vult-security-kyc 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,91 @@
1
+ # vult-kyc-widget
2
+
3
+ The client side construction for the KYC Widget
4
+
5
+ ## Local Development - Requirements
6
+
7
+ * [NPM](https://www.npmjs.com/)
8
+ * [Node](https://nodejs.org/en/)
9
+ * [Typescript](https://www.typescriptlang.org/)
10
+ * [Yarn](https://yarnpkg.com//)
11
+
12
+ ## Usage
13
+
14
+ ```typescript
15
+ window.addEventListener("load", () => {
16
+ // Code to run once the entire page (including images) is fully loaded
17
+ idv = new VultKYC.KYCWidget({
18
+ onComplete: function () {
19
+ console.log("The Kyc is completed.")
20
+ },
21
+ onDismiss:function(){
22
+ // callback when dismissing modal by pressing/clicking on backdrop
23
+ },
24
+ Session_Type: VultKYC.IDV,
25
+ })
26
+ ida = new VultKYC.KYCWidget({
27
+ onComplete: function () {
28
+ console.log("The Kyc is completed.")
29
+ },
30
+ onDismiss:function(){
31
+ // callback when dismissing modal by pressing/clicking on backdrop
32
+ },
33
+ Session_Type: VultKYC.IDA,
34
+ })
35
+ });
36
+
37
+ function onPressIDV() {
38
+ idv.startIDVerify("e595a489-3706-4942-969d-17259db47b51")
39
+ }
40
+ function onPressIDA() {
41
+ ida.startIDAuthenticate("beba906a-76aa-4231-a610-763f6fef8855")
42
+ }
43
+ ```
44
+
45
+ The object needed to instantiate KYC widget.
46
+
47
+ ```typescript
48
+ interface IKYCWidget {
49
+ Session_Type: "IDVerification" | "IDAuthentication",
50
+ onComplete?: () => void
51
+ onDismiss?: () => void
52
+ }
53
+ ```
54
+ ## Development
55
+
56
+ ### Installing the Package Locally
57
+
58
+ ```bash
59
+ # Step 1: Clear yarn cache for the specific package
60
+ yarn cache clean kyc-widget
61
+
62
+ # Step 2: Verify it's cleared (should return nothing)
63
+ yarn cache list | grep kyc-widget
64
+
65
+ # Step 3: Remove the package from node_modules (you already did this)
66
+ rm -rf node_modules/kyc-widget
67
+
68
+ # Step 4: Remove yarn.lock entry if it exists (optional but recommended)
69
+ # Manually edit yarn.lock to remove kyc-widget entries, or:
70
+
71
+ # Step 5: Clear yarn's entire cache (nuclear option if step 1 doesn't work)
72
+ yarn cache clean
73
+
74
+ # Step 6: Remove node_modules and yarn.lock (if you want completely fresh install)
75
+ rm -rf node_modules
76
+ rm yarn.lock
77
+
78
+ # Step 7: Reinstall everything
79
+ yarn install
80
+
81
+ # Step 8: Then add your local package
82
+ yarn add ./path/to/kyc-widget-2.0.0.tgz
83
+ ```
84
+
85
+ ## Licensing
86
+
87
+ This project includes third-party libraries with their own licenses. Below is a summary of the third-party licenses included in this project:
88
+
89
+ * **DOMPurify**: Licensed under the Apache License 2.0. See `third-party-licenses/DOMPurify/LICENSE` for the full text.
90
+
91
+ For detailed licensing information and attributions, please refer to the `third-party-licenses/` directory.
@@ -0,0 +1,8 @@
1
+ import { KYC_SETTINGS } from './interfaces/IKYCWidget';
2
+ export declare const IFrame: ({ KYC_VARS, }: {
3
+ KYC_VARS: KYC_SETTINGS;
4
+ setLocationData: (x: {
5
+ latitude: number;
6
+ longitude: number;
7
+ }) => void;
8
+ }) => Promise<HTMLDivElement>;
@@ -0,0 +1,3 @@
1
+ export declare const LoadingSpinner: ({ color }: {
2
+ color: string;
3
+ }) => string;
@@ -0,0 +1,4 @@
1
+ export declare const MainWindow: ({ removeElementFromDOM, onDismiss, }: {
2
+ removeElementFromDOM: () => void;
3
+ onDismiss?: () => void;
4
+ }) => HTMLDivElement;
@@ -0,0 +1,3 @@
1
+ export { VULTIdv } from '../components/VULTIdv';
2
+ export { VULTIda } from '../components/VULTIda';
3
+ export type { VULTProps } from './interfaces/VULTProps';
@@ -0,0 +1,62 @@
1
+ /* Vult Kyc Widget: 2.0.0 */
2
+ import { useRef as l, useEffect as f } from "react";
3
+ import { KYCWidget as a, IDV as p, IDA as y } from "../vult-kyc-widget.es.js";
4
+ const V = ({
5
+ environment: i,
6
+ sessionId: e,
7
+ autoClose: o = !0,
8
+ onComplete: n,
9
+ onDismiss: c
10
+ }) => {
11
+ const r = l(null);
12
+ return f(() => {
13
+ var t;
14
+ e ? (t = r.current) == null || t.startIDVerify(e) : console.warn("Awaiting sessionId to be provided");
15
+ }, [e]), f(() => {
16
+ var t;
17
+ return r.current || (r.current = new a({
18
+ env: i,
19
+ onDismiss: () => {
20
+ c && c();
21
+ },
22
+ onComplete: () => {
23
+ var u;
24
+ n && n(), o && ((u = r.current) == null || u.close());
25
+ },
26
+ Session_Type: p
27
+ })), e && ((t = r.current) == null || t.startIDVerify(e)), () => {
28
+ r.current && r.current.close();
29
+ };
30
+ }, []), null;
31
+ }, v = ({
32
+ environment: i,
33
+ sessionId: e,
34
+ autoClose: o = !0,
35
+ onComplete: n,
36
+ onDismiss: c
37
+ }) => {
38
+ const r = l(null);
39
+ return f(() => {
40
+ var t;
41
+ e ? (t = r.current) == null || t.startIDAuthenticate(e) : console.warn("Awaiting sessionId to be provided");
42
+ }, [e]), f(() => {
43
+ var t;
44
+ return r.current || (r.current = new a({
45
+ env: i,
46
+ onDismiss: () => {
47
+ c && c();
48
+ },
49
+ onComplete: () => {
50
+ var u;
51
+ n && n(), o && ((u = r.current) == null || u.close());
52
+ },
53
+ Session_Type: y
54
+ })), e && ((t = r.current) == null || t.startIDVerify(e)), () => {
55
+ r.current && r.current.close();
56
+ };
57
+ }, []), null;
58
+ };
59
+ export {
60
+ v as VULTIda,
61
+ V as VULTIdv
62
+ };
@@ -0,0 +1,30 @@
1
+ import { KYCWidgetConfig, KYC_SETTINGS } from './interfaces/IKYCWidget';
2
+ export declare class KYCWidget {
3
+ KYC_VARS: KYC_SETTINGS;
4
+ locationData: {
5
+ latitude: number;
6
+ longitude: number;
7
+ } | null;
8
+ isResizing: boolean;
9
+ resizeTimerID: null | number;
10
+ domain: string;
11
+ previousWidth: number;
12
+ previousHeight: number;
13
+ RESIZE_THRESHOLD_HEIGHT: number;
14
+ RESIZE_THRESHOLD_WIDTH: number;
15
+ constructor(initialConfiguration: KYCWidgetConfig);
16
+ windowEventListener: (ev: any) => void;
17
+ setLocationData: (coords: {
18
+ latitude: number;
19
+ longitude: number;
20
+ }) => void;
21
+ resizeHandler: () => void;
22
+ setupResizingServices: () => void;
23
+ setUpHtml: () => Promise<void>;
24
+ setSessionType: (initialConfiguration: KYCWidgetConfig) => "/verify" | "/authenticate" | "";
25
+ startIDVerify: (session_id: string) => Promise<void>;
26
+ startIDAuthenticate: (session_id: string) => Promise<void>;
27
+ close: () => void;
28
+ }
29
+ export declare const IDA = "IDAuthentication";
30
+ export declare const IDV = "IDVerification";
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Initial configuration provided by the user when creating a KYCWidget instance.
3
+ * This is what users pass to the constructor.
4
+ */
5
+ export interface KYCWidgetConfig {
6
+ /**
7
+ * The type of session to run (ID Verification or ID Authentication)
8
+ */
9
+ Session_Type: "IDVerification" | "IDAuthentication";
10
+ /**
11
+ * Environment for the widget (dev, development, stage, demo, prod, or production)
12
+ */
13
+ env: "dev" | "development" | "stage" | "demo" | "prod" | "production";
14
+ /**
15
+ * Optional callback fired when verification/authentication is completed
16
+ */
17
+ onComplete?: (x?: any) => void;
18
+ /**
19
+ * Optional callback fired when the widget is dismissed
20
+ */
21
+ onDismiss?: (x?: any) => void;
22
+ }
23
+ /**
24
+ * Internal widget settings used throughout the widget lifecycle.
25
+ * This extends the initial configuration with computed and runtime values.
26
+ */
27
+ export interface KYC_SETTINGS extends KYCWidgetConfig {
28
+ /**
29
+ * Session URL path computed from Session_Type ("/verify" or "/authenticate")
30
+ */
31
+ sessionURL: "/verify" | "/authenticate" | "";
32
+ /**
33
+ * Session ID - set when starting verification/authentication
34
+ */
35
+ session_id: string;
36
+ }
37
+ /**
38
+ * @deprecated Use KYCWidgetConfig instead. This interface is kept for backward compatibility.
39
+ */
40
+ export interface IKYCWidget {
41
+ session_id: string;
42
+ Session_Type: "IDVerification" | "IDAuthentication";
43
+ onComplete?: (x?: any) => void;
44
+ onDismiss?: (x?: any) => void;
45
+ }
@@ -0,0 +1,7 @@
1
+ export interface VULTProps {
2
+ sessionId: string;
3
+ autoClose?: boolean;
4
+ onDismiss?: () => void;
5
+ onComplete?: () => void;
6
+ environment: "dev" | "development" | "stage" | "demo" | "prod" | "production";
7
+ }
@@ -0,0 +1 @@
1
+ export declare const applyStyles: (htmlElement: HTMLElement | HTMLIFrameElement, styles: Partial<Record<keyof CSSStyleDeclaration, string>>) => void;
@@ -0,0 +1,6 @@
1
+ export declare function addListener({ element, event, handler }: {
2
+ element: HTMLElement | Window;
3
+ event: string;
4
+ handler: EventListener;
5
+ }): void;
6
+ export declare function removeListeners(element: HTMLElement): void;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Determines the environment domain URL based on the provided environment string.
3
+ *
4
+ * Maps environment values to their corresponding URLs:
5
+ * - dev, development -> https://face-dev.vultpayments.dev
6
+ * - stage -> https://face-stage.vultpayments.dev
7
+ * - demo -> https://face-demo.vultsecurity.com
8
+ * - prod, production -> https://face.vultsecurity.com
9
+ *
10
+ * @param env - The environment string (dev, development, stage, demo, prod, or production)
11
+ * @returns The domain URL for the specified environment
12
+ */
13
+ export declare function getEnvironmentDomain(env: 'dev' | 'development' | 'stage' | 'demo' | 'prod' | 'production'): string;
@@ -0,0 +1,4 @@
1
+ export declare const getGeolocation: () => Promise<{
2
+ latitude: number;
3
+ longitude: number;
4
+ }>;
@@ -0,0 +1,4 @@
1
+ export declare const iframeElementParentStyles: () => {
2
+ width: string;
3
+ height: string;
4
+ };
@@ -0,0 +1,2 @@
1
+ import { VULTProps } from '../client-apps/interfaces/VULTProps';
2
+ export declare const VULTIda: ({ environment, sessionId, autoClose, onComplete, onDismiss, }: VULTProps) => null;
@@ -0,0 +1,2 @@
1
+ import { VULTProps } from '../client-apps/interfaces/VULTProps';
2
+ export declare const VULTIdv: ({ environment, sessionId, autoClose, onComplete, onDismiss, }: VULTProps) => null;
@@ -0,0 +1,2 @@
1
+ export * from './client-apps/components'
2
+ export {}
@@ -0,0 +1,5 @@
1
+ interface Window {
2
+ OnBoarding: any
3
+ cv: any
4
+ DOMPurify: any
5
+ }
@@ -0,0 +1,2 @@
1
+ export * from './client-apps/index'
2
+ export {}
@@ -0,0 +1,2 @@
1
+ declare const _default: import('vite').UserConfig & Promise<import('vite').UserConfig> & import('vite').UserConfigFnObject & import('vite').UserConfigFnPromise & import('vite').UserConfigFn;
2
+ export default _default;
@@ -0,0 +1,883 @@
1
+ var Rn = Object.defineProperty;
2
+ var Dn = (s, n, l) => n in s ? Rn(s, n, { enumerable: !0, configurable: !0, writable: !0, value: l }) : s[n] = l;
3
+ var E = (s, n, l) => Dn(s, typeof n != "symbol" ? n + "" : n, l);
4
+ function In(s) {
5
+ return s && s.__esModule && Object.prototype.hasOwnProperty.call(s, "default") ? s.default : s;
6
+ }
7
+ /*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */
8
+ var Ye, bt;
9
+ function vt() {
10
+ if (bt) return Ye;
11
+ bt = 1;
12
+ const {
13
+ entries: s,
14
+ setPrototypeOf: n,
15
+ isFrozen: l,
16
+ getPrototypeOf: d,
17
+ getOwnPropertyDescriptor: T
18
+ } = Object;
19
+ let {
20
+ freeze: m,
21
+ seal: D,
22
+ create: q
23
+ } = Object, {
24
+ apply: Z,
25
+ construct: W
26
+ } = typeof Reflect < "u" && Reflect;
27
+ m || (m = function(o) {
28
+ return o;
29
+ }), D || (D = function(o) {
30
+ return o;
31
+ }), Z || (Z = function(o, f, u) {
32
+ return o.apply(f, u);
33
+ }), W || (W = function(o, f) {
34
+ return new o(...f);
35
+ });
36
+ const fe = L(Array.prototype.forEach), Pt = L(Array.prototype.lastIndexOf), $e = L(Array.prototype.pop), Q = L(Array.prototype.push), kt = L(Array.prototype.splice), me = L(String.prototype.toLowerCase), ye = L(String.prototype.toString), je = L(String.prototype.match), J = L(String.prototype.replace), Ht = L(String.prototype.indexOf), Ut = L(String.prototype.trim), M = L(Object.prototype.hasOwnProperty), I = L(RegExp.prototype.test), ee = Wt(TypeError);
37
+ function L(c) {
38
+ return function(o) {
39
+ o instanceof RegExp && (o.lastIndex = 0);
40
+ for (var f = arguments.length, u = new Array(f > 1 ? f - 1 : 0), w = 1; w < f; w++)
41
+ u[w - 1] = arguments[w];
42
+ return Z(c, o, u);
43
+ };
44
+ }
45
+ function Wt(c) {
46
+ return function() {
47
+ for (var o = arguments.length, f = new Array(o), u = 0; u < o; u++)
48
+ f[u] = arguments[u];
49
+ return W(c, f);
50
+ };
51
+ }
52
+ function a(c, o) {
53
+ let f = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : me;
54
+ n && n(c, null);
55
+ let u = o.length;
56
+ for (; u--; ) {
57
+ let w = o[u];
58
+ if (typeof w == "string") {
59
+ const x = f(w);
60
+ x !== w && (l(o) || (o[u] = x), w = x);
61
+ }
62
+ c[w] = !0;
63
+ }
64
+ return c;
65
+ }
66
+ function zt(c) {
67
+ for (let o = 0; o < c.length; o++)
68
+ M(c, o) || (c[o] = null);
69
+ return c;
70
+ }
71
+ function N(c) {
72
+ const o = q(null);
73
+ for (const [f, u] of s(c))
74
+ M(c, f) && (Array.isArray(u) ? o[f] = zt(u) : u && typeof u == "object" && u.constructor === Object ? o[f] = N(u) : o[f] = u);
75
+ return o;
76
+ }
77
+ function te(c, o) {
78
+ for (; c !== null; ) {
79
+ const u = T(c, o);
80
+ if (u) {
81
+ if (u.get)
82
+ return L(u.get);
83
+ if (typeof u.value == "function")
84
+ return L(u.value);
85
+ }
86
+ c = d(c);
87
+ }
88
+ function f() {
89
+ return null;
90
+ }
91
+ return f;
92
+ }
93
+ const Ke = m(["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"]), Re = m(["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"]), De = m(["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"]), Ft = m(["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"]), Ie = m(["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"]), Gt = m(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), Xe = m(["#text"]), qe = m(["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", "popover", "popovertarget", "popovertargetaction", "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"]), Le = m(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "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", "exponent", "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", "intercept", "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", "slope", "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", "tablevalues", "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"]), Ze = m(["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"]), de = m(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), Bt = D(/\{\{[\w\W]*|[\w\W]*\}\}/gm), Yt = D(/<%[\w\W]*|[\w\W]*%>/gm), Vt = D(/\$\{[\w\W]*/gm), $t = D(/^data-[\-\w.\u00B7-\uFFFF]+$/), jt = D(/^aria-[\-\w]+$/), Qe = D(
94
+ /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
95
+ // eslint-disable-line no-useless-escape
96
+ ), Kt = D(/^(?:\w+script|data):/i), Xt = D(
97
+ /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
98
+ // eslint-disable-line no-control-regex
99
+ ), Je = D(/^html$/i), qt = D(/^[a-z][.\w]*(-[.\w]+)+$/i);
100
+ var et = /* @__PURE__ */ Object.freeze({
101
+ __proto__: null,
102
+ ARIA_ATTR: jt,
103
+ ATTR_WHITESPACE: Xt,
104
+ CUSTOM_ELEMENT: qt,
105
+ DATA_ATTR: $t,
106
+ DOCTYPE_NAME: Je,
107
+ ERB_EXPR: Yt,
108
+ IS_ALLOWED_URI: Qe,
109
+ IS_SCRIPT_OR_DATA: Kt,
110
+ MUSTACHE_EXPR: Bt,
111
+ TMPLIT_EXPR: Vt
112
+ });
113
+ const ne = {
114
+ element: 1,
115
+ text: 3,
116
+ // Deprecated
117
+ progressingInstruction: 7,
118
+ comment: 8,
119
+ document: 9
120
+ }, Zt = function() {
121
+ return typeof window > "u" ? null : window;
122
+ }, Qt = function(o, f) {
123
+ if (typeof o != "object" || typeof o.createPolicy != "function")
124
+ return null;
125
+ let u = null;
126
+ const w = "data-tt-policy-suffix";
127
+ f && f.hasAttribute(w) && (u = f.getAttribute(w));
128
+ const x = "dompurify" + (u ? "#" + u : "");
129
+ try {
130
+ return o.createPolicy(x, {
131
+ createHTML(z) {
132
+ return z;
133
+ },
134
+ createScriptURL(z) {
135
+ return z;
136
+ }
137
+ });
138
+ } catch {
139
+ return console.warn("TrustedTypes policy " + x + " could not be created."), null;
140
+ }
141
+ }, tt = function() {
142
+ return {
143
+ afterSanitizeAttributes: [],
144
+ afterSanitizeElements: [],
145
+ afterSanitizeShadowDOM: [],
146
+ beforeSanitizeAttributes: [],
147
+ beforeSanitizeElements: [],
148
+ beforeSanitizeShadowDOM: [],
149
+ uponSanitizeAttribute: [],
150
+ uponSanitizeElement: [],
151
+ uponSanitizeShadowNode: []
152
+ };
153
+ };
154
+ function nt() {
155
+ let c = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Zt();
156
+ const o = (r) => nt(r);
157
+ if (o.version = "3.2.6", o.removed = [], !c || !c.document || c.document.nodeType !== ne.document || !c.Element)
158
+ return o.isSupported = !1, o;
159
+ let {
160
+ document: f
161
+ } = c;
162
+ const u = f, w = u.currentScript, {
163
+ DocumentFragment: x,
164
+ HTMLTemplateElement: z,
165
+ Node: Oe,
166
+ Element: it,
167
+ NodeFilter: ie,
168
+ NamedNodeMap: en = c.NamedNodeMap || c.MozNamedAttrMap,
169
+ HTMLFormElement: tn,
170
+ DOMParser: nn,
171
+ trustedTypes: pe
172
+ } = c, oe = it.prototype, on = te(oe, "cloneNode"), rn = te(oe, "remove"), sn = te(oe, "nextSibling"), an = te(oe, "childNodes"), he = te(oe, "parentNode");
173
+ if (typeof z == "function") {
174
+ const r = f.createElement("template");
175
+ r.content && r.content.ownerDocument && (f = r.content.ownerDocument);
176
+ }
177
+ let O, re = "";
178
+ const {
179
+ implementation: be,
180
+ createNodeIterator: ln,
181
+ createDocumentFragment: cn,
182
+ getElementsByTagName: un
183
+ } = f, {
184
+ importNode: fn
185
+ } = u;
186
+ let b = tt();
187
+ o.isSupported = typeof s == "function" && typeof he == "function" && be && be.createHTMLDocument !== void 0;
188
+ const {
189
+ MUSTACHE_EXPR: ve,
190
+ ERB_EXPR: Me,
191
+ TMPLIT_EXPR: Ce,
192
+ DATA_ATTR: mn,
193
+ ARIA_ATTR: dn,
194
+ IS_SCRIPT_OR_DATA: pn,
195
+ ATTR_WHITESPACE: ot,
196
+ CUSTOM_ELEMENT: hn
197
+ } = et;
198
+ let {
199
+ IS_ALLOWED_URI: rt
200
+ } = et, _ = null;
201
+ const st = a({}, [...Ke, ...Re, ...De, ...Ie, ...Xe]);
202
+ let S = null;
203
+ const at = a({}, [...qe, ...Le, ...Ze, ...de]);
204
+ let h = Object.seal(q(null, {
205
+ tagNameCheck: {
206
+ writable: !0,
207
+ configurable: !1,
208
+ enumerable: !0,
209
+ value: null
210
+ },
211
+ attributeNameCheck: {
212
+ writable: !0,
213
+ configurable: !1,
214
+ enumerable: !0,
215
+ value: null
216
+ },
217
+ allowCustomizedBuiltInElements: {
218
+ writable: !0,
219
+ configurable: !1,
220
+ enumerable: !0,
221
+ value: !1
222
+ }
223
+ })), se = null, Ne = null, lt = !0, xe = !0, ct = !1, ut = !0, F = !1, ge = !0, U = !1, Pe = !1, ke = !1, G = !1, Ee = !1, Te = !1, ft = !0, mt = !1;
224
+ const gn = "user-content-";
225
+ let He = !0, ae = !1, B = {}, Y = null;
226
+ const dt = a({}, ["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"]);
227
+ let pt = null;
228
+ const ht = a({}, ["audio", "video", "img", "source", "image", "track"]);
229
+ let Ue = null;
230
+ const gt = a({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), _e = "http://www.w3.org/1998/Math/MathML", Ae = "http://www.w3.org/2000/svg", P = "http://www.w3.org/1999/xhtml";
231
+ let V = P, We = !1, ze = null;
232
+ const En = a({}, [_e, Ae, P], ye);
233
+ let Se = a({}, ["mi", "mo", "mn", "ms", "mtext"]), we = a({}, ["annotation-xml"]);
234
+ const Tn = a({}, ["title", "style", "font", "a", "script"]);
235
+ let le = null;
236
+ const _n = ["application/xhtml+xml", "text/html"], An = "text/html";
237
+ let A = null, $ = null;
238
+ const Sn = f.createElement("form"), Et = function(e) {
239
+ return e instanceof RegExp || e instanceof Function;
240
+ }, Fe = function() {
241
+ let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
242
+ if (!($ && $ === e)) {
243
+ if ((!e || typeof e != "object") && (e = {}), e = N(e), le = // eslint-disable-next-line unicorn/prefer-includes
244
+ _n.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? An : e.PARSER_MEDIA_TYPE, A = le === "application/xhtml+xml" ? ye : me, _ = M(e, "ALLOWED_TAGS") ? a({}, e.ALLOWED_TAGS, A) : st, S = M(e, "ALLOWED_ATTR") ? a({}, e.ALLOWED_ATTR, A) : at, ze = M(e, "ALLOWED_NAMESPACES") ? a({}, e.ALLOWED_NAMESPACES, ye) : En, Ue = M(e, "ADD_URI_SAFE_ATTR") ? a(N(gt), e.ADD_URI_SAFE_ATTR, A) : gt, pt = M(e, "ADD_DATA_URI_TAGS") ? a(N(ht), e.ADD_DATA_URI_TAGS, A) : ht, Y = M(e, "FORBID_CONTENTS") ? a({}, e.FORBID_CONTENTS, A) : dt, se = M(e, "FORBID_TAGS") ? a({}, e.FORBID_TAGS, A) : N({}), Ne = M(e, "FORBID_ATTR") ? a({}, e.FORBID_ATTR, A) : N({}), B = M(e, "USE_PROFILES") ? e.USE_PROFILES : !1, lt = e.ALLOW_ARIA_ATTR !== !1, xe = e.ALLOW_DATA_ATTR !== !1, ct = e.ALLOW_UNKNOWN_PROTOCOLS || !1, ut = e.ALLOW_SELF_CLOSE_IN_ATTR !== !1, F = e.SAFE_FOR_TEMPLATES || !1, ge = e.SAFE_FOR_XML !== !1, U = e.WHOLE_DOCUMENT || !1, G = e.RETURN_DOM || !1, Ee = e.RETURN_DOM_FRAGMENT || !1, Te = e.RETURN_TRUSTED_TYPE || !1, ke = e.FORCE_BODY || !1, ft = e.SANITIZE_DOM !== !1, mt = e.SANITIZE_NAMED_PROPS || !1, He = e.KEEP_CONTENT !== !1, ae = e.IN_PLACE || !1, rt = e.ALLOWED_URI_REGEXP || Qe, V = e.NAMESPACE || P, Se = e.MATHML_TEXT_INTEGRATION_POINTS || Se, we = e.HTML_INTEGRATION_POINTS || we, h = e.CUSTOM_ELEMENT_HANDLING || {}, e.CUSTOM_ELEMENT_HANDLING && Et(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (h.tagNameCheck = e.CUSTOM_ELEMENT_HANDLING.tagNameCheck), e.CUSTOM_ELEMENT_HANDLING && Et(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (h.attributeNameCheck = e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), e.CUSTOM_ELEMENT_HANDLING && typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (h.allowCustomizedBuiltInElements = e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), F && (xe = !1), Ee && (G = !0), B && (_ = a({}, Xe), S = [], B.html === !0 && (a(_, Ke), a(S, qe)), B.svg === !0 && (a(_, Re), a(S, Le), a(S, de)), B.svgFilters === !0 && (a(_, De), a(S, Le), a(S, de)), B.mathMl === !0 && (a(_, Ie), a(S, Ze), a(S, de))), e.ADD_TAGS && (_ === st && (_ = N(_)), a(_, e.ADD_TAGS, A)), e.ADD_ATTR && (S === at && (S = N(S)), a(S, e.ADD_ATTR, A)), e.ADD_URI_SAFE_ATTR && a(Ue, e.ADD_URI_SAFE_ATTR, A), e.FORBID_CONTENTS && (Y === dt && (Y = N(Y)), a(Y, e.FORBID_CONTENTS, A)), He && (_["#text"] = !0), U && a(_, ["html", "head", "body"]), _.table && (a(_, ["tbody"]), delete se.tbody), e.TRUSTED_TYPES_POLICY) {
245
+ if (typeof e.TRUSTED_TYPES_POLICY.createHTML != "function")
246
+ throw ee('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
247
+ if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function")
248
+ throw ee('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
249
+ O = e.TRUSTED_TYPES_POLICY, re = O.createHTML("");
250
+ } else
251
+ O === void 0 && (O = Qt(pe, w)), O !== null && typeof re == "string" && (re = O.createHTML(""));
252
+ m && m(e), $ = e;
253
+ }
254
+ }, Tt = a({}, [...Re, ...De, ...Ft]), _t = a({}, [...Ie, ...Gt]), wn = function(e) {
255
+ let t = he(e);
256
+ (!t || !t.tagName) && (t = {
257
+ namespaceURI: V,
258
+ tagName: "template"
259
+ });
260
+ const i = me(e.tagName), p = me(t.tagName);
261
+ return ze[e.namespaceURI] ? e.namespaceURI === Ae ? t.namespaceURI === P ? i === "svg" : t.namespaceURI === _e ? i === "svg" && (p === "annotation-xml" || Se[p]) : !!Tt[i] : e.namespaceURI === _e ? t.namespaceURI === P ? i === "math" : t.namespaceURI === Ae ? i === "math" && we[p] : !!_t[i] : e.namespaceURI === P ? t.namespaceURI === Ae && !we[p] || t.namespaceURI === _e && !Se[p] ? !1 : !_t[i] && (Tn[i] || !Tt[i]) : !!(le === "application/xhtml+xml" && ze[e.namespaceURI]) : !1;
262
+ }, C = function(e) {
263
+ Q(o.removed, {
264
+ element: e
265
+ });
266
+ try {
267
+ he(e).removeChild(e);
268
+ } catch {
269
+ rn(e);
270
+ }
271
+ }, j = function(e, t) {
272
+ try {
273
+ Q(o.removed, {
274
+ attribute: t.getAttributeNode(e),
275
+ from: t
276
+ });
277
+ } catch {
278
+ Q(o.removed, {
279
+ attribute: null,
280
+ from: t
281
+ });
282
+ }
283
+ if (t.removeAttribute(e), e === "is")
284
+ if (G || Ee)
285
+ try {
286
+ C(t);
287
+ } catch {
288
+ }
289
+ else
290
+ try {
291
+ t.setAttribute(e, "");
292
+ } catch {
293
+ }
294
+ }, At = function(e) {
295
+ let t = null, i = null;
296
+ if (ke)
297
+ e = "<remove></remove>" + e;
298
+ else {
299
+ const g = je(e, /^[\r\n\t ]+/);
300
+ i = g && g[0];
301
+ }
302
+ le === "application/xhtml+xml" && V === P && (e = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + e + "</body></html>");
303
+ const p = O ? O.createHTML(e) : e;
304
+ if (V === P)
305
+ try {
306
+ t = new nn().parseFromString(p, le);
307
+ } catch {
308
+ }
309
+ if (!t || !t.documentElement) {
310
+ t = be.createDocument(V, "template", null);
311
+ try {
312
+ t.documentElement.innerHTML = We ? re : p;
313
+ } catch {
314
+ }
315
+ }
316
+ const y = t.body || t.documentElement;
317
+ return e && i && y.insertBefore(f.createTextNode(i), y.childNodes[0] || null), V === P ? un.call(t, U ? "html" : "body")[0] : U ? t.documentElement : y;
318
+ }, St = function(e) {
319
+ return ln.call(
320
+ e.ownerDocument || e,
321
+ e,
322
+ // eslint-disable-next-line no-bitwise
323
+ ie.SHOW_ELEMENT | ie.SHOW_COMMENT | ie.SHOW_TEXT | ie.SHOW_PROCESSING_INSTRUCTION | ie.SHOW_CDATA_SECTION,
324
+ null
325
+ );
326
+ }, Ge = function(e) {
327
+ return e instanceof tn && (typeof e.nodeName != "string" || typeof e.textContent != "string" || typeof e.removeChild != "function" || !(e.attributes instanceof en) || typeof e.removeAttribute != "function" || typeof e.setAttribute != "function" || typeof e.namespaceURI != "string" || typeof e.insertBefore != "function" || typeof e.hasChildNodes != "function");
328
+ }, wt = function(e) {
329
+ return typeof Oe == "function" && e instanceof Oe;
330
+ };
331
+ function k(r, e, t) {
332
+ fe(r, (i) => {
333
+ i.call(o, e, t, $);
334
+ });
335
+ }
336
+ const yt = function(e) {
337
+ let t = null;
338
+ if (k(b.beforeSanitizeElements, e, null), Ge(e))
339
+ return C(e), !0;
340
+ const i = A(e.nodeName);
341
+ if (k(b.uponSanitizeElement, e, {
342
+ tagName: i,
343
+ allowedTags: _
344
+ }), ge && e.hasChildNodes() && !wt(e.firstElementChild) && I(/<[/\w!]/g, e.innerHTML) && I(/<[/\w!]/g, e.textContent) || e.nodeType === ne.progressingInstruction || ge && e.nodeType === ne.comment && I(/<[/\w]/g, e.data))
345
+ return C(e), !0;
346
+ if (!_[i] || se[i]) {
347
+ if (!se[i] && Dt(i) && (h.tagNameCheck instanceof RegExp && I(h.tagNameCheck, i) || h.tagNameCheck instanceof Function && h.tagNameCheck(i)))
348
+ return !1;
349
+ if (He && !Y[i]) {
350
+ const p = he(e) || e.parentNode, y = an(e) || e.childNodes;
351
+ if (y && p) {
352
+ const g = y.length;
353
+ for (let v = g - 1; v >= 0; --v) {
354
+ const H = on(y[v], !0);
355
+ H.__removalCount = (e.__removalCount || 0) + 1, p.insertBefore(H, sn(e));
356
+ }
357
+ }
358
+ }
359
+ return C(e), !0;
360
+ }
361
+ return e instanceof it && !wn(e) || (i === "noscript" || i === "noembed" || i === "noframes") && I(/<\/no(script|embed|frames)/i, e.innerHTML) ? (C(e), !0) : (F && e.nodeType === ne.text && (t = e.textContent, fe([ve, Me, Ce], (p) => {
362
+ t = J(t, p, " ");
363
+ }), e.textContent !== t && (Q(o.removed, {
364
+ element: e.cloneNode()
365
+ }), e.textContent = t)), k(b.afterSanitizeElements, e, null), !1);
366
+ }, Rt = function(e, t, i) {
367
+ if (ft && (t === "id" || t === "name") && (i in f || i in Sn))
368
+ return !1;
369
+ if (!(xe && !Ne[t] && I(mn, t))) {
370
+ if (!(lt && I(dn, t))) {
371
+ if (!S[t] || Ne[t]) {
372
+ if (
373
+ // First condition does a very basic check if a) it's basically a valid custom element tagname AND
374
+ // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
375
+ // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
376
+ !(Dt(e) && (h.tagNameCheck instanceof RegExp && I(h.tagNameCheck, e) || h.tagNameCheck instanceof Function && h.tagNameCheck(e)) && (h.attributeNameCheck instanceof RegExp && I(h.attributeNameCheck, t) || h.attributeNameCheck instanceof Function && h.attributeNameCheck(t)) || // Alternative, second condition checks if it's an `is`-attribute, AND
377
+ // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
378
+ t === "is" && h.allowCustomizedBuiltInElements && (h.tagNameCheck instanceof RegExp && I(h.tagNameCheck, i) || h.tagNameCheck instanceof Function && h.tagNameCheck(i)))
379
+ ) return !1;
380
+ } else if (!Ue[t]) {
381
+ if (!I(rt, J(i, ot, ""))) {
382
+ if (!((t === "src" || t === "xlink:href" || t === "href") && e !== "script" && Ht(i, "data:") === 0 && pt[e])) {
383
+ if (!(ct && !I(pn, J(i, ot, "")))) {
384
+ if (i)
385
+ return !1;
386
+ }
387
+ }
388
+ }
389
+ }
390
+ }
391
+ }
392
+ return !0;
393
+ }, Dt = function(e) {
394
+ return e !== "annotation-xml" && je(e, hn);
395
+ }, It = function(e) {
396
+ k(b.beforeSanitizeAttributes, e, null);
397
+ const {
398
+ attributes: t
399
+ } = e;
400
+ if (!t || Ge(e))
401
+ return;
402
+ const i = {
403
+ attrName: "",
404
+ attrValue: "",
405
+ keepAttr: !0,
406
+ allowedAttributes: S,
407
+ forceKeepAttr: void 0
408
+ };
409
+ let p = t.length;
410
+ for (; p--; ) {
411
+ const y = t[p], {
412
+ name: g,
413
+ namespaceURI: v,
414
+ value: H
415
+ } = y, ce = A(g), Be = H;
416
+ let R = g === "value" ? Be : Ut(Be);
417
+ if (i.attrName = ce, i.attrValue = R, i.keepAttr = !0, i.forceKeepAttr = void 0, k(b.uponSanitizeAttribute, e, i), R = i.attrValue, mt && (ce === "id" || ce === "name") && (j(g, e), R = gn + R), ge && I(/((--!?|])>)|<\/(style|title)/i, R)) {
418
+ j(g, e);
419
+ continue;
420
+ }
421
+ if (i.forceKeepAttr)
422
+ continue;
423
+ if (!i.keepAttr) {
424
+ j(g, e);
425
+ continue;
426
+ }
427
+ if (!ut && I(/\/>/i, R)) {
428
+ j(g, e);
429
+ continue;
430
+ }
431
+ F && fe([ve, Me, Ce], (Ot) => {
432
+ R = J(R, Ot, " ");
433
+ });
434
+ const Lt = A(e.nodeName);
435
+ if (!Rt(Lt, ce, R)) {
436
+ j(g, e);
437
+ continue;
438
+ }
439
+ if (O && typeof pe == "object" && typeof pe.getAttributeType == "function" && !v)
440
+ switch (pe.getAttributeType(Lt, ce)) {
441
+ case "TrustedHTML": {
442
+ R = O.createHTML(R);
443
+ break;
444
+ }
445
+ case "TrustedScriptURL": {
446
+ R = O.createScriptURL(R);
447
+ break;
448
+ }
449
+ }
450
+ if (R !== Be)
451
+ try {
452
+ v ? e.setAttributeNS(v, g, R) : e.setAttribute(g, R), Ge(e) ? C(e) : $e(o.removed);
453
+ } catch {
454
+ j(g, e);
455
+ }
456
+ }
457
+ k(b.afterSanitizeAttributes, e, null);
458
+ }, yn = function r(e) {
459
+ let t = null;
460
+ const i = St(e);
461
+ for (k(b.beforeSanitizeShadowDOM, e, null); t = i.nextNode(); )
462
+ k(b.uponSanitizeShadowNode, t, null), yt(t), It(t), t.content instanceof x && r(t.content);
463
+ k(b.afterSanitizeShadowDOM, e, null);
464
+ };
465
+ return o.sanitize = function(r) {
466
+ let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, t = null, i = null, p = null, y = null;
467
+ if (We = !r, We && (r = "<!-->"), typeof r != "string" && !wt(r))
468
+ if (typeof r.toString == "function") {
469
+ if (r = r.toString(), typeof r != "string")
470
+ throw ee("dirty is not a string, aborting");
471
+ } else
472
+ throw ee("toString is not a function");
473
+ if (!o.isSupported)
474
+ return r;
475
+ if (Pe || Fe(e), o.removed = [], typeof r == "string" && (ae = !1), ae) {
476
+ if (r.nodeName) {
477
+ const H = A(r.nodeName);
478
+ if (!_[H] || se[H])
479
+ throw ee("root node is forbidden and cannot be sanitized in-place");
480
+ }
481
+ } else if (r instanceof Oe)
482
+ t = At("<!---->"), i = t.ownerDocument.importNode(r, !0), i.nodeType === ne.element && i.nodeName === "BODY" || i.nodeName === "HTML" ? t = i : t.appendChild(i);
483
+ else {
484
+ if (!G && !F && !U && // eslint-disable-next-line unicorn/prefer-includes
485
+ r.indexOf("<") === -1)
486
+ return O && Te ? O.createHTML(r) : r;
487
+ if (t = At(r), !t)
488
+ return G ? null : Te ? re : "";
489
+ }
490
+ t && ke && C(t.firstChild);
491
+ const g = St(ae ? r : t);
492
+ for (; p = g.nextNode(); )
493
+ yt(p), It(p), p.content instanceof x && yn(p.content);
494
+ if (ae)
495
+ return r;
496
+ if (G) {
497
+ if (Ee)
498
+ for (y = cn.call(t.ownerDocument); t.firstChild; )
499
+ y.appendChild(t.firstChild);
500
+ else
501
+ y = t;
502
+ return (S.shadowroot || S.shadowrootmode) && (y = fn.call(u, y, !0)), y;
503
+ }
504
+ let v = U ? t.outerHTML : t.innerHTML;
505
+ return U && _["!doctype"] && t.ownerDocument && t.ownerDocument.doctype && t.ownerDocument.doctype.name && I(Je, t.ownerDocument.doctype.name) && (v = "<!DOCTYPE " + t.ownerDocument.doctype.name + `>
506
+ ` + v), F && fe([ve, Me, Ce], (H) => {
507
+ v = J(v, H, " ");
508
+ }), O && Te ? O.createHTML(v) : v;
509
+ }, o.setConfig = function() {
510
+ let r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
511
+ Fe(r), Pe = !0;
512
+ }, o.clearConfig = function() {
513
+ $ = null, Pe = !1;
514
+ }, o.isValidAttribute = function(r, e, t) {
515
+ $ || Fe({});
516
+ const i = A(r), p = A(e);
517
+ return Rt(i, p, t);
518
+ }, o.addHook = function(r, e) {
519
+ typeof e == "function" && Q(b[r], e);
520
+ }, o.removeHook = function(r, e) {
521
+ if (e !== void 0) {
522
+ const t = Pt(b[r], e);
523
+ return t === -1 ? void 0 : kt(b[r], t, 1)[0];
524
+ }
525
+ return $e(b[r]);
526
+ }, o.removeHooks = function(r) {
527
+ b[r] = [];
528
+ }, o.removeAllHooks = function() {
529
+ b = tt();
530
+ }, o;
531
+ }
532
+ var Jt = nt();
533
+ return Ye = Jt, Ye;
534
+ }
535
+ var Ve, Mt;
536
+ function Ln() {
537
+ return Mt || (Mt = 1, Ve = window.DOMPurify || (window.DOMPurify = vt().default || vt())), Ve;
538
+ }
539
+ var On = Ln();
540
+ const bn = /* @__PURE__ */ In(On), vn = ({ color: s }) => {
541
+ const n = `
542
+ <svg
543
+ width="48"
544
+ height="48"
545
+ class="loader"
546
+ id="Layer_2" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48">
547
+ <defs>
548
+ <style>
549
+ .loader {
550
+ width: 48px;
551
+ height: 48px;
552
+ border: 6px solid ${s};
553
+ border-bottom-color: transparent;
554
+ border-radius: 50%;
555
+ display: inline-block;
556
+ box-sizing: border-box;
557
+ animation: rotation 1s linear infinite;
558
+ }
559
+
560
+ @keyframes rotation {
561
+ 0% {
562
+ transform: rotate(0deg);
563
+ }
564
+ 100% {
565
+ transform: rotate(360deg);
566
+ }
567
+ }
568
+ </style>
569
+ </defs>
570
+ <circle
571
+
572
+ cx="24"
573
+ cy="24"
574
+ r="20"
575
+ fill="none"
576
+ stroke="none"
577
+ strokeWidth="5"
578
+ strokeDasharray="125.6"
579
+ strokeDashoffset="62.8"
580
+ />
581
+ </svg>
582
+ `;
583
+ return bn.sanitize(n, {
584
+ ALLOWED_TAGS: ["style", "def"],
585
+ ALLOWED_ATTR: ["class"],
586
+ USE_PROFILES: { svg: !0 }
587
+ });
588
+ }, X = (s, n) => {
589
+ Object.entries(n).forEach(([l, d]) => {
590
+ d !== void 0 && (s.style[l] = d);
591
+ });
592
+ }, K = /* @__PURE__ */ new Map();
593
+ function ue({ element: s, event: n, handler: l }) {
594
+ s.addEventListener(n, l), K.has(s) || K.set(s, []), K.get(s).push({ event: n, handler: l });
595
+ }
596
+ function Ct(s) {
597
+ K.has(s) && (K.get(s).forEach(({ event: l, handler: d }) => {
598
+ s.removeEventListener(l, d);
599
+ }), K.delete(s));
600
+ }
601
+ const Mn = ({
602
+ removeElementFromDOM: s,
603
+ onDismiss: n
604
+ }) => {
605
+ const l = {
606
+ width: "100%",
607
+ height: window.innerHeight + "px",
608
+ position: "fixed",
609
+ margin: "0px",
610
+ top: "0",
611
+ left: "0",
612
+ display: "flex",
613
+ justifyContent: "center",
614
+ alignItems: "center",
615
+ zIndex: "1400"
616
+ }, d = document.createElement("div"), T = () => {
617
+ s(), n && n();
618
+ }, m = document.createElement("div");
619
+ return m.innerHTML = vn({ color: "#d9d9d9" }), ue({
620
+ element: d,
621
+ event: "click",
622
+ handler: T
623
+ }), d.setAttribute("id", "MainWindow"), X(m, {
624
+ position: "fixed",
625
+ display: "flex",
626
+ justifyContent: "center",
627
+ alignItems: "center",
628
+ top: "0px",
629
+ width: "100%",
630
+ height: "100%",
631
+ backgroundColor: "rgba(0,0,0,.55)",
632
+ zIndex: "-1"
633
+ }), X(d, l), d.append(m), d;
634
+ }, Nt = () => innerWidth > 1080 && innerWidth > innerHeight ? {
635
+ width: `${innerHeight * 0.7 * (9 / 16)}px`,
636
+ height: `${innerHeight * 0.7}px`
637
+ } : {
638
+ width: "95%",
639
+ height: "95%"
640
+ };
641
+ function xt(s) {
642
+ const n = s.toLowerCase().trim(), d = {
643
+ development: "dev",
644
+ production: "prod"
645
+ }[n] || n, T = {
646
+ dev: "https://face-dev.vultpayments.dev",
647
+ stage: "https://face-stage.vultpayments.dev",
648
+ demo: "https://face-demo.vultsecurity.com",
649
+ prod: "https://face.vultsecurity.com"
650
+ };
651
+ return T[d] ? T[d] : (console.warn(`Unknown environment: ${s}. Using dev domain as default.`), T.dev);
652
+ }
653
+ const Cn = async ({
654
+ KYC_VARS: s
655
+ }) => {
656
+ const n = xt(s.env), l = document.createElement("div");
657
+ l.setAttribute("id", "Iframe_Container");
658
+ const d = Nt();
659
+ X(l, {
660
+ width: d.width,
661
+ height: d.height,
662
+ overflow: "hidden",
663
+ borderRadius: "20px"
664
+ });
665
+ const T = document.createElement("iframe");
666
+ return ue({
667
+ element: T,
668
+ event: "load",
669
+ handler: () => {
670
+ const m = document.getElementById(
671
+ "KYC_WIDGET"
672
+ );
673
+ m && setTimeout(() => {
674
+ m.contentWindow && (m.contentWindow.postMessage(
675
+ "Incoming from kyc",
676
+ n
677
+ ), m.contentWindow.postMessage(
678
+ {
679
+ type: "RESPONSE_WINDOW_SIZE",
680
+ data: {
681
+ innerWidth: window.innerWidth,
682
+ innerHeight: window.innerHeight,
683
+ success: !0
684
+ }
685
+ },
686
+ n
687
+ ));
688
+ }, 1e3);
689
+ }
690
+ }), T.id = "KYC_WIDGET", T.allow = "camera", T.height = `${window.innerHeight}px`, window.innerWidth >= 768 ? T.src = `${n}/show-qr${s.sessionURL}/${s.session_id}` : T.src = `${n}${s.sessionURL}/${s.session_id}`, X(T, {
691
+ border: "0px",
692
+ width: "100%",
693
+ height: "100%",
694
+ overflow: "hidden",
695
+ borderRadius: "20px"
696
+ }), l.append(T), l;
697
+ };
698
+ class xn {
699
+ constructor(n) {
700
+ E(this, "KYC_VARS", {
701
+ session_id: "",
702
+ onComplete: function() {
703
+ },
704
+ onDismiss: function() {
705
+ },
706
+ Session_Type: "IDVerification",
707
+ sessionURL: "",
708
+ env: "dev"
709
+ });
710
+ E(this, "locationData", null);
711
+ E(this, "isResizing", !1);
712
+ E(this, "resizeTimerID", null);
713
+ E(this, "domain", "");
714
+ E(this, "previousWidth", 0);
715
+ E(this, "previousHeight", 0);
716
+ // Threshold for considering a resize significant (address bars typically change height by ~50-100px)
717
+ E(this, "RESIZE_THRESHOLD_HEIGHT", 100);
718
+ E(this, "RESIZE_THRESHOLD_WIDTH", 50);
719
+ E(this, "windowEventListener", (n) => {
720
+ const l = n;
721
+ if (l.data.type === "REQUEST_WINDOW_SIZE") {
722
+ const d = document.getElementById("KYC_WIDGET");
723
+ d && d.contentWindow && d.contentWindow.postMessage(
724
+ {
725
+ type: "RESPONSE_WINDOW_SIZE",
726
+ data: {
727
+ innerWidth: window.innerWidth,
728
+ innerHeight: window.innerHeight,
729
+ success: !0
730
+ }
731
+ },
732
+ this.domain
733
+ );
734
+ }
735
+ if (l.data.type === "APP_STATUS")
736
+ switch (l.data.data.status) {
737
+ case "complete": {
738
+ if (this.KYC_VARS.onComplete) {
739
+ if (l.data.data.response) {
740
+ this.KYC_VARS.onComplete(l.data.data.response);
741
+ return;
742
+ }
743
+ this.KYC_VARS.onComplete();
744
+ }
745
+ break;
746
+ }
747
+ case "testing": {
748
+ console.log(l.data.data.status);
749
+ break;
750
+ }
751
+ }
752
+ });
753
+ E(this, "setLocationData", (n) => {
754
+ this.locationData = n;
755
+ });
756
+ E(this, "resizeHandler", () => {
757
+ console.log("resize");
758
+ const n = window.innerWidth, l = window.innerHeight, d = Math.abs(n - this.previousWidth), T = Math.abs(l - this.previousHeight);
759
+ if (!(this.previousWidth === 0 && this.previousHeight === 0 || d >= this.RESIZE_THRESHOLD_WIDTH || T >= this.RESIZE_THRESHOLD_HEIGHT)) {
760
+ console.log("resize ignored (likely address bar hide/show on mobile)");
761
+ return;
762
+ }
763
+ this.isResizing = !0, this.resizeTimerID && clearTimeout(this.resizeTimerID), this.resizeTimerID = setTimeout(() => {
764
+ console.log("triggered state change");
765
+ const D = document.getElementById(
766
+ "KYC_WIDGET"
767
+ ), q = document.getElementById(
768
+ "MainWindow"
769
+ ), Z = document.getElementById(
770
+ "Iframe_Container"
771
+ ), W = Nt();
772
+ X(Z, {
773
+ width: W.width,
774
+ height: W.height
775
+ }), X(q, {
776
+ width: `${window.innerWidth}px`,
777
+ height: `${window.innerHeight}px`
778
+ }), D.contentWindow && (D.contentWindow.postMessage(
779
+ {
780
+ type: "RESPONSE_PARENT_RESIZED",
781
+ data: {
782
+ innerWidth: window.innerWidth,
783
+ innerHeight: window.innerHeight,
784
+ success: !0
785
+ }
786
+ },
787
+ this.domain
788
+ ), console.log(q), console.log("triggered state change")), this.previousWidth = window.innerWidth, this.previousHeight = window.innerHeight;
789
+ }, 1e3);
790
+ });
791
+ E(this, "setupResizingServices", () => {
792
+ this.previousWidth = window.innerWidth, this.previousHeight = window.innerHeight, ue({
793
+ element: window,
794
+ event: "resize",
795
+ handler: this.resizeHandler
796
+ });
797
+ });
798
+ E(this, "setUpHtml", async () => {
799
+ try {
800
+ const n = Mn({
801
+ removeElementFromDOM: this.close,
802
+ onDismiss: this.KYC_VARS.onDismiss
803
+ });
804
+ window.document.body.append(n);
805
+ const l = await Cn({
806
+ KYC_VARS: this.KYC_VARS,
807
+ setLocationData: this.setLocationData
808
+ });
809
+ n.append(l);
810
+ } catch {
811
+ console.error("Error setting up HTML");
812
+ }
813
+ });
814
+ E(this, "setSessionType", (n) => n.Session_Type === "IDAuthentication" ? "/authenticate" : n.Session_Type === "IDVerification" ? "/verify" : "");
815
+ // start - creates HTML div elements and appends to DOM body element.
816
+ E(this, "startIDVerify", async (n) => {
817
+ try {
818
+ if (!n || n === "") {
819
+ console.error("You need a session ID to continue");
820
+ return;
821
+ }
822
+ this.KYC_VARS = {
823
+ ...this.KYC_VARS,
824
+ session_id: n
825
+ }, await this.setUpHtml(), this.setupResizingServices(), ue({
826
+ element: window,
827
+ event: "message",
828
+ handler: this.windowEventListener
829
+ });
830
+ } catch {
831
+ console.error("There was an error starting ID Authentication.");
832
+ }
833
+ });
834
+ E(this, "startIDAuthenticate", async (n) => {
835
+ try {
836
+ if (!n || n === "") {
837
+ console.error("You need a session ID to continue");
838
+ return;
839
+ }
840
+ this.KYC_VARS = {
841
+ ...this.KYC_VARS,
842
+ session_id: n
843
+ }, this.setUpHtml(), this.setupResizingServices(), ue({
844
+ element: window,
845
+ event: "message",
846
+ handler: this.windowEventListener
847
+ });
848
+ } catch {
849
+ console.error("There was an error starting ID Authentication.");
850
+ }
851
+ });
852
+ E(this, "close", () => {
853
+ const n = document.getElementById("MainWindow");
854
+ n == null || n.remove();
855
+ const l = document.getElementById("KYC_WIDGET");
856
+ n && Ct(n), l && Ct(l), window.removeEventListener("resize", this.resizeHandler), window.removeEventListener("message", this.windowEventListener);
857
+ });
858
+ if (!n) {
859
+ console.error("Cannot initiate without initial configuration.");
860
+ return;
861
+ }
862
+ if (!n.Session_Type) {
863
+ console.error("Cannot initiate without a Session_Type.");
864
+ return;
865
+ }
866
+ if (!n.env) {
867
+ console.error("Environment is required. Please provide a valid environment.");
868
+ return;
869
+ }
870
+ this.domain = xt(n.env), this.KYC_VARS = {
871
+ ...n,
872
+ sessionURL: this.setSessionType(n),
873
+ session_id: ""
874
+ // Will be set when starting verification/authentication
875
+ };
876
+ }
877
+ }
878
+ const Pn = "IDAuthentication", kn = "IDVerification";
879
+ export {
880
+ Pn as IDA,
881
+ kn as IDV,
882
+ xn as KYCWidget
883
+ };
package/package.json ADDED
@@ -0,0 +1,75 @@
1
+ {
2
+ "name": "vult-security-kyc",
3
+ "version": "0.0.1",
4
+ "description": "typescript widget",
5
+ "author": "Nexrage",
6
+ "license": "ISC",
7
+ "main": "./build/vult-kyc-widget.es.js",
8
+ "module": "./build/vult-kyc-widget.es.js",
9
+ "type": "module",
10
+ "types": "./build/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./build/index.d.ts",
14
+ "import": "./build/vult-kyc-widget.es.js",
15
+ "default": "./build/vult-kyc-widget.es.js"
16
+ },
17
+ "./components": {
18
+ "types": "./build/client-apps/components.d.ts",
19
+ "import": "./build/client-apps/components.js",
20
+ "default": "./build/client-apps/components.js"
21
+ }
22
+ },
23
+ "files": [
24
+ "build"
25
+ ],
26
+ "scripts": {
27
+ "start:dev": "yarn env:dev && vite --host --port 8200",
28
+ "start:demo": "yarn env:demo && vite --host --port 8200",
29
+ "start:stage": "yarn env:stage && vite --host --port 8200",
30
+ "start:prod": "yarn env:prod && vite --host --port 8200",
31
+ "start:local": "yarn env:local && vite --host --port 8200",
32
+ "start:frontend": "yarn env:frontend && vite --host --port 8200",
33
+ "env:frontend": "node client-configs/env.js VITE_BUILD=dev VITE_DOMAIN=https://#/",
34
+ "env:dev": "node client-configs/env.js VITE_BUILD=dev VITE_KYC=VULT VITE_DOMAIN=https://face-dev.vultpayments.dev",
35
+ "env:stage": "node client-configs/env.js VITE_BUILD=stage VITE_DOMAIN=https://face-stage.vultpayments.dev",
36
+ "env:demo": "node client-configs/env.js VITE_BUILD=demo VITE_DOMAIN=https://face-demo.vultsecurity.com",
37
+ "env:prod": "node client-configs/env.js VITE_BUILD=prod VITE_DOMAIN=https://face.vultsecurity.com",
38
+ "env:local": "node client-configs/env.js VITE_BUILD=dev VITE_KYC=VULT VITE_DOMAIN=https://localhost:8000",
39
+ "build:dev": "yarn vite build",
40
+ "build:demo": "yarn vite build",
41
+ "build:stage": "yarn vite build",
42
+ "build:prod": "yarn vite build",
43
+ "build:flex-verify-dev": "yarn env:flex-verify-dev && vite build",
44
+ "build:flex-verify-demo": "yarn env:flex-verify-demo && vite build",
45
+ "build:flex-verify-stage": "yarn env:flex-verify-stage && vite build",
46
+ "build:flex-verify": "yarn env:flex-verify && vite build",
47
+ "build:local": "yarn env:local && vite build",
48
+ "format": "eslint --fix \"./client-{apps,configs,schemas}/**/*.{js,jsx,ts,tsx}\"",
49
+ "lint": "eslint \"./client-{apps,configs,schemas}/**/*.{js,jsx,ts,tsx}\"",
50
+ "preview": "vite preview"
51
+ },
52
+ "dependencies": {
53
+ "isomorphic-dompurify": "^2.15.0"
54
+ },
55
+ "peerDependencies": {
56
+ "react": ">=16.8.0",
57
+ "react-dom": ">=16.8.0"
58
+ },
59
+ "peerDependenciesMeta": {
60
+ "react": {
61
+ "optional": true
62
+ },
63
+ "react-dom": {
64
+ "optional": true
65
+ }
66
+ },
67
+ "devDependencies": {
68
+ "typescript": "^5.8.2",
69
+ "vite": "^6.4.1",
70
+ "vite-plugin-dts": "^4.5.4",
71
+ "vite-plugin-externals": "^0.6.2",
72
+ "vite-plugin-mkcert": "^1.17.5",
73
+ "vite-tsconfig-paths": "^4.3.2"
74
+ }
75
+ }