@robylon/web-react-sdk 2.0.0-alpha.7 → 2.0.0-alpha.8

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 n,useRef as t,useState as o,useEffect as i,useCallback as r,Component as l,useMemo as a,forwardRef as s,useImperativeHandle as c}from"react";var d=function(e,n){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])},d(e,n)};var u,p,f,v,h,m,g,_,b=function(){return b=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var i in n=arguments[t])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e},b.apply(this,arguments)};function y(e,n,t,o){return new(t||(t=Promise))((function(i,r){function l(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(l,a)}s((o=o.apply(e,n||[])).next())}))}function w(e,n){var t,o,i,r={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return l.next=a(0),l.throw=a(1),l.return=a(2),"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function a(a){return function(s){return function(a){if(t)throw new TypeError("Generator is already executing.");for(;l&&(l=0,a[0]&&(r=0)),r;)try{if(t=1,o&&(i=2&a[0]?o.return:a[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,a[1])).done)return i;switch(o=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,o=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(!(i=r.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){r=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){r.label=a[1];break}if(6===a[0]&&r.label<i[1]){r.label=i[1],i=a;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(a);break}i[2]&&r.ops.pop(),r.trys.pop();continue}a=n.call(e,r)}catch(e){a=[6,e],o=0}finally{t=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}function E(e,n,t){if(t||2===arguments.length)for(var o,i=0,r=n.length;i<r;i++)!o&&i in n||(o||(o=Array.prototype.slice.call(n,0,i)),o[i]=n[i]);return e.concat(o||Array.prototype.slice.call(n))}"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"}(v||(v={})),function(e){e.URL="URL"}(h||(h={})),function(e){e.AND="AND",e.OR="OR"}(m||(m={})),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"}(g||(g={})),function(e){e.BUTTON="BUTTON",e.TEXT="TEXT"}(_||(_={}));var I=function(e,n){void 0===n&&(n=.5);var t=function(e){e=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(e,n,t,o){return n+n+t+t+o+o}));var n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return n?{r:parseInt(n[1],16),g:parseInt(n[2],16),b:parseInt(n[3],16)}:{r:0,g:0,b:0}}(e),o=function(e,n,t){var o=[e,n,t].map((function(e){return(e/=255)<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}));return.2126*o[0]+.7152*o[1]+.0722*o[2]}(t.r,t.g,t.b);return o>n?"#0E0E0F":"#FFFFFF"},T={log:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.log.apply(console,e)},error:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.error.apply(console,e)},warn:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.warn.apply(console,e)},info:function(){}};T.log("Raw API_URL:","https://api.robylon.ai");var S={copilotUrl:"https://chatbot.robylon.ai",environment:"production",apiUrl:"https://api.robylon.ai"};T.log("CONFIG",S);var x,A,C=function(){return"undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement},O=function(){return{copilotUrl:S.copilotUrl||"https://app.robylon.ai",environment:S.environment||"production",apiUrl:S.apiUrl||"https://app.robylon.ai"}};!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"}(A||(A={}));var D,R="system-ui, Inter, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'",N="21px",L="",k=[],M=!1,z=function(){return"undefined"==typeof window?"":window.location.href},P=function(){return z()},H=function(){var e=z();e!==L&&(L=e,k.forEach((function(n){return n(e)})))},F=function(e){return M||U(),k.push(e),e(z()),function(){var n=k.indexOf(e);n>-1&&k.splice(n,1)}},U=function(){if(!M&&"undefined"!=typeof window){M=!0,L=z();var e=function(e){var n=history[e];return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var o=n.apply(this,e);return setTimeout(H,0),o}};try{history.pushState=e("pushState"),history.replaceState=e("replaceState")}catch(e){}window.addEventListener("popstate",H),window.addEventListener("hashchange",H);var n=setInterval((function(){H()}),1e3);setInterval((function(){0===k.length&&(clearInterval(n),window.removeEventListener("popstate",H),window.removeEventListener("hashchange",H),M=!1)}),5e3)}},B=function(e,n,t,o){var i=n||"",r=z(),l=o||r,a=function(e,n){return-1!==n.indexOf(e)}(i,l);switch(t){case g.IS:return l===i;case g.IS_NOT:return l!==i;case g.CONTAINS:return a;case g.DOES_NOT_CONTAIN:return!a;case g.STARTS_WITH:return l.startsWith(i);case g.ENDS_WITH:return l.endsWith(i);default:return!1}},W=null,j=null,V=function(){W=P()},G=function(){return W===P()},Y=function(e){j=b({input_id:null},e)},K=function(){var e=j;return j=null,e},X=function(){return!0},q=((D={})[v.WORKING_HOURS]=function(e,n){var t=n.getHours(),o=n.getMinutes();return(t>10||10===t&&o>=0)&&(t<19||19===t&&0===o)},D[v.ALWAYS]=X,D),J=function(e){if(!e||G())return[];var n=z(),t=new Date,o=[];return e.forEach((function(e){o.push.apply(o,function(e,n,t){var o=(null==e?void 0:e.send_time_type)||"",i=o?q[o]:X;if(!i||!i(e,t))return[];for(var r=(null==e?void 0:e.content_multiple)||[],l=(null==e?void 0:e.delay_type)||"time",a="time"===l?Math.max(0,1e3*Number((null==e?void 0:e.delay)||0)):0,s="scroll"===l?Number((null==e?void 0:e.scroll_threshold)||0):void 0,c=[],d=0;d<r.length;d++){for(var u=r[d],p=(null==u?void 0:u.message_display_attributes)||[],f=null,v=m.OR,h=0,g=p;h<g.length;h++){var b=g[h];if(null==b?void 0:b.logical_condition)v=b.logical_condition;else{var y=b,w=B(null==y||y.type,(null==y?void 0:y.value)||"",null==y?void 0:y.condition,n);f=null===f?w:v===m.AND?f&&w:f||w}}(null===f||f)&&(null==u?void 0:u.message)&&c.push({messageId:(null==e?void 0:e.message_id)||String(d),contentIndex:d,html:String(u.message),delayMs:a,delayType:l,scrollThreshold:s,contentId:u.content_id||null,messageDisplayType:(null==u?void 0:u.message_display_type)||_.TEXT,messageBubbleBg:null==u?void 0:u.message_bubble_bg,urlToGo:null==u?void 0:u.url_to_go})}return c}(e,n,t))})),o};
2
2
  /*! @license DOMPurify 3.3.0 | (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.0/LICENSE */
3
- const{entries:Z,setPrototypeOf:Q,isFrozen:$,getPrototypeOf:ee,getOwnPropertyDescriptor:ne}=Object;let{freeze:te,seal:oe,create:ie}=Object,{apply:re,construct:le}="undefined"!=typeof Reflect&&Reflect;te||(te=function(e){return e}),oe||(oe=function(e){return e}),re||(re=function(e,n){for(var t=arguments.length,o=new Array(t>2?t-2:0),i=2;i<t;i++)o[i-2]=arguments[i];return e.apply(n,o)}),le||(le=function(e){for(var n=arguments.length,t=new Array(n>1?n-1:0),o=1;o<n;o++)t[o-1]=arguments[o];return new e(...t)});const ae=Ee(Array.prototype.forEach),se=Ee(Array.prototype.lastIndexOf),ce=Ee(Array.prototype.pop),de=Ee(Array.prototype.push),ue=Ee(Array.prototype.splice),pe=Ee(String.prototype.toLowerCase),fe=Ee(String.prototype.toString),ve=Ee(String.prototype.match),he=Ee(String.prototype.replace),me=Ee(String.prototype.indexOf),ge=Ee(String.prototype.trim),_e=Ee(Object.prototype.hasOwnProperty),be=Ee(RegExp.prototype.test),ye=(we=TypeError,function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return le(we,n)});var we;function Ee(e){return function(n){n instanceof RegExp&&(n.lastIndex=0);for(var t=arguments.length,o=new Array(t>1?t-1:0),i=1;i<t;i++)o[i-1]=arguments[i];return re(e,n,o)}}function Ie(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:pe;Q&&Q(e,null);let o=n.length;for(;o--;){let i=n[o];if("string"==typeof i){const e=t(i);e!==i&&($(n)||(n[o]=e),i=e)}e[i]=!0}return e}function Te(e){for(let n=0;n<e.length;n++){_e(e,n)||(e[n]=null)}return e}function Se(e){const n=ie(null);for(const[t,o]of Z(e)){_e(e,t)&&(Array.isArray(o)?n[t]=Te(o):o&&"object"==typeof o&&o.constructor===Object?n[t]=Se(o):n[t]=o)}return n}function xe(e,n){for(;null!==e;){const t=ne(e,n);if(t){if(t.get)return Ee(t.get);if("function"==typeof t.value)return Ee(t.value)}e=ee(e)}return function(){return null}}const Ae=te(["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"]),Ce=te(["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"]),Oe=te(["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"]),De=te(["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"]),Re=te(["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"]),Ne=te(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Le=te(["#text"]),ke=te(["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"]),Me=te(["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"]),ze=te(["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"]),Pe=te(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),He=oe(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Fe=oe(/<%[\w\W]*|[\w\W]*%>/gm),Ue=oe(/\$\{[\w\W]*/gm),Be=oe(/^data-[\-\w.\u00B7-\uFFFF]+$/),We=oe(/^aria-[\-\w]+$/),je=oe(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ve=oe(/^(?:\w+script|data):/i),Ge=oe(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ye=oe(/^html$/i),Ke=oe(/^[a-z][.\w]*(-[.\w]+)+$/i);var Xe=Object.freeze({__proto__:null,ARIA_ATTR:We,ATTR_WHITESPACE:Ge,CUSTOM_ELEMENT:Ke,DATA_ATTR:Be,DOCTYPE_NAME:Ye,ERB_EXPR:Fe,IS_ALLOWED_URI:je,IS_SCRIPT_OR_DATA:Ve,MUSTACHE_EXPR:He,TMPLIT_EXPR:Ue});const qe=1,Je=3,Ze=7,Qe=8,$e=9,en=function(){return"undefined"==typeof window?null:window};var nn=function e(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:en();const t=n=>e(n);if(t.version="3.3.0",t.removed=[],!n||!n.document||n.document.nodeType!==$e||!n.Element)return t.isSupported=!1,t;let{document:o}=n;const i=o,r=i.currentScript,{DocumentFragment:l,HTMLTemplateElement:a,Node:s,Element:c,NodeFilter:d,NamedNodeMap:u=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:p,DOMParser:f,trustedTypes:v}=n,h=c.prototype,m=xe(h,"cloneNode"),g=xe(h,"remove"),_=xe(h,"nextSibling"),b=xe(h,"childNodes"),y=xe(h,"parentNode");if("function"==typeof a){const e=o.createElement("template");e.content&&e.content.ownerDocument&&(o=e.content.ownerDocument)}let w,E="";const{implementation:I,createNodeIterator:T,createDocumentFragment:S,getElementsByTagName:x}=o,{importNode:A}=i;let C={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};t.isSupported="function"==typeof Z&&"function"==typeof y&&I&&void 0!==I.createHTMLDocument;const{MUSTACHE_EXPR:O,ERB_EXPR:D,TMPLIT_EXPR:R,DATA_ATTR:N,ARIA_ATTR:L,IS_SCRIPT_OR_DATA:k,ATTR_WHITESPACE:M,CUSTOM_ELEMENT:z}=Xe;let{IS_ALLOWED_URI:P}=Xe,H=null;const F=Ie({},[...Ae,...Ce,...Oe,...Re,...Le]);let U=null;const B=Ie({},[...ke,...Me,...ze,...Pe]);let W=Object.seal(ie(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}})),j=null,V=null;const G=Object.seal(ie(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Y=!0,K=!0,X=!1,q=!0,J=!1,Q=!0,$=!1,ee=!1,ne=!1,oe=!1,re=!1,le=!1,we=!0,Ee=!1,Te=!0,He=!1,Fe={},Ue=null;const Be=Ie({},["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 We=null;const Ve=Ie({},["audio","video","img","source","image","track"]);let Ge=null;const Ke=Ie({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),nn="http://www.w3.org/1998/Math/MathML",tn="http://www.w3.org/2000/svg",on="http://www.w3.org/1999/xhtml";let rn=on,ln=!1,an=null;const sn=Ie({},[nn,tn,on],fe);let cn=Ie({},["mi","mo","mn","ms","mtext"]),dn=Ie({},["annotation-xml"]);const un=Ie({},["title","style","font","a","script"]);let pn=null;const fn=["application/xhtml+xml","text/html"];let vn=null,hn=null;const mn=o.createElement("form"),gn=function(e){return e instanceof RegExp||e instanceof Function},_n=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!hn||hn!==e){if(e&&"object"==typeof e||(e={}),e=Se(e),pn=-1===fn.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,vn="application/xhtml+xml"===pn?fe:pe,H=_e(e,"ALLOWED_TAGS")?Ie({},e.ALLOWED_TAGS,vn):F,U=_e(e,"ALLOWED_ATTR")?Ie({},e.ALLOWED_ATTR,vn):B,an=_e(e,"ALLOWED_NAMESPACES")?Ie({},e.ALLOWED_NAMESPACES,fe):sn,Ge=_e(e,"ADD_URI_SAFE_ATTR")?Ie(Se(Ke),e.ADD_URI_SAFE_ATTR,vn):Ke,We=_e(e,"ADD_DATA_URI_TAGS")?Ie(Se(Ve),e.ADD_DATA_URI_TAGS,vn):Ve,Ue=_e(e,"FORBID_CONTENTS")?Ie({},e.FORBID_CONTENTS,vn):Be,j=_e(e,"FORBID_TAGS")?Ie({},e.FORBID_TAGS,vn):Se({}),V=_e(e,"FORBID_ATTR")?Ie({},e.FORBID_ATTR,vn):Se({}),Fe=!!_e(e,"USE_PROFILES")&&e.USE_PROFILES,Y=!1!==e.ALLOW_ARIA_ATTR,K=!1!==e.ALLOW_DATA_ATTR,X=e.ALLOW_UNKNOWN_PROTOCOLS||!1,q=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,J=e.SAFE_FOR_TEMPLATES||!1,Q=!1!==e.SAFE_FOR_XML,$=e.WHOLE_DOCUMENT||!1,oe=e.RETURN_DOM||!1,re=e.RETURN_DOM_FRAGMENT||!1,le=e.RETURN_TRUSTED_TYPE||!1,ne=e.FORCE_BODY||!1,we=!1!==e.SANITIZE_DOM,Ee=e.SANITIZE_NAMED_PROPS||!1,Te=!1!==e.KEEP_CONTENT,He=e.IN_PLACE||!1,P=e.ALLOWED_URI_REGEXP||je,rn=e.NAMESPACE||on,cn=e.MATHML_TEXT_INTEGRATION_POINTS||cn,dn=e.HTML_INTEGRATION_POINTS||dn,W=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&gn(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(W.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&gn(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(W.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(W.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),J&&(K=!1),re&&(oe=!0),Fe&&(H=Ie({},Le),U=[],!0===Fe.html&&(Ie(H,Ae),Ie(U,ke)),!0===Fe.svg&&(Ie(H,Ce),Ie(U,Me),Ie(U,Pe)),!0===Fe.svgFilters&&(Ie(H,Oe),Ie(U,Me),Ie(U,Pe)),!0===Fe.mathMl&&(Ie(H,Re),Ie(U,ze),Ie(U,Pe))),e.ADD_TAGS&&("function"==typeof e.ADD_TAGS?G.tagCheck=e.ADD_TAGS:(H===F&&(H=Se(H)),Ie(H,e.ADD_TAGS,vn))),e.ADD_ATTR&&("function"==typeof e.ADD_ATTR?G.attributeCheck=e.ADD_ATTR:(U===B&&(U=Se(U)),Ie(U,e.ADD_ATTR,vn))),e.ADD_URI_SAFE_ATTR&&Ie(Ge,e.ADD_URI_SAFE_ATTR,vn),e.FORBID_CONTENTS&&(Ue===Be&&(Ue=Se(Ue)),Ie(Ue,e.FORBID_CONTENTS,vn)),Te&&(H["#text"]=!0),$&&Ie(H,["html","head","body"]),H.table&&(Ie(H,["tbody"]),delete j.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw ye('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw ye('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,n){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let t=null;const o="data-tt-policy-suffix";n&&n.hasAttribute(o)&&(t=n.getAttribute(o));const i="dompurify"+(t?"#"+t:"");try{return e.createPolicy(i,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+i+" could not be created."),null}}(v,r)),null!==w&&"string"==typeof E&&(E=w.createHTML(""));te&&te(e),hn=e}},bn=Ie({},[...Ce,...Oe,...De]),yn=Ie({},[...Re,...Ne]),wn=function(e){de(t.removed,{element:e});try{y(e).removeChild(e)}catch(n){g(e)}},En=function(e,n){try{de(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch(e){de(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),"is"===e)if(oe||re)try{wn(n)}catch(e){}else try{n.setAttribute(e,"")}catch(e){}},In=function(e){let n=null,t=null;if(ne)e="<remove></remove>"+e;else{const n=ve(e,/^[\r\n\t ]+/);t=n&&n[0]}"application/xhtml+xml"===pn&&rn===on&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const i=w?w.createHTML(e):e;if(rn===on)try{n=(new f).parseFromString(i,pn)}catch(e){}if(!n||!n.documentElement){n=I.createDocument(rn,"template",null);try{n.documentElement.innerHTML=ln?E:i}catch(e){}}const r=n.body||n.documentElement;return e&&t&&r.insertBefore(o.createTextNode(t),r.childNodes[0]||null),rn===on?x.call(n,$?"html":"body")[0]:$?n.documentElement:r},Tn=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)},Sn=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)},xn=function(e){return"function"==typeof s&&e instanceof s};function An(e,n,o){ae(e,(e=>{e.call(t,n,o,hn)}))}const Cn=function(e){let n=null;if(An(C.beforeSanitizeElements,e,null),Sn(e))return wn(e),!0;const o=vn(e.nodeName);if(An(C.uponSanitizeElement,e,{tagName:o,allowedTags:H}),Q&&e.hasChildNodes()&&!xn(e.firstElementChild)&&be(/<[/\w!]/g,e.innerHTML)&&be(/<[/\w!]/g,e.textContent))return wn(e),!0;if(e.nodeType===Ze)return wn(e),!0;if(Q&&e.nodeType===Qe&&be(/<[/\w]/g,e.data))return wn(e),!0;if(!(G.tagCheck instanceof Function&&G.tagCheck(o))&&(!H[o]||j[o])){if(!j[o]&&Dn(o)){if(W.tagNameCheck instanceof RegExp&&be(W.tagNameCheck,o))return!1;if(W.tagNameCheck instanceof Function&&W.tagNameCheck(o))return!1}if(Te&&!Ue[o]){const n=y(e)||e.parentNode,t=b(e)||e.childNodes;if(t&&n){for(let o=t.length-1;o>=0;--o){const i=m(t[o],!0);i.__removalCount=(e.__removalCount||0)+1,n.insertBefore(i,_(e))}}}return wn(e),!0}return e instanceof c&&!function(e){let n=y(e);n&&n.tagName||(n={namespaceURI:rn,tagName:"template"});const t=pe(e.tagName),o=pe(n.tagName);return!!an[e.namespaceURI]&&(e.namespaceURI===tn?n.namespaceURI===on?"svg"===t:n.namespaceURI===nn?"svg"===t&&("annotation-xml"===o||cn[o]):Boolean(bn[t]):e.namespaceURI===nn?n.namespaceURI===on?"math"===t:n.namespaceURI===tn?"math"===t&&dn[o]:Boolean(yn[t]):e.namespaceURI===on?!(n.namespaceURI===tn&&!dn[o])&&!(n.namespaceURI===nn&&!cn[o])&&!yn[t]&&(un[t]||!bn[t]):!("application/xhtml+xml"!==pn||!an[e.namespaceURI]))}(e)?(wn(e),!0):"noscript"!==o&&"noembed"!==o&&"noframes"!==o||!be(/<\/no(script|embed|frames)/i,e.innerHTML)?(J&&e.nodeType===Je&&(n=e.textContent,ae([O,D,R],(e=>{n=he(n,e," ")})),e.textContent!==n&&(de(t.removed,{element:e.cloneNode()}),e.textContent=n)),An(C.afterSanitizeElements,e,null),!1):(wn(e),!0)},On=function(e,n,t){if(we&&("id"===n||"name"===n)&&(t in o||t in mn))return!1;if(K&&!V[n]&&be(N,n));else if(Y&&be(L,n));else if(G.attributeCheck instanceof Function&&G.attributeCheck(n,e));else if(!U[n]||V[n]){if(!(Dn(e)&&(W.tagNameCheck instanceof RegExp&&be(W.tagNameCheck,e)||W.tagNameCheck instanceof Function&&W.tagNameCheck(e))&&(W.attributeNameCheck instanceof RegExp&&be(W.attributeNameCheck,n)||W.attributeNameCheck instanceof Function&&W.attributeNameCheck(n,e))||"is"===n&&W.allowCustomizedBuiltInElements&&(W.tagNameCheck instanceof RegExp&&be(W.tagNameCheck,t)||W.tagNameCheck instanceof Function&&W.tagNameCheck(t))))return!1}else if(Ge[n]);else if(be(P,he(t,M,"")));else if("src"!==n&&"xlink:href"!==n&&"href"!==n||"script"===e||0!==me(t,"data:")||!We[e]){if(X&&!be(k,he(t,M,"")));else if(t)return!1}else;return!0},Dn=function(e){return"annotation-xml"!==e&&ve(e,z)},Rn=function(e){An(C.beforeSanitizeAttributes,e,null);const{attributes:n}=e;if(!n||Sn(e))return;const o={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:U,forceKeepAttr:void 0};let i=n.length;for(;i--;){const r=n[i],{name:l,namespaceURI:a,value:s}=r,c=vn(l),d=s;let u="value"===l?d:ge(d);if(o.attrName=c,o.attrValue=u,o.keepAttr=!0,o.forceKeepAttr=void 0,An(C.uponSanitizeAttribute,e,o),u=o.attrValue,!Ee||"id"!==c&&"name"!==c||(En(l,e),u="user-content-"+u),Q&&be(/((--!?|])>)|<\/(style|title|textarea)/i,u)){En(l,e);continue}if("attributename"===c&&ve(u,"href")){En(l,e);continue}if(o.forceKeepAttr)continue;if(!o.keepAttr){En(l,e);continue}if(!q&&be(/\/>/i,u)){En(l,e);continue}J&&ae([O,D,R],(e=>{u=he(u,e," ")}));const p=vn(e.nodeName);if(On(p,c,u)){if(w&&"object"==typeof v&&"function"==typeof v.getAttributeType)if(a);else switch(v.getAttributeType(p,c)){case"TrustedHTML":u=w.createHTML(u);break;case"TrustedScriptURL":u=w.createScriptURL(u)}if(u!==d)try{a?e.setAttributeNS(a,l,u):e.setAttribute(l,u),Sn(e)?wn(e):ce(t.removed)}catch(n){En(l,e)}}else En(l,e)}An(C.afterSanitizeAttributes,e,null)},Nn=function e(n){let t=null;const o=Tn(n);for(An(C.beforeSanitizeShadowDOM,n,null);t=o.nextNode();)An(C.uponSanitizeShadowNode,t,null),Cn(t),Rn(t),t.content instanceof l&&e(t.content);An(C.afterSanitizeShadowDOM,n,null)};return t.sanitize=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=null,r=null,a=null,c=null;if(ln=!e,ln&&(e="\x3c!--\x3e"),"string"!=typeof e&&!xn(e)){if("function"!=typeof e.toString)throw ye("toString is not a function");if("string"!=typeof(e=e.toString()))throw ye("dirty is not a string, aborting")}if(!t.isSupported)return e;if(ee||_n(n),t.removed=[],"string"==typeof e&&(He=!1),He){if(e.nodeName){const n=vn(e.nodeName);if(!H[n]||j[n])throw ye("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof s)o=In("\x3c!----\x3e"),r=o.ownerDocument.importNode(e,!0),r.nodeType===qe&&"BODY"===r.nodeName||"HTML"===r.nodeName?o=r:o.appendChild(r);else{if(!oe&&!J&&!$&&-1===e.indexOf("<"))return w&&le?w.createHTML(e):e;if(o=In(e),!o)return oe?null:le?E:""}o&&ne&&wn(o.firstChild);const d=Tn(He?e:o);for(;a=d.nextNode();)Cn(a),Rn(a),a.content instanceof l&&Nn(a.content);if(He)return e;if(oe){if(re)for(c=S.call(o.ownerDocument);o.firstChild;)c.appendChild(o.firstChild);else c=o;return(U.shadowroot||U.shadowrootmode)&&(c=A.call(i,c,!0)),c}let u=$?o.outerHTML:o.innerHTML;return $&&H["!doctype"]&&o.ownerDocument&&o.ownerDocument.doctype&&o.ownerDocument.doctype.name&&be(Ye,o.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+o.ownerDocument.doctype.name+">\n"+u),J&&ae([O,D,R],(e=>{u=he(u,e," ")})),w&&le?w.createHTML(u):u},t.setConfig=function(){_n(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),ee=!0},t.clearConfig=function(){hn=null,ee=!1},t.isValidAttribute=function(e,n,t){hn||_n({});const o=vn(e),i=vn(n);return On(o,i,t)},t.addHook=function(e,n){"function"==typeof n&&de(C[e],n)},t.removeHook=function(e,n){if(void 0!==n){const t=se(C[e],n);return-1===t?void 0:ue(C[e],t,1)[0]}return ce(C[e])},t.removeHooks=function(e){C[e]=[]},t.removeAllHooks=function(){C={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},t}(),tn=function(e){return e?nn.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 on(e){if(!e||"string"!=typeof e||0===e.trim().length)return"ltr";var n=e.replace(/<[^>]*>/g,"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_`#]/g,"").trim();if(0===n.length)return"ltr";for(var t=/[\u0590-\u05FF\u0600-\u06FF\u0700-\u074F\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]/,o=0,i=0,r=0,l=n;r<l.length;r++){var a=l[r];/\s|\d|[.,;:!?()[\]{}'"`\-_=+*/\\|@#$%^&*~]/.test(a)||(i++,t.test(a)&&o++)}return 0===i?"ltr":o/i>.3?"rtl":"ltr"}var rn,ln=n((function(n){var r,l,a,s,c,d,u,p,v,h,m,g,y,w,S,A,C,D,L,k,M=n.config,z=n.toggleIframe,P=n.isIframeVisible,H=n.onEvent,U=n.onInternalEvent,B=n.position,W=n.sideSpacing,j=n.bottomSpacing,K=n.launcher_type,X=n.launcher_properties_text,q=n.shouldFadeIn,Z=n.launcher_size,Q=t(null),$=O().copilotUrl,ee=o(!1),ne=ee[0],te=ee[1],oe=o(!1),ie=oe[0],re=oe[1],le=o([]),ae=le[0],se=le[1],ce=o(!1),de=ce[0],ue=ce[1],pe=t([]),fe=t(),ve=t(new Set),he=t(new Map),me=t(new Set),ge=null!==(a=null==M?void 0:M.launcher_size_multiplier)&&void 0!==a?a:1,_e=null!=Z?Z:48*ge;i((function(){var e=function(){var e=(null===window||void 0===window?void 0:window.innerWidth)<560;te(e)};return e(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[]),i((function(){Q.current&&requestAnimationFrame((function(){null==H||H({type:x.CHATBOT_BUTTON_LOADED,timestamp:Date.now()}),U(x.CHATBOT_BUTTON_LOADED)}))}),[H,U]),i((function(){if(Q.current&&q){Q.current.style.opacity="0";var e=requestAnimationFrame((function(){Q.current&&(Q.current.style.opacity="1")}));return function(){return cancelAnimationFrame(e)}}}),[q]);var be=(null==M?void 0:M.launcher_type)?(null===(c=null===(s=null==M?void 0:M.images)||void 0===s?void 0:s.launcher_image_url)||void 0===c?void 0:c.url)||"".concat($,"/chatbubble.png"):(null==M?void 0:M.image_url)||"".concat($,"/chatbubble.png"),ye=function(){return e.createElement("div",{style:{position:"relative",width:"100%",height:"100%"}},e.createElement("img",{src:be,alt:"Chat","aria-hidden":P,style:{zIndex:1e3,cursor:"pointer",borderRadius:"50%",objectFit:"cover",width:"100%",height:"100%",boxSizing:"border-box",position:"absolute",inset:0,opacity:P?0:1}}),P?(n=Math.round(.5*_e),e.createElement("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center"}},e.createElement("svg",{width:n,height:n,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"}))))):null);var n},we=B||(null===(d=M.interface_properties)||void 0===d?void 0:d.position)||"Right",Ee=null!==(p=null!=W?W:null===(u=M.interface_properties)||void 0===u?void 0:u.side_spacing)&&void 0!==p?p:20,Ie=null!==(h=null!=j?j:null===(v=M.interface_properties)||void 0===v?void 0:v.bottom_spacing)&&void 0!==h?h:20,Te=K||(null==M?void 0:M.launcher_type)||f.IMAGE,Se=X||(null===(m=null==M?void 0:M.launcher_properties)||void 0===m?void 0:m.text),xe={zIndex:1e3,display:"flex",flexDirection:"column-reverse",alignItems:"center",justifyContent:"center",cursor:"pointer",overflow:"hidden",marginTop:"16px",boxSizing:"border-box"};Te===f.IMAGE&&(xe.width="".concat(_e,"px"),xe.height="".concat(_e,"px"),xe.borderRadius="50%",xe.backgroundColor=M.brand_colour);var Ae=b(b({},xe),((r={position:void 0,bottom:"0",borderRadius:Te===f.IMAGE?"50%":"9999px"})[we.toLowerCase()]="0",r)),Ce=b(b({},xe),((l={position:"fixed",bottom:"".concat(Ie,"px"),borderRadius:Te===f.IMAGE?"50%":"9999px"})[we.toLowerCase()]="".concat(Ee,"px"),l)),Oe=ne?Ce:Ae;i((function(){T.log("Screen width changed, isMobile:",ne,"Style:",Oe)}),[ne,Oe]),T.log("config in floating button",M);i((function(){var e=function(){pe.current.forEach((function(e){return clearTimeout(e)})),pe.current=[]},n=function(){he.current.forEach((function(e){window.removeEventListener("scroll",e)})),he.current.clear(),me.current.clear()},t=function(e,n,t){se((function(o){var i=[];return e.forEach((function(e){(n.get(e)||[]).forEach((function(e){var n="".concat(e.messageId,"-").concat(e.contentIndex);if(!o.some((function(n){return n.id===e.messageId&&n.index===e.contentIndex}))){var t={id:e.messageId,index:e.contentIndex,html:e.html,contentId:e.contentId,messageDisplayType:e.messageDisplayType,messageBubbleBg:null==e?void 0:e.messageBubbleBg,urlToGo:null==e?void 0:e.urlToGo};i.push(t),ve.current.add(n),setTimeout((function(){ve.current.delete(n)}),1200)}}))})),0===t?E(E([],o,!0),i,!0):E(E([],i,!0),o,!0)}))},o=function(){if(e(),n(),se([]),ve.current.clear(),(null==M?void 0:M.proactive_message_obj)&&!G()){var o=J(null==M?void 0:M.proactive_message_obj),i=[],r=[];o.forEach((function(e){"scroll"===e.delayType&&void 0!==e.scrollThreshold&&Number(e.scrollThreshold)>0?r.push(e):i.push(e)}));var l=new Map;i.forEach((function(e){var n=l.get(e.delayMs);n||(n={messageIds:[],groups:new Map},l.set(e.delayMs,n)),n.groups.has(e.messageId)||(n.messageIds.push(e.messageId),n.groups.set(e.messageId,[])),n.groups.get(e.messageId).push(e)})),l.forEach((function(e,n){var o=e.messageIds,i=e.groups,r=window.setTimeout((function(){t(o,i,n)}),n);pe.current.push(r)}));var a=new Map;r.forEach((function(e){var n=e.scrollThreshold||0,t=a.get(n);t||(t={messageIds:[],groups:new Map},a.set(n,t)),t.groups.has(e.messageId)||(t.messageIds.push(e.messageId),t.groups.set(e.messageId,[])),t.groups.get(e.messageId).push(e)})),a.forEach((function(e,n){var o=e.messageIds,i=e.groups,r="scroll-".concat(n),l=function(){if((window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0)>=n&&!me.current.has(r)){me.current.add(r),t(o,i,1);var e=he.current.get(r);e&&(window.removeEventListener("scroll",e),he.current.delete(r))}};l();var a=l;he.current.set(r,a),window.addEventListener("scroll",a,{passive:!0})}))}};return fe.current=F((function(){re(!1),o()})),o(),function(){var t;e(),n(),null===(t=fe.current)||void 0===t||t.call(fe)}}),[null==M?void 0:M.proactive_message_obj]);var De=ae.length>0&&!P&&!ie,Re="Right"===(B||(null===(g=M.interface_properties)||void 0===g?void 0:g.position)||"Right"),Ne=function(){ue(!0),setTimeout((function(){re(!0),V(),ue(!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(R,';\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 ')),De?e.createElement("div",{className:"proactive-message-container",style:{position:"fixed",bottom:"".concat((null!==(w=null!=j?j:null===(y=M.interface_properties)||void 0===y?void 0:y.bottom_spacing)&&void 0!==w?w:20)+(Te===f.IMAGE?_e:void 0!==Z?40:40*ge)+8,"px"),right:Re?"".concat(null!==(A=null!=W?W:null===(S=M.interface_properties)||void 0===S?void 0:S.side_spacing)&&void 0!==A?A:20,"px"):"auto",left:Re?"auto":"".concat(null!==(D=null!=W?W:null===(C=M.interface_properties)||void 0===C?void 0:C.side_spacing)&&void 0!==D?D:20,"px"),maxWidth:"22.875rem",zIndex:2147483646}},e.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:Re?"flex-end":"flex-start"},className:"proactive-message-bubble-container"},ae.map((function(n,t){var o="".concat(n.id,"-").concat(n.index),i=ve.current.has(o),r=10*(ae.length-1-t),l=n.messageDisplayType===_.BUTTON;return console.log("visibleProactives",ae),e.createElement("div",{key:o,onClick:function(){if((null==n?void 0:n.urlToGo)&&"string"==typeof n.urlToGo&&""!==n.urlToGo.trim())window.open(n.urlToGo,"_blank","noopener,noreferrer");else{Y({message_id:n.id,content_string:n.html||null,content_id:n.contentId||null}),z(),Ne();try{window.dispatchEvent(new CustomEvent("rblyn:proactiveClick",{detail:{message_id:n.id,content_string:n.html||null,content_id:n.contentId||null}}))}catch(e){}}},className:de?Re?"proactive-bubble-exit-right":"proactive-bubble-exit-left":i&&!de?Re?"proactive-bubble-enter-right":"proactive-bubble-enter-left":"",style:b({background:(null==n?void 0:n.messageBubbleBg)||"#ffffff",color:"#111",borderRadius:l?"100px":"12px",boxShadow:"0 2px 2px 0 rgba(0, 0, 0, 0.08)",padding:"16px",cursor:"pointer",fontFamily:R,lineHeight:N,fontSize:"14px",marginBottom:t<ae.length-1?16:0,border:"1px solid #F1F2F4",width:"fit-content",maxWidth:"100%",animationDelay:de?"0ms":i?"".concat(r,"ms"):void 0},de?{opacity:0}:i?{opacity:0,transform:Re?"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:on(n.html),dangerouslySetInnerHTML:{__html:tn(n.html)}}),(null==n?void 0:n.urlToGo)&&"string"==typeof n.urlToGo&&""!==n.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==n?void 0:n.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(),Ne()},className:de?"":Re?"proactive-close-enter-right":"proactive-close-enter-left",style:b({position:"absolute",top:"-32px",right:"Right"===(B||(null===(L=M.interface_properties)||void 0===L?void 0:L.position)||"Right")?"0px":"auto",left:"Left"===(B||(null===(k=M.interface_properties)||void 0===k?void 0:k.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:de?"0ms":"".concat(10*(ae.length-1),"ms")},de?{}:{opacity:0,transform:Re?"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:Q,className:"message-bubble-container",style:b(b({},Oe),{transition:"transform 0.2s cubic-bezier(0.2, 1.27, 0.29, 0.97), opacity 280ms ease",transform:P?"scale(0.85)":"scale(1)",opacity:q?0:1}),onClick:function(){z(),Ne()}},function(){switch(Te){case f.TEXT:return n=void 0!==Z?void 0:160*ge,t=void 0!==Z?void 0:40*ge,o=void 0!==Z?void 0:14*ge,i=void 0!==Z?void 0:21*ge,e.createElement("div",{style:{width:void 0!==n?"".concat(n,"px"):"fit-content",maxWidth:void 0!==n?"".concat(n,"px"):"160px",height:void 0!==t?"".concat(t,"px"):"40px",borderRadius:"9999px",backgroundColor:M.brand_colour,display:"flex",alignItems:"center",padding:"9px 20px",boxShadow:"0px 0px 16px 0px rgba(0, 0, 0, 0.24)",boxSizing:"border-box",fontFamily:R,lineHeight:N}},e.createElement("div",{style:{flex:1,minWidth:0}},e.createElement("p",{dir:on(Se),style:{margin:0,color:I(M.brand_colour),fontSize:void 0!==o?"".concat(o,"px"):"0.875rem",fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:R,lineHeight:void 0!==i?"".concat(i,"px"):N,textAlign:"center",WebkitFontSmoothing:"antialiased",textRendering:"optimizeLegibility",textSizeAdjust:"100%"}},Se)));case f.TEXTUAL_IMAGE:return function(){var n,t,o=void 0!==Z?void 0:174*ge,i=void 0!==Z?void 0:40*ge,r=void 0!==Z?void 0:40*ge,l=void 0!==Z?void 0:14*ge,a=void 0!==Z?void 0:21*ge;return e.createElement("div",{style:{maxWidth:void 0!==o?"".concat(o,"px"):"13rem",width:"fit-content",height:void 0!==i?"".concat(i,"px"):"40px",borderRadius:"9999px",backgroundColor:M.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:R,lineHeight:N}},e.createElement("div",{style:{flex:1,minWidth:0}},e.createElement("p",{dir:on(Se),style:{margin:0,color:I(M.brand_colour),fontSize:void 0!==l?"".concat(l,"px"):"0.875rem",fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:R,lineHeight:void 0!==a?"".concat(a,"px"):N,textAlign:"right",WebkitFontSmoothing:"antialiased",textRendering:"optimizeLegibility",textSizeAdjust:"100%"}},Se)),e.createElement("div",{style:{width:void 0!==r?"".concat(r,"px"):"40px",height:void 0!==r?"".concat(r,"px"):"40px",borderRadius:"9999px",overflow:"hidden",position:"relative",flexShrink:0}},e.createElement("img",{src:(null==M?void 0:M.launcher_type)?(null===(t=null===(n=null==M?void 0:M.images)||void 0===n?void 0:n.launcher_image_url)||void 0===t?void 0:t.url)||"".concat($,"/chatbubble.png"):(null==M?void 0:M.image_url)||"".concat($,"/chatbubble.png"),alt:"Chat",style:{width:"100%",height:"100%",objectFit:"cover"}})))}();case f.IMAGE:default:return ye()}var n,t,o,i}()))})),an=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]},sn=function(){var e;if(null===(e=navigator.userAgentData)||void 0===e?void 0:e.brands)for(var n=["Chrome","Firefox","Safari","Edge","Opera"],t=0,o=navigator.userAgentData.brands;t<o.length;t++){var i=o[t];if(n.includes(i.brand))return i.brand}return(/Chrome|Firefox|Safari|Edge|Opera/.exec(navigator.userAgent)||["Unknown"])[0]},cn=function(){var e,n,t,o;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===(n=null===document||void 0===document?void 0:document.body)||void 0===n?void 0:n.clientWidth),height:(null===window||void 0===window?void 0:window.innerHeight)||(null===(t=null===document||void 0===document?void 0:document.documentElement)||void 0===t?void 0:t.clientHeight)||(null===(o=null===document||void 0===document?void 0:document.body)||void 0===o?void 0:o.clientHeight)}},dn=function(){return{platform:"web",os:an(),browser:sn(),sdk_version:"2.0.0-alpha.7",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:cn()};var e};!function(e){e.ERROR="ERROR",e.INFO="INFO"}(rn||(rn={}));var un,pn,fn=["@robylon/web-react-sdk","node_modules/@robylon/web-react-sdk/"],vn=function(e){var n=e.filename,t=e.stack,o=e.message;return!!(n||t||o)&&fn.some((function(e){return(null==n?void 0:n.includes(e))||(null==t?void 0:t.includes(e))||(null==o?void 0:o.includes(e))}))},hn=function(){function e(){var e=this;this.apiKey="",this.userId=null,this.preInitQueue=[],this.isInitialized=!1,this.handleWindowError=function(n){var t,o={filename:n.filename,stack:null===(t=n.error)||void 0===t?void 0:t.stack,message:n.message};vn(o)&&e.trackError(n.error||n.message,"GlobalErrorHandler",{filename:n.filename,lineNo:n.lineno,colNo:n.colno})},this.handleUnhandledRejection=function(n){var t,o,i={stack:null===(t=n.reason)||void 0===t?void 0:t.stack,message:(null===(o=n.reason)||void 0===o?void 0:o.message)||String(n.reason)};vn(i)&&e.trackError(n.reason||"Unhandled Promise Rejection","GlobalPromiseHandler",{reason:n.reason})},this.setupGlobalHandlers()}return e.prototype.setupGlobalHandlers=function(){C()&&(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(){C()&&(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,n){void 0===n&&(n=null);try{if(this.preInitQueue.length>0){var t={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:n,timestamp:Date.now()},timestamp:Date.now()},metadata:dn(),event_type:rn.ERROR,user_id:n};this.sendLog(t).catch(console.error)}this.apiKey=e,this.userId=n,this.isInitialized=!0,this.processPreInitQueue()}catch(t){T.error("Error during ErrorTrackingService initialization:",t),this.preInitQueue.push({error:t instanceof Error?t:new Error(String(t)),componentName:"ErrorTrackingService",additionalInfo:{apiKey:e,userId:n}})}},e.prototype.processPreInitQueue=function(){return y(this,void 0,void 0,(function(){var e,n,t;return w(this,(function(o){switch(o.label){case 0:if(!this.preInitQueue.length)return[2];T.info("Processing ".concat(this.preInitQueue.length," pre-initialization errors")),e=0,n=this.preInitQueue,o.label=1;case 1:return e<n.length?(t=n[e],[4,this.trackError(t.error,t.componentName,b(b({},t.additionalInfo),{preInitError:!0}))]):[3,4];case 2:o.sent(),o.label=3;case 3:return e++,[3,1];case 4:return this.preInitQueue=[],[2]}}))}))},e.prototype.sendLog=function(e){return y(this,void 0,void 0,(function(){var n,t,o,i,r,l;return w(this,(function(a){switch(a.label){case 0:return a.trys.push([0,4,,5]),n=O().apiUrl,[4,fetch("".concat(n,"/users/sdk/record-logs/"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})];case 1:return(t=a.sent()).ok?[3,3]:(i=(o=T).error,r=["Failed to send error log:"],[4,t.text()]);case 2:i.apply(o,r.concat([a.sent()])),a.label=3;case 3:return[3,5];case 4:return l=a.sent(),T.error("Error sending log:",l),[3,5];case 5:return[2]}}))}))},e.prototype.trackError=function(e,n,t){return y(this,void 0,void 0,(function(){var o,i,r;return w(this,(function(l){switch(l.label){case 0:if(this.isInitialized)return[3,5];o={org_id:"UNINITALIZED",event_data:{message:e instanceof Error?e.message:e,stack:e instanceof Error?e.stack:void 0,componentName:n,additionalInfo:b(b({},t),{preInitError:!0,timestamp:Date.now()}),timestamp:Date.now()},metadata:dn(),event_type:rn.ERROR,user_id:this.userId},l.label=1;case 1:return l.trys.push([1,3,,4]),[4,this.sendLog(o)];case 2:return l.sent(),[3,4];case 3:return l.sent(),this.preInitQueue.push({error:e,componentName:n,additionalInfo:t}),T.warn("Error tracked before initialization, queuing:",e),[3,4];case 4:return[2];case 5:return i={message:e instanceof Error?e.message:e,stack:e instanceof Error?e.stack:void 0,componentName:n,additionalInfo:b(b({},t),{timestamp:Date.now()}),timestamp:Date.now()},r={org_id:this.apiKey||"UNINITALIZED",event_data:i,metadata:dn(),event_type:rn.ERROR,user_id:this.userId},[4,this.sendLog(r)];case 6:return l.sent(),[2]}}))}))},e.prototype.trackInfo=function(e,n,t){return y(this,void 0,void 0,(function(){var o,i;return w(this,(function(r){switch(r.label){case 0:return this.apiKey?(o={message:e,componentName:n,additionalInfo:t,timestamp:Date.now()},i={org_id:this.apiKey,event_data:o,metadata:dn(),event_type:rn.INFO,user_id:this.userId},[4,this.sendLog(i)]):(T.error("Error tracking not initialized"),[2]);case 1:return r.sent(),[2]}}))}))},e}(),mn=hn.getInstance(),gn="MISSING_API_KEY",_n="INVALID_API_KEY",bn="CONFIG_FETCH_FAILED",yn="SDK_INIT_FAILED",wn="ERROR_TRACKING_INIT_FAILED",En="API_REQUEST_FAILED",In="NETWORK_ERROR",Tn="INVALID_RESPONSE",Sn="IFRAME_LOAD_FAILED",xn="COOKIE_ACCESS_ERROR",An="COMPONENT_RENDER_ERROR",Cn="INITIALIZATION_ERROR",On="API_ERROR",Dn="RUNTIME_ERROR",Rn="COMPONENT_ERROR",Nn=((un={})[gn]=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.")},un[_n]=function(e){return"SDK Initialization Failed: Provided API key '".concat(e,"' is invalid. API key must be a non-empty string in UUID format.")},un[bn]=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):"")},un[En]=function(e,n,t){return"API Request Failed: Server responded with status ".concat(e," for ").concat(t?"endpoint ".concat(t):"request"," - ").concat(n)},un[In]=function(e){return"Network Error: Failed to communicate with server".concat(e.url?" at ".concat(e.url):"").concat(e.error?" - ".concat(e.error):"")},un[Sn]=function(e){return"Failed to load chatbot interface".concat(e.src?" from ".concat(e.src):"").concat(e.error?". Error: ".concat(e.error):"")},un[Tn]=function(e){return"Invalid API Response: Missing required fields in response data: ".concat(e.join(", "))},un[wn]=function(e){return"Error Tracking Service initialization failed".concat(e.apiKey?" for API key ".concat(e.apiKey):"").concat(e.error?". Error: ".concat(e.error):"")},un[yn]=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)):"")},un[xn]=function(e,n){return"Cookie Access Error: Failed to ".concat(e).concat(n?" cookie '".concat(n,"'"):" cookies",". This may affect user session persistence.")},un[An]=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):"")},un),Ln=function(){var e,n=navigator.userAgent;if(null===(e=navigator.userAgentData)||void 0===e?void 0:e.brands){var t=navigator.userAgentData.brands.find((function(e){return"Google Chrome"===e.brand}));if(null==t?void 0:t.version)return t.version}var o=n.match(/(Chrome|Firefox|Safari|Edge|Opera)\/(\d+\.\d+)/);return o?o[2]:"Unknown"},kn=function(){var e,n,t=dn();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===(n=null===navigator||void 0===navigator?void 0:navigator.languages)||void 0===n?void 0:n[0])||"en",browser_version:Ln(),os:null==t?void 0:t.os,referral_url:(null===document||void 0===document?void 0:document.referrer)||"",system_info:t}};!function(e){e.UPDATE_OVERRIDES="updateOverrides",e.I_CAN_AUTHENTICATE="i_can_authenticate",e.I_LOADED_LAUNCHER="i_loaded_launcher",e.I_OPENED_IFRAME="i_opened_iframe",e.I_CLICKED_PROACTIVE_BUBBLE="i_clicked_proactive_bubble",e.CAPTURED_SESSION_DATA="capturedSessionData",e.UPDATE_USER_PROFILE="updateUserProfile",e.OPENED_IFRAME_EVENT="openedIframe"}(pn||(pn={}));var Mn=n((function(n){var o,l,a,s,c=n.config,d=n.isVisible,u=n.onClose,p=n.onEvent,f=n.onIframeLoaded,v=n.onInternalEvent,h=n.position,m=n.bottomSpacing,g=n.overrides,_=t(null),y=t(!1),w=t(!1);t();var E=t(!1),I=h||(null===(o=c.interface_properties)||void 0===o?void 0:o.position)||"Right",T=null!==(a=null!=m?m:null===(l=c.interface_properties)||void 0===l?void 0:l.bottom_spacing)&&void 0!==a?a:20,S=r((function(e,n){var t=_.current;(null==t?void 0:t.contentWindow)&&t.contentWindow.postMessage(e,n)}),[]),C=r((function(){var e,n=_.current;if(n){var t=((e={width:(null===window||void 0===window?void 0:window.innerWidth)<560?"100vw":"26%",minWidth:(null===window||void 0===window?void 0:window.innerWidth)<560?"300px":"400px",height:(null===window||void 0===window?void 0:window.innerWidth)<560?"100vh":"calc(100vh - 2rem - 10vh - ".concat(T,"px)"),borderRadius:(null===window||void 0===window?void 0:window.innerWidth)<560?"0":"1rem",position:(null===window||void 0===window?void 0:window.innerWidth)<560?"fixed":"",maxHeight:(null===window||void 0===window?void 0:window.innerWidth)<560?"100%":"50rem",top:(null===window||void 0===window?void 0:window.innerWidth)<560?"0":"calc(10vh - 32px)"})[I.toLowerCase()]=(null===window||void 0===window?void 0:window.innerWidth)<560?"0":void 0,e.flexDirection=(null===window||void 0===window?void 0:window.innerWidth)<560?"column":void 0,e.flexGrow=(null===window||void 0===window?void 0:window.innerWidth)<560?"1":void 0,e);Object.assign(n.style,t)}}),[T,I]);return i((function(){var e=_.current;if(e&&!y.current){var n=O().copilotUrl;Object.assign(e.style,{zIndex:"20000000",border:"none",boxShadow:"0px 0px 40px 0px rgba(14, 14, 15, 0.24)",transformOrigin:"bottom ".concat(I.toLowerCase()),transition:"transform 0.2s cubic-bezier(0.2, 1.27, 0.29, 0.97), opacity 0.15s ease-out",transform:"scale(0.3) translate3d(0,40px,0)",opacity:"0",display:"none"}),e.src="".concat(n,"/chatbot-plugin?id=").concat(c.chatbotId),y.current=!0,C();var t=function(){var t,o,i,r,l,a,s,d,u,p,v,h,m,_,y,E,I=new URL(e.src).origin||n;if(S({domain:null===(t=null===window||void 0===window?void 0:window.location)||void 0===t?void 0:t.hostname,name:"checkDomain"},I),g){var T={header_avatar:null!==(o=null==g?void 0:g.header_avatar)&&void 0!==o?o:null,agent_avatar:null!==(i=null==g?void 0:g.agent_avatar)&&void 0!==i?i:null,header_title:null!==(r=null==g?void 0:g.header_title)&&void 0!==r?r:null,header_subtitle:null!==(l=null==g?void 0:g.header_subtitle)&&void 0!==l?l:null,header_title_text_color:null!==(a=null==g?void 0:g.header_title_text_color)&&void 0!==a?a:null,header_subtitle_text_color:null!==(s=null==g?void 0:g.header_subtitle_text_color)&&void 0!==s?s:null,header_bg:null!==(d=null==g?void 0:g.header_bg)&&void 0!==d?d:null};S({domain:null===(u=null===window||void 0===window?void 0:window.location)||void 0===u?void 0:u.hostname,action:pn.UPDATE_OVERRIDES,data:T},n)}if(!(null==w?void 0:w.current)&&e.contentWindow){S({domain:null===(p=null===window||void 0===window?void 0:window.location)||void 0===p?void 0:p.hostname,action:pn.I_CAN_AUTHENTICATE,data:{show_history:null==c?void 0:c.show_history}},n);var x=K();S({domain:null===(v=null===window||void 0===window?void 0:window.location)||void 0===v?void 0:v.hostname,action:pn.I_LOADED_LAUNCHER,data:b(b({ws_url:null==c?void 0:c.ws_url,userId:null==c?void 0:c.userId,token:null==c?void 0:c.token,userProfile:b(b({},null==c?void 0:c.userProfile),{__INT_SYS_INFO__:b(b({},(null===(h=null==c?void 0:c.userProfile)||void 0===h?void 0:h.__INT_SYS_INFO__)||{}),kn())}),isAnonymous:null==c?void 0:c.isAnonymous},x?{proactiveData:x}:{}),{show_history:null==c?void 0:c.show_history,init_load_image:(null===(_=null===(m=null==c?void 0:c.images)||void 0===m?void 0:m.header_image_url)||void 0===_?void 0:_.url)||(null==c?void 0:c.brand_logo_url),init_load_bot_name:null==c?void 0:c.name,init_load_brand_color:null===(y=null==c?void 0:c.colors)||void 0===y?void 0:y.brand_color,init_load_powered_by:(null===(E=null==c?void 0:c.footer)||void 0===E?void 0:E.show_powered_by)||!1})},n),w.current=!0}null==f||f()};return e.addEventListener("load",t),function(){return e.removeEventListener("load",t)}}}),[c.chatbotId,null===(s=c.interface_properties)||void 0===s?void 0:s.position,C,g]),i((function(){var e,n,t,o,i=_.current;if(i&&y.current){var r=(null===(e=c.interface_properties)||void 0===e?void 0:e.position)||"Right";if(d?(Object.assign(i.style,{transform:"scale(0.3) translate3d(0,40px,0)",opacity:"0",display:"block"}),i.getBoundingClientRect(),setTimeout((function(){Object.assign(i.style,{transform:"scale(1) translate3d(0,0,0)",opacity:"1",transition:"transform 0.2s cubic-bezier(0.2, 1.27, 0.29, 0.97), opacity 0.15s ease-out"})}),20)):(E.current=!1,i.style.transition="none",i.getBoundingClientRect(),Object.assign(i.style,{opacity:"0",transform:"scale(0.3) translate3d(".concat((r.toLowerCase(),"0"),",40px,0)"),transition:"transform 0.2s cubic-bezier(0.2, 1.27, 0.29, 0.97), opacity 0.15s ease-out"}),setTimeout((function(){!d&&i&&(i.style.display="none")}),200)),i.contentWindow&&d){var l=O().copilotUrl;if(S({domain:null===(n=null===window||void 0===window?void 0:window.location)||void 0===n?void 0:n.hostname,name:"openFrame"},l),E.current)E.current=!1;else{var a=K();console.log("proactiveData registerUserId===>",a),S({domain:null===(t=null===window||void 0===window?void 0:window.location)||void 0===t?void 0:t.hostname,action:pn.I_OPENED_IFRAME,data:b(b({ws_url:null==c?void 0:c.ws_url,userId:null==c?void 0:c.userId,token:null==c?void 0:c.token,userProfile:b(b({},null==c?void 0:c.userProfile),{__INT_SYS_INFO__:b(b({},(null===(o=null==c?void 0:c.userProfile)||void 0===o?void 0:o.__INT_SYS_INFO__)||{}),kn())}),isAnonymous:null==c?void 0:c.isAnonymous},a?{proactiveData:a}:{}),{show_history:null==c?void 0:c.show_history})},l)}}}}),[d,c.userId,c.token,c.userProfile]),i((function(){var e=function(e){var n,t,o,i;if(_.current&&w.current){E.current=!0;var r=(null==e?void 0:e.detail)||{},l=O().copilotUrl;S({domain:null===(n=null===window||void 0===window?void 0:window.location)||void 0===n?void 0:n.hostname,action:pn.I_CLICKED_PROACTIVE_BUBBLE,data:{userId:null==c?void 0:c.userId,token:null==c?void 0:c.token,userProfile:b(b({},null==c?void 0:c.userProfile),{__INT_SYS_INFO__:b(b({},(null===(t=null==c?void 0:c.userProfile)||void 0===t?void 0:t.__INT_SYS_INFO__)||{}),kn())}),isAnonymous:null==c?void 0:c.isAnonymous,ws_url:null==c?void 0:c.ws_url,proactiveData:{input_id:null,message_id:(null==r?void 0:r.message_id)||null,content_string:(null==r?void 0:r.content_string)||null,content_id:(null==r?void 0:r.content_id)||null},show_history:null==c?void 0:c.show_history}},l),console.log("message should have been sent===>",null===(o=_.current)||void 0===o?void 0:o.contentWindow,{userId:null==c?void 0:c.userId,token:null==c?void 0:c.token,userProfile:b(b({},null==c?void 0:c.userProfile),{__INT_SYS_INFO__:b(b({},(null===(i=null==c?void 0:c.userProfile)||void 0===i?void 0:i.__INT_SYS_INFO__)||{}),kn())}),isAnonymous:null==c?void 0:c.isAnonymous,ws_url:null==c?void 0:c.ws_url,proactiveData:{input_id:null,message_id:(null==r?void 0:r.message_id)||null,content_string:(null==r?void 0:r.content_string)||null,content_id:(null==r?void 0:r.content_id)||null}})}};return window.addEventListener("rblyn:proactiveClick",e),function(){return window.removeEventListener("rblyn:proactiveClick",e)}}),[null==c?void 0:c.userId,null==c?void 0:c.token,null==c?void 0:c.userProfile,null==c?void 0:c.isAnonymous]),i((function(){if(_.current&&y.current){var e=O().copilotUrl;d&&(null==p||p({type:x.CHATBOT_OPENED,timestamp:Date.now()}),v(x.CHATBOT_OPENED));var n=function(n){var t,o,i,r,l,a,s;if(n.origin===e){if("closeChatbot"===n.data)return void u();if("CHATBOT_TOKEN_EXHAUSTED"===(null===(t=n.data)||void 0===t?void 0:t.type))return void v(A.CHATBOT_TOKEN_EXHAUSTED);"CHATBOT_LOADED"===(null===(o=n.data)||void 0===o?void 0:o.type)&&(null==p||p({type:x.CHATBOT_LOADED,timestamp:Date.now()}),v(x.CHATBOT_LOADED)),"CHAT_INITIALIZED"===(null===(i=n.data)||void 0===i?void 0:i.type)&&(null==p||p({type:x.CHAT_INITIALIZED,timestamp:Date.now()}),v(x.CHAT_INITIALIZED)),"CHAT_INITIALIZATION_FAILED"===(null===(r=n.data)||void 0===r?void 0:r.type)&&(null==p||p({type:x.CHAT_INITIALIZATION_FAILED,timestamp:Date.now()}),v(x.CHAT_INITIALIZATION_FAILED,{error:null===(l=n.data)||void 0===l?void 0:l.error})),"SESSION_REFRESHED"===(null===(a=n.data)||void 0===a?void 0:a.type)&&(null==p||p({type:x.SESSION_REFRESHED,timestamp:Date.now()}),v(x.SESSION_REFRESHED)),"CHAT_MOVED"===(null===(s=n.data)||void 0===s?void 0:s.type)&&v(A.CHAT_MOVED,{from:n.data.from,to:n.data.to,trigger:n.data.trigger})}};return null===window||void 0===window||window.addEventListener("message",n),function(){return null===window||void 0===window?void 0:window.removeEventListener("message",n)}}}),[u,p,v,c.chatbotId,d]),i((function(){var e=_.current;if(e&&y.current){var n=function(){mn.trackError(new Error(Nn[Sn]({src:e.src,error:"Failed to load iframe"})),"ChatbotIframe",{errorCode:Sn,errorType:Dn,context:{config:c,iframeUrl:e.src,timestamp:Date.now()}})};return e.addEventListener("error",n),function(){return e.removeEventListener("error",n)}}}),[c]),i((function(){if(_.current&&c&&d){_.current;var e=O().copilotUrl;S({action:pn.UPDATE_USER_PROFILE,user_profile:c.userProfile,show_history:null==c?void 0:c.show_history},e),S({action:pn.OPENED_IFRAME_EVENT,user_profile:c.userProfile,show_history:null==c?void 0:c.show_history},e)}}),[c.userProfile,d]),e.createElement("iframe",{allow:"microphone",ref:_,id:"chat-iframe-rbyln",style:{display:"none"}})})),zn=function(e){function n(){var n=null!==e&&e.apply(this,arguments)||this;return n.state={hasError:!1},n}return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function t(){this.constructor=e}d(e,n),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}(n,e),n.getDerivedStateFromError=function(e){return{hasError:!0}},n.prototype.componentDidCatch=function(e,n){mn.trackError(new Error(Nn[An]({component:this.props.componentName||void 0,error:e.message,stack:n.componentStack})),this.props.componentName||void 0,{errorCode:An,errorType:Rn,context:{originalError:e,componentStack:n.componentStack,timestamp:Date.now()}})},n.prototype.render=function(){return this.state.hasError?null:this.props.children},n}(l),Pn=function(e,n,t,o){return y(void 0,void 0,void 0,(function(){var i,r,l,a,s,c,d,u;return w(this,(function(p){switch(p.label){case 0:i=O().apiUrl,r="".concat(i,"/chat/chatbot/get/"),T.log("endpointUrl",r),l={client_user_id:n,org_id:e,token:t||void 0,internal_user_id:o||void 0,extra_info:{},launcher_info:kn()},p.label=1;case 1:return p.trys.push([1,6,,7]),[4,fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)})];case 2:return(a=p.sent()).ok?[3,4]:[4,a.text()];case 3:throw s=p.sent(),new Error(Nn[En](a.status,s));case 4:return[4,a.json()];case 5:c=p.sent();try{String(l.org_id||"")}catch(e){}if(!(null===(u=null==c?void 0:c.user)||void 0===u?void 0:u.org_info))throw new Error(Nn[Tn](["user","org_info"]));return[2,c];case 6:throw d=p.sent(),mn.trackError(d instanceof Error?d:new Error(Nn[In]({error:String(d)})),"fetchChatbotConfig",{errorCode:d instanceof Error&&d.message.includes("API Request Failed")?En:In,errorType:On,context:{chatbotId:e,userId:n,apiUrl:i,statusCode:d instanceof Response?d.status:void 0,timestamp:Date.now(),requestPayload:{client_user_id:n,org_id:e}}}),d;case 7:return[2]}}))}))},Hn=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var n=16*Math.random()|0;return("x"===e?n:3&n|8).toString(16)}))},Fn=function(e){var n,t="; ".concat(document.cookie).split("; ".concat(e,"="));if(2===t.length)return null===(n=t.pop())||void 0===n?void 0:n.split(";").shift()},Un=function(e,n,t){var o=new Date;o.setTime(o.getTime()+24*t*60*60*1e3),document.cookie="".concat(e,"=").concat(n,";expires=").concat(o.toUTCString(),";path=/")},Bn=function(e){var n=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 n=n.split(";").map((function(e){var n=e.split("="),t=n[0],o=n.slice(1).join("=").trim();return{name:t=t.trim(),value:o?decodeURIComponent(o):""}})),n},Wn=function(){function e(e){this.logoContainer=null,this.iframe=null,this.bubblePromptContainer=null,this.chatBtnImage=null,this.isIframeLoaded=!1,this.config=e,this.validateDomain()&&this.init(),null===window||void 0===window||window.addEventListener("message",this.onCloseListener.bind(this),!1)}return e.prototype.sendMessageToIframe=function(e,n){var t;(null===(t=this.iframe)||void 0===t?void 0:t.contentWindow)&&this.iframe.contentWindow.postMessage(e,n)},e.prototype.onCloseListener=function(e){e.origin===this.config.domain&&"closeChatbot"===e.data&&this.closeIframe()},e.prototype.validateDomain=function(){var e,n=this.config.domain,t=null===(e=null===window||void 0===window?void 0:window.location)||void 0===e?void 0:e.origin;return T.log("expectedDomain, to current domain",n,t,n===t),n===t},e.prototype.createChatBubblContainer=function(){var e,n=this,t=document.createElement("div");t.id="chatbase-message-bubbles",Object.assign(t.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 o=document.createElement("div");o.classList.add("close-btn"),o.textContent="✕",Object.assign(o.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 o=n.createMessageBubble(e);t.appendChild(o)})),t.appendChild(o),document.body.appendChild(t)},e.prototype.createMessageBubble=function(e){var n=document.createElement("div");this.bubblePromptContainer=n,Object.assign(n.style,{display:"flex",position:"relative",justifyContent:"flex-end"});var t=document.createElement("div");t.classList.add("message"),t.textContent=e,Object.assign(t.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 o=document.createElement("button");return o.innerHTML="&times;",Object.assign(o.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"}),o.addEventListener("click",(function(){n.remove()})),n.appendChild(o),n.appendChild(t),n},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 n,t,o=document.createElement("img");o.src=this.config.launcher_type?(null===(t=null===(n=this.config.images)||void 0===n?void 0:n.launcher_image_url)||void 0===t?void 0:t.url)||"".concat(this.config.domain,"/chatbubble.png"):this.config.image_url||"".concat(this.config.domain,"/chatbubble.png"),o.alt="Chat",Object.assign(o.style,{zIndex:"1000",cursor:"pointer",borderRadius:"50%",objectFit:"cover"}),this.chatBtnImage=o,e.innerHTML="",e.appendChild(o)},e.prototype.createIframe=function(){var e=this;T.log("RobylonConfig?.domain====>",this.config.domain);var n=document.createElement("iframe");Object.assign(n.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"}),n.src="".concat(this.config.domain,"/chatbot-plugin?id=").concat(this.config.chatbotId),T.log("iframe.src====>",n.src),document.body.appendChild(n),this.iframe=n;var t=function(){(null===window||void 0===window?void 0:window.innerWidth)<560?Object.assign(n.style,{width:"100vw",minWidth:"300px",right:"0",bottom:"0",height:"100vh",flexDirection:"column",flexGrow:"1",borderRadius:"0",top:"0",maxHeight:"100%"}):Object.assign(n.style,{width:"26%",minWidth:"400px",right:"32px",bottom:"86px",height:"calc(100vh - 3rem - 10vh)",borderRadius:"1rem",top:"calc(10vh - 32px)",maxHeight:"45rem"})};t(),null===window||void 0===window||window.addEventListener("resize",t),n.addEventListener("load",(function(){var t,o,i,r,l;if(e.iframe){var a=new URL(e.iframe.src).origin||e.config.domain;null===(t=n.contentWindow)||void 0===t||t.postMessage({domain:null===(o=null===window||void 0===window?void 0:window.location)||void 0===o?void 0:o.hostname,name:"checkDomain"},a),null===(i=n.contentWindow)||void 0===i||i.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===(l=e.config.userProfile)||void 0===l?void 0:l.__INT_SYS_INFO__)||{}),kn())})}},a),e.isIframeLoaded=!0,e.createFloatingButton()}})),null===window||void 0===window||window.addEventListener("message",(function(t){var o,i;if(t.origin===e.config.domain){if("captureSessionData"===t.data){var r="66b33d16-5b38-4693-8772-1a1bd7dd412d"===e.config.chatbotId,l={cookies:Bn(r),localStorage:JSON.stringify(localStorage),sessionStorage:JSON.stringify(sessionStorage),action:"capturedSessionData",domain_name:null===(o=null===window||void 0===window?void 0:window.location)||void 0===o?void 0:o.hostname};null===(i=n.contentWindow)||void 0===i||i.postMessage(l,e.config.domain||"*")}"expand"===t.data&&(e.adjustIframeWidth(),n.style.height="calc(100vh - 120px)",n.style.bottom="86px"),"collapse"===t.data&&Object.assign(n.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;T.log("screenWidth",e),this.iframe.style.width=e<832?"".concat(e-64,"px"):"800px"}},e.prototype.loadSvgInline=function(e){var n=document.createElement("div");n.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 t=n.querySelector("svg");e.innerHTML="",t&&e.appendChild(t)},e.prototype.toggleIcon=function(e,n){"block"===n.style.display?this.loadSvgInline(e):this.loadImage(e)},e.prototype.toggleIframe=function(){var e;if(T.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;T.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":"cover",this.bubblePromptContainer&&(this.bubblePromptContainer.style.display="none"),T.log("this.bubblePromptContainer",this.bubblePromptContainer)}},e.prototype.closeIframe=function(){this.iframe&&this.logoContainer&&this.chatBtnImage&&(this.iframe.style.display="none",this.toggleIcon(this.logoContainer,this.iframe),this.chatBtnImage.style.objectFit="cover")},e.prototype.init=function(){this.createIframe()},e}(),jn=function(e,n,t){if(e.chatbotId&&e.userId)try{new Wn(e);n(!0),T.log("Robylon SDK initialized successfully.")}catch(e){t(e instanceof Error?e.message:"Failed to initialize SDK")}else t("Incomplete configuration for SDK initialization.")},Vn=function(e,n,t,o){return y(void 0,void 0,void 0,(function(){var i,r,l,a,s,c,d,u;return w(this,(function(p){switch(p.label){case 0:return p.trys.push([0,5,,6]),i=O().apiUrl,r="".concat(i,"/chat/chatbot/get/"),T.log("endpointUrl",r),l={client_user_id:n||null,org_id:e,token:t||void 0,internal_user_id:o||void 0,extra_info:{},launcher_info:kn()},[4,fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)})];case 1:return(a=p.sent()).ok?[3,3]:[4,a.text()];case 2:throw s=p.sent(),new Error(Nn[En](a.status,s));case 3:return[4,a.json()];case 4:if(c=p.sent(),!(null===(u=null==c?void 0:c.user)||void 0===u?void 0:u.org_info))throw new Error(Nn[Tn](["user","org_info"]));return[2,c];case 5:throw d=p.sent(),mn.trackError(d instanceof Error?d:new Error(Nn[In]({error:String(d)})),"fetchChatbotConfig",{errorCode:d instanceof Error&&d.message.includes("API Request Failed")?En:In,errorType:On,context:{apiKey:e,userId:n,timestamp:Date.now()}}),d;case 6:return[2]}}))}))},Gn=function(e){return y(void 0,void 0,void 0,(function(){var n,t,o,i,r,l,a,s,c,d,v,h,m,g,_,y,E,I,S,x,A,C,O,D,R,N,L,k,M,z,P,H,F,U,B,W,j,V,G,Y,K,X,q,J,Z,Q,$,ee,ne,te,oe,ie,re,le,ae;return w(this,(function(w){switch(w.label){case 0:return n=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),t=n.user_id||void 0,o=!1,t?i=Fn("rblyn_anon")||Hn():(t=Fn("rblyn_anon")||Hn(),Un("rblyn_anon",t,365),o=!0,i=t),[4,Vn(n.api_key,t,n.user_token,i)];case 1:r=w.sent();try{n.api_key}catch(e){T.warn("Failed to inject mock proactive messages",e)}return l=dn(),a=kn(),se=n.user_profile,s=se?Object.fromEntries(Object.entries(se).map((function(e){var n=e[0],t=e[1];return"boolean"==typeof t||"number"==typeof t?[n,t]:[n,String(t)]}))):{},c=b(b(b({},l),{__INT_SYS_INFO__:b(b({},l),a)}),s),[2,{chatbotId:n.api_key,name:(null===(d=r.user.org_info.brand_config)||void 0===d?void 0:d.name)||"",userId:t,token:n.user_token,isAnonymous:o,domain:"",show_launcher:null===(h=null===(v=r.user.org_info)||void 0===v?void 0:v.show_launcher)||void 0===h||h,auto_launch:null!==(g=null===(m=r.user.org_info)||void 0===m?void 0:m.auto_launch)&&void 0!==g&&g,brand_colour:(null===(y=null===(_=r.user.org_info.brand_config)||void 0===_?void 0:_.colors)||void 0===y?void 0:y.brand_color)||"",colors:{brand_color:(null===(I=null===(E=r.user.org_info.brand_config)||void 0===E?void 0:E.colors)||void 0===I?void 0:I.brand_color)||"",title_bar_color:(null===(x=null===(S=r.user.org_info.brand_config)||void 0===S?void 0:S.colors)||void 0===x?void 0:x.title_bar_color)||""},footer:{show_powered_by:(null===(C=null===(A=r.user.org_info.brand_config)||void 0===A?void 0:A.footer)||void 0===C?void 0:C.show_powered_by)||!1},image_url:(null===(D=null===(O=r.user.org_info)||void 0===O?void 0:O.brand_config)||void 0===D?void 0:D.launcher_logo_url)||"",brand_logo_url:(null===(N=null===(R=r.user.org_info)||void 0===R?void 0:R.brand_config)||void 0===N?void 0:N.launcher_logo_url)||"",userProfile:c,chat_interface_config:{chat_bubble_prompts:[],display_name:(null===(L=r.user.org_info.brand_config)||void 0===L?void 0:L.display_name)||"",welcome_message:(null===(k=r.user.org_info.brand_config)||void 0===k?void 0:k.welcome_message)||"Hey! What can we help you with today?",redirect_url:(null===(M=r.user.org_info.brand_config)||void 0===M?void 0:M.redirect_url)||""},launcher_type:(null===(z=r.user.org_info.brand_config)||void 0===z?void 0:z.launcher_type)||f.IMAGE,launcher_properties:{text:(null===(H=null===(P=r.user.org_info.brand_config)||void 0===P?void 0:P.launcher_properties)||void 0===H?void 0:H.text)||""},images:{launcher_image_url:{url:(null===(B=null===(U=null===(F=r.user.org_info.brand_config)||void 0===F?void 0:F.images)||void 0===U?void 0:U.launcher_image_url)||void 0===B?void 0:B.url)||""},header_image_url:{url:(null===(V=null===(j=null===(W=r.user.org_info.brand_config)||void 0===W?void 0:W.images)||void 0===j?void 0:j.header_image_url)||void 0===V?void 0:V.url)||""}},proactive_message_obj:Yn(null===(K=null===(Y=null===(G=null==r?void 0:r.user)||void 0===G?void 0:G.org_info)||void 0===Y?void 0:Y.brand_config)||void 0===K?void 0:K.proactive_message_obj),interface_properties:{position:(null===(q=null===(X=r.user.org_info.brand_config)||void 0===X?void 0:X.interface_properties)||void 0===q?void 0:q.position)||p.RIGHT,side_spacing:(null===(Z=null===(J=r.user.org_info.brand_config)||void 0===J?void 0:J.interface_properties)||void 0===Z?void 0:Z.side_spacing)||20,bottom_spacing:(null===($=null===(Q=r.user.org_info.brand_config)||void 0===Q?void 0:Q.interface_properties)||void 0===$?void 0:$.bottom_spacing)||20},interface_type:(null===(ee=r.user.org_info.brand_config)||void 0===ee?void 0:ee.interface_type)||u.WIDGET,launcher_delay:(null===(ne=r.user.org_info.brand_config)||void 0===ne?void 0:ne.launcher_delay)||{enabled:!1,delay:0},launcher_scroll:function(){var e,n,t,o,i,l,a;console.log("[Config] Raw API response launcher_scroll",{raw:null===(e=r.user.org_info.brand_config)||void 0===e?void 0:e.launcher_scroll,type:typeof(null===(n=r.user.org_info.brand_config)||void 0===n?void 0:n.launcher_scroll),enabled:null===(o=null===(t=r.user.org_info.brand_config)||void 0===t?void 0:t.launcher_scroll)||void 0===o?void 0:o.enabled,depth:null===(l=null===(i=r.user.org_info.brand_config)||void 0===i?void 0:i.launcher_scroll)||void 0===l?void 0:l.depth});var s=(null===(a=r.user.org_info.brand_config)||void 0===a?void 0:a.launcher_scroll)||{enabled:!1,depth:0};return console.log("[Config] Parsed launcher_scroll",s),s}(),auto_launch_delay:(null===(te=r.user.org_info.brand_config)||void 0===te?void 0:te.auto_launch_delay)||{enabled:!1,seconds:0},auto_launch_scroll:(null===(oe=r.user.org_info.brand_config)||void 0===oe?void 0:oe.auto_launch_scroll)||{enabled:!1,depth:0},launcher_size_multiplier:null!==(re=null===(ie=r.user.org_info.brand_config)||void 0===ie?void 0:ie.launcher_size_multiplier)&&void 0!==re?re:1,ws_url:null===(ae=null===(le=r.user)||void 0===le?void 0:le.router_connection_info)||void 0===ae?void 0:ae.url}]}var se}))}))},Yn=function(e){if(e){var n=(Array.isArray(e)?e:[e]).filter(Boolean).map((function(e){var n,t,o,i={message_id:String(null!==(n=null==e?void 0:e.message_id)&&void 0!==n?n:""),org_id:String(null!==(t=null==e?void 0:e.org_id)&&void 0!==t?t:""),name:null==e?void 0:e.name,content:null==e?void 0:e.content,send_time_type:null==e?void 0:e.send_time_type,created_by_name:null==e?void 0:e.created_by_name,updated_by_name:null==e?void 0:e.updated_by_name,updated_at:null==e?void 0:e.updated_at,created_at:null==e?void 0:e.created_at,delay:"number"==typeof(null==e?void 0:e.delay)?e.delay:void 0,delay_type:"scroll"===(null==e?void 0:e.delay_type)||"time"===(null==e?void 0:e.delay_type)?e.delay_type:void 0,scroll_threshold:(o=Number(null==e?void 0:e.scroll_threshold),Number.isFinite(o)?o:void 0),content_multiple:Array.isArray(null==e?void 0:e.content_multiple)?e.content_multiple:(null==e?void 0:e.content)?[{message:String(e.content),message_display_attributes:[]}]:[]};return(null==e?void 0:e.content)&&!(null==e?void 0:e.content_multiple)&&T.warn("[Robylon SDK] proactive_message.content is deprecated; use content_multiple[].message instead."),i}));return n.length?n:void 0}},Kn=function(e){var n=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)]),t=o({isInitialized:!1,isInitializing:!1,error:null,chatbotConfig:null,isIframeVisible:!1}),l=t[0],s=t[1],c=a((function(){return n.user_profile?Object.fromEntries(Object.entries(n.user_profile).map((function(e){var n=e[0],t=e[1];return"boolean"==typeof t||"number"==typeof t?[n,t]:[n,String(t)]}))):{}}),[JSON.stringify(n.user_profile)]),d=r((function(e){s((function(n){return b(b({},n),e)}))}),[]),v=r((function(){return y(void 0,void 0,void 0,(function(){var e,t,o,i,r,l,a,s,v,h,m,g,_,y,E,I,T,S,x,A,C,O,D,R,N,L,k,M,z,P,H,F,U,B,W,j,V,G,Y,K,X,q,J,Z,Q,$,ee,ne,te,oe,ie,re,le,ae,se,ce,de,ue,pe,fe,ve,he,me,ge,_e,be,ye;return w(this,(function(w){switch(w.label){case 0:if(!n.api_key)return mn.trackError(new Error(Nn[gn](n.api_key)),"useChatbotState",{errorCode:gn,errorType:Cn,context:{timestamp:Date.now()}}),[2];d({isInitializing:!0}),w.label=1;case 1:return w.trys.push([1,4,5,6]),e=n.user_id||void 0,t=!1,o=void 0,e?o=Fn("rblyn_anon")||Hn():(e=Fn("rblyn_anon")||Hn(),o=e,Un("rblyn_anon",e,365),t=!0),[4,Pn(n.api_key,e,n.user_token,o)];case 2:return i=w.sent(),r=dn(),l=kn(),a=b(b(b(b({},r),{__INT_SYS_INFO__:b(b({},r),l)}),c),{internal_user_id:o}),s={chatbotId:n.api_key,name:(null===(m=i.user.org_info.brand_config)||void 0===m?void 0:m.name)||"",userId:e,token:n.user_token,isAnonymous:t,domain:"",show_launcher:null===(_=null===(g=i.user.org_info)||void 0===g?void 0:g.show_launcher)||void 0===_||_,auto_launch:null!==(E=null===(y=i.user.org_info)||void 0===y?void 0:y.auto_launch)&&void 0!==E&&E,show_history:null===(S=null===(T=null===(I=null==i?void 0:i.user)||void 0===I?void 0:I.org_info)||void 0===T?void 0:T.brand_config)||void 0===S?void 0:S.enable_history,brand_colour:(null===(A=null===(x=i.user.org_info.brand_config)||void 0===x?void 0:x.colors)||void 0===A?void 0:A.brand_color)||"",colors:{brand_color:(null===(O=null===(C=i.user.org_info.brand_config)||void 0===C?void 0:C.colors)||void 0===O?void 0:O.brand_color)||"",title_bar_color:(null===(R=null===(D=i.user.org_info.brand_config)||void 0===D?void 0:D.colors)||void 0===R?void 0:R.title_bar_color)||""},footer:{show_powered_by:(null===(L=null===(N=i.user.org_info.brand_config)||void 0===N?void 0:N.footer)||void 0===L?void 0:L.show_powered_by)||!1},image_url:(null===(M=null===(k=i.user.org_info)||void 0===k?void 0:k.brand_config)||void 0===M?void 0:M.launcher_logo_url)||"",brand_logo_url:(null===(P=null===(z=i.user.org_info)||void 0===z?void 0:z.brand_config)||void 0===P?void 0:P.launcher_logo_url)||"",userProfile:a,chat_interface_config:{chat_bubble_prompts:[],display_name:(null===(H=i.user.org_info.brand_config)||void 0===H?void 0:H.display_name)||"",welcome_message:(null===(F=i.user.org_info.brand_config)||void 0===F?void 0:F.welcome_message)||"Hey! What can we help you with today?",redirect_url:(null===(U=i.user.org_info.brand_config)||void 0===U?void 0:U.redirect_url)||""},interface_properties:{position:(null===(W=null===(B=i.user.org_info.brand_config)||void 0===B?void 0:B.interface_properties)||void 0===W?void 0:W.position)||p.RIGHT,side_spacing:null!==(G=null===(V=null===(j=i.user.org_info.brand_config)||void 0===j?void 0:j.interface_properties)||void 0===V?void 0:V.side_spacing)&&void 0!==G?G:20,bottom_spacing:null!==(X=null===(K=null===(Y=i.user.org_info.brand_config)||void 0===Y?void 0:Y.interface_properties)||void 0===K?void 0:K.bottom_spacing)&&void 0!==X?X:20},interface_type:(null===(q=i.user.org_info.brand_config)||void 0===q?void 0:q.interface_type)||u.WIDGET,launcher_type:(null===(J=i.user.org_info.brand_config)||void 0===J?void 0:J.launcher_type)||f.IMAGE,launcher_properties:{text:(null===(Q=null===(Z=i.user.org_info.brand_config)||void 0===Z?void 0:Z.launcher_properties)||void 0===Q?void 0:Q.text)||""},images:{launcher_image_url:{url:(null===(ne=null===(ee=null===($=i.user.org_info.brand_config)||void 0===$?void 0:$.images)||void 0===ee?void 0:ee.launcher_image_url)||void 0===ne?void 0:ne.url)||""},header_image_url:{url:(null===(ie=null===(oe=null===(te=i.user.org_info.brand_config)||void 0===te?void 0:te.images)||void 0===oe?void 0:oe.header_image_url)||void 0===ie?void 0:ie.url)||""}},proactive_message_obj:Yn(null===(ae=null===(le=null===(re=null==i?void 0:i.user)||void 0===re?void 0:re.org_info)||void 0===le?void 0:le.brand_config)||void 0===ae?void 0:ae.proactive_message_obj),launcher_delay:(null===(ce=null===(se=i.user.org_info)||void 0===se?void 0:se.brand_config)||void 0===ce?void 0:ce.launcher_delay)||{enabled:!1,delay:0},launcher_scroll:(null===(ue=null===(de=i.user.org_info)||void 0===de?void 0:de.brand_config)||void 0===ue?void 0:ue.launcher_scroll)||{enabled:!1,depth:0},auto_launch_delay:(null===(fe=null===(pe=i.user.org_info)||void 0===pe?void 0:pe.brand_config)||void 0===fe?void 0:fe.auto_launch_delay)||{enabled:!1,seconds:0},auto_launch_scroll:(null===(he=null===(ve=i.user.org_info)||void 0===ve?void 0:ve.brand_config)||void 0===he?void 0:he.auto_launch_scroll)||{enabled:!1,depth:0},launcher_size_multiplier:null!==(_e=null===(ge=null===(me=i.user.org_info)||void 0===me?void 0:me.brand_config)||void 0===ge?void 0:ge.launcher_size_multiplier)&&void 0!==_e?_e:1,ws_url:null===(ye=null===(be=i.user)||void 0===be?void 0:be.router_connection_info)||void 0===ye?void 0:ye.url},[4,new Promise((function(e,n){jn(s,(function(){d({isInitialized:!0,chatbotConfig:s}),e()}),(function(e){n(e)}))}))];case 3:return w.sent(),[3,6];case 4:return v=w.sent(),h=v instanceof Error?v.message:"Failed to initialize chatbot",d({error:h}),mn.trackError(v instanceof Error?v:new Error(h),"useChatbotState",{errorCode:yn,errorType:Cn,context:{timestamp:Date.now()}}),[3,6];case 5:return d({isInitializing:!1}),[7];case 6:return[2]}}))}))}),[n.api_key,n.user_id,n.user_token]);i((function(){n.api_key&&v()}),[v]),i((function(){l.chatbotConfig&&s((function(e){return b(b({},e),{chatbotConfig:b(b({},e.chatbotConfig),{userProfile:b(b({},dn()),c)})})}))}),[c]);var h=r((function(){s((function(e){return b(b({},e),{isIframeVisible:!e.isIframeVisible})}))}),[]),m=r((function(){d({isIframeVisible:!1})}),[]);return b(b({},l),{toggleIframeVisibility:h,closeIframe:m})},Xn=function(n){var t,r,l,a,s,c,d,u=n.children,p=n.config,f=n.position,v=n.sideSpacing,h=n.bottomSpacing,m=o(!1),g=m[0],_=m[1];i((function(){var e=function(){var e=(null===window||void 0===window?void 0:window.innerWidth)<560;_(e)};return e(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[]);var y=f||(null===(l=p.interface_properties)||void 0===l?void 0:l.position)||"Right",w=null!==(s=null!=v?v:null===(a=p.interface_properties)||void 0===a?void 0:a.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;T.log("config",p,y,w);var I={position:"fixed",zIndex:1e3,display:"flex",flexDirection:"column"},S=b(b({},I),((t={bottom:"".concat(E,"px")})[y.toLowerCase()]="".concat(null!=w?w:20,"px"),t.alignItems="Right"===y?"flex-end":"flex-start",t.top=void 0,t["Right"===y?"left":"right"]=void 0,t)),x=b(b({},I),((r={top:0})[y.toLowerCase()]="".concat(null!=w?w:20,"px"),r.alignItems="center",r.bottom=void 0,r["Right"===y?"left":"right"]=void 0,r)),A=g?x:S;return i((function(){console.log("Container screen width changed, isMobile:",g,"Style:",A)}),[g,A]),e.createElement("div",{className:"robylon-chatbot-container",style:A},u)},qn=function(e,n,t,o){var i;if(!document.getElementById(e)){var r=document.createElement("link");r.id=e,r.rel=n,r.href=t,o&&(r.crossOrigin=""),null===(i=document.head)||void 0===i||i.appendChild(r)}},Jn=function(){if(C()){var e="".concat("https://d1h2odiipi7033.cloudfront.net","/");qn("robylon-launcher-cdn-preconnect","preconnect",e,!0),qn("robylon-launcher-cdn-dns-prefetch","dns-prefetch",e,!1)}},Zn=s((function(n,t){var l,s,d,u,p,f,v,h,m,g,_,I,S,A=n.api_key,C=n.user_id,D=n.user_token,R=n.user_profile,N=n.onEvent,L=n.position,k=n.sideSpacing,M=n.bottomSpacing,z=n.show_launcher,P=n.launcher_type,H=n.launcher_properties_text,F=n.overrides,U=n.launcher_size;i((function(){Jn()}),[]);var B="string"==typeof k?""===k||isNaN(Number(k))?void 0:Number(k):k,W="string"==typeof M?""===M||isNaN(Number(M))?void 0:Number(M):M,j="string"==typeof L?"left"===L.toLowerCase()?"Left":"right"===L.toLowerCase()?"Right":void 0:L;i((function(){}));var V=a((function(){return{api_key:A,user_id:C,user_token:D,user_profile:R}}),[A,C,D,R]),G=r((function(e){null==N||N(e)}),[N]),Y=Kn(V),K=Y.isInitialized,X=Y.error,q=Y.chatbotConfig,J=Y.isIframeVisible,Z=Y.toggleIframeVisibility,Q=Y.closeIframe,$=a((function(){return{api_key:A,user_profile:V.user_profile,onEvent:G,chatbotConfig:q?{isAnonymous:q.isAnonymous,userId:q.userId}:null}}),[A,V.user_profile,G,null==q?void 0:q.isAnonymous,null==q?void 0:q.userId]),ee=function(e){var n=e.api_key,t=e.chatbotConfig,o=e.user_profile,i=e.onEvent,l=a((function(){return{isAnonymous:(null==t?void 0:t.isAnonymous)||!1,userId:(null==t?void 0:t.userId)||""}}),[null==t?void 0:t.isAnonymous,null==t?void 0:t.userId]),s=a((function(){return o||{}}),[JSON.stringify(o)]),c=r((function(e){for(var t=[],o=1;o<arguments.length;o++)t[o-1]=arguments[o];return y(void 0,E([e],t,!0),void 0,(function(e,t){var o,i,r,a,c,d,u;return void 0===t&&(t={}),w(this,(function(p){switch(p.label){case 0:if(!n)return[2];p.label=1;case 1:return p.trys.push([1,3,,4]),o=O().apiUrl,i=dn(),r=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:n,client_user_id:l.isAnonymous?"Anonymous":String(l.userId),event_type:e,user_profile:s},t),a={org_id:n,event_data:r,metadata:b({timestamp:Date.now()},i),event_type:"INFO",user_id:l.userId},[4,fetch("".concat(o,"/users/sdk/record-logs/"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})];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(),T.error("Failed to send internal event:",d),[3,4];case 4:return[2]}}))}))}),[n,l]);return{emitEvent:r((function(e,n){var t=Date.now();e!==x.CHATBOT_BUTTON_CLICKED&&e!==x.CHATBOT_CLOSED&&e!==x.CHATBOT_OPENED&&e!==x.CHATBOT_READY||(i&&i({type:e,timestamp:t,data:n}),c(e,{timestamp:t}))}),[i,c]),onInternalEvent:c}}(b({},$)),ne=ee.emitEvent,te=ee.onInternalEvent;c(t,(function(){return{show:function(){K&&q?J||(Z(),ne(x.CHATBOT_BUTTON_CLICKED)):console.warn("Robylon Chatbot: Cannot show - chatbot not ready yet")},hide:function(){K&&q?J&&(Q(),ne(x.CHATBOT_CLOSED)):console.warn("Robylon Chatbot: Cannot hide - chatbot not ready yet")},toggle:function(){K&&q?(Z(),ne(J?x.CHATBOT_CLOSED:x.CHATBOT_BUTTON_CLICKED)):console.warn("Robylon Chatbot: Cannot toggle - chatbot not ready yet")},isReady:K&&!!q}}),[K,q,J,Z,Q,ne]),i((function(){K&&q&&ne(x.CHATBOT_READY)}),[K,q,ne]);var oe=o(!1),ie=oe[0],re=oe[1],le=o(!1),ae=le[0],se=le[1],ce=o(!1),de=ce[0],ue=ce[1],pe=o(!1),fe=pe[0],ve=pe[1],he=o(!1),me=he[0],ge=he[1];i((function(){var e,n,t,o,i,r,l,a,s;if(console.log("[RobylonChatbot] Scroll tracking effect running",{chatbotConfig:!!q,launcher_scroll:null==q?void 0:q.launcher_scroll,scrollEnabled:null===(e=null==q?void 0:q.launcher_scroll)||void 0===e?void 0:e.enabled,scrollDepth:null===(n=null==q?void 0:q.launcher_scroll)||void 0===n?void 0:n.depth,scrollEnabledType:typeof(null===(t=null==q?void 0:q.launcher_scroll)||void 0===t?void 0:t.enabled),scrollDepthType:typeof(null===(o=null==q?void 0:q.launcher_scroll)||void 0===o?void 0:o.depth)}),!q)return console.log("[RobylonChatbot] No config, resetting scroll state"),void ue(!1);var c=!0===(null===(i=null==q?void 0:q.launcher_scroll)||void 0===i?void 0:i.enabled),d=null!==(l=null===(r=null==q?void 0:q.launcher_scroll)||void 0===r?void 0:r.depth)&&void 0!==l?l:0;if(console.log("[RobylonChatbot] Scroll config check",{rawLauncherScroll:null==q?void 0:q.launcher_scroll,scrollEnabledRaw:null===(a=null==q?void 0:q.launcher_scroll)||void 0===a?void 0:a.enabled,scrollEnabled:c,scrollDepthRaw:null===(s=null==q?void 0:q.launcher_scroll)||void 0===s?void 0:s.depth,scrollDepth:d,scrollDepthNumber:Number(d),willSetup:c&&Number(d)>0}),!c||Number(d)<=0)return console.log("[RobylonChatbot] Scroll disabled or depth <= 0, resetting state"),void ue(!1);var u=function(){var e=window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0;console.log("[RobylonChatbot] Checking scroll depth",{currentScrollY:e,requiredDepth:Number(d),hasScrolledPast:e>=Number(d),currentState:de}),e>=Number(d)&&(console.log("[RobylonChatbot] Scroll depth reached! Setting flag to true"),ue(!0))};return console.log("[RobylonChatbot] Checking initial scroll position"),u(),console.log("[RobylonChatbot] Adding scroll event listener"),window.addEventListener("scroll",u,{passive:!0}),function(){console.log("[RobylonChatbot] Removing scroll event listener"),window.removeEventListener("scroll",u)}}),[q,null===(l=null==q?void 0:q.launcher_scroll)||void 0===l?void 0:l.enabled,null===(s=null==q?void 0:q.launcher_scroll)||void 0===s?void 0:s.depth]),i((function(){var e,n,t,o,i,r,l,a,s,c;if(console.log("[RobylonChatbot] Launcher visibility effect running",{hasConfig:!!q,show_launcher:z,configShowLauncher:null==q?void 0:q.show_launcher,hasScrolledPastDepth:de}),!q)return console.log("[RobylonChatbot] No config, hiding launcher"),void re(!1);var d=void 0!==z?Boolean(z):null===(e=null==q?void 0:q.show_launcher)||void 0===e||e;if(console.log("[RobylonChatbot] Final show_launcher decision",{finalShowLauncher:d,propShowLauncher:z,configShowLauncher:null==q?void 0:q.show_launcher}),!d)return console.log("[RobylonChatbot] show_launcher is false, hiding launcher"),re(!1),function(){c&&clearTimeout(c)};var u=!0===(null===(n=null==q?void 0:q.launcher_delay)||void 0===n?void 0:n.enabled),p=null!==(r=null!==(o=null===(t=null==q?void 0:q.launcher_delay)||void 0===t?void 0:t.seconds)&&void 0!==o?o:null===(i=null==q?void 0:q.launcher_delay)||void 0===i?void 0:i.delay)&&void 0!==r?r:0,f=!0===(null===(l=null==q?void 0:q.launcher_scroll)||void 0===l?void 0:l.enabled),v=null!==(s=null===(a=null==q?void 0:q.launcher_scroll)||void 0===a?void 0:a.depth)&&void 0!==s?s:0,h=f&&Number(v)>0;console.log("[RobylonChatbot] Scroll and delay config",{delayEnabled:u,seconds:p,scrollEnabled:f,scrollDepth:v,requiresScroll:h});var m=!0;if(h){var g=window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0;m=g>=Number(v)||de,console.log("[RobylonChatbot] Scroll condition check",{currentScrollY:g,requiredDepth:Number(v),hasScrolledPastDepthState:de,scrollConditionMet:m})}return h&&!m?(console.log("[RobylonChatbot] Scroll required but condition not met, hiding launcher"),re(!1),function(){c&&clearTimeout(c)}):(u&&Number(p)>0?(console.log("[RobylonChatbot] Delay enabled, setting timeout",{seconds:p}),re(!1),c=window.setTimeout((function(){console.log("[RobylonChatbot] Delay timeout fired, checking scroll condition");var e=!0;if(h){var n=window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0;e=n>=Number(v)||de,console.log("[RobylonChatbot] Final scroll check in delay timeout",{currentScrollY:n,requiredDepth:Number(v),hasScrolledPastDepthState:de,finalScrollConditionMet:e})}!h||e?(console.log("[RobylonChatbot] Showing launcher after delay"),re(!0)):console.log("[RobylonChatbot] Not showing launcher - scroll condition not met")}),1e3*Number(p))):(console.log("[RobylonChatbot] No delay, showing launcher immediately"),re(!0)),function(){c&&clearTimeout(c)})}),[q,z,null==q?void 0:q.show_launcher,null===(d=null==q?void 0:q.launcher_delay)||void 0===d?void 0:d.enabled,null===(u=null==q?void 0:q.launcher_delay)||void 0===u?void 0:u.seconds,null===(p=null==q?void 0:q.launcher_delay)||void 0===p?void 0:p.delay,null===(f=null==q?void 0:q.launcher_scroll)||void 0===f?void 0:f.enabled,null===(v=null==q?void 0:q.launcher_scroll)||void 0===v?void 0:v.depth,de]),i((function(){var e,n,t;if(q&&!fe){var o=!0===(null===(e=null==q?void 0:q.auto_launch_scroll)||void 0===e?void 0:e.enabled),i=null!==(t=null===(n=null==q?void 0:q.auto_launch_scroll)||void 0===n?void 0:n.depth)&&void 0!==t?t:0;if(o&&!(Number(i)<=0)){var r=function(){me||(window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0)>=Number(i)&&ge(!0)};return r(),window.addEventListener("scroll",r,{passive:!0}),function(){window.removeEventListener("scroll",r)}}ge(!1)}}),[q,null===(h=null==q?void 0:q.auto_launch_scroll)||void 0===h?void 0:h.enabled,null===(m=null==q?void 0:q.auto_launch_scroll)||void 0===m?void 0:m.depth,fe,me]),i((function(){var e,n,t,o,i,r,l;if(q&&!fe&&ae){var a=void 0!==z?Boolean(z):null===(e=null==q?void 0:q.show_launcher)||void 0===e||e,s=!0===(null==q?void 0:q.auto_launch);if(a&&s&&ie){var c=!0===(null===(n=null==q?void 0:q.auto_launch_delay)||void 0===n?void 0:n.enabled),d=null!==(o=null===(t=null==q?void 0:q.auto_launch_delay)||void 0===t?void 0:t.seconds)&&void 0!==o?o:0,u=!0===(null===(i=null==q?void 0:q.auto_launch_scroll)||void 0===i?void 0:i.enabled),p=null!==(l=null===(r=null==q?void 0:q.auto_launch_scroll)||void 0===r?void 0:r.depth)&&void 0!==l?l:0,f=u&&Number(p)>0,v=!0;if(f)v=(window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0)>=Number(p)||me;if(!f||v){var h=function(){fe||J||(ve(!0),Z(),ne(x.CHATBOT_BUTTON_CLICKED))};if(c&&Number(d)>0){var m=window.setTimeout((function(){var e=!0;f&&(e=(window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0)>=Number(p)||me);f&&!e||h()}),1e3*Number(d));return function(){clearTimeout(m)}}h()}}}}),[q,z,null==q?void 0:q.show_launcher,null==q?void 0:q.auto_launch,null===(g=null==q?void 0:q.auto_launch_delay)||void 0===g?void 0:g.enabled,null===(_=null==q?void 0:q.auto_launch_delay)||void 0===_?void 0:_.seconds,null===(I=null==q?void 0:q.auto_launch_scroll)||void 0===I?void 0:I.enabled,null===(S=null==q?void 0:q.auto_launch_scroll)||void 0===S?void 0:S.depth,ie,ae,fe,me,J,Z,ne]),i((function(){if(A)try{mn.initialize(A,C)}catch(e){mn.trackError(e instanceof Error?e:new Error(String(e)),"RobylonChatbot",{errorCode:wn,errorType:Cn,context:{timestamp:Date.now()}})}else mn.trackError(new Error(Nn[gn](A)),"RobylonChatbot",{errorCode:gn,errorType:Cn,context:{timestamp:Date.now()}})}),[A,C]);var _e=r((function(){Q(),ne(x.CHATBOT_CLOSED)}),[Q,ne]),be=r((function(){Z(),ne(J?x.CHATBOT_CLOSED:x.CHATBOT_BUTTON_CLICKED)}),[Z,ne,J]),ye=a((function(){var e,n,t,o,i;return{config:q,toggleIframe:be,isIframeVisible:J,onEvent:G,onInternalEvent:te,position:j,sideSpacing:B,bottomSpacing:W,launcher_type:P,launcher_properties_text:H,shouldFadeIn:!0===(null===(e=null==q?void 0:q.launcher_delay)||void 0===e?void 0:e.enabled)&&(null!==(i=null!==(t=null===(n=null==q?void 0:q.launcher_delay)||void 0===n?void 0:n.seconds)&&void 0!==t?t:null===(o=null==q?void 0:q.launcher_delay)||void 0===o?void 0:o.delay)&&void 0!==i?i:0)>0||!1,launcher_size:U}}),[q,be,J,G,te,j,B,W,P,H,U]);T.log("floatingButtonProps",ye);var we=a((function(){return{config:q,isVisible:J,onClose:_e,onEvent:G,onIframeLoaded:function(){return se(!0)},onInternalEvent:te,position:j,bottomSpacing:W,overrides:F}}),[q,J,_e,G,te,j,W,F]);return A&&!X&&q?e.createElement(zn,{componentName:"RobylonChatbot"},K?e.createElement(Xn,{config:q,position:j,sideSpacing:B,bottomSpacing:W},e.createElement(zn,{componentName:"ChatbotIframe"},e.createElement(Mn,b({},we))),e.createElement(zn,{componentName:"ChatbotFloatingButton"},(console.log("[RobylonChatbot] Render check",{isLauncherVisible:ie,isIframeLoaded:ae,willRender:ie&&ae}),ie&&ae?e.createElement(ln,b({},ye)):null))):null):null})),Qn=n(Zn,(function(e,n){return e.api_key===n.api_key&&e.user_id===n.user_id&&e.user_token===n.user_token&&JSON.stringify(e.user_profile)===JSON.stringify(n.user_profile)&&e.position===n.position&&e.sideSpacing===n.sideSpacing&&e.bottomSpacing===n.bottomSpacing&&e.show_launcher===n.show_launcher&&e.launcher_type===n.launcher_type&&e.launcher_properties_text===n.launcher_properties_text&&JSON.stringify(e.overrides)===JSON.stringify(n.overrides)&&e.launcher_size===n.launcher_size&&!0})),$n=function(e){var n=o({isLoading:!0,isInitialized:!1,error:null}),t=n[0],r=n[1],l=function(e){r((function(n){return b(b({},n),{isInitialized:e})}))},a=function(e){r((function(n){return b(b({},n),{error:e})}))};return i((function(){!function(){try{jn(e,l,a)}catch(e){r((function(n){return b(b({},n),{error:e instanceof Error?e.message:"Failed to initialize SDK",isLoading:!1})}))}}()}),[e.chatbotId,e.userId]),t},et="data-robylon-launcher-image-root",nt="data-robylon-launcher-chevron-overlay",tt=function(){function e(e){var n=this;this.resizeObserver=null,this.proactiveElement=null,this.urlUnsubscribe=null,this.delayTimers=[],this.scrollHandlers=new Map,this.shownScrollMessages=new Set,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(){n.buttonElement.style.opacity="1"}))}catch(e){}this.setupResizeListener(),this.renderProactiveIfNeeded(),this.urlUnsubscribe=F((function(){n.clearProactiveDelays(),n.renderProactiveIfNeeded(!0)}))}return e.prototype.render=function(){var e,n,t=this,o=O().copilotUrl,i=this.config,r=i.config,l=i.isIframeVisible,a=null!==(e=null==r?void 0:r.launcher_size_multiplier)&&void 0!==e?e:1,s=null!==(n=this.config.launcher_size)&&void 0!==n?n:48*a,c={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:l?"scale(0.85)":"scale(1)",fontFamily:R};if(r.launcher_type===f.IMAGE&&Object.assign(c,{width:"".concat(s,"px"),height:"".concat(s,"px"),borderRadius:"50%",backgroundColor:r.brand_colour}),this.applyResponsiveStyles(c),this.buttonElement.className="message-bubble-container",this.tryUpdateImageLauncherInPlace(s,o))return this.buttonElement.onclick=function(){t.config.toggleIframe(),t.hideProactiveMessages()},void this.renderProactiveIfNeeded();this.buttonElement.innerHTML="",this.buttonElement.appendChild(this.createLauncherElement()),this.buttonElement.onclick=function(){t.config.toggleIframe(),t.hideProactiveMessages()},this.renderProactiveIfNeeded()},e.prototype.getImageLauncherSrc=function(e){var n,t,o=this.config.config;return o.launcher_type?(null===(t=null===(n=o.images)||void 0===n?void 0:n.launcher_image_url)||void 0===t?void 0:t.url)||"".concat(e,"/chatbubble.png"):o.image_url||"".concat(e,"/chatbubble.png")},e.prototype.appendChevronSvg=function(e,n){var t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("width",String(n)),t.setAttribute("height",String(n)),t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("fill","none"),t.setAttribute("xmlns","http://www.w3.org/2000/svg"),t.style.display="block";var o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d","M19 9L12 16L5 9"),o.setAttribute("stroke","currentColor"),o.setAttribute("stroke-width","1.5"),o.setAttribute("stroke-linecap","round"),o.setAttribute("stroke-linejoin","round"),t.appendChild(o),e.appendChild(t)},e.prototype.tryUpdateImageLauncherInPlace=function(e,n){var t=this.config,o=t.config,i=t.isIframeVisible;if(!(o.launcher_type===f.IMAGE||void 0===o.launcher_type))return!1;var r=this.buttonElement.querySelector("[".concat(et,"]"));if(!r)return!1;var l=r.querySelector("img");if(!l)return!1;var a=this.getImageLauncherSrc(n);if(l.getAttribute("src")!==a)return!1;l.style.opacity=i?"0":"1",i?l.setAttribute("aria-hidden","true"):l.removeAttribute("aria-hidden");var s=r.querySelector("[".concat(nt,"]"));if(i&&!s){var c=document.createElement("div");c.setAttribute(nt,""),Object.assign(c.style,{position:"absolute",inset:"0",display:"flex",alignItems:"center",justifyContent:"center"}),this.appendChevronSvg(c,Math.round(.5*e)),r.appendChild(c)}return!i&&(null==s?void 0:s.parentElement)&&s.parentElement.removeChild(s),!0},e.prototype.createLauncherElement=function(){var e,n,t=this.config,o=t.config,i=t.isIframeVisible,r=O().copilotUrl,l=null!==(e=null==o?void 0:o.launcher_size_multiplier)&&void 0!==e?e:1,a=null!==(n=this.config.launcher_size)&&void 0!==n?n:48*l;switch(o.launcher_type){case f.TEXT:return this.createTextLauncher();case f.TEXTUAL_IMAGE:return this.createTextualImageLauncher();case f.IMAGE:default:var s=document.createElement("div");s.setAttribute(et,""),Object.assign(s.style,{position:"relative",width:"100%",height:"100%"});var c=document.createElement("img");if(c.src=this.getImageLauncherSrc(r),c.alt="Chat",i&&c.setAttribute("aria-hidden","true"),Object.assign(c.style,{zIndex:"1000",cursor:"pointer",borderRadius:"50%",objectFit:"cover",width:"100%",height:"100%",boxSizing:"border-box",position:"absolute",inset:"0",opacity:i?"0":"1"}),s.appendChild(c),i){var d=document.createElement("div");d.setAttribute(nt,""),Object.assign(d.style,{position:"absolute",inset:"0",display:"flex",alignItems:"center",justifyContent:"center"}),this.appendChevronSvg(d,Math.round(.5*a)),s.appendChild(d)}return s}},e.prototype.createTextLauncher=function(){var e=this.config.config,n=e.brand_colour,t=e.launcher_properties,o=e.launcher_size_multiplier,i=null!=o?o:1,r=void 0!==this.config.launcher_size?void 0:160*i,l=void 0!==this.config.launcher_size?void 0:40*i,a=void 0!==this.config.launcher_size?void 0:14*i,s=void 0!==this.config.launcher_size?void 0:21*i,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!==l?"".concat(l,"px"):"40px",borderRadius:"9999px",backgroundColor:n,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(n),fontSize:void 0!==a?"".concat(a,"px"):"0.875rem",fontWeight:"600",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:void 0!==s?"".concat(s,"px"):N,fontFamily:R,textAlign:"center",WebkitFontSmoothing:"antialiased",textRendering:"optimizeLegibility",textSizeAdjust:"100%"}),u.textContent=(null==t?void 0:t.text)||"",d.appendChild(u),c.appendChild(d),c},e.prototype.createTextualImageLauncher=function(){var e,n,t,o,i,r,l=O().copilotUrl,a=this.config.config,s=a.brand_colour,c=a.launcher_properties,d=a.image_url,u=a.launcher_size_multiplier,p=null!=u?u:1,f=void 0!==this.config.launcher_size?void 0:174*p,v=void 0!==this.config.launcher_size?void 0:40*p,h=void 0!==this.config.launcher_size?void 0:40*p,m=void 0!==this.config.launcher_size?void 0:14*p,g=void 0!==this.config.launcher_size?void 0:21*p,_=document.createElement("div");Object.assign(_.style,{maxWidth:void 0!==f?"".concat(f,"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 b=document.createElement("div");Object.assign(b.style,{flex:"1",minWidth:"0"});var y=document.createElement("p");Object.assign(y.style,{margin:"0",color:I(s),fontSize:void 0!==m?"".concat(m,"px"):"0.875rem",fontWeight:"600",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:void 0!==g?"".concat(g,"px"):N,fontFamily:R,textAlign:"right",WebkitFontSmoothing:"antialiased",textRendering:"optimizeLegibility",textSizeAdjust:"100%"}),y.textContent=(null==c?void 0:c.text)||"";var w=document.createElement("div");Object.assign(w.style,{width:void 0!==h?"".concat(h,"px"):"40px",height:void 0!==h?"".concat(h,"px"):"40px",borderRadius:"9999px",overflow:"hidden",position:"relative",flexShrink:"0"});var E=document.createElement("img");return E.src=(null===(n=null===(e=null==this?void 0:this.config)||void 0===e?void 0:e.config)||void 0===n?void 0:n.launcher_type)?(null===(r=null===(i=null===(o=null===(t=null==this?void 0:this.config)||void 0===t?void 0:t.config)||void 0===o?void 0:o.images)||void 0===i?void 0:i.launcher_image_url)||void 0===r?void 0:r.url)||"".concat(l,"/chatbubble.png"):d||"".concat(l,"/chatbubble.png"),E.alt="Chat",Object.assign(E.style,{width:"100%",height:"100%",objectFit:"cover"}),b.appendChild(y),w.appendChild(E),_.appendChild(b),_.appendChild(w),_},e.prototype.applyResponsiveStyles=function(e){var n,t,o,i,r,l,a,s,c,d=(null===window||void 0===window?void 0:window.innerWidth)<560,u=this.config.config,p=this.config.position||(null===(o=u.interface_properties)||void 0===o?void 0:o.position)||"Right",f=null!==(l=null!==(i=this.config.sideSpacing)&&void 0!==i?i:null===(r=u.interface_properties)||void 0===r?void 0:r.side_spacing)&&void 0!==l?l:20,v=null!==(c=null!==(a=this.config.bottomSpacing)&&void 0!==a?a: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?((n={position:"fixed",bottom:"".concat(v,"px")})[p.toLowerCase()]="".concat(f,"px"),n):((t={bottom:"".concat(v,"px")})[p.toLowerCase()]="".concat(f,"px"),t));Object.assign(this.buttonElement.style,h)},e.prototype.handleResize=function(){var e,n,t,o=null!==(n=null===(e=this.config.config)||void 0===e?void 0:e.launcher_size_multiplier)&&void 0!==n?n:1,i=null!==(t=this.config.launcher_size)&&void 0!==t?t:48*o,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(i,"px"),height:"".concat(i,"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 n,t;null===(t=(n=e.config).onEvent)||void 0===t||t.call(n,{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=[],this.scrollHandlers.forEach((function(e){window.removeEventListener("scroll",e)})),this.scrollHandlers.clear(),this.shownScrollMessages.clear()},e.prototype.hideProactiveMessages=function(){var e,n,t=this;V();var o=null===(e=this.proactiveElement)||void 0===e?void 0:e.children[0];if(o){var i="Right"===(this.config.position||(null===(n=this.config.config.interface_properties)||void 0===n?void 0:n.position)||"Right");Array.from(o.children).forEach((function(e){e.className=i?"rblyn-proactive-exit-right":"rblyn-proactive-exit-left"})),setTimeout((function(){t.proactiveElement&&t.proactiveElement.parentElement&&t.proactiveElement.parentElement.removeChild(t.proactiveElement),t.proactiveElement=null,t.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(R,' !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 n,t,o,i,r,l,a,s,c,d,u,p,v,h,m,g=this,b=null===(t=null===(n=this.config)||void 0===n?void 0:n.config)||void 0===t?void 0:t.proactive_message_obj;if(Array.isArray(b)&&!this.config.isIframeVisible&&!G()){if(this.injectAnimationStyles(),!this.proactiveElement){var y=document.createElement("div");y.style.position="fixed";var w=null!==(l=null!==(i=this.config.bottomSpacing)&&void 0!==i?i:null===(r=this.config.config.interface_properties)||void 0===r?void 0:r.bottom_spacing)&&void 0!==l?l:20,T=null!==(c=null!==(a=this.config.sideSpacing)&&void 0!==a?a:null===(s=this.config.config.interface_properties)||void 0===s?void 0:s.side_spacing)&&void 0!==c?c:20,S=this.config.position||(null===(d=this.config.config.interface_properties)||void 0===d?void 0:d.position)||"Right",x=null!==(p=null===(u=this.config.config)||void 0===u?void 0:u.launcher_size_multiplier)&&void 0!==p?p:1,A=null!==(v=this.config.launcher_size)&&void 0!==v?v:48*x,C=this.config.config.launcher_type===f.IMAGE?A:void 0!==this.config.launcher_size?40:40*x;y.style.bottom="".concat(w+C+8,"px"),"Right"===S?y.style.right="".concat(T,"px"):y.style.left="".concat(T,"px"),y.style.maxWidth="22.875rem",y.style.zIndex="2147483646";var O=document.createElement("div");O.style.display="flex",O.style.flexDirection="column",O.style.alignItems="Right"===S?"flex-end":"flex-start";var D=document.createElement("div");D.style.position="absolute",D.style.top="-32px",D.style.width="24px",D.style.height="24px",D.style.borderRadius="50%",D.style.background="#fff",D.style.boxShadow="0 2.667px 2.667px 0 rgba(0, 0, 0, 0.25)",D.style.display="flex",D.style.alignItems="center",D.style.justifyContent="center",D.style.cursor="pointer",D.style.opacity="0",D.style.visibility="hidden","Right"===(this.config.position||(null===(h=this.config.config.interface_properties)||void 0===h?void 0:h.position)||"Right")?(D.style.right="0px",D.style.left="auto",D.style.transform="translateX(120%) scale(0.95)"):(D.style.left="0px",D.style.right="auto",D.style.transform="translateX(-120%) scale(0.95)"),D.onclick=function(e){e.stopPropagation(),g.hideProactiveMessages()},D.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 ',y.appendChild(O),y.appendChild(D),document.body.appendChild(y),this.proactiveElement=y}var L=this.proactiveElement.children[0];L.innerHTML="";var k="Right"===(this.config.position||(null===(m=this.config.config.interface_properties)||void 0===m?void 0:m.position)||"Right");L.style.display="flex",L.style.flexDirection="column",L.style.alignItems=k?"flex-end":"flex-start",this.clearProactiveDelays();var M=J(b),z=[],P=[];M.forEach((function(e){"scroll"===e.delayType&&void 0!==e.scrollThreshold&&Number(e.scrollThreshold)>0?P.push(e):z.push(e)}));var H=new Map;z.forEach((function(e){var n=H.get(e.delayMs);n||(n={messageIds:[],groups:new Map},H.set(e.delayMs,n)),n.groups.has(e.messageId)||(n.messageIds.push(e.messageId),n.groups.set(e.messageId,[])),n.groups.get(e.messageId).push(e)}));var F=new Map;P.forEach((function(e){var n=e.scrollThreshold||0,t=F.get(n);t||(t={messageIds:[],groups:new Map},F.set(n,t)),t.groups.has(e.messageId)||(t.messageIds.push(e.messageId),t.groups.set(e.messageId,[])),t.groups.get(e.messageId).push(e)}));var U=void 0!==H.get(0),B=this.proactiveElement.children[1];if(B&&M.length>0){B.style.opacity="0",B.style.visibility="hidden",B.style.transform=k?"translateX(120%) scale(0.95)":"translateX(-120%) scale(0.95)";var W=function(){if(B){B.style.visibility="visible";var e=L.children.length,n=e>0?10*(e-1):0;B.style.animationDelay="".concat(n,"ms"),B.className=k?"rblyn-proactive-close-enter-right":"rblyn-proactive-close-enter-left"}};if(U){var j=window.setTimeout(W,0);this.delayTimers.push(j)}else{var V=Math.min.apply(Math,Array.from(H.keys()));j=window.setTimeout(W,V);this.delayTimers.push(j)}}else B&&(B.style.opacity="0",B.style.visibility="hidden");var K=function(e,n,t){var o=L.children.length,i=0,r=[];e.forEach((function(e){var t=n.get(e)||[];E([],t,!0).sort((function(e,n){return e.contentIndex-n.contentIndex})).forEach((function(n){r.push({messageId:e,item:n})})),i+=t.length}));var l=t>0?E([],r,!0).reverse():r;l.forEach((function(e,n){var r,a=e.item,s=document.createElement("div"),c=a.messageDisplayType===_.BUTTON;s.style.background=(null==a?void 0:a.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=R,s.style.fontSize="14px",s.style.lineHeight=String(N),s.style.width="fit-content",s.style.maxWidth="100%";var d=0===n,u=n===l.length-1,p=o>0,f=H.has(0),v=!1;0===t?v=!u||d&&p:d&&(p||f)?v=!0:d||(v=!0),v&&(s.style.marginBottom="16px");var h=10*(o+i-1-(0===t?o+0:0));s.className=k?"rblyn-proactive-enter-right":"rblyn-proactive-enter-left",s.style.animationDelay="".concat(h,"ms"),s.style.opacity="0",s.style.transform=k?"translateX(120%) scale(0.95)":"translateX(-120%) scale(0.95)";var m=document.createElement("div");Object.assign(m.style,{display:"flex",alignItems:"center",gap:"8px"});var b=document.createElement("div");if(b.className="rblyn-proactive-message-content",b.setAttribute("dir",on(a.html)),b.innerHTML=tn(a.html),m.appendChild(b),(null==a?void 0:a.urlToGo)&&"string"==typeof a.urlToGo&&""!==a.urlToGo.trim()){var y=document.createElementNS("http://www.w3.org/2000/svg","svg");y.setAttribute("width","16"),y.setAttribute("height","17"),y.setAttribute("viewBox","0 0 16 17"),y.setAttribute("fill","none"),y.setAttribute("xmlns","http://www.w3.org/2000/svg"),Object.assign(y.style,{flexShrink:"0",color:I((null==a?void 0:a.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),y.appendChild(w),m.appendChild(y)}if(s.appendChild(m),s.onclick=function(){if((null==a?void 0:a.urlToGo)&&"string"==typeof a.urlToGo&&""!==a.urlToGo.trim())window.open(a.urlToGo,"_blank","noopener,noreferrer");else{Y({message_id:a.messageId,content_string:a.html||null,content_id:a.contentId||null}),g.config.toggleIframe(),g.hideProactiveMessages();try{window.dispatchEvent(new CustomEvent("rblyn:proactiveClick",{detail:{message_id:a.messageId,content_string:a.html||null,content_id:a.contentId||null}}))}catch(e){}}},0===t)L.appendChild(s);else{L.insertBefore(s,L.firstChild);var T=null===(r=g.proactiveElement)||void 0===r?void 0:r.children[1];if(T&&"visible"===T.style.visibility){var S=L.children.length,x=S>0?10*(S-1):0;T.style.animationDelay="".concat(x,"ms")}}}))};H.forEach((function(e,n){var t=e.messageIds,o=e.groups;if(0===n)K(t,o,n);else{var i=window.setTimeout((function(){K(t,o,n)}),n);g.delayTimers.push(i)}})),F.forEach((function(e,n){var t=e.messageIds,o=e.groups,i="scroll-".concat(n),r=function(){if((window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0)>=n&&!g.shownScrollMessages.has(i)){g.shownScrollMessages.add(i),K(t,o,1);var e=g.scrollHandlers.get(i);e&&(window.removeEventListener("scroll",e),g.scrollHandlers.delete(i))}};r(),g.scrollHandlers.set(i,r),window.addEventListener("scroll",r,{passive:!0})}))}else if(this.proactiveElement&&this.proactiveElement.parentElement){var X=this.proactiveElement.children[0],q="Right"===(this.config.position||(null===(o=this.config.config.interface_properties)||void 0===o?void 0:o.position)||"Right");Array.from(X.children).forEach((function(e){e.className=q?"rblyn-proactive-exit-right":"rblyn-proactive-exit-left"})),setTimeout((function(){g.proactiveElement&&g.proactiveElement.parentElement&&g.proactiveElement.parentElement.removeChild(g.proactiveElement),g.proactiveElement=null,g.clearProactiveDelays()}),400)}else this.proactiveElement=null,this.clearProactiveDelays()},e}(),ot=function(){function e(e){var n=this;this.isInitialized=!1,this.hasRegistered=!1,this.isAppReady=!1,this.shouldWaitForAppReady=!1,this.hasPendingOpenRequest=!1,this.overridesPayloadCache=null,this.proactiveDataSentInRegistration=!1,this.openedDueToProactive=!1,this.handleMessage=function(e){var t,o,i,r,l,a,s,c,d,u,p=O().copilotUrl;if(e.origin===p){var f=JSON.parse(e.data);if("APP_READY"===(null==f?void 0:f.type))return n.isAppReady=!0,void n.sendOpenAndRegisterIfReady();if("CHATBOT_CLOSED"===(null==f?void 0:f.type))return void(null===(t=null==n?void 0:n.config)||void 0===t||t.onClose());if("CHATBOT_TOKEN_EXHAUSTED"===(null==f?void 0:f.type))return void n.config.onInternalEvent(A.CHATBOT_TOKEN_EXHAUSTED);"CHATBOT_LOADED"===(null==f?void 0:f.type)&&(null===(i=(o=n.config).onEvent)||void 0===i||i.call(o,{type:x.CHATBOT_LOADED,timestamp:Date.now()}),n.config.onInternalEvent(x.CHATBOT_LOADED)),"CHAT_INITIALIZED"===(null==f?void 0:f.type)&&(null===(l=(r=n.config).onEvent)||void 0===l||l.call(r,{type:x.CHAT_INITIALIZED,timestamp:Date.now()}),n.config.onInternalEvent(x.CHAT_INITIALIZED)),"CHAT_INITIALIZATION_FAILED"===(null==f?void 0:f.type)&&(null===(s=(a=n.config).onEvent)||void 0===s||s.call(a,{type:x.CHAT_INITIALIZATION_FAILED,timestamp:Date.now()}),n.config.onInternalEvent(x.CHAT_INITIALIZATION_FAILED,{error:null===(c=e.data)||void 0===c?void 0:c.error})),"SESSION_REFRESHED"===(null==f?void 0:f.type)&&(null===(u=(d=n.config).onEvent)||void 0===u||u.call(d,{type:x.SESSION_REFRESHED,timestamp:Date.now()}),n.config.onInternalEvent(x.SESSION_REFRESHED)),"CHAT_MOVED"===(null==f?void 0:f.type)&&n.config.onInternalEvent(A.CHAT_MOVED,{from:e.data.from,to:e.data.to,trigger:e.data.trigger})}},this.config=e,this.iframeElement=document.createElement("iframe"),this.iframeElement.id="chat-iframe-rbyln",this.resizeHandler=this.applyResponsiveStyles.bind(this),this.render(),this.initialize(),this.setupEventListeners()}return e.prototype.buildOverridesPayload=function(){var e,n,t,o,i,r,l,a,s,c,d,u,p,f,v,h,m,g,_,b,y;return{header_avatar:null!==(t=null===(n=null===(e=this.config)||void 0===e?void 0:e.overrides)||void 0===n?void 0:n.header_avatar)&&void 0!==t?t:null,agent_avatar:null!==(r=null===(i=null===(o=this.config)||void 0===o?void 0:o.overrides)||void 0===i?void 0:i.agent_avatar)&&void 0!==r?r:null,header_title:null!==(s=null===(a=null===(l=this.config)||void 0===l?void 0:l.overrides)||void 0===a?void 0:a.header_title)&&void 0!==s?s:null,header_subtitle:null!==(u=null===(d=null===(c=this.config)||void 0===c?void 0:c.overrides)||void 0===d?void 0:d.header_subtitle)&&void 0!==u?u:null,header_title_text_color:null!==(v=null===(f=null===(p=this.config)||void 0===p?void 0:p.overrides)||void 0===f?void 0:f.header_title_text_color)&&void 0!==v?v:null,header_subtitle_text_color:null!==(g=null===(m=null===(h=this.config)||void 0===h?void 0:h.overrides)||void 0===m?void 0:m.header_subtitle_text_color)&&void 0!==g?g:null,header_bg:null!==(y=null===(b=null===(_=this.config)||void 0===_?void 0:_.overrides)||void 0===b?void 0:b.header_bg)&&void 0!==y?y:null}},e.prototype.hasUserProvidedOverrides=function(e){return Object.values(e).some((function(e){return"string"==typeof e?e.trim().length>0:null!=e}))},e.prototype.getElement=function(){return this.iframeElement},e.prototype.render=function(){var e,n=this.config.position||(null===(e=this.config.config.interface_properties)||void 0===e?void 0:e.position)||"Right";Object.assign(this.iframeElement.style,{zIndex:"20000000",border:"none",boxShadow:"0px 0px 40px 0px rgba(14, 14, 15, 0.24)",transformOrigin:"bottom ".concat(n.toLowerCase()),transition:"transform 0.2s cubic-bezier(0.2, 1.27, 0.29, 0.97), opacity 0.15s ease-out",transform:"scale(0.3) translate3d(0,40px,0)",opacity:"0",display:"none"}),this.applyResponsiveStyles()},e.prototype.applyResponsiveStyles=function(){var e,n,t,o,i,r;if(this.iframeElement){var l=this.config.position||(null===(t=this.config.config.interface_properties)||void 0===t?void 0:t.position)||"Right",a=null!==(r=null!==(o=this.config.bottomSpacing)&&void 0!==o?o:null===(i=this.config.config.interface_properties)||void 0===i?void 0:i.bottom_spacing)&&void 0!==r?r:20;window.innerWidth<560?Object.assign(this.iframeElement.style,((e={width:"100vw",minWidth:"300px"})[l.toLowerCase()]="0",e.bottom="0",e.height="100vh",e.flexDirection="column",e.flexGrow="1",e.borderRadius="0",e.top="0",e.maxHeight="100%",e.position="fixed",e)):Object.assign(this.iframeElement.style,((n={width:"26%",minWidth:"400px",height:"calc(100vh - 2rem - 10vh - ".concat(a,"px)"),borderRadius:"1rem",top:"calc(10vh - 32px)",maxHeight:"50rem",position:""})[l.toLowerCase()]=void 0,n))}},e.prototype.initialize=function(){var e=this;if(!this.isInitialized){var n=O().copilotUrl;this.iframeElement.src="".concat(n,"/chatbot-plugin?id=").concat(this.config.config.chatbotId),this.isInitialized=!0,this.iframeElement.addEventListener("load",(function(){var t,o,i,r,l,a,s,c,d,u,p,f,v,h,m,g,_,y,w,E,I,T,S,A,C,O,D,R,N=new URL(e.iframeElement.src).origin||n;null===(t=e.iframeElement.contentWindow)||void 0===t||t.postMessage({domain:null===(o=null===window||void 0===window?void 0:window.location)||void 0===o?void 0:o.hostname,name:"checkDomain"},N);var L=e.buildOverridesPayload();if(e.hasUserProvidedOverrides(L)&&(null===(i=e.iframeElement.contentWindow)||void 0===i||i.postMessage({domain:null===(r=null===window||void 0===window?void 0:window.location)||void 0===r?void 0:r.hostname,action:pn.UPDATE_OVERRIDES,data:L},n)),!e.hasRegistered&&e.iframeElement.contentWindow){e.iframeElement.contentWindow.postMessage({domain:null===(l=null===window||void 0===window?void 0:window.location)||void 0===l?void 0:l.hostname,action:pn.I_CAN_AUTHENTICATE,data:{show_history:null===(a=e.config.config)||void 0===a?void 0:a.show_history}},n);var k=K();e.proactiveDataSentInRegistration=!!k,e.iframeElement.contentWindow.postMessage({domain:null===(s=null===window||void 0===window?void 0:window.location)||void 0===s?void 0:s.hostname,action:pn.I_LOADED_LAUNCHER,data:b(b({ws_url:null===(c=e.config.config)||void 0===c?void 0:c.ws_url,userId:null===(d=e.config.config)||void 0===d?void 0:d.userId,token:null===(u=e.config.config)||void 0===u?void 0:u.token,userProfile:b(b({},null===(p=e.config.config)||void 0===p?void 0:p.userProfile),{__INT_SYS_INFO__:b(b({},(null===(v=null===(f=e.config.config)||void 0===f?void 0:f.userProfile)||void 0===v?void 0:v.__INT_SYS_INFO__)||{}),kn())}),isAnonymous:null===(h=e.config.config)||void 0===h?void 0:h.isAnonymous},k?{proactiveData:k}:{}),{show_history:null===(m=e.config.config)||void 0===m?void 0:m.show_history,init_load_image:(null===(y=null===(_=null===(g=e.config.config)||void 0===g?void 0:g.images)||void 0===_?void 0:_.header_image_url)||void 0===y?void 0:y.url)||(null===(w=e.config.config)||void 0===w?void 0:w.brand_logo_url),init_load_bot_name:null===(E=e.config.config)||void 0===E?void 0:E.name,init_load_brand_color:null===(T=null===(I=e.config.config)||void 0===I?void 0:I.colors)||void 0===T?void 0:T.brand_color,init_load_powered_by:(null===(A=null===(S=e.config.config)||void 0===S?void 0:S.footer)||void 0===A?void 0:A.show_powered_by)||!1})},n),e.hasRegistered=!0}null===(O=(C=e.config).onIframeLoaded)||void 0===O||O.call(C),null===(R=(D=e.config).onEvent)||void 0===R||R.call(D,{type:x.CHATBOT_READY,timestamp:Date.now()}),e.config.onInternalEvent(x.CHATBOT_LOADED)}))}},e.prototype.setupEventListeners=function(){var e=this;window.addEventListener("resize",this.resizeHandler),this.iframeElement.addEventListener("error",(function(){mn.trackError(new Error(Nn[Sn]({src:e.iframeElement.src,error:"Failed to load iframe"})),"ChatbotIframe",{errorCode:Sn,errorType:Dn,context:{config:e.config.config,iframeUrl:e.iframeElement.src,timestamp:Date.now()}})})),window.addEventListener("message",this.handleMessage);window.addEventListener("rblyn:proactiveClick",(function(n){var t,o,i,r,l,a,s,c,d,u;if(e.hasRegistered)if(e.proactiveDataSentInRegistration)e.proactiveDataSentInRegistration=!1;else{e.openedDueToProactive=!0;var p=(null==n?void 0:n.detail)||{},f=O().copilotUrl,v=new URL(e.iframeElement.src).origin||f;null===(t=e.iframeElement.contentWindow)||void 0===t||t.postMessage({domain:null===(o=null===window||void 0===window?void 0:window.location)||void 0===o?void 0:o.hostname,action:pn.I_CLICKED_PROACTIVE_BUBBLE,data:{userId:null===(i=e.config.config)||void 0===i?void 0:i.userId,token:null===(r=e.config.config)||void 0===r?void 0:r.token,userProfile:b(b({},null===(l=e.config.config)||void 0===l?void 0:l.userProfile),{__INT_SYS_INFO__:b(b({},(null===(s=null===(a=e.config.config)||void 0===a?void 0:a.userProfile)||void 0===s?void 0:s.__INT_SYS_INFO__)||{}),kn())}),isAnonymous:null===(c=e.config.config)||void 0===c?void 0:c.isAnonymous,ws_url:null===(d=e.config.config)||void 0===d?void 0:d.ws_url,proactiveData:{input_id:null,message_id:(null==p?void 0:p.message_id)||null,content_string:(null==p?void 0:p.content_string)||null,content_id:(null==p?void 0:p.content_id)||null},show_history:null===(u=e.config.config)||void 0===u?void 0:u.show_history}},v)}}))},e.prototype.updateVisibility=function(e,n){var t;this.shouldWaitForAppReady=!!n,this.config.isVisible=e;var o=this.config.position||(null===(t=this.config.config.interface_properties)||void 0===t?void 0:t.position)||"Right";if(e?this.showIframe(o):this.hideIframe(o),!e)return this.openedDueToProactive=!1,void(this.hasPendingOpenRequest=!1);this.hasPendingOpenRequest=!0,this.shouldWaitForAppReady,this.sendOpenAndRegisterIfReady()},e.prototype.showIframe=function(e){this.iframeElement.style.display="block",this.iframeElement.getBoundingClientRect(),this.iframeElement.style.opacity="1",this.iframeElement.style.transform="scale(1) translate3d(0,0,0)"},e.prototype.hideIframe=function(e){var n=this;this.iframeElement.style.opacity="0",this.iframeElement.style.transform="scale(0.3) translate3d(".concat((e.toLowerCase(),"0"),",40px,0)"),setTimeout((function(){n.config.isVisible||(n.iframeElement.style.display="none")}),200)},e.prototype.sendOpenAndRegisterIfReady=function(){var e,n,t,o,i,r,l,a,s,c,d,u;if(this.iframeElement.contentWindow&&this.config.isVisible&&(!this.shouldWaitForAppReady||this.isAppReady)&&this.hasPendingOpenRequest){var p=O().copilotUrl,f=new URL(this.iframeElement.src).origin||p;if(this.iframeElement.contentWindow.postMessage({domain:null===(e=null===window||void 0===window?void 0:window.location)||void 0===e?void 0:e.hostname,name:"openFrame"},f),this.openedDueToProactive)this.openedDueToProactive=!1;else{var v=K();this.iframeElement.contentWindow.postMessage({domain:null===(n=null===window||void 0===window?void 0:window.location)||void 0===n?void 0:n.hostname,action:pn.I_OPENED_IFRAME,data:b(b({ws_url:null===(t=this.config.config)||void 0===t?void 0:t.ws_url,userId:null===(o=this.config.config)||void 0===o?void 0:o.userId,token:null===(i=this.config.config)||void 0===i?void 0:i.token,userProfile:b(b({},null===(r=this.config.config)||void 0===r?void 0:r.userProfile),{__INT_SYS_INFO__:b(b({},(null===(a=null===(l=this.config.config)||void 0===l?void 0:l.userProfile)||void 0===a?void 0:a.__INT_SYS_INFO__)||{}),kn())}),isAnonymous:null===(s=this.config.config)||void 0===s?void 0:s.isAnonymous},v?{proactiveData:v}:{}),{show_history:null===(c=this.config.config)||void 0===c?void 0:c.show_history})},p)}null===(u=(d=this.config).onEvent)||void 0===u||u.call(d,{type:x.CHATBOT_OPENED,timestamp:Date.now()}),this.config.onInternalEvent(x.CHATBOT_OPENED),this.hasPendingOpenRequest=!1}},e.prototype.update=function(e,n){var t,o,i=this.config.isVisible;if(this.config=b(b({},this.config),e),i!==this.config.isVisible&&this.updateVisibility(this.config.isVisible,n),this.iframeElement.contentWindow&&this.config.isVisible){var r=O().copilotUrl;this.iframeElement.contentWindow.postMessage({action:pn.UPDATE_USER_PROFILE,user_profile:this.config.config.userProfile,show_history:null===(t=this.config.config)||void 0===t?void 0:t.show_history},r),this.iframeElement.contentWindow.postMessage({action:pn.OPENED_IFRAME_EVENT,user_profile:this.config.config.userProfile,show_history:null===(o=this.config.config)||void 0===o?void 0:o.show_history},r)}},e.prototype.destroy=function(){window.removeEventListener("resize",this.resizeHandler),window.removeEventListener("message",this.handleMessage),this.iframeElement&&this.iframeElement.parentNode&&this.iframeElement.parentNode.removeChild(this.iframeElement)},e}(),it=function(){function e(e,n,t,o){this.resizeObserver=null,this.containerElement=document.createElement("div"),this.handleResizeFunction=this.handleResize.bind(this),this.config={config:e,position:n,sideSpacing:t,bottomSpacing:o},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,n,t,o,i,r,l,a,s,c=(null===window||void 0===window?void 0:window.innerWidth)<560,d=this.config.position||(null===(t=this.config.config.interface_properties)||void 0===t?void 0:t.position)||"Right",u=null!==(r=null!==(o=this.config.sideSpacing)&&void 0!==o?o:null===(i=this.config.config.interface_properties)||void 0===i?void 0:i.side_spacing)&&void 0!==r?r:20,p=null!==(s=null!==(l=this.config.bottomSpacing)&&void 0!==l?l:null===(a=this.config.config.interface_properties)||void 0===a?void 0:a.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"},v=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),((n={top:"0"})[d.toLowerCase()]="".concat(u,"px"),n.alignItems="center",n));Object.assign(this.containerElement.style,c?h:v)},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}(),rt=function(e){e.api_key,e.user_profile;var n=e.onEvent;e.chatbotConfig;return{emit:function(e,t){var o={type:e,timestamp:Date.now(),data:t};null==n||n(o)},onInternalEvent:function(e,n){}}},lt=function(){function e(e){var n=this;this.container=null,this.floatingButton=null,this.launcherDelayTimeout=null,this.iframe=null,this.isDestroyed=!1,this.isIframeLoaded=!1,this.hasScrolledPastDepth=!1,this.scrollHandler=null,this.hasAutoLaunched=!1,this.hasScrolledPastAutoLaunchDepth=!1,this.autoLaunchScrollHandler=null,this.autoLaunchDelayTimeout=null,this.handleStateChange=function(e){var t,o,i,r,l,a,s,c,d;if(!n.isDestroyed){var u=e.isInitialized,p=e.error,f=e.chatbotConfig,v=e.isIframeVisible;if(!p&&f&&u){if(n.eventEmitter=rt({api_key:n.config.api_key,user_profile:n.config.user_profile,onEvent:n.config.onEvent,chatbotConfig:{isAnonymous:f.isAnonymous,userId:f.userId}}),n.container||(n.container=new it(f,n.config.position,n.config.sideSpacing,n.config.bottomSpacing)),n.iframe)n.iframe.update({config:f,isVisible:v,position:n.config.position,bottomSpacing:n.config.bottomSpacing,overrides:n.config.overrides},!0);else if(n.iframe=new ot({config:f,isVisible:v,onClose:n.handleClose,onEvent:n.config.onEvent,onIframeLoaded:function(){n.isIframeLoaded=!0;var e=n.stateManager.getState();n.handleStateChange({isInitialized:e.isInitialized,error:e.error,chatbotConfig:e.chatbotConfig,isIframeVisible:e.isIframeVisible}),e.chatbotConfig&&n.handleAutoLaunch(e.chatbotConfig,e.isIframeVisible)},onInternalEvent:n.eventEmitter.onInternalEvent,position:n.config.position,bottomSpacing:n.config.bottomSpacing,overrides:n.config.overrides}),n.iframe.getElement&&"function"==typeof n.iframe.getElement){var h=n.iframe.getElement();h&&n.container&&n.container.getElement().prepend(h)}n.setupScrollTracking(f),n.setupAutoLaunchScrollTracking(f);var m=void 0!==n.config.show_launcher?Boolean(n.config.show_launcher):null===(t=null==f?void 0:f.show_launcher)||void 0===t||t,g=!0===(null===(o=null==f?void 0:f.launcher_delay)||void 0===o?void 0:o.enabled),_=null!==(a=null!==(r=null===(i=null==f?void 0:f.launcher_delay)||void 0===i?void 0:i.seconds)&&void 0!==r?r:null===(l=null==f?void 0:f.launcher_delay)||void 0===l?void 0:l.delay)&&void 0!==a?a:0,b=!0===(null===(s=null==f?void 0:f.launcher_scroll)||void 0===s?void 0:s.enabled),y=null!==(d=null===(c=null==f?void 0:f.launcher_scroll)||void 0===c?void 0:c.depth)&&void 0!==d?d:0,w=b&&Number(y)>0;console.log("[Vanilla SDK] Launcher visibility check",{finalShowLauncher:m,delayEnabled:g,seconds:_,scrollEnabled:b,scrollDepth:y,requiresScroll:w,hasScrolledPastDepth:n.hasScrolledPastDepth});var E=!0;if(w){var I=window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0;E=I>=Number(y)||n.hasScrolledPastDepth,console.log("[Vanilla SDK] Scroll condition check",{currentScrollY:I,requiredDepth:Number(y),hasScrolledPastDepthState:n.hasScrolledPastDepth,scrollConditionMet:E})}var T=function(){if(n.isIframeLoaded)if(n.floatingButton)n.floatingButton.update({config:f,isIframeVisible:v,position:n.config.position,sideSpacing:n.config.sideSpacing,bottomSpacing:n.config.bottomSpacing,launcher_size:n.config.launcher_size}),n.handleAutoLaunch(f,v);else{if(n.floatingButton=new tt({config:f,toggleIframe:n.toggleIframe,isIframeVisible:v,onEvent:n.config.onEvent,onInternalEvent:n.eventEmitter.onInternalEvent,position:n.config.position,sideSpacing:n.config.sideSpacing,bottomSpacing:n.config.bottomSpacing,launcher_size:n.config.launcher_size}),n.floatingButton.getElement&&"function"==typeof n.floatingButton.getElement){var e=n.floatingButton.getElement();e&&n.container&&n.container.getElement().appendChild(e)}n.handleAutoLaunch(f,v)}},S=function(){n.floatingButton&&(n.floatingButton.destroy(),n.floatingButton=null)};n.launcherDelayTimeout&&(clearTimeout(n.launcherDelayTimeout),n.launcherDelayTimeout=null),m?w&&!E?(console.log("[Vanilla SDK] Scroll required but condition not met, unmounting button"),S()):g&&Number(_)>0?n.floatingButton?n.isIframeLoaded&&T():n.launcherDelayTimeout=window.setTimeout((function(){var e,t,o,i=n.stateManager.getState().chatbotConfig,r=!0===(null===(e=null==i?void 0:i.launcher_scroll)||void 0===e?void 0:e.enabled),l=null!==(o=null===(t=null==i?void 0:i.launcher_scroll)||void 0===t?void 0:t.depth)&&void 0!==o?o:0,a=r&&Number(l)>0,s=!0;a&&(s=(window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0)>=Number(l)||n.hasScrolledPastDepth);!n.isIframeLoaded||a&&!s||T(),n.launcherDelayTimeout=null}),1e3*Number(_)):(console.log("[Vanilla SDK] No delay, checking iframe loaded",{isIframeLoaded:n.isIframeLoaded}),n.isIframeLoaded?(console.log("[Vanilla SDK] Mounting button immediately"),T()):console.log("[Vanilla SDK] Iframe not loaded yet, button will mount when loaded")):(console.log("[Vanilla SDK] show_launcher is false, unmounting button"),S())}}},this.setupAutoLaunchScrollTracking=function(e){var t,o,i;if(e&&!n.hasAutoLaunched){var r=!0===(null===(t=null==e?void 0:e.auto_launch_scroll)||void 0===t?void 0:t.enabled),l=null!==(i=null===(o=null==e?void 0:e.auto_launch_scroll)||void 0===o?void 0:o.depth)&&void 0!==i?i:0;if(n.autoLaunchScrollHandler&&(window.removeEventListener("scroll",n.autoLaunchScrollHandler),n.autoLaunchScrollHandler=null),!r||Number(l)<=0)n.hasScrolledPastAutoLaunchDepth=!1;else{var a=function(){if(!n.hasScrolledPastAutoLaunchDepth&&(window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0)>=Number(l)){n.hasScrolledPastAutoLaunchDepth=!0;var e=n.stateManager.getState();e.chatbotConfig&&n.handleAutoLaunch(e.chatbotConfig,e.isIframeVisible)}};a(),n.autoLaunchScrollHandler=a,window.addEventListener("scroll",n.autoLaunchScrollHandler,{passive:!0})}}},this.handleAutoLaunch=function(e,t){var o,i,r,l,a,s,c;if(e&&!n.hasAutoLaunched&&n.isIframeLoaded&&!t){var d=void 0!==n.config.show_launcher?Boolean(n.config.show_launcher):null===(o=null==e?void 0:e.show_launcher)||void 0===o||o,u=!0===(null==e?void 0:e.auto_launch),p=!!n.floatingButton;if(d&&u&&p){var f=!0===(null===(i=null==e?void 0:e.auto_launch_delay)||void 0===i?void 0:i.enabled),v=null!==(l=null===(r=null==e?void 0:e.auto_launch_delay)||void 0===r?void 0:r.seconds)&&void 0!==l?l:0,h=!0===(null===(a=null==e?void 0:e.auto_launch_scroll)||void 0===a?void 0:a.enabled),m=null!==(c=null===(s=null==e?void 0:e.auto_launch_scroll)||void 0===s?void 0:s.depth)&&void 0!==c?c:0,g=h&&Number(m)>0,_=!0;if(g)_=(window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0)>=Number(m)||n.hasScrolledPastAutoLaunchDepth;if(!g||_){n.autoLaunchDelayTimeout&&(clearTimeout(n.autoLaunchDelayTimeout),n.autoLaunchDelayTimeout=null);var b=function(){n.hasAutoLaunched||t||(n.hasAutoLaunched=!0,n.toggleIframe(),n.eventEmitter.emit(x.CHATBOT_BUTTON_CLICKED))};f&&Number(v)>0?n.autoLaunchDelayTimeout=window.setTimeout((function(){var e=!0;g&&(e=(window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0)>=Number(m)||n.hasScrolledPastAutoLaunchDepth);g&&!e||b(),n.autoLaunchDelayTimeout=null}),1e3*Number(v)):b()}}}},this.setupScrollTracking=function(e){var t,o,i,r,l;if(console.log("[Vanilla SDK] setupScrollTracking called",{hasConfig:!!e,scrollEnabled:null===(t=null==e?void 0:e.launcher_scroll)||void 0===t?void 0:t.enabled,scrollDepth:null===(o=null==e?void 0:e.launcher_scroll)||void 0===o?void 0:o.depth}),e){var a=!0===(null===(i=null==e?void 0:e.launcher_scroll)||void 0===i?void 0:i.enabled),s=null!==(l=null===(r=null==e?void 0:e.launcher_scroll)||void 0===r?void 0:r.depth)&&void 0!==l?l:0;if(n.scrollHandler&&(window.removeEventListener("scroll",n.scrollHandler),n.scrollHandler=null),!a||Number(s)<=0)return console.log("[Vanilla SDK] Scroll disabled or depth <= 0, resetting state"),void(n.hasScrolledPastDepth=!1);var c=function(){if(!n.hasScrolledPastDepth){var e=window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0;if(console.log("[Vanilla SDK] Checking scroll depth",{currentScrollY:e,requiredDepth:Number(s),hasScrolledPast:e>=Number(s),currentState:n.hasScrolledPastDepth}),e>=Number(s)){console.log("[Vanilla SDK] Scroll depth reached! Setting flag to true"),n.hasScrolledPastDepth=!0;var t=n.stateManager.getState();n.handleStateChange({isInitialized:t.isInitialized,error:t.error,chatbotConfig:t.chatbotConfig,isIframeVisible:t.isIframeVisible})}}};console.log("[Vanilla SDK] Checking initial scroll position"),c(),n.scrollHandler=c,window.addEventListener("scroll",n.scrollHandler,{passive:!0})}},this.toggleIframe=function(){var e=n.stateManager.getState();n.stateManager.toggleIframeVisibility(),n.eventEmitter.emit(e.isIframeVisible?x.CHATBOT_CLOSED:x.CHATBOT_BUTTON_CLICKED)},this.handleClose=function(){n.stateManager.closeIframe(),n.eventEmitter.emit(x.CHATBOT_CLOSED)};var t=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=t,Jn(),!e.api_key)throw mn.trackError(new Error(Nn[gn](e.api_key)),"RobylonChatbot",{errorCode:gn,errorType:Cn,context:{timestamp:Date.now()}}),new Error("API key is required");try{mn.initialize(e.api_key,e.user_id)}catch(e){mn.trackError(e instanceof Error?e:new Error(String(e)),"RobylonChatbot",{errorCode:wn,errorType:Cn,context:{timestamp:Date.now()}})}this.stateManager=function(e){var n={isInitialized:!1,isInitializing:!1,error:null,chatbotConfig:null,isIframeVisible:!1},t=[],o=function(e){n=b(b({},n),e),t.forEach((function(e){return e(n)}))};return{getState:function(){return n},initialize:function(){return y(void 0,void 0,void 0,(function(){var n,t,i;return w(this,(function(r){switch(r.label){case 0:if(!e.api_key)return mn.trackError(new Error(Nn[gn](e.api_key)),"ChatbotStateManager",{errorCode:gn,errorType:Cn,context:{timestamp:Date.now()}}),[2];o({isInitializing:!0}),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,Gn(e)];case 2:return n=r.sent(),[4,new Promise((function(e,t){jn(n,(function(){o({isInitialized:!0,chatbotConfig:n}),e()}),(function(e){t(e)}))}))];case 3:return r.sent(),[3,6];case 4:return t=r.sent(),i=t instanceof Error?t.message:"Failed to initialize chatbot",o({error:i}),mn.trackError(t instanceof Error?t:new Error(i),"ChatbotStateManager",{errorCode:yn,errorType:Cn,context:{timestamp:Date.now()}}),[3,6];case 5:return o({isInitializing:!1}),[7];case 6:return[2]}}))}))},toggleIframeVisibility:function(){o({isIframeVisible:!n.isIframeVisible})},closeIframe:function(){o({isIframeVisible:!1})},updateState:o,subscribe:function(e){return t.push(e),function(){var n=t.indexOf(e);n>-1&&t.splice(n,1)}},unsubscribe:function(e){var n=t.indexOf(e);n>-1&&t.splice(n,1)}}}({api_key:e.api_key,user_id:e.user_id,user_token:e.user_token,user_profile:e.user_profile}),this.eventEmitter=rt({api_key:e.api_key,user_profile:e.user_profile,onEvent:e.onEvent,chatbotConfig:null}),this.initialize()}return e.prototype.initialize=function(){return y(this,void 0,void 0,(function(){var e;return w(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.stateManager.initialize()];case 1:return n.sent(),this.stateManager.subscribe(this.handleStateChange),this.handleStateChange(this.stateManager.getState()),[3,3];case 2:return e=n.sent(),mn.trackError(e instanceof Error?e:new Error(String(e)),"RobylonChatbot.initialize",{errorCode:yn,errorType:Cn,context:{timestamp:Date.now()}}),[3,3];case 3:return[2]}}))}))},e.prototype.show=function(){this.stateManager.getState().isIframeVisible||(this.stateManager.toggleIframeVisibility(),this.eventEmitter.emit(x.CHATBOT_BUTTON_CLICKED))},e.prototype.hide=function(){this.stateManager.getState().isIframeVisible&&(this.stateManager.closeIframe(),this.eventEmitter.emit(x.CHATBOT_CLOSED))},e.prototype.toggle=function(){this.toggleIframe()},e.prototype.destroy=function(){this.isDestroyed=!0,this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler),this.scrollHandler=null),this.autoLaunchScrollHandler&&(window.removeEventListener("scroll",this.autoLaunchScrollHandler),this.autoLaunchScrollHandler=null),this.autoLaunchDelayTimeout&&(clearTimeout(this.autoLaunchDelayTimeout),this.autoLaunchDelayTimeout=null),this.floatingButton&&(this.floatingButton.destroy(),this.floatingButton=null),this.launcherDelayTimeout&&(clearTimeout(this.launcherDelayTimeout),this.launcherDelayTimeout=null),this.iframe&&(this.iframe.destroy(),this.iframe=null),this.container&&(this.container.destroy(),this.container=null),this.stateManager.unsubscribe(this.handleStateChange)},e.prototype.getState=function(){return this.stateManager.getState().isInitialized?"initialized":"uninitialized"},e}();function at(e){return new lt(e)}if("undefined"!=typeof window){!function(){if("undefined"!=typeof window){var e=window,n=(null==e?void 0:e.RobylonChatbot)||(null==e?void 0:e.R);if(n&&Array.isArray(n.q)){var t=null;n.q.forEach((function(e){var n=e[0];if("init"===n){var o=e[1]||{};t=at(o)}else t&&"function"==typeof t[n]&&t[n]()})),e.RobylonChatbot=function(e){var n=Array.prototype.slice.call(arguments,1);return"init"===e?t=at(n[0]||{}):t&&"function"==typeof t[e]?t[e].apply(t,n):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 st=window,ct=null==st?void 0:st.RobylonChatbot;ct&&!(null==st?void 0:st.R)&&(st.R=ct)}var dt={create:at,getState:function(){return"initialized"}};export{Qn as Chatbot,u as ChatbotInterfaceType,g as ConditionType,h as DisplayAttributesType,f as LauncherType,m as LogicalConditionType,_ as MessageDisplayType,v as ProactiveSendTimeType,dt as RobylonChatbot,p as WidgetPositionEnums,$n as useChatbot};
3
+ const{entries:Z,setPrototypeOf:Q,isFrozen:$,getPrototypeOf:ee,getOwnPropertyDescriptor:ne}=Object;let{freeze:te,seal:oe,create:ie}=Object,{apply:re,construct:le}="undefined"!=typeof Reflect&&Reflect;te||(te=function(e){return e}),oe||(oe=function(e){return e}),re||(re=function(e,n){for(var t=arguments.length,o=new Array(t>2?t-2:0),i=2;i<t;i++)o[i-2]=arguments[i];return e.apply(n,o)}),le||(le=function(e){for(var n=arguments.length,t=new Array(n>1?n-1:0),o=1;o<n;o++)t[o-1]=arguments[o];return new e(...t)});const ae=Ee(Array.prototype.forEach),se=Ee(Array.prototype.lastIndexOf),ce=Ee(Array.prototype.pop),de=Ee(Array.prototype.push),ue=Ee(Array.prototype.splice),pe=Ee(String.prototype.toLowerCase),fe=Ee(String.prototype.toString),ve=Ee(String.prototype.match),he=Ee(String.prototype.replace),me=Ee(String.prototype.indexOf),ge=Ee(String.prototype.trim),_e=Ee(Object.prototype.hasOwnProperty),be=Ee(RegExp.prototype.test),ye=(we=TypeError,function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return le(we,n)});var we;function Ee(e){return function(n){n instanceof RegExp&&(n.lastIndex=0);for(var t=arguments.length,o=new Array(t>1?t-1:0),i=1;i<t;i++)o[i-1]=arguments[i];return re(e,n,o)}}function Ie(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:pe;Q&&Q(e,null);let o=n.length;for(;o--;){let i=n[o];if("string"==typeof i){const e=t(i);e!==i&&($(n)||(n[o]=e),i=e)}e[i]=!0}return e}function Te(e){for(let n=0;n<e.length;n++){_e(e,n)||(e[n]=null)}return e}function Se(e){const n=ie(null);for(const[t,o]of Z(e)){_e(e,t)&&(Array.isArray(o)?n[t]=Te(o):o&&"object"==typeof o&&o.constructor===Object?n[t]=Se(o):n[t]=o)}return n}function xe(e,n){for(;null!==e;){const t=ne(e,n);if(t){if(t.get)return Ee(t.get);if("function"==typeof t.value)return Ee(t.value)}e=ee(e)}return function(){return null}}const Ae=te(["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"]),Ce=te(["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"]),Oe=te(["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"]),De=te(["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"]),Re=te(["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"]),Ne=te(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Le=te(["#text"]),ke=te(["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"]),Me=te(["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"]),ze=te(["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"]),Pe=te(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),He=oe(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Fe=oe(/<%[\w\W]*|[\w\W]*%>/gm),Ue=oe(/\$\{[\w\W]*/gm),Be=oe(/^data-[\-\w.\u00B7-\uFFFF]+$/),We=oe(/^aria-[\-\w]+$/),je=oe(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ve=oe(/^(?:\w+script|data):/i),Ge=oe(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ye=oe(/^html$/i),Ke=oe(/^[a-z][.\w]*(-[.\w]+)+$/i);var Xe=Object.freeze({__proto__:null,ARIA_ATTR:We,ATTR_WHITESPACE:Ge,CUSTOM_ELEMENT:Ke,DATA_ATTR:Be,DOCTYPE_NAME:Ye,ERB_EXPR:Fe,IS_ALLOWED_URI:je,IS_SCRIPT_OR_DATA:Ve,MUSTACHE_EXPR:He,TMPLIT_EXPR:Ue});const qe=1,Je=3,Ze=7,Qe=8,$e=9,en=function(){return"undefined"==typeof window?null:window};var nn=function e(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:en();const t=n=>e(n);if(t.version="3.3.0",t.removed=[],!n||!n.document||n.document.nodeType!==$e||!n.Element)return t.isSupported=!1,t;let{document:o}=n;const i=o,r=i.currentScript,{DocumentFragment:l,HTMLTemplateElement:a,Node:s,Element:c,NodeFilter:d,NamedNodeMap:u=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:p,DOMParser:f,trustedTypes:v}=n,h=c.prototype,m=xe(h,"cloneNode"),g=xe(h,"remove"),_=xe(h,"nextSibling"),b=xe(h,"childNodes"),y=xe(h,"parentNode");if("function"==typeof a){const e=o.createElement("template");e.content&&e.content.ownerDocument&&(o=e.content.ownerDocument)}let w,E="";const{implementation:I,createNodeIterator:T,createDocumentFragment:S,getElementsByTagName:x}=o,{importNode:A}=i;let C={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};t.isSupported="function"==typeof Z&&"function"==typeof y&&I&&void 0!==I.createHTMLDocument;const{MUSTACHE_EXPR:O,ERB_EXPR:D,TMPLIT_EXPR:R,DATA_ATTR:N,ARIA_ATTR:L,IS_SCRIPT_OR_DATA:k,ATTR_WHITESPACE:M,CUSTOM_ELEMENT:z}=Xe;let{IS_ALLOWED_URI:P}=Xe,H=null;const F=Ie({},[...Ae,...Ce,...Oe,...Re,...Le]);let U=null;const B=Ie({},[...ke,...Me,...ze,...Pe]);let W=Object.seal(ie(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}})),j=null,V=null;const G=Object.seal(ie(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Y=!0,K=!0,X=!1,q=!0,J=!1,Q=!0,$=!1,ee=!1,ne=!1,oe=!1,re=!1,le=!1,we=!0,Ee=!1,Te=!0,He=!1,Fe={},Ue=null;const Be=Ie({},["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 We=null;const Ve=Ie({},["audio","video","img","source","image","track"]);let Ge=null;const Ke=Ie({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),nn="http://www.w3.org/1998/Math/MathML",tn="http://www.w3.org/2000/svg",on="http://www.w3.org/1999/xhtml";let rn=on,ln=!1,an=null;const sn=Ie({},[nn,tn,on],fe);let cn=Ie({},["mi","mo","mn","ms","mtext"]),dn=Ie({},["annotation-xml"]);const un=Ie({},["title","style","font","a","script"]);let pn=null;const fn=["application/xhtml+xml","text/html"];let vn=null,hn=null;const mn=o.createElement("form"),gn=function(e){return e instanceof RegExp||e instanceof Function},_n=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!hn||hn!==e){if(e&&"object"==typeof e||(e={}),e=Se(e),pn=-1===fn.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,vn="application/xhtml+xml"===pn?fe:pe,H=_e(e,"ALLOWED_TAGS")?Ie({},e.ALLOWED_TAGS,vn):F,U=_e(e,"ALLOWED_ATTR")?Ie({},e.ALLOWED_ATTR,vn):B,an=_e(e,"ALLOWED_NAMESPACES")?Ie({},e.ALLOWED_NAMESPACES,fe):sn,Ge=_e(e,"ADD_URI_SAFE_ATTR")?Ie(Se(Ke),e.ADD_URI_SAFE_ATTR,vn):Ke,We=_e(e,"ADD_DATA_URI_TAGS")?Ie(Se(Ve),e.ADD_DATA_URI_TAGS,vn):Ve,Ue=_e(e,"FORBID_CONTENTS")?Ie({},e.FORBID_CONTENTS,vn):Be,j=_e(e,"FORBID_TAGS")?Ie({},e.FORBID_TAGS,vn):Se({}),V=_e(e,"FORBID_ATTR")?Ie({},e.FORBID_ATTR,vn):Se({}),Fe=!!_e(e,"USE_PROFILES")&&e.USE_PROFILES,Y=!1!==e.ALLOW_ARIA_ATTR,K=!1!==e.ALLOW_DATA_ATTR,X=e.ALLOW_UNKNOWN_PROTOCOLS||!1,q=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,J=e.SAFE_FOR_TEMPLATES||!1,Q=!1!==e.SAFE_FOR_XML,$=e.WHOLE_DOCUMENT||!1,oe=e.RETURN_DOM||!1,re=e.RETURN_DOM_FRAGMENT||!1,le=e.RETURN_TRUSTED_TYPE||!1,ne=e.FORCE_BODY||!1,we=!1!==e.SANITIZE_DOM,Ee=e.SANITIZE_NAMED_PROPS||!1,Te=!1!==e.KEEP_CONTENT,He=e.IN_PLACE||!1,P=e.ALLOWED_URI_REGEXP||je,rn=e.NAMESPACE||on,cn=e.MATHML_TEXT_INTEGRATION_POINTS||cn,dn=e.HTML_INTEGRATION_POINTS||dn,W=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&gn(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(W.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&gn(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(W.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(W.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),J&&(K=!1),re&&(oe=!0),Fe&&(H=Ie({},Le),U=[],!0===Fe.html&&(Ie(H,Ae),Ie(U,ke)),!0===Fe.svg&&(Ie(H,Ce),Ie(U,Me),Ie(U,Pe)),!0===Fe.svgFilters&&(Ie(H,Oe),Ie(U,Me),Ie(U,Pe)),!0===Fe.mathMl&&(Ie(H,Re),Ie(U,ze),Ie(U,Pe))),e.ADD_TAGS&&("function"==typeof e.ADD_TAGS?G.tagCheck=e.ADD_TAGS:(H===F&&(H=Se(H)),Ie(H,e.ADD_TAGS,vn))),e.ADD_ATTR&&("function"==typeof e.ADD_ATTR?G.attributeCheck=e.ADD_ATTR:(U===B&&(U=Se(U)),Ie(U,e.ADD_ATTR,vn))),e.ADD_URI_SAFE_ATTR&&Ie(Ge,e.ADD_URI_SAFE_ATTR,vn),e.FORBID_CONTENTS&&(Ue===Be&&(Ue=Se(Ue)),Ie(Ue,e.FORBID_CONTENTS,vn)),Te&&(H["#text"]=!0),$&&Ie(H,["html","head","body"]),H.table&&(Ie(H,["tbody"]),delete j.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw ye('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw ye('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,n){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let t=null;const o="data-tt-policy-suffix";n&&n.hasAttribute(o)&&(t=n.getAttribute(o));const i="dompurify"+(t?"#"+t:"");try{return e.createPolicy(i,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+i+" could not be created."),null}}(v,r)),null!==w&&"string"==typeof E&&(E=w.createHTML(""));te&&te(e),hn=e}},bn=Ie({},[...Ce,...Oe,...De]),yn=Ie({},[...Re,...Ne]),wn=function(e){de(t.removed,{element:e});try{y(e).removeChild(e)}catch(n){g(e)}},En=function(e,n){try{de(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch(e){de(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),"is"===e)if(oe||re)try{wn(n)}catch(e){}else try{n.setAttribute(e,"")}catch(e){}},In=function(e){let n=null,t=null;if(ne)e="<remove></remove>"+e;else{const n=ve(e,/^[\r\n\t ]+/);t=n&&n[0]}"application/xhtml+xml"===pn&&rn===on&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const i=w?w.createHTML(e):e;if(rn===on)try{n=(new f).parseFromString(i,pn)}catch(e){}if(!n||!n.documentElement){n=I.createDocument(rn,"template",null);try{n.documentElement.innerHTML=ln?E:i}catch(e){}}const r=n.body||n.documentElement;return e&&t&&r.insertBefore(o.createTextNode(t),r.childNodes[0]||null),rn===on?x.call(n,$?"html":"body")[0]:$?n.documentElement:r},Tn=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)},Sn=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)},xn=function(e){return"function"==typeof s&&e instanceof s};function An(e,n,o){ae(e,(e=>{e.call(t,n,o,hn)}))}const Cn=function(e){let n=null;if(An(C.beforeSanitizeElements,e,null),Sn(e))return wn(e),!0;const o=vn(e.nodeName);if(An(C.uponSanitizeElement,e,{tagName:o,allowedTags:H}),Q&&e.hasChildNodes()&&!xn(e.firstElementChild)&&be(/<[/\w!]/g,e.innerHTML)&&be(/<[/\w!]/g,e.textContent))return wn(e),!0;if(e.nodeType===Ze)return wn(e),!0;if(Q&&e.nodeType===Qe&&be(/<[/\w]/g,e.data))return wn(e),!0;if(!(G.tagCheck instanceof Function&&G.tagCheck(o))&&(!H[o]||j[o])){if(!j[o]&&Dn(o)){if(W.tagNameCheck instanceof RegExp&&be(W.tagNameCheck,o))return!1;if(W.tagNameCheck instanceof Function&&W.tagNameCheck(o))return!1}if(Te&&!Ue[o]){const n=y(e)||e.parentNode,t=b(e)||e.childNodes;if(t&&n){for(let o=t.length-1;o>=0;--o){const i=m(t[o],!0);i.__removalCount=(e.__removalCount||0)+1,n.insertBefore(i,_(e))}}}return wn(e),!0}return e instanceof c&&!function(e){let n=y(e);n&&n.tagName||(n={namespaceURI:rn,tagName:"template"});const t=pe(e.tagName),o=pe(n.tagName);return!!an[e.namespaceURI]&&(e.namespaceURI===tn?n.namespaceURI===on?"svg"===t:n.namespaceURI===nn?"svg"===t&&("annotation-xml"===o||cn[o]):Boolean(bn[t]):e.namespaceURI===nn?n.namespaceURI===on?"math"===t:n.namespaceURI===tn?"math"===t&&dn[o]:Boolean(yn[t]):e.namespaceURI===on?!(n.namespaceURI===tn&&!dn[o])&&!(n.namespaceURI===nn&&!cn[o])&&!yn[t]&&(un[t]||!bn[t]):!("application/xhtml+xml"!==pn||!an[e.namespaceURI]))}(e)?(wn(e),!0):"noscript"!==o&&"noembed"!==o&&"noframes"!==o||!be(/<\/no(script|embed|frames)/i,e.innerHTML)?(J&&e.nodeType===Je&&(n=e.textContent,ae([O,D,R],(e=>{n=he(n,e," ")})),e.textContent!==n&&(de(t.removed,{element:e.cloneNode()}),e.textContent=n)),An(C.afterSanitizeElements,e,null),!1):(wn(e),!0)},On=function(e,n,t){if(we&&("id"===n||"name"===n)&&(t in o||t in mn))return!1;if(K&&!V[n]&&be(N,n));else if(Y&&be(L,n));else if(G.attributeCheck instanceof Function&&G.attributeCheck(n,e));else if(!U[n]||V[n]){if(!(Dn(e)&&(W.tagNameCheck instanceof RegExp&&be(W.tagNameCheck,e)||W.tagNameCheck instanceof Function&&W.tagNameCheck(e))&&(W.attributeNameCheck instanceof RegExp&&be(W.attributeNameCheck,n)||W.attributeNameCheck instanceof Function&&W.attributeNameCheck(n,e))||"is"===n&&W.allowCustomizedBuiltInElements&&(W.tagNameCheck instanceof RegExp&&be(W.tagNameCheck,t)||W.tagNameCheck instanceof Function&&W.tagNameCheck(t))))return!1}else if(Ge[n]);else if(be(P,he(t,M,"")));else if("src"!==n&&"xlink:href"!==n&&"href"!==n||"script"===e||0!==me(t,"data:")||!We[e]){if(X&&!be(k,he(t,M,"")));else if(t)return!1}else;return!0},Dn=function(e){return"annotation-xml"!==e&&ve(e,z)},Rn=function(e){An(C.beforeSanitizeAttributes,e,null);const{attributes:n}=e;if(!n||Sn(e))return;const o={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:U,forceKeepAttr:void 0};let i=n.length;for(;i--;){const r=n[i],{name:l,namespaceURI:a,value:s}=r,c=vn(l),d=s;let u="value"===l?d:ge(d);if(o.attrName=c,o.attrValue=u,o.keepAttr=!0,o.forceKeepAttr=void 0,An(C.uponSanitizeAttribute,e,o),u=o.attrValue,!Ee||"id"!==c&&"name"!==c||(En(l,e),u="user-content-"+u),Q&&be(/((--!?|])>)|<\/(style|title|textarea)/i,u)){En(l,e);continue}if("attributename"===c&&ve(u,"href")){En(l,e);continue}if(o.forceKeepAttr)continue;if(!o.keepAttr){En(l,e);continue}if(!q&&be(/\/>/i,u)){En(l,e);continue}J&&ae([O,D,R],(e=>{u=he(u,e," ")}));const p=vn(e.nodeName);if(On(p,c,u)){if(w&&"object"==typeof v&&"function"==typeof v.getAttributeType)if(a);else switch(v.getAttributeType(p,c)){case"TrustedHTML":u=w.createHTML(u);break;case"TrustedScriptURL":u=w.createScriptURL(u)}if(u!==d)try{a?e.setAttributeNS(a,l,u):e.setAttribute(l,u),Sn(e)?wn(e):ce(t.removed)}catch(n){En(l,e)}}else En(l,e)}An(C.afterSanitizeAttributes,e,null)},Nn=function e(n){let t=null;const o=Tn(n);for(An(C.beforeSanitizeShadowDOM,n,null);t=o.nextNode();)An(C.uponSanitizeShadowNode,t,null),Cn(t),Rn(t),t.content instanceof l&&e(t.content);An(C.afterSanitizeShadowDOM,n,null)};return t.sanitize=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=null,r=null,a=null,c=null;if(ln=!e,ln&&(e="\x3c!--\x3e"),"string"!=typeof e&&!xn(e)){if("function"!=typeof e.toString)throw ye("toString is not a function");if("string"!=typeof(e=e.toString()))throw ye("dirty is not a string, aborting")}if(!t.isSupported)return e;if(ee||_n(n),t.removed=[],"string"==typeof e&&(He=!1),He){if(e.nodeName){const n=vn(e.nodeName);if(!H[n]||j[n])throw ye("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof s)o=In("\x3c!----\x3e"),r=o.ownerDocument.importNode(e,!0),r.nodeType===qe&&"BODY"===r.nodeName||"HTML"===r.nodeName?o=r:o.appendChild(r);else{if(!oe&&!J&&!$&&-1===e.indexOf("<"))return w&&le?w.createHTML(e):e;if(o=In(e),!o)return oe?null:le?E:""}o&&ne&&wn(o.firstChild);const d=Tn(He?e:o);for(;a=d.nextNode();)Cn(a),Rn(a),a.content instanceof l&&Nn(a.content);if(He)return e;if(oe){if(re)for(c=S.call(o.ownerDocument);o.firstChild;)c.appendChild(o.firstChild);else c=o;return(U.shadowroot||U.shadowrootmode)&&(c=A.call(i,c,!0)),c}let u=$?o.outerHTML:o.innerHTML;return $&&H["!doctype"]&&o.ownerDocument&&o.ownerDocument.doctype&&o.ownerDocument.doctype.name&&be(Ye,o.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+o.ownerDocument.doctype.name+">\n"+u),J&&ae([O,D,R],(e=>{u=he(u,e," ")})),w&&le?w.createHTML(u):u},t.setConfig=function(){_n(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),ee=!0},t.clearConfig=function(){hn=null,ee=!1},t.isValidAttribute=function(e,n,t){hn||_n({});const o=vn(e),i=vn(n);return On(o,i,t)},t.addHook=function(e,n){"function"==typeof n&&de(C[e],n)},t.removeHook=function(e,n){if(void 0!==n){const t=se(C[e],n);return-1===t?void 0:ue(C[e],t,1)[0]}return ce(C[e])},t.removeHooks=function(e){C[e]=[]},t.removeAllHooks=function(){C={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},t}(),tn=function(e){return e?nn.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 on(e){if(!e||"string"!=typeof e||0===e.trim().length)return"ltr";var n=e.replace(/<[^>]*>/g,"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_`#]/g,"").trim();if(0===n.length)return"ltr";for(var t=/[\u0590-\u05FF\u0600-\u06FF\u0700-\u074F\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]/,o=0,i=0,r=0,l=n;r<l.length;r++){var a=l[r];/\s|\d|[.,;:!?()[\]{}'"`\-_=+*/\\|@#$%^&*~]/.test(a)||(i++,t.test(a)&&o++)}return 0===i?"ltr":o/i>.3?"rtl":"ltr"}var rn,ln=n((function(n){var r,l,a,s,c,d,u,p,v,h,m,g,y,w,S,A,C,D,L,k,M=n.config,z=n.toggleIframe,P=n.isIframeVisible,H=n.onEvent,U=n.onInternalEvent,B=n.position,W=n.sideSpacing,j=n.bottomSpacing,K=n.launcher_type,X=n.launcher_properties_text,q=n.shouldFadeIn,Z=n.launcher_size,Q=t(null),$=O().copilotUrl,ee=o(!1),ne=ee[0],te=ee[1],oe=o(!1),ie=oe[0],re=oe[1],le=o([]),ae=le[0],se=le[1],ce=o(!1),de=ce[0],ue=ce[1],pe=t([]),fe=t(),ve=t(new Set),he=t(new Map),me=t(new Set),ge=null!==(a=null==M?void 0:M.launcher_size_multiplier)&&void 0!==a?a:1,_e=null!=Z?Z:48*ge;i((function(){var e=function(){var e=(null===window||void 0===window?void 0:window.innerWidth)<560;te(e)};return e(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[]),i((function(){Q.current&&requestAnimationFrame((function(){null==H||H({type:x.CHATBOT_BUTTON_LOADED,timestamp:Date.now()}),U(x.CHATBOT_BUTTON_LOADED)}))}),[H,U]),i((function(){if(Q.current&&q){Q.current.style.opacity="0";var e=requestAnimationFrame((function(){Q.current&&(Q.current.style.opacity="1")}));return function(){return cancelAnimationFrame(e)}}}),[q]);var be=(null==M?void 0:M.launcher_type)?(null===(c=null===(s=null==M?void 0:M.images)||void 0===s?void 0:s.launcher_image_url)||void 0===c?void 0:c.url)||"".concat($,"/chatbubble.png"):(null==M?void 0:M.image_url)||"".concat($,"/chatbubble.png"),ye=function(){return e.createElement("div",{style:{position:"relative",width:"100%",height:"100%"}},e.createElement("img",{src:be,alt:"Chat","aria-hidden":P,style:{zIndex:1e3,cursor:"pointer",borderRadius:"50%",objectFit:"cover",width:"100%",height:"100%",boxSizing:"border-box",position:"absolute",inset:0,opacity:P?0:1}}),P?(n=Math.round(.5*_e),e.createElement("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center"}},e.createElement("svg",{width:n,height:n,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"}))))):null);var n},we=B||(null===(d=M.interface_properties)||void 0===d?void 0:d.position)||"Right",Ee=null!==(p=null!=W?W:null===(u=M.interface_properties)||void 0===u?void 0:u.side_spacing)&&void 0!==p?p:20,Ie=null!==(h=null!=j?j:null===(v=M.interface_properties)||void 0===v?void 0:v.bottom_spacing)&&void 0!==h?h:20,Te=K||(null==M?void 0:M.launcher_type)||f.IMAGE,Se=X||(null===(m=null==M?void 0:M.launcher_properties)||void 0===m?void 0:m.text),xe={zIndex:1e3,display:"flex",flexDirection:"column-reverse",alignItems:"center",justifyContent:"center",cursor:"pointer",overflow:"hidden",marginTop:"16px",boxSizing:"border-box"};Te===f.IMAGE&&(xe.width="".concat(_e,"px"),xe.height="".concat(_e,"px"),xe.borderRadius="50%",xe.backgroundColor=M.brand_colour);var Ae=b(b({},xe),((r={position:void 0,bottom:"0",borderRadius:Te===f.IMAGE?"50%":"9999px"})[we.toLowerCase()]="0",r)),Ce=b(b({},xe),((l={position:"fixed",bottom:"".concat(Ie,"px"),borderRadius:Te===f.IMAGE?"50%":"9999px"})[we.toLowerCase()]="".concat(Ee,"px"),l)),Oe=ne?Ce:Ae;i((function(){T.log("Screen width changed, isMobile:",ne,"Style:",Oe)}),[ne,Oe]),T.log("config in floating button",M);i((function(){var e=function(){pe.current.forEach((function(e){return clearTimeout(e)})),pe.current=[]},n=function(){he.current.forEach((function(e){window.removeEventListener("scroll",e)})),he.current.clear(),me.current.clear()},t=function(e,n,t){se((function(o){var i=[];return e.forEach((function(e){(n.get(e)||[]).forEach((function(e){var n="".concat(e.messageId,"-").concat(e.contentIndex);if(!o.some((function(n){return n.id===e.messageId&&n.index===e.contentIndex}))){var t={id:e.messageId,index:e.contentIndex,html:e.html,contentId:e.contentId,messageDisplayType:e.messageDisplayType,messageBubbleBg:null==e?void 0:e.messageBubbleBg,urlToGo:null==e?void 0:e.urlToGo};i.push(t),ve.current.add(n),setTimeout((function(){ve.current.delete(n)}),1200)}}))})),0===t?E(E([],o,!0),i,!0):E(E([],i,!0),o,!0)}))},o=function(){if(e(),n(),se([]),ve.current.clear(),(null==M?void 0:M.proactive_message_obj)&&!G()){var o=J(null==M?void 0:M.proactive_message_obj),i=[],r=[];o.forEach((function(e){"scroll"===e.delayType&&void 0!==e.scrollThreshold&&Number(e.scrollThreshold)>0?r.push(e):i.push(e)}));var l=new Map;i.forEach((function(e){var n=l.get(e.delayMs);n||(n={messageIds:[],groups:new Map},l.set(e.delayMs,n)),n.groups.has(e.messageId)||(n.messageIds.push(e.messageId),n.groups.set(e.messageId,[])),n.groups.get(e.messageId).push(e)})),l.forEach((function(e,n){var o=e.messageIds,i=e.groups,r=window.setTimeout((function(){t(o,i,n)}),n);pe.current.push(r)}));var a=new Map;r.forEach((function(e){var n=e.scrollThreshold||0,t=a.get(n);t||(t={messageIds:[],groups:new Map},a.set(n,t)),t.groups.has(e.messageId)||(t.messageIds.push(e.messageId),t.groups.set(e.messageId,[])),t.groups.get(e.messageId).push(e)})),a.forEach((function(e,n){var o=e.messageIds,i=e.groups,r="scroll-".concat(n),l=function(){if((window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0)>=n&&!me.current.has(r)){me.current.add(r),t(o,i,1);var e=he.current.get(r);e&&(window.removeEventListener("scroll",e),he.current.delete(r))}};l();var a=l;he.current.set(r,a),window.addEventListener("scroll",a,{passive:!0})}))}};return fe.current=F((function(){re(!1),o()})),o(),function(){var t;e(),n(),null===(t=fe.current)||void 0===t||t.call(fe)}}),[null==M?void 0:M.proactive_message_obj]);var De=ae.length>0&&!P&&!ie,Re="Right"===(B||(null===(g=M.interface_properties)||void 0===g?void 0:g.position)||"Right"),Ne=function(){ue(!0),setTimeout((function(){re(!0),V(),ue(!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(R,';\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 ')),De?e.createElement("div",{className:"proactive-message-container",style:{position:"fixed",bottom:"".concat((null!==(w=null!=j?j:null===(y=M.interface_properties)||void 0===y?void 0:y.bottom_spacing)&&void 0!==w?w:20)+(Te===f.IMAGE?_e:void 0!==Z?40:40*ge)+8,"px"),right:Re?"".concat(null!==(A=null!=W?W:null===(S=M.interface_properties)||void 0===S?void 0:S.side_spacing)&&void 0!==A?A:20,"px"):"auto",left:Re?"auto":"".concat(null!==(D=null!=W?W:null===(C=M.interface_properties)||void 0===C?void 0:C.side_spacing)&&void 0!==D?D:20,"px"),maxWidth:"22.875rem",zIndex:2147483646}},e.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:Re?"flex-end":"flex-start"},className:"proactive-message-bubble-container"},ae.map((function(n,t){var o="".concat(n.id,"-").concat(n.index),i=ve.current.has(o),r=10*(ae.length-1-t),l=n.messageDisplayType===_.BUTTON;return console.log("visibleProactives",ae),e.createElement("div",{key:o,onClick:function(){if((null==n?void 0:n.urlToGo)&&"string"==typeof n.urlToGo&&""!==n.urlToGo.trim())window.open(n.urlToGo,"_blank","noopener,noreferrer");else{Y({message_id:n.id,content_string:n.html||null,content_id:n.contentId||null}),z(),Ne();try{window.dispatchEvent(new CustomEvent("rblyn:proactiveClick",{detail:{message_id:n.id,content_string:n.html||null,content_id:n.contentId||null}}))}catch(e){}}},className:de?Re?"proactive-bubble-exit-right":"proactive-bubble-exit-left":i&&!de?Re?"proactive-bubble-enter-right":"proactive-bubble-enter-left":"",style:b({background:(null==n?void 0:n.messageBubbleBg)||"#ffffff",color:"#111",borderRadius:l?"100px":"12px",boxShadow:"0 2px 2px 0 rgba(0, 0, 0, 0.08)",padding:"16px",cursor:"pointer",fontFamily:R,lineHeight:N,fontSize:"14px",marginBottom:t<ae.length-1?16:0,border:"1px solid #F1F2F4",width:"fit-content",maxWidth:"100%",animationDelay:de?"0ms":i?"".concat(r,"ms"):void 0},de?{opacity:0}:i?{opacity:0,transform:Re?"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:on(n.html),dangerouslySetInnerHTML:{__html:tn(n.html)}}),(null==n?void 0:n.urlToGo)&&"string"==typeof n.urlToGo&&""!==n.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==n?void 0:n.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(),Ne()},className:de?"":Re?"proactive-close-enter-right":"proactive-close-enter-left",style:b({position:"absolute",top:"-32px",right:"Right"===(B||(null===(L=M.interface_properties)||void 0===L?void 0:L.position)||"Right")?"0px":"auto",left:"Left"===(B||(null===(k=M.interface_properties)||void 0===k?void 0:k.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:de?"0ms":"".concat(10*(ae.length-1),"ms")},de?{}:{opacity:0,transform:Re?"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:Q,className:"message-bubble-container",style:b(b({},Oe),{transition:"transform 0.2s cubic-bezier(0.2, 1.27, 0.29, 0.97), opacity 280ms ease",transform:P?"scale(0.85)":"scale(1)",opacity:q?0:1}),onClick:function(){z(),Ne()}},function(){switch(Te){case f.TEXT:return n=void 0!==Z?void 0:160*ge,t=void 0!==Z?void 0:40*ge,o=void 0!==Z?void 0:14*ge,i=void 0!==Z?void 0:21*ge,e.createElement("div",{style:{width:void 0!==n?"".concat(n,"px"):"fit-content",maxWidth:void 0!==n?"".concat(n,"px"):"160px",height:void 0!==t?"".concat(t,"px"):"40px",borderRadius:"9999px",backgroundColor:M.brand_colour,display:"flex",alignItems:"center",padding:"9px 20px",boxShadow:"0px 0px 16px 0px rgba(0, 0, 0, 0.24)",boxSizing:"border-box",fontFamily:R,lineHeight:N}},e.createElement("div",{style:{flex:1,minWidth:0}},e.createElement("p",{dir:on(Se),style:{margin:0,color:I(M.brand_colour),fontSize:void 0!==o?"".concat(o,"px"):"0.875rem",fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:R,lineHeight:void 0!==i?"".concat(i,"px"):N,textAlign:"center",WebkitFontSmoothing:"antialiased",textRendering:"optimizeLegibility",textSizeAdjust:"100%"}},Se)));case f.TEXTUAL_IMAGE:return function(){var n,t,o=void 0!==Z?void 0:174*ge,i=void 0!==Z?void 0:40*ge,r=void 0!==Z?void 0:40*ge,l=void 0!==Z?void 0:14*ge,a=void 0!==Z?void 0:21*ge;return e.createElement("div",{style:{maxWidth:void 0!==o?"".concat(o,"px"):"13rem",width:"fit-content",height:void 0!==i?"".concat(i,"px"):"40px",borderRadius:"9999px",backgroundColor:M.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:R,lineHeight:N}},e.createElement("div",{style:{flex:1,minWidth:0}},e.createElement("p",{dir:on(Se),style:{margin:0,color:I(M.brand_colour),fontSize:void 0!==l?"".concat(l,"px"):"0.875rem",fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:R,lineHeight:void 0!==a?"".concat(a,"px"):N,textAlign:"right",WebkitFontSmoothing:"antialiased",textRendering:"optimizeLegibility",textSizeAdjust:"100%"}},Se)),e.createElement("div",{style:{width:void 0!==r?"".concat(r,"px"):"40px",height:void 0!==r?"".concat(r,"px"):"40px",borderRadius:"9999px",overflow:"hidden",position:"relative",flexShrink:0}},e.createElement("img",{src:(null==M?void 0:M.launcher_type)?(null===(t=null===(n=null==M?void 0:M.images)||void 0===n?void 0:n.launcher_image_url)||void 0===t?void 0:t.url)||"".concat($,"/chatbubble.png"):(null==M?void 0:M.image_url)||"".concat($,"/chatbubble.png"),alt:"Chat",style:{width:"100%",height:"100%",objectFit:"cover"}})))}();case f.IMAGE:default:return ye()}var n,t,o,i}()))})),an=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]},sn=function(){var e;if(null===(e=navigator.userAgentData)||void 0===e?void 0:e.brands)for(var n=["Chrome","Firefox","Safari","Edge","Opera"],t=0,o=navigator.userAgentData.brands;t<o.length;t++){var i=o[t];if(n.includes(i.brand))return i.brand}return(/Chrome|Firefox|Safari|Edge|Opera/.exec(navigator.userAgent)||["Unknown"])[0]},cn=function(){var e,n,t,o;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===(n=null===document||void 0===document?void 0:document.body)||void 0===n?void 0:n.clientWidth),height:(null===window||void 0===window?void 0:window.innerHeight)||(null===(t=null===document||void 0===document?void 0:document.documentElement)||void 0===t?void 0:t.clientHeight)||(null===(o=null===document||void 0===document?void 0:document.body)||void 0===o?void 0:o.clientHeight)}},dn=function(){return{platform:"web",os:an(),browser:sn(),sdk_version:"2.0.0-alpha.8",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:cn()};var e};!function(e){e.ERROR="ERROR",e.INFO="INFO"}(rn||(rn={}));var un,pn,fn=["@robylon/web-react-sdk","node_modules/@robylon/web-react-sdk/"],vn=function(e){var n=e.filename,t=e.stack,o=e.message;return!!(n||t||o)&&fn.some((function(e){return(null==n?void 0:n.includes(e))||(null==t?void 0:t.includes(e))||(null==o?void 0:o.includes(e))}))},hn=function(){function e(){var e=this;this.apiKey="",this.userId=null,this.preInitQueue=[],this.isInitialized=!1,this.handleWindowError=function(n){var t,o={filename:n.filename,stack:null===(t=n.error)||void 0===t?void 0:t.stack,message:n.message};vn(o)&&e.trackError(n.error||n.message,"GlobalErrorHandler",{filename:n.filename,lineNo:n.lineno,colNo:n.colno})},this.handleUnhandledRejection=function(n){var t,o,i={stack:null===(t=n.reason)||void 0===t?void 0:t.stack,message:(null===(o=n.reason)||void 0===o?void 0:o.message)||String(n.reason)};vn(i)&&e.trackError(n.reason||"Unhandled Promise Rejection","GlobalPromiseHandler",{reason:n.reason})},this.setupGlobalHandlers()}return e.prototype.setupGlobalHandlers=function(){C()&&(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(){C()&&(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,n){void 0===n&&(n=null);try{if(this.preInitQueue.length>0){var t={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:n,timestamp:Date.now()},timestamp:Date.now()},metadata:dn(),event_type:rn.ERROR,user_id:n};this.sendLog(t).catch(console.error)}this.apiKey=e,this.userId=n,this.isInitialized=!0,this.processPreInitQueue()}catch(t){T.error("Error during ErrorTrackingService initialization:",t),this.preInitQueue.push({error:t instanceof Error?t:new Error(String(t)),componentName:"ErrorTrackingService",additionalInfo:{apiKey:e,userId:n}})}},e.prototype.processPreInitQueue=function(){return y(this,void 0,void 0,(function(){var e,n,t;return w(this,(function(o){switch(o.label){case 0:if(!this.preInitQueue.length)return[2];T.info("Processing ".concat(this.preInitQueue.length," pre-initialization errors")),e=0,n=this.preInitQueue,o.label=1;case 1:return e<n.length?(t=n[e],[4,this.trackError(t.error,t.componentName,b(b({},t.additionalInfo),{preInitError:!0}))]):[3,4];case 2:o.sent(),o.label=3;case 3:return e++,[3,1];case 4:return this.preInitQueue=[],[2]}}))}))},e.prototype.sendLog=function(e){return y(this,void 0,void 0,(function(){var n,t,o,i,r,l;return w(this,(function(a){switch(a.label){case 0:return a.trys.push([0,4,,5]),n=O().apiUrl,[4,fetch("".concat(n,"/users/sdk/record-logs/"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})];case 1:return(t=a.sent()).ok?[3,3]:(i=(o=T).error,r=["Failed to send error log:"],[4,t.text()]);case 2:i.apply(o,r.concat([a.sent()])),a.label=3;case 3:return[3,5];case 4:return l=a.sent(),T.error("Error sending log:",l),[3,5];case 5:return[2]}}))}))},e.prototype.trackError=function(e,n,t){return y(this,void 0,void 0,(function(){var o,i,r;return w(this,(function(l){switch(l.label){case 0:if(this.isInitialized)return[3,5];o={org_id:"UNINITALIZED",event_data:{message:e instanceof Error?e.message:e,stack:e instanceof Error?e.stack:void 0,componentName:n,additionalInfo:b(b({},t),{preInitError:!0,timestamp:Date.now()}),timestamp:Date.now()},metadata:dn(),event_type:rn.ERROR,user_id:this.userId},l.label=1;case 1:return l.trys.push([1,3,,4]),[4,this.sendLog(o)];case 2:return l.sent(),[3,4];case 3:return l.sent(),this.preInitQueue.push({error:e,componentName:n,additionalInfo:t}),T.warn("Error tracked before initialization, queuing:",e),[3,4];case 4:return[2];case 5:return i={message:e instanceof Error?e.message:e,stack:e instanceof Error?e.stack:void 0,componentName:n,additionalInfo:b(b({},t),{timestamp:Date.now()}),timestamp:Date.now()},r={org_id:this.apiKey||"UNINITALIZED",event_data:i,metadata:dn(),event_type:rn.ERROR,user_id:this.userId},[4,this.sendLog(r)];case 6:return l.sent(),[2]}}))}))},e.prototype.trackInfo=function(e,n,t){return y(this,void 0,void 0,(function(){var o,i;return w(this,(function(r){switch(r.label){case 0:return this.apiKey?(o={message:e,componentName:n,additionalInfo:t,timestamp:Date.now()},i={org_id:this.apiKey,event_data:o,metadata:dn(),event_type:rn.INFO,user_id:this.userId},[4,this.sendLog(i)]):(T.error("Error tracking not initialized"),[2]);case 1:return r.sent(),[2]}}))}))},e}(),mn=hn.getInstance(),gn="MISSING_API_KEY",_n="INVALID_API_KEY",bn="CONFIG_FETCH_FAILED",yn="SDK_INIT_FAILED",wn="ERROR_TRACKING_INIT_FAILED",En="API_REQUEST_FAILED",In="NETWORK_ERROR",Tn="INVALID_RESPONSE",Sn="IFRAME_LOAD_FAILED",xn="COOKIE_ACCESS_ERROR",An="COMPONENT_RENDER_ERROR",Cn="INITIALIZATION_ERROR",On="API_ERROR",Dn="RUNTIME_ERROR",Rn="COMPONENT_ERROR",Nn=((un={})[gn]=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.")},un[_n]=function(e){return"SDK Initialization Failed: Provided API key '".concat(e,"' is invalid. API key must be a non-empty string in UUID format.")},un[bn]=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):"")},un[En]=function(e,n,t){return"API Request Failed: Server responded with status ".concat(e," for ").concat(t?"endpoint ".concat(t):"request"," - ").concat(n)},un[In]=function(e){return"Network Error: Failed to communicate with server".concat(e.url?" at ".concat(e.url):"").concat(e.error?" - ".concat(e.error):"")},un[Sn]=function(e){return"Failed to load chatbot interface".concat(e.src?" from ".concat(e.src):"").concat(e.error?". Error: ".concat(e.error):"")},un[Tn]=function(e){return"Invalid API Response: Missing required fields in response data: ".concat(e.join(", "))},un[wn]=function(e){return"Error Tracking Service initialization failed".concat(e.apiKey?" for API key ".concat(e.apiKey):"").concat(e.error?". Error: ".concat(e.error):"")},un[yn]=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)):"")},un[xn]=function(e,n){return"Cookie Access Error: Failed to ".concat(e).concat(n?" cookie '".concat(n,"'"):" cookies",". This may affect user session persistence.")},un[An]=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):"")},un),Ln=function(){var e,n=navigator.userAgent;if(null===(e=navigator.userAgentData)||void 0===e?void 0:e.brands){var t=navigator.userAgentData.brands.find((function(e){return"Google Chrome"===e.brand}));if(null==t?void 0:t.version)return t.version}var o=n.match(/(Chrome|Firefox|Safari|Edge|Opera)\/(\d+\.\d+)/);return o?o[2]:"Unknown"},kn=function(){var e,n,t=dn();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===(n=null===navigator||void 0===navigator?void 0:navigator.languages)||void 0===n?void 0:n[0])||"en",browser_version:Ln(),os:null==t?void 0:t.os,referral_url:(null===document||void 0===document?void 0:document.referrer)||"",system_info:t}};!function(e){e.UPDATE_OVERRIDES="updateOverrides",e.I_CAN_AUTHENTICATE="i_can_authenticate",e.I_LOADED_LAUNCHER="i_loaded_launcher",e.I_OPENED_IFRAME="i_opened_iframe",e.I_CLICKED_PROACTIVE_BUBBLE="i_clicked_proactive_bubble",e.CAPTURED_SESSION_DATA="capturedSessionData",e.UPDATE_USER_PROFILE="updateUserProfile",e.OPENED_IFRAME_EVENT="openedIframe"}(pn||(pn={}));var Mn=n((function(n){var o,l,a,s,c=n.config,d=n.isVisible,u=n.onClose,p=n.onEvent,f=n.onIframeLoaded,v=n.onInternalEvent,h=n.position,m=n.bottomSpacing,g=n.overrides,_=t(null),y=t(!1),w=t(!1);t();var E=t(!1),I=h||(null===(o=c.interface_properties)||void 0===o?void 0:o.position)||"Right",T=null!==(a=null!=m?m:null===(l=c.interface_properties)||void 0===l?void 0:l.bottom_spacing)&&void 0!==a?a:20,S=r((function(e,n){var t=_.current;(null==t?void 0:t.contentWindow)&&t.contentWindow.postMessage(e,n)}),[]),C=r((function(){var e,n=_.current;if(n){var t=((e={width:(null===window||void 0===window?void 0:window.innerWidth)<560?"100vw":"26%",minWidth:(null===window||void 0===window?void 0:window.innerWidth)<560?"300px":"400px",height:(null===window||void 0===window?void 0:window.innerWidth)<560?"100vh":"calc(100vh - 2rem - 10vh - ".concat(T,"px)"),borderRadius:(null===window||void 0===window?void 0:window.innerWidth)<560?"0":"1rem",position:(null===window||void 0===window?void 0:window.innerWidth)<560?"fixed":"",maxHeight:(null===window||void 0===window?void 0:window.innerWidth)<560?"100%":"50rem",top:(null===window||void 0===window?void 0:window.innerWidth)<560?"0":"calc(10vh - 32px)"})[I.toLowerCase()]=(null===window||void 0===window?void 0:window.innerWidth)<560?"0":void 0,e.flexDirection=(null===window||void 0===window?void 0:window.innerWidth)<560?"column":void 0,e.flexGrow=(null===window||void 0===window?void 0:window.innerWidth)<560?"1":void 0,e);Object.assign(n.style,t)}}),[T,I]);return i((function(){var e=_.current;if(e&&!y.current){var n=O().copilotUrl;Object.assign(e.style,{zIndex:"20000000",border:"none",boxShadow:"0px 0px 40px 0px rgba(14, 14, 15, 0.24)",transformOrigin:"bottom ".concat(I.toLowerCase()),transition:"transform 0.2s cubic-bezier(0.2, 1.27, 0.29, 0.97), opacity 0.15s ease-out",transform:"scale(0.3) translate3d(0,40px,0)",opacity:"0",display:"none"}),e.src="".concat(n,"/chatbot-plugin?id=").concat(c.chatbotId),y.current=!0,C();var t=function(){var t,o,i,r,l,a,s,d,u,p,v,h,m,_,y,E,I=new URL(e.src).origin||n;if(S({domain:null===(t=null===window||void 0===window?void 0:window.location)||void 0===t?void 0:t.hostname,name:"checkDomain"},I),g){var T={header_avatar:null!==(o=null==g?void 0:g.header_avatar)&&void 0!==o?o:null,agent_avatar:null!==(i=null==g?void 0:g.agent_avatar)&&void 0!==i?i:null,header_title:null!==(r=null==g?void 0:g.header_title)&&void 0!==r?r:null,header_subtitle:null!==(l=null==g?void 0:g.header_subtitle)&&void 0!==l?l:null,header_title_text_color:null!==(a=null==g?void 0:g.header_title_text_color)&&void 0!==a?a:null,header_subtitle_text_color:null!==(s=null==g?void 0:g.header_subtitle_text_color)&&void 0!==s?s:null,header_bg:null!==(d=null==g?void 0:g.header_bg)&&void 0!==d?d:null};S({domain:null===(u=null===window||void 0===window?void 0:window.location)||void 0===u?void 0:u.hostname,action:pn.UPDATE_OVERRIDES,data:T},n)}if(!(null==w?void 0:w.current)&&e.contentWindow){S({domain:null===(p=null===window||void 0===window?void 0:window.location)||void 0===p?void 0:p.hostname,action:pn.I_CAN_AUTHENTICATE,data:{show_history:null==c?void 0:c.show_history}},n);var x=K();S({domain:null===(v=null===window||void 0===window?void 0:window.location)||void 0===v?void 0:v.hostname,action:pn.I_LOADED_LAUNCHER,data:b(b({ws_url:null==c?void 0:c.ws_url,userId:null==c?void 0:c.userId,token:null==c?void 0:c.token,userProfile:b(b({},null==c?void 0:c.userProfile),{__INT_SYS_INFO__:b(b({},(null===(h=null==c?void 0:c.userProfile)||void 0===h?void 0:h.__INT_SYS_INFO__)||{}),kn())}),isAnonymous:null==c?void 0:c.isAnonymous},x?{proactiveData:x}:{}),{show_history:null==c?void 0:c.show_history,init_load_image:(null===(_=null===(m=null==c?void 0:c.images)||void 0===m?void 0:m.header_image_url)||void 0===_?void 0:_.url)||(null==c?void 0:c.brand_logo_url),init_load_bot_name:null==c?void 0:c.name,init_load_brand_color:null===(y=null==c?void 0:c.colors)||void 0===y?void 0:y.brand_color,init_load_powered_by:(null===(E=null==c?void 0:c.footer)||void 0===E?void 0:E.show_powered_by)||!1})},n),w.current=!0}null==f||f()};return e.addEventListener("load",t),function(){return e.removeEventListener("load",t)}}}),[c.chatbotId,null===(s=c.interface_properties)||void 0===s?void 0:s.position,C,g]),i((function(){var e,n,t,o,i=_.current;if(i&&y.current){var r=(null===(e=c.interface_properties)||void 0===e?void 0:e.position)||"Right";if(d?(Object.assign(i.style,{transform:"scale(0.3) translate3d(0,40px,0)",opacity:"0",display:"block"}),i.getBoundingClientRect(),setTimeout((function(){Object.assign(i.style,{transform:"scale(1) translate3d(0,0,0)",opacity:"1",transition:"transform 0.2s cubic-bezier(0.2, 1.27, 0.29, 0.97), opacity 0.15s ease-out"})}),20)):(E.current=!1,i.style.transition="none",i.getBoundingClientRect(),Object.assign(i.style,{opacity:"0",transform:"scale(0.3) translate3d(".concat((r.toLowerCase(),"0"),",40px,0)"),transition:"transform 0.2s cubic-bezier(0.2, 1.27, 0.29, 0.97), opacity 0.15s ease-out"}),setTimeout((function(){!d&&i&&(i.style.display="none")}),200)),i.contentWindow&&d){var l=O().copilotUrl;if(S({domain:null===(n=null===window||void 0===window?void 0:window.location)||void 0===n?void 0:n.hostname,name:"openFrame"},l),E.current)E.current=!1;else{var a=K();console.log("proactiveData registerUserId===>",a),S({domain:null===(t=null===window||void 0===window?void 0:window.location)||void 0===t?void 0:t.hostname,action:pn.I_OPENED_IFRAME,data:b(b({ws_url:null==c?void 0:c.ws_url,userId:null==c?void 0:c.userId,token:null==c?void 0:c.token,userProfile:b(b({},null==c?void 0:c.userProfile),{__INT_SYS_INFO__:b(b({},(null===(o=null==c?void 0:c.userProfile)||void 0===o?void 0:o.__INT_SYS_INFO__)||{}),kn())}),isAnonymous:null==c?void 0:c.isAnonymous},a?{proactiveData:a}:{}),{show_history:null==c?void 0:c.show_history})},l)}}}}),[d,c.userId,c.token,c.userProfile]),i((function(){var e=function(e){var n,t,o,i;if(_.current&&w.current){E.current=!0;var r=(null==e?void 0:e.detail)||{},l=O().copilotUrl;S({domain:null===(n=null===window||void 0===window?void 0:window.location)||void 0===n?void 0:n.hostname,action:pn.I_CLICKED_PROACTIVE_BUBBLE,data:{userId:null==c?void 0:c.userId,token:null==c?void 0:c.token,userProfile:b(b({},null==c?void 0:c.userProfile),{__INT_SYS_INFO__:b(b({},(null===(t=null==c?void 0:c.userProfile)||void 0===t?void 0:t.__INT_SYS_INFO__)||{}),kn())}),isAnonymous:null==c?void 0:c.isAnonymous,ws_url:null==c?void 0:c.ws_url,proactiveData:{input_id:null,message_id:(null==r?void 0:r.message_id)||null,content_string:(null==r?void 0:r.content_string)||null,content_id:(null==r?void 0:r.content_id)||null},show_history:null==c?void 0:c.show_history}},l),console.log("message should have been sent===>",null===(o=_.current)||void 0===o?void 0:o.contentWindow,{userId:null==c?void 0:c.userId,token:null==c?void 0:c.token,userProfile:b(b({},null==c?void 0:c.userProfile),{__INT_SYS_INFO__:b(b({},(null===(i=null==c?void 0:c.userProfile)||void 0===i?void 0:i.__INT_SYS_INFO__)||{}),kn())}),isAnonymous:null==c?void 0:c.isAnonymous,ws_url:null==c?void 0:c.ws_url,proactiveData:{input_id:null,message_id:(null==r?void 0:r.message_id)||null,content_string:(null==r?void 0:r.content_string)||null,content_id:(null==r?void 0:r.content_id)||null}})}};return window.addEventListener("rblyn:proactiveClick",e),function(){return window.removeEventListener("rblyn:proactiveClick",e)}}),[null==c?void 0:c.userId,null==c?void 0:c.token,null==c?void 0:c.userProfile,null==c?void 0:c.isAnonymous]),i((function(){if(_.current&&y.current){var e=O().copilotUrl;d&&(null==p||p({type:x.CHATBOT_OPENED,timestamp:Date.now()}),v(x.CHATBOT_OPENED));var n=function(n){var t,o,i,r,l,a,s;if(n.origin===e){if("closeChatbot"===n.data)return void u();if("CHATBOT_TOKEN_EXHAUSTED"===(null===(t=n.data)||void 0===t?void 0:t.type))return void v(A.CHATBOT_TOKEN_EXHAUSTED);"CHATBOT_LOADED"===(null===(o=n.data)||void 0===o?void 0:o.type)&&(null==p||p({type:x.CHATBOT_LOADED,timestamp:Date.now()}),v(x.CHATBOT_LOADED)),"CHAT_INITIALIZED"===(null===(i=n.data)||void 0===i?void 0:i.type)&&(null==p||p({type:x.CHAT_INITIALIZED,timestamp:Date.now()}),v(x.CHAT_INITIALIZED)),"CHAT_INITIALIZATION_FAILED"===(null===(r=n.data)||void 0===r?void 0:r.type)&&(null==p||p({type:x.CHAT_INITIALIZATION_FAILED,timestamp:Date.now()}),v(x.CHAT_INITIALIZATION_FAILED,{error:null===(l=n.data)||void 0===l?void 0:l.error})),"SESSION_REFRESHED"===(null===(a=n.data)||void 0===a?void 0:a.type)&&(null==p||p({type:x.SESSION_REFRESHED,timestamp:Date.now()}),v(x.SESSION_REFRESHED)),"CHAT_MOVED"===(null===(s=n.data)||void 0===s?void 0:s.type)&&v(A.CHAT_MOVED,{from:n.data.from,to:n.data.to,trigger:n.data.trigger})}};return null===window||void 0===window||window.addEventListener("message",n),function(){return null===window||void 0===window?void 0:window.removeEventListener("message",n)}}}),[u,p,v,c.chatbotId,d]),i((function(){var e=_.current;if(e&&y.current){var n=function(){mn.trackError(new Error(Nn[Sn]({src:e.src,error:"Failed to load iframe"})),"ChatbotIframe",{errorCode:Sn,errorType:Dn,context:{config:c,iframeUrl:e.src,timestamp:Date.now()}})};return e.addEventListener("error",n),function(){return e.removeEventListener("error",n)}}}),[c]),i((function(){if(_.current&&c&&d){_.current;var e=O().copilotUrl;S({action:pn.UPDATE_USER_PROFILE,user_profile:c.userProfile,show_history:null==c?void 0:c.show_history},e),S({action:pn.OPENED_IFRAME_EVENT,user_profile:c.userProfile,show_history:null==c?void 0:c.show_history},e)}}),[c.userProfile,d]),e.createElement("iframe",{allow:"microphone",ref:_,id:"chat-iframe-rbyln",style:{display:"none"}})})),zn=function(e){function n(){var n=null!==e&&e.apply(this,arguments)||this;return n.state={hasError:!1},n}return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function t(){this.constructor=e}d(e,n),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}(n,e),n.getDerivedStateFromError=function(e){return{hasError:!0}},n.prototype.componentDidCatch=function(e,n){mn.trackError(new Error(Nn[An]({component:this.props.componentName||void 0,error:e.message,stack:n.componentStack})),this.props.componentName||void 0,{errorCode:An,errorType:Rn,context:{originalError:e,componentStack:n.componentStack,timestamp:Date.now()}})},n.prototype.render=function(){return this.state.hasError?null:this.props.children},n}(l),Pn=function(e,n,t,o){return y(void 0,void 0,void 0,(function(){var i,r,l,a,s,c,d,u;return w(this,(function(p){switch(p.label){case 0:i=O().apiUrl,r="".concat(i,"/chat/chatbot/get/"),T.log("endpointUrl",r),l={client_user_id:n,org_id:e,token:t||void 0,internal_user_id:o||void 0,extra_info:{},launcher_info:kn()},p.label=1;case 1:return p.trys.push([1,6,,7]),[4,fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)})];case 2:return(a=p.sent()).ok?[3,4]:[4,a.text()];case 3:throw s=p.sent(),new Error(Nn[En](a.status,s));case 4:return[4,a.json()];case 5:c=p.sent();try{String(l.org_id||"")}catch(e){}if(!(null===(u=null==c?void 0:c.user)||void 0===u?void 0:u.org_info))throw new Error(Nn[Tn](["user","org_info"]));return[2,c];case 6:throw d=p.sent(),mn.trackError(d instanceof Error?d:new Error(Nn[In]({error:String(d)})),"fetchChatbotConfig",{errorCode:d instanceof Error&&d.message.includes("API Request Failed")?En:In,errorType:On,context:{chatbotId:e,userId:n,apiUrl:i,statusCode:d instanceof Response?d.status:void 0,timestamp:Date.now(),requestPayload:{client_user_id:n,org_id:e}}}),d;case 7:return[2]}}))}))},Hn=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var n=16*Math.random()|0;return("x"===e?n:3&n|8).toString(16)}))},Fn=function(e){var n,t="; ".concat(document.cookie).split("; ".concat(e,"="));if(2===t.length)return null===(n=t.pop())||void 0===n?void 0:n.split(";").shift()},Un=function(e,n,t){var o=new Date;o.setTime(o.getTime()+24*t*60*60*1e3),document.cookie="".concat(e,"=").concat(n,";expires=").concat(o.toUTCString(),";path=/")},Bn=function(e){var n=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 n=n.split(";").map((function(e){var n=e.split("="),t=n[0],o=n.slice(1).join("=").trim();return{name:t=t.trim(),value:o?decodeURIComponent(o):""}})),n},Wn=function(){function e(e){this.logoContainer=null,this.iframe=null,this.bubblePromptContainer=null,this.chatBtnImage=null,this.isIframeLoaded=!1,this.config=e,this.validateDomain()&&this.init(),null===window||void 0===window||window.addEventListener("message",this.onCloseListener.bind(this),!1)}return e.prototype.sendMessageToIframe=function(e,n){var t;(null===(t=this.iframe)||void 0===t?void 0:t.contentWindow)&&this.iframe.contentWindow.postMessage(e,n)},e.prototype.onCloseListener=function(e){e.origin===this.config.domain&&"closeChatbot"===e.data&&this.closeIframe()},e.prototype.validateDomain=function(){var e,n=this.config.domain,t=null===(e=null===window||void 0===window?void 0:window.location)||void 0===e?void 0:e.origin;return T.log("expectedDomain, to current domain",n,t,n===t),n===t},e.prototype.createChatBubblContainer=function(){var e,n=this,t=document.createElement("div");t.id="chatbase-message-bubbles",Object.assign(t.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 o=document.createElement("div");o.classList.add("close-btn"),o.textContent="✕",Object.assign(o.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 o=n.createMessageBubble(e);t.appendChild(o)})),t.appendChild(o),document.body.appendChild(t)},e.prototype.createMessageBubble=function(e){var n=document.createElement("div");this.bubblePromptContainer=n,Object.assign(n.style,{display:"flex",position:"relative",justifyContent:"flex-end"});var t=document.createElement("div");t.classList.add("message"),t.textContent=e,Object.assign(t.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 o=document.createElement("button");return o.innerHTML="&times;",Object.assign(o.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"}),o.addEventListener("click",(function(){n.remove()})),n.appendChild(o),n.appendChild(t),n},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 n,t,o=document.createElement("img");o.src=this.config.launcher_type?(null===(t=null===(n=this.config.images)||void 0===n?void 0:n.launcher_image_url)||void 0===t?void 0:t.url)||"".concat(this.config.domain,"/chatbubble.png"):this.config.image_url||"".concat(this.config.domain,"/chatbubble.png"),o.alt="Chat",Object.assign(o.style,{zIndex:"1000",cursor:"pointer",borderRadius:"50%",objectFit:"cover"}),this.chatBtnImage=o,e.innerHTML="",e.appendChild(o)},e.prototype.createIframe=function(){var e=this;T.log("RobylonConfig?.domain====>",this.config.domain);var n=document.createElement("iframe");Object.assign(n.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"}),n.src="".concat(this.config.domain,"/chatbot-plugin?id=").concat(this.config.chatbotId),T.log("iframe.src====>",n.src),document.body.appendChild(n),this.iframe=n;var t=function(){(null===window||void 0===window?void 0:window.innerWidth)<560?Object.assign(n.style,{width:"100vw",minWidth:"300px",right:"0",bottom:"0",height:"100vh",flexDirection:"column",flexGrow:"1",borderRadius:"0",top:"0",maxHeight:"100%"}):Object.assign(n.style,{width:"26%",minWidth:"400px",right:"32px",bottom:"86px",height:"calc(100vh - 3rem - 10vh)",borderRadius:"1rem",top:"calc(10vh - 32px)",maxHeight:"45rem"})};t(),null===window||void 0===window||window.addEventListener("resize",t),n.addEventListener("load",(function(){var t,o,i,r,l;if(e.iframe){var a=new URL(e.iframe.src).origin||e.config.domain;null===(t=n.contentWindow)||void 0===t||t.postMessage({domain:null===(o=null===window||void 0===window?void 0:window.location)||void 0===o?void 0:o.hostname,name:"checkDomain"},a),null===(i=n.contentWindow)||void 0===i||i.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===(l=e.config.userProfile)||void 0===l?void 0:l.__INT_SYS_INFO__)||{}),kn())})}},a),e.isIframeLoaded=!0,e.createFloatingButton()}})),null===window||void 0===window||window.addEventListener("message",(function(t){var o,i;if(t.origin===e.config.domain){if("captureSessionData"===t.data){var r="66b33d16-5b38-4693-8772-1a1bd7dd412d"===e.config.chatbotId,l={cookies:Bn(r),localStorage:JSON.stringify(localStorage),sessionStorage:JSON.stringify(sessionStorage),action:"capturedSessionData",domain_name:null===(o=null===window||void 0===window?void 0:window.location)||void 0===o?void 0:o.hostname};null===(i=n.contentWindow)||void 0===i||i.postMessage(l,e.config.domain||"*")}"expand"===t.data&&(e.adjustIframeWidth(),n.style.height="calc(100vh - 120px)",n.style.bottom="86px"),"collapse"===t.data&&Object.assign(n.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;T.log("screenWidth",e),this.iframe.style.width=e<832?"".concat(e-64,"px"):"800px"}},e.prototype.loadSvgInline=function(e){var n=document.createElement("div");n.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 t=n.querySelector("svg");e.innerHTML="",t&&e.appendChild(t)},e.prototype.toggleIcon=function(e,n){"block"===n.style.display?this.loadSvgInline(e):this.loadImage(e)},e.prototype.toggleIframe=function(){var e;if(T.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;T.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":"cover",this.bubblePromptContainer&&(this.bubblePromptContainer.style.display="none"),T.log("this.bubblePromptContainer",this.bubblePromptContainer)}},e.prototype.closeIframe=function(){this.iframe&&this.logoContainer&&this.chatBtnImage&&(this.iframe.style.display="none",this.toggleIcon(this.logoContainer,this.iframe),this.chatBtnImage.style.objectFit="cover")},e.prototype.init=function(){this.createIframe()},e}(),jn=function(e,n,t){if(e.chatbotId&&e.userId)try{new Wn(e);n(!0),T.log("Robylon SDK initialized successfully.")}catch(e){t(e instanceof Error?e.message:"Failed to initialize SDK")}else t("Incomplete configuration for SDK initialization.")},Vn=function(e,n,t,o){return y(void 0,void 0,void 0,(function(){var i,r,l,a,s,c,d,u;return w(this,(function(p){switch(p.label){case 0:return p.trys.push([0,5,,6]),i=O().apiUrl,r="".concat(i,"/chat/chatbot/get/"),T.log("endpointUrl",r),l={client_user_id:n||null,org_id:e,token:t||void 0,internal_user_id:o||void 0,extra_info:{},launcher_info:kn()},[4,fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)})];case 1:return(a=p.sent()).ok?[3,3]:[4,a.text()];case 2:throw s=p.sent(),new Error(Nn[En](a.status,s));case 3:return[4,a.json()];case 4:if(c=p.sent(),!(null===(u=null==c?void 0:c.user)||void 0===u?void 0:u.org_info))throw new Error(Nn[Tn](["user","org_info"]));return[2,c];case 5:throw d=p.sent(),mn.trackError(d instanceof Error?d:new Error(Nn[In]({error:String(d)})),"fetchChatbotConfig",{errorCode:d instanceof Error&&d.message.includes("API Request Failed")?En:In,errorType:On,context:{apiKey:e,userId:n,timestamp:Date.now()}}),d;case 6:return[2]}}))}))},Gn=function(e){return y(void 0,void 0,void 0,(function(){var n,t,o,i,r,l,a,s,c,d,v,h,m,g,_,y,E,I,S,x,A,C,O,D,R,N,L,k,M,z,P,H,F,U,B,W,j,V,G,Y,K,X,q,J,Z,Q,$,ee,ne,te,oe,ie,re,le,ae;return w(this,(function(w){switch(w.label){case 0:return n=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),t=n.user_id||void 0,o=!1,t?i=Fn("rblyn_anon")||Hn():(t=Fn("rblyn_anon")||Hn(),Un("rblyn_anon",t,365),o=!0,i=t),[4,Vn(n.api_key,t,n.user_token,i)];case 1:r=w.sent();try{n.api_key}catch(e){T.warn("Failed to inject mock proactive messages",e)}return l=dn(),a=kn(),se=n.user_profile,s=se?Object.fromEntries(Object.entries(se).map((function(e){var n=e[0],t=e[1];return"boolean"==typeof t||"number"==typeof t?[n,t]:[n,String(t)]}))):{},c=b(b(b({},l),{__INT_SYS_INFO__:b(b({},l),a)}),s),[2,{chatbotId:n.api_key,name:(null===(d=r.user.org_info.brand_config)||void 0===d?void 0:d.name)||"",userId:t,token:n.user_token,isAnonymous:o,domain:"",show_launcher:null===(h=null===(v=r.user.org_info)||void 0===v?void 0:v.show_launcher)||void 0===h||h,auto_launch:null!==(g=null===(m=r.user.org_info)||void 0===m?void 0:m.auto_launch)&&void 0!==g&&g,brand_colour:(null===(y=null===(_=r.user.org_info.brand_config)||void 0===_?void 0:_.colors)||void 0===y?void 0:y.brand_color)||"",colors:{brand_color:(null===(I=null===(E=r.user.org_info.brand_config)||void 0===E?void 0:E.colors)||void 0===I?void 0:I.brand_color)||"",title_bar_color:(null===(x=null===(S=r.user.org_info.brand_config)||void 0===S?void 0:S.colors)||void 0===x?void 0:x.title_bar_color)||""},footer:{show_powered_by:(null===(C=null===(A=r.user.org_info.brand_config)||void 0===A?void 0:A.footer)||void 0===C?void 0:C.show_powered_by)||!1},image_url:(null===(D=null===(O=r.user.org_info)||void 0===O?void 0:O.brand_config)||void 0===D?void 0:D.launcher_logo_url)||"",brand_logo_url:(null===(N=null===(R=r.user.org_info)||void 0===R?void 0:R.brand_config)||void 0===N?void 0:N.launcher_logo_url)||"",userProfile:c,chat_interface_config:{chat_bubble_prompts:[],display_name:(null===(L=r.user.org_info.brand_config)||void 0===L?void 0:L.display_name)||"",welcome_message:(null===(k=r.user.org_info.brand_config)||void 0===k?void 0:k.welcome_message)||"Hey! What can we help you with today?",redirect_url:(null===(M=r.user.org_info.brand_config)||void 0===M?void 0:M.redirect_url)||""},launcher_type:(null===(z=r.user.org_info.brand_config)||void 0===z?void 0:z.launcher_type)||f.IMAGE,launcher_properties:{text:(null===(H=null===(P=r.user.org_info.brand_config)||void 0===P?void 0:P.launcher_properties)||void 0===H?void 0:H.text)||""},images:{launcher_image_url:{url:(null===(B=null===(U=null===(F=r.user.org_info.brand_config)||void 0===F?void 0:F.images)||void 0===U?void 0:U.launcher_image_url)||void 0===B?void 0:B.url)||""},header_image_url:{url:(null===(V=null===(j=null===(W=r.user.org_info.brand_config)||void 0===W?void 0:W.images)||void 0===j?void 0:j.header_image_url)||void 0===V?void 0:V.url)||""}},proactive_message_obj:Yn(null===(K=null===(Y=null===(G=null==r?void 0:r.user)||void 0===G?void 0:G.org_info)||void 0===Y?void 0:Y.brand_config)||void 0===K?void 0:K.proactive_message_obj),interface_properties:{position:(null===(q=null===(X=r.user.org_info.brand_config)||void 0===X?void 0:X.interface_properties)||void 0===q?void 0:q.position)||p.RIGHT,side_spacing:(null===(Z=null===(J=r.user.org_info.brand_config)||void 0===J?void 0:J.interface_properties)||void 0===Z?void 0:Z.side_spacing)||20,bottom_spacing:(null===($=null===(Q=r.user.org_info.brand_config)||void 0===Q?void 0:Q.interface_properties)||void 0===$?void 0:$.bottom_spacing)||20},interface_type:(null===(ee=r.user.org_info.brand_config)||void 0===ee?void 0:ee.interface_type)||u.WIDGET,launcher_delay:(null===(ne=r.user.org_info.brand_config)||void 0===ne?void 0:ne.launcher_delay)||{enabled:!1,delay:0},launcher_scroll:function(){var e,n,t,o,i,l,a;console.log("[Config] Raw API response launcher_scroll",{raw:null===(e=r.user.org_info.brand_config)||void 0===e?void 0:e.launcher_scroll,type:typeof(null===(n=r.user.org_info.brand_config)||void 0===n?void 0:n.launcher_scroll),enabled:null===(o=null===(t=r.user.org_info.brand_config)||void 0===t?void 0:t.launcher_scroll)||void 0===o?void 0:o.enabled,depth:null===(l=null===(i=r.user.org_info.brand_config)||void 0===i?void 0:i.launcher_scroll)||void 0===l?void 0:l.depth});var s=(null===(a=r.user.org_info.brand_config)||void 0===a?void 0:a.launcher_scroll)||{enabled:!1,depth:0};return console.log("[Config] Parsed launcher_scroll",s),s}(),auto_launch_delay:(null===(te=r.user.org_info.brand_config)||void 0===te?void 0:te.auto_launch_delay)||{enabled:!1,seconds:0},auto_launch_scroll:(null===(oe=r.user.org_info.brand_config)||void 0===oe?void 0:oe.auto_launch_scroll)||{enabled:!1,depth:0},launcher_size_multiplier:null!==(re=null===(ie=r.user.org_info.brand_config)||void 0===ie?void 0:ie.launcher_size_multiplier)&&void 0!==re?re:1,ws_url:null===(ae=null===(le=r.user)||void 0===le?void 0:le.router_connection_info)||void 0===ae?void 0:ae.url}]}var se}))}))},Yn=function(e){if(e){var n=(Array.isArray(e)?e:[e]).filter(Boolean).map((function(e){var n,t,o,i={message_id:String(null!==(n=null==e?void 0:e.message_id)&&void 0!==n?n:""),org_id:String(null!==(t=null==e?void 0:e.org_id)&&void 0!==t?t:""),name:null==e?void 0:e.name,content:null==e?void 0:e.content,send_time_type:null==e?void 0:e.send_time_type,created_by_name:null==e?void 0:e.created_by_name,updated_by_name:null==e?void 0:e.updated_by_name,updated_at:null==e?void 0:e.updated_at,created_at:null==e?void 0:e.created_at,delay:"number"==typeof(null==e?void 0:e.delay)?e.delay:void 0,delay_type:"scroll"===(null==e?void 0:e.delay_type)||"time"===(null==e?void 0:e.delay_type)?e.delay_type:void 0,scroll_threshold:(o=Number(null==e?void 0:e.scroll_threshold),Number.isFinite(o)?o:void 0),content_multiple:Array.isArray(null==e?void 0:e.content_multiple)?e.content_multiple:(null==e?void 0:e.content)?[{message:String(e.content),message_display_attributes:[]}]:[]};return(null==e?void 0:e.content)&&!(null==e?void 0:e.content_multiple)&&T.warn("[Robylon SDK] proactive_message.content is deprecated; use content_multiple[].message instead."),i}));return n.length?n:void 0}},Kn=function(e){var n=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)]),t=o({isInitialized:!1,isInitializing:!1,error:null,chatbotConfig:null,isIframeVisible:!1}),l=t[0],s=t[1],c=a((function(){return n.user_profile?Object.fromEntries(Object.entries(n.user_profile).map((function(e){var n=e[0],t=e[1];return"boolean"==typeof t||"number"==typeof t?[n,t]:[n,String(t)]}))):{}}),[JSON.stringify(n.user_profile)]),d=r((function(e){s((function(n){return b(b({},n),e)}))}),[]),v=r((function(){return y(void 0,void 0,void 0,(function(){var e,t,o,i,r,l,a,s,v,h,m,g,_,y,E,I,T,S,x,A,C,O,D,R,N,L,k,M,z,P,H,F,U,B,W,j,V,G,Y,K,X,q,J,Z,Q,$,ee,ne,te,oe,ie,re,le,ae,se,ce,de,ue,pe,fe,ve,he,me,ge,_e,be,ye;return w(this,(function(w){switch(w.label){case 0:if(!n.api_key)return mn.trackError(new Error(Nn[gn](n.api_key)),"useChatbotState",{errorCode:gn,errorType:Cn,context:{timestamp:Date.now()}}),[2];d({isInitializing:!0}),w.label=1;case 1:return w.trys.push([1,4,5,6]),e=n.user_id||void 0,t=!1,o=void 0,e?o=Fn("rblyn_anon")||Hn():(e=Fn("rblyn_anon")||Hn(),o=e,Un("rblyn_anon",e,365),t=!0),[4,Pn(n.api_key,e,n.user_token,o)];case 2:return i=w.sent(),r=dn(),l=kn(),a=b(b(b(b({},r),{__INT_SYS_INFO__:b(b({},r),l)}),c),{internal_user_id:o}),s={chatbotId:n.api_key,name:(null===(m=i.user.org_info.brand_config)||void 0===m?void 0:m.name)||"",userId:e,token:n.user_token,isAnonymous:t,domain:"",show_launcher:null===(_=null===(g=i.user.org_info)||void 0===g?void 0:g.show_launcher)||void 0===_||_,auto_launch:null!==(E=null===(y=i.user.org_info)||void 0===y?void 0:y.auto_launch)&&void 0!==E&&E,show_history:null===(S=null===(T=null===(I=null==i?void 0:i.user)||void 0===I?void 0:I.org_info)||void 0===T?void 0:T.brand_config)||void 0===S?void 0:S.enable_history,brand_colour:(null===(A=null===(x=i.user.org_info.brand_config)||void 0===x?void 0:x.colors)||void 0===A?void 0:A.brand_color)||"",colors:{brand_color:(null===(O=null===(C=i.user.org_info.brand_config)||void 0===C?void 0:C.colors)||void 0===O?void 0:O.brand_color)||"",title_bar_color:(null===(R=null===(D=i.user.org_info.brand_config)||void 0===D?void 0:D.colors)||void 0===R?void 0:R.title_bar_color)||""},footer:{show_powered_by:(null===(L=null===(N=i.user.org_info.brand_config)||void 0===N?void 0:N.footer)||void 0===L?void 0:L.show_powered_by)||!1},image_url:(null===(M=null===(k=i.user.org_info)||void 0===k?void 0:k.brand_config)||void 0===M?void 0:M.launcher_logo_url)||"",brand_logo_url:(null===(P=null===(z=i.user.org_info)||void 0===z?void 0:z.brand_config)||void 0===P?void 0:P.launcher_logo_url)||"",userProfile:a,chat_interface_config:{chat_bubble_prompts:[],display_name:(null===(H=i.user.org_info.brand_config)||void 0===H?void 0:H.display_name)||"",welcome_message:(null===(F=i.user.org_info.brand_config)||void 0===F?void 0:F.welcome_message)||"Hey! What can we help you with today?",redirect_url:(null===(U=i.user.org_info.brand_config)||void 0===U?void 0:U.redirect_url)||""},interface_properties:{position:(null===(W=null===(B=i.user.org_info.brand_config)||void 0===B?void 0:B.interface_properties)||void 0===W?void 0:W.position)||p.RIGHT,side_spacing:null!==(G=null===(V=null===(j=i.user.org_info.brand_config)||void 0===j?void 0:j.interface_properties)||void 0===V?void 0:V.side_spacing)&&void 0!==G?G:20,bottom_spacing:null!==(X=null===(K=null===(Y=i.user.org_info.brand_config)||void 0===Y?void 0:Y.interface_properties)||void 0===K?void 0:K.bottom_spacing)&&void 0!==X?X:20},interface_type:(null===(q=i.user.org_info.brand_config)||void 0===q?void 0:q.interface_type)||u.WIDGET,launcher_type:(null===(J=i.user.org_info.brand_config)||void 0===J?void 0:J.launcher_type)||f.IMAGE,launcher_properties:{text:(null===(Q=null===(Z=i.user.org_info.brand_config)||void 0===Z?void 0:Z.launcher_properties)||void 0===Q?void 0:Q.text)||""},images:{launcher_image_url:{url:(null===(ne=null===(ee=null===($=i.user.org_info.brand_config)||void 0===$?void 0:$.images)||void 0===ee?void 0:ee.launcher_image_url)||void 0===ne?void 0:ne.url)||""},header_image_url:{url:(null===(ie=null===(oe=null===(te=i.user.org_info.brand_config)||void 0===te?void 0:te.images)||void 0===oe?void 0:oe.header_image_url)||void 0===ie?void 0:ie.url)||""}},proactive_message_obj:Yn(null===(ae=null===(le=null===(re=null==i?void 0:i.user)||void 0===re?void 0:re.org_info)||void 0===le?void 0:le.brand_config)||void 0===ae?void 0:ae.proactive_message_obj),launcher_delay:(null===(ce=null===(se=i.user.org_info)||void 0===se?void 0:se.brand_config)||void 0===ce?void 0:ce.launcher_delay)||{enabled:!1,delay:0},launcher_scroll:(null===(ue=null===(de=i.user.org_info)||void 0===de?void 0:de.brand_config)||void 0===ue?void 0:ue.launcher_scroll)||{enabled:!1,depth:0},auto_launch_delay:(null===(fe=null===(pe=i.user.org_info)||void 0===pe?void 0:pe.brand_config)||void 0===fe?void 0:fe.auto_launch_delay)||{enabled:!1,seconds:0},auto_launch_scroll:(null===(he=null===(ve=i.user.org_info)||void 0===ve?void 0:ve.brand_config)||void 0===he?void 0:he.auto_launch_scroll)||{enabled:!1,depth:0},launcher_size_multiplier:null!==(_e=null===(ge=null===(me=i.user.org_info)||void 0===me?void 0:me.brand_config)||void 0===ge?void 0:ge.launcher_size_multiplier)&&void 0!==_e?_e:1,ws_url:null===(ye=null===(be=i.user)||void 0===be?void 0:be.router_connection_info)||void 0===ye?void 0:ye.url},[4,new Promise((function(e,n){jn(s,(function(){d({isInitialized:!0,chatbotConfig:s}),e()}),(function(e){n(e)}))}))];case 3:return w.sent(),[3,6];case 4:return v=w.sent(),h=v instanceof Error?v.message:"Failed to initialize chatbot",d({error:h}),mn.trackError(v instanceof Error?v:new Error(h),"useChatbotState",{errorCode:yn,errorType:Cn,context:{timestamp:Date.now()}}),[3,6];case 5:return d({isInitializing:!1}),[7];case 6:return[2]}}))}))}),[n.api_key,n.user_id,n.user_token]);i((function(){n.api_key&&v()}),[v]),i((function(){l.chatbotConfig&&s((function(e){return b(b({},e),{chatbotConfig:b(b({},e.chatbotConfig),{userProfile:b(b({},dn()),c)})})}))}),[c]);var h=r((function(){s((function(e){return b(b({},e),{isIframeVisible:!e.isIframeVisible})}))}),[]),m=r((function(){d({isIframeVisible:!1})}),[]);return b(b({},l),{toggleIframeVisibility:h,closeIframe:m})},Xn=function(n){var t,r,l,a,s,c,d,u=n.children,p=n.config,f=n.position,v=n.sideSpacing,h=n.bottomSpacing,m=o(!1),g=m[0],_=m[1];i((function(){var e=function(){var e=(null===window||void 0===window?void 0:window.innerWidth)<560;_(e)};return e(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[]);var y=f||(null===(l=p.interface_properties)||void 0===l?void 0:l.position)||"Right",w=null!==(s=null!=v?v:null===(a=p.interface_properties)||void 0===a?void 0:a.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;T.log("config",p,y,w);var I={position:"fixed",zIndex:1e3,display:"flex",flexDirection:"column"},S=b(b({},I),((t={bottom:"".concat(E,"px")})[y.toLowerCase()]="".concat(null!=w?w:20,"px"),t.alignItems="Right"===y?"flex-end":"flex-start",t.top=void 0,t["Right"===y?"left":"right"]=void 0,t)),x=b(b({},I),((r={top:0})[y.toLowerCase()]="".concat(null!=w?w:20,"px"),r.alignItems="center",r.bottom=void 0,r["Right"===y?"left":"right"]=void 0,r)),A=g?x:S;return i((function(){console.log("Container screen width changed, isMobile:",g,"Style:",A)}),[g,A]),e.createElement("div",{className:"robylon-chatbot-container",style:A},u)},qn="robylon-launcher-cdn-preconnect",Jn="robylon-launcher-cdn-dns-prefetch",Zn=function(e,n,t,o){var i;if(!document.getElementById(e)){var r=document.createElement("link");r.id=e,r.rel=n,r.href=t,o&&(r.crossOrigin=""),null===(i=document.head)||void 0===i||i.appendChild(r)}},Qn=function(){if(C()){var e="".concat("https://d1h2odiipi7033.cloudfront.net","/"),n="".concat("https://api.robylon.ai","/"),t="".concat("https://stage-api.robylon.ai","/");Zn(qn,"preconnect",e,!0),Zn(Jn,"dns-prefetch",e,!1),Zn("".concat(qn,"-api"),"preconnect",n,!0),Zn("".concat(Jn,"-api"),"dns-prefetch",n,!1),Zn("".concat(qn,"-stage-api"),"preconnect",t,!0),Zn("".concat(Jn,"-stage-api"),"dns-prefetch",t,!1)}},$n=s((function(n,t){var l,s,d,u,p,f,v,h,m,g,_,I,S,A=n.api_key,C=n.user_id,D=n.user_token,R=n.user_profile,N=n.onEvent,L=n.position,k=n.sideSpacing,M=n.bottomSpacing,z=n.show_launcher,P=n.launcher_type,H=n.launcher_properties_text,F=n.overrides,U=n.launcher_size;i((function(){Qn()}),[]);var B="string"==typeof k?""===k||isNaN(Number(k))?void 0:Number(k):k,W="string"==typeof M?""===M||isNaN(Number(M))?void 0:Number(M):M,j="string"==typeof L?"left"===L.toLowerCase()?"Left":"right"===L.toLowerCase()?"Right":void 0:L;i((function(){}));var V=a((function(){return{api_key:A,user_id:C,user_token:D,user_profile:R}}),[A,C,D,R]),G=r((function(e){null==N||N(e)}),[N]),Y=Kn(V),K=Y.isInitialized,X=Y.error,q=Y.chatbotConfig,J=Y.isIframeVisible,Z=Y.toggleIframeVisibility,Q=Y.closeIframe,$=a((function(){return{api_key:A,user_profile:V.user_profile,onEvent:G,chatbotConfig:q?{isAnonymous:q.isAnonymous,userId:q.userId}:null}}),[A,V.user_profile,G,null==q?void 0:q.isAnonymous,null==q?void 0:q.userId]),ee=function(e){var n=e.api_key,t=e.chatbotConfig,o=e.user_profile,i=e.onEvent,l=a((function(){return{isAnonymous:(null==t?void 0:t.isAnonymous)||!1,userId:(null==t?void 0:t.userId)||""}}),[null==t?void 0:t.isAnonymous,null==t?void 0:t.userId]),s=a((function(){return o||{}}),[JSON.stringify(o)]),c=r((function(e){for(var t=[],o=1;o<arguments.length;o++)t[o-1]=arguments[o];return y(void 0,E([e],t,!0),void 0,(function(e,t){var o,i,r,a,c,d,u;return void 0===t&&(t={}),w(this,(function(p){switch(p.label){case 0:if(!n)return[2];p.label=1;case 1:return p.trys.push([1,3,,4]),o=O().apiUrl,i=dn(),r=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:n,client_user_id:l.isAnonymous?"Anonymous":String(l.userId),event_type:e,user_profile:s},t),a={org_id:n,event_data:r,metadata:b({timestamp:Date.now()},i),event_type:"INFO",user_id:l.userId},[4,fetch("".concat(o,"/users/sdk/record-logs/"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})];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(),T.error("Failed to send internal event:",d),[3,4];case 4:return[2]}}))}))}),[n,l]);return{emitEvent:r((function(e,n){var t=Date.now();e!==x.CHATBOT_BUTTON_CLICKED&&e!==x.CHATBOT_CLOSED&&e!==x.CHATBOT_OPENED&&e!==x.CHATBOT_READY||(i&&i({type:e,timestamp:t,data:n}),c(e,{timestamp:t}))}),[i,c]),onInternalEvent:c}}(b({},$)),ne=ee.emitEvent,te=ee.onInternalEvent;c(t,(function(){return{show:function(){K&&q?J||(Z(),ne(x.CHATBOT_BUTTON_CLICKED)):console.warn("Robylon Chatbot: Cannot show - chatbot not ready yet")},hide:function(){K&&q?J&&(Q(),ne(x.CHATBOT_CLOSED)):console.warn("Robylon Chatbot: Cannot hide - chatbot not ready yet")},toggle:function(){K&&q?(Z(),ne(J?x.CHATBOT_CLOSED:x.CHATBOT_BUTTON_CLICKED)):console.warn("Robylon Chatbot: Cannot toggle - chatbot not ready yet")},isReady:K&&!!q}}),[K,q,J,Z,Q,ne]),i((function(){K&&q&&ne(x.CHATBOT_READY)}),[K,q,ne]);var oe=o(!1),ie=oe[0],re=oe[1],le=o(!1),ae=le[0],se=le[1],ce=o(!1),de=ce[0],ue=ce[1],pe=o(!1),fe=pe[0],ve=pe[1],he=o(!1),me=he[0],ge=he[1];i((function(){var e,n,t,o,i,r,l,a,s;if(console.log("[RobylonChatbot] Scroll tracking effect running",{chatbotConfig:!!q,launcher_scroll:null==q?void 0:q.launcher_scroll,scrollEnabled:null===(e=null==q?void 0:q.launcher_scroll)||void 0===e?void 0:e.enabled,scrollDepth:null===(n=null==q?void 0:q.launcher_scroll)||void 0===n?void 0:n.depth,scrollEnabledType:typeof(null===(t=null==q?void 0:q.launcher_scroll)||void 0===t?void 0:t.enabled),scrollDepthType:typeof(null===(o=null==q?void 0:q.launcher_scroll)||void 0===o?void 0:o.depth)}),!q)return console.log("[RobylonChatbot] No config, resetting scroll state"),void ue(!1);var c=!0===(null===(i=null==q?void 0:q.launcher_scroll)||void 0===i?void 0:i.enabled),d=null!==(l=null===(r=null==q?void 0:q.launcher_scroll)||void 0===r?void 0:r.depth)&&void 0!==l?l:0;if(console.log("[RobylonChatbot] Scroll config check",{rawLauncherScroll:null==q?void 0:q.launcher_scroll,scrollEnabledRaw:null===(a=null==q?void 0:q.launcher_scroll)||void 0===a?void 0:a.enabled,scrollEnabled:c,scrollDepthRaw:null===(s=null==q?void 0:q.launcher_scroll)||void 0===s?void 0:s.depth,scrollDepth:d,scrollDepthNumber:Number(d),willSetup:c&&Number(d)>0}),!c||Number(d)<=0)return console.log("[RobylonChatbot] Scroll disabled or depth <= 0, resetting state"),void ue(!1);var u=function(){var e=window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0;console.log("[RobylonChatbot] Checking scroll depth",{currentScrollY:e,requiredDepth:Number(d),hasScrolledPast:e>=Number(d),currentState:de}),e>=Number(d)&&(console.log("[RobylonChatbot] Scroll depth reached! Setting flag to true"),ue(!0))};return console.log("[RobylonChatbot] Checking initial scroll position"),u(),console.log("[RobylonChatbot] Adding scroll event listener"),window.addEventListener("scroll",u,{passive:!0}),function(){console.log("[RobylonChatbot] Removing scroll event listener"),window.removeEventListener("scroll",u)}}),[q,null===(l=null==q?void 0:q.launcher_scroll)||void 0===l?void 0:l.enabled,null===(s=null==q?void 0:q.launcher_scroll)||void 0===s?void 0:s.depth]),i((function(){var e,n,t,o,i,r,l,a,s,c;if(console.log("[RobylonChatbot] Launcher visibility effect running",{hasConfig:!!q,show_launcher:z,configShowLauncher:null==q?void 0:q.show_launcher,hasScrolledPastDepth:de}),!q)return console.log("[RobylonChatbot] No config, hiding launcher"),void re(!1);var d=void 0!==z?Boolean(z):null===(e=null==q?void 0:q.show_launcher)||void 0===e||e;if(console.log("[RobylonChatbot] Final show_launcher decision",{finalShowLauncher:d,propShowLauncher:z,configShowLauncher:null==q?void 0:q.show_launcher}),!d)return console.log("[RobylonChatbot] show_launcher is false, hiding launcher"),re(!1),function(){c&&clearTimeout(c)};var u=!0===(null===(n=null==q?void 0:q.launcher_delay)||void 0===n?void 0:n.enabled),p=null!==(r=null!==(o=null===(t=null==q?void 0:q.launcher_delay)||void 0===t?void 0:t.seconds)&&void 0!==o?o:null===(i=null==q?void 0:q.launcher_delay)||void 0===i?void 0:i.delay)&&void 0!==r?r:0,f=!0===(null===(l=null==q?void 0:q.launcher_scroll)||void 0===l?void 0:l.enabled),v=null!==(s=null===(a=null==q?void 0:q.launcher_scroll)||void 0===a?void 0:a.depth)&&void 0!==s?s:0,h=f&&Number(v)>0;console.log("[RobylonChatbot] Scroll and delay config",{delayEnabled:u,seconds:p,scrollEnabled:f,scrollDepth:v,requiresScroll:h});var m=!0;if(h){var g=window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0;m=g>=Number(v)||de,console.log("[RobylonChatbot] Scroll condition check",{currentScrollY:g,requiredDepth:Number(v),hasScrolledPastDepthState:de,scrollConditionMet:m})}return h&&!m?(console.log("[RobylonChatbot] Scroll required but condition not met, hiding launcher"),re(!1),function(){c&&clearTimeout(c)}):(u&&Number(p)>0?(console.log("[RobylonChatbot] Delay enabled, setting timeout",{seconds:p}),re(!1),c=window.setTimeout((function(){console.log("[RobylonChatbot] Delay timeout fired, checking scroll condition");var e=!0;if(h){var n=window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0;e=n>=Number(v)||de,console.log("[RobylonChatbot] Final scroll check in delay timeout",{currentScrollY:n,requiredDepth:Number(v),hasScrolledPastDepthState:de,finalScrollConditionMet:e})}!h||e?(console.log("[RobylonChatbot] Showing launcher after delay"),re(!0)):console.log("[RobylonChatbot] Not showing launcher - scroll condition not met")}),1e3*Number(p))):(console.log("[RobylonChatbot] No delay, showing launcher immediately"),re(!0)),function(){c&&clearTimeout(c)})}),[q,z,null==q?void 0:q.show_launcher,null===(d=null==q?void 0:q.launcher_delay)||void 0===d?void 0:d.enabled,null===(u=null==q?void 0:q.launcher_delay)||void 0===u?void 0:u.seconds,null===(p=null==q?void 0:q.launcher_delay)||void 0===p?void 0:p.delay,null===(f=null==q?void 0:q.launcher_scroll)||void 0===f?void 0:f.enabled,null===(v=null==q?void 0:q.launcher_scroll)||void 0===v?void 0:v.depth,de]),i((function(){var e,n,t;if(q&&!fe){var o=!0===(null===(e=null==q?void 0:q.auto_launch_scroll)||void 0===e?void 0:e.enabled),i=null!==(t=null===(n=null==q?void 0:q.auto_launch_scroll)||void 0===n?void 0:n.depth)&&void 0!==t?t:0;if(o&&!(Number(i)<=0)){var r=function(){me||(window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0)>=Number(i)&&ge(!0)};return r(),window.addEventListener("scroll",r,{passive:!0}),function(){window.removeEventListener("scroll",r)}}ge(!1)}}),[q,null===(h=null==q?void 0:q.auto_launch_scroll)||void 0===h?void 0:h.enabled,null===(m=null==q?void 0:q.auto_launch_scroll)||void 0===m?void 0:m.depth,fe,me]),i((function(){var e,n,t,o,i,r,l;if(q&&!fe&&ae){var a=void 0!==z?Boolean(z):null===(e=null==q?void 0:q.show_launcher)||void 0===e||e,s=!0===(null==q?void 0:q.auto_launch);if(a&&s&&ie){var c=!0===(null===(n=null==q?void 0:q.auto_launch_delay)||void 0===n?void 0:n.enabled),d=null!==(o=null===(t=null==q?void 0:q.auto_launch_delay)||void 0===t?void 0:t.seconds)&&void 0!==o?o:0,u=!0===(null===(i=null==q?void 0:q.auto_launch_scroll)||void 0===i?void 0:i.enabled),p=null!==(l=null===(r=null==q?void 0:q.auto_launch_scroll)||void 0===r?void 0:r.depth)&&void 0!==l?l:0,f=u&&Number(p)>0,v=!0;if(f)v=(window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0)>=Number(p)||me;if(!f||v){var h=function(){fe||J||(ve(!0),Z(),ne(x.CHATBOT_BUTTON_CLICKED))};if(c&&Number(d)>0){var m=window.setTimeout((function(){var e=!0;f&&(e=(window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0)>=Number(p)||me);f&&!e||h()}),1e3*Number(d));return function(){clearTimeout(m)}}h()}}}}),[q,z,null==q?void 0:q.show_launcher,null==q?void 0:q.auto_launch,null===(g=null==q?void 0:q.auto_launch_delay)||void 0===g?void 0:g.enabled,null===(_=null==q?void 0:q.auto_launch_delay)||void 0===_?void 0:_.seconds,null===(I=null==q?void 0:q.auto_launch_scroll)||void 0===I?void 0:I.enabled,null===(S=null==q?void 0:q.auto_launch_scroll)||void 0===S?void 0:S.depth,ie,ae,fe,me,J,Z,ne]),i((function(){if(A)try{mn.initialize(A,C)}catch(e){mn.trackError(e instanceof Error?e:new Error(String(e)),"RobylonChatbot",{errorCode:wn,errorType:Cn,context:{timestamp:Date.now()}})}else mn.trackError(new Error(Nn[gn](A)),"RobylonChatbot",{errorCode:gn,errorType:Cn,context:{timestamp:Date.now()}})}),[A,C]);var _e=r((function(){Q(),ne(x.CHATBOT_CLOSED)}),[Q,ne]),be=r((function(){Z(),ne(J?x.CHATBOT_CLOSED:x.CHATBOT_BUTTON_CLICKED)}),[Z,ne,J]),ye=a((function(){var e,n,t,o,i;return{config:q,toggleIframe:be,isIframeVisible:J,onEvent:G,onInternalEvent:te,position:j,sideSpacing:B,bottomSpacing:W,launcher_type:P,launcher_properties_text:H,shouldFadeIn:!0===(null===(e=null==q?void 0:q.launcher_delay)||void 0===e?void 0:e.enabled)&&(null!==(i=null!==(t=null===(n=null==q?void 0:q.launcher_delay)||void 0===n?void 0:n.seconds)&&void 0!==t?t:null===(o=null==q?void 0:q.launcher_delay)||void 0===o?void 0:o.delay)&&void 0!==i?i:0)>0||!1,launcher_size:U}}),[q,be,J,G,te,j,B,W,P,H,U]);T.log("floatingButtonProps",ye);var we=a((function(){return{config:q,isVisible:J,onClose:_e,onEvent:G,onIframeLoaded:function(){return se(!0)},onInternalEvent:te,position:j,bottomSpacing:W,overrides:F}}),[q,J,_e,G,te,j,W,F]);return A&&!X&&q?e.createElement(zn,{componentName:"RobylonChatbot"},K?e.createElement(Xn,{config:q,position:j,sideSpacing:B,bottomSpacing:W},e.createElement(zn,{componentName:"ChatbotIframe"},e.createElement(Mn,b({},we))),e.createElement(zn,{componentName:"ChatbotFloatingButton"},(console.log("[RobylonChatbot] Render check",{isLauncherVisible:ie,isIframeLoaded:ae,willRender:ie&&ae}),ie&&ae?e.createElement(ln,b({},ye)):null))):null):null})),et=n($n,(function(e,n){return e.api_key===n.api_key&&e.user_id===n.user_id&&e.user_token===n.user_token&&JSON.stringify(e.user_profile)===JSON.stringify(n.user_profile)&&e.position===n.position&&e.sideSpacing===n.sideSpacing&&e.bottomSpacing===n.bottomSpacing&&e.show_launcher===n.show_launcher&&e.launcher_type===n.launcher_type&&e.launcher_properties_text===n.launcher_properties_text&&JSON.stringify(e.overrides)===JSON.stringify(n.overrides)&&e.launcher_size===n.launcher_size&&!0})),nt=function(e){var n=o({isLoading:!0,isInitialized:!1,error:null}),t=n[0],r=n[1],l=function(e){r((function(n){return b(b({},n),{isInitialized:e})}))},a=function(e){r((function(n){return b(b({},n),{error:e})}))};return i((function(){!function(){try{jn(e,l,a)}catch(e){r((function(n){return b(b({},n),{error:e instanceof Error?e.message:"Failed to initialize SDK",isLoading:!1})}))}}()}),[e.chatbotId,e.userId]),t},tt="data-robylon-launcher-image-root",ot="data-robylon-launcher-chevron-overlay",it=function(){function e(e){var n=this;this.resizeObserver=null,this.proactiveElement=null,this.urlUnsubscribe=null,this.delayTimers=[],this.scrollHandlers=new Map,this.shownScrollMessages=new Set,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(){n.buttonElement.style.opacity="1"}))}catch(e){}this.setupResizeListener(),this.renderProactiveIfNeeded(),this.urlUnsubscribe=F((function(){n.clearProactiveDelays(),n.renderProactiveIfNeeded(!0)}))}return e.prototype.render=function(){var e,n,t=this,o=O().copilotUrl,i=this.config,r=i.config,l=i.isIframeVisible,a=null!==(e=null==r?void 0:r.launcher_size_multiplier)&&void 0!==e?e:1,s=null!==(n=this.config.launcher_size)&&void 0!==n?n:48*a,c={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:l?"scale(0.85)":"scale(1)",fontFamily:R};if(r.launcher_type===f.IMAGE&&Object.assign(c,{width:"".concat(s,"px"),height:"".concat(s,"px"),borderRadius:"50%",backgroundColor:r.brand_colour}),this.applyResponsiveStyles(c),this.buttonElement.className="message-bubble-container",this.tryUpdateImageLauncherInPlace(s,o))return this.buttonElement.onclick=function(){t.config.toggleIframe(),t.hideProactiveMessages()},void this.renderProactiveIfNeeded();this.buttonElement.innerHTML="",this.buttonElement.appendChild(this.createLauncherElement()),this.buttonElement.onclick=function(){t.config.toggleIframe(),t.hideProactiveMessages()},this.renderProactiveIfNeeded()},e.prototype.getImageLauncherSrc=function(e){var n,t,o=this.config.config;return o.launcher_type?(null===(t=null===(n=o.images)||void 0===n?void 0:n.launcher_image_url)||void 0===t?void 0:t.url)||"".concat(e,"/chatbubble.png"):o.image_url||"".concat(e,"/chatbubble.png")},e.prototype.appendChevronSvg=function(e,n){var t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("width",String(n)),t.setAttribute("height",String(n)),t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("fill","none"),t.setAttribute("xmlns","http://www.w3.org/2000/svg"),t.style.display="block";var o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d","M19 9L12 16L5 9"),o.setAttribute("stroke","currentColor"),o.setAttribute("stroke-width","1.5"),o.setAttribute("stroke-linecap","round"),o.setAttribute("stroke-linejoin","round"),t.appendChild(o),e.appendChild(t)},e.prototype.tryUpdateImageLauncherInPlace=function(e,n){var t=this.config,o=t.config,i=t.isIframeVisible;if(!(o.launcher_type===f.IMAGE||void 0===o.launcher_type))return!1;var r=this.buttonElement.querySelector("[".concat(tt,"]"));if(!r)return!1;var l=r.querySelector("img");if(!l)return!1;var a=this.getImageLauncherSrc(n);if(l.getAttribute("src")!==a)return!1;l.style.opacity=i?"0":"1",i?l.setAttribute("aria-hidden","true"):l.removeAttribute("aria-hidden");var s=r.querySelector("[".concat(ot,"]"));if(i&&!s){var c=document.createElement("div");c.setAttribute(ot,""),Object.assign(c.style,{position:"absolute",inset:"0",display:"flex",alignItems:"center",justifyContent:"center"}),this.appendChevronSvg(c,Math.round(.5*e)),r.appendChild(c)}return!i&&(null==s?void 0:s.parentElement)&&s.parentElement.removeChild(s),!0},e.prototype.createLauncherElement=function(){var e,n,t=this.config,o=t.config,i=t.isIframeVisible,r=O().copilotUrl,l=null!==(e=null==o?void 0:o.launcher_size_multiplier)&&void 0!==e?e:1,a=null!==(n=this.config.launcher_size)&&void 0!==n?n:48*l;switch(o.launcher_type){case f.TEXT:return this.createTextLauncher();case f.TEXTUAL_IMAGE:return this.createTextualImageLauncher();case f.IMAGE:default:var s=document.createElement("div");s.setAttribute(tt,""),Object.assign(s.style,{position:"relative",width:"100%",height:"100%"});var c=document.createElement("img");if(c.src=this.getImageLauncherSrc(r),c.alt="Chat",i&&c.setAttribute("aria-hidden","true"),Object.assign(c.style,{zIndex:"1000",cursor:"pointer",borderRadius:"50%",objectFit:"cover",width:"100%",height:"100%",boxSizing:"border-box",position:"absolute",inset:"0",opacity:i?"0":"1"}),s.appendChild(c),i){var d=document.createElement("div");d.setAttribute(ot,""),Object.assign(d.style,{position:"absolute",inset:"0",display:"flex",alignItems:"center",justifyContent:"center"}),this.appendChevronSvg(d,Math.round(.5*a)),s.appendChild(d)}return s}},e.prototype.createTextLauncher=function(){var e=this.config.config,n=e.brand_colour,t=e.launcher_properties,o=e.launcher_size_multiplier,i=null!=o?o:1,r=void 0!==this.config.launcher_size?void 0:160*i,l=void 0!==this.config.launcher_size?void 0:40*i,a=void 0!==this.config.launcher_size?void 0:14*i,s=void 0!==this.config.launcher_size?void 0:21*i,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!==l?"".concat(l,"px"):"40px",borderRadius:"9999px",backgroundColor:n,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(n),fontSize:void 0!==a?"".concat(a,"px"):"0.875rem",fontWeight:"600",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:void 0!==s?"".concat(s,"px"):N,fontFamily:R,textAlign:"center",WebkitFontSmoothing:"antialiased",textRendering:"optimizeLegibility",textSizeAdjust:"100%"}),u.textContent=(null==t?void 0:t.text)||"",d.appendChild(u),c.appendChild(d),c},e.prototype.createTextualImageLauncher=function(){var e,n,t,o,i,r,l=O().copilotUrl,a=this.config.config,s=a.brand_colour,c=a.launcher_properties,d=a.image_url,u=a.launcher_size_multiplier,p=null!=u?u:1,f=void 0!==this.config.launcher_size?void 0:174*p,v=void 0!==this.config.launcher_size?void 0:40*p,h=void 0!==this.config.launcher_size?void 0:40*p,m=void 0!==this.config.launcher_size?void 0:14*p,g=void 0!==this.config.launcher_size?void 0:21*p,_=document.createElement("div");Object.assign(_.style,{maxWidth:void 0!==f?"".concat(f,"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 b=document.createElement("div");Object.assign(b.style,{flex:"1",minWidth:"0"});var y=document.createElement("p");Object.assign(y.style,{margin:"0",color:I(s),fontSize:void 0!==m?"".concat(m,"px"):"0.875rem",fontWeight:"600",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:void 0!==g?"".concat(g,"px"):N,fontFamily:R,textAlign:"right",WebkitFontSmoothing:"antialiased",textRendering:"optimizeLegibility",textSizeAdjust:"100%"}),y.textContent=(null==c?void 0:c.text)||"";var w=document.createElement("div");Object.assign(w.style,{width:void 0!==h?"".concat(h,"px"):"40px",height:void 0!==h?"".concat(h,"px"):"40px",borderRadius:"9999px",overflow:"hidden",position:"relative",flexShrink:"0"});var E=document.createElement("img");return E.src=(null===(n=null===(e=null==this?void 0:this.config)||void 0===e?void 0:e.config)||void 0===n?void 0:n.launcher_type)?(null===(r=null===(i=null===(o=null===(t=null==this?void 0:this.config)||void 0===t?void 0:t.config)||void 0===o?void 0:o.images)||void 0===i?void 0:i.launcher_image_url)||void 0===r?void 0:r.url)||"".concat(l,"/chatbubble.png"):d||"".concat(l,"/chatbubble.png"),E.alt="Chat",Object.assign(E.style,{width:"100%",height:"100%",objectFit:"cover"}),b.appendChild(y),w.appendChild(E),_.appendChild(b),_.appendChild(w),_},e.prototype.applyResponsiveStyles=function(e){var n,t,o,i,r,l,a,s,c,d=(null===window||void 0===window?void 0:window.innerWidth)<560,u=this.config.config,p=this.config.position||(null===(o=u.interface_properties)||void 0===o?void 0:o.position)||"Right",f=null!==(l=null!==(i=this.config.sideSpacing)&&void 0!==i?i:null===(r=u.interface_properties)||void 0===r?void 0:r.side_spacing)&&void 0!==l?l:20,v=null!==(c=null!==(a=this.config.bottomSpacing)&&void 0!==a?a: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?((n={position:"fixed",bottom:"".concat(v,"px")})[p.toLowerCase()]="".concat(f,"px"),n):((t={bottom:"".concat(v,"px")})[p.toLowerCase()]="".concat(f,"px"),t));Object.assign(this.buttonElement.style,h)},e.prototype.handleResize=function(){var e,n,t,o=null!==(n=null===(e=this.config.config)||void 0===e?void 0:e.launcher_size_multiplier)&&void 0!==n?n:1,i=null!==(t=this.config.launcher_size)&&void 0!==t?t:48*o,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(i,"px"),height:"".concat(i,"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 n,t;null===(t=(n=e.config).onEvent)||void 0===t||t.call(n,{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=[],this.scrollHandlers.forEach((function(e){window.removeEventListener("scroll",e)})),this.scrollHandlers.clear(),this.shownScrollMessages.clear()},e.prototype.hideProactiveMessages=function(){var e,n,t=this;V();var o=null===(e=this.proactiveElement)||void 0===e?void 0:e.children[0];if(o){var i="Right"===(this.config.position||(null===(n=this.config.config.interface_properties)||void 0===n?void 0:n.position)||"Right");Array.from(o.children).forEach((function(e){e.className=i?"rblyn-proactive-exit-right":"rblyn-proactive-exit-left"})),setTimeout((function(){t.proactiveElement&&t.proactiveElement.parentElement&&t.proactiveElement.parentElement.removeChild(t.proactiveElement),t.proactiveElement=null,t.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(R,' !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 n,t,o,i,r,l,a,s,c,d,u,p,v,h,m,g=this,b=null===(t=null===(n=this.config)||void 0===n?void 0:n.config)||void 0===t?void 0:t.proactive_message_obj;if(Array.isArray(b)&&!this.config.isIframeVisible&&!G()){if(this.injectAnimationStyles(),!this.proactiveElement){var y=document.createElement("div");y.style.position="fixed";var w=null!==(l=null!==(i=this.config.bottomSpacing)&&void 0!==i?i:null===(r=this.config.config.interface_properties)||void 0===r?void 0:r.bottom_spacing)&&void 0!==l?l:20,T=null!==(c=null!==(a=this.config.sideSpacing)&&void 0!==a?a:null===(s=this.config.config.interface_properties)||void 0===s?void 0:s.side_spacing)&&void 0!==c?c:20,S=this.config.position||(null===(d=this.config.config.interface_properties)||void 0===d?void 0:d.position)||"Right",x=null!==(p=null===(u=this.config.config)||void 0===u?void 0:u.launcher_size_multiplier)&&void 0!==p?p:1,A=null!==(v=this.config.launcher_size)&&void 0!==v?v:48*x,C=this.config.config.launcher_type===f.IMAGE?A:void 0!==this.config.launcher_size?40:40*x;y.style.bottom="".concat(w+C+8,"px"),"Right"===S?y.style.right="".concat(T,"px"):y.style.left="".concat(T,"px"),y.style.maxWidth="22.875rem",y.style.zIndex="2147483646";var O=document.createElement("div");O.style.display="flex",O.style.flexDirection="column",O.style.alignItems="Right"===S?"flex-end":"flex-start";var D=document.createElement("div");D.style.position="absolute",D.style.top="-32px",D.style.width="24px",D.style.height="24px",D.style.borderRadius="50%",D.style.background="#fff",D.style.boxShadow="0 2.667px 2.667px 0 rgba(0, 0, 0, 0.25)",D.style.display="flex",D.style.alignItems="center",D.style.justifyContent="center",D.style.cursor="pointer",D.style.opacity="0",D.style.visibility="hidden","Right"===(this.config.position||(null===(h=this.config.config.interface_properties)||void 0===h?void 0:h.position)||"Right")?(D.style.right="0px",D.style.left="auto",D.style.transform="translateX(120%) scale(0.95)"):(D.style.left="0px",D.style.right="auto",D.style.transform="translateX(-120%) scale(0.95)"),D.onclick=function(e){e.stopPropagation(),g.hideProactiveMessages()},D.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 ',y.appendChild(O),y.appendChild(D),document.body.appendChild(y),this.proactiveElement=y}var L=this.proactiveElement.children[0];L.innerHTML="";var k="Right"===(this.config.position||(null===(m=this.config.config.interface_properties)||void 0===m?void 0:m.position)||"Right");L.style.display="flex",L.style.flexDirection="column",L.style.alignItems=k?"flex-end":"flex-start",this.clearProactiveDelays();var M=J(b),z=[],P=[];M.forEach((function(e){"scroll"===e.delayType&&void 0!==e.scrollThreshold&&Number(e.scrollThreshold)>0?P.push(e):z.push(e)}));var H=new Map;z.forEach((function(e){var n=H.get(e.delayMs);n||(n={messageIds:[],groups:new Map},H.set(e.delayMs,n)),n.groups.has(e.messageId)||(n.messageIds.push(e.messageId),n.groups.set(e.messageId,[])),n.groups.get(e.messageId).push(e)}));var F=new Map;P.forEach((function(e){var n=e.scrollThreshold||0,t=F.get(n);t||(t={messageIds:[],groups:new Map},F.set(n,t)),t.groups.has(e.messageId)||(t.messageIds.push(e.messageId),t.groups.set(e.messageId,[])),t.groups.get(e.messageId).push(e)}));var U=void 0!==H.get(0),B=this.proactiveElement.children[1];if(B&&M.length>0){B.style.opacity="0",B.style.visibility="hidden",B.style.transform=k?"translateX(120%) scale(0.95)":"translateX(-120%) scale(0.95)";var W=function(){if(B){B.style.visibility="visible";var e=L.children.length,n=e>0?10*(e-1):0;B.style.animationDelay="".concat(n,"ms"),B.className=k?"rblyn-proactive-close-enter-right":"rblyn-proactive-close-enter-left"}};if(U){var j=window.setTimeout(W,0);this.delayTimers.push(j)}else{var V=Math.min.apply(Math,Array.from(H.keys()));j=window.setTimeout(W,V);this.delayTimers.push(j)}}else B&&(B.style.opacity="0",B.style.visibility="hidden");var K=function(e,n,t){var o=L.children.length,i=0,r=[];e.forEach((function(e){var t=n.get(e)||[];E([],t,!0).sort((function(e,n){return e.contentIndex-n.contentIndex})).forEach((function(n){r.push({messageId:e,item:n})})),i+=t.length}));var l=t>0?E([],r,!0).reverse():r;l.forEach((function(e,n){var r,a=e.item,s=document.createElement("div"),c=a.messageDisplayType===_.BUTTON;s.style.background=(null==a?void 0:a.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=R,s.style.fontSize="14px",s.style.lineHeight=String(N),s.style.width="fit-content",s.style.maxWidth="100%";var d=0===n,u=n===l.length-1,p=o>0,f=H.has(0),v=!1;0===t?v=!u||d&&p:d&&(p||f)?v=!0:d||(v=!0),v&&(s.style.marginBottom="16px");var h=10*(o+i-1-(0===t?o+0:0));s.className=k?"rblyn-proactive-enter-right":"rblyn-proactive-enter-left",s.style.animationDelay="".concat(h,"ms"),s.style.opacity="0",s.style.transform=k?"translateX(120%) scale(0.95)":"translateX(-120%) scale(0.95)";var m=document.createElement("div");Object.assign(m.style,{display:"flex",alignItems:"center",gap:"8px"});var b=document.createElement("div");if(b.className="rblyn-proactive-message-content",b.setAttribute("dir",on(a.html)),b.innerHTML=tn(a.html),m.appendChild(b),(null==a?void 0:a.urlToGo)&&"string"==typeof a.urlToGo&&""!==a.urlToGo.trim()){var y=document.createElementNS("http://www.w3.org/2000/svg","svg");y.setAttribute("width","16"),y.setAttribute("height","17"),y.setAttribute("viewBox","0 0 16 17"),y.setAttribute("fill","none"),y.setAttribute("xmlns","http://www.w3.org/2000/svg"),Object.assign(y.style,{flexShrink:"0",color:I((null==a?void 0:a.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),y.appendChild(w),m.appendChild(y)}if(s.appendChild(m),s.onclick=function(){if((null==a?void 0:a.urlToGo)&&"string"==typeof a.urlToGo&&""!==a.urlToGo.trim())window.open(a.urlToGo,"_blank","noopener,noreferrer");else{Y({message_id:a.messageId,content_string:a.html||null,content_id:a.contentId||null}),g.config.toggleIframe(),g.hideProactiveMessages();try{window.dispatchEvent(new CustomEvent("rblyn:proactiveClick",{detail:{message_id:a.messageId,content_string:a.html||null,content_id:a.contentId||null}}))}catch(e){}}},0===t)L.appendChild(s);else{L.insertBefore(s,L.firstChild);var T=null===(r=g.proactiveElement)||void 0===r?void 0:r.children[1];if(T&&"visible"===T.style.visibility){var S=L.children.length,x=S>0?10*(S-1):0;T.style.animationDelay="".concat(x,"ms")}}}))};H.forEach((function(e,n){var t=e.messageIds,o=e.groups;if(0===n)K(t,o,n);else{var i=window.setTimeout((function(){K(t,o,n)}),n);g.delayTimers.push(i)}})),F.forEach((function(e,n){var t=e.messageIds,o=e.groups,i="scroll-".concat(n),r=function(){if((window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0)>=n&&!g.shownScrollMessages.has(i)){g.shownScrollMessages.add(i),K(t,o,1);var e=g.scrollHandlers.get(i);e&&(window.removeEventListener("scroll",e),g.scrollHandlers.delete(i))}};r(),g.scrollHandlers.set(i,r),window.addEventListener("scroll",r,{passive:!0})}))}else if(this.proactiveElement&&this.proactiveElement.parentElement){var X=this.proactiveElement.children[0],q="Right"===(this.config.position||(null===(o=this.config.config.interface_properties)||void 0===o?void 0:o.position)||"Right");Array.from(X.children).forEach((function(e){e.className=q?"rblyn-proactive-exit-right":"rblyn-proactive-exit-left"})),setTimeout((function(){g.proactiveElement&&g.proactiveElement.parentElement&&g.proactiveElement.parentElement.removeChild(g.proactiveElement),g.proactiveElement=null,g.clearProactiveDelays()}),400)}else this.proactiveElement=null,this.clearProactiveDelays()},e}(),rt=function(){function e(e){var n=this;this.isInitialized=!1,this.hasRegistered=!1,this.isAppReady=!1,this.shouldWaitForAppReady=!1,this.hasPendingOpenRequest=!1,this.overridesPayloadCache=null,this.proactiveDataSentInRegistration=!1,this.openedDueToProactive=!1,this.handleMessage=function(e){var t,o,i,r,l,a,s,c,d,u,p=O().copilotUrl;if(e.origin===p){var f=JSON.parse(e.data);if("APP_READY"===(null==f?void 0:f.type))return n.isAppReady=!0,void n.sendOpenAndRegisterIfReady();if("CHATBOT_CLOSED"===(null==f?void 0:f.type))return void(null===(t=null==n?void 0:n.config)||void 0===t||t.onClose());if("CHATBOT_TOKEN_EXHAUSTED"===(null==f?void 0:f.type))return void n.config.onInternalEvent(A.CHATBOT_TOKEN_EXHAUSTED);"CHATBOT_LOADED"===(null==f?void 0:f.type)&&(null===(i=(o=n.config).onEvent)||void 0===i||i.call(o,{type:x.CHATBOT_LOADED,timestamp:Date.now()}),n.config.onInternalEvent(x.CHATBOT_LOADED)),"CHAT_INITIALIZED"===(null==f?void 0:f.type)&&(null===(l=(r=n.config).onEvent)||void 0===l||l.call(r,{type:x.CHAT_INITIALIZED,timestamp:Date.now()}),n.config.onInternalEvent(x.CHAT_INITIALIZED)),"CHAT_INITIALIZATION_FAILED"===(null==f?void 0:f.type)&&(null===(s=(a=n.config).onEvent)||void 0===s||s.call(a,{type:x.CHAT_INITIALIZATION_FAILED,timestamp:Date.now()}),n.config.onInternalEvent(x.CHAT_INITIALIZATION_FAILED,{error:null===(c=e.data)||void 0===c?void 0:c.error})),"SESSION_REFRESHED"===(null==f?void 0:f.type)&&(null===(u=(d=n.config).onEvent)||void 0===u||u.call(d,{type:x.SESSION_REFRESHED,timestamp:Date.now()}),n.config.onInternalEvent(x.SESSION_REFRESHED)),"CHAT_MOVED"===(null==f?void 0:f.type)&&n.config.onInternalEvent(A.CHAT_MOVED,{from:e.data.from,to:e.data.to,trigger:e.data.trigger})}},this.config=e,this.iframeElement=document.createElement("iframe"),this.iframeElement.id="chat-iframe-rbyln",this.resizeHandler=this.applyResponsiveStyles.bind(this),this.render(),this.initialize(),this.setupEventListeners()}return e.prototype.buildOverridesPayload=function(){var e,n,t,o,i,r,l,a,s,c,d,u,p,f,v,h,m,g,_,b,y;return{header_avatar:null!==(t=null===(n=null===(e=this.config)||void 0===e?void 0:e.overrides)||void 0===n?void 0:n.header_avatar)&&void 0!==t?t:null,agent_avatar:null!==(r=null===(i=null===(o=this.config)||void 0===o?void 0:o.overrides)||void 0===i?void 0:i.agent_avatar)&&void 0!==r?r:null,header_title:null!==(s=null===(a=null===(l=this.config)||void 0===l?void 0:l.overrides)||void 0===a?void 0:a.header_title)&&void 0!==s?s:null,header_subtitle:null!==(u=null===(d=null===(c=this.config)||void 0===c?void 0:c.overrides)||void 0===d?void 0:d.header_subtitle)&&void 0!==u?u:null,header_title_text_color:null!==(v=null===(f=null===(p=this.config)||void 0===p?void 0:p.overrides)||void 0===f?void 0:f.header_title_text_color)&&void 0!==v?v:null,header_subtitle_text_color:null!==(g=null===(m=null===(h=this.config)||void 0===h?void 0:h.overrides)||void 0===m?void 0:m.header_subtitle_text_color)&&void 0!==g?g:null,header_bg:null!==(y=null===(b=null===(_=this.config)||void 0===_?void 0:_.overrides)||void 0===b?void 0:b.header_bg)&&void 0!==y?y:null}},e.prototype.hasUserProvidedOverrides=function(e){return Object.values(e).some((function(e){return"string"==typeof e?e.trim().length>0:null!=e}))},e.prototype.getElement=function(){return this.iframeElement},e.prototype.render=function(){var e,n=this.config.position||(null===(e=this.config.config.interface_properties)||void 0===e?void 0:e.position)||"Right";Object.assign(this.iframeElement.style,{zIndex:"20000000",border:"none",boxShadow:"0px 0px 40px 0px rgba(14, 14, 15, 0.24)",transformOrigin:"bottom ".concat(n.toLowerCase()),transition:"transform 0.2s cubic-bezier(0.2, 1.27, 0.29, 0.97), opacity 0.15s ease-out",transform:"scale(0.3) translate3d(0,40px,0)",opacity:"0",display:"none"}),this.applyResponsiveStyles()},e.prototype.applyResponsiveStyles=function(){var e,n,t,o,i,r;if(this.iframeElement){var l=this.config.position||(null===(t=this.config.config.interface_properties)||void 0===t?void 0:t.position)||"Right",a=null!==(r=null!==(o=this.config.bottomSpacing)&&void 0!==o?o:null===(i=this.config.config.interface_properties)||void 0===i?void 0:i.bottom_spacing)&&void 0!==r?r:20;window.innerWidth<560?Object.assign(this.iframeElement.style,((e={width:"100vw",minWidth:"300px"})[l.toLowerCase()]="0",e.bottom="0",e.height="100vh",e.flexDirection="column",e.flexGrow="1",e.borderRadius="0",e.top="0",e.maxHeight="100%",e.position="fixed",e)):Object.assign(this.iframeElement.style,((n={width:"26%",minWidth:"400px",height:"calc(100vh - 2rem - 10vh - ".concat(a,"px)"),borderRadius:"1rem",top:"calc(10vh - 32px)",maxHeight:"50rem",position:""})[l.toLowerCase()]=void 0,n))}},e.prototype.initialize=function(){var e=this;if(!this.isInitialized){var n=O().copilotUrl;this.iframeElement.src="".concat(n,"/chatbot-plugin?id=").concat(this.config.config.chatbotId),this.isInitialized=!0,this.iframeElement.addEventListener("load",(function(){var t,o,i,r,l,a,s,c,d,u,p,f,v,h,m,g,_,y,w,E,I,T,S,A,C,O,D,R,N=new URL(e.iframeElement.src).origin||n;null===(t=e.iframeElement.contentWindow)||void 0===t||t.postMessage({domain:null===(o=null===window||void 0===window?void 0:window.location)||void 0===o?void 0:o.hostname,name:"checkDomain"},N);var L=e.buildOverridesPayload();if(e.hasUserProvidedOverrides(L)&&(null===(i=e.iframeElement.contentWindow)||void 0===i||i.postMessage({domain:null===(r=null===window||void 0===window?void 0:window.location)||void 0===r?void 0:r.hostname,action:pn.UPDATE_OVERRIDES,data:L},n)),!e.hasRegistered&&e.iframeElement.contentWindow){e.iframeElement.contentWindow.postMessage({domain:null===(l=null===window||void 0===window?void 0:window.location)||void 0===l?void 0:l.hostname,action:pn.I_CAN_AUTHENTICATE,data:{show_history:null===(a=e.config.config)||void 0===a?void 0:a.show_history}},n);var k=K();e.proactiveDataSentInRegistration=!!k,e.iframeElement.contentWindow.postMessage({domain:null===(s=null===window||void 0===window?void 0:window.location)||void 0===s?void 0:s.hostname,action:pn.I_LOADED_LAUNCHER,data:b(b({ws_url:null===(c=e.config.config)||void 0===c?void 0:c.ws_url,userId:null===(d=e.config.config)||void 0===d?void 0:d.userId,token:null===(u=e.config.config)||void 0===u?void 0:u.token,userProfile:b(b({},null===(p=e.config.config)||void 0===p?void 0:p.userProfile),{__INT_SYS_INFO__:b(b({},(null===(v=null===(f=e.config.config)||void 0===f?void 0:f.userProfile)||void 0===v?void 0:v.__INT_SYS_INFO__)||{}),kn())}),isAnonymous:null===(h=e.config.config)||void 0===h?void 0:h.isAnonymous},k?{proactiveData:k}:{}),{show_history:null===(m=e.config.config)||void 0===m?void 0:m.show_history,init_load_image:(null===(y=null===(_=null===(g=e.config.config)||void 0===g?void 0:g.images)||void 0===_?void 0:_.header_image_url)||void 0===y?void 0:y.url)||(null===(w=e.config.config)||void 0===w?void 0:w.brand_logo_url),init_load_bot_name:null===(E=e.config.config)||void 0===E?void 0:E.name,init_load_brand_color:null===(T=null===(I=e.config.config)||void 0===I?void 0:I.colors)||void 0===T?void 0:T.brand_color,init_load_powered_by:(null===(A=null===(S=e.config.config)||void 0===S?void 0:S.footer)||void 0===A?void 0:A.show_powered_by)||!1})},n),e.hasRegistered=!0}null===(O=(C=e.config).onIframeLoaded)||void 0===O||O.call(C),null===(R=(D=e.config).onEvent)||void 0===R||R.call(D,{type:x.CHATBOT_READY,timestamp:Date.now()}),e.config.onInternalEvent(x.CHATBOT_LOADED)}))}},e.prototype.setupEventListeners=function(){var e=this;window.addEventListener("resize",this.resizeHandler),this.iframeElement.addEventListener("error",(function(){mn.trackError(new Error(Nn[Sn]({src:e.iframeElement.src,error:"Failed to load iframe"})),"ChatbotIframe",{errorCode:Sn,errorType:Dn,context:{config:e.config.config,iframeUrl:e.iframeElement.src,timestamp:Date.now()}})})),window.addEventListener("message",this.handleMessage);window.addEventListener("rblyn:proactiveClick",(function(n){var t,o,i,r,l,a,s,c,d,u;if(e.hasRegistered)if(e.proactiveDataSentInRegistration)e.proactiveDataSentInRegistration=!1;else{e.openedDueToProactive=!0;var p=(null==n?void 0:n.detail)||{},f=O().copilotUrl,v=new URL(e.iframeElement.src).origin||f;null===(t=e.iframeElement.contentWindow)||void 0===t||t.postMessage({domain:null===(o=null===window||void 0===window?void 0:window.location)||void 0===o?void 0:o.hostname,action:pn.I_CLICKED_PROACTIVE_BUBBLE,data:{userId:null===(i=e.config.config)||void 0===i?void 0:i.userId,token:null===(r=e.config.config)||void 0===r?void 0:r.token,userProfile:b(b({},null===(l=e.config.config)||void 0===l?void 0:l.userProfile),{__INT_SYS_INFO__:b(b({},(null===(s=null===(a=e.config.config)||void 0===a?void 0:a.userProfile)||void 0===s?void 0:s.__INT_SYS_INFO__)||{}),kn())}),isAnonymous:null===(c=e.config.config)||void 0===c?void 0:c.isAnonymous,ws_url:null===(d=e.config.config)||void 0===d?void 0:d.ws_url,proactiveData:{input_id:null,message_id:(null==p?void 0:p.message_id)||null,content_string:(null==p?void 0:p.content_string)||null,content_id:(null==p?void 0:p.content_id)||null},show_history:null===(u=e.config.config)||void 0===u?void 0:u.show_history}},v)}}))},e.prototype.updateVisibility=function(e,n){var t;this.shouldWaitForAppReady=!!n,this.config.isVisible=e;var o=this.config.position||(null===(t=this.config.config.interface_properties)||void 0===t?void 0:t.position)||"Right";if(e?this.showIframe(o):this.hideIframe(o),!e)return this.openedDueToProactive=!1,void(this.hasPendingOpenRequest=!1);this.hasPendingOpenRequest=!0,this.shouldWaitForAppReady,this.sendOpenAndRegisterIfReady()},e.prototype.showIframe=function(e){this.iframeElement.style.display="block",this.iframeElement.getBoundingClientRect(),this.iframeElement.style.opacity="1",this.iframeElement.style.transform="scale(1) translate3d(0,0,0)"},e.prototype.hideIframe=function(e){var n=this;this.iframeElement.style.opacity="0",this.iframeElement.style.transform="scale(0.3) translate3d(".concat((e.toLowerCase(),"0"),",40px,0)"),setTimeout((function(){n.config.isVisible||(n.iframeElement.style.display="none")}),200)},e.prototype.sendOpenAndRegisterIfReady=function(){var e,n,t,o,i,r,l,a,s,c,d,u;if(this.iframeElement.contentWindow&&this.config.isVisible&&(!this.shouldWaitForAppReady||this.isAppReady)&&this.hasPendingOpenRequest){var p=O().copilotUrl,f=new URL(this.iframeElement.src).origin||p;if(this.iframeElement.contentWindow.postMessage({domain:null===(e=null===window||void 0===window?void 0:window.location)||void 0===e?void 0:e.hostname,name:"openFrame"},f),this.openedDueToProactive)this.openedDueToProactive=!1;else{var v=K();this.iframeElement.contentWindow.postMessage({domain:null===(n=null===window||void 0===window?void 0:window.location)||void 0===n?void 0:n.hostname,action:pn.I_OPENED_IFRAME,data:b(b({ws_url:null===(t=this.config.config)||void 0===t?void 0:t.ws_url,userId:null===(o=this.config.config)||void 0===o?void 0:o.userId,token:null===(i=this.config.config)||void 0===i?void 0:i.token,userProfile:b(b({},null===(r=this.config.config)||void 0===r?void 0:r.userProfile),{__INT_SYS_INFO__:b(b({},(null===(a=null===(l=this.config.config)||void 0===l?void 0:l.userProfile)||void 0===a?void 0:a.__INT_SYS_INFO__)||{}),kn())}),isAnonymous:null===(s=this.config.config)||void 0===s?void 0:s.isAnonymous},v?{proactiveData:v}:{}),{show_history:null===(c=this.config.config)||void 0===c?void 0:c.show_history})},p)}null===(u=(d=this.config).onEvent)||void 0===u||u.call(d,{type:x.CHATBOT_OPENED,timestamp:Date.now()}),this.config.onInternalEvent(x.CHATBOT_OPENED),this.hasPendingOpenRequest=!1}},e.prototype.update=function(e,n){var t,o,i=this.config.isVisible;if(this.config=b(b({},this.config),e),i!==this.config.isVisible&&this.updateVisibility(this.config.isVisible,n),this.iframeElement.contentWindow&&this.config.isVisible){var r=O().copilotUrl;this.iframeElement.contentWindow.postMessage({action:pn.UPDATE_USER_PROFILE,user_profile:this.config.config.userProfile,show_history:null===(t=this.config.config)||void 0===t?void 0:t.show_history},r),this.iframeElement.contentWindow.postMessage({action:pn.OPENED_IFRAME_EVENT,user_profile:this.config.config.userProfile,show_history:null===(o=this.config.config)||void 0===o?void 0:o.show_history},r)}},e.prototype.destroy=function(){window.removeEventListener("resize",this.resizeHandler),window.removeEventListener("message",this.handleMessage),this.iframeElement&&this.iframeElement.parentNode&&this.iframeElement.parentNode.removeChild(this.iframeElement)},e}(),lt=function(){function e(e,n,t,o){this.resizeObserver=null,this.containerElement=document.createElement("div"),this.handleResizeFunction=this.handleResize.bind(this),this.config={config:e,position:n,sideSpacing:t,bottomSpacing:o},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,n,t,o,i,r,l,a,s,c=(null===window||void 0===window?void 0:window.innerWidth)<560,d=this.config.position||(null===(t=this.config.config.interface_properties)||void 0===t?void 0:t.position)||"Right",u=null!==(r=null!==(o=this.config.sideSpacing)&&void 0!==o?o:null===(i=this.config.config.interface_properties)||void 0===i?void 0:i.side_spacing)&&void 0!==r?r:20,p=null!==(s=null!==(l=this.config.bottomSpacing)&&void 0!==l?l:null===(a=this.config.config.interface_properties)||void 0===a?void 0:a.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"},v=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),((n={top:"0"})[d.toLowerCase()]="".concat(u,"px"),n.alignItems="center",n));Object.assign(this.containerElement.style,c?h:v)},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}(),at=function(e){e.api_key,e.user_profile;var n=e.onEvent;e.chatbotConfig;return{emit:function(e,t){var o={type:e,timestamp:Date.now(),data:t};null==n||n(o)},onInternalEvent:function(e,n){}}};Qn();var st=function(){function e(e){var n=this;this.container=null,this.floatingButton=null,this.launcherDelayTimeout=null,this.iframe=null,this.isDestroyed=!1,this.isIframeLoaded=!1,this.hasScrolledPastDepth=!1,this.scrollHandler=null,this.hasAutoLaunched=!1,this.hasScrolledPastAutoLaunchDepth=!1,this.autoLaunchScrollHandler=null,this.autoLaunchDelayTimeout=null,this.handleStateChange=function(e){var t,o,i,r,l,a,s,c,d;if(!n.isDestroyed){var u=e.isInitialized,p=e.error,f=e.chatbotConfig,v=e.isIframeVisible;if(!p&&f&&u){if(n.eventEmitter=at({api_key:n.config.api_key,user_profile:n.config.user_profile,onEvent:n.config.onEvent,chatbotConfig:{isAnonymous:f.isAnonymous,userId:f.userId}}),n.container||(n.container=new lt(f,n.config.position,n.config.sideSpacing,n.config.bottomSpacing)),n.iframe)n.iframe.update({config:f,isVisible:v,position:n.config.position,bottomSpacing:n.config.bottomSpacing,overrides:n.config.overrides},!0);else if(n.iframe=new rt({config:f,isVisible:v,onClose:n.handleClose,onEvent:n.config.onEvent,onIframeLoaded:function(){n.isIframeLoaded=!0;var e=n.stateManager.getState();n.handleStateChange({isInitialized:e.isInitialized,error:e.error,chatbotConfig:e.chatbotConfig,isIframeVisible:e.isIframeVisible}),e.chatbotConfig&&n.handleAutoLaunch(e.chatbotConfig,e.isIframeVisible)},onInternalEvent:n.eventEmitter.onInternalEvent,position:n.config.position,bottomSpacing:n.config.bottomSpacing,overrides:n.config.overrides}),n.iframe.getElement&&"function"==typeof n.iframe.getElement){var h=n.iframe.getElement();h&&n.container&&n.container.getElement().prepend(h)}n.setupScrollTracking(f),n.setupAutoLaunchScrollTracking(f);var m=void 0!==n.config.show_launcher?Boolean(n.config.show_launcher):null===(t=null==f?void 0:f.show_launcher)||void 0===t||t,g=!0===(null===(o=null==f?void 0:f.launcher_delay)||void 0===o?void 0:o.enabled),_=null!==(a=null!==(r=null===(i=null==f?void 0:f.launcher_delay)||void 0===i?void 0:i.seconds)&&void 0!==r?r:null===(l=null==f?void 0:f.launcher_delay)||void 0===l?void 0:l.delay)&&void 0!==a?a:0,b=!0===(null===(s=null==f?void 0:f.launcher_scroll)||void 0===s?void 0:s.enabled),y=null!==(d=null===(c=null==f?void 0:f.launcher_scroll)||void 0===c?void 0:c.depth)&&void 0!==d?d:0,w=b&&Number(y)>0;console.log("[Vanilla SDK] Launcher visibility check",{finalShowLauncher:m,delayEnabled:g,seconds:_,scrollEnabled:b,scrollDepth:y,requiresScroll:w,hasScrolledPastDepth:n.hasScrolledPastDepth});var E=!0;if(w){var I=window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0;E=I>=Number(y)||n.hasScrolledPastDepth,console.log("[Vanilla SDK] Scroll condition check",{currentScrollY:I,requiredDepth:Number(y),hasScrolledPastDepthState:n.hasScrolledPastDepth,scrollConditionMet:E})}var T=function(){if(n.isIframeLoaded)if(n.floatingButton)n.floatingButton.update({config:f,isIframeVisible:v,position:n.config.position,sideSpacing:n.config.sideSpacing,bottomSpacing:n.config.bottomSpacing,launcher_size:n.config.launcher_size}),n.handleAutoLaunch(f,v);else{if(n.floatingButton=new it({config:f,toggleIframe:n.toggleIframe,isIframeVisible:v,onEvent:n.config.onEvent,onInternalEvent:n.eventEmitter.onInternalEvent,position:n.config.position,sideSpacing:n.config.sideSpacing,bottomSpacing:n.config.bottomSpacing,launcher_size:n.config.launcher_size}),n.floatingButton.getElement&&"function"==typeof n.floatingButton.getElement){var e=n.floatingButton.getElement();e&&n.container&&n.container.getElement().appendChild(e)}n.handleAutoLaunch(f,v)}},S=function(){n.floatingButton&&(n.floatingButton.destroy(),n.floatingButton=null)};n.launcherDelayTimeout&&(clearTimeout(n.launcherDelayTimeout),n.launcherDelayTimeout=null),m?w&&!E?(console.log("[Vanilla SDK] Scroll required but condition not met, unmounting button"),S()):g&&Number(_)>0?n.floatingButton?n.isIframeLoaded&&T():n.launcherDelayTimeout=window.setTimeout((function(){var e,t,o,i=n.stateManager.getState().chatbotConfig,r=!0===(null===(e=null==i?void 0:i.launcher_scroll)||void 0===e?void 0:e.enabled),l=null!==(o=null===(t=null==i?void 0:i.launcher_scroll)||void 0===t?void 0:t.depth)&&void 0!==o?o:0,a=r&&Number(l)>0,s=!0;a&&(s=(window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0)>=Number(l)||n.hasScrolledPastDepth);!n.isIframeLoaded||a&&!s||T(),n.launcherDelayTimeout=null}),1e3*Number(_)):(console.log("[Vanilla SDK] No delay, checking iframe loaded",{isIframeLoaded:n.isIframeLoaded}),n.isIframeLoaded?(console.log("[Vanilla SDK] Mounting button immediately"),T()):console.log("[Vanilla SDK] Iframe not loaded yet, button will mount when loaded")):(console.log("[Vanilla SDK] show_launcher is false, unmounting button"),S())}}},this.setupAutoLaunchScrollTracking=function(e){var t,o,i;if(e&&!n.hasAutoLaunched){var r=!0===(null===(t=null==e?void 0:e.auto_launch_scroll)||void 0===t?void 0:t.enabled),l=null!==(i=null===(o=null==e?void 0:e.auto_launch_scroll)||void 0===o?void 0:o.depth)&&void 0!==i?i:0;if(n.autoLaunchScrollHandler&&(window.removeEventListener("scroll",n.autoLaunchScrollHandler),n.autoLaunchScrollHandler=null),!r||Number(l)<=0)n.hasScrolledPastAutoLaunchDepth=!1;else{var a=function(){if(!n.hasScrolledPastAutoLaunchDepth&&(window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0)>=Number(l)){n.hasScrolledPastAutoLaunchDepth=!0;var e=n.stateManager.getState();e.chatbotConfig&&n.handleAutoLaunch(e.chatbotConfig,e.isIframeVisible)}};a(),n.autoLaunchScrollHandler=a,window.addEventListener("scroll",n.autoLaunchScrollHandler,{passive:!0})}}},this.handleAutoLaunch=function(e,t){var o,i,r,l,a,s,c;if(e&&!n.hasAutoLaunched&&n.isIframeLoaded&&!t){var d=void 0!==n.config.show_launcher?Boolean(n.config.show_launcher):null===(o=null==e?void 0:e.show_launcher)||void 0===o||o,u=!0===(null==e?void 0:e.auto_launch),p=!!n.floatingButton;if(d&&u&&p){var f=!0===(null===(i=null==e?void 0:e.auto_launch_delay)||void 0===i?void 0:i.enabled),v=null!==(l=null===(r=null==e?void 0:e.auto_launch_delay)||void 0===r?void 0:r.seconds)&&void 0!==l?l:0,h=!0===(null===(a=null==e?void 0:e.auto_launch_scroll)||void 0===a?void 0:a.enabled),m=null!==(c=null===(s=null==e?void 0:e.auto_launch_scroll)||void 0===s?void 0:s.depth)&&void 0!==c?c:0,g=h&&Number(m)>0,_=!0;if(g)_=(window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0)>=Number(m)||n.hasScrolledPastAutoLaunchDepth;if(!g||_){n.autoLaunchDelayTimeout&&(clearTimeout(n.autoLaunchDelayTimeout),n.autoLaunchDelayTimeout=null);var b=function(){n.hasAutoLaunched||t||(n.hasAutoLaunched=!0,n.toggleIframe(),n.eventEmitter.emit(x.CHATBOT_BUTTON_CLICKED))};f&&Number(v)>0?n.autoLaunchDelayTimeout=window.setTimeout((function(){var e=!0;g&&(e=(window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0)>=Number(m)||n.hasScrolledPastAutoLaunchDepth);g&&!e||b(),n.autoLaunchDelayTimeout=null}),1e3*Number(v)):b()}}}},this.setupScrollTracking=function(e){var t,o,i,r,l;if(console.log("[Vanilla SDK] setupScrollTracking called",{hasConfig:!!e,scrollEnabled:null===(t=null==e?void 0:e.launcher_scroll)||void 0===t?void 0:t.enabled,scrollDepth:null===(o=null==e?void 0:e.launcher_scroll)||void 0===o?void 0:o.depth}),e){var a=!0===(null===(i=null==e?void 0:e.launcher_scroll)||void 0===i?void 0:i.enabled),s=null!==(l=null===(r=null==e?void 0:e.launcher_scroll)||void 0===r?void 0:r.depth)&&void 0!==l?l:0;if(n.scrollHandler&&(window.removeEventListener("scroll",n.scrollHandler),n.scrollHandler=null),!a||Number(s)<=0)return console.log("[Vanilla SDK] Scroll disabled or depth <= 0, resetting state"),void(n.hasScrolledPastDepth=!1);var c=function(){if(!n.hasScrolledPastDepth){var e=window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0;if(console.log("[Vanilla SDK] Checking scroll depth",{currentScrollY:e,requiredDepth:Number(s),hasScrolledPast:e>=Number(s),currentState:n.hasScrolledPastDepth}),e>=Number(s)){console.log("[Vanilla SDK] Scroll depth reached! Setting flag to true"),n.hasScrolledPastDepth=!0;var t=n.stateManager.getState();n.handleStateChange({isInitialized:t.isInitialized,error:t.error,chatbotConfig:t.chatbotConfig,isIframeVisible:t.isIframeVisible})}}};console.log("[Vanilla SDK] Checking initial scroll position"),c(),n.scrollHandler=c,window.addEventListener("scroll",n.scrollHandler,{passive:!0})}},this.toggleIframe=function(){var e=n.stateManager.getState();n.stateManager.toggleIframeVisibility(),n.eventEmitter.emit(e.isIframeVisible?x.CHATBOT_CLOSED:x.CHATBOT_BUTTON_CLICKED)},this.handleClose=function(){n.stateManager.closeIframe(),n.eventEmitter.emit(x.CHATBOT_CLOSED)};var t=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=t,Qn(),!e.api_key)throw mn.trackError(new Error(Nn[gn](e.api_key)),"RobylonChatbot",{errorCode:gn,errorType:Cn,context:{timestamp:Date.now()}}),new Error("API key is required");try{mn.initialize(e.api_key,e.user_id)}catch(e){mn.trackError(e instanceof Error?e:new Error(String(e)),"RobylonChatbot",{errorCode:wn,errorType:Cn,context:{timestamp:Date.now()}})}this.stateManager=function(e){var n={isInitialized:!1,isInitializing:!1,error:null,chatbotConfig:null,isIframeVisible:!1},t=[],o=function(e){n=b(b({},n),e),t.forEach((function(e){return e(n)}))};return{getState:function(){return n},initialize:function(){return y(void 0,void 0,void 0,(function(){var n,t,i;return w(this,(function(r){switch(r.label){case 0:if(!e.api_key)return mn.trackError(new Error(Nn[gn](e.api_key)),"ChatbotStateManager",{errorCode:gn,errorType:Cn,context:{timestamp:Date.now()}}),[2];o({isInitializing:!0}),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,Gn(e)];case 2:return n=r.sent(),[4,new Promise((function(e,t){jn(n,(function(){o({isInitialized:!0,chatbotConfig:n}),e()}),(function(e){t(e)}))}))];case 3:return r.sent(),[3,6];case 4:return t=r.sent(),i=t instanceof Error?t.message:"Failed to initialize chatbot",o({error:i}),mn.trackError(t instanceof Error?t:new Error(i),"ChatbotStateManager",{errorCode:yn,errorType:Cn,context:{timestamp:Date.now()}}),[3,6];case 5:return o({isInitializing:!1}),[7];case 6:return[2]}}))}))},toggleIframeVisibility:function(){o({isIframeVisible:!n.isIframeVisible})},closeIframe:function(){o({isIframeVisible:!1})},updateState:o,subscribe:function(e){return t.push(e),function(){var n=t.indexOf(e);n>-1&&t.splice(n,1)}},unsubscribe:function(e){var n=t.indexOf(e);n>-1&&t.splice(n,1)}}}({api_key:e.api_key,user_id:e.user_id,user_token:e.user_token,user_profile:e.user_profile}),this.eventEmitter=at({api_key:e.api_key,user_profile:e.user_profile,onEvent:e.onEvent,chatbotConfig:null}),this.initialize()}return e.prototype.initialize=function(){return y(this,void 0,void 0,(function(){var e;return w(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.stateManager.initialize()];case 1:return n.sent(),this.stateManager.subscribe(this.handleStateChange),this.handleStateChange(this.stateManager.getState()),[3,3];case 2:return e=n.sent(),mn.trackError(e instanceof Error?e:new Error(String(e)),"RobylonChatbot.initialize",{errorCode:yn,errorType:Cn,context:{timestamp:Date.now()}}),[3,3];case 3:return[2]}}))}))},e.prototype.show=function(){this.stateManager.getState().isIframeVisible||(this.stateManager.toggleIframeVisibility(),this.eventEmitter.emit(x.CHATBOT_BUTTON_CLICKED))},e.prototype.hide=function(){this.stateManager.getState().isIframeVisible&&(this.stateManager.closeIframe(),this.eventEmitter.emit(x.CHATBOT_CLOSED))},e.prototype.toggle=function(){this.toggleIframe()},e.prototype.destroy=function(){this.isDestroyed=!0,this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler),this.scrollHandler=null),this.autoLaunchScrollHandler&&(window.removeEventListener("scroll",this.autoLaunchScrollHandler),this.autoLaunchScrollHandler=null),this.autoLaunchDelayTimeout&&(clearTimeout(this.autoLaunchDelayTimeout),this.autoLaunchDelayTimeout=null),this.floatingButton&&(this.floatingButton.destroy(),this.floatingButton=null),this.launcherDelayTimeout&&(clearTimeout(this.launcherDelayTimeout),this.launcherDelayTimeout=null),this.iframe&&(this.iframe.destroy(),this.iframe=null),this.container&&(this.container.destroy(),this.container=null),this.stateManager.unsubscribe(this.handleStateChange)},e.prototype.getState=function(){return this.stateManager.getState().isInitialized?"initialized":"uninitialized"},e}();function ct(e){return new st(e)}if("undefined"!=typeof window){!function(){if("undefined"!=typeof window){var e=window,n=(null==e?void 0:e.RobylonChatbot)||(null==e?void 0:e.R);if(n&&Array.isArray(n.q)){var t=null;n.q.forEach((function(e){var n=e[0];if("init"===n){var o=e[1]||{};t=ct(o)}else t&&"function"==typeof t[n]&&t[n]()})),e.RobylonChatbot=function(e){var n=Array.prototype.slice.call(arguments,1);return"init"===e?t=ct(n[0]||{}):t&&"function"==typeof t[e]?t[e].apply(t,n):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 dt=window,ut=null==dt?void 0:dt.RobylonChatbot;ut&&!(null==dt?void 0:dt.R)&&(dt.R=ut)}var pt={create:ct,getState:function(){return"initialized"}};export{et as Chatbot,u as ChatbotInterfaceType,g as ConditionType,h as DisplayAttributesType,f as LauncherType,m as LogicalConditionType,_ as MessageDisplayType,v as ProactiveSendTimeType,pt as RobylonChatbot,p as WidgetPositionEnums,nt as useChatbot};
4
4
  //# sourceMappingURL=index.js.map