@returningai/widget-sdk 1.8.11 → 1.8.13
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 +24 -0
- package/README.md +27 -17
- package/dist/rai-banner.iife.js +1 -1
- package/dist/rai-banner.js +1 -1
- package/dist/rai-widget.iife.js +1 -1
- package/dist/rai-widget.js +127 -109
- package/dist/types/BaseWidget.d.ts +1 -0
- package/dist/types/core/fonts.d.ts +3 -0
- package/package.json +5 -3
package/CHANGELOG.md
CHANGED
|
@@ -75,6 +75,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
75
75
|
|
|
76
76
|
---
|
|
77
77
|
|
|
78
|
+
## [1.8.13] — 2026-10-14
|
|
79
|
+
|
|
80
|
+
### Fixed
|
|
81
|
+
|
|
82
|
+
- Changes to `theme` and `data-theme` now remount custom elements without a
|
|
83
|
+
browser reload and refresh cached palette, loader, and error colors.
|
|
84
|
+
- Theme switches and explicit widget reloads now restore the configured loading
|
|
85
|
+
screen until the new widget is ready, including repeated switches during loading.
|
|
86
|
+
- Earlier loader fade-outs and delayed settings responses no longer interfere
|
|
87
|
+
with the loading screen for a newer theme switch.
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## [1.8.12] — 2026-10-07
|
|
92
|
+
|
|
93
|
+
### Fixed
|
|
94
|
+
|
|
95
|
+
- Widget and loading-text font settings now preserve CSS font fallback lists
|
|
96
|
+
instead of treating the entire list as one Google Fonts family. This prevents
|
|
97
|
+
failed Google Fonts requests for system font stacks while keeping single-family
|
|
98
|
+
Google Fonts loading unchanged.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
78
102
|
## [1.8.11] — 2026-08-28
|
|
79
103
|
|
|
80
104
|
### Fixed
|
package/README.md
CHANGED
|
@@ -419,7 +419,7 @@ All attributes can be provided with or without the `data-` prefix — both work.
|
|
|
419
419
|
| `api-url` | No | ReturningAI widget auth server | Optional widget auth server override |
|
|
420
420
|
| `widget-url` | **Yes**\* | — | Widget URL (from dashboard). \*Not required when using `data-bundle-url` |
|
|
421
421
|
| `data-bundle-url` | No | — | URL to the widget bundle loader (`widget.js`) — triggers [bundle mode](#bundle-mode) (non-iframe) |
|
|
422
|
-
| `data-theme` | No | See note below | `light` or `dark`; explicit values override custom widget settings
|
|
422
|
+
| `data-theme` | No | See note below | `light` or `dark`; explicit values override custom widget settings |
|
|
423
423
|
| `data-email` | Public Embed only | — | User's email for identification. **Access Key Embed:** omit — identity is signed into `data-embed-token` |
|
|
424
424
|
| `data-embed-token` | Access Key Embed only | — | Short-lived JWT from your server. Carries signed user identifiers — no `data-*` identifier attributes needed |
|
|
425
425
|
| `data-language` | No | Browser language | Force a [supported language](#supported-languages) (e.g. `fr-FR`). Takes priority over browser language |
|
|
@@ -440,7 +440,7 @@ All attributes can be provided with or without the `data-` prefix — both work.
|
|
|
440
440
|
| `api-url` | No | ReturningAI widget auth server | Optional widget auth server override |
|
|
441
441
|
| `widget-url` | **Yes**\* | — | Widget URL (from dashboard). \*Not required when using `bundle-url` |
|
|
442
442
|
| `bundle-url` | No | — | URL to the widget bundle loader (`widget.js`) — triggers [bundle mode](#bundle-mode) (non-iframe) |
|
|
443
|
-
| `theme` | No | See note below | `light` or `dark`; explicit values override custom widget settings
|
|
443
|
+
| `theme` | No | See note below | `light` or `dark`; explicit values override custom widget settings |
|
|
444
444
|
| `data-email` | Public Embed only | — | User's email for identification. **Access Key Embed:** omit — identity is signed into `embed-token` |
|
|
445
445
|
| `embed-token` | Access Key Embed only | — | Short-lived JWT from your server. Carries signed user identifiers — no `data-*` identifier attributes needed |
|
|
446
446
|
| `language` | No | Browser language | Force a [supported language](#supported-languages) (e.g. `fr-FR`). Takes priority over browser language |
|
|
@@ -460,6 +460,16 @@ All attributes can be provided with or without the `data-` prefix — both work.
|
|
|
460
460
|
> widget's configured default theme in iframe and bundle modes. Set it
|
|
461
461
|
> explicitly when the host page needs to force light or dark mode.
|
|
462
462
|
|
|
463
|
+
Changing `theme` (or `data-theme`) on a mounted custom element remounts the
|
|
464
|
+
widget with the new colors without reloading the host page. The configured
|
|
465
|
+
loading screen is shown during the remount and dismissed when the widget is ready:
|
|
466
|
+
|
|
467
|
+
```js
|
|
468
|
+
document.querySelector("rai-custom-widget").setAttribute("theme", "light");
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
Remove the attribute to return to the custom widget's configured default.
|
|
472
|
+
|
|
463
473
|
### Container `<div>` (script-tag method only)
|
|
464
474
|
|
|
465
475
|
The SDK looks for a `<div>` with `id="returning-ai-widget-{YOUR_WIDGET_ID}"`. Size the div to control the widget dimensions:
|
|
@@ -501,21 +511,21 @@ In Public Embed mode, any `data-*` attribute not reserved by the SDK is forwarde
|
|
|
501
511
|
Use one of these values with `data-language` on a script-tag embed or
|
|
502
512
|
`language` on a custom element:
|
|
503
513
|
|
|
504
|
-
| Code | Language
|
|
505
|
-
| ----- |
|
|
506
|
-
| `en` | English
|
|
507
|
-
| `es` | Spanish
|
|
508
|
-
| `it` | Italian
|
|
509
|
-
| `pl` | Polish
|
|
510
|
-
| `nl` | Dutch
|
|
511
|
-
| `chs` | Simplified Chinese
|
|
512
|
-
| `ko` | Korean
|
|
513
|
-
| `th` | Thai
|
|
514
|
-
| `id` | Indonesian
|
|
515
|
-
| `ms` | Malay
|
|
516
|
-
| `fil` | Filipino
|
|
517
|
-
| `tr` | Turkish
|
|
518
|
-
| `mn` | Mongolian
|
|
514
|
+
| Code | Language | Code | Language |
|
|
515
|
+
| ----- | ------------------ | ----- | ------------------- |
|
|
516
|
+
| `en` | English | `de` | German |
|
|
517
|
+
| `es` | Spanish | `fr` | French |
|
|
518
|
+
| `it` | Italian | `pt` | Portuguese |
|
|
519
|
+
| `pl` | Polish | `da` | Danish |
|
|
520
|
+
| `nl` | Dutch | `ru` | Russian |
|
|
521
|
+
| `chs` | Simplified Chinese | `el` | Greek |
|
|
522
|
+
| `ko` | Korean | `cht` | Traditional Chinese |
|
|
523
|
+
| `th` | Thai | `ja` | Japanese |
|
|
524
|
+
| `id` | Indonesian | `vt` | Vietnamese |
|
|
525
|
+
| `ms` | Malay | `hi` | Hindi |
|
|
526
|
+
| `fil` | Filipino | `ta` | Tamil |
|
|
527
|
+
| `tr` | Turkish | `ar` | Arabic |
|
|
528
|
+
| `mn` | Mongolian | `sw` | Swahili |
|
|
519
529
|
|
|
520
530
|
Standard regional language tags are accepted and normalized automatically.
|
|
521
531
|
For example, `fr-FR` becomes `fr`, `zh-Hans` becomes `chs`, `zh-Hant` becomes
|
package/dist/rai-banner.iife.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
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
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&>&&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="×",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.11"),"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}({});
|
|
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&>&&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="×",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.13"),"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}({});
|
package/dist/rai-banner.js
CHANGED
|
@@ -2061,7 +2061,7 @@ class BannerRuntime extends HTMLElement {
|
|
|
2061
2061
|
this.dispatchEvent(new CustomEvent(name, { detail, bubbles: true, composed: true }));
|
|
2062
2062
|
}
|
|
2063
2063
|
}
|
|
2064
|
-
console.log(`[rai-banner] v${"1.8.
|
|
2064
|
+
console.log(`[rai-banner] v${"1.8.13"}`);
|
|
2065
2065
|
if (typeof customElements !== "undefined" && !customElements.get("rai-banner")) {
|
|
2066
2066
|
customElements.define("rai-banner", BannerRuntime);
|
|
2067
2067
|
}
|