"),this.removeFile(e),l.$el.closest("#whats-new-form").removeClass("media-uploading"))}),bp.Nouveau.Activity.postForm.dropzone.on("removedfile",function(e){if(!0===bp.draft_activity.allow_delete_media){if(l.media.length){for(var t in l.media){var i;e.id===l.media[t].id?(_.isUndefined(l.media[t].saved)||l.media[t].saved||bp.Nouveau.Media.removeAttachment(e.id),l.media.splice(t,1),l.model.set("media",l.media)):"edit"===bp.draft_activity.display_post||!e.media_edit_data||(i=e.media_edit_data.id)===l.media[t].id&&(l.media.splice(t,1),l.model.set("media",l.media),bp.Nouveau.Media.removeAttachment(i))}var a=l.$el.find(".dz-preview.dz-error").length;l.media.length===a&&l.model.unset("media")}_.isNull(bp.Nouveau.Activity.postForm.dropzone.files)||0!==bp.Nouveau.Activity.postForm.dropzone.files.length||(l.$el.closest("#whats-new-form").removeClass("media-uploading"),(a=l.$el.parents("#whats-new-form")).find("#activity-document-button")&&a.find("#activity-document-button").parents(".post-elements-buttons-item").removeClass("disable no-click"),a.find("#activity-video-button")&&a.find("#activity-video-button").parents(".post-elements-buttons-item").removeClass("disable no-click"),a.find("#activity-gif-button")&&a.find("#activity-gif-button").parents(".post-elements-buttons-item").removeClass("disable no-click"),a.find("#activity-media-button")&&a.find("#activity-media-button").parents(".post-elements-buttons-item").removeClass("no-click"),l.model.unset("media"),g("#message-feedabck").hasClass("noMediaError")&&l.model.unset("errors")),bp.draft_content_changed=!0}}),bp.Nouveau.Activity.postForm.dropzone.on("complete",function(){0===this.getUploadingFiles().length&&0===this.getQueuedFiles().length&&0"+BP_Nouveau.media.invalid_file_type+". "+(t||"")+"
"),this.removeFile(e),l.$el.closest("#whats-new-form").removeClass("media-uploading"))}),bp.Nouveau.Activity.postForm.dropzone.on("removedfile",function(e){if(!0===bp.draft_activity.allow_delete_media){if(l.document.length)for(var t in l.document){var i;e.id===l.document[t].id?(_.isUndefined(l.document[t].saved)||l.document[t].saved||bp.Nouveau.Media.removeAttachment(e.id),l.document.splice(t,1),l.model.set("document",l.document)):"edit"===bp.draft_activity.display_post||!e.document_edit_data||(i=e.document_edit_data.id)===l.document[t].id&&(l.document.splice(t,1),l.model.set("document",l.document),bp.Nouveau.Media.removeAttachment(i))}var a;_.isNull(bp.Nouveau.Activity.postForm.dropzone.files)||0!==bp.Nouveau.Activity.postForm.dropzone.files.length||(l.$el.closest("#whats-new-form").removeClass("media-uploading"),(a=l.$el.parents("#whats-new-form")).find("#activity-media-button")&&a.find("#activity-media-button").parents(".post-elements-buttons-item").removeClass("disable active no-click"),a.find("#activity-video-button")&&a.find("#activity-video-button").parents(".post-elements-buttons-item").removeClass("disable active no-click"),a.find("#activity-gif-button")&&a.find("#activity-gif-button").parents(".post-elements-buttons-item").removeClass("disable active no-click"),a.find("#activity-document-button")&&a.find("#activity-document-button").parents(".post-elements-buttons-item").removeClass("disable no-click"),l.model.unset("document"),g("#message-feedabck").hasClass("noMediaError")&&l.model.unset("errors")),bp.draft_content_changed=!0}}),bp.Nouveau.Activity.postForm.dropzone.on("complete",function(e){0===this.getUploadingFiles().length&&0===this.getQueuedFiles().length&&0'),g(e.previewElement).closest(".dz-preview").addClass("dz-has-thumbnail")):bp.Nouveau.getVideoThumb&&bp.Nouveau.getVideoThumb(e,".dz-video-thumbnail")}),bp.Nouveau.Activity.postForm.dropzone.on("sending",function(e,t,i){i.append("action","video_upload"),i.append("_wpnonce",BP_Nouveau.nonces.video);i=l.$el.parents("#whats-new-form");i.find("#activity-media-button")&&i.find("#activity-media-button").parents(".post-elements-buttons-item").addClass("disable"),i.find("#activity-gif-button")&&i.find("#activity-gif-button").parents(".post-elements-buttons-item").addClass("disable"),i.find("#activity-document-button")&&i.find("#activity-document-button").parents(".post-elements-buttons-item").addClass("disable"),i.find("#activity-video-button")&&i.find("#activity-video-button").parents(".post-elements-buttons-item").addClass("no-click")}),bp.Nouveau.Activity.postForm.dropzone.on("uploadprogress",function(e){l.$el.closest("#whats-new-form").addClass("media-uploading");var t=g(e.previewElement).find(".dz-progress-ring circle")[0],i=2*t.r.baseVal.value*Math.PI;t.style.strokeDasharray=i+" "+i;var a=i-e.upload.progress.toFixed(0)/100*i;e.upload.progress<=99?(g(e.previewElement).find(".dz-progress-count").text(e.upload.progress.toFixed(0)+"% "+BP_Nouveau.video.i18n_strings.video_uploaded_text),t.style.strokeDashoffset=a):100===e.upload.progress&&(t.style.strokeDashoffset=i-.99*i,g(e.previewElement).find(".dz-progress-count").text("99% "+BP_Nouveau.video.i18n_strings.video_uploaded_text))}),bp.Nouveau.Activity.postForm.dropzone.on("success",function(e,t){if(100===e.upload.progress&&(g(e.previewElement).find(".dz-progress-ring circle")[0].style.strokeDashoffset=0,g(e.previewElement).find(".dz-progress-count").text("100% "+BP_Nouveau.video.i18n_strings.video_uploaded_text),g(e.previewElement).closest(".dz-preview").addClass("dz-complete")),!t.data.id){var i,a,o,s,d,n=t.data.feedback;for(e.previewElement.classList.add("dz-error"),d=[],a=0,o=(s=e.previewElement.querySelectorAll("[data-dz-errormessage]")).length;a"+BP_Nouveau.video.invalid_video_type+". "+(t||"")+"
"),this.removeFile(e),l.$el.closest("#whats-new-form").removeClass("media-uploading"))}),bp.Nouveau.Activity.postForm.dropzone.on("removedfile",function(e){if(!0===bp.draft_activity.allow_delete_media){if(l.video.length)for(var t in l.video){var i;e.id===l.video[t].id?(_.isUndefined(l.video[t].saved)||l.video[t].saved||bp.Nouveau.Media.removeAttachment(e.id),l.video.splice(t,1),l.model.set("video",l.video)):"edit"===bp.draft_activity.display_post||!e.video_edit_data||(i=e.video_edit_data.id)===l.video[t].id&&(l.video.splice(t,1),l.model.set("video",l.video),bp.Nouveau.Media.removeAttachment(i))}var a;_.isNull(bp.Nouveau.Activity.postForm.dropzone.files)||0!==bp.Nouveau.Activity.postForm.dropzone.files.length||(l.$el.closest("#whats-new-form").removeClass("media-uploading"),(a=l.$el.parents("#whats-new-form")).find("#activity-media-button")&&a.find("#activity-media-button").parents(".post-elements-buttons-item").removeClass("disable active no-click"),a.find("#activity-gif-button")&&a.find("#activity-gif-button").parents(".post-elements-buttons-item").removeClass("disable active no-click"),a.find("#activity-document-button")&&a.find("#activity-document-button").parents(".post-elements-buttons-item").removeClass("disable active no-click"),l.model.unset("video"),g("#message-feedabck").hasClass("noMediaError")&&l.model.unset("errors")),bp.draft_content_changed=!0}}),bp.Nouveau.Activity.postForm.dropzone.on("complete",function(){0===this.getUploadingFiles().length&&0===this.getQueuedFiles().length&&0/gi,"\n").replace(/<\/div>/gi,""))).replace(/ /g," "),""!==a.find(".ac-textarea").children(".ac-input").text().trim()||0<=i.indexOf("emojioneemoji")?g(a).closest("form").addClass("has-content"):g(a).closest("form").removeClass("has-content")),_.isUndefined(e)||_.isEmpty(t)||!_.isEmpty(this.model.get("gif_data"))||(bp.draft_content_changed=!0)}}),bp.Views.GifMediaSearchDropdown=bp.View.extend({tagName:"div",className:"activity-attached-gif-container",template:bp.template("gif-media-search-dropdown"),total_count:0,offset:0,limit:20,q:null,requests:[],standalone:!1,events:{"keydown .search-query-input":"search","click .found-media-item":"select"},initialize:function(e){this.select=this.select.bind(this),e&&void 0!==e.standalone&&(this.standalone=e.standalone),this.options=e||{},this.giphy=new window.Giphy(BP_Nouveau.media.gif_api_key),this.gifDataItems=new bp.Collections.GifDatas,this.listenTo(this.gifDataItems,"add",this.addOne),this.listenTo(this.gifDataItems,"reset",this.addAll),document.addEventListener("scroll",_.bind(this.loadMore,this),!0)},render:function(){return this.$el.html(this.template(this.model.toJSON())),this.$gifResultItem=this.$el.find(".gif-search-results-list"),this.loadTrending(),this},search:function(e){if("Enter"===e.key||13===e.keyCode)return e.preventDefault(),!1;var t=this;null!=this.Timeout&&clearTimeout(this.Timeout),""!==e.target.value?this.Timeout=setTimeout(function(){this.Timeout=null,t.searchGif(e.target.value)},1e3):this.loadTrending()},searchGif:function(e){var t=this;t.q=e,t.offset=0,t.clearRequests(),t.el.classList.add("loading"),this.$el.find(".gif-no-results").removeClass("show"),this.$el.find(".gif-no-connection").removeClass("show");e=t.giphy.search({q:e,offset:t.offset,fmt:"json",limit:this.limit},function(e){void 0!==e.data.length&&0===e.data.length&&g(t.el).find(".gif-no-results").addClass("show"),void 0!==e.meta.status&&200!==e.meta.status&&g(t.el).find(".gif-no-connection").addClass("show"),t.gifDataItems.reset(e.data),t.total_count=e.pagination.total_count,t.el.classList.remove("loading")},function(){g(t.el).find(".gif-no-connection").addClass("show")});t.requests.push(e),t.offset=t.offset+t.limit},select:function(e){e.preventDefault(),this.$el.parent().removeClass("open");var t=this.gifDataItems.findWhere({id:e.currentTarget.dataset.id});this.model.set("gif_data",t.attributes);t=this.$el.parents("#whats-new-form");t.find("#activity-document-button")&&t.find("#activity-document-button").parents(".post-elements-buttons-item").addClass("disable"),t.find("#activity-media-button")&&t.find("#activity-media-button").parents(".post-elements-buttons-item").addClass("disable"),t.find("#activity-video-button")&&t.find("#activity-video-button").parents(".post-elements-buttons-item").addClass("disable");t=this.$el.parents(".ac-reply-content");t.find(".ac-reply-toolbar .ac-reply-media-button")&&t.find(".ac-reply-toolbar .ac-reply-media-button").parents(".post-elements-buttons-item").addClass("disable"),t.find(".ac-reply-toolbar .ac-reply-document-button")&&t.find(".ac-reply-toolbar .ac-reply-document-button").parents(".post-elements-buttons-item").addClass("disable"),t.find(".ac-reply-toolbar .ac-reply-video-button")&&t.find(".ac-reply-toolbar .ac-reply-video-button").parents(".post-elements-buttons-item").addClass("disable");t=this.$el.closest("#whats-new-form");(this.standalone?this.$el.closest(".screen-content, .elementor-widget-container").find("#activity-modal .ac-form"):this.$el.closest(".ac-form")).addClass("has-gif");t=t.find(".whats-new-scroll-view");0=i.scrollHeight&&!i.classList.contains("loading")&&0
"),this.removeFile(e),l.$el.closest("#whats-new-form").removeClass("media-uploading"))}),bp.Nouveau.Activity.postForm.dropzone.on("removedfile",function(e){if(!0===bp.draft_activity.allow_delete_media){if(l.media.length){for(var t in l.media){var i;e.id===l.media[t].id?(_.isUndefined(l.media[t].saved)||l.media[t].saved||bp.Nouveau.Media.removeAttachment(e.id),l.media.splice(t,1),l.model.set("media",l.media)):"edit"===bp.draft_activity.display_post||!e.media_edit_data||(i=e.media_edit_data.id)===l.media[t].id&&(l.media.splice(t,1),l.model.set("media",l.media),bp.Nouveau.Media.removeAttachment(i))}var a=l.$el.find(".dz-preview.dz-error").length;l.media.length===a&&l.model.unset("media")}_.isNull(bp.Nouveau.Activity.postForm.dropzone.files)||0!==bp.Nouveau.Activity.postForm.dropzone.files.length||(l.$el.closest("#whats-new-form").removeClass("media-uploading"),(a=l.$el.parents("#whats-new-form")).find("#activity-document-button")&&a.find("#activity-document-button").parents(".post-elements-buttons-item").removeClass("disable no-click"),a.find("#activity-video-button")&&a.find("#activity-video-button").parents(".post-elements-buttons-item").removeClass("disable no-click"),a.find("#activity-gif-button")&&a.find("#activity-gif-button").parents(".post-elements-buttons-item").removeClass("disable no-click"),a.find("#activity-media-button")&&a.find("#activity-media-button").parents(".post-elements-buttons-item").removeClass("no-click"),l.model.unset("media"),g("#message-feedabck").hasClass("noMediaError")&&l.model.unset("errors")),bp.draft_content_changed=!0}}),bp.Nouveau.Activity.postForm.dropzone.on("complete",function(){0===this.getUploadingFiles().length&&0===this.getQueuedFiles().length&&0"+BP_Nouveau.media.invalid_file_type+". "+(t||"")+"
"),this.removeFile(e),l.$el.closest("#whats-new-form").removeClass("media-uploading"))}),bp.Nouveau.Activity.postForm.dropzone.on("removedfile",function(e){if(!0===bp.draft_activity.allow_delete_media){if(l.document.length)for(var t in l.document){var i;e.id===l.document[t].id?(_.isUndefined(l.document[t].saved)||l.document[t].saved||bp.Nouveau.Media.removeAttachment(e.id),l.document.splice(t,1),l.model.set("document",l.document)):"edit"===bp.draft_activity.display_post||!e.document_edit_data||(i=e.document_edit_data.id)===l.document[t].id&&(l.document.splice(t,1),l.model.set("document",l.document),bp.Nouveau.Media.removeAttachment(i))}var a;_.isNull(bp.Nouveau.Activity.postForm.dropzone.files)||0!==bp.Nouveau.Activity.postForm.dropzone.files.length||(l.$el.closest("#whats-new-form").removeClass("media-uploading"),(a=l.$el.parents("#whats-new-form")).find("#activity-media-button")&&a.find("#activity-media-button").parents(".post-elements-buttons-item").removeClass("disable active no-click"),a.find("#activity-video-button")&&a.find("#activity-video-button").parents(".post-elements-buttons-item").removeClass("disable active no-click"),a.find("#activity-gif-button")&&a.find("#activity-gif-button").parents(".post-elements-buttons-item").removeClass("disable active no-click"),a.find("#activity-document-button")&&a.find("#activity-document-button").parents(".post-elements-buttons-item").removeClass("disable no-click"),l.model.unset("document"),g("#message-feedabck").hasClass("noMediaError")&&l.model.unset("errors")),bp.draft_content_changed=!0}}),bp.Nouveau.Activity.postForm.dropzone.on("complete",function(e){0===this.getUploadingFiles().length&&0===this.getQueuedFiles().length&&0'),g(e.previewElement).closest(".dz-preview").addClass("dz-has-thumbnail")):bp.Nouveau.getVideoThumb&&bp.Nouveau.getVideoThumb(e,".dz-video-thumbnail")}),bp.Nouveau.Activity.postForm.dropzone.on("sending",function(e,t,i){i.append("action","video_upload"),i.append("_wpnonce",BP_Nouveau.nonces.video);i=l.$el.parents("#whats-new-form");i.find("#activity-media-button")&&i.find("#activity-media-button").parents(".post-elements-buttons-item").addClass("disable"),i.find("#activity-gif-button")&&i.find("#activity-gif-button").parents(".post-elements-buttons-item").addClass("disable"),i.find("#activity-document-button")&&i.find("#activity-document-button").parents(".post-elements-buttons-item").addClass("disable"),i.find("#activity-video-button")&&i.find("#activity-video-button").parents(".post-elements-buttons-item").addClass("no-click")}),bp.Nouveau.Activity.postForm.dropzone.on("uploadprogress",function(e){l.$el.closest("#whats-new-form").addClass("media-uploading");var t=g(e.previewElement).find(".dz-progress-ring circle")[0],i=2*t.r.baseVal.value*Math.PI;t.style.strokeDasharray=i+" "+i;var a=i-e.upload.progress.toFixed(0)/100*i;e.upload.progress<=99?(g(e.previewElement).find(".dz-progress-count").text(e.upload.progress.toFixed(0)+"% "+BP_Nouveau.video.i18n_strings.video_uploaded_text),t.style.strokeDashoffset=a):100===e.upload.progress&&(t.style.strokeDashoffset=i-.99*i,g(e.previewElement).find(".dz-progress-count").text("99% "+BP_Nouveau.video.i18n_strings.video_uploaded_text))}),bp.Nouveau.Activity.postForm.dropzone.on("success",function(e,t){if(100===e.upload.progress&&(g(e.previewElement).find(".dz-progress-ring circle")[0].style.strokeDashoffset=0,g(e.previewElement).find(".dz-progress-count").text("100% "+BP_Nouveau.video.i18n_strings.video_uploaded_text),g(e.previewElement).closest(".dz-preview").addClass("dz-complete")),!t.data.id){var i,a,o,s,d,n=t.data.feedback;for(e.previewElement.classList.add("dz-error"),d=[],a=0,o=(s=e.previewElement.querySelectorAll("[data-dz-errormessage]")).length;a"+BP_Nouveau.video.invalid_video_type+". "+(t||"")+"
"),this.removeFile(e),l.$el.closest("#whats-new-form").removeClass("media-uploading"))}),bp.Nouveau.Activity.postForm.dropzone.on("removedfile",function(e){if(!0===bp.draft_activity.allow_delete_media){if(l.video.length)for(var t in l.video){var i;e.id===l.video[t].id?(_.isUndefined(l.video[t].saved)||l.video[t].saved||bp.Nouveau.Media.removeAttachment(e.id),l.video.splice(t,1),l.model.set("video",l.video)):"edit"===bp.draft_activity.display_post||!e.video_edit_data||(i=e.video_edit_data.id)===l.video[t].id&&(l.video.splice(t,1),l.model.set("video",l.video),bp.Nouveau.Media.removeAttachment(i))}var a;_.isNull(bp.Nouveau.Activity.postForm.dropzone.files)||0!==bp.Nouveau.Activity.postForm.dropzone.files.length||(l.$el.closest("#whats-new-form").removeClass("media-uploading"),(a=l.$el.parents("#whats-new-form")).find("#activity-media-button")&&a.find("#activity-media-button").parents(".post-elements-buttons-item").removeClass("disable active no-click"),a.find("#activity-gif-button")&&a.find("#activity-gif-button").parents(".post-elements-buttons-item").removeClass("disable active no-click"),a.find("#activity-document-button")&&a.find("#activity-document-button").parents(".post-elements-buttons-item").removeClass("disable active no-click"),l.model.unset("video"),g("#message-feedabck").hasClass("noMediaError")&&l.model.unset("errors")),bp.draft_content_changed=!0}}),bp.Nouveau.Activity.postForm.dropzone.on("complete",function(){0===this.getUploadingFiles().length&&0===this.getQueuedFiles().length&&0/gi,"\n").replace(/<\/div>/gi,""))).replace(/ /g," "),""!==a.find(".ac-textarea").children(".ac-input").text().trim()||0<=i.indexOf("emojioneemoji")?g(a).closest("form").addClass("has-content"):g(a).closest("form").removeClass("has-content")),_.isUndefined(e)||_.isEmpty(t)||!_.isEmpty(this.model.get("gif_data"))||(bp.draft_content_changed=!0)}}),bp.Views.GifMediaSearchDropdown=bp.View.extend({tagName:"div",className:"activity-attached-gif-container",template:bp.template("gif-media-search-dropdown"),total_count:0,offset:0,limit:20,q:null,requests:[],standalone:!1,events:{"keydown .search-query-input":"search","click .found-media-item":"select"},initialize:function(e){this.select=this.select.bind(this),e&&void 0!==e.standalone&&(this.standalone=e.standalone),this.options=e||{},this.giphy=new window.Giphy(BP_Nouveau.media.gif_api_key),this.gifDataItems=new bp.Collections.GifDatas,this.listenTo(this.gifDataItems,"add",this.addOne),this.listenTo(this.gifDataItems,"reset",this.addAll),document.addEventListener("scroll",_.bind(this.loadMore,this),!0)},render:function(){return this.$el.html(this.template(this.model.toJSON())),this.$gifResultItem=this.$el.find(".gif-search-results-list"),this.loadTrending(),this},search:function(e){if("Enter"===e.key||13===e.keyCode)return e.preventDefault(),!1;var t=this;null!=this.Timeout&&clearTimeout(this.Timeout),""!==e.target.value?this.Timeout=setTimeout(function(){this.Timeout=null,t.searchGif(e.target.value)},1e3):this.loadTrending()},searchGif:function(e){var t=this;t.q=e,t.offset=0,t.clearRequests(),t.el.classList.add("loading"),this.$el.find(".gif-no-results").removeClass("show"),this.$el.find(".gif-no-connection").removeClass("show");e=t.giphy.search({q:e,offset:t.offset,fmt:"json",limit:this.limit},function(e){void 0!==e.data.length&&0===e.data.length&&g(t.el).find(".gif-no-results").addClass("show"),void 0!==e.meta.status&&200!==e.meta.status&&g(t.el).find(".gif-no-connection").addClass("show"),t.gifDataItems.reset(e.data),t.total_count=e.pagination.total_count,t.el.classList.remove("loading")},function(){g(t.el).find(".gif-no-connection").addClass("show")});t.requests.push(e),t.offset=t.offset+t.limit},select:function(e){e.preventDefault(),this.$el.parent().removeClass("open");var t=this.gifDataItems.findWhere({id:e.currentTarget.dataset.id});this.model.set("gif_data",t.attributes);t=this.$el.parents("#whats-new-form");t.find("#activity-document-button")&&t.find("#activity-document-button").parents(".post-elements-buttons-item").addClass("disable"),t.find("#activity-media-button")&&t.find("#activity-media-button").parents(".post-elements-buttons-item").addClass("disable"),t.find("#activity-video-button")&&t.find("#activity-video-button").parents(".post-elements-buttons-item").addClass("disable");t=this.$el.parents(".ac-reply-content");t.find(".ac-reply-toolbar .ac-reply-media-button")&&t.find(".ac-reply-toolbar .ac-reply-media-button").parents(".post-elements-buttons-item").addClass("disable"),t.find(".ac-reply-toolbar .ac-reply-document-button")&&t.find(".ac-reply-toolbar .ac-reply-document-button").parents(".post-elements-buttons-item").addClass("disable"),t.find(".ac-reply-toolbar .ac-reply-video-button")&&t.find(".ac-reply-toolbar .ac-reply-video-button").parents(".post-elements-buttons-item").addClass("disable");t=this.$el.closest("#whats-new-form");(this.standalone?this.$el.closest(".screen-content, .elementor-widget-container").find("#activity-modal .ac-form"):this.$el.closest(".ac-form")).addClass("has-gif");t=t.find(".whats-new-scroll-view");0=i.scrollHeight&&!i.classList.contains("loading")&&0