@returningai/widget-sdk 1.7.1 → 1.8.0

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/CHANGELOG.md CHANGED
@@ -11,6 +11,50 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
11
11
 
12
12
  ---
13
13
 
14
+ ## [1.8.0] — 2026-07-23
15
+
16
+ ### Added
17
+
18
+ - Added the fire-and-forget Milestone `milestoneCtaClick` host callback for
19
+ iframe and bundle modes. The payload includes the configured CTA button name,
20
+ and existing URL navigation remains independent from callback dispatch.
21
+ - Widget loaders now apply the resolved widget-specific animation, loading
22
+ text styling, and light/dark background colors returned by the widget server.
23
+ Custom widgets wait for their resolved settings on the first uncached load,
24
+ avoiding a flash of the generic loader.
25
+
26
+ ### Changed
27
+
28
+ - Bundle embeds now preload their runtime while authentication and loader
29
+ settings resolve, without executing or mounting the runtime before
30
+ authentication succeeds.
31
+ - Custom widget bundles now reuse widget data returned by authentication,
32
+ avoiding a second configuration request during mount.
33
+
34
+ ### Fixed
35
+
36
+ - Bundle embeds configured with `height="auto"` now render with natural height
37
+ and pass an explicit auto-height contract to the widget runtime so the host
38
+ page controls vertical sizing and scrolling.
39
+
40
+ ---
41
+
42
+ ## [1.7.2] — 2026-07-20
43
+
44
+ ### Fixed
45
+
46
+ - MFE-served custom widgets in iframe mode now wait for the SDK's authenticated
47
+ `postMessage` token instead of initializing with an SSR guest token.
48
+ - Custom widgets now use their configured theme when the embed omits
49
+ `theme` / `data-theme`; an explicitly supplied light or dark theme still
50
+ overrides the widget configuration in both iframe and bundle modes.
51
+ - Concurrent custom widgets in bundle mode no longer overwrite or prematurely
52
+ restore the host page's automatic-theme setting during mount and teardown.
53
+ - Widget-mounted banners now resolve CSS color tokens from the owning widget
54
+ before the document or sibling widgets, preventing cross-widget theme colors.
55
+
56
+ ---
57
+
14
58
  ## [1.7.1] — 2026-07-14
15
59
 
16
60
  ### Fixed
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Embed ReturningAI widgets on any website — React, Vue, Angular, or plain `<script>` tag. No external dependencies.
4
4
 
5
- > 🛡️ **2026-05-11 security notice — refresh-token TTL for Access Key Embed.** The auth backend now issues 0-TTL refresh tokens for Access Key Embed sessions, and rejects refresh tokens issued before this date. **No SDK update required.** See [CHANGELOG.md](./CHANGELOG.md) for the full rationale and behavior changes.
5
+ > 🛡️ **2026-05-11 security notice — refresh-token TTL for Access Key Embed.** The auth backend now issues 0-TTL refresh tokens for Access Key Embed sessions and rejects refresh tokens issued before this date. **No SDK update is required.**
6
6
 
7
7
  ---
8
8
 
@@ -335,6 +335,51 @@ Store widget.
335
335
  ></script>
336
336
  ```
337
337
 
338
+ #### Milestone CTA click callback
339
+
340
+ Milestone CTAs can notify the host page when **Trigger SDK callback on click**
341
+ is enabled in the CTA settings. Register `milestoneCtaClick` on the milestone
342
+ widget element before calling `lockCallbacks()`:
343
+
344
+ ```js
345
+ const widget = document.querySelector("rai-milestone-widget");
346
+
347
+ widget.registerCallback("milestoneCtaClick", (payload) => {
348
+ console.log("Milestone CTA clicked:", payload.context.button.name);
349
+ });
350
+
351
+ widget.lockCallbacks();
352
+ ```
353
+
354
+ The callback receives:
355
+
356
+ ```ts
357
+ {
358
+ scope: "milestone.cta_click",
359
+ callbackName: "milestoneCtaClick",
360
+ context: {
361
+ event: "milestone_cta_clicked",
362
+ community: { id: "COMMUNITY_ID", name: "Community name" },
363
+ milestone: { id: "MILESTONE_ID", name: "First deposit" },
364
+ stage: { id: "STAGE_ID", name: "Deposit funds" },
365
+ button: { name: "Deposit Funds" },
366
+ user: {
367
+ identifiers: { customIdentifier: "CUSTOMER_123" },
368
+ },
369
+ clickedAt: "2026-07-20T00:00:00.000Z",
370
+ },
371
+ }
372
+ ```
373
+
374
+ `user.identifiers` comes from the authenticated embed token, or from the
375
+ widget's public-embed `data-*` identifier attributes when no embed token is
376
+ used.
377
+
378
+ This callback is fire-and-forget. The SDK invokes the registered handler but
379
+ does not wait for its promise, use its return value, or report its eventual
380
+ outcome. A configured CTA URL continues to navigate normally after dispatch.
381
+ Missing or failing handlers do not block navigation.
382
+
338
383
  ### Custom widget
339
384
 
340
385
  ```html
@@ -374,7 +419,7 @@ All attributes can be provided with or without the `data-` prefix — both work.
374
419
  | `api-url` | No | ReturningAI widget auth server | Optional widget auth server override |
375
420
  | `widget-url` | **Yes**\* | — | Widget URL (from dashboard). \*Not required when using `data-bundle-url` |
