/*! This file is auto-generated */ (()=>{"use strict";var e={d:(r,t)=>{for(var n in t)e.o(t,n)&&!e.o(r,n)&&Object.defineProperty(r,n,{enumerable:!0,get:t[n]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r)},r={};e.d(r,{default:()=>b});const t=window.wp.i18n;var n=function(e){const r=(e,t)=>{const{headers:n={}}=e;for(const a in n)if("x-wp-nonce"===a.toLowerCase()&&n[a]===r.nonce)return t(e);return t({...e,headers:{...n,"X-WP-Nonce":r.nonce}})};return r.nonce=e,r};var a=(e,r)=>{let t,n,a=e.path;return"string"==typeof e.namespace&&"string"==typeof e.endpoint&&(t=e.namespace.replace(/^\/|\/$/g,""),n=e.endpoint.replace(/^\//,""),a=n?t+"/"+n:t),delete e.namespace,delete e.endpoint,r({...e,path:a})};var o=e=>(r,t)=>a(r,(r=>{let n,a=r.url,o=r.path;return"string"==typeof o&&(n=e,-1!==e.indexOf("?")&&(o=o.replace("?","&")),o=o.replace(/^\//,""),"string"==typeof n&&-1!==n.indexOf("?")&&(o=o.replace("?","&")),a=n+o),t({...r,url:a})}));const s=window.wp.url;function i(e,r){if(r)return Promise.resolve(e.body);try{return Promise.resolve(new window.Response(JSON.stringify(e.body),{status:200,statusText:"OK",headers:e.headers}))}catch{return Object.entries(e.headers).forEach((([r,t])=>{"link"===r.toLowerCase()&&(e.headers[r]=t.replace(/<([^>]+)>/,((e,r)=>`<${encodeURI(r)}>`)))})),Promise.resolve(r?e.body:new window.Response(JSON.stringify(e.body),{status:200,statusText:"OK",headers:e.headers}))}}var c=function(e){const r=Object.fromEntries(Object.entries(e).map((([e,r])=>[(0,s.normalizePath)(e),r])));return(e,t)=>{const{parse:n=!0}=e;let a=e.path;if(!a&&e.url){const{rest_route:r,...t}=(0,s.getQueryArgs)(e.url);"string"==typeof r&&(a=(0,s.addQueryArgs)(r,t))}if("string"!=typeof a)return t(e);const o=e.method||"GET",c=(0,s.normalizePath)(a);if("GET"===o&&r[c]){const e=r[c];return delete r[c],i(e,!!n)}if("OPTIONS"===o&&r[o]&&r[o][c]){const e=r[o][c];return delete r[o][c],i(e,!!n)}return t(e)}};const d=({path:e,url:r,...t},n)=>({...t,url:r&&(0,s.addQueryArgs)(r,n),path:e&&(0,s.addQueryArgs)(e,n)}),p=e=>e.json?e.json():Promise.reject(e),l=e=>{const{next:r}=(e=>{if(!e)return{};const r=e.match(/<([^>]+)>; rel="next"/);return r?{next:r[1]}:{}})(e.headers.get("link"));return r};var u=async(e,r)=>{if(!1===e.parse)return r(e);if(!(e=>{const r=!!e.path&&-1!==e.path.indexOf("per_page=-1"),t=!!e.url&&-1!==e.url.indexOf("per_page=-1");return r||t})(e))return r(e);const t=await b({...d(e,{per_page:100}),parse:!1}),n=await p(t);if(!Array.isArray(n))return n;let a=l(t);if(!a)return n;let o=[].concat(n);for(;a;){const r=await b({...e,path:void 0,url:a,parse:!1}),t=await p(r);o=o.concat(t),a=l(r)}return o};const h=new Set(["PATCH","PUT","DELETE"]),f="GET";async function w(e){try{return await e.json()}catch{throw{code:"invalid_json",message:(0,t.__)("The response is not a valid JSON response.")}}}async function g(e,r=!0){return r?204===e.status?null:await w(e):e}async function m(e,r=!0){if(!r)throw e;throw await w(e)}var y=(e,r)=>{if(!function(e){const r=!!e.method&&"POST"===e.method;return(!!e.path&&-1!==e.path.indexOf("/wp/v2/media")||!!e.url&&-1!==e.url.indexOf("/wp/v2/media"))&&r}(e))return r(e);let n=0;const a=e=>(n++,r({path:`/wp/v2/media/${e}/post-process`,method:"POST",data:{action:"create-image-subsizes"},parse:!1}).catch((()=>n<5?a(e):(r({path:`/wp/v2/media/${e}?force=true`,method:"DELETE"}),Promise.reject()))));return r({...e,parse:!1}).catch((r=>{if(!(r instanceof globalThis.Response))return Promise.reject(r);const n=r.headers.get("x-wp-upload-attachment-id");return r.status>=500&&r.status<600&&n?a(n).catch((()=>!1!==e.parse?Promise.reject({code:"post_process",message:(0,t.__)("Media upload failed. If this is a photo or a large image, please scale it down and try again.")}):Promise.reject(r))):m(r,e.parse)})).then((r=>g(r,e.parse)))};var v=e=>(r,t)=>{if("string"==typeof r.url){const t=(0,s.getQueryArg)(r.url,"wp_theme_preview");void 0===t?r.url=(0,s.addQueryArgs)(r.url,{wp_theme_preview:e}):""===t&&(r.url=(0,s.removeQueryArgs)(r.url,"wp_theme_preview"))}if("string"==typeof r.path){const t=(0,s.getQueryArg)(r.path,"wp_theme_preview");void 0===t?r.path=(0,s.addQueryArgs)(r.path,{wp_theme_preview:e}):""===t&&(r.path=(0,s.removeQueryArgs)(r.path,"wp_theme_preview"))}return t(r)};const _={Accept:"application/json, */*;q=0.1"},P={credentials:"include"},O=[(e,r)=>("string"!=typeof e.url||(0,s.hasQueryArg)(e.url,"_locale")||(e.url=(0,s.addQueryArgs)(e.url,{_locale:"user"})),"string"!=typeof e.path||(0,s.hasQueryArg)(e.path,"_locale")||(e.path=(0,s.addQueryArgs)(e.path,{_locale:"user"})),r(e)),a,(e,r)=>{const{method:t=f}=e;return h.has(t.toUpperCase())&&(e={...e,headers:{...e.headers,"X-HTTP-Method-Override":t,"Content-Type":"application/json"},method:"POST"}),r(e)},u];let T=e=>{const{url:r,path:n,data:a,parse:o=!0,...s}=e;let{body:i,headers:c}=e;c={..._,...c},a&&(i=JSON.stringify(a),c["Content-Type"]="application/json");return globalThis.fetch(r||n||window.location.href,{...P,...s,body:i,headers:c}).then((e=>e.ok?g(e,o):m(e,o)),(e=>{if(e&&"AbortError"===e.name)throw e;if(!globalThis.navigator.onLine)throw{code:"offline_error",message:(0,t.__)("Unable to connect. Please check your Internet connection.")};throw{code:"fetch_error",message:(0,t.__)("Could not get a valid response from the server.")}}))};const A=e=>O.reduceRight(((e,r)=>t=>r(t,e)),T)(e).catch((r=>"rest_cookie_invalid_nonce"!==r.code?Promise.reject(r):globalThis.fetch(A.nonceEndpoint).then((e=>e.ok?e.text():Promise.reject(r))).then((r=>(A.nonceMiddleware.nonce=r,A(e))))));A.use=function(e){O.unshift(e)},A.setFetchHandler=function(e){T=e},A.createNonceMiddleware=n,A.createPreloadingMiddleware=c,A.createRootURLMiddleware=o,A.fetchAllMiddleware=u,A.mediaUploadMiddleware=y,A.createThemePreviewMiddleware=v;var b=A;(window.wp=window.wp||{}).apiFetch=r.default})();