UNPKG

@sheerid/jslib-nightly

Version:

SheerID JavaScript Library

1,184 lines (1,183 loc) • 987 kB
/** * WARNING: This file is intended to be used within MySheerID. * This file is not intended for use in other contexts and there are no guarantees about its behavior outside of MySheerID. */ /** * VERSION: 2.230.0-alpha.0 * BUILD_TIMESTAMP: 1778694697559 * BUILD_DATE: Wed May 13 2026 17:51:37 GMT+0000 (Coordinated Universal Time) * BUILD_COMMIT: 7af1c105d5485ac4ed1190c56d492bb4590667a9 */ function yx(e, t) { for (var r = 0; r < t.length; r++) { const o = t[r]; if (typeof o != "string" && !Array.isArray(o)) { for (const i in o) if (i !== "default" && !(i in e)) { const a = Object.getOwnPropertyDescriptor(o, i); a && Object.defineProperty(e, i, a.get ? a : { enumerable: !0, get: () => o[i] }); } } } return Object.freeze(Object.defineProperty(e, Symbol.toStringTag, { value: "Module" })); } var nu = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; function Nr(e) { return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e; } var id, uv; function vx() { if (uv) return id; uv = 1, id = r, r.flatten = r, r.unflatten = o; function e(i) { return i && i.constructor && typeof i.constructor.isBuffer == "function" && i.constructor.isBuffer(i); } function t(i) { return i; } function r(i, a) { a = a || {}; const u = a.delimiter || ".", c = a.maxDepth, d = a.transformKey || t, p = {}; function m(h, v, S) { S = S || 1, Object.keys(h).forEach(function(b) { const E = h[b], I = a.safe && Array.isArray(E), P = Object.prototype.toString.call(E), C = e(E), D = P === "[object Object]" || P === "[object Array]", k = v ? v + u + d(b) : d(b); if (!I && !C && D && Object.keys(E).length && (!a.maxDepth || S < c)) return m(E, k, S + 1); p[k] = E; }); } return m(i), p; } function o(i, a) { a = a || {}; const u = a.delimiter || ".", c = a.overwrite || !1, d = a.transformKey || t, p = {}; if (e(i) || Object.prototype.toString.call(i) !== "[object Object]") return i; function h(b) { const E = Number(b); return isNaN(E) || b.indexOf(".") !== -1 || a.object ? b : E; } function v(b, E, I) { return Object.keys(I).reduce(function(P, C) { return P[b + u + C] = I[C], P; }, E); } function S(b) { const E = Object.prototype.toString.call(b), I = E === "[object Array]", P = E === "[object Object]"; if (b) { if (I) return !b.length; if (P) return !Object.keys(b).length; } else return !0; } return i = Object.keys(i).reduce(function(b, E) { const I = Object.prototype.toString.call(i[E]); return !(I === "[object Object]" || I === "[object Array]") || S(i[E]) ? (b[E] = i[E], b) : v( E, b, r(i[E], a) ); }, {}), Object.keys(i).forEach(function(b) { const E = b.split(u).map(d); let I = h(E.shift()), P = h(E[0]), C = p; for (; P !== void 0; ) { if (I === "__proto__") return; const D = Object.prototype.toString.call(C[I]), k = D === "[object Object]" || D === "[object Array]"; if (!c && !k && typeof C[I] < "u") return; (c && !k || !c && C[I] == null) && (C[I] = typeof P == "number" && !a.object ? [] : {}), C = C[I], E.length > 0 && (I = h(E.shift()), P = h(E[0])); } C[I] = o(i[b], a); }), p; } return id; } var pa = vx(); const rb = /* @__PURE__ */ Nr(pa), nb = {}, ob = (e) => Object.entries(e).forEach(([t, r]) => { nb[t] = r; }), sb = async () => nb, zg = () => window.navigator.globalPrivacyControl, ga = () => window.NREUM && !zg(); let Hi = 4, ba = ""; const cv = { info: 1, log: 2, warn: 3, error: 4, silent: 5 }, Wi = { info: "#26c1db", log: "#09f979", warn: "#f6b13f", error: "#e12046" }, Gi = "color: white; font-weight: bold; padding: 2px 10px;"; let ab = () => ({}); const Sx = (e) => e && e.stack && e.message, ku = (...e) => { Hi <= 3 && console.warn(`%c${ba} warn`, `background: ${Wi.warn};${Gi}`, ...e); }, wx = (...e) => { Hi <= 2 && console.log(`%c${ba} log`, `background: ${Wi.log};${Gi}`, ...e); }, bx = (...e) => { Hi <= 1 && console.log(`%c${ba} info`, `background: ${Wi.info};${Gi}`, ...e); }, Ex = async (e, t = "unknown group", r = {}) => { if (Hi <= 4) { if (!e) { console.error(new Error("An error must be supplied")); return; } let o; typeof e == "string" && (o = new Error(e)), Sx(e) && (o = e), o || (o = new Error("Unknown error")); let i = { errorMessageGroup: t }; try { i = { ...await sb(), ...i }, delete i.jslibVersionActual; } catch (a) { ga() ? window.NREUM.noticeError(o, i) : ku("Unable to assemble GA error attributes", a); } try { const a = ab(); i = { ...i, ...a, ...r }; } catch (a) { ga() ? window.NREUM.noticeError(o, i) : ku("Unable to assemble useful error attributes", a); } ga() && window.NREUM.noticeError(o, i), console.error( `%c${ba} error`, `background: ${Wi.error};${Gi}`, o, i ); } }, Ix = (e, t = {}) => { ga() && window.NREUM.addPageAction(e, t); }, Mx = (e, t) => { Ix("API-calls-timing", { api_call: e, api_response_time: t }); }, q = { error: Ex, warn: ku, log: wx, info: bx, /** @deprecated use newRelicPageAction() instead */ logAPIResponseTime: Mx, setLogLevel: (e) => { if (!cv.hasOwnProperty(e)) throw new Error(`Unknown logLevel '${e}'`); Hi = cv[e], console.log( `%c${ba} log level set to ${e}`, // @ts-ignore `background: ${Wi[e]};${Gi}` ), ga() || ku("Offsite logging not enabled"); }, setPrefix: (e) => { ba = e; }, init: (e) => { ab = e; } }; function ft(e, t) { try { return e(); } catch { return t; } } let yg = {}, ib = []; const XV = (e, t) => { q.log( `customValidator registering ${t} for custom field '${e}'` ), yg[e] = t, ib.push(e); }, lb = (e) => yg[e] ? (q.log(`getCustomValidator returning '${e}'`), yg[e]) : (q.error( `Custom validator for field '${e}' does not exist. Has a custom validator been registered using the setCustomValidator method?`, "getCustomValidator" ), null), ec = () => ib; var ot = /* @__PURE__ */ ((e) => (e.collectStudentPersonalInfo = "collectStudentPersonalInfo", e.collectTeacherPersonalInfo = "collectTeacherPersonalInfo", e.collectMemberPersonalInfo = "collectMemberPersonalInfo", e.collectMilitaryStatus = "collectMilitaryStatus", e.collectActiveMilitaryPersonalInfo = "collectActiveMilitaryPersonalInfo", e.collectInactiveMilitaryPersonalInfo = "collectInactiveMilitaryPersonalInfo", e.collectSeniorPersonalInfo = "collectSeniorPersonalInfo", e.collectAgePersonalInfo = "collectAgePersonalInfo", e.collectFirstResponderPersonalInfo = "collectFirstResponderPersonalInfo", e.collectMedicalProfessionalPersonalInfo = "collectMedicalProfessionalPersonalInfo", e.collectEmployeePersonalInfo = "collectEmployeePersonalInfo", e.collectSocialSecurityNumber = "collectSocialSecurityNumber", e.cancelSocialSecurityNumber = "cancelSocialSecurityNumber", e.collectDriverLicensePersonalInfo = "collectDriverLicensePersonalInfo", e.collectGeneralIdentityPersonalInfo = "collectGeneralIdentityPersonalInfo", e.collectHybridIdentityPersonalInfo = "collectHybridIdentityPersonalInfo", e.collectLicensedProfessionalPersonalInfo = "collectLicensedProfessionalPersonalInfo", e.collectMoverPersonalInfo = "collectMoverPersonalInfo", e.collectLowIncomePersonalInfo = "collectLowIncomePersonalInfo", e.collectIdentifier = "collectIdentifier", e.collectPersonalInfo = "collectPersonalInfo", e.docUpload = "docUpload", e.pending = "pending", e.docReviewLimitExceeded = "docReviewLimitExceeded", e.success = "success", e.error = "error", e.sso = "sso", e.smsLoop = "smsLoop", e.emailLoop = "emailLoop", e.emailLoopCollectOrganizationEmail = "emailLoopCollectOrganizationEmail", e.completeAuthentication = "completeAuthentication", e.cancelEmailLoop = "cancelEmailLoop", e.idCheckLoop = "idCheckLoop", e.consolation = "consolation", e.override = "override", e.cancelDocUpload = "cancelDocUpload", e.missingRequiredMetadata = "missingRequiredMetadata", e.missingRequiredExternalId = "missingRequiredExternalId", e.thirdPartyLoop = "thirdPartyLoop", e))(ot || {}); const xx = Object.values(ot), Rx = [ "collectStudentPersonalInfo", "collectTeacherPersonalInfo", "collectMemberPersonalInfo", "collectMilitaryStatus", "collectActiveMilitaryPersonalInfo", "collectInactiveMilitaryPersonalInfo", "collectSeniorPersonalInfo", "collectAgePersonalInfo", "collectFirstResponderPersonalInfo", "collectMedicalProfessionalPersonalInfo", "collectEmployeePersonalInfo", "collectDriverLicensePersonalInfo", "collectGeneralIdentityPersonalInfo", "collectHybridIdentityPersonalInfo", "collectLicensedProfessionalPersonalInfo", "collectMoverPersonalInfo", "collectLowIncomePersonalInfo", "collectIdentifier", "collectPersonalInfo" /* collectPersonalInfo */ ]; var ub = /* @__PURE__ */ ((e) => (e.loading = "loading", e.collect = "collect", e))(ub || {}); const Px = [ "cancelDocUpload", "cancelEmailLoop", "cancelSocialSecurityNumber", "collectMilitaryStatus" /* collectMilitaryStatus */ // currently not a useful step to mock ]; [ ...Object.values(ot).filter( (e) => !Px.includes(e) ), ...Object.values(ub) ]; function Ho(e) { return Rx.includes(e); } const Tx = [ "ar", "bg", "bn-IN", "cs", "da", "de", "el", "en-GB", "en-US", "es-ES", "es", "fi", "fr-CA", "fr", "ga", "hi-IN", "hr", "hu", "id", "is", "it", "iw", "ja", "ko", "lo", "lt", "ms", "nl", "nl-BE", "no", "pl", "pt-BR", "pt", "ro", "ru", "sk", "sl", "sr", "sv", "sw", "uk", "ur", "vi", "th", "tr", "zh-HK", "zh", "zu" ], Hg = [...Tx], Cx = (e) => { q.info(`Registering additional locales ${e.join(", ")}`), Hg.push(...e); }; function Ax(e) { return e.currentStep === "success"; } var cb = /* @__PURE__ */ ((e) => (e.docUpload = "docUpload", e.pending = "pending", e.error = "error", e))(cb || {}); Object.values(cb); var _i = /* @__PURE__ */ ((e) => (e.loading = "loading", e.collect = "collect", e))(_i || {}); const Ox = [ "cancelDocUpload", "cancelEmailLoop", "cancelSocialSecurityNumber", "collectMilitaryStatus" // currently not a useful step to mock ], Nx = [ ...Object.values(ot).filter( (e) => !Ox.includes(e) ), ...Object.values(_i) ]; var kx = /* @__PURE__ */ ((e) => (e.TEXT = "TEXT", e.QR = "QR", e.PDF417 = "PDF417", e.UPC_A = "UPC_A", e.ITF = "ITF", e.CODE_128 = "CODE_128", e))(kx || {}), fb = /* @__PURE__ */ ((e) => (e.student = "collectStudentPersonalInfo", e.military = "collectMilitaryStatus", e.teacher = "collectTeacherPersonalInfo", e.firstResponder = "collectFirstResponderPersonalInfo", e.senior = "collectSeniorPersonalInfo", e.age = "collectAgePersonalInfo", e.medical = "collectMedicalProfessionalPersonalInfo", e.recentMover = "collectMoverPersonalInfo", e.licensedProfessional = "collectLicensedProfessionalPersonalInfo", e.identity = "collectGeneralIdentityPersonalInfo", e.member = "collectMemberPersonalInfo", e))(fb || {}), db = /* @__PURE__ */ ((e) => (e.STUDENT = "student", e.MILITARY = "military", e.TEACHER = "teacher", e.MEMBER = "member", e.SENIOR = "senior", e.AGE = "age", e.FIRST_RESPONDER = "firstResponder", e.MEDICAL = "medical", e.EMPLOYMENT = "employment", e.IDENTITY = "identity", e.LICENSED_PROFESSIONAL = "licensedProfessional", e.RECENT_MOVER = "recentMover", e.LOW_INCOME = "lowIncome", e))(db || {}); const Dx = Object.values(db); var pb = /* @__PURE__ */ ((e) => (e.ACTIVE_DUTY = "activeDuty", e.VETERAN = "veteran", e.RESERVIST = "reservist", e.MILITARY_RETIREE = "retiree", e.MILITARY_FAMILY = "militaryFamily", e.GOLD_STAR_FAMILY = "goldStarFamily", e.FIREFIGHTER = "fireFighter", e.POLICE = "police", e.EMT = "emt", e.NURSE = "nurse", e.DRIVER_LICENSE = "driverLicense", e.GENERAL_IDENTITY = "generalIdentity", e.HYBRID_IDENTITY = "hybridIdentity", e.HOME_BUYER = "homeBuyer", e.OTHER_MOVER = "otherMover", e.LICENSED_COSMETOLOGIST = "licensedCosmetologist", e.LICENSED_REAL_ESTATE_AGENT = "licensedRealEstateAgent", e.VETERINARIAN = "veterinarian", e.SNAP_BENEFITS = "snapBenefits", e.OTHER_GOVERNMENT_ASSISTANCE = "otherGovernmentAssistance", e.CHILD_CARE_WORKER = "childCareWorker", e.LIBRARIAN = "librarian", e.INTERIOR_DESIGNER = "interiorDesigner", e.ARCHITECT = "architect", e.GENERAL_CONTRACTOR = "generalContractor", e.NUTRITION_PROFESSIONAL = "nutritionProfessional", e))(pb || {}); Object.values(pb); const _x = { ACTIVE_DUTY: "Active Duty", MILITARY_RETIREE: "Military Retiree", RESERVIST: "Reservist or National Guard", VETERAN: "Military Veteran or Retiree", MILITARY_FAMILY: "Military Family", GOLD_STAR_FAMILY: "Gold Star Family" }, Lx = { FIREFIGHTER: "Firefighter", POLICE: "Police", EMT: "EMT", SEARCH_AND_RESCUE: "Search and Rescue" }, Fx = { NURSE: "Nurse", DOCTOR: "Doctor", OTHER_HEALTH_WORKER: "Other Health Worker", DENTIST: "Dentist", PHARMACIST: "Pharmacist" }, Ux = { SNAP_BENEFITS: "Snap Benefits Recipient", OTHER_GOVERNMENT_ASSISTANCE: "Other Government Assistance Recipient", COMMUNITY_ELIGIBILITY_PROVISION: "CEP (Community Eligibility Provision, Title 1/LAP)" }; var wt = /* @__PURE__ */ ((e) => (e.firstName = "firstName", e.lastName = "lastName", e.memberId = "memberId", e.organization = "organization", e.birthDate = "birthDate", e.email = "email", e.phoneNumber = "phoneNumber", e.postalCode = "postalCode", e.address1 = "address1", e.city = "city", e.country = "country", e.state = "state", e.dischargeDate = "dischargeDate", e.activeDutyStartDate = "activeDutyStartDate", e.docUpload = "docUpload", e.status = "status", e.statuses = "statuses", e.marketConsentValue = "marketConsentValue", e.socialSecurityNumber = "socialSecurityNumber", e.carrierConsentValue = "carrierConsentValue", e.driverLicenseNumber = "driverLicenseNumber", e.ebtCardNumber = "ebtCardNumber", e.overrideCode = "overrideCode", e.organizationEmail = "organizationEmail", e.authenticationCode = "authenticationCode", e.cvecNumber = "cvecNumber", e.captchaToken = "captchaToken", e))(wt || {}); const fv = Object.values(wt); var gb = /* @__PURE__ */ ((e) => (e.ON_VERIFICATION_READY = "ON_VERIFICATION_READY", e.ON_VERIFICATION_SUCCESS = "ON_VERIFICATION_SUCCESS", e.ON_VERIFICATION_STEP_CHANGE = "ON_VERIFICATION_STEP_CHANGE", e.ON_FORM_LOCALE_CHANGE = "ON_FORM_LOCALE_CHANGE", e))(gb || {}); const mb = Object.values(gb); var Wg = /* @__PURE__ */ ((e) => (e.AK = "AK", e.AL = "AL", e.AR = "AR", e.AZ = "AZ", e.AS = "AS", e.CA = "CA", e.CO = "CO", e.CT = "CT", e.DC = "DC", e.DE = "DE", e.FL = "FL", e.GA = "GA", e.GU = "GU", e.HI = "HI", e.IA = "IA", e.ID = "ID", e.IL = "IL", e.IN = "IN", e.KS = "KS", e.KY = "KY", e.LA = "LA", e.MA = "MA", e.MD = "MD", e.ME = "ME", e.MI = "MI", e.MN = "MN", e.MO = "MO", e.MS = "MS", e.MT = "MT", e.NC = "NC", e.ND = "ND", e.NE = "NE", e.NH = "NH", e.NJ = "NJ", e.NM = "NM", e.NV = "NV", e.NY = "NY", e.OH = "OH", e.OK = "OK", e.OR = "OR", e.PA = "PA", e.PR = "PR", e.RI = "RI", e.SC = "SC", e.SD = "SD", e.TN = "TN", e.TX = "TX", e.UT = "UT", e.VA = "VA", e.VI = "VI", e.VT = "VT", e.WA = "WA", e.WI = "WI", e.WV = "WV", e.WY = "WY", e))(Wg || {}), $x = /* @__PURE__ */ ((e) => (e.DOCUMENT = "document", e.FACIAL_SIMILARITY_MOTION = "facial_similarity_motion", e))($x || {}), jx = /* @__PURE__ */ ((e) => (e.PASSPORT = "passport", e.NATIONAL_IDENTITY_CARD = "national_identity_card", e.DRIVING_LICENCE = "driving_licence", e.RESIDENCE_PERMIT = "residence_permit", e))(jx || {}), Vx = /* @__PURE__ */ ((e) => (e.ID_CHECK = "ID_CHECK", e.ID_CHECK_LIVENESS = "ID_CHECK_LIVENESS", e))(Vx || {}), hb = /* @__PURE__ */ ((e) => (e.SIGNZY = "signzy", e))(hb || {}); const yb = (e) => { if (xx.indexOf(e) < 0) throw new Error(`Expected valid verification step name but received "${e}".`); }, ld = (e) => { if (Nx.indexOf(e) < 0) throw new Error(`Expected valid verification step name but received "${e}".`); }, Bx = (e) => { if (Dx.indexOf(e) < 0) throw new Error(`Expected valid segment name but received "${e}".`); }, vb = (e) => { if (!Du(e)) throw new Error(`Invalid locale ${e}, expected one of ${Hg.join(", ")}`); }, Du = (e) => Hg.indexOf(e) > -1, zx = (e) => { if (!(e && e.nodeType === Node.ELEMENT_NODE)) throw new Error( `Expected argument of type Node.ELEMENT_NODE but received "${typeof e} ${e.nodeType}"` ); }, Sb = (e) => { Yx(e); }, Hx = (e) => { const t = ec(); if (fv.indexOf(e) < 0 && t.indexOf(e) < 0) throw new Error(`Expected valid field ID but received ${e}. Valid FieldIds are [${fv.join(", ")}, ${t.join(", ")}]`); }, Wx = (e) => { qx(e.name), wb(e.callback); }, Gx = (e) => mb.includes(e); function qx(e) { if (!Gx(e)) throw new Error( `Expected valid hook name but received ${e}. Valid HookNames are [${mb.join( ", " )}]` ); } const wb = (e) => { if (typeof e != "function") throw new Error(`Expected type "function", but received ${typeof e}`); }, Kx = (e) => { if (typeof e != "string") throw new Error( `Expected trackingId to be a string, but received ${typeof e} instead.` ); if (e.length < 1) throw new Error("Expected trackingId string length greater than 0."); }, Yx = (e) => { if (!/^[0-9a-fA-F]{24}$/.test(e)) throw new Error(`Invalid databaseId "${e}". Expected a 24-digit hexadecimal string.`); }, Zx = (e) => e.replace(/\/?$/, "/"), tc = (e) => { const t = new URL(e || window.location.toString()); return new URLSearchParams(t.search.slice(1)); }, _u = (e, t) => tc(t).get(e), bb = (e) => { const o = new URLSearchParams(e).get("verificationId"); return typeof o == "string" && o.length === 0 ? null : o; }, Xx = (e) => { const o = new URLSearchParams(e).get("trackingId"); return typeof o == "string" && o.length === 0 ? null : o; }, fa = "en-US", Qx = [ "image/png", "image/jpg", "image/jpeg", "application/pdf" ], QV = [".jpg", ".jpeg", ".png", ".pdf"], Jx = 3, eR = "file", jr = "mockStep", ys = "mockSegment", sa = "mockSubSegment", aa = "mockErrorId", ia = "mockErrorDetailId", la = "mockRewardCode", ua = "mockRedirectUrl", mi = "mockConsumerInfoState", hi = "mockIdCheckLoopServiceType", yi = "mockDocSelected", $o = "mockPreviousStep", tR = "thirdPartyLoopProvider", rR = "ssoMethod", eo = "installPageUrl", JV = "installType", Gg = "externalUserId", vi = "mockCaptchaState", nR = 9, oR = 1, sR = "https://verify.sheerid.com/verification-support/feedback.html?token=", aR = "https://support.sheerid.com", iR = "https://www.cloudflare.com/privacypolicy/", lR = 1e4, uR = 200, cR = 6, fR = [ "firstName", "lastName", "memberId", "organization", "birthDate", "email", "phoneNumber", "postalCode", "address1", "city", "state", "dischargeDate", "activeDutyStartDate", "status", "statuses", "docUpload", "country", "smsCode", "socialSecurityNumber", "marketConsentValue", "carrierConsentValue", "driverLicenseNumber", "overrideCode", "ebtCardNumber", "organizationEmail", "authenticationCode" ], Xe = (e) => typeof e == "string", Si = () => { let e, t; const r = new Promise((o, i) => { e = o, t = i; }); return r.resolve = e, r.reject = t, r; }, dv = (e) => e == null ? "" : "" + e, dR = (e, t, r) => { e.forEach((o) => { t[o] && (r[o] = t[o]); }); }, pR = /###/g, pv = (e) => e && e.indexOf("###") > -1 ? e.replace(pR, ".") : e, gv = (e) => !e || Xe(e), Ai = (e, t, r) => { const o = Xe(t) ? t.split(".") : t; let i = 0; for (; i < o.length - 1; ) { if (gv(e)) return {}; const a = pv(o[i]); !e[a] && r && (e[a] = new r()), Object.prototype.hasOwnProperty.call(e, a) ? e = e[a] : e = {}, ++i; } return gv(e) ? {} : { obj: e, k: pv(o[i]) }; }, mv = (e, t, r) => { const { obj: o, k: i } = Ai(e, t, Object); if (o !== void 0 || t.length === 1) { o[i] = r; return; } let a = t[t.length - 1], u = t.slice(0, t.length - 1), c = Ai(e, u, Object); for (; c.obj === void 0 && u.length; ) a = `${u[u.length - 1]}.${a}`, u = u.slice(0, u.length - 1), c = Ai(e, u, Object), c?.obj && typeof c.obj[`${c.k}.${a}`] < "u" && (c.obj = void 0); c.obj[`${c.k}.${a}`] = r; }, gR = (e, t, r, o) => { const { obj: i, k: a } = Ai(e, t, Object); i[a] = i[a] || [], i[a].push(r); }, Lu = (e, t) => { const { obj: r, k: o } = Ai(e, t); if (r && Object.prototype.hasOwnProperty.call(r, o)) return r[o]; }, mR = (e, t, r) => { const o = Lu(e, r); return o !== void 0 ? o : Lu(t, r); }, Eb = (e, t, r) => { for (const o in t) o !== "__proto__" && o !== "constructor" && (o in e ? Xe(e[o]) || e[o] instanceof String || Xe(t[o]) || t[o] instanceof String ? r && (e[o] = t[o]) : Eb(e[o], t[o], r) : e[o] = t[o]); return e; }, ps = (e) => e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); var hR = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;", "/": "&#x2F;" }; const yR = (e) => Xe(e) ? e.replace(/[&<>"'\/]/g, (t) => hR[t]) : e; class vR { constructor(t) { this.capacity = t, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = []; } getRegExp(t) { const r = this.regExpMap.get(t); if (r !== void 0) return r; const o = new RegExp(t); return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(t, o), this.regExpQueue.push(t), o; } } const SR = [" ", ",", "?", "!", ";"], wR = new vR(20), bR = (e, t, r) => { t = t || "", r = r || ""; const o = SR.filter((u) => t.indexOf(u) < 0 && r.indexOf(u) < 0); if (o.length === 0) return !0; const i = wR.getRegExp(`(${o.map((u) => u === "?" ? "\\?" : u).join("|")})`); let a = !i.test(e); if (!a) { const u = e.indexOf(r); u > 0 && !i.test(e.substring(0, u)) && (a = !0); } return a; }, vg = (e, t, r = ".") => { if (!e) return; if (e[t]) return Object.prototype.hasOwnProperty.call(e, t) ? e[t] : void 0; const o = t.split(r); let i = e; for (let a = 0; a < o.length; ) { if (!i || typeof i != "object") return; let u, c = ""; for (let d = a; d < o.length; ++d) if (d !== a && (c += r), c += o[d], u = i[c], u !== void 0) { if (["string", "number", "boolean"].indexOf(typeof u) > -1 && d < o.length - 1) continue; a += d - a + 1; break; } i = u; } return i; }, Li = (e) => e?.replace(/_/g, "-"), ER = { type: "logger", log(e) { this.output("log", e); }, warn(e) { this.output("warn", e); }, error(e) { this.output("error", e); }, output(e, t) { console?.[e]?.apply?.(console, t); } }; class Fu { constructor(t, r = {}) { this.init(t, r); } init(t, r = {}) { this.prefix = r.prefix || "i18next:", this.logger = t || ER, this.options = r, this.debug = r.debug; } log(...t) { return this.forward(t, "log", "", !0); } warn(...t) { return this.forward(t, "warn", "", !0); } error(...t) { return this.forward(t, "error", ""); } deprecate(...t) { return this.forward(t, "warn", "WARNING DEPRECATED: ", !0); } forward(t, r, o, i) { return i && !this.debug ? null : (Xe(t[0]) && (t[0] = `${o}${this.prefix} ${t[0]}`), this.logger[r](t)); } create(t) { return new Fu(this.logger, { prefix: `${this.prefix}:${t}:`, ...this.options }); } clone(t) { return t = t || this.options, t.prefix = t.prefix || this.prefix, new Fu(this.logger, t); } } var Nn = new Fu(); let rc = class { constructor() { this.observers = {}; } on(t, r) { return t.split(" ").forEach((o) => { this.observers[o] || (this.observers[o] = /* @__PURE__ */ new Map()); const i = this.observers[o].get(r) || 0; this.observers[o].set(r, i + 1); }), this; } off(t, r) { if (this.observers[t]) { if (!r) { delete this.observers[t]; return; } this.observers[t].delete(r); } } emit(t, ...r) { this.observers[t] && Array.from(this.observers[t].entries()).forEach(([i, a]) => { for (let u = 0; u < a; u++) i(...r); }), this.observers["*"] && Array.from(this.observers["*"].entries()).forEach(([i, a]) => { for (let u = 0; u < a; u++) i.apply(i, [t, ...r]); }); } }; class hv extends rc { constructor(t, r = { ns: ["translation"], defaultNS: "translation" }) { super(), this.data = t || {}, this.options = r, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = !0); } addNamespaces(t) { this.options.ns.indexOf(t) < 0 && this.options.ns.push(t); } removeNamespaces(t) { const r = this.options.ns.indexOf(t); r > -1 && this.options.ns.splice(r, 1); } getResource(t, r, o, i = {}) { const a = i.keySeparator !== void 0 ? i.keySeparator : this.options.keySeparator, u = i.ignoreJSONStructure !== void 0 ? i.ignoreJSONStructure : this.options.ignoreJSONStructure; let c; t.indexOf(".") > -1 ? c = t.split(".") : (c = [t, r], o && (Array.isArray(o) ? c.push(...o) : Xe(o) && a ? c.push(...o.split(a)) : c.push(o))); const d = Lu(this.data, c); return !d && !r && !o && t.indexOf(".") > -1 && (t = c[0], r = c[1], o = c.slice(2).join(".")), d || !u || !Xe(o) ? d : vg(this.data?.[t]?.[r], o, a); } addResource(t, r, o, i, a = { silent: !1 }) { const u = a.keySeparator !== void 0 ? a.keySeparator : this.options.keySeparator; let c = [t, r]; o && (c = c.concat(u ? o.split(u) : o)), t.indexOf(".") > -1 && (c = t.split("."), i = r, r = c[1]), this.addNamespaces(r), mv(this.data, c, i), a.silent || this.emit("added", t, r, o, i); } addResources(t, r, o, i = { silent: !1 }) { for (const a in o) (Xe(o[a]) || Array.isArray(o[a])) && this.addResource(t, r, a, o[a], { silent: !0 }); i.silent || this.emit("added", t, r, o); } addResourceBundle(t, r, o, i, a, u = { silent: !1, skipCopy: !1 }) { let c = [t, r]; t.indexOf(".") > -1 && (c = t.split("."), i = o, o = r, r = c[1]), this.addNamespaces(r); let d = Lu(this.data, c) || {}; u.skipCopy || (o = JSON.parse(JSON.stringify(o))), i ? Eb(d, o, a) : d = { ...d, ...o }, mv(this.data, c, d), u.silent || this.emit("added", t, r, o); } removeResourceBundle(t, r) { this.hasResourceBundle(t, r) && delete this.data[t][r], this.removeNamespaces(r), this.emit("removed", t, r); } hasResourceBundle(t, r) { return this.getResource(t, r) !== void 0; } getResourceBundle(t, r) { return r || (r = this.options.defaultNS), this.getResource(t, r); } getDataByLanguage(t) { return this.data[t]; } hasLanguageSomeTranslations(t) { const r = this.getDataByLanguage(t); return !!(r && Object.keys(r) || []).find((i) => r[i] && Object.keys(r[i]).length > 0); } toJSON() { return this.data; } } var Ib = { processors: {}, addPostProcessor(e) { this.processors[e.name] = e; }, handle(e, t, r, o, i) { return e.forEach((a) => { t = this.processors[a]?.process(t, r, o, i) ?? t; }), t; } }; const Mb = /* @__PURE__ */ Symbol("i18next/PATH_KEY"); function IR() { const e = [], t = /* @__PURE__ */ Object.create(null); let r; return t.get = (o, i) => (r?.revoke?.(), i === Mb ? e : (e.push(i), r = Proxy.revocable(o, t), r.proxy)), Proxy.revocable(/* @__PURE__ */ Object.create(null), t).proxy; } function Ss(e, t) { const { [Mb]: r } = e(IR()), o = t?.keySeparator ?? ".", i = t?.nsSeparator ?? ":"; if (r.length > 1 && i) { const a = t?.ns, u = Array.isArray(a) ? a : null; if (u && u.length > 1 && u.slice(1).includes(r[0])) return `${r[0]}${i}${r.slice(1).join(o)}`; } return r.join(o); } const yv = {}, ud = (e) => !Xe(e) && typeof e != "boolean" && typeof e != "number"; class Uu extends rc { constructor(t, r = {}) { super(), dR(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], t, this), this.options = r, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = Nn.create("translator"); } changeLanguage(t) { t && (this.language = t); } exists(t, r = { interpolation: {} }) { const o = { ...r }; if (t == null) return !1; const i = this.resolve(t, o); if (i?.res === void 0) return !1; const a = ud(i.res); return !(o.returnObjects === !1 && a); } extractFromKey(t, r) { let o = r.nsSeparator !== void 0 ? r.nsSeparator : this.options.nsSeparator; o === void 0 && (o = ":"); const i = r.keySeparator !== void 0 ? r.keySeparator : this.options.keySeparator; let a = r.ns || this.options.defaultNS || []; const u = o && t.indexOf(o) > -1, c = !this.options.userDefinedKeySeparator && !r.keySeparator && !this.options.userDefinedNsSeparator && !r.nsSeparator && !bR(t, o, i); if (u && !c) { const d = t.match(this.interpolator.nestingRegexp); if (d && d.length > 0) return { key: t, namespaces: Xe(a) ? [a] : a }; const p = t.split(o); (o !== i || o === i && this.options.ns.indexOf(p[0]) > -1) && (a = p.shift()), t = p.join(i); } return { key: t, namespaces: Xe(a) ? [a] : a }; } translate(t, r, o) { let i = typeof r == "object" ? { ...r } : r; if (typeof i != "object" && this.options.overloadTranslationOptionHandler && (i = this.options.overloadTranslationOptionHandler(arguments)), typeof i == "object" && (i = { ...i }), i || (i = {}), t == null) return ""; typeof t == "function" && (t = Ss(t, { ...this.options, ...i })), Array.isArray(t) || (t = [String(t)]), t = t.map((se) => typeof se == "function" ? Ss(se, { ...this.options, ...i }) : String(se)); const a = i.returnDetails !== void 0 ? i.returnDetails : this.options.returnDetails, u = i.keySeparator !== void 0 ? i.keySeparator : this.options.keySeparator, { key: c, namespaces: d } = this.extractFromKey(t[t.length - 1], i), p = d[d.length - 1]; let m = i.nsSeparator !== void 0 ? i.nsSeparator : this.options.nsSeparator; m === void 0 && (m = ":"); const h = i.lng || this.language, v = i.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode; if (h?.toLowerCase() === "cimode") return v ? a ? { res: `${p}${m}${c}`, usedKey: c, exactUsedKey: c, usedLng: h, usedNS: p, usedParams: this.getUsedParamsDetails(i) } : `${p}${m}${c}` : a ? { res: c, usedKey: c, exactUsedKey: c, usedLng: h, usedNS: p, usedParams: this.getUsedParamsDetails(i) } : c; const S = this.resolve(t, i); let b = S?.res; const E = S?.usedKey || c, I = S?.exactUsedKey || c, P = ["[object Number]", "[object Function]", "[object RegExp]"], C = i.joinArrays !== void 0 ? i.joinArrays : this.options.joinArrays, D = !this.i18nFormat || this.i18nFormat.handleAsObject, k = i.count !== void 0 && !Xe(i.count), R = Uu.hasDefaultValue(i), $ = k ? this.pluralResolver.getSuffix(h, i.count, i) : "", O = i.ordinal && k ? this.pluralResolver.getSuffix(h, i.count, { ordinal: !1 }) : "", L = k && !i.ordinal && i.count === 0, te = L && i[`defaultValue${this.options.pluralSeparator}zero`] || i[`defaultValue${$}`] || i[`defaultValue${O}`] || i.defaultValue; let j = b; D && !b && R && (j = te); const J = ud(j), oe = Object.prototype.toString.apply(j); if (D && j && J && P.indexOf(oe) < 0 && !(Xe(C) && Array.isArray(j))) { if (!i.returnObjects && !this.options.returnObjects) { this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!"); const se = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(E, j, { ...i, ns: d }) : `key '${c} (${this.language})' returned an object instead of string.`; return a ? (S.res = se, S.usedParams = this.getUsedParamsDetails(i), S) : se; } if (u) { const se = Array.isArray(j), ge = se ? [] : {}, Ce = se ? I : E; for (const be in j) if (Object.prototype.hasOwnProperty.call(j, be)) { const Se = `${Ce}${u}${be}`; R && !b ? ge[be] = this.translate(Se, { ...i, defaultValue: ud(te) ? te[be] : void 0, joinArrays: !1, ns: d }) : ge[be] = this.translate(Se, { ...i, joinArrays: !1, ns: d }), ge[be] === Se && (ge[be] = j[be]); } b = ge; } } else if (D && Xe(C) && Array.isArray(b)) b = b.join(C), b && (b = this.extendTranslation(b, t, i, o)); else { let se = !1, ge = !1; !this.isValidLookup(b) && R && (se = !0, b = te), this.isValidLookup(b) || (ge = !0, b = c); const be = (i.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && ge ? void 0 : b, Se = R && te !== b && this.options.updateMissing; if (ge || se || Se) { if (this.logger.log(Se ? "updateKey" : "missingKey", h, p, c, Se ? te : b), u) { const U = this.resolve(c, { ...i, keySeparator: !1 }); U && U.res && this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format."); } let K = []; const re = this.languageUtils.getFallbackCodes(this.options.fallbackLng, i.lng || this.language); if (this.options.saveMissingTo === "fallback" && re && re[0]) for (let U = 0; U < re.length; U++) K.push(re[U]); else this.options.saveMissingTo === "all" ? K = this.languageUtils.toResolveHierarchy(i.lng || this.language) : K.push(i.lng || this.language); const ce = (U, ee, Ee) => { const ke = R && Ee !== b ? Ee : be; this.options.missingKeyHandler ? this.options.missingKeyHandler(U, p, ee, ke, Se, i) : this.backendConnector?.saveMissing && this.backendConnector.saveMissing(U, p, ee, ke, Se, i), this.emit("missingKey", U, p, ee, b); }; this.options.saveMissing && (this.options.saveMissingPlurals && k ? K.forEach((U) => { const ee = this.pluralResolver.getSuffixes(U, i); L && i[`defaultValue${this.options.pluralSeparator}zero`] && ee.indexOf(`${this.options.pluralSeparator}zero`) < 0 && ee.push(`${this.options.pluralSeparator}zero`), ee.forEach((Ee) => { ce([U], c + Ee, i[`defaultValue${Ee}`] || te); }); }) : ce(K, c, te)); } b = this.extendTranslation(b, t, i, S, o), ge && b === c && this.options.appendNamespaceToMissingKey && (b = `${p}${m}${c}`), (ge || se) && this.options.parseMissingKeyHandler && (b = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${p}${m}${c}` : c, se ? b : void 0, i)); } return a ? (S.res = b, S.usedParams = this.getUsedParamsDetails(i), S) : b; } extendTranslation(t, r, o, i, a) { if (this.i18nFormat?.parse) t = this.i18nFormat.parse(t, { ...this.options.interpolation.defaultVariables, ...o }, o.lng || this.language || i.usedLng, i.usedNS, i.usedKey, { resolved: i }); else if (!o.skipInterpolation) { o.interpolation && this.interpolator.init({ ...o, interpolation: { ...this.options.interpolation, ...o.interpolation } }); const d = Xe(t) && (o?.interpolation?.skipOnVariables !== void 0 ? o.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables); let p; if (d) { const h = t.match(this.interpolator.nestingRegexp); p = h && h.length; } let m = o.replace && !Xe(o.replace) ? o.replace : o; if (this.options.interpolation.defaultVariables && (m = { ...this.options.interpolation.defaultVariables, ...m }), t = this.interpolator.interpolate(t, m, o.lng || this.language || i.usedLng, o), d) { const h = t.match(this.interpolator.nestingRegexp), v = h && h.length; p < v && (o.nest = !1); } !o.lng && i && i.res && (o.lng = this.language || i.usedLng), o.nest !== !1 && (t = this.interpolator.nest(t, (...h) => a?.[0] === h[0] && !o.context ? (this.logger.warn(`It seems you are nesting recursively key: ${h[0]} in key: ${r[0]}`), null) : this.translate(...h, r), o)), o.interpolation && this.interpolator.reset(); } const u = o.postProcess || this.options.postProcess, c = Xe(u) ? [u] : u; return t != null && c?.length && o.applyPostProcessor !== !1 && (t = Ib.handle(c, t, r, this.options && this.options.postProcessPassResolved ? { i18nResolved: { ...i, usedParams: this.getUsedParamsDetails(o) }, ...o } : o, this)), t; } resolve(t, r = {}) { let o, i, a, u, c; return Xe(t) && (t = [t]), Array.isArray(t) && (t = t.map((d) => typeof d == "function" ? Ss(d, { ...this.options, ...r }) : d)), t.forEach((d) => { if (this.isValidLookup(o)) return; const p = this.extractFromKey(d, r), m = p.key; i = m; let h = p.namespaces; this.options.fallbackNS && (h = h.concat(this.options.fallbackNS)); const v = r.count !== void 0 && !Xe(r.count), S = v && !r.ordinal && r.count === 0, b = r.context !== void 0 && (Xe(r.context) || typeof r.context == "number") && r.context !== "", E = r.lngs ? r.lngs : this.languageUtils.toResolveHierarchy(r.lng || this.language, r.fallbackLng); h.forEach((I) => { this.isValidLookup(o) || (c = I, !yv[`${E[0]}-${I}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(c) && (yv[`${E[0]}-${I}`] = !0, this.logger.warn(`key "${i}" for languages "${E.join(", ")}" won't get resolved as namespace "${c}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")), E.forEach((P) => { if (this.isValidLookup(o)) return; u = P; const C = [m]; if (this.i18nFormat?.addLookupKeys) this.i18nFormat.addLookupKeys(C, m, P, I, r); else { let k; v && (k = this.pluralResolver.getSuffix(P, r.count, r)); const R = `${this.options.pluralSeparator}zero`, $ = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`; if (v && (r.ordinal && k.indexOf($) === 0 && C.push(m + k.replace($, this.options.pluralSeparator)), C.push(m + k), S && C.push(m + R)), b) { const O = `${m}${this.options.contextSeparator || "_"}${r.context}`; C.push(O), v && (r.ordinal && k.indexOf($) === 0 && C.push(O + k.replace($, this.options.pluralSeparator)), C.push(O + k), S && C.push(O + R)); } } let D; for (; D = C.pop(); ) this.isValidLookup(o) || (a = D, o = this.getResource(P, I, D, r)); })); }); }), { res: o, usedKey: i, exactUsedKey: a, usedLng: u, usedNS: c }; } isValidLookup(t) { return t !== void 0 && !(!this.options.returnNull && t === null) && !(!this.options.returnEmptyString && t === ""); } getResource(t, r, o, i = {}) { return this.i18nFormat?.getResource ? this.i18nFormat.getResource(t, r, o, i) : this.resourceStore.getResource(t, r, o, i); } getUsedParamsDetails(t = {}) { const r = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"], o = t.replace && !Xe(t.replace); let i = o ? t.replace : t; if (o && typeof t.count < "u" && (i.count = t.count), this.options.interpolation.defaultVariables && (i = { ...this.options.interpolation.defaultVariables, ...i }), !o) { i = { ...i }; for (const a of r) delete i[a]; } return i; } static hasDefaultValue(t) { const r = "defaultValue"; for (const o in t) if (Object.prototype.hasOwnProperty.call(t, o) && r === o.substring(0, r.length) && t[o] !== void 0) return !0; return !1; } } class vv { constructor(t) { this.options = t, this.supportedLngs = this.options.supportedLngs || !1, this.logger = Nn.create("languageUtils"); } getScriptPartFromCode(t) { if (t = Li(t), !t || t.indexOf("-") < 0) return null; const r = t.split("-"); return r.length === 2 || (r.pop(), r[r.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(r.join("-")); } getLanguagePartFromCode(t) { if (t = Li(t), !t || t.indexOf("-") < 0) return t; const r = t.split("-"); return this.formatLanguageCode(r[0]); } formatLanguageCode(t) { if (Xe(t) && t.indexOf("-") > -1) { let r; try { r = Intl.getCanonicalLocales(t)[0]; } catch { } return r && this.options.lowerCaseLng && (r = r.toLowerCase()), r || (this.options.lowerCaseLng ? t.toLowerCase() : t); } return this.options.cleanCode || this.options.lowerCaseLng ? t.toLowerCase() : t; } isSupportedCode(t) { return (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) && (t = this.getLanguagePartFromCode(t)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(t) > -1; } getBestMatchFromCodes(t) { if (!t) return null; let r; return t.forEach((o) => { if (r) return; const i = this.formatLanguageCode(o); (!this.options.supportedLngs || this.isSupportedCode(i)) && (r = i); }), !r && this.options.supportedLngs && t.forEach((o) => { if (r) return; const i = this.getScriptPartFromCode(o); if (this.isSupportedCode(i)) return r = i; const a = this.getLanguagePartFromCode(o); if (this.isSupportedCode(a)) return r = a; r = this.options.supportedLngs.find((u) => { if (u === a) return u; if (!(u.indexOf("-") < 0 && a.indexOf("-") < 0) && (u.indexOf("-") > 0 && a.indexOf("-") < 0 && u.substring(0, u.indexOf("-")) === a || u.indexOf(a) === 0 && a.length > 1)) return u; }); }), r || (r = this.getFallbackCodes(this.options.fallbackLng)[0]), r; } getFallbackCodes(t, r) { if (!t) return []; if (typeof t == "function" && (t = t(r)), Xe(t) && (t = [t]), Array.isArray(t)) return t; if (!r) return t.default || []; let o = t[r]; return o || (o = t[this.getScriptPartFromCode(r)]), o || (o = t[this.formatLanguageCode(r)]), o || (o = t[this.getLanguagePartFromCode(r)]), o || (o = t.default), o || []; } toResolveHierarchy(t, r) { const o = this.getFallbackCodes((r === !1 ? [] : r) || this.options.fallbackLng || [], t), i = [], a = (u) => { u && (this.isSupportedCode(u) ? i.push(u) : this.logger.warn(`rejecting language code not found in supportedLngs: ${u}`)); }; return Xe(t) && (t.indexOf("-") > -1 || t.indexOf("_") > -1) ? (this.options.load !== "languageOnly" && a(this.formatLanguageCode(t)), this.options.load !== "languageOnly" && this.options.load !== "currentOnly" && a(this.getScriptPartFromCode(t)), this.options.load !== "currentOnly" && a(this.getLanguagePartFromCode(t))) : Xe(t) && a(this.formatLanguageCode(t)), o.forEach((u) => { i.indexOf(u) < 0 && a(this.formatLanguageCode(u)); }), i; } } const Sv = { zero: 0, one: 1, two: 2, few: 3, many: 4, other: 5 }, wv = { select: (e) => e === 1 ? "one" : "other", resolvedOptions: () => ({ pluralCategories: ["one", "other"] }) }; class MR { constructor(t, r = {}) { this.languageUtils = t, this.options = r, this.logger = Nn.create("pluralResolver"), this.pluralRulesCache = {}; } clearCache() { this.pluralRulesCache = {}; } getRule(t, r = {}) { const o = Li(t === "dev" ? "en" : t), i = r.ordinal ? "ordinal" : "cardinal", a = JSON.stringify({ cleanedCode: o, type: i }); if (a in this.pluralRulesCache) return this.pluralRulesCache[a]; let u; try { u = new Intl.PluralRules(o, { type: i }); } catch { if (typeof Intl > "u") return this.logger.error("No Intl support, please use an Intl polyfill!"), wv; if (!t.match(/-|_/)) return wv; const d = this.languageUtils.getLanguagePartFromCode(t); u = this.getRule(d, r); } return this.pluralRulesCache[a] = u, u; } needsPlural(t, r = {}) { let o = this.getRule(t, r); return o || (o = this.getRule("dev", r)), o?.resolvedOptions().pluralCategories.length > 1; } getPluralFormsOfKey(t, r, o = {}) { return this.getSuffixes(t, o).map((i) => `${r}${i}`); } getSuffixes(t, r = {}) { let o = this.getRule(t, r); return o || (o = this.getRule("dev", r)), o ? o.resolvedOptions().pluralCategories.sort((i, a) => Sv[i] - Sv[a]).map((i) => `${this.options.prepend}${r.ordinal ? `ordinal${this.options.prepend}` : ""}${i}`) : []; } getSuffix(t, r, o = {}) { const i = this.getRule(t, o); return i ? `${this.options.prepend}${o.ordinal ? `ordinal${this.options.prepend}` : ""}${i.select(r)}` : (this.logger.warn(`no plural rule found for: ${t}`), this.getSuffix("dev", r, o)); } } const bv = (e, t, r, o = ".", i = !0) => { let a = mR(e, t, r); return !a && i && Xe(r) && (a = vg(e, r, o), a === void 0 && (a = vg(t, r, o))), a; }, cd = (e) => e.replace(/\$/g, "$$$$"); class Ev { constructor(t = {}) { this.logger = Nn.create("interpolator"), this.options = t, this.format = t?.interpolation?.format || ((r) => r), this.init(t); } init(t = {}) { t.interpolation || (t.interpolation = { escapeValue: !0 }); const { escape: r, escapeValue: o, useRawValueToEscape: i, prefix: a, prefixEscaped: u, suffix: c, suffixEscaped: d, formatSeparator: p, unescapeSuffix: m, unescapePrefix: h, nestingPrefix: v, nestingPrefixEscaped: S, nestingSuffix: b, nestingSuffixEscaped: E, nestingOptionsSeparator: I, maxReplaces: P, alwaysFormat: C } = t.interpolation; this.escape = r !== void 0 ? r : yR, this.escapeValue = o !== void 0 ? o : !0, this.useRawValueToEscape = i !== void 0 ? i : !1, this.prefix = a ? ps(a) : u || "{{", this.suffix = c ? ps(c) : d || "}}", this.formatSeparator = p || ",", this.unescapePrefix = m ? "" : h || "-", this.unescapeSuffix = this.unescapePrefix ? "" : m || "", this.nestingPrefix = v ? ps(v) : S || ps("$t("), this.nestingSuffix = b ? ps(b) : E || ps(")"), this.nestingOptionsSeparator = I || ",", this.maxReplaces = P || 1e3, this.alwaysFormat = C !== void 0 ? C : !1, this.resetRegExp(); } reset() { this.options && this.init(this.options); } resetRegExp() { const t = (r, o) => r?.source === o ? (r.lastIndex = 0, r) : new RegExp(o, "g"); this.regexp = t(this.regexp, `${this.prefix}(.+?)${this.suffix}`), this.regexpUnescape = t(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`), this.nestingRegexp = t(this.nestingRegexp, `${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`); } interpolate(t, r, o, i) { let a, u, c; const d = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, p = (S) => { if (S.indexOf(this.formatSeparator) < 0) { const P = bv(r, d, S, this.options.keySeparator, this.options.ignoreJSONStructure); return this.alwaysFormat ? this.format(P, void 0, o, { ...i, ...r, interpolationkey: S }) : P; } const b = S.split(this.formatSeparator), E = b.shift().trim(), I = b.join(this.formatSeparator).trim(); return this.format(bv(r, d, E, this.options.keySeparator, this.options.ignoreJSONStructure), I, o, { ...i, ...r, interpolationkey: E }); }; this.resetRegExp(); const m = i?.missingInterpolationHandler || this.options.missingInterpolationHandler, h = i?.interpolation?.skipOnVariables !== void 0 ? i.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables; return [{ regex: this.regexpUnescape, safeValue: (S) => cd(S) }, { regex: this.regexp, safeValue: (S) => this.escapeValue ? cd(this.escape(S)) : cd(S) }].forEach((S) => { for (c = 0; a = S.regex.exec(t); ) { const b = a[1].trim(); if (u = p(b), u === void 0) if (typeof m == "function") { const I = m(t, a, i); u = Xe(I) ? I : ""; } else if (i && Object.prototype.hasOwnProperty.call(i, b)) u = ""; else if (h) { u = a[0]; continue; } else this.logger.warn(`missed to pass in variable ${b} for interpolating ${t}`), u = ""; else !Xe(u) && !this.useRawValueToEscape && (u = dv(u)); const E = S.saf