!function(){"use strict";var e={n:function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,{a:n}),n},d:function(t,n){for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function n(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}function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null!=n){var r,o,i=[],_n=!0,l=!1;try{for(n=n.call(e);!(_n=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);_n=!0);}catch(e){l=!0,o=e}finally{try{_n||null==n.return||n.return()}finally{if(l)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}(e,t)||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.")}()}e.r(t),e.d(t,{DeleteModal:function(){return w},Message:function(){return y}});var o=window.wp.element,i=window.lodash,l=window.React,a=window.wp.i18n,c=window.wp.components,s=window.wp.data,u=window.wp.apiFetch,d=e.n(u),m=window.nisje.components,f=window.nisje.router,w=function(e){var t=e.button,n=e.message,u=e.onRequestClose,w=e.onSuccess,p=void 0===w?i.noop:w,y=e.redirect,v=void 0!==y&&y,h=e.restPath,b=e.successMessage,g=e.title,E=(0,f.useHistory)(),_=r((0,l.useState)(!1),2),j=_[0],S=_[1],M=r((0,l.useState)(!1),2),x=M[0],C=M[1],I=(0,s.useDispatch)("nisje/notices").createInfoNotice;return(0,o.createElement)(c.Modal,{className:"views-delete-modal",closeButtonLabel:(0,a.__)("Cancel"),onRequestClose:u,title:g||(0,a.__)("Delete post?")},(0,o.createElement)("p",null,n||(0,a.__)("This will delete the post permanently")),x&&(0,o.createElement)(m.Notice,{status:"error"},x),(0,o.createElement)("div",{className:"views-delete-modal__actions"},(0,o.createElement)(m.Flex,{justify:"flex-end"},(0,o.createElement)(m.FlexItem,null,(0,o.createElement)(m.ExperimentalButton,{isSecondary:!0,onClick:u},(0,a.__)("Cancel"))),(0,o.createElement)(m.FlexItem,null,(0,o.createElement)(m.ExperimentalButton,{className:"delete-button",isDestructive:!0,isBusy:j,onClick:function(){S(!0),d()({path:h,method:"DELETE"}).then((function(){I(b||(0,a.__)("Successfully deleted the post")),p(),u(),v&&E.replace(v)})).catch((function(e){C(e.message),S(!1)}))}},t||(0,a.__)("Delete"))))))},p=window.nisje.icons,y=(0,window.nisje.viewport.withViewportMatch)({isHuge:"huge"})((function(e){var t=e.isHuge,n=e.icon,r=e.children;return(0,o.createElement)("div",{className:"views-message"},(0,o.createElement)("div",null,n&&(0,o.createElement)(p.Icon,{icon:n,size:t?80:60}),(0,o.createElement)("p",null,r)))}));(window.nisje=window.nisje||{}).views=t}();