(()=>{"use strict";var e={n:t=>{var o=t&&t.__esModule?()=>t.default:()=>t;return e.d(o,{a:o}),o},d:(t,o)=>{for(var r in o)e.o(o,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:o[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t);const o=window.wp.apiFetch;var r=e.n(o);let n="",a=0;try{const e=window.localStorage.getItem("storeApiNonce"),t=e?JSON.parse(e):{};n=(null==t?void 0:t.nonce)||"",a=(null==t?void 0:t.timestamp)||0}catch{}const s=e=>{const t=e.url||e.path;return!(!t||!e.method||"GET"===e.method)&&null!==/wc\/store\/v1\//.exec(t)},l=(e,t)=>{e!==n&&(a&&t<a||(n=e,a=t||Date.now()/1e3,window.localStorage.setItem("storeApiNonce",JSON.stringify({nonce:n,timestamp:a}))))},i=e=>{const t=e.headers||{};return e.headers={...t,Nonce:n},e};r().use(((e,t)=>{var o,r;return s(e)&&(e=i(e),Array.isArray(null===(o=e)||void 0===o||null===(r=o.data)||void 0===r?void 0:r.requests)&&(e.data.requests=e.data.requests.map(i))),t(e,t)})),r().setNonce=e=>{const t="function"==typeof(null==e?void 0:e.get)?e.get("Nonce"):e.Nonce,o="function"==typeof(null==e?void 0:e.get)?e.get("Nonce-Timestamp"):e["Nonce-Timestamp"];t&&l(t,o)},l(wcBlocksMiddlewareConfig.storeApiNonce,wcBlocksMiddlewareConfig.storeApiNonceTimestamp);const c=window.wp.url;r().use(((e,t)=>("string"==typeof e.url&&s(e)&&(e.url=(0,c.addQueryArgs)(e.url,{_locale:"site"})),"string"==typeof e.path&&s(e)&&(e.path=(0,c.addQueryArgs)(e.path,{_locale:"site"})),t(e)))),(this.wc=this.wc||{}).wcBlocksMiddleware=t})();