\r\n\r\n","import { Injectable } from '@angular/core';\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class NgxSpinnerTextService {\r\n private currentText = '';\r\n\r\n public getText(): string {\r\n return this.currentText;\r\n }\r\n\r\n public setText(text: string): void {\r\n this.currentText = text;\r\n }\r\n}\r\n","import {OffsetModel} from './models/OffsetModel'\r\nimport {ViewPortModel} from './models/ViewPortModel'\r\nimport {ElementStyleUtil} from './_ElementStyleUtil'\r\nimport {DataUtil} from './_DataUtil'\r\nimport {ElementAnimateUtil} from './ElementAnimateUtil'\r\nimport {getObjectPropertyValueByKey, toJSON} from './_TypesHelpers'\r\n\r\nfunction getCSS(el: HTMLElement, styleProp: string) {\r\n const defaultView = (el.ownerDocument || document).defaultView\r\n\r\n if (!defaultView) {\r\n return ''\r\n }\r\n\r\n // sanitize property name to css notation\r\n // (hyphen separated words eg. font-Size)\r\n styleProp = styleProp.replace(/([A-Z])/g, '-$1').toLowerCase()\r\n\r\n return defaultView.getComputedStyle(el, null).getPropertyValue(styleProp)\r\n}\r\n\r\nfunction getCSSVariableValue(variableName: string) {\r\n let hex = getComputedStyle(document.documentElement).getPropertyValue(variableName)\r\n if (hex && hex.length > 0) {\r\n hex = hex.trim()\r\n }\r\n\r\n return hex\r\n}\r\n\r\nfunction getElementActualCss(el: HTMLElement, prop: any, cache: boolean) {\r\n let css = ''\r\n\r\n if (!el.getAttribute('kt-hidden-' + prop) || cache === false) {\r\n let value\r\n\r\n // the element is hidden so:\r\n // making the el block so we can meassure its height but still be hidden\r\n css = el.style.cssText\r\n el.style.cssText = 'position: absolute; visibility: hidden; display: block;'\r\n\r\n if (prop === 'width') {\r\n value = el.offsetWidth\r\n } else if (prop === 'height') {\r\n value = el.offsetHeight\r\n }\r\n\r\n el.style.cssText = css\r\n\r\n // store it in cache\r\n if (value !== undefined) {\r\n el.setAttribute('kt-hidden-' + prop, value.toString())\r\n return parseFloat(value.toString())\r\n }\r\n return 0\r\n } else {\r\n // store it in cache\r\n const attributeValue = el.getAttribute('kt-hidden-' + prop)\r\n if (attributeValue || attributeValue === '0') {\r\n return parseFloat(attributeValue)\r\n }\r\n }\r\n}\r\n\r\nfunction getElementActualHeight(el: HTMLElement) {\r\n return getElementActualCss(el, 'height', false)\r\n}\r\n\r\nfunction getElementActualWidth(el: HTMLElement, cache?: boolean) {\r\n return getElementActualCss(el, 'width', false)\r\n}\r\n\r\nfunction getElementIndex(element: HTMLElement) {\r\n if (element.parentNode) {\r\n const c = element.parentNode.children\r\n for (let i = 0; i < c.length; i++) {\r\n if (c[i] === element) return i\r\n }\r\n }\r\n return -1\r\n}\r\n\r\n// https://developer.mozilla.org/en-US/docs/Web/API/Element/matches\r\nfunction getElementMatches(element: HTMLElement, selector: string) {\r\n const p = Element.prototype\r\n const f = p.matches || p.webkitMatchesSelector\r\n\r\n if (element && element.tagName) {\r\n return f.call(element, selector)\r\n } else {\r\n return false\r\n }\r\n}\r\n\r\nfunction getElementOffset(el: HTMLElement): OffsetModel {\r\n // Return zeros for disconnected and hidden (display: none) elements (gh-2310)\r\n // Support: IE <=11 only\r\n // Running getBoundingClientRect on a\r\n // disconnected node in IE throws an error\r\n if (!el.getClientRects().length) {\r\n return {top: 0, left: 0}\r\n }\r\n\r\n // Get document-relative position by adding viewport scroll to viewport-relative gBCR\r\n const rect = el.getBoundingClientRect()\r\n const win = el.ownerDocument.defaultView\r\n if (win) {\r\n return {\r\n top: rect.top + win.pageYOffset,\r\n left: rect.left + win.pageXOffset,\r\n }\r\n }\r\n\r\n return rect\r\n}\r\n\r\nfunction getElementParents(element: Element, selector: string) {\r\n // Element.matches() polyfill\r\n if (!Element.prototype.matches) {\r\n Element.prototype.matches = function (s) {\r\n const matches = (document || this.ownerDocument).querySelectorAll(s)\r\n let i = matches.length\r\n while (--i >= 0 && matches.item(i) !== this) {}\r\n return i > -1\r\n }\r\n }\r\n\r\n // Set up a parent array\r\n const parents: Array = []\r\n\r\n let el: Element | null = element\r\n\r\n // Push each parent element to the array\r\n for (; el && el !== document.body; el = el.parentElement) {\r\n if (selector) {\r\n if (el.matches(selector)) {\r\n parents.push(el)\r\n }\r\n continue\r\n }\r\n parents.push(el)\r\n }\r\n\r\n // Return our parent array\r\n return parents\r\n}\r\n\r\nfunction getHighestZindex(el: HTMLElement) {\r\n let bufferNode: Node | null = el as Node\r\n let buffer = el\r\n while (bufferNode && bufferNode !== document) {\r\n // Ignore z-index if position is set to a value where z-index is ignored by the browser\r\n // This makes behavior of this function consistent across browsers\r\n // WebKit always returns auto if the element is positioned\r\n const position = buffer.style.getPropertyValue('position')\r\n if (position === 'absolute' || position === 'relative' || position === 'fixed') {\r\n // IE returns 0 when zIndex is not specified\r\n // other browsers return a string\r\n // we ignore the case of nested elements with an explicit value of 0\r\n //
\r\n const value = parseInt(buffer.style.getPropertyValue('z-index'))\r\n if (!isNaN(value) && value !== 0) {\r\n return value\r\n }\r\n }\r\n\r\n bufferNode = bufferNode.parentNode\r\n buffer = bufferNode as HTMLElement\r\n }\r\n return null\r\n}\r\n\r\nfunction getScrollTop(): number {\r\n return (document.scrollingElement || document.documentElement).scrollTop\r\n}\r\n\r\n// https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth\r\nfunction getViewPort(): ViewPortModel {\r\n return {\r\n width: window.innerWidth,\r\n height: window.innerHeight,\r\n }\r\n}\r\n\r\nfunction insertAfterElement(el: HTMLElement, referenceNode: HTMLElement) {\r\n return referenceNode.parentNode?.insertBefore(el, referenceNode.nextSibling)\r\n}\r\n\r\nfunction isElementHasClasses(element: HTMLElement, classesStr: string): boolean {\r\n const classes = classesStr.split(' ')\r\n for (let i = 0; i < classes.length; i++) {\r\n if (!element.classList.contains(classes[i])) {\r\n return false\r\n }\r\n }\r\n\r\n return true\r\n}\r\n\r\nfunction isVisibleElement(element: HTMLElement): boolean {\r\n return !(element.offsetWidth === 0 && element.offsetHeight === 0)\r\n}\r\n\r\n// Throttle function: Input as function which needs to be throttled and delay is the time interval in milliseconds\r\nfunction throttle(timer: number | undefined, func: Function, delay?: number) {\r\n // If setTimeout is already scheduled, no need to do anything\r\n if (timer) {\r\n return\r\n }\r\n\r\n // Schedule a setTimeout after delay seconds\r\n timer = window.setTimeout(function () {\r\n func()\r\n\r\n // Once setTimeout function execution is finished, timerId = undefined so that in \r\n // the next scroll event function execution can be scheduled by the setTimeout\r\n timer = undefined\r\n }, delay)\r\n}\r\n\r\nfunction getElementChildren(element: HTMLElement, selector: string): Array | null {\r\n if (!element || !element.childNodes) {\r\n return null\r\n }\r\n\r\n const result: Array = []\r\n for (let i = 0; i < element.childNodes.length; i++) {\r\n const child = element.childNodes[i]\r\n // child.nodeType == 1 => Element, Text, Comment, ProcessingInstruction, CDATASection, EntityReference\r\n if (child.nodeType === 1 && getElementMatches(child as HTMLElement, selector)) {\r\n result.push(child as HTMLElement)\r\n }\r\n }\r\n\r\n return result\r\n}\r\n\r\nfunction getElementChild(element: HTMLElement, selector: string): HTMLElement | null {\r\n const children = getElementChildren(element, selector)\r\n return children ? children[0] : null\r\n}\r\n\r\nfunction isMobileDevice(): boolean {\r\n let test = getViewPort().width < +getBreakpoint('lg') ? true : false\r\n\r\n if (test === false) {\r\n // For use within normal web clients\r\n test = navigator.userAgent.match(/iPad/i) != null\r\n }\r\n\r\n return test\r\n}\r\n\r\nfunction slide(el: HTMLElement, dir: string, speed: number, callback: any) {\r\n if (\r\n !el ||\r\n (dir === 'up' && isVisibleElement(el) === false) ||\r\n (dir === 'down' && isVisibleElement(el) === true)\r\n ) {\r\n return\r\n }\r\n\r\n speed = speed ? speed : 600\r\n let calcHeight = getElementActualHeight(el)\r\n let calcPaddingTop: number = 0\r\n let calcPaddingBottom: number = 0\r\n\r\n if (ElementStyleUtil.get(el, 'padding-top') && DataUtil.get(el, 'slide-padding-top') !== true) {\r\n DataUtil.set(el, 'slide-padding-top', ElementStyleUtil.get(el, 'padding-top'))\r\n }\r\n\r\n if (\r\n ElementStyleUtil.get(el, 'padding-bottom') &&\r\n DataUtil.has(el, 'slide-padding-bottom') !== true\r\n ) {\r\n DataUtil.set(el, 'slide-padding-bottom', ElementStyleUtil.get(el, 'padding-bottom'))\r\n }\r\n\r\n if (DataUtil.has(el, 'slide-padding-top')) {\r\n const data = DataUtil.get(el, 'slide-padding-top') as string\r\n calcPaddingTop = parseInt(data as string)\r\n }\r\n\r\n if (DataUtil.has(el, 'slide-padding-bottom')) {\r\n const data = DataUtil.get(el, 'slide-padding-bottom') as string\r\n calcPaddingBottom = parseInt(data)\r\n }\r\n\r\n if (dir === 'up') {\r\n // up\r\n el.style.cssText = 'display: block; overflow: hidden;'\r\n\r\n if (calcPaddingTop) {\r\n ElementAnimateUtil.animate(0, calcPaddingTop, speed, function (value: number) {\r\n el.style.paddingTop = calcPaddingTop - value + 'px'\r\n })\r\n }\r\n\r\n if (calcPaddingBottom) {\r\n ElementAnimateUtil.animate(0, calcPaddingBottom, speed, function (value: number) {\r\n el.style.paddingBottom = calcPaddingBottom - value + 'px'\r\n })\r\n }\r\n\r\n ElementAnimateUtil.animate(\r\n 0,\r\n calcHeight || 0,\r\n speed,\r\n function (value: number) {\r\n el.style.height = (calcHeight || 0) - value + 'px'\r\n },\r\n function () {\r\n el.style.height = ''\r\n el.style.display = 'none'\r\n\r\n if (typeof callback === 'function') {\r\n callback()\r\n }\r\n }\r\n )\r\n } else if (dir === 'down') {\r\n // down\r\n el.style.cssText = 'display: block; overflow: hidden;'\r\n\r\n if (calcPaddingTop) {\r\n ElementAnimateUtil.animate(\r\n 0,\r\n calcPaddingTop,\r\n speed,\r\n function (value: number) {\r\n //\r\n el.style.paddingTop = value + 'px'\r\n },\r\n function () {\r\n el.style.paddingTop = ''\r\n }\r\n )\r\n }\r\n\r\n if (calcPaddingBottom) {\r\n ElementAnimateUtil.animate(\r\n 0,\r\n calcPaddingBottom,\r\n speed,\r\n function (value: number) {\r\n el.style.paddingBottom = value + 'px'\r\n },\r\n function () {\r\n el.style.paddingBottom = ''\r\n }\r\n )\r\n }\r\n\r\n ElementAnimateUtil.animate(\r\n 0,\r\n calcHeight || 0,\r\n speed,\r\n function (value: number) {\r\n el.style.height = value + 'px'\r\n },\r\n function () {\r\n el.style.height = ''\r\n el.style.display = ''\r\n el.style.overflow = ''\r\n\r\n if (typeof callback === 'function') {\r\n callback()\r\n }\r\n }\r\n )\r\n }\r\n}\r\n\r\nfunction slideUp(el: HTMLElement, speed: number, callback: any) {\r\n slide(el, 'up', speed, callback)\r\n}\r\n\r\nfunction slideDown(el: HTMLElement, speed: number, callback: any) {\r\n slide(el, 'down', speed, callback)\r\n}\r\n\r\nfunction getBreakpoint(breakpoint: string) {\r\n let value: number | string = getCSSVariableValue('--bs-' + breakpoint)\r\n if (value) {\r\n value = parseInt(value.trim())\r\n }\r\n\r\n return value\r\n}\r\n\r\nfunction getAttributeValueByBreakpoint(incomingAttr: string): string | JSON {\r\n let value = toJSON(incomingAttr)\r\n if (typeof value !== 'object') {\r\n return incomingAttr\r\n }\r\n\r\n const width = getViewPort().width\r\n let resultKey\r\n let resultBreakpoint = -1\r\n let breakpoint\r\n\r\n for (let key in value) {\r\n if (key === 'default') {\r\n breakpoint = 0\r\n } else {\r\n breakpoint = getBreakpoint(key) ? +getBreakpoint(key) : parseInt(key)\r\n }\r\n\r\n if (breakpoint <= width && breakpoint > resultBreakpoint) {\r\n resultKey = key\r\n resultBreakpoint = breakpoint\r\n }\r\n }\r\n\r\n return resultKey ? getObjectPropertyValueByKey(value, resultKey) : value\r\n}\r\n\r\nfunction colorLighten(color: string, amount: number) {\r\n const addLight = (_color: string, _amount: number) => {\r\n const cc = parseInt(_color, 16) + _amount\r\n const cNum = cc > 255 ? 255 : cc\r\n const c = cNum.toString(16).length > 1 ? cNum.toString(16) : `0${cNum.toString(16)}`\r\n return c\r\n }\r\n\r\n color = color.indexOf('#') >= 0 ? color.substring(1, color.length) : color\r\n amount = parseInt(((255 * amount) / 100).toString())\r\n return (color = `#${addLight(color.substring(0, 2), amount)}${addLight(\r\n color.substring(2, 4),\r\n amount\r\n )}${addLight(color.substring(4, 6), amount)}`)\r\n}\r\n\r\nfunction colorDarken(color: string, amount: number) {\r\n const subtractLight = (_color: string, _amount: number) => {\r\n const cc = parseInt(color, 16) - amount\r\n const cNum = cc < 0 ? 0 : cc\r\n const c = cNum.toString(16).length > 1 ? cNum.toString(16) : `0${cNum.toString(16)}`\r\n return c\r\n }\r\n\r\n color = color.indexOf('#') >= 0 ? color.substring(1, color.length) : color\r\n amount = parseInt(((255 * amount) / 100).toString())\r\n\r\n return (color = `#${subtractLight(color.substring(0, 2), amount)}${subtractLight(\r\n color.substring(2, 4),\r\n amount\r\n )}${subtractLight(color.substring(4, 6), amount)}`)\r\n}\r\n\r\nexport {\r\n getBreakpoint,\r\n getCSS,\r\n getCSSVariableValue,\r\n getElementActualCss,\r\n getElementActualHeight,\r\n getElementActualWidth,\r\n getElementIndex,\r\n getElementMatches,\r\n getElementOffset,\r\n getElementParents,\r\n getHighestZindex,\r\n getScrollTop,\r\n getViewPort,\r\n insertAfterElement,\r\n isElementHasClasses,\r\n isVisibleElement,\r\n throttle,\r\n getElementChildren,\r\n getElementChild,\r\n isMobileDevice,\r\n slide,\r\n slideUp,\r\n slideDown,\r\n getAttributeValueByBreakpoint,\r\n colorLighten,\r\n colorDarken,\r\n}\r\n","import {DOMEventHandlerUtil} from './_DOMEventHandlerUtil'\r\nimport {ElementStyleUtil} from './_ElementStyleUtil'\r\nimport {getElementOffset} from './DomHelpers'\r\n\r\nexport class ElementAnimateUtil {\r\n public static animate(\r\n from: number,\r\n to: number,\r\n duration: number,\r\n update: Function,\r\n complete?: Function\r\n ) {\r\n /**\r\n * TinyAnimate.easings\r\n * Adapted from jQuery Easing\r\n */\r\n const easings = {\r\n linear: function (t: number, b: number, c: number, d: number) {\r\n return (c * t) / d + b\r\n },\r\n }\r\n\r\n // Create mock done() function if necessary\r\n if (!complete) {\r\n complete = function () {}\r\n }\r\n\r\n // Animation loop\r\n // let canceled = false;\r\n const change = to - from\r\n\r\n function loop(timestamp: number) {\r\n var time = (timestamp || +new Date()) - start\r\n\r\n if (time >= 0) {\r\n update(easings.linear(time, from, change, duration))\r\n }\r\n if (time >= 0 && time >= duration) {\r\n update(to)\r\n if (complete) {\r\n complete()\r\n }\r\n } else {\r\n window.requestAnimationFrame(loop)\r\n }\r\n }\r\n\r\n update(from)\r\n\r\n // Start animation loop\r\n const start =\r\n window.performance && window.performance.now ? window.performance.now() : +new Date()\r\n\r\n window.requestAnimationFrame(loop)\r\n }\r\n\r\n public static animateClass(\r\n element: HTMLElement,\r\n animationName: string,\r\n callBack?: Function\r\n ): void {\r\n const animateClasses = animationName.split(' ')\r\n animateClasses.forEach((cssClass) => element.classList.add(cssClass))\r\n DOMEventHandlerUtil.one(element, 'animationend', function () {\r\n animateClasses.forEach((cssClass) => element.classList.remove(cssClass))\r\n })\r\n\r\n if (callBack) {\r\n DOMEventHandlerUtil.one(element, 'animationend', callBack)\r\n }\r\n }\r\n\r\n public static transitionEnd(element: HTMLElement, callBack: Function) {\r\n DOMEventHandlerUtil.one(element, 'transitionend', callBack)\r\n }\r\n\r\n public static animationEnd(element: HTMLElement, callBack: Function) {\r\n DOMEventHandlerUtil.one(element, 'animationend', callBack)\r\n }\r\n\r\n public static animationDelay(element: HTMLElement, value: string) {\r\n ElementStyleUtil.set(element, 'animation-delay', value)\r\n }\r\n\r\n public static animationDuration(element: HTMLElement, value: string) {\r\n ElementStyleUtil.set(element, 'animation-duration', value)\r\n }\r\n\r\n public static scrollTo(element: HTMLElement | null, offset: number, duration: number = 500) {\r\n let targetPos = element ? getElementOffset(element).top : 0\r\n let scrollPos =\r\n window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0\r\n\r\n if (offset) {\r\n scrollPos += offset\r\n targetPos = targetPos - offset\r\n }\r\n\r\n const from = scrollPos\r\n const to = targetPos\r\n\r\n ElementAnimateUtil.animate(from, to, duration, function (value: number) {\r\n document.documentElement.scrollTop = value\r\n // document.body.parentNode.scrollTop = value;\r\n document.body.scrollTop = value\r\n }) //, easing, done\r\n }\r\n public static scrollTop(offset: number, duration: number) {\r\n ElementAnimateUtil.scrollTo(null, offset, duration)\r\n }\r\n}\r\n","import {DataUtil} from './_DataUtil'\r\nimport {getUniqueIdWithPrefix} from './_TypesHelpers'\r\n\r\nexport interface EventMeta {\r\n name: string\r\n callback: Function\r\n one: boolean\r\n fired: boolean\r\n}\r\n\r\nexport class EventHandlerUtil {\r\n static store: {\r\n [name: string]: {\r\n [handlerId: string]: EventMeta\r\n }\r\n } = {}\r\n\r\n private static setEventMetasByName(\r\n name: string,\r\n handlers: {\r\n [handlerId: string]: EventMeta\r\n }\r\n ): void {\r\n EventHandlerUtil.store[name] = handlers\r\n }\r\n\r\n private static getEventMetaByName(name: string):\r\n | {\r\n [handlerId: string]: EventMeta\r\n }\r\n | undefined {\r\n return EventHandlerUtil.store[name]\r\n }\r\n\r\n private static setEventMetaByNameAndHandlerId(\r\n name: string,\r\n handlerId: string,\r\n meta: EventMeta\r\n ): void {\r\n if (EventHandlerUtil.store[name]) {\r\n EventHandlerUtil.store[name][handlerId] = meta\r\n return\r\n }\r\n EventHandlerUtil.store[name] = {}\r\n EventHandlerUtil.store[name][handlerId] = meta\r\n }\r\n\r\n private static getEventMetaByHandlerId(name: string, handlerId: string): EventMeta | undefined {\r\n const handlersIds = EventHandlerUtil.store[name]\r\n if (!handlersIds) {\r\n return\r\n }\r\n return handlersIds[handlerId]\r\n }\r\n\r\n private static setFiredByNameAndHandlerId(name: string, handerId: string, fired: boolean): void {\r\n const meta = EventHandlerUtil.getEventMetaByHandlerId(name, handerId)\r\n if (!meta) {\r\n return\r\n }\r\n\r\n meta.fired = fired\r\n EventHandlerUtil.setEventMetaByNameAndHandlerId(name, handerId, meta)\r\n }\r\n\r\n private static addEvent(\r\n element: HTMLElement,\r\n name: string,\r\n callback: Function,\r\n one: boolean = false\r\n ): string {\r\n const handlerId = getUniqueIdWithPrefix('event')\r\n const data = DataUtil.get(element, name)\r\n const handlersIds = data ? (data as string[]) : []\r\n handlersIds.push(handlerId)\r\n\r\n DataUtil.set(element, name, handlersIds)\r\n\r\n const meta: EventMeta = {\r\n name: name,\r\n callback: callback,\r\n one: one,\r\n fired: false,\r\n }\r\n\r\n EventHandlerUtil.setEventMetaByNameAndHandlerId(name, handlerId, meta)\r\n return handlerId\r\n }\r\n\r\n private static removeEvent(element: HTMLElement, name: string, handerId: string) {\r\n DataUtil.removeOne(element, name, handerId)\r\n const handlersIds = EventHandlerUtil.store[name]\r\n if (handlersIds) {\r\n return\r\n }\r\n\r\n delete EventHandlerUtil.store[name][handerId]\r\n }\r\n\r\n public static trigger(element: HTMLElement, name: string, target?: any, e?: Event): boolean {\r\n let returnValue = true\r\n if (!DataUtil.has(element, name)) {\r\n return returnValue\r\n }\r\n\r\n let eventValue\r\n let handlerId\r\n const data = DataUtil.get(element, name)\r\n const handlersIds = data ? (data as string[]) : []\r\n for (let i = 0; i < handlersIds.length; i++) {\r\n handlerId = handlersIds[i]\r\n if (EventHandlerUtil.store[name] && EventHandlerUtil.store[name][handlerId]) {\r\n const handler = EventHandlerUtil.store[name][handlerId]\r\n if (handler.name === name) {\r\n if (handler.one) {\r\n if (handler.fired) {\r\n EventHandlerUtil.store[name][handlerId].fired = true\r\n eventValue = handler.callback.call(this, target)\r\n }\r\n } else {\r\n eventValue = handler.callback.call(this, target)\r\n }\r\n\r\n if (eventValue === false) {\r\n returnValue = false\r\n }\r\n }\r\n }\r\n }\r\n return returnValue\r\n }\r\n\r\n public static on = function (element: HTMLElement, name: string, callBack: Function): void {\r\n EventHandlerUtil.addEvent(element, name, callBack, false)\r\n }\r\n\r\n public static one(element: HTMLElement, name: string, callBack: Function): void {\r\n EventHandlerUtil.addEvent(element, name, callBack, true)\r\n }\r\n\r\n public static off(element: HTMLElement, name: string, handerId: string): void {\r\n EventHandlerUtil.removeEvent(element, name, handerId)\r\n }\r\n}\r\n","import {getUniqueIdWithPrefix} from './_TypesHelpers'\r\n\r\nexport class DOMEventHandlerUtil {\r\n public static store = new Map()\r\n\r\n public static on(\r\n element: HTMLElement,\r\n selector: string,\r\n eventName: string,\r\n callBack: any\r\n ): string {\r\n const eventId = getUniqueIdWithPrefix('DOMEvent')\r\n DOMEventHandlerUtil.store.set(eventId, (e: Event) => {\r\n const targets = element.querySelectorAll(selector)\r\n let target: HTMLElement | null = e.target as HTMLElement\r\n while (target && target !== element) {\r\n for (let i = 0; i < targets.length; i++) {\r\n if (target === targets[i]) {\r\n callBack.call(target, e)\r\n }\r\n }\r\n\r\n if (target.parentElement) {\r\n target = target.parentElement\r\n } else {\r\n target = null\r\n }\r\n }\r\n })\r\n element.addEventListener(eventName, DOMEventHandlerUtil.store.get(eventId))\r\n return eventId\r\n }\r\n\r\n public static off(element: HTMLElement, eventName: string, eventId: string): void {\r\n const funcFromStore = DOMEventHandlerUtil.store.get(eventId)\r\n if (!funcFromStore) {\r\n return\r\n }\r\n\r\n element.removeEventListener(eventName, funcFromStore)\r\n DOMEventHandlerUtil.store.delete(eventId)\r\n }\r\n\r\n public static one(element: HTMLElement, eventName: string, callBack: Function): void {\r\n element.addEventListener(eventName, function calee(e) {\r\n // remove event\r\n if (e.target && e.target.removeEventListener) {\r\n e.target.removeEventListener(e.type, calee)\r\n }\r\n\r\n if (element && e && e.currentTarget) {\r\n // if (element && element.removeEventListener && e && e.currentTarget) {\r\n e.currentTarget.removeEventListener(e.type, calee)\r\n }\r\n\r\n // call hander\r\n return callBack(e)\r\n })\r\n }\r\n}\r\n","export class DataUtil {\r\n static store: Map> = new Map()\r\n\r\n public static set(instance: HTMLElement | undefined, key: string, data: unknown): void {\r\n if (!instance) {\r\n return\r\n }\r\n\r\n const instanceData = DataUtil.store.get(instance)\r\n if (!instanceData) {\r\n const newMap = new Map().set(key, data)\r\n DataUtil.store.set(instance, newMap)\r\n return\r\n }\r\n\r\n instanceData.set(key, data)\r\n }\r\n\r\n public static get(instance: HTMLElement, key: string): unknown | undefined {\r\n const instanceData = DataUtil.store.get(instance)\r\n if (!instanceData) {\r\n return\r\n }\r\n\r\n return instanceData.get(key)\r\n }\r\n\r\n public static remove(instance: HTMLElement, key: string): void {\r\n const instanceData = DataUtil.store.get(instance)\r\n if (!instanceData) {\r\n return\r\n }\r\n\r\n instanceData.delete(key)\r\n }\r\n\r\n public static removeOne(instance: HTMLElement, key: string, eventId: string) {\r\n const instanceData = DataUtil.store.get(instance)\r\n if (!instanceData) {\r\n return\r\n }\r\n\r\n const eventsIds = instanceData.get(key)\r\n if (!eventsIds) {\r\n return\r\n }\r\n\r\n const updateEventsIds = (eventsIds as string[]).filter((f) => f !== eventId)\r\n DataUtil.set(instance, key, updateEventsIds)\r\n }\r\n\r\n public static has(instance: HTMLElement, key: string): boolean {\r\n const instanceData = DataUtil.store.get(instance)\r\n if (instanceData) {\r\n return instanceData.has(key)\r\n }\r\n\r\n return false\r\n }\r\n\r\n public static getAllInstancesByKey(key: string) {\r\n const result: any[] = []\r\n DataUtil.store.forEach((val) => {\r\n val.forEach((v, k) => {\r\n if (k === key) {\r\n result.push(v)\r\n }\r\n })\r\n })\r\n return result\r\n }\r\n}\r\n","export class ElementStyleUtil {\r\n public static set(element: HTMLElement, property: string, value?: any, important?: boolean) {\r\n if (important) {\r\n element.style.setProperty(property, value, 'important')\r\n } else {\r\n element.style.setProperty(property, value)\r\n }\r\n }\r\n\r\n public static get(element: HTMLElement, attributeName: string) {\r\n return element.style.getPropertyValue(attributeName)\r\n }\r\n\r\n public static remove(element: HTMLElement, attibuteName: string) {\r\n element.style.removeProperty(attibuteName)\r\n }\r\n}\r\n","function getObjectPropertyValueByKey(obj: any, key: string): any | undefined {\r\n const map = new Map(Object.entries(obj))\r\n if (obj.hasOwnProperty(key) && map) {\r\n return map.get(key)\r\n }\r\n}\r\n\r\n/**\r\n * Generates unique ID for give prefix.\r\n * @param {string} prefix Prefix for generated ID\r\n * @returns {boolean}\r\n */\r\nfunction getUniqueIdWithPrefix(prefix: string | undefined): string {\r\n const result = Math.floor(Math.random() * new Date().getTime()).toString()\r\n if (!prefix) {\r\n return result\r\n }\r\n\r\n return `${prefix}${result}`\r\n}\r\n\r\n/* eslint-disable no-useless-escape */\r\nfunction stringSnakeToCamel(str: string): string {\r\n return str.replace(/(\\-\\w)/g, function (m) {\r\n return m[1].toUpperCase()\r\n })\r\n}\r\n\r\nfunction toJSON(value: string | JSON): JSON | undefined {\r\n if (typeof value !== 'string') {\r\n return value\r\n }\r\n\r\n if (!value) {\r\n return undefined\r\n }\r\n\r\n // (\"'\" => \"\\\"\");\r\n const result = value\r\n .toString()\r\n .split('')\r\n .map((el) => (el !== \"'\" ? el : '\"'))\r\n .join('')\r\n var jsonStr = result.replace(/(\\w+:)|(\\w+ :)/g, function (matched) {\r\n return '\"' + matched.substring(0, matched.length - 1) + '\":'\r\n })\r\n try {\r\n return JSON.parse(jsonStr)\r\n } catch {\r\n return undefined\r\n }\r\n}\r\n\r\nexport {getObjectPropertyValueByKey, getUniqueIdWithPrefix, stringSnakeToCamel, toJSON}\r\n","// Types\r\nexport * from './models/OffsetModel'\r\nexport * from './models/ViewPortModel'\r\n// Helpers\r\nexport * from './DomHelpers'\r\nexport * from './_TypesHelpers'\r\n// Basic\r\nexport * from './_DataUtil'\r\nexport * from './_DOMEventHandlerUtil'\r\nexport * from './_ElementStyleUtil'\r\nexport * from './ElementAnimateUtil'\r\nexport * from './EventHandlerUtil'\r\n","import {createPopper, VirtualElement} from '@popperjs/core'\r\nimport {\r\n getElementChild,\r\n getElementParents,\r\n getAttributeValueByBreakpoint,\r\n getUniqueIdWithPrefix,\r\n DataUtil,\r\n ElementStyleUtil,\r\n EventHandlerUtil,\r\n insertAfterElement,\r\n slideUp,\r\n slideDown,\r\n DOMEventHandlerUtil,\r\n throttle,\r\n getHighestZindex,\r\n} from '../_utils/index'\r\n\r\nexport interface MenuOptions {\r\n dropdown: {\r\n hoverTimeout: number\r\n zindex: number\r\n }\r\n accordion: {\r\n slideSpeed: number\r\n expand: boolean\r\n }\r\n}\r\n\r\nconst defaultMenuOptions: MenuOptions = {\r\n dropdown: {\r\n hoverTimeout: 200,\r\n zindex: 105,\r\n },\r\n accordion: {\r\n slideSpeed: 250,\r\n expand: false,\r\n },\r\n}\r\n\r\ntype PopperPlacement =\r\n | 'right'\r\n | 'auto'\r\n | 'auto-start'\r\n | 'auto-end'\r\n | 'top'\r\n | 'bottom'\r\n | 'left'\r\n | 'top-start'\r\n | 'top-end'\r\n | 'bottom-start'\r\n | 'bottom-end'\r\n | 'right-start'\r\n | 'right-end'\r\n | 'left-start'\r\n | 'left-end'\r\n | undefined\r\n\r\nclass MenuComponent {\r\n element: HTMLElement\r\n options: MenuOptions\r\n instanceUid: string\r\n triggerElement: HTMLElement | null = null\r\n\r\n constructor(_element: HTMLElement, options: MenuOptions) {\r\n this.element = _element\r\n this.options = Object.assign(defaultMenuOptions, options)\r\n this.instanceUid = getUniqueIdWithPrefix('menu')\r\n // this.element.setAttribute('data-kt-menu', 'true')\r\n this._setTriggerElement()\r\n this._update()\r\n DataUtil.set(this.element, 'menu', this)\r\n return this\r\n }\r\n\r\n // Set external trigger element\r\n private _setTriggerElement = () => {\r\n const target = document.querySelector(\r\n `[data-kt-menu-target=\"#${this.element.getAttribute('id')}\"`\r\n )\r\n\r\n if (target) {\r\n this.triggerElement = target as HTMLElement\r\n } else if (this.element.closest('[data-kt-menu-trigger]')) {\r\n this.triggerElement = this.element.closest('[data-kt-menu-trigger]') as HTMLElement\r\n } else if (\r\n this.element.parentNode &&\r\n getElementChild(this.element.parentNode as HTMLElement, '[data-kt-menu-trigger]')\r\n ) {\r\n const child = getElementChild(\r\n this.element.parentNode as HTMLElement,\r\n '[data-kt-menu-trigger]'\r\n )\r\n if (child) {\r\n this.triggerElement = child\r\n }\r\n }\r\n\r\n if (this.triggerElement) {\r\n DataUtil.set(this.triggerElement, 'menu', this)\r\n }\r\n }\r\n\r\n // Test if menu has external trigger element\r\n private _isTriggerElement = (item: HTMLElement) => {\r\n return this.triggerElement === item\r\n }\r\n\r\n // Get item option(through html attributes)\r\n private _getItemOption = (item: HTMLElement, name: string) => {\r\n let value: string | JSON | null | boolean = null\r\n if (item && item.hasAttribute('data-kt-menu-' + name)) {\r\n const attr = item.getAttribute('data-kt-menu-' + name) || ''\r\n value = getAttributeValueByBreakpoint(attr)\r\n if (value !== null && String(value) === 'true') {\r\n value = true\r\n } else if (value !== null && String(value) === 'false') {\r\n value = false\r\n }\r\n }\r\n return value\r\n }\r\n\r\n // Get item element\r\n private _getItemElement = (_element: HTMLElement): HTMLElement | undefined => {\r\n // Element is the external trigger element\r\n if (this._isTriggerElement(_element)) {\r\n return _element\r\n }\r\n\r\n // Element has item toggler attribute\r\n if (_element.hasAttribute('data-kt-menu-trigger')) {\r\n return _element\r\n }\r\n\r\n // Element has item DOM reference in it's data storage\r\n const itemElement = DataUtil.get(_element, 'item')\r\n if (itemElement) {\r\n return itemElement as HTMLElement\r\n }\r\n\r\n // Item is parent of element\r\n const item = _element.closest('.menu-item[data-kt-menu-trigger]')\r\n if (item) {\r\n return item\r\n }\r\n\r\n // Element's parent has item DOM reference in it's data storage\r\n const sub = _element.closest('.menu-sub')\r\n if (sub) {\r\n const subItem = DataUtil.get(sub as HTMLElement, 'item')\r\n if (subItem) {\r\n return subItem as HTMLElement\r\n }\r\n }\r\n }\r\n\r\n // Get item parent element\r\n private _getItemParentElement = (item: HTMLElement) => {\r\n const sub = item.closest('.menu-sub')\r\n if (!sub) {\r\n return null\r\n }\r\n\r\n const subItem = DataUtil.get(sub, 'item')\r\n if (subItem) {\r\n return subItem as HTMLElement\r\n }\r\n\r\n const parentItem = sub.closest('.menu-item[data-kt-menu-trigger]')\r\n if (sub && parentItem) {\r\n return parentItem\r\n }\r\n\r\n return null\r\n }\r\n\r\n // Get item parent elements\r\n private _getItemParentElements = (item: HTMLElement) => {\r\n const parents: Array = []\r\n let parent: HTMLElement | null\r\n let i = 0\r\n let buffer: HTMLElement = item\r\n\r\n do {\r\n parent = this._getItemParentElement(buffer)\r\n if (parent) {\r\n parents.push(parent)\r\n buffer = parent as HTMLElement\r\n }\r\n\r\n i++\r\n } while (parent !== null && i < 20)\r\n\r\n if (this.triggerElement) {\r\n parents.unshift(this.triggerElement)\r\n }\r\n\r\n return parents\r\n }\r\n\r\n // Prepare popper config for dropdown(see: https://popper.js.org/docs/v2/)\r\n private _getDropdownPopperConfig = (item: HTMLElement) => {\r\n // Placement\r\n const placementOption = this._getItemOption(item, 'placement')\r\n let placement: PopperPlacement = 'right'\r\n if (placementOption) {\r\n placement = placementOption as PopperPlacement\r\n }\r\n\r\n // Flip\r\n // const flipValue = this._getItemOption(item, 'flip')\r\n // const flip = flipValue ? flipValue.toString().split(',') : []\r\n\r\n // Offset\r\n const offsetValue = this._getItemOption(item, 'offset')\r\n const offset = offsetValue ? offsetValue.toString().split(',') : []\r\n\r\n // Strategy\r\n const strategy: 'absolute' | 'fixed' | undefined =\r\n this._getItemOption(item, 'overflow') === true ? 'absolute' : 'fixed'\r\n\r\n return {\r\n placement: placement,\r\n strategy: strategy,\r\n modifiers: [\r\n {\r\n name: 'offset',\r\n options: {\r\n offset: offset,\r\n },\r\n },\r\n {\r\n name: 'preventOverflow',\r\n },\r\n {\r\n name: 'flip',\r\n options: {\r\n // altBoundary: true,\r\n // fallbackPlacements: flip,\r\n flipVariations: false,\r\n },\r\n },\r\n ],\r\n }\r\n }\r\n\r\n // Get item child element\r\n private _getItemChildElement = (item: HTMLElement): HTMLElement | null => {\r\n let selector = item\r\n\r\n const subItem = DataUtil.get(item, 'sub')\r\n if (subItem) {\r\n selector = subItem as HTMLElement\r\n }\r\n\r\n if (selector) {\r\n //element = selector.querySelector('.show.menu-item[data-kt-menu-trigger]');\r\n const element = selector.querySelector('.menu-item[data-kt-menu-trigger]')\r\n if (element) {\r\n return element\r\n }\r\n }\r\n return null\r\n }\r\n\r\n // Get item child elements\r\n private _getItemChildElements = (item: HTMLElement) => {\r\n const children: Array = []\r\n let child: HTMLElement | null\r\n let i = 0\r\n let buffer = item\r\n do {\r\n child = this._getItemChildElement(buffer)\r\n if (child) {\r\n children.push(child)\r\n buffer = child as HTMLElement\r\n }\r\n\r\n i++\r\n } while (child !== null && i < 20)\r\n\r\n return children\r\n }\r\n\r\n // Get item sub element\r\n private _getItemSubElement = (item: HTMLElement): HTMLElement | null => {\r\n if (!item) {\r\n return null\r\n }\r\n\r\n if (this._isTriggerElement(item)) {\r\n return this.element\r\n }\r\n\r\n if (item.classList.contains('menu-sub')) {\r\n return item\r\n } else if (DataUtil.has(item, 'sub')) {\r\n const itemSub = DataUtil.get(item, 'sub')\r\n return itemSub ? (itemSub as HTMLElement) : null\r\n } else {\r\n return getElementChild(item, '.menu-sub')\r\n }\r\n }\r\n\r\n private _getCss = (el: HTMLElement, styleProp: string) => {\r\n const defaultView = (el.ownerDocument || document).defaultView\r\n if (!defaultView) {\r\n return ''\r\n }\r\n\r\n // sanitize property name to css notation\r\n // (hyphen separated words eg. font-Size)\r\n styleProp = styleProp.replace(/([A-Z])/g, '-$1').toLowerCase()\r\n\r\n return defaultView.getComputedStyle(el, null).getPropertyValue(styleProp)\r\n }\r\n\r\n // Get item sub type\r\n private _getItemSubType = (element: HTMLElement) => {\r\n const sub = this._getItemSubElement(element)\r\n if (sub && parseInt(this._getCss(sub as HTMLElement, 'z-index')) > 0) {\r\n return 'dropdown'\r\n } else {\r\n return 'accordion'\r\n }\r\n }\r\n\r\n // Test if item's sub is shown\r\n private _isItemSubShown = (item: HTMLElement) => {\r\n let sub = this._getItemSubElement(item)\r\n if (sub) {\r\n if (this._getItemSubType(item) === 'dropdown') {\r\n const subHTMLElement = sub as HTMLElement\r\n return (\r\n subHTMLElement.classList.contains('show') &&\r\n subHTMLElement.hasAttribute('data-popper-placement')\r\n )\r\n } else {\r\n return item.classList.contains('show')\r\n }\r\n }\r\n\r\n return false\r\n }\r\n\r\n // Test if item dropdown is permanent\r\n private _isItemDropdownPermanent = (item: HTMLElement) => {\r\n return this._getItemOption(item, 'permanent') === true\r\n }\r\n\r\n // Test if item's parent is shown\r\n private _isItemParentShown = (item: HTMLElement) => {\r\n return getElementParents(item, '.menu-item.show').length > 0\r\n }\r\n\r\n // Test of it is item sub element\r\n private _isItemSubElement = (item: HTMLElement) => {\r\n return item.classList.contains('menu-sub')\r\n }\r\n\r\n // Test if item has sub\r\n private _hasItemSub = (item: HTMLElement) => {\r\n return item.classList.contains('menu-item') && item.hasAttribute('data-kt-menu-trigger')\r\n }\r\n\r\n // Get link element\r\n private _getItemLinkElement = (item: HTMLElement) => {\r\n return getElementChild(item, '.menu-link')\r\n }\r\n\r\n // Get toggle element\r\n private _getItemToggleElement = (item: HTMLElement) => {\r\n if (this.triggerElement) {\r\n return this.triggerElement\r\n }\r\n\r\n return this._getItemLinkElement(item)\r\n }\r\n\r\n // Show item dropdown\r\n private _showDropdown = (item: HTMLElement) => {\r\n if (EventHandlerUtil.trigger(this.element, 'kt.menu.dropdown.show') === false) {\r\n return\r\n }\r\n\r\n // Hide all currently shown dropdowns except current one\r\n MenuComponent.hideDropdowns(item)\r\n\r\n // const toggle = this._isTriggerElement(item) ? item : this._getItemLinkElement(item);\r\n const sub = this._getItemSubElement(item)\r\n const width = this._getItemOption(item, 'width')\r\n const height = this._getItemOption(item, 'height')\r\n\r\n let zindex = this.options.dropdown.zindex\r\n const parentZindex = getHighestZindex(item) // update\r\n // Apply a new z-index if dropdown's toggle element or it's parent has greater z-index // update\r\n if (parentZindex !== null && parentZindex >= zindex) {\r\n zindex = parentZindex + 1\r\n }\r\n\r\n if (zindex && sub) {\r\n ElementStyleUtil.set(sub, 'z-index', zindex)\r\n }\r\n\r\n if (width && sub) {\r\n ElementStyleUtil.set(sub, 'width', width)\r\n }\r\n\r\n if (height && sub) {\r\n ElementStyleUtil.set(sub, 'height', height)\r\n }\r\n\r\n this.initDropdownPopper(item, sub as HTMLElement)\r\n\r\n item.classList.add('show')\r\n item.classList.add('menu-dropdown')\r\n sub?.classList.add('show')\r\n\r\n // Append the sub the the root of the menu\r\n if (this._getItemOption(item, 'overflow') === true) {\r\n if (sub) {\r\n document.body.appendChild(sub)\r\n DataUtil.set(item, 'sub', sub)\r\n DataUtil.set(sub, 'item', item)\r\n DataUtil.set(sub, 'menu', this)\r\n }\r\n } else {\r\n if (sub) {\r\n DataUtil.set(sub, 'item', item)\r\n }\r\n }\r\n\r\n EventHandlerUtil.trigger(this.element, 'kt.menu.dropdown.shown')\r\n }\r\n\r\n // Init dropdown popper(new)\r\n private initDropdownPopper = (item: HTMLElement, sub: HTMLElement) => {\r\n // Setup popper instance\r\n let reference\r\n const attach = this._getItemOption(item, 'attach') as string\r\n\r\n if (attach) {\r\n if (attach === 'parent') {\r\n reference = item.parentNode\r\n } else {\r\n reference = document.querySelector(attach)\r\n }\r\n } else {\r\n reference = item\r\n }\r\n\r\n if (reference) {\r\n const popper = createPopper(\r\n reference as Element | VirtualElement,\r\n sub,\r\n this._getDropdownPopperConfig(item)\r\n )\r\n DataUtil.set(item, 'popper', popper)\r\n }\r\n }\r\n\r\n // Hide item dropdown\r\n private _hideDropdown = (item: HTMLElement) => {\r\n if (EventHandlerUtil.trigger(this.element, 'kt.menu.dropdown.hide') === false) {\r\n return\r\n }\r\n\r\n const sub = this._getItemSubElement(item)\r\n if (sub) {\r\n ElementStyleUtil.set(sub, 'z-index', '')\r\n ElementStyleUtil.set(sub, 'width', '')\r\n ElementStyleUtil.set(sub, 'height', '')\r\n }\r\n\r\n item.classList.remove('show')\r\n item.classList.remove('menu-dropdown')\r\n if (sub) {\r\n sub.classList.remove('show')\r\n }\r\n\r\n // Append the sub back to it's parent\r\n if (this._getItemOption(item, 'overflow') === true) {\r\n if (item.classList.contains('menu-item')) {\r\n if (sub) {\r\n item.appendChild(sub)\r\n }\r\n } else {\r\n insertAfterElement(this.element, item)\r\n }\r\n\r\n if (sub) {\r\n DataUtil.remove(item, 'sub')\r\n DataUtil.remove(sub, 'item')\r\n DataUtil.remove(sub, 'menu')\r\n }\r\n }\r\n\r\n if (DataUtil.has(item, 'popper') === true) {\r\n // @ts-ignore\r\n DataUtil.get(item, 'popper').destroy()\r\n DataUtil.remove(item, 'popper')\r\n }\r\n\r\n // Destroy popper(new)\r\n this.destroyDropdownPopper(item)\r\n EventHandlerUtil.trigger(this.element, 'kt.menu.dropdown.hidden')\r\n }\r\n\r\n // Destroy dropdown popper(new)\r\n private destroyDropdownPopper = (item: HTMLElement) => {\r\n if (DataUtil.has(item, 'popper') === true) {\r\n // @ts-ignore\r\n DataUtil.get(item, 'popper').destroy()\r\n DataUtil.remove(item, 'popper')\r\n }\r\n\r\n EventHandlerUtil.trigger(this.element, 'kt.menu.dropdown.hidden')\r\n }\r\n\r\n private _showAccordion = (item: HTMLElement) => {\r\n if (EventHandlerUtil.trigger(this.element, 'kt.menu.accordion.show') === false) {\r\n return\r\n }\r\n\r\n if (this.options.accordion.expand === false) {\r\n this._hideAccordions(item)\r\n }\r\n\r\n if (DataUtil.has(item, 'popper') === true) {\r\n this._hideDropdown(item)\r\n }\r\n\r\n item.classList.add('hover') // updateWW\r\n item.classList.add('showing')\r\n\r\n const subElement = this._getItemSubElement(item)\r\n if (subElement) {\r\n const sub = subElement as HTMLElement\r\n slideDown(sub, this.options.accordion.slideSpeed, () => {\r\n item.classList.remove('showing')\r\n item.classList.add('show')\r\n sub.classList.add('show')\r\n EventHandlerUtil.trigger(this.element, 'kt.menu.accordion.shown')\r\n })\r\n }\r\n }\r\n\r\n private _hideAccordion = (item: HTMLElement) => {\r\n if (EventHandlerUtil.trigger(this.element, 'kt.menu.accordion.hide') === false) {\r\n return\r\n }\r\n\r\n const sub = this._getItemSubElement(item)\r\n item.classList.add('hiding')\r\n\r\n if (sub) {\r\n slideUp(sub, this.options.accordion.slideSpeed, () => {\r\n item.classList.remove('hiding')\r\n item.classList.remove('show')\r\n sub.classList.remove('show')\r\n item.classList.remove('hover') // update\r\n EventHandlerUtil.trigger(this.element, 'kt.menu.accordion.hidden')\r\n })\r\n }\r\n }\r\n\r\n // Hide all shown accordions of item\r\n private _hideAccordions = (item: HTMLElement) => {\r\n const itemsToHide = this.element.querySelectorAll('.hover[data-kt-menu-trigger]')\r\n if (itemsToHide && itemsToHide.length > 0) {\r\n for (var i = 0, len = itemsToHide.length; i < len; i++) {\r\n const itemToHide = itemsToHide[i] as HTMLElement\r\n\r\n if (\r\n this._getItemSubType(itemToHide) === 'accordion' &&\r\n itemToHide !== item &&\r\n item.contains(itemToHide) === false &&\r\n itemToHide.contains(item) === false\r\n ) {\r\n this._hideAccordion(itemToHide)\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Event Handlers\r\n // Reset item state classes if item sub type changed\r\n private _reset = (item: HTMLElement) => {\r\n if (this._hasItemSub(item) === false) {\r\n return\r\n }\r\n\r\n const sub = this._getItemSubElement(item)\r\n\r\n // Reset sub state if sub type is changed during the window resize\r\n if (DataUtil.has(item, 'type') && DataUtil.get(item, 'type') !== this._getItemSubType(item)) {\r\n // updated\r\n item.classList.remove('hover')\r\n item.classList.remove('show')\r\n item.classList.remove('show')\r\n if (sub) {\r\n sub.classList.remove('show')\r\n }\r\n } // updated\r\n }\r\n\r\n // TODO: not done\r\n private _destroy = () => {}\r\n\r\n // Update all item state classes if item sub type changed\r\n private _update = () => {\r\n const items = this.element.querySelectorAll('.menu-item[data-kt-menu-trigger]')\r\n items.forEach((el) => this._reset(el as HTMLElement))\r\n }\r\n\r\n // Hide item sub\r\n private _hide = (item: HTMLElement) => {\r\n if (!item) {\r\n return\r\n }\r\n\r\n if (this._isItemSubShown(item) === false) {\r\n return\r\n }\r\n\r\n if (this._getItemSubType(item) === 'dropdown') {\r\n this._hideDropdown(item)\r\n } else if (this._getItemSubType(item) === 'accordion') {\r\n this._hideAccordion(item)\r\n }\r\n }\r\n\r\n // Show item sub\r\n private _show = (item: HTMLElement) => {\r\n if (!item) {\r\n return\r\n }\r\n\r\n if (this._isItemSubShown(item) === true) {\r\n return\r\n }\r\n\r\n if (this._getItemSubType(item) === 'dropdown') {\r\n this._showDropdown(item) // // show current dropdown\r\n } else if (this._getItemSubType(item) === 'accordion') {\r\n this._showAccordion(item)\r\n }\r\n\r\n // Remember last submenu type\r\n\r\n DataUtil.set(item, 'type', this._getItemSubType(item)) // updated\r\n }\r\n\r\n // Toggle item sub\r\n private _toggle = (item: HTMLElement) => {\r\n if (!item) {\r\n return\r\n }\r\n\r\n if (this._isItemSubShown(item) === true) {\r\n this._hide(item)\r\n } else {\r\n this._show(item)\r\n }\r\n }\r\n\r\n // Mouseout handle\r\n private _mouseout = (element: HTMLElement, e: MouseEvent) => {\r\n const item = this._getItemElement(element)\r\n if (!item) {\r\n return\r\n }\r\n\r\n if (this._getItemOption(item, 'trigger') !== 'hover') {\r\n return\r\n }\r\n\r\n const timeout = setTimeout(() => {\r\n if (DataUtil.get(item, 'hover') === '1') {\r\n this._hide(item)\r\n }\r\n }, this.options.dropdown.hoverTimeout)\r\n\r\n DataUtil.set(item, 'hover', '1')\r\n DataUtil.set(item, 'timeout', timeout)\r\n }\r\n\r\n // Mouseover handle\r\n private _mouseover = (element: HTMLElement, e: MouseEvent) => {\r\n const item = this._getItemElement(element)\r\n if (!item) {\r\n return\r\n }\r\n\r\n if (this._getItemOption(item, 'trigger') !== 'hover') {\r\n return\r\n }\r\n\r\n if (DataUtil.get(item, 'hover') === '1') {\r\n const timeout = DataUtil.get(item, 'timeout')\r\n if (timeout) {\r\n clearTimeout(timeout as number)\r\n }\r\n DataUtil.remove(item, 'hover')\r\n DataUtil.remove(item, 'timeout')\r\n }\r\n\r\n this._show(item)\r\n }\r\n\r\n // Dismiss handler\r\n private _dismiss = (element: HTMLElement, e: Event) => {\r\n const item = this._getItemElement(element)\r\n if (!item) {\r\n return\r\n }\r\n const items = this._getItemChildElements(item)\r\n //if ( item !== null && _getItemOption(item, 'trigger') === 'click' && _getItemSubType(item) === 'dropdown' ) {\r\n const itemSubType = this._getItemSubType(item)\r\n if (item !== null && itemSubType === 'dropdown') {\r\n this._hide(item) // hide items dropdown\r\n\r\n // Hide all child elements as well\r\n if (items.length > 0) {\r\n for (let i = 0, len = items.length; i < len; i++) {\r\n //if ( _getItemOption(item, 'trigger') === 'click' && _getItemSubType(item) === 'dropdown' ) {\r\n if (items[i] !== null && this._getItemSubType(items[i] as HTMLElement) === 'dropdown') {\r\n this._hide(items[i] as HTMLElement)\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Link handler\r\n private _link = (element: HTMLElement, e: Event) => {\r\n if (EventHandlerUtil.trigger(this.element, 'kt.menu.link.click') === false) {\r\n return\r\n }\r\n\r\n this._hideAccordions(element)\r\n\r\n // Dismiss all shown dropdowns\r\n MenuComponent.hideDropdowns(undefined)\r\n EventHandlerUtil.trigger(this.element, 'kt.menu.link.clicked')\r\n }\r\n\r\n private _click = (element: HTMLElement, e: Event) => {\r\n e.preventDefault()\r\n const item = this._getItemElement(element)\r\n if (item) {\r\n if (this._getItemOption(item, 'trigger') !== 'click') {\r\n return\r\n }\r\n\r\n if (this._getItemOption(item, 'toggle') === false) {\r\n this._show(item)\r\n } else {\r\n this._toggle(item)\r\n }\r\n }\r\n }\r\n\r\n ///////////////////////\r\n // ** Public API ** //\r\n ///////////////////////\r\n public click = (element: HTMLElement, e: Event) => {\r\n return this._click(element, e)\r\n }\r\n\r\n public link = (element: HTMLElement, e: Event) => {\r\n return this._link(element, e)\r\n }\r\n\r\n public dismiss = (element: HTMLElement, e: Event) => {\r\n return this._dismiss(element, e)\r\n }\r\n\r\n public mouseover = (element: HTMLElement, e: Event) => {\r\n return this._mouseover(element, e as MouseEvent)\r\n }\r\n\r\n public mouseout = (element: HTMLElement, e: Event) => {\r\n return this._mouseout(element, e as MouseEvent)\r\n }\r\n\r\n // General Methods\r\n public getItemTriggerType = (item: HTMLElement) => {\r\n return this._getItemOption(item, 'trigger')\r\n }\r\n\r\n public getItemSubType = (element: HTMLElement) => {\r\n return this._getItemSubType(element)\r\n }\r\n\r\n public show = (item: HTMLElement) => {\r\n return this._show(item)\r\n }\r\n\r\n public hide = (item: HTMLElement) => {\r\n return this._hide(item)\r\n }\r\n\r\n public reset = (item: HTMLElement) => {\r\n return this._reset(item)\r\n }\r\n\r\n public update = () => {\r\n return this._update()\r\n }\r\n\r\n public getElement = () => {\r\n return this.element\r\n }\r\n\r\n public getItemLinkElement = (item: HTMLElement) => {\r\n return this._getItemLinkElement(item)\r\n }\r\n\r\n public getItemToggleElement = (item: HTMLElement) => {\r\n return this._getItemToggleElement(item)\r\n }\r\n\r\n public getItemSubElement = (item: HTMLElement) => {\r\n return this._getItemSubElement(item)\r\n }\r\n\r\n public getItemParentElements = (item: HTMLElement) => {\r\n return this._getItemParentElements(item)\r\n }\r\n\r\n public isItemSubShown = (item: HTMLElement) => {\r\n return this._isItemSubShown(item)\r\n }\r\n\r\n public isItemParentShown = (item: HTMLElement) => {\r\n return this._isItemParentShown(item)\r\n }\r\n\r\n public getTriggerElement = () => {\r\n return this.triggerElement\r\n }\r\n\r\n public isItemDropdownPermanent = (item: HTMLElement) => {\r\n return this._isItemDropdownPermanent(item)\r\n }\r\n\r\n // Accordion Mode Methods\r\n public hideAccordions = (item: HTMLElement) => {\r\n return this._hideAccordions(item)\r\n }\r\n\r\n // Event API\r\n public on = (name: string, handler: any) => {\r\n return EventHandlerUtil.on(this.element, name, handler)\r\n }\r\n\r\n public one = (name: string, handler: any) => {\r\n return EventHandlerUtil.one(this.element, name, handler)\r\n }\r\n\r\n public off = (name: string, handlerId: string) => {\r\n return EventHandlerUtil.off(this.element, name, handlerId)\r\n }\r\n\r\n // public static methods\r\n // Get KTMenu instance by element\r\n public static getInstance = (element: HTMLElement): MenuComponent | null => {\r\n // Element has menu DOM reference in it's DATA storage\r\n const elementMenu = DataUtil.get(element, 'menu')\r\n if (elementMenu) {\r\n return elementMenu as MenuComponent\r\n }\r\n\r\n // Element has .menu parent\r\n const menu = element.closest('.menu')\r\n if (menu) {\r\n const menuData = DataUtil.get(menu as HTMLElement, 'menu')\r\n if (menuData) {\r\n return menuData as MenuComponent\r\n }\r\n }\r\n\r\n // Element has a parent with DOM reference to .menu in it's DATA storage\r\n if (element.classList.contains('menu-link')) {\r\n const sub = element.closest('.menu-sub')\r\n if (sub) {\r\n const subMenu = DataUtil.get(sub as HTMLElement, 'menu')\r\n if (subMenu) {\r\n return subMenu as MenuComponent\r\n }\r\n }\r\n }\r\n\r\n return null\r\n }\r\n\r\n // Hide all dropdowns and skip one if provided\r\n public static hideDropdowns = (skip: HTMLElement | undefined) => {\r\n const items = document.querySelectorAll(\r\n '.show.menu-dropdown[data-kt-menu-trigger]'\r\n )\r\n\r\n if (items && items.length > 0) {\r\n for (let i = 0, len = items.length; i < len; i++) {\r\n const item = items[i]\r\n const menu = MenuComponent.getInstance(item as HTMLElement)\r\n\r\n if (menu && menu.getItemSubType(item) === 'dropdown') {\r\n if (skip) {\r\n if (\r\n // @ts-ignore\r\n menu.getItemSubElement(item).contains(skip) === false &&\r\n item.contains(skip) === false &&\r\n item !== skip\r\n ) {\r\n menu.hide(item)\r\n }\r\n } else {\r\n menu.hide(item)\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n public static updateDropdowns = () => {\r\n const items = document.querySelectorAll('.show.menu-dropdown[data-kt-menu-trigger]')\r\n if (items && items.length > 0) {\r\n for (var i = 0, len = items.length; i < len; i++) {\r\n var item = items[i]\r\n\r\n if (DataUtil.has(item as HTMLElement, 'popper')) {\r\n // @ts-ignore\r\n DataUtil.get(item as HTMLElement, 'popper').forceUpdate()\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Global handlers\r\n public static createInstances = (selector: string) => {\r\n // Initialize menus\r\n document.querySelectorAll(selector).forEach((el) => {\r\n const menuItem = el as HTMLElement\r\n let menuInstance = MenuComponent.getInstance(menuItem)\r\n if (!menuInstance) {\r\n menuInstance = new MenuComponent(el as HTMLElement, defaultMenuOptions)\r\n }\r\n })\r\n }\r\n\r\n public static initGlobalHandlers = () => {\r\n // Dropdown handler\r\n document.addEventListener('click', (e) => {\r\n const menuItems = document.querySelectorAll('.show.menu-dropdown[data-kt-menu-trigger]')\r\n if (menuItems && menuItems.length > 0) {\r\n for (let i = 0; i < menuItems.length; i++) {\r\n const item = menuItems[i] as HTMLElement\r\n const menuObj = MenuComponent.getInstance(item) as MenuComponent\r\n if (menuObj && menuObj.getItemSubType(item) === 'dropdown') {\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n const menu = menuObj.getElement()\r\n const sub = menuObj.getItemSubElement(item) as HTMLElement\r\n if (item === e.target || item.contains(e.target as HTMLElement)) {\r\n continue\r\n }\r\n\r\n if (sub && (sub === e.target || sub.contains(e.target as HTMLElement))) {\r\n continue\r\n }\r\n menuObj.hide(item)\r\n }\r\n }\r\n }\r\n })\r\n\r\n // Sub toggle handler\r\n DOMEventHandlerUtil.on(\r\n document.body,\r\n '.menu-item[data-kt-menu-trigger] > .menu-link, [data-kt-menu-trigger]:not(.menu-item):not([data-kt-menu-trigger=\"auto\"])',\r\n 'click',\r\n function (this: HTMLElement, e: Event) {\r\n const menu = MenuComponent.getInstance(this) as MenuComponent\r\n if (menu) {\r\n return menu.click(this, e)\r\n }\r\n }\r\n )\r\n\r\n // // Link handler\r\n DOMEventHandlerUtil.on(\r\n document.body,\r\n '.menu-item:not([data-kt-menu-trigger]) > .menu-link',\r\n 'click',\r\n function (this: HTMLElement, e: Event) {\r\n e.stopPropagation()\r\n const menu = MenuComponent.getInstance(this)\r\n if (menu && menu.link) {\r\n return menu.link(this, e)\r\n }\r\n }\r\n )\r\n\r\n // Dismiss handler\r\n DOMEventHandlerUtil.on(\r\n document.body,\r\n '[data-kt-menu-dismiss=\"true\"]',\r\n 'click',\r\n function (this: HTMLElement, e: Event) {\r\n const menu = MenuComponent.getInstance(this) as MenuComponent\r\n if (menu) {\r\n return menu.dismiss(this, e)\r\n }\r\n }\r\n )\r\n\r\n // Mouseover handler\r\n DOMEventHandlerUtil.on(\r\n document.body,\r\n '[data-kt-menu-trigger], .menu-sub',\r\n 'mouseover',\r\n function (this: HTMLElement, e: Event) {\r\n const menu = MenuComponent.getInstance(this) as MenuComponent\r\n if (menu && menu.getItemSubType(this) === 'dropdown') {\r\n return menu.mouseover(this, e)\r\n }\r\n }\r\n )\r\n\r\n // Mouseout handler\r\n DOMEventHandlerUtil.on(\r\n document.body,\r\n '[data-kt-menu-trigger], .menu-sub',\r\n 'mouseout',\r\n function (this: HTMLElement, e: Event) {\r\n const menu = MenuComponent.getInstance(this) as MenuComponent\r\n if (menu && menu.getItemSubType(this) === 'dropdown') {\r\n return menu.mouseout(this, e)\r\n }\r\n }\r\n )\r\n\r\n // Resize handler\r\n window.addEventListener('resize', () => {\r\n let timer\r\n throttle(\r\n timer,\r\n () => {\r\n // Locate and update Drawer instances on window resize\r\n const elements = document.querySelectorAll('[data-kt-menu=\"true\"]')\r\n elements.forEach((el) => {\r\n const menu = MenuComponent.getInstance(el as HTMLElement)\r\n if (menu) {\r\n menu.update()\r\n }\r\n })\r\n },\r\n 200\r\n )\r\n })\r\n }\r\n\r\n public static bootstrap = () => {\r\n MenuComponent.initGlobalHandlers()\r\n MenuComponent.createInstances('[data-kt-menu=\"true\"]')\r\n }\r\n\r\n public static reinitialization = () => {\r\n MenuComponent.createInstances('[data-kt-menu=\"true\"]')\r\n }\r\n\r\n public static createInsance = (\r\n selector: string,\r\n options: MenuOptions = defaultMenuOptions\r\n ): MenuComponent | undefined => {\r\n const element = document.body.querySelector(selector)\r\n if (!element) {\r\n return\r\n }\r\n const item = element as HTMLElement\r\n let menu = MenuComponent.getInstance(item)\r\n if (!menu) {\r\n menu = new MenuComponent(item, options)\r\n }\r\n return menu\r\n }\r\n}\r\n\r\nexport {MenuComponent, defaultMenuOptions}\r\n","import {\r\n EventHandlerUtil,\r\n DataUtil,\r\n getBreakpoint,\r\n getAttributeValueByBreakpoint,\r\n stringSnakeToCamel,\r\n getObjectPropertyValueByKey,\r\n getViewPort,\r\n isVisibleElement,\r\n throttle,\r\n} from '../_utils/index'\r\n\r\nimport {MenuComponent, defaultMenuOptions} from './MenuComponent'\r\n\r\nexport interface ISearchOptions {\r\n minLength: number // Miniam text lenght to query search\r\n keypress: boolean // Enable search on keypress\r\n enter: boolean // Enable search on enter key press\r\n layout: 'menu' | 'inline' // Use 'menu' or 'inline' layout options to display search results\r\n responsive?: number // Pass integer value or bootstrap compatible breakpoint key(sm,md,lg,xl,xxl) to enable reponsive form mode for device width below the breakpoint value\r\n showOnFocus: boolean // Always show menu on input focus\r\n}\r\n\r\nexport interface ISearchQueries {\r\n componentName: string\r\n instanseQuery: string\r\n attrQuery: string\r\n}\r\n\r\nconst defaultSearchOptions: ISearchOptions = {\r\n minLength: 2, // Miniam text lenght to query search\r\n keypress: true, // Enable search on keypress\r\n enter: true, // Enable search on enter key press\r\n layout: 'menu', // Use 'menu' or 'inline' layout options to display search results\r\n showOnFocus: true, // Always show menu on input focus\r\n}\r\n\r\nconst defaultSearchQueires: ISearchQueries = {\r\n componentName: 'search',\r\n instanseQuery: '[data-kt-search]',\r\n attrQuery: 'data-kt-search-',\r\n}\r\n\r\nclass SearchComponent {\r\n element: HTMLElement\r\n contentElement: HTMLElement\r\n formElement: HTMLFormElement\r\n inputElement: HTMLInputElement\r\n spinnerElement: HTMLElement\r\n clearElement: HTMLElement\r\n toggleElement: HTMLElement\r\n submitElement: HTMLElement\r\n toolbarElement: HTMLElement\r\n resultsElement: HTMLElement\r\n suggestionElement: HTMLElement\r\n emptyElement: HTMLElement\r\n layout: any\r\n\r\n options: ISearchOptions\r\n queries: ISearchQueries\r\n\r\n processing: boolean = false\r\n menuObject: MenuComponent | undefined\r\n\r\n constructor(_element: HTMLElement, _options: ISearchOptions, _queries: ISearchQueries) {\r\n // Variables\r\n this.options = Object.assign(defaultSearchOptions, _options)\r\n this.queries = _queries\r\n\r\n // Elements\r\n this.element = _element\r\n this.contentElement = this._getElement('content') as HTMLElement\r\n this.formElement = this._getElement('form') as HTMLFormElement\r\n this.inputElement = this._getElement('input') as HTMLInputElement\r\n this.spinnerElement = this._getElement('spinner') as HTMLElement\r\n this.clearElement = this._getElement('clear') as HTMLElement\r\n this.toggleElement = this._getElement('toggle') as HTMLElement\r\n this.submitElement = this._getElement('submit') as HTMLElement\r\n this.toolbarElement = this._getElement('toolbar') as HTMLElement\r\n\r\n this.resultsElement = this._getElement('results') as HTMLElement\r\n this.suggestionElement = this._getElement('suggestion') as HTMLElement\r\n this.emptyElement = this._getElement('empty') as HTMLElement\r\n\r\n // Layout\r\n this.layout = this.getOption('layout')\r\n if (this.layout === 'menu') {\r\n this.menuObject = new MenuComponent(this.contentElement, defaultMenuOptions)\r\n }\r\n\r\n // Update\r\n this.update()\r\n\r\n // Event Handlers\r\n this.handlers()\r\n\r\n DataUtil.set(this.element, this.queries.componentName, this)\r\n }\r\n\r\n private _getElement = (name: string) => {\r\n return this.element.querySelector('[data-kt-search-element=\"' + name + '\"]')\r\n }\r\n\r\n // Get option\r\n private getOption = (name: string) => {\r\n const attr = this.element.getAttribute(`${this.queries.attrQuery}${name}`)\r\n if (attr) {\r\n let value = getAttributeValueByBreakpoint(attr)\r\n\r\n if (value !== null && String(value) === 'true') {\r\n return true\r\n } else if (value !== null && String(value) === 'false') {\r\n return false\r\n }\r\n\r\n return value\r\n } else {\r\n const optionName = stringSnakeToCamel(name)\r\n\r\n const option = getObjectPropertyValueByKey(this.options, optionName)\r\n if (option) {\r\n return getAttributeValueByBreakpoint(option)\r\n } else {\r\n return null\r\n }\r\n }\r\n }\r\n\r\n // Check if responsive form mode is enabled\r\n private getResponsiveFormMode = () => {\r\n const responsive = this.getOption('responsive') as string\r\n const width = getViewPort().width\r\n\r\n if (!responsive) {\r\n return null\r\n }\r\n\r\n const breakpoint = getBreakpoint(responsive)\r\n let breakPointNum = -1\r\n if (!breakpoint) {\r\n breakPointNum = parseInt(responsive)\r\n } else {\r\n breakPointNum = +breakpoint\r\n }\r\n\r\n if (width < breakPointNum) {\r\n return 'on'\r\n } else {\r\n return 'off'\r\n }\r\n }\r\n\r\n // Focus\r\n private focus = () => {\r\n this.element.classList.add('focus')\r\n\r\n if (\r\n this.getOption('show-on-focus') === true ||\r\n this.inputElement.value.length >= this.options.minLength\r\n ) {\r\n this.show()\r\n }\r\n }\r\n\r\n // Blur\r\n private blur = () => {\r\n this.element.classList.remove('focus')\r\n }\r\n\r\n // Enter\r\n private enter = (e: KeyboardEvent) => {\r\n const key = e.charCode || e.keyCode || 0\r\n\r\n if (key === 13) {\r\n e.preventDefault()\r\n\r\n this.search()\r\n }\r\n }\r\n\r\n // Input\r\n private input = () => {\r\n if (this.getOption('min-length')) {\r\n const minLength = parseInt(this.getOption('min-length') as string)\r\n\r\n if (this.inputElement.value.length >= minLength) {\r\n this.search()\r\n } else if (this.inputElement.value.length === 0) {\r\n this.clear()\r\n }\r\n }\r\n }\r\n\r\n private handlers(): void {\r\n const context = this\r\n\r\n // Focus\r\n this.inputElement.addEventListener('focus', this.focus)\r\n\r\n // Blur\r\n this.inputElement.addEventListener('blur', this.blur)\r\n\r\n // Keypress\r\n if (this.getOption('keypress') === true) {\r\n this.inputElement.addEventListener('input', this.input)\r\n }\r\n\r\n // Submit\r\n if (this.submitElement) {\r\n this.submitElement.addEventListener('click', this.search)\r\n }\r\n\r\n // Enter\r\n if (this.getOption('enter') === true) {\r\n this.inputElement.addEventListener('keypress', this.enter)\r\n }\r\n\r\n // Clear\r\n if (this.clearElement) {\r\n this.clearElement.addEventListener('click', this.clear)\r\n }\r\n\r\n // Menu\r\n if (this.menuObject) {\r\n // Toggle menu\r\n if (this.toggleElement) {\r\n this.toggleElement.addEventListener('click', this.show)\r\n\r\n this.menuObject.on('kt.menu.dropdown.show', function () {\r\n // @ts-ignore\r\n if (isVisibleElement(context.toggleElement)) {\r\n // @ts-ignore\r\n context.toggleElement.classList.add('active')\r\n // @ts-ignore\r\n context.toggleElement.classList.add('show')\r\n }\r\n })\r\n\r\n this.menuObject.on('kt.menu.dropdown.hide', function () {\r\n // @ts-ignore\r\n if (isVisibleElement(context.toggleElement)) {\r\n // @ts-ignore\r\n context.toggleElement.classList.remove('active')\r\n // @ts-ignore\r\n context.toggleElement.classList.remove('show')\r\n }\r\n })\r\n }\r\n\r\n this.menuObject.on('kt.menu.dropdown.shown', function () {\r\n // @ts-ignore\r\n context.inputElement.focus()\r\n })\r\n }\r\n\r\n // Window resize handling\r\n window.addEventListener('resize', () => {\r\n let timer\r\n\r\n throttle(\r\n timer,\r\n () => {\r\n this.update()\r\n },\r\n 200\r\n )\r\n })\r\n }\r\n\r\n ///////////////////////\r\n // ** Public API ** //\r\n ///////////////////////\r\n // Update\r\n public update = () => {\r\n // Handle responsive form\r\n if (this.layout === 'menu') {\r\n let responsiveFormMode = this.getResponsiveFormMode()\r\n\r\n if (responsiveFormMode === 'on' && !this.contentElement.contains(this.formElement)) {\r\n this.contentElement.prepend(this.formElement)\r\n this.formElement.classList.remove('d-none')\r\n } else if (responsiveFormMode === 'off' && this.contentElement.contains(this.formElement)) {\r\n this.element.prepend(this.formElement)\r\n this.formElement.classList.add('d-none')\r\n }\r\n }\r\n }\r\n\r\n // Show menu\r\n public show = () => {\r\n if (this.menuObject) {\r\n this.update()\r\n\r\n this.menuObject.show(this.element)\r\n }\r\n }\r\n\r\n // Hide menu\r\n public hide = () => {\r\n if (this.menuObject) {\r\n this.update()\r\n\r\n this.menuObject.hide(this.element)\r\n }\r\n }\r\n\r\n // Search\r\n public search = () => {\r\n if (!this.processing) {\r\n // Show search spinner\r\n if (this.spinnerElement) {\r\n this.spinnerElement.classList.remove('d-none')\r\n }\r\n\r\n // Hide search clear button\r\n if (this.clearElement) {\r\n this.clearElement.classList.add('d-none')\r\n }\r\n\r\n // Hide search toolbar\r\n if (this.toolbarElement) {\r\n this.toolbarElement.classList.add('d-none')\r\n }\r\n\r\n // Focus input\r\n this.inputElement.focus()\r\n\r\n this.processing = true\r\n EventHandlerUtil.trigger(this.element, 'kt.search.process', this)\r\n }\r\n }\r\n\r\n // Complete\r\n public complete = () => {\r\n if (this.spinnerElement) {\r\n this.spinnerElement.classList.add('d-none')\r\n }\r\n\r\n // Show search toolbar\r\n if (this.clearElement) {\r\n this.clearElement.classList.remove('d-none')\r\n }\r\n\r\n if (this.inputElement.value.length === 0) {\r\n this.clear()\r\n }\r\n\r\n // Focus input\r\n this.inputElement.focus()\r\n\r\n this.show()\r\n\r\n this.processing = false\r\n }\r\n\r\n // Clear\r\n public clear = () => {\r\n if (EventHandlerUtil.trigger(this.element, 'kt.search.clear') === false) {\r\n return\r\n }\r\n\r\n // Clear and focus input\r\n this.inputElement.value = ''\r\n this.inputElement.focus()\r\n\r\n // Hide clear icon\r\n if (this.clearElement) {\r\n this.clearElement.classList.add('d-none')\r\n }\r\n\r\n // Show search toolbar\r\n if (this.toolbarElement) {\r\n this.toolbarElement.classList.remove('d-none')\r\n }\r\n\r\n // Hide menu\r\n if (this.getOption('show-on-focus') === false) {\r\n this.hide()\r\n }\r\n\r\n EventHandlerUtil.trigger(this.element, 'kt.search.cleared')\r\n }\r\n\r\n public isProcessing = () => {\r\n return this.processing\r\n }\r\n\r\n public getQuery = () => {\r\n return this.inputElement.value\r\n }\r\n\r\n public getMenu = () => {\r\n return this.menuObject\r\n }\r\n\r\n public getFormElement = () => {\r\n return this.formElement\r\n }\r\n\r\n public getInputElement(): HTMLInputElement {\r\n return this.inputElement\r\n }\r\n\r\n public getContentElement(): HTMLElement {\r\n return this.contentElement\r\n }\r\n\r\n public getElement(): HTMLElement {\r\n return this.element\r\n }\r\n\r\n // Event API\r\n public on = (name: string, handler: Function) => {\r\n return EventHandlerUtil.on(this.element, name, handler)\r\n }\r\n\r\n public one = (name: string, handler: Function) => {\r\n return EventHandlerUtil.one(this.element, name, handler)\r\n }\r\n\r\n public off = (name: string, handlerId: string) => {\r\n return EventHandlerUtil.off(this.element, name, handlerId)\r\n }\r\n\r\n // Static methods\r\n public static getInstance = (\r\n el: HTMLElement,\r\n componentName: string = defaultSearchQueires.componentName\r\n ) => {\r\n const Search = DataUtil.get(el, componentName)\r\n if (Search) {\r\n return Search as SearchComponent\r\n }\r\n\r\n return null\r\n }\r\n\r\n public static createInstances = (\r\n selector: string = defaultSearchQueires.instanseQuery,\r\n options: ISearchOptions = defaultSearchOptions,\r\n queries: ISearchQueries = defaultSearchQueires\r\n ) => {\r\n const elements = document.body.querySelectorAll(selector)\r\n elements.forEach((el) => {\r\n const item = el as HTMLElement\r\n let Search = SearchComponent.getInstance(item)\r\n if (!Search) {\r\n Search = new SearchComponent(item, options, queries)\r\n }\r\n })\r\n }\r\n\r\n public static createInsance = (\r\n selector: string = defaultSearchQueires.instanseQuery,\r\n options: ISearchOptions = defaultSearchOptions,\r\n queries: ISearchQueries = defaultSearchQueires\r\n ): SearchComponent | undefined => {\r\n const element = document.body.querySelector(selector)\r\n if (!element) {\r\n return\r\n }\r\n const item = element as HTMLElement\r\n let Search = SearchComponent.getInstance(item)\r\n if (!Search) {\r\n Search = new SearchComponent(item, options, queries)\r\n }\r\n return Search\r\n }\r\n\r\n public static bootstrap = (selector: string = defaultSearchQueires.instanseQuery) => {\r\n SearchComponent.createInstances(selector)\r\n }\r\n\r\n public static reinitialization = (selector: string = defaultSearchQueires.instanseQuery) => {\r\n SearchComponent.createInstances(selector)\r\n }\r\n}\r\nexport {SearchComponent, defaultSearchOptions, defaultSearchQueires}\r\n","/* eslint-disable no-useless-escape */\r\n// DOCS: https://javascript.info/cookie\r\nexport class CookieComponent {\r\n /**\r\n * Returns the cookie with the given name, or undefined if not found\r\n *\r\n * @param {string} name - cookie name\r\n * @returns string | null\r\n */\r\n public static get(name: string): string | undefined {\r\n let matches = document.cookie.match(\r\n new RegExp('(?:^|; )' + name.replace(/([\\.$?*|{}\\(\\)\\[\\]\\\\\\/\\+^])/g, '\\\\$1') + '=([^;]*)')\r\n )\r\n return matches ? decodeURIComponent(matches[1]) : undefined\r\n }\r\n\r\n /**\r\n * Please note that a cookie value is encoded,\r\n * so getCookie uses a built-in decodeURIComponent function to decode it.\r\n *\r\n * @param {string} name - cookie name\r\n * @param {string | number | boolean} value - cookie value\r\n * @param {any} cookieOptions - cookie options\r\n * @returns void\r\n */\r\n public static set(name: string, value: string | number | boolean, cookieOptions: any): void {\r\n const options = {\r\n path: '/',\r\n // add other defaults here if necessary\r\n ...cookieOptions,\r\n }\r\n\r\n if (options.expires instanceof Date) {\r\n options.expires = options.expires.toUTCString()\r\n }\r\n\r\n let updatedCookie = encodeURIComponent(name) + '=' + encodeURIComponent(value)\r\n\r\n for (let optionKey in options) {\r\n updatedCookie += '; ' + optionKey\r\n let optionValue = options[optionKey]\r\n if (optionValue !== true) {\r\n updatedCookie += '=' + optionValue\r\n }\r\n }\r\n\r\n document.cookie = updatedCookie\r\n }\r\n\r\n /**\r\n * To delete a cookie, we can call it with a negative expiration date\r\n *\r\n * @param {string} name\r\n */\r\n public static delete(name: string): void {\r\n CookieComponent.set(name, '', {\r\n 'max-age': -1,\r\n })\r\n }\r\n}\r\n","import {\r\n EventHandlerUtil,\r\n getUniqueIdWithPrefix,\r\n getObjectPropertyValueByKey,\r\n stringSnakeToCamel,\r\n getAttributeValueByBreakpoint,\r\n throttle,\r\n getCSS,\r\n DOMEventHandlerUtil,\r\n ElementStyleUtil,\r\n} from '../_utils/index'\r\n\r\nexport class DrawerStore {\r\n static store: Map = new Map()\r\n\r\n public static set(instanceId: string, drawerComponentObj: DrawerComponent): void {\r\n if (DrawerStore.has(instanceId)) {\r\n return\r\n }\r\n\r\n DrawerStore.store.set(instanceId, drawerComponentObj)\r\n }\r\n\r\n public static get(instanceId: string): DrawerComponent | undefined {\r\n if (!DrawerStore.has(instanceId)) {\r\n return\r\n }\r\n return DrawerStore.store.get(instanceId)\r\n }\r\n\r\n public static remove(instanceId: string): void {\r\n if (!DrawerStore.has(instanceId)) {\r\n return\r\n }\r\n\r\n DrawerStore.store.delete(instanceId)\r\n }\r\n\r\n public static has(instanceId: string): boolean {\r\n return DrawerStore.store.has(instanceId)\r\n }\r\n\r\n public static getAllInstances() {\r\n return DrawerStore.store\r\n }\r\n}\r\n\r\nexport interface DrawerOptions {\r\n overlay: boolean\r\n baseClass: string\r\n overlayClass: string\r\n direction: string\r\n}\r\n\r\nconst defaultDrawerOptions: DrawerOptions = {\r\n overlay: true,\r\n baseClass: 'drawer',\r\n overlayClass: 'drawer-overlay',\r\n direction: 'end',\r\n}\r\n\r\nclass DrawerComponent {\r\n element: HTMLElement\r\n overlayElement: HTMLElement | null = null\r\n toggleElement: HTMLElement | null = null\r\n options: DrawerOptions\r\n instanceUid: string\r\n name: string = ''\r\n shown: boolean = false\r\n lastWidth: number = 0\r\n closeElement: HTMLElement | null = null\r\n\r\n constructor(_element: HTMLElement, options: DrawerOptions) {\r\n this.element = _element\r\n this.options = Object.assign(defaultDrawerOptions, options)\r\n this.instanceUid = getUniqueIdWithPrefix('drawer')\r\n this.overlayElement = null\r\n this.name = this.element.getAttribute('data-kt-drawer-name') || ''\r\n this.shown = false\r\n this.toggleElement = null\r\n // Event Handlers\r\n this._handlers()\r\n // Update Instance\r\n this._update()\r\n // Bind Instance\r\n DrawerStore.set(this.element.id, this)\r\n }\r\n\r\n private _handlers = () => {\r\n const togglers = this._getOption('toggle') as string\r\n const closers = this._getOption('close') as string\r\n\r\n if (togglers !== null && togglers.length > 0) {\r\n DOMEventHandlerUtil.on(document.body, togglers, 'click', (e: Event) => {\r\n e.preventDefault()\r\n this.toggleElement = document.getElementById(togglers)\r\n this._toggle()\r\n })\r\n }\r\n\r\n if (closers !== null && closers.length > 0) {\r\n DOMEventHandlerUtil.on(document.body, closers, 'click', (e: Event) => {\r\n e.preventDefault()\r\n this.closeElement = document.getElementById(closers)\r\n\r\n this._hide()\r\n })\r\n }\r\n }\r\n\r\n private _update = () => {\r\n const width = String(this._getOption('width'))\r\n const direction = String(this._getOption('direction'))\r\n\r\n // Reset state\r\n const hasBaseClass = this.element.classList.contains(`${this.options.baseClass}-on`)\r\n const bodyCanvasAttr = String(document.body.getAttribute(`data-kt-drawer-${this.name}-`))\r\n\r\n if (hasBaseClass === true && bodyCanvasAttr === 'on') {\r\n this.shown = true\r\n } else {\r\n this.shown = false\r\n }\r\n\r\n // Activate/deactivate\r\n if (this._getOption('activate') === true) {\r\n this.element.classList.add(this.options.baseClass)\r\n this.element.classList.add(`${this.options.baseClass}-${direction}`)\r\n ElementStyleUtil.set(this.element, 'width', width, true)\r\n\r\n this.lastWidth = parseInt(width)\r\n } else {\r\n ElementStyleUtil.set(this.element, 'width', '')\r\n this.element.classList.remove(this.options.baseClass)\r\n this.element.classList.remove(`${this.options.baseClass}-${direction}`)\r\n this._hide()\r\n }\r\n }\r\n\r\n private _getOption = (name: string) => {\r\n const attr = this.element.getAttribute(`data-kt-drawer-${name}`)\r\n if (attr) {\r\n let value = getAttributeValueByBreakpoint(attr)\r\n if (value !== null && String(value) === 'true') {\r\n return true\r\n } else {\r\n if (value !== null && String(value) === 'false') {\r\n return false\r\n }\r\n }\r\n\r\n return value\r\n } else {\r\n const optionName = stringSnakeToCamel(name)\r\n const option = getObjectPropertyValueByKey(this.options, optionName)\r\n if (option) {\r\n return getAttributeValueByBreakpoint(option)\r\n } else {\r\n return null\r\n }\r\n }\r\n }\r\n\r\n private _toggle = () => {\r\n if (EventHandlerUtil.trigger(this.element, 'kt.drawer.toggle') === false) {\r\n return\r\n }\r\n\r\n if (this.shown) {\r\n this._hide()\r\n } else {\r\n this._show()\r\n }\r\n\r\n EventHandlerUtil.trigger(this.element, 'kt.drawer.toggled')\r\n }\r\n\r\n private _hide = () => {\r\n if (EventHandlerUtil.trigger(this.element, 'kt.drawer.hide') === false) {\r\n return\r\n }\r\n\r\n this.shown = false\r\n this._deleteOverlay()\r\n document.body.removeAttribute(`data-kt-drawer-${this.name}`)\r\n document.body.removeAttribute(`data-kt-drawer`)\r\n this.element.classList.remove(`${this.options.baseClass}-on`)\r\n if (this.toggleElement != null) {\r\n this.toggleElement.classList.remove('active')\r\n }\r\n\r\n EventHandlerUtil.trigger(this.element, 'kt.drawer.after.hidden')\r\n }\r\n\r\n private _show = () => {\r\n if (EventHandlerUtil.trigger(this.element, 'kt.drawer.show') === false) {\r\n return\r\n }\r\n\r\n this.shown = true\r\n this._createOverlay()\r\n document.body.setAttribute(`data-kt-drawer-${this.name}`, 'on')\r\n document.body.setAttribute('data-kt-drawer', 'on')\r\n this.element.classList.add(`${this.options.baseClass}-on`)\r\n if (this.toggleElement !== null) {\r\n this.toggleElement.classList.add('active')\r\n }\r\n\r\n EventHandlerUtil.trigger(this.element, 'kt.drawer.shown')\r\n }\r\n\r\n private _createOverlay = () => {\r\n if (this._getOption('overlay') === true) {\r\n this.overlayElement = document.createElement('DIV')\r\n const elementZIndex = getCSS(this.element, 'z-index')\r\n if (elementZIndex) {\r\n const overlayZindex = parseInt(elementZIndex) - 1\r\n ElementStyleUtil.set(this.overlayElement, 'z-index', overlayZindex) // update\r\n }\r\n document.body.append(this.overlayElement)\r\n const overlayClassOption = this._getOption('overlay-class')\r\n if (overlayClassOption) {\r\n this.overlayElement.classList.add(overlayClassOption.toString())\r\n }\r\n this.overlayElement.addEventListener('click', (e) => {\r\n e.preventDefault()\r\n this._hide()\r\n })\r\n }\r\n }\r\n\r\n private _deleteOverlay = () => {\r\n if (this.overlayElement !== null && this.overlayElement.parentNode) {\r\n this.overlayElement.parentNode.removeChild(this.overlayElement)\r\n }\r\n }\r\n\r\n private _getDirection = () => {\r\n return String(this._getOption('direction')) === 'left' ? 'left' : 'right'\r\n }\r\n\r\n private _getWidth = () => {\r\n let width = this._getOption('width')\r\n if (width && width === 'auto') {\r\n width = getCSS(this.element, 'width')\r\n }\r\n\r\n return width\r\n }\r\n\r\n ///////////////////////\r\n // ** Public API ** //\r\n ///////////////////////\r\n public toggle = () => {\r\n this._toggle()\r\n }\r\n\r\n public show = () => {\r\n this._show()\r\n }\r\n\r\n public hide = () => {\r\n this._hide()\r\n }\r\n\r\n public isShown = () => {\r\n return this.shown\r\n }\r\n\r\n public update = () => {\r\n this._update()\r\n }\r\n\r\n public goElement = () => {\r\n return this.element\r\n }\r\n\r\n // Event API\r\n public on = (name: string, handler: Function) => {\r\n return EventHandlerUtil.on(this.element, name, handler)\r\n }\r\n\r\n public one = (name: string, handler: Function) => {\r\n return EventHandlerUtil.one(this.element, name, handler)\r\n }\r\n\r\n public off = (name: string, handerId: string) => {\r\n return EventHandlerUtil.off(this.element, name, handerId)\r\n }\r\n\r\n public trigger = (name: string, event: Event) => {\r\n return EventHandlerUtil.trigger(this.element, name, event)\r\n }\r\n\r\n // Static methods\r\n public static hasInstace = (elementId: string): boolean => {\r\n return DrawerStore.has(elementId)\r\n }\r\n\r\n public static getInstance = (elementId: string) => {\r\n return DrawerStore.get(elementId)\r\n }\r\n\r\n public static hideAll = () => {\r\n const oldInstances = DrawerStore.getAllInstances()\r\n oldInstances.forEach((dr) => {\r\n dr.hide()\r\n })\r\n }\r\n\r\n public static updateAll = () => {\r\n const oldInstances = DrawerStore.getAllInstances()\r\n oldInstances.forEach((dr) => {\r\n dr.update()\r\n })\r\n }\r\n\r\n // Create Instances\r\n public static createInstances(selector: string): void {\r\n const elements = document.body.querySelectorAll(selector)\r\n elements.forEach((element) => {\r\n const item = element as HTMLElement\r\n let drawer = DrawerComponent.getInstance(item.id)\r\n if (!drawer) {\r\n drawer = new DrawerComponent(item, defaultDrawerOptions)\r\n }\r\n drawer.element = item\r\n drawer.hide()\r\n })\r\n }\r\n\r\n // Dismiss instances\r\n public static handleDismiss = () => {\r\n // External drawer toggle handler\r\n DOMEventHandlerUtil.on(document.body, '[data-kt-drawer-dismiss=\"true\"]', 'click', () => {\r\n /* @ts-ignore */\r\n const element = this.closest('[data-kt-drawer=\"true\"]')\r\n if (element) {\r\n const drawer = DrawerComponent.getInstance(element)\r\n if (drawer && drawer.isShown()) {\r\n drawer.hide()\r\n }\r\n }\r\n })\r\n }\r\n\r\n // Global Initialization\r\n public static initGlobalHandlers(): void {\r\n // Window Resize Handling\r\n window.addEventListener('resize', function () {\r\n let timer: number | undefined\r\n throttle(\r\n timer,\r\n () => {\r\n // Locate and update Drawer instances on window resize\r\n const elements = document.body.querySelectorAll('[data-kt-drawer=\"true\"]')\r\n elements.forEach((el) => {\r\n const item = el as HTMLElement\r\n const instance = DrawerComponent.getInstance(item.id)\r\n if (instance) {\r\n instance.element = item\r\n instance.update()\r\n }\r\n })\r\n },\r\n 200\r\n )\r\n })\r\n }\r\n\r\n public static bootstrap = () => {\r\n DrawerComponent.createInstances('[data-kt-drawer=\"true\"]')\r\n DrawerComponent.initGlobalHandlers()\r\n DrawerComponent.handleDismiss()\r\n }\r\n\r\n public static reinitialization = () => {\r\n DrawerComponent.createInstances('[data-kt-drawer=\"true\"]')\r\n DrawerComponent.hideAll()\r\n DrawerComponent.updateAll()\r\n DrawerComponent.handleDismiss()\r\n }\r\n}\r\n\r\nexport {DrawerComponent, defaultDrawerOptions}\r\n","import {\r\n DataUtil,\r\n ElementStyleUtil,\r\n EventHandlerUtil,\r\n getUniqueIdWithPrefix,\r\n getAttributeValueByBreakpoint,\r\n} from '../_utils/index'\r\n\r\nexport interface FeedbackOptions {\r\n width?: number\r\n placement?: string\r\n content?: string\r\n type?: string\r\n}\r\n\r\nconst defaultFeedbackOptions: FeedbackOptions = {\r\n width: 100,\r\n placement: 'top-center',\r\n content: '',\r\n type: 'popup',\r\n}\r\n\r\nclass FeedbackComponent {\r\n element: HTMLElement\r\n options: FeedbackOptions\r\n instanceUid: string\r\n shown: boolean\r\n\r\n constructor(_element: HTMLElement, options: FeedbackOptions) {\r\n this.element = _element\r\n this.options = Object.assign(defaultFeedbackOptions, options)\r\n this.instanceUid = getUniqueIdWithPrefix('feedback')\r\n this.shown = false\r\n\r\n // Event handlers\r\n this._handlers() // will add in the show popup\r\n DataUtil.set(this.element, 'feedback', this)\r\n }\r\n\r\n private _handlers = () => {\r\n this.element.addEventListener('click', (e: Event) => {\r\n e.preventDefault()\r\n this._go()\r\n })\r\n }\r\n\r\n private _go = () => {}\r\n\r\n private showPopup = () => {\r\n this.element = document.createElement('DIV')\r\n\r\n this.element.classList.add('feedback feedback-popup')\r\n this.element.innerHTML = this.options.content || ''\r\n\r\n if (this.options.placement === 'top-center') {\r\n this.setPopupTopCenterPosition()\r\n }\r\n\r\n document.body.appendChild(this.element)\r\n this.element.classList.add('feedback-shown')\r\n this.shown = true\r\n }\r\n\r\n private setPopupTopCenterPosition = () => {\r\n const width = getAttributeValueByBreakpoint(this.options.width?.toString() || '0')\r\n const height = ElementStyleUtil.get(this.element, 'height')\r\n this.element.classList.add('feedback-top-center')\r\n ElementStyleUtil.set(this.element, 'width', width)\r\n ElementStyleUtil.set(this.element, 'left', '50%')\r\n ElementStyleUtil.set(this.element, 'top', '-' + height)\r\n }\r\n\r\n private hidePopup = () => {\r\n this.element.remove()\r\n }\r\n\r\n ///////////////////////\r\n // ** Public API ** //\r\n ///////////////////////\r\n public show = () => {\r\n if (EventHandlerUtil.trigger(this.element, 'kt.feedback.show') === false) {\r\n return\r\n }\r\n\r\n if (this.options.type === 'popup') {\r\n this.showPopup()\r\n }\r\n\r\n EventHandlerUtil.trigger(this.element, 'kt.feedback.shown')\r\n\r\n return this\r\n }\r\n\r\n public hide = () => {\r\n if (EventHandlerUtil.trigger(this.element, 'kt.feedback.hide') === false) {\r\n return\r\n }\r\n\r\n if (this.options.type === 'popup') {\r\n this.hidePopup()\r\n }\r\n\r\n this.shown = false\r\n EventHandlerUtil.trigger(this.element, 'kt.feedback.hidden')\r\n return this\r\n }\r\n\r\n public isShown = () => {\r\n return this.isShown\r\n }\r\n\r\n public getElement = () => {\r\n return this.element\r\n }\r\n\r\n // Event API\r\n public on = (name: string, handler: Function) => {\r\n return EventHandlerUtil.on(this.element, name, handler)\r\n }\r\n\r\n public one = (name: string, handler: Function) => {\r\n return EventHandlerUtil.one(this.element, name, handler)\r\n }\r\n\r\n public off = (name: string, handerId: string) => {\r\n return EventHandlerUtil.off(this.element, name, handerId)\r\n }\r\n\r\n public trigger = (name: string, event: Event) => {\r\n return EventHandlerUtil.trigger(this.element, name, event)\r\n }\r\n\r\n // Create Instances\r\n public static createInstances(selector: string) {\r\n throw new Error('not implemented')\r\n }\r\n\r\n // Static methods\r\n public static hasInstace(element: HTMLElement) {\r\n throw new Error('not implemented')\r\n }\r\n\r\n public static getInstance(element: HTMLElement) {\r\n throw new Error('not implemented')\r\n }\r\n\r\n public static bootstrap(attr: string = '[data-Feedback]') {\r\n throw new Error('not implemented')\r\n }\r\n}\r\n\r\nexport {FeedbackComponent, defaultFeedbackOptions}\r\n","/* eslint-disable array-callback-return */\r\n/* eslint-disable no-useless-escape */\r\nimport {DataUtil} from '../_utils/index'\r\n\r\nexport interface IPasswordMeterOptions {\r\n minLength: number\r\n checkUppercase: boolean\r\n checkLowercase: boolean\r\n checkDigit: boolean\r\n checkChar: boolean\r\n scoreHighlightClass: string\r\n}\r\n\r\nexport interface IPasswordMeterQueries {\r\n componentName: string\r\n instanseQuery: string\r\n inputQuery: string\r\n visibilityQuery: string\r\n highlightQuery: string\r\n}\r\n\r\nconst defaultPasswordMeterOptions = {\r\n minLength: 8,\r\n checkUppercase: true,\r\n checkLowercase: true,\r\n checkDigit: true,\r\n checkChar: true,\r\n scoreHighlightClass: 'active',\r\n}\r\n\r\nconst defaultPasswordMeterQueires: IPasswordMeterQueries = {\r\n componentName: 'password-meter',\r\n instanseQuery: '[data-kt-password-meter]',\r\n inputQuery: 'input[type]',\r\n visibilityQuery: '[data-kt-password-meter-control=\"visibility\"]',\r\n highlightQuery: '[data-kt-password-meter-control=\"highlight\"]',\r\n}\r\n\r\nclass PasswordMeterComponent {\r\n element: HTMLElement\r\n inputElement: HTMLInputElement | null\r\n visibilityElement: HTMLElement | null\r\n highlightElement: HTMLElement | null\r\n options: IPasswordMeterOptions\r\n queries: IPasswordMeterQueries\r\n score: number\r\n checkSteps: number\r\n\r\n constructor(\r\n _element: HTMLElement,\r\n _options: IPasswordMeterOptions,\r\n _queries: IPasswordMeterQueries\r\n ) {\r\n this.element = _element\r\n this.options = Object.assign(defaultPasswordMeterOptions, _options)\r\n this.queries = _queries\r\n this.score = 0\r\n this.checkSteps = 5\r\n\r\n // Elements\r\n this.inputElement = this.element.querySelector(this.queries.inputQuery)\r\n this.visibilityElement = this.element.querySelector(this.queries.visibilityQuery)\r\n this.highlightElement = this.element.querySelector(this.queries.highlightQuery)\r\n\r\n // Event Handlers\r\n this.handlers()\r\n\r\n DataUtil.set(this.element, this.queries.componentName, this)\r\n }\r\n\r\n private handlers(): void {\r\n if (this.inputElement) {\r\n this.inputElement.addEventListener('input', () => {\r\n this.check()\r\n })\r\n }\r\n\r\n if (this.visibilityElement) {\r\n this.visibilityElement.addEventListener('click', () => {\r\n this.visitbility()\r\n })\r\n }\r\n }\r\n\r\n private visitbility() {\r\n if (this.visibilityElement && this.inputElement) {\r\n const visibleIcon = this.visibilityElement.querySelector(\r\n 'i:not(.d-none), .svg-icon:not(.d-none)'\r\n )\r\n\r\n const hiddenIcon = this.visibilityElement.querySelector('i.d-none, .svg-icon.d-none')\r\n\r\n const typeAttr = this.inputElement.getAttribute('type') || ''\r\n\r\n if (typeAttr === 'password') {\r\n this.inputElement.setAttribute('type', 'text')\r\n } else {\r\n this.inputElement.setAttribute('type', 'password')\r\n }\r\n\r\n visibleIcon?.classList.add('d-none')\r\n hiddenIcon?.classList.remove('d-none')\r\n\r\n this.inputElement.focus()\r\n }\r\n }\r\n\r\n private checkScore(): number {\r\n return 0\r\n }\r\n\r\n private checkLength(): boolean {\r\n if (this.inputElement) {\r\n return this.inputElement.value.length >= this.options.minLength // 20 score\r\n }\r\n\r\n return false\r\n }\r\n\r\n private checkLowerCase(): boolean {\r\n const val = this.inputElement ? this.inputElement.value : ''\r\n return /[a-z]/.test(val) // 20 score\r\n }\r\n\r\n private checkUppercase(): boolean {\r\n const val = this.inputElement ? this.inputElement.value : ''\r\n return /[A-Z]/.test(val) // 20 score\r\n }\r\n\r\n private checkDigit(): boolean {\r\n const val = this.inputElement ? this.inputElement.value : ''\r\n return /[0-9]/.test(val) // 20 score\r\n }\r\n\r\n private checkChar(): boolean {\r\n const val = this.inputElement ? this.inputElement.value : ''\r\n return /[~`!#$%\\^&*+=\\-\\[\\]\\\\';,/{}|\\\\\":<>\\?]/g.test(val) // 20 score\r\n }\r\n\r\n private getCheckScore(): number {\r\n let count = 1\r\n if (this.options.checkUppercase) {\r\n count++\r\n }\r\n\r\n if (this.options.checkLowercase) {\r\n count++\r\n }\r\n\r\n if (this.options.checkDigit) {\r\n count++\r\n }\r\n\r\n if (this.options.checkChar) {\r\n count++\r\n }\r\n\r\n this.checkSteps = count\r\n return 100 / this.checkSteps\r\n }\r\n\r\n private highlight() {\r\n const items = this.highlightElement\r\n ? [].slice.call(this.highlightElement.querySelectorAll('div'))\r\n : []\r\n const total = items.length\r\n let index = 0\r\n const checkScore = this.getCheckScore()\r\n const score = this.getScore()\r\n\r\n items.map((item: HTMLElement) => {\r\n index++\r\n if (checkScore * index * (this.checkSteps / total) <= score) {\r\n item.classList.add('active')\r\n } else {\r\n item.classList.remove('active')\r\n }\r\n })\r\n }\r\n\r\n ///////////////////////\r\n // ** Public API ** //\r\n ///////////////////////\r\n public reset = () => {\r\n this.score = 0\r\n this.highlight()\r\n }\r\n\r\n public getScore() {\r\n return this.score\r\n }\r\n\r\n public check() {\r\n let score = 0\r\n const checkScore = this.getCheckScore()\r\n if (this.checkLength()) {\r\n score = score + checkScore\r\n }\r\n\r\n if (this.options.checkUppercase && this.checkLowerCase()) {\r\n score = score + checkScore\r\n }\r\n\r\n if (this.options.checkLowercase && this.checkUppercase()) {\r\n score = score + checkScore\r\n }\r\n\r\n if (this.options.checkDigit && this.checkDigit()) {\r\n score = score + checkScore\r\n }\r\n\r\n if (this.options.checkChar && this.checkChar()) {\r\n score = score + checkScore\r\n }\r\n\r\n this.score = score\r\n this.highlight()\r\n }\r\n\r\n // Static methods\r\n public static getInstance = (\r\n el: HTMLElement,\r\n componentName: string = defaultPasswordMeterQueires.componentName\r\n ): PasswordMeterComponent | undefined => {\r\n const passwordMeter = DataUtil.get(el, componentName)\r\n if (passwordMeter) {\r\n return passwordMeter as PasswordMeterComponent\r\n }\r\n }\r\n\r\n public static createInstances = (\r\n selector: string = defaultPasswordMeterQueires.instanseQuery,\r\n options: IPasswordMeterOptions = defaultPasswordMeterOptions,\r\n queries: IPasswordMeterQueries = defaultPasswordMeterQueires\r\n ) => {\r\n const elements = document.body.querySelectorAll(selector)\r\n elements.forEach((el) => {\r\n const item = el as HTMLElement\r\n let passwordMeter = PasswordMeterComponent.getInstance(item)\r\n if (!passwordMeter) {\r\n passwordMeter = new PasswordMeterComponent(item, options, queries)\r\n }\r\n })\r\n }\r\n\r\n public static createInsance = (\r\n selector: string = defaultPasswordMeterQueires.instanseQuery,\r\n options: IPasswordMeterOptions = defaultPasswordMeterOptions,\r\n queries: IPasswordMeterQueries = defaultPasswordMeterQueires\r\n ): PasswordMeterComponent | undefined => {\r\n const element = document.body.querySelector(selector)\r\n if (!element) {\r\n return\r\n }\r\n const item = element as HTMLElement\r\n let passwordMeter = PasswordMeterComponent.getInstance(item)\r\n if (!passwordMeter) {\r\n passwordMeter = new PasswordMeterComponent(item, options, queries)\r\n }\r\n return passwordMeter\r\n }\r\n\r\n public static bootstrap = (selector: string = defaultPasswordMeterQueires.instanseQuery) => {\r\n PasswordMeterComponent.createInstances(selector)\r\n }\r\n\r\n public static reinitialization = (\r\n selector: string = defaultPasswordMeterQueires.instanseQuery\r\n ) => {\r\n PasswordMeterComponent.createInstances(selector)\r\n }\r\n}\r\nexport {PasswordMeterComponent, defaultPasswordMeterOptions, defaultPasswordMeterQueires}\r\n","import {\r\n DataUtil,\r\n getObjectPropertyValueByKey,\r\n stringSnakeToCamel,\r\n getAttributeValueByBreakpoint,\r\n getViewPort,\r\n isVisibleElement,\r\n throttle,\r\n getCSS,\r\n ElementStyleUtil,\r\n} from '../_utils/index'\r\nimport {CookieComponent} from './_CookieComponent'\r\n\r\nexport interface ScrollOptions {\r\n saveState?: boolean\r\n}\r\n\r\nconst defaultScrollOptions: ScrollOptions = {\r\n saveState: true,\r\n}\r\n\r\nclass ScrollComponent {\r\n element: HTMLElement\r\n options: ScrollOptions\r\n id: string\r\n\r\n constructor(_element: HTMLElement, options: ScrollOptions) {\r\n this.element = _element\r\n this.options = Object.assign(defaultScrollOptions, options)\r\n this.id = this.element.getAttribute('id') || ''\r\n this.update()\r\n // this.element.setAttribute('data-kt-scrolltop', 'true')\r\n DataUtil.set(this.element, 'scroll', this)\r\n }\r\n\r\n private getOption = (name: string) => {\r\n if (this.element.hasAttribute('data-kt-scroll-' + name) === true) {\r\n const attr = this.element.getAttribute('data-kt-scroll-' + name) || ''\r\n let value: string | JSON | boolean = getAttributeValueByBreakpoint(attr)\r\n if (value !== null && String(value) === 'true') {\r\n value = true\r\n } else if (value !== null && String(value) === 'false') {\r\n value = false\r\n }\r\n\r\n return value\r\n } else {\r\n const optionName = stringSnakeToCamel(name)\r\n const option = getObjectPropertyValueByKey(this.options, optionName)\r\n if (option) {\r\n return getAttributeValueByBreakpoint(option)\r\n } else {\r\n return null\r\n }\r\n }\r\n }\r\n\r\n private getHeightType = () => {\r\n if (this.getOption('height')) {\r\n return 'height'\r\n }\r\n if (this.getOption('min-height')) {\r\n return 'min-height'\r\n }\r\n if (this.getOption('max-height')) {\r\n return 'max-height'\r\n }\r\n }\r\n\r\n private getAutoHeight = () => {\r\n let height: number | string = getViewPort().height\r\n const dependencies = this.getOption('dependencies')\r\n const wrappers = this.getOption('wrappers')\r\n const offset = this.getOption('offset')\r\n\r\n // Height dependencies\r\n if (dependencies !== null) {\r\n const elements = document.querySelectorAll(dependencies as string)\r\n if (elements && elements.length > 0) {\r\n for (let i = 0, len = elements.length; i < len; i++) {\r\n const element = elements[i] as HTMLElement\r\n if (isVisibleElement(element) === false) {\r\n continue\r\n }\r\n\r\n height = height - parseInt(getCSS(element, 'height'))\r\n height = height - parseInt(getCSS(element, 'margin-top'))\r\n height = height - parseInt(getCSS(element, 'margin-bottom'))\r\n\r\n const borderTop = getCSS(element, 'border-top')\r\n if (borderTop) {\r\n height = height - parseInt(borderTop)\r\n }\r\n\r\n const borderBottom = getCSS(element, 'border-bottom')\r\n if (borderBottom) {\r\n height = height - parseInt(borderBottom)\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Wrappers\r\n if (wrappers !== null) {\r\n var elements = document.querySelectorAll(wrappers as string)\r\n if (elements && elements.length > 0) {\r\n for (let i = 0, len = elements.length; i < len; i++) {\r\n const element = elements[i] as HTMLElement\r\n\r\n if (!isVisibleElement(element)) {\r\n continue\r\n }\r\n\r\n height = height - parseInt(getCSS(element, 'margin-top'))\r\n height = height - parseInt(getCSS(element, 'margin-bottom'))\r\n height = height - parseInt(getCSS(element, 'padding-top'))\r\n height = height - parseInt(getCSS(element, 'padding-bottom'))\r\n\r\n const borderTop = getCSS(element, 'border-top')\r\n if (borderTop) {\r\n height = height - parseInt(borderTop)\r\n }\r\n\r\n const borderBottom = getCSS(element, 'border-bottom')\r\n if (borderBottom) {\r\n height = height - parseInt(borderBottom)\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Custom offset\r\n if (offset !== null) {\r\n height = height - parseInt(offset as string)\r\n }\r\n\r\n height = height - parseInt(getCSS(this.element, 'margin-top'))\r\n height = height - parseInt(getCSS(this.element, 'margin-bottom'))\r\n\r\n const borderTop = getCSS(this.element, 'border-top')\r\n if (borderTop) {\r\n height = height - parseInt(borderTop)\r\n }\r\n\r\n const borderBottom = getCSS(this.element, 'border-bottom')\r\n if (borderBottom) {\r\n height = height - parseInt(borderBottom)\r\n }\r\n\r\n height = String(height) + 'px'\r\n\r\n return height\r\n }\r\n\r\n private setupHeight = () => {\r\n let height = this.getHeight()\r\n let heightType = this.getHeightType() as string\r\n\r\n // Set height\r\n if (height !== null && height.length > 0) {\r\n ElementStyleUtil.set(this.element, heightType, height)\r\n } else {\r\n ElementStyleUtil.set(this.element, heightType, '')\r\n }\r\n }\r\n\r\n private setupState = () => {\r\n if (this.getOption('save-state') === true && this.id) {\r\n const cookie = CookieComponent.get(this.id + 'st')\r\n if (cookie) {\r\n var pos = parseInt(cookie)\r\n\r\n if (pos > 0) {\r\n this.element.scrollTop = pos\r\n }\r\n }\r\n }\r\n }\r\n\r\n private setupScrollHandler = () => {\r\n if (this.getOption('save-state') === true && this.id) {\r\n this.element.addEventListener('scroll', this.scrollHandler)\r\n } else {\r\n this.element.removeEventListener('scroll', this.scrollHandler)\r\n }\r\n }\r\n\r\n private scrollHandler = () => {\r\n const cookieId = this.id + 'st'\r\n CookieComponent.set(cookieId, this.element.scrollTop, {})\r\n }\r\n\r\n private destroyScrollHandler = () => {\r\n this.element.removeEventListener('scroll', this.scrollHandler)\r\n }\r\n\r\n private resetHeight = () => {\r\n const heghtType = this.getHeightType()\r\n if (heghtType) {\r\n ElementStyleUtil.set(this.element, heghtType, '')\r\n }\r\n }\r\n\r\n ///////////////////////\r\n // ** Public API ** //\r\n ///////////////////////\r\n public update = () => {\r\n // Activate/deactivate\r\n if (\r\n this.getOption('activate') === true ||\r\n !this.element.hasAttribute('data-kt-scroll-activate')\r\n ) {\r\n this.setupHeight()\r\n this.setupScrollHandler()\r\n this.setupState()\r\n } else {\r\n this.resetHeight()\r\n this.destroyScrollHandler()\r\n }\r\n }\r\n\r\n public getHeight = () => {\r\n const heightType = this.getHeightType()\r\n const height = this.getOption(heightType || '')\r\n if (height instanceof Function) {\r\n return height.call(height)\r\n } else if (height !== null && typeof height === 'string' && height.toLowerCase() === 'auto') {\r\n return this.getAutoHeight()\r\n } else {\r\n return height\r\n }\r\n }\r\n\r\n public getElement = () => {\r\n return this.element\r\n }\r\n\r\n // Static methods\r\n public static hasInstace(element: HTMLElement) {\r\n return DataUtil.has(element, 'scroll')\r\n }\r\n\r\n public static getInstance(element: HTMLElement): ScrollComponent | undefined {\r\n if (element !== null && ScrollComponent.hasInstace(element)) {\r\n const data = DataUtil.get(element, 'scroll')\r\n if (data) {\r\n return data as ScrollComponent\r\n }\r\n }\r\n }\r\n\r\n // Create Instances\r\n public static createInstances(selector: string) {\r\n const elements = document.body.querySelectorAll(selector)\r\n elements.forEach((element: Element) => {\r\n const item = element as HTMLElement\r\n let scroll = ScrollComponent.getInstance(item)\r\n if (!scroll) {\r\n scroll = new ScrollComponent(item, defaultScrollOptions)\r\n }\r\n })\r\n }\r\n\r\n public static destroyAll(attr: string = '[data-kt-scroll=\"true\"]') {}\r\n\r\n public static bootstrap(attr: string = '[data-kt-scroll=\"true\"]') {\r\n ScrollComponent.createInstances(attr)\r\n ScrollComponent.resize()\r\n }\r\n\r\n public static createInstance = (\r\n element: HTMLElement,\r\n options: ScrollOptions = defaultScrollOptions\r\n ): ScrollComponent | undefined => {\r\n let scroll = ScrollComponent.getInstance(element)\r\n if (!scroll) {\r\n scroll = new ScrollComponent(element, options)\r\n }\r\n return scroll\r\n }\r\n\r\n public static reinitialization(attr: string = '[data-kt-scroll=\"true\"]') {\r\n ScrollComponent.createInstances(attr)\r\n }\r\n\r\n public static updateAll() {\r\n const elements = document.body.querySelectorAll('[data-kt-scroll=\"true\"]')\r\n elements.forEach((element: Element) => {\r\n const instance = ScrollComponent.getInstance(element as HTMLElement)\r\n if (instance) {\r\n instance.update()\r\n }\r\n })\r\n }\r\n\r\n public static resize() {\r\n // Window Resize Handling\r\n window.addEventListener('resize', function () {\r\n let timer\r\n throttle(\r\n timer,\r\n () => {\r\n // Locate and update Drawer instances on window resize\r\n ScrollComponent.updateAll()\r\n },\r\n 200\r\n )\r\n })\r\n }\r\n}\r\n\r\nexport {ScrollComponent, defaultScrollOptions}\r\n","import {\r\n getScrollTop,\r\n getAttributeValueByBreakpoint,\r\n throttle,\r\n getObjectPropertyValueByKey,\r\n stringSnakeToCamel,\r\n getUniqueIdWithPrefix,\r\n DataUtil,\r\n ElementAnimateUtil,\r\n} from '../_utils/index'\r\n\r\nexport interface IScrollTopOptions {\r\n offset: number\r\n speed: number\r\n}\r\n\r\nconst defaultScrollTopOptions: IScrollTopOptions = {\r\n offset: 200,\r\n speed: 600,\r\n}\r\n\r\nclass ScrollTopComponent {\r\n element: HTMLElement\r\n options: IScrollTopOptions\r\n instanceUid: string\r\n\r\n constructor(_element: HTMLElement, options: IScrollTopOptions) {\r\n this.element = _element\r\n this.options = Object.assign(defaultScrollTopOptions, options)\r\n this.instanceUid = getUniqueIdWithPrefix('scrolltop')\r\n\r\n // Event Handlers\r\n this._handlers()\r\n\r\n // Bind Instance\r\n DataUtil.set(this.element, 'scrolltop', this)\r\n }\r\n\r\n private _handlers = () => {\r\n let timer: number\r\n window.addEventListener('scroll', () => {\r\n throttle(timer, () => {\r\n this._scroll()\r\n })\r\n })\r\n\r\n this.element.addEventListener('click', (e: Event) => {\r\n e.preventDefault()\r\n this._go()\r\n })\r\n }\r\n\r\n private _scroll = () => {\r\n const offset = parseInt(this._getOption('offset') as string)\r\n const pos = getScrollTop() // current vertical position\r\n if (pos > offset) {\r\n if (!document.body.hasAttribute('data-kt-scrolltop')) {\r\n document.body.setAttribute('data-kt-scrolltop', 'on')\r\n }\r\n } else {\r\n if (document.body.hasAttribute('data-kt-scrolltop')) {\r\n document.body.removeAttribute('data-kt-scrolltop')\r\n }\r\n }\r\n }\r\n\r\n private _go = () => {\r\n const speed = parseInt(this._getOption('speed') as string)\r\n ElementAnimateUtil.scrollTop(0, speed)\r\n }\r\n\r\n private _getOption = (name: string) => {\r\n const attr = this.element.getAttribute(`data-kt-scrolltop-${name}`)\r\n if (attr) {\r\n const value = getAttributeValueByBreakpoint(attr)\r\n return value !== null && String(value) === 'true'\r\n }\r\n\r\n const optionName = stringSnakeToCamel(name)\r\n const option = getObjectPropertyValueByKey(this.options, optionName)\r\n if (option) {\r\n return getAttributeValueByBreakpoint(option)\r\n }\r\n\r\n return null\r\n }\r\n\r\n ///////////////////////\r\n // ** Public API ** //\r\n ///////////////////////\r\n\r\n // Plugin API\r\n public go = () => {\r\n return this._go()\r\n }\r\n\r\n public getElement = () => {\r\n return this.element\r\n }\r\n\r\n // Static methods\r\n public static getInstance = (el: HTMLElement): ScrollTopComponent | undefined => {\r\n const scrollTop = DataUtil.get(el, 'scrolltop')\r\n if (scrollTop) {\r\n return scrollTop as ScrollTopComponent\r\n }\r\n }\r\n\r\n public static createInstances = (selector: string) => {\r\n const elements = document.body.querySelectorAll(selector)\r\n elements.forEach((el) => {\r\n const item = el as HTMLElement\r\n let scrollTop = ScrollTopComponent.getInstance(item)\r\n if (!scrollTop) {\r\n scrollTop = new ScrollTopComponent(item, defaultScrollTopOptions)\r\n }\r\n })\r\n }\r\n\r\n public static createInsance = (\r\n selector: string,\r\n options: IScrollTopOptions = defaultScrollTopOptions\r\n ): ScrollTopComponent | undefined => {\r\n const element = document.body.querySelector(selector)\r\n if (!element) {\r\n return\r\n }\r\n const item = element as HTMLElement\r\n let scrollTop = ScrollTopComponent.getInstance(item)\r\n if (!scrollTop) {\r\n scrollTop = new ScrollTopComponent(item, options)\r\n }\r\n return scrollTop\r\n }\r\n\r\n public static bootstrap = () => {\r\n ScrollTopComponent.createInstances('[data-kt-scrolltop=\"true\"]')\r\n }\r\n\r\n public static reinitialization = () => {\r\n ScrollTopComponent.createInstances('[data-kt-scrolltop=\"true\"]')\r\n }\r\n\r\n public static goTop = () => {\r\n ElementAnimateUtil.scrollTop(0, defaultScrollTopOptions.speed)\r\n }\r\n}\r\nexport {ScrollTopComponent, defaultScrollTopOptions}\r\n","import {DataUtil, DOMEventHandlerUtil, ElementAnimateUtil, ElementStyleUtil, EventHandlerUtil, getElementIndex, getUniqueIdWithPrefix,} from '../_utils/index';\r\n\r\nexport interface IStepperOptions {\r\n startIndex: number;\r\n animation: boolean;\r\n animationSpeed: string;\r\n animationNextClass: string;\r\n animationPreviousClass: string;\r\n}\r\n\r\nconst defaultStepperOptions: IStepperOptions = {\r\n startIndex: 1,\r\n animation: false,\r\n animationSpeed: '0.3s',\r\n animationNextClass: 'animate__animated animate__slideInRight animate__fast',\r\n animationPreviousClass:\r\n 'animate__animated animate__slideInLeft animate__fast',\r\n};\r\n\r\nclass StepperComponent {\r\n element: HTMLElement;\r\n options: IStepperOptions;\r\n instanceUid: string;\r\n steps: NodeListOf;\r\n btnNext: HTMLElement | null;\r\n btnPrev: HTMLElement | null;\r\n btnSubmit: HTMLElement | null;\r\n totatStepsNumber: number = 0;\r\n passedStepIndex: number = 0;\r\n currentStepIndex: number = 1;\r\n\r\n constructor(_element: HTMLElement, options: IStepperOptions) {\r\n this.element = _element;\r\n this.options = Object.assign(defaultStepperOptions, options);\r\n this.instanceUid = getUniqueIdWithPrefix('stepper');\r\n\r\n // Elements\r\n this.steps = this.element.querySelectorAll(\r\n '[data-kt-stepper-element=\"nav\"]'\r\n );\r\n this.btnNext = this.element.querySelector(\r\n '[data-kt-stepper-action=\"next\"]'\r\n );\r\n this.btnPrev = this.element.querySelector(\r\n '[data-kt-stepper-action=\"previous\"]'\r\n );\r\n this.btnSubmit = this.element.querySelector(\r\n '[data-kt-stepper-action=\"submit\"]'\r\n );\r\n\r\n // Variables\r\n this.totatStepsNumber = this.steps?.length | 0;\r\n this.passedStepIndex = 0;\r\n this.currentStepIndex = 1;\r\n\r\n // Set Current Step\r\n if (this.options.startIndex > 1) {\r\n this._goTo(this.options.startIndex);\r\n }\r\n\r\n // Event Handlers\r\n this.initHandlers();\r\n\r\n // Bind Instance\r\n DataUtil.set(this.element, 'stepper', this);\r\n }\r\n\r\n private _goTo = (index: number) => {\r\n EventHandlerUtil.trigger(this.element, 'kt.stepper.change');\r\n // Skip if this step is already shown\r\n if (\r\n index === this.currentStepIndex ||\r\n index > this.totatStepsNumber ||\r\n index < 0\r\n ) {\r\n return;\r\n }\r\n\r\n // Validate step number\r\n index = parseInt(index.toString());\r\n // Set current step\r\n this.passedStepIndex = this.currentStepIndex;\r\n this.currentStepIndex = index;\r\n\r\n // Refresh elements\r\n this.refreshUI();\r\n\r\n EventHandlerUtil.trigger(this.element, 'kt.stepper.changed');\r\n };\r\n\r\n private initHandlers = () => {\r\n this.btnNext?.addEventListener('click', (e: Event) => {\r\n e.preventDefault();\r\n\r\n EventHandlerUtil.trigger(this.element, 'kt.stepper.next', e);\r\n });\r\n\r\n this.btnPrev?.addEventListener('click', (e: Event) => {\r\n e.preventDefault();\r\n\r\n EventHandlerUtil.trigger(this.element, 'kt.stepper.previous', e);\r\n });\r\n\r\n DOMEventHandlerUtil.on(\r\n this.element,\r\n '[data-kt-stepper-action=\"step\"]',\r\n 'click',\r\n (e: Event) => {\r\n e.preventDefault();\r\n\r\n if (this.steps && this.steps.length > 0) {\r\n for (let i = 0; i < this.steps.length; i++) {\r\n if ((this.steps[i] as HTMLElement) === this.element) {\r\n let index = i + 1;\r\n\r\n const stepDirection = this._getStepDirection(index);\r\n EventHandlerUtil.trigger(\r\n this.element,\r\n `stepper.${stepDirection}`,\r\n e\r\n );\r\n return;\r\n }\r\n }\r\n }\r\n }\r\n );\r\n };\r\n\r\n private _getStepDirection = (index: number) => {\r\n return index > this.currentStepIndex ? 'next' : 'previous';\r\n };\r\n\r\n private getStepContent = (index: number) => {\r\n const content = this.element.querySelectorAll(\r\n '[data-kt-stepper-element=\"content\"]'\r\n );\r\n if (!content) {\r\n return false;\r\n }\r\n\r\n if (content[index - 1]) {\r\n return content[index - 1];\r\n }\r\n\r\n return false;\r\n };\r\n\r\n private getLastStepIndex = () => {\r\n return this.totatStepsNumber;\r\n };\r\n\r\n private getTotalStepsNumber = () => {\r\n return this.totatStepsNumber;\r\n };\r\n\r\n private refreshUI = () => {\r\n let state = '';\r\n\r\n if (this.isLastStep()) {\r\n state = 'last';\r\n } else if (this.isFirstStep()) {\r\n state = 'first';\r\n } else {\r\n state = 'between';\r\n }\r\n\r\n // Set state class\r\n this.element.classList.remove('last');\r\n this.element.classList.remove('first');\r\n this.element.classList.remove('between');\r\n\r\n this.element.classList.add(state);\r\n\r\n // Step Items\r\n const elements = this.element.querySelectorAll(\r\n '[data-kt-stepper-element=\"nav\"], [data-kt-stepper-element=\"content\"], [data-kt-stepper-element=\"info\"]'\r\n );\r\n\r\n if (!elements || elements.length <= 0) {\r\n return;\r\n }\r\n\r\n for (var i = 0, len = elements.length; i < len; i++) {\r\n var element = elements[i] as HTMLElement;\r\n var index = getElementIndex(element) + 1;\r\n\r\n element.classList.remove('current');\r\n element.classList.remove('completed');\r\n element.classList.remove('pending');\r\n\r\n if (index === this.currentStepIndex) {\r\n element.classList.add('current');\r\n\r\n if (\r\n this.options.animation !== false &&\r\n element.getAttribute('data-kt-stepper-element') === 'content'\r\n ) {\r\n ElementStyleUtil.set(\r\n element,\r\n 'animationDuration',\r\n this.options.animationSpeed\r\n );\r\n\r\n const animation =\r\n this._getStepDirection(this.passedStepIndex) === 'previous'\r\n ? this.options.animationPreviousClass\r\n : this.options.animationNextClass;\r\n ElementAnimateUtil.animateClass(element, animation);\r\n }\r\n } else {\r\n if (index < this.currentStepIndex) {\r\n element.classList.add('completed');\r\n } else {\r\n element.classList.add('pending');\r\n }\r\n }\r\n }\r\n };\r\n\r\n private isLastStep = () => {\r\n return this.currentStepIndex === this.totatStepsNumber;\r\n };\r\n\r\n private isFirstStep = () => {\r\n return this.currentStepIndex === 1;\r\n };\r\n\r\n private isBetweenStep = () => {\r\n return this.isLastStep() === false && this.isFirstStep() === false;\r\n };\r\n\r\n // ///////////////////////\r\n // // ** Public API ** //\r\n // ///////////////////////\r\n\r\n // // Plugin API\r\n public goto = (index: number) => {\r\n return this._goTo(index);\r\n };\r\n\r\n public goNext = () => {\r\n return this.goto(this.getNextStepIndex());\r\n };\r\n\r\n public goPrev = () => {\r\n return this.goto(this.getPrevStepIndex());\r\n };\r\n\r\n public goFirst = () => {\r\n return this.goto(1);\r\n };\r\n\r\n public goLast = () => {\r\n return this.goto(this.getLastStepIndex());\r\n };\r\n\r\n public getCurrentStepIndex = () => {\r\n return this.currentStepIndex;\r\n };\r\n\r\n public getNextStepIndex = () => {\r\n if (this.totatStepsNumber >= this.currentStepIndex + 1) {\r\n return this.currentStepIndex + 1;\r\n } else {\r\n return this.totatStepsNumber;\r\n }\r\n };\r\n\r\n public getPassedStepIndex = () => {\r\n return this.passedStepIndex;\r\n };\r\n\r\n public getPrevStepIndex = () => {\r\n if (this.currentStepIndex - 1 > 1) {\r\n return this.currentStepIndex - 1;\r\n } else {\r\n return 1;\r\n }\r\n };\r\n\r\n public getElement = (index: number) => {\r\n return this.element;\r\n };\r\n\r\n // Event API\r\n public on = (name: string, handler: Function) => {\r\n return EventHandlerUtil.on(this.element, name, handler);\r\n };\r\n\r\n public one = (name: string, handler: Function) => {\r\n return EventHandlerUtil.one(this.element, name, handler);\r\n };\r\n\r\n public off = (name: string, handlerId: string) => {\r\n return EventHandlerUtil.off(this.element, name, handlerId);\r\n };\r\n\r\n public destroy = () => {\r\n console.log('destroy stepper');\r\n };\r\n\r\n public trigger = (name: string, event: Event) => {\r\n return EventHandlerUtil.trigger(this.element, name, event);\r\n };\r\n\r\n // Static methods\r\n public static hasInstace(element: HTMLElement): boolean {\r\n return DataUtil.has(element, 'stepper');\r\n }\r\n\r\n public static getInstance(\r\n element: HTMLElement\r\n ): StepperComponent | undefined {\r\n if (element !== null && StepperComponent.hasInstace(element)) {\r\n const data = DataUtil.get(element, 'stepper');\r\n if (data) {\r\n return data as StepperComponent;\r\n }\r\n }\r\n }\r\n\r\n // Create Instances\r\n public static createInstances(selector: string): void {\r\n const elements = document.body.querySelectorAll(selector);\r\n elements.forEach((element) => {\r\n const item = element as HTMLElement;\r\n let stepper = StepperComponent.getInstance(item);\r\n if (!stepper) {\r\n stepper = new StepperComponent(item, defaultStepperOptions);\r\n }\r\n });\r\n }\r\n\r\n public static createInsance = (\r\n element: HTMLElement,\r\n options: IStepperOptions = defaultStepperOptions\r\n ): StepperComponent | null => {\r\n if (!element) {\r\n return null;\r\n }\r\n let stepper = StepperComponent.getInstance(element);\r\n if (!stepper) {\r\n stepper = new StepperComponent(element, options);\r\n }\r\n return stepper;\r\n };\r\n\r\n public static bootstrap(attr: string = '[data-kt-stepper]') {\r\n StepperComponent.createInstances(attr);\r\n }\r\n}\r\n\r\nexport {StepperComponent, defaultStepperOptions};\r\n","import {\r\n getElementOffset,\r\n getScrollTop,\r\n getAttributeValueByBreakpoint,\r\n getUniqueIdWithPrefix,\r\n getObjectPropertyValueByKey,\r\n stringSnakeToCamel,\r\n getCSS,\r\n DataUtil,\r\n ElementAnimateUtil,\r\n ElementStyleUtil,\r\n EventHandlerUtil,\r\n} from '../_utils/index'\r\n\r\nexport interface StickyOptions {\r\n offset: number\r\n reverse: boolean\r\n animation: boolean\r\n animationSpeed: string\r\n animationClass: string\r\n}\r\n\r\nconst defaultStickyOptions: StickyOptions = {\r\n offset: 200,\r\n reverse: false,\r\n animation: true,\r\n animationSpeed: '0.3s',\r\n animationClass: 'animation-slide-in-down',\r\n}\r\n\r\nclass StickyComponent {\r\n element: HTMLElement\r\n options: StickyOptions\r\n instanceUid: string\r\n instanceName: string | null = ''\r\n attributeName: string\r\n attributeName2: string\r\n eventTriggerState: boolean\r\n lastScrollTop: number\r\n\r\n constructor(_element: HTMLElement, options: StickyOptions) {\r\n this.element = _element\r\n this.options = Object.assign(defaultStickyOptions, options)\r\n this.instanceUid = getUniqueIdWithPrefix('sticky')\r\n this.instanceName = this.element.getAttribute('data-kt-sticky-name')\r\n this.attributeName = 'data-kt-sticky-' + this.instanceName\r\n this.attributeName2 = 'data-kt-' + this.instanceName\r\n this.eventTriggerState = true\r\n this.lastScrollTop = 0\r\n\r\n // Event Handlers\r\n window.addEventListener('scroll', this.scroll)\r\n\r\n // Initial Launch\r\n this.scroll()\r\n\r\n DataUtil.set(this.element, 'sticky', this)\r\n }\r\n\r\n private scroll = () => {\r\n let offset = this.getOption('offset')\r\n let reverse = this.getOption('reverse')\r\n\r\n // Exit if false\r\n if (offset === false) {\r\n return\r\n }\r\n\r\n let offsetNum = 0\r\n if (typeof offset === 'string') {\r\n offsetNum = parseInt(offset)\r\n }\r\n\r\n const st = getScrollTop()\r\n\r\n // Reverse scroll mode\r\n if (reverse === true) {\r\n // Release on reverse scroll mode\r\n if (st > offsetNum && this.lastScrollTop < st) {\r\n if (document.body.hasAttribute(this.attributeName) === false) {\r\n this.enable()\r\n document.body.setAttribute(this.attributeName, 'on')\r\n document.body.setAttribute(this.attributeName2, 'on')\r\n }\r\n\r\n if (this.eventTriggerState === true) {\r\n EventHandlerUtil.trigger(this.element, 'kt.sticky.on')\r\n EventHandlerUtil.trigger(this.element, 'kt.sticky.change')\r\n\r\n this.eventTriggerState = false\r\n }\r\n } else {\r\n // Back scroll mode\r\n if (document.body.hasAttribute(this.attributeName)) {\r\n this.disable()\r\n document.body.removeAttribute(this.attributeName)\r\n document.body.removeAttribute(this.attributeName2)\r\n }\r\n\r\n if (this.eventTriggerState === false) {\r\n EventHandlerUtil.trigger(this.element, 'kt.sticky.off')\r\n EventHandlerUtil.trigger(this.element, 'kt.sticky.change')\r\n\r\n this.eventTriggerState = true\r\n }\r\n }\r\n\r\n this.lastScrollTop = st\r\n return\r\n }\r\n\r\n // Classic scroll mode\r\n if (st > offsetNum) {\r\n if (document.body.hasAttribute(this.attributeName) === false) {\r\n this.enable()\r\n document.body.setAttribute(this.attributeName, 'on')\r\n document.body.setAttribute(this.attributeName2, 'on')\r\n }\r\n\r\n if (this.eventTriggerState === true) {\r\n EventHandlerUtil.trigger(this.element, 'kt.sticky.on')\r\n EventHandlerUtil.trigger(this.element, 'kt.sticky.change')\r\n this.eventTriggerState = false\r\n }\r\n } else {\r\n // back scroll mode\r\n if (document.body.hasAttribute(this.attributeName) === true) {\r\n this.disable()\r\n document.body.removeAttribute(this.attributeName)\r\n document.body.removeAttribute(this.attributeName2)\r\n }\r\n\r\n if (this.eventTriggerState === false) {\r\n EventHandlerUtil.trigger(this.element, 'kt.sticky.off')\r\n EventHandlerUtil.trigger(this.element, 'kt.sticky.change')\r\n this.eventTriggerState = true\r\n }\r\n }\r\n }\r\n\r\n private getOption = (name: string) => {\r\n const dataStickyAttr = 'data-kt-sticky-' + name\r\n if (this.element.hasAttribute(dataStickyAttr) === true) {\r\n const attrValueInStr = this.element.getAttribute(dataStickyAttr)\r\n const attrValue = getAttributeValueByBreakpoint(attrValueInStr || '')\r\n if (attrValue !== null && String(attrValue) === 'true') {\r\n return true\r\n } else if (attrValue !== null && String(attrValue) === 'false') {\r\n return false\r\n }\r\n\r\n return attrValue\r\n } else {\r\n const optionName = stringSnakeToCamel(name)\r\n const option = getObjectPropertyValueByKey(this.options, optionName)\r\n if (option) {\r\n return getAttributeValueByBreakpoint(option)\r\n }\r\n }\r\n }\r\n\r\n private disable = () => {\r\n ElementStyleUtil.remove(this.element, 'top')\r\n ElementStyleUtil.remove(this.element, 'width')\r\n ElementStyleUtil.remove(this.element, 'left')\r\n ElementStyleUtil.remove(this.element, 'right')\r\n ElementStyleUtil.remove(this.element, 'z-index')\r\n ElementStyleUtil.remove(this.element, 'position')\r\n }\r\n\r\n private enable = (update: boolean = false) => {\r\n const top = this.getOption('top')\r\n const left = this.getOption('left')\r\n // const right = this.getOption(\"right\");\r\n let width = this.getOption('width')\r\n const zindex = this.getOption('zindex')\r\n\r\n if (update !== true && this.getOption('animation') === true) {\r\n ElementStyleUtil.set(this.element, 'animationDuration', this.getOption('animationSpeed'))\r\n ElementAnimateUtil.animateClass(this.element, 'animation ' + this.getOption('animationClass'))\r\n }\r\n\r\n if (zindex !== null) {\r\n ElementStyleUtil.set(this.element, 'z-index', zindex)\r\n ElementStyleUtil.set(this.element, 'position', 'fixed')\r\n }\r\n\r\n if (top !== null) {\r\n ElementStyleUtil.set(this.element, 'top', top)\r\n }\r\n\r\n if (width !== null && width !== undefined) {\r\n const widthTarget = getObjectPropertyValueByKey(width, 'target')\r\n if (widthTarget) {\r\n const targetElement = document.querySelector(widthTarget)\r\n if (targetElement) {\r\n width = getCSS(targetElement, 'width')\r\n }\r\n }\r\n ElementStyleUtil.set(this.element, 'width', width)\r\n }\r\n\r\n if (left !== null) {\r\n if (String(left).toLowerCase() === 'auto') {\r\n var offsetLeft = getElementOffset(this.element).left\r\n\r\n if (offsetLeft > 0) {\r\n ElementStyleUtil.set(this.element, 'left', String(offsetLeft) + 'px')\r\n }\r\n }\r\n }\r\n }\r\n\r\n public update = () => {\r\n if (document.body.hasAttribute(this.attributeName) === true) {\r\n this.disable()\r\n document.body.removeAttribute(this.attributeName)\r\n document.body.removeAttribute(this.attributeName2)\r\n this.enable(true)\r\n document.body.setAttribute(this.attributeName, 'on')\r\n document.body.setAttribute(this.attributeName2, 'on')\r\n }\r\n }\r\n\r\n // Event API\r\n public on = (name: string, callBack: Function) => {\r\n return EventHandlerUtil.on(this.element, name, callBack)\r\n }\r\n\r\n public one = (name: string, callback: Function) => {\r\n return EventHandlerUtil.one(this.element, name, callback)\r\n }\r\n\r\n public off = (name: string, handlerId: string) => {\r\n return EventHandlerUtil.off(this.element, name, handlerId)\r\n }\r\n\r\n public trigger = (name: string) => {\r\n return EventHandlerUtil.trigger(this.element, name)\r\n }\r\n\r\n // Static methods\r\n public static hasInstace(element: HTMLElement) {\r\n return DataUtil.has(element, 'sticky')\r\n }\r\n\r\n public static getInstance(element: HTMLElement): StickyComponent | undefined {\r\n if (element !== null && StickyComponent.hasInstace(element)) {\r\n const data = DataUtil.get(element, 'sticky')\r\n if (data) {\r\n return data as StickyComponent\r\n }\r\n }\r\n }\r\n\r\n // Create Instances\r\n public static createInstances(selector: string) {\r\n const elements = document.body.querySelectorAll(selector)\r\n elements.forEach((element) => {\r\n const item = element as HTMLElement\r\n let sticky = StickyComponent.getInstance(item)\r\n if (!sticky) {\r\n sticky = new StickyComponent(item, defaultStickyOptions)\r\n }\r\n })\r\n }\r\n\r\n public static createInsance = (\r\n selector: string,\r\n options: StickyOptions = defaultStickyOptions\r\n ): StickyComponent | undefined => {\r\n const element = document.body.querySelector(selector)\r\n if (!element) {\r\n return\r\n }\r\n const item = element as HTMLElement\r\n let sticky = StickyComponent.getInstance(item)\r\n if (!sticky) {\r\n sticky = new StickyComponent(item, options)\r\n }\r\n return sticky\r\n }\r\n\r\n public static bootstrap(attr: string = '[data-kt-sticky=\"true\"]') {\r\n StickyComponent.createInstances(attr)\r\n }\r\n\r\n public static reInitialization(attr: string = '[data-kt-sticky=\"true\"]') {\r\n StickyComponent.createInstances(attr)\r\n }\r\n}\r\n\r\nexport {StickyComponent, defaultStickyOptions}\r\n","import {\r\n getAttributeValueByBreakpoint,\r\n stringSnakeToCamel,\r\n getObjectPropertyValueByKey,\r\n EventHandlerUtil,\r\n throttle,\r\n} from '../_utils/index'\r\n\r\nexport class SwapperStore {\r\n static store: Map = new Map()\r\n\r\n public static set(instanceId: string, drawerComponentObj: SwapperComponent): void {\r\n if (SwapperStore.has(instanceId)) {\r\n return\r\n }\r\n\r\n SwapperStore.store.set(instanceId, drawerComponentObj)\r\n }\r\n\r\n public static get(instanceId: string): SwapperComponent | undefined {\r\n if (!SwapperStore.has(instanceId)) {\r\n return\r\n }\r\n return SwapperStore.store.get(instanceId)\r\n }\r\n\r\n public static remove(instanceId: string): void {\r\n if (!SwapperStore.has(instanceId)) {\r\n return\r\n }\r\n\r\n SwapperStore.store.delete(instanceId)\r\n }\r\n\r\n public static has(instanceId: string): boolean {\r\n return SwapperStore.store.has(instanceId)\r\n }\r\n\r\n public static getAllInstances() {\r\n return SwapperStore.store\r\n }\r\n}\r\n\r\nexport interface ISwapperOptions {\r\n mode: string\r\n}\r\n\r\nexport interface ISwapperQueries {\r\n componentName: string\r\n instanseQuery: string\r\n attrQuery: string\r\n}\r\n\r\nconst defaultSwapperOptions: ISwapperOptions = {\r\n mode: 'append',\r\n}\r\n\r\nconst defaultSwapperQueires: ISwapperQueries = {\r\n componentName: 'swapper',\r\n instanseQuery: '[data-kt-swapper=\"true\"]',\r\n attrQuery: 'data-kt-swapper-',\r\n}\r\n\r\nclass SwapperComponent {\r\n element: HTMLElement\r\n options: ISwapperOptions\r\n queries: ISwapperQueries\r\n\r\n constructor(_element: HTMLElement, _options: ISwapperOptions, _queries: ISwapperQueries) {\r\n this.element = _element\r\n this.options = Object.assign(defaultSwapperOptions, _options)\r\n this.queries = _queries\r\n\r\n // Initial update\r\n this.update()\r\n\r\n SwapperStore.set(this.element.id, this)\r\n }\r\n\r\n private getOption(name: string) {\r\n const attr = this.element.getAttribute(`${this.queries.attrQuery}${name}`)\r\n if (attr) {\r\n let value = getAttributeValueByBreakpoint(attr)\r\n if (attr != null && String(value) === 'true') {\r\n return true\r\n } else if (value !== null && String(value) === 'false') {\r\n return false\r\n }\r\n return value\r\n } else {\r\n const optionName = stringSnakeToCamel(name)\r\n const option = getObjectPropertyValueByKey(this.options, optionName)\r\n if (option) {\r\n return getAttributeValueByBreakpoint(option)\r\n } else {\r\n return null\r\n }\r\n }\r\n }\r\n\r\n ///////////////////////\r\n // ** Public API ** //\r\n ///////////////////////\r\n public update = () => {\r\n const parentSelector = this.getOption('parent')?.toString()\r\n const mode = this.getOption('mode')\r\n const parentElement = parentSelector ? document.querySelector(parentSelector) : null\r\n\r\n if (parentElement && this.element.parentNode !== parentElement) {\r\n if (mode === 'prepend') {\r\n parentElement.prepend(this.element)\r\n } else if (mode === 'append') {\r\n parentElement.append(this.element)\r\n }\r\n }\r\n }\r\n\r\n // Event API\r\n public on = (name: string, handler: Function) => {\r\n return EventHandlerUtil.on(this.element, name, handler)\r\n }\r\n\r\n public one = (name: string, handler: Function) => {\r\n return EventHandlerUtil.one(this.element, name, handler)\r\n }\r\n\r\n public off = (name: string, handlerId: string) => {\r\n return EventHandlerUtil.off(this.element, name, handlerId)\r\n }\r\n\r\n public trigger = (name: string, event: Event) => {\r\n return EventHandlerUtil.trigger(this.element, name, event)\r\n }\r\n\r\n // Static methods\r\n public static getInstance = (\r\n el: HTMLElement,\r\n componentName: string = defaultSwapperQueires.componentName\r\n ): SwapperComponent | null => {\r\n const place = SwapperStore.get(el.id)\r\n if (place) {\r\n return place as SwapperComponent\r\n }\r\n\r\n return null\r\n }\r\n\r\n public static createInstances = (\r\n selector: string = defaultSwapperQueires.instanseQuery,\r\n options: ISwapperOptions = defaultSwapperOptions,\r\n queries: ISwapperQueries = defaultSwapperQueires\r\n ) => {\r\n const elements = document.body.querySelectorAll(selector)\r\n elements.forEach((el) => {\r\n const item = el as HTMLElement\r\n let place = SwapperComponent.getInstance(item)\r\n if (!place) {\r\n place = new SwapperComponent(item, options, queries)\r\n }\r\n })\r\n }\r\n\r\n public static createInsance = (\r\n selector: string = defaultSwapperQueires.instanseQuery,\r\n options: ISwapperOptions = defaultSwapperOptions,\r\n queries: ISwapperQueries = defaultSwapperQueires\r\n ): SwapperComponent | undefined => {\r\n const element = document.body.querySelector(selector)\r\n if (!element) {\r\n return\r\n }\r\n const item = element as HTMLElement\r\n let place = SwapperComponent.getInstance(item)\r\n if (!place) {\r\n place = new SwapperComponent(item, options, queries)\r\n }\r\n return place\r\n }\r\n\r\n public static bootstrap = (selector: string = defaultSwapperQueires.instanseQuery) => {\r\n SwapperComponent.createInstances(selector)\r\n }\r\n\r\n public static reinitialization = (selector: string = defaultSwapperQueires.instanseQuery) => {\r\n SwapperComponent.createInstances(selector)\r\n }\r\n}\r\n\r\n// Window resize handler\r\nwindow.addEventListener('resize', function () {\r\n let timer\r\n throttle(\r\n timer,\r\n () => {\r\n // Locate and update Offcanvas instances on window resize\r\n const elements = document.querySelectorAll(defaultSwapperQueires.instanseQuery)\r\n elements.forEach((el) => {\r\n const place = SwapperComponent.getInstance(el as HTMLElement)\r\n if (place) {\r\n place.update()\r\n }\r\n })\r\n },\r\n 200\r\n )\r\n})\r\n\r\nexport {SwapperComponent, defaultSwapperOptions, defaultSwapperQueires}\r\n","import {DataUtil, EventHandlerUtil, getUniqueIdWithPrefix,} from '../_utils/index';\r\n// Helpers\r\nimport {CookieComponent} from './_CookieComponent';\r\n\r\nexport interface ToggleOptions {\r\n saveState: boolean;\r\n targetState?: string;\r\n toggleState?: string;\r\n targetToggleMode?: string;\r\n}\r\n\r\nconst defaultToggleOptions: ToggleOptions = {\r\n saveState: false,\r\n};\r\n\r\nclass ToggleComponent {\r\n element: HTMLElement;\r\n instanceUid: string;\r\n options: ToggleOptions;\r\n state: string = '';\r\n mode: string = '';\r\n target: HTMLElement | null = null;\r\n attribute: string = '';\r\n\r\n constructor(_element: HTMLElement, options: ToggleOptions) {\r\n this.options = Object.assign(defaultToggleOptions, options);\r\n this.instanceUid = getUniqueIdWithPrefix('toggle');\r\n this.element = _element;\r\n\r\n const elementTargetAttr = this.element.getAttribute(\r\n 'data-kt-toggle-target'\r\n );\r\n if (elementTargetAttr) {\r\n this.target = document.querySelector(elementTargetAttr);\r\n }\r\n const elementToggleAttr = this.element.getAttribute('data-kt-toggle-state');\r\n this.state = elementToggleAttr || '';\r\n const elementModeAttr = this.element.getAttribute('data-kt-toggle-mode');\r\n this.mode = elementModeAttr || '';\r\n this.attribute =\r\n 'data-kt-' + this.element.getAttribute('data-kt-toggle-name');\r\n\r\n // Event Handlers\r\n this._handlers();\r\n\r\n // Update Instance\r\n // Bind Instance\r\n DataUtil.set(this.element, 'toggle', this);\r\n }\r\n\r\n private _handlers = () => {\r\n this.element.addEventListener('click', (e: Event) => {\r\n e.preventDefault();\r\n\r\n if (this.mode === '') {\r\n this._toggle();\r\n return;\r\n }\r\n\r\n if (this.mode === 'off' && !this._isEnabled()) {\r\n this._toggle();\r\n } else if (this.mode === 'on' && this._isEnabled()) {\r\n this._toggle();\r\n }\r\n });\r\n };\r\n\r\n // Event handlers\r\n private _toggle = () => {\r\n // Trigger \"after.toggle\" event\r\n EventHandlerUtil.trigger(this.element, 'kt.toggle.change');\r\n\r\n if (this._isEnabled()) {\r\n this._disable();\r\n } else {\r\n this._enable();\r\n }\r\n\r\n // Trigger \"before.toggle\" event\r\n EventHandlerUtil.trigger(this.element, 'kt.toggle.changed');\r\n return this;\r\n };\r\n\r\n private _enable = () => {\r\n if (this._isEnabled()) {\r\n return;\r\n }\r\n\r\n EventHandlerUtil.trigger(this.element, 'kt.toggle.enable');\r\n this.target?.setAttribute(this.attribute, 'on');\r\n if (this.state.length > 0) {\r\n this.element.classList.add(this.state);\r\n }\r\n\r\n if (this.options.saveState) {\r\n CookieComponent.set(this.attribute, 'on', {});\r\n }\r\n\r\n EventHandlerUtil.trigger(this.element, 'kt.toggle.enabled');\r\n return this;\r\n };\r\n\r\n private _disable = () => {\r\n if (!this._isEnabled()) {\r\n return false;\r\n }\r\n\r\n EventHandlerUtil.trigger(this.element, 'kt.toggle.disable');\r\n this.target?.removeAttribute(this.attribute);\r\n\r\n if (this.state.length > 0) {\r\n this.element.classList.remove(this.state);\r\n }\r\n\r\n if (this.options.saveState) {\r\n CookieComponent.delete(this.attribute);\r\n }\r\n\r\n EventHandlerUtil.trigger(this.element, 'kt.toggle.disabled');\r\n return this;\r\n };\r\n\r\n private _isEnabled = () => {\r\n if (!this.target) {\r\n return false;\r\n }\r\n\r\n return (\r\n String(this.target.getAttribute(this.attribute)).toLowerCase() === 'on'\r\n );\r\n };\r\n\r\n ///////////////////////\r\n // ** Public API ** //\r\n ///////////////////////\r\n\r\n // Plugin API\r\n // Plugin API\r\n public toggle = () => {\r\n return this._toggle();\r\n };\r\n\r\n public enable = () => {\r\n return this._enable();\r\n };\r\n\r\n public disable = () => {\r\n return this._disable();\r\n };\r\n\r\n public isEnabled = () => {\r\n return this._isEnabled();\r\n };\r\n\r\n public goElement = () => {\r\n return this.element;\r\n };\r\n\r\n // Event API\r\n public on = (name: string, handler: Function) => {\r\n return EventHandlerUtil.on(this.element, name, handler);\r\n };\r\n\r\n public one = (name: string, handler: Function) => {\r\n return EventHandlerUtil.one(this.element, name, handler);\r\n };\r\n\r\n public off = (name: string, handlerId: string) => {\r\n return EventHandlerUtil.off(this.element, name, handlerId);\r\n };\r\n\r\n public trigger = (name: string, event?: Event) => {\r\n return EventHandlerUtil.trigger(this.element, name, event);\r\n };\r\n\r\n // Static methods\r\n public static getInstance = (el: HTMLElement) => {\r\n const toggleElement = DataUtil.get(el, 'toggle');\r\n if (toggleElement) {\r\n return toggleElement;\r\n }\r\n\r\n return null;\r\n };\r\n\r\n public static createInstances = (selector: string) => {\r\n const elements = document.body.querySelectorAll(selector);\r\n elements.forEach((el) => {\r\n let toggleObj = ToggleComponent.getInstance(el);\r\n if (!toggleObj) {\r\n toggleObj = new ToggleComponent(el, defaultToggleOptions);\r\n\r\n // Add a class to prevent sidebar hover effect after toggle click\r\n // @ts-ignore\r\n toggleObj.on(\"kt.toggle.change\", function () {\r\n // Set animation state\r\n el.closest('#kt_app_sidebar')?.classList.add(\"animating\");\r\n\r\n // Wait till animation finishes\r\n setTimeout(function () {\r\n // Remove animation state\r\n el.closest('#kt_app_sidebar')?.classList.remove(\"animating\");\r\n }, 300);\r\n });\r\n }\r\n });\r\n };\r\n\r\n public static reinitialization = () => {\r\n ToggleComponent.createInstances('[data-kt-toggle]');\r\n };\r\n\r\n public static bootstrap = () => {\r\n ToggleComponent.createInstances('[data-kt-toggle]');\r\n };\r\n}\r\n\r\nexport {ToggleComponent, defaultToggleOptions};\r\n","export * from './_CookieComponent'\r\nexport * from './_DrawerComponent'\r\nexport * from './_FeedbackComponent'\r\nexport * from './_ScrollComponent'\r\nexport * from './_ScrollTopComponent'\r\nexport * from './_StepperComponent'\r\nexport * from './_StickyComponent'\r\nexport * from './_ToggleComponent'\r\n// export * from './_DialerComponent';\r\nexport * from './_PasswordMeterComponent'\r\nexport * from './_SwapperComponent'\r\nexport * from './MenuComponent'\r\nexport * from './SearchComponent'\r\n","import { BsDatepickerConfig, BsDaterangepickerConfig, BsLocaleService } from 'ngx-bootstrap/datepicker';\r\nimport { NgxBootstrapLocaleMappingService } from '@tp_assets/ngx-bootstrap/ngx-bootstrap-locale-mapping.service';\r\nimport { defineLocale } from '@node_modules/ngx-bootstrap/chronos';\r\nimport { ThemeHelper } from '@tp_app/shared/layout/themes/ThemeHelper';\r\n\r\nexport class NgxBootstrapDatePickerConfigService {\r\n\r\n static getDaterangepickerConfig(): BsDaterangepickerConfig {\r\n return Object.assign(new BsDaterangepickerConfig(), {\r\n containerClass: 'theme-default'\r\n });\r\n }\r\n\r\n static getDatepickerConfig(): BsDatepickerConfig {\r\n return Object.assign(new BsDatepickerConfig(), {\r\n containerClass: 'theme-default'\r\n });\r\n }\r\n\r\n static getDatepickerLocale(): BsLocaleService {\r\n let localeService = new BsLocaleService();\r\n localeService.use(abp.localization.currentLanguage.name);\r\n return localeService;\r\n }\r\n\r\n static registerNgxBootstrapDatePickerLocales(): Promise {\r\n if (abp.localization.currentLanguage.name === 'en') {\r\n return Promise.resolve(true);\r\n }\r\n\r\n let supportedLocale = new NgxBootstrapLocaleMappingService().map(abp.localization.currentLanguage.name).toLowerCase();\r\n let moduleLocaleName = new NgxBootstrapLocaleMappingService().getModuleName(abp.localization.currentLanguage.name);\r\n\r\n return new Promise((resolve, reject) => {\r\n import(`node_modules/ngx-bootstrap/chronos/esm2020/i18n/${supportedLocale}.mjs`)\r\n .then(module => {\r\n defineLocale(abp.localization.currentLanguage.name.toLowerCase(), module[`${moduleLocaleName}Locale`]);\r\n resolve(true);\r\n })\r\n .catch(error => {\r\n console.error('Error importing ngx-bootstrap locale:', error);\r\n reject(false);\r\n });\r\n });\r\n }\r\n}\r\n","export class NgxBootstrapLocaleMappingService {\r\n map(locale: string): string {\r\n const cultureMap = {\r\n 'zh-Hans': 'zh-cn',\r\n 'es-MX': 'es',\r\n 'vi': 'en-gb',\r\n 'ta': 'en-gb'\r\n // Add more here\r\n };\r\n\r\n if (locale === 'en' || locale.startsWith('en-')) {\r\n return 'en-gb';\r\n }\r\n\r\n if (cultureMap[locale]) {\r\n return cultureMap[locale];\r\n }\r\n\r\n return locale;\r\n }\r\n\r\n getModuleName(locale: string): string {\r\n const moduleNameMap = {\r\n 'zh-Hans': 'zhCn',\r\n 'es-MX': 'es',\r\n 'pt-BR': 'ptBr',\r\n 'vi': 'enGb',\r\n 'ta': 'enGb'\r\n // Add more here\r\n };\r\n\r\n if (locale === 'en' || locale.startsWith('en-')) {\r\n return 'enGb';\r\n }\r\n\r\n if (moduleNameMap[locale]) {\r\n return moduleNameMap[locale];\r\n }\r\n\r\n return locale;\r\n }\r\n}\r\n","// \"Production\" enabled environment\r\n\r\nexport const environment = {\r\n production: true,\r\n hmr: false,\r\n appConfig: 'appconfig.production.json',\r\n};\r\n","import { ApplicationRef, NgModuleRef } from '@angular/core';\r\nimport { createNewHosts } from '@angularclass/hmr';\r\n\r\nexport const hmrBootstrap = (module: any, bootstrap: () => Promise>) => {\r\n let ngModule: NgModuleRef;\r\n module.hot.accept();\r\n bootstrap().then((mod) => (ngModule = mod));\r\n module.hot.dispose(() => {\r\n const appRef: ApplicationRef = ngModule.injector.get(ApplicationRef);\r\n const elements = appRef.components.map((c) => c.location.nativeElement);\r\n const makeVisible = createNewHosts(elements);\r\n ngModule.destroy();\r\n makeVisible();\r\n });\r\n};\r\n","import { enableProdMode } from '@angular/core';\r\nimport { platformBrowserDynamic } from '@angular/platform-browser-dynamic';\r\nimport { environment } from './environments/environment';\r\nimport { hmrBootstrap } from './hmr';\r\nimport { RootModule } from './root.module';\r\n\r\nif (environment.production) {\r\n enableProdMode();\r\n}\r\n\r\nconst bootstrap = () => platformBrowserDynamic().bootstrapModule(RootModule);\r\n\r\n/* \"Hot Module Replacement\" is enabled as described on\r\n * https://medium.com/@beeman/tutorial-enable-hrm-in-angular-cli-apps-1b0d13b80130#.sa87zkloh\r\n */\r\n\r\nif (environment.hmr) {\r\n if (module['hot']) {\r\n hmrBootstrap(module, bootstrap); //HMR enabled bootstrap\r\n } else {\r\n console.error('HMR is not enabled for webpack-dev-server!');\r\n console.log('Are you using the --hmr flag for ng serve?');\r\n }\r\n} else {\r\n bootstrap(); //Regular bootstrap\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { NavigationEnd, Router, RouterModule, Routes } from '@angular/router';\r\nimport { AppUiCustomizationService } from '@tp_shared/common/ui/app-ui-customization.service';\r\n\r\nconst routes: Routes = [\r\n { path: '', redirectTo: '/app/main/dashboard', pathMatch: 'full' },\r\n {\r\n path: 'account',\r\n loadChildren: () => import('@tp_account/account.module').then((m) => m.AccountModule), //Lazy load account module\r\n data: { preload: true },\r\n },\r\n { path: '**', redirectTo: '/app/main/dashboard' },\r\n];\r\n\r\n@NgModule({\r\n imports: [RouterModule.forRoot(routes, { scrollPositionRestoration: 'top' })],\r\n exports: [RouterModule],\r\n providers: [],\r\n})\r\nexport class RootRoutingModule {\r\n constructor(private router: Router, private _uiCustomizationService: AppUiCustomizationService) {\r\n router.events.subscribe((event: NavigationEnd) => {\r\n setTimeout(() => {\r\n this.toggleBodyCssClass(event.url);\r\n }, 0);\r\n });\r\n }\r\n\r\n toggleBodyCssClass(url: string): void {\r\n if (url) {\r\n if (url === '/') {\r\n if (abp.session.userId > 0) {\r\n this.setAppModuleBodyClassInternal();\r\n } else {\r\n this.setAccountModuleBodyClassInternal();\r\n }\r\n }\r\n\r\n if (url.indexOf('/account/') >= 0) {\r\n this.setAccountModuleBodyClassInternal();\r\n } else {\r\n this.setAppModuleBodyClassInternal();\r\n }\r\n }\r\n }\r\n\r\n setAppModuleBodyClassInternal(): void {\r\n let currentBodyClass = document.body.className;\r\n let classesToRemember = '';\r\n\r\n if (currentBodyClass.indexOf('brand-minimize') >= 0) {\r\n classesToRemember += ' brand-minimize ';\r\n }\r\n\r\n if (currentBodyClass.indexOf('aside-left-minimize') >= 0) {\r\n classesToRemember += ' aside-left-minimize';\r\n }\r\n\r\n if (currentBodyClass.indexOf('brand-hide') >= 0) {\r\n classesToRemember += ' brand-hide';\r\n }\r\n\r\n if (currentBodyClass.indexOf('aside-left-hide') >= 0) {\r\n classesToRemember += ' aside-left-hide';\r\n }\r\n\r\n if (currentBodyClass.indexOf('swal2-toast-shown') >= 0) {\r\n classesToRemember += ' swal2-toast-shown';\r\n }\r\n\r\n document.body.className = this._uiCustomizationService.getAppModuleBodyClass() + ' ' + classesToRemember;\r\n }\r\n\r\n setAccountModuleBodyClassInternal(): void {\r\n let currentBodyClass = document.body.className;\r\n let classesToRemember = '';\r\n\r\n if (currentBodyClass.indexOf('swal2-toast-shown') >= 0) {\r\n classesToRemember += ' swal2-toast-shown';\r\n }\r\n\r\n document.body.className = this._uiCustomizationService.getAccountModuleBodyClass() + ' ' + classesToRemember;\r\n }\r\n\r\n getSetting(key: string): string {\r\n return abp.setting.get(key);\r\n }\r\n}\r\n","import { Component } from '@angular/core';\r\nimport { NgxSpinnerTextService } from '@tp_app/shared/ngx-spinner-text.service';\r\n\r\n@Component({\r\n selector: 'app-root',\r\n template: `\r\n \r\n \r\n
{{ getSpinnerText() }}
\r\n \r\n `,\r\n})\r\nexport class RootComponent {\r\n ngxSpinnerText: NgxSpinnerTextService;\r\n\r\n constructor(_ngxSpinnerText: NgxSpinnerTextService) {\r\n this.ngxSpinnerText = _ngxSpinnerText;\r\n }\r\n\r\n getSpinnerText(): string {\r\n return this.ngxSpinnerText.getText();\r\n }\r\n}\r\n","import { PlatformLocation, registerLocaleData } from '@angular/common';\r\nimport { HttpClientModule } from '@angular/common/http';\r\nimport { APP_INITIALIZER, DEFAULT_CURRENCY_CODE, Injector, LOCALE_ID, NgModule } from '@angular/core';\r\nimport { BrowserModule } from '@angular/platform-browser';\r\nimport { BrowserAnimationsModule } from '@angular/platform-browser/animations';\r\nimport { AppAuthService } from '@tp_app/shared/common/auth/app-auth.service';\r\nimport { AppConsts } from '@tp_shared/AppConsts';\r\nimport { PortalCommonModule } from '@tp_shared/common/common.module';\r\nimport { AppSessionService } from '@tp_shared/common/session/app-session.service';\r\nimport { AppUiCustomizationService } from '@tp_shared/common/ui/app-ui-customization.service';\r\nimport { UrlHelper } from '@tp_shared/helpers/UrlHelper';\r\nimport {\r\n API_BASE_URL,\r\n UiCustomizationSettingsDto,\r\n ThemeSettingsDto,\r\n ThemeMenuSettingsDto,\r\n ThemeLayoutSettingsDto,\r\n ThemeHeaderSettingsDto,\r\n ThemeSubHeaderSettingsDto,\r\n ThemeFooterSettingsDto,\r\n ApplicationInfoDto,\r\n} from '@tp_shared/service-proxies/service-proxies';\r\nimport { SHARED_API_BASE_URL } from '@tsl-lib/tusla-services/api-base.service';\r\nimport { ServiceProxyModule } from '@tp_shared/service-proxies/service-proxy.module';\r\nimport * as localForage from 'localforage';\r\nimport { AppPreBootstrap } from './AppPreBootstrap';\r\nimport { AppModule } from './app/app.module';\r\nimport { RootRoutingModule } from './root-routing.module';\r\nimport { RootComponent } from './root.component';\r\nimport { DomHelper } from '@tp_shared/helpers/DomHelper';\r\nimport { CookieConsentService } from '@tp_shared/common/session/cookie-consent.service';\r\nimport { NgxBootstrapDatePickerConfigService } from '@tp_assets/ngx-bootstrap/ngx-bootstrap-datepicker-config.service';\r\nimport { LocaleMappingService } from '@tp_shared/locale-mapping.service';\r\nimport { NgxSpinnerModule, NgxSpinnerService } from '@node_modules/ngx-spinner';\r\nimport { DateTimeService } from '@tp_app/shared/common/timing/date-time.service';\r\n\r\nexport function appInitializerFactory(injector: Injector, platformLocation: PlatformLocation) {\r\n return () => {\r\n let spinnerService = injector.get(NgxSpinnerService);\r\n\r\n spinnerService.show();\r\n\r\n return new Promise((resolve, reject) => {\r\n AppConsts.appBaseHref = getBaseHref(platformLocation);\r\n let appBaseUrl = getDocumentOrigin() + AppConsts.appBaseHref;\r\n\r\n initializeLocalForage();\r\n\r\n AppPreBootstrap.run(\r\n appBaseUrl,\r\n injector,\r\n () => {\r\n handleLogoutRequest(injector.get(AppAuthService));\r\n\r\n if (UrlHelper.isInstallUrl(location.href)) {\r\n doConfigurationForInstallPage(injector);\r\n spinnerService.hide();\r\n resolve(true);\r\n } else {\r\n let appSessionService: AppSessionService = injector.get(AppSessionService);\r\n appSessionService.init().then(\r\n (result) => {\r\n initializeAppCssClasses(injector, result);\r\n initializeTenantResources(injector);\r\n initializeCookieConsent(injector);\r\n registerLocales(resolve, reject, spinnerService);\r\n },\r\n (err) => {\r\n spinnerService.hide();\r\n reject(err);\r\n }\r\n );\r\n }\r\n },\r\n resolve,\r\n reject\r\n );\r\n });\r\n };\r\n}\r\n\r\nfunction initializeLocalForage() {\r\n localForage.config({\r\n driver: localForage.LOCALSTORAGE,\r\n name: 'Portal',\r\n version: 1.0,\r\n storeName: 'abpzerotemplate_local_storage',\r\n description: 'Cached data for Portal',\r\n });\r\n}\r\n\r\nfunction getDefaultThemeForInstallPage(): UiCustomizationSettingsDto {\r\n let theme = new UiCustomizationSettingsDto();\r\n theme.baseSettings = new ThemeSettingsDto();\r\n theme.baseSettings.theme = 'default';\r\n theme.baseSettings.menu = new ThemeMenuSettingsDto();\r\n theme.baseSettings.menu.asideSkin = 'light';\r\n\r\n theme.baseSettings.header = new ThemeHeaderSettingsDto();\r\n\r\n theme.baseSettings.subHeader = new ThemeSubHeaderSettingsDto();\r\n\r\n theme.baseSettings.layout = new ThemeLayoutSettingsDto();\r\n theme.baseSettings.layout.layoutType = 'fluid';\r\n theme.baseSettings.header = new ThemeHeaderSettingsDto();\r\n theme.baseSettings.footer = new ThemeFooterSettingsDto();\r\n return theme;\r\n}\r\n\r\nfunction setApplicationInfoForInstallPage(injector, theme: UiCustomizationSettingsDto) {\r\n let appSessionService: AppSessionService = injector.get(AppSessionService);\r\n let dateTimeService: DateTimeService = injector.get(DateTimeService);\r\n appSessionService.theme = theme;\r\n appSessionService.application = new ApplicationInfoDto();\r\n appSessionService.application.releaseDate = dateTimeService.getStartOfDay();\r\n}\r\n\r\nfunction doConfigurationForInstallPage(injector) {\r\n let theme = getDefaultThemeForInstallPage();\r\n setApplicationInfoForInstallPage(injector, theme);\r\n\r\n initializeAppCssClasses(injector, theme);\r\n}\r\n\r\nfunction initializeAppCssClasses(injector: Injector, theme: UiCustomizationSettingsDto) {\r\n let appUiCustomizationService = injector.get(AppUiCustomizationService);\r\n appUiCustomizationService.init(theme);\r\n\r\n // Css classes based on the layout\r\n if (abp.session.userId) {\r\n document.body.className = appUiCustomizationService.getAppModuleBodyClass();\r\n document.body.setAttribute('style', appUiCustomizationService.getAppModuleBodyStyle());\r\n } else {\r\n document.body.className = appUiCustomizationService.getAccountModuleBodyClass();\r\n document.body.setAttribute('style', appUiCustomizationService.getAccountModuleBodyStyle());\r\n }\r\n}\r\n\r\nfunction initializeTenantResources(injector: Injector) {\r\n let appSessionService: AppSessionService = injector.get(AppSessionService);\r\n\r\n if (appSessionService.tenant && appSessionService.tenant.customCssId) {\r\n document.head.appendChild(\r\n DomHelper.createElement('link', [\r\n {\r\n key: 'id',\r\n value: 'TenantCustomCss',\r\n },\r\n {\r\n key: 'rel',\r\n value: 'stylesheet',\r\n },\r\n {\r\n key: 'href',\r\n value:\r\n AppConsts.remoteServiceBaseUrl +\r\n '/TenantCustomization/GetCustomCss?tenantId=' +\r\n appSessionService.tenant.id,\r\n },\r\n ])\r\n );\r\n }\r\n\r\n let metaImage = DomHelper.getElementByAttributeValue('meta', 'property', 'og:image');\r\n if (metaImage) {\r\n //set og share image meta tag\r\n if (!appSessionService.tenant || !appSessionService.tenant.HasLogo()) {\r\n let ui: AppUiCustomizationService = injector.get(AppUiCustomizationService);\r\n metaImage.setAttribute(\r\n 'content',\r\n window.location.origin +\r\n '/assets/common/images/app-logo-on-' +\r\n abp.setting.get(\r\n appSessionService.theme.baseSettings.theme + '.' + 'App.UiManagement.Left.AsideSkin'\r\n ) +\r\n '.svg'\r\n );\r\n } else {\r\n metaImage.setAttribute(\r\n 'content',\r\n AppConsts.remoteServiceBaseUrl + '/TenantCustomization/GetLogo?tenantId=' + appSessionService.tenant.id\r\n );\r\n }\r\n }\r\n}\r\n\r\nfunction initializeCookieConsent(injector: Injector) {\r\n let cookieConsentService: CookieConsentService = injector.get(CookieConsentService);\r\n cookieConsentService.init();\r\n}\r\n\r\nfunction getDocumentOrigin() {\r\n if (!document.location.origin) {\r\n return (\r\n document.location.protocol +\r\n '//' +\r\n document.location.hostname +\r\n (document.location.port ? ':' + document.location.port : '')\r\n );\r\n }\r\n\r\n return document.location.origin;\r\n}\r\n\r\nfunction registerLocales(\r\n resolve: (value?: boolean | Promise) => void,\r\n reject: any,\r\n spinnerService: NgxSpinnerService\r\n) {\r\n if (shouldLoadLocale()) {\r\n let angularLocale = convertAbpLocaleToAngularLocale(abp.localization.currentLanguage.name);\r\n import(`node_modules/@angular/common/locales/${angularLocale}.mjs`).then((module) => {\r\n registerLocaleData(module.default);\r\n NgxBootstrapDatePickerConfigService.registerNgxBootstrapDatePickerLocales().then((_) => {\r\n resolve(true);\r\n spinnerService.hide();\r\n });\r\n }, reject);\r\n } else {\r\n NgxBootstrapDatePickerConfigService.registerNgxBootstrapDatePickerLocales().then((_) => {\r\n resolve(true);\r\n spinnerService.hide();\r\n });\r\n }\r\n}\r\n\r\nexport function shouldLoadLocale(): boolean {\r\n return abp.localization.currentLanguage.name && abp.localization.currentLanguage.name !== 'en-US';\r\n}\r\n\r\nexport function convertAbpLocaleToAngularLocale(locale: string): string {\r\n return new LocaleMappingService().map('angular', locale);\r\n}\r\n\r\nexport function getRemoteServiceBaseUrl(): string {\r\n return AppConsts.remoteServiceBaseUrl;\r\n}\r\n\r\nexport function getCurrentLanguage(): string {\r\n return convertAbpLocaleToAngularLocale(abp.localization.currentLanguage.name);\r\n}\r\n\r\nexport function getCurrencyCode(injector: Injector): string {\r\n let appSessionService: AppSessionService = injector.get(AppSessionService);\r\n return appSessionService.application.currency;\r\n}\r\n\r\nexport function getBaseHref(platformLocation: PlatformLocation): string {\r\n let baseUrl = platformLocation.getBaseHrefFromDOM();\r\n if (baseUrl) {\r\n return baseUrl;\r\n }\r\n\r\n return '/';\r\n}\r\n\r\nfunction handleLogoutRequest(authService: AppAuthService) {\r\n let currentUrl = UrlHelper.initialUrl;\r\n let returnUrl = UrlHelper.getReturnUrl();\r\n if (currentUrl.indexOf('account/logout') >= 0 && returnUrl) {\r\n authService.logout(true, returnUrl);\r\n }\r\n}\r\n\r\n@NgModule({\r\n imports: [\r\n BrowserModule,\r\n BrowserAnimationsModule,\r\n AppModule,\r\n PortalCommonModule.forRoot(),\r\n ServiceProxyModule,\r\n HttpClientModule,\r\n RootRoutingModule,\r\n NgxSpinnerModule,\r\n ],\r\n declarations: [RootComponent],\r\n providers: [\r\n { provide: API_BASE_URL, useFactory: getRemoteServiceBaseUrl },\r\n { provide: SHARED_API_BASE_URL, useFactory: getRemoteServiceBaseUrl }, \r\n {\r\n provide: APP_INITIALIZER,\r\n useFactory: appInitializerFactory,\r\n deps: [Injector, PlatformLocation],\r\n multi: true,\r\n },\r\n {\r\n provide: LOCALE_ID,\r\n useFactory: getCurrentLanguage,\r\n },\r\n {\r\n provide: DEFAULT_CURRENCY_CODE,\r\n useFactory: getCurrencyCode,\r\n deps: [Injector],\r\n },\r\n ],\r\n bootstrap: [RootComponent],\r\n})\r\nexport class RootModule {}\r\n","import { AppDefaultInvalidMessages } from \"@shared/AppEnums\";\r\n\r\nexport class AppConsts {\r\n static readonly tenancyNamePlaceHolderInUrl = '{TENANCY_NAME}';\r\n static readonly APP_DEFAULT_INVALID_FIELD_MSG = AppDefaultInvalidMessages.APP_DEFAULT_INVALID_FIELD_MSG;\r\n\r\n static remoteServiceBaseUrl: string;\r\n static remoteServiceBaseUrlFormat: string;\r\n static appBaseUrl: string;\r\n static appBaseHref: string; // returns angular's base-href parameter value if used during the publish\r\n static appBaseUrlFormat: string;\r\n static recaptchaSiteKey: string;\r\n static subscriptionExpireNootifyDayCount: number;\r\n static localeMappings: any = [];\r\n\r\n static readonly userManagement = {\r\n defaultAdminUserName: 'admin',\r\n };\r\n\r\n static readonly localization = {\r\n defaultLocalizationSourceName: 'Portal',\r\n };\r\n\r\n static readonly authorization = {\r\n encrptedAuthTokenName: 'enc_auth_token',\r\n };\r\n\r\n static readonly grid = {\r\n defaultPageSize: 10,\r\n };\r\n\r\n static readonly MinimumUpgradePaymentAmount = 1;\r\n\r\n /// \r\n /// Gets current version of the application.\r\n /// It's also shown in the web page.\r\n /// \r\n static readonly WebAppGuiVersion = '13.1.0';\r\n\r\n /// \r\n /// Redirects users to host URL when using subdomain as tenancy name for not existing tenants\r\n /// \r\n static readonly PreventNotExistingTenantSubdomains = false;\r\n\r\n \r\n}\r\n","import { animate, state, style, transition, trigger } from '@angular/animations';\r\n\r\nexport function appModuleAnimation() {\r\n return slideFromBottom();\r\n}\r\n\r\nexport function accountModuleAnimation() {\r\n return slideFromUp();\r\n}\r\n\r\nexport function slideFromBottom() {\r\n return trigger('routerTransition', [\r\n state('void', style({ 'padding-top': '20px', opacity: '0' })),\r\n state('*', style({ 'padding-top': '0px', opacity: '1' })),\r\n transition(':enter', [animate('0.33s ease-out', style({ opacity: '1', 'padding-top': '0px' }))]),\r\n ]);\r\n}\r\n\r\nexport function slideFromUp() {\r\n return trigger('routerTransition', [\r\n state('void', style({ 'margin-top': '-10px', opacity: '0' })),\r\n state('*', style({ 'margin-top': '0px', opacity: '1' })),\r\n transition(':enter', [animate('0.2s ease-out', style({ opacity: '1', 'margin-top': '0px' }))]),\r\n ]);\r\n}\r\n","import {\r\n PermissionCheckerService,\r\n FeatureCheckerService,\r\n LocalizationService,\r\n MessageService,\r\n AbpMultiTenancyService,\r\n NotifyService,\r\n SettingService,\r\n} from 'abp-ng2-module';\r\nimport { Component, Injector, OnDestroy } from '@angular/core';\r\nimport { AppConsts } from '@tp_shared/AppConsts';\r\nimport { AppUrlService } from '@tp_shared/common/nav/app-url.service';\r\nimport { AppSessionService } from '@tp_shared/common/session/app-session.service';\r\nimport { AppUiCustomizationService } from '@tp_shared/common/ui/app-ui-customization.service';\r\nimport { PrimengTableHelper } from '@tp_shared/helpers/PrimengTableHelper';\r\nimport { UiCustomizationSettingsDto } from '@tp_shared/service-proxies/service-proxies';\r\nimport '@tp_shared/service-proxies/tenant-login-info-dto-extensions';\r\nimport { NgxSpinnerService } from 'ngx-spinner';\r\nimport { NgxSpinnerTextService } from '@tp_app/shared/ngx-spinner-text.service';\r\n\r\ninterface AbpEventSubscription {\r\n eventName: string;\r\n callback: (...args: any[]) => void;\r\n}\r\n\r\n@Component({\r\n template: '',\r\n})\r\nexport abstract class AppComponentBase implements OnDestroy {\r\n localizationSourceName = AppConsts.localization.defaultLocalizationSourceName;\r\n injector: Injector\r\n\r\n localization: LocalizationService;\r\n permission: PermissionCheckerService;\r\n feature: FeatureCheckerService;\r\n notify: NotifyService;\r\n setting: SettingService;\r\n message: MessageService;\r\n multiTenancy: AbpMultiTenancyService;\r\n appSession: AppSessionService;\r\n primengTableHelper: PrimengTableHelper;\r\n ui: AppUiCustomizationService;\r\n appUrlService: AppUrlService;\r\n spinnerService: NgxSpinnerService;\r\n eventSubscriptions: AbpEventSubscription[] = [];\r\n\r\n private ngxSpinnerTextService: NgxSpinnerTextService;\r\n\r\n constructor(injector: Injector) {\r\n this.injector = injector;\r\n this.localization = injector.get(LocalizationService);\r\n this.permission = injector.get(PermissionCheckerService);\r\n this.feature = injector.get(FeatureCheckerService);\r\n this.notify = injector.get(NotifyService);\r\n this.setting = injector.get(SettingService);\r\n this.message = injector.get(MessageService);\r\n this.multiTenancy = injector.get(AbpMultiTenancyService);\r\n this.appSession = injector.get(AppSessionService);\r\n this.ui = injector.get(AppUiCustomizationService);\r\n this.appUrlService = injector.get(AppUrlService);\r\n this.primengTableHelper = new PrimengTableHelper();\r\n this.spinnerService = injector.get(NgxSpinnerService);\r\n this.ngxSpinnerTextService = injector.get(NgxSpinnerTextService);\r\n }\r\n\r\n get currentTheme(): UiCustomizationSettingsDto {\r\n return this.appSession.theme;\r\n }\r\n\r\n get appLogoSkin(): string{\r\n if (this.currentTheme.isTopMenuUsed || this.currentTheme.isTabMenuUsed)\r\n {\r\n return this.currentTheme.baseSettings.layout.darkMode ? \"light\" : \"dark\";\r\n }\r\n\r\n return this.currentTheme.baseSettings.menu.asideSkin;\r\n }\r\n\r\n get containerClass(): string {\r\n if (this.appSession.theme.baseSettings.layout.layoutType === 'fluid') {\r\n return 'app-container container-fluid';\r\n } else if (this.appSession.theme.baseSettings.layout.layoutType === 'fixed' || this.appSession.theme.baseSettings.layout.layoutType === 'fluid-xxl') {\r\n return 'app-container container-xxl';\r\n }\r\n\r\n return 'app-container container';\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this.unSubscribeAllEvents();\r\n }\r\n\r\n flattenDeep(array) {\r\n return array.reduce(\r\n (acc, val) => (Array.isArray(val) ? acc.concat(this.flattenDeep(val)) : acc.concat(val)),\r\n []\r\n );\r\n }\r\n\r\n l(key: string, ...args: any[]): string {\r\n args.unshift(key);\r\n args.unshift(this.localizationSourceName);\r\n return this.ls.apply(this, args);\r\n }\r\n\r\n ls(sourcename: string, key: string, ...args: any[]): string {\r\n let localizedText = this.localization.localize(key, sourcename);\r\n\r\n if (!localizedText) {\r\n localizedText = key;\r\n }\r\n\r\n if (!args || !args.length) {\r\n return localizedText;\r\n }\r\n\r\n args.unshift(localizedText);\r\n return abp.utils.formatString.apply(this, this.flattenDeep(args));\r\n }\r\n\r\n isGranted(permissionName: string): boolean {\r\n return this.permission.isGranted(permissionName);\r\n }\r\n\r\n isGrantedAny(...permissions: string[]): boolean {\r\n if (!permissions) {\r\n return false;\r\n }\r\n\r\n for (const permission of permissions) {\r\n if (this.isGranted(permission)) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n s(key: string): string {\r\n return abp.setting.get(key);\r\n }\r\n\r\n appRootUrl(): string {\r\n return this.appUrlService.appRootUrl;\r\n }\r\n\r\n showMainSpinner(text?: string): void {\r\n this.ngxSpinnerTextService.setText(text);\r\n this.spinnerService.show();\r\n }\r\n\r\n hideMainSpinner(text?: string): void {\r\n this.spinnerService.hide();\r\n }\r\n\r\n protected subscribeToEvent(eventName: string, callback: (...args: any[]) => void): void {\r\n abp.event.on(eventName, callback);\r\n this.eventSubscriptions.push({\r\n eventName,\r\n callback,\r\n });\r\n }\r\n\r\n private unSubscribeAllEvents() {\r\n this.eventSubscriptions.forEach((s) => abp.event.off(s.eventName, s.callback));\r\n this.eventSubscriptions = [];\r\n }\r\n}\r\n","import { Directive } from '@angular/core';\r\nimport { ModalDirective } from 'ngx-bootstrap/modal';\r\n\r\n@Directive({\r\n selector: '[appBsModal]',\r\n exportAs: 'bs-modal',\r\n})\r\nexport class AppBsModalDirective extends ModalDirective {\r\n showElement(): void {\r\n super.showElement();\r\n this.setZIndexes();\r\n }\r\n\r\n setZIndexes(): void {\r\n let newZIndex = this.setAndGetModalZIndex();\r\n this.setBackDropZIndex(newZIndex - 1);\r\n }\r\n\r\n setAndGetModalZIndex(): number {\r\n let modalBaseZIndex = 1050;\r\n let modalsLength = document.querySelectorAll('.modal.fade.show').length;\r\n\r\n let newZIndex = modalBaseZIndex + modalsLength * 2;\r\n\r\n (this as any)._element.nativeElement.style.zIndex = newZIndex.toString();\r\n return newZIndex;\r\n }\r\n\r\n setBackDropZIndex(zindex: number): void {\r\n let modalBackdrops = document.querySelectorAll('.modal-backdrop.fade.show');\r\n (modalBackdrops[modalBackdrops.length - 1] as HTMLElement).style.zIndex = zindex.toString();\r\n }\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { AppBsModalDirective } from './app-bs-modal.directive';\r\nimport { CommonModule } from '@angular/common';\r\n\r\n@NgModule({\r\n declarations: [AppBsModalDirective],\r\n imports: [CommonModule],\r\n exports: [AppBsModalDirective],\r\n})\r\nexport class AppBsModalModule {}\r\n","import { CommonModule } from '@angular/common';\r\nimport { ModuleWithProviders, NgModule } from '@angular/core';\r\nimport { AppUrlService } from './nav/app-url.service';\r\nimport { AppUiCustomizationService } from './ui/app-ui-customization.service';\r\nimport { AppSessionService } from './session/app-session.service';\r\nimport { CookieConsentService } from './session/cookie-consent.service';\r\nimport {\r\n PortalSampleFormsServiceProxy,\r\n PortalAddressServiceProxy\r\n } from '@tp_shared/service-proxies/service-proxies'\r\n\r\n\r\n@NgModule({\r\n imports: [CommonModule],\r\n})\r\nexport class PortalCommonModule {\r\n static forRoot(): ModuleWithProviders {\r\n return {\r\n ngModule: CommonModule,\r\n providers: [AppUiCustomizationService, CookieConsentService, AppSessionService, AppUrlService, PortalSampleFormsServiceProxy, PortalAddressServiceProxy],\r\n };\r\n }\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { AppConsts } from '@tp_shared/AppConsts';\r\nimport { AppSessionService } from '../session/app-session.service';\r\n\r\n@Injectable()\r\nexport class AppUrlService {\r\n static tenancyNamePlaceHolder = '{TENANCY_NAME}';\r\n\r\n constructor(private readonly _appSessionService: AppSessionService) {}\r\n\r\n get appRootUrl(): string {\r\n if (this._appSessionService.tenant) {\r\n return this.getAppRootUrlOfTenant(this._appSessionService.tenant.tenancyName);\r\n } else {\r\n return this.getAppRootUrlOfTenant(null);\r\n }\r\n }\r\n\r\n /**\r\n * Returning url ends with '/'.\r\n */\r\n getAppRootUrlOfTenant(tenancyName?: string): string {\r\n let baseUrl = this.ensureEndsWith(AppConsts.appBaseUrlFormat, '/');\r\n \r\n console.log('baseUrl: ' + baseUrl);\r\n //Add base href if it is not configured in appconfig.json\r\n if (baseUrl.indexOf(AppConsts.appBaseHref) < 0) {\r\n baseUrl = baseUrl + this.removeFromStart(AppConsts.appBaseHref, '/');\r\n }\r\n\r\n if (baseUrl.indexOf(AppUrlService.tenancyNamePlaceHolder) < 0) {\r\n return baseUrl;\r\n }\r\n\r\n if (baseUrl.indexOf(AppUrlService.tenancyNamePlaceHolder + '.') >= 0) {\r\n baseUrl = baseUrl.replace(AppUrlService.tenancyNamePlaceHolder + '.', AppUrlService.tenancyNamePlaceHolder);\r\n if (tenancyName) {\r\n tenancyName = tenancyName + '.';\r\n }\r\n }\r\n\r\n if (!tenancyName) {\r\n return baseUrl.replace(AppUrlService.tenancyNamePlaceHolder, '');\r\n }\r\n\r\n return baseUrl.replace(AppUrlService.tenancyNamePlaceHolder, tenancyName);\r\n }\r\n\r\n private ensureEndsWith(str: string, c: string) {\r\n if (str.charAt(str.length - 1) !== c) {\r\n str = str + c;\r\n }\r\n\r\n return str;\r\n }\r\n\r\n private removeFromEnd(str: string, c: string) {\r\n if (str.charAt(str.length - 1) === c) {\r\n str = str.substr(0, str.length - 1);\r\n }\r\n\r\n return str;\r\n }\r\n\r\n private removeFromStart(str: string, c: string) {\r\n if (str.charAt(0) === c) {\r\n str = str.substr(1, str.length - 1);\r\n }\r\n\r\n return str;\r\n }\r\n}\r\n","import { Injector, Pipe, PipeTransform } from '@angular/core';\r\nimport { FeatureCheckerService } from 'abp-ng2-module';\r\n\r\n@Pipe({\r\n name: 'checkFeature',\r\n})\r\nexport class FeatureCheckerPipe implements PipeTransform {\r\n featureCheckerService: FeatureCheckerService;\r\n\r\n constructor(injector: Injector) {\r\n this.featureCheckerService = injector.get(FeatureCheckerService);\r\n }\r\n\r\n transform(feature: string): boolean {\r\n return this.featureCheckerService.isEnabled(feature);\r\n }\r\n}\r\n","import { Injector, Pipe, PipeTransform } from '@angular/core';\r\nimport { AppConsts } from '@tp_shared/AppConsts';\r\nimport { LocalizationService } from 'abp-ng2-module';\r\n\r\n@Pipe({\r\n name: 'localize',\r\n})\r\nexport class LocalizePipe implements PipeTransform {\r\n localizationSourceName = AppConsts.localization.defaultLocalizationSourceName;\r\n\r\n localization: LocalizationService;\r\n\r\n constructor(injector: Injector) {\r\n this.localization = injector.get(LocalizationService);\r\n }\r\n\r\n l(key: string, ...args: any[]): string {\r\n args.unshift(key);\r\n args.unshift(this.localizationSourceName);\r\n return this.ls.apply(this, args);\r\n }\r\n\r\n ls(sourcename: string, key: string, ...args: any[]): string {\r\n let localizedText = this.localization.localize(key, sourcename);\r\n\r\n if (!localizedText) {\r\n localizedText = key;\r\n }\r\n\r\n if (!args || !args.length) {\r\n return localizedText;\r\n }\r\n\r\n args.unshift(localizedText);\r\n return abp.utils.formatString.apply(this, this.flattenDeep(args));\r\n }\r\n\r\n transform(key: string, ...args: any[]): string {\r\n return this.l(key, args);\r\n }\r\n\r\n flattenDeep(array) {\r\n return array.reduce(\r\n (acc, val) => (Array.isArray(val) ? acc.concat(this.flattenDeep(val)) : acc.concat(val)),\r\n []\r\n );\r\n }\r\n}\r\n","import { Injector, Pipe, PipeTransform } from '@angular/core';\r\nimport { PermissionCheckerService } from 'abp-ng2-module';\r\n\r\n@Pipe({\r\n name: 'permissionAll',\r\n})\r\nexport class PermissionAllPipe implements PipeTransform {\r\n permission: PermissionCheckerService;\r\n\r\n constructor(injector: Injector) {\r\n this.permission = injector.get(PermissionCheckerService);\r\n }\r\n\r\n transform(arrPermissions: string[]): boolean {\r\n if (!arrPermissions) {\r\n return false;\r\n }\r\n\r\n for (const permission of arrPermissions) {\r\n if (!this.permission.isGranted(permission)) {\r\n return false;\r\n }\r\n }\r\n\r\n return true; //all permissions are granted\r\n }\r\n}\r\n","import { Injector, Pipe, PipeTransform } from '@angular/core';\r\nimport { PermissionCheckerService } from 'abp-ng2-module';\r\n\r\n@Pipe({\r\n name: 'permissionAny',\r\n})\r\nexport class PermissionAnyPipe implements PipeTransform {\r\n permission: PermissionCheckerService;\r\n\r\n constructor(injector: Injector) {\r\n this.permission = injector.get(PermissionCheckerService);\r\n }\r\n\r\n transform(arrPermissions: string[]): boolean {\r\n if (!arrPermissions) {\r\n return false;\r\n }\r\n\r\n for (const permission of arrPermissions) {\r\n if (this.permission.isGranted(permission)) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n}\r\n","import { Injector, Pipe, PipeTransform } from '@angular/core';\r\nimport { PermissionCheckerService } from 'abp-ng2-module';\r\n\r\n@Pipe({\r\n name: 'permission',\r\n})\r\nexport class PermissionPipe implements PipeTransform {\r\n permission: PermissionCheckerService;\r\n\r\n constructor(injector: Injector) {\r\n this.permission = injector.get(PermissionCheckerService);\r\n }\r\n\r\n transform(permission: string): boolean {\r\n return this.permission.isGranted(permission);\r\n }\r\n}\r\n","import { AbpMultiTenancyService } from 'abp-ng2-module';\r\nimport { Injectable } from '@angular/core';\r\nimport {\r\n ApplicationInfoDto,\r\n GetCurrentLoginInformationsOutput,\r\n SessionServiceProxy,\r\n TenantLoginInfoDto,\r\n UserLoginInfoDto,\r\n UiCustomizationSettingsDto,\r\n} from '@tp_shared/service-proxies/service-proxies';\r\n\r\n@Injectable()\r\nexport class AppSessionService {\r\n private _user: UserLoginInfoDto;\r\n private _impersonatorUser: UserLoginInfoDto;\r\n private _tenant: TenantLoginInfoDto;\r\n private _impersonatorTenant: TenantLoginInfoDto;\r\n private _application: ApplicationInfoDto;\r\n private _theme: UiCustomizationSettingsDto;\r\n\r\n constructor(\r\n private _sessionService: SessionServiceProxy,\r\n private _abpMultiTenancyService: AbpMultiTenancyService\r\n ) {}\r\n\r\n get application(): ApplicationInfoDto {\r\n return this._application;\r\n }\r\n\r\n get user(): UserLoginInfoDto {\r\n return this._user;\r\n }\r\n\r\n get userId(): number {\r\n return this.user ? this.user.id : null;\r\n }\r\n\r\n get tenant(): TenantLoginInfoDto {\r\n return this._tenant;\r\n }\r\n\r\n get tenancyName(): string {\r\n return this._tenant ? this.tenant.tenancyName : '';\r\n }\r\n\r\n get tenantId(): number {\r\n return this.tenant ? this.tenant.id : null;\r\n }\r\n\r\n get impersonatorUser(): UserLoginInfoDto {\r\n return this._impersonatorUser;\r\n }\r\n get impersonatorUserId(): number {\r\n return this.impersonatorUser ? this.impersonatorUser.id : null;\r\n }\r\n get impersonatorTenant(): TenantLoginInfoDto {\r\n return this._impersonatorTenant;\r\n }\r\n get impersonatorTenancyName(): string {\r\n return this.impersonatorTenant ? this.impersonatorTenant.tenancyName : '';\r\n }\r\n get impersonatorTenantId(): number {\r\n return this.impersonatorTenant ? this.impersonatorTenant.id : null;\r\n }\r\n\r\n get theme(): UiCustomizationSettingsDto {\r\n return this._theme;\r\n }\r\n\r\n set theme(val: UiCustomizationSettingsDto) {\r\n this._theme = val;\r\n }\r\n\r\n set application(val: ApplicationInfoDto) {\r\n this._application = val;\r\n }\r\n\r\n init(): Promise {\r\n return new Promise((resolve, reject) => {\r\n this._sessionService\r\n .getCurrentLoginInformations()\r\n .toPromise()\r\n .then(\r\n (result: GetCurrentLoginInformationsOutput) => {\r\n this._application = result.application;\r\n this._user = result.user;\r\n this._tenant = result.tenant;\r\n this._theme = result.theme;\r\n this._impersonatorTenant = result.impersonatorTenant;\r\n this._impersonatorUser = result.impersonatorUser;\r\n resolve(result.theme);\r\n },\r\n (err) => {\r\n reject(err);\r\n }\r\n );\r\n });\r\n }\r\n\r\n getShownLoginName(): string {\r\n const userName = this._user.userName;\r\n if (!this._abpMultiTenancyService.isEnabled) {\r\n return userName;\r\n }\r\n\r\n return (this._tenant ? this._tenant.tenancyName : '.') + '\\\\' + userName;\r\n }\r\n\r\n changeTenantIfNeeded(tenantId?: number): boolean {\r\n if (this.isCurrentTenant(tenantId)) {\r\n return false;\r\n }\r\n\r\n abp.multiTenancy.setTenantIdCookie(tenantId);\r\n location.reload();\r\n return true;\r\n }\r\n\r\n private isCurrentTenant(tenantId?: number) {\r\n let isTenant = tenantId > 0;\r\n\r\n if (!isTenant && !this.tenant) {\r\n // this is host\r\n return true;\r\n }\r\n\r\n if (!tenantId && this.tenant) {\r\n return false;\r\n } else if (tenantId && (!this.tenant || this.tenant.id !== tenantId)) {\r\n return false;\r\n }\r\n\r\n return true;\r\n }\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { AppLocalizationService } from '@tp_app/shared/common/localization/app-localization.service';\r\n\r\n@Injectable()\r\nexport class CookieConsentService {\r\n constructor(private _appLocalizationService: AppLocalizationService) {}\r\n\r\n public init() {\r\n if (abp.setting.getBoolean('App.UserManagement.IsCookieConsentEnabled')) {\r\n (window as any).cookieconsent.initialise({\r\n showLink: false,\r\n content: {\r\n message: this._appLocalizationService.l('CookieConsent_Message'),\r\n dismiss: this._appLocalizationService.l('CookieConsent_Dismiss'),\r\n },\r\n });\r\n }\r\n }\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { UiCustomizationSettingsDto } from '@tp_shared/service-proxies/service-proxies';\r\nimport * as rtlDetect from 'rtl-detect';\r\nimport { ThemeAssetContributorFactory } from '@tp_shared/helpers/ThemeAssetContributorFactory';\r\n\r\n@Injectable()\r\nexport class AppUiCustomizationService {\r\n private _theme: UiCustomizationSettingsDto;\r\n\r\n init(theme: UiCustomizationSettingsDto): void {\r\n this._theme = theme;\r\n }\r\n\r\n getAppModuleBodyClass(): string {\r\n let assetContributor = ThemeAssetContributorFactory.getCurrent();\r\n return assetContributor.getAppModuleBodyClass();\r\n }\r\n\r\n getAppModuleBodyStyle(): string {\r\n return '--kt-toolbar-height:55px; --kt-toolbar-height-tablet-and-mobile:55px;';\r\n }\r\n\r\n getAccountModuleBodyClass() {\r\n return 'account header-fixed header-mobile-fixed subheader-fixed subheader-enabled subheader-solid aside-enabled aside-fixed page-loading';\r\n }\r\n\r\n getAccountModuleBodyStyle(): string {\r\n return '';\r\n }\r\n\r\n getSelectEditionBodyClass() {\r\n return 'skin-';\r\n }\r\n\r\n getLeftAsideClass(): string {\r\n let cssClass = 'aside aside-' + this._theme.baseSettings.menu.asideSkin;\r\n\r\n if (this._theme.baseSettings.menu.hoverableAside){\r\n cssClass += ' aside-hoverable';\r\n }\r\n\r\n if (this._theme.baseSettings.menu.submenuToggle === 'true') {\r\n cssClass += ' aside-menu-dropdown';\r\n }\r\n\r\n if (this._theme.baseSettings.menu.fixedAside && this._theme.baseSettings.menu.submenuToggle !== 'true') {\r\n cssClass += ' ps';\r\n }\r\n\r\n return cssClass;\r\n }\r\n\r\n getLeftAsideSubMenuStyles(): string {\r\n if (this._theme.baseSettings.menu.submenuToggle !== 'true') {\r\n return '';\r\n }\r\n return 'position: fixed; top:inherit';\r\n }\r\n\r\n isSubmenuToggleDropdown(): boolean {\r\n return this._theme.baseSettings.menu.submenuToggle === 'true';\r\n }\r\n\r\n getTopBarMenuContainerClass(): string {\r\n let menuCssClass =\r\n 'header-bottom header-menu-skin-' +\r\n this._theme.baseSettings.menu.asideSkin +\r\n ' container container--full-height container-responsive';\r\n if (this._theme.baseSettings.layout.layoutType === 'boxed') {\r\n return menuCssClass + ' container-xxl';\r\n }\r\n\r\n return menuCssClass;\r\n }\r\n\r\n getIsMenuScrollable(): boolean {\r\n return this._theme.allowMenuScroll && this._theme.baseSettings.menu.fixedAside;\r\n }\r\n\r\n getSideBarMenuItemClass(item, isMenuActive) {\r\n let menuCssClass = 'menu-item';\r\n\r\n if (item.items.length) {\r\n menuCssClass += ' menu-item-submenu';\r\n }\r\n\r\n if (isMenuActive) {\r\n menuCssClass += ' menu-item-open menu-item-active';\r\n }\r\n\r\n return menuCssClass;\r\n }\r\n}\r\n","export class DomHelper {\r\n static waitUntilElementIsReady(selector: string, callback: any, checkPeriod?: number): void {\r\n let selectors = selector.split(',');\r\n let elementCount = selectors.length;\r\n\r\n if (!checkPeriod) {\r\n checkPeriod = 100;\r\n }\r\n\r\n let checkExist = setInterval(() => {\r\n let foundElementCount = 0;\r\n for (let i = 0; i < selectors.length; i++) {\r\n let selector = selectors[i].trim();\r\n if (selector[0] === '#') {\r\n let idSelector = selector.replace('#', '');\r\n foundElementCount = foundElementCount + (document.getElementById(idSelector) ? 1 : 0);\r\n } else if (selector[0] === '.') {\r\n let classSelector = selector.replace('.', '');\r\n foundElementCount = foundElementCount + (document.getElementsByClassName(classSelector) ? 1 : 0);\r\n }\r\n }\r\n\r\n if (foundElementCount >= elementCount) {\r\n clearInterval(checkExist);\r\n callback();\r\n }\r\n }, checkPeriod);\r\n }\r\n\r\n static createElement(tag: string, attributes: any[]): any {\r\n let el = document.createElement(tag);\r\n for (let i = 0; i < attributes.length; i++) {\r\n let attribute = attributes[i];\r\n el.setAttribute(attribute.key, attribute.value);\r\n }\r\n\r\n return el;\r\n }\r\n\r\n static getElementByAttributeValue(tag: string, attribute: string, value: string) {\r\n let els = document.getElementsByTagName(tag);\r\n if (!els) {\r\n return undefined;\r\n }\r\n\r\n for (let i = 0; i < els.length; i++) {\r\n let el = els[i];\r\n if (el.getAttribute(attribute) === value) {\r\n return el;\r\n }\r\n }\r\n\r\n return undefined;\r\n }\r\n}\r\n","import { AppConsts } from '@tp_shared/AppConsts';\r\nimport * as rtlDetect from 'rtl-detect';\r\nimport { StyleLoaderService } from '@tp_shared/utils/style-loader.service';\r\nimport { ThemeHelper } from '@tp_app/shared/layout/themes/ThemeHelper';\r\nimport { ThemeAssetContributorFactory } from './ThemeAssetContributorFactory';\r\n\r\nexport class DynamicResourcesHelper {\r\n static loadResources(callback: () => void): void {\r\n Promise.all([DynamicResourcesHelper.loadStyles()]).then(() => {\r\n callback();\r\n });\r\n }\r\n\r\n static loadStyles(): Promise {\r\n let theme = ThemeHelper.getTheme();\r\n\r\n const isRtl = rtlDetect.isRtlLang(abp.localization.currentLanguage.name);\r\n\r\n if (isRtl) {\r\n document.documentElement.setAttribute('dir', 'rtl');\r\n }\r\n\r\n const skin = ThemeHelper.darkMode() ? 'dark' : 'light';\r\n document.documentElement.setAttribute('data-bs-theme', skin);\r\n\r\n const cssPostfix = isRtl ? '.rtl' : '';\r\n const styleLoaderService = new StyleLoaderService();\r\n\r\n let styleUrls = [\r\n AppConsts.appBaseUrl +\r\n '/assets/metronic/themes/' +\r\n theme +\r\n '/css/style.bundle' +\r\n cssPostfix.replace('-', '.') +\r\n '.css',\r\n AppConsts.appBaseUrl +\r\n '/assets/metronic/themes/' +\r\n theme +\r\n '/plugins/global/plugins.bundle' +\r\n cssPostfix.replace('-', '.') +\r\n '.css',\r\n AppConsts.appBaseUrl +\r\n '/assets/primeng/themes/mdc-' +\r\n (ThemeHelper.darkMode() ? 'dark' : 'light') +\r\n '-indigo/theme.css', // PrimeNG Dark mode styles\r\n AppConsts.appBaseUrl + '/assets/primeng/datatable/css/primeng.datatable' + cssPostfix + '.min.css', // PrimeNG RTL styles\r\n AppConsts.appBaseUrl + '/assets/common/styles/metronic-customize.min.css',\r\n AppConsts.appBaseUrl + '/assets/common/styles/themes/' + theme + '/metronic-customize.min.css',\r\n AppConsts.appBaseUrl + '/assets/common/styles/metronic-customize-angular.min.css',\r\n ].concat(DynamicResourcesHelper.getAdditionalThemeAssets());\r\n\r\n DynamicResourcesHelper.setBodyAttributes();\r\n\r\n if (isRtl) {\r\n styleUrls.push(AppConsts.appBaseUrl + '/assets/common/styles/abp-zero-template-rtl.min.css');\r\n }\r\n\r\n styleLoaderService.loadArray(styleUrls).then(function(){\r\n abp.event.trigger('app.dynamic-styles-loaded');\r\n });\r\n\r\n return Promise.resolve(true);\r\n }\r\n\r\n static getAdditionalThemeAssets(): string[] {\r\n let assetContributor = ThemeAssetContributorFactory.getCurrent();\r\n if (!assetContributor) {\r\n return [];\r\n }\r\n\r\n return assetContributor.getAssetUrls();\r\n }\r\n\r\n static setBodyAttributes(): void {\r\n let assetContributor = ThemeAssetContributorFactory.getCurrent();\r\n if (!assetContributor) {\r\n return;\r\n }\r\n\r\n let attributes = assetContributor.getBodyAttributes();\r\n for (let i = 0; i < attributes.length; i++) {\r\n let attr = attributes[i];\r\n document.body.setAttribute(attr.name, attr.value);\r\n }\r\n }\r\n}\r\n","class ExtractionResult {\r\n public IsMatch: boolean;\r\n public Matches: any[];\r\n\r\n constructor(isMatch: boolean) {\r\n this.IsMatch = isMatch;\r\n this.Matches = [];\r\n }\r\n}\r\n\r\nenum FormatStringTokenType {\r\n ConstantText,\r\n DynamicValue,\r\n}\r\n\r\nclass FormatStringToken {\r\n public Text: string;\r\n\r\n public Type: FormatStringTokenType;\r\n\r\n constructor(text: string, type: FormatStringTokenType) {\r\n this.Text = text;\r\n this.Type = type;\r\n }\r\n}\r\n\r\nclass FormatStringTokenizer {\r\n Tokenize(format: string, includeBracketsForDynamicValues: boolean = false): FormatStringToken[] {\r\n const tokens: FormatStringToken[] = [];\r\n\r\n let currentText = '';\r\n let inDynamicValue = false;\r\n\r\n for (let i = 0; i < format.length; i++) {\r\n const c = format[i];\r\n switch (c) {\r\n case '{':\r\n if (inDynamicValue) {\r\n throw new Error(\r\n 'Incorrect syntax at char ' +\r\n i +\r\n '! format string can not contain nested dynamic value expression!'\r\n );\r\n }\r\n\r\n inDynamicValue = true;\r\n\r\n if (currentText.length > 0) {\r\n tokens.push(new FormatStringToken(currentText, FormatStringTokenType.ConstantText));\r\n currentText = '';\r\n }\r\n\r\n break;\r\n case '}':\r\n if (!inDynamicValue) {\r\n throw new Error(\r\n 'Incorrect syntax at char ' +\r\n i +\r\n '! These is no opening brackets for the closing bracket }.'\r\n );\r\n }\r\n\r\n inDynamicValue = false;\r\n\r\n if (currentText.length <= 0) {\r\n throw new Error('Incorrect syntax at char ' + i + '! Brackets does not containt any chars.');\r\n }\r\n\r\n let dynamicValue = currentText;\r\n if (includeBracketsForDynamicValues) {\r\n dynamicValue = '{' + dynamicValue + '}';\r\n }\r\n\r\n tokens.push(new FormatStringToken(dynamicValue, FormatStringTokenType.DynamicValue));\r\n currentText = '';\r\n\r\n break;\r\n default:\r\n currentText += c;\r\n break;\r\n }\r\n }\r\n\r\n if (inDynamicValue) {\r\n throw new Error('There is no closing } char for an opened { char.');\r\n }\r\n\r\n if (currentText.length > 0) {\r\n tokens.push(new FormatStringToken(currentText, FormatStringTokenType.ConstantText));\r\n }\r\n\r\n return tokens;\r\n }\r\n}\r\n\r\nexport class FormattedStringValueExtracter {\r\n Extract(str: string, format: string): ExtractionResult {\r\n if (str === format) {\r\n return new ExtractionResult(true);\r\n }\r\n\r\n const formatTokens = new FormatStringTokenizer().Tokenize(format);\r\n if (!formatTokens) {\r\n return new ExtractionResult(str === '');\r\n }\r\n\r\n const result = new ExtractionResult(true);\r\n\r\n for (let i = 0; i < formatTokens.length; i++) {\r\n const currentToken = formatTokens[i];\r\n const previousToken = i > 0 ? formatTokens[i - 1] : null;\r\n\r\n if (currentToken.Type === FormatStringTokenType.ConstantText) {\r\n if (i === 0) {\r\n if (str.indexOf(currentToken.Text) !== 0) {\r\n result.IsMatch = false;\r\n return result;\r\n }\r\n\r\n str = str.substr(currentToken.Text.length, str.length - currentToken.Text.length);\r\n } else {\r\n const matchIndex = str.indexOf(currentToken.Text);\r\n if (matchIndex < 0) {\r\n result.IsMatch = false;\r\n return result;\r\n }\r\n\r\n result.Matches.push({ name: previousToken.Text, value: str.substr(0, matchIndex) });\r\n str = str.substring(0, matchIndex + currentToken.Text.length);\r\n }\r\n }\r\n }\r\n\r\n const lastToken = formatTokens[formatTokens.length - 1];\r\n if (lastToken.Type === FormatStringTokenType.DynamicValue) {\r\n result.Matches.push({ name: lastToken.Text, value: str });\r\n }\r\n\r\n return result;\r\n }\r\n\r\n IsMatch(str: string, format: string): string[] {\r\n const result = new FormattedStringValueExtracter().Extract(str, format);\r\n if (!result.IsMatch) {\r\n return [];\r\n }\r\n\r\n const values = [];\r\n for (let i = 0; i < result.Matches.length; i++) {\r\n values.push(result.Matches[i].value);\r\n }\r\n\r\n return values;\r\n }\r\n}\r\n","import { LazyLoadEvent } from 'primeng/api';\r\nimport { Paginator } from 'primeng/paginator';\r\nimport { Table } from 'primeng/table';\r\nimport * as rtlDetect from 'rtl-detect';\r\n\r\nexport class PrimengTableHelper {\r\n predefinedRecordsCountPerPage = [5, 10, 25, 50, 100, 250, 500];\r\n\r\n defaultRecordsCountPerPage = 10;\r\n\r\n resizableColumns: false;\r\n\r\n totalRecordsCount = 0;\r\n\r\n records: any[];\r\n\r\n isLoading = false;\r\n\r\n showLoadingIndicator(): void {\r\n setTimeout(() => {\r\n this.isLoading = true;\r\n }, 0);\r\n }\r\n\r\n hideLoadingIndicator(): void {\r\n setTimeout(() => {\r\n this.isLoading = false;\r\n }, 0);\r\n }\r\n\r\n getSorting(table: Table): string {\r\n let sorting = '';\r\n\r\n if (table.sortMode === 'multiple') {\r\n if (table.multiSortMeta) {\r\n for (let i = 0; i < table.multiSortMeta.length; i++) {\r\n const element = table.multiSortMeta[i];\r\n if (i > 0) {\r\n sorting += ',';\r\n }\r\n sorting += element.field;\r\n if (element.order === 1) {\r\n sorting += ' ASC';\r\n } else if (element.order === -1) {\r\n sorting += ' DESC';\r\n }\r\n }\r\n }\r\n } else {\r\n if (table.sortField) {\r\n sorting = table.sortField;\r\n if (table.sortOrder === 1) {\r\n sorting += ' ASC';\r\n } else if (table.sortOrder === -1) {\r\n sorting += ' DESC';\r\n }\r\n }\r\n }\r\n\r\n return sorting;\r\n }\r\n\r\n getMaxResultCount(paginator: Paginator, event: LazyLoadEvent): number {\r\n if (paginator.rows) {\r\n return paginator.rows;\r\n }\r\n\r\n if (!event) {\r\n return 0;\r\n }\r\n\r\n return event.rows;\r\n }\r\n\r\n getSkipCount(paginator: Paginator, event: LazyLoadEvent): number {\r\n if (paginator.first) {\r\n return paginator.first;\r\n }\r\n\r\n if (!event) {\r\n return 0;\r\n }\r\n\r\n return event.first;\r\n }\r\n\r\n shouldResetPaging(event: LazyLoadEvent): boolean {\r\n if (!event /*|| event.sortField*/) {\r\n // if you want to reset after sorting, comment out parameter\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n adjustScroll(table: Table) {\r\n const rtl = rtlDetect.isRtlLang(abp.localization.currentLanguage.name);\r\n if (!rtl) {\r\n return;\r\n }\r\n\r\n const body: HTMLElement = table.el.nativeElement.querySelector('.p-datatable-scrollable-body');\r\n const header: HTMLElement = table.el.nativeElement.querySelector('.p-datatable-scrollable-header');\r\n body.addEventListener('scroll', () => {\r\n header.scrollLeft = body.scrollLeft;\r\n });\r\n }\r\n}\r\n","import { AppConsts } from '@tp_shared/AppConsts';\r\nimport { LocalStorageService } from '@tp_shared/utils/local-storage.service';\r\n\r\nexport class SignalRHelper {\r\n static initSignalR(callback: () => void): void {\r\n new LocalStorageService().getItem(AppConsts.authorization.encrptedAuthTokenName, function (err, value) {\r\n let encryptedAuthToken = value?.token;\r\n\r\n abp.signalr = {\r\n autoConnect: false, // _zone.runOutsideAngular in ChatSignalrService\r\n // autoReconnect: true,\r\n connect: undefined,\r\n hubs: undefined,\r\n qs: encryptedAuthToken\r\n ? AppConsts.authorization.encrptedAuthTokenName + '=' + encodeURIComponent(encryptedAuthToken)\r\n : '',\r\n remoteServiceBaseUrl: AppConsts.remoteServiceBaseUrl,\r\n startConnection: undefined,\r\n url: '/signalr',\r\n withUrlOptions: {}\r\n };\r\n\r\n let script = document.createElement('script');\r\n script.onload = () => {\r\n callback();\r\n };\r\n\r\n script.src = AppConsts.appBaseUrl + '/assets/abp/abp.signalr-client.js';\r\n document.head.appendChild(script);\r\n });\r\n }\r\n\r\n static updateQueryString(encryptedAuthToken: string): void {\r\n if (!abp?.signalr) {\r\n return;\r\n }\r\n\r\n abp.signalr.qs = encryptedAuthToken\r\n ? AppConsts.authorization.encrptedAuthTokenName + '=' + encodeURIComponent(encryptedAuthToken)\r\n : '';\r\n }\r\n}\r\n","import { AppConsts } from '@tp_shared/AppConsts';\r\nimport { FormattedStringValueExtracter } from '@tp_shared/helpers/FormattedStringValueExtracter';\r\n\r\nexport class SubdomainTenancyNameFinder {\r\n urlHasTenancyNamePlaceholder(url: string): boolean {\r\n return url.indexOf(AppConsts.tenancyNamePlaceHolderInUrl) >= 0;\r\n }\r\n\r\n getCurrentTenancyNameOrNull(rootAddress: string): string {\r\n if (rootAddress.indexOf(AppConsts.tenancyNamePlaceHolderInUrl) < 0) {\r\n // Web site does not support subdomain tenant name\r\n return null;\r\n }\r\n\r\n const currentRootAddress = document.location.href;\r\n\r\n const formattedStringValueExtracter = new FormattedStringValueExtracter();\r\n const values: any[] = formattedStringValueExtracter.IsMatch(currentRootAddress, rootAddress);\r\n if (!values.length) {\r\n return null;\r\n }\r\n\r\n return values[0];\r\n }\r\n}\r\n","import { IThemeAssetContributor } from '@tp_app/shared/layout/themes/ThemeAssetContributor';\r\nimport { ThemeHelper } from '@tp_app/shared/layout/themes/ThemeHelper';\r\nimport { DefaultThemeAssetContributor } from '@tp_app/shared/layout/themes/default/DefaultThemeAssetContributor';\r\nimport { Theme2ThemeAssetContributor } from '@tp_app/shared/layout/themes/theme2/Theme2ThemeAssetContributor';\r\nimport { Theme3ThemeAssetContributor } from '@tp_app/shared/layout/themes/theme3/Theme3ThemeAssetContributor';\r\nimport { Theme4ThemeAssetContributor } from '@tp_app/shared/layout/themes/theme4/Theme4ThemeAssetContributor';\r\nimport { Theme5ThemeAssetContributor } from '@tp_app/shared/layout/themes/theme5/Theme5ThemeAssetContributor';\r\nimport { Theme6ThemeAssetContributor } from '@tp_app/shared/layout/themes/theme6/Theme6ThemeAssetContributor';\r\nimport { Theme7ThemeAssetContributor } from '@tp_app/shared/layout/themes/theme7/Theme7ThemeAssetContributor';\r\nimport { Theme8ThemeAssetContributor } from '@tp_app/shared/layout/themes/theme8/Theme8ThemeAssetContributor';\r\nimport { Theme9ThemeAssetContributor } from '@tp_app/shared/layout/themes/theme9/Theme9ThemeAssetContributor';\r\nimport { Theme10ThemeAssetContributor } from '@tp_app/shared/layout/themes/theme10/Theme10ThemeAssetContributor';\r\nimport { Theme11ThemeAssetContributor } from '@tp_app/shared/layout/themes/theme11/Theme11ThemeAssetContributor';\r\nimport { Theme12ThemeAssetContributor } from '@tp_app/shared/layout/themes/theme12/Theme12ThemeAssetContributor';\r\nimport { Theme13ThemeAssetContributor } from '@tp_app/shared/layout/themes/theme13/Theme13ThemeAssetContributor';\r\nexport class ThemeAssetContributorFactory {\r\n static getCurrent(): IThemeAssetContributor {\r\n let theme = ThemeHelper.getTheme();\r\n\r\n if (theme === 'default') {\r\n return new DefaultThemeAssetContributor();\r\n }\r\n\r\n if (theme === 'theme2') {\r\n return new Theme2ThemeAssetContributor();\r\n }\r\n\r\n if (theme === 'theme3') {\r\n return new Theme3ThemeAssetContributor();\r\n }\r\n\r\n if (theme === 'theme4') {\r\n return new Theme4ThemeAssetContributor();\r\n }\r\n\r\n if (theme === 'theme5') {\r\n return new Theme5ThemeAssetContributor();\r\n }\r\n\r\n if (theme === 'theme6') {\r\n return new Theme6ThemeAssetContributor();\r\n }\r\n\r\n if (theme === 'theme7') {\r\n return new Theme7ThemeAssetContributor();\r\n }\r\n\r\n if (theme === 'theme8') {\r\n return new Theme8ThemeAssetContributor();\r\n }\r\n\r\n if (theme === 'theme9') {\r\n return new Theme9ThemeAssetContributor();\r\n }\r\n\r\n if (theme === 'theme10') {\r\n return new Theme10ThemeAssetContributor();\r\n }\r\n\r\n if (theme === 'theme11') {\r\n return new Theme11ThemeAssetContributor();\r\n }\r\n\r\n if (theme === 'theme12') {\r\n return new Theme12ThemeAssetContributor();\r\n }\r\n\r\n if (theme === 'theme13') {\r\n return new Theme13ThemeAssetContributor();\r\n }\r\n\r\n return null;\r\n }\r\n}\r\n","export class UrlHelper {\r\n /**\r\n * The URL requested, before initial routing.\r\n */\r\n static readonly initialUrl = location.href;\r\n\r\n static getQueryParameters(): any {\r\n return UrlHelper.getQueryParametersUsingParameters(document.location.search);\r\n }\r\n\r\n static getQueryParametersUsingParameters(search: string): any {\r\n return search\r\n .replace(/(^\\?)/, '')\r\n .split('&')\r\n .map(\r\n function (n) {\r\n return (n = n.split('=')), (this[n[0]] = n[1]), this;\r\n }.bind({})\r\n )[0];\r\n }\r\n\r\n static getQueryParametersUsingHash(): any {\r\n return document.location.hash\r\n .substr(1, document.location.hash.length - 1)\r\n .replace(/(^\\?)/, '')\r\n .split('&')\r\n .map(\r\n function (n) {\r\n return (n = n.split('=')), (this[n[0]] = n[1]), this;\r\n }.bind({})\r\n )[0];\r\n }\r\n\r\n static getInitialUrlParameters(): any {\r\n let questionMarkIndex = UrlHelper.initialUrl.indexOf('?');\r\n if (questionMarkIndex >= 0) {\r\n return UrlHelper.initialUrl.substr(questionMarkIndex, UrlHelper.initialUrl.length - questionMarkIndex);\r\n }\r\n\r\n return '';\r\n }\r\n\r\n static getReturnUrl(): string {\r\n const queryStringObj = UrlHelper.getQueryParametersUsingParameters(UrlHelper.getInitialUrlParameters());\r\n if (queryStringObj.returnUrl) {\r\n return decodeURIComponent(queryStringObj.returnUrl);\r\n }\r\n\r\n return null;\r\n }\r\n\r\n static getSingleSignIn(): boolean {\r\n const queryStringObj = UrlHelper.getQueryParametersUsingParameters(UrlHelper.getInitialUrlParameters());\r\n if (queryStringObj.ss) {\r\n return queryStringObj.ss;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n static isInstallUrl(url): boolean {\r\n return url && url.indexOf('app/admin/install') >= 0;\r\n }\r\n}\r\n","export class XmlHttpRequestHelper {\r\n static ajax(type: string, url: string, customHeaders: any, data: any, success: any, error?: any) {\r\n let xhr = new XMLHttpRequest();\r\n\r\n xhr.onreadystatechange = () => {\r\n if (xhr.readyState === XMLHttpRequest.DONE) {\r\n if (xhr.status === 200) {\r\n let result = JSON.parse(xhr.responseText);\r\n success(result);\r\n } else if (xhr.status !== 0) {\r\n if(error){\r\n let result = JSON.parse(xhr.responseText);\r\n error(result);\r\n }else{\r\n alert(abp.localization.localize('InternalServerError', 'AbpWeb'));\r\n }\r\n }\r\n }\r\n };\r\n\r\n url += (url.indexOf('?') >= 0 ? '&' : '?') + 'd=' + new Date().getTime();\r\n xhr.open(type, url, true);\r\n\r\n for (let property in customHeaders) {\r\n if (customHeaders.hasOwnProperty(property)) {\r\n xhr.setRequestHeader(property, customHeaders[property]);\r\n }\r\n }\r\n\r\n xhr.setRequestHeader('Content-type', 'application/json');\r\n if (data) {\r\n xhr.send(data);\r\n } else {\r\n xhr.send();\r\n }\r\n }\r\n}","import { AppConsts } from '@tp_shared/AppConsts';\r\nimport { filter as _filter } from 'lodash-es';\r\n\r\nexport class LocaleMappingService {\r\n map(mappingSource: string, locale: string): string {\r\n if (!AppConsts.localeMappings && !AppConsts.localeMappings[mappingSource]) {\r\n return locale;\r\n }\r\n\r\n const localeMappings = _filter(AppConsts.localeMappings[mappingSource], { from: locale });\r\n if (localeMappings && localeMappings.length) {\r\n return localeMappings[0]['to'];\r\n }\r\n\r\n return locale;\r\n }\r\n}\r\n","export class CookieTenantResolver {\r\n\r\n resolve(): string {\r\n return abp.utils.getCookieValue('abp_tenancy_name');\r\n }\r\n\r\n}\r\n","import { UrlHelper } from '@tp_shared/helpers/UrlHelper';\r\n\r\nexport class QueryStringTenantResolver {\r\n\r\n resolve(): string {\r\n let queryParams = UrlHelper.getQueryParameters();\r\n return queryParams['abp_tenancy_name'];\r\n }\r\n\r\n}\r\n","import { SubdomainTenancyNameFinder } from '@tp_shared/helpers/SubdomainTenancyNameFinder';\r\n\r\nexport class SubdomainTenantResolver {\r\n\r\n resolve(appBaseUrl): string {\r\n const subdomainTenancyNameFinder = new SubdomainTenancyNameFinder();\r\n return subdomainTenancyNameFinder.getCurrentTenancyNameOrNull(appBaseUrl);\r\n }\r\n\r\n}\r\n","//----------------------\r\n// \r\n// Generated using the NSwag toolchain v13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org)\r\n// \r\n//----------------------\r\n\r\n/* tslint:disable */\r\n/* eslint-disable */\r\n// ReSharper disable InconsistentNaming\r\n\r\nimport { mergeMap as _observableMergeMap, catchError as _observableCatch } from 'rxjs/operators';\r\nimport { Observable, throwError as _observableThrow, of as _observableOf } from 'rxjs';\r\nimport { Injectable, Inject, Optional, InjectionToken } from '@angular/core';\r\nimport { HttpClient, HttpHeaders, HttpResponse, HttpResponseBase } from '@angular/common/http';\r\n\r\nimport { DateTime, Duration } from \"luxon\";\r\n\r\nexport const API_BASE_URL = new InjectionToken('API_BASE_URL');\r\n\r\n@Injectable()\r\nexport class AccountServiceProxy {\r\n private http: HttpClient;\r\n private baseUrl: string;\r\n protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;\r\n\r\n constructor(@Inject(HttpClient) http: HttpClient, @Optional() @Inject(API_BASE_URL) baseUrl?: string) {\r\n this.http = http;\r\n this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : \"\";\r\n }\r\n\r\n /**\r\n * @param body (optional) \r\n * @return Success\r\n */\r\n isTenantAvailable(body: IsTenantAvailableInput | undefined): Observable {\r\n let url_ = this.baseUrl + \"/api/services/app/Account/IsTenantAvailable\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n const content_ = JSON.stringify(body);\r\n\r\n let options_ : any = {\r\n body: content_,\r\n observe: \"response\",\r\n responseType: \"blob\",\r\n headers: new HttpHeaders({\r\n \"Content-Type\": \"application/json\",\r\n \"Accept\": \"text/plain\"\r\n })\r\n };\r\n\r\n return this.http.request(\"post\", url_, options_).pipe(_observableMergeMap((response_ : any) => {\r\n return this.processIsTenantAvailable(response_);\r\n })).pipe(_observableCatch((response_: any) => {\r\n if (response_ instanceof HttpResponseBase) {\r\n try {\r\n return this.processIsTenantAvailable(response_ as any);\r\n } catch (e) {\r\n return _observableThrow(e) as any as Observable;\r\n }\r\n } else\r\n return _observableThrow(response_) as any as Observable;\r\n }));\r\n }\r\n\r\n protected processIsTenantAvailable(response: HttpResponseBase): Observable {\r\n const status = response.status;\r\n const responseBlob =\r\n response instanceof HttpResponse ? response.body :\r\n (response as any).error instanceof Blob ? (response as any).error : undefined;\r\n\r\n let _headers: any = {}; if (response.headers) { for (let key of response.headers.keys()) { _headers[key] = response.headers.get(key); }}\r\n if (status === 200) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n let result200: any = null;\r\n let resultData200 = _responseText === \"\" ? null : JSON.parse(_responseText, this.jsonParseReviver);\r\n result200 = IsTenantAvailableOutput.fromJS(resultData200);\r\n return _observableOf(result200);\r\n }));\r\n } else if (status !== 200 && status !== 204) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }));\r\n }\r\n return _observableOf(null as any);\r\n }\r\n\r\n /**\r\n * @param body (optional) \r\n * @return Success\r\n */\r\n resolveTenantId(body: ResolveTenantIdInput | undefined): Observable {\r\n let url_ = this.baseUrl + \"/api/services/app/Account/ResolveTenantId\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n const content_ = JSON.stringify(body);\r\n\r\n let options_ : any = {\r\n body: content_,\r\n observe: \"response\",\r\n responseType: \"blob\",\r\n headers: new HttpHeaders({\r\n \"Content-Type\": \"application/json\",\r\n \"Accept\": \"text/plain\"\r\n })\r\n };\r\n\r\n return this.http.request(\"post\", url_, options_).pipe(_observableMergeMap((response_ : any) => {\r\n return this.processResolveTenantId(response_);\r\n })).pipe(_observableCatch((response_: any) => {\r\n if (response_ instanceof HttpResponseBase) {\r\n try {\r\n return this.processResolveTenantId(response_ as any);\r\n } catch (e) {\r\n return _observableThrow(e) as any as Observable;\r\n }\r\n } else\r\n return _observableThrow(response_) as any as Observable;\r\n }));\r\n }\r\n\r\n protected processResolveTenantId(response: HttpResponseBase): Observable {\r\n const status = response.status;\r\n const responseBlob =\r\n response instanceof HttpResponse ? response.body :\r\n (response as any).error instanceof Blob ? (response as any).error : undefined;\r\n\r\n let _headers: any = {}; if (response.headers) { for (let key of response.headers.keys()) { _headers[key] = response.headers.get(key); }}\r\n if (status === 200) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n let result200: any = null;\r\n let resultData200 = _responseText === \"\" ? null : JSON.parse(_responseText, this.jsonParseReviver);\r\n result200 = resultData200 !== undefined ? resultData200 : null;\r\n \r\n return _observableOf(result200);\r\n }));\r\n } else if (status !== 200 && status !== 204) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }));\r\n }\r\n return _observableOf(null as any);\r\n }\r\n\r\n /**\r\n * @param body (optional) \r\n * @return Success\r\n */\r\n register(body: RegisterInput | undefined): Observable {\r\n let url_ = this.baseUrl + \"/api/services/app/Account/Register\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n const content_ = JSON.stringify(body);\r\n\r\n let options_ : any = {\r\n body: content_,\r\n observe: \"response\",\r\n responseType: \"blob\",\r\n headers: new HttpHeaders({\r\n \"Content-Type\": \"application/json\",\r\n \"Accept\": \"text/plain\"\r\n })\r\n };\r\n\r\n return this.http.request(\"post\", url_, options_).pipe(_observableMergeMap((response_ : any) => {\r\n return this.processRegister(response_);\r\n })).pipe(_observableCatch((response_: any) => {\r\n if (response_ instanceof HttpResponseBase) {\r\n try {\r\n return this.processRegister(response_ as any);\r\n } catch (e) {\r\n return _observableThrow(e) as any as Observable;\r\n }\r\n } else\r\n return _observableThrow(response_) as any as Observable;\r\n }));\r\n }\r\n\r\n protected processRegister(response: HttpResponseBase): Observable {\r\n const status = response.status;\r\n const responseBlob =\r\n response instanceof HttpResponse ? response.body :\r\n (response as any).error instanceof Blob ? (response as any).error : undefined;\r\n\r\n let _headers: any = {}; if (response.headers) { for (let key of response.headers.keys()) { _headers[key] = response.headers.get(key); }}\r\n if (status === 200) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n let result200: any = null;\r\n let resultData200 = _responseText === \"\" ? null : JSON.parse(_responseText, this.jsonParseReviver);\r\n result200 = RegisterOutput.fromJS(resultData200);\r\n return _observableOf(result200);\r\n }));\r\n } else if (status !== 200 && status !== 204) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }));\r\n }\r\n return _observableOf(null as any);\r\n }\r\n\r\n /**\r\n * @return Success\r\n */\r\n getSupportedCountryCodes(): Observable {\r\n let url_ = this.baseUrl + \"/api/services/app/Account/GetSupportedCountryCodes\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ : any = {\r\n observe: \"response\",\r\n responseType: \"blob\",\r\n headers: new HttpHeaders({\r\n \"Accept\": \"text/plain\"\r\n })\r\n };\r\n\r\n return this.http.request(\"get\", url_, options_).pipe(_observableMergeMap((response_ : any) => {\r\n return this.processGetSupportedCountryCodes(response_);\r\n })).pipe(_observableCatch((response_: any) => {\r\n if (response_ instanceof HttpResponseBase) {\r\n try {\r\n return this.processGetSupportedCountryCodes(response_ as any);\r\n } catch (e) {\r\n return _observableThrow(e) as any as Observable;\r\n }\r\n } else\r\n return _observableThrow(response_) as any as Observable;\r\n }));\r\n }\r\n\r\n protected processGetSupportedCountryCodes(response: HttpResponseBase): Observable {\r\n const status = response.status;\r\n const responseBlob =\r\n response instanceof HttpResponse ? response.body :\r\n (response as any).error instanceof Blob ? (response as any).error : undefined;\r\n\r\n let _headers: any = {}; if (response.headers) { for (let key of response.headers.keys()) { _headers[key] = response.headers.get(key); }}\r\n if (status === 200) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n let result200: any = null;\r\n let resultData200 = _responseText === \"\" ? null : JSON.parse(_responseText, this.jsonParseReviver);\r\n if (Array.isArray(resultData200)) {\r\n result200 = [] as any;\r\n for (let item of resultData200)\r\n result200!.push(NameValueDto.fromJS(item));\r\n }\r\n else {\r\n result200 = null;\r\n }\r\n return _observableOf(result200);\r\n }));\r\n } else if (status !== 200 && status !== 204) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }));\r\n }\r\n return _observableOf(null as any);\r\n }\r\n\r\n /**\r\n * @param body (optional) \r\n * @return Success\r\n */\r\n sendPasswordResetCode(body: SendPasswordResetCodeInput | undefined): Observable {\r\n let url_ = this.baseUrl + \"/api/services/app/Account/SendPasswordResetCode\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n const content_ = JSON.stringify(body);\r\n\r\n let options_ : any = {\r\n body: content_,\r\n observe: \"response\",\r\n responseType: \"blob\",\r\n headers: new HttpHeaders({\r\n \"Content-Type\": \"application/json\",\r\n })\r\n };\r\n\r\n return this.http.request(\"post\", url_, options_).pipe(_observableMergeMap((response_ : any) => {\r\n return this.processSendPasswordResetCode(response_);\r\n })).pipe(_observableCatch((response_: any) => {\r\n if (response_ instanceof HttpResponseBase) {\r\n try {\r\n return this.processSendPasswordResetCode(response_ as any);\r\n } catch (e) {\r\n return _observableThrow(e) as any as Observable;\r\n }\r\n } else\r\n return _observableThrow(response_) as any as Observable;\r\n }));\r\n }\r\n\r\n protected processSendPasswordResetCode(response: HttpResponseBase): Observable {\r\n const status = response.status;\r\n const responseBlob =\r\n response instanceof HttpResponse ? response.body :\r\n (response as any).error instanceof Blob ? (response as any).error : undefined;\r\n\r\n let _headers: any = {}; if (response.headers) { for (let key of response.headers.keys()) { _headers[key] = response.headers.get(key); }}\r\n if (status === 200) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n return _observableOf(null as any);\r\n }));\r\n } else if (status !== 200 && status !== 204) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }));\r\n }\r\n return _observableOf(null as any);\r\n }\r\n\r\n /**\r\n * @param body (optional) \r\n * @return Success\r\n */\r\n resetPassword(body: ResetPasswordInput | undefined): Observable {\r\n let url_ = this.baseUrl + \"/api/services/app/Account/ResetPassword\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n const content_ = JSON.stringify(body);\r\n\r\n let options_ : any = {\r\n body: content_,\r\n observe: \"response\",\r\n responseType: \"blob\",\r\n headers: new HttpHeaders({\r\n \"Content-Type\": \"application/json\",\r\n \"Accept\": \"text/plain\"\r\n })\r\n };\r\n\r\n return this.http.request(\"post\", url_, options_).pipe(_observableMergeMap((response_ : any) => {\r\n return this.processResetPassword(response_);\r\n })).pipe(_observableCatch((response_: any) => {\r\n if (response_ instanceof HttpResponseBase) {\r\n try {\r\n return this.processResetPassword(response_ as any);\r\n } catch (e) {\r\n return _observableThrow(e) as any as Observable;\r\n }\r\n } else\r\n return _observableThrow(response_) as any as Observable;\r\n }));\r\n }\r\n\r\n protected processResetPassword(response: HttpResponseBase): Observable {\r\n const status = response.status;\r\n const responseBlob =\r\n response instanceof HttpResponse ? response.body :\r\n (response as any).error instanceof Blob ? (response as any).error : undefined;\r\n\r\n let _headers: any = {}; if (response.headers) { for (let key of response.headers.keys()) { _headers[key] = response.headers.get(key); }}\r\n if (status === 200) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n let result200: any = null;\r\n let resultData200 = _responseText === \"\" ? null : JSON.parse(_responseText, this.jsonParseReviver);\r\n result200 = ResetPasswordOutput.fromJS(resultData200);\r\n return _observableOf(result200);\r\n }));\r\n } else if (status !== 200 && status !== 204) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }));\r\n }\r\n return _observableOf(null as any);\r\n }\r\n\r\n /**\r\n * @param body (optional) \r\n * @return Success\r\n */\r\n sendEmailActivationLink(body: SendEmailActivationLinkInput | undefined): Observable {\r\n let url_ = this.baseUrl + \"/api/services/app/Account/SendEmailActivationLink\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n const content_ = JSON.stringify(body);\r\n\r\n let options_ : any = {\r\n body: content_,\r\n observe: \"response\",\r\n responseType: \"blob\",\r\n headers: new HttpHeaders({\r\n \"Content-Type\": \"application/json\",\r\n })\r\n };\r\n\r\n return this.http.request(\"post\", url_, options_).pipe(_observableMergeMap((response_ : any) => {\r\n return this.processSendEmailActivationLink(response_);\r\n })).pipe(_observableCatch((response_: any) => {\r\n if (response_ instanceof HttpResponseBase) {\r\n try {\r\n return this.processSendEmailActivationLink(response_ as any);\r\n } catch (e) {\r\n return _observableThrow(e) as any as Observable;\r\n }\r\n } else\r\n return _observableThrow(response_) as any as Observable;\r\n }));\r\n }\r\n\r\n protected processSendEmailActivationLink(response: HttpResponseBase): Observable {\r\n const status = response.status;\r\n const responseBlob =\r\n response instanceof HttpResponse ? response.body :\r\n (response as any).error instanceof Blob ? (response as any).error : undefined;\r\n\r\n let _headers: any = {}; if (response.headers) { for (let key of response.headers.keys()) { _headers[key] = response.headers.get(key); }}\r\n if (status === 200) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n return _observableOf(null as any);\r\n }));\r\n } else if (status !== 200 && status !== 204) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }));\r\n }\r\n return _observableOf(null as any);\r\n }\r\n\r\n /**\r\n * @param body (optional) \r\n * @return Success\r\n */\r\n activateEmail(body: ActivateEmailInput | undefined): Observable {\r\n let url_ = this.baseUrl + \"/api/services/app/Account/ActivateEmail\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n const content_ = JSON.stringify(body);\r\n\r\n let options_ : any = {\r\n body: content_,\r\n observe: \"response\",\r\n responseType: \"blob\",\r\n headers: new HttpHeaders({\r\n \"Content-Type\": \"application/json\",\r\n })\r\n };\r\n\r\n return this.http.request(\"post\", url_, options_).pipe(_observableMergeMap((response_ : any) => {\r\n return this.processActivateEmail(response_);\r\n })).pipe(_observableCatch((response_: any) => {\r\n if (response_ instanceof HttpResponseBase) {\r\n try {\r\n return this.processActivateEmail(response_ as any);\r\n } catch (e) {\r\n return _observableThrow(e) as any as Observable;\r\n }\r\n } else\r\n return _observableThrow(response_) as any as Observable;\r\n }));\r\n }\r\n\r\n protected processActivateEmail(response: HttpResponseBase): Observable {\r\n const status = response.status;\r\n const responseBlob =\r\n response instanceof HttpResponse ? response.body :\r\n (response as any).error instanceof Blob ? (response as any).error : undefined;\r\n\r\n let _headers: any = {}; if (response.headers) { for (let key of response.headers.keys()) { _headers[key] = response.headers.get(key); }}\r\n if (status === 200) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n return _observableOf(null as any);\r\n }));\r\n } else if (status !== 200 && status !== 204) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }));\r\n }\r\n return _observableOf(null as any);\r\n }\r\n\r\n /**\r\n * @param body (optional) \r\n * @return Success\r\n */\r\n changeEmail(body: ChangeEmailInput | undefined): Observable {\r\n let url_ = this.baseUrl + \"/api/services/app/Account/ChangeEmail\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n const content_ = JSON.stringify(body);\r\n\r\n let options_ : any = {\r\n body: content_,\r\n observe: \"response\",\r\n responseType: \"blob\",\r\n headers: new HttpHeaders({\r\n \"Content-Type\": \"application/json\",\r\n })\r\n };\r\n\r\n return this.http.request(\"post\", url_, options_).pipe(_observableMergeMap((response_ : any) => {\r\n return this.processChangeEmail(response_);\r\n })).pipe(_observableCatch((response_: any) => {\r\n if (response_ instanceof HttpResponseBase) {\r\n try {\r\n return this.processChangeEmail(response_ as any);\r\n } catch (e) {\r\n return _observableThrow(e) as any as Observable;\r\n }\r\n } else\r\n return _observableThrow(response_) as any as Observable;\r\n }));\r\n }\r\n\r\n protected processChangeEmail(response: HttpResponseBase): Observable {\r\n const status = response.status;\r\n const responseBlob =\r\n response instanceof HttpResponse ? response.body :\r\n (response as any).error instanceof Blob ? (response as any).error : undefined;\r\n\r\n let _headers: any = {}; if (response.headers) { for (let key of response.headers.keys()) { _headers[key] = response.headers.get(key); }}\r\n if (status === 200) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n return _observableOf(null as any);\r\n }));\r\n } else if (status !== 200 && status !== 204) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }));\r\n }\r\n return _observableOf(null as any);\r\n }\r\n\r\n /**\r\n * @param body (optional) \r\n * @return Success\r\n */\r\n impersonateUser(body: ImpersonateUserInput | undefined): Observable {\r\n let url_ = this.baseUrl + \"/api/services/app/Account/ImpersonateUser\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n const content_ = JSON.stringify(body);\r\n\r\n let options_ : any = {\r\n body: content_,\r\n observe: \"response\",\r\n responseType: \"blob\",\r\n headers: new HttpHeaders({\r\n \"Content-Type\": \"application/json\",\r\n \"Accept\": \"text/plain\"\r\n })\r\n };\r\n\r\n return this.http.request(\"post\", url_, options_).pipe(_observableMergeMap((response_ : any) => {\r\n return this.processImpersonateUser(response_);\r\n })).pipe(_observableCatch((response_: any) => {\r\n if (response_ instanceof HttpResponseBase) {\r\n try {\r\n return this.processImpersonateUser(response_ as any);\r\n } catch (e) {\r\n return _observableThrow(e) as any as Observable;\r\n }\r\n } else\r\n return _observableThrow(response_) as any as Observable;\r\n }));\r\n }\r\n\r\n protected processImpersonateUser(response: HttpResponseBase): Observable {\r\n const status = response.status;\r\n const responseBlob =\r\n response instanceof HttpResponse ? response.body :\r\n (response as any).error instanceof Blob ? (response as any).error : undefined;\r\n\r\n let _headers: any = {}; if (response.headers) { for (let key of response.headers.keys()) { _headers[key] = response.headers.get(key); }}\r\n if (status === 200) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n let result200: any = null;\r\n let resultData200 = _responseText === \"\" ? null : JSON.parse(_responseText, this.jsonParseReviver);\r\n result200 = ImpersonateOutput.fromJS(resultData200);\r\n return _observableOf(result200);\r\n }));\r\n } else if (status !== 200 && status !== 204) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }));\r\n }\r\n return _observableOf(null as any);\r\n }\r\n\r\n /**\r\n * @param body (optional) \r\n * @return Success\r\n */\r\n impersonateTenant(body: ImpersonateTenantInput | undefined): Observable {\r\n let url_ = this.baseUrl + \"/api/services/app/Account/ImpersonateTenant\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n const content_ = JSON.stringify(body);\r\n\r\n let options_ : any = {\r\n body: content_,\r\n observe: \"response\",\r\n responseType: \"blob\",\r\n headers: new HttpHeaders({\r\n \"Content-Type\": \"application/json\",\r\n \"Accept\": \"text/plain\"\r\n })\r\n };\r\n\r\n return this.http.request(\"post\", url_, options_).pipe(_observableMergeMap((response_ : any) => {\r\n return this.processImpersonateTenant(response_);\r\n })).pipe(_observableCatch((response_: any) => {\r\n if (response_ instanceof HttpResponseBase) {\r\n try {\r\n return this.processImpersonateTenant(response_ as any);\r\n } catch (e) {\r\n return _observableThrow(e) as any as Observable;\r\n }\r\n } else\r\n return _observableThrow(response_) as any as Observable;\r\n }));\r\n }\r\n\r\n protected processImpersonateTenant(response: HttpResponseBase): Observable {\r\n const status = response.status;\r\n const responseBlob =\r\n response instanceof HttpResponse ? response.body :\r\n (response as any).error instanceof Blob ? (response as any).error : undefined;\r\n\r\n let _headers: any = {}; if (response.headers) { for (let key of response.headers.keys()) { _headers[key] = response.headers.get(key); }}\r\n if (status === 200) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n let result200: any = null;\r\n let resultData200 = _responseText === \"\" ? null : JSON.parse(_responseText, this.jsonParseReviver);\r\n result200 = ImpersonateOutput.fromJS(resultData200);\r\n return _observableOf(result200);\r\n }));\r\n } else if (status !== 200 && status !== 204) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }));\r\n }\r\n return _observableOf(null as any);\r\n }\r\n\r\n /**\r\n * @param body (optional) \r\n * @return Success\r\n */\r\n delegatedImpersonate(body: DelegatedImpersonateInput | undefined): Observable {\r\n let url_ = this.baseUrl + \"/api/services/app/Account/DelegatedImpersonate\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n const content_ = JSON.stringify(body);\r\n\r\n let options_ : any = {\r\n body: content_,\r\n observe: \"response\",\r\n responseType: \"blob\",\r\n headers: new HttpHeaders({\r\n \"Content-Type\": \"application/json\",\r\n \"Accept\": \"text/plain\"\r\n })\r\n };\r\n\r\n return this.http.request(\"post\", url_, options_).pipe(_observableMergeMap((response_ : any) => {\r\n return this.processDelegatedImpersonate(response_);\r\n })).pipe(_observableCatch((response_: any) => {\r\n if (response_ instanceof HttpResponseBase) {\r\n try {\r\n return this.processDelegatedImpersonate(response_ as any);\r\n } catch (e) {\r\n return _observableThrow(e) as any as Observable;\r\n }\r\n } else\r\n return _observableThrow(response_) as any as Observable;\r\n }));\r\n }\r\n\r\n protected processDelegatedImpersonate(response: HttpResponseBase): Observable {\r\n const status = response.status;\r\n const responseBlob =\r\n response instanceof HttpResponse ? response.body :\r\n (response as any).error instanceof Blob ? (response as any).error : undefined;\r\n\r\n let _headers: any = {}; if (response.headers) { for (let key of response.headers.keys()) { _headers[key] = response.headers.get(key); }}\r\n if (status === 200) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n let result200: any = null;\r\n let resultData200 = _responseText === \"\" ? null : JSON.parse(_responseText, this.jsonParseReviver);\r\n result200 = ImpersonateOutput.fromJS(resultData200);\r\n return _observableOf(result200);\r\n }));\r\n } else if (status !== 200 && status !== 204) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }));\r\n }\r\n return _observableOf(null as any);\r\n }\r\n\r\n /**\r\n * @return Success\r\n */\r\n backToImpersonator(): Observable {\r\n let url_ = this.baseUrl + \"/api/services/app/Account/BackToImpersonator\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ : any = {\r\n observe: \"response\",\r\n responseType: \"blob\",\r\n headers: new HttpHeaders({\r\n \"Accept\": \"text/plain\"\r\n })\r\n };\r\n\r\n return this.http.request(\"post\", url_, options_).pipe(_observableMergeMap((response_ : any) => {\r\n return this.processBackToImpersonator(response_);\r\n })).pipe(_observableCatch((response_: any) => {\r\n if (response_ instanceof HttpResponseBase) {\r\n try {\r\n return this.processBackToImpersonator(response_ as any);\r\n } catch (e) {\r\n return _observableThrow(e) as any as Observable;\r\n }\r\n } else\r\n return _observableThrow(response_) as any as Observable;\r\n }));\r\n }\r\n\r\n protected processBackToImpersonator(response: HttpResponseBase): Observable {\r\n const status = response.status;\r\n const responseBlob =\r\n response instanceof HttpResponse ? response.body :\r\n (response as any).error instanceof Blob ? (response as any).error : undefined;\r\n\r\n let _headers: any = {}; if (response.headers) { for (let key of response.headers.keys()) { _headers[key] = response.headers.get(key); }}\r\n if (status === 200) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n let result200: any = null;\r\n let resultData200 = _responseText === \"\" ? null : JSON.parse(_responseText, this.jsonParseReviver);\r\n result200 = ImpersonateOutput.fromJS(resultData200);\r\n return _observableOf(result200);\r\n }));\r\n } else if (status !== 200 && status !== 204) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }));\r\n }\r\n return _observableOf(null as any);\r\n }\r\n\r\n /**\r\n * @param body (optional) \r\n * @return Success\r\n */\r\n switchToLinkedAccount(body: SwitchToLinkedAccountInput | undefined): Observable {\r\n let url_ = this.baseUrl + \"/api/services/app/Account/SwitchToLinkedAccount\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n const content_ = JSON.stringify(body);\r\n\r\n let options_ : any = {\r\n body: content_,\r\n observe: \"response\",\r\n responseType: \"blob\",\r\n headers: new HttpHeaders({\r\n \"Content-Type\": \"application/json\",\r\n \"Accept\": \"text/plain\"\r\n })\r\n };\r\n\r\n return this.http.request(\"post\", url_, options_).pipe(_observableMergeMap((response_ : any) => {\r\n return this.processSwitchToLinkedAccount(response_);\r\n })).pipe(_observableCatch((response_: any) => {\r\n if (response_ instanceof HttpResponseBase) {\r\n try {\r\n return this.processSwitchToLinkedAccount(response_ as any);\r\n } catch (e) {\r\n return _observableThrow(e) as any as Observable;\r\n }\r\n } else\r\n return _observableThrow(response_) as any as Observable;\r\n }));\r\n }\r\n\r\n protected processSwitchToLinkedAccount(response: HttpResponseBase): Observable {\r\n const status = response.status;\r\n const responseBlob =\r\n response instanceof HttpResponse ? response.body :\r\n (response as any).error instanceof Blob ? (response as any).error : undefined;\r\n\r\n let _headers: any = {}; if (response.headers) { for (let key of response.headers.keys()) { _headers[key] = response.headers.get(key); }}\r\n if (status === 200) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n let result200: any = null;\r\n let resultData200 = _responseText === \"\" ? null : JSON.parse(_responseText, this.jsonParseReviver);\r\n result200 = SwitchToLinkedAccountOutput.fromJS(resultData200);\r\n return _observableOf(result200);\r\n }));\r\n } else if (status !== 200 && status !== 204) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }));\r\n }\r\n return _observableOf(null as any);\r\n }\r\n}\r\n\r\n@Injectable()\r\nexport class AuditLogServiceProxy {\r\n private http: HttpClient;\r\n private baseUrl: string;\r\n protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;\r\n\r\n constructor(@Inject(HttpClient) http: HttpClient, @Optional() @Inject(API_BASE_URL) baseUrl?: string) {\r\n this.http = http;\r\n this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : \"\";\r\n }\r\n\r\n /**\r\n * @param startDate (optional) \r\n * @param endDate (optional) \r\n * @param userName (optional) \r\n * @param serviceName (optional) \r\n * @param methodName (optional) \r\n * @param browserInfo (optional) \r\n * @param hasException (optional) \r\n * @param minExecutionDuration (optional) \r\n * @param maxExecutionDuration (optional) \r\n * @param sorting (optional) \r\n * @param maxResultCount (optional) \r\n * @param skipCount (optional) \r\n * @return Success\r\n */\r\n getAuditLogs(startDate: DateTime | undefined, endDate: DateTime | undefined, userName: string | undefined, serviceName: string | undefined, methodName: string | undefined, browserInfo: string | undefined, hasException: boolean | undefined, minExecutionDuration: number | undefined, maxExecutionDuration: number | undefined, sorting: string | undefined, maxResultCount: number | undefined, skipCount: number | undefined): Observable {\r\n let url_ = this.baseUrl + \"/api/services/app/AuditLog/GetAuditLogs?\";\r\n if (startDate === null)\r\n throw new Error(\"The parameter 'startDate' cannot be null.\");\r\n else if (startDate !== undefined)\r\n url_ += \"StartDate=\" + encodeURIComponent(startDate ? \"\" + startDate.toString() : \"\") + \"&\";\r\n if (endDate === null)\r\n throw new Error(\"The parameter 'endDate' cannot be null.\");\r\n else if (endDate !== undefined)\r\n url_ += \"EndDate=\" + encodeURIComponent(endDate ? \"\" + endDate.toString() : \"\") + \"&\";\r\n if (userName === null)\r\n throw new Error(\"The parameter 'userName' cannot be null.\");\r\n else if (userName !== undefined)\r\n url_ += \"UserName=\" + encodeURIComponent(\"\" + userName) + \"&\";\r\n if (serviceName === null)\r\n throw new Error(\"The parameter 'serviceName' cannot be null.\");\r\n else if (serviceName !== undefined)\r\n url_ += \"ServiceName=\" + encodeURIComponent(\"\" + serviceName) + \"&\";\r\n if (methodName === null)\r\n throw new Error(\"The parameter 'methodName' cannot be null.\");\r\n else if (methodName !== undefined)\r\n url_ += \"MethodName=\" + encodeURIComponent(\"\" + methodName) + \"&\";\r\n if (browserInfo === null)\r\n throw new Error(\"The parameter 'browserInfo' cannot be null.\");\r\n else if (browserInfo !== undefined)\r\n url_ += \"BrowserInfo=\" + encodeURIComponent(\"\" + browserInfo) + \"&\";\r\n if (hasException === null)\r\n throw new Error(\"The parameter 'hasException' cannot be null.\");\r\n else if (hasException !== undefined)\r\n url_ += \"HasException=\" + encodeURIComponent(\"\" + hasException) + \"&\";\r\n if (minExecutionDuration === null)\r\n throw new Error(\"The parameter 'minExecutionDuration' cannot be null.\");\r\n else if (minExecutionDuration !== undefined)\r\n url_ += \"MinExecutionDuration=\" + encodeURIComponent(\"\" + minExecutionDuration) + \"&\";\r\n if (maxExecutionDuration === null)\r\n throw new Error(\"The parameter 'maxExecutionDuration' cannot be null.\");\r\n else if (maxExecutionDuration !== undefined)\r\n url_ += \"MaxExecutionDuration=\" + encodeURIComponent(\"\" + maxExecutionDuration) + \"&\";\r\n if (sorting === null)\r\n throw new Error(\"The parameter 'sorting' cannot be null.\");\r\n else if (sorting !== undefined)\r\n url_ += \"Sorting=\" + encodeURIComponent(\"\" + sorting) + \"&\";\r\n if (maxResultCount === null)\r\n throw new Error(\"The parameter 'maxResultCount' cannot be null.\");\r\n else if (maxResultCount !== undefined)\r\n url_ += \"MaxResultCount=\" + encodeURIComponent(\"\" + maxResultCount) + \"&\";\r\n if (skipCount === null)\r\n throw new Error(\"The parameter 'skipCount' cannot be null.\");\r\n else if (skipCount !== undefined)\r\n url_ += \"SkipCount=\" + encodeURIComponent(\"\" + skipCount) + \"&\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ : any = {\r\n observe: \"response\",\r\n responseType: \"blob\",\r\n headers: new HttpHeaders({\r\n \"Accept\": \"text/plain\"\r\n })\r\n };\r\n\r\n return this.http.request(\"get\", url_, options_).pipe(_observableMergeMap((response_ : any) => {\r\n return this.processGetAuditLogs(response_);\r\n })).pipe(_observableCatch((response_: any) => {\r\n if (response_ instanceof HttpResponseBase) {\r\n try {\r\n return this.processGetAuditLogs(response_ as any);\r\n } catch (e) {\r\n return _observableThrow(e) as any as Observable;\r\n }\r\n } else\r\n return _observableThrow(response_) as any as Observable;\r\n }));\r\n }\r\n\r\n protected processGetAuditLogs(response: HttpResponseBase): Observable {\r\n const status = response.status;\r\n const responseBlob =\r\n response instanceof HttpResponse ? response.body :\r\n (response as any).error instanceof Blob ? (response as any).error : undefined;\r\n\r\n let _headers: any = {}; if (response.headers) { for (let key of response.headers.keys()) { _headers[key] = response.headers.get(key); }}\r\n if (status === 200) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n let result200: any = null;\r\n let resultData200 = _responseText === \"\" ? null : JSON.parse(_responseText, this.jsonParseReviver);\r\n result200 = PagedResultDtoOfAuditLogListDto.fromJS(resultData200);\r\n return _observableOf(result200);\r\n }));\r\n } else if (status !== 200 && status !== 204) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }));\r\n }\r\n return _observableOf(null as any);\r\n }\r\n\r\n /**\r\n * @param startDate (optional) \r\n * @param endDate (optional) \r\n * @param userName (optional) \r\n * @param serviceName (optional) \r\n * @param methodName (optional) \r\n * @param browserInfo (optional) \r\n * @param hasException (optional) \r\n * @param minExecutionDuration (optional) \r\n * @param maxExecutionDuration (optional) \r\n * @param sorting (optional) \r\n * @param maxResultCount (optional) \r\n * @param skipCount (optional) \r\n * @return Success\r\n */\r\n getAuditLogsToExcel(startDate: DateTime | undefined, endDate: DateTime | undefined, userName: string | undefined, serviceName: string | undefined, methodName: string | undefined, browserInfo: string | undefined, hasException: boolean | undefined, minExecutionDuration: number | undefined, maxExecutionDuration: number | undefined, sorting: string | undefined, maxResultCount: number | undefined, skipCount: number | undefined): Observable {\r\n let url_ = this.baseUrl + \"/api/services/app/AuditLog/GetAuditLogsToExcel?\";\r\n if (startDate === null)\r\n throw new Error(\"The parameter 'startDate' cannot be null.\");\r\n else if (startDate !== undefined)\r\n url_ += \"StartDate=\" + encodeURIComponent(startDate ? \"\" + startDate.toString() : \"\") + \"&\";\r\n if (endDate === null)\r\n throw new Error(\"The parameter 'endDate' cannot be null.\");\r\n else if (endDate !== undefined)\r\n url_ += \"EndDate=\" + encodeURIComponent(endDate ? \"\" + endDate.toString() : \"\") + \"&\";\r\n if (userName === null)\r\n throw new Error(\"The parameter 'userName' cannot be null.\");\r\n else if (userName !== undefined)\r\n url_ += \"UserName=\" + encodeURIComponent(\"\" + userName) + \"&\";\r\n if (serviceName === null)\r\n throw new Error(\"The parameter 'serviceName' cannot be null.\");\r\n else if (serviceName !== undefined)\r\n url_ += \"ServiceName=\" + encodeURIComponent(\"\" + serviceName) + \"&\";\r\n if (methodName === null)\r\n throw new Error(\"The parameter 'methodName' cannot be null.\");\r\n else if (methodName !== undefined)\r\n url_ += \"MethodName=\" + encodeURIComponent(\"\" + methodName) + \"&\";\r\n if (browserInfo === null)\r\n throw new Error(\"The parameter 'browserInfo' cannot be null.\");\r\n else if (browserInfo !== undefined)\r\n url_ += \"BrowserInfo=\" + encodeURIComponent(\"\" + browserInfo) + \"&\";\r\n if (hasException === null)\r\n throw new Error(\"The parameter 'hasException' cannot be null.\");\r\n else if (hasException !== undefined)\r\n url_ += \"HasException=\" + encodeURIComponent(\"\" + hasException) + \"&\";\r\n if (minExecutionDuration === null)\r\n throw new Error(\"The parameter 'minExecutionDuration' cannot be null.\");\r\n else if (minExecutionDuration !== undefined)\r\n url_ += \"MinExecutionDuration=\" + encodeURIComponent(\"\" + minExecutionDuration) + \"&\";\r\n if (maxExecutionDuration === null)\r\n throw new Error(\"The parameter 'maxExecutionDuration' cannot be null.\");\r\n else if (maxExecutionDuration !== undefined)\r\n url_ += \"MaxExecutionDuration=\" + encodeURIComponent(\"\" + maxExecutionDuration) + \"&\";\r\n if (sorting === null)\r\n throw new Error(\"The parameter 'sorting' cannot be null.\");\r\n else if (sorting !== undefined)\r\n url_ += \"Sorting=\" + encodeURIComponent(\"\" + sorting) + \"&\";\r\n if (maxResultCount === null)\r\n throw new Error(\"The parameter 'maxResultCount' cannot be null.\");\r\n else if (maxResultCount !== undefined)\r\n url_ += \"MaxResultCount=\" + encodeURIComponent(\"\" + maxResultCount) + \"&\";\r\n if (skipCount === null)\r\n throw new Error(\"The parameter 'skipCount' cannot be null.\");\r\n else if (skipCount !== undefined)\r\n url_ += \"SkipCount=\" + encodeURIComponent(\"\" + skipCount) + \"&\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ : any = {\r\n observe: \"response\",\r\n responseType: \"blob\",\r\n headers: new HttpHeaders({\r\n \"Accept\": \"text/plain\"\r\n })\r\n };\r\n\r\n return this.http.request(\"get\", url_, options_).pipe(_observableMergeMap((response_ : any) => {\r\n return this.processGetAuditLogsToExcel(response_);\r\n })).pipe(_observableCatch((response_: any) => {\r\n if (response_ instanceof HttpResponseBase) {\r\n try {\r\n return this.processGetAuditLogsToExcel(response_ as any);\r\n } catch (e) {\r\n return _observableThrow(e) as any as Observable;\r\n }\r\n } else\r\n return _observableThrow(response_) as any as Observable;\r\n }));\r\n }\r\n\r\n protected processGetAuditLogsToExcel(response: HttpResponseBase): Observable {\r\n const status = response.status;\r\n const responseBlob =\r\n response instanceof HttpResponse ? response.body :\r\n (response as any).error instanceof Blob ? (response as any).error : undefined;\r\n\r\n let _headers: any = {}; if (response.headers) { for (let key of response.headers.keys()) { _headers[key] = response.headers.get(key); }}\r\n if (status === 200) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n let result200: any = null;\r\n let resultData200 = _responseText === \"\" ? null : JSON.parse(_responseText, this.jsonParseReviver);\r\n result200 = FileDto.fromJS(resultData200);\r\n return _observableOf(result200);\r\n }));\r\n } else if (status !== 200 && status !== 204) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }));\r\n }\r\n return _observableOf(null as any);\r\n }\r\n\r\n /**\r\n * @return Success\r\n */\r\n getEntityHistoryObjectTypes(): Observable {\r\n let url_ = this.baseUrl + \"/api/services/app/AuditLog/GetEntityHistoryObjectTypes\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ : any = {\r\n observe: \"response\",\r\n responseType: \"blob\",\r\n headers: new HttpHeaders({\r\n \"Accept\": \"text/plain\"\r\n })\r\n };\r\n\r\n return this.http.request(\"get\", url_, options_).pipe(_observableMergeMap((response_ : any) => {\r\n return this.processGetEntityHistoryObjectTypes(response_);\r\n })).pipe(_observableCatch((response_: any) => {\r\n if (response_ instanceof HttpResponseBase) {\r\n try {\r\n return this.processGetEntityHistoryObjectTypes(response_ as any);\r\n } catch (e) {\r\n return _observableThrow(e) as any as Observable;\r\n }\r\n } else\r\n return _observableThrow(response_) as any as Observable;\r\n }));\r\n }\r\n\r\n protected processGetEntityHistoryObjectTypes(response: HttpResponseBase): Observable {\r\n const status = response.status;\r\n const responseBlob =\r\n response instanceof HttpResponse ? response.body :\r\n (response as any).error instanceof Blob ? (response as any).error : undefined;\r\n\r\n let _headers: any = {}; if (response.headers) { for (let key of response.headers.keys()) { _headers[key] = response.headers.get(key); }}\r\n if (status === 200) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n let result200: any = null;\r\n let resultData200 = _responseText === \"\" ? null : JSON.parse(_responseText, this.jsonParseReviver);\r\n if (Array.isArray(resultData200)) {\r\n result200 = [] as any;\r\n for (let item of resultData200)\r\n result200!.push(NameValueDto.fromJS(item));\r\n }\r\n else {\r\n result200 = null;\r\n }\r\n return _observableOf(result200);\r\n }));\r\n } else if (status !== 200 && status !== 204) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }));\r\n }\r\n return _observableOf(null as any);\r\n }\r\n\r\n /**\r\n * @param startDate (optional) \r\n * @param endDate (optional) \r\n * @param userName (optional) \r\n * @param entityTypeFullName (optional) \r\n * @param sorting (optional) \r\n * @param maxResultCount (optional) \r\n * @param skipCount (optional) \r\n * @return Success\r\n */\r\n getEntityChanges(startDate: DateTime | undefined, endDate: DateTime | undefined, userName: string | undefined, entityTypeFullName: string | undefined, sorting: string | undefined, maxResultCount: number | undefined, skipCount: number | undefined): Observable {\r\n let url_ = this.baseUrl + \"/api/services/app/AuditLog/GetEntityChanges?\";\r\n if (startDate === null)\r\n throw new Error(\"The parameter 'startDate' cannot be null.\");\r\n else if (startDate !== undefined)\r\n url_ += \"StartDate=\" + encodeURIComponent(startDate ? \"\" + startDate.toString() : \"\") + \"&\";\r\n if (endDate === null)\r\n throw new Error(\"The parameter 'endDate' cannot be null.\");\r\n else if (endDate !== undefined)\r\n url_ += \"EndDate=\" + encodeURIComponent(endDate ? \"\" + endDate.toString() : \"\") + \"&\";\r\n if (userName === null)\r\n throw new Error(\"The parameter 'userName' cannot be null.\");\r\n else if (userName !== undefined)\r\n url_ += \"UserName=\" + encodeURIComponent(\"\" + userName) + \"&\";\r\n if (entityTypeFullName === null)\r\n throw new Error(\"The parameter 'entityTypeFullName' cannot be null.\");\r\n else if (entityTypeFullName !== undefined)\r\n url_ += \"EntityTypeFullName=\" + encodeURIComponent(\"\" + entityTypeFullName) + \"&\";\r\n if (sorting === null)\r\n throw new Error(\"The parameter 'sorting' cannot be null.\");\r\n else if (sorting !== undefined)\r\n url_ += \"Sorting=\" + encodeURIComponent(\"\" + sorting) + \"&\";\r\n if (maxResultCount === null)\r\n throw new Error(\"The parameter 'maxResultCount' cannot be null.\");\r\n else if (maxResultCount !== undefined)\r\n url_ += \"MaxResultCount=\" + encodeURIComponent(\"\" + maxResultCount) + \"&\";\r\n if (skipCount === null)\r\n throw new Error(\"The parameter 'skipCount' cannot be null.\");\r\n else if (skipCount !== undefined)\r\n url_ += \"SkipCount=\" + encodeURIComponent(\"\" + skipCount) + \"&\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ : any = {\r\n observe: \"response\",\r\n responseType: \"blob\",\r\n headers: new HttpHeaders({\r\n \"Accept\": \"text/plain\"\r\n })\r\n };\r\n\r\n return this.http.request(\"get\", url_, options_).pipe(_observableMergeMap((response_ : any) => {\r\n return this.processGetEntityChanges(response_);\r\n })).pipe(_observableCatch((response_: any) => {\r\n if (response_ instanceof HttpResponseBase) {\r\n try {\r\n return this.processGetEntityChanges(response_ as any);\r\n } catch (e) {\r\n return _observableThrow(e) as any as Observable;\r\n }\r\n } else\r\n return _observableThrow(response_) as any as Observable;\r\n }));\r\n }\r\n\r\n protected processGetEntityChanges(response: HttpResponseBase): Observable {\r\n const status = response.status;\r\n const responseBlob =\r\n response instanceof HttpResponse ? response.body :\r\n (response as any).error instanceof Blob ? (response as any).error : undefined;\r\n\r\n let _headers: any = {}; if (response.headers) { for (let key of response.headers.keys()) { _headers[key] = response.headers.get(key); }}\r\n if (status === 200) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n let result200: any = null;\r\n let resultData200 = _responseText === \"\" ? null : JSON.parse(_responseText, this.jsonParseReviver);\r\n result200 = PagedResultDtoOfEntityChangeListDto.fromJS(resultData200);\r\n return _observableOf(result200);\r\n }));\r\n } else if (status !== 200 && status !== 204) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }));\r\n }\r\n return _observableOf(null as any);\r\n }\r\n\r\n /**\r\n * @param entityTypeFullName (optional) \r\n * @param entityId (optional) \r\n * @param sorting (optional) \r\n * @param maxResultCount (optional) \r\n * @param skipCount (optional) \r\n * @return Success\r\n */\r\n getEntityTypeChanges(entityTypeFullName: string | undefined, entityId: string | undefined, sorting: string | undefined, maxResultCount: number | undefined, skipCount: number | undefined): Observable {\r\n let url_ = this.baseUrl + \"/api/services/app/AuditLog/GetEntityTypeChanges?\";\r\n if (entityTypeFullName === null)\r\n throw new Error(\"The parameter 'entityTypeFullName' cannot be null.\");\r\n else if (entityTypeFullName !== undefined)\r\n url_ += \"EntityTypeFullName=\" + encodeURIComponent(\"\" + entityTypeFullName) + \"&\";\r\n if (entityId === null)\r\n throw new Error(\"The parameter 'entityId' cannot be null.\");\r\n else if (entityId !== undefined)\r\n url_ += \"EntityId=\" + encodeURIComponent(\"\" + entityId) + \"&\";\r\n if (sorting === null)\r\n throw new Error(\"The parameter 'sorting' cannot be null.\");\r\n else if (sorting !== undefined)\r\n url_ += \"Sorting=\" + encodeURIComponent(\"\" + sorting) + \"&\";\r\n if (maxResultCount === null)\r\n throw new Error(\"The parameter 'maxResultCount' cannot be null.\");\r\n else if (maxResultCount !== undefined)\r\n url_ += \"MaxResultCount=\" + encodeURIComponent(\"\" + maxResultCount) + \"&\";\r\n if (skipCount === null)\r\n throw new Error(\"The parameter 'skipCount' cannot be null.\");\r\n else if (skipCount !== undefined)\r\n url_ += \"SkipCount=\" + encodeURIComponent(\"\" + skipCount) + \"&\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ : any = {\r\n observe: \"response\",\r\n responseType: \"blob\",\r\n headers: new HttpHeaders({\r\n \"Accept\": \"text/plain\"\r\n })\r\n };\r\n\r\n return this.http.request(\"get\", url_, options_).pipe(_observableMergeMap((response_ : any) => {\r\n return this.processGetEntityTypeChanges(response_);\r\n })).pipe(_observableCatch((response_: any) => {\r\n if (response_ instanceof HttpResponseBase) {\r\n try {\r\n return this.processGetEntityTypeChanges(response_ as any);\r\n } catch (e) {\r\n return _observableThrow(e) as any as Observable;\r\n }\r\n } else\r\n return _observableThrow(response_) as any as Observable;\r\n }));\r\n }\r\n\r\n protected processGetEntityTypeChanges(response: HttpResponseBase): Observable {\r\n const status = response.status;\r\n const responseBlob =\r\n response instanceof HttpResponse ? response.body :\r\n (response as any).error instanceof Blob ? (response as any).error : undefined;\r\n\r\n let _headers: any = {}; if (response.headers) { for (let key of response.headers.keys()) { _headers[key] = response.headers.get(key); }}\r\n if (status === 200) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n let result200: any = null;\r\n let resultData200 = _responseText === \"\" ? null : JSON.parse(_responseText, this.jsonParseReviver);\r\n result200 = PagedResultDtoOfEntityChangeListDto.fromJS(resultData200);\r\n return _observableOf(result200);\r\n }));\r\n } else if (status !== 200 && status !== 204) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }));\r\n }\r\n return _observableOf(null as any);\r\n }\r\n\r\n /**\r\n * @param startDate (optional) \r\n * @param endDate (optional) \r\n * @param userName (optional) \r\n * @param entityTypeFullName (optional) \r\n * @param sorting (optional) \r\n * @param maxResultCount (optional) \r\n * @param skipCount (optional) \r\n * @return Success\r\n */\r\n getEntityChangesToExcel(startDate: DateTime | undefined, endDate: DateTime | undefined, userName: string | undefined, entityTypeFullName: string | undefined, sorting: string | undefined, maxResultCount: number | undefined, skipCount: number | undefined): Observable {\r\n let url_ = this.baseUrl + \"/api/services/app/AuditLog/GetEntityChangesToExcel?\";\r\n if (startDate === null)\r\n throw new Error(\"The parameter 'startDate' cannot be null.\");\r\n else if (startDate !== undefined)\r\n url_ += \"StartDate=\" + encodeURIComponent(startDate ? \"\" + startDate.toString() : \"\") + \"&\";\r\n if (endDate === null)\r\n throw new Error(\"The parameter 'endDate' cannot be null.\");\r\n else if (endDate !== undefined)\r\n url_ += \"EndDate=\" + encodeURIComponent(endDate ? \"\" + endDate.toString() : \"\") + \"&\";\r\n if (userName === null)\r\n throw new Error(\"The parameter 'userName' cannot be null.\");\r\n else if (userName !== undefined)\r\n url_ += \"UserName=\" + encodeURIComponent(\"\" + userName) + \"&\";\r\n if (entityTypeFullName === null)\r\n throw new Error(\"The parameter 'entityTypeFullName' cannot be null.\");\r\n else if (entityTypeFullName !== undefined)\r\n url_ += \"EntityTypeFullName=\" + encodeURIComponent(\"\" + entityTypeFullName) + \"&\";\r\n if (sorting === null)\r\n throw new Error(\"The parameter 'sorting' cannot be null.\");\r\n else if (sorting !== undefined)\r\n url_ += \"Sorting=\" + encodeURIComponent(\"\" + sorting) + \"&\";\r\n if (maxResultCount === null)\r\n throw new Error(\"The parameter 'maxResultCount' cannot be null.\");\r\n else if (maxResultCount !== undefined)\r\n url_ += \"MaxResultCount=\" + encodeURIComponent(\"\" + maxResultCount) + \"&\";\r\n if (skipCount === null)\r\n throw new Error(\"The parameter 'skipCount' cannot be null.\");\r\n else if (skipCount !== undefined)\r\n url_ += \"SkipCount=\" + encodeURIComponent(\"\" + skipCount) + \"&\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ : any = {\r\n observe: \"response\",\r\n responseType: \"blob\",\r\n headers: new HttpHeaders({\r\n \"Accept\": \"text/plain\"\r\n })\r\n };\r\n\r\n return this.http.request(\"get\", url_, options_).pipe(_observableMergeMap((response_ : any) => {\r\n return this.processGetEntityChangesToExcel(response_);\r\n })).pipe(_observableCatch((response_: any) => {\r\n if (response_ instanceof HttpResponseBase) {\r\n try {\r\n return this.processGetEntityChangesToExcel(response_ as any);\r\n } catch (e) {\r\n return _observableThrow(e) as any as Observable;\r\n }\r\n } else\r\n return _observableThrow(response_) as any as Observable;\r\n }));\r\n }\r\n\r\n protected processGetEntityChangesToExcel(response: HttpResponseBase): Observable {\r\n const status = response.status;\r\n const responseBlob =\r\n response instanceof HttpResponse ? response.body :\r\n (response as any).error instanceof Blob ? (response as any).error : undefined;\r\n\r\n let _headers: any = {}; if (response.headers) { for (let key of response.headers.keys()) { _headers[key] = response.headers.get(key); }}\r\n if (status === 200) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n let result200: any = null;\r\n let resultData200 = _responseText === \"\" ? null : JSON.parse(_responseText, this.jsonParseReviver);\r\n result200 = FileDto.fromJS(resultData200);\r\n return _observableOf(result200);\r\n }));\r\n } else if (status !== 200 && status !== 204) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }));\r\n }\r\n return _observableOf(null as any);\r\n }\r\n\r\n /**\r\n * @param entityChangeId (optional) \r\n * @return Success\r\n */\r\n getEntityPropertyChanges(entityChangeId: number | undefined): Observable {\r\n let url_ = this.baseUrl + \"/api/services/app/AuditLog/GetEntityPropertyChanges?\";\r\n if (entityChangeId === null)\r\n throw new Error(\"The parameter 'entityChangeId' cannot be null.\");\r\n else if (entityChangeId !== undefined)\r\n url_ += \"entityChangeId=\" + encodeURIComponent(\"\" + entityChangeId) + \"&\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ : any = {\r\n observe: \"response\",\r\n responseType: \"blob\",\r\n headers: new HttpHeaders({\r\n \"Accept\": \"text/plain\"\r\n })\r\n };\r\n\r\n return this.http.request(\"get\", url_, options_).pipe(_observableMergeMap((response_ : any) => {\r\n return this.processGetEntityPropertyChanges(response_);\r\n })).pipe(_observableCatch((response_: any) => {\r\n if (response_ instanceof HttpResponseBase) {\r\n try {\r\n return this.processGetEntityPropertyChanges(response_ as any);\r\n } catch (e) {\r\n return _observableThrow(e) as any as Observable;\r\n }\r\n } else\r\n return _observableThrow(response_) as any as Observable;\r\n }));\r\n }\r\n\r\n protected processGetEntityPropertyChanges(response: HttpResponseBase): Observable {\r\n const status = response.status;\r\n const responseBlob =\r\n response instanceof HttpResponse ? response.body :\r\n (response as any).error instanceof Blob ? (response as any).error : undefined;\r\n\r\n let _headers: any = {}; if (response.headers) { for (let key of response.headers.keys()) { _headers[key] = response.headers.get(key); }}\r\n if (status === 200) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n let result200: any = null;\r\n let resultData200 = _responseText === \"\" ? null : JSON.parse(_responseText, this.jsonParseReviver);\r\n if (Array.isArray(resultData200)) {\r\n result200 = [] as any;\r\n for (let item of resultData200)\r\n result200!.push(EntityPropertyChangeDto.fromJS(item));\r\n }\r\n else {\r\n result200 = null;\r\n }\r\n return _observableOf(result200);\r\n }));\r\n } else if (status !== 200 && status !== 204) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }));\r\n }\r\n return _observableOf(null as any);\r\n }\r\n}\r\n\r\n@Injectable()\r\nexport class CachingServiceProxy {\r\n private http: HttpClient;\r\n private baseUrl: string;\r\n protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;\r\n\r\n constructor(@Inject(HttpClient) http: HttpClient, @Optional() @Inject(API_BASE_URL) baseUrl?: string) {\r\n this.http = http;\r\n this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : \"\";\r\n }\r\n\r\n /**\r\n * @return Success\r\n */\r\n getAllCaches(): Observable {\r\n let url_ = this.baseUrl + \"/api/services/app/Caching/GetAllCaches\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ : any = {\r\n observe: \"response\",\r\n responseType: \"blob\",\r\n headers: new HttpHeaders({\r\n \"Accept\": \"text/plain\"\r\n })\r\n };\r\n\r\n return this.http.request(\"get\", url_, options_).pipe(_observableMergeMap((response_ : any) => {\r\n return this.processGetAllCaches(response_);\r\n })).pipe(_observableCatch((response_: any) => {\r\n if (response_ instanceof HttpResponseBase) {\r\n try {\r\n return this.processGetAllCaches(response_ as any);\r\n } catch (e) {\r\n return _observableThrow(e) as any as Observable;\r\n }\r\n } else\r\n return _observableThrow(response_) as any as Observable;\r\n }));\r\n }\r\n\r\n protected processGetAllCaches(response: HttpResponseBase): Observable {\r\n const status = response.status;\r\n const responseBlob =\r\n response instanceof HttpResponse ? response.body :\r\n (response as any).error instanceof Blob ? (response as any).error : undefined;\r\n\r\n let _headers: any = {}; if (response.headers) { for (let key of response.headers.keys()) { _headers[key] = response.headers.get(key); }}\r\n if (status === 200) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n let result200: any = null;\r\n let resultData200 = _responseText === \"\" ? null : JSON.parse(_responseText, this.jsonParseReviver);\r\n result200 = ListResultDtoOfCacheDto.fromJS(resultData200);\r\n return _observableOf(result200);\r\n }));\r\n } else if (status !== 200 && status !== 204) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }));\r\n }\r\n return _observableOf(null as any);\r\n }\r\n\r\n /**\r\n * @param body (optional) \r\n * @return Success\r\n */\r\n clearCache(body: EntityDtoOfString | undefined): Observable {\r\n let url_ = this.baseUrl + \"/api/services/app/Caching/ClearCache\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n const content_ = JSON.stringify(body);\r\n\r\n let options_ : any = {\r\n body: content_,\r\n observe: \"response\",\r\n responseType: \"blob\",\r\n headers: new HttpHeaders({\r\n \"Content-Type\": \"application/json\",\r\n })\r\n };\r\n\r\n return this.http.request(\"post\", url_, options_).pipe(_observableMergeMap((response_ : any) => {\r\n return this.processClearCache(response_);\r\n })).pipe(_observableCatch((response_: any) => {\r\n if (response_ instanceof HttpResponseBase) {\r\n try {\r\n return this.processClearCache(response_ as any);\r\n } catch (e) {\r\n return _observableThrow(e) as any as Observable;\r\n }\r\n } else\r\n return _observableThrow(response_) as any as Observable;\r\n }));\r\n }\r\n\r\n protected processClearCache(response: HttpResponseBase): Observable {\r\n const status = response.status;\r\n const responseBlob =\r\n response instanceof HttpResponse ? response.body :\r\n (response as any).error instanceof Blob ? (response as any).error : undefined;\r\n\r\n let _headers: any = {}; if (response.headers) { for (let key of response.headers.keys()) { _headers[key] = response.headers.get(key); }}\r\n if (status === 200) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n return _observableOf(null as any);\r\n }));\r\n } else if (status !== 200 && status !== 204) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }));\r\n }\r\n return _observableOf(null as any);\r\n }\r\n\r\n /**\r\n * @return Success\r\n */\r\n clearAllCaches(): Observable {\r\n let url_ = this.baseUrl + \"/api/services/app/Caching/ClearAllCaches\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ : any = {\r\n observe: \"response\",\r\n responseType: \"blob\",\r\n headers: new HttpHeaders({\r\n })\r\n };\r\n\r\n return this.http.request(\"post\", url_, options_).pipe(_observableMergeMap((response_ : any) => {\r\n return this.processClearAllCaches(response_);\r\n })).pipe(_observableCatch((response_: any) => {\r\n if (response_ instanceof HttpResponseBase) {\r\n try {\r\n return this.processClearAllCaches(response_ as any);\r\n } catch (e) {\r\n return _observableThrow(e) as any as Observable;\r\n }\r\n } else\r\n return _observableThrow(response_) as any as Observable;\r\n }));\r\n }\r\n\r\n protected processClearAllCaches(response: HttpResponseBase): Observable {\r\n const status = response.status;\r\n const responseBlob =\r\n response instanceof HttpResponse ? response.body :\r\n (response as any).error instanceof Blob ? (response as any).error : undefined;\r\n\r\n let _headers: any = {}; if (response.headers) { for (let key of response.headers.keys()) { _headers[key] = response.headers.get(key); }}\r\n if (status === 200) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n return _observableOf(null as any);\r\n }));\r\n } else if (status !== 200 && status !== 204) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }));\r\n }\r\n return _observableOf(null as any);\r\n }\r\n\r\n /**\r\n * @return Success\r\n */\r\n canClearAllCaches(): Observable {\r\n let url_ = this.baseUrl + \"/api/services/app/Caching/CanClearAllCaches\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ : any = {\r\n observe: \"response\",\r\n responseType: \"blob\",\r\n headers: new HttpHeaders({\r\n \"Accept\": \"text/plain\"\r\n })\r\n };\r\n\r\n return this.http.request(\"post\", url_, options_).pipe(_observableMergeMap((response_ : any) => {\r\n return this.processCanClearAllCaches(response_);\r\n })).pipe(_observableCatch((response_: any) => {\r\n if (response_ instanceof HttpResponseBase) {\r\n try {\r\n return this.processCanClearAllCaches(response_ as any);\r\n } catch (e) {\r\n return _observableThrow(e) as any as Observable;\r\n }\r\n } else\r\n return _observableThrow(response_) as any as Observable;\r\n }));\r\n }\r\n\r\n protected processCanClearAllCaches(response: HttpResponseBase): Observable {\r\n const status = response.status;\r\n const responseBlob =\r\n response instanceof HttpResponse ? response.body :\r\n (response as any).error instanceof Blob ? (response as any).error : undefined;\r\n\r\n let _headers: any = {}; if (response.headers) { for (let key of response.headers.keys()) { _headers[key] = response.headers.get(key); }}\r\n if (status === 200) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n let result200: any = null;\r\n let resultData200 = _responseText === \"\" ? null : JSON.parse(_responseText, this.jsonParseReviver);\r\n result200 = resultData200 !== undefined ? resultData200 : null;\r\n \r\n return _observableOf(result200);\r\n }));\r\n } else if (status !== 200 && status !== 204) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }));\r\n }\r\n return _observableOf(null as any);\r\n }\r\n}\r\n\r\n@Injectable()\r\nexport class ChatServiceProxy {\r\n private http: HttpClient;\r\n private baseUrl: string;\r\n protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;\r\n\r\n constructor(@Inject(HttpClient) http: HttpClient, @Optional() @Inject(API_BASE_URL) baseUrl?: string) {\r\n this.http = http;\r\n this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : \"\";\r\n }\r\n\r\n /**\r\n * @return Success\r\n */\r\n getUserChatFriendsWithSettings(): Observable {\r\n let url_ = this.baseUrl + \"/api/services/app/Chat/GetUserChatFriendsWithSettings\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ : any = {\r\n observe: \"response\",\r\n responseType: \"blob\",\r\n headers: new HttpHeaders({\r\n \"Accept\": \"text/plain\"\r\n })\r\n };\r\n\r\n return this.http.request(\"get\", url_, options_).pipe(_observableMergeMap((response_ : any) => {\r\n return this.processGetUserChatFriendsWithSettings(response_);\r\n })).pipe(_observableCatch((response_: any) => {\r\n if (response_ instanceof HttpResponseBase) {\r\n try {\r\n return this.processGetUserChatFriendsWithSettings(response_ as any);\r\n } catch (e) {\r\n return _observableThrow(e) as any as Observable;\r\n }\r\n } else\r\n return _observableThrow(response_) as any as Observable;\r\n }));\r\n }\r\n\r\n protected processGetUserChatFriendsWithSettings(response: HttpResponseBase): Observable {\r\n const status = response.status;\r\n const responseBlob =\r\n response instanceof HttpResponse ? response.body :\r\n (response as any).error instanceof Blob ? (response as any).error : undefined;\r\n\r\n let _headers: any = {}; if (response.headers) { for (let key of response.headers.keys()) { _headers[key] = response.headers.get(key); }}\r\n if (status === 200) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n let result200: any = null;\r\n let resultData200 = _responseText === \"\" ? null : JSON.parse(_responseText, this.jsonParseReviver);\r\n result200 = GetUserChatFriendsWithSettingsOutput.fromJS(resultData200);\r\n return _observableOf(result200);\r\n }));\r\n } else if (status !== 200 && status !== 204) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }));\r\n }\r\n return _observableOf(null as any);\r\n }\r\n\r\n /**\r\n * @param tenantId (optional) \r\n * @param userId (optional) \r\n * @param minMessageId (optional) \r\n * @param maxResultCount (optional) \r\n * @return Success\r\n */\r\n getUserChatMessages(tenantId: number | undefined, userId: number | undefined, minMessageId: number | undefined, maxResultCount: number | undefined): Observable {\r\n let url_ = this.baseUrl + \"/api/services/app/Chat/GetUserChatMessages?\";\r\n if (tenantId === null)\r\n throw new Error(\"The parameter 'tenantId' cannot be null.\");\r\n else if (tenantId !== undefined)\r\n url_ += \"TenantId=\" + encodeURIComponent(\"\" + tenantId) + \"&\";\r\n if (userId === null)\r\n throw new Error(\"The parameter 'userId' cannot be null.\");\r\n else if (userId !== undefined)\r\n url_ += \"UserId=\" + encodeURIComponent(\"\" + userId) + \"&\";\r\n if (minMessageId === null)\r\n throw new Error(\"The parameter 'minMessageId' cannot be null.\");\r\n else if (minMessageId !== undefined)\r\n url_ += \"MinMessageId=\" + encodeURIComponent(\"\" + minMessageId) + \"&\";\r\n if (maxResultCount === null)\r\n throw new Error(\"The parameter 'maxResultCount' cannot be null.\");\r\n else if (maxResultCount !== undefined)\r\n url_ += \"MaxResultCount=\" + encodeURIComponent(\"\" + maxResultCount) + \"&\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ : any = {\r\n observe: \"response\",\r\n responseType: \"blob\",\r\n headers: new HttpHeaders({\r\n \"Accept\": \"text/plain\"\r\n })\r\n };\r\n\r\n return this.http.request(\"get\", url_, options_).pipe(_observableMergeMap((response_ : any) => {\r\n return this.processGetUserChatMessages(response_);\r\n })).pipe(_observableCatch((response_: any) => {\r\n if (response_ instanceof HttpResponseBase) {\r\n try {\r\n return this.processGetUserChatMessages(response_ as any);\r\n } catch (e) {\r\n return _observableThrow(e) as any as Observable;\r\n }\r\n } else\r\n return _observableThrow(response_) as any as Observable;\r\n }));\r\n }\r\n\r\n protected processGetUserChatMessages(response: HttpResponseBase): Observable {\r\n const status = response.status;\r\n const responseBlob =\r\n response instanceof HttpResponse ? response.body :\r\n (response as any).error instanceof Blob ? (response as any).error : undefined;\r\n\r\n let _headers: any = {}; if (response.headers) { for (let key of response.headers.keys()) { _headers[key] = response.headers.get(key); }}\r\n if (status === 200) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n let result200: any = null;\r\n let resultData200 = _responseText === \"\" ? null : JSON.parse(_responseText, this.jsonParseReviver);\r\n result200 = ListResultDtoOfChatMessageDto.fromJS(resultData200);\r\n return _observableOf(result200);\r\n }));\r\n } else if (status !== 200 && status !== 204) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }));\r\n }\r\n return _observableOf(null as any);\r\n }\r\n\r\n /**\r\n * @param body (optional) \r\n * @return Success\r\n */\r\n markAllUnreadMessagesOfUserAsRead(body: MarkAllUnreadMessagesOfUserAsReadInput | undefined): Observable {\r\n let url_ = this.baseUrl + \"/api/services/app/Chat/MarkAllUnreadMessagesOfUserAsRead\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n const content_ = JSON.stringify(body);\r\n\r\n let options_ : any = {\r\n body: content_,\r\n observe: \"response\",\r\n responseType: \"blob\",\r\n headers: new HttpHeaders({\r\n \"Content-Type\": \"application/json\",\r\n })\r\n };\r\n\r\n return this.http.request(\"post\", url_, options_).pipe(_observableMergeMap((response_ : any) => {\r\n return this.processMarkAllUnreadMessagesOfUserAsRead(response_);\r\n })).pipe(_observableCatch((response_: any) => {\r\n if (response_ instanceof HttpResponseBase) {\r\n try {\r\n return this.processMarkAllUnreadMessagesOfUserAsRead(response_ as any);\r\n } catch (e) {\r\n return _observableThrow(e) as any as Observable;\r\n }\r\n } else\r\n return _observableThrow(response_) as any as Observable;\r\n }));\r\n }\r\n\r\n protected processMarkAllUnreadMessagesOfUserAsRead(response: HttpResponseBase): Observable {\r\n const status = response.status;\r\n const responseBlob =\r\n response instanceof HttpResponse ? response.body :\r\n (response as any).error instanceof Blob ? (response as any).error : undefined;\r\n\r\n let _headers: any = {}; if (response.headers) { for (let key of response.headers.keys()) { _headers[key] = response.headers.get(key); }}\r\n if (status === 200) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n return _observableOf(null as any);\r\n }));\r\n } else if (status !== 200 && status !== 204) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }));\r\n }\r\n return _observableOf(null as any);\r\n }\r\n}\r\n\r\n@Injectable()\r\nexport class CommonLookupServiceProxy {\r\n private http: HttpClient;\r\n private baseUrl: string;\r\n protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;\r\n\r\n constructor(@Inject(HttpClient) http: HttpClient, @Optional() @Inject(API_BASE_URL) baseUrl?: string) {\r\n this.http = http;\r\n this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : \"\";\r\n }\r\n\r\n /**\r\n * @param onlyFreeItems (optional) \r\n * @return Success\r\n */\r\n getEditionsForCombobox(onlyFreeItems: boolean | undefined): Observable {\r\n let url_ = this.baseUrl + \"/api/services/app/CommonLookup/GetEditionsForCombobox?\";\r\n if (onlyFreeItems === null)\r\n throw new Error(\"The parameter 'onlyFreeItems' cannot be null.\");\r\n else if (onlyFreeItems !== undefined)\r\n url_ += \"onlyFreeItems=\" + encodeURIComponent(\"\" + onlyFreeItems) + \"&\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ : any = {\r\n observe: \"response\",\r\n responseType: \"blob\",\r\n headers: new HttpHeaders({\r\n \"Accept\": \"text/plain\"\r\n })\r\n };\r\n\r\n return this.http.request(\"get\", url_, options_).pipe(_observableMergeMap((response_ : any) => {\r\n return this.processGetEditionsForCombobox(response_);\r\n })).pipe(_observableCatch((response_: any) => {\r\n if (response_ instanceof HttpResponseBase) {\r\n try {\r\n return this.processGetEditionsForCombobox(response_ as any);\r\n } catch (e) {\r\n return _observableThrow(e) as any as Observable;\r\n }\r\n } else\r\n return _observableThrow(response_) as any as Observable;\r\n }));\r\n }\r\n\r\n protected processGetEditionsForCombobox(response: HttpResponseBase): Observable {\r\n const status = response.status;\r\n const responseBlob =\r\n response instanceof HttpResponse ? response.body :\r\n (response as any).error instanceof Blob ? (response as any).error : undefined;\r\n\r\n let _headers: any = {}; if (response.headers) { for (let key of response.headers.keys()) { _headers[key] = response.headers.get(key); }}\r\n if (status === 200) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n let result200: any = null;\r\n let resultData200 = _responseText === \"\" ? null : JSON.parse(_responseText, this.jsonParseReviver);\r\n result200 = ListResultDtoOfSubscribableEditionComboboxItemDto.fromJS(resultData200);\r\n return _observableOf(result200);\r\n }));\r\n } else if (status !== 200 && status !== 204) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }));\r\n }\r\n return _observableOf(null as any);\r\n }\r\n\r\n /**\r\n * @param body (optional) \r\n * @return Success\r\n */\r\n findUsers(body: FindUsersInput | undefined): Observable {\r\n let url_ = this.baseUrl + \"/api/services/app/CommonLookup/FindUsers\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n const content_ = JSON.stringify(body);\r\n\r\n let options_ : any = {\r\n body: content_,\r\n observe: \"response\",\r\n responseType: \"blob\",\r\n headers: new HttpHeaders({\r\n \"Content-Type\": \"application/json\",\r\n \"Accept\": \"text/plain\"\r\n })\r\n };\r\n\r\n return this.http.request(\"post\", url_, options_).pipe(_observableMergeMap((response_ : any) => {\r\n return this.processFindUsers(response_);\r\n })).pipe(_observableCatch((response_: any) => {\r\n if (response_ instanceof HttpResponseBase) {\r\n try {\r\n return this.processFindUsers(response_ as any);\r\n } catch (e) {\r\n return _observableThrow(e) as any as Observable;\r\n }\r\n } else\r\n return _observableThrow(response_) as any as Observable;\r\n }));\r\n }\r\n\r\n protected processFindUsers(response: HttpResponseBase): Observable {\r\n const status = response.status;\r\n const responseBlob =\r\n response instanceof HttpResponse ? response.body :\r\n (response as any).error instanceof Blob ? (response as any).error : undefined;\r\n\r\n let _headers: any = {}; if (response.headers) { for (let key of response.headers.keys()) { _headers[key] = response.headers.get(key); }}\r\n if (status === 200) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n let result200: any = null;\r\n let resultData200 = _responseText === \"\" ? null : JSON.parse(_responseText, this.jsonParseReviver);\r\n result200 = PagedResultDtoOfFindUsersOutputDto.fromJS(resultData200);\r\n return _observableOf(result200);\r\n }));\r\n } else if (status !== 200 && status !== 204) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }));\r\n }\r\n return _observableOf(null as any);\r\n }\r\n\r\n /**\r\n * @return Success\r\n */\r\n getDefaultEditionName(): Observable {\r\n let url_ = this.baseUrl + \"/api/services/app/CommonLookup/GetDefaultEditionName\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ : any = {\r\n observe: \"response\",\r\n responseType: \"blob\",\r\n headers: new HttpHeaders({\r\n \"Accept\": \"text/plain\"\r\n })\r\n };\r\n\r\n return this.http.request(\"get\", url_, options_).pipe(_observableMergeMap((response_ : any) => {\r\n return this.processGetDefaultEditionName(response_);\r\n })).pipe(_observableCatch((response_: any) => {\r\n if (response_ instanceof HttpResponseBase) {\r\n try {\r\n return this.processGetDefaultEditionName(response_ as any);\r\n } catch (e) {\r\n return _observableThrow(e) as any as Observable;\r\n }\r\n } else\r\n return _observableThrow(response_) as any as Observable;\r\n }));\r\n }\r\n\r\n protected processGetDefaultEditionName(response: HttpResponseBase): Observable {\r\n const status = response.status;\r\n const responseBlob =\r\n response instanceof HttpResponse ? response.body :\r\n (response as any).error instanceof Blob ? (response as any).error : undefined;\r\n\r\n let _headers: any = {}; if (response.headers) { for (let key of response.headers.keys()) { _headers[key] = response.headers.get(key); }}\r\n if (status === 200) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n let result200: any = null;\r\n let resultData200 = _responseText === \"\" ? null : JSON.parse(_responseText, this.jsonParseReviver);\r\n result200 = GetDefaultEditionNameOutput.fromJS(resultData200);\r\n return _observableOf(result200);\r\n }));\r\n } else if (status !== 200 && status !== 204) {\r\n return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }));\r\n }\r\n return _observableOf(null as any);\r\n }\r\n}\r\n\r\n@Injectable()\r\nexport class DashboardCustomizationServiceProxy {\r\n private http: HttpClient;\r\n private baseUrl: string;\r\n protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;\r\n\r\n constructor(@Inject(HttpClient) http: HttpClient, @Optional() @Inject(API_BASE_URL) baseUrl?: string) {\r\n this.http = http;\r\n this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : \"\";\r\n }\r\n\r\n /**\r\n * @param dashboardName (optional) \r\n * @param application (optional) \r\n * @return Success\r\n */\r\n getUserDashboard(dashboardName: string | undefined, application: string | undefined): Observable {\r\n let url_ = this.baseUrl + \"/api/services/app/DashboardCustomization/GetUserDashboard?\";\r\n if (dashboardName === null)\r\n throw new Error(\"The parameter 'dashboardName' cannot be null.\");\r\n else if (dashboardName !== undefined)\r\n url_ += \"DashboardName=\" + encodeURIComponent(\"\" + dashboardName) + \"&\";\r\n if (application === null)\r\n throw new Error(\"The parameter 'application' cannot be null.\");\r\n else if (application !== undefined)\r\n url_ += \"Application=\" + encodeURIComponent(\"\" + application) + \"&\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ : any = {\r\n observe: \"response\",\r\n responseType: \"blob\",\r\n headers: new HttpHeaders({\r\n \"Accept\": \"text/plain\"\r\n })\r\n };\r\n\r\n return this.http.request(\"get\", url_, options_).pipe(_observableMergeMap((response_ : any) => {\r\n return this.processGetUserDashboard(response_);\r\n })).pipe(_observableCatch((response_: any) => {\r\n if (response_ instanceof HttpResponseBase) {\r\n try {\r\n return this.processGetUserDashboard(response_ as any);\r\n } catch (e) {\r\n return _observableThrow(e) as any as Observable