!function(e,t,n,o,r,i){"use strict";var s=function(){return i.createElement(t.Spinner)},l=function(){return i.createElement(t.Notice,{status:"error",isDismissible:!1},n.__("Something went wrong. Try again or refresh the page.","post-views-counter"))};var a=i.createElement(function(e){var t=e.viewBox,n=void 0===t?"0 0 24 24":t,o=e.children;return i.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:n,width:24,height:24,fill:"currentColor"},o)},{viewBox:"0 0 16 16"},i.createElement("path",{d:"M12 2a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h1a1 1 0 0 0 1-1V3a1 1 0 0 0-1-1h-1ZM6.5 6a1 1 0 0 1 1-1h1a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1h-1a1 1 0 0 1-1-1V6ZM2 9a1 1 0 0 1 1-1h1a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V9Z"}));e.registerBlockType("post-views-counter/post-views",{icon:a,edit:function(e){var i=e.attributes,a=e.setAttributes,c=i.postID,p=i.period;return wp.element.createElement(wp.element.Fragment,null,wp.element.createElement(o.InspectorControls,null,wp.element.createElement(t.PanelBody,{title:n.__("Settings","post-views-counter")},wp.element.createElement(t.TextControl,{__nextHasNoMarginBottom:!0,label:n.__("Post ID","post-views-counter"),value:c,onChange:function(e){return a({postID:Number(e)})},help:n.__("Enter 0 to use current visited post.","post-views-counter")}),wp.element.createElement(t.SelectControl,{__nextHasNoMarginBottom:!0,disabled:1===pvcBlockEditorData.periods.length,label:n.__("Views period","post-views-counter"),value:p,options:pvcBlockEditorData.periods,onChange:function(e){return a({period:e})}}))),wp.element.createElement("div",o.useBlockProps(),wp.element.createElement(r,{httpMethod:"POST",block:"post-views-counter/post-views",attributes:i,LoadingResponsePlaceholder:s,ErrorResponsePlaceholder:l})))}})}(wp.blocks,wp.components,wp.i18n,wp.blockEditor,wp.serverSideRender,wp.element);
