@theymes/sdk 1.2.14 → 1.3.1

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/index.esm.js CHANGED
@@ -1 +1 @@
1
- var e=function(){return e=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var i in n=arguments[t])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e},e.apply(this,arguments)};function n(e,n,t,o){return new(t||(t=Promise))(function(i,r){function a(e){try{l(o.next(e))}catch(e){r(e)}}function s(e){try{l(o.throw(e))}catch(e){r(e)}}function l(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t(function(e){e(n)})).then(a,s)}l((o=o.apply(e,n||[])).next())})}function t(e,n){var t,o,i,r={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(r=0)),r;)try{if(t=1,o&&(i=2&s[0]?o.return:s[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;switch(o=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,o=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(i=r.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(6===s[0]&&r.label<i[1]){r.label=i[1],i=s;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(s);break}i[2]&&r.ops.pop(),r.trys.pop();continue}s=n.call(e,r)}catch(e){s=[6,e],o=0}finally{t=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function o(e,n,t){if(t||2===arguments.length)for(var o,i=0,r=n.length;i<r;i++)!o&&i in n||(o||(o=Array.prototype.slice.call(n,0,i)),o[i]=n[i]);return e.concat(o||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var i={unreadMessageCountUpdate:new Set,unansweredMessageCountUpdate:new Set,open:new Set,close:new Set};function r(e,n){i[e].add(n)}function a(e,n){i[e].delete(n)}function s(e,n){i[e].forEach(function(e){return e.apply(void 0,n)})}var l='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: sans-serif;\n font-size: CSS_FONT_SIZE_PLACEHOLDER;\n }\n\n html,\n body {\n background: rgb(CSS_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n padding-top: INSET_TOP_PLACEHOLDER;\n padding-bottom: INSET_BOTTOM_PLACEHOLDER;\n padding-left: INSET_LEFT_PLACEHOLDER;\n padding-right: INSET_RIGHT_PLACEHOLDER;\n }\n\n .top-bar {\n flex: 0 0 auto;\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: flex-end;\n }\n\n .close-button {\n padding: 0.5rem 1rem;\n cursor: pointer;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 1.75rem;\n height: 1.75rem;\n }\n\n .error-wrapper {\n flex: 1 0 0%;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: 12px;\n padding: 12px;\n }\n\n h1 {\n font-size: 18px;\n font-weight: 400;\n color: rgb(CSS_TEXT_PLACEHOLDER);\n }\n\n svg.error-icon {\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="wrapper">\n <div class="top-bar">\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"\n stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"\n class="lucide lucide-x-icon lucide-x">\n <path d="M18 6 6 18" />\n <path d="m6 6 12 12" />\n </svg>\n </div>\n </div>\n <div class="error-wrapper">\n <svg class="error-icon" width="91" height="91" viewBox="0 0 91 91" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path\n d="M45.1079 89.1321C50.7158 89.1321 55.2618 84.5859 55.2618 78.9783C55.2618 73.3707 50.7158 68.8245 45.1079 68.8245C39.5001 68.8245 34.9541 73.3707 34.9541 78.9783C34.9541 84.5859 39.5001 89.1321 45.1079 89.1321Z"\n stroke="#FFB547" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />\n <path d="M24.7637 58.6355C35.9988 47.4005 54.2144 47.4005 65.4492 58.6355" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M12.7988 46.6689C22.1436 37.3241 34.529 32.8731 46.7703 33.3159" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M1.1084 34.4283C11.6674 23.9971 25.012 18.0833 38.7295 16.6868" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M89.1082 1.13208L62.0312 28.209" stroke="#FFB547" stroke-width="2" stroke-linecap="round"\n stroke-linejoin="round" />\n <path d="M62.0312 1.13208L89.1082 28.209" stroke="#FFB547" stroke-width="2" stroke-linecap="round"\n stroke-linejoin="round" />\n </svg>\n <div>\n <h1>Connection error</h1>\n </div>\n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeTheymesSdk() {\n parent.postMessage({ action: \'theymes.close\' }, \'*\');\n }\n\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeTheymesSdk);\n <\/script>\n</body>\n\n</html>',c="1.2.14",d="colors",u="locs",g="fonts",f="recordRetentionAfterSecs",p="resetSessionAfterSecs",m="web",h={sdkDialog:"#theymes-sdk-dialog",sdkIframeWrapper:"#theymes-sdk-wrapper",sdkIframe:"#theymes-sdk",sdkLoaderIframe:"#theymes-sdk-loader",notificationDialog:"#theymes-sdk-notification-dialog",notificationIframe:"#theymes-sdk-notification",sdkButtonIframe:"#theymes-sdk-button"},v=.2,y="theymes_path_on_init",b=function(e){var n;try{return null!==(n=null===localStorage||void 0===localStorage?void 0:localStorage.getItem(e))&&void 0!==n?n:null}catch(e){return null}},w=function(e,n){try{null===localStorage||void 0===localStorage||localStorage.setItem(e,n)}catch(e){}},S={length:0,getItem:function(e){var n;try{return null!==(n=null===sessionStorage||void 0===sessionStorage?void 0:sessionStorage.getItem(e))&&void 0!==n?n:null}catch(e){return null}},setItem:function(e,n){try{null===sessionStorage||void 0===sessionStorage||sessionStorage.setItem(e,n)}catch(e){}},removeItem:function(e){try{null===sessionStorage||void 0===sessionStorage||sessionStorage.removeItem(e)}catch(e){}},clear:function(){try{null===sessionStorage||void 0===sessionStorage||sessionStorage.clear()}catch(e){}},key:function(e){var n;try{return null!==(n=null===sessionStorage||void 0===sessionStorage?void 0:sessionStorage.key(e))&&void 0!==n?n:null}catch(e){return null}}},x=function(){var n=null,t=28800,o={text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}},i={widgetButtonText:{}},r=E();try{n=function(){var e=b(f);if(e){var n=JSON.parse(e);if("number"==typeof n)return n}return null}(),t=function(){var e=b(p);if(e){var n=JSON.parse(e);if("number"==typeof n)return n}return k()}(),o=function(){var n=b(d);if(n){var t=JSON.parse(n);return e(e({},{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}}),t)}return{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}}}(),i=function(){var n=b(u);if(n){var t=JSON.parse(n);return e(e({},{widgetButtonText:{}}),t)}return{widgetButtonText:{}}}(),r=function(){var n=b(g);if(n){var t=JSON.parse(n);return e(e({},E()),t)}return E()}()}catch(e){console.error("Error initializing internals",e)}return{token:null,domain:null,mode:"game",deviceId:null,position:"bottom-right",widgetButton:!1,widgetButtonAction:"support",x:20,y:20,loggingEnabled:!1,element:null,language:null,userLanguage:navigator.language,tags:new Set,fields:{},youngPlayer:!1,privacyMode:!1,signedMetadataToken:null,isLoggedIn:!1,isInForeground:!0,hasNetworkConnectivity:!0,player:null,sdkIsOpen:!1,forceUpdateSdkDialog:!1,recordRetentionAfterSecs:n,resetSessionAfterSecs:t,sessionStatus:"waiting",sessionStartTime:null,sessionResumeOrStartTime:null,retentionRemainingSeconds:null,isRetentionRecordedForSession:!1,recordRetentionTimerId:null,retryRecordRetentionTimerId:null,retryIntervalSecs:300,networkErrorTimerId:null,colors:o,locs:i,fonts:r,notificationsPaused:!0,notifications:[],visibleNotification:null,unreadMessageCount:0,unansweredMessageCount:0,previousPath:null,previousConfig:null,nonce:null,keyboardHeight:0,disableInsets:!1}}();function E(){return{body:void 0}}function k(){return 28800}var T=function(e,n){return e===n||Boolean(e&&n&&"object"==typeof e&&"object"==typeof n&&Object.keys(e).length===Object.keys(n).length&&Object.entries(e).every(function(e){var t=e[0],o=e[1];return T(o,n[t])}))};function C(e){var n,t=e.iframe,o=e.content,i=null===(n=t.contentWindow)||void 0===n?void 0:n.document;i&&(i.open(),i.write(o),i.close())}function O(e){return"".concat(e.r,", ").concat(e.g,", ").concat(e.b)}function L(e){var n,t,o,i;return e.template.replace(/PLATFORM_PLACEHOLDER/g,m).replace(/INSET_TOP_PLACEHOLDER/g,x.disableInsets?"0px":"env(safe-area-inset-top, 0px)").replace(/INSET_BOTTOM_PLACEHOLDER/g,x.disableInsets?"0px":"env(safe-area-inset-bottom, 0px)").replace(/INSET_LEFT_PLACEHOLDER/g,x.disableInsets?"0px":"env(safe-area-inset-left, 0px)").replace(/INSET_RIGHT_PLACEHOLDER/g,x.disableInsets?"0px":"env(safe-area-inset-right, 0px)").replace(/CSS_TEXT_PLACEHOLDER/g,O(x.colors.text)).replace(/CSS_BORDER_PLACEHOLDER/g,O(x.colors.border)).replace(/CSS_BACKGROUND_PLACEHOLDER/g,O(x.colors.background)).replace(/CSS_TILE_PLACEHOLDER/g,O(x.colors.tile)).replace(/CSS_ACCENT_PLACEHOLDER/g,O(x.colors.accent)).replace(/CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER/g,O(x.colors.notificationBackground)).replace(/CSS_NOTIFICATION_TEXT_PLACEHOLDER/g,O(x.colors.notificationText)).replace(/CSS_FONT_SIZE_PLACEHOLDER/g,"game"===x.mode?"16px":"14px").replace(/CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER/g,null!==(t=null===(n=x.fonts.body)||void 0===n?void 0:n.regular)&&void 0!==t?t:"url('https://fonts.gstatic.com/s/poppins/v22/pxiEyp8kv8JHgFVrJJfecnFHGPc.woff2') format('woff2')").replace(/CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER/g,null!==(i=null===(o=x.fonts.body)||void 0===o?void 0:o.fallback)&&void 0!==i?i:"ui-sans-serif, system-ui, sans-serif").replace(/NONCE_ATTR_PLACEHOLDER/g,x.nonce?'nonce="'.concat(x.nonce,'"'):"")}function I(e,n,t){return function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];try{return n.apply(void 0,o)}catch(n){return console.error("Error in ".concat(e),n),t}}}var _=function(e){var n=e.split(/[-_]/),t=n[0],o=n[1];return t?o?"".concat(t.toLowerCase(),"-").concat(o.toUpperCase()):t.toLowerCase():"en"},R=/(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|redmi|series[46]0|samsungbrowser.*mobile|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,P=/CrOS/,A=/android|ipad|playbook|silk/i;function N(){return!!function(e){e||(e={});var n=e.ua;if(n||"undefined"==typeof navigator||(n=navigator.userAgent),n&&n.headers&&"string"==typeof n.headers["user-agent"]&&(n=n.headers["user-agent"]),"string"!=typeof n)return!1;var t=R.test(n)&&!P.test(n)||!!e.tablet&&A.test(n);return!t&&e.tablet&&e.featureDetect&&navigator&&navigator.maxTouchPoints>1&&-1!==n.indexOf("Macintosh")&&-1!==n.indexOf("Safari")&&(t=!0),t}({tablet:!0})&&(window.innerWidth<500||window.innerHeight<500)}function D(e){var n=e.type,t=x.position,o=x.x,i=x.y;return N()&&"widget"===n?{top:"0",left:"0",right:"0",bottom:"0"}:"top-left"===t?{top:"".concat(o,"px"),left:"".concat(i,"px"),right:"auto",bottom:"auto"}:"top-right"===t?{top:"".concat(o,"px"),right:"".concat(i,"px"),left:"auto",bottom:"auto"}:"bottom-left"===t?{bottom:"".concat(o,"px"),left:"".concat(i,"px"),right:"auto",top:"auto"}:{bottom:"".concat(o,"px"),right:"".concat(i,"px"),left:"auto",top:"auto"}}function M(){return N()?{width:"100%",height:"100%",maxWidth:"none",maxHeight:"none"}:{width:"".concat(340,"px"),height:"".concat(680,"px"),maxWidth:"none",maxHeight:"calc(100vh - ".concat(2*x.y,"px)")}}function B(e){var n=document.querySelector(h.sdkButtonIframe);if(n)var t=setInterval(function(){var o,i;"complete"===(null===(o=n.contentDocument)||void 0===o?void 0:o.readyState)&&(clearInterval(t),null===(i=null==n?void 0:n.contentWindow)||void 0===i||i.postMessage(e,"*"))},100)}function H(){var e,n,t=x.notifications[0];if(t&&!x.visibleNotification){x.visibleNotification=t;var o=null!==(e=document.querySelector(h.notificationDialog))&&void 0!==e?e:document.createElement("div");o.id=h.notificationDialog.replace("#",""),o.style.position="fixed",o.style.border="none",o.style.margin="0",o.style.padding="0",o.style.zIndex="9999",o.style.colorScheme="auto",o.style.backgroundColor="transparent",o.style.pointerEvents="none",o.style.overflow="hidden",document.body.appendChild(o);var i,r=null!==(n=o.querySelector(h.notificationIframe))&&void 0!==n?n:document.createElement("iframe");r.id=h.notificationIframe.replace("#",""),r.style.position="absolute",r.style.border="none",r.style.width="0",r.style.height="0",r.style.top="-20px",r.style.left="0",r.style.colorScheme="auto",r.style.pointerEvents="auto",r.style.marginTop="-20px",r.style.opacity="0",r.style.transition="opacity ".concat(.2,"s ease-in-out, margin-top ").concat(.2,"s ease-in-out"),o.appendChild(r),C({iframe:r,content:(i={text:t.text},L({template:'<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n @font-face {\n font-family: \'TheymesBody\';\n src: CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER;\n font-weight: normal;\n font-style: normal;\n font-display: fallback;\n }\n\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'TheymesBody\', CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER;\n }\n\n html,\n body {\n width: 100%;\n height: auto;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_NOTIFICATION_TEXT_PLACEHOLDER);\n width: 1.25rem;\n height: 1.25rem;\n }\n\n .notification {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n background: rgb(CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: auto;\n margin: 0;\n padding: 12px;\n border-radius: 6px;\n color: rgb(CSS_NOTIFICATION_TEXT_PLACEHOLDER);\n }\n\n .notification-text {\n flex: 1 0 0%;\n font-size: 0.875rem;\n /* 14/16 */\n line-height: 1.2;\n display: -webkit-box;\n line-clamp: 2;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n text-overflow: ellipsis;\n cursor: pointer;\n }\n\n .close-button {\n flex: 0 0 auto;\n padding-left: 10px;\n cursor: pointer;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="notification">\n <div class="notification-text">NOTIFICATION_TEXT_PLACEHOLDER</div>\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round">\n <path d="M18 6 6 18"></path>\n <path d="m6 6 12 12"></path>\n </svg>\n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeNotification() {\n parent.postMessage({ action: \'theymes.closeNotification\' }, \'*\');\n }\n\n function notificationClicked() {\n parent.postMessage({ action: \'theymes.handleNotificationAction\' }, \'*\');\n }\n\n document.querySelector(\'.notification-text\').addEventListener(\'click\', notificationClicked);\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeNotification);\n <\/script>\n</body>\n\n</html>'}).replace(/NOTIFICATION_TEXT_PLACEHOLDER/g,i.text))}),setTimeout(function(){r.style.opacity="1",r.style.marginTop="0px",F()},500),t.closeAfterSeconds>0&&setTimeout(function(){j({notification:t})},1e3*t.closeAfterSeconds)}}function F(){var e,n,t,o=document.querySelector(h.notificationDialog),i=document.querySelector(h.notificationIframe);if(o&&i){var r=(null===(t=null===(n=null===(e=i.contentWindow)||void 0===e?void 0:e.document)||void 0===n?void 0:n.body)||void 0===t?void 0:t.scrollHeight)?"".concat(i.contentWindow.document.body.scrollHeight,"px"):"0";if("widget"===x.mode){var a=D({type:"widget"}),s=M(),l="calc(".concat(s.width," - 20px)");o.style.bottom=a.bottom,o.style.right=a.right,o.style.left=a.left,o.style.top=a.top,o.style.overflow="hidden",i.style.width=l}else if(x.element){var c=x.element.getBoundingClientRect();l="".concat(c.width-20,"px");o.style.top="".concat(c.top,"px"),o.style.left="".concat(c.left,"px"),o.style.right="".concat(c.right,"px"),o.style.bottom="".concat(c.bottom,"px"),o.style.overflow="hidden",i.style.width=l}else{l="calc(100% - 20px)";o.style.top=x.disableInsets?"0px":"env(safe-area-inset-top, 0px)",o.style.left=x.disableInsets?"0px":"env(safe-area-inset-left, 0px)",o.style.right=x.disableInsets?"0px":"env(safe-area-inset-right, 0px)",o.style.bottom=x.disableInsets?"0px":"env(safe-area-inset-bottom, 0px)",o.style.overflow="visible",i.style.width=l}i.style.height=r,i.style.top="10px",i.style.left="10px"}}function j(e){if(e.notification&&x.visibleNotification===e.notification){var n=document.querySelector(h.notificationIframe),t=document.querySelector(h.notificationDialog);n&&(n.style.opacity="0",n.style.marginTop="-20px",setTimeout(function(){null==t||t.remove(),x.notifications=x.notifications.slice(1),x.visibleNotification=null,H()},200))}}var U=function(){function i(){Object.defineProperty(this,"isRunning",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"pollWhenNotificationsEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"lastPollDate",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"nextPollDate",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.resumeIfNeeded(!1)}return Object.defineProperty(i.prototype,"onIsInForegroundChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(){x.isInForeground?this.resumeIfNeeded(!1):this.pauseIfNeeded()}}),Object.defineProperty(i.prototype,"onHasNetworkConnectivityChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.resumeIfNeeded(!1)}}),Object.defineProperty(i.prototype,"resume",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning=!0;var e=new Date;if(this.nextPollDate||(this.nextPollDate=new Date(e.getTime()+1e3)),e>=this.nextPollDate)this.pollEventsRequest();else{var n=(this.nextPollDate.getTime()-e.getTime())/1e3;this.scheduleNextPollEventsRequest(n)}}}),Object.defineProperty(i.prototype,"pause",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning=!1,this.timer&&(clearTimeout(this.timer),this.timer=null)}}),Object.defineProperty(i.prototype,"shouldBeRunning",{enumerable:!1,configurable:!0,writable:!0,value:function(){return x.isLoggedIn&&x.isInForeground&&x.hasNetworkConnectivity&&!x.sdkIsOpen}}),Object.defineProperty(i.prototype,"resumeIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){e&&(this.nextPollDate=null),!this.shouldBeRunning()||this.isRunning&&!e||this.resume()}}),Object.defineProperty(i.prototype,"pauseIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning&&!this.shouldBeRunning()&&this.pause()}}),Object.defineProperty(i.prototype,"onEnableNotifications",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning&&this.pollWhenNotificationsEnabled&&this.scheduleNextPollEventsRequest(0)}}),Object.defineProperty(i.prototype,"onOpen",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.pauseIfNeeded()}}),Object.defineProperty(i.prototype,"onClose",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.resumeIfNeeded(!0)}}),Object.defineProperty(i.prototype,"onLogin",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.resumeIfNeeded(!0)}}),Object.defineProperty(i.prototype,"onLogout",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.pauseIfNeeded()}}),Object.defineProperty(i.prototype,"scheduleNextPollEventsRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this;this.nextPollDate=new Date(Date.now()+1e3*e),this.timer&&clearTimeout(this.timer),this.timer=setTimeout(function(){n.timer=null,n.pollEventsRequest()},1e3*e)}}),Object.defineProperty(i.prototype,"pollEventsRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(){return n(this,void 0,void 0,function(){var n,i,r,a,l,c,d,u,g;return t(this,function(t){switch(t.label){case 0:if(!x.token||!x.domain||!x.deviceId)return[2];if(!this.isRunning)return[2];if(this.lastPollDate&&(n=new Date(this.lastPollDate.getTime()+6e4),(i=(n.getTime()-Date.now())/1e3)>0))return this.scheduleNextPollEventsRequest(i),[2];this.lastPollDate=new Date,r=x.notificationsPaused||x.sdkIsOpen?"true":"false",a=new URLSearchParams(e(e({token:x.token,language:null!==(u=x.language)&&void 0!==u?u:"en",deviceId:x.deviceId,notificationsPaused:r,mode:x.mode},(null===(g=x.player)||void 0===g?void 0:g.id)?{unsignedPlayerId:x.player.id}:{}),x.signedMetadataToken?{signedMetadataToken:x.signedMetadataToken}:{})).toString(),t.label=1;case 1:return t.trys.push([1,4,,5]),[4,fetch("https://".concat(x.domain,"/api/sdk/events?").concat(a),{method:"GET"})];case 2:if(!(l=t.sent()).ok)throw new Error("HTTP error! status: ".concat(l.status));return[4,l.json()];case 3:return c=t.sent(),this.scheduleNextPollEventsRequest(c.nextPollSeconds),void 0!==c.pollWhenNotificationsEnabled&&(this.pollWhenNotificationsEnabled=c.pollWhenNotificationsEnabled),x.notifications=o(o([],x.notifications,!0),c.notifications,!0),x.notifications.length>0&&H(),c.unansweredMessageCount!==x.unansweredMessageCount&&(x.unansweredMessageCount=c.unansweredMessageCount,s("unansweredMessageCountUpdate",[c.unansweredMessageCount])),c.unreadMessageCount!==x.unreadMessageCount&&(x.unreadMessageCount=c.unreadMessageCount,s("unreadMessageCountUpdate",[c.unreadMessageCount]),B({action:"unreadMessageCountUpdate",count:c.unreadMessageCount})),[3,5];case 4:return d=t.sent(),console.error("Error fetching events:",d),this.scheduleNextPollEventsRequest(x.retryIntervalSecs),[3,5];case 5:return[2]}})})}}),i}(),q={eventPoller:null},W=function(){var e;null===(e=q.eventPoller)||void 0===e||e.onLogin()},G=function(){var e;null===(e=q.eventPoller)||void 0===e||e.onLogout()},z=function(){var e;null===(e=q.eventPoller)||void 0===e||e.onOpen()},J=function(){var e;null===(e=q.eventPoller)||void 0===e||e.onClose()},Y=function(){var e;null===(e=q.eventPoller)||void 0===e||e.onEnableNotifications()},K=function(){var e;null===(e=q.eventPoller)||void 0===e||e.onIsInForegroundChanged()},X=function(e){var n="/help-center";te({path:n,config:e}),ne({path:n,config:e})},V=function(e){var n="/assistant";te({path:n,config:e}),ne({path:n,config:e})},Z=function(){!function(){var e=document.querySelector(h.sdkDialog),n=document.querySelector(h.sdkIframeWrapper);if(e){var t=function(){"widget"!==x.mode||x.forceUpdateSdkDialog?e.remove():e.style.display="none",x.forceUpdateSdkDialog=!1};n?(n.style.opacity="0",n.style.transform=se({animation:"start"}),setTimeout(function(){t()},200)):t()}x.widgetButton&&ae();s("close",[])}()},Q=function(){try{return CSS.supports("color","var(--color)")&&CSS.supports("color","rgb(255 255 255 / 0.5)")}catch(e){return!1}},$=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];r.apply(void 0,e)};function ee(n){var t,i,r,a,s,l,d=(null!=n?n:{}).config;if(!x.token||!x.domain||!x.deviceId)return null;var u=null!==(t=null==d?void 0:d.tags)&&void 0!==t?t:[],g=null!==(i=null==d?void 0:d.fields)&&void 0!==i?i:{},f=null!==(a=null!==(r=null==d?void 0:d.language)&&void 0!==r?r:x.language)&&void 0!==a?a:null,p=null!==(s=x.signedMetadataToken)&&void 0!==s?s:null,h=null!==(l=x.player)&&void 0!==l?l:null,v={_platform:m,_sdkVersion:c};x.youngPlayer&&(v._youngPlayer=!0),(x.privacyMode||x.youngPlayer)&&(v._privacyMode=!0);var y=o(o([],Array.from(x.tags),!0),u,!0),b=e(e(e({},x.fields),g),v);return{token:x.token,domain:x.domain,deviceId:x.deviceId,tags:y,fields:b,language:f,signedMetadataToken:p,player:h}}function ne(e){var n,t,o,i=ee({config:e.config});if(i){var r=null!==(n=document.querySelector(h.sdkDialog))&&void 0!==n?n:document.createElement("div");r.id=h.sdkDialog.replace("#",""),r.style.display="block",r.style.position="fixed",r.style.border="none",r.style.width="0",r.style.height="0",r.style.margin="0",r.style.padding="0",r.style.zIndex="9998",r.style.overflow="hidden",r.style.backgroundColor="transparent";var a=null!==(t=r.querySelector(h.sdkIframeWrapper))&&void 0!==t?t:document.createElement("div");a.id=h.sdkIframeWrapper.replace("#",""),a.style.position="relative",a.style.width="100%",a.style.height="100%",a.style.top="0",a.style.right="0",a.style.bottom="0",a.style.left="0",a.style.opacity="0",a.style.colorScheme="auto",a.style.border="none",a.style.backgroundColor="rgb(".concat(O(x.colors.background),")"),a.style.transform=se({animation:"start"}),a.style.transition=(x.mode,"opacity ".concat(v,"s ease-in-out, transform ").concat(v,"s ease-in-out")),"widget"===x.mode&&(a.style.overflow="hidden");var c=null!==(o=a.querySelector(h.sdkLoaderIframe))&&void 0!==o?o:document.createElement("iframe");c.id=h.sdkLoaderIframe.replace("#",""),c.style.position="absolute",c.style.border="none",c.style.width="100%",c.style.height="100%",c.style.top="0",c.style.right="0",c.style.bottom="0",c.style.left="0",c.style.colorScheme="auto";var d=a.querySelector(h.sdkIframe),u=null!=d?d:document.createElement("iframe"),g=setInterval(function(){var e;"complete"===(null===(e=u.contentDocument)||void 0===e?void 0:e.readyState)&&(clearInterval(g),p())},500);u.id=h.sdkIframe.replace("#",""),u.style.position="absolute",u.style.border="none",u.style.top="0",u.style.right="0",u.style.bottom="0",u.style.left="0",u.style.colorScheme="auto",d&&!x.networkErrorTimerId||(u.src=function(e){var n=e.path,t=e.supportViewConfig,o="https://".concat(x.domain,"/sdk"),i=new URLSearchParams;i.set("platform",m),i.set("token",t.token),i.set("deviceId",t.deviceId),i.set("mode",x.mode),i.set("origin",window.location.origin),i.set("userLanguage",x.userLanguage),x.disableInsets&&i.set("disableInsets","true");t.language&&i.set("language",t.language);Q()||i.set("unsupported","true");var r=ie({supportViewConfig:t});return i.set("metadata",JSON.stringify(r)),"".concat(o).concat(n,"?").concat(i.toString())}({path:e.path,supportViewConfig:i}),u.style.width="0",u.style.height="0",r.appendChild(a),a.appendChild(c),a.appendChild(u),document.body.appendChild(r)),C({iframe:c,content:L({template:'<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n * {\n box-sizing: border-box;\n }\n\n html,\n body {\n background: rgb(CSS_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n padding-top: INSET_TOP_PLACEHOLDER;\n padding-bottom: INSET_BOTTOM_PLACEHOLDER;\n padding-left: INSET_LEFT_PLACEHOLDER;\n padding-right: INSET_RIGHT_PLACEHOLDER;\n }\n\n .top-bar {\n flex: 0 0 auto;\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: flex-end;\n }\n\n .loader-wrapper {\n flex: 1 0 0%;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: 12px;\n }\n\n .close-button {\n padding: 0.5rem 1rem;\n cursor: pointer;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 1.75rem;\n height: 1.75rem;\n }\n\n @keyframes spin {\n to {\n transform: rotate(360deg);\n }\n }\n\n .loader {\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 2rem;\n height: 2rem;\n animation: spin 1s linear infinite;\n transform-origin: center;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="wrapper">\n <div class="top-bar">\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"\n stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"\n class="lucide lucide-x-icon lucide-x">\n <path d="M18 6 6 18" />\n <path d="m6 6 12 12" />\n </svg>\n </div>\n </div>\n <div class="loader-wrapper">\n <svg class="loader" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg" fill="none" data-test-name="oval"\n role="img">\n <g fill="none" fill-rule="evenodd">\n <g transform="translate(1 1)" stroke-width="2">\n <circle stroke-opacity="0.5" cx="18" cy="18" r="18" />\n <path d="M36 18c0-9.94-8.06-18-18-18" />\n </g>\n </g>\n </svg>\n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeTheymesSdk() {\n parent.postMessage({ action: \'theymes.close\' }, \'*\');\n }\n\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeTheymesSdk);\n <\/script>\n</body>\n\n</html>'})});var f=!1,p=function(){f||(f=!0,x.networkErrorTimerId=setTimeout(function(){C({iframe:c,content:L({template:l})})},1e4))};u.onload=p,u.onerror=function(){C({iframe:c,content:L({template:l})})},re(),s("open",[]),setTimeout(function(){a.style.opacity="1",a.style.transform=se({animation:"end"})},100)}}function te(e){var n=e.path,t=e.config,o=null!=t?t:null;x.previousPath===n&&T(x.previousConfig,o)||(x.previousPath=n,x.previousConfig=o,oe())}function oe(){var e=document.querySelector(h.sdkDialog);x.sdkIsOpen?x.forceUpdateSdkDialog=!0:null==e||e.remove()}function ie(e){var n=e.supportViewConfig,t={unsigned:{},signed:void 0};return n.player&&(t.unsigned.player=n.player),n.tags&&(t.unsigned.tags=n.tags),n.fields&&(t.unsigned.fields=n.fields),n.signedMetadataToken&&(t.signed=n.signedMetadataToken),t}function re(){var e=document.querySelector(h.sdkDialog),n=document.querySelector(h.sdkIframeWrapper);if(e&&n)if("widget"===x.mode){var t=D({type:"widget"}),o=M();e.style.width=o.width,e.style.height=o.height,e.style.maxWidth=o.maxWidth,e.style.maxHeight=o.maxHeight,e.style.bottom=t.bottom,e.style.right=t.right,e.style.left=t.left,e.style.top=t.top,N()?(n.style.border="none",n.style.borderRadius="0"):(n.style.border="1px solid rgb(".concat(O(x.colors.border),")"),n.style.borderRadius="10px")}else if(n.style.border="none",n.style.borderRadius="0",x.element){var i=x.element.getBoundingClientRect(),r=i.width,a=i.height,s=i.top,l=i.left,c=i.right,d=i.bottom;e.style.width="".concat(r,"px"),e.style.height="".concat(a,"px"),e.style.maxWidth="none",e.style.maxHeight="none",e.style.top="".concat(s,"px"),e.style.left="".concat(l,"px"),e.style.right="".concat(c,"px"),e.style.bottom="".concat(d,"px")}else{a=x.keyboardHeight>0?"calc(100% - ".concat(x.keyboardHeight,"px + env(safe-area-inset-bottom) - 10px)"):"100%";e.style.width="100%",e.style.height=a,e.style.maxWidth="none",e.style.maxHeight="none",e.style.top="0",e.style.left="0",e.style.right="0",e.style.bottom="0"}}function ae(){var e,n=null!==(e=document.querySelector(h.sdkButtonIframe))&&void 0!==e?e:document.createElement("iframe");if(n){var t,o=D({type:"button"});n.id=h.sdkButtonIframe.replace("#",""),n.style.position="fixed",n.style.border="none",n.style.width="".concat(120,"px"),n.style.height="".concat(48,"px"),n.style.minWidth="".concat(120,"px"),n.style.maxWidth="95%",n.style.maxHeight="95%",n.style.bottom=o.bottom,n.style.right=o.right,n.style.left=o.left,n.style.top=o.top,n.style.margin="0",n.style.padding="0",n.style.zIndex="9997",n.style.backgroundColor="transparent",n.style.opacity="0",n.style.transform="scale(0.8)",n.style.transition="opacity ".concat(.2,"s ease-in-out, transform ").concat(.2,"s ease-in-out"),setTimeout(function(){n.style.opacity="1",n.style.transform="scale(1)"},100),document.body.appendChild(n),C({iframe:n,content:(t={unreadMessageCount:x.unreadMessageCount},L({template:"<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n <meta charset=\"utf-8\" />\n <meta name=\"viewport\"\n content=\"viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no\" />\n <meta name=\"theme-color\" content=\"#000000\" />\n <meta name=\"robots\" content=\"noindex\" />\n <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n @font-face {\n font-family: 'TheymesBody';\n src: CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER;\n font-weight: normal;\n font-style: normal;\n font-display: fallback;\n }\n\n * {\n box-sizing: border-box;\n }\n\n html,\n body {\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .sdk-button {\n display: flex;\n font-family: 'TheymesBody', CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER;\n background: rgb(CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n align-items: center;\n justify-content: center;\n color: rgb(CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER);\n font-size: 14px;\n font-weight: 700;\n cursor: pointer;\n text-align: center;\n padding: 0;\n border: none;\n outline: none;\n border-radius: 999px;\n box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);\n position: relative;\n white-space: nowrap; \n }\n\n .sdk-button-text {\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .sdk-button-badge {\n position: absolute;\n top: 0;\n right: 0;\n background: rgb(CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER);\n width: 12px;\n height: 12px;\n border-radius: 999px;\n display: none;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <button class=\"sdk-button\">\n <span class=\"sdk-button-text\">WIDGET_BUTTON_TEXT_PLACEHOLDER</span>\n <span class=\"sdk-button-badge\"></span>\n </button>\n <script NONCE_ATTR_PLACEHOLDER>\n let unreadMessageCount = UNREAD_MESSAGE_COUNT_PLACEHOLDER;\n\n function calculateButtonSize() {\n const paddingX = 12;\n const scrollWidth = document.querySelector('.sdk-button-text').scrollWidth;\n const width = scrollWidth + (paddingX * 2);\n \n parent.postMessage({ action: 'theymes.sdkButtonSizeUpdated', width }, '*');\n }\n\n function openWidget() {\n parent.postMessage({ action: 'theymes.sdkButtonClicked' }, '*');\n }\n\n function iframeSubscriber(e) {\n if (e.data.action === 'unreadMessageCountUpdate') {\n unreadMessageCount = e.data.count;\n updateUnreadMessageCount()\n } else if (e.data.action === 'widgetButtonTextUpdate') {\n document.querySelector('.sdk-button-text').innerHTML = e.data.text;\n calculateButtonSize();\n }\n }\n\n function updateUnreadMessageCount() {\n if (unreadMessageCount > 0) {\n document.querySelector('.sdk-button-badge').style.display = 'block';\n } else {\n document.querySelector('.sdk-button-badge').style.display = 'none';\n }\n }\n\n document.querySelector('.sdk-button').addEventListener('click', openWidget);\n window.addEventListener('message', iframeSubscriber, false);\n\n updateUnreadMessageCount();\n calculateButtonSize();\n <\/script>\n</body>\n\n</html>"}).replace(/UNREAD_MESSAGE_COUNT_PLACEHOLDER/g,"".concat(t.unreadMessageCount)).replace(/CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER/g,O(x.colors.widgetButtonBackground)).replace(/CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER/g,O(x.colors.widgetButtonText)).replace(/CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER/g,O(x.colors.widgetButtonActionPending)).replace(/WIDGET_BUTTON_TEXT_PLACEHOLDER/g,pe()))})}}function se(e){return"start"===e.animation?"game"===x.mode?"translateY(20%)":"scale(0.8)":"game"===x.mode?"translateY(0)":"scale(1)"}function le(e){return n(this,void 0,void 0,function(){return t(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,7]),[4,e.json()];case 1:return[2,n.sent()];case 2:n.sent(),n.label=3;case 3:return n.trys.push([3,5,,6]),[4,e.text()];case 4:return[2,n.sent()];case 5:return n.sent(),[2,void 0];case 6:return[3,7];case 7:return[2]}})})}function ce(){return n(this,void 0,void 0,function(){var e,n,o,i,r,a;return t(this,function(t){switch(t.label){case 0:if(ge(),x.retryRecordRetentionTimerId&&(clearTimeout(x.retryRecordRetentionTimerId),x.retryRecordRetentionTimerId=null),x.retentionRemainingSeconds=null,x.isRetentionRecordedForSession=!0,!(e=ee()))return[2];n="https://".concat(x.domain,"/api/sdk/retention"),o=ie({supportViewConfig:e}),i={token:x.token,deviceId:x.deviceId,language:x.language,metadata:o},t.label=1;case 1:return t.trys.push([1,5,,6]),[4,fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})];case 2:return(r=t.sent()).ok?[3,4]:[4,le(r)];case 3:throw t.sent();case 4:return[3,6];case 5:return a=t.sent(),console.error("Error tracking retention:",a),x.retryRecordRetentionTimerId=setTimeout(ce,6e4),[3,6];case 6:return[2]}})})}function de(){var e=new Date;if(x.sessionStatus="active",x.sessionResumeOrStartTime=e,x.sessionStartTime){var n=x.sessionStartTime.valueOf()/1e3+x.resetSessionAfterSecs;Date.now()/1e3>n&&ue()}else ue();null!==x.retentionRemainingSeconds&&(x.recordRetentionTimerId=setTimeout(ce,1e3*x.retentionRemainingSeconds))}function ue(){x.sessionStartTime=new Date,x.retentionRemainingSeconds=x.recordRetentionAfterSecs,x.isRetentionRecordedForSession=!1,ge()}function ge(){x.recordRetentionTimerId&&(clearTimeout(x.recordRetentionTimerId),x.recordRetentionTimerId=null)}function fe(){x.isRetentionRecordedForSession&&ce()}function pe(){var e;return function(e){var n=e.split(" ");if(e.length<=16||n.length<=1)return e;for(var t=n.map(function(e){return e.length}),i=[],r=1;r<t.length;r++){var a=t.slice(0,r),s=t.slice(r),l=a.reduce(function(e,n){return e+n},0),c=s.reduce(function(e,n){return e+n},0),d=Math.abs(l-c);i.push(d)}var u=Math.min.apply(Math,i),g=i.indexOf(u);return o(o(o([],n.slice(0,g+1),!0),["<br>"],!1),n.slice(g+1),!0).join(" ")}(null!==(e=function(e){var n,t,o,i,r,a=_(null!==(n=x.language)&&void 0!==n?n:"en"),s=null===(t=x.locs[e.loc])||void 0===t?void 0:t[a];if(s)return s;var l=a.split("-")[0];return l&&(null===(o=x.locs[e.loc])||void 0===o?void 0:o[l])||(null!==(r=null===(i=x.locs[e.loc])||void 0===i?void 0:i.en)&&void 0!==r?r:null)}({loc:"widgetButtonText"}))&&void 0!==e?e:"Support")}function me(){var e=x.isInForeground,n="visible"===document.visibilityState&&document.hasFocus();x.isInForeground=n,e!==n&&K(),n&&"paused"===x.sessionStatus?de():n||"active"!==x.sessionStatus||function(){if(x.sessionResumeOrStartTime&&x.retentionRemainingSeconds){var e=Math.floor((Date.now()-x.sessionResumeOrStartTime.valueOf())/1e3);x.retentionRemainingSeconds-=e}x.sessionStatus="paused",ge()}()}function he(){var e,n=x.isLoggedIn,t=Boolean(x.signedMetadataToken||(null===(e=x.player)||void 0===e?void 0:e.id));x.isLoggedIn=t,t&&!n?W():!t&&n&&G()}try{document.addEventListener("visibilitychange",me),window.addEventListener("focus",me),window.addEventListener("blur",me),window.addEventListener("resize",re),window.addEventListener("resize",F),window.addEventListener("message",function(e){if("theymes.ready"===e.data.action){var n=document.querySelector(h.sdkLoaderIframe),t=document.querySelector(h.sdkIframe);x.networkErrorTimerId&&(clearTimeout(x.networkErrorTimerId),x.networkErrorTimerId=null),t&&(t.style.width="100%",t.style.height="100%"),n&&n.remove()}else if("theymes.close"===e.data.action)Z();else if("theymes.closeNotification"===e.data.action)j({notification:x.visibleNotification});else if("theymes.handleNotificationAction"===e.data.action)d={notification:x.visibleNotification},(null==(u=d.notification)?void 0:u.action)&&"OPEN_PAGE"===u.action.type&&(ne({path:u.action.path}),j({notification:u}));else if("theymes.sdkButtonClicked"===e.data.action)(c=document.querySelector(h.sdkButtonIframe))&&(c.style.opacity="0",c.style.transform="scale(0.8)",setTimeout(function(){c.remove()},200)),"support"===x.widgetButtonAction?X():"assistant"===x.widgetButtonAction&&V();else if("theymes.sdkButtonSizeUpdated"===e.data.action){var o=document.querySelector(h.sdkButtonIframe);o&&(o.style.width="".concat(e.data.width,"px"))}else if("theymes.openExternalPage"===e.data.action){var i=e.data.target;"_self"===i&&function(e){var n=e.key,t=e.value,o=e.ttlMs,i=e.storage,r=void 0===i?S:i,a={value:t,expiry:Date.now()+o};r.setItem(n,JSON.stringify(a))}({key:y,value:e.data.path,ttlMs:6e5}),window.open(e.data.url,i)}else if("theymes.messageCountsChanged"===e.data.action){var r=e.data,a=r.unreadMessageCount,l=r.unansweredMessageCount;if("number"!=typeof a||"number"!=typeof l)return;l!==x.unansweredMessageCount&&(x.unansweredMessageCount=l,s("unansweredMessageCountUpdate",[l])),a!==x.unreadMessageCount&&(x.unreadMessageCount=a,s("unreadMessageCountUpdate",[a]),B({action:"unreadMessageCountUpdate",count:a}))}var c,d,u},!1),$("open",function(){x.sdkIsOpen=!0,z()}),$("close",function(){x.sdkIsOpen=!1,J()})}catch(e){console.error("Error adding event listeners to SDK",e)}var ve=I("initialize",function(o,i,r){return n(void 0,void 0,void 0,function(){var n,a,s,l,c,h,v,E,k,T,C,O,L,I;return t(this,function(t){switch(t.label){case 0:if(!o||!i||!r.mode)throw new Error("Token, domain, and mode are required");x.token=o,x.domain=i,x.mode=r.mode,x.element="element"in r&&void 0!==r.element?r.element:x.element,x.language=null!==(v=r.language)&&void 0!==v?v:x.language,x.nonce=null!==(E=r.nonce)&&void 0!==E?E:x.nonce,x.deviceId=function(){var e=b("deviceId");if(e)return e;var n=(t=Date.now(),"undefined"!=typeof performance&&"function"==typeof performance.now&&(t+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?n:3&n|8).toString(16)}));return w("deviceId",n),n;var t}(),x.widgetButton="button"in r&&void 0!==r.button&&null!==(k=r.button)&&void 0!==k?k:x.widgetButton,x.widgetButtonAction="buttonAction"in r&&void 0!==r.buttonAction&&null!==(T=r.buttonAction)&&void 0!==T?T:x.widgetButtonAction,x.position="position"in r&&void 0!==r.position&&null!==(C=r.position)&&void 0!==C?C:x.position,x.x="x"in r&&void 0!==r.x?r.x:x.x,x.y="y"in r&&void 0!==r.y?r.y:x.y,x.disableInsets="game"===x.mode&&null!==x.element,q.eventPoller||(q.eventPoller=new U),n="https://".concat(i,"/api/sdk/settings"),a=new URLSearchParams({token:x.token,platform:m,mode:x.mode}).toString(),t.label=1;case 1:return t.trys.push([1,6,,7]),[4,fetch("".concat(n,"?").concat(a),{method:"GET"})];case 2:return(s=t.sent()).ok?[3,4]:[4,le(s)];case 3:throw t.sent();case 4:return[4,s.json()];case 5:return l=t.sent(),(null===(O=null==l?void 0:l.branding)||void 0===O?void 0:O.colors)&&(D=l.branding.colors,x.colors=e(e({},x.colors),D),w(d,JSON.stringify(x.colors))),(null===(L=null==l?void 0:l.branding)||void 0===L?void 0:L.locs)&&(A=l.branding.locs,x.locs=e(e({},x.locs),A),w(u,JSON.stringify(x.locs))),(null===(I=null==l?void 0:l.branding)||void 0===I?void 0:I.fonts)&&(P=l.branding.fonts,x.fonts=e(e({},x.fonts),P),w(g,JSON.stringify(x.fonts))),"number"!=typeof(null==l?void 0:l.recordRetentionAfterSecs)&&null!==(null==l?void 0:l.recordRetentionAfterSecs)||(R=l.recordRetentionAfterSecs,x.recordRetentionAfterSecs=R,w(f,JSON.stringify(x.recordRetentionAfterSecs))),"number"!=typeof(null==l?void 0:l.resetSessionAfterSecs)&&null!==(null==l?void 0:l.resetSessionAfterSecs)||(_=l.resetSessionAfterSecs,x.resetSessionAfterSecs=null!=_?_:28800,w(p,JSON.stringify(x.resetSessionAfterSecs))),de(),oe(),c=function(e){var n=e.key,t=e.storage,o=void 0===t?S:t,i=o.getItem(n);if(!i)return null;var r=JSON.parse(i);return Date.now()>r.expiry?(o.removeItem(n),null):(o.removeItem(n),r.value)}({key:y}),c&&"widget"===x.mode&&!N()?ne({path:c}):x.widgetButton&&ae(),[3,7];case 6:return h=t.sent(),console.error("Error initializing SDK:",h),[3,7];case 7:return[2]}var _,R,P,A,D})})},void 0),ye=I("openSupport",X,void 0),be=I("openAssistant",V,void 0),we=I("openResource",function(e,n){var t="/resources/".concat(e);te({path:t,config:n}),ne({path:t,config:n})},void 0),Se=I("close",Z,void 0),xe=I("getLanguage",function(){return x.language},null),Ee=I("setLanguage",function(e){var n=x.language!==e;x.language=e,n&&(oe(),B({action:"widgetButtonTextUpdate",text:pe()}))},void 0),ke=I("getSignedMetadataToken",function(){return x.signedMetadataToken},null),Te=I("setSignedMetadataToken",function(e){var n=x.signedMetadataToken!==e;x.signedMetadataToken=e,he(),n&&(oe(),fe())},void 0),Ce=I("getPlayer",function(){return x.player},null),Oe=I("setPlayer",function(e){var n,t=(null===(n=x.player)||void 0===n?void 0:n.id)!==(null==e?void 0:e.id);x.player=e,he(),t&&(oe(),fe())},void 0),Le=I("getTags",function(){return Array.from(x.tags)},[]),Ie=I("setTags",function(e){x.tags=new Set(e),oe()},void 0),_e=I("addTag",function(e){x.tags.add(e),oe()},void 0),Re=I("addTags",function(e){e.forEach(function(e){return x.tags.add(e)}),oe()},void 0),Pe=I("removeTag",function(e){x.tags.delete(e),oe()},void 0),Ae=I("removeTags",function(e){e.forEach(function(e){return x.tags.delete(e)}),oe()},void 0),Ne=I("removeAllTags",function(){x.tags.clear(),oe()},void 0),De=I("getFields",function(){return x.fields},{}),Me=I("setFields",function(e){x.fields=e,oe()},void 0),Be=I("addField",function(e,n){x.fields[e]=n,oe()},void 0),He=I("addFields",function(n){x.fields=e(e({},x.fields),n),oe()},void 0),Fe=I("removeField",function(e){delete x.fields[e],oe()},void 0),je=I("removeFields",function(e){e.forEach(function(e){return delete x.fields[e]}),oe()},void 0),Ue=I("removeAllFields",function(){x.fields={},oe()},void 0),qe=I("enableLogging",function(){x.loggingEnabled=!0},void 0),We=I("disableLogging",function(){x.loggingEnabled=!1},void 0),Ge=I("isYoungPlayer",function(){return x.youngPlayer},!1),ze=I("setYoungPlayer",function(e){x.youngPlayer=e,oe()},void 0),Je=I("isPrivacyMode",function(){return x.privacyMode},!1),Ye=I("setPrivacyMode",function(e){x.privacyMode=e,oe()},void 0),Ke=I("isSupported",Q,!1),Xe=I("requestNotificationPermission",function(){},void 0),Ve=I("enableNotifications",function(){x.notificationsPaused=!1,Y()},void 0),Ze=I("disableNotifications",function(){x.notificationsPaused=!0},void 0),Qe=I("getUnreadMessageCount",function(){return x.unreadMessageCount},0),$e=I("getUnansweredMessageCount",function(){return x.unansweredMessageCount},0),en=I("getSdkVersion",function(){return c},""),nn=I("reset",function(){x.language=null,x.tags=new Set,x.fields={},x.signedMetadataToken=null,x.player=null,he(),oe(),B({action:"widgetButtonTextUpdate",text:pe()})},void 0),tn=I("recordRetention",function(){x.isRetentionRecordedForSession||ce()},void 0),on=I("addEventListener",$,void 0),rn=I("removeEventListener",function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];a.apply(void 0,e)},void 0),an=I("iosSetKeyboardHeight",function(e){x.keyboardHeight=e,re()},void 0);export{on as addEventListener,Be as addField,He as addFields,_e as addTag,Re as addTags,Se as close,We as disableLogging,Ze as disableNotifications,qe as enableLogging,Ve as enableNotifications,De as getFields,xe as getLanguage,Ce as getPlayer,en as getSdkVersion,ke as getSignedMetadataToken,Le as getTags,$e as getUnansweredMessageCount,Qe as getUnreadMessageCount,ve as initialize,an as iosSetKeyboardHeight,Je as isPrivacyMode,Ke as isSupported,Ge as isYoungPlayer,be as openAssistant,we as openResource,ye as openSupport,tn as recordRetention,Ue as removeAllFields,Ne as removeAllTags,rn as removeEventListener,Fe as removeField,je as removeFields,Pe as removeTag,Ae as removeTags,Xe as requestNotificationPermission,nn as reset,Me as setFields,Ee as setLanguage,Oe as setPlayer,Ye as setPrivacyMode,Te as setSignedMetadataToken,Ie as setTags,ze as setYoungPlayer};
1
+ var e=function(){return e=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var i in n=arguments[t])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e},e.apply(this,arguments)};function n(e,n,t,o){return new(t||(t=Promise))(function(i,r){function a(e){try{l(o.next(e))}catch(e){r(e)}}function s(e){try{l(o.throw(e))}catch(e){r(e)}}function l(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t(function(e){e(n)})).then(a,s)}l((o=o.apply(e,n||[])).next())})}function t(e,n){var t,o,i,r={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(r=0)),r;)try{if(t=1,o&&(i=2&s[0]?o.return:s[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;switch(o=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,o=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(i=r.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(6===s[0]&&r.label<i[1]){r.label=i[1],i=s;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(s);break}i[2]&&r.ops.pop(),r.trys.pop();continue}s=n.call(e,r)}catch(e){s=[6,e],o=0}finally{t=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function o(e,n,t){if(t||2===arguments.length)for(var o,i=0,r=n.length;i<r;i++)!o&&i in n||(o||(o=Array.prototype.slice.call(n,0,i)),o[i]=n[i]);return e.concat(o||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var i={unreadMessageCountUpdate:new Set,unansweredMessageCountUpdate:new Set,open:new Set,close:new Set};function r(e,n){i[e].add(n)}function a(e,n){i[e].delete(n)}function s(e,n){i[e].forEach(function(e){return e.apply(void 0,n)})}var l='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: sans-serif;\n font-size: CSS_FONT_SIZE_PLACEHOLDER;\n }\n\n html,\n body {\n background: rgb(CSS_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n padding-top: INSET_TOP_PLACEHOLDER;\n padding-bottom: INSET_BOTTOM_PLACEHOLDER;\n padding-left: INSET_LEFT_PLACEHOLDER;\n padding-right: INSET_RIGHT_PLACEHOLDER;\n }\n\n .top-bar {\n flex: 0 0 auto;\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: flex-end;\n }\n\n .close-button {\n padding: 0.5rem 1rem;\n cursor: pointer;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 1.75rem;\n height: 1.75rem;\n }\n\n .error-wrapper {\n flex: 1 0 0%;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: 12px;\n padding: 12px;\n }\n\n h1 {\n font-size: 18px;\n font-weight: 400;\n color: rgb(CSS_TEXT_PLACEHOLDER);\n }\n\n svg.error-icon {\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="wrapper">\n <div class="top-bar">\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"\n stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"\n class="lucide lucide-x-icon lucide-x">\n <path d="M18 6 6 18" />\n <path d="m6 6 12 12" />\n </svg>\n </div>\n </div>\n <div class="error-wrapper">\n <svg class="error-icon" width="91" height="91" viewBox="0 0 91 91" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path\n d="M45.1079 89.1321C50.7158 89.1321 55.2618 84.5859 55.2618 78.9783C55.2618 73.3707 50.7158 68.8245 45.1079 68.8245C39.5001 68.8245 34.9541 73.3707 34.9541 78.9783C34.9541 84.5859 39.5001 89.1321 45.1079 89.1321Z"\n stroke="#FFB547" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />\n <path d="M24.7637 58.6355C35.9988 47.4005 54.2144 47.4005 65.4492 58.6355" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M12.7988 46.6689C22.1436 37.3241 34.529 32.8731 46.7703 33.3159" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M1.1084 34.4283C11.6674 23.9971 25.012 18.0833 38.7295 16.6868" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M89.1082 1.13208L62.0312 28.209" stroke="#FFB547" stroke-width="2" stroke-linecap="round"\n stroke-linejoin="round" />\n <path d="M62.0312 1.13208L89.1082 28.209" stroke="#FFB547" stroke-width="2" stroke-linecap="round"\n stroke-linejoin="round" />\n </svg>\n <div>\n <h1>Connection error</h1>\n </div>\n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeTheymesSdk() {\n parent.postMessage({ action: \'theymes.close\' }, \'*\');\n }\n\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeTheymesSdk);\n <\/script>\n</body>\n\n</html>',c="1.3.1",d="colors",u="locs",g="fonts",p="deviceId",f="recordRetentionAfterSecs",m="resetSessionAfterSecs",v="settingsNextPollAt",h="eventPollerNextPollAt",y="hasSupportInteraction",b="sendPlayerRetention",w="pathOnInit",S=2419200,x="web",k={sdkDialog:"#theymes-sdk-dialog",sdkIframeWrapper:"#theymes-sdk-wrapper",sdkIframe:"#theymes-sdk",sdkLoaderIframe:"#theymes-sdk-loader",notificationDialog:"#theymes-sdk-notification-dialog",notificationIframe:"#theymes-sdk-notification",sdkButtonIframe:"#theymes-sdk-button"},C=.2,E=function(e){var n;try{return null!==(n=null===localStorage||void 0===localStorage?void 0:localStorage.getItem(e))&&void 0!==n?n:null}catch(e){return null}},T=function(e,n){try{null===localStorage||void 0===localStorage||localStorage.setItem(e,n)}catch(e){}},O=function(e){try{null===localStorage||void 0===localStorage||localStorage.removeItem(e)}catch(e){}},I={length:0,getItem:function(e){var n;try{return null!==(n=null===sessionStorage||void 0===sessionStorage?void 0:sessionStorage.getItem(e))&&void 0!==n?n:null}catch(e){return null}},setItem:function(e,n){try{null===sessionStorage||void 0===sessionStorage||sessionStorage.setItem(e,n)}catch(e){}},removeItem:function(e){try{null===sessionStorage||void 0===sessionStorage||sessionStorage.removeItem(e)}catch(e){}},clear:function(){try{null===sessionStorage||void 0===sessionStorage||sessionStorage.clear()}catch(e){}},key:function(e){var n;try{return null!==(n=null===sessionStorage||void 0===sessionStorage?void 0:sessionStorage.key(e))&&void 0!==n?n:null}catch(e){return null}}};function P(e){return"".concat("theymes",".").concat(e)}function L(e){return null===_.token?null:"".concat(P(e),".").concat(_.token)}function R(e){if(null===_.resolvedPlayerId||void 0===_.resolvedPlayerId)return null;var n=L(e);return null===n?null:"".concat(n,".").concat(_.resolvedPlayerId)}var _={token:null,domain:null,sdkApiDomain:null,mode:"game",deviceId:null,position:"bottom-right",widgetButton:!1,widgetButtonAction:"support",x:20,y:20,loggingEnabled:!1,element:null,language:null,userLanguage:navigator.language,tags:new Set,fields:{},youngPlayer:!1,privacyMode:!1,signedMetadataToken:null,isLoggedIn:!1,isInForeground:!0,hasNetworkConnectivity:!0,player:null,sdkIsOpen:!1,forceUpdateSdkDialog:!1,recordRetentionAfterSecs:null,resetSessionAfterSecs:28800,sessionStatus:"waiting",sessionStartTime:null,sessionResumeOrStartTime:null,retentionRemainingSeconds:null,isRetentionRecordedForSession:!1,recordRetentionTimerId:null,retryRecordRetentionTimerId:null,networkErrorTimerId:null,sendPlayerRetention:"support-only",hasSupportInteraction:!1,resolvedPlayerId:null,colors:{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}},locs:{widgetButtonText:{}},fonts:A(),notificationsPaused:!0,notifications:[],visibleNotification:null,unreadMessageCount:0,unansweredMessageCount:0,previousPath:null,previousConfig:null,nonce:null,keyboardHeight:0,disableInsets:!1};function A(){return{body:void 0}}var D=["always","support-only","never"];function N(){_.colors=function(){var n=L(d);if(null===n)return{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}};var t=E(n);if(t){var o=JSON.parse(t);return e(e({},{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}}),o)}return{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}}}(),_.locs=function(){var n=L(u);if(null===n)return{widgetButtonText:{}};var t=E(n);if(t){var o=JSON.parse(t);return e(e({},{widgetButtonText:{}}),o)}return{widgetButtonText:{}}}(),_.fonts=function(){var n=L(g);if(null===n)return{body:void 0};var t=E(n);if(t){var o=JSON.parse(t);return e(e({},{body:void 0}),o)}return{body:void 0}}(),_.recordRetentionAfterSecs=function(){var e=L(f);if(null===e)return null;var n=E(e);if(n){var t=JSON.parse(n);if("number"==typeof t)return t}return null}(),_.resetSessionAfterSecs=function(){var e=L(m);if(null===e)return 28800;var n=E(e);if(n){var t=JSON.parse(n);if("number"==typeof t)return t}return 28800}(),_.sendPlayerRetention=function(){var e=L(b);if(null===e)return"support-only";var n=E(e);return n&&D.includes(n)?n:"support-only"}()}var M=function(e,n){return e===n||Boolean(e&&n&&"object"==typeof e&&"object"==typeof n&&Object.keys(e).length===Object.keys(n).length&&Object.entries(e).every(function(e){var t=e[0],o=e[1];return M(o,n[t])}))};function B(e){var n,t=e.iframe,o=e.content,i=null===(n=t.contentWindow)||void 0===n?void 0:n.document;i&&(i.open(),i.write(o),i.close())}function H(e){return"".concat(e.r,", ").concat(e.g,", ").concat(e.b)}function F(e){var n,t,o,i;return e.template.replace(/PLATFORM_PLACEHOLDER/g,x).replace(/INSET_TOP_PLACEHOLDER/g,_.disableInsets?"0px":"env(safe-area-inset-top, 0px)").replace(/INSET_BOTTOM_PLACEHOLDER/g,_.disableInsets?"0px":"env(safe-area-inset-bottom, 0px)").replace(/INSET_LEFT_PLACEHOLDER/g,_.disableInsets?"0px":"env(safe-area-inset-left, 0px)").replace(/INSET_RIGHT_PLACEHOLDER/g,_.disableInsets?"0px":"env(safe-area-inset-right, 0px)").replace(/CSS_TEXT_PLACEHOLDER/g,H(_.colors.text)).replace(/CSS_BORDER_PLACEHOLDER/g,H(_.colors.border)).replace(/CSS_BACKGROUND_PLACEHOLDER/g,H(_.colors.background)).replace(/CSS_TILE_PLACEHOLDER/g,H(_.colors.tile)).replace(/CSS_ACCENT_PLACEHOLDER/g,H(_.colors.accent)).replace(/CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER/g,H(_.colors.notificationBackground)).replace(/CSS_NOTIFICATION_TEXT_PLACEHOLDER/g,H(_.colors.notificationText)).replace(/CSS_FONT_SIZE_PLACEHOLDER/g,"game"===_.mode?"16px":"14px").replace(/CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER/g,null!==(t=null===(n=_.fonts.body)||void 0===n?void 0:n.regular)&&void 0!==t?t:"url('https://fonts.gstatic.com/s/poppins/v22/pxiEyp8kv8JHgFVrJJfecnFHGPc.woff2') format('woff2')").replace(/CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER/g,null!==(i=null===(o=_.fonts.body)||void 0===o?void 0:o.fallback)&&void 0!==i?i:"ui-sans-serif, system-ui, sans-serif").replace(/NONCE_ATTR_PLACEHOLDER/g,_.nonce?'nonce="'.concat(_.nonce,'"'):"")}function j(e,n,t){return function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];try{return n.apply(void 0,o)}catch(n){return console.error("Error in ".concat(e),n),t}}}var U=function(e){var n=e.split(/[-_]/),t=n[0],o=n[1];return t?o?"".concat(t.toLowerCase(),"-").concat(o.toUpperCase()):t.toLowerCase():"en"},q=/(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|redmi|series[46]0|samsungbrowser.*mobile|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,W=/CrOS/,J=/android|ipad|playbook|silk/i;function G(){return!!function(e){e||(e={});var n=e.ua;if(n||"undefined"==typeof navigator||(n=navigator.userAgent),n&&n.headers&&"string"==typeof n.headers["user-agent"]&&(n=n.headers["user-agent"]),"string"!=typeof n)return!1;var t=q.test(n)&&!W.test(n)||!!e.tablet&&J.test(n);return!t&&e.tablet&&e.featureDetect&&navigator&&navigator.maxTouchPoints>1&&-1!==n.indexOf("Macintosh")&&-1!==n.indexOf("Safari")&&(t=!0),t}({tablet:!0})&&(window.innerWidth<500||window.innerHeight<500)}function z(e){var n=e.type,t=_.position,o=_.x,i=_.y;return G()&&"widget"===n?{top:"0",left:"0",right:"0",bottom:"0"}:"top-left"===t?{top:"".concat(o,"px"),left:"".concat(i,"px"),right:"auto",bottom:"auto"}:"top-right"===t?{top:"".concat(o,"px"),right:"".concat(i,"px"),left:"auto",bottom:"auto"}:"bottom-left"===t?{bottom:"".concat(o,"px"),left:"".concat(i,"px"),right:"auto",top:"auto"}:{bottom:"".concat(o,"px"),right:"".concat(i,"px"),left:"auto",top:"auto"}}function Y(){return G()?{width:"100%",height:"100%",maxWidth:"none",maxHeight:"none"}:{width:"".concat(340,"px"),height:"".concat(680,"px"),maxWidth:"none",maxHeight:"calc(100vh - ".concat(2*_.y,"px)")}}function K(e){var n=document.querySelector(k.sdkButtonIframe);if(n)var t=setInterval(function(){var o,i;"complete"===(null===(o=n.contentDocument)||void 0===o?void 0:o.readyState)&&(clearInterval(t),null===(i=null==n?void 0:n.contentWindow)||void 0===i||i.postMessage(e,"*"))},100)}function X(){var e,n;if(!_.notificationsPaused){var t=_.notifications[0];if(t&&!_.visibleNotification){_.visibleNotification=t;var o=null!==(e=document.querySelector(k.notificationDialog))&&void 0!==e?e:document.createElement("div");o.id=k.notificationDialog.replace("#",""),o.style.position="fixed",o.style.border="none",o.style.margin="0",o.style.padding="0",o.style.zIndex="9999",o.style.colorScheme="auto",o.style.backgroundColor="transparent",o.style.pointerEvents="none",o.style.overflow="hidden",document.body.appendChild(o);var i,r=null!==(n=o.querySelector(k.notificationIframe))&&void 0!==n?n:document.createElement("iframe");r.id=k.notificationIframe.replace("#",""),r.style.position="absolute",r.style.border="none",r.style.width="0",r.style.height="0",r.style.top="-20px",r.style.left="0",r.style.colorScheme="auto",r.style.pointerEvents="auto",r.style.marginTop="-20px",r.style.opacity="0",r.style.transition="opacity ".concat(.2,"s ease-in-out, margin-top ").concat(.2,"s ease-in-out"),o.appendChild(r),B({iframe:r,content:(i={text:t.text},F({template:'<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n @font-face {\n font-family: \'TheymesBody\';\n src: CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER;\n font-weight: normal;\n font-style: normal;\n font-display: fallback;\n }\n\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'TheymesBody\', CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER;\n }\n\n html,\n body {\n width: 100%;\n height: auto;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_NOTIFICATION_TEXT_PLACEHOLDER);\n width: 1.25rem;\n height: 1.25rem;\n }\n\n .notification {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n background: rgb(CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: auto;\n margin: 0;\n padding: 12px;\n border-radius: 6px;\n color: rgb(CSS_NOTIFICATION_TEXT_PLACEHOLDER);\n }\n\n .notification-text {\n flex: 1 0 0%;\n font-size: 0.875rem;\n /* 14/16 */\n line-height: 1.2;\n display: -webkit-box;\n line-clamp: 2;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n text-overflow: ellipsis;\n cursor: pointer;\n }\n\n .close-button {\n flex: 0 0 auto;\n padding-left: 10px;\n cursor: pointer;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="notification">\n <div class="notification-text">NOTIFICATION_TEXT_PLACEHOLDER</div>\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round">\n <path d="M18 6 6 18"></path>\n <path d="m6 6 12 12"></path>\n </svg>\n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeNotification() {\n parent.postMessage({ action: \'theymes.closeNotification\' }, \'*\');\n }\n\n function notificationClicked() {\n parent.postMessage({ action: \'theymes.handleNotificationAction\' }, \'*\');\n }\n\n document.querySelector(\'.notification-text\').addEventListener(\'click\', notificationClicked);\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeNotification);\n <\/script>\n</body>\n\n</html>'}).replace(/NOTIFICATION_TEXT_PLACEHOLDER/g,i.text))}),setTimeout(function(){r.style.opacity="1",r.style.marginTop="0px",V()},500),t.closeAfterSeconds>0&&setTimeout(function(){Z({notification:t})},1e3*t.closeAfterSeconds)}}}function V(){var e,n,t,o=document.querySelector(k.notificationDialog),i=document.querySelector(k.notificationIframe);if(o&&i){var r=(null===(t=null===(n=null===(e=i.contentWindow)||void 0===e?void 0:e.document)||void 0===n?void 0:n.body)||void 0===t?void 0:t.scrollHeight)?"".concat(i.contentWindow.document.body.scrollHeight,"px"):"0";if("widget"===_.mode){var a=z({type:"widget"}),s=Y(),l="calc(".concat(s.width," - 20px)");o.style.bottom=a.bottom,o.style.right=a.right,o.style.left=a.left,o.style.top=a.top,o.style.overflow="hidden",i.style.width=l}else if(_.element){var c=_.element.getBoundingClientRect();l="".concat(c.width-20,"px");o.style.top="".concat(c.top,"px"),o.style.left="".concat(c.left,"px"),o.style.right="".concat(c.right,"px"),o.style.bottom="".concat(c.bottom,"px"),o.style.overflow="hidden",i.style.width=l}else{l="calc(100% - 20px)";o.style.top=_.disableInsets?"0px":"env(safe-area-inset-top, 0px)",o.style.left=_.disableInsets?"0px":"env(safe-area-inset-left, 0px)",o.style.right=_.disableInsets?"0px":"env(safe-area-inset-right, 0px)",o.style.bottom=_.disableInsets?"0px":"env(safe-area-inset-bottom, 0px)",o.style.overflow="visible",i.style.width=l}i.style.height=r,i.style.top="10px",i.style.left="10px"}}function Z(e){if(e.notification&&_.visibleNotification===e.notification){var n=document.querySelector(k.notificationIframe),t=document.querySelector(k.notificationDialog);n&&(n.style.opacity="0",n.style.marginTop="-20px",setTimeout(function(){null==t||t.remove(),_.notifications=_.notifications.slice(1),_.visibleNotification=null,X()},200))}}var Q=function(){function e(){Object.defineProperty(this,"isRunning",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"retryFailureCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"lastPollDate",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"nextPollDate",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.restoreNextPollDateIfNeeded(),this.resumeIfNeeded(!1)}return Object.defineProperty(e.prototype,"restoreNextPollDateIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=R(h);if(null!==e&&!_.hasSupportInteraction){var n=E(e);if(n){var t=JSON.parse(n);if("number"==typeof t&&t>0){var o=Date.now()/1e3,i=t;i>o+S&&(i=o+S,T(e,JSON.stringify(i))),i>o&&(this.nextPollDate=new Date(1e3*i),_.loggingEnabled&&console.log("EventPoller: restored next poll date from storage: ".concat(this.nextPollDate.toISOString()," (in ").concat(Math.round(i-o),"s)")))}}}}}),Object.defineProperty(e.prototype,"onIsInForegroundChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(){_.isInForeground?this.resumeIfNeeded(!1):this.pauseIfNeeded()}}),Object.defineProperty(e.prototype,"onHasNetworkConnectivityChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.resumeIfNeeded(!1)}}),Object.defineProperty(e.prototype,"resume",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning=!0;var e=new Date;if(this.nextPollDate||(this.nextPollDate=new Date(e.getTime()+1e3)),e>=this.nextPollDate)this.pollEventsRequest();else{var n=(this.nextPollDate.getTime()-e.getTime())/1e3;this.scheduleNextPollEventsRequest(n)}}}),Object.defineProperty(e.prototype,"pause",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning=!1,this.timer&&(clearTimeout(this.timer),this.timer=null)}}),Object.defineProperty(e.prototype,"shouldBeRunning",{enumerable:!1,configurable:!0,writable:!0,value:function(){return _.isLoggedIn&&_.isInForeground&&_.hasNetworkConnectivity&&!_.sdkIsOpen}}),Object.defineProperty(e.prototype,"reset",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,n;this.nextPollDate=null,this.lastPollDate=null,this.retryFailureCount=0,e=R(h),n=R(y),null!==e&&O(e),null!==n&&O(n),_.hasSupportInteraction=!1}}),Object.defineProperty(e.prototype,"resumeIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){e&&this.reset(),!this.shouldBeRunning()||this.isRunning&&!e||this.resume()}}),Object.defineProperty(e.prototype,"pauseIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning&&!this.shouldBeRunning()&&this.pause()}}),Object.defineProperty(e.prototype,"onOpen",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.pauseIfNeeded(),this.reset()}}),Object.defineProperty(e.prototype,"onClose",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.resumeIfNeeded(!0)}}),Object.defineProperty(e.prototype,"onLogin",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.restoreNextPollDateIfNeeded(),this.resumeIfNeeded(!1)}}),Object.defineProperty(e.prototype,"onLogout",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.pauseIfNeeded(),this.reset()}}),Object.defineProperty(e.prototype,"scheduleNextPollEventsRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){var t=this;void 0===n&&(n=!1);var o=Date.now();if(this.nextPollDate=new Date(o+1e3*e),n){var i=R(h);if(null!==i){var r=o/1e3,a=r+e,s=Math.min(a,r+S);T(i,JSON.stringify(s))}}this.timer&&clearTimeout(this.timer),this.timer=setTimeout(function(){t.timer=null,t.pollEventsRequest()},1e3*e)}}),Object.defineProperty(e.prototype,"pollEventsRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(){return n(this,void 0,void 0,function(){var e,n,i,r,a,l,d,u,g,p;return t(this,function(t){switch(t.label){case 0:if(!_.token||!_.sdkApiDomain||!_.deviceId)return[2];if(!this.isRunning)return[2];if(this.lastPollDate&&(e=new Date(this.lastPollDate.getTime()+6e4),(n=(e.getTime()-Date.now())/1e3)>0))return this.scheduleNextPollEventsRequest(n),[2];this.lastPollDate=new Date,null!==(i=R(h))&&O(i),r={token:_.token,deviceId:_.deviceId,language:null!==(g=_.language)&&void 0!==g?g:null,userLanguage:_.userLanguage,mode:_.mode,sdkVersion:c},(null===(p=_.player)||void 0===p?void 0:p.id)&&(r.unsignedPlayerId=_.player.id),_.signedMetadataToken&&(r.signedMetadataToken=_.signedMetadataToken),t.label=1;case 1:return t.trys.push([1,4,,5]),[4,fetch("https://".concat(_.sdkApiDomain,"/api/events"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})];case 2:if(!(a=t.sent()).ok)throw new Error("HTTP error! status: ".concat(a.status));return[4,a.json()];case 3:return l=t.sent(),this.retryFailureCount=0,function(e){_.hasSupportInteraction=e;var n=R(y);null!==n&&T(n,String(_.hasSupportInteraction))}(l.hasSupportInteraction),this.scheduleNextPollEventsRequest(l.nextPollSeconds,!l.hasSupportInteraction),_.notifications=o(o([],_.notifications,!0),l.notifications,!0),!_.notificationsPaused&&!_.sdkIsOpen&&_.notifications.length>0&&X(),l.unansweredMessageCount!==_.unansweredMessageCount&&(_.unansweredMessageCount=l.unansweredMessageCount,s("unansweredMessageCountUpdate",[l.unansweredMessageCount])),l.unreadMessageCount!==_.unreadMessageCount&&(_.unreadMessageCount=l.unreadMessageCount,s("unreadMessageCountUpdate",[l.unreadMessageCount]),K({action:"unreadMessageCountUpdate",count:l.unreadMessageCount})),[3,5];case 4:return d=t.sent(),console.error("Error fetching events:",d),this.retryFailureCount+=1,u=Math.min(Math.pow(2,this.retryFailureCount+5),86400),this.scheduleNextPollEventsRequest(u),[3,5];case 5:return[2]}})})}}),e}(),$={eventPoller:null},ee=function(){var e;!function(){var e=R(y);if(null!==e){var n=E(e);_.hasSupportInteraction="true"===n}}(),null===(e=$.eventPoller)||void 0===e||e.onLogin()},ne=function(){var e;null===(e=$.eventPoller)||void 0===e||e.onLogout()},te=function(){var e;null===(e=$.eventPoller)||void 0===e||e.onOpen()},oe=function(){var e;null===(e=$.eventPoller)||void 0===e||e.onClose()},ie=function(){var e;null===(e=$.eventPoller)||void 0===e||e.onIsInForegroundChanged()},re=function(e){var n="/help-center";ge({path:n,config:e}),ue({path:n,config:e})},ae=function(e){var n="/assistant";ge({path:n,config:e}),ue({path:n,config:e})},se=function(){!function(){var e=document.querySelector(k.sdkDialog),n=document.querySelector(k.sdkIframeWrapper);if(e){var t=function(){"widget"!==_.mode||_.forceUpdateSdkDialog?e.remove():e.style.display="none",_.forceUpdateSdkDialog=!1};n?(n.style.opacity="0",n.style.transform=he({animation:"start"}),setTimeout(function(){t()},200)):t()}_.widgetButton&&ve();s("close",[])}()},le=function(){try{return CSS.supports("color","var(--color)")&&CSS.supports("color","rgb(255 255 255 / 0.5)")}catch(e){return!1}},ce=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];r.apply(void 0,e)};function de(n){var t,i,r,a,s,l,d=(null!=n?n:{}).config;if(!_.token||!_.domain||!_.deviceId)return null;var u=null!==(t=null==d?void 0:d.tags)&&void 0!==t?t:[],g=null!==(i=null==d?void 0:d.fields)&&void 0!==i?i:{},p=null!==(a=null!==(r=null==d?void 0:d.language)&&void 0!==r?r:_.language)&&void 0!==a?a:null,f=null!==(s=_.signedMetadataToken)&&void 0!==s?s:null,m=null!==(l=_.player)&&void 0!==l?l:null,v={_platform:x,_sdkVersion:c};_.youngPlayer&&(v._youngPlayer=!0),(_.privacyMode||_.youngPlayer)&&(v._privacyMode=!0);var h=o(o([],Array.from(_.tags),!0),u,!0),y=e(e(e({},_.fields),g),v);return{token:_.token,domain:_.domain,deviceId:_.deviceId,tags:h,fields:y,language:p,signedMetadataToken:f,player:m}}function ue(e){var n,t,o,i=de({config:e.config});if(i){var r=null!==(n=document.querySelector(k.sdkDialog))&&void 0!==n?n:document.createElement("div");r.id=k.sdkDialog.replace("#",""),r.style.display="block",r.style.position="fixed",r.style.border="none",r.style.width="0",r.style.height="0",r.style.margin="0",r.style.padding="0",r.style.zIndex="9998",r.style.overflow="hidden",r.style.backgroundColor="transparent";var a=null!==(t=r.querySelector(k.sdkIframeWrapper))&&void 0!==t?t:document.createElement("div");a.id=k.sdkIframeWrapper.replace("#",""),a.style.position="relative",a.style.width="100%",a.style.height="100%",a.style.top="0",a.style.right="0",a.style.bottom="0",a.style.left="0",a.style.opacity="0",a.style.colorScheme="auto",a.style.border="none",a.style.backgroundColor="rgb(".concat(H(_.colors.background),")"),a.style.transform=he({animation:"start"}),a.style.transition=(_.mode,"opacity ".concat(C,"s ease-in-out, transform ").concat(C,"s ease-in-out")),"widget"===_.mode&&(a.style.overflow="hidden");var c=null!==(o=a.querySelector(k.sdkLoaderIframe))&&void 0!==o?o:document.createElement("iframe");c.id=k.sdkLoaderIframe.replace("#",""),c.style.position="absolute",c.style.border="none",c.style.width="100%",c.style.height="100%",c.style.top="0",c.style.right="0",c.style.bottom="0",c.style.left="0",c.style.colorScheme="auto";var d=a.querySelector(k.sdkIframe),u=null!=d?d:document.createElement("iframe"),g=setInterval(function(){var e;"complete"===(null===(e=u.contentDocument)||void 0===e?void 0:e.readyState)&&(clearInterval(g),f())},500);u.id=k.sdkIframe.replace("#",""),u.style.position="absolute",u.style.border="none",u.style.top="0",u.style.right="0",u.style.bottom="0",u.style.left="0",u.style.colorScheme="auto",d&&!_.networkErrorTimerId||(u.src=function(e){var n=e.path,t=e.supportViewConfig,o="https://".concat(_.domain,"/sdk"),i=new URLSearchParams;i.set("platform",x),i.set("token",t.token),i.set("deviceId",t.deviceId),i.set("domain",t.domain),i.set("mode",_.mode),i.set("origin",window.location.origin),i.set("userLanguage",_.userLanguage),_.disableInsets&&i.set("disableInsets","true");t.language&&i.set("language",t.language);le()||i.set("unsupported","true");var r=fe({supportViewConfig:t});return i.set("metadata",JSON.stringify(r)),"".concat(o).concat(n,"?").concat(i.toString())}({path:e.path,supportViewConfig:i}),u.style.width="0",u.style.height="0",r.appendChild(a),a.appendChild(c),a.appendChild(u),document.body.appendChild(r)),B({iframe:c,content:F({template:'<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n * {\n box-sizing: border-box;\n }\n\n html,\n body {\n background: rgb(CSS_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n padding-top: INSET_TOP_PLACEHOLDER;\n padding-bottom: INSET_BOTTOM_PLACEHOLDER;\n padding-left: INSET_LEFT_PLACEHOLDER;\n padding-right: INSET_RIGHT_PLACEHOLDER;\n }\n\n .top-bar {\n flex: 0 0 auto;\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: flex-end;\n }\n\n .loader-wrapper {\n flex: 1 0 0%;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: 12px;\n }\n\n .close-button {\n padding: 0.5rem 1rem;\n cursor: pointer;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 1.75rem;\n height: 1.75rem;\n }\n\n @keyframes spin {\n to {\n transform: rotate(360deg);\n }\n }\n\n .loader {\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 2rem;\n height: 2rem;\n animation: spin 1s linear infinite;\n transform-origin: center;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="wrapper">\n <div class="top-bar">\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"\n stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"\n class="lucide lucide-x-icon lucide-x">\n <path d="M18 6 6 18" />\n <path d="m6 6 12 12" />\n </svg>\n </div>\n </div>\n <div class="loader-wrapper">\n <svg class="loader" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg" fill="none" data-test-name="oval"\n role="img">\n <g fill="none" fill-rule="evenodd">\n <g transform="translate(1 1)" stroke-width="2">\n <circle stroke-opacity="0.5" cx="18" cy="18" r="18" />\n <path d="M36 18c0-9.94-8.06-18-18-18" />\n </g>\n </g>\n </svg>\n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeTheymesSdk() {\n parent.postMessage({ action: \'theymes.close\' }, \'*\');\n }\n\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeTheymesSdk);\n <\/script>\n</body>\n\n</html>'})});var p=!1,f=function(){p||(p=!0,_.networkErrorTimerId=setTimeout(function(){B({iframe:c,content:F({template:l})})},1e4))};u.onload=f,u.onerror=function(){B({iframe:c,content:F({template:l})})},me(),s("open",[]),setTimeout(function(){a.style.opacity="1",a.style.transform=he({animation:"end"})},100)}}function ge(e){var n=e.path,t=e.config,o=null!=t?t:null;_.previousPath===n&&M(_.previousConfig,o)||(_.previousPath=n,_.previousConfig=o,pe())}function pe(){var e=document.querySelector(k.sdkDialog);_.sdkIsOpen?_.forceUpdateSdkDialog=!0:null==e||e.remove()}function fe(e){var n=e.supportViewConfig,t={unsigned:{},signed:void 0};return n.player&&(t.unsigned.player=n.player),n.tags&&(t.unsigned.tags=n.tags),n.fields&&(t.unsigned.fields=n.fields),n.signedMetadataToken&&(t.signed=n.signedMetadataToken),t}function me(){var e=document.querySelector(k.sdkDialog),n=document.querySelector(k.sdkIframeWrapper);if(e&&n)if("widget"===_.mode){var t=z({type:"widget"}),o=Y();e.style.width=o.width,e.style.height=o.height,e.style.maxWidth=o.maxWidth,e.style.maxHeight=o.maxHeight,e.style.bottom=t.bottom,e.style.right=t.right,e.style.left=t.left,e.style.top=t.top,G()?(n.style.border="none",n.style.borderRadius="0"):(n.style.border="1px solid rgb(".concat(H(_.colors.border),")"),n.style.borderRadius="10px")}else if(n.style.border="none",n.style.borderRadius="0",_.element){var i=_.element.getBoundingClientRect(),r=i.width,a=i.height,s=i.top,l=i.left,c=i.right,d=i.bottom;e.style.width="".concat(r,"px"),e.style.height="".concat(a,"px"),e.style.maxWidth="none",e.style.maxHeight="none",e.style.top="".concat(s,"px"),e.style.left="".concat(l,"px"),e.style.right="".concat(c,"px"),e.style.bottom="".concat(d,"px")}else{a=_.keyboardHeight>0?"calc(100% - ".concat(_.keyboardHeight,"px + env(safe-area-inset-bottom) - 10px)"):"100%";e.style.width="100%",e.style.height=a,e.style.maxWidth="none",e.style.maxHeight="none",e.style.top="0",e.style.left="0",e.style.right="0",e.style.bottom="0"}}function ve(){var e,n=null!==(e=document.querySelector(k.sdkButtonIframe))&&void 0!==e?e:document.createElement("iframe");if(n){var t,o=z({type:"button"});n.id=k.sdkButtonIframe.replace("#",""),n.style.position="fixed",n.style.border="none",n.style.width="".concat(120,"px"),n.style.height="".concat(48,"px"),n.style.minWidth="".concat(120,"px"),n.style.maxWidth="95%",n.style.maxHeight="95%",n.style.bottom=o.bottom,n.style.right=o.right,n.style.left=o.left,n.style.top=o.top,n.style.margin="0",n.style.padding="0",n.style.zIndex="9997",n.style.backgroundColor="transparent",n.style.opacity="0",n.style.transform="scale(0.8)",n.style.transition="opacity ".concat(.2,"s ease-in-out, transform ").concat(.2,"s ease-in-out"),setTimeout(function(){n.style.opacity="1",n.style.transform="scale(1)"},100),document.body.appendChild(n),B({iframe:n,content:(t={unreadMessageCount:_.unreadMessageCount},F({template:"<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n <meta charset=\"utf-8\" />\n <meta name=\"viewport\"\n content=\"viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no\" />\n <meta name=\"theme-color\" content=\"#000000\" />\n <meta name=\"robots\" content=\"noindex\" />\n <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n @font-face {\n font-family: 'TheymesBody';\n src: CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER;\n font-weight: normal;\n font-style: normal;\n font-display: fallback;\n }\n\n * {\n box-sizing: border-box;\n }\n\n html,\n body {\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .sdk-button {\n display: flex;\n font-family: 'TheymesBody', CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER;\n background: rgb(CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n align-items: center;\n justify-content: center;\n color: rgb(CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER);\n font-size: 14px;\n font-weight: 700;\n cursor: pointer;\n text-align: center;\n padding: 0;\n border: none;\n outline: none;\n border-radius: 999px;\n box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);\n position: relative;\n white-space: nowrap; \n }\n\n .sdk-button-text {\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .sdk-button-badge {\n position: absolute;\n top: 0;\n right: 0;\n background: rgb(CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER);\n width: 12px;\n height: 12px;\n border-radius: 999px;\n display: none;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <button class=\"sdk-button\">\n <span class=\"sdk-button-text\">WIDGET_BUTTON_TEXT_PLACEHOLDER</span>\n <span class=\"sdk-button-badge\"></span>\n </button>\n <script NONCE_ATTR_PLACEHOLDER>\n let unreadMessageCount = UNREAD_MESSAGE_COUNT_PLACEHOLDER;\n\n function calculateButtonSize() {\n const paddingX = 12;\n const scrollWidth = document.querySelector('.sdk-button-text').scrollWidth;\n const width = scrollWidth + (paddingX * 2);\n \n parent.postMessage({ action: 'theymes.sdkButtonSizeUpdated', width }, '*');\n }\n\n function openWidget() {\n parent.postMessage({ action: 'theymes.sdkButtonClicked' }, '*');\n }\n\n function iframeSubscriber(e) {\n if (e.data.action === 'unreadMessageCountUpdate') {\n unreadMessageCount = e.data.count;\n updateUnreadMessageCount()\n } else if (e.data.action === 'widgetButtonTextUpdate') {\n document.querySelector('.sdk-button-text').innerHTML = e.data.text;\n calculateButtonSize();\n }\n }\n\n function updateUnreadMessageCount() {\n if (unreadMessageCount > 0) {\n document.querySelector('.sdk-button-badge').style.display = 'block';\n } else {\n document.querySelector('.sdk-button-badge').style.display = 'none';\n }\n }\n\n document.querySelector('.sdk-button').addEventListener('click', openWidget);\n window.addEventListener('message', iframeSubscriber, false);\n\n updateUnreadMessageCount();\n calculateButtonSize();\n <\/script>\n</body>\n\n</html>"}).replace(/UNREAD_MESSAGE_COUNT_PLACEHOLDER/g,"".concat(t.unreadMessageCount)).replace(/CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER/g,H(_.colors.widgetButtonBackground)).replace(/CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER/g,H(_.colors.widgetButtonText)).replace(/CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER/g,H(_.colors.widgetButtonActionPending)).replace(/WIDGET_BUTTON_TEXT_PLACEHOLDER/g,Ce()))})}}function he(e){return"start"===e.animation?"game"===_.mode?"translateY(20%)":"scale(0.8)":"game"===_.mode?"translateY(0)":"scale(1)"}function ye(e){return n(this,void 0,void 0,function(){return t(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,7]),[4,e.json()];case 1:return[2,n.sent()];case 2:n.sent(),n.label=3;case 3:return n.trys.push([3,5,,6]),[4,e.text()];case 4:return[2,n.sent()];case 5:return n.sent(),[2,void 0];case 6:return[3,7];case 7:return[2]}})})}function be(){return n(this,void 0,void 0,function(){var e,n,o,i,r,a;return t(this,function(t){switch(t.label){case 0:if("never"===_.sendPlayerRetention)return[2];if("support-only"===_.sendPlayerRetention&&!_.hasSupportInteraction)return[2];if(xe(),_.retryRecordRetentionTimerId&&(clearTimeout(_.retryRecordRetentionTimerId),_.retryRecordRetentionTimerId=null),_.retentionRemainingSeconds=null,_.isRetentionRecordedForSession=!0,!(e=de()))return[2];n="https://".concat(_.sdkApiDomain,"/api/retention"),o=fe({supportViewConfig:e}),i={token:_.token,deviceId:_.deviceId,language:_.language,metadata:o},t.label=1;case 1:return t.trys.push([1,5,,6]),[4,fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})];case 2:return(r=t.sent()).ok?[3,4]:[4,ye(r)];case 3:throw t.sent();case 4:return[3,6];case 5:return a=t.sent(),console.error("Error tracking retention:",a),_.retryRecordRetentionTimerId=setTimeout(be,6e4),[3,6];case 6:return[2]}})})}function we(){var e=new Date;if(_.sessionStatus="active",_.sessionResumeOrStartTime=e,_.sessionStartTime){var n=_.sessionStartTime.valueOf()/1e3+_.resetSessionAfterSecs;Date.now()/1e3>n&&Se()}else Se();null!==_.retentionRemainingSeconds&&(_.recordRetentionTimerId=setTimeout(be,1e3*_.retentionRemainingSeconds))}function Se(){_.sessionStartTime=new Date,_.retentionRemainingSeconds=_.recordRetentionAfterSecs,_.isRetentionRecordedForSession=!1,xe()}function xe(){_.recordRetentionTimerId&&(clearTimeout(_.recordRetentionTimerId),_.recordRetentionTimerId=null)}function ke(){_.isRetentionRecordedForSession&&be()}function Ce(){var e;return function(e){var n=e.split(" ");if(e.length<=16||n.length<=1)return e;for(var t=n.map(function(e){return e.length}),i=[],r=1;r<t.length;r++){var a=t.slice(0,r),s=t.slice(r),l=a.reduce(function(e,n){return e+n},0),c=s.reduce(function(e,n){return e+n},0),d=Math.abs(l-c);i.push(d)}var u=Math.min.apply(Math,i),g=i.indexOf(u);return o(o(o([],n.slice(0,g+1),!0),["<br>"],!1),n.slice(g+1),!0).join(" ")}(null!==(e=function(e){var n,t,o,i,r,a=U(null!==(n=_.language)&&void 0!==n?n:"en"),s=null===(t=_.locs[e.loc])||void 0===t?void 0:t[a];if(s)return s;var l=a.split("-")[0];return l&&(null===(o=_.locs[e.loc])||void 0===o?void 0:o[l])||(null!==(r=null===(i=_.locs[e.loc])||void 0===i?void 0:i.en)&&void 0!==r?r:null)}({loc:"widgetButtonText"}))&&void 0!==e?e:"Support")}function Ee(){_.unreadMessageCount=0,_.unansweredMessageCount=0,s("unreadMessageCountUpdate",[0]),s("unansweredMessageCountUpdate",[0]),K({action:"unreadMessageCountUpdate",count:0})}function Te(){var e,n,t,o=_.signedMetadataToken?function(e){var n,t;try{var o=e.split(".");if(o.length<2)return null;var i=o[1].replace(/-/g,"+").replace(/_/g,"/"),r=i.length%4,a=0===r?i:i+"=".repeat(4-r),s=atob(a),l=JSON.parse(s),c=null===(t=null===(n=null==l?void 0:l.metadata)||void 0===n?void 0:n.player)||void 0===t?void 0:t.id;return"string"==typeof c&&c.length>0?c:null}catch(e){return null}}(_.signedMetadataToken):null,i=null!==(n=null===(e=_.player)||void 0===e?void 0:e.id)&&void 0!==n?n:null;return null!==(t=null!=o?o:i)&&void 0!==t?t:null}function Oe(){var e=_.isLoggedIn,n=_.resolvedPlayerId,t=Te(),o=Boolean(t),i=e&&o&&t!==n;_.resolvedPlayerId=t,_.isLoggedIn=o,i?(Ee(),ne(),_.resolvedPlayerId=t,ee()):o&&!e?ee():!o&&e&&(Ee(),ne())}try{document.addEventListener("visibilitychange",function(){var e=_.isInForeground,n="visible"===document.visibilityState;_.isInForeground=n,e!==n&&ie(),n&&"paused"===_.sessionStatus?we():n||"active"!==_.sessionStatus||function(){if(_.sessionResumeOrStartTime&&_.retentionRemainingSeconds){var e=Math.floor((Date.now()-_.sessionResumeOrStartTime.valueOf())/1e3);_.retentionRemainingSeconds-=e}_.sessionStatus="paused",xe()}()}),window.addEventListener("resize",me),window.addEventListener("resize",V),window.addEventListener("message",function(e){if("theymes.ready"===e.data.action){var n=document.querySelector(k.sdkLoaderIframe),t=document.querySelector(k.sdkIframe);_.networkErrorTimerId&&(clearTimeout(_.networkErrorTimerId),_.networkErrorTimerId=null),t&&(t.style.width="100%",t.style.height="100%"),n&&n.remove()}else if("theymes.close"===e.data.action)se();else if("theymes.closeNotification"===e.data.action)Z({notification:_.visibleNotification});else if("theymes.handleNotificationAction"===e.data.action)u={notification:_.visibleNotification},(null==(g=u.notification)?void 0:g.action)&&"OPEN_PAGE"===g.action.type&&(ue({path:g.action.path}),Z({notification:g}));else if("theymes.sdkButtonClicked"===e.data.action)(d=document.querySelector(k.sdkButtonIframe))&&(d.style.opacity="0",d.style.transform="scale(0.8)",setTimeout(function(){d.remove()},200)),"support"===_.widgetButtonAction?re():"assistant"===_.widgetButtonAction&&ae();else if("theymes.sdkButtonSizeUpdated"===e.data.action){var o=document.querySelector(k.sdkButtonIframe);o&&(o.style.width="".concat(e.data.width,"px"))}else if("theymes.openExternalPage"===e.data.action){var i=e.data.target;if("_self"===i){var r=L(w);null!==r&&function(e){var n=e.key,t=e.value,o=e.ttlMs,i=e.storage,r=void 0===i?I:i,a={value:t,expiry:Date.now()+o};r.setItem(n,JSON.stringify(a))}({key:r,value:e.data.path,ttlMs:6e5})}window.open(e.data.url,i)}else if("theymes.messageCountsChanged"===e.data.action){var a=e.data,l=a.unreadMessageCount,c=a.unansweredMessageCount;if("number"!=typeof l||"number"!=typeof c)return;c!==_.unansweredMessageCount&&(_.unansweredMessageCount=c,s("unansweredMessageCountUpdate",[c])),l!==_.unreadMessageCount&&(_.unreadMessageCount=l,s("unreadMessageCountUpdate",[l]),K({action:"unreadMessageCountUpdate",count:l}))}var d,u,g},!1),ce("open",function(){_.sdkIsOpen=!0,te()}),ce("close",function(){_.sdkIsOpen=!1,oe()})}catch(e){console.error("Error adding event listeners to SDK",e)}var Ie=j("initialize",function(o,i,r){return n(void 0,void 0,void 0,function(){var n,a,s,l,h,y,k,C,O,R,A,D,M,B,H,F,j,U,q,W,J,z,Y;return t(this,function(t){switch(t.label){case 0:if(!o||!i||!r.mode)throw new Error("Token, domain, and mode are required");if("string"==typeof r.apiDomain&&""!==r.apiDomain.trim())n=r.apiDomain.trim();else{if((a=i.split(".")).length<2)throw new Error("Invalid domain");n=a[0]+".sdk."+a.slice(1).join(".")}_.token=o,_.domain=i,_.sdkApiDomain=n,_.mode=r.mode,_.element="element"in r&&void 0!==r.element?r.element:_.element,_.language=null!==(F=r.language)&&void 0!==F?F:_.language,_.nonce=null!==(j=r.nonce)&&void 0!==j?j:_.nonce,_.deviceId=function(){var e=P(p),n=E(e);if(n)return n;var t=E("deviceId");if(t)return T(e,t),t;var o=(i=Date.now(),"undefined"!=typeof performance&&"function"==typeof performance.now&&(i+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var n=(i+16*Math.random())%16|0;return i=Math.floor(i/16),("x"===e?n:3&n|8).toString(16)}));var i;return T(e,o),o}(),_.widgetButton="button"in r&&void 0!==r.button&&null!==(U=r.button)&&void 0!==U?U:_.widgetButton,_.widgetButtonAction="buttonAction"in r&&void 0!==r.buttonAction&&null!==(q=r.buttonAction)&&void 0!==q?q:_.widgetButtonAction,_.position="position"in r&&void 0!==r.position&&null!==(W=r.position)&&void 0!==W?W:_.position,_.x="x"in r&&void 0!==r.x?r.x:_.x,_.y="y"in r&&void 0!==r.y?r.y:_.y,_.disableInsets="game"===_.mode&&null!==_.element,N(),$.eventPoller||($.eventPoller=new Q),s=function(){we(),pe();var e=L(w),n=null===e?null:function(e){var n=e.key,t=e.storage,o=void 0===t?I:t,i=o.getItem(n);if(!i)return null;var r=JSON.parse(i);return Date.now()>r.expiry?(o.removeItem(n),null):(o.removeItem(n),r.value)}({key:e});n&&"widget"===_.mode&&!G()?ue({path:n}):_.widgetButton&&ve()},t.label=1;case 1:return t.trys.push([1,6,,7]),l=Date.now()/1e3,h=L(v),y=null===h?null:E(h),k=null,y&&"number"==typeof(C=JSON.parse(y))&&C>0&&(k=C),null!=k&&(k>l+S&&(k=l+S,null!==h&&T(h,JSON.stringify(k))),l<k)?(s(),[2]):(O="https://".concat(n,"/api/settings"),R=new URLSearchParams({token:_.token,platform:x,mode:_.mode,sdkVersion:c}).toString(),[4,fetch("".concat(O,"?").concat(R),{method:"GET"})]);case 2:return(A=t.sent()).ok?[3,4]:[4,ye(A)];case 3:throw t.sent();case 4:return[4,A.json()];case 5:return D=t.sent(),(null===(J=null==D?void 0:D.branding)||void 0===J?void 0:J.colors)&&function(n){_.colors=e(e({},_.colors),n);var t=L(d);null!==t&&T(t,JSON.stringify(_.colors))}(D.branding.colors),(null===(z=null==D?void 0:D.branding)||void 0===z?void 0:z.locs)&&function(n){_.locs=e(e({},_.locs),n);var t=L(u);null!==t&&T(t,JSON.stringify(_.locs))}(D.branding.locs),(null===(Y=null==D?void 0:D.branding)||void 0===Y?void 0:Y.fonts)&&function(n){_.fonts=e(e({},_.fonts),n);var t=L(g);null!==t&&T(t,JSON.stringify(_.fonts))}(D.branding.fonts),"number"!=typeof(null==D?void 0:D.recordRetentionAfterSecs)&&null!==(null==D?void 0:D.recordRetentionAfterSecs)||function(e){_.recordRetentionAfterSecs=e;var n=L(f);null!==n&&T(n,JSON.stringify(_.recordRetentionAfterSecs))}(D.recordRetentionAfterSecs),"number"!=typeof(null==D?void 0:D.resetSessionAfterSecs)&&null!==(null==D?void 0:D.resetSessionAfterSecs)||function(e){_.resetSessionAfterSecs=null!=e?e:28800;var n=L(m);null!==n&&T(n,JSON.stringify(_.resetSessionAfterSecs))}(D.resetSessionAfterSecs),"always"!==(null==D?void 0:D.sendPlayerRetention)&&"support-only"!==(null==D?void 0:D.sendPlayerRetention)&&"never"!==(null==D?void 0:D.sendPlayerRetention)||function(e){_.sendPlayerRetention=e;var n=L(b);null!==n&&T(n,_.sendPlayerRetention)}(D.sendPlayerRetention),"number"==typeof(null==D?void 0:D.settingsPollIntervalSecs)&&D.settingsPollIntervalSecs>0&&(M=l+D.settingsPollIntervalSecs,B=Math.min(M,l+S),null!==h&&T(h,JSON.stringify(B))),s(),[3,7];case 6:return H=t.sent(),console.error("Error initializing SDK:",H),[3,7];case 7:return[2]}})})},void 0),Pe=j("openSupport",re,void 0),Le=j("openAssistant",ae,void 0),Re=j("openResource",function(e,n){var t="/resources/".concat(e);ge({path:t,config:n}),ue({path:t,config:n})},void 0),_e=j("close",se,void 0),Ae=j("getLanguage",function(){return _.language},null),De=j("setLanguage",function(e){var n=_.language!==e;_.language=e,n&&(pe(),K({action:"widgetButtonTextUpdate",text:Ce()}))},void 0),Ne=j("getSignedMetadataToken",function(){return _.signedMetadataToken},null),Me=j("setSignedMetadataToken",function(e){var n=_.signedMetadataToken!==e;_.signedMetadataToken=e,Oe(),n&&(pe(),ke())},void 0),Be=j("getPlayer",function(){return _.player},null),He=j("setPlayer",function(e){var n,t=(null===(n=_.player)||void 0===n?void 0:n.id)!==(null==e?void 0:e.id);_.player=e,Oe(),t&&(pe(),ke())},void 0),Fe=j("getTags",function(){return Array.from(_.tags)},[]),je=j("setTags",function(e){_.tags=new Set(e),pe()},void 0),Ue=j("addTag",function(e){_.tags.add(e),pe()},void 0),qe=j("addTags",function(e){e.forEach(function(e){return _.tags.add(e)}),pe()},void 0),We=j("removeTag",function(e){_.tags.delete(e),pe()},void 0),Je=j("removeTags",function(e){e.forEach(function(e){return _.tags.delete(e)}),pe()},void 0),Ge=j("removeAllTags",function(){_.tags.clear(),pe()},void 0),ze=j("getFields",function(){return _.fields},{}),Ye=j("setFields",function(e){_.fields=e,pe()},void 0),Ke=j("addField",function(e,n){_.fields[e]=n,pe()},void 0),Xe=j("addFields",function(n){_.fields=e(e({},_.fields),n),pe()},void 0),Ve=j("removeField",function(e){delete _.fields[e],pe()},void 0),Ze=j("removeFields",function(e){e.forEach(function(e){return delete _.fields[e]}),pe()},void 0),Qe=j("removeAllFields",function(){_.fields={},pe()},void 0),$e=j("enableLogging",function(){_.loggingEnabled=!0},void 0),en=j("disableLogging",function(){_.loggingEnabled=!1},void 0),nn=j("isYoungPlayer",function(){return _.youngPlayer},!1),tn=j("setYoungPlayer",function(e){_.youngPlayer=e,pe()},void 0),on=j("isPrivacyMode",function(){return _.privacyMode},!1),rn=j("setPrivacyMode",function(e){_.privacyMode=e,pe()},void 0),an=j("isSupported",le,!1),sn=j("requestNotificationPermission",function(){},void 0),ln=j("enableNotifications",function(){_.notificationsPaused=!1,X()},void 0),cn=j("disableNotifications",function(){_.notificationsPaused=!0},void 0),dn=j("getUnreadMessageCount",function(){return _.unreadMessageCount},0),un=j("getUnansweredMessageCount",function(){return _.unansweredMessageCount},0),gn=j("getSdkVersion",function(){return c},""),pn=j("reset",function(){_.youngPlayer=!1,_.privacyMode=!1,_.language=null,_.tags=new Set,_.fields={},_.signedMetadataToken=null,_.player=null,Oe(),pe(),K({action:"widgetButtonTextUpdate",text:Ce()})},void 0),fn=j("recordRetention",function(){_.isRetentionRecordedForSession||be()},void 0),mn=j("addEventListener",ce,void 0),vn=j("removeEventListener",function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];a.apply(void 0,e)},void 0),hn=j("iosSetKeyboardHeight",function(e){_.keyboardHeight=e,me()},void 0);export{mn as addEventListener,Ke as addField,Xe as addFields,Ue as addTag,qe as addTags,_e as close,en as disableLogging,cn as disableNotifications,$e as enableLogging,ln as enableNotifications,ze as getFields,Ae as getLanguage,Be as getPlayer,gn as getSdkVersion,Ne as getSignedMetadataToken,Fe as getTags,un as getUnansweredMessageCount,dn as getUnreadMessageCount,Ie as initialize,hn as iosSetKeyboardHeight,on as isPrivacyMode,an as isSupported,nn as isYoungPlayer,Le as openAssistant,Re as openResource,Pe as openSupport,fn as recordRetention,Qe as removeAllFields,Ge as removeAllTags,vn as removeEventListener,Ve as removeField,Ze as removeFields,We as removeTag,Je as removeTags,sn as requestNotificationPermission,pn as reset,Ye as setFields,De as setLanguage,He as setPlayer,rn as setPrivacyMode,Me as setSignedMetadataToken,je as setTags,tn as setYoungPlayer};
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- var theymes=function(e){"use strict";var n=function(){return n=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var i in n=arguments[t])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e},n.apply(this,arguments)};function t(e,n,t,o){return new(t||(t=Promise))(function(i,r){function a(e){try{l(o.next(e))}catch(e){r(e)}}function s(e){try{l(o.throw(e))}catch(e){r(e)}}function l(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t(function(e){e(n)})).then(a,s)}l((o=o.apply(e,n||[])).next())})}function o(e,n){var t,o,i,r={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(r=0)),r;)try{if(t=1,o&&(i=2&s[0]?o.return:s[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;switch(o=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,o=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(i=r.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(6===s[0]&&r.label<i[1]){r.label=i[1],i=s;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(s);break}i[2]&&r.ops.pop(),r.trys.pop();continue}s=n.call(e,r)}catch(e){s=[6,e],o=0}finally{t=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function i(e,n,t){if(t||2===arguments.length)for(var o,i=0,r=n.length;i<r;i++)!o&&i in n||(o||(o=Array.prototype.slice.call(n,0,i)),o[i]=n[i]);return e.concat(o||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var r={unreadMessageCountUpdate:new Set,unansweredMessageCountUpdate:new Set,open:new Set,close:new Set};function a(e,n){r[e].add(n)}function s(e,n){r[e].delete(n)}function l(e,n){r[e].forEach(function(e){return e.apply(void 0,n)})}var c='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: sans-serif;\n font-size: CSS_FONT_SIZE_PLACEHOLDER;\n }\n\n html,\n body {\n background: rgb(CSS_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n padding-top: INSET_TOP_PLACEHOLDER;\n padding-bottom: INSET_BOTTOM_PLACEHOLDER;\n padding-left: INSET_LEFT_PLACEHOLDER;\n padding-right: INSET_RIGHT_PLACEHOLDER;\n }\n\n .top-bar {\n flex: 0 0 auto;\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: flex-end;\n }\n\n .close-button {\n padding: 0.5rem 1rem;\n cursor: pointer;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 1.75rem;\n height: 1.75rem;\n }\n\n .error-wrapper {\n flex: 1 0 0%;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: 12px;\n padding: 12px;\n }\n\n h1 {\n font-size: 18px;\n font-weight: 400;\n color: rgb(CSS_TEXT_PLACEHOLDER);\n }\n\n svg.error-icon {\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="wrapper">\n <div class="top-bar">\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"\n stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"\n class="lucide lucide-x-icon lucide-x">\n <path d="M18 6 6 18" />\n <path d="m6 6 12 12" />\n </svg>\n </div>\n </div>\n <div class="error-wrapper">\n <svg class="error-icon" width="91" height="91" viewBox="0 0 91 91" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path\n d="M45.1079 89.1321C50.7158 89.1321 55.2618 84.5859 55.2618 78.9783C55.2618 73.3707 50.7158 68.8245 45.1079 68.8245C39.5001 68.8245 34.9541 73.3707 34.9541 78.9783C34.9541 84.5859 39.5001 89.1321 45.1079 89.1321Z"\n stroke="#FFB547" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />\n <path d="M24.7637 58.6355C35.9988 47.4005 54.2144 47.4005 65.4492 58.6355" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M12.7988 46.6689C22.1436 37.3241 34.529 32.8731 46.7703 33.3159" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M1.1084 34.4283C11.6674 23.9971 25.012 18.0833 38.7295 16.6868" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M89.1082 1.13208L62.0312 28.209" stroke="#FFB547" stroke-width="2" stroke-linecap="round"\n stroke-linejoin="round" />\n <path d="M62.0312 1.13208L89.1082 28.209" stroke="#FFB547" stroke-width="2" stroke-linecap="round"\n stroke-linejoin="round" />\n </svg>\n <div>\n <h1>Connection error</h1>\n </div>\n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeTheymesSdk() {\n parent.postMessage({ action: \'theymes.close\' }, \'*\');\n }\n\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeTheymesSdk);\n <\/script>\n</body>\n\n</html>',d="1.2.14",u="colors",g="locs",f="fonts",p="recordRetentionAfterSecs",m="resetSessionAfterSecs",h="web",v={sdkDialog:"#theymes-sdk-dialog",sdkIframeWrapper:"#theymes-sdk-wrapper",sdkIframe:"#theymes-sdk",sdkLoaderIframe:"#theymes-sdk-loader",notificationDialog:"#theymes-sdk-notification-dialog",notificationIframe:"#theymes-sdk-notification",sdkButtonIframe:"#theymes-sdk-button"},y=.2,b="theymes_path_on_init",w=function(e){var n;try{return null!==(n=null===localStorage||void 0===localStorage?void 0:localStorage.getItem(e))&&void 0!==n?n:null}catch(e){return null}},S=function(e,n){try{null===localStorage||void 0===localStorage||localStorage.setItem(e,n)}catch(e){}},x={length:0,getItem:function(e){var n;try{return null!==(n=null===sessionStorage||void 0===sessionStorage?void 0:sessionStorage.getItem(e))&&void 0!==n?n:null}catch(e){return null}},setItem:function(e,n){try{null===sessionStorage||void 0===sessionStorage||sessionStorage.setItem(e,n)}catch(e){}},removeItem:function(e){try{null===sessionStorage||void 0===sessionStorage||sessionStorage.removeItem(e)}catch(e){}},clear:function(){try{null===sessionStorage||void 0===sessionStorage||sessionStorage.clear()}catch(e){}},key:function(e){var n;try{return null!==(n=null===sessionStorage||void 0===sessionStorage?void 0:sessionStorage.key(e))&&void 0!==n?n:null}catch(e){return null}}},E=function(){var e=null,t=28800,o={text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}},i={widgetButtonText:{}},r=T();try{e=function(){var e=w(p);if(e){var n=JSON.parse(e);if("number"==typeof n)return n}return null}(),t=function(){var e=w(m);if(e){var n=JSON.parse(e);if("number"==typeof n)return n}return k()}(),o=function(){var e=w(u);if(e){var t=JSON.parse(e);return n(n({},{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}}),t)}return{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}}}(),i=function(){var e=w(g);if(e){var t=JSON.parse(e);return n(n({},{widgetButtonText:{}}),t)}return{widgetButtonText:{}}}(),r=function(){var e=w(f);if(e){var t=JSON.parse(e);return n(n({},T()),t)}return T()}()}catch(e){console.error("Error initializing internals",e)}return{token:null,domain:null,mode:"game",deviceId:null,position:"bottom-right",widgetButton:!1,widgetButtonAction:"support",x:20,y:20,loggingEnabled:!1,element:null,language:null,userLanguage:navigator.language,tags:new Set,fields:{},youngPlayer:!1,privacyMode:!1,signedMetadataToken:null,isLoggedIn:!1,isInForeground:!0,hasNetworkConnectivity:!0,player:null,sdkIsOpen:!1,forceUpdateSdkDialog:!1,recordRetentionAfterSecs:e,resetSessionAfterSecs:t,sessionStatus:"waiting",sessionStartTime:null,sessionResumeOrStartTime:null,retentionRemainingSeconds:null,isRetentionRecordedForSession:!1,recordRetentionTimerId:null,retryRecordRetentionTimerId:null,retryIntervalSecs:300,networkErrorTimerId:null,colors:o,locs:i,fonts:r,notificationsPaused:!0,notifications:[],visibleNotification:null,unreadMessageCount:0,unansweredMessageCount:0,previousPath:null,previousConfig:null,nonce:null,keyboardHeight:0,disableInsets:!1}}();function T(){return{body:void 0}}function k(){return 28800}var C=function(e,n){return e===n||Boolean(e&&n&&"object"==typeof e&&"object"==typeof n&&Object.keys(e).length===Object.keys(n).length&&Object.entries(e).every(function(e){var t=e[0],o=e[1];return C(o,n[t])}))};function O(e){var n,t=e.iframe,o=e.content,i=null===(n=t.contentWindow)||void 0===n?void 0:n.document;i&&(i.open(),i.write(o),i.close())}function L(e){return"".concat(e.r,", ").concat(e.g,", ").concat(e.b)}function I(e){var n,t,o,i;return e.template.replace(/PLATFORM_PLACEHOLDER/g,h).replace(/INSET_TOP_PLACEHOLDER/g,E.disableInsets?"0px":"env(safe-area-inset-top, 0px)").replace(/INSET_BOTTOM_PLACEHOLDER/g,E.disableInsets?"0px":"env(safe-area-inset-bottom, 0px)").replace(/INSET_LEFT_PLACEHOLDER/g,E.disableInsets?"0px":"env(safe-area-inset-left, 0px)").replace(/INSET_RIGHT_PLACEHOLDER/g,E.disableInsets?"0px":"env(safe-area-inset-right, 0px)").replace(/CSS_TEXT_PLACEHOLDER/g,L(E.colors.text)).replace(/CSS_BORDER_PLACEHOLDER/g,L(E.colors.border)).replace(/CSS_BACKGROUND_PLACEHOLDER/g,L(E.colors.background)).replace(/CSS_TILE_PLACEHOLDER/g,L(E.colors.tile)).replace(/CSS_ACCENT_PLACEHOLDER/g,L(E.colors.accent)).replace(/CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER/g,L(E.colors.notificationBackground)).replace(/CSS_NOTIFICATION_TEXT_PLACEHOLDER/g,L(E.colors.notificationText)).replace(/CSS_FONT_SIZE_PLACEHOLDER/g,"game"===E.mode?"16px":"14px").replace(/CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER/g,null!==(t=null===(n=E.fonts.body)||void 0===n?void 0:n.regular)&&void 0!==t?t:"url('https://fonts.gstatic.com/s/poppins/v22/pxiEyp8kv8JHgFVrJJfecnFHGPc.woff2') format('woff2')").replace(/CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER/g,null!==(i=null===(o=E.fonts.body)||void 0===o?void 0:o.fallback)&&void 0!==i?i:"ui-sans-serif, system-ui, sans-serif").replace(/NONCE_ATTR_PLACEHOLDER/g,E.nonce?'nonce="'.concat(E.nonce,'"'):"")}function _(e,n,t){return function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];try{return n.apply(void 0,o)}catch(n){return console.error("Error in ".concat(e),n),t}}}var R=function(e){var n=e.split(/[-_]/),t=n[0],o=n[1];return t?o?"".concat(t.toLowerCase(),"-").concat(o.toUpperCase()):t.toLowerCase():"en"},P=/(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|redmi|series[46]0|samsungbrowser.*mobile|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,A=/CrOS/,N=/android|ipad|playbook|silk/i;function D(){return!!function(e){e||(e={});var n=e.ua;if(n||"undefined"==typeof navigator||(n=navigator.userAgent),n&&n.headers&&"string"==typeof n.headers["user-agent"]&&(n=n.headers["user-agent"]),"string"!=typeof n)return!1;var t=P.test(n)&&!A.test(n)||!!e.tablet&&N.test(n);return!t&&e.tablet&&e.featureDetect&&navigator&&navigator.maxTouchPoints>1&&-1!==n.indexOf("Macintosh")&&-1!==n.indexOf("Safari")&&(t=!0),t}({tablet:!0})&&(window.innerWidth<500||window.innerHeight<500)}function M(e){var n=e.type,t=E.position,o=E.x,i=E.y;return D()&&"widget"===n?{top:"0",left:"0",right:"0",bottom:"0"}:"top-left"===t?{top:"".concat(o,"px"),left:"".concat(i,"px"),right:"auto",bottom:"auto"}:"top-right"===t?{top:"".concat(o,"px"),right:"".concat(i,"px"),left:"auto",bottom:"auto"}:"bottom-left"===t?{bottom:"".concat(o,"px"),left:"".concat(i,"px"),right:"auto",top:"auto"}:{bottom:"".concat(o,"px"),right:"".concat(i,"px"),left:"auto",top:"auto"}}function B(){return D()?{width:"100%",height:"100%",maxWidth:"none",maxHeight:"none"}:{width:"".concat(340,"px"),height:"".concat(680,"px"),maxWidth:"none",maxHeight:"calc(100vh - ".concat(2*E.y,"px)")}}function H(e){var n=document.querySelector(v.sdkButtonIframe);if(n)var t=setInterval(function(){var o,i;"complete"===(null===(o=n.contentDocument)||void 0===o?void 0:o.readyState)&&(clearInterval(t),null===(i=null==n?void 0:n.contentWindow)||void 0===i||i.postMessage(e,"*"))},100)}function F(){var e,n,t=E.notifications[0];if(t&&!E.visibleNotification){E.visibleNotification=t;var o=null!==(e=document.querySelector(v.notificationDialog))&&void 0!==e?e:document.createElement("div");o.id=v.notificationDialog.replace("#",""),o.style.position="fixed",o.style.border="none",o.style.margin="0",o.style.padding="0",o.style.zIndex="9999",o.style.colorScheme="auto",o.style.backgroundColor="transparent",o.style.pointerEvents="none",o.style.overflow="hidden",document.body.appendChild(o);var i,r=null!==(n=o.querySelector(v.notificationIframe))&&void 0!==n?n:document.createElement("iframe");r.id=v.notificationIframe.replace("#",""),r.style.position="absolute",r.style.border="none",r.style.width="0",r.style.height="0",r.style.top="-20px",r.style.left="0",r.style.colorScheme="auto",r.style.pointerEvents="auto",r.style.marginTop="-20px",r.style.opacity="0",r.style.transition="opacity ".concat(.2,"s ease-in-out, margin-top ").concat(.2,"s ease-in-out"),o.appendChild(r),O({iframe:r,content:(i={text:t.text},I({template:'<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n @font-face {\n font-family: \'TheymesBody\';\n src: CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER;\n font-weight: normal;\n font-style: normal;\n font-display: fallback;\n }\n\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'TheymesBody\', CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER;\n }\n\n html,\n body {\n width: 100%;\n height: auto;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_NOTIFICATION_TEXT_PLACEHOLDER);\n width: 1.25rem;\n height: 1.25rem;\n }\n\n .notification {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n background: rgb(CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: auto;\n margin: 0;\n padding: 12px;\n border-radius: 6px;\n color: rgb(CSS_NOTIFICATION_TEXT_PLACEHOLDER);\n }\n\n .notification-text {\n flex: 1 0 0%;\n font-size: 0.875rem;\n /* 14/16 */\n line-height: 1.2;\n display: -webkit-box;\n line-clamp: 2;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n text-overflow: ellipsis;\n cursor: pointer;\n }\n\n .close-button {\n flex: 0 0 auto;\n padding-left: 10px;\n cursor: pointer;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="notification">\n <div class="notification-text">NOTIFICATION_TEXT_PLACEHOLDER</div>\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round">\n <path d="M18 6 6 18"></path>\n <path d="m6 6 12 12"></path>\n </svg>\n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeNotification() {\n parent.postMessage({ action: \'theymes.closeNotification\' }, \'*\');\n }\n\n function notificationClicked() {\n parent.postMessage({ action: \'theymes.handleNotificationAction\' }, \'*\');\n }\n\n document.querySelector(\'.notification-text\').addEventListener(\'click\', notificationClicked);\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeNotification);\n <\/script>\n</body>\n\n</html>'}).replace(/NOTIFICATION_TEXT_PLACEHOLDER/g,i.text))}),setTimeout(function(){r.style.opacity="1",r.style.marginTop="0px",j()},500),t.closeAfterSeconds>0&&setTimeout(function(){U({notification:t})},1e3*t.closeAfterSeconds)}}function j(){var e,n,t,o=document.querySelector(v.notificationDialog),i=document.querySelector(v.notificationIframe);if(o&&i){var r=(null===(t=null===(n=null===(e=i.contentWindow)||void 0===e?void 0:e.document)||void 0===n?void 0:n.body)||void 0===t?void 0:t.scrollHeight)?"".concat(i.contentWindow.document.body.scrollHeight,"px"):"0";if("widget"===E.mode){var a=M({type:"widget"}),s=B(),l="calc(".concat(s.width," - 20px)");o.style.bottom=a.bottom,o.style.right=a.right,o.style.left=a.left,o.style.top=a.top,o.style.overflow="hidden",i.style.width=l}else if(E.element){var c=E.element.getBoundingClientRect();l="".concat(c.width-20,"px");o.style.top="".concat(c.top,"px"),o.style.left="".concat(c.left,"px"),o.style.right="".concat(c.right,"px"),o.style.bottom="".concat(c.bottom,"px"),o.style.overflow="hidden",i.style.width=l}else{l="calc(100% - 20px)";o.style.top=E.disableInsets?"0px":"env(safe-area-inset-top, 0px)",o.style.left=E.disableInsets?"0px":"env(safe-area-inset-left, 0px)",o.style.right=E.disableInsets?"0px":"env(safe-area-inset-right, 0px)",o.style.bottom=E.disableInsets?"0px":"env(safe-area-inset-bottom, 0px)",o.style.overflow="visible",i.style.width=l}i.style.height=r,i.style.top="10px",i.style.left="10px"}}function U(e){if(e.notification&&E.visibleNotification===e.notification){var n=document.querySelector(v.notificationIframe),t=document.querySelector(v.notificationDialog);n&&(n.style.opacity="0",n.style.marginTop="-20px",setTimeout(function(){null==t||t.remove(),E.notifications=E.notifications.slice(1),E.visibleNotification=null,F()},200))}}var q=function(){function e(){Object.defineProperty(this,"isRunning",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"pollWhenNotificationsEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"lastPollDate",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"nextPollDate",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.resumeIfNeeded(!1)}return Object.defineProperty(e.prototype,"onIsInForegroundChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(){E.isInForeground?this.resumeIfNeeded(!1):this.pauseIfNeeded()}}),Object.defineProperty(e.prototype,"onHasNetworkConnectivityChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.resumeIfNeeded(!1)}}),Object.defineProperty(e.prototype,"resume",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning=!0;var e=new Date;if(this.nextPollDate||(this.nextPollDate=new Date(e.getTime()+1e3)),e>=this.nextPollDate)this.pollEventsRequest();else{var n=(this.nextPollDate.getTime()-e.getTime())/1e3;this.scheduleNextPollEventsRequest(n)}}}),Object.defineProperty(e.prototype,"pause",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning=!1,this.timer&&(clearTimeout(this.timer),this.timer=null)}}),Object.defineProperty(e.prototype,"shouldBeRunning",{enumerable:!1,configurable:!0,writable:!0,value:function(){return E.isLoggedIn&&E.isInForeground&&E.hasNetworkConnectivity&&!E.sdkIsOpen}}),Object.defineProperty(e.prototype,"resumeIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){e&&(this.nextPollDate=null),!this.shouldBeRunning()||this.isRunning&&!e||this.resume()}}),Object.defineProperty(e.prototype,"pauseIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning&&!this.shouldBeRunning()&&this.pause()}}),Object.defineProperty(e.prototype,"onEnableNotifications",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning&&this.pollWhenNotificationsEnabled&&this.scheduleNextPollEventsRequest(0)}}),Object.defineProperty(e.prototype,"onOpen",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.pauseIfNeeded()}}),Object.defineProperty(e.prototype,"onClose",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.resumeIfNeeded(!0)}}),Object.defineProperty(e.prototype,"onLogin",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.resumeIfNeeded(!0)}}),Object.defineProperty(e.prototype,"onLogout",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.pauseIfNeeded()}}),Object.defineProperty(e.prototype,"scheduleNextPollEventsRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this;this.nextPollDate=new Date(Date.now()+1e3*e),this.timer&&clearTimeout(this.timer),this.timer=setTimeout(function(){n.timer=null,n.pollEventsRequest()},1e3*e)}}),Object.defineProperty(e.prototype,"pollEventsRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(){return t(this,void 0,void 0,function(){var e,t,r,a,s,c,d,u,g;return o(this,function(o){switch(o.label){case 0:if(!E.token||!E.domain||!E.deviceId)return[2];if(!this.isRunning)return[2];if(this.lastPollDate&&(e=new Date(this.lastPollDate.getTime()+6e4),(t=(e.getTime()-Date.now())/1e3)>0))return this.scheduleNextPollEventsRequest(t),[2];this.lastPollDate=new Date,r=E.notificationsPaused||E.sdkIsOpen?"true":"false",a=new URLSearchParams(n(n({token:E.token,language:null!==(u=E.language)&&void 0!==u?u:"en",deviceId:E.deviceId,notificationsPaused:r,mode:E.mode},(null===(g=E.player)||void 0===g?void 0:g.id)?{unsignedPlayerId:E.player.id}:{}),E.signedMetadataToken?{signedMetadataToken:E.signedMetadataToken}:{})).toString(),o.label=1;case 1:return o.trys.push([1,4,,5]),[4,fetch("https://".concat(E.domain,"/api/sdk/events?").concat(a),{method:"GET"})];case 2:if(!(s=o.sent()).ok)throw new Error("HTTP error! status: ".concat(s.status));return[4,s.json()];case 3:return c=o.sent(),this.scheduleNextPollEventsRequest(c.nextPollSeconds),void 0!==c.pollWhenNotificationsEnabled&&(this.pollWhenNotificationsEnabled=c.pollWhenNotificationsEnabled),E.notifications=i(i([],E.notifications,!0),c.notifications,!0),E.notifications.length>0&&F(),c.unansweredMessageCount!==E.unansweredMessageCount&&(E.unansweredMessageCount=c.unansweredMessageCount,l("unansweredMessageCountUpdate",[c.unansweredMessageCount])),c.unreadMessageCount!==E.unreadMessageCount&&(E.unreadMessageCount=c.unreadMessageCount,l("unreadMessageCountUpdate",[c.unreadMessageCount]),H({action:"unreadMessageCountUpdate",count:c.unreadMessageCount})),[3,5];case 4:return d=o.sent(),console.error("Error fetching events:",d),this.scheduleNextPollEventsRequest(E.retryIntervalSecs),[3,5];case 5:return[2]}})})}}),e}(),W={eventPoller:null},z=function(){var e;null===(e=W.eventPoller)||void 0===e||e.onLogin()},G=function(){var e;null===(e=W.eventPoller)||void 0===e||e.onLogout()},Y=function(){var e;null===(e=W.eventPoller)||void 0===e||e.onOpen()},J=function(){var e;null===(e=W.eventPoller)||void 0===e||e.onClose()},K=function(){var e;null===(e=W.eventPoller)||void 0===e||e.onEnableNotifications()},X=function(){var e;null===(e=W.eventPoller)||void 0===e||e.onIsInForegroundChanged()},V=function(e){var n="/help-center";oe({path:n,config:e}),te({path:n,config:e})},Z=function(e){var n="/assistant";oe({path:n,config:e}),te({path:n,config:e})},Q=function(){!function(){var e=document.querySelector(v.sdkDialog),n=document.querySelector(v.sdkIframeWrapper);if(e){var t=function(){"widget"!==E.mode||E.forceUpdateSdkDialog?e.remove():e.style.display="none",E.forceUpdateSdkDialog=!1};n?(n.style.opacity="0",n.style.transform=le({animation:"start"}),setTimeout(function(){t()},200)):t()}E.widgetButton&&se();l("close",[])}()},$=function(){try{return CSS.supports("color","var(--color)")&&CSS.supports("color","rgb(255 255 255 / 0.5)")}catch(e){return!1}},ee=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];a.apply(void 0,e)};function ne(e){var t,o,r,a,s,l,c=(null!=e?e:{}).config;if(!E.token||!E.domain||!E.deviceId)return null;var u=null!==(t=null==c?void 0:c.tags)&&void 0!==t?t:[],g=null!==(o=null==c?void 0:c.fields)&&void 0!==o?o:{},f=null!==(a=null!==(r=null==c?void 0:c.language)&&void 0!==r?r:E.language)&&void 0!==a?a:null,p=null!==(s=E.signedMetadataToken)&&void 0!==s?s:null,m=null!==(l=E.player)&&void 0!==l?l:null,v={_platform:h,_sdkVersion:d};E.youngPlayer&&(v._youngPlayer=!0),(E.privacyMode||E.youngPlayer)&&(v._privacyMode=!0);var y=i(i([],Array.from(E.tags),!0),u,!0),b=n(n(n({},E.fields),g),v);return{token:E.token,domain:E.domain,deviceId:E.deviceId,tags:y,fields:b,language:f,signedMetadataToken:p,player:m}}function te(e){var n,t,o,i=ne({config:e.config});if(i){var r=null!==(n=document.querySelector(v.sdkDialog))&&void 0!==n?n:document.createElement("div");r.id=v.sdkDialog.replace("#",""),r.style.display="block",r.style.position="fixed",r.style.border="none",r.style.width="0",r.style.height="0",r.style.margin="0",r.style.padding="0",r.style.zIndex="9998",r.style.overflow="hidden",r.style.backgroundColor="transparent";var a=null!==(t=r.querySelector(v.sdkIframeWrapper))&&void 0!==t?t:document.createElement("div");a.id=v.sdkIframeWrapper.replace("#",""),a.style.position="relative",a.style.width="100%",a.style.height="100%",a.style.top="0",a.style.right="0",a.style.bottom="0",a.style.left="0",a.style.opacity="0",a.style.colorScheme="auto",a.style.border="none",a.style.backgroundColor="rgb(".concat(L(E.colors.background),")"),a.style.transform=le({animation:"start"}),a.style.transition=(E.mode,"opacity ".concat(y,"s ease-in-out, transform ").concat(y,"s ease-in-out")),"widget"===E.mode&&(a.style.overflow="hidden");var s=null!==(o=a.querySelector(v.sdkLoaderIframe))&&void 0!==o?o:document.createElement("iframe");s.id=v.sdkLoaderIframe.replace("#",""),s.style.position="absolute",s.style.border="none",s.style.width="100%",s.style.height="100%",s.style.top="0",s.style.right="0",s.style.bottom="0",s.style.left="0",s.style.colorScheme="auto";var d=a.querySelector(v.sdkIframe),u=null!=d?d:document.createElement("iframe"),g=setInterval(function(){var e;"complete"===(null===(e=u.contentDocument)||void 0===e?void 0:e.readyState)&&(clearInterval(g),p())},500);u.id=v.sdkIframe.replace("#",""),u.style.position="absolute",u.style.border="none",u.style.top="0",u.style.right="0",u.style.bottom="0",u.style.left="0",u.style.colorScheme="auto",d&&!E.networkErrorTimerId||(u.src=function(e){var n=e.path,t=e.supportViewConfig,o="https://".concat(E.domain,"/sdk"),i=new URLSearchParams;i.set("platform",h),i.set("token",t.token),i.set("deviceId",t.deviceId),i.set("mode",E.mode),i.set("origin",window.location.origin),i.set("userLanguage",E.userLanguage),E.disableInsets&&i.set("disableInsets","true");t.language&&i.set("language",t.language);$()||i.set("unsupported","true");var r=re({supportViewConfig:t});return i.set("metadata",JSON.stringify(r)),"".concat(o).concat(n,"?").concat(i.toString())}({path:e.path,supportViewConfig:i}),u.style.width="0",u.style.height="0",r.appendChild(a),a.appendChild(s),a.appendChild(u),document.body.appendChild(r)),O({iframe:s,content:I({template:'<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n * {\n box-sizing: border-box;\n }\n\n html,\n body {\n background: rgb(CSS_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n padding-top: INSET_TOP_PLACEHOLDER;\n padding-bottom: INSET_BOTTOM_PLACEHOLDER;\n padding-left: INSET_LEFT_PLACEHOLDER;\n padding-right: INSET_RIGHT_PLACEHOLDER;\n }\n\n .top-bar {\n flex: 0 0 auto;\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: flex-end;\n }\n\n .loader-wrapper {\n flex: 1 0 0%;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: 12px;\n }\n\n .close-button {\n padding: 0.5rem 1rem;\n cursor: pointer;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 1.75rem;\n height: 1.75rem;\n }\n\n @keyframes spin {\n to {\n transform: rotate(360deg);\n }\n }\n\n .loader {\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 2rem;\n height: 2rem;\n animation: spin 1s linear infinite;\n transform-origin: center;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="wrapper">\n <div class="top-bar">\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"\n stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"\n class="lucide lucide-x-icon lucide-x">\n <path d="M18 6 6 18" />\n <path d="m6 6 12 12" />\n </svg>\n </div>\n </div>\n <div class="loader-wrapper">\n <svg class="loader" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg" fill="none" data-test-name="oval"\n role="img">\n <g fill="none" fill-rule="evenodd">\n <g transform="translate(1 1)" stroke-width="2">\n <circle stroke-opacity="0.5" cx="18" cy="18" r="18" />\n <path d="M36 18c0-9.94-8.06-18-18-18" />\n </g>\n </g>\n </svg>\n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeTheymesSdk() {\n parent.postMessage({ action: \'theymes.close\' }, \'*\');\n }\n\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeTheymesSdk);\n <\/script>\n</body>\n\n</html>'})});var f=!1,p=function(){f||(f=!0,E.networkErrorTimerId=setTimeout(function(){O({iframe:s,content:I({template:c})})},1e4))};u.onload=p,u.onerror=function(){O({iframe:s,content:I({template:c})})},ae(),l("open",[]),setTimeout(function(){a.style.opacity="1",a.style.transform=le({animation:"end"})},100)}}function oe(e){var n=e.path,t=e.config,o=null!=t?t:null;E.previousPath===n&&C(E.previousConfig,o)||(E.previousPath=n,E.previousConfig=o,ie())}function ie(){var e=document.querySelector(v.sdkDialog);E.sdkIsOpen?E.forceUpdateSdkDialog=!0:null==e||e.remove()}function re(e){var n=e.supportViewConfig,t={unsigned:{},signed:void 0};return n.player&&(t.unsigned.player=n.player),n.tags&&(t.unsigned.tags=n.tags),n.fields&&(t.unsigned.fields=n.fields),n.signedMetadataToken&&(t.signed=n.signedMetadataToken),t}function ae(){var e=document.querySelector(v.sdkDialog),n=document.querySelector(v.sdkIframeWrapper);if(e&&n)if("widget"===E.mode){var t=M({type:"widget"}),o=B();e.style.width=o.width,e.style.height=o.height,e.style.maxWidth=o.maxWidth,e.style.maxHeight=o.maxHeight,e.style.bottom=t.bottom,e.style.right=t.right,e.style.left=t.left,e.style.top=t.top,D()?(n.style.border="none",n.style.borderRadius="0"):(n.style.border="1px solid rgb(".concat(L(E.colors.border),")"),n.style.borderRadius="10px")}else if(n.style.border="none",n.style.borderRadius="0",E.element){var i=E.element.getBoundingClientRect(),r=i.width,a=i.height,s=i.top,l=i.left,c=i.right,d=i.bottom;e.style.width="".concat(r,"px"),e.style.height="".concat(a,"px"),e.style.maxWidth="none",e.style.maxHeight="none",e.style.top="".concat(s,"px"),e.style.left="".concat(l,"px"),e.style.right="".concat(c,"px"),e.style.bottom="".concat(d,"px")}else{a=E.keyboardHeight>0?"calc(100% - ".concat(E.keyboardHeight,"px + env(safe-area-inset-bottom) - 10px)"):"100%";e.style.width="100%",e.style.height=a,e.style.maxWidth="none",e.style.maxHeight="none",e.style.top="0",e.style.left="0",e.style.right="0",e.style.bottom="0"}}function se(){var e,n=null!==(e=document.querySelector(v.sdkButtonIframe))&&void 0!==e?e:document.createElement("iframe");if(n){var t,o=M({type:"button"});n.id=v.sdkButtonIframe.replace("#",""),n.style.position="fixed",n.style.border="none",n.style.width="".concat(120,"px"),n.style.height="".concat(48,"px"),n.style.minWidth="".concat(120,"px"),n.style.maxWidth="95%",n.style.maxHeight="95%",n.style.bottom=o.bottom,n.style.right=o.right,n.style.left=o.left,n.style.top=o.top,n.style.margin="0",n.style.padding="0",n.style.zIndex="9997",n.style.backgroundColor="transparent",n.style.opacity="0",n.style.transform="scale(0.8)",n.style.transition="opacity ".concat(.2,"s ease-in-out, transform ").concat(.2,"s ease-in-out"),setTimeout(function(){n.style.opacity="1",n.style.transform="scale(1)"},100),document.body.appendChild(n),O({iframe:n,content:(t={unreadMessageCount:E.unreadMessageCount},I({template:"<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n <meta charset=\"utf-8\" />\n <meta name=\"viewport\"\n content=\"viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no\" />\n <meta name=\"theme-color\" content=\"#000000\" />\n <meta name=\"robots\" content=\"noindex\" />\n <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n @font-face {\n font-family: 'TheymesBody';\n src: CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER;\n font-weight: normal;\n font-style: normal;\n font-display: fallback;\n }\n\n * {\n box-sizing: border-box;\n }\n\n html,\n body {\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .sdk-button {\n display: flex;\n font-family: 'TheymesBody', CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER;\n background: rgb(CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n align-items: center;\n justify-content: center;\n color: rgb(CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER);\n font-size: 14px;\n font-weight: 700;\n cursor: pointer;\n text-align: center;\n padding: 0;\n border: none;\n outline: none;\n border-radius: 999px;\n box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);\n position: relative;\n white-space: nowrap; \n }\n\n .sdk-button-text {\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .sdk-button-badge {\n position: absolute;\n top: 0;\n right: 0;\n background: rgb(CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER);\n width: 12px;\n height: 12px;\n border-radius: 999px;\n display: none;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <button class=\"sdk-button\">\n <span class=\"sdk-button-text\">WIDGET_BUTTON_TEXT_PLACEHOLDER</span>\n <span class=\"sdk-button-badge\"></span>\n </button>\n <script NONCE_ATTR_PLACEHOLDER>\n let unreadMessageCount = UNREAD_MESSAGE_COUNT_PLACEHOLDER;\n\n function calculateButtonSize() {\n const paddingX = 12;\n const scrollWidth = document.querySelector('.sdk-button-text').scrollWidth;\n const width = scrollWidth + (paddingX * 2);\n \n parent.postMessage({ action: 'theymes.sdkButtonSizeUpdated', width }, '*');\n }\n\n function openWidget() {\n parent.postMessage({ action: 'theymes.sdkButtonClicked' }, '*');\n }\n\n function iframeSubscriber(e) {\n if (e.data.action === 'unreadMessageCountUpdate') {\n unreadMessageCount = e.data.count;\n updateUnreadMessageCount()\n } else if (e.data.action === 'widgetButtonTextUpdate') {\n document.querySelector('.sdk-button-text').innerHTML = e.data.text;\n calculateButtonSize();\n }\n }\n\n function updateUnreadMessageCount() {\n if (unreadMessageCount > 0) {\n document.querySelector('.sdk-button-badge').style.display = 'block';\n } else {\n document.querySelector('.sdk-button-badge').style.display = 'none';\n }\n }\n\n document.querySelector('.sdk-button').addEventListener('click', openWidget);\n window.addEventListener('message', iframeSubscriber, false);\n\n updateUnreadMessageCount();\n calculateButtonSize();\n <\/script>\n</body>\n\n</html>"}).replace(/UNREAD_MESSAGE_COUNT_PLACEHOLDER/g,"".concat(t.unreadMessageCount)).replace(/CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER/g,L(E.colors.widgetButtonBackground)).replace(/CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER/g,L(E.colors.widgetButtonText)).replace(/CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER/g,L(E.colors.widgetButtonActionPending)).replace(/WIDGET_BUTTON_TEXT_PLACEHOLDER/g,me()))})}}function le(e){return"start"===e.animation?"game"===E.mode?"translateY(20%)":"scale(0.8)":"game"===E.mode?"translateY(0)":"scale(1)"}function ce(e){return t(this,void 0,void 0,function(){return o(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,7]),[4,e.json()];case 1:return[2,n.sent()];case 2:n.sent(),n.label=3;case 3:return n.trys.push([3,5,,6]),[4,e.text()];case 4:return[2,n.sent()];case 5:return n.sent(),[2,void 0];case 6:return[3,7];case 7:return[2]}})})}function de(){return t(this,void 0,void 0,function(){var e,n,t,i,r,a;return o(this,function(o){switch(o.label){case 0:if(fe(),E.retryRecordRetentionTimerId&&(clearTimeout(E.retryRecordRetentionTimerId),E.retryRecordRetentionTimerId=null),E.retentionRemainingSeconds=null,E.isRetentionRecordedForSession=!0,!(e=ne()))return[2];n="https://".concat(E.domain,"/api/sdk/retention"),t=re({supportViewConfig:e}),i={token:E.token,deviceId:E.deviceId,language:E.language,metadata:t},o.label=1;case 1:return o.trys.push([1,5,,6]),[4,fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})];case 2:return(r=o.sent()).ok?[3,4]:[4,ce(r)];case 3:throw o.sent();case 4:return[3,6];case 5:return a=o.sent(),console.error("Error tracking retention:",a),E.retryRecordRetentionTimerId=setTimeout(de,6e4),[3,6];case 6:return[2]}})})}function ue(){var e=new Date;if(E.sessionStatus="active",E.sessionResumeOrStartTime=e,E.sessionStartTime){var n=E.sessionStartTime.valueOf()/1e3+E.resetSessionAfterSecs;Date.now()/1e3>n&&ge()}else ge();null!==E.retentionRemainingSeconds&&(E.recordRetentionTimerId=setTimeout(de,1e3*E.retentionRemainingSeconds))}function ge(){E.sessionStartTime=new Date,E.retentionRemainingSeconds=E.recordRetentionAfterSecs,E.isRetentionRecordedForSession=!1,fe()}function fe(){E.recordRetentionTimerId&&(clearTimeout(E.recordRetentionTimerId),E.recordRetentionTimerId=null)}function pe(){E.isRetentionRecordedForSession&&de()}function me(){var e;return function(e){var n=e.split(" ");if(e.length<=16||n.length<=1)return e;for(var t=n.map(function(e){return e.length}),o=[],r=1;r<t.length;r++){var a=t.slice(0,r),s=t.slice(r),l=a.reduce(function(e,n){return e+n},0),c=s.reduce(function(e,n){return e+n},0),d=Math.abs(l-c);o.push(d)}var u=Math.min.apply(Math,o),g=o.indexOf(u);return i(i(i([],n.slice(0,g+1),!0),["<br>"],!1),n.slice(g+1),!0).join(" ")}(null!==(e=function(e){var n,t,o,i,r,a=R(null!==(n=E.language)&&void 0!==n?n:"en"),s=null===(t=E.locs[e.loc])||void 0===t?void 0:t[a];if(s)return s;var l=a.split("-")[0];return l&&(null===(o=E.locs[e.loc])||void 0===o?void 0:o[l])||(null!==(r=null===(i=E.locs[e.loc])||void 0===i?void 0:i.en)&&void 0!==r?r:null)}({loc:"widgetButtonText"}))&&void 0!==e?e:"Support")}function he(){var e=E.isInForeground,n="visible"===document.visibilityState&&document.hasFocus();E.isInForeground=n,e!==n&&X(),n&&"paused"===E.sessionStatus?ue():n||"active"!==E.sessionStatus||function(){if(E.sessionResumeOrStartTime&&E.retentionRemainingSeconds){var e=Math.floor((Date.now()-E.sessionResumeOrStartTime.valueOf())/1e3);E.retentionRemainingSeconds-=e}E.sessionStatus="paused",fe()}()}function ve(){var e,n=E.isLoggedIn,t=Boolean(E.signedMetadataToken||(null===(e=E.player)||void 0===e?void 0:e.id));E.isLoggedIn=t,t&&!n?z():!t&&n&&G()}try{document.addEventListener("visibilitychange",he),window.addEventListener("focus",he),window.addEventListener("blur",he),window.addEventListener("resize",ae),window.addEventListener("resize",j),window.addEventListener("message",function(e){if("theymes.ready"===e.data.action){var n=document.querySelector(v.sdkLoaderIframe),t=document.querySelector(v.sdkIframe);E.networkErrorTimerId&&(clearTimeout(E.networkErrorTimerId),E.networkErrorTimerId=null),t&&(t.style.width="100%",t.style.height="100%"),n&&n.remove()}else if("theymes.close"===e.data.action)Q();else if("theymes.closeNotification"===e.data.action)U({notification:E.visibleNotification});else if("theymes.handleNotificationAction"===e.data.action)d={notification:E.visibleNotification},(null==(u=d.notification)?void 0:u.action)&&"OPEN_PAGE"===u.action.type&&(te({path:u.action.path}),U({notification:u}));else if("theymes.sdkButtonClicked"===e.data.action)(c=document.querySelector(v.sdkButtonIframe))&&(c.style.opacity="0",c.style.transform="scale(0.8)",setTimeout(function(){c.remove()},200)),"support"===E.widgetButtonAction?V():"assistant"===E.widgetButtonAction&&Z();else if("theymes.sdkButtonSizeUpdated"===e.data.action){var o=document.querySelector(v.sdkButtonIframe);o&&(o.style.width="".concat(e.data.width,"px"))}else if("theymes.openExternalPage"===e.data.action){var i=e.data.target;"_self"===i&&function(e){var n=e.key,t=e.value,o=e.ttlMs,i=e.storage,r=void 0===i?x:i,a={value:t,expiry:Date.now()+o};r.setItem(n,JSON.stringify(a))}({key:b,value:e.data.path,ttlMs:6e5}),window.open(e.data.url,i)}else if("theymes.messageCountsChanged"===e.data.action){var r=e.data,a=r.unreadMessageCount,s=r.unansweredMessageCount;if("number"!=typeof a||"number"!=typeof s)return;s!==E.unansweredMessageCount&&(E.unansweredMessageCount=s,l("unansweredMessageCountUpdate",[s])),a!==E.unreadMessageCount&&(E.unreadMessageCount=a,l("unreadMessageCountUpdate",[a]),H({action:"unreadMessageCountUpdate",count:a}))}var c,d,u},!1),ee("open",function(){E.sdkIsOpen=!0,Y()}),ee("close",function(){E.sdkIsOpen=!1,J()})}catch(e){console.error("Error adding event listeners to SDK",e)}var ye=_("initialize",function(e,i,r){return t(void 0,void 0,void 0,function(){var t,a,s,l,c,d,v,y,T,k,C,O,L,I;return o(this,function(o){switch(o.label){case 0:if(!e||!i||!r.mode)throw new Error("Token, domain, and mode are required");E.token=e,E.domain=i,E.mode=r.mode,E.element="element"in r&&void 0!==r.element?r.element:E.element,E.language=null!==(v=r.language)&&void 0!==v?v:E.language,E.nonce=null!==(y=r.nonce)&&void 0!==y?y:E.nonce,E.deviceId=function(){var e=w("deviceId");if(e)return e;var n=(t=Date.now(),"undefined"!=typeof performance&&"function"==typeof performance.now&&(t+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?n:3&n|8).toString(16)}));return S("deviceId",n),n;var t}(),E.widgetButton="button"in r&&void 0!==r.button&&null!==(T=r.button)&&void 0!==T?T:E.widgetButton,E.widgetButtonAction="buttonAction"in r&&void 0!==r.buttonAction&&null!==(k=r.buttonAction)&&void 0!==k?k:E.widgetButtonAction,E.position="position"in r&&void 0!==r.position&&null!==(C=r.position)&&void 0!==C?C:E.position,E.x="x"in r&&void 0!==r.x?r.x:E.x,E.y="y"in r&&void 0!==r.y?r.y:E.y,E.disableInsets="game"===E.mode&&null!==E.element,W.eventPoller||(W.eventPoller=new q),t="https://".concat(i,"/api/sdk/settings"),a=new URLSearchParams({token:E.token,platform:h,mode:E.mode}).toString(),o.label=1;case 1:return o.trys.push([1,6,,7]),[4,fetch("".concat(t,"?").concat(a),{method:"GET"})];case 2:return(s=o.sent()).ok?[3,4]:[4,ce(s)];case 3:throw o.sent();case 4:return[4,s.json()];case 5:return l=o.sent(),(null===(O=null==l?void 0:l.branding)||void 0===O?void 0:O.colors)&&(N=l.branding.colors,E.colors=n(n({},E.colors),N),S(u,JSON.stringify(E.colors))),(null===(L=null==l?void 0:l.branding)||void 0===L?void 0:L.locs)&&(A=l.branding.locs,E.locs=n(n({},E.locs),A),S(g,JSON.stringify(E.locs))),(null===(I=null==l?void 0:l.branding)||void 0===I?void 0:I.fonts)&&(P=l.branding.fonts,E.fonts=n(n({},E.fonts),P),S(f,JSON.stringify(E.fonts))),"number"!=typeof(null==l?void 0:l.recordRetentionAfterSecs)&&null!==(null==l?void 0:l.recordRetentionAfterSecs)||(R=l.recordRetentionAfterSecs,E.recordRetentionAfterSecs=R,S(p,JSON.stringify(E.recordRetentionAfterSecs))),"number"!=typeof(null==l?void 0:l.resetSessionAfterSecs)&&null!==(null==l?void 0:l.resetSessionAfterSecs)||(_=l.resetSessionAfterSecs,E.resetSessionAfterSecs=null!=_?_:28800,S(m,JSON.stringify(E.resetSessionAfterSecs))),ue(),ie(),c=function(e){var n=e.key,t=e.storage,o=void 0===t?x:t,i=o.getItem(n);if(!i)return null;var r=JSON.parse(i);return Date.now()>r.expiry?(o.removeItem(n),null):(o.removeItem(n),r.value)}({key:b}),c&&"widget"===E.mode&&!D()?te({path:c}):E.widgetButton&&se(),[3,7];case 6:return d=o.sent(),console.error("Error initializing SDK:",d),[3,7];case 7:return[2]}var _,R,P,A,N})})},void 0),be=_("openSupport",V,void 0),we=_("openAssistant",Z,void 0),Se=_("openResource",function(e,n){var t="/resources/".concat(e);oe({path:t,config:n}),te({path:t,config:n})},void 0),xe=_("close",Q,void 0),Ee=_("getLanguage",function(){return E.language},null),Te=_("setLanguage",function(e){var n=E.language!==e;E.language=e,n&&(ie(),H({action:"widgetButtonTextUpdate",text:me()}))},void 0),ke=_("getSignedMetadataToken",function(){return E.signedMetadataToken},null),Ce=_("setSignedMetadataToken",function(e){var n=E.signedMetadataToken!==e;E.signedMetadataToken=e,ve(),n&&(ie(),pe())},void 0),Oe=_("getPlayer",function(){return E.player},null),Le=_("setPlayer",function(e){var n,t=(null===(n=E.player)||void 0===n?void 0:n.id)!==(null==e?void 0:e.id);E.player=e,ve(),t&&(ie(),pe())},void 0),Ie=_("getTags",function(){return Array.from(E.tags)},[]),_e=_("setTags",function(e){E.tags=new Set(e),ie()},void 0),Re=_("addTag",function(e){E.tags.add(e),ie()},void 0),Pe=_("addTags",function(e){e.forEach(function(e){return E.tags.add(e)}),ie()},void 0),Ae=_("removeTag",function(e){E.tags.delete(e),ie()},void 0),Ne=_("removeTags",function(e){e.forEach(function(e){return E.tags.delete(e)}),ie()},void 0),De=_("removeAllTags",function(){E.tags.clear(),ie()},void 0),Me=_("getFields",function(){return E.fields},{}),Be=_("setFields",function(e){E.fields=e,ie()},void 0),He=_("addField",function(e,n){E.fields[e]=n,ie()},void 0),Fe=_("addFields",function(e){E.fields=n(n({},E.fields),e),ie()},void 0),je=_("removeField",function(e){delete E.fields[e],ie()},void 0),Ue=_("removeFields",function(e){e.forEach(function(e){return delete E.fields[e]}),ie()},void 0),qe=_("removeAllFields",function(){E.fields={},ie()},void 0),We=_("enableLogging",function(){E.loggingEnabled=!0},void 0),ze=_("disableLogging",function(){E.loggingEnabled=!1},void 0),Ge=_("isYoungPlayer",function(){return E.youngPlayer},!1),Ye=_("setYoungPlayer",function(e){E.youngPlayer=e,ie()},void 0),Je=_("isPrivacyMode",function(){return E.privacyMode},!1),Ke=_("setPrivacyMode",function(e){E.privacyMode=e,ie()},void 0),Xe=_("isSupported",$,!1),Ve=_("requestNotificationPermission",function(){},void 0),Ze=_("enableNotifications",function(){E.notificationsPaused=!1,K()},void 0),Qe=_("disableNotifications",function(){E.notificationsPaused=!0},void 0),$e=_("getUnreadMessageCount",function(){return E.unreadMessageCount},0),en=_("getUnansweredMessageCount",function(){return E.unansweredMessageCount},0),nn=_("getSdkVersion",function(){return d},""),tn=_("reset",function(){E.language=null,E.tags=new Set,E.fields={},E.signedMetadataToken=null,E.player=null,ve(),ie(),H({action:"widgetButtonTextUpdate",text:me()})},void 0),on=_("recordRetention",function(){E.isRetentionRecordedForSession||de()},void 0),rn=_("addEventListener",ee,void 0),an=_("removeEventListener",function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];s.apply(void 0,e)},void 0),sn=_("iosSetKeyboardHeight",function(e){E.keyboardHeight=e,ae()},void 0);return e.addEventListener=rn,e.addField=He,e.addFields=Fe,e.addTag=Re,e.addTags=Pe,e.close=xe,e.disableLogging=ze,e.disableNotifications=Qe,e.enableLogging=We,e.enableNotifications=Ze,e.getFields=Me,e.getLanguage=Ee,e.getPlayer=Oe,e.getSdkVersion=nn,e.getSignedMetadataToken=ke,e.getTags=Ie,e.getUnansweredMessageCount=en,e.getUnreadMessageCount=$e,e.initialize=ye,e.iosSetKeyboardHeight=sn,e.isPrivacyMode=Je,e.isSupported=Xe,e.isYoungPlayer=Ge,e.openAssistant=we,e.openResource=Se,e.openSupport=be,e.recordRetention=on,e.removeAllFields=qe,e.removeAllTags=De,e.removeEventListener=an,e.removeField=je,e.removeFields=Ue,e.removeTag=Ae,e.removeTags=Ne,e.requestNotificationPermission=Ve,e.reset=tn,e.setFields=Be,e.setLanguage=Te,e.setPlayer=Le,e.setPrivacyMode=Ke,e.setSignedMetadataToken=Ce,e.setTags=_e,e.setYoungPlayer=Ye,e}({});
1
+ var theymes=function(e){"use strict";var n=function(){return n=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var i in n=arguments[t])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e},n.apply(this,arguments)};function t(e,n,t,o){return new(t||(t=Promise))(function(i,r){function a(e){try{l(o.next(e))}catch(e){r(e)}}function s(e){try{l(o.throw(e))}catch(e){r(e)}}function l(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t(function(e){e(n)})).then(a,s)}l((o=o.apply(e,n||[])).next())})}function o(e,n){var t,o,i,r={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(r=0)),r;)try{if(t=1,o&&(i=2&s[0]?o.return:s[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;switch(o=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,o=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(i=r.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(6===s[0]&&r.label<i[1]){r.label=i[1],i=s;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(s);break}i[2]&&r.ops.pop(),r.trys.pop();continue}s=n.call(e,r)}catch(e){s=[6,e],o=0}finally{t=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function i(e,n,t){if(t||2===arguments.length)for(var o,i=0,r=n.length;i<r;i++)!o&&i in n||(o||(o=Array.prototype.slice.call(n,0,i)),o[i]=n[i]);return e.concat(o||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var r={unreadMessageCountUpdate:new Set,unansweredMessageCountUpdate:new Set,open:new Set,close:new Set};function a(e,n){r[e].add(n)}function s(e,n){r[e].delete(n)}function l(e,n){r[e].forEach(function(e){return e.apply(void 0,n)})}var c='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: sans-serif;\n font-size: CSS_FONT_SIZE_PLACEHOLDER;\n }\n\n html,\n body {\n background: rgb(CSS_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n padding-top: INSET_TOP_PLACEHOLDER;\n padding-bottom: INSET_BOTTOM_PLACEHOLDER;\n padding-left: INSET_LEFT_PLACEHOLDER;\n padding-right: INSET_RIGHT_PLACEHOLDER;\n }\n\n .top-bar {\n flex: 0 0 auto;\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: flex-end;\n }\n\n .close-button {\n padding: 0.5rem 1rem;\n cursor: pointer;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 1.75rem;\n height: 1.75rem;\n }\n\n .error-wrapper {\n flex: 1 0 0%;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: 12px;\n padding: 12px;\n }\n\n h1 {\n font-size: 18px;\n font-weight: 400;\n color: rgb(CSS_TEXT_PLACEHOLDER);\n }\n\n svg.error-icon {\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="wrapper">\n <div class="top-bar">\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"\n stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"\n class="lucide lucide-x-icon lucide-x">\n <path d="M18 6 6 18" />\n <path d="m6 6 12 12" />\n </svg>\n </div>\n </div>\n <div class="error-wrapper">\n <svg class="error-icon" width="91" height="91" viewBox="0 0 91 91" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path\n d="M45.1079 89.1321C50.7158 89.1321 55.2618 84.5859 55.2618 78.9783C55.2618 73.3707 50.7158 68.8245 45.1079 68.8245C39.5001 68.8245 34.9541 73.3707 34.9541 78.9783C34.9541 84.5859 39.5001 89.1321 45.1079 89.1321Z"\n stroke="#FFB547" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />\n <path d="M24.7637 58.6355C35.9988 47.4005 54.2144 47.4005 65.4492 58.6355" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M12.7988 46.6689C22.1436 37.3241 34.529 32.8731 46.7703 33.3159" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M1.1084 34.4283C11.6674 23.9971 25.012 18.0833 38.7295 16.6868" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M89.1082 1.13208L62.0312 28.209" stroke="#FFB547" stroke-width="2" stroke-linecap="round"\n stroke-linejoin="round" />\n <path d="M62.0312 1.13208L89.1082 28.209" stroke="#FFB547" stroke-width="2" stroke-linecap="round"\n stroke-linejoin="round" />\n </svg>\n <div>\n <h1>Connection error</h1>\n </div>\n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeTheymesSdk() {\n parent.postMessage({ action: \'theymes.close\' }, \'*\');\n }\n\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeTheymesSdk);\n <\/script>\n</body>\n\n</html>',d="1.3.1",u="colors",g="locs",p="fonts",f="deviceId",m="recordRetentionAfterSecs",v="resetSessionAfterSecs",y="settingsNextPollAt",h="eventPollerNextPollAt",b="hasSupportInteraction",w="sendPlayerRetention",S="pathOnInit",x=2419200,k="web",T={sdkDialog:"#theymes-sdk-dialog",sdkIframeWrapper:"#theymes-sdk-wrapper",sdkIframe:"#theymes-sdk",sdkLoaderIframe:"#theymes-sdk-loader",notificationDialog:"#theymes-sdk-notification-dialog",notificationIframe:"#theymes-sdk-notification",sdkButtonIframe:"#theymes-sdk-button"},C=.2,E=function(e){var n;try{return null!==(n=null===localStorage||void 0===localStorage?void 0:localStorage.getItem(e))&&void 0!==n?n:null}catch(e){return null}},O=function(e,n){try{null===localStorage||void 0===localStorage||localStorage.setItem(e,n)}catch(e){}},I=function(e){try{null===localStorage||void 0===localStorage||localStorage.removeItem(e)}catch(e){}},P={length:0,getItem:function(e){var n;try{return null!==(n=null===sessionStorage||void 0===sessionStorage?void 0:sessionStorage.getItem(e))&&void 0!==n?n:null}catch(e){return null}},setItem:function(e,n){try{null===sessionStorage||void 0===sessionStorage||sessionStorage.setItem(e,n)}catch(e){}},removeItem:function(e){try{null===sessionStorage||void 0===sessionStorage||sessionStorage.removeItem(e)}catch(e){}},clear:function(){try{null===sessionStorage||void 0===sessionStorage||sessionStorage.clear()}catch(e){}},key:function(e){var n;try{return null!==(n=null===sessionStorage||void 0===sessionStorage?void 0:sessionStorage.key(e))&&void 0!==n?n:null}catch(e){return null}}};function L(e){return"".concat("theymes",".").concat(e)}function R(e){return null===A.token?null:"".concat(L(e),".").concat(A.token)}function _(e){if(null===A.resolvedPlayerId||void 0===A.resolvedPlayerId)return null;var n=R(e);return null===n?null:"".concat(n,".").concat(A.resolvedPlayerId)}var A={token:null,domain:null,sdkApiDomain:null,mode:"game",deviceId:null,position:"bottom-right",widgetButton:!1,widgetButtonAction:"support",x:20,y:20,loggingEnabled:!1,element:null,language:null,userLanguage:navigator.language,tags:new Set,fields:{},youngPlayer:!1,privacyMode:!1,signedMetadataToken:null,isLoggedIn:!1,isInForeground:!0,hasNetworkConnectivity:!0,player:null,sdkIsOpen:!1,forceUpdateSdkDialog:!1,recordRetentionAfterSecs:null,resetSessionAfterSecs:28800,sessionStatus:"waiting",sessionStartTime:null,sessionResumeOrStartTime:null,retentionRemainingSeconds:null,isRetentionRecordedForSession:!1,recordRetentionTimerId:null,retryRecordRetentionTimerId:null,networkErrorTimerId:null,sendPlayerRetention:"support-only",hasSupportInteraction:!1,resolvedPlayerId:null,colors:{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}},locs:{widgetButtonText:{}},fonts:N(),notificationsPaused:!0,notifications:[],visibleNotification:null,unreadMessageCount:0,unansweredMessageCount:0,previousPath:null,previousConfig:null,nonce:null,keyboardHeight:0,disableInsets:!1};function N(){return{body:void 0}}var D=["always","support-only","never"];function M(){A.colors=function(){var e=R(u);if(null===e)return{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}};var t=E(e);if(t){var o=JSON.parse(t);return n(n({},{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}}),o)}return{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}}}(),A.locs=function(){var e=R(g);if(null===e)return{widgetButtonText:{}};var t=E(e);if(t){var o=JSON.parse(t);return n(n({},{widgetButtonText:{}}),o)}return{widgetButtonText:{}}}(),A.fonts=function(){var e=R(p);if(null===e)return{body:void 0};var t=E(e);if(t){var o=JSON.parse(t);return n(n({},{body:void 0}),o)}return{body:void 0}}(),A.recordRetentionAfterSecs=function(){var e=R(m);if(null===e)return null;var n=E(e);if(n){var t=JSON.parse(n);if("number"==typeof t)return t}return null}(),A.resetSessionAfterSecs=function(){var e=R(v);if(null===e)return 28800;var n=E(e);if(n){var t=JSON.parse(n);if("number"==typeof t)return t}return 28800}(),A.sendPlayerRetention=function(){var e=R(w);if(null===e)return"support-only";var n=E(e);return n&&D.includes(n)?n:"support-only"}()}var B=function(e,n){return e===n||Boolean(e&&n&&"object"==typeof e&&"object"==typeof n&&Object.keys(e).length===Object.keys(n).length&&Object.entries(e).every(function(e){var t=e[0],o=e[1];return B(o,n[t])}))};function H(e){var n,t=e.iframe,o=e.content,i=null===(n=t.contentWindow)||void 0===n?void 0:n.document;i&&(i.open(),i.write(o),i.close())}function F(e){return"".concat(e.r,", ").concat(e.g,", ").concat(e.b)}function j(e){var n,t,o,i;return e.template.replace(/PLATFORM_PLACEHOLDER/g,k).replace(/INSET_TOP_PLACEHOLDER/g,A.disableInsets?"0px":"env(safe-area-inset-top, 0px)").replace(/INSET_BOTTOM_PLACEHOLDER/g,A.disableInsets?"0px":"env(safe-area-inset-bottom, 0px)").replace(/INSET_LEFT_PLACEHOLDER/g,A.disableInsets?"0px":"env(safe-area-inset-left, 0px)").replace(/INSET_RIGHT_PLACEHOLDER/g,A.disableInsets?"0px":"env(safe-area-inset-right, 0px)").replace(/CSS_TEXT_PLACEHOLDER/g,F(A.colors.text)).replace(/CSS_BORDER_PLACEHOLDER/g,F(A.colors.border)).replace(/CSS_BACKGROUND_PLACEHOLDER/g,F(A.colors.background)).replace(/CSS_TILE_PLACEHOLDER/g,F(A.colors.tile)).replace(/CSS_ACCENT_PLACEHOLDER/g,F(A.colors.accent)).replace(/CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER/g,F(A.colors.notificationBackground)).replace(/CSS_NOTIFICATION_TEXT_PLACEHOLDER/g,F(A.colors.notificationText)).replace(/CSS_FONT_SIZE_PLACEHOLDER/g,"game"===A.mode?"16px":"14px").replace(/CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER/g,null!==(t=null===(n=A.fonts.body)||void 0===n?void 0:n.regular)&&void 0!==t?t:"url('https://fonts.gstatic.com/s/poppins/v22/pxiEyp8kv8JHgFVrJJfecnFHGPc.woff2') format('woff2')").replace(/CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER/g,null!==(i=null===(o=A.fonts.body)||void 0===o?void 0:o.fallback)&&void 0!==i?i:"ui-sans-serif, system-ui, sans-serif").replace(/NONCE_ATTR_PLACEHOLDER/g,A.nonce?'nonce="'.concat(A.nonce,'"'):"")}function U(e,n,t){return function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];try{return n.apply(void 0,o)}catch(n){return console.error("Error in ".concat(e),n),t}}}var q=function(e){var n=e.split(/[-_]/),t=n[0],o=n[1];return t?o?"".concat(t.toLowerCase(),"-").concat(o.toUpperCase()):t.toLowerCase():"en"},W=/(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|redmi|series[46]0|samsungbrowser.*mobile|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,J=/CrOS/,z=/android|ipad|playbook|silk/i;function G(){return!!function(e){e||(e={});var n=e.ua;if(n||"undefined"==typeof navigator||(n=navigator.userAgent),n&&n.headers&&"string"==typeof n.headers["user-agent"]&&(n=n.headers["user-agent"]),"string"!=typeof n)return!1;var t=W.test(n)&&!J.test(n)||!!e.tablet&&z.test(n);return!t&&e.tablet&&e.featureDetect&&navigator&&navigator.maxTouchPoints>1&&-1!==n.indexOf("Macintosh")&&-1!==n.indexOf("Safari")&&(t=!0),t}({tablet:!0})&&(window.innerWidth<500||window.innerHeight<500)}function Y(e){var n=e.type,t=A.position,o=A.x,i=A.y;return G()&&"widget"===n?{top:"0",left:"0",right:"0",bottom:"0"}:"top-left"===t?{top:"".concat(o,"px"),left:"".concat(i,"px"),right:"auto",bottom:"auto"}:"top-right"===t?{top:"".concat(o,"px"),right:"".concat(i,"px"),left:"auto",bottom:"auto"}:"bottom-left"===t?{bottom:"".concat(o,"px"),left:"".concat(i,"px"),right:"auto",top:"auto"}:{bottom:"".concat(o,"px"),right:"".concat(i,"px"),left:"auto",top:"auto"}}function K(){return G()?{width:"100%",height:"100%",maxWidth:"none",maxHeight:"none"}:{width:"".concat(340,"px"),height:"".concat(680,"px"),maxWidth:"none",maxHeight:"calc(100vh - ".concat(2*A.y,"px)")}}function X(e){var n=document.querySelector(T.sdkButtonIframe);if(n)var t=setInterval(function(){var o,i;"complete"===(null===(o=n.contentDocument)||void 0===o?void 0:o.readyState)&&(clearInterval(t),null===(i=null==n?void 0:n.contentWindow)||void 0===i||i.postMessage(e,"*"))},100)}function V(){var e,n;if(!A.notificationsPaused){var t=A.notifications[0];if(t&&!A.visibleNotification){A.visibleNotification=t;var o=null!==(e=document.querySelector(T.notificationDialog))&&void 0!==e?e:document.createElement("div");o.id=T.notificationDialog.replace("#",""),o.style.position="fixed",o.style.border="none",o.style.margin="0",o.style.padding="0",o.style.zIndex="9999",o.style.colorScheme="auto",o.style.backgroundColor="transparent",o.style.pointerEvents="none",o.style.overflow="hidden",document.body.appendChild(o);var i,r=null!==(n=o.querySelector(T.notificationIframe))&&void 0!==n?n:document.createElement("iframe");r.id=T.notificationIframe.replace("#",""),r.style.position="absolute",r.style.border="none",r.style.width="0",r.style.height="0",r.style.top="-20px",r.style.left="0",r.style.colorScheme="auto",r.style.pointerEvents="auto",r.style.marginTop="-20px",r.style.opacity="0",r.style.transition="opacity ".concat(.2,"s ease-in-out, margin-top ").concat(.2,"s ease-in-out"),o.appendChild(r),H({iframe:r,content:(i={text:t.text},j({template:'<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n @font-face {\n font-family: \'TheymesBody\';\n src: CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER;\n font-weight: normal;\n font-style: normal;\n font-display: fallback;\n }\n\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'TheymesBody\', CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER;\n }\n\n html,\n body {\n width: 100%;\n height: auto;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_NOTIFICATION_TEXT_PLACEHOLDER);\n width: 1.25rem;\n height: 1.25rem;\n }\n\n .notification {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n background: rgb(CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: auto;\n margin: 0;\n padding: 12px;\n border-radius: 6px;\n color: rgb(CSS_NOTIFICATION_TEXT_PLACEHOLDER);\n }\n\n .notification-text {\n flex: 1 0 0%;\n font-size: 0.875rem;\n /* 14/16 */\n line-height: 1.2;\n display: -webkit-box;\n line-clamp: 2;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n text-overflow: ellipsis;\n cursor: pointer;\n }\n\n .close-button {\n flex: 0 0 auto;\n padding-left: 10px;\n cursor: pointer;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="notification">\n <div class="notification-text">NOTIFICATION_TEXT_PLACEHOLDER</div>\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round">\n <path d="M18 6 6 18"></path>\n <path d="m6 6 12 12"></path>\n </svg>\n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeNotification() {\n parent.postMessage({ action: \'theymes.closeNotification\' }, \'*\');\n }\n\n function notificationClicked() {\n parent.postMessage({ action: \'theymes.handleNotificationAction\' }, \'*\');\n }\n\n document.querySelector(\'.notification-text\').addEventListener(\'click\', notificationClicked);\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeNotification);\n <\/script>\n</body>\n\n</html>'}).replace(/NOTIFICATION_TEXT_PLACEHOLDER/g,i.text))}),setTimeout(function(){r.style.opacity="1",r.style.marginTop="0px",Z()},500),t.closeAfterSeconds>0&&setTimeout(function(){Q({notification:t})},1e3*t.closeAfterSeconds)}}}function Z(){var e,n,t,o=document.querySelector(T.notificationDialog),i=document.querySelector(T.notificationIframe);if(o&&i){var r=(null===(t=null===(n=null===(e=i.contentWindow)||void 0===e?void 0:e.document)||void 0===n?void 0:n.body)||void 0===t?void 0:t.scrollHeight)?"".concat(i.contentWindow.document.body.scrollHeight,"px"):"0";if("widget"===A.mode){var a=Y({type:"widget"}),s=K(),l="calc(".concat(s.width," - 20px)");o.style.bottom=a.bottom,o.style.right=a.right,o.style.left=a.left,o.style.top=a.top,o.style.overflow="hidden",i.style.width=l}else if(A.element){var c=A.element.getBoundingClientRect();l="".concat(c.width-20,"px");o.style.top="".concat(c.top,"px"),o.style.left="".concat(c.left,"px"),o.style.right="".concat(c.right,"px"),o.style.bottom="".concat(c.bottom,"px"),o.style.overflow="hidden",i.style.width=l}else{l="calc(100% - 20px)";o.style.top=A.disableInsets?"0px":"env(safe-area-inset-top, 0px)",o.style.left=A.disableInsets?"0px":"env(safe-area-inset-left, 0px)",o.style.right=A.disableInsets?"0px":"env(safe-area-inset-right, 0px)",o.style.bottom=A.disableInsets?"0px":"env(safe-area-inset-bottom, 0px)",o.style.overflow="visible",i.style.width=l}i.style.height=r,i.style.top="10px",i.style.left="10px"}}function Q(e){if(e.notification&&A.visibleNotification===e.notification){var n=document.querySelector(T.notificationIframe),t=document.querySelector(T.notificationDialog);n&&(n.style.opacity="0",n.style.marginTop="-20px",setTimeout(function(){null==t||t.remove(),A.notifications=A.notifications.slice(1),A.visibleNotification=null,V()},200))}}var $=function(){function e(){Object.defineProperty(this,"isRunning",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"retryFailureCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"lastPollDate",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"nextPollDate",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.restoreNextPollDateIfNeeded(),this.resumeIfNeeded(!1)}return Object.defineProperty(e.prototype,"restoreNextPollDateIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=_(h);if(null!==e&&!A.hasSupportInteraction){var n=E(e);if(n){var t=JSON.parse(n);if("number"==typeof t&&t>0){var o=Date.now()/1e3,i=t;i>o+x&&(i=o+x,O(e,JSON.stringify(i))),i>o&&(this.nextPollDate=new Date(1e3*i),A.loggingEnabled&&console.log("EventPoller: restored next poll date from storage: ".concat(this.nextPollDate.toISOString()," (in ").concat(Math.round(i-o),"s)")))}}}}}),Object.defineProperty(e.prototype,"onIsInForegroundChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(){A.isInForeground?this.resumeIfNeeded(!1):this.pauseIfNeeded()}}),Object.defineProperty(e.prototype,"onHasNetworkConnectivityChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.resumeIfNeeded(!1)}}),Object.defineProperty(e.prototype,"resume",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning=!0;var e=new Date;if(this.nextPollDate||(this.nextPollDate=new Date(e.getTime()+1e3)),e>=this.nextPollDate)this.pollEventsRequest();else{var n=(this.nextPollDate.getTime()-e.getTime())/1e3;this.scheduleNextPollEventsRequest(n)}}}),Object.defineProperty(e.prototype,"pause",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning=!1,this.timer&&(clearTimeout(this.timer),this.timer=null)}}),Object.defineProperty(e.prototype,"shouldBeRunning",{enumerable:!1,configurable:!0,writable:!0,value:function(){return A.isLoggedIn&&A.isInForeground&&A.hasNetworkConnectivity&&!A.sdkIsOpen}}),Object.defineProperty(e.prototype,"reset",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,n;this.nextPollDate=null,this.lastPollDate=null,this.retryFailureCount=0,e=_(h),n=_(b),null!==e&&I(e),null!==n&&I(n),A.hasSupportInteraction=!1}}),Object.defineProperty(e.prototype,"resumeIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){e&&this.reset(),!this.shouldBeRunning()||this.isRunning&&!e||this.resume()}}),Object.defineProperty(e.prototype,"pauseIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning&&!this.shouldBeRunning()&&this.pause()}}),Object.defineProperty(e.prototype,"onOpen",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.pauseIfNeeded(),this.reset()}}),Object.defineProperty(e.prototype,"onClose",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.resumeIfNeeded(!0)}}),Object.defineProperty(e.prototype,"onLogin",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.restoreNextPollDateIfNeeded(),this.resumeIfNeeded(!1)}}),Object.defineProperty(e.prototype,"onLogout",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.pauseIfNeeded(),this.reset()}}),Object.defineProperty(e.prototype,"scheduleNextPollEventsRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){var t=this;void 0===n&&(n=!1);var o=Date.now();if(this.nextPollDate=new Date(o+1e3*e),n){var i=_(h);if(null!==i){var r=o/1e3,a=r+e,s=Math.min(a,r+x);O(i,JSON.stringify(s))}}this.timer&&clearTimeout(this.timer),this.timer=setTimeout(function(){t.timer=null,t.pollEventsRequest()},1e3*e)}}),Object.defineProperty(e.prototype,"pollEventsRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(){return t(this,void 0,void 0,function(){var e,n,t,r,a,s,c,u,g,p;return o(this,function(o){switch(o.label){case 0:if(!A.token||!A.sdkApiDomain||!A.deviceId)return[2];if(!this.isRunning)return[2];if(this.lastPollDate&&(e=new Date(this.lastPollDate.getTime()+6e4),(n=(e.getTime()-Date.now())/1e3)>0))return this.scheduleNextPollEventsRequest(n),[2];this.lastPollDate=new Date,null!==(t=_(h))&&I(t),r={token:A.token,deviceId:A.deviceId,language:null!==(g=A.language)&&void 0!==g?g:null,userLanguage:A.userLanguage,mode:A.mode,sdkVersion:d},(null===(p=A.player)||void 0===p?void 0:p.id)&&(r.unsignedPlayerId=A.player.id),A.signedMetadataToken&&(r.signedMetadataToken=A.signedMetadataToken),o.label=1;case 1:return o.trys.push([1,4,,5]),[4,fetch("https://".concat(A.sdkApiDomain,"/api/events"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})];case 2:if(!(a=o.sent()).ok)throw new Error("HTTP error! status: ".concat(a.status));return[4,a.json()];case 3:return s=o.sent(),this.retryFailureCount=0,function(e){A.hasSupportInteraction=e;var n=_(b);null!==n&&O(n,String(A.hasSupportInteraction))}(s.hasSupportInteraction),this.scheduleNextPollEventsRequest(s.nextPollSeconds,!s.hasSupportInteraction),A.notifications=i(i([],A.notifications,!0),s.notifications,!0),!A.notificationsPaused&&!A.sdkIsOpen&&A.notifications.length>0&&V(),s.unansweredMessageCount!==A.unansweredMessageCount&&(A.unansweredMessageCount=s.unansweredMessageCount,l("unansweredMessageCountUpdate",[s.unansweredMessageCount])),s.unreadMessageCount!==A.unreadMessageCount&&(A.unreadMessageCount=s.unreadMessageCount,l("unreadMessageCountUpdate",[s.unreadMessageCount]),X({action:"unreadMessageCountUpdate",count:s.unreadMessageCount})),[3,5];case 4:return c=o.sent(),console.error("Error fetching events:",c),this.retryFailureCount+=1,u=Math.min(Math.pow(2,this.retryFailureCount+5),86400),this.scheduleNextPollEventsRequest(u),[3,5];case 5:return[2]}})})}}),e}(),ee={eventPoller:null},ne=function(){var e;!function(){var e=_(b);if(null!==e){var n=E(e);A.hasSupportInteraction="true"===n}}(),null===(e=ee.eventPoller)||void 0===e||e.onLogin()},te=function(){var e;null===(e=ee.eventPoller)||void 0===e||e.onLogout()},oe=function(){var e;null===(e=ee.eventPoller)||void 0===e||e.onOpen()},ie=function(){var e;null===(e=ee.eventPoller)||void 0===e||e.onClose()},re=function(){var e;null===(e=ee.eventPoller)||void 0===e||e.onIsInForegroundChanged()},ae=function(e){var n="/help-center";pe({path:n,config:e}),ge({path:n,config:e})},se=function(e){var n="/assistant";pe({path:n,config:e}),ge({path:n,config:e})},le=function(){!function(){var e=document.querySelector(T.sdkDialog),n=document.querySelector(T.sdkIframeWrapper);if(e){var t=function(){"widget"!==A.mode||A.forceUpdateSdkDialog?e.remove():e.style.display="none",A.forceUpdateSdkDialog=!1};n?(n.style.opacity="0",n.style.transform=he({animation:"start"}),setTimeout(function(){t()},200)):t()}A.widgetButton&&ye();l("close",[])}()},ce=function(){try{return CSS.supports("color","var(--color)")&&CSS.supports("color","rgb(255 255 255 / 0.5)")}catch(e){return!1}},de=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];a.apply(void 0,e)};function ue(e){var t,o,r,a,s,l,c=(null!=e?e:{}).config;if(!A.token||!A.domain||!A.deviceId)return null;var u=null!==(t=null==c?void 0:c.tags)&&void 0!==t?t:[],g=null!==(o=null==c?void 0:c.fields)&&void 0!==o?o:{},p=null!==(a=null!==(r=null==c?void 0:c.language)&&void 0!==r?r:A.language)&&void 0!==a?a:null,f=null!==(s=A.signedMetadataToken)&&void 0!==s?s:null,m=null!==(l=A.player)&&void 0!==l?l:null,v={_platform:k,_sdkVersion:d};A.youngPlayer&&(v._youngPlayer=!0),(A.privacyMode||A.youngPlayer)&&(v._privacyMode=!0);var y=i(i([],Array.from(A.tags),!0),u,!0),h=n(n(n({},A.fields),g),v);return{token:A.token,domain:A.domain,deviceId:A.deviceId,tags:y,fields:h,language:p,signedMetadataToken:f,player:m}}function ge(e){var n,t,o,i=ue({config:e.config});if(i){var r=null!==(n=document.querySelector(T.sdkDialog))&&void 0!==n?n:document.createElement("div");r.id=T.sdkDialog.replace("#",""),r.style.display="block",r.style.position="fixed",r.style.border="none",r.style.width="0",r.style.height="0",r.style.margin="0",r.style.padding="0",r.style.zIndex="9998",r.style.overflow="hidden",r.style.backgroundColor="transparent";var a=null!==(t=r.querySelector(T.sdkIframeWrapper))&&void 0!==t?t:document.createElement("div");a.id=T.sdkIframeWrapper.replace("#",""),a.style.position="relative",a.style.width="100%",a.style.height="100%",a.style.top="0",a.style.right="0",a.style.bottom="0",a.style.left="0",a.style.opacity="0",a.style.colorScheme="auto",a.style.border="none",a.style.backgroundColor="rgb(".concat(F(A.colors.background),")"),a.style.transform=he({animation:"start"}),a.style.transition=(A.mode,"opacity ".concat(C,"s ease-in-out, transform ").concat(C,"s ease-in-out")),"widget"===A.mode&&(a.style.overflow="hidden");var s=null!==(o=a.querySelector(T.sdkLoaderIframe))&&void 0!==o?o:document.createElement("iframe");s.id=T.sdkLoaderIframe.replace("#",""),s.style.position="absolute",s.style.border="none",s.style.width="100%",s.style.height="100%",s.style.top="0",s.style.right="0",s.style.bottom="0",s.style.left="0",s.style.colorScheme="auto";var d=a.querySelector(T.sdkIframe),u=null!=d?d:document.createElement("iframe"),g=setInterval(function(){var e;"complete"===(null===(e=u.contentDocument)||void 0===e?void 0:e.readyState)&&(clearInterval(g),f())},500);u.id=T.sdkIframe.replace("#",""),u.style.position="absolute",u.style.border="none",u.style.top="0",u.style.right="0",u.style.bottom="0",u.style.left="0",u.style.colorScheme="auto",d&&!A.networkErrorTimerId||(u.src=function(e){var n=e.path,t=e.supportViewConfig,o="https://".concat(A.domain,"/sdk"),i=new URLSearchParams;i.set("platform",k),i.set("token",t.token),i.set("deviceId",t.deviceId),i.set("domain",t.domain),i.set("mode",A.mode),i.set("origin",window.location.origin),i.set("userLanguage",A.userLanguage),A.disableInsets&&i.set("disableInsets","true");t.language&&i.set("language",t.language);ce()||i.set("unsupported","true");var r=me({supportViewConfig:t});return i.set("metadata",JSON.stringify(r)),"".concat(o).concat(n,"?").concat(i.toString())}({path:e.path,supportViewConfig:i}),u.style.width="0",u.style.height="0",r.appendChild(a),a.appendChild(s),a.appendChild(u),document.body.appendChild(r)),H({iframe:s,content:j({template:'<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n * {\n box-sizing: border-box;\n }\n\n html,\n body {\n background: rgb(CSS_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n padding-top: INSET_TOP_PLACEHOLDER;\n padding-bottom: INSET_BOTTOM_PLACEHOLDER;\n padding-left: INSET_LEFT_PLACEHOLDER;\n padding-right: INSET_RIGHT_PLACEHOLDER;\n }\n\n .top-bar {\n flex: 0 0 auto;\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: flex-end;\n }\n\n .loader-wrapper {\n flex: 1 0 0%;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: 12px;\n }\n\n .close-button {\n padding: 0.5rem 1rem;\n cursor: pointer;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 1.75rem;\n height: 1.75rem;\n }\n\n @keyframes spin {\n to {\n transform: rotate(360deg);\n }\n }\n\n .loader {\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 2rem;\n height: 2rem;\n animation: spin 1s linear infinite;\n transform-origin: center;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="wrapper">\n <div class="top-bar">\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"\n stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"\n class="lucide lucide-x-icon lucide-x">\n <path d="M18 6 6 18" />\n <path d="m6 6 12 12" />\n </svg>\n </div>\n </div>\n <div class="loader-wrapper">\n <svg class="loader" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg" fill="none" data-test-name="oval"\n role="img">\n <g fill="none" fill-rule="evenodd">\n <g transform="translate(1 1)" stroke-width="2">\n <circle stroke-opacity="0.5" cx="18" cy="18" r="18" />\n <path d="M36 18c0-9.94-8.06-18-18-18" />\n </g>\n </g>\n </svg>\n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeTheymesSdk() {\n parent.postMessage({ action: \'theymes.close\' }, \'*\');\n }\n\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeTheymesSdk);\n <\/script>\n</body>\n\n</html>'})});var p=!1,f=function(){p||(p=!0,A.networkErrorTimerId=setTimeout(function(){H({iframe:s,content:j({template:c})})},1e4))};u.onload=f,u.onerror=function(){H({iframe:s,content:j({template:c})})},ve(),l("open",[]),setTimeout(function(){a.style.opacity="1",a.style.transform=he({animation:"end"})},100)}}function pe(e){var n=e.path,t=e.config,o=null!=t?t:null;A.previousPath===n&&B(A.previousConfig,o)||(A.previousPath=n,A.previousConfig=o,fe())}function fe(){var e=document.querySelector(T.sdkDialog);A.sdkIsOpen?A.forceUpdateSdkDialog=!0:null==e||e.remove()}function me(e){var n=e.supportViewConfig,t={unsigned:{},signed:void 0};return n.player&&(t.unsigned.player=n.player),n.tags&&(t.unsigned.tags=n.tags),n.fields&&(t.unsigned.fields=n.fields),n.signedMetadataToken&&(t.signed=n.signedMetadataToken),t}function ve(){var e=document.querySelector(T.sdkDialog),n=document.querySelector(T.sdkIframeWrapper);if(e&&n)if("widget"===A.mode){var t=Y({type:"widget"}),o=K();e.style.width=o.width,e.style.height=o.height,e.style.maxWidth=o.maxWidth,e.style.maxHeight=o.maxHeight,e.style.bottom=t.bottom,e.style.right=t.right,e.style.left=t.left,e.style.top=t.top,G()?(n.style.border="none",n.style.borderRadius="0"):(n.style.border="1px solid rgb(".concat(F(A.colors.border),")"),n.style.borderRadius="10px")}else if(n.style.border="none",n.style.borderRadius="0",A.element){var i=A.element.getBoundingClientRect(),r=i.width,a=i.height,s=i.top,l=i.left,c=i.right,d=i.bottom;e.style.width="".concat(r,"px"),e.style.height="".concat(a,"px"),e.style.maxWidth="none",e.style.maxHeight="none",e.style.top="".concat(s,"px"),e.style.left="".concat(l,"px"),e.style.right="".concat(c,"px"),e.style.bottom="".concat(d,"px")}else{a=A.keyboardHeight>0?"calc(100% - ".concat(A.keyboardHeight,"px + env(safe-area-inset-bottom) - 10px)"):"100%";e.style.width="100%",e.style.height=a,e.style.maxWidth="none",e.style.maxHeight="none",e.style.top="0",e.style.left="0",e.style.right="0",e.style.bottom="0"}}function ye(){var e,n=null!==(e=document.querySelector(T.sdkButtonIframe))&&void 0!==e?e:document.createElement("iframe");if(n){var t,o=Y({type:"button"});n.id=T.sdkButtonIframe.replace("#",""),n.style.position="fixed",n.style.border="none",n.style.width="".concat(120,"px"),n.style.height="".concat(48,"px"),n.style.minWidth="".concat(120,"px"),n.style.maxWidth="95%",n.style.maxHeight="95%",n.style.bottom=o.bottom,n.style.right=o.right,n.style.left=o.left,n.style.top=o.top,n.style.margin="0",n.style.padding="0",n.style.zIndex="9997",n.style.backgroundColor="transparent",n.style.opacity="0",n.style.transform="scale(0.8)",n.style.transition="opacity ".concat(.2,"s ease-in-out, transform ").concat(.2,"s ease-in-out"),setTimeout(function(){n.style.opacity="1",n.style.transform="scale(1)"},100),document.body.appendChild(n),H({iframe:n,content:(t={unreadMessageCount:A.unreadMessageCount},j({template:"<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n <meta charset=\"utf-8\" />\n <meta name=\"viewport\"\n content=\"viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no\" />\n <meta name=\"theme-color\" content=\"#000000\" />\n <meta name=\"robots\" content=\"noindex\" />\n <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n @font-face {\n font-family: 'TheymesBody';\n src: CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER;\n font-weight: normal;\n font-style: normal;\n font-display: fallback;\n }\n\n * {\n box-sizing: border-box;\n }\n\n html,\n body {\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .sdk-button {\n display: flex;\n font-family: 'TheymesBody', CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER;\n background: rgb(CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n align-items: center;\n justify-content: center;\n color: rgb(CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER);\n font-size: 14px;\n font-weight: 700;\n cursor: pointer;\n text-align: center;\n padding: 0;\n border: none;\n outline: none;\n border-radius: 999px;\n box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);\n position: relative;\n white-space: nowrap; \n }\n\n .sdk-button-text {\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .sdk-button-badge {\n position: absolute;\n top: 0;\n right: 0;\n background: rgb(CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER);\n width: 12px;\n height: 12px;\n border-radius: 999px;\n display: none;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <button class=\"sdk-button\">\n <span class=\"sdk-button-text\">WIDGET_BUTTON_TEXT_PLACEHOLDER</span>\n <span class=\"sdk-button-badge\"></span>\n </button>\n <script NONCE_ATTR_PLACEHOLDER>\n let unreadMessageCount = UNREAD_MESSAGE_COUNT_PLACEHOLDER;\n\n function calculateButtonSize() {\n const paddingX = 12;\n const scrollWidth = document.querySelector('.sdk-button-text').scrollWidth;\n const width = scrollWidth + (paddingX * 2);\n \n parent.postMessage({ action: 'theymes.sdkButtonSizeUpdated', width }, '*');\n }\n\n function openWidget() {\n parent.postMessage({ action: 'theymes.sdkButtonClicked' }, '*');\n }\n\n function iframeSubscriber(e) {\n if (e.data.action === 'unreadMessageCountUpdate') {\n unreadMessageCount = e.data.count;\n updateUnreadMessageCount()\n } else if (e.data.action === 'widgetButtonTextUpdate') {\n document.querySelector('.sdk-button-text').innerHTML = e.data.text;\n calculateButtonSize();\n }\n }\n\n function updateUnreadMessageCount() {\n if (unreadMessageCount > 0) {\n document.querySelector('.sdk-button-badge').style.display = 'block';\n } else {\n document.querySelector('.sdk-button-badge').style.display = 'none';\n }\n }\n\n document.querySelector('.sdk-button').addEventListener('click', openWidget);\n window.addEventListener('message', iframeSubscriber, false);\n\n updateUnreadMessageCount();\n calculateButtonSize();\n <\/script>\n</body>\n\n</html>"}).replace(/UNREAD_MESSAGE_COUNT_PLACEHOLDER/g,"".concat(t.unreadMessageCount)).replace(/CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER/g,F(A.colors.widgetButtonBackground)).replace(/CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER/g,F(A.colors.widgetButtonText)).replace(/CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER/g,F(A.colors.widgetButtonActionPending)).replace(/WIDGET_BUTTON_TEXT_PLACEHOLDER/g,Ce()))})}}function he(e){return"start"===e.animation?"game"===A.mode?"translateY(20%)":"scale(0.8)":"game"===A.mode?"translateY(0)":"scale(1)"}function be(e){return t(this,void 0,void 0,function(){return o(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,7]),[4,e.json()];case 1:return[2,n.sent()];case 2:n.sent(),n.label=3;case 3:return n.trys.push([3,5,,6]),[4,e.text()];case 4:return[2,n.sent()];case 5:return n.sent(),[2,void 0];case 6:return[3,7];case 7:return[2]}})})}function we(){return t(this,void 0,void 0,function(){var e,n,t,i,r,a;return o(this,function(o){switch(o.label){case 0:if("never"===A.sendPlayerRetention)return[2];if("support-only"===A.sendPlayerRetention&&!A.hasSupportInteraction)return[2];if(ke(),A.retryRecordRetentionTimerId&&(clearTimeout(A.retryRecordRetentionTimerId),A.retryRecordRetentionTimerId=null),A.retentionRemainingSeconds=null,A.isRetentionRecordedForSession=!0,!(e=ue()))return[2];n="https://".concat(A.sdkApiDomain,"/api/retention"),t=me({supportViewConfig:e}),i={token:A.token,deviceId:A.deviceId,language:A.language,metadata:t},o.label=1;case 1:return o.trys.push([1,5,,6]),[4,fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})];case 2:return(r=o.sent()).ok?[3,4]:[4,be(r)];case 3:throw o.sent();case 4:return[3,6];case 5:return a=o.sent(),console.error("Error tracking retention:",a),A.retryRecordRetentionTimerId=setTimeout(we,6e4),[3,6];case 6:return[2]}})})}function Se(){var e=new Date;if(A.sessionStatus="active",A.sessionResumeOrStartTime=e,A.sessionStartTime){var n=A.sessionStartTime.valueOf()/1e3+A.resetSessionAfterSecs;Date.now()/1e3>n&&xe()}else xe();null!==A.retentionRemainingSeconds&&(A.recordRetentionTimerId=setTimeout(we,1e3*A.retentionRemainingSeconds))}function xe(){A.sessionStartTime=new Date,A.retentionRemainingSeconds=A.recordRetentionAfterSecs,A.isRetentionRecordedForSession=!1,ke()}function ke(){A.recordRetentionTimerId&&(clearTimeout(A.recordRetentionTimerId),A.recordRetentionTimerId=null)}function Te(){A.isRetentionRecordedForSession&&we()}function Ce(){var e;return function(e){var n=e.split(" ");if(e.length<=16||n.length<=1)return e;for(var t=n.map(function(e){return e.length}),o=[],r=1;r<t.length;r++){var a=t.slice(0,r),s=t.slice(r),l=a.reduce(function(e,n){return e+n},0),c=s.reduce(function(e,n){return e+n},0),d=Math.abs(l-c);o.push(d)}var u=Math.min.apply(Math,o),g=o.indexOf(u);return i(i(i([],n.slice(0,g+1),!0),["<br>"],!1),n.slice(g+1),!0).join(" ")}(null!==(e=function(e){var n,t,o,i,r,a=q(null!==(n=A.language)&&void 0!==n?n:"en"),s=null===(t=A.locs[e.loc])||void 0===t?void 0:t[a];if(s)return s;var l=a.split("-")[0];return l&&(null===(o=A.locs[e.loc])||void 0===o?void 0:o[l])||(null!==(r=null===(i=A.locs[e.loc])||void 0===i?void 0:i.en)&&void 0!==r?r:null)}({loc:"widgetButtonText"}))&&void 0!==e?e:"Support")}function Ee(){A.unreadMessageCount=0,A.unansweredMessageCount=0,l("unreadMessageCountUpdate",[0]),l("unansweredMessageCountUpdate",[0]),X({action:"unreadMessageCountUpdate",count:0})}function Oe(){var e,n,t,o=A.signedMetadataToken?function(e){var n,t;try{var o=e.split(".");if(o.length<2)return null;var i=o[1].replace(/-/g,"+").replace(/_/g,"/"),r=i.length%4,a=0===r?i:i+"=".repeat(4-r),s=atob(a),l=JSON.parse(s),c=null===(t=null===(n=null==l?void 0:l.metadata)||void 0===n?void 0:n.player)||void 0===t?void 0:t.id;return"string"==typeof c&&c.length>0?c:null}catch(e){return null}}(A.signedMetadataToken):null,i=null!==(n=null===(e=A.player)||void 0===e?void 0:e.id)&&void 0!==n?n:null;return null!==(t=null!=o?o:i)&&void 0!==t?t:null}function Ie(){var e=A.isLoggedIn,n=A.resolvedPlayerId,t=Oe(),o=Boolean(t),i=e&&o&&t!==n;A.resolvedPlayerId=t,A.isLoggedIn=o,i?(Ee(),te(),A.resolvedPlayerId=t,ne()):o&&!e?ne():!o&&e&&(Ee(),te())}try{document.addEventListener("visibilitychange",function(){var e=A.isInForeground,n="visible"===document.visibilityState;A.isInForeground=n,e!==n&&re(),n&&"paused"===A.sessionStatus?Se():n||"active"!==A.sessionStatus||function(){if(A.sessionResumeOrStartTime&&A.retentionRemainingSeconds){var e=Math.floor((Date.now()-A.sessionResumeOrStartTime.valueOf())/1e3);A.retentionRemainingSeconds-=e}A.sessionStatus="paused",ke()}()}),window.addEventListener("resize",ve),window.addEventListener("resize",Z),window.addEventListener("message",function(e){if("theymes.ready"===e.data.action){var n=document.querySelector(T.sdkLoaderIframe),t=document.querySelector(T.sdkIframe);A.networkErrorTimerId&&(clearTimeout(A.networkErrorTimerId),A.networkErrorTimerId=null),t&&(t.style.width="100%",t.style.height="100%"),n&&n.remove()}else if("theymes.close"===e.data.action)le();else if("theymes.closeNotification"===e.data.action)Q({notification:A.visibleNotification});else if("theymes.handleNotificationAction"===e.data.action)u={notification:A.visibleNotification},(null==(g=u.notification)?void 0:g.action)&&"OPEN_PAGE"===g.action.type&&(ge({path:g.action.path}),Q({notification:g}));else if("theymes.sdkButtonClicked"===e.data.action)(d=document.querySelector(T.sdkButtonIframe))&&(d.style.opacity="0",d.style.transform="scale(0.8)",setTimeout(function(){d.remove()},200)),"support"===A.widgetButtonAction?ae():"assistant"===A.widgetButtonAction&&se();else if("theymes.sdkButtonSizeUpdated"===e.data.action){var o=document.querySelector(T.sdkButtonIframe);o&&(o.style.width="".concat(e.data.width,"px"))}else if("theymes.openExternalPage"===e.data.action){var i=e.data.target;if("_self"===i){var r=R(S);null!==r&&function(e){var n=e.key,t=e.value,o=e.ttlMs,i=e.storage,r=void 0===i?P:i,a={value:t,expiry:Date.now()+o};r.setItem(n,JSON.stringify(a))}({key:r,value:e.data.path,ttlMs:6e5})}window.open(e.data.url,i)}else if("theymes.messageCountsChanged"===e.data.action){var a=e.data,s=a.unreadMessageCount,c=a.unansweredMessageCount;if("number"!=typeof s||"number"!=typeof c)return;c!==A.unansweredMessageCount&&(A.unansweredMessageCount=c,l("unansweredMessageCountUpdate",[c])),s!==A.unreadMessageCount&&(A.unreadMessageCount=s,l("unreadMessageCountUpdate",[s]),X({action:"unreadMessageCountUpdate",count:s}))}var d,u,g},!1),de("open",function(){A.sdkIsOpen=!0,oe()}),de("close",function(){A.sdkIsOpen=!1,ie()})}catch(e){console.error("Error adding event listeners to SDK",e)}var Pe=U("initialize",function(e,i,r){return t(void 0,void 0,void 0,function(){var t,a,s,l,c,h,b,T,C,I,_,N,D,B,H,F,j,U,q,W,J,z,Y;return o(this,function(o){switch(o.label){case 0:if(!e||!i||!r.mode)throw new Error("Token, domain, and mode are required");if("string"==typeof r.apiDomain&&""!==r.apiDomain.trim())t=r.apiDomain.trim();else{if((a=i.split(".")).length<2)throw new Error("Invalid domain");t=a[0]+".sdk."+a.slice(1).join(".")}A.token=e,A.domain=i,A.sdkApiDomain=t,A.mode=r.mode,A.element="element"in r&&void 0!==r.element?r.element:A.element,A.language=null!==(F=r.language)&&void 0!==F?F:A.language,A.nonce=null!==(j=r.nonce)&&void 0!==j?j:A.nonce,A.deviceId=function(){var e=L(f),n=E(e);if(n)return n;var t=E("deviceId");if(t)return O(e,t),t;var o=(i=Date.now(),"undefined"!=typeof performance&&"function"==typeof performance.now&&(i+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var n=(i+16*Math.random())%16|0;return i=Math.floor(i/16),("x"===e?n:3&n|8).toString(16)}));var i;return O(e,o),o}(),A.widgetButton="button"in r&&void 0!==r.button&&null!==(U=r.button)&&void 0!==U?U:A.widgetButton,A.widgetButtonAction="buttonAction"in r&&void 0!==r.buttonAction&&null!==(q=r.buttonAction)&&void 0!==q?q:A.widgetButtonAction,A.position="position"in r&&void 0!==r.position&&null!==(W=r.position)&&void 0!==W?W:A.position,A.x="x"in r&&void 0!==r.x?r.x:A.x,A.y="y"in r&&void 0!==r.y?r.y:A.y,A.disableInsets="game"===A.mode&&null!==A.element,M(),ee.eventPoller||(ee.eventPoller=new $),s=function(){Se(),fe();var e=R(S),n=null===e?null:function(e){var n=e.key,t=e.storage,o=void 0===t?P:t,i=o.getItem(n);if(!i)return null;var r=JSON.parse(i);return Date.now()>r.expiry?(o.removeItem(n),null):(o.removeItem(n),r.value)}({key:e});n&&"widget"===A.mode&&!G()?ge({path:n}):A.widgetButton&&ye()},o.label=1;case 1:return o.trys.push([1,6,,7]),l=Date.now()/1e3,c=R(y),h=null===c?null:E(c),b=null,h&&"number"==typeof(T=JSON.parse(h))&&T>0&&(b=T),null!=b&&(b>l+x&&(b=l+x,null!==c&&O(c,JSON.stringify(b))),l<b)?(s(),[2]):(C="https://".concat(t,"/api/settings"),I=new URLSearchParams({token:A.token,platform:k,mode:A.mode,sdkVersion:d}).toString(),[4,fetch("".concat(C,"?").concat(I),{method:"GET"})]);case 2:return(_=o.sent()).ok?[3,4]:[4,be(_)];case 3:throw o.sent();case 4:return[4,_.json()];case 5:return N=o.sent(),(null===(J=null==N?void 0:N.branding)||void 0===J?void 0:J.colors)&&function(e){A.colors=n(n({},A.colors),e);var t=R(u);null!==t&&O(t,JSON.stringify(A.colors))}(N.branding.colors),(null===(z=null==N?void 0:N.branding)||void 0===z?void 0:z.locs)&&function(e){A.locs=n(n({},A.locs),e);var t=R(g);null!==t&&O(t,JSON.stringify(A.locs))}(N.branding.locs),(null===(Y=null==N?void 0:N.branding)||void 0===Y?void 0:Y.fonts)&&function(e){A.fonts=n(n({},A.fonts),e);var t=R(p);null!==t&&O(t,JSON.stringify(A.fonts))}(N.branding.fonts),"number"!=typeof(null==N?void 0:N.recordRetentionAfterSecs)&&null!==(null==N?void 0:N.recordRetentionAfterSecs)||function(e){A.recordRetentionAfterSecs=e;var n=R(m);null!==n&&O(n,JSON.stringify(A.recordRetentionAfterSecs))}(N.recordRetentionAfterSecs),"number"!=typeof(null==N?void 0:N.resetSessionAfterSecs)&&null!==(null==N?void 0:N.resetSessionAfterSecs)||function(e){A.resetSessionAfterSecs=null!=e?e:28800;var n=R(v);null!==n&&O(n,JSON.stringify(A.resetSessionAfterSecs))}(N.resetSessionAfterSecs),"always"!==(null==N?void 0:N.sendPlayerRetention)&&"support-only"!==(null==N?void 0:N.sendPlayerRetention)&&"never"!==(null==N?void 0:N.sendPlayerRetention)||function(e){A.sendPlayerRetention=e;var n=R(w);null!==n&&O(n,A.sendPlayerRetention)}(N.sendPlayerRetention),"number"==typeof(null==N?void 0:N.settingsPollIntervalSecs)&&N.settingsPollIntervalSecs>0&&(D=l+N.settingsPollIntervalSecs,B=Math.min(D,l+x),null!==c&&O(c,JSON.stringify(B))),s(),[3,7];case 6:return H=o.sent(),console.error("Error initializing SDK:",H),[3,7];case 7:return[2]}})})},void 0),Le=U("openSupport",ae,void 0),Re=U("openAssistant",se,void 0),_e=U("openResource",function(e,n){var t="/resources/".concat(e);pe({path:t,config:n}),ge({path:t,config:n})},void 0),Ae=U("close",le,void 0),Ne=U("getLanguage",function(){return A.language},null),De=U("setLanguage",function(e){var n=A.language!==e;A.language=e,n&&(fe(),X({action:"widgetButtonTextUpdate",text:Ce()}))},void 0),Me=U("getSignedMetadataToken",function(){return A.signedMetadataToken},null),Be=U("setSignedMetadataToken",function(e){var n=A.signedMetadataToken!==e;A.signedMetadataToken=e,Ie(),n&&(fe(),Te())},void 0),He=U("getPlayer",function(){return A.player},null),Fe=U("setPlayer",function(e){var n,t=(null===(n=A.player)||void 0===n?void 0:n.id)!==(null==e?void 0:e.id);A.player=e,Ie(),t&&(fe(),Te())},void 0),je=U("getTags",function(){return Array.from(A.tags)},[]),Ue=U("setTags",function(e){A.tags=new Set(e),fe()},void 0),qe=U("addTag",function(e){A.tags.add(e),fe()},void 0),We=U("addTags",function(e){e.forEach(function(e){return A.tags.add(e)}),fe()},void 0),Je=U("removeTag",function(e){A.tags.delete(e),fe()},void 0),ze=U("removeTags",function(e){e.forEach(function(e){return A.tags.delete(e)}),fe()},void 0),Ge=U("removeAllTags",function(){A.tags.clear(),fe()},void 0),Ye=U("getFields",function(){return A.fields},{}),Ke=U("setFields",function(e){A.fields=e,fe()},void 0),Xe=U("addField",function(e,n){A.fields[e]=n,fe()},void 0),Ve=U("addFields",function(e){A.fields=n(n({},A.fields),e),fe()},void 0),Ze=U("removeField",function(e){delete A.fields[e],fe()},void 0),Qe=U("removeFields",function(e){e.forEach(function(e){return delete A.fields[e]}),fe()},void 0),$e=U("removeAllFields",function(){A.fields={},fe()},void 0),en=U("enableLogging",function(){A.loggingEnabled=!0},void 0),nn=U("disableLogging",function(){A.loggingEnabled=!1},void 0),tn=U("isYoungPlayer",function(){return A.youngPlayer},!1),on=U("setYoungPlayer",function(e){A.youngPlayer=e,fe()},void 0),rn=U("isPrivacyMode",function(){return A.privacyMode},!1),an=U("setPrivacyMode",function(e){A.privacyMode=e,fe()},void 0),sn=U("isSupported",ce,!1),ln=U("requestNotificationPermission",function(){},void 0),cn=U("enableNotifications",function(){A.notificationsPaused=!1,V()},void 0),dn=U("disableNotifications",function(){A.notificationsPaused=!0},void 0),un=U("getUnreadMessageCount",function(){return A.unreadMessageCount},0),gn=U("getUnansweredMessageCount",function(){return A.unansweredMessageCount},0),pn=U("getSdkVersion",function(){return d},""),fn=U("reset",function(){A.youngPlayer=!1,A.privacyMode=!1,A.language=null,A.tags=new Set,A.fields={},A.signedMetadataToken=null,A.player=null,Ie(),fe(),X({action:"widgetButtonTextUpdate",text:Ce()})},void 0),mn=U("recordRetention",function(){A.isRetentionRecordedForSession||we()},void 0),vn=U("addEventListener",de,void 0),yn=U("removeEventListener",function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];s.apply(void 0,e)},void 0),hn=U("iosSetKeyboardHeight",function(e){A.keyboardHeight=e,ve()},void 0);return e.addEventListener=vn,e.addField=Xe,e.addFields=Ve,e.addTag=qe,e.addTags=We,e.close=Ae,e.disableLogging=nn,e.disableNotifications=dn,e.enableLogging=en,e.enableNotifications=cn,e.getFields=Ye,e.getLanguage=Ne,e.getPlayer=He,e.getSdkVersion=pn,e.getSignedMetadataToken=Me,e.getTags=je,e.getUnansweredMessageCount=gn,e.getUnreadMessageCount=un,e.initialize=Pe,e.iosSetKeyboardHeight=hn,e.isPrivacyMode=rn,e.isSupported=sn,e.isYoungPlayer=tn,e.openAssistant=Re,e.openResource=_e,e.openSupport=Le,e.recordRetention=mn,e.removeAllFields=$e,e.removeAllTags=Ge,e.removeEventListener=yn,e.removeField=Ze,e.removeFields=Qe,e.removeTag=Je,e.removeTags=ze,e.requestNotificationPermission=ln,e.reset=fn,e.setFields=Ke,e.setLanguage=De,e.setPlayer=Fe,e.setPrivacyMode=an,e.setSignedMetadataToken=Be,e.setTags=Ue,e.setYoungPlayer=on,e}({});