1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4639],{25115:function(e,t,r){"use strict";var s=r(60930),n=r(67294),a=r(14357),i=r(35654),l=r(86056),o=r(87126),c=r(76626),d=r(52747),u=r(73716),p=r(85893);let h=["as","onSelect","activeKey","role","onKeyDown"],noop=()=>{},m=(0,d.PB)("event-key"),f=n.forwardRef((e,t)=>{let r,u,{as:f="div",onSelect:g,activeKey:x,role:y,onKeyDown:v}=e,b=function(e,t){if(null==e)return{};var r,s,n={},a=Object.keys(e);for(s=0;s<a.length;s++)r=a[s],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,h),w=(0,a.Z)(),j=(0,n.useRef)(!1),_=(0,n.useContext)(o.Z),N=(0,n.useContext)(c.Z);N&&(y=y||"tablist",x=N.activeKey,r=N.getControlledId,u=N.getControllerId);let k=(0,n.useRef)(null),getNextActiveTab=e=>{let t=k.current;if(!t)return null;let r=(0,s.Z)(t,`[${m}]:not([aria-disabled=true])`),n=t.querySelector("[aria-selected=true]");if(!n||n!==document.activeElement)return null;let a=r.indexOf(n);if(-1===a)return null;let i=a+e;return i>=r.length&&(i=0),i<0&&(i=r.length-1),r[i]},handleSelect=(e,t)=>{null!=e&&(null==g||g(e,t),null==_||_(e,t))};(0,n.useEffect)(()=>{if(k.current&&j.current){let e=k.current.querySelector(`[${m}][aria-selected=true]`);null==e||e.focus()}j.current=!1});let C=(0,i.Z)(t,k);return(0,p.jsx)(o.Z.Provider,{value:handleSelect,children:(0,p.jsx)(l.Z.Provider,{value:{role:y,activeKey:(0,o.h)(x),getControlledId:r||noop,getControllerId:u||noop},children:(0,p.jsx)(f,Object.assign({},b,{onKeyDown:e=>{let t;if(null==v||v(e),N){switch(e.key){case"ArrowLeft":case"ArrowUp":t=getNextActiveTab(-1);break;case"ArrowRight":case"ArrowDown":t=getNextActiveTab(1);break;default:return}t&&(e.preventDefault(),handleSelect(t.dataset[(0,d.$F)("EventKey")]||null,e),j.current=!0,w())}},ref:C,role:y}))})})});f.displayName="Nav",t.Z=Object.assign(f,{Item:u.Z})},73716:function(e,t,r){"use strict";r.d(t,{v:function(){return useNavItem}});var s=r(67294),n=r(78146),a=r(86056),i=r(87126),l=r(70861),o=r(52747),c=r(76626),d=r(85893);let u=["as","active","eventKey"];function useNavItem({key:e,onClick:t,active:r,id:l,role:d,disabled:u}){let p=(0,s.useContext)(i.Z),h=(0,s.useContext)(a.Z),m=(0,s.useContext)(c.Z),f=r,g={role:d};if(h){d||"tablist"!==h.role||(g.role="tab");let t=h.getControllerId(null!=e?e:null),s=h.getControlledId(null!=e?e:null);g[(0,o.PB)("event-key")]=e,g.id=t||l,((f=null==r&&null!=e?h.activeKey===e:r)||!(null!=m&&m.unmountOnExit)&&!(null!=m&&m.mountOnEnter))&&(g["aria-controls"]=s)}return"tab"===g.role&&(g["aria-selected"]=f,f||(g.tabIndex=-1),u&&(g.tabIndex=-1,g["aria-disabled"]=!0)),g.onClick=(0,n.Z)(r=>{u||(null==t||t(r),null!=e&&p&&!r.isPropagationStopped()&&p(e,r))}),[g,{isActive:f}]}let p=s.forwardRef((e,t)=>{let{as:r=l.ZP,active:s,eventKey:n}=e,a=function(e,t){if(null==e)return{};var r,s,n={},a=Object.keys(e);for(s=0;s<a.length;s++)r=a[s],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,u),[c,p]=useNavItem(Object.assign({key:(0,i.h)(n,a.href),active:s},a));return c[(0,o.PB)("active")]=p.isActive,(0,d.jsx)(r,Object.assign({},a,c,{ref:t}))});p.displayName="NavItem",t.Z=p},76626:function(e,t,r){"use strict";var s=r(67294);let n=s.createContext(null);t.Z=n},83375:function(e,t,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/produsenter/[producer]",function(){return r(2597)}])},89498:function(e,t,r){"use strict";var s=r(94137),n=r(94534),a=r(54450),i=r(68873),l=r(70251);t.Z=new class{async getSelfAuditsByProducerID(e,t){try{var r;let s="producers/".concat(e,"/audit/self");t&&(s+=(0,l.XF)(t));let a=await (0,n.C)(s);return null===(r=a.result)||void 0===r?void 0:r.data}catch(e){console.log(e)}}async getAuditRequests(e){try{var t;let r=await (0,n.C)("producers/".concat(e,"/audit/request"));return null===(t=r.result)||void 0===t?void 0:t.data}catch(e){console.log(e)}}async requestViewProducerAudit(e){try{let t=await (0,i.t)("producers/".concat(e,"/audit/request"),{});return t}catch(e){console.log(e)}}async setApproveAuditRequest(e,t){try{return await (0,s.A)("producers/".concat(e,"/audit/request"),{requestAuditID:t})}catch(e){console.log(e)}}async setRejectAuditRequest(e,t){try{return await (0,a.w)("producers/".concat(e,"/audit/request/").concat(t))}catch(e){console.log(e)}}async createAuditRequest(e,t,r){try{var s;let n=await (0,i.t)("producers/".concat(e,"/audit/request"),{auditId:t,requestedBy:r});return null===(s=n.result)||void 0===s?void 0:s.data}catch(e){console.log(e)}}async getLatestAuditRequest(e){try{let t=await (0,n.C)("producers/".concat(e,"/audit/request/latest-of-purchaser"));return t.result}catch(e){console.log(e)}}}},17363:function(e,t,r){"use strict";var s=r(94137),n=r(70251),a=r(94534);t.Z=new class{async getPurchasers(e,t){let r=this.prefix;e&&(r+=(0,n.XF)(e));try{var s;let e=await (0,a.C)(r);if(t)return e.result;return(null===(s=e.result)||void 0===s?void 0:s.data)||[]}catch(e){return console.log(e),[]}}async getPurchaserByID(e){try{let t=await (0,a.C)("/purchasers/".concat(e,"?d=true"));return t.result}catch(e){console.log(e)}}async updatePurchaser(e,t){try{let r=await (0,s.A)("/purchasers/".concat(e),t);return r}catch(e){console.log(e)}}async getUsersByPurchaser(e){try{let t=await (0,a.C)("/purchasers/".concat(e,"/users?size=12&page=1"));return t.result}catch(e){console.log(e)}}constructor(){this.prefix="purchasers"}}},40129:function(e,t,r){"use strict";r.d(t,{Z:function(){return u}});var s=r(85893),n=r(37054),a=r(67294),i=r(67175),l=r(41664),o=r.n(l),LokalmatGoogleMap_CustomInfoBox=e=>{let{position:t,title:r,imageSrc:a,slug:l,onClose:c}=e;return(0,s.jsx)(n.vD,{position:t,options:{closeBoxURL:"",enableEventPropagation:!0},children:(0,s.jsxs)("div",{className:"d-flex flex-column rounded-1 text-center",style:{width:"96px",backgroundColor:"#5E5E5E",overflow:"hidden"},children:[(0,s.jsx)("button",{type:"button",className:"btn-close position-absolute","aria-label":"Close",style:{to
1p:5,right:5},onClick:c}),a&&(0,s.jsx)(i.Z,{className:"img-fluid w-100 m-0",srcImage:a,altImage:"thumbnail"}),(0,s.jsx)(o(),{href:"/produsenter/".concat(l),style:{fontSize:"14px",fontWeight:400,color:"#FFF",padding:"8px"},title:"G\xe5 til produsentens profil",children:r})]})})},c=r(43599),d=r(9473),u=a.memo(function(e){var t,r;let i=(0,d.v9)(c.aB),l=i&&i.custom_fields?i.custom_fields.find(e=>"google_map_key"===e.key):null,o=l&&l.value,{isLoaded:u}=(0,n.Ji)({id:"google-map-script",googleMapsApiKey:null!=o?o:"AIzaSyBfMEc2KFuNiGldmBqwTyEY1WGnLbIX8l4"}),[p,h]=(0,a.useState)("/assets/images/map_point.png"),[m,f]=(0,a.useState)(""),[g,x]=(0,a.useState)(),[y,v]=(0,a.useState)(null),[b]=(0,a.useState)(e.zoom||4),[w,j]=(0,a.useState)(e.centerPoint||{lat:65.5,lng:16}),_={width:null!==(t=e.width)&&void 0!==t?t:"100%",height:null!==(r=e.height)&&void 0!==r?r:"400px"},handleHoverMarker=e=>{f(e.name),x(new google.maps.LatLng(e.lat,e.lng))},handleCloseMarker=()=>{f(""),x(null)};(0,a.useEffect)(()=>{if(!y)return;if(e.markersList.length<=1){y.setZoom(b);return}let t=new google.maps.LatLngBounds;e.markersList.forEach(e=>{let{lat:r,lng:s}=e;t.extend(new google.maps.LatLng(r,s))}),y.fitBounds(t)},[e.markersList]),(0,a.useEffect)(()=>{e.centerPoint&&j(e.centerPoint)},[e.centerPoint]);let N=a.useCallback(function(e){let t=new window.google.maps.LatLngBounds(w);e.fitBounds(t),google.maps.event.addListener(e,"zoom_changed",function(){e.getZoom()>4?h("/assets/images/map_point.png"):h("/assets/images/map_point_sm.png")}),v(e)},[e]);return u?(0,s.jsx)(n.b6,{mapContainerStyle:_,center:w,zoom:b,options:e.darkMode?{styles:[{elementType:"geometry",stylers:[{color:"#777777"}]},{elementType:"labels.icon",stylers:[{visibility:"off"}]},{elementType:"labels.text.fill",stylers:[{color:"#757575"}]},{elementType:"labels.text.stroke",stylers:[{color:"#777777"}]},{featureType:"administrative",elementType:"geometry",stylers:[{color:"#757575"}]},{featureType:"administrative.country",elementType:"labels.text.fill",stylers:[{color:"#9e9e9e"}]},{featureType:"administrative.land_parcel",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"administrative.locality",elementType:"labels.text.fill",stylers:[{color:"#bdbdbd"}]},{featureType:"poi",elementType:"labels.text",stylers:[{visibility:"off"}]},{featureType:"poi",elementType:"labels.text.fill",stylers:[{color:"#757575"}]},{featureType:"poi.park",elementType:"geometry",stylers:[{color:"#555555"}]},{featureType:"poi.park",elementType:"labels.text.fill",stylers:[{color:"#616161"}]},{featureType:"poi.park",elementType:"labels.text.stroke",stylers:[{color:"#1b1b1b"}]},{featureType:"road",elementType:"geometry.fill",stylers:[{color:"#2c2c2c"}]},{featureType:"road",elementType:"labels.text.fill",stylers:[{color:"#8a8a8a"}]},{featureType:"road.arterial",stylers:[{visibility:"off"}]},{featureType:"road.arterial",elementType:"geometry",stylers:[{color:"#373737"}]},{featureType:"road.highway",elementType:"geometry",stylers:[{color:"#cfcfcf"}]},{featureType:"road.highway",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"road.highway.controlled_access",elementType:"geometry",stylers:[{color:"#a5a5a5"}]},{featureType:"road.local",stylers:[{visibility:"off"}]},{featureType:"road.local",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"road.local",elementType:"labels.text.fill",stylers:[{color:"#616161"}]},{featureType:"transit",elementType:"labels.text.fill",stylers:[{color:"#757575"}]},{featureType:"water",elementType:"geometry",stylers:[{color:"#555555"}]},{featureType:"water",elementType:"labels.text.fill",stylers:[{color:"#3d3d3d"}]}]}:{},onClick:t=>{e.onClick&&e.onClick(t)},onLoad:N,children:e.markersList&&e.markersList.map((t,r)=>{var a,i;return(0,s.jsxs)("div",{children:[t.name&&m===t.name&&(0,s.jsx)(LokalmatGoogleMap_CustomInfoBox,{position:g,title:t.name,imageSrc:t.imageSrc,onClose:handleCloseMarker,slug:null!==(a=t.slug)&&void 0!==a?a:"#"}),(0,s.jsx)(n.Jx,{icon:e.defaultIcon?"":p,position:{lat:Number(t.lat),lng:Number(t.lng)},onMouseOver:()=>handleHoverMarker(t),title:null!==(i=t.name)&&void 0!==i?i:void 0})]},r)})}):(0,s.jsx)(s.Fragment,{})})},26242:function(e,t,r){"use strict";var s,n,a,i,l;r.d(t,{OB:function(){return a},bn:function(){return s}}),(i=s||(s={})).New="new",i.Approved="approved",i.Expired="expired",(n||(n={})).NotCompleted="not completed",(l=a||(a={})).New="new",l.Approved="approved",l.Rejected="rejected"},2597:function(e,t,r){"use strict";r.r(t),r.d(t,{__N_SSP:function(){return Q},default:function(){return _producer_}});var s=r(85893),n=r(3420),a=r(73),i=r(80258),l=r(70493),o=r(49883),c=r(86759),d=r(87378),u=r(68506),p=r(1937),h=r(67294),m=r(74658),f=r(41664),g=r.n(f),producer_details_LeftContent=e=>{let{data:t,userSelector:r}=e,[n,a]=(0,h.useState)(!1),[i,l]=(0,h.useState)(!1),onFollowProducer=async()=>{a(!0);let e=await m.Z.followProducer(t.id);e&&isFollowingProducer(t.id),a(!1)},onUnFollowProducer=async()=>{a(!0);let e=await m.Z.unfollowProducer(t.id);200===e.status&&isFollowingProducer(t.id),a(!1)},isFollowingProducer=async e=>{if(!r||!r.user||!r.user.userTypeID)return;let t=await m.Z.getProducersFollowing(r.user.userTypeID);if(t){let r=t.filter(t=>t.id===e);if(r.length&&r[0].id===e)return l(!0)}l(!1)};return(0,h.useEffect)(()=>{isFollowingProducer(t.id)},[]),(0,s.jsxs)("div",{className:"col-md-7 mb-4",children:[(0,s.jsx)("h1",{className:"display-4",children:t.displayName}),(0,s.jsx)("p",{className:"mb-5",children:t.county&&t.county.name?t.county.name:""}),(0,s.jsx)("h2",{className:"h3 fw-normal mb-5 mt-3",children:t.shortDe
1scription}),(0,s.jsx)("p",{className:"mb-5",children:t.longDescription}),(0,s.jsx)("div",{className:"d-flex gap-2 flex-wrap",children:t.categoriesData&&t.categoriesData.filter(e=>1===e.attributes.level).map((e,t)=>{let{id:r,attributes:n}=e;return(0,s.jsxs)(g(),{className:"badge rounded-pill color-p2 bg-p3 py-2 px-3 mb-3 text-decoration-hover",href:"".concat("/soek?cat=".concat(r)),children:["#",null==n?void 0:n.name]},t)})}),r&&(0,p.Ge)(r.user)&&(0,s.jsx)(s.Fragment,{children:i?(0,s.jsxs)("button",{className:"btn yellow-btn p-1 px-2 d-flex align-items-center gap-1",onClick:onUnFollowProducer,children:[(0,s.jsx)("span",{className:"material-icons-outlined",children:"motion_photos_off"}),"F\xf8lger produsent"]}):(0,s.jsxs)("button",{className:"btn yellow-btn p-1 pe-2 d-flex align-items-center gap-1",onClick:onFollowProducer,children:[(0,s.jsx)("span",{className:"material-icons",children:"add"}),"F\xf8lg produsent"]})}),(0,s.jsx)(c.Z,{open:n,setHide:()=>a(!1)})]})},x=r(89498),y=r(17363),v=r(10014),b=r(67175),w=r(40129),j=r(26242),_=r(63040),N=r(52686),k=r(16518),C=r(93967),P=r.n(C);r(42473);var I=r(15446),S=r(25115),T=r(76792),A=r(78146),L=r(73716),R=r(87126);let E=h.forwardRef(({bsPrefix:e,active:t,disabled:r,eventKey:n,className:a,variant:i,action:l,as:o,...c},d)=>{e=(0,T.vE)(e,"list-group-item");let[u,p]=(0,L.v)({key:(0,R.h)(n,c.href),active:t,...c}),h=(0,A.Z)(e=>{if(r){e.preventDefault(),e.stopPropagation();return}u.onClick(e)});r&&void 0===c.tabIndex&&(c.tabIndex=-1,c["aria-disabled"]=!0);let m=o||(l?c.href?"a":"button":"div");return(0,s.jsx)(m,{ref:d,...c,...u,onClick:h,className:P()(a,e,p.isActive&&"active",r&&"disabled",i&&`${e}-${i}`,l&&`${e}-action`)})});E.displayName="ListGroupItem";let O=h.forwardRef((e,t)=>{let r;let{className:n,bsPrefix:a,variant:i,horizontal:l,numbered:o,as:c="div",...d}=(0,I.Ch)(e,{activeKey:"onSelect"}),u=(0,T.vE)(a,"list-group");return l&&(r=!0===l?"horizontal":`horizontal-${l}`),(0,s.jsx)(S.Z,{ref:t,...d,as:c,className:P()(n,u,i&&`${u}-${i}`,r&&`${u}-${r}`,o&&`${u}-numbered`)})});O.displayName="ListGroup";var D=Object.assign(O,{Item:E}),Z=r(22920),F=r(68710),z=r.n(F),B=r(80438),q=r(57962),H=r(42298),U=r(7574),M=r(41866),producer_details_RightContent=e=>{var t,r,n,a,i,l,o;let{data:d,userSelector:u,isAdmin:m}=e,[f,C]=(0,h.useState)(!1),[P,I]=(0,h.useState)(!1),[S,T]=(0,h.useState)(!1),[A,L]=(0,h.useState)([]),[R,E]=(0,h.useState)(!1),[O,F]=(0,h.useState)(!0),[V,G]=(0,h.useState)(!1),{notify_error:K,notify_success:W}=B,[$,X]=(0,h.useState)(!1),[Y,J]=(0,h.useState)(),getPurchaserInfo=async()=>{if(!u||!(0,p.Ge)(u.user)||!u.user.userTypeID)return;let e=await y.Z.getPurchaserByID(u.user.userTypeID);e&&e.viewExternalAudits&&E(!0)},getAuditsRevisions=async()=>{I(!0);let e=await x.Z.getSelfAuditsByProducerID(d.id,{size:5});I(!1),e&&(L(e),e.length>0&&e.every(e=>e.status===j.bn.Expired)&&G(!0))},getLatestRequest=async()=>{if(!d.id)return;I(!0);let e=await x.Z.getLatestAuditRequest(d.id);if(I(!1),e){if([j.OB.Approved].includes(e.status))return T(!0);[j.OB.New].includes(e.status)&&F(!1)}},onRequestAuditAccess=async e=>{var t,r;if(!e)return;I(!0);let s=await x.Z.requestViewProducerAudit(e);if(I(!1),200===s.status)return F(!1),Z.Am.success("".concat(W.request_audit_access_success));let n=null==s?void 0:null===(r=s.response)||void 0===r?void 0:null===(t=r.data)||void 0===t?void 0:t.errorCode,a=Y&&Y[n]?Y[n]:"".concat(K.request_audit_access_error);return Z.Am.error(a)},getNamespaces=async()=>{let e=await U.Z.getNameSpace("error-message");e&&J(e)};return(0,h.useEffect)(()=>{getNamespaces()},[]),(0,h.useEffect)(()=>{S&&getAuditsRevisions()},[S]),(0,h.useEffect)(()=>{if(u){if(m||u.user.userTypeID===d.id)return E(!0),T(!0);getPurchaserInfo(),getLatestRequest()}},[u]),(0,s.jsxs)("aside",{className:"col-md-5 mt-5",children:[(0,s.jsxs)("ul",{className:"inline-list d-flex p-0 m-share element-sharing justify-content-md-end",children:[d.facebook&&(0,s.jsx)("li",{className:"list-inline-item",children:(0,s.jsx)(g(),{href:"https://www.facebook.com/sharer/sharer.php?u=".concat(window.location.href),className:"text-secondary facebook",target:"_new",children:(0,s.jsx)("span",{className:"material-icons",children:"facebook"})})}),(0,s.jsx)("li",{className:"list-inline-item",children:(0,s.jsx)(g(),{onClick:()=>window.print(),href:"#",className:" text-secondary info ghost print",children:(0,s.jsx)("span",{className:"material-icons-outlined",children:"print"})})}),(0,s.jsx)("li",{className:"list-inline-item",children:(0,s.jsx)("button",{style:{border:"none",backgroundColor:"inherit"},onClick:()=>{X(e=>!e)},className:"text-secondary button square email info p-0",children:(0,s.jsx)("span",{className:"material-icons-outlined",children:"email"})})})]}),$&&(0,s.jsx)(v.Z,{pageTitle:"Lokalmat - ".concat(d.displayName)}),(0,s.jsx)("div",{className:"ms-md-5 ps-md-5",children:(0,s.jsxs)("div",{className:"mt-md-5 pt-md-2",children:[d.logo&&d.logo.url&&(0,s.jsx)(b.Z,{className:"img-fluid w-100",srcImage:d.logo.url,width:274,height:224,altImage:(0,M.po)(d.logo.name)||"localfood"}),R&&(0,s.jsx)(N.Z,{className:"p-0 mb-5",style:{fontSize:"14px"},children:(0,s.jsxs)(D,{variant:"flush",children:[(0,s.jsxs)(D.Item,{className:"d-flex justify-content-between",children:[(0,s.jsxs)("span",{"data-lastaudit":null==d?void 0:d.lastSelfAuditDate,className:"d-flex align-items-center gap-1",children:[(0,s.jsx)("span",{className:"material-icons-outlined ".concat(V?"blue-color":""),children:"check_circle"}),"Intern revisjon"]}),S?(0,s.jsx)("button",{className:"btn yellow-btn py-1 px-2 fw-normal",style:{fontSize:"14px"},onClick:()=>C(!f),children:f?"Lukk":"Vis"}):(0,s.jsx)("button",{className:"btn yellow-btn py-1 px-2 fw-normal",style:{fontSize:"14px"},onClick:()=>onRequestAuditAccess(d.id),disabled:!O,children:"Be om tilgang"})]}),(0,s.jsx)(k.Z,{in:f,children:(0,s.jsx)(D.Item,{children:A&&A.map((e,t)=>{var r;return(0,s.jsx)("div",{className:"mb-1",children:(0,s.jsx)(g(),{title:e.status,href:"".concat(null!==(r=(0,q.Bv)(e.pdfUrl))&&void 0!==r?r:"#"),target:"_blank",className:"text-decoration-underline mb-1",onClick:t=>{e.pdfUrl||t.preventDefault()},children:(0,H.default)(new Date(e.auditDate),"dd/MM/yyyy")})},t)})})}
1),d.lastExternalAuditData&&d.lastExternalAuditData.pdfLink&&(0,s.jsxs)(D.Item,{className:"d-flex justify-content-between",children:[(0,s.jsxs)("span",{className:"d-flex align-items-center gap-1",children:[(0,s.jsx)("span",{className:"material-icons-outlined",children:"check_circle"}),"Ekstern revisjon"]}),(0,s.jsx)(g(),{href:"".concat((0,q.Bv)(d.lastExternalAuditData.pdfLink)),target:"_blank",className:"btn yellow-btn py-1 px-2 fw-normal",style:{fontSize:"14px"},onClick:e=>{var t;(null===(t=d.lastExternalAuditData)||void 0===t?void 0:t.pdfLink)||e.preventDefault()},children:"\xc5pne"})]})]})}),(0,s.jsx)("hr",{}),(0,s.jsx)(w.Z,{darkMode:!0,defaultIcon:!0,markersList:[{lat:Number(d.latitude),lng:Number(d.longitude)}],centerPoint:{lat:Number(d.latitude),lng:Number(d.longitude)},zoom:9,height:"200px"}),d.organization?(0,s.jsxs)("div",{className:"mt-4",children:[(0,s.jsx)("div",{style:{fontWeight:600},children:"Firma adresse:"}),(0,s.jsx)("div",{children:(null===(r=d.organization.address)||void 0===r?void 0:null===(t=r.addresses)||void 0===t?void 0:t.length)>0&&(null===(n=d.organization.address)||void 0===n?void 0:n.addresses.join(", "))}),(0,s.jsxs)("div",{children:[(null===(a=d.organization.address)||void 0===a?void 0:a.postalCode)||""," ",(null===(i=d.organization.address)||void 0===i?void 0:i.postalPlace)||""]})]}):(0,s.jsx)(s.Fragment,{}),d.addressVisiting&&(null===(l=d.addressVisiting.addresses)||void 0===l?void 0:l.length)>0&&d.addressVisiting.postalCode&&d.addressVisiting.postalPlace?(0,s.jsxs)("div",{className:"p-0 pt-2 d-flex flex-column",children:[(0,s.jsx)("div",{style:{fontWeight:600},children:"Bes\xf8ksadresse:"}),(0,s.jsxs)("p",{className:"",children:[(0,s.jsx)("div",{children:(null===(o=d.addressVisiting.addresses)||void 0===o?void 0:o.length)>0&&d.addressVisiting.addresses.join(", ")}),(0,s.jsxs)("div",{children:[d.addressVisiting.postalCode||""," ",d.addressVisiting.postalPlace||""]})]})]}):(0,s.jsx)(s.Fragment,{}),d.salesChannels&&d.salesChannels.length>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("hr",{}),(0,s.jsx)("div",{className:"fw-bold mb-3",children:"Salgskanaler"})," ",(0,s.jsx)("ul",{className:"d-flex flex-column gap-2",children:d.salesChannels.map((e,t)=>(0,s.jsx)("li",{children:e?e.attributes.name:""},t))})]}),(0,s.jsx)("hr",{}),(0,s.jsxs)("ul",{className:"inline-list p-0 pt-2 mt-4 mb-4 d-flex flex-column gap-3",children:[d.telephone&&(0,s.jsxs)("li",{className:"list-inline-item d-flex align-items-center gap-3",children:[(0,s.jsx)("span",{className:"material-icons",children:"phone"}),(0,s.jsx)(g(),{className:"text-decoration-none",href:"tel:".concat(d.telephone),children:d.telephone})]}),(0,s.jsxs)("li",{className:"list-inline-item d-flex align-items-center gap-3",children:[(0,s.jsx)("span",{className:"material-icons-outlined",children:"mail"}),(0,s.jsx)(g(),{className:"text-decoration-none",href:"mailto:".concat(d.email),children:d.email})]}),d.website&&(0,s.jsxs)("li",{className:"list-inline-item d-flex align-items-center gap-3",children:[(0,s.jsx)("span",{className:"material-icons-outlined",children:"link"}),(0,s.jsx)(g(),{className:"text-decoration-none",href:(0,q.B_)(d.website),target:"_new",children:"Bes\xf8k nettside"})]}),d.facebook&&(0,s.jsxs)("li",{className:"list-inline-item d-flex align-items-center gap-3",children:[(0,s.jsx)("span",{className:"material-icons",children:"facebook"}),(0,s.jsx)(g(),{href:(0,q.B_)(d.facebook),className:"text-decoration-none",target:"_new",children:"Facebook"})]})]}),(0,s.jsx)("hr",{}),d.foodOrganizations&&d.foodOrganizations.length>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:z().title,children:"Medlem av:"}),(0,s.jsx)("div",{className:"d-flex align-items-start gap-3 flex-wrap",children:d.foodOrganizations.map((e,t)=>{var r,n,a,i;let{attributes:l}=e;return(0,s.jsx)("div",{className:"d-flex flex-column gap-2",children:(0,s.jsx)(b.Z,{className:"img-fluid w-100",srcImage:l.logo?null===(r=(0,_.Z)(l.logo))||void 0===r?void 0:r.sizes.full:"",altImage:null===(i=l.logo)||void 0===i?void 0:null===(a=i.data)||void 0===a?void 0:null===(n=a.attributes)||void 0===n?void 0:n.alternativeText,width:60,style:{maxHeight:"60px"}})},t)})}),(0,s.jsx)("hr",{})]}),d.networks.length>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:z().title,children:"Er med i produsentnettverk"}),(0,s.jsx)("div",{className:"d-flex align-items-start flex-column",children:d.networks.map((e,t)=>{var r,n,a,i,l;let{slug:o,name:c}=e.attributes;return(0,s.jsx)(g(),{style:{maxWidth:"50%"},href:"/produsenter-liste/produsentnettverk/".concat(o),children:(null===(r=e.attributes.logo)||void 0===r?void 0:r.data)?(0,s.jsx)(b.Z,{className:"img-fluid w-100",srcImage:(null===(n=(0,_.Z)(e.attributes.logo))||void 0===n?void 0:n.sizes.full)||"",altImage:null===(l=e.attributes.logo)||void 0===l?void 0:null===(i=l.data)||void 0===i?void 0:null===(a=i.attributes)||void 0===a?void 0:a.alternativeText,style:{maxHeight:"110px"}}):(0,s.jsx)(s.Fragment,{children:c})},t)})})]})]})}),(0,s.jsx)(c.Z,{open:P,setHide:()=>I(!1)})]})},producer_details_ProducerDetailContent=e=>{let{producer:t,userSelector:r,isAdmin:n}=e,[a,i]=(0,h.useState)(1),[m,f]=(0,h.useState)(0),[g,x]=(0,h.useState)([]),[y,v]=(0,h.useState)([]),[b,w]=(0,h.useState)(!1),getProducts=async()=>{let e=await l.Z.getProducts({page:a-1,size:6,producerId:t.id,status:[u.Pt.Published],lokalmatStatus:(0,M.aW)()?[u.yk.Approved,u.yk.NotApproved]:[u.yk.Approved]},!0);if(e){let[t,r]=e;x(t),f(r)}},getFollowingProducts=async()=>
1{if(!r||!(0,p.Ge)(r.user)||!r.user.userTypeID)return;w(!0);let e=await l.Z.getProductsFollowing(r.user.userTypeID,{size:9999});e&&v(e),w(!1)},isFollowingProduct=e=>{if(!e)return!1;let t=y.filter(t=>t.id===e);return 0!==t.length},onFollowProduct=async e=>{if(!e)return;w(!0);let t=await l.Z.followProduct(e);200===t.status&&getFollowingProducts(),w(!1)},onUnFollowProduct=async e=>{if(!e)return;w(!0);let t=await l.Z.unFollowProduct(e);w(!1),200===t.status&&getFollowingProducts()};return(0,h.useEffect)(()=>{getProducts()},[a]),(0,s.jsxs)("div",{className:"row",children:[(0,s.jsx)(producer_details_LeftContent,{data:t,userSelector:r}),(0,s.jsx)(producer_details_RightContent,{data:t,userSelector:r,isAdmin:n}),(0,s.jsxs)("div",{className:"text-center",style:{fontSize:"32px",marginBottom:"32px",marginTop:"72px"},children:["Alle produkter fra ",t.displayName]}),g&&(0,s.jsxs)("div",{className:"row",children:[g.map((e,t)=>{let n=isFollowingProduct(e.id),a=n?u.DK.RemoveFollow:u.DK.AddFollow;return(0,s.jsx)(d.Z,{product:e,followBadgeType:(null==r?void 0:r.user)&&(0,p.Ge)(null==r?void 0:r.user)?a:void 0,followAction:a===u.DK.AddFollow?onFollowProduct:onUnFollowProduct},t)}),m>6&&(0,s.jsx)(o.Z,{numberOfPage:Math.ceil(m/6),handleChange:e=>{i(e)}})]}),(0,s.jsx)(c.Z,{open:b,setHide:()=>w(!1)})]})},V=r(74317),G=r(94346),K=r(1327),W=r(52638),$=r(33805),X=r(44539),Y=r(28700),J=r(9473),Q=!0,_producer_=e=>{let{producer:t}=e,[r,l]=(0,h.useState)(!0),o=(0,J.v9)(W.tH),c=t.thumbnail&&t.thumbnail.url?t.thumbnail.url:"",{common:d}=B,increaseView=async e=>{e&&await n.Z.increaseProducerView(e)};return(0,h.useEffect)(()=>{if(!(!o&&(0,Y.HV)("access_token"))){if((null==o?void 0:o.user)&&((0,p.Ge)(o.user)&&(0,X.b)({name:"producer",id:t.id,userId:null==o?void 0:o.user.userID},increaseView),(0,p.tY)(o.user)||(null==o?void 0:o.user.userTypeID)===t.id)||t.status===G.fI.Approved){l(!1);return}Z.Am.error("Produsent har ikke godkjent enda."),window.location.href="/"}},[o]),(0,s.jsx)($.o,{meta:(0,s.jsx)(K.h,{title:"Lokalmat - ".concat(t.displayName),description:"".concat(t.shortDescription," Lokalmat - Bransjeportalen for lokalmat for hele Norge - Stiftelsen Norsk Mat"),canonical:"".concat("https://www.lokalmat.no","/produsenter/").concat(t.slug),images:[{url:c,secureUrl:c}]}),children:r?(0,s.jsx)("div",{style:{minHeight:"80vh"},className:"justify-content-center align-items-center d-flex",children:(0,s.jsx)(i.Z,{})}):(0,s.jsxs)(s.Fragment,{children:[o&&(0,p.tY)(null==o?void 0:o.user)&&(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{className:"d-flex align-items-center justify-content-between gap-2 border-bottom p-2 mb-3",children:[(0,s.jsx)("div",{className:"fs-5 fw-bold",children:t.displayName}),(0,s.jsx)(g(),{href:"/admin-producer/company-profile?producerID=".concat(t.id),className:"btn btn-outline-primary",children:d.edit})]})}),(0,s.jsxs)("div",{id:"producer-".concat(t.id),className:"container",style:{color:"var(--text-color)"},children:[(0,s.jsxs)("div",{className:"breadcrumb d-flex align-items-center gap-2 mt-2",children:[(0,s.jsx)("span",{className:"material-icons-outlined d-flex align-items-center",style:{fontSize:"14px"},children:"arrow_back_ios_new"}),(0,s.jsx)(g(),{href:"/produsenter-liste",className:"small",children:"Alle produsenter"}),(0,s.jsx)("span",{className:"material-icons-outlined d-flex align-items-center",style:{fontSize:"14px"},children:"arrow_back_ios_new"}),(0,s.jsx)(g(),{className:"small text-decoration-none",href:"#",children:t.displayName})]}),t.companyPicturesData&&(0,s.jsx)(V.Z,{imageList:t.companyPicturesData&&t.companyPicturesData.length?t.companyPicturesData.map(e=>(0,M.r4)(e)):[],alt:t.displayName}),o&&(0,p.tY)(o.user)&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a.Z,{producerId:t.id}),t.organization&&t.organization.refID&&(0,s.jsxs)("div",{children:["Org Nr. ",(0,s.jsx)("strong",{children:t.organization.refID})]})]}),t&&(0,s.jsx)(producer_details_ProducerDetailContent,{isAdmin:o&&(0,p.tY)(o.user),userSelector:o,producer:t})]})]})})}},68710:function(e){e.exports={severalChoicesTitle:"Product_severalChoicesTitle__sXrNw",noImages:"Product_noImages__k0jWD",choicesWrapper:"Product_choicesWrapper__bzd0k",choice:"Product_choice__SPZNp",severals:"Product_several
1s__0garv",severalsButton:"Product_severalsButton__MN0nA",title:"Product_title__cIAXF",producerLink:"Product_producerLink__41hhB"}},34853:function(e,t,r){"use strict";r.d(t,{Z:function(){return m}});var s,n,a=r(67294),i=r(45697),l=r.n(i);function _extends(){return(_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e}).apply(this,arguments)}function _assertThisInitialized(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var o=function(e){function ReCAPTCHA(){var t;return(t=e.call(this)||this).handleExpired=t.handleExpired.bind(_assertThisInitialized(t)),t.handleErrored=t.handleErrored.bind(_assertThisInitialized(t)),t.handleChange=t.handleChange.bind(_assertThisInitialized(t)),t.handleRecaptchaRef=t.handleRecaptchaRef.bind(_assertThisInitialized(t)),t}ReCAPTCHA.prototype=Object.create(e.prototype),ReCAPTCHA.prototype.constructor=ReCAPTCHA,ReCAPTCHA.__proto__=e;var t=ReCAPTCHA.prototype;return t.getValue=function(){return this.props.grecaptcha&&void 0!==this._widgetId?this.props.grecaptcha.getResponse(this._widgetId):null},t.getWidgetId=function(){return this.props.grecaptcha&&void 0!==this._widgetId?this._widgetId:null},t.execute=function(){var e=this.props.grecaptcha;if(e&&void 0!==this._widgetId)return e.execute(this._widgetId);this._executeRequested=!0},t.executeAsync=function(){var e=this;return new Promise(function(t,r){e.executionResolve=t,e.executionReject=r,e.execute()})},t.reset=function(){this.props.grecaptcha&&void 0!==this._widgetId&&this.props.grecaptcha.reset(this._widgetId)},t.handleExpired=function(){this.props.onExpired?this.props.onExpired():this.handleChange(null)},t.handleErrored=function(){this.props.onErrored&&this.props.onErrored(),this.executionReject&&(this.executionReject(),delete this.executionResolve,delete this.executionReject)},t.handleChange=function(e){this.props.onChange&&this.props.onChange(e),this.executionResolve&&(this.executionResolve(e),delete this.executionReject,delete this.executionResolve)},t.explicitRender=function(){if(this.props.grecaptcha&&this.props.grecaptcha.render&&void 0===this._widgetId){var e=document.createElement("div");this._widgetId=this.props.grecaptcha.render(e,{sitekey:this.props.sitekey,callback:this.handleChange,theme:this.props.theme,type:this.props.type,tabindex:this.props.tabindex,"expired-callback":this.handleExpired,"error-callback":this.handleErrored,size:this.props.size,stoken:this.props.stoken,hl:this.props.hl,badge:this.props.badge}),this.captcha.appendChild(e)}this._executeRequested&&this.props.grecaptcha&&void 0!==this._widgetId&&(this._executeRequested=!1,this.execute())},t.componentDidMount=function(){this.explicitRender()},t.componentDidUpdate=function(){this.explicitRender()},t.componentWillUnmount=function(){void 0!==this._widgetId&&(this.delayOfCaptchaIframeRemoving(),this.reset())},t.delayOfCaptchaIframeRemoving=function(){var e=document.createElement("div");for(document.body.appendChild(e),e.style.display="none";this.captcha.firstChild;)e.appendChild(this.captcha.firstChild);setTimeout(function(){document.body.removeChild(e)},5e3)},t.handleRecaptchaRef=function(e){this.captcha=e},t.render=function(){var e=this.props,t=(e.sitekey,e.onChange,e.theme,e.type,e.tabindex,e.onExpired,e.onErrored,e.size,e.stoken,e.grecaptcha,e.badge,e.hl,function(e,t){if(null==e)return{};var r,s,n={},a=Object.keys(e);for(s=0;s<a.length;s++)t.indexOf(r=a[s])>=0||(n[r]=e[r]);return n}(e,["sitekey","onChange","theme","type","tabindex","onExpired","onErrored","size","stoken","grecaptcha","badge","hl"]));return a.createElement("div",_extends({},t,{ref:this.handleRecaptchaRef}))},ReCAPTCHA}(a.Component);o.displayName="ReCAPTCHA",o.propTypes={sitekey:l().string.isRequired,onChange:l().func,grecaptcha:l().object,theme:l().oneOf(["dark","light"]),type:l().oneOf(["image","audio"]),tabindex:l().number,onExpired:l().func,onErrored:l().func,size:l().oneOf(["compact","normal","invisible"]),stoken:l().string,hl:l().string,badge:l().oneOf(["bottomright","bottomleft","inline"])}
1,o.defaultProps={onChange:function(){},theme:"light",type:"image",tabindex:0,size:"normal",badge:"bottomright"};var c=r(8679),d=r.n(c);function async_script_loader_extends(){return(async_script_loader_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e}).apply(this,arguments)}var u={},p=0,h="onloadcallback",m=(s=function(){return"https://"+(("undefined"!=typeof window&&window.recaptchaOptions||{}).useRecaptchaNet?"recaptcha.net":"www.google.com")+"/recaptcha/api.js?onload="+h+"&render=explicit"},n=(n={callbackName:h,globalName:"grecaptcha"})||{},function(e){var t=e.displayName||e.name||"Component",r=function(t){function AsyncScriptLoader(e,r){var s;return(s=t.call(this,e,r)||this).state={},s.__scriptURL="",s}AsyncScriptLoader.prototype=Object.create(t.prototype),AsyncScriptLoader.prototype.constructor=AsyncScriptLoader,AsyncScriptLoader.__proto__=t;var r=AsyncScriptLoader.prototype;return r.asyncScriptLoaderGetScriptLoaderID=function(){return this.__scriptLoaderID||(this.__scriptLoaderID="async-script-loader-"+p++),this.__scriptLoaderID},r.setupScriptURL=function(){return this.__scriptURL=0?s:s(),this.__scriptURL},r.asyncScriptLoaderHandleLoad=function(e){var t=this;this.setState(e,function(){return t.props.asyncScriptOnLoad&&t.props.asyncScriptOnLoad(t.state)})},r.asyncScriptLoaderTriggerOnScriptLoaded=function(){var e=u[this.__scriptURL];if(!e||!e.loaded)throw Error("Script is not loaded.");for(var t in e.observers)e.observers[t](e);delete window[n.callbackName]},r.componentDidMount=function(){var e=this,t=this.setupScriptURL(),r=this.asyncScriptLoaderGetScriptLoaderID(),s=n,a=s.globalName,i=s.callbackName,l=s.scriptId;if(a&&void 0!==window[a]&&(u[t]={loaded:!0,observers:{}}),u[t]){var o=u[t];if(o&&(o.loaded||o.errored)){this.asyncScriptLoaderHandleLoad(o);return}o.observers[r]=function(t){return e.asyncScriptLoaderHandleLoad(t)};return}var c={};c[r]=function(t){return e.asyncScriptLoaderHandleLoad(t)},u[t]={loaded:!1,observers:c};var d=document.createElement("script");for(var p in d.src=t,d.async=!0,n.attributes)d.setAttribute(p,n.attributes[p]);l&&(d.id=l);var callObserverFuncAndRemoveObserver=function(e){if(u[t]){var r=u[t].observers;for(var s in r)e(r[s])&&delete r[s]}};i&&"undefined"!=typeof window&&(window[i]=function(){return e.asyncScriptLoaderTriggerOnScriptLoaded()}),d.onload=function(){var e=u[t];e&&(e.loaded=!0,callObserverFuncAndRemoveObserver(function(t){return!i&&(t(e),!0)}))},d.onerror=function(){var e=u[t];e&&(e.errored=!0,callObserverFuncAndRemoveObserver(function(t){return t(e),!0}))},document.body.appendChild(d)},r.componentWillUnmount=function(){var e=this.__scriptURL;if(!0===n.removeOnUnmount)for(var t=document.getElementsByTagName("script"),r=0;r<t.length;r+=1)t[r].src.indexOf(e)>-1&&t[r].parentNode&&t[r].parentNode.removeChild(t[r]);var s=u[e];s&&(delete s.observers[this.asyncScriptLoaderGetScriptLoaderID()],!0===n.removeOnUnmount&&delete u[e])},r.render=function(){var t=n.globalName,r=this.props,s=(r.asyncScriptOnLoad,r.forwardedRef),i=function(e,t){if(null==e)return{};var r,s,n={},a=Object.keys(e);for(s=0;s<a.length;s++)t.indexOf(r=a[s])>=0||(n[r]=e[r]);return n}(r,["asyncScriptOnLoad","forwardedRef"]);return t&&"undefined"!=typeof window&&(i[t]=void 0!==window[t]?window[t]:void 0),i.ref=s,(0,a.createElement)(e,i)},AsyncScriptLoader}(a.Component),i=(0,a.forwardRef)(function(e,t){return(0,a.createElement)(r,async_script_loader_extends({},e,{forwardedRef:t}))});return i.displayName="AsyncScriptLoader("+t+")",i.propTypes={asyncScriptOnLoad:l().func},d()(i,e)})(o)}},function(e){e.O(0,[1255,2632,2962,3185,1497,3752,1964,73,1348,9774,2888,179],function(){return e(e.s=83375)}),_N_E=e.O()}]);
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.