"}getUiOutput(){const e=window.HotelwizeApp.Resources[this.plugin.assemblyName];return`\n
`}renderTableRows(){const e=window.HotelwizeApp.Resources[this.plugin.assemblyName];let t="";for(const[n,o]of Object.entries(this.TrackerCategories)){const i=o,r=i==a.Trackers.TrackingCategory.Required,c=i==a.Trackers.TrackingCategory.Required||this.plugin.hasConsent(i),s=this.plugin.getCookiesListByTrackingCategory(i);0!==s.length&&(t+=` `)}return t}renderSwitch(e,t=!1,n=!1){const o=n?" checked":"",i=t?" disabled":"";return``}getCookiesList(e){const t=window.HotelwizeApp.Resources[this.plugin.assemblyName];let n=' ",n}convertToTime(e){const t=window.HotelwizeApp.Resources[this.plugin.assemblyName];if(!e)return e.toString();const n=e/3600;return n<=24?`${n} ${t.CookieDurationHours}`:`${Math.round(n/24)} ${t.CookieDurationDays}`}clickEventsSetup(){const e=document.getElementsByClassName("cookie-consent-bar-open"),t=document.getElementsByClassName("cookie-consent-bar-close"),n=document.getElementById("cookie-consent-bar-customize"),o=document.getElementsByClassName("cookie-consent-disable-all"),i=document.getElementsByClassName("cookie-consent-allow-all"),r=document.getElementsByClassName("cookie-consent-toggle"),a=document.getElementsByClassName("cookie-consent-checkbox"),c=document.getElementsByClassName("view-cookies");null!=e&&Array.from(e).forEach((e=>{e.addEventListener("click",(()=>{this.showConsentBar(200)}))})),null!=t&&Array.from(t).forEach((e=>{e.addEventListener("click",(()=>{this.hideConsentBar(200),this.setClientSettingsClose(!0)}))})),null!=n&&n.addEventListener("click",(()=>{this.consentBarWrapper.style.display="none",this.consentSettingsWrapper.style.display="block"})),null!=i&&Array.from(i).forEach((e=>{e.addEventListener("click",(()=>{this.toggleAllCookies(!0),this.hideConsentBar(750)}))})),null!=o&&Array.from(o).forEach((e=>{e.addEventListener("click",(()=>{this.toggleAllCookies(!1),this.hideConsentBar(750)}))})),null!=r&&Array.from(r).forEach((e=>{e.addEventListener("click",(e=>{if(null!=e.target){const t=e.target;Array.from(r).forEach((t=>{null!=t&&t!==e.target&&t.parentNode.classList.remove("active")}));const n=t.parentNode.classList;n.contains("active")?n.remove("active"):n.add("active")}}))})),null!=a&&Array.from(a).forEach((e=>{e.addEventListener("change",(e=>{if(null!=e.target){const t=e.target,n=this.TrackerCategories[t.name],o=t.checked;this.plugin.setStoreTrackingPreference(n,o),this.plugin.acceptRevokeTrackingCategory(n,o),this.plugin.logUserConsent(),this.setClientSettingsClose(!0)}}))})),null!=c&&Array.from(c).forEach((e=>{e.addEventListener("click",(e=>{if(null!=e&&null!=e.target){e.preventDefault();const t=e.target,n=t.nextElementSibling.classList;n.contains("opened")?(t.classList.remove("active"),n.remove("opened")):(t.classList.add("active"),n.add("opened"))}}))}))}toggleAllCookies(e=!0){for(const[t,n]of Object.entries(this.TrackerCategories)){const o=n;if(0===this.plugin.getCookiesListByTrackingCategory(n).length||"required"===n)continue;try{document.getElementById(`cookie-consent-category-switch-${o.toLowerCase()}`).checked=e}catch(e){}const i=this.TrackerCategories[t];this.plugin.setStoreTrackingPreference(i,e),this.plugin.acceptRevokeTrackingCategory(i,e)}this.plugin.logUserConsent(),this.setClientSettingsClose(!0)}setClientSettingsClose(e=!0){this.plugin.clientSettings.cookieConsentClosed=e,this.plugin.saveClientSettings()}}},727:function(e,t,n){var o=this&&this.__createBinding||(Object.create?function(e,t,n,o){void 0===o&&(o=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,o,i)}:function(e,t,n,o){void 0===o&&(o=n),e[o]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&o(t,e,n);return i(t,e),t},a=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function a(e){try{s(o.next(e))}catch(e){r(e)}}function c(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((o=o.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.CookieConsent=void 0;const c=r(n(382)),s=r(n(371)),l=n(380),u=n(597),d=n(578),h=n(950);class m extends s.Plugins.Plugin{constructor(e){var t;super(e),this.endPointUrl=null===(t=null==e?void 0:e.configuration)||void 0===t?void 0:t.consentLogEndpointUrl,this.trackingPreferences=new Map,this.loadTrackingPreferences();let n=new s.Trackers.Tracker;n.name="Cookie Consent",n.isRequired=!0,n.plugin=this,n.priority=999;let o=new s.Cookies.Cookie;o.name=`${this.assemblyName}.TrackingPreferences`,o.maxLifeTime=2592e3,o.storageType=s.Cookies.CookieStorageType.LocalStorage,o.purpose=s.Trackers.TrackingCategory.Required,o.isThirdParty=!1,n.cookies.push(o),this.trackers.push(n)}initialize(){}processPopup(){new h.CookieConsentUI(this).init()}onWindowLoaded(){return a(this,void 0,void 0,(function*(){}))}loadTrackingPreferences(){var e=new s.Support.LocalStorage;if(e.isSupported()){let t=e.getItem(`${this.assemblyName}.TrackingPreferences`);this.trackingPreferences=null==t?new Map:t}}setStoreTrackingPreference(e,t){this.trackingPreferences.set(e,t),this.storeTrackingPreferences()}storeTrackingPreferences(){var e=new s.Support.LocalStorage;e.isSupported()&&e.setItem(`${this.assemblyName}.TrackingPreferences`,this.trackingPreferences,2592e3)}hasConsent(e){var t;return!!this.trackingPreferences.has(e)&&null!==(t=this.trackingPreferences.get(e))&&void 0!==t&&t}run(e){return a(this,void 0,void 0,(function*(){this.visitorId=yield this.getVisitorId(),this.registeredPlugins=e;let t=this.filterPurgeCookies(e);yield this.runAcceptedTrackers(t),this.processPopup()}))}runAcceptedTrackers(e){return a(this,void 0,void 0,(function*(){e.sort(((e,t)=>e.priority>t.priority||e.priority===t.priority&&e.isRequired>t.isRequired?1:-1)),yield e.forEach((e=>a(this,void 0,void 0,(function*(){var t;try{(null===(t=e.plugin)||void 0===t?void 0:t.isPageActive)&&(yield e.onAccept(e.plugin,e,this.getAcceptedTrackingCategories()))}catch(t){null===console||void 0===console||console.error(`Error thrown while running onAccept event for ${e.name}`,t)}}))))}))}filterPurgeCookies(e){let t=new s.Support.CookieStorage,n=new s.Support.LocalStorage,o=new s.Support.SessionStorage,i=t.getKeys(),r=n.getKeys(),a=o.getKeys(),c=[],l=[],u=[];const d=this.getAcceptedTrackingCategories();let h=[];return window.HotelwizeApp.RegisteredThemeCookies.forEach((e=>{if(null!=e.name)switch(e.storageType){case s.Cookies.CookieStorageType.HttpCookie:c.push(e.name);break;case s.Cookies.CookieStorageType.LocalStorage:l.push(e.name);break;case s.Cookies.CookieStorageType.SessionStorage:u.push(e.name)}})),e.forEach((e=>{null!=e.cookies&&e.cookies.forEach((e=>{if(null!=e.name)switch(e.storageType){case s.Cookies.CookieStorageType.HttpCookie:c.push(e.name);break;case s.Cookies.CookieStorageType.LocalStorage:l.push(e.name);break;case s.Cookies.CookieStorageType.SessionStorage:u.push(e.name)}})),e.trackers.forEach((t=>{let n=!1;if(null!=t.cookies){const e=t.cookies.filter((e=>e.isSystemCookie));t.cookies.length==e.length?n=!0:t.cookies.forEach((e=>{if(!e.isSystemCookie&&d.includes(e.purpose)&&(n=!0,null!=e.name))switch(e.storageType){case s.Cookies.CookieStorageType.HttpCookie:c.push(e.name);break;case s.Cookies.CookieStorageType.LocalStorage:l.push(e.name);break;case s.Cookies.CookieStorageType.SessionStorage:u.push(e.name)}}))}n&&(t.plugin=e,h.push(t))}))})),i.forEach((e=>{let n=!1;""!=e&&(c.forEach((t=>{n||e!==t&&!s.Support.StringHelpers.matchRuleShort(e,t)||(n=!0)})),n||(null===console||void 0===console||console.info(`Removing http cookie: ${e}`),t.removeItem(e)))})),r.forEach((e=>{let t=!1;""!=e&&(l.forEach((n=>{t||e!==n&&!s.Support.StringHelpers.matchRuleShort(e,n)||(t=!0)})),t||(null===console||void 0===console||console.debug(`Removing local storage cookie: ${e}`),n.removeItem(e)))})),a.forEach((e=>{let t=!1;""!=e&&(u.forEach((n=>{t||e!==n&&!s.Support.StringHelpers.matchRuleShort(e,n)||(t=!0)})),t||(null===console||void 0===console||console.debug(`Removing sesion storage cookie: ${e}`),o.removeItem(e)))})),h}getTrackersOfCategory(e){let t=[];return this.registeredPlugins.forEach((n=>{n.trackers.forEach((o=>{let i=!1;o.cookies.forEach((t=>{i||t.purpose!==e||(i=!0)})),i&&(o.plugin=n,t.push(o))}))})),t}acceptRevokeTrackingCategory(e,t){return a(this,void 0,void 0,(function*(){const n=this.getTrackersOfCategory(e),o=this.getAcceptedTrackingCategories();yield n.forEach((e=>a(this,void 0,void 0,(function*(){if(void 0!==e.plugin&&null!=e.plugin&&e.plugin.isPageActive)try{t?yield e.onAccept(e.plugin,e,o):yield e.onRevoke(e.plugin,e,o)}catch(e){null===console||void 0===console||console.error(e)}})))),this.filterPurgeCookies(this.registeredPlugins)}))}getCookiesListByTrackingCategory(e){let t=[],n=window.HotelwizeApp.getTrackersByCategory(e);return e===s.Trackers.TrackingCategory.Required&&(window.HotelwizeApp.RegisteredThemeCookies.forEach((e=>{null!=e.name&&t.push(e)})),window.HotelwizeApp.RegisteredPlugins.forEach((e=>{null!=e.cookies&&e.cookies.forEach((e=>{null!=e.name&&t.push(e)}))}))),n.forEach((e=>{e.cookies.forEach((n=>{n.tracker=e,t.push(n)}))})),t}getVisitorId(){return a(this,void 0,void 0,(function*(){const e=yield c.load();return(yield e.get()).visitorId}))}getAcceptedTrackingCategories(){let e=[];return this.trackingPreferences.forEach(((t,n)=>{!0===t&&e.push(n)})),e.includes(s.Trackers.TrackingCategory.Required)||e.push(s.Trackers.TrackingCategory.Required),e}getCookiePolicyPageLink(){let e=this.configuration,t="#";try{(null==e?void 0:e.cookiePolicyPageUrl)&&(t=null==e?void 0:e.cookiePolicyPageUrl)}catch(e){}return t}logUserConsent(){if(void 0===this.endPointUrl||""==this.endPointUrl)return void(null===console||void 0===console||console.error("Cookie Consent Log Endpoint URL is invalid"));const e=[],t=this.getAcceptedTrackingCategories(),n=new l.ConsentLogItem;n.siteId=window.HotelwizeApp.SiteId,n.browserUID=this.visitorId,n.referrer=document.location.href,n.preferences=t,n.trackers=[],n.cookies=[],this.registeredPlugins.forEach((o=>{let i=!1;o.trackers.forEach((n=>{let r=!1;n.cookies.forEach((e=>{!r&&t.includes(e.purpose)&&(r=!0)})),r&&(i=!0,n.plugin=o,e.push(n))})),i&&o.cookies.forEach((e=>{var t;const i=new u.ConsentLogItemCookie;i.name=e.name||"",i.owner=o.assemblyName,i.storageType=e.storageType,null===(t=n.cookies)||void 0===t||t.push(i)}))})),e.forEach((e=>{var o,i,r;const a=new d.ConsentLogItemTracker;a.id=e.id,a.name=null===(o=e.plugin)||void 0===o?void 0:o.assemblyName,a.version=null===(i=e.plugin)||void 0===i?void 0:i.assemblyVersion,a.cookies=[],e.cookies.forEach((e=>{var n;if(t.includes(e.purpose)){const t=new u.ConsentLogItemCookie;t.name=e.name||"",t.owner=void 0,t.storageType=e.storageType,null===(n=a.cookies)||void 0===n||n.push(t)}})),null===(r=n.trackers)||void 0===r||r.push(a)})),window.HotelwizeApp.RegisteredThemeCookies.forEach((e=>{var t;if(null!=e.name){const o=new u.ConsentLogItemCookie;o.name=e.name,o.owner="theme",o.storageType=e.storageType,null===(t=n.cookies)||void 0===t||t.push(o)}}));const o=new XMLHttpRequest;o.onreadystatechange=function(){4==this.readyState&&this.status},o.open("POST",this.endPointUrl,!0),o.setRequestHeader("Content-Type","application/json;charset=UTF-8"),o.send(JSON.stringify(n))}}t.CookieConsent=m},371:e=>{e.exports=window.Hotelwize}},t={};function n(o){var i=t[o];if(void 0!==i)return i.exports;var r=t[o]={exports:{}};return e[o].call(r.exports,r,r.exports,n),r.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o=n(727);self["Hotelwize.Plugins.PrivacyProtection.CookieConsent"]=o})();