UNPKG

qwik-sonner

Version:

An opinionated toast component for Qwik.

1,439 lines (1,339 loc) 104 kB
"use strict"; Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); const qwik = require("@builder.io/qwik"); const jsxRuntime = require("@builder.io/qwik/jsx-runtime"); const styles = `:where(html[dir='ltr']), :where([data-qwik-toaster][dir='ltr']) { --toast-icon-margin-start: -3px; --toast-icon-margin-end: 4px; --toast-svg-margin-start: -1px; --toast-svg-margin-end: 0px; --toast-button-margin-start: auto; --toast-button-margin-end: 0; --toast-close-button-start: 0; --toast-close-button-end: unset; --toast-close-button-transform: translate(-35%, -35%); } :where(html[dir='rtl']), :where([data-qwik-toaster][dir='rtl']) { --toast-icon-margin-start: 4px; --toast-icon-margin-end: -3px; --toast-svg-margin-start: 0px; --toast-svg-margin-end: -1px; --toast-button-margin-start: 0; --toast-button-margin-end: auto; --toast-close-button-start: unset; --toast-close-button-end: 0; --toast-close-button-transform: translate(35%, -35%); } :where([data-qwik-toaster]) { position: fixed; width: var(--width); font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji; --gray1: hsl(0, 0%, 99%); --gray2: hsl(0, 0%, 97.3%); --gray3: hsl(0, 0%, 95.1%); --gray4: hsl(0, 0%, 93%); --gray5: hsl(0, 0%, 90.9%); --gray6: hsl(0, 0%, 88.7%); --gray7: hsl(0, 0%, 85.8%); --gray8: hsl(0, 0%, 78%); --gray9: hsl(0, 0%, 56.1%); --gray10: hsl(0, 0%, 52.3%); --gray11: hsl(0, 0%, 43.5%); --gray12: hsl(0, 0%, 9%); --border-radius: 8px; box-sizing: border-box; padding: 0; margin: 0; list-style: none; outline: none; z-index: 999999999; } :where([data-qwik-toaster][data-x-position='right']) { right: max(var(--offset), env(safe-area-inset-right)); } :where([data-qwik-toaster][data-x-position='left']) { left: max(var(--offset), env(safe-area-inset-left)); } :where([data-qwik-toaster][data-x-position='center']) { left: 50%; transform: translateX(-50%); } :where([data-qwik-toaster][data-y-position='top']) { top: max(var(--offset), env(safe-area-inset-top)); } :where([data-qwik-toaster][data-y-position='bottom']) { bottom: max(var(--offset), env(safe-area-inset-bottom)); } :where([data-qwik-toast]) { --y: translateY(100%); --lift-amount: calc(var(--lift) * var(--gap)); z-index: var(--z-index); position: absolute; opacity: 0; transform: var(--y); filter: blur(0); /* https://stackoverflow.com/questions/48124372/pointermove-event-not-working-with-touch-why-not */ touch-action: none; transition: transform 400ms, opacity 400ms, height 400ms, box-shadow 200ms; box-sizing: border-box; outline: none; overflow-wrap: anywhere; } :where([data-qwik-toast][data-styled='true']) { padding: 16px; background: var(--normal-bg); border: 1px solid var(--normal-border); color: var(--normal-text); border-radius: var(--border-radius); box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1); width: var(--width); font-size: 13px; display: flex; align-items: center; gap: 6px; } :where([data-qwik-toast]:focus-visible) { box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1), 0 0 0 2px rgba(0, 0, 0, 0.2); } :where([data-qwik-toast][data-y-position='top']) { top: 0; --y: translateY(-100%); --lift: 1; --lift-amount: calc(1 * var(--gap)); } :where([data-qwik-toast][data-y-position='bottom']) { bottom: 0; --y: translateY(100%); --lift: -1; --lift-amount: calc(var(--lift) * var(--gap)); } :where([data-qwik-toast]) :where([data-description]) { font-weight: 400; line-height: 1.4; color: inherit; } :where([data-qwik-toast]) :where([data-title]) { font-weight: 500; line-height: 1.5; color: inherit; } :where([data-qwik-toast]) :where([data-icon]) { display: flex; height: 16px; width: 16px; position: relative; justify-content: flex-start; align-items: center; flex-shrink: 0; margin-left: var(--toast-icon-margin-start); margin-right: var(--toast-icon-margin-end); } :where([data-qwik-toast][data-promise='true']) :where([data-icon])>svg { opacity: 0; transform: scale(0.8); transform-origin: center; animation: qwik-fade-in 300ms ease forwards; } :where([data-qwik-toast]) :where([data-icon])>* { flex-shrink: 0; } :where([data-qwik-toast]) :where([data-icon]) svg { margin-left: var(--toast-svg-margin-start); margin-right: var(--toast-svg-margin-end); } :where([data-qwik-toast]) :where([data-content]) { display: flex; flex-direction: column; gap: 2px; } [data-qwik-toast][data-styled="true"] [data-button] { border-radius: 4px; padding-left: 8px; padding-right: 8px; height: 24px; font-size: 12px; color: var(--normal-bg); background: var(--normal-text); margin-left: var(--toast-button-margin-start); margin-right: var(--toast-button-margin-end); border: none; cursor: pointer; outline: none; display: flex; align-items: center; flex-shrink: 0; transition: opacity 400ms, box-shadow 200ms; } :where([data-qwik-toast]) :where([data-button]):focus-visible { box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.4); } :where([data-qwik-toast]) :where([data-button]):first-of-type { margin-left: var(--toast-button-margin-start); margin-right: var(--toast-button-margin-end); } :where([data-qwik-toast]) :where([data-cancel]) { color: var(--normal-text); background: rgba(0, 0, 0, 0.08); } :where([data-qwik-toast][data-theme='dark']) :where([data-cancel]) { background: rgba(255, 255, 255, 0.3); } :where([data-qwik-toast]) :where([data-close-button]) { position: absolute; left: var(--toast-close-button-start); right: var(--toast-close-button-end); top: 0; height: 20px; width: 20px; display: flex; justify-content: center; align-items: center; padding: 0; background: var(--gray1); color: var(--gray12); border: 1px solid var(--gray4); transform: var(--toast-close-button-transform); border-radius: 50%; cursor: pointer; z-index: 1; transition: opacity 100ms, background 200ms, border-color 200ms; } :where([data-qwik-toast]) :where([data-close-button]):focus-visible { box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1), 0 0 0 2px rgba(0, 0, 0, 0.2); } :where([data-qwik-toast]) :where([data-disabled='true']) { cursor: not-allowed; } :where([data-qwik-toast]):hover :where([data-close-button]):hover { background: var(--gray2); border-color: var(--gray5); } /* Leave a ghost div to avoid setting hover to false when swiping out */ :where([data-qwik-toast][data-swiping='true'])::before { content: ''; position: absolute; left: 0; right: 0; height: 100%; z-index: -1; } :where([data-qwik-toast][data-y-position='top'][data-swiping='true'])::before { /* y 50% needed to distribute height additional height evenly */ bottom: 50%; transform: scaleY(3) translateY(50%); } :where([data-qwik-toast][data-y-position='bottom'][data-swiping='true'])::before { /* y -50% needed to distribute height additional height evenly */ top: 50%; transform: scaleY(3) translateY(-50%); } /* Leave a ghost div to avoid setting hover to false when transitioning out */ :where([data-qwik-toast][data-swiping='false'][data-removed='true'])::before { content: ''; position: absolute; inset: 0; transform: scaleY(2); } /* Needed to avoid setting hover to false when inbetween toasts */ :where([data-qwik-toast])::after { content: ''; position: absolute; left: 0; height: calc(var(--gap) + 1px); bottom: 100%; width: 100%; } :where([data-qwik-toast][data-mounted='true']) { --y: translateY(0); opacity: 1; } :where([data-qwik-toast][data-expanded='false'][data-front='false']) { --scale: var(--toasts-before) * 0.05 + 1; --y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale))); height: var(--front-toast-height); } :where([data-qwik-toast])>* { transition: opacity 400ms; } :where([data-qwik-toast][data-expanded='false'][data-front='false'][data-styled='true'])>* { opacity: 0; } :where([data-qwik-toast][data-visible='false']) { opacity: 0; pointer-events: none; } :where([data-qwik-toast][data-mounted='true'][data-expanded='true']) { --y: translateY(calc(var(--lift) * var(--offset))); height: var(--initial-height); } :where([data-qwik-toast][data-removed='true'][data-front='true'][data-swipe-out='false']) { --y: translateY(calc(var(--lift) * -100%)); opacity: 0; } :where([data-qwik-toast][data-removed='true'][data-front='false'][data-swipe-out='false'][data-expanded='true']) { --y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%)); opacity: 0; } :where([data-qwik-toast][data-removed='true'][data-front='false'][data-swipe-out='false'][data-expanded='false']) { --y: translateY(40%); opacity: 0; transition: transform 500ms, opacity 200ms; } /* Bump up the height to make sure hover state doesn't get set to false */ :where([data-qwik-toast][data-removed='true'][data-front='false'])::before { height: calc(var(--initial-height) + 20%); } [data-qwik-toast][data-swiping='true'] { transform: var(--y) translateY(var(--swipe-amount, 0px)); transition: none; } [data-qwik-toast][data-swipe-out='true'][data-y-position='bottom'], [data-qwik-toast][data-swipe-out='true'][data-y-position='top'] { animation: swipe-out 200ms ease-out forwards; } @keyframes swipe-out { from { transform: translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount))); opacity: 1; } to { transform: translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount) + var(--lift) * -100%)); opacity: 0; } } @media (max-width: 600px) { [data-qwik-toaster] { position: fixed; --mobile-offset: 16px; right: var(--mobile-offset); left: var(--mobile-offset); width: 100%; } [data-qwik-toaster] [data-qwik-toast] { left: 0; right: 0; width: calc(100% - var(--mobile-offset) * 2); } [data-qwik-toaster][data-x-position='left'] { left: var(--mobile-offset); } [data-qwik-toaster][data-y-position='bottom'] { bottom: 20px; } [data-qwik-toaster][data-y-position='top'] { top: 20px; } [data-qwik-toaster][data-x-position='center'] { left: var(--mobile-offset); right: var(--mobile-offset); transform: none; } } [data-qwik-toaster][data-theme='light'] { --normal-bg: #fff; --normal-border: var(--gray4); --normal-text: var(--gray12); --success-bg: hsl(143, 85%, 96%); --success-border: hsl(145, 92%, 91%); --success-text: hsl(140, 100%, 27%); --info-bg: hsl(208, 100%, 97%); --info-border: hsl(221, 91%, 91%); --info-text: hsl(210, 92%, 45%); --warning-bg: hsl(49, 100%, 97%); --warning-border: hsl(49, 91%, 91%); --warning-text: hsl(31, 92%, 45%); --error-bg: hsl(359, 100%, 97%); --error-border: hsl(359, 100%, 94%); --error-text: hsl(360, 100%, 45%); } [data-qwik-toaster][data-theme='light'] [data-qwik-toast][data-invert='true'] { --normal-bg: #000; --normal-border: hsl(0, 0%, 20%); --normal-text: var(--gray1); } [data-qwik-toaster][data-theme='dark'] [data-qwik-toast][data-invert='true'] { --normal-bg: #fff; --normal-border: var(--gray3); --normal-text: var(--gray12); } [data-qwik-toaster][data-theme='dark'] { --normal-bg: #000; --normal-border: hsl(0, 0%, 20%); --normal-text: var(--gray1); --success-bg: hsl(150, 100%, 6%); --success-border: hsl(147, 100%, 12%); --success-text: hsl(150, 86%, 65%); --info-bg: hsl(215, 100%, 6%); --info-border: hsl(223, 100%, 12%); --info-text: hsl(216, 87%, 65%); --warning-bg: hsl(64, 100%, 6%); --warning-border: hsl(60, 100%, 12%); --warning-text: hsl(46, 87%, 65%); --error-bg: hsl(358, 76%, 10%); --error-border: hsl(357, 89%, 16%); --error-text: hsl(358, 100%, 81%); } [data-rich-colors='true'] [data-qwik-toast][data-type='success'] { background: var(--success-bg); border-color: var(--success-border); color: var(--success-text); } [data-rich-colors='true'] [data-qwik-toast][data-type='success'] [data-close-button] { background: var(--success-bg); border-color: var(--success-border); color: var(--success-text); } [data-rich-colors='true'] [data-qwik-toast][data-type='info'] { background: var(--info-bg); border-color: var(--info-border); color: var(--info-text); } [data-rich-colors='true'] [data-qwik-toast][data-type='info'] [data-close-button] { background: var(--info-bg); border-color: var(--info-border); color: var(--info-text); } [data-rich-colors='true'] [data-qwik-toast][data-type='warning'] { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning-text); } [data-rich-colors='true'] [data-qwik-toast][data-type='warning'] [data-close-button] { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning-text); } [data-rich-colors='true'] [data-qwik-toast][data-type='error'] { background: var(--error-bg); border-color: var(--error-border); color: var(--error-text); } [data-rich-colors='true'] [data-qwik-toast][data-type='error'] [data-close-button] { background: var(--error-bg); border-color: var(--error-border); color: var(--error-text); } .qwik-loading-wrapper { --size: 16px; height: var(--size); width: var(--size); position: absolute; inset: 0; z-index: 10; } .qwik-loading-wrapper[data-visible='false'] { transform-origin: center; animation: qwik-fade-out 0.2s ease forwards; } .qwik-spinner { position: relative; top: 50%; left: 50%; height: var(--size); width: var(--size); } .qwik-loading-bar { animation: qwik-spin 1.2s linear infinite; background: var(--gray11); border-radius: 6px; height: 8%; left: -10%; position: absolute; top: -3.9%; width: 24%; } .qwik-loading-bar:nth-child(1) { animation-delay: -1.2s; transform: rotate(0.0001deg) translate(146%); } .qwik-loading-bar:nth-child(2) { animation-delay: -1.1s; transform: rotate(30deg) translate(146%); } .qwik-loading-bar:nth-child(3) { animation-delay: -1s; transform: rotate(60deg) translate(146%); } .qwik-loading-bar:nth-child(4) { animation-delay: -0.9s; transform: rotate(90deg) translate(146%); } .qwik-loading-bar:nth-child(5) { animation-delay: -0.8s; transform: rotate(120deg) translate(146%); } .qwik-loading-bar:nth-child(6) { animation-delay: -0.7s; transform: rotate(150deg) translate(146%); } .qwik-loading-bar:nth-child(7) { animation-delay: -0.6s; transform: rotate(180deg) translate(146%); } .qwik-loading-bar:nth-child(8) { animation-delay: -0.5s; transform: rotate(210deg) translate(146%); } .qwik-loading-bar:nth-child(9) { animation-delay: -0.4s; transform: rotate(240deg) translate(146%); } .qwik-loading-bar:nth-child(10) { animation-delay: -0.3s; transform: rotate(270deg) translate(146%); } .qwik-loading-bar:nth-child(11) { animation-delay: -0.2s; transform: rotate(300deg) translate(146%); } .qwik-loading-bar:nth-child(12) { animation-delay: -0.1s; transform: rotate(330deg) translate(146%); } @keyframes qwik-fade-in { 0% { opacity: 0; transform: scale(0.8); } 100% { opacity: 1; transform: scale(1); } } @keyframes qwik-fade-out { 0% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(0.8); } } @keyframes qwik-spin { 0% { opacity: 1; } 100% { opacity: 0.15; } } @media (prefers-reduced-motion) { [data-qwik-toast], [data-qwik-toast]>*, .qwik-loading-bar { transition: none !important; animation: none !important; } } .qwik-loader { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); transform-origin: center; transition: opacity 200ms, transform 200ms; } .qwik-loader[data-visible='false'] { opacity: 0; transform: scale(0.8) translate(-50%, -50%); }`; const VISIBLE_TOASTS_AMOUNT = 3; const VIEWPORT_OFFSET = "32px"; const TOAST_LIFETIME = 4e3; const TOAST_WIDTH = 356; const GAP = 14; const SWIPE_THRESHOLD = 20; const TIME_BEFORE_UNMOUNT = 200; let toastsCounter = 1; const subscribers = []; let toasts = []; const subscribe = (subscriber) => { subscribers.push(subscriber); return () => { const index = subscribers.indexOf(subscriber); subscribers.splice(index, 1); }; }; const publish = (data) => { subscribers.forEach((subscriber) => subscriber(data)); }; const addToast = (data) => { publish(data); toasts = [ ...toasts, data ]; }; const create$1 = (data) => { const { message: message2, ...rest } = data; const id = typeof data?.id === "number" || data.id && data.id?.length > 0 ? data.id : toastsCounter++; const alreadyExists = toasts.find((toast2) => { return toast2.id === id; }); const dismissible = data.dismissible === void 0 ? true : data.dismissible; if (alreadyExists) toasts = toasts.map((toast2) => { if (toast2.id === id) { publish({ ...toast2, ...data, id, title: message2 }); return { ...toast2, ...data, id, dismissible, title: message2 }; } return toast2; }); else addToast({ title: message2, ...rest, dismissible, id }); return id; }; const dismiss = (id) => { if (!id) return toasts.forEach((toast2) => { subscribers.forEach((subscriber) => subscriber({ id: toast2.id, dismiss: true })); }); subscribers.forEach((subscriber) => subscriber({ id, dismiss: true })); return id; }; const message = (message2, data) => { return create$1({ ...data, message: message2 }); }; const error = (message2, data) => { return create$1({ ...data, message: message2, type: "error" }); }; const success = (message2, data) => { return create$1({ ...data, type: "success", message: message2 }); }; const info = (message2, data) => { return create$1({ ...data, type: "info", message: message2 }); }; const warning = (message2, data) => { return create$1({ ...data, type: "warning", message: message2 }); }; const loading = (message2, data) => { return create$1({ ...data, type: "loading", message: message2 }); }; const promise = (promise2, data) => { if (!data) return; let id = void 0; if (data.loading !== void 0) id = create$1({ ...data, promise: promise2, type: "loading", message: data.loading, description: typeof data.description !== "function" ? data.description : void 0 }); const p = promise2 instanceof Promise ? promise2 : promise2(); let shouldDismiss = id !== void 0; p.then(async (response) => { if (response && typeof response.ok === "boolean" && !response.ok) { shouldDismiss = false; const message2 = typeof data.error === "function" ? await data.error({ // @ts-expect-error error: `HTTP error! status: ${response.status}` }) : data.error; const description = typeof data.description === "function" ? await data.description( // @ts-expect-error `HTTP error! status: ${response.status}` ) : data.description; create$1({ id, type: "error", message: message2, description }); } else if (data.success !== void 0) { shouldDismiss = false; const message2 = typeof data.success === "function" ? await data.success(response) : data.success; const description = typeof data.description === "function" ? await data.description(response) : data.description; create$1({ id, type: "success", message: message2, description }); } }).catch(async (error2) => { if (data.error !== void 0) { shouldDismiss = false; const message2 = typeof data.error === "function" ? await data.error(error2) : data.error; const description = typeof data.description === "function" ? await data.description(error2) : data.description; create$1({ id, type: "error", message: message2, description }); } }).finally(() => { if (shouldDismiss) { dismiss(id); id = void 0; } data.finally?.(); }); return id; }; const custom = (jsx, data) => { const id = data?.id || toastsCounter++; create$1({ jsx: jsx(id), id, ...data }); return id; }; const ToastState = { subscribe, addToast, create: create$1, dismiss, message, error, success, info, warning, loading, promise, custom }; const toastFunction = (message2, data) => { const id = data?.id || toastsCounter++; ToastState.addToast({ title: message2, ...data, id }); return id; }; const basicToast = toastFunction; const toast = Object.assign(basicToast, { success: ToastState.success, info: ToastState.info, warning: ToastState.warning, error: ToastState.error, custom: ToastState.custom, message: ToastState.message, promise: ToastState.promise, dismiss: ToastState.dismiss, loading: ToastState.loading }); function isAction(action) { return action.label !== void 0 && typeof action.onClick$ === "function"; } let SwipeStateTypes; (function(SwipeStateTypes2) { SwipeStateTypes2["SwipedOut"] = "SwipedOut"; SwipeStateTypes2["SwipedBack"] = "SwipedBack"; SwipeStateTypes2["NotSwiped"] = "NotSwiped"; })(SwipeStateTypes || (SwipeStateTypes = {})); const getAsset = (type) => { qwik._jsxBranch(); switch (type) { case "success": return /* @__PURE__ */ qwik._jsxC(SuccessIcon, null, 3, "oH_0"); case "info": return /* @__PURE__ */ qwik._jsxC(InfoIcon, null, 3, "oH_1"); case "warning": return /* @__PURE__ */ qwik._jsxC(WarningIcon, null, 3, "oH_2"); case "error": return /* @__PURE__ */ qwik._jsxC(ErrorIcon, null, 3, "oH_3"); default: return null; } }; const bars = Array(12).fill(0); const Loader = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl((props) => { return /* @__PURE__ */ qwik._jsxQ("div", null, { class: "qwik-loading-wrapper", "data-visible": qwik._fnSignal((p0) => String(p0.visible), [ props ], "String(p0.visible)") }, /* @__PURE__ */ qwik._jsxQ("div", null, { class: "qwik-spinner" }, bars.map((_, i) => /* @__PURE__ */ qwik._jsxQ("div", null, { class: "qwik-loading-bar" }, null, 3, `spinner-bar-${i}`)), 1, null), 1, "oH_4"); }, "Loader_component_0409WLJe4ZA")); const SuccessIcon = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(() => /* @__PURE__ */ qwik._jsxQ("svg", null, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", height: "20", width: "20" }, /* @__PURE__ */ qwik._jsxQ("path", null, { "fill-rule": "evenodd", d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z", "clip-rule": "evenodd" }, null, 3, null), 3, "oH_5"), "SuccessIcon_component_PlMhMWQHW9g")); const WarningIcon = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(() => /* @__PURE__ */ qwik._jsxQ("svg", null, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", height: "20", width: "20" }, /* @__PURE__ */ qwik._jsxQ("path", null, { "fill-rule": "evenodd", d: "M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z", "clip-rule": "evenodd" }, null, 3, null), 3, "oH_6"), "WarningIcon_component_XugbeigHGlc")); const InfoIcon = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(() => /* @__PURE__ */ qwik._jsxQ("svg", null, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", height: "20", width: "20" }, /* @__PURE__ */ qwik._jsxQ("path", null, { "fill-rule": "evenodd", d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z", "clip-rule": "evenodd" }, null, 3, null), 3, "oH_7"), "InfoIcon_component_czjMKqmqjMo")); const ErrorIcon = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(() => /* @__PURE__ */ qwik._jsxQ("svg", null, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", height: "20", width: "20" }, /* @__PURE__ */ qwik._jsxQ("path", null, { "fill-rule": "evenodd", d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z", "clip-rule": "evenodd" }, null, 3, null), 3, "oH_8"), "ErrorIcon_component_uE2rykD0NII")); /*! @license DOMPurify 3.1.2 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.2/LICENSE */ const { entries, setPrototypeOf, isFrozen, getPrototypeOf, getOwnPropertyDescriptor } = Object; let { freeze, seal, create } = Object; let { apply, construct } = typeof Reflect !== "undefined" && Reflect; if (!freeze) { freeze = function freeze2(x) { return x; }; } if (!seal) { seal = function seal2(x) { return x; }; } if (!apply) { apply = function apply2(fun, thisValue, args) { return fun.apply(thisValue, args); }; } if (!construct) { construct = function construct2(Func, args) { return new Func(...args); }; } const arrayForEach = unapply(Array.prototype.forEach); const arrayPop = unapply(Array.prototype.pop); const arrayPush = unapply(Array.prototype.push); const stringToLowerCase = unapply(String.prototype.toLowerCase); const stringToString = unapply(String.prototype.toString); const stringMatch = unapply(String.prototype.match); const stringReplace = unapply(String.prototype.replace); const stringIndexOf = unapply(String.prototype.indexOf); const stringTrim = unapply(String.prototype.trim); const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty); const regExpTest = unapply(RegExp.prototype.test); const typeErrorCreate = unconstruct(TypeError); function unapply(func) { return function(thisArg) { for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } return apply(func, thisArg, args); }; } function unconstruct(func) { return function() { for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args[_key2] = arguments[_key2]; } return construct(func, args); }; } function addToSet(set, array) { let transformCaseFunc = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : stringToLowerCase; if (setPrototypeOf) { setPrototypeOf(set, null); } let l = array.length; while (l--) { let element = array[l]; if (typeof element === "string") { const lcElement = transformCaseFunc(element); if (lcElement !== element) { if (!isFrozen(array)) { array[l] = lcElement; } element = lcElement; } } set[element] = true; } return set; } function cleanArray(array) { for (let index = 0; index < array.length; index++) { const isPropertyExist = objectHasOwnProperty(array, index); if (!isPropertyExist) { array[index] = null; } } return array; } function clone(object) { const newObject = create(null); for (const [property, value] of entries(object)) { const isPropertyExist = objectHasOwnProperty(object, property); if (isPropertyExist) { if (Array.isArray(value)) { newObject[property] = cleanArray(value); } else if (value && typeof value === "object" && value.constructor === Object) { newObject[property] = clone(value); } else { newObject[property] = value; } } } return newObject; } function lookupGetter(object, prop) { while (object !== null) { const desc = getOwnPropertyDescriptor(object, prop); if (desc) { if (desc.get) { return unapply(desc.get); } if (typeof desc.value === "function") { return unapply(desc.value); } } object = getPrototypeOf(object); } function fallbackValue() { return null; } return fallbackValue; } const html$1 = freeze(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "shadow", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]); const svg$1 = freeze(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]); const svgFilters = freeze(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]); const svgDisallowed = freeze(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]); const mathMl$1 = freeze(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]); const mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]); const text = freeze(["#text"]); const html = freeze(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "pattern", "placeholder", "playsinline", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]); const svg = freeze(["accent-height", "accumulate", "additive", "alignment-baseline", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]); const mathMl = freeze(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]); const xml = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]); const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); const ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm); const TMPLIT_EXPR = seal(/\${[\w\W]*}/gm); const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); const ARIA_ATTR = seal(/^aria-[\-\w]+$/); const IS_ALLOWED_URI = seal( /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape ); const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i); const ATTR_WHITESPACE = seal( /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex ); const DOCTYPE_NAME = seal(/^html$/i); const CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i); var EXPRESSIONS = /* @__PURE__ */ Object.freeze({ __proto__: null, MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR, DATA_ATTR, ARIA_ATTR, IS_ALLOWED_URI, IS_SCRIPT_OR_DATA, ATTR_WHITESPACE, DOCTYPE_NAME, CUSTOM_ELEMENT }); const getGlobal = function getGlobal2() { return typeof window === "undefined" ? null : window; }; const _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTypes, purifyHostElement) { if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function") { return null; } let suffix = null; const ATTR_NAME = "data-tt-policy-suffix"; if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) { suffix = purifyHostElement.getAttribute(ATTR_NAME); } const policyName = "dompurify" + (suffix ? "#" + suffix : ""); try { return trustedTypes.createPolicy(policyName, { createHTML(html2) { return html2; }, createScriptURL(scriptUrl) { return scriptUrl; } }); } catch (_) { console.warn("TrustedTypes policy " + policyName + " could not be created."); return null; } }; function createDOMPurify() { let window2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal(); const DOMPurify = (root) => createDOMPurify(root); DOMPurify.version = "3.1.2"; DOMPurify.removed = []; if (!window2 || !window2.document || window2.document.nodeType !== 9) { DOMPurify.isSupported = false; return DOMPurify; } let { document: document2 } = window2; const originalDocument = document2; const currentScript = originalDocument.currentScript; const { DocumentFragment, HTMLTemplateElement, Node, Element, NodeFilter, NamedNodeMap = window2.NamedNodeMap || window2.MozNamedAttrMap, HTMLFormElement, DOMParser, trustedTypes } = window2; const ElementPrototype = Element.prototype; const cloneNode = lookupGetter(ElementPrototype, "cloneNode"); const getNextSibling = lookupGetter(ElementPrototype, "nextSibling"); const getChildNodes = lookupGetter(ElementPrototype, "childNodes"); const getParentNode = lookupGetter(ElementPrototype, "parentNode"); if (typeof HTMLTemplateElement === "function") { const template = document2.createElement("template"); if (template.content && template.content.ownerDocument) { document2 = template.content.ownerDocument; } } let trustedTypesPolicy; let emptyHTML = ""; const { implementation, createNodeIterator, createDocumentFragment, getElementsByTagName } = document2; const { importNode } = originalDocument; let hooks = {}; DOMPurify.isSupported = typeof entries === "function" && typeof getParentNode === "function" && implementation && implementation.createHTMLDocument !== void 0; const { MUSTACHE_EXPR: MUSTACHE_EXPR2, ERB_EXPR: ERB_EXPR2, TMPLIT_EXPR: TMPLIT_EXPR2, DATA_ATTR: DATA_ATTR2, ARIA_ATTR: ARIA_ATTR2, IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA2, ATTR_WHITESPACE: ATTR_WHITESPACE2, CUSTOM_ELEMENT: CUSTOM_ELEMENT2 } = EXPRESSIONS; let { IS_ALLOWED_URI: IS_ALLOWED_URI$1 } = EXPRESSIONS; let ALLOWED_TAGS = null; const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]); let ALLOWED_ATTR = null; const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]); let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, { tagNameCheck: { writable: true, configurable: false, enumerable: true, value: null }, attributeNameCheck: { writable: true, configurable: false, enumerable: true, value: null }, allowCustomizedBuiltInElements: { writable: true, configurable: false, enumerable: true, value: false } })); let FORBID_TAGS = null; let FORBID_ATTR = null; let ALLOW_ARIA_ATTR = true; let ALLOW_DATA_ATTR = true; let ALLOW_UNKNOWN_PROTOCOLS = false; let ALLOW_SELF_CLOSE_IN_ATTR = true; let SAFE_FOR_TEMPLATES = false; let SAFE_FOR_XML = true; let WHOLE_DOCUMENT = false; let SET_CONFIG = false; let FORCE_BODY = false; let RETURN_DOM = false; let RETURN_DOM_FRAGMENT = false; let RETURN_TRUSTED_TYPE = false; let SANITIZE_DOM = true; let SANITIZE_NAMED_PROPS = false; const SANITIZE_NAMED_PROPS_PREFIX = "user-content-"; let KEEP_CONTENT = true; let IN_PLACE = false; let USE_PROFILES = {}; let FORBID_CONTENTS = null; const DEFAULT_FORBID_CONTENTS = addToSet({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]); let DATA_URI_TAGS = null; const DEFAULT_DATA_URI_TAGS = addToSet({}, ["audio", "video", "img", "source", "image", "track"]); let URI_SAFE_ATTRIBUTES = null; const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]); const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML"; const SVG_NAMESPACE = "http://www.w3.org/2000/svg"; const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml"; let NAMESPACE = HTML_NAMESPACE; let IS_EMPTY_INPUT = false; let ALLOWED_NAMESPACES = null; const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString); let PARSER_MEDIA_TYPE = null; const SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"]; const DEFAULT_PARSER_MEDIA_TYPE = "text/html"; let transformCaseFunc = null; let CONFIG = null; const MAX_NESTING_DEPTH = 255; const formElement = document2.createElement("form"); const isRegexOrFunction = function isRegexOrFunction2(testValue) { return testValue instanceof RegExp || testValue instanceof Function; }; const _parseConfig = function _parseConfig2() { let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; if (CONFIG && CONFIG === cfg) { return; } if (!cfg || typeof cfg !== "object") { cfg = {}; } cfg = clone(cfg); PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE; transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase; ALLOWED_TAGS = objectHasOwnProperty(cfg, "ALLOWED_TAGS") ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS; ALLOWED_ATTR = objectHasOwnProperty(cfg, "ALLOWED_ATTR") ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR; ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, "ALLOWED_NAMESPACES") ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES; URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") ? addToSet( clone(DEFAULT_URI_SAFE_ATTRIBUTES), // eslint-disable-line indent cfg.ADD_URI_SAFE_ATTR, // eslint-disable-line indent transformCaseFunc // eslint-disable-line indent ) : DEFAULT_URI_SAFE_ATTRIBUTES; DATA_URI_TAGS = objectHasOwnProperty(cfg, "ADD_DATA_URI_TAGS") ? addToSet( clone(DEFAULT_DATA_URI_TAGS), // eslint-disable-line indent cfg.ADD_DATA_URI_TAGS, // eslint-disable-line indent transformCaseFunc // eslint-disable-line indent ) : DEFAULT_DATA_URI_TAGS; FORBID_CONTENTS = objectHasOwnProperty(cfg, "FORBID_CONTENTS") ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS; FORBID_TAGS = objectHasOwnProperty(cfg, "FORBID_TAGS") ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {}; FORBID_ATTR = objectHasOwnProperty(cfg, "FORBID_ATTR") ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {}; USE_PROFILES = objectHasOwnProperty(cfg, "USE_PROFILES") ? cfg.USE_PROFILES : false; ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false; WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; RETURN_DOM = cfg.RETURN_DOM || false; RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; FORCE_BODY = cfg.FORCE_BODY || false; SANITIZE_DOM = cfg.SANITIZE_DOM !== false; SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; KEEP_CONTENT = cfg.KEEP_CONTENT !== false; IN_PLACE = cfg.IN_PLACE || false; IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI; NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE; CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {}; if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) { CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck; } if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) { CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck; } if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === "boolean") { CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements; } if (SAFE_FOR_TEMPLATES) { ALLOW_DATA_ATTR = false; } if (RETURN_DOM_FRAGMENT) { RETURN_DOM = true; } if (USE_PROFILES) { ALLOWED_TAGS = addToSet({}, text); ALLOWED_ATTR = []; if (USE_PROFILES.html === true) { addToSet(ALLOWED_TAGS, html$1); addToSet(ALLOWED_ATTR, html); } if (USE_PROFILES.svg === true) { addToSet(ALLOWED_TAGS, svg$1); addToSet(ALLOWED_ATTR, svg); addToSet(ALLOWED_ATTR, xml); } if (USE_PROFILES.svgFilters === true) { addToSet(ALLOWED_TAGS, svgFilters); addToSet(ALLOWED_ATTR, svg); addToSet(ALLOWED_ATTR, xml); } if (USE_PROFILES.mathMl === true) { addToSet(ALLOWED_TAGS, mathMl$1); addToSet(ALLOWED_ATTR, mathMl); addToSet(ALLOWED_ATTR, xml); } } if (cfg.ADD_TAGS) { if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) { ALLOWED_TAGS = clone(ALLOWED_TAGS); } addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc); } if (cfg.ADD_ATTR) { if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) { ALLOWED_ATTR = clone(ALLOWED_ATTR); } addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc); } if (cfg.ADD_URI_SAFE_ATTR) { addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc); } if (cfg.FORBID_CONTENTS) { if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) { FORBID_CONTENTS = clone(FORBID_CONTENTS); } addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc); } if (KEEP_CONTENT) { ALLOWED_TAGS["#text"] = true; } if (WHOLE_DOCUMENT) { addToSet(ALLOWED_TAGS, ["html", "head", "body"]); } if (ALLOWED_TAGS.table) { addToSet(ALLOWED_TAGS, ["tbody"]); delete FORBID_TAGS.tbody; } if (cfg.TRUSTED_TYPES_POLICY) { if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== "function") { throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.'); } if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== "function") { throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.'); } trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY; emptyHTML = trustedTypesPolicy.createHTML(""); } else { if (trustedTypesPolicy === void 0) { trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript); } if (trustedTypesPolicy !== null && typeof emptyHTML === "string") { emptyHTML = trustedTypesPolicy.createHTML(""); } } if (freeze) { freeze(cfg); } CONFIG = cfg; }; const MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]); const HTML_INTEGRATION_POINTS = addToSet({}, ["foreignobject", "annotation-xml"]); const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ["title", "style", "font", "a", "script"]); const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]); const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]); const _checkValidNamespace = function _checkValidNamespace2(element) { let parent = getParentNode(element); if (!parent || !parent.tagName) { parent = { namespaceURI: NAMESPACE, tagName: "template" }; } const tagName = stringToLowerCase(element.tagName); const parentTagName = stringToLowerCase(parent.tagName); if (!ALLOWED_NAMESPACES[element.namespaceURI]) { return false; } if (element.namespaceURI === SVG_NAMESPACE) { if (parent.namespaceURI === HTML_NAMESPACE) { return tagName === "svg"; }