File "acf-pro-blocks.min.js"

Full Path: /home/vantageo/public_html/cache/cache/cache/cache/cache/cache/cache/.wp-cli/wp-content/plugins/advanced-custom-fields-pro/pro/assets/js/acf-pro-blocks.min.js
File size: 9.82 KB
MIME-type: text/plain
Charset: utf-8

"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function t(e){return typeof e}:function t(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function _get(t,e,n){return(_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function t(e,n,r){var o=_superPropBase(e,n);if(o){var i=Object.getOwnPropertyDescriptor(o,n);return i.get?i.get.call(r):i.value}})(t,e,n||t)}function _superPropBase(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=_getPrototypeOf(t)););return t}function ownKeys(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(n,!0).forEach(function(e){_defineProperty(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys(n).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function _defineProperty(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function _createClass(t,e,n){return e&&_defineProperties(t.prototype,e),n&&_defineProperties(t,n),t}function _possibleConstructorReturn(t,e){return!e||"object"!==_typeof(e)&&"function"!=typeof e?_assertThisInitialized(t):e}function _getPrototypeOf(t){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function t(e){return e.__proto__||Object.getPrototypeOf(e)})(t)}function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _inherits(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&&_setPrototypeOf(t,e)}function _setPrototypeOf(t,e){return(_setPrototypeOf=Object.setPrototypeOf||function t(e,n){return e.__proto__=n,e})(t,e)}!function(t,e){function n(){var t=acf.get("blockTypes");t&&t.map(r)}function r(t){var e=t.post_types||[],n;if(e.length){e.push("wp_block");var r=acf.screen.getPostType();if(-1===e.indexOf(r))return!1}if("string"==typeof t.icon&&"<svg"===t.icon.substr(0,4)){var o=t.icon;t.icon=React.createElement(u,{html:o})}t.icon||delete t.icon,wp.blocks.getCategories().filter(function(e){return e.slug===t.category}).pop()||(console.warn('The block "'.concat(t.name,'" is registered with an unknown category "').concat(t.category,'".')),t.category="common"),t=acf.parseArgs(t,{title:"",name:"",category:"",attributes:{id:{type:"string"},name:{type:"string"},data:{type:"object"},align:{type:"string"},mode:{type:"string"}},edit:function t(e){return React.createElement(l,e)},save:function t(){return null}}),s[t.name]=t;var i=wp.blocks.registerBlockType(t.name,t);return i.attributes.anchor&&(i.attributes.anchor={type:"string"}),i}function o(t){return s[t]||!1}function i(t){for(var e=wp.data.select("core/editor").getBlocks(),n=0;n<e.length;)e=e.concat(e[n].innerBlocks),n++;for(var r in t)e=e.filter(function(e){return e.attributes[r]===t[r]});return e}function a(e,n){return t.ajax({url:acf.get("ajaxurl"),dataType:"json",type:"post",cache:!1,data:acf.prepareForAjax({action:"acf/ajax/fetch-block",block:JSON.stringify(e),query:n})})}function c(t){var e=[],n=t.nodeName.toLowerCase();for(var r in wp.editor)r.toLowerCase()===n&&(n=wp.editor[r]);return e[0]=n,e[1]={},[].slice.call(t.attributes).forEach(function(t){var n=t.name,r=t.value;n="class"===n?"className":n,e[1][n]=r}),[].slice.call(t.childNodes).forEach(function(t){if(t instanceof Text){var n=t.textContent.trim();n&&e.push(n)}else e.push(c(t))}),React.createElement.apply(this,e)}var s={};acf.addAction("ready",n),acf.parseJSX=function(t){return c(t[0])};var l=function(t){function e(t){var n;return _classCallCheck(this,e),(n=_possibleConstructorReturn(this,_getPrototypeOf(e).call(this,t))).setAttributes=n.setAttributes.bind(_assertThisInitialized(n)),n.setup(),n}return _inherits(e,t),_createClass(e,[{key:"setup",value:function t(){function e(t){-1===t.indexOf(a.mode)&&(a.mode=t[0])}var n=this.props,r=n.name,a=n.attributes,c=n.clientId,s=o(r),l;a.id?i().filter(function(t){return t.attributes.id===a.id}).filter(function(t){return t.clientId!==c}).pop()&&(a.id=acf.uniqid("block_")):(a.id=acf.uniqid("block_"),a.name=s.name,a.mode=a.mode||s.mode,a.align=a.align||s.align,a.data=a.data||s.data);"edit"===s.mode?e(["edit","preview"]):"preview"===s.mode?e(["preview","edit"]):e(["auto"])}},{key:"setAttributes",value:function t(e){this.props.setAttributes(e)}},{key:"render",value:function t(){function e(){c({mode:"preview"===s?"edit":"preview"})}var n=this.props,r=n.name,i=n.attributes,a=n.isSelected,c=n.setAttributes,s=i.mode,l=o(r),u=wp.element.Fragment,p=wp.editor,f=p.BlockControls,y=p.InspectorControls,m=wp.components,b=m.Toolbar,v=m.IconButton,_=m.PanelBody,g=m.Button,k=l.supports.mode;"auto"===s&&(k=!1);var w="preview"===s?acf.__("Switch to Edit"):acf.__("Switch to Preview"),O="preview"===s?"edit":"welcome-view-site";return React.createElement(u,null,React.createElement(f,null,k&&React.createElement(b,null,React.createElement(v,{className:"components-icon-button components-toolbar__control",label:w,icon:O,onClick:e}))),React.createElement(y,null,React.createElement("div",{className:"acf-block-component acf-block-panel"},React.createElement("div",{className:"acf-block-panel-actions"}),"preview"===s&&React.createElement(d,this.props))),React.createElement("div",{className:"acf-block-component acf-block-body"},"auto"===s&&a?React.createElement(d,this.props):"auto"!==s||a?"preview"===s?React.createElement(h,this.props):React.createElement(d,this.props):React.createElement(h,this.props)))}}]),e}(React.Component),u=function(t){function e(){return _classCallCheck(this,e),_possibleConstructorReturn(this,_getPrototypeOf(e).apply(this,arguments))}return _inherits(e,t),_createClass(e,[{key:"render",value:function t(){return React.createElement("div",{dangerouslySetInnerHTML:{__html:this.props.html}})}}]),e}(React.Component),p={},f=function(e){function n(t){var e;return _classCallCheck(this,n),(e=_possibleConstructorReturn(this,_getPrototypeOf(n).call(this,t))).setup(t),e.data=e.getData({html:"",$el:!1,init:!1}),e}return _inherits(n,e),_createClass(n,[{key:"setup",value:function t(e){this.id=""}},{key:"getData",value:function t(e){return p[this.id]||e}},{key:"setData",value:function t(e){this.data=p[this.id]=_objectSpread({},this.data,{},e)}},{key:"setHtml",value:function e(n){var r;if((n=n.trim())!==this.datahtml){var o=t(n);this.setData((_defineProperty(r={html:n,$el:o},"$el",o),_defineProperty(r,"init",!1),r)),this.display()}}},{key:"render",value:function t(){var e=this,n=wp.components,r=n.Placeholder,o=n.Spinner;return React.createElement("div",{ref:function t(n){return e.el=n}},React.createElement(r,null,React.createElement(o,null)))}},{key:"display",value:function e(){t(this.el).html(this.data.$el),this.data.init?this.componentDidRemount():(this.setData({init:!0}),this.componentDidInitialize()),this.componentDidRender()}},{key:"componentDidMount",value:function t(){var e=!!this.data.$el;this.props.reusableBlock&&(e=!1),e?this.display():this.fetch()}},{key:"componentDidInitialize",value:function t(){acf.doAction("append",this.data.$el)}},{key:"componentWillUnmount",value:function t(){acf.doAction("unmount",this.data.$el)}},{key:"componentDidRemount",value:function t(){var e=this;setTimeout(function(){acf.doAction("remount",e.data.$el)})}},{key:"componentDidRender",value:function t(){}},{key:"fetch",value:function t(){}}]),n}(React.Component),d=function(t){function n(){return _classCallCheck(this,n),_possibleConstructorReturn(this,_getPrototypeOf(n).apply(this,arguments))}return _inherits(n,t),_createClass(n,[{key:"setup",value:function t(e){this.id="BlockForm-".concat(e.attributes.id)}},{key:"fetch",value:function t(){var e=this,n;a(this.props.attributes,{form:!0}).done(function(t){e.setHtml(t.data.form)})}},{key:"componentDidInitialize",value:function t(){function r(t){var n=arguments.length>0&&t!==e&&t,r=acf.serialize(c,"acf-".concat(i.id));n?i.data=r:a({data:r})}_get(_getPrototypeOf(n.prototype),"componentDidInitialize",this).call(this);var o=this.props,i=o.attributes,a=o.setAttributes,c=this.data.$el,s=!1;c.on("change keyup",function(){clearTimeout(s),s=setTimeout(r,300)}),i.data||r(!0)}}]),n}(f),h=function(t){function e(){return _classCallCheck(this,e),_possibleConstructorReturn(this,_getPrototypeOf(e).apply(this,arguments))}return _inherits(e,t),_createClass(e,[{key:"setup",value:function t(e){this.id="BlockPreview-".concat(e.attributes.id)}},{key:"fetch",value:function t(){var e=this,n=this.props.attributes;this.setData({attributes:n}),a(n,{preview:!0}).done(function(t){e.setHtml(t.data.preview)})}},{key:"componentDidUpdate",value:function t(e){var n,r;JSON.stringify(e.attributes)!==JSON.stringify(this.props.attributes)&&this.fetch()}},{key:"componentDidInitialize",value:function t(){_get(_getPrototypeOf(e.prototype),"componentDidInitialize",this).call(this);var n=this.props.attributes,r=n.name.replace("acf/","");acf.doAction("render_block_preview",this.data.$el,n),acf.doAction("render_block_preview/type=".concat(r),this.data.$el,n)}},{key:"componentDidRemount",value:function t(){var n,r;_get(_getPrototypeOf(e.prototype),"componentDidRemount",this).call(this),JSON.stringify(this.data.attributes)!==JSON.stringify(this.props.attributes)&&this.fetch()}}]),e}(f)}(jQuery);