// source --> https://www.ellinides.net/wp-content/plugins/decent-comments/blocks/decent-comments/build/index.js?ver=d524a6e4a42d8bc0f05f 
(()=>{"use strict";var e={723(e){e.exports=window.wp.i18n},727(e,t,o){o.d(t,{PU:()=>l,p4:()=>r});const n=window.wp.apiFetch;var s=o.n(n),a=o(723),c=o(790);async function r(e,t){const o=function(e){const t={number:e.number||5,offset:e.offset||0,order:e.order||"asc",orderby:e.orderby||"comment_author_email",...e.post_id&&{post_id:e.post_id},...e.post__in&&{post__in:e.post__in},...e.post__not_in&&{post__not_in:e.post__not_in},...e.post_type&&{post_type:e.post_type},...e.taxonomy&&{taxonomy:e.taxonomy},...e.terms&&{terms:e.terms},...e.term_ids&&{term_ids:e.term_ids},...e.exclude_post_author&&{exclude_post_author:e.exclude_post_author},...e.pingback&&{pingback:e.pingback},...e.trackback&&{trackback:e.trackback},...e.avatar_size&&{avatar_size:e.avatar_size}};return new URLSearchParams(t)}(e);return await s()({path:`decent-comments/v1/comments?${o.toString()}`,method:"GET",headers:{"X-WP-Nonce":t}})}const l=({comments:e,attributes:t})=>(0,c.jsxs)("div",{className:"decent-comments",children:[t.title?.length>0&&(0,c.jsx)("div",{className:"decent-comments-heading gamma widget-title",children:t.title}),(0,c.jsx)("ul",{className:"decent-comments-list",children:0===e.length?(0,c.jsx)("li",{className:"comment no-comment",children:(0,a.__)("No comments","decent-comments")}):e.filter(e=>!t.exclude_post_author||e.author_email!==e.post_author).map(e=>(0,c.jsx)(m,{comment:e,attributes:t},e.id))})]}),m=({comment:e,attributes:t})=>{const o=t.show_author?t.link_authors&&e.author_url?(0,c.jsx)("a",{href:_(e.author_url),className:"comment-author-link",children:e.author}):e.author:null,n=t.show_date?`${e.date} ${(0,a.__)("at","decent-comments")} ${e.time}`:null;let s="",r="";e.author_url&&(s='<a href="'+e.author_url+'" rel="external">',r="</a>");const l=t.show_avatar&&e.avatar?(0,c.jsx)("div",{className:"comment-avatar",dangerouslySetInnerHTML:{__html:s+e.avatar+r}}):null,m=t.show_comment?function(e,t){let o=t.show_excerpt?e:"";if(t.strip_tags&&(o=o.replace(/(<([^>]+)>)/gi,"")),t.max_excerpt_words>0){const e=o.split(" ");o=e.slice(0,t.max_excerpt_words).join(" ")+(e.length>t.max_excerpt_words?t.ellipsis:"")}return t.max_excerpt_characters>0&&(o=o.substring(0,t.max_excerpt_characters)+(o.length>t.max_excerpt_characters?t.ellipsis:"")),o}(e.content,t):"",i=t.show_link&&e.comment_link?(0,c.jsxs)("div",{className:"comment-link",children:[(0,a.__)("on","decent-comments")," ",(0,c.jsx)("a",{href:_(e.comment_link),className:"comment-post-title",children:e.post_title||""})]}):null;return(0,c.jsx)("li",{className:"comment-entry",children:(0,c.jsxs)("div",{className:"comment-content",children:[l,o&&(0,c.jsxs)("div",{className:"comment-author",children:[o," "]}),n&&(0,c.jsxs)("div",{className:"comment-date",children:[n," "]}),i," ",m&&(0,c.jsx)("div",{className:"comment-excerpt",children:m})]})},e.id)};function _(e){try{const t=new URL(e);return["http:","https:"].includes(t.protocol)?encodeURI(e):"#"}catch{return"#"}}},790(e){e.exports=window.ReactJSXRuntime}},t={};function o(n){var s=t[n];if(void 0!==s)return s.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,o),a.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);const n=window.wp.blocks;var s=o(723);const a=window.wp.blockEditor,c=window.wp.components,r=JSON.parse('{"UU":"decent-comments-block/decent-comments"}'),l=window.wp.element;var m=o(727),_=o(790);(0,n.registerBlockType)(r.UU,{apiVersion:3,title:(0,s.__)("Decent Comments","decent-comments"),icon:"admin-comments",category:"widgets",attributes:{title:{type:"string",default:""},number:{type:"number",default:5},offset:{type:"number",default:0},post_id:{type:"string",default:""},post__in:{type:"string",default:""},post__not_in:{type:"string",default:""},post_tag:{type:"string",default:""},exclude_post_author:{type:"boolean",default:!1},show_author:{type:"boolean",default:!0},show_date:{type:"boolean",default:!0},link_authors:{type:"boolean",default:!0},show_avatar:{type:"boolean",default:!0},avatar_size:{type:"number",default:48},show_link:{type:"boolean",default:!0},show_comment:{type:"boolean",default:!0},taxonomy:{type:"string",default:""},terms:{type:"string",default:""},pingback:{type:"boolean",default:!0},trackback:{type:"boolean",default:!0},show_excerpt:{type:"boolean",default:!0},max_excerpt_words:{type:"number",default:20},max_excerpt_characters:{type:"number",default:0},ellipsis:{type:"string",default:""},strip_tags:{type:"boolean",default:!0},order:{type:"string",default:"desc"},orderby:{type:"string",default:"comment_date_gmt"},class:{type:"string",default:""},post_type:{type:"string",default:"post"}},edit:({attributes:e,setAttributes:t})=>{(0,a.useBlockProps)();const[o,n]=(0,l.useState)([]),[r,i]=(0,l.useState)(null);return(0,l.useEffect)(()=>{(async()=>{try{const t={...e};"[current]"!==e.post_id&&"{current}"!==e.post_id||(t.post_id=""),"[current]"!==e.terms&&"{current}"!==e.terms||(t.term_ids="");const o=window.decentCommentsEdit?.nonce||"",s=await(0,m.p4)(t,o);n(s.comments||[]),i(null)}catch(e){i(e),n([])}})()},[e]),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(a.InspectorControls,{children:(0,_.jsxs)(c.PanelBody,{title:(0,s.__)("Comment Settings","decent-comments"),children:[(0,_.jsx)(c.TextControl,{label:(0,s.__)("Title","decent-comments"),value:e.title,onChange:e=>t({title:e})}),(0,_.jsx)(c.TextControl,{label:(0,s.__)("Number of Comments","decent-comments"),value:e.number,onChange:e=>t({number:parseInt(e)||5}),min:"1",type:"number"}),(0,_.jsx)(c.SelectControl,{label:(0,s.__)("Order by...","decent-comments"),value:e.orderby,options:[{label:(0,s.__)("Author Email","decent-comments"),value:"comment_author_email"},{label:(0,s.__)("Author URL","decent-comments"),value:"comment_author_url"},{label:(0,s.__)("Content","decent-comments"),value:"comment_content"},{label:(0,s.__)("Comment Date","decent-comments"),value:"comment_date_gmt"},{label:(0,s.__)("Karma","decent-comments"),value:"comment_karma"},{label:(0,s.__)("Post","decent-comments"),value:"comment_post_id"}],onChange:e=>t({orderby:e})}),(0,_.jsx)(c.SelectControl,{label:(0,s.__)("Sort order","decent-comments"),value:e.order,options:[{label:(0,s.__)("Descending","decent-comments"),value:"desc"},{label:(0,s.__)("Ascending","decent-comments"),value:"asc"}],onChange:e=>t({order:e})}),(0,_.jsx)(c.TextControl,{label:(0,s.__)("Post ID","decent-comments"),value:e.post_id,onChange:e=>t({post_id:e||""}),help:(0,s.__)("Title, empty, post ID or [current]","decent-comments")}),(0,_.jsx)(c.TextControl,{label:(0,s.__)("Post type","decent-comments"),value:e.post_type,onChange:e=>t({post_type:e}),help:(0,s.__)("Available post types: "+decentCommentsEdit.post_types,"decent-comments")}),(0,_.jsx)(c.ToggleControl,{label:(0,s.__)("Exclude comments from post authors","decent-comments"),checked:e.exclude_post_author,onChange:e=>t({exclude_post_author:e})}),(0,_.jsx)(c.ToggleControl,{label:(0,s.__)("Show comment excerpt","decent-comments"),checked:e.show_excerpt,onChange:e=>t({show_excerpt:e})}),(0,_.jsx)(c.TextControl,{label:(0,s.__)("Number of words in excerpts","decent-comments"),value:e.max_excerpt_words,onChange:e=>t({max_excerpt_words:parseInt(e)||20}),min:"0",type:"number"}),(0,_.jsx)(c.TextControl,{label:(0,s.__)("Number of characters in excerpts","decent-comments"),value:e.max_excerpt_characters,onChange:e=>t({max_excerpt_characters:parseInt(e)||0}),min:"0",type:"number"}),(0,_.jsx)(c.TextControl,{label:(0,s.__)("Ellipsis"),value:e.ellipsis,onChange:e=>t({ellipsis:e}),help:(0,s.__)("The ellipsis is shown after the excerpt when there is more content.","decent-comments")}),(0,_.jsx)(c.ToggleControl,{label:(0,s.__)("Show author","decent-comments"),checked:e.show_author,onChange:e=>t({show_author:e})}),(0,_.jsx)(c.ToggleControl,{label:(0,s.__)("Show date","decent-comments"),checked:e.show_date,onChange:e=>t({show_date:e})}),(0,_.jsx)(c.ToggleControl,{label:(0,s.__)("Link authors","decent-comments"),checked:e.link_authors,onChange:e=>t({link_authors:e}),help:(0,s.__)("Whether to link comment authors to their website.","decent-comments")}),(0,_.jsx)(c.ToggleControl,{label:(0,s.__)("Show avatar","decent-comments"),checked:e.show_avatar,onChange:e=>t({show_avatar:e})}),(0,_.jsx)(c.TextControl,{label:(0,s.__)("Avatar size","decent-comments"),value:e.avatar_size,onChange:e=>t({avatar_size:parseInt(e)||48}),min:"0",type:"number"}),(0,_.jsx)(c.ToggleControl,{label:(0,s.__)("Show link to post","decent-comments"),checked:e.show_link,onChange:e=>t({show_link:e})}),(0,_.jsx)(c.ToggleControl,{label:(0,s.__)("Show the comment","decent-comments"),checked:e.show_comment,onChange:e=>t({show_comment:e})}),(0,_.jsx)(c.SelectControl,{label:(0,s.__)("Taxonomy","decent-comments"),value:e.taxonomy,options:[{label:(0,s.__)("All post taxonomies","decent-comments"),value:""},{label:(0,s.__)("category","decent-comments"),value:"category"},{label:(0,s.__)("tag","decent-comments"),value:"post_tag"}],onChange:e=>t({taxonomy:e}),help:(0,s.__)("Select category if you would like to show comments on posts in certain categories. Give the desired categories' slugs in Term. For tags select post_tag and give the tags' slugs in Term.","decent-comments")}),(0,_.jsx)(c.TextControl,{label:(0,s.__)("Term","decent-comments"),value:e.terms,onChange:e=>t({terms:e})}),(0,_.jsx)(c.ToggleControl,{label:(0,s.__)("Pingbacks","decent-comments"),checked:e.pingback,onChange:e=>t({pingback:e})}),(0,_.jsx)(c.ToggleControl,{label:(0,s.__)("Trackbacks","decent-comments"),checked:e.trackback,onChange:e=>t({trackback:e})})]})}),(0,_.jsx)("div",{...(0,a.useBlockProps)({className:"wp-block-itthinx-decent-comments","data-attributes":JSON.stringify(e)}),children:r?(0,_.jsx)("div",{className:"decent-comments-error",children:(0,_.jsxs)("p",{children:[(0,s.__)("Error loading comments in editor","decent-comments"),r.message&&`: ${r.message}`]})}):(0,_.jsx)("div",{className:"wp-block-itthinx-decent-comments",children:(0,_.jsx)(m.PU,{comments:o,attributes:e})})})]})},save:({attributes:e})=>(0,_.jsx)("div",{className:"wp-block-itthinx-decent-comments","data-attributes":JSON.stringify(e),children:(0,_.jsxs)("p",{children:[(0,s.__)("Comments","decent-comments")," …"]})})})})();;