diff --git a/modules/calendar/lib/async-calendar/js/Functions.jsx b/modules/calendar/lib/async-calendar/js/Functions.jsx
index 9ca67e311..53544f80c 100644
--- a/modules/calendar/lib/async-calendar/js/Functions.jsx
+++ b/modules/calendar/lib/async-calendar/js/Functions.jsx
@@ -135,10 +135,11 @@ export function getDateWithNoTimezoneOffset(dateString) {
}
export function getPostLinksElement(linkData, handleOnClick) {
+ var className = linkData.className ? linkData.className : '';
if (linkData.url) {
- return ({linkData.label});
+ return ({linkData.label});
} else if (linkData.action) {
- return ( handleOnClick(e, linkData)}>{linkData.label});
+ return ( handleOnClick(e, linkData)}>{linkData.label});
}
}
diff --git a/modules/calendar/lib/async-calendar/js/ItemFormPopup.jsx b/modules/calendar/lib/async-calendar/js/ItemFormPopup.jsx
index 0a7116f5a..2cad1b7d6 100644
--- a/modules/calendar/lib/async-calendar/js/ItemFormPopup.jsx
+++ b/modules/calendar/lib/async-calendar/js/ItemFormPopup.jsx
@@ -366,12 +366,14 @@ export default function ItemFormPopup(props) {
const formLinks = [
{
'id': 'create',
+ 'className': 'button-primary calendar-create-btn',
'label': props.strings.save,
'labelLoading': props.strings.saving,
'action': 'publishpress_calendar_create_item'
},
{
'id': 'edit',
+ 'className': 'button-secondary calendar-edit-btn',
'label': props.strings.saveAndEdit,
'labelLoading': props.strings.saving,
'action': 'publishpress_calendar_create_item'
@@ -393,7 +395,7 @@ export default function ItemFormPopup(props) {
} else {
links.push(getPostLinksElement(linkData, handleLinkOnClick));
}
- links.push(|);
+ links.push();
}
links.pop();
diff --git a/modules/calendar/lib/async-calendar/js/index.min.js b/modules/calendar/lib/async-calendar/js/index.min.js
index 6525fd205..0c041fdbf 100644
--- a/modules/calendar/lib/async-calendar/js/index.min.js
+++ b/modules/calendar/lib/async-calendar/js/index.min.js
@@ -1 +1 @@
-!function(e){var t={};function a(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,a),r.l=!0,r.exports}a.m=e,a.c=t,a.d=function(e,t,n){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)a.d(n,r,function(t){return e[t]}.bind(null,r));return n},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=3)}([function(e,t){e.exports=wp.element},function(e,t){e.exports=ReactDOM},,function(e,t,a){"use strict";function n(e){var t;e.icon&&(t=React.createElement("span",{className:"dashicons dashicons-"+e.icon}));var a="publishpress-calendar-button "+(e.className||"");return React.createElement("a",{href:e.href||"#",className:a,onClick:e.onClick},t,e.label)}function r(e){return React.createElement("div",{className:"publishpress-calendar-navigation-bar"},React.createElement(n,{className:"refresh-button",icon:"update-alt",onClick:e.refreshOnClickCallback}),React.createElement(n,{label:"«",onClick:e.backPageOnClickCallback}),React.createElement(n,{label:"‹",onClick:e.backOnClickCallback}),React.createElement(n,{label:e.strings.today,onClick:e.todayOnClickCallback}),React.createElement(n,{label:"›",onClick:e.forwardOnClickCallback}),React.createElement(n,{label:"»",onClick:e.forwardPageOnClickCallback}))}function l(e){for(var t=[e.strings.weekDaySun,e.strings.weekDayMon,e.strings.weekDayTue,e.strings.weekDayWed,e.strings.weekDayThu,e.strings.weekDayFri,e.strings.weekDaySat],a=[],n=(e.weekStartsOnSunday?0:1)-1,r=0;r<7;r++)n++,6!==r||e.weekStartsOnSunday||(n=0),a.push({key:n.toString(),label:t[n]});return React.createElement(React.Fragment,null,a.map((function(e){return React.createElement("th",{key:e.key.toString()},e.label)})))}function s(e){var t=e.showSpinner||!1,a=e.message||"";return React.createElement("div",{className:"publishpress-calendar-message-bar"},t&&React.createElement("span",{className:"dashicons dashicons-update-alt publishpress-spinner"}),React.createElement("span",null,a))}function i(e){return(i="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 o(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return t};var e,t={},a=Object.prototype,n=a.hasOwnProperty,r=Object.defineProperty||function(e,t,a){e[t]=a.value},l="function"==typeof Symbol?Symbol:{},s=l.iterator||"@@iterator",c=l.asyncIterator||"@@asyncIterator",u=l.toStringTag||"@@toStringTag";function p(e,t,a){return Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{p({},"")}catch(e){p=function(e,t,a){return e[t]=a}}function d(e,t,a,n){var l=t&&t.prototype instanceof b?t:b,s=Object.create(l.prototype),i=new D(n||[]);return r(s,"_invoke",{value:j(e,a,i)}),s}function m(e,t,a){try{return{type:"normal",arg:e.call(t,a)}}catch(e){return{type:"throw",arg:e}}}t.wrap=d;var f="suspendedStart",h="executing",v="completed",g={};function b(){}function y(){}function E(){}var w={};p(w,s,(function(){return this}));var k=Object.getPrototypeOf,_=k&&k(k(T([])));_&&_!==a&&n.call(_,s)&&(w=_);var C=E.prototype=b.prototype=Object.create(w);function R(e){["next","throw","return"].forEach((function(t){p(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function a(r,l,s,o){var c=m(e[r],e,l);if("throw"!==c.type){var u=c.arg,p=u.value;return p&&"object"==i(p)&&n.call(p,"__await")?t.resolve(p.__await).then((function(e){a("next",e,s,o)}),(function(e){a("throw",e,s,o)})):t.resolve(p).then((function(e){u.value=e,s(u)}),(function(e){return a("throw",e,s,o)}))}o(c.arg)}var l;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){a(e,n,t,r)}))}return l=l?l.then(r,r):r()}})}function j(t,a,n){var r=f;return function(l,s){if(r===h)throw new Error("Generator is already running");if(r===v){if("throw"===l)throw s;return{value:e,done:!0}}for(n.method=l,n.arg=s;;){var i=n.delegate;if(i){var o=S(i,n);if(o){if(o===g)continue;return o}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===f)throw r=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=h;var c=m(t,a,n);if("normal"===c.type){if(r=n.done?v:"suspendedYield",c.arg===g)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r=v,n.method="throw",n.arg=c.arg)}}}function S(t,a){var n=a.method,r=t.iterator[n];if(r===e)return a.delegate=null,"throw"===n&&t.iterator.return&&(a.method="return",a.arg=e,S(t,a),"throw"===a.method)||"return"!==n&&(a.method="throw",a.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var l=m(r,t.iterator,a.arg);if("throw"===l.type)return a.method="throw",a.arg=l.arg,a.delegate=null,g;var s=l.arg;return s?s.done?(a[t.resultName]=s.value,a.next=t.nextLoc,"return"!==a.method&&(a.method="next",a.arg=e),a.delegate=null,g):s:(a.method="throw",a.arg=new TypeError("iterator result is not an object"),a.delegate=null,g)}function O(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 P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function D(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(O,this),this.reset(!0)}function T(t){if(t||""===t){var a=t[s];if(a)return a.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,l=function a(){for(;++r=0;--l){var s=this.tryEntries[l],i=s.completion;if("root"===s.tryLoc)return r("end");if(s.tryLoc<=this.prev){var o=n.call(s,"catchLoc"),c=n.call(s,"finallyLoc");if(o&&c){if(this.prev=0;--a){var r=this.tryEntries[a];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--t){var a=this.tryEntries[t];if(a.finallyLoc===e)return this.complete(a.completion,a.afterLoc),P(a),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var a=this.tryEntries[t];if(a.tryLoc===e){var n=a.completion;if("throw"===n.type){var r=n.arg;P(a)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,a,n){return this.delegate={iterator:T(t),resultName:a,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function c(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function u(e){for(var t=1;t2&&void 0!==arguments[2])||arguments[2],n=new Date(t,0,1+7*(e-1)),r=n.getDay(),l=n;return r<=4?l.setDate(n.getDate()-n.getDay()+1):l.setDate(n.getDate()+8-n.getDay()),a&&l.setDate(l.getDate()-1),l}function h(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],a=new Date(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),n=a.getDay();a.setDate(a.getDate()+4-(a.getDay()||7));var r=new Date(a.getFullYear(),0,1),l=Math.round(((a-r)/864e5+1)/7);return t&&0===n&&l++,[a.getFullYear(),l]}function v(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],a=h(e,t);return f(a[1],a[0],t)}function g(e){return e.getFullYear()+"-"+(e.getMonth()+1).toString().padStart(2,"0")+"-"+e.getDate().toString().padStart(2,"0")}function b(e,t){return e.url?React.createElement("a",{key:"link-".concat(e.url,"-").concat(e.label),href:e.url},e.label):e.action?React.createElement("a",{key:"link-".concat(e.url,"-").concat(e.label),onClick:function(a){return t(a,e)}},e.label):void 0}function y(e,t,a){return E.apply(this,arguments)}function E(){return(E=m(o().mark((function e(t,a,n){var r,l,s;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=n+"?action="+t,e.t0=o().keys(a);case 2:if((e.t1=e.t0()).done){e.next=9;break}if(l=e.t1.value,a.hasOwnProperty(l)){e.next=6;break}return e.abrupt("continue",2);case 6:r+="&"+l+"="+a[l],e.next=2;break;case 9:return e.next=11,fetch(r);case 11:return s=e.sent,e.next=14,s.json();case 14:return e.abrupt("return",e.sent);case 15:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function w(){return(w=m(o().mark((function e(t,a,n,r){var l,s,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:l=n+"?action="+t,e.t0=o().keys(a);case 2:if((e.t1=e.t0()).done){e.next=9;break}if(s=e.t1.value,a.hasOwnProperty(s)){e.next=6;break}return e.abrupt("continue",2);case 6:l+="&"+s+"="+a[s],e.next=2;break;case 9:return e.next=11,fetch(l,{method:"post",body:r});case 11:return i=e.sent,e.next=14,i.json();case 14:return e.abrupt("return",e.sent);case 15:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function k(e){return new Date(String(e).replace(/-/g,"/"))}function _(e,t){for(var a in t)t.hasOwnProperty(a)&&t[a].forEach((function(t){if(t.calendar_post_data&&Object.keys(t.calendar_post_data).length>0){var a=e.findIndex((function(e){return e.post_id===t.calendar_post_data.post_id})),n=u(u({},t.calendar_post_data),{},{taxonomies:u({},t.calendar_taxonomies_data)});a>-1?e[a]=n:e.push(n)}}));return e}function C(e,t,a){e.preventDefault();var n=t.closest(".modal-content-right");t.addClass("disabled");var r=t.attr("data-post_id"),l=n.find(".title-area").val(),s=n.find(".content_board_post_date_hidden").val(),i=n.find(".pp-modal-form-author").val(),o=n.find(".pp-modal-form-post-status").val(),c={};n.find(".pp-modal-form-post-taxonomy").each((function(){var e=jQuery(this);c[e.attr("data-taxonomy")]=e.val()}));var u={action:"publishpress_content_calendar_update_post",post_id:r,post_title:l,post_date:s,post_author:i,post_status:o,post_taxonomies:c,nonce:publishpressCalendarParams.nonce};jQuery.post(ajaxurl,u,(function(n){if("success"==n.status){var s=publishpressCalendarParams.PostData,i=jQuery(".publishpress-calendar .publishpress-calendar-item.post-"+r),c=s.findIndex((function(e){return Number(e.post_id)===Number(r)})),u=s[c],p=u.taxonomies;u.post_title=l,u.raw_title=l,u.post_status=o,u.author_markup=n.author_markup,u.date_markup=n.date_markup;var d=n.taxonomy_terms;for(var m in d)if(d.hasOwnProperty(m)){var f=d[m];p[m].terms=f}u.taxonomies=p,publishpressCalendarParams.PostData[c]=u,i.find(".publishpress-calendar-item-title").html(u.post_title),"function"==typeof a&&a(e)}t.removeClass("disabled"),function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"success",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";setTimeout((function(){var a="pp-floating-msg-"+Math.round((new Date).getTime()+100*Math.random()),n=jQuery(".pp-floating-status").length;jQuery("#wpbody-content").after(''+t+""),jQuery("."+a).css("bottom",45*n).fadeIn(1e3).delay(1e4).fadeOut(1e3,(function(){jQuery(this).remove()}))}),500)}(n.status,n.content)}))}function R(e){var t=publishpressCalendarParams.PostData,a=t.findIndex((function(t){return Number(t.post_id)===Number(e)}));if(-1===a)return console.error("Post with id "+e+" not found"),void console.log(t);var n=t[a],r=n.post_status,l=t[a-1]||t[t.length-1],s=t[a+1]||t[0],i=n.status_label,o=n.action_links,c=n.taxonomies||null,u=Number(n.can_edit_post)>0,p='";var d='",jQuery("#pp-content-calendar-general-modal-container").html(d);var v=Math.round(.78*window.innerHeight);tb_show(p,"#TB_inline?width=600&height="+v+"&inlineId=pp-content-calendar-general-modal");var g=jQuery("body.pp-content-calendar-page #TB_window").css("height");if(g){var b=parseInt(g,10)-55;jQuery(".pp-content-calendar-general-modal-container .modal-content-right .scrollable-content").css("height",b-60+"px"),jQuery(".pp-content-calendar-general-modal-container .modal-content-left").css("height",b+"px"),jQuery("body.pp-content-calendar-page #TB_ajaxContent").css("height",b+"px");var y=jQuery(".pp-content-calendar-general-modal-container .modal-post-title .title-area");y.length>0&&x(!1,y)}jQuery(".pp-content-calendar-general-modal-container .modal-content-right .date-time-pick").each((function(){var e=jQuery(this),t=function(e,t){var a={dateFormat:publishpressCalendarParams.strings.date_format,firstDay:publishpressCalendarParams.strings.week_first_day},n=jQuery.extend({},a,t),r=e.attr("data-alt-field");return r&&void 0!==r&&0!=r.length?jQuery.extend({},n,{altField:'input[name="'+r+'"]',altFormat:e.attr("data-alt-format")}):n}(e,{alwaysSetTime:!1,controlType:"select",altFieldTimeOnly:!1});e.hasClass("future-date")&&(t.minDate=new Date),e.datetimepicker(t)})),jQuery(".pp-modal-form-author").pp_select2({allowClear:!1,ajax:{url:ajaxurl,dataType:"json",delay:0,data:function(e){return{action:"publishpress_calendar_search_authors",nonce:publishpressCalendarParams.nonce,q:e.term}},processResults:function(e){return{results:e}},cache:!1}}),jQuery(".pp-modal-form-post-taxonomy").pp_select2({allowClear:!0,ajax:{url:ajaxurl,dataType:"json",delay:0,data:function(e){return{action:"publishpress_calendar_search_terms",taxonomy:jQuery(this).attr("data-taxonomy"),nonce:publishpressCalendarParams.nonce,q:e.term}},processResults:function(e){return{results:e}},cache:!1}}),jQuery(".pp-modal-form-post-status").pp_select2({allowClear:!1})}function x(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return function(e){if(!e)e=jQuery(".pp-content-calendar-general-modal-container .modal-post-title .title-area");e.css("height","auto"),e.css("height",e[0].scrollHeight+"px")}(t)}function j(e){return e.isEditing?React.createElement("input",{type:"text",id:e.id,value:e.value,onChange:function(t){e.onChange&&e.onChange(t,t.target.value)}}):React.createElement("time",{dateTime:e.value,title:e.value,id:e.id},e.valueString||e.value)}a.r(t);var S=jQuery;function O(e){var t,a=React.useRef(null);React.useEffect((function(){var t={placeholder:e.placeholder||!1,tags:!0,allowClear:void 0===e.allowClear||null===e.allowClear||e.allowClear};return e.ajaxUrl&&e.ajaxAction&&(t.ajax={delay:250,url:e.ajaxUrl,dataType:"json",data:function(t){var a={q:t.term,action:e.ajaxAction,nonce:e.nonce};if(e.ajaxArgs)for(var n in e.ajaxArgs)e.ajaxArgs.hasOwnProperty(n)&&(a[n]=e.ajaxArgs[n]);return a},processResults:function(e){return{results:e}}}),S(a.current).pp_select2(t).on("select2:select",(function(t){"function"==typeof e.onSelect&&e.onSelect(t,a.current,S(a.current).pp_select2("data"))})).on("select2:clear",(function(t){"function"==typeof e.onClear&&e.onClear(t,a.current)})),function(){S(a.current).pp_select2("destroy")}}),[]),e.options&&(t=e.options.map((function(e){return React.createElement("option",{key:"select-option-".concat(e.value),value:e.value},e.text)})));var n="pp_select2";return e.className&&(n+=" "+e.className),n+=e.metadata?"pp-calendar-form-metafied "+e.post_types:"",React.createElement("select",{className:n,defaultValue:e.value,type:"select",name:e.name,id:e.id,multiple:e.multiple,ref:a},e.placeholder?React.createElement("option",{value:""},e.placeholder):React.createElement(React.Fragment,null),t)}function P(e){return e.isEditing?React.createElement(O,{ajaxUrl:e.ajaxUrl,nonce:e.nonce,multiple:e.multiple,ajaxAction:"publishpress_calendar_search_authors",ajaxArgs:e.ajaxArgs,value:e.value,metadata:e.metadata,post_types:e.post_types,className:e.metadata?"pp-calendar-form-metafied-input":"",name:e.name,id:e.id,onSelect:e.onSelect,onClear:e.onClear}):React.createElement("span",{id:e.id},e.value.join(", "))}function D(e){return e.isEditing?React.createElement("input",{type:"text",value:e.value}):React.createElement("span",null,e.value)}function T(e){return e.isEditing?React.createElement(O,{ajaxUrl:e.ajaxUrl,nonce:e.nonce,multiple:e.multiple,ajaxAction:e.ajaxAction,ajaxArgs:e.ajaxArgs,options:e.options,value:e.value,name:e.name,id:e.id,onSelect:e.onSelect,onClear:e.onClear}):React.createElement("span",{id:e.id},e.value)}function A(e){return e.isEditing?React.createElement(O,{options:e.options,id:e.id,value:e.value,allowClear:e.allowClear,onSelect:e.onSelect,onClear:e.onClear}):React.createElement("span",{id:e.id},e.value)}function I(e){return e.isEditing?React.createElement(O,{placeholder:e.placeholder,id:e.id,ajaxUrl:e.ajaxUrl,nonce:e.nonce,ajaxAction:"publishpress_calendar_search_terms",ajaxArgs:{taxonomy:e.taxonomy},options:e.options,value:e.value,multiple:e.multiple,onSelect:e.onSelect,onClear:e.onClear,className:e.className}):void 0===e.value||0===e.value.length?React.createElement("span",{id:e.id,className:"publishpress-calendar-empty-value"},publishpressCalendarParams.strings.noTerms):React.createElement("span",{id:e.id},e.value.join(", "))}function N(e){return e.isEditing?React.createElement("input",{type:"checkbox",id:e.id,value:"1",checked:"Yes"===e.value}):"Yes"===e.value?React.createElement("span",{id:e.id,className:"dashicons dashicons-yes-alt"}):React.createElement("span",{id:e.id,className:"dashicons dashicons-no-alt"})}function F(e){return e.isEditing?React.createElement("input",{type:"location",id:e.id,value:e.value,onChange:function(t){e.onChange&&e.onChange(t,t.target.value)}}):React.createElement("span",{id:e.id},e.value)}function L(e){var t=e.metadata?"pp-calendar-form-metafied-input pp-calendar-form-metafied "+e.post_types:"";return e.isEditing?React.createElement("div",{className:t},React.createElement("textarea",{id:e.id,metadata:e.metadata,post_types:e.post_types,name:e.name,className:t,onChange:function(t){e.onChange&&e.onChange(t,t.target.value)}},e.value)):React.createElement("div",{id:e.id},e.value)}function M(e){return e.isEditing?React.createElement("input",{type:"text",id:e.id,value:e.value,onChange:function(t){e.onChange&&e.onChange(t,t.target.value)}}):React.createElement("span",{id:e.id},e.value)}function Q(e){return e.isEditing?React.createElement("input",{type:"text",id:e.id,value:e.value}):React.createElement("span",{id:e.id},e.value)}function U(e){var t;return e.isEditing?React.createElement("input",{type:"number",value:e.value,id:e.id,onChange:function(t){e.onChange&&e.onChange(t,t.target.value)}}):(t=0===e.value?"publishpress-calendar-empty-value":"",React.createElement("span",{id:e.id,className:t},e.value))}function G(e){return React.useEffect((function(){var t="#"+e.id,a=jQuery(t);a.length&&(a.attr("placeholder",e.placeholder||"HH:MM"),a.on("input",(function(e){var t=e.target.value.replace(/\D/g,"");if(1===t.length&&parseInt(t[0],10)>2)a.val("");else{t.length>=3&&(t=t.slice(0,2)+":"+t.slice(2,4)),a.val(t.slice(0,5));var n=t.split(":");if(n[0]){var r=n[0];if(2===r.length&&"2"===r[0]&&parseInt(r[1],10)>3)return void a.val(r[0])}if(n[1]){var l=n[1];if(1===l.length&&parseInt(l[0],10)>5)return void a.val(n[0]+":");2===l.length&&parseInt(l,10)>59&&a.val(n[0]+":"+l[0])}}})),a.on("change",(function(t){var n=a.val();/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(n)||(alert("Invalid time format. Please enter a time between 00:00 and 23:59."),a.val("")),e.onChange&&e.onChange(t,n)})))})),e.isEditing?React.createElement("input",{type:"text",id:e.id,placeholder:e.placeholder||null,value:e.value}):React.createElement("span",{id:e.id},e.value)}var H=jQuery;function q(e){if(!e.data)return React.createElement(React.Fragment,null);if(!e.target.current)return React.createElement(React.Fragment,null);var t=H(e.target.current).position(),a=H(e.target.current).offset(),n=H(e.target.current).width(),r=t.top,l=a.left+380+10+180>=H(document).width()?t.left-25-380:t.left+n+10,s=function(t,a){t.preventDefault(),y(a.action,a.args,e.ajaxUrl).then((function(t){e.onItemActionClickCallback(a.action,e.id,t)}))};return React.createElement("div",{className:"publishpress-calendar-popup",style:{top:r,left:l}},React.createElement("div",{className:"publishpress-calendar-popup-title",style:{backgroundColor:e.color}},e.icon&&React.createElement("span",{className:"dashicons "+e.icon+" publishpress-calendar-icon"}),React.createElement("span",{dangerouslySetInnerHTML:{__html:e.title}}),React.createElement("span",{className:"dashicons dashicons-no publishpress-calendar-popup-close",title:e.strings.close,onClick:function(){H(document).trigger("publishpress_calendar:close_popup")}})),React.createElement("table",null,React.createElement("tbody",null,function(){var t,a,n=[];for(var r in e.data.fields)if(e.data.fields.hasOwnProperty(r)){switch((t=e.data.fields[r]).type){case"date":a=React.createElement(j,{value:t.value,valueString:t.valueString||null,isEditing:!1});break;case"time":a=React.createElement(G,{value:t.value,isEditing:!1});break;case"authors":a=React.createElement(P,{value:t.value,isEditing:!1});break;case"select":a=React.createElement(T,{value:t.value,isEditing:!1});break;case"type":a=React.createElement(D,{value:t.value,isEditing:!1});break;case"status":a=React.createElement(A,{value:t.value,isEditing:!1});break;case"taxonomy":a=React.createElement(I,{value:t.value,isEditing:!1});break;case"checkbox":a=React.createElement(N,{value:t.value,isEditing:!1});break;case"location":a=React.createElement(F,{value:t.value,isEditing:!1});break;case"paragraph":a=React.createElement(L,{value:t.value,isEditing:!1});break;case"text":a=React.createElement(M,{value:t.value,isEditing:!1});break;case"user":a=React.createElement(Q,{value:t.value,isEditing:!1});break;case"number":a=React.createElement(U,{value:t.value,isEditing:!1});break;default:a=null}n.push(React.createElement("tr",{key:"field-rows-popup-".concat(n.length)},React.createElement("th",null,t.label,":"),React.createElement("td",null,a)))}return n}())),React.createElement("hr",null),React.createElement("div",{className:"publishpress-calendar-popup-links"},function(){var t,a=[];for(var n in e.data.links)e.data.links.hasOwnProperty(n)&&((t=e.data.links[n]).url?a.push(React.createElement("a",{key:"links-popup-".concat(a.length),href:t.url},t.label)):t.action&&a.push(React.createElement("a",{key:"links-popup-".concat(a.length),onClick:function(e){return s(e,t)}},t.label)),a.push(React.createElement("span",{key:"links-popup-".concat(a.length)},"|")));return a.pop(),a}()))}var Y=jQuery;function V(e){var t,a,n=e.strings.untitled,r=React.useRef(null),l=e.showIcon&&e.icon?React.createElement("span",{className:"dashicons "+e.icon}," "):null,s=e.showTime?React.createElement("time",{className:"publishpress-calendar-item-time",dateTime:e.timestamp,title:e.timestamp},function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"ga",a=e.getHours();return"ga"===t||"ha"===t?0===a?a="12am":a<12?("ha"===t&&(a=a.toString().padStart(2,"0")),a+="am"):(a>12&&(a-=12),"ha"===t&&(a=a.toString().padStart(2,"0")),a+="pm"):a=a.toString().padStart(2,"0"),a}(k(e.timestamp),e.timeFormat||"g:i a")):null,i=e.label||n;return React.createElement("li",{ref:r,className:(t=e.id,a="publishpress-calendar-item post-"+t,e.isPopupOpened&&(a+=" publishpress-calendar-item-opened-popup"),e.canMove&&(a+=" publishpress-calendar-item-movable"),a),style:{backgroundColor:e.color},"data-index":e.index,"data-id":e.id,"data-datetime":e.timestamp,onClick:function(t){var a;(a=t.target,Y(a).hasClass("publishpress-calendar-popup")||Y(a).parents(".publishpress-calendar-popup").length>0)||e.onClickItemCallback(e.id)}},l,s,React.createElement("span",{className:"publishpress-calendar-item-title",dangerouslySetInnerHTML:{__html:i}}),e.isPopupOpened&&React.createElement(q,{target:r,id:e.id,title:i,icon:e.icon,timestamp:e.timestamp,color:e.color,data:e.isPopupOpened?e.getPopupItemDataCallback():null,onItemActionClickCallback:e.onItemActionClickCallback,ajaxUrl:e.ajaxUrl,strings:e.strings}))}function W(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var n,r,l,s,i=[],o=!0,c=!1;try{if(l=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;o=!1}else for(;!(o=(n=l.call(a)).done)&&(i.push(n.value),i.length!==t);o=!0);}catch(e){c=!0,r=e}finally{try{if(!o&&null!=a.return&&(s=a.return(),Object(s)!==s))return}finally{if(c)throw r}}return i}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return B(e,t);var a=Object.prototype.toString.call(e).slice(8,-1);"Object"===a&&e.constructor&&(a=e.constructor.name);if("Map"===a||"Set"===a)return Array.from(e);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return B(e,t)}(e,t)||function(){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 B(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,n=new Array(t);a=0?"business-day":"weekend-day",r.getFullYear()===n.getFullYear()&&r.getMonth()===n.getMonth()&&r.getDate()===n.getDate()&&(l+=" publishpress-calendar-today"),e.isLoading&&(l+=" publishpress-calendar-loading"),i&&(l+=" publishpress-calendar-uncollapse"),1===n.getDate()&&(l+=" publishpress-calendar-first-day-of-month"),e.isHovering&&(l+=" publishpress-calendar-hovering"),"publishpress-calendar-"+l),"data-year":e.date.getFullYear(),"data-month":e.date.getMonth()+1,"data-day":e.date.getDate()},React.createElement("div",null,React.createElement("div",{className:"publishpress-calendar-cell-header"},e.shouldDisplayMonthName&&React.createElement("span",{className:"publishpress-calendar-month-name"},(t=e.date.getMonth(),[(a=publishpressCalendarParams.strings).monthJan,a.monthFeb,a.monthMar,a.monthApr,a.monthMay,a.monthJun,a.monthJul,a.monthAug,a.monthSep,a.monthOct,a.monthNov,a.monthDec][t])),React.createElement("span",{className:"publishpress-calendar-date"},e.date.getDate()),e.isHovering&&React.createElement("span",{className:"publishpress-calendar-cell-click-to-add"},e.strings.clickToAdd)),React.createElement("ul",{className:"publishpress-calendar-day-items"},p.map((function(t){var a=t.id===e.openedItemId;return React.createElement(V,{key:"item-"+t.id+"-"+e.date.getTime(),icon:t.icon,color:t.color,label:t.label,id:t.id,timestamp:t.timestamp,timeFormat:e.timeFormat,showTime:t.showTime,showIcon:!0,index:c++,canMove:t.canEdit,isPopupOpened:a,getPopupItemDataCallback:e.getOpenedItemDataCallback,onClickItemCallback:e.onClickItemCallback,onItemActionClickCallback:e.onItemActionClickCallback,ajaxUrl:e.ajaxUrl,strings:e.strings})}))),function(){if(-1===e.maxVisibleItems)return React.createElement(React.Fragment,null);if(e.items.length>e.maxVisibleItems){var t=e.items.length-e.maxVisibleItems,a=e.strings.hideItems,n=e.strings.showMore,r=i?a.replace("%s",t):n.replace("%s",t),l=i?"publishpress-calendar-hide-items":"publishpress-calendar-show-more",s=i?"hidden":"visibility";return React.createElement("a",{className:l,onClick:u},React.createElement("span",{className:"dashicons dashicons-"+s})," ",r)}return React.createElement(React.Fragment,null)}()))}wp.i18n._n;var z=jQuery;function J(e){return e.isEditing?(z(".pp_editorial_single_select2").length>0&&z(".pp_editorial_single_select2").pp_select2({allowClear:!0,placeholder:function(){z(this).data("placeholder")}}),z(".pp_editorial_meta_multi_select2").length>0&&z(".pp_editorial_meta_multi_select2").pp_select2({multiple:!0}),z(".date-time-pick").each((function(){var e=z(this),t=function(e,t){var a=z.extend({},{},t),n=e.attr("data-alt-field");return n&&void 0!==n&&0!=n.length?z.extend({},a,{altField:'input[name="'+n+'"]',altFormat:e.attr("data-alt-format")}):a}(e,{alwaysSetTime:!1,controlType:"select",altFieldTimeOnly:!1});e.datetimepicker(t)})),React.createElement("div",{dangerouslySetInnerHTML:{__html:e.html}})):React.createElement("span",{id:e.id},e.value)}function K(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var n,r,l,s,i=[],o=!0,c=!1;try{if(l=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;o=!1}else for(;!(o=(n=l.call(a)).done)&&(i.push(n.value),i.length!==t);o=!0);}catch(e){c=!0,r=e}finally{try{if(!o&&null!=a.return&&(s=a.return(),Object(s)!==s))return}finally{if(c)throw r}}return i}}(e,t)||X(e,t)||function(){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 X(e,t){if(e){if("string"==typeof e)return Z(e,t);var a=Object.prototype.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?Z(e,t):void 0}}function Z(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,n=new Array(t);a0&&(n=a[0].id),x(i,n)},onClear:function(e,t){x(i,null)}});break;case"taxonomy":a=React.createElement(I,{value:t.value,isEditing:!0,id:n,taxonomy:t.taxonomy,nonce:e.nonce,ajaxUrl:e.ajaxUrl,multiple:!0,onSelect:function(e,t,a){for(var n=[],r=0;r1&&React.createElement("tr",null,React.createElement("th",null,React.createElement("label",null,e.strings.postType)),React.createElement("td",null,React.createElement(O,{options:e.postTypes,allowClear:!1,onSelect:function(e){var t=ee(e.target).pp_select2("data")[0].id;n(t),x("post_type",t)}}))),1===e.postTypes.length&&React.createElement("tr",null,React.createElement("th",null,React.createElement("label",null,e.strings.postType)),React.createElement("td",null,function(t){var a,n=function(e,t){var a="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!a){if(Array.isArray(e)||(a=X(e))||t&&e&&"number"==typeof e.length){a&&(e=a);var n=0,r=function(){};return{s:r,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,s=!0,i=!1;return{s:function(){a=a.call(e)},n:function(){var e=a.next();return s=e.done,e},e:function(e){i=!0,l=e},f:function(){try{s||null==a.return||a.return()}finally{if(i)throw l}}}}(e.postTypes);try{for(n.s();!(a=n.n()).done;){var r=a.value;if(r.value===t)return r.text}}catch(e){n.e(e)}finally{n.f()}return e.strings.postTypeNotFound}(a))),H.length>0&&H)),0===H.length&&React.createElement("div",{className:"publishpress-calendar-popup-loading-fields"},e.strings.pleaseWaitLoadingFormFields),f&&React.createElement("div",{className:"publishpress-calendar-popup-error-message"},React.createElement("span",{className:"dashicons dashicons-warning"}),f),React.createElement("hr",{className:"publishpress-calendar-popup-links-hr"}),React.createElement("div",{className:"publishpress-calendar-popup-links"},function(){var t,a=[{id:"create",label:e.strings.save,labelLoading:e.strings.saving,action:"publishpress_calendar_create_item"},{id:"edit",label:e.strings.saveAndEdit,labelLoading:e.strings.saving,action:"publishpress_calendar_create_item"}],n=[];for(var r in a)a.hasOwnProperty(r)&&(t=a[r],p===t.id?n.push(React.createElement("span",{key:t.id},t.labelLoading)):n.push(b(t,S)),n.push(React.createElement("span",{key:"link-separator-".concat(n.length)},"|")));return n.pop(),n}(),o&&React.createElement("span",{className:"dashicons dashicons-update-alt publishpress-spinner"}))))}function ae(e){return(ae="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 ne(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function re(e){for(var t=1;te.length)&&(t=e.length);for(var a=0,n=new Array(t);a tr > td").off("mouseenter")},ye=function(){oe(".publishpress-calendar-day-hover").removeClass("publishpress-calendar-day-hover"),oe(".publishpress-calendar-loading").removeClass("publishpress-calendar-loading")},Ee=function(e){c(new Date(o.getTime()+7*e*24*60*60*1e3))},we=function(e){e.preventDefault(),J((function(e){return e+1}))},ke=function(t,a){var n=oe(t.target),r=oe(a.draggable[0]),l=g(k(r.data("datetime")));oe(t.target).addClass("publishpress-calendar-loading"),function(t,a,n,r,l){if(f[t]){var s=f[t][a];E(!0),D(e.strings.movingTheItem);var i=pe(e.actionMoveItem),o=new FormData;o.append("id",s.id),o.append("year",n),o.append("month",r),o.append("day",l),fetch(i,{method:"POST",body:o}).then((function(e){return e.json()})).then((function(){J(z+1)}))}}(l,r.data("index"),n.data("year"),n.data("month"),n.data("day"))},_e=function(e,t){ye(),oe(e.target).addClass("publishpress-calendar-day-hover")},Ce=function(e){var t=oe(e);return t.is("td.publishpress-calendar-business-day, td.publishpress-calendar-weekend-day")?t:t.is(".publishpress-calendar-cell-header, .publishpress-calendar-date, .publishpress-calendar-cell-click-to-add, .publishpress-calendar-month-name")?t.parents("td"):null},Re=function(e){var t=k(e.data("year")+"-"+e.data("month")+"-"+e.data("day"));return t.getHours()>0&&t.setTime(t.getTime()+6e4*t.getTimezoneOffset()),t},xe=function(){var e;oe(".publishpress-calendar tbody > tr > td").on("mouseover",(function(t){t.preventDefault(),t.stopPropagation();var a=Ce(t.target);if(a){if(function(e){return oe(e).hasClass("publishpress-calendar-day-hover")}(a))return;Z(Re(a)),e=Re(a)}})).on("mouseout",(function(t){t.stopPropagation(),t.preventDefault(),Ce(t.relatedTarget)||(Z(null),e=null)})).on("click",(function(t){Ce(t.target)&&(U(null),ne(e))}))},je=function(t,a){ue((function(e){return re(re({},e),{},le({},t,a))})),"weeks"===t&&((0===(a=parseInt(a))||isNaN(a))&&(a=e.numberOfWeeksToDisplay),I(a),d(a))},Se=function(){U(null),q(null),ne(null)},Oe=function(e){q(null),Z(null),ne(null),U(e),publishpressCalendarParams.proActive&&R(e)},Pe=function(e,t,a){W(V+1)},De=function(e){"Escape"===e.key&&Se()},Te=function(){return H},Ae=function(){U(null)};React.useEffect((function(){return document.addEventListener("keydown",De),oe(document).on("publishpress_calendar:close_popup",Ae),oe(document).on("change","#pp-content-filters select:not(.non-trigger-select)",de),oe(document).on("click",".metadata-item-filter .filter-apply input[type=submit]",ge),oe(document).on("click",".pp-content-calendar-manage .search-bar input[type=submit]",ve),oe(document).on("click",".pp-content-calendar-manage .me-mode-action",fe),oe(document).on("click",".pp-content-calendar-manage .pp-show-revision-btn",he),oe(document).on("click",".pp-popup-modal-header .modal-nav-prev, .pp-popup-modal-header .modal-nav-next",me),oe(document).on("input",".pp-content-calendar-general-modal-container .modal-post-title .title-area",x),oe(document).on("click",".pp-content-calendar-general-modal-container .modal-content-right .save-post-changes:not(.disabled)",(function(e){C(e,jQuery(this),we)})),e.userCanAddPosts&&xe(),be}),[]),React.useEffect((function(){oe(".publishpress-calendar-day-items li").draggable({zIndex:99999,helper:"clone",containment:".publishpress-calendar table",start:function(e,t){return oe(e.target).data("id")!==Q&&(!!oe(e.target).hasClass("publishpress-calendar-item-movable")&&(oe(e.target).addClass("ui-draggable-target"),Se(),void S(!0)))},stop:function(e,t){oe(".ui-draggable-target").removeClass("ui-draggable-target"),S(!1)}}),oe(".publishpress-calendar tbody > tr > td").droppable({drop:ke,over:_e})})),e.userCanAddPosts&&React.useEffect(xe,[o,p,A,F,ce,z]),React.useEffect((function(){E(!0),D(e.strings.loading);var t=pe(e.actionGetData,"");ce&&Object.keys(ce).length>0&&(ce.hasOwnProperty("start_date")&&delete ce.start_date,ce.hasOwnProperty("number_of_weeks")&&delete ce.number_of_weeks,t+="&"+new URLSearchParams(ce).toString());t+="&start_date="+g(v(o,e.weekStartsOnSunday))+"&number_of_weeks="+p,t+=F?"&s="+F:"&s=",fetch(t).then((function(e){return e.json()})).then((function(e){publishpressCalendarParams.PostData=_(publishpressCalendarParams.PostData,e),h(e),E(!1),D(null),ye(),jQuery(".pp-title-tooltip").each((function(){var e=jQuery(this),t=e.attr("title");if(t&&""!==t){e.removeAttr("title");var a=jQuery('').text(t);jQuery("body").append(a),e.hover((function(){a.show();var t=e.offset().top-a.outerHeight()-10,n=e.offset().left+e.outerWidth()/2-a.outerWidth()/2;a.css({top:t+"px",left:n+"px",position:"absolute"})}),(function(){a.hide()}))}}))}))}),[o,p,A,F,ce,z]),React.useEffect((function(){if(Q)if(publishpressCalendarParams.proActive)R(Q);else{E(!0),D(e.strings.loadingItem);var t=e.ajaxUrl+"?action=publishpress_calendar_get_post_data&nonce="+e.nonce+"&id="+Q;fetch(t).then((function(e){return e.json()})).then((function(e){E(!1),D(null),q(e)}))}}),[Q,V]);var Ie=["publishpress-calendar","publishpress-calendar-theme-"+t];return e.userCanAddPosts&&Ie.push("user-can-add-posts"),React.createElement("div",{className:Ie.join(" ")},React.createElement(r,{refreshOnClickCallback:we,backPageOnClickCallback:function(e){e.preventDefault(),Ee(-1*p)},backOnClickCallback:function(e){e.preventDefault(),Ee(-1)},forwardOnClickCallback:function(e){e.preventDefault(),Ee(1)},forwardPageOnClickCallback:function(e){e.preventDefault(),Ee(p)},todayOnClickCallback:function(t){t.preventDefault(),c(v(e.todayDate,e.weekStartsOnSunday))},strings:e.strings}),React.createElement("table",null,React.createElement("thead",null,React.createElement("tr",null,React.createElement(l,{weekStartsOnSunday:e.weekStartsOnSunday,strings:e.strings}))),React.createElement("tbody",null,function(){for(var t,a,n=7*p,r=v(o,e.weekStartsOnSunday),l=[],s=[],i=0,c=r.getMonth(),u=0;u=0;--l){var s=this.tryEntries[l],i=s.completion;if("root"===s.tryLoc)return r("end");if(s.tryLoc<=this.prev){var o=n.call(s,"catchLoc"),c=n.call(s,"finallyLoc");if(o&&c){if(this.prev=0;--a){var r=this.tryEntries[a];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--t){var a=this.tryEntries[t];if(a.finallyLoc===e)return this.complete(a.completion,a.afterLoc),P(a),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var a=this.tryEntries[t];if(a.tryLoc===e){var n=a.completion;if("throw"===n.type){var r=n.arg;P(a)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,a,n){return this.delegate={iterator:T(t),resultName:a,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function c(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function u(e){for(var t=1;t2&&void 0!==arguments[2])||arguments[2],n=new Date(t,0,1+7*(e-1)),r=n.getDay(),l=n;return r<=4?l.setDate(n.getDate()-n.getDay()+1):l.setDate(n.getDate()+8-n.getDay()),a&&l.setDate(l.getDate()-1),l}function h(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],a=new Date(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),n=a.getDay();a.setDate(a.getDate()+4-(a.getDay()||7));var r=new Date(a.getFullYear(),0,1),l=Math.round(((a-r)/864e5+1)/7);return t&&0===n&&l++,[a.getFullYear(),l]}function v(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],a=h(e,t);return f(a[1],a[0],t)}function g(e){return e.getFullYear()+"-"+(e.getMonth()+1).toString().padStart(2,"0")+"-"+e.getDate().toString().padStart(2,"0")}function b(e,t){var a=e.className?e.className:"";return e.url?React.createElement("a",{key:"link-".concat(e.url,"-").concat(e.label),href:e.url,className:a},e.label):e.action?React.createElement("a",{key:"link-".concat(e.url,"-").concat(e.label),className:a,onClick:function(a){return t(a,e)}},e.label):void 0}function y(e,t,a){return E.apply(this,arguments)}function E(){return(E=m(o().mark((function e(t,a,n){var r,l,s;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=n+"?action="+t,e.t0=o().keys(a);case 2:if((e.t1=e.t0()).done){e.next=9;break}if(l=e.t1.value,a.hasOwnProperty(l)){e.next=6;break}return e.abrupt("continue",2);case 6:r+="&"+l+"="+a[l],e.next=2;break;case 9:return e.next=11,fetch(r);case 11:return s=e.sent,e.next=14,s.json();case 14:return e.abrupt("return",e.sent);case 15:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function w(){return(w=m(o().mark((function e(t,a,n,r){var l,s,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:l=n+"?action="+t,e.t0=o().keys(a);case 2:if((e.t1=e.t0()).done){e.next=9;break}if(s=e.t1.value,a.hasOwnProperty(s)){e.next=6;break}return e.abrupt("continue",2);case 6:l+="&"+s+"="+a[s],e.next=2;break;case 9:return e.next=11,fetch(l,{method:"post",body:r});case 11:return i=e.sent,e.next=14,i.json();case 14:return e.abrupt("return",e.sent);case 15:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function k(e){return new Date(String(e).replace(/-/g,"/"))}function _(e,t){for(var a in t)t.hasOwnProperty(a)&&t[a].forEach((function(t){if(t.calendar_post_data&&Object.keys(t.calendar_post_data).length>0){var a=e.findIndex((function(e){return e.post_id===t.calendar_post_data.post_id})),n=u(u({},t.calendar_post_data),{},{taxonomies:u({},t.calendar_taxonomies_data)});a>-1?e[a]=n:e.push(n)}}));return e}function C(e,t,a){e.preventDefault();var n=t.closest(".modal-content-right");t.addClass("disabled");var r=t.attr("data-post_id"),l=n.find(".title-area").val(),s=n.find(".content_board_post_date_hidden").val(),i=n.find(".pp-modal-form-author").val(),o=n.find(".pp-modal-form-post-status").val(),c={};n.find(".pp-modal-form-post-taxonomy").each((function(){var e=jQuery(this);c[e.attr("data-taxonomy")]=e.val()}));var u={action:"publishpress_content_calendar_update_post",post_id:r,post_title:l,post_date:s,post_author:i,post_status:o,post_taxonomies:c,nonce:publishpressCalendarParams.nonce};jQuery.post(ajaxurl,u,(function(n){if("success"==n.status){var s=publishpressCalendarParams.PostData,i=jQuery(".publishpress-calendar .publishpress-calendar-item.post-"+r),c=s.findIndex((function(e){return Number(e.post_id)===Number(r)})),u=s[c],p=u.taxonomies;u.post_title=l,u.raw_title=l,u.post_status=o,u.author_markup=n.author_markup,u.date_markup=n.date_markup;var d=n.taxonomy_terms;for(var m in d)if(d.hasOwnProperty(m)){var f=d[m];p[m].terms=f}u.taxonomies=p,publishpressCalendarParams.PostData[c]=u,i.find(".publishpress-calendar-item-title").html(u.post_title),"function"==typeof a&&a(e)}t.removeClass("disabled"),function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"success",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";setTimeout((function(){var a="pp-floating-msg-"+Math.round((new Date).getTime()+100*Math.random()),n=jQuery(".pp-floating-status").length;jQuery("#wpbody-content").after(''+t+""),jQuery("."+a).css("bottom",45*n).fadeIn(1e3).delay(1e4).fadeOut(1e3,(function(){jQuery(this).remove()}))}),500)}(n.status,n.content)}))}function R(e){var t=publishpressCalendarParams.PostData,a=t.findIndex((function(t){return Number(t.post_id)===Number(e)}));if(-1===a)return console.error("Post with id "+e+" not found"),void console.log(t);var n=t[a],r=n.post_status,l=t[a-1]||t[t.length-1],s=t[a+1]||t[0],i=n.status_label,o=n.action_links,c=n.taxonomies||null,u=Number(n.can_edit_post)>0,p='";var d='",jQuery("#pp-content-calendar-general-modal-container").html(d);var v=Math.round(.78*window.innerHeight);tb_show(p,"#TB_inline?width=600&height="+v+"&inlineId=pp-content-calendar-general-modal");var g=jQuery("body.pp-content-calendar-page #TB_window").css("height");if(g){var b=parseInt(g,10)-55;jQuery(".pp-content-calendar-general-modal-container .modal-content-right .scrollable-content").css("height",b-60+"px"),jQuery(".pp-content-calendar-general-modal-container .modal-content-left").css("height",b+"px"),jQuery("body.pp-content-calendar-page #TB_ajaxContent").css("height",b+"px");var y=jQuery(".pp-content-calendar-general-modal-container .modal-post-title .title-area");y.length>0&&x(!1,y)}jQuery(".pp-content-calendar-general-modal-container .modal-content-right .date-time-pick").each((function(){var e=jQuery(this),t=function(e,t){var a={dateFormat:publishpressCalendarParams.strings.date_format,firstDay:publishpressCalendarParams.strings.week_first_day},n=jQuery.extend({},a,t),r=e.attr("data-alt-field");return r&&void 0!==r&&0!=r.length?jQuery.extend({},n,{altField:'input[name="'+r+'"]',altFormat:e.attr("data-alt-format")}):n}(e,{alwaysSetTime:!1,controlType:"select",altFieldTimeOnly:!1});e.hasClass("future-date")&&(t.minDate=new Date),e.datetimepicker(t)})),jQuery(".pp-modal-form-author").pp_select2({allowClear:!1,ajax:{url:ajaxurl,dataType:"json",delay:0,data:function(e){return{action:"publishpress_calendar_search_authors",nonce:publishpressCalendarParams.nonce,q:e.term}},processResults:function(e){return{results:e}},cache:!1}}),jQuery(".pp-modal-form-post-taxonomy").pp_select2({allowClear:!0,ajax:{url:ajaxurl,dataType:"json",delay:0,data:function(e){return{action:"publishpress_calendar_search_terms",taxonomy:jQuery(this).attr("data-taxonomy"),nonce:publishpressCalendarParams.nonce,q:e.term}},processResults:function(e){return{results:e}},cache:!1}}),jQuery(".pp-modal-form-post-status").pp_select2({allowClear:!1})}function x(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return function(e){if(!e)e=jQuery(".pp-content-calendar-general-modal-container .modal-post-title .title-area");e.css("height","auto"),e.css("height",e[0].scrollHeight+"px")}(t)}function j(e){return e.isEditing?React.createElement("input",{type:"text",id:e.id,value:e.value,onChange:function(t){e.onChange&&e.onChange(t,t.target.value)}}):React.createElement("time",{dateTime:e.value,title:e.value,id:e.id},e.valueString||e.value)}a.r(t);var S=jQuery;function O(e){var t,a=React.useRef(null);React.useEffect((function(){var t={placeholder:e.placeholder||!1,tags:!0,allowClear:void 0===e.allowClear||null===e.allowClear||e.allowClear};return e.ajaxUrl&&e.ajaxAction&&(t.ajax={delay:250,url:e.ajaxUrl,dataType:"json",data:function(t){var a={q:t.term,action:e.ajaxAction,nonce:e.nonce};if(e.ajaxArgs)for(var n in e.ajaxArgs)e.ajaxArgs.hasOwnProperty(n)&&(a[n]=e.ajaxArgs[n]);return a},processResults:function(e){return{results:e}}}),S(a.current).pp_select2(t).on("select2:select",(function(t){"function"==typeof e.onSelect&&e.onSelect(t,a.current,S(a.current).pp_select2("data"))})).on("select2:clear",(function(t){"function"==typeof e.onClear&&e.onClear(t,a.current)})),function(){S(a.current).pp_select2("destroy")}}),[]),e.options&&(t=e.options.map((function(e){return React.createElement("option",{key:"select-option-".concat(e.value),value:e.value},e.text)})));var n="pp_select2";return e.className&&(n+=" "+e.className),n+=e.metadata?"pp-calendar-form-metafied "+e.post_types:"",React.createElement("select",{className:n,defaultValue:e.value,type:"select",name:e.name,id:e.id,multiple:e.multiple,ref:a},e.placeholder?React.createElement("option",{value:""},e.placeholder):React.createElement(React.Fragment,null),t)}function P(e){return e.isEditing?React.createElement(O,{ajaxUrl:e.ajaxUrl,nonce:e.nonce,multiple:e.multiple,ajaxAction:"publishpress_calendar_search_authors",ajaxArgs:e.ajaxArgs,value:e.value,metadata:e.metadata,post_types:e.post_types,className:e.metadata?"pp-calendar-form-metafied-input":"",name:e.name,id:e.id,onSelect:e.onSelect,onClear:e.onClear}):React.createElement("span",{id:e.id},e.value.join(", "))}function D(e){return e.isEditing?React.createElement("input",{type:"text",value:e.value}):React.createElement("span",null,e.value)}function T(e){return e.isEditing?React.createElement(O,{ajaxUrl:e.ajaxUrl,nonce:e.nonce,multiple:e.multiple,ajaxAction:e.ajaxAction,ajaxArgs:e.ajaxArgs,options:e.options,value:e.value,name:e.name,id:e.id,onSelect:e.onSelect,onClear:e.onClear}):React.createElement("span",{id:e.id},e.value)}function A(e){return e.isEditing?React.createElement(O,{options:e.options,id:e.id,value:e.value,allowClear:e.allowClear,onSelect:e.onSelect,onClear:e.onClear}):React.createElement("span",{id:e.id},e.value)}function N(e){return e.isEditing?React.createElement(O,{placeholder:e.placeholder,id:e.id,ajaxUrl:e.ajaxUrl,nonce:e.nonce,ajaxAction:"publishpress_calendar_search_terms",ajaxArgs:{taxonomy:e.taxonomy},options:e.options,value:e.value,multiple:e.multiple,onSelect:e.onSelect,onClear:e.onClear,className:e.className}):void 0===e.value||0===e.value.length?React.createElement("span",{id:e.id,className:"publishpress-calendar-empty-value"},publishpressCalendarParams.strings.noTerms):React.createElement("span",{id:e.id},e.value.join(", "))}function I(e){return e.isEditing?React.createElement("input",{type:"checkbox",id:e.id,value:"1",checked:"Yes"===e.value}):"Yes"===e.value?React.createElement("span",{id:e.id,className:"dashicons dashicons-yes-alt"}):React.createElement("span",{id:e.id,className:"dashicons dashicons-no-alt"})}function F(e){return e.isEditing?React.createElement("input",{type:"location",id:e.id,value:e.value,onChange:function(t){e.onChange&&e.onChange(t,t.target.value)}}):React.createElement("span",{id:e.id},e.value)}function L(e){var t=e.metadata?"pp-calendar-form-metafied-input pp-calendar-form-metafied "+e.post_types:"";return e.isEditing?React.createElement("div",{className:t},React.createElement("textarea",{id:e.id,metadata:e.metadata,post_types:e.post_types,name:e.name,className:t,onChange:function(t){e.onChange&&e.onChange(t,t.target.value)}},e.value)):React.createElement("div",{id:e.id},e.value)}function M(e){return e.isEditing?React.createElement("input",{type:"text",id:e.id,value:e.value,onChange:function(t){e.onChange&&e.onChange(t,t.target.value)}}):React.createElement("span",{id:e.id},e.value)}function Q(e){return e.isEditing?React.createElement("input",{type:"text",id:e.id,value:e.value}):React.createElement("span",{id:e.id},e.value)}function U(e){var t;return e.isEditing?React.createElement("input",{type:"number",value:e.value,id:e.id,onChange:function(t){e.onChange&&e.onChange(t,t.target.value)}}):(t=0===e.value?"publishpress-calendar-empty-value":"",React.createElement("span",{id:e.id,className:t},e.value))}function G(e){return React.useEffect((function(){var t="#"+e.id,a=jQuery(t);a.length&&(a.attr("placeholder",e.placeholder||"HH:MM"),a.on("input",(function(e){var t=e.target.value.replace(/\D/g,"");if(1===t.length&&parseInt(t[0],10)>2)a.val("");else{t.length>=3&&(t=t.slice(0,2)+":"+t.slice(2,4)),a.val(t.slice(0,5));var n=t.split(":");if(n[0]){var r=n[0];if(2===r.length&&"2"===r[0]&&parseInt(r[1],10)>3)return void a.val(r[0])}if(n[1]){var l=n[1];if(1===l.length&&parseInt(l[0],10)>5)return void a.val(n[0]+":");2===l.length&&parseInt(l,10)>59&&a.val(n[0]+":"+l[0])}}})),a.on("change",(function(t){var n=a.val();/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(n)||(alert("Invalid time format. Please enter a time between 00:00 and 23:59."),a.val("")),e.onChange&&e.onChange(t,n)})))})),e.isEditing?React.createElement("input",{type:"text",id:e.id,placeholder:e.placeholder||null,value:e.value}):React.createElement("span",{id:e.id},e.value)}var H=jQuery;function q(e){if(!e.data)return React.createElement(React.Fragment,null);if(!e.target.current)return React.createElement(React.Fragment,null);var t=H(e.target.current).position(),a=H(e.target.current).offset(),n=H(e.target.current).width(),r=t.top,l=a.left+380+10+180>=H(document).width()?t.left-25-380:t.left+n+10,s=function(t,a){t.preventDefault(),y(a.action,a.args,e.ajaxUrl).then((function(t){e.onItemActionClickCallback(a.action,e.id,t)}))};return React.createElement("div",{className:"publishpress-calendar-popup",style:{top:r,left:l}},React.createElement("div",{className:"publishpress-calendar-popup-title",style:{backgroundColor:e.color}},e.icon&&React.createElement("span",{className:"dashicons "+e.icon+" publishpress-calendar-icon"}),React.createElement("span",{dangerouslySetInnerHTML:{__html:e.title}}),React.createElement("span",{className:"dashicons dashicons-no publishpress-calendar-popup-close",title:e.strings.close,onClick:function(){H(document).trigger("publishpress_calendar:close_popup")}})),React.createElement("table",null,React.createElement("tbody",null,function(){var t,a,n=[];for(var r in e.data.fields)if(e.data.fields.hasOwnProperty(r)){switch((t=e.data.fields[r]).type){case"date":a=React.createElement(j,{value:t.value,valueString:t.valueString||null,isEditing:!1});break;case"time":a=React.createElement(G,{value:t.value,isEditing:!1});break;case"authors":a=React.createElement(P,{value:t.value,isEditing:!1});break;case"select":a=React.createElement(T,{value:t.value,isEditing:!1});break;case"type":a=React.createElement(D,{value:t.value,isEditing:!1});break;case"status":a=React.createElement(A,{value:t.value,isEditing:!1});break;case"taxonomy":a=React.createElement(N,{value:t.value,isEditing:!1});break;case"checkbox":a=React.createElement(I,{value:t.value,isEditing:!1});break;case"location":a=React.createElement(F,{value:t.value,isEditing:!1});break;case"paragraph":a=React.createElement(L,{value:t.value,isEditing:!1});break;case"text":a=React.createElement(M,{value:t.value,isEditing:!1});break;case"user":a=React.createElement(Q,{value:t.value,isEditing:!1});break;case"number":a=React.createElement(U,{value:t.value,isEditing:!1});break;default:a=null}n.push(React.createElement("tr",{key:"field-rows-popup-".concat(n.length)},React.createElement("th",null,t.label,":"),React.createElement("td",null,a)))}return n}())),React.createElement("hr",null),React.createElement("div",{className:"publishpress-calendar-popup-links"},function(){var t,a=[];for(var n in e.data.links)e.data.links.hasOwnProperty(n)&&((t=e.data.links[n]).url?a.push(React.createElement("a",{key:"links-popup-".concat(a.length),href:t.url},t.label)):t.action&&a.push(React.createElement("a",{key:"links-popup-".concat(a.length),onClick:function(e){return s(e,t)}},t.label)),a.push(React.createElement("span",{key:"links-popup-".concat(a.length)},"|")));return a.pop(),a}()))}var Y=jQuery;function V(e){var t,a,n=e.strings.untitled,r=React.useRef(null),l=e.showIcon&&e.icon?React.createElement("span",{className:"dashicons "+e.icon}," "):null,s=e.showTime?React.createElement("time",{className:"publishpress-calendar-item-time",dateTime:e.timestamp,title:e.timestamp},function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"ga",a=e.getHours();return"ga"===t||"ha"===t?0===a?a="12am":a<12?("ha"===t&&(a=a.toString().padStart(2,"0")),a+="am"):(a>12&&(a-=12),"ha"===t&&(a=a.toString().padStart(2,"0")),a+="pm"):a=a.toString().padStart(2,"0"),a}(k(e.timestamp),e.timeFormat||"g:i a")):null,i=e.label||n;return React.createElement("li",{ref:r,className:(t=e.id,a="publishpress-calendar-item post-"+t,e.isPopupOpened&&(a+=" publishpress-calendar-item-opened-popup"),e.canMove&&(a+=" publishpress-calendar-item-movable"),a),style:{backgroundColor:e.color},"data-index":e.index,"data-id":e.id,"data-datetime":e.timestamp,onClick:function(t){var a;(a=t.target,Y(a).hasClass("publishpress-calendar-popup")||Y(a).parents(".publishpress-calendar-popup").length>0)||e.onClickItemCallback(e.id)}},l,s,React.createElement("span",{className:"publishpress-calendar-item-title",dangerouslySetInnerHTML:{__html:i}}),e.isPopupOpened&&React.createElement(q,{target:r,id:e.id,title:i,icon:e.icon,timestamp:e.timestamp,color:e.color,data:e.isPopupOpened?e.getPopupItemDataCallback():null,onItemActionClickCallback:e.onItemActionClickCallback,ajaxUrl:e.ajaxUrl,strings:e.strings}))}function W(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var n,r,l,s,i=[],o=!0,c=!1;try{if(l=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;o=!1}else for(;!(o=(n=l.call(a)).done)&&(i.push(n.value),i.length!==t);o=!0);}catch(e){c=!0,r=e}finally{try{if(!o&&null!=a.return&&(s=a.return(),Object(s)!==s))return}finally{if(c)throw r}}return i}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return B(e,t);var a=Object.prototype.toString.call(e).slice(8,-1);"Object"===a&&e.constructor&&(a=e.constructor.name);if("Map"===a||"Set"===a)return Array.from(e);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return B(e,t)}(e,t)||function(){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 B(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,n=new Array(t);a=0?"business-day":"weekend-day",r.getFullYear()===n.getFullYear()&&r.getMonth()===n.getMonth()&&r.getDate()===n.getDate()&&(l+=" publishpress-calendar-today"),e.isLoading&&(l+=" publishpress-calendar-loading"),i&&(l+=" publishpress-calendar-uncollapse"),1===n.getDate()&&(l+=" publishpress-calendar-first-day-of-month"),e.isHovering&&(l+=" publishpress-calendar-hovering"),"publishpress-calendar-"+l),"data-year":e.date.getFullYear(),"data-month":e.date.getMonth()+1,"data-day":e.date.getDate()},React.createElement("div",null,React.createElement("div",{className:"publishpress-calendar-cell-header"},e.shouldDisplayMonthName&&React.createElement("span",{className:"publishpress-calendar-month-name"},(t=e.date.getMonth(),[(a=publishpressCalendarParams.strings).monthJan,a.monthFeb,a.monthMar,a.monthApr,a.monthMay,a.monthJun,a.monthJul,a.monthAug,a.monthSep,a.monthOct,a.monthNov,a.monthDec][t])),React.createElement("span",{className:"publishpress-calendar-date"},e.date.getDate()),e.isHovering&&React.createElement("span",{className:"publishpress-calendar-cell-click-to-add"},e.strings.clickToAdd)),React.createElement("ul",{className:"publishpress-calendar-day-items"},p.map((function(t){var a=t.id===e.openedItemId;return React.createElement(V,{key:"item-"+t.id+"-"+e.date.getTime(),icon:t.icon,color:t.color,label:t.label,id:t.id,timestamp:t.timestamp,timeFormat:e.timeFormat,showTime:t.showTime,showIcon:!0,index:c++,canMove:t.canEdit,isPopupOpened:a,getPopupItemDataCallback:e.getOpenedItemDataCallback,onClickItemCallback:e.onClickItemCallback,onItemActionClickCallback:e.onItemActionClickCallback,ajaxUrl:e.ajaxUrl,strings:e.strings})}))),function(){if(-1===e.maxVisibleItems)return React.createElement(React.Fragment,null);if(e.items.length>e.maxVisibleItems){var t=e.items.length-e.maxVisibleItems,a=e.strings.hideItems,n=e.strings.showMore,r=i?a.replace("%s",t):n.replace("%s",t),l=i?"publishpress-calendar-hide-items":"publishpress-calendar-show-more",s=i?"hidden":"visibility";return React.createElement("a",{className:l,onClick:u},React.createElement("span",{className:"dashicons dashicons-"+s})," ",r)}return React.createElement(React.Fragment,null)}()))}wp.i18n._n;var z=jQuery;function J(e){return e.isEditing?(z(".pp_editorial_single_select2").length>0&&z(".pp_editorial_single_select2").pp_select2({allowClear:!0,placeholder:function(){z(this).data("placeholder")}}),z(".pp_editorial_meta_multi_select2").length>0&&z(".pp_editorial_meta_multi_select2").pp_select2({multiple:!0}),z(".date-time-pick").each((function(){var e=z(this),t=function(e,t){var a=z.extend({},{},t),n=e.attr("data-alt-field");return n&&void 0!==n&&0!=n.length?z.extend({},a,{altField:'input[name="'+n+'"]',altFormat:e.attr("data-alt-format")}):a}(e,{alwaysSetTime:!1,controlType:"select",altFieldTimeOnly:!1});e.datetimepicker(t)})),React.createElement("div",{dangerouslySetInnerHTML:{__html:e.html}})):React.createElement("span",{id:e.id},e.value)}function K(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var n,r,l,s,i=[],o=!0,c=!1;try{if(l=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;o=!1}else for(;!(o=(n=l.call(a)).done)&&(i.push(n.value),i.length!==t);o=!0);}catch(e){c=!0,r=e}finally{try{if(!o&&null!=a.return&&(s=a.return(),Object(s)!==s))return}finally{if(c)throw r}}return i}}(e,t)||X(e,t)||function(){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 X(e,t){if(e){if("string"==typeof e)return Z(e,t);var a=Object.prototype.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?Z(e,t):void 0}}function Z(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,n=new Array(t);a0&&(n=a[0].id),x(i,n)},onClear:function(e,t){x(i,null)}});break;case"taxonomy":a=React.createElement(N,{value:t.value,isEditing:!0,id:n,taxonomy:t.taxonomy,nonce:e.nonce,ajaxUrl:e.ajaxUrl,multiple:!0,onSelect:function(e,t,a){for(var n=[],r=0;r1&&React.createElement("tr",null,React.createElement("th",null,React.createElement("label",null,e.strings.postType)),React.createElement("td",null,React.createElement(O,{options:e.postTypes,allowClear:!1,onSelect:function(e){var t=ee(e.target).pp_select2("data")[0].id;n(t),x("post_type",t)}}))),1===e.postTypes.length&&React.createElement("tr",null,React.createElement("th",null,React.createElement("label",null,e.strings.postType)),React.createElement("td",null,function(t){var a,n=function(e,t){var a="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!a){if(Array.isArray(e)||(a=X(e))||t&&e&&"number"==typeof e.length){a&&(e=a);var n=0,r=function(){};return{s:r,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,s=!0,i=!1;return{s:function(){a=a.call(e)},n:function(){var e=a.next();return s=e.done,e},e:function(e){i=!0,l=e},f:function(){try{s||null==a.return||a.return()}finally{if(i)throw l}}}}(e.postTypes);try{for(n.s();!(a=n.n()).done;){var r=a.value;if(r.value===t)return r.text}}catch(e){n.e(e)}finally{n.f()}return e.strings.postTypeNotFound}(a))),H.length>0&&H)),0===H.length&&React.createElement("div",{className:"publishpress-calendar-popup-loading-fields"},e.strings.pleaseWaitLoadingFormFields),f&&React.createElement("div",{className:"publishpress-calendar-popup-error-message"},React.createElement("span",{className:"dashicons dashicons-warning"}),f),React.createElement("hr",{className:"publishpress-calendar-popup-links-hr"}),React.createElement("div",{className:"publishpress-calendar-popup-links"},function(){var t,a=[{id:"create",className:"button-primary calendar-create-btn",label:e.strings.save,labelLoading:e.strings.saving,action:"publishpress_calendar_create_item"},{id:"edit",className:"button-secondary calendar-edit-btn",label:e.strings.saveAndEdit,labelLoading:e.strings.saving,action:"publishpress_calendar_create_item"}],n=[];for(var r in a)a.hasOwnProperty(r)&&(t=a[r],p===t.id?n.push(React.createElement("span",{key:t.id},t.labelLoading)):n.push(b(t,S)),n.push(React.createElement("span",{key:"link-separator-".concat(n.length)})));return n.pop(),n}(),o&&React.createElement("span",{className:"dashicons dashicons-update-alt publishpress-spinner"}))))}function ae(e){return(ae="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 ne(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function re(e){for(var t=1;te.length)&&(t=e.length);for(var a=0,n=new Array(t);a tr > td").off("mouseenter")},ye=function(){oe(".publishpress-calendar-day-hover").removeClass("publishpress-calendar-day-hover"),oe(".publishpress-calendar-loading").removeClass("publishpress-calendar-loading")},Ee=function(e){c(new Date(o.getTime()+7*e*24*60*60*1e3))},we=function(e){e.preventDefault(),J((function(e){return e+1}))},ke=function(t,a){var n=oe(t.target),r=oe(a.draggable[0]),l=g(k(r.data("datetime")));oe(t.target).addClass("publishpress-calendar-loading"),function(t,a,n,r,l){if(f[t]){var s=f[t][a];E(!0),D(e.strings.movingTheItem);var i=pe(e.actionMoveItem),o=new FormData;o.append("id",s.id),o.append("year",n),o.append("month",r),o.append("day",l),fetch(i,{method:"POST",body:o}).then((function(e){return e.json()})).then((function(){J(z+1)}))}}(l,r.data("index"),n.data("year"),n.data("month"),n.data("day"))},_e=function(e,t){ye(),oe(e.target).addClass("publishpress-calendar-day-hover")},Ce=function(e){var t=oe(e);return t.is("td.publishpress-calendar-business-day, td.publishpress-calendar-weekend-day")?t:t.is(".publishpress-calendar-cell-header, .publishpress-calendar-date, .publishpress-calendar-cell-click-to-add, .publishpress-calendar-month-name")?t.parents("td"):null},Re=function(e){var t=k(e.data("year")+"-"+e.data("month")+"-"+e.data("day"));return t.getHours()>0&&t.setTime(t.getTime()+6e4*t.getTimezoneOffset()),t},xe=function(){var e;oe(".publishpress-calendar tbody > tr > td").on("mouseover",(function(t){t.preventDefault(),t.stopPropagation();var a=Ce(t.target);if(a){if(function(e){return oe(e).hasClass("publishpress-calendar-day-hover")}(a))return;Z(Re(a)),e=Re(a)}})).on("mouseout",(function(t){t.stopPropagation(),t.preventDefault(),Ce(t.relatedTarget)||(Z(null),e=null)})).on("click",(function(t){Ce(t.target)&&(U(null),ne(e))}))},je=function(t,a){ue((function(e){return re(re({},e),{},le({},t,a))})),"weeks"===t&&((0===(a=parseInt(a))||isNaN(a))&&(a=e.numberOfWeeksToDisplay),N(a),d(a))},Se=function(){U(null),q(null),ne(null)},Oe=function(e){q(null),Z(null),ne(null),U(e),publishpressCalendarParams.proActive&&R(e)},Pe=function(e,t,a){W(V+1)},De=function(e){"Escape"===e.key&&Se()},Te=function(){return H},Ae=function(){U(null)};React.useEffect((function(){return document.addEventListener("keydown",De),oe(document).on("publishpress_calendar:close_popup",Ae),oe(document).on("change","#pp-content-filters select:not(.non-trigger-select)",de),oe(document).on("click",".metadata-item-filter .filter-apply input[type=submit]",ge),oe(document).on("click",".pp-content-calendar-manage .search-bar input[type=submit]",ve),oe(document).on("click",".pp-content-calendar-manage .me-mode-action",fe),oe(document).on("click",".pp-content-calendar-manage .pp-show-revision-btn",he),oe(document).on("click",".pp-popup-modal-header .modal-nav-prev, .pp-popup-modal-header .modal-nav-next",me),oe(document).on("input",".pp-content-calendar-general-modal-container .modal-post-title .title-area",x),oe(document).on("click",".pp-content-calendar-general-modal-container .modal-content-right .save-post-changes:not(.disabled)",(function(e){C(e,jQuery(this),we)})),e.userCanAddPosts&&xe(),be}),[]),React.useEffect((function(){oe(".publishpress-calendar-day-items li").draggable({zIndex:99999,helper:"clone",containment:".publishpress-calendar table",start:function(e,t){return oe(e.target).data("id")!==Q&&(!!oe(e.target).hasClass("publishpress-calendar-item-movable")&&(oe(e.target).addClass("ui-draggable-target"),Se(),void S(!0)))},stop:function(e,t){oe(".ui-draggable-target").removeClass("ui-draggable-target"),S(!1)}}),oe(".publishpress-calendar tbody > tr > td").droppable({drop:ke,over:_e})})),e.userCanAddPosts&&React.useEffect(xe,[o,p,A,F,ce,z]),React.useEffect((function(){E(!0),D(e.strings.loading);var t=pe(e.actionGetData,"");ce&&Object.keys(ce).length>0&&(ce.hasOwnProperty("start_date")&&delete ce.start_date,ce.hasOwnProperty("number_of_weeks")&&delete ce.number_of_weeks,t+="&"+new URLSearchParams(ce).toString());t+="&start_date="+g(v(o,e.weekStartsOnSunday))+"&number_of_weeks="+p,t+=F?"&s="+F:"&s=",fetch(t).then((function(e){return e.json()})).then((function(e){publishpressCalendarParams.PostData=_(publishpressCalendarParams.PostData,e),h(e),E(!1),D(null),ye(),jQuery(".pp-title-tooltip").each((function(){var e=jQuery(this),t=e.attr("title");if(t&&""!==t){e.removeAttr("title");var a=jQuery('').text(t);jQuery("body").append(a),e.hover((function(){a.show();var t=e.offset().top-a.outerHeight()-10,n=e.offset().left+e.outerWidth()/2-a.outerWidth()/2;a.css({top:t+"px",left:n+"px",position:"absolute"})}),(function(){a.hide()}))}}))}))}),[o,p,A,F,ce,z]),React.useEffect((function(){if(Q)if(publishpressCalendarParams.proActive)R(Q);else{E(!0),D(e.strings.loadingItem);var t=e.ajaxUrl+"?action=publishpress_calendar_get_post_data&nonce="+e.nonce+"&id="+Q;fetch(t).then((function(e){return e.json()})).then((function(e){E(!1),D(null),q(e)}))}}),[Q,V]);var Ne=["publishpress-calendar","publishpress-calendar-theme-"+t];return e.userCanAddPosts&&Ne.push("user-can-add-posts"),React.createElement("div",{className:Ne.join(" ")},React.createElement(r,{refreshOnClickCallback:we,backPageOnClickCallback:function(e){e.preventDefault(),Ee(-1*p)},backOnClickCallback:function(e){e.preventDefault(),Ee(-1)},forwardOnClickCallback:function(e){e.preventDefault(),Ee(1)},forwardPageOnClickCallback:function(e){e.preventDefault(),Ee(p)},todayOnClickCallback:function(t){t.preventDefault(),c(v(e.todayDate,e.weekStartsOnSunday))},strings:e.strings}),React.createElement("table",null,React.createElement("thead",null,React.createElement("tr",null,React.createElement(l,{weekStartsOnSunday:e.weekStartsOnSunday,strings:e.strings}))),React.createElement("tbody",null,function(){for(var t,a,n=7*p,r=v(o,e.weekStartsOnSunday),l=[],s=[],i=0,c=r.getMonth(),u=0;u