jQuery(document).ready(function($){var RvyInitializeBlockEditorModifications=function(){if(($('button.editor-post-publish-button').length||$('button.editor-post-publish-panel__toggle').length)&&($('button.editor-post-switch-to-draft').length||$('button.editor-post-save-draft').length)){clearInterval(RvyInitInterval);$('select.editor-post-author__select').parent().hide();$('button.editor-post-trash').parent().show();$('button.editor-post-switch-to-draft').hide();$('div.components-notice-list').hide();}}
var RvyInitInterval=setInterval(RvyInitializeBlockEditorModifications,50);var RvyInitializeHeaderCaption=function(){if($('#editor .editor-document-bar span.editor-document-bar__post-type-label').length){clearInterval(RvyHeaderInterval);$('#editor .editor-document-bar span.editor-document-bar__post-type-label').append(' '+rvyObjEdit.revisionCaption+' ');}}
var RvyHeaderInterval=setInterval(RvyInitializeHeaderCaption,50);var RvyHideElements=function(){var ediv='div.edit-post-sidebar ';if($(ediv+'div.edit-post-post-visibility,'+ediv+'div.editor-post-link,'+ediv+'select.editor-post-author__select:visible,'+ediv+'div.components-base-control__field input[type="checkbox"]:visible,'+ediv+'button.editor-post-switch-to-draft,'+ediv+'button.editor-post-trash').length){$(ediv+'select.editor-post-author__select').parent().hide();$(ediv+'button.editor-post-trash').parent().show();$(ediv+'button.editor-post-switch-to-draft').hide();$(ediv+'div.editor-post-link').parent().hide();$(ediv+'div.components-notice-list').hide();if(!rvyObjEdit.scheduledRevisionsEnabled){$(ediv+'div.edit-post-post-schedule').hide();}
$(ediv+'#publishpress-notifications').hide();$('#icl_div').closest('div.edit-post-meta-boxes-area').hide();}
if('future'==rvyObjEdit.currentStatus){$('button.editor-post-publish-button').show();}else{if($('button.editor-post-publish-button').length&&($('button.editor-post-save-draft:visible').length||$('button.editor-post-saved-stated:visible').length)){$('button.editor-post-publish-button').hide();}}
ediv=null;}
var RvyHideInterval=setInterval(RvyHideElements,50);var RvySubmissionUI=function(){selectedDateHTML=wp.data.select('core/editor').getEditedPostAttribute('date');var selectedDate=new Date(selectedDateHTML);var currentDate=new Date();RvyTimeSelection=selectedDate.getTime()-((currentDate.getTimezoneOffset()*60-rvyObjEdit.timezoneOffset)*1000);if(RvyTimeSelection-currentDate.getTime()>120000){var approveCaption=rvyObjEdit['scheduleCaption'];if('future'==rvyObjEdit.currentStatus){approveCaption=rvyObjEdit['futureActionCaption'];}else{approveCaption=rvyObjEdit['scheduleCaption'];}}else{var approveCaption=rvyObjEdit['approveCaption'];}
if($('div.edit-post-post-schedule').length&&!$('div.editor-post-schedule__panel-dropdown:visible').length){$('.rvy-creation-ui').remove();}
if(approveCaption){if($('button.rvy-direct-approve:visible').length){$('button.rvy-direct-approve:visible span.rvy-caption').html(approveCaption);}else{$('button.revision-approve:visible span.rvy-caption').html(approveCaption);}}
$('button.edit-post-post-visibility__toggle, div.editor-post-url__panel-dropdown, div.components-checkbox-control').closest("div.editor-post-panel__row").hide();var refSelectorUseParent=false;if($('div.edit-post-post-schedule').length){var refSelector='div.edit-post-post-schedule';}else{var refSelector='div.edit-post-post-visibility';if(!$(refSelector).length){if($('button.editor-post-trash').length){refSelector='button.editor-post-trash';refSelectorUseParent=true;}else{if($('div.editor-post-panel__section').length){refSelector='div.editor-post-panel__section';}else{refSelector='div.edit-post-post-status h2';}}}}
if(refSelectorUseParent){var foundUIloc=$(refSelector).parent().length;}else{var foundUIloc=$(refSelector).length;}
if(rvyObjEdit.ajaxurl&&!$('div.edit-post-revision-status').length&&foundUIloc){if($('div.editor-post-panel__row-label').length){var labelOpen='<div class="editor-post-panel__row-label">';var labelClose='</div>';var statusWrapperClass='editor-post-panel__row-control';}else{var labelOpen='<span>';var labelClose='</span>';var statusWrapperClass='';}
var currentStatusCaption;if(typeof rvyObjEdit[rvyObjEdit.currentStatus+'StatusCaption']!=='undefined'){currentStatusCaption=rvyObjEdit[rvyObjEdit.currentStatus+'StatusCaption'];}else{currentStatusCaption='';}
if(refSelector=='div.editor-post-panel__section'){var rvyUI='';if(statusWrapperClass){statusWrapperClass+=' gutenberg-18-5';rvyUI+='<div class="'+statusWrapperClass+'">';}
rvyUI+='<div class="components-dropdown rvy-current-status">'
+currentStatusCaption
+'</div>';if(statusWrapperClass){rvyUI+='</div>';}
$('div.editor-post-panel__row-control div.editor-post-status').html(rvyUI);}else{if($('div.editor-post-status').length){$('.rvy-creation-ui.edit-post-revision-status').remove();$('div.editor-post-status').parent().html('<div class="components-dropdown rvy-current-status">'
+currentStatusCaption
+'</div>');}else{if(!$('.rvy-current-status').length){var rvyUI='<div class="components-panel__row rvy-creation-ui edit-post-revision-status">'
+labelOpen+rvyObjEdit.statusLabel+labelClose;if(statusWrapperClass){rvyUI+='<div class="'+statusWrapperClass+'">';}
rvyUI+='<div class="components-dropdown rvy-current-status">'
+currentStatusCaption
+'</div>';if(statusWrapperClass){rvyUI+='</div>';}
rvyUI+='</div>';$(refSelector).before(rvyUI);}}}
if(rvyObjEdit[rvyObjEdit.currentStatus+'ActionURL']){var url=rvyObjEdit[rvyObjEdit.currentStatus+'ActionURL'];}else{var url='javascript:void(0)';}
if(rvyObjEdit[rvyObjEdit.currentStatus+'ActionCaption']){var approveButtonHTML='';var mainDashicon='';if(rvyObjEdit.canPublish&&('pending'!=rvyObjEdit.currentStatus)&&('future'!=rvyObjEdit.currentStatus)){approveButtonHTML='<a href="'+rvyObjEdit['pendingActionURL']+'" class="revision-approve">'
+'<button type="button" class="components-button revision-approve is-button is-primary ppr-purple-button rvy-direct-approve">'
+'<span class="dashicons dashicons-yes"></span>'
+'<span class="rvy-caption">'+rvyObjEdit['approveCaption']+'</span></button></a>';mainDashicon='dashicons-upload';}else{if('pending'==rvyObjEdit.currentStatus){mainDashicon='dashicons-yes';}else{mainDashicon='dashicons-upload';}}
var rvyPreviewLink='';if(rvyObjEdit[rvyObjEdit.currentStatus+'CompletedLinkCaption']){rvyPreviewLink='<br /><a href="'+rvyObjEdit[rvyObjEdit.currentStatus+'CompletedURL']+'" class="revision-approve revision-preview components-button is-secondary ppr-purple-button" target="pp_revisions_copy">'
+rvyObjEdit[rvyObjEdit.currentStatus+'CompletedLinkCaption']+'</a>';}
if(refSelector=='div.editor-post-panel__section'){divClass=' gutenberg-18-5';}else{divClass='';}
if(refSelectorUseParent){var uiLoc=$(refSelector).parent();}else{var uiLoc=$(refSelector);}
if(!$('div.rvy-creation-ui').length){var buttonUI='<div class="rvy-creation-ui rvy-submission-div'+divClass+'">';if((!approveButtonHTML&&rvyObjEdit.canPublish)||!rvyObjEdit.approveButtonReplacesSubmit){buttonUI+='<a href="'+url+'" class="revision-approve">'
+'<button type="button" class="components-button revision-approve is-button is-primary ppr-purple-button">'
+'<span class="dashicons '+mainDashicon+'"></span>'
+'<span class="rvy-caption">'+rvyObjEdit[rvyObjEdit.currentStatus+'ActionCaption']+'</span></button></a>';}
buttonUI+=approveButtonHTML
+rvyObjEdit.saveRevisionTooltip
+'<div class="revision-submitting" style="display: none;">'
+'<span class="revision-approve revision-submitting">'
+rvyObjEdit[rvyObjEdit.currentStatus+'InProcessCaption']+'</span><span class="spinner ppr-submission-spinner" style=""></span></div>'
+'<div class="revision-approving" style="display: none;">'
+'<span class="revision-approve revision-submitting">'
+rvyObjEdit.approvingCaption+'</span><span class="spinner ppr-submission-spinner" style=""></span></div>'
+'<div class="revision-created" style="display: none; margin-top: 15px">'
+'<span class="revision-approve revision-created">'
+rvyObjEdit[rvyObjEdit.currentStatus+'CompletedCaption']+'</span> '
+rvyPreviewLink
+'</div>'
+'</div>';$(uiLoc).after(buttonUI);}
$('div.rvy-submission-div').trigger('loaded-ui');}
$('.edit-post-post-schedule__toggle').after('<button class="components-button is-tertiary post-schedule-footnote" disabled>'+rvyObjEdit.onApprovalCaption+'</button>');}
refSelector=null;url=null;approveButtonHTML=null;mainDashicon=null;rvyPreviewLink=null;$('button.post-schedule-footnote').toggle(!/\d/.test($('button.edit-post-post-schedule__toggle').html()));$('button.editor-post-trash').parent().css('text-align','right');}
var RvyUIInterval=setInterval(RvySubmissionUI,100);setInterval(function(){if(rvyObjEdit.deleteCaption&&$('button.editor-post-trash').length&&($('button.editor-post-trash').html()!=rvyObjEdit.deleteCaption)){$('button.editor-post-trash').html(rvyObjEdit.deleteCaption).closest('div').show();}},100);var redirectCheckSaveDoneInterval=false;function rvyDoSubmission(){rvySubmitCopy();}
function rvyDoApproval(){setTimeout(function(){var redirectCheckSaveDoneInterval=setInterval(function(){if(!wp.data.select('core/editor').isSavingPost()||$('div.edit-post-header button.is-saved').length){clearInterval(redirectCheckSaveDoneInterval);if(rvyRedirectURL!=''){setTimeout(function(){window.location.href=rvyRedirectURL;},5000);}}},100);},500);}
rvyObjEdit.creationDisabled=false;function rvyDisableSubmitApprove(){if(rvyObjEdit.creationDisabled){return;}
rvyObjEdit.creationDisabled=true;$('a.revision-approve').attr('title',rvyObjEdit.actionDisabledTitle);$('a.revision-schedule').attr('title',rvyObjEdit.scheduleDisabledTitle);$('button.revision-approve, button.revision-schedule').prop('disabled','disabled');$('a.revision-approve, a.revision-schedule').css('pointer-events','none');$('div.rvy-save-revision-tip').show();$('div.editor-sidebar__panel-tabs div button').on('click',function(){setInterval(function(){if(rvyObjEdit.creationDisabled){$('button.revision-approve, button.revision-schedule').prop('disabled','disabled');$('a.revision-approve, a.revision-schedule').css('pointer-events','none');$('div.rvy-save-revision-tip').show();}},500);});intSaveWatch=setInterval(()=>{if(!$('button.editor-post-save-draft:visible').length||wp.data.select('core/editor').isSavingPost()){rvyObjEdit.creationDisabled=false;$('button.revision-approve').prop('disabled',false);$('button.revision-schedule').prop('disabled',false);$('a.revision-approve, a.revision-schedule').css('pointer-events','auto');$('div.rvy-save-revision-tip').hide();$('a.revision-approve').attr('title',rvyObjEdit.actionTitle);$('a.revision-schedule').attr('title',rvyObjEdit.scheduleTitle);clearInterval(intSaveWatch);}},500);}
if(rvyObjEdit.disableSubmitUntilSave){var intSaveWatch;setTimeout(function(){$(document).on('click','div.postbox-container,button.components-button:not(.revision-approve):not(.revision-schedule),div.acf-postbox,.editor-post-schedule__dialog-toggle',function(){rvyDisableSubmitApprove();});},200);}
var rvyRedirectURL='';$(document).on('click','button.revision-approve',function(){var isApproval=$(this).hasClass('rvy-direct-approve');var isSubmission=(rvyObjEdit[rvyObjEdit.currentStatus+'ActionURL']=="")&&!isApproval;$('button.revision-approve').hide();if(!isSubmission&&(isApproval||('future'==rvyObjEdit.currentStatus)||('future-revision'==rvyObjEdit.currentStatus))){$('div.revision-approving').show().css('display','block');$('div.revision-approving span.ppr-submission-spinner').css('visibility','visible');}
if(isApproval){if(wp.data.select('core/editor').isEditedPostDirty()){wp.data.dispatch('core/editor').savePost();}
rvyRedirectURL=$('div.rvy-creation-ui button.rvy-direct-approve').closest('a').attr('href');if(rvyRedirectURL==''){rvyRedirectURL=$('div.rvy-creation-ui button.revision-approve').closest('a').attr('href');}}else{rvyRedirectURL=$('div.rvy-creation-ui a').attr('href');}
if(isSubmission){$('div.revision-submitting').show();$('div.revision-submitting .spinner').css('visibility','visible');rvyDoSubmission();}else{rvyDoApproval();}
isApproval=null;isSubmission=null;return false;});function rvySubmitCopy(){var revisionaryCreateDone=function(){if(wp.data.select('core/editor').isEditedPostDirty()){wp.data.dispatch('core/editor').savePost();}
$('.revision-approve').hide();$('div.revision-submitting').hide();$('.revision-created').show();rvyObjEdit.currentStatus='pending';$('.rvy-current-status').html(rvyObjEdit[rvyObjEdit.currentStatus+'StatusCaption']);$('a.revision-preview').attr('href',rvyObjEdit[rvyObjEdit.currentStatus+'CompletedURL']).show();$('a.revision-edit').attr('href',rvyObjEdit[rvyObjEdit.currentStatus+'CompletedEditURL']).show();if((typeof PPCustomStatuses!='undefined')&&(typeof PPCustomStatuses.statusRestProperty!='undefined')){var ret=new Object();ret[PPCustomStatuses.statusRestProperty]='pending-revision';wp.data.dispatch('core/editor').editPost(ret);}}
$.ajax({url:rvyObjEdit.ajaxurl,data:{'rvy_ajax_field':rvyObjEdit[rvyObjEdit.currentStatus+'AjaxField'],'rvy_ajax_value':wp.data.select('core/editor').getCurrentPostId(),'_rvynonce':rvyObjEdit.revisionActionNonce},dataType:"html",success:revisionaryCreateDone,error:function(data,txtStatus){$('div.rvy-creation-ui').html(rvyObjEdit[rvyObjEdit.currentStatus+'ErrorCaption']);}});}
var RvyRecaptionDefaultButtons=function(){if(!rvyObjEdit.isStatusesPro){RvyRecaptionSaveButton(rvyObjEdit.saveRevision);}
if(('future'==rvyObjEdit.currentStatus)||('future-revision'==rvyObjEdit.currentStatus)||!rvyObjEdit.isStatusesPro){$('button.editor-post-publish-panel__toggle').hide();}
if(rvyObjEdit.viewURL&&($('.editor-preview-dropdown__toggle').length||$('div.block-editor-post-preview__dropdown').length)){var viewPreviewLink='<a href="'
+rvyObjEdit.viewURL
+'" target="pp_revisions_copy" role="menuitem" class="ppr-purple-button components-button is-primary editor-preview-dropdown__button-external">'
+rvyObjEdit.viewTitle
+'</a>';if(!$('div.components-menu-group div a.ppr-purple-button').length){if($('.editor-preview-dropdown__button-external svg').length){$('.editor-preview-dropdown__button-external:not(.ppr-purple-button)').closest('div.components-dropdown-menu__menu').after('<div class="components-menu-group"><div role="group">'+viewPreviewLink+'</div></div>');}}}
if(rvyObjEdit.viewTitle){$('div.edit-post-header__settings a.rvy-post-preview').attr('title',rvyObjEdit.viewTitle);}
if(rvyObjEdit.revisionEdits&&$('div.edit-post-sidebar a.editor-post-last-revision__title:visible').length&&!$('div.edit-post-sidebar a.editor-post-last-revision__title.rvy-recaption').length){$('div.edit-post-sidebar a.editor-post-last-revision__title').html(rvyObjEdit.revisionEdits);$('div.edit-post-sidebar a.editor-post-last-revision__title').addClass('rvy-recaption');}
newPreviewItem=null;}
var RvyRecaptionSaveDraftInterval=setInterval(RvyRecaptionDefaultButtons,100);function RvyRecaptionSaveButton(btnCaption){jQuery(document).ready(function($){btnSelector='button.editor-post-save-draft';var node=$(btnSelector);if(wp.data.select('core/editor').isSavingPost()){return;}
if(!btnCaption){btnCaption=rvyObjEdit.saveRevision;}
if(btnCaption!=$('span.revisionary-save-button button').html()||!$('span.revisionary-save-button button:visible').length||$('button.editor-post-save-draft:visible').length){var hideClass='presspermit-save-hidden';if(!$('.revisionary-save-button').length){node.after('<span class="revisionary-save-button">'+node.clone().css('z-index',0).removeClass(hideClass).removeClass('editor-post-save-draft').removeAttr('disabled').removeAttr('aria-disabled').removeAttr('style').css('white-space','nowrap').css('position','relative').show().html(btnCaption).wrap('<span>').parent().html()+'</span>');node.addClass(hideClass).hide().css('z-index',-999);$('span.revisionary-save-button button').removeClass('editor-post-save-draft').removeClass(hideClass).removeClass('is-tertiary').addClass('is-primary').addClass('ppr-purple-button').html(btnCaption);node.addClass(hideClass).attr('aria-disabled',true);}}});}
$(document).on('click','span.revisionary-save-button button',function(){if(!wp.data.select('core/editor').isSavingPost()&&!$('span.revisionary-save-button button').attr('aria-disabled')){$(this).parent().prev('button.editor-post-save-draft').trigger('click');}});});