Image

Helvar ActiveAhead – Intelligente drahtlose Lichtsteuerung

HELVAR ACTIVEAHEAD® ist eine wirklich intelligente und skalierbare Lösung für drahtlose Lichtsteuerung.

Mit einzigarten selbstlernenden Fähigkeiten, sorgt ActiveAhead für höchste Effizienz bei der Einrichtung und im Betrieb. ActiveAhead lernt kontinuierlich und generiert Erkenntnisse, die Ihnen helfen, Ihr Gebäude zu optimieren und menschenorientierte Räume zu schaffen. Die perfekte drahtlose, vernetzte Beleuchtung für Büros, Lagerhallen, Treppenhäuser und Parkgaragen.

Einführung von Node Advanced – Intelligenz von ActiveAhead
Kombiniert mit den Vorteilen der DALI-Adressierung

Image

Helvar erweitert seine preisgekrönte, intelligente, drahtlose Lichtsteuerungslösung ActiveAhead durch ein Upgrade auf ActiveAhead Node Advanced um eine neue Stufe der Skalierbarkeit. Das Upgrade ermöglicht die Verbindung und Steuerung einzelner DALI-Leuchten und ausgewählter DALI-Geräte wie Sensoren und Relais.
Mit diesen Ergänzungen können die Vorteile und die Einfachheit von ActiveAhead in neue Anwendungsbereiche wie Lagerhallen, neue Arten von Büros und Einzelhandel sowie in Anwendungsfälle mit DALI-Adressierung eingebracht werden.
Helvar ActiveAhead – Vorführung der Einrichtung
Der Wireless Director von Helvar, Matti Vesterinen, demonstriert anhand eines Demo-Cases, wie flexibel und einfach ein ActiveAhead®-Kontrollsystem eingerichtet werden kann.

Image

Links und Dokumente:
Broschüre
Presseinformation
System Overview

Image

Fallstudie:
Lesen Sie mehr über die intelligente und hochflexible Beleuchtungslösung bei Unipro, die eine einfache Anpassung an künftige Anforderungen ermöglicht.

Wirklich intelligente drahtlose Lichtsteuerung 

Helvar_CaseStudy_Finland_Office_Ramboll_1121.jpg

Selbstlernend mit erhöhtem Komfort

Drahtlos vernetzte ActiveAhead Nodes verwenden einen intelligenten Algorithmus und Bluetooth Mesh, um zu erfahren, wie der Raum genutzt wird. Die Leuchten sammeln Daten, sowohl von ihren eigenen Sensoren als auch von den anderen Leuchten, die sie umgeben. Sie reagieren auch auf die Menge des natürlichen Lichts im Raum.
Aufgrund dieses intelligenten DALI Netzwerk bleibt das Beleuchtungsniveau für den Nutzer optimal und passt sich kontinuierlich an mögliche Veränderungen an.
Helvar ActiveAhead saves energy and costs

Energiesparende und effiziente Gebäude

Im Vergleich zu einer geschalteten LED-Leuchte hebt ActiveAhead den Beleuchtungskomfort auf ein völlig neues Niveau und bietet gleichzeitig erhebliche Energieeinsparungen.
Zusätzlich zur vorausschauenden Dimmung der Beleuchtung, wird das Licht je nach Nutzungszweck der Räumlichkeit auf intelligente Weise gedimmt, wodurch Energie gespart wird.
Helvar ActiveAhead is fast and easy to install

Einfache und schnelle Installation

Mit ActiveAhead ausgestattete Leuchten lassen sich direkt nach der Montage der Leuchten an der gewünschten Position in Betrieb nehmen. Es ist keine Steuerverdrahtung, Programmierung oder Konfiguration erforderlich.
Die individuelle Einstellung und Gruppierung erfolgt über die ActiveAhead-App für Mobilgeräte. Kontinuierliches Lernen bedeutet, dass die intelligente Beleuchtung automatisch angepasst wird, ohne dass eine manuelle Neukonfigurierung nötig ist.

Mit Fallstudien mehr über ActiveAhead erfahren

Ramboll Fallstudie

Für den Hauptsitz von Ramboll fiel die Entscheidung für die Beleuchtung von allen Büroetagen und dem Parkhaus auf ActiveAhead, einer drahtlosen, selbstlernenden und zukunftsorientierten Lichtsteuerungslösung. Insgesamt wurden rund 3000 ActiveAhead-Sensor-Nodes installiert.

YIT Fallstudie

YIT war äußerst zufrieden mit der einfachen Installation, Konfiguration und Flexibilität der ActiveAhead-Lösung, weshalb das Unternehmen auch für die zweite Phase der Renovierung des Firmensitzes ActiveAhead wählte.
Wartsila Case Study

Wärtsilä Fallstudie

Der Wärtsilä-Campus ist mit ActiveAhead der weltweit ersten durch künstliche Intelligenz gesteuerten Lichtsteuerung, ausgestattet. Wärtsilä hatte es sich zum Ziel gesetzt, alle Gebäude mit modernster Technologie auszustatten und entschied sich daher für die drahtlose, intelligente und zukunftsorientierte Beleuchtung, die nur ActiveAhead bieten kann.

ActiveAhead – ideal für Renovierungs- und Neubauprojekte

Broschüre herunterladen

ActiveAhead – ideal für Renovierungs- und Neubauprojekte

ActiveAhead-Videos

Wirklich intelligente vernetzte Beleuchtung

Finden Sie heraus, warum selbstlernende ActiveAhead die ultimative Lösung für drahtlose Lichtsteuerung ist.

Kontinuierlich Selbstlernendes DALI Netzwerk

Möchten Sie mehr über intelligente ActiveAhead Lichtsteuerung in Großraumbereichen erfahren?

Wie wird ActiveAhead in einem Parkhaus konfiguriert?

Diese einfache Schritt-für-Schritt-Anleitung zeigt, wie einfach und schnell es ist, unsere intelligente ActiveAhead Lichtsteuerung mit der ActiveAhead-App zu konfigurieren!

Einrichtung der persönlichen ActiveTune-Beleuchtungssteuerung

Mit der Helvar ActiveTune-Lösung können Raumnutzer das Licht über ihrem Schreibtisch mit einer mobilen App einstellen. Dieses Video zeigt, wie schnell eine ActiveAhead-Leuchte mit einem ActiveTune-Sticker über die ActiveAhead-Mobil-App gekoppelt werden kann.

Wie man Operationen auf Netzwerkebene in ActiveAhead verwendet

ActiveAhead-Knoten befinden sich in ein und demselben Netzwerk, wodurch es möglich ist, das gesamte Netzwerk oder Teile davon zu steuern. In diesem Video wird gezeigt, wie Sie die Vorteile von Operationen auf Netzebene mit der ActiveAhead Mobile App nutzen können.

Einrichten der Korridor-Haltefunktion in ActiveAhead

Die Korridor-Haltefunktion lässt die Lichter einer Gruppe an, während eine andere Gruppe aktiv ist. Dieses Video zeigt, wie einfach und schnell die Korridor-Haltefunktion mit der ActiveAhead Mobile App aktiviert werden kann.

Wie installiert man Helvar ActiveAhead-fähige Leuchten?

Die Installation von ActiveAhead Ready-Leuchten ist einfach und schnell. Hier wird die empfohlene Sensorpositionierung für einen optimalen Sensorbetrieb gezeigt. PDF

Helvar ActiveAhead – Vorführung der Einrichtung

Der Wireless Director von Helvar, Matti Vesterinen, demonstriert anhand eines Demo-Cases, wie flexibel und einfach ein ActiveAhead®-Kontrollsystem eingerichtet werden kann.

10 Vorteile von ActiveAhead

Entdecken Sie die einzigartigen Vorteile von Helvar ActiveAhead und verwandeln Sie Ihren Raum noch heute! Das Video zeigt Ausschnitte aus Helvar Fallstudien: Bravida, YIT, Ramboll, Wärtsilä.

Wie man einen Besprechungsraum mit Helvar ActiveAhead Node Advanced konfiguriert

Helvar ActiveAhead Node Advanced ermöglicht es Ihnen, einen Besprechungsraum mit DALI-Leuchten und DALI-Geräten Ihrer Wahl zu konfigurieren. Dieses Video führt Sie durch den gesamten Konfigurationsprozess eines Besprechungsraums, einschließlich der Einstellungen, der Einrichtung des Wandpanels und der Steuerungsfunktionalität.

ActiveAhead – Konfiguration wählen

Die Wahl der richtigen Konfiguration für Ihr Projekt ist einfach. Wählen Sie je nach Raum und Leuchtentyp eine ActiveAhead-Node und den dazu passenden DALI LED-Treiber aus. Wählen Sie gegebenenfalls einfach den DALI Sensor und einen möglichen Halter dafür aus. Für Besprechungszimmer empfehlen wir die Verwendung eines drahtlosen Bedienpanel für den Abruf von Lichtszenen und schon sind Sie fertig. Falls erforderlich, kann die Feinabstimmung der Konfiguration vor Ort mit der ActiveAhead-App für Mobilgeräte erfolgen.

1 Auswahl der Node

Image

5634 ActiveAhead Node Sense
Kombiniert DALI Funk, Prozessor, Multisensor und Verbindungskabel zu einem kleinen, leistungsstarken ActiveAhead Node Sense.
Produktseite
Runde Halterung

Freedom-Node-ActiveAhead

5652 ActiveAhead Node
Extrem kompakte, leistungsstarker ActiveAhead Node mit Selbstlernfunktion zum Einbau in die Leuchte.
Produktseite

Image

5609 ActiveAhead Node Advanced
Erweitert die ActiveAhead-Funktionen auf Standard-DALI-Leuchten. Es unterstützt auch Helvar DALI-System-Sensoren und bietet flexible Installationen je nach Platzbedarf. Super einfach zu installieren, z.B. an der Decke.
Produktseite

ActiveAhead Nodes – Standard or DALI
Ständige Umgebungsanalyse – kontinuierliches Lernen. ActiveAhead Nodes kommunizieren miteinander über Bluetooth Mesh, um vorausschauend festzustellen, wo und welches Licht benötigt wird. ActiveAhead Nodes nehmen ihre Arbeit vom Moment des Einschaltens auf und lernen danach kontinuierlich.

2 Wählen Sie einen Treiber

Helvar ActiveAhead Freedom LED Drivers

ActiveAhead Freedom LED Treiber
Die Auswahl der Freedom LED-Treiber ist für die Verwendung mit ActiveAhead Node Sense und ActiveAhead Node optimiert.
Produktseite

Helvar DALI LED Drivers

DALI LED-Treiber
DALI LED-Treiber von Helvar sind energieeffizient, langlebig und von hoher Qualität.
Produktseite

Image

5610 ActiveAhead Adapter DA
Ermöglicht die Verwendung von Standard-DALI-LED-Treibern mit ActiveAhead Node Sense und ActiveAhead Node.
Produktseite

ActiveAhead-Treiber: Freedom oder DALI
Die DALI LED-Treiber von Helvar sind für energieeffiziente, langlebige, qualitativ hochwertige und professionelle Beleuchtungssteuerung konzipiert. Gemeinsam mit ActiveAhead Nodes bieten Freedom LED-Treiber eine optimale Lösung. Darüber hinaus können die LED-Treiber der DALI-Standardreihe an ein ActiveAhead-Netzwerk angeschlossen werden, wodurch eine große Auswahl an verschiedenen Treiberoptionen ermöglicht wird. Dadurch erhalten sie die Möglichkeit, kontinuierlich zu lernen und Lichtverhältnisse vorausschauend zu regulieren.

3 Wählen Sie Ihren Sensor

Funktioniert mit ActiveAhead Node- und ActiveAhead Node Advanced-Produkten. ActiveAhead Node Sense verfügt über integrierte Sensoren.

ActiveAhead_5630_Sense

Sensoren für den Innenbereich
ActiveAhead Sense mit PIR-Bewegungs- und Lichtsensor ist klein, leistungsfähig, einfach in der Leuchte zu montieren und benötigt keine separate Stromversorgung.
Produktseite
Runde Sensorhalterung
Rechteckige Sensorhalterung

ActiveAhead

Sensoren für den Außenbereich
Mit dem IP65 Sensor, der an der Leuchte montiert wird, findet ActiveAhead ab sofort auch im Außenbereich Verwendung.
Produktseite

Bedienpanel

Sofort einsatzbereit
Der optional erhältliche EnOcean Funktaster kann fast überall angebracht werden und ist somit ideal, wenn eine manuelle Beleuchtungssteuerung gefordert ist. Die Kommunikation zwischen Bedienpanel und ActiveAhead Nodes ermöglicht das Aufrufen verschiedener Beleuchtungsszenarien.
Produktseite

Image

Personalisierte Beleuchtung mit ActiveTune

Stellen Sie die Beleuchtung an Ihrem Schreibtisch ganz nach Wunsch und passend zu Ihren jeweiligen Aufgaben ein. Die Beleuchtungseinstellungen können gespeichert und jederzeit über die ActiveTune-App für Mobilgeräte abgerufen werden. Laden Sie die kostenlose App herunter, scannen Sie den QR-Code und nutzen Sie die Lichteinstellung, die perfekt zu Ihren Bedürfnissen passt.
Produktseite

ActiveTune

Image

Image

App für Mobilgeräte

Einfach personalisierbar
Der große Vorteil von ActiveAhead besteht im endlosen Selbstlernvermögen des Beleuchtungssystems. Es besteht aber auch die Möglichkeit, individuelle Einstellungen vorzunehmen. Nach Installation der App reicht eine Bewegung Ihres Fingers und Sie haben die vollständige Kontrolle über Ihre Beleuchtung.

Image

Produktseite

Helvar ActiveAhead App

Helvar ActiveHeat Thermostat

Intelligenter Thermostat
Helvar ActiveHeat ist ein intelligenter und einfach zu bedienender energiesparender Thermostat. Der Thermostat hört auf die ActiveAhead-Knoten und schaltet zwischen ECO- und Komfort-Temperaturen um, je nach der aktuellen Raumbelegung in der Nähe.
Produktseite

Image

Helvar arbeitet mit ausgewählten führenden Leuchtenherstellern zusammen. ActiveAhead mit Selbstlernvermögen kann einfach in fast jede Leuchte (innen oder außen) integriert werden. Mehr herausfinden.

