@das-fed/utils 6.3.0-beta.9 → 6.4.0-dev.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.
Files changed (39) hide show
  1. package/api-services/modules/file/index.d.ts +1 -1
  2. package/api-services/modules/file/index.js +253 -244
  3. package/api-services/modules/file/index.js.gz +0 -0
  4. package/common-info/set-personal-info/index.js +591 -565
  5. package/common-info/set-personal-info/index.js.gz +0 -0
  6. package/common-tools/date-format/index.js +2 -1
  7. package/common-tools/get-url-params/index.d.ts +1 -1
  8. package/common-tools/get-url-params/index.js +49 -46
  9. package/common-tools/get-url-params/index.js.gz +0 -0
  10. package/common-tools/update-fav-icon/index.js +1 -1
  11. package/create-api-service/index.js +1405 -1371
  12. package/create-api-service/index.js.gz +0 -0
  13. package/create-api-service/sso/index.js +739 -714
  14. package/create-api-service/sso/index.js.gz +0 -0
  15. package/curring-http/index.js +856 -830
  16. package/curring-http/index.js.gz +0 -0
  17. package/directive/auth/index.d.ts +8 -0
  18. package/directive/auth/index.js +62 -0
  19. package/directive/auth/index.js.gz +0 -0
  20. package/directive/clickOutside/index.d.ts +6 -0
  21. package/directive/clickOutside/index.js +27 -0
  22. package/directive/hoverInside/index.d.ts +6 -0
  23. package/directive/hoverInside/index.js +21 -0
  24. package/directive/utils/index.d.ts +7 -0
  25. package/directive/utils/index.js +7 -0
  26. package/esm-map.json +135 -5
  27. package/hooks/popup-manager/use-zindex/index.d.ts +5 -0
  28. package/hooks/popup-manager/use-zindex/index.js +22 -0
  29. package/hooks/use-get-auth/apis.d.ts +4 -0
  30. package/hooks/use-get-auth/index.d.ts +9 -0
  31. package/hooks/use-get-auth/index.js +53 -0
  32. package/hooks/use-get-auth/index.js.gz +0 -0
  33. package/package.json +5 -3
  34. package/pinyin-first-character/index.js +142 -132
  35. package/pinyin-first-character/index.js.gz +0 -0
  36. package/style/index.js +1 -1
  37. package/style/index.js.gz +0 -0
  38. package/vue/hooks/use-model-value/index.d.ts +5 -0
  39. package/vue/hooks/use-model-value/index.js +10 -0
