From 55662689cf701eda45646735bd1dd2dc9b9c88c8 Mon Sep 17 00:00:00 2001 From: poojabhimani12 <82029773+poojabhimani12@users.noreply.github.com> Date: Wed, 4 Dec 2024 11:23:38 +0530 Subject: [PATCH] fix minor issues --- .../js/commenting-block-admin-functions.js | 11 ++++- admin/assets/js/commenting-block-admin.js | 43 +------------------ .../js/dist/activityCentre.build.min.js | 2 +- commenting-block.php | 11 ----- 4 files changed, 11 insertions(+), 56 deletions(-) diff --git a/admin/assets/js/commenting-block-admin-functions.js b/admin/assets/js/commenting-block-admin-functions.js index 0a94ddf..85c1ab9 100644 --- a/admin/assets/js/commenting-block-admin-functions.js +++ b/admin/assets/js/commenting-block-admin-functions.js @@ -529,7 +529,11 @@ function showNoticeBoardonNewComments() { } setTimeout(function () { if (noticeboard !== null) { - + // if( noticeboard.innerHTML === "" ){ + // noticeboard.setAttribute('style','display:none'); + // } else { + // noticeboard.setAttribute('style','display:block'); + // } } }, 300); @@ -1145,6 +1149,9 @@ function cfgetCustomAttributeId(selectedText) { //topOfText = document.querySelector('[datatext="' + elid + '"]').offsetTop; topOfText = jQuery('[datatext="' + elid + '"]').offset()?.top; } else { + // const sid = document.getElementById(elid)?.getAttribute('data-sid'); + // //topOfText = document.querySelector('[id="' + sid + '"]')?.offsetTop; + // topOfText = document.getElementById( elid )?.offsetTop; const sid = jQuery('#' + elid).attr('data-sid'); topOfText = jQuery('[id="' + sid + '"]').offset()?.top; @@ -1207,7 +1214,6 @@ function cfgetCustomAttributeId(selectedText) { setContainerDimensions("auto", `${calcLyotWidth}px`); } if( fromIconClick ) { - setTimeout(function () { const notCommentOncls = document.querySelector(".multicollab_body_class"); const $boardOuter = $("#cf-comment-board-wrapper .cls-board-outer"); @@ -1240,3 +1246,4 @@ function cfgetCustomAttributeId(selectedText) { } } + \ No newline at end of file diff --git a/admin/assets/js/commenting-block-admin.js b/admin/assets/js/commenting-block-admin.js index c1c47d1..949fcba 100644 --- a/admin/assets/js/commenting-block-admin.js +++ b/admin/assets/js/commenting-block-admin.js @@ -174,28 +174,6 @@ window.addEventListener("click", function (e) { localStorage.setItem("userURL", user.url); }) .catch((error) => console.error("Error:", error)); - // comment below code due to performance issue / Since 4.8 - /* commentedId = adminLocalizer.comment_id; - if (commentedId) { - setTimeout(function () { - const editCommentButton = document.querySelector( - `#${commentedId} .js-edit-comment` - ); - if (editCommentButton) { - editCommentButton.click(); - } - const commentedElement = document.getElementById(commentedId); - if (commentedElement) { - commentedElement.classList.add("comment-flash"); - } - }, 2000); - setTimeout(function () { - const commentedElement = document.getElementById(commentedId); - if (commentedElement) { - commentedElement.classList.remove("comment-flash"); - } - }, 4000); - }*/ }); document.addEventListener("DOMContentLoaded", function () { @@ -632,26 +610,7 @@ window.addEventListener("click", function (e) { }); } } - - // Show/Hide comment toggler if the counter value is zero. - /*if (event.target.matches('#history-toggle')) { - var dataCount = event.target.getAttribute('data-count'); - if (0 >= dataCount) { - document.getElementById('comments-toggle').style.display = 'none'; - } else { - document.getElementById('comments-toggle').style.display = 'block'; - } - }*/ - - // Settings page tabs toggle. - // if (event.target.matches('.cf-dashboard-layout__tabs-list span')) { - // const tabID = event.target?.dataset?.id; - // document.querySelectorAll('.cf-dashboard-layout__tabs-wrap-inner').forEach(function (element) { - // element.style.display = 'none'; - // }); - // document.getElementById(tabID).style.display = 'block'; - // } - + // Scroll to the commented text and its popup from History Popup. const scrollCommentTarget = event.target.closest(".user-commented-on"); if (scrollCommentTarget) { diff --git a/admin/assets/js/dist/activityCentre.build.min.js b/admin/assets/js/dist/activityCentre.build.min.js index 6af8c6f..c6ff67c 100644 --- a/admin/assets/js/dist/activityCentre.build.min.js +++ b/admin/assets/js/dist/activityCentre.build.min.js @@ -42,4 +42,4 @@ var d=Symbol.for("react.element"),p=Symbol.for("react.portal"),n=Symbol.for("rea * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -function a(e,t){var n=e.length;for(e.push(t);0>>1,o=e[r];if(!(0>>1;rt)||e&&!L());){var r,o=m.callback;"function"==typeof o?(m.callback=null,f=m.priorityLevel,r=o(m.expirationTime<=t),t=s.unstable_now(),"function"==typeof r?m.callback=r:m===l(d)&&c(d),v(t)):c(d),m=l(d)}var a,i=null!==m||(null!==(a=l(p))&&x(_,a.startTime-t),!1);return i}finally{m=null,f=n,h=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var A,S,N,k=!1,C=null,O=-1,w=5,R=-1;function L(){return!(s.unstable_now()-R{e.exports=n(7463)},6897:(e,t,n)=>{var r=n(453),i=n(41),s=n(592)(),l=n(5795),c=n(9675),u=r("%Math.floor%");e.exports=function(e,t){if("function"!=typeof e)throw new c("`fn` is not a function");if("number"!=typeof t||t<0||4294967295{var r=n(9995);function o(){r.call(this)}o.prototype=new r,((e.exports=o).Stream=o).prototype.pipe=function(t,e){var n=this;function r(e){t.writable&&!1===t.write(e)&&n.pause&&n.pause()}function o(){n.readable&&n.resume&&n.resume()}n.on("data",r),t.on("drain",o),t._isStdio||e&&!1===e.end||(n.on("end",i),n.on("close",s));var a=!1;function i(){a||(a=!0,t.end())}function s(){a||(a=!0,"function"==typeof t.destroy&&t.destroy())}function l(e){if(c(),!this.hasListeners("error"))throw e}function c(){n.off("data",r),t.off("drain",o),n.off("end",i),n.off("close",s),n.off("error",l),t.off("error",l),n.off("end",c),n.off("close",c),t.off("end",c),t.off("close",c)}return n.on("error",l),t.on("error",l),n.on("end",c),n.on("close",c),t.on("end",c),t.on("close",c),t.emit("pipe",n),t}},1135:e=>{e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},9032:(e,t,n)=>{var r=n(7244),o=n(8184),a=n(5767),i=n(5680);function s(e){return e.call.bind(e)}var l,c,u="undefined"!=typeof BigInt,d="undefined"!=typeof Symbol,p=s(Object.prototype.toString),m=s(Number.prototype.valueOf),f=s(String.prototype.valueOf),h=s(Boolean.prototype.valueOf);function g(e,t){if("object"!=typeof e)return!1;try{return t(e),!0}catch(e){return!1}}function E(e){return"[object Map]"===p(e)}function y(e){return"[object Set]"===p(e)}function T(e){return"[object WeakMap]"===p(e)}function v(e){return"[object WeakSet]"===p(e)}function _(e){return"[object ArrayBuffer]"===p(e)}function b(e){return"undefined"!=typeof ArrayBuffer&&(_.working?_(e):e instanceof ArrayBuffer)}function A(e){return"[object DataView]"===p(e)}function S(e){return"undefined"!=typeof DataView&&(A.working?A(e):e instanceof DataView)}u&&(l=s(BigInt.prototype.valueOf)),d&&(c=s(Symbol.prototype.valueOf)),t.isArgumentsObject=r,t.isGeneratorFunction=o,t.isTypedArray=i,t.isPromise=function(e){return"undefined"!=typeof Promise&&e instanceof Promise||null!==e&&"object"==typeof e&&"function"==typeof e.then&&"function"==typeof e.catch},t.isArrayBufferView=function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):i(e)||S(e)},t.isUint8Array=function(e){return"Uint8Array"===a(e)},t.isUint8ClampedArray=function(e){return"Uint8ClampedArray"===a(e)},t.isUint16Array=function(e){return"Uint16Array"===a(e)},t.isUint32Array=function(e){return"Uint32Array"===a(e)},t.isInt8Array=function(e){return"Int8Array"===a(e)},t.isInt16Array=function(e){return"Int16Array"===a(e)},t.isInt32Array=function(e){return"Int32Array"===a(e)},t.isFloat32Array=function(e){return"Float32Array"===a(e)},t.isFloat64Array=function(e){return"Float64Array"===a(e)},t.isBigInt64Array=function(e){return"BigInt64Array"===a(e)},t.isBigUint64Array=function(e){return"BigUint64Array"===a(e)},E.working="undefined"!=typeof Map&&E(new Map),t.isMap=function(e){return"undefined"!=typeof Map&&(E.working?E(e):e instanceof Map)},y.working="undefined"!=typeof Set&&y(new Set),t.isSet=function(e){return"undefined"!=typeof Set&&(y.working?y(e):e instanceof Set)},T.working="undefined"!=typeof WeakMap&&T(new WeakMap),t.isWeakMap=function(e){return"undefined"!=typeof WeakMap&&(T.working?T(e):e instanceof WeakMap)},v.working="undefined"!=typeof WeakSet&&v(new WeakSet),t.isWeakSet=v,_.working="undefined"!=typeof ArrayBuffer&&_(new ArrayBuffer),t.isArrayBuffer=b,A.working="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView&&A(new DataView(new ArrayBuffer(1),0,1)),t.isDataView=S;var N="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:void 0;function k(e){return"[object SharedArrayBuffer]"===p(e)}function C(e){return void 0!==N&&((k.working=void 0===k.working?k(new N):k.working)?k(e):e instanceof N)}function O(e){return g(e,m)}function w(e){return g(e,f)}function R(e){return g(e,h)}function L(e){return u&&g(e,l)}function I(e){return d&&g(e,c)}t.isSharedArrayBuffer=C,t.isAsyncFunction=function(e){return"[object AsyncFunction]"===p(e)},t.isMapIterator=function(e){return"[object Map Iterator]"===p(e)},t.isSetIterator=function(e){return"[object Set Iterator]"===p(e)},t.isGeneratorObject=function(e){return"[object Generator]"===p(e)},t.isWebAssemblyCompiledModule=function(e){return"[object WebAssembly.Module]"===p(e)},t.isNumberObject=O,t.isStringObject=w,t.isBooleanObject=R,t.isBigIntObject=L,t.isSymbolObject=I,t.isBoxedPrimitive=function(e){return O(e)||w(e)||R(e)||L(e)||I(e)},t.isAnyArrayBuffer=function(e){return"undefined"!=typeof Uint8Array&&(b(e)||C(e))},["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(e){Object.defineProperty(t,e,{enumerable:!1,value:function(){throw new Error(e+" is not supported in userland")}})})},537:(e,u,t)=>{var n,r=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),n={},r=0;r{var n;return T(t)?e.stylize("undefined","undefined"):y(t)?(n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'",e.stylize(n,"string")):E(t)?e.stylize(""+t,"number"):h(t)?e.stylize(""+t,"boolean"):g(t)?e.stylize("null","null"):void 0})(t,n);if(e)return e;var o,e=Object.keys(n),a=(o={},e.forEach(function(e,t){o[e]=!0}),o);if(t.showHidden&&(e=Object.getOwnPropertyNames(n)),A(n)&&(0<=e.indexOf("message")||0<=e.indexOf("description")))return p(n);if(0===e.length){if(S(n))return i=n.name?": "+n.name:"",t.stylize("[Function"+i+"]","special");if(v(n))return t.stylize(RegExp.prototype.toString.call(n),"regexp");if(b(n))return t.stylize(Date.prototype.toString.call(n),"date");if(A(n))return p(n)}var i="",s=!1,l=["{","}"];if(f(n)&&(s=!0,l=["[","]"]),S(n)&&(i=" [Function"+(n.name?": "+n.name:"")+"]"),v(n)&&(i=" "+RegExp.prototype.toString.call(n)),b(n)&&(i=" "+Date.prototype.toUTCString.call(n)),A(n)&&(i=" "+p(n)),0===e.length&&(!s||0==n.length))return l[0]+i+l[1];if(r<0)return v(n)?t.stylize(RegExp.prototype.toString.call(n),"regexp"):t.stylize("[Object]","special");t.seen.push(n),c=s?((t,n,r,o,e)=>{for(var a=[],i=0,s=n.length;i{var i=n(2682),r=n(9209),o=n(487),a=n(8075),s=n(5795),l=a("Object.prototype.toString"),c=n(9092)(),u="undefined"==typeof globalThis?n.g:globalThis,d=r(),p=a("String.prototype.slice"),m=Object.getPrototypeOf,f=a("Array.prototype.indexOf",!0)||function(e,t){for(var n=0;n{var r=n(6578),o="undefined"==typeof globalThis?n.g:globalThis;e.exports=function(){for(var e=[],t=0;t{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);{function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function B(e){e=((e,t)=>{if("object"!=o(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0===n)return("string"===t?String:Number)(e);if("object"!=o(n=n.call(e,t||"default")))return n;throw new TypeError("@@toPrimitive must return a primitive value.")})(e,"string");return"symbol"==o(e)?e:e+""}function G(e,t){if(null==e)return{};var n,r=((e,t)=>{if(null==e)return{};var n,r={};for(n in e)if({}.hasOwnProperty.call(e,n)){if(t.includes(n))continue;r[n]=e[n]}return r})(e,t);if(Object.getOwnPropertySymbols)for(var o=Object.getOwnPropertySymbols(e),a=0;a(e=((e,t)=>{if("object"!=l(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0===n)return("string"===t?String:Number)(e);if("object"!=l(n=n.call(e,t||"default")))return n;throw new TypeError("@@toPrimitive must return a primitive value.")})(e,"string"),"symbol"==l(e)?e:e+""))(r.key),r)}}function V(e,t,n){t=u(t);var r=e,t=Q()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n);if(!t||"object"!=l(t)&&"function"!=typeof t){if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(t=r))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t}function Q(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Q=function(){return!!e})()}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function X(e,t){return(X=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}var d=wp.i18n.__,s;(s=wp.components).Button;var s,p=((s=wp.element).createRef,s.Fragment),J=s.RawHTML,s,Z=((s=wp.blockEditor).MediaUpload,/^((?!chrome|android).)*safari/i.test(navigator.userAgent),(e=>{function n(e){var t;if(this instanceof n)return(t=V(this,n,[e])).contentEditable=b.createRef(),t.edit=t.edit.bind(t),t.save=t.save.bind(t),t.remove=t.remove.bind(t),t.resolve=t.resolve.bind(t),t.copy=t.copy.bind(t),t.cancelEdit=t.cancelEdit.bind(t),t.state={editing:!1,showEditedDraft:!1,contentHtml:"
",editedTime:"",copySuccess:""},t.val=e.value,t;throw new TypeError("Cannot call a class as a function")}var t,r=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),e&&X(r,e),r=n,(e=[{key:"componentDidUpdate",value:function(){var e,t;0!==document.querySelectorAll('mdspan[data-rich-text-format-boundary="true"]').length&&(e=this.props.timestamp,e=document.getElementById(e).querySelector("textarea"))&&(t=e.value,e.focus(),e.value="",e.value=t)}},{key:"edit",value:function(){this.setState({editing:!0});var e=this.state.showEditedDraft?this.props.editedDraft:this.props.children,e=removeLinkFromEditableText(e);this.state.contentHtml=e,this.state.attachmentText=this.props.attachmentText,""!==this.state.attachmentText&&this.setState({mediaId:"",mediaName:"",mediaUrl:""})}},{key:"save",value:function(e){var t=e.currentTarget.parentElement.parentElement.parentElement.parentElement.parentElement.id;if(e.currentTarget.classList.contains("btn-disabled"))return!1;if(0!==document.querySelector("#".concat(t," .js-cf-edit-comment")).textContent.trim().length){var n,r,o,e=this.state.contentHtml;if(""===e)return y(d("Please add some comment.","content-collaboration-inline-commenting")),!1;!0===this.state.editing&&(o=editedTimezone?editedTimezone.editedTime:"",r=getTimestampWithTimezone(),n=""!==this.state.attachmentText||"undefined"!==this.state.attachmentText||null===(null==(n=document.getElementById("cf_thumb_file"))?void 0:n.innerHTML)?this.state.attachmentText:null==(n=document.getElementById("cf_thumb_file"))?void 0:n.innerHTML,this.state.editedTime=o,this.state.editedTimestamp=r,""!==this.state.attachmentText&&void 0!==this.state.attachmentText||(n=null==(o=document.getElementById("cf_thumb_file"))?void 0:o.innerHTML),""!==this.props.assignedText)&&null!=this.props.assignedText&&(r=this.props.assignedText,(o=document.createElement("span")).innerHTML=r,o.classList.add("assigned-meta-text"),null!=(r=document.getElementById(this.props.timestamp).querySelector(".commentInnerContainer .commentText .readmoreTxt")))&&r.after(o),e=filterTextBeforeSave(e),this.props.updateCommentFromBoard(e,this.props.index,this.props.timestamp,this.props.dateTime,t,this.state.editedTime,this.state.editedTimestamp,this.props.assignedText,n),this.setState({editing:!1})}else y(d("Please add some comment.","content-collaboration-inline-commenting"))}},{key:"remove",value:function(e){var t=e.currentTarget.closest(".cls-board-outer");this.props.removeCommentFromBoard(this.props.index,this.props.timestamp,t.id),e.currentTarget.closest(".comment-delete-overlay").classList.remove("show")}},{key:"copy",value:function(e){var t=e.currentTarget.closest(".cls-board-outer").id,n=window.location.href+"¤t_url="+t,r=document.querySelector(".copytext"),r=(r&&(r.textContent=""),document.getElementById(t).querySelector(".copytext")),t=(r&&(r.textContent=n),document.createElement("input"));t.setAttribute("style","position: absolute; top: -8888px; left: -8888px"),document.body.appendChild(t),t.setAttribute("value",n),t.select(),document.execCommand("copy"),e.target.focus(),t.remove(),this.setState({copySuccess:d("Link Copied!","content-collaboration-inline-commenting")}),clearInterval(this.resetState()),e.currentTarget.closest(".buttons-wrapper").classList.remove("active"),document.createElement("input").select()}},{key:"resetState",value:function(){var e=this;setTimeout(function(){return e.setState({copySuccess:""})},3e3)}},{key:"resolve",value:function(e){var o=e.currentTarget.closest(".cls-board-outer").id,a=o,e=wp.data.select("core/editor").getCurrentPostId();fetch(ajaxurl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({action:"cf_resolve_thread",currentPostID:e,metaId:"_"+o}).toString()}).then(function(e){var t,n=wp.data.select("mdstore").getAllCommentCount(),n=(void 0!==(null==n?void 0:n.length)&&(t=o.replace("_",""),n.find(function(e){return e.elID===t})),setTimeout(function(){var e=document.getElementById(a);e&&e.remove()},1e3),null!=(n=document.getElementById("history-toggle"))&&n.setAttribute("data-count",null==(n=document.querySelectorAll(".cls-board-outer"))?void 0:n.length),Array.from(document.querySelectorAll('[datatext="'.concat(a,'"]'))).map(function(e){return e.getAttribute("data-block")})),r=(document.querySelectorAll("#cf-comment-board-wrapper .cls-board-outer").forEach(function(e){e.classList.remove("focus"),e.removeAttribute("style")}),document.querySelectorAll('[datatext="'.concat(a,'"].cf-icon-wholeblock__comment')).forEach(function(e){return e.classList.remove("cf-icon-wholeblock__comment")}),document.querySelectorAll('[datatext="'.concat(a,'"]')).forEach(function(e){e.classList.remove("commentIcon"),e.classList.remove("cf-onwhole-block__comment")}),null==(r=document.querySelector('[datatext="'.concat(a,'"]')))?void 0:r.getAttribute("data-type")),r=(void 0!==r&&n&&null!==r?n.forEach(function(e){wp.data.dispatch("core/block-editor").updateBlockAttributes(e,{datatext:""})}):document.querySelectorAll('[datatext="'.concat(a,'"]')).forEach(function(e){var t;removeTag(a),null!=(t=document.getElementById(a))&&t.remove()}),wp.data.dispatch("mdstore").setIsActive(!1),new Event("editorLayoutUpdate"));document.dispatchEvent(r),setTimeout(function(){},2e3),wp.data.dispatch("core/editor").autosave()}).catch(function(e){return console.error("Error:",e)})}},{key:"cancelEdit",value:function(){this.state.attachmentText=this.props.attachmentText,this.setState({editing:!1})}},{key:"deleteAttachment",value:function(e){e=$(e.currentTarget).closest(".cls-board-outer");this.setState({attachmentText:"",mediaId:"",mediaName:"",mediaUrl:""}),this.props.removeAttachmentFromBoard(this.props.index,this.props.timestamp,e[0].id,this.props.attachmentText)}},{key:"renderNormalMode",value:function(){var e=document.querySelector(".cls-board-outer.focus .shareCommentContainer"),e=(e&&(e.style.display="block"),this.props.index),t=(this.props.status,this.props.attachmentText),n=timeAgo(this.props.timestamp),r=convertedDatetime(this.props.timestamp),o="";try{o=wp.data.select("core").getCurrentUser().id}catch(e){o=localStorage.getItem("userID")}var a=this.state.showEditedDraft?this.props.editedDraft:this.props.children,i="",s=(a=(a=300]+(>|$)/g,"").length?(i=a).substring(0,300)+"...":a).replace(/contenteditable=\"false\"/gi,'data-edit="false"'),this.props.userRole),s=(8getCommentsLimit()&&(l="none"),"block"!==(null==s?void 0:s.style.display)&&void 0!==(null==s?void 0:s.style.display)&&(l="block"),""===t&&(this.state.attachmentText=""),"\n \n ".concat(a,"\n ").concat(""!==i?"".concat(d("show more","content-collaboration-inline-commenting"),""):"","\n \n ")),t="\n \n ".concat(i,"\n ").concat(""!==i?"".concat(d("show less","content-collaboration-inline-commenting"),""):"","\n \n ");return b.createElement("div",{className:"commentContainer",style:{display:l},id:this.props.timestamp},b.createElement("div",{className:"commentInnerContainer"},b.createElement("div",{className:"comment-header"},b.createElement("div",{className:"comment-details"},"1"===this.props.showAvatars&&b.createElement("div",{className:"avatar"},b.createElement("img",{src:this.props.profileURL,alt:"avatar"})),b.createElement("div",{className:"commenter-name-time"},b.createElement("div",{className:"commenter-name"},this.props.userName.charAt(0).toUpperCase()+this.props.userName.slice(1),b.createElement("span",{className:"tooltip"},this.props.userRole)),b.createElement("div",{className:"comment-time"},b.createElement("span",{className:"comment-time-wrapper"},n," ",b.createElement("span",{className:"tooltip"},r," ")))),b.createElement("div",{className:"comment-actions"},b.createElement(p,null,0===e&&"guest"!==currentUserData.role&&b.createElement("div",{className:"comment-resolve"},b.createElement("input",{id:"resolve_cb_"+this.props.timestamp+"_"+e,type:"checkbox",className:"resolve-cb",value:"1"}),b.createElement("label",{htmlFor:"resolve_cb_"+this.props.timestamp+"_"+e},d("Resolved","content-collaboration-inline-commenting")),b.createElement("span",{className:"tooltip"},d("Mark as Resolved","content-collaboration-inline-commenting")))),0===e&&b.createElement(p,null,""!==this.state.copySuccess&&b.createElement("p",{className:"comment-copied-tooltip"},this.state.copySuccess),b.createElement("div",{className:"buttons-wrapper"},b.createElement("span",{className:"tooltip"},d("More Options...","content-collaboration-inline-commenting")),b.createElement("div",{className:"more-option-btn"},b.createElement("div",{className:"cf-option-light-btn"},f.moreFirstOption),b.createElement("div",{className:"cf-option-midlight-btn"},f.moreSecndOption),b.createElement("div",{className:"cf-option-dark-btn"},f.moreThirdOption)),b.createElement("div",{className:"comment-more-option"},b.createElement("ul",{className:"comment-more-option-list"},b.createElement("li",{onClick:this.copy.bind(this)},b.createElement("i",{className:"dashicons dashicons-share",title:d("Copy Link","content-collaboration-inline-commenting")}),b.createElement("span",{className:"more-option-meta"},d("Share","content-collaboration-inline-commenting"))),this.props.userID===o&&b.createElement(p,null,b.createElement("li",{onClick:this.edit,className:"js-edit-comment"},b.createElement("i",{className:"dashicons dashicons-edit",title:"Edit"}),b.createElement("span",{className:"more-option-meta"},d("Edit","content-collaboration-inline-commenting"))),b.createElement("li",{className:"js-resolve-comment"},b.createElement("i",{className:"dashicons dashicons-trash",title:"Resolve"}),b.createElement("span",{className:"more-option-meta"},d("Delete","content-collaboration-inline-commenting")))))))),this.props.userID===o&&0(e=((e,t)=>{if("object"!=m(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0===n)return("string"===t?String:Number)(e);if("object"!=m(n=n.call(e,t||"default")))return n;throw new TypeError("@@toPrimitive must return a primitive value.")})(e,"string"),"symbol"==m(e)?e:e+""))(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function te(e,f){document.addEventListener("keydown",function(e){var s,l,a,r,o,i,c,u,t,n,d,p,m=this;wp.data.select("core/block-editor").getSelectedBlock();wp.keycodes.isKeyboardEvent.primary(e,"y")&&(e.stopImmediatePropagation(),s=(d=wp.data.select("mdstore").getredoData()).pop())&&(null!=(p=r=document.getElementById(s.id))&&p.classList.contains("cm-board")&&r.classList.add("cls-board-outer"),l=s.id,r&&r.classList.contains("cls-board-outer")?setTimeout(function(){jQuery("#"+l).show();var e,t=s.content,n=document.querySelector("#block-"+s.clientId),n=(null!=n&&n.classList.contains("cf-onwhole-block__comment")&&(n.innerHTML=s.content,n.classList.add("cf-onwhole-block__comment"),document.querySelector(".cf-icon-wholeblock__comment[datatext="+s.id+"]").style.display="block"),document.createElement("div")),t=(n.innerHTML=t,n.innerHTML),n=!1;!0===(null==(e=wp.data.select("core/editor").getEditedPostAttribute("meta"))?void 0:e._sb_is_suggestion_mode)&&(n=!0,wp.data.dispatch("core/editor").editPost({meta:{_sb_is_suggestion_mode:!1}})),wp.data.dispatch("core/block-editor").updateBlockAttributes(s.clientId,{content:t}),!0===n&&wp.data.dispatch("core/editor").editPost({meta:{_sb_is_suggestion_mode:!0}}),jQuery("#".concat(l)).attr("data-rich-text-format-boundary",!0),jQuery("#".concat(l)).addClass("cls-board-outer sg-board is-open focus onGoing"),setTimeout(function(){floatCommentsBoard(l)},300)},300):setTimeout(function(){wp.data.dispatch("core/editor").editPost({meta:{_sb_is_suggestion_mode:!1}}),jQuery("[data-sid='"+l+"']").show();var t,n,e=s.content,r=document.createElement("div"),e=(r.innerHTML=e,r.innerHTML),r=(wp.data.dispatch("core/editor").editPost({meta:{_sb_is_suggestion_mode:!1}}),s.clientId),o={},a=("core/table"!==(null==(a=wp.data.select("core/block-editor").getBlock(r))?void 0:a.name)||"body"!==f&&"newBody"!==f||(i=(a=(new DOMParser).parseFromString(e,"text/html")).getElementById(l))&&(i.outerHTML,o=ne(i,r,a),i=wp.data.select("core/block-editor").getBlock(r).attributes.body,0!==Object.keys(o).length&&void 0!==o&&(a=re(o.rowIndex,o.columnIndex,r,a),i[o.rowIndex].cells[o.columnIndex].content=a),e=ee()(i)),wp.data.dispatch("core/block-editor").updateBlockAttributes(r,T({},f,e)),null==(o=wp.data.select("core/editor").getEditedPostAttribute("meta"))?void 0:o._sb_suggestion_history),i=JSON.parse(a),r=[];i[l]?(t=l,n=s.data,setTimeout(function(){var e=null==(e=wp.data.select("core/editor").getEditedPostAttribute("meta"))?void 0:e._sb_suggestion_history,e=JSON.parse(e);void 0===e?(e={})[t]=n:e[t]?Object.assign(e[t][0],n):e[t]=n,wp.data.dispatch("core/editor").editPost({meta:{_sb_suggestion_history:JSON.stringify(e)}})},300)):(r.push(s.data),i[l]=r,wp.data.dispatch("core/editor").editPost({meta:{_sb_suggestion_history:JSON.stringify(i)}})),setTimeout(function(){wp.data.dispatch("core/editor").editPost({meta:{_sb_is_suggestion_mode:!0}})},300),setTimeout(function(){jQuery("#sg".concat(l)).attr("data-rich-text-format-boundary",!0),jQuery("#sg".concat(l)).addClass("cls-board-outer sg-board is-open focus onGoing"),jQuery("#sg".concat(l)).removeClass("undo-suggestion"),floatCommentsBoard(l)},300)},500),p=[],null!==(n=wp.data.select("mdstore").getundoData())?(n.push(s),p=n):p.push(s),wp.data.dispatch("mdstore").setundoData(p)),wp.keycodes.isKeyboardEvent.primary(e,"z")&&(e.stopImmediatePropagation(),a=wp.data.select("mdstore").getundoData().pop())&&(e=null==(n=r=document.getElementById(a.id))||null==(n=n.closest(".block-editor-block-list__block"))?void 0:n.getAttribute("data-block"),o=null==(n=wp.data.select("core/block-editor").getBlock(e))?void 0:n.name,i={},"core/table"!==o||"body"!==f&&"newbody"!==f||(i=ne(r,e)),r&&r.classList.contains("cls-board-outer")?(c=null==(n=jQuery("[datatext='"+a.id+"']").closest(".block-editor-block-list__block"))?void 0:n.attr("data-block"),t=jQuery("#block-"+c).html(),a.content=t,a.clientId=c,setTimeout(function(){var e=!1,t=(!0===(null==(t=wp.data.select("core/editor").getEditedPostAttribute("meta"))?void 0:t._sb_is_suggestion_mode)&&(e=!0,wp.data.dispatch("core/editor").editPost({meta:{_sb_is_suggestion_mode:!1}})),wp.data.select("core/block-editor").getBlockAttributes(c)),n=document.querySelector("[datatext='"+a.id+"']"),r=document.querySelector("#block-"+c),o=(null!=r&&r.classList.contains("cf-onwhole-block__comment")?(t.className=null==t||null==(o=t.className)?void 0:o.replace(/(cf-onwhole-block__comment)\s*/g,""),r.classList.remove("cf-onwhole-block__comment"),r.innerHTML=a.content,document.querySelector(".cf-icon-wholeblock__comment[datatext="+a.id+"]").style.display="none"):n.replaceWith(a.data.commentedOnText),jQuery("#"+a.id).hide(),jQuery("#"+a.id).removeClass("cls-board-outer"),jQuery("#block-"+c).html()),r=document.createElement("div"),n=(r.innerHTML=o,r.innerHTML);wp.data.dispatch("core/block-editor").updateBlockAttributes(c,{content:n,className:t.className}),!0===e&&setTimeout(function(){wp.data.dispatch("core/editor").editPost({meta:{_sb_is_suggestion_mode:!0}})},500)},300)):(u=null==(e=jQuery("#".concat(a.id)).closest(".block-editor-block-list__block"))?void 0:e.attr("data-block"),t=jQuery("#block-"+u).html(),"caption"===f?(e=null==(n=document.getElementById("block-"+u))?void 0:n.getElementsByTagName("figcaption")[0],a.content=e.innerHTML):a.content=t,a.clientId=u,setTimeout(function(){var e,t,n=null==(n=wp.data.select("core/editor").getEditedPostAttribute("meta"))?void 0:n._sb_suggestion_history,n=JSON.parse(n),n=(delete n[a.id],wp.data.dispatch("core/editor").editPost({meta:{_sb_suggestion_history:JSON.stringify(n)}}),wp.data.dispatch("core/editor").editPost({meta:{_sb_is_suggestion_mode:!1}}),m.getElementById(a.id));n&&("Delete"===a.data.action?n.outerHTML=null==(e=r)?void 0:e.textContent:n.outerHTML=a.data.oldvalue||"",jQuery("[data-sid='"+a.id+"']").hide(),e=jQuery("#block-"+u).html(),(n=document.createElement("div")).innerHTML=e,e=n.innerHTML,"core/table"!==o||"body"!==f&&"newbody"!==f||(n=wp.data.select("core/block-editor").getBlock(u).attributes.body,0!==Object.keys(i).length&&void 0!==i&&(t=re(i.rowIndex,i.columnIndex,u),n[i.rowIndex].cells[i.columnIndex].content=t),e=ee()(n)),"caption"===f?(n=null==(t=document.getElementById("block-"+u))?void 0:t.getElementsByTagName("figcaption")[0],wp.data.dispatch("core/block-editor").updateBlockAttributes(u,T({},f,null==n?void 0:n.innerHTML))):wp.data.dispatch("core/block-editor").updateBlockAttributes(u,T({},f,e)),jQuery("#sg".concat(a.id)).addClass("undo-suggestion")),setTimeout(function(){wp.data.dispatch("core/editor").editPost({meta:{_sb_is_suggestion_mode:!0}})},500)},300)),p=[],null!==(d=wp.data.select("mdstore").getredoData())?(d.push(a),p=d):p.push(a),wp.data.dispatch("mdstore").setredoData(p))})}function ne(e,t,n){for(var r={},o=void 0!==n?n.querySelectorAll(".wp-block-table__cell-content"):document.querySelectorAll("#block-"+t+" .wp-block-table__cell-content"),a=e.outerHTML,i=0;i{if(Array.isArray(e))return _(e)})(e)||(e=>{if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)})(e)||((e,t)=>{var n;if(e)return"string"==typeof e?_(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_(e,t):void 0})(e)||(()=>{throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function _(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n(e=((e,t)=>{if("object"!=v(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0===n)return("string"===t?String:Number)(e);if("object"!=v(n=n.call(e,t||"default")))return n;throw new TypeError("@@toPrimitive must return a primitive value.")})(e,"string"),"symbol"==v(e)?e:e+""))(r.key),r)}}function ie(e,t,n){t=A(t);var r=e,t=se()?Reflect.construct(t,n||[],A(e).constructor):t.apply(e,n);if(!t||"object"!=v(t)&&"function"!=typeof t){if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(t=r))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t}function se(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(se=function(){return!!e})()}function A(e){return(A=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function le(e,t){return(le=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}var S=wp.i18n.__,s,s;(s=wp.components).Button,(s=wp.element).createRef;var s,N=(s=wp.data).dispatch,k=s.select,ce=(wp.blockEditor.MediaUpload,wp.richText.removeFormat),ue=(/^((?!chrome|android).)*safari/i.test(navigator.userAgent),(e=>{function s(e){var o;if(!(this instanceof s))throw new TypeError("Cannot call a class as a function");(o=ie(this,s,[e])).contentEditable=b.createRef(),o.displayComments=o.displayComments.bind(o),o.updateComment=o.updateComment.bind(o),o.removeComment=o.removeComment.bind(o),o.addNewComment=o.addNewComment.bind(o),o.cancelComment=o.cancelComment.bind(o);var e=wp.data.select("core/editor").getCurrentPostId(),a=[],i=o.props.datatext,t="txt"+i,n="_"+i;if(setTimeout(function(){var e=document.querySelector("#".concat(i," textarea"));e&&e.setAttribute("id",t)},3e3),o.commentedOnText=o.props.commentedOnText,1!==o.props.freshBoard)wp.apiFetch({path:"cf/cf-get-comments-api/?currentPostID="+e+"&elID="+n}).then(function(e){var t=e.userDetails,n=e.resolved,r=e.assignedTo;if(o.commentedOnText=void 0!==o.commentedOnText?o.commentedOnText:e.commentedOnText,o.assignedTo=r,"true"===n||0===t.length)return e=i,(r=document.querySelector('[datatext="'.concat(i,'"]')))&&r.classList.remove("commentIcon"),n=r?r.getAttribute("data-type"):null,r=r?r.getAttribute("data-block"):null,h.text.includes(n)?(removeTag(e),(n=document.getElementById(e))&&n.remove()):(N("core/block-editor").updateBlock(r,{attributes:{datatext:""}}),(e=document.getElementById(i))&&e.remove()),!1;t.forEach(function(e,t){a.push(e)}),o.hasComments=0!==a.length?1:0,o.state={comments:[a]},o.setState({comments:a})});else try{o.currentUserName=wp.data.select("core").getCurrentUser().name;var r=wp.data.select("core").getCurrentUser().avatar_urls;o.currentUserProfile=r[Object.keys(r)[1]]}catch(e){o.currentUserName=localStorage.getItem("userName"),o.currentUserProfile=localStorage.getItem("userURL")}return o.state={comments:[],newcommentText:""},o}var t,n=s;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),e&&le(n,e),n=s,(e=[{key:"removeAttachment",value:function(e,t,n,r){wp.data.select("core/editor").getCurrentPostId();var o=document.querySelector("#".concat(t," .attachment-text")),o=(o&&(o.innerHTML=""),document.querySelector("#".concat(t," #cf_thumb_file")));o&&(o.innerHTML=""),N("core/editor").editPost({meta:{reflect_comments_changes:1}})}},{key:"removeComment",value:function(e,t,n){var r=this.state.comments;r.splice(e,1);e={action:"cf_delete_comment",currentPostID:wp.data.select("core/editor").getCurrentPostId(),timestamp:t,metaId:n="_"+n},t=new URLSearchParams(e).toString();fetch(ajaxurl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t}).then(function(e){return e.text()}).then(function(){N("core/editor").editPost({meta:{reflect_comments_changes:1}})}).catch(function(e){return console.error("Error:",e)}),this.setState({comments:r,newcommentText:""}),N("core/editor").autosave()}},{key:"updateComment",value:function(e,o,t,n,r,a,i,s,l){var c=this,u=this.state.comments,d="",p="",m="",f="";try{d=k("core").getCurrentUser().id,p=k("core").getCurrentUser().name,m=k("core").getUser(d).roles[0],f=(f=k("core").getCurrentUser().avatar_urls)[Object.keys(f)[1]]}catch(e){d=localStorage.getItem("userID"),p=localStorage.getItem("userName"),m=localStorage.getItem("userRole"),f=localStorage.getItem("userURL")}p={userName:p,userRole:m,profileURL:f,dtTime:n,thread:e,userData:d,index:o,status:"publish",timestamp:t,editedTime:a,editedTimestamp:i,assignedText:s,attachmentText:l};u[o]=p;r="_"+r;m={action:"cf_update_comment",currentPostID:k("core/editor").getCurrentPostId(),editedComment:JSON.stringify(p),metaId:r},f=new URLSearchParams(m).toString();fetch(ajaxurl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:f}).then(function(e){return e.json()}).then(function(e){if(void 0!==e.error)return alert(e.error),!1;N("core/editor").editPost({meta:{reflect_comments_changes:1}}),e.arr.thread&&(u[o].thread=e.arr.thread);var t=k("mdstore").getAllCommentCount();if(void 0!==(null==t?void 0:t.length))for(var n,r=0;r<(null==(n=t[o])||null==(n=n.activities)?void 0:n.length);r++)t[o].activities[r].id===e.arr.timestamp&&(t[o].activities[r].thread=e.arr.thread,N("mdstore").setAllCommentCount(t));c.setState({comments:u}),N("core/editor").autosave()}).catch(function(e){return console.error("Error:",e)})}},{key:"addNewComment",value:function(e){e.preventDefault();var t=this.props,r=t.datatext,o="txt"+r,t=null==(t=document.getElementById(o))?void 0:t.innerHTML,n=null==(n=document.getElementById("cf_thumb_file"))?void 0:n.innerHTML,t=filterTextBeforeSave(t),a=validateCommentReplyText(t);if(""!==t&&""!==a&&/\S/g.test(a)){var a="",i="",s="",l="";try{a=k("core").getCurrentUser().id,s=k("core").getUser(a).roles[0],i=k("core").getCurrentUser().name}catch(e){a=localStorage.getItem("userID"),i=localStorage.getItem("userName"),s=localStorage.getItem("userRole")}var l="1"===localStorage.getItem("showAvatars")?(l=k("core").getCurrentUser().avatar_urls)[Object.keys(l)[1]]:localStorage.getItem("userURL"),c=this.state.comments,u=document.querySelector('[datatext="'.concat(this.props.datatext,'"]')).getAttribute("data-type"),d=(h.media.includes(u)||(u=h.text.includes(u)||null==u?"":"md-block"),{}),a=(d.userData=a,d.thread=t,d.commentedOnText=void 0!==this.commentedOnText?this.commentedOnText:"",d.userName=i,d.userRole=s,d.profileURL=l,d.status="publish",d.blockType=u,d.attachmentText=n,k("core/editor").getCurrentPostId()),p=o.substring(3),m="_"+p,t="",s=(null!=(i=document.querySelector("#".concat(p," .cf-assign-to-user")))&&i.checked&&(t=document.querySelector("#".concat(p," .cf-assign-to-user")).value),d.assigned=t,c.push(d),{action:"cf_add_comment",currentPostID:a,commentList:JSON.stringify(c),metaId:m,assignTo:t,blockType:u}),f=(document.querySelector("#".concat(p," .shareCommentContainer")).classList.add("loading"),this),l=new Event("editorLayoutUpdate");document.dispatchEvent(l),fetch(ajaxurl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(s).toString()}).then(function(e){return e.json()}).then(function(e){if(document.querySelector("#".concat(p," .shareCommentContainer")).classList.remove("loading"),document.querySelectorAll(".fresh-board").forEach(function(e){return e.classList.remove("fresh-board")}),void 0!==e.error)return alert(e.error),!1;c[c.length-1].dtTime=e.dtTime,c[c.length-1].timestamp=e.timestamp,c[c.length-1].assignedText=e.assignedText,null!==e.assignedTo&&(t=e.assignedTo.display_name||S("Unknown User","content-collaboration-inline-commenting"),t='\n
\n
\n
\n ').concat(e.assignedTo.display_name,'\n
\n \n
\n
\n "),(n=document.querySelector("#".concat(p," .cf-board-assigned-to")))&&n.remove(),n=document.querySelector("#".concat(p," .boardTop")))&&n.insertAdjacentHTML("beforebegin",DOMPurify.sanitize(t)),f.hasComments=1,N("core/editor").editPost({meta:{reflect_comments_changes:1}}),e.arr.thread&&(n=c.length-1,c[n].thread=e.arr.thread),f.setState({comments:c,newcommentText:"",mediaId:"",mediaName:"",mediaUrl:""});var t=k("mdstore").getAllCommentCount(),n=(void 0!==(null==t?void 0:t.length)&&(c[0].elID=m.replace("_",""),null!=t&&t.push.apply(t,oe(c)),N("mdstore").setAllCommentCount(t)),k("mdstore").getundoData()),e=[],t=Object.assign({},c[0]),n=(null!==n?(n.push({id:r,data:t}),e=n):e.push({id:r,data:t}),N("mdstore").setundoData(e),te(),document.getElementById(o).innerHTML="",document.getElementById(o).focus(),document.getElementById("cf_thumb_file"));n&&(n.innerHTML=""),document.querySelectorAll(".cf-assign-to").forEach(function(e){return e.remove()})}),N("core/editor").autosave()}else{if(e.currentTarget.classList.contains("btn-disabled"))return!1;y(S("Please add some comment.","content-collaboration-inline-commenting"))}}},{key:"displayComments",value:function(t,e){var n,r,o,a,i,s,l,c,u,d,p,m,f,h,g,E=this.props,y=E.lastVal,T=E.onChanged,E=E.selectedText,v=(Object.keys(t).map(function(e){"userName"===e?n=t[e]:"userRole"===e?r=t[e]:"dtTime"===e?o=t[e]:"thread"===e?a=t[e]:"profileURL"===e?i=t[e]:"userData"===e?s=parseInt(t[e],10):"status"===e?l=t[e]:"timestamp"===e?c=t[e]:"editedDraft"===e?u=t[e]:"updatedTime"===e?d=t[e].toString():"blockType"===e?p=t[e]:"assignedText"===e?m=t[e]:"editedTimestamp"===e?f=t[e]:"attachmentText"===e&&(h=t[e])}),m),_=(null!=(_=v)&&_.includes("Assigned to You")?v=wp.i18n.__("Assigned to You","content-collaboration-inline-commenting"):null!=(_=v)&&_.includes("Reassigned to You")?v=wp.i18n.__("Reassigned to You","content-collaboration-inline-commenting"):null!=(_=v)&&_.includes("Assigned to")?(g=v.split("Assigned to"),v=sprintf(S("Assigned to %s","content-collaboration-inline-commenting"),g[1])):null!=(_=v)&&_.includes("Reassigned to ")&&(g=v.split("Reassigned to"),v=sprintf(S("Reassigned to %s","content-collaboration-inline-commenting"),g[1])),m=v,k("core/editor").getCurrentPost());return(null==_?void 0:_.author)===s&&(r="Owner"),b.createElement(Z,{key:e,index:e,removeCommentFromBoard:this.removeComment,updateCommentFromBoard:this.updateComment,removeAttachmentFromBoard:this.removeAttachment,userName:n,userRole:r,dateTime:o,profileURL:i,userID:s,status:l,lastVal:y,onChanged:T,selectedText:E,timestamp:c,editedDraft:u,editedTime:d,editedTimestamp:f&&f.toString(),blockType:p,assignedText:m,attachmentText:h,showAvatars:localStorage.getItem("showAvatars")},a=a||t)}},{key:"cancelComment",value:function(){var t=this,e=this.props,n=e.datatext,r=e.onChanged,e=e.lastVal,o=document.querySelector('[datatext="'.concat(n,'"]')),a=o.closest("[data-block]"),i=null==o?void 0:o.getAttribute("data-type"),s=null==a?void 0:a.getAttribute("data-type"),a=null==a?void 0:a.getAttribute("data-block"),l=k("core/block-editor").getSelectedBlock(),a=a||(null==l?void 0:l.clientId),l=k("core/block-editor").getBlockAttributes(a),c=null==o?void 0:o.getAttribute("data-block");0===document.querySelectorAll("#".concat(n," .boardTop .commentContainer")).length&&(null!=i?(null!=o&&o.classList.remove("commentIcon"),N("mdstore").setIsActive(!1),N("core/block-editor").updateBlock(c,{attributes:{datatext:""}})):null!=s&&s.startsWith("acf/")&&void 0!==s&&null!==i?(removeAcfTag(l,a,n),N("mdstore").setIsActive(!1)):e&&r(ce(e,"multidots/comment")),null!=(o=document.getElementById(n))&&o.remove(),c=new Event("editorLayoutUpdate"),document.dispatchEvent(c)),setTimeout(function(){document.querySelectorAll("#cf-comment-board-wrapper .cls-board-outer").forEach(function(e){return e.classList.remove("focus")}),document.querySelectorAll(".cf-icon__addBlocks, .cf-icon__removeBlocks").forEach(function(e){return e.classList.remove("focus")}),document.querySelectorAll(".cf-icon-wholeblock__comment").forEach(function(e){e.classList.remove("focus"),e.classList.remove("is-selected")}),document.querySelectorAll(".cf-onwhole-block__comment").forEach(function(e){return e.classList.remove("focus")}),document.querySelectorAll("#cf-comment-board-wrapper .cls-board-outer").forEach(function(e){return e.removeAttribute("style")}),document.querySelectorAll("#cf-comment-board-wrapper .cls-board-outer .shareCommentContainer").forEach(function(e){return e.removeAttribute("style")}),document.querySelectorAll("[data-rich-text-format-boundary]").forEach(function(e){return e.removeAttribute("data-rich-text-format-boundary")}),document.querySelectorAll(".cf-assign-to").forEach(function(e){return e.remove()}),document.querySelectorAll("#cf-comment-board-wrapper .comment-delete-overlay").forEach(function(e){return e.classList.remove("show")}),document.querySelectorAll(".commentIcon").forEach(function(e){return e.classList.remove("is-selected")}),document.querySelectorAll("#cf-comment-board-wrapper .cls-board-outer .buttons-wrapper").forEach(function(e){return e.classList.remove("active")});var e=document.getElementById("txt"+n),e=(e&&(e.innerHTML=""),document.getElementById("cf_thumb_file")),e=(e&&(e.innerHTML=""),t.setState({newcommentText:"",mediaId:"",mediaName:"",mediaUrl:""}),new Event("showHideComments"));document.dispatchEvent(e),document.querySelectorAll(".js-activity-centre .user-data-row").forEach(function(e){return e.classList.remove("active")})},200)}},{key:"deleteAttachment",value:function(){this.setState({attachmentText:"",mediaId:"",mediaName:"",mediaUrl:""});var e=document.getElementById("cf_thumb_file");e&&(e.innerHTML="")}},{key:"componentDidMount",value:function(){var t;this.props.freshBoard&&(t=this.props.datatext,setTimeout(function(){var e=document.getElementById("txt"+t);e&&e.focus()},500))}},{key:"render",value:function(){var n=this,e=this.props,e=e.datatext,t=1===this.hasComments?S("Reply","content-collaboration-inline-commenting"):S("Comment","content-collaboration-inline-commenting"),r=1===this.hasComments?S("Reply to this comment","content-collaboration-inline-commenting"):S("Post Comment","content-collaboration-inline-commenting"),o=this.assignedTo,a=1===this.hasComments||void 0===this.hasComments?S("Reply or add others with @","content-collaboration-inline-commenting"):S("Comment or add others with @","content-collaboration-inline-commenting"),i=(this.props.freshBoard&&(a=S("Comment or add others with @","content-collaboration-inline-commenting")),this.state.comments.length),s="none",l=(i>getCommentsLimit()&&(s="block"),this.state.newcommentText),l=""===validateCommentReplyText(l)?"btn-disabled":"";return b.createElement("div",{className:"board ".concat(void 0===this.hasComments&&this.currentUserProfile&&"fresh-board")},null!=o&&b.createElement("div",{className:"cf-board-assigned-to","data-user-id":o.ID,"data-user-email":o.user_email},b.createElement("div",{className:"assigned-user-details"},b.createElement("div",{className:"user-avatar"},b.createElement("img",{src:o.avatar,alt:o.display_name})),b.createElement("div",{className:"user-info"},b.createElement("span",{className:"badge"},S("Assigned to","content-collaboration-inline-commenting")),b.createElement("p",{className:"display-name"},o.display_name?S(o.display_name.charAt(0).toUpperCase()+o.display_name.slice(1),"content-collaboration-inline-commenting"):S("Unknown User","content-collaboration-inline-commenting"))))),b.createElement("div",{className:"boardTop"},this.state.comments&&this.state.comments.map(function(e,t){return n.displayComments(e,t)}),b.createElement("div",{className:"show-all-comments",style:{display:s}},sprintf(S("Show all %d replies"),i-1))),void 0===this.hasComments&&this.currentUserProfile&&b.createElement("div",{className:"commentContainer"},b.createElement("div",{className:"commentInnerContainer"},b.createElement("div",{className:"comment-header"},b.createElement("div",{className:"comment-details"},b.createElement("div",{className:"avatar"},b.createElement("img",{src:this.currentUserProfile,alt:"avatar"})),b.createElement("div",{className:"commenter-name-time"},b.createElement("div",{className:"commenter-name"},this.currentUserName.charAt(0).toUpperCase()+this.currentUserName.slice(1))))))),b.createElement("div",{className:"shareCommentContainer"},b.createElement("div",{className:"cf-share-comment-wrapper js-cf-share-comment-wrapper"},b.createElement(c(),{innerRef:this.contentEditable,html:this.state.newcommentText,disabled:!1,onChange:function(e){return n.setState({newcommentText:e.target.value})},id:"txt"+e,className:"cf-share-comment js-cf-share-comment",placeholder:a}),b.createElement("div",{className:"cf-commentboard-attach-wrap"},null!=this.state.mediaId&&b.createElement("div",{id:"cf_thumb_file"},b.createElement("a",{href:this.state.mediaUrl,target:"_blank"},this.state.mediaName)),b.createElement("div",{className:"btn-wrapper"},b.createElement("button",{onClick:this.addNewComment,className:"btn btn-success ".concat(l)},t,b.createElement("span",{className:"tooltip"},r)),b.createElement("button",{onClick:this.cancelComment,className:"btn btn-cancel"},S("Cancel","content-collaboration-inline-commenting")," ",b.createElement("span",{className:"tooltip"},S("Discard Comment","content-collaboration-inline-commenting"))))))))}}])&&ae(n.prototype,e),t&&ae(n,t),Object.defineProperty(n,"prototype",{writable:!1}),n})(b.Component)),de=(ue.propTypes={lastVal:i().object,datatext:i().string,onChanged:i().func,selectedText:i().string,commentedOnText:i().string,freshBoard:i().number,onLoadFetch:i().number},r(5338));function O(e){return(O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function pe(e){return(e=>{if(Array.isArray(e))return C(e)})(e)||(e=>{if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)})(e)||fe(e)||(()=>{throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function M(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */M=function(){return i};var l,i={},e=Object.prototype,c=e.hasOwnProperty,u=Object.defineProperty||function(e,t,n){e[t]=n.value},t="function"==typeof Symbol?Symbol:{},r=t.iterator||"@@iterator",n=t.asyncIterator||"@@asyncIterator",o=t.toStringTag||"@@toStringTag";function a(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{a({},"")}catch(l){a=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var o,a,i,s,t=t&&t.prototype instanceof E?t:E,t=Object.create(t.prototype),r=new k(r||[]);return u(t,"_invoke",{value:(o=e,a=n,i=r,s=p,function(e,t){if(s===f)throw Error("Generator is already running");if(s===h){if("throw"===e)throw t;return{value:l,done:!0}}for(i.method=e,i.arg=t;;){var n=i.delegate;if(n){n=function e(t,n){var r=n.method,o=t.iterator[r];if(o===l)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=l,e(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;r=d(o,t.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,g;o=r.arg;return o?o.done?(n[t.resultName]=o.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=l),n.delegate=null,g):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}(n,i);if(n){if(n===g)continue;return n}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(s===p)throw s=h,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);s=f;n=d(o,a,i);if("normal"===n.type){if(s=i.done?h:m,n.arg===g)continue;return{value:n.arg,done:i.done}}"throw"===n.type&&(s=h,i.method="throw",i.arg=n.arg)}})}),t}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}i.wrap=s;var p="suspendedStart",m="suspendedYield",f="executing",h="completed",g={};function E(){}function y(){}function T(){}var t={},v=(a(t,r,function(){return this}),Object.getPrototypeOf),v=v&&v(v(C([]))),_=(v&&v!==e&&c.call(v,r)&&(t=v),T.prototype=E.prototype=Object.create(t));function b(e){["next","throw","return"].forEach(function(t){a(e,t,function(e){return this._invoke(t,e)})})}function A(i,s){var t;u(this,"_invoke",{value:function(n,r){function e(){return new s(function(e,t){!function t(e,n,r,o){var a,e=d(i[e],i,n);if("throw"!==e.type)return(n=(a=e.arg).value)&&"object"==O(n)&&c.call(n,"__await")?s.resolve(n.__await).then(function(e){t("next",e,r,o)},function(e){t("throw",e,r,o)}):s.resolve(n).then(function(e){a.value=e,r(a)},function(e){return t("throw",e,r,o)});o(e.arg)}(n,r,e,t)})}return t=t?t.then(e,e):e()}})}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function N(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function k(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function C(t){if(t||""===t){var n,e=t[r];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return n=-1,(e=function e(){for(;++n{if(Array.isArray(e))return e})(e)||((e,t)=>{var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,s=[],l=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw o}}return s}})(e,t)||fe(e,t)||(()=>{throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function fe(e,t){var n;if(e)return"string"==typeof e?C(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?C(e,t):void 0}function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{s=M().mark(function e(){var t,n;return M().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,n=null!=(n=wp.data.select("core/editor").getCurrentPostId())?n:document.getElementById("post_ID").value,n="".concat(activityLocalizer.apiUrl,"/cf/v2/activities?postID=").concat(n),e.next=5,fetch(n,{method:"GET",headers:{"X-WP-Nonce":activityLocalizer.nonce}});case 5:if((t=e.sent).ok){e.next=8;break}throw new Error("Network response was not ok");case 8:return e.next=10,t.json();case 10:n=e.sent,p(0{if("object"!=R(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0===n)return("string"===t?String:Number)(e);if("object"!=R(n=n.call(e,t||"default")))return n;throw new TypeError("@@toPrimitive must return a primitive value.")})(e,"string");return"symbol"==R(e)?e:e+""}var I,H=wp.i18n.__,U=wp.element.Fragment,s=wp.plugins.registerPlugin,i,Re=(i=wp.editPost).PluginSidebar,Le=i.PluginSidebarMoreMenuItem,i,Ie=(i=wp.components).PanelBody,Me=i.TabPanel,xe=i.ToggleControl,j=jQuery,F=wp.i18n.sprintf,i,Pe=((i=wp.keycodes).displayShortcut,i.isKeyboardEvent),i,De=((i=wp.hooks).addFilter,(e=>{function i(e){var t;if(!(this instanceof i))throw new TypeError("Cannot call a class as a function");t=ke(this,i,[e]),e=t,r=function(e){wp.data.dispatch("mdstore").setShowActivities(e),t.setState({showActivities:e}),t.setState({isLoading:e}),t.getComments()},(n=we(n="enableshowActivitiesToggleUpdate"))in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r;var e=wp.data.select,n=e("mdstore").getShowActivities(),r=e("mdstore").getShowComments(),o=null==(o=e("core/editor").getEditedPostAttribute("meta"))?void 0:o._sb_show_suggestion_boards,a=null==(a=e("core/editor").getEditedPostAttribute("meta"))?void 0:a._is_real_time_mode,e=e("mdstore").getSuggestionMode();return t.state={threads:[],isLoading:!1,showActivities:n,showComments:r,collapseLimit:50,hasAccordian:!1,hasAccordianSuggestions:!1,hasAccordionReviewSugesstions:!1,suggestionEnable:e,suggestionBoardsEnable:o,enableCoEditing:a,usersWithAccess:[]},t.postID=wp.data.select("core/editor").getCurrentPostId(),t.edit=t.edit.bind(t),t.reply=t.reply.bind(t),t.delete=t.delete.bind(t),t.toggleCollapseLink=t.toggleCollapseLink.bind(t),t.resolveThread=t.resolveThread.bind(t),t.handleShowComments=t.handleShowComments.bind(t),t.getComments=t.getComments.bind(t),t.currentUserID=activityLocalizer.currentUserID,t.setUserFlag,t.enableshowActivitiesToggleUpdate=t.enableshowActivitiesToggleUpdate.bind(t),t}var t,n=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),e&&Oe(n,e),n=i,(e=[{key:"collapseBoardOnMobile",value:function(){var e;window.innerWidth<=768&&(this.setState({showComments:wp.data.dispatch("mdstore").setShowComments(!1)}),(e=document.body).classList.add("hide-comments"),e.classList.remove("commentOn"),e=new CustomEvent("editorLayoutUpdate"),document.dispatchEvent(e))}},{key:"collapseText",value:function(e){var t=this.state.collapseLimit;return null!==t&&e&&t<=e.replace(/<\/?[^>]+(>|$)/g,"").length&&(e=e.slice(0,t)+(e.length>t?"...":"")),H(e,"content-collaboration-inline-commenting")}},{key:"toggleCollapseLink",value:function(e){var t=e.target.dataset.id,e=e.target,n=H("Show more","content-collaboration-inline-commenting"),r=H("Show less","content-collaboration-inline-commenting");e.innerHTML===n?(e.innerHTML=r,document.getElementById("show-all-".concat(t)).classList.remove("js-hide"),document.getElementById("show-less-".concat(t)).classList.add("js-hide")):(e.innerHTML=n,document.getElementById("show-all-".concat(t)).classList.add("js-hide"),document.getElementById("show-less-".concat(t)).classList.remove("js-hide"))}},{key:"getComments",value:function(){var e,n=this;wp.data.select("mdstore").getShowActivities()?(e="".concat(activityLocalizer.apiUrl,"/cf/v2/activities?postID=").concat(this.postID),fetch(e,{method:"GET",headers:{"X-WP-Nonce":activityLocalizer.nonce}}).then(function(e){if(e.ok)return e.json();throw new Error("Network response was not ok")}).then(function(e){var t=0%s',H("Suggestion mode is limited to a few blocks and actions only.","content-collaboration-inline-commenting"),H("Check compatibility.","content-collaboration-inline-commenting")),y(e),cf_removeAllNotices(),wp.data.dispatch("core/notices").createNotice("success",H("Suggestion Mode is ON","content-collaboration-inline-commenting"),{id:"suggestionModeOn",type:"snackbar",isDismissible:!0})):(cf_removeAllNotices(),wp.data.dispatch("core/notices").createNotice("success",H("Suggestion Mode is OFF","content-collaboration-inline-commenting"),{id:"suggestionModeOff",type:"snackbar",isDismissible:!0}))}},{key:"acceptAllSuggestions",value:function(){var e=new SuggestionComment,t=document.querySelectorAll(".cls-board-outer .sg-board").length;e.acceptAllSuggestion(),cf_removeAllNotices(),wp.data.dispatch("core/notices").createNotice("success",F("%s (%d)",H("Suggestions Accepted","content-collaboration-inline-commenting"),t),{id:"suggestionsAccepted",type:"snackbar",isDismissible:!0}),e.acceptAllSuggestion(),(new i).getComments()}},{key:"rejectAllSuggestions",value:function(){var e=new SuggestionComment,t=document.querySelectorAll(".cls-board-outer .sg-board").length;e.rejectAllSuggestion(),cf_removeAllNotices(),wp.data.dispatch("core/notices").createNotice("success",F("%s (%d)",H("Suggestions Rejected","content-collaboration-inline-commenting"),t),{id:"suggestionsRejected",type:"snackbar",isDismissible:!0}),(new i).getComments()}},{key:"render",value:function(){var t,n,a,r,i,o,s,l,c,u,e,d=this,p=wp.data.select("core/edit-post").isEditingTemplate();function m(e){e&&(e={elID:["sg",e].join("")},i.push(e))}return p?null:(e=this.state,t=e.threads,n=e.isLoading,a=e.collapseLimit,r=e.showActivities,this.postStatus=wp.data.select("core/editor").getCurrentPost().status,i=[],e=document.querySelector(".wp-block-post-content iframe"),p||e&&e.contentDocument?((p=e.contentDocument).querySelectorAll(".wp-block mdspan, .wp-block .mdadded, .wp-block .mdmodified, .wp-block .mdremoved, .commentIcon, .cf-onwhole-block__comment").forEach(function(e){e=e.getAttribute("datatext");e&&i.push({elID:e})}),p.querySelectorAll(".wp-block .mdadded, .wp-block .mdmodified, .wp-block .mdremoved, .commentIcon, .blockAdded, .blockremove, .cf-onwhole-block__comment").forEach(function(e){var t=e.getAttribute("id");(t=e.classList.contains("blockAdded")||e.classList.contains("blockremove")?e.getAttribute("suggestion_id"):t)&&i.push({elID:"sg".concat(t)})}),p.querySelectorAll("[textAlign_sg_id], [lock_sg_id], [align_sg_id], [width_sg_id], [url_sg_id], [link_sg_id], [style_sg_id], [minheight_sg_id], [contentposition_sg_id], [tracks_sg_id], [table_style_sg_id]").forEach(function(t){cfgetCustomAttribute().forEach(function(e){t.getAttribute(e)&&m(t.getAttribute(e))})})):(document.querySelectorAll(".commentIcon, .cf-onwhole-block__comment, .wp-block mdspan").forEach(function(e){e=e.getAttribute("datatext");e&&i.push({elID:e})}),document.querySelectorAll(".wp-block .mdadded, .wp-block .mdmodified, .wp-block .mdremoved, .blockAdded, .blockremove").forEach(function(e){var t=e.getAttribute("id");(t=e.classList.contains("blockAdded")||e.classList.contains("blockremove")?e.getAttribute("suggestion_id"):t)&&m(t)}),document.querySelectorAll("[textAlign_sg_id], [lock_sg_id], [align_sg_id], [width_sg_id], [url_sg_id], [link_sg_id], [style_sg_id], [minheight_sg_id], [contentposition_sg_id], [tracks_sg_id], [table_style_sg_id]").forEach(function(t){cfgetCustomAttribute().forEach(function(e){t.getAttribute(e)&&m(t.getAttribute(e))})})),o=[],s=[],l=0,null!==i&&null!=t&&(t.forEach(function(e){"false"===e.resolved&&o.push(e.elID)}),i.forEach(function(e){s.push(e.elID)}),c=new Set(s),(u=o.filter(function(e){return!c.has(e)})).forEach(function(e){e.match(/el/g)&&l++})),I=null==(e=wp.data.select("core/editor").getEditedPostAttribute("meta"))?void 0:e._sb_show_comment_boards,"1"!==cf_permissions.hide_comment&&(p=document.body,!I&&p.classList.contains("hide-comments")?p.classList.remove("hide-comments"):I&&!p.classList.contains("hide-comments")&&"1"!==cf_permissions.hide_comment&&(p.classList.add("hide-comments"),document.querySelectorAll("#cf-comment-board-wrapper .cls-board-outer.cm-board").forEach(function(e){e.classList.remove("focus"),e.classList.remove("is-open"),e.removeAttribute("style")}),document.querySelectorAll("mdspan").forEach(function(e){e.removeAttribute("data-rich-text-format-boundary")}))),"cf-activity-center/cf-activity-center"===wp.data.select("core/edit-post").getActiveGeneralSidebarName()&&setTimeout(function(){var e=document.getElementById("cf-comment-board-wrapper");(null==e?void 0:e.querySelector(".".concat("focus")))||document.querySelectorAll(".js-activity-centre .user-data-row").forEach(function(e){e.classList.remove("active")})},200),document.body.classList.contains("hide-sg")?document.body.classList.remove("hide-sg"):document.body.classList.contains("hide-sg")||((e=document.querySelector(".cls-board-outer.sg-board.focus"))&&(p=e.getAttribute("data-sid"),(e=document.getElementById(p))&&e.removeAttribute("data-rich-text-format-boundary"),wp.data.dispatch("mdstore").setDataText("")),document.body.classList.add("hide-sg"),document.querySelectorAll("#cf-comment-board-wrapper .cls-board-outer.sg-board").forEach(function(e){e.classList.remove("focus"),e.classList.remove("is-open")})),multicollab_fs.is_plan_free&&document.body.classList.remove("hide-sg"),0No recent activities found!")},200),React.createElement(Ie,{className:"cf-multicollab-sidebar-panel"},multicollab_fs.can_use_premium_code&&multicollab_fs.is_plan_pro&&"1"===cf_permissions.resolved_suggestion&&1=getCommentsLimit()?"none":""}},React.createElement("div",{className:"user-data"},React.createElement(ve,{c:e,th:n}),React.createElement("div",{className:"user-data-wrapper"},React.createElement("div",{className:"user-commented-on"},t<=0&&React.createElement(U,null,React.createElement("blockquote",{className:"user-commented-icon"+(n.blockType?"-"+n.blockType:"")+(n.action&&"delete"===n.action.toLowerCase()?" delete":" add")},"deleted"===e.status||"true"===n.resolved?React.createElement(U,null,"sg"===n.type?React.createElement(U,null,React.createElement("span",{id:"show-all-".concat(e.id),class:"user-commented-on show-all js-hide ","data-id":"cf-".concat(n.elID)},React.createElement(E,null,F("%s : %s",H(n.action,"content-collaboration-inline-commenting"),H(translateStringFormat(n.selectedText),"content-collaboration-inline-commenting")))),React.createElement("span",{id:"show-less-".concat(e.id),class:"user-commented-on show-less","data-id":"cf-".concat(n.elID)},React.createElement(E,null,d.collapseText(F("%s : %s",H(n.action,"content-collaboration-inline-commenting"),H(translateStringFormat(n.selectedText),"content-collaboration-inline-commenting")))))):React.createElement(U,null,React.createElement("span",{id:"show-all-".concat(e.id),class:"user-commented-on show-all js-hide ","data-id":"cf-".concat(n.elID)},React.createElement(E,null,translateStringFormat(n.selectedText))),React.createElement("span",{id:"show-less-".concat(e.id),class:"user-commented-on show-less","data-id":"cf-".concat(n.elID)},React.createElement(E,null,d.collapseText(translateStringFormat(n.selectedText))))),null!==n.selectedText&&a<=n.selectedText.replace(/<\/?[^>]+(>|$)/g,"").length&&React.createElement("a",{href:"javascript:void(0)",className:"cf-show-more","data-id":e.id,onClick:d.toggleCollapseLink.bind(d)},H("Show more","content-collaboration-inline-commenting"))):React.createElement(U,null,"sg"===n.type?React.createElement(U,null,React.createElement("a",{id:"show-all-".concat(e.id),class:"user-commented-on show-all js-hide ","data-elid":"cf-".concat(n.elID),href:"javascript:void(0)",onClick:d.reply.bind(d)},React.createElement(E,null,F("%s : %s",H(n.action,"content-collaboration-inline-commenting"),H(translateStringFormat(n.selectedText),"content-collaboration-inline-commenting")))),React.createElement("a",{id:"show-less-".concat(e.id),class:"user-commented-on show-less","data-elid":"cf-".concat(n.elID),href:"javascript:void(0)",onClick:d.reply.bind(d)},React.createElement(E,null,d.collapseText(F("%s : %s",H(n.action,"content-collaboration-inline-commenting"),H(translateStringFormat(n.selectedText),"content-collaboration-inline-commenting")))))):React.createElement(U,null,React.createElement("a",{id:"show-all-".concat(e.id),class:"user-commented-on show-all js-hide ","data-elid":"cf-".concat(n.elID),href:"javascript:void(0)",onClick:d.reply.bind(d)},React.createElement(E,null,translateStringFormat(n.selectedText))),React.createElement("a",{id:"show-less-".concat(e.id),class:"user-commented-on show-less","data-elid":"cf-".concat(n.elID),href:"javascript:void(0)",onClick:d.reply.bind(d)},React.createElement(E,null,d.collapseText(translateStringFormat(n.selectedText))))),null!==n.selectedText&&a<=n.selectedText.replace(/<\/[^>]+(>|$)/g,"").length&&React.createElement("a",{href:"javascript:void(0)",className:"cf-show-more","data-id":e.id,onClick:d.toggleCollapseLink.bind(d)},H("Show more","content-collaboration-inline-commenting")))))),React.createElement("div",{class:"user-comment"},0getCommentsLimit()&&React.createElement("div",{className:"show-all-comments"}," ",F(H("Show all %d replies"),n.activities.length-1)," "),"true"===n.resolved&&void 0!==n.resolvedBy&&React.createElement(Ee,{th:n}))})):"cf-settings"===e.name&&j(".cf-settings-tab-title").css("display","block")?React.createElement(Se,{handleShowComments:d.handleShowComments,enableCoEditing:d.enableCoEditing,postStatus:d.postStatus,commentBoardToggle:I}):"cf-comment-summary"===e.name&&j(".cf-comment-summary-tab-title").css("display","block")?React.createElement(React.Fragment,null,!0===n&&React.createElement("div",{className:"comment-summary-row-loading"},React.createElement("strong",null,H("Loading...","content-collaboration-inline-commenting"))),!1===n&&React.createElement(ge,{commentAutoDrafts:l,setDifference:u})):void 0}),React.createElement(U,null,React.createElement("div",{className:"cf-feedback-post-wrap__outer",style:{display:"none"}},React.createElement("div",{className:"cf-feedback-post-wrap__inner"},React.createElement("button",{className:"cf-feedback-post-wrap__button"},f.fbcommentIcon))))))}}])&&Ne(n.prototype,e),t&&Ne(n,t),Object.defineProperty(n,"prototype",{writable:!1}),n})(React.Component));s("cf-activity-center",{icon:f.multicollab,render:function(){return React.createElement(U,null,React.createElement(Le,{target:"cf-activity-center"},H("Multicollab","cf-activity-center")),React.createElement(Re,{name:"cf-activity-center",title:H("Multicollab","cf-activity-center")},React.createElement(De,null)))}})}})(); \ No newline at end of file +function a(e,t){var n=e.length;for(e.push(t);0>>1,o=e[r];if(!(0>>1;rt)||e&&!L());){var r,o=m.callback;"function"==typeof o?(m.callback=null,f=m.priorityLevel,r=o(m.expirationTime<=t),t=s.unstable_now(),"function"==typeof r?m.callback=r:m===l(d)&&c(d),v(t)):c(d),m=l(d)}var a,i=null!==m||(null!==(a=l(p))&&x(_,a.startTime-t),!1);return i}finally{m=null,f=n,h=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var A,S,N,k=!1,C=null,O=-1,w=5,R=-1;function L(){return!(s.unstable_now()-R{e.exports=n(7463)},6897:(e,t,n)=>{var r=n(453),i=n(41),s=n(592)(),l=n(5795),c=n(9675),u=r("%Math.floor%");e.exports=function(e,t){if("function"!=typeof e)throw new c("`fn` is not a function");if("number"!=typeof t||t<0||4294967295{var r=n(9995);function o(){r.call(this)}o.prototype=new r,((e.exports=o).Stream=o).prototype.pipe=function(t,e){var n=this;function r(e){t.writable&&!1===t.write(e)&&n.pause&&n.pause()}function o(){n.readable&&n.resume&&n.resume()}n.on("data",r),t.on("drain",o),t._isStdio||e&&!1===e.end||(n.on("end",i),n.on("close",s));var a=!1;function i(){a||(a=!0,t.end())}function s(){a||(a=!0,"function"==typeof t.destroy&&t.destroy())}function l(e){if(c(),!this.hasListeners("error"))throw e}function c(){n.off("data",r),t.off("drain",o),n.off("end",i),n.off("close",s),n.off("error",l),t.off("error",l),n.off("end",c),n.off("close",c),t.off("end",c),t.off("close",c)}return n.on("error",l),t.on("error",l),n.on("end",c),n.on("close",c),t.on("end",c),t.on("close",c),t.emit("pipe",n),t}},1135:e=>{e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},9032:(e,t,n)=>{var r=n(7244),o=n(8184),a=n(5767),i=n(5680);function s(e){return e.call.bind(e)}var l,c,u="undefined"!=typeof BigInt,d="undefined"!=typeof Symbol,p=s(Object.prototype.toString),m=s(Number.prototype.valueOf),f=s(String.prototype.valueOf),h=s(Boolean.prototype.valueOf);function g(e,t){if("object"!=typeof e)return!1;try{return t(e),!0}catch(e){return!1}}function E(e){return"[object Map]"===p(e)}function y(e){return"[object Set]"===p(e)}function T(e){return"[object WeakMap]"===p(e)}function v(e){return"[object WeakSet]"===p(e)}function _(e){return"[object ArrayBuffer]"===p(e)}function b(e){return"undefined"!=typeof ArrayBuffer&&(_.working?_(e):e instanceof ArrayBuffer)}function A(e){return"[object DataView]"===p(e)}function S(e){return"undefined"!=typeof DataView&&(A.working?A(e):e instanceof DataView)}u&&(l=s(BigInt.prototype.valueOf)),d&&(c=s(Symbol.prototype.valueOf)),t.isArgumentsObject=r,t.isGeneratorFunction=o,t.isTypedArray=i,t.isPromise=function(e){return"undefined"!=typeof Promise&&e instanceof Promise||null!==e&&"object"==typeof e&&"function"==typeof e.then&&"function"==typeof e.catch},t.isArrayBufferView=function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):i(e)||S(e)},t.isUint8Array=function(e){return"Uint8Array"===a(e)},t.isUint8ClampedArray=function(e){return"Uint8ClampedArray"===a(e)},t.isUint16Array=function(e){return"Uint16Array"===a(e)},t.isUint32Array=function(e){return"Uint32Array"===a(e)},t.isInt8Array=function(e){return"Int8Array"===a(e)},t.isInt16Array=function(e){return"Int16Array"===a(e)},t.isInt32Array=function(e){return"Int32Array"===a(e)},t.isFloat32Array=function(e){return"Float32Array"===a(e)},t.isFloat64Array=function(e){return"Float64Array"===a(e)},t.isBigInt64Array=function(e){return"BigInt64Array"===a(e)},t.isBigUint64Array=function(e){return"BigUint64Array"===a(e)},E.working="undefined"!=typeof Map&&E(new Map),t.isMap=function(e){return"undefined"!=typeof Map&&(E.working?E(e):e instanceof Map)},y.working="undefined"!=typeof Set&&y(new Set),t.isSet=function(e){return"undefined"!=typeof Set&&(y.working?y(e):e instanceof Set)},T.working="undefined"!=typeof WeakMap&&T(new WeakMap),t.isWeakMap=function(e){return"undefined"!=typeof WeakMap&&(T.working?T(e):e instanceof WeakMap)},v.working="undefined"!=typeof WeakSet&&v(new WeakSet),t.isWeakSet=v,_.working="undefined"!=typeof ArrayBuffer&&_(new ArrayBuffer),t.isArrayBuffer=b,A.working="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView&&A(new DataView(new ArrayBuffer(1),0,1)),t.isDataView=S;var N="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:void 0;function k(e){return"[object SharedArrayBuffer]"===p(e)}function C(e){return void 0!==N&&((k.working=void 0===k.working?k(new N):k.working)?k(e):e instanceof N)}function O(e){return g(e,m)}function w(e){return g(e,f)}function R(e){return g(e,h)}function L(e){return u&&g(e,l)}function I(e){return d&&g(e,c)}t.isSharedArrayBuffer=C,t.isAsyncFunction=function(e){return"[object AsyncFunction]"===p(e)},t.isMapIterator=function(e){return"[object Map Iterator]"===p(e)},t.isSetIterator=function(e){return"[object Set Iterator]"===p(e)},t.isGeneratorObject=function(e){return"[object Generator]"===p(e)},t.isWebAssemblyCompiledModule=function(e){return"[object WebAssembly.Module]"===p(e)},t.isNumberObject=O,t.isStringObject=w,t.isBooleanObject=R,t.isBigIntObject=L,t.isSymbolObject=I,t.isBoxedPrimitive=function(e){return O(e)||w(e)||R(e)||L(e)||I(e)},t.isAnyArrayBuffer=function(e){return"undefined"!=typeof Uint8Array&&(b(e)||C(e))},["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(e){Object.defineProperty(t,e,{enumerable:!1,value:function(){throw new Error(e+" is not supported in userland")}})})},537:(e,u,t)=>{var n,r=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),n={},r=0;r{var n;return T(t)?e.stylize("undefined","undefined"):y(t)?(n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'",e.stylize(n,"string")):E(t)?e.stylize(""+t,"number"):h(t)?e.stylize(""+t,"boolean"):g(t)?e.stylize("null","null"):void 0})(t,n);if(e)return e;var o,e=Object.keys(n),a=(o={},e.forEach(function(e,t){o[e]=!0}),o);if(t.showHidden&&(e=Object.getOwnPropertyNames(n)),A(n)&&(0<=e.indexOf("message")||0<=e.indexOf("description")))return p(n);if(0===e.length){if(S(n))return i=n.name?": "+n.name:"",t.stylize("[Function"+i+"]","special");if(v(n))return t.stylize(RegExp.prototype.toString.call(n),"regexp");if(b(n))return t.stylize(Date.prototype.toString.call(n),"date");if(A(n))return p(n)}var i="",s=!1,l=["{","}"];if(f(n)&&(s=!0,l=["[","]"]),S(n)&&(i=" [Function"+(n.name?": "+n.name:"")+"]"),v(n)&&(i=" "+RegExp.prototype.toString.call(n)),b(n)&&(i=" "+Date.prototype.toUTCString.call(n)),A(n)&&(i=" "+p(n)),0===e.length&&(!s||0==n.length))return l[0]+i+l[1];if(r<0)return v(n)?t.stylize(RegExp.prototype.toString.call(n),"regexp"):t.stylize("[Object]","special");t.seen.push(n),c=s?((t,n,r,o,e)=>{for(var a=[],i=0,s=n.length;i{var i=n(2682),r=n(9209),o=n(487),a=n(8075),s=n(5795),l=a("Object.prototype.toString"),c=n(9092)(),u="undefined"==typeof globalThis?n.g:globalThis,d=r(),p=a("String.prototype.slice"),m=Object.getPrototypeOf,f=a("Array.prototype.indexOf",!0)||function(e,t){for(var n=0;n{var r=n(6578),o="undefined"==typeof globalThis?n.g:globalThis;e.exports=function(){for(var e=[],t=0;t{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);{function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function B(e){e=((e,t)=>{if("object"!=o(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0===n)return("string"===t?String:Number)(e);if("object"!=o(n=n.call(e,t||"default")))return n;throw new TypeError("@@toPrimitive must return a primitive value.")})(e,"string");return"symbol"==o(e)?e:e+""}function G(e,t){if(null==e)return{};var n,r=((e,t)=>{if(null==e)return{};var n,r={};for(n in e)if({}.hasOwnProperty.call(e,n)){if(t.includes(n))continue;r[n]=e[n]}return r})(e,t);if(Object.getOwnPropertySymbols)for(var o=Object.getOwnPropertySymbols(e),a=0;a(e=((e,t)=>{if("object"!=l(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0===n)return("string"===t?String:Number)(e);if("object"!=l(n=n.call(e,t||"default")))return n;throw new TypeError("@@toPrimitive must return a primitive value.")})(e,"string"),"symbol"==l(e)?e:e+""))(r.key),r)}}function V(e,t,n){t=u(t);var r=e,t=Q()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n);if(!t||"object"!=l(t)&&"function"!=typeof t){if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(t=r))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t}function Q(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Q=function(){return!!e})()}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function X(e,t){return(X=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}var d=wp.i18n.__,s;(s=wp.components).Button;var s,p=((s=wp.element).createRef,s.Fragment),J=s.RawHTML,s,Z=((s=wp.blockEditor).MediaUpload,/^((?!chrome|android).)*safari/i.test(navigator.userAgent),(e=>{function n(e){var t;if(this instanceof n)return(t=V(this,n,[e])).contentEditable=b.createRef(),t.edit=t.edit.bind(t),t.save=t.save.bind(t),t.remove=t.remove.bind(t),t.resolve=t.resolve.bind(t),t.copy=t.copy.bind(t),t.cancelEdit=t.cancelEdit.bind(t),t.state={editing:!1,showEditedDraft:!1,contentHtml:"
",editedTime:"",copySuccess:""},t.val=e.value,t;throw new TypeError("Cannot call a class as a function")}var t,r=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),e&&X(r,e),r=n,(e=[{key:"componentDidUpdate",value:function(){var e,t;0!==document.querySelectorAll('mdspan[data-rich-text-format-boundary="true"]').length&&(e=this.props.timestamp,e=document.getElementById(e).querySelector("textarea"))&&(t=e.value,e.focus(),e.value="",e.value=t)}},{key:"edit",value:function(){this.setState({editing:!0});var e=this.state.showEditedDraft?this.props.editedDraft:this.props.children,e=removeLinkFromEditableText(e);this.state.contentHtml=e,this.state.attachmentText=this.props.attachmentText,""!==this.state.attachmentText&&this.setState({mediaId:"",mediaName:"",mediaUrl:""})}},{key:"save",value:function(e){var t=e.currentTarget.parentElement.parentElement.parentElement.parentElement.parentElement.id;if(e.currentTarget.classList.contains("btn-disabled"))return!1;if(0!==document.querySelector("#".concat(t," .js-cf-edit-comment")).textContent.trim().length){var n,r,o,e=this.state.contentHtml;if(""===e)return y(d("Please add some comment.","content-collaboration-inline-commenting")),!1;!0===this.state.editing&&(o=editedTimezone?editedTimezone.editedTime:"",r=getTimestampWithTimezone(),n=""!==this.state.attachmentText||"undefined"!==this.state.attachmentText||null===(null==(n=document.getElementById("cf_thumb_file"))?void 0:n.innerHTML)?this.state.attachmentText:null==(n=document.getElementById("cf_thumb_file"))?void 0:n.innerHTML,this.state.editedTime=o,this.state.editedTimestamp=r,""!==this.state.attachmentText&&void 0!==this.state.attachmentText||(n=null==(o=document.getElementById("cf_thumb_file"))?void 0:o.innerHTML),""!==this.props.assignedText)&&null!=this.props.assignedText&&(r=this.props.assignedText,(o=document.createElement("span")).innerHTML=r,o.classList.add("assigned-meta-text"),null!=(r=document.getElementById(this.props.timestamp).querySelector(".commentInnerContainer .commentText .readmoreTxt")))&&r.after(o),e=filterTextBeforeSave(e),this.props.updateCommentFromBoard(e,this.props.index,this.props.timestamp,this.props.dateTime,t,this.state.editedTime,this.state.editedTimestamp,this.props.assignedText,n),this.setState({editing:!1})}else y(d("Please add some comment.","content-collaboration-inline-commenting"))}},{key:"remove",value:function(e){var t=e.currentTarget.closest(".cls-board-outer");this.props.removeCommentFromBoard(this.props.index,this.props.timestamp,t.id),e.currentTarget.closest(".comment-delete-overlay").classList.remove("show")}},{key:"copy",value:function(e){var t=e.currentTarget.closest(".cls-board-outer").id,n=window.location.href+"¤t_url="+t,r=document.querySelector(".copytext"),r=(r&&(r.textContent=""),document.getElementById(t).querySelector(".copytext")),t=(r&&(r.textContent=n),document.createElement("input"));t.setAttribute("style","position: absolute; top: -8888px; left: -8888px"),document.body.appendChild(t),t.setAttribute("value",n),t.select(),document.execCommand("copy"),e.target.focus(),t.remove(),this.setState({copySuccess:d("Link Copied!","content-collaboration-inline-commenting")}),clearInterval(this.resetState()),e.currentTarget.closest(".buttons-wrapper").classList.remove("active"),document.createElement("input").select()}},{key:"resetState",value:function(){var e=this;setTimeout(function(){return e.setState({copySuccess:""})},3e3)}},{key:"resolve",value:function(e){var o=e.currentTarget.closest(".cls-board-outer").id,a=o,e=wp.data.select("core/editor").getCurrentPostId();fetch(ajaxurl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({action:"cf_resolve_thread",currentPostID:e,metaId:"_"+o}).toString()}).then(function(e){var t,n=wp.data.select("mdstore").getAllCommentCount(),n=(void 0!==(null==n?void 0:n.length)&&(t=o.replace("_",""),n.find(function(e){return e.elID===t})),setTimeout(function(){var e=document.getElementById(a);e&&e.remove()},1e3),null!=(n=document.getElementById("history-toggle"))&&n.setAttribute("data-count",null==(n=document.querySelectorAll(".cls-board-outer"))?void 0:n.length),Array.from(document.querySelectorAll('[datatext="'.concat(a,'"]'))).map(function(e){return e.getAttribute("data-block")})),r=(document.querySelectorAll("#cf-comment-board-wrapper .cls-board-outer").forEach(function(e){e.classList.remove("focus"),e.removeAttribute("style")}),document.querySelectorAll('[datatext="'.concat(a,'"].cf-icon-wholeblock__comment')).forEach(function(e){return e.classList.remove("cf-icon-wholeblock__comment")}),document.querySelectorAll('[datatext="'.concat(a,'"]')).forEach(function(e){e.classList.remove("commentIcon"),e.classList.remove("cf-onwhole-block__comment")}),null==(r=document.querySelector('[datatext="'.concat(a,'"]')))?void 0:r.getAttribute("data-type")),r=(void 0!==r&&n&&null!==r?n.forEach(function(e){wp.data.dispatch("core/block-editor").updateBlockAttributes(e,{datatext:""})}):document.querySelectorAll('[datatext="'.concat(a,'"]')).forEach(function(e){var t;removeTag(a),null!=(t=document.getElementById(a))&&t.remove()}),wp.data.dispatch("mdstore").setIsActive(!1),new Event("editorLayoutUpdate"));document.dispatchEvent(r),setTimeout(function(){},2e3),wp.data.dispatch("core/editor").autosave()}).catch(function(e){return console.error("Error:",e)})}},{key:"cancelEdit",value:function(){this.state.attachmentText=this.props.attachmentText,this.setState({editing:!1})}},{key:"deleteAttachment",value:function(e){e=$(e.currentTarget).closest(".cls-board-outer");this.setState({attachmentText:"",mediaId:"",mediaName:"",mediaUrl:""}),this.props.removeAttachmentFromBoard(this.props.index,this.props.timestamp,e[0].id,this.props.attachmentText)}},{key:"renderNormalMode",value:function(){var e=document.querySelector(".cls-board-outer.focus .shareCommentContainer"),e=(e&&(e.style.display="block"),this.props.index),t=(this.props.status,this.props.attachmentText),n=timeAgo(this.props.timestamp),r=convertedDatetime(this.props.timestamp),o="";try{o=wp.data.select("core").getCurrentUser().id}catch(e){o=localStorage.getItem("userID")}var a=this.state.showEditedDraft?this.props.editedDraft:this.props.children,i="",s=(a=(a=300]+(>|$)/g,"").length?(i=a).substring(0,300)+"...":a).replace(/contenteditable=\"false\"/gi,'data-edit="false"'),this.props.userRole),s=(8getCommentsLimit()&&(l="none"),"block"!==(null==s?void 0:s.style.display)&&void 0!==(null==s?void 0:s.style.display)&&(l="block"),""===t&&(this.state.attachmentText=""),"\n \n ".concat(a,"\n ").concat(""!==i?"".concat(d("show more","content-collaboration-inline-commenting"),""):"","\n \n ")),t="\n \n ".concat(i,"\n ").concat(""!==i?"".concat(d("show less","content-collaboration-inline-commenting"),""):"","\n \n ");return b.createElement("div",{className:"commentContainer",style:{display:l},id:this.props.timestamp},b.createElement("div",{className:"commentInnerContainer"},b.createElement("div",{className:"comment-header"},b.createElement("div",{className:"comment-details"},"1"===this.props.showAvatars&&b.createElement("div",{className:"avatar"},b.createElement("img",{src:this.props.profileURL,alt:"avatar"})),b.createElement("div",{className:"commenter-name-time"},b.createElement("div",{className:"commenter-name"},this.props.userName.charAt(0).toUpperCase()+this.props.userName.slice(1),b.createElement("span",{className:"tooltip"},this.props.userRole)),b.createElement("div",{className:"comment-time"},b.createElement("span",{className:"comment-time-wrapper"},n," ",b.createElement("span",{className:"tooltip"},r," ")))),b.createElement("div",{className:"comment-actions"},b.createElement(p,null,0===e&&"guest"!==currentUserData.role&&b.createElement("div",{className:"comment-resolve"},b.createElement("input",{id:"resolve_cb_"+this.props.timestamp+"_"+e,type:"checkbox",className:"resolve-cb",value:"1"}),b.createElement("label",{htmlFor:"resolve_cb_"+this.props.timestamp+"_"+e},d("Resolved","content-collaboration-inline-commenting")),b.createElement("span",{className:"tooltip"},d("Mark as Resolved","content-collaboration-inline-commenting")))),0===e&&b.createElement(p,null,""!==this.state.copySuccess&&b.createElement("p",{className:"comment-copied-tooltip"},this.state.copySuccess),b.createElement("div",{className:"buttons-wrapper"},b.createElement("span",{className:"tooltip"},d("More Options...","content-collaboration-inline-commenting")),b.createElement("div",{className:"more-option-btn"},b.createElement("div",{className:"cf-option-light-btn"},f.moreFirstOption),b.createElement("div",{className:"cf-option-midlight-btn"},f.moreSecndOption),b.createElement("div",{className:"cf-option-dark-btn"},f.moreThirdOption)),b.createElement("div",{className:"comment-more-option"},b.createElement("ul",{className:"comment-more-option-list"},b.createElement("li",{onClick:this.copy.bind(this)},b.createElement("i",{className:"dashicons dashicons-share",title:d("Copy Link","content-collaboration-inline-commenting")}),b.createElement("span",{className:"more-option-meta"},d("Share","content-collaboration-inline-commenting"))),this.props.userID===o&&b.createElement(p,null,b.createElement("li",{onClick:this.edit,className:"js-edit-comment"},b.createElement("i",{className:"dashicons dashicons-edit",title:"Edit"}),b.createElement("span",{className:"more-option-meta"},d("Edit","content-collaboration-inline-commenting"))),b.createElement("li",{className:"js-resolve-comment"},b.createElement("i",{className:"dashicons dashicons-trash",title:"Resolve"}),b.createElement("span",{className:"more-option-meta"},d("Delete","content-collaboration-inline-commenting")))))))),this.props.userID===o&&0(e=((e,t)=>{if("object"!=m(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0===n)return("string"===t?String:Number)(e);if("object"!=m(n=n.call(e,t||"default")))return n;throw new TypeError("@@toPrimitive must return a primitive value.")})(e,"string"),"symbol"==m(e)?e:e+""))(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function te(e,f){document.addEventListener("keydown",function(e){var s,l,a,r,o,i,c,u,t,n,d,p,m=this;wp.data.select("core/block-editor").getSelectedBlock();wp.keycodes.isKeyboardEvent.primary(e,"y")&&(e.stopImmediatePropagation(),s=(d=wp.data.select("mdstore").getredoData()).pop())&&(null!=(p=r=document.getElementById(s.id))&&p.classList.contains("cm-board")&&r.classList.add("cls-board-outer"),l=s.id,r&&r.classList.contains("cls-board-outer")?setTimeout(function(){jQuery("#"+l).show();var e,t=s.content,n=document.querySelector("#block-"+s.clientId),n=(null!=n&&n.classList.contains("cf-onwhole-block__comment")&&(n.innerHTML=s.content,n.classList.add("cf-onwhole-block__comment"),document.querySelector(".cf-icon-wholeblock__comment[datatext="+s.id+"]").style.display="block"),document.createElement("div")),t=(n.innerHTML=t,n.innerHTML),n=!1;!0===(null==(e=wp.data.select("core/editor").getEditedPostAttribute("meta"))?void 0:e._sb_is_suggestion_mode)&&(n=!0,wp.data.dispatch("core/editor").editPost({meta:{_sb_is_suggestion_mode:!1}})),wp.data.dispatch("core/block-editor").updateBlockAttributes(s.clientId,{content:t}),!0===n&&wp.data.dispatch("core/editor").editPost({meta:{_sb_is_suggestion_mode:!0}}),jQuery("#".concat(l)).attr("data-rich-text-format-boundary",!0),jQuery("#".concat(l)).addClass("cls-board-outer sg-board is-open focus onGoing"),setTimeout(function(){floatCommentsBoard(l)},300)},300):setTimeout(function(){wp.data.dispatch("core/editor").editPost({meta:{_sb_is_suggestion_mode:!1}}),jQuery("[data-sid='"+l+"']").show();var t,n,e=s.content,r=document.createElement("div"),e=(r.innerHTML=e,r.innerHTML),r=(wp.data.dispatch("core/editor").editPost({meta:{_sb_is_suggestion_mode:!1}}),s.clientId),o={},a=("core/table"!==(null==(a=wp.data.select("core/block-editor").getBlock(r))?void 0:a.name)||"body"!==f&&"newBody"!==f||(i=(a=(new DOMParser).parseFromString(e,"text/html")).getElementById(l))&&(i.outerHTML,o=ne(i,r,a),i=wp.data.select("core/block-editor").getBlock(r).attributes.body,0!==Object.keys(o).length&&void 0!==o&&(a=re(o.rowIndex,o.columnIndex,r,a),i[o.rowIndex].cells[o.columnIndex].content=a),e=ee()(i)),wp.data.dispatch("core/block-editor").updateBlockAttributes(r,T({},f,e)),null==(o=wp.data.select("core/editor").getEditedPostAttribute("meta"))?void 0:o._sb_suggestion_history),i=JSON.parse(a),r=[];i[l]?(t=l,n=s.data,setTimeout(function(){var e=null==(e=wp.data.select("core/editor").getEditedPostAttribute("meta"))?void 0:e._sb_suggestion_history,e=JSON.parse(e);void 0===e?(e={})[t]=n:e[t]?Object.assign(e[t][0],n):e[t]=n,wp.data.dispatch("core/editor").editPost({meta:{_sb_suggestion_history:JSON.stringify(e)}})},300)):(r.push(s.data),i[l]=r,wp.data.dispatch("core/editor").editPost({meta:{_sb_suggestion_history:JSON.stringify(i)}})),setTimeout(function(){wp.data.dispatch("core/editor").editPost({meta:{_sb_is_suggestion_mode:!0}})},300),setTimeout(function(){jQuery("#sg".concat(l)).attr("data-rich-text-format-boundary",!0),jQuery("#sg".concat(l)).addClass("cls-board-outer sg-board is-open focus onGoing"),jQuery("#sg".concat(l)).removeClass("undo-suggestion"),floatCommentsBoard(l)},300)},500),p=[],null!==(n=wp.data.select("mdstore").getundoData())?(n.push(s),p=n):p.push(s),wp.data.dispatch("mdstore").setundoData(p)),wp.keycodes.isKeyboardEvent.primary(e,"z")&&(e.stopImmediatePropagation(),a=wp.data.select("mdstore").getundoData().pop())&&(e=null==(n=r=document.getElementById(a.id))||null==(n=n.closest(".block-editor-block-list__block"))?void 0:n.getAttribute("data-block"),o=null==(n=wp.data.select("core/block-editor").getBlock(e))?void 0:n.name,i={},"core/table"!==o||"body"!==f&&"newbody"!==f||(i=ne(r,e)),r&&r.classList.contains("cls-board-outer")?(c=null==(n=jQuery("[datatext='"+a.id+"']").closest(".block-editor-block-list__block"))?void 0:n.attr("data-block"),t=jQuery("#block-"+c).html(),a.content=t,a.clientId=c,setTimeout(function(){var e=!1,t=(!0===(null==(t=wp.data.select("core/editor").getEditedPostAttribute("meta"))?void 0:t._sb_is_suggestion_mode)&&(e=!0,wp.data.dispatch("core/editor").editPost({meta:{_sb_is_suggestion_mode:!1}})),wp.data.select("core/block-editor").getBlockAttributes(c)),n=document.querySelector("[datatext='"+a.id+"']"),r=document.querySelector("#block-"+c),o=(null!=r&&r.classList.contains("cf-onwhole-block__comment")?(t.className=null==t||null==(o=t.className)?void 0:o.replace(/(cf-onwhole-block__comment)\s*/g,""),r.classList.remove("cf-onwhole-block__comment"),r.innerHTML=a.content,document.querySelector(".cf-icon-wholeblock__comment[datatext="+a.id+"]").style.display="none"):n.replaceWith(a.data.commentedOnText),jQuery("#"+a.id).hide(),jQuery("#"+a.id).removeClass("cls-board-outer"),jQuery("#block-"+c).html()),r=document.createElement("div"),n=(r.innerHTML=o,r.innerHTML);wp.data.dispatch("core/block-editor").updateBlockAttributes(c,{content:n,className:t.className}),!0===e&&setTimeout(function(){wp.data.dispatch("core/editor").editPost({meta:{_sb_is_suggestion_mode:!0}})},500)},300)):(u=null==(e=jQuery("#".concat(a.id)).closest(".block-editor-block-list__block"))?void 0:e.attr("data-block"),t=jQuery("#block-"+u).html(),"caption"===f?(e=null==(n=document.getElementById("block-"+u))?void 0:n.getElementsByTagName("figcaption")[0],a.content=e.innerHTML):a.content=t,a.clientId=u,setTimeout(function(){var e,t,n=null==(n=wp.data.select("core/editor").getEditedPostAttribute("meta"))?void 0:n._sb_suggestion_history,n=JSON.parse(n),n=(delete n[a.id],wp.data.dispatch("core/editor").editPost({meta:{_sb_suggestion_history:JSON.stringify(n)}}),wp.data.dispatch("core/editor").editPost({meta:{_sb_is_suggestion_mode:!1}}),m.getElementById(a.id));n&&("Delete"===a.data.action?n.outerHTML=null==(e=r)?void 0:e.textContent:n.outerHTML=a.data.oldvalue||"",jQuery("[data-sid='"+a.id+"']").hide(),e=jQuery("#block-"+u).html(),(n=document.createElement("div")).innerHTML=e,e=n.innerHTML,"core/table"!==o||"body"!==f&&"newbody"!==f||(n=wp.data.select("core/block-editor").getBlock(u).attributes.body,0!==Object.keys(i).length&&void 0!==i&&(t=re(i.rowIndex,i.columnIndex,u),n[i.rowIndex].cells[i.columnIndex].content=t),e=ee()(n)),"caption"===f?(n=null==(t=document.getElementById("block-"+u))?void 0:t.getElementsByTagName("figcaption")[0],wp.data.dispatch("core/block-editor").updateBlockAttributes(u,T({},f,null==n?void 0:n.innerHTML))):wp.data.dispatch("core/block-editor").updateBlockAttributes(u,T({},f,e)),jQuery("#sg".concat(a.id)).addClass("undo-suggestion")),setTimeout(function(){wp.data.dispatch("core/editor").editPost({meta:{_sb_is_suggestion_mode:!0}})},500)},300)),p=[],null!==(d=wp.data.select("mdstore").getredoData())?(d.push(a),p=d):p.push(a),wp.data.dispatch("mdstore").setredoData(p))})}function ne(e,t,n){for(var r={},o=void 0!==n?n.querySelectorAll(".wp-block-table__cell-content"):document.querySelectorAll("#block-"+t+" .wp-block-table__cell-content"),a=e.outerHTML,i=0;i{if(Array.isArray(e))return _(e)})(e)||(e=>{if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)})(e)||((e,t)=>{var n;if(e)return"string"==typeof e?_(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_(e,t):void 0})(e)||(()=>{throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function _(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n(e=((e,t)=>{if("object"!=v(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0===n)return("string"===t?String:Number)(e);if("object"!=v(n=n.call(e,t||"default")))return n;throw new TypeError("@@toPrimitive must return a primitive value.")})(e,"string"),"symbol"==v(e)?e:e+""))(r.key),r)}}function ie(e,t,n){t=A(t);var r=e,t=se()?Reflect.construct(t,n||[],A(e).constructor):t.apply(e,n);if(!t||"object"!=v(t)&&"function"!=typeof t){if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(t=r))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t}function se(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(se=function(){return!!e})()}function A(e){return(A=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function le(e,t){return(le=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}var S=wp.i18n.__,s,s;(s=wp.components).Button,(s=wp.element).createRef;var s,N=(s=wp.data).dispatch,k=s.select,ce=(wp.blockEditor.MediaUpload,wp.richText.removeFormat),ue=(/^((?!chrome|android).)*safari/i.test(navigator.userAgent),(e=>{function s(e){var o;if(!(this instanceof s))throw new TypeError("Cannot call a class as a function");(o=ie(this,s,[e])).contentEditable=b.createRef(),o.displayComments=o.displayComments.bind(o),o.updateComment=o.updateComment.bind(o),o.removeComment=o.removeComment.bind(o),o.addNewComment=o.addNewComment.bind(o),o.cancelComment=o.cancelComment.bind(o);var e=wp.data.select("core/editor").getCurrentPostId(),a=[],i=o.props.datatext,t="txt"+i,n="_"+i;if(setTimeout(function(){var e=document.querySelector("#".concat(i," textarea"));e&&e.setAttribute("id",t)},3e3),o.commentedOnText=o.props.commentedOnText,1!==o.props.freshBoard)wp.apiFetch({path:"cf/cf-get-comments-api/?currentPostID="+e+"&elID="+n}).then(function(e){var t=e.userDetails,n=e.resolved,r=e.assignedTo;if(o.commentedOnText=void 0!==o.commentedOnText?o.commentedOnText:e.commentedOnText,o.assignedTo=r,"true"===n||0===t.length)return e=i,(r=document.querySelector('[datatext="'.concat(i,'"]')))&&r.classList.remove("commentIcon"),n=r?r.getAttribute("data-type"):null,r=r?r.getAttribute("data-block"):null,h.text.includes(n)?(removeTag(e),(n=document.getElementById(e))&&n.remove()):(N("core/block-editor").updateBlock(r,{attributes:{datatext:""}}),(e=document.getElementById(i))&&e.remove()),!1;t.forEach(function(e,t){a.push(e)}),o.hasComments=0!==a.length?1:0,o.state={comments:[a]},o.setState({comments:a})});else try{o.currentUserName=wp.data.select("core").getCurrentUser().name;var r=wp.data.select("core").getCurrentUser().avatar_urls;o.currentUserProfile=r[Object.keys(r)[1]]}catch(e){o.currentUserName=localStorage.getItem("userName"),o.currentUserProfile=localStorage.getItem("userURL")}return o.state={comments:[],newcommentText:""},o}var t,n=s;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),e&&le(n,e),n=s,(e=[{key:"removeAttachment",value:function(e,t,n,r){wp.data.select("core/editor").getCurrentPostId();var o=document.querySelector("#".concat(t," .attachment-text")),o=(o&&(o.innerHTML=""),document.querySelector("#".concat(t," #cf_thumb_file")));o&&(o.innerHTML=""),N("core/editor").editPost({meta:{reflect_comments_changes:1}})}},{key:"removeComment",value:function(e,t,n){var r=this.state.comments;r.splice(e,1);e={action:"cf_delete_comment",currentPostID:wp.data.select("core/editor").getCurrentPostId(),timestamp:t,metaId:n="_"+n},t=new URLSearchParams(e).toString();fetch(ajaxurl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t}).then(function(e){return e.text()}).then(function(){N("core/editor").editPost({meta:{reflect_comments_changes:1}})}).catch(function(e){return console.error("Error:",e)}),this.setState({comments:r,newcommentText:""}),N("core/editor").autosave()}},{key:"updateComment",value:function(e,o,t,n,r,a,i,s,l){var c=this,u=this.state.comments,d="",p="",m="",f="";try{d=k("core").getCurrentUser().id,p=k("core").getCurrentUser().name,m=k("core").getUser(d).roles[0],f=(f=k("core").getCurrentUser().avatar_urls)[Object.keys(f)[1]]}catch(e){d=localStorage.getItem("userID"),p=localStorage.getItem("userName"),m=localStorage.getItem("userRole"),f=localStorage.getItem("userURL")}p={userName:p,userRole:m,profileURL:f,dtTime:n,thread:e,userData:d,index:o,status:"publish",timestamp:t,editedTime:a,editedTimestamp:i,assignedText:s,attachmentText:l};u[o]=p;r="_"+r;m={action:"cf_update_comment",currentPostID:k("core/editor").getCurrentPostId(),editedComment:JSON.stringify(p),metaId:r},f=new URLSearchParams(m).toString();fetch(ajaxurl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:f}).then(function(e){return e.json()}).then(function(e){if(void 0!==e.error)return alert(e.error),!1;N("core/editor").editPost({meta:{reflect_comments_changes:1}}),e.arr.thread&&(u[o].thread=e.arr.thread);var t=k("mdstore").getAllCommentCount();if(void 0!==(null==t?void 0:t.length))for(var n,r=0;r<(null==(n=t[o])||null==(n=n.activities)?void 0:n.length);r++)t[o].activities[r].id===e.arr.timestamp&&(t[o].activities[r].thread=e.arr.thread,N("mdstore").setAllCommentCount(t));c.setState({comments:u}),N("core/editor").autosave()}).catch(function(e){return console.error("Error:",e)})}},{key:"addNewComment",value:function(e){e.preventDefault();var t=this.props,r=t.datatext,o="txt"+r,t=null==(t=document.getElementById(o))?void 0:t.innerHTML,n=null==(n=document.getElementById("cf_thumb_file"))?void 0:n.innerHTML,t=filterTextBeforeSave(t),a=validateCommentReplyText(t);if(""!==t&&""!==a&&/\S/g.test(a)){var a="",i="",s="",l="";try{a=k("core").getCurrentUser().id,s=k("core").getUser(a).roles[0],i=k("core").getCurrentUser().name}catch(e){a=localStorage.getItem("userID"),i=localStorage.getItem("userName"),s=localStorage.getItem("userRole")}var l="1"===localStorage.getItem("showAvatars")?(l=k("core").getCurrentUser().avatar_urls)[Object.keys(l)[1]]:localStorage.getItem("userURL"),c=this.state.comments,u=document.querySelector('[datatext="'.concat(this.props.datatext,'"]')).getAttribute("data-type"),d=(h.media.includes(u)||(u=h.text.includes(u)||null==u?"":"md-block"),{}),a=(d.userData=a,d.thread=t,d.commentedOnText=void 0!==this.commentedOnText?this.commentedOnText:"",d.userName=i,d.userRole=s,d.profileURL=l,d.status="publish",d.blockType=u,d.attachmentText=n,k("core/editor").getCurrentPostId()),p=o.substring(3),m="_"+p,t="",s=(null!=(i=document.querySelector("#".concat(p," .cf-assign-to-user")))&&i.checked&&(t=document.querySelector("#".concat(p," .cf-assign-to-user")).value),d.assigned=t,c.push(d),{action:"cf_add_comment",currentPostID:a,commentList:JSON.stringify(c),metaId:m,assignTo:t,blockType:u}),f=(document.querySelector("#".concat(p," .shareCommentContainer")).classList.add("loading"),this),l=new Event("editorLayoutUpdate");document.dispatchEvent(l),fetch(ajaxurl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(s).toString()}).then(function(e){return e.json()}).then(function(e){if(document.querySelector("#".concat(p," .shareCommentContainer")).classList.remove("loading"),document.querySelectorAll(".fresh-board").forEach(function(e){return e.classList.remove("fresh-board")}),void 0!==e.error)return alert(e.error),!1;c[c.length-1].dtTime=e.dtTime,c[c.length-1].timestamp=e.timestamp,c[c.length-1].assignedText=e.assignedText,null!==e.assignedTo&&(t=e.assignedTo.display_name||S("Unknown User","content-collaboration-inline-commenting"),t='\n
\n
\n
\n ').concat(e.assignedTo.display_name,'\n
\n \n
\n
\n "),(n=document.querySelector("#".concat(p," .cf-board-assigned-to")))&&n.remove(),n=document.querySelector("#".concat(p," .boardTop")))&&n.insertAdjacentHTML("beforebegin",DOMPurify.sanitize(t)),f.hasComments=1,N("core/editor").editPost({meta:{reflect_comments_changes:1}}),e.arr.thread&&(n=c.length-1,c[n].thread=e.arr.thread),f.setState({comments:c,newcommentText:"",mediaId:"",mediaName:"",mediaUrl:""});var t=k("mdstore").getAllCommentCount(),n=(void 0!==(null==t?void 0:t.length)&&(c[0].elID=m.replace("_",""),null!=t&&t.push.apply(t,oe(c)),N("mdstore").setAllCommentCount(t)),k("mdstore").getundoData()),e=[],t=Object.assign({},c[0]),n=(null!==n?(n.push({id:r,data:t}),e=n):e.push({id:r,data:t}),N("mdstore").setundoData(e),te(),document.getElementById(o).innerHTML="",document.getElementById(o).focus(),document.getElementById("cf_thumb_file"));n&&(n.innerHTML=""),document.querySelectorAll(".cf-assign-to").forEach(function(e){return e.remove()})}),N("core/editor").autosave()}else{if(e.currentTarget.classList.contains("btn-disabled"))return!1;y(S("Please add some comment.","content-collaboration-inline-commenting"))}}},{key:"displayComments",value:function(t,e){var n,r,o,a,i,s,l,c,u,d,p,m,f,h,g,E=this.props,y=E.lastVal,T=E.onChanged,E=E.selectedText,v=(Object.keys(t).map(function(e){"userName"===e?n=t[e]:"userRole"===e?r=t[e]:"dtTime"===e?o=t[e]:"thread"===e?a=t[e]:"profileURL"===e?i=t[e]:"userData"===e?s=parseInt(t[e],10):"status"===e?l=t[e]:"timestamp"===e?c=t[e]:"editedDraft"===e?u=t[e]:"updatedTime"===e?d=t[e].toString():"blockType"===e?p=t[e]:"assignedText"===e?m=t[e]:"editedTimestamp"===e?f=t[e]:"attachmentText"===e&&(h=t[e])}),m),_=(null!=(_=v)&&_.includes("Assigned to You")?v=wp.i18n.__("Assigned to You","content-collaboration-inline-commenting"):null!=(_=v)&&_.includes("Reassigned to You")?v=wp.i18n.__("Reassigned to You","content-collaboration-inline-commenting"):null!=(_=v)&&_.includes("Assigned to")?(g=v.split("Assigned to"),v=sprintf(S("Assigned to %s","content-collaboration-inline-commenting"),g[1])):null!=(_=v)&&_.includes("Reassigned to ")&&(g=v.split("Reassigned to"),v=sprintf(S("Reassigned to %s","content-collaboration-inline-commenting"),g[1])),m=v,k("core/editor").getCurrentPost());return(null==_?void 0:_.author)===s&&(r="Owner"),b.createElement(Z,{key:e,index:e,removeCommentFromBoard:this.removeComment,updateCommentFromBoard:this.updateComment,removeAttachmentFromBoard:this.removeAttachment,userName:n,userRole:r,dateTime:o,profileURL:i,userID:s,status:l,lastVal:y,onChanged:T,selectedText:E,timestamp:c,editedDraft:u,editedTime:d,editedTimestamp:f&&f.toString(),blockType:p,assignedText:m,attachmentText:h,showAvatars:localStorage.getItem("showAvatars")},a=a||t)}},{key:"cancelComment",value:function(){var t=this,e=this.props,n=e.datatext,r=e.onChanged,e=e.lastVal,o=document.querySelector('[datatext="'.concat(n,'"]')),a=o.closest("[data-block]"),i=null==o?void 0:o.getAttribute("data-type"),s=null==a?void 0:a.getAttribute("data-type"),a=null==a?void 0:a.getAttribute("data-block"),l=k("core/block-editor").getSelectedBlock(),a=a||(null==l?void 0:l.clientId),l=k("core/block-editor").getBlockAttributes(a),c=null==o?void 0:o.getAttribute("data-block");0===document.querySelectorAll("#".concat(n," .boardTop .commentContainer")).length&&(null!=i?(null!=o&&o.classList.remove("commentIcon"),N("mdstore").setIsActive(!1),N("core/block-editor").updateBlock(c,{attributes:{datatext:""}})):null!=s&&s.startsWith("acf/")&&void 0!==s&&null!==i?(removeAcfTag(l,a,n),N("mdstore").setIsActive(!1)):e&&r(ce(e,"multidots/comment")),null!=(o=document.getElementById(n))&&o.remove(),c=new Event("editorLayoutUpdate"),document.dispatchEvent(c)),setTimeout(function(){document.querySelectorAll("#cf-comment-board-wrapper .cls-board-outer").forEach(function(e){return e.classList.remove("focus")}),document.querySelectorAll(".cf-icon__addBlocks, .cf-icon__removeBlocks").forEach(function(e){return e.classList.remove("focus")}),document.querySelectorAll(".cf-icon-wholeblock__comment").forEach(function(e){e.classList.remove("focus"),e.classList.remove("is-selected")}),document.querySelectorAll(".cf-onwhole-block__comment").forEach(function(e){return e.classList.remove("focus")}),document.querySelectorAll("#cf-comment-board-wrapper .cls-board-outer").forEach(function(e){return e.removeAttribute("style")}),document.querySelectorAll("#cf-comment-board-wrapper .cls-board-outer .shareCommentContainer").forEach(function(e){return e.removeAttribute("style")}),document.querySelectorAll("[data-rich-text-format-boundary]").forEach(function(e){return e.removeAttribute("data-rich-text-format-boundary")}),document.querySelectorAll(".cf-assign-to").forEach(function(e){return e.remove()}),document.querySelectorAll("#cf-comment-board-wrapper .comment-delete-overlay").forEach(function(e){return e.classList.remove("show")}),document.querySelectorAll(".commentIcon").forEach(function(e){return e.classList.remove("is-selected")}),document.querySelectorAll("#cf-comment-board-wrapper .cls-board-outer .buttons-wrapper").forEach(function(e){return e.classList.remove("active")});var e=document.getElementById("txt"+n),e=(e&&(e.innerHTML=""),document.getElementById("cf_thumb_file")),e=(e&&(e.innerHTML=""),t.setState({newcommentText:"",mediaId:"",mediaName:"",mediaUrl:""}),new Event("showHideComments"));document.dispatchEvent(e),document.querySelectorAll(".js-activity-centre .user-data-row").forEach(function(e){return e.classList.remove("active")})},200)}},{key:"deleteAttachment",value:function(){this.setState({attachmentText:"",mediaId:"",mediaName:"",mediaUrl:""});var e=document.getElementById("cf_thumb_file");e&&(e.innerHTML="")}},{key:"componentDidMount",value:function(){var t;this.props.freshBoard&&(t=this.props.datatext,setTimeout(function(){var e=document.getElementById("txt"+t);e&&e.focus()},500))}},{key:"render",value:function(){var n=this,e=this.props,e=e.datatext,t=1===this.hasComments?S("Reply","content-collaboration-inline-commenting"):S("Comment","content-collaboration-inline-commenting"),r=1===this.hasComments?S("Reply to this comment","content-collaboration-inline-commenting"):S("Post Comment","content-collaboration-inline-commenting"),o=this.assignedTo,a=1===this.hasComments||void 0===this.hasComments?S("Reply or add others with @","content-collaboration-inline-commenting"):S("Comment or add others with @","content-collaboration-inline-commenting"),i=(this.props.freshBoard&&(a=S("Comment or add others with @","content-collaboration-inline-commenting")),this.state.comments.length),s="none",l=(i>getCommentsLimit()&&(s="block"),this.state.newcommentText),l=""===validateCommentReplyText(l)?"btn-disabled":"";return b.createElement("div",{className:"board ".concat(void 0===this.hasComments&&this.currentUserProfile&&"fresh-board")},null!=o&&b.createElement("div",{className:"cf-board-assigned-to","data-user-id":o.ID,"data-user-email":o.user_email},b.createElement("div",{className:"assigned-user-details"},b.createElement("div",{className:"user-avatar"},b.createElement("img",{src:o.avatar,alt:o.display_name})),b.createElement("div",{className:"user-info"},b.createElement("span",{className:"badge"},S("Assigned to","content-collaboration-inline-commenting")),b.createElement("p",{className:"display-name"},o.display_name?S(o.display_name.charAt(0).toUpperCase()+o.display_name.slice(1),"content-collaboration-inline-commenting"):S("Unknown User","content-collaboration-inline-commenting"))))),b.createElement("div",{className:"boardTop"},this.state.comments&&this.state.comments.map(function(e,t){return n.displayComments(e,t)}),b.createElement("div",{className:"show-all-comments",style:{display:s}},sprintf(S("Show all %d replies"),i-1))),void 0===this.hasComments&&this.currentUserProfile&&b.createElement("div",{className:"commentContainer"},b.createElement("div",{className:"commentInnerContainer"},b.createElement("div",{className:"comment-header"},b.createElement("div",{className:"comment-details"},b.createElement("div",{className:"avatar"},b.createElement("img",{src:this.currentUserProfile,alt:"avatar"})),b.createElement("div",{className:"commenter-name-time"},b.createElement("div",{className:"commenter-name"},this.currentUserName.charAt(0).toUpperCase()+this.currentUserName.slice(1))))))),b.createElement("div",{className:"shareCommentContainer"},b.createElement("div",{className:"cf-share-comment-wrapper js-cf-share-comment-wrapper"},b.createElement(c(),{innerRef:this.contentEditable,html:this.state.newcommentText,disabled:!1,onChange:function(e){return n.setState({newcommentText:e.target.value})},id:"txt"+e,className:"cf-share-comment js-cf-share-comment",placeholder:a}),b.createElement("div",{className:"cf-commentboard-attach-wrap"},null!=this.state.mediaId&&b.createElement("div",{id:"cf_thumb_file"},b.createElement("a",{href:this.state.mediaUrl,target:"_blank"},this.state.mediaName)),b.createElement("div",{className:"btn-wrapper"},b.createElement("button",{onClick:this.addNewComment,className:"btn btn-success ".concat(l)},t,b.createElement("span",{className:"tooltip"},r)),b.createElement("button",{onClick:this.cancelComment,className:"btn btn-cancel"},S("Cancel","content-collaboration-inline-commenting")," ",b.createElement("span",{className:"tooltip"},S("Discard Comment","content-collaboration-inline-commenting"))))))))}}])&&ae(n.prototype,e),t&&ae(n,t),Object.defineProperty(n,"prototype",{writable:!1}),n})(b.Component)),de=(ue.propTypes={lastVal:i().object,datatext:i().string,onChanged:i().func,selectedText:i().string,commentedOnText:i().string,freshBoard:i().number,onLoadFetch:i().number},r(5338));function O(e){return(O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function pe(e){return(e=>{if(Array.isArray(e))return C(e)})(e)||(e=>{if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)})(e)||fe(e)||(()=>{throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function M(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */M=function(){return i};var l,i={},e=Object.prototype,c=e.hasOwnProperty,u=Object.defineProperty||function(e,t,n){e[t]=n.value},t="function"==typeof Symbol?Symbol:{},r=t.iterator||"@@iterator",n=t.asyncIterator||"@@asyncIterator",o=t.toStringTag||"@@toStringTag";function a(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{a({},"")}catch(l){a=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var o,a,i,s,t=t&&t.prototype instanceof E?t:E,t=Object.create(t.prototype),r=new k(r||[]);return u(t,"_invoke",{value:(o=e,a=n,i=r,s=p,function(e,t){if(s===f)throw Error("Generator is already running");if(s===h){if("throw"===e)throw t;return{value:l,done:!0}}for(i.method=e,i.arg=t;;){var n=i.delegate;if(n){n=function e(t,n){var r=n.method,o=t.iterator[r];if(o===l)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=l,e(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;r=d(o,t.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,g;o=r.arg;return o?o.done?(n[t.resultName]=o.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=l),n.delegate=null,g):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}(n,i);if(n){if(n===g)continue;return n}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(s===p)throw s=h,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);s=f;n=d(o,a,i);if("normal"===n.type){if(s=i.done?h:m,n.arg===g)continue;return{value:n.arg,done:i.done}}"throw"===n.type&&(s=h,i.method="throw",i.arg=n.arg)}})}),t}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}i.wrap=s;var p="suspendedStart",m="suspendedYield",f="executing",h="completed",g={};function E(){}function y(){}function T(){}var t={},v=(a(t,r,function(){return this}),Object.getPrototypeOf),v=v&&v(v(C([]))),_=(v&&v!==e&&c.call(v,r)&&(t=v),T.prototype=E.prototype=Object.create(t));function b(e){["next","throw","return"].forEach(function(t){a(e,t,function(e){return this._invoke(t,e)})})}function A(i,s){var t;u(this,"_invoke",{value:function(n,r){function e(){return new s(function(e,t){!function t(e,n,r,o){var a,e=d(i[e],i,n);if("throw"!==e.type)return(n=(a=e.arg).value)&&"object"==O(n)&&c.call(n,"__await")?s.resolve(n.__await).then(function(e){t("next",e,r,o)},function(e){t("throw",e,r,o)}):s.resolve(n).then(function(e){a.value=e,r(a)},function(e){return t("throw",e,r,o)});o(e.arg)}(n,r,e,t)})}return t=t?t.then(e,e):e()}})}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function N(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function k(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function C(t){if(t||""===t){var n,e=t[r];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return n=-1,(e=function e(){for(;++n{if(Array.isArray(e))return e})(e)||((e,t)=>{var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,s=[],l=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw o}}return s}})(e,t)||fe(e,t)||(()=>{throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function fe(e,t){var n;if(e)return"string"==typeof e?C(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?C(e,t):void 0}function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{s=M().mark(function e(){var t,n;return M().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,n=null!=(n=wp.data.select("core/editor").getCurrentPostId())?n:document.getElementById("post_ID").value,n="".concat(activityLocalizer.apiUrl,"/cf/v2/activities?postID=").concat(n),e.next=5,fetch(n,{method:"GET",headers:{"X-WP-Nonce":activityLocalizer.nonce}});case 5:if((t=e.sent).ok){e.next=8;break}throw new Error("Network response was not ok");case 8:return e.next=10,t.json();case 10:n=e.sent,p(0{if("object"!=R(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0===n)return("string"===t?String:Number)(e);if("object"!=R(n=n.call(e,t||"default")))return n;throw new TypeError("@@toPrimitive must return a primitive value.")})(e,"string");return"symbol"==R(e)?e:e+""}var I,H=wp.i18n.__,U=wp.element.Fragment,s=wp.plugins.registerPlugin,i,Re=(i=wp.editPost).PluginSidebar,Le=i.PluginSidebarMoreMenuItem,i,Ie=(i=wp.components).PanelBody,Me=i.TabPanel,xe=i.ToggleControl,j=jQuery,F=wp.i18n.sprintf,i,Pe=((i=wp.keycodes).displayShortcut,i.isKeyboardEvent),i,De=((i=wp.hooks).addFilter,(e=>{function i(e){var t;if(!(this instanceof i))throw new TypeError("Cannot call a class as a function");t=ke(this,i,[e]),e=t,r=function(e){wp.data.dispatch("mdstore").setShowActivities(e),t.setState({showActivities:e}),t.setState({isLoading:e}),t.getComments()},(n=we(n="enableshowActivitiesToggleUpdate"))in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r;var e=wp.data.select,n=e("mdstore").getShowActivities(),r=e("mdstore").getShowComments(),o=null==(o=e("core/editor").getEditedPostAttribute("meta"))?void 0:o._sb_show_suggestion_boards,a=null==(a=e("core/editor").getEditedPostAttribute("meta"))?void 0:a._is_real_time_mode,e=e("mdstore").getSuggestionMode();return t.state={threads:[],isLoading:!1,showActivities:n,showComments:r,collapseLimit:50,hasAccordian:!1,hasAccordianSuggestions:!1,hasAccordionReviewSugesstions:!1,suggestionEnable:e,suggestionBoardsEnable:o,enableCoEditing:a,usersWithAccess:[]},t.postID=wp.data.select("core/editor").getCurrentPostId(),t.edit=t.edit.bind(t),t.reply=t.reply.bind(t),t.delete=t.delete.bind(t),t.toggleCollapseLink=t.toggleCollapseLink.bind(t),t.resolveThread=t.resolveThread.bind(t),t.handleShowComments=t.handleShowComments.bind(t),t.getComments=t.getComments.bind(t),t.currentUserID=activityLocalizer.currentUserID,t.setUserFlag,t.enableshowActivitiesToggleUpdate=t.enableshowActivitiesToggleUpdate.bind(t),t}var t,n=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),e&&Oe(n,e),n=i,(e=[{key:"collapseBoardOnMobile",value:function(){var e;window.innerWidth<=768&&(this.setState({showComments:wp.data.dispatch("mdstore").setShowComments(!1)}),(e=document.body).classList.add("hide-comments"),e.classList.remove("commentOn"),e=new CustomEvent("editorLayoutUpdate"),document.dispatchEvent(e))}},{key:"collapseText",value:function(e){var t=this.state.collapseLimit;return null!==t&&e&&t<=e.replace(/<\/?[^>]+(>|$)/g,"").length&&(e=e.slice(0,t)+(e.length>t?"...":"")),H(e,"content-collaboration-inline-commenting")}},{key:"toggleCollapseLink",value:function(e){var t=e.target.dataset.id,e=e.target,n=H("Show more","content-collaboration-inline-commenting"),r=H("Show less","content-collaboration-inline-commenting");e.innerHTML===n?(e.innerHTML=r,document.getElementById("show-all-".concat(t)).classList.remove("js-hide"),document.getElementById("show-less-".concat(t)).classList.add("js-hide")):(e.innerHTML=n,document.getElementById("show-all-".concat(t)).classList.add("js-hide"),document.getElementById("show-less-".concat(t)).classList.remove("js-hide"))}},{key:"getComments",value:function(){var e,n=this;wp.data.select("mdstore").getShowActivities()?(e="".concat(activityLocalizer.apiUrl,"/cf/v2/activities?postID=").concat(this.postID),fetch(e,{method:"GET",headers:{"X-WP-Nonce":activityLocalizer.nonce}}).then(function(e){if(e.ok)return e.json();throw new Error("Network response was not ok")}).then(function(e){var t=0%s',H("Suggestion mode is limited to a few blocks and actions only.","content-collaboration-inline-commenting"),H("Check compatibility.","content-collaboration-inline-commenting")),y(e),cf_removeAllNotices(),wp.data.dispatch("core/notices").createNotice("success",H("Suggestion Mode is ON","content-collaboration-inline-commenting"),{id:"suggestionModeOn",type:"snackbar",isDismissible:!0})):(cf_removeAllNotices(),wp.data.dispatch("core/notices").createNotice("success",H("Suggestion Mode is OFF","content-collaboration-inline-commenting"),{id:"suggestionModeOff",type:"snackbar",isDismissible:!0}))}},{key:"acceptAllSuggestions",value:function(){var e=new SuggestionComment,t=document.querySelectorAll(".cls-board-outer .sg-board").length;e.acceptAllSuggestion(),cf_removeAllNotices(),wp.data.dispatch("core/notices").createNotice("success",F("%s (%d)",H("Suggestions Accepted","content-collaboration-inline-commenting"),t),{id:"suggestionsAccepted",type:"snackbar",isDismissible:!0}),e.acceptAllSuggestion(),(new i).getComments()}},{key:"rejectAllSuggestions",value:function(){var e=new SuggestionComment,t=document.querySelectorAll(".cls-board-outer .sg-board").length;e.rejectAllSuggestion(),cf_removeAllNotices(),wp.data.dispatch("core/notices").createNotice("success",F("%s (%d)",H("Suggestions Rejected","content-collaboration-inline-commenting"),t),{id:"suggestionsRejected",type:"snackbar",isDismissible:!0}),(new i).getComments()}},{key:"render",value:function(){var t,n,a,r,i,o,s,l,c,u,e,d=this,p=wp.data.select("core/edit-post").isEditingTemplate();function m(e){e&&(e={elID:["sg",e].join("")},i.push(e))}return p?null:(e=this.state,t=e.threads,n=e.isLoading,a=e.collapseLimit,r=e.showActivities,this.postStatus=wp.data.select("core/editor").getCurrentPost().status,i=[],e=document.querySelector(".block-editor-iframe__container iframe"),p||e&&e.contentDocument?((p=e.contentDocument).querySelectorAll(".wp-block mdspan, .wp-block .mdadded, .wp-block .mdmodified, .wp-block .mdremoved, .commentIcon, .cf-onwhole-block__comment").forEach(function(e){e=e.getAttribute("datatext");e&&i.push({elID:e})}),p.querySelectorAll(".wp-block .mdadded, .wp-block .mdmodified, .wp-block .mdremoved, .commentIcon, .blockAdded, .blockremove, .cf-onwhole-block__comment").forEach(function(e){var t=e.getAttribute("id");(t=e.classList.contains("blockAdded")||e.classList.contains("blockremove")?e.getAttribute("suggestion_id"):t)&&i.push({elID:"sg".concat(t)})}),p.querySelectorAll("[textAlign_sg_id], [lock_sg_id], [align_sg_id], [width_sg_id], [url_sg_id], [link_sg_id], [style_sg_id], [minheight_sg_id], [contentposition_sg_id], [tracks_sg_id], [table_style_sg_id]").forEach(function(t){cfgetCustomAttribute().forEach(function(e){t.getAttribute(e)&&m(t.getAttribute(e))})})):(document.querySelectorAll(".commentIcon, .cf-onwhole-block__comment, .wp-block mdspan").forEach(function(e){e=e.getAttribute("datatext");e&&i.push({elID:e})}),document.querySelectorAll(".wp-block .mdadded, .wp-block .mdmodified, .wp-block .mdremoved, .blockAdded, .blockremove").forEach(function(e){var t=e.getAttribute("id");(t=e.classList.contains("blockAdded")||e.classList.contains("blockremove")?e.getAttribute("suggestion_id"):t)&&m(t)}),document.querySelectorAll("[textAlign_sg_id], [lock_sg_id], [align_sg_id], [width_sg_id], [url_sg_id], [link_sg_id], [style_sg_id], [minheight_sg_id], [contentposition_sg_id], [tracks_sg_id], [table_style_sg_id]").forEach(function(t){cfgetCustomAttribute().forEach(function(e){t.getAttribute(e)&&m(t.getAttribute(e))})})),o=[],s=[],l=0,null!==i&&null!=t&&(t.forEach(function(e){"false"===e.resolved&&o.push(e.elID)}),i.forEach(function(e){s.push(e.elID)}),c=new Set(s),(u=o.filter(function(e){return!c.has(e)})).forEach(function(e){e.match(/el/g)&&l++})),I=null==(e=wp.data.select("core/editor").getEditedPostAttribute("meta"))?void 0:e._sb_show_comment_boards,"1"!==cf_permissions.hide_comment&&(p=document.body,!I&&p.classList.contains("hide-comments")?p.classList.remove("hide-comments"):I&&!p.classList.contains("hide-comments")&&"1"!==cf_permissions.hide_comment&&(p.classList.add("hide-comments"),document.querySelectorAll("#cf-comment-board-wrapper .cls-board-outer.cm-board").forEach(function(e){e.classList.remove("focus"),e.classList.remove("is-open"),e.removeAttribute("style")}),document.querySelectorAll("mdspan").forEach(function(e){e.removeAttribute("data-rich-text-format-boundary")}))),"cf-activity-center/cf-activity-center"===wp.data.select("core/edit-post").getActiveGeneralSidebarName()&&setTimeout(function(){var e=document.getElementById("cf-comment-board-wrapper");(null==e?void 0:e.querySelector(".".concat("focus")))||document.querySelectorAll(".js-activity-centre .user-data-row").forEach(function(e){e.classList.remove("active")})},200),document.body.classList.contains("hide-sg")?document.body.classList.remove("hide-sg"):document.body.classList.contains("hide-sg")||((e=document.querySelector(".cls-board-outer.sg-board.focus"))&&(p=e.getAttribute("data-sid"),(e=document.getElementById(p))&&e.removeAttribute("data-rich-text-format-boundary"),wp.data.dispatch("mdstore").setDataText("")),document.body.classList.add("hide-sg"),document.querySelectorAll("#cf-comment-board-wrapper .cls-board-outer.sg-board").forEach(function(e){e.classList.remove("focus"),e.classList.remove("is-open")})),multicollab_fs.is_plan_free&&document.body.classList.remove("hide-sg"),0No recent activities found!")},200),React.createElement(Ie,{className:"cf-multicollab-sidebar-panel"},multicollab_fs.can_use_premium_code&&multicollab_fs.is_plan_pro&&"1"===cf_permissions.resolved_suggestion&&1=getCommentsLimit()?"none":""}},React.createElement("div",{className:"user-data"},React.createElement(ve,{c:e,th:n}),React.createElement("div",{className:"user-data-wrapper"},React.createElement("div",{className:"user-commented-on"},t<=0&&React.createElement(U,null,React.createElement("blockquote",{className:"user-commented-icon"+(n.blockType?"-"+n.blockType:"")+(n.action&&"delete"===n.action.toLowerCase()?" delete":" add")},"deleted"===e.status||"true"===n.resolved?React.createElement(U,null,"sg"===n.type?React.createElement(U,null,React.createElement("span",{id:"show-all-".concat(e.id),class:"user-commented-on show-all js-hide ","data-id":"cf-".concat(n.elID)},React.createElement(E,null,F("%s : %s",H(n.action,"content-collaboration-inline-commenting"),H(translateStringFormat(n.selectedText),"content-collaboration-inline-commenting")))),React.createElement("span",{id:"show-less-".concat(e.id),class:"user-commented-on show-less","data-id":"cf-".concat(n.elID)},React.createElement(E,null,d.collapseText(F("%s : %s",H(n.action,"content-collaboration-inline-commenting"),H(translateStringFormat(n.selectedText),"content-collaboration-inline-commenting")))))):React.createElement(U,null,React.createElement("span",{id:"show-all-".concat(e.id),class:"user-commented-on show-all js-hide ","data-id":"cf-".concat(n.elID)},React.createElement(E,null,translateStringFormat(n.selectedText))),React.createElement("span",{id:"show-less-".concat(e.id),class:"user-commented-on show-less","data-id":"cf-".concat(n.elID)},React.createElement(E,null,d.collapseText(translateStringFormat(n.selectedText))))),null!==n.selectedText&&a<=n.selectedText.replace(/<\/?[^>]+(>|$)/g,"").length&&React.createElement("a",{href:"javascript:void(0)",className:"cf-show-more","data-id":e.id,onClick:d.toggleCollapseLink.bind(d)},H("Show more","content-collaboration-inline-commenting"))):React.createElement(U,null,"sg"===n.type?React.createElement(U,null,React.createElement("a",{id:"show-all-".concat(e.id),class:"user-commented-on show-all js-hide ","data-elid":"cf-".concat(n.elID),href:"javascript:void(0)",onClick:d.reply.bind(d)},React.createElement(E,null,F("%s : %s",H(n.action,"content-collaboration-inline-commenting"),H(translateStringFormat(n.selectedText),"content-collaboration-inline-commenting")))),React.createElement("a",{id:"show-less-".concat(e.id),class:"user-commented-on show-less","data-elid":"cf-".concat(n.elID),href:"javascript:void(0)",onClick:d.reply.bind(d)},React.createElement(E,null,d.collapseText(F("%s : %s",H(n.action,"content-collaboration-inline-commenting"),H(translateStringFormat(n.selectedText),"content-collaboration-inline-commenting")))))):React.createElement(U,null,React.createElement("a",{id:"show-all-".concat(e.id),class:"user-commented-on show-all js-hide ","data-elid":"cf-".concat(n.elID),href:"javascript:void(0)",onClick:d.reply.bind(d)},React.createElement(E,null,translateStringFormat(n.selectedText))),React.createElement("a",{id:"show-less-".concat(e.id),class:"user-commented-on show-less","data-elid":"cf-".concat(n.elID),href:"javascript:void(0)",onClick:d.reply.bind(d)},React.createElement(E,null,d.collapseText(translateStringFormat(n.selectedText))))),null!==n.selectedText&&a<=n.selectedText.replace(/<\/[^>]+(>|$)/g,"").length&&React.createElement("a",{href:"javascript:void(0)",className:"cf-show-more","data-id":e.id,onClick:d.toggleCollapseLink.bind(d)},H("Show more","content-collaboration-inline-commenting")))))),React.createElement("div",{class:"user-comment"},0getCommentsLimit()&&React.createElement("div",{className:"show-all-comments"}," ",F(H("Show all %d replies"),n.activities.length-1)," "),"true"===n.resolved&&void 0!==n.resolvedBy&&React.createElement(Ee,{th:n}))})):"cf-settings"===e.name&&j(".cf-settings-tab-title").css("display","block")?React.createElement(Se,{handleShowComments:d.handleShowComments,enableCoEditing:d.enableCoEditing,postStatus:d.postStatus,commentBoardToggle:I}):"cf-comment-summary"===e.name&&j(".cf-comment-summary-tab-title").css("display","block")?React.createElement(React.Fragment,null,!0===n&&React.createElement("div",{className:"comment-summary-row-loading"},React.createElement("strong",null,H("Loading...","content-collaboration-inline-commenting"))),!1===n&&React.createElement(ge,{commentAutoDrafts:l,setDifference:u})):void 0}),React.createElement(U,null,React.createElement("div",{className:"cf-feedback-post-wrap__outer",style:{display:"none"}},React.createElement("div",{className:"cf-feedback-post-wrap__inner"},React.createElement("button",{className:"cf-feedback-post-wrap__button"},f.fbcommentIcon))))))}}])&&Ne(n.prototype,e),t&&Ne(n,t),Object.defineProperty(n,"prototype",{writable:!1}),n})(React.Component));s("cf-activity-center",{icon:f.multicollab,render:function(){return React.createElement(U,null,React.createElement(Le,{target:"cf-activity-center"},H("Multicollab","cf-activity-center")),React.createElement(Re,{name:"cf-activity-center",title:H("Multicollab","cf-activity-center")},React.createElement(De,null)))}})}})(); \ No newline at end of file diff --git a/commenting-block.php b/commenting-block.php index 6742019..4534f6e 100644 --- a/commenting-block.php +++ b/commenting-block.php @@ -78,17 +78,6 @@ function cf_custom_plugin_row_meta( $plugin_meta, $plugin_file ) { * @author: Rishi Shah * @version 3.4 */ -// $remote_arrd = filter_input( INPUT_SERVER, 'REMOTE_ADDR', FILTER_SANITIZE_SPECIAL_CHARS ); -// if ( '127.' === substr( $remote_arrd, 0, 4 ) || '::1' === $remote_arrd ) { -// define( 'CF_PROMOTIONAL_BANNER_API_URL', 'https://multicollabstg.wpengine.com/' ); -// define( 'CF_STORE_URL', 'https://multicollabstg.wpengine.com/' ); -// define( 'EDD_PLAN_PRO', 2817 ); -// } else { -// define( 'CF_PROMOTIONAL_BANNER_API_URL', 'https://www.multicollab.com/' ); -// define( 'CF_STORE_URL', 'https://www.multicollab.com/' ); -// define( 'EDD_PLAN_PRO', 3793 ); -// } - define( 'CF_PROMOTIONAL_BANNER_API_URL', 'https://www.multicollab.com/' ); define( 'CF_STORE_URL', 'https://www.multicollab.com/' ); define( 'EDD_PLAN_PRO', 3793 );