Current File : /var/www/e360ban/wp-content/plugins/toolset-blocks/public/js/contentTemplate.js |
!function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(o,r,function(e){return t[e]}.bind(null,r));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=226)}({0:function(t,e){t.exports=window.wp.i18n},1:function(t,e){t.exports=window.wp.components},11:function(t,e){t.exports=window.wp.hooks},19:function(t,e,n){"use strict";n.d(e,"a",(function(){return u}));var o=n(0),r=n(32),i=n.n(r),c=n(4),a=n(3);function u(t){var e=setTimeout((function(){Object(c.dispatch)("core/notices").createNotice("info",Object(o.__)("Processing server request, please wait...","wpv-views"),{id:"http_delay_notice",isDismissible:!0,type:"snackbar"})}),a.n);return new Promise((function(n,o){i()(t).then((function(t){clearTimeout(e),Object(c.dispatch)("core/notices").removeNotice("http_delay_notice"),n(t)}),(function(t){clearTimeout(e),Object(c.dispatch)("core/notices").removeNotice("http_delay_notice"),o(t)}))}))}},2:function(t,e){t.exports=window.wp.element},226:function(t,e,n){"use strict";n.r(e);var o=n(0),r=n(2),i=n(4),c=n(6);function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function u(t,e){return(u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function s(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,o=p(t);if(e){var r=p(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return l(this,n)}}function l(t,e){return!e||"object"!==a(e)&&"function"!=typeof e?f(t):e}function f(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var d=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&u(t,e)}(n,t);var e=s(n);function n(t){var r,a,u,s;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),r=e.call(this,t),a=f(r),s=function(t){var e=Object(i.select)("core/editor").getCurrentPostType,n=Object(i.dispatch)("core/notices").createInfoNotice;if(e()||setTimeout(Object(c.partial)(t,t),1),Object(c.isEqual)("view-template",e())){var r=Object(o.__)("You are editing a template. Need help?","wpv-views"),a=window.ctBlockEditor,u=a.collections,s=a.themeName;u&&(r=Object(o.sprintf)(Object(o.__)('You are using the "%1$s" theme and you can show or hide the theme\'s elements. In the right sidebar, click the "Content Template" tab and scroll to the "Theme options (%1$s)" section.',"wpv-views"),s)),n(r,{id:"ct-editing-notice",isDismissible:!0,actions:[{label:Object(o.__)("Learn how to design templates with Toolset.","wpv-views"),url:"https://toolset.com/course-lesson/creating-templates-to-display-custom-posts/?utm_source=plugin&utm_medium=gui&utm_campaign=blocks"}]})}},(u="deferAddingContentTemplateEditingNotice")in a?Object.defineProperty(a,u,{value:s,enumerable:!0,configurable:!0,writable:!0}):a[u]=s,r.deferAddingContentTemplateEditingNotice(r.deferAddingContentTemplateEditingNotice),r}return n}(r.Component);var y=function t(){var e,n,o;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),o=function(t){var e=Object(i.select)("core/editor").getCurrentPostType;if(e()||setTimeout(Object(c.partial)(t,t),1),Object(c.isEqual)("view-template",e())){var n=document.getElementById("wpv-ct-change-editor-opener");n&&n.addEventListener("click",(function(){var t=jQuery("#wpv-ct-change-editor");t.dialog({title:t.data("title"),modal:!0})}))}},(n="deferAddingChangeEditorHooks")in(e=this)?Object.defineProperty(e,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[n]=o,this.deferAddingChangeEditorHooks(this.deferAddingChangeEditorHooks)},b=n(11),m=n(3);function h(t){return function(t){if(Array.isArray(t))return v(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||g(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(t,e){if(t){if("string"==typeof t)return v(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(t,e):void 0}}function v(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n<e;n++)o[n]=t[n];return o}function w(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var O=function t(){var e=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),w(this,"ctUsageClicked",(function(t){var e=t.target,n=Object(i.dispatch)(m.f).toggleUsage,o=e.value,r=h(e.name.matchAll(/wpv-content-template-usage\[(.+?)\]/g)),a=Object(c.get)(r,["0","1"],null);a&&n(a,o)})),w(this,"maybeModifyPostTypeInContentSelection",(function(t){if(m.e!==t)return t;var e=(0,Object(i.select)(m.f).getUsage)(),n=Object(c.get)(e,["single"],[]),o=Object(c.get)(e,["cpt-archive"],[]),r=Object(c.get)(e,["taxonomy-archive"],[]);return 0===n.length&&0===o.length||n.length>1||o.length>1||r.length>0||1===n.length&&1===o.length&&n[0]!==o[0]?t:n[0]||o[0]})),w(this,"maybeFetchOptionsInContentSelection",(function(t,n){var o=Object(i.select)("core/editor").getCurrentPostType;if(!Object(c.isEqual)(m.e,o()))return t;var r=e.maybeModifyPostTypeInContentSelection(m.e);return Object(c.isEqual)(m.e,r)?t:n(r)})),w(this,"deferAddingUsageElementsHooks",(function(t){var n=Object(i.select)("core/editor").getCurrentPostType;if(n()||setTimeout(Object(c.partial)(t,t),1),Object(c.isEqual)(m.e,n())){Object(b.addFilter)("toolsetViews.filters.currentPostTypeInContentSelection","wpv-views",e.maybeModifyPostTypeInContentSelection),Object(b.addFilter)("toolsetViews.filters.relatedPostTypesInContentSelection","wpv-views",e.maybeFetchOptionsInContentSelection),Object(b.addFilter)("toolsetViews.filters.relatedRFGsInContentSelection","wpv-views",e.maybeFetchOptionsInContentSelection);var o,r=function(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=g(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var o=0,r=function(){};return{s:r,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},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 i,c=!0,a=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return c=t.done,t},e:function(t){a=!0,i=t},f:function(){try{c||null==n.return||n.return()}finally{if(a)throw i}}}}(document.getElementsByClassName("js-wpv-content-template-usage-selector"));try{for(r.s();!(o=r.n()).done;){var a=o.value;a.addEventListener("click",e.ctUsageClicked),a.checked&&e.ctUsageClicked({target:a})}}catch(t){r.e(t)}finally{r.f()}}})),this.deferAddingUsageElementsHooks(this.deferAddingUsageElementsHooks)},P=n(8),_=n(1);function j(t){return(j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function S(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function E(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function C(t,e){return(C=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function R(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,o=k(t);if(e){var r=k(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return T(this,n)}}function T(t,e){return!e||"object"!==j(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function k(t){return(k=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var x=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&C(t,e)}(a,t);var e,n,i,c=R(a);function a(){return S(this,a),c.apply(this,arguments)}return e=a,(n=[{key:"render",value:function(){var t=window.wp.editPost.PluginDocumentSettingPanel,e=this.props,n=e.post,i=e.onChangePostTitle;return React.createElement(r.Fragment,null,React.createElement(t,{name:"general-panel",title:"General",icon:" "},React.createElement("div",null,React.createElement(_.TextControl,{label:Object(o.__)("Name","wpv-views"),value:n.title,onChange:i}))))}}])&&E(e.prototype,n),i&&E(e,i),a}(r.Component),A=n(31),U=n(19);function D(t){return(D="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function N(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function I(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function M(t,e){return(M=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function F(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,o=L(t);if(e){var r=L(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return H(this,n)}}function H(t,e){return!e||"object"!==D(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function L(t){return(L=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var q=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&M(t,e)}(i,t);var e,n,o,r=F(i);function i(){return N(this,i),r.apply(this,arguments)}return e=i,(n=[{key:"fetchAvailableUsages",value:function(){var t="".concat(this.baseUrl,"/content-template/available-usages");return Object(U.a)({path:t,method:"GET"})}},{key:"cleanPostTypeAssignedPosts",value:function(t){var e="".concat(this.baseUrl,"/content-template/post-type/").concat(t,"/clean-assigned-posts");return Object(U.a)({path:e,method:"GET"})}}])&&I(e.prototype,n),o&&I(e,o),i}(A.a);function G(t){return(G="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function B(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Y(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function V(t,e){return(V=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function z(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,o=Q(t);if(e){var r=Q(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return $(this,n)}}function $(t,e){return!e||"object"!==G(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Q(t){return(Q=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var J=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&V(t,e)}(c,t);var e,n,r,i=z(c);function c(){return B(this,c),i.apply(this,arguments)}return e=c,(n=[{key:"renderConditions",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"AND",r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=Object(o.__)("NOT","wpv-views"),c="AND"===n?Object(o.__)("AND","wpv-views"):Object(o.__)("OR","wpv-views"),a=t.map((function(t){if(t.operator&&t.conditions&&t.conditions.length>0){var n=e.renderConditions(t.conditions,t.operator,t.negative);return"( ".concat(n," )")}var o=t.secondArgument.value&&t.secondArgument.value.label?t.secondArgument.value.label:"";return"<b>".concat(t.firstArgument.value.label,":</b> ").concat(o)})).join(" <small>".concat(c,"</small> "));return r?"<small>".concat(i,"</small> ( ").concat(a," ) "):a}},{key:"render",value:function(){var t=this.props,e=t.conditions,n=t.operator,o=t.negative;return React.createElement("div",{className:"conditions-text",dangerouslySetInnerHTML:{__html:this.renderConditions(e,n,o)}})}}])&&Y(e.prototype,n),r&&Y(e,r),c}(r.Component);function K(t){return(K="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function W(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function X(t,e){return(X=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Z(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,o=nt(t);if(e){var r=nt(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return tt(this,n)}}function tt(t,e){return!e||"object"!==K(e)&&"function"!=typeof e?et(t):e}function et(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function nt(t){return(nt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var ot=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&X(t,e)}(c,t);var e,n,o,r=Z(c);function c(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,c),(e=r.call(this,t)).state={modalOpened:!1,loading:!1},e.setUsage=e.setUsage.bind(et(e)),e.cleanPostTypeAssignedPosts=e.cleanPostTypeAssignedPosts.bind(et(e)),e.saveConditions=e.saveConditions.bind(et(e)),e}return e=c,(n=[{key:"setUsage",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];Object(i.dispatch)(m.f).setUsage(t,e,n,o),this.setState({modalOpened:!1,error:!1})}},{key:"cleanPostTypeAssignedPosts",value:function(){var t=this,e=this.props.postType,n=new q;this.setState({loading:!0}),n.cleanPostTypeAssignedPosts(e.slug).then((function(){t.setState({loading:!1,error:!1}),Object(i.dispatch)(m.f).availableUsagesCleanAssignedPosts(e.slug)}),(function(){t.setState({loading:!1,error:!0})}))}},{key:"saveConditions",value:function(t,e){var n=this.props.postType,o=t.conditions;1===o.length&&""===o[0].firstArgument.value.value?this.setUsage(n.slug,!0):this.setUsage(n.slug,!0,t,e)}},{key:"render",value:function(){var t=this,e=this.props,n=e.postType,o=e.usageRow,r=this.state,i=r.modalOpened,c=r.loading,a=r.error,u=window.toolsetConditionals,s=u.ConditionalsModal,l=u.PostFieldCondition,f=u.EMPTY_POST_FIELD_CONDITION,p=!(!o||!o.enabled),d=!(!o||!o.conditions)&&o.conditions,y=o&&o.parsed_conditions?o.parsed_conditions:{},b=d?"Edit Conditions":"Set conditions",m={type:l,defaultCondition:f,parameters:{options:n.options}};return React.createElement("div",{className:"wpv-ct-usage-row"},React.createElement(_.CheckboxControl,{key:"checkbox_".concat(n.slug),label:n.display_name,value:n.slug,checked:p,className:"usage-row-checkbox is-inline-block",onChange:function(e){t.setState({error:!1}),t.setUsage(n.slug,e)}}),p&&React.createElement(_.Button,{className:"conditions-button is-link is-inline-block",onClick:function(){return t.setState({modalOpened:!0})}},b),i&&React.createElement(s,{key:"conditionals_".concat(n.slug),conditions:d,parsedConditions:y,clientId:"conditionals_".concat(n.slug),configuration:m,onCancel:function(){return t.setState({modalOpened:!1})},onChange:this.saveConditions,debug:!0}),d&&d.conditions&&d.conditions.length>0&&React.createElement(J,{conditions:d.conditions,operator:d.operator,negative:d.negative}),p&&n.has_assigned_posts&&React.createElement("div",{className:"dissident-posts-notice"},React.createElement("i",{className:"fa fa-warning"}),"Some posts have custom templates.",React.createElement(_.Button,{className:"clear-link is-link is-inline-block",onClick:this.cleanPostTypeAssignedPosts},c?React.createElement(_.Spinner,null):"Apply to all")),a&&React.createElement("p",null," Unexpected error when applying to all posts. "))}}])&&W(e.prototype,n),o&&W(e,o),c}(r.Component);function rt(t){return(rt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function it(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function ct(t,e){return(ct=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function at(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,o=lt(t);if(e){var r=lt(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return ut(this,n)}}function ut(t,e){return!e||"object"!==rt(e)&&"function"!=typeof e?st(t):e}function st(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function lt(t){return(lt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var ft=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&ct(t,e)}(u,t);var e,n,i,a=at(u);function u(t){var e;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,u),e=a.call(this,t);var n=t.post,o=n&&n.meta&&n.meta.usage_priority?n.meta.usage_priority:0;return e.state={priority:o},e.onChangePriority=e.onChangePriority.bind(st(e)),e}return e=u,(n=[{key:"onChangePriority",value:function(t){this.setState({priority:parseInt(t)}),this.props.onChangePriority(parseInt(t))}},{key:"render",value:function(){var t=window.wp.editPost.PluginDocumentSettingPanel,e=this.props,n=e.post,i=e.availableUsages,a=this.state.priority,u=n&&n.meta&&n.meta.usage?n.meta.usage:{};return React.createElement(r.Fragment,null,React.createElement(t,{name:"usage-panel",key:"usage-panel",title:Object(o.__)("Usage","wpv-views"),icon:" "},React.createElement("div",null,i.map((function(t){return React.createElement(ot,{key:t.slug,postType:t,usageRow:Object(c.find)(u,(function(e){return e.post_type===t.slug}))})})))),React.createElement(t,{name:"usage-priority",key:"usage-priority",title:Object(o.__)("Priority","wpv-views"),icon:" "},React.createElement("div",{className:"toolset-ct-editor-priority-tab"},React.createElement("span",null,Object(o.__)("There might be multiple templates assigned to the same post type. Set your preferred template priority if a post matches more than one set of conditions.","wpv-views")),React.createElement("br",null),React.createElement("a",{target:"_blank",rel:"noreferrer",className:"is-link",href:"https://toolset.com/course-lesson/assigning-templates-to-posts-conditionally/?utm_source=plugin&utm_medium=gui&utm_campaign=blocks"},Object(o.__)("Learn More","wpv-views"),React.createElement(_.Dashicon,{icon:"external"})),React.createElement("br",null),React.createElement("br",null),React.createElement(_.TextControl,{label:Object(o.__)("Template Priority","wpv-views"),value:a,onChange:this.onChangePriority}),React.createElement("small",null,Object(o.__)("Higher number means higher priority.","wpv-views")))))}}])&&it(e.prototype,n),i&&it(e,i),u}(r.Component);function pt(t){return(pt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function dt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function yt(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function bt(t,e){return(bt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function mt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,o=gt(t);if(e){var r=gt(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return ht(this,n)}}function ht(t,e){return!e||"object"!==pt(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function gt(t){return(gt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var vt=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&bt(t,e)}(a,t);var e,n,i,c=mt(a);function a(){return dt(this,a),c.apply(this,arguments)}return e=a,(n=[{key:"render",value:function(){var t=this.props,e=t.post,n=t.availableUsages,i=t.onChangePostTitle,c=t.onChangePriority;if(null===this.props.post){var a=window.wp.editPost.PluginDocumentSettingPanel;return React.createElement(a,{name:"general-panel",title:Object(o.__)("General","wpv-views"),icon:" "},React.createElement(_.Spinner,null))}return React.createElement(r.Fragment,null,React.createElement(x,{key:"general",post:e,onChangePostTitle:i}),React.createElement(ft,{key:"usage",post:e,availableUsages:n,onChangePriority:c}))}}])&&yt(e.prototype,n),i&&yt(e,i),a}(r.Component);function wt(t){return(wt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ot(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function Pt(t,e){return(Pt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function _t(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,o=Et(t);if(e){var r=Et(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return jt(this,n)}}function jt(t,e){return!e||"object"!==wt(e)&&"function"!=typeof e?St(t):e}function St(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Et(t){return(Et=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Ct=window.toolsetDynamicSourcesScriptData,Rt=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Pt(t,e)}(u,t);var e,n,o,a=_t(u);function u(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,u),(t=a.call(this)).setPreviewPostsForUsage=t.setPreviewPostsForUsage.bind(St(t)),t}return e=u,(n=[{key:"componentDidMount",value:function(){this.initialize()}},{key:"componentDidUpdate",value:function(t){var e=this.props.usage;Object(c.eq)(e,t.usage)||(this.props.setPostMetaUsage(e),this.setPreviewPostsForUsage(e))}},{key:"setPreviewPostsForUsage",value:function(t){var e=this.props.availableUsages,n=Object(c.filter)(t,(function(t){return!0===t.enabled})).map((function(t){return t.post_type})),o=Object(c.flatten)(e.map((function(e){return void 0!==Object(c.find)(t,(function(t){return t.post_type===e.slug&&t.enabled}))?e.preview_urls:[]})));this.props.setPreviewPosts(o,n)}},{key:"initialize",value:function(){var t=Object(i.select)("core/editor").getCurrentPost();Object(i.dispatch)(m.f).setPost(t),(new q).fetchAvailableUsages().then((function(t){Object(i.dispatch)(m.f).setAvailableUsages(t)})),wp.data.dispatch("core/edit-post").removeEditorPanel("post-status"),wp.data.dispatch("core/editor").disablePublishSidebar()}},{key:"render",value:function(){var t=this.props,e=t.post,n=t.availableUsages;return React.createElement(r.Fragment,null,React.createElement(vt,{post:e,availableUsages:n,onChangePostTitle:this.props.setPostTitle,onChangePriority:this.props.setPostMetaPriority}))}}])&&Ot(e.prototype,n),o&&Ot(e,o),u}(r.Component),Tt=Object(P.compose)(Object(P.withState)({post:null,availableUsages:[]}),Object(i.withSelect)((function(t){var e=t(m.f),n=e.getPost,o=e.getAvailableUsages,r=n();return{post:r,usage:r&&r.meta&&r.meta.usage?r.meta.usage:[],availableUsages:o()}})),Object(i.withDispatch)((function(t){return{setPostMetaUsage:function(e){t("core/editor").editPost({meta:{usage:e}})},setPreviewPosts:function(e,n){t(Ct.dynamicSourcesStore).setPreviewPostTypes(n),t(Ct.dynamicSourcesStore).setPreviewPosts(e)},setPostMetaPriority:function(e){t("core/editor").editPost({meta:{usage_priority:e}})},setPostTitle:function(e){t("core/editor").editPost({title:e}),t(m.f).setPostTitle(e)}}})))(Rt);var kt="plugin-content-template-panel-sidebar",xt=function t(){var e,n,o;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),o=function(t){var e=Object(i.select)("core/editor").getCurrentPostType;e()&&void 0!==window.toolsetConditionals?Object(c.isEqual)("view-template",e())&&((0,wp.plugins.registerPlugin)(kt,{render:Tt}),window._wpLoadBlockEditor.then((function(){var t=["".concat(kt,"/general-panel"),"".concat(kt,"/usage-panel")];for(var e in t){var n=t[e];Object(c.get)(wp.data.select("core/edit-post").getPreference("panels")[n],"opened",!1)||wp.data.dispatch("core/edit-post").toggleEditorPanelOpened(n)}}))):setTimeout(Object(c.partial)(t,t),1)},(n="deferAddingContentSelectionHooks")in(e=this)?Object.defineProperty(e,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[n]=o,this.deferAddingContentSelectionHooks(this.deferAddingContentSelectionHooks)};new d,new y,new O,new xt},3:function(t,e,n){"use strict";n.d(e,"db",(function(){return o})),n.d(e,"eb",(function(){return r})),n.d(e,"E",(function(){return i})),n.d(e,"D",(function(){return c})),n.d(e,"F",(function(){return a})),n.d(e,"R",(function(){return u})),n.d(e,"M",(function(){return s})),n.d(e,"N",(function(){return l})),n.d(e,"O",(function(){return f})),n.d(e,"P",(function(){return p})),n.d(e,"Q",(function(){return d})),n.d(e,"S",(function(){return y})),n.d(e,"L",(function(){return b})),n.d(e,"z",(function(){return m})),n.d(e,"u",(function(){return h})),n.d(e,"w",(function(){return g})),n.d(e,"s",(function(){return v})),n.d(e,"r",(function(){return w})),n.d(e,"y",(function(){return O})),n.d(e,"A",(function(){return P})),n.d(e,"x",(function(){return _})),n.d(e,"v",(function(){return j})),n.d(e,"B",(function(){return S})),n.d(e,"t",(function(){return E})),n.d(e,"o",(function(){return C})),n.d(e,"p",(function(){return R})),n.d(e,"W",(function(){return T})),n.d(e,"Z",(function(){return k})),n.d(e,"ab",(function(){return x})),n.d(e,"X",(function(){return A})),n.d(e,"Y",(function(){return U})),n.d(e,"bb",(function(){return D})),n.d(e,"cb",(function(){return N})),n.d(e,"g",(function(){return I})),n.d(e,"h",(function(){return M})),n.d(e,"i",(function(){return F})),n.d(e,"G",(function(){return H})),n.d(e,"m",(function(){return L})),n.d(e,"H",(function(){return q})),n.d(e,"n",(function(){return G})),n.d(e,"q",(function(){return B})),n.d(e,"gb",(function(){return Y})),n.d(e,"C",(function(){return V})),n.d(e,"K",(function(){return z})),n.d(e,"J",(function(){return $})),n.d(e,"T",(function(){return Q})),n.d(e,"l",(function(){return J})),n.d(e,"k",(function(){return K})),n.d(e,"j",(function(){return W})),n.d(e,"V",(function(){return X})),n.d(e,"U",(function(){return Z})),n.d(e,"e",(function(){return tt})),n.d(e,"f",(function(){return et})),n.d(e,"fb",(function(){return nt})),n.d(e,"I",(function(){return ot})),n.d(e,"a",(function(){return rt})),n.d(e,"c",(function(){return it})),n.d(e,"d",(function(){return ct})),n.d(e,"b",(function(){return at}));var o=0,r=2,i="paged",c="ajaxed",a="rollover",u="builtin",s="spinner1",l="spinner2",f="spinner3",p="spinner4",d="spinner5",y="uploaded",b="disabled",m="unformatted",h="toolset-grid",g="toolset-masonry",v="bootstrap-grid",w="bootstrap-4-grid",O="table_of_fields",P="un_ordered_list",_="ordered_list",j="separators_list",S="wp_columns",E="collage",C="0",R="1",T="all",k="pagination",x="slider",A="parametric",U="full",D="NUMERIC",N="STRING",I="posts",M="taxonomy",F="users",H="views-editor/preview",L="views-editor/dictionaries",q=700,G=1500,B=700,Y=700,V=500,z="select",$="list",Q="toolset/dynamic-sources",J=(new RegExp("\x3c!--[\\s\\S]*?(?:--\x3e)?\x3c!---+>?|<!(?![dD][oO][cC][tT][yY][pP][eE]|\\[CDATA\\[)[^>]*>?|<[?][^>]*>?","g"),""),K="ajaxrefreshonsubmit",W="ajaxrefreshonchange",X="toolset_use_theme_setting",Z="toolset_use_custom",tt="view-template",et="views/content-template",nt={NAME:1,DESIGN:2,POST_TYPE:3,COLLAGE:4},ot="all",rt="product",it="related",ct="up-sells",at="cross-sells"},31:function(t,e,n){"use strict";function o(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}n.d(e,"a",(function(){return r}));var r=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),o(this,"baseUrl","/toolset-views/v1"),o(this,"wpBaseUrl","/wp/v2")}},32:function(t,e){t.exports=window.wp.apiFetch},4:function(t,e){t.exports=window.wp.data},6:function(t,e){t.exports=lodash},8:function(t,e){t.exports=window.wp.compose}});