!function(){var e={669:function(e,t,n){e.exports=n(609)},448:function(e,t,n){"use strict";var i=n(867),s=n(26),r=n(372),o=n(327),a=n(97),c=n(109),u=n(985),l=n(61);e.exports=function(e){return new Promise((function(t,n){var p=e.data,d=e.headers;i.isFormData(p)&&delete d["Content-Type"];var f=new XMLHttpRequest;if(e.auth){var h=e.auth.username||"",m=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";d.Authorization="Basic "+btoa(h+":"+m)}var g=a(e.baseURL,e.url);if(f.open(e.method.toUpperCase(),o(g,e.params,e.paramsSerializer),!0),f.timeout=e.timeout,f.onreadystatechange=function(){if(f&&4===f.readyState&&(0!==f.status||f.responseURL&&0===f.responseURL.indexOf("file:"))){var i="getAllResponseHeaders"in f?c(f.getAllResponseHeaders()):null,r={data:e.responseType&&"text"!==e.responseType?f.response:f.responseText,status:f.status,statusText:f.statusText,headers:i,config:e,request:f};s(t,n,r),f=null}},f.onabort=function(){f&&(n(l("Request aborted",e,"ECONNABORTED",f)),f=null)},f.onerror=function(){n(l("Network Error",e,null,f)),f=null},f.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(l(t,e,"ECONNABORTED",f)),f=null},i.isStandardBrowserEnv()){var y=(e.withCredentials||u(g))&&e.xsrfCookieName?r.read(e.xsrfCookieName):void 0;y&&(d[e.xsrfHeaderName]=y)}if("setRequestHeader"in f&&i.forEach(d,(function(e,t){void 0===p&&"content-type"===t.toLowerCase()?delete d[t]:f.setRequestHeader(t,e)})),i.isUndefined(e.withCredentials)||(f.withCredentials=!!e.withCredentials),e.responseType)try{f.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&f.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&f.upload&&f.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){f&&(f.abort(),n(e),f=null)})),p||(p=null),f.send(p)}))}},609:function(e,t,n){"use strict";var i=n(867),s=n(849),r=n(321),o=n(185);function a(e){var t=new r(e),n=s(r.prototype.request,t);return i.extend(n,r.prototype,t),i.extend(n,t),n}var c=a(n(655));c.Axios=r,c.create=function(e){return a(o(c.defaults,e))},c.Cancel=n(263),c.CancelToken=n(972),c.isCancel=n(502),c.all=function(e){return Promise.all(e)},c.spread=n(713),c.isAxiosError=n(268),e.exports=c,e.exports.default=c},263:function(e){"use strict";function t(e){this.message=e}t.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},t.prototype.__CANCEL__=!0,e.exports=t},972:function(e,t,n){"use strict";var i=n(263);function s(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;e((function(e){n.reason||(n.reason=new i(e),t(n.reason))}))}s.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},s.source=function(){var e;return{token:new s((function(t){e=t})),cancel:e}},e.exports=s},502:function(e){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},321:function(e,t,n){"use strict";var i=n(867),s=n(327),r=n(782),o=n(572),a=n(185);function c(e){this.defaults=e,this.interceptors={request:new r,response:new r}}c.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=a(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[o,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)n=n.then(t.shift(),t.shift());return n},c.prototype.getUri=function(e){return e=a(this.defaults,e),s(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},i.forEach(["delete","get","head","options"],(function(e){c.prototype[e]=function(t,n){return this.request(a(n||{},{method:e,url:t,data:(n||{}).data}))}})),i.forEach(["post","put","patch"],(function(e){c.prototype[e]=function(t,n,i){return this.request(a(i||{},{method:e,url:t,data:n}))}})),e.exports=c},782:function(e,t,n){"use strict";var i=n(867);function s(){this.handlers=[]}s.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},s.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},s.prototype.forEach=function(e){i.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=s},97:function(e,t,n){"use strict";var i=n(793),s=n(303);e.exports=function(e,t){return e&&!i(t)?s(e,t):t}},61:function(e,t,n){"use strict";var i=n(481);e.exports=function(e,t,n,s,r){var o=new Error(e);return i(o,t,n,s,r)}},572:function(e,t,n){"use strict";var i=n(867),s=n(527),r=n(502),o=n(655);function a(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return a(e),e.headers=e.headers||{},e.data=s(e.data,e.headers,e.transformRequest),e.headers=i.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),i.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||o.adapter)(e).then((function(t){return a(e),t.data=s(t.data,t.headers,e.transformResponse),t}),(function(t){return r(t)||(a(e),t&&t.response&&(t.response.data=s(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},481:function(e){"use strict";e.exports=function(e,t,n,i,s){return e.config=t,n&&(e.code=n),e.request=i,e.response=s,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},185:function(e,t,n){"use strict";var i=n(867);e.exports=function(e,t){t=t||{};var n={},s=["url","method","data"],r=["headers","auth","proxy","params"],o=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function c(e,t){return i.isPlainObject(e)&&i.isPlainObject(t)?i.merge(e,t):i.isPlainObject(t)?i.merge({},t):i.isArray(t)?t.slice():t}function u(s){i.isUndefined(t[s])?i.isUndefined(e[s])||(n[s]=c(void 0,e[s])):n[s]=c(e[s],t[s])}i.forEach(s,(function(e){i.isUndefined(t[e])||(n[e]=c(void 0,t[e]))})),i.forEach(r,u),i.forEach(o,(function(s){i.isUndefined(t[s])?i.isUndefined(e[s])||(n[s]=c(void 0,e[s])):n[s]=c(void 0,t[s])})),i.forEach(a,(function(i){i in t?n[i]=c(e[i],t[i]):i in e&&(n[i]=c(void 0,e[i]))}));var l=s.concat(r).concat(o).concat(a),p=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===l.indexOf(e)}));return i.forEach(p,u),n}},26:function(e,t,n){"use strict";var i=n(61);e.exports=function(e,t,n){var s=n.config.validateStatus;n.status&&s&&!s(n.status)?t(i("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}},527:function(e,t,n){"use strict";var i=n(867);e.exports=function(e,t,n){return i.forEach(n,(function(n){e=n(e,t)})),e}},655:function(e,t,n){"use strict";var i=n(867),s=n(16),r={"Content-Type":"application/x-www-form-urlencoded"};function o(e,t){!i.isUndefined(e)&&i.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var a,c={adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(a=n(448)),a),transformRequest:[function(e,t){return s(t,"Accept"),s(t,"Content-Type"),i.isFormData(e)||i.isArrayBuffer(e)||i.isBuffer(e)||i.isStream(e)||i.isFile(e)||i.isBlob(e)?e:i.isArrayBufferView(e)?e.buffer:i.isURLSearchParams(e)?(o(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):i.isObject(e)?(o(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};i.forEach(["delete","get","head"],(function(e){c.headers[e]={}})),i.forEach(["post","put","patch"],(function(e){c.headers[e]=i.merge(r)})),e.exports=c},849:function(e){"use strict";e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),i=0;i=0)return;o[t]="set-cookie"===t?(o[t]?o[t]:[]).concat([n]):o[t]?o[t]+", "+n:n}})),o):o}},713:function(e){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},867:function(e,t,n){"use strict";var i=n(849),s=Object.prototype.toString;function r(e){return"[object Array]"===s.call(e)}function o(e){return void 0===e}function a(e){return null!==e&&"object"==typeof e}function c(e){if("[object Object]"!==s.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function u(e){return"[object Function]"===s.call(e)}function l(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),r(e))for(var n=0,i=e.length;n=3&&(t[n]+t[n-1]).length<=5;return t.splice(i?-3:-2).join(".")}catch(e){return null}}function n(e,t){let n=e||window.location.hostname;const i=t||!1;let s=0;if(n.includes(".co.")||n.includes(".com.")){const e=n.split(".");e[e.length-1].length<=3&&(s=1)}if(n=n.replace(/(https?:\/\/)?(www.)?/i,""),!i){const e=n.split(".");n=e.slice(e.length-(2+s)).join(".")}return-1!==n.indexOf("/")?n.split("/")[0]:n}return e&&(e.environment="production"===e.environment?"":e.environment),{getDomainName:n,getDefaultSubmissionUrl:function(){const t=e.recordUrlDomain;if(t||t?.length>0)return t;const{region:i}=e;let s=e?.environment;return s&&s?.length>0&&(s=`-${s}`),`https://cscript-${i}${s}.${n()}/cookiesapi/submit`},getSubmissionUrl:function(){const t=""===e.environment?"":`-${e.environment}`,n=window?.cassieResourceRootDomain??"cassiecloud.com";return`https://cscript-${e.region}${t}.${n}/cookiesapi/submit`},determineJsonUrl:function(){return`${e.baseUrl}/${e.licenseKey}/V2/${e.profileSettings.WidgetId}_${e.languageCode}.json`},checkDomain:function(e){if("all"===e||"N/A"===e)return!0;const n=e.trim().split(",");for(let e=0;e{s().get(e).then((e=>{t(e.data)})).catch((e=>{n(e)}))}))},o=function(e,t){return new Promise(((n,i)=>{s().get(e,t).then((e=>{n(e.data)})).catch((e=>{i(e)}))}))},a=function(e,t,n){return new Promise(((i,r)=>{try{s().post(e,t,n).then((e=>{i(e.data)})).catch((e=>{r(e)}))}catch(e){r(e)}}))},c=async function(e,t,n,i,s,r,a,c,u,l,p,d){const f=`${u}/Home/SaveConsent?accessKey=${t}&domain=${l}&consentedCookieIds=${n}&cookieFormConsent=${i}&runFirstCookieIds=${s}&privacyCookieIds=${r}&custom1stPartyData=${a}&privacyLink=${c}${p?`&userProfile=${p}`:""}&cookieCollectionId=${d}&expiryDays=${e}`,h=await o(f,{withCredentials:!0});return JSON.parse(h.CassieConsent)},u=async function(e,t,n,i,s,r){const a=`${i}/Home/Index?accessKey=${t}&domain=${n}${s?`&userProfile=${s}`:""}&cookieCollectionId=${r}&expiryDays=${e}`;return await o(a,{withCredentials:!0})},l=async function(e,t,n){const i=`${n}/Home/CdcPropagate?accessKey=${e}&domain=${t}`;return await o(i,{withCredentials:!0})},p=function(){return/Trident\/|MSIE/.test(window.navigator.userAgent)};function d(e){return e&&"string"==typeof e&&""!==e.trim()?e.split(".").map((e=>{const t=e.split("-");if(2!==t.length)return null;const n=t[0].match(/s(\d+)c(\d+)/);return n?{FieldID:`s${n[1]}_c${n[2]}`,IsChecked:parseInt(t[1],10)}:null})).filter((e=>null!==e)):[]}function f(e){try{return JSON.parse(e),!0}catch(e){return!1}}var h=class{constructor(e,t=null){this.accessKey=e,this.cookies=this.getAllCookies(),this.defaultCookieExpiry=t??365,this.maxTimeout=2e3}getAllCookies(){for(var e={},t=document.cookie.split(";"),n=1;n<=t.length;n++){var i=t[n-1].split("="),s=i[0],r=i[1];void 0!==s&&s.length>0&&(s=s.trim()),void 0!==r&&r.length>0&&(r=r.trim()),e[s]=r}return e}getCookieValueByName=function(e){const t=`; ${document.cookie}`.split(`; ${e}=`);return 2===t.length?t.pop().split(";").shift().trim():null};sleep(e){return new Promise((t=>setTimeout(t,e)))}getProtectedCookieByName=function(e,t,n=2e3){return new Promise((async i=>{let s=n/100;for(let n=1;n{let t=e.browserCookieName.trim().toLowerCase(),n=[];return t.includes(",")?n=t.split(",").map((e=>e.trim())):n.push(t),n.includes(r.toLowerCase())}));if(o&&0!=o?.expiry){var s=new Date;s.setDate(s.getDate()+o.expiry),i.push(this.getProtectedCookieByName(r,s.getTime().toString(),this.maxTimeout))}}return i=(await Promise.all(i)).filter((e=>e)),i.filter((e=>e))};recreateProtectedCookies(){try{const e=this.getCookieValueByName("SyrenisCustom_"+this.accessKey);let t=[];t=f(e)?JSON.parse(e):function(e){if(!e||"string"!=typeof e||""===e.trim())return[];let t=null;try{t=function(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");for(;t.length%4!=0;)t+="=";return decodeURIComponent(Array.from(atob(t)).map((e=>`%${e.charCodeAt(0).toString(16).padStart(2,"0")}`)).join(""))}(e)}catch(e){return console.error("Error decoding base64 string:",e),[]}return t.split("|$|").map((e=>{const t=e.split("|*|");return{Key:t[0],Value:t[1],Expiry:t[2]}}))}(e);for(let e=0;e0&&t[0].FieldID?(c=t)&&Array.isArray(c)&&0!==c.length?c.map((e=>`${e.FieldID.replace("_","")}-${e.IsChecked}`)).join("."):"":Array.isArray(t)&&t.length>0&&t[0].Key?function(e){return e&&Array.isArray(e)&&0!==e.length?(t=e.map((e=>`${e.Key}|*|${e.Value}|*|${e.Expiry}`)).join("|$|"),btoa(Array.from((new TextEncoder).encode(t)).map((e=>String.fromCharCode(e))).join("")).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")):"";var t}(t):e.includes("GtmConsent")?function(e){return e&&Array.isArray(e)&&0!==e.length?e.map((e=>Object.entries(e).map((([e,t])=>`${e}:${t}`)).join("|"))).join("|"):""}(t):JSON.stringify(t):"object"==typeof t&&(a=JSON.stringify(t));let u=e+"="+a+";"+r+o+";path=/";document.cookie=u};storeCookieWithTimeExpiry=function(e,t,n,i){let s=new Date;s.setTime(i);let r=e+"="+t+";expires="+s.toUTCString()+";domain="+(n=n??window.document.domain)+";path=/";document.cookie=r};hasConsent=function(){let e=this.getAllCookies(),t=e["SyrenisCookieFormConsent_"+this.accessKey],n=e["SyrenisGuid_"+this.accessKey];return!(!t||!n)};getVisitGuid=function(){return this.getCookieValueByName("SyrenisGuid_"+this.accessKey)};getConsentDate=function(){let e=this.getCookieValueByName("SyrenisCookieConsentDate_"+this.accessKey);return e||(e=new Date(1970,0,1).getTime()),e};getPrivacyPolicyId=function(){let e=this.getCookieValueByName("SyrenisCookiePrivacyLink_"+this.accessKey);return e&&0!=e.length?e:null};getProtectedCookiesContainer=function(){return this.getCookieValueByName("SyrenisCustom_"+this.accessKey)}};let m,g,y;function C(e){const t=e.split(",").map((e=>e.trim().replace("*","").replace("https://","").replace("http://",""))).filter((e=>(e||e.length>0)&&"all"!==e.trim())).map((e=>e.trim().replace("*","")));return 0===t.length&&t.push(`.${document.domain}`),t}var S=function(e,n){function i(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))}function s(e){e.sort(((e,t)=>e.executionOrder-t.executionOrder)),e.sort(((e,t)=>t.isRunFirst-e.isRunFirst)),e.forEach((e=>{e.isStrictlyNecessary||(e.isOptIn?(t(e.bodyOptIn,!1),t(e.headOptIn,!0)):(t(e.bodyOptOut,!1),t(e.headOptOut,!0)))}))}function r(e){for(const[t,n]of Object.entries(e))C(g.supportedDomains).forEach((e=>{m.storeCookie(t.replace("Cassie","Syrenis"),n,e)}))}function o(e,t){e.forEach((e=>{const n=t.find((t=>t.channelId==e.channelId));e.isStrictlyNecessary?(e.hasConsent=!0,e.isOptIn=!0):n&&(e.hasConsent=!0,e.isOptIn=n.isOptIn)})),s(e.filter((e=>e.hasConsent)))}return g=e,y=n,m=new h(g.profileSettings.AccessKey,y),{runStrictlyNecessaryScripts:function(e){e.sort(((e,t)=>e.executionOrder-t.executionOrder)),e.sort(((e,t)=>t.isRunFirst-e.isRunFirst)),e.forEach((e=>{e.isStrictlyNecessary&&(t(e.bodyOptIn,!1),t(e.headOptIn,!0))}))},runOptInScripts:s,placeSyrenisCookies:r,processConsent:async function(e,t,n){const s=g.profileSettings.AccessKey,a=e.map((e=>({FieldID:`s${e.statementId}_c${e.channelId}`,IsChecked:e.isOptIn?1:0})));this.runStrictlyNecessaryScripts(t),o(t,e);const u=await m.getProtectedCookies(n.persistCookies,t);g.identityServiceUrl?r(await c(y,s,JSON.stringify([]),JSON.stringify(a),JSON.stringify([]),JSON.stringify([]),JSON.stringify(u),n.privacyId,g.identityServiceUrl,g.supportedDomains,g.crossDomainConsent,g?.profileSettings?.CookieCollectionId??1)):function(e,t){let n=g.profileSettings.AccessKey,s=C(g.supportedDomains);var r=i(),o=(new Date).getTime();s.forEach((i=>{null===m.getCookieValueByName("SyrenisGuid_"+n)&&m.storeCookie("SyrenisGuid_"+n,r,i),m.storeCookie("SyrenisCookieFormConsent_"+n,e,i),m.storeCookie("SyrenisCookiePrivacyLink_"+n,t,i),m.storeCookie("SyrenisCookieConsentDate_"+n,o,i)}))}(a,n.privacyId)},runConsent:async function(e){let t=g?.profileSettings?.CookieCollectionId??1;if(g.identityServiceUrl&&await async function(e){let t=(!m.hasConsent()||g.crossDomainConsent)&&await u(y,g.profileSettings.AccessKey,g.supportedDomains,g.identityServiceUrl,g.crossDomainConsent,e);if(null!==t){const e=JSON.parse(t.CassieConsent),n=t.Restored,i="boolean"!=typeof e&&e;if(i&&r(i),!1===n&&g.crossDomainConsent){const e=await l(g.profileSettings.AccessKey,g.supportedDomains,g.identityServiceUrl);document.getElementsByTagName("body")[0].insertAdjacentHTML("beforeend",e)}}}(t),!m.hasConsent())return;const n=m.getCookieValueByName("SyrenisCookieFormConsent_"+g.profileSettings.AccessKey);let i;try{i=f(n)?JSON.parse(n):d(n)}catch(e){return void console.error("Error parsing cookie consent:",e)}let s=i.map((e=>{let t=e.FieldID.indexOf("c")+1;return{channelId:e.FieldID.substring(t,e.FieldID.length),isOptIn:1==e.IsChecked}}));m.recreateProtectedCookies(),this.runStrictlyNecessaryScripts(e),o(e,s)},getCurrentConsent:function(){let e=m.getFormConsent(),t=[];for(let n=0;n{let c={CookieFormID:g?.profileSettings?.WidgetId??null,LicenseID:g?.licenseKey,DivID:s,Preferences:m.getFormConsent(),appCodeName:navigator.appCodeName,appName:navigator.appName,appVersion:navigator.appVersion,cookieEnabled:navigator.cookieEnabled,geolocation:"",language:navigator.language,platform:navigator.platform,referrer:document.referrer.replace(/&/g,"%26"),submissionSource:t??"undefined_source",visitGUID:m.getVisitGuid()??i(),WebsiteURL:document.URL.replace(/&/g,"%26"),PrivacyPolicyID:n,custom1stPartyData:m.getProtectedCookiesContainer()};try{return r(await a(e,c,{timeout:5e3}))}catch(e){return o(e)}}))},dropStrictlyNecessaryCookies:function(e,t){let n=g.profileSettings.AccessKey,s=C(g.supportedDomains);var r=i(),o=(new Date).getTime();s.forEach((t=>{null===m.getCookieValueByName("SyrenisGuid_"+n)&&m.storeCookie("SyrenisGuid_"+n,r,t),m.storeCookie("SyrenisCookiePrivacyLink_"+n,e,t),m.storeCookie("SyrenisCookieConsentDate_"+n,o,t)})),this.runStrictlyNecessaryScripts(t)},saveGtmConsent:function(e){let t=g.profileSettings.AccessKey,n=C(g.supportedDomains),i=e;n.forEach((e=>{m.storeCookie("SyrenisGtmConsent_"+t,i,e)}))}}},v={emit:function(e,t){!function(e,t){const n=t||{bubbles:!0,cancelable:!1},i=document.createEvent("CustomEvent");i.initCustomEvent(e,n.bubbles,n.cancelable,n.detail),document.dispatchEvent(i)}(e,{detail:t,bubbles:!0,cancelable:!0})}};window.CassieWidget=class{constructor(t){this.eventManager=v,this.datetimestamp=(new Date).getTime(),this.domain=(new e).getDomainName();let n=t.languageCode??"";(t.profileSettings?.SupportedLanguages??[]).includes(n)&&""!==n||(n="Default"),this.cassieSettings=function(e,t,n,i,s,r,o,a,c,u,l){return{licenseKey:e,profileSettings:t,baseUrl:n,languageCode:i,supportedDomains:s,environment:r,region:o,recordUrlDomain:a,identityServiceUrl:c,crossDomainConsent:u,customOptions:l}}(t.licenseKey,t.profileSettings,t.baseUrl,n,t.supportedDomains??`*.${this.domain}`,t.environment,t.region,t.recordUrlDomain,t.identityServiceUrl,t.crossDomainConsent,t.customOptions),this.cassieSettings.profileSettings?.TemplateOptions||(this.cassieSettings.profileSettings.TemplateOptions={},this.cassieSettings.profileSettings.TemplateOptions.PreBannerPosition=this.cassieSettings.profileSettings?.TemplateOptions?.PreBannerPosition??1,this.cassieSettings.profileSettings.TemplateOptions.WidgetPosition=this.cassieSettings.profileSettings?.TemplateOptions?.WidgetPosition??2),this.urlHelper=new e(this.cassieSettings),this.cookieWidgetDivId="cassie-widget",this.cassieScripts=[],this.widgetTemplate={},this.cassieWidgetFileSettings=null,this.gpcEnabled=(t.profileSettings.GpcEnabled&&navigator.globalPrivacyControl)??!1,this.bannerIsVisible=!1,this.modalIsVisible=!1,this.handlerUrl=this.urlHelper.getSubmissionUrl(),this.forceReconsent=!1,this.extentions=[{event:"Sample",extentionFunction:function(){}}],this.init()}async init(){this.createWidgetElement(),await this.getWidgetJson(),this.cassieWidgetFileSettings.identityServiceUrl&&!this.cassieSettings?.customOptions?.isPreview&&(this.cassieSettings.identityServiceUrl=this.cassieWidgetFileSettings.identityServiceUrl),this.cassieSettings?.crossDomainConsent&&this.cassieWidgetFileSettings.identityServiceUrlPrefix&&(this.cassieSettings.identityServiceUrl=`https://${this.cassieWidgetFileSettings.identityServiceUrlPrefix}.${this.domain}`),this.syrenisHelper=new S(this.cassieSettings,this.cassieWidgetFileSettings.CassieCookiesExpiry),this.cookieHelper=new h(this.cassieSettings.profileSettings.AccessKey,this.cassieWidgetFileSettings.CassieCookiesExpiry);const e=this.cassieWidgetFileSettings.reconsentDate.toString(),t=e.endsWith("Z")?new Date(e):new Date(`${e}Z`);this.forceReconsent=t.getTime()>this.cookieHelper.getConsentDate()&&this.cookieHelper.hasConsent(),!this.forceReconsent&&await this.syrenisHelper.runConsent(this.cassieScripts),this.widgetTemplate.hasConsent=this.cookieHelper.hasConsent()&&!this.forceReconsent,this.widgetTemplate.useRadioButtons=this.cassieSettings.profileSettings.UseRadioButtons??!1,this.widgetTemplate.hasConsent||this.dropCookiesOnLoad(),await this.getTemplateFiles(),v.emit("CassieTemplateFilesLoaded")}registerExtention(e,t){this.extentions.push({event:e,extentionFunction:t})}runExtentions(e){const t=this.extentions.filter((t=>t.event===e));for(const e of t)e.extentionFunction()}dropCookiesOnLoad(){const e="auto_save",t=this.widgetTemplate.CookieDropBehaviourType??1;if(3===t)this.acceptAll(e);else if(2===t){const e=this.cookieHelper.getPrivacyPolicyId()??this.cassieWidgetFileSettings.privacyId;this.syrenisHelper.dropStrictlyNecessaryCookies(e,this.cassieScripts)}else if(4===t)this.acceptAll({respectGpc:!0,source:e});else if(1===t)return}getCurrentConsent(){return this.syrenisHelper.getCurrentConsent()}getGtmConsent(){const e=this.syrenisHelper.getCurrentConsent(),t=this.cassieScripts.filter((e=>null!==e.gtmConsentType&&""!==e.gtmConsentType)).reduce(((e,t)=>{const n=t.gtmConsentType;return e[n]||(e[n]=[]),e[n].push(t.channelId),e}),{});return Object.keys(t).map((n=>{const i=t[n].every((t=>e.find((e=>e.channelId==t))?.isOptIn))?"granted":"denied",s={};return s[n]=i,s}))}storeGtmConsent(){const e=this.getGtmConsent();e.length>0&&this.syrenisHelper.saveGtmConsent(e)}initializeTemplate(){v.emit("CassieTemplateInitialized")}hideBanner(){this.runExtentions("hideBanner"),this.bannerIsVisible=!1,v.emit("CassieBannerVisibility",!1)}showBanner(){this.runExtentions("showBanner"),this.bannerIsVisible=!0,v.emit("CassieBannerVisibility",!0)}showModal(){this.runExtentions("showModal"),this.modalIsVisible=!0,v.emit("CassieModalVisibility",!0)}hideModal(){this.runExtentions("hideModal"),this.modalIsVisible=!1,v.emit("CassieModalVisibility",!1)}getPreferences(){const e=this.widgetTemplate.Categories,t=[];return e.forEach((e=>{const n=e.Cookies.map((e=>({channelId:e.ChannelID,gpcEnabled:e.GpcEnabled,statementId:e.Statements[0].StatementID,isOptIn:e.DefaultValue})));t.push(...n)})),t}async submitConsent(e,t){if(v.emit("CassieSubmitConsent",e),await this.syrenisHelper.processConsent(e,this.cassieScripts,this.cassieWidgetFileSettings),this.storeGtmConsent(),this.widgetTemplate.hasConsent=!0,v.emit("CassieProcessedConsent",e),this.handlerUrl)try{const n=this.cookieHelper.getPrivacyPolicyId()??this.cassieWidgetFileSettings.privacyId;this.syrenisHelper.postConsentToCassie(this.handlerUrl,t,n,this.cookieWidgetDivId).then((t=>(v.emit("CassieSubmittedConsent",e),t))).catch((async()=>{const i=await this.syrenisHelper.postConsentToCassie(this.defaultSubmissionUrl,t,n,this.cookieWidgetDivId);return v.emit("CassieSubmittedConsent",e),i}))}catch(e){return console.error(e),e}}addConsentListener(e){document.addEventListener("CassieProcessedConsent",e)}hasConsent(){return this.widgetTemplate.hasConsent=this.cookieHelper.hasConsent(),this.widgetTemplate.hasConsent}acceptAll(e){if("string"==typeof e||null==e){var t=e;(e={}).source=t,e.respectGpc=!1}let n=this.getPreferences();n.forEach((t=>{t.isOptIn=!0,e.respectGpc&&this.gpcEnabled&&t.gpcEnabled&&(t.isOptIn=!1)})),this.submitConsent(n,e.source)}rejectAll(e){const t=this.getPreferences();t.forEach((e=>e.isOptIn=!1)),this.submitConsent(t,e)}createWidgetElement(){if(!this.cassieSettings.profileSettings.LoadTemplateHtml)return;const e=this.cookieWidgetDivId;if(null===document.getElementById(e)||0===document.getElementById(e).length){const t=document.createElement("div");t.setAttribute("id",e),t.style.display="none",t.classList.add("syrenis-cookie-widget"),document.body.appendChild(t)}}async getWidgetJson(){const e=this.urlHelper.determineJsonUrl(),t=await r(e);this.populateWidget(t),v.emit("CassieWidgetFileLoaded",null)}async getTemplateFiles(){const e=`${this.cassieSettings.baseUrl}/templates/${this.cassieSettings.profileSettings.Template}/`;if(this.cassieSettings.profileSettings.LoadTemplateCss&&this.AddCssToPage(`${e}template.min.css`),this.cassieSettings.profileSettings.LoadTemplateHtml){const t=await r(`${e}index.min.html`);this.loadHtmlToElement(this.cookieWidgetDivId,t)}if(this.cassieSettings.profileSettings.LoadTemplateJs){const t=await r(`${e}template.min.js`);this.loadScriptToDOM(t)}}AddCssToPage(e){const{head:t}=document,n=document.createElement("link");n.type="text/css",n.rel="stylesheet",n.href=e,t.insertBefore(n,t.childNodes[0])}loadHtmlToElement(e,t){const n=document.getElementById(e);n.innerHTML=t;const i=document.getElementsByTagName("body")[0];i.insertBefore(n,i.firstChild)}loadScriptToDOM(e){const t=document.createElement("script");t.innerHTML=e,document.body.appendChild(t)}populateWidget(e){if(this.cassieWidgetFileSettings=new class{constructor(e){this.persistCookies=e.Custom1stPartyData?.length>0?e.Custom1stPartyData:[],this.privacyId=function(e){if(!e)return 1;const t=e.substring(0,e.length-1).split("|"),n=[];for(let e=0;e!1===e.Default));return i?i.PrivacyId:1}(e.Template.PrivacyPolicies),this.identityServiceUrl=e.IdentityServiceEndpoint??null,this.reconsentDate=e.ReconsentDate??"1970-01-01T00:00:00.000Z",this.cookieCollectionId=e.CookieCollectionId??1,this.identityServiceUrlPrefix=e.IdentityServiceUrlPrefix??null,this.CassieCookiesExpiry=e.CassieCookiesExpiry??365}}(e),e.Scripts.forEach((e=>{const t=new class{constructor(e){this.cookieId=e.CookieID,this.scriptName=e.CookieName,this.scriptDescription=e.CookieDescription??new String(""),this.isStrictlyNecessary=e.IsStrictlyNecessary??!1,this.isRunFirst=e.IsRunFirst??!1,this.executionOrder=e.ExecutionOrder??100,this.bodyOptIn=e.CookieBodyDivID,this.bodyOptOut=e.CookieBodyDivIDOptOut,this.headOptIn=e.CookieScript,this.headOptOut=e.CookieScriptOptOut,this.cookieUrl=e.CookieURL,this.channelId=e.ChannelID,this.expiry=e.Expiry,this.browserCookieName=e.BrowserCookieName,this.gtmConsentType=e.GtmConsentType}CreateScript(e){this.cookieId=e.cookieId,this.scriptName=e.scriptName,this.scriptDescription=e.scriptDescription,this.isStrictlyNecessary=e.isStrictlyNecessary,this.isRunFirst=e.isRunFirst,this.executionOrder=e.executionOrder,this.bodyOptIn=e.bodyOptIn,this.bodyOptOut=e.bodyOptOut,this.headOptIn=e.headOptIn,this.headOptOut=e.headOptOut,this.cookieUrl=e.cookieUrl,this.channelId=e.channelID,this.gtmConsentType=e.gtmConsentType}}(e);this.cassieScripts.push(t)})),!(e.AccessKeys?.split(",").map((e=>e.toLowerCase().trim()))??[]).includes(this.cassieSettings.profileSettings.AccessKey.toLowerCase().trim())&&"n/a"!==this.cassieSettings.profileSettings.AccessKey&&!this.cassieSettings?.customOptions?.isPreview)throw new Error(`Access Key: ${this.cassieSettings.profileSettings.AccessKey}\n can't access widget with id: ${this.cassieSettings.widgetId}`);const t=e.SupportedDomains;if(t&&!this.urlHelper.checkDomain(t)&&!this.cassieSettings?.customOptions?.isPreview)throw new Error(`Not supported domain: ${this.domain} the supported domains are ${t}.\n Please add this domain to your Cassie system`);this.cassieSettings.supportedDomains=t,this.widgetTemplate=e.Template,this.widgetTemplate.strictlyNecessary=e.Scripts.filter((e=>e.IsStrictlyNecessary)).map((e=>({cookieName:e.CookieName,cookieDescription:e.CookieDescription}))),this.widgetTemplate.Services=e.Scripts}}}()}();