@robylon/whatsapp-react-sdk 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import e,{memo as t,useRef as n,useState as i,useEffect as o,Component as r,useMemo as a,useCallback as l,forwardRef as s,useImperativeHandle as c}from"react";var d=function(e,t){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},d(e,t)};var u,p,f,m,h,g,v,y,b=function(){return b=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},b.apply(this,arguments)};function _(e,t,n,i){return new(n||(n=Promise))(function(o,r){function a(e){try{s(i.next(e))}catch(e){r(e)}}function l(e){try{s(i.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,l)}s((i=i.apply(e,t||[])).next())})}function w(e,t){var n,i,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,i&&(o=2&l[0]?i.return:l[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,l[1])).done)return o;switch(i=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++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(!(o=r.trys,(o=o.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=t.call(e,r)}catch(e){l=[6,e],i=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 E(e,t,n){if(n||2===arguments.length)for(var i,o=0,r=t.length;o<r;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError,function(e){e.WIDGET="WIDGET",e.POPOVER="POPOVER",e.EMBED="EMBED"}(u||(u={})),function(e){e.RIGHT="Right",e.LEFT="Left"}(p||(p={})),function(e){e.TEXT="TEXT",e.IMAGE="IMAGE",e.TEXTUAL_IMAGE="TEXTUAL_IMAGE"}(f||(f={})),function(e){e.WORKING_HOURS="WORKING_HOURS",e.ALWAYS="ALWAYS"}(m||(m={})),function(e){e.URL="URL"}(h||(h={})),function(e){e.AND="AND",e.OR="OR"}(g||(g={})),function(e){e.IS="IS",e.IS_NOT="IS_NOT",e.CONTAINS="CONTAINS",e.DOES_NOT_CONTAIN="DOES_NOT_CONTAIN",e.STARTS_WITH="STARTS_WITH",e.ENDS_WITH="ENDS_WITH"}(v||(v={})),function(e){e.BUTTON="BUTTON",e.TEXT="TEXT"}(y||(y={}));var x,T,I=function(e,t){void 0===t&&(t=.5);var n=function(e){e=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(e,t,n,i){return t+t+n+n+i+i});var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:{r:0,g:0,b:0}}(e),i=function(e,t,n){var i=[e,t,n].map(function(e){return(e/=255)<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)});return.2126*i[0]+.7152*i[1]+.0722*i[2]}(n.r,n.g,n.b);return i>t?"#0E0E0F":"#FFFFFF"};!function(e){e.CHATBOT_BUTTON_LOADED="CHATBOT_BUTTON_LOADED",e.CHATBOT_BUTTON_CLICKED="CHATBOT_BUTTON_CLICKED",e.CHATBOT_OPENED="CHATBOT_OPENED",e.CHATBOT_CLOSED="CHATBOT_CLOSED",e.CHATBOT_APP_READY="CHATBOT_APP_READY",e.CHATBOT_LOADED="CHATBOT_LOADED",e.CHAT_INITIALIZED="CHAT_INITIALIZED",e.SESSION_REFRESHED="SESSION_REFRESHED",e.CHAT_INITIALIZATION_FAILED="CHAT_INITIALIZATION_FAILED",e.CHATBOT_READY="CHATBOT_READY"}(x||(x={})),function(e){e.CHAT_MOVED="CHAT_MOVED",e.CHATBOT_TOKEN_EXHAUSTED="CHATBOT_TOKEN_EXHAUSTED"}(T||(T={}));var C,S={log:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.log.apply(console,e)},error:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.error.apply(console,e)},warn:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.warn.apply(console,e)},info:function(){}},A="system-ui, Inter, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'",O='system-ui, Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif',k="21px",R="",N=[],D=!1,L=function(){return"undefined"==typeof window?"":window.location.href},z=function(){return L()},M=function(){var e=L();e!==R&&(R=e,N.forEach(function(t){return t(e)}))},F=function(e){return D||B(),N.push(e),e(L()),function(){var t=N.indexOf(e);t>-1&&N.splice(t,1)}},B=function(){if(!D&&"undefined"!=typeof window){D=!0,R=L();var e=function(e){var t=history[e];return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var i=t.apply(this,e);return setTimeout(M,0),i}};try{history.pushState=e("pushState"),history.replaceState=e("replaceState")}catch(e){}window.addEventListener("popstate",M),window.addEventListener("hashchange",M);var t=setInterval(function(){M()},1e3);setInterval(function(){0===N.length&&(clearInterval(t),window.removeEventListener("popstate",M),window.removeEventListener("hashchange",M),D=!1)},5e3)}},U=function(e,t,n,i){var o=t||"",r=L(),a=i||r,l=function(e,t){return-1!==t.indexOf(e)}(o,a);switch(n){case v.IS:return a===o;case v.IS_NOT:return a!==o;case v.CONTAINS:return l;case v.DOES_NOT_CONTAIN:return!l;case v.STARTS_WITH:return a.startsWith(o);case v.ENDS_WITH:return a.endsWith(o);default:return!1}},H=null,j=function(){H=z()},P=function(){return H===z()},W=function(e){b({input_id:null},e)},G=function(){return!0},X=((C={})[m.WORKING_HOURS]=function(e,t){var n=t.getHours(),i=t.getMinutes();return(n>10||10===n&&i>=0)&&(n<19||19===n&&0===i)},C[m.ALWAYS]=G,C),V=function(e){if(!e||P())return[];var t=L(),n=new Date,i=[];return e.forEach(function(e){i.push.apply(i,function(e,t,n){var i=(null==e?void 0:e.send_time_type)||"",o=i?X[i]:G;if(!o||!o(e,n))return[];for(var r=(null==e?void 0:e.content_multiple)||[],a=Math.max(0,1e3*Number((null==e?void 0:e.delay)||0)),l=[],s=0;s<r.length;s++){for(var c=r[s],d=(null==c?void 0:c.message_display_attributes)||[],u=null,p=g.OR,f=0,m=d;f<m.length;f++){var h=m[f];if(null==h?void 0:h.logical_condition)p=h.logical_condition;else{var v=h,b=U(null==v||v.type,(null==v?void 0:v.value)||"",null==v?void 0:v.condition,t);u=null===u?b:p===g.AND?u&&b:u||b}}(null===u||u)&&(null==c?void 0:c.message)&&l.push({messageId:(null==e?void 0:e.message_id)||String(s),contentIndex:s,html:String(c.message),delayMs:a,contentId:c.content_id||null,messageDisplayType:(null==c?void 0:c.message_display_type)||y.TEXT,messageBubbleBg:null==c?void 0:c.message_bubble_bg,urlToGo:null==c?void 0:c.url_to_go})}return l}(e,t,n))}),i};
2
2
  /*! @license DOMPurify 3.3.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.3/LICENSE */
3
- const{entries:Y,setPrototypeOf:K,isFrozen:J,getPrototypeOf:q,getOwnPropertyDescriptor:Z}=Object;let{freeze:Q,seal:$,create:ee}=Object,{apply:te,construct:ne}="undefined"!=typeof Reflect&&Reflect;Q||(Q=function(e){return e}),$||($=function(e){return e}),te||(te=function(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return e.apply(t,i)}),ne||(ne=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return new e(...n)});const ie=ye(Array.prototype.forEach),oe=ye(Array.prototype.lastIndexOf),re=ye(Array.prototype.pop),ae=ye(Array.prototype.push),le=ye(Array.prototype.splice),se=ye(String.prototype.toLowerCase),ce=ye(String.prototype.toString),de=ye(String.prototype.match),ue=ye(String.prototype.replace),pe=ye(String.prototype.indexOf),fe=ye(String.prototype.trim),me=ye(Object.prototype.hasOwnProperty),he=ye(RegExp.prototype.test),ge=(ve=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return ne(ve,t)});var ve;function ye(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return te(e,t,i)}}function be(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:se;K&&K(e,null);let i=t.length;for(;i--;){let o=t[i];if("string"==typeof o){const e=n(o);e!==o&&(J(t)||(t[i]=e),o=e)}e[o]=!0}return e}function _e(e){for(let t=0;t<e.length;t++){me(e,t)||(e[t]=null)}return e}function we(e){const t=ee(null);for(const[n,i]of Y(e)){me(e,n)&&(Array.isArray(i)?t[n]=_e(i):i&&"object"==typeof i&&i.constructor===Object?t[n]=we(i):t[n]=i)}return t}function Ee(e,t){for(;null!==e;){const n=Z(e,t);if(n){if(n.get)return ye(n.get);if("function"==typeof n.value)return ye(n.value)}e=q(e)}return function(){return null}}const xe=Q(["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"]),Te=Q(["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"]),Ie=Q(["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"]),Ce=Q(["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"]),Se=Q(["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"]),Ae=Q(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Oe=Q(["#text"]),ke=Q(["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"]),Re=Q(["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"]),Ne=Q(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),De=Q(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Le=$(/\{\{[\w\W]*|[\w\W]*\}\}/gm),ze=$(/<%[\w\W]*|[\w\W]*%>/gm),Me=$(/\$\{[\w\W]*/gm),Fe=$(/^data-[\-\w.\u00B7-\uFFFF]+$/),Be=$(/^aria-[\-\w]+$/),Ue=$(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),He=$(/^(?:\w+script|data):/i),je=$(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Pe=$(/^html$/i),We=$(/^[a-z][.\w]*(-[.\w]+)+$/i);var Ge=Object.freeze({__proto__:null,ARIA_ATTR:Be,ATTR_WHITESPACE:je,CUSTOM_ELEMENT:We,DATA_ATTR:Fe,DOCTYPE_NAME:Pe,ERB_EXPR:ze,IS_ALLOWED_URI:Ue,IS_SCRIPT_OR_DATA:He,MUSTACHE_EXPR:Le,TMPLIT_EXPR:Me});const Xe=1,Ve=3,Ye=7,Ke=8,Je=9,qe=function(){return"undefined"==typeof window?null:window};var Ze=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:qe();const n=t=>e(t);if(n.version="3.3.3",n.removed=[],!t||!t.document||t.document.nodeType!==Je||!t.Element)return n.isSupported=!1,n;let{document:i}=t;const o=i,r=o.currentScript,{DocumentFragment:a,HTMLTemplateElement:l,Node:s,Element:c,NodeFilter:d,NamedNodeMap:u=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:p,DOMParser:f,trustedTypes:m}=t,h=c.prototype,g=Ee(h,"cloneNode"),v=Ee(h,"remove"),y=Ee(h,"nextSibling"),b=Ee(h,"childNodes"),_=Ee(h,"parentNode");if("function"==typeof l){const e=i.createElement("template");e.content&&e.content.ownerDocument&&(i=e.content.ownerDocument)}let w,E="";const{implementation:x,createNodeIterator:T,createDocumentFragment:I,getElementsByTagName:C}=i,{importNode:S}=o;let A={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof Y&&"function"==typeof _&&x&&void 0!==x.createHTMLDocument;const{MUSTACHE_EXPR:O,ERB_EXPR:k,TMPLIT_EXPR:R,DATA_ATTR:N,ARIA_ATTR:D,IS_SCRIPT_OR_DATA:L,ATTR_WHITESPACE:z,CUSTOM_ELEMENT:M}=Ge;let{IS_ALLOWED_URI:F}=Ge,B=null;const U=be({},[...xe,...Te,...Ie,...Se,...Oe]);let H=null;const j=be({},[...ke,...Re,...Ne,...De]);let P=Object.seal(ee(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}})),W=null,G=null;const X=Object.seal(ee(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let V=!0,K=!0,J=!1,q=!0,Z=!1,$=!0,te=!1,ne=!1,ve=!1,ye=!1,_e=!1,Le=!1,ze=!0,Me=!1,Fe=!0,Be=!1,He={},je=null;const We=be({},["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 Ze=null;const Qe=be({},["audio","video","img","source","image","track"]);let $e=null;const et=be({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),tt="http://www.w3.org/1998/Math/MathML",nt="http://www.w3.org/2000/svg",it="http://www.w3.org/1999/xhtml";let ot=it,rt=!1,at=null;const lt=be({},[tt,nt,it],ce);let st=be({},["mi","mo","mn","ms","mtext"]),ct=be({},["annotation-xml"]);const dt=be({},["title","style","font","a","script"]);let ut=null;const pt=["application/xhtml+xml","text/html"];let ft=null,mt=null;const ht=i.createElement("form"),gt=function(e){return e instanceof RegExp||e instanceof Function},vt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!mt||mt!==e){if(e&&"object"==typeof e||(e={}),e=we(e),ut=-1===pt.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,ft="application/xhtml+xml"===ut?ce:se,B=me(e,"ALLOWED_TAGS")?be({},e.ALLOWED_TAGS,ft):U,H=me(e,"ALLOWED_ATTR")?be({},e.ALLOWED_ATTR,ft):j,at=me(e,"ALLOWED_NAMESPACES")?be({},e.ALLOWED_NAMESPACES,ce):lt,$e=me(e,"ADD_URI_SAFE_ATTR")?be(we(et),e.ADD_URI_SAFE_ATTR,ft):et,Ze=me(e,"ADD_DATA_URI_TAGS")?be(we(Qe),e.ADD_DATA_URI_TAGS,ft):Qe,je=me(e,"FORBID_CONTENTS")?be({},e.FORBID_CONTENTS,ft):We,W=me(e,"FORBID_TAGS")?be({},e.FORBID_TAGS,ft):we({}),G=me(e,"FORBID_ATTR")?be({},e.FORBID_ATTR,ft):we({}),He=!!me(e,"USE_PROFILES")&&e.USE_PROFILES,V=!1!==e.ALLOW_ARIA_ATTR,K=!1!==e.ALLOW_DATA_ATTR,J=e.ALLOW_UNKNOWN_PROTOCOLS||!1,q=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Z=e.SAFE_FOR_TEMPLATES||!1,$=!1!==e.SAFE_FOR_XML,te=e.WHOLE_DOCUMENT||!1,ye=e.RETURN_DOM||!1,_e=e.RETURN_DOM_FRAGMENT||!1,Le=e.RETURN_TRUSTED_TYPE||!1,ve=e.FORCE_BODY||!1,ze=!1!==e.SANITIZE_DOM,Me=e.SANITIZE_NAMED_PROPS||!1,Fe=!1!==e.KEEP_CONTENT,Be=e.IN_PLACE||!1,F=e.ALLOWED_URI_REGEXP||Ue,ot=e.NAMESPACE||it,st=e.MATHML_TEXT_INTEGRATION_POINTS||st,ct=e.HTML_INTEGRATION_POINTS||ct,P=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&gt(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(P.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&gt(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(P.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(P.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Z&&(K=!1),_e&&(ye=!0),He&&(B=be({},Oe),H=ee(null),!0===He.html&&(be(B,xe),be(H,ke)),!0===He.svg&&(be(B,Te),be(H,Re),be(H,De)),!0===He.svgFilters&&(be(B,Ie),be(H,Re),be(H,De)),!0===He.mathMl&&(be(B,Se),be(H,Ne),be(H,De))),me(e,"ADD_TAGS")||(X.tagCheck=null),me(e,"ADD_ATTR")||(X.attributeCheck=null),e.ADD_TAGS&&("function"==typeof e.ADD_TAGS?X.tagCheck=e.ADD_TAGS:(B===U&&(B=we(B)),be(B,e.ADD_TAGS,ft))),e.ADD_ATTR&&("function"==typeof e.ADD_ATTR?X.attributeCheck=e.ADD_ATTR:(H===j&&(H=we(H)),be(H,e.ADD_ATTR,ft))),e.ADD_URI_SAFE_ATTR&&be($e,e.ADD_URI_SAFE_ATTR,ft),e.FORBID_CONTENTS&&(je===We&&(je=we(je)),be(je,e.FORBID_CONTENTS,ft)),e.ADD_FORBID_CONTENTS&&(je===We&&(je=we(je)),be(je,e.ADD_FORBID_CONTENTS,ft)),Fe&&(B["#text"]=!0),te&&be(B,["html","head","body"]),B.table&&(be(B,["tbody"]),delete W.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw ge('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw ge('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');w=e.TRUSTED_TYPES_POLICY,E=w.createHTML("")}else void 0===w&&(w=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(n=t.getAttribute(i));const o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}}(m,r)),null!==w&&"string"==typeof E&&(E=w.createHTML(""));Q&&Q(e),mt=e}},yt=be({},[...Te,...Ie,...Ce]),bt=be({},[...Se,...Ae]),_t=function(e){ae(n.removed,{element:e});try{_(e).removeChild(e)}catch(t){v(e)}},wt=function(e,t){try{ae(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){ae(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(ye||_e)try{_t(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Et=function(e){let t=null,n=null;if(ve)e="<remove></remove>"+e;else{const t=de(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===ut&&ot===it&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const o=w?w.createHTML(e):e;if(ot===it)try{t=(new f).parseFromString(o,ut)}catch(e){}if(!t||!t.documentElement){t=x.createDocument(ot,"template",null);try{t.documentElement.innerHTML=rt?E:o}catch(e){}}const r=t.body||t.documentElement;return e&&n&&r.insertBefore(i.createTextNode(n),r.childNodes[0]||null),ot===it?C.call(t,te?"html":"body")[0]:te?t.documentElement:r},xt=function(e){return T.call(e.ownerDocument||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},Tt=function(e){return e instanceof p&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof u)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},It=function(e){return"function"==typeof s&&e instanceof s};function Ct(e,t,i){ie(e,e=>{e.call(n,t,i,mt)})}const St=function(e){let t=null;if(Ct(A.beforeSanitizeElements,e,null),Tt(e))return _t(e),!0;const i=ft(e.nodeName);if(Ct(A.uponSanitizeElement,e,{tagName:i,allowedTags:B}),$&&e.hasChildNodes()&&!It(e.firstElementChild)&&he(/<[/\w!]/g,e.innerHTML)&&he(/<[/\w!]/g,e.textContent))return _t(e),!0;if(e.nodeType===Ye)return _t(e),!0;if($&&e.nodeType===Ke&&he(/<[/\w]/g,e.data))return _t(e),!0;if(!(X.tagCheck instanceof Function&&X.tagCheck(i))&&(!B[i]||W[i])){if(!W[i]&&Ot(i)){if(P.tagNameCheck instanceof RegExp&&he(P.tagNameCheck,i))return!1;if(P.tagNameCheck instanceof Function&&P.tagNameCheck(i))return!1}if(Fe&&!je[i]){const t=_(e)||e.parentNode,n=b(e)||e.childNodes;if(n&&t){for(let i=n.length-1;i>=0;--i){const o=g(n[i],!0);o.__removalCount=(e.__removalCount||0)+1,t.insertBefore(o,y(e))}}}return _t(e),!0}return e instanceof c&&!function(e){let t=_(e);t&&t.tagName||(t={namespaceURI:ot,tagName:"template"});const n=se(e.tagName),i=se(t.tagName);return!!at[e.namespaceURI]&&(e.namespaceURI===nt?t.namespaceURI===it?"svg"===n:t.namespaceURI===tt?"svg"===n&&("annotation-xml"===i||st[i]):Boolean(yt[n]):e.namespaceURI===tt?t.namespaceURI===it?"math"===n:t.namespaceURI===nt?"math"===n&&ct[i]:Boolean(bt[n]):e.namespaceURI===it?!(t.namespaceURI===nt&&!ct[i])&&!(t.namespaceURI===tt&&!st[i])&&!bt[n]&&(dt[n]||!yt[n]):!("application/xhtml+xml"!==ut||!at[e.namespaceURI]))}(e)?(_t(e),!0):"noscript"!==i&&"noembed"!==i&&"noframes"!==i||!he(/<\/no(script|embed|frames)/i,e.innerHTML)?(Z&&e.nodeType===Ve&&(t=e.textContent,ie([O,k,R],e=>{t=ue(t,e," ")}),e.textContent!==t&&(ae(n.removed,{element:e.cloneNode()}),e.textContent=t)),Ct(A.afterSanitizeElements,e,null),!1):(_t(e),!0)},At=function(e,t,n){if(G[t])return!1;if(ze&&("id"===t||"name"===t)&&(n in i||n in ht))return!1;if(K&&!G[t]&&he(N,t));else if(V&&he(D,t));else if(X.attributeCheck instanceof Function&&X.attributeCheck(t,e));else if(!H[t]||G[t]){if(!(Ot(e)&&(P.tagNameCheck instanceof RegExp&&he(P.tagNameCheck,e)||P.tagNameCheck instanceof Function&&P.tagNameCheck(e))&&(P.attributeNameCheck instanceof RegExp&&he(P.attributeNameCheck,t)||P.attributeNameCheck instanceof Function&&P.attributeNameCheck(t,e))||"is"===t&&P.allowCustomizedBuiltInElements&&(P.tagNameCheck instanceof RegExp&&he(P.tagNameCheck,n)||P.tagNameCheck instanceof Function&&P.tagNameCheck(n))))return!1}else if($e[t]);else if(he(F,ue(n,z,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==pe(n,"data:")||!Ze[e]){if(J&&!he(L,ue(n,z,"")));else if(n)return!1}else;return!0},Ot=function(e){return"annotation-xml"!==e&&de(e,M)},kt=function(e){Ct(A.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||Tt(e))return;const i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:H,forceKeepAttr:void 0};let o=t.length;for(;o--;){const r=t[o],{name:a,namespaceURI:l,value:s}=r,c=ft(a),d=s;let u="value"===a?d:fe(d);if(i.attrName=c,i.attrValue=u,i.keepAttr=!0,i.forceKeepAttr=void 0,Ct(A.uponSanitizeAttribute,e,i),u=i.attrValue,!Me||"id"!==c&&"name"!==c||(wt(a,e),u="user-content-"+u),$&&he(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,u)){wt(a,e);continue}if("attributename"===c&&de(u,"href")){wt(a,e);continue}if(i.forceKeepAttr)continue;if(!i.keepAttr){wt(a,e);continue}if(!q&&he(/\/>/i,u)){wt(a,e);continue}Z&&ie([O,k,R],e=>{u=ue(u,e," ")});const p=ft(e.nodeName);if(At(p,c,u)){if(w&&"object"==typeof m&&"function"==typeof m.getAttributeType)if(l);else switch(m.getAttributeType(p,c)){case"TrustedHTML":u=w.createHTML(u);break;case"TrustedScriptURL":u=w.createScriptURL(u)}if(u!==d)try{l?e.setAttributeNS(l,a,u):e.setAttribute(a,u),Tt(e)?_t(e):re(n.removed)}catch(t){wt(a,e)}}else wt(a,e)}Ct(A.afterSanitizeAttributes,e,null)},Rt=function e(t){let n=null;const i=xt(t);for(Ct(A.beforeSanitizeShadowDOM,t,null);n=i.nextNode();)Ct(A.uponSanitizeShadowNode,n,null),St(n),kt(n),n.content instanceof a&&e(n.content);Ct(A.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=null,r=null,l=null,c=null;if(rt=!e,rt&&(e="\x3c!--\x3e"),"string"!=typeof e&&!It(e)){if("function"!=typeof e.toString)throw ge("toString is not a function");if("string"!=typeof(e=e.toString()))throw ge("dirty is not a string, aborting")}if(!n.isSupported)return e;if(ne||vt(t),n.removed=[],"string"==typeof e&&(Be=!1),Be){if(e.nodeName){const t=ft(e.nodeName);if(!B[t]||W[t])throw ge("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof s)i=Et("\x3c!----\x3e"),r=i.ownerDocument.importNode(e,!0),r.nodeType===Xe&&"BODY"===r.nodeName||"HTML"===r.nodeName?i=r:i.appendChild(r);else{if(!ye&&!Z&&!te&&-1===e.indexOf("<"))return w&&Le?w.createHTML(e):e;if(i=Et(e),!i)return ye?null:Le?E:""}i&&ve&&_t(i.firstChild);const d=xt(Be?e:i);for(;l=d.nextNode();)St(l),kt(l),l.content instanceof a&&Rt(l.content);if(Be)return e;if(ye){if(_e)for(c=I.call(i.ownerDocument);i.firstChild;)c.appendChild(i.firstChild);else c=i;return(H.shadowroot||H.shadowrootmode)&&(c=S.call(o,c,!0)),c}let u=te?i.outerHTML:i.innerHTML;return te&&B["!doctype"]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&he(Pe,i.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+i.ownerDocument.doctype.name+">\n"+u),Z&&ie([O,k,R],e=>{u=ue(u,e," ")}),w&&Le?w.createHTML(u):u},n.setConfig=function(){vt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),ne=!0},n.clearConfig=function(){mt=null,ne=!1},n.isValidAttribute=function(e,t,n){mt||vt({});const i=ft(e),o=ft(t);return At(i,o,n)},n.addHook=function(e,t){"function"==typeof t&&ae(A[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=oe(A[e],t);return-1===n?void 0:le(A[e],n,1)[0]}return re(A[e])},n.removeHooks=function(e){A[e]=[]},n.removeAllHooks=function(){A={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}(),Qe=function(e){return e?Ze.sanitize(e,{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}):""};function $e(e){if(!e||"string"!=typeof e||0===e.trim().length)return"ltr";var t=e.replace(/<[^>]*>/g,"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_`#]/g,"").trim();if(0===t.length)return"ltr";for(var n=/[\u0590-\u05FF\u0600-\u06FF\u0700-\u074F\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]/,i=0,o=0,r=0,a=t;r<a.length;r++){var l=a[r];/\s|\d|[.,;:!?()[\]{}'"`\-_=+*/\\|@#$%^&*~]/.test(l)||(o++,n.test(l)&&i++)}return 0===o?"ltr":i/o>.3?"rtl":"ltr"}var et="https://cdn.robylon.ai/logos/WhatsApp.svg",tt=t(function(t){var r,a,l,s,c,d,u,p,m,h,g,v,_,w,T,C,O,R,N=t.config,D=t.toggleIframe,L=t.isIframeVisible,z=t.onEvent,M=t.onInternalEvent,B=t.position,U=t.sideSpacing,H=t.bottomSpacing,G=t.launcher_type,X=t.launcher_properties_text,Y=t.shouldFadeIn,K=t.launcher_size,J=n(null),q=i(!1),Z=q[0],Q=q[1],$=i(!1),ee=$[0],te=$[1],ne=i([]),ie=ne[0],oe=ne[1],re=i(!1),ae=re[0],le=re[1],se=n([]),ce=n(),de=n(new Set),ue=null!==(l=null==N?void 0:N.launcher_size_multiplier)&&void 0!==l?l:1,pe=null!=K?K:48*ue,fe="".concat(Math.max(4,Math.round(4*ue)),"px");o(function(){var e=function(){var e=(null===window||void 0===window?void 0:window.innerWidth)<560;Q(e)};return e(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}},[]),o(function(){J.current&&requestAnimationFrame(function(){null==z||z({type:x.CHATBOT_BUTTON_LOADED,timestamp:Date.now()}),M(x.CHATBOT_BUTTON_LOADED)})},[z,M]),o(function(){if(J.current&&Y){J.current.style.opacity="0";var e=requestAnimationFrame(function(){J.current&&(J.current.style.opacity="1")});return function(){return cancelAnimationFrame(e)}}},[Y]);var me=B||(null===(s=N.interface_properties)||void 0===s?void 0:s.position)||"Right",he=null!==(d=null!=U?U:null===(c=N.interface_properties)||void 0===c?void 0:c.side_spacing)&&void 0!==d?d:20,ge=null!==(p=null!=H?H:null===(u=N.interface_properties)||void 0===u?void 0:u.bottom_spacing)&&void 0!==p?p:20,ve=G||(null==N?void 0:N.launcher_type)||f.IMAGE,ye=X||(null===(m=null==N?void 0:N.launcher_properties)||void 0===m?void 0:m.text),be={zIndex:1e3,display:"flex",flexDirection:"column-reverse",alignItems:"center",justifyContent:"center",cursor:"pointer",overflow:"hidden",marginTop:"16px",boxSizing:"border-box"};ve===f.IMAGE&&(be.width="".concat(pe,"px"),be.height="".concat(pe,"px"),be.borderRadius="50%",be.backgroundColor=N.brand_colour);var _e=b(b({},be),((r={position:void 0,bottom:"0",borderRadius:ve===f.IMAGE?"50%":"9999px"})[me.toLowerCase()]="0",r)),we=b(b({},be),((a={position:"fixed",bottom:"".concat(ge,"px"),borderRadius:ve===f.IMAGE?"50%":"9999px"})[me.toLowerCase()]="".concat(he,"px"),a)),Ee=Z?we:_e;o(function(){S.log("Screen width changed, isMobile:",Z,"Style:",Ee)},[Z,Ee]),S.log("config in floating button",N);o(function(){var e=function(){se.current.forEach(function(e){return clearTimeout(e)}),se.current=[]},t=function(){if(e(),oe([]),de.current.clear(),(null==N?void 0:N.proactive_message_obj)&&!P()){var t=V(null==N?void 0:N.proactive_message_obj);E([],t,!0).sort(function(e,t){return e.delayMs!==t.delayMs?e.delayMs-t.delayMs:e.contentIndex-t.contentIndex});var n=new Map;t.forEach(function(e){var t=n.get(e.delayMs);t||(t={messageIds:[],groups:new Map},n.set(e.delayMs,t)),t.groups.has(e.messageId)||(t.messageIds.push(e.messageId),t.groups.set(e.messageId,[])),t.groups.get(e.messageId).push(e)}),n.forEach(function(e,t){var n=e.messageIds,i=e.groups,o=window.setTimeout(function(){oe(function(e){var o=[];return n.forEach(function(t){(i.get(t)||[]).forEach(function(t){var n="".concat(t.messageId,"-").concat(t.contentIndex);if(!e.some(function(e){return e.id===t.messageId&&e.index===t.contentIndex})){var i={id:t.messageId,index:t.contentIndex,html:t.html,contentId:t.contentId,messageDisplayType:t.messageDisplayType,messageBubbleBg:null==t?void 0:t.messageBubbleBg,urlToGo:null==t?void 0:t.urlToGo};o.push(i),de.current.add(n),setTimeout(function(){de.current.delete(n)},1200)}})}),0===t?E(E([],e,!0),o,!0):E(E([],o,!0),e,!0)})},t);se.current.push(o)})}};return ce.current=F(function(){te(!1),t()}),t(),function(){var t;e(),null===(t=ce.current)||void 0===t||t.call(ce)}},[null==N?void 0:N.proactive_message_obj]);var xe=ie.length>0&&!L&&!ee,Te="Right"===(B||(null===(h=N.interface_properties)||void 0===h?void 0:h.position)||"Right"),Ie=function(){le(!0),setTimeout(function(){te(!0),j(),le(!1)},400)};return e.createElement(e.Fragment,null,e.createElement("style",null,"\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 .proactive-bubble-enter-right {\n animation: slideInFromRight 1.2s cubic-bezier(0.5, 0.8, 0.3, 1.1) forwards;\n }\n .proactive-bubble-enter-left {\n animation: slideInFromLeft 1.2s cubic-bezier(0.5, 0.8, 0.3, 1.1) forwards;\n }\n .proactive-bubble-exit-right {\n animation: slideOutRight 0.4s ease-in forwards;\n }\n .proactive-bubble-exit-left {\n animation: slideOutLeft 0.4s ease-in forwards;\n }\n .proactive-close-enter-right {\n animation: slideInFromRight 1.2s cubic-bezier(0.5, 0.8, 0.3, 1.1) forwards;\n }\n .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 .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(A,';\n // font-size: inherit;\n // font-weight: inherit;\n line-height: inherit;\n color: inherit;\n text-align: inherit;\n // text-decoration: none ;\n list-style: none !important;\n }\n .proactive-message-content p,\n .proactive-message-content div,\n .proactive-message-content span {\n display: inline !important;\n margin: 0 !important;\n padding: 0 !important;\n }\n .proactive-message-content p:first-child,\n .proactive-message-content div:first-child,\n .proactive-message-content span:first-child {\n margin-top: 0 !important;\n }\n .proactive-message-content p:last-child,\n .proactive-message-content div:last-child,\n .proactive-message-content span:last-child {\n margin-bottom: 0 !important;\n }\n .proactive-message-content a {\n color: inherit !important;\n text-decoration: underline !important;\n cursor: pointer !important;\n }\n .proactive-message-content a:hover {\n opacity: 0.8 !important;\n }\n .proactive-message-content b,\n .proactive-message-content strong {\n font-weight: 600 !important;\n }\n .proactive-message-content i,\n .proactive-message-content em {\n font-style: italic !important;\n }\n .proactive-message-content u {\n text-decoration: underline !important;\n }\n .proactive-message-content br {\n display: block !important;\n content: "" !important;\n margin-top: 0.5em !important;\n }\n ')),xe?e.createElement("div",{className:"proactive-message-container",style:{position:"fixed",bottom:"".concat((null!==(v=null!=H?H:null===(g=N.interface_properties)||void 0===g?void 0:g.bottom_spacing)&&void 0!==v?v:20)+(ve===f.IMAGE?pe:void 0!==K?40:40*ue)+8,"px"),right:Te?"".concat(null!==(w=null!=U?U:null===(_=N.interface_properties)||void 0===_?void 0:_.side_spacing)&&void 0!==w?w:20,"px"):"auto",left:Te?"auto":"".concat(null!==(C=null!=U?U:null===(T=N.interface_properties)||void 0===T?void 0:T.side_spacing)&&void 0!==C?C:20,"px"),maxWidth:"22.875rem",zIndex:2147483646}},e.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:Te?"flex-end":"flex-start"},className:"proactive-message-bubble-container"},ie.map(function(t,n){var i="".concat(t.id,"-").concat(t.index),o=de.current.has(i),r=10*(ie.length-1-n),a=t.messageDisplayType===y.BUTTON;return console.log("visibleProactives",ie),e.createElement("div",{key:i,onClick:function(){if((null==t?void 0:t.urlToGo)&&"string"==typeof t.urlToGo&&""!==t.urlToGo.trim())window.open(t.urlToGo,"_blank","noopener,noreferrer");else{W({message_id:t.id,content_string:t.html||null,content_id:t.contentId||null}),D(),Ie();try{window.dispatchEvent(new CustomEvent("rblyn:proactiveClick",{detail:{message_id:t.id,content_string:t.html||null,content_id:t.contentId||null}}))}catch(e){}}},className:ae?Te?"proactive-bubble-exit-right":"proactive-bubble-exit-left":o&&!ae?Te?"proactive-bubble-enter-right":"proactive-bubble-enter-left":"",style:b({background:(null==t?void 0:t.messageBubbleBg)||"#ffffff",color:"#111",borderRadius:a?"100px":"12px",boxShadow:"0 2px 2px 0 rgba(0, 0, 0, 0.08)",padding:"16px",cursor:"pointer",fontFamily:A,lineHeight:k,fontSize:"14px",marginBottom:n<ie.length-1?16:0,border:"1px solid #F1F2F4",width:"fit-content",maxWidth:"100%",animationDelay:ae?"0ms":o?"".concat(r,"ms"):void 0},ae?{opacity:0}:o?{opacity:0,transform:Te?"translateX(120%) scale(0.95)":"translateX(-120%) scale(0.95)"}:{})},e.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},e.createElement("div",{className:"proactive-message-content",dir:$e(t.html),dangerouslySetInnerHTML:{__html:Qe(t.html)}}),(null==t?void 0:t.urlToGo)&&"string"==typeof t.urlToGo&&""!==t.urlToGo.trim()&&e.createElement("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{flexShrink:0,color:I((null==t?void 0:t.messageBubbleBg)||"#ffffff")}},e.createElement("g",{id:"External_Link"},e.createElement("path",{id:"Vector",d:"M6.6668 3.83268H5.4668C4.72006 3.83268 4.34642 3.83268 4.0612 3.97801C3.81032 4.10584 3.60649 4.30966 3.47866 4.56055C3.33334 4.84576 3.33334 5.21941 3.33334 5.96615V11.0328C3.33334 11.7795 3.33334 12.1527 3.47866 12.4379C3.60649 12.6888 3.81032 12.893 4.0612 13.0208C4.34614 13.166 4.71933 13.166 5.46461 13.166H10.5354C11.2807 13.166 11.6533 13.166 11.9383 13.0208C12.1891 12.893 12.3937 12.6886 12.5215 12.4377C12.6667 12.1528 12.6667 11.78 12.6667 11.0347V9.83268M13.3333 6.49935V3.16602M13.3333 3.16602H10M13.3333 3.16602L8.66667 7.83268",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})))))})),e.createElement("div",{onClick:function(e){e.stopPropagation(),Ie()},className:ae?"":Te?"proactive-close-enter-right":"proactive-close-enter-left",style:b({position:"absolute",top:"-32px",right:"Right"===(B||(null===(O=N.interface_properties)||void 0===O?void 0:O.position)||"Right")?"0px":"auto",left:"Left"===(B||(null===(R=N.interface_properties)||void 0===R?void 0:R.position)||"Right")?"0px":"auto",width:"24px",height:"24px",borderRadius:"50%",background:"#fff",boxShadow:" 0 2.667px 2.667px 0 rgba(0, 0, 0, 0.25)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",userSelect:"none",animationDelay:ae?"0ms":"".concat(10*(ie.length-1),"ms")},ae?{}:{opacity:0,transform:Te?"translateX(120%) scale(0.95)":"translateX(-120%) scale(0.95)"}),"aria-label":"Close proactive message"},e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 14 14",fill:"none"},e.createElement("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",strokeWidth:"0.816326",strokeLinecap:"round",strokeLinejoin:"round"})))):null,e.createElement("div",{ref:J,className:"message-bubble-container",style:b(b({},Ee),{transition:"transform 0.2s cubic-bezier(0.2, 1.27, 0.29, 0.97), opacity 280ms ease",transform:L?"scale(0.85)":"scale(1)",opacity:Y?0:1}),onClick:function(){D(),Ie()}},function(){switch(ve){case f.TEXT:return t=void 0!==K?void 0:160*ue,n=void 0!==K?void 0:40*ue,i=void 0!==K?void 0:14*ue,o=void 0!==K?void 0:21*ue,e.createElement("div",{style:{width:void 0!==t?"".concat(t,"px"):"fit-content",maxWidth:void 0!==t?"".concat(t,"px"):"160px",height:void 0!==n?"".concat(n,"px"):"40px",borderRadius:"9999px",backgroundColor:N.brand_colour,display:"flex",alignItems:"center",padding:"9px 20px",boxShadow:"0px 0px 16px 0px rgba(0, 0, 0, 0.24)",boxSizing:"border-box",fontFamily:A,lineHeight:k}},e.createElement("div",{style:{flex:1,minWidth:0}},e.createElement("p",{dir:$e(ye),style:{margin:0,color:I(N.brand_colour),fontSize:void 0!==i?"".concat(i,"px"):"0.875rem",fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:A,lineHeight:void 0!==o?"".concat(o,"px"):k,textAlign:"center",WebkitFontSmoothing:"antialiased",textRendering:"optimizeLegibility",textSizeAdjust:"100%"}},ye)));case f.TEXTUAL_IMAGE:return function(){var t,n,i,o,r=void 0!==K?void 0:174*ue,a=void 0!==K?void 0:40*ue,l=void 0!==K?void 0:40*ue,s=void 0!==K?void 0:14*ue,c=void 0!==K?void 0:21*ue,d=(null==N?void 0:N.launcher_type)?(null===(i=null===(n=null===(t=null==N?void 0:N.images)||void 0===t?void 0:t.launcher_image_url)||void 0===n?void 0:n.url)||void 0===i?void 0:i.trim())||et:(null===(o=null==N?void 0:N.image_url)||void 0===o?void 0:o.trim())||et,u=d===et;return e.createElement("div",{style:{maxWidth:void 0!==r?"".concat(r,"px"):"13rem",width:"fit-content",height:void 0!==a?"".concat(a,"px"):"40px",borderRadius:"9999px",backgroundColor:N.brand_colour,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",fontFamily:A,lineHeight:k}},e.createElement("div",{style:{flex:1,minWidth:0}},e.createElement("p",{dir:$e(ye),style:{margin:0,color:I(N.brand_colour),fontSize:void 0!==s?"".concat(s,"px"):"0.875rem",fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:A,lineHeight:void 0!==c?"".concat(c,"px"):k,textAlign:"right",WebkitFontSmoothing:"antialiased",textRendering:"optimizeLegibility",textSizeAdjust:"100%"}},ye)),e.createElement("div",{style:{width:void 0!==l?"".concat(l,"px"):"40px",height:void 0!==l?"".concat(l,"px"):"40px",borderRadius:"9999px",overflow:"hidden",position:"relative",flexShrink:0}},e.createElement("img",{src:d,alt:"Chat",style:{width:u?"calc(100% - 6px)":"100%",height:u?"calc(100% - 6px)":"100%",margin:u?"3px":0,borderRadius:u?0:"50%",objectFit:u?"contain":"cover",padding:u?fe:0,boxSizing:"border-box"}})))}();case f.IMAGE:default:return function(){var t,n,i,o;if(L){var r=Math.round(.5*pe);return e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%"}},e.createElement("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{display:"block"}},e.createElement("g",{id:"Chevron_Down"},e.createElement("path",{id:"Vector",d:"M19 9L12 16L5 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}))))}var a=(null==N?void 0:N.launcher_type)?(null===(i=null===(n=null===(t=null==N?void 0:N.images)||void 0===t?void 0:t.launcher_image_url)||void 0===n?void 0:n.url)||void 0===i?void 0:i.trim())||et:(null===(o=null==N?void 0:N.image_url)||void 0===o?void 0:o.trim())||et,l=a===et;return e.createElement("img",{src:a,alt:"Chat",style:{zIndex:1e3,cursor:"pointer",borderRadius:l?0:"50%",objectFit:l?"contain":"cover",padding:l?fe:0,width:l?"calc(100% - 3px)":"100%",height:l?"calc(100% - 3px)":"100%",margin:l?"4px":0,boxSizing:"border-box"}})}()}var t,n,i,o}()))}),nt=function(t){var n=t.config,i=t.onCtaClick,o=(null==n?void 0:n.title_bar_color)||"#075E54",r=I(o),a=function(e){var t,n;if(null==e?void 0:e.startsWith("#")){var i=e.replace("#",""),o=3===(null==i?void 0:i.length)?null===(n=null===(t=null==i?void 0:i.split(""))||void 0===t?void 0:t.map(function(e){return"".concat(e).concat(e)}))||void 0===n?void 0:n.join(""):i;if(6===(null==o?void 0:o.length)){var r=parseInt(null==o?void 0:o.slice(0,2),16),a=parseInt(null==o?void 0:o.slice(2,4),16),l=parseInt(null==o?void 0:o.slice(4,6),16);return"rgba(".concat(r,", ").concat(a,", ").concat(l,", 0.8)")}}return"#FFFFFF"===e?"rgba(255, 255, 255, 0.8)":"rgba(14, 14, 15, 0.8)"}(r),l=(null==n?void 0:n.button_content)||"Chat on WhatsApp";return e.createElement("div",{className:"rblyn-chat-widget-popup",style:{width:"20rem",maxWidth:"calc(100vw - 20px)",borderRadius:"22px",overflow:"hidden",backgroundColor:"#fff",boxShadow:"0 16px 40px rgba(14, 14, 15, 0.2)",marginBottom:"14px"}},e.createElement("style",null,"\n .rblyn-chat-widget-popup,\n .rblyn-chat-widget-popup * {\n font-family: ".concat(O," !important;\n }\n .rblyn-chat-widget-powered-link {\n text-decoration: none;\n }\n .rblyn-chat-widget-powered-link:hover {\n text-decoration: underline;\n color: rgba(14, 14, 15, 0.8) !important;\n }\n ")),e.createElement("div",{style:{backgroundColor:o,padding:"20px 18px 16px"}},e.createElement("div",{style:{color:r,fontSize:"16px",fontWeight:600,lineHeight:"1.2"}},(null==n?void 0:n.widget_title)||"Hi there"),e.createElement("div",{style:{color:a,fontSize:"12px",marginTop:"4px"}},(null==n?void 0:n.widget_subtitle)||"We typically reply in minutes")),e.createElement("div",{style:{padding:"20px 16px 22px"}},e.createElement("button",{onClick:i,style:{width:"100%",border:"none",borderRadius:"14px",backgroundColor:(null==n?void 0:n.brand_colour)||"#25D366",color:I((null==n?void 0:n.brand_colour)||"#25D366"),fontSize:"14px",fontWeight:600,padding:"14px 16px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"}},e.createElement("img",{src:"https://cdn.robylon.ai/logos/WhatsApp.svg",alt:"WhatsApp",style:{width:"20px",height:"20px",objectFit:"contain"}}),e.createElement("span",null,l)),(null==n?void 0:n.powered_by_robylon)?e.createElement("div",{style:{textAlign:"center",color:"rgba(14, 14, 15, 0.4)",fontSize:"14px",marginTop:"14px"}},"Powered by"," ",e.createElement("a",{href:"https://www.robylon.ai",target:"_blank",rel:"noopener noreferrer",className:"rblyn-chat-widget-powered-link"},"Robylon")):null))},it=function(){var e;return(null===(e=navigator.userAgentData)||void 0===e?void 0:e.platform)||(/Windows|Mac|Linux|Android|iOS/.exec(navigator.userAgent)||["Unknown"])[0]},ot=function(){var e;if(null===(e=navigator.userAgentData)||void 0===e?void 0:e.brands)for(var t=["Chrome","Firefox","Safari","Edge","Opera"],n=0,i=navigator.userAgentData.brands;n<i.length;n++){var o=i[n];if(t.includes(o.brand))return o.brand}return(/Chrome|Firefox|Safari|Edge|Opera/.exec(navigator.userAgent)||["Unknown"])[0]},rt=function(){var e,t,n,i;return{width:(null===window||void 0===window?void 0:window.innerWidth)||(null===(e=null===document||void 0===document?void 0:document.documentElement)||void 0===e?void 0:e.clientWidth)||(null===(t=null===document||void 0===document?void 0:document.body)||void 0===t?void 0:t.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===(i=null===document||void 0===document?void 0:document.body)||void 0===i?void 0:i.clientHeight)}},at=function(){return{platform:"web",os:it(),browser:ot(),sdk_version:"1.0.1",device:(e=navigator.userAgent.toLowerCase(),/(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i.test(e)?"tablet":/Mobile|Android|iP(hone|od)|IEMobile|BlackBerry|Kindle|Silk-Accelerated|(hpw|web)OS|Opera M(obi|ini)/.test(e)?"mobile":"desktop"),screen_size:rt()};var e};S.log("Raw API_URL:","https://api.robylon.ai");var lt={copilotUrl:"https://chatbot.robylon.ai",environment:"production",apiUrl:"https://api.robylon.ai"};S.log("CONFIG",lt);var st,ct=function(){return"undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement},dt=function(){return{copilotUrl:lt.copilotUrl||"https://app.robylon.ai",environment:lt.environment||"production",apiUrl:lt.apiUrl||"https://app.robylon.ai"}};!function(e){e.ERROR="ERROR",e.INFO="INFO"}(st||(st={}));var ut,pt=["@robylon/whatsapp-react-sdk","node_modules/@robylon/whatsapp-react-sdk/"],ft=function(e){var t=e.filename,n=e.stack,i=e.message;return!!(t||n||i)&&pt.some(function(e){return(null==t?void 0:t.includes(e))||(null==n?void 0:n.includes(e))||(null==i?void 0:i.includes(e))})},mt=function(){function e(){var e=this;this.apiKey="",this.userId=null,this.preInitQueue=[],this.isInitialized=!1,this.handleWindowError=function(t){var n,i={filename:t.filename,stack:null===(n=t.error)||void 0===n?void 0:n.stack,message:t.message};ft(i)&&e.trackError(t.error||t.message,"GlobalErrorHandler",{filename:t.filename,lineNo:t.lineno,colNo:t.colno})},this.handleUnhandledRejection=function(t){var n,i,o={stack:null===(n=t.reason)||void 0===n?void 0:n.stack,message:(null===(i=t.reason)||void 0===i?void 0:i.message)||String(t.reason)};ft(o)&&e.trackError(t.reason||"Unhandled Promise Rejection","GlobalPromiseHandler",{reason:t.reason})},this.setupGlobalHandlers()}return e.prototype.setupGlobalHandlers=function(){ct()&&(null===window||void 0===window||window.addEventListener("error",null==this?void 0:this.handleWindowError),null===window||void 0===window||window.addEventListener("unhandledrejection",this.handleUnhandledRejection))},e.prototype.cleanup=function(){ct()&&(null===window||void 0===window||window.removeEventListener("error",null==this?void 0:this.handleWindowError),null===window||void 0===window||window.removeEventListener("unhandledrejection",this.handleUnhandledRejection))},e.getInstance=function(){return e.instance||(e.instance=new e),e.instance},e.prototype.initialize=function(e,t){void 0===t&&(t=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===e?"undefined":null===e?"null":""===e?"empty string":"invalid: ".concat(e)),componentName:"ErrorTrackingService",additionalInfo:{preInitError:!0,apiKey:e,userId:t,timestamp:Date.now()},timestamp:Date.now()},metadata:at(),event_type:st.ERROR,user_id:t};this.sendLog(n).catch(console.error)}this.apiKey=e,this.userId=t,this.isInitialized=!0,this.processPreInitQueue()}catch(n){S.error("Error during ErrorTrackingService initialization:",n),this.preInitQueue.push({error:n instanceof Error?n:new Error(String(n)),componentName:"ErrorTrackingService",additionalInfo:{apiKey:e,userId:t}})}},e.prototype.processPreInitQueue=function(){return _(this,void 0,void 0,function(){var e,t,n;return w(this,function(i){switch(i.label){case 0:if(!this.preInitQueue.length)return[2];S.info("Processing ".concat(this.preInitQueue.length," pre-initialization errors")),e=0,t=this.preInitQueue,i.label=1;case 1:return e<t.length?(n=t[e],[4,this.trackError(n.error,n.componentName,b(b({},n.additionalInfo),{preInitError:!0}))]):[3,4];case 2:i.sent(),i.label=3;case 3:return e++,[3,1];case 4:return this.preInitQueue=[],[2]}})})},e.prototype.sendLog=function(e){return _(this,void 0,void 0,function(){var t,n,i,o,r,a;return w(this,function(l){switch(l.label){case 0:return l.trys.push([0,4,,5]),t=dt().apiUrl,[4,fetch("".concat(t,"/users/sdk/record-logs/"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})];case 1:return(n=l.sent()).ok?[3,3]:(o=(i=S).error,r=["Failed to send error log:"],[4,n.text()]);case 2:o.apply(i,r.concat([l.sent()])),l.label=3;case 3:return[3,5];case 4:return a=l.sent(),S.error("Error sending log:",a),[3,5];case 5:return[2]}})})},e.prototype.trackError=function(e,t,n){return _(this,void 0,void 0,function(){var i,o,r;return w(this,function(a){switch(a.label){case 0:if(this.isInitialized)return[3,5];i={org_id:"UNINITALIZED",event_data:{message:e instanceof Error?e.message:e,stack:e instanceof Error?e.stack:void 0,componentName:t,additionalInfo:b(b({},n),{preInitError:!0,timestamp:Date.now()}),timestamp:Date.now()},metadata:at(),event_type:st.ERROR,user_id:this.userId},a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.sendLog(i)];case 2:return a.sent(),[3,4];case 3:return a.sent(),this.preInitQueue.push({error:e,componentName:t,additionalInfo:n}),S.warn("Error tracked before initialization, queuing:",e),[3,4];case 4:return[2];case 5:return o={message:e instanceof Error?e.message:e,stack:e instanceof Error?e.stack:void 0,componentName:t,additionalInfo:b(b({},n),{timestamp:Date.now()}),timestamp:Date.now()},r={org_id:this.apiKey||"UNINITALIZED",event_data:o,metadata:at(),event_type:st.ERROR,user_id:this.userId},[4,this.sendLog(r)];case 6:return a.sent(),[2]}})})},e.prototype.trackInfo=function(e,t,n){return _(this,void 0,void 0,function(){var i,o;return w(this,function(r){switch(r.label){case 0:return this.apiKey?(i={message:e,componentName:t,additionalInfo:n,timestamp:Date.now()},o={org_id:this.apiKey,event_data:i,metadata:at(),event_type:st.INFO,user_id:this.userId},[4,this.sendLog(o)]):(S.error("Error tracking not initialized"),[2]);case 1:return r.sent(),[2]}})})},e}(),ht=mt.getInstance(),gt="MISSING_API_KEY",vt="INVALID_API_KEY",yt="CONFIG_FETCH_FAILED",bt="SDK_INIT_FAILED",_t="ERROR_TRACKING_INIT_FAILED",wt="API_REQUEST_FAILED",Et="NETWORK_ERROR",xt="INVALID_RESPONSE",Tt="IFRAME_LOAD_FAILED",It="COOKIE_ACCESS_ERROR",Ct="COMPONENT_RENDER_ERROR",St="INITIALIZATION_ERROR",At="API_ERROR",Ot="COMPONENT_ERROR",kt=((ut={})[gt]=function(e){return"SDK Initialization Failed: Required parameter 'api_key' is ".concat(void 0===e?"undefined":null===e?"null":""===e?"empty string":"invalid: ".concat(e),". A valid API key string is required to initialize the SDK.")},ut[vt]=function(e){return"SDK Initialization Failed: Provided API key '".concat(e,"' is invalid. API key must be a non-empty string in UUID format.")},ut[yt]=function(e){return"Failed to fetch chatbot configuration: ".concat(e.statusCode?"Server responded with status ".concat(e.statusCode):"Could not reach server").concat(e.error?". Error: ".concat(e.error):"")},ut[wt]=function(e,t,n){return"API Request Failed: Server responded with status ".concat(e," for ").concat(n?"endpoint ".concat(n):"request"," - ").concat(t)},ut[Et]=function(e){return"Network Error: Failed to communicate with server".concat(e.url?" at ".concat(e.url):"").concat(e.error?" - ".concat(e.error):"")},ut[Tt]=function(e){return"Failed to load chatbot interface".concat(e.src?" from ".concat(e.src):"").concat(e.error?". Error: ".concat(e.error):"")},ut[xt]=function(e){return"Invalid API Response: Missing required fields in response data: ".concat(e.join(", "))},ut[_t]=function(e){return"Error Tracking Service initialization failed".concat(e.apiKey?" for API key ".concat(e.apiKey):"").concat(e.error?". Error: ".concat(e.error):"")},ut[bt]=function(e){return"SDK Initialization Failed: ".concat(e.reason||"Could not initialize the chatbot SDK").concat(e.config?". Attempted initialization with config: ".concat(JSON.stringify(e.config,null,2)):"")},ut[It]=function(e,t){return"Cookie Access Error: Failed to ".concat(e).concat(t?" cookie '".concat(t,"'"):" cookies",". This may affect user session persistence.")},ut[Ct]=function(e){return"React Component Error: ".concat(e.component||"Unknown component"," failed to render. Error: ").concat(e.error).concat(e.stack?"\nComponent Stack: ".concat(e.stack):"")},ut),Rt=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={hasError:!1},t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}d(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.getDerivedStateFromError=function(e){return{hasError:!0}},t.prototype.componentDidCatch=function(e,t){ht.trackError(new Error(kt[Ct]({component:this.props.componentName||void 0,error:e.message,stack:t.componentStack})),this.props.componentName||void 0,{errorCode:Ct,errorType:Ot,context:{originalError:e,componentStack:t.componentStack,timestamp:Date.now()}})},t.prototype.render=function(){return this.state.hasError?null:this.props.children},t}(r),Nt=function(e){var t=e?"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 t=t.split(";").map(function(e){var t=e.split("="),n=t[0],i=t.slice(1).join("=").trim();return{name:n=n.trim(),value:i?decodeURIComponent(i):""}}),t},Dt=function(){var e,t=navigator.userAgent;if(null===(e=navigator.userAgentData)||void 0===e?void 0:e.brands){var n=navigator.userAgentData.brands.find(function(e){return"Google Chrome"===e.brand});if(null==n?void 0:n.version)return n.version}var i=t.match(/(Chrome|Firefox|Safari|Edge|Opera)\/(\d+\.\d+)/);return i?i[2]:"Unknown"},Lt=function(){var e,t,n=at();return{current_page_url:(null===(e=null===window||void 0===window?void 0:window.location)||void 0===e?void 0:e.href)||"",browser_language:(null===navigator||void 0===navigator?void 0:navigator.language)||(null===(t=null===navigator||void 0===navigator?void 0:navigator.languages)||void 0===t?void 0:t[0])||"en",browser_version:Dt(),os:null==n?void 0:n.os,referral_url:(null===document||void 0===document?void 0:document.referrer)||"",system_info:n}},zt="https://cdn.robylon.ai/logos/WhatsApp.svg",Mt=function(){function e(e){this.logoContainer=null,this.iframe=null,this.bubblePromptContainer=null,this.chatBtnImage=null,this.config=e,this.validateDomain()&&this.init(),null===window||void 0===window||window.addEventListener("message",this.onCloseListener.bind(this),!1)}return e.prototype.onCloseListener=function(e){e.origin===this.config.domain&&"closeChatbot"===e.data&&this.closeIframe()},e.prototype.validateDomain=function(){var e,t=this.config.domain,n=null===(e=null===window||void 0===window?void 0:window.location)||void 0===e?void 0:e.origin;return S.log("expectedDomain, to current domain",t,n,t===n),t===n},e.prototype.createChatBubblContainer=function(){var e,t=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 i=document.createElement("div");i.classList.add("close-btn"),i.textContent="✕",Object.assign(i.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===(e=this.config.chat_interface_config)||void 0===e?void 0:e.chat_bubble_prompts)||[]).forEach(function(e){var i=t.createMessageBubble(e);n.appendChild(i)}),n.appendChild(i),document.body.appendChild(n)},e.prototype.createMessageBubble=function(e){var t=document.createElement("div");this.bubblePromptContainer=t,Object.assign(t.style,{display:"flex",position:"relative",justifyContent:"flex-end"});var n=document.createElement("div");n.classList.add("message"),n.textContent=e,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 i=document.createElement("button");return i.innerHTML="&times;",Object.assign(i.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"}),i.addEventListener("click",function(){t.remove()}),t.appendChild(i),t.appendChild(n),t},e.prototype.createFloatingButton=function(){var e=document.createElement("div");e.classList.add("message-bubble-container"),Object.assign(e.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:I(this.config.brand_colour),borderRadius:"50%",alignItems:"center",justifyContent:"center",cursor:"pointer",overflow:"hidden"}),document.body.appendChild(e),this.logoContainer=e,this.loadImage(this.logoContainer),this.createChatBubblContainer(),this.logoContainer.addEventListener("click",this.toggleIframe.bind(this))},e.prototype.loadImage=function(e){var t,n,i,o,r,a,l,s,c,d=document.createElement("img"),u=null!==(n=null===(t=this.config)||void 0===t?void 0:t.launcher_size_multiplier)&&void 0!==n?n:1,p="".concat(Math.max(4,Math.round(4*u)),"px"),f=(null===(i=this.config)||void 0===i?void 0:i.launcher_type)?(null===(l=null===(a=null===(r=null===(o=this.config)||void 0===o?void 0:o.images)||void 0===r?void 0:r.launcher_image_url)||void 0===a?void 0:a.url)||void 0===l?void 0:l.trim())||zt:(null===(c=null===(s=this.config)||void 0===s?void 0:s.image_url)||void 0===c?void 0:c.trim())||zt,m=f===zt;d.src=f,d.alt="Chat",Object.assign(d.style,{zIndex:"1000",cursor:"pointer",borderRadius:m?"0":"50%",objectFit:m?"contain":"cover",padding:m?p:"0",boxSizing:"border-box",width:m?"calc(100% - 3px)":"100%",height:m?"calc(100% - 3px)":"100%",margin:m?"4px":"0"}),this.chatBtnImage=d,e.innerHTML="",e.appendChild(d)},e.prototype.createIframe=function(){var e=this;S.log("RobylonConfig?.domain====>",this.config.domain);var t=document.createElement("iframe");Object.assign(t.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"}),t.src="".concat(this.config.domain,"/chatbot-plugin?id=").concat(this.config.chatbotId),S.log("iframe.src====>",t.src),document.body.appendChild(t),this.iframe=t;var n=function(){(null===window||void 0===window?void 0:window.innerWidth)<560?Object.assign(t.style,{width:"100vw",minWidth:"300px",right:"0",bottom:"0",height:"100vh",flexDirection:"column",flexGrow:"1",borderRadius:"0",top:"0",maxHeight:"100%"}):Object.assign(t.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),t.addEventListener("load",function(){var n,i,o,r,a;if(e.iframe){var l=new URL(e.iframe.src).origin||e.config.domain;null===(n=t.contentWindow)||void 0===n||n.postMessage({domain:null===(i=null===window||void 0===window?void 0:window.location)||void 0===i?void 0:i.hostname,name:"checkDomain"},l),null===(o=t.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:e.config.userId,token:e.config.token,userProfile:b(b({},e.config.userProfile||{}),{__INT_SYS_INFO__:b(b({},(null===(a=e.config.userProfile)||void 0===a?void 0:a.__INT_SYS_INFO__)||{}),Lt())})}},l)}}),null===window||void 0===window||window.addEventListener("message",function(n){var i,o;if(n.origin===e.config.domain){if("captureSessionData"===n.data){var r="66b33d16-5b38-4693-8772-1a1bd7dd412d"===e.config.chatbotId,a={cookies:Nt(r),localStorage:JSON.stringify(localStorage),sessionStorage:JSON.stringify(sessionStorage),action:"capturedSessionData",domain_name:null===(i=null===window||void 0===window?void 0:window.location)||void 0===i?void 0:i.hostname};null===(o=t.contentWindow)||void 0===o||o.postMessage(a,e.config.domain||"*")}"expand"===n.data&&(e.adjustIframeWidth(),t.style.height="calc(100vh - 120px)",t.style.bottom="86px"),"collapse"===n.data&&Object.assign(t.style,{width:"26%",height:"calc(100vh - 32px - 10vh)",bottom:"86px",top:"calc(32px + 10vh)"})}})},e.prototype.adjustIframeWidth=function(){if(this.iframe){var e=null===window||void 0===window?void 0:window.innerWidth;S.log("screenWidth",e),this.iframe.style.width=e<832?"".concat(e-64,"px"):"800px"}},e.prototype.loadSvgInline=function(e){var t=document.createElement("div");t.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=t.querySelector("svg");e.innerHTML="",n&&e.appendChild(n)},e.prototype.toggleIcon=function(e,t){"block"===t.style.display?this.loadSvgInline(e):this.loadImage(e)},e.prototype.toggleIframe=function(){var e,t;if(S.log("toggleIframe",this.iframe,this.logoContainer,this.chatBtnImage),this.iframe&&this.logoContainer&&this.chatBtnImage){var n=new URL(this.iframe.src).origin||this.config.domain;S.log("toggleIframe"),null===(e=this.iframe.contentWindow)||void 0===e||e.postMessage({domain:null===window||void 0===window?void 0:window.location.hostname,name:"none"===this.iframe.style.display?"openFrame":"closeFrame"},n),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":(null===(t=this.chatBtnImage)||void 0===t?void 0:t.src)===zt?"contain":"cover",this.bubblePromptContainer&&(this.bubblePromptContainer.style.display="none"),S.log("this.bubblePromptContainer",this.bubblePromptContainer)}},e.prototype.closeIframe=function(){var e;this.iframe&&this.logoContainer&&this.chatBtnImage&&(this.iframe.style.display="none",this.toggleIcon(this.logoContainer,this.iframe),this.chatBtnImage.style.objectFit=(null===(e=this.chatBtnImage)||void 0===e?void 0:e.src)===zt?"contain":"cover")},e.prototype.init=function(){this.createIframe(),this.createFloatingButton()},e}(),Ft=function(e,t,n){if(e.chatbotId&&e.userId)try{new Mt(e);t(!0),S.log("Robylon SDK initialized successfully.")}catch(e){n(e instanceof Error?e.message:"Failed to initialize SDK")}else n("Incomplete configuration for SDK initialization.")},Bt=function(e){return function(e){var t,n,i,o,r,a,l,s;return Boolean((null===(i=null===(n=null===(t=null==e?void 0:e.user)||void 0===t?void 0:t.org_info)||void 0===n?void 0:n.brand_config)||void 0===i?void 0:i.widget)&&(null===(s=null===(l=null===(a=null===(r=null===(o=null==e?void 0:e.user)||void 0===o?void 0:o.org_info)||void 0===r?void 0:r.brand_config)||void 0===a?void 0:a.profile)||void 0===l?void 0:l.qr_code)||void 0===s?void 0:s.chat_link))}(e)?function(e){var t,n,i=null===(n=null===(t=null==e?void 0:e.user)||void 0===t?void 0:t.org_info)||void 0===n?void 0:n.brand_config;return{profile:null==i?void 0:i.profile,widget:null==i?void 0:i.widget,business_profile:null==i?void 0:i.business_profile,display_name:null==i?void 0:i.display_name}}(e):e},Ut=function(e,t,n){return _(void 0,void 0,void 0,function(){var i,o,r,a,l,s,c,d,u,p;return w(this,function(f){switch(f.label){case 0:return f.trys.push([0,5,,6]),i=dt().apiUrl,o="".concat(i,"/chat/whatsapp/get/"),S.log("endpointUrl",o),r={client_user_id:t||null,org_id:e,token:n||void 0,extra_info:{},launcher_info:Lt(),phone_no_id:"739739745898120"},[4,fetch(o,{method:"POST",headers:{"Content-Type":"text/plain"},body:JSON.stringify(r)})];case 1:return(a=f.sent()).ok?[3,3]:[4,a.text()];case 2:throw l=f.sent(),new Error(kt[wt](a.status,l));case 3:return[4,a.json()];case 4:if(s=f.sent(),c=Bt(s),!(null===(p=null===(u=null==c?void 0:c.profile)||void 0===u?void 0:u.qr_code)||void 0===p?void 0:p.chat_link)||!(null==c?void 0:c.widget))throw new Error(kt[xt](["profile","widget"]));return[2,c];case 5:throw d=f.sent(),ht.trackError(d instanceof Error?d:new Error(kt[Et]({error:String(d)})),"fetchChatbotConfig",{errorCode:d instanceof Error&&d.message.includes("API Request Failed")?wt:Et,errorType:At,context:{apiKey:e,userId:t,timestamp:Date.now()}}),d;case 6:return[2]}})})},Ht=function(e){return _(void 0,void 0,void 0,function(){var t,n,i,o,r,a,l,s,c,d,m,h,g,v,y,_,E,x,T,I,C,A,O,k,R,N,D,L,z,M,F,B,U;return w(this,function(w){switch(w.label){case 0:return t=function(e){return{api_key:String(e.api_key||""),user_id:e.user_id?String(e.user_id):null,user_token:e.user_token?String(e.user_token):void 0,user_profile:e.user_profile||{}}}(e),n=t.user_id||void 0,i=!1,n||(n=function(e){var t,n="; ".concat(document.cookie).split("; ".concat(e,"="));if(2===n.length)return null===(t=n.pop())||void 0===t?void 0:t.split(";").shift()}("rblyn_anon")||"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}),j="rblyn_anon",P=n,W=365,(G=new Date).setTime(G.getTime()+24*W*60*60*1e3),document.cookie="".concat(j,"=").concat(P,";expires=").concat(G.toUTCString(),";path=/"),i=!0),[4,Ut(t.api_key,n,t.user_token)];case 1:o=w.sent();try{t.api_key}catch(e){S.warn("Failed to inject mock proactive messages",e)}return r=at(),a=Lt(),H=t.user_profile,l=H?Object.fromEntries(Object.entries(H).map(function(e){var t=e[0],n=e[1];return"boolean"==typeof n||"number"==typeof n?[t,n]:[t,String(n)]})):{},s=b(b(b({},r),{__INT_SYS_INFO__:b(b({},r),a)}),l),c=function(e){if("string"==typeof e)return(null==e?void 0:e.trim())||"";var t=null==e?void 0:e.url;return"string"==typeof t&&(null==t?void 0:t.trim())||""}(null===(d=null==o?void 0:o.widget)||void 0===d?void 0:d.launcher_image),[2,{chatbotId:t.api_key,userId:n,token:t.user_token,isAnonymous:i,domain:"",show_launcher:!0,brand_colour:(null===(m=null==o?void 0:o.widget)||void 0===m?void 0:m.brand_color)||"#25D366",image_url:c,userProfile:s,chat_interface_config:{chat_bubble_prompts:[],display_name:(null===(h=null==o?void 0:o.widget)||void 0===h?void 0:h.title)||(null==o?void 0:o.display_name)||"",welcome_message:(null===(g=null==o?void 0:o.widget)||void 0===g?void 0:g.subtitle)||"Hey! What can we help you with today?",redirect_url:(null===(y=null===(v=null==o?void 0:o.profile)||void 0===v?void 0:v.qr_code)||void 0===y?void 0:y.chat_link)||""},launcher_type:(null===(_=null==o?void 0:o.widget)||void 0===_?void 0:_.launcher_type)||f.IMAGE,launcher_properties:{text:(null===(E=null==o?void 0:o.widget)||void 0===E?void 0:E.launcher_text)||(null===(x=null==o?void 0:o.widget)||void 0===x?void 0:x.button_content)||""},images:{launcher_image_url:{url:c}},proactive_message_obj:void 0,interface_properties:{position:(null===(T=null==o?void 0:o.widget)||void 0===T?void 0:T.position)||p.RIGHT,side_spacing:(null===(I=null==o?void 0:o.widget)||void 0===I?void 0:I.side_spacing)||20,bottom_spacing:(null===(C=null==o?void 0:o.widget)||void 0===C?void 0:C.bottom_spacing)||20},interface_type:u.WIDGET,launcher_delay:{enabled:!1,delay:0},launcher_size_multiplier:null!==(O=null===(A=null==o?void 0:o.widget)||void 0===A?void 0:A.launcher_size_multiplier)&&void 0!==O?O:1,redirect_chat_link:(null===(R=null===(k=null==o?void 0:o.profile)||void 0===k?void 0:k.qr_code)||void 0===R?void 0:R.chat_link)||"",pre_filled_message:(null===(D=null===(N=null==o?void 0:o.profile)||void 0===N?void 0:N.qr_code)||void 0===D?void 0:D.pre_filled_message)||"",widget_type:(null===(L=null==o?void 0:o.widget)||void 0===L?void 0:L.widget_type)||"quick_launch",widget_title:(null===(z=null==o?void 0:o.widget)||void 0===z?void 0:z.title)||"",widget_subtitle:(null===(M=null==o?void 0:o.widget)||void 0===M?void 0:M.subtitle)||"",title_bar_color:(null===(F=null==o?void 0:o.widget)||void 0===F?void 0:F.title_bar_color)||"#075E54",button_content:(null===(B=null==o?void 0:o.widget)||void 0===B?void 0:B.button_content)||"Chat on WhatsApp",powered_by_robylon:!1!==(null===(U=null==o?void 0:o.widget)||void 0===U?void 0:U.powered_by_robylon)}]}var H,j,P,W,G})})},jt=function(e){var t=a(function(){return function(e){return{api_key:String(e.api_key||""),user_id:e.user_id?String(e.user_id):null,user_token:e.user_token?String(e.user_token):void 0,user_profile:e.user_profile||{}}}(e)},[e.api_key,e.user_id,e.user_token,JSON.stringify(e.user_profile)]),n=i({isInitialized:!1,isInitializing:!1,error:null,chatbotConfig:null,isIframeVisible:!1}),r=n[0],s=n[1],c=a(function(){return t.user_profile?Object.fromEntries(Object.entries(t.user_profile).map(function(e){var t=e[0],n=e[1];return"boolean"==typeof n||"number"==typeof n?[t,n]:[t,String(n)]})):{}},[JSON.stringify(t.user_profile)]),d=l(function(e){s(function(t){return b(b({},t),e)})},[]),u=l(function(){return _(void 0,void 0,void 0,function(){var e,n,i,o;return w(this,function(r){switch(r.label){case 0:if(!t.api_key)return ht.trackError(new Error(kt[gt](t.api_key)),"useChatbotState",{errorCode:gt,errorType:St,context:{timestamp:Date.now()}}),[2];d({isInitializing:!0}),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,Ht(t)];case 2:return e=r.sent(),n=b(b(b({},at()),null==e?void 0:e.userProfile),c),e.userProfile=n,[4,new Promise(function(t,n){Ft(e,function(){d({isInitialized:!0,chatbotConfig:e}),t()},function(e){n(e)})})];case 3:return r.sent(),[3,6];case 4:return i=r.sent(),o=i instanceof Error?i.message:"Failed to initialize chatbot",d({error:o}),ht.trackError(i instanceof Error?i:new Error(o),"useChatbotState",{errorCode:bt,errorType:St,context:{timestamp:Date.now()}}),[3,6];case 5:return d({isInitializing:!1}),[7];case 6:return[2]}})})},[t.api_key,t.user_id,t.user_token]);o(function(){t.api_key&&u()},[u]),o(function(){r.chatbotConfig&&s(function(e){return b(b({},e),{chatbotConfig:b(b({},e.chatbotConfig),{userProfile:b(b({},at()),c)})})})},[c]);var p=l(function(){s(function(e){return b(b({},e),{isIframeVisible:!e.isIframeVisible})})},[]),f=l(function(){d({isIframeVisible:!1})},[]);return b(b({},r),{toggleIframeVisibility:p,closeIframe:f})},Pt=function(t){var n,r,a,l,s,c,d,u=t.children,p=t.config,f=t.position,m=t.sideSpacing,h=t.bottomSpacing,g=i(!1),v=g[0],y=g[1];o(function(){var e=function(){var e=(null===window||void 0===window?void 0:window.innerWidth)<560;y(e)};return e(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}},[]);var _=f||(null===(a=p.interface_properties)||void 0===a?void 0:a.position)||"Right",w=null!==(s=null!=m?m:null===(l=p.interface_properties)||void 0===l?void 0:l.side_spacing)&&void 0!==s?s:20,E=null!==(d=null!=h?h:null===(c=p.interface_properties)||void 0===c?void 0:c.bottom_spacing)&&void 0!==d?d:20;S.log("config",p,_,w);var x={position:"fixed",zIndex:1e3,display:"flex",flexDirection:"column"},T=b(b({},x),((n={bottom:"".concat(E,"px")})[_.toLowerCase()]="".concat(null!=w?w:20,"px"),n.alignItems="Right"===_?"flex-end":"flex-start",n.top=void 0,n["Right"===_?"left":"right"]=void 0,n)),I=b(b({},x),((r={top:0})[_.toLowerCase()]="".concat(null!=w?w:20,"px"),r.alignItems="center",r.bottom=void 0,r["Right"===_?"left":"right"]=void 0,r)),C=v?I:T;return o(function(){console.log("Container screen width changed, isMobile:",v,"Style:",C)},[v,C]),e.createElement("div",{className:"robylon-chatbot-container",style:C},u)},Wt=s(function(t,n){var r,s,d,u=t.api_key,p=t.user_id,f=t.user_token,m=t.user_profile,h=t.onEvent,g=t.position,v=t.sideSpacing,y=t.bottomSpacing,T=t.show_launcher,I=t.launcher_type,C=t.launcher_properties_text;t.overrides;var A=t.launcher_size,O="string"==typeof v?""===v||isNaN(Number(v))?void 0:Number(v):v,k="string"==typeof y?""===y||isNaN(Number(y))?void 0:Number(y):y,R="string"==typeof g?"left"===g.toLowerCase()?"Left":"right"===g.toLowerCase()?"Right":void 0:g;o(function(){});var N=a(function(){return{api_key:u,user_id:p,user_token:f,user_profile:m}},[u,p,f,m]),D=l(function(e){null==h||h(e)},[h]),L=jt(N),z=L.isInitialized,M=L.error,F=L.chatbotConfig,B=L.isIframeVisible,U=L.toggleIframeVisibility,H=L.closeIframe,j=a(function(){return{api_key:u,user_profile:N.user_profile,onEvent:D,chatbotConfig:F?{isAnonymous:F.isAnonymous,userId:F.userId}:null}},[u,N.user_profile,D,null==F?void 0:F.isAnonymous,null==F?void 0:F.userId]),P=function(e){var t=e.api_key,n=e.chatbotConfig,i=e.user_profile,o=e.onEvent,r=a(function(){return{isAnonymous:(null==n?void 0:n.isAnonymous)||!1,userId:(null==n?void 0:n.userId)||""}},[null==n?void 0:n.isAnonymous,null==n?void 0:n.userId]),s=a(function(){return i||{}},[JSON.stringify(i)]),c=l(function(e){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];return _(void 0,E([e],n,!0),void 0,function(e,n){var i,o,a,l,c,d,u;return void 0===n&&(n={}),w(this,function(p){switch(p.label){case 0:if(!t)return[2];p.label=1;case 1:return p.trys.push([1,3,,4]),i=dt().apiUrl,o=at(),a=b({trigger_time:Date.now(),channel:"CHATBOT",launch_url:(null===(u=null===window||void 0===window?void 0:window.location)||void 0===u?void 0:u.href)||"",org_id:t,client_user_id:r.isAnonymous?"Anonymous":String(r.userId),event_type:e,user_profile:s},n),l={org_id:t,event_data:a,metadata:b({timestamp:Date.now()},o),event_type:"INFO",user_id:r.userId},[4,fetch("".concat(i,"/users/sdk/record-logs/"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)})];case 2:if(!(c=p.sent()).ok)throw new Error("Failed to send internal event: ".concat(c.statusText));return[3,4];case 3:return d=p.sent(),S.error("Failed to send internal event:",d),[3,4];case 4:return[2]}})})},[t,r]);return{emitEvent:l(function(e,t){var n=Date.now();e!==x.CHATBOT_BUTTON_CLICKED&&e!==x.CHATBOT_CLOSED&&e!==x.CHATBOT_OPENED&&e!==x.CHATBOT_READY||(o&&o({type:e,timestamp:n,data:t}),c(e,{timestamp:n}))},[o,c]),onInternalEvent:c}}(b({},j)),W=P.emitEvent,G=P.onInternalEvent;c(n,function(){return{show:function(){z&&F?"chat_widget"===(null==F?void 0:F.widget_type)?B||(U(),W(x.CHATBOT_BUTTON_CLICKED)):(null==F?void 0:F.redirect_chat_link)&&(window.open(null==F?void 0:F.redirect_chat_link,"_blank","noopener,noreferrer"),W(x.CHATBOT_BUTTON_CLICKED)):console.warn("Robylon Chatbot: Cannot show - chatbot not ready yet")},hide:function(){z&&F?"chat_widget"===(null==F?void 0:F.widget_type)&&B&&(H(),W(x.CHATBOT_CLOSED)):console.warn("Robylon Chatbot: Cannot hide - chatbot not ready yet")},toggle:function(){z&&F?"chat_widget"===(null==F?void 0:F.widget_type)?(U(),W(B?x.CHATBOT_CLOSED:x.CHATBOT_BUTTON_CLICKED)):(null==F?void 0:F.redirect_chat_link)&&(window.open(null==F?void 0:F.redirect_chat_link,"_blank","noopener,noreferrer"),W(x.CHATBOT_BUTTON_CLICKED)):console.warn("Robylon Chatbot: Cannot toggle - chatbot not ready yet")},isReady:z&&!!F}},[z,F,B,U,H,W]),o(function(){z&&F&&W(x.CHATBOT_READY)},[z,F,W]);var X=i(!1),V=X[0],Y=X[1];o(function(){var e,t,n,i,o,r,a;if(!(void 0!==T?Boolean(T):null===(e=null==F?void 0:F.show_launcher)||void 0===e||e))return Y(!1),function(){a&&clearTimeout(a)};var l=!0===(null===(t=null==F?void 0:F.launcher_delay)||void 0===t?void 0:t.enabled),s=null!==(r=null!==(i=null===(n=null==F?void 0:F.launcher_delay)||void 0===n?void 0:n.seconds)&&void 0!==i?i:null===(o=null==F?void 0:F.launcher_delay)||void 0===o?void 0:o.delay)&&void 0!==r?r:0;return l&&Number(s)>0?(Y(!1),a=window.setTimeout(function(){Y(!0)},1e3*Number(s))):Y(!0),function(){a&&clearTimeout(a)}},[T,null==F?void 0:F.show_launcher,null===(r=null==F?void 0:F.launcher_delay)||void 0===r?void 0:r.enabled,null===(s=null==F?void 0:F.launcher_delay)||void 0===s?void 0:s.seconds,null===(d=null==F?void 0:F.launcher_delay)||void 0===d?void 0:d.delay]),o(function(){if(u)try{ht.initialize(u,p)}catch(e){ht.trackError(e instanceof Error?e:new Error(String(e)),"RobylonChatbot",{errorCode:_t,errorType:St,context:{timestamp:Date.now()}})}else ht.trackError(new Error(kt[gt](u)),"RobylonChatbot",{errorCode:gt,errorType:St,context:{timestamp:Date.now()}})},[u,p]);var K="chat_widget"===(null==F?void 0:F.widget_type),J=l(function(){var e=null==F?void 0:F.redirect_chat_link;K?(U(),W(B?x.CHATBOT_CLOSED:x.CHATBOT_BUTTON_CLICKED)):e&&(window.open(e,"_blank","noopener,noreferrer"),W(x.CHATBOT_BUTTON_CLICKED))},[null==F?void 0:F.redirect_chat_link,W,K,B,U]),q=l(function(){var e=null==F?void 0:F.redirect_chat_link;e&&(window.open(e,"_blank","noopener,noreferrer"),W(x.CHATBOT_BUTTON_CLICKED)),H()},[null==F?void 0:F.redirect_chat_link,W,H]),Z=a(function(){var e,t,n,i,o;return{config:F,toggleIframe:J,isIframeVisible:B,onEvent:D,onInternalEvent:G,position:R,sideSpacing:O,bottomSpacing:k,launcher_type:I,launcher_properties_text:C,shouldFadeIn:!0===(null===(e=null==F?void 0:F.launcher_delay)||void 0===e?void 0:e.enabled)&&(null!==(o=null!==(n=null===(t=null==F?void 0:F.launcher_delay)||void 0===t?void 0:t.seconds)&&void 0!==n?n:null===(i=null==F?void 0:F.launcher_delay)||void 0===i?void 0:i.delay)&&void 0!==o?o:0)>0||!1,launcher_size:A}},[F,J,B,D,G,R,O,k,I,C,A]);return S.log("floatingButtonProps",Z),u&&!M&&F?e.createElement(Rt,{componentName:"RobylonChatbot"},z?e.createElement(Pt,{config:F,position:R,sideSpacing:O,bottomSpacing:k},K&&B?e.createElement(Rt,{componentName:"ChatWidgetPopup"},e.createElement(nt,{config:F,onCtaClick:q})):null,e.createElement(Rt,{componentName:"ChatbotFloatingButton"},V?e.createElement(tt,b({},Z)):null)):null):null}),Gt=t(Wt,function(e,t){return e.api_key===t.api_key&&e.user_id===t.user_id&&e.user_token===t.user_token&&JSON.stringify(e.user_profile)===JSON.stringify(t.user_profile)&&e.position===t.position&&e.sideSpacing===t.sideSpacing&&e.bottomSpacing===t.bottomSpacing&&e.show_launcher===t.show_launcher&&e.launcher_type===t.launcher_type&&e.launcher_properties_text===t.launcher_properties_text&&JSON.stringify(e.overrides)===JSON.stringify(t.overrides)&&e.launcher_size===t.launcher_size&&!0}),Xt=function(e){var t=i({isLoading:!0,isInitialized:!1,error:null}),n=t[0],r=t[1],a=function(e){r(function(t){return b(b({},t),{isInitialized:e})})},l=function(e){r(function(t){return b(b({},t),{error:e})})};return o(function(){!function(){try{Ft(e,a,l)}catch(e){r(function(t){return b(b({},t),{error:e instanceof Error?e.message:"Failed to initialize SDK",isLoading:!1})})}}()},[e.chatbotId,e.userId]),n},Vt="https://cdn.robylon.ai/logos/WhatsApp.svg",Yt=function(){function e(e){var t=this;this.resizeObserver=null,this.proactiveElement=null,this.urlUnsubscribe=null,this.delayTimers=[],this.config=e,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(){t.buttonElement.style.opacity="1"})}catch(e){}this.setupResizeListener(),this.renderProactiveIfNeeded(),this.urlUnsubscribe=F(function(){t.clearProactiveDelays(),t.renderProactiveIfNeeded(!0)})}return e.prototype.render=function(){var e,t,n=this,i=this.config,o=i.config,r=i.isIframeVisible,a=null!==(e=null==o?void 0:o.launcher_size_multiplier)&&void 0!==e?e:1,l=null!==(t=this.config.launcher_size)&&void 0!==t?t:48*a,s={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:A};o.launcher_type===f.IMAGE&&Object.assign(s,{width:"".concat(l,"px"),height:"".concat(l,"px"),borderRadius:"50%",backgroundColor:o.brand_colour}),this.applyResponsiveStyles(s),this.buttonElement.className="message-bubble-container",this.buttonElement.innerHTML="",this.buttonElement.appendChild(this.createLauncherElement()),this.buttonElement.onclick=function(){n.config.toggleIframe(),n.hideProactiveMessages()},this.renderProactiveIfNeeded()},e.prototype.createLauncherElement=function(){var e,t,n,i,o,r,a=this.config,l=a.config,s=a.isIframeVisible,c=null!==(e=null==l?void 0:l.launcher_size_multiplier)&&void 0!==e?e:1,d=null!==(t=this.config.launcher_size)&&void 0!==t?t:48*c,u="".concat(Math.max(4,Math.round(4*c)),"px"),p=(null==l?void 0:l.launcher_type)?(null===(o=null===(i=null===(n=null==l?void 0:l.images)||void 0===n?void 0:n.launcher_image_url)||void 0===i?void 0:i.url)||void 0===o?void 0:o.trim())||Vt:(null===(r=null==l?void 0:l.image_url)||void 0===r?void 0:r.trim())||Vt,m=p===Vt;switch(console.log("config in floating button",l),l.launcher_type){case f.TEXT:return this.createTextLauncher();case f.TEXTUAL_IMAGE:return this.createTextualImageLauncher();case f.IMAGE:default:if(s){var h=Math.round(.5*d),g=document.createElement("div");Object.assign(g.style,{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%"});var v=document.createElementNS("http://www.w3.org/2000/svg","svg");v.setAttribute("width",String(h)),v.setAttribute("height",String(h)),v.setAttribute("viewBox","0 0 24 24"),v.setAttribute("fill","none"),v.setAttribute("xmlns","http://www.w3.org/2000/svg"),v.style.display="block";var y=document.createElementNS("http://www.w3.org/2000/svg","path");return y.setAttribute("d","M19 9L12 16L5 9"),y.setAttribute("stroke","currentColor"),y.setAttribute("stroke-width","1.5"),y.setAttribute("stroke-linecap","round"),y.setAttribute("stroke-linejoin","round"),v.appendChild(y),g.appendChild(v),g}var b=document.createElement("img");return b.src=p,b.alt="Chat",Object.assign(b.style,{zIndex:"1000",cursor:"pointer",borderRadius:m?"0":"50%",objectFit:m?"contain":"cover",padding:m?u:"0",width:m?"calc(100% - 3px)":"100%",height:m?"calc(100% - 3px)":"100%",margin:m?"4px":"0",boxSizing:"border-box"}),b}},e.prototype.createTextLauncher=function(){var e=this.config.config,t=e.brand_colour,n=e.launcher_properties,i=e.launcher_size_multiplier,o=null!=i?i:1,r=void 0!==this.config.launcher_size?void 0:160*o,a=void 0!==this.config.launcher_size?void 0:40*o,l=void 0!==this.config.launcher_size?void 0:14*o,s=void 0!==this.config.launcher_size?void 0:21*o,c=document.createElement("div");Object.assign(c.style,{width:void 0!==r?"".concat(r,"px"):"fit-content",maxWidth:void 0!==r?"".concat(r,"px"):"160px",height:void 0!==a?"".concat(a,"px"):"40px",borderRadius:"9999px",backgroundColor:t,display:"flex",alignItems:"center",padding:"9px 20px",boxShadow:"0px 0px 16px 0px rgba(0, 0, 0, 0.24)",boxSizing:"border-box"});var d=document.createElement("div");Object.assign(d.style,{flex:"1",minWidth:"0"});var u=document.createElement("p");return Object.assign(u.style,{margin:"0",color:I(t),fontSize:void 0!==l?"".concat(l,"px"):"0.875rem",fontWeight:"600",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:void 0!==s?"".concat(s,"px"):k,fontFamily:A,textAlign:"center",WebkitFontSmoothing:"antialiased",textRendering:"optimizeLegibility",textSizeAdjust:"100%"}),u.textContent=(null==n?void 0:n.text)||"",d.appendChild(u),c.appendChild(d),c},e.prototype.createTextualImageLauncher=function(){var e,t,n,i,o,r,a,l=this.config.config,s=l.brand_colour,c=l.launcher_properties,d=l.image_url,u=l.launcher_size_multiplier,p=(null===(t=null===(e=null==this?void 0:this.config)||void 0===e?void 0:e.config)||void 0===t?void 0:t.launcher_type)?(null===(a=null===(r=null===(o=null===(i=null===(n=null==this?void 0:this.config)||void 0===n?void 0:n.config)||void 0===i?void 0:i.images)||void 0===o?void 0:o.launcher_image_url)||void 0===r?void 0:r.url)||void 0===a?void 0:a.trim())||Vt:(null==d?void 0:d.trim())||Vt,f=p===Vt,m=null!=u?u:1,h="".concat(Math.max(4,Math.round(4*m)),"px"),g=void 0!==this.config.launcher_size?void 0:174*m,v=void 0!==this.config.launcher_size?void 0:40*m,y=void 0!==this.config.launcher_size?void 0:40*m,b=void 0!==this.config.launcher_size?void 0:14*m,_=void 0!==this.config.launcher_size?void 0:21*m,w=document.createElement("div");Object.assign(w.style,{maxWidth:void 0!==g?"".concat(g,"px"):"13rem",width:"fit-content",height:void 0!==v?"".concat(v,"px"):"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 E=document.createElement("div");Object.assign(E.style,{flex:"1",minWidth:"0"});var x=document.createElement("p");Object.assign(x.style,{margin:"0",color:I(s),fontSize:void 0!==b?"".concat(b,"px"):"0.875rem",fontWeight:"600",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:void 0!==_?"".concat(_,"px"):k,fontFamily:A,textAlign:"right",WebkitFontSmoothing:"antialiased",textRendering:"optimizeLegibility",textSizeAdjust:"100%"}),x.textContent=(null==c?void 0:c.text)||"";var T=document.createElement("div");Object.assign(T.style,{width:void 0!==y?"".concat(y,"px"):"40px",height:void 0!==y?"".concat(y,"px"):"40px",borderRadius:"9999px",overflow:"hidden",position:"relative",flexShrink:"0"});var C=document.createElement("img");return C.src=p,C.alt="Chat",Object.assign(C.style,{width:f?"calc(100% - 6px)":"100%",height:f?"calc(100% - 6px)":"100%",margin:f?"3px":"0",borderRadius:f?"0":"50%",objectFit:f?"contain":"cover",padding:f?h:"0",boxSizing:"border-box"}),E.appendChild(x),T.appendChild(C),w.appendChild(E),w.appendChild(T),w},e.prototype.applyResponsiveStyles=function(e){var t,n,i,o,r,a,l,s,c,d=(null===window||void 0===window?void 0:window.innerWidth)<560,u=this.config.config,p=this.config.position||(null===(i=u.interface_properties)||void 0===i?void 0:i.position)||"Right",f=null!==(a=null!==(o=this.config.sideSpacing)&&void 0!==o?o:null===(r=u.interface_properties)||void 0===r?void 0:r.side_spacing)&&void 0!==a?a:20,m=null!==(c=null!==(l=this.config.bottomSpacing)&&void 0!==l?l:null===(s=u.interface_properties)||void 0===s?void 0:s.bottom_spacing)&&void 0!==c?c:20;this.buttonElement.style.position="",this.buttonElement.style.bottom="",this.buttonElement.style.right="",this.buttonElement.style.left="";var h=b(b({},e),d?((t={position:"fixed",bottom:"".concat(m,"px")})[p.toLowerCase()]="".concat(f,"px"),t):((n={bottom:"".concat(m,"px")})[p.toLowerCase()]="".concat(f,"px"),n));Object.assign(this.buttonElement.style,h)},e.prototype.handleResize=function(){var e,t,n,i=null!==(t=null===(e=this.config.config)||void 0===e?void 0:e.launcher_size_multiplier)&&void 0!==t?t:1,o=null!==(n=this.config.launcher_size)&&void 0!==n?n:48*i,r={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!==f.IMAGE?"9999px":"50%",boxSizing:"border-box"};this.config.config.launcher_type===f.IMAGE&&Object.assign(r,{width:"".concat(o,"px"),height:"".concat(o,"px"),borderRadius:"50%",backgroundColor:this.config.config.brand_colour}),this.applyResponsiveStyles(r)},e.prototype.setupResizeListener=function(){"undefined"!=typeof ResizeObserver?(this.resizeObserver=new ResizeObserver(this.handleResizeFunction),this.resizeObserver.observe(document.body)):window.addEventListener("resize",this.handleResizeFunction)},e.prototype.getElement=function(){return this.buttonElement},e.prototype.mount=function(){var e=this;requestAnimationFrame(function(){var t,n;null===(n=(t=e.config).onEvent)||void 0===n||n.call(t,{type:x.CHATBOT_BUTTON_LOADED,timestamp:Date.now()}),e.config.onInternalEvent(x.CHATBOT_BUTTON_LOADED)})},e.prototype.update=function(e){this.config.isIframeVisible,this.config=b(b({},this.config),e),this.buttonElement.style.transform=this.config.isIframeVisible?"scale(0.85)":"scale(1)",this.render(),this.renderProactiveIfNeeded()},e.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)},e.prototype.clearProactiveDelays=function(){this.delayTimers.forEach(function(e){return clearTimeout(e)}),this.delayTimers=[]},e.prototype.hideProactiveMessages=function(){var e,t,n=this;j();var i=null===(e=this.proactiveElement)||void 0===e?void 0:e.children[0];if(i){var o="Right"===(this.config.position||(null===(t=this.config.config.interface_properties)||void 0===t?void 0:t.position)||"Right");Array.from(i.children).forEach(function(e){e.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()},e.prototype.injectAnimationStyles=function(){if(!document.getElementById("rblyn-proactive-animations")){var e=document.createElement("style");e.id="rblyn-proactive-animations",e.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(A,' !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(e)}},e.prototype.renderProactiveIfNeeded=function(e){var t,n,i,o,r,a,l,s,c,d,u,p,m,h,g,v=this,b=null===(n=null===(t=this.config)||void 0===t?void 0:t.config)||void 0===n?void 0:n.proactive_message_obj;if(Array.isArray(b)&&!this.config.isIframeVisible&&!P()){if(this.injectAnimationStyles(),!this.proactiveElement){var _=document.createElement("div");_.style.position="fixed";var w=null!==(a=null!==(o=this.config.bottomSpacing)&&void 0!==o?o:null===(r=this.config.config.interface_properties)||void 0===r?void 0:r.bottom_spacing)&&void 0!==a?a:20,x=null!==(c=null!==(l=this.config.sideSpacing)&&void 0!==l?l:null===(s=this.config.config.interface_properties)||void 0===s?void 0:s.side_spacing)&&void 0!==c?c:20,T=this.config.position||(null===(d=this.config.config.interface_properties)||void 0===d?void 0:d.position)||"Right",C=null!==(p=null===(u=this.config.config)||void 0===u?void 0:u.launcher_size_multiplier)&&void 0!==p?p:1,S=null!==(m=this.config.launcher_size)&&void 0!==m?m:48*C,O=this.config.config.launcher_type===f.IMAGE?S:void 0!==this.config.launcher_size?40:40*C;_.style.bottom="".concat(w+O+8,"px"),"Right"===T?_.style.right="".concat(x,"px"):_.style.left="".concat(x,"px"),_.style.maxWidth="22.875rem",_.style.zIndex="2147483646";var R=document.createElement("div");R.style.display="flex",R.style.flexDirection="column",R.style.alignItems="Right"===T?"flex-end":"flex-start";var N=document.createElement("div");N.style.position="absolute",N.style.top="-32px",N.style.width="24px",N.style.height="24px",N.style.borderRadius="50%",N.style.background="#fff",N.style.boxShadow="0 2.667px 2.667px 0 rgba(0, 0, 0, 0.25)",N.style.display="flex",N.style.alignItems="center",N.style.justifyContent="center",N.style.cursor="pointer",N.style.opacity="0",N.style.visibility="hidden","Right"===(this.config.position||(null===(h=this.config.config.interface_properties)||void 0===h?void 0:h.position)||"Right")?(N.style.right="0px",N.style.left="auto",N.style.transform="translateX(120%) scale(0.95)"):(N.style.left="0px",N.style.right="auto",N.style.transform="translateX(-120%) scale(0.95)"),N.onclick=function(e){e.stopPropagation(),v.hideProactiveMessages()},N.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 ',_.appendChild(R),_.appendChild(N),document.body.appendChild(_),this.proactiveElement=_}var D=this.proactiveElement.children[0];D.innerHTML="";var L="Right"===(this.config.position||(null===(g=this.config.config.interface_properties)||void 0===g?void 0:g.position)||"Right");D.style.display="flex",D.style.flexDirection="column",D.style.alignItems=L?"flex-end":"flex-start",this.clearProactiveDelays();var z=V(b);E([],z,!0).sort(function(e,t){return e.delayMs!==t.delayMs?e.delayMs-t.delayMs:e.contentIndex-t.contentIndex});var M=new Map;z.forEach(function(e){var t=M.get(e.delayMs);t||(t={messageIds:[],groups:new Map},M.set(e.delayMs,t)),t.groups.has(e.messageId)||(t.messageIds.push(e.messageId),t.groups.set(e.messageId,[])),t.groups.get(e.messageId).push(e)});var F=void 0!==M.get(0),B=this.proactiveElement.children[1];if(B&&z.length>0){B.style.opacity="0",B.style.visibility="hidden",B.style.transform=L?"translateX(120%) scale(0.95)":"translateX(-120%) scale(0.95)";var U=function(){if(B){B.style.visibility="visible";var e=D.children.length,t=e>0?10*(e-1):0;B.style.animationDelay="".concat(t,"ms"),B.className=L?"rblyn-proactive-close-enter-right":"rblyn-proactive-close-enter-left"}};if(F){var H=window.setTimeout(U,0);this.delayTimers.push(H)}else{var j=Math.min.apply(Math,Array.from(M.keys()));H=window.setTimeout(U,j);this.delayTimers.push(H)}}else B&&(B.style.opacity="0",B.style.visibility="hidden");var G=0;M.forEach(function(e,t){var n=e.messageIds,i=e.groups,o=window.setTimeout(function(){var e=D.children.length,o=0,r=[];n.forEach(function(e){var t=i.get(e)||[];E([],t,!0).sort(function(e,t){return e.contentIndex-t.contentIndex}).forEach(function(t){r.push({messageId:e,item:t})}),o+=t.length});var a=t>0?E([],r,!0).reverse():r;a.forEach(function(n,i){var r,l=n.item,s=document.createElement("div"),c=l.messageDisplayType===y.BUTTON;s.style.background=(null==l?void 0:l.messageBubbleBg)||"#ffffff",s.style.color="#111",s.style.borderRadius=c?"100px":"12px",s.style.boxShadow="0 2px 2px 0 rgba(0, 0, 0, 0.08)",s.style.padding="16px",s.style.border="1px solid #F1F2F4",s.style.cursor="pointer",s.style.fontFamily=A,s.style.fontSize="14px",s.style.lineHeight=String(k),s.style.width="fit-content",s.style.maxWidth="100%";var d=0===i,u=i===a.length-1,p=e>0,f=M.has(0),m=!1;0===t?m=!u||d&&p:d&&(p||f)?m=!0:d||(m=!0),m&&(s.style.marginBottom="16px");var h=10*(e+o-1-(0===t?e+G:G));s.className=L?"rblyn-proactive-enter-right":"rblyn-proactive-enter-left",s.style.animationDelay="".concat(h,"ms"),s.style.opacity="0",s.style.transform=L?"translateX(120%) scale(0.95)":"translateX(-120%) scale(0.95)";var g=document.createElement("div");Object.assign(g.style,{display:"flex",alignItems:"center",gap:"8px"});var b=document.createElement("div");if(b.className="rblyn-proactive-message-content",b.setAttribute("dir",$e(l.html)),b.innerHTML=Qe(l.html),g.appendChild(b),(null==l?void 0:l.urlToGo)&&"string"==typeof l.urlToGo&&""!==l.urlToGo.trim()){var _=document.createElementNS("http://www.w3.org/2000/svg","svg");_.setAttribute("width","16"),_.setAttribute("height","17"),_.setAttribute("viewBox","0 0 16 17"),_.setAttribute("fill","none"),_.setAttribute("xmlns","http://www.w3.org/2000/svg"),Object.assign(_.style,{flexShrink:"0",color:I((null==l?void 0:l.messageBubbleBg)||"#ffffff")});var w=document.createElementNS("http://www.w3.org/2000/svg","g");w.setAttribute("id","External_Link");var E=document.createElementNS("http://www.w3.org/2000/svg","path");E.setAttribute("id","Vector"),E.setAttribute("d","M6.6668 3.83268H5.4668C4.72006 3.83268 4.34642 3.83268 4.0612 3.97801C3.81032 4.10584 3.60649 4.30966 3.47866 4.56055C3.33334 4.84576 3.33334 5.21941 3.33334 5.96615V11.0328C3.33334 11.7795 3.33334 12.1527 3.47866 12.4379C3.60649 12.6888 3.81032 12.893 4.0612 13.0208C4.34614 13.166 4.71933 13.166 5.46461 13.166H10.5354C11.2807 13.166 11.6533 13.166 11.9383 13.0208C12.1891 12.893 12.3937 12.6886 12.5215 12.4377C12.6667 12.1528 12.6667 11.78 12.6667 11.0347V9.83268M13.3333 6.49935V3.16602M13.3333 3.16602H10M13.3333 3.16602L8.66667 7.83268"),E.setAttribute("stroke","currentColor"),E.setAttribute("stroke-width","1.5"),E.setAttribute("stroke-linecap","round"),E.setAttribute("stroke-linejoin","round"),w.appendChild(E),_.appendChild(w),g.appendChild(_)}if(s.appendChild(g),s.onclick=function(){if((null==l?void 0:l.urlToGo)&&"string"==typeof l.urlToGo&&""!==l.urlToGo.trim())window.open(l.urlToGo,"_blank","noopener,noreferrer");else{W({message_id:l.messageId,content_string:l.html||null,content_id:l.contentId||null}),v.config.toggleIframe(),v.hideProactiveMessages();try{window.dispatchEvent(new CustomEvent("rblyn:proactiveClick",{detail:{message_id:l.messageId,content_string:l.html||null,content_id:l.contentId||null}}))}catch(e){}}},0===t)D.appendChild(s);else{D.insertBefore(s,D.firstChild);var x=null===(r=v.proactiveElement)||void 0===r?void 0:r.children[1];if(x&&"visible"===x.style.visibility){var T=D.children.length,C=T>0?10*(T-1):0;x.style.animationDelay="".concat(C,"ms")}}G++})},t);v.delayTimers.push(o)})}else if(this.proactiveElement&&this.proactiveElement.parentElement){var X=this.proactiveElement.children[0],Y="Right"===(this.config.position||(null===(i=this.config.config.interface_properties)||void 0===i?void 0:i.position)||"Right");Array.from(X.children).forEach(function(e){e.className=Y?"rblyn-proactive-exit-right":"rblyn-proactive-exit-left"}),setTimeout(function(){v.proactiveElement&&v.proactiveElement.parentElement&&v.proactiveElement.parentElement.removeChild(v.proactiveElement),v.proactiveElement=null,v.clearProactiveDelays()},400)}else this.proactiveElement=null,this.clearProactiveDelays()},e}(),Kt=function(){function e(e,t,n,i){this.resizeObserver=null,this.containerElement=document.createElement("div"),this.handleResizeFunction=this.handleResize.bind(this),this.config={config:e,position:t,sideSpacing:n,bottomSpacing:i},this.render(),this.mount(),this.setupResizeListener()}return e.prototype.render=function(){this.applyStyles(),this.containerElement.className="robylon-chatbot-container"},e.prototype.applyStyles=function(){var e,t,n,i,o,r,a,l,s,c=(null===window||void 0===window?void 0:window.innerWidth)<560,d=this.config.position||(null===(n=this.config.config.interface_properties)||void 0===n?void 0:n.position)||"Right",u=null!==(r=null!==(i=this.config.sideSpacing)&&void 0!==i?i:null===(o=this.config.config.interface_properties)||void 0===o?void 0:o.side_spacing)&&void 0!==r?r:20,p=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 f={position:"fixed",zIndex:"1000",display:"flex",flexDirection:"column"},m=b(b({},f),((e={bottom:"".concat(p,"px")})[d.toLowerCase()]="".concat(u,"px"),e.alignItems="Right"===d?"flex-end":"flex-start",e)),h=b(b({},f),((t={top:"0"})[d.toLowerCase()]="".concat(u,"px"),t.alignItems="center",t));Object.assign(this.containerElement.style,c?h:m)},e.prototype.handleResize=function(){this.applyStyles()},e.prototype.setupResizeListener=function(){"undefined"!=typeof ResizeObserver?(this.resizeObserver=new ResizeObserver(this.handleResizeFunction),this.resizeObserver.observe(document.body)):window.addEventListener("resize",this.handleResizeFunction)},e.prototype.mount=function(){document.body.appendChild(this.containerElement)},e.prototype.getElement=function(){return this.containerElement},e.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)},e}(),Jt=function(){function e(e){this.config=e,this.popupElement=document.createElement("div"),this.render()}return e.prototype.createTitleBar=function(){var e,t,n,i,o,r,a=(null===(t=null===(e=this.config)||void 0===e?void 0:e.config)||void 0===t?void 0:t.title_bar_color)||"#075E54",l=I(a),s=function(e){var t,n;if(null==e?void 0:e.startsWith("#")){var i=e.replace("#",""),o=3===(null==i?void 0:i.length)?null===(n=null===(t=null==i?void 0:i.split(""))||void 0===t?void 0:t.map(function(e){return"".concat(e).concat(e)}))||void 0===n?void 0:n.join(""):i;if(6===(null==o?void 0:o.length)){var r=parseInt(null==o?void 0:o.slice(0,2),16),a=parseInt(null==o?void 0:o.slice(2,4),16),l=parseInt(null==o?void 0:o.slice(4,6),16);return"rgba(".concat(r,", ").concat(a,", ").concat(l,", 0.8)")}}return"#FFFFFF"===e?"rgba(255, 255, 255, 0.8)":"rgba(14, 14, 15, 0.8)"}(l),c=document.createElement("div");Object.assign(c.style,{backgroundColor:a,padding:"16px 18px 14px"});var d=document.createElement("div");d.textContent=(null===(i=null===(n=this.config)||void 0===n?void 0:n.config)||void 0===i?void 0:i.widget_title)||"Hi there",Object.assign(d.style,{color:l,fontSize:"16px",fontWeight:"600",lineHeight:"1.2"});var u=document.createElement("div");return u.textContent=(null===(r=null===(o=this.config)||void 0===o?void 0:o.config)||void 0===r?void 0:r.widget_subtitle)||"We typically reply in minutes",Object.assign(u.style,{color:s,fontSize:"12px",marginTop:"4px"}),c.appendChild(d),c.appendChild(u),c},e.prototype.createContent=function(){var e,t,n,i,o,r,a,l,s=document.createElement("div");Object.assign(s.style,{padding:"20px 16px 16px"});var c=document.createElement("button");Object.assign(c.style,{width:"100%",border:"none",borderRadius:"14px",backgroundColor:(null===(t=null===(e=this.config)||void 0===e?void 0:e.config)||void 0===t?void 0:t.brand_colour)||"#25D366",color:I((null===(i=null===(n=this.config)||void 0===n?void 0:n.config)||void 0===i?void 0:i.brand_colour)||"#25D366"),fontSize:"14px",fontWeight:"600",padding:"10px 16px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",letterSpacing:"0.01em"});var d=document.createElement("img");d.src="https://cdn.robylon.ai/logos/WhatsApp.svg",d.alt="WhatsApp",Object.assign(d.style,{width:"20px",height:"20px",objectFit:"contain"});var u=document.createElement("span");if(u.textContent=(null===(r=null===(o=this.config)||void 0===o?void 0:o.config)||void 0===r?void 0:r.button_content)||"Chat on WhatsApp",c.appendChild(d),c.appendChild(u),c.onclick=this.config.onCtaClick,s.appendChild(c),null===(l=null===(a=this.config)||void 0===a?void 0:a.config)||void 0===l?void 0:l.powered_by_robylon){var p=document.createElement("div");Object.assign(p.style,{textAlign:"center",color:"rgba(14, 14, 15, 0.4)",fontSize:"10px",marginTop:"10px"}),p.appendChild(document.createTextNode("Powered by "));var f=document.createElement("a");f.href="https://www.robylon.ai",f.target="_blank",f.rel="noopener noreferrer",f.textContent="Robylon",Object.assign(f.style,{color:"inherit",textDecoration:"none"}),f.addEventListener("mouseenter",function(){f.style.textDecoration="underline",f.style.color="rgba(14, 14, 15, 0.8)"}),f.addEventListener("mouseleave",function(){f.style.textDecoration="none",f.style.color="inherit"}),p.appendChild(f),s.appendChild(p)}return s},e.prototype.render=function(){this.popupElement.innerHTML="",this.popupElement.className="rblyn-chat-widget-popup",Object.assign(this.popupElement.style,{width:"19rem",maxWidth:"calc(100vw - 19rem)",borderRadius:"22px",overflow:"hidden",backgroundColor:"#fff",boxShadow:"0 16px 40px rgba(14, 14, 15, 0.2)",marginBottom:"14px"});var e=document.createElement("style");e.textContent="\n .rblyn-chat-widget-popup,\n .rblyn-chat-widget-popup * {\n font-family: ".concat(O," !important;\n }\n "),this.popupElement.appendChild(e),this.popupElement.appendChild(this.createTitleBar()),this.popupElement.appendChild(this.createContent())},e.prototype.getElement=function(){return this.popupElement},e.prototype.update=function(e){this.config=e,this.render()},e.prototype.destroy=function(){var e;(null===(e=this.popupElement)||void 0===e?void 0:e.parentNode)&&this.popupElement.parentNode.removeChild(this.popupElement)},e}(),qt=function(e){e.api_key,e.user_profile;var t=e.onEvent;e.chatbotConfig;return{emit:function(e,n){var i={type:e,timestamp:Date.now(),data:n};null==t||t(i)},onInternalEvent:function(e,t){}}},Zt=function(){function e(e){var t=this;this.container=null,this.floatingButton=null,this.launcherDelayTimeout=null,this.popup=null,this.isDestroyed=!1,this.handleStateChange=function(e){var n,i,o,r,a,l,s,c;if(!t.isDestroyed){var d=e.isInitialized,u=e.error,p=e.chatbotConfig,f=e.isIframeVisible,m="chat_widget"===(null==p?void 0:p.widget_type);if(!u&&p&&d){t.eventEmitter=qt({api_key:t.config.api_key,user_profile:t.config.user_profile,onEvent:t.config.onEvent,chatbotConfig:{isAnonymous:p.isAnonymous,userId:p.userId}}),t.container||(t.container=new Kt(p,t.config.position,t.config.sideSpacing,t.config.bottomSpacing)),m&&f?t.popup?t.popup.update({config:p,onCtaClick:t.handlePopupCta}):(t.popup=new Jt({config:p,onCtaClick:t.handlePopupCta}),null===(i=null===(n=t.container)||void 0===n?void 0:n.getElement())||void 0===i||i.prepend(t.popup.getElement())):t.popup&&(t.popup.destroy(),t.popup=null);var h=void 0!==t.config.show_launcher?Boolean(t.config.show_launcher):null===(o=null==p?void 0:p.show_launcher)||void 0===o||o,g=!0===(null===(r=null==p?void 0:p.launcher_delay)||void 0===r?void 0:r.enabled),v=null!==(c=null!==(l=null===(a=null==p?void 0:p.launcher_delay)||void 0===a?void 0:a.seconds)&&void 0!==l?l:null===(s=null==p?void 0:p.launcher_delay)||void 0===s?void 0:s.delay)&&void 0!==c?c:0,y=function(){if(t.floatingButton)t.floatingButton.update({config:p,isIframeVisible:f,position:t.config.position,sideSpacing:t.config.sideSpacing,bottomSpacing:t.config.bottomSpacing,launcher_size:t.config.launcher_size});else if(t.floatingButton=new Yt({config:p,toggleIframe:t.toggleIframe,isIframeVisible:f,onEvent:t.config.onEvent,onInternalEvent:t.eventEmitter.onInternalEvent,position:t.config.position,sideSpacing:t.config.sideSpacing,bottomSpacing:t.config.bottomSpacing,launcher_size:t.config.launcher_size}),t.floatingButton.getElement&&"function"==typeof t.floatingButton.getElement){var e=t.floatingButton.getElement();e&&t.container&&t.container.getElement().appendChild(e)}};t.launcherDelayTimeout&&(clearTimeout(t.launcherDelayTimeout),t.launcherDelayTimeout=null),h?g&&Number(v)>0&&!t.floatingButton?t.launcherDelayTimeout=window.setTimeout(function(){y(),t.launcherDelayTimeout=null},1e3*Number(v)):y():t.floatingButton&&(t.floatingButton.destroy(),t.floatingButton=null)}}},this.toggleIframe=function(){var e,n,i=t.stateManager.getState(),o=null===(e=null==i?void 0:i.chatbotConfig)||void 0===e?void 0:e.redirect_chat_link;"chat_widget"===(null===(n=null==i?void 0:i.chatbotConfig)||void 0===n?void 0:n.widget_type)?(t.stateManager.toggleIframeVisibility(),t.eventEmitter.emit(i.isIframeVisible?x.CHATBOT_CLOSED:x.CHATBOT_BUTTON_CLICKED)):o&&(window.open(o,"_blank","noopener,noreferrer"),t.eventEmitter.emit(x.CHATBOT_BUTTON_CLICKED))},this.handlePopupCta=function(){var e,n=t.stateManager.getState(),i=null===(e=null==n?void 0:n.chatbotConfig)||void 0===e?void 0:e.redirect_chat_link;i&&(window.open(i,"_blank","noopener,noreferrer"),t.eventEmitter.emit(x.CHATBOT_BUTTON_CLICKED)),t.stateManager.closeIframe()};var n=b(b({},e),{position:"string"==typeof e.position?"left"===e.position.toLowerCase()?"Left":"right"===e.position.toLowerCase()?"Right":void 0:void 0,sideSpacing:"string"==typeof e.sideSpacing?""===e.sideSpacing||isNaN(Number(e.sideSpacing))?void 0:Number(e.sideSpacing):e.sideSpacing,bottomSpacing:"string"==typeof e.bottomSpacing?""===e.bottomSpacing||isNaN(Number(e.bottomSpacing))?void 0:Number(e.bottomSpacing):e.bottomSpacing,show_launcher:e.show_launcher,overrides:e.overrides,launcher_size:e.launcher_size});if(this.config=n,!e.api_key)throw ht.trackError(new Error(kt[gt](e.api_key)),"RobylonChatbot",{errorCode:gt,errorType:St,context:{timestamp:Date.now()}}),new Error("API key is required");try{ht.initialize(e.api_key,e.user_id)}catch(e){ht.trackError(e instanceof Error?e:new Error(String(e)),"RobylonChatbot",{errorCode:_t,errorType:St,context:{timestamp:Date.now()}})}this.stateManager=function(e){var t={isInitialized:!1,isInitializing:!1,error:null,chatbotConfig:null,isIframeVisible:!1},n=[],i=function(e){t=b(b({},t),e),n.forEach(function(e){return e(t)})};return{getState:function(){return t},initialize:function(){return _(void 0,void 0,void 0,function(){var t,n,o;return w(this,function(r){switch(r.label){case 0:if(!e.api_key)return ht.trackError(new Error(kt[gt](e.api_key)),"ChatbotStateManager",{errorCode:gt,errorType:St,context:{timestamp:Date.now()}}),[2];i({isInitializing:!0}),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,Ht(e)];case 2:return t=r.sent(),[4,new Promise(function(e,n){Ft(t,function(){i({isInitialized:!0,chatbotConfig:t}),e()},function(e){n(e)})})];case 3:return r.sent(),[3,6];case 4:return n=r.sent(),o=n instanceof Error?n.message:"Failed to initialize chatbot",i({error:o}),ht.trackError(n instanceof Error?n:new Error(o),"ChatbotStateManager",{errorCode:bt,errorType:St,context:{timestamp:Date.now()}}),[3,6];case 5:return i({isInitializing:!1}),[7];case 6:return[2]}})})},toggleIframeVisibility:function(){i({isIframeVisible:!t.isIframeVisible})},closeIframe:function(){i({isIframeVisible:!1})},updateState:i,subscribe:function(e){return n.push(e),function(){var t=n.indexOf(e);t>-1&&n.splice(t,1)}},unsubscribe:function(e){var t=n.indexOf(e);t>-1&&n.splice(t,1)}}}({api_key:e.api_key,user_id:e.user_id,user_token:e.user_token,user_profile:e.user_profile}),this.eventEmitter=qt({api_key:e.api_key,user_profile:e.user_profile,onEvent:e.onEvent,chatbotConfig:null}),this.initialize()}return e.prototype.initialize=function(){return _(this,void 0,void 0,function(){var e;return w(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.stateManager.initialize()];case 1:return t.sent(),this.stateManager.subscribe(this.handleStateChange),this.handleStateChange(this.stateManager.getState()),[3,3];case 2:return e=t.sent(),ht.trackError(e instanceof Error?e:new Error(String(e)),"RobylonChatbot.initialize",{errorCode:bt,errorType:St,context:{timestamp:Date.now()}}),[3,3];case 3:return[2]}})})},e.prototype.show=function(){var e,t,n=this.stateManager.getState();if("chat_widget"===(null===(e=null==n?void 0:n.chatbotConfig)||void 0===e?void 0:e.widget_type))n.isIframeVisible||(this.stateManager.toggleIframeVisibility(),this.eventEmitter.emit(x.CHATBOT_BUTTON_CLICKED));else{var i=null===(t=null==n?void 0:n.chatbotConfig)||void 0===t?void 0:t.redirect_chat_link;i&&(window.open(i,"_blank","noopener,noreferrer"),this.eventEmitter.emit(x.CHATBOT_BUTTON_CLICKED))}},e.prototype.hide=function(){var e,t=this.stateManager.getState();"chat_widget"===(null===(e=null==t?void 0:t.chatbotConfig)||void 0===e?void 0:e.widget_type)&&t.isIframeVisible&&(this.stateManager.closeIframe(),this.eventEmitter.emit(x.CHATBOT_CLOSED))},e.prototype.toggle=function(){this.toggleIframe()},e.prototype.destroy=function(){this.isDestroyed=!0,this.floatingButton&&(this.floatingButton.destroy(),this.floatingButton=null),this.launcherDelayTimeout&&(clearTimeout(this.launcherDelayTimeout),this.launcherDelayTimeout=null),this.popup&&(this.popup.destroy(),this.popup=null),this.container&&(this.container.destroy(),this.container=null),this.stateManager.unsubscribe(this.handleStateChange)},e.prototype.getState=function(){return this.stateManager.getState().isInitialized?"initialized":"uninitialized"},e}();function Qt(e){return new Zt(e)}if("undefined"!=typeof window){!function(){if("undefined"!=typeof window){var e=window,t=(null==e?void 0:e.RobylonChatbot)||(null==e?void 0:e.R);if(t&&Array.isArray(t.q)){var n=null;t.q.forEach(function(e){var t=e[0];if("init"===t){var i=e[1]||{};n=Qt(i)}else n&&"function"==typeof n[t]&&n[t]()}),e.RobylonChatbot=function(e){var t=Array.prototype.slice.call(arguments,1);return"init"===e?n=Qt(t[0]||{}):n&&"function"==typeof n[e]?n[e].apply(n,t):void 0},(null==e?void 0:e.R)||(e.R=e.RobylonChatbot),e.RobylonChatbot.getState=function(){return"initialized"},(null==e?void 0:e.R)&&(e.R.getState=e.RobylonChatbot.getState)}}}();var $t=window,en=null==$t?void 0:$t.RobylonChatbot;en&&!(null==$t?void 0:$t.R)&&($t.R=en)}var tn={create:Qt,getState:function(){return"initialized"}};export{Gt as Chatbot,u as ChatbotInterfaceType,v as ConditionType,h as DisplayAttributesType,f as LauncherType,g as LogicalConditionType,y as MessageDisplayType,m as ProactiveSendTimeType,tn as RobylonChatbot,p as WidgetPositionEnums,Xt as useChatbot};
3
+ const{entries:Y,setPrototypeOf:K,isFrozen:J,getPrototypeOf:q,getOwnPropertyDescriptor:Z}=Object;let{freeze:Q,seal:$,create:ee}=Object,{apply:te,construct:ne}="undefined"!=typeof Reflect&&Reflect;Q||(Q=function(e){return e}),$||($=function(e){return e}),te||(te=function(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return e.apply(t,i)}),ne||(ne=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return new e(...n)});const ie=ye(Array.prototype.forEach),oe=ye(Array.prototype.lastIndexOf),re=ye(Array.prototype.pop),ae=ye(Array.prototype.push),le=ye(Array.prototype.splice),se=ye(String.prototype.toLowerCase),ce=ye(String.prototype.toString),de=ye(String.prototype.match),ue=ye(String.prototype.replace),pe=ye(String.prototype.indexOf),fe=ye(String.prototype.trim),me=ye(Object.prototype.hasOwnProperty),he=ye(RegExp.prototype.test),ge=(ve=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return ne(ve,t)});var ve;function ye(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return te(e,t,i)}}function be(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:se;K&&K(e,null);let i=t.length;for(;i--;){let o=t[i];if("string"==typeof o){const e=n(o);e!==o&&(J(t)||(t[i]=e),o=e)}e[o]=!0}return e}function _e(e){for(let t=0;t<e.length;t++){me(e,t)||(e[t]=null)}return e}function we(e){const t=ee(null);for(const[n,i]of Y(e)){me(e,n)&&(Array.isArray(i)?t[n]=_e(i):i&&"object"==typeof i&&i.constructor===Object?t[n]=we(i):t[n]=i)}return t}function Ee(e,t){for(;null!==e;){const n=Z(e,t);if(n){if(n.get)return ye(n.get);if("function"==typeof n.value)return ye(n.value)}e=q(e)}return function(){return null}}const xe=Q(["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"]),Te=Q(["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"]),Ie=Q(["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"]),Ce=Q(["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"]),Se=Q(["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"]),Ae=Q(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Oe=Q(["#text"]),ke=Q(["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"]),Re=Q(["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"]),Ne=Q(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),De=Q(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Le=$(/\{\{[\w\W]*|[\w\W]*\}\}/gm),ze=$(/<%[\w\W]*|[\w\W]*%>/gm),Me=$(/\$\{[\w\W]*/gm),Fe=$(/^data-[\-\w.\u00B7-\uFFFF]+$/),Be=$(/^aria-[\-\w]+$/),Ue=$(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),He=$(/^(?:\w+script|data):/i),je=$(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Pe=$(/^html$/i),We=$(/^[a-z][.\w]*(-[.\w]+)+$/i);var Ge=Object.freeze({__proto__:null,ARIA_ATTR:Be,ATTR_WHITESPACE:je,CUSTOM_ELEMENT:We,DATA_ATTR:Fe,DOCTYPE_NAME:Pe,ERB_EXPR:ze,IS_ALLOWED_URI:Ue,IS_SCRIPT_OR_DATA:He,MUSTACHE_EXPR:Le,TMPLIT_EXPR:Me});const Xe=1,Ve=3,Ye=7,Ke=8,Je=9,qe=function(){return"undefined"==typeof window?null:window};var Ze=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:qe();const n=t=>e(t);if(n.version="3.3.3",n.removed=[],!t||!t.document||t.document.nodeType!==Je||!t.Element)return n.isSupported=!1,n;let{document:i}=t;const o=i,r=o.currentScript,{DocumentFragment:a,HTMLTemplateElement:l,Node:s,Element:c,NodeFilter:d,NamedNodeMap:u=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:p,DOMParser:f,trustedTypes:m}=t,h=c.prototype,g=Ee(h,"cloneNode"),v=Ee(h,"remove"),y=Ee(h,"nextSibling"),b=Ee(h,"childNodes"),_=Ee(h,"parentNode");if("function"==typeof l){const e=i.createElement("template");e.content&&e.content.ownerDocument&&(i=e.content.ownerDocument)}let w,E="";const{implementation:x,createNodeIterator:T,createDocumentFragment:I,getElementsByTagName:C}=i,{importNode:S}=o;let A={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof Y&&"function"==typeof _&&x&&void 0!==x.createHTMLDocument;const{MUSTACHE_EXPR:O,ERB_EXPR:k,TMPLIT_EXPR:R,DATA_ATTR:N,ARIA_ATTR:D,IS_SCRIPT_OR_DATA:L,ATTR_WHITESPACE:z,CUSTOM_ELEMENT:M}=Ge;let{IS_ALLOWED_URI:F}=Ge,B=null;const U=be({},[...xe,...Te,...Ie,...Se,...Oe]);let H=null;const j=be({},[...ke,...Re,...Ne,...De]);let P=Object.seal(ee(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}})),W=null,G=null;const X=Object.seal(ee(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let V=!0,K=!0,J=!1,q=!0,Z=!1,$=!0,te=!1,ne=!1,ve=!1,ye=!1,_e=!1,Le=!1,ze=!0,Me=!1,Fe=!0,Be=!1,He={},je=null;const We=be({},["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 Ze=null;const Qe=be({},["audio","video","img","source","image","track"]);let $e=null;const et=be({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),tt="http://www.w3.org/1998/Math/MathML",nt="http://www.w3.org/2000/svg",it="http://www.w3.org/1999/xhtml";let ot=it,rt=!1,at=null;const lt=be({},[tt,nt,it],ce);let st=be({},["mi","mo","mn","ms","mtext"]),ct=be({},["annotation-xml"]);const dt=be({},["title","style","font","a","script"]);let ut=null;const pt=["application/xhtml+xml","text/html"];let ft=null,mt=null;const ht=i.createElement("form"),gt=function(e){return e instanceof RegExp||e instanceof Function},vt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!mt||mt!==e){if(e&&"object"==typeof e||(e={}),e=we(e),ut=-1===pt.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,ft="application/xhtml+xml"===ut?ce:se,B=me(e,"ALLOWED_TAGS")?be({},e.ALLOWED_TAGS,ft):U,H=me(e,"ALLOWED_ATTR")?be({},e.ALLOWED_ATTR,ft):j,at=me(e,"ALLOWED_NAMESPACES")?be({},e.ALLOWED_NAMESPACES,ce):lt,$e=me(e,"ADD_URI_SAFE_ATTR")?be(we(et),e.ADD_URI_SAFE_ATTR,ft):et,Ze=me(e,"ADD_DATA_URI_TAGS")?be(we(Qe),e.ADD_DATA_URI_TAGS,ft):Qe,je=me(e,"FORBID_CONTENTS")?be({},e.FORBID_CONTENTS,ft):We,W=me(e,"FORBID_TAGS")?be({},e.FORBID_TAGS,ft):we({}),G=me(e,"FORBID_ATTR")?be({},e.FORBID_ATTR,ft):we({}),He=!!me(e,"USE_PROFILES")&&e.USE_PROFILES,V=!1!==e.ALLOW_ARIA_ATTR,K=!1!==e.ALLOW_DATA_ATTR,J=e.ALLOW_UNKNOWN_PROTOCOLS||!1,q=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Z=e.SAFE_FOR_TEMPLATES||!1,$=!1!==e.SAFE_FOR_XML,te=e.WHOLE_DOCUMENT||!1,ye=e.RETURN_DOM||!1,_e=e.RETURN_DOM_FRAGMENT||!1,Le=e.RETURN_TRUSTED_TYPE||!1,ve=e.FORCE_BODY||!1,ze=!1!==e.SANITIZE_DOM,Me=e.SANITIZE_NAMED_PROPS||!1,Fe=!1!==e.KEEP_CONTENT,Be=e.IN_PLACE||!1,F=e.ALLOWED_URI_REGEXP||Ue,ot=e.NAMESPACE||it,st=e.MATHML_TEXT_INTEGRATION_POINTS||st,ct=e.HTML_INTEGRATION_POINTS||ct,P=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&gt(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(P.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&gt(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(P.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(P.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Z&&(K=!1),_e&&(ye=!0),He&&(B=be({},Oe),H=ee(null),!0===He.html&&(be(B,xe),be(H,ke)),!0===He.svg&&(be(B,Te),be(H,Re),be(H,De)),!0===He.svgFilters&&(be(B,Ie),be(H,Re),be(H,De)),!0===He.mathMl&&(be(B,Se),be(H,Ne),be(H,De))),me(e,"ADD_TAGS")||(X.tagCheck=null),me(e,"ADD_ATTR")||(X.attributeCheck=null),e.ADD_TAGS&&("function"==typeof e.ADD_TAGS?X.tagCheck=e.ADD_TAGS:(B===U&&(B=we(B)),be(B,e.ADD_TAGS,ft))),e.ADD_ATTR&&("function"==typeof e.ADD_ATTR?X.attributeCheck=e.ADD_ATTR:(H===j&&(H=we(H)),be(H,e.ADD_ATTR,ft))),e.ADD_URI_SAFE_ATTR&&be($e,e.ADD_URI_SAFE_ATTR,ft),e.FORBID_CONTENTS&&(je===We&&(je=we(je)),be(je,e.FORBID_CONTENTS,ft)),e.ADD_FORBID_CONTENTS&&(je===We&&(je=we(je)),be(je,e.ADD_FORBID_CONTENTS,ft)),Fe&&(B["#text"]=!0),te&&be(B,["html","head","body"]),B.table&&(be(B,["tbody"]),delete W.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw ge('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw ge('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');w=e.TRUSTED_TYPES_POLICY,E=w.createHTML("")}else void 0===w&&(w=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(n=t.getAttribute(i));const o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}}(m,r)),null!==w&&"string"==typeof E&&(E=w.createHTML(""));Q&&Q(e),mt=e}},yt=be({},[...Te,...Ie,...Ce]),bt=be({},[...Se,...Ae]),_t=function(e){ae(n.removed,{element:e});try{_(e).removeChild(e)}catch(t){v(e)}},wt=function(e,t){try{ae(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){ae(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(ye||_e)try{_t(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Et=function(e){let t=null,n=null;if(ve)e="<remove></remove>"+e;else{const t=de(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===ut&&ot===it&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const o=w?w.createHTML(e):e;if(ot===it)try{t=(new f).parseFromString(o,ut)}catch(e){}if(!t||!t.documentElement){t=x.createDocument(ot,"template",null);try{t.documentElement.innerHTML=rt?E:o}catch(e){}}const r=t.body||t.documentElement;return e&&n&&r.insertBefore(i.createTextNode(n),r.childNodes[0]||null),ot===it?C.call(t,te?"html":"body")[0]:te?t.documentElement:r},xt=function(e){return T.call(e.ownerDocument||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},Tt=function(e){return e instanceof p&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof u)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},It=function(e){return"function"==typeof s&&e instanceof s};function Ct(e,t,i){ie(e,e=>{e.call(n,t,i,mt)})}const St=function(e){let t=null;if(Ct(A.beforeSanitizeElements,e,null),Tt(e))return _t(e),!0;const i=ft(e.nodeName);if(Ct(A.uponSanitizeElement,e,{tagName:i,allowedTags:B}),$&&e.hasChildNodes()&&!It(e.firstElementChild)&&he(/<[/\w!]/g,e.innerHTML)&&he(/<[/\w!]/g,e.textContent))return _t(e),!0;if(e.nodeType===Ye)return _t(e),!0;if($&&e.nodeType===Ke&&he(/<[/\w]/g,e.data))return _t(e),!0;if(!(X.tagCheck instanceof Function&&X.tagCheck(i))&&(!B[i]||W[i])){if(!W[i]&&Ot(i)){if(P.tagNameCheck instanceof RegExp&&he(P.tagNameCheck,i))return!1;if(P.tagNameCheck instanceof Function&&P.tagNameCheck(i))return!1}if(Fe&&!je[i]){const t=_(e)||e.parentNode,n=b(e)||e.childNodes;if(n&&t){for(let i=n.length-1;i>=0;--i){const o=g(n[i],!0);o.__removalCount=(e.__removalCount||0)+1,t.insertBefore(o,y(e))}}}return _t(e),!0}return e instanceof c&&!function(e){let t=_(e);t&&t.tagName||(t={namespaceURI:ot,tagName:"template"});const n=se(e.tagName),i=se(t.tagName);return!!at[e.namespaceURI]&&(e.namespaceURI===nt?t.namespaceURI===it?"svg"===n:t.namespaceURI===tt?"svg"===n&&("annotation-xml"===i||st[i]):Boolean(yt[n]):e.namespaceURI===tt?t.namespaceURI===it?"math"===n:t.namespaceURI===nt?"math"===n&&ct[i]:Boolean(bt[n]):e.namespaceURI===it?!(t.namespaceURI===nt&&!ct[i])&&!(t.namespaceURI===tt&&!st[i])&&!bt[n]&&(dt[n]||!yt[n]):!("application/xhtml+xml"!==ut||!at[e.namespaceURI]))}(e)?(_t(e),!0):"noscript"!==i&&"noembed"!==i&&"noframes"!==i||!he(/<\/no(script|embed|frames)/i,e.innerHTML)?(Z&&e.nodeType===Ve&&(t=e.textContent,ie([O,k,R],e=>{t=ue(t,e," ")}),e.textContent!==t&&(ae(n.removed,{element:e.cloneNode()}),e.textContent=t)),Ct(A.afterSanitizeElements,e,null),!1):(_t(e),!0)},At=function(e,t,n){if(G[t])return!1;if(ze&&("id"===t||"name"===t)&&(n in i||n in ht))return!1;if(K&&!G[t]&&he(N,t));else if(V&&he(D,t));else if(X.attributeCheck instanceof Function&&X.attributeCheck(t,e));else if(!H[t]||G[t]){if(!(Ot(e)&&(P.tagNameCheck instanceof RegExp&&he(P.tagNameCheck,e)||P.tagNameCheck instanceof Function&&P.tagNameCheck(e))&&(P.attributeNameCheck instanceof RegExp&&he(P.attributeNameCheck,t)||P.attributeNameCheck instanceof Function&&P.attributeNameCheck(t,e))||"is"===t&&P.allowCustomizedBuiltInElements&&(P.tagNameCheck instanceof RegExp&&he(P.tagNameCheck,n)||P.tagNameCheck instanceof Function&&P.tagNameCheck(n))))return!1}else if($e[t]);else if(he(F,ue(n,z,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==pe(n,"data:")||!Ze[e]){if(J&&!he(L,ue(n,z,"")));else if(n)return!1}else;return!0},Ot=function(e){return"annotation-xml"!==e&&de(e,M)},kt=function(e){Ct(A.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||Tt(e))return;const i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:H,forceKeepAttr:void 0};let o=t.length;for(;o--;){const r=t[o],{name:a,namespaceURI:l,value:s}=r,c=ft(a),d=s;let u="value"===a?d:fe(d);if(i.attrName=c,i.attrValue=u,i.keepAttr=!0,i.forceKeepAttr=void 0,Ct(A.uponSanitizeAttribute,e,i),u=i.attrValue,!Me||"id"!==c&&"name"!==c||(wt(a,e),u="user-content-"+u),$&&he(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,u)){wt(a,e);continue}if("attributename"===c&&de(u,"href")){wt(a,e);continue}if(i.forceKeepAttr)continue;if(!i.keepAttr){wt(a,e);continue}if(!q&&he(/\/>/i,u)){wt(a,e);continue}Z&&ie([O,k,R],e=>{u=ue(u,e," ")});const p=ft(e.nodeName);if(At(p,c,u)){if(w&&"object"==typeof m&&"function"==typeof m.getAttributeType)if(l);else switch(m.getAttributeType(p,c)){case"TrustedHTML":u=w.createHTML(u);break;case"TrustedScriptURL":u=w.createScriptURL(u)}if(u!==d)try{l?e.setAttributeNS(l,a,u):e.setAttribute(a,u),Tt(e)?_t(e):re(n.removed)}catch(t){wt(a,e)}}else wt(a,e)}Ct(A.afterSanitizeAttributes,e,null)},Rt=function e(t){let n=null;const i=xt(t);for(Ct(A.beforeSanitizeShadowDOM,t,null);n=i.nextNode();)Ct(A.uponSanitizeShadowNode,n,null),St(n),kt(n),n.content instanceof a&&e(n.content);Ct(A.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=null,r=null,l=null,c=null;if(rt=!e,rt&&(e="\x3c!--\x3e"),"string"!=typeof e&&!It(e)){if("function"!=typeof e.toString)throw ge("toString is not a function");if("string"!=typeof(e=e.toString()))throw ge("dirty is not a string, aborting")}if(!n.isSupported)return e;if(ne||vt(t),n.removed=[],"string"==typeof e&&(Be=!1),Be){if(e.nodeName){const t=ft(e.nodeName);if(!B[t]||W[t])throw ge("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof s)i=Et("\x3c!----\x3e"),r=i.ownerDocument.importNode(e,!0),r.nodeType===Xe&&"BODY"===r.nodeName||"HTML"===r.nodeName?i=r:i.appendChild(r);else{if(!ye&&!Z&&!te&&-1===e.indexOf("<"))return w&&Le?w.createHTML(e):e;if(i=Et(e),!i)return ye?null:Le?E:""}i&&ve&&_t(i.firstChild);const d=xt(Be?e:i);for(;l=d.nextNode();)St(l),kt(l),l.content instanceof a&&Rt(l.content);if(Be)return e;if(ye){if(_e)for(c=I.call(i.ownerDocument);i.firstChild;)c.appendChild(i.firstChild);else c=i;return(H.shadowroot||H.shadowrootmode)&&(c=S.call(o,c,!0)),c}let u=te?i.outerHTML:i.innerHTML;return te&&B["!doctype"]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&he(Pe,i.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+i.ownerDocument.doctype.name+">\n"+u),Z&&ie([O,k,R],e=>{u=ue(u,e," ")}),w&&Le?w.createHTML(u):u},n.setConfig=function(){vt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),ne=!0},n.clearConfig=function(){mt=null,ne=!1},n.isValidAttribute=function(e,t,n){mt||vt({});const i=ft(e),o=ft(t);return At(i,o,n)},n.addHook=function(e,t){"function"==typeof t&&ae(A[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=oe(A[e],t);return-1===n?void 0:le(A[e],n,1)[0]}return re(A[e])},n.removeHooks=function(e){A[e]=[]},n.removeAllHooks=function(){A={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}(),Qe=function(e){return e?Ze.sanitize(e,{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}):""};function $e(e){if(!e||"string"!=typeof e||0===e.trim().length)return"ltr";var t=e.replace(/<[^>]*>/g,"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_`#]/g,"").trim();if(0===t.length)return"ltr";for(var n=/[\u0590-\u05FF\u0600-\u06FF\u0700-\u074F\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]/,i=0,o=0,r=0,a=t;r<a.length;r++){var l=a[r];/\s|\d|[.,;:!?()[\]{}'"`\-_=+*/\\|@#$%^&*~]/.test(l)||(o++,n.test(l)&&i++)}return 0===o?"ltr":i/o>.3?"rtl":"ltr"}var et="https://cdn.robylon.ai/logos/WhatsApp.svg",tt=t(function(t){var r,a,l,s,c,d,u,p,m,h,g,v,_,w,T,C,O,R,N=t.config,D=t.toggleIframe,L=t.isIframeVisible,z=t.onEvent,M=t.onInternalEvent,B=t.position,U=t.sideSpacing,H=t.bottomSpacing,G=t.launcher_type,X=t.launcher_properties_text,Y=t.shouldFadeIn,K=t.launcher_size,J=n(null),q=i(!1),Z=q[0],Q=q[1],$=i(!1),ee=$[0],te=$[1],ne=i([]),ie=ne[0],oe=ne[1],re=i(!1),ae=re[0],le=re[1],se=n([]),ce=n(),de=n(new Set),ue=null!==(l=null==N?void 0:N.launcher_size_multiplier)&&void 0!==l?l:1,pe=null!=K?K:48*ue,fe="".concat(Math.max(4,Math.round(4*ue)),"px");o(function(){var e=function(){var e=(null===window||void 0===window?void 0:window.innerWidth)<560;Q(e)};return e(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}},[]),o(function(){J.current&&requestAnimationFrame(function(){null==z||z({type:x.CHATBOT_BUTTON_LOADED,timestamp:Date.now()}),M(x.CHATBOT_BUTTON_LOADED)})},[z,M]),o(function(){if(J.current&&Y){J.current.style.opacity="0";var e=requestAnimationFrame(function(){J.current&&(J.current.style.opacity="1")});return function(){return cancelAnimationFrame(e)}}},[Y]);var me=B||(null===(s=N.interface_properties)||void 0===s?void 0:s.position)||"Right",he=null!==(d=null!=U?U:null===(c=N.interface_properties)||void 0===c?void 0:c.side_spacing)&&void 0!==d?d:20,ge=null!==(p=null!=H?H:null===(u=N.interface_properties)||void 0===u?void 0:u.bottom_spacing)&&void 0!==p?p:20,ve=G||(null==N?void 0:N.launcher_type)||f.IMAGE,ye=X||(null===(m=null==N?void 0:N.launcher_properties)||void 0===m?void 0:m.text),be={zIndex:1e3,display:"flex",flexDirection:"column-reverse",alignItems:"center",justifyContent:"center",cursor:"pointer",overflow:"hidden",marginTop:"16px",boxSizing:"border-box"};ve===f.IMAGE&&(be.width="".concat(pe,"px"),be.height="".concat(pe,"px"),be.borderRadius="50%",be.backgroundColor=N.brand_colour);var _e=b(b({},be),((r={position:void 0,bottom:"0",borderRadius:ve===f.IMAGE?"50%":"9999px"})[me.toLowerCase()]="0",r)),we=b(b({},be),((a={position:"fixed",bottom:"".concat(ge,"px"),borderRadius:ve===f.IMAGE?"50%":"9999px"})[me.toLowerCase()]="".concat(he,"px"),a)),Ee=Z?we:_e;o(function(){S.log("Screen width changed, isMobile:",Z,"Style:",Ee)},[Z,Ee]),S.log("config in floating button",N);o(function(){var e=function(){se.current.forEach(function(e){return clearTimeout(e)}),se.current=[]},t=function(){if(e(),oe([]),de.current.clear(),(null==N?void 0:N.proactive_message_obj)&&!P()){var t=V(null==N?void 0:N.proactive_message_obj);E([],t,!0).sort(function(e,t){return e.delayMs!==t.delayMs?e.delayMs-t.delayMs:e.contentIndex-t.contentIndex});var n=new Map;t.forEach(function(e){var t=n.get(e.delayMs);t||(t={messageIds:[],groups:new Map},n.set(e.delayMs,t)),t.groups.has(e.messageId)||(t.messageIds.push(e.messageId),t.groups.set(e.messageId,[])),t.groups.get(e.messageId).push(e)}),n.forEach(function(e,t){var n=e.messageIds,i=e.groups,o=window.setTimeout(function(){oe(function(e){var o=[];return n.forEach(function(t){(i.get(t)||[]).forEach(function(t){var n="".concat(t.messageId,"-").concat(t.contentIndex);if(!e.some(function(e){return e.id===t.messageId&&e.index===t.contentIndex})){var i={id:t.messageId,index:t.contentIndex,html:t.html,contentId:t.contentId,messageDisplayType:t.messageDisplayType,messageBubbleBg:null==t?void 0:t.messageBubbleBg,urlToGo:null==t?void 0:t.urlToGo};o.push(i),de.current.add(n),setTimeout(function(){de.current.delete(n)},1200)}})}),0===t?E(E([],e,!0),o,!0):E(E([],o,!0),e,!0)})},t);se.current.push(o)})}};return ce.current=F(function(){te(!1),t()}),t(),function(){var t;e(),null===(t=ce.current)||void 0===t||t.call(ce)}},[null==N?void 0:N.proactive_message_obj]);var xe=ie.length>0&&!L&&!ee,Te="Right"===(B||(null===(h=N.interface_properties)||void 0===h?void 0:h.position)||"Right"),Ie=function(){le(!0),setTimeout(function(){te(!0),j(),le(!1)},400)};return e.createElement(e.Fragment,null,e.createElement("style",null,"\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 .proactive-bubble-enter-right {\n animation: slideInFromRight 1.2s cubic-bezier(0.5, 0.8, 0.3, 1.1) forwards;\n }\n .proactive-bubble-enter-left {\n animation: slideInFromLeft 1.2s cubic-bezier(0.5, 0.8, 0.3, 1.1) forwards;\n }\n .proactive-bubble-exit-right {\n animation: slideOutRight 0.4s ease-in forwards;\n }\n .proactive-bubble-exit-left {\n animation: slideOutLeft 0.4s ease-in forwards;\n }\n .proactive-close-enter-right {\n animation: slideInFromRight 1.2s cubic-bezier(0.5, 0.8, 0.3, 1.1) forwards;\n }\n .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 .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(A,';\n // font-size: inherit;\n // font-weight: inherit;\n line-height: inherit;\n color: inherit;\n text-align: inherit;\n // text-decoration: none ;\n list-style: none !important;\n }\n .proactive-message-content p,\n .proactive-message-content div,\n .proactive-message-content span {\n display: inline !important;\n margin: 0 !important;\n padding: 0 !important;\n }\n .proactive-message-content p:first-child,\n .proactive-message-content div:first-child,\n .proactive-message-content span:first-child {\n margin-top: 0 !important;\n }\n .proactive-message-content p:last-child,\n .proactive-message-content div:last-child,\n .proactive-message-content span:last-child {\n margin-bottom: 0 !important;\n }\n .proactive-message-content a {\n color: inherit !important;\n text-decoration: underline !important;\n cursor: pointer !important;\n }\n .proactive-message-content a:hover {\n opacity: 0.8 !important;\n }\n .proactive-message-content b,\n .proactive-message-content strong {\n font-weight: 600 !important;\n }\n .proactive-message-content i,\n .proactive-message-content em {\n font-style: italic !important;\n }\n .proactive-message-content u {\n text-decoration: underline !important;\n }\n .proactive-message-content br {\n display: block !important;\n content: "" !important;\n margin-top: 0.5em !important;\n }\n ')),xe?e.createElement("div",{className:"proactive-message-container",style:{position:"fixed",bottom:"".concat((null!==(v=null!=H?H:null===(g=N.interface_properties)||void 0===g?void 0:g.bottom_spacing)&&void 0!==v?v:20)+(ve===f.IMAGE?pe:void 0!==K?40:40*ue)+8,"px"),right:Te?"".concat(null!==(w=null!=U?U:null===(_=N.interface_properties)||void 0===_?void 0:_.side_spacing)&&void 0!==w?w:20,"px"):"auto",left:Te?"auto":"".concat(null!==(C=null!=U?U:null===(T=N.interface_properties)||void 0===T?void 0:T.side_spacing)&&void 0!==C?C:20,"px"),maxWidth:"22.875rem",zIndex:2147483646}},e.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:Te?"flex-end":"flex-start"},className:"proactive-message-bubble-container"},ie.map(function(t,n){var i="".concat(t.id,"-").concat(t.index),o=de.current.has(i),r=10*(ie.length-1-n),a=t.messageDisplayType===y.BUTTON;return console.log("visibleProactives",ie),e.createElement("div",{key:i,onClick:function(){if((null==t?void 0:t.urlToGo)&&"string"==typeof t.urlToGo&&""!==t.urlToGo.trim())window.open(t.urlToGo,"_blank","noopener,noreferrer");else{W({message_id:t.id,content_string:t.html||null,content_id:t.contentId||null}),D(),Ie();try{window.dispatchEvent(new CustomEvent("rblyn:proactiveClick",{detail:{message_id:t.id,content_string:t.html||null,content_id:t.contentId||null}}))}catch(e){}}},className:ae?Te?"proactive-bubble-exit-right":"proactive-bubble-exit-left":o&&!ae?Te?"proactive-bubble-enter-right":"proactive-bubble-enter-left":"",style:b({background:(null==t?void 0:t.messageBubbleBg)||"#ffffff",color:"#111",borderRadius:a?"100px":"12px",boxShadow:"0 2px 2px 0 rgba(0, 0, 0, 0.08)",padding:"16px",cursor:"pointer",fontFamily:A,lineHeight:k,fontSize:"14px",marginBottom:n<ie.length-1?16:0,border:"1px solid #F1F2F4",width:"fit-content",maxWidth:"100%",animationDelay:ae?"0ms":o?"".concat(r,"ms"):void 0},ae?{opacity:0}:o?{opacity:0,transform:Te?"translateX(120%) scale(0.95)":"translateX(-120%) scale(0.95)"}:{})},e.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},e.createElement("div",{className:"proactive-message-content",dir:$e(t.html),dangerouslySetInnerHTML:{__html:Qe(t.html)}}),(null==t?void 0:t.urlToGo)&&"string"==typeof t.urlToGo&&""!==t.urlToGo.trim()&&e.createElement("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{flexShrink:0,color:I((null==t?void 0:t.messageBubbleBg)||"#ffffff")}},e.createElement("g",{id:"External_Link"},e.createElement("path",{id:"Vector",d:"M6.6668 3.83268H5.4668C4.72006 3.83268 4.34642 3.83268 4.0612 3.97801C3.81032 4.10584 3.60649 4.30966 3.47866 4.56055C3.33334 4.84576 3.33334 5.21941 3.33334 5.96615V11.0328C3.33334 11.7795 3.33334 12.1527 3.47866 12.4379C3.60649 12.6888 3.81032 12.893 4.0612 13.0208C4.34614 13.166 4.71933 13.166 5.46461 13.166H10.5354C11.2807 13.166 11.6533 13.166 11.9383 13.0208C12.1891 12.893 12.3937 12.6886 12.5215 12.4377C12.6667 12.1528 12.6667 11.78 12.6667 11.0347V9.83268M13.3333 6.49935V3.16602M13.3333 3.16602H10M13.3333 3.16602L8.66667 7.83268",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})))))})),e.createElement("div",{onClick:function(e){e.stopPropagation(),Ie()},className:ae?"":Te?"proactive-close-enter-right":"proactive-close-enter-left",style:b({position:"absolute",top:"-32px",right:"Right"===(B||(null===(O=N.interface_properties)||void 0===O?void 0:O.position)||"Right")?"0px":"auto",left:"Left"===(B||(null===(R=N.interface_properties)||void 0===R?void 0:R.position)||"Right")?"0px":"auto",width:"24px",height:"24px",borderRadius:"50%",background:"#fff",boxShadow:" 0 2.667px 2.667px 0 rgba(0, 0, 0, 0.25)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",userSelect:"none",animationDelay:ae?"0ms":"".concat(10*(ie.length-1),"ms")},ae?{}:{opacity:0,transform:Te?"translateX(120%) scale(0.95)":"translateX(-120%) scale(0.95)"}),"aria-label":"Close proactive message"},e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 14 14",fill:"none"},e.createElement("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",strokeWidth:"0.816326",strokeLinecap:"round",strokeLinejoin:"round"})))):null,e.createElement("div",{ref:J,className:"message-bubble-container",style:b(b({},Ee),{transition:"transform 0.2s cubic-bezier(0.2, 1.27, 0.29, 0.97), opacity 280ms ease",transform:L?"scale(0.85)":"scale(1)",opacity:Y?0:1}),onClick:function(){D(),Ie()}},function(){switch(ve){case f.TEXT:return t=void 0!==K?void 0:160*ue,n=void 0!==K?void 0:40*ue,i=void 0!==K?void 0:14*ue,o=void 0!==K?void 0:21*ue,e.createElement("div",{style:{width:void 0!==t?"".concat(t,"px"):"fit-content",maxWidth:void 0!==t?"".concat(t,"px"):"160px",height:void 0!==n?"".concat(n,"px"):"40px",borderRadius:"9999px",backgroundColor:N.brand_colour,display:"flex",alignItems:"center",padding:"9px 20px",boxShadow:"0px 0px 16px 0px rgba(0, 0, 0, 0.24)",boxSizing:"border-box",fontFamily:A,lineHeight:k}},e.createElement("div",{style:{flex:1,minWidth:0}},e.createElement("p",{dir:$e(ye),style:{margin:0,color:I(N.brand_colour),fontSize:void 0!==i?"".concat(i,"px"):"0.875rem",fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:A,lineHeight:void 0!==o?"".concat(o,"px"):k,textAlign:"center",WebkitFontSmoothing:"antialiased",textRendering:"optimizeLegibility",textSizeAdjust:"100%"}},ye)));case f.TEXTUAL_IMAGE:return function(){var t,n,i,o,r=void 0!==K?void 0:174*ue,a=void 0!==K?void 0:40*ue,l=void 0!==K?void 0:40*ue,s=void 0!==K?void 0:14*ue,c=void 0!==K?void 0:21*ue,d=(null==N?void 0:N.launcher_type)?(null===(i=null===(n=null===(t=null==N?void 0:N.images)||void 0===t?void 0:t.launcher_image_url)||void 0===n?void 0:n.url)||void 0===i?void 0:i.trim())||et:(null===(o=null==N?void 0:N.image_url)||void 0===o?void 0:o.trim())||et,u=d===et;return e.createElement("div",{style:{maxWidth:void 0!==r?"".concat(r,"px"):"13rem",width:"fit-content",height:void 0!==a?"".concat(a,"px"):"40px",borderRadius:"9999px",backgroundColor:N.brand_colour,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",fontFamily:A,lineHeight:k}},e.createElement("div",{style:{flex:1,minWidth:0}},e.createElement("p",{dir:$e(ye),style:{margin:0,color:I(N.brand_colour),fontSize:void 0!==s?"".concat(s,"px"):"0.875rem",fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:A,lineHeight:void 0!==c?"".concat(c,"px"):k,textAlign:"right",WebkitFontSmoothing:"antialiased",textRendering:"optimizeLegibility",textSizeAdjust:"100%"}},ye)),e.createElement("div",{style:{width:void 0!==l?"".concat(l,"px"):"40px",height:void 0!==l?"".concat(l,"px"):"40px",borderRadius:"9999px",overflow:"hidden",position:"relative",flexShrink:0}},e.createElement("img",{src:d,alt:"Chat",style:{width:u?"calc(100% - 6px)":"100%",height:u?"calc(100% - 6px)":"100%",margin:u?"3px":0,borderRadius:u?0:"50%",objectFit:u?"contain":"cover",padding:u?fe:0,boxSizing:"border-box"}})))}();case f.IMAGE:default:return function(){var t,n,i,o;if(L){var r=Math.round(.5*pe);return e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%"}},e.createElement("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{display:"block"}},e.createElement("g",{id:"Chevron_Down"},e.createElement("path",{id:"Vector",d:"M19 9L12 16L5 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}))))}var a=(null==N?void 0:N.launcher_type)?(null===(i=null===(n=null===(t=null==N?void 0:N.images)||void 0===t?void 0:t.launcher_image_url)||void 0===n?void 0:n.url)||void 0===i?void 0:i.trim())||et:(null===(o=null==N?void 0:N.image_url)||void 0===o?void 0:o.trim())||et,l=a===et;return e.createElement("img",{src:a,alt:"Chat",style:{zIndex:1e3,cursor:"pointer",borderRadius:l?0:"50%",objectFit:l?"contain":"cover",padding:l?fe:0,width:l?"calc(100% - 3px)":"100%",height:l?"calc(100% - 3px)":"100%",margin:l?"4px":0,boxSizing:"border-box"}})}()}var t,n,i,o}()))}),nt=function(t){var n=t.config,i=t.onCtaClick,o=(null==n?void 0:n.title_bar_color)||"#075E54",r=I(o),a=function(e){var t,n;if(null==e?void 0:e.startsWith("#")){var i=e.replace("#",""),o=3===(null==i?void 0:i.length)?null===(n=null===(t=null==i?void 0:i.split(""))||void 0===t?void 0:t.map(function(e){return"".concat(e).concat(e)}))||void 0===n?void 0:n.join(""):i;if(6===(null==o?void 0:o.length)){var r=parseInt(null==o?void 0:o.slice(0,2),16),a=parseInt(null==o?void 0:o.slice(2,4),16),l=parseInt(null==o?void 0:o.slice(4,6),16);return"rgba(".concat(r,", ").concat(a,", ").concat(l,", 0.8)")}}return"#FFFFFF"===e?"rgba(255, 255, 255, 0.8)":"rgba(14, 14, 15, 0.8)"}(r),l=(null==n?void 0:n.button_content)||"Chat on WhatsApp";return e.createElement("div",{className:"rblyn-chat-widget-popup",style:{width:"20rem",maxWidth:"calc(100vw - 20px)",borderRadius:"22px",overflow:"hidden",backgroundColor:"#fff",boxShadow:"0 16px 40px rgba(14, 14, 15, 0.2)",marginBottom:"14px"}},e.createElement("style",null,"\n .rblyn-chat-widget-popup,\n .rblyn-chat-widget-popup * {\n font-family: ".concat(O," !important;\n }\n .rblyn-chat-widget-powered-link {\n text-decoration: none;\n }\n .rblyn-chat-widget-powered-link:hover {\n text-decoration: underline;\n color: rgba(14, 14, 15, 0.8) !important;\n }\n ")),e.createElement("div",{style:{backgroundColor:o,padding:"20px 18px 16px"}},e.createElement("div",{style:{color:r,fontSize:"16px",fontWeight:600,lineHeight:"1.2"}},(null==n?void 0:n.widget_title)||"Hi there"),e.createElement("div",{style:{color:a,fontSize:"12px",marginTop:"4px"}},(null==n?void 0:n.widget_subtitle)||"We typically reply in minutes")),e.createElement("div",{style:{padding:"20px 16px 22px"}},e.createElement("button",{onClick:i,style:{width:"100%",border:"none",borderRadius:"14px",backgroundColor:(null==n?void 0:n.brand_colour)||"#25D366",color:I((null==n?void 0:n.brand_colour)||"#25D366"),fontSize:"14px",fontWeight:600,padding:"14px 16px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"}},e.createElement("img",{src:"https://cdn.robylon.ai/logos/WhatsApp.svg",alt:"WhatsApp",style:{width:"20px",height:"20px",objectFit:"contain"}}),e.createElement("span",null,l)),(null==n?void 0:n.powered_by_robylon)?e.createElement("div",{style:{textAlign:"center",color:"rgba(14, 14, 15, 0.4)",fontSize:"14px",marginTop:"14px"}},"Powered by"," ",e.createElement("a",{href:"https://www.robylon.ai",target:"_blank",rel:"noopener noreferrer",className:"rblyn-chat-widget-powered-link"},"Robylon")):null))},it=function(){var e;return(null===(e=navigator.userAgentData)||void 0===e?void 0:e.platform)||(/Windows|Mac|Linux|Android|iOS/.exec(navigator.userAgent)||["Unknown"])[0]},ot=function(){var e;if(null===(e=navigator.userAgentData)||void 0===e?void 0:e.brands)for(var t=["Chrome","Firefox","Safari","Edge","Opera"],n=0,i=navigator.userAgentData.brands;n<i.length;n++){var o=i[n];if(t.includes(o.brand))return o.brand}return(/Chrome|Firefox|Safari|Edge|Opera/.exec(navigator.userAgent)||["Unknown"])[0]},rt=function(){var e,t,n,i;return{width:(null===window||void 0===window?void 0:window.innerWidth)||(null===(e=null===document||void 0===document?void 0:document.documentElement)||void 0===e?void 0:e.clientWidth)||(null===(t=null===document||void 0===document?void 0:document.body)||void 0===t?void 0:t.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===(i=null===document||void 0===document?void 0:document.body)||void 0===i?void 0:i.clientHeight)}},at=function(){return{platform:"web",os:it(),browser:ot(),sdk_version:"1.0.2",device:(e=navigator.userAgent.toLowerCase(),/(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i.test(e)?"tablet":/Mobile|Android|iP(hone|od)|IEMobile|BlackBerry|Kindle|Silk-Accelerated|(hpw|web)OS|Opera M(obi|ini)/.test(e)?"mobile":"desktop"),screen_size:rt()};var e};S.log("Raw API_URL:","https://api.robylon.ai");var lt={copilotUrl:"https://chatbot.robylon.ai",environment:"production",apiUrl:"https://api.robylon.ai"};S.log("CONFIG",lt);var st,ct=function(){return"undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement},dt=function(){return{copilotUrl:lt.copilotUrl||"https://app.robylon.ai",environment:lt.environment||"production",apiUrl:lt.apiUrl||"https://app.robylon.ai"}};!function(e){e.ERROR="ERROR",e.INFO="INFO"}(st||(st={}));var ut,pt=["@robylon/whatsapp-react-sdk","node_modules/@robylon/whatsapp-react-sdk/"],ft=function(e){var t=e.filename,n=e.stack,i=e.message;return!!(t||n||i)&&pt.some(function(e){return(null==t?void 0:t.includes(e))||(null==n?void 0:n.includes(e))||(null==i?void 0:i.includes(e))})},mt=function(){function e(){var e=this;this.apiKey="",this.userId=null,this.preInitQueue=[],this.isInitialized=!1,this.handleWindowError=function(t){var n,i={filename:t.filename,stack:null===(n=t.error)||void 0===n?void 0:n.stack,message:t.message};ft(i)&&e.trackError(t.error||t.message,"GlobalErrorHandler",{filename:t.filename,lineNo:t.lineno,colNo:t.colno})},this.handleUnhandledRejection=function(t){var n,i,o={stack:null===(n=t.reason)||void 0===n?void 0:n.stack,message:(null===(i=t.reason)||void 0===i?void 0:i.message)||String(t.reason)};ft(o)&&e.trackError(t.reason||"Unhandled Promise Rejection","GlobalPromiseHandler",{reason:t.reason})},this.setupGlobalHandlers()}return e.prototype.setupGlobalHandlers=function(){ct()&&(null===window||void 0===window||window.addEventListener("error",null==this?void 0:this.handleWindowError),null===window||void 0===window||window.addEventListener("unhandledrejection",this.handleUnhandledRejection))},e.prototype.cleanup=function(){ct()&&(null===window||void 0===window||window.removeEventListener("error",null==this?void 0:this.handleWindowError),null===window||void 0===window||window.removeEventListener("unhandledrejection",this.handleUnhandledRejection))},e.getInstance=function(){return e.instance||(e.instance=new e),e.instance},e.prototype.initialize=function(e,t){void 0===t&&(t=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===e?"undefined":null===e?"null":""===e?"empty string":"invalid: ".concat(e)),componentName:"ErrorTrackingService",additionalInfo:{preInitError:!0,apiKey:e,userId:t,timestamp:Date.now()},timestamp:Date.now()},metadata:at(),event_type:st.ERROR,user_id:t};this.sendLog(n).catch(console.error)}this.apiKey=e,this.userId=t,this.isInitialized=!0,this.processPreInitQueue()}catch(n){S.error("Error during ErrorTrackingService initialization:",n),this.preInitQueue.push({error:n instanceof Error?n:new Error(String(n)),componentName:"ErrorTrackingService",additionalInfo:{apiKey:e,userId:t}})}},e.prototype.processPreInitQueue=function(){return _(this,void 0,void 0,function(){var e,t,n;return w(this,function(i){switch(i.label){case 0:if(!this.preInitQueue.length)return[2];S.info("Processing ".concat(this.preInitQueue.length," pre-initialization errors")),e=0,t=this.preInitQueue,i.label=1;case 1:return e<t.length?(n=t[e],[4,this.trackError(n.error,n.componentName,b(b({},n.additionalInfo),{preInitError:!0}))]):[3,4];case 2:i.sent(),i.label=3;case 3:return e++,[3,1];case 4:return this.preInitQueue=[],[2]}})})},e.prototype.sendLog=function(e){return _(this,void 0,void 0,function(){var t,n,i,o,r,a;return w(this,function(l){switch(l.label){case 0:return l.trys.push([0,4,,5]),t=dt().apiUrl,[4,fetch("".concat(t,"/users/sdk/record-logs/"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})];case 1:return(n=l.sent()).ok?[3,3]:(o=(i=S).error,r=["Failed to send error log:"],[4,n.text()]);case 2:o.apply(i,r.concat([l.sent()])),l.label=3;case 3:return[3,5];case 4:return a=l.sent(),S.error("Error sending log:",a),[3,5];case 5:return[2]}})})},e.prototype.trackError=function(e,t,n){return _(this,void 0,void 0,function(){var i,o,r;return w(this,function(a){switch(a.label){case 0:if(this.isInitialized)return[3,5];i={org_id:"UNINITALIZED",event_data:{message:e instanceof Error?e.message:e,stack:e instanceof Error?e.stack:void 0,componentName:t,additionalInfo:b(b({},n),{preInitError:!0,timestamp:Date.now()}),timestamp:Date.now()},metadata:at(),event_type:st.ERROR,user_id:this.userId},a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.sendLog(i)];case 2:return a.sent(),[3,4];case 3:return a.sent(),this.preInitQueue.push({error:e,componentName:t,additionalInfo:n}),S.warn("Error tracked before initialization, queuing:",e),[3,4];case 4:return[2];case 5:return o={message:e instanceof Error?e.message:e,stack:e instanceof Error?e.stack:void 0,componentName:t,additionalInfo:b(b({},n),{timestamp:Date.now()}),timestamp:Date.now()},r={org_id:this.apiKey||"UNINITALIZED",event_data:o,metadata:at(),event_type:st.ERROR,user_id:this.userId},[4,this.sendLog(r)];case 6:return a.sent(),[2]}})})},e.prototype.trackInfo=function(e,t,n){return _(this,void 0,void 0,function(){var i,o;return w(this,function(r){switch(r.label){case 0:return this.apiKey?(i={message:e,componentName:t,additionalInfo:n,timestamp:Date.now()},o={org_id:this.apiKey,event_data:i,metadata:at(),event_type:st.INFO,user_id:this.userId},[4,this.sendLog(o)]):(S.error("Error tracking not initialized"),[2]);case 1:return r.sent(),[2]}})})},e}(),ht=mt.getInstance(),gt="MISSING_API_KEY",vt="INVALID_API_KEY",yt="CONFIG_FETCH_FAILED",bt="SDK_INIT_FAILED",_t="ERROR_TRACKING_INIT_FAILED",wt="API_REQUEST_FAILED",Et="NETWORK_ERROR",xt="INVALID_RESPONSE",Tt="IFRAME_LOAD_FAILED",It="COOKIE_ACCESS_ERROR",Ct="COMPONENT_RENDER_ERROR",St="INITIALIZATION_ERROR",At="API_ERROR",Ot="COMPONENT_ERROR",kt=((ut={})[gt]=function(e){return"SDK Initialization Failed: Required parameter 'api_key' is ".concat(void 0===e?"undefined":null===e?"null":""===e?"empty string":"invalid: ".concat(e),". A valid API key string is required to initialize the SDK.")},ut[vt]=function(e){return"SDK Initialization Failed: Provided API key '".concat(e,"' is invalid. API key must be a non-empty string in UUID format.")},ut[yt]=function(e){return"Failed to fetch chatbot configuration: ".concat(e.statusCode?"Server responded with status ".concat(e.statusCode):"Could not reach server").concat(e.error?". Error: ".concat(e.error):"")},ut[wt]=function(e,t,n){return"API Request Failed: Server responded with status ".concat(e," for ").concat(n?"endpoint ".concat(n):"request"," - ").concat(t)},ut[Et]=function(e){return"Network Error: Failed to communicate with server".concat(e.url?" at ".concat(e.url):"").concat(e.error?" - ".concat(e.error):"")},ut[Tt]=function(e){return"Failed to load chatbot interface".concat(e.src?" from ".concat(e.src):"").concat(e.error?". Error: ".concat(e.error):"")},ut[xt]=function(e){return"Invalid API Response: Missing required fields in response data: ".concat(e.join(", "))},ut[_t]=function(e){return"Error Tracking Service initialization failed".concat(e.apiKey?" for API key ".concat(e.apiKey):"").concat(e.error?". Error: ".concat(e.error):"")},ut[bt]=function(e){return"SDK Initialization Failed: ".concat(e.reason||"Could not initialize the chatbot SDK").concat(e.config?". Attempted initialization with config: ".concat(JSON.stringify(e.config,null,2)):"")},ut[It]=function(e,t){return"Cookie Access Error: Failed to ".concat(e).concat(t?" cookie '".concat(t,"'"):" cookies",". This may affect user session persistence.")},ut[Ct]=function(e){return"React Component Error: ".concat(e.component||"Unknown component"," failed to render. Error: ").concat(e.error).concat(e.stack?"\nComponent Stack: ".concat(e.stack):"")},ut),Rt=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={hasError:!1},t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}d(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.getDerivedStateFromError=function(e){return{hasError:!0}},t.prototype.componentDidCatch=function(e,t){ht.trackError(new Error(kt[Ct]({component:this.props.componentName||void 0,error:e.message,stack:t.componentStack})),this.props.componentName||void 0,{errorCode:Ct,errorType:Ot,context:{originalError:e,componentStack:t.componentStack,timestamp:Date.now()}})},t.prototype.render=function(){return this.state.hasError?null:this.props.children},t}(r),Nt=function(e){var t=e?"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 t=t.split(";").map(function(e){var t=e.split("="),n=t[0],i=t.slice(1).join("=").trim();return{name:n=n.trim(),value:i?decodeURIComponent(i):""}}),t},Dt=function(){var e,t=navigator.userAgent;if(null===(e=navigator.userAgentData)||void 0===e?void 0:e.brands){var n=navigator.userAgentData.brands.find(function(e){return"Google Chrome"===e.brand});if(null==n?void 0:n.version)return n.version}var i=t.match(/(Chrome|Firefox|Safari|Edge|Opera)\/(\d+\.\d+)/);return i?i[2]:"Unknown"},Lt=function(){var e,t,n=at();return{current_page_url:(null===(e=null===window||void 0===window?void 0:window.location)||void 0===e?void 0:e.href)||"",browser_language:(null===navigator||void 0===navigator?void 0:navigator.language)||(null===(t=null===navigator||void 0===navigator?void 0:navigator.languages)||void 0===t?void 0:t[0])||"en",browser_version:Dt(),os:null==n?void 0:n.os,referral_url:(null===document||void 0===document?void 0:document.referrer)||"",system_info:n}},zt="https://cdn.robylon.ai/logos/WhatsApp.svg",Mt=function(){function e(e){this.logoContainer=null,this.iframe=null,this.bubblePromptContainer=null,this.chatBtnImage=null,this.config=e,this.validateDomain()&&this.init(),null===window||void 0===window||window.addEventListener("message",this.onCloseListener.bind(this),!1)}return e.prototype.onCloseListener=function(e){e.origin===this.config.domain&&"closeChatbot"===e.data&&this.closeIframe()},e.prototype.validateDomain=function(){var e,t=this.config.domain,n=null===(e=null===window||void 0===window?void 0:window.location)||void 0===e?void 0:e.origin;return S.log("expectedDomain, to current domain",t,n,t===n),t===n},e.prototype.createChatBubblContainer=function(){var e,t=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 i=document.createElement("div");i.classList.add("close-btn"),i.textContent="✕",Object.assign(i.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===(e=this.config.chat_interface_config)||void 0===e?void 0:e.chat_bubble_prompts)||[]).forEach(function(e){var i=t.createMessageBubble(e);n.appendChild(i)}),n.appendChild(i),document.body.appendChild(n)},e.prototype.createMessageBubble=function(e){var t=document.createElement("div");this.bubblePromptContainer=t,Object.assign(t.style,{display:"flex",position:"relative",justifyContent:"flex-end"});var n=document.createElement("div");n.classList.add("message"),n.textContent=e,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 i=document.createElement("button");return i.innerHTML="&times;",Object.assign(i.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"}),i.addEventListener("click",function(){t.remove()}),t.appendChild(i),t.appendChild(n),t},e.prototype.createFloatingButton=function(){var e=document.createElement("div");e.classList.add("message-bubble-container"),Object.assign(e.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:I(this.config.brand_colour),borderRadius:"50%",alignItems:"center",justifyContent:"center",cursor:"pointer",overflow:"hidden"}),document.body.appendChild(e),this.logoContainer=e,this.loadImage(this.logoContainer),this.createChatBubblContainer(),this.logoContainer.addEventListener("click",this.toggleIframe.bind(this))},e.prototype.loadImage=function(e){var t,n,i,o,r,a,l,s,c,d=document.createElement("img"),u=null!==(n=null===(t=this.config)||void 0===t?void 0:t.launcher_size_multiplier)&&void 0!==n?n:1,p="".concat(Math.max(4,Math.round(4*u)),"px"),f=(null===(i=this.config)||void 0===i?void 0:i.launcher_type)?(null===(l=null===(a=null===(r=null===(o=this.config)||void 0===o?void 0:o.images)||void 0===r?void 0:r.launcher_image_url)||void 0===a?void 0:a.url)||void 0===l?void 0:l.trim())||zt:(null===(c=null===(s=this.config)||void 0===s?void 0:s.image_url)||void 0===c?void 0:c.trim())||zt,m=f===zt;d.src=f,d.alt="Chat",Object.assign(d.style,{zIndex:"1000",cursor:"pointer",borderRadius:m?"0":"50%",objectFit:m?"contain":"cover",padding:m?p:"0",boxSizing:"border-box",width:m?"calc(100% - 3px)":"100%",height:m?"calc(100% - 3px)":"100%",margin:m?"4px":"0"}),this.chatBtnImage=d,e.innerHTML="",e.appendChild(d)},e.prototype.createIframe=function(){var e=this;S.log("RobylonConfig?.domain====>",this.config.domain);var t=document.createElement("iframe");Object.assign(t.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"}),t.src="".concat(this.config.domain,"/chatbot-plugin?id=").concat(this.config.chatbotId),S.log("iframe.src====>",t.src),document.body.appendChild(t),this.iframe=t;var n=function(){(null===window||void 0===window?void 0:window.innerWidth)<560?Object.assign(t.style,{width:"100vw",minWidth:"300px",right:"0",bottom:"0",height:"100vh",flexDirection:"column",flexGrow:"1",borderRadius:"0",top:"0",maxHeight:"100%"}):Object.assign(t.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),t.addEventListener("load",function(){var n,i,o,r,a;if(e.iframe){var l=new URL(e.iframe.src).origin||e.config.domain;null===(n=t.contentWindow)||void 0===n||n.postMessage({domain:null===(i=null===window||void 0===window?void 0:window.location)||void 0===i?void 0:i.hostname,name:"checkDomain"},l),null===(o=t.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:e.config.userId,token:e.config.token,userProfile:b(b({},e.config.userProfile||{}),{__INT_SYS_INFO__:b(b({},(null===(a=e.config.userProfile)||void 0===a?void 0:a.__INT_SYS_INFO__)||{}),Lt())})}},l)}}),null===window||void 0===window||window.addEventListener("message",function(n){var i,o;if(n.origin===e.config.domain){if("captureSessionData"===n.data){var r="66b33d16-5b38-4693-8772-1a1bd7dd412d"===e.config.chatbotId,a={cookies:Nt(r),localStorage:JSON.stringify(localStorage),sessionStorage:JSON.stringify(sessionStorage),action:"capturedSessionData",domain_name:null===(i=null===window||void 0===window?void 0:window.location)||void 0===i?void 0:i.hostname};null===(o=t.contentWindow)||void 0===o||o.postMessage(a,e.config.domain||"*")}"expand"===n.data&&(e.adjustIframeWidth(),t.style.height="calc(100vh - 120px)",t.style.bottom="86px"),"collapse"===n.data&&Object.assign(t.style,{width:"26%",height:"calc(100vh - 32px - 10vh)",bottom:"86px",top:"calc(32px + 10vh)"})}})},e.prototype.adjustIframeWidth=function(){if(this.iframe){var e=null===window||void 0===window?void 0:window.innerWidth;S.log("screenWidth",e),this.iframe.style.width=e<832?"".concat(e-64,"px"):"800px"}},e.prototype.loadSvgInline=function(e){var t=document.createElement("div");t.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=t.querySelector("svg");e.innerHTML="",n&&e.appendChild(n)},e.prototype.toggleIcon=function(e,t){"block"===t.style.display?this.loadSvgInline(e):this.loadImage(e)},e.prototype.toggleIframe=function(){var e,t;if(S.log("toggleIframe",this.iframe,this.logoContainer,this.chatBtnImage),this.iframe&&this.logoContainer&&this.chatBtnImage){var n=new URL(this.iframe.src).origin||this.config.domain;S.log("toggleIframe"),null===(e=this.iframe.contentWindow)||void 0===e||e.postMessage({domain:null===window||void 0===window?void 0:window.location.hostname,name:"none"===this.iframe.style.display?"openFrame":"closeFrame"},n),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":(null===(t=this.chatBtnImage)||void 0===t?void 0:t.src)===zt?"contain":"cover",this.bubblePromptContainer&&(this.bubblePromptContainer.style.display="none"),S.log("this.bubblePromptContainer",this.bubblePromptContainer)}},e.prototype.closeIframe=function(){var e;this.iframe&&this.logoContainer&&this.chatBtnImage&&(this.iframe.style.display="none",this.toggleIcon(this.logoContainer,this.iframe),this.chatBtnImage.style.objectFit=(null===(e=this.chatBtnImage)||void 0===e?void 0:e.src)===zt?"contain":"cover")},e.prototype.init=function(){this.createIframe(),this.createFloatingButton()},e}(),Ft=function(e,t,n){if(e.chatbotId&&e.userId)try{new Mt(e);t(!0),S.log("Robylon SDK initialized successfully.")}catch(e){n(e instanceof Error?e.message:"Failed to initialize SDK")}else n("Incomplete configuration for SDK initialization.")},Bt=function(e){return function(e){var t,n,i,o,r,a,l,s;return Boolean((null===(i=null===(n=null===(t=null==e?void 0:e.user)||void 0===t?void 0:t.org_info)||void 0===n?void 0:n.brand_config)||void 0===i?void 0:i.widget)&&(null===(s=null===(l=null===(a=null===(r=null===(o=null==e?void 0:e.user)||void 0===o?void 0:o.org_info)||void 0===r?void 0:r.brand_config)||void 0===a?void 0:a.profile)||void 0===l?void 0:l.qr_code)||void 0===s?void 0:s.chat_link))}(e)?function(e){var t,n,i=null===(n=null===(t=null==e?void 0:e.user)||void 0===t?void 0:t.org_info)||void 0===n?void 0:n.brand_config;return{profile:null==i?void 0:i.profile,widget:null==i?void 0:i.widget,business_profile:null==i?void 0:i.business_profile,display_name:null==i?void 0:i.display_name}}(e):e},Ut=function(e,t,n){return _(void 0,void 0,void 0,function(){var i,o,r,a,l,s,c,d,u,p;return w(this,function(f){switch(f.label){case 0:return f.trys.push([0,5,,6]),i=dt().apiUrl,o="".concat(i,"/chat/whatsapp/get/"),S.log("endpointUrl",o),r={client_user_id:t||null,org_id:e,token:n||void 0,extra_info:{},launcher_info:Lt(),phone_no_id:"739739745898120"},[4,fetch(o,{method:"POST",headers:{"Content-Type":"text/plain"},body:JSON.stringify(r)})];case 1:return(a=f.sent()).ok?[3,3]:[4,a.text()];case 2:throw l=f.sent(),new Error(kt[wt](a.status,l));case 3:return[4,a.json()];case 4:if(s=f.sent(),c=Bt(s),!(null===(p=null===(u=null==c?void 0:c.profile)||void 0===u?void 0:u.qr_code)||void 0===p?void 0:p.chat_link)||!(null==c?void 0:c.widget))throw new Error(kt[xt](["profile","widget"]));return[2,c];case 5:throw d=f.sent(),ht.trackError(d instanceof Error?d:new Error(kt[Et]({error:String(d)})),"fetchChatbotConfig",{errorCode:d instanceof Error&&d.message.includes("API Request Failed")?wt:Et,errorType:At,context:{apiKey:e,userId:t,timestamp:Date.now()}}),d;case 6:return[2]}})})},Ht=function(e){return _(void 0,void 0,void 0,function(){var t,n,i,o,r,a,l,s,c,d,m,h,g,v,y,_,E,x,T,I,C,A,O,k,R,N,D,L,z,M,F,B,U;return w(this,function(w){switch(w.label){case 0:return t=function(e){return{api_key:String(e.api_key||""),user_id:e.user_id?String(e.user_id):null,user_token:e.user_token?String(e.user_token):void 0,user_profile:e.user_profile||{}}}(e),n=t.user_id||void 0,i=!1,n||(n=function(e){var t,n="; ".concat(document.cookie).split("; ".concat(e,"="));if(2===n.length)return null===(t=n.pop())||void 0===t?void 0:t.split(";").shift()}("rblyn_anon")||"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}),j="rblyn_anon",P=n,W=365,(G=new Date).setTime(G.getTime()+24*W*60*60*1e3),document.cookie="".concat(j,"=").concat(P,";expires=").concat(G.toUTCString(),";path=/"),i=!0),[4,Ut(t.api_key,n,t.user_token)];case 1:o=w.sent();try{t.api_key}catch(e){S.warn("Failed to inject mock proactive messages",e)}return r=at(),a=Lt(),H=t.user_profile,l=H?Object.fromEntries(Object.entries(H).map(function(e){var t=e[0],n=e[1];return"boolean"==typeof n||"number"==typeof n?[t,n]:[t,String(n)]})):{},s=b(b(b({},r),{__INT_SYS_INFO__:b(b({},r),a)}),l),c=function(e){if("string"==typeof e)return(null==e?void 0:e.trim())||"";var t=null==e?void 0:e.url;return"string"==typeof t&&(null==t?void 0:t.trim())||""}(null===(d=null==o?void 0:o.widget)||void 0===d?void 0:d.launcher_image),[2,{chatbotId:t.api_key,userId:n,token:t.user_token,isAnonymous:i,domain:"",show_launcher:!0,brand_colour:(null===(m=null==o?void 0:o.widget)||void 0===m?void 0:m.brand_color)||"#25D366",image_url:c,userProfile:s,chat_interface_config:{chat_bubble_prompts:[],display_name:(null===(h=null==o?void 0:o.widget)||void 0===h?void 0:h.title)||(null==o?void 0:o.display_name)||"",welcome_message:(null===(g=null==o?void 0:o.widget)||void 0===g?void 0:g.subtitle)||"Hey! What can we help you with today?",redirect_url:(null===(y=null===(v=null==o?void 0:o.profile)||void 0===v?void 0:v.qr_code)||void 0===y?void 0:y.chat_link)||""},launcher_type:(null===(_=null==o?void 0:o.widget)||void 0===_?void 0:_.launcher_type)||f.IMAGE,launcher_properties:{text:(null===(E=null==o?void 0:o.widget)||void 0===E?void 0:E.launcher_text)||(null===(x=null==o?void 0:o.widget)||void 0===x?void 0:x.button_content)||""},images:{launcher_image_url:{url:c}},proactive_message_obj:void 0,interface_properties:{position:(null===(T=null==o?void 0:o.widget)||void 0===T?void 0:T.position)||p.RIGHT,side_spacing:(null===(I=null==o?void 0:o.widget)||void 0===I?void 0:I.side_spacing)||20,bottom_spacing:(null===(C=null==o?void 0:o.widget)||void 0===C?void 0:C.bottom_spacing)||20},interface_type:u.WIDGET,launcher_delay:{enabled:!1,delay:0},launcher_size_multiplier:null!==(O=null===(A=null==o?void 0:o.widget)||void 0===A?void 0:A.launcher_size_multiplier)&&void 0!==O?O:1,redirect_chat_link:(null===(R=null===(k=null==o?void 0:o.profile)||void 0===k?void 0:k.qr_code)||void 0===R?void 0:R.chat_link)||"",pre_filled_message:(null===(D=null===(N=null==o?void 0:o.profile)||void 0===N?void 0:N.qr_code)||void 0===D?void 0:D.pre_filled_message)||"",widget_type:(null===(L=null==o?void 0:o.widget)||void 0===L?void 0:L.widget_type)||"quick_launch",widget_title:(null===(z=null==o?void 0:o.widget)||void 0===z?void 0:z.title)||"",widget_subtitle:(null===(M=null==o?void 0:o.widget)||void 0===M?void 0:M.subtitle)||"",title_bar_color:(null===(F=null==o?void 0:o.widget)||void 0===F?void 0:F.title_bar_color)||"#075E54",button_content:(null===(B=null==o?void 0:o.widget)||void 0===B?void 0:B.button_content)||"Chat on WhatsApp",powered_by_robylon:!1!==(null===(U=null==o?void 0:o.widget)||void 0===U?void 0:U.powered_by_robylon)}]}var H,j,P,W,G})})},jt=function(e){var t=a(function(){return function(e){return{api_key:String(e.api_key||""),user_id:e.user_id?String(e.user_id):null,user_token:e.user_token?String(e.user_token):void 0,user_profile:e.user_profile||{}}}(e)},[e.api_key,e.user_id,e.user_token,JSON.stringify(e.user_profile)]),n=i({isInitialized:!1,isInitializing:!1,error:null,chatbotConfig:null,isIframeVisible:!1}),r=n[0],s=n[1],c=a(function(){return t.user_profile?Object.fromEntries(Object.entries(t.user_profile).map(function(e){var t=e[0],n=e[1];return"boolean"==typeof n||"number"==typeof n?[t,n]:[t,String(n)]})):{}},[JSON.stringify(t.user_profile)]),d=l(function(e){s(function(t){return b(b({},t),e)})},[]),u=l(function(){return _(void 0,void 0,void 0,function(){var e,n,i,o;return w(this,function(r){switch(r.label){case 0:if(!t.api_key)return ht.trackError(new Error(kt[gt](t.api_key)),"useChatbotState",{errorCode:gt,errorType:St,context:{timestamp:Date.now()}}),[2];d({isInitializing:!0}),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,Ht(t)];case 2:return e=r.sent(),n=b(b(b({},at()),null==e?void 0:e.userProfile),c),e.userProfile=n,[4,new Promise(function(t,n){Ft(e,function(){d({isInitialized:!0,chatbotConfig:e}),t()},function(e){n(e)})})];case 3:return r.sent(),[3,6];case 4:return i=r.sent(),o=i instanceof Error?i.message:"Failed to initialize chatbot",d({error:o}),ht.trackError(i instanceof Error?i:new Error(o),"useChatbotState",{errorCode:bt,errorType:St,context:{timestamp:Date.now()}}),[3,6];case 5:return d({isInitializing:!1}),[7];case 6:return[2]}})})},[t.api_key,t.user_id,t.user_token]);o(function(){t.api_key&&u()},[u]),o(function(){r.chatbotConfig&&s(function(e){return b(b({},e),{chatbotConfig:b(b({},e.chatbotConfig),{userProfile:b(b({},at()),c)})})})},[c]);var p=l(function(){s(function(e){return b(b({},e),{isIframeVisible:!e.isIframeVisible})})},[]),f=l(function(){d({isIframeVisible:!1})},[]);return b(b({},r),{toggleIframeVisibility:p,closeIframe:f})},Pt=function(t){var n,r,a,l,s,c,d,u=t.children,p=t.config,f=t.position,m=t.sideSpacing,h=t.bottomSpacing,g=i(!1),v=g[0],y=g[1];o(function(){var e=function(){var e=(null===window||void 0===window?void 0:window.innerWidth)<560;y(e)};return e(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}},[]);var _=f||(null===(a=p.interface_properties)||void 0===a?void 0:a.position)||"Right",w=null!==(s=null!=m?m:null===(l=p.interface_properties)||void 0===l?void 0:l.side_spacing)&&void 0!==s?s:20,E=null!==(d=null!=h?h:null===(c=p.interface_properties)||void 0===c?void 0:c.bottom_spacing)&&void 0!==d?d:20;S.log("config",p,_,w);var x={position:"fixed",zIndex:1e3,display:"flex",flexDirection:"column"},T=b(b({},x),((n={bottom:"".concat(E,"px")})[_.toLowerCase()]="".concat(null!=w?w:20,"px"),n.alignItems="Right"===_?"flex-end":"flex-start",n.top=void 0,n["Right"===_?"left":"right"]=void 0,n)),I=b(b({},x),((r={top:0})[_.toLowerCase()]="".concat(null!=w?w:20,"px"),r.alignItems="center",r.bottom=void 0,r["Right"===_?"left":"right"]=void 0,r)),C=v?I:T;return o(function(){console.log("Container screen width changed, isMobile:",v,"Style:",C)},[v,C]),e.createElement("div",{className:"robylon-chatbot-container",style:C},u)},Wt=s(function(t,n){var r,s,d,u=t.api_key,p=t.user_id,f=t.user_token,m=t.user_profile,h=t.onEvent,g=t.position,v=t.sideSpacing,y=t.bottomSpacing,T=t.show_launcher,I=t.launcher_type,C=t.launcher_properties_text;t.overrides;var A=t.launcher_size,O="string"==typeof v?""===v||isNaN(Number(v))?void 0:Number(v):v,k="string"==typeof y?""===y||isNaN(Number(y))?void 0:Number(y):y,R="string"==typeof g?"left"===g.toLowerCase()?"Left":"right"===g.toLowerCase()?"Right":void 0:g;o(function(){});var N=a(function(){return{api_key:u,user_id:p,user_token:f,user_profile:m}},[u,p,f,m]),D=l(function(e){null==h||h(e)},[h]),L=jt(N),z=L.isInitialized,M=L.error,F=L.chatbotConfig,B=L.isIframeVisible,U=L.toggleIframeVisibility,H=L.closeIframe,j=a(function(){return{api_key:u,user_profile:N.user_profile,onEvent:D,chatbotConfig:F?{isAnonymous:F.isAnonymous,userId:F.userId}:null}},[u,N.user_profile,D,null==F?void 0:F.isAnonymous,null==F?void 0:F.userId]),P=function(e){var t=e.api_key,n=e.chatbotConfig,i=e.user_profile,o=e.onEvent,r=a(function(){return{isAnonymous:(null==n?void 0:n.isAnonymous)||!1,userId:(null==n?void 0:n.userId)||""}},[null==n?void 0:n.isAnonymous,null==n?void 0:n.userId]),s=a(function(){return i||{}},[JSON.stringify(i)]),c=l(function(e){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];return _(void 0,E([e],n,!0),void 0,function(e,n){var i,o,a,l,c,d,u;return void 0===n&&(n={}),w(this,function(p){switch(p.label){case 0:if(!t)return[2];p.label=1;case 1:return p.trys.push([1,3,,4]),i=dt().apiUrl,o=at(),a=b({trigger_time:Date.now(),channel:"CHATBOT",launch_url:(null===(u=null===window||void 0===window?void 0:window.location)||void 0===u?void 0:u.href)||"",org_id:t,client_user_id:r.isAnonymous?"Anonymous":String(r.userId),event_type:e,user_profile:s},n),l={org_id:t,event_data:a,metadata:b({timestamp:Date.now()},o),event_type:"INFO",user_id:r.userId},[4,fetch("".concat(i,"/users/sdk/record-logs/"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)})];case 2:if(!(c=p.sent()).ok)throw new Error("Failed to send internal event: ".concat(c.statusText));return[3,4];case 3:return d=p.sent(),S.error("Failed to send internal event:",d),[3,4];case 4:return[2]}})})},[t,r]);return{emitEvent:l(function(e,t){var n=Date.now();e!==x.CHATBOT_BUTTON_CLICKED&&e!==x.CHATBOT_CLOSED&&e!==x.CHATBOT_OPENED&&e!==x.CHATBOT_READY||(o&&o({type:e,timestamp:n,data:t}),c(e,{timestamp:n}))},[o,c]),onInternalEvent:c}}(b({},j)),W=P.emitEvent,G=P.onInternalEvent;c(n,function(){return{show:function(){z&&F?"chat_widget"===(null==F?void 0:F.widget_type)?B||(U(),W(x.CHATBOT_BUTTON_CLICKED)):(null==F?void 0:F.redirect_chat_link)&&(window.open(null==F?void 0:F.redirect_chat_link,"_blank","noopener,noreferrer"),W(x.CHATBOT_BUTTON_CLICKED)):console.warn("Robylon Chatbot: Cannot show - chatbot not ready yet")},hide:function(){z&&F?"chat_widget"===(null==F?void 0:F.widget_type)&&B&&(H(),W(x.CHATBOT_CLOSED)):console.warn("Robylon Chatbot: Cannot hide - chatbot not ready yet")},toggle:function(){z&&F?"chat_widget"===(null==F?void 0:F.widget_type)?(U(),W(B?x.CHATBOT_CLOSED:x.CHATBOT_BUTTON_CLICKED)):(null==F?void 0:F.redirect_chat_link)&&(window.open(null==F?void 0:F.redirect_chat_link,"_blank","noopener,noreferrer"),W(x.CHATBOT_BUTTON_CLICKED)):console.warn("Robylon Chatbot: Cannot toggle - chatbot not ready yet")},isReady:z&&!!F}},[z,F,B,U,H,W]),o(function(){z&&F&&W(x.CHATBOT_READY)},[z,F,W]);var X=i(!1),V=X[0],Y=X[1];o(function(){var e,t,n,i,o,r,a;if(!(void 0!==T?Boolean(T):null===(e=null==F?void 0:F.show_launcher)||void 0===e||e))return Y(!1),function(){a&&clearTimeout(a)};var l=!0===(null===(t=null==F?void 0:F.launcher_delay)||void 0===t?void 0:t.enabled),s=null!==(r=null!==(i=null===(n=null==F?void 0:F.launcher_delay)||void 0===n?void 0:n.seconds)&&void 0!==i?i:null===(o=null==F?void 0:F.launcher_delay)||void 0===o?void 0:o.delay)&&void 0!==r?r:0;return l&&Number(s)>0?(Y(!1),a=window.setTimeout(function(){Y(!0)},1e3*Number(s))):Y(!0),function(){a&&clearTimeout(a)}},[T,null==F?void 0:F.show_launcher,null===(r=null==F?void 0:F.launcher_delay)||void 0===r?void 0:r.enabled,null===(s=null==F?void 0:F.launcher_delay)||void 0===s?void 0:s.seconds,null===(d=null==F?void 0:F.launcher_delay)||void 0===d?void 0:d.delay]),o(function(){if(u)try{ht.initialize(u,p)}catch(e){ht.trackError(e instanceof Error?e:new Error(String(e)),"RobylonChatbot",{errorCode:_t,errorType:St,context:{timestamp:Date.now()}})}else ht.trackError(new Error(kt[gt](u)),"RobylonChatbot",{errorCode:gt,errorType:St,context:{timestamp:Date.now()}})},[u,p]);var K="chat_widget"===(null==F?void 0:F.widget_type),J=l(function(){var e=null==F?void 0:F.redirect_chat_link;K?(U(),W(B?x.CHATBOT_CLOSED:x.CHATBOT_BUTTON_CLICKED)):e&&(window.open(e,"_blank","noopener,noreferrer"),W(x.CHATBOT_BUTTON_CLICKED))},[null==F?void 0:F.redirect_chat_link,W,K,B,U]),q=l(function(){var e=null==F?void 0:F.redirect_chat_link;e&&(window.open(e,"_blank","noopener,noreferrer"),W(x.CHATBOT_BUTTON_CLICKED)),H()},[null==F?void 0:F.redirect_chat_link,W,H]),Z=a(function(){var e,t,n,i,o;return{config:F,toggleIframe:J,isIframeVisible:B,onEvent:D,onInternalEvent:G,position:R,sideSpacing:O,bottomSpacing:k,launcher_type:I,launcher_properties_text:C,shouldFadeIn:!0===(null===(e=null==F?void 0:F.launcher_delay)||void 0===e?void 0:e.enabled)&&(null!==(o=null!==(n=null===(t=null==F?void 0:F.launcher_delay)||void 0===t?void 0:t.seconds)&&void 0!==n?n:null===(i=null==F?void 0:F.launcher_delay)||void 0===i?void 0:i.delay)&&void 0!==o?o:0)>0||!1,launcher_size:A}},[F,J,B,D,G,R,O,k,I,C,A]);return S.log("floatingButtonProps",Z),u&&!M&&F?e.createElement(Rt,{componentName:"RobylonChatbot"},z?e.createElement(Pt,{config:F,position:R,sideSpacing:O,bottomSpacing:k},K&&B?e.createElement(Rt,{componentName:"ChatWidgetPopup"},e.createElement(nt,{config:F,onCtaClick:q})):null,e.createElement(Rt,{componentName:"ChatbotFloatingButton"},V?e.createElement(tt,b({},Z)):null)):null):null}),Gt=t(Wt,function(e,t){return e.api_key===t.api_key&&e.user_id===t.user_id&&e.user_token===t.user_token&&JSON.stringify(e.user_profile)===JSON.stringify(t.user_profile)&&e.position===t.position&&e.sideSpacing===t.sideSpacing&&e.bottomSpacing===t.bottomSpacing&&e.show_launcher===t.show_launcher&&e.launcher_type===t.launcher_type&&e.launcher_properties_text===t.launcher_properties_text&&JSON.stringify(e.overrides)===JSON.stringify(t.overrides)&&e.launcher_size===t.launcher_size&&!0}),Xt=function(e){var t=i({isLoading:!0,isInitialized:!1,error:null}),n=t[0],r=t[1],a=function(e){r(function(t){return b(b({},t),{isInitialized:e})})},l=function(e){r(function(t){return b(b({},t),{error:e})})};return o(function(){!function(){try{Ft(e,a,l)}catch(e){r(function(t){return b(b({},t),{error:e instanceof Error?e.message:"Failed to initialize SDK",isLoading:!1})})}}()},[e.chatbotId,e.userId]),n},Vt="https://cdn.robylon.ai/logos/WhatsApp.svg",Yt=function(){function e(e){var t=this;this.resizeObserver=null,this.proactiveElement=null,this.urlUnsubscribe=null,this.delayTimers=[],this.config=e,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(){t.buttonElement.style.opacity="1"})}catch(e){}this.setupResizeListener(),this.renderProactiveIfNeeded(),this.urlUnsubscribe=F(function(){t.clearProactiveDelays(),t.renderProactiveIfNeeded(!0)})}return e.prototype.render=function(){var e,t,n=this,i=this.config,o=i.config,r=i.isIframeVisible,a=null!==(e=null==o?void 0:o.launcher_size_multiplier)&&void 0!==e?e:1,l=null!==(t=this.config.launcher_size)&&void 0!==t?t:48*a,s={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:A};o.launcher_type===f.IMAGE&&Object.assign(s,{width:"".concat(l,"px"),height:"".concat(l,"px"),borderRadius:"50%",backgroundColor:o.brand_colour}),this.applyResponsiveStyles(s),this.buttonElement.className="message-bubble-container",this.buttonElement.innerHTML="",this.buttonElement.appendChild(this.createLauncherElement()),this.buttonElement.onclick=function(){n.config.toggleIframe(),n.hideProactiveMessages()},this.renderProactiveIfNeeded()},e.prototype.createLauncherElement=function(){var e,t,n,i,o,r,a=this.config,l=a.config,s=a.isIframeVisible,c=null!==(e=null==l?void 0:l.launcher_size_multiplier)&&void 0!==e?e:1,d=null!==(t=this.config.launcher_size)&&void 0!==t?t:48*c,u="".concat(Math.max(4,Math.round(4*c)),"px"),p=(null==l?void 0:l.launcher_type)?(null===(o=null===(i=null===(n=null==l?void 0:l.images)||void 0===n?void 0:n.launcher_image_url)||void 0===i?void 0:i.url)||void 0===o?void 0:o.trim())||Vt:(null===(r=null==l?void 0:l.image_url)||void 0===r?void 0:r.trim())||Vt,m=p===Vt;switch(console.log("config in floating button",l),l.launcher_type){case f.TEXT:return this.createTextLauncher();case f.TEXTUAL_IMAGE:return this.createTextualImageLauncher();case f.IMAGE:default:if(s){var h=Math.round(.5*d),g=document.createElement("div");Object.assign(g.style,{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%"});var v=document.createElementNS("http://www.w3.org/2000/svg","svg");v.setAttribute("width",String(h)),v.setAttribute("height",String(h)),v.setAttribute("viewBox","0 0 24 24"),v.setAttribute("fill","none"),v.setAttribute("xmlns","http://www.w3.org/2000/svg"),v.style.display="block";var y=document.createElementNS("http://www.w3.org/2000/svg","path");return y.setAttribute("d","M19 9L12 16L5 9"),y.setAttribute("stroke","currentColor"),y.setAttribute("stroke-width","1.5"),y.setAttribute("stroke-linecap","round"),y.setAttribute("stroke-linejoin","round"),v.appendChild(y),g.appendChild(v),g}var b=document.createElement("img");return b.src=p,b.alt="Chat",Object.assign(b.style,{zIndex:"1000",cursor:"pointer",borderRadius:m?"0":"50%",objectFit:m?"contain":"cover",padding:m?u:"0",width:m?"calc(100% - 3px)":"100%",height:m?"calc(100% - 3px)":"100%",margin:m?"4px":"0",boxSizing:"border-box"}),b}},e.prototype.createTextLauncher=function(){var e=this.config.config,t=e.brand_colour,n=e.launcher_properties,i=e.launcher_size_multiplier,o=null!=i?i:1,r=void 0!==this.config.launcher_size?void 0:160*o,a=void 0!==this.config.launcher_size?void 0:40*o,l=void 0!==this.config.launcher_size?void 0:14*o,s=void 0!==this.config.launcher_size?void 0:21*o,c=document.createElement("div");Object.assign(c.style,{width:void 0!==r?"".concat(r,"px"):"fit-content",maxWidth:void 0!==r?"".concat(r,"px"):"160px",height:void 0!==a?"".concat(a,"px"):"40px",borderRadius:"9999px",backgroundColor:t,display:"flex",alignItems:"center",padding:"9px 20px",boxShadow:"0px 0px 16px 0px rgba(0, 0, 0, 0.24)",boxSizing:"border-box"});var d=document.createElement("div");Object.assign(d.style,{flex:"1",minWidth:"0"});var u=document.createElement("p");return Object.assign(u.style,{margin:"0",color:I(t),fontSize:void 0!==l?"".concat(l,"px"):"0.875rem",fontWeight:"600",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:void 0!==s?"".concat(s,"px"):k,fontFamily:A,textAlign:"center",WebkitFontSmoothing:"antialiased",textRendering:"optimizeLegibility",textSizeAdjust:"100%"}),u.textContent=(null==n?void 0:n.text)||"",d.appendChild(u),c.appendChild(d),c},e.prototype.createTextualImageLauncher=function(){var e,t,n,i,o,r,a,l=this.config.config,s=l.brand_colour,c=l.launcher_properties,d=l.image_url,u=l.launcher_size_multiplier,p=(null===(t=null===(e=null==this?void 0:this.config)||void 0===e?void 0:e.config)||void 0===t?void 0:t.launcher_type)?(null===(a=null===(r=null===(o=null===(i=null===(n=null==this?void 0:this.config)||void 0===n?void 0:n.config)||void 0===i?void 0:i.images)||void 0===o?void 0:o.launcher_image_url)||void 0===r?void 0:r.url)||void 0===a?void 0:a.trim())||Vt:(null==d?void 0:d.trim())||Vt,f=p===Vt,m=null!=u?u:1,h="".concat(Math.max(4,Math.round(4*m)),"px"),g=void 0!==this.config.launcher_size?void 0:174*m,v=void 0!==this.config.launcher_size?void 0:40*m,y=void 0!==this.config.launcher_size?void 0:40*m,b=void 0!==this.config.launcher_size?void 0:14*m,_=void 0!==this.config.launcher_size?void 0:21*m,w=document.createElement("div");Object.assign(w.style,{maxWidth:void 0!==g?"".concat(g,"px"):"13rem",width:"fit-content",height:void 0!==v?"".concat(v,"px"):"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 E=document.createElement("div");Object.assign(E.style,{flex:"1",minWidth:"0"});var x=document.createElement("p");Object.assign(x.style,{margin:"0",color:I(s),fontSize:void 0!==b?"".concat(b,"px"):"0.875rem",fontWeight:"600",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:void 0!==_?"".concat(_,"px"):k,fontFamily:A,textAlign:"right",WebkitFontSmoothing:"antialiased",textRendering:"optimizeLegibility",textSizeAdjust:"100%"}),x.textContent=(null==c?void 0:c.text)||"";var T=document.createElement("div");Object.assign(T.style,{width:void 0!==y?"".concat(y,"px"):"40px",height:void 0!==y?"".concat(y,"px"):"40px",borderRadius:"9999px",overflow:"hidden",position:"relative",flexShrink:"0"});var C=document.createElement("img");return C.src=p,C.alt="Chat",Object.assign(C.style,{width:f?"calc(100% - 6px)":"100%",height:f?"calc(100% - 6px)":"100%",margin:f?"3px":"0",borderRadius:f?"0":"50%",objectFit:f?"contain":"cover",padding:f?h:"0",boxSizing:"border-box"}),E.appendChild(x),T.appendChild(C),w.appendChild(E),w.appendChild(T),w},e.prototype.applyResponsiveStyles=function(e){var t,n,i,o,r,a,l,s,c,d=(null===window||void 0===window?void 0:window.innerWidth)<560,u=this.config.config,p=this.config.position||(null===(i=u.interface_properties)||void 0===i?void 0:i.position)||"Right",f=null!==(a=null!==(o=this.config.sideSpacing)&&void 0!==o?o:null===(r=u.interface_properties)||void 0===r?void 0:r.side_spacing)&&void 0!==a?a:20,m=null!==(c=null!==(l=this.config.bottomSpacing)&&void 0!==l?l:null===(s=u.interface_properties)||void 0===s?void 0:s.bottom_spacing)&&void 0!==c?c:20;this.buttonElement.style.position="",this.buttonElement.style.bottom="",this.buttonElement.style.right="",this.buttonElement.style.left="";var h=b(b({},e),d?((t={position:"fixed",bottom:"".concat(m,"px")})[p.toLowerCase()]="".concat(f,"px"),t):((n={bottom:"".concat(m,"px")})[p.toLowerCase()]="".concat(f,"px"),n));Object.assign(this.buttonElement.style,h)},e.prototype.handleResize=function(){var e,t,n,i=null!==(t=null===(e=this.config.config)||void 0===e?void 0:e.launcher_size_multiplier)&&void 0!==t?t:1,o=null!==(n=this.config.launcher_size)&&void 0!==n?n:48*i,r={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!==f.IMAGE?"9999px":"50%",boxSizing:"border-box"};this.config.config.launcher_type===f.IMAGE&&Object.assign(r,{width:"".concat(o,"px"),height:"".concat(o,"px"),borderRadius:"50%",backgroundColor:this.config.config.brand_colour}),this.applyResponsiveStyles(r)},e.prototype.setupResizeListener=function(){"undefined"!=typeof ResizeObserver?(this.resizeObserver=new ResizeObserver(this.handleResizeFunction),this.resizeObserver.observe(document.body)):window.addEventListener("resize",this.handleResizeFunction)},e.prototype.getElement=function(){return this.buttonElement},e.prototype.mount=function(){var e=this;requestAnimationFrame(function(){var t,n;null===(n=(t=e.config).onEvent)||void 0===n||n.call(t,{type:x.CHATBOT_BUTTON_LOADED,timestamp:Date.now()}),e.config.onInternalEvent(x.CHATBOT_BUTTON_LOADED)})},e.prototype.update=function(e){this.config.isIframeVisible,this.config=b(b({},this.config),e),this.buttonElement.style.transform=this.config.isIframeVisible?"scale(0.85)":"scale(1)",this.render(),this.renderProactiveIfNeeded()},e.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)},e.prototype.clearProactiveDelays=function(){this.delayTimers.forEach(function(e){return clearTimeout(e)}),this.delayTimers=[]},e.prototype.hideProactiveMessages=function(){var e,t,n=this;j();var i=null===(e=this.proactiveElement)||void 0===e?void 0:e.children[0];if(i){var o="Right"===(this.config.position||(null===(t=this.config.config.interface_properties)||void 0===t?void 0:t.position)||"Right");Array.from(i.children).forEach(function(e){e.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()},e.prototype.injectAnimationStyles=function(){if(!document.getElementById("rblyn-proactive-animations")){var e=document.createElement("style");e.id="rblyn-proactive-animations",e.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(A,' !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(e)}},e.prototype.renderProactiveIfNeeded=function(e){var t,n,i,o,r,a,l,s,c,d,u,p,m,h,g,v=this,b=null===(n=null===(t=this.config)||void 0===t?void 0:t.config)||void 0===n?void 0:n.proactive_message_obj;if(Array.isArray(b)&&!this.config.isIframeVisible&&!P()){if(this.injectAnimationStyles(),!this.proactiveElement){var _=document.createElement("div");_.style.position="fixed";var w=null!==(a=null!==(o=this.config.bottomSpacing)&&void 0!==o?o:null===(r=this.config.config.interface_properties)||void 0===r?void 0:r.bottom_spacing)&&void 0!==a?a:20,x=null!==(c=null!==(l=this.config.sideSpacing)&&void 0!==l?l:null===(s=this.config.config.interface_properties)||void 0===s?void 0:s.side_spacing)&&void 0!==c?c:20,T=this.config.position||(null===(d=this.config.config.interface_properties)||void 0===d?void 0:d.position)||"Right",C=null!==(p=null===(u=this.config.config)||void 0===u?void 0:u.launcher_size_multiplier)&&void 0!==p?p:1,S=null!==(m=this.config.launcher_size)&&void 0!==m?m:48*C,O=this.config.config.launcher_type===f.IMAGE?S:void 0!==this.config.launcher_size?40:40*C;_.style.bottom="".concat(w+O+8,"px"),"Right"===T?_.style.right="".concat(x,"px"):_.style.left="".concat(x,"px"),_.style.maxWidth="22.875rem",_.style.zIndex="2147483646";var R=document.createElement("div");R.style.display="flex",R.style.flexDirection="column",R.style.alignItems="Right"===T?"flex-end":"flex-start";var N=document.createElement("div");N.style.position="absolute",N.style.top="-32px",N.style.width="24px",N.style.height="24px",N.style.borderRadius="50%",N.style.background="#fff",N.style.boxShadow="0 2.667px 2.667px 0 rgba(0, 0, 0, 0.25)",N.style.display="flex",N.style.alignItems="center",N.style.justifyContent="center",N.style.cursor="pointer",N.style.opacity="0",N.style.visibility="hidden","Right"===(this.config.position||(null===(h=this.config.config.interface_properties)||void 0===h?void 0:h.position)||"Right")?(N.style.right="0px",N.style.left="auto",N.style.transform="translateX(120%) scale(0.95)"):(N.style.left="0px",N.style.right="auto",N.style.transform="translateX(-120%) scale(0.95)"),N.onclick=function(e){e.stopPropagation(),v.hideProactiveMessages()},N.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 ',_.appendChild(R),_.appendChild(N),document.body.appendChild(_),this.proactiveElement=_}var D=this.proactiveElement.children[0];D.innerHTML="";var L="Right"===(this.config.position||(null===(g=this.config.config.interface_properties)||void 0===g?void 0:g.position)||"Right");D.style.display="flex",D.style.flexDirection="column",D.style.alignItems=L?"flex-end":"flex-start",this.clearProactiveDelays();var z=V(b);E([],z,!0).sort(function(e,t){return e.delayMs!==t.delayMs?e.delayMs-t.delayMs:e.contentIndex-t.contentIndex});var M=new Map;z.forEach(function(e){var t=M.get(e.delayMs);t||(t={messageIds:[],groups:new Map},M.set(e.delayMs,t)),t.groups.has(e.messageId)||(t.messageIds.push(e.messageId),t.groups.set(e.messageId,[])),t.groups.get(e.messageId).push(e)});var F=void 0!==M.get(0),B=this.proactiveElement.children[1];if(B&&z.length>0){B.style.opacity="0",B.style.visibility="hidden",B.style.transform=L?"translateX(120%) scale(0.95)":"translateX(-120%) scale(0.95)";var U=function(){if(B){B.style.visibility="visible";var e=D.children.length,t=e>0?10*(e-1):0;B.style.animationDelay="".concat(t,"ms"),B.className=L?"rblyn-proactive-close-enter-right":"rblyn-proactive-close-enter-left"}};if(F){var H=window.setTimeout(U,0);this.delayTimers.push(H)}else{var j=Math.min.apply(Math,Array.from(M.keys()));H=window.setTimeout(U,j);this.delayTimers.push(H)}}else B&&(B.style.opacity="0",B.style.visibility="hidden");var G=0;M.forEach(function(e,t){var n=e.messageIds,i=e.groups,o=window.setTimeout(function(){var e=D.children.length,o=0,r=[];n.forEach(function(e){var t=i.get(e)||[];E([],t,!0).sort(function(e,t){return e.contentIndex-t.contentIndex}).forEach(function(t){r.push({messageId:e,item:t})}),o+=t.length});var a=t>0?E([],r,!0).reverse():r;a.forEach(function(n,i){var r,l=n.item,s=document.createElement("div"),c=l.messageDisplayType===y.BUTTON;s.style.background=(null==l?void 0:l.messageBubbleBg)||"#ffffff",s.style.color="#111",s.style.borderRadius=c?"100px":"12px",s.style.boxShadow="0 2px 2px 0 rgba(0, 0, 0, 0.08)",s.style.padding="16px",s.style.border="1px solid #F1F2F4",s.style.cursor="pointer",s.style.fontFamily=A,s.style.fontSize="14px",s.style.lineHeight=String(k),s.style.width="fit-content",s.style.maxWidth="100%";var d=0===i,u=i===a.length-1,p=e>0,f=M.has(0),m=!1;0===t?m=!u||d&&p:d&&(p||f)?m=!0:d||(m=!0),m&&(s.style.marginBottom="16px");var h=10*(e+o-1-(0===t?e+G:G));s.className=L?"rblyn-proactive-enter-right":"rblyn-proactive-enter-left",s.style.animationDelay="".concat(h,"ms"),s.style.opacity="0",s.style.transform=L?"translateX(120%) scale(0.95)":"translateX(-120%) scale(0.95)";var g=document.createElement("div");Object.assign(g.style,{display:"flex",alignItems:"center",gap:"8px"});var b=document.createElement("div");if(b.className="rblyn-proactive-message-content",b.setAttribute("dir",$e(l.html)),b.innerHTML=Qe(l.html),g.appendChild(b),(null==l?void 0:l.urlToGo)&&"string"==typeof l.urlToGo&&""!==l.urlToGo.trim()){var _=document.createElementNS("http://www.w3.org/2000/svg","svg");_.setAttribute("width","16"),_.setAttribute("height","17"),_.setAttribute("viewBox","0 0 16 17"),_.setAttribute("fill","none"),_.setAttribute("xmlns","http://www.w3.org/2000/svg"),Object.assign(_.style,{flexShrink:"0",color:I((null==l?void 0:l.messageBubbleBg)||"#ffffff")});var w=document.createElementNS("http://www.w3.org/2000/svg","g");w.setAttribute("id","External_Link");var E=document.createElementNS("http://www.w3.org/2000/svg","path");E.setAttribute("id","Vector"),E.setAttribute("d","M6.6668 3.83268H5.4668C4.72006 3.83268 4.34642 3.83268 4.0612 3.97801C3.81032 4.10584 3.60649 4.30966 3.47866 4.56055C3.33334 4.84576 3.33334 5.21941 3.33334 5.96615V11.0328C3.33334 11.7795 3.33334 12.1527 3.47866 12.4379C3.60649 12.6888 3.81032 12.893 4.0612 13.0208C4.34614 13.166 4.71933 13.166 5.46461 13.166H10.5354C11.2807 13.166 11.6533 13.166 11.9383 13.0208C12.1891 12.893 12.3937 12.6886 12.5215 12.4377C12.6667 12.1528 12.6667 11.78 12.6667 11.0347V9.83268M13.3333 6.49935V3.16602M13.3333 3.16602H10M13.3333 3.16602L8.66667 7.83268"),E.setAttribute("stroke","currentColor"),E.setAttribute("stroke-width","1.5"),E.setAttribute("stroke-linecap","round"),E.setAttribute("stroke-linejoin","round"),w.appendChild(E),_.appendChild(w),g.appendChild(_)}if(s.appendChild(g),s.onclick=function(){if((null==l?void 0:l.urlToGo)&&"string"==typeof l.urlToGo&&""!==l.urlToGo.trim())window.open(l.urlToGo,"_blank","noopener,noreferrer");else{W({message_id:l.messageId,content_string:l.html||null,content_id:l.contentId||null}),v.config.toggleIframe(),v.hideProactiveMessages();try{window.dispatchEvent(new CustomEvent("rblyn:proactiveClick",{detail:{message_id:l.messageId,content_string:l.html||null,content_id:l.contentId||null}}))}catch(e){}}},0===t)D.appendChild(s);else{D.insertBefore(s,D.firstChild);var x=null===(r=v.proactiveElement)||void 0===r?void 0:r.children[1];if(x&&"visible"===x.style.visibility){var T=D.children.length,C=T>0?10*(T-1):0;x.style.animationDelay="".concat(C,"ms")}}G++})},t);v.delayTimers.push(o)})}else if(this.proactiveElement&&this.proactiveElement.parentElement){var X=this.proactiveElement.children[0],Y="Right"===(this.config.position||(null===(i=this.config.config.interface_properties)||void 0===i?void 0:i.position)||"Right");Array.from(X.children).forEach(function(e){e.className=Y?"rblyn-proactive-exit-right":"rblyn-proactive-exit-left"}),setTimeout(function(){v.proactiveElement&&v.proactiveElement.parentElement&&v.proactiveElement.parentElement.removeChild(v.proactiveElement),v.proactiveElement=null,v.clearProactiveDelays()},400)}else this.proactiveElement=null,this.clearProactiveDelays()},e}(),Kt=function(){function e(e,t,n,i){this.resizeObserver=null,this.containerElement=document.createElement("div"),this.handleResizeFunction=this.handleResize.bind(this),this.config={config:e,position:t,sideSpacing:n,bottomSpacing:i},this.render(),this.mount(),this.setupResizeListener()}return e.prototype.render=function(){this.applyStyles(),this.containerElement.className="robylon-chatbot-container"},e.prototype.applyStyles=function(){var e,t,n,i,o,r,a,l,s,c=(null===window||void 0===window?void 0:window.innerWidth)<560,d=this.config.position||(null===(n=this.config.config.interface_properties)||void 0===n?void 0:n.position)||"Right",u=null!==(r=null!==(i=this.config.sideSpacing)&&void 0!==i?i:null===(o=this.config.config.interface_properties)||void 0===o?void 0:o.side_spacing)&&void 0!==r?r:20,p=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 f={position:"fixed",zIndex:"1000",display:"flex",flexDirection:"column"},m=b(b({},f),((e={bottom:"".concat(p,"px")})[d.toLowerCase()]="".concat(u,"px"),e.alignItems="Right"===d?"flex-end":"flex-start",e)),h=b(b({},f),((t={top:"0"})[d.toLowerCase()]="".concat(u,"px"),t.alignItems="center",t));Object.assign(this.containerElement.style,c?h:m)},e.prototype.handleResize=function(){this.applyStyles()},e.prototype.setupResizeListener=function(){"undefined"!=typeof ResizeObserver?(this.resizeObserver=new ResizeObserver(this.handleResizeFunction),this.resizeObserver.observe(document.body)):window.addEventListener("resize",this.handleResizeFunction)},e.prototype.mount=function(){document.body.appendChild(this.containerElement)},e.prototype.getElement=function(){return this.containerElement},e.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)},e}(),Jt=function(){function e(e){this.config=e,this.popupElement=document.createElement("div"),this.render()}return e.prototype.createTitleBar=function(){var e,t,n,i,o,r,a=(null===(t=null===(e=this.config)||void 0===e?void 0:e.config)||void 0===t?void 0:t.title_bar_color)||"#075E54",l=I(a),s=function(e){var t,n;if(null==e?void 0:e.startsWith("#")){var i=e.replace("#",""),o=3===(null==i?void 0:i.length)?null===(n=null===(t=null==i?void 0:i.split(""))||void 0===t?void 0:t.map(function(e){return"".concat(e).concat(e)}))||void 0===n?void 0:n.join(""):i;if(6===(null==o?void 0:o.length)){var r=parseInt(null==o?void 0:o.slice(0,2),16),a=parseInt(null==o?void 0:o.slice(2,4),16),l=parseInt(null==o?void 0:o.slice(4,6),16);return"rgba(".concat(r,", ").concat(a,", ").concat(l,", 0.8)")}}return"#FFFFFF"===e?"rgba(255, 255, 255, 0.8)":"rgba(14, 14, 15, 0.8)"}(l),c=document.createElement("div");Object.assign(c.style,{backgroundColor:a,padding:"16px 18px 14px"});var d=document.createElement("div");d.textContent=(null===(i=null===(n=this.config)||void 0===n?void 0:n.config)||void 0===i?void 0:i.widget_title)||"Hi there",Object.assign(d.style,{color:l,fontSize:"16px",fontWeight:"600",lineHeight:"1.2"});var u=document.createElement("div");return u.textContent=(null===(r=null===(o=this.config)||void 0===o?void 0:o.config)||void 0===r?void 0:r.widget_subtitle)||"We typically reply in minutes",Object.assign(u.style,{color:s,fontSize:"12px",marginTop:"4px"}),c.appendChild(d),c.appendChild(u),c},e.prototype.createContent=function(){var e,t,n,i,o,r,a,l,s=document.createElement("div");Object.assign(s.style,{padding:"20px 16px 16px"});var c=document.createElement("button");Object.assign(c.style,{width:"100%",border:"none",borderRadius:"14px",backgroundColor:(null===(t=null===(e=this.config)||void 0===e?void 0:e.config)||void 0===t?void 0:t.brand_colour)||"#25D366",color:I((null===(i=null===(n=this.config)||void 0===n?void 0:n.config)||void 0===i?void 0:i.brand_colour)||"#25D366"),fontSize:"14px",fontWeight:"600",padding:"10px 16px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",letterSpacing:"0.01em"});var d=document.createElement("img");d.src="https://cdn.robylon.ai/logos/WhatsApp.svg",d.alt="WhatsApp",Object.assign(d.style,{width:"20px",height:"20px",objectFit:"contain"});var u=document.createElement("span");if(u.textContent=(null===(r=null===(o=this.config)||void 0===o?void 0:o.config)||void 0===r?void 0:r.button_content)||"Chat on WhatsApp",c.appendChild(d),c.appendChild(u),c.onclick=this.config.onCtaClick,s.appendChild(c),null===(l=null===(a=this.config)||void 0===a?void 0:a.config)||void 0===l?void 0:l.powered_by_robylon){var p=document.createElement("div");Object.assign(p.style,{textAlign:"center",color:"rgba(14, 14, 15, 0.4)",fontSize:"10px",marginTop:"10px"}),p.appendChild(document.createTextNode("Powered by "));var f=document.createElement("a");f.href="https://www.robylon.ai",f.target="_blank",f.rel="noopener noreferrer",f.textContent="Robylon",Object.assign(f.style,{color:"inherit",textDecoration:"none"}),f.addEventListener("mouseenter",function(){f.style.textDecoration="underline",f.style.color="rgba(14, 14, 15, 0.8)"}),f.addEventListener("mouseleave",function(){f.style.textDecoration="none",f.style.color="inherit"}),p.appendChild(f),s.appendChild(p)}return s},e.prototype.render=function(){this.popupElement.innerHTML="",this.popupElement.className="rblyn-chat-widget-popup",Object.assign(this.popupElement.style,{width:"19rem",maxWidth:"calc(100vw - 19rem)",borderRadius:"22px",overflow:"hidden",backgroundColor:"#fff",boxShadow:"0 16px 40px rgba(14, 14, 15, 0.2)",marginBottom:"14px"});var e=document.createElement("style");e.textContent="\n .rblyn-chat-widget-popup,\n .rblyn-chat-widget-popup * {\n font-family: ".concat(O," !important;\n }\n "),this.popupElement.appendChild(e),this.popupElement.appendChild(this.createTitleBar()),this.popupElement.appendChild(this.createContent())},e.prototype.getElement=function(){return this.popupElement},e.prototype.update=function(e){this.config=e,this.render()},e.prototype.destroy=function(){var e;(null===(e=this.popupElement)||void 0===e?void 0:e.parentNode)&&this.popupElement.parentNode.removeChild(this.popupElement)},e}(),qt=function(e){e.api_key,e.user_profile;var t=e.onEvent;e.chatbotConfig;return{emit:function(e,n){var i={type:e,timestamp:Date.now(),data:n};null==t||t(i)},onInternalEvent:function(e,t){}}},Zt=function(){function e(e){var t=this;this.container=null,this.floatingButton=null,this.launcherDelayTimeout=null,this.popup=null,this.isDestroyed=!1,this.handleStateChange=function(e){var n,i,o,r,a,l,s,c;if(!t.isDestroyed){var d=e.isInitialized,u=e.error,p=e.chatbotConfig,f=e.isIframeVisible,m="chat_widget"===(null==p?void 0:p.widget_type);if(!u&&p&&d){t.eventEmitter=qt({api_key:t.config.api_key,user_profile:t.config.user_profile,onEvent:t.config.onEvent,chatbotConfig:{isAnonymous:p.isAnonymous,userId:p.userId}}),t.container||(t.container=new Kt(p,t.config.position,t.config.sideSpacing,t.config.bottomSpacing)),m&&f?t.popup?t.popup.update({config:p,onCtaClick:t.handlePopupCta}):(t.popup=new Jt({config:p,onCtaClick:t.handlePopupCta}),null===(i=null===(n=t.container)||void 0===n?void 0:n.getElement())||void 0===i||i.prepend(t.popup.getElement())):t.popup&&(t.popup.destroy(),t.popup=null);var h=void 0!==t.config.show_launcher?Boolean(t.config.show_launcher):null===(o=null==p?void 0:p.show_launcher)||void 0===o||o,g=!0===(null===(r=null==p?void 0:p.launcher_delay)||void 0===r?void 0:r.enabled),v=null!==(c=null!==(l=null===(a=null==p?void 0:p.launcher_delay)||void 0===a?void 0:a.seconds)&&void 0!==l?l:null===(s=null==p?void 0:p.launcher_delay)||void 0===s?void 0:s.delay)&&void 0!==c?c:0,y=function(){if(t.floatingButton)t.floatingButton.update({config:p,isIframeVisible:f,position:t.config.position,sideSpacing:t.config.sideSpacing,bottomSpacing:t.config.bottomSpacing,launcher_size:t.config.launcher_size});else if(t.floatingButton=new Yt({config:p,toggleIframe:t.toggleIframe,isIframeVisible:f,onEvent:t.config.onEvent,onInternalEvent:t.eventEmitter.onInternalEvent,position:t.config.position,sideSpacing:t.config.sideSpacing,bottomSpacing:t.config.bottomSpacing,launcher_size:t.config.launcher_size}),t.floatingButton.getElement&&"function"==typeof t.floatingButton.getElement){var e=t.floatingButton.getElement();e&&t.container&&t.container.getElement().appendChild(e)}};t.launcherDelayTimeout&&(clearTimeout(t.launcherDelayTimeout),t.launcherDelayTimeout=null),h?g&&Number(v)>0&&!t.floatingButton?t.launcherDelayTimeout=window.setTimeout(function(){y(),t.launcherDelayTimeout=null},1e3*Number(v)):y():t.floatingButton&&(t.floatingButton.destroy(),t.floatingButton=null)}}},this.toggleIframe=function(){var e,n,i=t.stateManager.getState(),o=null===(e=null==i?void 0:i.chatbotConfig)||void 0===e?void 0:e.redirect_chat_link;"chat_widget"===(null===(n=null==i?void 0:i.chatbotConfig)||void 0===n?void 0:n.widget_type)?(t.stateManager.toggleIframeVisibility(),t.eventEmitter.emit(i.isIframeVisible?x.CHATBOT_CLOSED:x.CHATBOT_BUTTON_CLICKED)):o&&(window.open(o,"_blank","noopener,noreferrer"),t.eventEmitter.emit(x.CHATBOT_BUTTON_CLICKED))},this.handlePopupCta=function(){var e,n=t.stateManager.getState(),i=null===(e=null==n?void 0:n.chatbotConfig)||void 0===e?void 0:e.redirect_chat_link;i&&(window.open(i,"_blank","noopener,noreferrer"),t.eventEmitter.emit(x.CHATBOT_BUTTON_CLICKED)),t.stateManager.closeIframe()};var n=b(b({},e),{position:"string"==typeof e.position?"left"===e.position.toLowerCase()?"Left":"right"===e.position.toLowerCase()?"Right":void 0:void 0,sideSpacing:"string"==typeof e.sideSpacing?""===e.sideSpacing||isNaN(Number(e.sideSpacing))?void 0:Number(e.sideSpacing):e.sideSpacing,bottomSpacing:"string"==typeof e.bottomSpacing?""===e.bottomSpacing||isNaN(Number(e.bottomSpacing))?void 0:Number(e.bottomSpacing):e.bottomSpacing,show_launcher:e.show_launcher,overrides:e.overrides,launcher_size:e.launcher_size});if(this.config=n,!e.api_key)throw ht.trackError(new Error(kt[gt](e.api_key)),"RobylonChatbot",{errorCode:gt,errorType:St,context:{timestamp:Date.now()}}),new Error("API key is required");try{ht.initialize(e.api_key,e.user_id)}catch(e){ht.trackError(e instanceof Error?e:new Error(String(e)),"RobylonChatbot",{errorCode:_t,errorType:St,context:{timestamp:Date.now()}})}this.stateManager=function(e){var t={isInitialized:!1,isInitializing:!1,error:null,chatbotConfig:null,isIframeVisible:!1},n=[],i=function(e){t=b(b({},t),e),n.forEach(function(e){return e(t)})};return{getState:function(){return t},initialize:function(){return _(void 0,void 0,void 0,function(){var t,n,o;return w(this,function(r){switch(r.label){case 0:if(!e.api_key)return ht.trackError(new Error(kt[gt](e.api_key)),"ChatbotStateManager",{errorCode:gt,errorType:St,context:{timestamp:Date.now()}}),[2];i({isInitializing:!0}),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,Ht(e)];case 2:return t=r.sent(),[4,new Promise(function(e,n){Ft(t,function(){i({isInitialized:!0,chatbotConfig:t}),e()},function(e){n(e)})})];case 3:return r.sent(),[3,6];case 4:return n=r.sent(),o=n instanceof Error?n.message:"Failed to initialize chatbot",i({error:o}),ht.trackError(n instanceof Error?n:new Error(o),"ChatbotStateManager",{errorCode:bt,errorType:St,context:{timestamp:Date.now()}}),[3,6];case 5:return i({isInitializing:!1}),[7];case 6:return[2]}})})},toggleIframeVisibility:function(){i({isIframeVisible:!t.isIframeVisible})},closeIframe:function(){i({isIframeVisible:!1})},updateState:i,subscribe:function(e){return n.push(e),function(){var t=n.indexOf(e);t>-1&&n.splice(t,1)}},unsubscribe:function(e){var t=n.indexOf(e);t>-1&&n.splice(t,1)}}}({api_key:e.api_key,user_id:e.user_id,user_token:e.user_token,user_profile:e.user_profile}),this.eventEmitter=qt({api_key:e.api_key,user_profile:e.user_profile,onEvent:e.onEvent,chatbotConfig:null}),this.initialize()}return e.prototype.initialize=function(){return _(this,void 0,void 0,function(){var e;return w(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.stateManager.initialize()];case 1:return t.sent(),this.stateManager.subscribe(this.handleStateChange),this.handleStateChange(this.stateManager.getState()),[3,3];case 2:return e=t.sent(),ht.trackError(e instanceof Error?e:new Error(String(e)),"RobylonChatbot.initialize",{errorCode:bt,errorType:St,context:{timestamp:Date.now()}}),[3,3];case 3:return[2]}})})},e.prototype.show=function(){var e,t,n=this.stateManager.getState();if("chat_widget"===(null===(e=null==n?void 0:n.chatbotConfig)||void 0===e?void 0:e.widget_type))n.isIframeVisible||(this.stateManager.toggleIframeVisibility(),this.eventEmitter.emit(x.CHATBOT_BUTTON_CLICKED));else{var i=null===(t=null==n?void 0:n.chatbotConfig)||void 0===t?void 0:t.redirect_chat_link;i&&(window.open(i,"_blank","noopener,noreferrer"),this.eventEmitter.emit(x.CHATBOT_BUTTON_CLICKED))}},e.prototype.hide=function(){var e,t=this.stateManager.getState();"chat_widget"===(null===(e=null==t?void 0:t.chatbotConfig)||void 0===e?void 0:e.widget_type)&&t.isIframeVisible&&(this.stateManager.closeIframe(),this.eventEmitter.emit(x.CHATBOT_CLOSED))},e.prototype.toggle=function(){this.toggleIframe()},e.prototype.destroy=function(){this.isDestroyed=!0,this.floatingButton&&(this.floatingButton.destroy(),this.floatingButton=null),this.launcherDelayTimeout&&(clearTimeout(this.launcherDelayTimeout),this.launcherDelayTimeout=null),this.popup&&(this.popup.destroy(),this.popup=null),this.container&&(this.container.destroy(),this.container=null),this.stateManager.unsubscribe(this.handleStateChange)},e.prototype.getState=function(){return this.stateManager.getState().isInitialized?"initialized":"uninitialized"},e}();function Qt(e){return new Zt(e)}if("undefined"!=typeof window){!function(){if("undefined"!=typeof window){var e=window,t=(null==e?void 0:e.RobylonChatbot)||(null==e?void 0:e.R);if(t&&Array.isArray(t.q)){var n=null;t.q.forEach(function(e){var t=e[0];if("init"===t){var i=e[1]||{};n=Qt(i)}else n&&"function"==typeof n[t]&&n[t]()}),e.RobylonChatbot=function(e){var t=Array.prototype.slice.call(arguments,1);return"init"===e?n=Qt(t[0]||{}):n&&"function"==typeof n[e]?n[e].apply(n,t):void 0},(null==e?void 0:e.R)||(e.R=e.RobylonChatbot),e.RobylonChatbot.getState=function(){return"initialized"},(null==e?void 0:e.R)&&(e.R.getState=e.RobylonChatbot.getState)}}}();var $t=window,en=null==$t?void 0:$t.RobylonChatbot;en&&!(null==$t?void 0:$t.R)&&($t.R=en)}var tn={create:Qt,getState:function(){return"initialized"}};export{Gt as Chatbot,u as ChatbotInterfaceType,v as ConditionType,h as DisplayAttributesType,f as LauncherType,g as LogicalConditionType,y as MessageDisplayType,m as ProactiveSendTimeType,tn as RobylonChatbot,p as WidgetPositionEnums,Xt as useChatbot};
4
4
  //# sourceMappingURL=index.js.map