{"version":3,"file":"Toast.modern.mjs","sources":["../node_modules/lestin/jsx-runtime/dist/jsx-runtime.mjs","../src/Toast.tsx"],"sourcesContent":["const namespaces = {\n  svg: \"http://www.w3.org/2000/svg\",\n  html: \"http://www.w3.org/1999/xhtml\",\n  xml: \"http://www.w3.org/XML/1998/namespace\",\n  xlink: \"http://www.w3.org/1999/xlink\",\n  xmlns: \"http://www.w3.org/2000/xmlns/\",\n  mathMl: \"http://www.w3.org/1998/Math/MathML\"\n};\n\nconst svgElements = [\n  // \"a\",\n  \"animate\",\n  \"animateMotion\",\n  \"animateTransform\",\n  \"circle\",\n  \"clipPath\",\n  \"defs\",\n  \"desc\",\n  \"discard\",\n  \"ellipse\",\n  // \"feBlend\",\n  // \"feColorMatrix\",\n  // \"feComponentTransfer\",\n  // \"feComposite\",\n  // \"feConvolveMatrix\",\n  // \"feDiffuseLighting\",\n  // \"feDisplacementMap\",\n  // \"feDistantLight\",\n  // \"feDropShadow\",\n  // \"feFlood\",\n  // \"feFuncA\",\n  // \"feFuncB\",\n  // \"feFuncG\",\n  // \"feFuncR\",\n  // \"feGaussianBlur\",\n  // \"feImage\",\n  // \"feMerge\",\n  // \"feMergeNode\",\n  // \"feMorphology\",\n  // \"feOffset\",\n  // \"fePointLight\",\n  // \"feSpecularLighting\",\n  // \"feSpotLight\",\n  // \"feTile\",\n  // \"feTurbulence\",\n  \"filter\",\n  \"foreignObject\",\n  \"g\",\n  \"image\",\n  \"line\",\n  \"linearGradient\",\n  \"marker\",\n  \"mask\",\n  \"metadata\",\n  \"mpath\",\n  \"path\",\n  \"pattern\",\n  \"polygon\",\n  \"polyline\",\n  \"radialGradient\",\n  \"rect\",\n  // \"script\",\n  \"set\",\n  \"stop\",\n  // \"style\",\n  \"svg\",\n  \"switch\",\n  \"symbol\",\n  \"text\",\n  \"textPath\",\n  // \"title\",\n  \"tspan\",\n  \"use\",\n  \"view\"\n];\n\nfunction CreateElement(type, props = {}) {\n  let { children, ...attrs } = props;\n  if (!Array.isArray(children)) {\n    children = [children];\n  }\n  let childrenLength = children.length;\n  for (let i = 0; i < childrenLength; i++) {\n    const child = children[i];\n    if (!(Boolean(child) && !(Array.isArray(child) && !child.length) || child === 0)) {\n      children.splice(i, 1);\n    }\n  }\n  childrenLength = children.length;\n  props.children = children;\n  if (typeof type === \"function\") {\n    return type(props);\n  }\n  if (svgElements.includes(type)) {\n    attrs.xmlns = namespaces.svg;\n  }\n  let element;\n  if (attrs.xmlns) {\n    element = document.createElementNS(attrs.xmlns, type);\n  } else {\n    element = document.createElement(type);\n  }\n  for (const propName in attrs) {\n    if (!Object.hasOwn(attrs, propName)) {\n      continue;\n    }\n    let propValue = attrs[propName];\n    if (!propName || !propValue && typeof propValue !== \"number\" && propValue !== \"\") {\n      continue;\n    }\n    if (propName === \"__source\" || propName === \"__self\" || propName === \"tsxTag\") {\n      continue;\n    }\n    if (propName == \"class\" || propName == \"className\") {\n      let className = \"\";\n      if (Array.isArray(propValue)) {\n        propValue = propValue.flat(5);\n        const arrayLength = propValue.length;\n        for (let i = 0; i < arrayLength; i++) {\n          if (propValue[i]) {\n            className += (className ? \" \" : \"\") + propValue[i].trim();\n          }\n        }\n        propValue = className;\n      }\n      element.className = propValue;\n    } else if (propName.startsWith(\"on\")) {\n      const finalName = propName.replace(/Capture$/, \"\");\n      const useCapture = propName !== finalName;\n      let eventName = finalName.toLowerCase().substring(2);\n      if (eventName === \"doubleclick\") {\n        eventName = \"dblclick\";\n      }\n      if (!Array.isArray(propValue)) {\n        propValue = [propValue];\n      }\n      const arrayLength = propValue.length;\n      for (let i = 0; i < arrayLength; i++) {\n        if (eventName && propValue[i]) {\n          element.addEventListener(eventName, propValue[i], useCapture);\n        }\n      }\n    } else if (propName === \"style\") {\n      if (typeof propValue === \"string\") {\n        element.style.cssText = propValue;\n      } else {\n        Object.assign(element.style, propValue);\n      }\n    } else if (propName === \"dataset\") {\n      Object.assign(element.dataset, propValue);\n    } else if (propName == \"htmlFor\" || propName == \"for\") {\n      element.htmlFor = propValue;\n    } else if ([\"innerHTML\", \"innerText\", \"textContent\"].includes(propName)) {\n      element[propName] = propValue;\n    } else if (propName === \"ref\") {\n      propValue.current = element;\n    } else if (propName === \"assign\" && typeof propValue === \"function\") {\n      propValue(element);\n    } else if (propName === \"xmlns\") {\n      element.setAttributeNS(namespaces.xmlns, propName, propValue.toString());\n    } else {\n      if (propValue === true) {\n        propValue = propName;\n      }\n      element.setAttribute(propName, propValue.toString());\n    }\n  }\n  for (let i = 0; i < childrenLength; i++) {\n    const child = children[i];\n    AppendChild(element, child);\n  }\n  return element;\n}\nconst Fragment = (props) => props.children;\nfunction AppendChild(parent, childOrText) {\n  if (Array.isArray(childOrText)) {\n    const childOrTextArrayLength = childOrText.length;\n    for (let i = 0; i < childOrTextArrayLength; i++) {\n      const nestedChild = childOrText[i];\n      AppendChild(parent, nestedChild);\n    }\n  } else {\n    const isElement = childOrText instanceof Element;\n    parent.appendChild(isElement ? childOrText : document.createTextNode(childOrText));\n  }\n}\nconst createRef = (initialValue) => ({ current: initialValue });\n\nexport { AppendChild, CreateElement, Fragment, createRef, CreateElement as jsx, CreateElement as jsxDEV, CreateElement as jsxs };\n//# sourceMappingURL=jsx-runtime.mjs.map\n","import type Lestin from \"lestin\";\r\n\r\n/**\r\n * An enumeration of the different types of toasts that can be created.\r\n */\r\nexport enum ToastType {\r\n\t/**\r\n\t * A toast indicating a successful operation.\r\n\t */\r\n\tSuccessful = \"Success\",\r\n\r\n\t/**\r\n\t * A toast indicating an error.\r\n\t */\r\n\tError = \"Error\",\r\n\r\n\t/**\r\n\t * A toast providing information.\r\n\t */\r\n\tInfo = \"Info\",\r\n}\r\n\r\n/**\r\n * An object containing data for each type of toast.\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const ToastTypeData: {\r\n\t[name in keyof typeof ToastType]: {\r\n\t\tclassname: string;\r\n\t\ttext: string;\r\n\t\tcolor: string;\r\n\t};\r\n} = {\r\n\t/**\r\n\t * Data for a successful toast.\r\n\t */\r\n\t// eslint-disable-next-line @typescript-eslint/naming-convention\r\n\tSuccessful: {\r\n\t\tclassname: \"Success\",\r\n\t\ttext: \"Operation successful\",\r\n\t\tcolor: \"#47B35F\",\r\n\t},\r\n\r\n\t/**\r\n\t * Data for an error toast.\r\n\t */\r\n\t// eslint-disable-next-line @typescript-eslint/naming-convention\r\n\tError: {\r\n\t\tclassname: \"Error\",\r\n\t\ttext: \"An error occurred\",\r\n\t\tcolor: \"#47B35F\",\r\n\t},\r\n\r\n\t/**\r\n\t * Data for an informational toast.\r\n\t */\r\n\t// eslint-disable-next-line @typescript-eslint/naming-convention\r\n\tInfo: {\r\n\t\tclassname: \"Info\",\r\n\t\ttext: \"Processing...\",\r\n\t\tcolor: \"#47B35F\",\r\n\t},\r\n};\r\n\r\n/**\r\n * An interface representing the properties that can be passed to a Toast instance to customize its appearance and behavior.\r\n */\r\nexport interface IToast_Props {\r\n\t/**\r\n\t * How long to wait before automatically dismissing the toast (in milliseconds).\r\n\t */\r\n\tduration?: number;\r\n\r\n\t/**\r\n\t * The background color of the toast.\r\n\t */\r\n\tbackColor?: string;\r\n\r\n\t/**\r\n\t * The title to display in the toast.\r\n\t */\r\n\ttitle?: string;\r\n\r\n\t/**\r\n\t * Whether the toast should be pinned or not.\r\n\t */\r\n\tisPinned?: boolean;\r\n\r\n\t/**\r\n\t * Whether to hide the pin button or not.\r\n\t */\r\n\tnoPin?: boolean;\r\n\r\n\t/**\r\n\t * Whether to hide the dismiss button or not.\r\n\t */\r\n\tnoDismiss?: boolean;\r\n\r\n\t/**\r\n\t * The text alignment of the toast text.\r\n\t */\r\n\ttextAlign?: \"start\" | \"end\" | \"center\";\r\n\r\n\t/**\r\n\t * The font size of the toast text.\r\n\t */\r\n\ttextSize?: string;\r\n\r\n\t/**\r\n\t * The font weight of the toast text.\r\n\t */\r\n\ttextWeight?: string;\r\n\r\n\t/**\r\n\t * The text alignment of the toast title.\r\n\t */\r\n\ttitleAlign?: \"start\" | \"end\" | \"center\";\r\n\r\n\t/**\r\n\t * The font size of the toast title.\r\n\t */\r\n\ttitleSize?: string;\r\n\r\n\t/**\r\n\t * The font weight of the toast title.\r\n\t */\r\n\ttitleWeight?: string;\r\n\r\n\t/**\r\n\t * An array of buttons to display in the toast.\r\n\t */\r\n\tbuttons?: IToastButton_Props[];\r\n\r\n\t/**\r\n\t * Indicates whether the component should display a loader.\r\n\t */\r\n\thasLoader?: boolean;\r\n\r\n\t/**\r\n\t * Specifies whether only a loader should be displayed.\r\n\t */\r\n\tonlyLoader?: boolean;\r\n}\r\n\r\n/**\r\n * Default properties for a Toast instance.\r\n */\r\nconst toast_DefaultProps: IToast_Props = {\r\n\tduration: 5000,\r\n\thasLoader: false,\r\n};\r\n\r\n/**\r\n * An interface representing the properties of a button in a toast.\r\n */\r\ninterface IToastButton_Props {\r\n\t/**\r\n\t * The text to display on the button.\r\n\t */\r\n\ttext: string;\r\n\r\n\t/**\r\n\t * The CSS class to apply to the button.\r\n\t */\r\n\tstyle?: string;\r\n\r\n\t/**\r\n\t * The function to call when the button is clicked.\r\n\t */\r\n\tonClick: Lestin.MouseEventHandler<HTMLButtonElement>;\r\n}\r\n\r\n/**\r\n * A class representing a toast notification.\r\n */\r\nexport class Toast {\r\n\t/**\r\n\t * The HTML element representing the toast.\r\n\t */\r\n\tpublic readonly toastElement: HTMLElement;\r\n\r\n\t/**\r\n\t * The current percentage of the progress bar.\r\n\t */\r\n\tpublic currentPercent: number | null = null;\r\n\t#toastInterval: number | null | any = null;\r\n\t#toastTextElement: HTMLElement | null = null;\r\n\t#toastProgressBarValueElement: HTMLElement | null = null;\r\n\t#toastActionPinElement: HTMLElement | null = null;\r\n\t#toastInitialOptions = null;\r\n\r\n\t#isPinned: boolean = false;\r\n\t/**\r\n\t * Whether the toast is pinned or not.\r\n\t */\r\n\tget isPinned(): boolean {\r\n\t\treturn this.#isPinned;\r\n\t}\r\n\r\n\t/**\r\n\t * Creates a new Toast instance.\r\n\t *\r\n\t * @param {ToastType} [toastType=ToastType.Info] - The type of toast to create.\r\n\t * @param {string} [toastText=\"\"] - The text to display in the toast.\r\n\t * @param {IToast_Props} [options={}] - An object containing options for customizing the appearance and behavior of the toast.\r\n\t */\r\n\tconstructor(toastType: ToastType = ToastType.Info, toastText: string = \"\", options: IToast_Props = {}) {\r\n\t\tthis.toastElement = <div class=\"Toast\"></div>;\r\n\t\treturn this.BuildToast(toastType, toastText, options);\r\n\t}\r\n\r\n\tpublic BuildToast(toastType: ToastType = ToastType.Info, toastText: string = \"\", options: IToast_Props = {}) {\r\n\t\toptions = { ...toast_DefaultProps, ...options };\r\n\r\n\t\tlet toastTypeSpecs = ToastTypeData.Info;\r\n\t\tif (toastType == ToastType.Successful) toastTypeSpecs = ToastTypeData.Successful;\r\n\t\telse if (toastType == ToastType.Error) toastTypeSpecs = ToastTypeData.Error;\r\n\r\n\t\tif (toastText == null) toastText = toastTypeSpecs.text;\r\n\r\n\t\tthis.#isPinned = options.isPinned || options.duration === -1;\r\n\r\n\t\tconst hasActionBox = !((options.noPin || options.isPinned) && options.noDismiss);\r\n\t\tconst isUserPinable = !(options.noPin || this.#isPinned);\r\n\t\tconst isUserDismissable = !options.noDismiss;\r\n\r\n\t\tthis.#toastInitialOptions = options;\r\n\r\n\t\tthis.#toastTextElement = <></>;\r\n\t\tif (toastText) {\r\n\t\t\tthis.#toastTextElement = (\r\n\t\t\t\t<p\r\n\t\t\t\t\tclass=\"Toast-Text\"\r\n\t\t\t\t\tstyle={{\r\n\t\t\t\t\t\t...(options.textAlign ? { textAlign: options.textAlign } : {}),\r\n\t\t\t\t\t\t...(options.textSize ? { fontSize: options.textSize } : {}),\r\n\t\t\t\t\t\t...(options.textWeight ? { fontWeight: options.textWeight } : {}),\r\n\t\t\t\t\t}}\r\n\t\t\t\t>\r\n\t\t\t\t\t{toastText}\r\n\t\t\t\t</p>\r\n\t\t\t);\r\n\t\t}\r\n\t\tthis.#toastProgressBarValueElement = <div class=\"Toast-ProgressBar-Value\"></div>;\r\n\r\n\t\tif (isUserPinable)\r\n\t\t\tthis.#toastActionPinElement = (\r\n\t\t\t\t<button class=\"Toast-Action Pin\" onClick={() => this.Pin()}>\r\n\t\t\t\t\t<i class=\"fas fa-thumbtack\"></i>\r\n\t\t\t\t</button>\r\n\t\t\t);\r\n\r\n\t\tthis.toastElement.innerHTML = \"\";\r\n\t\t// this.toastElement.className = \"Toast \" + toastTypeSpecs.classname;\r\n\t\tthis.SetToastType(toastType);\r\n\r\n\t\tif (hasActionBox) {\r\n\t\t\tthis.toastElement.append(\r\n\t\t\t\t<div class=\"Toast-ActionBox\">\r\n\t\t\t\t\t{isUserPinable && this.#toastActionPinElement}\r\n\t\t\t\t\t{isUserDismissable && (\r\n\t\t\t\t\t\t<button class={\"Toast-Action Dismiss\"} onClick={() => this.Dismiss()}>\r\n\t\t\t\t\t\t\t<i class=\"fas fa-times\"></i>\r\n\t\t\t\t\t\t</button>\r\n\t\t\t\t\t)}\r\n\t\t\t\t</div>,\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\tconst hasContent = (options.title || toastText || options.buttons) && !options.onlyLoader;\r\n\t\tconst isLoaderOnly = options.onlyLoader || (options.hasLoader && !hasContent);\r\n\r\n\t\tlet loaderElement: HTMLElement;\r\n\r\n\t\tif (options.hasLoader) {\r\n\t\t\tloaderElement = (\r\n\t\t\t\t<div class=\"Toast-LoaderBox\">\r\n\t\t\t\t\t<div class=\"Toast-Loader\"></div>\r\n\t\t\t\t</div>\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\tconst toastBodyClass = isLoaderOnly ? \"Toast-Body Toast-LoaderOnly\" : \"Toast-Body\";\r\n\r\n\t\tthis.toastElement.append(\r\n\t\t\t<div class={toastBodyClass}>\r\n\t\t\t\t{loaderElement}\r\n\t\t\t\t{hasContent && (\r\n\t\t\t\t\t<div class=\"Toast-Content\">\r\n\t\t\t\t\t\t{options.title && (\r\n\t\t\t\t\t\t\t<h5\r\n\t\t\t\t\t\t\t\tclass=\"Toast-Title\"\r\n\t\t\t\t\t\t\t\tstyle={{\r\n\t\t\t\t\t\t\t\t\t...(options.titleAlign ? { textAlign: options.titleAlign } : {}),\r\n\t\t\t\t\t\t\t\t\t...(options.titleSize ? { fontSize: options.titleSize } : {}),\r\n\t\t\t\t\t\t\t\t\t...(options.titleWeight ? { fontWeight: options.titleWeight } : {}),\r\n\t\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t\t>\r\n\t\t\t\t\t\t\t\t{options.title}\r\n\t\t\t\t\t\t\t</h5>\r\n\t\t\t\t\t\t)}\r\n\r\n\t\t\t\t\t\t{this.#toastTextElement}\r\n\t\t\t\t\t\t{options.buttons && (\r\n\t\t\t\t\t\t\t<div class=\"Toast-ButtonBox\">\r\n\t\t\t\t\t\t\t\t{options.buttons?.map((i) => (\r\n\t\t\t\t\t\t\t\t\t<button class={\"Toast-Button \" + i.style} onClick={i.onClick}>\r\n\t\t\t\t\t\t\t\t\t\t{i.text}\r\n\t\t\t\t\t\t\t\t\t</button>\r\n\t\t\t\t\t\t\t\t))}\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t)}\r\n\t\t\t\t\t</div>\r\n\t\t\t\t)}\r\n\t\t\t\t<div class=\"Toast-ProgressBar\">{this.#toastProgressBarValueElement}</div>\r\n\t\t\t</div>,\r\n\t\t);\r\n\r\n\t\tif (!this.#isPinned) {\r\n\t\t\tthis.SetInterval(options.duration);\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\t}\r\n\r\n\tBuildSuccessToast(toastText: string = \"\", options: IToast_Props = {}): Toast {\r\n\t\treturn this.BuildToast(ToastType.Successful, toastText, options);\r\n\t}\r\n\r\n\tBuildErrorToast(toastText: string = \"\", options: IToast_Props = {}): Toast {\r\n\t\treturn this.BuildToast(ToastType.Error, toastText, options);\r\n\t}\r\n\r\n\tBuildInfoToast(toastText: string = \"\", options: IToast_Props = {}): Toast {\r\n\t\treturn this.BuildToast(ToastType.Info, toastText, options);\r\n\t}\r\n\r\n\tBuildLoaderToast(toastText: string = \"\", options: IToast_Props = {}): Toast {\r\n\t\treturn this.BuildToast(ToastType.Info, toastText, { hasLoader: true, isPinned: true, noDismiss: true, ...options });\r\n\t}\r\n\r\n\t/**\r\n\t * Pins the toast so that it does not automatically dismiss.\r\n\t *\r\n\t * @param {number} [percent=0] - The percentage of the progress bar to fill.\r\n\t * @returns {Toast} - The Toast instance.\r\n\t */\r\n\tPin(percent: number = 0): Toast {\r\n\t\tthis.#isPinned = true;\r\n\t\tif (this.#toastInterval) clearInterval(this.#toastInterval);\r\n\t\tif (this.#toastActionPinElement) this.#toastActionPinElement.remove();\r\n\t\tthis.#toastProgressBarValueElement.style.width = percent + \"%\";\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * Sets the text of the toast.\r\n\t *\r\n\t * @param {string} [text=\"\"] - The new text to display in the toast.\r\n\t * @returns {Toast} - The Toast instance.\r\n\t */\r\n\tSetText(text: string = \"\"): Toast {\r\n\t\tthis.#toastTextElement.textContent = text;\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * Dismisses the toast.\r\n\t *\r\n\t * @param {number} [timeMs=0] - How long to wait before dismissing the toast (in milliseconds).\r\n\t * @returns {number} - The ID of the timeout that was set.\r\n\t */\r\n\tDismiss(timeMs: number = 0): number | any {\r\n\t\tif (this.#toastInterval) clearInterval(this.#toastInterval);\r\n\t\treturn setTimeout(() => {\r\n\t\t\trequestAnimationFrame(() => {\r\n\t\t\t\tthis.toastElement.style.height = this.toastElement.scrollHeight + \"px\";\r\n\t\t\t\trequestAnimationFrame(() => {\r\n\t\t\t\t\tthis.toastElement.classList.add(\"Bye\");\r\n\t\t\t\t\tthis.toastElement.style.height = \"0\";\r\n\t\t\t\t\tthis.toastElement.style.margin = \"0\";\r\n\t\t\t\t\tsetTimeout(() => this.toastElement.remove(), 500);\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\t}, timeMs);\r\n\t}\r\n\r\n\t/**\r\n\t * Sets the percentage of the progress bar to fill.\r\n\t *\r\n\t * @param {number} [percentage=0] - The new percentage to fill the progress bar with.\r\n\t * @returns {Toast} - The Toast instance.\r\n\t */\r\n\tSetPercent(percentage: number = 0): Toast {\r\n\t\treturn this.Pin(percentage);\r\n\t}\r\n\r\n\t/**\r\n\t * Sets an interval for automatically dismissing the toast.\r\n\t *\r\n\t * @param {number} [durationMs=toast_DefaultProps.duration] - How long to wait before dismissing the toast (in milliseconds).\r\n\t * @param {number} [initialPercent=0] - The initial percentage of the progress bar to fill.\r\n\t * @returns {Toast} - The Toast instance.\r\n\t */\r\n\tSetInterval(durationMs: number = toast_DefaultProps.duration, initialPercent: number = 0): Toast {\r\n\t\tthis.#isPinned = false;\r\n\t\tif (this.#toastInterval) clearInterval(this.#toastInterval);\r\n\t\t// ToastProgressBar.style.display = \"block\";\r\n\t\tthis.currentPercent = initialPercent;\r\n\r\n\t\tthis.#toastInterval = setInterval(\r\n\t\t\t() => {\r\n\t\t\t\tif (this.currentPercent >= 100) {\r\n\t\t\t\t\tclearInterval(this.#toastInterval);\r\n\t\t\t\t\tthis.Dismiss();\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthis.currentPercent++;\r\n\t\t\t\t\tthis.#toastProgressBarValueElement.style.width = this.currentPercent + \"%\";\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t(durationMs - 200) / 100,\r\n\t\t);\r\n\r\n\t\tif (!this.#toastInitialOptions.NoPauseOnHover) {\r\n\t\t\tthis.toastElement.addEventListener(\"mouseenter\", () => clearInterval(this.#toastInterval));\r\n\t\t\tthis.toastElement.addEventListener(\"mouseleave\", () => {\r\n\t\t\t\tif (!this.#isPinned) {\r\n\t\t\t\t\tthis.SetInterval(durationMs, this.currentPercent);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t\treturn this;\r\n\t}\r\n\r\n\tSetGoing = this.SetInterval;\r\n\r\n\tSetToastType(toastType: ToastType): Toast {\r\n\t\tlet toastTypeSpecs = ToastTypeData.Info;\r\n\t\tif (toastType == ToastType.Successful) toastTypeSpecs = ToastTypeData.Successful;\r\n\t\telse if (toastType == ToastType.Error) toastTypeSpecs = ToastTypeData.Error;\r\n\r\n\t\tthis.toastElement.classList.remove(\"Info\", \"Success\", \"Error\");\r\n\t\tthis.toastElement.classList.add(toastTypeSpecs.classname);\r\n\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * Sets the inner HTML content of the toast element.\r\n\t *\r\n\t * @param {string} content - The new HTML content to set.\r\n\t */\r\n\tset innerHTML(content: string) {\r\n\t\tthis.toastElement.innerHTML = content;\r\n\t}\r\n}\r\n\r\n/**\r\n * A function component that returns a `ToastBox` element.\r\n *\r\n * @returns {HTMLDivElement} - A `ToastBox` element.\r\n */\r\nexport const ToastBox = (): HTMLDivElement => (<div id=\"ToastBox\"></div>) as HTMLDivElement;\r\n\r\n/**\r\n * Creates and displays a new toast notification.\r\n *\r\n * @param {ToastType} [toastType=ToastType.Info] - The type of toast to create.\r\n * @param {string} [toastText=\"\"] - The text to display in the toast.\r\n * @param {IToast_Props} [options={}] - An object containing options for customizing the appearance and behavior of the toast.\r\n * @returns {Toast} - The new Toast instance that was created.\r\n */\r\n// eslint-disable-next-line max-params\r\nexport function ShowToast(\r\n\ttoastType: ToastType = ToastType.Info,\r\n\ttoastText?: string,\r\n\toptions?: IToast_Props,\r\n\ttoastBoxParent: HTMLElement = document.body,\r\n): Toast {\r\n\tconst toast = new Toast(toastType, toastText, options);\r\n\r\n\tlet toastBox = document.getElementById(\"ToastBox\");\r\n\tif (toastBox === null) {\r\n\t\ttoastBox = <ToastBox />;\r\n\t\ttoastBoxParent.prepend(toastBox);\r\n\t}\r\n\r\n\ttoastBox.appendChild(toast.toastElement);\r\n\treturn toast;\r\n}\r\n\r\nexport function ShowSuccessToast(toastText?: string, options?: IToast_Props, toastBoxParent?: HTMLElement): Toast {\r\n\treturn ShowToast(ToastType.Successful, toastText, options, toastBoxParent);\r\n}\r\n\r\nexport function ShowErrorToast(toastText?: string, options?: IToast_Props, toastBoxParent?: HTMLElement): Toast {\r\n\treturn ShowToast(ToastType.Error, toastText, options, toastBoxParent);\r\n}\r\n\r\nexport function ShowInfoToast(toastText?: string, options?: IToast_Props, toastBoxParent?: HTMLElement): Toast {\r\n\treturn ShowToast(ToastType.Info, toastText, options, toastBoxParent);\r\n}\r\n\r\nexport function ShowLoaderToast(toastText?: string, options?: IToast_Props, toastBoxParent?: HTMLElement): Toast {\r\n\treturn ShowToast(\r\n\t\tToastType.Info,\r\n\t\ttoastText,\r\n\t\t{ hasLoader: true, isPinned: true, noDismiss: true, ...options },\r\n\t\ttoastBoxParent,\r\n\t);\r\n}\r\n"],"names":["namespaces","svg","html","xml","xlink","xmlns","mathMl","svgElements","CreateElement","type","props","children","attrs","Array","isArray","element","childrenLength","length","i","child","Boolean","splice","includes","document","createElementNS","createElement","propName","Object","hasOwn","propValue","className","flat","arrayLength","trim","startsWith","finalName","replace","useCapture","eventName","toLowerCase","substring","addEventListener","style","cssText","assign","dataset","htmlFor","current","setAttributeNS","toString","setAttribute","AppendChild","Fragment","parent","childOrText","childOrTextArrayLength","isElement","Element","appendChild","createTextNode","ToastType","ToastTypeData","Successful","classname","text","color","Error","Info","toast_DefaultProps","duration","hasLoader","_toastInterval","_classPrivateFieldLooseKey","_toastTextElement","_toastProgressBarValueElement","_toastActionPinElement","_toastInitialOptions","_isPinned","Toast","isPinned","_classPrivateFieldLooseBase","this","constructor","toastType","toastText","options","toastElement","currentPercent","defineProperty","writable","value","SetGoing","SetInterval","_jsx","class","BuildToast","_options$buttons","_extends","toastTypeSpecs","hasActionBox","noPin","noDismiss","isUserPinable","isUserDismissable","_Fragment","textAlign","textSize","fontSize","textWeight","fontWeight","onClick","Pin","innerHTML","SetToastType","append","_jsxs","Dismiss","hasContent","title","buttons","onlyLoader","isLoaderOnly","loaderElement","titleAlign","titleSize","titleWeight","map","BuildSuccessToast","BuildErrorToast","BuildInfoToast","BuildLoaderToast","percent","clearInterval","remove","width","SetText","textContent","timeMs","setTimeout","requestAnimationFrame","height","scrollHeight","classList","add","margin","SetPercent","percentage","durationMs","initialPercent","setInterval","NoPauseOnHover","content","ToastBox","id","ShowToast","toastBoxParent","body","toast","toastBox","getElementById","prepend","ShowSuccessToast","ShowErrorToast","ShowInfoToast","ShowLoaderToast"],"mappings":"oaAAA,MAAMA,EAAa,CACjBC,IAAK,6BACLC,KAAM,+BACNC,IAAK,uCACLC,MAAO,+BACPC,MAAO,gCACPC,OAAQ,sCAGJC,EAAc,CAElB,UACA,gBACA,mBACA,SACA,WACA,OACA,OACA,UACA,UA0BA,SACA,gBACA,IACA,QACA,OACA,iBACA,SACA,OACA,WACA,QACA,OACA,UACA,UACA,WACA,iBACA,OAEA,MACA,OAEA,MACA,SACA,SACA,OACA,WAEA,QACA,MACA,QAGF,SAASC,EAAcC,EAAMC,EAAQ,IACnC,IAAIC,SAAEA,KAAaC,GAAUF,EACxBG,MAAMC,QAAQH,KACjBA,EAAW,CAACA,IAEd,IAeII,EAfAC,EAAiBL,EAASM,OAC9B,IAAK,IAAIC,EAAI,EAAGA,EAAIF,EAAgBE,IAAK,CACvC,MAAMC,EAAQR,EAASO,GACjBE,QAAQD,MAAYN,MAAMC,QAAQK,IAAWA,EAAMF,SAAqB,IAAVE,GAClER,EAASU,OAAOH,EAAG,EAEtB,CAGD,GAFAF,EAAiBL,EAASM,OAC1BP,EAAMC,SAAWA,EACG,mBAATF,EACT,OAAOA,EAAKC,GAEVH,EAAYe,SAASb,KACvBG,EAAMP,MAAQL,EAAWC,KAIzBc,EADEH,EAAMP,MACEkB,SAASC,gBAAgBZ,EAAMP,MAAOI,GAEtCc,SAASE,cAAchB,GAEnC,IAAK,MAAMiB,KAAYd,EAAO,CAC5B,IAAKe,OAAOC,OAAOhB,EAAOc,GACxB,SAEF,IAAIG,EAAYjB,EAAMc,GACtB,GAAKA,IAAaG,GAAkC,iBAAdA,GAAwC,KAAdA,IAG/C,aAAbH,GAAw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