");const ee=m?m.createHTML(E):E;if(Lt===Xe)try{C=new c().parseFromString(ee,gn)}catch(re){}if(!C||!C.documentElement){C=N.createDocument(Lt,"template",null);try{C.documentElement.innerHTML=Vi?b:ee}catch(re){}}const ce=C.body||C.documentElement;return E&&L&&ce.insertBefore(n.createTextNode(L),ce.childNodes[0]||null),Lt===Xe?Q.call(C,pt?"html":"body")[0]:pt?C.documentElement:ce},ul=function(E){return A.call(E.ownerDocument||E,E,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},ji=function(E){return E instanceof p&&(typeof E.nodeName!="string"||typeof E.textContent!="string"||typeof E.removeChild!="function"||!(E.attributes instanceof f)||typeof E.removeAttribute!="function"||typeof E.setAttribute!="function"||typeof E.namespaceURI!="string"||typeof E.insertBefore!="function"||typeof E.hasChildNodes!="function")},cl=function(E){return typeof l=="function"&&E instanceof l};function Qe(x,E,C){In(x,L=>{L.call(t,E,C,xt)})}const fl=function(E){let C=null;if(Qe(B.beforeSanitizeElements,E,null),ji(E))return ze(E),!0;const L=ae(E.nodeName);if(Qe(B.uponSanitizeElement,E,{tagName:L,allowedTags:oe}),Xn&&E.hasChildNodes()&&!cl(E.firstElementChild)&&me(/<[/\w!]/g,E.innerHTML)&&me(/<[/\w!]/g,E.textContent)||E.nodeType===Yt.progressingInstruction||Xn&&E.nodeType===Yt.comment&&me(/<[/\w]/g,E.data))return ze(E),!0;if(!oe[L]||hn[L]){if(!hn[L]&&hl(L)&&(ne.tagNameCheck instanceof RegExp&&me(ne.tagNameCheck,L)||ne.tagNameCheck instanceof Function&&ne.tagNameCheck(L)))return!1;if(Fi&&!Rt[L]){const ee=I(E)||E.parentNode,ce=_(E)||E.childNodes;if(ce&&ee){const re=ce.length;for(let _e=re-1;_e>=0;--_e){const Je=g(ce[_e],!0);Je.__removalCount=(E.__removalCount||0)+1,ee.insertBefore(Je,w(E))}}}return ze(E),!0}return E instanceof a&&!bg(E)||(L==="noscript"||L==="noembed"||L==="noframes")&&me(/<\/no(script|embed|frames)/i,E.innerHTML)?(ze(E),!0):(Nt&&E.nodeType===Yt.text&&(C=E.textContent,In([He,Fe,Li],ee=>{C=Wt(C,ee," ")}),E.textContent!==C&&(jt(t.removed,{element:E.cloneNode()}),E.textContent=C)),Qe(B.afterSanitizeElements,E,null),!1)},dl=function(E,C,L){if(Js&&(C==="id"||C==="name")&&(L in n||L in Tg))return!1;if(!(ki&&!xi[C]&&me(dg,C))){if(!(Ks&&me(hg,C))){if(!se[C]||xi[C]){if(!(hl(E)&&(ne.tagNameCheck instanceof RegExp&&me(ne.tagNameCheck,E)||ne.tagNameCheck instanceof Function&&ne.tagNameCheck(E))&&(ne.attributeNameCheck instanceof RegExp&&me(ne.attributeNameCheck,C)||ne.attributeNameCheck instanceof Function&&ne.attributeNameCheck(C,E))||C==="is"&&ne.allowCustomizedBuiltInElements&&(ne.tagNameCheck instanceof RegExp&&me(ne.tagNameCheck,L)||ne.tagNameCheck instanceof Function&&ne.tagNameCheck(L))))return!1}else if(!zi[C]){if(!me($s,Wt(L,qs,""))){if(!((C==="src"||C==="xlink:href"||C==="href")&&E!=="script"&&ql(L,"data:")===0&&nl[E])){if(!(Xs&&!me(pg,Wt(L,qs,"")))){if(L)return!1}}}}}}return!0},hl=function(E){return E!=="annotation-xml"&&vr(E,gg)},pl=function(E){Qe(B.beforeSanitizeAttributes,E,null);const{attributes:C}=E;if(!C||ji(E))return;const L={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:se,forceKeepAttr:void 0};let ee=C.length;for(;ee--;){const ce=C[ee],{name:re,namespaceURI:_e,value:Je}=ce,kt=ae(re),Wi=Je;let le=re==="value"?Wi:$l(Wi);if(L.attrName=kt,L.attrValue=le,L.keepAttr=!0,L.forceKeepAttr=void 0,Qe(B.uponSanitizeAttribute,E,L),le=L.attrValue,el&&(kt==="id"||kt==="name")&&(gt(re,E),le=mg+le),Xn&&me(/((--!?|])>)|<\/(style|title|textarea)/i,le)){gt(re,E);continue}if(kt==="attributename"&&vr(le,"href")){gt(re,E);continue}if(L.forceKeepAttr)continue;if(!L.keepAttr){gt(re,E);continue}if(!Qs&&me(/\/>/i,le)){gt(re,E);continue}Nt&&In([He,Fe,Li],ml=>{le=Wt(le,ml," ")});const gl=ae(E.nodeName);if(!dl(gl,kt,le)){gt(re,E);continue}if(m&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!_e)switch(h.getAttributeType(gl,kt)){case"TrustedHTML":{le=m.createHTML(le);break}case"TrustedScriptURL":{le=m.createScriptURL(le);break}}if(le!==Wi)try{_e?E.setAttributeNS(_e,re,le):E.setAttribute(re,le),ji(E)?ze(E):po(t.removed)}catch(ml){gt(re,E)}}Qe(B.afterSanitizeAttributes,E,null)},wg=function x(E){let C=null;const L=ul(E);for(Qe(B.beforeSanitizeShadowDOM,E,null);C=L.nextNode();)Qe(B.uponSanitizeShadowNode,C,null),fl(C),pl(C),C.content instanceof o&&x(C.content);Qe(B.afterSanitizeShadowDOM,E,null)};return t.sanitize=function(x){let E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},C=null,L=null,ee=null,ce=null;if(Vi=!x,Vi&&(x=""),L=C.ownerDocument.importNode(x,!0),L.nodeType===Yt.element&&L.nodeName==="BODY"||L.nodeName==="HTML"?C=L:C.appendChild(L);else{if(!Dt&&!Nt&&!pt&&x.indexOf("<")===-1)return m&&Jn?m.createHTML(x):x;if(C=ll(x),!C)return Dt?null:Jn?b:""}C&&Hi&&ze(C.firstChild);const re=ul(pn?x:C);for(;ee=re.nextNode();)fl(ee),pl(ee),ee.content instanceof o&&wg(ee.content);if(pn)return x;if(Dt){if(Qn)for(ce=U.call(C.ownerDocument);C.firstChild;)ce.appendChild(C.firstChild);else ce=C;return(se.shadowroot||se.shadowrootmode)&&(ce=W.call(r,ce,!0)),ce}let _e=pt?C.outerHTML:C.innerHTML;return pt&&oe["!doctype"]&&C.ownerDocument&&C.ownerDocument.doctype&&C.ownerDocument.doctype.name&&me(_o,C.ownerDocument.doctype.name)&&(_e=" `+_e),Nt&&In([He,Fe,Li],Je=>{_e=Wt(_e,Je," ")}),m&&Jn?m.createHTML(_e):_e},t.setConfig=function(){let x=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Gi(x),Ui=!0},t.clearConfig=function(){xt=null,Ui=!1},t.isValidAttribute=function(x,E,C){xt||Gi({});const L=ae(x),ee=ae(E);return dl(L,ee,C)},t.addHook=function(x,E){typeof E=="function"&&jt(B[x],E)},t.removeHook=function(x,E){if(E!==void 0){const C=jl(B[x],E);return C===-1?void 0:Wl(B[x],C,1)[0]}return po(B[x])},t.removeHooks=function(x){B[x]=[]},t.removeAllHooks=function(){B=bo()},t}var lu=wo();class uu{sanitizeString(t){if(!T(t))return"";try{return lu.sanitize(t)}catch(n){return y.log.error("could not verify that content was safe",n),""}}sanitizeObject(t){const n=H(t);if(!O(t)&&!n)if(T(t))try{return this.sanitizeString(String(t))}catch(r){return y.log.error("could not verify that content was safe",r),""}else return t;if(n)return this.sanitizeArray(t);for(const r in t)O(t[r])?t[r]=this.sanitizeObject(t[r]):H(t[r])?t[r]=this.sanitizeArray(t[r]):J(t,r)&&(t[r]=this.sanitizeObject(t[r]));return t}sanitizeArray(t){if(!H(t))return[];for(let n=0;n(e.TransformerConfig="TransformerConfig",e.Element="Element",e.Any="Any",e))(ut||{}),Nn=(e=>(e.SchemaPath="SchemaPath",e))(Nn||{});class du{add(t,n,r){if(typeof arguments[0]!="string")for(let i in arguments[0])this.add(i,arguments[0][i],arguments[1]);else(Array.isArray(t)?t:[t]).forEach(function(i){this[i]=this[i]||[],n&&this[i][r?"unshift":"push"](n)},this)}run(t,n){this[t]=this[t]||[],this[t].forEach(function(r){r.call(n&&n.context?n.context:n,n)})}}class hu{constructor(t){this.jsep=t,this.registered={}}register(){for(var t=arguments.length,n=new Array(t),r=0;r{if(typeof i!="object"||!i.name||!i.init)throw new Error("Invalid JSEP plugin format");this.registered[i.name]||(i.init(this.jsep),this.registered[i.name]=i)})}}class S{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+S.version}static addUnaryOp(t){return S.max_unop_len=Math.max(t.length,S.max_unop_len),S.unary_ops[t]=1,S}static addBinaryOp(t,n,r){return S.max_binop_len=Math.max(t.length,S.max_binop_len),S.binary_ops[t]=n,r?S.right_associative.add(t):S.right_associative.delete(t),S}static addIdentifierChar(t){return S.additional_identifier_chars.add(t),S}static addLiteral(t,n){return S.literals[t]=n,S}static removeUnaryOp(t){return delete S.unary_ops[t],t.length===S.max_unop_len&&(S.max_unop_len=S.getMaxKeyLen(S.unary_ops)),S}static removeAllUnaryOps(){return S.unary_ops={},S.max_unop_len=0,S}static removeIdentifierChar(t){return S.additional_identifier_chars.delete(t),S}static removeBinaryOp(t){return delete S.binary_ops[t],t.length===S.max_binop_len&&(S.max_binop_len=S.getMaxKeyLen(S.binary_ops)),S.right_associative.delete(t),S}static removeAllBinaryOps(){return S.binary_ops={},S.max_binop_len=0,S}static removeLiteral(t){return delete S.literals[t],S}static removeAllLiterals(){return S.literals={},S}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(t){this.expr=t,this.index=0}static parse(t){return new S(t).parse()}static getMaxKeyLen(t){return Math.max(0,...Object.keys(t).map(n=>n.length))}static isDecimalDigit(t){return t>=48&&t<=57}static binaryPrecedence(t){return S.binary_ops[t]||0}static isIdentifierStart(t){return t>=65&&t<=90||t>=97&&t<=122||t>=128&&!S.binary_ops[String.fromCharCode(t)]||S.additional_identifier_chars.has(String.fromCharCode(t))}static isIdentifierPart(t){return S.isIdentifierStart(t)||S.isDecimalDigit(t)}throwError(t){const n=new Error(t+" at character "+this.index);throw n.index=this.index,n.description=t,n}runHook(t,n){if(S.hooks[t]){const r={context:this,node:n};return S.hooks.run(t,r),r.node}return n}searchHook(t){if(S.hooks[t]){const n={context:this};return S.hooks[t].find(function(r){return r.call(n.context,n),n.node}),n.node}}gobbleSpaces(){let t=this.code;for(;t===S.SPACE_CODE||t===S.TAB_CODE||t===S.LF_CODE||t===S.CR_CODE;)t=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");const t=this.gobbleExpressions(),n=t.length===1?t[0]:{type:S.COMPOUND,body:t};return this.runHook("after-all",n)}gobbleExpressions(t){let n=[],r,i;for(;this.index0;){if(S.binary_ops.hasOwnProperty(t)&&(!S.isIdentifierStart(this.code)||this.index+t.lengtho.right_a&&p.right_a?r>p.prec:r<=p.prec;for(;i.length>2&&f(i[i.length-2]);)l=i.pop(),n=i.pop().value,s=i.pop(),t={type:S.BINARY_EXP,operator:n,left:s,right:l},i.push(t);t=this.gobbleToken(),t||this.throwError("Expected expression after "+u),i.push(o,t)}for(a=i.length-1,t=i[a];a>1;)t={type:S.BINARY_EXP,operator:i[a-1].value,left:i[a-2],right:t},a-=2;return t}gobbleToken(){let t,n,r,i;if(this.gobbleSpaces(),i=this.searchHook("gobble-token"),i)return this.runHook("after-token",i);if(t=this.code,S.isDecimalDigit(t)||t===S.PERIOD_CODE)return this.gobbleNumericLiteral();if(t===S.SQUOTE_CODE||t===S.DQUOTE_CODE)i=this.gobbleStringLiteral();else if(t===S.OBRACK_CODE)i=this.gobbleArray();else{for(n=this.expr.substr(this.index,S.max_unop_len),r=n.length;r>0;){if(S.unary_ops.hasOwnProperty(n)&&(!S.isIdentifierStart(this.code)||this.index+n.length=n.length&&this.throwError("Unexpected token "+String.fromCharCode(t));break}else if(o===S.COMMA_CODE){if(this.index++,i++,i!==n.length){if(t===S.CPAREN_CODE)this.throwError("Unexpected token ,");else if(t===S.CBRACK_CODE)for(let s=n.length;s":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10,"**":11},right_associative:new Set(["**"]),additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"}),S.max_unop_len=S.getMaxKeyLen(S.unary_ops),S.max_binop_len=S.getMaxKeyLen(S.binary_ops);const We=e=>new S(e).parse(),gu=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(S).filter(e=>!gu.includes(e)&&We[e]===void 0).forEach(e=>{We[e]=S[e]}),We.Jsep=S;const mu="ConditionalExpression";var vu={name:"ternary",init(e){e.hooks.add("after-expression",function(n){if(n.node&&this.code===e.QUMARK_CODE){this.index++;const r=n.node,i=this.gobbleExpression();if(i||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;const o=this.gobbleExpression();if(o||this.throwError("Expected expression"),n.node={type:mu,test:r,consequent:i,alternate:o},r.operator&&e.binary_ops[r.operator]<=.9){let s=r;for(;s.right.operator&&e.binary_ops[s.right.operator]<=.9;)s=s.right;n.node.test=s.right,s.right=n.node,n.node=r}}else this.throwError("Expected :")}})}};We.plugins.register(vu);const Co=47,Eu=92;var yu={name:"regex",init(e){e.hooks.add("gobble-token",function(n){if(this.code===Co){const r=++this.index;let i=!1;for(;this.index=97&&a<=122||a>=65&&a<=90||a>=48&&a<=57)s+=this.char;else break}let l;try{l=new RegExp(o,s)}catch(a){this.throwError(a.message)}return n.node={type:e.LITERAL,value:l,raw:this.expr.slice(r-1,this.index)},n.node=this.gobbleTokenProperty(n.node),n.node}this.code===e.OBRACK_CODE?i=!0:i&&this.code===e.CBRACK_CODE&&(i=!1),this.index+=this.code===Eu?2:1}this.throwError("Unclosed Regex")}})}};const wr=43,Ct={name:"assignment",assignmentOperators:new Set(["=","*=","**=","/=","%=","+=","-=","<<=",">>=",">>>=","&=","^=","|=","||=","&&=","??="]),updateOperators:[wr,45],assignmentPrecedence:.9,init(e){const t=[e.IDENTIFIER,e.MEMBER_EXP];Ct.assignmentOperators.forEach(r=>e.addBinaryOp(r,Ct.assignmentPrecedence,!0)),e.hooks.add("gobble-token",function(i){const o=this.code;Ct.updateOperators.some(s=>s===o&&s===this.expr.charCodeAt(this.index+1))&&(this.index+=2,i.node={type:"UpdateExpression",operator:o===wr?"++":"--",argument:this.gobbleTokenProperty(this.gobbleIdentifier()),prefix:!0},(!i.node.argument||!t.includes(i.node.argument.type))&&this.throwError(`Unexpected ${i.node.operator}`))}),e.hooks.add("after-token",function(i){if(i.node){const o=this.code;Ct.updateOperators.some(s=>s===o&&s===this.expr.charCodeAt(this.index+1))&&(t.includes(i.node.type)||this.throwError(`Unexpected ${i.node.operator}`),this.index+=2,i.node={type:"UpdateExpression",operator:o===wr?"++":"--",argument:i.node,prefix:!1})}}),e.hooks.add("after-expression",function(i){i.node&&n(i.node)});function n(r){Ct.assignmentOperators.has(r.operator)?(r.type="AssignmentExpression",n(r.left),n(r.right)):r.operator||Object.values(r).forEach(i=>{i&&typeof i=="object"&&n(i)})}}};We.plugins.register(yu,Ct),We.addUnaryOp("typeof"),We.addLiteral("null",null),We.addLiteral("undefined",void 0);const _u=new Set(["constructor","__proto__","__defineGetter__","__defineSetter__"]),Z={evalAst(e,t){switch(e.type){case"BinaryExpression":case"LogicalExpression":return Z.evalBinaryExpression(e,t);case"Compound":return Z.evalCompound(e,t);case"ConditionalExpression":return Z.evalConditionalExpression(e,t);case"Identifier":return Z.evalIdentifier(e,t);case"Literal":return Z.evalLiteral(e,t);case"MemberExpression":return Z.evalMemberExpression(e,t);case"UnaryExpression":return Z.evalUnaryExpression(e,t);case"ArrayExpression":return Z.evalArrayExpression(e,t);case"CallExpression":return Z.evalCallExpression(e,t);case"AssignmentExpression":return Z.evalAssignmentExpression(e,t);default:throw SyntaxError("Unexpected expression",e)}},evalBinaryExpression(e,t){return{"||":(r,i)=>r||i(),"&&":(r,i)=>r&&i(),"|":(r,i)=>r|i(),"^":(r,i)=>r^i(),"&":(r,i)=>r&i(),"==":(r,i)=>r==i(),"!=":(r,i)=>r!=i(),"===":(r,i)=>r===i(),"!==":(r,i)=>r!==i(),"<":(r,i)=>r":(r,i)=>r>i(),"<=":(r,i)=>r<=i(),">=":(r,i)=>r>=i(),"<<":(r,i)=>r<>":(r,i)=>r>>i(),">>>":(r,i)=>r>>>i(),"+":(r,i)=>r+i(),"-":(r,i)=>r-i(),"*":(r,i)=>r*i(),"/":(r,i)=>r/i(),"%":(r,i)=>r%i()}[e.operator](Z.evalAst(e.left,t),()=>Z.evalAst(e.right,t))},evalCompound(e,t){let n;for(let r=0;r-Z.evalAst(r,t),"!":r=>!Z.evalAst(r,t),"~":r=>~Z.evalAst(r,t),"+":r=>+Z.evalAst(r,t),typeof:r=>typeof Z.evalAst(r,t)}[e.operator](e.argument)},evalArrayExpression(e,t){return e.elements.map(n=>Z.evalAst(n,t))},evalCallExpression(e,t){const n=e.arguments.map(i=>Z.evalAst(i,t));return Z.evalAst(e.callee,t)(...n)},evalAssignmentExpression(e,t){if(e.left.type!=="Identifier")throw SyntaxError("Invalid left-hand side in assignment");const n=e.left.name,r=Z.evalAst(e.right,t);return t[n]=r,t[n]}};class Tu{constructor(t){this.code=t,this.ast=We(this.code)}runInNewContext(t){const n=Object.assign(Object.create(null),t);return Z.evalAst(this.ast,n)}}function it(e,t){return e=e.slice(),e.push(t),e}function Sr(e,t){return t=t.slice(),t.unshift(e),t}class bu extends Error{constructor(t){super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),this.avoidNew=!0,this.value=t,this.name="NewError"}}function j(e,t,n,r,i){if(!(this instanceof j))try{return new j(e,t,n,r,i)}catch(s){if(!s.avoidNew)throw s;return s.value}typeof e=="string"&&(i=r,r=n,n=t,t=e,e=null);const o=e&&typeof e=="object";if(e=e||{},this.json=e.json||n,this.path=e.path||t,this.resultType=e.resultType||"value",this.flatten=e.flatten||!1,this.wrap=Object.hasOwn(e,"wrap")?e.wrap:!0,this.sandbox=e.sandbox||{},this.eval=e.eval===void 0?"safe":e.eval,this.ignoreEvalErrors=typeof e.ignoreEvalErrors=="undefined"?!1:e.ignoreEvalErrors,this.parent=e.parent||null,this.parentProperty=e.parentProperty||null,this.callback=e.callback||r||null,this.otherTypeCallback=e.otherTypeCallback||i||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},e.autostart!==!1){const s={path:o?e.path:t};o?"json"in e&&(s.json=e.json):s.json=n;const l=this.evaluate(s);if(!l||typeof l!="object")throw new bu(l);return l}}j.prototype.evaluate=function(e,t,n,r){let i=this.parent,o=this.parentProperty,{flatten:s,wrap:l}=this;if(this.currResultType=this.resultType,this.currEval=this.eval,this.currSandbox=this.sandbox,n=n||this.callback,this.currOtherTypeCallback=r||this.otherTypeCallback,t=t||this.json,e=e||this.path,e&&typeof e=="object"&&!Array.isArray(e)){if(!e.path&&e.path!=="")throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!Object.hasOwn(e,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:t}=e),s=Object.hasOwn(e,"flatten")?e.flatten:s,this.currResultType=Object.hasOwn(e,"resultType")?e.resultType:this.currResultType,this.currSandbox=Object.hasOwn(e,"sandbox")?e.sandbox:this.currSandbox,l=Object.hasOwn(e,"wrap")?e.wrap:l,this.currEval=Object.hasOwn(e,"eval")?e.eval:this.currEval,n=Object.hasOwn(e,"callback")?e.callback:n,this.currOtherTypeCallback=Object.hasOwn(e,"otherTypeCallback")?e.otherTypeCallback:this.currOtherTypeCallback,i=Object.hasOwn(e,"parent")?e.parent:i,o=Object.hasOwn(e,"parentProperty")?e.parentProperty:o,e=e.path}if(i=i||null,o=o||null,Array.isArray(e)&&(e=j.toPathString(e)),!e&&e!==""||!t)return;const a=j.toPathArray(e);a[0]==="$"&&a.length>1&&a.shift(),this._hasParentSelector=null;const u=this._trace(a,t,["$"],i,o,n).filter(function(f){return f&&!f.isParentSelector});return u.length?!l&&u.length===1&&!u[0].hasArrExpr?this._getPreferredOutput(u[0]):u.reduce((f,p)=>{const c=this._getPreferredOutput(p);return s&&Array.isArray(c)?f=f.concat(c):f.push(c),f},[]):l?[]:void 0},j.prototype._getPreferredOutput=function(e){const t=this.currResultType;switch(t){case"all":{const n=Array.isArray(e.path)?e.path:j.toPathArray(e.path);return e.pointer=j.toPointer(n),e.path=typeof e.path=="string"?e.path:j.toPathString(e.path),e}case"value":case"parent":case"parentProperty":return e[t];case"path":return j.toPathString(e[t]);case"pointer":return j.toPointer(e.path);default:throw new TypeError("Unknown result type")}},j.prototype._handleCallback=function(e,t,n){if(t){const r=this._getPreferredOutput(e);e.path=typeof e.path=="string"?e.path:j.toPathString(e.path),t(r,n,e)}},j.prototype._trace=function(e,t,n,r,i,o,s,l){let a;if(!e.length)return a={path:n,value:t,parent:r,parentProperty:i,hasArrExpr:s},this._handleCallback(a,o,"value"),a;const u=e[0],f=e.slice(1),p=[];function c(h){Array.isArray(h)?h.forEach(d=>{p.push(d)}):p.push(h)}if((typeof u!="string"||l)&&t&&Object.hasOwn(t,u))c(this._trace(f,t[u],it(n,u),t,u,o,s));else if(u==="*")this._walk(t,h=>{c(this._trace(f,t[h],it(n,h),t,h,o,!0,!0))});else if(u==="..")c(this._trace(f,t,n,r,i,o,s)),this._walk(t,h=>{typeof t[h]=="object"&&c(this._trace(e.slice(),t[h],it(n,h),t,h,o,!0))});else{if(u==="^")return this._hasParentSelector=!0,{path:n.slice(0,-1),expr:f,isParentSelector:!0};if(u==="~")return a={path:it(n,u),value:i,parent:r,parentProperty:null},this._handleCallback(a,o,"property"),a;if(u==="$")c(this._trace(f,t,n,null,null,o,s));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(u))c(this._slice(u,f,t,n,r,i,o));else if(u.indexOf("?(")===0){if(this.currEval===!1)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");const h=u.replace(/^\?\((.*?)\)$/u,"$1"),d=/@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(h);d?this._walk(t,g=>{const v=[d[2]],w=d[1]?t[g][d[1]]:t[g];this._trace(v,w,n,r,i,o,!0).length>0&&c(this._trace(f,t[g],it(n,g),t,g,o,!0))}):this._walk(t,g=>{this._eval(h,t[g],g,n,r,i)&&c(this._trace(f,t[g],it(n,g),t,g,o,!0))})}else if(u[0]==="("){if(this.currEval===!1)throw new Error("Eval [(expr)] prevented in JSONPath expression.");c(this._trace(Sr(this._eval(u,t,n.at(-1),n.slice(0,-1),r,i),f),t,n,r,i,o,s))}else if(u[0]==="@"){let h=!1;const d=u.slice(1,-2);switch(d){case"scalar":(!t||!["object","function"].includes(typeof t))&&(h=!0);break;case"boolean":case"string":case"undefined":case"function":typeof t===d&&(h=!0);break;case"integer":Number.isFinite(t)&&!(t%1)&&(h=!0);break;case"number":Number.isFinite(t)&&(h=!0);break;case"nonFinite":typeof t=="number"&&!Number.isFinite(t)&&(h=!0);break;case"object":t&&typeof t===d&&(h=!0);break;case"array":Array.isArray(t)&&(h=!0);break;case"other":h=this.currOtherTypeCallback(t,n,r,i);break;case"null":t===null&&(h=!0);break;default:throw new TypeError("Unknown value type "+d)}if(h)return a={path:n,value:t,parent:r,parentProperty:i},this._handleCallback(a,o,"value"),a}else if(u[0]==="`"&&t&&Object.hasOwn(t,u.slice(1))){const h=u.slice(1);c(this._trace(f,t[h],it(n,h),t,h,o,s,!0))}else if(u.includes(",")){const h=u.split(",");for(const d of h)c(this._trace(Sr(d,f),t,n,r,i,o,!0))}else!l&&t&&Object.hasOwn(t,u)&&c(this._trace(f,t[u],it(n,u),t,u,o,s,!0))}if(this._hasParentSelector)for(let h=0;h{t(n)})},j.prototype._slice=function(e,t,n,r,i,o,s){if(!Array.isArray(n))return;const l=n.length,a=e.split(":"),u=a[2]&&Number.parseInt(a[2])||1;let f=a[0]&&Number.parseInt(a[0])||0,p=a[1]&&Number.parseInt(a[1])||l;f=f<0?Math.max(0,f+l):Math.min(l,f),p=p<0?Math.max(0,p+l):Math.min(l,p);const c=[];for(let h=f;h{c.push(g)});return c},j.prototype._eval=function(e,t,n,r,i,o){this.currSandbox._$_parentProperty=o,this.currSandbox._$_parent=i,this.currSandbox._$_property=n,this.currSandbox._$_root=this.json,this.currSandbox._$_v=t;const s=e.includes("@path");s&&(this.currSandbox._$_path=j.toPathString(r.concat([n])));const l=this.currEval+"Script:"+e;if(!j.cache[l]){let a=e.replaceAll("@parentProperty","_$_parentProperty").replaceAll("@parent","_$_parent").replaceAll("@property","_$_property").replaceAll("@root","_$_root").replaceAll(/@([.\s)[])/gu,"_$_v$1");if(s&&(a=a.replaceAll("@path","_$_path")),this.currEval==="safe"||this.currEval===!0||this.currEval===void 0)j.cache[l]=new this.safeVm.Script(a);else if(this.currEval==="native")j.cache[l]=new this.vm.Script(a);else if(typeof this.currEval=="function"&&this.currEval.prototype&&Object.hasOwn(this.currEval.prototype,"runInNewContext")){const u=this.currEval;j.cache[l]=new u(a)}else if(typeof this.currEval=="function")j.cache[l]={runInNewContext:u=>this.currEval(a,u)};else throw new TypeError(`Unknown "eval" property "${this.currEval}"`)}try{return j.cache[l].runInNewContext(this.currSandbox)}catch(a){if(this.ignoreEvalErrors)return!1;throw new Error("jsonPath: "+a.message+": "+e)}},j.cache={},j.toPathString=function(e){const t=e,n=t.length;let r="$";for(let i=1;itypeof t[u]=="function");const o=r.map(u=>t[u]);n=i.reduce((u,f)=>{let p=t[f].toString();return/function/u.test(p)||(p="function "+p),"var "+f+"="+p+";"+u},"")+n,!/(['"])use strict\1/u.test(n)&&!r.includes("arguments")&&(n="var arguments = undefined;"+n),n=n.replace(/;\s*$/u,"");const l=n.lastIndexOf(";"),a=l!==-1?n.slice(0,l+1)+" return "+n.slice(l+1):" return "+n;return new Function(...r,a)(...o)}}j.prototype.vm={Script:Su};class Iu{constructor(t){this._highlight=!1,D(t)||this.setProperties(t)}setProperties(t){this.validateProperties(t),this.path=t.path,this.label=t.label,this._onRevert=t.onRevert,this._onReady=t.onReady,!D(this._onReady)&&!D(this._content)&&!D(this._metadata)&&this._onReady(this._content,this._metadata),this._onHighlight=t.onHighlight,!D(this._onHighlight)&&this._highlight&&D(this.path)&&(D(this._metadata)?this._onHighlight(this._highlight):this._onHighlight(this._highlight,this._metadata))}validateProperties(t){if(D(t.onReady))throw new tt(Be.InvalidContentZoneHandlerProperty,"onReady property must defined");if(J(t,"onReady")&&!or(t.onReady))throw new tt(Be.InvalidContentZoneHandlerProperty,"onReady property must be a function");if(J(t,"onRevert")&&!or(t.onRevert))throw new tt(Be.InvalidContentZoneHandlerProperty,"onRevert property must be a function");if(J(t,"onHighlight")&&!or(t.onHighlight))throw new tt(Be.InvalidContentZoneHandlerProperty,"onHighlight property must be a function");if(J(t,"path")&&!T(t.path))throw new tt(Be.InvalidContentZoneHandlerProperty,"Path property must be a non-empty string");if(J(t,"label")&&!T(t.label))throw new tt(Be.InvalidContentZoneHandlerProperty,"Label property must be a non-empty string")}triggerReady(t,n){if(D(t)||D(n)){y.log.warn("Handling a call to ready for a content zone handler transformation, but the content or the metadata parameter is not defined. The ready handler will not be called.");return}this._content=t,this._metadata=n,D(this._onReady)||this._onReady(t,n)}triggerRevert(){this._content=null;const t=this._metadata;if(this._metadata=null,D(t)){y.log.warn("Handling a call to revert for a content zone handler transformation, but the content zone handler metadata is not defined. The revert handler will not be called.");return}D(this._onRevert)||this._onRevert(t)}triggerHighlight(t){if(!et(t)){y.log.warn("Handling a call to highlight for a content zone handler transformation, but the highlight parameter is not a boolean. The highlight handler will not be called.");return}this._highlight=t,!D(this._onHighlight)&&D(this.path)&&(D(this._metadata)?this._onHighlight(this._highlight):this._onHighlight(this._highlight,this._metadata))}}let Zt={};function Au(){Zt={}}function Cu(e,t){try{if(!O(t,!1))throw new tt(Be.InvalidContentZoneHandlerProperties,"Content Zone Handler Properties must be a non-empty object");const n=Ir(e);D(n)?Po(e,t):n.setProperties(t)}catch(n){y.log.error(`Content Zone Handler could not be set due to: ${K(n).message}`)}}function Pu(e){const t=Ir(e);if(D(t))return t;const{label:n,path:r}=t;return{label:n,path:r}}function Ir(e){if(!T(e))throw new tt(Be.InvalidContentZoneHandlerName,"Name must be a non-empty string");return Zt[e]}function Po(e,t){return Zt[e]=new Iu(t),Zt[e]}function Ou(){return Zt}var Nu=Object.defineProperty,Du=Object.defineProperties,Mu=Object.getOwnPropertyDescriptors,Oo=Object.getOwnPropertySymbols,Ru=Object.prototype.hasOwnProperty,Lu=Object.prototype.propertyIsEnumerable,No=(e,t,n)=>t in e?Nu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xu=(e,t)=>{for(var n in t||(t={}))Ru.call(t,n)&&No(e,n,t[n]);if(Oo)for(var n of Oo(t))Lu.call(t,n)&&No(e,n,t[n]);return e},ku=(e,t)=>Du(e,Mu(t));let Do=null;function Uu(e){var t;if(O(e)&&(J(e,"anchorId")||J(e,"anchorDmoName"))){const n=ku(xu({},J(e,"anchorDmoName")&&{anchorDmoName:e.anchorDmoName}),{anchorId:(t=e.anchorId)!=null?t:""});return Hu(n),n.anchorId===null?null:n}else return Do}function Hu(e){if(J(e,"anchorDmoName")&&(!T(e.anchorDmoName)||!T(e.anchorId)))throw T(e.anchorId)?new Ee(de.AnchorDmoNameRequired,"Anchor Dmo Name must be a non-empty string when provided."):new Ee(de.AnchorIdRequiredWithDmoName,"Anchor Id cannot be null if Anchor Dmo Name is provided.");if(e.anchorId!==null&&!T(e.anchorId))throw new Ee(de.AnchorIdNullOrNotEmpty,"Anchor Id must be null or a non-empty string.")}document.addEventListener(P.CustomEvents.OnEventSend,e=>{var t,n,r;if(((r=(n=(t=e==null?void 0:e.detail)==null?void 0:t.actionEvent)==null?void 0:n.interaction)==null?void 0:r.name)===P.CatalogObjectInteractionName.ViewCatalogObject){const i=e.detail.actionEvent.interaction.catalogObject;O(i)&&T(i.id)&&T(i.type)&&Mo({anchorId:i.id})}}),document.addEventListener(P.CustomEvents.OnInit,()=>{Mo(null)});function Mo(e){Do=e}var Ro=(e,t,n)=>new Promise((r,i)=>{var o=a=>{try{l(n.next(a))}catch(u){i(u)}},s=a=>{try{l(n.throw(a))}catch(u){i(u)}},l=a=>a.done?r(a.value):Promise.resolve(a.value).then(o,s);l((n=n.apply(e,t)).next())});const Lo="TestMode",xo="Web";class Fu{constructor(t,n){this.statuses=t,this.finished=Promise.allSettled(Object.values(t).map(r=>Ro(this,null,function*(){return yield r.finished}))).then(r=>{const i=r.filter(o=>o.status==="rejected").map(o=>K(o.reason).message);if(i.length>0)throw new Error(`Issue(s) with preview (see 'statuses' for more detail): ${JSON.stringify(i)}`)}),this.finished.catch(()=>{}),this.revert=()=>(D(this._revertResponse)&&(this._revertResponse=n()),this._revertResponse)}}class zu{constructor(t){this.statuses=t,this.finished=Promise.allSettled(Object.values(t).map(n=>Ro(this,null,function*(){return yield n.finished}))).then(n=>{const r=n.filter(i=>i.status==="rejected").map(i=>K(i.reason).message);if(r.length>0)throw new Error(`Issue(s) with revert (see 'statuses' for more detail): ${JSON.stringify(r)}`)}),this.finished.catch(()=>{})}}let qe=null;function Vu(e){const t={};let n=!1;return T(e==null?void 0:e.pageType)?(t.pageType=e.pageType,n=!0):T(qe==null?void 0:qe.pageType)&&(t.pageType=qe==null?void 0:qe.pageType,n=!0),T(e==null?void 0:e.interaction)?(t.interaction=e.interaction,n=!0):T(qe==null?void 0:qe.interaction)&&(t.interaction=qe==null?void 0:qe.interaction,n=!0),n?t:null}function Ar(e){qe=e}function Bu(){document.addEventListener(y.CustomEvents.OnShutDown,()=>Ar(null)),document.addEventListener(y.CustomEvents.OnInit,()=>Ar(null)),document.addEventListener(y.CustomEvents.OnSettledSitemap,e=>{var t,n;((t=e==null?void 0:e.detail)==null?void 0:t.result)!==void 0&&Gu((n=e==null?void 0:e.detail)==null?void 0:n.result)})}function Gu(e){var t,n,r,i,o,s,l,a,u,f,p,c;const h={};let d=!1;const g=(i=(t=e==null?void 0:e.matchedConfig)==null?void 0:t.name)!=null?i:(r=(n=e==null?void 0:e.currentPage)==null?void 0:n.source)==null?void 0:r.pageType;T(g)&&(h.pageType=g,d=!0),T((s=(o=e==null?void 0:e.matchedConfig)==null?void 0:o.interaction)==null?void 0:s.name)?(h.interaction=(a=(l=e==null?void 0:e.matchedConfig)==null?void 0:l.interaction)==null?void 0:a.name,d=!0):T((f=(u=e==null?void 0:e.currentPage)==null?void 0:u.interaction)==null?void 0:f.name)&&(h.interaction=(c=(p=e==null?void 0:e.currentPage)==null?void 0:p.interaction)==null?void 0:c.name,d=!0),Ar(d?h:null)}var Cr=(e,t,n)=>new Promise((r,i)=>{var o=a=>{try{l(n.next(a))}catch(u){i(u)}},s=a=>{try{l(n.throw(a))}catch(u){i(u)}},l=a=>a.done?r(a.value):Promise.resolve(a.value).then(o,s);l((n=n.apply(e,t)).next())});function ju(e){return Cr(this,null,function*(){var t,n;const r=y.getSitemapResult(),i=y.getSitemapConfig();return(r==null?void 0:r.matchedConfig)!=null?(y.log.trace(`Evaluating context attributes from matched page type [${r==null?void 0:r.matchedConfig.name}] for dataspace [${(t=e==null?void 0:e.dataspace)!=null?t:""}].`),yield Pr(r.matchedConfig,e)):(i==null?void 0:i.global)!=null?(y.log.trace(`Evaluating context attributes from global page type for dataspace [${(n=e==null?void 0:e.dataspace)!=null?n:""}].`),yield Pr(i.global,e)):{}})}function Pr(e,t){return Cr(this,null,function*(){if((e==null?void 0:e.contextualAttributes)==null)return{};const n=e.contextualAttributes,r=Object.keys(n),i={},o={};return r.forEach(s=>{i[s]=Wu(s,n[s],t)}),yield Promise.all(Object.values(i)).then(s=>(s.forEach((l,a)=>{if(l!==void 0){const u=r[a];o[u]=l}}),o))})}function Wu(e,t,n){return Cr(this,null,function*(){try{return O(n)&&J(n,e)?n[e]:yield Promise.resolve(t).then(r=>typeof r=="function"?r():r)}catch(r){y.log.error(`Error when evaluating contextual attribute [${e}]: ${K(r).message}`,r)}})}var qu=Object.defineProperty,$u=Object.defineProperties,Yu=Object.getOwnPropertyDescriptors,ko=Object.getOwnPropertySymbols,Zu=Object.prototype.hasOwnProperty,Ku=Object.prototype.propertyIsEnumerable,Uo=(e,t,n)=>t in e?qu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ke=(e,t)=>{for(var n in t||(t={}))Zu.call(t,n)&&Uo(e,n,t[n]);if(ko)for(var n of ko(t))Ku.call(t,n)&&Uo(e,n,t[n]);return e},Xu=(e,t)=>$u(e,Yu(t)),Dn=(e,t,n)=>new Promise((r,i)=>{var o=a=>{try{l(n.next(a))}catch(u){i(u)}},s=a=>{try{l(n.throw(a))}catch(u){i(u)}},l=a=>a.done?r(a.value):Promise.resolve(a.value).then(o,s);l((n=n.apply(e,t)).next())});const Kt=new Ol("PreviewMeta");function Ho(e,t){return Dn(this,null,function*(){let n=dr();const r=yield e;io(t==null?void 0:t.endpoint),D(t==null?void 0:t.endpoint)||(n=t.endpoint,P.log.debug(`Using specified endpoint of ${n} as endpoint for fetching personalization.`));const i={method:"POST",cache:"no-store",headers:{"Content-Type":"application/json",Accept:"application/json, text/javascript, */*; q=0.01"},body:JSON.stringify(r)};return zo(r)&&(i.credentials="include",i.mode="cors"),yield window.fetch(n,i).then(o=>Dn(this,null,function*(){if(!o.ok){const s=yield o.text();throw new Ji(Qi.PersonalizationFetchFailed,"Personalization fetch failed.",{context:{status:o.status,message:s}})}return yield o.json().then(s=>(sc(s),zo(r)&&s.personalizations.forEach(l=>{Bo({personalizationId:l.personalizationId,personalizationPointName:l.personalizationPointName})}),s))})).catch(o=>Dn(this,null,function*(){return o instanceof Ji||P.log.error("Unexpected error with browser fetch."),yield Promise.reject(o)}))})}function Qu(e,t){if(!H(e))throw new Ee(de.PersonalizationPointsIsNotAnArray,"The Personalization Points parameter must be an array of length >= 1.");e.forEach(n=>{if(D(n))throw new Ee(de.PersonalizationPointIsNotDefined,"The Personalization Point must be an object containing a name value.",{context:{value:n}});if(!T(n.name))throw new Ee(de.PersonalizationPointNameIsNotAString,"The Personalization Point name parameter must be a non empty string.",{context:{value:n.name}});if(J(n,"decisionId")){if(t!==!0)throw new Ee(de.PersonalizationPointDecisionIdProvidedNonPreview,"The Personalization Point decisionId parameter can only be provided during previews.",{context:{value:n.decisionId}});if(!T(n.decisionId))throw new Ee(de.PersonalizationPointDecisionIdIsNotAString,"The Personalization Point decisionId parameter must be a non empty string if provided.",{context:{value:n.decisionId}})}})}function Ju(e){if(!O(e))throw new Ee(de.ContextIsNotAnObject,"The Context parameter must be an object.")}function Fo(e,t,n){return Dn(this,null,function*(){Qu(e,n),t!==void 0&&Ju(t);const r=et(n)&&n;t=ke(ke({},yield ju(t)),t);const i={personalizationPoints:e,context:ke(ke(Xu(ke(ke(ke(ke(ke(ke({},t),Uu(t)),nc(t)),rc(t)),Vu(t)),ic(t)),{individualId:oc(r,t)}),ec(t)),tc())};return r&&(i.executionFlags=[Lo]),i})}function ec(e){const t={};if(T(e==null?void 0:e.dataspace))t.dataspace=e==null?void 0:e.dataspace;else{const n=Vt();T(n)&&(t.dataspace=n)}return t}function tc(){var e;const t=(e=window==null?void 0:window.location)==null?void 0:e.hostname;return t===void 0?(P.log.warn("Channel context (window.location.hostname) is undefined \u2014 not sending channelContext"),{channel:xo}):{channel:xo,channelContext:t}}function nc(e){var t;const n={};if(T(e==null?void 0:e.requestUrl))n.requestUrl=e==null?void 0:e.requestUrl;else{const r=(t=window==null?void 0:window.location)==null?void 0:t.href;T(r)&&(n.requestUrl=r)}return n}function rc(e){const t={};if(T(e==null?void 0:e.p13n_sys_requestTimeZone))t.p13n_sys_requestTimeZone=e.p13n_sys_requestTimeZone;else try{const n=window.Intl.DateTimeFormat().resolvedOptions().timeZone;T(n)&&(t.p13n_sys_requestTimeZone=n)}catch(n){P.log.error("Error getting request time zone from browser. The contextual attribute p13n_sys_requestTimeZone will not be set.",n)}return t}function ic(e){const t={};if([Xt(e==null?void 0:e.utm_source,n=>{t.utm_source=n}),Xt(e==null?void 0:e.utm_campaign,n=>{t.utm_campaign=n}),Xt(e==null?void 0:e.utm_medium,n=>{t.utm_medium=n}),Xt(e==null?void 0:e.utm_content,n=>{t.utm_content=n}),Xt(e==null?void 0:e.utm_term,n=>{t.utm_term=n})].every(n=>!n)){const n=Sl(["utm_source","utm_campaign","utm_medium","utm_content","utm_term"]);Qt("utm_source",n,r=>{t.utm_source=r}),Qt("utm_campaign",n,r=>{t.utm_campaign=r}),Qt("utm_medium",n,r=>{t.utm_medium=r}),Qt("utm_content",n,r=>{t.utm_content=r}),Qt("utm_term",n,r=>{t.utm_term=r})}return t}function Xt(e,t){return T(e)?(t(e),!0):!1}function Qt(e,t,n){const r=t!==null?t[e]:null;T(r)&&n(r)}function oc(e,t){if(e&&O(t)&&J(t,"individualId")){const n=t.individualId;if(T(n))return n}return P.getAnonymousId()}function zo(e){var t,n;return(n=(t=e==null?void 0:e.executionFlags)==null?void 0:t.includes(Lo))!=null?n:!1}function Or(e,t){return T(e)&&Vo(e)||T(t)&&ac(t)}function Vo(e){return!D(Kt.get(e))}function ac(e){return!D(Kt.get(e))}function Bo(e){J(e,"personalizationId")?Kt.set(e.personalizationId,e):J(e,"personalizationExperienceConfigName")&&Kt.set(e.personalizationExperienceConfigName,e)}function Nr(e){Kt.delete(e)}function Go(e){return H(e.data)||O(e.attributes,!1)}function sc(e){let t=!0;if(!O(e))throw new Ft(mt.InvalidJsonObject,"Personalization response invalid: Expected a JSON object.");if(!H(e.personalizations,!0))throw new Ft(mt.MissingPersonalizationsArray,'Personalization response invalid: Expected "personalizations" array.');if(e.personalizations.length===0&&(t=!1),e.personalizations.forEach(n=>{if(!T(n.personalizationId))throw new Ft(mt.MissingPersonalizationId,'Personalization response invalid: Expected each "personalization" to include "personalizationId".');if(!T(n.personalizationPointName))throw new Ft(mt.MissingPersonalizationPointName,'Personalization response invalid: Expected each "personalization" to include "personalizationPointName".');if(!Go(n))if(!T(n.decisionId))P.log.debug(`User did not qualify for a decision. Id ${n.personalizationId}, Name ${n.personalizationPointName}`);else{P.log.error(`User qualified for a decision but there is no "data" nor "attributes". Id ${n.personalizationId}, Name ${n.personalizationPointName}, Decision Id ${n.decisionId}`);return}t=!1}),t)throw new Ft(mt.MissingPersonalizationContent,'Personalization response invalid. Expected each "personalization" to include either "data" or "attributes".')}function lc(e){var t;return(t=e==null?void 0:e.contentZones)!=null?t:[]}function jo(e,t=!0){return lc(e).reduce((n,r)=>{const[i,o]=uc(r,t);return T(i==null?void 0:i.name)&&o&&n.push(r),n},[])}function uc(e,t=!0){const n=O(e)?e:{name:"",selector:""},r=T(n==null?void 0:n.selector);T(n==null?void 0:n.name)&&!r&&y.log.debug(`Content Zone ${n.name} has no Selector configured`);const i=r&&(!t||cc(n==null?void 0:n.selector));return[e,i]}const cc=e=>y.cashDom(e).length>0;function Wo(e){if(!T(e))return null;const t=y.getSitemapResult().matchedConfig;if(t.contentZones!==void 0){const n=t.contentZones;if(!H(n))return null;const r=n.find(i=>i.name===e);return T(r==null?void 0:r.selector)?r.selector:null}return null}function Dr(e,t=!0){return jo(e,t).map(n=>n.name)}function fc(e,t=!0){return Mr([e],void 0,void 0,!0,t)}function dc(e,t=!0){return Mr(e,void 0,void 0,!0,t)}function hc(e){return O(e)?Mr(e.pageTypes,e.global,e.pageTypeDefault,!0,!1):[]}function Mr(e,t,n,r=!0,i=!0){const o=[];if(O(t)&&o.push(...Dr(t,i)),H(e)&&e.forEach(s=>{o.push(...Dr(s,i))}),O(n)&&o.push(...Dr(n,i)),r){const s=pc(o);if(s.length>0)return y.log.warn(`The following content zones are duplicated which are not supported by personalization: ${gc(s).join(", ")}`),mc(o,s)}return o}function pc(e){return e.filter((t,n)=>e.indexOf(t)!==n)}function gc(e){return e.filter((t,n)=>e.indexOf(t)===n)}function mc(e,t){return e.filter(n=>!t.includes(n))}const vc={redisplayTimeoutMilliseconds:2e3,renderPersonalizationAfterTimeoutElapsed:!1};var Te=(e=>(e.PageType="PageType",e.PageUrlMatcher="PageUrlMatcher",e))(Te||{}),Ec=Object.defineProperty,qo=Object.getOwnPropertySymbols,yc=Object.prototype.hasOwnProperty,_c=Object.prototype.propertyIsEnumerable,$o=(e,t,n)=>t in e?Ec(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Yo=(e,t)=>{for(var n in t||(t={}))yc.call(t,n)&&$o(e,n,t[n]);if(qo)for(var n of qo(t))_c.call(t,n)&&$o(e,n,t[n]);return e};let Mn=vc,Zo=!1;const Tc="head > style.personalizationFlickerDefense",ct={PageUrlMatcher:[],PageType:[]};function Rn(){return Mn!=null?Mn:{}}function bc(e){Mn=Yo(Yo({},Mn),e)}function wc(e){if(!O(e))throw new cr("flicker defense config is required");if(J(e,"redisplayTimeoutMilliseconds")&&(!Ut(e.redisplayTimeoutMilliseconds)||e.redisplayTimeoutMilliseconds<0))throw new cr("redisplayTimeoutMilliseconds must be a number greater than or equal to 0");if(J(e,"renderPersonalizationAfterTimeoutElapsed")&&!et(e.renderPersonalizationAfterTimeoutElapsed))throw new cr("renderPersonalizationAfterTimeoutElapsed must be a boolean")}function Ko(e){Zo=e}function Sc(){return Zo}function Ic(e){try{return document.querySelector(e),!0}catch(t){return P.log.warn(`Invalid path ${e} detected while trying to prevent flicker.`),!1}}function Ac(){const e=Cc();return Object.values(ct).flat().map(t=>{var n;if(Gt(t)){const r=(n=e.find(i=>t.name===i.name))==null?void 0:n.selector;if(T(r))return r}else if(rt(t))return t.path;return""}).filter(Ic).join(",")}function Cc(){const{pageTypes:e,global:t,pageTypeDefault:n}=P.getSitemapConfig();return[...e,...O(t)?[t]:[],...O(n)?[n]:[]].flatMap(r=>jo(r,!1))}function Pc(e){return e.transformationConfig.transformations.filter(rt).length>0}function Xo(e){if(et(e.isEnabled)&&!e.isEnabled)return!1;const t=e.transformationConfig.method;return t===$.ReplaceContentZoneContent||t===$.ReplaceElementContent||D(t)&&Pc(e)}function Qo(e){return e.filter(Xo).flatMap(t=>t.transformationConfig.transformations)}function Oc(){const e=P.cashDom(""),t=Bt();return T(t)&&e.attr("nonce",t),e.attr({type:"text/css",class:"personalizationFlickerDefense"}).appendTo(document.head)}function Rr(){const e=()=>{let t=P.cashDom(Tc);t.length===0&&(t=Oc());const n=Ac();T(n)?(P.log.debug(`flicker defense style tag updated to ${n}`),t.text(`${n} { visibility: hidden !important; }`)):(P.log.debug("flicker defense style tag removed"),t.remove())};window.requestAnimationFrame(e)}function Lr(e){const t=Qo(e);for(const n of t)Ln(n)}function Ln(e){for(const t of Object.values(Te))ct[t]=ct[t].filter(n=>(n===e&&P.log.debug(`flicker defense reshowing hidden transformation with source matcher type of ${t}: ${JSON.stringify(e)}`),n!==e));Rr()}function Jo(e,t,n){if(!Or(e,t.pec.name)&&Xo(t.pec)&&!Rn().renderPersonalizationAfterTimeoutElapsed&&Sc()){const r=`Blocking transform and render of following transformation for config ${t.pec.name} due to flicker defense: ${JSON.stringify(n)}`;throw t.status.update(new k(r)),Ln(n),new ie(ue.FlickerDefenseRedisplayElapsed,`Blocking transform and render of following transformation for config ${t.pec.name} due to flicker defense`)}}function ea(e){if(Ge()){if(!O(e,!1)){P.log.error("A config is required when setting Flicker Defense Config.");return}try{wc(e),bc(e),P.log.info("Set Flicker Defense Config to the following: ",e)}catch(t){P.log.error(`Flicker Defense Config could not be set due to: ${K(t).message}`)}}else P.log.error("Flicker Defense Config can only be set before SalesforceInteractions.init is called.")}var Nc=(e,t,n)=>new Promise((r,i)=>{var o=a=>{try{l(n.next(a))}catch(u){i(u)}},s=a=>{try{l(n.throw(a))}catch(u){i(u)}},l=a=>a.done?r(a.value):Promise.resolve(a.value).then(o,s);l((n=n.apply(e,t)).next())});const ta=class ir{validateTransformerDetails(t){}validateMethod(t){}validateSubstitutionValues(t){}supportsEngagementSelection(){return!0}setContent(t,n,r,i,o,s,l=$.ReplaceElementContent){const a=`pec ${o.pec.name}, transformation ${r.transformerName}`+(s!==void 0?`, personalizationId ${s}`:"");o.status.update(new k(`Awaiting element/conditions ${a}`));const u=t.then(f=>{if(!(f instanceof Element))throw new ie(ue.FoundNonElement,"Found non-Element");if(s!==void 0&&Jo(s,o,r),!D(o.revertStatus)){const p=`Aborting ${a}, revert has been called`;return y.log.info(p),o.status.update(new k(p)),c=>{c.update(new k(`Nothing to revert, since revert was requested before transformation, ${a}`))}}if(o.status.update(new k(`About to transform/render, element/conditions ready ${a}`)),ao(i)){const p=document.head;if(D(p))throw new ie(ue.ElementsNotFound,"Could not add agent script, head not found");const c=document.createElement("script");return c.type="text/javascript",c.textContent=n(),c.nonce=Bt(),this.insertAdjacentHtmlUnlessAlreadyPersonalized(p,"beforeend",()=>c,a)}else{if(hr(r,l))return this.triggerReadyHandlerWithHtml(r.name,o,s,n,a);if(_t(l)){const p=f.closest("body");if(D(p))throw new ie(ue.ElementsNotFound,"Could not add overlay, body not found");return this.insertAdjacentHtmlUnlessAlreadyPersonalized(p,"beforeend",n,a)}else{if(wn(r,l))return this.setInnerHtmlUnlessAlreadyPersonalized(f,n,a);if(rt(r)){const p=l!=null?l:$.ReplaceElementContent;switch(p){case $.ReplaceElementContent:return this.setInnerHtmlUnlessAlreadyPersonalized(f,n,a);case $.AddAfterElement:return this.insertAdjacentHtmlUnlessAlreadyPersonalized(f,"afterend",n,a);case $.AddBeforeElement:return this.insertAdjacentHtmlUnlessAlreadyPersonalized(f,"beforebegin",n,a);default:throw new ie(ue.NotSupported,`method "${p}" is not supported for Element transformations`)}}else throw new ie(ue.NotSupported,"transformation is not of a known type")}}});return u.catch(f=>{const p=new Error(`Could not set content for ${a}: ${K(f).message}`);o.status.update(new k(p)),y.log.error(p.message)}),{promise:u.then(),revert:f=>Nc(this,null,function*(){f.update(new k("Awaiting transformPromise"));const p=u.then(c=>{c(f)},c=>{if(c instanceof ie){f.update(new k(`Nothing to revert, no transformation attempt, ${a}`));return}throw c});p.catch(c=>{const h=new Error(`Issue reverting ${a}: `+K(c).message);y.log.error(h),f.update(new k(h))}),yield p})}}setInnerHtmlUnlessAlreadyPersonalized(t,n,r){if(t.children.length>0&&this.isElementAlreadyPersonalized(t.children[0]))throw new ie(ue.AlreadyPersonalized,`Aborting setting innerHTML, element ${t.localName} already personalized`);const i=n();y.log.trace(`Setting element ${t.localName}'s innerHTML to ${i}, ${r}`,t);const o=t.innerHTML;return t.innerHTML=i,s=>{let l=`Reverting, ${r}`;s.update(new k(l)),y.log.debug(l),t.innerHTML=o,l=`Reverted, ${r}`,s.update(new k(l)),y.log.debug(l)}}insertAdjacentHtmlUnlessAlreadyPersonalized(t,n,r,i){let o;switch(n){case"beforebegin":o=t.previousSibling;break;case"afterbegin":o=t.firstChild;break;case"beforeend":o=t.lastChild;break;case"afterend":o=t.nextSibling;break;default:throw new Error(`Unsupported insertAdjacentHTML position: ${String(n)}`)}if(o instanceof Element&&this.isElementAlreadyPersonalized(t))throw new ie(ue.AlreadyPersonalized,`Aborting inserting adjacent HTML, adjacent element ${o.localName} ${n} from ${t.localName} is already personalized`);const s=r();y.log.trace(`Inserting adjacent HTML ${n} element ${t.localName}'s with ${T(s)?s:s.outerHTML}, ${i}`,t);const l=T(s)?this.getHTMLElements(s):[s];return this.insertAdjacentElements(t,n,l),a=>{let u=`Reverting, ${i}`;a.update(new k(u)),y.log.debug(u),l.forEach(f=>f.remove()),u=`Reverted, ${i}`,a.update(new k(u)),y.log.debug(u)}}triggerReadyHandlerWithHtml(t,n,r,i,o){var s;const l=i(),a=(s=Ir(t))!=null?s:Po(t);return a.triggerReady(l,{personalizationExperienceConfig:n.pec,isPreview:Or(r,n.pec.name)}),u=>{let f=`Reverting, ${o}`;u.update(new k(f)),y.log.debug(f),a.triggerRevert(),f=`Reverted, ${o}`,u.update(new k(f)),y.log.debug(f)}}isElementAlreadyPersonalized(t){return t.getAttributeNames().some(n=>n.startsWith(Tt))}autoInjectDefaultRootAttributes(t,n,r,i=!0){const o=[];t.hasAttribute(Le)?y.log.debug(`Element already has root attribute "${Le}"`,t):(y.log.debug(`Adding root attribute "${Le}"="${n}" to element`,t),t.setAttribute(Le,n),o.push(()=>{t.removeAttribute(Le)}));const s={};T(r)&&(s[St]=r);const l=JSON.stringify(s);return i&&(t.hasAttribute(bt)?y.log.debug(`Element already has root attribute "${bt}"`,t):(y.log.debug(`Adding root attribute "${bt}"="${l}" to element`,t),t.setAttribute(bt,l),o.push(()=>{t.removeAttribute(bt)}))),t.hasAttribute(wt)?y.log.debug(`Element already has attribute "${wt}"`,t):(y.log.debug(`Adding attribute "${wt}"="${l}" to element`,t),t.setAttribute(wt,l),o.push(()=>{t.removeAttribute(wt)})),a=>{o.forEach(u=>u==null?void 0:u(a))}}autoInjectDefaultItemAttributes(t,n,r,i=!0){const o=[];D(n)||(t.setAttribute(Le,n),o.push(()=>{t.removeAttribute(Le)}));const s=JSON.stringify(r);if(i){const a=this.assignMaybeOverrideAttribute(t,bt,s);o.push(a)}const l=this.assignMaybeOverrideAttribute(t,wt,s);return o.push(l),a=>{o.forEach(u=>u==null?void 0:u(a))}}assignMaybeOverrideAttribute(t,n,r){return t.hasAttribute(n)?y.log.debug(`Overwriting item attribute "${n}"="${r}" on element`,t):y.log.debug(`Adding item attribute "${n}"="${r}" to element`,t),t.setAttribute(n,r),()=>{t.removeAttribute(n)}}static findValueDefaultForContentId(t){var n,r,i;return(i=(r=(n=t.attributes)==null?void 0:n.eventModifiers)==null?void 0:r[At])==null?void 0:i.valueDefault}static findValueDefaultForObjectId(t){var n,r,i;return(i=(r=(n=t.attributes)==null?void 0:n.eventModifiers)==null?void 0:r[It])==null?void 0:i.valueDefault}buildModifiersIfItemRelated(t,n,r){if(!O(t))return;const i={},o=ir.findValueDefaultForContentId(r);if(T(o)){const l=this.getSanitizedContentString(o,t);T(l)&&(i[At]=l)}const s=ir.findValueDefaultForObjectId(r);if(T(s)){const l=this.getSanitizedContentString(s,t);T(l)&&(i[It]=l)}if(Object.keys(i).length!==0)return T(n)&&(i[St]=n),i}getHTMLElements(t){const n=document.createElement("div");return n.innerHTML=t,Array.from(n.children)}getPathParentObject(t,n){if(!T(t))return;const r=j({path:`$.${t}`,json:n,wrap:!1,resultType:"parent"});return O(r)?r:void 0}getSanitizedContentString(t,n){const r=j({path:`$${t}`,json:n,wrap:!1});if(D(r))return;const i=String(r),o=ir.sanitizer.sanitizeString(i);return y.log.debug(`sanitized data for dataPath ${t}: ${o}`),o}insertAdjacentElement(t,n,r){if(r==="beforeend")t.appendChild(n);else{if(t.parentNode===null)throw new Error("Unable to find parent element");r==="beforebegin"?t.parentNode.insertBefore(n,t):r==="afterbegin"?t.parentNode.insertBefore(n,t.firstChild):r==="afterend"&&t.parentNode.insertBefore(n,t.nextSibling)}}insertAdjacentElements(t,n,r){const i=[];if(n==="beforeend"||n==="afterend"?r.forEach(o=>{try{this.insertAdjacentElement(t,o,n)}catch(s){i.push(K(s).message)}}):(n==="beforebegin"||n==="afterbegin")&&r.reverse().forEach(o=>{try{this.insertAdjacentElement(t,o,n)}catch(s){i.push(K(s).message)}}),i.length>0)throw new Error(`Issues with insertAdjacentElements: ${JSON.stringify(i)}`)}};ta.sanitizer=new uu;let xr=ta;function xn(e,t,n){var r,i;if(!T(e,!0))throw new M(R.MissingTransformerName,"Transformer Name is required.");if(!O(n))throw new M(R.MissingEngagementConfig,"Engagement Configuration or Destinations are not defined.");const o=n.destinationDefaults;if(o===void 0)throw new M(R.MissingEngagementConfigDefaults,"Engagement Configuration Defaults are not defined.");let s=e!==""?(r=o.byName)==null?void 0:r[e]:void 0;if(T(s)||(s=(i=o.byType)==null?void 0:i[t],T(s)))return s;if(!T(o.global))throw new M(R.MissingEngagementConfigGlobalDefault,"Engagement Configuration Global Default is not defined.");return o.global}function na(e,t,n,r){if(T(e))return e;try{return xn(t,n,r)}catch(i){return}}const Dc={destinations:{[So]:{label:"Product Engagement",description:"Engagement events (e.g. view/click) on this personalization are intended for the stock Product Browse Engagement DMO",disableSendingNonItemEngagementEvents:!0,eventModifiers:{[On]:"catalog",[Pn]:e=>{switch(e.name){case lt:return"catalog-object-view-start";case xe:return"catalog-object-click";default:return}},[br]:"Product"}},[Io]:{label:"Website Engagement",description:"Engagement events (e.g. view/click) on this personalization are intended for the stock Website Engagement DMO",eventModifiers:{[On]:"userEngagement",[Pn]:e=>{switch(e.name){case lt:return"personalization-view";case xe:return"personalization-click";default:return}}}}},destinationDefaults:{byType:{HTMLElementModifier:"Other",Handlebars:"Product",AgentScript:"Other"},global:"Other"},attributes:{engagements:{[lt]:{description:'Apply to specific items/recs, and to the entire personalization (to generate an "overall" view/impression, especially relevant for a banner not using recs).',scope:ut.Any,qualify:()=>ca(lt),observe:(e,t)=>kc(e,t),handle:e=>fa(lt,e)},[xe]:{description:"Apply to an element in the personalization, to listen for click events (including bubbled ones), for engagement/attribution.",scope:ut.Element,qualify:()=>ca(xe),observe:(e,t)=>Uc(e,t),handle:e=>fa(xe,e)}},eventModifiers:{[At]:{description:"Apply to an Engagement attribute, to specify the personalization content id (which rec in the decision) in the resulting engagement event.",scope:ut.Element,valueType:Nn.SchemaPath,valueDefault:"[personalizationContentId]",modifyEvent:(e,t,n)=>{D(n.personalization)&&(n.personalization={}),n.personalization.contentId=e}},[It]:{description:"Apply to an Engagement attribute, to specify the object id (e.g. product id) in the resulting engagement event.",scope:ut.Element,valueType:Nn.SchemaPath,valueDefault:"[ssot__Id__c]",modifyEvent:(e,t,n)=>{if(t.eventModifiers===void 0)return;const r=t.eventModifiers[St];switch(r){case"Product":n.interaction.id=e;return;case"Other":n.interaction.catalogObjectId=e;return;default:P.log.warn(`Unknown Engagement Destination "${r!=null?r:""}"`)}}},[St]:{description:'Chosen entry from "engagementDestinations", which will modify the resulting engagement event accordingly.',scope:ut.Any,modifyEvent:(e,t,n)=>{const r=la(e);if(r===void 0){P.log.warn(`Destination name "${e}" not found, cannot be applied to the event.`);return}for(const i in r.eventModifiers){const o=kr(i);if(o===void 0){P.log.warn(`Modifier name "${i}" unknown, cannot be applied to the event.`);continue}const s=r.eventModifiers[i];let l;if(T(s)?l=s:l=s(t),l===void 0){P.log.warn(`Modifier Name "${i}" resulted in no value and as such is not applied to the event.`);continue}o.modifyEvent(l,t,n)}}},[Pn]:{description:'Defined by chosen entry in "engagementDestinations", for the "interaction name" in the resulting engagement event.',modifyEvent:(e,t,n)=>{D(n.interaction)?n.interaction={name:e}:n.interaction.name=e}},[On]:{description:'Defined by chosen entry in "engagementDestinations", for the "event type" in the resulting engagement event.',modifyEvent:(e,t,n)=>{D(n.interaction)&&(n.interaction={name:""}),n.interaction.eventType=e}},[br]:{description:'Defined by chosen entry in "engagementDestinations", for the "type" in the resulting engagement event.',modifyEvent:(e,t,n)=>{D(n.interaction)&&(n.interaction={name:""}),n.interaction.type=e}}}}},ra={destinations:{},destinationDefaults:{global:""}};let Jt=Dc,ia=!0;function Ue(){return Jt!=null?Jt:ra}function Mc(e){e===void 0?Jt=ra:Jt=e,ia=Rc(Jt)}function Rc(e){var t,n;return!(!O((t=e==null?void 0:e.attributes)==null?void 0:t.engagements)||cu.some(r=>{var i;return D((i=e.attributes)==null?void 0:i.engagements[r])})||!O((n=e==null?void 0:e.attributes)==null?void 0:n.eventModifiers)||fu.some(r=>{var i;return D((i=e.attributes)==null?void 0:i.eventModifiers[r])})||!O(e==null?void 0:e.destinations,!1)||Ao.some(r=>D(e.destinations[r]))||!O(e==null?void 0:e.destinationDefaults)||!Ao.includes(e.destinationDefaults.global))}function oa(){return ia}function aa(){const e=Ue();if(e===void 0||e.destinations===void 0||Object.keys(e.destinations).length===0){P.log.warn("Engagement Configuration does not have any Config for Destinations");return}return e}function sa(){const e=aa();return e===void 0?[]:Object.keys(e.destinations)}function la(e){if(!T(e)){P.log.warn("A valid destination string must be provided in order to find its Engagement Destination configuration");return}const t=aa();if(t!==void 0){if(!(e in t.destinations)){P.log.warn(`Engagement Configuration does not Config for Destination "${e}"`);return}return t.destinations[e]}}function ua(e){if(!T(e)){P.log.warn("A valid attribute name string must be provided in order to find its Engagement Attribute configuration");return}const t=Ue();if(t===void 0||t.attributes===void 0){P.log.warn("Engagement Configuration does not have any Config for Attributes");return}if(!(e in t.attributes.engagements)){P.log.warn(`Engagement Configuration does not Config for Attribute "${e}"`);return}return t.attributes.engagements[e]}function kr(e){if(!T(e)){P.log.warn("A valid modifier name string must be provided in order to find its Engagement Modifier configuration");return}const t=Ue();if(t===void 0||t.attributes===void 0){P.log.warn("Engagement Configuration does not have any Config for Attributes");return}if(!(e in t.attributes.eventModifiers)){P.log.warn(`Engagement Configuration does not have Config for Event Modifier "${e}"`);return}return t.attributes.eventModifiers[e]}function ca(e){const t=ua(e);if(t===void 0)return;const n=`${Tt}${e}`,r=Zi(n),i=Array.of(...document.querySelectorAll(r));for(const s of i)t.observe(s,t);const o=new MutationObserver(s=>{if(document===void 0){o.disconnect();return}s.forEach(l=>{switch(l.type){case"attributes":Lc(l,n,t);break;case"childList":xc(l,n,t);break;default:P.log.error(`Unsupported mutation type: ${l.type}`)}})});o.observe(document,{attributes:!0,attributeFilter:[n],attributeOldValue:!1,childList:!0,subtree:!0}),document.addEventListener(P.CustomEvents.OnShutDown,()=>{o.disconnect()})}function Lc(e,t,n){if(!(e.target instanceof Element)||t!==e.attributeName)return;const r=e.target.getAttribute(t);T(r)&&n.observe(e.target,n)}function xc(e,t,n){if(!(e.target instanceof Element))return;const r=Array.from(e.addedNodes).filter(o=>o instanceof Element);if(r.length===0)return;const i=Zi(t);r.forEach(o=>{o.hasAttribute(t)&&n.observe(o,n),o.querySelectorAll(i).forEach(s=>{n.observe(s,n)})})}let Pt=new WeakMap;function kc(e,t){if(Pt.has(e)){P.log.debug("Already observing element for visibility",e);return}P.log.debug("Observing element for visibility",e);const n=Pl.pageElementVisible(e);Pt.set(e,n),n.then(r=>{if(Pt.get(r)!==n){P.log.debug("Element now visible, but aborting, no longer current observer",r);return}P.log.debug("Element now visible, calling handle",r),t.handle(r)}).catch(r=>{P.log.warn("Failed to observe element for visibility",e,r)}).finally(()=>{if(Pt.get(e)!==n){P.log.debug("Observing element for visibility completed, was no longer current observer",e);return}P.log.debug("Observing element for visibility completed",e),Pt.delete(e)})}let kn=new WeakMap;function Uc(e,t){if(kn.has(e)){P.log.debug("Already observing element for click",e);return}P.log.debug("Observing element for click",e);const n=r=>{r.target instanceof Element?e.contains(r.target)?kn.get(e)!==n?(P.log.debug("Click within element, but aborting, no longer current observer",r.target,e),e.removeEventListener(xe,n)):(P.log.debug("Click within element, calling handle",r.target,e),t.handle(e)):P.log.warn("Click event target is not contained by expected element",r.target,e):P.log.warn("Click event target is not an element",r.target,e)};kn.set(e,n),e.addEventListener(xe,n),document.addEventListener(P.CustomEvents.OnShutDown,()=>{e.removeEventListener(xe,n)})}function Hc(){Pt=new WeakMap,kn=new WeakMap}function fa(e,t){const n=Fc(e,t);if(D(n))return;const r=zc(n);D(r)||P.sendEvent(r).catch(i=>{P.log.error(`Failed to send personalization engagement event ${JSON.stringify(r)}`,i)})}function Fc(e,t){var n,r;const i=(n=t.closest(`[${Le}]`))==null?void 0:n.getAttribute(Le);if(!T(i))return P.log.warn(`${Le} not found in DOM hierarchy for element`,t),null;if(ua(e)===void 0)return P.log.warn(`No engagement attribute definition found for ${e}`),null;const o=`${Tt}${e}`;if(!t.hasAttribute(o))return P.log.warn(`Engagement attribute ${e} not found on element`,t),null;const s={},l=o.substring(5),a=(r=P.cashDom(t).attr(o))!=null?r:"",u=P.cashDom(t).data(l);P.log.debug(`Found ${e} with modifiers ${a}`,t),O(u,!1)?Object.keys(u).forEach(p=>{if(!T(p)){P.log.warn(`Ignoring empty/non-string modifier key within: ${a}`);return}const c=kr(p);if(D(c)){P.log.warn(`Ignoring unknown modifier: ${p}`);return}const h=u[p];if(!T(h)){P.log.warn(`The value for event modifier "${p}" for engagement attribute of "${e}" is not a string and thus can't be used`);return}s[p]=h}):a.trim().length>0&&P.log.warn(`The value for engagement attribute ${e} was not valid JSON, so cannot process modifiers.`);const f={name:e,element:t,eventModifiers:s,personalizationId:i};return Vo(i)&&(f.isPreview=!0),f}function zc(e){var t,n,r;if(D(e))return null;const i={interaction:{name:""},personalization:{id:e.personalizationId}};et(e.isPreview)&&e.isPreview&&(i.personalization.isTesting=!0);for(const l in e.eventModifiers){const a=kr(l);if(D(a)){P.log.warn(`Ignoring unknown modifier: ${l}`);break}const u=e.eventModifiers[l];if(!T(u)){P.log.warn(`The value for event modifier "${l}" for engagement attribute of "${e.name}" is not a string and thus can't be used`);break}try{a.modifyEvent(u,e,i)}catch(f){P.log.error(`Could not set the value for event modifier "${l}" for engagement attribute of "${e.name}"`,f)}}T((t=i.interaction)==null?void 0:t.name)||P.log.warn("Resulting engagement event has no/empty interaction.name, is likely misconfigured, and will likely be suppressed from sending");const o=(n=e.eventModifiers)==null?void 0:n[St],s=T(o)?la(o):void 0;return(s==null?void 0:s.disableSendingNonItemEngagementEvents)===!0&&!T((r=i.personalization)==null?void 0:r.contentId)?(P.log.debug(`Not sending event due to disableSendingNonItemEngagementEvents and no contentId string: ${JSON.stringify(i)}`),null):i}function Vc(e){if(!O(e))throw new Y(q.DestinationEventModifiersAreRequired,"Engagement destination event modifiers are required.");Object.entries(e).forEach(([t,n])=>{if(!T(n)&&typeof n!="function")throw new Y(q.InvalidDestinationEventModifier,"Engagement destinations event modifier must be a function or a valid string.")})}function Bc(e){if(!O(e)||Object.keys(e).length===0)throw new Y(q.EngagementDestinationsAreRequired,"Engagement destinations are required.");Object.entries(e).forEach(([t,n])=>{if(n.description!==void 0&&!T(n.description))throw new Y(q.InvalidEngagementDestinationDescription,"Engagement destination description must be a string if provided.");Vc(n.eventModifiers)})}function Gc(e){if(!O(e))throw new Y(q.EngagementDestinationDefaultsAreRequired,"Engagement destination defaults are required.");if(e.byName!==void 0){if(!O(e.byName))throw new Y(q.InvalidEngagementDestinationDefaultByName,"Engagement destination defaults by name must be an object if provided.");Object.entries(e.byName).forEach(([,t])=>{if(!T(t))throw new Y(q.InvalidEngagementDestinationDefaultByNameValue,"Engagement destination by name must have a valid string value.")})}if(e.byType!==void 0){if(!O(e.byType))throw new Y(q.InvalidEngagementDestinationDefaultByType,"Engagement destination defaults by type must be an object if provided.");Object.entries(e.byType).forEach(([,t])=>{if(!T(t))throw new Y(q.InvalidEngagementDestinationDefaultByTypeValue,"Engagement destination by type must have a valid string value.")})}if(!T(e.global))throw new Y(q.InvalidEngagementDestinationDefaultGlobal,"Engagement destination global default must be valid string value.")}function da(e,t){var n;if(e.description!==void 0&&!T(e.description))throw new Y(q.InvalidEngagementDestinationAttributeDescription,"Engagement destination attribute description must be a valid string if provided.",{context:{type:t}});if(e.scope!==void 0&&!((n=Object.values(ut))!=null&&n.includes(e.scope)))throw new Y(q.InvalidEngagementDestinationAttributeScope,"Engagement destination attribute scope should be a valid Engagement Attribute Scope if provided.",{context:{type:t,scope:e.scope}})}function jc(e){if(!O(e))throw new Y(q.InvalidEngagementDestinationAttributeEngagements,"Engagement destination attribute engagements must be a valid object.");Object.entries(e).forEach(([,t])=>{if(!O(t))throw new Y(q.InvalidEngagementDestinationAttributeEngagementValue,"Engagement destination attribute engagements value must be a valid object.");if(da(t,"engagements"),t.qualify===void 0)throw new Y(q.MissingEngagementDestinationAttributeEngagementQualify,"Engagement destination attribute engagements must define a qualify function.");if(typeof t.qualify!="function")throw new Y(q.InvalidEngagementDestinationAttributeEngagementQualify,"Engagement destination attribute engagements qualify must be a function.");if(t.observe===void 0)throw new Y(q.MissingEngagementDestinationAttributeEngagementObserve,"Engagement destination attribute engagements must define an observe function.");if(typeof t.observe!="function")throw new Y(q.InvalidEngagementDestinationAttributeEngagementObserve,"Engagement destination attribute engagements observe must be a function.");if(t.handle===void 0)throw new Y(q.MissingEngagementDestinationAttributeEngagementHandle,"Engagement destination attribute engagements must define a handle function.");if(typeof t.handle!="function")throw new Y(q.InvalidEngagementDestinationAttributeEngagementHandle,"Engagement destination attribute engagements handle must be a function.")})}function Wc(e){if(!O(e))throw new Y(q.InvalidEngagementDestinationAttributeEventModifiers,"Engagement destination attribute event modifiers must be a valid object.");Object.entries(e).forEach(([,t])=>{var n;if(!O(t))throw new Y(q.InvalidEngagementDestinationAttributeEventModifiersValue,"Engagement destination attribute event modifiers value must be a valid object.");if(da(t,"eventModifiers"),t.modifyEvent===void 0)throw new Y(q.MissingEngagementDestinationAttributeEventModifierModifyEvent,"Engagement destination attribute event modifiers must define a modifyEvent function.");if(typeof t.modifyEvent!="function")throw new Y(q.InvalidEngagementDestinationAttributeEventModifierModifyEvent,"Engagement destination attribute event modifiers modifyEvent must be a function.");if(t.valueType!==void 0&&!((n=Object.values(Nn))!=null&&n.includes(t.valueType)))throw new Y(q.InvalidEngagementDestinationAttributeEventModifierValueType,"Engagement destination attribute event modifiers value type should be a valid Engagement Attribute Value Type if provided.",{context:{valueType:t.valueType}});if(t.valueDefault!==void 0&&!T(t.valueDefault,!1,!0))throw new Y(q.InvalidEngagementDestinationAttributeEventModifierValueDefault,"Engagement destination attribute event modifiers value default should be a valid non-empty string if provided.")})}function qc(e){if(!O(e))throw new Y(q.InvalidEngagementDestinationAttributes,"Engagement destination attributes must be a valid object if provided.");jc(e.engagements),Wc(e.eventModifiers)}function ha(e){if(!O(e))throw new Y(q.InvalidConfig,"Config is required.");Bc(e.destinations),Gc(e.destinationDefaults),e.attributes!==void 0&&qc(e.attributes)}function pa(e){if(Ge()){if(!O(e,!1)){P.log.error("A config is required when setting Engagement Config.");return}try{ha(e),Mc(e),P.log.info("Set Engagement Config to the following: ",e)}catch(t){P.log.error(`Engagement Config could not be set due to: ${K(t).message}`)}}else P.log.error("Engagement Config can only be set before SalesforceInteractions.init is called.")}var Ur=(e,t,n)=>new Promise((r,i)=>{var o=a=>{try{l(n.next(a))}catch(u){i(u)}},s=a=>{try{l(n.throw(a))}catch(u){i(u)}},l=a=>a.done?r(a.value):Promise.resolve(a.value).then(o,s);l((n=n.apply(e,t)).next())});class $c extends xr{validateMethod(t){if(t!==void 0&&t!==$.ReplaceElementContent)throw new M(R.TransformationConfigMethodNotSupported,"Transformation Config method not supported for the specific type of transformer.",{context:{transformerType:pe.HtmlElementModifier,provided:t,required:$.ReplaceElementContent}})}validateSubstitutionValues(t){if(t===void 0||Object.entries(t).length===0)throw new M(R.MissingTransformationSubstitutionValues,"Transformation substitution values are required for the specific type of transformer.",{context:{transformerType:pe.HtmlElementModifier}})}transform(t,n,r,i,o){const s=o.pec.name,l=i.personalizationId,a=n.transformerName,u=`pec ${s} transformer ${a} for personalization ${l}`;if(n.substitutionValues===void 0){const p=new ie(ue.MissingSubstitutions,`missing substitutionValues for transformation so cannot get the data from Personalization response, ${u}`);return y.log.warn(p.message),o.status.update(new k(p)),{promise:Promise.reject(p),revert:c=>Ur(this,null,function*(){c.update(new k(`Nothing to revert, no transformation attempt, ${p.message}`)),yield Promise.resolve()})}}if(Object.entries(n.substitutionValues).length===0){const p=new ie(ue.MissingSubstitutions,"missing an entry in substitutionValues for transformation so cannot get the data from Personalization response");return y.log.warn(p.message),o.status.update(new k(p)),{promise:Promise.reject(p),revert:c=>Ur(this,null,function*(){c.update(new k(`Nothing to revert, no transformation attempt, ${p.message}`)),yield Promise.resolve()})}}o.status.update(new k(`Awaiting element/conditions ${u}`));const f=r.then(p=>{if(this.isElementAlreadyPersonalized(p)){y.log.error("Aborting personalization, element is already personalized",p);const I=new ie(ue.AlreadyPersonalized,`Aborting ${u}, element is already personalized`);throw o.status.update(new k(I)),I}if(Jo(l,o,n),!D(o.revertStatus)){const I=`Aborting ${u}, revert has been called`;return y.log.info(I),o.status.update(new k(I)),m=>{m.update(new k(`Nothing to revert, since revert was requested before transformation, ${u}`))}}o.status.update(new k(`About to transform/render, element/conditions ready ${u}`));const c=p.outerHTML;let h,d;const g=Ue(),v=na(o.pec.transformationConfig.engagementDestination,t.name,t.transformerType,g),w=oa();for(const I in n.substitutionValues){const m=n.substitutionValues[I];if(!T(m)){const N=`substitutionValues is missing a value for property "${I}" for transformation so cannot get the data from Personalization response`;y.log.warn(N),o.status.update(new k(N));continue}if(y.log.debug(`using dataPath ${m} to get data from personalization response`),w){const N=this.getPathParentObject(m,i),A=this.buildModifiersIfItemRelated(N,v,g);D(A)||(D(d)?(y.log.debug(`Using item-related modifiers ${JSON.stringify(A)} found adjacent to path "${m}"`),h=m,d=A):(A[At]!==d[At]||A[It]!==d[It])&&y.log.warn(`Ignoring different item-related modifiers ${JSON.stringify(A)} found adjacent to path "${m}", already using modifiers from path "${h}"`))}const b=this.isAttributeAssignment(I);if(b!==void 0)try{const N=this.getSanitizedContentString(m,i);if(T(N))if(b){this.setAttributeContent(p,I,N);const A=`Set attribute ${I} to ${N}, ${u}`;y.log.trace(A+", element:",p),o.status.update(new k(A))}else{this.setProperty(p,I,N);const A=`Set property ${I} to ${N}, ${u}`;y.log.trace(A+", element:",p),o.status.update(new k(A))}else{const A=`Could not set property ${I}, nothing found at path ${m}`;y.log.debug(A+", element:",p),o.status.update(new k(A))}}catch(N){const A=`Could not set content for ${u}, subVal "${I}"`;y.log.error(A,N);const U=new Error(A+": "+K(N).message);o.status.update(new k(U))}}let _;return w?(D(d)?(this.autoInjectDefaultRootAttributes(p,l,v,!0),_="Auto-injected engagement attributes without item ids"):(this.autoInjectDefaultItemAttributes(p,l,d,!0),_="Auto-injected engagement attributes with item ids"),y.log.trace(_+`, ${u}`)):(_="Engagement Config does not support auto-injection of default engagement attributes",y.log.trace(_)),o.status.update(new k(_)),I=>{let m=`Reverting ${u}`;y.log.debug(m,p),I.update(new k(m)),p.insertAdjacentHTML("beforebegin",c),p.remove(),m=`Reverted ${u}`,y.log.debug(m,p),I.update(new k(m))}});return{promise:f.then(),revert:p=>Ur(this,null,function*(){p.update(new k("Awaiting transformPromise"));const c=f.then(h=>{h(p)},h=>{if(h instanceof ie){p.update(new k(`Nothing to revert, no transformation attempt, ${u}`));return}throw h});c.catch(h=>{const d=new Error(`Issue reverting ${u}: `+K(h).message);y.log.error(d),p.update(new k(d))}),yield c})}}isAttributeAssignment(t){const n=t.split(".");if(n[0].toLowerCase()==="attributes"){if(n.length===2)return!0;y.log.warn(`multiple objects for 'attributes' with propertyName '${t}' is not supported`);return}return!1}getAttributeContent(t,n){const r=n.split(".");return t.getAttribute(r[1])}removeAttribute(t,n){const r=n.split(".");t.removeAttribute(r[1])}setAttributeContent(t,n,r){const i=n.split(".");t.setAttribute(i[1],r)}setProperty(t,n,r){r=this.handleSpecialValues(n,r);const i=n.split(".");i.length>1?this.setProperty(t[i[0]],i[1],r):Object.assign(t,{[n]:r})}getProperty(t,n){const r=n.split(".");return r.length>1?this.getProperty(t[r[0]],r[1]):t[n]}handleSpecialValues(t,n){if(t.toLowerCase()==="style.backgroundimage"&&T(n))try{return`url(${encodeURI(n)})`}catch(r){y.log.warn(`Could not set style.backgroundImage to a URL "${n}" due to: `,r)}return n}}function Yc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Hr={exports:{}},Fr={exports:{}},we={},X={};X.__esModule=!0,X.extend=ga,X.indexOf=Jc,X.escapeExpression=ef,X.isEmpty=tf,X.createFrame=nf,X.blockParams=rf,X.appendContextPath=of;var Zc={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`","=":"="},Kc=/[&<>"'`=]/g,Xc=/[&<>"'`=]/;function Qc(e){return Zc[e]}function ga(e){for(var t=1;t0?(o.ids&&(o.ids=[o.name]),r.helpers.each(i,o)):s(this);if(o.data&&o.ids){var a=n.createFrame(o.data);a.contextPath=n.appendContextPath(o.data.contextPath,o.name),o={data:a}}return l(i,o)})},e.exports=t.default})(Gr,Gr.exports);var af=Gr.exports,jr={exports:{}};(function(e,t){t.__esModule=!0;function n(s){return s&&s.__esModule?s:{default:s}}var r=X,i=Oe,o=n(i);t.default=function(s){s.registerHelper("each",function(l,a){if(!a)throw new o.default("Must pass iterator to #each");var u=a.fn,f=a.inverse,p=0,c="",h=void 0,d=void 0;a.data&&a.ids&&(d=r.appendContextPath(a.data.contextPath,a.ids[0])+"."),r.isFunction(l)&&(l=l.call(this)),a.data&&(h=r.createFrame(a.data));function g(m,b,N){h&&(h.key=m,h.index=b,h.first=b===0,h.last=!!N,d&&(h.contextPath=d+m)),c=c+u(l[m],{data:h,blockParams:r.blockParams([l[m],m],[d+m,null])})}if(l&&typeof l=="object")if(r.isArray(l))for(var v=l.length;p=0?o=s:o=parseInt(o,10)}return o},log:function(o){if(o=r.lookupLevel(o),typeof console!="undefined"&&r.lookupLevel(r.level)<=o){var s=r.methodMap[o];console[s]||(s="log");for(var l=arguments.length,a=Array(l>1?l-1:0),u=1;u= 2.0.0-beta.1",7:">= 4.0.0 <4.3.0",8:">= 4.3.0"};we.REVISION_CHANGES=Xf;var ti="[object Object]";function ni(e,t,n){this.helpers=e||{},this.partials=t||{},this.decorators=n||{},jf.registerDefaultHelpers(this),Wf.registerDefaultDecorators(this)}ni.prototype={constructor:ni,logger:Hn.default,log:Hn.default.log,registerHelper:function(t,n){if(dt.toString.call(t)===ti){if(n)throw new ei.default("Arg not supported with multiple helpers");dt.extend(this.helpers,t)}else this.helpers[t]=n},unregisterHelper:function(t){delete this.helpers[t]},registerPartial:function(t,n){if(dt.toString.call(t)===ti)dt.extend(this.partials,t);else{if(typeof n=="undefined")throw new ei.default('Attempting to register a partial called "'+t+'" as undefined');this.partials[t]=n}},unregisterPartial:function(t){delete this.partials[t]},registerDecorator:function(t,n){if(dt.toString.call(t)===ti){if(n)throw new ei.default("Arg not supported with multiple decorators");dt.extend(this.decorators,t)}else this.decorators[t]=n},unregisterDecorator:function(t){delete this.decorators[t]},resetLoggedPropertyAccesses:function(){$f.resetLoggedProperties()}};var Qf=Hn.default.log;we.log=Qf,we.createFrame=dt.createFrame,we.logger=Hn.default;var ri={exports:{}};(function(e,t){t.__esModule=!0;function n(r){this.string=r}n.prototype.toString=n.prototype.toHTML=function(){return""+this.string},t.default=n,e.exports=t.default})(ri,ri.exports);var Jf=ri.exports,ot={},ii={};ii.__esModule=!0,ii.wrapHelper=ed;function ed(e,t){if(typeof e!="function")return e;var n=function(){var i=arguments[arguments.length-1];return arguments[arguments.length-1]=t(i),e.apply(this,arguments)};return n}ot.__esModule=!0,ot.checkRevision=ad,ot.template=sd,ot.wrapProgram=Fn,ot.resolvePartial=ld,ot.invokePartial=ud,ot.noop=wa;function td(e){return e&&e.__esModule?e:{default:e}}function nd(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}var rd=X,$e=nd(rd),id=Oe,Ye=td(id),Ze=we,Ta=en,od=ii,ba=Ot;function ad(e){var t=e&&e[0]||1,n=Ze.COMPILER_REVISION;if(!(t>=Ze.LAST_COMPATIBLE_COMPILER_REVISION&&t<=Ze.COMPILER_REVISION))if(t2&&B.push("'"+this.terminals_[U]+"'");this.lexer.showPosition?He="Parse error on line "+(d+1)+`: `+this.lexer.showPosition()+` Expecting `+B.join(", ")+", got '"+(this.terminals_[I]||I)+"'":He="Parse error on line "+(d+1)+": Unexpected "+(I==1?"end of input":"'"+(this.terminals_[I]||I)+"'"),this.parseError(He,{text:this.lexer.match,token:this.terminals_[I]||I,line:this.lexer.yylineno,loc:v,expected:B})}}if(b[0]instanceof Array&&b.length>1)throw new Error("Parse Error: multiple actions possible at state: "+m+", token: "+I);switch(b[0]){case 1:u.push(I),f.push(this.lexer.yytext),p.push(this.lexer.yylloc),u.push(b[1]),I=null,g=this.lexer.yyleng,h=this.lexer.yytext,d=this.lexer.yylineno,v=this.lexer.yylloc;break;case 2:if(Q=this.productions_[b[1]][1],A.$=f[f.length-Q],A._$={first_line:p[p.length-(Q||1)].first_line,last_line:p[p.length-1].last_line,first_column:p[p.length-(Q||1)].first_column,last_column:p[p.length-1].last_column},w&&(A._$.range=[p[p.length-(Q||1)].range[0],p[p.length-1].range[1]]),N=this.performAction.call(A,h,g,d,this.yy,b[1],f,p),typeof N!="undefined")return N;Q&&(u=u.slice(0,-1*Q*2),f=f.slice(0,-1*Q),p=p.slice(0,-1*Q)),u.push(this.productions_[b[1]][0]),f.push(A.$),p.push(A._$),W=c[u[u.length-2]][u[u.length-1]],u.push(W);break;case 3:return!0}}return!0}},i=function(){var s={EOF:1,parseError:function(a,u){if(this.yy.parser)this.yy.parser.parseError(a,u);else throw new Error(a)},setInput:function(a){return this._input=a,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.offset++,this.match+=a,this.matched+=a;var u=a.match(/(?:\r\n?|\n).*/g);return u?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),a},unput:function(a){var u=a.length,f=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-u-1),this.offset-=u;var p=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),f.length-1&&(this.yylineno-=f.length-1);var c=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:f?(f.length===p.length?this.yylloc.first_column:0)+p[p.length-f.length].length-f[0].length:this.yylloc.first_column-u},this.options.ranges&&(this.yylloc.range=[c[0],c[0]+this.yyleng-u]),this},more:function(){return this._more=!0,this},less:function(a){this.unput(this.match.slice(a))},pastInput:function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var a=this.pastInput(),u=new Array(a.length+1).join("-");return a+this.upcomingInput()+` `+u+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var a,u,f,p,c;this._more||(this.yytext="",this.match="");for(var h=this._currentRules(),d=0;du[0].length)&&(u=f,p=d,!this.options.flex)));d++);return u?(c=u[0].match(/(?:\r\n?|\n).*/g),c&&(this.yylineno+=c.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:c?c[c.length-1].length-c[c.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+u[0].length},this.yytext+=u[0],this.match+=u[0],this.matches=u,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(u[0].length),this.matched+=u[0],a=this.performAction.call(this,this.yy,this,h[p],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),a||void 0):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. `+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var a=this.next();return typeof a!="undefined"?a:this.lex()},begin:function(a){this.conditionStack.push(a)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(a){this.begin(a)}};return s.options={},s.performAction=function(a,u,f,p){function c(h,d){return u.yytext=u.yytext.substring(h,u.yyleng-d+h)}switch(f){case 0:if(u.yytext.slice(-2)==="\\\\"?(c(0,1),this.begin("mu")):u.yytext.slice(-1)==="\\"?(c(0,1),this.begin("emu")):this.begin("mu"),u.yytext)return 15;break;case 1:return 15;case 2:return this.popState(),15;case 3:return this.begin("raw"),15;case 4:return this.popState(),this.conditionStack[this.conditionStack.length-1]==="raw"?15:(c(5,9),"END_RAW_BLOCK");case 5:return 15;case 6:return this.popState(),14;case 7:return 65;case 8:return 68;case 9:return 19;case 10:return this.popState(),this.begin("raw"),23;case 11:return 55;case 12:return 60;case 13:return 29;case 14:return 47;case 15:return this.popState(),44;case 16:return this.popState(),44;case 17:return 34;case 18:return 39;case 19:return 51;case 20:return 48;case 21:this.unput(u.yytext),this.popState(),this.begin("com");break;case 22:return this.popState(),14;case 23:return 48;case 24:return 73;case 25:return 72;case 26:return 72;case 27:return 87;case 28:break;case 29:return this.popState(),54;case 30:return this.popState(),33;case 31:return u.yytext=c(1,2).replace(/\\"/g,'"'),80;case 32:return u.yytext=c(1,2).replace(/\\'/g,"'"),80;case 33:return 85;case 34:return 82;case 35:return 82;case 36:return 83;case 37:return 84;case 38:return 81;case 39:return 75;case 40:return 77;case 41:return 72;case 42:return u.yytext=u.yytext.replace(/\\([\\\]])/g,"$1"),72;case 43:return"INVALID";case 44:return 5}},s.rules=[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{(?=[^/]))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]+?(?=(\{\{\{\{)))/,/^(?:[\s\S]*?--(~)?\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#>)/,/^(?:\{\{(~)?#\*?)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{(~)?!--)/,/^(?:\{\{(~)?![\s\S]*?\}\})/,/^(?:\{\{(~)?\*?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)|])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:undefined(?=([~}\s)])))/,/^(?:null(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:as\s+\|)/,/^(?:\|)/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/,/^(?:\[(\\\]|[^\]])*\])/,/^(?:.)/,/^(?:$)/],s.conditions={mu:{rules:[7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[6],inclusive:!1},raw:{rules:[3,4,5],inclusive:!1},INITIAL:{rules:[0,1,44],inclusive:!0}},s}();r.lexer=i;function o(){this.yy={}}return o.prototype=r,r.Parser=o,new o}();t.default=n,e.exports=t.default})(si,si.exports);var pd=si.exports,li={exports:{}},ui={exports:{}};(function(e,t){t.__esModule=!0;function n(u){return u&&u.__esModule?u:{default:u}}var r=Oe,i=n(r);function o(){this.parents=[]}o.prototype={constructor:o,mutating:!1,acceptKey:function(f,p){var c=this.accept(f[p]);if(this.mutating){if(c&&!o.prototype[c.type])throw new i.default('Unexpected node type "'+c.type+'" found when accepting '+p+" on "+f.type);f[p]=c}},acceptRequired:function(f,p){if(this.acceptKey(f,p),!f[p])throw new i.default(f.type+" requires "+p)},acceptArray:function(f){for(var p=0,c=f.length;p0)throw new ci.default("Invalid path: "+r,{loc:n});a===".."&&o++}else i.push(a)}return{type:"PathExpression",data:e,depth:o,parts:i,original:r,loc:n}}function wd(e,t,n,r,i,o){var s=r.charAt(3)||r.charAt(2),l=s!=="{"&&s!=="&",a=/\*/.test(r);return{type:a?"Decorator":"MustacheStatement",path:e,params:t,hash:n,escaped:l,strip:i,loc:this.locInfo(o)}}function Sd(e,t,n,r){fi(e,n),r=this.locInfo(r);var i={type:"Program",body:t,strip:{},loc:r};return{type:"BlockStatement",path:e.path,params:e.params,hash:e.hash,program:i,openStrip:{},inverseStrip:{},closeStrip:{},loc:r}}function Id(e,t,n,r,i,o){r&&r.path&&fi(e,r);var s=/\*/.test(e.open);t.blockParams=e.blockParams;var l=void 0,a=void 0;if(n){if(s)throw new ci.default("Unexpected inverse block on decorator",n);n.chain&&(n.program.body[0].closeStrip=r.strip),a=n.strip,l=n.program}return i&&(i=l,l=t,t=i),{type:s?"DecoratorBlock":"BlockStatement",path:e.path,params:e.params,hash:e.hash,program:t,inverse:l,openStrip:e.strip,inverseStrip:a,closeStrip:r&&r.strip,loc:this.locInfo(o)}}function Ad(e,t){if(!t&&e.length){var n=e[0].loc,r=e[e.length-1].loc;n&&r&&(t={source:n.source,start:{line:n.start.line,column:n.start.column},end:{line:r.end.line,column:r.end.column}})}return{type:"Program",body:e,strip:{},loc:t}}function Cd(e,t,n,r){return fi(e,n),{type:"PartialBlockStatement",name:e.path,params:e.params,hash:e.hash,program:t,openStrip:e.strip,closeStrip:n&&n.strip,loc:this.locInfo(r)}}tn.__esModule=!0,tn.parseWithoutProcessing=Oa,tn.parse=xd;function Pd(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function Pa(e){return e&&e.__esModule?e:{default:e}}var Od=pd,di=Pa(Od),Nd=gd,Dd=Pa(Nd),Md=Se,Rd=Pd(Md),Ld=X;tn.parser=di.default;var zn={};Ld.extend(zn,Rd);function Oa(e,t){if(e.type==="Program")return e;di.default.yy=zn,zn.locInfo=function(r){return new zn.SourceLocation(t&&t.srcName,r)};var n=di.default.parse(e);return n}function xd(e,t){var n=Oa(e,t),r=new Dd.default(t);return r.accept(n)}var nn={};nn.__esModule=!0,nn.Compiler=hi,nn.precompile=Fd,nn.compile=zd;function Na(e){return e&&e.__esModule?e:{default:e}}var kd=Oe,rn=Na(kd),on=X,Ud=Aa,an=Na(Ud),Hd=[].slice;function hi(){}hi.prototype={compiler:hi,equals:function(t){var n=this.opcodes.length;if(t.opcodes.length!==n)return!1;for(var r=0;r1)throw new rn.default("Unsupported number of partial arguments: "+r.length,t);r.length||(this.options.explicitPartialContext?this.opcode("pushLiteral","undefined"):r.push({type:"PathExpression",parts:[],depth:0}));var i=t.name.original,o=t.name.type==="SubExpression";o&&this.accept(t.name),this.setupFullMustacheParams(t,n,void 0,!0);var s=t.indent||"";this.options.preventIndent&&s&&(this.opcode("appendContent",s),s=""),this.opcode("invokePartial",o,i,s),this.opcode("append")},PartialBlockStatement:function(t){this.PartialStatement(t)},MustacheStatement:function(t){this.SubExpression(t),t.escaped&&!this.options.noEscape?this.opcode("appendEscaped"):this.opcode("append")},Decorator:function(t){this.DecoratorBlock(t)},ContentStatement:function(t){t.value&&this.opcode("appendContent",t.value)},CommentStatement:function(){},SubExpression:function(t){Ma(t);var n=this.classifySexpr(t);n==="simple"?this.simpleSexpr(t):n==="helper"?this.helperSexpr(t):this.ambiguousSexpr(t)},ambiguousSexpr:function(t,n,r){var i=t.path,o=i.parts[0],s=n!=null||r!=null;this.opcode("getContext",i.depth),this.opcode("pushProgram",n),this.opcode("pushProgram",r),i.strict=!0,this.accept(i),this.opcode("invokeAmbiguous",o,s)},simpleSexpr:function(t){var n=t.path;n.strict=!0,this.accept(n),this.opcode("resolvePossibleLambda")},helperSexpr:function(t,n,r){var i=this.setupFullMustacheParams(t,n,r),o=t.path,s=o.parts[0];if(this.options.knownHelpers[s])this.opcode("invokeKnownHelper",i.length,s);else{if(this.options.knownHelpersOnly)throw new rn.default("You specified knownHelpersOnly, but used the unknown helper "+s,t);o.strict=!0,o.falsy=!0,this.accept(o),this.opcode("invokeHelper",i.length,o.original,an.default.helpers.simpleId(o))}},PathExpression:function(t){this.addDepth(t.depth),this.opcode("getContext",t.depth);var n=t.parts[0],r=an.default.helpers.scopedId(t),i=!t.depth&&!r&&this.blockParamIndex(n);i?this.opcode("lookupBlockParam",i,t.parts):n?t.data?(this.options.data=!0,this.opcode("lookupData",t.depth,t.parts,t.strict)):this.opcode("lookupOnContext",t.parts,t.falsy,t.strict,r):this.opcode("pushContext")},StringLiteral:function(t){this.opcode("pushString",t.value)},NumberLiteral:function(t){this.opcode("pushLiteral",t.value)},BooleanLiteral:function(t){this.opcode("pushLiteral",t.value)},UndefinedLiteral:function(){this.opcode("pushLiteral","undefined")},NullLiteral:function(){this.opcode("pushLiteral","null")},Hash:function(t){var n=t.pairs,r=0,i=n.length;for(this.opcode("pushHash");r=0)return[n,o]}}};function Fd(e,t,n){if(e==null||typeof e!="string"&&e.type!=="Program")throw new rn.default("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+e);t=t||{},"data"in t||(t.data=!0),t.compat&&(t.useDepths=!0);var r=n.parse(e,t),i=new n.Compiler().compile(r,t);return new n.JavaScriptCompiler().compile(i,t)}function zd(e,t,n){if(t===void 0&&(t={}),e==null||typeof e!="string"&&e.type!=="Program")throw new rn.default("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+e);t=on.extend({},t),"data"in t||(t.data=!0),t.compat&&(t.useDepths=!0);var r=void 0;function i(){var s=n.parse(e,t),l=new n.Compiler().compile(s,t),a=new n.JavaScriptCompiler().compile(l,t,void 0,!0);return n.template(a)}function o(s,l){return r||(r=i()),r.call(this,s,l)}return o._setup=function(s){return r||(r=i()),r._setup(s)},o._child=function(s,l,a,u){return r||(r=i()),r._child(s,l,a,u)},o}function Da(e,t){if(e===t)return!0;if(on.isArray(e)&&on.isArray(t)&&e.length===t.length){for(var n=0;n>1;return a?-u:u}return Vn.encode=function(a){var u="",f,p=o(a);do f=p&r,p>>>=t,p>0&&(f|=i),u+=e.encode(f);while(p>0);return u},Vn.decode=function(a,u,f){var p=a.length,c=0,h=0,d,g;do{if(u>=p)throw new Error("Expected more digits in base 64 VLQ value.");if(g=e.decode(a.charCodeAt(u++)),g===-1)throw new Error("Invalid base64 digit: "+a.charAt(u-1));d=!!(g&i),g&=r,c=c+(g<=0;B--)Q=U[B],Q==="."?U.splice(B,1):Q===".."?W++:W>0&&(Q===""?(U.splice(B+1,W),W=0):(U.splice(B,2),W--));return b=U.join("/"),b===""&&(b=A?"/":"."),N?(N.path=b,o(N)):b}e.normalize=s;function l(m,b){m===""&&(m="."),b===""&&(b=".");var N=i(b),A=i(m);if(A&&(m=A.path||"/"),N&&!N.scheme)return A&&(N.scheme=A.scheme),o(N);if(N||b.match(r))return b;if(A&&!A.host&&!A.path)return A.host=b,o(A);var U=b.charAt(0)==="/"?b:s(m.replace(/\/+$/,"")+"/"+b);return A?(A.path=U,o(A)):U}e.join=l,e.isAbsolute=function(m){return m.charAt(0)==="/"||n.test(m)};function a(m,b){m===""&&(m="."),m=m.replace(/\/$/,"");for(var N=0;b.indexOf(m+"/")!==0;){var A=m.lastIndexOf("/");if(A<0||(m=m.slice(0,A),m.match(/^([^\/]+:\/)?\/*$/)))return b;++N}return Array(N+1).join("../")+b.substr(m.length+1)}e.relative=a;var u=function(){var m=Object.create(null);return!("__proto__"in m)}();function f(m){return m}function p(m){return h(m)?"$"+m:m}e.toSetString=u?f:p;function c(m){return h(m)?m.slice(1):m}e.fromSetString=u?f:c;function h(m){if(!m)return!1;var b=m.length;if(b<9||m.charCodeAt(b-1)!==95||m.charCodeAt(b-2)!==95||m.charCodeAt(b-3)!==111||m.charCodeAt(b-4)!==116||m.charCodeAt(b-5)!==111||m.charCodeAt(b-6)!==114||m.charCodeAt(b-7)!==112||m.charCodeAt(b-8)!==95||m.charCodeAt(b-9)!==95)return!1;for(var N=b-10;N>=0;N--)if(m.charCodeAt(N)!==36)return!1;return!0}function d(m,b,N){var A=v(m.source,b.source);return A!==0||(A=m.originalLine-b.originalLine,A!==0)||(A=m.originalColumn-b.originalColumn,A!==0||N)||(A=m.generatedColumn-b.generatedColumn,A!==0)||(A=m.generatedLine-b.generatedLine,A!==0)?A:v(m.name,b.name)}e.compareByOriginalPositions=d;function g(m,b,N){var A=m.generatedLine-b.generatedLine;return A!==0||(A=m.generatedColumn-b.generatedColumn,A!==0||N)||(A=v(m.source,b.source),A!==0)||(A=m.originalLine-b.originalLine,A!==0)||(A=m.originalColumn-b.originalColumn,A!==0)?A:v(m.name,b.name)}e.compareByGeneratedPositionsDeflated=g;function v(m,b){return m===b?0:m===null?1:b===null?-1:m>b?1:-1}function w(m,b){var N=m.generatedLine-b.generatedLine;return N!==0||(N=m.generatedColumn-b.generatedColumn,N!==0)||(N=v(m.source,b.source),N!==0)||(N=m.originalLine-b.originalLine,N!==0)||(N=m.originalColumn-b.originalColumn,N!==0)?N:v(m.name,b.name)}e.compareByGeneratedPositionsInflated=w;function _(m){return JSON.parse(m.replace(/^\)]}'[^\n]*\n/,""))}e.parseSourceMapInput=_;function I(m,b,N){if(b=b||"",m&&(m[m.length-1]!=="/"&&b[0]!=="/"&&(m+="/"),b=m+b),N){var A=i(N);if(!A)throw new Error("sourceMapURL could not be parsed");if(A.path){var U=A.path.lastIndexOf("/");U>=0&&(A.path=A.path.substring(0,U+1))}b=l(o(A),b)}return s(b)}e.computeSourceURL=I}(vi)),vi}var Ei={},Ua;function Ha(){if(Ua)return Ei;Ua=1;var e=ln(),t=Object.prototype.hasOwnProperty,n=typeof Map!="undefined";function r(){this._array=[],this._set=n?new Map:Object.create(null)}return r.fromArray=function(o,s){for(var l=new r,a=0,u=o.length;a=0)return s}else{var l=e.toSetString(o);if(t.call(this._set,l))return this._set[l]}throw new Error('"'+o+'" is not in the set.')},r.prototype.at=function(o){if(o>=0&&oo||s==o&&a>=l||e.compareByGeneratedPositionsInflated(r,i)<=0}function n(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}return n.prototype.unsortedForEach=function(i,o){this._array.forEach(i,o)},n.prototype.add=function(i){t(this._last,i)?(this._last=i,this._array.push(i)):(this._sorted=!1,this._array.push(i))},n.prototype.toArray=function(){return this._sorted||(this._array.sort(e.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},yi.MappingList=n,yi}var za;function Va(){if(za)return mi;za=1;var e=xa(),t=ln(),n=Ha().ArraySet,r=Bd().MappingList;function i(o){o||(o={}),this._file=t.getArg(o,"file",null),this._sourceRoot=t.getArg(o,"sourceRoot",null),this._skipValidation=t.getArg(o,"skipValidation",!1),this._sources=new n,this._names=new n,this._mappings=new r,this._sourcesContents=null}return i.prototype._version=3,i.fromSourceMap=function(s){var l=s.sourceRoot,a=new i({file:s.file,sourceRoot:l});return s.eachMapping(function(u){var f={generated:{line:u.generatedLine,column:u.generatedColumn}};u.source!=null&&(f.source=u.source,l!=null&&(f.source=t.relative(l,f.source)),f.original={line:u.originalLine,column:u.originalColumn},u.name!=null&&(f.name=u.name)),a.addMapping(f)}),s.sources.forEach(function(u){var f=u;l!==null&&(f=t.relative(l,u)),a._sources.has(f)||a._sources.add(f);var p=s.sourceContentFor(u);p!=null&&a.setSourceContent(u,p)}),a},i.prototype.addMapping=function(s){var l=t.getArg(s,"generated"),a=t.getArg(s,"original",null),u=t.getArg(s,"source",null),f=t.getArg(s,"name",null);this._skipValidation||this._validateMapping(l,a,u,f),u!=null&&(u=String(u),this._sources.has(u)||this._sources.add(u)),f!=null&&(f=String(f),this._names.has(f)||this._names.add(f)),this._mappings.add({generatedLine:l.line,generatedColumn:l.column,originalLine:a!=null&&a.line,originalColumn:a!=null&&a.column,source:u,name:f})},i.prototype.setSourceContent=function(s,l){var a=s;this._sourceRoot!=null&&(a=t.relative(this._sourceRoot,a)),l!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[t.toSetString(a)]=l):this._sourcesContents&&(delete this._sourcesContents[t.toSetString(a)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))},i.prototype.applySourceMap=function(s,l,a){var u=l;if(l==null){if(s.file==null)throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);u=s.file}var f=this._sourceRoot;f!=null&&(u=t.relative(f,u));var p=new n,c=new n;this._mappings.unsortedForEach(function(h){if(h.source===u&&h.originalLine!=null){var d=s.originalPositionFor({line:h.originalLine,column:h.originalColumn});d.source!=null&&(h.source=d.source,a!=null&&(h.source=t.join(a,h.source)),f!=null&&(h.source=t.relative(f,h.source)),h.originalLine=d.line,h.originalColumn=d.column,d.name!=null&&(h.name=d.name))}var g=h.source;g!=null&&!p.has(g)&&p.add(g);var v=h.name;v!=null&&!c.has(v)&&c.add(v)},this),this._sources=p,this._names=c,s.sources.forEach(function(h){var d=s.sourceContentFor(h);d!=null&&(a!=null&&(h=t.join(a,h)),f!=null&&(h=t.relative(f,h)),this.setSourceContent(h,d))},this)},i.prototype._validateMapping=function(s,l,a,u){if(l&&typeof l.line!="number"&&typeof l.column!="number")throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(!(s&&"line"in s&&"column"in s&&s.line>0&&s.column>=0&&!l&&!a&&!u)){if(s&&"line"in s&&"column"in s&&l&&"line"in l&&"column"in l&&s.line>0&&s.column>=0&&l.line>0&&l.column>=0&&a)return;throw new Error("Invalid mapping: "+JSON.stringify({generated:s,source:a,original:l,name:u}))}},i.prototype._serializeMappings=function(){for(var s=0,l=1,a=0,u=0,f=0,p=0,c="",h,d,g,v,w=this._mappings.toArray(),_=0,I=w.length;_0){if(!t.compareByGeneratedPositionsInflated(d,w[_-1]))continue;h+=","}h+=e.encode(d.generatedColumn-s),s=d.generatedColumn,d.source!=null&&(v=this._sources.indexOf(d.source),h+=e.encode(v-p),p=v,h+=e.encode(d.originalLine-1-u),u=d.originalLine-1,h+=e.encode(d.originalColumn-a),a=d.originalColumn,d.name!=null&&(g=this._names.indexOf(d.name),h+=e.encode(g-f),f=g)),c+=h}return c},i.prototype._generateSourcesContent=function(s,l){return s.map(function(a){if(!this._sourcesContents)return null;l!=null&&(a=t.relative(l,a));var u=t.toSetString(a);return Object.prototype.hasOwnProperty.call(this._sourcesContents,u)?this._sourcesContents[u]:null},this)},i.prototype.toJSON=function(){var s={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(s.file=this._file),this._sourceRoot!=null&&(s.sourceRoot=this._sourceRoot),this._sourcesContents&&(s.sourcesContent=this._generateSourcesContent(s.sources,s.sourceRoot)),s},i.prototype.toString=function(){return JSON.stringify(this.toJSON())},mi.SourceMapGenerator=i,mi}var un={},_i={},Ba;function Gd(){return Ba||(Ba=1,function(e){e.GREATEST_LOWER_BOUND=1,e.LEAST_UPPER_BOUND=2;function t(n,r,i,o,s,l){var a=Math.floor((r-n)/2)+n,u=s(i,o[a],!0);return u===0?a:u>0?r-a>1?t(a,r,i,o,s,l):l==e.LEAST_UPPER_BOUND?r1?t(n,a,i,o,s,l):l==e.LEAST_UPPER_BOUND?a:n<0?-1:n}e.search=function(r,i,o,s){if(i.length===0)return-1;var l=t(-1,i.length,r,i,o,s||e.GREATEST_LOWER_BOUND);if(l<0)return-1;for(;l-1>=0&&o(i[l],i[l-1],!0)===0;)--l;return l}}(_i)),_i}var Ti={},Ga;function jd(){if(Ga)return Ti;Ga=1;function e(r,i,o){var s=r[i];r[i]=r[o],r[o]=s}function t(r,i){return Math.round(r+Math.random()*(i-r))}function n(r,i,o,s){if(o=0){var g=this._originalMappings[d];if(f.column===void 0)for(var v=g.originalLine;g&&g.originalLine===v;)h.push({line:e.getArg(g,"generatedLine",null),column:e.getArg(g,"generatedColumn",null),lastColumn:e.getArg(g,"lastGeneratedColumn",null)}),g=this._originalMappings[++d];else for(var w=g.originalColumn;g&&g.originalLine===p&&g.originalColumn==w;)h.push({line:e.getArg(g,"generatedLine",null),column:e.getArg(g,"generatedColumn",null),lastColumn:e.getArg(g,"lastGeneratedColumn",null)}),g=this._originalMappings[++d]}return h},un.SourceMapConsumer=o;function s(u,f){var p=u;typeof u=="string"&&(p=e.parseSourceMapInput(u));var c=e.getArg(p,"version"),h=e.getArg(p,"sources"),d=e.getArg(p,"names",[]),g=e.getArg(p,"sourceRoot",null),v=e.getArg(p,"sourcesContent",null),w=e.getArg(p,"mappings"),_=e.getArg(p,"file",null);if(c!=this._version)throw new Error("Unsupported version: "+c);g&&(g=e.normalize(g)),h=h.map(String).map(e.normalize).map(function(I){return g&&e.isAbsolute(g)&&e.isAbsolute(I)?e.relative(g,I):I}),this._names=n.fromArray(d.map(String),!0),this._sources=n.fromArray(h,!0),this._absoluteSources=this._sources.toArray().map(function(I){return e.computeSourceURL(g,I,f)}),this.sourceRoot=g,this.sourcesContent=v,this._mappings=w,this._sourceMapURL=f,this.file=_}s.prototype=Object.create(o.prototype),s.prototype.consumer=o,s.prototype._findSourceIndex=function(u){var f=u;if(this.sourceRoot!=null&&(f=e.relative(this.sourceRoot,f)),this._sources.has(f))return this._sources.indexOf(f);var p;for(p=0;p1&&(U.source=v+W[1],v+=W[1],U.originalLine=d+W[2],d=U.originalLine,U.originalLine+=1,U.originalColumn=g+W[3],g=U.originalColumn,W.length>4&&(U.name=w+W[4],w+=W[4])),A.push(U),typeof U.originalLine=="number"&&N.push(U)}i(A,e.compareByGeneratedPositionsDeflated),this.__generatedMappings=A,i(N,e.compareByOriginalPositions),this.__originalMappings=N},s.prototype._findMapping=function(f,p,c,h,d,g){if(f[c]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+f[c]);if(f[h]<0)throw new TypeError("Column must be greater than or equal to 0, got "+f[h]);return t.search(f,p,d,g)},s.prototype.computeColumnSpans=function(){for(var f=0;f=0){var h=this._generatedMappings[c];if(h.generatedLine===p.generatedLine){var d=e.getArg(h,"source",null);d!==null&&(d=this._sources.at(d),d=e.computeSourceURL(this.sourceRoot,d,this._sourceMapURL));var g=e.getArg(h,"name",null);return g!==null&&(g=this._names.at(g)),{source:d,line:e.getArg(h,"originalLine",null),column:e.getArg(h,"originalColumn",null),name:g}}}return{source:null,line:null,column:null,name:null}},s.prototype.hasContentsOfAllSources=function(){return this.sourcesContent?this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(f){return f==null}):!1},s.prototype.sourceContentFor=function(f,p){if(!this.sourcesContent)return null;var c=this._findSourceIndex(f);if(c>=0)return this.sourcesContent[c];var h=f;this.sourceRoot!=null&&(h=e.relative(this.sourceRoot,h));var d;if(this.sourceRoot!=null&&(d=e.urlParse(this.sourceRoot))){var g=h.replace(/^file:\/\//,"");if(d.scheme=="file"&&this._sources.has(g))return this.sourcesContent[this._sources.indexOf(g)];if((!d.path||d.path=="/")&&this._sources.has("/"+h))return this.sourcesContent[this._sources.indexOf("/"+h)]}if(p)return null;throw new Error('"'+h+'" is not in the SourceMap.')},s.prototype.generatedPositionFor=function(f){var p=e.getArg(f,"source");if(p=this._findSourceIndex(p),p<0)return{line:null,column:null,lastColumn:null};var c={source:p,originalLine:e.getArg(f,"line"),originalColumn:e.getArg(f,"column")},h=this._findMapping(c,this._originalMappings,"originalLine","originalColumn",e.compareByOriginalPositions,e.getArg(f,"bias",o.GREATEST_LOWER_BOUND));if(h>=0){var d=this._originalMappings[h];if(d.source===c.source)return{line:e.getArg(d,"generatedLine",null),column:e.getArg(d,"generatedColumn",null),lastColumn:e.getArg(d,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},un.BasicSourceMapConsumer=s;function a(u,f){var p=u;typeof u=="string"&&(p=e.parseSourceMapInput(u));var c=e.getArg(p,"version"),h=e.getArg(p,"sections");if(c!=this._version)throw new Error("Unsupported version: "+c);this._sources=new n,this._names=new n;var d={line:-1,column:0};this._sections=h.map(function(g){if(g.url)throw new Error("Support for url field in sections not implemented.");var v=e.getArg(g,"offset"),w=e.getArg(v,"line"),_=e.getArg(v,"column");if(w=0;a--)this.prepend(l[a]);else if(l[i]||typeof l=="string")this.children.unshift(l);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+l);return this},o.prototype.walk=function(l){for(var a,u=0,f=this.children.length;u0){for(a=[],u=0;u0&&(g+=", "+v.join(", "));var w=0;Object.keys(this.aliases).forEach(function(m){var b=d.aliases[m];b.children&&b.referenceCount>1&&(g+=", alias"+ ++w+"="+m,b.children[0]="alias"+w)}),this.lookupPropertyFunctionIsUsed&&(g+=", "+this.lookupPropertyFunctionVarDeclaration());var _=["container","depth0","helpers","partials","data"];(this.useBlockParams||this.useDepths)&&_.push("blockParams"),this.useDepths&&_.push("depths");var I=this.mergeSource(g);return h?(_.push(I),Function.apply(this,_)):this.source.wrap(["function(",_.join(","),`) { `,I,"}"])},mergeSource:function(h){var d=this.environment.isSimple,g=!this.forceBuffer,v=void 0,w=void 0,_=void 0,I=void 0;return this.source.each(function(m){m.appendToBuffer?(_?m.prepend(" + "):_=m,I=m):(_&&(w?_.prepend("buffer += "):v=!0,I.add(";"),_=I=void 0),w=!0,d||(g=!1))}),g?_?(_.prepend("return "),I.add(";")):w||this.source.push('return "";'):(h+=", buffer = "+(v?"":this.initializeBuffer()),_?(_.prepend("return buffer + "),I.add(";")):this.source.push("return buffer;")),h&&this.source.prepend("var "+h.substring(2)+(v?"":`; `)),this.source.merge()},lookupPropertyFunctionVarDeclaration:function(){return` lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined } `.trim()},blockValue:function(h){var d=this.aliasable("container.hooks.blockHelperMissing"),g=[this.contextName(0)];this.setupHelperArgs(h,0,g);var v=this.popStack();g.splice(1,0,v),this.push(this.source.functionCall(d,"call",g))},ambiguousBlockValue:function(){var h=this.aliasable("container.hooks.blockHelperMissing"),d=[this.contextName(0)];this.setupHelperArgs("",0,d,!0),this.flushInline();var g=this.topStack();d.splice(1,0,g),this.pushSource(["if (!",this.lastHelper,") { ",g," = ",this.source.functionCall(h,"call",d),"}"])},appendContent:function(h){this.pendingContent?h=this.pendingContent+h:this.pendingLocation=this.source.currentLocation,this.pendingContent=h},append:function(){if(this.isInline())this.replaceStack(function(d){return[" != null ? ",d,' : ""']}),this.pushSource(this.appendToBuffer(this.popStack()));else{var h=this.popStack();this.pushSource(["if (",h," != null) { ",this.appendToBuffer(h,void 0,!0)," }"]),this.environment.isSimple&&this.pushSource(["else { ",this.appendToBuffer("''",void 0,!0)," }"])}},appendEscaped:function(){this.pushSource(this.appendToBuffer([this.aliasable("container.escapeExpression"),"(",this.popStack(),")"]))},getContext:function(h){this.lastContext=h},pushContext:function(){this.pushStackLiteral(this.contextName(this.lastContext))},lookupOnContext:function(h,d,g,v){var w=0;!v&&this.options.compat&&!this.lastContext?this.push(this.depthedLookup(h[w++])):this.pushContext(),this.resolvePath("context",h,w,d,g)},lookupBlockParam:function(h,d){this.useBlockParams=!0,this.push(["blockParams[",h[0],"][",h[1],"]"]),this.resolvePath("context",d,1)},lookupData:function(h,d,g){h?this.pushStackLiteral("container.data(data, "+h+")"):this.pushStackLiteral("data"),this.resolvePath("data",d,0,!0,g)},resolvePath:function(h,d,g,v,w){var _=this;if(this.options.strict||this.options.assumeObjects){this.push(p(this.options.strict&&w,this,d,g,h));return}for(var I=d.length;gthis.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var h=this.inlineStack;this.inlineStack=[];for(var d=0,g=h.length;dt in e?Xd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Za=(e,t)=>{for(var n in t||(t={}))Qd.call(t,n)&&Ya(e,n,t[n]);if($a)for(var n of $a(t))Jd.call(t,n)&&Ya(e,n,t[n]);return e};class cn extends xr{constructor(){super();const t=cn.getBuiltInHandlebarsHelpers();for(const[n,r]of Object.entries(t))at.registerHelper(n,r)}static getBuiltInHandlebarsHelpers(){return{subVar:ch,each:hh,isPreview:dh}}getContent(t,n,r,i){var o,s;let l=`transformation ${n.transformerName}`;r!==void 0&&(l=`personalization ${r.personalizationId}, `+l);const a=this,u=this.getHandlebarsTemplate(t),f=Za({},(o=n.substitutionValues)!=null?o:{}),p=(s=t.substitutionDefinitions)!=null?s:{},c={},h=Or(r==null?void 0:r.personalizationId,i.pec.name);Xi("DEBUG")&&y.log.debug(`For ${l}, rendering of template: \r ${u} \r SubstitutionValues: \r ${JSON.stringify(f)} \r Preview: ${String(h)}`),Object.entries(p).forEach(([b,N])=>{var A;c[b]=(A=N.configType)!=null?A:Re.SchemaPath,(!(b in f)||b in f&&(D(f[b])||f[b]===""))&&(f[b]=N.defaultValue)});const d=Ue(),g=na(i.pec.transformationConfig.engagementDestination,t.name,t.transformerType,d),v=oa(),w=this.transformerSupportsAutoInjection(t),_={data:{_sf_personalization:{subVar:f,subConfigTypes:c,destinationName:g,engagementConfig:d,ecSupportsAutoInjection:v,transformerSupportsAutoInjection:w,transformerInstance:a,isPreview:h}}};let I=a.compileTransformerDetails(u,r,_,i.status);v&&w&&r!==void 0?I=rh(a,I,r.personalizationId,g):(y.log.trace(`${v?"Transformer":"Engagement Config"} does not support auto-injection of default engagement attributes`),i.status.update(new k("No auto-injection of default engagement attributes")));const m=Bt();return T(m)&&(I=nh(I,m)),y.log.trace(`Rendered Content: ${I}`),i.status.update(new k("Rendered Content")),String(I)}compileTransformerDetails(t,n,r,i){const o=document.createElement("script");i.update(new k("Precompiling template"));const s=at.precompile(t);if(!T(s))throw new Error("Error while compiling handlebars template, precompilation did not result in a string");o.textContent="window.SalesforceInteractions.Personalization.precompiledTemplate = "+s;const l=Bt();T(l)&&(y.log.debug("Adding nonce to inline script for handlebars precompile"),o.nonce=l),document.head.appendChild(o);const a=window.SalesforceInteractions.Personalization.precompiledTemplate;let u;try{if(!O(a))throw new Error("Error while compiling handlebars template, compiled template is undefined. This is likely due to a Content Security Policy (CSP) violation.");i.update(new k("Forming template")),u=at.template(a)}finally{delete window.SalesforceInteractions.Personalization.precompiledTemplate,document.head.removeChild(o)}const f=n!==void 0?xr.sanitizer.sanitizeObject(n):{};return i.update(new k("Using template")),u(f,r)}}function eh(e,t){if(!T(e))throw new V(G.InvalidHandlebarsHelperName,"Handlebars helper name is undefined");if(D(t))throw new V(G.InvalidHandlebarsHelperFunction,"Handlebars helper function is undefined");if(Object.keys(cn.getBuiltInHandlebarsHelpers()).includes(e))throw new V(G.InvalidHandlebarsHelperName,`Handlebars helper ${e} is a reserved name. Please use a different name.`)}function th(e,t){if(y.log.debug(`Adding the following custom handlebars helper: ${e}`),!Ge()){y.log.error("Handlebars helpers can only be added before SalesforceInteractions.init is called.");return}try{eh(e,t),at.registerHelper(e,(...n)=>{y.log.debug(`Custom handlebars helper ${e} called with following parameters:`,n);const r=t(...n);return y.log.debug(`Custom handlebars helper ${e} returned:`,r),r})}catch(n){y.log.error(`Custom handlebars helper ${e} could not be added due to: ${K(n).message}`)}}function nh(e,t){return wi(e,n=>{for(const r of n)r instanceof HTMLStyleElement&&(y.log.debug("Adding nonce to inline style",r),r.nonce=t)})}function rh(e,t,n,r){return wi(t,i=>{for(let o=0;o{if(!i&&!(t&&o==="root")){const s=parseInt(o);!isNaN(s)&&H(e)?(e=e[s],r=!0):o in e?(e=e[o],r=!0):(i=!0,r=!1,e=void 0)}}),[e,r]}function ah(e){let t;return T(e,!0)?t=e:D(e)?(y.log.debug("Null/undefined substitution value provided to handlebars"),t=""):(y.log.debug("Coercing ${} substitution value provided to handlebars"),t=String(e)),t}function sh(e,t,n,r){const i=ah(t);try{let o;return n===Re.Static?o=uh(i):o=lh(e,i,r),y.log.trace("Handlebars helper subVar returned:",o),o}catch(o){y.log.warn(`Could not parse the substitution value path ${i} due to an error`,o)}return null}function lh(e,t,n){const r=at.parseWithoutProcessing(`{{${t}}}`);if((r==null?void 0:r.body)===void 0||r.body.length===0||r.body[0].type!=="MustacheStatement")return y.log.warn(`Could not parse the substitution value path ${t} via handlebars`),null;const i=r.body[0];if(i.path===void 0)return y.log.warn(`Could not parse the substitution value path ${t} via handlebars treating it as a Mustache Statement`),null;const o=i.path;if(o.type!=="PathExpression")return y.log.warn(`Could not parse the substitution value path ${t} via handlebars expecting it to be a Path Expression`),null;const s=o,[l,a]=ih(e,t,s,n),[u,f]=oh(l,a,s);return f?u:null}function uh(e){const t=at.parseWithoutProcessing(`${e}`);return(t==null?void 0:t.body)===void 0||t.body.length===0||t.body[0].type!=="ContentStatement"?(y.log.warn(`Could not parse the substitution value ${e} via handlebars`),null):e}function ch(e,t){var n,r,i;if(y.log.trace("Handlebars helper subVar called with following parameters:",e),!T(e)||((r=(n=t==null?void 0:t.data)==null?void 0:n._sf_personalization)==null?void 0:r.subVar)===void 0||!(e in t.data._sf_personalization.subVar))return null;const o=t.data._sf_personalization.subVar[e],s=(i=t.data._sf_personalization.subConfigTypes[e])!=null?i:Re.SchemaPath;return sh(this,o,s,t)}function fh(e,t,n){let r=n;if(e._sf_personalization.ecSupportsAutoInjection&&e._sf_personalization.transformerSupportsAutoInjection){const i=e._sf_personalization.transformerInstance.buildModifiersIfItemRelated(t,e._sf_personalization.destinationName,e._sf_personalization.engagementConfig);!D(i)&&T(n)&&(r=wi(n,o=>{for(let s=0,l=o.length;s{s!==void 0&&(s.key=a,s.index=f,s.first=f===0,s.last=!!p);const c=n(u,{data:s,blockParams:[e[a],a]}),h=fh(s,u,c);o=o+h};if(!D(e)&&typeof e=="object"){const a=e;if(H(e,!0))for(let u=e.length;i{u!==void 0&&l(u,a[u],i-1,!1),u=f,i++}),u!==void 0&&l(u,a[u],i-1,!0)}}return i===0&&(o=r(this)),y.log.trace("Handlebars helper each returned:",o),o}class ph extends cn{validateTransformerDetails(t){if(!this.isHandlebarsTransformerDetails(t))throw new V(G.InvalidTransformerTypeDetails,"Transformer Type Details is not the correct type.",{context:{expectedType:"HandlebarsTransformerDetails"}});this.validateHandlebarsTransformerDetails(t)}isHandlebarsTransformerDetails(t){return(t==null?void 0:t.html)!==void 0}validateHandlebarsTransformerDetails(t){if(!O(t))throw new V(G.InvalidTransformerTypeDetailsType,"Transformer Type Details is not a valid object.");if(!T(t.html))throw new V(G.MissingTransformerTypeDetailsHtml,"Transformer Type Details html is required for the specific Transformer Type Details.",{context:{type:"HandlebarsTransformerDetails"}});if(t.css!==void 0&&!T(t.css))throw new V(G.MissingTransformerTypeDetailsCss,"Transformer Type Details css must be a string when defined for the specific Transformer Type Details.",{context:{type:"HandlebarsTransformerDetails"}})}validateMethod(t){if(t===void 0)throw new M(R.MissingTransformationConfigMethod,"Transformation Config method is required for specific transformer type.",{context:{transformerType:pe.Handlebars}})}setCSS(t){if(this.isHandlebarsTransformerDetails(t.transformerTypeDetails)){const n=t.transformerTypeDetails.css;if(T(n))try{const r=document.createElement("style");r.textContent=n;const i=Bt();T(i)&&(y.log.debug("Adding nonce to inline style",r),r.nonce=i),document.head.appendChild(r)}catch(r){y.log.error(`could not apply styles ${n} for "${t.name}"`,r)}}}transform(t,n,r,i,o){const s=()=>this.getContent(t,n,i,o);return this.setCSS(t),this.setContent(r,s,n,t.transformerType,o,i==null?void 0:i.personalizationId,o.pec.transformationConfig.method)}getHandlebarsTemplate(t){return t.transformerTypeDetails.html}transformerSupportsAutoInjection(t){var n;return!((n=t.transformerTypeDetails.disableAutoInjectionOfEngagementAttributes)!=null&&n)}}class gh extends cn{validateTransformerDetails(t){if(!this.isAgentTransformerDetails(t))throw new V(G.InvalidTransformerTypeDetails,"Transformer Type Details is not the correct type.",{context:{expectedType:"AgentScriptTransformerDetails"}});this.validateAgentTransformerDetails(t)}isAgentTransformerDetails(t){return(t==null?void 0:t.script)!==void 0}validateAgentTransformerDetails(t){if(!O(t))throw new V(G.InvalidTransformerTypeDetailsType,"Transformer Type Details is not a valid object.");if(!T(t.script))throw new V(G.MissingTransformerTypeDetailsHtml,"Transformer Type Details script is required for the specific Transformer Type Details.",{context:{expectedType:"AgentScriptTransformerDetails"}})}validateMethod(t){if(t!==void 0)throw new M(R.InvalidTransformationConfigMethod,"Transformation Config method is not allowed for specific transformer type.",{context:{transformerType:pe.AgentScript}})}transform(t,n,r,i,o){const s=()=>this.getContent(t,n,i,o);return this.setContent(r,s,n,t.transformerType,o,i==null?void 0:i.personalizationId,o.pec.transformationConfig.method)}getHandlebarsTemplate(t){return t.transformerTypeDetails.script}transformerSupportsAutoInjection(){return!1}supportsEngagementSelection(){return!1}}function Ka(e){switch(e){case pe.HtmlElementModifier:return new $c;case pe.Handlebars:return new ph;case pe.AgentScript:return new gh;default:return}}function Si(e){const t=Ka(e);if(t===void 0)throw new V(G.MissingImplementation,"Transformer does not have an implementation",{context:{transformerType:e}});return t}var mh={name:"HTMLElementModifier",transformerType:pe.HtmlElementModifier,transformerCategory:nt.EmbeddedContent,transformerTypeDetails:{}};let Ke=Object.assign([],[mh]);function jn(){return Ke!=null?Ke:[]}function Xa(e,t=!1){function n(r){if(Ge()){if(!H(r,!0)){y.log.error("A list of transformers is required when adding to Transformers.");return}Ke===void 0&&(Ke=[]);let i=r;if(t){const o=Ke.map(s=>s.name);i=[],r.forEach(s=>{!T(s.name)||!o.includes(s.name)?i.push(s):y.log.debug(`Not adding Transformer "${s.name}" because it already exists`)})}i.forEach(o=>{try{if(Th(o),Ke.find(s=>o.name===s.name)!==void 0)throw new V(G.DuplicateTransformer,"Transformer already exists.",{context:{transformerName:o.name}});y.log.info("Adding the following Transformer: ",o),Ke.push(o)}catch(s){y.log.error(`Transformers could not be added due to: ${K(s).message}`,o)}})}else y.log.error("The list of Transformers can only be modified before SalesforceInteractions.init is called.")}if(T(e))try{const r=JSON.parse(e,Ki);n(r)}catch(r){y.log.error("JSON Transformers list could not be added due to: ",r)}else n(e)}function Qa(e){Xa(e)}function vh(e){Xa(e,!0)}function Ja(e=Re.SchemaPath){switch(e){case Re.SchemaPath:case Re.Static:return _n.String;default:throw new V(G.InvalidSubstitutionConfigType,"Substitution Definition config type is not supported.",{context:{configType:e}})}}function Eh(e,t=nt.EmbeddedContent){if(!Fl[t].supportedTypes.includes(e))throw new V(G.InvalidTransformerTypeForCategory,"Transformer Type is not allowed for Transformer Category.",{context:{category:t,type:e}})}function es(e=_n.String,t){switch(e){case _n.String:if(!T(t))throw new V(G.InvalidSubstitutionDefinitionValue,"Substitution Definition value is incorrect type.",{context:{expectedType:e,value:t}});break;default:throw new V(G.InvalidSubstitutionDefinitionConfigDataType,"",{context:{configDataType:e}})}}function yh(e){var t;if(!O(e))throw new V(G.MissingTransformerSubstitutionDefinition,"Transformer substitution definition object is required.");if(e.label!==void 0&&!T(e.label))throw new V(G.InvalidSubstitutionDefinitionLabel,"Transformer substitution definition label is required to be a string if provided.");if(e.description!==void 0&&!T(e.description))throw new V(G.InvalidSubstitutionDefinitionDescription,"Transformer substitution definition description is required to be a string if provided.");if(e.configType!==void 0&&!((t=Object.values(Re))!=null&&t.includes(e.configType)))throw new V(G.InvalidSubstitutionDefinitionConfigType,"Transformer substitution definition config type should be a valid Substitution Definition Config Type if provided.",{context:{configType:e.configType}});e.defaultValue!==void 0&&es(Ja(e.configType),e.defaultValue)}function _h(e){if(!O(e))throw new V(G.InvalidSubstitutionDefinitions,"Transformer substitution definitions is not a record.");Object.entries(e).forEach(([t,n])=>{if(!T(t))throw new V(G.MissingTransformerSubstitutionDefinitionKey,"Transformer substitution definition key is required.");yh(n)})}function Th(e){var t,n;if(!O(e))throw new V(G.MissingTransformer,"Transformer is required.");if(!T(e.name))throw new V(G.MissingTransformerName,"Transformer name is required.");if(e.label!==void 0&&!T(e.label))throw new V(G.InvalidTransformerLabel,"Transformer label is required to be a string if provided.");if(e.description!==void 0&&!T(e.description))throw new V(G.InvalidTransformerDescription,"Transformer description is required to be a string if provided.");if(e.schemaReference!==void 0&&!T(e.schemaReference))throw new V(G.InvalidTransformerSchemaReference,"Transformer schema reference is required to be a string if provided.");if(!((t=Object.values(pe))!=null&&t.includes(e.transformerType)))throw new V(G.InvalidTransformerType,"Transformer type is not a valid Transformer Type.",{context:{transformerType:e.transformerType}});if(e.transformerCategory!==void 0&&!((n=Object.values(nt))!=null&&n.includes(e.transformerCategory)))throw new V(G.InvalidTransformerCategory,"Transformer category is not a valid Transformer Category.",{context:{transformerCategory:e.transformerCategory}});if(Eh(e.transformerType,e.transformerCategory),e.substitutionDefinitions!==void 0&&_h(e.substitutionDefinitions),!O(e.transformerTypeDetails))throw new V(G.MissingTransformerTypeDetails,"Transformer transformer type details are required.");if(e.publishedDate!==void 0)try{e.publishedDate=Ht("publishedDate",e.publishedDate)}catch(r){throw new V(G.InvalidPublishedDate,"Transformer published date should be a number or date if provided.")}if(e.lastModifiedDate!==void 0)try{e.lastModifiedDate=Ht("lastModifiedDate",e.lastModifiedDate)}catch(r){throw new V(G.InvalidLastModifiedDate,"Transformer last modified date should be a number or date if provided.")}Si(e.transformerType).validateTransformerDetails(e.transformerTypeDetails)}function ts(e){return H(Ke)?Ke.filter(t=>{var n;return((n=t.transformerCategory)!=null?n:nt.EmbeddedContent)===e}):[]}function bh(e){return Si(e.transformerType).supportsEngagementSelection()}const ns=/\*\s*\*/;function wh(e){var t;if(!O(e))throw new M(R.InvalidSourceMatchers,"Source Matchers is not a valid array.");if(!((t=Object.values(Te))!=null&&t.includes(e.type)))throw new M(R.InvalidSourceMatcherType,"Source Matcher type is not a valid Source Matcher Type.",{context:{sourceMatcherType:e.type}});if(!T(e.value))throw new M(R.MissingSourceMatcherValue,"Source Matcher value is required.");if(e.value!==e.value.trim())throw new M(R.PaddedSourceMatcherValue,"Source Matcher value has leading or trailing spaces.",{context:{sourceMatcherValue:e.value}});if(e.type===Te.PageUrlMatcher){if(e.value==="*")throw new M(R.InvalidSourceMatcherValueOnlyStar,"Source Matcher value cannot be only * char.");if(e.value.includes("**"))throw new M(R.InvalidSourceMatcherValueRepeatedStars,"Source Matcher value cannot have repeated * chars.");if(ns.lastIndex=0,ns.test(e.value))throw new M(R.InvalidSourceMatcherValueSpaceWithStars,"Source Matcher value cannot have * followed by a space followed by a *.")}}function Sh(e){if(!H(e))throw new M(R.MissingSourceMatchers,"Source Matchers are required.");e.forEach(t=>wh(t))}function rs(e,t,n){switch(e.type){case Te.PageType:return Ph(e,t);case Te.PageUrlMatcher:return Ch(e,n);default:return y.log.warn(`Support missing for SourceMatcherType: ${e.type}`),!1}}function Ih(e){if(e.type!==Te.PageUrlMatcher){y.log.warn("Ignoring SourceMatcher, since type is not PageUrlMatcher");return}let t=encodeURIComponent(e.value.trim());return t=t.replace(/[.()!']/g,"\\$&"),t=t.replace(/\*/g,".*"),new RegExp(t,"i")}function Ah(e){if(T(e))return encodeURIComponent(e)}function Ch(e,t){const n=Ah(t);if(!T(n))return y.log.debug("Ignoring match, url is not a non-empty string"),!1;const r=Ih(e);return D(r)?!1:r.test(n)}function Ph(e,t){return T(t)?t===e.value.trim():(y.log.debug("Ignoring match, pageType is not a non-empty string"),!1)}var Oh=Object.defineProperty,Nh=Object.defineProperties,Dh=Object.getOwnPropertyDescriptors,is=Object.getOwnPropertySymbols,Mh=Object.prototype.hasOwnProperty,Rh=Object.prototype.propertyIsEnumerable,os=(e,t,n)=>t in e?Oh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,as=(e,t)=>{for(var n in t||(t={}))Mh.call(t,n)&&os(e,n,t[n]);if(is)for(var n of is(t))Rh.call(t,n)&&os(e,n,t[n]);return e},ss=(e,t)=>Nh(e,Dh(t)),Ii=(e=>(e.DataCloudModuleConfig="DATA_CLOUD_MODULE_CONFIG",e.Other="OTHER",e))(Ii||{});let fn=[];const Wn={DATA_CLOUD_MODULE_CONFIG:null,OTHER:[]};function Ie(){return fn!=null?fn:[]}function Lh(e){fn=[...e]}function xh(e,t){const n=H(t,!0)?t:Ie();if(!(!H(n)||!T(e)))return n.find(r=>ar(r.name,e))}function ls(e,t){return T(e)?(H(t,!0)?t:Ie()).filter(n=>n.sourceMatchers.some(r=>r.type===Te.PageUrlMatcher&&rs(r,"",e))):[]}function us(e,t){return T(e)?(H(t,!0)?t:Ie()).filter(n=>n.sourceMatchers.some(r=>r.type===Te.PageType&&rs(r,e,""))):[]}function kh(e,t){return Object.values(Te).includes(e)?(H(t,!0)?t:Ie()).filter(n=>n.sourceMatchers.some(r=>r.type===e)):[]}function Uh(e){var t,n,r,i;if(!O(e))throw new M(R.MissingDataProvider,"DataProvider is required.");if(e.type!==void 0&&!((t=Object.values(Tn))!=null&&t.includes(e.type)))throw new M(R.InvalidDataProviderType,"Data Provider type should be a valid Data Provider Type if provided.",{context:{type:e.type}});if(e.referenceType!==void 0&&!((n=Object.values(bn))!=null&&n.includes(e.referenceType)))throw new M(R.InvalidDataProviderReferenceType,"Data Provider reference type should be a valid Reference Type if provided.",{context:{referenceType:e.referenceType}});if(!T(e.value))throw new M(R.MissingDataProviderValue,"Data Provider value is required.");if(e.dataSpaceReferenceType!==void 0&&!((r=Object.values(bn))!=null&&r.includes(e.dataSpaceReferenceType)))throw new M(R.InvalidDataProviderDataSpaceReferenceType,"Data Provider data space reference type should be a valid Reference Type if provided.",{context:{referenceType:e.dataSpaceReferenceType}});if(!T(e.dataSpaceValue)&&e.dataSpaceReferenceType!==void 0)throw new M(R.MissingDataSpaceValue,"Data Provider data space value is required if Data Provider data space reference type is set.");if(e.groupByType!==void 0&&!Object.values(oo).includes(e.groupByType))throw new M(R.InvalidDataProviderGroupByType,"Data Provider group by type should be a valid Data Provider Group By Type if provided.",{context:{groupByType:e.groupByType}});if(e.groupByReferenceType!==void 0&&!((i=Object.values(bn))!=null&&i.includes(e.groupByReferenceType)))throw new M(R.InvalidDataProviderGroupByReferenceType,"Data Provider group by reference type should be a valid Reference Type if provided.",{context:{referenceType:e.groupByReferenceType}});if(!T(e.groupByValue)&&(e.groupByType!==void 0||e.groupByReferenceType!==void 0))throw new M(R.MissingDataGroupByValue,"Data Provider group by value is required if Data Provider group by type or reference type is set.")}function Hh(e){if(J(e,"name"))throw new M(R.TransformationNameNotSupported,"Transformation Name is not supported for method type.",{context:{methodType:$.AddOverlay}});if(J(e,"tag"))throw new M(R.TransformationTagNotSupported,"Transformation Tag is not supported for method type.",{context:{methodType:$.AddOverlay}});if(J(e,"path"))throw new M(R.TransformationPathNotSupported,"Transformation Path is not supported for method type.",{context:{methodType:$.AddOverlay}})}function Fh(e){if(!T(e.name))throw new M(R.MissingTransformationName,"Transformation Name is required.",{context:{transformationType:"ContentZone"}})}function zh(e){if(!T(e.tag))throw new M(R.MissingTransformationTag,"Transformation Tag is required.",{context:{transformationType:"Element"}});if(!T(e.path))throw new M(R.MissingTransformationPath,"Transformation Path is required.",{context:{transformationType:"Element"}})}function Vh(e){return Object.keys(e).some(t=>!["transformerName","substitutionValues"].includes(t))}function Bh(e){return Gh(e,jn())}function Gh(e,t){if(!T(e))throw new M(R.MissingTransformerName,"Transformer Name is required.");if(t.length===0)throw new M(R.TransformersNotAvailable,"There are no transformers available.");const n=t.find(r=>r.name===e);if(n===void 0)throw new M(R.InvalidTransformerName,"Transformation Transformer Name is not a valid transformer.",{context:{transformerName:e}});return n}function cs(e,t,n){Object.entries(t).forEach(([r,i])=>{var o;if(r in e)y.log.debug(`using substitution value for Substitution Definition of ${r} for Transformer ${n}`);else{if(i.defaultValue===void 0&&((o=i.required)==null||o))throw new M(R.MissingSubstitutionDefinitionDefaultValue,"Substitution Definition value is required and there is no default value specified.",{context:{key:r}});y.log.debug(`using default value for Substitution Definition of ${r} for Transformer ${n}`)}})}function jh(e,t,n){var r;if(!((r=t.overrideable)!=null&&r)&&n!==void 0)throw new M(R.InvalidTransformationSubstitutionValue,"Substitution Value is not allowed when Substitution Definition is not overridable.",{context:{key:e}})}function Wh(e,t){if(e.substitutionDefinitions!==void 0&&Object.values(e.substitutionDefinitions).find(n=>{var r;return((r=n.configType)!=null?r:Re.SchemaPath)===Re.SchemaPath})!==void 0&&(!O(t)||!Sn(t==null?void 0:t.type)))throw new M(R.InvalidTransformationSubstitutionValueType,"Personalization Point Data Provider is required when using Schema Path Substitution Definitions")}function qh(e,t,n){var r;if(Wh(t,n),e===void 0){t.substitutionDefinitions!==void 0&&cs({},t.substitutionDefinitions,t.name);return}if(!O(e))throw new M(R.InvalidTransformationSubstitutionValues,"Substitution Values is not a valid object.");if(t.substitutionDefinitions!==void 0){const i=(r=t.substitutionDefinitions)!=null?r:{};Object.entries(e).forEach(([o,s])=>{if(o in i){const l=i[o];jh(o,l,s),es(Ja(l.configType),s)}else throw new M(R.SubstitutionDefinitionKeyNotSupported,"Transformer does not support Substitution Definition Key.",{context:{key:o}})}),cs(e,t.substitutionDefinitions,t.name)}else if(t.transformerType!==pe.HtmlElementModifier)if(Object.entries(e).length===0)y.log.warn(`transformer "${t.name}" does not accept substitutionValues`);else throw new M(R.TransformerDoesNotSupportSubstitutionValues,"Substitution Values are provided when transformer does not support Substitution Definitions.")}function fs(e,t,n){var r;const i=Bh(e.transformerName);if(!((r=i.isEnabled)==null||r))throw new M(R.DisabledTransformer,"Transformer is disabled.",{context:{transformer:i.name}});qh(e.substitutionValues,i,n);const o=Si(i.transformerType);o.validateMethod(t),o.validateSubstitutionValues(e.substitutionValues)}function $h(e,t,n){if(!O(e))throw new M(R.MissingTransformation,"Transformation is required.");if(!T(e.transformerName))throw new M(R.MissingTransformerName,"Transformer Name is required.");if(e.substitutionValues!==void 0&&!O(e.substitutionValues))throw new M(R.InvalidTransformationSubstitutionValues,"Substitution Values is not a valid object.");if(_t(t))Hh(e);else if(Vh(e))if(Gt(e))Fh(e);else if(rt(e))zh(e);else throw new M(R.InvalidTransformationType,"Transformation is not one of the supported types.");Ge()||fs(e,t,n)}function Yh(e,t,n){if(!H(e))throw new M(R.InvalidTransformations,"Transformations is required to be an array.");if(e.forEach(r=>$h(r,t,n)),t!==void 0&&t!==$.AddOverlay){if(t===$.ReplaceContentZoneContent&&!e.every(r=>wn(r,t)))throw new M(R.MethodRequiresSpecificTransformations,"Method requires specific transformation type(s).",{context:{transformationType:"ContentZone",methods:[$.ReplaceContentZoneContent]}});if(t===$.ContentZoneHandler&&!e.every(r=>hr(r,t)))throw new M(R.MethodRequiresSpecificTransformations,"Method requires specific transformation type(s).",{context:{transformationType:"ContentZone",methods:[$.ContentZoneHandler]}});if(t!==$.ReplaceContentZoneContent&&t!==$.ContentZoneHandler&&!e.every(r=>rt(r)))throw new M(R.MethodRequiresSpecificTransformations,"Method requires specific transformation type(s).",{context:{transformationType:"Element",methods:[$.ReplaceElementContent,$.AddAfterElement,$.AddBeforeElement]}})}}function Zh(e,t){var n,r;if(!O(e))throw new M(R.MissingTransformationConfig,"Transformation Config is required.");if(e.renderIfEmpty!==void 0&&!et(e.renderIfEmpty))throw new M(R.InvalidRenderIfEmpty,"Transformation Config Render If Empty should be a boolean if provided.");if(!((n=Object.values(Ce))!=null&&n.includes(e.when)))throw new M(R.InvalidTransformationConfigWhen,"Transformation Config has an invalid Transformation Config When Type.",{context:{whenType:e.when}});if(e.method!==void 0&&!((r=Object.values($))!=null&&r.includes(e.method)))throw new M(R.InvalidTransformationConfigMethod,"Transformation Config has an invalid Target Method Type.",{context:{methodType:e.method}});switch(e.when){case Ce.Immediately:if(e.whenValues!==void 0)throw new M(R.WhenValuesNotSupported,"Transformation Config does not support when values for the specific Transformation Config When Type.",{context:{whenType:e.when}});break;case Ce.ExitIntent:if(!_t(e.method))throw new M(R.WhenTypeRequiresSpecificMethodType,"Transformation Config when type requires specific method type.",{context:{whenType:e.when,methodType:$.AddOverlay}});if(!uo(e.whenValues))throw new M(R.InvalidTransformationConfigWhenTypes,"Transformation Config when values is invalid for the specific Transformation Config When Type.",{context:{whenType:e.when}});if(!Ut(e.whenValues.delay)||e.whenValues.delay<0)throw new M(R.InvalidWhenValueDelay,"Transformation Config requires a numeric when values delay of 0 or greater for the specific Transformation Config When Type.",{context:{whenType:e.when}});break;case Ce.ElementClick:if(!_t(e.method))throw new M(R.WhenTypeRequiresSpecificMethodType,"Transformation Config when type requires specific method type.",{context:{whenType:e.when,methodType:$.AddOverlay}});if(!so(e.whenValues))throw new M(R.InvalidTransformationConfigWhenTypes,"Transformation Config when values is invalid for the specific Transformation Config When Type.",{context:{whenType:e.when}});if(!T(e.whenValues.path))throw new M(R.InvalidWhenValuePath,"Transformation Config requires a string when values path for the specific Transformation Config When Type.",{context:{whenType:e.when}});if(e.whenValues.tag!==void 0&&!T(e.whenValues.tag))throw new M(R.InvalidWhenValueTag,"Transformation Config requires a string when values tag, if provided, for the specific Transformation Config When Type.",{context:{whenType:e.when}});break;case Ce.ScrollPercent:if(!_t(e.method))throw new M(R.WhenTypeRequiresSpecificMethodType,"Transformation Config when type requires specific method type.",{context:{whenType:e.when,methodType:$.AddOverlay}});if(!lo(e.whenValues))throw new M(R.InvalidTransformationConfigWhenTypes,"Transformation Config when values is invalid for the specific Transformation Config When Type.",{context:{whenType:e.when}});if(!Ut(e.whenValues.percent)||e.whenValues.percent<0||e.whenValues.percent>1)throw new M(R.InvalidWhenValuePercent,"Transformation Config requires a numeric when values percent between 0 and 1 for the specific Transformation Config When Type.",{context:{whenType:e.when}});break;default:throw new M(R.WhenValuesValidationLogicNotImplemented,"Transformation Config when values validation logic has not been implemented for the specific Transformation Config When Type.",{context:{whenType:e.when}})}if(e.engagementDestination!==void 0&&!T(e.engagementDestination))throw new M(R.InvalidTransformationConfigEngagementDestination,"Transformation Config engagement destination should be a valid string if provided.");Yh(e.transformations,e.method,t)}function Ai(e,t,n,r){if(!O(e))throw new M(R.MissingConfig,"Config is required.");if(!T(e.name))throw new M(R.MissingName,"Name is required.");if(e.label!==void 0&&!T(e.label))throw new M(R.InvalidLabel,"Label is required to be a string if provided.");if(e.description!==void 0&&!T(e.description))throw new M(R.InvalidDescription,"Description is required to be a string if provided.");if(e.dataProvider!==void 0&&Uh(e.dataProvider),Sh(e.sourceMatchers),Zh(e.transformationConfig,e.dataProvider),e.publishedDate!==void 0&&!mn(e.publishedDate))try{e.publishedDate=Ht("publishedDate",e.publishedDate)}catch(i){throw new M(R.InvalidPublishedDate,"Published date should be a number or date if provided.")}if(e.lastModifiedDate!==void 0&&!mn(e.lastModifiedDate))try{e.lastModifiedDate=Ht("lastModifiedDate",e.lastModifiedDate)}catch(i){throw new M(R.InvalidLastModifiedDate,"Last modified date should be a number or date if provided.")}if(t!=null&&t&&n!==void 0){const i=[];if(hs(e,n,[],i),i.length>0)throw i[0]}if(r!=null&&r){const i=[];if(ps(e,[],i),i.length>0)throw i[0]}}function Ci(e){var t,n,r,i;if(((t=e==null?void 0:e.dataProvider)==null?void 0:t.type)!==void 0&&((n=e==null?void 0:e.dataProvider)==null?void 0:n.type)!==Tn.PersonalizationPoint)throw new En(ur.OnlySupportPersonalizationPoint,"Personalization Experience Config has Data Provider Type that is not Personalization Point, which is not currently supported.",{context:{configName:e.name}});!Ge()&&(((r=e==null?void 0:e.dataProvider)==null?void 0:r.type)===Tn.PersonalizationPoint||T((i=e==null?void 0:e.dataProvider)==null?void 0:i.dataSpaceValue))&&ds(e)}function ds(e){var t,n,r;const i=D((t=e==null?void 0:e.dataProvider)==null?void 0:t.dataSpaceValue)?"":(n=e==null?void 0:e.dataProvider)==null?void 0:n.dataSpaceValue;if(Vt()!==i)throw new En(ur.OnlySupportConfiguredDataSpace,"Personalization Experience Config has Data Provider Data Space Value that does not match Sitemap value, which is not currently supported.",{context:{configName:e.name,configDataSpace:(r=e==null?void 0:e.dataProvider)==null?void 0:r.dataSpaceValue,configuredDataSpace:Vt()}})}function Pi(e,t="OTHER"){function n(r){if(Ge()){if(!H(r,!0)){y.log.error("A list of personalization experience configs is required.");return}t==="OTHER"&&Wn.OTHER.push(...r);const i=[];r.forEach(o=>{!T(o.name)||fn.findIndex(s=>ar(s.name,o.name))<0&&i.findIndex(s=>ar(s.name,o.name))<0?i.push(o):y.log.error(`Not adding Personalization Experience Config "${o.name}" because it already exists`)}),i.forEach(o=>{try{Ai(o),Ci(o),y.log.info("Adding the following Personalization Experience Config: ",o),fn.push(o)}catch(s){y.log.error(`Personalization Experience Configs could not be added due to: ${K(s).message}`,o)}})}else y.log.error("The list of Personalization Experience Configs can only be modified before SalesforceInteractions.init is called.")}if(T(e))try{const r=JSON.parse(e,Ki);n(r)}catch(r){y.log.error(`JSON Personalization Experience Config list could not be initialized due to: ${K(r).message}`,r)}else n(e)}function Kh(e){Pi(e)}function Xh(){document.addEventListener(y.CustomEvents.OnInit,()=>{op(),np(),sp()}),document.addEventListener(y.CustomEvents.OnInitSitemap,e=>{ep(e.detail.sitemapConfig)})}function Qh(e){if(!H(e))return y.log.debug("Ignoring non/empty array of personalizationExperienceConfigs"),{};const t={};return e.forEach(n=>{var r,i,o;if(!Sn((r=n.dataProvider)==null?void 0:r.type))y.log.warn(`Ignoring config: ${n.name} with unsupported dataProvider.type: ${String((i=n.dataProvider)==null?void 0:i.type)}`);else{const s=(o=n.dataProvider.groupByValue)!=null?o:zl;let l=t[s];D(l)&&(l={},t[s]=l);const a=n.dataProvider.value;let u=l[a];D(u)&&(u={point:{name:a},pecNames:[]},l[a]=u),u.pecNames.includes(n.name)||u.pecNames.push(n.name)}}),t}function qn(e){const t=e.filter(n=>T(n.getConfigName()));if(t.length>0){t.forEach(r=>{const i=r.getConfigName(),o=Ie().find(s=>s.name===i);o===void 0?y.log.error(`Could not find Personalization Experience Config with name ${i}`):y.log.error(`Personalization Experience Config with name ${i} is invalid due to: ${r.getMessageWithContext()} Config: `,o)});const n=t.map(r=>r.getConfigName());Lh(Ie().filter(r=>!n.includes(r.name)))}}function hs(e,t,n,r){e.transformationConfig.transformations.forEach(i=>{wn(i,e.transformationConfig.method)&&(n.length===0&&hc(t).forEach(o=>n.push(o)),n.length===0?r.push(new M(R.ContentZonesNotAvailable,"There are no content zones configured in the sitemap or content zone is defined more than once.",{context:{configName:e.name}})):n.find(o=>o===i.name)===void 0&&r.push(new M(R.InvalidTransformationContentZone,"Content zone is not defined in the sitemap or content zone is defined more than once.",{context:{configName:e.name,contentZone:i.name}})))})}function Jh(e){const t=[],n=[];return Ie().forEach(r=>{hs(r,e,t,n)}),n}function ep(e){const t=Jh(e);qn(t)}function ps(e,t,n){T(e.transformationConfig.engagementDestination)&&(t.length===0&&sa().forEach(r=>t.push(r)),t.length===0?n.push(new M(R.EngagementDestinationsNotAvailable,"There are no engagement destinations configured.",{context:{configName:e.name}})):t.find(r=>r===e.transformationConfig.engagementDestination)===void 0&&n.push(new M(R.InvalidTransformationConfigEngagementDestinationName,"Engagement destination is not defined.",{context:{configName:e.name,engagementDestination:e.transformationConfig.engagementDestination}})))}function tp(){const e=[],t=[];return Ie().forEach(n=>{ps(n,e,t)}),t}function np(){const e=tp();qn(e)}function gs(){return Wn}function rp(e,t){e==="DATA_CLOUD_MODULE_CONFIG"&&"list"in t&&H(t.list,!0)?Wn.DATA_CLOUD_MODULE_CONFIG=t:e==="OTHER"&&H(t,!0)&&(Wn.OTHER=t)}function ip(){const e=[];return Ie().forEach(t=>{var n;try{const r=t.transformationConfig.method;t.transformationConfig.transformations.forEach(i=>{fs(i,r,t.dataProvider)})}catch(r){if(r instanceof Error)if(r instanceof M||r instanceof V){const i={context:ss(as({},r.context),{configName:t.name}),cause:(n=r.cause)!=null?n:r},o=r instanceof M?new M(r.name,r.message,i):new V(r.name,r.message,i);e.push(o)}else e.push(new M(R.UnexpectedError,r.message,{context:{configName:t.name}}))}}),e}function op(){const e=ip();qn(e)}function ap(){const e=[];return Ie().forEach(t=>{var n;try{ds(t)}catch(r){if(r instanceof Error)if(r instanceof En){const i=new En(r.name,r.message,{context:ss(as({},r.context),{configName:t.name}),cause:(n=r.cause)!=null?n:r});e.push(i)}else e.push(new M(R.UnexpectedError,r.message,{context:{configName:t.name}}))}}),e}function sp(){const e=ap();qn(e)}var z=(e=>(e.SingleElementHtmlTransformer="SingleElementHtmlTransformer",e.MultiElementModifier="MultiElementModifier",e.WhenElementClick="WhenElementClick",e.Agent="Agent",e))(z||{}),dn=(e=>(e.Prod="prod",e.Test="test",e.ProdSandbox="prod_sandbox",e.TestSandbox="test_sandbox",e))(dn||{});const lp={configOptions:{SingleElementHtmlTransformer:{allowedElements:{div:{},p:{},header:{},footer:{},section:{},article:{},nav:{},table:{}}},MultiElementModifier:{allowedElements:{h1:{allowedProperties:["innerText"]},h2:{allowedProperties:["innerText"]},h3:{allowedProperties:["innerText"]},h4:{allowedProperties:["innerText"]},h5:{allowedProperties:["innerText"]},h6:{allowedProperties:["innerText"]},p:{allowedProperties:["innerText"]},div:{allowedProperties:["innerText","style.backgroundImage"]},a:{allowedProperties:["innerText","attributes.href"]},img:{allowedProperties:["attributes.src"]}}},WhenElementClick:{allowedElements:{input:{},button:{},img:{}}}}};var ms=(e,t,n)=>new Promise((r,i)=>{var o=a=>{try{l(n.next(a))}catch(u){i(u)}},s=a=>{try{l(n.throw(a))}catch(u){i(u)}},l=a=>a.done?r(a.value):Promise.resolve(a.value).then(o,s);l((n=n.apply(e,t)).next())});const te={pageUrl:{},pageType:{}};function vs(){return ms(this,null,function*(){return D(te.pageUrl.matchedPromise)?yield Promise.reject(new Error("getPromiseUrlMatch called too soon")):yield te.pageUrl.matchedPromise})}function Es(){return ms(this,null,function*(){return D(te.pageType.matchedPromise)?yield Promise.reject(new Error("getPromisePageMatch called too soon")):yield te.pageType.matchedPromise})}const $n="sf_personalization_wpm";function up(){Ni(!1);const e=Il($n);window.history.replaceState({},document==null?void 0:document.title,e.toString()),window.location.reload()}function Oi(){try{return window.localStorage.getItem($n)==="true"}catch(e){return!1}}function Ni(e){try{window.localStorage.setItem($n,e?"true":"false")}catch(t){throw y.log.error("Error trying to save client side editor mode.",t),t}}const ys="sf_personalization_wpm_env",_s="2",cp=`https://cdn.c360a.salesforce.com/npm/@salesforce/interactions-website-personalization-manager/${_s}/build/dist/index.min.js`,fp=`https://cdn.pc-rnd.c360a.salesforce.com/npm/@salesforce/interactions-website-personalization-manager/${_s}/build/dist/index.min.js`,Ts={configOptions:{}};let Yn=lp;function bs(){return Yn!=null?Yn:Ts}function dp(e){e===void 0?Yn=Ts:Yn=e}function hp(){Yi($n)&&Ni(!0),document.addEventListener(y.CustomEvents.OnInit,Is)}function ws(){if(Yi(ys)){const e=wl(ys);if(e!==null){const t=e.toLowerCase();if(Object.values(dn).includes(t))return t}}return dn.Prod}function pp(){const e=ws(),t=e===dn.Test||e===dn.TestSandbox?fp:cp;return y.log.debug(`WPM (client side editor) CDN Script is set to ${t}`),t}function gp(e,t){return xn(e,t,Ue())}function mp(){const e=jn();if(e.length>0){const t=e.find(n=>n.transformerType===pe.HtmlElementModifier);if(t!==void 0)return xn(t.name,t.transformerType,Ue())}return xn("",pe.HtmlElementModifier,Ue())}function vp(){return ts(nt.EmbeddedContent)}function Ep(){return ts(nt.Agent)}function Ss(){var e;const t={closeEditorMode:up,determineEditorOption:Cs,getConfig:bs,getAppSourceId:xl,getPspConfig:kl,isInEditorMode:Oi,isPECSupported:Op,checkPECSupport:Os,getPromiseUrlMatch:vs,getPromisePageMatch:Es,findContentZoneNamesForPageConfig:fc,findContentZoneNamesForPageConfigs:dc,getEngagementDestinationNames:sa,determineHtmlElementModifierTransformerEngagementDestination:mp,determineTransformerEngagementDestination:gp,findPersonalizationExperienceConfigsMatchingPageType:us,findPersonalizationExperienceConfigsMatchingPageUrl:ls,getContentZoneSelectorByName:Wo,getPersonalizationExperienceConfigsByInitializationSource:gs,matchesDataCloudHostname:Np,determineWpmEnvironment:ws,getAllContentZoneHandlers:Ou,evaluateContextualAttributes:Pr,getAllEmbeddedContentTransformers:vp,isEngagementSelectionSupported:bh,getAllWebAgentTransformers:Ep};(e=window.SalesforceInteractions.Wpm)==null||e.initialize(t)}function Is(){var e;if(Oi())if(((e=window.SalesforceInteractions.Wpm)==null?void 0:e.initialize)!==void 0)Ss();else{const t=document.createElement("script");t.src=pp(),t.type="text/javascript",t.onload=Ss,t.onerror=n=>{y.log.error("Error trying to initialize WPM (client side editor)",n)},document.head.appendChild(t)}}function yp(){Ni(!0),Is()}function _p(e){if(!O(e))throw new ye(he.InvalidConfig,"Config is invalid.",{context:{configType:z.SingleElementHtmlTransformer}});if((e==null?void 0:e.allowedElements)!==void 0){const t=e==null?void 0:e.allowedElements;if(!O(t))throw new ye(he.InvalidAllowedElements,"Allowed Elements is invalid.",{context:{configType:z.SingleElementHtmlTransformer}});Object.entries(t).forEach(([n])=>{if(!O(t[n]))throw new ye(he.InvalidAllowedElementKey,"Allowed Elements key is invalid.",{context:{configType:z.SingleElementHtmlTransformer,key:n}})})}if((e==null?void 0:e.allowedTargetMethodTypes)!==void 0){if(!H(e==null?void 0:e.allowedTargetMethodTypes,!0))throw new ye(he.InvalidAllowedTargetMethodTypes,"Allowed Target Method Types is invalid.",{context:{configType:z.SingleElementHtmlTransformer}});e==null||e.allowedTargetMethodTypes.forEach(t=>{var n;if(!((n=Object.values($))!=null&&n.includes(t)))throw new ye(he.InvalidAllowedTargetMethodTypeMethod,"Allowed Target Method Types method is not a valid Target Method Type.",{context:{configType:z.SingleElementHtmlTransformer,method:t}})})}if((e==null?void 0:e.allowedTransformers)!==void 0&&!H(e==null?void 0:e.allowedTransformers,!0))throw new ye(he.InvalidAllowedTransformers,"Allowed Transformers is invalid.",{context:{configType:z.SingleElementHtmlTransformer}})}function Tp(e){if(!O(e))throw new ye(he.InvalidConfig,"Config is invalid.",{context:{configType:z.MultiElementModifier}});if((e==null?void 0:e.allowedElements)!==void 0){const t=e==null?void 0:e.allowedElements;if(!O(t))throw new ye(he.InvalidAllowedElements,"Allowed Elements is invalid.",{context:{configType:z.MultiElementModifier}});Object.entries(t).forEach(([n])=>{var r,i;if(!O(t[n]))throw new ye(he.InvalidAllowedElementKey,"Allowed Elements key is invalid.",{context:{configType:z.MultiElementModifier,key:n}});if(((r=t[n])==null?void 0:r.allowedProperties)!==void 0&&!H((i=t[n])==null?void 0:i.allowedProperties,!0))throw new ye(he.InvalidAllowedProperties,"Allowed Elements allowed properties is invalid.",{context:{configType:z.MultiElementModifier,key:n}})})}}function bp(e){if(!O(e))throw new ye(he.InvalidConfig,"Config is invalid.",{context:{configType:z.WhenElementClick}});if((e==null?void 0:e.allowedElements)!==void 0){const t=e==null?void 0:e.allowedElements;if(!O(t))throw new ye(he.InvalidAllowedElements,"Allowed Elements is invalid.",{context:{configType:z.WhenElementClick}});Object.entries(t).forEach(([n])=>{if(!O(t[n]))throw new ye(he.InvalidAllowedElementKey,"Allowed Elements key is invalid.",{context:{configType:z.WhenElementClick,key:n}})})}}function As(e){if(!O(e))throw new Et(st.WpmConfigIsRequired,"Wpm Config is required.");if(!O(e.configOptions))throw new ye(he.InvalidConfigOptions,"Config Options are required.");z.SingleElementHtmlTransformer in e.configOptions?_p(e.configOptions[z.SingleElementHtmlTransformer]):y.log.info("WPM Config does not contain any restrictions for SingleElementHtmlTransformer"),z.MultiElementModifier in e.configOptions?Tp(e.configOptions[z.MultiElementModifier]):y.log.info("WPM Config does not contain any restrictions for MultiElementModifier"),z.WhenElementClick in e.configOptions?bp(e.configOptions[z.WhenElementClick]):y.log.info("WPM Config does not contain any restrictions for WhenElementClick")}function Cs(e,t){var n;if(!O(e))throw new Et(st.ConfigIsRequired,"Config is required.");if(!H(t))throw new Et(st.TransformersAreRequired,"Transformers are required.");const r=t.filter(i=>i.transformerType===pe.HtmlElementModifier).map(i=>i.name);return r.length>0&&e.transformationConfig.transformations.length>0&&(e.transformationConfig.method===void 0||e.transformationConfig.method===$.ReplaceElementContent)&&e.transformationConfig.transformations.every(i=>r.includes(i.transformerName))?z.MultiElementModifier:((n=t==null?void 0:t[0])==null?void 0:n.transformerCategory)===nt.Agent?z.Agent:z.SingleElementHtmlTransformer}function Ps(e,t,n){if(e===void 0)return;const r=t.filter(i=>rt(i)).map(i=>i.tag).filter(i=>!Object.keys(e).includes(i.toLowerCase()));if(r.length>0)throw new Me(Ae.TagsNotAllowed,"Tags are not allowed.",{context:{configType:n,disallowedTags:JSON.stringify(r)}})}function wp(e,t,n){e!==void 0&&t.filter(r=>rt(r)).map(r=>r).forEach(r=>{const i=e[r.tag.toLowerCase()].allowedProperties;i!==void 0&&(r.substitutionValues!==void 0?Object.keys(r.substitutionValues):[]).forEach(o=>{if(!i.includes(o))throw new Me(Ae.PropertyNotAllowed,"Property is not allowed.",{context:{configType:n,property:`${r.tag}.${o}`}})})})}function Sp(e,t,n){if(e!==void 0&&t.method!==void 0&&!e.includes(t.method))throw new Me(Ae.MethodNotAllowed,"Method is not allowed.",{context:{configType:n,method:t.method}})}function Ip(e,t,n){if(e!==void 0)if(e.length===0){const r=t.map(i=>i.transformerName);throw new Me(Ae.TransformersAreDisabled,"Transformers are disabled.",{context:{configType:n,transformers:JSON.stringify(r)}})}else{const r=t.filter(i=>!e.includes(i.transformerName)).map(i=>i.transformerName);if(r.length>0)throw new Me(Ae.TransformersAreDisabled,"Transformers are disabled.",{context:{configType:n,transformers:JSON.stringify(r)}})}}function Ap(e,t){t!==void 0&&(Ps(t.allowedElements,e.transformationConfig.transformations,"SingleElementHtmlTransformer"),Sp(t.allowedTargetMethodTypes,e.transformationConfig,"SingleElementHtmlTransformer"),Ip(t.allowedTransformers,e.transformationConfig.transformations,"SingleElementHtmlTransformer"))}function Cp(e,t){t!==void 0&&(Ps(t.allowedElements,e.transformationConfig.transformations,"MultiElementModifier"),wp(t.allowedElements,e.transformationConfig.transformations,"MultiElementModifier"))}function Pp(e,t){var n,r;if(t!==void 0&&t.allowedElements!==void 0){const i=(r=(n=e.transformationConfig.whenValues)==null?void 0:n.tag)!=null?r:"";if(!Object.keys(t.allowedElements).includes(i))throw new Me(Ae.TagsNotAllowed,"Tags are not allowed.",{context:{configType:z.WhenElementClick,disallowedTags:i}})}}function Os(e,t,n){if(!O(e))throw new Et(st.ConfigIsRequired,"Config is required.");if(!O(t))throw new Et(st.WpmConfigIsRequired,"Wpm Config is required.");if(!H(n))throw new Et(st.TransformersAreRequired,"Transformers are required.");if(e.sourceMatchers.length>1)throw new Me(Ae.OneSourceMatcherSupported,"Only one source matcher is allowed.");switch(Cs(e,n)){case z.SingleElementHtmlTransformer:if(e.transformationConfig.transformations.length>1)throw new Me(Ae.OneTransformerSupported,"Only one transformation is allowed.",{context:{configType:z.SingleElementHtmlTransformer}});if(e.transformationConfig.method===void 0)throw new Me(Ae.MethodIsRequired,"Method is required.",{context:{configType:z.SingleElementHtmlTransformer}});z.SingleElementHtmlTransformer in t.configOptions&&Ap(e,t.configOptions[z.SingleElementHtmlTransformer]);break;case z.MultiElementModifier:if(e.transformationConfig.transformations.some(r=>Gt(r)))throw new Me(Ae.OnlyElementsSupported,"Can only target elements.",{context:{configType:z.MultiElementModifier}});z.MultiElementModifier in t.configOptions&&Cp(e,t.configOptions[z.MultiElementModifier]);break}z.WhenElementClick in t.configOptions&&e.transformationConfig.when===Ce.ElementClick&&Pp(e,t.configOptions[z.WhenElementClick])}function Op(e,t,n){try{return Os(e,t,n),!0}catch(r){return!1}}function Ns(e){function t(n){if(Ge()){if(!O(n,!1)){y.log.error("A config is required when setting WPM Config.");return}try{As(n),dp(n),y.log.info("Set WPMConfig to the following: ",n)}catch(r){y.log.error(`WPMConfig could not be set due to: ${K(r).message}`,r)}}else y.log.error("WPMConfig can only be set before SalesforceInteractions.init is called.")}if(T(e))try{const n=JSON.parse(e);t(n)}catch(n){y.log.error("JSON WPM Config list could not be initialized due to: ",n)}else t(e)}function Np(e){const t=dr();if(T(t)){const n=new URL(e),r=new URL(t);return n.hostname===r.hostname}return!0}var Ds=(e=>(e.Cart="cart",e.CartItem="cartItem",e.Catalog="catalog",e.Consent="consentLog",e.Order="order",e.OrderItem="orderItem",e))(Ds||{}),Ms=(e=>(e.Engagement="Engagement",e.Profile="Profile",e))(Ms||{}),Di=(e=>(e.Category="category",e.DateTime="dateTime",e.DeviceId="deviceId",e.EventId="eventId",e.EventType="eventType",e.SessionId="sessionId",e))(Di||{}),Rs=(e=>(e.OnBeforeEventSend="dataCloud:onBeforeEventSend",e))(Rs||{}),ht=(e=>(e.Id="personalizationId",e.ContentId="personalizationContentId",e))(ht||{});function Dp(){document.addEventListener(Rs.OnBeforeEventSend,e=>{const t=e.detail.actionEvent;if(!Mp(t))return;const n=t.personalization;if(O(n)){if((n==null?void 0:n.isTesting)===!0)Ls(e,xs,"Cancelling event since we are in test mode and all events are engagement events","Not sending engagement event since we are in test mode");else if((T(n.id)||T(n.contentId))&&!Ls(e,Rp,"Cancelling event since Personalization fields are already present in events with different values","Not sending event since Personalization fields are already present in event with different values")){const r=e.detail.events;Lp(n,r)}}})}function Mp(e){return"personalization"in e}function Ls(e,t,n,r){let i=e.detail.events;const o=t(i,e.detail.actionEvent.personalization);if(o.length>0){if(o.length===i.length)return P.log.warn(n,JSON.stringify(i)),e.detail.events=[],e.preventDefault(),!0;o.forEach(s=>P.log.warn(r,JSON.stringify(s))),i=i.filter(s=>!o.includes(s)),e.detail.events=i}return!1}function xs(e,t){return e.filter(n=>n[Di.Category]===Ms.Engagement.toString()&&n[Di.EventType]!==Ds.Consent)}function Rp(e,t){return e.filter(n=>J(n,ht.Id)&&n[ht.Id]!==t.id||J(n,ht.ContentId)&&n[ht.ContentId]!==t.contentId)}function Lp(e,t){xs(t).forEach(n=>{T(e.id)&&(n[ht.Id]=e.id),T(e.contentId)&&(n[ht.ContentId]=e.contentId)})}function xp(){document.addEventListener(P.CustomEvents.OnInit,()=>{const e=Ue();if(e===void 0||e.attributes===void 0){P.log.warn("Engagement Configuration does not have any Config for Attributes");return}const t=e.attributes.engagements;Object.keys(t).forEach(n=>{t[n].qualify()})}),document.addEventListener(P.CustomEvents.OnShutDown,()=>{Hc()})}var Ne=(e,t,n)=>new Promise((r,i)=>{var o=a=>{try{l(n.next(a))}catch(u){i(u)}},s=a=>{try{l(n.throw(a))}catch(u){i(u)}},l=a=>a.done?r(a.value):Promise.resolve(a.value).then(o,s);l((n=n.apply(e,t)).next())});function ks(e){const t=jn().find(r=>r.name===e.transformerName);if(t===void 0){y.log.error(`transformer with name ${e.transformerName} could not be found`);return}const n=Ka(t.transformerType);if(n===void 0){y.log.error(`transformer ${t.transformerType} does not have an implementation`);return}return[n,t]}function Us(e,t,n,r){return e.map((i,o)=>{const s=n+`, transformer ${i.transformation.transformerName}, element index ${o}`,l=ks(i.transformation);if(D(l)){const c=new Error(`Cannot transform, handler not found for ${s}`);return y.log.error(c.message),t.status.update(new k(c)),Ln(i.transformation),null}const[a,u]=l,f=`Providing transformer with element promise etc, ${s}`;y.log.trace(f),t.status.update(new k(f));const p=a.transform(u,i.transformation,i.pageElementReady,r,t);return p.promise=p.promise.then(()=>{const c=`Finished transformation for ${s}`;y.log.trace(c),t.status.update(new k(c))}).catch(c=>{const h=new Error(`Issue handling transformation for ${s}`+K(c).message);throw y.log.error(h.message),t.status.update(new k(h)),c}).finally(()=>Ln(i.transformation)),p}).filter(i=>!D(i))}function kp(e,t=!1){const n=`PEC ${e.pec.name}`,r=Vs(e.pec);if(!H(r)){const o=new ie(ue.MissingPersonalization,`Could not find any elements, PEC ${n}`);throw y.log.warn(o.message),o}t&&Bo({personalizationExperienceConfigName:e.pec.name});const i=Us(r,e,n);Hs(e,Promise.resolve({transformResponses:i}),n)}function Hs(e,t,n,r){e.status.update(new k(`Awaiting response and processing for ${n}`),t.then(i=>Ne(this,null,function*(){yield Promise.allSettled(i.transformResponses.map(o=>Ne(this,null,function*(){return yield o.promise}))).then(o=>{const s=o.filter(l=>l.status==="rejected").map(l=>K(l.reason).message);if(s.length>0)throw new Error(`Issue(s) with transformation(s) for ${n}: ${JSON.stringify(s)}`)})}))),e.initiateRevert=()=>{const i=new lr(t.then(o=>Ne(this,null,function*(){yield Promise.allSettled(o.transformResponses.map(s=>Ne(this,null,function*(){yield s.revert(i)}))).then(s=>{const l=s.filter(a=>a.status==="rejected").map(a=>K(a.reason).message);if(l.length>0)throw new Error(`Issue(s) with revert (see 'statuses' for more detail): ${JSON.stringify(l)}`);i.update(new k("Revert (as applicable) finished")),!D(o.personalizationId)&&et(r)&&!r?Nr(o.personalizationId):D(o.personalizationId)&&Nr(e.pec.name)})}),o=>{if(o instanceof ie)i.update(new k("Nothing to revert, no transformation attempt"));else throw o}));return i}}function Up(e,t,n){const r=e.pec.name;let i=`PEC ${r}`;const o=t.then(s=>{const l=s.personalizations.filter(p=>{var c;return Sn((c=e.pec.dataProvider)==null?void 0:c.type)&&e.pec.dataProvider.value===p.personalizationPointName});if(H(l)){if(l.length>1){const p=`Received multiple responses for [${i}] when only one is expected. Using the first response.`;y.log.warn(p),e.status.update(new k(p))}}else{const p=new ie(ue.MissingPersonalization,`Did not receive a personalization response for ${i}`);throw y.log.warn(p.message),p}const a=l[0],u=a.personalizationId;if(!Go(a))if(T(a.decisionId)){const p=new ie(ue.MissingPersonalizationDataAttributes,'Personalization invalid. Expected to include either "data" or "attributes".',{context:{configName:r,personalization:a}});throw y.log.warn(p.message),p}else{const p=`User did not qualify for a decision for the following personalization experience config: ${r}`;return y.log.debug(p),e.status.update(new k(p)),{personalizationId:u,transformResponses:[]}}e.status.update(new k(`Found response personalizationId ${u} ${i}`));const f=Vs(e.pec);if(!H(f)){const p=new ie(ue.MissingPersonalization,`Could not find any elements, ${i}, personalization ${u}`);throw y.log.warn(p.message),n||Nr(u),p}return i=i+`, personalization ${u}`,{personalizationId:u,transformResponses:Us(f,e,i,a)}});Hs(e,o,i,n)}function Hp(e,t,n){if(!H(e)){y.log.warn("ignoring empty personalization experience configs");return}if(D(t)){const i="null/undefined personalization response promise";y.log.warn(`ignoring ${i}`);const o=new Error(i);vn.updateForAll(e,new k(o),Promise.reject(o)),Lr(e.map(s=>s.pec));return}const r=t.then(i=>{if(!O(i)){const o=D(i)?new Error("null/undefined personalization response"):new Error("unexpected personalization response type");throw y.log.error(o.message),Lr(e.map(s=>s.pec)),o}return Xi("DEBUG")&&y.log.debug(`handling personalization response: ${JSON.stringify(i)}`),i},i=>{y.log.error("error handling personalization response",i);const o=new Error("Personalization response promise rejection: "+K(i).message);throw Lr(e.map(s=>s.pec)),o});e.filter(i=>{var o;return Sn((o=i.pec.dataProvider)==null?void 0:o.type)}).forEach(i=>{const o=Object.values(n!=null?n:{}).flatMap(s=>Object.values(s)).filter(s=>{var l;return s.point.name===((l=i.pec.dataProvider)==null?void 0:l.value)}).flatMap(s=>s.pecNames).length>1;Up(i,r,o)})}function Fp(e){var t;const n=e.name;return(t=Wo(n))!=null?t:""}function zp(e){return e.path}function Fs(e,t){var n;if(hr(e,t))return"html";if(wn(e,t))return Fp(e);if(rt(e))return zp(e);if(_t(t))return"body";if(ao((n=ks(e))==null?void 0:n[1].transformerType))return"head"}function zs(e){return Ne(this,null,function*(){return yield new Promise((t,n)=>{const r=sr("findElementOnPage:"+e);document.addEventListener(y.CustomEvents.OnShutDown,()=>{y.DisplayUtils.unbind(r),n(new Ve(De.NotWaitingForElementPath,"No longer waiting for element at path.",{context:{path:e}}))}),y.DisplayUtils.bind(r).pageElementLoaded(e).then(i=>{t(i)}).catch(i=>{y.log.warn("error with DisplayUtils",i),n(i)})})})}function Zn(e){const t=[];for(const n of e.transformations){const r=Fs(n,e.method),i=r!==void 0?t.find(o=>Fs(o.transformation,e.method)===r):void 0;i!==void 0?t.push({transformation:n,pageElementReady:i.pageElementReady}):r!==void 0?t.push({transformation:n,pageElementReady:zs(r)}):y.log.warn(`could not get the element path for transformerConfig: ${JSON.stringify(e)}`)}return t}function Vp(e){return Zn(e.transformationConfig)}function Bp(e){var t;const n=e.transformationConfig,r=lo(n.whenValues)&&(t=n.whenValues.percent)!=null?t:0,i=new Promise((s,l)=>{const a=sr("pageElementsReadyOnPageScroll:"+e.name);document.addEventListener(y.CustomEvents.OnShutDown,()=>{y.DisplayUtils.unbind(a),l(new Ve(De.NotWaitingForPageScroll,"No longer waiting for page scroll.",{context:{config:e.name}}))});const u=window.scrollY/(document.documentElement.scrollHeight-window.innerHeight);try{u>=r?s():y.DisplayUtils.bind(a).pageScroll(r).then(s).catch(f=>{l(new Ve(De.DisplayUtilsPageScrollError,"Error with DisplayUtils pageScroll method.",{cause:f}))})}catch(f){l(new Ve(De.DisplayUtilsPageScrollError,"Error with DisplayUtils pageScroll method.",{cause:f}))}}),o=s=>Ne(this,null,function*(){const[l]=yield Promise.all([s,i]);return l});return Zn(n).map(s=>(s.pageElementReady=o(s.pageElementReady),s))}function Gp(e){var t;const n=e.transformationConfig,r=uo(n.whenValues)&&(t=n.whenValues.delay)!=null?t:0,i=new Promise((s,l)=>{const a=sr("pageElementsReadyOnExitIntent:"+e.name);document.addEventListener(y.CustomEvents.OnShutDown,()=>{y.DisplayUtils.unbind(a),l(new Ve(De.NotWaitingForPageExit,"No longer waiting for page exit.",{context:{config:e.name}}))});try{y.DisplayUtils.bind(a).pageExit(r).then(s).catch(u=>{l(new Ve(De.DisplayUtilsPageExitError,"Error with DisplayUtils pageExit method.",{cause:u}))})}catch(u){l(new Ve(De.DisplayUtilsPageExitError,"Error with DisplayUtils pageExit method.",{cause:u}))}}),o=s=>Ne(this,null,function*(){const[l]=yield Promise.all([s,i]);return l});return Zn(n).map(s=>(s.pageElementReady=o(s.pageElementReady),s))}function jp(e){const t=e.transformationConfig,n=so(t.whenValues)?t.whenValues.path:"";if(!T(n))return[];function r(s){return Ne(this,null,function*(){return yield new Promise((l,a)=>{const u=()=>{y.log.debug(`Add Overlay Personalization Element '${s.id}' was clicked`),l(s)};document.addEventListener(y.CustomEvents.OnShutDown,()=>{s.removeEventListener("click",u),a(new Ve(De.NotWaitingForElementClick,"No longer waiting for element click.",{context:{element:s.id}}))});try{s.addEventListener("click",u)}catch(f){a(new Ve(De.AddingClickListenerError,"Error with adding click listener",{cause:f}))}})})}function i(){return Ne(this,null,function*(){yield zs(n).then(s=>Ne(this,null,function*(){return yield r(s)}))})}const o=s=>Ne(this,null,function*(){const[l]=yield Promise.all([s,i()]);return l});return Zn(t).map(s=>(s.pageElementReady=o(s.pageElementReady),s))}function Vs(e){const t=e.transformationConfig.when;return t===Ce.Immediately?Vp(e):t===Ce.ScrollPercent?Bp(e):t===Ce.ExitIntent?Gp(e):t===Ce.ElementClick?jp(e):(y.log.warn(`whenType [${t}] not explicitly handled`),[])}var Kn=(e,t,n)=>new Promise((r,i)=>{var o=a=>{try{l(n.next(a))}catch(u){i(u)}},s=a=>{try{l(n.throw(a))}catch(u){i(u)}},l=a=>a.done?r(a.value):Promise.resolve(a.value).then(o,s);l((n=n.apply(e,t)).next())});function Wp(){document.addEventListener(y.CustomEvents.OnShutDown,Bs),Bs()}function Bs(){Au(),qp(),$p(),Kp(),Xp()}function qp(){const e=te.pageUrl.listener,t=te.pageUrl.reject,n=te.pageUrl={};D(e)||document.removeEventListener(y.CustomEvents.OnInitSitemap,e),D(t)||t(new Error("shutdown/reinit")),n.matchedPromise=new Promise((r,i)=>{n.reject=i,n.listener=()=>{const o=Yp();n.matchedPECs=o,r(o)},document.addEventListener(y.CustomEvents.OnInitSitemap,n.listener)}),n.matchedPromise.catch(r=>{y.log.error(`Issue matching page URLs: ${K(r).message}`,r)})}function $p(){const e=te.pageType.listener,t=te.pageType.reject,n=te.pageType={};D(e)||document.removeEventListener(y.CustomEvents.OnSettledSitemap,e),D(t)||t(new Error("shutdown/reinit")),n.matchedPromise=new Promise((r,i)=>{n.reject=i,n.listener=o=>{const s=Zp(o.detail.result);n.matchedPECs=s,r(s)},document.addEventListener(y.CustomEvents.OnSettledSitemap,n.listener)}),n.matchedPromise.catch(r=>{y.log.error(`Issue matching page types: ${K(r).message}`,r)})}function Yp(){var e;const t=(e=window==null?void 0:window.location)==null?void 0:e.href;return y.log.debug(`current page url: ${t}`),ls(t)}function Zp(e){var t,n;const r=(t=e==null?void 0:e.matchedConfig)==null?void 0:t.name,i=(n=window==null?void 0:window.location)==null?void 0:n.href;return y.log.debug(`sitemap result pageType: ${r} url: ${i}`),us(r)}function Kp(){if(te.pageUrl.processedPromise=void 0,D(te.pageUrl.matchedPromise)){y.log.error("Unable to process page URL matches. Missing Promise.");return}te.pageUrl.processedPromise=te.pageUrl.matchedPromise.then(e=>Kn(this,null,function*(){yield Ws(e)})),te.pageUrl.processedPromise.catch(e=>{y.log.error(`Issue processing page URL matches: ${K(e).message}`,e)})}function Xp(){if(te.pageType.processedPromise=void 0,D(te.pageUrl.matchedPromise)||D(te.pageType.matchedPromise)){y.log.error("Unable to process page type matches. Missing Promise(s).");return}te.pageType.processedPromise=Promise.all([te.pageUrl.matchedPromise,te.pageType.matchedPromise]).then(e=>Kn(this,null,function*(){if(e.length!==2)throw new Error(`Unable to process page type matches. Expected results for 2 promises (url matches, page-type matches), but found: ${e==null?void 0:e.length}`);const t=[],n=[];e[1].forEach(r=>{e[0].some(i=>i.name===r.name)?n.push(r.name):t.push(r)}),n.length>0&&y.log.debug(`Avoiding processing, already url-matched: ${JSON.stringify(n)}`),yield Ws(t)})),te.pageType.processedPromise.catch(e=>{y.log.error(`Issue processing page type matches: ${K(e).message}`,e)})}function Qp(e){if(!D(e)){if(!D(e.individualId)&&!T(e.individualId))throw new Ee(de.IndividualIdNotValid,"Individual Id must be a valid string if provided.",{context:{value:e.individualId}});if(D(e.endpoint)||io(e.endpoint),!D(e.perPersonalizationPoint)){if(!O(e.perPersonalizationPoint))throw new zt(vt.PointOptionsNotValid,"perPersonalizationPoint must be an object if provided.",{context:{value:e.perPersonalizationPoint}});Object.entries(e.perPersonalizationPoint).forEach(([t,n])=>{if(!T(t))throw new zt(vt.PointOptionKeyInvalid,"perPersonalizationPoint key must be a valid string.",{context:{value:t}});if(!O(n))throw new zt(vt.PointOptionsNotValid,"PreviewPersonalizationPointOptions must be an object.",{context:{value:n}});if(!D(n.decisionId)&&!T(n.decisionId))throw new Ee(de.DecisionIdNotValid,"PreviewPersonalizationPointOptions decisionId must be a valid string if provided.",{context:{value:n.decisionId}})})}}}function Jp(e,t){if(!H(e))throw new zt(vt.MissingPersonalizationExperienceConfig,"Valid PersonalizationExperienceConfig(s) expected to Preview.");eg(e),y.log.debug(`Previewing personalization experience config(s): ${JSON.stringify(e.map(s=>s==null?void 0:s.name))}`),e.forEach(s=>{Ai(s),Ci(s)}),Qp(t);const n={individualId:t==null?void 0:t.individualId,dataspaceApiName:Vt(),isPreview:!0,endpoint:t==null?void 0:t.endpoint},r=e.map(s=>new vn(s));Gs(r,!0),js(r,n,t);const i=r.reduce((s,l)=>(s[l.pec.name]=l.status,s),{}),o=()=>{const s=r.reduce((l,a)=>(l[a.pec.name]=a.revert(),l),{});return new zu(s)};return new Fu(i,o)}function eg(e){const t=e.map(r=>r.name),n=tg(t);if(n.length>0)throw new zt(vt.DuplicatePersonalizationExperienceConfigs,"",{context:{value:n}})}function tg(e){const t=new Set,n=new Array;return e.forEach(r=>{const i=r.toLowerCase();t.has(i)?n.push(r):t.add(i)}),n}function ng(e){const t=new Set,n=new Set;return e.forEach(r=>{r.isEnabled===void 0||r.isEnabled?t.add(r):n.add(r.name)}),y.log.debug(`skipping matched disabled personalization experience config names: ${JSON.stringify(n)}`),[...t]}function Gs(e,t=!1){e.filter(n=>D(n.pec.dataProvider)).forEach(n=>{kp(n,t)})}function js(e,t,n){const r=e.filter(s=>!D(s.pec.dataProvider));if(y.log.debug(`matched enabled and with data providers personalization experience config names: ${JSON.stringify(r.map(s=>s.pec.name))}`),r.length<=0)return;const i=r.map(s=>s.pec),o=Qh(i);t=t!=null?t:{dataspaceApiName:Vt()},et(t.isPreview)&&t.isPreview&&Object.values(o).forEach(s=>{Object.values(s).forEach(l=>{var a,u;const f=(u=(a=n==null?void 0:n.perPersonalizationPoint)==null?void 0:a[l.point.name])==null?void 0:u.decisionId;T(f)&&(l.point.decisionId=f)})}),rg(r,o,t)}function Ws(e){return Kn(this,null,function*(){e=ng(e);const t=e.map(r=>r.name);if(y.log.debug(`matched enabled personalization experience config names: ${JSON.stringify(t)}`),e.length<=0)return;if(Oi()){y.log.info(`WPM (client side editor) active, suppressing live/non-preview fetch for PECs: ${JSON.stringify(t)}`);return}const n=e.map(r=>new vn(r));Gs(n),js(n),yield Promise.allSettled(n.map(r=>Kn(this,null,function*(){return yield r.status.finished}))).then(r=>{const i=r.filter(o=>o.status==="rejected").map(o=>K(o.reason));if(i.length>0)throw new Error(`Issues processing matched PECs: ${JSON.stringify(t)} : ${JSON.stringify(i.map(o=>o.message))}`)})})}function rg(e,t,n){var r;const i=(r=n==null?void 0:n.dataspaceApiName)!=null?r:"";if(y.log.debug(`fetching for dataspace ["${i}]" points: ${JSON.stringify(t)}`),Object.keys(t).length<1){const s=JSON.stringify(e.map(a=>a.pec.name)),l=new Error(`No personalization points across PECs ${s} using dataspace [${i}]`);vn.updateForAll(e,new k(l),Promise.reject(l));return}const o={};T(n==null?void 0:n.dataspaceApiName)&&(o.dataspace=n.dataspaceApiName),T(n==null?void 0:n.individualId)&&(o.individualId=n.individualId),Object.values(t).forEach(s=>{const l=Fo(Object.values(s).map(u=>u.point),o,n==null?void 0:n.isPreview),a=Ho(l,{endpoint:n==null?void 0:n.endpoint});Hp(e,a,t)})}var Mi=(e,t,n)=>new Promise((r,i)=>{var o=a=>{try{l(n.next(a))}catch(u){i(u)}},s=a=>{try{l(n.throw(a))}catch(u){i(u)}},l=a=>a.done?r(a.value):Promise.resolve(a.value).then(o,s);l((n=n.apply(e,t)).next())});function ig(){document.addEventListener(P.CustomEvents.OnInitSitemap,()=>{const e=Ie();for(const n of Object.values(Te))Ri(n,e);const t=og();Promise.race([lg(),t]).then(n=>{n=n!=null?n:[],Ri(Te.PageUrlMatcher,n)}).catch(n=>{P.log.error("Unexpected error updating paths for flicker defense while evaluating Personalization Experience Config URL matches.",n)}),Promise.race([sg(),t]).then(n=>{n=n!=null?n:[],Ri(Te.PageType,n)}).catch(n=>{P.log.error("Unexpected error updating paths for flicker defense while evaluating Personalization Experience Config page type matches.",n)})})}function og(){return Mi(this,null,function*(){yield new Promise(e=>{Ko(!1),setTimeout(()=>{P.log.debug(`flicker defense redisplay timeout of ${Rn().redisplayTimeoutMilliseconds}ms elapsed`),Ko(!0),ag(),e()},Rn().redisplayTimeoutMilliseconds)})})}function ag(){ct.PageUrlMatcher=[],ct.PageType=[],Rr()}function sg(){return Mi(this,null,function*(){return[...yield Es()]})}function lg(){return Mi(this,null,function*(){return[...yield vs()]})}function Ri(e,t){const n=kh(e,t);ct[e]=Qo(n),P.log.debug(`flicker defense currently hiding the following transformations for source matcher type ${e}: ${JSON.stringify(Object.values(ct[e]))}`),Rr()}function ug(e){if(!Ge()){y.log.error("The config can only be modified before SalesforceInteractions.init is called.");return}if(!O(e)){y.log.error("A config is required.");return}if(e.customEngagementConfig!==void 0&&pa(e.customEngagementConfig),e.customWpmConfig!==void 0&&Ns(e.customWpmConfig),e.customFlickerDefenseConfig!==void 0&&ea(e.customFlickerDefenseConfig),e.additionalTransformers!==void 0&&(J(e.additionalTransformers,"list")&&H(e.additionalTransformers.list,!0)?Qa(e.additionalTransformers.list):H(e.additionalTransformers,!0)?Qa(e.additionalTransformers):y.log.error("A list of transformers is required when adding to Transformers.")),e.personalizationExperienceConfigs!==void 0)if(J(e.personalizationExperienceConfigs,"list")&&H(e.personalizationExperienceConfigs.list,!0)){const t=gs().DATA_CLOUD_MODULE_CONFIG;if(O(t)){y.log.error("Initializing personalization experience configs using this format can only be used once.");return}rp(Ii.DataCloudModuleConfig,e.personalizationExperienceConfigs),Pi(e.personalizationExperienceConfigs.list,Ii.DataCloudModuleConfig)}else H(e.personalizationExperienceConfigs,!0)?Pi(e.personalizationExperienceConfigs):y.log.error("A list of personalization experience configs is required.");if(e.additionalHandlebarsHelpers!==void 0){if(!O(e.additionalHandlebarsHelpers)){y.log.error("An object is required when adding custom handlebars helpers.");return}for(const[t,n]of Object.entries(e.additionalHandlebarsHelpers))th(t,n)}}var cg=(e,t,n)=>new Promise((r,i)=>{var o=a=>{try{l(n.next(a))}catch(u){i(u)}},s=a=>{try{l(n.throw(a))}catch(u){i(u)}},l=a=>a.done?r(a.value):Promise.resolve(a.value).then(o,s);l((n=n.apply(e,t)).next())});function fg(e,t){return cg(this,null,function*(){try{if(!H(e))throw new Ee(de.PersonalizationPointsIsNotAnArray,"The Personalization Points parameter must be an array of length >= 1.",{context:{value:e}});const n=e.map(i=>({name:i})),r=Fo(n,t);return yield Ho(r)}catch(n){return y.log.error(n),yield Promise.reject(n)}})}Ul(),Hl(),Dp(),xp(),Wp(),Bu(),Xh(),hp(),ig(),window.SalesforceInteractions.Personalization={fetch:fg,Config:{initialize:ug,PersonalizationExperience:{findByName:xh,getAll:Ie,addNew:Kh,isSupported:Ci,validate:Ai,preview:Jp},Transformer:{getAll:jn,addNew:vh},Engagement:{initializeCustom:pa,get:Ue,validate:ha},Wpm:{initializeCustom:Ns,get:bs,validate:As},FlickerDefense:{initializeCustom:ea,get:Rn},ContentZoneHandler:{set:Cu,get:Pu}},launchWpm:yp}})(window.SalesforceInteractions); } catch (e) { console.error("[Salesforce personalization] Error initializing module: personalization", e); } })(); (function () { // ----- module marketing - npm/@salesforce/interactions-marketing/258.0.0/dist/marketing.min.js [258.0.0] try { (()=>{"use strict";var e={118:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ConfigManager=void 0;const i=n(88);class r{static#e;#t=null;#n=null;static get instance(){return r.#e||(r.#e=new r),r.#e}get configuration(){return this.#t}set configuration(e){this.#t=e}constructor(){}preserveScriptParams(){this.#n=this.#i()}getEventParams(e){const t=this.#r(this.#n);let n=null,r=null;if(e===i.EventType.TrackedLinkClick){if(n=this.#s("content_id"),!n)return null;r=this.#s("bu_id")}else this.#n?(n=this.#n,r=t?.bu_id):(n=null,r=null);return{eventType:e,websitePublicationId:n??null,businessUnitId:r??null}}#i(){return this.#a("wtcp_id")}#r(e){if(!e)return null;if(!this.configuration?.webTrackingConfigParams)return null;return(this.configuration.webTrackingConfigParams[e]??null)||null}#s(e){const t=new URLSearchParams(window.location.search);return t.has(e)?t.get(e):null}#a(e){const t=document.currentScript,n=null!=t&&"src"in t?t.src:null;if(!n)return null;const i=new URL(n);return new URLSearchParams(i.search).get(e)}}t.ConfigManager=r},208:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CookieAttributes=void 0;const i=n(123);class r{static DOMAIN="domain";static EXPIRES="expires";static HTTP_ONLY="httponly";static PATH="path";static SAMESITE="samesite";static SECURE="secure";#o;#l;constructor(e){this.#o={},this.#l=e??new Date}get isInitialized(){return Object.keys(this.#o).length>0}get domain(){return this.#u(r.DOMAIN)}set domain(e){this.#c(r.DOMAIN,e)}get expires(){return this.#u(r.EXPIRES)}set expires(e){this.#c(r.EXPIRES,e)}set expiresSeconds(e){null!=e&&(this.#l.setTime(e*i.MILLISECONDS_PER_SECOND),this.#c(r.EXPIRES,this.#l.toUTCString()))}get httpOnly(){return Boolean(this.#u(r.HTTP_ONLY))}set httpOnly(e){this.#c(r.HTTP_ONLY,Boolean(e))}get path(){return this.#u(r.PATH)}set path(e){this.#c(r.PATH,e)}get sameSite(){return this.#u(r.SAMESITE)}set sameSite(e){this.#c(r.SAMESITE,e)}get secure(){return Boolean(this.#u(r.SECURE))}set secure(e){this.#c(r.SECURE,Boolean(e))}#u(e){return null!=this.#o&&Object.keys(this.#o).includes(e)?this.#o[e]:null}#c(e,t){null!=t&&(this.#o=this.#o??{},this.#o[e]=t)}}t.CookieAttributes=r},132:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UninitializedCookieError=t.Cookie=void 0;const i=n(208);class r extends Error{constructor(e){super(e)}}t.UninitializedCookieError=r;class s{#d;#o;#h;static get(e){let t=document.cookie.split("; ").find((t=>t.startsWith(e)))??null;return s.#g(t)}static getAll(e){let t=document.cookie.split("; ").filter((t=>t.startsWith(e)));return t.length>0?t.map((e=>s.#g(e))):[]}static exists(e){return null!==new RegExp(e+"=([^;]+)").exec(document.cookie)}static fromString(e){return s.#g(e)}static#g(e){if(null==e||""===e)return null;let t=Object.fromEntries(e.split("; ").map((e=>e.split(/=(.*)/s).map(decodeURIComponent)))),n=Object.keys(t),r=n[0]??null;if(null===r)return null;let a=null;return n.length>1&&(a=new i.CookieAttributes,a.domain=t[i.CookieAttributes.DOMAIN]??null,a.path=t[i.CookieAttributes.PATH]??null,a.expires=t[i.CookieAttributes.EXPIRES]??null,a.sameSite=t[i.CookieAttributes.SAMESITE]??null,a.secure=n.includes(i.CookieAttributes.SECURE)??null,a.httpOnly=n.includes(i.CookieAttributes.HTTP_ONLY)??null),new s(decodeURIComponent(r),decodeURIComponent(t[r]),a)}constructor(e,t,n){this.#d=e,this.#h=t,this.#o=n??new i.CookieAttributes}get name(){return this.#d}get value(){return this.#h}set value(e){this.#h=e}get attributes(){return this.#o}delete(){this.#o&&(this.#o.expiresSeconds=0),this.set()}set(){if(!this.#o.isInitialized)throw new r(`Refusing to write cookie named "${this.#d}" with uninitialized attributes.`);document.cookie=this.toString()}toString(){if(null===this.#d||null===this.#h)return"";let e=`${encodeURIComponent(this.#d)}=${encodeURIComponent(this.#h)}`;return null===this.#o||(null!==this.#o.domain&&(e+=`; ${i.CookieAttributes.DOMAIN}=${this.#o.domain}`),null!==this.#o.expires&&(e+=`; ${i.CookieAttributes.EXPIRES}=${this.#o.expires}`),this.#o.httpOnly&&(e+=`; ${i.CookieAttributes.HTTP_ONLY}`),null!==this.#o.path&&(e+=`; ${i.CookieAttributes.PATH}=${this.#o.path}`),null!==this.#o.sameSite&&(e+=`; ${i.CookieAttributes.SAMESITE}=${this.#o.sameSite}`),this.#o.secure&&(e+=`; ${i.CookieAttributes.SECURE}`)),e}}t.Cookie=s},797:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SfidCookie=void 0;const i=n(132);t.SfidCookie=class{#d;#p;constructor(e){this.#d=e,this.#p=i.Cookie.get(this.name)??new i.Cookie(this.name,!1)}get name(){return this.#d}get isExpired(){if(!this.exists())return!0;const e=this.#p?.attributes?.expires,t=Date.now().toString();return Date.parse(e??t){Object.defineProperty(t,"__esModule",{value:!0}),t.SECONDS_PER_DAY=t.MILLISECONDS_PER_SECOND=void 0,t.MILLISECONDS_PER_SECOND=1e3,t.SECONDS_PER_DAY=86400},145:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EventHandlerRegistrationResult=void 0,t.EventHandlerRegistrationResult=class{name;wasRegistered;constructor(e,t){this.name=e,this.wasRegistered=t}}},926:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.EventManager=void 0;const a=s(n(56)),o=n(118),l=n(518),u=n(244),c=n(862),d=n(145),h=n(88);t.EventManager=class{registeredEvents=new c.RegisteredHandlersCollection([]);debugEnabled=!1;registerEventHandlers(){const e=[...this.#m(),...this.#b()];for(const t of e)t.wasRegistered||console.error(`Failed to register the ${t.name} event handler`);return e}unregisterEventHandlers(){this.registeredEvents.handlers.forEach((e=>{this.#k(`Unregistering event handler: ${e.humanReadableName}`),e.parentElement.removeEventListener(e.eventType,e)})),this.registeredEvents.clear()}#m(){const e=[],t=new u.HandlerRegistration("PageView[Init]",window,"DOMContentLoaded",this.#v.bind(this));e.push(this.#C(t));const n=new u.HandlerRegistration("CustomTrackedLinkClick[Init]",window,"DOMContentLoaded",this.#E.bind(this));e.push(this.#C(n));const i=new u.HandlerRegistration("MessagingTrackedLinkClick[Init]",window,"DOMContentLoaded",this.#f.bind(this));return e.push(this.#C(i)),e.push(...this.#y(null)),e}#b(){const e=[],t=new u.HandlerRegistration("PageView[ConsentGrant]",document,a.CustomEvents.OnConsentGrant,this.#v.bind(this));e.push(this.#C(t));const n=new u.HandlerRegistration("CustomTrackedLinkClick[ConsentGrant]",document,a.CustomEvents.OnConsentGrant,this.#E.bind(this));e.push(this.#C(n));const i=new u.HandlerRegistration("MessagingTrackedLinkClick[ConsentGrant]",document,a.CustomEvents.OnConsentGrant,this.#f.bind(this));e.push(this.#C(i));const r=new u.HandlerRegistration("WebsiteEngagement[ConsentGrant]",document,a.CustomEvents.OnConsentGrant,this.#y.bind(this));return e.push(this.#C(r)),e}#y(e){const t=new u.HandlerRegistration("Click",document,"click",this.#w.bind(this));return[this.#C(t)]}#v(e){if(this.#R())try{const e=o.ConfigManager.instance?.getEventParams(h.EventType.PageView),t=this.#I(e);this.#_(t)}catch(e){console.error("Marketing.pageViewEventHandler(): "+e)}}#E(e){if(!this.#R())return null;try{const e=this.#S();if(e)return this.#k("Found CustomTrackedLinkClick",e),a.sendEvent(e);this.#k("No custom tracked link click found.")}catch(e){console.error("Marketing.handleCustomTrackedLinkClick(): "+e)}return null}#f(e){if(this.#R())try{(new l.IndividualLinkingManager).linkAnonymousIndividual()}catch(e){console.error("Marketing.handleMessagingTrackedLinkClick(): "+e)}}#w(e){if(this.#R())try{const t=this.#T(e);if(null!==t){const e=o.ConfigManager.instance?.getEventParams(t),n=this.#I(e);this.#_(n)}}catch(e){console.error("Marketing.clickEventHandler(): "+e)}}#T(e){const t=e?.target,n=t?.tagName,i=t?.getAttribute("type")??"";switch(n.toLowerCase()){case"a":return h.EventType.AnchorClick;case"button":return h.EventType.ButtonClick;case"input":switch(i.toLowerCase()){case"button":return h.EventType.InputTypeButtonClick;case"submit":return h.EventType.InputTypeSubmitClick;case"reset":return h.EventType.InputTypeResetClick}}return null}#I(e){return e?{interaction:{name:e.eventType,eventType:"website",screenHeight:window.screen.height,screenWidth:window.screen.width,sourcePageTitle:document.title,sourceDomainName:window.location.hostname,websitePublicationId:e.websitePublicationId,businessUnitId:e.businessUnitId},source:{locale:navigator.language,pageType:"standard__externalWebPage"},user:{attributes:{eventType:"identity",isAnonymous:"1"}}}:null}#_(e){e&&a.sendEvent(e)}#S(){const e=o.ConfigManager.instance?.getEventParams(h.EventType.TrackedLinkClick);return e?this.#I(e):null}#R(){const e=a.getConsents();for(const t of e)if("Salesforce Marketing Cloud"===t.consent.provider&&t.consent.purpose===a.ConsentPurpose.Tracking&&t.consent.status===a.ConsentStatus.OptIn)return!0;return!1}#C(e){return this.registeredEvents.addIfNotAlreadyRegistered(e)?(this.#k(`Registering the ${e.humanReadableName} listener for ${e.parentElement}'s ${e.eventType} event`),e.parentElement.addEventListener(e.eventType,e),new d.EventHandlerRegistrationResult(e.humanReadableName,!0)):(this.#k(`Listener ${e.humanReadableName} already registered, ignoring.`),new d.EventHandlerRegistrationResult(e.humanReadableName,!1))}#k(e,...t){this.debugEnabled&&console.log(`[EventManager] ${e}`,t)}}},88:(e,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.EventType=void 0,function(e){e.PageView="page-view",e.TrackedLinkClick="tracked-link-click",e.AnchorClick="anchor-click",e.ButtonClick="button-click",e.InputTypeButtonClick="input-type-button-click",e.InputTypeSubmitClick="input-type-submit-click",e.InputTypeResetClick="input-type-reset-click"}(n||(t.EventType=n={}))},244:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.HandlerRegistration=void 0,t.HandlerRegistration=class{_humanReadableName;_eventType;_methodReference;_parentElement;constructor(e,t,n,i){this._humanReadableName=e,this._parentElement=t,this._eventType=n,this._methodReference=i}get humanReadableName(){return this._humanReadableName}get parentElement(){return this._parentElement}get eventType(){return this._eventType}get methodReference(){return this._methodReference}handleEvent(e){this._methodReference(e)}}},862:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RegisteredHandlersCollection=void 0,t.RegisteredHandlersCollection=class{_handlers;constructor(e=[]){this._handlers=e}get handlers(){return this._handlers}add(e){return this.isInCollection(e.humanReadableName)&&console.warn(`Adding a duplicate handlerRegistration for ${e.humanReadableName}`),this._handlers.push(e),this}addIfNotAlreadyRegistered(e){return!this.isInCollection(e.humanReadableName)&&(this.add(e),!0)}isInCollection(e){return null!==this.getByHumanReadableName(e)}getByHumanReadableName(e){return this._handlers.find((t=>t.humanReadableName==e))??null}removeByHumanReadableName(e){let t=!1;return this._handlers.forEach(((n,i)=>{n.humanReadableName===e&&(this._handlers.splice(i,1),t=!0)})),t}clear(){return this._handlers.length=0,this}size(){return this._handlers.length}}},518:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IndividualLinkingManager=void 0;const i=n(118),r=n(132),s=n(797);t.IndividualLinkingManager=class{linkAnonymousIndividual(){try{const e=this.#P(),t=this.#M();if(null===t||null===e)return;this.#A(e,t)}catch(e){console.log("IndividualLinkingManager.linkAnonymousIndividual(): "+e)}}async#A(e,t){const n=new URL(`link?sftoken=${t}&deviceId=${e}`,i.ConfigManager?.instance?.configuration?.trackingServiceHostname);return await fetch(n,{method:"GET"})}#P(){const e=r.Cookie.getAll("_sfid").map((e=>null===e?null:new s.SfidCookie(e?.name))).filter((e=>null!==e)).filter((e=>!1===e?.isExpired)).filter((e=>null!==e?.anonymousId));return 0==e.length?null:e[0]?.anonymousId??null}#M(){return new URLSearchParams(window.location.search).get("sftoken")}}},204:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.init=function(e,t){try{console.log(a()),r.ConfigManager.instance.configuration=e,r.ConfigManager.instance.preserveScriptParams(),(t=t??new i.EventManager).registerEventHandlers()}catch(e){console.log("EventManager.init(): "+e)}},t.appVersion=a;const i=n(926),r=n(118),s=n(330);function a(){return`interactions-marketing-v${s.version}`}},56:e=>{e.exports=window.SalesforceInteractions},330:e=>{e.exports=JSON.parse('{"name":"@salesforce/interactions-marketing","version":"258.0.0","description":"Marketing-related extensions for the Data Cloud Web SDK.","main":"build/dist/index.js","types":"build/types/index.d.ts","browser":"build/dist/index.min.js","module":"build/dist/index.esm.js","repository":{"type":"git","url":"git@github.salesforce.com:sf-uma/interactions-marketing.git"},"author":"Salesforce, Inc.","license":"UNLICENSED","dependencies":{"@salesforce/interactions":"^2.0.9","@salesforce/interactions-cdp-event-receiver":"^1.0.12","dompurify":"^3.1.0","handlebars":"^4.7.0","jsonpath-plus":"^9.0.0"},"engines":{"node":">=16.20.0"},"scripts":{"build":"npm run clean && webpack","clean":"rm -rf ./dist && mkdir ./dist","doc":"typedoc","lint":"eslint ./src","lint:fix":"eslint --fix ./src","prepare":"npm run build","test":"jest --coverage"},"devDependencies":{"@babel/core":"^7.23.0","@babel/eslint-parser":"^7.25.1","@babel/eslint-plugin":"^7.25.1","@babel/plugin-syntax-class-properties":"7.12.13","@babel/plugin-syntax-decorators":"^7.24.7","@babel/preset-env":"^7.22.20","@babel/preset-typescript":"^7.24.7","@eslint/js":"^9.9.1","@testing-library/dom":"^10.4.0","@types/dompurify":"^v3.0.5","@types/eslint__js":"^8.42.3","@types/jest":"^29.5.13","@types/jsonpath-plus":"^5.0.5","@types/node":"^22.5.4","esbuild":"^0.23.1","eslint":"^8.0.0","eslint-config-prettier":"^9.1.0","eslint-plugin-babel":"^5.3.1","eslint-plugin-import":"^2.30.0","eslint-plugin-jest":"^28.8.2","eslint-plugin-prettier":"^5.2.1","jest":"^29.7.0","jest-environment-jsdom":"^29.7.0","jest-fetch-mock":"^3.0.3","jest-html-reporter":"^3.10.2","jest-junit":"^16.0.0","prettier":"^3.3.3","sucrase":"^3.35.0","ts-jest":"^29.2.5","ts-loader":"^9.5.1","ts-node":"^10.9.2","tslib":"^2.6.2","typedoc":"^0.26.6","typedoc-plugin-markdown":"^4.2.6","typedoc-plugin-mdn-links":"^3.2.10","typescript-eslint":"^8.4.0","typescript-register":"^1.1.0","typescript-require":"^0.3.0","webpack":"^5.92.0","webpack-cli":"^5.1.4"},"files":["dist","package.json","README.md"]}')}},t={};function n(i){var r=t[i];if(void 0!==r)return r.exports;var s=t[i]={exports:{}};return e[i].call(s.exports,s,s.exports,n),s.exports}var i={};(()=>{var e=i;Object.defineProperty(e,"__esModule",{value:!0});const t=n(204);window.SalesforceInteractions=window.SalesforceInteractions||{},window.SalesforceInteractions.Marketing=window.SalesforceInteractions.Marketing||{},window.SalesforceInteractions.Marketing={...window.SalesforceInteractions.Marketing,init:t.init}})();var r=window;for(var s in i)r[s]=i[s];i.__esModule&&Object.defineProperty(r,"__esModule",{value:!0})})(); SalesforceInteractions.Marketing.init({ "trackingServiceHostname": "https://e360-tracking-service-cdp1.sfdc-yzvdd4.svc.sfdcfc.net", "webTrackingConfigParams": { "1NDQx00000006evOAA": { bu_id: "1QOQx0000000Po1OAE" } } }); } catch (e) { console.error("[Salesforce marketing] Error initializing module: marketing", e); } })(); (function () { // ----- module consent-banner - npm/@salesforce/consent-banner/258.0.2/dist/consent-banner.min.js [258.0.2] try { (()=>{"use strict";var e={112:(e,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ConsentBannerConsentMode=void 0,t.getConsentBannerConsentMode=function(e){return e.toUpperCase()===n.NOT_REQUIRED?n.NOT_REQUIRED:n.REQUIRED},function(e){e.REQUIRED="REQUIRED",e.NOT_REQUIRED="NOT_REQUIRED"}(n||(t.ConsentBannerConsentMode=n={}))},502:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ConsentBannerFrontend=void 0;class n{static DEFAULT_BANNER_MESSAGE="We use cookies to enhance your browsing experience, serve personalized content or ads, and analyze web traffic. By accepting, you consent to our use of cookies.";static DEFAULT_BANNER_COLOR="#FFFFFF";static DEFAULT_BANNER_TEXT_COLOR="#000000";static DEFAULT_BANNER_POSITION="top";static DEFAULT_BANNER_FONT_FAMILY="serif";static DEFAULT_ALLOW_BUTTON_COLOR="#FFFFFF";static DEFAULT_ALLOW_BUTTON_TEXT_COLOR="#000000";static DEFAULT_DECLINE_BUTTON_COLOR="#FFFFFF";static DEFAULT_DECLINE_BUTTON_TEXT_COLOR="#000000";static DEFAULT_PRIVACY_POLICY_TEXT="Review our privacy policy";#e;#t;#n;#o;#i;#s;#r;#a;#c;#l;#u;#d;#h;#C;#m;#E;#b;constructor(e,t={},o=null,i=null){this.#e=t.bannerMessage??n.DEFAULT_BANNER_MESSAGE,this.#t=t.bannerColor??n.DEFAULT_BANNER_COLOR,this.#n=t.bannerTextColor??n.DEFAULT_BANNER_TEXT_COLOR,this.#o=(t.bannerPosition??n.DEFAULT_BANNER_POSITION).toLowerCase(),this.#i=t.bannerFontFamily??n.DEFAULT_BANNER_FONT_FAMILY,this.#s=t.allowButtonColor??n.DEFAULT_ALLOW_BUTTON_COLOR,this.#r=t.allowButtonTextColor??n.DEFAULT_ALLOW_BUTTON_TEXT_COLOR,this.#a=t.declineButtonColor??n.DEFAULT_DECLINE_BUTTON_COLOR,this.#c=t.declineButtonTextColor??n.DEFAULT_DECLINE_BUTTON_TEXT_COLOR,this.#l=t.privacyPolicyText??n.DEFAULT_PRIVACY_POLICY_TEXT,this.#u=t.privacyPolicyUrl??null,this.#d=t.infoText??null,this.#h=t.infoUrl??null,this.#m=o,this.#E=i,this.#C=e,this.#b=null,this.onLoad()}get allowButtonColor(){return this.#s}get allowButtonTextColor(){return this.#r}get bannerMessage(){return this.#e}get bannerColor(){return this.#t}get bannerTextColor(){return this.#n}get bannerPosition(){return this.#o}get bannerFontFamily(){return this.#i}get declineButtonColor(){return this.#a}get declineButtonTextColor(){return this.#c}get privacyPolicyText(){return this.#l}get privacyPolicyLink(){const e=this.#u??null;return null===e?"":``}get infoText(){return this.#d}get infoLink(){const e=this.#h??null;return null===e?"":``}get rootElement(){return this.#b}create(){return!this.#b&&(this.#g(),!0)}show(){this.#b&&(this.#b.style.display="block")}hide(){this.#b&&(this.#b.style.display="none")}onLoad(){this.#C.initConsent(),this.#C.hasConsent()||this.#g()}#g(){this.#b=document.createElement("div"),this.#b.innerHTML=this.#p,document.body?this.#_(document.body):new MutationObserver(((e,t)=>{document.body&&(this.#_(document.body),t.disconnect())})).observe(document.documentElement,{childList:!0,subtree:!0})}#_(e){e.appendChild(this.#b);const t=document.querySelector("#sfmc-consent-banner-accept-button");null!==t&&t.addEventListener("click",(e=>{this.#m&&this.#m(),this.hide()}));const n=document.querySelector("#sfmc-consent-banner-decline-button");null!==n&&n.addEventListener("click",(e=>{this.#E&&this.#E(),this.hide()}))}get#p(){return`\n\n\n`}}t.ConsentBannerFrontend=n},127:(e,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ConsentBannerTrackingMode=void 0,t.getConsentBannerTrackingMode=function(e){switch(e.toUpperCase()){case n.DATA_CLOUD:return n.DATA_CLOUD;case n.MARKETING_CLOUD:return n.MARKETING_CLOUD;case n.EXPERIENCE_SERVICES:default:return n.EXPERIENCE_SERVICES}},function(e){e.DATA_CLOUD="DATA_CLOUD",e.MARKETING_CLOUD="MARKETING_CLOUD",e.EXPERIENCE_SERVICES="EXPERIENCE_SERVICES"}(n||(t.ConsentBannerTrackingMode=n={}))},653:(e,t,n)=>{var o;Object.defineProperty(t,"__esModule",{value:!0}),t.ConsentBanner=void 0;const i=n(127),s=n(112),r=n(596),a=n(502);class c{static DEFAULT_TRACKING_MODE=i.ConsentBannerTrackingMode.EXPERIENCE_SERVICES;static DEFAULT_CONSENT_MODE=s.ConsentBannerConsentMode.REQUIRED;static SALESFORCE_EMBEDDED_PAGE_QUERYSTRING="sfdc.lightning_out=true";#T;#f;#M;#O;#C;#A;constructor(e={},t){this.#T=e.orgId??null,this.#M=(0,i.getConsentBannerTrackingMode)(e.trackingMode??o.DEFAULT_TRACKING_MODE),this.#O=(0,s.getConsentBannerConsentMode)(e.consentMode??o.DEFAULT_CONSENT_MODE),this.#f=e.isHeadless??!1,this.#C=t??new r.ConsentManager(this.#T,this.#M,this.#O),this.#A=this.isHeadless?null:new a.ConsentBannerFrontend(this.#C,e,this.onAcceptConsent.bind(this),this.onRejectConsent.bind(this))}get consentManager(){return this.#C}get isHeadless(){return this.#f||this.#D}get consentMode(){return this.#O}get trackingMode(){return this.#M}async onAcceptConsent(){await this.consentManager.setConsent(!0)}async onRejectConsent(){await this.consentManager.setConsent(!1),this.consentManager.clearDeviceCookie()}get#D(){return window.location.search.includes(o.SALESFORCE_EMBEDDED_PAGE_QUERYSTRING)}}t.ConsentBanner=c,o=c},45:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ConsentCookie=void 0;const o=n(792),i=n(251),s=n(95);class r{static DEFAULT_TTL_DAYS=365;#T;#k;#S;#I;constructor(e,t,n){this.#T=e,this.#k=t,this.#S=n??new Date,this.#I=o.Cookie.get(this.name)??new o.Cookie(this.name,!1)}get name(){return`sfmc_consent_${this.#T}`}get isExpired(){return!this.exists()||Date.parse(this.#I?.attributes?.expires??Date.now().toString()){Object.defineProperty(t,"__esModule",{value:!0}),t.ConsentManager=void 0;const o=n(127),i=n(112),s=n(792),r=n(45),a=n(11),c=n(806),l=n(168),u=n(540);class d{#T;#R;#M;#O;#C;#y;#v;static DEVICE_COOKIE_NAME="_sfid_";constructor(e,t,n,i=null){this.#T=e,this.#M=t,this.#O=n,this.#v=new l.DomainManager,this.#R=this.#v.getETLD(),this.#y=i??new r.ConsentCookie(this.#T,this.#R),this.#C=this.#M===o.ConsentBannerTrackingMode.DATA_CLOUD||this.#M===o.ConsentBannerTrackingMode.MARKETING_CLOUD?new a.DataCloudConsentManager(this.getCookieDomain()):new c.ExperienceServicesConsentManager(this.getCookieDomain())}hasConsent(){return this.#O===i.ConsentBannerConsentMode.NOT_REQUIRED||this.#y.exists()}async initConsent(){await this.waitForInitialization(),this.#O===i.ConsentBannerConsentMode.NOT_REQUIRED?this.getConsentManager().setConsent(!0):this.#y.exists()?this.getConsentManager().setConsent(this.#y.get()):this.getConsentManager().setConsent(!1)}getConsent(){return!!this.hasConsent()&&(this.#O===i.ConsentBannerConsentMode.NOT_REQUIRED||this.#y.get())}getCookieDomain(){return this.#R}getTimeout(){return 3e4}async setConsent(e){await this.waitForInitialization(),this.#y.set(e),this.getConsentManager().setConsent(e)}clearConsent(){this.#y.delete()}clearDeviceCookie(){let e=s.Cookie.getAll(d.DEVICE_COOKIE_NAME);for(let t of e){if(!t)continue;let e=new u.CookieAttributes;e.domain=this.#R,t=new s.Cookie(t.name,t.value,e),t.delete()}}getConsentManager(){return this.#C}waitForInitialization(){return new Promise(((e,t)=>{const n=Date.now(),o=()=>{if(this.getConsentManager().isInitialized())e();else{if(Date.now()-n>this.getTimeout())return void t(new Error("Consent manager initialization timed out after "+this.getTimeout()+" milliseconds"));setTimeout(o,100)}};o()}))}}t.ConsentManager=d},540:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CookieAttributes=void 0;const o=n(95);class i{static DOMAIN="domain";static EXPIRES="expires";static HTTP_ONLY="httponly";static PATH="path";static SAMESITE="samesite";static SECURE="secure";#L;#S;constructor(e){this.#L={},this.#S=e??new Date}get isInitialized(){return Object.keys(this.#L).length>0}get domain(){return this.#w(i.DOMAIN)}set domain(e){this.#N(i.DOMAIN,e)}get expires(){return this.#w(i.EXPIRES)}set expires(e){this.#N(i.EXPIRES,e)}set expiresSeconds(e){null!=e&&(this.#S.setTime(e*o.MILLISECONDS_PER_SECOND),this.#N(i.EXPIRES,this.#S.toUTCString()))}get httpOnly(){return Boolean(this.#w(i.HTTP_ONLY))}set httpOnly(e){this.#N(i.HTTP_ONLY,Boolean(e))}get path(){return this.#w(i.PATH)}set path(e){this.#N(i.PATH,e)}get sameSite(){return this.#w(i.SAMESITE)}set sameSite(e){this.#N(i.SAMESITE,e)}get secure(){return Boolean(this.#w(i.SECURE))}set secure(e){this.#N(i.SECURE,Boolean(e))}#w(e){return null!=this.#L&&Object.keys(this.#L).includes(e)?this.#L[e]:null}#N(e,t){null!=t&&(this.#L=this.#L??{},this.#L[e]=t)}}t.CookieAttributes=i},792:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UninitializedCookieError=t.Cookie=void 0;const o=n(540);class i extends Error{constructor(e){super(e)}}t.UninitializedCookieError=i;class s{#U;#L;#x;static get(e){let t=document.cookie.split("; ").find((t=>t.startsWith(e)))??null;return s.#B(t)}static getAll(e){let t=document.cookie.split("; ").filter((t=>t.startsWith(e)));return t.length>0?t.map((e=>s.#B(e))):[]}static exists(e){return null!==new RegExp(e+"=([^;]+)").exec(document.cookie)}static fromString(e){return s.#B(e)}static#B(e){if(null==e||""===e)return null;let t=Object.fromEntries(e.split("; ").map((e=>e.split(/=(.*)/s).map(decodeURIComponent)))),n=Object.keys(t),i=n[0]??null;if(null===i)return null;let r=null;return n.length>1&&(r=new o.CookieAttributes,r.domain=t[o.CookieAttributes.DOMAIN]??null,r.path=t[o.CookieAttributes.PATH]??null,r.expires=t[o.CookieAttributes.EXPIRES]??null,r.sameSite=t[o.CookieAttributes.SAMESITE]??null,r.secure=n.includes(o.CookieAttributes.SECURE)??null,r.httpOnly=n.includes(o.CookieAttributes.HTTP_ONLY)??null),new s(decodeURIComponent(i),decodeURIComponent(t[i]),r)}constructor(e,t,n){this.#U=e,this.#x=t,this.#L=n??new o.CookieAttributes}get name(){return this.#U}get value(){return this.#x}set value(e){this.#x=e}get attributes(){return this.#L}delete(){this.#L&&(this.#L.expiresSeconds=0),this.set()}set(){if(!this.#L.isInitialized)throw new i(`Refusing to write cookie named "${this.#U}" with uninitialized attributes.`);document.cookie=this.toString()}toString(){if(null===this.#U||null===this.#x)return"";let e=`${encodeURIComponent(this.#U)}=${encodeURIComponent(this.#x)}`;return null===this.#L||(null!==this.#L.domain&&(e+=`; ${o.CookieAttributes.DOMAIN}=${this.#L.domain}`),null!==this.#L.expires&&(e+=`; ${o.CookieAttributes.EXPIRES}=${this.#L.expires}`),this.#L.httpOnly&&(e+=`; ${o.CookieAttributes.HTTP_ONLY}`),null!==this.#L.path&&(e+=`; ${o.CookieAttributes.PATH}=${this.#L.path}`),null!==this.#L.sameSite&&(e+=`; ${o.CookieAttributes.SAMESITE}=${this.#L.sameSite}`),this.#L.secure&&(e+=`; ${o.CookieAttributes.SECURE}`)),e}}t.Cookie=s},11:function(e,t,n){var o=this&&this.__createBinding||(Object.create?function(e,t,n,o){void 0===o&&(o=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,o,i)}:function(e,t,n,o){void 0===o&&(o=n),e[o]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&o(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.DataCloudConsentManager=void 0;const r=s(n(56));t.DataCloudConsentManager=class{#R;constructor(e){this.#R=e}setConsent(e){if(!e)return!0;let t={provider:"Salesforce Marketing Cloud",purpose:r.ConsentPurpose.Tracking,status:e?r.ConsentStatus.OptIn:r.ConsentStatus.OptOut};return r.init({consents:[t],cookieDomain:this.#R??window.location.hostname}).then((()=>{})),!0}isInitialized(){return void 0!==window.SalesforceInteractions}}},168:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DomainManager=void 0;const o=n(792);class i{static PROBE_COOKIE_NAME="_sfmc_pc";static SALESFORCE_DOMAINS=[".site.com",".salesforce.com","salesforce-sites.com",".force.com",".lightning.com",".documentforce.com",".salesforce-communities.com",".salesforce-experience.com",".forceusercontent.com",".force-user-content.com",".salesforce-hub.com",".database.com",".cloudforce.com",".salesforcescrt.com",".salesforce-scrt.com",".my-salesforce.com",".my-lightning.com",".my-visualforce.com",".my-documentforce.com",".my-salesforce-hub.com",".my-salesforce-communities.com",".my-salesforce-community-builder.com",".my-salesforce-community-preview.com",".my-salesforce-community-live-preview.com",".my-lightning-container.com",".my-salesforce-sites.com",".my-salesforce-scrt.com",".my-force-user-content.com",".my-sfdcopens.com"];getETLD(){const e=window.location.hostname;if(this.isSalesforceDomain(e))return e;let t=new o.Cookie(i.PROBE_COOKIE_NAME,!0);try{const n=e.split(".");for(t.attributes.domain=n.pop()??"";n.length>0&&!o.Cookie.exists(t.name);)t.attributes.domain=n.pop()+"."+t.attributes.domain,t.set();return t.attributes.domain}finally{t.delete()}}isSalesforceDomain(e){return i.SALESFORCE_DOMAINS.some((t=>!!e.endsWith(t)))}}t.DomainManager=i},806:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExperienceServicesConsentManager=void 0,t.ExperienceServicesConsentManager=class{#R;constructor(e){this.#R=e}setConsent(e){return document.dispatchEvent(new CustomEvent("experience_interaction",{bubbles:!0,composed:!0,detail:{name:"set-cookie-domain",domain:this.#R}})),document.dispatchEvent(new CustomEvent("experience_interaction",{bubbles:!0,composed:!0,detail:{name:"set-consent",value:e}})),!0}isInitialized(){return void 0!==window.ExperienceTagManager}}},251:(e,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.SameSite=void 0,function(e){e.LAX="lax",e.STRICT="strict",e.NONE="none"}(n||(t.SameSite=n={}))},95:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SECONDS_PER_DAY=t.MILLISECONDS_PER_SECOND=void 0,t.MILLISECONDS_PER_SECOND=1e3,t.SECONDS_PER_DAY=86400},56:e=>{e.exports=window.SalesforceInteractions}},t={};function n(o){var i=t[o];if(void 0!==i)return i.exports;var s=t[o]={exports:{}};return e[o].call(s.exports,s,s.exports,n),s.exports}var o={};(()=>{var e=o;Object.defineProperty(e,"__esModule",{value:!0});const t=n(653),i=n(112),s=n(127),r=n(251);window.SalesforceInteractions=window.SalesforceInteractions||{},window.SalesforceInteractions.Marketing=window.SalesforceInteractions.Marketing||{},window.SalesforceInteractions.Marketing={...window.SalesforceInteractions.Marketing,ConsentBanner:t.ConsentBanner,ConsentBannerConsentMode:i.ConsentBannerConsentMode,ConsentBannerTrackingMode:s.ConsentBannerTrackingMode,SameSite:r.SameSite},document.dispatchEvent(new CustomEvent("consentbannerready",{bubbles:!0,composed:!0,detail:{library:"SalesforceInteractions.Marketing",timestamp:(new Date).toISOString()}}))})();var i=window;for(var s in o)i[s]=o[s];o.__esModule&&Object.defineProperty(i,"__esModule",{value:!0})})(); SalesforceInteractions.Marketing.consentBanner = new SalesforceInteractions.Marketing.ConsentBanner({ "allowButtonColor": "#B72A43", "allowButtonTextColor": "#FFFFFF", "bannerColor": "#FFFFFF", "bannerFontFamily": "sans-serif", "bannerMessage": "We use cookies to enhance your browsing experience, serve personalized content or ads, and analyze web traffic. By accepting, you consent to our use of cookies.", "bannerPosition": "bottom", "bannerTextColor": "#000000", "consentMode": "NOT_REQUIRED", "declineButtonColor": "#8C909D", "declineButtonTextColor": "#FFFFFF", "infoText": "Legal Notices", "infoUrl": "https://helvar.com/legal-notices/", "isHeadless": false, "isSalesforceDomain": false, "orgId": "00D1t000000pssE", "privacyPolicyText": "Privacy Statement", "privacyPolicyUrl": "https://helvar.com/legal-notices/#privacy", "trackingMode": "MARKETING_CLOUD" }); } catch (e) { console.error("[Salesforce consent-banner] Error initializing module: consent-banner", e); } })(); // SITEMAP AND INIT try { (function () { // 1. Safety: If Complianz blocked the library, exit immediately. if (typeof SalesforceInteractions === 'undefined') return; // 2. Prevent Multiple Runs (Fixes "New ID on every click") if (window.salesforce_started_this_session) return; // 3. Configuration var sdkConfig = { cookieDomain: "helvar.com", consents: [{ provider: "Salesforce Marketing Cloud", purpose: "Tracking", status: SalesforceInteractions.ConsentStatus.OptIn }] }; var sitemapConfig = { global: {}, pageTypeDefault: { name: "default", interaction: { name: "Default Page View" } }, pageTypes: [ { name: "home", isMatch: () => window.location.pathname === "/", interaction: { name: "Home Page View" } } ] }; // 4. Execution Logic // We use .init() for everything because it is stable. // We use .catch() to silently ignore errors if the SDK gets confused by the re-accept. SalesforceInteractions.init(sdkConfig).then(() => { SalesforceInteractions.initSitemap(sitemapConfig); window.salesforce_started_this_session = true; }).catch((err) => { window.salesforce_started_this_session = true; }); })() } catch (e) { // Silent fail }