376
421
  | `data-bundle-url` | No | — | URL to the widget bundle loader (`widget.js`) — triggers [bundle mode](#bundle-mode) (non-iframe) |
377
- | `data-theme` | No | `light` | `light` or `dark` |
422
+ | `data-theme` | No | See note below | `light` or `dark`; explicit values override custom widget settings |
378
423
  | `data-email` | Public Embed only | — | User's email for identification. **Access Key Embed:** omit — identity is signed into `data-embed-token` |
379
424
  | `data-embed-token` | Access Key Embed only | — | Short-lived JWT from your server. Carries signed user identifiers — no `data-*` identifier attributes needed |
380
425
  | `data-locale` | No | — | BCP 47 locale tag (e.g. `fr-FR`) |
@@ -394,11 +439,11 @@ All attributes can be provided with or without the `data-` prefix — both work.
394
439
  | `api-url` | No | ReturningAI widget auth server | Optional widget auth server override |
395
440
  | `widget-url` | **Yes**\* | — | Widget URL (from dashboard). \*Not required when using `bundle-url` |
396
441
  | `bundle-url` | No | — | URL to the widget bundle loader (`widget.js`) — triggers [bundle mode](#bundle-mode) (non-iframe) |
397
- | `theme` | No | `light` | `light` or `dark` |
442
+ | `theme` | No | See note below | `light` or `dark`; explicit values override custom widget settings |
398
443
  | `data-email` | Public Embed only | — | User's email for identification. **Access Key Embed:** omit — identity is signed into `embed-token` |
399
444
  | `embed-token` | Access Key Embed only | — | Short-lived JWT from your server. Carries signed user identifiers — no `data-*` identifier attributes needed |
400
445
  | `width` | No | `100%` | CSS width |
401
- | `height` | No | `600px` | CSS height |
446
+ | `height` | No | `600px` | CSS height. In bundle mode, use `auto` to delegate vertical sizing and scrolling to the host page |
402
447
  | `locale` | No | — | BCP 47 locale tag (e.g. `fr-FR`) |
403
448
  | `eager` | No | — | Load immediately instead of waiting until visible (presence-based boolean) |
404
449
  | `auto-refresh` | No | `true` | Auto-refresh access token before expiry |
@@ -409,6 +454,10 @@ All attributes can be provided with or without the `data-` prefix — both work.
409
454
 
410
455
  > **`widget-id` vs `community-id`:** The script-tag method uses `data-widget-id` which is a pre-encoded identifier (base64). The custom element method uses raw ObjectIds — `community-id` for most widget types, plus `channel-id` for channel widgets. The SDK handles the encoding internally.
411
456
 
457
+ > **Custom widget themes:** Omit `theme` / `data-theme` to use the custom
458
+ > widget's configured default theme in iframe and bundle modes. Set it
459
+ > explicitly when the host page needs to force light or dark mode.
460
+
412
461
  ### Container `<div>` (script-tag method only)
413
462
 
414
463
  The SDK looks for a `<div>` with `id="returning-ai-widget-{YOUR_WIDGET_ID}"`. Size the div to control the widget dimensions:
@@ -464,6 +513,8 @@ When you set the `bundle-url` attribute, the widget renders directly in the page
464
513
 
465
514
  - `widget-url` is **not** needed in bundle mode (the widget is loaded directly from `bundle-url`).
466
515
  - `bundle-url` must point to the widget bundle loader file named `widget.js`.
516
+ - Set `height="auto"` on a custom-element embed to let the bundle use its
517
+ natural height and delegate vertical sizing and scrolling to the host page.
467
518
  - ReturningAI endpoints are used by default.
468
519
  - `api-url` and `v2-api-url` are optional endpoint URL overrides.
469
520
  - The npm package only provides the SDK runtime (`@returningai/widget-sdk`). Widget bundle URLs are generated by the ReturningAI dashboard / widget backend and are passed to the SDK through `bundle-url`.
@@ -967,10 +1018,3 @@ document.addEventListener("rai-banner-impression", (e) =>
967
1018
  console.log("shown", e.detail.bannerId),
968
1019
  );
969
1020
  ```
970
-
971
- ### Build
972
-
973
- ```
974
- npm run build:banner # dev
975
- npm run build:banner:min # production (minified)
976
- ```
@@ -1,3 +1,3 @@
1
- var RaiBanner=function(e){"use strict";var t=Object.defineProperty,n=(e,n,o)=>((e,n,o)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[n]=o)(e,"symbol"!=typeof n?n+"":n,o);
2
- /*! @license DOMPurify 3.4.9 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.9/LICENSE */
3
- function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,i,a,l=[],s=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t);else for(;!(s=(o=i.call(n)).done)&&(l.push(o.value),l.length!==t);s=!0);}catch(u){c=!0,r=u}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw r}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return o(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const i=Object.entries,a=Object.setPrototypeOf,l=Object.isFrozen,s=Object.getPrototypeOf,c=Object.getOwnPropertyDescriptor;let u=Object.freeze,d=Object.seal,p=Object.create,f="undefined"!=typeof Reflect&&Reflect,m=f.apply,h=f.construct;u||(u=function(e){return e}),d||(d=function(e){return e}),m||(m=function(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),r=2;r<n;r++)o[r-2]=arguments[r];return e.apply(t,o)}),h||(h=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return new e(...n)});const g=U(Array.prototype.forEach),y=U(Array.prototype.lastIndexOf),b=U(Array.prototype.pop),A=U(Array.prototype.push),T=U(Array.prototype.splice),S=Array.isArray,x=U(String.prototype.toLowerCase),v=U(String.prototype.toString),w=U(String.prototype.match),E=U(String.prototype.replace),_=U(String.prototype.indexOf),N=U(String.prototype.trim),C=U(Number.prototype.toString),O=U(Boolean.prototype.toString),k="undefined"==typeof BigInt?null:U(BigInt.prototype.toString),D="undefined"==typeof Symbol?null:U(Symbol.prototype.toString),R=U(Object.prototype.hasOwnProperty),I=U(Object.prototype.toString),L=U(RegExp.prototype.test),M=(z=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return h(z,t)});var z;function U(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return m(e,t,o)}}function P(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:x;if(a&&a(e,null),!S(t))return e;let o=t.length;for(;o--;){let r=t[o];if("string"==typeof r){const e=n(r);e!==r&&(l(t)||(t[o]=e),r=e)}e[r]=!0}return e}function F(e){for(let t=0;t<e.length;t++){R(e,t)||(e[t]=null)}return e}function H(e){const t=p(null);for(const o of i(e)){var n=r(o,2);const i=n[0],a=n[1];R(e,i)&&(S(a)?t[i]=F(a):a&&"object"==typeof a&&a.constructor===Object?t[i]=H(a):t[i]=a)}return t}function j(e,t){for(;null!==e;){const n=c(e,t);if(n){if(n.get)return U(n.get);if("function"==typeof n.value)return U(n.value)}e=s(e)}return function(){return null}}const W=u(["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","search","section","select","shadow","slot","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"]),B=u(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),G=u(["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"]),Y=u(["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"]),q=u(["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"]),$=u(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),X=u(["#text"]),V=u(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","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","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),K=u(["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","mask-type","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"]),Z=u(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","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"]),J=u(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Q=d(/{{[\w\W]*|^[\w\W]*}}/g),ee=d(/<%[\w\W]*|^[\w\W]*%>/g),te=d(/\${[\w\W]*/g),ne=d(/^data-[\-\w.\u00B7-\uFFFF]+$/),oe=d(/^aria-[\-\w]+$/),re=d(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ie=d(/^(?:\w+script|data):/i),ae=d(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),le=d(/^html$/i),se=d(/^[a-z][.\w]*(-[.\w]+)+$/i),ce=1,ue=3,de=7,pe=8,fe=9,me=11;var he=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"undefined"==typeof window?null:window;const n=t=>e(t);if(n.version="3.4.9",n.removed=[],!t||!t.document||t.document.nodeType!==fe||!t.Element)return n.isSupported=!1,n;let o=t.document;const r=o,a=r.currentScript;t.DocumentFragment;const l=t.HTMLTemplateElement,s=t.Node,c=t.Element,d=t.NodeFilter,f=t.NamedNodeMap;void 0===f&&(t.NamedNodeMap||t.MozNamedAttrMap),t.HTMLFormElement;const m=t.DOMParser,h=t.trustedTypes,z=c.prototype,U=j(z,"cloneNode"),F=j(z,"remove"),he=j(z,"nextSibling"),ge=j(z,"childNodes"),ye=j(z,"parentNode"),be=j(z,"shadowRoot"),Ae=j(z,"attributes"),Te=s&&s.prototype?j(s.prototype,"nodeType"):null,Se=s&&s.prototype?j(s.prototype,"nodeName"):null;if("function"==typeof l){const e=o.createElement("template");e.content&&e.content.ownerDocument&&(o=e.content.ownerDocument)}let xe,ve,we="",Ee=!1,_e=0;const Ne=function(){if(_e>0)throw M('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},Ce=function(e){Ne(),_e++;try{return xe.createHTML(e)}finally{_e--}},Oe=function(e){Ne(),_e++;try{return xe.createScriptURL(e)}finally{_e--}},ke=function(){return Ee||(ve=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const o="data-tt-policy-suffix";t&&t.hasAttribute(o)&&(n=t.getAttribute(o));const r="dompurify"+(n?"#"+n:"");try{return e.createPolicy(r,{createHTML:e=>e,createScriptURL:e=>e})}catch(i){return console.warn("TrustedTypes policy "+r+" could not be created."),null}}(h,a),Ee=!0),ve},De=o,Re=De.implementation,Ie=De.createNodeIterator,Le=De.createDocumentFragment,Me=De.getElementsByTagName,ze=r.importNode;let Ue={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof i&&"function"==typeof ye&&Re&&void 0!==Re.createHTMLDocument;const Pe=Q,Fe=ee,He=te,je=ne,We=oe,Be=ie,Ge=ae,Ye=se;let qe=re,$e=null;const Xe=P({},[...W,...B,...G,...q,...X]);let Ve=null;const Ke=P({},[...V,...K,...Z,...J]);let Ze=Object.seal(p(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Je=null,Qe=null;const et=Object.seal(p(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let tt=!0,nt=!0,ot=!1,rt=!0,it=!1,at=!0,lt=!1,st=!1,ct=!1,ut=!1,dt=!1,pt=!1,ft=!0,mt=!1;const ht="user-content-";let gt=!0,yt=!1,bt={},At=null;const Tt=P({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let St=null;const xt=P({},["audio","video","img","source","image","track"]);let vt=null;const wt=P({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Et="http://www.w3.org/1998/Math/MathML",_t="http://www.w3.org/2000/svg",Nt="http://www.w3.org/1999/xhtml";let Ct=Nt,Ot=!1,kt=null;const Dt=P({},[Et,_t,Nt],v);let Rt=P({},["mi","mo","mn","ms","mtext"]),It=P({},["annotation-xml"]);const Lt=P({},["title","style","font","a","script"]);let Mt=null;const zt=["application/xhtml+xml","text/html"];let Ut=null,Pt=null;const Ft=o.createElement("form"),Ht=function(e){return e instanceof RegExp||e instanceof Function},jt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(Pt&&Pt===e)return;e&&"object"==typeof e||(e={}),e=H(e),Mt=-1===zt.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,Ut="application/xhtml+xml"===Mt?v:x,$e=R(e,"ALLOWED_TAGS")&&S(e.ALLOWED_TAGS)?P({},e.ALLOWED_TAGS,Ut):Xe,Ve=R(e,"ALLOWED_ATTR")&&S(e.ALLOWED_ATTR)?P({},e.ALLOWED_ATTR,Ut):Ke,kt=R(e,"ALLOWED_NAMESPACES")&&S(e.ALLOWED_NAMESPACES)?P({},e.ALLOWED_NAMESPACES,v):Dt,vt=R(e,"ADD_URI_SAFE_ATTR")&&S(e.ADD_URI_SAFE_ATTR)?P(H(wt),e.ADD_URI_SAFE_ATTR,Ut):wt,St=R(e,"ADD_DATA_URI_TAGS")&&S(e.ADD_DATA_URI_TAGS)?P(H(xt),e.ADD_DATA_URI_TAGS,Ut):xt,At=R(e,"FORBID_CONTENTS")&&S(e.FORBID_CONTENTS)?P({},e.FORBID_CONTENTS,Ut):Tt,Je=R(e,"FORBID_TAGS")&&S(e.FORBID_TAGS)?P({},e.FORBID_TAGS,Ut):H({}),Qe=R(e,"FORBID_ATTR")&&S(e.FORBID_ATTR)?P({},e.FORBID_ATTR,Ut):H({}),bt=!!R(e,"USE_PROFILES")&&(e.USE_PROFILES&&"object"==typeof e.USE_PROFILES?H(e.USE_PROFILES):e.USE_PROFILES),tt=!1!==e.ALLOW_ARIA_ATTR,nt=!1!==e.ALLOW_DATA_ATTR,ot=e.ALLOW_UNKNOWN_PROTOCOLS||!1,rt=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,it=e.SAFE_FOR_TEMPLATES||!1,at=!1!==e.SAFE_FOR_XML,lt=e.WHOLE_DOCUMENT||!1,ut=e.RETURN_DOM||!1,dt=e.RETURN_DOM_FRAGMENT||!1,pt=e.RETURN_TRUSTED_TYPE||!1,ct=e.FORCE_BODY||!1,ft=!1!==e.SANITIZE_DOM,mt=e.SANITIZE_NAMED_PROPS||!1,gt=!1!==e.KEEP_CONTENT,yt=e.IN_PLACE||!1,qe=function(e){try{return L(e,""),!0}catch(t){return!1}}(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:re,Ct="string"==typeof e.NAMESPACE?e.NAMESPACE:Nt,Rt=R(e,"MATHML_TEXT_INTEGRATION_POINTS")&&e.MATHML_TEXT_INTEGRATION_POINTS&&"object"==typeof e.MATHML_TEXT_INTEGRATION_POINTS?H(e.MATHML_TEXT_INTEGRATION_POINTS):P({},["mi","mo","mn","ms","mtext"]),It=R(e,"HTML_INTEGRATION_POINTS")&&e.HTML_INTEGRATION_POINTS&&"object"==typeof e.HTML_INTEGRATION_POINTS?H(e.HTML_INTEGRATION_POINTS):P({},["annotation-xml"]);const t=R(e,"CUSTOM_ELEMENT_HANDLING")&&e.CUSTOM_ELEMENT_HANDLING&&"object"==typeof e.CUSTOM_ELEMENT_HANDLING?H(e.CUSTOM_ELEMENT_HANDLING):p(null);if(Ze=p(null),R(t,"tagNameCheck")&&Ht(t.tagNameCheck)&&(Ze.tagNameCheck=t.tagNameCheck),R(t,"attributeNameCheck")&&Ht(t.attributeNameCheck)&&(Ze.attributeNameCheck=t.attributeNameCheck),R(t,"allowCustomizedBuiltInElements")&&"boolean"==typeof t.allowCustomizedBuiltInElements&&(Ze.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),it&&(nt=!1),dt&&(ut=!0),bt&&($e=P({},X),Ve=p(null),!0===bt.html&&(P($e,W),P(Ve,V)),!0===bt.svg&&(P($e,B),P(Ve,K),P(Ve,J)),!0===bt.svgFilters&&(P($e,G),P(Ve,K),P(Ve,J)),!0===bt.mathMl&&(P($e,q),P(Ve,Z),P(Ve,J))),et.tagCheck=null,et.attributeCheck=null,R(e,"ADD_TAGS")&&("function"==typeof e.ADD_TAGS?et.tagCheck=e.ADD_TAGS:S(e.ADD_TAGS)&&($e===Xe&&($e=H($e)),P($e,e.ADD_TAGS,Ut))),R(e,"ADD_ATTR")&&("function"==typeof e.ADD_ATTR?et.attributeCheck=e.ADD_ATTR:S(e.ADD_ATTR)&&(Ve===Ke&&(Ve=H(Ve)),P(Ve,e.ADD_ATTR,Ut))),R(e,"ADD_URI_SAFE_ATTR")&&S(e.ADD_URI_SAFE_ATTR)&&P(vt,e.ADD_URI_SAFE_ATTR,Ut),R(e,"FORBID_CONTENTS")&&S(e.FORBID_CONTENTS)&&(At===Tt&&(At=H(At)),P(At,e.FORBID_CONTENTS,Ut)),R(e,"ADD_FORBID_CONTENTS")&&S(e.ADD_FORBID_CONTENTS)&&(At===Tt&&(At=H(At)),P(At,e.ADD_FORBID_CONTENTS,Ut)),gt&&($e["#text"]=!0),lt&&P($e,["html","head","body"]),$e.table&&(P($e,["tbody"]),delete Je.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw M('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw M('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const t=xe;xe=e.TRUSTED_TYPES_POLICY;try{we=Ce("")}catch(n){throw xe=t,n}}else null===e.TRUSTED_TYPES_POLICY?(xe=void 0,we=""):(void 0===xe&&(xe=ke()),xe&&"string"==typeof we&&(we=Ce("")));(Ue.uponSanitizeElement.length>0||Ue.uponSanitizeAttribute.length>0)&&$e===Xe&&($e=H($e)),Ue.uponSanitizeAttribute.length>0&&Ve===Ke&&(Ve=H(Ve)),u&&u(e),Pt=e},Wt=P({},[...B,...G,...Y]),Bt=P({},[...q,...$]),Gt=function(e){A(n.removed,{element:e});try{ye(e).removeChild(e)}catch(t){if(F(e),!ye(e))throw M("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Yt=function(e){const t=ge?ge(e):e.childNodes;if(t){const e=[];g(t,t=>{A(e,t)}),g(e,e=>{try{F(e)}catch(t){}})}const n=Ae?Ae(e):null;if(n)for(let r=n.length-1;r>=0;--r){const t=n[r],i=t&&t.name;if("string"==typeof i)try{e.removeAttribute(i)}catch(o){}}},qt=function(e,t){try{A(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(o){A(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(ut||dt)try{Gt(t)}catch(o){}else try{t.setAttribute(e,"")}catch(o){}},$t=function(e){const t=Ae?Ae(e):e.attributes;if(t)for(let o=t.length-1;o>=0;--o){const r=t[o],i=r&&r.name;if("string"==typeof i&&!Ve[Ut(i)])try{e.removeAttribute(i)}catch(n){}}},Xt=function(e){let t=null,n=null;if(ct)e="<remove></remove>"+e;else{const t=w(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===Mt&&Ct===Nt&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const r=xe?Ce(e):e;if(Ct===Nt)try{t=(new m).parseFromString(r,Mt)}catch(a){}if(!t||!t.documentElement){t=Re.createDocument(Ct,"template",null);try{t.documentElement.innerHTML=Ot?we:r}catch(a){}}const i=t.body||t.documentElement;return e&&n&&i.insertBefore(o.createTextNode(n),i.childNodes[0]||null),Ct===Nt?Me.call(t,lt?"html":"body")[0]:lt?t.documentElement:i},Vt=function(e){return Ie.call(e.ownerDocument||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},Kt=function(e){var t,n;e.normalize();const o=Ie.call(e.ownerDocument||e,e,d.SHOW_TEXT|d.SHOW_COMMENT|d.SHOW_CDATA_SECTION|d.SHOW_PROCESSING_INSTRUCTION,null);let r=o.nextNode();for(;r;){let e=r.data;g([Pe,Fe,He],t=>{e=E(e,t," ")}),r.data=e,r=o.nextNode()}const i=null!==(t=null===(n=e.querySelectorAll)||void 0===n?void 0:n.call(e,"template"))&&void 0!==t?t:[];g(Array.from(i),e=>{Jt(e.content)&&Kt(e.content)})},Zt=function(e){const t=Se?Se(e):null;return"string"==typeof t&&("form"===Ut(t)&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||e.attributes!==Ae(e)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes||e.nodeType!==Te(e)||e.childNodes!==ge(e)))},Jt=function(e){if(!Te||"object"!=typeof e||null===e)return!1;try{return Te(e)===me}catch(t){return!1}},Qt=function(e){if(!Te||"object"!=typeof e||null===e)return!1;try{return"number"==typeof Te(e)}catch(t){return!1}};function en(e,t,o){g(e,e=>{e.call(n,t,o,Pt)})}const tn=function(e){let t=null;if(en(Ue.beforeSanitizeElements,e,null),Zt(e))return Gt(e),!0;const o=Ut(Se?Se(e):e.nodeName);if(en(Ue.uponSanitizeElement,e,{tagName:o,allowedTags:$e}),at&&e.hasChildNodes()&&!Qt(e.firstElementChild)&&L(/<[/\w!]/g,e.innerHTML)&&L(/<[/\w!]/g,e.textContent))return Gt(e),!0;if(at&&e.namespaceURI===Nt&&"style"===o&&Qt(e.firstElementChild))return Gt(e),!0;if(e.nodeType===de)return Gt(e),!0;if(at&&e.nodeType===pe&&L(/<[/\w]/g,e.data))return Gt(e),!0;if(Je[o]||!(et.tagCheck instanceof Function&&et.tagCheck(o))&&!$e[o]){if(!Je[o]&&rn(o)){if(Ze.tagNameCheck instanceof RegExp&&L(Ze.tagNameCheck,o))return!1;if(Ze.tagNameCheck instanceof Function&&Ze.tagNameCheck(o))return!1}if(gt&&!At[o]){const t=ye(e),n=ge(e);if(n&&t){for(let o=n.length-1;o>=0;--o){const r=yt?n[o]:U(n[o],!0);t.insertBefore(r,he(e))}}}return Gt(e),!0}return((Te?Te(e):e.nodeType)!==ce||function(e){let t=ye(e);t&&t.tagName||(t={namespaceURI:Ct,tagName:"template"});const n=x(e.tagName),o=x(t.tagName);return!!kt[e.namespaceURI]&&(e.namespaceURI===_t?t.namespaceURI===Nt?"svg"===n:t.namespaceURI===Et?"svg"===n&&("annotation-xml"===o||Rt[o]):Boolean(Wt[n]):e.namespaceURI===Et?t.namespaceURI===Nt?"math"===n:t.namespaceURI===_t?"math"===n&&It[o]:Boolean(Bt[n]):e.namespaceURI===Nt?!(t.namespaceURI===_t&&!It[o])&&!(t.namespaceURI===Et&&!Rt[o])&&!Bt[n]&&(Lt[n]||!Wt[n]):!("application/xhtml+xml"!==Mt||!kt[e.namespaceURI]))}(e))&&("noscript"!==o&&"noembed"!==o&&"noframes"!==o||!L(/<\/no(script|embed|frames)/i,e.innerHTML))?(it&&e.nodeType===ue&&(t=e.textContent,g([Pe,Fe,He],e=>{t=E(t,e," ")}),e.textContent!==t&&(A(n.removed,{element:e.cloneNode()}),e.textContent=t)),en(Ue.afterSanitizeElements,e,null),!1):(Gt(e),!0)},nn=function(e,t,n){if(Qe[t])return!1;if(ft&&("id"===t||"name"===t)&&(n in o||n in Ft))return!1;const r=Ve[t]||et.attributeCheck instanceof Function&&et.attributeCheck(t,e);if(nt&&!Qe[t]&&L(je,t));else if(tt&&L(We,t));else if(!r||Qe[t]){if(!(rn(e)&&(Ze.tagNameCheck instanceof RegExp&&L(Ze.tagNameCheck,e)||Ze.tagNameCheck instanceof Function&&Ze.tagNameCheck(e))&&(Ze.attributeNameCheck instanceof RegExp&&L(Ze.attributeNameCheck,t)||Ze.attributeNameCheck instanceof Function&&Ze.attributeNameCheck(t,e))||"is"===t&&Ze.allowCustomizedBuiltInElements&&(Ze.tagNameCheck instanceof RegExp&&L(Ze.tagNameCheck,n)||Ze.tagNameCheck instanceof Function&&Ze.tagNameCheck(n))))return!1}else if(vt[t]);else if(L(qe,E(n,Ge,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==_(n,"data:")||!St[e]){if(ot&&!L(Be,E(n,Ge,"")));else if(n)return!1}else;return!0},on=P({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),rn=function(e){return!on[x(e)]&&L(Ye,e)},an=function(e){en(Ue.beforeSanitizeAttributes,e,null);const t=e.attributes;if(!t||Zt(e))return;const o={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ve,forceKeepAttr:void 0};let r=t.length;for(;r--;){const a=t[r],l=a.name,s=a.namespaceURI,c=a.value,u=Ut(l),d=c;let p="value"===l?d:N(d);if(o.attrName=u,o.attrValue=p,o.keepAttr=!0,o.forceKeepAttr=void 0,en(Ue.uponSanitizeAttribute,e,o),p=o.attrValue,!mt||"id"!==u&&"name"!==u||0===_(p,ht)||(qt(l,e),p=ht+p),at&&L(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,p)){qt(l,e);continue}if("attributename"===u&&w(p,"href")){qt(l,e);continue}if(o.forceKeepAttr)continue;if(!o.keepAttr){qt(l,e);continue}if(!rt&&L(/\/>/i,p)){qt(l,e);continue}it&&g([Pe,Fe,He],e=>{p=E(p,e," ")});const f=Ut(e.nodeName);if(nn(f,u,p)){if(xe&&"object"==typeof h&&"function"==typeof h.getAttributeType)if(s);else switch(h.getAttributeType(f,u)){case"TrustedHTML":p=Ce(p);break;case"TrustedScriptURL":p=Oe(p)}if(p!==d)try{s?e.setAttributeNS(s,l,p):e.setAttribute(l,p),Zt(e)?Gt(e):b(n.removed)}catch(i){qt(l,e)}}else qt(l,e)}en(Ue.afterSanitizeAttributes,e,null)},ln=function(e){let t=null;const n=Vt(e);for(en(Ue.beforeSanitizeShadowDOM,e,null);t=n.nextNode();){en(Ue.uponSanitizeShadowNode,t,null),tn(t),an(t),Jt(t.content)&&ln(t.content);if((Te?Te(t):t.nodeType)===ce){const e=be?be(t):t.shadowRoot;Jt(e)&&(sn(e),ln(e))}}en(Ue.afterSanitizeShadowDOM,e,null)},sn=function(e){const t=[{node:e,shadow:null}];for(;t.length>0;){const e=t.pop();if(e.shadow){ln(e.shadow);continue}const n=e.node,o=(Te?Te(n):n.nodeType)===ce,r=ge?ge(n):n.childNodes;if(r)for(let i=r.length-1;i>=0;--i)t.push({node:r[i],shadow:null});if(o){const e=Se?Se(n):null;if("string"==typeof e&&"template"===Ut(e)){const e=n.content;Jt(e)&&t.push({node:e,shadow:null})}}if(o){const e=be?be(n):n.shadowRoot;Jt(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=null,i=null,a=null,l=null;if(Ot=!e,Ot&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Qt(e)&&"string"!=typeof(e=function(e){switch(typeof e){case"string":return e;case"number":return C(e);case"boolean":return O(e);case"bigint":return k?k(e):"0";case"symbol":return D?D(e):"Symbol()";case"undefined":default:return I(e);case"function":case"object":{if(null===e)return I(e);const t=e,n=j(t,"toString");if("function"==typeof n){const e=n(t);return"string"==typeof e?e:I(e)}return I(e)}}}(e)))throw M("dirty is not a string, aborting");if(!n.isSupported)return e;st||jt(t),n.removed=[];const s=yt&&"string"!=typeof e&&Qt(e);if(s){const t=Se?Se(e):e.nodeName;if("string"==typeof t){const e=Ut(t);if(!$e[e]||Je[e])throw M("root node is forbidden and cannot be sanitized in-place")}if(Zt(e))throw M("root node is clobbered and cannot be sanitized in-place");try{sn(e)}catch(d){throw Yt(e),d}}else if(Qt(e))o=Xt("\x3c!----\x3e"),i=o.ownerDocument.importNode(e,!0),i.nodeType===ce&&"BODY"===i.nodeName||"HTML"===i.nodeName?o=i:o.appendChild(i),sn(i);else{if(!ut&&!it&&!lt&&-1===e.indexOf("<"))return xe&&pt?Ce(e):e;if(o=Xt(e),!o)return ut?null:pt?we:""}o&&ct&&Gt(o.firstChild);const c=Vt(s?e:o);try{for(;a=c.nextNode();)tn(a),an(a),Jt(a.content)&&ln(a.content)}catch(d){throw s&&Yt(e),d}if(s)return g(n.removed,e=>{e.element&&function(e){const t=[e];for(;t.length>0;){const e=t.pop();(Te?Te(e):e.nodeType)===ce&&$t(e);const n=ge?ge(e):e.childNodes;if(n)for(let o=n.length-1;o>=0;--o)t.push(n[o])}}(e.element)}),it&&Kt(e),e;if(ut){if(it&&Kt(o),dt)for(l=Le.call(o.ownerDocument);o.firstChild;)l.appendChild(o.firstChild);else l=o;return(Ve.shadowroot||Ve.shadowrootmode)&&(l=ze.call(r,l,!0)),l}let u=lt?o.outerHTML:o.innerHTML;return lt&&$e["!doctype"]&&o.ownerDocument&&o.ownerDocument.doctype&&o.ownerDocument.doctype.name&&L(le,o.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+o.ownerDocument.doctype.name+">\n"+u),it&&g([Pe,Fe,He],e=>{u=E(u,e," ")}),xe&&pt?Ce(u):u},n.setConfig=function(){jt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),st=!0},n.clearConfig=function(){Pt=null,st=!1,xe=ve,we=""},n.isValidAttribute=function(e,t,n){Pt||jt({});const o=Ut(e),r=Ut(t);return nn(o,r,n)},n.addHook=function(e,t){"function"==typeof t&&A(Ue[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=y(Ue[e],t);return-1===n?void 0:T(Ue[e],n,1)[0]}return b(Ue[e])},n.removeHooks=function(e){Ue[e]=[]},n.removeAllHooks=function(){Ue={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}();function ge(e){const t=e.startsWith("--")?e:`--${e}`,n=[document.documentElement,document.body,...Array.from(document.querySelectorAll(["rai-widget","rai-custom-widget","rai-channel-widget","rai-store-widget","rai-milestone-widget","rai-social-widget","rai-currency-widget","rai-referral-widget",".rai-widget-root",'[data-rai-widget-root="true"]'].join(",")))].filter(Boolean);for(const o of n){const e=getComputedStyle(o).getPropertyValue(t).trim();if(e)return e}for(const o of Array.from(document.querySelectorAll("*"))){const e=getComputedStyle(o).getPropertyValue(t).trim();if(e)return e}}he.addHook("afterSanitizeAttributes",e=>{"A"===e.tagName&&"_blank"===e.getAttribute("target")&&e.setAttribute("rel","noopener noreferrer")});const ye=e=>{if(!e)return;const t=e.trim();if(/^(#|rgb|hsl)/i.test(t))return t;if(/^(--)?[a-z0-9-]+$/i.test(t)){return ge(t)}const n=t.match(/^var\((--[a-z0-9-]+)\)$/i);if(n){return ge(n[1])}};function be(e,t,n){const o=document.createElement(e);if(Object.assign(o.style,t),n)for(const r of Object.keys(n))o.setAttribute(r,n[r]);return o}function Ae(e){return"left"===e||"top"===e?"flex-start":"right"===e||"bottom"===e?"flex-end":"center"}function Te(e,t){var n;const o=[null==(n=e.cta)?void 0:n.style,e.cta,e.ctaStyle];for(const r of o)for(const e of t){const t=null==r?void 0:r[e];if(t)return t}}function Se(e,t){var n,o,r,i,a,l,s,c,u,d,p,f,m,h;const g=e.placement||{},y=g.mode||"overlay",b=g.position||"top",A=String(g.zIndex||2147483e3),T=function(e){var t,n;return"image"===e.type&&Boolean((null==(t=e.image)?void 0:t.desktopUrl)||(null==(n=e.image)?void 0:n.mobileUrl))}(e),S=T?"transparent":ye(null==(n=e.style)?void 0:n.backgroundColor)||"#1f2024",x=ye(null==(o=e.style)?void 0:o.color)||"#ffffff",v="overlay"===y||"popup"===y,w=Te(e,["position"])||"center",E=Ae(null==(r=e.image)?void 0:r.horizontalAlignment),_=Ae(null==(i=e.image)?void 0:i.verticalAlignment),N=(null==(a=e.image)?void 0:a.horizontalAlignment)||"center",C=(null==(l=e.image)?void 0:l.verticalAlignment)||"center",O=T?"#ffffff":x,k=be("div",{boxSizing:"border-box",fontFamily:"Roboto, sans-serif",fontSize:"14px",lineHeight:"1.35",background:S,color:x,borderRadius:v&&!T?"6px":"0",boxShadow:v&&!T?"0 8px 24px rgba(0,0,0,0.22)":"none",padding:T?"0":v?"12px 42px 12px 24px":"8px 42px 8px 16px",display:"flex",alignItems:T?_:"flex-start",justifyContent:"center",gap:T?"0":"16px"});if(k.setAttribute("role",v?"dialog":"region"),k.setAttribute("aria-label","community banner"),k.setAttribute("data-renderer-version","sdk-banner-preview-layout"),v)if(Object.assign(k.style,{position:"fixed",left:"50%",width:"fit-content",maxWidth:T?"70vw":"min(700px, 80vw)",height:"auto",minHeight:T?"0":"80px",maxHeight:T?"70vh":"calc(100vh - 300px)",overflowY:T?"visible":"auto",zIndex:A}),T){const e=[];"left"===N?k.style.left="24px":"right"===N?(k.style.left="",k.style.right="24px"):(k.style.left="50%",e.push("-50%")),"top"===C?k.style.top="10px":"bottom"===C?k.style.bottom="24px":(k.style.top="50%",e.push("-50%")),2===e.length?k.style.transform=`translate(${e[0]}, ${e[1]})`:1===e.length&&"center"===N?k.style.transform=`translateX(${e[0]})`:1===e.length?k.style.transform=`translateY(${e[0]})`:k.style.transform=""}else"bottom"===b?(k.style.bottom="24px",k.style.transform="translateX(-50%)"):"center"===b?(k.style.top="50%",k.style.transform="translate(-50%, -50%)"):(k.style.top="10px",k.style.transform="translateX(-50%)");else Object.assign(k.style,{position:"relative",width:"100%",zIndex:A});const D=be("div",{display:"flex",width:T||v?"auto":"100%",maxWidth:"100%",flexDirection:"column",gap:T?"0":"12px",overflow:"hidden"}),R=be("div",{display:"flex",width:T||v?"auto":"100%",justifyContent:T?E:"space-between",alignItems:T?_:"flex-start",gap:"12px"}),I=be("div",{width:T||v?"auto":"100%",maxWidth:T?"70vw":v?"calc(min(700px, 80vw) - 66px)":"100%",overflow:"hidden",wordBreak:"normal",overflowWrap:"anywhere",whiteSpace:"normal",color:x}),L=(null==(s=e.image)?void 0:s.desktopUrl)||(null==(c=e.image)?void 0:c.mobileUrl);if(T&&L){const t=null==(u=e.image)?void 0:u.linkUrl,n=null==(d=e.image)?void 0:d.openInNewTab,o=be("img",{display:"block",maxWidth:"70vw",maxHeight:"70vh",width:"auto",height:"auto",objectFit:"contain",objectPosition:(P=null==(p=e.image)?void 0:p.horizontalAlignment,F=null==(f=e.image)?void 0:f.verticalAlignment,`${"left"===P?"left":"right"===P?"right":"center"} ${"top"===F?"top":"bottom"===F?"bottom":"center"}`),cursor:t?"pointer":"",borderRadius:"rounded"===(null==(m=e.image)?void 0:m.cornerRadius)?"8px":"0"},{src:L,alt:e.title||"banner"});t&&o.addEventListener("click",()=>{n?window.open(t,"_blank","noopener,noreferrer"):window.location.href=t}),I.appendChild(o)}else{I.innerHTML=(U=e.text)?he.sanitize(U,{ALLOWED_TAGS:["p","strong","em","u","img","span","div","a","br"],ALLOWED_ATTR:["style","src","class","href","target","alt","width","height"],ADD_ATTR:["target"],ALLOW_DATA_ATTR:!1}):"",(z=I).querySelectorAll("p").forEach(e=>{e.style.margin="0",e.style.whiteSpace="normal",e.style.overflowWrap="anywhere"}),z.querySelectorAll("strong").forEach(e=>{e.style.fontWeight="700",e.style.whiteSpace="normal"}),z.querySelectorAll("em").forEach(e=>{e.style.fontStyle="italic",e.style.whiteSpace="normal"}),z.querySelectorAll("u").forEach(e=>{e.style.textDecoration="underline",e.style.whiteSpace="normal"}),z.querySelectorAll("a").forEach(e=>{e.style.color="#3b82f6",e.style.textDecoration="underline",e.style.whiteSpace="normal",e.style.overflowWrap="anywhere","_blank"===e.getAttribute("target")&&e.setAttribute("rel","noopener noreferrer")}),z.querySelectorAll("img").forEach(e=>{e.style.maxWidth="100%",e.style.height="auto"});const t=function(e){const t=e.querySelector('[style*="text-align"]'),n=((null==t?void 0:t.style.textAlign)||e.style.textAlign||"").toLowerCase().trim();return"center"===n||"right"===n||"justify"===n?n:"left"}(I);I.style.textAlign=t,v&&(R.style.justifyContent="center"===(M=t)?"center":"right"===M?"flex-end":"flex-start")}var M,z,U,P,F,H;if(!T&&(null==(h=e.cta)?void 0:h.enabled)){const n=be("button",{cursor:"pointer",border:"none",borderRadius:"6px",height:"36px",minHeight:"36px",padding:"0 16px",fontFamily:"Roboto, sans-serif",fontSize:"12px",fontWeight:"600",lineHeight:"20px",backgroundColor:ye(Te(e,["backgroundColor","buttonColor","aColor"]))||"#2f6df6",color:ye(Te(e,["textColor","color"]))||"#ffffff",boxSizing:"border-box",display:"inline-flex",alignItems:"center",justifyContent:"center"});if(n.type="button",n.textContent=e.cta.label||"CTA Button",n.addEventListener("click",t.onCtaClick),"inline"===w){R.appendChild(I);const e=be("div",{display:"flex",flexDirection:"column",alignItems:"flex-end",justifyContent:"center",flexShrink:"0"});e.appendChild(n),R.appendChild(e),D.appendChild(R)}else{R.appendChild(I),D.appendChild(R);const e=be("div",{display:"flex",width:"100%",justifyContent:(H=w,"left"===H?"flex-start":"right"===H?"flex-end":"center")});e.appendChild(n),D.appendChild(e)}}else R.appendChild(I),D.appendChild(R);k.appendChild(D);const j=be("button",{position:v?"absolute":"",top:v?T?"16px":"12px":"",right:v?T?"16px":"12px":"",marginTop:v?"0":"8px",width:"20px",minWidth:"20px",height:"20px",cursor:"pointer",border:"none",borderRadius:"50%",background:"rgba(0,0,0,0.25)",color:O,fontSize:"16px",lineHeight:"1",display:"flex",alignItems:"center",justifyContent:"center",padding:"0",flexShrink:"0"});return j.type="button",j.setAttribute("aria-label","dismiss banner"),j.innerHTML="&times;",j.addEventListener("click",t.onDismiss),k.appendChild(j),k}function xe(){try{if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID()}catch{}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}function ve(e){if(e)try{(new Image).src=e}catch{}}const we={LOCAL:"http://localhost:1335",SGTR:"https://api-v2.genesiv.org",STG:"https://staging-api-v2.genesiv.org",GEN:"https://api-v2.returning.ai"};class Ee extends HTMLElement{constructor(){super(...arguments),n(this,"rendered",null),n(this,"impressionFired",!1)}connectedCallback(){this.init()}disconnectedCallback(){this.cleanup()}resolveApiUrl(){const e=this.getAttribute("api-url")||this.getAttribute("data-api-url");if(e)return e.replace(/\/+$/,"");const t=this.getAttribute("domain-key")||this.getAttribute("data-domain-key");return t&&we[t]?we[t]:we.LOCAL}device(){const e=window.innerWidth;return e<640?"mobile":e<1024?"tablet":"desktop"}async init(){var e;try{const t=this.getAttribute("community-id")||this.getAttribute("data-community-id");if(!t)return void console.error('[rai-banner] missing required "community-id" attribute');const n=this.resolveApiUrl(),o=this.getAttribute("storage-prefix")||this.getAttribute("data-storage-prefix")||"returning-ai-widget",r=this.getAttribute("surface")||"sdk",i=function(e,t){const n=`${t}-rai-banner-visitor-${e}`;try{let e=localStorage.getItem(n);return e||(e=xe(),localStorage.setItem(n,e)),e}catch{return xe()}}(t,o),a=this.getAttribute("page-path")||window.location.pathname,l=this.getAttribute("page-hostname")||window.location.hostname,s=this.getAttribute("page-url")||window.location.href,c=this.getAttribute("embed-token")||this.getAttribute("data-embed-token")||void 0,u=await async function(e,t){try{const n=await fetch(`${e}/v2/api/banner-sdk/eligible`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),o=await n.json();return o&&o.meta&&"success"===o.meta.status?o.data||{banner:null}:{banner:null,reason:o&&o.detail||"request_failed"}}catch{return{banner:null,reason:"network_error"}}}(n,{communityId:t,surface:r,embedToken:c,page:{url:s,hostname:l,path:a},viewport:{width:window.innerWidth,height:window.innerHeight,device:this.device()},identifier:{type:"anonymous_session",value:i}}),d=u.banner;if(!d)return void this.dispatch("rai-banner-empty",{reason:u.reason});if("hide"===(null==(e=d.placement)?void 0:e.mobileBehavior)&&"mobile"===this.device())return void this.dispatch("rai-banner-empty",{reason:"hidden_on_mobile"});this.mount(d)}catch(t){this.dispatch("rai-banner-error",{error:null==t?void 0:t.message})}}mount(e){var t,n,o,r,i,a,l;if(!this.isConnected)return;const s=Se(e,{onCtaClick:()=>{var t,n,o;ve(null==(t=e.tracking)?void 0:t.clickUrl),this.dispatch("rai-banner-click",{bannerId:e.id});const r=null==(n=e.cta)?void 0:n.url;r&&((null==(o=e.cta)?void 0:o.openInNewTab)?window.open(r,"_blank","noopener,noreferrer"):window.location.href=r)},onDismiss:()=>{var t;ve(null==(t=e.tracking)?void 0:t.dismissUrl),this.dispatch("rai-banner-dismiss",{bannerId:e.id}),this.cleanup()}});this.rendered=s;if("overlay"===(null==(t=e.placement)?void 0:t.mode)||"popup"===(null==(n=e.placement)?void 0:n.mode))document.body.appendChild(s);else{const t=null==(o=e.placement)?void 0:o.targetSelector,n=t?document.querySelector(t):null;if(n){const t=(null==(r=e.placement)?void 0:r.insertion)||"append";"prepend"===t?n.insertBefore(s,n.firstChild):"before"===t?null==(i=n.parentNode)||i.insertBefore(s,n):"after"===t?null==(a=n.parentNode)||a.insertBefore(s,n.nextSibling):n.appendChild(s)}else this.style.display="block",this.style.width="100%",this.appendChild(s)}this.impressionFired||(this.impressionFired=!0,ve(null==(l=e.tracking)?void 0:l.impressionUrl),this.dispatch("rai-banner-impression",{bannerId:e.id}))}cleanup(){this.rendered&&this.rendered.parentNode&&this.rendered.parentNode.removeChild(this.rendered),this.rendered=null}dispatch(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}}function _e(){var e;const t=((null==(e=document.currentScript)?void 0:e.hasAttribute("data-rai-banner"))?document.currentScript:null)||document.querySelector("script[data-rai-banner]");if(!t)return;if(!t.getAttribute("data-community-id"))return;if(document.querySelector("rai-banner"))return;const n=document.createElement("rai-banner"),o={"data-community-id":"community-id","data-api-url":"api-url","data-domain-key":"domain-key","data-surface":"surface","data-storage-prefix":"storage-prefix","data-page-path":"page-path","data-embed-token":"embed-token"};for(const[r,i]of Object.entries(o)){const e=t.getAttribute(r);e&&n.setAttribute(i,e)}document.body.appendChild(n)}return console.log("[rai-banner] v1.7.1"),"undefined"==typeof customElements||customElements.get("rai-banner")||customElements.define("rai-banner",Ee),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",_e):_e(),e.BannerRuntime=Ee,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e}({});
1
+ var RaiBanner=function(e){"use strict";var t=Object.defineProperty,n=(e,n,r)=>((e,n,r)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r)(e,"symbol"!=typeof n?n+"":n,r);
2
+ /*! @license DOMPurify 3.4.12 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.12/LICENSE */
3
+ function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,l=[],s=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t);else for(;!(s=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(u){c=!0,o=u}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return r(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const i=Object.entries,a=Object.setPrototypeOf,l=Object.isFrozen,s=Object.getPrototypeOf,c=Object.getOwnPropertyDescriptor;let u=Object.freeze,d=Object.seal,p=Object.create,f="undefined"!=typeof Reflect&&Reflect,m=f.apply,h=f.construct;u||(u=function(e){return e}),d||(d=function(e){return e}),m||(m=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return e.apply(t,r)}),h||(h=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return new e(...n)});const g=U(Array.prototype.forEach),y=U(Array.prototype.lastIndexOf),b=U(Array.prototype.pop),x=U(Array.prototype.push),v=U(Array.prototype.splice),T=Array.isArray,A=U(String.prototype.toLowerCase),S=U(String.prototype.toString),w=U(String.prototype.match),E=U(String.prototype.replace),N=U(String.prototype.indexOf),C=U(String.prototype.trim),_=U(Number.prototype.toString),k=U(Boolean.prototype.toString),O="undefined"==typeof BigInt?null:U(BigInt.prototype.toString),D="undefined"==typeof Symbol?null:U(Symbol.prototype.toString),I=U(Object.prototype.hasOwnProperty),R=U(Object.prototype.toString),L=U(RegExp.prototype.test),M=(z=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return h(z,t)});var z;function U(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return m(e,t,r)}}function P(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:A;if(a&&a(e,null),!T(t))return e;let r=t.length;for(;r--;){let o=t[r];if("string"==typeof o){const e=n(o);e!==o&&(l(t)||(t[r]=e),o=e)}e[o]=!0}return e}function F(e){for(let t=0;t<e.length;t++){I(e,t)||(e[t]=null)}return e}function H(e){const t=p(null);for(const r of i(e)){var n=o(r,2);const i=n[0],a=n[1];I(e,i)&&(T(a)?t[i]=F(a):a&&"object"==typeof a&&a.constructor===Object?t[i]=H(a):t[i]=a)}return t}function j(e,t){for(;null!==e;){const n=c(e,t);if(n){if(n.get)return U(n.get);if("function"==typeof n.value)return U(n.value)}e=s(e)}return function(){return null}}const W=u(["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","search","section","select","shadow","slot","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"]),B=u(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),G=u(["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"]),Y=u(["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"]),q=u(["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"]),$=u(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),X=u(["#text"]),V=u(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","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","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),K=u(["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","dominant-baseline","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","mask-type","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-orientation","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"]),Z=u(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","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"]),J=u(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Q=d(/{{[\w\W]*|^[\w\W]*}}/g),ee=d(/<%[\w\W]*|^[\w\W]*%>/g),te=d(/\${[\w\W]*/g),ne=d(/^data-[\-\w.\u00B7-\uFFFF]+$/),re=d(/^aria-[\-\w]+$/),oe=d(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ie=d(/^(?:\w+script|data):/i),ae=d(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),le=d(/^html$/i),se=d(/^[a-z][.\w]*(-[.\w]+)+$/i),ce=d(/<[/\w!]/g),ue=d(/<[/\w]/g),de=d(/<\/no(script|embed|frames)/i),pe=d(/\/>/i),fe=1,me=3,he=7,ge=8,ye=9,be=11,xe=function(e,t,n,r){return I(e,t)&&T(e[t])?P(r.base?H(r.base):{},e[t],r.transform):n};var ve=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"undefined"==typeof window?null:window;const n=t=>e(t);if(n.version="3.4.12",n.removed=[],!t||!t.document||t.document.nodeType!==ye||!t.Element)return n.isSupported=!1,n;let r=t.document;const o=r,a=o.currentScript;t.DocumentFragment;const l=t.HTMLTemplateElement,s=t.Node,c=t.Element,f=t.NodeFilter,m=t.NamedNodeMap;void 0===m&&(t.NamedNodeMap||t.MozNamedAttrMap),t.HTMLFormElement;const h=t.DOMParser,z=t.trustedTypes,U=c.prototype,F=j(U,"cloneNode"),ve=j(U,"remove"),Te=j(U,"nextSibling"),Ae=j(U,"childNodes"),Se=j(U,"parentNode"),we=j(U,"shadowRoot"),Ee=j(U,"attributes"),Ne=s&&s.prototype?j(s.prototype,"nodeType"):null,Ce=s&&s.prototype?j(s.prototype,"nodeName"):null;if("function"==typeof l){const e=r.createElement("template");e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let _e,ke,Oe="",De=!1,Ie=0;const Re=function(){if(Ie>0)throw M('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},Le=function(e){Re(),Ie++;try{return _e.createHTML(e)}finally{Ie--}},Me=function(){return De||(ke=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(n=t.getAttribute(r));const o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML:e=>e,createScriptURL:e=>e})}catch(i){return console.warn("TrustedTypes policy "+o+" could not be created."),null}}(z,a),De=!0),ke},ze=r,Ue=ze.implementation,Pe=ze.createNodeIterator,Fe=ze.createDocumentFragment,He=ze.getElementsByTagName,je=o.importNode;let We={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof i&&"function"==typeof Se&&Ue&&void 0!==Ue.createHTMLDocument;const Be=Q,Ge=ee,Ye=te,qe=ne,$e=re,Xe=ie,Ve=ae,Ke=se;let Ze=oe,Je=null;const Qe=P({},[...W,...B,...G,...q,...X]);let et=null;const tt=P({},[...V,...K,...Z,...J]);let nt=Object.seal(p(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),rt=null,ot=null;const it=Object.seal(p(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let at=!0,lt=!0,st=!1,ct=!0,ut=!1,dt=!0,pt=!1,ft=!1,mt=null,ht=null,gt=!1,yt=!1,bt=!1,xt=!1,vt=!0,Tt=!1;const At="user-content-";let St=!0,wt=!1,Et={},Nt=null;const Ct=P({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let _t=null;const kt=P({},["audio","video","img","source","image","track"]);let Ot=null;const Dt=P({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),It="http://www.w3.org/1998/Math/MathML",Rt="http://www.w3.org/2000/svg",Lt="http://www.w3.org/1999/xhtml";let Mt=Lt,zt=!1,Ut=null;const Pt=P({},[It,Rt,Lt],S),Ft=u(["mi","mo","mn","ms","mtext"]);let Ht=P({},Ft);const jt=u(["annotation-xml"]);let Wt=P({},jt);const Bt=P({},["title","style","font","a","script"]);let Gt=null;const Yt=["application/xhtml+xml","text/html"];let qt=null,$t=null;const Xt=r.createElement("form"),Vt=function(e){return e instanceof RegExp||e instanceof Function},Kt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if($t&&$t===e)return;e&&"object"==typeof e||(e={}),e=H(e),Gt=-1===Yt.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,qt="application/xhtml+xml"===Gt?S:A,Je=xe(e,"ALLOWED_TAGS",Qe,{transform:qt}),et=xe(e,"ALLOWED_ATTR",tt,{transform:qt}),Ut=xe(e,"ALLOWED_NAMESPACES",Pt,{transform:S}),Ot=xe(e,"ADD_URI_SAFE_ATTR",Dt,{transform:qt,base:Dt}),_t=xe(e,"ADD_DATA_URI_TAGS",kt,{transform:qt,base:kt}),Nt=xe(e,"FORBID_CONTENTS",Ct,{transform:qt}),rt=xe(e,"FORBID_TAGS",H({}),{transform:qt}),ot=xe(e,"FORBID_ATTR",H({}),{transform:qt}),Et=!!I(e,"USE_PROFILES")&&(e.USE_PROFILES&&"object"==typeof e.USE_PROFILES?H(e.USE_PROFILES):e.USE_PROFILES),at=!1!==e.ALLOW_ARIA_ATTR,lt=!1!==e.ALLOW_DATA_ATTR,st=e.ALLOW_UNKNOWN_PROTOCOLS||!1,ct=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,ut=e.SAFE_FOR_TEMPLATES||!1,dt=!1!==e.SAFE_FOR_XML,pt=e.WHOLE_DOCUMENT||!1,yt=e.RETURN_DOM||!1,bt=e.RETURN_DOM_FRAGMENT||!1,xt=e.RETURN_TRUSTED_TYPE||!1,gt=e.FORCE_BODY||!1,vt=!1!==e.SANITIZE_DOM,Tt=e.SANITIZE_NAMED_PROPS||!1,St=!1!==e.KEEP_CONTENT,wt=e.IN_PLACE||!1,Ze=function(e){try{return L(e,""),!0}catch(t){return!1}}(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:oe,Mt="string"==typeof e.NAMESPACE?e.NAMESPACE:Lt,Ht=I(e,"MATHML_TEXT_INTEGRATION_POINTS")&&e.MATHML_TEXT_INTEGRATION_POINTS&&"object"==typeof e.MATHML_TEXT_INTEGRATION_POINTS?H(e.MATHML_TEXT_INTEGRATION_POINTS):P({},Ft),Wt=I(e,"HTML_INTEGRATION_POINTS")&&e.HTML_INTEGRATION_POINTS&&"object"==typeof e.HTML_INTEGRATION_POINTS?H(e.HTML_INTEGRATION_POINTS):P({},jt);const t=I(e,"CUSTOM_ELEMENT_HANDLING")&&e.CUSTOM_ELEMENT_HANDLING&&"object"==typeof e.CUSTOM_ELEMENT_HANDLING?H(e.CUSTOM_ELEMENT_HANDLING):p(null);if(nt=p(null),I(t,"tagNameCheck")&&Vt(t.tagNameCheck)&&(nt.tagNameCheck=t.tagNameCheck),I(t,"attributeNameCheck")&&Vt(t.attributeNameCheck)&&(nt.attributeNameCheck=t.attributeNameCheck),I(t,"allowCustomizedBuiltInElements")&&"boolean"==typeof t.allowCustomizedBuiltInElements&&(nt.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),d(nt),ut&&(lt=!1),bt&&(yt=!0),Et&&(Je=P({},X),et=p(null),!0===Et.html&&(P(Je,W),P(et,V)),!0===Et.svg&&(P(Je,B),P(et,K),P(et,J)),!0===Et.svgFilters&&(P(Je,G),P(et,K),P(et,J)),!0===Et.mathMl&&(P(Je,q),P(et,Z),P(et,J))),it.tagCheck=null,it.attributeCheck=null,I(e,"ADD_TAGS")&&("function"==typeof e.ADD_TAGS?it.tagCheck=e.ADD_TAGS:T(e.ADD_TAGS)&&(Je===Qe&&(Je=H(Je)),P(Je,e.ADD_TAGS,qt))),I(e,"ADD_ATTR")&&("function"==typeof e.ADD_ATTR?it.attributeCheck=e.ADD_ATTR:T(e.ADD_ATTR)&&(et===tt&&(et=H(et)),P(et,e.ADD_ATTR,qt))),I(e,"ADD_URI_SAFE_ATTR")&&T(e.ADD_URI_SAFE_ATTR)&&P(Ot,e.ADD_URI_SAFE_ATTR,qt),I(e,"FORBID_CONTENTS")&&T(e.FORBID_CONTENTS)&&(Nt===Ct&&(Nt=H(Nt)),P(Nt,e.FORBID_CONTENTS,qt)),I(e,"ADD_FORBID_CONTENTS")&&T(e.ADD_FORBID_CONTENTS)&&(Nt===Ct&&(Nt=H(Nt)),P(Nt,e.ADD_FORBID_CONTENTS,qt)),St&&(Je["#text"]=!0),pt&&P(Je,["html","head","body"]),Je.table&&(P(Je,["tbody"]),delete rt.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw M('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw M('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const t=_e;_e=e.TRUSTED_TYPES_POLICY;try{Oe=Le("")}catch(n){throw _e=t,n}}else null===e.TRUSTED_TYPES_POLICY?(_e=void 0,Oe=""):(void 0===_e&&(_e=Me()),_e&&"string"==typeof Oe&&(Oe=Le("")));u&&u(e),$t=e},Zt=P({},[...B,...G,...Y]),Jt=P({},[...q,...$]),Qt=function(e){let t=Se(e);t&&t.tagName||(t={namespaceURI:Mt,tagName:"template"});const n=A(e.tagName),r=A(t.tagName);return!!Ut[e.namespaceURI]&&(e.namespaceURI===Rt?function(e,t,n){return t.namespaceURI===Lt?"svg"===e:t.namespaceURI===It?"svg"===e&&("annotation-xml"===n||Ht[n]):Boolean(Zt[e])}(n,t,r):e.namespaceURI===It?function(e,t,n){return t.namespaceURI===Lt?"math"===e:t.namespaceURI===Rt?"math"===e&&Wt[n]:Boolean(Jt[e])}(n,t,r):e.namespaceURI===Lt?function(e,t,n){return!(t.namespaceURI===Rt&&!Wt[n])&&!(t.namespaceURI===It&&!Ht[n])&&!Jt[e]&&(Bt[e]||!Zt[e])}(n,t,r):!("application/xhtml+xml"!==Gt||!Ut[e.namespaceURI]))},en=function(e){x(n.removed,{element:e});try{Se(e).removeChild(e)}catch(t){if(ve(e),!Se(e))throw M("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},tn=function(e){on(e);const t=Ae(e);if(t){const e=[];g(t,t=>{x(e,t)}),g(e,e=>{try{ve(e)}catch(t){}})}const n=Ee(e);if(n)for(let o=n.length-1;o>=0;--o){const t=n[o],i=t&&t.name;if("string"==typeof i)try{e.removeAttribute(i)}catch(r){}}},nn=function(e,t){try{x(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(r){x(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(yt||bt)try{en(t)}catch(r){}else try{t.setAttribute(e,"")}catch(r){}},rn=function(e){const t=Ee(e);if(t)for(let r=t.length-1;r>=0;--r){const o=t[r],i=o&&o.name;if("string"==typeof i&&!et[qt(i)])try{e.removeAttribute(i)}catch(n){}}},on=function(e){const t=[e];for(;t.length>0;){const e=t.pop();(Ne?Ne(e):e.nodeType)===fe&&rn(e);const n=Ae(e);if(n)for(let r=n.length-1;r>=0;--r)t.push(n[r])}},an=function(e){let t=null,n=null;if(gt)e="<remove></remove>"+e;else{const t=w(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===Gt&&Mt===Lt&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const o=_e?Le(e):e;if(Mt===Lt)try{t=(new h).parseFromString(o,Gt)}catch(a){}if(!t||!t.documentElement){t=Ue.createDocument(Mt,"template",null);try{t.documentElement.innerHTML=zt?Oe:o}catch(a){}}const i=t.body||t.documentElement;return e&&n&&i.insertBefore(r.createTextNode(n),i.childNodes[0]||null),Mt===Lt?He.call(t,pt?"html":"body")[0]:pt?t.documentElement:i},ln=function(e){return Pe.call(e.ownerDocument||e,e,f.SHOW_ELEMENT|f.SHOW_COMMENT|f.SHOW_TEXT|f.SHOW_PROCESSING_INSTRUCTION|f.SHOW_CDATA_SECTION,null)},sn=function(e){return e=E(e,Be," "),e=E(e,Ge," "),e=E(e,Ye," ")},cn=function(e){var t;e.normalize();const n=Pe.call(e.ownerDocument||e,e,f.SHOW_TEXT|f.SHOW_COMMENT|f.SHOW_CDATA_SECTION|f.SHOW_PROCESSING_INSTRUCTION,null);let r=n.nextNode();for(;r;)r.data=sn(r.data),r=n.nextNode();const o=null===(t=e.querySelectorAll)||void 0===t?void 0:t.call(e,"template");o&&g(o,e=>{dn(e.content)&&cn(e.content)})},un=function(e){const t=Ce?Ce(e):null;return"string"==typeof t&&("form"===qt(t)&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||e.attributes!==Ee(e)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes||e.nodeType!==Ne(e)||e.childNodes!==Ae(e)))},dn=function(e){if(!Ne||"object"!=typeof e||null===e)return!1;try{return Ne(e)===be}catch(t){return!1}},pn=function(e){if(!Ne||"object"!=typeof e||null===e)return!1;try{return"number"==typeof Ne(e)}catch(t){return!1}};function fn(e,t,r){0!==e.length&&g(e,e=>{e.call(n,t,r,$t)})}const mn=function(e,t){if(fn(We.beforeSanitizeElements,e,null),e!==t&&null===Se(e))return!0;if(un(e))return en(e),!0;const r=qt(Ce?Ce(e):e.nodeName);if(fn(We.uponSanitizeElement,e,{tagName:r,allowedTags:Je}),e!==t&&null===Se(e))return!0;if(function(e,t){return!!(dt&&e.hasChildNodes()&&!pn(e.firstElementChild)&&L(ce,e.textContent)&&L(ce,e.innerHTML))||!(!dt||e.namespaceURI!==Lt||"style"!==t||!pn(e.firstElementChild))||e.nodeType===he||!(!dt||e.nodeType!==ge||!L(ue,e.data))}(e,r))return en(e),!0;if(rt[r]||!(it.tagCheck instanceof Function&&it.tagCheck(r))&&!Je[r]){const t=function(e,t){if(!rt[t]&&yn(t)){if(nt.tagNameCheck instanceof RegExp&&L(nt.tagNameCheck,t))return!1;if(nt.tagNameCheck instanceof Function&&nt.tagNameCheck(t))return!1}if(St&&!Nt[t]){const t=Se(e),n=Ae(e);if(n&&t)for(let r=n.length-1;r>=0;--r){const o=wt?n[r]:F(n[r],!0);t.insertBefore(o,Te(e))}}return en(e),!0}(e,r);return!1===t&&fn(We.afterSanitizeElements,e,null),t}if((Ne?Ne(e):e.nodeType)===fe&&!Qt(e))return en(e),!0;if(("noscript"===r||"noembed"===r||"noframes"===r)&&L(de,e.innerHTML))return en(e),!0;if(ut&&e.nodeType===me){const t=sn(e.textContent);e.textContent!==t&&(x(n.removed,{element:e.cloneNode()}),e.textContent=t)}return fn(We.afterSanitizeElements,e,null),!1},hn=function(e,t,n){if(ot[t])return!1;if(dt&&"patchsrc"===t)return!1;if(dt&&"for"===t&&"label"!==e&&"output"!==e)return!1;if(vt&&("id"===t||"name"===t)&&(n in r||n in Xt))return!1;const o=et[t]||it.attributeCheck instanceof Function&&it.attributeCheck(t,e);if(lt&&L(qe,t));else if(at&&L($e,t));else if(o)if(Ot[t]);else if(L(Ze,E(n,Ve,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==N(n,"data:")||!_t[e]){if(st&&!L(Xe,E(n,Ve,"")));else if(n)return!1}else;else if(!(yn(e)&&(nt.tagNameCheck instanceof RegExp&&L(nt.tagNameCheck,e)||nt.tagNameCheck instanceof Function&&nt.tagNameCheck(e))&&(nt.attributeNameCheck instanceof RegExp&&L(nt.attributeNameCheck,t)||nt.attributeNameCheck instanceof Function&&nt.attributeNameCheck(t,e))||"is"===t&&nt.allowCustomizedBuiltInElements&&(nt.tagNameCheck instanceof RegExp&&L(nt.tagNameCheck,n)||nt.tagNameCheck instanceof Function&&nt.tagNameCheck(n))))return!1;return!0},gn=P({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),yn=function(e){return!gn[A(e)]&&L(Ke,e)},bn=function(e,t,n,r){if(_e&&"object"==typeof z&&"function"==typeof z.getAttributeType&&!n)switch(z.getAttributeType(e,t)){case"TrustedHTML":return Le(r);case"TrustedScriptURL":return function(e){Re(),Ie++;try{return _e.createScriptURL(e)}finally{Ie--}}(r)}return r},xn=function(e,t,r,o){try{r?e.setAttributeNS(r,t,o):e.setAttribute(t,o),un(e)?en(e):b(n.removed)}catch(i){nn(t,e)}},vn=function(e){fn(We.beforeSanitizeAttributes,e,null);const t=e.attributes;if(!t||un(e))return;const n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:et,forceKeepAttr:void 0};let r=t.length;const o=qt(e.nodeName);for(;r--;){const i=t[r],a=i.name,l=i.namespaceURI,s=i.value,c=qt(a),u=s;let d="value"===a?u:C(u);n.attrName=c,n.attrValue=d,n.keepAttr=!0,n.forceKeepAttr=void 0,fn(We.uponSanitizeAttribute,e,n),d=n.attrValue,!Tt||"id"!==c&&"name"!==c||0===N(d,At)||(nn(a,e),d=At+d),dt&&L(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)?nn(a,e):"attributename"===c&&w(d,"href")?nn(a,e):n.forceKeepAttr||(n.keepAttr&&(ct||!L(pe,d))?(ut&&(d=sn(d)),hn(o,c,d)?(d=bn(o,c,l,d),d!==u&&xn(e,a,l,d)):nn(a,e)):nn(a,e))}fn(We.afterSanitizeAttributes,e,null)},Tn=function(e){let t=null;const n=ln(e);for(fn(We.beforeSanitizeShadowDOM,e,null);t=n.nextNode();){fn(We.uponSanitizeShadowNode,t,null),mn(t,e),vn(t),dn(t.content)&&Tn(t.content);if((Ne?Ne(t):t.nodeType)===fe){const e=we(t);dn(e)&&(An(e),Tn(e))}}fn(We.afterSanitizeShadowDOM,e,null)},An=function(e){const t=[{node:e,shadow:null}];for(;t.length>0;){const e=t.pop();if(e.shadow){Tn(e.shadow);continue}const n=e.node,r=(Ne?Ne(n):n.nodeType)===fe,o=Ae(n);if(o)for(let i=o.length-1;i>=0;--i)t.push({node:o[i],shadow:null});if(r){const e=Ce?Ce(n):null;if("string"==typeof e&&"template"===qt(e)){const e=n.content;dn(e)&&t.push({node:e,shadow:null})}}if(r){const e=we(n);dn(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null,i=null,a=null,l=null;if(zt=!e,zt&&(e="\x3c!--\x3e"),"string"!=typeof e&&!pn(e)&&"string"!=typeof(e=function(e){switch(typeof e){case"string":return e;case"number":return _(e);case"boolean":return k(e);case"bigint":return O?O(e):"0";case"symbol":return D?D(e):"Symbol()";case"undefined":default:return R(e);case"function":case"object":{if(null===e)return R(e);const t=e,n=j(t,"toString");if("function"==typeof n){const e=n(t);return"string"==typeof e?e:R(e)}return R(e)}}}(e)))throw M("dirty is not a string, aborting");if(!n.isSupported)return e;ft?(Je=mt,et=ht):Kt(t),(We.uponSanitizeElement.length>0||We.uponSanitizeAttribute.length>0)&&(Je=H(Je)),We.uponSanitizeAttribute.length>0&&(et=H(et)),n.removed=[];const s=wt&&"string"!=typeof e&&pn(e);if(s){!function(e){if(!dt)return;const t=[e];for(;t.length>0;){const e=t.pop(),r=Ne?Ne(e):e.nodeType;if(r===he||r===ge&&L(ue,e.data)){try{ve(e)}catch(n){}continue}if(r===fe){const t=e,r=qt(Ce?Ce(e):e.nodeName);try{t.hasAttribute&&t.hasAttribute("patchsrc")&&t.removeAttribute("patchsrc"),t.hasAttribute&&t.hasAttribute("for")&&"label"!==r&&"output"!==r&&t.removeAttribute("for")}catch(n){}}const o=Ae(e);if(o)for(let n=o.length-1;n>=0;--n)t.push(o[n])}}(e);const t=Ce?Ce(e):e.nodeName;if("string"==typeof t){const n=qt(t);if(!Je[n]||rt[n])throw tn(e),M("root node is forbidden and cannot be sanitized in-place")}if(un(e))throw tn(e),M("root node is clobbered and cannot be sanitized in-place");try{An(e)}catch(p){throw tn(e),p}}else if(pn(e))r=an("\x3c!----\x3e"),i=r.ownerDocument.importNode(e,!0),i.nodeType===fe&&"BODY"===i.nodeName||"HTML"===i.nodeName?r=i:r.appendChild(i),An(i);else{if(!yt&&!ut&&!pt&&-1===e.indexOf("<"))return _e&&xt?Le(e):e;if(r=an(e),!r)return yt?null:xt?Oe:""}r&&gt&&en(r.firstChild);const c=s?e:r,u=ln(c);try{for(;a=u.nextNode();)mn(a,c),vn(a),dn(a.content)&&Tn(a.content)}catch(p){throw s&&(tn(e),g(n.removed,e=>{e.element&&on(e.element)})),p}if(s)return g(n.removed,e=>{e.element&&on(e.element)}),ut&&cn(e),e;if(yt){if(ut&&cn(r),bt)for(l=Fe.call(r.ownerDocument);r.firstChild;)l.appendChild(r.firstChild);else l=r;return(et.shadowroot||et.shadowrootmode)&&(l=je.call(o,l,!0)),l}let d=pt?r.outerHTML:r.innerHTML;return pt&&Je["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&L(le,r.ownerDocument.doctype.name)&&(d="<!DOCTYPE "+r.ownerDocument.doctype.name+">\n"+d),ut&&(d=sn(d)),_e&&xt?Le(d):d},n.setConfig=function(){Kt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),ft=!0,mt=Je,ht=et},n.clearConfig=function(){$t=null,ft=!1,mt=null,ht=null,_e=ke,Oe=""},n.isValidAttribute=function(e,t,n){$t||Kt({});const r=qt(e),o=qt(t);return hn(r,o,n)},n.addHook=function(e,t){"function"==typeof t&&I(We,e)&&x(We[e],t)},n.removeHook=function(e,t){if(I(We,e)){if(void 0!==t){const n=y(We[e],t);return-1===n?void 0:v(We[e],n,1)[0]}return b(We[e])}},n.removeHooks=function(e){I(We,e)&&(We[e]=[])},n.removeAllHooks=function(){We={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}();function Te(e,t){const n=e.startsWith("--")?e:`--${e}`,r=[t,document.documentElement,document.body,...Array.from(document.querySelectorAll(["rai-widget","rai-custom-widget","rai-channel-widget","rai-store-widget","rai-milestone-widget","rai-social-widget","rai-currency-widget","rai-referral-widget",".rai-widget-root",'[data-rai-widget-root="true"]'].join(",")))].filter(Boolean),o=new Set;for(const i of r){if(o.has(i))continue;o.add(i);const e=getComputedStyle(i).getPropertyValue(n).trim();if(e)return e}for(const i of Array.from(document.querySelectorAll("*"))){if(o.has(i))continue;const e=getComputedStyle(i).getPropertyValue(n).trim();if(e)return e}}function Ae(e,t){if(!e)return;const n=e.trim();if(/^(#|rgb|hsl)/i.test(n))return n;if(/^(--)?[a-z0-9-]+$/i.test(n))return Te(n,t);const r=n.match(/^var\((--[a-z0-9-]+)\)$/i);return r?Te(r[1],t):void 0}function Se(e,t,n){const r=document.createElement(e);if(Object.assign(r.style,t),n)for(const o of Object.keys(n))r.setAttribute(o,n[o]);return r}function we(e){return"left"===e||"top"===e?"flex-start":"right"===e||"bottom"===e?"flex-end":"center"}function Ee(e,t){var n;const r=[null==(n=e.cta)?void 0:n.style,e.cta,e.ctaStyle];for(const o of r)for(const e of t){const t=null==o?void 0:o[e];if(t)return t}}function Ne(e,t,n){var r,o,i,a,l,s,c,u,d,p,f,m,h,g;const y=e.placement||{},b=y.mode||"overlay",x=y.position||"top",v=String(y.zIndex||2147483e3),T=function(e){var t,n;return"image"===e.type&&Boolean((null==(t=e.image)?void 0:t.desktopUrl)||(null==(n=e.image)?void 0:n.mobileUrl))}(e),A=T?"transparent":Ae(null==(r=e.style)?void 0:r.backgroundColor,n)||"#1f2024",S=Ae(null==(o=e.style)?void 0:o.color,n)||"#ffffff",w="overlay"===b||"popup"===b,E=Ee(e,["position"])||"center",N=we(null==(i=e.image)?void 0:i.horizontalAlignment),C=we(null==(a=e.image)?void 0:a.verticalAlignment),_=(null==(l=e.image)?void 0:l.horizontalAlignment)||"center",k=(null==(s=e.image)?void 0:s.verticalAlignment)||"center",O=T?"#ffffff":S,D=Se("div",{boxSizing:"border-box",fontFamily:"Roboto, sans-serif",fontSize:"14px",lineHeight:"1.35",background:A,color:S,borderRadius:w&&!T?"6px":"0",boxShadow:w&&!T?"0 8px 24px rgba(0,0,0,0.22)":"none",padding:T?"0":w?"12px 42px 12px 24px":"8px 42px 8px 16px",display:"flex",alignItems:T?C:"flex-start",justifyContent:"center",gap:T?"0":"16px"});if(D.setAttribute("role",w?"dialog":"region"),D.setAttribute("aria-label","community banner"),D.setAttribute("data-renderer-version","sdk-banner-preview-layout"),w)if(Object.assign(D.style,{position:"fixed",left:"50%",width:"fit-content",maxWidth:T?"70vw":"min(700px, 80vw)",height:"auto",minHeight:T?"0":"80px",maxHeight:T?"70vh":"calc(100vh - 300px)",overflowY:T?"visible":"auto",zIndex:v}),T){const e=[];"left"===_?D.style.left="24px":"right"===_?(D.style.left="",D.style.right="24px"):(D.style.left="50%",e.push("-50%")),"top"===k?D.style.top="10px":"bottom"===k?D.style.bottom="24px":(D.style.top="50%",e.push("-50%")),2===e.length?D.style.transform=`translate(${e[0]}, ${e[1]})`:1===e.length&&"center"===_?D.style.transform=`translateX(${e[0]})`:1===e.length?D.style.transform=`translateY(${e[0]})`:D.style.transform=""}else"bottom"===x?(D.style.bottom="24px",D.style.transform="translateX(-50%)"):"center"===x?(D.style.top="50%",D.style.transform="translate(-50%, -50%)"):(D.style.top="10px",D.style.transform="translateX(-50%)");else Object.assign(D.style,{position:"relative",width:"100%",zIndex:v});const I=Se("div",{display:"flex",width:T||w?"auto":"100%",maxWidth:"100%",flexDirection:"column",gap:T?"0":"12px",overflow:"hidden"}),R=Se("div",{display:"flex",width:T||w?"auto":"100%",justifyContent:T?N:"space-between",alignItems:T?C:"flex-start",gap:"12px"}),L=Se("div",{width:T||w?"auto":"100%",maxWidth:T?"70vw":w?"calc(min(700px, 80vw) - 66px)":"100%",overflow:"hidden",wordBreak:"normal",overflowWrap:"anywhere",whiteSpace:"normal",color:S}),M=(null==(c=e.image)?void 0:c.desktopUrl)||(null==(u=e.image)?void 0:u.mobileUrl);if(T&&M){const t=null==(d=e.image)?void 0:d.linkUrl,n=null==(p=e.image)?void 0:p.openInNewTab,r=Se("img",{display:"block",maxWidth:"70vw",maxHeight:"70vh",width:"auto",height:"auto",objectFit:"contain",objectPosition:(F=null==(f=e.image)?void 0:f.horizontalAlignment,H=null==(m=e.image)?void 0:m.verticalAlignment,`${"left"===F?"left":"right"===F?"right":"center"} ${"top"===H?"top":"bottom"===H?"bottom":"center"}`),cursor:t?"pointer":"",borderRadius:"rounded"===(null==(h=e.image)?void 0:h.cornerRadius)?"8px":"0"},{src:M,alt:e.title||"banner"});t&&r.addEventListener("click",()=>{n?window.open(t,"_blank","noopener,noreferrer"):window.location.href=t}),L.appendChild(r)}else{L.innerHTML=(P=e.text)?ve.sanitize(P,{ALLOWED_TAGS:["p","strong","em","u","img","span","div","a","br"],ALLOWED_ATTR:["style","src","class","href","target","alt","width","height"],ADD_ATTR:["target"],ALLOW_DATA_ATTR:!1}):"",(U=L).querySelectorAll("p").forEach(e=>{e.style.margin="0",e.style.whiteSpace="normal",e.style.overflowWrap="anywhere"}),U.querySelectorAll("strong").forEach(e=>{e.style.fontWeight="700",e.style.whiteSpace="normal"}),U.querySelectorAll("em").forEach(e=>{e.style.fontStyle="italic",e.style.whiteSpace="normal"}),U.querySelectorAll("u").forEach(e=>{e.style.textDecoration="underline",e.style.whiteSpace="normal"}),U.querySelectorAll("a").forEach(e=>{e.style.color="#3b82f6",e.style.textDecoration="underline",e.style.whiteSpace="normal",e.style.overflowWrap="anywhere","_blank"===e.getAttribute("target")&&e.setAttribute("rel","noopener noreferrer")}),U.querySelectorAll("img").forEach(e=>{e.style.maxWidth="100%",e.style.height="auto"});const t=function(e){const t=e.querySelector('[style*="text-align"]'),n=((null==t?void 0:t.style.textAlign)||e.style.textAlign||"").toLowerCase().trim();return"center"===n||"right"===n||"justify"===n?n:"left"}(L);L.style.textAlign=t,w&&(R.style.justifyContent="center"===(z=t)?"center":"right"===z?"flex-end":"flex-start")}var z,U,P,F,H,j;if(!T&&(null==(g=e.cta)?void 0:g.enabled)){const r=Se("button",{cursor:"pointer",border:"none",borderRadius:"6px",height:"36px",minHeight:"36px",padding:"0 16px",fontFamily:"Roboto, sans-serif",fontSize:"12px",fontWeight:"600",lineHeight:"20px",backgroundColor:Ae(Ee(e,["backgroundColor","buttonColor","aColor"]),n)||"#2f6df6",color:Ae(Ee(e,["textColor","color"]),n)||"#ffffff",boxSizing:"border-box",display:"inline-flex",alignItems:"center",justifyContent:"center"});if(r.type="button",r.textContent=e.cta.label||"CTA Button",r.addEventListener("click",t.onCtaClick),"inline"===E){R.appendChild(L);const e=Se("div",{display:"flex",flexDirection:"column",alignItems:"flex-end",justifyContent:"center",flexShrink:"0"});e.appendChild(r),R.appendChild(e),I.appendChild(R)}else{R.appendChild(L),I.appendChild(R);const e=Se("div",{display:"flex",width:"100%",justifyContent:(j=E,"left"===j?"flex-start":"right"===j?"flex-end":"center")});e.appendChild(r),I.appendChild(e)}}else R.appendChild(L),I.appendChild(R);D.appendChild(I);const W=Se("button",{position:w?"absolute":"",top:w?T?"16px":"12px":"",right:w?T?"16px":"12px":"",marginTop:w?"0":"8px",width:"20px",minWidth:"20px",height:"20px",cursor:"pointer",border:"none",borderRadius:"50%",background:"rgba(0,0,0,0.25)",color:O,fontSize:"16px",lineHeight:"1",display:"flex",alignItems:"center",justifyContent:"center",padding:"0",flexShrink:"0"});return W.type="button",W.setAttribute("aria-label","dismiss banner"),W.innerHTML="&times;",W.addEventListener("click",t.onDismiss),D.appendChild(W),D}ve.addHook("afterSanitizeAttributes",e=>{"A"===e.tagName&&"_blank"===e.getAttribute("target")&&e.setAttribute("rel","noopener noreferrer")});function Ce(){try{if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID()}catch{}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}function _e(e){if(e)try{(new Image).src=e}catch{}}const ke={LOCAL:"http://localhost:1335",SGTR:"https://api-v2.genesiv.org",STG:"https://staging-api-v2.genesiv.org",GEN:"https://api-v2.returning.ai"};class Oe extends HTMLElement{constructor(){super(...arguments),n(this,"rendered",null),n(this,"impressionFired",!1)}connectedCallback(){this.init()}disconnectedCallback(){this.cleanup()}resolveApiUrl(){const e=this.getAttribute("api-url")||this.getAttribute("data-api-url");if(e)return e.replace(/\/+$/,"");const t=this.getAttribute("domain-key")||this.getAttribute("data-domain-key");return t&&ke[t]?ke[t]:ke.LOCAL}device(){const e=window.innerWidth;return e<640?"mobile":e<1024?"tablet":"desktop"}async init(){var e;try{const t=this.getAttribute("community-id")||this.getAttribute("data-community-id");if(!t)return void console.error('[rai-banner] missing required "community-id" attribute');const n=this.resolveApiUrl(),r=this.getAttribute("storage-prefix")||this.getAttribute("data-storage-prefix")||"returning-ai-widget",o=this.getAttribute("surface")||"sdk",i=function(e,t){const n=`${t}-rai-banner-visitor-${e}`;try{let e=localStorage.getItem(n);return e||(e=Ce(),localStorage.setItem(n,e)),e}catch{return Ce()}}(t,r),a=this.getAttribute("page-path")||window.location.pathname,l=this.getAttribute("page-hostname")||window.location.hostname,s=this.getAttribute("page-url")||window.location.href,c=this.getAttribute("embed-token")||this.getAttribute("data-embed-token")||void 0,u=await async function(e,t){try{const n=await fetch(`${e}/v2/api/banner-sdk/eligible`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),r=await n.json();return r&&r.meta&&"success"===r.meta.status?r.data||{banner:null}:{banner:null,reason:r&&r.detail||"request_failed"}}catch{return{banner:null,reason:"network_error"}}}(n,{communityId:t,surface:o,embedToken:c,page:{url:s,hostname:l,path:a},viewport:{width:window.innerWidth,height:window.innerHeight,device:this.device()},identifier:{type:"anonymous_session",value:i}}),d=u.banner;if(!d)return void this.dispatch("rai-banner-empty",{reason:u.reason});if("hide"===(null==(e=d.placement)?void 0:e.mobileBehavior)&&"mobile"===this.device())return void this.dispatch("rai-banner-empty",{reason:"hidden_on_mobile"});this.mount(d)}catch(t){this.dispatch("rai-banner-error",{error:null==t?void 0:t.message})}}mount(e){var t,n,r,o,i,a,l;if(!this.isConnected)return;const s=Ne(e,{onCtaClick:()=>{var t,n,r;_e(null==(t=e.tracking)?void 0:t.clickUrl),this.dispatch("rai-banner-click",{bannerId:e.id});const o=null==(n=e.cta)?void 0:n.url;o&&((null==(r=e.cta)?void 0:r.openInNewTab)?window.open(o,"_blank","noopener,noreferrer"):window.location.href=o)},onDismiss:()=>{var t;_e(null==(t=e.tracking)?void 0:t.dismissUrl),this.dispatch("rai-banner-dismiss",{bannerId:e.id}),this.cleanup()}},this);this.rendered=s;if("overlay"===(null==(t=e.placement)?void 0:t.mode)||"popup"===(null==(n=e.placement)?void 0:n.mode))document.body.appendChild(s);else{const t=null==(r=e.placement)?void 0:r.targetSelector,n=t?document.querySelector(t):null;if(n){const t=(null==(o=e.placement)?void 0:o.insertion)||"append";"prepend"===t?n.insertBefore(s,n.firstChild):"before"===t?null==(i=n.parentNode)||i.insertBefore(s,n):"after"===t?null==(a=n.parentNode)||a.insertBefore(s,n.nextSibling):n.appendChild(s)}else this.style.display="block",this.style.width="100%",this.appendChild(s)}this.impressionFired||(this.impressionFired=!0,_e(null==(l=e.tracking)?void 0:l.impressionUrl),this.dispatch("rai-banner-impression",{bannerId:e.id}))}cleanup(){this.rendered&&this.rendered.parentNode&&this.rendered.parentNode.removeChild(this.rendered),this.rendered=null}dispatch(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}}function De(){var e;const t=((null==(e=document.currentScript)?void 0:e.hasAttribute("data-rai-banner"))?document.currentScript:null)||document.querySelector("script[data-rai-banner]");if(!t)return;if(!t.getAttribute("data-community-id"))return;if(document.querySelector("rai-banner"))return;const n=document.createElement("rai-banner"),r={"data-community-id":"community-id","data-api-url":"api-url","data-domain-key":"domain-key","data-surface":"surface","data-storage-prefix":"storage-prefix","data-page-path":"page-path","data-embed-token":"embed-token"};for(const[o,i]of Object.entries(r)){const e=t.getAttribute(o);e&&n.setAttribute(i,e)}document.body.appendChild(n)}return console.log("[rai-banner] v1.8.0"),"undefined"==typeof customElements||customElements.get("rai-banner")||customElements.define("rai-banner",Oe),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",De):De(),e.BannerRuntime=Oe,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e}({});