2 lines
4.5 KiB
JavaScript
2 lines
4.5 KiB
JavaScript
/*! This file is auto-generated */
|
|
this.wp=this.wp||{},this.wp.serverSideRender=function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s="./node_modules/@wordpress/server-side-render/build-module/index.js")}({"./node_modules/@babel/runtime/helpers/esm/extends.js":function(e,r,t){"use strict";function n(){return(n=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}t.d(r,"a",(function(){return n}))},"./node_modules/@wordpress/server-side-render/build-module/index.js":function(e,r,t){"use strict";t.r(r);var n=t("./node_modules/@babel/runtime/helpers/esm/extends.js"),o=t("@wordpress/element"),s=t("@wordpress/data"),c=t("@wordpress/deprecated"),u=t.n(c),l=t("lodash"),d=t("@wordpress/compose"),i=t("@wordpress/i18n"),a=t("@wordpress/api-fetch"),p=t.n(a),w=t("@wordpress/url"),f=t("@wordpress/components"),b=t("@wordpress/blocks");function m({className:e}){return Object(o.createElement)(f.Placeholder,{className:e},Object(i.__)("Block rendered as empty."))}function j({response:e,className:r}){const t=Object(i.sprintf)(Object(i.__)("Error loading block: %s"),e.errorMsg);return Object(o.createElement)(f.Placeholder,{className:r},t)}function O({className:e}){return Object(o.createElement)(f.Placeholder,{className:e},Object(o.createElement)(f.Spinner,null))}function h(e){const{attributes:r,block:t,className:s,httpMethod:c="GET",urlQueryArgs:u,EmptyResponsePlaceholder:i=m,ErrorResponsePlaceholder:a=j,LoadingResponsePlaceholder:f=O}=e,h=Object(o.useRef)(!0),v=Object(o.useRef)(),[y,x]=Object(o.useState)(null),g=Object(d.usePrevious)(e);function E(){if(!h.current)return;null!==y&&x(null);const e=r&&Object(b.__experimentalSanitizeBlockAttributes)(t,r),n="POST"===c,o=function(e,r=null,t={}){return Object(w.addQueryArgs)("/wp/v2/block-renderer/"+e,{context:"edit",...null!==r?{attributes:r}:{},...t})}(t,n?null:null!=e?e:null,u),s=n?{attributes:null!=e?e:null}:null,l=v.current=p()({path:o,data:s,method:n?"POST":"GET"}).then(e=>{h.current&&l===v.current&&e&&x(e.rendered)}).catch(e=>{h.current&&l===v.current&&x({error:!0,errorMsg:e.message})});return l}const P=Object(d.useDebounce)(E,500);return Object(o.useEffect)(()=>()=>{h.current=!1},[]),Object(o.useEffect)(()=>{void 0===g?E():Object(l.isEqual)(g,e)||P()}),""===y?Object(o.createElement)(i,e):y?y.error?Object(o.createElement)(a,Object(n.a)({response:y},e)):Object(o.createElement)(o.RawHTML,{className:s},y):Object(o.createElement)(f,e)}const v={},y=Object(s.withSelect)(e=>{const r=e("core/editor");if(r){const e=r.getCurrentPostId();if(e&&"number"==typeof e)return{currentPostId:e}}return v})(({urlQueryArgs:e=v,currentPostId:r,...t})=>{const s=Object(o.useMemo)(()=>r?{post_id:r,...e}:e,[r,e]);return Object(o.createElement)(h,Object(n.a)({urlQueryArgs:s},t))});window&&window.wp&&window.wp.components&&(window.wp.components.ServerSideRender=Object(o.forwardRef)((e,r)=>(u()("wp.components.ServerSideRender",{since:"5.3",alternative:"wp.serverSideRender"}),Object(o.createElement)(y,Object(n.a)({},e,{ref:r})))));r.default=y},"@wordpress/api-fetch":function(e,r){e.exports=window.wp.apiFetch},"@wordpress/blocks":function(e,r){e.exports=window.wp.blocks},"@wordpress/components":function(e,r){e.exports=window.wp.components},"@wordpress/compose":function(e,r){e.exports=window.wp.compose},"@wordpress/data":function(e,r){e.exports=window.wp.data},"@wordpress/deprecated":function(e,r){e.exports=window.wp.deprecated},"@wordpress/element":function(e,r){e.exports=window.wp.element},"@wordpress/i18n":function(e,r){e.exports=window.wp.i18n},"@wordpress/url":function(e,r){e.exports=window.wp.url},lodash:function(e,r){e.exports=window.lodash}}).default; |