1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[646],{442:()=>{},1657:()=>{},2404:(e,t,l)=>{"use strict";l.d(t,{default:()=>r});var n=l(5155),a=l(2115),s=l(6107);let r=e=>{var t;let{post:l}=e,r=(0,a.useRef)(null);null==l||l.lang;let i=(0,s.decode)((null==l||null==(t=l.content)?void 0:t.rendered)||""),[c,o]=(0,a.useState)(i);return(0,a.useEffect)(()=>{try{let e=new DOMParser().parseFromString(i,"text/html");e.querySelectorAll("figure.wp-block-image").forEach(t=>{let l=t.querySelector("img");if(!l||t.querySelector(".image-overlay-wrapper"))return;let n=t.querySelector("figcaption.figure-credit"),a=t.querySelector("div.figure-custom-caption");t.querySelectorAll("figcaption").forEach(e=>{e===n||e.textContent.trim()||e.remove()});let s=e.createElement("div");s.className="image-overlay-wrapper",l.replaceWith(s),s.appendChild(l),n&&s.appendChild(n),a&&t.appendChild(a)}),o(e.body.innerHTML)}catch(e){o(i)}},[i]),(0,a.useEffect)(()=>{if(!r.current)return;r.current.querySelectorAll(".faq-item").forEach(e=>{let t=e.querySelector("summary");t&&(t.querySelector("svg")||t.insertAdjacentHTML("beforeend",'<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 36 36" fill="none">\n <path d="M18 23.1L9 14.1L11.1 12L18 18.9L24.9 12L27 14.1L18 23.1Z" fill="#003633"/>\n </svg>'),e.addEventListener("toggle",()=>{e.classList.toggle("is-open",e.hasAttribute("open"))}))});let e=()=>{r.current&&r.current.querySelectorAll("img[style]").forEach(e=>{let t=e.style,l=parseFloat(t.width),n=parseFloat(t.height);l&&n&&(t.width="100%",t.height="auto",t.aspectRatio="".concat(l," / ").concat(n),t.objectFit="cover")})},t=(e,t)=>{let l=e.querySelector(".fa-arrow-left-long"),n=e.querySelector(".fa-arrow-right-long");if(!l||!n)return;let a=Math.round(t.scrollLeft),s=Math.round(t.scrollWidth-t.clientWidth);a>0?l.classList.remove("disabled"):l.classList.add("disabled"),a>=s-1?n.classList.add("disabled"):n.classList.remove("disabled")},n=e=>{var t;let n=e.target.closest(".coupon-code");if(!n)return;let a=null==(t=n.getAttribute("data-coupon"))?void 0:t.trim(),s=n.getAttribute("data-original-html");if(!a||!s)return;let r=atob(s),i=(null==l?void 0:l.lang)==="en"?"Copied!":"Kopiert!";navigator.clipboard.writeText(a).then(()=>{n.innerHTML='<span class="copied-message">'.concat(i,"</span>"),n.classList.add("copied"),setTimeout(()=>{n.innerHTML=r,n.classList.remove("copied")},2e3)}).catch(e=>{console.error("Kopiering feilet:",e)})};document.addEventListener("click",n);let a=e=>{if(e.target.matches(".fa-arrow-left-long")||e.target.matches(".fa-arrow-right-long")){let l=e.target.closest(".slider-wrapper"),n=null==l?void 0:l.previousElementSibling;n&&((e,l,n)=>{let a=l.querySelector(".post-listing");if(!a)return;let s=a.offsetWidth+20;l.scrollBy({left:"next"===n?s:-s,behavior:"smooth"}),setTimeout(()=>t(e,l),400)})(l,n,e.target.matches(".fa-arrow-left-long")?"prev":"next")}},s=r.current.querySelectorAll(".slider-wrapper");return s.forEach(e=>{let l=e.previousElementSibling;l&&l.classList.contains("post-listings")&&l.addEventListener("scroll",()=>t(e,l))}),e(),window.addEventListener("resize",e),document.addEventListener("click",a),setTimeout(()=>{(()=>{let e=r.current.querySelector("#custom-newsletter-form");if(console.log("Form found:",e),!e||"true"===e.dataset.listenerAttached)return;e.dataset.listenerAttached="true";let t={no:{placeholder:"Din epostadresseâ¦",button:"Bli med",success:"Du er p\xe5meldt. Takk for at du vil bli med â vi lover \xe5 bare sende ting vi tror du vil ha nytte av.",error:"Oisann, noe stemte ikke helt med e-posten. Kan du sjekke og pr\xf8ve p\xe5 nytt?",privacy:'Ved \xe5 melde deg inn godtar du v\xe5re vilk\xe5r i henhold til v\xe5r <a href="/no/info/personvernerklaering" target="_blank" rel="nofollow">personvernerkl\xe6ring</a>.'},en:{placeholder:"Your email addressâ¦",button:"Join",success:"Thanks for signing up! No spam â just a bit of Vestfold inspiration now and then.",error:"Oops, something didnât look right with your email. Mind checking it and trying again?",privacy:'By subscribing you agree to our <a href="/en/info/privacy-policy" target="_blank" rel="nofollow">privacy policy</a>.'}},n=(null==l?void 0:l.lang)==="en"?"8405":"8404",a=e.querySelector('input[name="email"]'),s=e.querySelector("button"),i=e.querySelector(".newsletter-msg"),c=document.querySelector(".newsletter-privacy");a&&s&&i&&(a.placeholder=t[null==l?void 0:l.lang].placeholder,s.textContent=t[null==l?void 0:l.lang].button,c.innerHTML=t[null==l?void 0:l.lang].privacy,e.classList.add("test"),e.addEventListener("submit",async s=>{console.log("\uD83D\uDFE1 Newsletter form submitted"),s.preventDefault(),s.stopPropagation(),console.log("â
Prevent default called"),i.textContent="",a.classList.remove("error");let r=a.value;if(!r||!r.includes("@")){a.classList.add("error"),i.textContent=t[null==l?void 0:l.lang].error;return}try{let a=await fetch("https://wordpress.visitvestfold.com/wp-json/custom/v1/subscribers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:r,list_id:n})}),s=await a.json();!a.ok||(null==s?void 0:s.error)?(i.textContent=t[null==l?void 0:l.lang].error,i.classList.add("error")):(i.textContent=t[null==l?void 0:l.lang].success,i.classList.add("success"),e.reset())}catch(e){console.error(e),i.textContent=t[null==l?void 0:l.lang].error}}))})()},1200),()=>{document.removeEventListener("click",a),document.removeEventListener("click",n),window.removeEventListener("resize",e),s.forEac
1h(e=>{let l=e.previousElementSibling;l&&l.removeEventListener("scroll",()=>t(e,l))})}},[c]),(0,n.jsx)("div",{className:"post-content--content",dangerouslySetInnerHTML:{__html:c},ref:r})}},2521:(e,t,l)=>{"use strict";l.d(t,{A:()=>o});var n=l(5155),a=l(2115);l(442);var s=l(2619),r=l.n(s),i=l(6107),c=l(2321);let o=function(e){let{lang:t,cards:l}=e,[s,o]=(0,a.useState)({}),d=async e=>{if(!e||!Number.isInteger(e))return null;try{let t=await fetch("https://wordpress.visitvestfold.com/wp-json/wp/v2/media/".concat(e));return(await t.json()).source_url}catch(e){return console.error("Error fetching image:",e),null}},u=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,l=(0,i.decode)(e.replace(/(<([^>]+)>)/gi,""));return l.length>t?"".concat(l.slice(0,t),"..."):l},h=e=>e.replace("https://wordpress.visitvestfold.com/","").replace(/\/$/,"");return(0,a.useEffect)(()=>{(async()=>{let e={};for(let t of l){if(0===t.featured_media)continue;let l=await d(t.featured_media);l&&(e[t.featured_media]=l)}o(e)})()},[l]),(0,n.jsx)("div",{className:"card-container",children:(0,n.jsx)("div",{className:"card-component-wrapper",children:l.map((e,l)=>{var a,o,d,g,m,v,p,f,x,j,_,w;return(0,n.jsxs)("div",{className:"card-single",children:[Array.isArray(null==(a=e.acf)?void 0:a.media_gallery)&&e.acf.media_gallery.length>0?(0,n.jsx)(r(),{style:{display:"block",width:"100%"},href:"/".concat(h(e.link)),children:(0,n.jsx)("div",{className:"card-image",style:{backgroundImage:"url(".concat((0,c.L)(e.acf.media_gallery),")"),backgroundColor:(0,c.L)(e.acf.media_gallery)?"transparent":"#f0f0f0",backgroundSize:"cover",backgroundPosition:"center center"}})}):(0,n.jsx)(r(),{style:{display:"block",width:"100%"},href:"/".concat(h(e.link)),children:(0,n.jsx)("div",{className:"card-image",style:{backgroundImage:(null==e||null==(g=e.yoast_head_json)||null==(d=g.og_image)||null==(o=d[0])?void 0:o.url)?"url(".concat(e.yoast_head_json.og_image[0].url,")"):(null==e?void 0:e.featured_media)?"url(".concat(e.featured_media,")"):"none",backgroundColor:s[e.featured_media]?"transparent":"#f0f0f0",backgroundSize:"cover",backgroundPosition:"center center"}})}),(0,n.jsxs)("div",{className:"card-content",children:[(0,n.jsxs)("div",{className:"card-title-area",children:[(0,n.jsx)(r(),{href:"/".concat(h(e.link)),children:(0,n.jsx)("h3",{children:(0,i.decode)(null!=(_=null==e||null==(m=e.title)?void 0:m.rendered)?_:null==e?void 0:e.title)})}),(null==e||null==(v=e.acf)?void 0:v.excerpt)?(0,n.jsx)("p",{children:u(null==e||null==(p=e.acf)?void 0:p.excerpt)}):(0,n.jsx)("p",{children:u(null!=(w=null==e||null==(f=e.excerpt)?void 0:f.rendered)?w:null==e?void 0:e.excerpt)})]}),(0,n.jsxs)("div",{className:"booking-btn-wrap",children:[(null==e||null==(x=e.acf)?void 0:x.booking_website)?(0,n.jsx)(r(),{target:"_blank",className:"book-btn",href:(null==e||null==(j=e.acf)?void 0:j.booking_website)+(e.acf.booking_website.includes("?")?"&":"?")+"utm_source=VisitVestfold&utm_medium=booking_button",children:(0,n.jsx)("strong",{children:"no"===t?"Book n\xe5":"Book now"})}):null,e.link?(0,n.jsx)(r(),{className:"btn main",href:"/".concat(h(e.link)),children:(0,n.jsx)("strong",{children:"no"===t?"Les mer":"Read more"})}):null]})]})]},"card-".concat(l))})})})}},2563:(e,t,l)=>{"use strict";l.d(t,{default:()=>r});var n=l(5155),a=l(2115),s=l(2521);function r(e){let{lang:t,post:l,title:r}=e,[i,c]=(0,a.useState)([]);console.log(l);let o={events:"event_category",accomodations:"accomodation_category",attraction:"attraction_catagory",activity:"activity_category",transport:"transport_category",catering:"catering_category",simple_location:"simple_location_category",simple_reta:"simple_reta_category",simple_serv:"simple_serv_category",simple_busi:"simple_busi_category",simple_broc:"simple_broc_category",simple_tour:"simple_tour_category",simple_hire:"simple_hire_category",simple_ptcn:"simple_ptcn_category",simple_proj:"simple_proj_category",simple_gast:"simple_gast_category",simple_gcat:"simple_gcat_category",simple_film:"simple_film"};return(0,a.useEffect)(()=>{(async()=>{let e=o[l.type];if(!e)return;let t=null==l?void 0:l[e];
1if(t&&0!==t.length){for(let n of t)try{let t=await fetch("https://wordpress.visitvestfold.com/wp-json/wp/v2/".concat(l.type,"?").concat(e,"=").concat(n,"&exclude=").concat(l.id,"&per_page=3&_embed&lang=no")),a=await t.json();if(a.length>0)return void c(a)}catch(e){console.error("Error fetching ".concat(l.type),e)}if(0===i.length)try{var n;let e=null==(n=l.categories)?void 0:n[0];if(!e)return;let t=await fetch("https://wordpress.visitvestfold.com/wp-json/wp/v2/posts?categories=".concat(e,"&exclude=").concat(l.id,"&per_page=3&_embed")),a=await t.json();c(a)}catch(e){console.error("Error fetching fallback related posts:",e)}}})()},[l,i.length]),(0,n.jsx)("div",{className:"related-posts",children:i.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("h2",{children:"no"===t?"Du liker kanskje ogs\xe5":"You may also like"}),(0,n.jsx)(s.A,{lang:t,cards:i})]})})}},4070:()=>{},4496:()=>{},6783:()=>{},7065:()=>{},7309:()=>{},8450:()=>{},9265:(e,t,l)=>{"use strict";l.d(t,{default:()=>eh});var n=l(5155),a=l(2115);l(7309);var s=l(2375),r=l(5686);l(8450);var i=l(2230),c=l(3677);let o=function(e){let{backgroundColor:t,icon:l,text:a}=e;return(0,n.jsxs)("div",{className:"alert",children:[(0,n.jsx)(i.g,{icon:c.pde}),(0,n.jsx)("p",{children:a})]})},d=function(e){let{pageData:t}=e,l=[{title:"Hotell",text:"Hotell er mer enn en seng! Det vil du oppleve i Vestfold."},{title:"Campingplasser",text:"Bo ved vannkanten p\xe5 en av Vestfolds campingplasser og nyt campinglivet."}];return(0,n.jsxs)("div",{className:"single-page",children:[(0,n.jsx)("div",{className:"text-hero",children:(0,n.jsxs)("div",{className:"inner-hero",children:[(0,n.jsx)("h1",{children:"Overnatting i Vestfold"}),(0,n.jsx)("p",{children:"I Vestfold er det enkelt \xe5 finne et sted hvor du kan f\xe5 en god natts s\xf8vn."})]})}),(0,n.jsxs)("div",{className:"section",children:[(0,n.jsx)(r.default,{type:"cards",items:l}),(0,n.jsx)(r.default,{type:"cards",items:l}),(0,n.jsx)(o,{backgroundColor:"yellow",icon:"faSailBoat",text:"Vestfold er et popul\xe6rt feriefylke, og et perfekt utgangspunkt for kurs- og konferanser. Det brede spekteret av overnattingstilbud gir deg mulighet til \xe5 velge blant sm\xe5 og store hotell med s\xe6rpreg, vandrerhjem, camping ved sj\xf8kanten, hytter og leiligheter, eller rom for leie i private boliger."}),(0,n.jsx)(r.default,{type:"cards",items:l})]})]})};var u=l(63),h=l(2758),g=l.n(h);function m(e){let{lang:t,selectedRange:l,onRangeChange:s,currentDate:r,onDateChange:o}=e,d=(0,u.useSearchParams)().get("maned"),h=r||new Date,[g,m]=(0,a.useState)(null),v=new Date;v.setHours(0,0,0,0);let p=h.getMonth(),f=h.getFullYear();var x=[],j="default";"no"===t?(x=["Ma","Ti","On","To","Fr","L\xf8","S\xf8"],j="nb-NO"):(x=["Mo","Tu","We","Th","Fr","Sa","Su"],j="en-GB");let _=e=>{let t=new Date(e);return t.setHours(0,0,0,0),t},w=(e,t)=>new Date(t,e+1,0).getDate(),y=e=>{let t=_(e),n=_(l.start),a=l.end?_(l.end):null;return!!n&&!!a&&t>=n&&t<=a},k=e=>_(e)<v,C=(()=>{let e=[],t=new Date(f,p,1).getDay(),l=0===t?6:t-1,n=w(p-1,f);for(let t=l;t>0;t--)e.push({date:new Date(f,p-1,n-t+1),currentMonth:!1});let a=w(p,f);for(let t=1;t<=a;t++)e.push({date:new Date(f,p,t),currentMonth:!0});let s=42-e.length;for(let t=1;t<=s;t++)e.push({date:new Date(f,p+1,t),currentMonth:!1});return e})(),b=e=>{o(t=>{let l=t?new Date(t):new Date;return l.setMonth(l.getMonth()+e),l})},N=C.findIndex(e=>{let{date:t}=e;return y(t)}),S=C.length-1-[...C].reverse().findIndex(e=>{let{date:t}=e;return y(t)});return(0,a.useEffect)(()=>{if(d){let[e,t]=d.split("-"),l=parseInt(e,10),n=parseInt(t,10)-1;!isNaN(l)&&!isNaN(n)&&n>=0&&n<12&&(o(new Date(l,n,1)),s({start:new Date(l,n,1),end:new Date(l,n+1,0)}))}},[d,o,s]),(0,n.jsxs)("div",{className:"calendarWrap",children:[(0,n.jsxs)("div",{className:"calendar--header",children:[(0,n.jsx)(i.g,{icon:c.CeG,onClick:()=>b(-1)}),(0,n.jsxs)("p",{className:"currentMonth",children:[h.toLocaleString(j,{month:"long"})," ",f]}),(0,n.jsx)(i.g,{icon:c.dmS,onClick:()=>b(1)})]}),(0,n.jsx)("div",{className:"calendar-days",children:x.map(e=>(0,n.jsx)("div",{children:e},e))}),(0,n.jsx)("div",{className:"calendar-dates",children:C.map((e,t)=>{let{date:a,currentMonth:r}=e;return(0,n.jsx)("div",{className:"calendar-date ".concat(r?"current":"not-current"," ").concat(y(a)?"selected":""," ").concat((e=>{if(!l.start||null!==l.end)return!1;let t=_(e),n=_(l.start),a=_(g);
1return!!g&&(a<n?t>=a&&t<=n:t>=n&&t<=a)})(a)?"temp-selection":""," ").concat(k(a)?"past-date":""," ").concat(t===N?"first-selected":""," ").concat(t===S?"last-selected":""),onClick:()=>!k(a)&&(e=>{let t=_(e);k(e)||(!l.start||l.end?s({start:t,end:null}):t<v||t<l.start?s({start:t,end:l.start}):s({...l,end:t}),m(null))})(a),onMouseEnter:()=>!k(a)&&m(a),onMouseLeave:()=>m(null),children:a.getDate()},t)})})]})}m.propTypes={selectedRange:g().shape({start:g().instanceOf(Date),end:g().instanceOf(Date)}).isRequired,onRangeChange:g().func.isRequired,currentDate:g().instanceOf(Date),onDateChange:g().func.isRequired};var v=l(6107),p=l(2619),f=l.n(p),x=l(3900),j=l(2321);l(4070);let _=function(e){let{count:t=4,lang:l="no"}=e;return(0,n.jsxs)("div",{className:"event-day event-skeleton","aria-busy":"true",children:[(0,n.jsx)("p",{className:"skeleton-status",role:"status",children:"no"===l?"Laster inn arrangementerâ¦":"Loading eventsâ¦"}),(0,n.jsx)("div",{className:"skeleton-block skeleton-heading","aria-hidden":"true"}),(0,n.jsx)("div",{className:"card-container eventcards","aria-hidden":"true",children:(0,n.jsx)("div",{className:"card-component-wrapper",children:Array.from({length:t},(e,t)=>(0,n.jsxs)("div",{className:"card-single",children:[(0,n.jsx)("div",{className:"card-image skeleton-block"}),(0,n.jsxs)("div",{className:"card-content",children:[(0,n.jsxs)("div",{className:"event-cat-wrapper",children:[(0,n.jsx)("span",{className:"skeleton-block skeleton-pill"}),(0,n.jsx)("span",{className:"skeleton-block skeleton-pill short"})]}),(0,n.jsxs)("div",{className:"card-title-area",children:[(0,n.jsx)("span",{className:"skeleton-block skeleton-line title"}),(0,n.jsx)("span",{className:"skeleton-block skeleton-line"}),(0,n.jsx)("span",{className:"skeleton-block skeleton-line short"})]}),(0,n.jsxs)("div",{className:"additional-info-wrapper",children:[(0,n.jsx)("span",{className:"skeleton-block skeleton-line meta"}),(0,n.jsx)("span",{className:"skeleton-block skeleton-line meta short"})]}),(0,n.jsx)("span",{className:"skeleton-block skeleton-btn"})]})]},t))})})]})};l(2118);var w=l(2577),y=l(2381);let k=e=>{if(!e)return"";let t=e.match(/(\d{1,2}):(\d{2})\s?(AM|PM)/i);if(t){let e=parseInt(t[1],10),l=t[2],n=t[3].toUpperCase();return"PM"===n&&12!==e&&(e+=12),"AM"===n&&12===e&&(e=0),"".concat(e.toString().padStart(2,"0"),":").concat(l)}return e},C=function(e){var t,l,s,r;let{lang:o,pageData:d,initialEvents:h}=e,[g,p]=(0,a.useState)(!1),[C,b]=(0,a.useState)(!1),{setPageData:N}=(0,x.B)(),[S,L]=(0,a.useState)(!1),[H,M]=(0,a.useState)([]),[V,E]=(0,a.useState)(new Date),[D,B]=(0,a.useState)(null!=h?h:[]),A=(0,a.useRef)(!!(null==h?void 0:h.length)),[I,T]=(0,a.useState)(!1),[Z,F]=(0,a.useState)(!1),[P,R]=(0,a.useState)([]),[q,z]=(0,a.useState)([]),[O,W]=(0,a.useState)({start:new Date,end:new Date(new Date().setDate(new Date().getDate()+6))}),K=e=>e?e.includes("-")?e:/^\d{8}$/.test(e)?"".concat(e.slice(0,4),"-").concat(e.slice(4,6),"-").concat(e.slice(6,8)):e:null;(0,a.useEffect)(()=>{var e;if(null==d||null==(e=d.acf)?void 0:e.date_pre_start){let e=new Date(K(d.acf.date_pre_start)),t=d.acf.date_pre_end?new Date(K(d.acf.date_pre_end)):e;W({start:e,end:t})}},[]);let G="no"===o?"by":"city",U="from";(0,u.useRouter)(),(0,a.useEffect)(()=>{var e,t;(null==d||null==(t=d.acf)||null==(e=t.cities)?void 0:e.length)>0&&M(d.acf.cities.map(e=>eu[e]).filter(Boolean)),b(!0)},[d]);let[$,Y]=(0,a.useState)(!1),X=(0,u.useSearchParams)(),J=X.get("kategori");(0,a.useEffect)(()=>{N(d)},[d,N,o]),(0,a.useEffect)(()=>{let e=X.get(U),t=X.get("to");if(e&&t){let l=new Date(K(e)),n=new Date(K(t)),a=l<=n?l:n,s=l<=n?n:l,r=ee(new Date),i=ee(a),c=ee(s);if(c<r){let e=(0,y.f)(r,14);W({start:r,end:e})}else i<r&&c>=r?W({start:r,end:s}):W({start:a,end:s})}else{let e=X.get("maned");if(e){let[t,l]=e.split("-").map(Number),n=new Date(new Date().setHours(0,0,0,0)),a=new Date(t,l-1,1),s=new Date(t,l,0);W({start:n.getMonth()===a.getMonth()&&n.getFullYear()===a.getFullYear()?n:a,end:s})}}let l=X.get(G);l&&M(l.split(","))},[X]),(0,a.useEffect)(()=>{if(!C||null===O.end)return;let e=!(X.get(U)||X.get("to")||X.get("kategori")||X.get(G))&&0===H.length&&0===q.length;if(A.current&&e){A.current=!1;return}A.current=!1;let t=setTimeout(()=>{Q()},100);return()=>clearTimeout(t)},[O,o,H,J,q,C]),(0,a.useEffect)(()=>
1{if(!C||!(null==O?void 0:O.start)||!(null==O?void 0:O.end))return;let e=new URLSearchParams(window.location.search);H.length>0?e.set(G,H.join(",")):e.delete(G),e.set(U,(0,w.GP)(O.start,"yyyy-MM-dd")),e.set("to",(0,w.GP)(O.end,"yyyy-MM-dd"));let t="".concat(window.location.pathname,"?").concat(e.toString());window.history.replaceState({},"",t)},[O,H,C,G]);let Q=async()=>{p(!0);try{var e,t,l;let n=(0,w.GP)(O.start,"yyyy-MM-dd"),a=(0,w.GP)(O.end,"yyyy-MM-dd"),s=H.length>0?"&city=".concat(H.join(",")):"",r=X.get("kategori"),i="";(null==d||null==(e=d.acf)?void 0:e.event_category.length)!==0||r||(i="&exclude_cat=23278,23282,25426,25433");let c="";q.length>0?c="&event_category=".concat(q.join(",")):r&&"all"!==r?c="&event_category=".concat(r):(null==d||null==(l=d.acf)||null==(t=l.event_category)?void 0:t.length)>0&&(c="&event_category=".concat(d.acf.event_category.join(","))),console.log(c);let u=await fetch("".concat("https://wordpress.visitvestfold.com","/wp-json/custom/v1/events?start_date=").concat(n,"&end_date=").concat(a).concat(s).concat(c,"&lang=").concat(o).concat(i));if(!u.ok)throw Error("Failed to fetch events");let h=await u.json();B(h),console.log(h),p(!1)}catch(e){console.error("Error fetching events:",e),p(!1)}};(0,a.useEffect)(()=>{(async()=>{try{let e="".concat("https://wordpress.visitvestfold.com","/wp-json/wp/v2/event_category"),t=new URLSearchParams({per_page:"100",lang:o,orderby:"count",order:"desc",_fields:"id,name,slug,count"}),l=await fetch("".concat(e,"?").concat(t.toString(),"&page=1"));if(!l.ok)throw Error("Failed to fetch categories");let n=parseInt(l.headers.get("X-WP-TotalPages")||"1",10),a=await l.json(),s=[];for(let l=2;l<=n;l++)s.push(fetch("".concat(e,"?").concat(t.toString(),"&page=").concat(l)).then(e=>{if(!e.ok)throw Error("Failed page ".concat(l));return e.json()}));let r=(await Promise.all(s)).flat(),i=[...a,...r],c=[23278,25246],d=c.map(e=>i.find(t=>t.id===e)).filter(Boolean),u=i.filter(e=>e.count>0||c.includes(e.id)).sort((e,t)=>t.count-e.count).filter(e=>!c.includes(e.id)),h=Math.max(0,11-d.length),g=[...u.slice(0,h),...d].filter((e,t,l)=>l.findIndex(t=>t.id===e.id)===t);R(g)}catch(e){console.error("Error fetching categories",e)}})()},[o]);let ee=e=>{let t=new Date(e);return t.setHours(0,0,0,0),t},et=e=>{let t=ee(new Date);switch(e){case"today":W({start:t,end:t}),E(t);break;case"tomorrow":let l=ee(new Date(t));l.setDate(l.getDate()+1),W({start:l,end:l}),E(l);break;case"nextWeek":let n=ee(new Date(t));n.setDate(n.getDate()+7);let a=ee(new Date(n));a.setDate(a.getDate()+6),W({start:n,end:a}),E(n)}},el=e=>{M(t=>{let l;l=t.includes(e)?t.filter(t=>t!==e):[...t,e];let n=new URLSearchParams(window.location.search);l.length>0?n.set(G,l.join(",")):n.delete(G);let a="".concat(window.location.pathname,"?").concat(n.toString());return window.history.replaceState({},"",a),l})},en=(e,t)=>{if(!e||!t)return[];let l=[],n=new Date(e);for(;n<=t;)l.push(new Date(n)),n.setDate(n.getDate()+1);return l},ea=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,l=(0,v.decode)(e.replace(/(<([^>]+)>)/gi,""));return l.length>t?"".concat(l.slice(0,t),"..."):l},es=e=>e.replace("https://wordpress.visitvestfold.com/","").replace(/\/$/,"");D.filter(e=>en(O.start,O.end).some(t=>ee(e.start_date).getTime()===ee(t).getTime())),r="no"===o?"nb-NO":"en-GB";let[er,ei]=(0,a.useState)(20),ec=(0,a.useMemo)(()=>(null==O?void 0:O.start)&&(null==O?void 0:O.end)?en(O.start,O.end).map(e=>{let t=e.toLocaleDateString("en-CA"),l=new Date(t).toLocaleDateString("en-US",{weekday:"long"}),n=D.map(e=>{var n;let a=null==(n=e.dates)?void 0:n.find(e=>t>=e.start_date&&t<=e.end_date&&e.actual_open_days===l);return a?{...e,matchedDate:a}:null}).filter(Boolean).sort((e,t)=>{var l,n;let a=(null==(l=e.matchedDate)?void 0:l.start_time)?k(e.matchedDate.start_time):"99:99",s=(null==(n=t.matchedDate)?void 0:n.start_time)?k(t.matchedDate.start_time):"99:99";return a.localeCompare(s)});return{key:t,date:e,formattedDate:t,events:n}}).filter(e=>e.events.length>0):[],[D,O]),eo=(0,a.useMemo)(()=>ec.reduce((e,t)=>e+t.events.length,0),[ec]),ed=(0,a.useMemo)(()=>{let e=er,t=[];for(let l of ec){if(e<=0)break;let n=l.events.slice(0,e);t.push({...l,events:n}),e-=n.length}return t},[ec,er]);(0,a.useEffect)(()=>{ei(20)},[ec]);let eu={"Larvik og Stavern":"larvik-stavern",Sandefjord:"sandefjord","T\xf8nsberg og F\xe6rder":"tonsberg","Horten og \xc5sg\xe5rdstrand":"horten-asgardstrand",Holmestrand:"holmestrand"},eh=Object.keys(eu),eg=()=>{let e=new URLSearchParams;H.length&&e.set(G,H.join(",")),(null==O?void 0:O.start)&&e.set(U,(0,w.GP)(O.start,"yyyy-MM-dd")),(null==O?void 0:O.end)&&e.set("to",(0,w.GP)(O.end,"yyyy-MM-dd"));let t=X.get("kategori");return t&&"all"!==t&&e.set("kategori",t),e.toString()};return(0,n.jsxs)("div",{className:"single-page",children:[(0,n.jsx)("div",{className:"text-hero yellow",children:(0,n.jsxs)("div",{className:"inner
1-hero",children:[(0,n.jsx)("h1",{children:(0,v.decode)(null==d||null==(t=d.title)?void 0:t.rendered)}),(0,n.jsx)("div",{dangerouslySetInnerHTML:{__html:null==d?void 0:d.content.rendered}})]})}),(0,n.jsxs)("div",{className:"section",children:[(null==d||null==(s=d.acf)||null==(l=s.dropdown)?void 0:l.title.length)>0?(0,n.jsxs)("div",{className:"toggler",children:[(0,n.jsxs)("div",{onClick:()=>{L(!S)},className:"toggler-header",children:[(0,n.jsx)("h3",{children:d.acf.dropdown.title}),S?(0,n.jsx)(i.g,{icon:c.w2A}):(0,n.jsx)(i.g,{icon:c.Jt$})]}),S?(0,n.jsx)("div",{className:"toggler-content",dangerouslySetInnerHTML:{__html:d.acf.dropdown.text}}):""]}):"",(0,n.jsxs)("div",{className:"event-wrapper",id:"kalender",children:[(0,n.jsxs)("div",{className:"event-sidebar",children:[(0,n.jsxs)("div",{className:"filter",children:[(0,n.jsxs)("div",{className:"filter-topbar",onClick:()=>{T(!I)},children:[(0,n.jsx)("p",{children:"Filter"}),(0,n.jsx)(i.g,{icon:c._$s})]}),I?(0,n.jsx)("ul",{className:"city-list filter-list",children:P.map(e=>{var t,l,a,s,r,o,u,h,m,v,p,f;return g?(0,n.jsxs)("li",{className:q.includes(e.id)||(Array.isArray(null==d||null==(u=d.acf)?void 0:u.event_category)?null==d||null==(h=d.acf)?void 0:h.event_category.includes(e.id):(null==d||null==(m=d.acf)?void 0:m.event_category)===e.id)?"selected inactive":"not-selected inactive",children:[(0,n.jsx)("div",{className:"select-square",children:q.includes(e.id)||(Array.isArray(null==d||null==(v=d.acf)?void 0:v.event_category)?null==d||null==(p=d.acf)?void 0:p.event_category.includes(e.id):(null==d||null==(f=d.acf)?void 0:f.event_category)===e.id)?(0,n.jsx)(i.g,{icon:c.e68}):""}),e.name]},e.id):(0,n.jsxs)("li",{className:q.includes(e.id)||(Array.isArray(null==d||null==(t=d.acf)?void 0:t.event_category)?null==d||null==(l=d.acf)?void 0:l.event_category.includes(e.id):(null==d||null==(a=d.acf)?void 0:a.event_category)===e.id)?"selected":"not-selected",onClick:()=>{var t;return t=e.id,void z(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t])},children:[(0,n.jsx)("div",{className:"select-square",children:q.includes(e.id)||(Array.isArray(null==d||null==(s=d.acf)?void 0:s.event_category)?null==d||null==(r=d.acf)?void 0:r.event_category.includes(e.id):(null==d||null==(o=d.acf)?void 0:o.event_category)===e.id)?(0,n.jsx)(i.g,{icon:c.e68}):""}),e.name]},e.id)})}):""]}),(0,n.jsxs)("div",{className:"filter datemobile",children:[(0,n.jsxs)("div",{className:"filter-topbar",onClick:()=>{F(!Z)},children:[(0,n.jsx)("p",{children:"no"===o?"Velg by":"Choose city"}),(0,n.jsx)(i.g,{icon:c._$s})]}),Z?(0,n.jsx)("ul",{className:"city-list",children:eh.map(e=>{var t,l,a,s;let r=eu[e];return g?(0,n.jsxs)("li",{className:H.includes(r)||(null==d||null==(a=d.acf)?void 0:a.cities.includes(r))?"selected inactive":"not-selected inactive",children:[(0,n.jsx)("div",{className:"select-square",children:H.includes(r)||(null==d||null==(s=d.acf)?void 0:s.cities.includes(r))?(0,n.jsx)(i.g,{icon:c.e68}):""}),e," "]},r):(0,n.jsxs)("li",{className:H.includes(r)||(null==d||null==(t=d.acf)?void 0:t.cities.includes(r))?"selected":"not-selected",onClick:()=>el(r),children:[(0,n.jsx)("div",{className:"select-square",children:H.includes(r)||(null==d||null==(l=d.acf)?void 0:l.cities.includes(r))?(0,n.jsx)(i.g,{icon:c.e68}):""}),e," "]},r)})}):""]}),(0,n.jsxs)("div",{className:"filter datemobile",children:[(0,n.jsxs)("div",{className:"filter-topbar",onClick:()=>{Y(!$)},children:[(0,n.jsx)("p",{children:"no"===o?"Dato":"Date"}),(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:(0,n.jsx)("path",{d:"M8 14C7.71667 14 7.47917 13.9042 7.2875 13.7125C7.09583 13.5208 7 13.2833 7 13C7 12.7167 7.09583 12.4792 7.2875 12.2875C7.47917 12.0958 7.71667 12 8 12C8.28333 12 8.52083 12.0958 8.7125 12.2875C8.90417 12.4792 9 12.7167 9 13C9 13.2833 8.90417 13.5208 8.7125 13.7125C8.52083 13.9042 8.28333 14 8 14ZM12 14C11.7167 14 11.4792 13.9042 11.2875 13.7125C11.0958 13.5208 11 13.2833 11 13C11 12.7167 11.0958 12.4792 11.2875 12.2875C11.4792 12.0958 11.7167 12 12 12C12.2833 12 12.5208 12.0958 12.7125 12.2875C12.9042 12.4792 13 12.7167 13 13C13 13.2833 12.9042 13.5208 12.7125 13.7125C12.5208 13.9042 12.2833 14 12 14ZM16 14C15.7167 14 15.4792 13.9042 15.2875 13.7125C15.0958 13.5208 15 13.2833 15 13C15 12.7167 15.0958 12.4792 15.2875 12.2875C15.4792 12.0958 15.7167 12 16 12C16.2833 12 16.5208 12.0958 16.7125 12.2875C16.9042 12.4792 17 12.7167 17 13C17 13.2833 16.9042 13.5208 16.7125 13.7125C16.5208 13.9042 16.2833 14 16 14ZM5 22C4.45 22 3.97917 21.8042 3.5875 21.4125C3.19583 21.0208 3 20.55 3 20V6C3 5.45 3.19583 4.97917 3.5875 4.5875C3.97917 4.19583 4.45 4 5 4H6V2H8V4H16V2H18V4H19C19.55 4 20.0208 4.19583 20.4125 4.5875C20.8042 4.97917 21 5.45 21 6V20C21 20.55 20.8042 21.0208 20.4125 21.4125C20.0208 21.8042 19.55 22 19 22H5ZM5 20H19V10H5V20ZM5 8H19V6H5V8Z",fill:"black"})})]}),$?(0,n.jsxs)("div",{className:"datemobwrapper",children:[(0,n.jsxs)("div",{className:"fast-action",children:[(0,n.jsx)("button",{className:"action-btn",onClick:()=>
1et("today"),children:"no"===o?"I dag":"Today"}),(0,n.jsx)("button",{className:"action-btn",onClick:()=>et("tomorrow"),children:"no"===o?"I morgen":"Tomorrow"}),(0,n.jsx)("button",{className:"action-btn",onClick:()=>et("nextWeek"),children:"no"===o?"Neste uke":"Next week"})]}),(0,n.jsx)(m,{lang:o,selectedRange:O,onRangeChange:W,currentDate:V,onDateChange:E})]}):""]}),(0,n.jsxs)("div",{className:"city-picker",children:[(0,n.jsx)("p",{children:"no"===o?"Velg by":"Choose City"}),(0,n.jsx)("ul",{className:"city-list",children:eh.map(e=>{var t,l,a,s;let r=eu[e];return g?(0,n.jsxs)("li",{className:H.includes(r)||(null==d||null==(a=d.acf)?void 0:a.cities.includes(r))?"selected inactive":"not-selected inactive",children:[(0,n.jsx)("div",{className:"select-square",children:H.includes(r)||(null==d||null==(s=d.acf)?void 0:s.cities.includes(r))?(0,n.jsx)(i.g,{icon:c.e68}):""}),e," "]},r):(0,n.jsxs)("li",{className:H.includes(r)||(null==d||null==(t=d.acf)?void 0:t.cities.includes(r))?"selected":"not-selected",onClick:()=>el(r),children:[(0,n.jsx)("div",{className:"select-square",children:H.includes(r)||(null==d||null==(l=d.acf)?void 0:l.cities.includes(r))?(0,n.jsx)(i.g,{icon:c.e68}):""}),e," "]},r)})})]}),(0,n.jsxs)("div",{className:"date-picker",children:[(0,n.jsx)("p",{children:"no"===o?"Velg dato":"Pick date"}),(0,n.jsxs)("div",{className:"fast-action",children:[(0,n.jsx)("button",{className:"action-btn",onClick:()=>et("today"),children:"no"===o?"I dag":"Today"}),(0,n.jsx)("button",{className:"action-btn",onClick:()=>et("tomorrow"),children:"no"===o?"I morgen":"Tomorrow"}),(0,n.jsx)("button",{className:"action-btn",onClick:()=>et("nextWeek"),children:"no"===o?"Neste uke":"Next week"})]}),(0,n.jsx)(m,{lang:o,selectedRange:O,onRangeChange:W,currentDate:V,onDateChange:E})]})]}),(0,n.jsx)("div",{className:"event-content",children:g?(0,n.jsx)(_,{lang:o}):(0,n.jsxs)(n.Fragment,{children:[ed.map(e=>{let{key:t,date:l,formattedDate:a,events:s}=e;return(0,n.jsxs)("div",{className:"event-day",children:[(0,n.jsx)("h2",{children:l.toLocaleDateString(r,{weekday:"long",day:"numeric",month:"long",year:"numeric"})}),(0,n.jsx)("div",{className:"card-container eventcards",children:(0,n.jsx)("div",{className:"card-component-wrapper",children:s.map(e=>{var t,s,i,c,u,h,g;return(0,n.jsxs)("div",{className:"card-single",children:[(0,n.jsx)(f(),{className:"image-link",href:"/".concat(es(e.link),"?").concat(eg()),children:(0,n.jsx)("div",{className:"card-image",style:{backgroundImage:(null==(t=e.media_gallery)?void 0:t.length)>0?"url(".concat((0,j.L)(e.media_gallery),")"):"none",backgroundColor:"transparent",backgroundSize:"cover",backgroundPosition:"center center"},children:(null==(i=e.media_gallery)||null==(s=i[0])?void 0:s.copyright)?(0,n.jsxs)("div",{className:"copyright-symbol",children:[(0,n.jsx)("span",{className:"c-symbol",children:"\xa9"}),(0,n.jsx)("div",{className:"copyright-text",children:e.media_gallery[0].copyright})]}):""})}),(0,n.jsxs)("div",{className:"card-content",children:[(null==(c=e.categories)?void 0:c.length)>0?(0,n.jsx)("div",{className:"event-cat-wrapper",children:e.categories.map((e,t)=>(0,n.jsx)("div",{className:"cat-pill",children:(0,v.decode)(e.name)},t))}):"",(0,n.jsxs)("div",{className:"card-title-area",children:[(0,n.jsx)(f(),{className:"text-link",href:"/".concat(es(e.link),"?").concat(eg()),children:(0,n.jsx)("h3",{children:(0,v.decode)(e.title)})}),(0,n.jsx)("p",{children:ea(e.excerpt)})]}),(0,n.jsxs)("div",{className:"additional-info-wrapper",children:[(null==e||null==(u=e.matchedDate)?void 0:u.additional_info)?(0,n.jsxs)("p",{className:"additional-info",children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:(0,n.jsx)("path",{d:"M12 12C12.55 12 13.0208 11.8042 13.4125 11.4125C13.8042 11.0208 14 10.55 14 10C14 9.45 13.8042 8.97917 13.4125 8.5875C13.0208 8.19583 12.55 8 12 8C11.45 8 10.9792 8.19583 10.5875 8.5875C10.1958 8.97917 10 9.45 10 10C10 10.55 10.1958 11.0208 10.5875 11.4125C10.9792 11.8042 11.45 12 12 12ZM12 19.35C14.0333 17.4833 15.5417 15.7875 16.525 14.2625C17.5083 12.7375 18 11.3833 18 10.2C18 8.38333 17.4208 6.89583 16.2625 5.7375C15.1042 4.57917 13.6833 4 12 4C10.3167 4 8.89583 4.57917 7.7375 5.7375C6.57917 6.89583 6 8.38333 6 10.2C6 11.3833 6.49167 12.7375 7.475 14.2625C8.45833 15.7875 9.96667 17.4833 12 19.35ZM12 22C9.31667 19.7167 7.3125 17.5958 5.9875 15.6375C4.6625 13.6792 4 11.8667 4
110.2C4 7.7 4.80417 5.70833 6.4125 4.225C8.02083 2.74167 9.88333 2 12 2C14.1167 2 15.9792 2.74167 17.5875 4.225C19.1958 5.70833 20 7.7 20 10.2C20 11.8667 19.3375 13.6792 18.0125 15.6375C16.6875 17.5958 14.6833 19.7167 12 22Z",fill:"black"})}),e.matchedDate.additional_info]}):"",(null==e?void 0:e.city)&&(0,n.jsx)("p",{className:"additional-info city",children:e.city}),(null==e||null==(h=e.matchedDate)?void 0:h.start_date)&&(0,n.jsxs)("p",{className:"additional-info date",children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:(0,n.jsx)("path",{d:"M8 14C7.71667 14 7.47917 13.9042 7.2875 13.7125C7.09583 13.5208 7 13.2833 7 13C7 12.7167 7.09583 12.4792 7.2875 12.2875C7.47917 12.0958 7.71667 12 8 12C8.28333 12 8.52083 12.0958 8.7125 12.2875C8.90417 12.4792 9 12.7167 9 13C9 13.2833 8.90417 13.5208 8.7125 13.7125C8.52083 13.9042 8.28333 14 8 14ZM12 14C11.7167 14 11.4792 13.9042 11.2875 13.7125C11.0958 13.5208 11 13.2833 11 13C11 12.7167 11.0958 12.4792 11.2875 12.2875C11.4792 12.0958 11.7167 12 12 12C12.2833 12 12.5208 12.0958 12.7125 12.2875C12.9042 12.4792 13 12.7167 13 13C13 13.2833 12.9042 13.5208 12.7125 13.7125C12.5208 13.9042 12.2833 14 12 14ZM16 14C15.7167 14 15.4792 13.9042 15.2875 13.7125C15.0958 13.5208 15 13.2833 15 13C15 12.7167 15.0958 12.4792 15.2875 12.2875C15.4792 12.0958 15.7167 12 16 12C16.2833 12 16.5208 12.0958 16.7125 12.2875C16.9042 12.4792 17 12.7167 17 13C17 13.2833 16.9042 13.5208 16.7125 13.7125C16.5208 13.9042 16.2833 14 16 14ZM5 22C4.45 22 3.97917 21.8042 3.5875 21.4125C3.19583 21.0208 3 20.55 3 20V6C3 5.45 3.19583 4.97917 3.5875 4.5875C3.97917 4.19583 4.45 4 5 4H6V2H8V4H16V2H18V4H19C19.55 4 20.0208 4.19583 20.4125 4.5875C20.8042 4.97917 21 5.45 21 6V20C21 20.55 20.8042 21.0208 20.4125 21.4125C20.0208 21.8042 19.55 22 19 22H5ZM5 20H19V10H5V20ZM5 8H19V6H5V8Z",fill:"black"})}),(0,n.jsx)("span",{className:"datetext",children:l.toLocaleDateString(r,{weekday:"long",day:"numeric",month:"short"})}),(null==(g=e.matchedDate)?void 0:g.start_time)?(null==d?void 0:d.lang)==="no"?" kl: "+k(e.matchedDate.start_time):" at "+k(e.matchedDate.start_time):""]})]}),(0,n.jsxs)("div",{className:"btn-wrap",children:[e.booking&&(0,n.jsxs)("div",{className:"booknow-wrapper",children:[(0,n.jsx)(f(),{className:"btn book",target:"_blank",href:e.booking,children:(0,n.jsx)("strong",{children:"no"===o?"Book n\xe5":"Book now"})}),e.from_price?(0,n.jsxs)("div",{className:"price-wrapper",children:[(0,n.jsx)("p",{children:"Pris fra:"}),(0,n.jsxs)("p",{className:"from-price",children:[e.from_price,",-"]})]}):""]}),e.link&&(0,n.jsx)(f(),{className:"btn main",href:"/".concat(es(e.link),"?").concat(eg()),children:(0,n.jsx)("strong",{children:"no"===o?"Les mer":"Read more"})})]})]})]},"".concat(e.id,"-").concat(a))})})})]},t)}),eo>er&&(0,n.jsxs)("div",{className:"load-more-events",children:[(0,n.jsx)("button",{className:"btn main",onClick:()=>ei(e=>e+20),children:(0,n.jsx)("strong",{children:"no"===o?"Last inn flere":"Load more"})}),(0,n.jsx)("p",{className:"load-more-count",children:"no"===o?"Viser ".concat(er," av ").concat(eo," arrangementer"):"Showing ".concat(er," of ").concat(eo," events")})]})]})})]})]})]})};var b=l(2404);let N=function(e){var t;let{pageData:l}=e,{setPageData:s}=(0,x.B)();return(0,a.useEffect)(()=>{s(l)},[l,s]),(0,n.jsxs)("div",{className:"single-page",children:[(0,n.jsx)("div",{className:"text-hero grey",children:(0,n.jsxs)("div",{className:"inner-hero",children:[(0,n.jsx)("h1",{children:(0,v.decode)(l.title.rendered)}),(0,n.jsx)("p",{dangerouslySetInnerHTML:{__html:null==l||null==(t=l.acf)?void 0:t.custom_excerpt}})]})}),(0,n.jsx)("div",{className:"backgroundgrey",children:(0,n.jsx)(b.default,{post:l})})]})};var S=l(2521);let L=function(e){var t;let{lang:l,pageData:s}=e,{setPageData:r}=(0,x.B)();(0,a.useEffect)(()=>{r(s)},[s,r]);let[i,c]=(0,a.useState)([]),o=(0,u.useSearchParams)(),d="no"===s.lang?"side":"page",h=parseInt(o.get(d)||"1",10),[g,m]=(0,a.useState)(h),[p,f]=(0,a.useState)(1),j=(0,a.useRef)(null);(0,a.useEffect)(()=>{(async()=>{try{let e=await fetch("https://wordpress.visitvestfold.com/wp-json/wp/v2/posts?per_page=".concat(9,"&page=").concat(g,"&lang=").concat(s.lang,"&orderby=menu_order&order=asc"));if(!e.ok)throw Error("Error: ".concat(e.status));let t=await e.json(),l=e.headers.get("X-WP-TotalPages");c(t),f(parseInt(l,10))}catch(e){console.error("Error fetching posts:",e)}})()},[g,s]);let _=(0,u.useRouter)(),w=e=>{m(e);let t=new URLSearchParams(o.toString());t.set(d,e),_.push("?".concat(t.toString()),{scroll:!1}),j.current&&j.current.scrollIntoView({behavior:"smooth",block:"start"})};return(0,a.useEffect)(()=>{m(parseInt(o.get(d)||"1",10))},[o]),(0,n.jsxs)("div",{className:"single-page",children:[(0,n.jsx)("div",{className:"text-hero olive",children:(0,n.jsxs)("div",{className:"inner
1-hero",children:[(0,n.jsx)("h1",{children:(0,v.decode)(null==s?void 0:s.title.rendered)}),(0,n.jsx)("div",{dangerouslySetInnerHTML:{__html:null==s||null==(t=s.content)?void 0:t.rendered}})]})}),(0,n.jsx)("div",{className:"backgroundgrey",style:{paddingTop:"40px",paddingBottom:"40px"},children:(0,n.jsxs)("div",{className:"wrapper",ref:j,children:[i.length>0?(0,n.jsx)(S.A,{lang:l,cards:i}):(0,n.jsxs)("div",{className:"center",children:[(0,n.jsx)("i",{className:"fa-solid fa-spin fa-spinner-scale"}),(0,n.jsx)("p",{children:"no"===l?"Laster inn..":"Loading.."})]}),(0,n.jsxs)("div",{className:"pagination",children:[(0,n.jsx)("button",{disabled:1===g,onClick:()=>w(g-1),children:"no"===l?"Forrige":"Previous"}),(0,n.jsxs)("span",{children:["no"===l?"Side":"Page"," ",g," ","no"===l?"av":"of"," ",p]}),(0,n.jsx)("button",{disabled:g===p,onClick:()=>w(g+1),children:"no"===l?"Neste":"Next"})]})]})})]})};l(1657);let H=function(e){var t,l,s;let{pageData:r}=e,{setPageData:i}=(0,x.B)();(0,a.useEffect)(()=>{i(r)},[r,i]);let[c,o]=(0,a.useState)([]);(0,a.useEffect)(()=>{var e,t,l;(null==r||null==(e=r.acf)?void 0:e.product_search)||!((null==r||null==(l=r.acf)||null==(t=l.content_cards)?void 0:t.length)>0)||d(r.acf.content_cards)},[r,i]);let d=async e=>{try{let t=e.map(async e=>{if(e.img){let t=await fetch("https://wordpress.visitvestfold.com/wp-json/wp/v2/media/".concat(e.img));if(!t.ok)return e;let l=await t.json();return{...e,img_url:l.source_url}}return e}),l=await Promise.all(t);console.log(l),o(l)}catch(e){console.error("Error fetching images:",e)}};return(0,n.jsxs)("div",{className:"single-page",children:[(0,n.jsx)("div",{className:"text-hero olive",children:(0,n.jsxs)("div",{className:"inner-hero",children:[(0,n.jsx)("h1",{children:(0,v.decode)(null==r||null==(t=r.title)?void 0:t.rendered)}),(0,n.jsx)("div",{dangerouslySetInnerHTML:{__html:(0,v.decode)(null==r||null==(l=r.excerpt)?void 0:l.rendered)}})]})}),(0,n.jsx)("div",{className:"backgroundgrey",children:(0,n.jsx)("div",{className:"wrapper",children:(0,n.jsx)("div",{className:"page-content todo",children:!(null==r||null==(s=r.acf)?void 0:s.product_search)&&c.length>0&&(0,n.jsx)("div",{className:"related-items",children:(0,n.jsx)("div",{className:"related-grid",children:c.map((e,t)=>(0,n.jsxs)("div",{className:"related-card",children:[(0,n.jsx)("div",{className:"related-image",children:(null==e?void 0:e.img_url)&&(0,n.jsx)("a",{href:e.link.url,target:e.link.target,children:(0,n.jsx)("div",{className:"img-background",style:{background:"url('".concat(e.img_url,"') no-repeat"),backgroundSize:"cover",backgroundPosition:"center center",width:"100%",height:"296px"}})})}),(0,n.jsxs)("div",{className:"related-content",children:[(0,n.jsxs)("div",{className:"related-content-title",children:[(0,n.jsx)("a",{href:e.link.url,target:e.link.target,children:(0,n.jsx)("h3",{children:(0,v.decode)(e.title)})}),(0,n.jsx)("p",{dangerouslySetInnerHTML:{__html:e.excerpt}})]}),(0,n.jsx)("div",{className:"related-btn-wrap",children:(0,n.jsx)("a",{href:e.link.url,target:e.link.target,className:"read-more",children:e.link.title})})]})]},t))})})})})})]})};var M=l(4897);let V={width:"100%",height:"650px"},E={lat:59.1313,lng:10.2166},D=function(e){let{lang:t,markers:l=[]}=e,{isLoaded:s}=(0,M.KD)({googleMapsApiKey:"AIzaSyAh84dfg7hHhd7zOdb1jUN2XZtlgqIRDyg"}),[r,i]=(0,a.useState)(null),c=(0,a.useMemo)(()=>l.filter(e=>e.lat&&e.lon&&!isNaN(e.lat)&&!isNaN(e.lon)),[l]);return s?(0,n.jsxs)(M.u6,{mapContainerStyle:V,zoom:9,center:E,children:[(0,n.jsx)(M.w1,{children:e=>c.map((t,l)=>(0,n.jsx)(M.pH,{position:{lat:Number(t.lat),lng:Number(t.lon)},title:t.title,onClick:()=>i(t),clusterer:e},l))}),r&&(0,n.jsx)(M.Fu,{position:{lat:Number(r.lat),lng:Number(r.lon)},onCloseClick:()=>i(null),children:(0,n.jsxs)("div",{style:{padding:"10px",maxWidth:"200px"},children:[(0,n.jsx)("h4",{style:{marginBottom:"15px",fontSize:"20px"},children:(0,v.decode)(r.title)}),(0,n.jsx)(f(),{href:"/".concat(r.link.replace("https://wordpress.visitvestfold.com/","").replace(/\/$/,"")),passHref:!0,children:(0,n.jsx)("button",{style:{backgroundColor:"#003633",color:"#fff",border:"none",padding:"8px 12px",borderRadius:"3px",cursor:"pointer",width:"100%",fontFamily:"arial",fontWeight:"600",fontSize:"20px"},children:"no"===t?"Les mer":"Read more"})})]})})]}):(0,n.jsx)("p",{children:"no"===t?"Laster inn kart...":"Loading map..."})},B=function(e){var t;let{pageData:l}=e,{setPageData:s}=(0,x.B)(),[r,o]=(0,a.useState)(new Set),[d,u]=(0,a.useState)({activities:!1,attractions:!1,shopping:!1,accommodations:!1,food:!1}),[h,g]=(0,a.useState)([]),[m,p]=(0,a.useState)(!1);(0,a.useEffect)(()=>
1{if(0===r.size)return void g([]);p(!0);let e={activities:"activities",attractions:"attractions",shopping:"simple_reta",accommodations:"accomodations",food:"catering"};(async()=>{let t=[];for(let[s,i]of Object.entries(e)){var n,a;let e=j[i],c=null!=(a=null==l||null==(n=l.acf)?void 0:n.city_selection)?a:"",o="";c&&(o="&city_category="+c);let d=Object.values(w[s].filters).flatMap(e=>"no"===_?e.ids_no:e.ids_en).filter(e=>r.has(e));if(d.length>0)try{let l=await fetch("".concat("https://wordpress.visitvestfold.com","/wp-json/wp/v2/").concat(i,"?").concat(e,"=").concat(d.join(","),"&per_page=100&lang=").concat(_).concat(o));if(!l.ok)throw Error("Failed to fetch ".concat(i));let n=await l.json();t=[...t,...n.map(e=>{var t,l,n,a;return{title:e.title.rendered,type:s,link:e.link,lat:null==(l=e.acf)||null==(t=l.location_gps)?void 0:t.lat,lon:null==(a=e.acf)||null==(n=a.location_gps)?void 0:n.lon}})]}catch(e){console.error("Error fetching posts:",e)}}console.log(t),g(t),p(!1)})()},[r]),(0,a.useEffect)(()=>{s(l)},[l,s]);let j={activities:"activity_category",attractions:"attraction_category",accomodations:"accomodation_category",simple_reta:"simple_reta_category",catering:"catering_category"},_=(null==l?void 0:l.lang)==="no"?"no":"en",w={activities:{no:"Aktiviteter",en:"Activities",filters:[{ids_no:[23576],ids_en:[24051],no:"Aktivitetsparker og familieparker",en:"Amusement parks & family parks"},{ids_no:[23534],ids_en:[23838],no:"Badestrender og sv\xf8mmehall",en:"Beaches & swimming pools"},{ids_no:[23612],ids_en:[24217],no:"Bes\xf8ksg\xe5rd og hest",en:"Petting farms & horse riding"},{ids_no:[35064],ids_en:[24163],no:"B\xe5tturer",en:"Boat tours"},{ids_no:[23702],ids_en:[24660],no:"Fallskjerm og tandemhopp",en:"Skydiving & tandem jumps"},{ids_no:[23546],ids_en:[23911],no:"Fiske",en:"Fishing"},{ids_no:[23540],ids_en:[23883],no:"Golf",en:"Golf"},{ids_no:[23610],ids_en:[24207],no:"Guiding og sightseeing",en:"Guided tours & sightseeing"},{ids_no:[23574,23536,23728],ids_en:[24048,23841],no:"Innend\xf8rsaktiviteter",en:"Indoor activities"},{ids_no:[23658],ids_en:[24536],no:"Kajakk og padling",en:"Kayaking & paddling"},{ids_no:[23584],ids_en:[24094],no:"Klatring",en:"Climbing"},{ids_no:[23542],ids_en:[23886],no:"Sportsaktiviteter",en:"Sports activities"},{ids_no:[23586],ids_en:[24123],no:"Sykkel",en:"Cycling"},{ids_no:[23548],ids_en:[23924],no:"Vandring og kyststiene",en:"Hiking & coastal trails"},{ids_no:[23556],ids_en:[23962],no:"Vinter",en:"Winter activities"}]},attractions:{no:"Attraksjoner & museum",en:"Attractions & museums",filters:[{ids_no:[23378],ids_en:[23833],no:"Museum",en:"Museum"},{ids_no:[23382],ids_en:[23854],no:"Gallerier",en:"Galleries"},{ids_no:[23420],ids_en:[24014],no:"Arkitektur & skulptur",en:"Architecture & sculpture"},{ids_no:[23410],ids_en:[23983],no:"Naturattraksjoner",en:"Natural attractions"},{ids_no:[23390],ids_en:[23904],no:"Kulturminner",en:"Cultural heritage"},{ids_no:[23380,35197],ids_en:[23845],no:"Kirker",en:"Churches"}]},shopping:{no:"Handel & service",en:"Shopping & service",filters:[{ids_no:[25151,23806,23786],ids_en:[],no:"Lokal mat",en:"Local food"},{ids_no:[25107,25111,25105,25113,25103,25109],ids_en:[],no:"Service & tjenester",en:"Services"},{ids_no:[25147],ids_en:[],no:"Shopping",en:"Shopping"}]},accommodations:{no:"Overnatting",en:"Accommodations",filters:[{ids_no:[22965],ids_en:[23054],no:"Hotell",en:"Hotel"},{ids_no:[22977],ids_en:[23075],no:"Camping",en:"Camping"},{ids_no:[22975,22993],ids_en:[23071,23111,23134],no:"Hytter, rom og leiligheter",en:"Cabins, rooms & apartments"},{ids_no:[22967,22985],ids_en:[23094],no:"Gjestehavn",en:"Guest harbor"},{ids_no:[23025],ids_en:[23057],no:"Bed&Breakfast og vandrerhjem",en:"B&B & hostels"}]},food:{no:"Mat & drikke",en:"Food & drinks",filters:[{ids_no:[23764],ids_en:[23879],no:"Restauranter",en:"Restaurants"},{ids_no:[23766],ids_en:[24006],no:"Bakerier & caf\xe9er",en:"Bakeries & caf\xe9s"},{ids_no:[23762],ids_en:[23876],no:"Barer & puber",en:"Bars & pubs"},{ids_no:[23770,23778],ids_en:[24075,24152],no:"Selskapslokaler & catering",en:"Event venues & catering"},{ids_no:[23794,23806],ids_en:[24667,24919],no:"Lokal mat & g\xe5rdsbutikk",en:"Local food & farm shops"}]}};return(0,n.jsxs)("div",{className:"single-page",children:[(0,n.jsx)("div",{className:"text-hero grey",children:(0,n.jsxs)("div",{className:"inner
1-hero",children:[(0,n.jsx)("h1",{children:(0,v.decode)(null==l?void 0:l.title.rendered)}),(0,n.jsx)("p",{dangerouslySetInnerHTML:{__html:null==l||null==(t=l.content)?void 0:t.rendered}})]})}),(0,n.jsx)("div",{className:"backgroundgrey",children:(0,n.jsx)("div",{className:"wrapper",children:(0,n.jsx)("div",{className:"post-content mapcontent",children:(0,n.jsxs)("div",{className:"post-content--content",children:[(0,n.jsx)("p",{children:(null==l?void 0:l.lang)==="no"?"Kartet er klikkbart og kan zoomes.":"The map is clickable and can be zoomed."}),(0,n.jsx)("div",{className:"map-filtering",children:Object.entries(w).map(e=>{let[t,l]=e;return(0,n.jsxs)("div",{className:"filtering",children:[(0,n.jsxs)("div",{className:"filtering-header",onClick:()=>{u({activities:!1,attractions:!1,shopping:!1,accommodations:!1,food:!1,[t]:!d[t]})},children:[l[_],(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:(0,n.jsx)("path",{d:"M11 21V15H13V17H21V19H13V21H11ZM3 19V17H9V19H3ZM7 15V13H3V11H7V9H9V15H7ZM11 13V11H21V13H11ZM15 9V3H17V5H21V7H17V9H15ZM3 7V5H13V7H3Z",fill:"#1C1B1F"})})]}),d[t]?(0,n.jsx)("div",{className:"filtering-content",children:(0,n.jsx)("ul",{className:"map-filter-list",children:l.filters.map(e=>{let t="no"===_?e.ids_no:e.ids_en,l=t.some(e=>r.has(e));return(0,n.jsxs)("li",{className:l?"selected":"not-selected",onClick:()=>{o(e=>{let l=new Set(e);return t.some(e=>l.has(e))?t.forEach(e=>l.delete(e)):t.forEach(e=>l.add(e)),new Set(l)})},children:[(0,n.jsx)("div",{className:"select-square",children:l?(0,n.jsx)(i.g,{icon:c.e68}):""}),e[_]]},e.no)})})}):null]},t)})}),(0,n.jsx)("div",{className:"map-container",children:(0,n.jsx)(D,{lang:_,markers:h.filter(e=>e.lat&&e.lon)})}),h.length>0&&(0,n.jsxs)("div",{className:"filtered-results",children:[(0,n.jsx)("h3",{children:"no"===_?"Lokasjoner:":"Locations:"}),(0,n.jsx)("ul",{children:h.map((e,t)=>(0,n.jsx)("li",{children:(0,n.jsx)(f(),{href:"/".concat(e.link.replace("https://wordpress.visitvestfold.com/","").replace(/\/$/,"")),children:(0,v.decode)(e.title)})},t))})]})]})})})})]})};var A=l(5239);let I=function(e){var t,l,s,r,i;let{pageData:c}=e,{setPageData:o}=(0,x.B)(),[d,u]=(0,a.useState)(null),[h,g]=(0,a.useState)({x:50,y:50});return(0,a.useEffect)(()=>{o(c)},[c,o]),(0,a.useEffect)(()=>{let e=c.featured_media;e&&fetch("https://wordpress.visitvestfold.com/wp-json/wp/v2/media/".concat(e)).then(e=>e.json()).then(e=>{var t,l;u(e.source_url),console.log(e),g({x:(null==(t=e.meta)?void 0:t.focal_x)?parseFloat(e.meta.focal_x):50,y:(null==(l=e.meta)?void 0:l.focal_y)?parseFloat(e.meta.focal_y):50})}).catch(e=>{console.error("Error fetching image URL:",e)})},[null==(l=c._embedded)||null==(t=l["wp:featuredmedia"])?void 0:t[0]]),null==(r=c._embedded)||null==(s=r["wp:featuredmedia"])||s[0],(0,n.jsxs)("div",{className:"single-page",children:[(0,n.jsx)("div",{className:"backgroundgrey",children:(0,n.jsx)("div",{className:"wrapper",children:d&&(0,n.jsx)(A.default,{className:"post-feature",src:d,width:"1240",height:"547"})})}),(0,n.jsx)("div",{className:"text-hero grey",children:(0,n.jsxs)("div",{className:"inner-hero",children:[(0,n.jsx)("h1",{children:(0,v.decode)(c.title.rendered)}),(0,n.jsx)("p",{children:null==c||null==(i=c.acf)?void 0:i.excerpt})]})}),(0,n.jsx)("div",{className:"backgroundgrey",children:(0,n.jsx)("div",{className:"wrapper",children:(0,n.jsx)("div",{className:"post-content",children:(0,n.jsx)("div",{className:"post-content--content",dangerouslySetInnerHTML:{__html:c.content.rendered}})})})})]})};l(442);let T=function(e){let{title:t,text:l,cards:s}=e,[r,i]=(0,a.useState)({}),c=async e=>{try{let t=await fetch("https://wordpress.visitvestfold.com/wp-json/wp/v2/media/".concat(e));return(await t.json()).source_url}catch(e){return console.error("Error fetching image:",e),null}};return(0,a.useEffect)(()=>{(async()=>{let e={};for(let t of s){let l=await c(t.img);l&&(e[t.img]=l)}i(e)})()},[s]),(0,n.jsxs)("div",{className:"card-container",children:[(0,n.jsxs)("div",{className:"card-container--title",children:[(0,n.jsx)("h2",{children:t}),(0,n.jsx)("p",{children:l})]}),(0,n.jsx)("div",{className:"card-component-wrapper",children:s.map((e,t)=>{let l=r[e.img];return(0,n.jsxs)("div",{className:"card-single",children:[(0,n.jsx)("div",{className:"card-image",style:{backgroundImage:l?"url(".concat(l,")"):"none",backgroundColor:l?"transparent":"#f0f0f0"}}),(0,n.jsxs)("div",{className:"card-content",children:[(0,n.jsxs)("div",{className:"card-title-area",children:[(0,n.jsx)("h3",{children:e.title}),(0,n.jsx)("p",{children:e.text})]}),e.link?(0,n.jsx)(f(),{className:"btn main",href:e.link.url,children:e.link.title}):""]})]},"card-"+t)})})]})},Z=function(e){var t,l,s,r;let{pageData:i}=e,{setPageData:c}=(0,x.B)();(0,a.useEffect)(()=>{c(i)},[i,c]);let[o,d]=(0,a.useState)((null==i||null==(l=i.acf)||null==(t=l.cards_expand)?void 0:t.cards)||[]),[u,h]=(0,a.useState)({}),g=async e=>{try{let t=await fetch("https://wordpress.visitvestfold.com/wp-json/wp/v2/media/".concat(e));return(await t.json()).source_url}catch(e){return console.error("Error fetching image:",e),null}};return(0,a.useEffect)(()=>{(async()=>{let e={};for(let t of o){let l=await g(t.img);l&&(e[t.img]=l)}h(e)})()},[o,c]),(0,n.jsxs)("div",{className:"single-page",children:[(0,n.jsx)("div",{className:"text-hero grey",children:(0,n.jsxs)("div",{className:"inner
1-hero",children:[(0,n.jsx)("h1",{children:i.title.rendered}),(0,n.jsx)("p",{children:null==(s=i.acf)?void 0:s.excerpt})]})}),(0,n.jsx)("div",{className:"backgroundgrey",children:(0,n.jsx)("div",{className:"wrapper",children:(0,n.jsx)("div",{className:"post-content-industry",children:i.acf.content_cards.cards.length>0?(0,n.jsx)(T,{title:i.acf.content_cards.title,text:i.acf.content_cards.text,cards:i.acf.content_cards.cards}):""})})}),(null==(r=i.acf)?void 0:r.cards_expand)?(0,n.jsx)("div",{className:"background-cards",style:{backgroundColor:i.acf.cards_expand.background},children:(0,n.jsx)("div",{className:"expand-cards",children:i.acf.cards_expand.cards.map((e,t)=>{let l=u[e.img];return(0,n.jsxs)("div",{className:"expand-card",children:[(0,n.jsx)("div",{className:"expand-image",style:{backgroundImage:l?"url(".concat(l,")"):"none",backgroundColor:l?"transparent":"#f0f0f0"}}),(0,n.jsxs)("div",{className:"expand-content",children:[(0,n.jsxs)("div",{className:"expand--title",children:[(0,n.jsx)("h3",{children:e.title}),(0,n.jsx)("p",{children:e.text})]}),e.link?(0,n.jsx)("div",{className:"btn-wrap",children:(0,n.jsx)(f(),{className:"btn main",href:e.link.url,children:(0,n.jsx)("strong",{children:e.link.title})})}):""]})]},"expand-card-"+t)})})}):""]})},F=function(e){var t;let{pageData:l}=e,{setPageData:s}=(0,x.B)();return(0,a.useEffect)(()=>{s(l)},[l,s]),(0,n.jsxs)("div",{className:"single-page",children:[(0,n.jsx)("div",{className:"text-hero grey",children:(0,n.jsxs)("div",{className:"inner-hero",children:[(0,n.jsx)("h1",{children:(0,v.decode)(l.title.rendered)}),(0,n.jsx)("p",{children:(0,v.decode)(null==(t=l.acf)?void 0:t.excerpt)})]})}),(0,n.jsx)("div",{className:"backgroundgrey",children:(0,n.jsx)("div",{className:"wrapper",children:(0,n.jsx)("div",{className:"post-content",children:(0,n.jsx)(b.default,{post:l})})})})]})},P=function(e){var t;let{pageData:l}=e,{setPageData:s}=(0,x.B)();return(0,a.useEffect)(()=>{s(l)},[l,s]),(0,n.jsxs)("div",{className:"single-page",children:[(0,n.jsx)("div",{className:"text-hero grey",children:(0,n.jsxs)("div",{className:"inner-hero",children:[(0,n.jsx)("h1",{children:l.title.rendered}),(0,n.jsx)("p",{children:null==(t=l.acf)?void 0:t.excerpt})]})}),(0,n.jsx)("div",{className:"backgroundgrey",children:(0,n.jsx)("div",{className:"wrapper",children:(0,n.jsx)("div",{className:"post-content",children:(0,n.jsx)("div",{className:"post-content--content",dangerouslySetInnerHTML:{__html:l.content.rendered}})})})})]})},R=function(e){var t,l,s;let{pageData:r}=e,{setPageData:i}=(0,x.B)();return(0,a.useEffect)(()=>{i(r)},[r,i]),(0,n.jsxs)("div",{className:"single-page",children:[(0,n.jsx)("div",{className:"text-hero grey",children:(0,n.jsxs)("div",{className:"inner-hero with-pills",children:[(0,n.jsxs)("div",{className:"pill-wrapper",children:[(null==(t=r.acf)?void 0:t.location_marker)?(0,n.jsxs)("div",{className:"location-pill",children:[(0,n.jsx)("i",{className:"fa-light fa-location-dot","aria-hidden":"true"}),(0,n.jsx)("p",{children:r.acf.location_marker})]}):"",(null==(l=r.acf)?void 0:l.category)?(0,n.jsx)("div",{className:"category-pill",children:(0,n.jsx)("p",{children:r.acf.category})}):""]}),(0,n.jsxs)("div",{className:"title-area",children:[(0,n.jsx)("h1",{children:r.title.rendered}),(0,n.jsx)("p",{children:null==(s=r.acf)?void 0:s.excerpt})]})]})}),(0,n.jsx)("div",{className:"backgroundgrey",children:(0,n.jsx)("div",{className:"wrapper",children:(0,n.jsx)("div",{className:"post-content",children:(0,n.jsx)("div",{className:"post-content--content",dangerouslySetInnerHTML:{__html:r.content.rendered}})})})})]})};l(2563);let q=function(e){var t,l,s,r;let{pageData:i}=e,{setPageData:c}=(0,x.B)();(0,a.useEffect)(()=>{c(i)},[i,c]);let[o,d]=(0,a.useState)([]),u=null==i||null==(l=i._embedded)||null==(t=l["wp:featuredmedia"])?void 0:t[0];(0,a.useEffect)(()=>{h()},[i,c]);let h=async()=>{if(!(null==i?void 0:i.categories)||0===i.categories.length)return;let e="no"===i.lang?21247:21249,t=i.categories.filter(t=>t!==e);try{let l=[];if(t.length>0){let e=await fetch("https://wordpress.visitvestfold.com/wp-json/wp/v2/posts?per_page=3&exclude=".concat(i.id,"&lang=").concat(i.lang,"&categories=").concat(t.join(","),"&orderby=menu_order&order=asc"));if(!e.ok)throw Error("Main fetch failed");l=await e.json()}if(l.length<3&&i.categories.includes(e)){let t=await fetch("https://wordpress.visitvestfold.com/wp-json/wp/v2/posts?per_page=".concat(3-l.length,"&exclude=").concat(i.id,"&lang=").concat(i.lang,"&categories=").concat(e,"&orderby=menu_order&order=asc"));if(!t.ok)throw Error("Fallback fetch failed");let n=await t.json();l=[...l,...n]}d(l)}catch(e){console.error("Error fetching related posts:",e)}};return(0,n.jsxs)("div",{className:"single-post",children:[(0,n.jsx)("div",{className:"wrapper",children:(null==u?void 0:u.source_url)?(0,n.jsx)(A.default,{className:"post-feature",src:u.source_url,alt:(null==u?void 0:u.alt_text)||"Featured Image",width:"1240",height:"600"}):""}),(0,n.jsxs)("div",{className:"wrapper",children:[(0,n.jsxs)("div",{className:"post-content",children:[(0,n.jsxs)("div",{className:"post-intro",children:[(0,n.jsx)("h1",{children:(0,v.decode)(null==i||null==(s=i.title)?void 0:s.rendered)}),(null==i?void 0:i.modified_gmt)&&(0,n.jsxs)("small",{className:"modified_date",children:[(null==i?void 0:i.lang)==="no"?"Sist oppdatert: ":"Last updated: ",(0,n.jsx)("time",{dateTime:i.modified_gmt,children:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"no";
1return e?new Date(e+"Z").toLocaleString("no"===t?"nb-NO":"en-GB",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"}):""}(i.modified_gmt,null==i?void 0:i.lang)})]}),(null==i||null==(r=i.acf)?void 0:r.excerpt)&&(0,n.jsx)("p",{className:"excerpt",dangerouslySetInnerHTML:{__html:i.acf.excerpt}})]}),(0,n.jsx)(b.default,{post:i})]}),o.length>0?(0,n.jsxs)("div",{className:"related-posts",children:[(0,n.jsx)("h2",{children:"no"===i.lang?"Andre artikler":"Related articles"}),(0,n.jsx)(S.A,{lang:null==i?void 0:i.lang,cards:o})]}):""]})]})},z=function(e){let{lang:t,cards:l}=e,[s,r]=(0,a.useState)({}),i=(0,a.useRef)(null),[c,o]=(0,a.useState)(!1),[d,u]=(0,a.useState)(!1);(0,a.useEffect)(()=>{h()},[l]);let h=()=>{if(!i.current)return;let{scrollLeft:e,scrollWidth:t,clientWidth:l}=i.current;console.log("Left: "+e),console.log("Width: "+t),console.log("Client: "+l),o(e>0),u(e+5<t-l)},g=e=>{if(!i.current)return;let t=i.current.querySelector(".post-listing");if(!t)return;let l=window.innerWidth<=1200,n=t.offsetWidth+(l?16:20),a="next"===e?n:-n;console.log(n),console.log(a),i.current.scrollBy({left:a,behavior:"smooth"}),setTimeout(h,400)},m=async e=>{if(void 0!==e)try{let t=await fetch("https://wordpress.visitvestfold.com/wp-json/wp/v2/media/".concat(e));return(await t.json()).source_url}catch(e){return console.error("Error fetching image:",e),null}},p=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,l=(0,v.decode)(e.replace(/(<([^>]+)>)/gi,""));return l.length>t?"".concat(l.slice(0,t),"..."):l},x=e=>e.replace("https://wordpress.visitvestfold.com/","").replace(/\/$/,"");return(0,a.useEffect)(()=>{(async()=>{let e={};for(let t of l){if(0===t.featured_media)continue;let l=await m(t.featured_media);l&&(e[t.featured_media]=l)}r(e)})()},[l]),(0,n.jsx)("div",{className:"relationship-block",style:{left:"unset",right:"unset",width:"unset"}
1,children:(0,n.jsxs)("div",{className:"inside",children:[(0,n.jsx)("div",{className:"title-area",children:(0,n.jsx)("h2",{children:"no"===t?"Se ogs\xe5":"You may also like"})}),(0,n.jsx)("ul",{className:"post-listings",ref:i,onScroll:h,children:l.map((e,l)=>{var a,r,i,c,o,d,u,h;return(0,n.jsxs)("li",{className:"post-listing",children:[Array.isArray(null==(a=e.acf)?void 0:a.media_gallery)&&e.acf.media_gallery.length>0?(0,n.jsx)(f(),{className:"image-wrapper",style:{display:"block",width:"100%"},href:"/".concat(x(e.link)),children:(0,n.jsx)("div",{className:"listing-image",style:{backgroundImage:"url(".concat((0,j.L)(e.acf.media_gallery),")"),backgroundColor:(0,j.L)(e.acf.media_gallery)?"transparent":"#f0f0f0",backgroundSize:"cover",backgroundPosition:"center center"}})}):(0,n.jsx)(f(),{style:{display:"block",width:"100%"},href:"/".concat(x(e.link)),children:(0,n.jsx)("div",{className:"card-image",style:{backgroundImage:(null==e||null==(c=e.yoast_head_json)||null==(i=c.og_image)||null==(r=i[0])?void 0:r.url)?"url(".concat(e.yoast_head_json.og_image[0].url,")"):(null==s?void 0:s[e.featured_media])?"url(".concat(s[e.featured_media],")"):"none",backgroundColor:s[e.featured_media]?"transparent":"#f0f0f0",backgroundSize:"cover",backgroundPosition:"center center"}})}),(0,n.jsxs)("div",{className:"listing-content",children:[(0,n.jsxs)("div",{className:"listing-content-titlearea",children:[(0,n.jsx)(f(),{href:"/".concat(x(e.link)),children:(0,n.jsx)("h3",{children:(0,v.decode)(null!=(u=e.title.rendered)?u:e.title)})}),(0,n.jsx)("p",{children:p(null!=(h=e.excerpt.rendered)?h:e.excerpt)})]}),(0,n.jsxs)("div",{className:"listing-btn-wrap",children:[(null==e||null==(o=e.acf)?void 0:o.booking_website)?(0,n.jsx)(f(),{target:"_blank",className:"book-btn",href:null==e||null==(d=e.acf)?void 0:d.booking_website,children:(0,n.jsx)("strong",{children:"no"===t?"Book n\xe5":"Book now"})}):null,e.link?(0,n.jsx)(f(),{className:"post-btn",href:"/".concat(x(e.link)),children:(0,n.jsx)("strong",{children:"no"===t?"Les mer":"Read more"})}):null]})]})]},"card-".concat(l))})}),l.length>3&&(0,n.jsxs)("div",{className:"slider-wrapper",children:[(0,n.jsx)("svg",{onClick:()=>g("prev"),className:c?"":"disabled",xmlns:"http://www.w3.org/2000/svg",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",children:(0,n.jsx)("path",{d:"M36.6667 20.1668L14.3459 20.1668L24.6125 9.90016L22 7.3335L7.33335 22.0002L22 36.6668L24.6125 34.1002L14.3459 23.8335L36.6667 23.8335L36.6667 20.1668Z",fill:"black"})}),(0,n.jsx)("svg",{onClick:()=>g("next"),className:d?"":"disabled",xmlns:"http://www.w3.org/2000/svg",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",children:(0,n.jsx)("path",{d:"M7.33334 23.8332L29.6542 23.8332L19.3875 34.0998L22 36.6665L36.6667 21.9998L22 7.33317L19.3875 9.89984L29.6542 20.1665L7.33334 20.1665L7.33334 23.8332Z",fill:"black"})})]})]})})};l(6783);let O=e=>{if(!e)return null;let t=e.match(/youtu\.be\/([^?&]+)/);if(t)return"https://www.youtube.com/embed/".concat(t[1]);let l=e.match(/youtube\.com\/watch\?v=([^&]+)/);if(l)return"https://www.youtube.com/embed/".concat(l[1]);let n=e.match(/vimeo\.com\/(\d+)/);return n?"https://player.vimeo.com/video/".concat(n[1]):null};function W(e){let{images:t,videos:l}=e,s=(0,a.useRef)(null),[r,i]=(0,a.useState)(0),c=(0,a.useMemo)(()=>{if(!t||0===t.length)return[];let e=t.find(e=>e.isDefault);return[...e?[e]:[],...t.filter(e=>!e.isDefault).sort((e,t)=>e.sequence-t.sequence)]},[t]),o=(0,a.useMemo)(()=>[...c.map(e=>({type:"image",data:e})),...(l||[]).filter(e=>O(e.external_link_url)).map(e=>({type:"video",data:e}))],[c,l]),d=e=>{var t;if(!s.current)return;let l=(null==(t=s.current.firstChild)?void 0:t.offsetWidth)||0,n="right"===e?r+1:r-1;n>=0&&n<o.length&&(s.current.scrollBy({left:"right"===e?l:-l,behavior:"smooth"}),i(n))};return(0,a.useEffect)(()=>{let e=()=>{var e;if(s.current)i(Math.round(s.current.scrollLeft/((null==(e=s.current.firstChild)?void 0:e.offsetWidth)||1)))},t=s.current;return null==t||t.addEventListener("scroll",e),()=>null==t?void 0:t.removeEventListener("scroll",e)},[]),(0,n.jsxs)("div",{className:"carousel-container",children:[o.length>0&&(0,n.jsx)("div",{className:"arrow left",onClick:()=>d("left"),children:(0,n.jsx)("i",{className:"fa-light fa-arrow-left","aria-hidden":"true"})}),(0,n.jsx)("ul",{className:"carousel",ref:s,children:o.map((e,t)=>(0,n.jsx)("li",{className:"carousel-item",children:"image"===e.type?(0,n.jsx)("div",{className:"gallery-img-background",style:{backgroundImage:"url(".concat(e.data.image_url).concat(e.data.imageresizecrop?"[ProductDetail_New][".concat(e.data.imageresizecrop,"]"):"",")"),backgroundRepeat:"no-repeat",backgroundSize:"cover",backgroundPosition:"center center",width:"100%",height:"100%"},children:e.data.copyright?(0,n.jsxs)("span",{className:"copyright-carousel",children:["\xa9 ",(0,n.jsx)("span",{className:"copyrightText",children:e.data.copyright})]}):null}):(0,n.jsx)("div",{className:"gallery-video-background",children:(0,n.jsx)("iframe",{src:O(e.data.external_link_url),title:e.data.external_link_name||"Video",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,style:{width:"100%",height:"100%",border:"none"}})})},t))}),o.length>0&&(0,n.jsx)("div",{className:"arrow right",onClick:()=>d("right"),children:(0,n.jsx)("i",{className:"fa-light fa-arrow-right","aria-hidden":"true"})}),(0,n.jsx)("div",{className:"image-navigation",children:(0,n.jsx)("ul",{children:o.map((e,t)=>(0,n.jsx)("li",{children:(0,n.jsx)("div",{className:"circle ".concat(t===r?"active":""),onClick:()=>(e=>{var t;if(!s.current)return;let l=(null==(t=s.current.firstChild)?void 0:t.offsetWidth)||0;s.current.scrollTo({left:l*e,behavior:"smooth"}),i(e)})(t)})},t))})})]})}function K(e){let{lang:t,address:l}=e,[s,r]=(0,a.useState)(!1),i=encodeURIComponent(l),c="https://www.google.com/maps/embed/v1/place?key=".concat("AIzaSyC8oFBwxjfUw5Ok0zFwJ9_5INNKLCP2y_Y","&q=").concat(i,"&zoom=9");return(0,n.jsx)("div",{className:"mapBtn",style:{backgroundImage:"url('/img/placeholder-map.jpg')",position:"relative",width:"716px",maxWidth:"100%",marginBottom:"80px",height:"396px"},children:s?(0,n.jsx)("iframe",{src:c,width:"100%",height:"100%",style:{border:0},allowFullScreen:"",loading:"lazy",referrerPolicy:"no-referrer-when-downgrade"}):(0,n.jsx)("button",{className:"mapBtn",onClick:()=>r(!0),style:{width:"240px",maxWidth:"100%",height:"50px",top:"50%",left:"50%",position:"absolute",transform:"translate(-50%, -50%)",background:"#003633",border:"1px solid #003633",color:"#fff",borderRadius:"4px",fontWeight:"600",display:"flex",justifyContent:"center",alignItems:"center",fontSize:"18px",cursor:"pointer"},children:"no"===t?"Klikk her for \xe5 vise kart":"Click here to show map"})})}l(7065);let G=function(e){var t,l,s,r,i,c,o,d,u,h,g,m,p,j,_,w,y,k,C,b,N,S,L,H,M,V,E,D,B,A,I,T,Z,F,P,R,q,O,G,U,$,Y,X,J,Q,ee,et;let{lang:el,pageData:en}=e,{setPageData:ea}=(0,x.B)(),[es,er]=(0,a.useState)([]),[ei,ec]=(0,a.useState)(!1),[eo,ed]=(0,a.useState)(""),[eu,eh]=(0,a.useState)(""),[eg,em]=(0,a.useState)(!1),[ev,ep]=(0,a.useState)([]),[ef,ex]=(0,a.useState)(!1),[ej,e_]=(0,a.useState)([]),[ew,ey]=(0,a.useState)([]);(0,a.useEffect)(()=>{var e,t;ea(en),(null==en||null==(e=en.acf)?void 0:e.facilities)&&ep(en.acf.facilities),(null==en||null==(t=en.acf)?void 0:t.t
1ickets)&&e_(en.acf.tickets)},[en,ea]);let ek=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"no";return"no"===t&&({Monday:"Mandag",Tuesday:"Tirsdag",Wednesday:"Onsdag",Thursday:"Torsdag",Friday:"Fredag",Saturday:"L\xf8rdag",Sunday:"S\xf8ndag"})[e]||e},eC=e=>e&&""!==e?e.includes("T")?e.split("T")[1].slice(0,5):e:null,eb=e=>e?e.includes("-")?e:/^\d{8}$/.test(e)?"".concat(e.slice(0,4),"-").concat(e.slice(4,6),"-").concat(e.slice(6,8)):e:null;(0,a.useEffect)(()=>{var e;if((null==en||null==(e=en.acf)?void 0:e.opening_times)&&Array.isArray(en.acf.opening_times)){let e=new Date;e.setHours(0,0,0,0);let t=en.acf.opening_times.filter(t=>{let l=new Date(eb(t.end_date));return l.setHours(23,59,59,999),l>=e}).map(e=>{let t=eb(e.start_date),l=eb(e.end_date),n=t!==l?"".concat(eN(t,null==en?void 0:en.lang)," - ").concat(eN(l,null==en?void 0:en.lang)):eN(t,null==en?void 0:en.lang),a=[],s=null;return e.days.forEach(t=>{t.is_open&&t.opening_times&&t.opening_times.length>0&&t.opening_times.forEach(l=>{let n=eC(null==l?void 0:l.opening_time),r=eC(null==l?void 0:l.closing_time);if(!n)return;let i=r?"".concat(n," - ").concat(r):"".concat(n),c=ek(t.day_name,null==en?void 0:en.lang);""!==l.booking_url&&em(!0),s&&s.time===i?s.days.push(c):(s={days:[c],time:i,booking_url:l.booking_url,sold_out:l.sold_out,additional_info:e.additional_info},a.push(s))})}),{date:n,times:a.map(e=>{var t,l;return{timeString:"".concat(e.days.join(", ")," ").concat(e.time),booking_url:null!=(t=e.booking_url)?t:"",sold_out:null!=(l=e.sold_out)&&l,additional_info:e.additional_info}}),additional_info:e.additional_info,sortKey:t,rawEndDate:l}}).sort((e,t)=>new Date(e.sortKey)-new Date(t.sortKey)).filter(t=>{let l=new Date(t.rawEndDate);return l.setHours(23,59,59,999),l>=e});if(er(t),t.length>0){let e=t.map(e=>e.sortKey).sort((e,t)=>new Date(e)-new Date(t)),l=t.map(e=>e.rawEndDate).sort((e,t)=>new Date(e)-new Date(t));ed(e[0]),eh(l[l.length-1])}console.log("Filtered Dates:",t)}},[null==en||null==(t=en.acf)?void 0:t.opening_times,null==en?void 0:en.lang]),(0,a.useEffect)(()=>{(async()=>{var e;if(!(null==en||null==(e=en.acf)?void 0:e.related_products))return;let t=en.acf.related_products.map(e=>e.key).map(async e=>{let t=await fetch("https://wordpress.visitvestfold.com/wp-json/custom/v1/product-id?key=".concat(e,"&lang=").concat(en.lang));return t.ok?await t.json():null}),l=(await Promise.all(t)).filter(Boolean);ey(l),console.log(l)})()},[en]);let eN=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"no";if(!e)return"Ukjent dato";let l=new Date(e);return isNaN(l.getTime())?(console.error("Invalid date:",e),"Ugyldig dato"):l.toLocaleDateString("no"===t?"nb-NO":"en-GB",{day:"2-digit",month:"short",year:"numeric"})},eS={activities:{link:"/no/se-og-gjore/aktiviteter",title:"Aktiviteter"},events:{link:"/no/hva-skjer",title:"Hva skjer?"},catering:{link:"/no/servering-og-uteliv",title:"Mat & drikke"},transport:{link:"/no/kom-deg-rundt",title:"Kom deg rundt"},attractions:{link:"/no/se-og-gjore/attraksjoner",title:"Attraksjoner"},accomodations:{link:"/no/overnatting/",title:"Overnatting"}},eL={activities:{link:"/en/see-and-do/activities",title:"Activities"},events:{link:"/en/whats-on",title:"What's on"},catering:{link:"/en/food-and-drink",title:"Food & drink"},transport:{link:"/en/get-around",title:"Get Around"},attractions:{link:"/en/see-and-do/attractions",title:"Attractions"},accomodations:{link:"/en/accommodations/",title:"Accommodations"}},eH=null!=(ee=null==en||null==(s=en.acf)||null==(l=s.media_gallery)?void 0:l.filter(e=>62===e.media_type))?ee:[],eM=null!=(et=null==en||null==(i=en.acf)||null==(r=i.media_gallery)?void 0:r.filter(e=>62!==e.media_type))?et:[];return(0,n.jsxs)("div",{className:"single-location",children:[(0,n.jsxs)("div",{className:"location-hero",children:[(null==en?void 0:en.lang)==="no"?eS[null==en?void 0:en.type]?(0,n.jsx)("div",{className:"bread",children:(0,n.jsx)(f(),{className:"small",href:null==(c=eS[null==en?void 0:en.type])?void 0:c.link,children:null==(o=eS[null==en?void 0:en.type])?void 0:o.title})}):null:eL[null==en?void 0:en.type]?(0,n.jsx)("div",{className:"bread",children:(0,n.jsx)(f(),{className:"small",href:null==(d=eL[null==en?void 0:en.type])?void 0:d.link,
1children:null==(u=eL[null==en?void 0:en.type])?void 0:u.title})}):null,(0,n.jsxs)("div",{className:"hero-section",children:[(0,n.jsx)("div",{className:"text-content",children:(0,n.jsxs)("div",{className:"inner",children:[(0,n.jsx)("div",{className:"topinfo",children:(0,n.jsxs)("div",{className:"location-pill",children:[(0,n.jsx)("i",{className:"fa-light fa-location-dot","aria-hidden":"true"})," ",(null==en||null==(h=en.acf)?void 0:h.venue_name)?"".concat(en.acf.venue_name," \xb7 "):"",null==en||null==(g=en.acf)?void 0:g.location]})}),(null==en?void 0:en.title)?(0,n.jsx)("h1",{children:(0,v.decode)(null==en||null==(m=en.title)?void 0:m.rendered)}):"",(null==en?void 0:en.excerpt)?(0,n.jsx)("p",{dangerouslySetInnerHTML:{__html:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:125,l=(0,v.decode)(e.replace(/(<([^>]+)>)/gi,""));return l.length>t?"".concat(l.slice(0,t),"..."):l}(null==en||null==(p=en.excerpt)?void 0:p.rendered)}}):"",(null==en||null==(j=en.acf)?void 0:j.booking_website)&&(0,n.jsx)("div",{className:"location-btn-wrap",children:(0,n.jsx)(f(),{target:"_blank",className:"location-btn",href:en.acf.booking_website+(en.acf.booking_website.includes("?")?"&":"?")+"utm_source=VisitVestfold&utm_medium=booking_button",children:(0,n.jsx)("strong",{children:(null==en?void 0:en.lang)==="no"?"Book n\xe5":"Book now"})})}),!(null==en||null==(_=en.acf)?void 0:_.booking_website)&&(null==en||null==(w=en.acf)?void 0:w.extern_website)?(0,n.jsx)("div",{className:"location-btn-wrap",children:(0,n.jsx)(f(),{target:"_blank",className:"location-btn",href:en.acf.extern_website+(en.acf.extern_website.includes("?")?"&":"?")+"utm_source=VisitVestfold&utm_medium=website_button",children:(0,n.jsx)("strong",{children:(null==en?void 0:en.lang)==="no"?"Les mer":"Read more"})})}):""]})}),eH.length>0?eH.length>1?(0,n.jsx)(W,{images:eH,videos:en.acf.external_links}):(0,n.jsx)("div",{className:"image-content",style:{backgroundImage:(null==(y=eH[0])?void 0:y.image_url)?"url(".concat(eH[0].image_url).concat(eH[0].imageresizecrop?"[ProductDetail_New][".concat(eH[0].imageresizecrop,"]"):"",")"):"none"}}):(0,n.jsx)("div",{className:"image-content",style:{backgroundImage:"url('')"}})]})]}),(0,n.jsxs)("div",{className:"wrapper",children:[(0,n.jsxs)("div",{className:"post-location-content",children:[(0,n.jsxs)("div",{className:"content",children:[(null==es?void 0:es.length)===0&&(null==en?void 0:en.type)==="events"?(0,n.jsxs)("div",{className:"alert alert-warning custom-alert",children:[(0,n.jsx)("i",{className:"fa-solid fa-triangle-exclamation"})," ",(null==en?void 0:en.lang)==="no"?"Dette arrangementet har v\xe6rt.":"This event has already happened."]}):"",((null==es?void 0:es.length)>0||(null==ej?void 0:ej.length)>0)&&(0,n.jsxs)("div",{className:"filters",children:[es.length>0&&(0,n.jsxs)("div",{className:"datesFilter",children:[(0,n.jsxs)("div",{className:"datesFilter--header",onClick:()=>{ec(!ei)},children:[(0,n.jsx)("strong",{children:(null==en?void 0:en.type)==="catering"||(null==en?void 0:en.type)==="accomodations"?(null==en?void 0:en.lang)==="no"?"\xc5pningstider":"Opening hours":(null==en?void 0:en.lang)==="no"?eg||(null==en||null==(k=en.acf)?void 0:k.booking_website)?"Tider & billetter":"Tider":eg||(null==en||null==(C=en.acf)?void 0:C.booking_website)?"Hours & Tickets":"Hours"}),ei?(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:(0,n.jsx)("path",{d:"M12 7.9999L18 13.9999L16.6 15.3999L12 10.7999L7.4 15.3999L6 13.9999L12 7.9999Z",fill:"black"})}):(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:(0,n.jsx)("path",{d:"M12 15.4L6 9.4L7.4 8L12 12.6L16.6 8L18 9.4L12 15.4Z",fill:"black"})})]}),ei&&(0,n.jsx)("div",{className:"showDates",children:es.map(e=>{let{date:t,times:l,additional_info:a,booking_url:s}=e;return(0,n.jsxs)("div",{className:"date",children:[(0,n.jsx)("strong",{children:t})," ",l.map((e,t)=>{var l,a;let{timeString:s,booking_url:r,sold_out:i,additional_info:c}=e;return(0,n.jsxs)("div",{className:"hourflex",children:[(0,n.jsxs)("div",{className:"hourcal
1-left",children:[(0,n.jsxs)("div",{className:"hourcal",children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:(0,n.jsx)("path",{d:"M8 14C7.71667 14 7.47917 13.9042 7.2875 13.7125C7.09583 13.5208 7 13.2833 7 13C7 12.7167 7.09583 12.4792 7.2875 12.2875C7.47917 12.0958 7.71667 12 8 12C8.28333 12 8.52083 12.0958 8.7125 12.2875C8.90417 12.4792 9 12.7167 9 13C9 13.2833 8.90417 13.5208 8.7125 13.7125C8.52083 13.9042 8.28333 14 8 14ZM12 14C11.7167 14 11.4792 13.9042 11.2875 13.7125C11.0958 13.5208 11 13.2833 11 13C11 12.7167 11.0958 12.4792 11.2875 12.2875C11.4792 12.0958 11.7167 12 12 12C12.2833 12 12.5208 12.0958 12.7125 12.2875C12.9042 12.4792 13 12.7167 13 13C13 13.2833 12.9042 13.5208 12.7125 13.7125C12.5208 13.9042 12.2833 14 12 14ZM16 14C15.7167 14 15.4792 13.9042 15.2875 13.7125C15.0958 13.5208 15 13.2833 15 13C15 12.7167 15.0958 12.4792 15.2875 12.2875C15.4792 12.0958 15.7167 12 16 12C16.2833 12 16.5208 12.0958 16.7125 12.2875C16.9042 12.4792 17 12.7167 17 13C17 13.2833 16.9042 13.5208 16.7125 13.7125C16.5208 13.9042 16.2833 14 16 14ZM5 22C4.45 22 3.97917 21.8042 3.5875 21.4125C3.19583 21.0208 3 20.55 3 20V6C3 5.45 3.19583 4.97917 3.5875 4.5875C3.97917 4.19583 4.45 4 5 4H6V2H8V4H16V2H18V4H19C19.55 4 20.0208 4.19583 20.4125 4.5875C20.8042 4.97917 21 5.45 21 6V20C21 20.55 20.8042 21.0208 20.4125 21.4125C20.0208 21.8042 19.55 22 19 22H5ZM5 20H19V10H5V20ZM5 8H19V6H5V8Z",fill:"black"})}),s]}),c?(0,n.jsxs)("div",{className:"hourcal",children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"size-6",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"})}),c]}):"",(null==en?void 0:en.type)!=="catering"&&!0!==i&&r&&(0,n.jsxs)("div",{className:"hourcal",children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:(0,n.jsx)("path",{d:"M12 17C12.2833 17 12.5208 16.9042 12.7125 16.7125C12.9042 16.5208 13 16.2833 13 16C13 15.7167 12.9042 15.4792 12.7125 15.2875C12.5208 15.0958 12.2833 15 12 15C11.7167 15 11.4792 15.0958 11.2875 15.2875C11.0958 15.4792 11 15.7167 11 16C11 16.2833 11.0958 16.5208 11.2875 16.7125C11.4792 16.9042 11.7167 17 12 17ZM12 13C12.2833 13 12.5208 12.9042 12.7125 12.7125C12.9042 12.5208 13 12.2833 13 12C13 11.7167 12.9042 11.4792 12.7125 11.2875C12.5208 11.0958 12.2833 11 12 11C11.7167 11 11.4792 11.0958 11.2875 11.2875C11.0958 11.4792 11 11.7167 11 12C11 12.2833 11.0958 12.5208 11.2875 12.7125C11.4792 12.9042 11.7167 13 12 13ZM12 9C12.2833 9 12.5208 8.90417 12.7125 8.7125C12.9042 8.52083 13 8.28333 13 8C13 7.71667 12.9042 7.47917 12.7125 7.2875C12.5208 7.09583 12.2833 7 12 7C11.7167 7 11.4792 7.09583 11.2875 7.2875C11.0958 7.47917 11 7.71667 11 8C11 8.28333 11.0958 8.52083 11.2875 8.7125C11.4792 8.90417 11.7167 9 12 9ZM20 20H4C3.45 20 2.97917 19.8042 2.5875 19.4125C2.19583 19.0208 2 18.55 2 18V14C2.55 14 3.02083 13.8042 3.4125 13.4125C3.80417 13.0208 4 12.55 4 12C4 11.45 3.80417 10.9792 3.4125 10.5875C3.02083 10.1958 2.55 10 2 10V6C2 5.45 2.19583 4.97917 2.5875 4.5875C2.97917 4.19583 3.45 4 4 4H20C20.55 4 21.0208 4.19583 21.4125 4.5875C21.8042 4.97917 22 5.45 22 6V10C21.45 10 20.9792 10.1958 20.5875 10.5875C20.1958 10.9792 20 11.45 20 12C20 12.55 20.1958 13.0208 20.5875 13.4125C20.9792 13.8042 21.45 14 22 14V18C22 18.55 21.8042 19.0208 21.4125 19.4125C21.0208 19.8042 20.55 20 20 20ZM20 18V15.45C19.3833 15.0833 18.8958 14.5958 18.5375 13.9875C18.1792 13.3792 18 12.7167 18 12C18 11.2833 18.1792 10.6208 18.5375 10.0125C18.8958 9.40417 19.3833 8.91667 20 8.55V6H4V8.55C4.61667 8.91667 5.10417 9.40417 5.4625 10.0125C5.82083 10.6208 6 11.2833 6 12C6 12.7167 5.82083 13.3792 5.4625 13.9875C5.10417 14.5958 4.61667 15.0833 4 15.45V18H20Z",fill:"black"})}),!0!==i?"Billetter tilgjengelig":"Utsolgt"]})]}
1),(0,n.jsxs)("div",{className:"hourcal-right",children:[!0!==i&&r&&(0,n.jsx)("div",{className:"hourcal",children:(0,n.jsx)(f(),{className:"book btn",href:r,target:"_blank",rel:"noopener noreferrer",children:(null==en?void 0:en.lang)==="no"?"Billetter":"Tickets"})}),(null==en||null==(l=en.acf)?void 0:l.booking_website)&&!0!==i&&!eg&&(0,n.jsx)("div",{className:"hourcal",children:(0,n.jsx)(f(),{className:"book btn",href:null==en||null==(a=en.acf)?void 0:a.booking_website,target:"_blank",rel:"noopener noreferrer",children:(null==en?void 0:en.lang)==="no"?"Book n\xe5":"Book now"})})]})]},t)})]},t)})})]}),ej.length>0?(0,n.jsxs)("div",{className:"ticketFilter",children:[(0,n.jsxs)("div",{className:"ticket--header",onClick:()=>{ex(!ef)},children:[(0,n.jsx)("strong",{children:(null==en?void 0:en.lang)==="no"?"Priser":"Prices"}),ef?(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:(0,n.jsx)("path",{d:"M12 7.9999L18 13.9999L16.6 15.3999L12 10.7999L7.4 15.3999L6 13.9999L12 7.9999Z",fill:"black"})}):(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:(0,n.jsx)("path",{d:"M12 15.4L6 9.4L7.4 8L12 12.6L16.6 8L18 9.4L12 15.4Z",fill:"black"})})]}),ef?(0,n.jsx)("div",{className:"tickets--content",children:(0,n.jsx)("table",{className:"ticket-table",children:(0,n.jsx)("tbody",{children:ej.map((e,t)=>(0,n.jsxs)("tr",{children:[e.ticket_name?(0,n.jsx)("td",{children:e.ticket_name}):"",(0,n.jsx)("td",{colSpan:e.ticket_name?"1":"2",children:e.unit_type?e.unit_type:""}),(0,n.jsx)("td",{children:e.price_basis?e.price_basis:""}),(0,n.jsxs)("td",{children:[e.ticket_price,",-"]})]},t))})})}):""]}):""]}),(0,n.jsx)("div",{dangerouslySetInnerHTML:{__html:null==en||null==(b=en.content)?void 0:b.rendered}}),ev.length>0&&(0,n.jsxs)(n.Fragment,{children:[ev.filter(e=>!e.notes).length>0&&(0,n.jsx)("ul",{className:"facilities",children:ev.filter(e=>!e.notes).map((e,t)=>(0,n.jsx)("li",{children:e.name},t))}),ev.filter(e=>e.notes).length>0&&(0,n.jsx)("ul",{className:"facilities with-notes",children:ev.filter(e=>e.notes).map((e,t)=>(0,n.jsxs)("li",{children:[e.name,": ",e.notes]},t))})]})]}),(0,n.jsxs)("div",{className:"meta",children:[(0,n.jsxs)("ul",{className:"meta-list",children:[(null==en||null==(N=en.acf)?void 0:N.address)?(0,n.jsxs)("li",{children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:(0,n.jsx)("path",{d:"M12 12C12.55 12 13.0208 11.8042 13.4125 11.4125C13.8042 11.0208 14 10.55 14 10C14 9.45 13.8042 8.97917 13.4125 8.5875C13.0208 8.19583 12.55 8 12 8C11.45 8 10.9792 8.19583 10.5875 8.5875C10.1958 8.97917 10 9.45 10 10C10 10.55 10.1958 11.0208 10.5875 11.4125C10.9792 11.8042 11.45 12 12 12ZM12 19.35C14.0333 17.4833 15.5417 15.7875 16.525 14.2625C17.5083 12.7375 18 11.3833 18 10.2C18 8.38333 17.4208 6.89583 16.2625 5.7375C15.1042 4.57917 13.6833 4 12 4C10.3167 4 8.89583 4.57917 7.7375 5.7375C6.57917 6.89583 6 8.38333 6 10.2C6 11.3833 6.49167 12.7375 7.475 14.2625C8.45833 15.7875 9.96667 17.4833 12 19.35ZM12 22C9.31667 19.7167 7.3125 17.5958 5.9875 15.6375C4.6625 13.6792 4 11.8667 4 10.2C4 7.7 4.80417 5.70833 6.4125 4.225C8.02083 2.74167 9.88333 2 12 2C14.1167 2 15.9792 2.74167 17.5875 4.225C19.1958 5.70833 20 7.7 20 10.2C20 11.8667 19.3375 13.6792 18.0125 15.6375C16.6875 17.5958 14.6833 19.7167 12 22Z",fill:"black"})}),null==en||null==(S=en.acf)?void 0:S.address,(null==en||null==(L=en.acf)?void 0:L.zipcode)?", "+en.acf.zipcode+" "+en.acf.location:""]}):"",eo&&(0,n.jsxs)("li",{children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:(0,n.jsx)("path",{d:"M8 14C7.71667 14 7.47917 13.9042 7.2875 13.7125C7.09583 13.5208 7 13.2833 7 13C7 12.7167 7.09583 12.4792 7.2875 12.2875C7.47917 12.0958 7.71667 12 8 12C8.28333 12 8.52083 12.0958 8.7125 12.2875C8.90417 12.4792 9 12.7167 9 13C9 13.2833 8.90417 13.5208 8.7125 13.7125C8.52083 13.9042 8.28333 14 8 14ZM12 14C11.7167 14 11.4792 13.9042 11.2875 13.7125C11.0958 13.5208 11 13.2833 11 13C11 12.7167 11.0958 12.4792 11.2875 12.2875C11.4792 12.0958 11.7167 12 12 12C12.2833 12 12.5208 12.0958 12.7125 12.2875C12.9042 12.4792 13 12.7167 13 13C13 13.2833 12.9042 13.5208 12.7125 13.7125C12.5208 13.9042 12.28333 14 12 14ZM16 14C15.7167 14 15.4792 13.9042 15.2875 13.7125C15.0958 13.5208 15 13.2833 15 13C15 12.7167 15.0958 12.4792 15.2875 12.2875C15.4792 12.0958 15.7167 12 16 12C16.2833 12 16.5208 12.0958 16.7125 12.2875C16.9042 12.4792 17 12.7167 17 13C17 13.2833 16.9042 13.5208 16.7125 13.7125C16.5208 13.9042 16.2833 14 16 14ZM5 22C4.45 22 3.97917 21.8042 3.5875 21.4125C3.19583 21.0208 3 20.55 3 20V6C3 5.45 3.19583 4.97917 3.5875 4.5875C3.97917 4.19583 4.45 4 5 4H6V2H8V4H16V2H18V4H19C19.55 4 20.0208 4.19583 20.4125 4.5875C20.8042 4.97917 21 5.45 21 6V20C21 20.55 20.8042 21.0208 20.4125 21.4125C20.0208 21.8042 19.55 22 19 22H5ZM5 20H19V10H5V20ZM5 8H19V6H5V8Z",fill:"black"})})," ",eo&&eu===eo?eN(eo):"".concat(eN(eo)," - ").concat(eN(eu))]}),(null==en||null==(H=en.acf)?void 0:H.ticket_price)&&(0,n.jsxs)("li",{children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:(0,n.jsx)("path",{d:"M12 17C12.2833 17 12.5208 16.9042 12.7125 16.7125C12.9042 16.5208 13 16.2833 13 16C13 15.7167 12.9042 15.4792 12.7125 15.2875C12.5208 15.0958 12.2833 15 12 15C11.7167 15 11.4792 15.0958 11.2875 15.2875C11.0958 15.4792 11 15.7167 11 16C11 16.2833 11.0958 16.5208 11.2875 16.7125C11.4792 16.9042 11.7167 17 12 17ZM12 13C12.2833 13 12.5208 12.9042 12.7125 12.7125C12.9042 12.5208 13 12.2833 13 12C13 11.7167 12.9042 11.4792 12.7125 11.2875C12.5208 11.0958 12.2833 11 12 11C11.7167 11 11.4792 11.0958 11.2875 11.2875C11.0958 11.4792 11 11.7167 11 12C11 12.2833 11.0958 12.5208 11.2875 12.7125C11.4792 12.9042 11.7167 13 12 13ZM12 9C12.2833 9 12.5208 8.90417 12.7125 8.7125C12.9042 8.52083 13 8.28333 13 8C13 7.71667 12.9042 7.47917 12.7125 7.2875C12.5208 7.09583 12.2833 7 12 7C11.7167 7 11.4792 7.09583 11.2875 7.2875C11.0958 7.47917 11 7.71667 11 8C11 8.28333 11.0958 8.52083 11.2875 8.7125C11.4792 8.90417 11.7167 9 12 9ZM20 20H4C3.45 20 2.97917 19.8042 2.5875 19.4125C2.19583 19.0208 2 18.55 2 18V14C2.55 14 3.02083 13.8042 3.4125 13.4125C3.80417 13.0208 4 12.55 4
112C4 11.45 3.80417 10.9792 3.4125 10.5875C3.02083 10.1958 2.55 10 2 10V6C2 5.45 2.19583 4.97917 2.5875 4.5875C2.97917 4.19583 3.45 4 4 4H20C20.55 4 21.0208 4.19583 21.4125 4.5875C21.8042 4.97917 22 5.45 22 6V10C21.45 10 20.9792 10.1958 20.5875 10.5875C20.1958 10.9792 20 11.45 20 12C20 12.55 20.1958 13.0208 20.5875 13.4125C20.9792 13.8042 21.45 14 22 14V18C22 18.55 21.8042 19.0208 21.4125 19.4125C21.0208 19.8042 20.55 20 20 20ZM20 18V15.45C19.3833 15.0833 18.8958 14.5958 18.5375 13.9875C18.1792 13.3792 18 12.7167 18 12C18 11.2833 18.1792 10.6208 18.5375 10.0125C18.8958 9.40417 19.3833 8.91667 20 8.55V6H4V8.55C4.61667 8.91667 5.10417 9.40417 5.4625 10.0125C5.82083 10.6208 6 11.2833 6 12C6 12.7167 5.82083 13.3792 5.4625 13.9875C5.10417 14.5958 4.61667 15.0833 4 15.45V18H20Z",fill:"black"})}),"Pris:"]}),(null==en||null==(M=en.acf)?void 0:M.telephone)?(0,n.jsxs)("li",{children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:(0,n.jsx)("path",{d:"M7 23C6.45 23 5.97917 22.8042 5.5875 22.4125C5.19583 22.0208 5 21.55 5 21V3C5 2.45 5.19583 1.97917 5.5875 1.5875C5.97917 1.19583 6.45 1 7 1H17C17.55 1 18.0208 1.19583 18.4125 1.5875C18.8042 1.97917 19 2.45 19 3V21C19 21.55 18.8042 22.0208 18.4125 22.4125C18.0208 22.8042 17.55 23 17 23H7ZM7 18V21H17V18H7ZM12 20.5C12.2833 20.5 12.5208 20.4042 12.7125 20.2125C12.9042 20.0208 13 19.7833 13 19.5C13 19.2167 12.9042 18.9792 12.7125 18.7875C12.5208 18.5958 12.2833 18.5 12 18.5C11.7167 18.5 11.4792 18.5958 11.2875 18.7875C11.0958 18.9792 11 19.2167 11 19.5C11 19.7833 11.0958 20.0208 11.2875 20.2125C11.4792 20.4042 11.7167 20.5 12 20.5ZM7 16H17V6H7V16ZM7 4H17V3H7V4Z",fill:"black"})}),(0,n.jsxs)(f(),{href:"tel:".concat(null==en||null==(V=en.acf)?void 0:V.telephone),children:[" ",null==en||null==(E=en.acf)?void 0:E.telephone]})]}):"",(null==en||null==(D=en.acf)?void 0:D.email)?(0,n.jsxs)("li",{children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:(0,n.jsx)("path",{d:"M4 20C3.45 20 2.97917 19.8042 2.5875 19.4125C2.19583 19.0208 2 18.55 2 18V6C2 5.45 2.19583 4.97917 2.5875 4.5875C2.97917 4.19583 3.45 4 4 4H20C20.55 4 21.0208 4.19583 21.4125 4.5875C21.8042 4.97917 22 5.45 22 6V18C22 18.55 21.8042 19.0208 21.4125 19.4125C21.0208 19.8042 20.55 20 20 20H4ZM12 13L4 8V18H20V8L12 13ZM12 11L20 6H4L12 11ZM4 8V6V18V8Z",fill:"black"})}),(0,n.jsxs)(f(),{href:"mailto:"+(null==en||null==(B=en.acf)?void 0:B.email),children:[" ",(null==en?void 0:en.lang)==="no"?"Send e-post":"Send email"]})]}):"",(null==en||null==(A=en.acf)?void 0:A.extern_website)?(0,n.jsxs)("li",{children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:(0,n.jsx)("path",{d:"M5 21C4.45 21 3.97917 20.8042 3.5875 20.4125C3.19583 20.0208 3 19.55 3 19V5C3 4.45 3.19583 3.97917 3.5875 3.5875C3.97917 3.19583 4.45 3 5 3H12V5H5V19H19V12H21V19C21 19.55 20.8042 20.0208 20.4125 20.4125C20.0208 20.8042 19.55 21 19 21H5ZM9.7 15.7L8.3 14.3L17.6 5H14V3H21V10H19V6.4L9.7 15.7Z",fill:"black"})}),(0,n.jsxs)(f(),{target:"_blank",href:null==en||null==(I=en.acf)?void 0:I.extern_website,children:[" ",(null==en?void 0:en.lang)==="no"?"Nettside":"Website"]})]}):"",(null==en||null==(T=en.acf)?void 0:T.tripadvisor)?(0,n.jsxs)("li",{children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:(0,n.jsx)("path",{d:"M5 21C4.45 21 3.97917 20.8042 3.5875 20.4125C3.19583 20.0208 3 19.55 3 19V5C3 4.45 3.19583 3.97917 3.5875 3.5875C3.97917 3.19583 4.45 3 5 3H12V5H5V19H19V12H21V19C21 19.55 20.8042 20.0208 20.4125 20.4125C20.0208 20.8042 19.55 21 19 21H5ZM9.7 15.7L8.3 14.3L17.6 5H14V3H21V10H19V6.4L9.7 15.7Z",fill:"black"})}),(0,n.jsx)(f(),{target:"_blank",href:null==en||null==(Z=en.acf)?void 0:Z.tripadvisor,children:" TripAdvisor"})]}):"",(null==en||null==(F=en.acf)?void 0:F.instagram)?(0,n.jsxs)("li",{children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:(0,n.jsx)("path",{d:"M8.27263 3.06294C7.31502 3.10812 6.66107 3.26094 6.08939 3.48559C5.49772 3.71617 4.99623 4.02559 4.49727 4.52635C3.9983 5.02711 3.69104 5.52895 3.46208 6.12151C3.2405 6.69446 3.09038 7.34894 3.04808 8.30708C3.00577 9.26523 2.99641 9.57321 3.00109 12.0173C3.00577 14.4613 3.01657 14.7677 3.06302 15.7278C3.10874 16.6852 3.26102 17.339 3.48566 17.9108C3.7166 18.5025 4.02566 19.0038 4.52661 19.5029C5.02755 20.0021 5.52904 20.3086 6.12305 20.5379C6.69545 20.7592 7.35012 20.91 8.30809 20.9519C9.26606 20.9939 9.5744 21.0036 12.0177 20.9989C14.4611 20.9942 14.7687 20.9834 15.7287 20.9379C16.6886 20.8924 17.339 20.739 17.911 20.5154C18.5027 20.284 19.0043 19.9754 19.5031 19.4743C20.0019 18.9732 20.309 18.471 20.5378 17.8781C20.7595 17.3057 20.9102 16.651 20.9518 15.6938C20.9937 14.7331 21.0036 14.4264 20.9989 11.9827C20.9943 9.53901 20.9833 9.23265 20.9377 8.27288C20.8922 7.31312 20.7397 6.66134 20.5153 6.08911C20.284 5.49745 19.9753 4.99651 19.4745 4.49701C18.9737 3.99751 18.4712 3.69061 17.8784 3.46237C17.3057 3.24078 16.6514 3.08976 15.6934 3.04836C14.7354 3.00696 14.4271 2.99634 11.9828 3.00102C9.53858 3.0057 9.23258 3.01614 8.27263 3.06294ZM8.37775 19.3328C7.50024 19.2947 7.02378 19.1489 6.70625 19.0268C6.28577 18.8648 5.98624 18.669 5.6698 18.3556C5.35336 18.0422 5.15896 17.74
116 4.99479 17.3221C4.87149 17.0045 4.72299 16.5286 4.68195 15.6511C4.63731 14.7027 4.62795 14.4179 4.62273 12.0151C4.61751 9.61227 4.62669 9.32787 4.66827 8.37908C4.70571 7.5023 4.85241 7.0253 4.97427 6.70796C5.13628 6.28694 5.3314 5.98795 5.6455 5.67169C5.9596 5.35543 6.25931 5.16067 6.67925 4.99651C6.99641 4.87267 7.47234 4.72543 8.34949 4.68367C9.29864 4.63867 9.58304 4.62967 11.9855 4.62445C14.388 4.61923 14.6731 4.62823 15.6226 4.66999C16.4994 4.70815 16.9766 4.85341 17.2936 4.97599C17.7143 5.13799 18.0136 5.33257 18.3299 5.64721C18.6461 5.96185 18.8411 6.26048 19.0052 6.68132C19.1293 6.99758 19.2765 7.47332 19.3179 8.351C19.3631 9.30015 19.3733 9.58473 19.3777 11.987C19.382 14.3893 19.3735 14.6746 19.3319 15.623C19.2936 16.5005 19.1482 16.9772 19.0259 17.2951C18.8639 17.7154 18.6686 18.0151 18.3543 18.3311C18.0401 18.6472 17.7407 18.842 17.3206 19.0061C17.0038 19.1298 16.5273 19.2774 15.6509 19.3192C14.7018 19.3638 14.4173 19.3732 12.014 19.3784C9.61058 19.3836 9.32708 19.3739 8.37793 19.3328M15.7148 7.18982C15.7152 7.40344
115.7789 7.61215 15.8978 7.78957C16.0168 7.96698 16.1858 8.10513 16.3833 8.18653C16.5808 8.26793 16.798 8.28894 17.0074 8.24689C17.2169 8.20484 17.4091 8.10162 17.5599 7.95029C17.7107 7.79896 17.8132 7.60632 17.8545 7.39673C17.8957 7.18714 17.8739 6.97001 17.7918 6.77281C17.7097 6.5756 17.5709 6.40719 17.3931 6.28885C17.2152 6.17052 17.0063 6.10759 16.7927 6.10801C16.5063 6.10859 16.2319 6.22287 16.0297 6.42574C15.8276 6.62861 15.7143 6.90345 15.7148 7.18982ZM7.37892 12.009C7.38396 14.5614 9.45686 16.6258 12.0087 16.621C14.5606 16.6161 16.6265 14.5434 16.6217 11.991C16.6168 9.43857 14.5434 7.3736 11.9911 7.37864C9.43886 7.38368 7.37406 9.45693 7.37892 12.009ZM9.00002 12.0057C8.99884 11.4124 9.17365 10.832 9.50232 10.338C9.831 9.84398 10.2988 9.45853 10.8465 9.23037C11.3943 9.00222 11.9974 8.94162 12.5796 9.05622C13.1617 9.17083 13.6969 9.4555 14.1173 9.87423C14.5377 10.293 14.8245 10.827 14.9414 11.4087C15.0583 11.9904 15.0001 12.5937 14.7741 13.1424C14.5481 13.691 14.1645 14.1603 13.6718 14.491C13.1791 14.8216 12.5994 14.9987 12.006 14.9999C11.6121 15.0007 11.2218 14.9239 10.8575 14.7739C10.4931 14.6238 10.162 14.4035 9.88281 14.1255C9.60367 13.8474 9.38203 13.5171 9.23056 13.1534C9.07909 12.7897 9.00075 12.3997 9.00002 12.0057Z",fill:"black"})}),(0,n.jsx)(f(),{target:"_blank",href:null==en||null==(P=en.acf)?void 0:P.instagram,children:" Instagram"})]}):"",(null==en||null==(R=en.acf)?void 0:R.facebook)?(0,n.jsxs)("li",{children:[(0,n.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:[(0,n.jsx)("path",{d:"M21 12.055C21 7.05406 16.9706 3 12 3C7.02943 3 3 7.05406 3 12.055C3 16.5745 6.29115 20.3207 10.5938 21V14.6725H8.30859V12.055H10.5938V10.0601C10.5938 7.79066 11.9374 6.53711 13.9932 6.53711C14.9779 6.53711 16.0078 6.71397 16.0078 6.71397V8.94235H14.873C13.755 8.94235 13.4062 9.64039 13.4062 10.3565V12.055H15.9023L15.5033 14.6725H13.4062V21C17.7088 20.3207 21 16.5747 21 12.055Z",fill:"black"}),(0,n.jsx)("path",{d:"M15.4758 14.8155L15.8904 12.301H13.2968V10.6692C13.2968 9.98129 13.6592 9.31068 14.8208 9.31068H16V7.1699C16 7.1699 14.9299 7 13.9067 7C11.7706 7 10.3744 8.20427 10.3744 10.3845V12.301H8V14.8155H10.3744V20.8943C10.8506 20.9638 11.3384 21 11.8356 21C12.3328 21 12.8206 20.9638 13.2968 20.8943V14.8155H15.4758Z",fill:"#FFFBEF"})]}),(0,n.jsx)(f(),{target:"_blank",href:null==en||null==(q=en.acf)?void 0:q.facebook,children:" Facebook"})]}):"",(null==en||null==(O=en.acf)?void 0:O.tripadvisor)?(0,n.jsx)("div",{className:"trip-rating",children:(0,n.jsx)("iframe",{className:"tripframe",src:"https://www.tripadvisor.com/WidgetEmbed-cdsLicensedRating?display=true&partnerId=564F0E59F14942E3BBE414D78E5D55CF&lang=no&locationId=".concat((e=>{let t=e.match(/-d(\d+)-Reviews/);return t?t[1]:null})(en.acf.tripadvisor)),width:"100%",height:"57px",frameBorder:"0"})}):"",(null==en||null==(U=en.acf)||null==(G=U.awards)?void 0:G.length)>0&&(0,n.jsxs)("div",{className:"eco-awards",children:["no"===en.lang?(0,n.jsx)("div",{children:(0,n.jsx)("h3",{children:"Milj\xf8sertifisering"})}):(0,n.jsx)("div",{children:(0,n.jsx)("h3",{children:"Environmental certification"})}),(0,n.jsx)("ul",{children:en.acf.awards.map(e=>(0,n.jsx)("li",{children:(0,n.jsx)("span",{className:"eco-badge",children:e.name})},e.key))})]})]}),eM.length>0&&(0,n.jsxs)("div",{className:"meta-files",children:[(0,n.jsx)("h3",{children:(null==en?void 0:en.lang)==="no"?"Filer":"Files"}),(0,n.jsx)("ul",{children:eM.map((e,t)=>(0,n.jsx)("li",{children:(0,n.jsxs)("a",{href:e.image_url,target:"_blank",rel:"noopener noreferrer",children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:(0,n.jsx)("path",{d:"M14 2H6C5.45 2 4.97917 2.19583 4.5875 2.5875C4.19583 2.97917 4 3.45 4 4V20C4 20.55 4.19583 21.0208 4.5875 21.4125C4.97917 21.8042 5.45 22 6 22H18C18.55 22 19.0208 21.8042 19.4125 21.4125C19.8042 21.0208 20 20.55 20 20V8L14 2ZM18 20H6V4H13V9H18V20Z",fill:"currentColor"})}),(e=>{var t,l;if(e.alt_text)return e.alt_text;let n=e.image_url.split("/").pop();return n.replace(/\.[^.]+$/,"").replace(/_\d+$/,"").replace(/_/g," ")+(null!=(l=null==(t=n.match(/\.[^.]+$/))?void 0:t[0])?l:"")})(e)]})},t))})]})]})]}),(null==en||null==($=en.acf)?void 0:$.address)?(0,n.jsx)(K,{lang:null==en?void 0:en.lang,address:en.acf.address+", "+en.acf.zipcode+" "+en.acf.location}):"",(0,n.jsx)("div",{className:"related-posts",style:{height:"0px",padding:"0px"},children:" "}),(null==en||null==(Y=en.acf)?void 0:Y.widgets)?(0,n.jsx)("div",{dangerouslySetInnerHTML:{__html:null==en||null==(X=en.acf)?void 0:X.widgets}}):"",(null==en||null==(J=en.acf)?void 0:J.booking_website)?(0,n.jsxs)("div",{className:"fixed-booking",children:[(0,n.jsx)("p",{children:(0,v.decode)(null==en||null==(Q=en.title)?void 0:Q.rendered)}),(0,n.jsx)(f(),{target:"_blank",className:"location-btn",href:en.acf.booking_website
1+(en.acf.booking_website.includes("?")?"&":"?")+"utm_source=VisitVestfold&utm_medium=booking_button",children:(0,n.jsx)("strong",{children:(null==en?void 0:en.lang)==="no"?"Book n\xe5":"Book now"})})]}):""]}),ew.length>0?(0,n.jsx)(z,{lang:null==en?void 0:en.lang,title:(null==en?void 0:en.lang)==="no"?"Se ogs\xe5":"You may also like",cards:ew}):""]})};var U=l(7102);let $="https://wordpress.visitvestfold.com/wp-json/wp/v2",Y={post:"posts",page:"pages"},X=["pages","posts","accomodations","attractions","activities","simple_gast","events","special_post"],J=async e=>{let t=await fetch(e);return t.ok?t.json():[]};async function Q(e,t){let{fields:l,embed:n}=t,a=[...new Set(e)];if(0===a.length)return[];let s=n?"_embed":"_fields=".concat(encodeURIComponent(l)),r=new Set(a),i=[],c=e=>{if(null==e?void 0:e.length)for(let t of e)i.push(t),r.delete(t.id)};for(let e of((e,t)=>{let l=[];for(let n=0;n<e.length;n+=t)l.push(e.slice(n,n+t));return l})(a,50)){let t=e.join(","),l=await J("".concat($,"/search?include=").concat(t,"&per_page=100&type=post&subtype=any&_fields=id,subtype")),n=new Map;for(let e of l){if(!(null==e?void 0:e.subtype))continue;let t=Y[e.subtype]||e.subtype;n.has(t)||n.set(t,[]),n.get(t).push(e.id)}(await Promise.all([...n].map(e=>{let[t,l]=e;return J("".concat($,"/").concat(t,"?include=").concat(l.join(","),"&per_page=").concat(50,"&").concat(s))}))).forEach(c)}if(r.size>0){let e=[...r].join(","),t=0,l=async()=>{for(;t<X.length&&r.size>0;){let l=X[t++];c(await J("".concat($,"/").concat(l,"?include=").concat(e,"&per_page=").concat(50,"&").concat(s)))}};await Promise.all(Array.from({length:4},l))}r.size>0&&console.warn("fetchRelatedByIds: unresolved IDs (likely deleted posts still referenced in ACF): ".concat([...r].join(", ")));let o=new Map(i.map(e=>[e.id,e]));return e.map(e=>o.get(e)).filter(Boolean)}let ee=new Map;function et(e){let{fields:t,embed:l=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=(e||[]).filter(Boolean);if(0===n.length)return Promise.resolve([]);let a="".concat(l?"_embed":t,"|").concat(n.join(",")),s=e=>e.then(e=>e.slice()),r=ee.get(a);if(r)return ee.delete(a),ee.set(a,r),s(r);let i=Q(n,{fields:t,embed:l}).catch(e=>{throw ee.delete(a),e});return ee.set(a,i),ee.size>50&&ee.delete(ee.keys().next().value),s(i)}let el=function(e){var t,l,s,r,o,d,u,h,g,m,p;let{pageData:j,initialProducts:_}=e,[w,y]=(0,a.useState)(""),{setPageData:k}=(0,x.B)();(0,a.useEffect)(()=>{k(j)},[]);let[C,b]=(0,a.useState)(null!=_?_:[]),[N,L]=(0,a.useState)([]),[H,M]=(0,a.useState)(1),[V,E]=(0,a.useState)(!_),[B,I]=(0,a.useState)(!1),[T,Z]=(0,a.useState)(0),[F,P]=(0,a.useState)(!1),[R,q]=(0,a.useState)(!1),[z,O]=(0,a.useState)(!1),[W,K]=(0,a.useState)([]),[G,$]=(0,a.useState)([]),[Y,X]=(0,a.useState)([]),[J,Q]=(0,a.useState)(null),[ee,el]=(0,a.useState)(""),[en,ea]=(0,a.useState)(null!=_?_:[]),[es,er]=(0,a.useState)(!1),[ei,ec]=(0,a.useState)(!1),[eo,ed]=(0,a.useState)("normal"),eu=e=>{ed(e)},[eh,eg]=(0,a.useState)({event:!1,activity:!1,attraction:!1,catering:!1});(0,a.useEffect)(()=>{var e,t;if(!(null==j||null==(e=j.acf)?void 0:e.product_search)||!(null==j||null==(t=j.acf)?void 0:t.product_search_category)||_&&0===Y.length&&0===G.length&&!ee)return;let l=setTimeout(()=>eb(),250);return()=>clearTimeout(l)},[null==j||null==(t=j.acf)?void 0:t.product_search_category,Y,G,ee]);let[em,ev]=(0,a.useState)({activity:[],attraction:[],event:[],catering:[]}),[ep,ef]=(0,a.useState)({activity:[],attraction:[],event:[],catering:[]});(0,a.useEffect)(()=>{if(0===em.activity.length&&0===em.attraction.length&&0===em.event.length&&0===em.catering.length)return void ea(C);ea(C.filter(e=>{var t,l,n,a;let s=em.activity.length>0&&(null==(t=e.activity_categories)?void 0:t.some(e=>em.activity.includes(e))),r=em.attraction.length>0&&(null==(l=e.attraction_categories)?void 0:l.some(e=>em.attraction.includes(e))),i=em.event.length>0&&(null==(n=e.event_categories)?void 0:n.some(e=>em.event.includes(e))),c=em.catering.length>0&&(null==(a=e.catering_categories)?void 0:a.some(e=>em.catering.includes(e)));return s||r||i||c}))},[em,C]),(0,a.useEffect)(()=>{(async()=>{try{let e=await fetch("".concat("https://wordpress.visitvestfold.com","/wp-json/wp/v2/city_category?per_page=100&lang=").concat(j.lang));if(!e.ok)throw Error("Failed to fetch cities");let t=await e.json(),l=t.filter(e=>21241!==e.id);K(l);let n=t.filter(e=>{var t,l;return null==j||null==(l=j.acf)||null==(t=l.cities)?void 0:t.includes(String(e.id))});console.log("PRESELECT: ",n),n.length>0&&$(n)}catch(e){console.error("Error fetching cities:",e)}finally{}})()},[]),(0,a.useEffect)(()=>{q(!0)},[]);let ex=null==j||null==(s=j._embedded)||null==(l=s["wp:featuredmedia"])?void 0:l[0];(0,a.useEffect)(()=>{var e,t,l,n;(null==j||null==(e=j.acf)?void 0:e.product_search)||(null==j||null==(t=j.acf)?void 0:t.channel_search)||!((null==j||null==(n=j.acf)||null==(l=n.content_cards)?void 0:l.length)>0)||ej(j.acf.content_cards)},[]),(0,a.useEffect)(()=>{var e;if(null==j||null==(e=j.acf)?void 0:e.kategori)if((null==j?void 0:j.lang)==="no")switch(j.acf.kategori){case"Se og gj\xf8re":y("/no/se-og-gjore/");break;case"Overnatting":y("/no/overnatting/");break;case"Mat og drikke":y("/no/servering-og-uteliv/");break;case"Hva skjer?":y("/no/hva-skjer/");break;case"Kurs & konferanse":y("/no/grupper-og-moter/");break;case"Kom deg rundt":case"Planlegg turen":y("/no/kom-deg-rundt");break;case"B\xe6rekraft":y("/no/baerekraft/");break;case"Bransje":y("/no/bransje/");break;default:y("/no/")}else switch(j.acf.kategori){case"Se og gj\xf8re":y("/en/see-and-do/");break;case"Overnatting":y("/en/accommodation");break;case"Mat og drikke":y("/en/food-and-drink/");break;case"Hva skjer?":y("/en/whats-on/");break;case"Kurs & konferanse":y("/en/groups/");break;
1case"Kom deg rundt":case"Planlegg turen":y("/en/get-around/");break;case"B\xe6rekraft":y("/en/sustainability/");break;case"Bransje":y("/en/industry/");break;default:y("/en/")}},[]);let ej=async e=>{E(!0);try{L(await et(e,{fields:"id,type,link,title,slug,acf,excerpt,activity_categories,event_categories,attraction_categories,catering_categories,_embedded.wp:featuredmedia,featured_media,yoast_head_json"}))}catch(e){console.error("Error fetching related items:",e)}finally{E(!1)}},e_={events:"event_category",attractions:"attraction_category",activities:"activity_category",transport:"transport_category",accomodations:"accomodation_category",catering:"catering_category",simple_location:"simple_location_category",simple_busi:"simple_busi_category",simple_serv:"simple_serv_category",simple_orga:"simple_orga_category",simple_broc:"simple_broc_category",simple_tour:"simple_tour_category",simple_hire:"simple_hire_category",simple_ptcn:"simple_ptcn_category",simple_proj:"simple_proj_category",simple_gast:"simple_gast_category",simple_gcat:"simple_gcat_category",simple_film:"simple_film_category",simple_reta:"simple_reta_category"},ew={category_multi_activities:"activity_category",category_multi_accomodations:"accomodation_category",category_multi_attractions:"attraction_category",category_multi_catering:"catering_category",category_multi_transport:"transport_category",category_multi_simple_location:"simple_location_category",category_multi_simple_busi:"simple_busi_category",category_multi_simple_serv:"simple_serv_category",category_multi_simple_orga:"simple_orga_category",category_multi_simple_broc:"simple_broc_category",category_multi_simple_tour:"simple_tour_category",category_multi_simple_hire:"simple_hire_category",category_multi_simple_ptcn:"simple_ptcn_category",category_multi_simple_proj:"simple_proj_category",category_multi_simple_gast:"simple_gast_category",category_multi_simple_gcat:"simple_gcat_category",category_multi_simple_film:"simple_film_category",category_multi_simple_reta:"simple_reta_category"},ey=e=>{var t;let l=null==e||null==(t=e.acf)?void 0:t.channels;if(!Array.isArray(l)||0===l.length)return null;let n=l.filter(e=>"750"===e.channel_id||"VisitVestfold.com"===e.channel_name).map(e=>parseInt(e.listing_level)).filter(e=>!isNaN(e));return 0===n.length?null:Math.min(...n)},ek=(e,t)=>{var l,n;let a="events"===e.type,s="events"===t.type,r=!!(null==(l=e.acf)?void 0:l.booking_website),i=!!(null==(n=t.acf)?void 0:n.booking_website),c=(e,t)=>!e&&t?0:e&&t?1:e?3:2,o=c(a,r),d=c(s,i);if(o!==d)return o-d;let u=ey(e),h=ey(t),g=e=>null===e?3.5:0===e||4===e?99:e;return g(u)-g(h)},eC=a.useRef(null),eb=async()=>{var e,t,l,n,a,s,r,i,c;if(!(null==j||null==(e=j.acf)?void 0:e.product_search))return;null==(t=eC.current)||t.abort();let o=new AbortController;eC.current=o,E(!0);try{let e=null==j||null==(l=j.acf)?void 0:l.product_search_category,t=null==j||null==(n=j.acf)?void 0:n.product_search_multi,d=null==j||null==(a=j.acf)?void 0:a.product_search_category_multiple,u=Array.isArray(d)?[...new Set(d.filter(e=>"string"==typeof e&&e.length>0))]:[];console.log(d);let h=(null==j?void 0:j.lang)||"no",g=ee?"&search=".concat(encodeURIComponent(ee)):"",m="";G.length>0?m="&city_category=".concat(G.map(e=>e.id).join(",")):(null==j||null==(r=j.acf)||null==(s=r.cities)?void 0:s.length)>0&&(m="&city_category=".concat(j.acf.cities.join(",")));let v="id,link,title,slug,acf,excerpt,activity_categories,event_categories,attraction_categories,catering_categories,_embedded.wp:featuredmedia";if(u.length>0&&t){let e=u.map(async e=>{var t;let l="category_multi_".concat(e);console.log(l);let n=ew[l];console.log(n);let a=(null==j||null==(t=j.acf)?void 0:t[l])||[];if(!n||0===a.length)return[];let s="&".concat(n,"=").concat(a.join(",")),r="https://wordpress.visitvestfold.com/wp-json/wp/v2/".concat(e,"?lang=").concat(h,"&per_page=").concat(100).concat(s,"&orderby=title&order=asc").concat(g).concat(m,"&_fields=").concat(encodeURIComponent(v));console.log(r);let i=await fetch(r,{signal:o.signal});return i.ok?await i.json():[]}),t=(await Promise.all(e)).flat().sort(ek);Z(t.length),b(t),ea(t),M(1);return}let p=e_[e]||"activity_category",f="";Y.length>0?f="&".concat(p,"=").concat(Y.map(e=>e.id).join(",")):(null==j||null==(c=j.acf)||null==(i=c.category)?void 0:i.length)>0&&(f="&".concat(p,"=").concat(j.acf.category.join(",")));let x="https://wordpress.visitvestfold.com/wp-json/wp/v2/".concat(e,"?lang=").concat(h,"&per_page=").concat(100).concat(f,"&orderby=title&order=asc").concat(g).concat(m,"&_fields=").concat(encodeURIComponent(v)),_=await fetch(x,{signal:o.signal});if(!_.ok)throw Error("Failed to fetch products");let w=await _.json(),y=Number(_.headers.get("X-WP-Total")),k=w.sort(ek);Z(y),b(k),ea(k),M(1)}catch(e){"AbortError"!==e.name&&console.error(e),console.error("Error fetching products:",e)}finally{E(!1)}},eN=async e=>{var t,l;E(!0);let n=Array.isArray(e)?e.join(","):e,a="";G.length>0?a="&city_category=".concat(G.map(e=>e.id).join(",")):(null==j||null==(l=j.acf)||null==(t=l.cities)?void 0:t.length)>0&&(a="&city_category=".concat(j.acf.cities.join(",")));try{let e=await fetch("https://wordpress.visitvestfold.com/wp-json/custom/v1/channel-products/".concat(n,"?city_category=").concat(a)),t=await e.json(),l=Number(e.headers.get("X-WP-Total")),s=t.sort(ek);Z(l),b(s),ea(s),M(1)}catch(e){console.error("Failed to fetch channel products",e)}finally{E(!1)}};(0,a.useEffect)(()=>{var e;(null==j||null==(e=j.acf)?void 0:e.channel_search)&&(eN(j.acf.channel),er(!0))},[G]),(0,a.useEffect)(()=>{let e={activity:new Set,attraction:new Set,event:new Set,catering:new Set};
1C.forEach(t=>{var l,n,a,s;null==(l=t.activity_categories)||l.forEach(t=>e.activity.add(t)),null==(n=t.attraction_categories)||n.forEach(t=>e.attraction.add(t)),null==(a=t.event_categories)||a.forEach(t=>e.event.add(t)),null==(s=t.catering_categories)||s.forEach(t=>e.catering.add(t))}),ef({activity:Array.from(e.activity),attraction:Array.from(e.attraction),event:Array.from(e.event),catering:Array.from(e.catering)})},[C]);let eS={Overnatting:"Accommodation","Se og gj\xf8re":"See and do",Arrangementer:"Events","Mat og drikke":"Food & drink",Attraksjoner:"Attractions","Kurs & konferanse":"Events & Conferences","Kom deg rundt":"Get Around",Bransje:"Industry",Bærekraft:"Sustainability"};return(0,n.jsxs)("div",{className:"single-page",children:[(0,n.jsx)("div",{className:"backgroundgrey",children:(0,n.jsx)("div",{className:"wrapper",children:(null==ex?void 0:ex.source_url)&&(0,n.jsx)(A.default,{className:"post-feature",src:ex.source_url,alt:(null==ex?void 0:ex.alt_text)||"Featured Image",width:"1240",height:"547"})})}),(0,n.jsx)("div",{className:"text-hero grey",children:(0,n.jsxs)("div",{className:"inner-hero",children:[(null==j||null==(r=j.acf)?void 0:r.kategori)!=="Ingen pill"?(0,n.jsx)(f(),{href:w,children:(0,n.jsx)("div",{className:"pill-cat",children:(null==j||null==(o=j.acf)?void 0:o.kategori)==="Planlegg turen"?(null==j?void 0:j.lang)==="en"?"Get Around":"Kom deg rundt":(null==j?void 0:j.lang)==="en"&&eS[null==j||null==(d=j.acf)?void 0:d.kategori]?eS[j.acf.kategori]:null==j||null==(u=j.acf)?void 0:u.kategori})}):"",(0,n.jsx)("h1",{children:(0,v.decode)(null==j||null==(h=j.title)?void 0:h.rendered)}),(0,n.jsx)("div",{className:"custom-excerpt",dangerouslySetInnerHTML:{__html:j.content.rendered}})]})}),(0,n.jsx)("div",{className:"backgroundgrey",children:(0,n.jsx)("div",{className:"wrapper",children:(0,n.jsxs)("div",{className:"page-content",children:[!(null==j||null==(g=j.acf)?void 0:g.product_search)&&(0,n.jsx)(n.Fragment,{children:V?(0,n.jsx)(U.A,{}):(0,n.jsx)(S.A,{lang:null==j?void 0:j.lang,cards:N})}),(null==j||null==(m=j.acf)?void 0:m.product_search)||(null==j||null==(p=j.acf)?void 0:p.channel_search)?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"filter-products",children:(0,n.jsxs)("div",{className:"product-search",children:[(0,n.jsxs)("div",{className:V?"filter-area loading-area":"filter-area",children:[(0,n.jsxs)("div",{className:"filter-header",onClick:()=>{O(!z)},children:[(0,n.jsx)("span",{children:(null==j?void 0:j.lang)==="no"?"Velg by":"Choose city"}),(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:(0,n.jsx)("path",{d:"M11 21V15H13V17H21V19H13V21H11ZM3 19V17H9V19H3ZM7 15V13H3V11H7V9H9V15H7ZM11 13V11H21V13H11ZM15 9V3H17V5H21V7H17V9H15ZM3 7V5H13V7H3Z",fill:"#1C1B1F"})})]}),z?(0,n.jsx)("div",{className:"filter-content",children:(0,n.jsx)("ul",{className:V?"city-list loading-city":"city-list",children:null==W?void 0:W.map(e=>{var t,l,a;return(0,n.jsxs)("li",{"data-id":e.id,className:G.includes(e)||(null==j||null==(t=j.acf)?void 0:t.cities.includes(String(e.id)))?"selected":"not-selected",onClick:()=>{V||$(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},children:[(0,n.jsx)("div",{className:"select-square",children:(null==j||null==(a=j.acf)||null==(l=a.cities)?void 0:l.includes(String(e.id)))?(0,n.jsx)(i.g,{icon:c.DW4}):G.includes(e)?(0,n.jsx)(i.g,{icon:c.e68}):""}),(0,v.decode)(e.name)]},e.id)})})}):""]}),(0,n.jsx)("div",{className:"filter-area",children:"normal"===eo?(0,n.jsxs)("div",{className:"filter-header",onClick:e=>eu("map"),children:[(0,n.jsx)("span",{children:(null==j?void 0:j.lang)==="no"?"Kartvisning":"Map view"}),(0,n.jsx)("i",{className:"fa-solid fa-map","aria-hidden":!0})]}):(0,n.jsxs)("div",{className:"filter-header",onClick:e=>eu("normal"),children:[(0,n.jsx)("span",{children:(null==j?void 0:j.lang)==="no"?"Listevisning":"List view"}),(0,n.jsx)("i",{className:"fa-solid fa-objects-column"})]})}),(0,n.jsxs)("div",{className:"filter-area searchWrapper",children:[F?(0,n.jsx)("input",{type:"text",className:"inlinesrc",placeholder:"S\xf8k her...",autoFocus:
1F,value:ee,onChange:e=>{let t=e.target.value.toLowerCase();J&&clearTimeout(J),Q(setTimeout(()=>{el(t)},500))}}):"",R?(0,n.jsx)("i",{onClick:()=>{P(!F)},className:"fa-solid fa-magnifying-glass"}):""]})]})}),(0,n.jsx)("div",{className:"loading-wrap-main",children:(0,n.jsxs)("div",{className:"filter-cards",style:{marginTop:"25px"},children:[V?(0,n.jsx)(U.A,{}):null,"map"===eo?(0,n.jsx)("div",{className:"map-container",children:(0,n.jsx)(D,{lang:null==j?void 0:j.lang,markers:en.filter(e=>{var t,l,n,a;return(null==e||null==(l=e.acf)||null==(t=l.location_gps)?void 0:t.lat)&&(null==e||null==(a=e.acf)||null==(n=a.location_gps)?void 0:n.lon)}).map(e=>{var t;return{title:(null==(t=e.title)?void 0:t.rendered)||(null==e?void 0:e.title),link:e.link,lat:e.acf.location_gps.lat,lon:e.acf.location_gps.lon}})})}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(S.A,{lang:null==j?void 0:j.lang,cards:en.slice(0,9*H)}),en.length>9*H&&(0,n.jsx)("button",{className:"btn main",onClick:()=>M(e=>e+1),disabled:B,children:(null==j?void 0:j.lang)==="no"?B?"Laster inn...":"Last inn flere":B?"Loading...":"Load more"}),!V&&0===en.length&&(0,n.jsx)("p",{className:"error-search",style:{marginTop:"35px"},children:""!==ee?(0,n.jsxs)(n.Fragment,{children:['Fant ingenting som passer til s\xf8ket: "',ee,'"']}):(null==j?void 0:j.lang)==="no"?"Ingen produkter funnet for valgte filtre eller by.":"No products found for the selected filters or city."})]})]})})]}):null]})})})]})},en=function(e){var t,l,s,r,i,c,o,d,u,h,g;let{pageData:m}=e,[p,j]=(0,a.useState)(""),[_,w]=(0,a.useState)([]),{setPageData:y}=(0,x.B)();(0,a.useEffect)(()=>{if(y(m),(null==m?void 0:m.lang)==="no")switch(m.acf.kategori){case"Se og gj\xf8re":j("/no/se-og-gjore/");break;case"Overnatting":j("/no/overnatting/");break;case"Mat og drikke":j("/no/servering-og-uteliv/");break;case"Hva skjer?":j("/no/hva-skjer/");break;case"Kurs & konferanse":j("/no/kurs-og-konferanse/");break;case"Bransje":j("/no/bransje");break;case"B\xe6rekraft":j("/no/baerekraft");break;default:j("/no/")}else switch(m.acf.kategori){case"Se og gj\xf8re":j("/en/see-and-do/");break;case"Overnatting":j("/en/accommodation");break;case"Mat og drikke":j("/en/food-and-drink/");break;case"Hva skjer?":j("/en/whats-on/");break;case"Kurs & konferanse":j("/en/groups");break;case"Bransje":j("/en/industry");break;case"B\xe6rekraft":j("/en/sustainability");break;default:j("/en/")}},[m,y]);let[k,C]=(0,a.useState)([]),[b,N]=(0,a.useState)(!1),S=null==m||null==(l=m._embedded)||null==(t=l["wp:featuredmedia"])?void 0:t[0];(0,a.useEffect)(()=>{var e,t,l,n;(null==m||null==(e=m.acf)?void 0:e.channel_search)||(null==m||null==(t=m.acf)?void 0:t.product_search)||!((null==m||null==(n=m.acf)||null==(l=n.content_cards)?void 0:l.length)>0)||L(m.acf.content_cards)},[m,y]);let L=async e=>{N(!0);try{let t=e.map(async e=>{let t=null;if(e.img){let l=await fetch("https://wordpress.visitvestfold.com/wp-json/wp/v2/media/".concat(e.img));l.ok&&(t=(await l.json()).source_url)}return{...e,img_url:t}}),l=await Promise.all(t);C(l),N(!1)}catch(e){console.error("Error fetching images:",e),N(!1)}},H=async(e,t)=>{if(null==e?void 0:e.length){N(!0);try{let l=await et(e,{embed:!0});if(!t())return;w(l),N(!1)}catch(e){console.error("Error fetching related items:",e),t()&&N(!1)}}};(0,a.useEffect)(()=>{var e;let t=!0;return H(null==m||null==(e=m.acf)?void 0:e.related_products,()=>t),()=>{t=!1}},[m]);let M=e=>{var t;let l=null==e||null==(t=e.acf)?void 0:t.channels;if(!Array.isArray(l)||0===l.length)return null;let n=l.filter(e=>"750"===e.channel_id||"VisitVestfold.com"===e.channel_name).map(e=>parseInt(e.listing_level)).filter(e=>!isNaN(e));return 0===n.length?null:Math.min(...n)},V=(e,t)=>{var l,n;let a="events"===e.type,s="events"===t.type,r=!!(null==(l=e.acf)?void 0:l.booking_website),i=!!(null==(n=t.acf)?void 0:n.booking_website),c=(e,t)=>!e&&t?0:e&&t?1:e?3:2,o=c(a,r),d=c(s,i);if(o!==d)return o-d;let u=M(e),h=M(t),g=e=>null===e?3.5:0===e||4===e?99:e;return g(u)-g(h)},E=async e=>{N(!0);let t=Array.isArray(e)?e.join(","):e;try{let e=await fetch("https://wordpress.visitvestfold.com/wp-json/custom/v1/channel-products/".concat(t)),l=await e.json(),n=Number(e.headers.get("X-WP-Total")),a=l.sort(V);setTotalProducts(n),setProducts(a),setFilteredProducts(a),setCurrentPage(1),console.log("products"),console.log(l)}catch(e){console.error("Failed to fetch channel products",e)}finally{N(!1)}};(0,a.useEffect)(()=>{var e;(null==m||null==(e=m.acf)?void 0:e.channel_search)&&E(m.acf.channel)},[]);let D={Overnatting:"Accommodation","Se og gj\xf8re":"See and do",Arrangementer:"Events","Mat og drikke":"Food & drink",Attraksjoner:"Attractions","Kurs & konferanse":"Events & Conferences",Transport:"Transport",Bransje:"Industry",Bærekraft:"Sustainability"};return(0,n.jsxs)("div",{className:"single-page",children:[(0,n.jsx)("div",{className:"backgroundgrey",children:(0,n.jsx)("div",{className:"wrapper",children:(null==S?void 0:S.source_url)&&(0,n.jsx)(A.default,{className:"post-feature",src:S.source_url,alt:(null==S?void 0:S.alt_text)||"Featured Image",width:"1240",height:"547"})})}),(0,n.jsx)("div",{className:"text-hero grey",children:(0,n.jsxs)("div",{className:"inner
1-hero",children:[(null==m||null==(s=m.acf)?void 0:s.kategori)!=="Ingen pill"?(0,n.jsx)(f(),{href:p,children:(0,n.jsx)("div",{className:"pill-cat",children:(null==m||null==(r=m.acf)?void 0:r.kategori)==="Planlegg turen"?(null==m?void 0:m.lang)==="en"?"Get Around":"Kom deg rundt":(null==m?void 0:m.lang)==="en"&&D[null==m||null==(i=m.acf)?void 0:i.kategori]?D[m.acf.kategori]:null==m||null==(c=m.acf)?void 0:c.kategori})}):"",(0,n.jsx)("h1",{children:(0,v.decode)(null==m||null==(o=m.title)?void 0:o.rendered)}),(0,n.jsx)("div",{dangerouslySetInnerHTML:{__html:m.content.rendered}})]})}),(0,n.jsx)("div",{className:"backgroundgrey",children:(0,n.jsx)("div",{className:"wrapper",children:(0,n.jsxs)("div",{className:"page-content",children:[b?(0,n.jsx)("div",{className:"center",children:(0,n.jsx)("i",{className:"fa-solid fa-spin fa-spinner-scale"})}):(0,n.jsx)(n.Fragment,{children:!(null==m||null==(d=m.acf)?void 0:d.product_search)&&!(null==m||null==(u=m.acf)?void 0:u.channel_search)&&k.length>0&&(0,n.jsx)("div",{className:"related-items",children:(0,n.jsx)("div",{className:"related-grid",children:k.map((e,t)=>{var l,a,s,r,i,c,o,d;return(0,n.jsxs)("div",{className:"related-card",children:[(0,n.jsx)("div",{className:"related-image",children:(null==e?void 0:e.img_url)&&(0,n.jsx)("a",{href:(null==(l=e.link)?void 0:l.url)||"#",target:(null==(a=e.link)?void 0:a.target)||"_self",children:(0,n.jsx)("div",{className:"img-background",style:{background:"url(".concat(e.img_url,") no-repeat"),backgroundSize:"cover",backgroundPosition:"center center",width:"100%",height:"296px"}})})}),(0,n.jsxs)("div",{className:"related-content",children:[(0,n.jsxs)("div",{className:"related-content-title",children:[(0,n.jsx)("a",{href:(null==(s=e.link)?void 0:s.url)||"#",target:(null==(r=e.link)?void 0:r.target)||"_self",children:(0,n.jsx)("h3",{children:e?(0,v.decode)(e.title):""})}),(null==e||null==(i=e.acf)?void 0:i.excerpt)?(0,n.jsx)("p",{children:e.acf.excerpt}):(0,n.jsx)("p",{dangerouslySetInnerHTML:{__html:e.excerpt}})]}),(0,n.jsx)("div",{className:"related-btn-wrap",children:(0,n.jsx)("a",{href:(null==(c=e.link)?void 0:c.url)||"#",target:(null==(o=e.link)?void 0:o.target)||"_self",className:"read-more",children:(null==e?void 0:e.link)?(0,v.decode)(null==(d=e.link)?void 0:d.title):(null==m?void 0:m.lang)==="no"?"Les mer":"Read more"})})]})]},t)})})})}),(null==m||null==(g=m.acf)||null==(h=g.related_products)?void 0:h.length)>0&&(0,n.jsx)(z,{lang:null==m?void 0:m.lang,cards:_})]})})})]})};l(4496);let ea=function(e){let{quote:t,link:l,color:s,id:r}=e,[i,c]=(0,a.useState)(!1),o=(0,a.useRef)();(0,a.useEffect)(()=>{let e=new IntersectionObserver(t=>{let[l]=t;l.isIntersecting&&(c(!0),e.unobserve(l.target))},{threshold:.2});return o.current&&e.observe(o.current),()=>{o.current&&e.unobserve(o.current)}},[]);let d=t.split(" ").map((e,t)=>(0,n.jsx)("span",{style:{display:"inline-block",marginRight:"0.25em"},children:e},t));return(0,n.jsxs)("div",{ref:o,className:"special quote ".concat(s," ").concat(i?"color-animate":""),id:r,children:[(0,n.jsx)(A.default,{className:"imageBackground",src:"/img/quoteBackground.svg",width:"1143",height:"1080",alt:"Background Element"}),(0,n.jsx)("div",{className:"quote-wrapper",children:(0,n.jsx)("h1",{className:"elegant-text ".concat(i?"animate":""),children:d})}),l?(0,n.jsx)(f(),{className:"quote-link",href:l.url,target:l.target,children:l.title}):""]})},es=function(e){let{quote:t,lang:l}=e,[s,r]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{let e=setTimeout(()=>{r(!0)},100);return()=>clearTimeout(e)},[]),(0,n.jsxs)("div",{className:"special quote white",children:[(0,n.jsx)(A.default,{className:"imageBackground",src:"/img/quoteBackground.svg",width:"1143",height:"1080",alt:"Background Element"}),(0,n.jsxs)("div",{className:"quote-wrapper",children:[(0,n.jsx)(f(),{href:"https://visitvestfold.com/".concat(l),target:"_blank",rel:"follow",children:(0,n.jsx)(A.default,{className:s?"special-logo fade-in":"special-logo should-fade",width:"48",height:"48",src:"/img/special-logo.svg",alt:"Visit Vestfold Logoicon"})}),(0,n.jsx)("h1",{className:s?"fade-in":"should-fade",children:t})]}),(0,n.jsx)(f(),{className:s?"quote-link fade-in":"quote-link should-fade",href:"#seksjon-1",children:"no"===l?"Utforsk":"Explore"})]})},er=function(e){let{text:t,id:l}=e,[s,r]=(0,a.useState)(!1),i=(0,a.useRef)();(0,a.useEffect)(()=>{let e=new IntersectionObserver(t=>{let[l]=t;l.isIntersecting&&(r(!0),e.unobserve(l.target))},{threshold:.1});return i.current&&e.observe(i.current),()=>{i.current&&e.unobserve(i.current)}},[]);let c=(e=>{let t=new DOMParser().parseFromString("<div>".concat(e,"</div>"),"text/html"),l=t.body.firstChild,n=Array.from(l.childNodes),a=[];
1return n.forEach(e=>{if(3===e.nodeType&&(3!==e.nodeType||/\S/.test(e.nodeValue))){let l=t.createElement("p");l.textContent=e.nodeValue,a.push(l)}else a.push(e)}),l.innerHTML="",a.forEach(e=>l.appendChild(e)),l.innerHTML})(t);return(0,n.jsx)("div",{className:"special textcomponent",id:l,children:(0,n.jsx)("div",{ref:i,className:"text-wrapper ".concat(s?"fadeUpOnScroll":""),children:(0,n.jsx)("div",{className:"text",dangerouslySetInnerHTML:{__html:c}})})})},ei=function(e){let{videos:t,id:l,lang:s}=e,[r,i]=(0,a.useState)({}),[c,o]=(0,a.useState)(!0),[d,u]=(0,a.useState)(!0),h=(0,a.useRef)([]);return(0,a.useEffect)(()=>{let e=async()=>{let e={};for(let l of t)if(null==l?void 0:l.video)try{let t=await fetch("https://wordpress.visitvestfold.com/wp-json/wp/v2/media/".concat(l.video)),n=await t.json();e[l.video]=n.source_url}catch(e){console.error("Failed to fetch video ".concat(l.video,":"),e)}i(e)};(null==t?void 0:t.length)&&e()},[t]),(0,n.jsx)(n.Fragment,{children:t.map((e,t)=>(0,n.jsxs)("div",{className:"fullscreen video",id:"".concat(l),children:[(0,n.jsx)("video",{ref:e=>h.current[t]=e,className:"video-element",src:r[e.video],muted:d,autoPlay:!0,playsInline:!0,loop:!0}),(0,n.jsx)("div",{className:"video-overlay"}),(0,n.jsxs)("div",{className:"video-details",children:[(0,n.jsxs)("div",{className:"action-btns",children:[(0,n.jsx)("div",{className:"video-circle",onClick:()=>(e=>{let t=h.current[e];t&&(t.paused?(t.play(),o(!0)):(t.pause(),o(!1)))})(t),children:c?(0,n.jsx)("i",{className:"fa-sharp fa-solid fa-pause"}):(0,n.jsx)("i",{className:"fa-sharp fa-solid fa-play"})}),!1==e.volume_control?(0,n.jsx)("div",{className:"video-circle",onClick:()=>(e=>{let t=h.current[e];t&&(t.muted=!t.muted,u(t.muted))})(t),children:d?(0,n.jsx)("i",{className:"fa-sharp fa-solid fa-volume-xmark"}):(0,n.jsx)("i",{className:"fa-sharp fa-solid fa-volume-high"})}):""]}),(0,n.jsx)("div",{className:"title-area",children:(0,n.jsx)("h3",{children:e.title})}),(0,n.jsxs)("div",{className:"video-info",children:[(null==e?void 0:e.vid_location)&&(0,n.jsxs)("div",{className:"info-wrapper",children:[(0,n.jsx)("p",{children:"no"===s?"Sted:":"Location:"}),(0,n.jsx)("p",{children:e.vid_location})]}),(null==e?void 0:e.playtime)&&(0,n.jsxs)("div",{className:"info-wrapper",children:[(0,n.jsx)("p",{children:"no"===s?"Spilletid:":"Length:"}),(0,n.jsx)("p",{children:e.playtime})]})]})]})]},t))})},ec=function(e){let{videos:t,id:l,lang:s}=e,r=(0,a.useRef)([]),i=(0,a.useRef)(),[c,o]=(0,a.useState)([]),[d,u]=(0,a.useState)([]),[h,g]=(0,a.useState)({}),[m,v]=(0,a.useState)(!1),[p,f]=(0,a.useState)(!0);return(0,a.useEffect)(()=>{let e=async()=>{let e={};for(let l of t)if(null==l?void 0:l.video)try{let t=await fetch("https://wordpress.visitvestfold.com/wp-json/wp/v2/media/".concat(l.video)),n=await t.json();e[l.video]=n.source_url}catch(e){console.error("Failed to fetch video ".concat(l.video,":"),e)}finally{f(!1)}g(e)};(null==t?void 0:t.length)&&e()},[t]),(0,a.useEffect)(()=>{o(t.map(()=>!0)),u(t.map(()=>!0))},[t]),(0,a.useEffect)(()=>{let e=new IntersectionObserver(t=>{let[l]=t;l.isIntersecting&&(v(!0),e.unobserve(l.target))},{threshold:.2});return i.current&&e.observe(i.current),()=>{i.current&&e.unobserve(i.current)}},[]),(0,n.jsx)("div",{ref:i,className:"content video",id:"".concat(l),children:(0,n.jsx)("div",{className:t.length>1?"videos-wrapper multiple":"videos-wrapper",children:t.map((e,t)=>(0,n.jsxs)("div",{className:"content--video ".concat(m?"fadeUpOnScroll":""),id:"".concat(l,"-").concat(t),children:[(0,n.jsx)("video",{ref:e=>r.current[t]=e,className:"video-element",src:null==h?void 0:h[e.video],autoPlay:!0,loop:!0,playsInline:!0,muted:c[t]}),(0,n.jsx)("div",{className:"video-overlay"}),(0,n.jsxs)("div",{className:"video-details",children:[(0,n.jsxs)("div",{className:"action-btns",children:[(0,n.jsx)("div",{className:"video-circle",onClick:()=>(e=>{let t=r.current[e];t&&(t.paused?t.play():t.pause(),u(t=>t.map((t,l)=>l===e?!t:t)))})(t),children:(0,n.jsx)("i",{className:"fa-sharp fa-solid ".concat(d[t]?"fa-pause":"fa-play")})}),!1==e.volume_control?(0,n.jsx)("div",{className:"video-circle",onClick:()=>(e=>{let t=r.current[e];t&&(t.muted=!t.muted,o(t=>t.map((t,l)=>l===e?!t:t)))})(t),children:(0,n.jsx)("i",{className:"fa-sharp fa-solid ".concat(c[t]?"fa-volume-xmark":"fa-volume-high")})}):""]}),(null==e?void 0:e.title)&&(0,n.jsx)("div",{className:"title-area",children:(0,n.jsx)("h3",{children:e.title})}),(0,n.jsxs)("div",{className:"video-info",children:[(null==e?void 0:e.vid_location)&&(0,n.jsxs)("div",{className:"info-wrapper",children:[(0,n.jsx)("p",{children:"no"===s?"Sted:":"Location:"}),(0,n.jsx)("p",{children:e.vid_location})]}),(null==e?void 0:e.playtime)&&(0,n.jsxs)("div",{className:"info-wrapper",children:[(0,n.jsx)("p",{children:"no"===s?"Spilletid:":"Length:"}),(0,n.jsx)("p",{children:e.playtime})]})]})]})]},t))})})},eo=function(e){let{img:t,id:l,lang:s}=e,[r,i]=(0,a.useState)(null),[c,o]=(0,a.useState)(null),[d,u]=(0,a.useState)(null),[h,g]=(0,a.useState)(!1),m=(0,a.useRef)();return(0,a.useEffect)(()=>{async function e(){try{var e;let l=await fetch("https://wordpress.visitvestfold.com/wp-json/wp/v2/media/".concat(t)),n=await l.json(),a=(null==(e=n.media_details.sizes)?void 0:e.full)||n.media_details;i(a.source_url||n.source_url),o(a.width),u(a.height)}catch(e){console.error("Failed to fetch image:",e)}}t&&e()},[t]),(0,a.useEffect)(()=>{let e=new IntersectionObserver(t=>{let[l]=t;l.isIntersecting&&(g(!0),e.unobserve(l.target))},{threshold:.2});return m.current&&e.observe(m.current),()=>{m.current&&e.unobserve(m.current)}},[]),(0,n.jsx)("div",{className:"image-special",ref:m,id:l,children:(0,n.jsx)("div",{className:"image-wrapper ".concat(h?"scale-in":""),children:r&&c&&d&&(0,n.jsx)(A.default,{className:"special-img",width:c,height:d,alt:"",src:r})})})},ed=function(e){let{title:t,lang:l,postIds:s}=e,[r,i]=(0,a.useState)([]),c=(0,a.useRef)(null),[o,d]=(0,a.useState)(!1),[u,h]=(0,a.useState)(!1);(0,a.useEffect)(()=>{let e=async()=>{let e=[];for(let t of s)try{let l=await fetch("https://wordpress.visitvestfold.com/wp-json/custom/v1/post-id?id=".concat(t)),n=await l.json();e.push(n),console.log(n)}catch(e){console.error("Failed to fetch post ID ".concat(t,":"),e)}i(e)};s.length&&e()},[s]);let g=()=>{if(!c.current)return;let{scrollLeft:e,scrollWidth:t,clientWidth:l}=c.current;d(e>0),h(e+5<t-l)},m=e=>{if(!c.current)return;let t=c.current.querySelector(".post-listing");if(!t)return;let l=window.innerWidth<=1200,n=t.offsetWidth+(l?16:20);c.current.scrollBy({left:"next"===e?n:-n,behavior:"smooth"}),setTimeout(g,400)},p=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,l=(0,v.decode)(e.replace(/(<([^>]+)>)/gi,""));return l.length>t?"".concat(l.slice(0,t),"..."):l},x=e=>{if(e)return e.replace("https://wordpress.visitvestfold.com/","").replace(/\/$/,"")};return(0,n.jsx)("div",{className:"relationship-block",children:(0,n.jsxs)("div",{className:"inside",children:[(0,n.jsx)("div",{className:"title-area",children:(0,n.jsx)("h2",{children:null!=t?t:"no"===l?"Se ogs\xe5":"You may also like"})}),(0,n.jsx)("ul",{className:"post-listings",ref:c,onScroll:g,children:r.filter(e=>e&&e.title&&e.link).map((e,t)=>{var a,s,r,i;return(0,n.jsxs)("li",{className:"post-listing",children:[Array.isArray(null==(a=e.acf)?void 0:a.media_gallery)&&e.acf.media_gallery.length>0?(0,n.jsx)(f(),{className:"image-wrapper",style:{display:"block",width:"100%"},href:"/".concat(x(e.link)),children:(0,n.jsx)("div",{className:"listing-image",style:{backgroundImage:"url(".concat((0,j.L)(e.acf.media_gallery),")"),backgroundColor:(0,j.L)(e.acf.media_gallery)?"transparent":"#f0f0f0",backgroundSize:"cover",backgroundPosition:"center center"}})}):(0,n.jsx)(f(),{style:{display:"block",width:"100%"},href:"/".concat(x(e.link)),children:(0,n.jsx)("div",{className:"card-image",style:{backgroundImage:(null==e||null==(s=e.yoast_head_json)?void 0:s.og_image)?"url(".concat(null==e||null==(r=e.yoast_head_json)?void 0:r.og_image,")"):(null==e?void 0:e.featured_image)?"url(".concat(e.featured_image,")"):"none",backgroundColor:(null==e?void 0:e.featured_image)?"transparent":"#f0f0f0",backgroundSize:"cover",backgroundPosition:"center center"}})}),(0,n.jsxs)("div",{className:"listing-content",children:[(0,n.jsxs)("div",{className:"listing-content-titlearea",children:[(0,n.jsx)(f(),{href:"/".concat(x(e.link)),children:(0,n.jsx)("h3",{children:(0,v.decode)(null==e?void 0:e.title)})}),(0,n.jsx)("p",{children:p(null==e?void 0:e.excerpt)})]}),(0,n.jsxs)("div",{className:"listing-btn-wrap",children:[(null==e||null==(i=e.acf)?void 0:i.booking_website)&&(0,n.jsx)(f(),{target:"_blank",className:"book-btn",href:e.acf.booking_website,children:(0,n.jsx)("strong",{children:"no"===l?"Book n\xe5":"Book now"})}),(0,n.jsx)(f(),{className:"post-btn",href:"/".concat(x(e.link)),children:(0,n.jsx)("strong",{children:"no"===l?"Les mer":"Read more"})})]})]})]},"post-".concat(t))})}),r.length>3&&(0,n.jsxs)("div",{className:"slider-wrapper",children:[(0,n.jsx)("svg",{onClick:()=>m("prev"),className:o?"":"disabled",xmlns:"http://www.w3.org/2000/svg",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",children:(0,n.jsx)("path",{d:"M36.6667 20.1668L14.3459 20.1668L24.6125 9.90016L22 7.3335L7.33335 22.0002L22 36.6668L24.6125 34.1002L14.3459 23.8335L36.6667 23.8335L36.6667 20.1668Z",fill:"black"})}),(0,n.jsx)("svg",{onClick:()=>m("next"),className:u?"":"disabled",xmlns:"http://www.w3.org/2000/svg",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",children:(0,n.jsx)("path",{d:"M7.33334 23.8332L29.6542 23.8332L19.3875 34.0998L22 36.666
15L36.6667 21.9998L22 7.33317L19.3875 9.89984L29.6542 20.1665L7.33334 20.1665L7.33334 23.8332Z",fill:"black"})})]})]})})},eu=function(e){var t;let{pageData:l}=e,{setPageData:s}=(0,x.B)();return(0,a.useEffect)(()=>{s(l)},[l,s]),(0,a.useEffect)(()=>{if((null==l?void 0:l.type)==="special_post"){let e="special-body";return document.body.classList.add(e),()=>{document.body.classList.remove(e)}}},[null==l?void 0:l.type]),(0,n.jsxs)("article",{className:"special-article",children:[(0,n.jsx)(es,{lang:null==l?void 0:l.lang,quote:null==l?void 0:l.title.rendered}),null==l||null==(t=l.acf)?void 0:t.sections.map((e,t)=>{switch(e.acf_fc_layout){case"brand_quote":return(0,n.jsx)(ea,{quote:e.quote,color:e.color,link:e.link,id:"seksjon-"+(t+1)},t);case"content":return(0,n.jsx)(er,{text:e.content,id:"seksjon-"+(t+1)},t);case"video":if("fullscreen"===e.size)return(0,n.jsx)(ei,{id:"seksjon-"+(t+1),videos:e.video_repeater,lang:null==l?void 0:l.lang});return(0,n.jsx)(ec,{id:"seksjon-"+(t+1),videos:e.video_repeater,lang:null==l?void 0:l.lang});case"img":return(0,n.jsx)(eo,{id:"seksjon-"+(t+1),img:e.img});case"products_posts":return(0,n.jsx)(ed,{lang:null==l?void 0:l.lang,postIds:e.products||[],title:e.product_title},t);default:return null}})]},null==l?void 0:l.id)},eh=function(e){let{lang:t,pageData:l,initialProducts:r,initialEvents:i}=e,{setPageData:c}=(0,x.B)();if((0,a.useEffect)(()=>{c(l)},[l,c]),(0,a.useEffect)(()=>{if(l){if(console.log("Page Data:",l),null==l?void 0:l.template){let e="template-".concat(l.template.replace(".php",""));return document.body.classList.add(e),()=>{document.body.classList.remove(e)}}}else console.error("Page Data is undefined or null. Ensure it is passed correctly.")},[l]),!l)return(0,n.jsxs)("div",{className:"loading",children:[(0,n.jsx)("h1",{children:"Loading..."}),(0,n.jsx)("p",{children:"Please wait while we fetch the content."})]});if("page"===l.type)switch(l.template){case"page-city.php":return(0,n.jsx)(s.default,{pageData:l,lang:t});case"page-accomodation.php":return(0,n.jsx)(d,{pageData:l,lang:t});case"page-mainevent.php":return(0,n.jsx)(C,{pageData:l,lang:t,initialEvents:i});case"page-courses.php":return(0,n.jsx)(N,{pageData:l,lang:t});case"page-articles.php":return(0,n.jsx)(L,{pageData:l,lang:t});case"page-todo.php":return(0,n.jsx)(H,{pageData:l,lang:t});case"page-map.php":return(0,n.jsx)(B,{pageData:l,lang:t});case"page-info.php":return(0,n.jsx)(I,{pageData:l,lang:t});case"page-industry.php":return(0,n.jsx)(Z,{pageData:l,lang:t});case"page-plantour.php":return(0,n.jsx)(F,{pageData:l,lang:t});case"page-food.php":return(0,n.jsx)(P,{pageData:l,lang:t});case"page-listings.php":return(0,n.jsx)(R,{pageData:l,lang:t});case"page-standardcards.php":return(0,n.jsx)(en,{pageData:l,lang:t});case"page-singlearticle.php":return(0,n.jsx)(q,{pageData:l,lang:t});case"":return(0,n.jsx)(el,{pageData:l,lang:t,initialProducts:r})}switch(l.type){case"post":return(0,n.jsx)(q,{pageData:l,lang:t});case"special_post":return(0,n.jsx)(eu,{pageData:l,lang:t});default:return(0,n.jsx)(G,{pageData:l,lang:t})}}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.