!function(){"use strict";var e={252:function(e){e.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var n,o,s;if(Array.isArray(t)){if((n=t.length)!=r.length)return!1;for(o=n;0!==o--;)if(!e(t[o],r[o]))return!1;return!0}if(t instanceof Map&&r instanceof Map){if(t.size!==r.size)return!1;for(o of t.entries())if(!r.has(o[0]))return!1;for(o of t.entries())if(!e(o[1],r.get(o[0])))return!1;return!0}if(t instanceof Set&&r instanceof Set){if(t.size!==r.size)return!1;for(o of t.entries())if(!r.has(o[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(r)){if((n=t.length)!=r.length)return!1;for(o=n;0!==o--;)if(t[o]!==r[o])return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((n=(s=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(o=n;0!==o--;)if(!Object.prototype.hasOwnProperty.call(r,s[o]))return!1;for(o=n;0!==o--;){var a=s[o];if(!e(t[a],r[a]))return!1}return!0}return t!=t&&r!=r}},20:function(e,t,r){var n=r(594),o=Symbol.for("react.element"),s=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,u=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function c(e,t,r){var n,s={},c=null,l=null;for(n in void 0!==r&&(c=""+r),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(l=t.ref),t)a.call(t,n)&&!i.hasOwnProperty(n)&&(s[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===s[n]&&(s[n]=t[n]);return{$$typeof:o,type:e,key:c,ref:l,props:s,_owner:u.current}}t.jsx=c,t.jsxs=c},848:function(e,t,r){e.exports=r(20)},594:function(e){e.exports=React}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,r),s.exports}r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.dn=function(e){(Object.getOwnPropertyDescriptor(e,"name")||{}).writable||Object.defineProperty(e,"name",{value:"default",configurable:!0})};const n=lodash,o=wp.blocks,s=wp.i18n,a=wp.blockEditor,u=wp.components,i=wp.element,c=wp.data;var l=r(252),f=r.n(l);const p=wp.compose,d=wp.apiFetch;var y=r.n(d);const h=wp.url;var m=r(848);const b={};function _({className:e}){return(0,m.jsx)(u.Placeholder,{className:e,children:(0,s.__)("Block rendered as empty.")})}function g({response:e,className:t}){const r=(0,s.sprintf)((0,s.__)("Error loading block: %s"),e.errorMsg);return(0,m.jsx)(u.Placeholder,{className:t,children:r})}function v({children:e,showLoader:t}){return(0,m.jsxs)("div",{style:{position:"relative"},children:[t&&(0,m.jsx)("div",{style:{position:"absolute",top:"50%",left:"50%",marginTop:"-9px",marginLeft:"-9px"},children:(0,m.jsx)(u.Spinner,{})}),(0,m.jsx)("div",{style:{opacity:t?"0.3":1},children:e})]})}function x(e){const{className:t,EmptyResponsePlaceholder:r=_,ErrorResponsePlaceholder:n=g,LoadingResponsePlaceholder:s=v}=e,a=(0,i.useRef)(!1),[u,c]=(0,i.useState)(!1),l=(0,i.useRef)(),[d,x]=(0,i.useState)(null),w=(0,p.usePrevious)(e),[k,j]=(0,i.useState)(!1),O=(0,i.useRef)(e);(0,i.useLayoutEffect)(()=>{O.current=e},[e]);const S=(0,i.useCallback)(()=>{var e,t;if(!a.current)return;const{attributes:r,block:n,skipBlockSupportAttributes:s=!1,httpMethod:u="GET",urlQueryArgs:i}=O.current;j(!0);const f=setTimeout(()=>{c(!0)},1e3);let p=r&&(0,o.__experimentalSanitizeBlockAttributes)(n,r);s&&(p=function(e){const{backgroundColor:t,borderColor:r,fontFamily:n,fontSize:o,gradient:s,textColor:a,className:u,...i}=e,{border:c,color:l,elements:f,spacing:p,typography:d,...y}=e?.style||b;return{...i,style:y}}(p));const d="POST"===u,m=function(e,t=null,r={}){return(0,h.addQueryArgs)(`/wp/v2/block-renderer/${e}`,{context:"edit",...null!==t?{attributes:t}:{},...r})}(n,d?null:null!==(e=p)&&void 0!==e?e:null,i),_=d?{attributes:null!==(t=p)&&void 0!==t?t:null}:null,g=l.current=y()({path:m,data:_,method:d?"POST":"GET"}).then(e=>{a.current&&g===l.current&&e&&x(e.rendered)}).catch(e=>{a.current&&g===l.current&&x({error:!0,errorMsg:e.message})}).finally(()=>{a.current&&g===l.current&&(j(!1),c(!1),clearTimeout(f))});return g},[]),E=(0,p.useDebounce)(S,500);(0,i.useEffect)(()=>(a.current=!0,()=>{a.current=!1}),[]),(0,i.useEffect)(()=>{void 0===w?S():f()(w,e)||E()});const P=!!d,R=""===d,T=!!d?.error;return k?(0,m.jsx)(s,{...e,showLoader:u,children:P&&!T&&(0,m.jsx)(i.RawHTML,{className:t,children:d})}):R||!P?(0,m.jsx)(r,{...e}):T?(0,m.jsx)(n,{response:d,...e}):(0,m.jsx)(i.RawHTML,{className:t,children:d})}const w={},k=(0,c.withSelect)(e=>{const t=e("core/editor");if(t){const e=t.getCurrentPostId();if(e&&"number"==typeof e)return{currentPostId:e}}return w})(({urlQueryArgs:e=w,currentPostId:t,...r})=>{const n=(0,i.useMemo)(()=>t?{post_id:t,...e}:e,[t,e]);return(0,m.jsx)(x,{urlQueryArgs:n,...r})}),j=function(e){var t=e.attributes,r=e.setAttributes,o=(0,a.useBlockProps)(),i=[];return t.post_id||(t.post_id=rankMath.objectID,r({post_id:rankMath.objectID})),(0,n.forEach)(t,function(e,o){"post_id"!==o?"className"!==o&&i.push(wp.element.createElement(u.TextControl,{key:o,label:(0,s.__)((0,n.startCase)(o),"seo-by-rank-math"),value:t[o],type:"string",onChange:function(e){var t={};t[o]=e,r(t)},__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0})):i.push(wp.element.createElement(u.TextControl,{key:o,label:(0,s.__)((0,n.startCase)(o),"seo-by-rank-math"),value:t[o],type:"number",min:1,step:1,onChange:function(e){var t={};t[o]=e||rankMath.objectID,r(t)},__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0}))}),wp.element.createElement("div",o,wp.element.createElement(a.InspectorControls,null,wp.element.createElement(u.PanelBody,{title:(0,s.__)("Settings","seo-by-rank-math")},i)),wp.element.createElement(k,{block:"rank-math/rich-snippet",attributes:t}))};r.dn(j),(0,o.registerBlockType)("rank-math/rich-snippet",{edit:j})}();