PageSourceSearch

https://meglerbasen.no/_next/static/chunks/6983-9aa64ac3a2f3fa30.js

js meglerbasen.no collected 2026-10-04 04:09:48 UTC 11,903 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6983],{46983:(e,s,a)=>{a.d(s,{A:()=>d});var r=a(95155),t=a(12115),l=a(74500),i=a(78046),n=a(35695);let c=[{id:"oslo",Name:"Oslo",Slug:"oslo"},{id:"bergen",Name:"Bergen",Slug:"bergen"},{id:"trondheim",Name:"Trondheim",Slug:"trondheim"},{id:"stavanger",Name:"Stavanger",Slug:"stavanger"},{id:"kristiansand",Name:"Kristiansand",Slug:"kristiansand"},{id:"fredrikstad",Name:"Fredrikstad",Slug:"fredrikstad"},{id:"sandnes",Name:"Sandnes",Slug:"sandnes"},{id:"drammen",Name:"Drammen",Slug:"drammen"}];function d(e){let{isOpen:s,onClose:a}=e,[d,o]=(0,t.useState)(""),[m,u]=(0,t.useState)([]),[x,h]=(0,t.useState)([]),[g,f]=(0,t.useState)([]),[p,y]=(0,t.useState)(!1),[v,b]=(0,t.useState)(-1),[j,N]=(0,t.useState)(!1),[w,k]=(0,t.useState)(!1),A=(0,t.useRef)(null),S=(0,n.useRouter)();(0,t.useEffect)(()=>{if(s)N(!0);else{let e=setTimeout(()=>N(!1),300);return()=>clearTimeout(e)}},[s]),(0,t.useEffect)(()=>{s&&A.current&&A.current.focus()},[s]),(0,t.useEffect)(()=>{d.trim().length>=2?(k(!0),y(!0)):(k(!1),y(!1))},[d]),(0,t.useEffect)(()=>{let e=setTimeout(async()=>{if(d.trim().length<2){u([]),h([]),f([]),y(!1),k(!1);return}y(!0);try{let e=[fetch("/api/search-municipalities?q=".concat(encodeURIComponent(d.trim()))),fetch("/api/search?search=".concat(encodeURIComponent(d.trim()),"&type=offices&limit=3")),fetch("/api/search?search=".concat(encodeURIComponent(d.trim()),"&type=agents&limit=4"))],s=await Promise.allSettled(e);if("fulfilled"===s[0].status)try{let e=await s[0].value.json();e.success&&Array.isArray(e.cities)?u(e.cities):u([])}catch(e){console.error("Failed to parse municipalities result:",e),u([])}else console.error("Municipalities search failed:",s[0].reason),u([]);if("fulfilled"===s[1].status)try{let e=await s[1].value.json();console.log("\uD83D\uDD0D SearchModal - Offices result:",e),e.success&&Array.isArray(e.data)?h(e.data):(console.log("❌ Offices failed or no data:",e),h([]))}catch(e){console.error("Failed to parse offices result:",e),h([])}else console.error("Offices search failed:",s[1].reason),h([]);if("fulfilled"===s[2].status)try{let e=await s[2].value.json();console.log("\uD83D\uDD0D SearchModal - Agents result:",e),e.success&&Array.isArray(e.data)?(f(e.data),console.log("✅ Found agents:",e.data.length)):(console.log("❌ Agents failed or no data:",e),f([]))}catch(e){console.error("Failed to parse agents result:",e),f([])}else console.error("Agents search failed:",s[2].reason),f([]);b(-1)}catch(e){console.error("Search failed:",e),u([]),h([]),f([])}finally{y(!1),k(!1)}},150);return()=>clearTimeout(e)},[d]);let C=e=>{S.push("/omrader/".concat(e.Slug)),a(),o(""),k(!1)},E=e=>{S.push("/avdeling/".concat(e.Slug)),a(),o(""),k(!1)},M=e=>{S.push("/meglere/".concat(e.Slug)),a(),o(""),k(!1)};return s||j?(0,r.jsx)("div",{className:"fixed inset-0 z-50 overflow-y-auto transition-opacity duration-300 ".concat(s?"opacity-100":"opacity-0 pointer-events-none"),onClick:a,children:(0,r.jsxs)("div",{className:"flex min-h-full items-start justify-center p-4 text-center sm:p-0",children:[(0,r.jsx)("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm transition-all duration-300"}),(0,r.jsxs)("div",{className:"relative w-full max-w-lg transform overflow-hidden rounded-xl bg-white/95 backdrop-blur-md shadow-2xl border border-white/20 transition-all duration-300 sm:my-8 ".concat(s?"scale-100 translate-y-0 opacity-100":"scale-95 translate-y-4 opacity-0"),onClick:e=>e.stopPropagation(),children:[(0,r.jsxs)("div",{className:"flex items-center justify-between p-4 border-b border-white/20 bg-white/10 backdrop-blur-sm",children:[(0,r.jsx)("h3",{className:"text-lg font-medium text-gray-900",children:"Finn eiendomsmegler"}),(0,r.jsx)("button",{onClick:a,className:"rounded-full p-2 text-gray-400 hover:text-gray-600 hover:bg-white/20 transition-all duration-200 cursor-pointer",children:(0,r.jsx)(l.A,{className:"h-5 w-5"})})]}),(0,r.jsxs)("div",{className:"p-4 bg-white/5",children:[(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:(0,r.jsx)(i.A,{className:"h-5 w-5 text-gray-400"})}),(0,r.jsx)("input",{ref:A,type:"text",value:d,onChange:e=>o(e.target.value),onKeyDown:e=>{"Escape"===e.key?a():"ArrowDown"===e.key?(e.preventDefault(),d.trim().length>=2&&Array.isArray(m)&&m.length>0&&b(e=>Math.min(e+1,m.length-1))):"ArrowUp"===e.key?(e.preventDefault(),d.trim().length>=2&&Array.isArray(m)&&m.length>0&&b(e=>Math.max(e-1,-1))):"Enter"===e.key&&v>=0&&d.trim().length>=2&&Array.isArray(m)&&m[v]&&(e.preventDefault(),C(m[v]))},placeholder:"S\xf8k etter omr\xe5de...",className:"block w-full pl-10 pr-3 py-3 border border-white/30 rounded-xl leading-5 bg-white/80 backdrop-blur-sm text-gray-900 placeholder-gray-500 focus:outline-none focus:ring-2 focus:ring-blue-500/50 focus:border-blue-500/50 focus:bg-white/90 transition-all duration-200 sm:text-sm shadow-sm"})]}),d.trim().length<2&&(0,r.jsx)("div",{className:"mt-3 flex flex-wrap gap-2",children:c.map(e=>(0,r.jsx)("button",{onClick:()=>C(e),className:"inline-flex items-center px-3 py-1.5 rounded-full text-xs font-medium bg-blue-100/80 text-blue-700 hover:bg-blue-200/80 transition-all duration-200 backdrop-blur-sm border border-blue-200/50 cursor-pointer",children:e.Name},e.id))})]}),(0,r.jsxs)("div",{className:"max-h-96 overflow-y-auto",children:[w&&p&&(0,r.jsxs)("div",{className:"py-2",children:[(0,r.jsxs)("div",{className:"mb-4",children:[(0,r.jsx)("div",{className:"px-4 py-2 text-xs font-semibold text-gray-500 uppercase tracking-wider bg-gray-50/50",children:"Omr\xe5der"}),[1,2,3].map(e=>(0,r.jsx)("div",{className:"px-4 py-3 animate-pulse",children:(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-8 h-8 rounded-full bg-gray-200"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("div",{className:"h-4 bg-gray-200 rounded w-24 mb-1"}),(0,r.jsx)("div",{className:"h-3 bg-gray-200 rounded w-16"})]})]})},"area-skeleton-".concat(e)))]}),(0,r.jsxs)("div",{className:"mb-4",children:[(0,r.jsx)("div",{className:"px-4 py-2 text-xs font-semibold text-gray-500 uppercase tracking-wider bg-gray-50/50",children:"Meglerfirmaer"}),[1,2].map(e=>(0,r.jsx)("div",{className:"px-4 py-3 animate-pulse",children:(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-8 h-8 rounded-lg bg-gray-200"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("div",{className:"h-4 bg-gray-200 rounded w-32 mb-1"}),(0,r.jsx)("div",{className:"h-3 bg-gray-200 rounded w-24"})]})]})},"office-skeleton-".concat(e)))]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"px-4 py-2 text-xs font-semibold text-gray-500 uppercase tracking-wider bg-gray-50/50",children:"Eiendomsmeglere"}),[1,2,3].map(e=>(0,r.jsx)("div",{className:"px-4 py-3 animate-pulse",children:(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-8 h-8 rounded-full bg-gray-200"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("div",{className:"h-4 bg-gray-200 rounded w-28 mb-1"}),(0,r.jsx)("div",{className:"h-3 bg-gray-200 rounded w-20"})]})]})},"agent-skeleton-".concat(e)))]})]}),!p&&d.trim().length>=2&&(!Array.isArray(m)||0===m.length)&&(!Array.isArray(x)||0===x.length)&&(!Array.isArray(g)||0===g.length)&&(0,r.jsx)("div",{className:"p-4 text-center",children:(0,r.jsx)("p",{className:"text-sm text-gray-500",children:"Ingen resultater funnet"})}),!p&&d.trim().length>=2&&(Array.isArray(m)&&m.length>0||Array.isArray(x)&&x.length>0||Array.isArray(g)&&g.length>0)&&(0,r.jsxs)("div",{className:"py-2",children:[Array.isArray(m)&&m.length>0&&(0,r.jsxs)("div",{className:"mb-4",children:[(0,r.jsx)("div",{className:"px-4 py-2 text-xs font-semibold text-gray-500 uppercase tracking-wider bg-gray-50/50",children:"Omr\xe5der"}),m.map(e=>(0,r.jsx)("button",{onClick:()=>C(e),className:"w-full text-left px-4 py-3 hover:bg-white/40 transition-all duration-200 cursor-pointer",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-8 h-8 rounded-full bg-blue-100 flex items-center justify-center",children:(0,r.jsx)("svg",{className:"w-4 h-4 text-blue-600",fill:"currentColor",viewBox:"0 0 20 20",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M5.05 4.05a7 7 0 119.9 9.9L10 18.9l-4.95-4.95a7 7 0 010-9.9zM10 11a2 2 0 100-4 2 2 0 000 4z",clipRule:"evenodd"})})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium text-gray-900",children:e.Name}),(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"Omr\xe5de"})]})]}),(0,r.jsx)("div",{className:"text-xs text-blue-600 font-medium",children:"Se meglere →"})]})},"city-".concat(e.id)))]}),Array.isArray(x)&&x.length>0&&(0,r.jsxs)("div",{className:"mb-4",children:[(0,r.jsx)("div",{className:"px-4 py-2 text-xs font-semibold text-gray-500 uppercase tracking-wider bg-gray-50/50",children:"Meglerfirmaer"}),x.map(e=>(0,r.jsx)("button",{onClick:()=>E(e),className:"w-full text-left px-4 py-3 hover:bg-white/40 transition-all duration-200 cursor-pointer",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-8 h-8 rounded-lg overflow-hidden bg-gray-100 flex items-center justify-center",children:e.Logo?(0,r.jsx)("img",{src:e.Logo,alt:e.Name,className:"w-full h-full object-contain"}):(0,r.jsx)("svg",{className:"w-4 h-4 text-gray-400",fill:"currentColor",viewBox:"0 0 20 20",children:(0,r.jsx)("path",{d:"M4 4a2 2 0 00-2 2v8a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2H4zm0 2h12v8H4V6z"})})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium text-gray-900",children:e.Name}),(0,r.jsxs)("p",{className:"text-xs text-gray-500",children:[e.Firmanavn," • ",e.agentCount," meglere"]})]})]}),(0,r.jsx)("div",{className:"text-xs text-blue-600 font-medium",children:"Se kontor →"})]})},"office-".concat(e.id)))]}),Array.isArray(g)&&g.length>0&&(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"px-4 py-2 text-xs font-semibold text-gray-500 uppercase tracking-wider bg-gray-50/50",children:"Eiendomsmeglere"}),g.map(e=>{var s;return(0,r.jsx)("button",{onClick:()=>M(e),className:"w-full text-left px-4 py-3 hover:bg-white/40 transition-all duration-200 cursor-pointer",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-8 h-8 rounded-full overflow-hidden bg-blue-100 flex items-center justify-center",children:e.Profilbilde?(0,r.jsx)("img",{src:e.Profilbilde,alt:e.Name,className:"w-full h-full object-cover",onError:e=>{let s=e.target;s.style.display="none";let a=s.parentElement;a&&(a.innerHTML='\n                                        <svg class="w-4 h-4 text-blue-600" fill="currentColor" viewBox="0 0 20 20">\n                                          <path fill-rule="evenodd" d="M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z" clip-rule="evenodd"/>\n                                        </svg>\n                                      ')}}):(0,r.jsx)("svg",{className:"w-4 h-4 text-blue-600",fill:"currentColor",viewBox:"0 0 20 20",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z",clipRule:"evenodd"})})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium text-gray-900",children:e.Name}),(0,r.jsx)("p",{className:"text-xs text-gray-500",children:(null==(s=e.office)?void 0:s.Name)||"Eiendomsmegler"})]})]}),(0,r.jsx)("div",{className:"text-xs text-blue-600 font-medium",children:"Se profil →"})]})},"agent-".concat(e.id))})]})]})]})]})]})}):null}}}]);

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.