advanced-custom-fields-pro/assets/build/js/pro/acf-pro-blocks.min.js

1 line
26 KiB
JavaScript

"use strict";function _typeof(e){return(_typeof="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 _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){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 _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o=[],a=!0,l=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){l=!0,i=e}finally{try{a||null==r.return||r.return()}finally{if(l)throw i}}return o}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _get(e,t,r){return(_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){e=_superPropBase(e,t);if(e){t=Object.getOwnPropertyDescriptor(e,t);return t.get?t.get.call(r):t.value}})(e,t,r||e)}function _superPropBase(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=_getPrototypeOf(e)););return e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),e}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(r){var n=_isNativeReflectConstruct();return function(){var e,t=_getPrototypeOf(r);return _possibleConstructorReturn(this,n?(e=_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function _possibleConstructorReturn(e,t){return!t||"object"!==_typeof(t)&&"function"!=typeof t?_assertThisInitialized(e):t}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ownKeys(t,e){var r,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(r),!0).forEach(function(e){_defineProperty(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}jQuery,acf.jsxNameReplacements={"accent-height":"accentHeight",accentheight:"accentHeight","accept-charset":"acceptCharset",acceptcharset:"acceptCharset",accesskey:"accessKey","alignment-baseline":"alignmentBaseline",alignmentbaseline:"alignmentBaseline",allowedblocks:"allowedBlocks",allowfullscreen:"allowFullScreen",allowreorder:"allowReorder","arabic-form":"arabicForm",arabicform:"arabicForm",attributename:"attributeName",attributetype:"attributeType",autocapitalize:"autoCapitalize",autocomplete:"autoComplete",autocorrect:"autoCorrect",autofocus:"autoFocus",autoplay:"autoPlay",autoreverse:"autoReverse",autosave:"autoSave",basefrequency:"baseFrequency","baseline-shift":"baselineShift",baselineshift:"baselineShift",baseprofile:"baseProfile",calcmode:"calcMode","cap-height":"capHeight",capheight:"capHeight",cellpadding:"cellPadding",cellspacing:"cellSpacing",charset:"charSet",class:"className",classid:"classID",classname:"className","clip-path":"clipPath","clip-rule":"clipRule",clippath:"clipPath",clippathunits:"clipPathUnits",cliprule:"clipRule","color-interpolation":"colorInterpolation","color-interpolation-filters":"colorInterpolationFilters","color-profile":"colorProfile","color-rendering":"colorRendering",colorinterpolation:"colorInterpolation",colorinterpolationfilters:"colorInterpolationFilters",colorprofile:"colorProfile",colorrendering:"colorRendering",colspan:"colSpan",contenteditable:"contentEditable",contentscripttype:"contentScriptType",contentstyletype:"contentStyleType",contextmenu:"contextMenu",controlslist:"controlsList",crossorigin:"crossOrigin",dangerouslysetinnerhtml:"dangerouslySetInnerHTML",datetime:"dateTime",defaultchecked:"defaultChecked",defaultvalue:"defaultValue",diffuseconstant:"diffuseConstant",disablepictureinpicture:"disablePictureInPicture",disableremoteplayback:"disableRemotePlayback","dominant-baseline":"dominantBaseline",dominantbaseline:"dominantBaseline",edgemode:"edgeMode","enable-background":"enableBackground",enablebackground:"enableBackground",enctype:"encType",enterkeyhint:"enterKeyHint",externalresourcesrequired:"externalResourcesRequired","fill-opacity":"fillOpacity","fill-rule":"fillRule",fillopacity:"fillOpacity",fillrule:"fillRule",filterres:"filterRes",filterunits:"filterUnits","flood-color":"floodColor","flood-opacity":"floodOpacity",floodcolor:"floodColor",floodopacity:"floodOpacity","font-family":"fontFamily","font-size":"fontSize","font-size-adjust":"fontSizeAdjust","font-stretch":"fontStretch","font-style":"fontStyle","font-variant":"fontVariant","font-weight":"fontWeight",fontfamily:"fontFamily",fontsize:"fontSize",fontsizeadjust:"fontSizeAdjust",fontstretch:"fontStretch",fontstyle:"fontStyle",fontvariant:"fontVariant",fontweight:"fontWeight",for:"htmlFor",formaction:"formAction",formenctype:"formEncType",formmethod:"formMethod",formnovalidate:"formNoValidate",formtarget:"formTarget",frameborder:"frameBorder","glyph-name":"glyphName","glyph-orientation-horizontal":"glyphOrientationHorizontal","glyph-orientation-vertical":"glyphOrientationVertical",glyphname:"glyphName",glyphorientationhorizontal:"glyphOrientationHorizontal",glyphorientationvertical:"glyphOrientationVertical",glyphref:"glyphRef",gradienttransform:"gradientTransform",gradientunits:"gradientUnits","horiz-adv-x":"horizAdvX","horiz-origin-x":"horizOriginX",horizadvx:"horizAdvX",horizoriginx:"horizOriginX",hreflang:"hrefLang",htmlfor:"htmlFor","http-equiv":"httpEquiv",httpequiv:"httpEquiv","image-rendering":"imageRendering",imagerendering:"imageRendering",innerhtml:"innerHTML",inputmode:"inputMode",itemid:"itemID",itemprop:"itemProp",itemref:"itemRef",itemscope:"itemScope",itemtype:"itemType",kernelmatrix:"kernelMatrix",kernelunitlength:"kernelUnitLength",keyparams:"keyParams",keypoints:"keyPoints",keysplines:"keySplines",keytimes:"keyTimes",keytype:"keyType",lengthadjust:"lengthAdjust","letter-spacing":"letterSpacing",letterspacing:"letterSpacing","lighting-color":"lightingColor",lightingcolor:"lightingColor",limitingconeangle:"limitingConeAngle",marginheight:"marginHeight",marginwidth:"marginWidth","marker-end":"markerEnd","marker-mid":"markerMid","marker-start":"markerStart",markerend:"markerEnd",markerheight:"markerHeight",markermid:"markerMid",markerstart:"markerStart",markerunits:"markerUnits",markerwidth:"markerWidth",maskcontentunits:"maskContentUnits",maskunits:"maskUnits",maxlength:"maxLength",mediagroup:"mediaGroup",minlength:"minLength",nomodule:"noModule",novalidate:"noValidate",numoctaves:"numOctaves","overline-position":"overlinePosition","overline-thickness":"overlineThickness",overlineposition:"overlinePosition",overlinethickness:"overlineThickness","paint-order":"paintOrder",paintorder:"paintOrder","panose-1":"panose1",pathlength:"pathLength",patterncontentunits:"patternContentUnits",patterntransform:"patternTransform",patternunits:"patternUnits",playsinline:"playsInline","pointer-events":"pointerEvents",pointerevents:"pointerEvents",pointsatx:"pointsAtX",pointsaty:"pointsAtY",pointsatz:"pointsAtZ",preservealpha:"preserveAlpha",preserveaspectratio:"preserveAspectRatio",primitiveunits:"primitiveUnits",radiogroup:"radioGroup",readonly:"readOnly",referrerpolicy:"referrerPolicy",refx:"refX",refy:"refY","rendering-intent":"renderingIntent",renderingintent:"renderingIntent",repeatcount:"repeatCount",repeatdur:"repeatDur",requiredextensions:"requiredExtensions",requiredfeatures:"requiredFeatures",rowspan:"rowSpan","shape-rendering":"shapeRendering",shaperendering:"shapeRendering",specularconstant:"specularConstant",specularexponent:"specularExponent",spellcheck:"spellCheck",spreadmethod:"spreadMethod",srcdoc:"srcDoc",srclang:"srcLang",srcset:"srcSet",startoffset:"startOffset",stddeviation:"stdDeviation",stitchtiles:"stitchTiles","stop-color":"stopColor","stop-opacity":"stopOpacity",stopcolor:"stopColor",stopopacity:"stopOpacity","strikethrough-position":"strikethroughPosition","strikethrough-thickness":"strikethroughThickness",strikethroughposition:"strikethroughPosition",strikethroughthickness:"strikethroughThickness","stroke-dasharray":"strokeDasharray","stroke-dashoffset":"strokeDashoffset","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","stroke-miterlimit":"strokeMiterlimit","stroke-opacity":"strokeOpacity","stroke-width":"strokeWidth",strokedasharray:"strokeDasharray",strokedashoffset:"strokeDashoffset",strokelinecap:"strokeLinecap",strokelinejoin:"strokeLinejoin",strokemiterlimit:"strokeMiterlimit",strokeopacity:"strokeOpacity",strokewidth:"strokeWidth",suppresscontenteditablewarning:"suppressContentEditableWarning",suppresshydrationwarning:"suppressHydrationWarning",surfacescale:"surfaceScale",systemlanguage:"systemLanguage",tabindex:"tabIndex",tablevalues:"tableValues",targetx:"targetX",targety:"targetY",templatelock:"templateLock","text-anchor":"textAnchor","text-decoration":"textDecoration","text-rendering":"textRendering",textanchor:"textAnchor",textdecoration:"textDecoration",textlength:"textLength",textrendering:"textRendering","underline-position":"underlinePosition","underline-thickness":"underlineThickness",underlineposition:"underlinePosition",underlinethickness:"underlineThickness","unicode-bidi":"unicodeBidi","unicode-range":"unicodeRange",unicodebidi:"unicodeBidi",unicoderange:"unicodeRange","units-per-em":"unitsPerEm",unitsperem:"unitsPerEm",usemap:"useMap","v-alphabetic":"vAlphabetic","v-hanging":"vHanging","v-ideographic":"vIdeographic","v-mathematical":"vMathematical",valphabetic:"vAlphabetic","vector-effect":"vectorEffect",vectoreffect:"vectorEffect","vert-adv-y":"vertAdvY","vert-origin-x":"vertOriginX","vert-origin-y":"vertOriginY",vertadvy:"vertAdvY",vertoriginx:"vertOriginX",vertoriginy:"vertOriginY",vhanging:"vHanging",videographic:"vIdeographic",viewbox:"viewBox",viewtarget:"viewTarget",vmathematical:"vMathematical","word-spacing":"wordSpacing",wordspacing:"wordSpacing","writing-mode":"writingMode",writingmode:"writingMode","x-height":"xHeight",xchannelselector:"xChannelSelector",xheight:"xHeight","xlink:actuate":"xlinkActuate","xlink:arcrole":"xlinkArcrole","xlink:href":"xlinkHref","xlink:role":"xlinkRole","xlink:show":"xlinkShow","xlink:title":"xlinkTitle","xlink:type":"xlinkType",xlinkactuate:"xlinkActuate",xlinkarcrole:"xlinkArcrole",xlinkhref:"xlinkHref",xlinkrole:"xlinkRole",xlinkshow:"xlinkShow",xlinktitle:"xlinkTitle",xlinktype:"xlinkType","xml:base":"xmlBase","xml:lang":"xmlLang","xml:space":"xmlSpace",xmlbase:"xmlBase",xmllang:"xmlLang","xmlns:xlink":"xmlnsXlink",xmlnsxlink:"xmlnsXlink",xmlspace:"xmlSpace",ychannelselector:"yChannelSelector",zoomandpan:"zoomAndPan"},function(o,u){var e=wp.blockEditor,p=e.BlockControls,a=e.InspectorControls,t=e.InnerBlocks,f=e.useBlockProps,r=wp.components,l=r.ToolbarGroup,c=r.ToolbarButton,i=r.Placeholder,s=r.Spinner,h=wp.element.Fragment,d=React.Component,e=wp.data.withSelect,r=wp.compose.createHigherOrderComponent,m={};function g(e){return m[e]||!1}function y(e){var t=e.attributes,r=e.clientId;return function(r){var e=function(e){return"core/block-editor"!==e?wp.data.select(e):wp.data.select("core/block-editor")||wp.data.select("core/editor")}("core/block-editor").getBlocks(),t=0;for(;t<e.length;)e=e.concat(e[t].innerBlocks),t++;for(var n in r)!function(t){e=e.filter(function(e){return e.attributes[t]===r[t]})}(n);return e}().filter(function(e){return e.attributes.id===t.id}).filter(function(e){return e.clientId!==r}).length}function n(t){var e=t.post_types||[];if(e.length){e.push("wp_block");var r=acf.get("postType");if(!e.includes(r))return!1}"string"==typeof t.icon&&"<svg"===t.icon.substr(0,4)&&(o=t.icon,t.icon=React.createElement(O,null,o)),t.icon||delete t.icon,wp.blocks.getCategories().filter(function(e){return e.slug===t.category}).pop()||(t.category="common");var n,i,o,a,l,r={id:{type:"string"},name:{type:"string"},data:{type:"object"},align:{type:"string"},mode:{type:"string"},wpClassName:{type:"string"}},c=C,s=R;t.supports.align_text&&((o=r).align_text={type:"string"},r=o,n=c,i=M,(o=t).align_text=i(o.align_text),c=function(){_inherits(t,d);var e=_createSuper(t);function t(){return _classCallCheck(this,t),e.apply(this,arguments)}return _createClass(t,[{key:"render",value:function(){var e=this.props,t=e.attributes,r=e.setAttributes,t=t.align_text;return React.createElement(h,null,React.createElement(p,{group:"block"},React.createElement(H,{value:i(t),onChange:function(e){r({align_text:i(e)})}})),React.createElement(n,this.props))}}]),t}()),t.supports.align_content&&((l=r).align_content={type:"string"},r=l,c=function(n,e){var i,o,t=e.supports.align_content;o="matrix"===t?(i=L||z,D):(i=I,B);return i!==u?(e.align_content=o(e.align_content),function(){_inherits(t,d);var e=_createSuper(t);function t(){return _classCallCheck(this,t),e.apply(this,arguments)}return _createClass(t,[{key:"render",value:function(){var e=this.props,t=e.attributes,r=e.setAttributes,t=t.align_content;return React.createElement(h,null,React.createElement(p,{group:"block"},React.createElement(i,{label:acf.__("Change content alignment"),value:o(t),onChange:function(e){r({align_content:o(e)})}})),React.createElement(n,this.props))}}]),t}()):(console.warn('The "'.concat(t,'" alignment component was not found.')),n)}(c,t)),t.supports.full_height&&((l=r).full_height={type:"boolean"},r=l,a=c,c=N?function(){_inherits(t,d);var e=_createSuper(t);function t(){return _classCallCheck(this,t),e.apply(this,arguments)}return _createClass(t,[{key:"render",value:function(){var e=this.props,t=e.attributes,r=e.setAttributes,t=t.full_height;return React.createElement(h,null,React.createElement(p,{group:"block"},React.createElement(N,{isActive:t,onToggle:function(e){r({full_height:e})}})),React.createElement(a,this.props))}}]),t}():a),t=acf.parseArgs(t,{title:"",name:"",category:"",attributes:r,apiVersion:2,edit:function(e){return React.createElement(c,e)},save:function(e){e=f.save(e);return e.className&&(e.attributes.wpClassName=e.className),React.createElement(s,e)}}),m[t.name]=t;r=wp.blocks.registerBlockType(t.name,t);return r.attributes.anchor&&(r.attributes.anchor={type:"string"}),r}var k={};function v(e){var t=e.attributes,r=void 0===t?{}:t,t=e.query,t=void 0===t?{}:t,e=e.delay,e=void 0===e?0:e,n=r.id,i=k[n]||{query:{},timeout:!1,promise:o.Deferred()};return i.query=_objectSpread(_objectSpread({},i.query),t),clearTimeout(i.timeout),i.timeout=setTimeout(function(){o.ajax({url:acf.get("ajaxurl"),dataType:"json",type:"post",cache:!1,data:acf.prepareForAjax({action:"acf/ajax/fetch-block",block:JSON.stringify(r),query:i.query})}).always(function(){k[n]=null}).done(function(){i.promise.resolve.apply(this,arguments)}).fail(function(){i.promise.reject.apply(this,arguments)})},e),(k[n]=i).promise}function b(e,t){return JSON.stringify(e)===JSON.stringify(t)}function _(e){var t=acf.isget(acf,"jsxNameReplacements",e);return t||e}function x(e){switch(e){case"innerblocks":return t;case"script":return A;case"#comment":return null;default:e=_(e)}return e}function w(e){var t=e.name,r=e.value;switch(t){case"class":t="className";break;case"style":var n={};r.split(";").forEach(function(e){var t,r=e.indexOf(":");0<r&&(t=e.substr(0,r).trim(),r=e.substr(r+1).trim(),"-"!==t.charAt(0)&&(t=acf.strCamelCase(t)),n[t]=r)}),r=n;break;default:if(0===t.indexOf("data-"))break;var t=_(t),i=r.charAt(0);"true"!==(r="["===i||"{"===i?JSON.parse(r):r)&&"false"!==r||(r="true"===r)}return{name:t,value:r}}acf.parseJSX=function(e){return function r(e){var t=x(e.nodeName.toLowerCase());if(!t)return null;var n={};acf.arrayArgs(e.attributes).map(w).forEach(function(e){var t=e.name,e=e.value;n[t]=e});var i=[t,n];acf.arrayArgs(e.childNodes).forEach(function(e){var t;e instanceof Text?(t=e.textContent)&&i.push(t):i.push(r(e))});return React.createElement.apply(this,i)}(o(e)[0])};r=r(function(e){return function(){_inherits(c,d);var l=_createSuper(c);function c(e){_classCallCheck(this,c);var t,r,n=(t=l.call(this,e)).props,i=n.name,o=n.attributes,a=g(i);if(!a)return _possibleConstructorReturn(t);if(e.attributes.id)return y(e)?(o.id=acf.uniqid("block_"),_possibleConstructorReturn(t)):t;for(r in o.id=acf.uniqid("block_"),a.attributes)o[r]===u&&a[r]!==u&&(o[r]=a[r]);return _possibleConstructorReturn(t)}return _createClass(c,[{key:"render",value:function(){return React.createElement(e,this.props)}}]),c}()},"withDefaultAttributes");function R(){return React.createElement(t.Content,null)}wp.hooks.addFilter("editor.BlockListBlock","acf/with-default-attributes",r);var C=function(){_inherits(r,d);var t=_createSuper(r);function r(e){return _classCallCheck(this,r),(e=t.call(this,e)).setup(),e}return _createClass(r,[{key:"setup",value:function(){var e=this.props,t=e.name,r=e.attributes;function n(e){e.includes(r.mode)||(r.mode=e[0])}switch(g(t).mode){case"edit":n(["edit","preview"]);break;case"preview":n(["preview","edit"]);break;default:n(["auto"])}}},{key:"render",value:function(){var e=this.props,t=e.name,r=e.attributes,n=e.setAttributes,i=r.mode,r=g(t).supports.mode;"auto"===i&&(r=!1);t="preview"===i?acf.__("Switch to Edit"):acf.__("Switch to Preview");return React.createElement(h,null,React.createElement(p,null,r&&React.createElement(l,null,React.createElement(c,{className:"components-icon-button components-toolbar__control",label:t,icon:"preview"===i?"edit":"welcome-view-site",onClick:function(){n({mode:"preview"===i?"edit":"preview"})}}))),React.createElement(a,null,"preview"===i&&React.createElement("div",{className:"acf-block-component acf-block-panel"},React.createElement(T,this.props))),React.createElement(S,this.props))}}]),r}();var S=e(function(e,t){var r=t.clientId,t=e("core/block-editor").getBlockRootClientId(r);return{index:e("core/block-editor").getBlockIndex(r,t)}})(function(e){var t=f(),r=e.attributes,n=e.isSelected,r=r.mode;return React.createElement("div",t,React.createElement("div",{className:"acf-block-component acf-block-body"},!("auto"===r&&n||("auto"!==r||n)&&"preview"!==r)?React.createElement(j,e):React.createElement(T,e)))}),O=function(){_inherits(t,d);var e=_createSuper(t);function t(){return _classCallCheck(this,t),e.apply(this,arguments)}return _createClass(t,[{key:"render",value:function(){return React.createElement("div",{dangerouslySetInnerHTML:{__html:this.props.children}})}}]),t}(),A=function(){_inherits(t,d);var e=_createSuper(t);function t(){return _classCallCheck(this,t),e.apply(this,arguments)}return _createClass(t,[{key:"render",value:function(){var t=this;return React.createElement("div",{ref:function(e){return t.el=e}})}},{key:"setHTML",value:function(e){o(this.el).html("<script>".concat(e,"<\/script>"))}},{key:"componentDidUpdate",value:function(){this.setHTML(this.props.children)}},{key:"componentDidMount",value:function(){this.setHTML(this.props.children)}}]),t}(),E={},P=function(){_inherits(n,d);var r=_createSuper(n);function n(e){var t;return _classCallCheck(this,n),(t=r.call(this,e)).setRef=t.setRef.bind(_assertThisInitialized(t)),t.id="",t.el=!1,t.subscribed=!0,t.renderMethod="jQuery",t.setup(e),t.loadState(),t}return _createClass(n,[{key:"setup",value:function(e){}},{key:"fetch",value:function(){}},{key:"maybePreload",value:function(e){if(this.state.html===u){var t=acf.get("preloadedBlocks");if(t&&t[e])return this.setHtml(t[e]),delete t[e],acf.set("preloadedBlocks",t),!0}return!1}},{key:"loadState",value:function(){this.state=E[this.id]||{}}},{key:"setState",value:function(e){E[this.id]=_objectSpread(_objectSpread({},this.state),e),this.subscribed&&_get(_getPrototypeOf(n.prototype),"setState",this).call(this,e)}},{key:"setHtml",value:function(e){var t;(e=e?e.trim():"")!==this.state.html&&(t={html:e},"jsx"===this.renderMethod?(t.jsx=acf.parseJSX(e),t.$el=o(this.el)):t.$el=o(e),this.setState(t))}},{key:"setRef",value:function(e){this.el=e}},{key:"render",value:function(){return this.state.jsx?React.createElement("div",{ref:this.setRef},this.state.jsx):React.createElement("div",{ref:this.setRef},React.createElement(i,null,React.createElement(s,null)))}},{key:"shouldComponentUpdate",value:function(e,t){e=e.index,t=t.html;return e!==this.props.index&&this.componentWillMove(),t!==this.state.html}},{key:"display",value:function(e){var t,r,n;switch("jQuery"===this.renderMethod&&(r=(t=this.state.$el).parent(),(n=o(this.el)).html(t),r.length&&r[0]!==n[0]&&r.html(t.clone())),e){case"append":this.componentDidAppend();break;case"remount":this.componentDidRemount()}}},{key:"componentDidMount",value:function(){this.state.html===u?this.fetch():this.display("remount")}},{key:"componentDidUpdate",value:function(e,t){this.display("append")}},{key:"componentDidAppend",value:function(){acf.doAction("append",this.state.$el)}},{key:"componentWillUnmount",value:function(){acf.doAction("unmount",this.state.$el),this.subscribed=!1}},{key:"componentDidRemount",value:function(){var e=this;this.subscribed=!0,setTimeout(function(){acf.doAction("remount",e.state.$el)})}},{key:"componentWillMove",value:function(){var e=this;acf.doAction("unmount",this.state.$el),setTimeout(function(){acf.doAction("remount",e.state.$el)})}}]),n}(),T=function(){_inherits(a,P);var e=_createSuper(a);function a(){return _classCallCheck(this,a),e.apply(this,arguments)}return _createClass(a,[{key:"setup",value:function(e){e=e.attributes;this.id="BlockForm-".concat(e.id)}},{key:"fetch",value:function(){var t=this,e=this.props.attributes;this.maybePreload(e.id)||v({attributes:e,query:{form:!0}}).done(function(e){e=e.data;t.setHtml(e.form)})}},{key:"componentDidAppend",value:function(){_get(_getPrototypeOf(a.prototype),"componentDidAppend",this).call(this);var e=this.props,r=e.attributes,n=e.setAttributes,i=(this.props,this.state.$el);function t(){var e=0<arguments.length&&arguments[0]!==u&&arguments[0],t=acf.serialize(i,"acf-".concat(r.id));e?r.data=t:n({data:t})}var o=!1;i.on("change keyup",function(){clearTimeout(o),o=setTimeout(t,300)}),r.data||t(!0)}}]),a}(),j=function(){_inherits(o,P);var e=_createSuper(o);function o(){return _classCallCheck(this,o),e.apply(this,arguments)}return _createClass(o,[{key:"setup",value:function(e){var t=e.attributes,e=e.name;this.id="BlockPreview-".concat(t.id),g(e).supports.jsx&&(this.renderMethod="jsx")}},{key:"fetch",value:function(){var t=this,e=0<arguments.length&&arguments[0]!==u?arguments[0]:{},r=e.attributes,r=void 0===r?this.props.attributes:r,e=e.delay,e=void 0===e?0:e;this.setState({prevAttributes:r}),this.maybePreload(r.id)||v({attributes:r,query:{preview:!0},delay:e}).done(function(e){e=e.data;t.setHtml(e.preview)})}},{key:"componentDidAppend",value:function(){_get(_getPrototypeOf(o.prototype),"componentDidAppend",this).call(this);var e=this.props.attributes,t=this.state.$el,r=e.name.replace("acf/","");acf.doAction("render_block_preview",t,e),acf.doAction("render_block_preview/type=".concat(r),t,e)}},{key:"shouldComponentUpdate",value:function(e,t){var r,n=e.attributes,i=this.props.attributes;return b(n,i)||(r=0,n.className!==i.className&&(r=300),n.anchor!==i.anchor&&(r=300),this.fetch({attributes:n,delay:r})),_get(_getPrototypeOf(o.prototype),"shouldComponentUpdate",this).call(this,e,t)}},{key:"componentDidRemount",value:function(){_get(_getPrototypeOf(o.prototype),"componentDidRemount",this).call(this),b(this.state.prevAttributes,this.props.attributes)||this.fetch()}}]),o}();function B(e){return["top","center","bottom"].includes(e)?e:"top"}function M(e){var t=acf.get("rtl")?"right":"left";return["left","center","right"].includes(e)?e:t}function D(e){if(e){var t=_slicedToArray(e.split(" "),2),e=t[0],t=t[1];return"".concat(B(e)," ").concat(M(t))}return"center center"}acf.addAction("prepare",function(){wp.blockEditor||(wp.blockEditor=wp.editor);var e=acf.get("blockTypes");e&&e.map(n)});var e=wp.blockEditor,H=e.AlignmentToolbar,I=e.BlockVerticalAlignmentToolbar,z=wp.blockEditor.__experimentalBlockAlignmentMatrixToolbar||wp.blockEditor.BlockAlignmentMatrixToolbar,L=wp.blockEditor.__experimentalBlockAlignmentMatrixControl||wp.blockEditor.BlockAlignmentMatrixControl,N=wp.blockEditor.__experimentalBlockFullHeightAligmentControl||wp.blockEditor.__experimentalBlockFullHeightAlignmentControl||wp.blockEditor.BlockFullHeightAlignmentControl}(jQuery);