@formatjs/intl-relativetimeformat 7.3.3 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts.map +1 -1
- package/index.js +12 -24
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +13 -25
- package/locale-data/af-NA.js +1 -1
- package/locale-data/af.js +1 -1
- package/locale-data/agq.js +1 -1
- package/locale-data/ak.js +1 -1
- package/locale-data/am.js +1 -1
- package/locale-data/ar-AE.js +1 -1
- package/locale-data/ar-BH.js +1 -1
- package/locale-data/ar-DJ.js +1 -1
- package/locale-data/ar-DZ.js +1 -1
- package/locale-data/ar-EG.js +1 -1
- package/locale-data/ar-EH.js +1 -1
- package/locale-data/ar-ER.js +1 -1
- package/locale-data/ar-IL.js +1 -1
- package/locale-data/ar-IQ.js +1 -1
- package/locale-data/ar-JO.js +1 -1
- package/locale-data/ar-KM.js +1 -1
- package/locale-data/ar-KW.js +1 -1
- package/locale-data/ar-LB.js +1 -1
- package/locale-data/ar-LY.js +1 -1
- package/locale-data/ar-MA.js +1 -1
- package/locale-data/ar-MR.js +1 -1
- package/locale-data/ar-OM.js +1 -1
- package/locale-data/ar-PS.js +1 -1
- package/locale-data/ar-QA.js +1 -1
- package/locale-data/ar-SA.js +1 -1
- package/locale-data/ar-SD.js +1 -1
- package/locale-data/ar-SO.js +1 -1
- package/locale-data/ar-SS.js +1 -1
- package/locale-data/ar-SY.js +1 -1
- package/locale-data/ar-TD.js +1 -1
- package/locale-data/ar-TN.js +1 -1
- package/locale-data/ar-YE.js +1 -1
- package/locale-data/ar.js +1 -1
- package/locale-data/as.js +1 -1
- package/locale-data/asa.js +1 -1
- package/locale-data/ast.js +1 -1
- package/locale-data/az-Cyrl.js +1 -1
- package/locale-data/az-Latn.js +1 -1
- package/locale-data/az.js +1 -1
- package/locale-data/bas.js +1 -1
- package/locale-data/be.js +1 -1
- package/locale-data/bem.js +1 -1
- package/locale-data/bez.js +1 -1
- package/locale-data/bg.js +1 -1
- package/locale-data/bm.js +1 -1
- package/locale-data/bn-IN.js +1 -1
- package/locale-data/bn.js +1 -1
- package/locale-data/bo-IN.js +1 -1
- package/locale-data/bo.js +1 -1
- package/locale-data/br.js +1 -1
- package/locale-data/brx.js +1 -1
- package/locale-data/bs-Cyrl.js +1 -1
- package/locale-data/bs-Latn.js +1 -1
- package/locale-data/bs.js +1 -1
- package/locale-data/ca-AD.js +1 -1
- package/locale-data/ca-ES-VALENCIA.js +1 -1
- package/locale-data/ca-FR.js +1 -1
- package/locale-data/ca-IT.js +1 -1
- package/locale-data/ca.js +1 -1
- package/locale-data/ccp-IN.js +1 -1
- package/locale-data/ccp.js +1 -1
- package/locale-data/ce.js +1 -1
- package/locale-data/ceb.js +1 -1
- package/locale-data/cgg.js +1 -1
- package/locale-data/chr.js +1 -1
- package/locale-data/ckb-IR.js +1 -1
- package/locale-data/ckb.js +1 -1
- package/locale-data/cs.js +1 -1
- package/locale-data/cu.js +1 -1
- package/locale-data/cy.js +1 -1
- package/locale-data/da-GL.js +1 -1
- package/locale-data/da.js +1 -1
- package/locale-data/dav.js +1 -1
- package/locale-data/de-AT.js +1 -1
- package/locale-data/de-BE.js +1 -1
- package/locale-data/de-CH.js +1 -1
- package/locale-data/de-IT.js +1 -1
- package/locale-data/de-LI.js +1 -1
- package/locale-data/de-LU.js +1 -1
- package/locale-data/de.js +1 -1
- package/locale-data/dje.js +1 -1
- package/locale-data/dsb.js +1 -1
- package/locale-data/dua.js +1 -1
- package/locale-data/dyo.js +1 -1
- package/locale-data/dz.js +1 -1
- package/locale-data/ebu.js +1 -1
- package/locale-data/ee-TG.js +1 -1
- package/locale-data/ee.js +1 -1
- package/locale-data/el-CY.js +1 -1
- package/locale-data/el.js +1 -1
- package/locale-data/en-001.js +1 -1
- package/locale-data/en-150.js +1 -1
- package/locale-data/en-AE.js +1 -1
- package/locale-data/en-AG.js +1 -1
- package/locale-data/en-AI.js +1 -1
- package/locale-data/en-AS.js +1 -1
- package/locale-data/en-AT.js +1 -1
- package/locale-data/en-AU.js +1 -1
- package/locale-data/en-BB.js +1 -1
- package/locale-data/en-BE.js +1 -1
- package/locale-data/en-BI.js +1 -1
- package/locale-data/en-BM.js +1 -1
- package/locale-data/en-BS.js +1 -1
- package/locale-data/en-BW.js +1 -1
- package/locale-data/en-BZ.js +1 -1
- package/locale-data/en-CA.js +1 -1
- package/locale-data/en-CC.js +1 -1
- package/locale-data/en-CH.js +1 -1
- package/locale-data/en-CK.js +1 -1
- package/locale-data/en-CM.js +1 -1
- package/locale-data/en-CX.js +1 -1
- package/locale-data/en-CY.js +1 -1
- package/locale-data/en-DE.js +1 -1
- package/locale-data/en-DG.js +1 -1
- package/locale-data/en-DK.js +1 -1
- package/locale-data/en-DM.js +1 -1
- package/locale-data/en-ER.js +1 -1
- package/locale-data/en-FI.js +1 -1
- package/locale-data/en-FJ.js +1 -1
- package/locale-data/en-FK.js +1 -1
- package/locale-data/en-FM.js +1 -1
- package/locale-data/en-GB.js +1 -1
- package/locale-data/en-GD.js +1 -1
- package/locale-data/en-GG.js +1 -1
- package/locale-data/en-GH.js +1 -1
- package/locale-data/en-GI.js +1 -1
- package/locale-data/en-GM.js +1 -1
- package/locale-data/en-GU.js +1 -1
- package/locale-data/en-GY.js +1 -1
- package/locale-data/en-HK.js +1 -1
- package/locale-data/en-IE.js +1 -1
- package/locale-data/en-IL.js +1 -1
- package/locale-data/en-IM.js +1 -1
- package/locale-data/en-IN.js +1 -1
- package/locale-data/en-IO.js +1 -1
- package/locale-data/en-JE.js +1 -1
- package/locale-data/en-JM.js +1 -1
- package/locale-data/en-KE.js +1 -1
- package/locale-data/en-KI.js +1 -1
- package/locale-data/en-KN.js +1 -1
- package/locale-data/en-KY.js +1 -1
- package/locale-data/en-LC.js +1 -1
- package/locale-data/en-LR.js +1 -1
- package/locale-data/en-LS.js +1 -1
- package/locale-data/en-MG.js +1 -1
- package/locale-data/en-MH.js +1 -1
- package/locale-data/en-MO.js +1 -1
- package/locale-data/en-MP.js +1 -1
- package/locale-data/en-MS.js +1 -1
- package/locale-data/en-MT.js +1 -1
- package/locale-data/en-MU.js +1 -1
- package/locale-data/en-MW.js +1 -1
- package/locale-data/en-MY.js +1 -1
- package/locale-data/en-NA.js +1 -1
- package/locale-data/en-NF.js +1 -1
- package/locale-data/en-NG.js +1 -1
- package/locale-data/en-NL.js +1 -1
- package/locale-data/en-NR.js +1 -1
- package/locale-data/en-NU.js +1 -1
- package/locale-data/en-NZ.js +1 -1
- package/locale-data/en-PG.js +1 -1
- package/locale-data/en-PH.js +1 -1
- package/locale-data/en-PK.js +1 -1
- package/locale-data/en-PN.js +1 -1
- package/locale-data/en-PR.js +1 -1
- package/locale-data/en-PW.js +1 -1
- package/locale-data/en-RW.js +1 -1
- package/locale-data/en-SB.js +1 -1
- package/locale-data/en-SC.js +1 -1
- package/locale-data/en-SD.js +1 -1
- package/locale-data/en-SE.js +1 -1
- package/locale-data/en-SG.js +1 -1
- package/locale-data/en-SH.js +1 -1
- package/locale-data/en-SI.js +1 -1
- package/locale-data/en-SL.js +1 -1
- package/locale-data/en-SS.js +1 -1
- package/locale-data/en-SX.js +1 -1
- package/locale-data/en-SZ.js +1 -1
- package/locale-data/en-TC.js +1 -1
- package/locale-data/en-TK.js +1 -1
- package/locale-data/en-TO.js +1 -1
- package/locale-data/en-TT.js +1 -1
- package/locale-data/en-TV.js +1 -1
- package/locale-data/en-TZ.js +1 -1
- package/locale-data/en-UG.js +1 -1
- package/locale-data/en-UM.js +1 -1
- package/locale-data/en-US.js +1 -1
- package/locale-data/en-VC.js +1 -1
- package/locale-data/en-VG.js +1 -1
- package/locale-data/en-VI.js +1 -1
- package/locale-data/en-VU.js +1 -1
- package/locale-data/en-WS.js +1 -1
- package/locale-data/en-ZA.js +1 -1
- package/locale-data/en-ZM.js +1 -1
- package/locale-data/en-ZW.js +1 -1
- package/locale-data/en.js +1 -1
- package/locale-data/eo.js +1 -1
- package/locale-data/es-419.js +1 -1
- package/locale-data/es-AR.js +1 -1
- package/locale-data/es-BO.js +1 -1
- package/locale-data/es-BR.js +1 -1
- package/locale-data/es-BZ.js +1 -1
- package/locale-data/es-CL.js +1 -1
- package/locale-data/es-CO.js +1 -1
- package/locale-data/es-CR.js +1 -1
- package/locale-data/es-CU.js +1 -1
- package/locale-data/es-DO.js +1 -1
- package/locale-data/es-EA.js +1 -1
- package/locale-data/es-EC.js +1 -1
- package/locale-data/es-GQ.js +1 -1
- package/locale-data/es-GT.js +1 -1
- package/locale-data/es-HN.js +1 -1
- package/locale-data/es-IC.js +1 -1
- package/locale-data/es-MX.js +1 -1
- package/locale-data/es-NI.js +1 -1
- package/locale-data/es-PA.js +1 -1
- package/locale-data/es-PE.js +1 -1
- package/locale-data/es-PH.js +1 -1
- package/locale-data/es-PR.js +1 -1
- package/locale-data/es-PY.js +1 -1
- package/locale-data/es-SV.js +1 -1
- package/locale-data/es-US.js +1 -1
- package/locale-data/es-UY.js +1 -1
- package/locale-data/es-VE.js +1 -1
- package/locale-data/es.js +1 -1
- package/locale-data/et.js +1 -1
- package/locale-data/eu.js +1 -1
- package/locale-data/ewo.js +1 -1
- package/locale-data/fa-AF.js +1 -1
- package/locale-data/fa.js +1 -1
- package/locale-data/ff-Latn-BF.js +1 -1
- package/locale-data/ff-Latn-CM.js +1 -1
- package/locale-data/ff-Latn-GH.js +1 -1
- package/locale-data/ff-Latn-GM.js +1 -1
- package/locale-data/ff-Latn-GN.js +1 -1
- package/locale-data/ff-Latn-GW.js +1 -1
- package/locale-data/ff-Latn-LR.js +1 -1
- package/locale-data/ff-Latn-MR.js +1 -1
- package/locale-data/ff-Latn-NE.js +1 -1
- package/locale-data/ff-Latn-NG.js +1 -1
- package/locale-data/ff-Latn-SL.js +1 -1
- package/locale-data/ff-Latn.js +1 -1
- package/locale-data/ff.js +1 -1
- package/locale-data/fi.js +1 -1
- package/locale-data/fil.js +1 -1
- package/locale-data/fo-DK.js +1 -1
- package/locale-data/fo.js +1 -1
- package/locale-data/fr-BE.js +1 -1
- package/locale-data/fr-BF.js +1 -1
- package/locale-data/fr-BI.js +1 -1
- package/locale-data/fr-BJ.js +1 -1
- package/locale-data/fr-BL.js +1 -1
- package/locale-data/fr-CA.js +1 -1
- package/locale-data/fr-CD.js +1 -1
- package/locale-data/fr-CF.js +1 -1
- package/locale-data/fr-CG.js +1 -1
- package/locale-data/fr-CH.js +1 -1
- package/locale-data/fr-CI.js +1 -1
- package/locale-data/fr-CM.js +1 -1
- package/locale-data/fr-DJ.js +1 -1
- package/locale-data/fr-DZ.js +1 -1
- package/locale-data/fr-GA.js +1 -1
- package/locale-data/fr-GF.js +1 -1
- package/locale-data/fr-GN.js +1 -1
- package/locale-data/fr-GP.js +1 -1
- package/locale-data/fr-GQ.js +1 -1
- package/locale-data/fr-HT.js +1 -1
- package/locale-data/fr-KM.js +1 -1
- package/locale-data/fr-LU.js +1 -1
- package/locale-data/fr-MA.js +1 -1
- package/locale-data/fr-MC.js +1 -1
- package/locale-data/fr-MF.js +1 -1
- package/locale-data/fr-MG.js +1 -1
- package/locale-data/fr-ML.js +1 -1
- package/locale-data/fr-MQ.js +1 -1
- package/locale-data/fr-MR.js +1 -1
- package/locale-data/fr-MU.js +1 -1
- package/locale-data/fr-NC.js +1 -1
- package/locale-data/fr-NE.js +1 -1
- package/locale-data/fr-PF.js +1 -1
- package/locale-data/fr-PM.js +1 -1
- package/locale-data/fr-RE.js +1 -1
- package/locale-data/fr-RW.js +1 -1
- package/locale-data/fr-SC.js +1 -1
- package/locale-data/fr-SN.js +1 -1
- package/locale-data/fr-SY.js +1 -1
- package/locale-data/fr-TD.js +1 -1
- package/locale-data/fr-TG.js +1 -1
- package/locale-data/fr-TN.js +1 -1
- package/locale-data/fr-VU.js +1 -1
- package/locale-data/fr-WF.js +1 -1
- package/locale-data/fr-YT.js +1 -1
- package/locale-data/fr.js +1 -1
- package/locale-data/fur.js +1 -1
- package/locale-data/fy.js +1 -1
- package/locale-data/ga-GB.js +1 -1
- package/locale-data/ga.js +1 -1
- package/locale-data/gd.js +1 -1
- package/locale-data/gl.js +1 -1
- package/locale-data/gsw-FR.js +1 -1
- package/locale-data/gsw-LI.js +1 -1
- package/locale-data/gsw.js +1 -1
- package/locale-data/gu.js +1 -1
- package/locale-data/guz.js +1 -1
- package/locale-data/gv.js +1 -1
- package/locale-data/ha-GH.js +1 -1
- package/locale-data/ha-NE.js +1 -1
- package/locale-data/ha.js +1 -1
- package/locale-data/haw.js +1 -1
- package/locale-data/he.js +1 -1
- package/locale-data/hi.js +1 -1
- package/locale-data/hr-BA.js +1 -1
- package/locale-data/hr.js +1 -1
- package/locale-data/hsb.js +1 -1
- package/locale-data/hu.js +1 -1
- package/locale-data/hy.js +1 -1
- package/locale-data/ia.js +1 -1
- package/locale-data/id.js +1 -1
- package/locale-data/ig.js +1 -1
- package/locale-data/ii.js +1 -1
- package/locale-data/is.js +1 -1
- package/locale-data/it-CH.js +1 -1
- package/locale-data/it-SM.js +1 -1
- package/locale-data/it-VA.js +1 -1
- package/locale-data/it.js +1 -1
- package/locale-data/ja.js +1 -1
- package/locale-data/jgo.js +1 -1
- package/locale-data/jmc.js +1 -1
- package/locale-data/jv.js +1 -1
- package/locale-data/ka.js +1 -1
- package/locale-data/kab.js +1 -1
- package/locale-data/kam.js +1 -1
- package/locale-data/kde.js +1 -1
- package/locale-data/kea.js +1 -1
- package/locale-data/khq.js +1 -1
- package/locale-data/ki.js +1 -1
- package/locale-data/kk.js +1 -1
- package/locale-data/kkj.js +1 -1
- package/locale-data/kl.js +1 -1
- package/locale-data/kln.js +1 -1
- package/locale-data/km.js +1 -1
- package/locale-data/kn.js +1 -1
- package/locale-data/ko-KP.js +1 -1
- package/locale-data/ko.js +1 -1
- package/locale-data/kok.js +1 -1
- package/locale-data/ks.js +1 -1
- package/locale-data/ksb.js +1 -1
- package/locale-data/ksf.js +1 -1
- package/locale-data/ksh.js +1 -1
- package/locale-data/ku.js +1 -1
- package/locale-data/kw.js +1 -1
- package/locale-data/ky.js +1 -1
- package/locale-data/lag.js +1 -1
- package/locale-data/lb.js +1 -1
- package/locale-data/lg.js +1 -1
- package/locale-data/lkt.js +1 -1
- package/locale-data/ln-AO.js +1 -1
- package/locale-data/ln-CF.js +1 -1
- package/locale-data/ln-CG.js +1 -1
- package/locale-data/ln.js +1 -1
- package/locale-data/lo.js +1 -1
- package/locale-data/lrc-IQ.js +1 -1
- package/locale-data/lrc.js +1 -1
- package/locale-data/lt.js +1 -1
- package/locale-data/lu.js +1 -1
- package/locale-data/luo.js +1 -1
- package/locale-data/luy.js +1 -1
- package/locale-data/lv.js +1 -1
- package/locale-data/mas-TZ.js +1 -1
- package/locale-data/mas.js +1 -1
- package/locale-data/mer.js +1 -1
- package/locale-data/mfe.js +1 -1
- package/locale-data/mg.js +1 -1
- package/locale-data/mgh.js +1 -1
- package/locale-data/mgo.js +1 -1
- package/locale-data/mi.js +1 -1
- package/locale-data/mk.js +1 -1
- package/locale-data/ml.js +1 -1
- package/locale-data/mn.js +1 -1
- package/locale-data/mr.js +1 -1
- package/locale-data/ms-BN.js +1 -1
- package/locale-data/ms-SG.js +1 -1
- package/locale-data/ms.js +1 -1
- package/locale-data/mt.js +1 -1
- package/locale-data/mua.js +1 -1
- package/locale-data/my.js +1 -1
- package/locale-data/mzn.js +1 -1
- package/locale-data/naq.js +1 -1
- package/locale-data/nb-SJ.js +1 -1
- package/locale-data/nb.js +1 -1
- package/locale-data/nd.js +1 -1
- package/locale-data/nds-NL.js +1 -1
- package/locale-data/nds.js +1 -1
- package/locale-data/ne-IN.js +1 -1
- package/locale-data/ne.js +1 -1
- package/locale-data/nl-AW.js +1 -1
- package/locale-data/nl-BE.js +1 -1
- package/locale-data/nl-BQ.js +1 -1
- package/locale-data/nl-CW.js +1 -1
- package/locale-data/nl-SR.js +1 -1
- package/locale-data/nl-SX.js +1 -1
- package/locale-data/nl.js +1 -1
- package/locale-data/nmg.js +1 -1
- package/locale-data/nn.js +1 -1
- package/locale-data/nnh.js +1 -1
- package/locale-data/nus.js +1 -1
- package/locale-data/nyn.js +1 -1
- package/locale-data/om-KE.js +1 -1
- package/locale-data/om.js +1 -1
- package/locale-data/or.js +1 -1
- package/locale-data/os-RU.js +1 -1
- package/locale-data/os.js +1 -1
- package/locale-data/pa-Arab.js +1 -1
- package/locale-data/pa-Guru.js +1 -1
- package/locale-data/pa.js +1 -1
- package/locale-data/pl.js +1 -1
- package/locale-data/prg.js +1 -1
- package/locale-data/ps-PK.js +1 -1
- package/locale-data/ps.js +1 -1
- package/locale-data/pt-AO.js +1 -1
- package/locale-data/pt-CH.js +1 -1
- package/locale-data/pt-CV.js +1 -1
- package/locale-data/pt-GQ.js +1 -1
- package/locale-data/pt-GW.js +1 -1
- package/locale-data/pt-LU.js +1 -1
- package/locale-data/pt-MO.js +1 -1
- package/locale-data/pt-MZ.js +1 -1
- package/locale-data/pt-PT.js +1 -1
- package/locale-data/pt-ST.js +1 -1
- package/locale-data/pt-TL.js +1 -1
- package/locale-data/pt.js +1 -1
- package/locale-data/qu-BO.js +1 -1
- package/locale-data/qu-EC.js +1 -1
- package/locale-data/qu.js +1 -1
- package/locale-data/rm.js +1 -1
- package/locale-data/rn.js +1 -1
- package/locale-data/ro-MD.js +1 -1
- package/locale-data/ro.js +1 -1
- package/locale-data/rof.js +1 -1
- package/locale-data/ru-BY.js +1 -1
- package/locale-data/ru-KG.js +1 -1
- package/locale-data/ru-KZ.js +1 -1
- package/locale-data/ru-MD.js +1 -1
- package/locale-data/ru-UA.js +1 -1
- package/locale-data/ru.js +1 -1
- package/locale-data/rw.js +1 -1
- package/locale-data/rwk.js +1 -1
- package/locale-data/sah.js +1 -1
- package/locale-data/saq.js +1 -1
- package/locale-data/sbp.js +1 -1
- package/locale-data/sd.js +1 -1
- package/locale-data/se-FI.js +1 -1
- package/locale-data/se-SE.js +1 -1
- package/locale-data/se.js +1 -1
- package/locale-data/seh.js +1 -1
- package/locale-data/ses.js +1 -1
- package/locale-data/sg.js +1 -1
- package/locale-data/shi-Latn.js +1 -1
- package/locale-data/shi-Tfng.js +1 -1
- package/locale-data/shi.js +1 -1
- package/locale-data/si.js +1 -1
- package/locale-data/sk.js +1 -1
- package/locale-data/sl.js +1 -1
- package/locale-data/smn.js +1 -1
- package/locale-data/sn.js +1 -1
- package/locale-data/so-DJ.js +1 -1
- package/locale-data/so-ET.js +1 -1
- package/locale-data/so-KE.js +1 -1
- package/locale-data/so.js +1 -1
- package/locale-data/sq-MK.js +1 -1
- package/locale-data/sq-XK.js +1 -1
- package/locale-data/sq.js +1 -1
- package/locale-data/sr-Cyrl-BA.js +1 -1
- package/locale-data/sr-Cyrl-ME.js +1 -1
- package/locale-data/sr-Cyrl-XK.js +1 -1
- package/locale-data/sr-Cyrl.js +1 -1
- package/locale-data/sr-Latn-BA.js +1 -1
- package/locale-data/sr-Latn-ME.js +1 -1
- package/locale-data/sr-Latn-XK.js +1 -1
- package/locale-data/sr-Latn.js +1 -1
- package/locale-data/sr.js +1 -1
- package/locale-data/sv-AX.js +1 -1
- package/locale-data/sv-FI.js +1 -1
- package/locale-data/sv.js +1 -1
- package/locale-data/sw-CD.js +1 -1
- package/locale-data/sw-KE.js +1 -1
- package/locale-data/sw-UG.js +1 -1
- package/locale-data/sw.js +1 -1
- package/locale-data/ta-LK.js +1 -1
- package/locale-data/ta-MY.js +1 -1
- package/locale-data/ta-SG.js +1 -1
- package/locale-data/ta.js +1 -1
- package/locale-data/te.js +1 -1
- package/locale-data/teo-KE.js +1 -1
- package/locale-data/teo.js +1 -1
- package/locale-data/tg.js +1 -1
- package/locale-data/th.js +1 -1
- package/locale-data/ti-ER.js +1 -1
- package/locale-data/ti.js +1 -1
- package/locale-data/tk.js +1 -1
- package/locale-data/to.js +1 -1
- package/locale-data/tr-CY.js +1 -1
- package/locale-data/tr.js +1 -1
- package/locale-data/tt.js +1 -1
- package/locale-data/twq.js +1 -1
- package/locale-data/tzm.js +1 -1
- package/locale-data/ug.js +1 -1
- package/locale-data/uk.js +1 -1
- package/locale-data/ur-IN.js +1 -1
- package/locale-data/ur.js +1 -1
- package/locale-data/uz-Arab.js +1 -1
- package/locale-data/uz-Cyrl.js +1 -1
- package/locale-data/uz-Latn.js +1 -1
- package/locale-data/uz.js +1 -1
- package/locale-data/vai-Latn.js +1 -1
- package/locale-data/vai-Vaii.js +1 -1
- package/locale-data/vai.js +1 -1
- package/locale-data/vi.js +1 -1
- package/locale-data/vo.js +1 -1
- package/locale-data/vun.js +1 -1
- package/locale-data/wae.js +1 -1
- package/locale-data/wo.js +1 -1
- package/locale-data/xh.js +1 -1
- package/locale-data/xog.js +1 -1
- package/locale-data/yav.js +1 -1
- package/locale-data/yi.js +1 -1
- package/locale-data/yo-BJ.js +1 -1
- package/locale-data/yo.js +1 -1
- package/locale-data/yue-Hans.js +1 -1
- package/locale-data/yue-Hant.js +1 -1
- package/locale-data/yue.js +1 -1
- package/locale-data/zgh.js +1 -1
- package/locale-data/zh-Hans-HK.js +1 -1
- package/locale-data/zh-Hans-MO.js +1 -1
- package/locale-data/zh-Hans-SG.js +1 -1
- package/locale-data/zh-Hans.js +1 -1
- package/locale-data/zh-Hant-HK.js +1 -1
- package/locale-data/zh-Hant-MO.js +1 -1
- package/locale-data/zh-Hant.js +1 -1
- package/locale-data/zh.js +1 -1
- package/locale-data/zu.js +1 -1
- package/package.json +2 -2
- package/polyfill-locales.js +541 -543
- package/polyfill.umd.js +666 -730
- package/polyfill.umd.min.js +1 -15
- package/_validate_dist-base_options.optionsvalid.d.ts +0 -9
- package/_validate_dist-esm_options.optionsvalid.d.ts +0 -9
- package/locale-data/root.js +0 -6
package/polyfill.umd.js
CHANGED
|
@@ -1,755 +1,691 @@
|
|
|
1
1
|
(function (factory) {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
typeof define === 'function' && define.amd ? define(factory) :
|
|
3
|
+
factory();
|
|
4
4
|
}((function () { 'use strict';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
18
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
19
|
-
***************************************************************************** */
|
|
20
|
-
/* global Reflect, Promise */
|
|
21
|
-
|
|
22
|
-
var extendStatics = function(d, b) {
|
|
23
|
-
extendStatics = Object.setPrototypeOf ||
|
|
24
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
25
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
26
|
-
return extendStatics(d, b);
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
function __extends(d, b) {
|
|
30
|
-
extendStatics(d, b);
|
|
31
|
-
function __() { this.constructor = d; }
|
|
32
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
var __assign = function() {
|
|
36
|
-
__assign = Object.assign || function __assign(t) {
|
|
37
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
38
|
-
s = arguments[i];
|
|
39
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
40
|
-
}
|
|
41
|
-
return t;
|
|
42
|
-
};
|
|
43
|
-
return __assign.apply(this, arguments);
|
|
44
|
-
};
|
|
6
|
+
/**
|
|
7
|
+
* Cannot do Math.log(x) / Math.log(10) bc if IEEE floating point issue
|
|
8
|
+
* @param x number
|
|
9
|
+
*/
|
|
10
|
+
var UNICODE_EXTENSION_SEQUENCE_REGEX = /-u(?:-[0-9a-z]{2,8})+/gi;
|
|
11
|
+
function invariant(condition, message, Err) {
|
|
12
|
+
if (Err === void 0) { Err = Error; }
|
|
13
|
+
if (!condition) {
|
|
14
|
+
throw new Err(message);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
45
17
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
throw new Err(message);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
18
|
+
/**
|
|
19
|
+
* http://ecma-international.org/ecma-402/7.0/index.html#sec-canonicalizelocalelist
|
|
20
|
+
* @param locales
|
|
21
|
+
*/
|
|
22
|
+
function CanonicalizeLocaleList(locales) {
|
|
23
|
+
// TODO
|
|
24
|
+
return Intl.getCanonicalLocales(locales);
|
|
25
|
+
}
|
|
57
26
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
27
|
+
/**
|
|
28
|
+
* https://tc39.es/ecma262/#sec-tostring
|
|
29
|
+
*/
|
|
30
|
+
function ToString(o) {
|
|
31
|
+
// Only symbol is irregular...
|
|
32
|
+
if (typeof o === 'symbol') {
|
|
33
|
+
throw TypeError('Cannot convert a Symbol value to a string');
|
|
34
|
+
}
|
|
35
|
+
return String(o);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* https://tc39.es/ecma262/#sec-toobject
|
|
39
|
+
* @param arg
|
|
40
|
+
*/
|
|
41
|
+
function ToObject(arg) {
|
|
42
|
+
if (arg == null) {
|
|
43
|
+
throw new TypeError('undefined/null cannot be converted to object');
|
|
44
|
+
}
|
|
45
|
+
return Object(arg);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* https://www.ecma-international.org/ecma-262/11.0/index.html#sec-samevalue
|
|
49
|
+
* @param x
|
|
50
|
+
* @param y
|
|
51
|
+
*/
|
|
52
|
+
function SameValue(x, y) {
|
|
53
|
+
if (Object.is) {
|
|
54
|
+
return Object.is(x, y);
|
|
55
|
+
}
|
|
56
|
+
// SameValue algorithm
|
|
57
|
+
if (x === y) {
|
|
58
|
+
// Steps 1-5, 7-10
|
|
59
|
+
// Steps 6.b-6.e: +0 != -0
|
|
60
|
+
return x !== 0 || 1 / x === 1 / y;
|
|
61
|
+
}
|
|
62
|
+
// Step 6.a: NaN == NaN
|
|
63
|
+
return x !== x && y !== y;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* https://www.ecma-international.org/ecma-262/11.0/index.html#sec-type
|
|
67
|
+
* @param x
|
|
68
|
+
*/
|
|
69
|
+
function Type(x) {
|
|
70
|
+
if (x === null) {
|
|
71
|
+
return 'Null';
|
|
72
|
+
}
|
|
73
|
+
if (typeof x === 'undefined') {
|
|
74
|
+
return 'Undefined';
|
|
75
|
+
}
|
|
76
|
+
if (typeof x === 'function' || typeof x === 'object') {
|
|
77
|
+
return 'Object';
|
|
78
|
+
}
|
|
79
|
+
if (typeof x === 'number') {
|
|
80
|
+
return 'Number';
|
|
81
|
+
}
|
|
82
|
+
if (typeof x === 'boolean') {
|
|
83
|
+
return 'Boolean';
|
|
84
|
+
}
|
|
85
|
+
if (typeof x === 'string') {
|
|
86
|
+
return 'String';
|
|
87
|
+
}
|
|
88
|
+
if (typeof x === 'symbol') {
|
|
89
|
+
return 'Symbol';
|
|
90
|
+
}
|
|
91
|
+
if (typeof x === 'bigint') {
|
|
92
|
+
return 'BigInt';
|
|
93
|
+
}
|
|
94
|
+
}
|
|
66
95
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
// Step 6.a: NaN == NaN
|
|
103
|
-
return x !== x && y !== y;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* https://www.ecma-international.org/ecma-262/11.0/index.html#sec-type
|
|
107
|
-
* @param x
|
|
108
|
-
*/
|
|
109
|
-
function Type(x) {
|
|
110
|
-
if (x === null) {
|
|
111
|
-
return 'Null';
|
|
112
|
-
}
|
|
113
|
-
if (typeof x === 'undefined') {
|
|
114
|
-
return 'Undefined';
|
|
115
|
-
}
|
|
116
|
-
if (typeof x === 'function' || typeof x === 'object') {
|
|
117
|
-
return 'Object';
|
|
118
|
-
}
|
|
119
|
-
if (typeof x === 'number') {
|
|
120
|
-
return 'Number';
|
|
121
|
-
}
|
|
122
|
-
if (typeof x === 'boolean') {
|
|
123
|
-
return 'Boolean';
|
|
124
|
-
}
|
|
125
|
-
if (typeof x === 'string') {
|
|
126
|
-
return 'String';
|
|
127
|
-
}
|
|
128
|
-
if (typeof x === 'symbol') {
|
|
129
|
-
return 'Symbol';
|
|
130
|
-
}
|
|
131
|
-
if (typeof x === 'bigint') {
|
|
132
|
-
return 'BigInt';
|
|
133
|
-
}
|
|
134
|
-
}
|
|
96
|
+
/**
|
|
97
|
+
* https://tc39.es/ecma402/#sec-partitionpattern
|
|
98
|
+
* @param pattern
|
|
99
|
+
*/
|
|
100
|
+
function PartitionPattern(pattern) {
|
|
101
|
+
var result = [];
|
|
102
|
+
var beginIndex = pattern.indexOf('{');
|
|
103
|
+
var endIndex = 0;
|
|
104
|
+
var nextIndex = 0;
|
|
105
|
+
var length = pattern.length;
|
|
106
|
+
while (beginIndex < pattern.length && beginIndex > -1) {
|
|
107
|
+
endIndex = pattern.indexOf('}', beginIndex);
|
|
108
|
+
invariant(endIndex > beginIndex, "Invalid pattern " + pattern);
|
|
109
|
+
if (beginIndex > nextIndex) {
|
|
110
|
+
result.push({
|
|
111
|
+
type: 'literal',
|
|
112
|
+
value: pattern.substring(nextIndex, beginIndex),
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
result.push({
|
|
116
|
+
type: pattern.substring(beginIndex + 1, endIndex),
|
|
117
|
+
value: undefined,
|
|
118
|
+
});
|
|
119
|
+
nextIndex = endIndex + 1;
|
|
120
|
+
beginIndex = pattern.indexOf('{', nextIndex);
|
|
121
|
+
}
|
|
122
|
+
if (nextIndex < length) {
|
|
123
|
+
result.push({
|
|
124
|
+
type: 'literal',
|
|
125
|
+
value: pattern.substring(nextIndex, length),
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
return result;
|
|
129
|
+
}
|
|
135
130
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
type: 'literal',
|
|
165
|
-
value: pattern.substring(nextIndex, length),
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
return result;
|
|
169
|
-
}
|
|
131
|
+
/**
|
|
132
|
+
* https://tc39.es/ecma402/#sec-getoption
|
|
133
|
+
* @param opts
|
|
134
|
+
* @param prop
|
|
135
|
+
* @param type
|
|
136
|
+
* @param values
|
|
137
|
+
* @param fallback
|
|
138
|
+
*/
|
|
139
|
+
function GetOption(opts, prop, type, values, fallback) {
|
|
140
|
+
// const descriptor = Object.getOwnPropertyDescriptor(opts, prop);
|
|
141
|
+
var value = opts[prop];
|
|
142
|
+
if (value !== undefined) {
|
|
143
|
+
if (type !== 'boolean' && type !== 'string') {
|
|
144
|
+
throw new TypeError('invalid type');
|
|
145
|
+
}
|
|
146
|
+
if (type === 'boolean') {
|
|
147
|
+
value = Boolean(value);
|
|
148
|
+
}
|
|
149
|
+
if (type === 'string') {
|
|
150
|
+
value = ToString(value);
|
|
151
|
+
}
|
|
152
|
+
if (values !== undefined && !values.filter(function (val) { return val == value; }).length) {
|
|
153
|
+
throw new RangeError(value + " is not within " + values.join(', '));
|
|
154
|
+
}
|
|
155
|
+
return value;
|
|
156
|
+
}
|
|
157
|
+
return fallback;
|
|
158
|
+
}
|
|
170
159
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
if (values !== undefined && !values.filter(function (val) { return val == value; }).length) {
|
|
193
|
-
throw new RangeError(value + " is not within " + values.join(', '));
|
|
194
|
-
}
|
|
195
|
-
return value;
|
|
196
|
-
}
|
|
197
|
-
return fallback;
|
|
198
|
-
}
|
|
160
|
+
/**
|
|
161
|
+
* https://tc39.es/ecma402/#sec-bestavailablelocale
|
|
162
|
+
* @param availableLocales
|
|
163
|
+
* @param locale
|
|
164
|
+
*/
|
|
165
|
+
function BestAvailableLocale(availableLocales, locale) {
|
|
166
|
+
var candidate = locale;
|
|
167
|
+
while (true) {
|
|
168
|
+
if (availableLocales.has(candidate)) {
|
|
169
|
+
return candidate;
|
|
170
|
+
}
|
|
171
|
+
var pos = candidate.lastIndexOf('-');
|
|
172
|
+
if (!~pos) {
|
|
173
|
+
return undefined;
|
|
174
|
+
}
|
|
175
|
+
if (pos >= 2 && candidate[pos - 2] === '-') {
|
|
176
|
+
pos -= 2;
|
|
177
|
+
}
|
|
178
|
+
candidate = candidate.slice(0, pos);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
199
181
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
182
|
+
/**
|
|
183
|
+
* https://tc39.es/ecma402/#sec-lookupmatcher
|
|
184
|
+
* @param availableLocales
|
|
185
|
+
* @param requestedLocales
|
|
186
|
+
* @param getDefaultLocale
|
|
187
|
+
*/
|
|
188
|
+
function LookupMatcher(availableLocales, requestedLocales, getDefaultLocale) {
|
|
189
|
+
var result = { locale: '' };
|
|
190
|
+
for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
|
|
191
|
+
var locale = requestedLocales_1[_i];
|
|
192
|
+
var noExtensionLocale = locale.replace(UNICODE_EXTENSION_SEQUENCE_REGEX, '');
|
|
193
|
+
var availableLocale = BestAvailableLocale(availableLocales, noExtensionLocale);
|
|
194
|
+
if (availableLocale) {
|
|
195
|
+
result.locale = availableLocale;
|
|
196
|
+
if (locale !== noExtensionLocale) {
|
|
197
|
+
result.extension = locale.slice(noExtensionLocale.length + 1, locale.length);
|
|
198
|
+
}
|
|
199
|
+
return result;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
result.locale = getDefaultLocale();
|
|
203
|
+
return result;
|
|
204
|
+
}
|
|
221
205
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
206
|
+
/**
|
|
207
|
+
* https://tc39.es/ecma402/#sec-bestfitmatcher
|
|
208
|
+
* @param availableLocales
|
|
209
|
+
* @param requestedLocales
|
|
210
|
+
* @param getDefaultLocale
|
|
211
|
+
*/
|
|
212
|
+
function BestFitMatcher(availableLocales, requestedLocales, getDefaultLocale) {
|
|
213
|
+
var minimizedAvailableLocaleMap = {};
|
|
214
|
+
var minimizedAvailableLocales = new Set();
|
|
215
|
+
availableLocales.forEach(function (locale) {
|
|
216
|
+
var minimizedLocale = new Intl.Locale(locale)
|
|
217
|
+
.minimize()
|
|
218
|
+
.toString();
|
|
219
|
+
minimizedAvailableLocaleMap[minimizedLocale] = locale;
|
|
220
|
+
minimizedAvailableLocales.add(minimizedLocale);
|
|
221
|
+
});
|
|
222
|
+
var foundLocale;
|
|
223
|
+
for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
|
|
224
|
+
var l = requestedLocales_1[_i];
|
|
225
|
+
if (foundLocale) {
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
var noExtensionLocale = l.replace(UNICODE_EXTENSION_SEQUENCE_REGEX, '');
|
|
229
|
+
if (availableLocales.has(noExtensionLocale)) {
|
|
230
|
+
foundLocale = noExtensionLocale;
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
if (minimizedAvailableLocales.has(noExtensionLocale)) {
|
|
234
|
+
foundLocale = minimizedAvailableLocaleMap[noExtensionLocale];
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
237
|
+
var locale = new Intl.Locale(noExtensionLocale);
|
|
238
|
+
var maximizedRequestedLocale = locale.maximize().toString();
|
|
239
|
+
var minimizedRequestedLocale = locale.minimize().toString();
|
|
240
|
+
// Check minimized locale
|
|
241
|
+
if (minimizedAvailableLocales.has(minimizedRequestedLocale)) {
|
|
242
|
+
foundLocale = minimizedAvailableLocaleMap[minimizedRequestedLocale];
|
|
243
|
+
break;
|
|
244
|
+
}
|
|
245
|
+
// Lookup algo on maximized locale
|
|
246
|
+
foundLocale = BestAvailableLocale(minimizedAvailableLocales, maximizedRequestedLocale);
|
|
247
|
+
}
|
|
248
|
+
return {
|
|
249
|
+
locale: foundLocale || getDefaultLocale(),
|
|
250
|
+
};
|
|
251
|
+
}
|
|
245
252
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
253
|
+
/**
|
|
254
|
+
* https://tc39.es/ecma402/#sec-unicodeextensionvalue
|
|
255
|
+
* @param extension
|
|
256
|
+
* @param key
|
|
257
|
+
*/
|
|
258
|
+
function UnicodeExtensionValue(extension, key) {
|
|
259
|
+
invariant(key.length === 2, 'key must have 2 elements');
|
|
260
|
+
var size = extension.length;
|
|
261
|
+
var searchValue = "-" + key + "-";
|
|
262
|
+
var pos = extension.indexOf(searchValue);
|
|
263
|
+
if (pos !== -1) {
|
|
264
|
+
var start = pos + 4;
|
|
265
|
+
var end = start;
|
|
266
|
+
var k = start;
|
|
267
|
+
var done = false;
|
|
268
|
+
while (!done) {
|
|
269
|
+
var e = extension.indexOf('-', k);
|
|
270
|
+
var len = void 0;
|
|
271
|
+
if (e === -1) {
|
|
272
|
+
len = size - k;
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
len = e - k;
|
|
276
|
+
}
|
|
277
|
+
if (len === 2) {
|
|
278
|
+
done = true;
|
|
279
|
+
}
|
|
280
|
+
else if (e === -1) {
|
|
281
|
+
end = size;
|
|
282
|
+
done = true;
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
end = e;
|
|
286
|
+
k = e + 1;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
return extension.slice(start, end);
|
|
290
|
+
}
|
|
291
|
+
searchValue = "-" + key;
|
|
292
|
+
pos = extension.indexOf(searchValue);
|
|
293
|
+
if (pos !== -1 && pos + 3 === size) {
|
|
294
|
+
return '';
|
|
295
|
+
}
|
|
296
|
+
return undefined;
|
|
297
|
+
}
|
|
269
298
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
299
|
+
/**
|
|
300
|
+
* https://tc39.es/ecma402/#sec-resolvelocale
|
|
301
|
+
*/
|
|
302
|
+
function ResolveLocale(availableLocales, requestedLocales, options, relevantExtensionKeys, localeData, getDefaultLocale) {
|
|
303
|
+
var matcher = options.localeMatcher;
|
|
304
|
+
var r;
|
|
305
|
+
if (matcher === 'lookup') {
|
|
306
|
+
r = LookupMatcher(availableLocales, requestedLocales, getDefaultLocale);
|
|
307
|
+
}
|
|
308
|
+
else {
|
|
309
|
+
r = BestFitMatcher(availableLocales, requestedLocales, getDefaultLocale);
|
|
310
|
+
}
|
|
311
|
+
var foundLocale = r.locale;
|
|
312
|
+
var result = { locale: '', dataLocale: foundLocale };
|
|
313
|
+
var supportedExtension = '-u';
|
|
314
|
+
for (var _i = 0, relevantExtensionKeys_1 = relevantExtensionKeys; _i < relevantExtensionKeys_1.length; _i++) {
|
|
315
|
+
var key = relevantExtensionKeys_1[_i];
|
|
316
|
+
invariant(foundLocale in localeData, "Missing locale data for " + foundLocale);
|
|
317
|
+
var foundLocaleData = localeData[foundLocale];
|
|
318
|
+
invariant(typeof foundLocaleData === 'object' && foundLocaleData !== null, "locale data " + key + " must be an object");
|
|
319
|
+
var keyLocaleData = foundLocaleData[key];
|
|
320
|
+
invariant(Array.isArray(keyLocaleData), "keyLocaleData for " + key + " must be an array");
|
|
321
|
+
var value = keyLocaleData[0];
|
|
322
|
+
invariant(typeof value === 'string' || value === null, "value must be string or null but got " + typeof value + " in key " + key);
|
|
323
|
+
var supportedExtensionAddition = '';
|
|
324
|
+
if (r.extension) {
|
|
325
|
+
var requestedValue = UnicodeExtensionValue(r.extension, key);
|
|
326
|
+
if (requestedValue !== undefined) {
|
|
327
|
+
if (requestedValue !== '') {
|
|
328
|
+
if (~keyLocaleData.indexOf(requestedValue)) {
|
|
329
|
+
value = requestedValue;
|
|
330
|
+
supportedExtensionAddition = "-" + key + "-" + value;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
else if (~requestedValue.indexOf('true')) {
|
|
334
|
+
value = 'true';
|
|
335
|
+
supportedExtensionAddition = "-" + key;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
if (key in options) {
|
|
340
|
+
var optionsValue = options[key];
|
|
341
|
+
invariant(typeof optionsValue === 'string' ||
|
|
342
|
+
typeof optionsValue === 'undefined' ||
|
|
343
|
+
optionsValue === null, 'optionsValue must be String, Undefined or Null');
|
|
344
|
+
if (~keyLocaleData.indexOf(optionsValue)) {
|
|
345
|
+
if (optionsValue !== value) {
|
|
346
|
+
value = optionsValue;
|
|
347
|
+
supportedExtensionAddition = '';
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
result[key] = value;
|
|
352
|
+
supportedExtension += supportedExtensionAddition;
|
|
353
|
+
}
|
|
354
|
+
if (supportedExtension.length > 2) {
|
|
355
|
+
var privateIndex = foundLocale.indexOf('-x-');
|
|
356
|
+
if (privateIndex === -1) {
|
|
357
|
+
foundLocale = foundLocale + supportedExtension;
|
|
358
|
+
}
|
|
359
|
+
else {
|
|
360
|
+
var preExtension = foundLocale.slice(0, privateIndex);
|
|
361
|
+
var postExtension = foundLocale.slice(privateIndex, foundLocale.length);
|
|
362
|
+
foundLocale = preExtension + supportedExtension + postExtension;
|
|
363
|
+
}
|
|
364
|
+
foundLocale = Intl.getCanonicalLocales(foundLocale)[0];
|
|
365
|
+
}
|
|
366
|
+
result.locale = foundLocale;
|
|
367
|
+
return result;
|
|
368
|
+
}
|
|
315
369
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
else if (~requestedValue.indexOf('true')) {
|
|
351
|
-
value = 'true';
|
|
352
|
-
supportedExtensionAddition = "-" + key;
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
if (key in options) {
|
|
357
|
-
var optionsValue = options[key];
|
|
358
|
-
invariant(typeof optionsValue === 'string' ||
|
|
359
|
-
typeof optionsValue === 'undefined' ||
|
|
360
|
-
optionsValue === null, 'optionsValue must be String, Undefined or Null');
|
|
361
|
-
if (~keyLocaleData.indexOf(optionsValue)) {
|
|
362
|
-
if (optionsValue !== value) {
|
|
363
|
-
value = optionsValue;
|
|
364
|
-
supportedExtensionAddition = '';
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
result[key] = value;
|
|
369
|
-
supportedExtension += supportedExtensionAddition;
|
|
370
|
-
}
|
|
371
|
-
if (supportedExtension.length > 2) {
|
|
372
|
-
var privateIndex = foundLocale.indexOf('-x-');
|
|
373
|
-
if (privateIndex === -1) {
|
|
374
|
-
foundLocale = foundLocale + supportedExtension;
|
|
375
|
-
}
|
|
376
|
-
else {
|
|
377
|
-
var preExtension = foundLocale.slice(0, privateIndex);
|
|
378
|
-
var postExtension = foundLocale.slice(privateIndex, foundLocale.length);
|
|
379
|
-
foundLocale = preExtension + supportedExtension + postExtension;
|
|
380
|
-
}
|
|
381
|
-
foundLocale = Intl.getCanonicalLocales(foundLocale)[0];
|
|
382
|
-
}
|
|
383
|
-
result.locale = foundLocale;
|
|
384
|
-
return result;
|
|
385
|
-
}
|
|
370
|
+
/**
|
|
371
|
+
* https://tc39.es/proposal-intl-relative-time/#sec-singularrelativetimeunit
|
|
372
|
+
* @param unit
|
|
373
|
+
*/
|
|
374
|
+
function SingularRelativeTimeUnit(unit) {
|
|
375
|
+
invariant(Type(unit) === 'String', 'unit must be a string');
|
|
376
|
+
if (unit === 'seconds')
|
|
377
|
+
return 'second';
|
|
378
|
+
if (unit === 'minutes')
|
|
379
|
+
return 'minute';
|
|
380
|
+
if (unit === 'hours')
|
|
381
|
+
return 'hour';
|
|
382
|
+
if (unit === 'days')
|
|
383
|
+
return 'day';
|
|
384
|
+
if (unit === 'weeks')
|
|
385
|
+
return 'week';
|
|
386
|
+
if (unit === 'months')
|
|
387
|
+
return 'month';
|
|
388
|
+
if (unit === 'quarters')
|
|
389
|
+
return 'quarter';
|
|
390
|
+
if (unit === 'years')
|
|
391
|
+
return 'year';
|
|
392
|
+
if (unit !== 'second' &&
|
|
393
|
+
unit !== 'minute' &&
|
|
394
|
+
unit !== 'hour' &&
|
|
395
|
+
unit !== 'day' &&
|
|
396
|
+
unit !== 'week' &&
|
|
397
|
+
unit !== 'month' &&
|
|
398
|
+
unit !== 'quarter' &&
|
|
399
|
+
unit !== 'year') {
|
|
400
|
+
throw new RangeError('invalid unit');
|
|
401
|
+
}
|
|
402
|
+
return unit;
|
|
403
|
+
}
|
|
386
404
|
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
unit !== 'day' &&
|
|
413
|
-
unit !== 'week' &&
|
|
414
|
-
unit !== 'month' &&
|
|
415
|
-
unit !== 'quarter' &&
|
|
416
|
-
unit !== 'year') {
|
|
417
|
-
throw new RangeError('invalid unit');
|
|
418
|
-
}
|
|
419
|
-
return unit;
|
|
420
|
-
}
|
|
405
|
+
function MakePartsList(pattern, unit, parts) {
|
|
406
|
+
var patternParts = PartitionPattern(pattern);
|
|
407
|
+
var result = [];
|
|
408
|
+
for (var _i = 0, patternParts_1 = patternParts; _i < patternParts_1.length; _i++) {
|
|
409
|
+
var patternPart = patternParts_1[_i];
|
|
410
|
+
if (patternPart.type === 'literal') {
|
|
411
|
+
result.push({
|
|
412
|
+
type: 'literal',
|
|
413
|
+
value: patternPart.value,
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
else {
|
|
417
|
+
invariant(patternPart.type === '0', "Malformed pattern " + pattern);
|
|
418
|
+
for (var _a = 0, parts_1 = parts; _a < parts_1.length; _a++) {
|
|
419
|
+
var part = parts_1[_a];
|
|
420
|
+
result.push({
|
|
421
|
+
type: part.type,
|
|
422
|
+
value: part.value,
|
|
423
|
+
unit: unit,
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
return result;
|
|
429
|
+
}
|
|
421
430
|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
431
|
+
function PartitionRelativeTimePattern(rtf, value, unit, _a) {
|
|
432
|
+
var getInternalSlots = _a.getInternalSlots;
|
|
433
|
+
invariant(Type(value) === 'Number', "value must be number, instead got " + typeof value, TypeError);
|
|
434
|
+
invariant(Type(unit) === 'String', "unit must be number, instead got " + typeof value, TypeError);
|
|
435
|
+
if (isNaN(value) || !isFinite(value)) {
|
|
436
|
+
throw new RangeError("Invalid value " + value);
|
|
437
|
+
}
|
|
438
|
+
var resolvedUnit = SingularRelativeTimeUnit(unit);
|
|
439
|
+
var _b = getInternalSlots(rtf), fields = _b.fields, style = _b.style, numeric = _b.numeric, pluralRules = _b.pluralRules, numberFormat = _b.numberFormat;
|
|
440
|
+
var entry = resolvedUnit;
|
|
441
|
+
if (style === 'short') {
|
|
442
|
+
entry = resolvedUnit + "-short";
|
|
443
|
+
}
|
|
444
|
+
else if (style === 'narrow') {
|
|
445
|
+
entry = resolvedUnit + "-narrow";
|
|
446
|
+
}
|
|
447
|
+
if (!(entry in fields)) {
|
|
448
|
+
entry = resolvedUnit;
|
|
449
|
+
}
|
|
450
|
+
var patterns = fields[entry];
|
|
451
|
+
if (numeric === 'auto') {
|
|
452
|
+
if (ToString(value) in patterns) {
|
|
453
|
+
return [
|
|
454
|
+
{
|
|
455
|
+
type: 'literal',
|
|
456
|
+
value: patterns[ToString(value)],
|
|
457
|
+
},
|
|
458
|
+
];
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
var tl = 'future';
|
|
462
|
+
if (SameValue(value, -0) || value < 0) {
|
|
463
|
+
tl = 'past';
|
|
464
|
+
}
|
|
465
|
+
var po = patterns[tl];
|
|
466
|
+
var fv = typeof numberFormat.formatToParts === 'function'
|
|
467
|
+
? numberFormat.formatToParts(Math.abs(value))
|
|
468
|
+
: // TODO: If formatToParts is not supported, we assume the whole formatted
|
|
469
|
+
// number is a part
|
|
470
|
+
[
|
|
471
|
+
{
|
|
472
|
+
type: 'literal',
|
|
473
|
+
value: numberFormat.format(Math.abs(value)),
|
|
474
|
+
unit: unit,
|
|
475
|
+
},
|
|
476
|
+
];
|
|
477
|
+
var pr = pluralRules.select(value);
|
|
478
|
+
var pattern = po[pr];
|
|
479
|
+
return MakePartsList(pattern, resolvedUnit, fv);
|
|
480
|
+
}
|
|
447
481
|
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
var tl = 'future';
|
|
479
|
-
if (SameValue(value, -0) || value < 0) {
|
|
480
|
-
tl = 'past';
|
|
481
|
-
}
|
|
482
|
-
var po = patterns[tl];
|
|
483
|
-
var fv = typeof numberFormat.formatToParts === 'function'
|
|
484
|
-
? numberFormat.formatToParts(Math.abs(value))
|
|
485
|
-
: // TODO: If formatToParts is not supported, we assume the whole formatted
|
|
486
|
-
// number is a part
|
|
487
|
-
[
|
|
488
|
-
{
|
|
489
|
-
type: 'literal',
|
|
490
|
-
value: numberFormat.format(Math.abs(value)),
|
|
491
|
-
unit: unit,
|
|
492
|
-
},
|
|
493
|
-
];
|
|
494
|
-
var pr = pluralRules.select(value);
|
|
495
|
-
var pattern = po[pr];
|
|
496
|
-
return MakePartsList(pattern, resolvedUnit, fv);
|
|
497
|
-
}
|
|
482
|
+
var NUMBERING_SYSTEM_REGEX = /^[a-z0-9]{3,8}(-[a-z0-9]{3,8})*$/i;
|
|
483
|
+
function InitializeRelativeTimeFormat(rtf, locales, options, _a) {
|
|
484
|
+
var getInternalSlots = _a.getInternalSlots, availableLocales = _a.availableLocales, relevantExtensionKeys = _a.relevantExtensionKeys, localeData = _a.localeData, getDefaultLocale = _a.getDefaultLocale;
|
|
485
|
+
var internalSlots = getInternalSlots(rtf);
|
|
486
|
+
internalSlots.initializedRelativeTimeFormat = true;
|
|
487
|
+
var requestedLocales = CanonicalizeLocaleList(locales);
|
|
488
|
+
var opt = Object.create(null);
|
|
489
|
+
var opts = options === undefined ? Object.create(null) : ToObject(options);
|
|
490
|
+
var matcher = GetOption(opts, 'localeMatcher', 'string', ['best fit', 'lookup'], 'best fit');
|
|
491
|
+
opt.localeMatcher = matcher;
|
|
492
|
+
var numberingSystem = GetOption(opts, 'numberingSystem', 'string', undefined, undefined);
|
|
493
|
+
if (numberingSystem !== undefined) {
|
|
494
|
+
if (!NUMBERING_SYSTEM_REGEX.test(numberingSystem)) {
|
|
495
|
+
throw new RangeError("Invalid numbering system " + numberingSystem);
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
opt.nu = numberingSystem;
|
|
499
|
+
var r = ResolveLocale(availableLocales, requestedLocales, opt, relevantExtensionKeys, localeData, getDefaultLocale);
|
|
500
|
+
var locale = r.locale, nu = r.nu;
|
|
501
|
+
internalSlots.locale = locale;
|
|
502
|
+
internalSlots.style = GetOption(opts, 'style', 'string', ['long', 'narrow', 'short'], 'long');
|
|
503
|
+
internalSlots.numeric = GetOption(opts, 'numeric', 'string', ['always', 'auto'], 'always');
|
|
504
|
+
var fields = localeData[r.dataLocale];
|
|
505
|
+
invariant(!!fields, "Missing locale data for " + r.dataLocale);
|
|
506
|
+
internalSlots.fields = fields;
|
|
507
|
+
internalSlots.numberFormat = new Intl.NumberFormat(locales);
|
|
508
|
+
internalSlots.pluralRules = new Intl.PluralRules(locales);
|
|
509
|
+
internalSlots.numberingSystem = nu;
|
|
510
|
+
return rtf;
|
|
511
|
+
}
|
|
498
512
|
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
var r = ResolveLocale(availableLocales, requestedLocales, opt, relevantExtensionKeys, localeData, getDefaultLocale);
|
|
517
|
-
var locale = r.locale, nu = r.nu;
|
|
518
|
-
internalSlots.locale = locale;
|
|
519
|
-
internalSlots.style = GetOption(opts, 'style', 'string', ['long', 'narrow', 'short'], 'long');
|
|
520
|
-
internalSlots.numeric = GetOption(opts, 'numeric', 'string', ['always', 'auto'], 'always');
|
|
521
|
-
var fields = localeData[locale];
|
|
522
|
-
invariant(!!fields, "Missing locale data for " + locale);
|
|
523
|
-
internalSlots.fields = fields;
|
|
524
|
-
internalSlots.numberFormat = new Intl.NumberFormat(locales);
|
|
525
|
-
internalSlots.pluralRules = new Intl.PluralRules(locales);
|
|
526
|
-
internalSlots.numberingSystem = nu;
|
|
527
|
-
return rtf;
|
|
528
|
-
}
|
|
513
|
+
/**
|
|
514
|
+
* https://tc39.es/ecma402/#sec-lookupsupportedlocales
|
|
515
|
+
* @param availableLocales
|
|
516
|
+
* @param requestedLocales
|
|
517
|
+
*/
|
|
518
|
+
function LookupSupportedLocales(availableLocales, requestedLocales) {
|
|
519
|
+
var subset = [];
|
|
520
|
+
for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
|
|
521
|
+
var locale = requestedLocales_1[_i];
|
|
522
|
+
var noExtensionLocale = locale.replace(UNICODE_EXTENSION_SEQUENCE_REGEX, '');
|
|
523
|
+
var availableLocale = BestAvailableLocale(availableLocales, noExtensionLocale);
|
|
524
|
+
if (availableLocale) {
|
|
525
|
+
subset.push(availableLocale);
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
return subset;
|
|
529
|
+
}
|
|
529
530
|
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
531
|
+
/**
|
|
532
|
+
* https://tc39.es/ecma402/#sec-supportedlocales
|
|
533
|
+
* @param availableLocales
|
|
534
|
+
* @param requestedLocales
|
|
535
|
+
* @param options
|
|
536
|
+
*/
|
|
537
|
+
function SupportedLocales(availableLocales, requestedLocales, options) {
|
|
538
|
+
var matcher = 'best fit';
|
|
539
|
+
if (options !== undefined) {
|
|
540
|
+
options = ToObject(options);
|
|
541
|
+
matcher = GetOption(options, 'localeMatcher', 'string', ['lookup', 'best fit'], 'best fit');
|
|
542
|
+
}
|
|
543
|
+
if (matcher === 'best fit') {
|
|
544
|
+
return LookupSupportedLocales(availableLocales, requestedLocales);
|
|
545
|
+
}
|
|
546
|
+
return LookupSupportedLocales(availableLocales, requestedLocales);
|
|
547
|
+
}
|
|
547
548
|
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
}
|
|
560
|
-
if (matcher === 'best fit') {
|
|
561
|
-
return LookupSupportedLocales(availableLocales, requestedLocales);
|
|
562
|
-
}
|
|
563
|
-
return LookupSupportedLocales(availableLocales, requestedLocales);
|
|
564
|
-
}
|
|
549
|
+
// Type-only circular import
|
|
550
|
+
// eslint-disable-next-line import/no-cycle
|
|
551
|
+
var internalSlotMap = new WeakMap();
|
|
552
|
+
function getInternalSlots(x) {
|
|
553
|
+
var internalSlots = internalSlotMap.get(x);
|
|
554
|
+
if (!internalSlots) {
|
|
555
|
+
internalSlots = Object.create(null);
|
|
556
|
+
internalSlotMap.set(x, internalSlots);
|
|
557
|
+
}
|
|
558
|
+
return internalSlots;
|
|
559
|
+
}
|
|
565
560
|
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
561
|
+
var RelativeTimeFormat = /** @class */ (function () {
|
|
562
|
+
function RelativeTimeFormat(locales, options) {
|
|
563
|
+
// test262/test/intl402/RelativeTimeFormat/constructor/constructor/newtarget-undefined.js
|
|
564
|
+
// Cannot use `new.target` bc of IE11 & TS transpiles it to something else
|
|
565
|
+
var newTarget = this && this instanceof RelativeTimeFormat ? this.constructor : void 0;
|
|
566
|
+
if (!newTarget) {
|
|
567
|
+
throw new TypeError("Intl.RelativeTimeFormat must be called with 'new'");
|
|
568
|
+
}
|
|
569
|
+
return InitializeRelativeTimeFormat(this, locales, options, {
|
|
570
|
+
getInternalSlots: getInternalSlots,
|
|
571
|
+
availableLocales: RelativeTimeFormat.availableLocales,
|
|
572
|
+
relevantExtensionKeys: RelativeTimeFormat.relevantExtensionKeys,
|
|
573
|
+
localeData: RelativeTimeFormat.localeData,
|
|
574
|
+
getDefaultLocale: RelativeTimeFormat.getDefaultLocale,
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
RelativeTimeFormat.prototype.format = function (value, unit) {
|
|
578
|
+
if (typeof this !== 'object') {
|
|
579
|
+
throw new TypeError('format was called on a non-object');
|
|
580
|
+
}
|
|
581
|
+
var internalSlots = getInternalSlots(this);
|
|
582
|
+
if (!internalSlots.initializedRelativeTimeFormat) {
|
|
583
|
+
throw new TypeError('format was called on a invalid context');
|
|
584
|
+
}
|
|
585
|
+
return PartitionRelativeTimePattern(this, Number(value), ToString(unit), {
|
|
586
|
+
getInternalSlots: getInternalSlots,
|
|
587
|
+
})
|
|
588
|
+
.map(function (el) { return el.value; })
|
|
589
|
+
.join('');
|
|
590
|
+
};
|
|
591
|
+
RelativeTimeFormat.prototype.formatToParts = function (value, unit) {
|
|
592
|
+
if (typeof this !== 'object') {
|
|
593
|
+
throw new TypeError('formatToParts was called on a non-object');
|
|
594
|
+
}
|
|
595
|
+
var internalSlots = getInternalSlots(this);
|
|
596
|
+
if (!internalSlots.initializedRelativeTimeFormat) {
|
|
597
|
+
throw new TypeError('formatToParts was called on a invalid context');
|
|
598
|
+
}
|
|
599
|
+
return PartitionRelativeTimePattern(this, Number(value), ToString(unit), { getInternalSlots: getInternalSlots });
|
|
600
|
+
};
|
|
601
|
+
RelativeTimeFormat.prototype.resolvedOptions = function () {
|
|
602
|
+
if (typeof this !== 'object') {
|
|
603
|
+
throw new TypeError('resolvedOptions was called on a non-object');
|
|
604
|
+
}
|
|
605
|
+
var internalSlots = getInternalSlots(this);
|
|
606
|
+
if (!internalSlots.initializedRelativeTimeFormat) {
|
|
607
|
+
throw new TypeError('resolvedOptions was called on a invalid context');
|
|
608
|
+
}
|
|
609
|
+
// test262/test/intl402/RelativeTimeFormat/prototype/resolvedOptions/type.js
|
|
610
|
+
return {
|
|
611
|
+
locale: internalSlots.locale,
|
|
612
|
+
style: internalSlots.style,
|
|
613
|
+
numeric: internalSlots.numeric,
|
|
614
|
+
numberingSystem: internalSlots.numberingSystem,
|
|
615
|
+
};
|
|
616
|
+
};
|
|
617
|
+
RelativeTimeFormat.supportedLocalesOf = function (locales, options) {
|
|
618
|
+
return SupportedLocales(RelativeTimeFormat.availableLocales, CanonicalizeLocaleList(locales), options);
|
|
619
|
+
};
|
|
620
|
+
RelativeTimeFormat.__addLocaleData = function () {
|
|
621
|
+
var data = [];
|
|
622
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
623
|
+
data[_i] = arguments[_i];
|
|
624
|
+
}
|
|
625
|
+
for (var _a = 0, data_1 = data; _a < data_1.length; _a++) {
|
|
626
|
+
var _b = data_1[_a], d = _b.data, locale = _b.locale;
|
|
627
|
+
var minimizedLocale = new Intl.Locale(locale)
|
|
628
|
+
.minimize()
|
|
629
|
+
.toString();
|
|
630
|
+
RelativeTimeFormat.localeData[locale] = RelativeTimeFormat.localeData[minimizedLocale] = d;
|
|
631
|
+
RelativeTimeFormat.availableLocales.add(minimizedLocale);
|
|
632
|
+
RelativeTimeFormat.availableLocales.add(locale);
|
|
633
|
+
if (!RelativeTimeFormat.__defaultLocale) {
|
|
634
|
+
RelativeTimeFormat.__defaultLocale = minimizedLocale;
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
};
|
|
638
|
+
RelativeTimeFormat.getDefaultLocale = function () {
|
|
639
|
+
return RelativeTimeFormat.__defaultLocale;
|
|
640
|
+
};
|
|
641
|
+
RelativeTimeFormat.localeData = {};
|
|
642
|
+
RelativeTimeFormat.availableLocales = new Set();
|
|
643
|
+
RelativeTimeFormat.__defaultLocale = '';
|
|
644
|
+
RelativeTimeFormat.relevantExtensionKeys = ['nu'];
|
|
645
|
+
RelativeTimeFormat.polyfilled = true;
|
|
646
|
+
return RelativeTimeFormat;
|
|
647
|
+
}());
|
|
648
|
+
try {
|
|
649
|
+
// IE11 does not have Symbol
|
|
650
|
+
if (typeof Symbol !== 'undefined') {
|
|
651
|
+
Object.defineProperty(RelativeTimeFormat.prototype, Symbol.toStringTag, {
|
|
652
|
+
value: 'Intl.RelativeTimeFormat',
|
|
653
|
+
writable: false,
|
|
654
|
+
enumerable: false,
|
|
655
|
+
configurable: true,
|
|
656
|
+
});
|
|
657
|
+
}
|
|
658
|
+
// https://github.com/tc39/test262/blob/master/test/intl402/RelativeTimeFormat/constructor/length.js
|
|
659
|
+
Object.defineProperty(RelativeTimeFormat.prototype.constructor, 'length', {
|
|
660
|
+
value: 0,
|
|
661
|
+
writable: false,
|
|
662
|
+
enumerable: false,
|
|
663
|
+
configurable: true,
|
|
664
|
+
});
|
|
665
|
+
// https://github.com/tc39/test262/blob/master/test/intl402/RelativeTimeFormat/constructor/supportedLocalesOf/length.js
|
|
666
|
+
Object.defineProperty(RelativeTimeFormat.supportedLocalesOf, 'length', {
|
|
667
|
+
value: 1,
|
|
668
|
+
writable: false,
|
|
669
|
+
enumerable: false,
|
|
670
|
+
configurable: true,
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
catch (e) {
|
|
674
|
+
// Meta fix so we're test262-compliant, not important
|
|
675
|
+
}
|
|
600
676
|
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
function getInternalSlots(x) {
|
|
605
|
-
var internalSlots = internalSlotMap.get(x);
|
|
606
|
-
if (!internalSlots) {
|
|
607
|
-
internalSlots = Object.create(null);
|
|
608
|
-
internalSlotMap.set(x, internalSlots);
|
|
609
|
-
}
|
|
610
|
-
return internalSlots;
|
|
611
|
-
}
|
|
677
|
+
function shouldPolyfill() {
|
|
678
|
+
return typeof Intl === 'undefined' || !('RelativeTimeFormat' in Intl);
|
|
679
|
+
}
|
|
612
680
|
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
return InitializeRelativeTimeFormat(this, locales, options, {
|
|
622
|
-
getInternalSlots: getInternalSlots,
|
|
623
|
-
availableLocales: RelativeTimeFormat.availableLocales,
|
|
624
|
-
relevantExtensionKeys: RelativeTimeFormat.relevantExtensionKeys,
|
|
625
|
-
localeData: RelativeTimeFormat.localeData,
|
|
626
|
-
getDefaultLocale: RelativeTimeFormat.getDefaultLocale,
|
|
627
|
-
});
|
|
628
|
-
}
|
|
629
|
-
RelativeTimeFormat.prototype.format = function (value, unit) {
|
|
630
|
-
if (typeof this !== 'object') {
|
|
631
|
-
throw new TypeError('format was called on a non-object');
|
|
632
|
-
}
|
|
633
|
-
var internalSlots = getInternalSlots(this);
|
|
634
|
-
if (!internalSlots.initializedRelativeTimeFormat) {
|
|
635
|
-
throw new TypeError('format was called on a invalid context');
|
|
636
|
-
}
|
|
637
|
-
return PartitionRelativeTimePattern(this, Number(value), ToString(unit), {
|
|
638
|
-
getInternalSlots: getInternalSlots,
|
|
639
|
-
})
|
|
640
|
-
.map(function (el) { return el.value; })
|
|
641
|
-
.join('');
|
|
642
|
-
};
|
|
643
|
-
RelativeTimeFormat.prototype.formatToParts = function (value, unit) {
|
|
644
|
-
if (typeof this !== 'object') {
|
|
645
|
-
throw new TypeError('formatToParts was called on a non-object');
|
|
646
|
-
}
|
|
647
|
-
var internalSlots = getInternalSlots(this);
|
|
648
|
-
if (!internalSlots.initializedRelativeTimeFormat) {
|
|
649
|
-
throw new TypeError('formatToParts was called on a invalid context');
|
|
650
|
-
}
|
|
651
|
-
return PartitionRelativeTimePattern(this, Number(value), ToString(unit), { getInternalSlots: getInternalSlots });
|
|
652
|
-
};
|
|
653
|
-
RelativeTimeFormat.prototype.resolvedOptions = function () {
|
|
654
|
-
if (typeof this !== 'object') {
|
|
655
|
-
throw new TypeError('resolvedOptions was called on a non-object');
|
|
656
|
-
}
|
|
657
|
-
var internalSlots = getInternalSlots(this);
|
|
658
|
-
if (!internalSlots.initializedRelativeTimeFormat) {
|
|
659
|
-
throw new TypeError('resolvedOptions was called on a invalid context');
|
|
660
|
-
}
|
|
661
|
-
// test262/test/intl402/RelativeTimeFormat/prototype/resolvedOptions/type.js
|
|
662
|
-
return {
|
|
663
|
-
locale: internalSlots.locale,
|
|
664
|
-
style: internalSlots.style,
|
|
665
|
-
numeric: internalSlots.numeric,
|
|
666
|
-
numberingSystem: internalSlots.numberingSystem,
|
|
667
|
-
};
|
|
668
|
-
};
|
|
669
|
-
RelativeTimeFormat.supportedLocalesOf = function (locales, options) {
|
|
670
|
-
return SupportedLocales(RelativeTimeFormat.availableLocales, CanonicalizeLocaleList(locales), options);
|
|
671
|
-
};
|
|
672
|
-
RelativeTimeFormat.__addLocaleData = function () {
|
|
673
|
-
var data = [];
|
|
674
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
675
|
-
data[_i] = arguments[_i];
|
|
676
|
-
}
|
|
677
|
-
var _loop_1 = function (datum) {
|
|
678
|
-
var availableLocales = datum.availableLocales;
|
|
679
|
-
availableLocales.forEach(function (locale) {
|
|
680
|
-
try {
|
|
681
|
-
RelativeTimeFormat.localeData[locale] = unpackData(locale, datum);
|
|
682
|
-
}
|
|
683
|
-
catch (e) {
|
|
684
|
-
if (isMissingLocaleDataError(e)) {
|
|
685
|
-
// If we just don't have data for certain locale, that's ok
|
|
686
|
-
return;
|
|
687
|
-
}
|
|
688
|
-
throw e;
|
|
689
|
-
}
|
|
690
|
-
});
|
|
691
|
-
};
|
|
692
|
-
for (var _a = 0, data_1 = data; _a < data_1.length; _a++) {
|
|
693
|
-
var datum = data_1[_a];
|
|
694
|
-
_loop_1(datum);
|
|
695
|
-
}
|
|
696
|
-
RelativeTimeFormat.availableLocales = Object.keys(RelativeTimeFormat.localeData);
|
|
697
|
-
if (!RelativeTimeFormat.__defaultLocale) {
|
|
698
|
-
RelativeTimeFormat.__defaultLocale =
|
|
699
|
-
RelativeTimeFormat.availableLocales[0];
|
|
700
|
-
}
|
|
701
|
-
};
|
|
702
|
-
RelativeTimeFormat.getDefaultLocale = function () {
|
|
703
|
-
return RelativeTimeFormat.__defaultLocale;
|
|
704
|
-
};
|
|
705
|
-
RelativeTimeFormat.localeData = {};
|
|
706
|
-
RelativeTimeFormat.availableLocales = [];
|
|
707
|
-
RelativeTimeFormat.__defaultLocale = 'en';
|
|
708
|
-
RelativeTimeFormat.relevantExtensionKeys = ['nu'];
|
|
709
|
-
RelativeTimeFormat.polyfilled = true;
|
|
710
|
-
return RelativeTimeFormat;
|
|
711
|
-
}());
|
|
712
|
-
try {
|
|
713
|
-
// IE11 does not have Symbol
|
|
714
|
-
if (typeof Symbol !== 'undefined') {
|
|
715
|
-
Object.defineProperty(RelativeTimeFormat.prototype, Symbol.toStringTag, {
|
|
716
|
-
value: 'Intl.RelativeTimeFormat',
|
|
717
|
-
writable: false,
|
|
718
|
-
enumerable: false,
|
|
719
|
-
configurable: true,
|
|
720
|
-
});
|
|
721
|
-
}
|
|
722
|
-
// https://github.com/tc39/test262/blob/master/test/intl402/RelativeTimeFormat/constructor/length.js
|
|
723
|
-
Object.defineProperty(RelativeTimeFormat.prototype.constructor, 'length', {
|
|
724
|
-
value: 0,
|
|
725
|
-
writable: false,
|
|
726
|
-
enumerable: false,
|
|
727
|
-
configurable: true,
|
|
728
|
-
});
|
|
729
|
-
// https://github.com/tc39/test262/blob/master/test/intl402/RelativeTimeFormat/constructor/supportedLocalesOf/length.js
|
|
730
|
-
Object.defineProperty(RelativeTimeFormat.supportedLocalesOf, 'length', {
|
|
731
|
-
value: 1,
|
|
732
|
-
writable: false,
|
|
733
|
-
enumerable: false,
|
|
734
|
-
configurable: true,
|
|
735
|
-
});
|
|
736
|
-
}
|
|
737
|
-
catch (e) {
|
|
738
|
-
// Meta fix so we're test262-compliant, not important
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
function shouldPolyfill() {
|
|
742
|
-
return typeof Intl === 'undefined' || !('RelativeTimeFormat' in Intl);
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
if (shouldPolyfill()) {
|
|
746
|
-
Object.defineProperty(Intl, 'RelativeTimeFormat', {
|
|
747
|
-
value: RelativeTimeFormat,
|
|
748
|
-
writable: true,
|
|
749
|
-
enumerable: false,
|
|
750
|
-
configurable: true,
|
|
751
|
-
});
|
|
752
|
-
}
|
|
681
|
+
if (shouldPolyfill()) {
|
|
682
|
+
Object.defineProperty(Intl, 'RelativeTimeFormat', {
|
|
683
|
+
value: RelativeTimeFormat,
|
|
684
|
+
writable: true,
|
|
685
|
+
enumerable: false,
|
|
686
|
+
configurable: true,
|
|
687
|
+
});
|
|
688
|
+
}
|
|
753
689
|
|
|
754
690
|
})));
|
|
755
691
|
//# sourceMappingURL=polyfill.umd.js.map
|