PageSourceSearch

https://www.environment.no/miljostatus/static/js/StandardMap.CJyJM_nr.js

js environment.no collected 2026-10-02 05:44:56 UTC 7,536 bytes, 1 lines download raw bytes

1import{M as b,F as k,c as M,G as F,j as a,H as $,L as I,m as T,u as _,r as m,t as P,g as h,S as R}from"./main.CyMC73VT.js";import{C as A}from"./Checkbox.BiA2BtCJ.js";const E="/",H="StandardMapBlock/GetAddresses?address=",g=e=>({type:F,payload:e}),D=e=>i=>{i({type:k,payload:!0}),M.get(`${E}${H}${e}`).then(r=>{if(r.status===200){const n=r.data;n.length>5&&(n.length=5),i(g(n))}else i(g([{address:"Noe gikk feil ved søk på sted...",extent:""}]))}).catch(r=>{throw i(g([{address:"Noe gikk feil ved søk på sted...",extent:""}])),r})},O=e=>i=>{i({type:b,payload:e})},W=e=>a.jsxs("div",{className:"c_map-search-field",role:"search","aria-label":`Søk i kart ${e.id}`,children:[a.jsxs("label",{htmlFor:`mapSearchField${e.id}`,children:[a.jsx("span",{id:`mapSearchFieldDescription${e.id}`,className:"u_visuallyhidden",children:e.translate.MapComponent.SearchForPlace}),a.jsx("input",{type:"text",placeholder:e.translate.MapComponent.SearchForPlace,className:"c_map-search-field__input",name:`mapSearchField${e.id}`,id:`mapSearchField${e.id}`,value:e.searchInputValue,onChange:i=>e.onInputChange(i.target.value),"aria-labelledby":`mapSearchFieldDescription${e.id}`}),a.jsx($,{title:"Søk på sted",className:"c_map-search-field__icon"})]}),(e.isLoading||e.showResultList)&&e.searchInputValue.length>0&&a.jsxs("div",{className:"c_map-search-field__result-wrapper",children:[e.resultList&&e.resultList.length>0&&e.showResultList&&!e.isLoading&&a.jsx("ul",{className:"c_map-search-field__result-list",children:e.resultList.map((i,r)=>r<=2?a.jsx("li",{className:"c_map-search-field__result-item",children:i.extent.length>0?a.jsx("button",{onClick:()=>e.onLocationClick(i),children:i.address}):a.jsx("span",{children:i.address})},i.extent):null)}),e.isLoading&&a.jsx(I,{})]})]}),V=e=>{const i=_(t=>t.app.language),r=_(t=>t.map.isLoading),[n,o]=m.useState({selectedLayers:e.model.mapSettings.selectedLayers,mapWidth:1150,mapHeight:670,showFilters:e.model.showFilterPanelOnLoad,showInteractionOverlay:!0,searchInputValue:"",miljoAtlasUrl:e.model.mapSettings.miljoAtlasUrl?e.model.mapSettings.miljoAtlasUrl:e.miljoAtlasUrl}),u=m.useRef(null),p=Math.floor(Math.random()*1e4)+1,l=P(i.name);m.useEffect(()=>{N();const t=u.current,s=(t==null?void 0:t.getElementsByTagName("input"))||[];e.showFilterPanelOnLoad?h({items:[...s],attr:"tabIndex",value:"0"}):h({items:[...s],attr:"tabIndex",value:"-1"})},[]),m.useEffect(()=>{const t=u.current,s=(t==null?void 0:t.getElementsByTagName("input"))||[];n.showFilters?h({items:[...s],attr:"tabIndex",value:"0"}):h({items:[...s],attr:"tabIndex",value:"-1"})},[n.showFilters]);const S=t=>{o({...n,searchInputValue:t});let s;t.length>0&&(s&&clearTimeout(s),s=setTimeout(()=>{e.fetchSearchResult(t)},300))},w=()=>{if(n.selectedLayers.length>0){let t="&layers=";for(const s of n.selectedLayers){const c=e.model.mapSettings.layers.find(d=>d.id.toString()===s.toString());t+=`${c==null?void 0:c.id}:${c==null?void 0:c.opacity};`}return t}return""},x=()=>e.mapPin&&e.mapPin.length>0?`&mappin=${e.mapPin}`:e.model.mapSettings.mapPin&&e.model.mapSettings.mapPin.length>0?`&mappin=${e.model.mapSettings.mapPin}`:e.initialMapPin&&e.initialMapPin.length>0?`&mappin=${e.initialMapPin}`:"",j=t=>{e.setLocation(t),o({...n,searchInputValue:""})},N=()=>{if(window.innerWidth<769){const t=window.innerWidth-20,s=t/.736;o({...n,mapWidth:t,mapHeight:s})}else o({...n,mapWidth:1150,mapHeight:670})},C=t=>{let s=[...n.selectedLayers];s.includes(t)?s=s.filter(c=>c!==t):s.push(t),o({...n,selectedLayers:s})},v=t=>{for(const s of n.selectedLayers)if(s===t)return!0;return!1},y=()=>{o({...n,showFilters:!n.showFilters})},f=()=>{let t=e.initialExtent;return e.model.mapSettings.extent&&e.model.mapSettings.extent.length>0&&(t=e.model.mapSettings.extent,t=`${t}${x()}`),e.extent&&e.extent.length>0&&(t=`${e.extent}${x()}`),`${n.miljoAtlasUrl}?lang=${i.name}&extent=${t}${w()}&basemap=KART&opacity=60&saturation=100`},L=()=>{const t=()=>e.model.mapDescription?"c_map-container__title":"u_visuallyhidden",s=()=>e.model.mapDescription?e.model.mapDescription:l.App.Map;switch(e.model.headingLevel){case"3":return a.jsx("h3",{className:t(),children:s()});case"4":return a.jsx("h4",{className:t(),children:s()});case"5":return a.jsx("h5",{className:t(),children:s()});default:return a.jsx("h2",{className:t(),children:s()})}};return a.jsxs("figure",{className:"c_map-container g_container g_container--full",children:[L(),a.jsxs("div",{className:"c_map",children:[e.model.mapSettings.layers&&e.model.mapSettings.layers.length>0&&a.jsxs("div",{className:`c_map-filter-wrapper ${n.showFilters?"c_map-filter-wrapper--expanded":"c_map-filter-wrapper--collapsed"}`,ref:u,children:[a.jsxs("div",{className:`c_map-filter-checkbox-wrapper ${n.showFilters?"c_map-filter-checkbox-wrapper--expanded":"c_map-filter-checkbox-wrapper--collapsed"}`,children:[a.jsx("h2",{className:"u_visuallyhidden",children:"Kart"}),a.jsx("div",{className:"g_col g_col--large-6",children:a.jsx(W,{searchInputValue:n.searchInputValue,onInputChange:S,resultList:e.searchResult,onLocationClick:j,isLoading:r,showResultList:e.showResultList||!1,id:p.toString(),translate:l})}),a.jsx("div",{className:"g_col g_col--large-6",children:a.jsxs("div",{className:"c_map-filter-checkbox-wrapper__checkbox-group",children:[a.jsxs("p",{className:"c_map-filter-checkbox-wrapper__filter-heading",children:[l.MapComponent.FilterTheMap,":"]}),e.model.mapSettings.layers.map(t=>{const d=`${t.layerName.replace(/[^\w\s]/gi,"o").replace(/\s+/g,"").toLowerCase()}${p}`;return a.jsxs("div",{"aria-label":t.layerName,children:[a.jsx("span",{className:"u_visuallyhidden",children:t.layerName}),t.isInteractive?a.jsx(A,{id:d,checked:v(t.id),labelText:t.layerName,onChange:()=>{C(t.id)}}):a.jsxs(a.Fragment,{children:[a.jsx("input",{id:d,name:d,style:{opacity:0,width:0,height:0,cursor:"default"},type:"checkbox",checked:!0,disabled:!0}),a.jsx("span",{className:`c_map-filter-checkbox-wrapper__text ${t.isInteractive?"":"c_map-filter-checkbox-wrapper__text--inactive"}`,children:t.layerName})]})]},`checkboxLabelKey__id${t.Id||t.id}_${p}`)})]})})]}),a.jsxs("button",{className:"c_map-filter-wrapper__toggle-button",onClick:()=>y(),"aria-expanded":n.showFilters,children:[a.jsx("span",{className:" c_map-filter-wrapper__toggle-button-text",children:n.showFilters?l.MapComponent.HideFilterMenu:l.MapComponent.ShowFilterMenu}),a.jsx(R,{title:n.showFilters?l.MapComponent.HideFilterMenu:l.MapComponent.ShowFilterMenu,"aria-hidden":"true"})]})]}),a.jsxs("div",{className:"c_map__frame-wrapper",children:[a.jsxs("iframe",{height:n.mapHeight,width:n.mapWidth,title:e.model.mapTitle||e.title,src:f(),tabIndex:n.showInteractionOverlay?-1:0,children:[a.jsx("p",{children:e.model.mapTitle||e.title}),a.jsxs("p",{children:[l.MapComponent.YourBrowserCantHandleFrames," -",a.jsx("a",{href:f(),target:"_new",children:l.MapComponent.ClickHereToOpenInteractiveMap})]})]}),n.showInteractionOverlay&&a.jsx("button",{className:"c_map__interaction-overlay",onClick:()=>
1o({...n,showInteractionOverlay:!1,showFilters:!1}),style:{width:n.showFilters?"80%":"100%"},children:a.jsxs("span",{children:[l.MapComponent.ClickToZoom1,a.jsx("br",{}),l.MapComponent.ClickToZoom2,a.jsx("br",{}),l.MapComponent.ClickToZoom3]})})]})]}),e.model.sourceReference&&a.jsx("figcaption",{className:"c_map__source-ref-text",children:e.model.sourceReference})]})},U=e=>({searchResult:e.map.searchResult,extent:e.map.extent,mapPin:e.map.mapPin,showResultList:e.map.showResultList}),K=T(U,{fetchSearchResult:D,setLocation:O})(V);export{K as default};

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.