@robylon/web-react-sdk 1.1.51-staging.9 → 1.1.52-staging.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -120,6 +120,7 @@ export interface ProactiveMessage {
120
120
  message: string;
121
121
  content_id?: string;
122
122
  message_display_type?: MessageDisplayType;
123
+ message_bubble_bg?: string;
123
124
  message_display_attributes: (ContentDisplayAttribute | LogicalConditionAttribute)[];
124
125
  }[];
125
126
  }
@@ -19,5 +19,6 @@ export interface VisibleContent {
19
19
  delayMs: number;
20
20
  contentId: string | null;
21
21
  messageDisplayType: MessageDisplayType;
22
+ messageBubbleBg?: string;
22
23
  }
23
24
  export declare const evaluateProactiveMessages: (messages?: ProactiveMessage[]) => VisibleContent[];
package/dist/index.d.ts CHANGED
@@ -173,6 +173,7 @@ interface ProactiveMessage {
173
173
  message: string;
174
174
  content_id?: string;
175
175
  message_display_type?: MessageDisplayType;
176
+ message_bubble_bg?: string;
176
177
  message_display_attributes: (ContentDisplayAttribute | LogicalConditionAttribute)[];
177
178
  }[];
178
179
  }
@@ -1,2 +1,2 @@
1
- !function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((t="undefined"!=typeof globalThis?globalThis:t||self).RobylonChatbot={})}(this,(function(t){"use strict";var i,n,e,o,r,a,l,s,u=function(){return u=Object.assign||function(t){for(var i,n=1,e=arguments.length;e>n;n++)for(var o in i=arguments[n])({}).hasOwnProperty.call(i,o)&&(t[o]=i[o]);return t},u.apply(this,arguments)};function d(t,i,n,e){return new(n||(n=Promise))((function(o,r){function a(t){try{s(e.next(t))}catch(t){r(t)}}function l(t){try{s(e.throw(t))}catch(t){r(t)}}function s(t){var i;t.done?o(t.value):(i=t.value,i instanceof n?i:new n((function(t){t(i)}))).then(a,l)}s((e=e.apply(t,i||[])).next())}))}function c(t,i){var n,e,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(l){return function(s){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(r=0)),r;)try{if(n=1,e&&(o=2&l[0]?e.return:l[0]?e.throw||((o=e.return)&&o.call(e),0):e.next)&&!(o=o.call(e,l[1])).done)return o;switch(e=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,e=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(!((o=(o=r.trys).length>0&&o[o.length-1])||6!==l[0]&&2!==l[0])){r=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){r.label=l[1];break}if(6===l[0]&&r.label<o[1]){r.label=o[1],o=l;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(l);break}o[2]&&r.ops.pop(),r.trys.pop();continue}l=i.call(t,r)}catch(t){l=[6,t],e=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,s])}}}"function"==typeof SuppressedError&&SuppressedError,function(t){t.WIDGET="WIDGET",t.POPOVER="POPOVER",t.EMBED="EMBED"}(i||(i={})),function(t){t.RIGHT="Right",t.LEFT="Left"}(n||(n={})),function(t){t.TEXT="TEXT",t.IMAGE="IMAGE",t.TEXTUAL_IMAGE="TEXTUAL_IMAGE"}(e||(e={})),function(t){t.WORKING_HOURS="WORKING_HOURS",t.ALWAYS="ALWAYS"}(o||(o={})),function(t){t.URL="URL"}(r||(r={})),function(t){t.AND="AND",t.OR="OR"}(a||(a={})),function(t){t.IS="IS",t.IS_NOT="IS_NOT",t.CONTAINS="CONTAINS",t.DOES_NOT_CONTAIN="DOES_NOT_CONTAIN",t.STARTS_WITH="STARTS_WITH",t.ENDS_WITH="ENDS_WITH"}(l||(l={})),function(t){t.BUTTON="BUTTON",t.TEXT="TEXT"}(s||(s={}));var f=function(t,i){void 0===i&&(i=.5);var n,e,o,r,a=function(t){t=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(t,i,n,e){return i+i+n+n+e+e}));var i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return i?{r:parseInt(i[1],16),g:parseInt(i[2],16),b:parseInt(i[3],16)}:{r:0,g:0,b:0}}(t);return(n=a.r,e=a.g,o=a.b,.2126*(r=[n,e,o].map((function(t){return(t/=255)>.03928?Math.pow((t+.055)/1.055,2.4):t/12.92})))[0]+.7152*r[1]+.0722*r[2])>i?"#0E0E0F":"#FFFFFF"},h={log:function(){for(var t=[],i=0;arguments.length>i;i++)t[i]=arguments[i];console.log.apply(console,t)},error:function(){for(var t=[],i=0;arguments.length>i;i++)t[i]=arguments[i];console.error.apply(console,t)},warn:function(){for(var t=[],i=0;arguments.length>i;i++)t[i]=arguments[i];console.warn.apply(console,t)},info:function(){}};h.log("Raw API_URL:","https://stage-api.robylon.ai");var v={copilotUrl:"https://staging.d2s3wsqyyond1h.amplifyapp.com",environment:"staging",apiUrl:"https://stage-api.robylon.ai"};h.log("CONFIG",v);var p,m,g=function(){return"undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement},b=function(){return{copilotUrl:v.copilotUrl||"https://app.robylon.ai",environment:v.environment||"production",apiUrl:v.apiUrl||"https://app.robylon.ai"}};!function(t){t.CHATBOT_BUTTON_LOADED="CHATBOT_BUTTON_LOADED",t.CHATBOT_BUTTON_CLICKED="CHATBOT_BUTTON_CLICKED",t.CHATBOT_OPENED="CHATBOT_OPENED",t.CHATBOT_CLOSED="CHATBOT_CLOSED",t.CHATBOT_APP_READY="CHATBOT_APP_READY",t.CHATBOT_LOADED="CHATBOT_LOADED",t.CHAT_INITIALIZED="CHAT_INITIALIZED",t.SESSION_REFRESHED="SESSION_REFRESHED",t.CHAT_INITIALIZATION_FAILED="CHAT_INITIALIZATION_FAILED",t.CHATBOT_READY="CHATBOT_READY"}(p||(p={})),function(t){t.CHAT_MOVED="CHAT_MOVED",t.CHATBOT_TOKEN_EXHAUSTED="CHATBOT_TOKEN_EXHAUSTED"}(m||(m={}));var w,y="system-ui, Inter, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'",x="21px",_="",I=[],T=!1,E=function(){return"undefined"==typeof window?"":window.location.href},S=function(){return E()},A=function(){var t=E();t!==_&&(_=t,I.forEach((function(i){return i(t)})))},R=function(t,i,n,e){var o=i||"",r=E(),a=e||r,s=function(t,i){return-1!==i.indexOf(t)}(o,a);switch(n){case l.IS:return a===o;case l.IS_NOT:return a!==o;case l.CONTAINS:return s;case l.DOES_NOT_CONTAIN:return!s;case l.STARTS_WITH:return a.startsWith(o);case l.ENDS_WITH:return a.endsWith(o);default:return!1}},k=null,O=null,D=function(){return k===S()},C=function(){return!0},z=((w={})[o.WORKING_HOURS]=function(t,i){var n=i.getHours(),e=i.getMinutes();return(n>10||10===n&&e>=0)&&(19>n||19===n&&0===e)},w[o.ALWAYS]=C,w);const{entries:F,setPrototypeOf:N,isFrozen:M,getPrototypeOf:j,getOwnPropertyDescriptor:L}=Object;let{freeze:U,seal:P,create:W}=Object,{apply:B,construct:H}="undefined"!=typeof Reflect&&Reflect;U||(U=function(t){return t}),P||(P=function(t){return t}),B||(B=function(t,i){for(var n=arguments.length,e=Array(n>2?n-2:0),o=2;n>o;o++)e[o-2]=arguments[o];return t.apply(i,e)}),H||(H=function(t){for(var i=arguments.length,n=Array(i>1?i-1:0),e=1;i>e;e++)n[e-1]=arguments[e];return new t(...n)});const Y=rt([].forEach),X=rt([].lastIndexOf),J=rt([].pop),G=rt([].push),K=rt([].splice),Z=rt("".toLowerCase),V=rt("".toString),q=rt("".match),Q=rt("".replace),$=rt("".indexOf),tt=rt("".trim),it=rt({}.hasOwnProperty),nt=rt(/t/.test),et=(ot=TypeError,function(){for(var t=arguments.length,i=Array(t),n=0;t>n;n++)i[n]=arguments[n];return H(ot,i)});var ot;function rt(t){return function(i){i instanceof RegExp&&(i.lastIndex=0);for(var n=arguments.length,e=Array(n>1?n-1:0),o=1;n>o;o++)e[o-1]=arguments[o];return B(t,i,e)}}function at(t,i){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Z;N&&N(t,null);let e=i.length;for(;e--;){let o=i[e];if("string"==typeof o){const t=n(o);t!==o&&(M(i)||(i[e]=t),o=t)}t[o]=!0}return t}function lt(t){for(let i=0;i<t.length;i++)it(t,i)||(t[i]=null);return t}function st(t){const i=W(null);for(const[n,e]of F(t))it(t,n)&&(Array.isArray(e)?i[n]=lt(e):e&&"object"==typeof e&&e.constructor===Object?i[n]=st(e):i[n]=e);return i}function ut(t,i){for(;null!==t;){const n=L(t,i);if(n){if(n.get)return rt(n.get);if("function"==typeof n.value)return rt(n.value)}t=j(t)}return function(){return null}}const dt=U(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ct=U(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ft=U(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),ht=U(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),vt=U(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),pt=U(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),mt=U(["#text"]),gt=U(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),bt=U(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),wt=U(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),yt=U(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),xt=P(/\{\{[\w\W]*|[\w\W]*\}\}/gm),_t=P(/<%[\w\W]*|[\w\W]*%>/gm),It=P(/\$\{[\w\W]*/gm),Tt=P(/^data-[\-\w.\u00B7-\uFFFF]+$/),Et=P(/^aria-[\-\w]+$/),St=P(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),At=P(/^(?:\w+script|data):/i),Rt=P(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),kt=P(/^html$/i),Ot=P(/^[a-z][.\w]*(-[.\w]+)+$/i);var Dt=Object.freeze({__proto__:null,ARIA_ATTR:Et,ATTR_WHITESPACE:Rt,CUSTOM_ELEMENT:Ot,DATA_ATTR:Tt,DOCTYPE_NAME:kt,ERB_EXPR:_t,IS_ALLOWED_URI:St,IS_SCRIPT_OR_DATA:At,MUSTACHE_EXPR:xt,TMPLIT_EXPR:It});const Ct=function(){return"undefined"==typeof window?null:window};var zt,Ft=function t(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ct();const n=i=>t(i);if(n.version="3.3.0",n.removed=[],!i||!i.document||9!==i.document.nodeType||!i.Element)return n.isSupported=!1,n;let{document:e}=i;const o=e,r=o.currentScript,{DocumentFragment:a,HTMLTemplateElement:l,Node:s,Element:u,NodeFilter:d,NamedNodeMap:c=i.NamedNodeMap||i.MozNamedAttrMap,HTMLFormElement:f,DOMParser:h,trustedTypes:v}=i,p=u.prototype,m=ut(p,"cloneNode"),g=ut(p,"remove"),b=ut(p,"nextSibling"),w=ut(p,"childNodes"),y=ut(p,"parentNode");if("function"==typeof l){const t=e.createElement("template");t.content&&t.content.ownerDocument&&(e=t.content.ownerDocument)}let x,_="";const{implementation:I,createNodeIterator:T,createDocumentFragment:E,getElementsByTagName:S}=e,{importNode:A}=o;let R={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof F&&"function"==typeof y&&I&&void 0!==I.createHTMLDocument;const{MUSTACHE_EXPR:k,ERB_EXPR:O,TMPLIT_EXPR:D,DATA_ATTR:C,ARIA_ATTR:z,IS_SCRIPT_OR_DATA:N,ATTR_WHITESPACE:M,CUSTOM_ELEMENT:j}=Dt;let{IS_ALLOWED_URI:L}=Dt,P=null;const B=at({},[...dt,...ct,...ft,...vt,...mt]);let H=null;const ot=at({},[...gt,...bt,...wt,...yt]);let rt=Object.seal(W(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),lt=null,xt=null;const _t=Object.seal(W(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let It=!0,Tt=!0,Et=!1,At=!0,Rt=!1,Ot=!0,zt=!1,Ft=!1,Nt=!1,Mt=!1,jt=!1,Lt=!1,Ut=!0,Pt=!1,Wt=!0,Bt=!1,Ht={},Yt=null;const Xt=at({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Jt=null;const Gt=at({},["audio","video","img","source","image","track"]);let Kt=null;const Zt=at({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Vt="http://www.w3.org/1998/Math/MathML",qt="http://www.w3.org/2000/svg",Qt="http://www.w3.org/1999/xhtml";let $t=Qt,ti=!1,ii=null;const ni=at({},[Vt,qt,Qt],V);let ei=at({},["mi","mo","mn","ms","mtext"]),oi=at({},["annotation-xml"]);const ri=at({},["title","style","font","a","script"]);let ai=null;const li=["application/xhtml+xml","text/html"];let si=null,ui=null;const di=e.createElement("form"),ci=function(t){return t instanceof RegExp||t instanceof Function},fi=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!ui||ui!==t){if(t&&"object"==typeof t||(t={}),t=st(t),ai=-1===li.indexOf(t.PARSER_MEDIA_TYPE)?"text/html":t.PARSER_MEDIA_TYPE,si="application/xhtml+xml"===ai?V:Z,P=it(t,"ALLOWED_TAGS")?at({},t.ALLOWED_TAGS,si):B,H=it(t,"ALLOWED_ATTR")?at({},t.ALLOWED_ATTR,si):ot,ii=it(t,"ALLOWED_NAMESPACES")?at({},t.ALLOWED_NAMESPACES,V):ni,Kt=it(t,"ADD_URI_SAFE_ATTR")?at(st(Zt),t.ADD_URI_SAFE_ATTR,si):Zt,Jt=it(t,"ADD_DATA_URI_TAGS")?at(st(Gt),t.ADD_DATA_URI_TAGS,si):Gt,Yt=it(t,"FORBID_CONTENTS")?at({},t.FORBID_CONTENTS,si):Xt,lt=it(t,"FORBID_TAGS")?at({},t.FORBID_TAGS,si):st({}),xt=it(t,"FORBID_ATTR")?at({},t.FORBID_ATTR,si):st({}),Ht=!!it(t,"USE_PROFILES")&&t.USE_PROFILES,It=!1!==t.ALLOW_ARIA_ATTR,Tt=!1!==t.ALLOW_DATA_ATTR,Et=t.ALLOW_UNKNOWN_PROTOCOLS||!1,At=!1!==t.ALLOW_SELF_CLOSE_IN_ATTR,Rt=t.SAFE_FOR_TEMPLATES||!1,Ot=!1!==t.SAFE_FOR_XML,zt=t.WHOLE_DOCUMENT||!1,Mt=t.RETURN_DOM||!1,jt=t.RETURN_DOM_FRAGMENT||!1,Lt=t.RETURN_TRUSTED_TYPE||!1,Nt=t.FORCE_BODY||!1,Ut=!1!==t.SANITIZE_DOM,Pt=t.SANITIZE_NAMED_PROPS||!1,Wt=!1!==t.KEEP_CONTENT,Bt=t.IN_PLACE||!1,L=t.ALLOWED_URI_REGEXP||St,$t=t.NAMESPACE||Qt,ei=t.MATHML_TEXT_INTEGRATION_POINTS||ei,oi=t.HTML_INTEGRATION_POINTS||oi,rt=t.CUSTOM_ELEMENT_HANDLING||{},t.CUSTOM_ELEMENT_HANDLING&&ci(t.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(rt.tagNameCheck=t.CUSTOM_ELEMENT_HANDLING.tagNameCheck),t.CUSTOM_ELEMENT_HANDLING&&ci(t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(rt.attributeNameCheck=t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),t.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(rt.allowCustomizedBuiltInElements=t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Rt&&(Tt=!1),jt&&(Mt=!0),Ht&&(P=at({},mt),H=[],!0===Ht.html&&(at(P,dt),at(H,gt)),!0===Ht.svg&&(at(P,ct),at(H,bt),at(H,yt)),!0===Ht.svgFilters&&(at(P,ft),at(H,bt),at(H,yt)),!0===Ht.mathMl&&(at(P,vt),at(H,wt),at(H,yt))),t.ADD_TAGS&&("function"==typeof t.ADD_TAGS?_t.tagCheck=t.ADD_TAGS:(P===B&&(P=st(P)),at(P,t.ADD_TAGS,si))),t.ADD_ATTR&&("function"==typeof t.ADD_ATTR?_t.attributeCheck=t.ADD_ATTR:(H===ot&&(H=st(H)),at(H,t.ADD_ATTR,si))),t.ADD_URI_SAFE_ATTR&&at(Kt,t.ADD_URI_SAFE_ATTR,si),t.FORBID_CONTENTS&&(Yt===Xt&&(Yt=st(Yt)),at(Yt,t.FORBID_CONTENTS,si)),Wt&&(P["#text"]=!0),zt&&at(P,["html","head","body"]),P.table&&(at(P,["tbody"]),delete lt.tbody),t.TRUSTED_TYPES_POLICY){if("function"!=typeof t.TRUSTED_TYPES_POLICY.createHTML)throw et('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof t.TRUSTED_TYPES_POLICY.createScriptURL)throw et('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');x=t.TRUSTED_TYPES_POLICY,_=x.createHTML("")}else void 0===x&&(x=function(t,i){if("object"!=typeof t||"function"!=typeof t.createPolicy)return null;let n=null;const e="data-tt-policy-suffix";i&&i.hasAttribute(e)&&(n=i.getAttribute(e));const o="dompurify"+(n?"#"+n:"");try{return t.createPolicy(o,{createHTML:t=>t,createScriptURL:t=>t})}catch(t){return console.warn("TrustedTypes policy "+o+" could not be created."),null}}(v,r)),null!==x&&"string"==typeof _&&(_=x.createHTML(""));U&&U(t),ui=t}},hi=at({},[...ct,...ft,...ht]),vi=at({},[...vt,...pt]),pi=function(t){G(n.removed,{element:t});try{y(t).removeChild(t)}catch(i){g(t)}},mi=function(t,i){try{G(n.removed,{attribute:i.getAttributeNode(t),from:i})}catch(t){G(n.removed,{attribute:null,from:i})}if(i.removeAttribute(t),"is"===t)if(Mt||jt)try{pi(i)}catch(t){}else try{i.setAttribute(t,"")}catch(t){}},gi=function(t){let i=null,n=null;if(Nt)t="<remove></remove>"+t;else{const i=q(t,/^[\r\n\t ]+/);n=i&&i[0]}"application/xhtml+xml"===ai&&$t===Qt&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");const o=x?x.createHTML(t):t;if($t===Qt)try{i=(new h).parseFromString(o,ai)}catch(t){}if(!i||!i.documentElement){i=I.createDocument($t,"template",null);try{i.documentElement.innerHTML=ti?_:o}catch(t){}}const r=i.body||i.documentElement;return t&&n&&r.insertBefore(e.createTextNode(n),r.childNodes[0]||null),$t===Qt?S.call(i,zt?"html":"body")[0]:zt?i.documentElement:r},bi=function(t){return T.call(t.ownerDocument||t,t,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},wi=function(t){return t instanceof f&&("string"!=typeof t.nodeName||"string"!=typeof t.textContent||"function"!=typeof t.removeChild||!(t.attributes instanceof c)||"function"!=typeof t.removeAttribute||"function"!=typeof t.setAttribute||"string"!=typeof t.namespaceURI||"function"!=typeof t.insertBefore||"function"!=typeof t.hasChildNodes)},yi=function(t){return"function"==typeof s&&t instanceof s};function xi(t,i,e){Y(t,(t=>{t.call(n,i,e,ui)}))}const _i=function(t){let i=null;if(xi(R.beforeSanitizeElements,t,null),wi(t))return pi(t),!0;const e=si(t.nodeName);if(xi(R.uponSanitizeElement,t,{tagName:e,allowedTags:P}),Ot&&t.hasChildNodes()&&!yi(t.firstElementChild)&&nt(/<[/\w!]/g,t.innerHTML)&&nt(/<[/\w!]/g,t.textContent))return pi(t),!0;if(7===t.nodeType)return pi(t),!0;if(Ot&&8===t.nodeType&&nt(/<[/\w]/g,t.data))return pi(t),!0;if(!(_t.tagCheck instanceof Function&&_t.tagCheck(e))&&(!P[e]||lt[e])){if(!lt[e]&&Ti(e)){if(rt.tagNameCheck instanceof RegExp&&nt(rt.tagNameCheck,e))return!1;if(rt.tagNameCheck instanceof Function&&rt.tagNameCheck(e))return!1}if(Wt&&!Yt[e]){const i=y(t)||t.parentNode,n=w(t)||t.childNodes;if(n&&i)for(let e=n.length-1;e>=0;--e){const o=m(n[e],!0);o.t=(t.t||0)+1,i.insertBefore(o,b(t))}}return pi(t),!0}return t instanceof u&&!function(t){let i=y(t);i&&i.tagName||(i={namespaceURI:$t,tagName:"template"});const n=Z(t.tagName),e=Z(i.tagName);return!!ii[t.namespaceURI]&&(t.namespaceURI===qt?i.namespaceURI===Qt?"svg"===n:i.namespaceURI===Vt?"svg"===n&&("annotation-xml"===e||ei[e]):!!hi[n]:t.namespaceURI===Vt?i.namespaceURI===Qt?"math"===n:i.namespaceURI===qt?"math"===n&&oi[e]:!!vi[n]:t.namespaceURI===Qt?!(i.namespaceURI===qt&&!oi[e])&&!(i.namespaceURI===Vt&&!ei[e])&&!vi[n]&&(ri[n]||!hi[n]):!("application/xhtml+xml"!==ai||!ii[t.namespaceURI]))}(t)?(pi(t),!0):"noscript"!==e&&"noembed"!==e&&"noframes"!==e||!nt(/<\/no(script|embed|frames)/i,t.innerHTML)?(Rt&&3===t.nodeType&&(i=t.textContent,Y([k,O,D],(t=>{i=Q(i,t," ")})),t.textContent!==i&&(G(n.removed,{element:t.cloneNode()}),t.textContent=i)),xi(R.afterSanitizeElements,t,null),!1):(pi(t),!0)},Ii=function(t,i,n){if(Ut&&("id"===i||"name"===i)&&(n in e||n in di))return!1;if(Tt&&!xt[i]&&nt(C,i));else if(It&&nt(z,i));else if(_t.attributeCheck instanceof Function&&_t.attributeCheck(i,t));else if(!H[i]||xt[i]){if(!(Ti(t)&&(rt.tagNameCheck instanceof RegExp&&nt(rt.tagNameCheck,t)||rt.tagNameCheck instanceof Function&&rt.tagNameCheck(t))&&(rt.attributeNameCheck instanceof RegExp&&nt(rt.attributeNameCheck,i)||rt.attributeNameCheck instanceof Function&&rt.attributeNameCheck(i,t))||"is"===i&&rt.allowCustomizedBuiltInElements&&(rt.tagNameCheck instanceof RegExp&&nt(rt.tagNameCheck,n)||rt.tagNameCheck instanceof Function&&rt.tagNameCheck(n))))return!1}else if(Kt[i]);else if(nt(L,Q(n,M,"")));else if("src"!==i&&"xlink:href"!==i&&"href"!==i||"script"===t||0!==$(n,"data:")||!Jt[t])if(Et&&!nt(N,Q(n,M,"")));else if(n)return!1;return!0},Ti=function(t){return"annotation-xml"!==t&&q(t,j)},Ei=function(t){xi(R.beforeSanitizeAttributes,t,null);const{attributes:i}=t;if(!i||wi(t))return;const e={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:H,forceKeepAttr:void 0};let o=i.length;for(;o--;){const r=i[o],{name:a,namespaceURI:l,value:s}=r,u=si(a),d=s;let c="value"===a?d:tt(d);if(e.attrName=u,e.attrValue=c,e.keepAttr=!0,e.forceKeepAttr=void 0,xi(R.uponSanitizeAttribute,t,e),c=e.attrValue,!Pt||"id"!==u&&"name"!==u||(mi(a,t),c="user-content-"+c),Ot&&nt(/((--!?|])>)|<\/(style|title|textarea)/i,c)){mi(a,t);continue}if("attributename"===u&&q(c,"href")){mi(a,t);continue}if(e.forceKeepAttr)continue;if(!e.keepAttr){mi(a,t);continue}if(!At&&nt(/\/>/i,c)){mi(a,t);continue}Rt&&Y([k,O,D],(t=>{c=Q(c,t," ")}));const f=si(t.nodeName);if(Ii(f,u,c)){if(x&&"object"==typeof v&&"function"==typeof v.getAttributeType)if(l);else switch(v.getAttributeType(f,u)){case"TrustedHTML":c=x.createHTML(c);break;case"TrustedScriptURL":c=x.createScriptURL(c)}if(c!==d)try{l?t.setAttributeNS(l,a,c):t.setAttribute(a,c),wi(t)?pi(t):J(n.removed)}catch(i){mi(a,t)}}else mi(a,t)}xi(R.afterSanitizeAttributes,t,null)},Si=function t(i){let n=null;const e=bi(i);for(xi(R.beforeSanitizeShadowDOM,i,null);n=e.nextNode();)xi(R.uponSanitizeShadowNode,n,null),_i(n),Ei(n),n.content instanceof a&&t(n.content);xi(R.afterSanitizeShadowDOM,i,null)};return n.sanitize=function(t){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=null,r=null,l=null,u=null;if(ti=!t,ti&&(t="\x3c!--\x3e"),"string"!=typeof t&&!yi(t)){if("function"!=typeof t.toString)throw et("toString is not a function");if("string"!=typeof(t=t.toString()))throw et("dirty is not a string, aborting")}if(!n.isSupported)return t;if(Ft||fi(i),n.removed=[],"string"==typeof t&&(Bt=!1),Bt){if(t.nodeName){const i=si(t.nodeName);if(!P[i]||lt[i])throw et("root node is forbidden and cannot be sanitized in-place")}}else if(t instanceof s)e=gi("\x3c!----\x3e"),r=e.ownerDocument.importNode(t,!0),1===r.nodeType&&"BODY"===r.nodeName||"HTML"===r.nodeName?e=r:e.appendChild(r);else{if(!Mt&&!Rt&&!zt&&-1===t.indexOf("<"))return x&&Lt?x.createHTML(t):t;if(e=gi(t),!e)return Mt?null:Lt?_:""}e&&Nt&&pi(e.firstChild);const d=bi(Bt?t:e);for(;l=d.nextNode();)_i(l),Ei(l),l.content instanceof a&&Si(l.content);if(Bt)return t;if(Mt){if(jt)for(u=E.call(e.ownerDocument);e.firstChild;)u.appendChild(e.firstChild);else u=e;return(H.shadowroot||H.shadowrootmode)&&(u=A.call(o,u,!0)),u}let c=zt?e.outerHTML:e.innerHTML;return zt&&P["!doctype"]&&e.ownerDocument&&e.ownerDocument.doctype&&e.ownerDocument.doctype.name&&nt(kt,e.ownerDocument.doctype.name)&&(c="<!DOCTYPE "+e.ownerDocument.doctype.name+">\n"+c),Rt&&Y([k,O,D],(t=>{c=Q(c,t," ")})),x&&Lt?x.createHTML(c):c},n.setConfig=function(){fi(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Ft=!0},n.clearConfig=function(){ui=null,Ft=!1},n.isValidAttribute=function(t,i,n){ui||fi({});const e=si(t),o=si(i);return Ii(e,o,n)},n.addHook=function(t,i){"function"==typeof i&&G(R[t],i)},n.removeHook=function(t,i){if(void 0!==i){const n=X(R[t],i);return-1===n?void 0:K(R[t],n,1)[0]}return J(R[t])},n.removeHooks=function(t){R[t]=[]},n.removeAllHooks=function(){R={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}(),Nt=function(){function t(t){var i,n=this;this.resizeObserver=null,this.proactiveElement=null,this.urlUnsubscribe=null,this.delayTimers=[],this.config=t,this.buttonElement=document.createElement("div"),this.handleResizeFunction=this.handleResize.bind(this),this.render(),this.mount();try{this.buttonElement.style.opacity="0",this.buttonElement.style.transition="transform 0.2s cubic-bezier(0.2, 1.27, 0.29, 0.97), opacity 280ms ease",requestAnimationFrame((function(){n.buttonElement.style.opacity="1"}))}catch(t){}this.setupResizeListener(),this.renderProactiveIfNeeded(),this.urlUnsubscribe=(i=function(){n.clearProactiveDelays(),n.renderProactiveIfNeeded(!0)},T||function(){if(!T&&"undefined"!=typeof window){T=!0,_=E();var t=function(t){var i=history[t];return function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];var e=i.apply(this,t);return setTimeout(A,0),e}};try{history.pushState=t("pushState"),history.replaceState=t("replaceState")}catch(t){}window.addEventListener("popstate",A),window.addEventListener("hashchange",A);var i=setInterval((function(){A()}),1e3);setInterval((function(){0===I.length&&(clearInterval(i),window.removeEventListener("popstate",A),window.removeEventListener("hashchange",A),T=!1)}),5e3)}}(),I.push(i),i(E()),function(){var t=I.indexOf(i);t>-1&&I.splice(t,1)})}return t.prototype.render=function(){var t,i=this;b().copilotUrl;var n=this.config,o=n.config,r=n.isIframeVisible,a=null!==(t=this.config.launcher_size)&&void 0!==t?t:48,l={zIndex:"1000",display:"flex",flexDirection:"column-reverse",alignItems:"center",justifyContent:"center",cursor:"pointer",overflow:"hidden",marginTop:"16px",transition:"transform 0.2s cubic-bezier(0.2, 1.27, 0.29, 0.97)",transform:r?"scale(0.85)":"scale(1)",fontFamily:y};o.launcher_type===e.IMAGE&&Object.assign(l,{width:"".concat(a,"px"),height:"".concat(a,"px"),borderRadius:"50%",backgroundColor:o.brand_colour}),this.applyResponsiveStyles(l),this.buttonElement.className="message-bubble-container",this.buttonElement.innerHTML="",this.buttonElement.appendChild(this.createLauncherElement()),this.buttonElement.onclick=function(){i.config.toggleIframe(),i.hideProactiveMessages()},this.renderProactiveIfNeeded()},t.prototype.createLauncherElement=function(){var t,i,n,o=this.config,r=o.config,a=o.isIframeVisible,l=b().copilotUrl,s=null!==(t=this.config.launcher_size)&&void 0!==t?t:48;switch(console.log("config in floating button",r),r.launcher_type){case e.TEXT:return this.createTextLauncher();case e.TEXTUAL_IMAGE:return this.createTextualImageLauncher();case e.IMAGE:default:if(a){var u=Math.round(.5*s),d=document.createElement("div");Object.assign(d.style,{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%"});var c=document.createElementNS("http://www.w3.org/2000/svg","svg");c.setAttribute("width",u+""),c.setAttribute("height",u+""),c.setAttribute("viewBox","0 0 24 24"),c.setAttribute("fill","none"),c.setAttribute("xmlns","http://www.w3.org/2000/svg"),c.style.display="block";var f=document.createElementNS("http://www.w3.org/2000/svg","path");return f.setAttribute("d","M19 9L12 16L5 9"),f.setAttribute("stroke","currentColor"),f.setAttribute("stroke-width","1.5"),f.setAttribute("stroke-linecap","round"),f.setAttribute("stroke-linejoin","round"),c.appendChild(f),d.appendChild(c),d}var h=document.createElement("img");return h.src=r.launcher_type?(null===(n=null===(i=r.images)||void 0===i?void 0:i.launcher_image_url)||void 0===n?void 0:n.url)||"".concat(l,"/chatbubble.png"):r.image_url||"".concat(l,"/chatbubble.png"),h.alt="Chat",Object.assign(h.style,{zIndex:"1000",cursor:"pointer",borderRadius:"50%",objectFit:"cover",width:"100%",height:"100%",boxSizing:"border-box"}),h}},t.prototype.createTextLauncher=function(){var t=this.config.config,i=t.brand_colour,n=t.launcher_properties,e=document.createElement("div");Object.assign(e.style,{width:"fit-content",maxWidth:"160px",height:"40px",borderRadius:"9999px",backgroundColor:i,display:"flex",alignItems:"center",padding:"9px 20px",boxShadow:"0px 0px 16px 0px rgba(0, 0, 0, 0.24)",boxSizing:"border-box"});var o=document.createElement("div");Object.assign(o.style,{flex:"1",minWidth:"0"});var r=document.createElement("p");return Object.assign(r.style,{margin:"0",color:f(i),fontSize:"0.875rem",fontWeight:"600",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:x,fontFamily:y,WebkitFontSmoothing:"antialiased",textRendering:"optimizeLegibility",textSizeAdjust:"100%"}),r.textContent=(null==n?void 0:n.text)||"",o.appendChild(r),e.appendChild(o),e},t.prototype.createTextualImageLauncher=function(){var t,i,n,e,o,r,a=b().copilotUrl,l=this.config.config,s=l.brand_colour,u=l.launcher_properties,d=l.image_url,c=document.createElement("div");Object.assign(c.style,{maxWidth:"13rem",width:"fit-content",height:"40px",borderRadius:"9999px",backgroundColor:s,display:"flex",alignItems:"center",paddingLeft:"20px",paddingRight:"0",paddingTop:"9px",paddingBottom:"9px",boxShadow:"0px 0px 16px 0px rgba(0, 0, 0, 0.24)",gap:"8px",boxSizing:"border-box"});var h=document.createElement("div");Object.assign(h.style,{flex:"1",minWidth:"0"});var v=document.createElement("p");Object.assign(v.style,{margin:"0",color:f(s),fontSize:"0.875rem",fontWeight:"600",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:x,fontFamily:y,WebkitFontSmoothing:"antialiased",textRendering:"optimizeLegibility",textSizeAdjust:"100%"}),v.textContent=(null==u?void 0:u.text)||"";var p=document.createElement("div");Object.assign(p.style,{width:"40px",height:"40px",borderRadius:"9999px",overflow:"hidden",position:"relative",flexShrink:"0"});var m=document.createElement("img");return m.src=(null===(i=null===(t=null==this?void 0:this.config)||void 0===t?void 0:t.config)||void 0===i?void 0:i.launcher_type)?(null===(r=null===(o=null===(e=null===(n=null==this?void 0:this.config)||void 0===n?void 0:n.config)||void 0===e?void 0:e.images)||void 0===o?void 0:o.launcher_image_url)||void 0===r?void 0:r.url)||"".concat(a,"/chatbubble.png"):d||"".concat(a,"/chatbubble.png"),m.alt="Chat",Object.assign(m.style,{width:"100%",height:"100%",objectFit:"cover"}),h.appendChild(v),p.appendChild(m),c.appendChild(h),c.appendChild(p),c},t.prototype.applyResponsiveStyles=function(t){var i,n,e,o,r,a,l,s,d,c=560>(null===window||void 0===window?void 0:window.innerWidth),f=this.config.config,h=this.config.position||(null===(e=f.interface_properties)||void 0===e?void 0:e.position)||"Right",v=null!==(a=null!==(o=this.config.sideSpacing)&&void 0!==o?o:null===(r=f.interface_properties)||void 0===r?void 0:r.side_spacing)&&void 0!==a?a:20,p=null!==(d=null!==(l=this.config.bottomSpacing)&&void 0!==l?l:null===(s=f.interface_properties)||void 0===s?void 0:s.bottom_spacing)&&void 0!==d?d:20;this.buttonElement.style.position="",this.buttonElement.style.bottom="",this.buttonElement.style.right="",this.buttonElement.style.left="";var m=u(u({},t),c?((i={position:"fixed",bottom:"".concat(p,"px")})[h.toLowerCase()]="".concat(v,"px"),i):((n={bottom:"".concat(p,"px")})[h.toLowerCase()]="".concat(v,"px"),n));Object.assign(this.buttonElement.style,m)},t.prototype.handleResize=function(){var t,i=null!==(t=this.config.launcher_size)&&void 0!==t?t:48,n={zIndex:"1000",display:"flex",flexDirection:"column-reverse",alignItems:"center",justifyContent:"center",cursor:"pointer",overflow:"hidden",marginTop:"16px",borderRadius:this.config.config.launcher_type&&this.config.config.launcher_type!==e.IMAGE?"9999px":"50%",boxSizing:"border-box"};this.config.config.launcher_type===e.IMAGE&&Object.assign(n,{width:"".concat(i,"px"),height:"".concat(i,"px"),borderRadius:"50%",backgroundColor:this.config.config.brand_colour}),this.applyResponsiveStyles(n)},t.prototype.setupResizeListener=function(){"undefined"!=typeof ResizeObserver?(this.resizeObserver=new ResizeObserver(this.handleResizeFunction),this.resizeObserver.observe(document.body)):window.addEventListener("resize",this.handleResizeFunction)},t.prototype.getElement=function(){return this.buttonElement},t.prototype.mount=function(){var t=this;requestAnimationFrame((function(){var i,n;null===(n=(i=t.config).onEvent)||void 0===n||n.call(i,{type:p.CHATBOT_BUTTON_LOADED,timestamp:Date.now()}),t.config.onInternalEvent(p.CHATBOT_BUTTON_LOADED)}))},t.prototype.update=function(t){this.config.isIframeVisible,this.config=u(u({},this.config),t),this.buttonElement.style.transform=this.config.isIframeVisible?"scale(0.85)":"scale(1)",this.render(),this.renderProactiveIfNeeded()},t.prototype.destroy=function(){this.resizeObserver?(this.resizeObserver.disconnect(),this.resizeObserver=null):window.removeEventListener("resize",this.handleResizeFunction),this.buttonElement&&this.buttonElement.parentNode&&this.buttonElement.parentNode.removeChild(this.buttonElement),this.proactiveElement&&this.proactiveElement.parentElement&&(this.proactiveElement.parentElement.removeChild(this.proactiveElement),this.proactiveElement=null),this.clearProactiveDelays(),this.urlUnsubscribe&&(this.urlUnsubscribe(),this.urlUnsubscribe=null)},t.prototype.clearProactiveDelays=function(){this.delayTimers.forEach((function(t){return clearTimeout(t)})),this.delayTimers=[]},t.prototype.hideProactiveMessages=function(){var t,i,n=this;k=S();var e=null===(t=this.proactiveElement)||void 0===t?void 0:t.children[0];if(e){var o="Right"===(this.config.position||(null===(i=this.config.config.interface_properties)||void 0===i?void 0:i.position)||"Right");Array.from(e.children).forEach((function(t){t.className=o?"rblyn-proactive-exit-right":"rblyn-proactive-exit-left"})),setTimeout((function(){n.proactiveElement&&n.proactiveElement.parentElement&&n.proactiveElement.parentElement.removeChild(n.proactiveElement),n.proactiveElement=null,n.clearProactiveDelays()}),400)}else this.clearProactiveDelays()},t.prototype.injectAnimationStyles=function(){if(!document.getElementById("rblyn-proactive-animations")){var t=document.createElement("style");t.id="rblyn-proactive-animations",t.textContent="\n @keyframes slideInFromRight {\n 0% {\n transform: translateX(120%) scale(0.95);\n opacity: 0;\n }\n 85% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n 92% {\n transform: translateX(-1px) scale(1.002);\n }\n 100% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n }\n @keyframes slideInFromLeft {\n 0% {\n transform: translateX(-120%) scale(0.95);\n opacity: 0;\n }\n 85% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n 92% {\n transform: translateX(1px) scale(1.002);\n }\n 100% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n }\n @keyframes slideOutRight {\n 0% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n 100% {\n transform: translateX(120%) scale(0.9);\n opacity: 0;\n }\n }\n @keyframes slideOutLeft {\n 0% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n 100% {\n transform: translateX(-120%) scale(0.9);\n opacity: 0;\n }\n }\n .rblyn-proactive-enter-right {\n animation: slideInFromRight 1.2s cubic-bezier(0.5, 0.8, 0.3, 1.1) forwards;\n }\n .rblyn-proactive-enter-left {\n animation: slideInFromLeft 1.2s cubic-bezier(0.5, 0.8, 0.3, 1.1) forwards;\n }\n .rblyn-proactive-exit-right {\n animation: slideOutRight 0.4s ease-in forwards;\n }\n .rblyn-proactive-exit-left {\n animation: slideOutLeft 0.4s ease-in forwards;\n }\n .rblyn-proactive-close-enter-right {\n animation: slideInFromRight 1.2s cubic-bezier(0.5, 0.8, 0.3, 1.1) forwards;\n }\n .rblyn-proactive-close-enter-left {\n animation: slideInFromLeft 1.2s cubic-bezier(0.5, 0.8, 0.3, 1.1) forwards;\n }\n /* Reset styles for proactive message content to prevent website CSS interference */\n /* Only target children of the content wrapper, not the bubble container itself */\n .rblyn-proactive-message-content * {\n box-sizing: border-box !important;\n margin: 0 !important;\n padding: 0 !important;\n border: none !important;\n background: transparent;\n font-family: ".concat(y,' !important;\n font-size: inherit !important;\n font-weight: inherit !important;\n line-height: inherit !important;\n color: inherit;\n text-align: inherit;\n list-style: none;\n }\n .rblyn-proactive-message-content p,\n .rblyn-proactive-message-content div,\n .rblyn-proactive-message-content span {\n display: inline !important;\n margin: 0 !important;\n padding: 0 !important;\n }\n .rblyn-proactive-message-content p:first-child,\n .rblyn-proactive-message-content div:first-child,\n .rblyn-proactive-message-content span:first-child {\n margin-top: 0 !important;\n }\n .rblyn-proactive-message-content p:last-child,\n .rblyn-proactive-message-content div:last-child,\n .rblyn-proactive-message-content span:last-child {\n margin-bottom: 0 !important;\n }\n .rblyn-proactive-message-content a {\n color: inherit !important;\n text-decoration: underline !important;\n cursor: pointer !important;\n }\n .rblyn-proactive-message-content a:hover {\n opacity: 0.8 !important;\n }\n .rblyn-proactive-message-content b,\n .rblyn-proactive-message-content strong {\n font-weight: 600 !important;\n }\n .rblyn-proactive-message-content i,\n .rblyn-proactive-message-content em {\n font-style: italic !important;\n }\n .rblyn-proactive-message-content u {\n text-decoration: underline !important;\n }\n .rblyn-proactive-message-content br {\n display: block !important;\n content: "" !important;\n margin-top: 0.5em !important;\n }\n '),document.head.appendChild(t)}},t.prototype.renderProactiveIfNeeded=function(t){var i,n,o,r,l,d,c,f,h,v,p,m,g,b=this,w=null===(n=null===(i=this.config)||void 0===i?void 0:i.config)||void 0===n?void 0:n.proactive_message_obj;if(!Array.isArray(w)||this.config.isIframeVisible||D())if(this.proactiveElement&&this.proactiveElement.parentElement){var _=this.proactiveElement.children[0],I="Right"===(this.config.position||(null===(o=this.config.config.interface_properties)||void 0===o?void 0:o.position)||"Right");Array.from(_.children).forEach((function(t){t.className=I?"rblyn-proactive-exit-right":"rblyn-proactive-exit-left"})),setTimeout((function(){b.proactiveElement&&b.proactiveElement.parentElement&&b.proactiveElement.parentElement.removeChild(b.proactiveElement),b.proactiveElement=null,b.clearProactiveDelays()}),400)}else this.proactiveElement=null,this.clearProactiveDelays();else{if(this.injectAnimationStyles(),!this.proactiveElement){var T=document.createElement("div");T.style.position="fixed";var S=null!==(d=null!==(r=this.config.bottomSpacing)&&void 0!==r?r:null===(l=this.config.config.interface_properties)||void 0===l?void 0:l.bottom_spacing)&&void 0!==d?d:20,A=null!==(h=null!==(c=this.config.sideSpacing)&&void 0!==c?c:null===(f=this.config.config.interface_properties)||void 0===f?void 0:f.side_spacing)&&void 0!==h?h:20,k=this.config.position||(null===(v=this.config.config.interface_properties)||void 0===v?void 0:v.position)||"Right",F=null!==(p=this.config.launcher_size)&&void 0!==p?p:48;T.style.bottom="".concat(S+(this.config.config.launcher_type===e.IMAGE?F:40)+8,"px"),"Right"===k?T.style.right="".concat(A,"px"):T.style.left="".concat(A,"px"),T.style.maxWidth="22.875rem",T.style.zIndex="2147483646";var N=document.createElement("div");N.style.display="flex",N.style.flexDirection="column",N.style.alignItems="Right"===k?"flex-end":"flex-start";var M=document.createElement("div");M.style.position="absolute",M.style.top="-32px",M.style.width="24px",M.style.height="24px",M.style.borderRadius="50%",M.style.background="#fff",M.style.boxShadow="0 2.667px 2.667px 0 rgba(0, 0, 0, 0.25)",M.style.display="flex",M.style.alignItems="center",M.style.justifyContent="center",M.style.cursor="pointer",M.style.opacity="0",M.style.visibility="hidden","Right"===(this.config.position||(null===(m=this.config.config.interface_properties)||void 0===m?void 0:m.position)||"Right")?(M.style.right="0px",M.style.left="auto",M.style.transform="translateX(120%) scale(0.95)"):(M.style.left="0px",M.style.right="auto",M.style.transform="translateX(-120%) scale(0.95)"),M.onclick=function(t){t.stopPropagation(),b.hideProactiveMessages()},M.innerHTML='\n <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14" fill="none">\n <path d="M10.3334 10.3334L7.00009 7.00009M7.00009 7.00009L3.66675 3.66675M7.00009 7.00009L10.3334 3.66675M7.00009 7.00009L3.66675 10.3334" stroke="#444547" stroke-width="0.816326" stroke-linecap="round" stroke-linejoin="round"/>\n </svg>\n ',T.appendChild(N),T.appendChild(M),document.body.appendChild(T),this.proactiveElement=T}var j=this.proactiveElement.children[0];j.innerHTML="";var L="Right"===(this.config.position||(null===(g=this.config.config.interface_properties)||void 0===g?void 0:g.position)||"Right");j.style.display="flex",j.style.flexDirection="column",j.style.alignItems=L?"flex-end":"flex-start",this.clearProactiveDelays();var U=function(t){if(!t||D())return[];var i=E(),n=new Date,e=[];return t.forEach((function(t){e.push.apply(e,function(t,i,n){var e=(null==t?void 0:t.send_time_type)||"",o=e?z[e]:C;if(!o||!o(t,n))return[];for(var r=(null==t?void 0:t.content_multiple)||[],l=Math.max(0,1e3*+((null==t?void 0:t.delay)||0)),u=[],d=0;d<r.length;d++){for(var c=r[d],f=(null==c?void 0:c.message_display_attributes)||[],h=null,v=a.OR,p=0,m=f;p<m.length;p++){var g=m[p];if(null==g?void 0:g.logical_condition)v=g.logical_condition;else{var b=g,w=R(null==b||b.type,(null==b?void 0:b.value)||"",null==b?void 0:b.condition,i);h=null===h?w:v===a.AND?h&&w:h||w}}(null===h||h)&&(null==c?void 0:c.message)&&u.push({messageId:(null==t?void 0:t.message_id)||d+"",contentIndex:d,html:c.message+"",delayMs:l,contentId:c.content_id||null,messageDisplayType:(null==c?void 0:c.message_display_type)||s.TEXT})}return u}(t,i,n))})),e}(w),P=U.length>0?U[U.length-1].delayMs:0,W=this.proactiveElement.children[1];if(W&&U.length>0){W.style.opacity="0",W.style.visibility="hidden",W.style.transform=L?"translateX(120%) scale(0.95)":"translateX(-120%) scale(0.95)";var B=window.setTimeout((function(){W.style.visibility="visible",W.style.animationDelay="0ms",W.className=L?"rblyn-proactive-close-enter-right":"rblyn-proactive-close-enter-left"}),P);this.delayTimers.push(B)}else W&&(W.style.opacity="0",W.style.visibility="hidden");U.forEach((function(t,i){var n=window.setTimeout((function(){var n=document.createElement("div"),e=t.messageDisplayType===s.BUTTON;n.style.background="#fff",n.style.color="#111",n.style.borderRadius=e?"100px":"12px",n.style.boxShadow="0 2px 2px 0 rgba(0, 0, 0, 0.08)",n.style.padding="16px",n.style.border=e?"none":"1px solid #F1F2F4",n.style.cursor="pointer",n.style.fontFamily=y,n.style.fontSize="14px",n.style.lineHeight=x+"",n.style.width="fit-content",n.style.maxWidth="100%",j.children.length>0&&(n.style.marginBottom="16px");var o=10*(U.length-1-i);n.className=L?"rblyn-proactive-enter-right":"rblyn-proactive-enter-left",n.style.animationDelay="".concat(o,"ms"),n.style.opacity="0",n.style.transform=L?"translateX(120%) scale(0.95)":"translateX(-120%) scale(0.95)";var r=document.createElement("div");r.className="rblyn-proactive-message-content",r.setAttribute("dir",function(t){if(!t||"string"!=typeof t||0===t.trim().length)return"ltr";var i=t.replace(/<[^>]*>/g,"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_`#]/g,"").trim();if(0===i.length)return"ltr";for(var n=/[\u0590-\u05FF\u0600-\u06FF\u0700-\u074F\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]/,e=0,o=0,r=0,a=i;r<a.length;r++){var l=a[r];/\s|\d|[.,;:!?()[\]{}'"`\-_=+*/\\|@#$%^&*~]/.test(l)||(o++,n.test(l)&&e++)}return 0===o?"ltr":e/o>.3?"rtl":"ltr"}(t.html)),r.innerHTML=function(t){return t?Ft.sanitize(t,{ALLOWED_TAGS:["b","strong","i","em","u","br","span","a","p","s"],ALLOWED_ATTR:["href","target","rel","style"],ALLOW_ARIA_ATTR:!1,ALLOW_DATA_ATTR:!1,RETURN_TRUSTED_TYPE:!1}):""}(t.html),n.appendChild(r),n.onclick=function(){var i;i={message_id:t.messageId,content_string:t.html||null,content_id:t.contentId||null},O=u({input_id:null},i),b.config.toggleIframe(),b.hideProactiveMessages();try{window.dispatchEvent(new CustomEvent("rblyn:proactiveClick",{detail:{message_id:t.messageId,content_string:t.html||null,content_id:t.contentId||null}}))}catch(t){}},j.insertBefore(n,j.firstChild)}),t.delayMs);b.delayTimers.push(n)}))}},t}(),Mt=function(){var t;return(null===(t=navigator.userAgentData)||void 0===t?void 0:t.platform)||(/Windows|Mac|Linux|Android|iOS/.exec(navigator.userAgent)||["Unknown"])[0]},jt=function(){var t;if(null===(t=navigator.userAgentData)||void 0===t?void 0:t.brands)for(var i=["Chrome","Firefox","Safari","Edge","Opera"],n=0,e=navigator.userAgentData.brands;n<e.length;n++){var o=e[n];if(i.includes(o.brand))return o.brand}return(/Chrome|Firefox|Safari|Edge|Opera/.exec(navigator.userAgent)||["Unknown"])[0]},Lt=function(){var t,i,n,e;return{width:(null===window||void 0===window?void 0:window.innerWidth)||(null===(t=null===document||void 0===document?void 0:document.documentElement)||void 0===t?void 0:t.clientWidth)||(null===(i=null===document||void 0===document?void 0:document.body)||void 0===i?void 0:i.clientWidth),height:(null===window||void 0===window?void 0:window.innerHeight)||(null===(n=null===document||void 0===document?void 0:document.documentElement)||void 0===n?void 0:n.clientHeight)||(null===(e=null===document||void 0===document?void 0:document.body)||void 0===e?void 0:e.clientHeight)}},Ut=function(){return{platform:"web",os:Mt(),browser:jt(),sdk_version:"1.1.51-staging.9",device:(t=navigator.userAgent.toLowerCase(),/(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i.test(t)?"tablet":/Mobile|Android|iP(hone|od)|IEMobile|BlackBerry|Kindle|Silk-Accelerated|(hpw|web)OS|Opera M(obi|ini)/.test(t)?"mobile":"desktop"),screen_size:Lt()};var t};!function(t){t.ERROR="ERROR",t.INFO="INFO"}(zt||(zt={}));var Pt,Wt=["@robylon/web-react-sdk","node_modules/@robylon/web-react-sdk/"],Bt=function(t){var i=t.filename,n=t.stack,e=t.message;return!!(i||n||e)&&Wt.some((function(t){return(null==i?void 0:i.includes(t))||(null==n?void 0:n.includes(t))||(null==e?void 0:e.includes(t))}))},Ht=function(){function t(){var t=this;this.apiKey="",this.userId=null,this.preInitQueue=[],this.isInitialized=!1,this.handleWindowError=function(i){var n,e={filename:i.filename,stack:null===(n=i.error)||void 0===n?void 0:n.stack,message:i.message};Bt(e)&&t.trackError(i.error||i.message,"GlobalErrorHandler",{filename:i.filename,lineNo:i.lineno,colNo:i.colno})},this.handleUnhandledRejection=function(i){var n,e,o={stack:null===(n=i.reason)||void 0===n?void 0:n.stack,message:(null===(e=i.reason)||void 0===e?void 0:e.message)||i.reason+""};Bt(o)&&t.trackError(i.reason||"Unhandled Promise Rejection","GlobalPromiseHandler",{reason:i.reason})},this.setupGlobalHandlers()}return t.prototype.setupGlobalHandlers=function(){g()&&(null===window||void 0===window||window.addEventListener("error",null==this?void 0:this.handleWindowError),null===window||void 0===window||window.addEventListener("unhandledrejection",this.handleUnhandledRejection))},t.prototype.cleanup=function(){g()&&(null===window||void 0===window||window.removeEventListener("error",null==this?void 0:this.handleWindowError),null===window||void 0===window||window.removeEventListener("unhandledrejection",this.handleUnhandledRejection))},t.getInstance=function(){return t.instance||(t.instance=new t),t.instance},t.prototype.initialize=function(t,i){void 0===i&&(i=null);try{if(this.preInitQueue.length>0){var n={org_id:"UNINITALIZED",event_data:{message:"SDK Initialization Failed: Required parameter 'api_key' is ".concat(void 0===t?"undefined":null===t?"null":""===t?"empty string":"invalid: ".concat(t)),componentName:"ErrorTrackingService",additionalInfo:{preInitError:!0,apiKey:t,userId:i,timestamp:Date.now()},timestamp:Date.now()},metadata:Ut(),event_type:zt.ERROR,user_id:i};this.sendLog(n).catch(console.error)}this.apiKey=t,this.userId=i,this.isInitialized=!0,this.processPreInitQueue()}catch(n){h.error("Error during ErrorTrackingService initialization:",n),this.preInitQueue.push({error:n instanceof Error?n:Error(n+""),componentName:"ErrorTrackingService",additionalInfo:{apiKey:t,userId:i}})}},t.prototype.processPreInitQueue=function(){return d(this,void 0,void 0,(function(){var t,i,n;return c(this,(function(e){switch(e.label){case 0:if(!this.preInitQueue.length)return[2];h.info("Processing ".concat(this.preInitQueue.length," pre-initialization errors")),t=0,i=this.preInitQueue,e.label=1;case 1:return t<i.length?(n=i[t],[4,this.trackError(n.error,n.componentName,u(u({},n.additionalInfo),{preInitError:!0}))]):[3,4];case 2:e.sent(),e.label=3;case 3:return t++,[3,1];case 4:return this.preInitQueue=[],[2]}}))}))},t.prototype.sendLog=function(t){return d(this,void 0,void 0,(function(){var i,n,e,o,r,a;return c(this,(function(l){switch(l.label){case 0:return l.trys.push([0,4,,5]),i=b().apiUrl,[4,fetch("".concat(i,"/users/sdk/record-logs/"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})];case 1:return(n=l.sent()).ok?[3,3]:(o=(e=h).error,r=["Failed to send error log:"],[4,n.text()]);case 2:o.apply(e,r.concat([l.sent()])),l.label=3;case 3:return[3,5];case 4:return a=l.sent(),h.error("Error sending log:",a),[3,5];case 5:return[2]}}))}))},t.prototype.trackError=function(t,i,n){return d(this,void 0,void 0,(function(){var e,o,r;return c(this,(function(a){switch(a.label){case 0:if(this.isInitialized)return[3,5];e={org_id:"UNINITALIZED",event_data:{message:t instanceof Error?t.message:t,stack:t instanceof Error?t.stack:void 0,componentName:i,additionalInfo:u(u({},n),{preInitError:!0,timestamp:Date.now()}),timestamp:Date.now()},metadata:Ut(),event_type:zt.ERROR,user_id:this.userId},a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.sendLog(e)];case 2:return a.sent(),[3,4];case 3:return a.sent(),this.preInitQueue.push({error:t,componentName:i,additionalInfo:n}),h.warn("Error tracked before initialization, queuing:",t),[3,4];case 4:return[2];case 5:return o={message:t instanceof Error?t.message:t,stack:t instanceof Error?t.stack:void 0,componentName:i,additionalInfo:u(u({},n),{timestamp:Date.now()}),timestamp:Date.now()},r={org_id:this.apiKey||"UNINITALIZED",event_data:o,metadata:Ut(),event_type:zt.ERROR,user_id:this.userId},[4,this.sendLog(r)];case 6:return a.sent(),[2]}}))}))},t.prototype.trackInfo=function(t,i,n){return d(this,void 0,void 0,(function(){var e,o;return c(this,(function(r){switch(r.label){case 0:return this.apiKey?(e={message:t,componentName:i,additionalInfo:n,timestamp:Date.now()},o={org_id:this.apiKey,event_data:e,metadata:Ut(),event_type:zt.INFO,user_id:this.userId},[4,this.sendLog(o)]):(h.error("Error tracking not initialized"),[2]);case 1:return r.sent(),[2]}}))}))},t}(),Yt=Ht.getInstance(),Xt="MISSING_API_KEY",Jt="SDK_INIT_FAILED",Gt="ERROR_TRACKING_INIT_FAILED",Kt="API_REQUEST_FAILED",Zt="NETWORK_ERROR",Vt="INVALID_RESPONSE",qt="IFRAME_LOAD_FAILED",Qt="INITIALIZATION_ERROR",$t=((Pt={})[Xt]=function(t){return"SDK Initialization Failed: Required parameter 'api_key' is ".concat(void 0===t?"undefined":null===t?"null":""===t?"empty string":"invalid: ".concat(t),". A valid API key string is required to initialize the SDK.")},Pt.INVALID_API_KEY=function(t){return"SDK Initialization Failed: Provided API key '".concat(t,"' is invalid. API key must be a non-empty string in UUID format.")},Pt.CONFIG_FETCH_FAILED=function(t){return"Failed to fetch chatbot configuration: ".concat(t.statusCode?"Server responded with status ".concat(t.statusCode):"Could not reach server").concat(t.error?". Error: ".concat(t.error):"")},Pt[Kt]=function(t,i,n){return"API Request Failed: Server responded with status ".concat(t," for ").concat(n?"endpoint ".concat(n):"request"," - ").concat(i)},Pt[Zt]=function(t){return"Network Error: Failed to communicate with server".concat(t.url?" at ".concat(t.url):"").concat(t.error?" - ".concat(t.error):"")},Pt[qt]=function(t){return"Failed to load chatbot interface".concat(t.src?" from ".concat(t.src):"").concat(t.error?". Error: ".concat(t.error):"")},Pt[Vt]=function(t){return"Invalid API Response: Missing required fields in response data: ".concat(t.join(", "))},Pt[Gt]=function(t){return"Error Tracking Service initialization failed".concat(t.apiKey?" for API key ".concat(t.apiKey):"").concat(t.error?". Error: ".concat(t.error):"")},Pt[Jt]=function(t){return"SDK Initialization Failed: ".concat(t.reason||"Could not initialize the chatbot SDK").concat(t.config?". Attempted initialization with config: ".concat(JSON.stringify(t.config,null,2)):"")},Pt.COOKIE_ACCESS_ERROR=function(t,i){return"Cookie Access Error: Failed to ".concat(t).concat(i?" cookie '".concat(i,"'"):" cookies",". This may affect user session persistence.")},Pt.COMPONENT_RENDER_ERROR=function(t){return"React Component Error: ".concat(t.component||"Unknown component"," failed to render. Error: ").concat(t.error).concat(t.stack?"\nComponent Stack: ".concat(t.stack):"")},Pt),ti=function(){var t,i=navigator.userAgent;if(null===(t=navigator.userAgentData)||void 0===t?void 0:t.brands){var n=navigator.userAgentData.brands.find((function(t){return"Google Chrome"===t.brand}));if(null==n?void 0:n.version)return n.version}var e=i.match(/(Chrome|Firefox|Safari|Edge|Opera)\/(\d+\.\d+)/);return e?e[2]:"Unknown"},ii=function(){var t,i,n=Ut();return{current_page_url:(null===(t=null===window||void 0===window?void 0:window.location)||void 0===t?void 0:t.href)||"",browser_language:(null===navigator||void 0===navigator?void 0:navigator.language)||(null===(i=null===navigator||void 0===navigator?void 0:navigator.languages)||void 0===i?void 0:i[0])||"en",browser_version:ti(),os:null==n?void 0:n.os,referral_url:(null===document||void 0===document?void 0:document.referrer)||"",system_info:n}},ni=function(){function t(t){var i=this;this.isInitialized=!1,this.hasRegistered=!1,this.isAppReady=!1,this.shouldWaitForAppReady=!1,this.hasPendingOpenRequest=!1,this.overridesPayloadCache=null,this.proactiveDataSentInRegistration=!1,this.handleMessage=function(t){var n,e,o,r,a,l,s,u,d,c,f=b().copilotUrl;if(t.origin===f){var h=JSON.parse(t.data);if("APP_READY"===(null==h?void 0:h.type))return i.isAppReady=!0,void i.sendOpenAndRegisterIfReady();if("CHATBOT_CLOSED"===(null==h?void 0:h.type))return void(null===(n=null==i?void 0:i.config)||void 0===n||n.onClose());if("CHATBOT_TOKEN_EXHAUSTED"===(null==h?void 0:h.type))return void i.config.onInternalEvent(m.CHATBOT_TOKEN_EXHAUSTED);"CHATBOT_LOADED"===(null==h?void 0:h.type)&&(null===(o=(e=i.config).onEvent)||void 0===o||o.call(e,{type:p.CHATBOT_LOADED,timestamp:Date.now()}),i.config.onInternalEvent(p.CHATBOT_LOADED)),"CHAT_INITIALIZED"===(null==h?void 0:h.type)&&(null===(a=(r=i.config).onEvent)||void 0===a||a.call(r,{type:p.CHAT_INITIALIZED,timestamp:Date.now()}),i.config.onInternalEvent(p.CHAT_INITIALIZED)),"CHAT_INITIALIZATION_FAILED"===(null==h?void 0:h.type)&&(null===(s=(l=i.config).onEvent)||void 0===s||s.call(l,{type:p.CHAT_INITIALIZATION_FAILED,timestamp:Date.now()}),i.config.onInternalEvent(p.CHAT_INITIALIZATION_FAILED,{error:null===(u=t.data)||void 0===u?void 0:u.error})),"SESSION_REFRESHED"===(null==h?void 0:h.type)&&(null===(c=(d=i.config).onEvent)||void 0===c||c.call(d,{type:p.SESSION_REFRESHED,timestamp:Date.now()}),i.config.onInternalEvent(p.SESSION_REFRESHED)),"CHAT_MOVED"===(null==h?void 0:h.type)&&i.config.onInternalEvent(m.CHAT_MOVED,{from:t.data.from,to:t.data.to,trigger:t.data.trigger})}},this.config=t,this.iframeElement=document.createElement("iframe"),this.iframeElement.id="chat-iframe-rbyln",this.resizeHandler=this.applyResponsiveStyles.bind(this),this.render(),this.initialize(),this.setupEventListeners()}return t.prototype.getElement=function(){return this.iframeElement},t.prototype.render=function(){var t,i=this.config.position||(null===(t=this.config.config.interface_properties)||void 0===t?void 0:t.position)||"Right";Object.assign(this.iframeElement.style,{zIndex:"20000000",border:"none",boxShadow:"0px 0px 40px 0px rgba(14, 14, 15, 0.24)",transformOrigin:"bottom ".concat(i.toLowerCase()),transition:"transform 0.2s cubic-bezier(0.2, 1.27, 0.29, 0.97), opacity 0.15s ease-out",transform:"scale(0.3) translate3d(0,40px,0)",opacity:"0",display:"none"}),this.applyResponsiveStyles()},t.prototype.applyResponsiveStyles=function(){var t,i,n,e,o,r;if(this.iframeElement){var a=this.config.position||(null===(n=this.config.config.interface_properties)||void 0===n?void 0:n.position)||"Right",l=null!==(r=null!==(e=this.config.bottomSpacing)&&void 0!==e?e:null===(o=this.config.config.interface_properties)||void 0===o?void 0:o.bottom_spacing)&&void 0!==r?r:20;560>window.innerWidth?Object.assign(this.iframeElement.style,((t={width:"100vw",minWidth:"300px"})[a.toLowerCase()]="0",t.bottom="0",t.height="100vh",t.flexDirection="column",t.flexGrow="1",t.borderRadius="0",t.top="0",t.maxHeight="100%",t.position="fixed",t)):Object.assign(this.iframeElement.style,((i={width:"26%",minWidth:"400px",height:"calc(100vh - 2rem - 10vh - ".concat(l,"px)"),borderRadius:"1rem",top:"calc(10vh - 32px)",maxHeight:"50rem",position:""})[a.toLowerCase()]=void 0,i))}},t.prototype.initialize=function(){var t=this;if(!this.isInitialized){var i=b().copilotUrl;this.iframeElement.src="".concat(i,"/chatbot-plugin?id=").concat(this.config.config.chatbotId),this.isInitialized=!0,this.iframeElement.addEventListener("load",(function(){var n,e,o,r,a,l,s,u,d,c,f,h,v,m,g,b,w,y,x,_,I=new URL(t.iframeElement.src).origin||i;null===(n=t.iframeElement.contentWindow)||void 0===n||n.postMessage({domain:null===(e=null===window||void 0===window?void 0:window.location)||void 0===e?void 0:e.hostname,name:"checkDomain"},I);var T={header_avatar:null!==(r=null===(o=t.config.overrides)||void 0===o?void 0:o.header_avatar)&&void 0!==r?r:null,agent_avatar:null!==(l=null===(a=t.config.overrides)||void 0===a?void 0:a.agent_avatar)&&void 0!==l?l:null,header_title:null!==(u=null===(s=t.config.overrides)||void 0===s?void 0:s.header_title)&&void 0!==u?u:null,header_subtitle:null!==(c=null===(d=t.config.overrides)||void 0===d?void 0:d.header_subtitle)&&void 0!==c?c:null,header_title_text_color:null!==(h=null===(f=t.config.overrides)||void 0===f?void 0:f.header_title_text_color)&&void 0!==h?h:null,header_subtitle_text_color:null!==(m=null===(v=t.config.overrides)||void 0===v?void 0:v.header_subtitle_text_color)&&void 0!==m?m:null,header_bg:null!==(b=null===(g=t.config.overrides)||void 0===g?void 0:g.header_bg)&&void 0!==b?b:null};null===(w=t.iframeElement.contentWindow)||void 0===w||w.postMessage({domain:null===(y=null===window||void 0===window?void 0:window.location)||void 0===y?void 0:y.hostname,action:"updateOverrides",data:T},I),null===(_=(x=t.config).onEvent)||void 0===_||_.call(x,{type:p.CHATBOT_READY,timestamp:Date.now()}),t.config.onInternalEvent(p.CHATBOT_LOADED)}))}},t.prototype.setupEventListeners=function(){var t=this;window.addEventListener("resize",this.resizeHandler),this.iframeElement.addEventListener("error",(function(){Yt.trackError(Error($t[qt]({src:t.iframeElement.src,error:"Failed to load iframe"})),"ChatbotIframe",{errorCode:qt,errorType:"RUNTIME_ERROR",context:{config:t.config.config,iframeUrl:t.iframeElement.src,timestamp:Date.now()}})})),window.addEventListener("message",this.handleMessage),window.addEventListener("rblyn:proactiveClick",(function(i){var n,e,o,r,a,l;if(t.hasRegistered)if(t.proactiveDataSentInRegistration)t.proactiveDataSentInRegistration=!1;else{var s=(null==i?void 0:i.detail)||{},u=b().copilotUrl,d=new URL(t.iframeElement.src).origin||u;null===(n=t.iframeElement.contentWindow)||void 0===n||n.postMessage({domain:null===(e=null===window||void 0===window?void 0:window.location)||void 0===e?void 0:e.hostname,action:"proactiveClick",data:{userId:null===(o=t.config.config)||void 0===o?void 0:o.userId,token:null===(r=t.config.config)||void 0===r?void 0:r.token,userProfile:null===(a=t.config.config)||void 0===a?void 0:a.userProfile,isAnonymous:null===(l=t.config.config)||void 0===l?void 0:l.isAnonymous,proactiveData:{input_id:null,message_id:(null==s?void 0:s.message_id)||null,content_string:(null==s?void 0:s.content_string)||null}}},d)}}))},t.prototype.updateVisibility=function(t,i){var n;this.shouldWaitForAppReady=!!i,this.config.isVisible=t;var e=this.config.position||(null===(n=this.config.config.interface_properties)||void 0===n?void 0:n.position)||"Right";t?this.showIframe(e):this.hideIframe(e),t?(this.hasPendingOpenRequest=!0,this.shouldWaitForAppReady,this.sendOpenAndRegisterIfReady()):this.hasPendingOpenRequest=!1},t.prototype.showIframe=function(t){this.iframeElement.style.display="block",this.iframeElement.getBoundingClientRect(),this.iframeElement.style.opacity="1",this.iframeElement.style.transform="scale(1) translate3d(0,0,0)"},t.prototype.hideIframe=function(t){var i=this;this.iframeElement.style.opacity="0",this.iframeElement.style.transform="scale(0.3) translate3d(".concat((t.toLowerCase(),"0"),",40px,0)"),setTimeout((function(){i.config.isVisible||(i.iframeElement.style.display="none")}),200)},t.prototype.sendOpenAndRegisterIfReady=function(){var t,i,n,e,o,r,a,l,s,d;if(this.iframeElement.contentWindow&&this.config.isVisible&&(!this.shouldWaitForAppReady||this.isAppReady)&&this.hasPendingOpenRequest){var c,f=b().copilotUrl,h=new URL(this.iframeElement.src).origin||f;if(this.iframeElement.contentWindow.postMessage({domain:null===(t=null===window||void 0===window?void 0:window.location)||void 0===t?void 0:t.hostname,name:"openFrame"},h),!this.hasRegistered){var v=(c=O,O=null,c);this.proactiveDataSentInRegistration=!!v,this.iframeElement.contentWindow.postMessage({domain:null===(i=null===window||void 0===window?void 0:window.location)||void 0===i?void 0:i.hostname,action:"registerUserId",data:u({userId:null===(n=this.config.config)||void 0===n?void 0:n.userId,token:null===(e=this.config.config)||void 0===e?void 0:e.token,userProfile:u(u({},null===(o=this.config.config)||void 0===o?void 0:o.userProfile),{__INT_SYS_INFO__:u(u({},(null===(a=null===(r=this.config.config)||void 0===r?void 0:r.userProfile)||void 0===a?void 0:a.__INT_SYS_INFO__)||{}),ii())}),isAnonymous:null===(l=this.config.config)||void 0===l?void 0:l.isAnonymous},v?{proactiveData:v}:{})},h),this.hasRegistered=!0}null===(d=(s=this.config).onEvent)||void 0===d||d.call(s,{type:p.CHATBOT_OPENED,timestamp:Date.now()}),this.config.onInternalEvent(p.CHATBOT_OPENED),this.hasPendingOpenRequest=!1}},t.prototype.update=function(t,i){var n=this.config.isVisible;if(this.config=u(u({},this.config),t),n!==this.config.isVisible&&this.updateVisibility(this.config.isVisible,i),this.iframeElement.contentWindow&&this.config.isVisible){var e=b().copilotUrl;this.iframeElement.contentWindow.postMessage({action:"updateUserProfile",user_profile:this.config.config.userProfile},e)}},t.prototype.destroy=function(){window.removeEventListener("resize",this.resizeHandler),window.removeEventListener("message",this.handleMessage),this.iframeElement&&this.iframeElement.parentNode&&this.iframeElement.parentNode.removeChild(this.iframeElement)},t}(),ei=function(){function t(t,i,n,e){this.resizeObserver=null,this.containerElement=document.createElement("div"),this.handleResizeFunction=this.handleResize.bind(this),this.config={config:t,position:i,sideSpacing:n,bottomSpacing:e},this.render(),this.mount(),this.setupResizeListener()}return t.prototype.render=function(){this.applyStyles(),this.containerElement.className="robylon-chatbot-container"},t.prototype.applyStyles=function(){var t,i,n,e,o,r,a,l,s,d=560>(null===window||void 0===window?void 0:window.innerWidth),c=this.config.position||(null===(n=this.config.config.interface_properties)||void 0===n?void 0:n.position)||"Right",f=null!==(r=null!==(e=this.config.sideSpacing)&&void 0!==e?e:null===(o=this.config.config.interface_properties)||void 0===o?void 0:o.side_spacing)&&void 0!==r?r:20,h=null!==(s=null!==(a=this.config.bottomSpacing)&&void 0!==a?a:null===(l=this.config.config.interface_properties)||void 0===l?void 0:l.bottom_spacing)&&void 0!==s?s:20;this.containerElement.style.position="",this.containerElement.style.top="",this.containerElement.style.bottom="",this.containerElement.style.right="",this.containerElement.style.left="",this.containerElement.style.alignItems="";var v={position:"fixed",zIndex:"1000",display:"flex",flexDirection:"column"},p=u(u({},v),((t={bottom:"".concat(h,"px")})[c.toLowerCase()]="".concat(f,"px"),t.alignItems="Right"===c?"flex-end":"flex-start",t)),m=u(u({},v),((i={top:"0"})[c.toLowerCase()]="".concat(f,"px"),i.alignItems="center",i));Object.assign(this.containerElement.style,d?m:p)},t.prototype.handleResize=function(){this.applyStyles()},t.prototype.setupResizeListener=function(){"undefined"!=typeof ResizeObserver?(this.resizeObserver=new ResizeObserver(this.handleResizeFunction),this.resizeObserver.observe(document.body)):window.addEventListener("resize",this.handleResizeFunction)},t.prototype.mount=function(){document.body.appendChild(this.containerElement)},t.prototype.getElement=function(){return this.containerElement},t.prototype.destroy=function(){this.resizeObserver?(this.resizeObserver.disconnect(),this.resizeObserver=null):window.removeEventListener("resize",this.handleResizeFunction),this.containerElement&&this.containerElement.parentNode&&this.containerElement.parentNode.removeChild(this.containerElement)},t}(),oi=function(t){var i=t?"USER_DATA=%7B%22attributes%22%3A%5B%7B%22key%22%3A%22USER_ATTRIBUTE_USER_EMAIL%22%2C%22value%22%3A%22dinesh.goel%40robylon.ai%22%7D%2C%7B%22key%22%3A%22USER_ATTRIBUTE_UNIQUE_ID%22%2C%22value%22%3A%2266011f2c28d1787d13c6c796%22%7D%5D%2C%22subscribedToOldSdk%22%3Afalse%2C%22deviceUuid%22%3A%2226c02feb-2664-451d-8469-9cf1378547c6%22%2C%22deviceAdded%22%3Atrue%7D; _ga_3YS9P6ZDWX=GS1.1.1715252584.3.1.1715258696.39.0.0; _ga_V4J24F7YF9=GS1.1.1715273274.2.0.1715273274.0.0.0; city_name=Bengaluru; lang_code=en-in; cookieConcent=A; _gcl_au=1.1.343275043.1717154298; _clck=43guwd%7C2%7Cfmi%7C0%7C1561; _gid=GA1.2.1423066649.1718210058; moe_uuid=26c02feb-2664-451d-8469-9cf1378547c6; _ga_6RM65PWEZY=GS1.1.1718210058.18.1.1718211647.60.0.0; _ga=GA1.1.689213983.1712737672; AMP_MKTG_fe4beb374f=JTdCJTIycmVmZXJyZXIlMjIlM0ElMjJodHRwcyUzQSUyRiUyRmFjY291bnRzLnRlYWNobWludC5jb20lMkYlMjIlMkMlMjJyZWZlcnJpbmdfZG9tYWluJTIyJTNBJTIyYWNjb3VudHMudGVhY2htaW50LmNvbSUyMiU3RA==; AMP_fe4beb374f=JTdCJTIyZGV2aWNlSWQlMjIlM0ElMjI0MWMxMTljZC03YzVjLTRiYTctYTUzZS1mYTgzMjRlYjc0OWUlMjIlMkMlMjJ1c2VySWQlMjIlM0ElMjIxZjI2ODAwOC01OGYxLTQwYTItYjQ0Ni1mYmQ5N2E0NDQyYTAlMjIlMkMlMjJzZXNzaW9uSWQlMjIlM0ExNzE4MjEzMzEwOTc3JTJDJTIyb3B0T3V0JTIyJTNBZmFsc2UlMkMlMjJsYXN0RXZlbnRUaW1lJTIyJTNBMTcxODIxMzMxMDk4MSUyQyUyMmxhc3RFdmVudElkJTIyJTNBMTQlN0Q=; _ga_3YS9P6ZDWX=GS1.1.1718211637.26.1.1718213441.60.0.0; SESSION=%7B%22sessionKey%22%3A%22e4d76f52-9053-4277-99a4-f1ba667fd5f2%22%2C%22sessionStartTime%22%3A%222024-06-12T16%3A34%3A19.047Z%22%2C%22sessionMaxTime%22%3A1800%2C%22customIdentifiersToTrack%22%3A%5B%5D%2C%22sessionExpiryTime%22%3A1718215247464%2C%22numberOfSessions%22%3A17%7D":document.cookie;return i=i.split(";").map((function(t){var i=t.split("="),n=i[0],e=i.slice(1).join("=").trim();return{name:n=n.trim(),value:e?decodeURIComponent(e):""}})),i},ri=function(t,i,n){return d(void 0,void 0,void 0,(function(){var e,o,r,a,l,s,u,d;return c(this,(function(c){switch(c.label){case 0:return c.trys.push([0,5,,6]),e=b().apiUrl,h.log("endpointUrl",o="".concat(e,"/chat/chatbot/get/")),r={client_user_id:i||null,org_id:t,token:n||void 0,extra_info:{},launcher_info:ii()},[4,fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})];case 1:return(a=c.sent()).ok?[3,3]:[4,a.text()];case 2:throw l=c.sent(),Error($t[Kt](a.status,l));case 3:return[4,a.json()];case 4:if(s=c.sent(),!(null===(d=null==s?void 0:s.user)||void 0===d?void 0:d.org_info))throw Error($t[Vt](["user","org_info"]));return[2,s];case 5:throw u=c.sent(),Yt.trackError(u instanceof Error?u:Error($t[Zt]({error:u+""})),"fetchChatbotConfig",{errorCode:u instanceof Error&&u.message.includes("API Request Failed")?Kt:Zt,errorType:"API_ERROR",context:{apiKey:t,userId:i,timestamp:Date.now()}}),u;case 6:return[2]}}))}))},ai=function(t){return d(void 0,void 0,void 0,(function(){var o,r,a,l,s,d,f,v,p,m,g,b,w,y,x,_,I,T,E,S,A,R,k,O,D,C,z,F,N,M,j,L,U,P;return c(this,(function(c){switch(c.label){case 0:return o=function(t){return{api_key:(t.api_key||"")+"",user_id:t.user_id?t.user_id+"":null,user_token:t.user_token?t.user_token+"":void 0,user_profile:t.user_profile||{}}}(t),r=o.user_id||void 0,a=!1,r||(r=function(){var t,i="; ".concat(document.cookie).split("; rblyn_anon=");if(2===i.length)return null===(t=i.pop())||void 0===t?void 0:t.split(";").shift()}()||"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var i=16*Math.random()|0;return("x"===t?i:3&i|8).toString(16)})),B=r,(H=new Date).setTime(H.getTime()+31536e6),document.cookie="".concat("rblyn_anon","=").concat(B,";expires=").concat(H.toUTCString(),";path=/"),a=!0),[4,ri(o.api_key,r,o.user_token)];case 1:l=c.sent();try{o.api_key}catch(t){h.warn("Failed to inject mock proactive messages",t)}return s=Ut(),d=ii(),W=o.user_profile,f=W?Object.fromEntries(Object.entries(W).map((function(t){var i=t[0],n=t[1];return"boolean"==typeof n||"number"==typeof n?[i,n]:[i,n+""]}))):{},v=u(u(u({},s),{__INT_SYS_INFO__:u(u({},s),d)}),f),[2,{chatbotId:o.api_key,userId:r,token:o.user_token,isAnonymous:a,domain:"",show_launcher:null===(m=null===(p=l.user.org_info)||void 0===p?void 0:p.show_launcher)||void 0===m||m,brand_colour:(null===(b=null===(g=l.user.org_info.brand_config)||void 0===g?void 0:g.colors)||void 0===b?void 0:b.brand_color)||"",image_url:(null===(y=null===(w=l.user.org_info)||void 0===w?void 0:w.brand_config)||void 0===y?void 0:y.launcher_logo_url)||"",userProfile:v,chat_interface_config:{chat_bubble_prompts:[],display_name:(null===(x=l.user.org_info.brand_config)||void 0===x?void 0:x.display_name)||"",welcome_message:(null===(_=l.user.org_info.brand_config)||void 0===_?void 0:_.welcome_message)||"Hey! What can we help you with today?",redirect_url:(null===(I=l.user.org_info.brand_config)||void 0===I?void 0:I.redirect_url)||""},launcher_type:(null===(T=l.user.org_info.brand_config)||void 0===T?void 0:T.launcher_type)||e.IMAGE,launcher_properties:{text:(null===(S=null===(E=l.user.org_info.brand_config)||void 0===E?void 0:E.launcher_properties)||void 0===S?void 0:S.text)||""},images:{launcher_image_url:{url:(null===(k=null===(R=null===(A=l.user.org_info.brand_config)||void 0===A?void 0:A.images)||void 0===R?void 0:R.launcher_image_url)||void 0===k?void 0:k.url)||""}},proactive_message_obj:li(null===(C=null===(D=null===(O=null==l?void 0:l.user)||void 0===O?void 0:O.org_info)||void 0===D?void 0:D.brand_config)||void 0===C?void 0:C.proactive_message_obj),interface_properties:{position:(null===(F=null===(z=l.user.org_info.brand_config)||void 0===z?void 0:z.interface_properties)||void 0===F?void 0:F.position)||n.RIGHT,side_spacing:(null===(M=null===(N=l.user.org_info.brand_config)||void 0===N?void 0:N.interface_properties)||void 0===M?void 0:M.side_spacing)||20,bottom_spacing:(null===(L=null===(j=l.user.org_info.brand_config)||void 0===j?void 0:j.interface_properties)||void 0===L?void 0:L.bottom_spacing)||20},interface_type:(null===(U=l.user.org_info.brand_config)||void 0===U?void 0:U.interface_type)||i.WIDGET,launcher_delay:(null===(P=l.user.org_info.brand_config)||void 0===P?void 0:P.launcher_delay)||{enabled:!1,delay:0}}]}var W,B,H}))}))},li=function(t){if(t){var i=(Array.isArray(t)?t:[t]).filter(Boolean).map((function(t){var i,n,e={message_id:(null!==(i=null==t?void 0:t.message_id)&&void 0!==i?i:"")+"",org_id:(null!==(n=null==t?void 0:t.org_id)&&void 0!==n?n:"")+"",name:null==t?void 0:t.name,content:null==t?void 0:t.content,send_time_type:null==t?void 0:t.send_time_type,created_by_name:null==t?void 0:t.created_by_name,updated_by_name:null==t?void 0:t.updated_by_name,updated_at:null==t?void 0:t.updated_at,created_at:null==t?void 0:t.created_at,delay:"number"==typeof(null==t?void 0:t.delay)?t.delay:void 0,content_multiple:Array.isArray(null==t?void 0:t.content_multiple)?t.content_multiple:(null==t?void 0:t.content)?[{message:t.content+"",message_display_attributes:[]}]:[]};return(null==t?void 0:t.content)&&!(null==t?void 0:t.content_multiple)&&h.warn("[Robylon SDK] proactive_message.content is deprecated; use content_multiple[].message instead."),e}));return i.length?i:void 0}},si=function(){function t(t){this.logoContainer=null,this.iframe=null,this.bubblePromptContainer=null,this.chatBtnImage=null,this.config=t,this.validateDomain()&&this.init(),null===window||void 0===window||window.addEventListener("message",this.onCloseListener.bind(this),!1)}return t.prototype.onCloseListener=function(t){t.origin===this.config.domain&&"closeChatbot"===t.data&&this.closeIframe()},t.prototype.validateDomain=function(){var t,i=this.config.domain,n=null===(t=null===window||void 0===window?void 0:window.location)||void 0===t?void 0:t.origin;return h.log("expectedDomain, to current domain",i,n,i===n),i===n},t.prototype.createChatBubblContainer=function(){var t,i=this,n=document.createElement("div");n.id="chatbase-message-bubbles",Object.assign(n.style,{position:"fixed",bottom:"80px",borderRadius:"10px",fontFamily:"sans-serif",fontSize:"16px",zIndex:"2147483644",cursor:"pointer",flexDirection:"column",gap:"50px",maxWidth:"70vw",display:"block",right:"1rem",left:"unset"});var e=document.createElement("div");e.classList.add("close-btn"),e.textContent="✕",Object.assign(e.style,{position:"absolute",top:"-7px",right:"-7px",fontWeight:"bold",display:"none",justifyContent:"center",alignItems:"center",zIndex:"2147483643",width:"22px",height:"22px",borderRadius:"50%",textAlign:"center",fontSize:"12px",cursor:"pointer",backgroundColor:"rgb(224, 224, 224)",color:"black",boxShadow:"rgba(150, 150, 150, 0.15) 0px 6px 24px 0px, rgba(150, 150, 150, 0.15) 0px 0px 0px 1px"}),((null===(t=this.config.chat_interface_config)||void 0===t?void 0:t.chat_bubble_prompts)||[]).forEach((function(t){var e=i.createMessageBubble(t);n.appendChild(e)})),n.appendChild(e),document.body.appendChild(n)},t.prototype.createMessageBubble=function(t){var i=document.createElement("div");this.bubblePromptContainer=i,Object.assign(i.style,{display:"flex",position:"relative",justifyContent:"flex-end"});var n=document.createElement("div");n.classList.add("message"),n.textContent=t,Object.assign(n.style,{backgroundColor:"white",color:"black",boxShadow:"rgba(150, 150, 150, 0.2) 0px 10px 30px 0px, rgba(150, 150, 150, 0.2) 0px 0px 0px 1px",borderRadius:"10px",padding:"8px 5px",margin:"8px",fontSize:"14px",opacity:"1",transform:"scale(1)",transition:"opacity 0.5s ease 0s, transform 0.5s ease 0s"});var e=document.createElement("button");return e.innerHTML="&times;",Object.assign(e.style,{position:"absolute",top:"1px",left:"-3px",width:"20px",height:"20px",borderRadius:"50%",backgroundColor:"#fff",color:"#000",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 2px 5px rgba(0,0,0,0.2)",fontSize:"14px",lineHeight:"1",padding:"0",zIndex:"100"}),e.addEventListener("click",(function(){i.remove()})),i.appendChild(e),i.appendChild(n),i},t.prototype.createFloatingButton=function(){var t=document.createElement("div");t.classList.add("message-bubble-container"),Object.assign(t.style,{position:"fixed",bottom:"1.5rem",right:"1.5rem",zIndex:"1000",width:"48px",height:"48px",display:"flex",flexDirection:"column-reverse",backgroundColor:this.config.brand_colour,color:f(this.config.brand_colour),borderRadius:"50%",alignItems:"center",justifyContent:"center",cursor:"pointer",overflow:"hidden"}),document.body.appendChild(t),this.logoContainer=t,this.loadImage(this.logoContainer),this.createChatBubblContainer(),this.logoContainer.addEventListener("click",this.toggleIframe.bind(this))},t.prototype.loadImage=function(t){var i,n,e=document.createElement("img");e.src=this.config.launcher_type?(null===(n=null===(i=this.config.images)||void 0===i?void 0:i.launcher_image_url)||void 0===n?void 0:n.url)||"".concat(this.config.domain,"/chatbubble.png"):this.config.image_url||"".concat(this.config.domain,"/chatbubble.png"),e.alt="Chat",Object.assign(e.style,{zIndex:"1000",cursor:"pointer",borderRadius:"50%",objectFit:"cover"}),this.chatBtnImage=e,t.innerHTML="",t.appendChild(e)},t.prototype.createIframe=function(){var t=this;h.log("RobylonConfig?.domain====>",this.config.domain);var i=document.createElement("iframe");Object.assign(i.style,{position:"fixed",right:"32px",bottom:"86px",minWidth:"400px",width:"26%",maxWidth:"800px",top:"calc(10vh - 32px)",maxHeight:"45rem",height:"calc(100vh - 3rem - 10vh)",zIndex:"20000000",border:"none",boxShadow:"0px 0px 40px 0px rgba(14, 14, 15, 0.24)",transformOrigin:"bottom right",transition:"transform 0.3s ease-out",borderRadius:"1rem",display:"none"}),i.src="".concat(this.config.domain,"/chatbot-plugin?id=").concat(this.config.chatbotId),h.log("iframe.src====>",i.src),document.body.appendChild(i),this.iframe=i;var n=function(){560>(null===window||void 0===window?void 0:window.innerWidth)?Object.assign(i.style,{width:"100vw",minWidth:"300px",right:"0",bottom:"0",height:"100vh",flexDirection:"column",flexGrow:"1",borderRadius:"0",top:"0",maxHeight:"100%"}):Object.assign(i.style,{width:"26%",minWidth:"400px",right:"32px",bottom:"86px",height:"calc(100vh - 3rem - 10vh)",borderRadius:"1rem",top:"calc(10vh - 32px)",maxHeight:"45rem"})};n(),null===window||void 0===window||window.addEventListener("resize",n),i.addEventListener("load",(function(){var n,e,o,r,a;if(t.iframe){var l=new URL(t.iframe.src).origin||t.config.domain;null===(n=i.contentWindow)||void 0===n||n.postMessage({domain:null===(e=null===window||void 0===window?void 0:window.location)||void 0===e?void 0:e.hostname,name:"checkDomain"},l),null===(o=i.contentWindow)||void 0===o||o.postMessage({domain:null===(r=null===window||void 0===window?void 0:window.location)||void 0===r?void 0:r.hostname,action:"registerUserId",data:{userId:t.config.userId,token:t.config.token,userProfile:u(u({},t.config.userProfile||{}),{__INT_SYS_INFO__:u(u({},(null===(a=t.config.userProfile)||void 0===a?void 0:a.__INT_SYS_INFO__)||{}),ii())})}},l)}})),null===window||void 0===window||window.addEventListener("message",(function(n){var e,o;if(n.origin===t.config.domain){if("captureSessionData"===n.data){var r="66b33d16-5b38-4693-8772-1a1bd7dd412d"===t.config.chatbotId,a={cookies:oi(r),localStorage:JSON.stringify(localStorage),sessionStorage:JSON.stringify(sessionStorage),action:"capturedSessionData",domain_name:null===(e=null===window||void 0===window?void 0:window.location)||void 0===e?void 0:e.hostname};null===(o=i.contentWindow)||void 0===o||o.postMessage(a,t.config.domain||"*")}"expand"===n.data&&(t.adjustIframeWidth(),i.style.height="calc(100vh - 120px)",i.style.bottom="86px"),"collapse"===n.data&&Object.assign(i.style,{width:"26%",height:"calc(100vh - 32px - 10vh)",bottom:"86px",top:"calc(32px + 10vh)"})}}))},t.prototype.adjustIframeWidth=function(){if(this.iframe){var t=null===window||void 0===window?void 0:window.innerWidth;h.log("screenWidth",t),this.iframe.style.width=832>t?"".concat(t-64,"px"):"800px"}},t.prototype.loadSvgInline=function(t){var i=document.createElement("div");i.innerHTML='\n<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <g id="Chevron_Down">\n <path id="Vector" d="M19 9L12 16L5 9" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>\n </g>\n</svg>\n';var n=i.querySelector("svg");t.innerHTML="",n&&t.appendChild(n)},t.prototype.toggleIcon=function(t,i){"block"===i.style.display?this.loadSvgInline(t):this.loadImage(t)},t.prototype.toggleIframe=function(){var t;if(h.log("toggleIframe",this.iframe,this.logoContainer,this.chatBtnImage),this.iframe&&this.logoContainer&&this.chatBtnImage){var i=new URL(this.iframe.src).origin||this.config.domain;h.log("toggleIframe"),null===(t=this.iframe.contentWindow)||void 0===t||t.postMessage({domain:null===window||void 0===window?void 0:window.location.hostname,name:"none"===this.iframe.style.display?"openFrame":"closeFrame"},i),this.iframe.style.display="none"===this.iframe.style.display?"block":"none",this.toggleIcon(this.logoContainer,this.iframe),this.chatBtnImage.style.objectFit="block"===this.iframe.style.display?"none":"cover",this.bubblePromptContainer&&(this.bubblePromptContainer.style.display="none"),h.log("this.bubblePromptContainer",this.bubblePromptContainer)}},t.prototype.closeIframe=function(){this.iframe&&this.logoContainer&&this.chatBtnImage&&(this.iframe.style.display="none",this.toggleIcon(this.logoContainer,this.iframe),this.chatBtnImage.style.objectFit="cover")},t.prototype.init=function(){this.createIframe(),this.createFloatingButton()},t}(),ui=function(t){var i={isInitialized:!1,isInitializing:!1,error:null,chatbotConfig:null,isIframeVisible:!1},n=[],e=function(t){i=u(u({},i),t),n.forEach((function(t){return t(i)}))};return{getState:function(){return i},initialize:function(){return d(void 0,void 0,void 0,(function(){var i,n,o;return c(this,(function(r){switch(r.label){case 0:if(!t.api_key)return Yt.trackError(Error($t[Xt](t.api_key)),"ChatbotStateManager",{errorCode:Xt,errorType:Qt,context:{timestamp:Date.now()}}),[2];e({isInitializing:!0}),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,ai(t)];case 2:return i=r.sent(),[4,new Promise((function(t,n){!function(n,o,r){if(n.chatbotId&&n.userId)try{new si(n),e({isInitialized:!0,chatbotConfig:i}),t(),h.log("Robylon SDK initialized successfully.")}catch(t){r(t instanceof Error?t.message:"Failed to initialize SDK")}else r("Incomplete configuration for SDK initialization.")}(i,0,(function(t){n(t)}))}))];case 3:return r.sent(),[3,6];case 4:return n=r.sent(),o=n instanceof Error?n.message:"Failed to initialize chatbot",e({error:o}),Yt.trackError(n instanceof Error?n:Error(o),"ChatbotStateManager",{errorCode:Jt,errorType:Qt,context:{timestamp:Date.now()}}),[3,6];case 5:return e({isInitializing:!1}),[7];case 6:return[2]}}))}))},toggleIframeVisibility:function(){e({isIframeVisible:!i.isIframeVisible})},closeIframe:function(){e({isIframeVisible:!1})},updateState:e,subscribe:function(t){return n.push(t),function(){var i=n.indexOf(t);i>-1&&n.splice(i,1)}},unsubscribe:function(t){var i=n.indexOf(t);i>-1&&n.splice(i,1)}}},di=function(t){t.api_key,t.user_profile;var i=t.onEvent;return t.chatbotConfig,{emit:function(t,n){var e={type:t,timestamp:Date.now(),data:n};null==i||i(e)},onInternalEvent:function(t,i){}}},ci=function(){function t(t){var i=this;this.container=null,this.floatingButton=null,this.launcherDelayTimeout=null,this.iframe=null,this.isDestroyed=!1,this.handleStateChange=function(t){var n,e,o,r,a,l;if(!i.isDestroyed){var s=t.isInitialized,u=t.error,d=t.chatbotConfig,c=t.isIframeVisible;if(!u&&d&&s){if(i.eventEmitter=di({api_key:i.config.api_key,user_profile:i.config.user_profile,onEvent:i.config.onEvent,chatbotConfig:{isAnonymous:d.isAnonymous,userId:d.userId}}),i.container||(i.container=new ei(d,i.config.position,i.config.sideSpacing,i.config.bottomSpacing)),i.iframe)i.iframe.update({config:d,isVisible:c,position:i.config.position,bottomSpacing:i.config.bottomSpacing,overrides:i.config.overrides},!0);else if(i.iframe=new ni({config:d,isVisible:c,onClose:i.handleClose,onEvent:i.config.onEvent,onInternalEvent:i.eventEmitter.onInternalEvent,position:i.config.position,bottomSpacing:i.config.bottomSpacing,overrides:i.config.overrides}),i.iframe.getElement&&"function"==typeof i.iframe.getElement){var f=i.iframe.getElement();f&&i.container&&i.container.getElement().prepend(f)}var h=void 0!==i.config.show_launcher?!!i.config.show_launcher:null===(n=null==d?void 0:d.show_launcher)||void 0===n||n,v=!0===(null===(e=null==d?void 0:d.launcher_delay)||void 0===e?void 0:e.enabled),p=null!==(l=null!==(r=null===(o=null==d?void 0:d.launcher_delay)||void 0===o?void 0:o.seconds)&&void 0!==r?r:null===(a=null==d?void 0:d.launcher_delay)||void 0===a?void 0:a.delay)&&void 0!==l?l:0,m=function(){if(i.floatingButton)i.floatingButton.update({config:d,isIframeVisible:c,position:i.config.position,sideSpacing:i.config.sideSpacing,bottomSpacing:i.config.bottomSpacing,launcher_size:i.config.launcher_size});else if(i.floatingButton=new Nt({config:d,toggleIframe:i.toggleIframe,isIframeVisible:c,onEvent:i.config.onEvent,onInternalEvent:i.eventEmitter.onInternalEvent,position:i.config.position,sideSpacing:i.config.sideSpacing,bottomSpacing:i.config.bottomSpacing,launcher_size:i.config.launcher_size}),i.floatingButton.getElement&&"function"==typeof i.floatingButton.getElement){var t=i.floatingButton.getElement();t&&i.container&&i.container.getElement().appendChild(t)}};i.launcherDelayTimeout&&(clearTimeout(i.launcherDelayTimeout),i.launcherDelayTimeout=null),h?v&&+p>0&&!i.floatingButton?i.launcherDelayTimeout=window.setTimeout((function(){m(),i.launcherDelayTimeout=null}),1e3*+p):m():i.floatingButton&&(i.floatingButton.destroy(),i.floatingButton=null)}}},this.toggleIframe=function(){var t=i.stateManager.getState();i.stateManager.toggleIframeVisibility(),i.eventEmitter.emit(t.isIframeVisible?p.CHATBOT_CLOSED:p.CHATBOT_BUTTON_CLICKED)},this.handleClose=function(){i.stateManager.closeIframe(),i.eventEmitter.emit(p.CHATBOT_CLOSED)};var n=u(u({},t),{position:"string"==typeof t.position?"left"===t.position.toLowerCase()?"Left":"right"===t.position.toLowerCase()?"Right":void 0:void 0,sideSpacing:"string"==typeof t.sideSpacing?""===t.sideSpacing||isNaN(+t.sideSpacing)?void 0:+t.sideSpacing:t.sideSpacing,bottomSpacing:"string"==typeof t.bottomSpacing?""===t.bottomSpacing||isNaN(+t.bottomSpacing)?void 0:+t.bottomSpacing:t.bottomSpacing,show_launcher:t.show_launcher,overrides:t.overrides,launcher_size:t.launcher_size});if(this.config=n,!t.api_key)throw Yt.trackError(Error($t[Xt](t.api_key)),"RobylonChatbot",{errorCode:Xt,errorType:Qt,context:{timestamp:Date.now()}}),Error("API key is required");try{Yt.initialize(t.api_key,t.user_id)}catch(t){Yt.trackError(t instanceof Error?t:Error(t+""),"RobylonChatbot",{errorCode:Gt,errorType:Qt,context:{timestamp:Date.now()}})}this.stateManager=ui({api_key:t.api_key,user_id:t.user_id,user_token:t.user_token,user_profile:t.user_profile}),this.eventEmitter=di({api_key:t.api_key,user_profile:t.user_profile,onEvent:t.onEvent,chatbotConfig:null}),this.initialize()}return t.prototype.initialize=function(){return d(this,void 0,void 0,(function(){var t;return c(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.stateManager.initialize()];case 1:return i.sent(),this.stateManager.subscribe(this.handleStateChange),this.handleStateChange(this.stateManager.getState()),[3,3];case 2:return t=i.sent(),Yt.trackError(t instanceof Error?t:Error(t+""),"RobylonChatbot.initialize",{errorCode:Jt,errorType:Qt,context:{timestamp:Date.now()}}),[3,3];case 3:return[2]}}))}))},t.prototype.show=function(){this.stateManager.getState().isIframeVisible||(this.stateManager.toggleIframeVisibility(),this.eventEmitter.emit(p.CHATBOT_BUTTON_CLICKED))},t.prototype.hide=function(){this.stateManager.getState().isIframeVisible&&(this.stateManager.closeIframe(),this.eventEmitter.emit(p.CHATBOT_CLOSED))},t.prototype.toggle=function(){this.toggleIframe()},t.prototype.destroy=function(){this.isDestroyed=!0,this.floatingButton&&(this.floatingButton.destroy(),this.floatingButton=null),this.launcherDelayTimeout&&(clearTimeout(this.launcherDelayTimeout),this.launcherDelayTimeout=null),this.iframe&&(this.iframe.destroy(),this.iframe=null),this.container&&(this.container.destroy(),this.container=null),this.stateManager.unsubscribe(this.handleStateChange)},t.prototype.getState=function(){return this.stateManager.getState().isInitialized?"initialized":"uninitialized"},t}();function fi(t){return new ci(t)}if("undefined"!=typeof window){!function(){if("undefined"!=typeof window){var t=window,i=(null==t?void 0:t.RobylonChatbot)||(null==t?void 0:t.R);if(i&&Array.isArray(i.q)){var n=null;i.q.forEach((function(t){var i=t[0];if("init"===i){var e=t[1]||{};n=fi(e)}else n&&"function"==typeof n[i]&&n[i]()})),t.RobylonChatbot=function(t){var i=[].slice.call(arguments,1);return"init"===t?n=fi(i[0]||{}):n&&"function"==typeof n[t]?n[t].apply(n,i):void 0},(null==t?void 0:t.R)||(t.R=t.RobylonChatbot),t.RobylonChatbot.getState=function(){return"initialized"},(null==t?void 0:t.R)&&(t.R.getState=t.RobylonChatbot.getState)}}}();var hi=window,vi=null==hi?void 0:hi.RobylonChatbot;vi&&!(null==hi?void 0:hi.R)&&(hi.R=vi)}var pi={create:fi,getState:function(){return"initialized"}};t.create=fi,t.default=pi,Object.defineProperty(t,"i",{value:!0})}));
1
+ !function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((t="undefined"!=typeof globalThis?globalThis:t||self).RobylonChatbot={})}(this,(function(t){"use strict";var i,n,e,o,r,a,l,s,u=function(){return u=Object.assign||function(t){for(var i,n=1,e=arguments.length;e>n;n++)for(var o in i=arguments[n])({}).hasOwnProperty.call(i,o)&&(t[o]=i[o]);return t},u.apply(this,arguments)};function d(t,i,n,e){return new(n||(n=Promise))((function(o,r){function a(t){try{s(e.next(t))}catch(t){r(t)}}function l(t){try{s(e.throw(t))}catch(t){r(t)}}function s(t){var i;t.done?o(t.value):(i=t.value,i instanceof n?i:new n((function(t){t(i)}))).then(a,l)}s((e=e.apply(t,i||[])).next())}))}function c(t,i){var n,e,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(l){return function(s){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(r=0)),r;)try{if(n=1,e&&(o=2&l[0]?e.return:l[0]?e.throw||((o=e.return)&&o.call(e),0):e.next)&&!(o=o.call(e,l[1])).done)return o;switch(e=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,e=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(!((o=(o=r.trys).length>0&&o[o.length-1])||6!==l[0]&&2!==l[0])){r=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){r.label=l[1];break}if(6===l[0]&&r.label<o[1]){r.label=o[1],o=l;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(l);break}o[2]&&r.ops.pop(),r.trys.pop();continue}l=i.call(t,r)}catch(t){l=[6,t],e=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,s])}}}function f(t,i,n){if(n||2===arguments.length)for(var e,o=0,r=i.length;r>o;o++)!e&&o in i||(e||(e=[].slice.call(i,0,o)),e[o]=i[o]);return t.concat(e||[].slice.call(i))}"function"==typeof SuppressedError&&SuppressedError,function(t){t.WIDGET="WIDGET",t.POPOVER="POPOVER",t.EMBED="EMBED"}(i||(i={})),function(t){t.RIGHT="Right",t.LEFT="Left"}(n||(n={})),function(t){t.TEXT="TEXT",t.IMAGE="IMAGE",t.TEXTUAL_IMAGE="TEXTUAL_IMAGE"}(e||(e={})),function(t){t.WORKING_HOURS="WORKING_HOURS",t.ALWAYS="ALWAYS"}(o||(o={})),function(t){t.URL="URL"}(r||(r={})),function(t){t.AND="AND",t.OR="OR"}(a||(a={})),function(t){t.IS="IS",t.IS_NOT="IS_NOT",t.CONTAINS="CONTAINS",t.DOES_NOT_CONTAIN="DOES_NOT_CONTAIN",t.STARTS_WITH="STARTS_WITH",t.ENDS_WITH="ENDS_WITH"}(l||(l={})),function(t){t.BUTTON="BUTTON",t.TEXT="TEXT"}(s||(s={}));var h=function(t,i){void 0===i&&(i=.5);var n,e,o,r,a=function(t){t=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(t,i,n,e){return i+i+n+n+e+e}));var i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return i?{r:parseInt(i[1],16),g:parseInt(i[2],16),b:parseInt(i[3],16)}:{r:0,g:0,b:0}}(t);return(n=a.r,e=a.g,o=a.b,.2126*(r=[n,e,o].map((function(t){return(t/=255)>.03928?Math.pow((t+.055)/1.055,2.4):t/12.92})))[0]+.7152*r[1]+.0722*r[2])>i?"#0E0E0F":"#FFFFFF"},v={log:function(){for(var t=[],i=0;arguments.length>i;i++)t[i]=arguments[i];console.log.apply(console,t)},error:function(){for(var t=[],i=0;arguments.length>i;i++)t[i]=arguments[i];console.error.apply(console,t)},warn:function(){for(var t=[],i=0;arguments.length>i;i++)t[i]=arguments[i];console.warn.apply(console,t)},info:function(){}};v.log("Raw API_URL:","https://stage-api.robylon.ai");var p={copilotUrl:"https://staging.d2s3wsqyyond1h.amplifyapp.com",environment:"staging",apiUrl:"https://stage-api.robylon.ai"};v.log("CONFIG",p);var m,g,b=function(){return"undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement},w=function(){return{copilotUrl:p.copilotUrl||"https://app.robylon.ai",environment:p.environment||"production",apiUrl:p.apiUrl||"https://app.robylon.ai"}};!function(t){t.CHATBOT_BUTTON_LOADED="CHATBOT_BUTTON_LOADED",t.CHATBOT_BUTTON_CLICKED="CHATBOT_BUTTON_CLICKED",t.CHATBOT_OPENED="CHATBOT_OPENED",t.CHATBOT_CLOSED="CHATBOT_CLOSED",t.CHATBOT_APP_READY="CHATBOT_APP_READY",t.CHATBOT_LOADED="CHATBOT_LOADED",t.CHAT_INITIALIZED="CHAT_INITIALIZED",t.SESSION_REFRESHED="SESSION_REFRESHED",t.CHAT_INITIALIZATION_FAILED="CHAT_INITIALIZATION_FAILED",t.CHATBOT_READY="CHATBOT_READY"}(m||(m={})),function(t){t.CHAT_MOVED="CHAT_MOVED",t.CHATBOT_TOKEN_EXHAUSTED="CHATBOT_TOKEN_EXHAUSTED"}(g||(g={}));var y,x="system-ui, Inter, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'",_="21px",I="",T=[],E=!1,S=function(){return"undefined"==typeof window?"":window.location.href},A=function(){return S()},R=function(){var t=S();t!==I&&(I=t,T.forEach((function(i){return i(t)})))},k=function(t,i,n,e){var o=i||"",r=S(),a=e||r,s=function(t,i){return-1!==i.indexOf(t)}(o,a);switch(n){case l.IS:return a===o;case l.IS_NOT:return a!==o;case l.CONTAINS:return s;case l.DOES_NOT_CONTAIN:return!s;case l.STARTS_WITH:return a.startsWith(o);case l.ENDS_WITH:return a.endsWith(o);default:return!1}},O=null,D=null,C=function(){return O===A()},z=function(){return!0},F=((y={})[o.WORKING_HOURS]=function(t,i){var n=i.getHours(),e=i.getMinutes();return(n>10||10===n&&e>=0)&&(19>n||19===n&&0===e)},y[o.ALWAYS]=z,y);const{entries:M,setPrototypeOf:N,isFrozen:j,getPrototypeOf:L,getOwnPropertyDescriptor:U}=Object;let{freeze:P,seal:W,create:B}=Object,{apply:H,construct:Y}="undefined"!=typeof Reflect&&Reflect;P||(P=function(t){return t}),W||(W=function(t){return t}),H||(H=function(t,i){for(var n=arguments.length,e=Array(n>2?n-2:0),o=2;n>o;o++)e[o-2]=arguments[o];return t.apply(i,e)}),Y||(Y=function(t){for(var i=arguments.length,n=Array(i>1?i-1:0),e=1;i>e;e++)n[e-1]=arguments[e];return new t(...n)});const X=at([].forEach),J=at([].lastIndexOf),G=at([].pop),K=at([].push),Z=at([].splice),V=at("".toLowerCase),q=at("".toString),Q=at("".match),$=at("".replace),tt=at("".indexOf),it=at("".trim),nt=at({}.hasOwnProperty),et=at(/t/.test),ot=(rt=TypeError,function(){for(var t=arguments.length,i=Array(t),n=0;t>n;n++)i[n]=arguments[n];return Y(rt,i)});var rt;function at(t){return function(i){i instanceof RegExp&&(i.lastIndex=0);for(var n=arguments.length,e=Array(n>1?n-1:0),o=1;n>o;o++)e[o-1]=arguments[o];return H(t,i,e)}}function lt(t,i){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:V;N&&N(t,null);let e=i.length;for(;e--;){let o=i[e];if("string"==typeof o){const t=n(o);t!==o&&(j(i)||(i[e]=t),o=t)}t[o]=!0}return t}function st(t){for(let i=0;i<t.length;i++)nt(t,i)||(t[i]=null);return t}function ut(t){const i=B(null);for(const[n,e]of M(t))nt(t,n)&&(Array.isArray(e)?i[n]=st(e):e&&"object"==typeof e&&e.constructor===Object?i[n]=ut(e):i[n]=e);return i}function dt(t,i){for(;null!==t;){const n=U(t,i);if(n){if(n.get)return at(n.get);if("function"==typeof n.value)return at(n.value)}t=L(t)}return function(){return null}}const ct=P(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ft=P(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ht=P(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),vt=P(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),pt=P(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),mt=P(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),gt=P(["#text"]),bt=P(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),wt=P(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),yt=P(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),xt=P(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),_t=W(/\{\{[\w\W]*|[\w\W]*\}\}/gm),It=W(/<%[\w\W]*|[\w\W]*%>/gm),Tt=W(/\$\{[\w\W]*/gm),Et=W(/^data-[\-\w.\u00B7-\uFFFF]+$/),St=W(/^aria-[\-\w]+$/),At=W(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Rt=W(/^(?:\w+script|data):/i),kt=W(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ot=W(/^html$/i),Dt=W(/^[a-z][.\w]*(-[.\w]+)+$/i);var Ct=Object.freeze({__proto__:null,ARIA_ATTR:St,ATTR_WHITESPACE:kt,CUSTOM_ELEMENT:Dt,DATA_ATTR:Et,DOCTYPE_NAME:Ot,ERB_EXPR:It,IS_ALLOWED_URI:At,IS_SCRIPT_OR_DATA:Rt,MUSTACHE_EXPR:_t,TMPLIT_EXPR:Tt});const zt=function(){return"undefined"==typeof window?null:window};var Ft,Mt=function t(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:zt();const n=i=>t(i);if(n.version="3.3.0",n.removed=[],!i||!i.document||9!==i.document.nodeType||!i.Element)return n.isSupported=!1,n;let{document:e}=i;const o=e,r=o.currentScript,{DocumentFragment:a,HTMLTemplateElement:l,Node:s,Element:u,NodeFilter:d,NamedNodeMap:c=i.NamedNodeMap||i.MozNamedAttrMap,HTMLFormElement:f,DOMParser:h,trustedTypes:v}=i,p=u.prototype,m=dt(p,"cloneNode"),g=dt(p,"remove"),b=dt(p,"nextSibling"),w=dt(p,"childNodes"),y=dt(p,"parentNode");if("function"==typeof l){const t=e.createElement("template");t.content&&t.content.ownerDocument&&(e=t.content.ownerDocument)}let x,_="";const{implementation:I,createNodeIterator:T,createDocumentFragment:E,getElementsByTagName:S}=e,{importNode:A}=o;let R={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof M&&"function"==typeof y&&I&&void 0!==I.createHTMLDocument;const{MUSTACHE_EXPR:k,ERB_EXPR:O,TMPLIT_EXPR:D,DATA_ATTR:C,ARIA_ATTR:z,IS_SCRIPT_OR_DATA:F,ATTR_WHITESPACE:N,CUSTOM_ELEMENT:j}=Ct;let{IS_ALLOWED_URI:L}=Ct,U=null;const W=lt({},[...ct,...ft,...ht,...pt,...gt]);let H=null;const Y=lt({},[...bt,...wt,...yt,...xt]);let rt=Object.seal(B(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),at=null,st=null;const _t=Object.seal(B(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let It=!0,Tt=!0,Et=!1,St=!0,Rt=!1,kt=!0,Dt=!1,Ft=!1,Mt=!1,Nt=!1,jt=!1,Lt=!1,Ut=!0,Pt=!1,Wt=!0,Bt=!1,Ht={},Yt=null;const Xt=lt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Jt=null;const Gt=lt({},["audio","video","img","source","image","track"]);let Kt=null;const Zt=lt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Vt="http://www.w3.org/1998/Math/MathML",qt="http://www.w3.org/2000/svg",Qt="http://www.w3.org/1999/xhtml";let $t=Qt,ti=!1,ii=null;const ni=lt({},[Vt,qt,Qt],q);let ei=lt({},["mi","mo","mn","ms","mtext"]),oi=lt({},["annotation-xml"]);const ri=lt({},["title","style","font","a","script"]);let ai=null;const li=["application/xhtml+xml","text/html"];let si=null,ui=null;const di=e.createElement("form"),ci=function(t){return t instanceof RegExp||t instanceof Function},fi=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!ui||ui!==t){if(t&&"object"==typeof t||(t={}),t=ut(t),ai=-1===li.indexOf(t.PARSER_MEDIA_TYPE)?"text/html":t.PARSER_MEDIA_TYPE,si="application/xhtml+xml"===ai?q:V,U=nt(t,"ALLOWED_TAGS")?lt({},t.ALLOWED_TAGS,si):W,H=nt(t,"ALLOWED_ATTR")?lt({},t.ALLOWED_ATTR,si):Y,ii=nt(t,"ALLOWED_NAMESPACES")?lt({},t.ALLOWED_NAMESPACES,q):ni,Kt=nt(t,"ADD_URI_SAFE_ATTR")?lt(ut(Zt),t.ADD_URI_SAFE_ATTR,si):Zt,Jt=nt(t,"ADD_DATA_URI_TAGS")?lt(ut(Gt),t.ADD_DATA_URI_TAGS,si):Gt,Yt=nt(t,"FORBID_CONTENTS")?lt({},t.FORBID_CONTENTS,si):Xt,at=nt(t,"FORBID_TAGS")?lt({},t.FORBID_TAGS,si):ut({}),st=nt(t,"FORBID_ATTR")?lt({},t.FORBID_ATTR,si):ut({}),Ht=!!nt(t,"USE_PROFILES")&&t.USE_PROFILES,It=!1!==t.ALLOW_ARIA_ATTR,Tt=!1!==t.ALLOW_DATA_ATTR,Et=t.ALLOW_UNKNOWN_PROTOCOLS||!1,St=!1!==t.ALLOW_SELF_CLOSE_IN_ATTR,Rt=t.SAFE_FOR_TEMPLATES||!1,kt=!1!==t.SAFE_FOR_XML,Dt=t.WHOLE_DOCUMENT||!1,Nt=t.RETURN_DOM||!1,jt=t.RETURN_DOM_FRAGMENT||!1,Lt=t.RETURN_TRUSTED_TYPE||!1,Mt=t.FORCE_BODY||!1,Ut=!1!==t.SANITIZE_DOM,Pt=t.SANITIZE_NAMED_PROPS||!1,Wt=!1!==t.KEEP_CONTENT,Bt=t.IN_PLACE||!1,L=t.ALLOWED_URI_REGEXP||At,$t=t.NAMESPACE||Qt,ei=t.MATHML_TEXT_INTEGRATION_POINTS||ei,oi=t.HTML_INTEGRATION_POINTS||oi,rt=t.CUSTOM_ELEMENT_HANDLING||{},t.CUSTOM_ELEMENT_HANDLING&&ci(t.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(rt.tagNameCheck=t.CUSTOM_ELEMENT_HANDLING.tagNameCheck),t.CUSTOM_ELEMENT_HANDLING&&ci(t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(rt.attributeNameCheck=t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),t.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(rt.allowCustomizedBuiltInElements=t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Rt&&(Tt=!1),jt&&(Nt=!0),Ht&&(U=lt({},gt),H=[],!0===Ht.html&&(lt(U,ct),lt(H,bt)),!0===Ht.svg&&(lt(U,ft),lt(H,wt),lt(H,xt)),!0===Ht.svgFilters&&(lt(U,ht),lt(H,wt),lt(H,xt)),!0===Ht.mathMl&&(lt(U,pt),lt(H,yt),lt(H,xt))),t.ADD_TAGS&&("function"==typeof t.ADD_TAGS?_t.tagCheck=t.ADD_TAGS:(U===W&&(U=ut(U)),lt(U,t.ADD_TAGS,si))),t.ADD_ATTR&&("function"==typeof t.ADD_ATTR?_t.attributeCheck=t.ADD_ATTR:(H===Y&&(H=ut(H)),lt(H,t.ADD_ATTR,si))),t.ADD_URI_SAFE_ATTR&&lt(Kt,t.ADD_URI_SAFE_ATTR,si),t.FORBID_CONTENTS&&(Yt===Xt&&(Yt=ut(Yt)),lt(Yt,t.FORBID_CONTENTS,si)),Wt&&(U["#text"]=!0),Dt&&lt(U,["html","head","body"]),U.table&&(lt(U,["tbody"]),delete at.tbody),t.TRUSTED_TYPES_POLICY){if("function"!=typeof t.TRUSTED_TYPES_POLICY.createHTML)throw ot('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof t.TRUSTED_TYPES_POLICY.createScriptURL)throw ot('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');x=t.TRUSTED_TYPES_POLICY,_=x.createHTML("")}else void 0===x&&(x=function(t,i){if("object"!=typeof t||"function"!=typeof t.createPolicy)return null;let n=null;const e="data-tt-policy-suffix";i&&i.hasAttribute(e)&&(n=i.getAttribute(e));const o="dompurify"+(n?"#"+n:"");try{return t.createPolicy(o,{createHTML:t=>t,createScriptURL:t=>t})}catch(t){return console.warn("TrustedTypes policy "+o+" could not be created."),null}}(v,r)),null!==x&&"string"==typeof _&&(_=x.createHTML(""));P&&P(t),ui=t}},hi=lt({},[...ft,...ht,...vt]),vi=lt({},[...pt,...mt]),pi=function(t){K(n.removed,{element:t});try{y(t).removeChild(t)}catch(i){g(t)}},mi=function(t,i){try{K(n.removed,{attribute:i.getAttributeNode(t),from:i})}catch(t){K(n.removed,{attribute:null,from:i})}if(i.removeAttribute(t),"is"===t)if(Nt||jt)try{pi(i)}catch(t){}else try{i.setAttribute(t,"")}catch(t){}},gi=function(t){let i=null,n=null;if(Mt)t="<remove></remove>"+t;else{const i=Q(t,/^[\r\n\t ]+/);n=i&&i[0]}"application/xhtml+xml"===ai&&$t===Qt&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");const o=x?x.createHTML(t):t;if($t===Qt)try{i=(new h).parseFromString(o,ai)}catch(t){}if(!i||!i.documentElement){i=I.createDocument($t,"template",null);try{i.documentElement.innerHTML=ti?_:o}catch(t){}}const r=i.body||i.documentElement;return t&&n&&r.insertBefore(e.createTextNode(n),r.childNodes[0]||null),$t===Qt?S.call(i,Dt?"html":"body")[0]:Dt?i.documentElement:r},bi=function(t){return T.call(t.ownerDocument||t,t,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},wi=function(t){return t instanceof f&&("string"!=typeof t.nodeName||"string"!=typeof t.textContent||"function"!=typeof t.removeChild||!(t.attributes instanceof c)||"function"!=typeof t.removeAttribute||"function"!=typeof t.setAttribute||"string"!=typeof t.namespaceURI||"function"!=typeof t.insertBefore||"function"!=typeof t.hasChildNodes)},yi=function(t){return"function"==typeof s&&t instanceof s};function xi(t,i,e){X(t,(t=>{t.call(n,i,e,ui)}))}const _i=function(t){let i=null;if(xi(R.beforeSanitizeElements,t,null),wi(t))return pi(t),!0;const e=si(t.nodeName);if(xi(R.uponSanitizeElement,t,{tagName:e,allowedTags:U}),kt&&t.hasChildNodes()&&!yi(t.firstElementChild)&&et(/<[/\w!]/g,t.innerHTML)&&et(/<[/\w!]/g,t.textContent))return pi(t),!0;if(7===t.nodeType)return pi(t),!0;if(kt&&8===t.nodeType&&et(/<[/\w]/g,t.data))return pi(t),!0;if(!(_t.tagCheck instanceof Function&&_t.tagCheck(e))&&(!U[e]||at[e])){if(!at[e]&&Ti(e)){if(rt.tagNameCheck instanceof RegExp&&et(rt.tagNameCheck,e))return!1;if(rt.tagNameCheck instanceof Function&&rt.tagNameCheck(e))return!1}if(Wt&&!Yt[e]){const i=y(t)||t.parentNode,n=w(t)||t.childNodes;if(n&&i)for(let e=n.length-1;e>=0;--e){const o=m(n[e],!0);o.t=(t.t||0)+1,i.insertBefore(o,b(t))}}return pi(t),!0}return t instanceof u&&!function(t){let i=y(t);i&&i.tagName||(i={namespaceURI:$t,tagName:"template"});const n=V(t.tagName),e=V(i.tagName);return!!ii[t.namespaceURI]&&(t.namespaceURI===qt?i.namespaceURI===Qt?"svg"===n:i.namespaceURI===Vt?"svg"===n&&("annotation-xml"===e||ei[e]):!!hi[n]:t.namespaceURI===Vt?i.namespaceURI===Qt?"math"===n:i.namespaceURI===qt?"math"===n&&oi[e]:!!vi[n]:t.namespaceURI===Qt?!(i.namespaceURI===qt&&!oi[e])&&!(i.namespaceURI===Vt&&!ei[e])&&!vi[n]&&(ri[n]||!hi[n]):!("application/xhtml+xml"!==ai||!ii[t.namespaceURI]))}(t)?(pi(t),!0):"noscript"!==e&&"noembed"!==e&&"noframes"!==e||!et(/<\/no(script|embed|frames)/i,t.innerHTML)?(Rt&&3===t.nodeType&&(i=t.textContent,X([k,O,D],(t=>{i=$(i,t," ")})),t.textContent!==i&&(K(n.removed,{element:t.cloneNode()}),t.textContent=i)),xi(R.afterSanitizeElements,t,null),!1):(pi(t),!0)},Ii=function(t,i,n){if(Ut&&("id"===i||"name"===i)&&(n in e||n in di))return!1;if(Tt&&!st[i]&&et(C,i));else if(It&&et(z,i));else if(_t.attributeCheck instanceof Function&&_t.attributeCheck(i,t));else if(!H[i]||st[i]){if(!(Ti(t)&&(rt.tagNameCheck instanceof RegExp&&et(rt.tagNameCheck,t)||rt.tagNameCheck instanceof Function&&rt.tagNameCheck(t))&&(rt.attributeNameCheck instanceof RegExp&&et(rt.attributeNameCheck,i)||rt.attributeNameCheck instanceof Function&&rt.attributeNameCheck(i,t))||"is"===i&&rt.allowCustomizedBuiltInElements&&(rt.tagNameCheck instanceof RegExp&&et(rt.tagNameCheck,n)||rt.tagNameCheck instanceof Function&&rt.tagNameCheck(n))))return!1}else if(Kt[i]);else if(et(L,$(n,N,"")));else if("src"!==i&&"xlink:href"!==i&&"href"!==i||"script"===t||0!==tt(n,"data:")||!Jt[t])if(Et&&!et(F,$(n,N,"")));else if(n)return!1;return!0},Ti=function(t){return"annotation-xml"!==t&&Q(t,j)},Ei=function(t){xi(R.beforeSanitizeAttributes,t,null);const{attributes:i}=t;if(!i||wi(t))return;const e={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:H,forceKeepAttr:void 0};let o=i.length;for(;o--;){const r=i[o],{name:a,namespaceURI:l,value:s}=r,u=si(a),d=s;let c="value"===a?d:it(d);if(e.attrName=u,e.attrValue=c,e.keepAttr=!0,e.forceKeepAttr=void 0,xi(R.uponSanitizeAttribute,t,e),c=e.attrValue,!Pt||"id"!==u&&"name"!==u||(mi(a,t),c="user-content-"+c),kt&&et(/((--!?|])>)|<\/(style|title|textarea)/i,c)){mi(a,t);continue}if("attributename"===u&&Q(c,"href")){mi(a,t);continue}if(e.forceKeepAttr)continue;if(!e.keepAttr){mi(a,t);continue}if(!St&&et(/\/>/i,c)){mi(a,t);continue}Rt&&X([k,O,D],(t=>{c=$(c,t," ")}));const f=si(t.nodeName);if(Ii(f,u,c)){if(x&&"object"==typeof v&&"function"==typeof v.getAttributeType)if(l);else switch(v.getAttributeType(f,u)){case"TrustedHTML":c=x.createHTML(c);break;case"TrustedScriptURL":c=x.createScriptURL(c)}if(c!==d)try{l?t.setAttributeNS(l,a,c):t.setAttribute(a,c),wi(t)?pi(t):G(n.removed)}catch(i){mi(a,t)}}else mi(a,t)}xi(R.afterSanitizeAttributes,t,null)},Si=function t(i){let n=null;const e=bi(i);for(xi(R.beforeSanitizeShadowDOM,i,null);n=e.nextNode();)xi(R.uponSanitizeShadowNode,n,null),_i(n),Ei(n),n.content instanceof a&&t(n.content);xi(R.afterSanitizeShadowDOM,i,null)};return n.sanitize=function(t){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=null,r=null,l=null,u=null;if(ti=!t,ti&&(t="\x3c!--\x3e"),"string"!=typeof t&&!yi(t)){if("function"!=typeof t.toString)throw ot("toString is not a function");if("string"!=typeof(t=t.toString()))throw ot("dirty is not a string, aborting")}if(!n.isSupported)return t;if(Ft||fi(i),n.removed=[],"string"==typeof t&&(Bt=!1),Bt){if(t.nodeName){const i=si(t.nodeName);if(!U[i]||at[i])throw ot("root node is forbidden and cannot be sanitized in-place")}}else if(t instanceof s)e=gi("\x3c!----\x3e"),r=e.ownerDocument.importNode(t,!0),1===r.nodeType&&"BODY"===r.nodeName||"HTML"===r.nodeName?e=r:e.appendChild(r);else{if(!Nt&&!Rt&&!Dt&&-1===t.indexOf("<"))return x&&Lt?x.createHTML(t):t;if(e=gi(t),!e)return Nt?null:Lt?_:""}e&&Mt&&pi(e.firstChild);const d=bi(Bt?t:e);for(;l=d.nextNode();)_i(l),Ei(l),l.content instanceof a&&Si(l.content);if(Bt)return t;if(Nt){if(jt)for(u=E.call(e.ownerDocument);e.firstChild;)u.appendChild(e.firstChild);else u=e;return(H.shadowroot||H.shadowrootmode)&&(u=A.call(o,u,!0)),u}let c=Dt?e.outerHTML:e.innerHTML;return Dt&&U["!doctype"]&&e.ownerDocument&&e.ownerDocument.doctype&&e.ownerDocument.doctype.name&&et(Ot,e.ownerDocument.doctype.name)&&(c="<!DOCTYPE "+e.ownerDocument.doctype.name+">\n"+c),Rt&&X([k,O,D],(t=>{c=$(c,t," ")})),x&&Lt?x.createHTML(c):c},n.setConfig=function(){fi(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Ft=!0},n.clearConfig=function(){ui=null,Ft=!1},n.isValidAttribute=function(t,i,n){ui||fi({});const e=si(t),o=si(i);return Ii(e,o,n)},n.addHook=function(t,i){"function"==typeof i&&K(R[t],i)},n.removeHook=function(t,i){if(void 0!==i){const n=J(R[t],i);return-1===n?void 0:Z(R[t],n,1)[0]}return G(R[t])},n.removeHooks=function(t){R[t]=[]},n.removeAllHooks=function(){R={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}(),Nt=function(){function t(t){var i,n=this;this.resizeObserver=null,this.proactiveElement=null,this.urlUnsubscribe=null,this.delayTimers=[],this.config=t,this.buttonElement=document.createElement("div"),this.handleResizeFunction=this.handleResize.bind(this),this.render(),this.mount();try{this.buttonElement.style.opacity="0",this.buttonElement.style.transition="transform 0.2s cubic-bezier(0.2, 1.27, 0.29, 0.97), opacity 280ms ease",requestAnimationFrame((function(){n.buttonElement.style.opacity="1"}))}catch(t){}this.setupResizeListener(),this.renderProactiveIfNeeded(),this.urlUnsubscribe=(i=function(){n.clearProactiveDelays(),n.renderProactiveIfNeeded(!0)},E||function(){if(!E&&"undefined"!=typeof window){E=!0,I=S();var t=function(t){var i=history[t];return function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];var e=i.apply(this,t);return setTimeout(R,0),e}};try{history.pushState=t("pushState"),history.replaceState=t("replaceState")}catch(t){}window.addEventListener("popstate",R),window.addEventListener("hashchange",R);var i=setInterval((function(){R()}),1e3);setInterval((function(){0===T.length&&(clearInterval(i),window.removeEventListener("popstate",R),window.removeEventListener("hashchange",R),E=!1)}),5e3)}}(),T.push(i),i(S()),function(){var t=T.indexOf(i);t>-1&&T.splice(t,1)})}return t.prototype.render=function(){var t,i=this;w().copilotUrl;var n=this.config,o=n.config,r=n.isIframeVisible,a=null!==(t=this.config.launcher_size)&&void 0!==t?t:48,l={zIndex:"1000",display:"flex",flexDirection:"column-reverse",alignItems:"center",justifyContent:"center",cursor:"pointer",overflow:"hidden",marginTop:"16px",transition:"transform 0.2s cubic-bezier(0.2, 1.27, 0.29, 0.97)",transform:r?"scale(0.85)":"scale(1)",fontFamily:x};o.launcher_type===e.IMAGE&&Object.assign(l,{width:"".concat(a,"px"),height:"".concat(a,"px"),borderRadius:"50%",backgroundColor:o.brand_colour}),this.applyResponsiveStyles(l),this.buttonElement.className="message-bubble-container",this.buttonElement.innerHTML="",this.buttonElement.appendChild(this.createLauncherElement()),this.buttonElement.onclick=function(){i.config.toggleIframe(),i.hideProactiveMessages()},this.renderProactiveIfNeeded()},t.prototype.createLauncherElement=function(){var t,i,n,o=this.config,r=o.config,a=o.isIframeVisible,l=w().copilotUrl,s=null!==(t=this.config.launcher_size)&&void 0!==t?t:48;switch(console.log("config in floating button",r),r.launcher_type){case e.TEXT:return this.createTextLauncher();case e.TEXTUAL_IMAGE:return this.createTextualImageLauncher();case e.IMAGE:default:if(a){var u=Math.round(.5*s),d=document.createElement("div");Object.assign(d.style,{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%"});var c=document.createElementNS("http://www.w3.org/2000/svg","svg");c.setAttribute("width",u+""),c.setAttribute("height",u+""),c.setAttribute("viewBox","0 0 24 24"),c.setAttribute("fill","none"),c.setAttribute("xmlns","http://www.w3.org/2000/svg"),c.style.display="block";var f=document.createElementNS("http://www.w3.org/2000/svg","path");return f.setAttribute("d","M19 9L12 16L5 9"),f.setAttribute("stroke","currentColor"),f.setAttribute("stroke-width","1.5"),f.setAttribute("stroke-linecap","round"),f.setAttribute("stroke-linejoin","round"),c.appendChild(f),d.appendChild(c),d}var h=document.createElement("img");return h.src=r.launcher_type?(null===(n=null===(i=r.images)||void 0===i?void 0:i.launcher_image_url)||void 0===n?void 0:n.url)||"".concat(l,"/chatbubble.png"):r.image_url||"".concat(l,"/chatbubble.png"),h.alt="Chat",Object.assign(h.style,{zIndex:"1000",cursor:"pointer",borderRadius:"50%",objectFit:"cover",width:"100%",height:"100%",boxSizing:"border-box"}),h}},t.prototype.createTextLauncher=function(){var t=this.config.config,i=t.brand_colour,n=t.launcher_properties,e=document.createElement("div");Object.assign(e.style,{width:"fit-content",maxWidth:"160px",height:"40px",borderRadius:"9999px",backgroundColor:i,display:"flex",alignItems:"center",padding:"9px 20px",boxShadow:"0px 0px 16px 0px rgba(0, 0, 0, 0.24)",boxSizing:"border-box"});var o=document.createElement("div");Object.assign(o.style,{flex:"1",minWidth:"0"});var r=document.createElement("p");return Object.assign(r.style,{margin:"0",color:h(i),fontSize:"0.875rem",fontWeight:"600",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:_,fontFamily:x,WebkitFontSmoothing:"antialiased",textRendering:"optimizeLegibility",textSizeAdjust:"100%"}),r.textContent=(null==n?void 0:n.text)||"",o.appendChild(r),e.appendChild(o),e},t.prototype.createTextualImageLauncher=function(){var t,i,n,e,o,r,a=w().copilotUrl,l=this.config.config,s=l.brand_colour,u=l.launcher_properties,d=l.image_url,c=document.createElement("div");Object.assign(c.style,{maxWidth:"13rem",width:"fit-content",height:"40px",borderRadius:"9999px",backgroundColor:s,display:"flex",alignItems:"center",paddingLeft:"20px",paddingRight:"0",paddingTop:"9px",paddingBottom:"9px",boxShadow:"0px 0px 16px 0px rgba(0, 0, 0, 0.24)",gap:"8px",boxSizing:"border-box"});var f=document.createElement("div");Object.assign(f.style,{flex:"1",minWidth:"0"});var v=document.createElement("p");Object.assign(v.style,{margin:"0",color:h(s),fontSize:"0.875rem",fontWeight:"600",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:_,fontFamily:x,WebkitFontSmoothing:"antialiased",textRendering:"optimizeLegibility",textSizeAdjust:"100%"}),v.textContent=(null==u?void 0:u.text)||"";var p=document.createElement("div");Object.assign(p.style,{width:"40px",height:"40px",borderRadius:"9999px",overflow:"hidden",position:"relative",flexShrink:"0"});var m=document.createElement("img");return m.src=(null===(i=null===(t=null==this?void 0:this.config)||void 0===t?void 0:t.config)||void 0===i?void 0:i.launcher_type)?(null===(r=null===(o=null===(e=null===(n=null==this?void 0:this.config)||void 0===n?void 0:n.config)||void 0===e?void 0:e.images)||void 0===o?void 0:o.launcher_image_url)||void 0===r?void 0:r.url)||"".concat(a,"/chatbubble.png"):d||"".concat(a,"/chatbubble.png"),m.alt="Chat",Object.assign(m.style,{width:"100%",height:"100%",objectFit:"cover"}),f.appendChild(v),p.appendChild(m),c.appendChild(f),c.appendChild(p),c},t.prototype.applyResponsiveStyles=function(t){var i,n,e,o,r,a,l,s,d,c=560>(null===window||void 0===window?void 0:window.innerWidth),f=this.config.config,h=this.config.position||(null===(e=f.interface_properties)||void 0===e?void 0:e.position)||"Right",v=null!==(a=null!==(o=this.config.sideSpacing)&&void 0!==o?o:null===(r=f.interface_properties)||void 0===r?void 0:r.side_spacing)&&void 0!==a?a:20,p=null!==(d=null!==(l=this.config.bottomSpacing)&&void 0!==l?l:null===(s=f.interface_properties)||void 0===s?void 0:s.bottom_spacing)&&void 0!==d?d:20;this.buttonElement.style.position="",this.buttonElement.style.bottom="",this.buttonElement.style.right="",this.buttonElement.style.left="";var m=u(u({},t),c?((i={position:"fixed",bottom:"".concat(p,"px")})[h.toLowerCase()]="".concat(v,"px"),i):((n={bottom:"".concat(p,"px")})[h.toLowerCase()]="".concat(v,"px"),n));Object.assign(this.buttonElement.style,m)},t.prototype.handleResize=function(){var t,i=null!==(t=this.config.launcher_size)&&void 0!==t?t:48,n={zIndex:"1000",display:"flex",flexDirection:"column-reverse",alignItems:"center",justifyContent:"center",cursor:"pointer",overflow:"hidden",marginTop:"16px",borderRadius:this.config.config.launcher_type&&this.config.config.launcher_type!==e.IMAGE?"9999px":"50%",boxSizing:"border-box"};this.config.config.launcher_type===e.IMAGE&&Object.assign(n,{width:"".concat(i,"px"),height:"".concat(i,"px"),borderRadius:"50%",backgroundColor:this.config.config.brand_colour}),this.applyResponsiveStyles(n)},t.prototype.setupResizeListener=function(){"undefined"!=typeof ResizeObserver?(this.resizeObserver=new ResizeObserver(this.handleResizeFunction),this.resizeObserver.observe(document.body)):window.addEventListener("resize",this.handleResizeFunction)},t.prototype.getElement=function(){return this.buttonElement},t.prototype.mount=function(){var t=this;requestAnimationFrame((function(){var i,n;null===(n=(i=t.config).onEvent)||void 0===n||n.call(i,{type:m.CHATBOT_BUTTON_LOADED,timestamp:Date.now()}),t.config.onInternalEvent(m.CHATBOT_BUTTON_LOADED)}))},t.prototype.update=function(t){this.config.isIframeVisible,this.config=u(u({},this.config),t),this.buttonElement.style.transform=this.config.isIframeVisible?"scale(0.85)":"scale(1)",this.render(),this.renderProactiveIfNeeded()},t.prototype.destroy=function(){this.resizeObserver?(this.resizeObserver.disconnect(),this.resizeObserver=null):window.removeEventListener("resize",this.handleResizeFunction),this.buttonElement&&this.buttonElement.parentNode&&this.buttonElement.parentNode.removeChild(this.buttonElement),this.proactiveElement&&this.proactiveElement.parentElement&&(this.proactiveElement.parentElement.removeChild(this.proactiveElement),this.proactiveElement=null),this.clearProactiveDelays(),this.urlUnsubscribe&&(this.urlUnsubscribe(),this.urlUnsubscribe=null)},t.prototype.clearProactiveDelays=function(){this.delayTimers.forEach((function(t){return clearTimeout(t)})),this.delayTimers=[]},t.prototype.hideProactiveMessages=function(){var t,i,n=this;O=A();var e=null===(t=this.proactiveElement)||void 0===t?void 0:t.children[0];if(e){var o="Right"===(this.config.position||(null===(i=this.config.config.interface_properties)||void 0===i?void 0:i.position)||"Right");Array.from(e.children).forEach((function(t){t.className=o?"rblyn-proactive-exit-right":"rblyn-proactive-exit-left"})),setTimeout((function(){n.proactiveElement&&n.proactiveElement.parentElement&&n.proactiveElement.parentElement.removeChild(n.proactiveElement),n.proactiveElement=null,n.clearProactiveDelays()}),400)}else this.clearProactiveDelays()},t.prototype.injectAnimationStyles=function(){if(!document.getElementById("rblyn-proactive-animations")){var t=document.createElement("style");t.id="rblyn-proactive-animations",t.textContent="\n @keyframes slideInFromRight {\n 0% {\n transform: translateX(120%) scale(0.95);\n opacity: 0;\n }\n 85% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n 92% {\n transform: translateX(-1px) scale(1.002);\n }\n 100% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n }\n @keyframes slideInFromLeft {\n 0% {\n transform: translateX(-120%) scale(0.95);\n opacity: 0;\n }\n 85% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n 92% {\n transform: translateX(1px) scale(1.002);\n }\n 100% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n }\n @keyframes slideOutRight {\n 0% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n 100% {\n transform: translateX(120%) scale(0.9);\n opacity: 0;\n }\n }\n @keyframes slideOutLeft {\n 0% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n 100% {\n transform: translateX(-120%) scale(0.9);\n opacity: 0;\n }\n }\n .rblyn-proactive-enter-right {\n animation: slideInFromRight 1.2s cubic-bezier(0.5, 0.8, 0.3, 1.1) forwards;\n }\n .rblyn-proactive-enter-left {\n animation: slideInFromLeft 1.2s cubic-bezier(0.5, 0.8, 0.3, 1.1) forwards;\n }\n .rblyn-proactive-exit-right {\n animation: slideOutRight 0.4s ease-in forwards;\n }\n .rblyn-proactive-exit-left {\n animation: slideOutLeft 0.4s ease-in forwards;\n }\n .rblyn-proactive-close-enter-right {\n animation: slideInFromRight 1.2s cubic-bezier(0.5, 0.8, 0.3, 1.1) forwards;\n }\n .rblyn-proactive-close-enter-left {\n animation: slideInFromLeft 1.2s cubic-bezier(0.5, 0.8, 0.3, 1.1) forwards;\n }\n /* Reset styles for proactive message content to prevent website CSS interference */\n /* Only target children of the content wrapper, not the bubble container itself */\n .rblyn-proactive-message-content * {\n box-sizing: border-box !important;\n margin: 0 !important;\n padding: 0 !important;\n border: none !important;\n background: transparent;\n font-family: ".concat(x,' !important;\n font-size: inherit !important;\n font-weight: inherit !important;\n line-height: inherit !important;\n color: inherit;\n text-align: inherit;\n list-style: none;\n }\n .rblyn-proactive-message-content p,\n .rblyn-proactive-message-content div,\n .rblyn-proactive-message-content span {\n display: inline !important;\n margin: 0 !important;\n padding: 0 !important;\n }\n .rblyn-proactive-message-content p:first-child,\n .rblyn-proactive-message-content div:first-child,\n .rblyn-proactive-message-content span:first-child {\n margin-top: 0 !important;\n }\n .rblyn-proactive-message-content p:last-child,\n .rblyn-proactive-message-content div:last-child,\n .rblyn-proactive-message-content span:last-child {\n margin-bottom: 0 !important;\n }\n .rblyn-proactive-message-content a {\n color: inherit !important;\n text-decoration: underline !important;\n cursor: pointer !important;\n }\n .rblyn-proactive-message-content a:hover {\n opacity: 0.8 !important;\n }\n .rblyn-proactive-message-content b,\n .rblyn-proactive-message-content strong {\n font-weight: 600 !important;\n }\n .rblyn-proactive-message-content i,\n .rblyn-proactive-message-content em {\n font-style: italic !important;\n }\n .rblyn-proactive-message-content u {\n text-decoration: underline !important;\n }\n .rblyn-proactive-message-content br {\n display: block !important;\n content: "" !important;\n margin-top: 0.5em !important;\n }\n '),document.head.appendChild(t)}},t.prototype.renderProactiveIfNeeded=function(t){var i,n,o,r,l,d,c,h,v,p,m,g,b,w=this,y=null===(n=null===(i=this.config)||void 0===i?void 0:i.config)||void 0===n?void 0:n.proactive_message_obj;if(!Array.isArray(y)||this.config.isIframeVisible||C())if(this.proactiveElement&&this.proactiveElement.parentElement){var I=this.proactiveElement.children[0],T="Right"===(this.config.position||(null===(o=this.config.config.interface_properties)||void 0===o?void 0:o.position)||"Right");Array.from(I.children).forEach((function(t){t.className=T?"rblyn-proactive-exit-right":"rblyn-proactive-exit-left"})),setTimeout((function(){w.proactiveElement&&w.proactiveElement.parentElement&&w.proactiveElement.parentElement.removeChild(w.proactiveElement),w.proactiveElement=null,w.clearProactiveDelays()}),400)}else this.proactiveElement=null,this.clearProactiveDelays();else{if(this.injectAnimationStyles(),!this.proactiveElement){var E=document.createElement("div");E.style.position="fixed";var A=null!==(d=null!==(r=this.config.bottomSpacing)&&void 0!==r?r:null===(l=this.config.config.interface_properties)||void 0===l?void 0:l.bottom_spacing)&&void 0!==d?d:20,R=null!==(v=null!==(c=this.config.sideSpacing)&&void 0!==c?c:null===(h=this.config.config.interface_properties)||void 0===h?void 0:h.side_spacing)&&void 0!==v?v:20,O=this.config.position||(null===(p=this.config.config.interface_properties)||void 0===p?void 0:p.position)||"Right",M=null!==(m=this.config.launcher_size)&&void 0!==m?m:48;E.style.bottom="".concat(A+(this.config.config.launcher_type===e.IMAGE?M:40)+8,"px"),"Right"===O?E.style.right="".concat(R,"px"):E.style.left="".concat(R,"px"),E.style.maxWidth="22.875rem",E.style.zIndex="2147483646";var N=document.createElement("div");N.style.display="flex",N.style.flexDirection="column",N.style.alignItems="Right"===O?"flex-end":"flex-start";var j=document.createElement("div");j.style.position="absolute",j.style.top="-32px",j.style.width="24px",j.style.height="24px",j.style.borderRadius="50%",j.style.background="#fff",j.style.boxShadow="0 2.667px 2.667px 0 rgba(0, 0, 0, 0.25)",j.style.display="flex",j.style.alignItems="center",j.style.justifyContent="center",j.style.cursor="pointer",j.style.opacity="0",j.style.visibility="hidden","Right"===(this.config.position||(null===(g=this.config.config.interface_properties)||void 0===g?void 0:g.position)||"Right")?(j.style.right="0px",j.style.left="auto",j.style.transform="translateX(120%) scale(0.95)"):(j.style.left="0px",j.style.right="auto",j.style.transform="translateX(-120%) scale(0.95)"),j.onclick=function(t){t.stopPropagation(),w.hideProactiveMessages()},j.innerHTML='\n <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14" fill="none">\n <path d="M10.3334 10.3334L7.00009 7.00009M7.00009 7.00009L3.66675 3.66675M7.00009 7.00009L10.3334 3.66675M7.00009 7.00009L3.66675 10.3334" stroke="#444547" stroke-width="0.816326" stroke-linecap="round" stroke-linejoin="round"/>\n </svg>\n ',E.appendChild(N),E.appendChild(j),document.body.appendChild(E),this.proactiveElement=E}var L=this.proactiveElement.children[0];L.innerHTML="";var U="Right"===(this.config.position||(null===(b=this.config.config.interface_properties)||void 0===b?void 0:b.position)||"Right");L.style.display="flex",L.style.flexDirection="column",L.style.alignItems=U?"flex-end":"flex-start",this.clearProactiveDelays();var P=function(t){if(!t||C())return[];var i=S(),n=new Date,e=[];return t.forEach((function(t){e.push.apply(e,function(t,i,n){var e=(null==t?void 0:t.send_time_type)||"",o=e?F[e]:z;if(!o||!o(t,n))return[];for(var r=(null==t?void 0:t.content_multiple)||[],l=Math.max(0,1e3*+((null==t?void 0:t.delay)||0)),u=[],d=0;d<r.length;d++){for(var c=r[d],f=(null==c?void 0:c.message_display_attributes)||[],h=null,v=a.OR,p=0,m=f;p<m.length;p++){var g=m[p];if(null==g?void 0:g.logical_condition)v=g.logical_condition;else{var b=g,w=k(null==b||b.type,(null==b?void 0:b.value)||"",null==b?void 0:b.condition,i);h=null===h?w:v===a.AND?h&&w:h||w}}(null===h||h)&&(null==c?void 0:c.message)&&u.push({messageId:(null==t?void 0:t.message_id)||d+"",contentIndex:d,html:c.message+"",delayMs:l,contentId:c.content_id||null,messageDisplayType:(null==c?void 0:c.message_display_type)||s.TEXT,messageBubbleBg:null==c?void 0:c.message_bubble_bg})}return u}(t,i,n))})),e}(y);f([],P,!0).sort((function(t,i){return t.delayMs!==i.delayMs?t.delayMs-i.delayMs:t.contentIndex-i.contentIndex}));var W=new Map;P.forEach((function(t){var i=W.get(t.delayMs);i||(i={messageIds:[],groups:new Map},W.set(t.delayMs,i)),i.groups.has(t.messageId)||(i.messageIds.push(t.messageId),i.groups.set(t.messageId,[])),i.groups.get(t.messageId).push(t)}));var B=void 0!==W.get(0),H=this.proactiveElement.children[1];if(H&&P.length>0){H.style.opacity="0",H.style.visibility="hidden",H.style.transform=U?"translateX(120%) scale(0.95)":"translateX(-120%) scale(0.95)";var Y=function(){if(H){H.style.visibility="visible";var t=L.children.length,i=t>0?10*(t-1):0;H.style.animationDelay="".concat(i,"ms"),H.className=U?"rblyn-proactive-close-enter-right":"rblyn-proactive-close-enter-left"}};if(B){var X=window.setTimeout(Y,0);this.delayTimers.push(X)}else{var J=Math.min.apply(Math,Array.from(W.keys()));X=window.setTimeout(Y,J),this.delayTimers.push(X)}}else H&&(H.style.opacity="0",H.style.visibility="hidden");var G=0;W.forEach((function(t,i){var n=t.messageIds,e=t.groups,o=window.setTimeout((function(){var t=L.children.length,o=0,r=[];n.forEach((function(t){var i=e.get(t)||[];f([],i,!0).sort((function(t,i){return t.contentIndex-i.contentIndex})).forEach((function(i){r.push({messageId:t,item:i})})),o+=i.length}));var a=i>0?f([],r,!0).reverse():r;a.forEach((function(n,e){var r,l=n.item,d=document.createElement("div"),c=l.messageDisplayType===s.BUTTON;d.style.background=(null==l?void 0:l.messageBubbleBg)||"#ffffff",d.style.color="#111",d.style.borderRadius=c?"100px":"12px",d.style.boxShadow="0 2px 2px 0 rgba(0, 0, 0, 0.08)",d.style.padding="16px",d.style.border="1px solid #F1F2F4",d.style.cursor="pointer",d.style.fontFamily=x,d.style.fontSize="14px",d.style.lineHeight=_+"",d.style.width="fit-content",d.style.maxWidth="100%";var f=0===e,h=e===a.length-1,v=t>0,p=W.has(0),m=!1;0===i?m=!h||f&&v:f&&(v||p)?m=!0:f||(m=!0),m&&(d.style.marginBottom="16px");var g=10*(t+o-1-(0===i?t+G:G));d.className=U?"rblyn-proactive-enter-right":"rblyn-proactive-enter-left",d.style.animationDelay="".concat(g,"ms"),d.style.opacity="0",d.style.transform=U?"translateX(120%) scale(0.95)":"translateX(-120%) scale(0.95)";var b=document.createElement("div");if(b.className="rblyn-proactive-message-content",b.setAttribute("dir",function(t){if(!t||"string"!=typeof t||0===t.trim().length)return"ltr";var i=t.replace(/<[^>]*>/g,"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_`#]/g,"").trim();if(0===i.length)return"ltr";for(var n=/[\u0590-\u05FF\u0600-\u06FF\u0700-\u074F\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]/,e=0,o=0,r=0,a=i;r<a.length;r++){var l=a[r];/\s|\d|[.,;:!?()[\]{}'"`\-_=+*/\\|@#$%^&*~]/.test(l)||(o++,n.test(l)&&e++)}return 0===o?"ltr":e/o>.3?"rtl":"ltr"}(l.html)),b.innerHTML=function(t){return t?Mt.sanitize(t,{ALLOWED_TAGS:["b","strong","i","em","u","br","span","a","p","s"],ALLOWED_ATTR:["href","target","rel","style"],ALLOW_ARIA_ATTR:!1,ALLOW_DATA_ATTR:!1,RETURN_TRUSTED_TYPE:!1}):""}(l.html),d.appendChild(b),d.onclick=function(){var t;t={message_id:l.messageId,content_string:l.html||null,content_id:l.contentId||null},D=u({input_id:null},t),w.config.toggleIframe(),w.hideProactiveMessages();try{window.dispatchEvent(new CustomEvent("rblyn:proactiveClick",{detail:{message_id:l.messageId,content_string:l.html||null,content_id:l.contentId||null}}))}catch(t){}},0===i)L.appendChild(d);else{L.insertBefore(d,L.firstChild);var y=null===(r=w.proactiveElement)||void 0===r?void 0:r.children[1];if(y&&"visible"===y.style.visibility){var I=L.children.length,T=I>0?10*(I-1):0;y.style.animationDelay="".concat(T,"ms")}}G++}))}),i);w.delayTimers.push(o)}))}},t}(),jt=function(){var t;return(null===(t=navigator.userAgentData)||void 0===t?void 0:t.platform)||(/Windows|Mac|Linux|Android|iOS/.exec(navigator.userAgent)||["Unknown"])[0]},Lt=function(){var t;if(null===(t=navigator.userAgentData)||void 0===t?void 0:t.brands)for(var i=["Chrome","Firefox","Safari","Edge","Opera"],n=0,e=navigator.userAgentData.brands;n<e.length;n++){var o=e[n];if(i.includes(o.brand))return o.brand}return(/Chrome|Firefox|Safari|Edge|Opera/.exec(navigator.userAgent)||["Unknown"])[0]},Ut=function(){var t,i,n,e;return{width:(null===window||void 0===window?void 0:window.innerWidth)||(null===(t=null===document||void 0===document?void 0:document.documentElement)||void 0===t?void 0:t.clientWidth)||(null===(i=null===document||void 0===document?void 0:document.body)||void 0===i?void 0:i.clientWidth),height:(null===window||void 0===window?void 0:window.innerHeight)||(null===(n=null===document||void 0===document?void 0:document.documentElement)||void 0===n?void 0:n.clientHeight)||(null===(e=null===document||void 0===document?void 0:document.body)||void 0===e?void 0:e.clientHeight)}},Pt=function(){return{platform:"web",os:jt(),browser:Lt(),sdk_version:"1.1.52-staging.10",device:(t=navigator.userAgent.toLowerCase(),/(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i.test(t)?"tablet":/Mobile|Android|iP(hone|od)|IEMobile|BlackBerry|Kindle|Silk-Accelerated|(hpw|web)OS|Opera M(obi|ini)/.test(t)?"mobile":"desktop"),screen_size:Ut()};var t};!function(t){t.ERROR="ERROR",t.INFO="INFO"}(Ft||(Ft={}));var Wt,Bt=["@robylon/web-react-sdk","node_modules/@robylon/web-react-sdk/"],Ht=function(t){var i=t.filename,n=t.stack,e=t.message;return!!(i||n||e)&&Bt.some((function(t){return(null==i?void 0:i.includes(t))||(null==n?void 0:n.includes(t))||(null==e?void 0:e.includes(t))}))},Yt=function(){function t(){var t=this;this.apiKey="",this.userId=null,this.preInitQueue=[],this.isInitialized=!1,this.handleWindowError=function(i){var n,e={filename:i.filename,stack:null===(n=i.error)||void 0===n?void 0:n.stack,message:i.message};Ht(e)&&t.trackError(i.error||i.message,"GlobalErrorHandler",{filename:i.filename,lineNo:i.lineno,colNo:i.colno})},this.handleUnhandledRejection=function(i){var n,e,o={stack:null===(n=i.reason)||void 0===n?void 0:n.stack,message:(null===(e=i.reason)||void 0===e?void 0:e.message)||i.reason+""};Ht(o)&&t.trackError(i.reason||"Unhandled Promise Rejection","GlobalPromiseHandler",{reason:i.reason})},this.setupGlobalHandlers()}return t.prototype.setupGlobalHandlers=function(){b()&&(null===window||void 0===window||window.addEventListener("error",null==this?void 0:this.handleWindowError),null===window||void 0===window||window.addEventListener("unhandledrejection",this.handleUnhandledRejection))},t.prototype.cleanup=function(){b()&&(null===window||void 0===window||window.removeEventListener("error",null==this?void 0:this.handleWindowError),null===window||void 0===window||window.removeEventListener("unhandledrejection",this.handleUnhandledRejection))},t.getInstance=function(){return t.instance||(t.instance=new t),t.instance},t.prototype.initialize=function(t,i){void 0===i&&(i=null);try{if(this.preInitQueue.length>0){var n={org_id:"UNINITALIZED",event_data:{message:"SDK Initialization Failed: Required parameter 'api_key' is ".concat(void 0===t?"undefined":null===t?"null":""===t?"empty string":"invalid: ".concat(t)),componentName:"ErrorTrackingService",additionalInfo:{preInitError:!0,apiKey:t,userId:i,timestamp:Date.now()},timestamp:Date.now()},metadata:Pt(),event_type:Ft.ERROR,user_id:i};this.sendLog(n).catch(console.error)}this.apiKey=t,this.userId=i,this.isInitialized=!0,this.processPreInitQueue()}catch(n){v.error("Error during ErrorTrackingService initialization:",n),this.preInitQueue.push({error:n instanceof Error?n:Error(n+""),componentName:"ErrorTrackingService",additionalInfo:{apiKey:t,userId:i}})}},t.prototype.processPreInitQueue=function(){return d(this,void 0,void 0,(function(){var t,i,n;return c(this,(function(e){switch(e.label){case 0:if(!this.preInitQueue.length)return[2];v.info("Processing ".concat(this.preInitQueue.length," pre-initialization errors")),t=0,i=this.preInitQueue,e.label=1;case 1:return t<i.length?(n=i[t],[4,this.trackError(n.error,n.componentName,u(u({},n.additionalInfo),{preInitError:!0}))]):[3,4];case 2:e.sent(),e.label=3;case 3:return t++,[3,1];case 4:return this.preInitQueue=[],[2]}}))}))},t.prototype.sendLog=function(t){return d(this,void 0,void 0,(function(){var i,n,e,o,r,a;return c(this,(function(l){switch(l.label){case 0:return l.trys.push([0,4,,5]),i=w().apiUrl,[4,fetch("".concat(i,"/users/sdk/record-logs/"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})];case 1:return(n=l.sent()).ok?[3,3]:(o=(e=v).error,r=["Failed to send error log:"],[4,n.text()]);case 2:o.apply(e,r.concat([l.sent()])),l.label=3;case 3:return[3,5];case 4:return a=l.sent(),v.error("Error sending log:",a),[3,5];case 5:return[2]}}))}))},t.prototype.trackError=function(t,i,n){return d(this,void 0,void 0,(function(){var e,o,r;return c(this,(function(a){switch(a.label){case 0:if(this.isInitialized)return[3,5];e={org_id:"UNINITALIZED",event_data:{message:t instanceof Error?t.message:t,stack:t instanceof Error?t.stack:void 0,componentName:i,additionalInfo:u(u({},n),{preInitError:!0,timestamp:Date.now()}),timestamp:Date.now()},metadata:Pt(),event_type:Ft.ERROR,user_id:this.userId},a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.sendLog(e)];case 2:return a.sent(),[3,4];case 3:return a.sent(),this.preInitQueue.push({error:t,componentName:i,additionalInfo:n}),v.warn("Error tracked before initialization, queuing:",t),[3,4];case 4:return[2];case 5:return o={message:t instanceof Error?t.message:t,stack:t instanceof Error?t.stack:void 0,componentName:i,additionalInfo:u(u({},n),{timestamp:Date.now()}),timestamp:Date.now()},r={org_id:this.apiKey||"UNINITALIZED",event_data:o,metadata:Pt(),event_type:Ft.ERROR,user_id:this.userId},[4,this.sendLog(r)];case 6:return a.sent(),[2]}}))}))},t.prototype.trackInfo=function(t,i,n){return d(this,void 0,void 0,(function(){var e,o;return c(this,(function(r){switch(r.label){case 0:return this.apiKey?(e={message:t,componentName:i,additionalInfo:n,timestamp:Date.now()},o={org_id:this.apiKey,event_data:e,metadata:Pt(),event_type:Ft.INFO,user_id:this.userId},[4,this.sendLog(o)]):(v.error("Error tracking not initialized"),[2]);case 1:return r.sent(),[2]}}))}))},t}(),Xt=Yt.getInstance(),Jt="MISSING_API_KEY",Gt="SDK_INIT_FAILED",Kt="ERROR_TRACKING_INIT_FAILED",Zt="API_REQUEST_FAILED",Vt="NETWORK_ERROR",qt="INVALID_RESPONSE",Qt="IFRAME_LOAD_FAILED",$t="INITIALIZATION_ERROR",ti=((Wt={})[Jt]=function(t){return"SDK Initialization Failed: Required parameter 'api_key' is ".concat(void 0===t?"undefined":null===t?"null":""===t?"empty string":"invalid: ".concat(t),". A valid API key string is required to initialize the SDK.")},Wt.INVALID_API_KEY=function(t){return"SDK Initialization Failed: Provided API key '".concat(t,"' is invalid. API key must be a non-empty string in UUID format.")},Wt.CONFIG_FETCH_FAILED=function(t){return"Failed to fetch chatbot configuration: ".concat(t.statusCode?"Server responded with status ".concat(t.statusCode):"Could not reach server").concat(t.error?". Error: ".concat(t.error):"")},Wt[Zt]=function(t,i,n){return"API Request Failed: Server responded with status ".concat(t," for ").concat(n?"endpoint ".concat(n):"request"," - ").concat(i)},Wt[Vt]=function(t){return"Network Error: Failed to communicate with server".concat(t.url?" at ".concat(t.url):"").concat(t.error?" - ".concat(t.error):"")},Wt[Qt]=function(t){return"Failed to load chatbot interface".concat(t.src?" from ".concat(t.src):"").concat(t.error?". Error: ".concat(t.error):"")},Wt[qt]=function(t){return"Invalid API Response: Missing required fields in response data: ".concat(t.join(", "))},Wt[Kt]=function(t){return"Error Tracking Service initialization failed".concat(t.apiKey?" for API key ".concat(t.apiKey):"").concat(t.error?". Error: ".concat(t.error):"")},Wt[Gt]=function(t){return"SDK Initialization Failed: ".concat(t.reason||"Could not initialize the chatbot SDK").concat(t.config?". Attempted initialization with config: ".concat(JSON.stringify(t.config,null,2)):"")},Wt.COOKIE_ACCESS_ERROR=function(t,i){return"Cookie Access Error: Failed to ".concat(t).concat(i?" cookie '".concat(i,"'"):" cookies",". This may affect user session persistence.")},Wt.COMPONENT_RENDER_ERROR=function(t){return"React Component Error: ".concat(t.component||"Unknown component"," failed to render. Error: ").concat(t.error).concat(t.stack?"\nComponent Stack: ".concat(t.stack):"")},Wt),ii=function(){var t,i=navigator.userAgent;if(null===(t=navigator.userAgentData)||void 0===t?void 0:t.brands){var n=navigator.userAgentData.brands.find((function(t){return"Google Chrome"===t.brand}));if(null==n?void 0:n.version)return n.version}var e=i.match(/(Chrome|Firefox|Safari|Edge|Opera)\/(\d+\.\d+)/);return e?e[2]:"Unknown"},ni=function(){var t,i,n=Pt();return{current_page_url:(null===(t=null===window||void 0===window?void 0:window.location)||void 0===t?void 0:t.href)||"",browser_language:(null===navigator||void 0===navigator?void 0:navigator.language)||(null===(i=null===navigator||void 0===navigator?void 0:navigator.languages)||void 0===i?void 0:i[0])||"en",browser_version:ii(),os:null==n?void 0:n.os,referral_url:(null===document||void 0===document?void 0:document.referrer)||"",system_info:n}},ei=function(){function t(t){var i=this;this.isInitialized=!1,this.hasRegistered=!1,this.isAppReady=!1,this.shouldWaitForAppReady=!1,this.hasPendingOpenRequest=!1,this.overridesPayloadCache=null,this.proactiveDataSentInRegistration=!1,this.handleMessage=function(t){var n,e,o,r,a,l,s,u,d,c,f=w().copilotUrl;if(t.origin===f){var h=JSON.parse(t.data);if("APP_READY"===(null==h?void 0:h.type))return i.isAppReady=!0,void i.sendOpenAndRegisterIfReady();if("CHATBOT_CLOSED"===(null==h?void 0:h.type))return void(null===(n=null==i?void 0:i.config)||void 0===n||n.onClose());if("CHATBOT_TOKEN_EXHAUSTED"===(null==h?void 0:h.type))return void i.config.onInternalEvent(g.CHATBOT_TOKEN_EXHAUSTED);"CHATBOT_LOADED"===(null==h?void 0:h.type)&&(null===(o=(e=i.config).onEvent)||void 0===o||o.call(e,{type:m.CHATBOT_LOADED,timestamp:Date.now()}),i.config.onInternalEvent(m.CHATBOT_LOADED)),"CHAT_INITIALIZED"===(null==h?void 0:h.type)&&(null===(a=(r=i.config).onEvent)||void 0===a||a.call(r,{type:m.CHAT_INITIALIZED,timestamp:Date.now()}),i.config.onInternalEvent(m.CHAT_INITIALIZED)),"CHAT_INITIALIZATION_FAILED"===(null==h?void 0:h.type)&&(null===(s=(l=i.config).onEvent)||void 0===s||s.call(l,{type:m.CHAT_INITIALIZATION_FAILED,timestamp:Date.now()}),i.config.onInternalEvent(m.CHAT_INITIALIZATION_FAILED,{error:null===(u=t.data)||void 0===u?void 0:u.error})),"SESSION_REFRESHED"===(null==h?void 0:h.type)&&(null===(c=(d=i.config).onEvent)||void 0===c||c.call(d,{type:m.SESSION_REFRESHED,timestamp:Date.now()}),i.config.onInternalEvent(m.SESSION_REFRESHED)),"CHAT_MOVED"===(null==h?void 0:h.type)&&i.config.onInternalEvent(g.CHAT_MOVED,{from:t.data.from,to:t.data.to,trigger:t.data.trigger})}},this.config=t,this.iframeElement=document.createElement("iframe"),this.iframeElement.id="chat-iframe-rbyln",this.resizeHandler=this.applyResponsiveStyles.bind(this),this.render(),this.initialize(),this.setupEventListeners()}return t.prototype.getElement=function(){return this.iframeElement},t.prototype.render=function(){var t,i=this.config.position||(null===(t=this.config.config.interface_properties)||void 0===t?void 0:t.position)||"Right";Object.assign(this.iframeElement.style,{zIndex:"20000000",border:"none",boxShadow:"0px 0px 40px 0px rgba(14, 14, 15, 0.24)",transformOrigin:"bottom ".concat(i.toLowerCase()),transition:"transform 0.2s cubic-bezier(0.2, 1.27, 0.29, 0.97), opacity 0.15s ease-out",transform:"scale(0.3) translate3d(0,40px,0)",opacity:"0",display:"none"}),this.applyResponsiveStyles()},t.prototype.applyResponsiveStyles=function(){var t,i,n,e,o,r;if(this.iframeElement){var a=this.config.position||(null===(n=this.config.config.interface_properties)||void 0===n?void 0:n.position)||"Right",l=null!==(r=null!==(e=this.config.bottomSpacing)&&void 0!==e?e:null===(o=this.config.config.interface_properties)||void 0===o?void 0:o.bottom_spacing)&&void 0!==r?r:20;560>window.innerWidth?Object.assign(this.iframeElement.style,((t={width:"100vw",minWidth:"300px"})[a.toLowerCase()]="0",t.bottom="0",t.height="100vh",t.flexDirection="column",t.flexGrow="1",t.borderRadius="0",t.top="0",t.maxHeight="100%",t.position="fixed",t)):Object.assign(this.iframeElement.style,((i={width:"26%",minWidth:"400px",height:"calc(100vh - 2rem - 10vh - ".concat(l,"px)"),borderRadius:"1rem",top:"calc(10vh - 32px)",maxHeight:"50rem",position:""})[a.toLowerCase()]=void 0,i))}},t.prototype.initialize=function(){var t=this;if(!this.isInitialized){var i=w().copilotUrl;this.iframeElement.src="".concat(i,"/chatbot-plugin?id=").concat(this.config.config.chatbotId),this.isInitialized=!0,this.iframeElement.addEventListener("load",(function(){var n,e,o,r,a,l,s,u,d,c,f,h,v,p,g,b,w,y,x,_,I=new URL(t.iframeElement.src).origin||i;null===(n=t.iframeElement.contentWindow)||void 0===n||n.postMessage({domain:null===(e=null===window||void 0===window?void 0:window.location)||void 0===e?void 0:e.hostname,name:"checkDomain"},I);var T={header_avatar:null!==(r=null===(o=t.config.overrides)||void 0===o?void 0:o.header_avatar)&&void 0!==r?r:null,agent_avatar:null!==(l=null===(a=t.config.overrides)||void 0===a?void 0:a.agent_avatar)&&void 0!==l?l:null,header_title:null!==(u=null===(s=t.config.overrides)||void 0===s?void 0:s.header_title)&&void 0!==u?u:null,header_subtitle:null!==(c=null===(d=t.config.overrides)||void 0===d?void 0:d.header_subtitle)&&void 0!==c?c:null,header_title_text_color:null!==(h=null===(f=t.config.overrides)||void 0===f?void 0:f.header_title_text_color)&&void 0!==h?h:null,header_subtitle_text_color:null!==(p=null===(v=t.config.overrides)||void 0===v?void 0:v.header_subtitle_text_color)&&void 0!==p?p:null,header_bg:null!==(b=null===(g=t.config.overrides)||void 0===g?void 0:g.header_bg)&&void 0!==b?b:null};null===(w=t.iframeElement.contentWindow)||void 0===w||w.postMessage({domain:null===(y=null===window||void 0===window?void 0:window.location)||void 0===y?void 0:y.hostname,action:"updateOverrides",data:T},I),null===(_=(x=t.config).onEvent)||void 0===_||_.call(x,{type:m.CHATBOT_READY,timestamp:Date.now()}),t.config.onInternalEvent(m.CHATBOT_LOADED)}))}},t.prototype.setupEventListeners=function(){var t=this;window.addEventListener("resize",this.resizeHandler),this.iframeElement.addEventListener("error",(function(){Xt.trackError(Error(ti[Qt]({src:t.iframeElement.src,error:"Failed to load iframe"})),"ChatbotIframe",{errorCode:Qt,errorType:"RUNTIME_ERROR",context:{config:t.config.config,iframeUrl:t.iframeElement.src,timestamp:Date.now()}})})),window.addEventListener("message",this.handleMessage),window.addEventListener("rblyn:proactiveClick",(function(i){var n,e,o,r,a,l;if(t.hasRegistered)if(t.proactiveDataSentInRegistration)t.proactiveDataSentInRegistration=!1;else{var s=(null==i?void 0:i.detail)||{},u=w().copilotUrl,d=new URL(t.iframeElement.src).origin||u;null===(n=t.iframeElement.contentWindow)||void 0===n||n.postMessage({domain:null===(e=null===window||void 0===window?void 0:window.location)||void 0===e?void 0:e.hostname,action:"proactiveClick",data:{userId:null===(o=t.config.config)||void 0===o?void 0:o.userId,token:null===(r=t.config.config)||void 0===r?void 0:r.token,userProfile:null===(a=t.config.config)||void 0===a?void 0:a.userProfile,isAnonymous:null===(l=t.config.config)||void 0===l?void 0:l.isAnonymous,proactiveData:{input_id:null,message_id:(null==s?void 0:s.message_id)||null,content_string:(null==s?void 0:s.content_string)||null}}},d)}}))},t.prototype.updateVisibility=function(t,i){var n;this.shouldWaitForAppReady=!!i,this.config.isVisible=t;var e=this.config.position||(null===(n=this.config.config.interface_properties)||void 0===n?void 0:n.position)||"Right";t?this.showIframe(e):this.hideIframe(e),t?(this.hasPendingOpenRequest=!0,this.shouldWaitForAppReady,this.sendOpenAndRegisterIfReady()):this.hasPendingOpenRequest=!1},t.prototype.showIframe=function(t){this.iframeElement.style.display="block",this.iframeElement.getBoundingClientRect(),this.iframeElement.style.opacity="1",this.iframeElement.style.transform="scale(1) translate3d(0,0,0)"},t.prototype.hideIframe=function(t){var i=this;this.iframeElement.style.opacity="0",this.iframeElement.style.transform="scale(0.3) translate3d(".concat((t.toLowerCase(),"0"),",40px,0)"),setTimeout((function(){i.config.isVisible||(i.iframeElement.style.display="none")}),200)},t.prototype.sendOpenAndRegisterIfReady=function(){var t,i,n,e,o,r,a,l,s,d;if(this.iframeElement.contentWindow&&this.config.isVisible&&(!this.shouldWaitForAppReady||this.isAppReady)&&this.hasPendingOpenRequest){var c,f=w().copilotUrl,h=new URL(this.iframeElement.src).origin||f;if(this.iframeElement.contentWindow.postMessage({domain:null===(t=null===window||void 0===window?void 0:window.location)||void 0===t?void 0:t.hostname,name:"openFrame"},h),!this.hasRegistered){var v=(c=D,D=null,c);this.proactiveDataSentInRegistration=!!v,this.iframeElement.contentWindow.postMessage({domain:null===(i=null===window||void 0===window?void 0:window.location)||void 0===i?void 0:i.hostname,action:"registerUserId",data:u({userId:null===(n=this.config.config)||void 0===n?void 0:n.userId,token:null===(e=this.config.config)||void 0===e?void 0:e.token,userProfile:u(u({},null===(o=this.config.config)||void 0===o?void 0:o.userProfile),{__INT_SYS_INFO__:u(u({},(null===(a=null===(r=this.config.config)||void 0===r?void 0:r.userProfile)||void 0===a?void 0:a.__INT_SYS_INFO__)||{}),ni())}),isAnonymous:null===(l=this.config.config)||void 0===l?void 0:l.isAnonymous},v?{proactiveData:v}:{})},h),this.hasRegistered=!0}null===(d=(s=this.config).onEvent)||void 0===d||d.call(s,{type:m.CHATBOT_OPENED,timestamp:Date.now()}),this.config.onInternalEvent(m.CHATBOT_OPENED),this.hasPendingOpenRequest=!1}},t.prototype.update=function(t,i){var n=this.config.isVisible;if(this.config=u(u({},this.config),t),n!==this.config.isVisible&&this.updateVisibility(this.config.isVisible,i),this.iframeElement.contentWindow&&this.config.isVisible){var e=w().copilotUrl;this.iframeElement.contentWindow.postMessage({action:"updateUserProfile",user_profile:this.config.config.userProfile},e)}},t.prototype.destroy=function(){window.removeEventListener("resize",this.resizeHandler),window.removeEventListener("message",this.handleMessage),this.iframeElement&&this.iframeElement.parentNode&&this.iframeElement.parentNode.removeChild(this.iframeElement)},t}(),oi=function(){function t(t,i,n,e){this.resizeObserver=null,this.containerElement=document.createElement("div"),this.handleResizeFunction=this.handleResize.bind(this),this.config={config:t,position:i,sideSpacing:n,bottomSpacing:e},this.render(),this.mount(),this.setupResizeListener()}return t.prototype.render=function(){this.applyStyles(),this.containerElement.className="robylon-chatbot-container"},t.prototype.applyStyles=function(){var t,i,n,e,o,r,a,l,s,d=560>(null===window||void 0===window?void 0:window.innerWidth),c=this.config.position||(null===(n=this.config.config.interface_properties)||void 0===n?void 0:n.position)||"Right",f=null!==(r=null!==(e=this.config.sideSpacing)&&void 0!==e?e:null===(o=this.config.config.interface_properties)||void 0===o?void 0:o.side_spacing)&&void 0!==r?r:20,h=null!==(s=null!==(a=this.config.bottomSpacing)&&void 0!==a?a:null===(l=this.config.config.interface_properties)||void 0===l?void 0:l.bottom_spacing)&&void 0!==s?s:20;this.containerElement.style.position="",this.containerElement.style.top="",this.containerElement.style.bottom="",this.containerElement.style.right="",this.containerElement.style.left="",this.containerElement.style.alignItems="";var v={position:"fixed",zIndex:"1000",display:"flex",flexDirection:"column"},p=u(u({},v),((t={bottom:"".concat(h,"px")})[c.toLowerCase()]="".concat(f,"px"),t.alignItems="Right"===c?"flex-end":"flex-start",t)),m=u(u({},v),((i={top:"0"})[c.toLowerCase()]="".concat(f,"px"),i.alignItems="center",i));Object.assign(this.containerElement.style,d?m:p)},t.prototype.handleResize=function(){this.applyStyles()},t.prototype.setupResizeListener=function(){"undefined"!=typeof ResizeObserver?(this.resizeObserver=new ResizeObserver(this.handleResizeFunction),this.resizeObserver.observe(document.body)):window.addEventListener("resize",this.handleResizeFunction)},t.prototype.mount=function(){document.body.appendChild(this.containerElement)},t.prototype.getElement=function(){return this.containerElement},t.prototype.destroy=function(){this.resizeObserver?(this.resizeObserver.disconnect(),this.resizeObserver=null):window.removeEventListener("resize",this.handleResizeFunction),this.containerElement&&this.containerElement.parentNode&&this.containerElement.parentNode.removeChild(this.containerElement)},t}(),ri=function(t){var i=t?"USER_DATA=%7B%22attributes%22%3A%5B%7B%22key%22%3A%22USER_ATTRIBUTE_USER_EMAIL%22%2C%22value%22%3A%22dinesh.goel%40robylon.ai%22%7D%2C%7B%22key%22%3A%22USER_ATTRIBUTE_UNIQUE_ID%22%2C%22value%22%3A%2266011f2c28d1787d13c6c796%22%7D%5D%2C%22subscribedToOldSdk%22%3Afalse%2C%22deviceUuid%22%3A%2226c02feb-2664-451d-8469-9cf1378547c6%22%2C%22deviceAdded%22%3Atrue%7D; _ga_3YS9P6ZDWX=GS1.1.1715252584.3.1.1715258696.39.0.0; _ga_V4J24F7YF9=GS1.1.1715273274.2.0.1715273274.0.0.0; city_name=Bengaluru; lang_code=en-in; cookieConcent=A; _gcl_au=1.1.343275043.1717154298; _clck=43guwd%7C2%7Cfmi%7C0%7C1561; _gid=GA1.2.1423066649.1718210058; moe_uuid=26c02feb-2664-451d-8469-9cf1378547c6; _ga_6RM65PWEZY=GS1.1.1718210058.18.1.1718211647.60.0.0; _ga=GA1.1.689213983.1712737672; AMP_MKTG_fe4beb374f=JTdCJTIycmVmZXJyZXIlMjIlM0ElMjJodHRwcyUzQSUyRiUyRmFjY291bnRzLnRlYWNobWludC5jb20lMkYlMjIlMkMlMjJyZWZlcnJpbmdfZG9tYWluJTIyJTNBJTIyYWNjb3VudHMudGVhY2htaW50LmNvbSUyMiU3RA==; AMP_fe4beb374f=JTdCJTIyZGV2aWNlSWQlMjIlM0ElMjI0MWMxMTljZC03YzVjLTRiYTctYTUzZS1mYTgzMjRlYjc0OWUlMjIlMkMlMjJ1c2VySWQlMjIlM0ElMjIxZjI2ODAwOC01OGYxLTQwYTItYjQ0Ni1mYmQ5N2E0NDQyYTAlMjIlMkMlMjJzZXNzaW9uSWQlMjIlM0ExNzE4MjEzMzEwOTc3JTJDJTIyb3B0T3V0JTIyJTNBZmFsc2UlMkMlMjJsYXN0RXZlbnRUaW1lJTIyJTNBMTcxODIxMzMxMDk4MSUyQyUyMmxhc3RFdmVudElkJTIyJTNBMTQlN0Q=; _ga_3YS9P6ZDWX=GS1.1.1718211637.26.1.1718213441.60.0.0; SESSION=%7B%22sessionKey%22%3A%22e4d76f52-9053-4277-99a4-f1ba667fd5f2%22%2C%22sessionStartTime%22%3A%222024-06-12T16%3A34%3A19.047Z%22%2C%22sessionMaxTime%22%3A1800%2C%22customIdentifiersToTrack%22%3A%5B%5D%2C%22sessionExpiryTime%22%3A1718215247464%2C%22numberOfSessions%22%3A17%7D":document.cookie;return i=i.split(";").map((function(t){var i=t.split("="),n=i[0],e=i.slice(1).join("=").trim();return{name:n=n.trim(),value:e?decodeURIComponent(e):""}})),i},ai=function(t,i,n){return d(void 0,void 0,void 0,(function(){var e,o,r,a,l,s,u,d;return c(this,(function(c){switch(c.label){case 0:return c.trys.push([0,5,,6]),e=w().apiUrl,v.log("endpointUrl",o="".concat(e,"/chat/chatbot/get/")),r={client_user_id:i||null,org_id:t,token:n||void 0,extra_info:{},launcher_info:ni()},[4,fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})];case 1:return(a=c.sent()).ok?[3,3]:[4,a.text()];case 2:throw l=c.sent(),Error(ti[Zt](a.status,l));case 3:return[4,a.json()];case 4:if(s=c.sent(),!(null===(d=null==s?void 0:s.user)||void 0===d?void 0:d.org_info))throw Error(ti[qt](["user","org_info"]));return[2,s];case 5:throw u=c.sent(),Xt.trackError(u instanceof Error?u:Error(ti[Vt]({error:u+""})),"fetchChatbotConfig",{errorCode:u instanceof Error&&u.message.includes("API Request Failed")?Zt:Vt,errorType:"API_ERROR",context:{apiKey:t,userId:i,timestamp:Date.now()}}),u;case 6:return[2]}}))}))},li=function(t){return d(void 0,void 0,void 0,(function(){var o,r,a,l,s,d,f,h,p,m,g,b,w,y,x,_,I,T,E,S,A,R,k,O,D,C,z,F,M,N,j,L,U,P;return c(this,(function(c){switch(c.label){case 0:return o=function(t){return{api_key:(t.api_key||"")+"",user_id:t.user_id?t.user_id+"":null,user_token:t.user_token?t.user_token+"":void 0,user_profile:t.user_profile||{}}}(t),r=o.user_id||void 0,a=!1,r||(r=function(){var t,i="; ".concat(document.cookie).split("; rblyn_anon=");if(2===i.length)return null===(t=i.pop())||void 0===t?void 0:t.split(";").shift()}()||"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var i=16*Math.random()|0;return("x"===t?i:3&i|8).toString(16)})),B=r,(H=new Date).setTime(H.getTime()+31536e6),document.cookie="".concat("rblyn_anon","=").concat(B,";expires=").concat(H.toUTCString(),";path=/"),a=!0),[4,ai(o.api_key,r,o.user_token)];case 1:l=c.sent();try{o.api_key}catch(t){v.warn("Failed to inject mock proactive messages",t)}return s=Pt(),d=ni(),W=o.user_profile,f=W?Object.fromEntries(Object.entries(W).map((function(t){var i=t[0],n=t[1];return"boolean"==typeof n||"number"==typeof n?[i,n]:[i,n+""]}))):{},h=u(u(u({},s),{__INT_SYS_INFO__:u(u({},s),d)}),f),[2,{chatbotId:o.api_key,userId:r,token:o.user_token,isAnonymous:a,domain:"",show_launcher:null===(m=null===(p=l.user.org_info)||void 0===p?void 0:p.show_launcher)||void 0===m||m,brand_colour:(null===(b=null===(g=l.user.org_info.brand_config)||void 0===g?void 0:g.colors)||void 0===b?void 0:b.brand_color)||"",image_url:(null===(y=null===(w=l.user.org_info)||void 0===w?void 0:w.brand_config)||void 0===y?void 0:y.launcher_logo_url)||"",userProfile:h,chat_interface_config:{chat_bubble_prompts:[],display_name:(null===(x=l.user.org_info.brand_config)||void 0===x?void 0:x.display_name)||"",welcome_message:(null===(_=l.user.org_info.brand_config)||void 0===_?void 0:_.welcome_message)||"Hey! What can we help you with today?",redirect_url:(null===(I=l.user.org_info.brand_config)||void 0===I?void 0:I.redirect_url)||""},launcher_type:(null===(T=l.user.org_info.brand_config)||void 0===T?void 0:T.launcher_type)||e.IMAGE,launcher_properties:{text:(null===(S=null===(E=l.user.org_info.brand_config)||void 0===E?void 0:E.launcher_properties)||void 0===S?void 0:S.text)||""},images:{launcher_image_url:{url:(null===(k=null===(R=null===(A=l.user.org_info.brand_config)||void 0===A?void 0:A.images)||void 0===R?void 0:R.launcher_image_url)||void 0===k?void 0:k.url)||""}},proactive_message_obj:si(null===(C=null===(D=null===(O=null==l?void 0:l.user)||void 0===O?void 0:O.org_info)||void 0===D?void 0:D.brand_config)||void 0===C?void 0:C.proactive_message_obj),interface_properties:{position:(null===(F=null===(z=l.user.org_info.brand_config)||void 0===z?void 0:z.interface_properties)||void 0===F?void 0:F.position)||n.RIGHT,side_spacing:(null===(N=null===(M=l.user.org_info.brand_config)||void 0===M?void 0:M.interface_properties)||void 0===N?void 0:N.side_spacing)||20,bottom_spacing:(null===(L=null===(j=l.user.org_info.brand_config)||void 0===j?void 0:j.interface_properties)||void 0===L?void 0:L.bottom_spacing)||20},interface_type:(null===(U=l.user.org_info.brand_config)||void 0===U?void 0:U.interface_type)||i.WIDGET,launcher_delay:(null===(P=l.user.org_info.brand_config)||void 0===P?void 0:P.launcher_delay)||{enabled:!1,delay:0}}]}var W,B,H}))}))},si=function(t){if(t){var i=(Array.isArray(t)?t:[t]).filter(Boolean).map((function(t){var i,n,e={message_id:(null!==(i=null==t?void 0:t.message_id)&&void 0!==i?i:"")+"",org_id:(null!==(n=null==t?void 0:t.org_id)&&void 0!==n?n:"")+"",name:null==t?void 0:t.name,content:null==t?void 0:t.content,send_time_type:null==t?void 0:t.send_time_type,created_by_name:null==t?void 0:t.created_by_name,updated_by_name:null==t?void 0:t.updated_by_name,updated_at:null==t?void 0:t.updated_at,created_at:null==t?void 0:t.created_at,delay:"number"==typeof(null==t?void 0:t.delay)?t.delay:void 0,content_multiple:Array.isArray(null==t?void 0:t.content_multiple)?t.content_multiple:(null==t?void 0:t.content)?[{message:t.content+"",message_display_attributes:[]}]:[]};return(null==t?void 0:t.content)&&!(null==t?void 0:t.content_multiple)&&v.warn("[Robylon SDK] proactive_message.content is deprecated; use content_multiple[].message instead."),e}));return i.length?i:void 0}},ui=function(){function t(t){this.logoContainer=null,this.iframe=null,this.bubblePromptContainer=null,this.chatBtnImage=null,this.config=t,this.validateDomain()&&this.init(),null===window||void 0===window||window.addEventListener("message",this.onCloseListener.bind(this),!1)}return t.prototype.onCloseListener=function(t){t.origin===this.config.domain&&"closeChatbot"===t.data&&this.closeIframe()},t.prototype.validateDomain=function(){var t,i=this.config.domain,n=null===(t=null===window||void 0===window?void 0:window.location)||void 0===t?void 0:t.origin;return v.log("expectedDomain, to current domain",i,n,i===n),i===n},t.prototype.createChatBubblContainer=function(){var t,i=this,n=document.createElement("div");n.id="chatbase-message-bubbles",Object.assign(n.style,{position:"fixed",bottom:"80px",borderRadius:"10px",fontFamily:"sans-serif",fontSize:"16px",zIndex:"2147483644",cursor:"pointer",flexDirection:"column",gap:"50px",maxWidth:"70vw",display:"block",right:"1rem",left:"unset"});var e=document.createElement("div");e.classList.add("close-btn"),e.textContent="✕",Object.assign(e.style,{position:"absolute",top:"-7px",right:"-7px",fontWeight:"bold",display:"none",justifyContent:"center",alignItems:"center",zIndex:"2147483643",width:"22px",height:"22px",borderRadius:"50%",textAlign:"center",fontSize:"12px",cursor:"pointer",backgroundColor:"rgb(224, 224, 224)",color:"black",boxShadow:"rgba(150, 150, 150, 0.15) 0px 6px 24px 0px, rgba(150, 150, 150, 0.15) 0px 0px 0px 1px"}),((null===(t=this.config.chat_interface_config)||void 0===t?void 0:t.chat_bubble_prompts)||[]).forEach((function(t){var e=i.createMessageBubble(t);n.appendChild(e)})),n.appendChild(e),document.body.appendChild(n)},t.prototype.createMessageBubble=function(t){var i=document.createElement("div");this.bubblePromptContainer=i,Object.assign(i.style,{display:"flex",position:"relative",justifyContent:"flex-end"});var n=document.createElement("div");n.classList.add("message"),n.textContent=t,Object.assign(n.style,{backgroundColor:"white",color:"black",boxShadow:"rgba(150, 150, 150, 0.2) 0px 10px 30px 0px, rgba(150, 150, 150, 0.2) 0px 0px 0px 1px",borderRadius:"10px",padding:"8px 5px",margin:"8px",fontSize:"14px",opacity:"1",transform:"scale(1)",transition:"opacity 0.5s ease 0s, transform 0.5s ease 0s"});var e=document.createElement("button");return e.innerHTML="&times;",Object.assign(e.style,{position:"absolute",top:"1px",left:"-3px",width:"20px",height:"20px",borderRadius:"50%",backgroundColor:"#fff",color:"#000",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 2px 5px rgba(0,0,0,0.2)",fontSize:"14px",lineHeight:"1",padding:"0",zIndex:"100"}),e.addEventListener("click",(function(){i.remove()})),i.appendChild(e),i.appendChild(n),i},t.prototype.createFloatingButton=function(){var t=document.createElement("div");t.classList.add("message-bubble-container"),Object.assign(t.style,{position:"fixed",bottom:"1.5rem",right:"1.5rem",zIndex:"1000",width:"48px",height:"48px",display:"flex",flexDirection:"column-reverse",backgroundColor:this.config.brand_colour,color:h(this.config.brand_colour),borderRadius:"50%",alignItems:"center",justifyContent:"center",cursor:"pointer",overflow:"hidden"}),document.body.appendChild(t),this.logoContainer=t,this.loadImage(this.logoContainer),this.createChatBubblContainer(),this.logoContainer.addEventListener("click",this.toggleIframe.bind(this))},t.prototype.loadImage=function(t){var i,n,e=document.createElement("img");e.src=this.config.launcher_type?(null===(n=null===(i=this.config.images)||void 0===i?void 0:i.launcher_image_url)||void 0===n?void 0:n.url)||"".concat(this.config.domain,"/chatbubble.png"):this.config.image_url||"".concat(this.config.domain,"/chatbubble.png"),e.alt="Chat",Object.assign(e.style,{zIndex:"1000",cursor:"pointer",borderRadius:"50%",objectFit:"cover"}),this.chatBtnImage=e,t.innerHTML="",t.appendChild(e)},t.prototype.createIframe=function(){var t=this;v.log("RobylonConfig?.domain====>",this.config.domain);var i=document.createElement("iframe");Object.assign(i.style,{position:"fixed",right:"32px",bottom:"86px",minWidth:"400px",width:"26%",maxWidth:"800px",top:"calc(10vh - 32px)",maxHeight:"45rem",height:"calc(100vh - 3rem - 10vh)",zIndex:"20000000",border:"none",boxShadow:"0px 0px 40px 0px rgba(14, 14, 15, 0.24)",transformOrigin:"bottom right",transition:"transform 0.3s ease-out",borderRadius:"1rem",display:"none"}),i.src="".concat(this.config.domain,"/chatbot-plugin?id=").concat(this.config.chatbotId),v.log("iframe.src====>",i.src),document.body.appendChild(i),this.iframe=i;var n=function(){560>(null===window||void 0===window?void 0:window.innerWidth)?Object.assign(i.style,{width:"100vw",minWidth:"300px",right:"0",bottom:"0",height:"100vh",flexDirection:"column",flexGrow:"1",borderRadius:"0",top:"0",maxHeight:"100%"}):Object.assign(i.style,{width:"26%",minWidth:"400px",right:"32px",bottom:"86px",height:"calc(100vh - 3rem - 10vh)",borderRadius:"1rem",top:"calc(10vh - 32px)",maxHeight:"45rem"})};n(),null===window||void 0===window||window.addEventListener("resize",n),i.addEventListener("load",(function(){var n,e,o,r,a;if(t.iframe){var l=new URL(t.iframe.src).origin||t.config.domain;null===(n=i.contentWindow)||void 0===n||n.postMessage({domain:null===(e=null===window||void 0===window?void 0:window.location)||void 0===e?void 0:e.hostname,name:"checkDomain"},l),null===(o=i.contentWindow)||void 0===o||o.postMessage({domain:null===(r=null===window||void 0===window?void 0:window.location)||void 0===r?void 0:r.hostname,action:"registerUserId",data:{userId:t.config.userId,token:t.config.token,userProfile:u(u({},t.config.userProfile||{}),{__INT_SYS_INFO__:u(u({},(null===(a=t.config.userProfile)||void 0===a?void 0:a.__INT_SYS_INFO__)||{}),ni())})}},l)}})),null===window||void 0===window||window.addEventListener("message",(function(n){var e,o;if(n.origin===t.config.domain){if("captureSessionData"===n.data){var r="66b33d16-5b38-4693-8772-1a1bd7dd412d"===t.config.chatbotId,a={cookies:ri(r),localStorage:JSON.stringify(localStorage),sessionStorage:JSON.stringify(sessionStorage),action:"capturedSessionData",domain_name:null===(e=null===window||void 0===window?void 0:window.location)||void 0===e?void 0:e.hostname};null===(o=i.contentWindow)||void 0===o||o.postMessage(a,t.config.domain||"*")}"expand"===n.data&&(t.adjustIframeWidth(),i.style.height="calc(100vh - 120px)",i.style.bottom="86px"),"collapse"===n.data&&Object.assign(i.style,{width:"26%",height:"calc(100vh - 32px - 10vh)",bottom:"86px",top:"calc(32px + 10vh)"})}}))},t.prototype.adjustIframeWidth=function(){if(this.iframe){var t=null===window||void 0===window?void 0:window.innerWidth;v.log("screenWidth",t),this.iframe.style.width=832>t?"".concat(t-64,"px"):"800px"}},t.prototype.loadSvgInline=function(t){var i=document.createElement("div");i.innerHTML='\n<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <g id="Chevron_Down">\n <path id="Vector" d="M19 9L12 16L5 9" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>\n </g>\n</svg>\n';var n=i.querySelector("svg");t.innerHTML="",n&&t.appendChild(n)},t.prototype.toggleIcon=function(t,i){"block"===i.style.display?this.loadSvgInline(t):this.loadImage(t)},t.prototype.toggleIframe=function(){var t;if(v.log("toggleIframe",this.iframe,this.logoContainer,this.chatBtnImage),this.iframe&&this.logoContainer&&this.chatBtnImage){var i=new URL(this.iframe.src).origin||this.config.domain;v.log("toggleIframe"),null===(t=this.iframe.contentWindow)||void 0===t||t.postMessage({domain:null===window||void 0===window?void 0:window.location.hostname,name:"none"===this.iframe.style.display?"openFrame":"closeFrame"},i),this.iframe.style.display="none"===this.iframe.style.display?"block":"none",this.toggleIcon(this.logoContainer,this.iframe),this.chatBtnImage.style.objectFit="block"===this.iframe.style.display?"none":"cover",this.bubblePromptContainer&&(this.bubblePromptContainer.style.display="none"),v.log("this.bubblePromptContainer",this.bubblePromptContainer)}},t.prototype.closeIframe=function(){this.iframe&&this.logoContainer&&this.chatBtnImage&&(this.iframe.style.display="none",this.toggleIcon(this.logoContainer,this.iframe),this.chatBtnImage.style.objectFit="cover")},t.prototype.init=function(){this.createIframe(),this.createFloatingButton()},t}(),di=function(t){var i={isInitialized:!1,isInitializing:!1,error:null,chatbotConfig:null,isIframeVisible:!1},n=[],e=function(t){i=u(u({},i),t),n.forEach((function(t){return t(i)}))};return{getState:function(){return i},initialize:function(){return d(void 0,void 0,void 0,(function(){var i,n,o;return c(this,(function(r){switch(r.label){case 0:if(!t.api_key)return Xt.trackError(Error(ti[Jt](t.api_key)),"ChatbotStateManager",{errorCode:Jt,errorType:$t,context:{timestamp:Date.now()}}),[2];e({isInitializing:!0}),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,li(t)];case 2:return i=r.sent(),[4,new Promise((function(t,n){!function(n,o,r){if(n.chatbotId&&n.userId)try{new ui(n),e({isInitialized:!0,chatbotConfig:i}),t(),v.log("Robylon SDK initialized successfully.")}catch(t){r(t instanceof Error?t.message:"Failed to initialize SDK")}else r("Incomplete configuration for SDK initialization.")}(i,0,(function(t){n(t)}))}))];case 3:return r.sent(),[3,6];case 4:return n=r.sent(),o=n instanceof Error?n.message:"Failed to initialize chatbot",e({error:o}),Xt.trackError(n instanceof Error?n:Error(o),"ChatbotStateManager",{errorCode:Gt,errorType:$t,context:{timestamp:Date.now()}}),[3,6];case 5:return e({isInitializing:!1}),[7];case 6:return[2]}}))}))},toggleIframeVisibility:function(){e({isIframeVisible:!i.isIframeVisible})},closeIframe:function(){e({isIframeVisible:!1})},updateState:e,subscribe:function(t){return n.push(t),function(){var i=n.indexOf(t);i>-1&&n.splice(i,1)}},unsubscribe:function(t){var i=n.indexOf(t);i>-1&&n.splice(i,1)}}},ci=function(t){t.api_key,t.user_profile;var i=t.onEvent;return t.chatbotConfig,{emit:function(t,n){var e={type:t,timestamp:Date.now(),data:n};null==i||i(e)},onInternalEvent:function(t,i){}}},fi=function(){function t(t){var i=this;this.container=null,this.floatingButton=null,this.launcherDelayTimeout=null,this.iframe=null,this.isDestroyed=!1,this.handleStateChange=function(t){var n,e,o,r,a,l;if(!i.isDestroyed){var s=t.isInitialized,u=t.error,d=t.chatbotConfig,c=t.isIframeVisible;if(!u&&d&&s){if(i.eventEmitter=ci({api_key:i.config.api_key,user_profile:i.config.user_profile,onEvent:i.config.onEvent,chatbotConfig:{isAnonymous:d.isAnonymous,userId:d.userId}}),i.container||(i.container=new oi(d,i.config.position,i.config.sideSpacing,i.config.bottomSpacing)),i.iframe)i.iframe.update({config:d,isVisible:c,position:i.config.position,bottomSpacing:i.config.bottomSpacing,overrides:i.config.overrides},!0);else if(i.iframe=new ei({config:d,isVisible:c,onClose:i.handleClose,onEvent:i.config.onEvent,onInternalEvent:i.eventEmitter.onInternalEvent,position:i.config.position,bottomSpacing:i.config.bottomSpacing,overrides:i.config.overrides}),i.iframe.getElement&&"function"==typeof i.iframe.getElement){var f=i.iframe.getElement();f&&i.container&&i.container.getElement().prepend(f)}var h=void 0!==i.config.show_launcher?!!i.config.show_launcher:null===(n=null==d?void 0:d.show_launcher)||void 0===n||n,v=!0===(null===(e=null==d?void 0:d.launcher_delay)||void 0===e?void 0:e.enabled),p=null!==(l=null!==(r=null===(o=null==d?void 0:d.launcher_delay)||void 0===o?void 0:o.seconds)&&void 0!==r?r:null===(a=null==d?void 0:d.launcher_delay)||void 0===a?void 0:a.delay)&&void 0!==l?l:0,m=function(){if(i.floatingButton)i.floatingButton.update({config:d,isIframeVisible:c,position:i.config.position,sideSpacing:i.config.sideSpacing,bottomSpacing:i.config.bottomSpacing,launcher_size:i.config.launcher_size});else if(i.floatingButton=new Nt({config:d,toggleIframe:i.toggleIframe,isIframeVisible:c,onEvent:i.config.onEvent,onInternalEvent:i.eventEmitter.onInternalEvent,position:i.config.position,sideSpacing:i.config.sideSpacing,bottomSpacing:i.config.bottomSpacing,launcher_size:i.config.launcher_size}),i.floatingButton.getElement&&"function"==typeof i.floatingButton.getElement){var t=i.floatingButton.getElement();t&&i.container&&i.container.getElement().appendChild(t)}};i.launcherDelayTimeout&&(clearTimeout(i.launcherDelayTimeout),i.launcherDelayTimeout=null),h?v&&+p>0&&!i.floatingButton?i.launcherDelayTimeout=window.setTimeout((function(){m(),i.launcherDelayTimeout=null}),1e3*+p):m():i.floatingButton&&(i.floatingButton.destroy(),i.floatingButton=null)}}},this.toggleIframe=function(){var t=i.stateManager.getState();i.stateManager.toggleIframeVisibility(),i.eventEmitter.emit(t.isIframeVisible?m.CHATBOT_CLOSED:m.CHATBOT_BUTTON_CLICKED)},this.handleClose=function(){i.stateManager.closeIframe(),i.eventEmitter.emit(m.CHATBOT_CLOSED)};var n=u(u({},t),{position:"string"==typeof t.position?"left"===t.position.toLowerCase()?"Left":"right"===t.position.toLowerCase()?"Right":void 0:void 0,sideSpacing:"string"==typeof t.sideSpacing?""===t.sideSpacing||isNaN(+t.sideSpacing)?void 0:+t.sideSpacing:t.sideSpacing,bottomSpacing:"string"==typeof t.bottomSpacing?""===t.bottomSpacing||isNaN(+t.bottomSpacing)?void 0:+t.bottomSpacing:t.bottomSpacing,show_launcher:t.show_launcher,overrides:t.overrides,launcher_size:t.launcher_size});if(this.config=n,!t.api_key)throw Xt.trackError(Error(ti[Jt](t.api_key)),"RobylonChatbot",{errorCode:Jt,errorType:$t,context:{timestamp:Date.now()}}),Error("API key is required");try{Xt.initialize(t.api_key,t.user_id)}catch(t){Xt.trackError(t instanceof Error?t:Error(t+""),"RobylonChatbot",{errorCode:Kt,errorType:$t,context:{timestamp:Date.now()}})}this.stateManager=di({api_key:t.api_key,user_id:t.user_id,user_token:t.user_token,user_profile:t.user_profile}),this.eventEmitter=ci({api_key:t.api_key,user_profile:t.user_profile,onEvent:t.onEvent,chatbotConfig:null}),this.initialize()}return t.prototype.initialize=function(){return d(this,void 0,void 0,(function(){var t;return c(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.stateManager.initialize()];case 1:return i.sent(),this.stateManager.subscribe(this.handleStateChange),this.handleStateChange(this.stateManager.getState()),[3,3];case 2:return t=i.sent(),Xt.trackError(t instanceof Error?t:Error(t+""),"RobylonChatbot.initialize",{errorCode:Gt,errorType:$t,context:{timestamp:Date.now()}}),[3,3];case 3:return[2]}}))}))},t.prototype.show=function(){this.stateManager.getState().isIframeVisible||(this.stateManager.toggleIframeVisibility(),this.eventEmitter.emit(m.CHATBOT_BUTTON_CLICKED))},t.prototype.hide=function(){this.stateManager.getState().isIframeVisible&&(this.stateManager.closeIframe(),this.eventEmitter.emit(m.CHATBOT_CLOSED))},t.prototype.toggle=function(){this.toggleIframe()},t.prototype.destroy=function(){this.isDestroyed=!0,this.floatingButton&&(this.floatingButton.destroy(),this.floatingButton=null),this.launcherDelayTimeout&&(clearTimeout(this.launcherDelayTimeout),this.launcherDelayTimeout=null),this.iframe&&(this.iframe.destroy(),this.iframe=null),this.container&&(this.container.destroy(),this.container=null),this.stateManager.unsubscribe(this.handleStateChange)},t.prototype.getState=function(){return this.stateManager.getState().isInitialized?"initialized":"uninitialized"},t}();function hi(t){return new fi(t)}if("undefined"!=typeof window){!function(){if("undefined"!=typeof window){var t=window,i=(null==t?void 0:t.RobylonChatbot)||(null==t?void 0:t.R);if(i&&Array.isArray(i.q)){var n=null;i.q.forEach((function(t){var i=t[0];if("init"===i){var e=t[1]||{};n=hi(e)}else n&&"function"==typeof n[i]&&n[i]()})),t.RobylonChatbot=function(t){var i=[].slice.call(arguments,1);return"init"===t?n=hi(i[0]||{}):n&&"function"==typeof n[t]?n[t].apply(n,i):void 0},(null==t?void 0:t.R)||(t.R=t.RobylonChatbot),t.RobylonChatbot.getState=function(){return"initialized"},(null==t?void 0:t.R)&&(t.R.getState=t.RobylonChatbot.getState)}}}();var vi=window,pi=null==vi?void 0:vi.RobylonChatbot;pi&&!(null==vi?void 0:vi.R)&&(vi.R=pi)}var mi={create:hi,getState:function(){return"initialized"}};t.create=hi,t.default=mi,Object.defineProperty(t,"i",{value:!0})}));
2
2
  //# sourceMappingURL=robylon-chatbot.js.map