import{m as H}from"../memize.js";import{s as S}from"../sprintf-js.js";import{T as I}from"../tannin.js";import{d as P}from"./hooks.js";const U=H(console.error);function X(c,...p){try{return S.sprintf(c,...p)}catch(r){return r instanceof Error&&U(`sprintf error: 

`+r.toString()),c}}const x={"":{plural_forms(c){return c===1?0:1}}},j=/^i18n\.(n?gettext|has_translation)(_|$)/,z=(c,p,r)=>{const l=new I({}),f=new Set,d=()=>{f.forEach(t=>t())},A=t=>(f.add(t),()=>f.delete(t)),D=(t="default")=>l.data[t],L=(t,n="default")=>{var e;l.data[n]={...l.data[n],...t},l.data[n][""]={...x[""],...(e=l.data[n])==null?void 0:e[""]},delete l.pluralForms[n]},y=(t,n)=>{L(t,n),d()},b=(t,n="default")=>{var e;l.data[n]={...l.data[n],...t,"":{...x[""],...(e=l.data[n])==null?void 0:e[""],...t==null?void 0:t[""]}},delete l.pluralForms[n],d()},T=(t,n)=>{l.data={},l.pluralForms={},y(t,n)},_=(t="default",n,e,s,i)=>(l.data[t]||L(void 0,t),l.dcnpgettext(t,n,e,s,i)),u=(t="default")=>t,E=(t,n)=>{let e=_(n,void 0,t);return r?(e=r.applyFilters("i18n.gettext",e,t,n),r.applyFilters("i18n.gettext_"+u(n),e,t,n)):e},F=(t,n,e)=>{let s=_(e,n,t);return r?(s=r.applyFilters("i18n.gettext_with_context",s,t,n,e),r.applyFilters("i18n.gettext_with_context_"+u(e),s,t,n,e)):s},w=(t,n,e,s)=>{let i=_(s,void 0,t,n,e);return r?(i=r.applyFilters("i18n.ngettext",i,t,n,e,s),r.applyFilters("i18n.ngettext_"+u(s),i,t,n,e,s)):i},R=(t,n,e,s,i)=>{let o=_(i,s,t,n,e);return r?(o=r.applyFilters("i18n.ngettext_with_context",o,t,n,e,s,i),r.applyFilters("i18n.ngettext_with_context_"+u(i),o,t,n,e,s,i)):o},O=()=>F("ltr","text direction")==="rtl",v=(t,n,e)=>{var o,g;const s=n?n+""+t:t;let i=!!((g=(o=l.data)==null?void 0:o[e??"default"])!=null&&g[s]);return r&&(i=r.applyFilters("i18n.has_translation",i,t,n,e),i=r.applyFilters("i18n.has_translation_"+u(e),i,t,n,e)),i};if(c&&y(c,p),r){const t=n=>{j.test(n)&&d()};r.addAction("hookAdded","core/i18n",t),r.addAction("hookRemoved","core/i18n",t)}return{getLocaleData:D,setLocaleData:y,addLocaleData:b,resetLocaleData:T,subscribe:A,__:E,_x:F,_n:w,_nx:R,isRTL:O,hasTranslation:v}},a=z(void 0,void 0,P);a.getLocaleData.bind(a);const $=a.setLocaleData.bind(a);a.resetLocaleData.bind(a);a.subscribe.bind(a);const q=a.__.bind(a);a._x.bind(a);const B=a._n.bind(a);a._nx.bind(a);a.isRTL.bind(a);a.hasTranslation.bind(a);export{q as _,$ as a,B as b,X as s};
