lipilekhika 1.0.0 → 1.0.2
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/LICENCE +1 -1
- package/README.md +133 -128
- package/dist/cjs/{Assamese-D-JeQpHm.cjs → Assamese-DB4wYtnM.cjs} +1 -1
- package/dist/cjs/{Bengali-Cb8p6Ss6.cjs → Bengali-Cmp4ERCx.cjs} +1 -1
- package/dist/cjs/{Brahmi-WrTB6e7g.cjs → Brahmi-DXNNRCQo.cjs} +1 -1
- package/dist/cjs/{Devanagari-CubB6Ubb.cjs → Devanagari-C5Xu55TI.cjs} +1 -1
- package/dist/cjs/{Granth-C6Es6NQ-.cjs → Granth-DfIl5B1W.cjs} +1 -1
- package/dist/cjs/{Gujarati-ToSwR4ym.cjs → Gujarati-VhhVj3ND.cjs} +1 -1
- package/dist/cjs/{Gurumukhi-enKEt02s.cjs → Gurumukhi-B3KktUHR.cjs} +1 -1
- package/dist/cjs/{Kannada-BuxZGQgS.cjs → Kannada-Cim8EpsZ.cjs} +1 -1
- package/dist/cjs/{Malayalam-DrxDIRjl.cjs → Malayalam-ByvdN31f.cjs} +1 -1
- package/dist/cjs/{Modi-CYRCB8M0.cjs → Modi-BmaT2WSv.cjs} +1 -1
- package/dist/cjs/Normal-Dtdwej3_.cjs +1 -0
- package/dist/cjs/{Odia-DyI85meX.cjs → Odia-B2SrneR4.cjs} +1 -1
- package/dist/cjs/{Purna-Devanagari-72KHauTF.cjs → Purna-Devanagari-B6wi3Ozk.cjs} +1 -1
- package/dist/cjs/Romanized-CuNlC73n.cjs +1 -0
- package/dist/cjs/{Sharada-CsNaWIt6.cjs → Sharada-BhQ08FSG.cjs} +1 -1
- package/dist/cjs/Siddham-D4nvxdh7.cjs +1 -0
- package/dist/cjs/{Sinhala-Cu5sdgUY.cjs → Sinhala-BfF1GhfP.cjs} +1 -1
- package/dist/cjs/{Tamil-Extended-PyLgZJyX.cjs → Tamil-Extended-BWvMEAwT.cjs} +1 -1
- package/dist/cjs/{Tamil-CiqM4WXX.cjs → Tamil-lWn6n3eQ.cjs} +1 -1
- package/dist/cjs/{Telugu-CaCRkj-p.cjs → Telugu-zv0Kis3h.cjs} +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/script_normalization-CA-LgBRA.cjs +2 -0
- package/dist/cjs/typing.cjs +1 -1
- package/dist/esm/{Assamese-4WO2wzXg.js → Assamese-J9rLtNyc.js} +1 -1
- package/dist/esm/{Bengali-Dhlxv7Pr.js → Bengali-CzBJ2A7u.js} +1 -1
- package/dist/esm/{Brahmi-BvC4Luvf.js → Brahmi-BEpeQWDq.js} +1 -1
- package/dist/esm/{Devanagari-C4NmXCKb.js → Devanagari-BnMkKqfQ.js} +1 -1
- package/dist/esm/{Granth-B3US1gHe.js → Granth-Dm7b2ooD.js} +1 -1
- package/dist/esm/{Gujarati-DfQS2sSY.js → Gujarati-C-B0DC9F.js} +1 -1
- package/dist/esm/{Gurumukhi-dVJRMJNL.js → Gurumukhi-GmwtiirL.js} +1 -1
- package/dist/esm/{Kannada-ZB5P9u4T.js → Kannada-BYMa9Anc.js} +1 -1
- package/dist/esm/{Malayalam-BQROfOnO.js → Malayalam-BJnHbd1I.js} +1 -1
- package/dist/esm/{Modi-B16t9oPJ.js → Modi-D1HxQQAw.js} +1 -1
- package/dist/esm/Normal-9g1lSg7V.js +25 -0
- package/dist/esm/{Odia-hd6WA8ll.js → Odia-CkBeE4O8.js} +1 -1
- package/dist/esm/{Purna-Devanagari-CqkVL5zc.js → Purna-Devanagari-BqwAqNzf.js} +1 -1
- package/dist/esm/Romanized-BFCb5s8R.js +25 -0
- package/dist/esm/{Sharada-Bk4pUPeN.js → Sharada-CJqMtpHb.js} +1 -1
- package/dist/esm/Siddham-DxnhsFps.js +29 -0
- package/dist/esm/{Sinhala-C6t7GaP6.js → Sinhala-BbPpiimZ.js} +1 -1
- package/dist/esm/{Tamil-CR4VFQvV.js → Tamil-CyqLqDzd.js} +5 -5
- package/dist/esm/{Tamil-Extended-nmDMmVeX.js → Tamil-Extended-CXbdAVNJ.js} +1 -1
- package/dist/esm/{Telugu-BCg-EHjf.js → Telugu-o2swovuz.js} +1 -1
- package/dist/esm/index.mjs +3 -2
- package/dist/esm/script_normalization-HKw9dSJ0.js +704 -0
- package/dist/esm/typing.mjs +1 -1
- package/dist/index.d.ts +9 -31
- package/dist/lipilekhika.umd.js +2 -2
- package/dist/typing.d.ts +1 -1
- package/dist/umd_json/script_data/Assamese.json +1 -1
- package/dist/umd_json/script_data/Bengali.json +1 -1
- package/dist/umd_json/script_data/Brahmi.json +1 -1
- package/dist/umd_json/script_data/Devanagari.json +1 -1
- package/dist/umd_json/script_data/Granth.json +1 -1
- package/dist/umd_json/script_data/Gujarati.json +1 -1
- package/dist/umd_json/script_data/Gurumukhi.json +1 -1
- package/dist/umd_json/script_data/Kannada.json +1 -1
- package/dist/umd_json/script_data/Malayalam.json +1 -1
- package/dist/umd_json/script_data/Modi.json +1 -1
- package/dist/umd_json/script_data/Normal.json +1 -1
- package/dist/umd_json/script_data/Odia.json +1 -1
- package/dist/umd_json/script_data/Purna-Devanagari.json +1 -1
- package/dist/umd_json/script_data/Romanized.json +1 -1
- package/dist/umd_json/script_data/Sharada.json +1 -1
- package/dist/umd_json/script_data/Siddham.json +1 -1
- package/dist/umd_json/script_data/Sinhala.json +1 -1
- package/dist/umd_json/script_data/Tamil-Extended.json +1 -1
- package/dist/umd_json/script_data/Tamil.json +1 -1
- package/dist/umd_json/script_data/Telugu.json +1 -1
- package/package.json +4 -2
- package/dist/cjs/Normal-BfIhy-Ts.cjs +0 -1
- package/dist/cjs/Romanized-Dy_qfDqa.cjs +0 -1
- package/dist/cjs/Siddham-Do9NoVoz.cjs +0 -1
- package/dist/cjs/script_normalization-BlG9S8Ex.cjs +0 -2
- package/dist/esm/Normal-Chi5ccip.js +0 -25
- package/dist/esm/Romanized-CQkrk7RV.js +0 -25
- package/dist/esm/Siddham-Cf9Jp5KF.js +0 -29
- package/dist/esm/script_normalization-D8Eu1NYy.js +0 -712
|
@@ -1,712 +0,0 @@
|
|
|
1
|
-
function Q(n, e, l, t) {
|
|
2
|
-
const { accessor: a, compareFn: s } = t ?? {}, c = a ?? ((i, r) => i[r]);
|
|
3
|
-
let o = 0, h = e.length - 1, _ = -1;
|
|
4
|
-
for (; o <= h; ) {
|
|
5
|
-
const i = Math.floor((o + h) / 2), r = e[i], u = c(n, r);
|
|
6
|
-
let m;
|
|
7
|
-
s ? m = s(l, u) : m = l < u ? -1 : l > u ? 1 : 0, m === 0 ? (_ = r, h = i - 1) : m < 0 ? h = i - 1 : o = i + 1;
|
|
8
|
-
}
|
|
9
|
-
return _;
|
|
10
|
-
}
|
|
11
|
-
function Y(n, e, l) {
|
|
12
|
-
const { accessor: t, compareFn: a } = l ?? {}, s = t ?? ((_, i) => _[i]);
|
|
13
|
-
let c = 0, o = n.length - 1, h = -1;
|
|
14
|
-
for (; c <= o; ) {
|
|
15
|
-
const _ = Math.floor((c + o) / 2), i = s(n, _);
|
|
16
|
-
let r;
|
|
17
|
-
a ? r = a(e, i) : r = e < i ? -1 : e > i ? 1 : 0, r === 0 ? (h = _, o = _ - 1) : r < 0 ? o = _ - 1 : c = _ + 1;
|
|
18
|
-
}
|
|
19
|
-
return h;
|
|
20
|
-
}
|
|
21
|
-
const ve = (n, e, l) => {
|
|
22
|
-
const t = n[e];
|
|
23
|
-
return t ? typeof t == "function" ? t() : Promise.resolve(t) : new Promise((a, s) => {
|
|
24
|
-
(typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(s.bind(null, /* @__PURE__ */ new Error("Unknown variable dynamic import: " + e + (e.split("/").length !== l ? ". Note that variables only represent file names one level deep." : ""))));
|
|
25
|
-
});
|
|
26
|
-
}, le = {}, ue = async (n) => (le[n] || (le[n] = ve(/* @__PURE__ */ Object.assign({ "../script_data/Assamese.json": () => import("./Assamese-4WO2wzXg.js"), "../script_data/Bengali.json": () => import("./Bengali-Dhlxv7Pr.js"), "../script_data/Brahmi.json": () => import("./Brahmi-BvC4Luvf.js"), "../script_data/Devanagari.json": () => import("./Devanagari-C4NmXCKb.js"), "../script_data/Granth.json": () => import("./Granth-B3US1gHe.js"), "../script_data/Gujarati.json": () => import("./Gujarati-DfQS2sSY.js"), "../script_data/Gurumukhi.json": () => import("./Gurumukhi-dVJRMJNL.js"), "../script_data/Kannada.json": () => import("./Kannada-ZB5P9u4T.js"), "../script_data/Malayalam.json": () => import("./Malayalam-BQROfOnO.js"), "../script_data/Modi.json": () => import("./Modi-B16t9oPJ.js"), "../script_data/Normal.json": () => import("./Normal-Chi5ccip.js"), "../script_data/Odia.json": () => import("./Odia-hd6WA8ll.js"), "../script_data/Purna-Devanagari.json": () => import("./Purna-Devanagari-CqkVL5zc.js"), "../script_data/Romanized.json": () => import("./Romanized-CQkrk7RV.js"), "../script_data/Sharada.json": () => import("./Sharada-Bk4pUPeN.js"), "../script_data/Siddham.json": () => import("./Siddham-Cf9Jp5KF.js"), "../script_data/Sinhala.json": () => import("./Sinhala-C6t7GaP6.js"), "../script_data/Tamil-Extended.json": () => import("./Tamil-Extended-nmDMmVeX.js"), "../script_data/Tamil.json": () => import("./Tamil-CR4VFQvV.js"), "../script_data/Telugu.json": () => import("./Telugu-BCg-EHjf.js") }), `../script_data/${n}.json`, 3).then(
|
|
27
|
-
(e) => e.default
|
|
28
|
-
)), le[n]), J = {
|
|
29
|
-
"all_to_normal:replace_pancham_varga_varna_with_n": { from_script_type: "all", to_script_name: ["Normal"], check_in: "output", rules: [{ type: "replace_prev_krama_keys", check_in: "output", prev: [60], following: [52, 53, 54, 55, 56, 57, 58, 59], replace_with: [72] }, { type: "replace_prev_krama_keys", check_in: "output", prev: [67], following: [61, 62, 63, 64, 65, 66], replace_with: [72] }] },
|
|
30
|
-
"brahmic_to_brahmic:replace_pancham_varga_varna_with_anusvAra": { from_script_type: "brahmic", to_script_type: "brahmic", check_in: "input", rules: [{ type: "replace_prev_krama_keys", check_in: "input", prev: [60, 49], following: [52, 53, 54, 55, 56, 57, 58, 59], replace_with: [45] }, { type: "replace_prev_krama_keys", check_in: "input", prev: [67, 49], following: [61, 62, 63, 64, 65, 66], replace_with: [45] }, { type: "replace_prev_krama_keys", check_in: "input", prev: [81, 49], following: [74, 75, 76, 77, 78, 79, 80], replace_with: [45] }, { type: "replace_prev_krama_keys", check_in: "input", prev: [72, 49], following: [68, 69, 70, 71], replace_with: [45] }, { type: "replace_prev_krama_keys", check_in: "input", prev: [88, 49], following: [82, 83, 85, 86, 87], replace_with: [45] }] },
|
|
31
|
-
"all_to_sinhala:use_conjunct_enabling_halant": { from_script_type: "all", to_script_name: ["Sinhala"], check_in: "output", rules: [{ type: "direct_replace", check_in: "output", to_replace: [[49]], replace_text: "්", replace_with: [] }] },
|
|
32
|
-
"all_to_normal:remove_virAma_and_double_virAma": { from_script_type: "all", to_script_name: ["Normal", "Romanized"], check_in: "output", rules: [{ type: "direct_replace", check_in: "output", to_replace: [[116], [115]], replace_with: [-1] }] },
|
|
33
|
-
"all_to_normal:replace_avagraha_with_a": { from_script_type: "all", to_script_name: ["Normal", "Romanized"], check_in: "output", rules: [{ type: "direct_replace", check_in: "output", to_replace: [[48]], replace_with: [1] }] },
|
|
34
|
-
"normal_to_all:use_typing_chars": { from_script_name: ["Normal"], to_script_type: "all", check_in: "output", rules: [] },
|
|
35
|
-
"all_to_normal:preserve_specific_chars": { from_script_type: "all", to_script_name: ["Normal"], check_in: "output", rules: [] }
|
|
36
|
-
}, xe = (n, e) => {
|
|
37
|
-
const l = n.krama_text_arr[e]?.[0];
|
|
38
|
-
return typeof l == "string" ? l : null;
|
|
39
|
-
}, U = (n, e) => xe(n, e) ?? "", Z = (n, e) => Q(
|
|
40
|
-
n.krama_text_arr,
|
|
41
|
-
n.krama_text_arr_index,
|
|
42
|
-
e,
|
|
43
|
-
{
|
|
44
|
-
accessor: (l, t) => l[t][0]
|
|
45
|
-
}
|
|
46
|
-
), Ae = () => {
|
|
47
|
-
let n = [];
|
|
48
|
-
function e(i) {
|
|
49
|
-
i && n.push(i);
|
|
50
|
-
}
|
|
51
|
-
function l(i) {
|
|
52
|
-
for (const r of i) e(r);
|
|
53
|
-
}
|
|
54
|
-
function t() {
|
|
55
|
-
return n.at(-1);
|
|
56
|
-
}
|
|
57
|
-
function a() {
|
|
58
|
-
return t()?.at(-1);
|
|
59
|
-
}
|
|
60
|
-
function s() {
|
|
61
|
-
const i = t();
|
|
62
|
-
if (!i) return;
|
|
63
|
-
const r = i.at(-1), u = i.slice(0, -1);
|
|
64
|
-
return u ? n[n.length - 1] = u : n.pop(), r;
|
|
65
|
-
}
|
|
66
|
-
function c(i, r) {
|
|
67
|
-
n.splice(-i, i, ...r.filter(Boolean));
|
|
68
|
-
}
|
|
69
|
-
function o(i, r) {
|
|
70
|
-
const u = s();
|
|
71
|
-
if (!u) {
|
|
72
|
-
l(i), l(r);
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
l(i), e(u), l(r);
|
|
76
|
-
}
|
|
77
|
-
function h(i) {
|
|
78
|
-
const r = n.at(i);
|
|
79
|
-
return r ? {
|
|
80
|
-
cp: i,
|
|
81
|
-
ch: r,
|
|
82
|
-
width: r.length
|
|
83
|
-
} : null;
|
|
84
|
-
}
|
|
85
|
-
function _(i, r) {
|
|
86
|
-
i < 0 && (i = n.length + i), !(i < 0 || i >= n.length) && (n[i] = r);
|
|
87
|
-
}
|
|
88
|
-
return {
|
|
89
|
-
emit: e,
|
|
90
|
-
emitPieces: l,
|
|
91
|
-
lastPiece: t,
|
|
92
|
-
lastChar: a,
|
|
93
|
-
popLastChar: s,
|
|
94
|
-
rewriteTailPieces: c,
|
|
95
|
-
withLastCharMovedAfter: o,
|
|
96
|
-
toString: () => n.join(""),
|
|
97
|
-
rewriteAt: _,
|
|
98
|
-
peekAt: h
|
|
99
|
-
};
|
|
100
|
-
}, we = (n) => {
|
|
101
|
-
let e = [];
|
|
102
|
-
function l() {
|
|
103
|
-
e = [];
|
|
104
|
-
}
|
|
105
|
-
function t() {
|
|
106
|
-
return e.length;
|
|
107
|
-
}
|
|
108
|
-
function a(u) {
|
|
109
|
-
return e.at(u);
|
|
110
|
-
}
|
|
111
|
-
function s() {
|
|
112
|
-
return e.at(-1);
|
|
113
|
-
}
|
|
114
|
-
function c() {
|
|
115
|
-
return s()?.[0];
|
|
116
|
-
}
|
|
117
|
-
function o() {
|
|
118
|
-
return s()?.[1]?.type;
|
|
119
|
-
}
|
|
120
|
-
function h(u) {
|
|
121
|
-
return a(u)?.[1]?.type;
|
|
122
|
-
}
|
|
123
|
-
function _(u) {
|
|
124
|
-
return a(u)?.[0];
|
|
125
|
-
}
|
|
126
|
-
function i(u) {
|
|
127
|
-
return o() === u;
|
|
128
|
-
}
|
|
129
|
-
function r(u) {
|
|
130
|
-
const m = u[0];
|
|
131
|
-
m !== void 0 && m.length > 0 && e.push(u), e.length > n && e.shift();
|
|
132
|
-
}
|
|
133
|
-
return {
|
|
134
|
-
clear: l,
|
|
135
|
-
length: t,
|
|
136
|
-
at: a,
|
|
137
|
-
last: s,
|
|
138
|
-
lastText: c,
|
|
139
|
-
lastType: o,
|
|
140
|
-
typeAt: h,
|
|
141
|
-
textAt: _,
|
|
142
|
-
isLastType: i,
|
|
143
|
-
push: r
|
|
144
|
-
};
|
|
145
|
-
}, be = (n) => {
|
|
146
|
-
let e = 0;
|
|
147
|
-
function l(o) {
|
|
148
|
-
const h = n.codePointAt(o);
|
|
149
|
-
if (h === void 0) return null;
|
|
150
|
-
const _ = String.fromCodePoint(h);
|
|
151
|
-
return { cp: h, ch: _, width: _.length };
|
|
152
|
-
}
|
|
153
|
-
function t() {
|
|
154
|
-
return l(e);
|
|
155
|
-
}
|
|
156
|
-
function a(o) {
|
|
157
|
-
return l(e + o);
|
|
158
|
-
}
|
|
159
|
-
function s(o) {
|
|
160
|
-
e += o;
|
|
161
|
-
}
|
|
162
|
-
function c(o, h) {
|
|
163
|
-
return n.substring(o, h);
|
|
164
|
-
}
|
|
165
|
-
return {
|
|
166
|
-
get pos() {
|
|
167
|
-
return e;
|
|
168
|
-
},
|
|
169
|
-
peek: t,
|
|
170
|
-
peekAt: l,
|
|
171
|
-
peekAtOffsetUnits: a,
|
|
172
|
-
advance: s,
|
|
173
|
-
slice: c
|
|
174
|
-
};
|
|
175
|
-
}, ce = (n, e, l, t) => {
|
|
176
|
-
for (let a = 0; a < l.length; a++) {
|
|
177
|
-
const s = l[l.length - 1 - a], c = n(e - a);
|
|
178
|
-
if (c === null) return { matched: !1, matchedLen: 0 };
|
|
179
|
-
const o = Z(t, c.ch);
|
|
180
|
-
if (o === -1 || o !== s)
|
|
181
|
-
return { matched: !1, matchedLen: 0 };
|
|
182
|
-
}
|
|
183
|
-
return { matched: !0, matchedLen: l.length };
|
|
184
|
-
}, se = (n, e) => n.map((l) => U(e, l)).filter(Boolean), Te = ["²", "³", "⁴"], S = (n) => !!n && Te.indexOf(
|
|
185
|
-
n
|
|
186
|
-
) !== -1, je = ["॒", "॑", "᳚", "᳛"], oe = (n) => !!n && je.indexOf(n) !== -1, L = (n) => n === "Tamil-Extended", H = (n, e, l, t) => {
|
|
187
|
-
if (e.length === 0) return;
|
|
188
|
-
if (!t) {
|
|
189
|
-
n.emitPieces(e);
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
const a = e[0] ?? "";
|
|
193
|
-
if (a[0] === l) {
|
|
194
|
-
const s = a.slice(1), c = [];
|
|
195
|
-
s && c.push(s);
|
|
196
|
-
for (let o = 1; o < e.length; o++) c.push(e[o]);
|
|
197
|
-
n.withLastCharMovedAfter([l], c);
|
|
198
|
-
} else
|
|
199
|
-
n.withLastCharMovedAfter(e, []);
|
|
200
|
-
}, pe = ["#an", "#sss", "#ss", "#s"], Se = ["↓", "↑↑↑", "↑↑", "↑"], Ne = (n, e) => {
|
|
201
|
-
if (!n) return n;
|
|
202
|
-
if (n.indexOf("x") !== -1 && (n = n.replaceAll("x", "kSh")), e === "Tamil-Extended")
|
|
203
|
-
for (let l = 0; l < pe.length; l++) {
|
|
204
|
-
const t = pe[l];
|
|
205
|
-
n.indexOf(t) !== -1 && (n = n.replaceAll(t, Se[l]));
|
|
206
|
-
}
|
|
207
|
-
return n;
|
|
208
|
-
}, Le = [" ", `
|
|
209
|
-
`, "\r", " ", ",", "~", "!", "@", "?", "%"], Ee = 3;
|
|
210
|
-
function j(n, e, l) {
|
|
211
|
-
const {
|
|
212
|
-
from_script_name: t,
|
|
213
|
-
to_script_name: a,
|
|
214
|
-
from_script_data: s,
|
|
215
|
-
to_script_data: c,
|
|
216
|
-
trans_options: o,
|
|
217
|
-
result: h,
|
|
218
|
-
prev_context: _,
|
|
219
|
-
BRAHMIC_HALANT: i,
|
|
220
|
-
BRAHMIC_NUQTA: r,
|
|
221
|
-
typing_mode: u,
|
|
222
|
-
include_inherent_vowel: m
|
|
223
|
-
} = n, { next: d, last_extra_call: E } = l ?? {};
|
|
224
|
-
let K = !1;
|
|
225
|
-
if (
|
|
226
|
-
// vyanjana, nuqta, svara
|
|
227
|
-
(r && _.typeAt(-3) === "vyanjana" && _.textAt(-2) === r && _.typeAt(-1) === "mAtrA" || // or vyanjana, svara
|
|
228
|
-
_.typeAt(-2) === "vyanjana" && _.typeAt(-1) === "mAtrA") && // to anya or null
|
|
229
|
-
(!e || e[1]?.type === "anya") && _.clear(), s.script_type === "brahmic" && c.script_type === "other"
|
|
230
|
-
)
|
|
231
|
-
e[0] !== i && (!(L(t) && e[0] && e[0].length > 0) || e[0].charAt(0) !== i) && // (BRAHMIC_NUQTA ? item[0] !== BRAHMIC_NUQTA : true) &&
|
|
232
|
-
(!r || e[0] !== r) && // ^ two special cases to ignore
|
|
233
|
-
// vyanjana or vyanjana, nuqta
|
|
234
|
-
(_.typeAt(-1) === "vyanjana" || r && _.typeAt(-2) === "vyanjana" && _.textAt(-1) === r) && // to anya or null
|
|
235
|
-
(e[1]?.type !== "mAtrA" && e[0] !== i || e[1]?.type === "anya" || e[1] === null || e[1] === void 0) && h.emit(c.schwa_character);
|
|
236
|
-
else if (s.script_type === "other" && c.script_type === "brahmic")
|
|
237
|
-
if (_.typeAt(-1) === "vyanjana" && (e[1]?.type === "mAtrA" || e[1]?.type === "svara")) {
|
|
238
|
-
const y = e[1].type === "svara" ? U(c, e[1].mAtrA_krama_ref?.[0] ?? -1) : e[0];
|
|
239
|
-
L(a) && S(h.lastChar()) ? H(h, [y], c.halant, !0) : H(h, [y], c.halant, !1), K = !0;
|
|
240
|
-
} else // default transliteration behavior (without schwa deletion)
|
|
241
|
-
!m && _.typeAt(-1) === "vyanjana" && !(e[0] === i || e[1]?.type === "mAtrA") ? L(a) && S(h.lastChar()) ? H(h, [i], c.halant, !0) : (H(h, [i], c.halant, !1), a === "Sinhala" && o["all_to_sinhala:use_conjunct_enabling_halant"] && h.rewriteAt(-1, h.lastPiece() + "")) : (
|
|
242
|
-
// if to include inherent vowel then check when to add that skipped halant
|
|
243
|
-
m && e && e[1]?.type === "vyanjana" && (_.typeAt(-1) === "vyanjana" || r && _.typeAt(-2) === "vyanjana" && _.textAt(-1) === r) && (L(a) && S(h.lastChar()) ? H(h, [i], c.halant, !0) : (H(h, [i], c.halant, !1), a === "Sinhala" && o["all_to_sinhala:use_conjunct_enabling_halant"] && h.rewriteAt(-1, h.lastPiece() + "")))
|
|
244
|
-
);
|
|
245
|
-
let q = !1;
|
|
246
|
-
return u && (d === void 0 || d.length === 0) && !E && // the case below is to enable typing of #an, #s (Vedic svara chihnas too)
|
|
247
|
-
!(L(a) && S(h.lastChar())) && (q = !0, e[1]?.type === "vyanjana" && (q = !1), q && _.clear()), (!u || !E && !q) && _.push(e), K;
|
|
248
|
-
}
|
|
249
|
-
function he(n, e, l) {
|
|
250
|
-
const { custom_rules: t, cursor: a, result: s, from_script_data: c, to_script_data: o } = n, h = e + l;
|
|
251
|
-
for (let _ = 0; _ < t.length; _++) {
|
|
252
|
-
if (t[_].use_replace === !0) continue;
|
|
253
|
-
const i = t[_];
|
|
254
|
-
if (i.type === "replace_prev_krama_keys") {
|
|
255
|
-
if (i.check_in === "input") {
|
|
256
|
-
const r = ce(
|
|
257
|
-
a.peekAt,
|
|
258
|
-
h,
|
|
259
|
-
i.prev,
|
|
260
|
-
c
|
|
261
|
-
), u = a.peekAt(e);
|
|
262
|
-
if (r.matched && u !== null) {
|
|
263
|
-
const m = u.ch, d = Z(c, m);
|
|
264
|
-
if (d !== -1 && i.following.indexOf(d) !== -1) {
|
|
265
|
-
const E = se(i.replace_with, o);
|
|
266
|
-
s.rewriteTailPieces(r.matchedLen, E);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
} else if (i.check_in === "output") {
|
|
270
|
-
const r = s.lastPiece();
|
|
271
|
-
if (!r) continue;
|
|
272
|
-
const u = Z(o, r);
|
|
273
|
-
if (u !== -1 && i.following.indexOf(u) !== -1) {
|
|
274
|
-
const m = ce(s.peekAt, -2, i.prev, o);
|
|
275
|
-
if (m.matched) {
|
|
276
|
-
const d = se(i.replace_with, o);
|
|
277
|
-
s.rewriteTailPieces(m.matchedLen + 1, [
|
|
278
|
-
...d,
|
|
279
|
-
r
|
|
280
|
-
]);
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
} else if (i.type === "direct_replace") {
|
|
285
|
-
const r = i.check_in === "output" ? o : c;
|
|
286
|
-
for (const u of i.to_replace) {
|
|
287
|
-
const m = ce(s.peekAt, -1, u, r);
|
|
288
|
-
if (!m.matched) continue;
|
|
289
|
-
if (i.replace_text) {
|
|
290
|
-
s.rewriteTailPieces(m.matchedLen, [i.replace_text]);
|
|
291
|
-
break;
|
|
292
|
-
}
|
|
293
|
-
const d = se(i.replace_with, r);
|
|
294
|
-
s.rewriteTailPieces(m.matchedLen, d);
|
|
295
|
-
break;
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
const Ce = (n, e, l) => {
|
|
301
|
-
if (!l) return {};
|
|
302
|
-
const t = {};
|
|
303
|
-
for (const [a, s] of Object.entries(l ?? {})) {
|
|
304
|
-
if (!(a in J)) continue;
|
|
305
|
-
const c = J[a];
|
|
306
|
-
(c.from_script_type === "all" && c.to_script_type === "all" || (c.from_script_type !== void 0 && (c.from_script_type === "all" || c.from_script_type === n.script_type) || c.from_script_name !== void 0 && c.from_script_name.includes(n.script_name)) && (c.to_script_type !== void 0 && (c.to_script_type === "all" || c.to_script_type === e.script_type) || c.to_script_name !== void 0 && c.to_script_name.includes(e.script_name))) && (t[a] = s);
|
|
307
|
-
}
|
|
308
|
-
return t;
|
|
309
|
-
}, Oe = (n, e, l) => {
|
|
310
|
-
const t = Ce(
|
|
311
|
-
n,
|
|
312
|
-
e,
|
|
313
|
-
l
|
|
314
|
-
), a = Object.keys(t).flatMap(
|
|
315
|
-
(s) => t[s] === !0 ? J[s].rules : []
|
|
316
|
-
);
|
|
317
|
-
return { trans_options: t, custom_rules: a };
|
|
318
|
-
}, me = (n, e) => n.replace_with.map((l) => U(e, l)).join(""), fe = (n, e, l, t) => {
|
|
319
|
-
if (l.length === 0) return n;
|
|
320
|
-
for (const a of l)
|
|
321
|
-
if (!(a.use_replace !== !0 || a.check_in !== t)) {
|
|
322
|
-
if (a.type === "replace_prev_krama_keys") {
|
|
323
|
-
const s = a.prev.map((c) => U(e, c)).join("");
|
|
324
|
-
for (let c of a.following) {
|
|
325
|
-
const o = U(e, c);
|
|
326
|
-
if (!o) continue;
|
|
327
|
-
const h = me(a, e) + o;
|
|
328
|
-
n = n.replaceAll(s + o, h);
|
|
329
|
-
}
|
|
330
|
-
} else if (a.type === "direct_replace") {
|
|
331
|
-
const s = a.to_replace.map(
|
|
332
|
-
(c) => c.map((o) => U(e, o)).join("")
|
|
333
|
-
);
|
|
334
|
-
for (let c of s)
|
|
335
|
-
n = n.replaceAll(c, me(a, e));
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
return n;
|
|
339
|
-
}, Pe = !0, Me = !1, De = (n, e, l, t, a, s, c, o) => {
|
|
340
|
-
const h = o?.useNativeNumerals ?? Pe, _ = o?.typing_mode ?? !1, i = o?.includeInherentVowel ?? Me;
|
|
341
|
-
if (_ && e !== "Normal")
|
|
342
|
-
throw new Error("Typing mode is only supported with Normal script as the input");
|
|
343
|
-
_ && (s["normal_to_all:use_typing_chars"] = !0), _ && e === "Normal" && (n = Ne(n, l)), n = fe(n, t, c, "input");
|
|
344
|
-
const r = Ae();
|
|
345
|
-
let u = 0;
|
|
346
|
-
const m = be(n), d = we(Ee), E = t.script_type === "brahmic" && a.script_type === "other" || t.script_type === "other" && a.script_type === "brahmic" || _ && e === "Normal" && a.script_type === "other", K = t.script_type === "brahmic" && a.script_type === "other" ? t.nuqta ?? null : t.script_type === "other" && a.script_type === "brahmic" ? a.nuqta ?? null : null, q = t.script_type === "brahmic" && a.script_type === "other" ? t.halant : t.script_type === "other" && a.script_type === "brahmic" ? a.halant : null, y = {
|
|
347
|
-
from_script_name: e,
|
|
348
|
-
to_script_name: l,
|
|
349
|
-
from_script_data: t,
|
|
350
|
-
to_script_data: a,
|
|
351
|
-
trans_options: s,
|
|
352
|
-
custom_rules: c,
|
|
353
|
-
cursor: m,
|
|
354
|
-
result: r,
|
|
355
|
-
prev_context: d,
|
|
356
|
-
BRAHMIC_NUQTA: K,
|
|
357
|
-
BRAHMIC_HALANT: q,
|
|
358
|
-
typing_mode: _,
|
|
359
|
-
include_inherent_vowel: i
|
|
360
|
-
}, ee = (s["normal_to_all:use_typing_chars"] || _) && e === "Normal" ? a.typing_text_to_krama_map : t.text_to_krama_map;
|
|
361
|
-
let v = -1;
|
|
362
|
-
for (; m.pos < n.length; ) {
|
|
363
|
-
u = m.pos;
|
|
364
|
-
const ne = m.peek();
|
|
365
|
-
if (!ne) break;
|
|
366
|
-
const V = ne.ch, z = ne.width, _e = z === 2 ? 1 : z;
|
|
367
|
-
if (v !== -1 && u >= v) {
|
|
368
|
-
v = -1, m.advance(z);
|
|
369
|
-
continue;
|
|
370
|
-
}
|
|
371
|
-
if (Le.indexOf(V) !== -1) {
|
|
372
|
-
m.advance(z), E && (j(y, [" ", null]), d.clear()), r.emit(V);
|
|
373
|
-
continue;
|
|
374
|
-
}
|
|
375
|
-
if (V.match(/^\d$/) && !h) {
|
|
376
|
-
r.emit(V), m.advance(z), j(y, [V, null]);
|
|
377
|
-
continue;
|
|
378
|
-
}
|
|
379
|
-
if (s["all_to_normal:preserve_specific_chars"] && l === "Normal") {
|
|
380
|
-
const x = Y(
|
|
381
|
-
t.custom_script_chars_arr,
|
|
382
|
-
V,
|
|
383
|
-
{
|
|
384
|
-
accessor: (A, T) => A[T][0]
|
|
385
|
-
}
|
|
386
|
-
);
|
|
387
|
-
if (x !== -1) {
|
|
388
|
-
const A = t.custom_script_chars_arr[x];
|
|
389
|
-
j(y, [
|
|
390
|
-
A[0],
|
|
391
|
-
t.list[A[1] ?? -1] ?? null
|
|
392
|
-
]);
|
|
393
|
-
const T = t.typing_text_to_krama_map[A[2] ?? -1]?.[0];
|
|
394
|
-
r.emit(T ?? ""), m.advance(A[0].length);
|
|
395
|
-
continue;
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
let R = -1;
|
|
399
|
-
{
|
|
400
|
-
let x = 0, A = -1;
|
|
401
|
-
const T = E && t.script_type === "other" && a.script_type === "brahmic" && (d.typeAt(-1) === "vyanjana" || K && d.typeAt(-2) === "vyanjana" && d.textAt(-1) === K);
|
|
402
|
-
for (; ; ) {
|
|
403
|
-
const G = m.peekAt(u + _e + x), $ = G?.ch ?? "";
|
|
404
|
-
v !== -1 && $ && S($) && (x += G?.width ?? 0);
|
|
405
|
-
const w = u + _e + x, f = (
|
|
406
|
-
// usage example: க்⁴ரு² -> ghR
|
|
407
|
-
v !== -1 ? (
|
|
408
|
-
// in this we will ignore the current charcter and scan one ahead
|
|
409
|
-
m.slice(u, v) + (w > v ? m.slice(v + 1, w) : "")
|
|
410
|
-
) : m.slice(u, w)
|
|
411
|
-
), N = Y(ee, f, {
|
|
412
|
-
accessor: (b, C) => b[C][0]
|
|
413
|
-
});
|
|
414
|
-
if (N === -1) {
|
|
415
|
-
R = -1;
|
|
416
|
-
break;
|
|
417
|
-
}
|
|
418
|
-
const k = ee[N];
|
|
419
|
-
if (T && k[1].krama && k[1].krama.length >= 1) {
|
|
420
|
-
const b = k[1].krama, C = b[0], O = a.krama_text_arr[C]?.[1], re = a.list[O ?? -1]?.type;
|
|
421
|
-
if (b.length === 1 && O !== null && O !== void 0 && (re === "svara" || re === "mAtrA"))
|
|
422
|
-
A = N;
|
|
423
|
-
else if (A !== -1) {
|
|
424
|
-
R = A;
|
|
425
|
-
break;
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
if (k[1].next && k[1].next.length > 0) {
|
|
429
|
-
const b = m.peekAt(w), C = b?.ch;
|
|
430
|
-
if (L(e) && t.script_type === "brahmic") {
|
|
431
|
-
const F = b ? m.peekAt(w + b.width) : null, O = F?.ch, M = (b && F ? m.peekAt(w + b.width + F.width) : null)?.ch;
|
|
432
|
-
if (v === -1 && O !== void 0 && S(O) && k[1].next.indexOf(O) !== -1) {
|
|
433
|
-
const B = Y(
|
|
434
|
-
t.text_to_krama_map,
|
|
435
|
-
f + O,
|
|
436
|
-
{
|
|
437
|
-
accessor: (P, g) => P[g][0]
|
|
438
|
-
}
|
|
439
|
-
), D = Q(
|
|
440
|
-
t.krama_text_arr,
|
|
441
|
-
t.krama_text_arr_index,
|
|
442
|
-
C ?? "",
|
|
443
|
-
{
|
|
444
|
-
accessor: (P, g) => P[g][0]
|
|
445
|
-
}
|
|
446
|
-
);
|
|
447
|
-
if (B !== -1 && D !== -1) {
|
|
448
|
-
R = B;
|
|
449
|
-
const P = t.krama_text_arr[D], g = t.list[P[1] ?? -1]?.type;
|
|
450
|
-
if (C === t.halant || g === "mAtrA") {
|
|
451
|
-
v = w + (b?.width ?? 0);
|
|
452
|
-
break;
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
} else if (v === -1 && M !== void 0 && S(M) && k[1].next.indexOf(M) !== -1) {
|
|
456
|
-
const B = Y(
|
|
457
|
-
t.text_to_krama_map,
|
|
458
|
-
f + M,
|
|
459
|
-
{
|
|
460
|
-
accessor: (g, I) => g[I][0]
|
|
461
|
-
}
|
|
462
|
-
), D = Q(
|
|
463
|
-
t.krama_text_arr,
|
|
464
|
-
t.krama_text_arr_index,
|
|
465
|
-
C ?? "",
|
|
466
|
-
{
|
|
467
|
-
accessor: (g, I) => g[I][0]
|
|
468
|
-
}
|
|
469
|
-
), P = Q(
|
|
470
|
-
t.krama_text_arr,
|
|
471
|
-
t.krama_text_arr_index,
|
|
472
|
-
O ?? "",
|
|
473
|
-
{
|
|
474
|
-
accessor: (g, I) => g[I][0]
|
|
475
|
-
}
|
|
476
|
-
);
|
|
477
|
-
if (B !== -1 && D !== -1 && P !== -1) {
|
|
478
|
-
const g = t.krama_text_arr[D], I = t.krama_text_arr[P];
|
|
479
|
-
R = B;
|
|
480
|
-
const ie = t.list[g[1] ?? -1]?.type, ge = t.list[I[1] ?? -1]?.type;
|
|
481
|
-
if (ie === "mAtrA" && ge === "mAtrA") {
|
|
482
|
-
v = w + (b?.width ?? 0) + (F?.width ?? 0);
|
|
483
|
-
break;
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
if (v === -1 && C !== void 0 && O !== void 0 && oe(O) && M !== void 0 && S(M) && k[1].next.indexOf(M) !== -1) {
|
|
488
|
-
const B = Q(
|
|
489
|
-
t.krama_text_arr,
|
|
490
|
-
t.krama_text_arr_index,
|
|
491
|
-
C ?? "",
|
|
492
|
-
{ accessor: (D, P) => D[P][0] }
|
|
493
|
-
);
|
|
494
|
-
if (B !== -1) {
|
|
495
|
-
const D = t.krama_text_arr[B];
|
|
496
|
-
if (t.list[D[1] ?? -1]?.type === "mAtrA") {
|
|
497
|
-
const g = Y(
|
|
498
|
-
t.text_to_krama_map,
|
|
499
|
-
f + M,
|
|
500
|
-
{ accessor: (I, ie) => I[ie][0] }
|
|
501
|
-
);
|
|
502
|
-
if (g !== -1) {
|
|
503
|
-
R = g, v = w + (b?.width ?? 0) + (F?.width ?? 0);
|
|
504
|
-
break;
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
if (C !== void 0 && k[1].next.indexOf(C) !== -1) {
|
|
511
|
-
x += b?.width ?? 0;
|
|
512
|
-
continue;
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
R = N;
|
|
516
|
-
break;
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
const p = R !== -1 ? ee[R] : null;
|
|
520
|
-
if (p !== null) {
|
|
521
|
-
const x = v !== -1 && p[0].length > 1 && t.list[t.krama_text_arr[p[1].krama?.[0] ?? -1]?.[1] ?? -1]?.type === "vyanjana" && S(p[0].at(-1) ?? void 0) ? 1 : 0, A = p[0].length - x;
|
|
522
|
-
if (m.advance(A), u = m.pos, s["normal_to_all:use_typing_chars"] && "custom_back_ref" in p[1] && p[1].custom_back_ref !== void 0 && p[1].custom_back_ref !== null) {
|
|
523
|
-
const T = a.custom_script_chars_arr[p[1].custom_back_ref] ?? null;
|
|
524
|
-
J !== null && (r.emit(T[0]), j(
|
|
525
|
-
y,
|
|
526
|
-
[p[0], a.list[T[1] ?? -1] ?? null],
|
|
527
|
-
{
|
|
528
|
-
next: p[1].next ?? void 0
|
|
529
|
-
}
|
|
530
|
-
));
|
|
531
|
-
continue;
|
|
532
|
-
}
|
|
533
|
-
if (p[1].krama !== null && p[1].krama !== void 0 && p[1].krama.some((T) => T !== -1)) {
|
|
534
|
-
const G = p[1].krama.map(
|
|
535
|
-
(f) => U(a, f)
|
|
536
|
-
// revert to the original character if the krama index is not found
|
|
537
|
-
), $ = G.join("");
|
|
538
|
-
let w = !1;
|
|
539
|
-
if (E)
|
|
540
|
-
if (t.script_type === "brahmic" && a.script_type === "other") {
|
|
541
|
-
let f = null;
|
|
542
|
-
if (!s["normal_to_all:use_typing_chars"] && p[1].fallback_list_ref !== void 0 && p[1].fallback_list_ref !== null)
|
|
543
|
-
f = t.list[p[1].fallback_list_ref];
|
|
544
|
-
else if (!p[1].krama || p[1].krama.length === 0)
|
|
545
|
-
f = null;
|
|
546
|
-
else {
|
|
547
|
-
const N = p[1].krama.map(
|
|
548
|
-
(k) => t.list[t.krama_text_arr[k][1] ?? -1]
|
|
549
|
-
);
|
|
550
|
-
L(e) && N.some((k) => k?.type === "mAtrA") && N.some((k) => k?.type === "vyanjana") ? f = { ...N[0], type: "anya" } : L(e) && N.length > 1 && N.some((k) => k == null) ? f = N.at(-1) : f = N[0];
|
|
551
|
-
}
|
|
552
|
-
w = j(y, [p[0], f]);
|
|
553
|
-
} else if (a.script_type === "brahmic" && t.script_type === "other") {
|
|
554
|
-
let f = null;
|
|
555
|
-
p[1].fallback_list_ref !== void 0 && p[1].fallback_list_ref !== null ? f = a.list[p[1].fallback_list_ref] : f = p[1].krama && p[1].krama.length > 0 ? a.list[a.krama_text_arr[p[1].krama[0]]?.[1] ?? -1] ?? null : null, _ && e === "Normal" ? w = j(y, [p[0], f], {
|
|
556
|
-
next: p[1].next ?? void 0
|
|
557
|
-
}) : w = j(y, [p[0], f]);
|
|
558
|
-
} else _ && e === "Normal" && a.script_type === "other" && (w = j(y, [p[0], null], {
|
|
559
|
-
next: p[1].next ?? void 0
|
|
560
|
-
}));
|
|
561
|
-
if (!w)
|
|
562
|
-
if (a.script_type === "brahmic" && L(l) && (a.list[p[1].krama?.at(-1) ?? -1]?.type === "mAtrA" || $ === a.halant) && S(r.lastChar()))
|
|
563
|
-
H(
|
|
564
|
-
r,
|
|
565
|
-
G,
|
|
566
|
-
a.halant,
|
|
567
|
-
!0
|
|
568
|
-
);
|
|
569
|
-
else if (L(l) && oe(G.at(-1)?.at(-1) ?? "") && S(r.lastChar())) {
|
|
570
|
-
const f = r.popLastChar();
|
|
571
|
-
r.emitPieces(G), r.emit(f ?? "");
|
|
572
|
-
} else
|
|
573
|
-
r.emitPieces(G);
|
|
574
|
-
he(y, u, -A);
|
|
575
|
-
continue;
|
|
576
|
-
} else if (p[1].krama !== null && p[1].krama !== void 0 && p[1].krama.some((T) => T === -1)) {
|
|
577
|
-
r.emit(p[0]), _ && j(y, [p[0], null], {
|
|
578
|
-
next: p[1].next ?? void 0
|
|
579
|
-
});
|
|
580
|
-
continue;
|
|
581
|
-
}
|
|
582
|
-
} else
|
|
583
|
-
m.advance(z), u = m.pos;
|
|
584
|
-
const W = p === null ? V : p[0], X = Z(t, W);
|
|
585
|
-
if (X === -1) {
|
|
586
|
-
E && (j(y, [W, null]), d.clear()), r.emit(W);
|
|
587
|
-
continue;
|
|
588
|
-
}
|
|
589
|
-
let ae = !1;
|
|
590
|
-
if (E && (t.script_type === "brahmic" ? ae = j(y, [
|
|
591
|
-
W,
|
|
592
|
-
t.list[t.krama_text_arr[X][1] ?? -1]
|
|
593
|
-
]) : a.script_type === "brahmic" && (ae = j(y, [
|
|
594
|
-
W,
|
|
595
|
-
a.list[a.krama_text_arr[X][1] ?? -1]
|
|
596
|
-
]))), !ae) {
|
|
597
|
-
const x = U(a, X);
|
|
598
|
-
if (a.script_type === "brahmic" && L(l) && (a.list[a.krama_text_arr[X][1] ?? -1]?.type === "mAtrA" || x === a.halant) && S(r.lastChar()))
|
|
599
|
-
H(r, [x], a.halant, !0);
|
|
600
|
-
else if (L(l) && oe(x) && S(r.lastChar())) {
|
|
601
|
-
const A = r.popLastChar();
|
|
602
|
-
r.emit(x), r.emit(A ?? "");
|
|
603
|
-
} else
|
|
604
|
-
r.emit(x);
|
|
605
|
-
}
|
|
606
|
-
he(y, u, -z);
|
|
607
|
-
}
|
|
608
|
-
E && j(y, [void 0, null], { last_extra_call: !0 });
|
|
609
|
-
let te = r.toString();
|
|
610
|
-
return te = fe(te, a, c, "output"), {
|
|
611
|
-
output: te,
|
|
612
|
-
/** Can be used to manage context while using the typing feature.
|
|
613
|
-
* If this is 0, the external context can be cleared
|
|
614
|
-
*/
|
|
615
|
-
context_length: d.length()
|
|
616
|
-
};
|
|
617
|
-
}, ze = async (n, e, l, t, a) => {
|
|
618
|
-
const [s, c] = await Promise.all([
|
|
619
|
-
ue(e),
|
|
620
|
-
ue(l)
|
|
621
|
-
]), { trans_options: o, custom_rules: h } = Oe(
|
|
622
|
-
s,
|
|
623
|
-
c,
|
|
624
|
-
t
|
|
625
|
-
);
|
|
626
|
-
return De(
|
|
627
|
-
n,
|
|
628
|
-
e,
|
|
629
|
-
l,
|
|
630
|
-
s,
|
|
631
|
-
c,
|
|
632
|
-
o,
|
|
633
|
-
h,
|
|
634
|
-
a
|
|
635
|
-
);
|
|
636
|
-
}, Ie = { Devanagari: 1, Telugu: 2, Tamil: 3, "Tamil-Extended": 4, Bengali: 5, Kannada: 6, Gujarati: 7, Malayalam: 8, Odia: 9, Sinhala: 10, Normal: 11, Romanized: 12, Gurumukhi: 13, Assamese: 14, "Purna-Devanagari": 15, Brahmi: 16, Granth: 17, Modi: 18, Sharada: 20, Siddham: 21 }, Re = { English: 1, Sanskrit: 2, Hindi: 3, Telugu: 4, Tamil: 5, Bengali: 6, Kannada: 7, Gujarati: 8, Malayalam: 9, Odia: 10, Sinhala: 11, Marathi: 12, Nepali: 13, Punjabi: 14, Assamese: 15 }, Ge = {
|
|
637
|
-
script_list: Ie,
|
|
638
|
-
lang_list: Re
|
|
639
|
-
}, { script_list: Be, lang_list: He } = Ge, ke = Object.keys(Be), de = Object.keys(He), Ke = Array.from(
|
|
640
|
-
/* @__PURE__ */ new Set([...de, ...ke])
|
|
641
|
-
), Ue = {
|
|
642
|
-
Bengali: "Bengali",
|
|
643
|
-
Gujarati: "Gujarati",
|
|
644
|
-
Hindi: "Devanagari",
|
|
645
|
-
Kannada: "Kannada",
|
|
646
|
-
Malayalam: "Malayalam",
|
|
647
|
-
Odia: "Odia",
|
|
648
|
-
Sinhala: "Sinhala",
|
|
649
|
-
Tamil: "Tamil",
|
|
650
|
-
Telugu: "Telugu",
|
|
651
|
-
English: "Normal",
|
|
652
|
-
Sanskrit: "Devanagari",
|
|
653
|
-
Marathi: "Devanagari",
|
|
654
|
-
Nepali: "Devanagari",
|
|
655
|
-
Punjabi: "Gurumukhi",
|
|
656
|
-
Assamese: "Assamese"
|
|
657
|
-
}, ye = {
|
|
658
|
-
dev: "Devanagari",
|
|
659
|
-
te: "Telugu",
|
|
660
|
-
tel: "Telugu",
|
|
661
|
-
tam: "Tamil",
|
|
662
|
-
"tam-ex": "Tamil-Extended",
|
|
663
|
-
ben: "Bengali",
|
|
664
|
-
be: "Bengali",
|
|
665
|
-
ka: "Kannada",
|
|
666
|
-
kan: "Kannada",
|
|
667
|
-
gu: "Gujarati",
|
|
668
|
-
guj: "Gujarati",
|
|
669
|
-
mal: "Malayalam",
|
|
670
|
-
or: "Odia",
|
|
671
|
-
od: "Odia",
|
|
672
|
-
oriya: "Odia",
|
|
673
|
-
si: "Sinhala",
|
|
674
|
-
sinh: "Sinhala",
|
|
675
|
-
sin: "Sinhala",
|
|
676
|
-
en: "Normal",
|
|
677
|
-
eng: "Normal",
|
|
678
|
-
la: "Normal",
|
|
679
|
-
lat: "Normal",
|
|
680
|
-
nor: "Normal",
|
|
681
|
-
norm: "Normal",
|
|
682
|
-
rom: "Romanized",
|
|
683
|
-
gur: "Gurumukhi",
|
|
684
|
-
as: "Assamese",
|
|
685
|
-
sa: "Devanagari",
|
|
686
|
-
san: "Devanagari",
|
|
687
|
-
hin: "Devanagari",
|
|
688
|
-
hi: "Devanagari",
|
|
689
|
-
mar: "Devanagari",
|
|
690
|
-
ne: "Devanagari",
|
|
691
|
-
nep: "Devanagari",
|
|
692
|
-
pun: "Gurumukhi"
|
|
693
|
-
};
|
|
694
|
-
function Ve(n) {
|
|
695
|
-
return n.toLowerCase().replace(/(^|-)([a-z])/g, (e, l, t) => l + t.toUpperCase());
|
|
696
|
-
}
|
|
697
|
-
const qe = (n) => {
|
|
698
|
-
const e = Ve(n);
|
|
699
|
-
return ke.includes(e) ? e : de.includes(e) ? Ue[e] : n.toLocaleLowerCase() in ye ? ye[n.toLocaleLowerCase()] : null;
|
|
700
|
-
};
|
|
701
|
-
export {
|
|
702
|
-
Ke as A,
|
|
703
|
-
de as L,
|
|
704
|
-
ke as S,
|
|
705
|
-
ue as a,
|
|
706
|
-
Ce as b,
|
|
707
|
-
J as c,
|
|
708
|
-
De as d,
|
|
709
|
-
qe as g,
|
|
710
|
-
Oe as r,
|
|
711
|
-
ze as t
|
|
712
|
-
};
|