@robylon/web-react-sdk 1.1.49-staging.7 → 1.1.50-staging.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
|
-
import e,{memo as t,useRef as n,useState as i,useEffect as o,useCallback as r,Component as a,useMemo as l,forwardRef as s,useImperativeHandle as c}from"react";var d=function(e,t){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},d(e,t)};var u,p,f,m,h,v,g,y=function(){return y=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},y.apply(this,arguments)};function b(e,t,n,i){return new(n||(n=Promise))((function(o,r){function a(e){try{s(i.next(e))}catch(e){r(e)}}function l(e){try{s(i.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,l)}s((i=i.apply(e,t||[])).next())}))}function _(e,t){var n,i,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(l){return function(s){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(r=0)),r;)try{if(n=1,i&&(o=2&l[0]?i.return:l[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,l[1])).done)return o;switch(i=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(!(o=r.trys,(o=o.length>0&&o[o.length-1])||6!==l[0]&&2!==l[0])){r=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){r.label=l[1];break}if(6===l[0]&&r.label<o[1]){r.label=o[1],o=l;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(l);break}o[2]&&r.ops.pop(),r.trys.pop();continue}l=t.call(e,r)}catch(e){l=[6,e],i=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,s])}}}function w(e,t,n){if(n||2===arguments.length)for(var i,o=0,r=t.length;o<r;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError,function(e){e.WIDGET="WIDGET",e.POPOVER="POPOVER",e.EMBED="EMBED"}(u||(u={})),function(e){e.RIGHT="Right",e.LEFT="Left"}(p||(p={})),function(e){e.TEXT="TEXT",e.IMAGE="IMAGE",e.TEXTUAL_IMAGE="TEXTUAL_IMAGE"}(f||(f={})),function(e){e.WORKING_HOURS="WORKING_HOURS",e.ALWAYS="ALWAYS"}(m||(m={})),function(e){e.URL="URL"}(h||(h={})),function(e){e.AND="AND",e.OR="OR"}(v||(v={})),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={}));var E=function(e,t){void 0===t&&(t=.5);var n=function(e){e=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(e,t,n,i){return t+t+n+n+i+i}));var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:{r:0,g:0,b:0}}(e),i=function(e,t,n){var i=[e,t,n].map((function(e){return(e/=255)<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}));return.2126*i[0]+.7152*i[1]+.0722*i[2]}(n.r,n.g,n.b);return i>t?"#0E0E0F":"#FFFFFF"},I={log:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.log.apply(console,e)},error:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.error.apply(console,e)},warn:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.warn.apply(console,e)},info:function(){}};I.log("Raw API_URL:","https://stage-api.robylon.ai");var T={copilotUrl:"https://staging.d2s3wsqyyond1h.amplifyapp.com",environment:"staging",apiUrl:"https://stage-api.robylon.ai"};I.log("CONFIG",T);var x,S,A=function(){return"undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement},C=function(){return{copilotUrl:T.copilotUrl||"https://app.robylon.ai",environment:T.environment||"production",apiUrl:T.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"}(S||(S={}));var O,R="system-ui, Inter, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'",D="21px",N="",k=[],L=!1,M=function(){return"undefined"==typeof window?"":window.location.href},z=function(){return M()},F=function(){var e=M();e!==N&&(N=e,k.forEach((function(t){return t(e)})))},H=function(e){return L||U(),k.push(e),e(M()),function(){var t=k.indexOf(e);t>-1&&k.splice(t,1)}},U=function(){if(!L&&"undefined"!=typeof window){L=!0,N=M();var e=function(e){var t=history[e];return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var i=t.apply(this,e);return setTimeout(F,0),i}};try{history.pushState=e("pushState"),history.replaceState=e("replaceState")}catch(e){}window.addEventListener("popstate",F),window.addEventListener("hashchange",F);var t=setInterval((function(){F()}),1e3);setInterval((function(){0===k.length&&(clearInterval(t),window.removeEventListener("popstate",F),window.removeEventListener("hashchange",F),L=!1)}),5e3)}},
|
|
1
|
+
import e,{memo as t,useRef as n,useState as i,useEffect as o,useCallback as r,Component as a,useMemo as l,forwardRef as s,useImperativeHandle as c}from"react";var d=function(e,t){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},d(e,t)};var u,p,f,m,h,v,g,y=function(){return y=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},y.apply(this,arguments)};function b(e,t,n,i){return new(n||(n=Promise))((function(o,r){function a(e){try{s(i.next(e))}catch(e){r(e)}}function l(e){try{s(i.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,l)}s((i=i.apply(e,t||[])).next())}))}function _(e,t){var n,i,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(l){return function(s){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(r=0)),r;)try{if(n=1,i&&(o=2&l[0]?i.return:l[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,l[1])).done)return o;switch(i=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(!(o=r.trys,(o=o.length>0&&o[o.length-1])||6!==l[0]&&2!==l[0])){r=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){r.label=l[1];break}if(6===l[0]&&r.label<o[1]){r.label=o[1],o=l;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(l);break}o[2]&&r.ops.pop(),r.trys.pop();continue}l=t.call(e,r)}catch(e){l=[6,e],i=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,s])}}}function w(e,t,n){if(n||2===arguments.length)for(var i,o=0,r=t.length;o<r;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError,function(e){e.WIDGET="WIDGET",e.POPOVER="POPOVER",e.EMBED="EMBED"}(u||(u={})),function(e){e.RIGHT="Right",e.LEFT="Left"}(p||(p={})),function(e){e.TEXT="TEXT",e.IMAGE="IMAGE",e.TEXTUAL_IMAGE="TEXTUAL_IMAGE"}(f||(f={})),function(e){e.WORKING_HOURS="WORKING_HOURS",e.ALWAYS="ALWAYS"}(m||(m={})),function(e){e.URL="URL"}(h||(h={})),function(e){e.AND="AND",e.OR="OR"}(v||(v={})),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={}));var E=function(e,t){void 0===t&&(t=.5);var n=function(e){e=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(e,t,n,i){return t+t+n+n+i+i}));var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:{r:0,g:0,b:0}}(e),i=function(e,t,n){var i=[e,t,n].map((function(e){return(e/=255)<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}));return.2126*i[0]+.7152*i[1]+.0722*i[2]}(n.r,n.g,n.b);return i>t?"#0E0E0F":"#FFFFFF"},I={log:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.log.apply(console,e)},error:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.error.apply(console,e)},warn:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.warn.apply(console,e)},info:function(){}};I.log("Raw API_URL:","https://stage-api.robylon.ai");var T={copilotUrl:"https://staging.d2s3wsqyyond1h.amplifyapp.com",environment:"staging",apiUrl:"https://stage-api.robylon.ai"};I.log("CONFIG",T);var x,S,A=function(){return"undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement},C=function(){return{copilotUrl:T.copilotUrl||"https://app.robylon.ai",environment:T.environment||"production",apiUrl:T.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"}(S||(S={}));var O,R="system-ui, Inter, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'",D="21px",N="",k=[],L=!1,M=function(){return"undefined"==typeof window?"":window.location.href},z=function(){return M()},F=function(){var e=M();e!==N&&(N=e,k.forEach((function(t){return t(e)})))},H=function(e){return L||U(),k.push(e),e(M()),function(){var t=k.indexOf(e);t>-1&&k.splice(t,1)}},U=function(){if(!L&&"undefined"!=typeof window){L=!0,N=M();var e=function(e){var t=history[e];return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var i=t.apply(this,e);return setTimeout(F,0),i}};try{history.pushState=e("pushState"),history.replaceState=e("replaceState")}catch(e){}window.addEventListener("popstate",F),window.addEventListener("hashchange",F);var t=setInterval((function(){F()}),1e3);setInterval((function(){0===k.length&&(clearInterval(t),window.removeEventListener("popstate",F),window.removeEventListener("hashchange",F),L=!1)}),5e3)}},B=function(e,t,n,i){var o=t||"",r=M(),a=i||r,l=function(e,t){return-1!==t.indexOf(e)}(o,a);switch(n){case g.IS:return a===o;case g.IS_NOT:return a!==o;case g.CONTAINS:return l;case g.DOES_NOT_CONTAIN:return!l;case g.STARTS_WITH:return a.startsWith(o);case g.ENDS_WITH:return a.endsWith(o);default:return!1}},P=null,W=null,j=function(){P=z()},G=function(){return P===z()},X=function(e){W=y({input_id:null},e)},V=function(){var e=W;return W=null,e},Y=function(){return!0},K=((O={})[m.WORKING_HOURS]=function(e,t){var n=t.getHours(),i=t.getMinutes();return(n>10||10===n&&i>=0)&&(n<19||19===n&&0===i)},O[m.ALWAYS]=Y,O),J=function(e){if(!e||G())return[];var t=M(),n=new Date,i=[];return e.forEach((function(e){i.push.apply(i,function(e,t,n){var i=(null==e?void 0:e.send_time_type)||"",o=i?K[i]:Y;if(!o||!o(e,n))return[];for(var r=(null==e?void 0:e.content_multiple)||[],a=Math.max(0,1e3*Number((null==e?void 0:e.delay)||0)),l=[],s=0;s<r.length;s++){for(var c=r[s],d=(null==c?void 0:c.message_display_attributes)||[],u=null,p=v.OR,f=0,m=d;f<m.length;f++){var h=m[f];if(null==h?void 0:h.logical_condition)p=h.logical_condition;else{var g=h,y=B(null==g||g.type,(null==g?void 0:g.value)||"",null==g?void 0:g.condition,t);u=null===u?y:p===v.AND?u&&y:u||y}}(null===u||u)&&(null==c?void 0:c.message)&&l.push({messageId:(null==e?void 0:e.message_id)||String(s),contentIndex:s,html:String(c.message),delayMs:a})}return l}(e,t,n))})),i};
|
|
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:Q,getPrototypeOf:$,getOwnPropertyDescriptor:ee}=Object;let{freeze:te,seal:ne,create:ie}=Object,{apply:oe,construct:re}="undefined"!=typeof Reflect&&Reflect;te||(te=function(e){return e}),ne||(ne=function(e){return e}),oe||(oe=function(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return e.apply(t,i)}),re||(re=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return new e(...n)});const ae=we(Array.prototype.forEach),le=we(Array.prototype.lastIndexOf),se=we(Array.prototype.pop),ce=we(Array.prototype.push),de=we(Array.prototype.splice),ue=we(String.prototype.toLowerCase),pe=we(String.prototype.toString),fe=we(String.prototype.match),me=we(String.prototype.replace),he=we(String.prototype.indexOf),ve=we(String.prototype.trim),ge=we(Object.prototype.hasOwnProperty),ye=we(RegExp.prototype.test),be=(_e=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return re(_e,t)});var _e;function we(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return oe(e,t,i)}}function Ee(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ue;q&&q(e,null);let i=t.length;for(;i--;){let o=t[i];if("string"==typeof o){const e=n(o);e!==o&&(Q(t)||(t[i]=e),o=e)}e[o]=!0}return e}function Ie(e){for(let t=0;t<e.length;t++){ge(e,t)||(e[t]=null)}return e}function Te(e){const t=ie(null);for(const[n,i]of Z(e)){ge(e,n)&&(Array.isArray(i)?t[n]=Ie(i):i&&"object"==typeof i&&i.constructor===Object?t[n]=Te(i):t[n]=i)}return t}function xe(e,t){for(;null!==e;){const n=ee(e,t);if(n){if(n.get)return we(n.get);if("function"==typeof n.value)return we(n.value)}e=$(e)}return function(){return null}}const Se=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"]),Ae=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"]),Ce=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"]),Oe=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"]),De=te(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ne=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"]),Le=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"]),Me=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"]),ze=te(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Fe=ne(/\{\{[\w\W]*|[\w\W]*\}\}/gm),He=ne(/<%[\w\W]*|[\w\W]*%>/gm),Ue=ne(/\$\{[\w\W]*/gm),Pe=ne(/^data-[\-\w.\u00B7-\uFFFF]+$/),Be=ne(/^aria-[\-\w]+$/),We=ne(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),je=ne(/^(?:\w+script|data):/i),Ge=ne(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Xe=ne(/^html$/i),Ve=ne(/^[a-z][.\w]*(-[.\w]+)+$/i);var Ye=Object.freeze({__proto__:null,ARIA_ATTR:Be,ATTR_WHITESPACE:Ge,CUSTOM_ELEMENT:Ve,DATA_ATTR:Pe,DOCTYPE_NAME:Xe,ERB_EXPR:He,IS_ALLOWED_URI:We,IS_SCRIPT_OR_DATA:je,MUSTACHE_EXPR:Fe,TMPLIT_EXPR:Ue});const Ke=1,Je=3,Ze=7,qe=8,Qe=9,$e=function(){return"undefined"==typeof window?null:window};var et=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:$e();const n=t=>e(t);if(n.version="3.3.0",n.removed=[],!t||!t.document||t.document.nodeType!==Qe||!t.Element)return n.isSupported=!1,n;let{document:i}=t;const o=i,r=o.currentScript,{DocumentFragment:a,HTMLTemplateElement:l,Node:s,Element:c,NodeFilter:d,NamedNodeMap:u=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:p,DOMParser:f,trustedTypes:m}=t,h=c.prototype,v=xe(h,"cloneNode"),g=xe(h,"remove"),y=xe(h,"nextSibling"),b=xe(h,"childNodes"),_=xe(h,"parentNode");if("function"==typeof l){const e=i.createElement("template");e.content&&e.content.ownerDocument&&(i=e.content.ownerDocument)}let w,E="";const{implementation:I,createNodeIterator:T,createDocumentFragment:x,getElementsByTagName:S}=i,{importNode:A}=o;let C={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof Z&&"function"==typeof _&&I&&void 0!==I.createHTMLDocument;const{MUSTACHE_EXPR:O,ERB_EXPR:R,TMPLIT_EXPR:D,DATA_ATTR:N,ARIA_ATTR:k,IS_SCRIPT_OR_DATA:L,ATTR_WHITESPACE:M,CUSTOM_ELEMENT:z}=Ye;let{IS_ALLOWED_URI:F}=Ye,H=null;const U=Ee({},[...Se,...Ae,...Ce,...Re,...Ne]);let P=null;const B=Ee({},[...ke,...Le,...Me,...ze]);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,G=null;const X=Object.seal(ie(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let V=!0,Y=!0,K=!1,J=!0,q=!1,Q=!0,$=!1,ee=!1,ne=!1,oe=!1,re=!1,_e=!1,we=!0,Ie=!1,Fe=!0,He=!1,Ue={},Pe=null;const Be=Ee({},["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 je=null;const Ge=Ee({},["audio","video","img","source","image","track"]);let Ve=null;const et=Ee({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),tt="http://www.w3.org/1998/Math/MathML",nt="http://www.w3.org/2000/svg",it="http://www.w3.org/1999/xhtml";let ot=it,rt=!1,at=null;const lt=Ee({},[tt,nt,it],pe);let st=Ee({},["mi","mo","mn","ms","mtext"]),ct=Ee({},["annotation-xml"]);const dt=Ee({},["title","style","font","a","script"]);let ut=null;const pt=["application/xhtml+xml","text/html"];let ft=null,mt=null;const ht=i.createElement("form"),vt=function(e){return e instanceof RegExp||e instanceof Function},gt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!mt||mt!==e){if(e&&"object"==typeof e||(e={}),e=Te(e),ut=-1===pt.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,ft="application/xhtml+xml"===ut?pe:ue,H=ge(e,"ALLOWED_TAGS")?Ee({},e.ALLOWED_TAGS,ft):U,P=ge(e,"ALLOWED_ATTR")?Ee({},e.ALLOWED_ATTR,ft):B,at=ge(e,"ALLOWED_NAMESPACES")?Ee({},e.ALLOWED_NAMESPACES,pe):lt,Ve=ge(e,"ADD_URI_SAFE_ATTR")?Ee(Te(et),e.ADD_URI_SAFE_ATTR,ft):et,je=ge(e,"ADD_DATA_URI_TAGS")?Ee(Te(Ge),e.ADD_DATA_URI_TAGS,ft):Ge,Pe=ge(e,"FORBID_CONTENTS")?Ee({},e.FORBID_CONTENTS,ft):Be,j=ge(e,"FORBID_TAGS")?Ee({},e.FORBID_TAGS,ft):Te({}),G=ge(e,"FORBID_ATTR")?Ee({},e.FORBID_ATTR,ft):Te({}),Ue=!!ge(e,"USE_PROFILES")&&e.USE_PROFILES,V=!1!==e.ALLOW_ARIA_ATTR,Y=!1!==e.ALLOW_DATA_ATTR,K=e.ALLOW_UNKNOWN_PROTOCOLS||!1,J=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,q=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,_e=e.RETURN_TRUSTED_TYPE||!1,ne=e.FORCE_BODY||!1,we=!1!==e.SANITIZE_DOM,Ie=e.SANITIZE_NAMED_PROPS||!1,Fe=!1!==e.KEEP_CONTENT,He=e.IN_PLACE||!1,F=e.ALLOWED_URI_REGEXP||We,ot=e.NAMESPACE||it,st=e.MATHML_TEXT_INTEGRATION_POINTS||st,ct=e.HTML_INTEGRATION_POINTS||ct,W=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&vt(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(W.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&vt(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),q&&(Y=!1),re&&(oe=!0),Ue&&(H=Ee({},Ne),P=[],!0===Ue.html&&(Ee(H,Se),Ee(P,ke)),!0===Ue.svg&&(Ee(H,Ae),Ee(P,Le),Ee(P,ze)),!0===Ue.svgFilters&&(Ee(H,Ce),Ee(P,Le),Ee(P,ze)),!0===Ue.mathMl&&(Ee(H,Re),Ee(P,Me),Ee(P,ze))),e.ADD_TAGS&&("function"==typeof e.ADD_TAGS?X.tagCheck=e.ADD_TAGS:(H===U&&(H=Te(H)),Ee(H,e.ADD_TAGS,ft))),e.ADD_ATTR&&("function"==typeof e.ADD_ATTR?X.attributeCheck=e.ADD_ATTR:(P===B&&(P=Te(P)),Ee(P,e.ADD_ATTR,ft))),e.ADD_URI_SAFE_ATTR&&Ee(Ve,e.ADD_URI_SAFE_ATTR,ft),e.FORBID_CONTENTS&&(Pe===Be&&(Pe=Te(Pe)),Ee(Pe,e.FORBID_CONTENTS,ft)),Fe&&(H["#text"]=!0),$&&Ee(H,["html","head","body"]),H.table&&(Ee(H,["tbody"]),delete j.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw be('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw be('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');w=e.TRUSTED_TYPES_POLICY,E=w.createHTML("")}else void 0===w&&(w=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(n=t.getAttribute(i));const o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}}(m,r)),null!==w&&"string"==typeof E&&(E=w.createHTML(""));te&&te(e),mt=e}},yt=Ee({},[...Ae,...Ce,...Oe]),bt=Ee({},[...Re,...De]),_t=function(e){ce(n.removed,{element:e});try{_(e).removeChild(e)}catch(t){g(e)}},wt=function(e,t){try{ce(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){ce(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(oe||re)try{_t(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Et=function(e){let t=null,n=null;if(ne)e="<remove></remove>"+e;else{const t=fe(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===ut&&ot===it&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const o=w?w.createHTML(e):e;if(ot===it)try{t=(new f).parseFromString(o,ut)}catch(e){}if(!t||!t.documentElement){t=I.createDocument(ot,"template",null);try{t.documentElement.innerHTML=rt?E:o}catch(e){}}const r=t.body||t.documentElement;return e&&n&&r.insertBefore(i.createTextNode(n),r.childNodes[0]||null),ot===it?S.call(t,$?"html":"body")[0]:$?t.documentElement:r},It=function(e){return T.call(e.ownerDocument||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},Tt=function(e){return e instanceof p&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof u)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},xt=function(e){return"function"==typeof s&&e instanceof s};function St(e,t,i){ae(e,(e=>{e.call(n,t,i,mt)}))}const At=function(e){let t=null;if(St(C.beforeSanitizeElements,e,null),Tt(e))return _t(e),!0;const i=ft(e.nodeName);if(St(C.uponSanitizeElement,e,{tagName:i,allowedTags:H}),Q&&e.hasChildNodes()&&!xt(e.firstElementChild)&&ye(/<[/\w!]/g,e.innerHTML)&&ye(/<[/\w!]/g,e.textContent))return _t(e),!0;if(e.nodeType===Ze)return _t(e),!0;if(Q&&e.nodeType===qe&&ye(/<[/\w]/g,e.data))return _t(e),!0;if(!(X.tagCheck instanceof Function&&X.tagCheck(i))&&(!H[i]||j[i])){if(!j[i]&&Ot(i)){if(W.tagNameCheck instanceof RegExp&&ye(W.tagNameCheck,i))return!1;if(W.tagNameCheck instanceof Function&&W.tagNameCheck(i))return!1}if(Fe&&!Pe[i]){const t=_(e)||e.parentNode,n=b(e)||e.childNodes;if(n&&t){for(let i=n.length-1;i>=0;--i){const o=v(n[i],!0);o.__removalCount=(e.__removalCount||0)+1,t.insertBefore(o,y(e))}}}return _t(e),!0}return e instanceof c&&!function(e){let t=_(e);t&&t.tagName||(t={namespaceURI:ot,tagName:"template"});const n=ue(e.tagName),i=ue(t.tagName);return!!at[e.namespaceURI]&&(e.namespaceURI===nt?t.namespaceURI===it?"svg"===n:t.namespaceURI===tt?"svg"===n&&("annotation-xml"===i||st[i]):Boolean(yt[n]):e.namespaceURI===tt?t.namespaceURI===it?"math"===n:t.namespaceURI===nt?"math"===n&&ct[i]:Boolean(bt[n]):e.namespaceURI===it?!(t.namespaceURI===nt&&!ct[i])&&!(t.namespaceURI===tt&&!st[i])&&!bt[n]&&(dt[n]||!yt[n]):!("application/xhtml+xml"!==ut||!at[e.namespaceURI]))}(e)?(_t(e),!0):"noscript"!==i&&"noembed"!==i&&"noframes"!==i||!ye(/<\/no(script|embed|frames)/i,e.innerHTML)?(q&&e.nodeType===Je&&(t=e.textContent,ae([O,R,D],(e=>{t=me(t,e," ")})),e.textContent!==t&&(ce(n.removed,{element:e.cloneNode()}),e.textContent=t)),St(C.afterSanitizeElements,e,null),!1):(_t(e),!0)},Ct=function(e,t,n){if(we&&("id"===t||"name"===t)&&(n in i||n in ht))return!1;if(Y&&!G[t]&&ye(N,t));else if(V&&ye(k,t));else if(X.attributeCheck instanceof Function&&X.attributeCheck(t,e));else if(!P[t]||G[t]){if(!(Ot(e)&&(W.tagNameCheck instanceof RegExp&&ye(W.tagNameCheck,e)||W.tagNameCheck instanceof Function&&W.tagNameCheck(e))&&(W.attributeNameCheck instanceof RegExp&&ye(W.attributeNameCheck,t)||W.attributeNameCheck instanceof Function&&W.attributeNameCheck(t,e))||"is"===t&&W.allowCustomizedBuiltInElements&&(W.tagNameCheck instanceof RegExp&&ye(W.tagNameCheck,n)||W.tagNameCheck instanceof Function&&W.tagNameCheck(n))))return!1}else if(Ve[t]);else if(ye(F,me(n,M,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==he(n,"data:")||!je[e]){if(K&&!ye(L,me(n,M,"")));else if(n)return!1}else;return!0},Ot=function(e){return"annotation-xml"!==e&&fe(e,z)},Rt=function(e){St(C.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||Tt(e))return;const i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:P,forceKeepAttr:void 0};let o=t.length;for(;o--;){const r=t[o],{name:a,namespaceURI:l,value:s}=r,c=ft(a),d=s;let u="value"===a?d:ve(d);if(i.attrName=c,i.attrValue=u,i.keepAttr=!0,i.forceKeepAttr=void 0,St(C.uponSanitizeAttribute,e,i),u=i.attrValue,!Ie||"id"!==c&&"name"!==c||(wt(a,e),u="user-content-"+u),Q&&ye(/((--!?|])>)|<\/(style|title|textarea)/i,u)){wt(a,e);continue}if("attributename"===c&&fe(u,"href")){wt(a,e);continue}if(i.forceKeepAttr)continue;if(!i.keepAttr){wt(a,e);continue}if(!J&&ye(/\/>/i,u)){wt(a,e);continue}q&&ae([O,R,D],(e=>{u=me(u,e," ")}));const p=ft(e.nodeName);if(Ct(p,c,u)){if(w&&"object"==typeof m&&"function"==typeof m.getAttributeType)if(l);else switch(m.getAttributeType(p,c)){case"TrustedHTML":u=w.createHTML(u);break;case"TrustedScriptURL":u=w.createScriptURL(u)}if(u!==d)try{l?e.setAttributeNS(l,a,u):e.setAttribute(a,u),Tt(e)?_t(e):se(n.removed)}catch(t){wt(a,e)}}else wt(a,e)}St(C.afterSanitizeAttributes,e,null)},Dt=function e(t){let n=null;const i=It(t);for(St(C.beforeSanitizeShadowDOM,t,null);n=i.nextNode();)St(C.uponSanitizeShadowNode,n,null),At(n),Rt(n),n.content instanceof a&&e(n.content);St(C.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=null,r=null,l=null,c=null;if(rt=!e,rt&&(e="\x3c!--\x3e"),"string"!=typeof e&&!xt(e)){if("function"!=typeof e.toString)throw be("toString is not a function");if("string"!=typeof(e=e.toString()))throw be("dirty is not a string, aborting")}if(!n.isSupported)return e;if(ee||gt(t),n.removed=[],"string"==typeof e&&(He=!1),He){if(e.nodeName){const t=ft(e.nodeName);if(!H[t]||j[t])throw be("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof s)i=Et("\x3c!----\x3e"),r=i.ownerDocument.importNode(e,!0),r.nodeType===Ke&&"BODY"===r.nodeName||"HTML"===r.nodeName?i=r:i.appendChild(r);else{if(!oe&&!q&&!$&&-1===e.indexOf("<"))return w&&_e?w.createHTML(e):e;if(i=Et(e),!i)return oe?null:_e?E:""}i&&ne&&_t(i.firstChild);const d=It(He?e:i);for(;l=d.nextNode();)At(l),Rt(l),l.content instanceof a&&Dt(l.content);if(He)return e;if(oe){if(re)for(c=x.call(i.ownerDocument);i.firstChild;)c.appendChild(i.firstChild);else c=i;return(P.shadowroot||P.shadowrootmode)&&(c=A.call(o,c,!0)),c}let u=$?i.outerHTML:i.innerHTML;return $&&H["!doctype"]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&ye(Xe,i.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+i.ownerDocument.doctype.name+">\n"+u),q&&ae([O,R,D],(e=>{u=me(u,e," ")})),w&&_e?w.createHTML(u):u},n.setConfig=function(){gt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),ee=!0},n.clearConfig=function(){mt=null,ee=!1},n.isValidAttribute=function(e,t,n){mt||gt({});const i=ft(e),o=ft(t);return Ct(i,o,n)},n.addHook=function(e,t){"function"==typeof t&&ce(C[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=le(C[e],t);return-1===n?void 0:de(C[e],n,1)[0]}return se(C[e])},n.removeHooks=function(e){C[e]=[]},n.removeAllHooks=function(){C={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}(),tt=function(e){return e?et.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 nt(e){if(!e||"string"!=typeof e||0===e.trim().length)return"ltr";var t=e.replace(/<[^>]*>/g,"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_`#]/g,"").trim();if(0===t.length)return"ltr";for(var n=/[\u0590-\u05FF\u0600-\u06FF\u0700-\u074F\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]/,i=0,o=0,r=0,a=t;r<a.length;r++){var l=a[r];/\s|\d|[.,;:!?()[\]{}'"`\-_=+*/\\|@#$%^&*~]/.test(l)||(o++,n.test(l)&&i++)}return 0===o?"ltr":i/o>.3?"rtl":"ltr"}var it,ot=t((function(t){var r,a,l,s,c,d,u,p,m,h,v,g,b,_,T,S,A,O=t.config,N=t.toggleIframe,k=t.isIframeVisible,L=t.onEvent,M=t.onInternalEvent,z=t.position,F=t.sideSpacing,U=t.bottomSpacing,P=t.launcher_type,B=t.launcher_properties_text,W=t.shouldFadeIn,V=t.launcher_size,Y=n(null),K=C().copilotUrl,Z=i(!1),q=Z[0],Q=Z[1],$=i(!1),ee=$[0],te=$[1],ne=i([]),ie=ne[0],oe=ne[1],re=i(!1),ae=re[0],le=re[1],se=n([]),ce=n(),de=null!=V?V:48;o((function(){var e=function(){var e=(null===window||void 0===window?void 0:window.innerWidth)<560;Q(e)};return e(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[]),o((function(){Y.current&&requestAnimationFrame((function(){null==L||L({type:x.CHATBOT_BUTTON_LOADED,timestamp:Date.now()}),M(x.CHATBOT_BUTTON_LOADED)}))}),[L,M]),o((function(){if(Y.current&&W){Y.current.style.opacity="0";var e=requestAnimationFrame((function(){Y.current&&(Y.current.style.opacity="1")}));return function(){return cancelAnimationFrame(e)}}}),[W]);var ue=z||(null===(l=O.interface_properties)||void 0===l?void 0:l.position)||"Right",pe=null!==(c=null!=F?F:null===(s=O.interface_properties)||void 0===s?void 0:s.side_spacing)&&void 0!==c?c:20,fe=null!==(u=null!=U?U:null===(d=O.interface_properties)||void 0===d?void 0:d.bottom_spacing)&&void 0!==u?u:20,me=P||(null==O?void 0:O.launcher_type)||f.IMAGE,he=B||(null===(p=null==O?void 0:O.launcher_properties)||void 0===p?void 0:p.text),ve={zIndex:1e3,display:"flex",flexDirection:"column-reverse",alignItems:"center",justifyContent:"center",cursor:"pointer",overflow:"hidden",marginTop:"16px",boxSizing:"border-box"};me===f.IMAGE&&(ve.width="".concat(de,"px"),ve.height="".concat(de,"px"),ve.borderRadius="50%",ve.backgroundColor=O.brand_colour);var ge=y(y({},ve),((r={position:void 0,bottom:"0",borderRadius:me===f.IMAGE?"50%":"9999px"})[ue.toLowerCase()]="0",r)),ye=y(y({},ve),((a={position:"fixed",bottom:"".concat(fe,"px"),borderRadius:me===f.IMAGE?"50%":"9999px"})[ue.toLowerCase()]="".concat(pe,"px"),a)),be=q?ye:ge;o((function(){I.log("Screen width changed, isMobile:",q,"Style:",be)}),[q,be]),I.log("config in floating button",O);o((function(){var e=function(){se.current.forEach((function(e){return clearTimeout(e)})),se.current=[]},t=function(){(e(),oe([]),(null==O?void 0:O.proactive_message_obj)&&!G())&&J(null==O?void 0:O.proactive_message_obj).forEach((function(e){var t=window.setTimeout((function(){oe((function(t){return t.some((function(t){return t.id===e.messageId&&t.index===e.contentIndex}))?t:w([{id:e.messageId,index:e.contentIndex,html:e.html}],t,!0)}))}),e.delayMs);se.current.push(t)}))};return ce.current=H((function(){te(!1),t()})),t(),function(){var t;e(),null===(t=ce.current)||void 0===t||t.call(ce)}}),[null==O?void 0:O.proactive_message_obj]);var _e=ie.length>0&&!k&&!ee,we="Right"===(z||(null===(m=O.interface_properties)||void 0===m?void 0:m.position)||"Right"),Ee=function(){le(!0),setTimeout((function(){te(!0),j(),le(!1)}),400)};return e.createElement(e.Fragment,null,e.createElement("style",null,"\n @keyframes slideInFromRight {\n 0% {\n transform: translateX(120%) scale(0.95);\n opacity: 0;\n }\n 85% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n 92% {\n transform: translateX(-1px) scale(1.002);\n }\n 100% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n }\n @keyframes slideInFromLeft {\n 0% {\n transform: translateX(-120%) scale(0.95);\n opacity: 0;\n }\n 85% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n 92% {\n transform: translateX(1px) scale(1.002);\n }\n 100% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n }\n @keyframes slideOutRight {\n 0% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n 100% {\n transform: translateX(120%) scale(0.9);\n opacity: 0;\n }\n }\n @keyframes slideOutLeft {\n 0% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n 100% {\n transform: translateX(-120%) scale(0.9);\n opacity: 0;\n }\n }\n .proactive-bubble-enter-right {\n animation: slideInFromRight 1.2s cubic-bezier(0.5, 0.8, 0.3, 1.1) forwards;\n }\n .proactive-bubble-enter-left {\n animation: slideInFromLeft 1.2s cubic-bezier(0.5, 0.8, 0.3, 1.1) forwards;\n }\n .proactive-bubble-exit-right {\n animation: slideOutRight 0.4s ease-in forwards;\n }\n .proactive-bubble-exit-left {\n animation: slideOutLeft 0.4s ease-in forwards;\n }\n .proactive-close-enter-right {\n animation: slideInFromRight 1.2s cubic-bezier(0.5, 0.8, 0.3, 1.1) forwards;\n }\n .proactive-close-enter-left {\n animation: slideInFromLeft 1.2s cubic-bezier(0.5, 0.8, 0.3, 1.1) forwards;\n }\n /* Reset styles for proactive message content to prevent website CSS interference */\n /* Only target children of the content wrapper, not the bubble container itself */\n .proactive-message-content * {\n box-sizing: border-box !important;\n margin: 0 !important;\n padding: 0 !important;\n border: none !important;\n background: transparent;\n font-family: ".concat(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 ')),_e?e.createElement("div",{className:"proactive-message-container",style:{position:"fixed",bottom:"".concat((null!==(v=null!=U?U:null===(h=O.interface_properties)||void 0===h?void 0:h.bottom_spacing)&&void 0!==v?v:20)+(me===f.IMAGE?de:40)+8,"px"),right:we?"".concat(null!==(b=null!=F?F:null===(g=O.interface_properties)||void 0===g?void 0:g.side_spacing)&&void 0!==b?b:20,"px"):"auto",left:we?"auto":"".concat(null!==(T=null!=F?F:null===(_=O.interface_properties)||void 0===_?void 0:_.side_spacing)&&void 0!==T?T:20,"px"),maxWidth:"22.875rem",zIndex:2147483646}},e.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:we?"flex-end":"flex-start"},className:"proactive-message-bubble-container"},ie.map((function(t,n){var i=10*(ie.length-1-n);return e.createElement("div",{key:"".concat(t.id,"-").concat(t.index,"-").concat(n),onClick:function(){X({message_id:t.id,content_string:t.html||null}),N(),Ee();try{window.dispatchEvent(new CustomEvent("rblyn:proactiveClick",{detail:{message_id:t.id,content_string:t.html||null}}))}catch(e){}},className:ae?we?"proactive-bubble-exit-right":"proactive-bubble-exit-left":we?"proactive-bubble-enter-right":"proactive-bubble-enter-left",style:y({background:"#fff",color:"#111",borderRadius:"12px",boxShadow:"0 2px 2px 0 rgba(0, 0, 0, 0.08)",padding:"16px",cursor:"pointer",fontFamily:R,lineHeight:D,fontSize:"14px",marginBottom:n<ie.length-1?16:0,border:"1px solid #F1F2F4",width:"fit-content",maxWidth:"100%",animationDelay:ae?"0ms":"".concat(i,"ms")},ae?{opacity:0}:{opacity:0,transform:we?"translateX(120%) scale(0.95)":"translateX(-120%) scale(0.95)"})},e.createElement("div",{className:"proactive-message-content",dir:nt(t.html),dangerouslySetInnerHTML:{__html:tt(t.html)}}))}))),e.createElement("div",{onClick:function(e){e.stopPropagation(),Ee()},className:ae?"":we?"proactive-close-enter-right":"proactive-close-enter-left",style:y({position:"absolute",top:"-32px",right:"Right"===(z||(null===(S=O.interface_properties)||void 0===S?void 0:S.position)||"Right")?"0px":"auto",left:"Left"===(z||(null===(A=O.interface_properties)||void 0===A?void 0:A.position)||"Right")?"0px":"auto",width:"24px",height:"24px",borderRadius:"50%",background:"#fff",boxShadow:" 0 2.667px 2.667px 0 rgba(0, 0, 0, 0.25)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",userSelect:"none",animationDelay:ae?"0ms":"".concat(10*(ie.length-1),"ms")},ae?{}:{opacity:0,transform:we?"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:Y,className:"message-bubble-container",style:y(y({},be),{transition:"transform 0.2s cubic-bezier(0.2, 1.27, 0.29, 0.97), opacity 280ms ease",transform:k?"scale(0.85)":"scale(1)",opacity:W?0:1}),onClick:function(){N(),Ee()}},function(){switch(me){case f.TEXT:return e.createElement("div",{style:{width:"fit-content",maxWidth:"160px",height:"40px",borderRadius:"9999px",backgroundColor:O.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:D}},e.createElement("div",{style:{flex:1,minWidth:0}},e.createElement("p",{dir:nt(he),style:{margin:0,color:E(O.brand_colour),fontSize:"0.875rem",fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:R,lineHeight:D,WebkitFontSmoothing:"antialiased",textRendering:"optimizeLegibility",textSizeAdjust:"100%"}},he)));case f.TEXTUAL_IMAGE:return function(){var t,n;return e.createElement("div",{style:{maxWidth:"13rem",width:"fit-content",height:"40px",borderRadius:"9999px",backgroundColor:O.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:D}},e.createElement("div",{style:{flex:1,minWidth:0}},e.createElement("p",{dir:nt(he),style:{margin:0,color:E(O.brand_colour),fontSize:"0.875rem",fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:R,lineHeight:D,WebkitFontSmoothing:"antialiased",textRendering:"optimizeLegibility",textSizeAdjust:"100%"}},he)),e.createElement("div",{style:{width:"40px",height:"40px",borderRadius:"9999px",overflow:"hidden",position:"relative",flexShrink:0}},e.createElement("img",{src:(null==O?void 0:O.launcher_type)?(null===(n=null===(t=null==O?void 0:O.images)||void 0===t?void 0:t.launcher_image_url)||void 0===n?void 0:n.url)||"".concat(K,"/chatbubble.png"):(null==O?void 0:O.image_url)||"".concat(K,"/chatbubble.png"),alt:"Chat",style:{width:"100%",height:"100%",objectFit:"cover"}})))}();case f.IMAGE:default:return function(){var t,n;if(k){var i=Math.round(.5*de);return e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%"}},e.createElement("svg",{width:i,height:i,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"}))))}return e.createElement("img",{src:(null==O?void 0:O.launcher_type)?(null===(n=null===(t=null==O?void 0:O.images)||void 0===t?void 0:t.launcher_image_url)||void 0===n?void 0:n.url)||"".concat(K,"/chatbubble.png"):(null==O?void 0:O.image_url)||"".concat(K,"/chatbubble.png"),alt:"Chat",style:{zIndex:1e3,cursor:"pointer",borderRadius:"50%",objectFit:"cover",width:"100%",height:"100%",boxSizing:"border-box"}})}()}}()))})),rt=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]},at=function(){var e;if(null===(e=navigator.userAgentData)||void 0===e?void 0:e.brands)for(var t=["Chrome","Firefox","Safari","Edge","Opera"],n=0,i=navigator.userAgentData.brands;n<i.length;n++){var o=i[n];if(t.includes(o.brand))return o.brand}return(/Chrome|Firefox|Safari|Edge|Opera/.exec(navigator.userAgent)||["Unknown"])[0]},lt=function(){var e,t,n,i;return{width:(null===window||void 0===window?void 0:window.innerWidth)||(null===(e=null===document||void 0===document?void 0:document.documentElement)||void 0===e?void 0:e.clientWidth)||(null===(t=null===document||void 0===document?void 0:document.body)||void 0===t?void 0:t.clientWidth),height:(null===window||void 0===window?void 0:window.innerHeight)||(null===(n=null===document||void 0===document?void 0:document.documentElement)||void 0===n?void 0:n.clientHeight)||(null===(i=null===document||void 0===document?void 0:document.body)||void 0===i?void 0:i.clientHeight)}},st=function(){return{platform:"web",os:rt(),browser:at(),sdk_version:"1.1.49-staging.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:lt()};var e};!function(e){e.ERROR="ERROR",e.INFO="INFO"}(it||(it={}));var ct,dt=["@robylon/web-react-sdk","node_modules/@robylon/web-react-sdk/"],ut=function(e){var t=e.filename,n=e.stack,i=e.message;return!!(t||n||i)&&dt.some((function(e){return(null==t?void 0:t.includes(e))||(null==n?void 0:n.includes(e))||(null==i?void 0:i.includes(e))}))},pt=function(){function e(){var e=this;this.apiKey="",this.userId=null,this.preInitQueue=[],this.isInitialized=!1,this.handleWindowError=function(t){var n,i={filename:t.filename,stack:null===(n=t.error)||void 0===n?void 0:n.stack,message:t.message};ut(i)&&e.trackError(t.error||t.message,"GlobalErrorHandler",{filename:t.filename,lineNo:t.lineno,colNo:t.colno})},this.handleUnhandledRejection=function(t){var n,i,o={stack:null===(n=t.reason)||void 0===n?void 0:n.stack,message:(null===(i=t.reason)||void 0===i?void 0:i.message)||String(t.reason)};ut(o)&&e.trackError(t.reason||"Unhandled Promise Rejection","GlobalPromiseHandler",{reason:t.reason})},this.setupGlobalHandlers()}return e.prototype.setupGlobalHandlers=function(){A()&&(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(){A()&&(null===window||void 0===window||window.removeEventListener("error",null==this?void 0:this.handleWindowError),null===window||void 0===window||window.removeEventListener("unhandledrejection",this.handleUnhandledRejection))},e.getInstance=function(){return e.instance||(e.instance=new e),e.instance},e.prototype.initialize=function(e,t){void 0===t&&(t=null);try{if(this.preInitQueue.length>0){var n={org_id:"UNINITALIZED",event_data:{message:"SDK Initialization Failed: Required parameter 'api_key' is ".concat(void 0===e?"undefined":null===e?"null":""===e?"empty string":"invalid: ".concat(e)),componentName:"ErrorTrackingService",additionalInfo:{preInitError:!0,apiKey:e,userId:t,timestamp:Date.now()},timestamp:Date.now()},metadata:st(),event_type:it.ERROR,user_id:t};this.sendLog(n).catch(console.error)}this.apiKey=e,this.userId=t,this.isInitialized=!0,this.processPreInitQueue()}catch(n){I.error("Error during ErrorTrackingService initialization:",n),this.preInitQueue.push({error:n instanceof Error?n:new Error(String(n)),componentName:"ErrorTrackingService",additionalInfo:{apiKey:e,userId:t}})}},e.prototype.processPreInitQueue=function(){return b(this,void 0,void 0,(function(){var e,t,n;return _(this,(function(i){switch(i.label){case 0:if(!this.preInitQueue.length)return[2];I.info("Processing ".concat(this.preInitQueue.length," pre-initialization errors")),e=0,t=this.preInitQueue,i.label=1;case 1:return e<t.length?(n=t[e],[4,this.trackError(n.error,n.componentName,y(y({},n.additionalInfo),{preInitError:!0}))]):[3,4];case 2:i.sent(),i.label=3;case 3:return e++,[3,1];case 4:return this.preInitQueue=[],[2]}}))}))},e.prototype.sendLog=function(e){return b(this,void 0,void 0,(function(){var t,n,i,o,r,a;return _(this,(function(l){switch(l.label){case 0:return l.trys.push([0,4,,5]),t=C().apiUrl,[4,fetch("".concat(t,"/users/sdk/record-logs/"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})];case 1:return(n=l.sent()).ok?[3,3]:(o=(i=I).error,r=["Failed to send error log:"],[4,n.text()]);case 2:o.apply(i,r.concat([l.sent()])),l.label=3;case 3:return[3,5];case 4:return a=l.sent(),I.error("Error sending log:",a),[3,5];case 5:return[2]}}))}))},e.prototype.trackError=function(e,t,n){return b(this,void 0,void 0,(function(){var i,o,r;return _(this,(function(a){switch(a.label){case 0:if(this.isInitialized)return[3,5];i={org_id:"UNINITALIZED",event_data:{message:e instanceof Error?e.message:e,stack:e instanceof Error?e.stack:void 0,componentName:t,additionalInfo:y(y({},n),{preInitError:!0,timestamp:Date.now()}),timestamp:Date.now()},metadata:st(),event_type:it.ERROR,user_id:this.userId},a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.sendLog(i)];case 2:return a.sent(),[3,4];case 3:return a.sent(),this.preInitQueue.push({error:e,componentName:t,additionalInfo:n}),I.warn("Error tracked before initialization, queuing:",e),[3,4];case 4:return[2];case 5:return o={message:e instanceof Error?e.message:e,stack:e instanceof Error?e.stack:void 0,componentName:t,additionalInfo:y(y({},n),{timestamp:Date.now()}),timestamp:Date.now()},r={org_id:this.apiKey||"UNINITALIZED",event_data:o,metadata:st(),event_type:it.ERROR,user_id:this.userId},[4,this.sendLog(r)];case 6:return a.sent(),[2]}}))}))},e.prototype.trackInfo=function(e,t,n){return b(this,void 0,void 0,(function(){var i,o;return _(this,(function(r){switch(r.label){case 0:return this.apiKey?(i={message:e,componentName:t,additionalInfo:n,timestamp:Date.now()},o={org_id:this.apiKey,event_data:i,metadata:st(),event_type:it.INFO,user_id:this.userId},[4,this.sendLog(o)]):(I.error("Error tracking not initialized"),[2]);case 1:return r.sent(),[2]}}))}))},e}(),ft=pt.getInstance(),mt="MISSING_API_KEY",ht="INVALID_API_KEY",vt="CONFIG_FETCH_FAILED",gt="SDK_INIT_FAILED",yt="ERROR_TRACKING_INIT_FAILED",bt="API_REQUEST_FAILED",_t="NETWORK_ERROR",wt="INVALID_RESPONSE",Et="IFRAME_LOAD_FAILED",It="COOKIE_ACCESS_ERROR",Tt="COMPONENT_RENDER_ERROR",xt="INITIALIZATION_ERROR",St="API_ERROR",At="RUNTIME_ERROR",Ct="COMPONENT_ERROR",Ot=((ct={})[mt]=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.")},ct[ht]=function(e){return"SDK Initialization Failed: Provided API key '".concat(e,"' is invalid. API key must be a non-empty string in UUID format.")},ct[vt]=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):"")},ct[bt]=function(e,t,n){return"API Request Failed: Server responded with status ".concat(e," for ").concat(n?"endpoint ".concat(n):"request"," - ").concat(t)},ct[_t]=function(e){return"Network Error: Failed to communicate with server".concat(e.url?" at ".concat(e.url):"").concat(e.error?" - ".concat(e.error):"")},ct[Et]=function(e){return"Failed to load chatbot interface".concat(e.src?" from ".concat(e.src):"").concat(e.error?". Error: ".concat(e.error):"")},ct[wt]=function(e){return"Invalid API Response: Missing required fields in response data: ".concat(e.join(", "))},ct[yt]=function(e){return"Error Tracking Service initialization failed".concat(e.apiKey?" for API key ".concat(e.apiKey):"").concat(e.error?". Error: ".concat(e.error):"")},ct[gt]=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)):"")},ct[It]=function(e,t){return"Cookie Access Error: Failed to ".concat(e).concat(t?" cookie '".concat(t,"'"):" cookies",". This may affect user session persistence.")},ct[Tt]=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):"")},ct),Rt=function(){var e,t=navigator.userAgent;if(null===(e=navigator.userAgentData)||void 0===e?void 0:e.brands){var n=navigator.userAgentData.brands.find((function(e){return"Google Chrome"===e.brand}));if(null==n?void 0:n.version)return n.version}var i=t.match(/(Chrome|Firefox|Safari|Edge|Opera)\/(\d+\.\d+)/);return i?i[2]:"Unknown"},Dt=function(){var e,t,n=st();return{current_page_url:(null===(e=null===window||void 0===window?void 0:window.location)||void 0===e?void 0:e.href)||"",browser_language:(null===navigator||void 0===navigator?void 0:navigator.language)||(null===(t=null===navigator||void 0===navigator?void 0:navigator.languages)||void 0===t?void 0:t[0])||"en",browser_version:Rt(),os:null==n?void 0:n.os,referral_url:(null===document||void 0===document?void 0:document.referrer)||"",system_info:n}},Nt=t((function(t){var i,a,l,s,c=t.config,d=t.isVisible,u=t.onClose,p=t.onEvent,f=t.onInternalEvent,m=t.position,h=t.bottomSpacing,v=t.overrides,g=n(null),b=n(!1),_=n(!1),w=m||(null===(i=c.interface_properties)||void 0===i?void 0:i.position)||"Right",E=null!==(l=null!=h?h:null===(a=c.interface_properties)||void 0===a?void 0:a.bottom_spacing)&&void 0!==l?l:20,I=r((function(){var e,t=g.current;if(t){var n=((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(E,"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)"})[w.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(t.style,n)}}),[E,w]);return o((function(){var e=g.current;if(e&&!b.current){var t=C().copilotUrl;Object.assign(e.style,{zIndex:"20000000",border:"none",boxShadow:"0px 0px 40px 0px rgba(14, 14, 15, 0.24)",transformOrigin:"bottom ".concat(w.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(t,"/chatbot-plugin?id=").concat(c.chatbotId),b.current=!0,I();var n=function(){var n,i,o,r,a,l,s,c,d,u,p,f=new URL(e.src).origin||t;if(null===(n=e.contentWindow)||void 0===n||n.postMessage({domain:null===(i=null===window||void 0===window?void 0:window.location)||void 0===i?void 0:i.hostname,name:"checkDomain"},f),v){var m={header_avatar:null!==(o=null==v?void 0:v.header_avatar)&&void 0!==o?o:null,agent_avatar:null!==(r=null==v?void 0:v.agent_avatar)&&void 0!==r?r:null,header_title:null!==(a=null==v?void 0:v.header_title)&&void 0!==a?a:null,header_subtitle:null!==(l=null==v?void 0:v.header_subtitle)&&void 0!==l?l:null,header_title_text_color:null!==(s=null==v?void 0:v.header_title_text_color)&&void 0!==s?s:null,header_subtitle_text_color:null!==(c=null==v?void 0:v.header_subtitle_text_color)&&void 0!==c?c:null,header_bg:null!==(d=null==v?void 0:v.header_bg)&&void 0!==d?d:null};null===(u=e.contentWindow)||void 0===u||u.postMessage({domain:null===(p=null===window||void 0===window?void 0:window.location)||void 0===p?void 0:p.hostname,action:"updateOverrides",data:m},t)}};return e.addEventListener("load",n),function(){return e.removeEventListener("load",n)}}}),[c.chatbotId,null===(s=c.interface_properties)||void 0===s?void 0:s.position,I,v]),o((function(){var e,t,n,i,o,r,a=g.current;if(a&&b.current){var l=(null===(e=c.interface_properties)||void 0===e?void 0:e.position)||"Right";if(d?(Object.assign(a.style,{transform:"scale(0.3) translate3d(0,40px,0)",opacity:"0",display:"block"}),a.getBoundingClientRect(),setTimeout((function(){Object.assign(a.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)):(a.style.transition="none",a.getBoundingClientRect(),Object.assign(a.style,{opacity:"0",transform:"scale(0.3) translate3d(".concat((l.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&&a&&(a.style.display="none")}),200)),a.contentWindow&&d){var s=C().copilotUrl;if(null===(t=null==a?void 0:a.contentWindow)||void 0===t||t.postMessage({domain:null===(n=null===window||void 0===window?void 0:window.location)||void 0===n?void 0:n.hostname,name:"openFrame"},s),!(null==_?void 0:_.current)){var u=V();null===(i=a.contentWindow)||void 0===i||i.postMessage({domain:null===(o=null===window||void 0===window?void 0:window.location)||void 0===o?void 0:o.hostname,action:"registerUserId",data:y({userId:null==c?void 0:c.userId,token:null==c?void 0:c.token,userProfile:y(y({},null==c?void 0:c.userProfile),{__INT_SYS_INFO__:y(y({},(null===(r=null==c?void 0:c.userProfile)||void 0===r?void 0:r.__INT_SYS_INFO__)||{}),Dt())}),isAnonymous:null==c?void 0:c.isAnonymous},u?{proactiveData:u}:{})},s),_.current=!0}}}}),[d,c.userId,c.token,c.userProfile]),o((function(){var e=function(e){var t,n;if(_.current&&g.current){var i=(null==e?void 0:e.detail)||{},o=C().copilotUrl;null===(t=g.current.contentWindow)||void 0===t||t.postMessage({domain:null===(n=null===window||void 0===window?void 0:window.location)||void 0===n?void 0:n.hostname,action:"proactiveClick",data:{userId:null==c?void 0:c.userId,token:null==c?void 0:c.token,userProfile:null==c?void 0:c.userProfile,isAnonymous:null==c?void 0:c.isAnonymous,proactiveData:{input_id:null,message_id:(null==i?void 0:i.message_id)||null,content_string:(null==i?void 0:i.content_string)||null}}},o)}};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]),o((function(){if(g.current&&b.current){var e=C().copilotUrl;d&&(null==p||p({type:x.CHATBOT_OPENED,timestamp:Date.now()}),f(x.CHATBOT_OPENED));var t=function(t){var n,i,o,r,a,l,s;if(t.origin===e){if("closeChatbot"===t.data)return void u();if("CHATBOT_TOKEN_EXHAUSTED"===(null===(n=t.data)||void 0===n?void 0:n.type))return void f(S.CHATBOT_TOKEN_EXHAUSTED);"CHATBOT_LOADED"===(null===(i=t.data)||void 0===i?void 0:i.type)&&(null==p||p({type:x.CHATBOT_LOADED,timestamp:Date.now()}),f(x.CHATBOT_LOADED)),"CHAT_INITIALIZED"===(null===(o=t.data)||void 0===o?void 0:o.type)&&(null==p||p({type:x.CHAT_INITIALIZED,timestamp:Date.now()}),f(x.CHAT_INITIALIZED)),"CHAT_INITIALIZATION_FAILED"===(null===(r=t.data)||void 0===r?void 0:r.type)&&(null==p||p({type:x.CHAT_INITIALIZATION_FAILED,timestamp:Date.now()}),f(x.CHAT_INITIALIZATION_FAILED,{error:null===(a=t.data)||void 0===a?void 0:a.error})),"SESSION_REFRESHED"===(null===(l=t.data)||void 0===l?void 0:l.type)&&(null==p||p({type:x.SESSION_REFRESHED,timestamp:Date.now()}),f(x.SESSION_REFRESHED)),"CHAT_MOVED"===(null===(s=t.data)||void 0===s?void 0:s.type)&&f(S.CHAT_MOVED,{from:t.data.from,to:t.data.to,trigger:t.data.trigger})}};return null===window||void 0===window||window.addEventListener("message",t),function(){return null===window||void 0===window?void 0:window.removeEventListener("message",t)}}}),[u,p,f,c.chatbotId,d]),o((function(){var e=g.current;if(e&&b.current){var t=function(){ft.trackError(new Error(Ot[Et]({src:e.src,error:"Failed to load iframe"})),"ChatbotIframe",{errorCode:Et,errorType:At,context:{config:c,iframeUrl:e.src,timestamp:Date.now()}})};return e.addEventListener("error",t),function(){return e.removeEventListener("error",t)}}}),[c]),o((function(){var e;if(g.current&&c&&d){var t=g.current,n=C().copilotUrl;null===(e=t.contentWindow)||void 0===e||e.postMessage({action:"updateUserProfile",user_profile:c.userProfile},n)}}),[c.userProfile,d]),e.createElement("iframe",{allow:"microphone",ref:g,id:"chat-iframe-rbyln",style:{display:"none"}})})),kt=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={hasError:!1},t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}d(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.getDerivedStateFromError=function(e){return{hasError:!0}},t.prototype.componentDidCatch=function(e,t){ft.trackError(new Error(Ot[Tt]({component:this.props.componentName||void 0,error:e.message,stack:t.componentStack})),this.props.componentName||void 0,{errorCode:Tt,errorType:Ct,context:{originalError:e,componentStack:t.componentStack,timestamp:Date.now()}})},t.prototype.render=function(){return this.state.hasError?null:this.props.children},t}(a),Lt=function(e,t,n){return b(void 0,void 0,void 0,(function(){var i,o,r,a,l,s,c,d;return _(this,(function(u){switch(u.label){case 0:i=C().apiUrl,o="".concat(i,"/chat/chatbot/get/"),I.log("endpointUrl",o),r={client_user_id:t,org_id:e,token:n||void 0,extra_info:{},launcher_info:Dt()},u.label=1;case 1:return u.trys.push([1,6,,7]),[4,fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})];case 2:return(a=u.sent()).ok?[3,4]:[4,a.text()];case 3:throw l=u.sent(),new Error(Ot[bt](a.status,l));case 4:return[4,a.json()];case 5:s=u.sent();try{String(r.org_id||"")}catch(e){}if(!(null===(d=null==s?void 0:s.user)||void 0===d?void 0:d.org_info))throw new Error(Ot[wt](["user","org_info"]));return[2,s];case 6:throw c=u.sent(),ft.trackError(c instanceof Error?c:new Error(Ot[_t]({error:String(c)})),"fetchChatbotConfig",{errorCode:c instanceof Error&&c.message.includes("API Request Failed")?bt:_t,errorType:St,context:{chatbotId:e,userId:t,apiUrl:i,statusCode:c instanceof Response?c.status:void 0,timestamp:Date.now(),requestPayload:{client_user_id:t,org_id:e}}}),c;case 7:return[2]}}))}))},Mt=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},zt=function(e){var t,n="; ".concat(document.cookie).split("; ".concat(e,"="));if(2===n.length)return null===(t=n.pop())||void 0===t?void 0:t.split(";").shift()},Ft=function(e,t,n){var i=new Date;i.setTime(i.getTime()+24*n*60*60*1e3),document.cookie="".concat(e,"=").concat(t,";expires=").concat(i.toUTCString(),";path=/")},Ht=function(e){var t=e?"USER_DATA=%7B%22attributes%22%3A%5B%7B%22key%22%3A%22USER_ATTRIBUTE_USER_EMAIL%22%2C%22value%22%3A%22dinesh.goel%40robylon.ai%22%7D%2C%7B%22key%22%3A%22USER_ATTRIBUTE_UNIQUE_ID%22%2C%22value%22%3A%2266011f2c28d1787d13c6c796%22%7D%5D%2C%22subscribedToOldSdk%22%3Afalse%2C%22deviceUuid%22%3A%2226c02feb-2664-451d-8469-9cf1378547c6%22%2C%22deviceAdded%22%3Atrue%7D; _ga_3YS9P6ZDWX=GS1.1.1715252584.3.1.1715258696.39.0.0; _ga_V4J24F7YF9=GS1.1.1715273274.2.0.1715273274.0.0.0; city_name=Bengaluru; lang_code=en-in; cookieConcent=A; _gcl_au=1.1.343275043.1717154298; _clck=43guwd%7C2%7Cfmi%7C0%7C1561; _gid=GA1.2.1423066649.1718210058; moe_uuid=26c02feb-2664-451d-8469-9cf1378547c6; _ga_6RM65PWEZY=GS1.1.1718210058.18.1.1718211647.60.0.0; _ga=GA1.1.689213983.1712737672; AMP_MKTG_fe4beb374f=JTdCJTIycmVmZXJyZXIlMjIlM0ElMjJodHRwcyUzQSUyRiUyRmFjY291bnRzLnRlYWNobWludC5jb20lMkYlMjIlMkMlMjJyZWZlcnJpbmdfZG9tYWluJTIyJTNBJTIyYWNjb3VudHMudGVhY2htaW50LmNvbSUyMiU3RA==; AMP_fe4beb374f=JTdCJTIyZGV2aWNlSWQlMjIlM0ElMjI0MWMxMTljZC03YzVjLTRiYTctYTUzZS1mYTgzMjRlYjc0OWUlMjIlMkMlMjJ1c2VySWQlMjIlM0ElMjIxZjI2ODAwOC01OGYxLTQwYTItYjQ0Ni1mYmQ5N2E0NDQyYTAlMjIlMkMlMjJzZXNzaW9uSWQlMjIlM0ExNzE4MjEzMzEwOTc3JTJDJTIyb3B0T3V0JTIyJTNBZmFsc2UlMkMlMjJsYXN0RXZlbnRUaW1lJTIyJTNBMTcxODIxMzMxMDk4MSUyQyUyMmxhc3RFdmVudElkJTIyJTNBMTQlN0Q=; _ga_3YS9P6ZDWX=GS1.1.1718211637.26.1.1718213441.60.0.0; SESSION=%7B%22sessionKey%22%3A%22e4d76f52-9053-4277-99a4-f1ba667fd5f2%22%2C%22sessionStartTime%22%3A%222024-06-12T16%3A34%3A19.047Z%22%2C%22sessionMaxTime%22%3A1800%2C%22customIdentifiersToTrack%22%3A%5B%5D%2C%22sessionExpiryTime%22%3A1718215247464%2C%22numberOfSessions%22%3A17%7D":document.cookie;return t=t.split(";").map((function(e){var t=e.split("="),n=t[0],i=t.slice(1).join("=").trim();return{name:n=n.trim(),value:i?decodeURIComponent(i):""}})),t},Ut=function(){function e(e){this.logoContainer=null,this.iframe=null,this.bubblePromptContainer=null,this.chatBtnImage=null,this.config=e,this.validateDomain()&&this.init(),null===window||void 0===window||window.addEventListener("message",this.onCloseListener.bind(this),!1)}return e.prototype.onCloseListener=function(e){e.origin===this.config.domain&&"closeChatbot"===e.data&&this.closeIframe()},e.prototype.validateDomain=function(){var e,t=this.config.domain,n=null===(e=null===window||void 0===window?void 0:window.location)||void 0===e?void 0:e.origin;return I.log("expectedDomain, to current domain",t,n,t===n),t===n},e.prototype.createChatBubblContainer=function(){var e,t=this,n=document.createElement("div");n.id="chatbase-message-bubbles",Object.assign(n.style,{position:"fixed",bottom:"80px",borderRadius:"10px",fontFamily:"sans-serif",fontSize:"16px",zIndex:"2147483644",cursor:"pointer",flexDirection:"column",gap:"50px",maxWidth:"70vw",display:"block",right:"1rem",left:"unset"});var i=document.createElement("div");i.classList.add("close-btn"),i.textContent="✕",Object.assign(i.style,{position:"absolute",top:"-7px",right:"-7px",fontWeight:"bold",display:"none",justifyContent:"center",alignItems:"center",zIndex:"2147483643",width:"22px",height:"22px",borderRadius:"50%",textAlign:"center",fontSize:"12px",cursor:"pointer",backgroundColor:"rgb(224, 224, 224)",color:"black",boxShadow:"rgba(150, 150, 150, 0.15) 0px 6px 24px 0px, rgba(150, 150, 150, 0.15) 0px 0px 0px 1px"}),((null===(e=this.config.chat_interface_config)||void 0===e?void 0:e.chat_bubble_prompts)||[]).forEach((function(e){var i=t.createMessageBubble(e);n.appendChild(i)})),n.appendChild(i),document.body.appendChild(n)},e.prototype.createMessageBubble=function(e){var t=document.createElement("div");this.bubblePromptContainer=t,Object.assign(t.style,{display:"flex",position:"relative",justifyContent:"flex-end"});var n=document.createElement("div");n.classList.add("message"),n.textContent=e,Object.assign(n.style,{backgroundColor:"white",color:"black",boxShadow:"rgba(150, 150, 150, 0.2) 0px 10px 30px 0px, rgba(150, 150, 150, 0.2) 0px 0px 0px 1px",borderRadius:"10px",padding:"8px 5px",margin:"8px",fontSize:"14px",opacity:"1",transform:"scale(1)",transition:"opacity 0.5s ease 0s, transform 0.5s ease 0s"});var i=document.createElement("button");return i.innerHTML="×",Object.assign(i.style,{position:"absolute",top:"1px",left:"-3px",width:"20px",height:"20px",borderRadius:"50%",backgroundColor:"#fff",color:"#000",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 2px 5px rgba(0,0,0,0.2)",fontSize:"14px",lineHeight:"1",padding:"0",zIndex:"100"}),i.addEventListener("click",(function(){t.remove()})),t.appendChild(i),t.appendChild(n),t},e.prototype.createFloatingButton=function(){var e=document.createElement("div");e.classList.add("message-bubble-container"),Object.assign(e.style,{position:"fixed",bottom:"1.5rem",right:"1.5rem",zIndex:"1000",width:"48px",height:"48px",display:"flex",flexDirection:"column-reverse",backgroundColor:this.config.brand_colour,color:E(this.config.brand_colour),borderRadius:"50%",alignItems:"center",justifyContent:"center",cursor:"pointer",overflow:"hidden"}),document.body.appendChild(e),this.logoContainer=e,this.loadImage(this.logoContainer),this.createChatBubblContainer(),this.logoContainer.addEventListener("click",this.toggleIframe.bind(this))},e.prototype.loadImage=function(e){var t,n,i=document.createElement("img");i.src=this.config.launcher_type?(null===(n=null===(t=this.config.images)||void 0===t?void 0:t.launcher_image_url)||void 0===n?void 0:n.url)||"".concat(this.config.domain,"/chatbubble.png"):this.config.image_url||"".concat(this.config.domain,"/chatbubble.png"),i.alt="Chat",Object.assign(i.style,{zIndex:"1000",cursor:"pointer",borderRadius:"50%",objectFit:"cover"}),this.chatBtnImage=i,e.innerHTML="",e.appendChild(i)},e.prototype.createIframe=function(){var e=this;I.log("RobylonConfig?.domain====>",this.config.domain);var t=document.createElement("iframe");Object.assign(t.style,{position:"fixed",right:"32px",bottom:"86px",minWidth:"400px",width:"26%",maxWidth:"800px",top:"calc(10vh - 32px)",maxHeight:"45rem",height:"calc(100vh - 3rem - 10vh)",zIndex:"20000000",border:"none",boxShadow:"0px 0px 40px 0px rgba(14, 14, 15, 0.24)",transformOrigin:"bottom right",transition:"transform 0.3s ease-out",borderRadius:"1rem",display:"none"}),t.src="".concat(this.config.domain,"/chatbot-plugin?id=").concat(this.config.chatbotId),I.log("iframe.src====>",t.src),document.body.appendChild(t),this.iframe=t;var n=function(){(null===window||void 0===window?void 0:window.innerWidth)<560?Object.assign(t.style,{width:"100vw",minWidth:"300px",right:"0",bottom:"0",height:"100vh",flexDirection:"column",flexGrow:"1",borderRadius:"0",top:"0",maxHeight:"100%"}):Object.assign(t.style,{width:"26%",minWidth:"400px",right:"32px",bottom:"86px",height:"calc(100vh - 3rem - 10vh)",borderRadius:"1rem",top:"calc(10vh - 32px)",maxHeight:"45rem"})};n(),null===window||void 0===window||window.addEventListener("resize",n),t.addEventListener("load",(function(){var n,i,o,r,a;if(e.iframe){var l=new URL(e.iframe.src).origin||e.config.domain;null===(n=t.contentWindow)||void 0===n||n.postMessage({domain:null===(i=null===window||void 0===window?void 0:window.location)||void 0===i?void 0:i.hostname,name:"checkDomain"},l),null===(o=t.contentWindow)||void 0===o||o.postMessage({domain:null===(r=null===window||void 0===window?void 0:window.location)||void 0===r?void 0:r.hostname,action:"registerUserId",data:{userId:e.config.userId,token:e.config.token,userProfile:y(y({},e.config.userProfile||{}),{__INT_SYS_INFO__:y(y({},(null===(a=e.config.userProfile)||void 0===a?void 0:a.__INT_SYS_INFO__)||{}),Dt())})}},l)}})),null===window||void 0===window||window.addEventListener("message",(function(n){var i,o;if(n.origin===e.config.domain){if("captureSessionData"===n.data){var r="66b33d16-5b38-4693-8772-1a1bd7dd412d"===e.config.chatbotId,a={cookies:Ht(r),localStorage:JSON.stringify(localStorage),sessionStorage:JSON.stringify(sessionStorage),action:"capturedSessionData",domain_name:null===(i=null===window||void 0===window?void 0:window.location)||void 0===i?void 0:i.hostname};null===(o=t.contentWindow)||void 0===o||o.postMessage(a,e.config.domain||"*")}"expand"===n.data&&(e.adjustIframeWidth(),t.style.height="calc(100vh - 120px)",t.style.bottom="86px"),"collapse"===n.data&&Object.assign(t.style,{width:"26%",height:"calc(100vh - 32px - 10vh)",bottom:"86px",top:"calc(32px + 10vh)"})}}))},e.prototype.adjustIframeWidth=function(){if(this.iframe){var e=null===window||void 0===window?void 0:window.innerWidth;I.log("screenWidth",e),this.iframe.style.width=e<832?"".concat(e-64,"px"):"800px"}},e.prototype.loadSvgInline=function(e){var t=document.createElement("div");t.innerHTML='\n<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <g id="Chevron_Down">\n <path id="Vector" d="M19 9L12 16L5 9" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>\n </g>\n</svg>\n';var n=t.querySelector("svg");e.innerHTML="",n&&e.appendChild(n)},e.prototype.toggleIcon=function(e,t){"block"===t.style.display?this.loadSvgInline(e):this.loadImage(e)},e.prototype.toggleIframe=function(){var e;if(I.log("toggleIframe",this.iframe,this.logoContainer,this.chatBtnImage),this.iframe&&this.logoContainer&&this.chatBtnImage){var t=new URL(this.iframe.src).origin||this.config.domain;I.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"},t),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"),I.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(),this.createFloatingButton()},e}(),Pt=function(e,t,n){if(e.chatbotId&&e.userId)try{new Ut(e);t(!0),I.log("Robylon SDK initialized successfully.")}catch(e){n(e instanceof Error?e.message:"Failed to initialize SDK")}else n("Incomplete configuration for SDK initialization.")},Bt=function(e,t,n){return b(void 0,void 0,void 0,(function(){var i,o,r,a,l,s,c,d;return _(this,(function(u){switch(u.label){case 0:return u.trys.push([0,5,,6]),i=C().apiUrl,o="".concat(i,"/chat/chatbot/get/"),I.log("endpointUrl",o),r={client_user_id:t||null,org_id:e,token:n||void 0,extra_info:{},launcher_info:Dt()},[4,fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})];case 1:return(a=u.sent()).ok?[3,3]:[4,a.text()];case 2:throw l=u.sent(),new Error(Ot[bt](a.status,l));case 3:return[4,a.json()];case 4:if(s=u.sent(),!(null===(d=null==s?void 0:s.user)||void 0===d?void 0:d.org_info))throw new Error(Ot[wt](["user","org_info"]));return[2,s];case 5:throw c=u.sent(),ft.trackError(c instanceof Error?c:new Error(Ot[_t]({error:String(c)})),"fetchChatbotConfig",{errorCode:c instanceof Error&&c.message.includes("API Request Failed")?bt:_t,errorType:St,context:{apiKey:e,userId:t,timestamp:Date.now()}}),c;case 6:return[2]}}))}))},Wt=function(e){return b(void 0,void 0,void 0,(function(){var t,n,i,o,r,a,l,s,c,d,m,h,v,g,b,w,E,T,x,S,A,C,O,R,D,N,k,L,M,z,F,H,U,P;return _(this,(function(_){switch(_.label){case 0:return t=function(e){return{api_key:String(e.api_key||""),user_id:e.user_id?String(e.user_id):null,user_token:e.user_token?String(e.user_token):void 0,user_profile:e.user_profile||{}}}(e),n=t.user_id||void 0,i=!1,n||(n=zt("rblyn_anon")||Mt(),Ft("rblyn_anon",n,365),i=!0),[4,Bt(t.api_key,n,t.user_token)];case 1:o=_.sent();try{t.api_key}catch(e){I.warn("Failed to inject mock proactive messages",e)}return r=st(),a=Dt(),B=t.user_profile,l=B?Object.fromEntries(Object.entries(B).map((function(e){var t=e[0],n=e[1];return"boolean"==typeof n||"number"==typeof n?[t,n]:[t,String(n)]}))):{},s=y(y(y({},r),{__INT_SYS_INFO__:y(y({},r),a)}),l),[2,{chatbotId:t.api_key,userId:n,token:t.user_token,isAnonymous:i,domain:"",show_launcher:null===(d=null===(c=o.user.org_info)||void 0===c?void 0:c.show_launcher)||void 0===d||d,brand_colour:(null===(h=null===(m=o.user.org_info.brand_config)||void 0===m?void 0:m.colors)||void 0===h?void 0:h.brand_color)||"",image_url:(null===(g=null===(v=o.user.org_info)||void 0===v?void 0:v.brand_config)||void 0===g?void 0:g.launcher_logo_url)||"",userProfile:s,chat_interface_config:{chat_bubble_prompts:[],display_name:(null===(b=o.user.org_info.brand_config)||void 0===b?void 0:b.display_name)||"",welcome_message:(null===(w=o.user.org_info.brand_config)||void 0===w?void 0:w.welcome_message)||"Hey! What can we help you with today?",redirect_url:(null===(E=o.user.org_info.brand_config)||void 0===E?void 0:E.redirect_url)||""},launcher_type:(null===(T=o.user.org_info.brand_config)||void 0===T?void 0:T.launcher_type)||f.IMAGE,launcher_properties:{text:(null===(S=null===(x=o.user.org_info.brand_config)||void 0===x?void 0:x.launcher_properties)||void 0===S?void 0:S.text)||""},images:{launcher_image_url:{url:(null===(O=null===(C=null===(A=o.user.org_info.brand_config)||void 0===A?void 0:A.images)||void 0===C?void 0:C.launcher_image_url)||void 0===O?void 0:O.url)||""}},proactive_message_obj:jt(null===(N=null===(D=null===(R=null==o?void 0:o.user)||void 0===R?void 0:R.org_info)||void 0===D?void 0:D.brand_config)||void 0===N?void 0:N.proactive_message_obj),interface_properties:{position:(null===(L=null===(k=o.user.org_info.brand_config)||void 0===k?void 0:k.interface_properties)||void 0===L?void 0:L.position)||p.RIGHT,side_spacing:(null===(z=null===(M=o.user.org_info.brand_config)||void 0===M?void 0:M.interface_properties)||void 0===z?void 0:z.side_spacing)||20,bottom_spacing:(null===(H=null===(F=o.user.org_info.brand_config)||void 0===F?void 0:F.interface_properties)||void 0===H?void 0:H.bottom_spacing)||20},interface_type:(null===(U=o.user.org_info.brand_config)||void 0===U?void 0:U.interface_type)||u.WIDGET,launcher_delay:(null===(P=o.user.org_info.brand_config)||void 0===P?void 0:P.launcher_delay)||{enabled:!1,delay:0}}]}var B}))}))},jt=function(e){if(e){var t=(Array.isArray(e)?e:[e]).filter(Boolean).map((function(e){var t,n,i={message_id:String(null!==(t=null==e?void 0:e.message_id)&&void 0!==t?t:""),org_id:String(null!==(n=null==e?void 0:e.org_id)&&void 0!==n?n:""),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,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)&&I.warn("[Robylon SDK] proactive_message.content is deprecated; use content_multiple[].message instead."),i}));return t.length?t:void 0}},Gt=function(e){var t=l((function(){return function(e){return{api_key:String(e.api_key||""),user_id:e.user_id?String(e.user_id):null,user_token:e.user_token?String(e.user_token):void 0,user_profile:e.user_profile||{}}}(e)}),[e.api_key,e.user_id,e.user_token,JSON.stringify(e.user_profile)]),n=i({isInitialized:!1,isInitializing:!1,error:null,chatbotConfig:null,isIframeVisible:!1}),a=n[0],s=n[1],c=l((function(){return t.user_profile?Object.fromEntries(Object.entries(t.user_profile).map((function(e){var t=e[0],n=e[1];return"boolean"==typeof n||"number"==typeof n?[t,n]:[t,String(n)]}))):{}}),[JSON.stringify(t.user_profile)]),d=r((function(e){s((function(t){return y(y({},t),e)}))}),[]),m=r((function(){return b(void 0,void 0,void 0,(function(){var e,n,i,o,r,a,l,s,m,h,v,g,b,w,E,I,T,x,S,A,C,O,R,D,N,k,L,M,z,F,H,U,P,B,W,j,G,X;return _(this,(function(_){switch(_.label){case 0:if(!t.api_key)return ft.trackError(new Error(Ot[mt](t.api_key)),"useChatbotState",{errorCode:mt,errorType:xt,context:{timestamp:Date.now()}}),[2];d({isInitializing:!0}),_.label=1;case 1:return _.trys.push([1,4,5,6]),e=t.user_id||void 0,n=!1,e||(e=zt("rblyn_anon")||Mt(),Ft("rblyn_anon",e,365),n=!0),[4,Lt(t.api_key,e,t.user_token)];case 2:return i=_.sent(),o=st(),r=Dt(),a=y(y(y({},o),{__INT_SYS_INFO__:y(y({},o),r)}),c),l={chatbotId:t.api_key,userId:e,token:t.user_token,isAnonymous:n,domain:"",show_launcher:null===(v=null===(h=i.user.org_info)||void 0===h?void 0:h.show_launcher)||void 0===v||v,brand_colour:(null===(b=null===(g=i.user.org_info.brand_config)||void 0===g?void 0:g.colors)||void 0===b?void 0:b.brand_color)||"",image_url:(null===(E=null===(w=i.user.org_info)||void 0===w?void 0:w.brand_config)||void 0===E?void 0:E.launcher_logo_url)||"",userProfile:a,chat_interface_config:{chat_bubble_prompts:[],display_name:(null===(I=i.user.org_info.brand_config)||void 0===I?void 0:I.display_name)||"",welcome_message:(null===(T=i.user.org_info.brand_config)||void 0===T?void 0:T.welcome_message)||"Hey! What can we help you with today?",redirect_url:(null===(x=i.user.org_info.brand_config)||void 0===x?void 0:x.redirect_url)||""},interface_properties:{position:(null===(A=null===(S=i.user.org_info.brand_config)||void 0===S?void 0:S.interface_properties)||void 0===A?void 0:A.position)||p.RIGHT,side_spacing:null!==(R=null===(O=null===(C=i.user.org_info.brand_config)||void 0===C?void 0:C.interface_properties)||void 0===O?void 0:O.side_spacing)&&void 0!==R?R:20,bottom_spacing:null!==(k=null===(N=null===(D=i.user.org_info.brand_config)||void 0===D?void 0:D.interface_properties)||void 0===N?void 0:N.bottom_spacing)&&void 0!==k?k:20},interface_type:(null===(L=i.user.org_info.brand_config)||void 0===L?void 0:L.interface_type)||u.WIDGET,launcher_type:(null===(M=i.user.org_info.brand_config)||void 0===M?void 0:M.launcher_type)||f.IMAGE,launcher_properties:{text:(null===(F=null===(z=i.user.org_info.brand_config)||void 0===z?void 0:z.launcher_properties)||void 0===F?void 0:F.text)||""},images:{launcher_image_url:{url:(null===(P=null===(U=null===(H=i.user.org_info.brand_config)||void 0===H?void 0:H.images)||void 0===U?void 0:U.launcher_image_url)||void 0===P?void 0:P.url)||""}},proactive_message_obj:jt(null===(j=null===(W=null===(B=null==i?void 0:i.user)||void 0===B?void 0:B.org_info)||void 0===W?void 0:W.brand_config)||void 0===j?void 0:j.proactive_message_obj),launcher_delay:(null===(X=null===(G=i.user.org_info)||void 0===G?void 0:G.brand_config)||void 0===X?void 0:X.launcher_delay)||{enabled:!1,delay:0}},[4,new Promise((function(e,t){Pt(l,(function(){d({isInitialized:!0,chatbotConfig:l}),e()}),(function(e){t(e)}))}))];case 3:return _.sent(),[3,6];case 4:return s=_.sent(),m=s instanceof Error?s.message:"Failed to initialize chatbot",d({error:m}),ft.trackError(s instanceof Error?s:new Error(m),"useChatbotState",{errorCode:gt,errorType:xt,context:{timestamp:Date.now()}}),[3,6];case 5:return d({isInitializing:!1}),[7];case 6:return[2]}}))}))}),[t.api_key,t.user_id,t.user_token]);o((function(){t.api_key&&m()}),[m]),o((function(){a.chatbotConfig&&s((function(e){return y(y({},e),{chatbotConfig:y(y({},e.chatbotConfig),{userProfile:y(y({},st()),c)})})}))}),[c]);var h=r((function(){s((function(e){return y(y({},e),{isIframeVisible:!e.isIframeVisible})}))}),[]),v=r((function(){d({isIframeVisible:!1})}),[]);return y(y({},a),{toggleIframeVisibility:h,closeIframe:v})},Xt=function(t){var n,r,a,l,s,c,d,u=t.children,p=t.config,f=t.position,m=t.sideSpacing,h=t.bottomSpacing,v=i(!1),g=v[0],b=v[1];o((function(){var e=function(){var e=(null===window||void 0===window?void 0:window.innerWidth)<560;b(e)};return e(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[]);var _=f||(null===(a=p.interface_properties)||void 0===a?void 0:a.position)||"Right",w=null!==(s=null!=m?m:null===(l=p.interface_properties)||void 0===l?void 0:l.side_spacing)&&void 0!==s?s:20,E=null!==(d=null!=h?h:null===(c=p.interface_properties)||void 0===c?void 0:c.bottom_spacing)&&void 0!==d?d:20;I.log("config",p,_,w);var T={position:"fixed",zIndex:1e3,display:"flex",flexDirection:"column"},x=y(y({},T),((n={bottom:"".concat(E,"px")})[_.toLowerCase()]="".concat(null!=w?w:20,"px"),n.alignItems="Right"===_?"flex-end":"flex-start",n.top=void 0,n["Right"===_?"left":"right"]=void 0,n)),S=y(y({},T),((r={top:0})[_.toLowerCase()]="".concat(null!=w?w:20,"px"),r.alignItems="center",r.bottom=void 0,r["Right"===_?"left":"right"]=void 0,r)),A=g?S:x;return o((function(){console.log("Container screen width changed, isMobile:",g,"Style:",A)}),[g,A]),e.createElement("div",{className:"robylon-chatbot-container",style:A},u)},Vt=s((function(t,n){var a,s,d,u=t.api_key,p=t.user_id,f=t.user_token,m=t.user_profile,h=t.onEvent,v=t.position,g=t.sideSpacing,E=t.bottomSpacing,T=t.show_launcher,S=t.launcher_type,A=t.launcher_properties_text,O=t.overrides,R=t.launcher_size,D="string"==typeof g?""===g||isNaN(Number(g))?void 0:Number(g):g,N="string"==typeof E?""===E||isNaN(Number(E))?void 0:Number(E):E,k="string"==typeof v?"left"===v.toLowerCase()?"Left":"right"===v.toLowerCase()?"Right":void 0:v;o((function(){}));var L=l((function(){return{api_key:u,user_id:p,user_token:f,user_profile:m}}),[u,p,f,m]),M=r((function(e){null==h||h(e)}),[h]),z=Gt(L),F=z.isInitialized,H=z.error,U=z.chatbotConfig,P=z.isIframeVisible,B=z.toggleIframeVisibility,W=z.closeIframe,j=l((function(){return{api_key:u,user_profile:L.user_profile,onEvent:M,chatbotConfig:U?{isAnonymous:U.isAnonymous,userId:U.userId}:null}}),[u,L.user_profile,M,null==U?void 0:U.isAnonymous,null==U?void 0:U.userId]),G=function(e){var t=e.api_key,n=e.chatbotConfig,i=e.user_profile,o=e.onEvent,a=l((function(){return{isAnonymous:(null==n?void 0:n.isAnonymous)||!1,userId:(null==n?void 0:n.userId)||""}}),[null==n?void 0:n.isAnonymous,null==n?void 0:n.userId]),s=l((function(){return i||{}}),[JSON.stringify(i)]),c=r((function(e){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];return b(void 0,w([e],n,!0),void 0,(function(e,n){var i,o,r,l,c,d,u;return void 0===n&&(n={}),_(this,(function(p){switch(p.label){case 0:if(!t)return[2];p.label=1;case 1:return p.trys.push([1,3,,4]),i=C().apiUrl,o=st(),r=y({trigger_time:Date.now(),channel:"CHATBOT",launch_url:(null===(u=null===window||void 0===window?void 0:window.location)||void 0===u?void 0:u.href)||"",org_id:t,client_user_id:a.isAnonymous?"Anonymous":String(a.userId),event_type:e,user_profile:s},n),l={org_id:t,event_data:r,metadata:y({timestamp:Date.now()},o),event_type:"INFO",user_id:a.userId},[4,fetch("".concat(i,"/users/sdk/record-logs/"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)})];case 2:if(!(c=p.sent()).ok)throw new Error("Failed to send internal event: ".concat(c.statusText));return[3,4];case 3:return d=p.sent(),I.error("Failed to send internal event:",d),[3,4];case 4:return[2]}}))}))}),[t,a]);return{emitEvent:r((function(e,t){var n=Date.now();e!==x.CHATBOT_BUTTON_CLICKED&&e!==x.CHATBOT_CLOSED&&e!==x.CHATBOT_OPENED&&e!==x.CHATBOT_READY||(o&&o({type:e,timestamp:n,data:t}),c(e,{timestamp:n}))}),[o,c]),onInternalEvent:c}}(y({},j)),X=G.emitEvent,V=G.onInternalEvent;c(n,(function(){return{show:function(){F&&U?P||(B(),X(x.CHATBOT_BUTTON_CLICKED)):console.warn("Robylon Chatbot: Cannot show - chatbot not ready yet")},hide:function(){F&&U?P&&(W(),X(x.CHATBOT_CLOSED)):console.warn("Robylon Chatbot: Cannot hide - chatbot not ready yet")},toggle:function(){F&&U?(B(),X(P?x.CHATBOT_CLOSED:x.CHATBOT_BUTTON_CLICKED)):console.warn("Robylon Chatbot: Cannot toggle - chatbot not ready yet")},isReady:F&&!!U}}),[F,U,P,B,W,X]),o((function(){F&&U&&X(x.CHATBOT_READY)}),[F,U,X]);var Y=i(!1),K=Y[0],J=Y[1];o((function(){var e,t,n,i,o,r,a;if(!(void 0!==T?Boolean(T):null===(e=null==U?void 0:U.show_launcher)||void 0===e||e))return J(!1),function(){a&&clearTimeout(a)};var l=!0===(null===(t=null==U?void 0:U.launcher_delay)||void 0===t?void 0:t.enabled),s=null!==(r=null!==(i=null===(n=null==U?void 0:U.launcher_delay)||void 0===n?void 0:n.seconds)&&void 0!==i?i:null===(o=null==U?void 0:U.launcher_delay)||void 0===o?void 0:o.delay)&&void 0!==r?r:0;return l&&Number(s)>0?(J(!1),a=window.setTimeout((function(){J(!0)}),1e3*Number(s))):J(!0),function(){a&&clearTimeout(a)}}),[T,null==U?void 0:U.show_launcher,null===(a=null==U?void 0:U.launcher_delay)||void 0===a?void 0:a.enabled,null===(s=null==U?void 0:U.launcher_delay)||void 0===s?void 0:s.seconds,null===(d=null==U?void 0:U.launcher_delay)||void 0===d?void 0:d.delay]),o((function(){if(u)try{ft.initialize(u,p)}catch(e){ft.trackError(e instanceof Error?e:new Error(String(e)),"RobylonChatbot",{errorCode:yt,errorType:xt,context:{timestamp:Date.now()}})}else ft.trackError(new Error(Ot[mt](u)),"RobylonChatbot",{errorCode:mt,errorType:xt,context:{timestamp:Date.now()}})}),[u,p]);var Z=r((function(){W(),X(x.CHATBOT_CLOSED)}),[W,X]),q=r((function(){B(),X(P?x.CHATBOT_CLOSED:x.CHATBOT_BUTTON_CLICKED)}),[B,X,P]),Q=l((function(){var e,t,n,i,o;return{config:U,toggleIframe:q,isIframeVisible:P,onEvent:M,onInternalEvent:V,position:k,sideSpacing:D,bottomSpacing:N,launcher_type:S,launcher_properties_text:A,shouldFadeIn:!0===(null===(e=null==U?void 0:U.launcher_delay)||void 0===e?void 0:e.enabled)&&(null!==(o=null!==(n=null===(t=null==U?void 0:U.launcher_delay)||void 0===t?void 0:t.seconds)&&void 0!==n?n:null===(i=null==U?void 0:U.launcher_delay)||void 0===i?void 0:i.delay)&&void 0!==o?o:0)>0||!1,launcher_size:R}}),[U,q,P,M,V,k,D,N,S,A,R]);I.log("floatingButtonProps",Q);var $=l((function(){return{config:U,isVisible:P,onClose:Z,onEvent:M,onInternalEvent:V,position:k,bottomSpacing:N,overrides:O}}),[U,P,Z,M,V,k,N,O]);return u&&!H&&U?e.createElement(kt,{componentName:"RobylonChatbot"},F?e.createElement(Xt,{config:U,position:k,sideSpacing:D,bottomSpacing:N},e.createElement(kt,{componentName:"ChatbotIframe"},e.createElement(Nt,y({},$))),e.createElement(kt,{componentName:"ChatbotFloatingButton"},K?e.createElement(ot,y({},Q)):null)):null):null})),Yt=t(Vt,(function(e,t){return e.api_key===t.api_key&&e.user_id===t.user_id&&e.user_token===t.user_token&&JSON.stringify(e.user_profile)===JSON.stringify(t.user_profile)&&e.position===t.position&&e.sideSpacing===t.sideSpacing&&e.bottomSpacing===t.bottomSpacing&&e.show_launcher===t.show_launcher&&e.launcher_type===t.launcher_type&&e.launcher_properties_text===t.launcher_properties_text&&JSON.stringify(e.overrides)===JSON.stringify(t.overrides)&&e.launcher_size===t.launcher_size&&!0})),Kt=function(e){var t=i({isLoading:!0,isInitialized:!1,error:null}),n=t[0],r=t[1],a=function(e){r((function(t){return y(y({},t),{isInitialized:e})}))},l=function(e){r((function(t){return y(y({},t),{error:e})}))};return o((function(){!function(){try{Pt(e,a,l)}catch(e){r((function(t){return y(y({},t),{error:e instanceof Error?e.message:"Failed to initialize SDK",isLoading:!1})}))}}()}),[e.chatbotId,e.userId]),n},Jt=function(){function e(e){var t=this;this.resizeObserver=null,this.proactiveElement=null,this.urlUnsubscribe=null,this.delayTimers=[],this.config=e,this.buttonElement=document.createElement("div"),this.handleResizeFunction=this.handleResize.bind(this),this.render(),this.mount();try{this.buttonElement.style.opacity="0",this.buttonElement.style.transition="transform 0.2s cubic-bezier(0.2, 1.27, 0.29, 0.97), opacity 280ms ease",requestAnimationFrame((function(){t.buttonElement.style.opacity="1"}))}catch(e){}this.setupResizeListener(),this.renderProactiveIfNeeded(),this.urlUnsubscribe=H((function(){t.clearProactiveDelays(),t.renderProactiveIfNeeded(!0)}))}return e.prototype.render=function(){var e,t=this;C().copilotUrl;var n=this.config,i=n.config,o=n.isIframeVisible,r=null!==(e=this.config.launcher_size)&&void 0!==e?e:48,a={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:o?"scale(0.85)":"scale(1)",fontFamily:R};i.launcher_type===f.IMAGE&&Object.assign(a,{width:"".concat(r,"px"),height:"".concat(r,"px"),borderRadius:"50%",backgroundColor:i.brand_colour}),this.applyResponsiveStyles(a),this.buttonElement.className="message-bubble-container",this.buttonElement.innerHTML="",this.buttonElement.appendChild(this.createLauncherElement()),this.buttonElement.onclick=function(){t.config.toggleIframe(),t.hideProactiveMessages()},this.renderProactiveIfNeeded()},e.prototype.createLauncherElement=function(){var e,t,n,i=this.config,o=i.config,r=i.isIframeVisible,a=C().copilotUrl,l=null!==(e=this.config.launcher_size)&&void 0!==e?e:48;switch(console.log("config in floating button",o),o.launcher_type){case f.TEXT:return this.createTextLauncher();case f.TEXTUAL_IMAGE:return this.createTextualImageLauncher();case f.IMAGE:default:if(r){var s=Math.round(.5*l),c=document.createElement("div");Object.assign(c.style,{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%"});var d=document.createElementNS("http://www.w3.org/2000/svg","svg");d.setAttribute("width",String(s)),d.setAttribute("height",String(s)),d.setAttribute("viewBox","0 0 24 24"),d.setAttribute("fill","none"),d.setAttribute("xmlns","http://www.w3.org/2000/svg"),d.style.display="block";var u=document.createElementNS("http://www.w3.org/2000/svg","path");return u.setAttribute("d","M19 9L12 16L5 9"),u.setAttribute("stroke","currentColor"),u.setAttribute("stroke-width","1.5"),u.setAttribute("stroke-linecap","round"),u.setAttribute("stroke-linejoin","round"),d.appendChild(u),c.appendChild(d),c}var p=document.createElement("img");return p.src=o.launcher_type?(null===(n=null===(t=o.images)||void 0===t?void 0:t.launcher_image_url)||void 0===n?void 0:n.url)||"".concat(a,"/chatbubble.png"):o.image_url||"".concat(a,"/chatbubble.png"),p.alt="Chat",Object.assign(p.style,{zIndex:"1000",cursor:"pointer",borderRadius:"50%",objectFit:"cover",width:"100%",height:"100%",boxSizing:"border-box"}),p}},e.prototype.createTextLauncher=function(){var e=this.config.config,t=e.brand_colour,n=e.launcher_properties,i=document.createElement("div");Object.assign(i.style,{width:"fit-content",maxWidth:"160px",height:"40px",borderRadius:"9999px",backgroundColor:t,display:"flex",alignItems:"center",padding:"9px 20px",boxShadow:"0px 0px 16px 0px rgba(0, 0, 0, 0.24)",boxSizing:"border-box"});var o=document.createElement("div");Object.assign(o.style,{flex:"1",minWidth:"0"});var r=document.createElement("p");return Object.assign(r.style,{margin:"0",color:E(t),fontSize:"0.875rem",fontWeight:"600",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:D,fontFamily:R,WebkitFontSmoothing:"antialiased",textRendering:"optimizeLegibility",textSizeAdjust:"100%"}),r.textContent=(null==n?void 0:n.text)||"",o.appendChild(r),i.appendChild(o),i},e.prototype.createTextualImageLauncher=function(){var e,t,n,i,o,r,a=C().copilotUrl,l=this.config.config,s=l.brand_colour,c=l.launcher_properties,d=l.image_url,u=document.createElement("div");Object.assign(u.style,{maxWidth:"13rem",width:"fit-content",height:"40px",borderRadius:"9999px",backgroundColor:s,display:"flex",alignItems:"center",paddingLeft:"20px",paddingRight:"0",paddingTop:"9px",paddingBottom:"9px",boxShadow:"0px 0px 16px 0px rgba(0, 0, 0, 0.24)",gap:"8px",boxSizing:"border-box"});var p=document.createElement("div");Object.assign(p.style,{flex:"1",minWidth:"0"});var f=document.createElement("p");Object.assign(f.style,{margin:"0",color:E(s),fontSize:"0.875rem",fontWeight:"600",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:D,fontFamily:R,WebkitFontSmoothing:"antialiased",textRendering:"optimizeLegibility",textSizeAdjust:"100%"}),f.textContent=(null==c?void 0:c.text)||"";var m=document.createElement("div");Object.assign(m.style,{width:"40px",height:"40px",borderRadius:"9999px",overflow:"hidden",position:"relative",flexShrink:"0"});var h=document.createElement("img");return h.src=(null===(t=null===(e=null==this?void 0:this.config)||void 0===e?void 0:e.config)||void 0===t?void 0:t.launcher_type)?(null===(r=null===(o=null===(i=null===(n=null==this?void 0:this.config)||void 0===n?void 0:n.config)||void 0===i?void 0:i.images)||void 0===o?void 0:o.launcher_image_url)||void 0===r?void 0:r.url)||"".concat(a,"/chatbubble.png"):d||"".concat(a,"/chatbubble.png"),h.alt="Chat",Object.assign(h.style,{width:"100%",height:"100%",objectFit:"cover"}),p.appendChild(f),m.appendChild(h),u.appendChild(p),u.appendChild(m),u},e.prototype.applyResponsiveStyles=function(e){var t,n,i,o,r,a,l,s,c,d=(null===window||void 0===window?void 0:window.innerWidth)<560,u=this.config.config,p=this.config.position||(null===(i=u.interface_properties)||void 0===i?void 0:i.position)||"Right",f=null!==(a=null!==(o=this.config.sideSpacing)&&void 0!==o?o:null===(r=u.interface_properties)||void 0===r?void 0:r.side_spacing)&&void 0!==a?a:20,m=null!==(c=null!==(l=this.config.bottomSpacing)&&void 0!==l?l:null===(s=u.interface_properties)||void 0===s?void 0:s.bottom_spacing)&&void 0!==c?c:20;this.buttonElement.style.position="",this.buttonElement.style.bottom="",this.buttonElement.style.right="",this.buttonElement.style.left="";var h=y(y({},e),d?((t={position:"fixed",bottom:"".concat(m,"px")})[p.toLowerCase()]="".concat(f,"px"),t):((n={bottom:"".concat(m,"px")})[p.toLowerCase()]="".concat(f,"px"),n));Object.assign(this.buttonElement.style,h)},e.prototype.handleResize=function(){var e,t=null!==(e=this.config.launcher_size)&&void 0!==e?e:48,n={zIndex:"1000",display:"flex",flexDirection:"column-reverse",alignItems:"center",justifyContent:"center",cursor:"pointer",overflow:"hidden",marginTop:"16px",borderRadius:this.config.config.launcher_type&&this.config.config.launcher_type!==f.IMAGE?"9999px":"50%",boxSizing:"border-box"};this.config.config.launcher_type===f.IMAGE&&Object.assign(n,{width:"".concat(t,"px"),height:"".concat(t,"px"),borderRadius:"50%",backgroundColor:this.config.config.brand_colour}),this.applyResponsiveStyles(n)},e.prototype.setupResizeListener=function(){"undefined"!=typeof ResizeObserver?(this.resizeObserver=new ResizeObserver(this.handleResizeFunction),this.resizeObserver.observe(document.body)):window.addEventListener("resize",this.handleResizeFunction)},e.prototype.getElement=function(){return this.buttonElement},e.prototype.mount=function(){var e=this;requestAnimationFrame((function(){var t,n;null===(n=(t=e.config).onEvent)||void 0===n||n.call(t,{type:x.CHATBOT_BUTTON_LOADED,timestamp:Date.now()}),e.config.onInternalEvent(x.CHATBOT_BUTTON_LOADED)}))},e.prototype.update=function(e){this.config.isIframeVisible,this.config=y(y({},this.config),e),this.buttonElement.style.transform=this.config.isIframeVisible?"scale(0.85)":"scale(1)",this.render(),this.renderProactiveIfNeeded()},e.prototype.destroy=function(){this.resizeObserver?(this.resizeObserver.disconnect(),this.resizeObserver=null):window.removeEventListener("resize",this.handleResizeFunction),this.buttonElement&&this.buttonElement.parentNode&&this.buttonElement.parentNode.removeChild(this.buttonElement),this.proactiveElement&&this.proactiveElement.parentElement&&(this.proactiveElement.parentElement.removeChild(this.proactiveElement),this.proactiveElement=null),this.clearProactiveDelays(),this.urlUnsubscribe&&(this.urlUnsubscribe(),this.urlUnsubscribe=null)},e.prototype.clearProactiveDelays=function(){this.delayTimers.forEach((function(e){return clearTimeout(e)})),this.delayTimers=[]},e.prototype.hideProactiveMessages=function(){var e,t,n=this;j();var i=null===(e=this.proactiveElement)||void 0===e?void 0:e.children[0];if(i){var o="Right"===(this.config.position||(null===(t=this.config.config.interface_properties)||void 0===t?void 0:t.position)||"Right");Array.from(i.children).forEach((function(e){e.className=o?"rblyn-proactive-exit-right":"rblyn-proactive-exit-left"})),setTimeout((function(){n.proactiveElement&&n.proactiveElement.parentElement&&n.proactiveElement.parentElement.removeChild(n.proactiveElement),n.proactiveElement=null,n.clearProactiveDelays()}),400)}else this.clearProactiveDelays()},e.prototype.injectAnimationStyles=function(){if(!document.getElementById("rblyn-proactive-animations")){var e=document.createElement("style");e.id="rblyn-proactive-animations",e.textContent="\n @keyframes slideInFromRight {\n 0% {\n transform: translateX(120%) scale(0.95);\n opacity: 0;\n }\n 85% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n 92% {\n transform: translateX(-1px) scale(1.002);\n }\n 100% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n }\n @keyframes slideInFromLeft {\n 0% {\n transform: translateX(-120%) scale(0.95);\n opacity: 0;\n }\n 85% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n 92% {\n transform: translateX(1px) scale(1.002);\n }\n 100% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n }\n @keyframes slideOutRight {\n 0% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n 100% {\n transform: translateX(120%) scale(0.9);\n opacity: 0;\n }\n }\n @keyframes slideOutLeft {\n 0% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n 100% {\n transform: translateX(-120%) scale(0.9);\n opacity: 0;\n }\n }\n .rblyn-proactive-enter-right {\n animation: slideInFromRight 1.2s cubic-bezier(0.5, 0.8, 0.3, 1.1) forwards;\n }\n .rblyn-proactive-enter-left {\n animation: slideInFromLeft 1.2s cubic-bezier(0.5, 0.8, 0.3, 1.1) forwards;\n }\n .rblyn-proactive-exit-right {\n animation: slideOutRight 0.4s ease-in forwards;\n }\n .rblyn-proactive-exit-left {\n animation: slideOutLeft 0.4s ease-in forwards;\n }\n .rblyn-proactive-close-enter-right {\n animation: slideInFromRight 1.2s cubic-bezier(0.5, 0.8, 0.3, 1.1) forwards;\n }\n .rblyn-proactive-close-enter-left {\n animation: slideInFromLeft 1.2s cubic-bezier(0.5, 0.8, 0.3, 1.1) forwards;\n }\n /* Reset styles for proactive message content to prevent website CSS interference */\n /* Only target children of the content wrapper, not the bubble container itself */\n .rblyn-proactive-message-content * {\n box-sizing: border-box !important;\n margin: 0 !important;\n padding: 0 !important;\n border: none !important;\n background: transparent;\n font-family: ".concat(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 t,n,i,o,r,a,l,s,c,d,u,p,m,h=this,v=null===(n=null===(t=this.config)||void 0===t?void 0:t.config)||void 0===n?void 0:n.proactive_message_obj;if(Array.isArray(v)&&!this.config.isIframeVisible&&!G()){if(this.injectAnimationStyles(),!this.proactiveElement){var g=document.createElement("div");g.style.position="fixed";var y=null!==(a=null!==(o=this.config.bottomSpacing)&&void 0!==o?o:null===(r=this.config.config.interface_properties)||void 0===r?void 0:r.bottom_spacing)&&void 0!==a?a:20,b=null!==(c=null!==(l=this.config.sideSpacing)&&void 0!==l?l:null===(s=this.config.config.interface_properties)||void 0===s?void 0:s.side_spacing)&&void 0!==c?c:20,_=this.config.position||(null===(d=this.config.config.interface_properties)||void 0===d?void 0:d.position)||"Right",w=null!==(u=this.config.launcher_size)&&void 0!==u?u:48;g.style.bottom="".concat(y+(this.config.config.launcher_type===f.IMAGE?w:40)+8,"px"),"Right"===_?g.style.right="".concat(b,"px"):g.style.left="".concat(b,"px"),g.style.maxWidth="22.875rem",g.style.zIndex="2147483646";var E=document.createElement("div");E.style.display="flex",E.style.flexDirection="column",E.style.alignItems="Right"===_?"flex-end":"flex-start";var I=document.createElement("div");I.style.position="absolute",I.style.top="-32px",I.style.width="24px",I.style.height="24px",I.style.borderRadius="50%",I.style.background="#fff",I.style.boxShadow="0 2.667px 2.667px 0 rgba(0, 0, 0, 0.25)",I.style.display="flex",I.style.alignItems="center",I.style.justifyContent="center",I.style.cursor="pointer",I.style.opacity="0",I.style.visibility="hidden","Right"===(this.config.position||(null===(p=this.config.config.interface_properties)||void 0===p?void 0:p.position)||"Right")?(I.style.right="0px",I.style.left="auto",I.style.transform="translateX(120%) scale(0.95)"):(I.style.left="0px",I.style.right="auto",I.style.transform="translateX(-120%) scale(0.95)"),I.onclick=function(e){e.stopPropagation(),h.hideProactiveMessages()},I.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 ',g.appendChild(E),g.appendChild(I),document.body.appendChild(g),this.proactiveElement=g}var T=this.proactiveElement.children[0];T.innerHTML="";var x="Right"===(this.config.position||(null===(m=this.config.config.interface_properties)||void 0===m?void 0:m.position)||"Right");T.style.display="flex",T.style.flexDirection="column",T.style.alignItems=x?"flex-end":"flex-start",this.clearProactiveDelays();var S=J(v),A=S.length>0?S[S.length-1].delayMs:0,C=this.proactiveElement.children[1];if(C&&S.length>0){C.style.opacity="0",C.style.visibility="hidden",C.style.transform=x?"translateX(120%) scale(0.95)":"translateX(-120%) scale(0.95)";var O=window.setTimeout((function(){C.style.visibility="visible",C.style.animationDelay="0ms",C.className=x?"rblyn-proactive-close-enter-right":"rblyn-proactive-close-enter-left"}),A);this.delayTimers.push(O)}else C&&(C.style.opacity="0",C.style.visibility="hidden");S.forEach((function(e,t){var n=window.setTimeout((function(){var n=document.createElement("div");n.style.background="#fff",n.style.color="#111",n.style.borderRadius="12px",n.style.boxShadow="0 2px 2px 0 rgba(0, 0, 0, 0.08)",n.style.padding="16px",n.style.border="1px solid #F1F2F4",n.style.cursor="pointer",n.style.fontFamily=R,n.style.fontSize="14px",n.style.lineHeight=String(D),n.style.width="fit-content",n.style.maxWidth="100%",T.children.length>0&&(n.style.marginBottom="16px");var i=10*(S.length-1-t);n.className=x?"rblyn-proactive-enter-right":"rblyn-proactive-enter-left",n.style.animationDelay="".concat(i,"ms"),n.style.opacity="0",n.style.transform=x?"translateX(120%) scale(0.95)":"translateX(-120%) scale(0.95)";var o=document.createElement("div");o.className="rblyn-proactive-message-content",o.setAttribute("dir",nt(e.html)),o.innerHTML=tt(e.html),n.appendChild(o),n.onclick=function(){X({message_id:e.messageId,content_string:e.html||null}),h.config.toggleIframe(),h.hideProactiveMessages();try{window.dispatchEvent(new CustomEvent("rblyn:proactiveClick",{detail:{message_id:e.messageId,content_string:e.html||null}}))}catch(e){}},T.insertBefore(n,T.firstChild)}),e.delayMs);h.delayTimers.push(n)}))}else if(this.proactiveElement&&this.proactiveElement.parentElement){var N=this.proactiveElement.children[0],k="Right"===(this.config.position||(null===(i=this.config.config.interface_properties)||void 0===i?void 0:i.position)||"Right");Array.from(N.children).forEach((function(e){e.className=k?"rblyn-proactive-exit-right":"rblyn-proactive-exit-left"})),setTimeout((function(){h.proactiveElement&&h.proactiveElement.parentElement&&h.proactiveElement.parentElement.removeChild(h.proactiveElement),h.proactiveElement=null,h.clearProactiveDelays()}),400)}else this.proactiveElement=null,this.clearProactiveDelays()},e}(),Zt=function(){function e(e){var t=this;this.isInitialized=!1,this.hasRegistered=!1,this.overridesPayloadCache=null,this.proactiveDataSentInRegistration=!1,this.handleMessage=function(e){var n,i,o,r,a,l,s,c,d,u,p,f,m,h,v,g=C().copilotUrl;if(e.origin===g){if("closeChatbot"===e.data)return void t.config.onClose();if("CHATBOT_TOKEN_EXHAUSTED"===(null===(n=e.data)||void 0===n?void 0:n.type))return void t.config.onInternalEvent(S.CHATBOT_TOKEN_EXHAUSTED);"CHATBOT_LOADED"===(null===(i=e.data)||void 0===i?void 0:i.type)&&(null===(r=(o=t.config).onEvent)||void 0===r||r.call(o,{type:x.CHATBOT_LOADED,timestamp:Date.now()}),t.config.onInternalEvent(x.CHATBOT_LOADED)),"CHAT_INITIALIZED"===(null===(a=e.data)||void 0===a?void 0:a.type)&&(null===(s=(l=t.config).onEvent)||void 0===s||s.call(l,{type:x.CHAT_INITIALIZED,timestamp:Date.now()}),t.config.onInternalEvent(x.CHAT_INITIALIZED)),"CHAT_INITIALIZATION_FAILED"===(null===(c=e.data)||void 0===c?void 0:c.type)&&(null===(u=(d=t.config).onEvent)||void 0===u||u.call(d,{type:x.CHAT_INITIALIZATION_FAILED,timestamp:Date.now()}),t.config.onInternalEvent(x.CHAT_INITIALIZATION_FAILED,{error:null===(p=e.data)||void 0===p?void 0:p.error})),"SESSION_REFRESHED"===(null===(f=e.data)||void 0===f?void 0:f.type)&&(null===(h=(m=t.config).onEvent)||void 0===h||h.call(m,{type:x.SESSION_REFRESHED,timestamp:Date.now()}),t.config.onInternalEvent(x.SESSION_REFRESHED)),"CHAT_MOVED"===(null===(v=e.data)||void 0===v?void 0:v.type)&&t.config.onInternalEvent(S.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.getElement=function(){return this.iframeElement},e.prototype.render=function(){var e,t=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(t.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,t,n,i,o,r;if(this.iframeElement){var a=this.config.position||(null===(n=this.config.config.interface_properties)||void 0===n?void 0:n.position)||"Right",l=null!==(r=null!==(i=this.config.bottomSpacing)&&void 0!==i?i:null===(o=this.config.config.interface_properties)||void 0===o?void 0:o.bottom_spacing)&&void 0!==r?r:20;window.innerWidth<560?Object.assign(this.iframeElement.style,((e={width:"100vw",minWidth:"300px"})[a.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,((t={width:"26%",minWidth:"400px",height:"calc(100vh - 2rem - 10vh - ".concat(l,"px)"),borderRadius:"1rem",top:"calc(10vh - 32px)",maxHeight:"50rem",position:""})[a.toLowerCase()]=void 0,t))}},e.prototype.initialize=function(){var e=this;if(!this.isInitialized){var t=C().copilotUrl;this.iframeElement.src="".concat(t,"/chatbot-plugin?id=").concat(this.config.config.chatbotId),this.isInitialized=!0,this.iframeElement.addEventListener("load",(function(){var n,i,o,r,a,l,s,c,d,u,p,f,m,h,v,g,y,b,_=new URL(e.iframeElement.src).origin||t;null===(n=e.iframeElement.contentWindow)||void 0===n||n.postMessage({domain:null===(i=null===window||void 0===window?void 0:window.location)||void 0===i?void 0:i.hostname,name:"checkDomain"},_);var w={header_avatar:null!==(r=null===(o=e.config.overrides)||void 0===o?void 0:o.header_avatar)&&void 0!==r?r:null,agent_avatar:null!==(l=null===(a=e.config.overrides)||void 0===a?void 0:a.agent_avatar)&&void 0!==l?l:null,header_title:null!==(c=null===(s=e.config.overrides)||void 0===s?void 0:s.header_title)&&void 0!==c?c:null,header_subtitle:null!==(u=null===(d=e.config.overrides)||void 0===d?void 0:d.header_subtitle)&&void 0!==u?u:null,header_title_text_color:null!==(f=null===(p=e.config.overrides)||void 0===p?void 0:p.header_title_text_color)&&void 0!==f?f:null,header_subtitle_text_color:null!==(h=null===(m=e.config.overrides)||void 0===m?void 0:m.header_subtitle_text_color)&&void 0!==h?h:null,header_bg:null!==(g=null===(v=e.config.overrides)||void 0===v?void 0:v.header_bg)&&void 0!==g?g:null};null===(y=e.iframeElement.contentWindow)||void 0===y||y.postMessage({domain:null===(b=null===window||void 0===window?void 0:window.location)||void 0===b?void 0:b.hostname,action:"updateOverrides",data:w},_)}))}},e.prototype.setupEventListeners=function(){var e=this;window.addEventListener("resize",this.resizeHandler),this.iframeElement.addEventListener("error",(function(){ft.trackError(new Error(Ot[Et]({src:e.iframeElement.src,error:"Failed to load iframe"})),"ChatbotIframe",{errorCode:Et,errorType:At,context:{config:e.config.config,iframeUrl:e.iframeElement.src,timestamp:Date.now()}})})),window.addEventListener("message",this.handleMessage);window.addEventListener("rblyn:proactiveClick",(function(t){var n,i,o,r,a,l;if(e.hasRegistered)if(e.proactiveDataSentInRegistration)e.proactiveDataSentInRegistration=!1;else{var s=(null==t?void 0:t.detail)||{},c=C().copilotUrl,d=new URL(e.iframeElement.src).origin||c;null===(n=e.iframeElement.contentWindow)||void 0===n||n.postMessage({domain:null===(i=null===window||void 0===window?void 0:window.location)||void 0===i?void 0:i.hostname,action:"proactiveClick",data:{userId:null===(o=e.config.config)||void 0===o?void 0:o.userId,token:null===(r=e.config.config)||void 0===r?void 0:r.token,userProfile:null===(a=e.config.config)||void 0===a?void 0:a.userProfile,isAnonymous:null===(l=e.config.config)||void 0===l?void 0:l.isAnonymous,proactiveData:{input_id:null,message_id:(null==s?void 0:s.message_id)||null,content_string:(null==s?void 0:s.content_string)||null}}},d)}}))},e.prototype.updateVisibility=function(e){var t,n,i,o,r,a,l,s,c,d,u,p=this;this.config.isVisible=e;var f=this.config.position||(null===(t=this.config.config.interface_properties)||void 0===t?void 0:t.position)||"Right";if(e?(this.iframeElement.style.display="block",this.iframeElement.getBoundingClientRect(),this.iframeElement.style.opacity="1",this.iframeElement.style.transform="scale(1) translate3d(0,0,0)"):(this.iframeElement.style.opacity="0",this.iframeElement.style.transform="scale(0.3) translate3d(".concat((f.toLowerCase(),"0"),",40px,0)"),setTimeout((function(){p.config.isVisible||(p.iframeElement.style.display="none")}),200)),this.iframeElement.contentWindow&&e){var m=C().copilotUrl,h=new URL(this.iframeElement.src).origin||m;if(this.iframeElement.contentWindow.postMessage({domain:null===(n=null===window||void 0===window?void 0:window.location)||void 0===n?void 0:n.hostname,name:"openFrame"},h),!this.hasRegistered){var v=V();this.proactiveDataSentInRegistration=!!v,this.iframeElement.contentWindow.postMessage({domain:null===(i=null===window||void 0===window?void 0:window.location)||void 0===i?void 0:i.hostname,action:"registerUserId",data:y({userId:null===(o=this.config.config)||void 0===o?void 0:o.userId,token:null===(r=this.config.config)||void 0===r?void 0:r.token,userProfile:y(y({},null===(a=this.config.config)||void 0===a?void 0:a.userProfile),{__INT_SYS_INFO__:y(y({},(null===(s=null===(l=this.config.config)||void 0===l?void 0:l.userProfile)||void 0===s?void 0:s.__INT_SYS_INFO__)||{}),Dt())}),isAnonymous:null===(c=this.config.config)||void 0===c?void 0:c.isAnonymous},v?{proactiveData:v}:{})},h),this.hasRegistered=!0}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)}},e.prototype.update=function(e){var t=this.config.isVisible;if(this.config=y(y({},this.config),e),t!==this.config.isVisible&&this.updateVisibility(this.config.isVisible),this.iframeElement.contentWindow&&this.config.isVisible){var n=C().copilotUrl;this.iframeElement.contentWindow.postMessage({action:"updateUserProfile",user_profile:this.config.config.userProfile},n)}},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}(),qt=function(){function e(e,t,n,i){this.resizeObserver=null,this.containerElement=document.createElement("div"),this.handleResizeFunction=this.handleResize.bind(this),this.config={config:e,position:t,sideSpacing:n,bottomSpacing:i},this.render(),this.mount(),this.setupResizeListener()}return e.prototype.render=function(){this.applyStyles(),this.containerElement.className="robylon-chatbot-container"},e.prototype.applyStyles=function(){var e,t,n,i,o,r,a,l,s,c=(null===window||void 0===window?void 0:window.innerWidth)<560,d=this.config.position||(null===(n=this.config.config.interface_properties)||void 0===n?void 0:n.position)||"Right",u=null!==(r=null!==(i=this.config.sideSpacing)&&void 0!==i?i:null===(o=this.config.config.interface_properties)||void 0===o?void 0:o.side_spacing)&&void 0!==r?r:20,p=null!==(s=null!==(a=this.config.bottomSpacing)&&void 0!==a?a:null===(l=this.config.config.interface_properties)||void 0===l?void 0:l.bottom_spacing)&&void 0!==s?s:20;this.containerElement.style.position="",this.containerElement.style.top="",this.containerElement.style.bottom="",this.containerElement.style.right="",this.containerElement.style.left="",this.containerElement.style.alignItems="";var f={position:"fixed",zIndex:"1000",display:"flex",flexDirection:"column"},m=y(y({},f),((e={bottom:"".concat(p,"px")})[d.toLowerCase()]="".concat(u,"px"),e.alignItems="Right"===d?"flex-end":"flex-start",e)),h=y(y({},f),((t={top:"0"})[d.toLowerCase()]="".concat(u,"px"),t.alignItems="center",t));Object.assign(this.containerElement.style,c?h:m)},e.prototype.handleResize=function(){this.applyStyles()},e.prototype.setupResizeListener=function(){"undefined"!=typeof ResizeObserver?(this.resizeObserver=new ResizeObserver(this.handleResizeFunction),this.resizeObserver.observe(document.body)):window.addEventListener("resize",this.handleResizeFunction)},e.prototype.mount=function(){document.body.appendChild(this.containerElement)},e.prototype.getElement=function(){return this.containerElement},e.prototype.destroy=function(){this.resizeObserver?(this.resizeObserver.disconnect(),this.resizeObserver=null):window.removeEventListener("resize",this.handleResizeFunction),this.containerElement&&this.containerElement.parentNode&&this.containerElement.parentNode.removeChild(this.containerElement)},e}(),Qt=function(e){e.api_key,e.user_profile;var t=e.onEvent;e.chatbotConfig;return{emit:function(e,n){var i={type:e,timestamp:Date.now(),data:n};null==t||t(i)},onInternalEvent:function(e,t){}}},$t=function(){function e(e){var t=this;this.container=null,this.floatingButton=null,this.launcherDelayTimeout=null,this.iframe=null,this.isDestroyed=!1,this.handleStateChange=function(e){var n,i,o,r,a,l;if(!t.isDestroyed){var s=e.isInitialized,c=e.error,d=e.chatbotConfig,u=e.isIframeVisible;if(!c&&d&&s){if(t.eventEmitter=Qt({api_key:t.config.api_key,user_profile:t.config.user_profile,onEvent:t.config.onEvent,chatbotConfig:{isAnonymous:d.isAnonymous,userId:d.userId}}),t.container||(t.container=new qt(d,t.config.position,t.config.sideSpacing,t.config.bottomSpacing)),t.iframe)t.iframe.update({config:d,isVisible:u,position:t.config.position,bottomSpacing:t.config.bottomSpacing,overrides:t.config.overrides});else if(t.iframe=new Zt({config:d,isVisible:u,onClose:t.handleClose,onEvent:t.config.onEvent,onInternalEvent:t.eventEmitter.onInternalEvent,position:t.config.position,bottomSpacing:t.config.bottomSpacing,overrides:t.config.overrides}),t.iframe.getElement&&"function"==typeof t.iframe.getElement){var p=t.iframe.getElement();p&&t.container&&t.container.getElement().prepend(p)}var f=void 0!==t.config.show_launcher?Boolean(t.config.show_launcher):null===(n=null==d?void 0:d.show_launcher)||void 0===n||n,m=!0===(null===(i=null==d?void 0:d.launcher_delay)||void 0===i?void 0:i.enabled),h=null!==(l=null!==(r=null===(o=null==d?void 0:d.launcher_delay)||void 0===o?void 0:o.seconds)&&void 0!==r?r:null===(a=null==d?void 0:d.launcher_delay)||void 0===a?void 0:a.delay)&&void 0!==l?l:0,v=function(){if(t.floatingButton)t.floatingButton.update({config:d,isIframeVisible:u,position:t.config.position,sideSpacing:t.config.sideSpacing,bottomSpacing:t.config.bottomSpacing,launcher_size:t.config.launcher_size});else if(t.floatingButton=new Jt({config:d,toggleIframe:t.toggleIframe,isIframeVisible:u,onEvent:t.config.onEvent,onInternalEvent:t.eventEmitter.onInternalEvent,position:t.config.position,sideSpacing:t.config.sideSpacing,bottomSpacing:t.config.bottomSpacing,launcher_size:t.config.launcher_size}),t.floatingButton.getElement&&"function"==typeof t.floatingButton.getElement){var e=t.floatingButton.getElement();e&&t.container&&t.container.getElement().appendChild(e)}};t.launcherDelayTimeout&&(clearTimeout(t.launcherDelayTimeout),t.launcherDelayTimeout=null),f?m&&Number(h)>0&&!t.floatingButton?t.launcherDelayTimeout=window.setTimeout((function(){v(),t.launcherDelayTimeout=null}),1e3*Number(h)):v():t.floatingButton&&(t.floatingButton.destroy(),t.floatingButton=null)}}},this.toggleIframe=function(){var e=t.stateManager.getState();t.stateManager.toggleIframeVisibility(),t.eventEmitter.emit(e.isIframeVisible?x.CHATBOT_CLOSED:x.CHATBOT_BUTTON_CLICKED)},this.handleClose=function(){t.stateManager.closeIframe(),t.eventEmitter.emit(x.CHATBOT_CLOSED)};var n=y(y({},e),{position:"string"==typeof e.position?"left"===e.position.toLowerCase()?"Left":"right"===e.position.toLowerCase()?"Right":void 0:void 0,sideSpacing:"string"==typeof e.sideSpacing?""===e.sideSpacing||isNaN(Number(e.sideSpacing))?void 0:Number(e.sideSpacing):e.sideSpacing,bottomSpacing:"string"==typeof e.bottomSpacing?""===e.bottomSpacing||isNaN(Number(e.bottomSpacing))?void 0:Number(e.bottomSpacing):e.bottomSpacing,show_launcher:e.show_launcher,overrides:e.overrides,launcher_size:e.launcher_size});if(this.config=n,!e.api_key)throw ft.trackError(new Error(Ot[mt](e.api_key)),"RobylonChatbot",{errorCode:mt,errorType:xt,context:{timestamp:Date.now()}}),new Error("API key is required");try{ft.initialize(e.api_key,e.user_id)}catch(e){ft.trackError(e instanceof Error?e:new Error(String(e)),"RobylonChatbot",{errorCode:yt,errorType:xt,context:{timestamp:Date.now()}})}this.stateManager=function(e){var t={isInitialized:!1,isInitializing:!1,error:null,chatbotConfig:null,isIframeVisible:!1},n=[],i=function(e){t=y(y({},t),e),n.forEach((function(e){return e(t)}))};return{getState:function(){return t},initialize:function(){return b(void 0,void 0,void 0,(function(){var t,n,o;return _(this,(function(r){switch(r.label){case 0:if(!e.api_key)return ft.trackError(new Error(Ot[mt](e.api_key)),"ChatbotStateManager",{errorCode:mt,errorType:xt,context:{timestamp:Date.now()}}),[2];i({isInitializing:!0}),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,Wt(e)];case 2:return t=r.sent(),[4,new Promise((function(e,n){Pt(t,(function(){i({isInitialized:!0,chatbotConfig:t}),e()}),(function(e){n(e)}))}))];case 3:return r.sent(),[3,6];case 4:return n=r.sent(),o=n instanceof Error?n.message:"Failed to initialize chatbot",i({error:o}),ft.trackError(n instanceof Error?n:new Error(o),"ChatbotStateManager",{errorCode:gt,errorType:xt,context:{timestamp:Date.now()}}),[3,6];case 5:return i({isInitializing:!1}),[7];case 6:return[2]}}))}))},toggleIframeVisibility:function(){i({isIframeVisible:!t.isIframeVisible})},closeIframe:function(){i({isIframeVisible:!1})},updateState:i,subscribe:function(e){return n.push(e),function(){var t=n.indexOf(e);t>-1&&n.splice(t,1)}},unsubscribe:function(e){var t=n.indexOf(e);t>-1&&n.splice(t,1)}}}({api_key:e.api_key,user_id:e.user_id,user_token:e.user_token,user_profile:e.user_profile}),this.eventEmitter=Qt({api_key:e.api_key,user_profile:e.user_profile,onEvent:e.onEvent,chatbotConfig:null}),this.initialize()}return e.prototype.initialize=function(){return b(this,void 0,void 0,(function(){var e;return _(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.stateManager.initialize()];case 1:return t.sent(),this.stateManager.subscribe(this.handleStateChange),this.handleStateChange(this.stateManager.getState()),[3,3];case 2:return e=t.sent(),ft.trackError(e instanceof Error?e:new Error(String(e)),"RobylonChatbot.initialize",{errorCode:gt,errorType:xt,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.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 en(e){return new $t(e)}"undefined"!=typeof window&&function(){if("undefined"!=typeof window){var e=window.RobylonChatbot;if(e&&Array.isArray(e.q)){var t=null;e.q.forEach((function(e){var n=e[0];if("init"===n){var i=e[1]||{};t=en(i)}else t&&"function"==typeof t[n]&&t[n]()})),window.RobylonChatbot=function(e){var n=Array.prototype.slice.call(arguments,1);return"init"===e?t=en(n[0]||{}):t&&"function"==typeof t[e]?t[e].apply(t,n):void 0},window.RobylonChatbot.getState=function(){return"initialized"}}}}();var tn={create:en,getState:function(){return"initialized"}};export{Yt as Chatbot,u as ChatbotInterfaceType,g as ConditionType,h as DisplayAttributesType,f as LauncherType,v as LogicalConditionType,m as ProactiveSendTimeType,tn as RobylonChatbot,p as WidgetPositionEnums,Kt as useChatbot};
|
|
3
|
+
const{entries:Z,setPrototypeOf:q,isFrozen:Q,getPrototypeOf:$,getOwnPropertyDescriptor:ee}=Object;let{freeze:te,seal:ne,create:ie}=Object,{apply:oe,construct:re}="undefined"!=typeof Reflect&&Reflect;te||(te=function(e){return e}),ne||(ne=function(e){return e}),oe||(oe=function(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return e.apply(t,i)}),re||(re=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return new e(...n)});const ae=we(Array.prototype.forEach),le=we(Array.prototype.lastIndexOf),se=we(Array.prototype.pop),ce=we(Array.prototype.push),de=we(Array.prototype.splice),ue=we(String.prototype.toLowerCase),pe=we(String.prototype.toString),fe=we(String.prototype.match),me=we(String.prototype.replace),he=we(String.prototype.indexOf),ve=we(String.prototype.trim),ge=we(Object.prototype.hasOwnProperty),ye=we(RegExp.prototype.test),be=(_e=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return re(_e,t)});var _e;function we(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return oe(e,t,i)}}function Ee(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ue;q&&q(e,null);let i=t.length;for(;i--;){let o=t[i];if("string"==typeof o){const e=n(o);e!==o&&(Q(t)||(t[i]=e),o=e)}e[o]=!0}return e}function Ie(e){for(let t=0;t<e.length;t++){ge(e,t)||(e[t]=null)}return e}function Te(e){const t=ie(null);for(const[n,i]of Z(e)){ge(e,n)&&(Array.isArray(i)?t[n]=Ie(i):i&&"object"==typeof i&&i.constructor===Object?t[n]=Te(i):t[n]=i)}return t}function xe(e,t){for(;null!==e;){const n=ee(e,t);if(n){if(n.get)return we(n.get);if("function"==typeof n.value)return we(n.value)}e=$(e)}return function(){return null}}const Se=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"]),Ae=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"]),Ce=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"]),Oe=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"]),De=te(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ne=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"]),Le=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"]),Me=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"]),ze=te(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Fe=ne(/\{\{[\w\W]*|[\w\W]*\}\}/gm),He=ne(/<%[\w\W]*|[\w\W]*%>/gm),Ue=ne(/\$\{[\w\W]*/gm),Be=ne(/^data-[\-\w.\u00B7-\uFFFF]+$/),Pe=ne(/^aria-[\-\w]+$/),We=ne(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),je=ne(/^(?:\w+script|data):/i),Ge=ne(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Xe=ne(/^html$/i),Ve=ne(/^[a-z][.\w]*(-[.\w]+)+$/i);var Ye=Object.freeze({__proto__:null,ARIA_ATTR:Pe,ATTR_WHITESPACE:Ge,CUSTOM_ELEMENT:Ve,DATA_ATTR:Be,DOCTYPE_NAME:Xe,ERB_EXPR:He,IS_ALLOWED_URI:We,IS_SCRIPT_OR_DATA:je,MUSTACHE_EXPR:Fe,TMPLIT_EXPR:Ue});const Ke=1,Je=3,Ze=7,qe=8,Qe=9,$e=function(){return"undefined"==typeof window?null:window};var et=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:$e();const n=t=>e(t);if(n.version="3.3.0",n.removed=[],!t||!t.document||t.document.nodeType!==Qe||!t.Element)return n.isSupported=!1,n;let{document:i}=t;const o=i,r=o.currentScript,{DocumentFragment:a,HTMLTemplateElement:l,Node:s,Element:c,NodeFilter:d,NamedNodeMap:u=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:p,DOMParser:f,trustedTypes:m}=t,h=c.prototype,v=xe(h,"cloneNode"),g=xe(h,"remove"),y=xe(h,"nextSibling"),b=xe(h,"childNodes"),_=xe(h,"parentNode");if("function"==typeof l){const e=i.createElement("template");e.content&&e.content.ownerDocument&&(i=e.content.ownerDocument)}let w,E="";const{implementation:I,createNodeIterator:T,createDocumentFragment:x,getElementsByTagName:S}=i,{importNode:A}=o;let C={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof Z&&"function"==typeof _&&I&&void 0!==I.createHTMLDocument;const{MUSTACHE_EXPR:O,ERB_EXPR:R,TMPLIT_EXPR:D,DATA_ATTR:N,ARIA_ATTR:k,IS_SCRIPT_OR_DATA:L,ATTR_WHITESPACE:M,CUSTOM_ELEMENT:z}=Ye;let{IS_ALLOWED_URI:F}=Ye,H=null;const U=Ee({},[...Se,...Ae,...Ce,...Re,...Ne]);let B=null;const P=Ee({},[...ke,...Le,...Me,...ze]);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,G=null;const X=Object.seal(ie(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let V=!0,Y=!0,K=!1,J=!0,q=!1,Q=!0,$=!1,ee=!1,ne=!1,oe=!1,re=!1,_e=!1,we=!0,Ie=!1,Fe=!0,He=!1,Ue={},Be=null;const Pe=Ee({},["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 je=null;const Ge=Ee({},["audio","video","img","source","image","track"]);let Ve=null;const et=Ee({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),tt="http://www.w3.org/1998/Math/MathML",nt="http://www.w3.org/2000/svg",it="http://www.w3.org/1999/xhtml";let ot=it,rt=!1,at=null;const lt=Ee({},[tt,nt,it],pe);let st=Ee({},["mi","mo","mn","ms","mtext"]),ct=Ee({},["annotation-xml"]);const dt=Ee({},["title","style","font","a","script"]);let ut=null;const pt=["application/xhtml+xml","text/html"];let ft=null,mt=null;const ht=i.createElement("form"),vt=function(e){return e instanceof RegExp||e instanceof Function},gt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!mt||mt!==e){if(e&&"object"==typeof e||(e={}),e=Te(e),ut=-1===pt.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,ft="application/xhtml+xml"===ut?pe:ue,H=ge(e,"ALLOWED_TAGS")?Ee({},e.ALLOWED_TAGS,ft):U,B=ge(e,"ALLOWED_ATTR")?Ee({},e.ALLOWED_ATTR,ft):P,at=ge(e,"ALLOWED_NAMESPACES")?Ee({},e.ALLOWED_NAMESPACES,pe):lt,Ve=ge(e,"ADD_URI_SAFE_ATTR")?Ee(Te(et),e.ADD_URI_SAFE_ATTR,ft):et,je=ge(e,"ADD_DATA_URI_TAGS")?Ee(Te(Ge),e.ADD_DATA_URI_TAGS,ft):Ge,Be=ge(e,"FORBID_CONTENTS")?Ee({},e.FORBID_CONTENTS,ft):Pe,j=ge(e,"FORBID_TAGS")?Ee({},e.FORBID_TAGS,ft):Te({}),G=ge(e,"FORBID_ATTR")?Ee({},e.FORBID_ATTR,ft):Te({}),Ue=!!ge(e,"USE_PROFILES")&&e.USE_PROFILES,V=!1!==e.ALLOW_ARIA_ATTR,Y=!1!==e.ALLOW_DATA_ATTR,K=e.ALLOW_UNKNOWN_PROTOCOLS||!1,J=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,q=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,_e=e.RETURN_TRUSTED_TYPE||!1,ne=e.FORCE_BODY||!1,we=!1!==e.SANITIZE_DOM,Ie=e.SANITIZE_NAMED_PROPS||!1,Fe=!1!==e.KEEP_CONTENT,He=e.IN_PLACE||!1,F=e.ALLOWED_URI_REGEXP||We,ot=e.NAMESPACE||it,st=e.MATHML_TEXT_INTEGRATION_POINTS||st,ct=e.HTML_INTEGRATION_POINTS||ct,W=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&vt(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(W.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&vt(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),q&&(Y=!1),re&&(oe=!0),Ue&&(H=Ee({},Ne),B=[],!0===Ue.html&&(Ee(H,Se),Ee(B,ke)),!0===Ue.svg&&(Ee(H,Ae),Ee(B,Le),Ee(B,ze)),!0===Ue.svgFilters&&(Ee(H,Ce),Ee(B,Le),Ee(B,ze)),!0===Ue.mathMl&&(Ee(H,Re),Ee(B,Me),Ee(B,ze))),e.ADD_TAGS&&("function"==typeof e.ADD_TAGS?X.tagCheck=e.ADD_TAGS:(H===U&&(H=Te(H)),Ee(H,e.ADD_TAGS,ft))),e.ADD_ATTR&&("function"==typeof e.ADD_ATTR?X.attributeCheck=e.ADD_ATTR:(B===P&&(B=Te(B)),Ee(B,e.ADD_ATTR,ft))),e.ADD_URI_SAFE_ATTR&&Ee(Ve,e.ADD_URI_SAFE_ATTR,ft),e.FORBID_CONTENTS&&(Be===Pe&&(Be=Te(Be)),Ee(Be,e.FORBID_CONTENTS,ft)),Fe&&(H["#text"]=!0),$&&Ee(H,["html","head","body"]),H.table&&(Ee(H,["tbody"]),delete j.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw be('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw be('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');w=e.TRUSTED_TYPES_POLICY,E=w.createHTML("")}else void 0===w&&(w=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(n=t.getAttribute(i));const o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}}(m,r)),null!==w&&"string"==typeof E&&(E=w.createHTML(""));te&&te(e),mt=e}},yt=Ee({},[...Ae,...Ce,...Oe]),bt=Ee({},[...Re,...De]),_t=function(e){ce(n.removed,{element:e});try{_(e).removeChild(e)}catch(t){g(e)}},wt=function(e,t){try{ce(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){ce(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(oe||re)try{_t(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Et=function(e){let t=null,n=null;if(ne)e="<remove></remove>"+e;else{const t=fe(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===ut&&ot===it&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const o=w?w.createHTML(e):e;if(ot===it)try{t=(new f).parseFromString(o,ut)}catch(e){}if(!t||!t.documentElement){t=I.createDocument(ot,"template",null);try{t.documentElement.innerHTML=rt?E:o}catch(e){}}const r=t.body||t.documentElement;return e&&n&&r.insertBefore(i.createTextNode(n),r.childNodes[0]||null),ot===it?S.call(t,$?"html":"body")[0]:$?t.documentElement:r},It=function(e){return T.call(e.ownerDocument||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},Tt=function(e){return e instanceof p&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof u)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},xt=function(e){return"function"==typeof s&&e instanceof s};function St(e,t,i){ae(e,(e=>{e.call(n,t,i,mt)}))}const At=function(e){let t=null;if(St(C.beforeSanitizeElements,e,null),Tt(e))return _t(e),!0;const i=ft(e.nodeName);if(St(C.uponSanitizeElement,e,{tagName:i,allowedTags:H}),Q&&e.hasChildNodes()&&!xt(e.firstElementChild)&&ye(/<[/\w!]/g,e.innerHTML)&&ye(/<[/\w!]/g,e.textContent))return _t(e),!0;if(e.nodeType===Ze)return _t(e),!0;if(Q&&e.nodeType===qe&&ye(/<[/\w]/g,e.data))return _t(e),!0;if(!(X.tagCheck instanceof Function&&X.tagCheck(i))&&(!H[i]||j[i])){if(!j[i]&&Ot(i)){if(W.tagNameCheck instanceof RegExp&&ye(W.tagNameCheck,i))return!1;if(W.tagNameCheck instanceof Function&&W.tagNameCheck(i))return!1}if(Fe&&!Be[i]){const t=_(e)||e.parentNode,n=b(e)||e.childNodes;if(n&&t){for(let i=n.length-1;i>=0;--i){const o=v(n[i],!0);o.__removalCount=(e.__removalCount||0)+1,t.insertBefore(o,y(e))}}}return _t(e),!0}return e instanceof c&&!function(e){let t=_(e);t&&t.tagName||(t={namespaceURI:ot,tagName:"template"});const n=ue(e.tagName),i=ue(t.tagName);return!!at[e.namespaceURI]&&(e.namespaceURI===nt?t.namespaceURI===it?"svg"===n:t.namespaceURI===tt?"svg"===n&&("annotation-xml"===i||st[i]):Boolean(yt[n]):e.namespaceURI===tt?t.namespaceURI===it?"math"===n:t.namespaceURI===nt?"math"===n&&ct[i]:Boolean(bt[n]):e.namespaceURI===it?!(t.namespaceURI===nt&&!ct[i])&&!(t.namespaceURI===tt&&!st[i])&&!bt[n]&&(dt[n]||!yt[n]):!("application/xhtml+xml"!==ut||!at[e.namespaceURI]))}(e)?(_t(e),!0):"noscript"!==i&&"noembed"!==i&&"noframes"!==i||!ye(/<\/no(script|embed|frames)/i,e.innerHTML)?(q&&e.nodeType===Je&&(t=e.textContent,ae([O,R,D],(e=>{t=me(t,e," ")})),e.textContent!==t&&(ce(n.removed,{element:e.cloneNode()}),e.textContent=t)),St(C.afterSanitizeElements,e,null),!1):(_t(e),!0)},Ct=function(e,t,n){if(we&&("id"===t||"name"===t)&&(n in i||n in ht))return!1;if(Y&&!G[t]&&ye(N,t));else if(V&&ye(k,t));else if(X.attributeCheck instanceof Function&&X.attributeCheck(t,e));else if(!B[t]||G[t]){if(!(Ot(e)&&(W.tagNameCheck instanceof RegExp&&ye(W.tagNameCheck,e)||W.tagNameCheck instanceof Function&&W.tagNameCheck(e))&&(W.attributeNameCheck instanceof RegExp&&ye(W.attributeNameCheck,t)||W.attributeNameCheck instanceof Function&&W.attributeNameCheck(t,e))||"is"===t&&W.allowCustomizedBuiltInElements&&(W.tagNameCheck instanceof RegExp&&ye(W.tagNameCheck,n)||W.tagNameCheck instanceof Function&&W.tagNameCheck(n))))return!1}else if(Ve[t]);else if(ye(F,me(n,M,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==he(n,"data:")||!je[e]){if(K&&!ye(L,me(n,M,"")));else if(n)return!1}else;return!0},Ot=function(e){return"annotation-xml"!==e&&fe(e,z)},Rt=function(e){St(C.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||Tt(e))return;const i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:B,forceKeepAttr:void 0};let o=t.length;for(;o--;){const r=t[o],{name:a,namespaceURI:l,value:s}=r,c=ft(a),d=s;let u="value"===a?d:ve(d);if(i.attrName=c,i.attrValue=u,i.keepAttr=!0,i.forceKeepAttr=void 0,St(C.uponSanitizeAttribute,e,i),u=i.attrValue,!Ie||"id"!==c&&"name"!==c||(wt(a,e),u="user-content-"+u),Q&&ye(/((--!?|])>)|<\/(style|title|textarea)/i,u)){wt(a,e);continue}if("attributename"===c&&fe(u,"href")){wt(a,e);continue}if(i.forceKeepAttr)continue;if(!i.keepAttr){wt(a,e);continue}if(!J&&ye(/\/>/i,u)){wt(a,e);continue}q&&ae([O,R,D],(e=>{u=me(u,e," ")}));const p=ft(e.nodeName);if(Ct(p,c,u)){if(w&&"object"==typeof m&&"function"==typeof m.getAttributeType)if(l);else switch(m.getAttributeType(p,c)){case"TrustedHTML":u=w.createHTML(u);break;case"TrustedScriptURL":u=w.createScriptURL(u)}if(u!==d)try{l?e.setAttributeNS(l,a,u):e.setAttribute(a,u),Tt(e)?_t(e):se(n.removed)}catch(t){wt(a,e)}}else wt(a,e)}St(C.afterSanitizeAttributes,e,null)},Dt=function e(t){let n=null;const i=It(t);for(St(C.beforeSanitizeShadowDOM,t,null);n=i.nextNode();)St(C.uponSanitizeShadowNode,n,null),At(n),Rt(n),n.content instanceof a&&e(n.content);St(C.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=null,r=null,l=null,c=null;if(rt=!e,rt&&(e="\x3c!--\x3e"),"string"!=typeof e&&!xt(e)){if("function"!=typeof e.toString)throw be("toString is not a function");if("string"!=typeof(e=e.toString()))throw be("dirty is not a string, aborting")}if(!n.isSupported)return e;if(ee||gt(t),n.removed=[],"string"==typeof e&&(He=!1),He){if(e.nodeName){const t=ft(e.nodeName);if(!H[t]||j[t])throw be("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof s)i=Et("\x3c!----\x3e"),r=i.ownerDocument.importNode(e,!0),r.nodeType===Ke&&"BODY"===r.nodeName||"HTML"===r.nodeName?i=r:i.appendChild(r);else{if(!oe&&!q&&!$&&-1===e.indexOf("<"))return w&&_e?w.createHTML(e):e;if(i=Et(e),!i)return oe?null:_e?E:""}i&&ne&&_t(i.firstChild);const d=It(He?e:i);for(;l=d.nextNode();)At(l),Rt(l),l.content instanceof a&&Dt(l.content);if(He)return e;if(oe){if(re)for(c=x.call(i.ownerDocument);i.firstChild;)c.appendChild(i.firstChild);else c=i;return(B.shadowroot||B.shadowrootmode)&&(c=A.call(o,c,!0)),c}let u=$?i.outerHTML:i.innerHTML;return $&&H["!doctype"]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&ye(Xe,i.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+i.ownerDocument.doctype.name+">\n"+u),q&&ae([O,R,D],(e=>{u=me(u,e," ")})),w&&_e?w.createHTML(u):u},n.setConfig=function(){gt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),ee=!0},n.clearConfig=function(){mt=null,ee=!1},n.isValidAttribute=function(e,t,n){mt||gt({});const i=ft(e),o=ft(t);return Ct(i,o,n)},n.addHook=function(e,t){"function"==typeof t&&ce(C[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=le(C[e],t);return-1===n?void 0:de(C[e],n,1)[0]}return se(C[e])},n.removeHooks=function(e){C[e]=[]},n.removeAllHooks=function(){C={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}(),tt=function(e){return e?et.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 nt(e){if(!e||"string"!=typeof e||0===e.trim().length)return"ltr";var t=e.replace(/<[^>]*>/g,"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_`#]/g,"").trim();if(0===t.length)return"ltr";for(var n=/[\u0590-\u05FF\u0600-\u06FF\u0700-\u074F\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]/,i=0,o=0,r=0,a=t;r<a.length;r++){var l=a[r];/\s|\d|[.,;:!?()[\]{}'"`\-_=+*/\\|@#$%^&*~]/.test(l)||(o++,n.test(l)&&i++)}return 0===o?"ltr":i/o>.3?"rtl":"ltr"}var it,ot=t((function(t){var r,a,l,s,c,d,u,p,m,h,v,g,b,_,T,S,A,O=t.config,N=t.toggleIframe,k=t.isIframeVisible,L=t.onEvent,M=t.onInternalEvent,z=t.position,F=t.sideSpacing,U=t.bottomSpacing,B=t.launcher_type,P=t.launcher_properties_text,W=t.shouldFadeIn,V=t.launcher_size,Y=n(null),K=C().copilotUrl,Z=i(!1),q=Z[0],Q=Z[1],$=i(!1),ee=$[0],te=$[1],ne=i([]),ie=ne[0],oe=ne[1],re=i(!1),ae=re[0],le=re[1],se=n([]),ce=n(),de=null!=V?V:48;o((function(){var e=function(){var e=(null===window||void 0===window?void 0:window.innerWidth)<560;Q(e)};return e(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[]),o((function(){Y.current&&requestAnimationFrame((function(){null==L||L({type:x.CHATBOT_BUTTON_LOADED,timestamp:Date.now()}),M(x.CHATBOT_BUTTON_LOADED)}))}),[L,M]),o((function(){if(Y.current&&W){Y.current.style.opacity="0";var e=requestAnimationFrame((function(){Y.current&&(Y.current.style.opacity="1")}));return function(){return cancelAnimationFrame(e)}}}),[W]);var ue=z||(null===(l=O.interface_properties)||void 0===l?void 0:l.position)||"Right",pe=null!==(c=null!=F?F:null===(s=O.interface_properties)||void 0===s?void 0:s.side_spacing)&&void 0!==c?c:20,fe=null!==(u=null!=U?U:null===(d=O.interface_properties)||void 0===d?void 0:d.bottom_spacing)&&void 0!==u?u:20,me=B||(null==O?void 0:O.launcher_type)||f.IMAGE,he=P||(null===(p=null==O?void 0:O.launcher_properties)||void 0===p?void 0:p.text),ve={zIndex:1e3,display:"flex",flexDirection:"column-reverse",alignItems:"center",justifyContent:"center",cursor:"pointer",overflow:"hidden",marginTop:"16px",boxSizing:"border-box"};me===f.IMAGE&&(ve.width="".concat(de,"px"),ve.height="".concat(de,"px"),ve.borderRadius="50%",ve.backgroundColor=O.brand_colour);var ge=y(y({},ve),((r={position:void 0,bottom:"0",borderRadius:me===f.IMAGE?"50%":"9999px"})[ue.toLowerCase()]="0",r)),ye=y(y({},ve),((a={position:"fixed",bottom:"".concat(fe,"px"),borderRadius:me===f.IMAGE?"50%":"9999px"})[ue.toLowerCase()]="".concat(pe,"px"),a)),be=q?ye:ge;o((function(){I.log("Screen width changed, isMobile:",q,"Style:",be)}),[q,be]),I.log("config in floating button",O);o((function(){var e=function(){se.current.forEach((function(e){return clearTimeout(e)})),se.current=[]},t=function(){(e(),oe([]),(null==O?void 0:O.proactive_message_obj)&&!G())&&J(null==O?void 0:O.proactive_message_obj).forEach((function(e){var t=window.setTimeout((function(){oe((function(t){return t.some((function(t){return t.id===e.messageId&&t.index===e.contentIndex}))?t:w([{id:e.messageId,index:e.contentIndex,html:e.html}],t,!0)}))}),e.delayMs);se.current.push(t)}))};return ce.current=H((function(){te(!1),t()})),t(),function(){var t;e(),null===(t=ce.current)||void 0===t||t.call(ce)}}),[null==O?void 0:O.proactive_message_obj]);var _e=ie.length>0&&!k&&!ee,we="Right"===(z||(null===(m=O.interface_properties)||void 0===m?void 0:m.position)||"Right"),Ee=function(){le(!0),setTimeout((function(){te(!0),j(),le(!1)}),400)};return e.createElement(e.Fragment,null,e.createElement("style",null,"\n @keyframes slideInFromRight {\n 0% {\n transform: translateX(120%) scale(0.95);\n opacity: 0;\n }\n 85% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n 92% {\n transform: translateX(-1px) scale(1.002);\n }\n 100% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n }\n @keyframes slideInFromLeft {\n 0% {\n transform: translateX(-120%) scale(0.95);\n opacity: 0;\n }\n 85% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n 92% {\n transform: translateX(1px) scale(1.002);\n }\n 100% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n }\n @keyframes slideOutRight {\n 0% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n 100% {\n transform: translateX(120%) scale(0.9);\n opacity: 0;\n }\n }\n @keyframes slideOutLeft {\n 0% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n 100% {\n transform: translateX(-120%) scale(0.9);\n opacity: 0;\n }\n }\n .proactive-bubble-enter-right {\n animation: slideInFromRight 1.2s cubic-bezier(0.5, 0.8, 0.3, 1.1) forwards;\n }\n .proactive-bubble-enter-left {\n animation: slideInFromLeft 1.2s cubic-bezier(0.5, 0.8, 0.3, 1.1) forwards;\n }\n .proactive-bubble-exit-right {\n animation: slideOutRight 0.4s ease-in forwards;\n }\n .proactive-bubble-exit-left {\n animation: slideOutLeft 0.4s ease-in forwards;\n }\n .proactive-close-enter-right {\n animation: slideInFromRight 1.2s cubic-bezier(0.5, 0.8, 0.3, 1.1) forwards;\n }\n .proactive-close-enter-left {\n animation: slideInFromLeft 1.2s cubic-bezier(0.5, 0.8, 0.3, 1.1) forwards;\n }\n /* Reset styles for proactive message content to prevent website CSS interference */\n /* Only target children of the content wrapper, not the bubble container itself */\n .proactive-message-content * {\n box-sizing: border-box !important;\n margin: 0 !important;\n padding: 0 !important;\n border: none !important;\n background: transparent;\n font-family: ".concat(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 ')),_e?e.createElement("div",{className:"proactive-message-container",style:{position:"fixed",bottom:"".concat((null!==(v=null!=U?U:null===(h=O.interface_properties)||void 0===h?void 0:h.bottom_spacing)&&void 0!==v?v:20)+(me===f.IMAGE?de:40)+8,"px"),right:we?"".concat(null!==(b=null!=F?F:null===(g=O.interface_properties)||void 0===g?void 0:g.side_spacing)&&void 0!==b?b:20,"px"):"auto",left:we?"auto":"".concat(null!==(T=null!=F?F:null===(_=O.interface_properties)||void 0===_?void 0:_.side_spacing)&&void 0!==T?T:20,"px"),maxWidth:"22.875rem",zIndex:2147483646}},e.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:we?"flex-end":"flex-start"},className:"proactive-message-bubble-container"},ie.map((function(t,n){var i=10*(ie.length-1-n);return e.createElement("div",{key:"".concat(t.id,"-").concat(t.index,"-").concat(n),onClick:function(){X({message_id:t.id,content_string:t.html||null}),N(),Ee();try{window.dispatchEvent(new CustomEvent("rblyn:proactiveClick",{detail:{message_id:t.id,content_string:t.html||null}}))}catch(e){}},className:ae?we?"proactive-bubble-exit-right":"proactive-bubble-exit-left":we?"proactive-bubble-enter-right":"proactive-bubble-enter-left",style:y({background:"#fff",color:"#111",borderRadius:"12px",boxShadow:"0 2px 2px 0 rgba(0, 0, 0, 0.08)",padding:"16px",cursor:"pointer",fontFamily:R,lineHeight:D,fontSize:"14px",marginBottom:n<ie.length-1?16:0,border:"1px solid #F1F2F4",width:"fit-content",maxWidth:"100%",animationDelay:ae?"0ms":"".concat(i,"ms")},ae?{opacity:0}:{opacity:0,transform:we?"translateX(120%) scale(0.95)":"translateX(-120%) scale(0.95)"})},e.createElement("div",{className:"proactive-message-content",dir:nt(t.html),dangerouslySetInnerHTML:{__html:tt(t.html)}}))}))),e.createElement("div",{onClick:function(e){e.stopPropagation(),Ee()},className:ae?"":we?"proactive-close-enter-right":"proactive-close-enter-left",style:y({position:"absolute",top:"-32px",right:"Right"===(z||(null===(S=O.interface_properties)||void 0===S?void 0:S.position)||"Right")?"0px":"auto",left:"Left"===(z||(null===(A=O.interface_properties)||void 0===A?void 0:A.position)||"Right")?"0px":"auto",width:"24px",height:"24px",borderRadius:"50%",background:"#fff",boxShadow:" 0 2.667px 2.667px 0 rgba(0, 0, 0, 0.25)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",userSelect:"none",animationDelay:ae?"0ms":"".concat(10*(ie.length-1),"ms")},ae?{}:{opacity:0,transform:we?"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:Y,className:"message-bubble-container",style:y(y({},be),{transition:"transform 0.2s cubic-bezier(0.2, 1.27, 0.29, 0.97), opacity 280ms ease",transform:k?"scale(0.85)":"scale(1)",opacity:W?0:1}),onClick:function(){N(),Ee()}},function(){switch(me){case f.TEXT:return e.createElement("div",{style:{width:"fit-content",maxWidth:"160px",height:"40px",borderRadius:"9999px",backgroundColor:O.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:D}},e.createElement("div",{style:{flex:1,minWidth:0}},e.createElement("p",{dir:nt(he),style:{margin:0,color:E(O.brand_colour),fontSize:"0.875rem",fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:R,lineHeight:D,WebkitFontSmoothing:"antialiased",textRendering:"optimizeLegibility",textSizeAdjust:"100%"}},he)));case f.TEXTUAL_IMAGE:return function(){var t,n;return e.createElement("div",{style:{maxWidth:"13rem",width:"fit-content",height:"40px",borderRadius:"9999px",backgroundColor:O.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:D}},e.createElement("div",{style:{flex:1,minWidth:0}},e.createElement("p",{dir:nt(he),style:{margin:0,color:E(O.brand_colour),fontSize:"0.875rem",fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:R,lineHeight:D,WebkitFontSmoothing:"antialiased",textRendering:"optimizeLegibility",textSizeAdjust:"100%"}},he)),e.createElement("div",{style:{width:"40px",height:"40px",borderRadius:"9999px",overflow:"hidden",position:"relative",flexShrink:0}},e.createElement("img",{src:(null==O?void 0:O.launcher_type)?(null===(n=null===(t=null==O?void 0:O.images)||void 0===t?void 0:t.launcher_image_url)||void 0===n?void 0:n.url)||"".concat(K,"/chatbubble.png"):(null==O?void 0:O.image_url)||"".concat(K,"/chatbubble.png"),alt:"Chat",style:{width:"100%",height:"100%",objectFit:"cover"}})))}();case f.IMAGE:default:return function(){var t,n;if(k){var i=Math.round(.5*de);return e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%"}},e.createElement("svg",{width:i,height:i,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"}))))}return e.createElement("img",{src:(null==O?void 0:O.launcher_type)?(null===(n=null===(t=null==O?void 0:O.images)||void 0===t?void 0:t.launcher_image_url)||void 0===n?void 0:n.url)||"".concat(K,"/chatbubble.png"):(null==O?void 0:O.image_url)||"".concat(K,"/chatbubble.png"),alt:"Chat",style:{zIndex:1e3,cursor:"pointer",borderRadius:"50%",objectFit:"cover",width:"100%",height:"100%",boxSizing:"border-box"}})}()}}()))})),rt=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]},at=function(){var e;if(null===(e=navigator.userAgentData)||void 0===e?void 0:e.brands)for(var t=["Chrome","Firefox","Safari","Edge","Opera"],n=0,i=navigator.userAgentData.brands;n<i.length;n++){var o=i[n];if(t.includes(o.brand))return o.brand}return(/Chrome|Firefox|Safari|Edge|Opera/.exec(navigator.userAgent)||["Unknown"])[0]},lt=function(){var e,t,n,i;return{width:(null===window||void 0===window?void 0:window.innerWidth)||(null===(e=null===document||void 0===document?void 0:document.documentElement)||void 0===e?void 0:e.clientWidth)||(null===(t=null===document||void 0===document?void 0:document.body)||void 0===t?void 0:t.clientWidth),height:(null===window||void 0===window?void 0:window.innerHeight)||(null===(n=null===document||void 0===document?void 0:document.documentElement)||void 0===n?void 0:n.clientHeight)||(null===(i=null===document||void 0===document?void 0:document.body)||void 0===i?void 0:i.clientHeight)}},st=function(){return{platform:"web",os:rt(),browser:at(),sdk_version:"1.1.50-staging.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:lt()};var e};!function(e){e.ERROR="ERROR",e.INFO="INFO"}(it||(it={}));var ct,dt=["@robylon/web-react-sdk","node_modules/@robylon/web-react-sdk/"],ut=function(e){var t=e.filename,n=e.stack,i=e.message;return!!(t||n||i)&&dt.some((function(e){return(null==t?void 0:t.includes(e))||(null==n?void 0:n.includes(e))||(null==i?void 0:i.includes(e))}))},pt=function(){function e(){var e=this;this.apiKey="",this.userId=null,this.preInitQueue=[],this.isInitialized=!1,this.handleWindowError=function(t){var n,i={filename:t.filename,stack:null===(n=t.error)||void 0===n?void 0:n.stack,message:t.message};ut(i)&&e.trackError(t.error||t.message,"GlobalErrorHandler",{filename:t.filename,lineNo:t.lineno,colNo:t.colno})},this.handleUnhandledRejection=function(t){var n,i,o={stack:null===(n=t.reason)||void 0===n?void 0:n.stack,message:(null===(i=t.reason)||void 0===i?void 0:i.message)||String(t.reason)};ut(o)&&e.trackError(t.reason||"Unhandled Promise Rejection","GlobalPromiseHandler",{reason:t.reason})},this.setupGlobalHandlers()}return e.prototype.setupGlobalHandlers=function(){A()&&(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(){A()&&(null===window||void 0===window||window.removeEventListener("error",null==this?void 0:this.handleWindowError),null===window||void 0===window||window.removeEventListener("unhandledrejection",this.handleUnhandledRejection))},e.getInstance=function(){return e.instance||(e.instance=new e),e.instance},e.prototype.initialize=function(e,t){void 0===t&&(t=null);try{if(this.preInitQueue.length>0){var n={org_id:"UNINITALIZED",event_data:{message:"SDK Initialization Failed: Required parameter 'api_key' is ".concat(void 0===e?"undefined":null===e?"null":""===e?"empty string":"invalid: ".concat(e)),componentName:"ErrorTrackingService",additionalInfo:{preInitError:!0,apiKey:e,userId:t,timestamp:Date.now()},timestamp:Date.now()},metadata:st(),event_type:it.ERROR,user_id:t};this.sendLog(n).catch(console.error)}this.apiKey=e,this.userId=t,this.isInitialized=!0,this.processPreInitQueue()}catch(n){I.error("Error during ErrorTrackingService initialization:",n),this.preInitQueue.push({error:n instanceof Error?n:new Error(String(n)),componentName:"ErrorTrackingService",additionalInfo:{apiKey:e,userId:t}})}},e.prototype.processPreInitQueue=function(){return b(this,void 0,void 0,(function(){var e,t,n;return _(this,(function(i){switch(i.label){case 0:if(!this.preInitQueue.length)return[2];I.info("Processing ".concat(this.preInitQueue.length," pre-initialization errors")),e=0,t=this.preInitQueue,i.label=1;case 1:return e<t.length?(n=t[e],[4,this.trackError(n.error,n.componentName,y(y({},n.additionalInfo),{preInitError:!0}))]):[3,4];case 2:i.sent(),i.label=3;case 3:return e++,[3,1];case 4:return this.preInitQueue=[],[2]}}))}))},e.prototype.sendLog=function(e){return b(this,void 0,void 0,(function(){var t,n,i,o,r,a;return _(this,(function(l){switch(l.label){case 0:return l.trys.push([0,4,,5]),t=C().apiUrl,[4,fetch("".concat(t,"/users/sdk/record-logs/"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})];case 1:return(n=l.sent()).ok?[3,3]:(o=(i=I).error,r=["Failed to send error log:"],[4,n.text()]);case 2:o.apply(i,r.concat([l.sent()])),l.label=3;case 3:return[3,5];case 4:return a=l.sent(),I.error("Error sending log:",a),[3,5];case 5:return[2]}}))}))},e.prototype.trackError=function(e,t,n){return b(this,void 0,void 0,(function(){var i,o,r;return _(this,(function(a){switch(a.label){case 0:if(this.isInitialized)return[3,5];i={org_id:"UNINITALIZED",event_data:{message:e instanceof Error?e.message:e,stack:e instanceof Error?e.stack:void 0,componentName:t,additionalInfo:y(y({},n),{preInitError:!0,timestamp:Date.now()}),timestamp:Date.now()},metadata:st(),event_type:it.ERROR,user_id:this.userId},a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.sendLog(i)];case 2:return a.sent(),[3,4];case 3:return a.sent(),this.preInitQueue.push({error:e,componentName:t,additionalInfo:n}),I.warn("Error tracked before initialization, queuing:",e),[3,4];case 4:return[2];case 5:return o={message:e instanceof Error?e.message:e,stack:e instanceof Error?e.stack:void 0,componentName:t,additionalInfo:y(y({},n),{timestamp:Date.now()}),timestamp:Date.now()},r={org_id:this.apiKey||"UNINITALIZED",event_data:o,metadata:st(),event_type:it.ERROR,user_id:this.userId},[4,this.sendLog(r)];case 6:return a.sent(),[2]}}))}))},e.prototype.trackInfo=function(e,t,n){return b(this,void 0,void 0,(function(){var i,o;return _(this,(function(r){switch(r.label){case 0:return this.apiKey?(i={message:e,componentName:t,additionalInfo:n,timestamp:Date.now()},o={org_id:this.apiKey,event_data:i,metadata:st(),event_type:it.INFO,user_id:this.userId},[4,this.sendLog(o)]):(I.error("Error tracking not initialized"),[2]);case 1:return r.sent(),[2]}}))}))},e}(),ft=pt.getInstance(),mt="MISSING_API_KEY",ht="INVALID_API_KEY",vt="CONFIG_FETCH_FAILED",gt="SDK_INIT_FAILED",yt="ERROR_TRACKING_INIT_FAILED",bt="API_REQUEST_FAILED",_t="NETWORK_ERROR",wt="INVALID_RESPONSE",Et="IFRAME_LOAD_FAILED",It="COOKIE_ACCESS_ERROR",Tt="COMPONENT_RENDER_ERROR",xt="INITIALIZATION_ERROR",St="API_ERROR",At="RUNTIME_ERROR",Ct="COMPONENT_ERROR",Ot=((ct={})[mt]=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.")},ct[ht]=function(e){return"SDK Initialization Failed: Provided API key '".concat(e,"' is invalid. API key must be a non-empty string in UUID format.")},ct[vt]=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):"")},ct[bt]=function(e,t,n){return"API Request Failed: Server responded with status ".concat(e," for ").concat(n?"endpoint ".concat(n):"request"," - ").concat(t)},ct[_t]=function(e){return"Network Error: Failed to communicate with server".concat(e.url?" at ".concat(e.url):"").concat(e.error?" - ".concat(e.error):"")},ct[Et]=function(e){return"Failed to load chatbot interface".concat(e.src?" from ".concat(e.src):"").concat(e.error?". Error: ".concat(e.error):"")},ct[wt]=function(e){return"Invalid API Response: Missing required fields in response data: ".concat(e.join(", "))},ct[yt]=function(e){return"Error Tracking Service initialization failed".concat(e.apiKey?" for API key ".concat(e.apiKey):"").concat(e.error?". Error: ".concat(e.error):"")},ct[gt]=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)):"")},ct[It]=function(e,t){return"Cookie Access Error: Failed to ".concat(e).concat(t?" cookie '".concat(t,"'"):" cookies",". This may affect user session persistence.")},ct[Tt]=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):"")},ct),Rt=function(){var e,t=navigator.userAgent;if(null===(e=navigator.userAgentData)||void 0===e?void 0:e.brands){var n=navigator.userAgentData.brands.find((function(e){return"Google Chrome"===e.brand}));if(null==n?void 0:n.version)return n.version}var i=t.match(/(Chrome|Firefox|Safari|Edge|Opera)\/(\d+\.\d+)/);return i?i[2]:"Unknown"},Dt=function(){var e,t,n=st();return{current_page_url:(null===(e=null===window||void 0===window?void 0:window.location)||void 0===e?void 0:e.href)||"",browser_language:(null===navigator||void 0===navigator?void 0:navigator.language)||(null===(t=null===navigator||void 0===navigator?void 0:navigator.languages)||void 0===t?void 0:t[0])||"en",browser_version:Rt(),os:null==n?void 0:n.os,referral_url:(null===document||void 0===document?void 0:document.referrer)||"",system_info:n}},Nt=t((function(t){var i,a,l,s,c=t.config,d=t.isVisible,u=t.onClose,p=t.onEvent,f=t.onInternalEvent,m=t.position,h=t.bottomSpacing,v=t.overrides,g=n(null),b=n(!1),_=n(!1),w=m||(null===(i=c.interface_properties)||void 0===i?void 0:i.position)||"Right",E=null!==(l=null!=h?h:null===(a=c.interface_properties)||void 0===a?void 0:a.bottom_spacing)&&void 0!==l?l:20,I=r((function(){var e,t=g.current;if(t){var n=((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(E,"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)"})[w.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(t.style,n)}}),[E,w]);return o((function(){var e=g.current;if(e&&!b.current){var t=C().copilotUrl;Object.assign(e.style,{zIndex:"20000000",border:"none",boxShadow:"0px 0px 40px 0px rgba(14, 14, 15, 0.24)",transformOrigin:"bottom ".concat(w.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(t,"/chatbot-plugin?id=").concat(c.chatbotId),b.current=!0,I();var n=function(){var n,i,o,r,a,l,s,c,d,u,p,f=new URL(e.src).origin||t;if(null===(n=e.contentWindow)||void 0===n||n.postMessage({domain:null===(i=null===window||void 0===window?void 0:window.location)||void 0===i?void 0:i.hostname,name:"checkDomain"},f),v){var m={header_avatar:null!==(o=null==v?void 0:v.header_avatar)&&void 0!==o?o:null,agent_avatar:null!==(r=null==v?void 0:v.agent_avatar)&&void 0!==r?r:null,header_title:null!==(a=null==v?void 0:v.header_title)&&void 0!==a?a:null,header_subtitle:null!==(l=null==v?void 0:v.header_subtitle)&&void 0!==l?l:null,header_title_text_color:null!==(s=null==v?void 0:v.header_title_text_color)&&void 0!==s?s:null,header_subtitle_text_color:null!==(c=null==v?void 0:v.header_subtitle_text_color)&&void 0!==c?c:null,header_bg:null!==(d=null==v?void 0:v.header_bg)&&void 0!==d?d:null};null===(u=e.contentWindow)||void 0===u||u.postMessage({domain:null===(p=null===window||void 0===window?void 0:window.location)||void 0===p?void 0:p.hostname,action:"updateOverrides",data:m},t)}};return e.addEventListener("load",n),function(){return e.removeEventListener("load",n)}}}),[c.chatbotId,null===(s=c.interface_properties)||void 0===s?void 0:s.position,I,v]),o((function(){var e,t,n,i,o,r,a=g.current;if(a&&b.current){var l=(null===(e=c.interface_properties)||void 0===e?void 0:e.position)||"Right";if(d?(Object.assign(a.style,{transform:"scale(0.3) translate3d(0,40px,0)",opacity:"0",display:"block"}),a.getBoundingClientRect(),setTimeout((function(){Object.assign(a.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)):(a.style.transition="none",a.getBoundingClientRect(),Object.assign(a.style,{opacity:"0",transform:"scale(0.3) translate3d(".concat((l.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&&a&&(a.style.display="none")}),200)),a.contentWindow&&d){var s=C().copilotUrl;if(null===(t=null==a?void 0:a.contentWindow)||void 0===t||t.postMessage({domain:null===(n=null===window||void 0===window?void 0:window.location)||void 0===n?void 0:n.hostname,name:"openFrame"},s),!(null==_?void 0:_.current)){var u=V();null===(i=a.contentWindow)||void 0===i||i.postMessage({domain:null===(o=null===window||void 0===window?void 0:window.location)||void 0===o?void 0:o.hostname,action:"registerUserId",data:y({userId:null==c?void 0:c.userId,token:null==c?void 0:c.token,userProfile:y(y({},null==c?void 0:c.userProfile),{__INT_SYS_INFO__:y(y({},(null===(r=null==c?void 0:c.userProfile)||void 0===r?void 0:r.__INT_SYS_INFO__)||{}),Dt())}),isAnonymous:null==c?void 0:c.isAnonymous},u?{proactiveData:u}:{})},s),_.current=!0}}}}),[d,c.userId,c.token,c.userProfile]),o((function(){var e=function(e){var t,n;if(_.current&&g.current){var i=(null==e?void 0:e.detail)||{},o=C().copilotUrl;null===(t=g.current.contentWindow)||void 0===t||t.postMessage({domain:null===(n=null===window||void 0===window?void 0:window.location)||void 0===n?void 0:n.hostname,action:"proactiveClick",data:{userId:null==c?void 0:c.userId,token:null==c?void 0:c.token,userProfile:null==c?void 0:c.userProfile,isAnonymous:null==c?void 0:c.isAnonymous,proactiveData:{input_id:null,message_id:(null==i?void 0:i.message_id)||null,content_string:(null==i?void 0:i.content_string)||null}}},o)}};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]),o((function(){if(g.current&&b.current){var e=C().copilotUrl;d&&(null==p||p({type:x.CHATBOT_OPENED,timestamp:Date.now()}),f(x.CHATBOT_OPENED));var t=function(t){var n,i,o,r,a,l,s;if(t.origin===e){if("closeChatbot"===t.data)return void u();if("CHATBOT_TOKEN_EXHAUSTED"===(null===(n=t.data)||void 0===n?void 0:n.type))return void f(S.CHATBOT_TOKEN_EXHAUSTED);"CHATBOT_LOADED"===(null===(i=t.data)||void 0===i?void 0:i.type)&&(null==p||p({type:x.CHATBOT_LOADED,timestamp:Date.now()}),f(x.CHATBOT_LOADED)),"CHAT_INITIALIZED"===(null===(o=t.data)||void 0===o?void 0:o.type)&&(null==p||p({type:x.CHAT_INITIALIZED,timestamp:Date.now()}),f(x.CHAT_INITIALIZED)),"CHAT_INITIALIZATION_FAILED"===(null===(r=t.data)||void 0===r?void 0:r.type)&&(null==p||p({type:x.CHAT_INITIALIZATION_FAILED,timestamp:Date.now()}),f(x.CHAT_INITIALIZATION_FAILED,{error:null===(a=t.data)||void 0===a?void 0:a.error})),"SESSION_REFRESHED"===(null===(l=t.data)||void 0===l?void 0:l.type)&&(null==p||p({type:x.SESSION_REFRESHED,timestamp:Date.now()}),f(x.SESSION_REFRESHED)),"CHAT_MOVED"===(null===(s=t.data)||void 0===s?void 0:s.type)&&f(S.CHAT_MOVED,{from:t.data.from,to:t.data.to,trigger:t.data.trigger})}};return null===window||void 0===window||window.addEventListener("message",t),function(){return null===window||void 0===window?void 0:window.removeEventListener("message",t)}}}),[u,p,f,c.chatbotId,d]),o((function(){var e=g.current;if(e&&b.current){var t=function(){ft.trackError(new Error(Ot[Et]({src:e.src,error:"Failed to load iframe"})),"ChatbotIframe",{errorCode:Et,errorType:At,context:{config:c,iframeUrl:e.src,timestamp:Date.now()}})};return e.addEventListener("error",t),function(){return e.removeEventListener("error",t)}}}),[c]),o((function(){var e;if(g.current&&c&&d){var t=g.current,n=C().copilotUrl;null===(e=t.contentWindow)||void 0===e||e.postMessage({action:"updateUserProfile",user_profile:c.userProfile},n)}}),[c.userProfile,d]),e.createElement("iframe",{allow:"microphone",ref:g,id:"chat-iframe-rbyln",style:{display:"none"}})})),kt=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={hasError:!1},t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}d(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.getDerivedStateFromError=function(e){return{hasError:!0}},t.prototype.componentDidCatch=function(e,t){ft.trackError(new Error(Ot[Tt]({component:this.props.componentName||void 0,error:e.message,stack:t.componentStack})),this.props.componentName||void 0,{errorCode:Tt,errorType:Ct,context:{originalError:e,componentStack:t.componentStack,timestamp:Date.now()}})},t.prototype.render=function(){return this.state.hasError?null:this.props.children},t}(a),Lt=function(e,t,n){return b(void 0,void 0,void 0,(function(){var i,o,r,a,l,s,c,d;return _(this,(function(u){switch(u.label){case 0:i=C().apiUrl,o="".concat(i,"/chat/chatbot/get/"),I.log("endpointUrl",o),r={client_user_id:t,org_id:e,token:n||void 0,extra_info:{},launcher_info:Dt()},u.label=1;case 1:return u.trys.push([1,6,,7]),[4,fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})];case 2:return(a=u.sent()).ok?[3,4]:[4,a.text()];case 3:throw l=u.sent(),new Error(Ot[bt](a.status,l));case 4:return[4,a.json()];case 5:s=u.sent();try{String(r.org_id||"")}catch(e){}if(!(null===(d=null==s?void 0:s.user)||void 0===d?void 0:d.org_info))throw new Error(Ot[wt](["user","org_info"]));return[2,s];case 6:throw c=u.sent(),ft.trackError(c instanceof Error?c:new Error(Ot[_t]({error:String(c)})),"fetchChatbotConfig",{errorCode:c instanceof Error&&c.message.includes("API Request Failed")?bt:_t,errorType:St,context:{chatbotId:e,userId:t,apiUrl:i,statusCode:c instanceof Response?c.status:void 0,timestamp:Date.now(),requestPayload:{client_user_id:t,org_id:e}}}),c;case 7:return[2]}}))}))},Mt=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},zt=function(e){var t,n="; ".concat(document.cookie).split("; ".concat(e,"="));if(2===n.length)return null===(t=n.pop())||void 0===t?void 0:t.split(";").shift()},Ft=function(e,t,n){var i=new Date;i.setTime(i.getTime()+24*n*60*60*1e3),document.cookie="".concat(e,"=").concat(t,";expires=").concat(i.toUTCString(),";path=/")},Ht=function(e){var t=e?"USER_DATA=%7B%22attributes%22%3A%5B%7B%22key%22%3A%22USER_ATTRIBUTE_USER_EMAIL%22%2C%22value%22%3A%22dinesh.goel%40robylon.ai%22%7D%2C%7B%22key%22%3A%22USER_ATTRIBUTE_UNIQUE_ID%22%2C%22value%22%3A%2266011f2c28d1787d13c6c796%22%7D%5D%2C%22subscribedToOldSdk%22%3Afalse%2C%22deviceUuid%22%3A%2226c02feb-2664-451d-8469-9cf1378547c6%22%2C%22deviceAdded%22%3Atrue%7D; _ga_3YS9P6ZDWX=GS1.1.1715252584.3.1.1715258696.39.0.0; _ga_V4J24F7YF9=GS1.1.1715273274.2.0.1715273274.0.0.0; city_name=Bengaluru; lang_code=en-in; cookieConcent=A; _gcl_au=1.1.343275043.1717154298; _clck=43guwd%7C2%7Cfmi%7C0%7C1561; _gid=GA1.2.1423066649.1718210058; moe_uuid=26c02feb-2664-451d-8469-9cf1378547c6; _ga_6RM65PWEZY=GS1.1.1718210058.18.1.1718211647.60.0.0; _ga=GA1.1.689213983.1712737672; AMP_MKTG_fe4beb374f=JTdCJTIycmVmZXJyZXIlMjIlM0ElMjJodHRwcyUzQSUyRiUyRmFjY291bnRzLnRlYWNobWludC5jb20lMkYlMjIlMkMlMjJyZWZlcnJpbmdfZG9tYWluJTIyJTNBJTIyYWNjb3VudHMudGVhY2htaW50LmNvbSUyMiU3RA==; AMP_fe4beb374f=JTdCJTIyZGV2aWNlSWQlMjIlM0ElMjI0MWMxMTljZC03YzVjLTRiYTctYTUzZS1mYTgzMjRlYjc0OWUlMjIlMkMlMjJ1c2VySWQlMjIlM0ElMjIxZjI2ODAwOC01OGYxLTQwYTItYjQ0Ni1mYmQ5N2E0NDQyYTAlMjIlMkMlMjJzZXNzaW9uSWQlMjIlM0ExNzE4MjEzMzEwOTc3JTJDJTIyb3B0T3V0JTIyJTNBZmFsc2UlMkMlMjJsYXN0RXZlbnRUaW1lJTIyJTNBMTcxODIxMzMxMDk4MSUyQyUyMmxhc3RFdmVudElkJTIyJTNBMTQlN0Q=; _ga_3YS9P6ZDWX=GS1.1.1718211637.26.1.1718213441.60.0.0; SESSION=%7B%22sessionKey%22%3A%22e4d76f52-9053-4277-99a4-f1ba667fd5f2%22%2C%22sessionStartTime%22%3A%222024-06-12T16%3A34%3A19.047Z%22%2C%22sessionMaxTime%22%3A1800%2C%22customIdentifiersToTrack%22%3A%5B%5D%2C%22sessionExpiryTime%22%3A1718215247464%2C%22numberOfSessions%22%3A17%7D":document.cookie;return t=t.split(";").map((function(e){var t=e.split("="),n=t[0],i=t.slice(1).join("=").trim();return{name:n=n.trim(),value:i?decodeURIComponent(i):""}})),t},Ut=function(){function e(e){this.logoContainer=null,this.iframe=null,this.bubblePromptContainer=null,this.chatBtnImage=null,this.config=e,this.validateDomain()&&this.init(),null===window||void 0===window||window.addEventListener("message",this.onCloseListener.bind(this),!1)}return e.prototype.onCloseListener=function(e){e.origin===this.config.domain&&"closeChatbot"===e.data&&this.closeIframe()},e.prototype.validateDomain=function(){var e,t=this.config.domain,n=null===(e=null===window||void 0===window?void 0:window.location)||void 0===e?void 0:e.origin;return I.log("expectedDomain, to current domain",t,n,t===n),t===n},e.prototype.createChatBubblContainer=function(){var e,t=this,n=document.createElement("div");n.id="chatbase-message-bubbles",Object.assign(n.style,{position:"fixed",bottom:"80px",borderRadius:"10px",fontFamily:"sans-serif",fontSize:"16px",zIndex:"2147483644",cursor:"pointer",flexDirection:"column",gap:"50px",maxWidth:"70vw",display:"block",right:"1rem",left:"unset"});var i=document.createElement("div");i.classList.add("close-btn"),i.textContent="✕",Object.assign(i.style,{position:"absolute",top:"-7px",right:"-7px",fontWeight:"bold",display:"none",justifyContent:"center",alignItems:"center",zIndex:"2147483643",width:"22px",height:"22px",borderRadius:"50%",textAlign:"center",fontSize:"12px",cursor:"pointer",backgroundColor:"rgb(224, 224, 224)",color:"black",boxShadow:"rgba(150, 150, 150, 0.15) 0px 6px 24px 0px, rgba(150, 150, 150, 0.15) 0px 0px 0px 1px"}),((null===(e=this.config.chat_interface_config)||void 0===e?void 0:e.chat_bubble_prompts)||[]).forEach((function(e){var i=t.createMessageBubble(e);n.appendChild(i)})),n.appendChild(i),document.body.appendChild(n)},e.prototype.createMessageBubble=function(e){var t=document.createElement("div");this.bubblePromptContainer=t,Object.assign(t.style,{display:"flex",position:"relative",justifyContent:"flex-end"});var n=document.createElement("div");n.classList.add("message"),n.textContent=e,Object.assign(n.style,{backgroundColor:"white",color:"black",boxShadow:"rgba(150, 150, 150, 0.2) 0px 10px 30px 0px, rgba(150, 150, 150, 0.2) 0px 0px 0px 1px",borderRadius:"10px",padding:"8px 5px",margin:"8px",fontSize:"14px",opacity:"1",transform:"scale(1)",transition:"opacity 0.5s ease 0s, transform 0.5s ease 0s"});var i=document.createElement("button");return i.innerHTML="×",Object.assign(i.style,{position:"absolute",top:"1px",left:"-3px",width:"20px",height:"20px",borderRadius:"50%",backgroundColor:"#fff",color:"#000",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 2px 5px rgba(0,0,0,0.2)",fontSize:"14px",lineHeight:"1",padding:"0",zIndex:"100"}),i.addEventListener("click",(function(){t.remove()})),t.appendChild(i),t.appendChild(n),t},e.prototype.createFloatingButton=function(){var e=document.createElement("div");e.classList.add("message-bubble-container"),Object.assign(e.style,{position:"fixed",bottom:"1.5rem",right:"1.5rem",zIndex:"1000",width:"48px",height:"48px",display:"flex",flexDirection:"column-reverse",backgroundColor:this.config.brand_colour,color:E(this.config.brand_colour),borderRadius:"50%",alignItems:"center",justifyContent:"center",cursor:"pointer",overflow:"hidden"}),document.body.appendChild(e),this.logoContainer=e,this.loadImage(this.logoContainer),this.createChatBubblContainer(),this.logoContainer.addEventListener("click",this.toggleIframe.bind(this))},e.prototype.loadImage=function(e){var t,n,i=document.createElement("img");i.src=this.config.launcher_type?(null===(n=null===(t=this.config.images)||void 0===t?void 0:t.launcher_image_url)||void 0===n?void 0:n.url)||"".concat(this.config.domain,"/chatbubble.png"):this.config.image_url||"".concat(this.config.domain,"/chatbubble.png"),i.alt="Chat",Object.assign(i.style,{zIndex:"1000",cursor:"pointer",borderRadius:"50%",objectFit:"cover"}),this.chatBtnImage=i,e.innerHTML="",e.appendChild(i)},e.prototype.createIframe=function(){var e=this;I.log("RobylonConfig?.domain====>",this.config.domain);var t=document.createElement("iframe");Object.assign(t.style,{position:"fixed",right:"32px",bottom:"86px",minWidth:"400px",width:"26%",maxWidth:"800px",top:"calc(10vh - 32px)",maxHeight:"45rem",height:"calc(100vh - 3rem - 10vh)",zIndex:"20000000",border:"none",boxShadow:"0px 0px 40px 0px rgba(14, 14, 15, 0.24)",transformOrigin:"bottom right",transition:"transform 0.3s ease-out",borderRadius:"1rem",display:"none"}),t.src="".concat(this.config.domain,"/chatbot-plugin?id=").concat(this.config.chatbotId),I.log("iframe.src====>",t.src),document.body.appendChild(t),this.iframe=t;var n=function(){(null===window||void 0===window?void 0:window.innerWidth)<560?Object.assign(t.style,{width:"100vw",minWidth:"300px",right:"0",bottom:"0",height:"100vh",flexDirection:"column",flexGrow:"1",borderRadius:"0",top:"0",maxHeight:"100%"}):Object.assign(t.style,{width:"26%",minWidth:"400px",right:"32px",bottom:"86px",height:"calc(100vh - 3rem - 10vh)",borderRadius:"1rem",top:"calc(10vh - 32px)",maxHeight:"45rem"})};n(),null===window||void 0===window||window.addEventListener("resize",n),t.addEventListener("load",(function(){var n,i,o,r,a;if(e.iframe){var l=new URL(e.iframe.src).origin||e.config.domain;null===(n=t.contentWindow)||void 0===n||n.postMessage({domain:null===(i=null===window||void 0===window?void 0:window.location)||void 0===i?void 0:i.hostname,name:"checkDomain"},l),null===(o=t.contentWindow)||void 0===o||o.postMessage({domain:null===(r=null===window||void 0===window?void 0:window.location)||void 0===r?void 0:r.hostname,action:"registerUserId",data:{userId:e.config.userId,token:e.config.token,userProfile:y(y({},e.config.userProfile||{}),{__INT_SYS_INFO__:y(y({},(null===(a=e.config.userProfile)||void 0===a?void 0:a.__INT_SYS_INFO__)||{}),Dt())})}},l)}})),null===window||void 0===window||window.addEventListener("message",(function(n){var i,o;if(n.origin===e.config.domain){if("captureSessionData"===n.data){var r="66b33d16-5b38-4693-8772-1a1bd7dd412d"===e.config.chatbotId,a={cookies:Ht(r),localStorage:JSON.stringify(localStorage),sessionStorage:JSON.stringify(sessionStorage),action:"capturedSessionData",domain_name:null===(i=null===window||void 0===window?void 0:window.location)||void 0===i?void 0:i.hostname};null===(o=t.contentWindow)||void 0===o||o.postMessage(a,e.config.domain||"*")}"expand"===n.data&&(e.adjustIframeWidth(),t.style.height="calc(100vh - 120px)",t.style.bottom="86px"),"collapse"===n.data&&Object.assign(t.style,{width:"26%",height:"calc(100vh - 32px - 10vh)",bottom:"86px",top:"calc(32px + 10vh)"})}}))},e.prototype.adjustIframeWidth=function(){if(this.iframe){var e=null===window||void 0===window?void 0:window.innerWidth;I.log("screenWidth",e),this.iframe.style.width=e<832?"".concat(e-64,"px"):"800px"}},e.prototype.loadSvgInline=function(e){var t=document.createElement("div");t.innerHTML='\n<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <g id="Chevron_Down">\n <path id="Vector" d="M19 9L12 16L5 9" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>\n </g>\n</svg>\n';var n=t.querySelector("svg");e.innerHTML="",n&&e.appendChild(n)},e.prototype.toggleIcon=function(e,t){"block"===t.style.display?this.loadSvgInline(e):this.loadImage(e)},e.prototype.toggleIframe=function(){var e;if(I.log("toggleIframe",this.iframe,this.logoContainer,this.chatBtnImage),this.iframe&&this.logoContainer&&this.chatBtnImage){var t=new URL(this.iframe.src).origin||this.config.domain;I.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"},t),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"),I.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(),this.createFloatingButton()},e}(),Bt=function(e,t,n){if(e.chatbotId&&e.userId)try{new Ut(e);t(!0),I.log("Robylon SDK initialized successfully.")}catch(e){n(e instanceof Error?e.message:"Failed to initialize SDK")}else n("Incomplete configuration for SDK initialization.")},Pt=function(e,t,n){return b(void 0,void 0,void 0,(function(){var i,o,r,a,l,s,c,d;return _(this,(function(u){switch(u.label){case 0:return u.trys.push([0,5,,6]),i=C().apiUrl,o="".concat(i,"/chat/chatbot/get/"),I.log("endpointUrl",o),r={client_user_id:t||null,org_id:e,token:n||void 0,extra_info:{},launcher_info:Dt()},[4,fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})];case 1:return(a=u.sent()).ok?[3,3]:[4,a.text()];case 2:throw l=u.sent(),new Error(Ot[bt](a.status,l));case 3:return[4,a.json()];case 4:if(s=u.sent(),!(null===(d=null==s?void 0:s.user)||void 0===d?void 0:d.org_info))throw new Error(Ot[wt](["user","org_info"]));return[2,s];case 5:throw c=u.sent(),ft.trackError(c instanceof Error?c:new Error(Ot[_t]({error:String(c)})),"fetchChatbotConfig",{errorCode:c instanceof Error&&c.message.includes("API Request Failed")?bt:_t,errorType:St,context:{apiKey:e,userId:t,timestamp:Date.now()}}),c;case 6:return[2]}}))}))},Wt=function(e){return b(void 0,void 0,void 0,(function(){var t,n,i,o,r,a,l,s,c,d,m,h,v,g,b,w,E,T,x,S,A,C,O,R,D,N,k,L,M,z,F,H,U,B;return _(this,(function(_){switch(_.label){case 0:return t=function(e){return{api_key:String(e.api_key||""),user_id:e.user_id?String(e.user_id):null,user_token:e.user_token?String(e.user_token):void 0,user_profile:e.user_profile||{}}}(e),n=t.user_id||void 0,i=!1,n||(n=zt("rblyn_anon")||Mt(),Ft("rblyn_anon",n,365),i=!0),[4,Pt(t.api_key,n,t.user_token)];case 1:o=_.sent();try{t.api_key}catch(e){I.warn("Failed to inject mock proactive messages",e)}return r=st(),a=Dt(),P=t.user_profile,l=P?Object.fromEntries(Object.entries(P).map((function(e){var t=e[0],n=e[1];return"boolean"==typeof n||"number"==typeof n?[t,n]:[t,String(n)]}))):{},s=y(y(y({},r),{__INT_SYS_INFO__:y(y({},r),a)}),l),[2,{chatbotId:t.api_key,userId:n,token:t.user_token,isAnonymous:i,domain:"",show_launcher:null===(d=null===(c=o.user.org_info)||void 0===c?void 0:c.show_launcher)||void 0===d||d,brand_colour:(null===(h=null===(m=o.user.org_info.brand_config)||void 0===m?void 0:m.colors)||void 0===h?void 0:h.brand_color)||"",image_url:(null===(g=null===(v=o.user.org_info)||void 0===v?void 0:v.brand_config)||void 0===g?void 0:g.launcher_logo_url)||"",userProfile:s,chat_interface_config:{chat_bubble_prompts:[],display_name:(null===(b=o.user.org_info.brand_config)||void 0===b?void 0:b.display_name)||"",welcome_message:(null===(w=o.user.org_info.brand_config)||void 0===w?void 0:w.welcome_message)||"Hey! What can we help you with today?",redirect_url:(null===(E=o.user.org_info.brand_config)||void 0===E?void 0:E.redirect_url)||""},launcher_type:(null===(T=o.user.org_info.brand_config)||void 0===T?void 0:T.launcher_type)||f.IMAGE,launcher_properties:{text:(null===(S=null===(x=o.user.org_info.brand_config)||void 0===x?void 0:x.launcher_properties)||void 0===S?void 0:S.text)||""},images:{launcher_image_url:{url:(null===(O=null===(C=null===(A=o.user.org_info.brand_config)||void 0===A?void 0:A.images)||void 0===C?void 0:C.launcher_image_url)||void 0===O?void 0:O.url)||""}},proactive_message_obj:jt(null===(N=null===(D=null===(R=null==o?void 0:o.user)||void 0===R?void 0:R.org_info)||void 0===D?void 0:D.brand_config)||void 0===N?void 0:N.proactive_message_obj),interface_properties:{position:(null===(L=null===(k=o.user.org_info.brand_config)||void 0===k?void 0:k.interface_properties)||void 0===L?void 0:L.position)||p.RIGHT,side_spacing:(null===(z=null===(M=o.user.org_info.brand_config)||void 0===M?void 0:M.interface_properties)||void 0===z?void 0:z.side_spacing)||20,bottom_spacing:(null===(H=null===(F=o.user.org_info.brand_config)||void 0===F?void 0:F.interface_properties)||void 0===H?void 0:H.bottom_spacing)||20},interface_type:(null===(U=o.user.org_info.brand_config)||void 0===U?void 0:U.interface_type)||u.WIDGET,launcher_delay:(null===(B=o.user.org_info.brand_config)||void 0===B?void 0:B.launcher_delay)||{enabled:!1,delay:0}}]}var P}))}))},jt=function(e){if(e){var t=(Array.isArray(e)?e:[e]).filter(Boolean).map((function(e){var t,n,i={message_id:String(null!==(t=null==e?void 0:e.message_id)&&void 0!==t?t:""),org_id:String(null!==(n=null==e?void 0:e.org_id)&&void 0!==n?n:""),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,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)&&I.warn("[Robylon SDK] proactive_message.content is deprecated; use content_multiple[].message instead."),i}));return t.length?t:void 0}},Gt=function(e){var t=l((function(){return function(e){return{api_key:String(e.api_key||""),user_id:e.user_id?String(e.user_id):null,user_token:e.user_token?String(e.user_token):void 0,user_profile:e.user_profile||{}}}(e)}),[e.api_key,e.user_id,e.user_token,JSON.stringify(e.user_profile)]),n=i({isInitialized:!1,isInitializing:!1,error:null,chatbotConfig:null,isIframeVisible:!1}),a=n[0],s=n[1],c=l((function(){return t.user_profile?Object.fromEntries(Object.entries(t.user_profile).map((function(e){var t=e[0],n=e[1];return"boolean"==typeof n||"number"==typeof n?[t,n]:[t,String(n)]}))):{}}),[JSON.stringify(t.user_profile)]),d=r((function(e){s((function(t){return y(y({},t),e)}))}),[]),m=r((function(){return b(void 0,void 0,void 0,(function(){var e,n,i,o,r,a,l,s,m,h,v,g,b,w,E,I,T,x,S,A,C,O,R,D,N,k,L,M,z,F,H,U,B,P,W,j,G,X;return _(this,(function(_){switch(_.label){case 0:if(!t.api_key)return ft.trackError(new Error(Ot[mt](t.api_key)),"useChatbotState",{errorCode:mt,errorType:xt,context:{timestamp:Date.now()}}),[2];d({isInitializing:!0}),_.label=1;case 1:return _.trys.push([1,4,5,6]),e=t.user_id||void 0,n=!1,e||(e=zt("rblyn_anon")||Mt(),Ft("rblyn_anon",e,365),n=!0),[4,Lt(t.api_key,e,t.user_token)];case 2:return i=_.sent(),o=st(),r=Dt(),a=y(y(y({},o),{__INT_SYS_INFO__:y(y({},o),r)}),c),l={chatbotId:t.api_key,userId:e,token:t.user_token,isAnonymous:n,domain:"",show_launcher:null===(v=null===(h=i.user.org_info)||void 0===h?void 0:h.show_launcher)||void 0===v||v,brand_colour:(null===(b=null===(g=i.user.org_info.brand_config)||void 0===g?void 0:g.colors)||void 0===b?void 0:b.brand_color)||"",image_url:(null===(E=null===(w=i.user.org_info)||void 0===w?void 0:w.brand_config)||void 0===E?void 0:E.launcher_logo_url)||"",userProfile:a,chat_interface_config:{chat_bubble_prompts:[],display_name:(null===(I=i.user.org_info.brand_config)||void 0===I?void 0:I.display_name)||"",welcome_message:(null===(T=i.user.org_info.brand_config)||void 0===T?void 0:T.welcome_message)||"Hey! What can we help you with today?",redirect_url:(null===(x=i.user.org_info.brand_config)||void 0===x?void 0:x.redirect_url)||""},interface_properties:{position:(null===(A=null===(S=i.user.org_info.brand_config)||void 0===S?void 0:S.interface_properties)||void 0===A?void 0:A.position)||p.RIGHT,side_spacing:null!==(R=null===(O=null===(C=i.user.org_info.brand_config)||void 0===C?void 0:C.interface_properties)||void 0===O?void 0:O.side_spacing)&&void 0!==R?R:20,bottom_spacing:null!==(k=null===(N=null===(D=i.user.org_info.brand_config)||void 0===D?void 0:D.interface_properties)||void 0===N?void 0:N.bottom_spacing)&&void 0!==k?k:20},interface_type:(null===(L=i.user.org_info.brand_config)||void 0===L?void 0:L.interface_type)||u.WIDGET,launcher_type:(null===(M=i.user.org_info.brand_config)||void 0===M?void 0:M.launcher_type)||f.IMAGE,launcher_properties:{text:(null===(F=null===(z=i.user.org_info.brand_config)||void 0===z?void 0:z.launcher_properties)||void 0===F?void 0:F.text)||""},images:{launcher_image_url:{url:(null===(B=null===(U=null===(H=i.user.org_info.brand_config)||void 0===H?void 0:H.images)||void 0===U?void 0:U.launcher_image_url)||void 0===B?void 0:B.url)||""}},proactive_message_obj:jt(null===(j=null===(W=null===(P=null==i?void 0:i.user)||void 0===P?void 0:P.org_info)||void 0===W?void 0:W.brand_config)||void 0===j?void 0:j.proactive_message_obj),launcher_delay:(null===(X=null===(G=i.user.org_info)||void 0===G?void 0:G.brand_config)||void 0===X?void 0:X.launcher_delay)||{enabled:!1,delay:0}},[4,new Promise((function(e,t){Bt(l,(function(){d({isInitialized:!0,chatbotConfig:l}),e()}),(function(e){t(e)}))}))];case 3:return _.sent(),[3,6];case 4:return s=_.sent(),m=s instanceof Error?s.message:"Failed to initialize chatbot",d({error:m}),ft.trackError(s instanceof Error?s:new Error(m),"useChatbotState",{errorCode:gt,errorType:xt,context:{timestamp:Date.now()}}),[3,6];case 5:return d({isInitializing:!1}),[7];case 6:return[2]}}))}))}),[t.api_key,t.user_id,t.user_token]);o((function(){t.api_key&&m()}),[m]),o((function(){a.chatbotConfig&&s((function(e){return y(y({},e),{chatbotConfig:y(y({},e.chatbotConfig),{userProfile:y(y({},st()),c)})})}))}),[c]);var h=r((function(){s((function(e){return y(y({},e),{isIframeVisible:!e.isIframeVisible})}))}),[]),v=r((function(){d({isIframeVisible:!1})}),[]);return y(y({},a),{toggleIframeVisibility:h,closeIframe:v})},Xt=function(t){var n,r,a,l,s,c,d,u=t.children,p=t.config,f=t.position,m=t.sideSpacing,h=t.bottomSpacing,v=i(!1),g=v[0],b=v[1];o((function(){var e=function(){var e=(null===window||void 0===window?void 0:window.innerWidth)<560;b(e)};return e(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[]);var _=f||(null===(a=p.interface_properties)||void 0===a?void 0:a.position)||"Right",w=null!==(s=null!=m?m:null===(l=p.interface_properties)||void 0===l?void 0:l.side_spacing)&&void 0!==s?s:20,E=null!==(d=null!=h?h:null===(c=p.interface_properties)||void 0===c?void 0:c.bottom_spacing)&&void 0!==d?d:20;I.log("config",p,_,w);var T={position:"fixed",zIndex:1e3,display:"flex",flexDirection:"column"},x=y(y({},T),((n={bottom:"".concat(E,"px")})[_.toLowerCase()]="".concat(null!=w?w:20,"px"),n.alignItems="Right"===_?"flex-end":"flex-start",n.top=void 0,n["Right"===_?"left":"right"]=void 0,n)),S=y(y({},T),((r={top:0})[_.toLowerCase()]="".concat(null!=w?w:20,"px"),r.alignItems="center",r.bottom=void 0,r["Right"===_?"left":"right"]=void 0,r)),A=g?S:x;return o((function(){console.log("Container screen width changed, isMobile:",g,"Style:",A)}),[g,A]),e.createElement("div",{className:"robylon-chatbot-container",style:A},u)},Vt=s((function(t,n){var a,s,d,u=t.api_key,p=t.user_id,f=t.user_token,m=t.user_profile,h=t.onEvent,v=t.position,g=t.sideSpacing,E=t.bottomSpacing,T=t.show_launcher,S=t.launcher_type,A=t.launcher_properties_text,O=t.overrides,R=t.launcher_size,D="string"==typeof g?""===g||isNaN(Number(g))?void 0:Number(g):g,N="string"==typeof E?""===E||isNaN(Number(E))?void 0:Number(E):E,k="string"==typeof v?"left"===v.toLowerCase()?"Left":"right"===v.toLowerCase()?"Right":void 0:v;o((function(){}));var L=l((function(){return{api_key:u,user_id:p,user_token:f,user_profile:m}}),[u,p,f,m]),M=r((function(e){null==h||h(e)}),[h]),z=Gt(L),F=z.isInitialized,H=z.error,U=z.chatbotConfig,B=z.isIframeVisible,P=z.toggleIframeVisibility,W=z.closeIframe,j=l((function(){return{api_key:u,user_profile:L.user_profile,onEvent:M,chatbotConfig:U?{isAnonymous:U.isAnonymous,userId:U.userId}:null}}),[u,L.user_profile,M,null==U?void 0:U.isAnonymous,null==U?void 0:U.userId]),G=function(e){var t=e.api_key,n=e.chatbotConfig,i=e.user_profile,o=e.onEvent,a=l((function(){return{isAnonymous:(null==n?void 0:n.isAnonymous)||!1,userId:(null==n?void 0:n.userId)||""}}),[null==n?void 0:n.isAnonymous,null==n?void 0:n.userId]),s=l((function(){return i||{}}),[JSON.stringify(i)]),c=r((function(e){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];return b(void 0,w([e],n,!0),void 0,(function(e,n){var i,o,r,l,c,d,u;return void 0===n&&(n={}),_(this,(function(p){switch(p.label){case 0:if(!t)return[2];p.label=1;case 1:return p.trys.push([1,3,,4]),i=C().apiUrl,o=st(),r=y({trigger_time:Date.now(),channel:"CHATBOT",launch_url:(null===(u=null===window||void 0===window?void 0:window.location)||void 0===u?void 0:u.href)||"",org_id:t,client_user_id:a.isAnonymous?"Anonymous":String(a.userId),event_type:e,user_profile:s},n),l={org_id:t,event_data:r,metadata:y({timestamp:Date.now()},o),event_type:"INFO",user_id:a.userId},[4,fetch("".concat(i,"/users/sdk/record-logs/"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)})];case 2:if(!(c=p.sent()).ok)throw new Error("Failed to send internal event: ".concat(c.statusText));return[3,4];case 3:return d=p.sent(),I.error("Failed to send internal event:",d),[3,4];case 4:return[2]}}))}))}),[t,a]);return{emitEvent:r((function(e,t){var n=Date.now();e!==x.CHATBOT_BUTTON_CLICKED&&e!==x.CHATBOT_CLOSED&&e!==x.CHATBOT_OPENED&&e!==x.CHATBOT_READY||(o&&o({type:e,timestamp:n,data:t}),c(e,{timestamp:n}))}),[o,c]),onInternalEvent:c}}(y({},j)),X=G.emitEvent,V=G.onInternalEvent;c(n,(function(){return{show:function(){F&&U?B||(P(),X(x.CHATBOT_BUTTON_CLICKED)):console.warn("Robylon Chatbot: Cannot show - chatbot not ready yet")},hide:function(){F&&U?B&&(W(),X(x.CHATBOT_CLOSED)):console.warn("Robylon Chatbot: Cannot hide - chatbot not ready yet")},toggle:function(){F&&U?(P(),X(B?x.CHATBOT_CLOSED:x.CHATBOT_BUTTON_CLICKED)):console.warn("Robylon Chatbot: Cannot toggle - chatbot not ready yet")},isReady:F&&!!U}}),[F,U,B,P,W,X]),o((function(){F&&U&&X(x.CHATBOT_READY)}),[F,U,X]);var Y=i(!1),K=Y[0],J=Y[1];o((function(){var e,t,n,i,o,r,a;if(!(void 0!==T?Boolean(T):null===(e=null==U?void 0:U.show_launcher)||void 0===e||e))return J(!1),function(){a&&clearTimeout(a)};var l=!0===(null===(t=null==U?void 0:U.launcher_delay)||void 0===t?void 0:t.enabled),s=null!==(r=null!==(i=null===(n=null==U?void 0:U.launcher_delay)||void 0===n?void 0:n.seconds)&&void 0!==i?i:null===(o=null==U?void 0:U.launcher_delay)||void 0===o?void 0:o.delay)&&void 0!==r?r:0;return l&&Number(s)>0?(J(!1),a=window.setTimeout((function(){J(!0)}),1e3*Number(s))):J(!0),function(){a&&clearTimeout(a)}}),[T,null==U?void 0:U.show_launcher,null===(a=null==U?void 0:U.launcher_delay)||void 0===a?void 0:a.enabled,null===(s=null==U?void 0:U.launcher_delay)||void 0===s?void 0:s.seconds,null===(d=null==U?void 0:U.launcher_delay)||void 0===d?void 0:d.delay]),o((function(){if(u)try{ft.initialize(u,p)}catch(e){ft.trackError(e instanceof Error?e:new Error(String(e)),"RobylonChatbot",{errorCode:yt,errorType:xt,context:{timestamp:Date.now()}})}else ft.trackError(new Error(Ot[mt](u)),"RobylonChatbot",{errorCode:mt,errorType:xt,context:{timestamp:Date.now()}})}),[u,p]);var Z=r((function(){W(),X(x.CHATBOT_CLOSED)}),[W,X]),q=r((function(){P(),X(B?x.CHATBOT_CLOSED:x.CHATBOT_BUTTON_CLICKED)}),[P,X,B]),Q=l((function(){var e,t,n,i,o;return{config:U,toggleIframe:q,isIframeVisible:B,onEvent:M,onInternalEvent:V,position:k,sideSpacing:D,bottomSpacing:N,launcher_type:S,launcher_properties_text:A,shouldFadeIn:!0===(null===(e=null==U?void 0:U.launcher_delay)||void 0===e?void 0:e.enabled)&&(null!==(o=null!==(n=null===(t=null==U?void 0:U.launcher_delay)||void 0===t?void 0:t.seconds)&&void 0!==n?n:null===(i=null==U?void 0:U.launcher_delay)||void 0===i?void 0:i.delay)&&void 0!==o?o:0)>0||!1,launcher_size:R}}),[U,q,B,M,V,k,D,N,S,A,R]);I.log("floatingButtonProps",Q);var $=l((function(){return{config:U,isVisible:B,onClose:Z,onEvent:M,onInternalEvent:V,position:k,bottomSpacing:N,overrides:O}}),[U,B,Z,M,V,k,N,O]);return u&&!H&&U?e.createElement(kt,{componentName:"RobylonChatbot"},F?e.createElement(Xt,{config:U,position:k,sideSpacing:D,bottomSpacing:N},e.createElement(kt,{componentName:"ChatbotIframe"},e.createElement(Nt,y({},$))),e.createElement(kt,{componentName:"ChatbotFloatingButton"},K?e.createElement(ot,y({},Q)):null)):null):null})),Yt=t(Vt,(function(e,t){return e.api_key===t.api_key&&e.user_id===t.user_id&&e.user_token===t.user_token&&JSON.stringify(e.user_profile)===JSON.stringify(t.user_profile)&&e.position===t.position&&e.sideSpacing===t.sideSpacing&&e.bottomSpacing===t.bottomSpacing&&e.show_launcher===t.show_launcher&&e.launcher_type===t.launcher_type&&e.launcher_properties_text===t.launcher_properties_text&&JSON.stringify(e.overrides)===JSON.stringify(t.overrides)&&e.launcher_size===t.launcher_size&&!0})),Kt=function(e){var t=i({isLoading:!0,isInitialized:!1,error:null}),n=t[0],r=t[1],a=function(e){r((function(t){return y(y({},t),{isInitialized:e})}))},l=function(e){r((function(t){return y(y({},t),{error:e})}))};return o((function(){!function(){try{Bt(e,a,l)}catch(e){r((function(t){return y(y({},t),{error:e instanceof Error?e.message:"Failed to initialize SDK",isLoading:!1})}))}}()}),[e.chatbotId,e.userId]),n},Jt=function(){function e(e){var t=this;this.resizeObserver=null,this.proactiveElement=null,this.urlUnsubscribe=null,this.delayTimers=[],this.config=e,this.buttonElement=document.createElement("div"),this.handleResizeFunction=this.handleResize.bind(this),this.render(),this.mount();try{this.buttonElement.style.opacity="0",this.buttonElement.style.transition="transform 0.2s cubic-bezier(0.2, 1.27, 0.29, 0.97), opacity 280ms ease",requestAnimationFrame((function(){t.buttonElement.style.opacity="1"}))}catch(e){}this.setupResizeListener(),this.renderProactiveIfNeeded(),this.urlUnsubscribe=H((function(){t.clearProactiveDelays(),t.renderProactiveIfNeeded(!0)}))}return e.prototype.render=function(){var e,t=this;C().copilotUrl;var n=this.config,i=n.config,o=n.isIframeVisible,r=null!==(e=this.config.launcher_size)&&void 0!==e?e:48,a={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:o?"scale(0.85)":"scale(1)",fontFamily:R};i.launcher_type===f.IMAGE&&Object.assign(a,{width:"".concat(r,"px"),height:"".concat(r,"px"),borderRadius:"50%",backgroundColor:i.brand_colour}),this.applyResponsiveStyles(a),this.buttonElement.className="message-bubble-container",this.buttonElement.innerHTML="",this.buttonElement.appendChild(this.createLauncherElement()),this.buttonElement.onclick=function(){t.config.toggleIframe(),t.hideProactiveMessages()},this.renderProactiveIfNeeded()},e.prototype.createLauncherElement=function(){var e,t,n,i=this.config,o=i.config,r=i.isIframeVisible,a=C().copilotUrl,l=null!==(e=this.config.launcher_size)&&void 0!==e?e:48;switch(console.log("config in floating button",o),o.launcher_type){case f.TEXT:return this.createTextLauncher();case f.TEXTUAL_IMAGE:return this.createTextualImageLauncher();case f.IMAGE:default:if(r){var s=Math.round(.5*l),c=document.createElement("div");Object.assign(c.style,{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%"});var d=document.createElementNS("http://www.w3.org/2000/svg","svg");d.setAttribute("width",String(s)),d.setAttribute("height",String(s)),d.setAttribute("viewBox","0 0 24 24"),d.setAttribute("fill","none"),d.setAttribute("xmlns","http://www.w3.org/2000/svg"),d.style.display="block";var u=document.createElementNS("http://www.w3.org/2000/svg","path");return u.setAttribute("d","M19 9L12 16L5 9"),u.setAttribute("stroke","currentColor"),u.setAttribute("stroke-width","1.5"),u.setAttribute("stroke-linecap","round"),u.setAttribute("stroke-linejoin","round"),d.appendChild(u),c.appendChild(d),c}var p=document.createElement("img");return p.src=o.launcher_type?(null===(n=null===(t=o.images)||void 0===t?void 0:t.launcher_image_url)||void 0===n?void 0:n.url)||"".concat(a,"/chatbubble.png"):o.image_url||"".concat(a,"/chatbubble.png"),p.alt="Chat",Object.assign(p.style,{zIndex:"1000",cursor:"pointer",borderRadius:"50%",objectFit:"cover",width:"100%",height:"100%",boxSizing:"border-box"}),p}},e.prototype.createTextLauncher=function(){var e=this.config.config,t=e.brand_colour,n=e.launcher_properties,i=document.createElement("div");Object.assign(i.style,{width:"fit-content",maxWidth:"160px",height:"40px",borderRadius:"9999px",backgroundColor:t,display:"flex",alignItems:"center",padding:"9px 20px",boxShadow:"0px 0px 16px 0px rgba(0, 0, 0, 0.24)",boxSizing:"border-box"});var o=document.createElement("div");Object.assign(o.style,{flex:"1",minWidth:"0"});var r=document.createElement("p");return Object.assign(r.style,{margin:"0",color:E(t),fontSize:"0.875rem",fontWeight:"600",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:D,fontFamily:R,WebkitFontSmoothing:"antialiased",textRendering:"optimizeLegibility",textSizeAdjust:"100%"}),r.textContent=(null==n?void 0:n.text)||"",o.appendChild(r),i.appendChild(o),i},e.prototype.createTextualImageLauncher=function(){var e,t,n,i,o,r,a=C().copilotUrl,l=this.config.config,s=l.brand_colour,c=l.launcher_properties,d=l.image_url,u=document.createElement("div");Object.assign(u.style,{maxWidth:"13rem",width:"fit-content",height:"40px",borderRadius:"9999px",backgroundColor:s,display:"flex",alignItems:"center",paddingLeft:"20px",paddingRight:"0",paddingTop:"9px",paddingBottom:"9px",boxShadow:"0px 0px 16px 0px rgba(0, 0, 0, 0.24)",gap:"8px",boxSizing:"border-box"});var p=document.createElement("div");Object.assign(p.style,{flex:"1",minWidth:"0"});var f=document.createElement("p");Object.assign(f.style,{margin:"0",color:E(s),fontSize:"0.875rem",fontWeight:"600",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:D,fontFamily:R,WebkitFontSmoothing:"antialiased",textRendering:"optimizeLegibility",textSizeAdjust:"100%"}),f.textContent=(null==c?void 0:c.text)||"";var m=document.createElement("div");Object.assign(m.style,{width:"40px",height:"40px",borderRadius:"9999px",overflow:"hidden",position:"relative",flexShrink:"0"});var h=document.createElement("img");return h.src=(null===(t=null===(e=null==this?void 0:this.config)||void 0===e?void 0:e.config)||void 0===t?void 0:t.launcher_type)?(null===(r=null===(o=null===(i=null===(n=null==this?void 0:this.config)||void 0===n?void 0:n.config)||void 0===i?void 0:i.images)||void 0===o?void 0:o.launcher_image_url)||void 0===r?void 0:r.url)||"".concat(a,"/chatbubble.png"):d||"".concat(a,"/chatbubble.png"),h.alt="Chat",Object.assign(h.style,{width:"100%",height:"100%",objectFit:"cover"}),p.appendChild(f),m.appendChild(h),u.appendChild(p),u.appendChild(m),u},e.prototype.applyResponsiveStyles=function(e){var t,n,i,o,r,a,l,s,c,d=(null===window||void 0===window?void 0:window.innerWidth)<560,u=this.config.config,p=this.config.position||(null===(i=u.interface_properties)||void 0===i?void 0:i.position)||"Right",f=null!==(a=null!==(o=this.config.sideSpacing)&&void 0!==o?o:null===(r=u.interface_properties)||void 0===r?void 0:r.side_spacing)&&void 0!==a?a:20,m=null!==(c=null!==(l=this.config.bottomSpacing)&&void 0!==l?l:null===(s=u.interface_properties)||void 0===s?void 0:s.bottom_spacing)&&void 0!==c?c:20;this.buttonElement.style.position="",this.buttonElement.style.bottom="",this.buttonElement.style.right="",this.buttonElement.style.left="";var h=y(y({},e),d?((t={position:"fixed",bottom:"".concat(m,"px")})[p.toLowerCase()]="".concat(f,"px"),t):((n={bottom:"".concat(m,"px")})[p.toLowerCase()]="".concat(f,"px"),n));Object.assign(this.buttonElement.style,h)},e.prototype.handleResize=function(){var e,t=null!==(e=this.config.launcher_size)&&void 0!==e?e:48,n={zIndex:"1000",display:"flex",flexDirection:"column-reverse",alignItems:"center",justifyContent:"center",cursor:"pointer",overflow:"hidden",marginTop:"16px",borderRadius:this.config.config.launcher_type&&this.config.config.launcher_type!==f.IMAGE?"9999px":"50%",boxSizing:"border-box"};this.config.config.launcher_type===f.IMAGE&&Object.assign(n,{width:"".concat(t,"px"),height:"".concat(t,"px"),borderRadius:"50%",backgroundColor:this.config.config.brand_colour}),this.applyResponsiveStyles(n)},e.prototype.setupResizeListener=function(){"undefined"!=typeof ResizeObserver?(this.resizeObserver=new ResizeObserver(this.handleResizeFunction),this.resizeObserver.observe(document.body)):window.addEventListener("resize",this.handleResizeFunction)},e.prototype.getElement=function(){return this.buttonElement},e.prototype.mount=function(){var e=this;requestAnimationFrame((function(){var t,n;null===(n=(t=e.config).onEvent)||void 0===n||n.call(t,{type:x.CHATBOT_BUTTON_LOADED,timestamp:Date.now()}),e.config.onInternalEvent(x.CHATBOT_BUTTON_LOADED)}))},e.prototype.update=function(e){this.config.isIframeVisible,this.config=y(y({},this.config),e),this.buttonElement.style.transform=this.config.isIframeVisible?"scale(0.85)":"scale(1)",this.render(),this.renderProactiveIfNeeded()},e.prototype.destroy=function(){this.resizeObserver?(this.resizeObserver.disconnect(),this.resizeObserver=null):window.removeEventListener("resize",this.handleResizeFunction),this.buttonElement&&this.buttonElement.parentNode&&this.buttonElement.parentNode.removeChild(this.buttonElement),this.proactiveElement&&this.proactiveElement.parentElement&&(this.proactiveElement.parentElement.removeChild(this.proactiveElement),this.proactiveElement=null),this.clearProactiveDelays(),this.urlUnsubscribe&&(this.urlUnsubscribe(),this.urlUnsubscribe=null)},e.prototype.clearProactiveDelays=function(){this.delayTimers.forEach((function(e){return clearTimeout(e)})),this.delayTimers=[]},e.prototype.hideProactiveMessages=function(){var e,t,n=this;j();var i=null===(e=this.proactiveElement)||void 0===e?void 0:e.children[0];if(i){var o="Right"===(this.config.position||(null===(t=this.config.config.interface_properties)||void 0===t?void 0:t.position)||"Right");Array.from(i.children).forEach((function(e){e.className=o?"rblyn-proactive-exit-right":"rblyn-proactive-exit-left"})),setTimeout((function(){n.proactiveElement&&n.proactiveElement.parentElement&&n.proactiveElement.parentElement.removeChild(n.proactiveElement),n.proactiveElement=null,n.clearProactiveDelays()}),400)}else this.clearProactiveDelays()},e.prototype.injectAnimationStyles=function(){if(!document.getElementById("rblyn-proactive-animations")){var e=document.createElement("style");e.id="rblyn-proactive-animations",e.textContent="\n @keyframes slideInFromRight {\n 0% {\n transform: translateX(120%) scale(0.95);\n opacity: 0;\n }\n 85% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n 92% {\n transform: translateX(-1px) scale(1.002);\n }\n 100% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n }\n @keyframes slideInFromLeft {\n 0% {\n transform: translateX(-120%) scale(0.95);\n opacity: 0;\n }\n 85% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n 92% {\n transform: translateX(1px) scale(1.002);\n }\n 100% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n }\n @keyframes slideOutRight {\n 0% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n 100% {\n transform: translateX(120%) scale(0.9);\n opacity: 0;\n }\n }\n @keyframes slideOutLeft {\n 0% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n 100% {\n transform: translateX(-120%) scale(0.9);\n opacity: 0;\n }\n }\n .rblyn-proactive-enter-right {\n animation: slideInFromRight 1.2s cubic-bezier(0.5, 0.8, 0.3, 1.1) forwards;\n }\n .rblyn-proactive-enter-left {\n animation: slideInFromLeft 1.2s cubic-bezier(0.5, 0.8, 0.3, 1.1) forwards;\n }\n .rblyn-proactive-exit-right {\n animation: slideOutRight 0.4s ease-in forwards;\n }\n .rblyn-proactive-exit-left {\n animation: slideOutLeft 0.4s ease-in forwards;\n }\n .rblyn-proactive-close-enter-right {\n animation: slideInFromRight 1.2s cubic-bezier(0.5, 0.8, 0.3, 1.1) forwards;\n }\n .rblyn-proactive-close-enter-left {\n animation: slideInFromLeft 1.2s cubic-bezier(0.5, 0.8, 0.3, 1.1) forwards;\n }\n /* Reset styles for proactive message content to prevent website CSS interference */\n /* Only target children of the content wrapper, not the bubble container itself */\n .rblyn-proactive-message-content * {\n box-sizing: border-box !important;\n margin: 0 !important;\n padding: 0 !important;\n border: none !important;\n background: transparent;\n font-family: ".concat(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 t,n,i,o,r,a,l,s,c,d,u,p,m,h=this,v=null===(n=null===(t=this.config)||void 0===t?void 0:t.config)||void 0===n?void 0:n.proactive_message_obj;if(Array.isArray(v)&&!this.config.isIframeVisible&&!G()){if(this.injectAnimationStyles(),!this.proactiveElement){var g=document.createElement("div");g.style.position="fixed";var y=null!==(a=null!==(o=this.config.bottomSpacing)&&void 0!==o?o:null===(r=this.config.config.interface_properties)||void 0===r?void 0:r.bottom_spacing)&&void 0!==a?a:20,b=null!==(c=null!==(l=this.config.sideSpacing)&&void 0!==l?l:null===(s=this.config.config.interface_properties)||void 0===s?void 0:s.side_spacing)&&void 0!==c?c:20,_=this.config.position||(null===(d=this.config.config.interface_properties)||void 0===d?void 0:d.position)||"Right",w=null!==(u=this.config.launcher_size)&&void 0!==u?u:48;g.style.bottom="".concat(y+(this.config.config.launcher_type===f.IMAGE?w:40)+8,"px"),"Right"===_?g.style.right="".concat(b,"px"):g.style.left="".concat(b,"px"),g.style.maxWidth="22.875rem",g.style.zIndex="2147483646";var E=document.createElement("div");E.style.display="flex",E.style.flexDirection="column",E.style.alignItems="Right"===_?"flex-end":"flex-start";var I=document.createElement("div");I.style.position="absolute",I.style.top="-32px",I.style.width="24px",I.style.height="24px",I.style.borderRadius="50%",I.style.background="#fff",I.style.boxShadow="0 2.667px 2.667px 0 rgba(0, 0, 0, 0.25)",I.style.display="flex",I.style.alignItems="center",I.style.justifyContent="center",I.style.cursor="pointer",I.style.opacity="0",I.style.visibility="hidden","Right"===(this.config.position||(null===(p=this.config.config.interface_properties)||void 0===p?void 0:p.position)||"Right")?(I.style.right="0px",I.style.left="auto",I.style.transform="translateX(120%) scale(0.95)"):(I.style.left="0px",I.style.right="auto",I.style.transform="translateX(-120%) scale(0.95)"),I.onclick=function(e){e.stopPropagation(),h.hideProactiveMessages()},I.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 ',g.appendChild(E),g.appendChild(I),document.body.appendChild(g),this.proactiveElement=g}var T=this.proactiveElement.children[0];T.innerHTML="";var x="Right"===(this.config.position||(null===(m=this.config.config.interface_properties)||void 0===m?void 0:m.position)||"Right");T.style.display="flex",T.style.flexDirection="column",T.style.alignItems=x?"flex-end":"flex-start",this.clearProactiveDelays();var S=J(v),A=S.length>0?S[S.length-1].delayMs:0,C=this.proactiveElement.children[1];if(C&&S.length>0){C.style.opacity="0",C.style.visibility="hidden",C.style.transform=x?"translateX(120%) scale(0.95)":"translateX(-120%) scale(0.95)";var O=window.setTimeout((function(){C.style.visibility="visible",C.style.animationDelay="0ms",C.className=x?"rblyn-proactive-close-enter-right":"rblyn-proactive-close-enter-left"}),A);this.delayTimers.push(O)}else C&&(C.style.opacity="0",C.style.visibility="hidden");S.forEach((function(e,t){var n=window.setTimeout((function(){var n=document.createElement("div");n.style.background="#fff",n.style.color="#111",n.style.borderRadius="12px",n.style.boxShadow="0 2px 2px 0 rgba(0, 0, 0, 0.08)",n.style.padding="16px",n.style.border="1px solid #F1F2F4",n.style.cursor="pointer",n.style.fontFamily=R,n.style.fontSize="14px",n.style.lineHeight=String(D),n.style.width="fit-content",n.style.maxWidth="100%",T.children.length>0&&(n.style.marginBottom="16px");var i=10*(S.length-1-t);n.className=x?"rblyn-proactive-enter-right":"rblyn-proactive-enter-left",n.style.animationDelay="".concat(i,"ms"),n.style.opacity="0",n.style.transform=x?"translateX(120%) scale(0.95)":"translateX(-120%) scale(0.95)";var o=document.createElement("div");o.className="rblyn-proactive-message-content",o.setAttribute("dir",nt(e.html)),o.innerHTML=tt(e.html),n.appendChild(o),n.onclick=function(){X({message_id:e.messageId,content_string:e.html||null}),h.config.toggleIframe(),h.hideProactiveMessages();try{window.dispatchEvent(new CustomEvent("rblyn:proactiveClick",{detail:{message_id:e.messageId,content_string:e.html||null}}))}catch(e){}},T.insertBefore(n,T.firstChild)}),e.delayMs);h.delayTimers.push(n)}))}else if(this.proactiveElement&&this.proactiveElement.parentElement){var N=this.proactiveElement.children[0],k="Right"===(this.config.position||(null===(i=this.config.config.interface_properties)||void 0===i?void 0:i.position)||"Right");Array.from(N.children).forEach((function(e){e.className=k?"rblyn-proactive-exit-right":"rblyn-proactive-exit-left"})),setTimeout((function(){h.proactiveElement&&h.proactiveElement.parentElement&&h.proactiveElement.parentElement.removeChild(h.proactiveElement),h.proactiveElement=null,h.clearProactiveDelays()}),400)}else this.proactiveElement=null,this.clearProactiveDelays()},e}(),Zt=function(){function e(e){var t=this;this.isInitialized=!1,this.hasRegistered=!1,this.overridesPayloadCache=null,this.proactiveDataSentInRegistration=!1,this.handleMessage=function(e){var n,i,o,r,a,l,s,c,d,u,p,f,m,h,v,g=C().copilotUrl;if(e.origin===g){if("closeChatbot"===e.data)return void t.config.onClose();if("CHATBOT_TOKEN_EXHAUSTED"===(null===(n=e.data)||void 0===n?void 0:n.type))return void t.config.onInternalEvent(S.CHATBOT_TOKEN_EXHAUSTED);"CHATBOT_LOADED"===(null===(i=e.data)||void 0===i?void 0:i.type)&&(null===(r=(o=t.config).onEvent)||void 0===r||r.call(o,{type:x.CHATBOT_LOADED,timestamp:Date.now()}),t.config.onInternalEvent(x.CHATBOT_LOADED)),"CHAT_INITIALIZED"===(null===(a=e.data)||void 0===a?void 0:a.type)&&(null===(s=(l=t.config).onEvent)||void 0===s||s.call(l,{type:x.CHAT_INITIALIZED,timestamp:Date.now()}),t.config.onInternalEvent(x.CHAT_INITIALIZED)),"CHAT_INITIALIZATION_FAILED"===(null===(c=e.data)||void 0===c?void 0:c.type)&&(null===(u=(d=t.config).onEvent)||void 0===u||u.call(d,{type:x.CHAT_INITIALIZATION_FAILED,timestamp:Date.now()}),t.config.onInternalEvent(x.CHAT_INITIALIZATION_FAILED,{error:null===(p=e.data)||void 0===p?void 0:p.error})),"SESSION_REFRESHED"===(null===(f=e.data)||void 0===f?void 0:f.type)&&(null===(h=(m=t.config).onEvent)||void 0===h||h.call(m,{type:x.SESSION_REFRESHED,timestamp:Date.now()}),t.config.onInternalEvent(x.SESSION_REFRESHED)),"CHAT_MOVED"===(null===(v=e.data)||void 0===v?void 0:v.type)&&t.config.onInternalEvent(S.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.getElement=function(){return this.iframeElement},e.prototype.render=function(){var e,t=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(t.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,t,n,i,o,r;if(this.iframeElement){var a=this.config.position||(null===(n=this.config.config.interface_properties)||void 0===n?void 0:n.position)||"Right",l=null!==(r=null!==(i=this.config.bottomSpacing)&&void 0!==i?i:null===(o=this.config.config.interface_properties)||void 0===o?void 0:o.bottom_spacing)&&void 0!==r?r:20;window.innerWidth<560?Object.assign(this.iframeElement.style,((e={width:"100vw",minWidth:"300px"})[a.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,((t={width:"26%",minWidth:"400px",height:"calc(100vh - 2rem - 10vh - ".concat(l,"px)"),borderRadius:"1rem",top:"calc(10vh - 32px)",maxHeight:"50rem",position:""})[a.toLowerCase()]=void 0,t))}},e.prototype.initialize=function(){var e=this;if(!this.isInitialized){var t=C().copilotUrl;this.iframeElement.src="".concat(t,"/chatbot-plugin?id=").concat(this.config.config.chatbotId),this.isInitialized=!0,this.iframeElement.addEventListener("load",(function(){var n,i,o,r,a,l,s,c,d,u,p,f,m,h,v,g,y,b,_,w,E=new URL(e.iframeElement.src).origin||t;null===(n=e.iframeElement.contentWindow)||void 0===n||n.postMessage({domain:null===(i=null===window||void 0===window?void 0:window.location)||void 0===i?void 0:i.hostname,name:"checkDomain"},E);var I={header_avatar:null!==(r=null===(o=e.config.overrides)||void 0===o?void 0:o.header_avatar)&&void 0!==r?r:null,agent_avatar:null!==(l=null===(a=e.config.overrides)||void 0===a?void 0:a.agent_avatar)&&void 0!==l?l:null,header_title:null!==(c=null===(s=e.config.overrides)||void 0===s?void 0:s.header_title)&&void 0!==c?c:null,header_subtitle:null!==(u=null===(d=e.config.overrides)||void 0===d?void 0:d.header_subtitle)&&void 0!==u?u:null,header_title_text_color:null!==(f=null===(p=e.config.overrides)||void 0===p?void 0:p.header_title_text_color)&&void 0!==f?f:null,header_subtitle_text_color:null!==(h=null===(m=e.config.overrides)||void 0===m?void 0:m.header_subtitle_text_color)&&void 0!==h?h:null,header_bg:null!==(g=null===(v=e.config.overrides)||void 0===v?void 0:v.header_bg)&&void 0!==g?g:null};null===(y=e.iframeElement.contentWindow)||void 0===y||y.postMessage({domain:null===(b=null===window||void 0===window?void 0:window.location)||void 0===b?void 0:b.hostname,action:"updateOverrides",data:I},E),null===(w=(_=e.config).onEvent)||void 0===w||w.call(_,{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(){ft.trackError(new Error(Ot[Et]({src:e.iframeElement.src,error:"Failed to load iframe"})),"ChatbotIframe",{errorCode:Et,errorType:At,context:{config:e.config.config,iframeUrl:e.iframeElement.src,timestamp:Date.now()}})})),window.addEventListener("message",this.handleMessage);window.addEventListener("rblyn:proactiveClick",(function(t){var n,i,o,r,a,l;if(e.hasRegistered)if(e.proactiveDataSentInRegistration)e.proactiveDataSentInRegistration=!1;else{var s=(null==t?void 0:t.detail)||{},c=C().copilotUrl,d=new URL(e.iframeElement.src).origin||c;null===(n=e.iframeElement.contentWindow)||void 0===n||n.postMessage({domain:null===(i=null===window||void 0===window?void 0:window.location)||void 0===i?void 0:i.hostname,action:"proactiveClick",data:{userId:null===(o=e.config.config)||void 0===o?void 0:o.userId,token:null===(r=e.config.config)||void 0===r?void 0:r.token,userProfile:null===(a=e.config.config)||void 0===a?void 0:a.userProfile,isAnonymous:null===(l=e.config.config)||void 0===l?void 0:l.isAnonymous,proactiveData:{input_id:null,message_id:(null==s?void 0:s.message_id)||null,content_string:(null==s?void 0:s.content_string)||null}}},d)}}))},e.prototype.updateVisibility=function(e){var t,n,i,o,r,a,l,s,c,d,u,p=this;this.config.isVisible=e;var f=this.config.position||(null===(t=this.config.config.interface_properties)||void 0===t?void 0:t.position)||"Right";if(e?(this.iframeElement.style.display="block",this.iframeElement.getBoundingClientRect(),this.iframeElement.style.opacity="1",this.iframeElement.style.transform="scale(1) translate3d(0,0,0)"):(this.iframeElement.style.opacity="0",this.iframeElement.style.transform="scale(0.3) translate3d(".concat((f.toLowerCase(),"0"),",40px,0)"),setTimeout((function(){p.config.isVisible||(p.iframeElement.style.display="none")}),200)),this.iframeElement.contentWindow&&e){var m=C().copilotUrl,h=new URL(this.iframeElement.src).origin||m;if(this.iframeElement.contentWindow.postMessage({domain:null===(n=null===window||void 0===window?void 0:window.location)||void 0===n?void 0:n.hostname,name:"openFrame"},h),!this.hasRegistered){var v=V();this.proactiveDataSentInRegistration=!!v,this.iframeElement.contentWindow.postMessage({domain:null===(i=null===window||void 0===window?void 0:window.location)||void 0===i?void 0:i.hostname,action:"registerUserId",data:y({userId:null===(o=this.config.config)||void 0===o?void 0:o.userId,token:null===(r=this.config.config)||void 0===r?void 0:r.token,userProfile:y(y({},null===(a=this.config.config)||void 0===a?void 0:a.userProfile),{__INT_SYS_INFO__:y(y({},(null===(s=null===(l=this.config.config)||void 0===l?void 0:l.userProfile)||void 0===s?void 0:s.__INT_SYS_INFO__)||{}),Dt())}),isAnonymous:null===(c=this.config.config)||void 0===c?void 0:c.isAnonymous},v?{proactiveData:v}:{})},h),this.hasRegistered=!0}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)}},e.prototype.update=function(e){var t=this.config.isVisible;if(this.config=y(y({},this.config),e),t!==this.config.isVisible&&this.updateVisibility(this.config.isVisible),this.iframeElement.contentWindow&&this.config.isVisible){var n=C().copilotUrl;this.iframeElement.contentWindow.postMessage({action:"updateUserProfile",user_profile:this.config.config.userProfile},n)}},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}(),qt=function(){function e(e,t,n,i){this.resizeObserver=null,this.containerElement=document.createElement("div"),this.handleResizeFunction=this.handleResize.bind(this),this.config={config:e,position:t,sideSpacing:n,bottomSpacing:i},this.render(),this.mount(),this.setupResizeListener()}return e.prototype.render=function(){this.applyStyles(),this.containerElement.className="robylon-chatbot-container"},e.prototype.applyStyles=function(){var e,t,n,i,o,r,a,l,s,c=(null===window||void 0===window?void 0:window.innerWidth)<560,d=this.config.position||(null===(n=this.config.config.interface_properties)||void 0===n?void 0:n.position)||"Right",u=null!==(r=null!==(i=this.config.sideSpacing)&&void 0!==i?i:null===(o=this.config.config.interface_properties)||void 0===o?void 0:o.side_spacing)&&void 0!==r?r:20,p=null!==(s=null!==(a=this.config.bottomSpacing)&&void 0!==a?a:null===(l=this.config.config.interface_properties)||void 0===l?void 0:l.bottom_spacing)&&void 0!==s?s:20;this.containerElement.style.position="",this.containerElement.style.top="",this.containerElement.style.bottom="",this.containerElement.style.right="",this.containerElement.style.left="",this.containerElement.style.alignItems="";var f={position:"fixed",zIndex:"1000",display:"flex",flexDirection:"column"},m=y(y({},f),((e={bottom:"".concat(p,"px")})[d.toLowerCase()]="".concat(u,"px"),e.alignItems="Right"===d?"flex-end":"flex-start",e)),h=y(y({},f),((t={top:"0"})[d.toLowerCase()]="".concat(u,"px"),t.alignItems="center",t));Object.assign(this.containerElement.style,c?h:m)},e.prototype.handleResize=function(){this.applyStyles()},e.prototype.setupResizeListener=function(){"undefined"!=typeof ResizeObserver?(this.resizeObserver=new ResizeObserver(this.handleResizeFunction),this.resizeObserver.observe(document.body)):window.addEventListener("resize",this.handleResizeFunction)},e.prototype.mount=function(){document.body.appendChild(this.containerElement)},e.prototype.getElement=function(){return this.containerElement},e.prototype.destroy=function(){this.resizeObserver?(this.resizeObserver.disconnect(),this.resizeObserver=null):window.removeEventListener("resize",this.handleResizeFunction),this.containerElement&&this.containerElement.parentNode&&this.containerElement.parentNode.removeChild(this.containerElement)},e}(),Qt=function(e){e.api_key,e.user_profile;var t=e.onEvent;e.chatbotConfig;return{emit:function(e,n){var i={type:e,timestamp:Date.now(),data:n};null==t||t(i)},onInternalEvent:function(e,t){}}},$t=function(){function e(e){var t=this;this.container=null,this.floatingButton=null,this.launcherDelayTimeout=null,this.iframe=null,this.isDestroyed=!1,this.handleStateChange=function(e){var n,i,o,r,a,l;if(!t.isDestroyed){var s=e.isInitialized,c=e.error,d=e.chatbotConfig,u=e.isIframeVisible;if(!c&&d&&s){if(t.eventEmitter=Qt({api_key:t.config.api_key,user_profile:t.config.user_profile,onEvent:t.config.onEvent,chatbotConfig:{isAnonymous:d.isAnonymous,userId:d.userId}}),t.container||(t.container=new qt(d,t.config.position,t.config.sideSpacing,t.config.bottomSpacing)),t.iframe)t.iframe.update({config:d,isVisible:u,position:t.config.position,bottomSpacing:t.config.bottomSpacing,overrides:t.config.overrides});else if(t.iframe=new Zt({config:d,isVisible:u,onClose:t.handleClose,onEvent:t.config.onEvent,onInternalEvent:t.eventEmitter.onInternalEvent,position:t.config.position,bottomSpacing:t.config.bottomSpacing,overrides:t.config.overrides}),t.iframe.getElement&&"function"==typeof t.iframe.getElement){var p=t.iframe.getElement();p&&t.container&&t.container.getElement().prepend(p)}var f=void 0!==t.config.show_launcher?Boolean(t.config.show_launcher):null===(n=null==d?void 0:d.show_launcher)||void 0===n||n,m=!0===(null===(i=null==d?void 0:d.launcher_delay)||void 0===i?void 0:i.enabled),h=null!==(l=null!==(r=null===(o=null==d?void 0:d.launcher_delay)||void 0===o?void 0:o.seconds)&&void 0!==r?r:null===(a=null==d?void 0:d.launcher_delay)||void 0===a?void 0:a.delay)&&void 0!==l?l:0,v=function(){if(t.floatingButton)t.floatingButton.update({config:d,isIframeVisible:u,position:t.config.position,sideSpacing:t.config.sideSpacing,bottomSpacing:t.config.bottomSpacing,launcher_size:t.config.launcher_size});else if(t.floatingButton=new Jt({config:d,toggleIframe:t.toggleIframe,isIframeVisible:u,onEvent:t.config.onEvent,onInternalEvent:t.eventEmitter.onInternalEvent,position:t.config.position,sideSpacing:t.config.sideSpacing,bottomSpacing:t.config.bottomSpacing,launcher_size:t.config.launcher_size}),t.floatingButton.getElement&&"function"==typeof t.floatingButton.getElement){var e=t.floatingButton.getElement();e&&t.container&&t.container.getElement().appendChild(e)}};t.launcherDelayTimeout&&(clearTimeout(t.launcherDelayTimeout),t.launcherDelayTimeout=null),f?m&&Number(h)>0&&!t.floatingButton?t.launcherDelayTimeout=window.setTimeout((function(){v(),t.launcherDelayTimeout=null}),1e3*Number(h)):v():t.floatingButton&&(t.floatingButton.destroy(),t.floatingButton=null)}}},this.toggleIframe=function(){var e=t.stateManager.getState();t.stateManager.toggleIframeVisibility(),t.eventEmitter.emit(e.isIframeVisible?x.CHATBOT_CLOSED:x.CHATBOT_BUTTON_CLICKED)},this.handleClose=function(){t.stateManager.closeIframe(),t.eventEmitter.emit(x.CHATBOT_CLOSED)};var n=y(y({},e),{position:"string"==typeof e.position?"left"===e.position.toLowerCase()?"Left":"right"===e.position.toLowerCase()?"Right":void 0:void 0,sideSpacing:"string"==typeof e.sideSpacing?""===e.sideSpacing||isNaN(Number(e.sideSpacing))?void 0:Number(e.sideSpacing):e.sideSpacing,bottomSpacing:"string"==typeof e.bottomSpacing?""===e.bottomSpacing||isNaN(Number(e.bottomSpacing))?void 0:Number(e.bottomSpacing):e.bottomSpacing,show_launcher:e.show_launcher,overrides:e.overrides,launcher_size:e.launcher_size});if(this.config=n,!e.api_key)throw ft.trackError(new Error(Ot[mt](e.api_key)),"RobylonChatbot",{errorCode:mt,errorType:xt,context:{timestamp:Date.now()}}),new Error("API key is required");try{ft.initialize(e.api_key,e.user_id)}catch(e){ft.trackError(e instanceof Error?e:new Error(String(e)),"RobylonChatbot",{errorCode:yt,errorType:xt,context:{timestamp:Date.now()}})}this.stateManager=function(e){var t={isInitialized:!1,isInitializing:!1,error:null,chatbotConfig:null,isIframeVisible:!1},n=[],i=function(e){t=y(y({},t),e),n.forEach((function(e){return e(t)}))};return{getState:function(){return t},initialize:function(){return b(void 0,void 0,void 0,(function(){var t,n,o;return _(this,(function(r){switch(r.label){case 0:if(!e.api_key)return ft.trackError(new Error(Ot[mt](e.api_key)),"ChatbotStateManager",{errorCode:mt,errorType:xt,context:{timestamp:Date.now()}}),[2];i({isInitializing:!0}),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,Wt(e)];case 2:return t=r.sent(),[4,new Promise((function(e,n){Bt(t,(function(){i({isInitialized:!0,chatbotConfig:t}),e()}),(function(e){n(e)}))}))];case 3:return r.sent(),[3,6];case 4:return n=r.sent(),o=n instanceof Error?n.message:"Failed to initialize chatbot",i({error:o}),ft.trackError(n instanceof Error?n:new Error(o),"ChatbotStateManager",{errorCode:gt,errorType:xt,context:{timestamp:Date.now()}}),[3,6];case 5:return i({isInitializing:!1}),[7];case 6:return[2]}}))}))},toggleIframeVisibility:function(){i({isIframeVisible:!t.isIframeVisible})},closeIframe:function(){i({isIframeVisible:!1})},updateState:i,subscribe:function(e){return n.push(e),function(){var t=n.indexOf(e);t>-1&&n.splice(t,1)}},unsubscribe:function(e){var t=n.indexOf(e);t>-1&&n.splice(t,1)}}}({api_key:e.api_key,user_id:e.user_id,user_token:e.user_token,user_profile:e.user_profile}),this.eventEmitter=Qt({api_key:e.api_key,user_profile:e.user_profile,onEvent:e.onEvent,chatbotConfig:null}),this.initialize()}return e.prototype.initialize=function(){return b(this,void 0,void 0,(function(){var e;return _(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.stateManager.initialize()];case 1:return t.sent(),this.stateManager.subscribe(this.handleStateChange),this.handleStateChange(this.stateManager.getState()),[3,3];case 2:return e=t.sent(),ft.trackError(e instanceof Error?e:new Error(String(e)),"RobylonChatbot.initialize",{errorCode:gt,errorType:xt,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.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 en(e){return new $t(e)}if("undefined"!=typeof window){!function(){if("undefined"!=typeof window){var e=window,t=(null==e?void 0:e.RobylonChatbot)||(null==e?void 0:e.R);if(t&&Array.isArray(t.q)){var n=null;t.q.forEach((function(e){var t=e[0];if("init"===t){var i=e[1]||{};n=en(i)}else n&&"function"==typeof n[t]&&n[t]()})),e.RobylonChatbot=function(e){var t=Array.prototype.slice.call(arguments,1);return"init"===e?n=en(t[0]||{}):n&&"function"==typeof n[e]?n[e].apply(n,t):void 0},(null==e?void 0:e.R)||(e.R=e.RobylonChatbot),e.RobylonChatbot.getState=function(){return"initialized"},(null==e?void 0:e.R)&&(e.R.getState=e.RobylonChatbot.getState)}}}();var tn=window,nn=null==tn?void 0:tn.RobylonChatbot;nn&&!(null==tn?void 0:tn.R)&&(tn.R=nn)}var on={create:en,getState:function(){return"initialized"}};export{Yt as Chatbot,u as ChatbotInterfaceType,g as ConditionType,h as DisplayAttributesType,f as LauncherType,v as LogicalConditionType,m as ProactiveSendTimeType,on as RobylonChatbot,p as WidgetPositionEnums,Kt as useChatbot};
|
|
4
4
|
//# sourceMappingURL=index.js.map
|