(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5420],{6519:function(e,t,l){(window.__NEXT_P=window.__NEXT_P||[]).push(["/unterkunft",function(){return l(4754)}])},4754:function(e,t,l){"use strict";l.r(t),l.d(t,{default:function(){return A}});var r=l(4246),n=l(6677),a=l(7378),s=l(8974),i=l(7387),u=l(3952),o=l(3365),c=l(7771),d=l(2064),x=l(5406),h=l(9147),m=l(6990);let p=e=>{let{title:t,fetching:l,articleList:n,pageCount:a,currentPage:s,onPageChange:i,resultRef:u,themeWorld:o,metaDescription:c,children:p}=e,f=(0,h.$)("hui.search");return(0,r.jsx)(d.D,{themeWorld:o,children:(0,r.jsxs)(x.D,{title:t,description:c,showTitle:!0,children:[(0,r.jsx)("div",{ref:u,className:"absolute scroll-mt-2"}),p,(0,r.jsxs)("div",{className:"relative",children:[l&&(0,r.jsx)("div",{className:"text-themeworld absolute z-10 h-full w-full bg-white/80 py-8 text-center text-4xl",children:f("searching")}),!l&&0===n.length&&(0,r.jsx)("p",{className:"text-themeworld w-full text-center text-4xl",children:f("no_results")}),(0,r.jsx)(m.L,{articleList:n,pageCount:a,onPageChange:i,currentPage:s,hLevel:"h2"})]})]})})};var f=l(624);let v=(0,a.forwardRef)((e,t)=>{let{labelText:l,options:n,bordered:a,className:s,...i}=e;return(0,r.jsx)("div",{className:(0,f.Z)("w-full",s),children:(0,r.jsxs)("label",{children:[l,(0,r.jsx)("select",{className:(0,f.Z)("mt-1 w-full scroll-mt-32 rounded py-1 px-2 text-black",a&&"border border-[#d9d9d9]"),ref:t,...i,children:n.map(e=>(0,r.jsx)("option",{value:e.value,children:e.text},e.value))})]})})});v.displayName="Select";let g=(0,a.forwardRef)((e,t)=>{let{labelText:l,bordered:n,className:a,...s}=e;return(0,r.jsx)("div",{className:(0,f.Z)("w-full",a),children:(0,r.jsxs)("label",{children:[l,(0,r.jsx)("input",{className:(0,f.Z)("mt-1 w-full scroll-mt-32 rounded py-1 px-2 text-black",n&&"border border-[#d9d9d9]"),type:"text",ref:t,...s})]})})});g.displayName="TextInput";let j=["Alle","Hotel","Pension","Ferienhaus","Ferienwohnung","Campingplatz","Hotel garni","Gasthaus","Privatzimmer","Wohnmobilstellplatz","Reiterhof","Ferien auf dem Bauernhof"];var b=l(9894),y=l.n(b),w=l(236),N=l.n(w);let k={city:"Alle",perimeter:"0",type:"alle",online:"online",rating:"alle",freetext:""},C=e=>{var t,l;let{onSearch:s,defaultSearchOptions:i,city:u}=e,o=(0,n.useRouter)(),d=(0,a.useRef)(N()(i,k)),x=(0,a.useRef)(null),[m,p]=(0,a.useState)("Alle"==d.current.city),[{data:f}]=(0,c.$b)(),b=e=>{let t=e.target.value,l=e.target.name;"city"===l&&(p("Alle"===t),"Alle"===t&&x.current&&(d.current.perimeter="0",x.current.value="0")),d.current[l]=t},w=(0,h.$)("hui.accommodations");return(0,r.jsxs)("div",{className:"bg-themeworld mb-8 w-full rounded-xl p-4 text-white",children:[(0,r.jsx)("p",{className:"text-2xl",children:w("Unterkunft suchen")}),(0,r.jsx)("hr",{className:"my-3"}),(0,r.jsxs)("form",{children:[(0,r.jsxs)("div",{className:"flex flex-wrap gap-8 sm:flex-nowrap",children:[(0,r.jsx)(v,{name:"city",labelText:w("Ort"),options:[{text:w("Alle"),value:"Alle"},...null!==(l=null==f?void 0:null===(t=f.cityNames)||void 0===t?void 0:t.map(e=>({text:e,value:e})))&&void 0!==l?l:[]],onChange:b,defaultValue:d.current.city,value:u,disabled:!!u}),(0,r.jsx)(v,{name:"perimeter",labelText:w("Umkreis"),options:[{text:w("Kein Umkreis"),value:0},{text:"10 km",value:1e4},{text:"20 km",value:2e4},{text:"30 km",value:3e4},{text:"40 km",value:4e4},{text:"50 km",value:5e4}],onChange:b,disabled:m,defaultValue:d.current.perimeter,ref:x})]}),(0,r.jsxs)("div",{className:"my-4 flex flex-wrap gap-8 sm:flex-nowrap",children:[(0,r.jsx)(v,{name:"type",labelText:w("Art der Unterkunft"),options:j.map(e=>({text:w(e),value:e,default:"alle"===e})),onChange:b,defaultValue:d.current.type}),(0,r.jsx)(v,{name:"online",labelText:w("Online buchbar"),options:[{text:w("Alle"),value:"alle"},{text:w("Online buchbar"),value:"online"}],onChange:b,defaultValue:d.current.online})]}),(0,r.jsxs)("div",{className:"mt-4 flex flex-wrap gap-8 sm:flex-nowrap",children:[(0,r.jsx)(v,{name:"rating",labelText:w("Sterne"),options:[{text:w("Alle"),value:"alle"},{text:"1 ".concat(w("Stern")),value:"1"},{text:"2 ".concat(w("Sterne")),value:"2"},{text:"3 ".concat(w("Sterne")),value:"3"},{text:"4 ".concat(w("Sterne")),value:"4"},{text:"5 ".concat(w("Sterne")),value:"5"}],defaultValue:d.current.rating,onChange:b}),(0,r.jsx)(g,{name:"freetext",labelText:w("Freitext"),onChange:b,placeholder:w("Suchbegriff eingeben"),defaultValue:d.current.freetext})]}),(0,r.jsx)(y(),{href:{pathname:o.pathname,query:d.current},shallow:!0,legacyBehavior:!0,children:(0,r.jsx)("button",{className:"bg-themeworld-dark mt-6 mb-3 rounded py-1 px-2 text-white",onClick:e=>{e.preventDefault(),s(d.current)},type:"submit",children:w("Suche starten")})})]})]})},S=e=>{var t,l,d;let x,{metaDescription:m}=e,f=(0,n.useRouter)(),v=Number(null!==(t=f.query.page)&&void 0!==t?t:1),g=(0,h.$)("hui.accommodations"),{experience:j}=(0,s.N)(),b=(0,i.p)(),{city:y,perimeter:w,type:N,online:k,rating:S,freetext:A}=(0,u.n)(f.query),_=(0,a.useRef)(null);"celle"===f.query.themeWorld&&(x="Celle",b=o.Du.Stadt),"lueneburg"===f.query.themeWorld&&(x="L\xfcneburg",b=o.Du.Stadt);let[{data:R,fetching:T}]=(0,c.O_)({variables:{input:{offset:Math.max(0,(v-1)*7),city:null!=x?x:y,perimeter:"Alle"==y?"0":w,type:N,online:k,rating:S?Number(S):void 0,freetext:A,experience:j,themeWorld:b,locale:f.locale}}}),W=null!==(l=null==R?void 0:R.accommodations.items)&&void 0!==l?l:[],q=null!==(d=null==R?void 0:R.accommodations.overallcount)&&void 0!==d?d:0;return(0,r.jsx)(p,{title:g("Unterk\xfcnfte"),fetching:T,articleList:W,pageCount:Math.ceil(q/7),currentPage:v,onPageChange:e=>{if(R){var t;let l={...f.query,page:e};f.push({query:l},void 0,{shallow:!0}),null===(t=_.current)||void 0===t||t.scrollIntoView({behavior:"smooth"})}},themeWorld:null!=b?b:void 0,metaDescription:m,resultRef:_,children:(0,r.jsx)(C,{onSearch:e=>{var t;let l={...f.query,...e,page:1};f.push({query:l},void 0,{shallow:!0}),null===(t=_.current)||void 0===t||t.scrollIntoView({behavior:"smooth"})},defaultSearchOptions:{city:y,perimeter:w,rating:S,type:N,freetext:A,online:k},city:x},JSON.stringify(f.query))})};var A=()=>(0,r.jsx)(S,{})},5406:function(e,t,l){"use strict";l.d(t,{D:function(){return v}});var r=l(4246),n=l(6158),a=l(7378),s=l(9894),i=l.n(s),u=l(6677),o=l(8052),c=l.n(o);let d=(e,t)=>{let l=c()(e);switch(l){case"Etappe":return{title:"Etappen",url:"/etappen"};case"Unterkunft":case"Unterkuenfte":return{title:"Unterk\xfcnfte",url:t};default:return{title:l,url:t}}},x=e=>{let{title:t}=e,l=[{title:"Home",url:"/"}],{pathname:s,asPath:o,query:c}=(0,u.useRouter)(),x="";for(let e of s.split("/").filter(e=>""!==e&&!(e.startsWith("[...")&&e.endsWith("]"))&&"[entityType]"!==e&&"[articleRoute]"!==e&&!e.endsWith(".html")))e.startsWith("[")&&e.endsWith("]")&&(e=c[e.replace(/[\[\]]+/g,"")]),x+="/"+e,l.push(d(e,x));let h=o.replace(/\?.*$/,"").split("#")[0];return t&&l[l.length-1].url!==h?l.push({title:t,url:o}):t&&(l[l.length-1].title=t),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"text-themeworld flex gap-2 overflow-hidden py-2 text-sm",children:l.map((e,t)=>(0,r.jsxs)(a.Fragment,{children:[(0,r.jsx)(i(),{href:e.url.split("#")[0],shallow:!0,className:"hover:text-themeworld-light last-of-type:truncate",children:e.title}),t!==l.length-1&&(0,r.jsx)("span",{children:">"})]},e.url))}),(0,r.jsx)(n.f,{})]})};var h=l(8974),m=l(624),p=l(6533),f=l(5113);let v=e=>{var t,l;let{children:a,aside:s,title:i,description:u,showTitle:o=!1,belowTitle:c,noOverflowHidden:d,...v}=e,{title:g,contentLayoutAdditionalWidgetComponent:j}=(0,h.N)(),{seoSettings:b}=(0,p.e)(),y=i||(null==b?void 0:b.title)?"".concat(null!==(t=null==b?void 0:b.title)&&void 0!==t?t:i," | ").concat(g):g,w=null!==(l=null==b?void 0:b.description)&&void 0!==l?l:u;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(x,{title:i}),i&&o&&(0,r.jsxs)("div",{className:"w-full",children:[(0,r.jsxs)("div",{className:"py-12 text-center",children:[(0,r.jsx)("h1",{className:"text-themeworld text-3xl font-bold sm:text-4xl",children:i}),c&&(0,r.jsx)("div",{className:"mt-4",children:c})]}),(0,r.jsx)(n.f,{})]}),(0,r.jsxs)("div",{className:"grid-cols-1 gap-y-8 py-8 lg:grid lg:grid-cols-3 lg:gap-x-8",...v,children:[(0,r.jsx)(f.R,{title:y,description:w,imageUrl:null==b?void 0:b.imageUrl}),(0,r.jsx)("main",{className:(0,m.Z)("flex flex-col gap-2",!1===s?"col-span-3":"col-span-2",!d&&"overflow-hidden"),children:a}),!1!==s&&(0,r.jsxs)("aside",{className:"flex flex-col gap-y-4",children:[s,j&&(0,r.jsx)(j,{})]})]})]})}},3952:function(e,t,l){"use strict";l.d(t,{n:function(){return r}});let r=e=>Object.fromEntries(Object.entries(e).map(e=>{let[t,l]=e;return[t,Array.isArray(l)?l[l.length-1]:l]}))}},function(e){e.O(0,[5787,3361,1569,3876,2888,9774,179],function(){return e(e.s=6519)}),_N_E=e.O()}]);