@@ -1,8 +1,8 @@
1
- const A = /^[\uD800-\uDBFF]$/, B = /^[\uDC00-\uDFFF]$/, H = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
2
- var a;
1
+ const H = /^[\uD800-\uDBFF]$/, Q = /^[\uDC00-\uDFFF]$/, V = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
2
+ var P;
3
3
  (function(n) {
4
4
  n[n.Unknown = 1e-13] = "Unknown", n[n.Rule = 1e-12] = "Rule", n[n.DICT = 2e-8] = "DICT", n[n.Surname = 1] = "Surname", n[n.Custom = 1] = "Custom";
5
- })(a || (a = {}));
5
+ })(P || (P = {}));
6
6
  const j = {
7
7
  Normal: 1,
8
8
  Surname: 10,
@@ -10,18 +10,18 @@ const j = {
10
10
  };
11
11
  function d(n) {
12
12
  var i;
13
- return n.length - (((i = n.match(H)) === null || i === void 0 ? void 0 : i.length) || 0);
13
+ return n.length - (((i = n.match(V)) === null || i === void 0 ? void 0 : i.length) || 0);
14
14
  }
15
15
  function w(n) {
16
16
  const i = [];
17
17
  let g = 0;
18
18
  for (; g < n.length; ) {
19
19
  const h = n[g];
20
- A.test(h) && B.test(n[g + 1]) ? (i.push(n.substring(g, g + 2)), g += 2) : (i.push(h), g += 1);
20
+ H.test(h) && Q.test(n[g + 1]) ? (i.push(n.substring(g, g + 2)), g += 2) : (i.push(h), g += 1);
21
21
  }
22
22
  return i;
23
23
  }
24
- class $ {
24
+ class F {
25
25
  constructor() {
26
26
  this.NumberDICT = [], this.StringDICT = /* @__PURE__ */ new Map();
27
27
  }
@@ -45,7 +45,7 @@ class $ {
45
45
  this.NumberDICT = [], this.StringDICT.clear();
46
46
  }
47
47
  }
48
- const k = {
48
+ const S = {
49
49
  "bǎng páng pāng": ["膀"],
50
50
  líng: [
51
51
  "〇",
@@ -18705,13 +18705,13 @@ const k = {
18705
18705
  "zhǐ dǐ": ["茋"],
18706
18706
  "gǒng hóng": ["硔"],
18707
18707
  "yáo xiào": ["滧"]
18708
- }, x = new $();
18709
- Object.keys(k).forEach((n) => {
18710
- const i = k[n];
18708
+ }, x = new F();
18709
+ Object.keys(S).forEach((n) => {
18710
+ const i = S[n];
18711
18711
  for (let g of i)
18712
18712
  x.set(g, n);
18713
18713
  });
18714
- const Q = [
18714
+ const G = [
18715
18715
  "zh",
18716
18716
  "ch",
18717
18717
  "sh",
@@ -18736,7 +18736,7 @@ const Q = [
18736
18736
  "y",
18737
18737
  "w",
18738
18738
  ""
18739
- ], V = ["j", "q", "x"], G = [
18739
+ ], J = ["j", "q", "x"], K = [
18740
18740
  "uān",
18741
18741
  "uán",
18742
18742
  "uǎn",
@@ -18757,7 +18757,7 @@ const Q = [
18757
18757
  "ǔ",
18758
18758
  "ù",
18759
18759
  "u"
18760
- ], J = {
18760
+ ], X = {
18761
18761
  uān: "üān",
18762
18762
  uán: "üán",
18763
18763
  uǎn: "üǎn",
@@ -18778,7 +18778,7 @@ const Q = [
18778
18778
  ǔ: "ǚ",
18779
18779
  ù: "ǜ",
18780
18780
  u: "ü"
18781
- }, K = [
18781
+ }, Y = [
18782
18782
  "ia",
18783
18783
  "ian",
18784
18784
  "iang",
@@ -18797,7 +18797,7 @@ const Q = [
18797
18797
  "üe",
18798
18798
  "van",
18799
18799
  "ve"
18800
- ], P = {
18800
+ ], D = {
18801
18801
  一: "yì",
18802
18802
  二: "èr",
18803
18803
  三: "sān",
@@ -18822,13 +18822,13 @@ const Q = [
18822
18822
  第一: "dì yī",
18823
18823
  一十: "yī shí",
18824
18824
  一十一: "yī shí yī"
18825
- }, D = {
18825
+ }, T = {
18826
18826
  重: "chóng",
18827
18827
  行: "háng",
18828
18828
  斗: "dǒu",
18829
18829
  更: "gēng"
18830
18830
  };
18831
- function X() {
18831
+ function nn() {
18832
18832
  const n = {
18833
18833
  零一: "líng yī",
18834
18834
  "〇一": "líng yī",
@@ -18837,21 +18837,21 @@ function X() {
18837
18837
  第一: "dì yī",
18838
18838
  一十一: "yī shí yī"
18839
18839
  };
18840
- for (let i in P)
18841
- for (let g in D) {
18842
- const h = `${i}${g}`, u = `${P[i]} ${D[g]}`;
18840
+ for (let i in D)
18841
+ for (let g in T) {
18842
+ const h = `${i}${g}`, u = `${D[i]} ${T[g]}`;
18843
18843
  n[h] = u;
18844
18844
  }
18845
18845
  return n;
18846
18846
  }
18847
- const T = X(), Y = Object.keys(T).map((n) => ({
18847
+ const Z = nn(), gn = Object.keys(Z).map((n) => ({
18848
18848
  zh: n,
18849
- pinyin: T[n],
18849
+ pinyin: Z[n],
18850
18850
  probability: 1e-12,
18851
18851
  length: d(n),
18852
18852
  priority: j.Normal,
18853
18853
  dict: Symbol("rule")
18854
- })), L = {
18854
+ })), O = {
18855
18855
  // 说不说,说一说,叠词之间发音为轻声
18856
18856
  不: {
18857
18857
  bú: [4]
@@ -18861,37 +18861,37 @@ const T = X(), Y = Object.keys(T).map((n) => ({
18861
18861
  yí: [4],
18862
18862
  yì: [1, 2, 3]
18863
18863
  }
18864
- }, nn = {
18864
+ }, hn = {
18865
18865
  不: ["的", "而", "之", "后", "也", "还", "地"],
18866
18866
  一: ["的", "而", "之", "后", "也", "还", "是"]
18867
- }, gn = Object.keys(L);
18868
- function hn(n, i, g) {
18869
- if (gn.indexOf(n) === -1)
18870
- return r(n);
18871
- if (i === g && i && r(i) !== i)
18872
- return q(r(n));
18873
- if (g && !nn[n].includes(g)) {
18874
- const h = r(g);
18867
+ }, un = Object.keys(O);
18868
+ function sn(n, i, g) {
18869
+ if (un.indexOf(n) === -1)
18870
+ return e(n);
18871
+ if (i === g && i && e(i) !== i)
18872
+ return f(e(n));
18873
+ if (g && !hn[n].includes(g)) {
18874
+ const h = e(g);
18875
18875
  if (h !== g) {
18876
- const u = f(h), s = L[n];
18876
+ const u = m(h), s = O[n];
18877
18877
  for (let z in s)
18878
18878
  if (s[z].indexOf(Number(u)) !== -1)
18879
18879
  return z;
18880
18880
  }
18881
18881
  }
18882
18882
  }
18883
- function un(n, i) {
18883
+ function zn(n, i) {
18884
18884
  if (n === "了" && (!i || !x.get(i)))
18885
18885
  return "liǎo";
18886
18886
  }
18887
- function sn(n, i) {
18887
+ function on(n, i) {
18888
18888
  if (n === "々")
18889
18889
  return !i || !x.get(i) ? "tóng" : x.get(i).split(" ")[0];
18890
18890
  }
18891
- function S(n, i, g) {
18892
- return sn(n, i) || un(n, i) || hn(n, i, g) || r(n);
18891
+ function C(n, i, g) {
18892
+ return on(n, i) || zn(n, i) || sn(n, i, g) || e(n);
18893
18893
  }
18894
- const p = {
18894
+ const a = {
18895
18895
  南宫: "nán gōng",
18896
18896
  第五: "dì wǔ",
18897
18897
  万俟: "mò qí",
@@ -19384,14 +19384,14 @@ const p = {
19384
19384
  六: "lù",
19385
19385
  啜: "chuài",
19386
19386
  行: "xíng"
19387
- }, zn = Object.keys(p).map((n) => ({
19387
+ }, yn = Object.keys(a).map((n) => ({
19388
19388
  zh: n,
19389
- pinyin: p[n],
19389
+ pinyin: a[n],
19390
19390
  probability: 1 + d(n),
19391
19391
  length: d(n),
19392
19392
  priority: j.Surname,
19393
19393
  dict: Symbol("surname")
19394
- })), C = {
19394
+ })), M = {
19395
19395
  这个: "zhè ge",
19396
19396
  成为: "chéng wéi",
19397
19397
  认为: "rèn wéi",
@@ -21548,14 +21548,14 @@ const p = {
21548
21548
  曲肱: "qū gōng",
21549
21549
  曲意: "qū yì",
21550
21550
  仡佬: "gē lǎo"
21551
- }, on = Object.keys(C).map((n) => ({
21551
+ }, ln = Object.keys(M).map((n) => ({
21552
21552
  zh: n,
21553
- pinyin: C[n],
21553
+ pinyin: M[n],
21554
21554
  probability: 2e-8,
21555
21555
  length: 2,
21556
21556
  priority: j.Normal,
21557
21557
  dict: Symbol("dict2")
21558
- })), M = {
21558
+ })), I = {
21559
21559
  为什么: "wèi shén me",
21560
21560
  实际上: "shí jì shang",
21561
21561
  检察长: "jiǎn chá zhǎng",
@@ -21881,14 +21881,14 @@ const p = {
21881
21881
  干哪行: "gàn nǎ háng",
21882
21882
  干一行: "gàn yì háng",
21883
21883
  曲别针: "qū bié zhēn"
21884
- }, yn = Object.keys(M).map((n) => ({
21884
+ }, cn = Object.keys(I).map((n) => ({
21885
21885
  zh: n,
21886
- pinyin: M[n],
21886
+ pinyin: I[n],
21887
21887
  probability: 2e-8,
21888
21888
  length: 3,
21889
21889
  priority: j.Normal,
21890
21890
  dict: Symbol("dict3")
21891
- })), Z = {
21891
+ })), N = {
21892
21892
  成吉思汗: "chéng jí sī hán",
21893
21893
  四通八达: "sì tōng bā dá",
21894
21894
  一模一样: "yì mú yí yàng",
@@ -23484,14 +23484,14 @@ const p = {
23484
23484
  曲意逢迎: "qū yì féng yíng",
23485
23485
  一行不行: "yì háng bù xíng",
23486
23486
  行行不行: "háng háng bù xíng"
23487
- }, ln = Object.keys(Z).map((n) => ({
23487
+ }, tn = Object.keys(N).map((n) => ({
23488
23488
  zh: n,
23489
- pinyin: Z[n],
23489
+ pinyin: N[n],
23490
23490
  probability: 2e-8,
23491
23491
  length: 4,
23492
23492
  priority: j.Normal,
23493
23493
  dict: Symbol("dict4")
23494
- })), I = {
23494
+ })), v = {
23495
23495
  巴尔干半岛: "bā ěr gàn bàn dǎo",
23496
23496
  巴尔喀什湖: "bā ěr kā shí hú",
23497
23497
  不幸而言中: "bú xìng ér yán zhòng",
@@ -23507,24 +23507,24 @@ const p = {
23507
23507
  亚得里亚海: "yà dé lǐ yà hǎi",
23508
23508
  眼不见为净: "yǎn bú jiàn wéi jìng",
23509
23509
  竹筒倒豆子: "zhú tǒng dào dòu zi"
23510
- }, cn = Object.keys(I).map((n) => ({
23510
+ }, jn = Object.keys(v).map((n) => ({
23511
23511
  zh: n,
23512
- pinyin: I[n],
23512
+ pinyin: v[n],
23513
23513
  probability: 2e-8,
23514
23514
  length: 5,
23515
23515
  priority: j.Normal,
23516
23516
  dict: Symbol("dict5")
23517
23517
  }));
23518
- function N(n, i) {
23518
+ function _(n, i) {
23519
23519
  return n && (n.decimal < i.decimal || n.decimal === i.decimal && n.probability > i.probability) ? n : i;
23520
23520
  }
23521
- function v(n) {
23521
+ function E(n) {
23522
23522
  n.probability < 1e-300 && (n.probability *= 1e300, n.decimal += 1);
23523
23523
  }
23524
- function tn(n) {
23524
+ function dn(n) {
23525
23525
  return n.priority === j.Custom ? -(n.length * n.length * 100) : n.priority === j.Surname ? -(n.length * n.length * 10) : 0;
23526
23526
  }
23527
- function jn(n, i) {
23527
+ function xn(n, i) {
23528
23528
  const g = [];
23529
23529
  let h = n.length - 1, u = n[h];
23530
23530
  for (let s = i - 1; s >= 0; s--) {
@@ -23532,74 +23532,74 @@ function jn(n, i) {
23532
23532
  for (; u && u.index + u.length - 1 === s; ) {
23533
23533
  const l = u.index, y = {
23534
23534
  probability: u.probability * z.probability,
23535
- decimal: z.decimal + tn(u),
23535
+ decimal: z.decimal + dn(u),
23536
23536
  patterns: z.patterns,
23537
23537
  concatPattern: u
23538
23538
  };
23539
- v(y), g[l] = N(g[l], y), u = n[--h];
23539
+ E(y), g[l] = _(g[l], y), u = n[--h];
23540
23540
  }
23541
23541
  const o = {
23542
23542
  probability: 1e-13 * z.probability,
23543
23543
  decimal: 0,
23544
23544
  patterns: z.patterns
23545
23545
  };
23546
- v(o), g[s] = N(g[s], o), g[s].concatPattern && (g[s].patterns = g[s].patterns.concat(g[s].concatPattern), g[s].concatPattern = void 0, delete g[s + 1]);
23546
+ E(o), g[s] = _(g[s], o), g[s].concatPattern && (g[s].patterns = g[s].patterns.concat(g[s].concatPattern), g[s].concatPattern = void 0, delete g[s + 1]);
23547
23547
  }
23548
23548
  return g[0].patterns.reverse();
23549
23549
  }
23550
- function F(n, i) {
23550
+ function A(n, i) {
23551
23551
  return n && n.count <= i.count ? n : i;
23552
23552
  }
23553
- function dn(n) {
23553
+ function bn(n) {
23554
23554
  return n.priority === j.Custom ? -(n.length * n.length * 1e5) : n.priority === j.Surname ? -(n.length * n.length * 100) : 1;
23555
23555
  }
23556
- function xn(n, i) {
23556
+ function en(n, i) {
23557
23557
  const g = [];
23558
23558
  let h = n.length - 1, u = n[h];
23559
23559
  for (let s = i - 1; s >= 0; s--) {
23560
23560
  const z = s + 1 >= i ? { count: 0, patterns: [] } : g[s + 1];
23561
23561
  for (; u && u.index + u.length - 1 === s; ) {
23562
23562
  const l = u.index, y = {
23563
- count: dn(u) + z.count,
23563
+ count: bn(u) + z.count,
23564
23564
  patterns: z.patterns,
23565
23565
  concatPattern: u
23566
23566
  };
23567
- g[l] = F(g[l], y), u = n[--h];
23567
+ g[l] = A(g[l], y), u = n[--h];
23568
23568
  }
23569
23569
  const o = {
23570
23570
  count: 1 + z.count,
23571
23571
  patterns: z.patterns
23572
23572
  };
23573
- g[s] = F(g[s], o), g[s].concatPattern && (g[s].patterns = g[s].patterns.concat(g[s].concatPattern), g[s].concatPattern = void 0, delete g[s + 1]);
23573
+ g[s] = A(g[s], o), g[s].concatPattern && (g[s].patterns = g[s].patterns.concat(g[s].concatPattern), g[s].concatPattern = void 0, delete g[s + 1]);
23574
23574
  }
23575
23575
  return g[0].patterns.reverse();
23576
23576
  }
23577
- function bn(n, i) {
23577
+ function rn(n, i) {
23578
23578
  return !(i.index + i.length <= n.index || i.priority > n.priority || i.priority === n.priority && i.length > n.length);
23579
23579
  }
23580
- function rn(n) {
23580
+ function wn(n) {
23581
23581
  const i = [];
23582
23582
  for (let g = n.length - 1; g >= 0; ) {
23583
23583
  const { index: h } = n[g];
23584
23584
  let u = g - 1;
23585
- for (; u >= 0 && bn(n[g], n[u]); )
23585
+ for (; u >= 0 && rn(n[g], n[u]); )
23586
23586
  u--;
23587
23587
  (u < 0 || n[u].index + n[u].length <= h) && i.push(n[g]), g = u;
23588
23588
  }
23589
23589
  return i.reverse();
23590
23590
  }
23591
- var O;
23591
+ var R;
23592
23592
  (function(n) {
23593
23593
  n[n.ReverseMaxMatch = 1] = "ReverseMaxMatch", n[n.MaxProbability = 2] = "MaxProbability", n[n.MinTokenization = 3] = "MinTokenization";
23594
- })(O || (O = {}));
23595
- class _ {
23594
+ })(R || (R = {}));
23595
+ class $ {
23596
23596
  constructor(i, g = "", h = "") {
23597
23597
  this.children = /* @__PURE__ */ new Map(), this.fail = null, this.patterns = [], this.parent = i, this.prefix = g, this.key = h;
23598
23598
  }
23599
23599
  }
23600
- class en {
23600
+ class qn {
23601
23601
  constructor() {
23602
- this.dictMap = /* @__PURE__ */ new Map(), this.queues = [], this.root = new _(null);
23602
+ this.dictMap = /* @__PURE__ */ new Map(), this.queues = [], this.root = new $(null);
23603
23603
  }
23604
23604
  build(i) {
23605
23605
  this.buildTrie(i), this.buildFailPointer();
@@ -23612,7 +23612,7 @@ class en {
23612
23612
  for (let s = 0; s < h.length; s++) {
23613
23613
  let z = h[s];
23614
23614
  if (!u.children.has(z)) {
23615
- const o = new _(u, h.slice(0, s).join(""), z);
23615
+ const o = new $(u, h.slice(0, s).join(""), z);
23616
23616
  u.children.set(z, o), this.addNodeToQueues(o);
23617
23617
  }
23618
23618
  u = u.children.get(z);
@@ -23684,23 +23684,23 @@ class en {
23684
23684
  }
23685
23685
  search(i, g, h = 2) {
23686
23686
  const u = this.match(i, g);
23687
- return h === 1 ? rn(u) : h === 3 ? xn(u, d(i)) : jn(u, d(i));
23687
+ return h === 1 ? wn(u) : h === 3 ? en(u, d(i)) : xn(u, d(i));
23688
23688
  }
23689
23689
  }
23690
- const wn = [
23690
+ const fn = [
23691
+ ...jn,
23692
+ ...tn,
23691
23693
  ...cn,
23692
23694
  ...ln,
23693
- ...yn,
23694
- ...on,
23695
- ...Y,
23696
- ...zn
23697
- ], R = new en();
23698
- R.build(wn);
23699
- const mn = new $(), qn = () => mn, r = (n) => {
23695
+ ...gn,
23696
+ ...yn
23697
+ ], U = new qn();
23698
+ U.build(fn);
23699
+ const mn = new F(), pn = () => mn, e = (n) => {
23700
23700
  const i = x.get(n);
23701
23701
  return i ? i.split(" ")[0] : n;
23702
- }, fn = (n, i, g, h) => {
23703
- const u = R.search(n, g, h);
23702
+ }, an = (n, i, g, h) => {
23703
+ const u = U.search(n, g, h);
23704
23704
  let s = 0;
23705
23705
  const z = w(n);
23706
23706
  for (let o = 0; o < z.length; ) {
@@ -23709,7 +23709,7 @@ const mn = new $(), qn = () => mn, r = (n) => {
23709
23709
  if (l.length === 1 && l.priority <= j.Normal) {
23710
23710
  const t = z[o];
23711
23711
  let b = "";
23712
- b = S(t, z[o - 1], z[o + 1]), i[o] = {
23712
+ b = C(t, z[o - 1], z[o + 1]), i[o] = {
23713
23713
  origin: t,
23714
23714
  result: b,
23715
23715
  isZh: b !== t,
@@ -23732,7 +23732,7 @@ const mn = new $(), qn = () => mn, r = (n) => {
23732
23732
  } else {
23733
23733
  const y = z[o];
23734
23734
  let c = "";
23735
- c = S(y, z[o - 1], z[o + 1]), i[o] = {
23735
+ c = C(y, z[o - 1], z[o + 1]), i[o] = {
23736
23736
  origin: y,
23737
23737
  result: c,
23738
23738
  isZh: c !== y,
@@ -23740,19 +23740,19 @@ const mn = new $(), qn = () => mn, r = (n) => {
23740
23740
  }, o++;
23741
23741
  }
23742
23742
  }
23743
- return i;
23744
- }, q = (n) => n.replace(/(ā|á|ǎ|à)/g, "a").replace(/(ō|ó|ǒ|ò)/g, "o").replace(/(ē|é|ě|è)/g, "e").replace(/(ī|í|ǐ|ì)/g, "i").replace(/(ū|ú|ǔ|ù)/g, "u").replace(/(ǖ|ǘ|ǚ|ǜ)/g, "ü").replace(/(n̄|ń|ň|ǹ)/g, "n").replace(/(m̄|ḿ|m̌|m̀)/g, "m").replace(/(ê̄|ế|ê̌|ề)/g, "ê"), U = (n, i = "off") => {
23745
- const g = qn();
23743
+ return { list: i, matches: u };
23744
+ }, f = (n) => n.replace(/(ā|á|ǎ|à)/g, "a").replace(/(ō|ó|ǒ|ò)/g, "o").replace(/(ē|é|ě|è)/g, "e").replace(/(ī|í|ǐ|ì)/g, "i").replace(/(ū|ú|ǔ|ù)/g, "u").replace(/(ǖ|ǘ|ǚ|ǜ)/g, "ü").replace(/(n̄|ń|ň|ǹ)/g, "n").replace(/(m̄|ḿ|m̌|m̀)/g, "m").replace(/(ê̄|ế|ê̌|ề)/g, "ê"), W = (n, i = "off") => {
23745
+ const g = pn();
23746
23746
  let h = x.get(n) ? x.get(n).split(" ") : [];
23747
23747
  if (g.get(n))
23748
23748
  h = g.get(n).split(" ");
23749
23749
  else if (i !== "off") {
23750
- const u = p[n];
23750
+ const u = a[n];
23751
23751
  u && (h = [u].concat(h.filter((s) => s !== u)));
23752
23752
  }
23753
23753
  return h;
23754
- }, pn = (n, i = "off") => {
23755
- let g = U(n, i);
23754
+ }, kn = (n, i = "off") => {
23755
+ let g = W(n, i);
23756
23756
  return g.length > 0 ? g.map((h) => ({
23757
23757
  origin: n,
23758
23758
  result: h,
@@ -23766,13 +23766,13 @@ const mn = new $(), qn = () => mn, r = (n) => {
23766
23766
  originPinyin: n
23767
23767
  }
23768
23768
  ];
23769
- }, m = (n) => {
23769
+ }, q = (n) => {
23770
23770
  const i = n.split(" "), g = [], h = [];
23771
23771
  for (let u of i)
23772
- for (let s of Q)
23772
+ for (let s of G)
23773
23773
  if (u.startsWith(s)) {
23774
23774
  let z = u.slice(s.length);
23775
- V.indexOf(s) !== -1 && G.indexOf(z) !== -1 && (z = J[z]), g.push(s), h.push(z);
23775
+ J.indexOf(s) !== -1 && K.indexOf(z) !== -1 && (z = X[z]), g.push(s), h.push(z);
23776
23776
  break;
23777
23777
  }
23778
23778
  return {
@@ -23780,98 +23780,102 @@ const mn = new $(), qn = () => mn, r = (n) => {
23780
23780
  initial: g.join(" ")
23781
23781
  // 声母
23782
23782
  };
23783
- }, e = (n) => {
23784
- const { final: i } = m(n);
23783
+ }, r = (n) => {
23784
+ const { final: i } = q(n);
23785
23785
  let g = "", h = "", u = "";
23786
- return K.indexOf(q(i)) !== -1 ? (g = i[0], h = i[1], u = i.slice(2)) : (h = i[0] || "", u = i.slice(1) || ""), { head: g, body: h, tail: u };
23787
- }, f = (n) => {
23786
+ return Y.indexOf(f(i)) !== -1 ? (g = i[0], h = i[1], u = i.slice(2)) : (h = i[0] || "", u = i.slice(1) || ""), { head: g, body: h, tail: u };
23787
+ }, m = (n) => {
23788
23788
  const i = /(ā|ō|ē|ī|ū|ǖ|n̄|m̄|ê̄)/, g = /(á|ó|é|í|ú|ǘ|ń|ḿ|ế)/, h = /(ǎ|ǒ|ě|ǐ|ǔ|ǚ|ň|m̌|ê̌)/, u = /(à|ò|è|ì|ù|ǜ|ǹ|m̀|ề)/, s = /(a|o|e|i|u|ü|ê)/, z = /(n|m)$/, o = [];
23789
23789
  return n.split(" ").forEach((y) => {
23790
23790
  i.test(y) ? o.push("1") : g.test(y) ? o.push("2") : h.test(y) ? o.push("3") : u.test(y) ? o.push("4") : s.test(y) || z.test(y) ? o.push("0") : o.push("");
23791
23791
  }), o.join(" ");
23792
- }, an = (n, i) => {
23793
- const g = q(n).split(" "), h = f(i).split(" "), u = [];
23792
+ }, Pn = (n, i) => {
23793
+ const g = f(n).split(" "), h = m(i).split(" "), u = [];
23794
23794
  return g.forEach((s, z) => {
23795
23795
  u.push(`${s}${h[z]}`);
23796
23796
  }), u.join(" ");
23797
- }, W = (n) => {
23797
+ }, B = (n) => {
23798
23798
  const i = [];
23799
23799
  return n.split(" ").forEach((h) => {
23800
23800
  i.push(h[0]);
23801
23801
  }), i.join(" ");
23802
- }, kn = (n) => typeof n == "string", Pn = (n, i) => {
23802
+ }, Sn = (n) => typeof n == "string";
23803
+ function p(n, i) {
23804
+ return i instanceof RegExp ? i.test(n) : !0;
23805
+ }
23806
+ const Dn = (n, i) => {
23803
23807
  let g = i.nonZh;
23804
23808
  if (g === "removed")
23805
- return n.filter((h) => h.isZh);
23809
+ return n.filter((h) => h.isZh || !p(h.origin, i.nonZhScope));
23806
23810
  if (g === "consecutive") {
23807
23811
  for (let h = n.length - 2; h >= 0; h--) {
23808
23812
  const u = n[h], s = n[h + 1];
23809
- !u.isZh && !s.isZh && (u.origin += s.origin, u.result += s.result, s.delete = !0);
23813
+ !u.isZh && !s.isZh && p(u.origin, i.nonZhScope) && p(s.origin, i.nonZhScope) && (u.origin += s.origin, u.result += s.result, s.delete = !0);
23810
23814
  }
23811
23815
  return n.filter((h) => !h.delete);
23812
23816
  } else
23813
23817
  return n;
23814
- }, E = (n, i) => d(n) === 1 && i.multiple ? pn(n, i.surname) : !1, Dn = (n, i) => {
23818
+ }, L = (n, i) => d(n) === 1 && i.multiple ? kn(n, i.surname) : !1, Tn = (n, i) => {
23815
23819
  switch (i.pattern) {
23816
23820
  case "pinyin":
23817
23821
  break;
23818
23822
  case "num":
23819
23823
  n.forEach((g) => {
23820
- g.result = g.isZh ? f(g.result) : "";
23824
+ g.result = g.isZh ? m(g.result) : "";
23821
23825
  });
23822
23826
  break;
23823
23827
  case "initial":
23824
23828
  n.forEach((g) => {
23825
- g.result = g.isZh ? m(g.result).initial : "";
23829
+ g.result = g.isZh ? q(g.result).initial : "";
23826
23830
  });
23827
23831
  break;
23828
23832
  case "final":
23829
23833
  n.forEach((g) => {
23830
- g.result = g.isZh ? m(g.result).final : "";
23834
+ g.result = g.isZh ? q(g.result).final : "";
23831
23835
  });
23832
23836
  break;
23833
23837
  case "first":
23834
23838
  n.forEach((g) => {
23835
- g.result = W(g.result);
23839
+ g.result = B(g.result);
23836
23840
  });
23837
23841
  break;
23838
23842
  case "finalHead":
23839
23843
  n.forEach((g) => {
23840
- g.result = g.isZh ? e(g.result).head : "";
23844
+ g.result = g.isZh ? r(g.result).head : "";
23841
23845
  });
23842
23846
  break;
23843
23847
  case "finalBody":
23844
23848
  n.forEach((g) => {
23845
- g.result = g.isZh ? e(g.result).body : "";
23849
+ g.result = g.isZh ? r(g.result).body : "";
23846
23850
  });
23847
23851
  break;
23848
23852
  case "finalTail":
23849
23853
  n.forEach((g) => {
23850
- g.result = g.isZh ? e(g.result).tail : "";
23854
+ g.result = g.isZh ? r(g.result).tail : "";
23851
23855
  });
23852
23856
  break;
23853
23857
  }
23854
- }, Tn = (n, i) => {
23858
+ }, Zn = (n, i) => {
23855
23859
  switch (i.toneType) {
23856
23860
  case "symbol":
23857
23861
  break;
23858
23862
  case "none":
23859
23863
  n.forEach((g) => {
23860
- g.isZh && (g.result = q(g.result));
23864
+ g.isZh && (g.result = f(g.result));
23861
23865
  });
23862
23866
  break;
23863
23867
  case "num": {
23864
23868
  n.forEach((g) => {
23865
- g.isZh && (g.result = an(g.result, g.originPinyin));
23869
+ g.isZh && (g.result = Pn(g.result, g.originPinyin));
23866
23870
  });
23867
23871
  break;
23868
23872
  }
23869
23873
  }
23870
- }, Sn = (n, i) => {
23874
+ }, Cn = (n, i) => {
23871
23875
  i.v && n.forEach((g) => {
23872
23876
  g.isZh && (g.result = g.result.replace(/ü/g, "v"));
23873
23877
  });
23874
- }, Cn = (n, i, g) => {
23878
+ }, Mn = (n, i, g) => {
23875
23879
  if (i.multiple && d(g) === 1) {
23876
23880
  let h = "";
23877
23881
  n = n.filter((u) => {
@@ -23880,26 +23884,27 @@ const mn = new $(), qn = () => mn, r = (n) => {
23880
23884
  });
23881
23885
  }
23882
23886
  return i.type === "array" ? n.map((h) => h.result) : i.type === "all" ? n.map((h) => {
23883
- const u = h.isZh ? h.result : "", { initial: s, final: z } = m(u), { head: o, body: l, tail: y } = e(u);
23887
+ const u = h.isZh ? h.result : "", { initial: s, final: z } = q(u), { head: o, body: l, tail: y } = r(u);
23884
23888
  let c = [];
23885
- return u !== "" && (c = [u].concat(U(h.origin, i.surname).filter((t) => t !== u))), {
23889
+ return u !== "" && (c = [u].concat(W(h.origin, i.surname).filter((t) => t !== u))), {
23886
23890
  origin: h.origin,
23887
23891
  pinyin: u,
23888
23892
  initial: s,
23889
23893
  final: z,
23890
- first: h.isZh ? W(h.result) : "",
23894
+ first: h.isZh ? B(h.result) : "",
23891
23895
  finalHead: o,
23892
23896
  finalBody: l,
23893
23897
  finalTail: y,
23894
- num: Number(f(h.originPinyin)),
23898
+ num: Number(m(h.originPinyin)),
23895
23899
  isZh: h.isZh,
23896
23900
  polyphonic: c,
23897
- inZhRange: !!x.get(h.origin)
23901
+ inZhRange: !!x.get(h.origin),
23902
+ result: h.result
23898
23903
  };
23899
23904
  }) : n.map((h) => h.result).join(i.separator);
23900
- }, Mn = (n, i) => (i === !1 && n.forEach((g) => {
23905
+ }, In = (n, i) => (i === !1 && n.forEach((g) => {
23901
23906
  g.origin === "一" ? g.result = g.originPinyin = "yī" : g.origin === "不" && (g.result = g.originPinyin = "bù");
23902
- }), n), Zn = {
23907
+ }), n), Nn = {
23903
23908
  pattern: "pinyin",
23904
23909
  toneType: "symbol",
23905
23910
  type: "string",
@@ -23912,16 +23917,21 @@ const mn = new $(), qn = () => mn, r = (n) => {
23912
23917
  toneSandhi: !0,
23913
23918
  segmentit: 2
23914
23919
  };
23915
- function In(n, i) {
23916
- if (i = Object.assign(Object.assign({}, Zn), i || {}), !kn(n))
23920
+ function vn(n, i) {
23921
+ if (i = Object.assign(Object.assign({}, Nn), i || {}), !Sn(n))
23917
23922
  return n;
23918
23923
  if (n === "")
23919
23924
  return i.type === "array" || i.type === "all" ? [] : "";
23920
23925
  i.surname === void 0 && (i.mode === "surname" ? i.surname = "all" : i.surname = "off"), i.type === "all" && (i.pattern = "pinyin"), i.pattern === "num" && (i.toneType = "none"), i.removeNonZh && (i.nonZh = "removed");
23921
- let h = Array(d(n));
23922
- return h = fn(n, h, i.surname, i.segmentit), h = Mn(h, i.toneSandhi), h = Pn(h, i), E(n, i) && (h = E(n, i)), Dn(h, i), Tn(h, i), Sn(h, i), Cn(h, i, n);
23926
+ let h = Array(d(n)), { list: u } = an(n, h, i.surname, i.segmentit);
23927
+ return u = In(u, i.toneSandhi), u = Dn(u, i), L(n, i) && (u = L(n, i)), Tn(u, i), Zn(u, i), Cn(u, i), Mn(u, i, n);
23923
23928
  }
23924
- const Nn = (n) => In(n, { pattern: "first", toneType: "none", type: "string", separator: "", nonZh: "removed" });
23929
+ var k;
23930
+ (function(n) {
23931
+ n[n.AllSegment = 1] = "AllSegment", n[n.AllArray = 2] = "AllArray", n[n.AllString = 3] = "AllString", n[n.PinyinSegment = 4] = "PinyinSegment", n[n.PinyinArray = 5] = "PinyinArray", n[n.PinyinString = 6] = "PinyinString", n[n.ZhSegment = 7] = "ZhSegment", n[n.ZhArray = 8] = "ZhArray", n[n.ZhString = 9] = "ZhString";
23932
+ })(k || (k = {}));
23933
+ k.AllSegment;
23934
+ const _n = (n) => vn(n, { pattern: "first", toneType: "none", type: "string", separator: "", nonZh: "removed" });
23925
23935
  export {
23926
- Nn as getPinyinFirstCharacter
23936
+ _n as getPinyinFirstCharacter
23927
23937
  };
Binary file