@theymes/sdk 1.2.13 → 1.3.0
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/constants.d.ts +6 -1
- package/dist/eventPoller.d.ts +3 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +43 -43
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.unity.js +1 -1
- package/dist/internalEvents.d.ts +0 -1
- package/dist/internals.d.ts +9 -1
- package/dist/sdk.d.ts +2 -0
- package/dist/utils.d.ts +1 -1
- package/package.json +1 -1
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 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>',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="<!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>",u="1.2.13",g="colors",f="locs",p="fonts",m="recordRetentionAfterSecs",h="resetSessionAfterSecs",v="web",y={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",sdkStylesheet:"#theymes-sdk-stylesheet"},b=340,w=680,S=500,x=120,E=48,k=.2,T=.2,C=.2,O="theymes_path_on_init",L="url('https://fonts.gstatic.com/s/poppins/v22/pxiEyp8kv8JHgFVrJJfecnFHGPc.woff2') format('woff2')",I=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}},_=function(e,n){try{null===localStorage||void 0===localStorage||localStorage.setItem(e,n)}catch(e){}},R={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}}},P=28800,A=function(){var n=null,t=P,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=N();try{n=function(){var e=I(m);if(e){var n=JSON.parse(e);if("number"==typeof n)return n}return null}(),t=function(){var e=I(h);if(e){var n=JSON.parse(e);if("number"==typeof n)return n}return D()}(),o=function(){var n=I(g);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=I(f);if(n){var t=JSON.parse(n);return e(e({},{widgetButtonText:{}}),t)}return{widgetButtonText:{}}}(),r=function(){var n=I(p);if(n){var t=JSON.parse(n);return e(e({},N()),t)}return N()}()}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 N(){return{body:void 0}}function D(){return P}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 M(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,v).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,H(A.colors.text)).replace(/CSS_BORDER_PLACEHOLDER/g,H(A.colors.border)).replace(/CSS_BACKGROUND_PLACEHOLDER/g,H(A.colors.background)).replace(/CSS_TILE_PLACEHOLDER/g,H(A.colors.tile)).replace(/CSS_ACCENT_PLACEHOLDER/g,H(A.colors.accent)).replace(/CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER/g,H(A.colors.notificationBackground)).replace(/CSS_NOTIFICATION_TEXT_PLACEHOLDER/g,H(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:L).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,'"'):"")}var j=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}}},U=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],c=l&&(null===(o=A.locs[e.loc])||void 0===o?void 0:o[l]);return c||(null!==(r=null===(i=A.locs[e.loc])||void 0===i?void 0:i.en)&&void 0!==r?r:null)},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='<!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>',G=/(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,z=/CrOS/,J=/android|ipad|playbook|silk/i;function Y(){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=G.test(n)&&!z.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<S||window.innerHeight<S)}function K(e){var n=e.type,t=A.position,o=A.x,i=A.y;return Y()&&"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 X(){return Y()?{width:"100%",height:"100%",maxWidth:"none",maxHeight:"none"}:{width:"".concat(b,"px"),height:"".concat(w,"px"),maxWidth:"none",maxHeight:"calc(100vh - ".concat(2*A.y,"px)")}}function V(e){var n=document.querySelector(y.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 Z(){var e,n,t=A.notifications[0];if(t&&!A.visibleNotification){A.visibleNotification=t;var o=null!==(e=document.querySelector(y.notificationDialog))&&void 0!==e?e:document.createElement("div");o.id=y.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(y.notificationIframe))&&void 0!==n?n:document.createElement("iframe");r.id=y.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(C,"s ease-in-out, margin-top ").concat(C,"s ease-in-out"),o.appendChild(r),M({iframe:r,content:(i={text:t.text},F({template:W}).replace(/NOTIFICATION_TEXT_PLACEHOLDER/g,i.text))}),setTimeout((function(){r.style.opacity="1",r.style.marginTop="0px",Q()}),500),t.closeAfterSeconds>0&&setTimeout((function(){$({notification:t})}),1e3*t.closeAfterSeconds)}}function Q(){var e,n,t,o=document.querySelector(y.notificationDialog),i=document.querySelector(y.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=K({type:"widget"}),s=X(),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 $(e){if(e.notification&&A.visibleNotification===e.notification){var n=document.querySelector(y.notificationIframe),t=document.querySelector(y.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,Z()}),1e3*C))}}var ee=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(){A.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(e){this.isRunning=!0;var n=new Date;if(this.nextPollDate&&!e||(this.nextPollDate=new Date(n.getTime()+1e3)),n>=this.nextPollDate)this.pollEventsRequest();else{var t=(this.nextPollDate.getTime()-n.getTime())/1e3;this.scheduleNextPollEventsRequest(t)}}}),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 A.isLoggedIn&&A.isInForeground&&A.hasNetworkConnectivity&&!A.sdkIsOpen}}),Object.defineProperty(i.prototype,"resumeIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){!this.shouldBeRunning()||this.isRunning&&!e||this.resume(e)}}),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(!A.token||!A.domain||!A.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=A.notificationsPaused||A.sdkIsOpen?"true":"false",a=new URLSearchParams(e(e({token:A.token,language:null!==(u=A.language)&&void 0!==u?u:"en",deviceId:A.deviceId,notificationsPaused:r,mode:A.mode},(null===(g=A.player)||void 0===g?void 0:g.id)?{unsignedPlayerId:A.player.id}:{}),A.signedMetadataToken?{signedMetadataToken:A.signedMetadataToken}:{})).toString(),t.label=1;case 1:return t.trys.push([1,4,,5]),[4,fetch("https://".concat(A.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),A.notifications=o(o([],A.notifications,!0),c.notifications,!0),A.notifications.length>0&&Z(),c.unansweredMessageCount!==A.unansweredMessageCount&&(A.unansweredMessageCount=c.unansweredMessageCount,s("unansweredMessageCountUpdate",[c.unansweredMessageCount])),c.unreadMessageCount!==A.unreadMessageCount&&(A.unreadMessageCount=c.unreadMessageCount,s("unreadMessageCountUpdate",[c.unreadMessageCount]),V({action:"unreadMessageCountUpdate",count:c.unreadMessageCount})),[3,5];case 4:return d=t.sent(),console.error("Error fetching events:",d),this.scheduleNextPollEventsRequest(A.retryIntervalSecs),[3,5];case 5:return[2]}}))}))}}),i}(),ne={eventPoller:null},te=function(){var e;null===(e=ne.eventPoller)||void 0===e||e.onLogin()},oe=function(){var e;null===(e=ne.eventPoller)||void 0===e||e.onLogout()},ie=function(){var e;null===(e=ne.eventPoller)||void 0===e||e.onOpen()},re=function(){var e;null===(e=ne.eventPoller)||void 0===e||e.onClose()},ae=function(){var e;null===(e=ne.eventPoller)||void 0===e||e.onEnableNotifications()},se=function(){var e;null===(e=ne.eventPoller)||void 0===e||e.onIsInForegroundChanged()},le=function(e){var n="/help-center";me({path:n,config:e}),pe({path:n,config:e})},ce=function(e){var n="/assistant";me({path:n,config:e}),pe({path:n,config:e})},de=function(){!function(){var e=document.querySelector(y.sdkDialog),n=document.querySelector(y.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=we({animation:"start"}),setTimeout((function(){t()}),1e3*k)):t()}A.widgetButton&&be();s("close",[])}()},ue=function(){try{return CSS.supports("color","var(--color)")&&CSS.supports("color","rgb(255 255 255 / 0.5)")}catch(e){return!1}},ge=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];r.apply(void 0,e)};function fe(n){var t,i,r,a,s,l,c=(null!=n?n:{}).config;if(!A.token||!A.domain||!A.deviceId)return null;var d=null!==(t=null==c?void 0:c.tags)&&void 0!==t?t:[],g=null!==(i=null==c?void 0:c.fields)&&void 0!==i?i:{},f=null!==(a=null!==(r=null==c?void 0:c.language)&&void 0!==r?r:A.language)&&void 0!==a?a:null,p=null!==(s=A.signedMetadataToken)&&void 0!==s?s:null,m=null!==(l=A.player)&&void 0!==l?l:null,h={_platform:v,_sdkVersion:u};A.youngPlayer&&(h._youngPlayer=!0),(A.privacyMode||A.youngPlayer)&&(h._privacyMode=!0);var y=o(o([],Array.from(A.tags),!0),d,!0),b=e(e(e({},A.fields),g),h);return{token:A.token,domain:A.domain,deviceId:A.deviceId,tags:y,fields:b,language:f,signedMetadataToken:p,player:m}}function pe(e){var n,t,o,i=fe({config:e.config});if(i){var r=null!==(n=document.querySelector(y.sdkDialog))&&void 0!==n?n:document.createElement("div");r.id=y.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(y.sdkIframeWrapper))&&void 0!==t?t:document.createElement("div");a.id=y.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(A.colors.background),")"),a.style.transform=we({animation:"start"}),a.style.transition=(A.mode,"opacity ".concat(k,"s ease-in-out, transform ").concat(k,"s ease-in-out")),"widget"===A.mode&&(a.style.overflow="hidden");var d=null!==(o=a.querySelector(y.sdkLoaderIframe))&&void 0!==o?o:document.createElement("iframe");d.id=y.sdkLoaderIframe.replace("#",""),d.style.position="absolute",d.style.border="none",d.style.width="100%",d.style.height="100%",d.style.top="0",d.style.right="0",d.style.bottom="0",d.style.left="0",d.style.colorScheme="auto";var u=a.querySelector(y.sdkIframe),g=null!=u?u:document.createElement("iframe"),f=setInterval((function(){var e;"complete"===(null===(e=g.contentDocument)||void 0===e?void 0:e.readyState)&&(clearInterval(f),m())}),500);g.id=y.sdkIframe.replace("#",""),g.style.position="absolute",g.style.border="none",g.style.top="0",g.style.right="0",g.style.bottom="0",g.style.left="0",g.style.colorScheme="auto",u&&!A.networkErrorTimerId||(g.src=function(e){var n=e.path,t=e.supportViewConfig,o="https://".concat(A.domain,"/sdk"),i=new URLSearchParams;i.set("platform",v),i.set("token",t.token),i.set("deviceId",t.deviceId),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);ue()||i.set("unsupported","true");var r=ve({supportViewConfig:t});return i.set("metadata",JSON.stringify(r)),"".concat(o).concat(n,"?").concat(i.toString())}({path:e.path,supportViewConfig:i}),g.style.width="0",g.style.height="0",r.appendChild(a),a.appendChild(d),a.appendChild(g),document.body.appendChild(r)),M({iframe:d,content:F({template:l})});var p=!1,m=function(){p||(p=!0,A.networkErrorTimerId=setTimeout((function(){M({iframe:d,content:F({template:c})})}),1e4))};g.onload=m,g.onerror=function(){M({iframe:d,content:F({template:c})})},ye(),s("open",[]),setTimeout((function(){a.style.opacity="1",a.style.transform=we({animation:"end"})}),100)}}function me(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,he())}function he(){var e=document.querySelector(y.sdkDialog);A.sdkIsOpen?A.forceUpdateSdkDialog=!0:null==e||e.remove()}function ve(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 ye(){var e=document.querySelector(y.sdkDialog),n=document.querySelector(y.sdkIframeWrapper);if(e&&n)if("widget"===A.mode){var t=K({type:"widget"}),o=X();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,Y()?(n.style.border="none",n.style.borderRadius="0"):(n.style.border="1px solid rgb(".concat(H(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 be(){var e,n=null!==(e=document.querySelector(y.sdkButtonIframe))&&void 0!==e?e:document.createElement("iframe");if(n){var t,o=K({type:"button"});n.id=y.sdkButtonIframe.replace("#",""),n.style.position="fixed",n.style.border="none",n.style.width="".concat(x,"px"),n.style.height="".concat(E,"px"),n.style.minWidth="".concat(x,"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(T,"s ease-in-out, transform ").concat(T,"s ease-in-out"),setTimeout((function(){n.style.opacity="1",n.style.transform="scale(1)"}),100),document.body.appendChild(n),M({iframe:n,content:(t={unreadMessageCount:A.unreadMessageCount},F({template:d}).replace(/UNREAD_MESSAGE_COUNT_PLACEHOLDER/g,"".concat(t.unreadMessageCount)).replace(/CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER/g,H(A.colors.widgetButtonBackground)).replace(/CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER/g,H(A.colors.widgetButtonText)).replace(/CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER/g,H(A.colors.widgetButtonActionPending)).replace(/WIDGET_BUTTON_TEXT_PLACEHOLDER/g,Oe()))})}}function we(e){return"start"===e.animation?"game"===A.mode?"translateY(20%)":"scale(0.8)":"game"===A.mode?"translateY(0)":"scale(1)"}function Se(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 xe(){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(Te(),A.retryRecordRetentionTimerId&&(clearTimeout(A.retryRecordRetentionTimerId),A.retryRecordRetentionTimerId=null),A.retentionRemainingSeconds=null,A.isRetentionRecordedForSession=!0,!(e=fe()))return[2];n="https://".concat(A.domain,"/api/sdk/retention"),o=ve({supportViewConfig:e}),i={token:A.token,deviceId:A.deviceId,language:A.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,Se(r)];case 3:throw t.sent();case 4:return[3,6];case 5:return a=t.sent(),console.error("Error tracking retention:",a),A.retryRecordRetentionTimerId=setTimeout(xe,6e4),[3,6];case 6:return[2]}}))}))}function Ee(){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&&ke()}else ke();null!==A.retentionRemainingSeconds&&(A.recordRetentionTimerId=setTimeout(xe,1e3*A.retentionRemainingSeconds))}function ke(){A.sessionStartTime=new Date,A.retentionRemainingSeconds=A.recordRetentionAfterSecs,A.isRetentionRecordedForSession=!1,Te()}function Te(){A.recordRetentionTimerId&&(clearTimeout(A.recordRetentionTimerId),A.recordRetentionTimerId=null)}function Ce(){A.isRetentionRecordedForSession&&xe()}function Oe(){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=U({loc:"widgetButtonText"}))&&void 0!==e?e:"Support")}function Le(){var e=A.isInForeground,n="visible"===document.visibilityState&&document.hasFocus();A.isInForeground=n,e!==n&&se(),n&&"paused"===A.sessionStatus?Ee():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",Te()}()}function Ie(){var e,n=A.isLoggedIn,t=Boolean(A.signedMetadataToken||(null===(e=A.player)||void 0===e?void 0:e.id));A.isLoggedIn=t,t&&!n?te():!t&&n&&oe()}try{document.addEventListener("visibilitychange",Le),window.addEventListener("focus",Le),window.addEventListener("blur",Le),window.addEventListener("resize",ye),window.addEventListener("resize",Q),window.addEventListener("message",(function(e){if("theymes.ready"===e.data.action){var n=document.querySelector(y.sdkLoaderIframe),t=document.querySelector(y.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)de();else if("theymes.closeNotification"===e.data.action)$({notification:A.visibleNotification});else if("theymes.handleNotificationAction"===e.data.action)a={notification:A.visibleNotification},(null==(s=a.notification)?void 0:s.action)&&"OPEN_PAGE"===s.action.type&&(pe({path:s.action.path}),$({notification:s}));else if("theymes.sdkButtonClicked"===e.data.action)(r=document.querySelector(y.sdkButtonIframe))&&(r.style.opacity="0",r.style.transform="scale(0.8)",setTimeout((function(){r.remove()}),1e3*T)),"support"===A.widgetButtonAction?le():"assistant"===A.widgetButtonAction&&ce();else if("theymes.sdkButtonSizeUpdated"===e.data.action){var o=document.querySelector(y.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?R:i,a={value:t,expiry:Date.now()+o};r.setItem(n,JSON.stringify(a))}({key:O,value:e.data.path,ttlMs:6e5}),window.open(e.data.url,i)}var r,a,s}),!1),ge("open",(function(){A.sdkIsOpen=!0,ie()})),ge("close",(function(){A.sdkIsOpen=!1,re()}))}catch(e){console.error("Error adding event listeners to SDK",e)}var _e=j("initialize",(function(o,i,r){return n(void 0,void 0,void 0,(function(){var n,a,s,l,c,d,u,y,b,w,S,x,E,k;return t(this,(function(t){switch(t.label){case 0:if(!o||!i||!r.mode)throw new Error("Token, domain, and mode are required");A.token=o,A.domain=i,A.mode=r.mode,A.element="element"in r&&void 0!==r.element?r.element:A.element,A.language=null!==(u=r.language)&&void 0!==u?u:A.language,A.nonce=null!==(y=r.nonce)&&void 0!==y?y:A.nonce,A.deviceId=function(){var e=I("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 _("deviceId",n),n;var t}(),A.widgetButton="button"in r&&void 0!==r.button&&null!==(b=r.button)&&void 0!==b?b:A.widgetButton,A.widgetButtonAction="buttonAction"in r&&void 0!==r.buttonAction&&null!==(w=r.buttonAction)&&void 0!==w?w:A.widgetButtonAction,A.position="position"in r&&void 0!==r.position&&null!==(S=r.position)&&void 0!==S?S: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,ne.eventPoller||(ne.eventPoller=new ee),n="https://".concat(i,"/api/sdk/settings"),a=new URLSearchParams({token:A.token,platform:v,mode:A.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,Se(s)];case 3:throw t.sent();case 4:return[4,s.json()];case 5:return l=t.sent(),(null===(x=null==l?void 0:l.branding)||void 0===x?void 0:x.colors)&&(N=l.branding.colors,A.colors=e(e({},A.colors),N),_(g,JSON.stringify(A.colors))),(null===(E=null==l?void 0:l.branding)||void 0===E?void 0:E.locs)&&(P=l.branding.locs,A.locs=e(e({},A.locs),P),_(f,JSON.stringify(A.locs))),(null===(k=null==l?void 0:l.branding)||void 0===k?void 0:k.fonts)&&(L=l.branding.fonts,A.fonts=e(e({},A.fonts),L),_(p,JSON.stringify(A.fonts))),"number"!=typeof(null==l?void 0:l.recordRetentionAfterSecs)&&null!==(null==l?void 0:l.recordRetentionAfterSecs)||(C=l.recordRetentionAfterSecs,A.recordRetentionAfterSecs=C,_(m,JSON.stringify(A.recordRetentionAfterSecs))),"number"!=typeof(null==l?void 0:l.resetSessionAfterSecs)&&null!==(null==l?void 0:l.resetSessionAfterSecs)||(T=l.resetSessionAfterSecs,A.resetSessionAfterSecs=null!=T?T:D(),_(h,JSON.stringify(A.resetSessionAfterSecs))),Ee(),he(),c=function(e){var n=e.key,t=e.storage,o=void 0===t?R:t,i=e.removeItem,r=void 0!==i&&i,a=o.getItem(n);if(!a)return null;var s=JSON.parse(a);return Date.now()>s.expiry?(o.removeItem(n),null):(r&&o.removeItem(n),s.value)}({key:O,removeItem:!0}),c&&"widget"===A.mode&&!Y()?pe({path:c}):A.widgetButton&&be(),[3,7];case 6:return d=t.sent(),console.error("Error initializing SDK:",d),[3,7];case 7:return[2]}var T,C,L,P,N}))}))}),void 0),Re=j("openSupport",le,void 0),Pe=j("openAssistant",ce,void 0),Ae=j("openResource",(function(e,n){var t="/resources/".concat(e);me({path:t,config:n}),pe({path:t,config:n})}),void 0),Ne=j("close",de,void 0),De=j("getLanguage",(function(){return A.language}),null),Be=j("setLanguage",(function(e){var n=A.language!==e;A.language=e,n&&(he(),V({action:"widgetButtonTextUpdate",text:Oe()}))}),void 0),Me=j("getSignedMetadataToken",(function(){return A.signedMetadataToken}),null),He=j("setSignedMetadataToken",(function(e){var n=A.signedMetadataToken!==e;A.signedMetadataToken=e,Ie(),n&&(he(),Ce())}),void 0),Fe=j("getPlayer",(function(){return A.player}),null),je=j("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&&(he(),Ce())}),void 0),Ue=j("getTags",(function(){return Array.from(A.tags)}),[]),qe=j("setTags",(function(e){A.tags=new Set(e),he()}),void 0),We=j("addTag",(function(e){A.tags.add(e),he()}),void 0),Ge=j("addTags",(function(e){e.forEach((function(e){return A.tags.add(e)})),he()}),void 0),ze=j("removeTag",(function(e){A.tags.delete(e),he()}),void 0),Je=j("removeTags",(function(e){e.forEach((function(e){return A.tags.delete(e)})),he()}),void 0),Ye=j("removeAllTags",(function(){A.tags.clear(),he()}),void 0),Ke=j("getFields",(function(){return A.fields}),{}),Xe=j("setFields",(function(e){A.fields=e,he()}),void 0),Ve=j("addField",(function(e,n){A.fields[e]=n,he()}),void 0),Ze=j("addFields",(function(n){A.fields=e(e({},A.fields),n),he()}),void 0),Qe=j("removeField",(function(e){delete A.fields[e],he()}),void 0),$e=j("removeFields",(function(e){e.forEach((function(e){return delete A.fields[e]})),he()}),void 0),en=j("removeAllFields",(function(){A.fields={},he()}),void 0),nn=j("enableLogging",(function(){A.loggingEnabled=!0}),void 0),tn=j("disableLogging",(function(){A.loggingEnabled=!1}),void 0),on=j("isYoungPlayer",(function(){return A.youngPlayer}),!1),rn=j("setYoungPlayer",(function(e){A.youngPlayer=e,he()}),void 0),an=j("isPrivacyMode",(function(){return A.privacyMode}),!1),sn=j("setPrivacyMode",(function(e){A.privacyMode=e,he()}),void 0),ln=j("isSupported",ue,!1),cn=j("requestNotificationPermission",(function(){}),void 0),dn=j("enableNotifications",(function(){A.notificationsPaused=!1,ae()}),void 0),un=j("disableNotifications",(function(){A.notificationsPaused=!0}),void 0),gn=j("getUnreadMessageCount",(function(){return A.unreadMessageCount}),0),fn=j("getUnansweredMessageCount",(function(){return A.unansweredMessageCount}),0),pn=j("getSdkVersion",(function(){return u}),""),mn=j("reset",(function(){A.language=null,A.tags=new Set,A.fields={},A.signedMetadataToken=null,A.player=null,Ie(),he(),V({action:"widgetButtonTextUpdate",text:Oe()})}),void 0),hn=j("recordRetention",(function(){A.isRetentionRecordedForSession||xe()}),void 0),vn=j("addEventListener",ge,void 0),yn=j("removeEventListener",(function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];a.apply(void 0,e)}),void 0),bn=j("iosSetKeyboardHeight",(function(e){A.keyboardHeight=e,ye()}),void 0);export{vn as addEventListener,Ve as addField,Ze as addFields,We as addTag,Ge as addTags,Ne as close,tn as disableLogging,un as disableNotifications,nn as enableLogging,dn as enableNotifications,Ke as getFields,De as getLanguage,Fe as getPlayer,pn as getSdkVersion,Me as getSignedMetadataToken,Ue as getTags,fn as getUnansweredMessageCount,gn as getUnreadMessageCount,_e as initialize,bn as iosSetKeyboardHeight,an as isPrivacyMode,ln as isSupported,on as isYoungPlayer,Pe as openAssistant,Ae as openResource,Re as openSupport,hn as recordRetention,en as removeAllFields,Ye as removeAllTags,yn as removeEventListener,Qe as removeField,$e as removeFields,ze as removeTag,Je as removeTags,cn as requestNotificationPermission,mn as reset,Xe as setFields,Be as setLanguage,je as setPlayer,sn as setPrivacyMode,He as setSignedMetadataToken,qe as setTags,rn 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.0",d="colors",u="locs",g="fonts",p="recordRetentionAfterSecs",f="resetSessionAfterSecs",m="settingsNextPollAt",v="eventPollerNextPollAt",h="hasSupportInteraction",y="sendPlayerRetention",b=2419200,w="web",S={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"},x=.2,E="theymes_path_on_init",k=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}},C=function(e,n){try{null===localStorage||void 0===localStorage||localStorage.setItem(e,n)}catch(e){}},T=function(e){try{null===localStorage||void 0===localStorage||localStorage.removeItem(e)}catch(e){}},O={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 I(e){return null===P.resolvedPlayerId||void 0===P.resolvedPlayerId?null:"".concat(e,".").concat(P.resolvedPlayerId)}var P=function(){var n=null,t=28800,o="support-only",i=!1,r={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={widgetButtonText:{}},s=L();try{n=function(){var e=k(p);if(e){var n=JSON.parse(e);if("number"==typeof n)return n}return null}(),t=function(){var e=k(f);if(e){var n=JSON.parse(e);if("number"==typeof n)return n}return _()}(),o=function(){var e=k(y);if(e&&R.includes(e))return e;return"support-only"}(),i=!1,r=function(){var n=k(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}}}(),a=function(){var n=k(u);if(n){var t=JSON.parse(n);return e(e({},{widgetButtonText:{}}),t)}return{widgetButtonText:{}}}(),s=function(){var n=k(g);if(n){var t=JSON.parse(n);return e(e({},L()),t)}return L()}()}catch(e){console.error("Error initializing internals",e)}return{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:n,resetSessionAfterSecs:t,sessionStatus:"waiting",sessionStartTime:null,sessionResumeOrStartTime:null,retentionRemainingSeconds:null,isRetentionRecordedForSession:!1,recordRetentionTimerId:null,retryRecordRetentionTimerId:null,networkErrorTimerId:null,sendPlayerRetention:o,hasSupportInteraction:i,resolvedPlayerId:null,colors:r,locs:a,fonts:s,notificationsPaused:!0,notifications:[],visibleNotification:null,unreadMessageCount:0,unansweredMessageCount:0,previousPath:null,previousConfig:null,nonce:null,keyboardHeight:0,disableInsets:!1}}();function L(){return{body:void 0}}function _(){return 28800}var R=["always","support-only","never"];var A=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 A(o,n[t])}))};function D(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 N(e){return"".concat(e.r,", ").concat(e.g,", ").concat(e.b)}function M(e){var n,t,o,i;return e.template.replace(/PLATFORM_PLACEHOLDER/g,w).replace(/INSET_TOP_PLACEHOLDER/g,P.disableInsets?"0px":"env(safe-area-inset-top, 0px)").replace(/INSET_BOTTOM_PLACEHOLDER/g,P.disableInsets?"0px":"env(safe-area-inset-bottom, 0px)").replace(/INSET_LEFT_PLACEHOLDER/g,P.disableInsets?"0px":"env(safe-area-inset-left, 0px)").replace(/INSET_RIGHT_PLACEHOLDER/g,P.disableInsets?"0px":"env(safe-area-inset-right, 0px)").replace(/CSS_TEXT_PLACEHOLDER/g,N(P.colors.text)).replace(/CSS_BORDER_PLACEHOLDER/g,N(P.colors.border)).replace(/CSS_BACKGROUND_PLACEHOLDER/g,N(P.colors.background)).replace(/CSS_TILE_PLACEHOLDER/g,N(P.colors.tile)).replace(/CSS_ACCENT_PLACEHOLDER/g,N(P.colors.accent)).replace(/CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER/g,N(P.colors.notificationBackground)).replace(/CSS_NOTIFICATION_TEXT_PLACEHOLDER/g,N(P.colors.notificationText)).replace(/CSS_FONT_SIZE_PLACEHOLDER/g,"game"===P.mode?"16px":"14px").replace(/CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER/g,null!==(t=null===(n=P.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=P.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,P.nonce?'nonce="'.concat(P.nonce,'"'):"")}function B(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 H=function(e){var n=e.split(/[-_]/),t=n[0],o=n[1];return t?o?"".concat(t.toLowerCase(),"-").concat(o.toUpperCase()):t.toLowerCase():"en"},F=/(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/,U=/android|ipad|playbook|silk/i;function q(){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=F.test(n)&&!j.test(n)||!!e.tablet&&U.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 W(e){var n=e.type,t=P.position,o=P.x,i=P.y;return q()&&"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 J(){return q()?{width:"100%",height:"100%",maxWidth:"none",maxHeight:"none"}:{width:"".concat(340,"px"),height:"".concat(680,"px"),maxWidth:"none",maxHeight:"calc(100vh - ".concat(2*P.y,"px)")}}function z(e){var n=document.querySelector(S.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 G(){var e,n;if(!P.notificationsPaused){var t=P.notifications[0];if(t&&!P.visibleNotification){P.visibleNotification=t;var o=null!==(e=document.querySelector(S.notificationDialog))&&void 0!==e?e:document.createElement("div");o.id=S.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(S.notificationIframe))&&void 0!==n?n:document.createElement("iframe");r.id=S.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),D({iframe:r,content:(i={text:t.text},M({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",Y()},500),t.closeAfterSeconds>0&&setTimeout(function(){K({notification:t})},1e3*t.closeAfterSeconds)}}}function Y(){var e,n,t,o=document.querySelector(S.notificationDialog),i=document.querySelector(S.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"===P.mode){var a=W({type:"widget"}),s=J(),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(P.element){var c=P.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=P.disableInsets?"0px":"env(safe-area-inset-top, 0px)",o.style.left=P.disableInsets?"0px":"env(safe-area-inset-left, 0px)",o.style.right=P.disableInsets?"0px":"env(safe-area-inset-right, 0px)",o.style.bottom=P.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 K(e){if(e.notification&&P.visibleNotification===e.notification){var n=document.querySelector(S.notificationIframe),t=document.querySelector(S.notificationDialog);n&&(n.style.opacity="0",n.style.marginTop="-20px",setTimeout(function(){null==t||t.remove(),P.notifications=P.notifications.slice(1),P.visibleNotification=null,G()},200))}}var X=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=I(v);if(null!==e&&!P.hasSupportInteraction){var n=k(e);if(n){var t=JSON.parse(n);if("number"==typeof t&&t>0){var o=Date.now()/1e3,i=t;i>o+b&&(i=o+b,C(e,JSON.stringify(i))),i>o&&(this.nextPollDate=new Date(1e3*i),P.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(){P.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 P.isLoggedIn&&P.isInForeground&&P.hasNetworkConnectivity&&!P.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=I(v),n=I(h),null!==e&&T(e),null!==n&&T(n),P.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=I(v);if(null!==i){var r=o/1e3,a=r+e,s=Math.min(a,r+b);C(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(!P.token||!P.sdkApiDomain||!P.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=I(v))&&T(i),r={token:P.token,deviceId:P.deviceId,language:null!==(g=P.language)&&void 0!==g?g:null,userLanguage:P.userLanguage,mode:P.mode,sdkVersion:c},(null===(p=P.player)||void 0===p?void 0:p.id)&&(r.unsignedPlayerId=P.player.id),P.signedMetadataToken&&(r.signedMetadataToken=P.signedMetadataToken),t.label=1;case 1:return t.trys.push([1,4,,5]),[4,fetch("https://".concat(P.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){P.hasSupportInteraction=e;var n=I(h);null!==n&&C(n,String(P.hasSupportInteraction))}(l.hasSupportInteraction),this.scheduleNextPollEventsRequest(l.nextPollSeconds,!l.hasSupportInteraction),P.notifications=o(o([],P.notifications,!0),l.notifications,!0),!P.notificationsPaused&&!P.sdkIsOpen&&P.notifications.length>0&&G(),l.unansweredMessageCount!==P.unansweredMessageCount&&(P.unansweredMessageCount=l.unansweredMessageCount,s("unansweredMessageCountUpdate",[l.unansweredMessageCount])),l.unreadMessageCount!==P.unreadMessageCount&&(P.unreadMessageCount=l.unreadMessageCount,s("unreadMessageCountUpdate",[l.unreadMessageCount]),z({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}(),V={eventPoller:null},Z=function(){var e;!function(){var e=I(h);if(null!==e){var n=k(e);P.hasSupportInteraction="true"===n}}(),null===(e=V.eventPoller)||void 0===e||e.onLogin()},Q=function(){var e;null===(e=V.eventPoller)||void 0===e||e.onLogout()},$=function(){var e;null===(e=V.eventPoller)||void 0===e||e.onOpen()},ee=function(){var e;null===(e=V.eventPoller)||void 0===e||e.onClose()},ne=function(){var e;null===(e=V.eventPoller)||void 0===e||e.onIsInForegroundChanged()},te=function(e){var n="/help-center";ce({path:n,config:e}),le({path:n,config:e})},oe=function(e){var n="/assistant";ce({path:n,config:e}),le({path:n,config:e})},ie=function(){!function(){var e=document.querySelector(S.sdkDialog),n=document.querySelector(S.sdkIframeWrapper);if(e){var t=function(){"widget"!==P.mode||P.forceUpdateSdkDialog?e.remove():e.style.display="none",P.forceUpdateSdkDialog=!1};n?(n.style.opacity="0",n.style.transform=fe({animation:"start"}),setTimeout(function(){t()},200)):t()}P.widgetButton&&pe();s("close",[])}()},re=function(){try{return CSS.supports("color","var(--color)")&&CSS.supports("color","rgb(255 255 255 / 0.5)")}catch(e){return!1}},ae=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];r.apply(void 0,e)};function se(n){var t,i,r,a,s,l,d=(null!=n?n:{}).config;if(!P.token||!P.domain||!P.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:P.language)&&void 0!==a?a:null,f=null!==(s=P.signedMetadataToken)&&void 0!==s?s:null,m=null!==(l=P.player)&&void 0!==l?l:null,v={_platform:w,_sdkVersion:c};P.youngPlayer&&(v._youngPlayer=!0),(P.privacyMode||P.youngPlayer)&&(v._privacyMode=!0);var h=o(o([],Array.from(P.tags),!0),u,!0),y=e(e(e({},P.fields),g),v);return{token:P.token,domain:P.domain,deviceId:P.deviceId,tags:h,fields:y,language:p,signedMetadataToken:f,player:m}}function le(e){var n,t,o,i=se({config:e.config});if(i){var r=null!==(n=document.querySelector(S.sdkDialog))&&void 0!==n?n:document.createElement("div");r.id=S.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(S.sdkIframeWrapper))&&void 0!==t?t:document.createElement("div");a.id=S.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(N(P.colors.background),")"),a.style.transform=fe({animation:"start"}),a.style.transition=(P.mode,"opacity ".concat(x,"s ease-in-out, transform ").concat(x,"s ease-in-out")),"widget"===P.mode&&(a.style.overflow="hidden");var c=null!==(o=a.querySelector(S.sdkLoaderIframe))&&void 0!==o?o:document.createElement("iframe");c.id=S.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(S.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=S.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&&!P.networkErrorTimerId||(u.src=function(e){var n=e.path,t=e.supportViewConfig,o="https://".concat(P.domain,"/sdk"),i=new URLSearchParams;i.set("platform",w),i.set("token",t.token),i.set("deviceId",t.deviceId),i.set("domain",t.domain),i.set("mode",P.mode),i.set("origin",window.location.origin),i.set("userLanguage",P.userLanguage),P.disableInsets&&i.set("disableInsets","true");t.language&&i.set("language",t.language);re()||i.set("unsupported","true");var r=ue({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)),D({iframe:c,content:M({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,P.networkErrorTimerId=setTimeout(function(){D({iframe:c,content:M({template:l})})},1e4))};u.onload=f,u.onerror=function(){D({iframe:c,content:M({template:l})})},ge(),s("open",[]),setTimeout(function(){a.style.opacity="1",a.style.transform=fe({animation:"end"})},100)}}function ce(e){var n=e.path,t=e.config,o=null!=t?t:null;P.previousPath===n&&A(P.previousConfig,o)||(P.previousPath=n,P.previousConfig=o,de())}function de(){var e=document.querySelector(S.sdkDialog);P.sdkIsOpen?P.forceUpdateSdkDialog=!0:null==e||e.remove()}function ue(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 ge(){var e=document.querySelector(S.sdkDialog),n=document.querySelector(S.sdkIframeWrapper);if(e&&n)if("widget"===P.mode){var t=W({type:"widget"}),o=J();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,q()?(n.style.border="none",n.style.borderRadius="0"):(n.style.border="1px solid rgb(".concat(N(P.colors.border),")"),n.style.borderRadius="10px")}else if(n.style.border="none",n.style.borderRadius="0",P.element){var i=P.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=P.keyboardHeight>0?"calc(100% - ".concat(P.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 pe(){var e,n=null!==(e=document.querySelector(S.sdkButtonIframe))&&void 0!==e?e:document.createElement("iframe");if(n){var t,o=W({type:"button"});n.id=S.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),D({iframe:n,content:(t={unreadMessageCount:P.unreadMessageCount},M({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,N(P.colors.widgetButtonBackground)).replace(/CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER/g,N(P.colors.widgetButtonText)).replace(/CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER/g,N(P.colors.widgetButtonActionPending)).replace(/WIDGET_BUTTON_TEXT_PLACEHOLDER/g,Se()))})}}function fe(e){return"start"===e.animation?"game"===P.mode?"translateY(20%)":"scale(0.8)":"game"===P.mode?"translateY(0)":"scale(1)"}function me(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 ve(){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"===P.sendPlayerRetention)return[2];if("support-only"===P.sendPlayerRetention&&!P.hasSupportInteraction)return[2];if(be(),P.retryRecordRetentionTimerId&&(clearTimeout(P.retryRecordRetentionTimerId),P.retryRecordRetentionTimerId=null),P.retentionRemainingSeconds=null,P.isRetentionRecordedForSession=!0,!(e=se()))return[2];n="https://".concat(P.sdkApiDomain,"/api/retention"),o=ue({supportViewConfig:e}),i={token:P.token,deviceId:P.deviceId,language:P.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,me(r)];case 3:throw t.sent();case 4:return[3,6];case 5:return a=t.sent(),console.error("Error tracking retention:",a),P.retryRecordRetentionTimerId=setTimeout(ve,6e4),[3,6];case 6:return[2]}})})}function he(){var e=new Date;if(P.sessionStatus="active",P.sessionResumeOrStartTime=e,P.sessionStartTime){var n=P.sessionStartTime.valueOf()/1e3+P.resetSessionAfterSecs;Date.now()/1e3>n&&ye()}else ye();null!==P.retentionRemainingSeconds&&(P.recordRetentionTimerId=setTimeout(ve,1e3*P.retentionRemainingSeconds))}function ye(){P.sessionStartTime=new Date,P.retentionRemainingSeconds=P.recordRetentionAfterSecs,P.isRetentionRecordedForSession=!1,be()}function be(){P.recordRetentionTimerId&&(clearTimeout(P.recordRetentionTimerId),P.recordRetentionTimerId=null)}function we(){P.isRetentionRecordedForSession&&ve()}function Se(){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=H(null!==(n=P.language)&&void 0!==n?n:"en"),s=null===(t=P.locs[e.loc])||void 0===t?void 0:t[a];if(s)return s;var l=a.split("-")[0];return l&&(null===(o=P.locs[e.loc])||void 0===o?void 0:o[l])||(null!==(r=null===(i=P.locs[e.loc])||void 0===i?void 0:i.en)&&void 0!==r?r:null)}({loc:"widgetButtonText"}))&&void 0!==e?e:"Support")}function xe(){P.unreadMessageCount=0,P.unansweredMessageCount=0,s("unreadMessageCountUpdate",[0]),s("unansweredMessageCountUpdate",[0]),z({action:"unreadMessageCountUpdate",count:0})}function Ee(){var e,n,t,o=P.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}}(P.signedMetadataToken):null,i=null!==(n=null===(e=P.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 ke(){var e=P.isLoggedIn,n=P.resolvedPlayerId,t=Ee(),o=Boolean(t),i=e&&o&&t!==n;P.resolvedPlayerId=t,P.isLoggedIn=o,i?(xe(),Q(),P.resolvedPlayerId=t,Z()):o&&!e?Z():!o&&e&&(xe(),Q())}try{document.addEventListener("visibilitychange",function(){var e=P.isInForeground,n="visible"===document.visibilityState;P.isInForeground=n,e!==n&&ne(),n&&"paused"===P.sessionStatus?he():n||"active"!==P.sessionStatus||function(){if(P.sessionResumeOrStartTime&&P.retentionRemainingSeconds){var e=Math.floor((Date.now()-P.sessionResumeOrStartTime.valueOf())/1e3);P.retentionRemainingSeconds-=e}P.sessionStatus="paused",be()}()}),window.addEventListener("resize",ge),window.addEventListener("resize",Y),window.addEventListener("message",function(e){if("theymes.ready"===e.data.action){var n=document.querySelector(S.sdkLoaderIframe),t=document.querySelector(S.sdkIframe);P.networkErrorTimerId&&(clearTimeout(P.networkErrorTimerId),P.networkErrorTimerId=null),t&&(t.style.width="100%",t.style.height="100%"),n&&n.remove()}else if("theymes.close"===e.data.action)ie();else if("theymes.closeNotification"===e.data.action)K({notification:P.visibleNotification});else if("theymes.handleNotificationAction"===e.data.action)d={notification:P.visibleNotification},(null==(u=d.notification)?void 0:u.action)&&"OPEN_PAGE"===u.action.type&&(le({path:u.action.path}),K({notification:u}));else if("theymes.sdkButtonClicked"===e.data.action)(c=document.querySelector(S.sdkButtonIframe))&&(c.style.opacity="0",c.style.transform="scale(0.8)",setTimeout(function(){c.remove()},200)),"support"===P.widgetButtonAction?te():"assistant"===P.widgetButtonAction&&oe();else if("theymes.sdkButtonSizeUpdated"===e.data.action){var o=document.querySelector(S.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?O:i,a={value:t,expiry:Date.now()+o};r.setItem(n,JSON.stringify(a))}({key:E,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!==P.unansweredMessageCount&&(P.unansweredMessageCount=l,s("unansweredMessageCountUpdate",[l])),a!==P.unreadMessageCount&&(P.unreadMessageCount=a,s("unreadMessageCountUpdate",[a]),z({action:"unreadMessageCountUpdate",count:a}))}var c,d,u},!1),ae("open",function(){P.sdkIsOpen=!0,$()}),ae("close",function(){P.sdkIsOpen=!1,ee()})}catch(e){console.error("Error adding event listeners to SDK",e)}var Ce=B("initialize",function(o,i,r){return n(void 0,void 0,void 0,function(){var n,a,s,l,v,h,S,x,T,I,L,_,R,A,D,N,M,B,H,F,j,U;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(".")}P.token=o,P.domain=i,P.sdkApiDomain=n,P.mode=r.mode,P.element="element"in r&&void 0!==r.element?r.element:P.element,P.language=null!==(D=r.language)&&void 0!==D?D:P.language,P.nonce=null!==(N=r.nonce)&&void 0!==N?N:P.nonce,P.deviceId=function(){var e=k("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 C("deviceId",n),n;var t}(),P.widgetButton="button"in r&&void 0!==r.button&&null!==(M=r.button)&&void 0!==M?M:P.widgetButton,P.widgetButtonAction="buttonAction"in r&&void 0!==r.buttonAction&&null!==(B=r.buttonAction)&&void 0!==B?B:P.widgetButtonAction,P.position="position"in r&&void 0!==r.position&&null!==(H=r.position)&&void 0!==H?H:P.position,P.x="x"in r&&void 0!==r.x?r.x:P.x,P.y="y"in r&&void 0!==r.y?r.y:P.y,P.disableInsets="game"===P.mode&&null!==P.element,V.eventPoller||(V.eventPoller=new X),s=function(){he(),de();var e=function(e){var n=e.key,t=e.storage,o=void 0===t?O: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});e&&"widget"===P.mode&&!q()?le({path:e}):P.widgetButton&&pe()},t.label=1;case 1:return t.trys.push([1,6,,7]),l=Date.now()/1e3,v=k(m),h=null,v&&"number"==typeof(S=JSON.parse(v))&&S>0&&(h=S),null!=h&&(h>l+b&&(h=l+b,C(m,JSON.stringify(h))),l<h)?(s(),[2]):(x="https://".concat(n,"/api/settings"),T=new URLSearchParams({token:P.token,platform:w,mode:P.mode,sdkVersion:c}).toString(),[4,fetch("".concat(x,"?").concat(T),{method:"GET"})]);case 2:return(I=t.sent()).ok?[3,4]:[4,me(I)];case 3:throw t.sent();case 4:return[4,I.json()];case 5:return L=t.sent(),(null===(F=null==L?void 0:L.branding)||void 0===F?void 0:F.colors)&&(K=L.branding.colors,P.colors=e(e({},P.colors),K),C(d,JSON.stringify(P.colors))),(null===(j=null==L?void 0:L.branding)||void 0===j?void 0:j.locs)&&(Y=L.branding.locs,P.locs=e(e({},P.locs),Y),C(u,JSON.stringify(P.locs))),(null===(U=null==L?void 0:L.branding)||void 0===U?void 0:U.fonts)&&(G=L.branding.fonts,P.fonts=e(e({},P.fonts),G),C(g,JSON.stringify(P.fonts))),"number"!=typeof(null==L?void 0:L.recordRetentionAfterSecs)&&null!==(null==L?void 0:L.recordRetentionAfterSecs)||(z=L.recordRetentionAfterSecs,P.recordRetentionAfterSecs=z,C(p,JSON.stringify(P.recordRetentionAfterSecs))),"number"!=typeof(null==L?void 0:L.resetSessionAfterSecs)&&null!==(null==L?void 0:L.resetSessionAfterSecs)||(J=L.resetSessionAfterSecs,P.resetSessionAfterSecs=null!=J?J:28800,C(f,JSON.stringify(P.resetSessionAfterSecs))),"always"!==(null==L?void 0:L.sendPlayerRetention)&&"support-only"!==(null==L?void 0:L.sendPlayerRetention)&&"never"!==(null==L?void 0:L.sendPlayerRetention)||(W=L.sendPlayerRetention,P.sendPlayerRetention=W,C(y,P.sendPlayerRetention)),"number"==typeof(null==L?void 0:L.settingsPollIntervalSecs)&&L.settingsPollIntervalSecs>0&&(_=l+L.settingsPollIntervalSecs,R=Math.min(_,l+b),C(m,JSON.stringify(R))),s(),[3,7];case 6:return A=t.sent(),console.error("Error initializing SDK:",A),[3,7];case 7:return[2]}var W,J,z,G,Y,K})})},void 0),Te=B("openSupport",te,void 0),Oe=B("openAssistant",oe,void 0),Ie=B("openResource",function(e,n){var t="/resources/".concat(e);ce({path:t,config:n}),le({path:t,config:n})},void 0),Pe=B("close",ie,void 0),Le=B("getLanguage",function(){return P.language},null),_e=B("setLanguage",function(e){var n=P.language!==e;P.language=e,n&&(de(),z({action:"widgetButtonTextUpdate",text:Se()}))},void 0),Re=B("getSignedMetadataToken",function(){return P.signedMetadataToken},null),Ae=B("setSignedMetadataToken",function(e){var n=P.signedMetadataToken!==e;P.signedMetadataToken=e,ke(),n&&(de(),we())},void 0),De=B("getPlayer",function(){return P.player},null),Ne=B("setPlayer",function(e){var n,t=(null===(n=P.player)||void 0===n?void 0:n.id)!==(null==e?void 0:e.id);P.player=e,ke(),t&&(de(),we())},void 0),Me=B("getTags",function(){return Array.from(P.tags)},[]),Be=B("setTags",function(e){P.tags=new Set(e),de()},void 0),He=B("addTag",function(e){P.tags.add(e),de()},void 0),Fe=B("addTags",function(e){e.forEach(function(e){return P.tags.add(e)}),de()},void 0),je=B("removeTag",function(e){P.tags.delete(e),de()},void 0),Ue=B("removeTags",function(e){e.forEach(function(e){return P.tags.delete(e)}),de()},void 0),qe=B("removeAllTags",function(){P.tags.clear(),de()},void 0),We=B("getFields",function(){return P.fields},{}),Je=B("setFields",function(e){P.fields=e,de()},void 0),ze=B("addField",function(e,n){P.fields[e]=n,de()},void 0),Ge=B("addFields",function(n){P.fields=e(e({},P.fields),n),de()},void 0),Ye=B("removeField",function(e){delete P.fields[e],de()},void 0),Ke=B("removeFields",function(e){e.forEach(function(e){return delete P.fields[e]}),de()},void 0),Xe=B("removeAllFields",function(){P.fields={},de()},void 0),Ve=B("enableLogging",function(){P.loggingEnabled=!0},void 0),Ze=B("disableLogging",function(){P.loggingEnabled=!1},void 0),Qe=B("isYoungPlayer",function(){return P.youngPlayer},!1),$e=B("setYoungPlayer",function(e){P.youngPlayer=e,de()},void 0),en=B("isPrivacyMode",function(){return P.privacyMode},!1),nn=B("setPrivacyMode",function(e){P.privacyMode=e,de()},void 0),tn=B("isSupported",re,!1),on=B("requestNotificationPermission",function(){},void 0),rn=B("enableNotifications",function(){P.notificationsPaused=!1,G()},void 0),an=B("disableNotifications",function(){P.notificationsPaused=!0},void 0),sn=B("getUnreadMessageCount",function(){return P.unreadMessageCount},0),ln=B("getUnansweredMessageCount",function(){return P.unansweredMessageCount},0),cn=B("getSdkVersion",function(){return c},""),dn=B("reset",function(){P.youngPlayer=!1,P.privacyMode=!1,P.language=null,P.tags=new Set,P.fields={},P.signedMetadataToken=null,P.player=null,ke(),de(),z({action:"widgetButtonTextUpdate",text:Se()})},void 0),un=B("recordRetention",function(){P.isRetentionRecordedForSession||ve()},void 0),gn=B("addEventListener",ae,void 0),pn=B("removeEventListener",function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];a.apply(void 0,e)},void 0),fn=B("iosSetKeyboardHeight",function(e){P.keyboardHeight=e,ge()},void 0);export{gn as addEventListener,ze as addField,Ge as addFields,He as addTag,Fe as addTags,Pe as close,Ze as disableLogging,an as disableNotifications,Ve as enableLogging,rn as enableNotifications,We as getFields,Le as getLanguage,De as getPlayer,cn as getSdkVersion,Re as getSignedMetadataToken,Me as getTags,ln as getUnansweredMessageCount,sn as getUnreadMessageCount,Ce as initialize,fn as iosSetKeyboardHeight,en as isPrivacyMode,tn as isSupported,Qe as isYoungPlayer,Oe as openAssistant,Ie as openResource,Te as openSupport,un as recordRetention,Xe as removeAllFields,qe as removeAllTags,pn as removeEventListener,Ye as removeField,Ke as removeFields,je as removeTag,Ue as removeTags,on as requestNotificationPermission,dn as reset,Je as setFields,_e as setLanguage,Ne as setPlayer,nn as setPrivacyMode,Ae as setSignedMetadataToken,Be as setTags,$e 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 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>',d='<!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>',u="<!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>",g="1.2.13",f="colors",p="locs",m="fonts",h="recordRetentionAfterSecs",v="resetSessionAfterSecs",y="web",b={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",sdkStylesheet:"#theymes-sdk-stylesheet"},w=340,S=680,E=500,x=120,T=48,k=.2,C=.2,O=.2,L="theymes_path_on_init",I="url('https://fonts.gstatic.com/s/poppins/v22/pxiEyp8kv8JHgFVrJJfecnFHGPc.woff2') format('woff2')",_=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}},R=function(e,n){try{null===localStorage||void 0===localStorage||localStorage.setItem(e,n)}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}}},A=28800,N=function(){var e=null,t=A,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=D();try{e=function(){var e=_(h);if(e){var n=JSON.parse(e);if("number"==typeof n)return n}return null}(),t=function(){var e=_(v);if(e){var n=JSON.parse(e);if("number"==typeof n)return n}return B()}(),o=function(){var e=_(f);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=_(p);if(e){var t=JSON.parse(e);return n(n({},{widgetButtonText:{}}),t)}return{widgetButtonText:{}}}(),r=function(){var e=_(m);if(e){var t=JSON.parse(e);return n(n({},D()),t)}return D()}()}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 D(){return{body:void 0}}function B(){return A}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 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,y).replace(/INSET_TOP_PLACEHOLDER/g,N.disableInsets?"0px":"env(safe-area-inset-top, 0px)").replace(/INSET_BOTTOM_PLACEHOLDER/g,N.disableInsets?"0px":"env(safe-area-inset-bottom, 0px)").replace(/INSET_LEFT_PLACEHOLDER/g,N.disableInsets?"0px":"env(safe-area-inset-left, 0px)").replace(/INSET_RIGHT_PLACEHOLDER/g,N.disableInsets?"0px":"env(safe-area-inset-right, 0px)").replace(/CSS_TEXT_PLACEHOLDER/g,F(N.colors.text)).replace(/CSS_BORDER_PLACEHOLDER/g,F(N.colors.border)).replace(/CSS_BACKGROUND_PLACEHOLDER/g,F(N.colors.background)).replace(/CSS_TILE_PLACEHOLDER/g,F(N.colors.tile)).replace(/CSS_ACCENT_PLACEHOLDER/g,F(N.colors.accent)).replace(/CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER/g,F(N.colors.notificationBackground)).replace(/CSS_NOTIFICATION_TEXT_PLACEHOLDER/g,F(N.colors.notificationText)).replace(/CSS_FONT_SIZE_PLACEHOLDER/g,"game"===N.mode?"16px":"14px").replace(/CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER/g,null!==(t=null===(n=N.fonts.body)||void 0===n?void 0:n.regular)&&void 0!==t?t:I).replace(/CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER/g,null!==(i=null===(o=N.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,N.nonce?'nonce="'.concat(N.nonce,'"'):"")}var U=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}}},q=function(e){var n,t,o,i,r,a=W(null!==(n=N.language)&&void 0!==n?n:"en"),s=null===(t=N.locs[e.loc])||void 0===t?void 0:t[a];if(s)return s;var l=a.split("-")[0],c=l&&(null===(o=N.locs[e.loc])||void 0===o?void 0:o[l]);return c||(null!==(r=null===(i=N.locs[e.loc])||void 0===i?void 0:i.en)&&void 0!==r?r:null)},W=function(e){var n=e.split(/[-_]/),t=n[0],o=n[1];return t?o?"".concat(t.toLowerCase(),"-").concat(o.toUpperCase()):t.toLowerCase():"en"},z='<!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>',G=/(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,Y=/CrOS/,J=/android|ipad|playbook|silk/i;function K(){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=G.test(n)&&!Y.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<E||window.innerHeight<E)}function X(e){var n=e.type,t=N.position,o=N.x,i=N.y;return K()&&"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 V(){return K()?{width:"100%",height:"100%",maxWidth:"none",maxHeight:"none"}:{width:"".concat(w,"px"),height:"".concat(S,"px"),maxWidth:"none",maxHeight:"calc(100vh - ".concat(2*N.y,"px)")}}function Z(e){var n=document.querySelector(b.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 Q(){var e,n,t=N.notifications[0];if(t&&!N.visibleNotification){N.visibleNotification=t;var o=null!==(e=document.querySelector(b.notificationDialog))&&void 0!==e?e:document.createElement("div");o.id=b.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(b.notificationIframe))&&void 0!==n?n:document.createElement("iframe");r.id=b.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(O,"s ease-in-out, margin-top ").concat(O,"s ease-in-out"),o.appendChild(r),H({iframe:r,content:(i={text:t.text},j({template:z}).replace(/NOTIFICATION_TEXT_PLACEHOLDER/g,i.text))}),setTimeout((function(){r.style.opacity="1",r.style.marginTop="0px",$()}),500),t.closeAfterSeconds>0&&setTimeout((function(){ee({notification:t})}),1e3*t.closeAfterSeconds)}}function $(){var e,n,t,o=document.querySelector(b.notificationDialog),i=document.querySelector(b.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"===N.mode){var a=X({type:"widget"}),s=V(),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(N.element){var c=N.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=N.disableInsets?"0px":"env(safe-area-inset-top, 0px)",o.style.left=N.disableInsets?"0px":"env(safe-area-inset-left, 0px)",o.style.right=N.disableInsets?"0px":"env(safe-area-inset-right, 0px)",o.style.bottom=N.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 ee(e){if(e.notification&&N.visibleNotification===e.notification){var n=document.querySelector(b.notificationIframe),t=document.querySelector(b.notificationDialog);n&&(n.style.opacity="0",n.style.marginTop="-20px",setTimeout((function(){null==t||t.remove(),N.notifications=N.notifications.slice(1),N.visibleNotification=null,Q()}),1e3*O))}}var ne=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(){N.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(e){this.isRunning=!0;var n=new Date;if(this.nextPollDate&&!e||(this.nextPollDate=new Date(n.getTime()+1e3)),n>=this.nextPollDate)this.pollEventsRequest();else{var t=(this.nextPollDate.getTime()-n.getTime())/1e3;this.scheduleNextPollEventsRequest(t)}}}),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 N.isLoggedIn&&N.isInForeground&&N.hasNetworkConnectivity&&!N.sdkIsOpen}}),Object.defineProperty(e.prototype,"resumeIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){!this.shouldBeRunning()||this.isRunning&&!e||this.resume(e)}}),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(!N.token||!N.domain||!N.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=N.notificationsPaused||N.sdkIsOpen?"true":"false",a=new URLSearchParams(n(n({token:N.token,language:null!==(u=N.language)&&void 0!==u?u:"en",deviceId:N.deviceId,notificationsPaused:r,mode:N.mode},(null===(g=N.player)||void 0===g?void 0:g.id)?{unsignedPlayerId:N.player.id}:{}),N.signedMetadataToken?{signedMetadataToken:N.signedMetadataToken}:{})).toString(),o.label=1;case 1:return o.trys.push([1,4,,5]),[4,fetch("https://".concat(N.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),N.notifications=i(i([],N.notifications,!0),c.notifications,!0),N.notifications.length>0&&Q(),c.unansweredMessageCount!==N.unansweredMessageCount&&(N.unansweredMessageCount=c.unansweredMessageCount,l("unansweredMessageCountUpdate",[c.unansweredMessageCount])),c.unreadMessageCount!==N.unreadMessageCount&&(N.unreadMessageCount=c.unreadMessageCount,l("unreadMessageCountUpdate",[c.unreadMessageCount]),Z({action:"unreadMessageCountUpdate",count:c.unreadMessageCount})),[3,5];case 4:return d=o.sent(),console.error("Error fetching events:",d),this.scheduleNextPollEventsRequest(N.retryIntervalSecs),[3,5];case 5:return[2]}}))}))}}),e}(),te={eventPoller:null},oe=function(){var e;null===(e=te.eventPoller)||void 0===e||e.onLogin()},ie=function(){var e;null===(e=te.eventPoller)||void 0===e||e.onLogout()},re=function(){var e;null===(e=te.eventPoller)||void 0===e||e.onOpen()},ae=function(){var e;null===(e=te.eventPoller)||void 0===e||e.onClose()},se=function(){var e;null===(e=te.eventPoller)||void 0===e||e.onEnableNotifications()},le=function(){var e;null===(e=te.eventPoller)||void 0===e||e.onIsInForegroundChanged()},ce=function(e){var n="/help-center";he({path:n,config:e}),me({path:n,config:e})},de=function(e){var n="/assistant";he({path:n,config:e}),me({path:n,config:e})},ue=function(){!function(){var e=document.querySelector(b.sdkDialog),n=document.querySelector(b.sdkIframeWrapper);if(e){var t=function(){"widget"!==N.mode||N.forceUpdateSdkDialog?e.remove():e.style.display="none",N.forceUpdateSdkDialog=!1};n?(n.style.opacity="0",n.style.transform=Se({animation:"start"}),setTimeout((function(){t()}),1e3*k)):t()}N.widgetButton&&we();l("close",[])}()},ge=function(){try{return CSS.supports("color","var(--color)")&&CSS.supports("color","rgb(255 255 255 / 0.5)")}catch(e){return!1}},fe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];a.apply(void 0,e)};function pe(e){var t,o,r,a,s,l,c=(null!=e?e:{}).config;if(!N.token||!N.domain||!N.deviceId)return null;var d=null!==(t=null==c?void 0:c.tags)&&void 0!==t?t:[],u=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:N.language)&&void 0!==a?a:null,p=null!==(s=N.signedMetadataToken)&&void 0!==s?s:null,m=null!==(l=N.player)&&void 0!==l?l:null,h={_platform:y,_sdkVersion:g};N.youngPlayer&&(h._youngPlayer=!0),(N.privacyMode||N.youngPlayer)&&(h._privacyMode=!0);var v=i(i([],Array.from(N.tags),!0),d,!0),b=n(n(n({},N.fields),u),h);return{token:N.token,domain:N.domain,deviceId:N.deviceId,tags:v,fields:b,language:f,signedMetadataToken:p,player:m}}function me(e){var n,t,o,i=pe({config:e.config});if(i){var r=null!==(n=document.querySelector(b.sdkDialog))&&void 0!==n?n:document.createElement("div");r.id=b.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(b.sdkIframeWrapper))&&void 0!==t?t:document.createElement("div");a.id=b.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(N.colors.background),")"),a.style.transform=Se({animation:"start"}),a.style.transition=(N.mode,"opacity ".concat(k,"s ease-in-out, transform ").concat(k,"s ease-in-out")),"widget"===N.mode&&(a.style.overflow="hidden");var s=null!==(o=a.querySelector(b.sdkLoaderIframe))&&void 0!==o?o:document.createElement("iframe");s.id=b.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 u=a.querySelector(b.sdkIframe),g=null!=u?u:document.createElement("iframe"),f=setInterval((function(){var e;"complete"===(null===(e=g.contentDocument)||void 0===e?void 0:e.readyState)&&(clearInterval(f),m())}),500);g.id=b.sdkIframe.replace("#",""),g.style.position="absolute",g.style.border="none",g.style.top="0",g.style.right="0",g.style.bottom="0",g.style.left="0",g.style.colorScheme="auto",u&&!N.networkErrorTimerId||(g.src=function(e){var n=e.path,t=e.supportViewConfig,o="https://".concat(N.domain,"/sdk"),i=new URLSearchParams;i.set("platform",y),i.set("token",t.token),i.set("deviceId",t.deviceId),i.set("mode",N.mode),i.set("origin",window.location.origin),i.set("userLanguage",N.userLanguage),N.disableInsets&&i.set("disableInsets","true");t.language&&i.set("language",t.language);ge()||i.set("unsupported","true");var r=ye({supportViewConfig:t});return i.set("metadata",JSON.stringify(r)),"".concat(o).concat(n,"?").concat(i.toString())}({path:e.path,supportViewConfig:i}),g.style.width="0",g.style.height="0",r.appendChild(a),a.appendChild(s),a.appendChild(g),document.body.appendChild(r)),H({iframe:s,content:j({template:c})});var p=!1,m=function(){p||(p=!0,N.networkErrorTimerId=setTimeout((function(){H({iframe:s,content:j({template:d})})}),1e4))};g.onload=m,g.onerror=function(){H({iframe:s,content:j({template:d})})},be(),l("open",[]),setTimeout((function(){a.style.opacity="1",a.style.transform=Se({animation:"end"})}),100)}}function he(e){var n=e.path,t=e.config,o=null!=t?t:null;N.previousPath===n&&M(N.previousConfig,o)||(N.previousPath=n,N.previousConfig=o,ve())}function ve(){var e=document.querySelector(b.sdkDialog);N.sdkIsOpen?N.forceUpdateSdkDialog=!0:null==e||e.remove()}function ye(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 be(){var e=document.querySelector(b.sdkDialog),n=document.querySelector(b.sdkIframeWrapper);if(e&&n)if("widget"===N.mode){var t=X({type:"widget"}),o=V();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,K()?(n.style.border="none",n.style.borderRadius="0"):(n.style.border="1px solid rgb(".concat(F(N.colors.border),")"),n.style.borderRadius="10px")}else if(n.style.border="none",n.style.borderRadius="0",N.element){var i=N.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=N.keyboardHeight>0?"calc(100% - ".concat(N.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 we(){var e,n=null!==(e=document.querySelector(b.sdkButtonIframe))&&void 0!==e?e:document.createElement("iframe");if(n){var t,o=X({type:"button"});n.id=b.sdkButtonIframe.replace("#",""),n.style.position="fixed",n.style.border="none",n.style.width="".concat(x,"px"),n.style.height="".concat(T,"px"),n.style.minWidth="".concat(x,"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(C,"s ease-in-out, transform ").concat(C,"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:N.unreadMessageCount},j({template:u}).replace(/UNREAD_MESSAGE_COUNT_PLACEHOLDER/g,"".concat(t.unreadMessageCount)).replace(/CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER/g,F(N.colors.widgetButtonBackground)).replace(/CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER/g,F(N.colors.widgetButtonText)).replace(/CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER/g,F(N.colors.widgetButtonActionPending)).replace(/WIDGET_BUTTON_TEXT_PLACEHOLDER/g,Le()))})}}function Se(e){return"start"===e.animation?"game"===N.mode?"translateY(20%)":"scale(0.8)":"game"===N.mode?"translateY(0)":"scale(1)"}function Ee(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 xe(){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(Ce(),N.retryRecordRetentionTimerId&&(clearTimeout(N.retryRecordRetentionTimerId),N.retryRecordRetentionTimerId=null),N.retentionRemainingSeconds=null,N.isRetentionRecordedForSession=!0,!(e=pe()))return[2];n="https://".concat(N.domain,"/api/sdk/retention"),t=ye({supportViewConfig:e}),i={token:N.token,deviceId:N.deviceId,language:N.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,Ee(r)];case 3:throw o.sent();case 4:return[3,6];case 5:return a=o.sent(),console.error("Error tracking retention:",a),N.retryRecordRetentionTimerId=setTimeout(xe,6e4),[3,6];case 6:return[2]}}))}))}function Te(){var e=new Date;if(N.sessionStatus="active",N.sessionResumeOrStartTime=e,N.sessionStartTime){var n=N.sessionStartTime.valueOf()/1e3+N.resetSessionAfterSecs;Date.now()/1e3>n&&ke()}else ke();null!==N.retentionRemainingSeconds&&(N.recordRetentionTimerId=setTimeout(xe,1e3*N.retentionRemainingSeconds))}function ke(){N.sessionStartTime=new Date,N.retentionRemainingSeconds=N.recordRetentionAfterSecs,N.isRetentionRecordedForSession=!1,Ce()}function Ce(){N.recordRetentionTimerId&&(clearTimeout(N.recordRetentionTimerId),N.recordRetentionTimerId=null)}function Oe(){N.isRetentionRecordedForSession&&xe()}function Le(){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=q({loc:"widgetButtonText"}))&&void 0!==e?e:"Support")}function Ie(){var e=N.isInForeground,n="visible"===document.visibilityState&&document.hasFocus();N.isInForeground=n,e!==n&&le(),n&&"paused"===N.sessionStatus?Te():n||"active"!==N.sessionStatus||function(){if(N.sessionResumeOrStartTime&&N.retentionRemainingSeconds){var e=Math.floor((Date.now()-N.sessionResumeOrStartTime.valueOf())/1e3);N.retentionRemainingSeconds-=e}N.sessionStatus="paused",Ce()}()}function _e(){var e,n=N.isLoggedIn,t=Boolean(N.signedMetadataToken||(null===(e=N.player)||void 0===e?void 0:e.id));N.isLoggedIn=t,t&&!n?oe():!t&&n&&ie()}try{document.addEventListener("visibilitychange",Ie),window.addEventListener("focus",Ie),window.addEventListener("blur",Ie),window.addEventListener("resize",be),window.addEventListener("resize",$),window.addEventListener("message",(function(e){if("theymes.ready"===e.data.action){var n=document.querySelector(b.sdkLoaderIframe),t=document.querySelector(b.sdkIframe);N.networkErrorTimerId&&(clearTimeout(N.networkErrorTimerId),N.networkErrorTimerId=null),t&&(t.style.width="100%",t.style.height="100%"),n&&n.remove()}else if("theymes.close"===e.data.action)ue();else if("theymes.closeNotification"===e.data.action)ee({notification:N.visibleNotification});else if("theymes.handleNotificationAction"===e.data.action)a={notification:N.visibleNotification},(null==(s=a.notification)?void 0:s.action)&&"OPEN_PAGE"===s.action.type&&(me({path:s.action.path}),ee({notification:s}));else if("theymes.sdkButtonClicked"===e.data.action)(r=document.querySelector(b.sdkButtonIframe))&&(r.style.opacity="0",r.style.transform="scale(0.8)",setTimeout((function(){r.remove()}),1e3*C)),"support"===N.widgetButtonAction?ce():"assistant"===N.widgetButtonAction&&de();else if("theymes.sdkButtonSizeUpdated"===e.data.action){var o=document.querySelector(b.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?P:i,a={value:t,expiry:Date.now()+o};r.setItem(n,JSON.stringify(a))}({key:L,value:e.data.path,ttlMs:6e5}),window.open(e.data.url,i)}var r,a,s}),!1),fe("open",(function(){N.sdkIsOpen=!0,re()})),fe("close",(function(){N.sdkIsOpen=!1,ae()}))}catch(e){console.error("Error adding event listeners to SDK",e)}var Re=U("initialize",(function(e,i,r){return t(void 0,void 0,void 0,(function(){var t,a,s,l,c,d,u,g,b,w,S,E,x,T;return o(this,(function(o){switch(o.label){case 0:if(!e||!i||!r.mode)throw new Error("Token, domain, and mode are required");N.token=e,N.domain=i,N.mode=r.mode,N.element="element"in r&&void 0!==r.element?r.element:N.element,N.language=null!==(u=r.language)&&void 0!==u?u:N.language,N.nonce=null!==(g=r.nonce)&&void 0!==g?g:N.nonce,N.deviceId=function(){var e=_("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 R("deviceId",n),n;var t}(),N.widgetButton="button"in r&&void 0!==r.button&&null!==(b=r.button)&&void 0!==b?b:N.widgetButton,N.widgetButtonAction="buttonAction"in r&&void 0!==r.buttonAction&&null!==(w=r.buttonAction)&&void 0!==w?w:N.widgetButtonAction,N.position="position"in r&&void 0!==r.position&&null!==(S=r.position)&&void 0!==S?S:N.position,N.x="x"in r&&void 0!==r.x?r.x:N.x,N.y="y"in r&&void 0!==r.y?r.y:N.y,N.disableInsets="game"===N.mode&&null!==N.element,te.eventPoller||(te.eventPoller=new ne),t="https://".concat(i,"/api/sdk/settings"),a=new URLSearchParams({token:N.token,platform:y,mode:N.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,Ee(s)];case 3:throw o.sent();case 4:return[4,s.json()];case 5:return l=o.sent(),(null===(E=null==l?void 0:l.branding)||void 0===E?void 0:E.colors)&&(A=l.branding.colors,N.colors=n(n({},N.colors),A),R(f,JSON.stringify(N.colors))),(null===(x=null==l?void 0:l.branding)||void 0===x?void 0:x.locs)&&(I=l.branding.locs,N.locs=n(n({},N.locs),I),R(p,JSON.stringify(N.locs))),(null===(T=null==l?void 0:l.branding)||void 0===T?void 0:T.fonts)&&(O=l.branding.fonts,N.fonts=n(n({},N.fonts),O),R(m,JSON.stringify(N.fonts))),"number"!=typeof(null==l?void 0:l.recordRetentionAfterSecs)&&null!==(null==l?void 0:l.recordRetentionAfterSecs)||(C=l.recordRetentionAfterSecs,N.recordRetentionAfterSecs=C,R(h,JSON.stringify(N.recordRetentionAfterSecs))),"number"!=typeof(null==l?void 0:l.resetSessionAfterSecs)&&null!==(null==l?void 0:l.resetSessionAfterSecs)||(k=l.resetSessionAfterSecs,N.resetSessionAfterSecs=null!=k?k:B(),R(v,JSON.stringify(N.resetSessionAfterSecs))),Te(),ve(),c=function(e){var n=e.key,t=e.storage,o=void 0===t?P:t,i=e.removeItem,r=void 0!==i&&i,a=o.getItem(n);if(!a)return null;var s=JSON.parse(a);return Date.now()>s.expiry?(o.removeItem(n),null):(r&&o.removeItem(n),s.value)}({key:L,removeItem:!0}),c&&"widget"===N.mode&&!K()?me({path:c}):N.widgetButton&&we(),[3,7];case 6:return d=o.sent(),console.error("Error initializing SDK:",d),[3,7];case 7:return[2]}var k,C,O,I,A}))}))}),void 0),Pe=U("openSupport",ce,void 0),Ae=U("openAssistant",de,void 0),Ne=U("openResource",(function(e,n){var t="/resources/".concat(e);he({path:t,config:n}),me({path:t,config:n})}),void 0),De=U("close",ue,void 0),Be=U("getLanguage",(function(){return N.language}),null),Me=U("setLanguage",(function(e){var n=N.language!==e;N.language=e,n&&(ve(),Z({action:"widgetButtonTextUpdate",text:Le()}))}),void 0),He=U("getSignedMetadataToken",(function(){return N.signedMetadataToken}),null),Fe=U("setSignedMetadataToken",(function(e){var n=N.signedMetadataToken!==e;N.signedMetadataToken=e,_e(),n&&(ve(),Oe())}),void 0),je=U("getPlayer",(function(){return N.player}),null),Ue=U("setPlayer",(function(e){var n,t=(null===(n=N.player)||void 0===n?void 0:n.id)!==(null==e?void 0:e.id);N.player=e,_e(),t&&(ve(),Oe())}),void 0),qe=U("getTags",(function(){return Array.from(N.tags)}),[]),We=U("setTags",(function(e){N.tags=new Set(e),ve()}),void 0),ze=U("addTag",(function(e){N.tags.add(e),ve()}),void 0),Ge=U("addTags",(function(e){e.forEach((function(e){return N.tags.add(e)})),ve()}),void 0),Ye=U("removeTag",(function(e){N.tags.delete(e),ve()}),void 0),Je=U("removeTags",(function(e){e.forEach((function(e){return N.tags.delete(e)})),ve()}),void 0),Ke=U("removeAllTags",(function(){N.tags.clear(),ve()}),void 0),Xe=U("getFields",(function(){return N.fields}),{}),Ve=U("setFields",(function(e){N.fields=e,ve()}),void 0),Ze=U("addField",(function(e,n){N.fields[e]=n,ve()}),void 0),Qe=U("addFields",(function(e){N.fields=n(n({},N.fields),e),ve()}),void 0),$e=U("removeField",(function(e){delete N.fields[e],ve()}),void 0),en=U("removeFields",(function(e){e.forEach((function(e){return delete N.fields[e]})),ve()}),void 0),nn=U("removeAllFields",(function(){N.fields={},ve()}),void 0),tn=U("enableLogging",(function(){N.loggingEnabled=!0}),void 0),on=U("disableLogging",(function(){N.loggingEnabled=!1}),void 0),rn=U("isYoungPlayer",(function(){return N.youngPlayer}),!1),an=U("setYoungPlayer",(function(e){N.youngPlayer=e,ve()}),void 0),sn=U("isPrivacyMode",(function(){return N.privacyMode}),!1),ln=U("setPrivacyMode",(function(e){N.privacyMode=e,ve()}),void 0),cn=U("isSupported",ge,!1),dn=U("requestNotificationPermission",(function(){}),void 0),un=U("enableNotifications",(function(){N.notificationsPaused=!1,se()}),void 0),gn=U("disableNotifications",(function(){N.notificationsPaused=!0}),void 0),fn=U("getUnreadMessageCount",(function(){return N.unreadMessageCount}),0),pn=U("getUnansweredMessageCount",(function(){return N.unansweredMessageCount}),0),mn=U("getSdkVersion",(function(){return g}),""),hn=U("reset",(function(){N.language=null,N.tags=new Set,N.fields={},N.signedMetadataToken=null,N.player=null,_e(),ve(),Z({action:"widgetButtonTextUpdate",text:Le()})}),void 0),vn=U("recordRetention",(function(){N.isRetentionRecordedForSession||xe()}),void 0),yn=U("addEventListener",fe,void 0),bn=U("removeEventListener",(function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];s.apply(void 0,e)}),void 0),wn=U("iosSetKeyboardHeight",(function(e){N.keyboardHeight=e,be()}),void 0);return e.addEventListener=yn,e.addField=Ze,e.addFields=Qe,e.addTag=ze,e.addTags=Ge,e.close=De,e.disableLogging=on,e.disableNotifications=gn,e.enableLogging=tn,e.enableNotifications=un,e.getFields=Xe,e.getLanguage=Be,e.getPlayer=je,e.getSdkVersion=mn,e.getSignedMetadataToken=He,e.getTags=qe,e.getUnansweredMessageCount=pn,e.getUnreadMessageCount=fn,e.initialize=Re,e.iosSetKeyboardHeight=wn,e.isPrivacyMode=sn,e.isSupported=cn,e.isYoungPlayer=rn,e.openAssistant=Ae,e.openResource=Ne,e.openSupport=Pe,e.recordRetention=vn,e.removeAllFields=nn,e.removeAllTags=Ke,e.removeEventListener=bn,e.removeField=$e,e.removeFields=en,e.removeTag=Ye,e.removeTags=Je,e.requestNotificationPermission=dn,e.reset=hn,e.setFields=Ve,e.setLanguage=Me,e.setPlayer=Ue,e.setPrivacyMode=ln,e.setSignedMetadataToken=Fe,e.setTags=We,e.setYoungPlayer=an,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 d='<!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.0",u="colors",g="locs",p="fonts",f="recordRetentionAfterSecs",m="resetSessionAfterSecs",v="settingsNextPollAt",h="eventPollerNextPollAt",y="hasSupportInteraction",b="sendPlayerRetention",w=2419200,S="web",x={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"},T=.2,k="theymes_path_on_init",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}},C=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 null===L.resolvedPlayerId||void 0===L.resolvedPlayerId?null:"".concat(e,".").concat(L.resolvedPlayerId)}var L=function(){var e=null,t=28800,o="support-only",i=!1,r={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={widgetButtonText:{}},s=R();try{e=function(){var e=E(f);if(e){var n=JSON.parse(e);if("number"==typeof n)return n}return null}(),t=function(){var e=E(m);if(e){var n=JSON.parse(e);if("number"==typeof n)return n}return _()}(),o=function(){var e=E(b);if(e&&A.includes(e))return e;return"support-only"}(),i=!1,r=function(){var e=E(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}}}(),a=function(){var e=E(g);if(e){var t=JSON.parse(e);return n(n({},{widgetButtonText:{}}),t)}return{widgetButtonText:{}}}(),s=function(){var e=E(p);if(e){var t=JSON.parse(e);return n(n({},R()),t)}return R()}()}catch(e){console.error("Error initializing internals",e)}return{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:e,resetSessionAfterSecs:t,sessionStatus:"waiting",sessionStartTime:null,sessionResumeOrStartTime:null,retentionRemainingSeconds:null,isRetentionRecordedForSession:!1,recordRetentionTimerId:null,retryRecordRetentionTimerId:null,networkErrorTimerId:null,sendPlayerRetention:o,hasSupportInteraction:i,resolvedPlayerId:null,colors:r,locs:a,fonts:s,notificationsPaused:!0,notifications:[],visibleNotification:null,unreadMessageCount:0,unansweredMessageCount:0,previousPath:null,previousConfig:null,nonce:null,keyboardHeight:0,disableInsets:!1}}();function R(){return{body:void 0}}function _(){return 28800}var A=["always","support-only","never"];var N=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 N(o,n[t])}))};function D(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 M(e){return"".concat(e.r,", ").concat(e.g,", ").concat(e.b)}function B(e){var n,t,o,i;return e.template.replace(/PLATFORM_PLACEHOLDER/g,S).replace(/INSET_TOP_PLACEHOLDER/g,L.disableInsets?"0px":"env(safe-area-inset-top, 0px)").replace(/INSET_BOTTOM_PLACEHOLDER/g,L.disableInsets?"0px":"env(safe-area-inset-bottom, 0px)").replace(/INSET_LEFT_PLACEHOLDER/g,L.disableInsets?"0px":"env(safe-area-inset-left, 0px)").replace(/INSET_RIGHT_PLACEHOLDER/g,L.disableInsets?"0px":"env(safe-area-inset-right, 0px)").replace(/CSS_TEXT_PLACEHOLDER/g,M(L.colors.text)).replace(/CSS_BORDER_PLACEHOLDER/g,M(L.colors.border)).replace(/CSS_BACKGROUND_PLACEHOLDER/g,M(L.colors.background)).replace(/CSS_TILE_PLACEHOLDER/g,M(L.colors.tile)).replace(/CSS_ACCENT_PLACEHOLDER/g,M(L.colors.accent)).replace(/CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER/g,M(L.colors.notificationBackground)).replace(/CSS_NOTIFICATION_TEXT_PLACEHOLDER/g,M(L.colors.notificationText)).replace(/CSS_FONT_SIZE_PLACEHOLDER/g,"game"===L.mode?"16px":"14px").replace(/CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER/g,null!==(t=null===(n=L.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=L.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,L.nonce?'nonce="'.concat(L.nonce,'"'):"")}function H(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 F=function(e){var n=e.split(/[-_]/),t=n[0],o=n[1];return t?o?"".concat(t.toLowerCase(),"-").concat(o.toUpperCase()):t.toLowerCase():"en"},j=/(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,U=/CrOS/,q=/android|ipad|playbook|silk/i;function W(){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=j.test(n)&&!U.test(n)||!!e.tablet&&q.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 J(e){var n=e.type,t=L.position,o=L.x,i=L.y;return W()&&"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 z(){return W()?{width:"100%",height:"100%",maxWidth:"none",maxHeight:"none"}:{width:"".concat(340,"px"),height:"".concat(680,"px"),maxWidth:"none",maxHeight:"calc(100vh - ".concat(2*L.y,"px)")}}function G(e){var n=document.querySelector(x.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 Y(){var e,n;if(!L.notificationsPaused){var t=L.notifications[0];if(t&&!L.visibleNotification){L.visibleNotification=t;var o=null!==(e=document.querySelector(x.notificationDialog))&&void 0!==e?e:document.createElement("div");o.id=x.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(x.notificationIframe))&&void 0!==n?n:document.createElement("iframe");r.id=x.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),D({iframe:r,content:(i={text:t.text},B({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",K()},500),t.closeAfterSeconds>0&&setTimeout(function(){X({notification:t})},1e3*t.closeAfterSeconds)}}}function K(){var e,n,t,o=document.querySelector(x.notificationDialog),i=document.querySelector(x.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"===L.mode){var a=J({type:"widget"}),s=z(),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(L.element){var d=L.element.getBoundingClientRect();l="".concat(d.width-20,"px");o.style.top="".concat(d.top,"px"),o.style.left="".concat(d.left,"px"),o.style.right="".concat(d.right,"px"),o.style.bottom="".concat(d.bottom,"px"),o.style.overflow="hidden",i.style.width=l}else{l="calc(100% - 20px)";o.style.top=L.disableInsets?"0px":"env(safe-area-inset-top, 0px)",o.style.left=L.disableInsets?"0px":"env(safe-area-inset-left, 0px)",o.style.right=L.disableInsets?"0px":"env(safe-area-inset-right, 0px)",o.style.bottom=L.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 X(e){if(e.notification&&L.visibleNotification===e.notification){var n=document.querySelector(x.notificationIframe),t=document.querySelector(x.notificationDialog);n&&(n.style.opacity="0",n.style.marginTop="-20px",setTimeout(function(){null==t||t.remove(),L.notifications=L.notifications.slice(1),L.visibleNotification=null,Y()},200))}}var V=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=P(h);if(null!==e&&!L.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+w&&(i=o+w,C(e,JSON.stringify(i))),i>o&&(this.nextPollDate=new Date(1e3*i),L.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(){L.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 L.isLoggedIn&&L.isInForeground&&L.hasNetworkConnectivity&&!L.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=P(h),n=P(y),null!==e&&O(e),null!==n&&O(n),L.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=P(h);if(null!==i){var r=o/1e3,a=r+e,s=Math.min(a,r+w);C(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,d,u,g,p;return o(this,function(o){switch(o.label){case 0:if(!L.token||!L.sdkApiDomain||!L.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=P(h))&&O(t),r={token:L.token,deviceId:L.deviceId,language:null!==(g=L.language)&&void 0!==g?g:null,userLanguage:L.userLanguage,mode:L.mode,sdkVersion:c},(null===(p=L.player)||void 0===p?void 0:p.id)&&(r.unsignedPlayerId=L.player.id),L.signedMetadataToken&&(r.signedMetadataToken=L.signedMetadataToken),o.label=1;case 1:return o.trys.push([1,4,,5]),[4,fetch("https://".concat(L.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){L.hasSupportInteraction=e;var n=P(y);null!==n&&C(n,String(L.hasSupportInteraction))}(s.hasSupportInteraction),this.scheduleNextPollEventsRequest(s.nextPollSeconds,!s.hasSupportInteraction),L.notifications=i(i([],L.notifications,!0),s.notifications,!0),!L.notificationsPaused&&!L.sdkIsOpen&&L.notifications.length>0&&Y(),s.unansweredMessageCount!==L.unansweredMessageCount&&(L.unansweredMessageCount=s.unansweredMessageCount,l("unansweredMessageCountUpdate",[s.unansweredMessageCount])),s.unreadMessageCount!==L.unreadMessageCount&&(L.unreadMessageCount=s.unreadMessageCount,l("unreadMessageCountUpdate",[s.unreadMessageCount]),G({action:"unreadMessageCountUpdate",count:s.unreadMessageCount})),[3,5];case 4:return d=o.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}(),Z={eventPoller:null},Q=function(){var e;!function(){var e=P(y);if(null!==e){var n=E(e);L.hasSupportInteraction="true"===n}}(),null===(e=Z.eventPoller)||void 0===e||e.onLogin()},$=function(){var e;null===(e=Z.eventPoller)||void 0===e||e.onLogout()},ee=function(){var e;null===(e=Z.eventPoller)||void 0===e||e.onOpen()},ne=function(){var e;null===(e=Z.eventPoller)||void 0===e||e.onClose()},te=function(){var e;null===(e=Z.eventPoller)||void 0===e||e.onIsInForegroundChanged()},oe=function(e){var n="/help-center";ce({path:n,config:e}),de({path:n,config:e})},ie=function(e){var n="/assistant";ce({path:n,config:e}),de({path:n,config:e})},re=function(){!function(){var e=document.querySelector(x.sdkDialog),n=document.querySelector(x.sdkIframeWrapper);if(e){var t=function(){"widget"!==L.mode||L.forceUpdateSdkDialog?e.remove():e.style.display="none",L.forceUpdateSdkDialog=!1};n?(n.style.opacity="0",n.style.transform=me({animation:"start"}),setTimeout(function(){t()},200)):t()}L.widgetButton&&fe();l("close",[])}()},ae=function(){try{return CSS.supports("color","var(--color)")&&CSS.supports("color","rgb(255 255 255 / 0.5)")}catch(e){return!1}},se=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];a.apply(void 0,e)};function le(e){var t,o,r,a,s,l,d=(null!=e?e:{}).config;if(!L.token||!L.domain||!L.deviceId)return null;var u=null!==(t=null==d?void 0:d.tags)&&void 0!==t?t:[],g=null!==(o=null==d?void 0:d.fields)&&void 0!==o?o:{},p=null!==(a=null!==(r=null==d?void 0:d.language)&&void 0!==r?r:L.language)&&void 0!==a?a:null,f=null!==(s=L.signedMetadataToken)&&void 0!==s?s:null,m=null!==(l=L.player)&&void 0!==l?l:null,v={_platform:S,_sdkVersion:c};L.youngPlayer&&(v._youngPlayer=!0),(L.privacyMode||L.youngPlayer)&&(v._privacyMode=!0);var h=i(i([],Array.from(L.tags),!0),u,!0),y=n(n(n({},L.fields),g),v);return{token:L.token,domain:L.domain,deviceId:L.deviceId,tags:h,fields:y,language:p,signedMetadataToken:f,player:m}}function de(e){var n,t,o,i=le({config:e.config});if(i){var r=null!==(n=document.querySelector(x.sdkDialog))&&void 0!==n?n:document.createElement("div");r.id=x.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(x.sdkIframeWrapper))&&void 0!==t?t:document.createElement("div");a.id=x.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(M(L.colors.background),")"),a.style.transform=me({animation:"start"}),a.style.transition=(L.mode,"opacity ".concat(T,"s ease-in-out, transform ").concat(T,"s ease-in-out")),"widget"===L.mode&&(a.style.overflow="hidden");var s=null!==(o=a.querySelector(x.sdkLoaderIframe))&&void 0!==o?o:document.createElement("iframe");s.id=x.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 c=a.querySelector(x.sdkIframe),u=null!=c?c: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=x.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",c&&!L.networkErrorTimerId||(u.src=function(e){var n=e.path,t=e.supportViewConfig,o="https://".concat(L.domain,"/sdk"),i=new URLSearchParams;i.set("platform",S),i.set("token",t.token),i.set("deviceId",t.deviceId),i.set("domain",t.domain),i.set("mode",L.mode),i.set("origin",window.location.origin),i.set("userLanguage",L.userLanguage),L.disableInsets&&i.set("disableInsets","true");t.language&&i.set("language",t.language);ae()||i.set("unsupported","true");var r=ge({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)),D({iframe:s,content:B({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,L.networkErrorTimerId=setTimeout(function(){D({iframe:s,content:B({template:d})})},1e4))};u.onload=f,u.onerror=function(){D({iframe:s,content:B({template:d})})},pe(),l("open",[]),setTimeout(function(){a.style.opacity="1",a.style.transform=me({animation:"end"})},100)}}function ce(e){var n=e.path,t=e.config,o=null!=t?t:null;L.previousPath===n&&N(L.previousConfig,o)||(L.previousPath=n,L.previousConfig=o,ue())}function ue(){var e=document.querySelector(x.sdkDialog);L.sdkIsOpen?L.forceUpdateSdkDialog=!0:null==e||e.remove()}function ge(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 pe(){var e=document.querySelector(x.sdkDialog),n=document.querySelector(x.sdkIframeWrapper);if(e&&n)if("widget"===L.mode){var t=J({type:"widget"}),o=z();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,W()?(n.style.border="none",n.style.borderRadius="0"):(n.style.border="1px solid rgb(".concat(M(L.colors.border),")"),n.style.borderRadius="10px")}else if(n.style.border="none",n.style.borderRadius="0",L.element){var i=L.element.getBoundingClientRect(),r=i.width,a=i.height,s=i.top,l=i.left,d=i.right,c=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(d,"px"),e.style.bottom="".concat(c,"px")}else{a=L.keyboardHeight>0?"calc(100% - ".concat(L.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 fe(){var e,n=null!==(e=document.querySelector(x.sdkButtonIframe))&&void 0!==e?e:document.createElement("iframe");if(n){var t,o=J({type:"button"});n.id=x.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),D({iframe:n,content:(t={unreadMessageCount:L.unreadMessageCount},B({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,M(L.colors.widgetButtonBackground)).replace(/CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER/g,M(L.colors.widgetButtonText)).replace(/CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER/g,M(L.colors.widgetButtonActionPending)).replace(/WIDGET_BUTTON_TEXT_PLACEHOLDER/g,xe()))})}}function me(e){return"start"===e.animation?"game"===L.mode?"translateY(20%)":"scale(0.8)":"game"===L.mode?"translateY(0)":"scale(1)"}function ve(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 he(){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"===L.sendPlayerRetention)return[2];if("support-only"===L.sendPlayerRetention&&!L.hasSupportInteraction)return[2];if(we(),L.retryRecordRetentionTimerId&&(clearTimeout(L.retryRecordRetentionTimerId),L.retryRecordRetentionTimerId=null),L.retentionRemainingSeconds=null,L.isRetentionRecordedForSession=!0,!(e=le()))return[2];n="https://".concat(L.sdkApiDomain,"/api/retention"),t=ge({supportViewConfig:e}),i={token:L.token,deviceId:L.deviceId,language:L.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,ve(r)];case 3:throw o.sent();case 4:return[3,6];case 5:return a=o.sent(),console.error("Error tracking retention:",a),L.retryRecordRetentionTimerId=setTimeout(he,6e4),[3,6];case 6:return[2]}})})}function ye(){var e=new Date;if(L.sessionStatus="active",L.sessionResumeOrStartTime=e,L.sessionStartTime){var n=L.sessionStartTime.valueOf()/1e3+L.resetSessionAfterSecs;Date.now()/1e3>n&&be()}else be();null!==L.retentionRemainingSeconds&&(L.recordRetentionTimerId=setTimeout(he,1e3*L.retentionRemainingSeconds))}function be(){L.sessionStartTime=new Date,L.retentionRemainingSeconds=L.recordRetentionAfterSecs,L.isRetentionRecordedForSession=!1,we()}function we(){L.recordRetentionTimerId&&(clearTimeout(L.recordRetentionTimerId),L.recordRetentionTimerId=null)}function Se(){L.isRetentionRecordedForSession&&he()}function xe(){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),d=s.reduce(function(e,n){return e+n},0),c=Math.abs(l-d);o.push(c)}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=F(null!==(n=L.language)&&void 0!==n?n:"en"),s=null===(t=L.locs[e.loc])||void 0===t?void 0:t[a];if(s)return s;var l=a.split("-")[0];return l&&(null===(o=L.locs[e.loc])||void 0===o?void 0:o[l])||(null!==(r=null===(i=L.locs[e.loc])||void 0===i?void 0:i.en)&&void 0!==r?r:null)}({loc:"widgetButtonText"}))&&void 0!==e?e:"Support")}function Te(){L.unreadMessageCount=0,L.unansweredMessageCount=0,l("unreadMessageCountUpdate",[0]),l("unansweredMessageCountUpdate",[0]),G({action:"unreadMessageCountUpdate",count:0})}function ke(){var e,n,t,o=L.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),d=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 d&&d.length>0?d:null}catch(e){return null}}(L.signedMetadataToken):null,i=null!==(n=null===(e=L.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 Ee(){var e=L.isLoggedIn,n=L.resolvedPlayerId,t=ke(),o=Boolean(t),i=e&&o&&t!==n;L.resolvedPlayerId=t,L.isLoggedIn=o,i?(Te(),$(),L.resolvedPlayerId=t,Q()):o&&!e?Q():!o&&e&&(Te(),$())}try{document.addEventListener("visibilitychange",function(){var e=L.isInForeground,n="visible"===document.visibilityState;L.isInForeground=n,e!==n&&te(),n&&"paused"===L.sessionStatus?ye():n||"active"!==L.sessionStatus||function(){if(L.sessionResumeOrStartTime&&L.retentionRemainingSeconds){var e=Math.floor((Date.now()-L.sessionResumeOrStartTime.valueOf())/1e3);L.retentionRemainingSeconds-=e}L.sessionStatus="paused",we()}()}),window.addEventListener("resize",pe),window.addEventListener("resize",K),window.addEventListener("message",function(e){if("theymes.ready"===e.data.action){var n=document.querySelector(x.sdkLoaderIframe),t=document.querySelector(x.sdkIframe);L.networkErrorTimerId&&(clearTimeout(L.networkErrorTimerId),L.networkErrorTimerId=null),t&&(t.style.width="100%",t.style.height="100%"),n&&n.remove()}else if("theymes.close"===e.data.action)re();else if("theymes.closeNotification"===e.data.action)X({notification:L.visibleNotification});else if("theymes.handleNotificationAction"===e.data.action)c={notification:L.visibleNotification},(null==(u=c.notification)?void 0:u.action)&&"OPEN_PAGE"===u.action.type&&(de({path:u.action.path}),X({notification:u}));else if("theymes.sdkButtonClicked"===e.data.action)(d=document.querySelector(x.sdkButtonIframe))&&(d.style.opacity="0",d.style.transform="scale(0.8)",setTimeout(function(){d.remove()},200)),"support"===L.widgetButtonAction?oe():"assistant"===L.widgetButtonAction&&ie();else if("theymes.sdkButtonSizeUpdated"===e.data.action){var o=document.querySelector(x.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?I:i,a={value:t,expiry:Date.now()+o};r.setItem(n,JSON.stringify(a))}({key:k,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!==L.unansweredMessageCount&&(L.unansweredMessageCount=s,l("unansweredMessageCountUpdate",[s])),a!==L.unreadMessageCount&&(L.unreadMessageCount=a,l("unreadMessageCountUpdate",[a]),G({action:"unreadMessageCountUpdate",count:a}))}var d,c,u},!1),se("open",function(){L.sdkIsOpen=!0,ee()}),se("close",function(){L.sdkIsOpen=!1,ne()})}catch(e){console.error("Error adding event listeners to SDK",e)}var Ce=H("initialize",function(e,i,r){return t(void 0,void 0,void 0,function(){var t,a,s,l,d,h,y,x,T,O,P,R,_,A,N,D,M,B,H,F,j,U;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(".")}L.token=e,L.domain=i,L.sdkApiDomain=t,L.mode=r.mode,L.element="element"in r&&void 0!==r.element?r.element:L.element,L.language=null!==(N=r.language)&&void 0!==N?N:L.language,L.nonce=null!==(D=r.nonce)&&void 0!==D?D:L.nonce,L.deviceId=function(){var e=E("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 C("deviceId",n),n;var t}(),L.widgetButton="button"in r&&void 0!==r.button&&null!==(M=r.button)&&void 0!==M?M:L.widgetButton,L.widgetButtonAction="buttonAction"in r&&void 0!==r.buttonAction&&null!==(B=r.buttonAction)&&void 0!==B?B:L.widgetButtonAction,L.position="position"in r&&void 0!==r.position&&null!==(H=r.position)&&void 0!==H?H:L.position,L.x="x"in r&&void 0!==r.x?r.x:L.x,L.y="y"in r&&void 0!==r.y?r.y:L.y,L.disableInsets="game"===L.mode&&null!==L.element,Z.eventPoller||(Z.eventPoller=new V),s=function(){ye(),ue();var e=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:k});e&&"widget"===L.mode&&!W()?de({path:e}):L.widgetButton&&fe()},o.label=1;case 1:return o.trys.push([1,6,,7]),l=Date.now()/1e3,d=E(v),h=null,d&&"number"==typeof(y=JSON.parse(d))&&y>0&&(h=y),null!=h&&(h>l+w&&(h=l+w,C(v,JSON.stringify(h))),l<h)?(s(),[2]):(x="https://".concat(t,"/api/settings"),T=new URLSearchParams({token:L.token,platform:S,mode:L.mode,sdkVersion:c}).toString(),[4,fetch("".concat(x,"?").concat(T),{method:"GET"})]);case 2:return(O=o.sent()).ok?[3,4]:[4,ve(O)];case 3:throw o.sent();case 4:return[4,O.json()];case 5:return P=o.sent(),(null===(F=null==P?void 0:P.branding)||void 0===F?void 0:F.colors)&&(K=P.branding.colors,L.colors=n(n({},L.colors),K),C(u,JSON.stringify(L.colors))),(null===(j=null==P?void 0:P.branding)||void 0===j?void 0:j.locs)&&(Y=P.branding.locs,L.locs=n(n({},L.locs),Y),C(g,JSON.stringify(L.locs))),(null===(U=null==P?void 0:P.branding)||void 0===U?void 0:U.fonts)&&(G=P.branding.fonts,L.fonts=n(n({},L.fonts),G),C(p,JSON.stringify(L.fonts))),"number"!=typeof(null==P?void 0:P.recordRetentionAfterSecs)&&null!==(null==P?void 0:P.recordRetentionAfterSecs)||(z=P.recordRetentionAfterSecs,L.recordRetentionAfterSecs=z,C(f,JSON.stringify(L.recordRetentionAfterSecs))),"number"!=typeof(null==P?void 0:P.resetSessionAfterSecs)&&null!==(null==P?void 0:P.resetSessionAfterSecs)||(J=P.resetSessionAfterSecs,L.resetSessionAfterSecs=null!=J?J:28800,C(m,JSON.stringify(L.resetSessionAfterSecs))),"always"!==(null==P?void 0:P.sendPlayerRetention)&&"support-only"!==(null==P?void 0:P.sendPlayerRetention)&&"never"!==(null==P?void 0:P.sendPlayerRetention)||(q=P.sendPlayerRetention,L.sendPlayerRetention=q,C(b,L.sendPlayerRetention)),"number"==typeof(null==P?void 0:P.settingsPollIntervalSecs)&&P.settingsPollIntervalSecs>0&&(R=l+P.settingsPollIntervalSecs,_=Math.min(R,l+w),C(v,JSON.stringify(_))),s(),[3,7];case 6:return A=o.sent(),console.error("Error initializing SDK:",A),[3,7];case 7:return[2]}var q,J,z,G,Y,K})})},void 0),Oe=H("openSupport",oe,void 0),Ie=H("openAssistant",ie,void 0),Pe=H("openResource",function(e,n){var t="/resources/".concat(e);ce({path:t,config:n}),de({path:t,config:n})},void 0),Le=H("close",re,void 0),Re=H("getLanguage",function(){return L.language},null),_e=H("setLanguage",function(e){var n=L.language!==e;L.language=e,n&&(ue(),G({action:"widgetButtonTextUpdate",text:xe()}))},void 0),Ae=H("getSignedMetadataToken",function(){return L.signedMetadataToken},null),Ne=H("setSignedMetadataToken",function(e){var n=L.signedMetadataToken!==e;L.signedMetadataToken=e,Ee(),n&&(ue(),Se())},void 0),De=H("getPlayer",function(){return L.player},null),Me=H("setPlayer",function(e){var n,t=(null===(n=L.player)||void 0===n?void 0:n.id)!==(null==e?void 0:e.id);L.player=e,Ee(),t&&(ue(),Se())},void 0),Be=H("getTags",function(){return Array.from(L.tags)},[]),He=H("setTags",function(e){L.tags=new Set(e),ue()},void 0),Fe=H("addTag",function(e){L.tags.add(e),ue()},void 0),je=H("addTags",function(e){e.forEach(function(e){return L.tags.add(e)}),ue()},void 0),Ue=H("removeTag",function(e){L.tags.delete(e),ue()},void 0),qe=H("removeTags",function(e){e.forEach(function(e){return L.tags.delete(e)}),ue()},void 0),We=H("removeAllTags",function(){L.tags.clear(),ue()},void 0),Je=H("getFields",function(){return L.fields},{}),ze=H("setFields",function(e){L.fields=e,ue()},void 0),Ge=H("addField",function(e,n){L.fields[e]=n,ue()},void 0),Ye=H("addFields",function(e){L.fields=n(n({},L.fields),e),ue()},void 0),Ke=H("removeField",function(e){delete L.fields[e],ue()},void 0),Xe=H("removeFields",function(e){e.forEach(function(e){return delete L.fields[e]}),ue()},void 0),Ve=H("removeAllFields",function(){L.fields={},ue()},void 0),Ze=H("enableLogging",function(){L.loggingEnabled=!0},void 0),Qe=H("disableLogging",function(){L.loggingEnabled=!1},void 0),$e=H("isYoungPlayer",function(){return L.youngPlayer},!1),en=H("setYoungPlayer",function(e){L.youngPlayer=e,ue()},void 0),nn=H("isPrivacyMode",function(){return L.privacyMode},!1),tn=H("setPrivacyMode",function(e){L.privacyMode=e,ue()},void 0),on=H("isSupported",ae,!1),rn=H("requestNotificationPermission",function(){},void 0),an=H("enableNotifications",function(){L.notificationsPaused=!1,Y()},void 0),sn=H("disableNotifications",function(){L.notificationsPaused=!0},void 0),ln=H("getUnreadMessageCount",function(){return L.unreadMessageCount},0),dn=H("getUnansweredMessageCount",function(){return L.unansweredMessageCount},0),cn=H("getSdkVersion",function(){return c},""),un=H("reset",function(){L.youngPlayer=!1,L.privacyMode=!1,L.language=null,L.tags=new Set,L.fields={},L.signedMetadataToken=null,L.player=null,Ee(),ue(),G({action:"widgetButtonTextUpdate",text:xe()})},void 0),gn=H("recordRetention",function(){L.isRetentionRecordedForSession||he()},void 0),pn=H("addEventListener",se,void 0),fn=H("removeEventListener",function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];s.apply(void 0,e)},void 0),mn=H("iosSetKeyboardHeight",function(e){L.keyboardHeight=e,pe()},void 0);return e.addEventListener=pn,e.addField=Ge,e.addFields=Ye,e.addTag=Fe,e.addTags=je,e.close=Le,e.disableLogging=Qe,e.disableNotifications=sn,e.enableLogging=Ze,e.enableNotifications=an,e.getFields=Je,e.getLanguage=Re,e.getPlayer=De,e.getSdkVersion=cn,e.getSignedMetadataToken=Ae,e.getTags=Be,e.getUnansweredMessageCount=dn,e.getUnreadMessageCount=ln,e.initialize=Ce,e.iosSetKeyboardHeight=mn,e.isPrivacyMode=nn,e.isSupported=on,e.isYoungPlayer=$e,e.openAssistant=Ie,e.openResource=Pe,e.openSupport=Oe,e.recordRetention=gn,e.removeAllFields=Ve,e.removeAllTags=We,e.removeEventListener=fn,e.removeField=Ke,e.removeFields=Xe,e.removeTag=Ue,e.removeTags=qe,e.requestNotificationPermission=rn,e.reset=un,e.setFields=ze,e.setLanguage=_e,e.setPlayer=Me,e.setPrivacyMode=tn,e.setSignedMetadataToken=Ne,e.setTags=He,e.setYoungPlayer=en,e}({});
|