const npRwInit=t=>{!function(e,n,s){if(void 0!==e.NPRW)return;const o=t=>{t.detail.resolve(null)},i={"get-token":o,"get-user":o,"validate-token":t=>{t.detail.resolve(!0)}},r={},a=(e,n,o,i,r)=>{e=l(e,i),r=r||{};for(const[t,n]of Object.entries(r))null!==n&&void 0!==n&&(e=e.replace(`${t}`,`${n}`));const a=t.concat(e);n=(n||"GET").toUpperCase();const c={"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"};i&&(c.Authorization=`Bearer ${i}`);const d={method:n,cache:"no-cache",headers:c};return o&&-1===["GET","DELETE"].indexOf(n)&&(d.body=JSON.stringify(o)),new Promise((t,e)=>{fetch(a,d).then(n=>{n.status>=200&&n.status<300?n.json().then(e=>t(e)):n.status>=400&&(401===n.status&&i.length&&e(401),n.json().then(t=>{s.error(t),void 0!==t.message?e(t.message):e("An error has occurred while processing your request. Please try again.")}))}).catch(t=>{s.error(t),e("An error has occurred while processing your request. Please try again.")})})},l=(t,e)=>"string"==typeof t?t:e?t.logged_in:t.guest,c=(t,e=0)=>{let n=3735928559^e,s=1103547991^e;for(let e,o=0;o<t.length;o++)e=t.charCodeAt(o),n=Math.imul(n^e,2654435761),s=Math.imul(s^e,1597334677);return n=Math.imul(n^n>>>16,2246822507)^Math.imul(s^s>>>13,3266489909),`H${4294967296*(2097151&(s=Math.imul(s^s>>>16,2246822507)^Math.imul(n^n>>>13,3266489909)))+(n>>>0)}`};a("rw/core/init").then(t=>{const{bundled:o,custom_body_class:l,custom_css:d,base_url:u,api_base_url:h,static_base_url:g,widgets:m}=t,p="NPRW_".concat(c(u));e.NPRW={globalEventBusEl:null,widgetScriptIds:[],widgetLoadedScriptIds:[],withCustomStyleEl:null,addGlobalEventBus:function(){null===this.globalEventBusEl&&(this.globalEventBusEl=n.createElement("span"),this.globalEventBusEl.id="NPRW_event_bus",n.getElementsByTagName("body")[0].appendChild(this.globalEventBusEl));for(const[t,e]of Object.entries(i))this.listen(t,e)},addStyles:function(t,e){if(e){const t=n.getElementById(e);if(t)return t}if(t&&t.length){const s=n.createElement("style");e&&(s.id=e),s.setAttribute("data-nprw-style","1"),s.innerHTML=t;const o=n.getElementsByTagName("head")[0];return null===this.withCustomStyleEl?o.appendChild(s):o.insertBefore(s,this.withCustomStyleEl),s}return null},clearStorageContents:function(){e.localStorage.setItem(p,"{}")},getStorageContent:function(t,e){const n=this.getStorageContents()[t];if(void 0===n)return null;if(e)try{return JSON.parse(n)}catch(t){return s.error(t),null}return n},getStorageContents:function(){return JSON.parse(e.localStorage.getItem(p)||"{}")},init:function(){this.addGlobalEventBus(),l&&n.getElementsByTagName("body")[0].classList.add(l),this.withCustomStyleEl=this.addStyles(d,"nprw-core-custom-css"),this.initWidgets()},initWidgets:function(){for(const t of m){const{code:e,script_path:n}=t;if(!n)continue;const s="NPRW_".concat(e),o="s".concat(s);this.widgetScriptIds.push(o)}for(const t of m){const{code:n,css_path:s,setup_json:i,script_path:r}=t,a="NPRW_".concat(n),l="s".concat(a),c=JSON.parse(i||"{}");if(o)e[a].init(c,h,g),this.widgetLoadedScriptIds.push(l),this.renderWidgets();else if(s&&this.loadStyleSheet(l,g.concat(s)),r){const t=this;this.loadScript(l,g.concat(r),function(){e[a].init(c,h,g),t.widgetLoadedScriptIds.push(l),t.renderWidgets()},a)}}},loadSplashScript:function(t){this.loadScript("js-spash",g.concat("Navipartner_RemoteWidgetCore/js/lib/js-splash.min.js"),t,"Splash")},loadScript:function(t,s,o,i){const r=void 0!==o;if(i&&void 0!==e[i])return void(r&&o());const a="NPRW".concat(t);let l=n.getElementById(a);return null===l&&((l=n.createElement("script")).id=a,l.type="text/javascript",l.src=s,l.crossorigin="anonymous",n.getElementsByTagName("head")[0].appendChild(l)),r&&l.addEventListener("load",o),l},loadStyleSheet:function(t,e,s){const o="NPRW_S_".concat(t);let i=n.getElementById(o);if(null===i){(i=n.createElement("link")).id=o,i.rel="stylesheet",i.type="text/css",i.href=e;const t=n.getElementsByTagName("head")[0];null===this.withCustomStyleEl?t.appendChild(i):t.insertBefore(i,this.withCustomStyleEl),void 0!==s&&i.addEventListener("load",s)}return i},listen:function(t,e,n){void 0===n&&(n=this.globalEventBusEl);const s=e.name&&e.name.length>0?e.name:"lf-"+c(`${e}`);void 0===r[s]&&(r[s]=e),n.removeEventListener(t,r[s]),n.addEventListener(t,r[s])},makeApiCall:function(t,n,s,o,i){const r=this;return new Promise((l,c)=>{new Promise(t=>{r.trigger("get-token",{resolve:t})}).then(r=>{a(t,n,s,r,o).then(t=>l(t)).catch(t=>{401!==t||i?c(t):r&&e.location.reload()})})})},removeDefaultGlobalListener:function(t){const e=this.globalEventBusEl,n=i[t];n&&e.removeEventListener(t,n)},renderWidgets:function(){if(this.widgetScriptIds.filter(t=>!this.widgetLoadedScriptIds.includes(t)).length)return;const t=this;new Promise(e=>{t.trigger("validate-token",{resolve:e})}).finally(()=>{for(const t of m){const{code:n}=t,s="NPRW_".concat(n);e[s].render()}})},showSplash:function(t,e){const{background:n,animationDuration:s,startAnimation:o,endAnimation:i,duration:r}=e||{};this.loadSplashScript(function(){new Splash({background:n||"#FFF",zIndex:2147483647},{use:!0,start:o||FancyAnimation.moveIn,end:i||FancyAnimation.moveOut,duration:s||500}).fromHtml(t,r||1e4)})},trigger:function(t,e,n){void 0===n&&(n=this.globalEventBusEl);const s=new CustomEvent(t,{bubbles:!1,detail:e});n.dispatchEvent(s)},updateStorageContent:function(t,n,o){const i=this.getStorageContents();if(o)try{n=JSON.stringify(n)}catch(t){s.error(t),n=null}i[t]=n,e.localStorage.setItem(p,JSON.stringify(i))}},e.NPRW.init()}).catch(t=>{s.error(t)})}(window,document,console)};;!function(t,e,i){t["NPRW_floating-mini-cart"]={baseApiUrl:void 0,baseStaticUrl:void 0,config:void 0,coreLib:void 0,elementId:void 0,element:void 0,addEventListeners:function(){const t=this;this.coreLib.listen("cart-id-updated",function(e){t.coreLib.updateStorageContent("cart-id",e.detail.id||null),t.coreLib.trigger("cart-id-updated",e.detail)},this.element),this.coreLib.listen("checkout",function(e){t.coreLib.trigger("checkout",e.detail)},this.element)},addGlobalEventListeners:function(){const t=this;this.coreLib.listen("cart-lock",function(e){t.coreLib.trigger("cart-lock",e.detail||{},t.element)}),this.coreLib.listen("cart-unlock",function(e){t.coreLib.trigger("cart-unlock",e.detail||{},t.element)}),this.coreLib.listen("cart-update",function(e){t.coreLib.trigger("cart-update",e.detail||{},t.element)}),this.coreLib.listen("get-cart-id",function(e){const i=t.coreLib.getStorageContent("cart-id");if(i)return e.detail.resolve(i);t.coreLib.makeApiCall(t.config.create_cart_api_path,"POST",void 0).then(i=>{t.coreLib.trigger("set-cart-id",{id:i},t.element),e.detail.resolve(i)}).catch(t=>{e.detail.reject(t)})}),this.coreLib.listen("set-token",function(e){const i=(e.detail||{}).token;i||t.coreLib.updateStorageContent("cart-id",null);const n={id:i?t.coreLib.getStorageContent("cart-id"):void 0,token:i};t.coreLib.trigger("set-token",n,t.element)})},initElement:function(){this.element=e.getElementById(this.elementId),null===this.element&&(this.element=e.createElement("div"),this.element.id=this.elementId,this.element.classList.add("np-remote-widget","np-rw-mini-cart"),e.getElementsByTagName("body")[0].appendChild(this.element)),this.element.classList.add("np-remote-widget"),this.addGlobalEventListeners(),this.addEventListeners()},init:function(e,i,n){this.baseApiUrl=i,this.baseStaticUrl=n,this.config=e,this.coreLib=t.NPRW,this.elementId=e.root_element_id||"rw_mini_cart",this.initElement()},render:function(){if(this.element.classList.contains("cart-init"))return;const{app:e}=this.config,i={...e,root_element_id:this.elementId},n=i.layout_library,o=this.baseStaticUrl.concat(`Navipartner_RemoteWidgetCart/js/${i.layout_filename}.js`),r=this.baseStaticUrl.concat(`Navipartner_RemoteWidgetCart/css/${i.layout_filename}.css`);this.coreLib.loadStyleSheet(n,r);const c=this;this.coreLib.loadScript(n,o,function(){const e=c.coreLib.getStorageContent("cart-id");null!==e&&(i.cart_id=e),new Promise(t=>{c.coreLib.trigger("get-token",{resolve:t})}).then(t=>{null!==t&&(i.api.token=t)}).finally(()=>{t[n].init(i)})},n)}}}(window,document,console);;!function(e,s,i){e["NPRW_hosted-checkout"]={baseApiUrl:void 0,baseStaticUrl:void 0,coreLib:void 0,config:void 0,addGlobalEventListeners:function(){const s=this;this.coreLib.listen("checkout",function(i){const t=i.detail,o=i.detail.cart_id;s.coreLib.makeApiCall(s.config.checkout_url_api_path,"POST",{referrer:e.location.href},{":cartId":o}).then(s=>{e.location.href=s,t.resolve(!0)}).catch(e=>{t.reject(e)})})},init:function(s,i,t){this.coreLib=e.NPRW,this.baseApiUrl=i,this.baseStaticUrl=t,this.config=s,this.addGlobalEventListeners()},render:function(){const e=this.config;e.splash&&this.splashSuccess(e.splash_html,e.splash_duration)},splashSuccess:function(s,i){const t=new URLSearchParams(e.location.search).get("order_success_id");if(!t)return;const o=this.coreLib.getStorageContent("splashed_order_ids",!0)||[];o.includes(t)||(o.push(t),this.coreLib.updateStorageContent("splashed_order_ids",o,!0),s=s||"<div>\n                <p>Thanks for your Order!</p>\n                <p>Your Order Reference is #%order_id%.</p>\n            </div>",this.coreLib.showSplash(`<div class="order-success-splash-content">${s.replace("%order_id%",t)}</div>`,{duration:i}))}}}(window,document,console);;!function(t,i,e){t["NPRW_ticket-view"]={baseApiUrl:void 0,baseStaticUrl:void 0,coreLib:void 0,config:void 0,addEventListeners:function(t){const e=this;this.coreLib.listen("ticket-view-popup-opened",function(){i.body.classList.add("ticket-view-popup-on")},t),this.coreLib.listen("ticket-view-popup-closed",function(){i.body.classList.remove("ticket-view-popup-on")},t),this.coreLib.listen("ticket-view-selection",function(t){e.coreLib.trigger("cart-lock");const i=t.detail;new Promise((t,i)=>{const o={};o.resolve=t,o.reject=i,e.coreLib.trigger("get-cart-id",o)}).then(t=>{const o={product:i.package_id,ticketing:{[i.package_id]:{ticket:{},restore:i.restore}}};for(const[,t]of Object.entries(i.tickets))if(o.ticketing[i.package_id].ticket[t.id]={},o.ticketing[i.package_id].ticket[t.id].qty=t.qty,void 0!==t.options&&void 0!==t.options.admissions){o.ticketing[i.package_id].ticket[t.id].options={},o.ticketing[i.package_id].ticket[t.id].options.admissions={};for(const[,e]of Object.entries(t.options.admissions))o.ticketing[i.package_id].ticket[t.id].options.admissions[e.code]=e.schedule}for(const[,t]of Object.entries(i.addons))if(void 0===o.ticketing[i.package_id].addon&&(o.ticketing[i.package_id].addon={}),o.ticketing[i.package_id].addon[t.id]={},void 0!==t.options&&void 0!==t.options.variants){o.ticketing[i.package_id].addon[t.id].options={variant:{}};for(const[,e]of Object.entries(t.options.variants))o.ticketing[i.package_id].addon[t.id].options.variant[e.id]={},o.ticketing[i.package_id].addon[t.id].options.variant[e.id].qty=e.qty}else o.ticketing[i.package_id].addon[t.id].qty=t.qty;for(const[t,e]of Object.entries(i.options)){void 0===o.ticketing[i.package_id].option&&(o.ticketing[i.package_id].option={}),void 0===o.ticketing[i.package_id].option[t]&&(o.ticketing[i.package_id].option[t]={});for(const[n,c]of Object.entries(e))if(Object.keys(c).length)for(const[e,{value:a}]of Object.entries(c))if(void 0===o.ticketing[i.package_id].option[t][n]&&(o.ticketing[i.package_id].option[t][n]={}),Array.isArray(a)){o.ticketing[i.package_id].option[t][n][e]=[];for(const c of a)o.ticketing[i.package_id].option[t][n][e].push(c)}else o.ticketing[i.package_id].option[t][n][e]=a}e.coreLib.makeApiCall(e.config.reserve_api_path,"POST",{packageDataJson:JSON.stringify(o)},{":cartId":t}).then(()=>{i.resolve(!0)}).catch(t=>{i.reject(t)}).finally(()=>{e.coreLib.trigger("cart-update",{id:t})})}).catch(t=>{e.coreLib.trigger("cart-unlock"),i.reject(t)})},t)},addGlobalEventListeners:function(){const t=this;this.coreLib.listen("content-updated",function(i){const e=(i.detail||{}).element||void 0;t.render(e)}),this.coreLib.listen("set-token",function(i){t.rebuildApps()})},rebuildApps:function(){const t=i.getElementsByClassName("ticket-view-init");for(;t.length;){const e=t[0],o=e.tagName,n=e.parentElement,c=i.createElement(o);c.classList.add(...e.classList),c.classList.remove("ticket-view-init","np-remote-widget");const a=e.dataset.packageId;a&&(c.dataset.packageId=a);const s=e.dataset.widgetId;s&&(c.dataset.widgetId=s),n.insertBefore(c,e),e.remove()}const e=i.getElementsByClassName("ticket-view-popup-overlay");for(;e.length;)e[0].remove();this.coreLib.trigger("content-updated")},init:function(i,e,o){this.coreLib=t.NPRW,this.baseApiUrl=e,this.baseStaticUrl=o,this.config=i,this.addGlobalEventListeners()},render:function(e){const o=(e=e||i).getElementsByClassName("ticket-view-container");if(!o.length)return;const n=this.config.extra_css;n&&this.coreLib.addStyles(n,"rw-ticket-view-extra-css");for(const i of o){if(i.classList.contains("ticket-view-init"))continue;i.id||(i.id="ticket-view-"+1e3*new Date+"-"+Math.floor(99999*Math.random()));const e=i.dataset.packageId,o=i.dataset.widgetId;this.coreLib.makeApiCall(this.config.config_api_path,"GET",void 0,{":packageId":e||0,":widgetId":o||0}).then(e=>{const o=JSON.parse(e),n=o.layout_library,c=this.baseStaticUrl.concat(`Navipartner_Ticketing/js/${o.layout_filename}.js`),a=this.baseStaticUrl.concat(`Navipartner_Ticketing/css/${o.layout_filename}.css`);this.coreLib.loadStyleSheet(n,a);const s={load_config:o,root_element_id:i.id},d=this;this.coreLib.loadScript(n,c,function(){new Promise(t=>{d.coreLib.trigger("get-token",{resolve:t})}).then(t=>{null!==t&&(s.load_config.api.token=t)}).finally(()=>{t[n].init(s)})},n),i.classList.add("np-remote-widget"),this.addEventListeners(i)}).catch(t=>{console.error(t)})}}}}(window,document,console);
!function(e,n){let t=n.getElementById("NPRW_S_bundled");null===t
&&((t=n.createElement("style")).id="NPRW_S_bundled",t.innerHTML=`.order-success-splash-content{color:#000;font-size:1rem;font-weight:800;text-align:center}`,        
n.getElementsByTagName("head")[0].appendChild(t)
)}(window,document);
!function(w){w.addEventListener('DOMContentLoaded',()=>npRwInit('https://shop.experimentarium.dk/DK/rest/DK/V1/'))}(window);