| 1 |
(function(){(()=>{var S=/^[^/]+\/widgets\//,c;function g(){return{manifests:new Map(),downloads:new Map(),active:0,queue:[]};}function h(e){let t=e;return!!t&&t.manifests instanceof Map&&t.downloads instanceof Map&&typeof t.active=="number"&&Array.isArray(t.queue);}function T(){let e=window,t=e.__jetpackWpBuildI18nCatalogs;if(t===void 0){let a=g();return e.__jetpackWpBuildI18nCatalogs=a,a;}return h(t)?t:(c||(l("Shared catalog state on window has an unrecognized shape; downloads will not be deduped across module copies."),c=g()),c);}function y(e,t,a){return new Promise(n=>{let o=()=>{e.active++;let r=!1,i=()=>{r||(r=!0,clearTimeout(s),I(e));},s=setTimeout(()=>{l(`Catalog download for ${t} has held a slot for 30000ms; releasing it so queued downloads can proceed.`),i();},3e4);s.unref?.(),n(a().finally(i));};e.active<6?o():e.queue.push(o);});}function I(e){e.active--;let t=e.queue.shift();t&&t();}function L(e,t,a,n){let o=`${a}|${n}`,r=t.downloads.get(o);return r||(r=y(t,n,()=>e.downloadI18n(n,a,"plugin")).catch(i=>{let s=u(i);p(s)||l(`Failed to load "${a}" catalog (${n}): ${s}`);}),t.downloads.set(o,r)),r;}function l(e){console.warn(`[jetpack-i18n] ${e}`);}function u(e){return e instanceof Error?e.message:String(e);}function p(e){let t=/^HTTP request failed: (\d+)\b/.exec(e);return t!==null&&t[1]==="404";}async function C(e){let t=await fetch(e,{cache:"no-cache"});if(!t.ok)throw new Error(`HTTP request failed: ${t.status} ${t.statusText}`);let a=await t.json();return Array.isArray(a?.bundles)?a.bundles.filter(n=>typeof n=="string"):[];}function _(e){let t=new URL("../../i18n-manifest.json",e);return t.search=new URL(e).search,t;}function v(e,t,a){let n=e.manifests.get(t);return n||(n=C(a).catch(o=>{let r=u(o);return p(r)||l(`Failed to load the i18n manifest for "${t}": ${r}`),[];}).then(o=>new Set(o)),e.manifests.set(t,n)),n;}async function m(e,t,a=5e3){let n=window.wp?.jpI18nLoader;if(!n||typeof n.downloadI18n!="function"){l(`wp.jpI18nLoader unavailable; "${e}" strings will render untranslated.`);return;}if(n.state?.locale==="en_US")return;let o=T(),r=async()=>{let d=v(o,e,_(t)),f=[];for(let w of await d)S.test(w)||f.push(L(n,o,e,w));await Promise.all(f);},i,s=!1;try{await Promise.race([r().finally(()=>{s=!0;}),new Promise(d=>{i=setTimeout(d,a);})]);}catch(d){l(`Unexpected failure loading "${e}" catalogs: ${u(d)}`);return;}finally{clearTimeout(i);}s||l(`"${e}" catalog downloads still pending after ${a}ms; rendering may start untranslated.`);}var $={};async function U(){globalThis.jetpackConfig={consumer_slug:"jetpack-forms"},await m("jetpack-forms",$.url);}})();})();//# sourceMappingURL=index.min.js.map |