!function(){"use strict";var e={};(function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})})(e);var t=window.wp.element,n=window.lodash,r=window.wp.plugins,o=window.nisje.core,a=window.nisje.settings,i=window.nisje.router,l=window.nisje.components;function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var s=window.nisje.views,u=window.nisje.data,d=window.nisje.icons,m=function(e){var n,r,o=e.match.params.id,a=(n=(0,u.useApiFetch)("/wp/v2/nisje-alert/".concat(o)),r=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],_n=!0,r=!1,o=void 0;try{for(var a,i=e[Symbol.iterator]();!(_n=(a=i.next()).done)&&(n.push(a.value),!t||n.length!==t);_n=!0);}catch(e){r=!0,o=e}finally{try{_n||null==i.return||i.return()}finally{if(r)throw o}}return n}}(n,r)||function(e,t){if(e){if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}(n,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),i=a[0],m=a[1];return i?m?(0,t.createElement)(s.Message,{icon:d.warning},m.data.status,": ",m.message):(0,t.createElement)(l.EntryContainer,null,(0,t.createElement)(l.EntryHeader,null,i.title.rendered),(0,t.createElement)(l.EntryContent,null,i.content.rendered)):(0,t.createElement)(l.PostLoader,null)},w=(0,a.getOption)("alerts");(0,r.registerPlugin)("alerts",{render:function(){return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(i.PluginRoutes,null,(0,t.createElement)(i.Route,{path:"/alerts/:id",component:m,exact:!0})),!(0,n.isEmpty)(w)&&(0,t.createElement)(o.BeforeFrontpageControls,null,w.map((function(e){return(0,t.createElement)("div",{key:e.id,className:"frontpage-alert is-color-".concat(e.color)},(0,t.createElement)(l.TextDeprecated,{as:"h2",variant:"title-large",mb:1},(0,t.createElement)(i.Link,{to:"/alerts/".concat(e.id,"/")},e.title)),(0,t.createElement)(l.TextDeprecated,{className:"frontpage-alert__excerpt"},e.excerpt))}))))}}),(window.nisje=window.nisje||{}).pluginAlerts=e}();