@sheetxl/studio-vanilla 0.4.19 → 0.4.21

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 (178) hide show
  1. package/browser/cjs/index.cjs +80 -2
  2. package/browser/cjs/{BJIfDlGWvnC0eGUi.cjs → n6CXzSocLW_BCO8w.cjs} +6 -6
  3. package/browser/esm/{DiGLoJDZqriVp152.mjs → NBuS53B7u8hItiXf.mjs} +933 -937
  4. package/browser/esm/index.mjs +176 -4
  5. package/cdn/assets/CY8njwo06MWkoPz2.js +21 -0
  6. package/cdn/index.js +2 -2
  7. package/cdn/loader.js +1 -1
  8. package/package.json +3 -3
  9. package/browser/cjs/1FbLU-GkjsXMtg8T.cjs +0 -15
  10. package/browser/cjs/3xnum9EEG0qokR90.cjs +0 -12
  11. package/browser/cjs/5i4FVjROedZEnZNH.cjs +0 -6
  12. package/browser/cjs/9yZt9CqVSMBE7LUX.cjs +0 -6
  13. package/browser/cjs/B7V2ifI29G13Ypfn.cjs +0 -378
  14. package/browser/cjs/BCBl10fgrkZ5JX8E.cjs +0 -161
  15. package/browser/cjs/BCVApYTYfHlRzbCn.cjs +0 -6
  16. package/browser/cjs/BjW-ykzXN9S3TMzb.cjs +0 -11
  17. package/browser/cjs/Bn5tlfH0oqJI1Lk9.cjs +0 -6
  18. package/browser/cjs/BnD8IArw964iF-Zg.cjs +0 -1501
  19. package/browser/cjs/BnwSPi6FOdqxr7z1.cjs +0 -19
  20. package/browser/cjs/BxpKhdqadWDARG9W.cjs +0 -16
  21. package/browser/cjs/C8FEOglWYUtglsLP.cjs +0 -6
  22. package/browser/cjs/CDd6P2SfTKp4v-QA.cjs +0 -6
  23. package/browser/cjs/CFfq2Z-VQyMwMJKP.cjs +0 -6
  24. package/browser/cjs/CG1FkANzsujO3FLU.cjs +0 -6
  25. package/browser/cjs/CGD07mOjjl6zfCzK.cjs +0 -15
  26. package/browser/cjs/CMO36tnnJHrXso4Q.cjs +0 -7
  27. package/browser/cjs/CMfyyxtrIHPMnrBl.cjs +0 -6
  28. package/browser/cjs/CNue1AsHpswiVYJx.cjs +0 -6
  29. package/browser/cjs/C_bqbac1bCl1H0Bn.cjs +0 -6
  30. package/browser/cjs/C_jIzbaCWis1jB7f.cjs +0 -32
  31. package/browser/cjs/CaFeiasVg3jafLwL.cjs +0 -6
  32. package/browser/cjs/CaWJjQ_KmjWp1ooU.cjs +0 -145
  33. package/browser/cjs/CahVr7pzDRu3h4G3.cjs +0 -6
  34. package/browser/cjs/CaswMUSE1R9Noewr.cjs +0 -6
  35. package/browser/cjs/CfX6-fSMFgAg6iL9.cjs +0 -124
  36. package/browser/cjs/CkhCXLhqA4a2CnSJ.cjs +0 -6
  37. package/browser/cjs/CkriFKrE5BBPFQWm.cjs +0 -6
  38. package/browser/cjs/CuX_ftSJWqfRsXHy.cjs +0 -6
  39. package/browser/cjs/CznEff7u33FYbOSn.cjs +0 -6
  40. package/browser/cjs/D-fNsTpgGyZHdYEp.cjs +0 -6
  41. package/browser/cjs/DCxlQuW8eB70ZbcJ.cjs +0 -6
  42. package/browser/cjs/DFet-I-_FYR9s_ET.cjs +0 -6
  43. package/browser/cjs/DKQmNMiW6vEz1i7V.cjs +0 -6
  44. package/browser/cjs/DMOCfhgdy7Z8GoD-.cjs +0 -13
  45. package/browser/cjs/DVVk6WU7lfgpQLZG.cjs +0 -6
  46. package/browser/cjs/DYMFAMQ13cX03167.cjs +0 -7
  47. package/browser/cjs/DZVJ234kMQwb5dEy.cjs +0 -6
  48. package/browser/cjs/DZqqUVtfn36E0rIk.cjs +0 -6
  49. package/browser/cjs/DguzXHidCk2s1uCY.cjs +0 -6
  50. package/browser/cjs/Dhik7yBvR-5iyJcR.cjs +0 -6
  51. package/browser/cjs/Dms2LCMINwYEtl3S.cjs +0 -6
  52. package/browser/cjs/DnHgK81nepMuvMim.cjs +0 -6
  53. package/browser/cjs/DuJlHux5dLU53d80.cjs +0 -6
  54. package/browser/cjs/Dz5uLsJ16GF2Cyov.cjs +0 -6
  55. package/browser/cjs/Io_6AEq6KpjrZEfL.cjs +0 -6
  56. package/browser/cjs/R7ToEkyr-cbP0Q3N.cjs +0 -6
  57. package/browser/cjs/TGD3vlMtB_qnQE-M.cjs +0 -11
  58. package/browser/cjs/XFsZZevZgfk9vB1r.cjs +0 -6
  59. package/browser/cjs/bGVtUGltyeHuGKLB.cjs +0 -6
  60. package/browser/cjs/f-w9NYC1mTi7W9HY.cjs +0 -6
  61. package/browser/cjs/kGBvcCWaH3h23Ojp.cjs +0 -7
  62. package/browser/cjs/mUwYCSHSRCUQJ4uV.cjs +0 -42
  63. package/browser/cjs/qLyXB7fJpKBbTC_N.cjs +0 -6
  64. package/browser/cjs/s2JuJCqW6ny4lxQX.cjs +0 -6
  65. package/browser/esm/2Fopggi4LREIIXpY.mjs +0 -13208
  66. package/browser/esm/4ZXEcNsjnqWXAiUa.mjs +0 -2344
  67. package/browser/esm/4yxl564v_Wx022xz.mjs +0 -633
  68. package/browser/esm/5Ovf_TtcBCG7hgdY.mjs +0 -20
  69. package/browser/esm/6X4p3ajMgDNtcmLW.mjs +0 -10
  70. package/browser/esm/8F0vFRAXlzH-vmJl.mjs +0 -52354
  71. package/browser/esm/B1L8rEDpskxCqnhJ.mjs +0 -10
  72. package/browser/esm/BENg2ibY7Hr-SYp3.mjs +0 -10
  73. package/browser/esm/BHzg_9TpgdKnIlaX.mjs +0 -10
  74. package/browser/esm/BY9rDUy2rHkqh6hH.mjs +0 -820
  75. package/browser/esm/Bd2yJknZG5WTZ26u.mjs +0 -10
  76. package/browser/esm/BlH_AWoPr-w3-qdS.mjs +0 -10
  77. package/browser/esm/BmeozQuzbqa81PvH.mjs +0 -41
  78. package/browser/esm/BprECrKMFGb2UK2v.mjs +0 -2174
  79. package/browser/esm/Br_6r7a5IjKksr00.mjs +0 -390
  80. package/browser/esm/ByJuiohpCMXnDKmL.mjs +0 -47
  81. package/browser/esm/C04_X_6DkiZCUmwB.mjs +0 -1702
  82. package/browser/esm/C3pNOQaLBsTUp2CW.mjs +0 -10
  83. package/browser/esm/C4gnsPTE7_xP3Mz_.mjs +0 -1575
  84. package/browser/esm/C8kq7JNW8ivhRL1S.mjs +0 -3934
  85. package/browser/esm/CGquHZGGYOxATF73.mjs +0 -10
  86. package/browser/esm/CKwR5AWlnckKQRc-.mjs +0 -10
  87. package/browser/esm/CLSpsTCV3Onb_QXV.mjs +0 -84
  88. package/browser/esm/CMrXKGbxBR_LxLxN.mjs +0 -3755
  89. package/browser/esm/CN-UcSPqkcXnkJCx.mjs +0 -1365
  90. package/browser/esm/CQJsDOnipkhuGkKg.mjs +0 -56
  91. package/browser/esm/CTIgStBt9DOpau5q.mjs +0 -1665
  92. package/browser/esm/CXL9mY2kUT053cTN.mjs +0 -1346
  93. package/browser/esm/CZ54d8Ueai6uZgy6.mjs +0 -10
  94. package/browser/esm/CZM2uNUNI4W8qUw3.mjs +0 -10
  95. package/browser/esm/CaaAGrJF7OxdprqB.mjs +0 -10
  96. package/browser/esm/CnRJWnfDHzunp3N5.mjs +0 -472
  97. package/browser/esm/CpGYH9QSPqM4ejyF.mjs +0 -421
  98. package/browser/esm/CqLIq6VVhQnv6ZP4.mjs +0 -10
  99. package/browser/esm/CqTn7MLxDJZX7aIA.mjs +0 -10
  100. package/browser/esm/D3RHh0FQuMAKk4JL.mjs +0 -10
  101. package/browser/esm/D8hxrXJDfvDRoouY.mjs +0 -147
  102. package/browser/esm/DMwYqCQzDDwbzt8K.mjs +0 -44
  103. package/browser/esm/DNV2yXFlJ5hRF5ME.mjs +0 -46
  104. package/browser/esm/DUxcExPcvgbBrSXX.mjs +0 -5582
  105. package/browser/esm/DbTEH7CjzsjIc-ew.mjs +0 -21
  106. package/browser/esm/Df2lY3OJ73BCDQo6.mjs +0 -24
  107. package/browser/esm/DlUeNEy_cp31Am5t.mjs +0 -39
  108. package/browser/esm/DovESggwbqQKJEkM.mjs +0 -10
  109. package/browser/esm/DpNpusKUeZXcDNra.mjs +0 -29
  110. package/browser/esm/Dx-FJghQY8rpWJi1.mjs +0 -10
  111. package/browser/esm/DxObRtwZ98tP8NM3.mjs +0 -10
  112. package/browser/esm/FT-XJjpzjdyq4pin.mjs +0 -48
  113. package/browser/esm/HnfOytlj72v4rd6y.mjs +0 -425
  114. package/browser/esm/IChTkXO9eDekfSb7.mjs +0 -10
  115. package/browser/esm/KcDpdRfEgTnFwlSh.mjs +0 -21
  116. package/browser/esm/TVfGpAQkvkA9mx4E.mjs +0 -10
  117. package/browser/esm/pqikV5IyVMBYUDqP.mjs +0 -10
  118. package/browser/esm/qfHSXgWX4yZd3nwZ.mjs +0 -1466
  119. package/browser/esm/xWvOAH67Iwyf2Zge.mjs +0 -10
  120. package/browser/esm/xaJvLe6JwO1rQiE-.mjs +0 -12
  121. package/cdn/assets/15AvUM5aNUAfFLU7.js +0 -58
  122. package/cdn/assets/2Fopggi4LREIIXpY.js +0 -13208
  123. package/cdn/assets/4yxl564v_Wx022xz.js +0 -633
  124. package/cdn/assets/6X4p3ajMgDNtcmLW.js +0 -10
  125. package/cdn/assets/B1L8rEDpskxCqnhJ.js +0 -10
  126. package/cdn/assets/B1y38xd4JTLIrdUW.js +0 -1702
  127. package/cdn/assets/BENg2ibY7Hr-SYp3.js +0 -10
  128. package/cdn/assets/BHzg_9TpgdKnIlaX.js +0 -10
  129. package/cdn/assets/BXRf5zCAUE8kGNat.js +0 -46
  130. package/cdn/assets/BZdjtacH2DTSHsdG.js +0 -22
  131. package/cdn/assets/Bd2yJknZG5WTZ26u.js +0 -10
  132. package/cdn/assets/BlH_AWoPr-w3-qdS.js +0 -10
  133. package/cdn/assets/C3pNOQaLBsTUp2CW.js +0 -10
  134. package/cdn/assets/C6yX85fw0aO70N0-.js +0 -2346
  135. package/cdn/assets/CGquHZGGYOxATF73.js +0 -10
  136. package/cdn/assets/CKwR5AWlnckKQRc-.js +0 -10
  137. package/cdn/assets/CN-UcSPqkcXnkJCx.js +0 -1365
  138. package/cdn/assets/CSBAnGx7ebIRyjML.js +0 -21
  139. package/cdn/assets/CTIgStBt9DOpau5q.js +0 -1665
  140. package/cdn/assets/CXL9mY2kUT053cTN.js +0 -1346
  141. package/cdn/assets/CZ54d8Ueai6uZgy6.js +0 -10
  142. package/cdn/assets/CZM2uNUNI4W8qUw3.js +0 -10
  143. package/cdn/assets/CaaAGrJF7OxdprqB.js +0 -10
  144. package/cdn/assets/Cfgui52VcoZakyBi.js +0 -50
  145. package/cdn/assets/Ck6R7vI9j0vG-mKU.js +0 -390
  146. package/cdn/assets/ClTJpu1UdRW0KLAX.js +0 -23
  147. package/cdn/assets/Co1yPh9LPeUa-tCm.js +0 -29
  148. package/cdn/assets/CpGYH9QSPqM4ejyF.js +0 -421
  149. package/cdn/assets/CppP22dM3wzxzf_R.js +0 -3934
  150. package/cdn/assets/CqLIq6VVhQnv6ZP4.js +0 -10
  151. package/cdn/assets/CqTn7MLxDJZX7aIA.js +0 -10
  152. package/cdn/assets/D3RHh0FQuMAKk4JL.js +0 -10
  153. package/cdn/assets/DCmJyecz9jzS5Hh5.js +0 -41
  154. package/cdn/assets/DEHd1h8uAHbt7JQl.js +0 -425
  155. package/cdn/assets/DK25k4g9SWrBiPDl.js +0 -43
  156. package/cdn/assets/DL18SWHzmNBC5_Sq.js +0 -472
  157. package/cdn/assets/DZz8nVXsYYFIaomy.js +0 -3756
  158. package/cdn/assets/Df2lY3OJ73BCDQo6.js +0 -24
  159. package/cdn/assets/DidmQocPR2LUv5_-.js +0 -84
  160. package/cdn/assets/DifkJcFEihfAmrz6.js +0 -5582
  161. package/cdn/assets/Dj-9L-ifpIi1HChy.js +0 -52185
  162. package/cdn/assets/DovESggwbqQKJEkM.js +0 -10
  163. package/cdn/assets/Dwy3QqzGL-q3IHdC.js +0 -49
  164. package/cdn/assets/Dx-FJghQY8rpWJi1.js +0 -10
  165. package/cdn/assets/DxObRtwZ98tP8NM3.js +0 -10
  166. package/cdn/assets/IChTkXO9eDekfSb7.js +0 -10
  167. package/cdn/assets/KcDpdRfEgTnFwlSh.js +0 -21
  168. package/cdn/assets/R-6SrokApX5Vs5h6.js +0 -12
  169. package/cdn/assets/TVfGpAQkvkA9mx4E.js +0 -10
  170. package/cdn/assets/ZfVobc-p41aYisnX.js +0 -46
  171. package/cdn/assets/_QS_SgWjAGVcBh2y.js +0 -2177
  172. package/cdn/assets/_bKdjn1gFyUlsKF8.js +0 -149
  173. package/cdn/assets/cgKx_r-dAv2kc57N.js +0 -1575
  174. package/cdn/assets/lxv3lfQ08L2wD1S3.js +0 -820
  175. package/cdn/assets/pqikV5IyVMBYUDqP.js +0 -10
  176. package/cdn/assets/wXUNHjkvpeSH2dQZ.js +0 -1466
  177. package/cdn/assets/xWvOAH67Iwyf2Zge.js +0 -10
  178. package/cdn/assets/xaJvLe6JwO1rQiE-.js +0 -12
@@ -1,1702 +0,0 @@
1
- import { ai as k, Y as T, Q as G, h as Z, o as W, aj as C, ak as tt, al as P, n as et, s as Y, am as V } from "./8F0vFRAXlzH-vmJl.mjs";
2
- import { c as x, b as f, r as L, t as rt, a as A, p as D, d as st } from "./qfHSXgWX4yZd3nwZ.mjs";
3
- /**
4
- * @license @sheetxl/studio-vanilla - SheetXL Studio - Vanilla entry point for integrating SheetXL UI. - v0.4.19
5
- *
6
- * (C) 2025-present SheetXL Inc. & Michael T. Ford
7
- * License: The license can be found at https://www.sheetxl.com/license.
8
- */
9
- class ot {
10
- constructor(t) {
11
- this.list = t;
12
- }
13
- get length() {
14
- return this.list.length;
15
- }
16
- item(t) {
17
- return this.list[t];
18
- }
19
- forEach(t, e) {
20
- for (let s = 0; s < this.list.length; s++) t(this.list[s], s, this);
21
- }
22
- }
23
- const it = (u) => u === !0 || u === "1" || u === "on" || u === "true" || u !== !1 && u !== "0" && u !== "off" && u !== "false" && null, nt = (u) => {
24
- const t = parseInt(u);
25
- return isNaN(t) ? null : t;
26
- }, lt = (u) => {
27
- const t = parseFloat(u);
28
- return isNaN(t) ? null : t;
29
- }, at = /* @__PURE__ */ new Map();
30
- class _ {
31
- constructor(t, e, s, r, o, i = null, n) {
32
- const l = (c, h, p) => n?.getRef?.(c, h, p, n?.parsedRefs), a = (c) => n?.getRefs?.(c, n?.parsedRefs);
33
- this._parent = t, this.sharedShared = e, this.currentPath = s, this.elemRoot = r, this.jsonRoot = o, t ? (this._fileLocation = t._fileLocation, this._getRef = t._getRef, this._getRefs = t._getRefs) : (i && (this._fileLocation = i), l && a && (this._getRef = l), a && (this._getRefs = a), this._onWarning = n?.onWarning, this._addPerson = n?.addPerson);
34
- }
35
- getRef(t, e = !1) {
36
- return this._getRef?.(t, this._fileLocation, e) ?? null;
37
- }
38
- getRelationships() {
39
- return this._getRefs(this._fileLocation) ?? at;
40
- }
41
- getPath() {
42
- return this.currentPath;
43
- }
44
- getElemRoot() {
45
- return this.elemRoot;
46
- }
47
- getJsonRoot() {
48
- return this.jsonRoot;
49
- }
50
- warn(t) {
51
- this._onWarning ? this._onWarning(t) : this._parent ? this._parent?.warn?.(t) : console.warn(t);
52
- }
53
- addPerson(t) {
54
- return this._addPerson ? this._addPerson(t) : this._parent ? this._parent?._addPerson?.(t) : null;
55
- }
56
- getVisitorParamsState() {
57
- return this.sharedShared.getVisitorParamsState();
58
- }
59
- evaluate(t, e) {
60
- if (!t) return e;
61
- let s = [e];
62
- const r = t.split("/");
63
- for (let o = 0; o < r.length; o++) {
64
- const i = r[o];
65
- if (i === "" || i === ".") continue;
66
- let n = [];
67
- for (let l = 0; l < s.length; l++) {
68
- const a = s[l], c = a.childNodes;
69
- for (let h = 0; c && h < c.length; h++) {
70
- const p = a.childNodes[h];
71
- p.localName !== i && i !== "*" || n.push(p);
72
- }
73
- }
74
- s = n;
75
- }
76
- return s.length === 1 ? s[0] : s.length === 0 ? null : new ot(s);
77
- }
78
- getFromPath(t, e) {
79
- return Y.getFromPath(t, e);
80
- }
81
- setToPath(t, e, s) {
82
- return Y.setToPath(t, e, s);
83
- }
84
- getValAttrAsString(t, e) {
85
- let s = this.evaluate(t, e);
86
- return s && s.hasAttribute("val") ? s.getAttribute("val") ?? null : null;
87
- }
88
- getValAttrAsBoolean(t, e, s = !1) {
89
- let r = this.evaluate(t, e);
90
- if (!r) return null;
91
- const o = r.hasAttribute("val") ? r.getAttribute("val") : void 0;
92
- return o == null ? s : o === "1" || o === "on" || o === "true" || o !== "0" && o !== "off" && o !== "false" && s;
93
- }
94
- getValAttrAsInteger(t, e) {
95
- let s = this.evaluate(t, e);
96
- return s && s.hasAttribute("val") ? parseInt(s.getAttribute("val")) ?? null : null;
97
- }
98
- getValAttrAsFloat(t, e) {
99
- let s = this.evaluate(t, e);
100
- return s && s.hasAttribute("val") ? parseFloat(s.getAttribute("val")) ?? null : null;
101
- }
102
- get BOOLEAN_COPY() {
103
- return it;
104
- }
105
- get INT_COPY() {
106
- return nt;
107
- }
108
- get FLOAT_COPY() {
109
- return lt;
110
- }
111
- copyFromAttribute(t, e, s, r = e, o = null) {
112
- if (!t || !s || !t.hasAttribute(e)) return;
113
- let i = t.getAttribute(e);
114
- if (o) {
115
- if (Array.isArray(o)) {
116
- for (let n = 0; n < o.length; n++) if (i == null || (i = o[n](i), i == null)) return;
117
- } else if (i == null || (i = o(i), i == null)) return;
118
- }
119
- this.setToPath(s, r, i);
120
- }
121
- }
122
- class j {
123
- constructor(t) {
124
- this.jsonKey = t;
125
- }
126
- visit(t, e, s) {
127
- const r = {};
128
- return s[this.jsonKey] = r, r;
129
- }
130
- }
131
- class ct {
132
- visit(t, e, s) {
133
- if (!e) return;
134
- const r = e.childNodes;
135
- for (let o = 0; o < r.length; o++) {
136
- const i = r.item(o);
137
- i.nodeType === 1 && i.localName === "Relationship" && this.processRelationship(t, i, s);
138
- }
139
- return s;
140
- }
141
- processRelationship(t, e, s) {
142
- const r = {};
143
- t.copyFromAttribute(e, "Target", r, "target"), t.copyFromAttribute(e, "Type", r, "type"), t.copyFromAttribute(e, "TargetMode", r, "targetMode"), s[e.getAttribute("Id")] = r;
144
- }
145
- }
146
- const H = (u, t) => {
147
- if (u || !u.hasAttribute("rot")) return;
148
- const e = u.getAttribute("rot"), s = Y.roundAccurately(D(e), 2);
149
- s !== -1e3 && (t.rotation = s);
150
- }, b = (u, t, e, s, r) => {
151
- const o = u.getValAttrAsString(s, t);
152
- o !== null && (e[r] = o);
153
- }, m = (u, t, e, s, r = s, o = null) => {
154
- const i = u.getValAttrAsBoolean(s, t, o);
155
- i !== null && (e[r] = i);
156
- }, w = (u, t, e, s, r) => {
157
- const o = u.getValAttrAsInteger(s, t);
158
- o !== null && (e[r] = o);
159
- }, y = (u, t, e, s, r, o = 1) => {
160
- const i = u.getValAttrAsFloat(s, t);
161
- i !== null && (e[r] = i * o);
162
- };
163
- class ut {
164
- visit(t, e, s) {
165
- return m(t, e, s, "roundedCorners", "roundedCorners"), w(t, e, s, ".//AlternateContent/Fallback/style", "styleId"), s.range = null, s;
166
- }
167
- afterVisit(t, e, s) {
168
- let r = {};
169
- s.types = r;
170
- let o = {}, i = 0, n = {}, l = 0, a = t.getVisitorParamsState().get("axes");
171
- const c = t.getVisitorParamsState().get("types");
172
- for (let g = 0; g < c.length; g++) {
173
- const d = c[g];
174
- if (d.xAxisId) {
175
- const v = d.xAxisId, O = a.get(v);
176
- o[g + ""] = O, d.offsetXAxis = g, delete d.xAxisId, s.xAxes = o, o.length = ++i;
177
- }
178
- if (d.yAxisId) {
179
- const v = d.yAxisId, O = a.get(v);
180
- n[g + ""] = O, d.offsetYAxis = g, delete d.yAxisId, s.yAxes = n, n.length = ++l;
181
- }
182
- r[g + ""] = d;
183
- }
184
- r.length = c.length;
185
- const h = t.getVisitorParamsState().get("series");
186
- if (!h || h.length === 0) return;
187
- const p = {};
188
- s.series = p;
189
- for (let g = 0; g < h.length; g++) p[g + ""] = h[g];
190
- p.length = h.length;
191
- }
192
- }
193
- class ht {
194
- visit(t, e, s) {
195
- return m(t, e, s, "plotVisOnly", "plotVisOnly"), b(t, e, s, "dispBlanksAs", "dispBlanksAs"), m(t, e, s, ".//extLst/ext/dataDisplayOptions16/dispNaAsBlank", "dispNaAsBlank"), m(t, e, s, "showDLblsOverMax", "showDLblsOverMax"), s;
196
- }
197
- afterVisit(t, e, s) {
198
- try {
199
- const r = t.getValAttrAsBoolean("autoTitleDeleted", e), o = t.evaluate("title", e);
200
- t.setToPath(s, "title.shown", !(r === !0 || !o));
201
- const i = t.evaluate("legend", e);
202
- t.setToPath(s, "legend.shown", i !== null);
203
- } catch (r) {
204
- throw new Error("Unexpected Error parsing Chart: " + r);
205
- }
206
- }
207
- }
208
- class pt {
209
- visit(t, e, s) {
210
- let r = {};
211
- return s.plotArea = r, r;
212
- }
213
- }
214
- class I {
215
- EnumMappings() {
216
- }
217
- static fromOoxmlGradientType(t) {
218
- return t === "circle" ? "radial" : t;
219
- }
220
- static fromOoxmlLineCap(t) {
221
- if (t === "rnd") return "round";
222
- if (t === "flat") return "butt";
223
- if (t === "sq") return "square";
224
- throw new Error("Invalid lineCap type: " + t);
225
- }
226
- static fromOoxmlCompound(t) {
227
- return t === "sng" ? "single" : t;
228
- }
229
- static fromOoxmlAlignment(t) {
230
- return t === "ctr" ? "center" : t;
231
- }
232
- }
233
- class J {
234
- visit(t, e, s) {
235
- }
236
- processStroke(t, e, s) {
237
- const r = {}, o = t.evaluate("ln", e);
238
- if (o) {
239
- o.hasAttribute("algn") && (r.align = I.fromOoxmlAlignment(o.getAttribute("algn"))), o.hasAttribute("cap") && (r.lineCap = I.fromOoxmlLineCap(o.getAttribute("cap"))), o.hasAttribute("cmpd") && (r.compound = I.fromOoxmlCompound(o.getAttribute("cmpd"))), o.hasAttribute("w") && (r.width = rt(o.getAttribute("w")));
240
- const i = t.evaluate("miter", o);
241
- i && (r.lineJoin = "miter", i.hasAttribute("lim") && (r.miter = parseFloat(i.getAttribute("lim")))), t.evaluate("bevel", o) && (r.lineJoin = "bevel"), t.evaluate("round", o) && (r.lineJoin = "round");
242
- const n = t.evaluate("custDash", o);
243
- if (n) {
244
- const c = t.evaluate("ds", n);
245
- if (c && c.length > 0) {
246
- let h = "";
247
- for (let p = 0; p < c.length; p++) {
248
- const g = c.item(p);
249
- h += A(g.getAttribute("d")) + "," + A(g.getAttribute("sp"));
250
- }
251
- r.dash = h;
252
- }
253
- }
254
- const l = t.evaluate("prstDash", o);
255
- l && l.hasAttribute("val") && (r.dash = l.getAttribute("val")), this.parseEndElement(t, o, r, "headEnd", "head"), this.parseEndElement(t, o, r, "tailEnd", "tail");
256
- const a = this.processFill(t, o, s);
257
- r.fill = a;
258
- }
259
- return r;
260
- }
261
- parseEndElement(t, e, s, r, o) {
262
- const i = t.evaluate(r, e);
263
- if (i && (i.hasAttribute("type") && (s[o + "Type"] = i.getAttribute("type")), i.hasAttribute("len") || i.hasAttribute("w"))) {
264
- const n = i.getAttribute("len") ? i.getAttribute("len") : "med", l = i.getAttribute("w") ? i.getAttribute("w") : "med";
265
- s[o + "Size"] = n + "-" + l;
266
- }
267
- }
268
- processFill(t, e, s) {
269
- const r = {};
270
- if (t.evaluate("noFill", e)) return r.none = !0, r;
271
- const o = t.evaluate("solidFill", e);
272
- if (o) {
273
- const a = this.processAdjColor(t, o);
274
- return a && (r.solid = a), r;
275
- }
276
- const i = t.evaluate("gradFill", e);
277
- if (i) {
278
- i.hasAttribute("rotWithShape") && (r.isRotated = i.getAttribute("rotWithShape") === "1");
279
- const a = this.processGradFill(t, i);
280
- return r.gradient = a, r;
281
- }
282
- const n = t.evaluate("pattFill", e);
283
- if (n) {
284
- const a = this.processPatternFill(t, n);
285
- return r.pattern = a, r;
286
- }
287
- const l = t.evaluate("blipFill", e);
288
- if (l) {
289
- l.hasAttribute("rotWithShape") && (r.isRotated = f(l.getAttribute("rotWithShape"))), l.hasAttribute("dpi") && (r.dpi = l.getAttribute("dpi"));
290
- const a = this.processImageFill(t, l);
291
- return r.image = a, r;
292
- }
293
- return r.none = !0, r;
294
- }
295
- processGradFill(t, e) {
296
- const s = {}, r = t.evaluate("lin", e);
297
- if (r) {
298
- if (s.type = "linear", r.hasAttribute("ang")) {
299
- const c = D(r.getAttribute("ang"));
300
- s.angle = c;
301
- }
302
- if (r.hasAttribute("scaled")) {
303
- const c = f(r.getAttribute("scaled"));
304
- s.scaled = c;
305
- }
306
- }
307
- const o = {};
308
- e.hasAttribute("flip") && (o.mirror = e.getAttribute("flip")), Object.keys(o).length > 0 && (s.tile = o);
309
- const i = t.evaluate("path", e);
310
- if (i) {
311
- i.hasAttribute("path") && (s.type = I.fromOoxmlGradientType(i.getAttribute("path")));
312
- const c = t.evaluate("fillToRect", i);
313
- c && (s.fillTo = this.getRect(c));
314
- }
315
- const n = t.evaluate("tileRect", e);
316
- n && (s.tile.bounds = this.getRect(n));
317
- const l = [], a = t.evaluate("gsLst/gs", e);
318
- for (let c = 0; a && c < a.length; c++) {
319
- const h = a.item(c), p = { offset: A(h.getAttribute("pos")), color: this.processAdjColor(t, h) };
320
- l.push(p);
321
- }
322
- return l.length > 0 && (s.stops = l), s;
323
- }
324
- getRect(t) {
325
- const e = {};
326
- return t.hasAttribute("t") && (e.t = A(t.getAttribute("t"))), t.hasAttribute("l") && (e.l = A(t.getAttribute("l"))), t.hasAttribute("b") && (e.b = A(t.getAttribute("b"))), t.hasAttribute("r") && (e.r = A(t.getAttribute("r"))), Object.keys(e).length === 0 ? null : e;
327
- }
328
- processImageFill(t, e) {
329
- return { ref: "https://www.sheetxl.com/logo-color-padded-white.jpg", tile: !1 };
330
- }
331
- processPatternFill(t, e) {
332
- const s = {}, r = e.getAttribute("prst");
333
- s.type = r;
334
- const o = t.evaluate("bgClr", e);
335
- if (o) {
336
- const n = this.processAdjColor(t, o);
337
- n && (s.background = n);
338
- }
339
- const i = t.evaluate("fgClr", e);
340
- if (i) {
341
- let n = this.processAdjColor(t, i);
342
- n && (s.foreground = n);
343
- }
344
- return s;
345
- }
346
- processAdjColor(t, e) {
347
- const s = t.evaluate("hslClr", e);
348
- if (s) return this.processHslClr(t, s);
349
- const r = t.evaluate("prstClr", e);
350
- if (r) return this.processClrWithValAttribute(t, r);
351
- const o = t.evaluate("schemeClr", e);
352
- if (o) return this.processClrWithValAttribute(t, o);
353
- const i = t.evaluate("sysClr", e);
354
- if (i) return this.processClrWithValAttribute(t, i);
355
- const n = t.evaluate("scrgbClr", e);
356
- if (n) return this.processScrgbClrElement(t, n);
357
- const l = t.evaluate("srgbClr", e);
358
- return l ? this.processSrgbClrElement(t, l) : null;
359
- }
360
- processScrgbClrElement(t, e) {
361
- let s = "lrgba(" + A(e.getAttribute("r")) + "," + A(e.getAttribute("g")) + "," + A(e.getAttribute("b")) + ")";
362
- return s += this.processAdjustments(t, e), s;
363
- }
364
- processSrgbClrElement(t, e) {
365
- let s = e.getAttribute("val");
366
- return s += this.processAdjustments(t, e), s;
367
- }
368
- processHslClr(t, e) {
369
- let s = "hsl(" + D(e.getAttribute("hue")) + "," + A(e.getAttribute("sat")) + "," + A(e.getAttribute("lum")) + ")";
370
- return s += this.processAdjustments(t, e), s;
371
- }
372
- processClrWithValAttribute(t, e) {
373
- const s = e.getAttribute("val");
374
- if (!s) return;
375
- let r = s;
376
- return r += this.processAdjustments(t, e), r;
377
- }
378
- processAdjustments(t, e) {
379
- let s = "";
380
- const r = e.childNodes;
381
- for (let o = 0; o < r.length; o++) {
382
- const i = r.item(o);
383
- if (i.nodeType === 1) {
384
- let n = i.localName;
385
- s += n === "hue" || n === "hueOff" || n === "hueMod" ? this.processAdjustmentElement(t, e, n, 6e4) : n === "gray" || n === "comp" || n === "inv" || n === "gamma" || n === "invGamma" ? this.processAdjustmentElement(t, e, n, 1) : this.processAdjustmentElement(t, e, n);
386
- }
387
- }
388
- return s;
389
- }
390
- processAdjustmentElement(t, e, s, r = 1e3) {
391
- const o = t.evaluate(s, e);
392
- if (!o) return "";
393
- const i = o.getAttribute("val");
394
- return i ? ` ${s} ${!i || parseFloat(i) / r}` : ` ${s}`;
395
- }
396
- }
397
- class M extends J {
398
- visit(t, e, s) {
399
- try {
400
- const r = t.evaluate("xfrm", e);
401
- if (r) {
402
- H(r, s);
403
- const l = { x: 0, y: 0, width: 0, height: 0 }, a = t.evaluate("off", r);
404
- a && (l.x = x(a.getAttribute("x")) ?? 0, l.y = x(a.getAttribute("y")) ?? 0);
405
- const c = t.evaluate("ext", r);
406
- a && (l.width = x(c.getAttribute("cx")) ?? 0, l.height = x(c.getAttribute("cy")) ?? 0), s.bounds = l;
407
- }
408
- const o = t.evaluate("prstGeom", e);
409
- o?.hasAttribute("prst") ? s.geometry = o?.getAttribute("prst") : t.evaluate("customGeom", e) && console.warn("customGeom not supported yet");
410
- const i = this.processFill(t, e, s);
411
- i && Object.keys(i).length > 0 && (s.fill = i);
412
- const n = this.processStroke(t, e, s);
413
- return n && Object.keys(n).length > 0 && (s.stroke = n), s;
414
- } catch (r) {
415
- throw console.warn(r), new Error("Unexpected Error parsing Shape Properties element");
416
- }
417
- }
418
- }
419
- class S {
420
- visit(t, e, s) {
421
- let r = {};
422
- if (b(t, e, r, "grouping", "grouping"), m(t, e, r, "varyColors", "varyColors"), y(t, e, r, "gapWidth", "gapWidth", 0.01), y(t, e, r, "overlap", "overlap", 0.01), this.parseType(t, e, r), w(t, e, r, "bubbleScale", "bubbleScale"), m(t, e, r, "showNegBubbles", "showNegativeBubbleValues"), m(t, e, r, "sizeRepresents", "bubbleSizeRepresentsWidth"), w(t, e, r, "firstSliceAng", "startAngle"), w(t, e, r, "holeSize", "holeSize"), b(t, e, r, "scatterStyle", "scatterStyle"), this.parseAxisIds(t, e, r), Object.keys(r).length > 0) {
423
- let o = t.getVisitorParamsState().get("types");
424
- o || (o = [], t.getVisitorParamsState().set("types", o)), o.push(r);
425
- }
426
- return r;
427
- }
428
- parseType(t, e, s) {
429
- switch (e.localName) {
430
- case "areaChart":
431
- s.type = "area";
432
- break;
433
- case "bubbleChart":
434
- s.type = "bubble";
435
- break;
436
- case "doughnutChart":
437
- case "ofPieType":
438
- case "pieChart":
439
- s.type = "pie";
440
- break;
441
- case "lineChart":
442
- s.type = "line";
443
- break;
444
- case "scatterChart":
445
- s.type = "scatter";
446
- }
447
- }
448
- parseAxisIds(t, e, s) {
449
- const r = t.evaluate("axId", e);
450
- if (r.length === 0) return;
451
- const o = r.item(0).getAttribute("val");
452
- s.xAxisId = o;
453
- const i = r.item(1).getAttribute("val");
454
- s.yAxisId = i;
455
- }
456
- }
457
- class gt extends S {
458
- parseType(t, e, s) {
459
- const r = t.getValAttrAsString("barDir", e);
460
- r && (s.type = r === "col" ? "column" : "bar");
461
- }
462
- }
463
- class N {
464
- constructor(t) {
465
- this.jsonKey = t;
466
- }
467
- visit(t, e, s) {
468
- let r = {}, o = r, i = t.getValAttrAsString("idx", e);
469
- i !== null && (o = {}, o[i] = r);
470
- const n = t.getValAttrAsBoolean("delete", e);
471
- this.parseNumFormat(t, e, r), n === !0 ? (r.showBubbleSize = !1, r.showCatName = !1, r.showLeaderLines = !1, r.showPercentage = !1, r.showSerName = !1, r.showVal = !1, r.showLegendKey = !1) : (m(t, e, r, "showBubbleSize", "showBubbleSize"), m(t, e, r, "showCatName", "showCatName"), m(t, e, r, "showLeaderLines", "showLeaderLines"), m(t, e, r, "showPercent", "showPercentage"), m(t, e, r, "showSerName", "showSerName"), m(t, e, r, "showVal", "showVal"), m(t, e, r, "showLegendKey", "showLegendKey"));
472
- const l = t.evaluate("separator", e);
473
- return l !== null && (r.separator = l.textContent), b(t, e, r, "dLblPos", "position"), s[this.jsonKey] = o, r;
474
- }
475
- parseNumFormat(t, e, s) {
476
- const r = t.evaluate("numFmt", e);
477
- if (r) {
478
- const o = r.getAttribute("formatCode");
479
- s.formatCode = o, r.hasAttribute("sourceLinked") && (s.sourceLinked = r.getAttribute("sourceLinked") === "1");
480
- }
481
- }
482
- }
483
- const q = (u, t, e) => {
484
- if (u.getValAttrAsBoolean("invertIfNegative", t) === !0) if (u.evaluate("extLst/ext/invertSolidFillFmt", t)) {
485
- if (e.fill && e.fillNegative) {
486
- const s = u.getFromPath(e, "fill.solid.adjs");
487
- s && u.setToPath(e, "fillNegative.solid.adjs", s);
488
- }
489
- } else {
490
- const s = { val: "FFFFFF" }, r = {};
491
- r.solid = s, e.fillNegative = r;
492
- const o = { val: "000000" }, i = {};
493
- i.solid = o;
494
- const n = {};
495
- n.fill = i, e.strokeNegative = n;
496
- }
497
- };
498
- class dt {
499
- visit(t, e, s) {
500
- const r = {};
501
- w(t, e, r, "explosion", "explosion");
502
- let o = t.evaluate("cat/*/f", e);
503
- o || (o = t.evaluate("xVal/*/f", e));
504
- let i = null;
505
- o !== null && o.firstChild !== null && (i = o.firstChild.nodeValue), o || (o = t.evaluate("cat/strLit", e), o || (o = t.evaluate("cat/numLit", e)), o && (i = this.parsePointsAsString(t, o))), i !== null && (r.xRange = i);
506
- let n = t.evaluate("val/*/f", e);
507
- n || (n = t.evaluate("yVal/*/f", e));
508
- let l = null;
509
- n && n.firstChild && (l = n.firstChild.nodeValue), n || (n = t.evaluate("val/numLit", e), n !== null && (l = this.parsePointsAsString(t, n))), l !== null && (r.valRange = l), this.parseTitleRangeOrValue(t, e, r), w(t, e, r, "idx", "idx"), m(t, e, r, "smooth", "smooth");
510
- const a = t.getVisitorParamsState().get("types").length - 1;
511
- r.offsetChart = a;
512
- let c = t.getVisitorParamsState().get("series");
513
- return c || (c = [], t.getVisitorParamsState().set("series", c)), c.push(r), r;
514
- }
515
- parseTitleRangeOrValue(t, e, s) {
516
- const r = t.evaluate("tx/strRef/f", e);
517
- if (r !== null) {
518
- const o = r.firstChild.nodeValue;
519
- t.setToPath(s, "title.range", o);
520
- } else {
521
- const o = t.evaluate("tx/v", e);
522
- o !== null && t.setToPath(s, "title.text.simpleRun", o.firstChild.nodeValue);
523
- }
524
- }
525
- parsePointsAsString(t, e) {
526
- let s = "{";
527
- const r = t.getValAttrAsInteger("ptCount", e), o = t.evaluate("pt", e), i = [];
528
- for (let n = 0; o && r && n < r; n++) {
529
- let l = null, a = t.evaluate("pt[@idx='" + n + "']/v", e);
530
- a instanceof Node && (l = a.textContent), i[n] = l;
531
- }
532
- for (let n = 0; n < i.length; n++) n > 0 && (s += ","), i[n] !== void 0 && (s += i[n]);
533
- return s += "}", s;
534
- }
535
- afterVisit(t, e, s) {
536
- q(t, e, s);
537
- let r = t.getFromPath(s, "points");
538
- if (r) {
539
- const o = Object.keys(r);
540
- for (let i = 0; i < o.length; i++) {
541
- const n = o[i], l = t.getFromPath(r, n);
542
- if (!l) continue;
543
- let a = t.getFromPath(l, "markers");
544
- a && (t.setToPath(s, "markers.points." + n, a), delete l.markers);
545
- }
546
- }
547
- }
548
- }
549
- class mt {
550
- DataPointVisitor() {
551
- }
552
- visit(t, e, s) {
553
- let r = t.getFromPath(s, "points"), o = null;
554
- r ? o = r : (o = {}, t.setToPath(s, "points", o));
555
- let i = {}, n = t.getValAttrAsString("idx", e);
556
- return n !== null && (o[n] = i), m(t, e, i, "bubble3D", "bubble3D"), w(t, e, i, "explosion", "explosion"), q(t, e, i), i;
557
- }
558
- }
559
- class bt {
560
- visit(t, e, s) {
561
- const r = e.parentNode.localName;
562
- if (r === "ser" || r === "dPt") {
563
- const o = {}, i = t.getValAttrAsString("size", e);
564
- i !== null && (o.size = i);
565
- const n = t.getValAttrAsString("symbol", e);
566
- return n && (o.type = n), s.markers = o, o;
567
- }
568
- return null;
569
- }
570
- }
571
- class R {
572
- visit(t, e, s) {
573
- let r = {};
574
- this.parseScaling(t, e, r), y(t, e, r, "majorUnit", "majorUnits"), y(t, e, r, "minorUnit", "minorUnits"), m(t, e, r, "delete", "shown"), this.parseOrientation(t, e, r), this.parseNumFormat(t, e, r), b(t, e, r, "majorTickMark", "majorTickMarks"), b(t, e, r, "minorTickMark", "minorTickMarks"), b(t, e, r, "crosses", "crosses"), y(t, e, r, "crossesAt", "crosses"), b(t, e, r, "crossBetween", "crossBetween"), this.parseLabelAlign(t, e, r), w(t, e, r, "lblOffset", "labelOffset"), b(t, e, r, "tickLblPos", "labelPosition");
575
- const o = t.getValAttrAsInteger("noMultiLvlLbl", e);
576
- r.labelMultiLevel = o !== null && o === 0, w(t, e, r, "tickMarkSkip", "tickMarkSkip"), w(t, e, r, "tickLblSkip", "labelInterval"), this.parseDisplayCustOrBuiltInUnit(e, t, r), this.parseTimeUnits(t, e, r, "majorUnitDates", "majorTimeUnit", "majorUnit"), this.parseTimeUnits(t, e, r, "minorUnitDates", "minorTimeUnit", "minorUnit"), b(t, e, r, "baseTimeUnit", "baseUnitDates"), t.getVisitorParamsState().get("axes") || t.getVisitorParamsState().set("axes", /* @__PURE__ */ new Map());
577
- const i = t.getValAttrAsString("axId", e);
578
- return t.getVisitorParamsState().get("axes").set(i, r), r;
579
- }
580
- parseTimeUnits(t, e, s, r, o, i) {
581
- const n = {};
582
- let l = t.getValAttrAsString(o, e);
583
- if (l !== null) {
584
- n.dem = l;
585
- let a = t.getValAttrAsString(i, e);
586
- n.amt = a;
587
- }
588
- Object.keys(n).length > 0 && (s[r] = n);
589
- }
590
- parseDisplayCustOrBuiltInUnit(t, e, s) {
591
- let r = e.getValAttrAsString("dispUnits/builtInUnit", t);
592
- r || (r = e.getValAttrAsString("dispUnits/custUnit", t)), r && (s.displayUnits = r);
593
- }
594
- parseLabelAlign(t, e, s) {
595
- let r = t.getValAttrAsString("lblAlgn", e);
596
- r !== null && (r === "ctr" ? s.labelAlign = "center" : r === "l" ? s.labelAlign = "left" : r === "r" && (s.labelAlign = "right"));
597
- }
598
- parseOrientation(t, e, s) {
599
- const r = t.getValAttrAsString("AxPos", e);
600
- r !== null && (r === "b" ? s.orientation = "bottom" : r === "l" ? s.orientation = "left" : r === "r" ? s.orientation = "right" : r === "t" && (s.orientation = "top"));
601
- }
602
- parseNumFormat(t, e, s) {
603
- const r = {}, o = t.evaluate("numFmt", e);
604
- o !== null && (o.hasAttribute("formatCode") && (r.formatCode = o.getAttribute("formatCode")), o.hasAttribute("sourceLinked") && (r.sourceLinked = o.getAttribute("sourceLinked") === "1")), Object.keys(r).length > 0 && (s.labels = r);
605
- }
606
- parseScaling(t, e, s) {
607
- const r = t.getValAttrAsString("scaling/orientation", e);
608
- r !== null && (s.inverted = r !== "minMax");
609
- const o = t.getValAttrAsFloat("scaling/logBase", e);
610
- o !== null && (s.logBase = o, s.scaleType = "log"), y(t, e, s, "scaling/max", "max"), y(t, e, s, "scaling/min", "min");
611
- }
612
- afterVisit(t, e, s) {
613
- s.fill && s.labels && (s.labels.fill = s.fill, delete s.fill);
614
- let r = t.getValAttrAsBoolean("delete", e);
615
- r !== null && (t.setToPath(s, "labels.shown", r !== !0), t.setToPath(s, "shown", r !== !0));
616
- const o = t.getFromPath(s, "dispUnits.displayUnitsLabel");
617
- o && (t.setToPath(s, "displayUnitsLabel", o), delete s.dispUnits);
618
- const i = t.evaluate("title", e);
619
- t.setToPath(s, "title.shown", i !== null);
620
- const n = t.evaluate("minorGridlines", e);
621
- t.setToPath(s, "gridLinesMinor.shown", n !== null);
622
- const l = t.evaluate("majorGridlines", e);
623
- t.setToPath(s, "gridLinesMajor.shown", l !== null);
624
- }
625
- }
626
- class F {
627
- constructor(t = "text") {
628
- this._jsonKey = t;
629
- }
630
- getTextPath() {
631
- return this._jsonKey;
632
- }
633
- visit(t, e, s) {
634
- let r = t.getFromPath(s, this.getTextPath());
635
- return r || (r = {}), this.parseTextElement(t, e, r, !1), Object.keys(r).length > 0 && t.setToPath(s, this.getTextPath(), r), s;
636
- }
637
- parseTextElement(t, e, s, r) {
638
- const o = t.evaluate("p/pPr/defRPr", e) ?? t.evaluate("defRPr", e);
639
- o && (this.parseTextProperties(t, o, s), new M().visit(t, o, s));
640
- let i = [], n = t.evaluate("p/r", e) ?? t.evaluate("r", e);
641
- const l = (c) => {
642
- const h = {};
643
- let p = t.evaluate("t", c);
644
- const g = t.evaluate("rPr", c);
645
- g && this.parseTextProperties(t, g, h), p ? h.text = p.firstChild.textContent ?? "" : c.textContent && (h.text = c.textContent ?? ""), i.push(h);
646
- };
647
- if (n?.length !== void 0) for (let c = 0; n && c < n.length; c++) l(n.item(c));
648
- else l(n || e);
649
- i.length > 0 && (s.runs = i);
650
- const a = t.evaluate("bodyPr", e);
651
- a && H(a, s);
652
- }
653
- parseTextProperties(t, e, s) {
654
- if (!e) return;
655
- e.hasAttribute("sz") && (s.size = parseFloat(e.getAttribute("sz")) / 100), e.hasAttribute("b") && (s.weight = e.getAttribute("b") === "1" ? 700 : 400), e.hasAttribute("i") && (s.italic = e.getAttribute("i") === "1"), e.hasAttribute("u") && (s.underline = e.getAttribute("u")), e.hasAttribute("strike") && (s.strike = e.getAttribute("strike"));
656
- const r = t.evaluate("latin", e);
657
- if (r && !r.getAttribute("typeface").startsWith("+")) {
658
- const o = s.font ?? {};
659
- if (r.hasAttribute("typeface") && (o.family = r.getAttribute("typeface")), r.hasAttribute("panose")) {
660
- const i = r.getAttribute("panose");
661
- i && (o.fallbacks = [k.getPanoseFallback(i)]);
662
- }
663
- r.hasAttribute("pitchFamily") && (o.pitch = r.getAttribute("pitchFamily")), r.hasAttribute("charset") && (o.charset = r.getAttribute("charset")), Object.keys(o).length > 0 && (s.font = o);
664
- }
665
- }
666
- }
667
- class ft {
668
- visit(t, e, s) {
669
- let r = t.getVisitorParamsState().get("series")[t.getValAttrAsInteger("idx", e)];
670
- if (r) {
671
- let o = t.getFromPath(r, "title");
672
- o || (o = {}, t.setToPath(r, "title", o));
673
- let i = o, n = t.getValAttrAsBoolean("delete", e);
674
- return n !== null && (i.shown = !n), i;
675
- }
676
- return s;
677
- }
678
- }
679
- class At {
680
- visit(t, e, s) {
681
- const r = {};
682
- return m(t, e, r, "overlay", "overlay"), b(t, e, r, "legendPos", "position"), s.legend = r, r;
683
- }
684
- }
685
- class yt extends M {
686
- visit(t, e, s) {
687
- const r = this.processFill(t, e, s);
688
- Object.keys(r).length > 0 && (s.fillNegative = r);
689
- const o = this.processStroke(t, e, s);
690
- return Object.keys(o).length > 0 && (s.strokeNegative = o), s;
691
- }
692
- }
693
- class X extends F {
694
- constructor(t = "title") {
695
- super(t);
696
- }
697
- parseTitleRangeOrValue(t, e, s) {
698
- let r = t.evaluate("tx/strRef/f", e) ?? null;
699
- if (r) {
700
- const o = r.firstElementChild.nodeValue;
701
- t.setToPath(s, "range", o);
702
- }
703
- }
704
- visit(t, e, s) {
705
- const r = {};
706
- m(t, e, r, "overlay", "overlay"), s[this._jsonKey] = r;
707
- let o = t.getFromPath(r, this.getTextPath());
708
- o || (o = {}), this.parseTitleRangeOrValue(t, e, r);
709
- const i = t.evaluate("txPr", e);
710
- i && this.parseTextElement(t, i, o, !1);
711
- const n = t.evaluate("tx/rich", e);
712
- return n && this.parseTextElement(t, n, o, !0), Object.keys(o).length > 0 && t.setToPath(r, this.getTextPath(), o), r;
713
- }
714
- afterVisit(t, e, s) {
715
- if (s?.text) {
716
- const r = s.text?.rotation ?? null;
717
- r !== null && (s.rotation = parseInt(r), delete s.title.rotation);
718
- }
719
- }
720
- }
721
- class vt {
722
- visit(t, e, s) {
723
- const r = t.evaluate("manualLayout", e);
724
- if (r) {
725
- let o = {};
726
- y(t, r, o, "x", "x"), y(t, r, o, "y", "y"), y(t, r, o, "w", "w"), y(t, r, o, "h", "h"), b(t, r, o, "xMode", "xMode"), b(t, r, o, "yMode", "yMode"), b(t, r, o, "wMode", "wMode"), b(t, r, o, "hMode", "hMode"), Object.keys(o).length > 0 && (s.manualLayout = o);
727
- }
728
- return s;
729
- }
730
- }
731
- class Ft {
732
- visit(t, e, s) {
733
- return s.name = e.getAttribute("name"), s;
734
- }
735
- }
736
- class Ct extends J {
737
- visit(t, e, s) {
738
- const r = {};
739
- r.name = e.getAttribute("name");
740
- const o = e.childNodes;
741
- for (let i = 0; i < o.length; i++) {
742
- const n = o.item(i);
743
- if (n.nodeType === 1) {
744
- let l = n.localName;
745
- const a = t.evaluate(l, e), c = this.processAdjColor(t, a);
746
- r[l] = c;
747
- }
748
- }
749
- return Object.keys(r).length > 0 && (s.colors = r), r;
750
- }
751
- }
752
- class wt {
753
- visit(t, e, s) {
754
- const r = {};
755
- r.name = e.getAttribute("name");
756
- const o = t.evaluate("majorFont", e), i = this.processFontElement(t, o, {});
757
- r.majorFont = i.family, i.fallbacks && (r.majorFallbacks = i.fallbacks);
758
- const n = t.evaluate("minorFont", e), l = this.processFontElement(t, n, {});
759
- return r.minorFont = l.family, i.fallbacks && (r.minorFallbacks = l.fallbacks), s.fonts = r, r;
760
- }
761
- processFontElement(t, e, s) {
762
- if (!e) return;
763
- const r = t.evaluate("latin", e);
764
- if (!r) return;
765
- const o = r.getAttribute("typeface");
766
- o && (s.family = o);
767
- const i = r.getAttribute("panose");
768
- return i && (s.fallbacks = [k.getPanoseFallback(i)]), s;
769
- }
770
- }
771
- class Pt {
772
- visit(t, e, s) {
773
- if (!e) return;
774
- const r = {}, o = e.getAttribute("r:id");
775
- if (o) {
776
- const i = t.getRef(o);
777
- typeof i == "string" && (r.address = i);
778
- }
779
- return t.copyFromAttribute(e, "tooltip", r), t.copyFromAttribute(e, "history", r, "history", t.BOOLEAN_COPY), t.copyFromAttribute(e, "tgtFrame", r, "target"), s.hyperlink = r, r;
780
- }
781
- }
782
- class Nt {
783
- visit(t, e, s) {
784
- if (!e) return;
785
- const r = {};
786
- return t.copyFromAttribute(e, "ref", r), this.processFilterColumns(t, e, r), Object.keys(r).length > 0 && (s.filter = r), r;
787
- }
788
- processColorFilter(t, e) {
789
- const s = { type: T.Type.Color };
790
- return t.copyFromAttribute(e, "cellColor", s, "cellColor", t.BOOLEAN_COPY), t.copyFromAttribute(e, "dxfId", s, "styleId", t.INT_COPY), s;
791
- }
792
- processCustomFilter(t, e) {
793
- const s = {};
794
- return t.copyFromAttribute(e, "operator", s, "operator", t.BOOLEAN_COPY), t.copyFromAttribute(e, "val", s, "val"), s;
795
- }
796
- processCustomFilters(t, e) {
797
- const s = { type: T.Type.Custom };
798
- t.copyFromAttribute(e, "and", s, "and", t.BOOLEAN_COPY);
799
- const r = e.childNodes;
800
- s.filters = [];
801
- for (let o = 0; o < r.length; o++) {
802
- const i = r.item(o);
803
- if (i.nodeType !== 1) continue;
804
- let n = null;
805
- i.localName === "customFilter" && (n = this.processCustomFilter(t, i)), n && s.filters.push(n);
806
- }
807
- return s;
808
- }
809
- processDynamicFilter(t, e) {
810
- const s = { type: T.Type.Dynamic };
811
- return t.copyFromAttribute(e, "type", s, "dynamicType"), t.copyFromAttribute(e, "val", s, "val", t.INT_COPY), t.copyFromAttribute(e, "maxVal", s, "maxVal", t.INT_COPY), s;
812
- }
813
- processDateGroupItem(t, e) {
814
- const s = {};
815
- return t.copyFromAttribute(e, "dateTimeGrouping", s, "group"), t.copyFromAttribute(e, "day", s, "day", t.INT_COPY), t.copyFromAttribute(e, "hour", s, "hour", t.INT_COPY), t.copyFromAttribute(e, "minute", s, "minute", t.INT_COPY), t.copyFromAttribute(e, "month", s, "month", t.INT_COPY), t.copyFromAttribute(e, "second", s, "second", t.INT_COPY), t.copyFromAttribute(e, "year", s, "year", t.INT_COPY), s;
816
- }
817
- processFilterItem(t, e) {
818
- if (e.hasAttribute("val")) return e.getAttribute("val");
819
- }
820
- processFilters(t, e) {
821
- const s = { type: T.Type.Items };
822
- t.copyFromAttribute(e, "blank", s, "blank", t.BOOLEAN_COPY), t.copyFromAttribute(e, "calendarType", s, "calendarType");
823
- let r = [], o = [];
824
- const i = e.childNodes;
825
- for (let n = 0; n < i.length; n++) {
826
- const l = i.item(n);
827
- if (l.nodeType === 1) {
828
- if (l.localName === "dateGroupItem") {
829
- const a = this.processDateGroupItem(t, l);
830
- a && r.push(a);
831
- } else if (l.localName === "filter") {
832
- const a = this.processFilterItem(t, l);
833
- a !== void 0 && o.push(a);
834
- }
835
- }
836
- }
837
- return r.length > 0 && (s.dateGroups = r), o.length > 0 && (s.items = o), s;
838
- }
839
- processIcon(t, e) {
840
- const s = { type: T.Type.Icon };
841
- return t.copyFromAttribute(e, "iconId", s, "iconId", t.INT_COPY), t.copyFromAttribute(e, "iconSet", s), s;
842
- }
843
- processTop10(t, e) {
844
- const s = { type: T.Type.Top10 };
845
- return t.copyFromAttribute(e, "filterVal", s, "filterVal", t.FLOAT_COPY), t.copyFromAttribute(e, "percent", s, "percent", t.BOOLEAN_COPY), t.copyFromAttribute(e, "top", s, "top", t.BOOLEAN_COPY), t.copyFromAttribute(e, "val", s, "val", t.FLOAT_COPY), s;
846
- }
847
- processFilterCriteria(t, e, s) {
848
- if (!e) return;
849
- const r = e.childNodes, o = [];
850
- for (let i = 0; i < r.length; i++) {
851
- const n = r.item(i);
852
- if (n.nodeType !== 1) continue;
853
- let l = null;
854
- n.localName === "colorFilter" ? l = this.processColorFilter(t, n) : n.localName === "customFilters" ? l = this.processCustomFilters(t, n) : n.localName === "dynamicFilter" ? l = this.processDynamicFilter(t, n) : n.localName === "filters" ? l = this.processFilters(t, n) : n.localName === "iconFilter" ? l = this.processIcon(t, n) : n.localName === "top10" && (l = this.processTop10(t, n)), l && o.push(l);
855
- }
856
- return o.length > 0 && (s.criteria = o), o;
857
- }
858
- processFilterColumn(t, e) {
859
- if (!e) return null;
860
- const s = {};
861
- if (!e.hasAttribute("colId")) return;
862
- s.offset = parseInt(e.getAttribute("colId"));
863
- let r = !1;
864
- return e.hasAttribute("hiddenButton") && (r = f(e.getAttribute("hiddenButton"))), r && (s.hiddenButton = !0), e.hasAttribute("showButton") && (s.showButton = f(e.getAttribute("showButton"))), this.processFilterCriteria(t, e, s), s;
865
- }
866
- processFilterColumns(t, e, s) {
867
- if (!e) return;
868
- const r = e.childNodes, o = [];
869
- for (let i = 0; i < r.length; i++) {
870
- const n = r.item(i);
871
- if (n.nodeType === 1 && n.localName === "filterColumn") {
872
- const l = this.processFilterColumn(t, n);
873
- l && o.push(l);
874
- }
875
- }
876
- return o.length > 0 && (s.fields = o), o;
877
- }
878
- }
879
- class Ot {
880
- visit(t, e, s) {
881
- if (!e) return;
882
- const r = {};
883
- if (t.copyFromAttribute(e, "ref", r), e.hasAttribute("caseSensitive")) {
884
- const n = f(e.getAttribute("caseSensitive"));
885
- r.collatorOptions = n ? G.CaseSensitiveOptions : G.CaseInsensitiveOptions;
886
- }
887
- const o = e.getAttribute("sortMethod");
888
- o != null && o !== "none" && (o === "stroke" ? r.collatorOptions = { ...r.collatorOptions, collation: "stroke" } : o === "pinYin" && (r.collatorOptions = { ...r.collatorOptions, collation: "pinyin" })), e.hasAttribute("columnSort") && f(e.getAttribute("columnSort")) && (r.orientation = Z.Orientation.Column);
889
- const i = W.fastStringToRange(r.ref);
890
- return this.processSortConditions(t, e, r, i), Object.keys(r).length > 0 && (s.sort = r), r;
891
- }
892
- processSortCondition(t, e, s) {
893
- if (!e) return null;
894
- const r = {};
895
- if (e.hasAttribute("ref")) {
896
- if (e.hasAttribute("ref")) {
897
- const o = e.getAttribute("ref"), i = W.fastStringToRange(o);
898
- r.offset = s ? i.colStart - s.colStart : i.colStart;
899
- }
900
- return r.reverse = !1, e.hasAttribute("descending") && (r.reverse = f(e.getAttribute("descending"))), t.copyFromAttribute(e, "sortBy", r, "sortOn"), t.copyFromAttribute(e, "dxfId", r), t.copyFromAttribute(e, "iconSet", r), t.copyFromAttribute(e, "customList", r), r;
901
- }
902
- console.warn("no ref for sort conditional", t.getPath());
903
- }
904
- processSortConditions(t, e, s, r) {
905
- if (!e) return;
906
- const o = e.childNodes, i = [];
907
- for (let n = 0; n < o.length; n++) {
908
- const l = o.item(n);
909
- if (l.nodeType === 1 && l.localName === "sortCondition") {
910
- const a = this.processSortCondition(t, l, r);
911
- a && i.push(a);
912
- }
913
- }
914
- return i.length > 0 && (s.fields = i), i;
915
- }
916
- }
917
- class Q {
918
- visit(t, e, s) {
919
- }
920
- processDataBarColor(t, e, s, r, o = "dk1") {
921
- if (!e) return;
922
- const i = st((n) => e.getAttribute(n), o);
923
- return i && (s[r] = i), s;
924
- }
925
- processFonts(t, e, s) {
926
- if (!e) return;
927
- const r = e.childNodes;
928
- let o = 0;
929
- for (let i = 0; i < r.length; i++) {
930
- const n = r.item(i);
931
- if (n.nodeType === 1 && n.localName === "font") {
932
- const l = {};
933
- this.processFont(t, n, l), s[o++] = l;
934
- }
935
- }
936
- return s;
937
- }
938
- processFont(t, e, s) {
939
- t.getValAttrAsBoolean("b", e, !0) && (s.weight = 700), t.getValAttrAsBoolean("i", e, !0) && (s.style = k.Style.Italic), t.getValAttrAsBoolean("strike", e, !0) && (s.strike = !0);
940
- const r = t.evaluate("u", e);
941
- if (r) {
942
- const n = r.getAttribute("val");
943
- s.underline = n || k.UnderlineStyle.Single;
944
- }
945
- b(t, e, s, "vertAlign", "verticalAlign"), s.verticalAlign === "superscript" ? s.verticalAlign = k.VerticalAlignment.Super : s.verticalAlign === "subscript" && (s.verticalAlign = k.VerticalAlignment.Sub), y(t, e, s, "sz", "size");
946
- const o = t.evaluate("color", e);
947
- this.processDataBarColor(t, o, s, "fill"), s.fill || (s.fill = "dk1"), b(t, e, s, "name", "family"), b(t, e, s, "rFont", "family");
948
- const i = t.evaluate("family", e);
949
- if (i) {
950
- const n = i.getAttribute("val");
951
- if (n) switch (n) {
952
- case "1":
953
- s.fallbacks = ["serif"];
954
- break;
955
- case "2":
956
- s.fallbacks = ["sans-serif"];
957
- break;
958
- case "3":
959
- s.fallbacks = ["monospace"];
960
- break;
961
- case "4":
962
- s.fallbacks = ["cursive"];
963
- break;
964
- case "5":
965
- s.fallbacks = ["fantasy"];
966
- }
967
- }
968
- return b(t, e, s, "scheme", "scheme"), m(t, e, s, "shadow", "shadow", !0), m(t, e, s, "outline", "outline", !0), t.getValAttrAsBoolean("condense", e, !0) && (s.letterSpacing = -1), t.getValAttrAsBoolean("extend", e, !0) && (s.letterSpacing = 1), b(t, e, s, "charset", "charset"), s;
969
- }
970
- processFills(t, e, s) {
971
- if (!e) return;
972
- const r = e.childNodes;
973
- let o = 0;
974
- for (let i = 0; i < r.length; i++) {
975
- const n = r.item(i);
976
- n.nodeType === 1 && n.localName === "fill" && this.processFill(t, n, s, o++);
977
- }
978
- return s;
979
- }
980
- processFill(t, e, s, r) {
981
- const o = { type: C.Type.None }, i = e.childNodes;
982
- let n = !1;
983
- for (let l = 0; !n && l < i.length; l++) {
984
- const a = i.item(l);
985
- a.nodeType === 1 && (a.localName === "gradientFill" ? (this.processGradientFill(t, a, o), n = !0) : a.localName === "patternFill" && (this.processPatternFill(t, a, o), n = !0));
986
- }
987
- return s[r] = o, s;
988
- }
989
- processGradientFill(t, e, s) {
990
- if (!e) return;
991
- s.type = C.Type.Gradient;
992
- const r = [];
993
- s.stops = r, s.angle = 90 + (e.hasAttribute("degree") ? parseFloat(e.getAttribute("degree")) : 0);
994
- const o = e.getAttribute("type");
995
- o && (s.gradientType = o);
996
- const i = (l) => {
997
- if (!l) return 0;
998
- const a = parseFloat(l);
999
- return isNaN(a) ? 0 : a;
1000
- };
1001
- (e.hasAttribute("left") || e.hasAttribute("top") || e.hasAttribute("right") || e.hasAttribute("bottom")) && (s.fillTo = { left: i(e.getAttribute("left")), top: i(e.getAttribute("top")), right: i(e.getAttribute("right")), bottom: i(e.getAttribute("bottom")) });
1002
- const n = e.childNodes;
1003
- for (let l = 0; l < n.length; l++) {
1004
- const a = n.item(l);
1005
- if (a.nodeType === 1 && a.localName === "stop") {
1006
- const c = {};
1007
- r.push(c);
1008
- const h = parseFloat(a.getAttribute("position"));
1009
- c.offset = h;
1010
- const p = t.evaluate("color", a);
1011
- this.processDataBarColor(t, p, c, "color");
1012
- }
1013
- }
1014
- return s;
1015
- }
1016
- processPatternFill(t, e, s) {
1017
- if (!e) return;
1018
- const r = t.getVisitorParamsState().get("processingDXFs"), o = e.getAttribute("patternType") || (r ? C.BuiltInSheetPattern.Solid : C.BuiltInSheetPattern.None);
1019
- if (o === C.BuiltInSheetPattern.None) return { none: !0 };
1020
- s.type = C.Type.Pattern, o && (s.patternType = o);
1021
- let i, n = "foreground", l = "background";
1022
- const a = s.patternType === C.BuiltInSheetPattern.Solid && r;
1023
- if (a) {
1024
- i = "lt1";
1025
- const p = n;
1026
- n = l, l = p;
1027
- }
1028
- const c = t.evaluate("fgColor", e);
1029
- this.processDataBarColor(t, c, s, n, i);
1030
- const h = t.evaluate("bgColor", e);
1031
- return this.processDataBarColor(t, h, s, l, i), a && !s.foreground && (s.foreground = i), s;
1032
- }
1033
- processBorders(t, e, s, r) {
1034
- if (!e) return;
1035
- const o = e.childNodes;
1036
- let i = 0;
1037
- for (let n = 0; n < o.length; n++) {
1038
- const l = o.item(n);
1039
- l.nodeType === 1 && l.localName === "border" && this.processBorder(t, l, s, i++, r);
1040
- }
1041
- return s;
1042
- }
1043
- processBorder(t, e, s, r, o) {
1044
- if (!e) return;
1045
- const i = {};
1046
- return this.processBorderStroke(t, e, i, V.Edge.Left), this.processBorderStroke(t, e, i, V.Edge.Right), o ? (i.right || i.left) && (i.right ? i.vertical = { ...i.right } : i.vertical = { ...i.left }) : this.processBorderStroke(t, e, i, V.Edge.Vertical), this.processBorderStroke(t, e, i, V.Edge.Top), this.processBorderStroke(t, e, i, V.Edge.Bottom), o ? (i.bottom || i.top) && (i.right ? i.horizontal = { ...i.bottom } : i.horizontal = { ...i.top }) : this.processBorderStroke(t, e, i, V.Edge.Horizontal), s[r] = i, s;
1047
- }
1048
- processBorderStroke(t, e, s, r) {
1049
- if (!e) return;
1050
- const o = t.evaluate(r, e);
1051
- if (!o) return;
1052
- const i = {};
1053
- o.hasAttribute("style") && (i.style = o.getAttribute("style"));
1054
- const n = t.evaluate("color", o);
1055
- return n && this.processDataBarColor(t, n, i, "color"), Object.keys(i).length > 0 ? s[r] = i : null;
1056
- }
1057
- }
1058
- class Tt extends Q {
1059
- visit(t, e, s) {
1060
- this.processNumFmts(t, t.evaluate("numFmts", e), null), t.getVisitorParamsState().set("colorsToProcess", /* @__PURE__ */ new Set());
1061
- const r = { fills: {}, fonts: {}, borders: {} };
1062
- this.processFonts(t, t.evaluate("fonts", e), r.fonts), this.processFills(t, t.evaluate("fills", e), r.fills), this.processBorders(t, t.evaluate("borders", e), r.borders, !0), r.fills[0] = { type: C.Type.None }, r.fills[1] = { type: C.Type.Pattern, patternType: C.BuiltInSheetPattern.Gray125 }, r.borders[0] = {};
1063
- const o = [];
1064
- this.processXFs(t, t.evaluate("cellStyleXfs", e), o, r, null, !1);
1065
- const i = /* @__PURE__ */ new Map();
1066
- if (o.length > 0) {
1067
- const a = [];
1068
- this.processCellStyles(t, t.evaluate("cellStyles", e), a, o, i), s.named = a;
1069
- }
1070
- const n = [];
1071
- this.processXFs(t, t.evaluate("cellXfs", e), n, r, i), Object.keys(n).length > 0 && (s.direct = n);
1072
- const l = [];
1073
- return this.processDXFs(t, t.evaluate("dxfs", e), l), this.processTableStyles(t, t.evaluate("tableStyles", e), s, l), this.processIndexColors(t, t.evaluate("colors/indexedColors", e), s), this.processMruColors(t, t.evaluate("colors/mruColors", e), s), s;
1074
- }
1075
- processIndexColors(t, e, s) {
1076
- if (!e) return;
1077
- const r = [], o = e.childNodes;
1078
- for (let i = 0; i < o.length; i++) {
1079
- const n = o.item(i);
1080
- if (n.nodeType === 1 && n.localName === "rgbColor") {
1081
- const l = { color: null };
1082
- this.processDataBarColor(t, n, l, "color"), l.color && r.push(l.color);
1083
- }
1084
- }
1085
- s.indexedColors = r;
1086
- }
1087
- processMruColors(t, e, s) {
1088
- if (!e) return;
1089
- const r = [], o = e.childNodes;
1090
- for (let i = 0; i < o.length; i++) {
1091
- const n = o.item(i);
1092
- if (n.nodeType === 1 && n.localName === "color") {
1093
- const l = { color: null };
1094
- this.processDataBarColor(t, n, l, "color"), l.color && r.push(l.color);
1095
- }
1096
- }
1097
- r.length > 0 && (s.mruColors = r);
1098
- }
1099
- processNumFmts(t, e, s) {
1100
- if (!e) return;
1101
- const r = /* @__PURE__ */ new Map();
1102
- if (t.getVisitorParamsState().set("numFmts", r), !e) return;
1103
- const o = e.childNodes;
1104
- for (let i = 0; i < o.length; i++) {
1105
- const n = o.item(i);
1106
- if (n.nodeType === 1 && n.localName === "numFmt") {
1107
- const l = n.getAttribute("numFmtId"), a = n.getAttribute("formatCode");
1108
- if (l && a) {
1109
- const c = a.replace(/\\(.)/g, "$1");
1110
- r.set(parseInt(l), c);
1111
- }
1112
- }
1113
- }
1114
- }
1115
- processXFs(t, e, s, r, o = null, i = !0) {
1116
- if (!e) return;
1117
- const n = e.childNodes;
1118
- for (let l = 0; l < n.length; l++) {
1119
- const a = n.item(l);
1120
- if (a.nodeType === 1 && a.localName === "xf") {
1121
- const c = {};
1122
- this.processXF(t, a, c, r, o, i), s.push(c);
1123
- }
1124
- }
1125
- }
1126
- processXF(t, e, s, r, o, i) {
1127
- if (!e) return;
1128
- const n = e.getAttribute("xfId");
1129
- if (n && o) {
1130
- const c = o.get(parseInt(n));
1131
- c && c !== tt.BuiltInName.Normal && (s.named = c);
1132
- }
1133
- const l = (c) => !(!i && e.hasAttribute(c)) || f(e.getAttribute("applyFont"));
1134
- if (l("applyFont")) {
1135
- const c = r.fonts[e.getAttribute("fontId")];
1136
- c && (s.font = c);
1137
- }
1138
- if (l("applyFill")) {
1139
- const c = r.fills[e.getAttribute("fillId")];
1140
- c && Object.keys(c).length > 0 && (s.fill = c);
1141
- }
1142
- if (l("applyBorder")) {
1143
- const c = r.borders[e.getAttribute("borderId")];
1144
- c && Object.keys(c).length > 0 && (s.border = c);
1145
- }
1146
- if (l("applyNumberFormat")) {
1147
- const c = e.getAttribute("numFmtId");
1148
- if (c) {
1149
- const h = parseInt(c);
1150
- let p;
1151
- const g = t.getVisitorParamsState();
1152
- if (g) {
1153
- const d = g.get("numFmts");
1154
- d && (p = d.get(h)), s.numberFormat = p ?? h;
1155
- } else console.warn("no visitor params state");
1156
- }
1157
- }
1158
- l("applyAlignment") && this.processAlignment(t, t.evaluate("alignment", e), s), l("applyProtection") && this.processProtection(t, t.evaluate("protection", e), s);
1159
- const a = f(e.getAttribute("quotePrefix"));
1160
- a && (s.quotePrefix = a);
1161
- }
1162
- processAlignment(t, e, s) {
1163
- const r = {};
1164
- if (e?.hasAttribute("horizontal") ? r.horizontal = e.getAttribute("horizontal") : r.horizontal = P.HorizontalAlignment.General, e?.hasAttribute("vertical") ? r.vertical = e.getAttribute("vertical") : r.vertical = P.VerticalAlignment.Bottom, e?.hasAttribute("indent") ? r.indent = parseInt(e.getAttribute("indent")) : r.indent = 0, e?.hasAttribute("relativeIndent") ? r.relativeIndent = parseInt(e.getAttribute("relativeIndent")) : r.relativeIndent = 0, f(e?.getAttribute("wrapText")) ? r.overflow = P.Overflow.Wrap : r.overflow = P.Overflow.Visible, f(e?.getAttribute("shrinkToFit")) && (r.overflow = P.Overflow.Shrink), e?.hasAttribute("textRotation")) {
1165
- let i = parseFloat(e.getAttribute("textRotation"));
1166
- i > 0 && i <= 90 ? i = 360 - i : i > 90 && i <= 180 ? i -= 90 : i === 255 && (i = 0, r.stacked = !0), r.rotation = i;
1167
- } else r.rotation = 0;
1168
- e?.hasAttribute("justifyLastLine") && (r.justifyLastLine = f(e.getAttribute("justifyLastLine")));
1169
- const o = e?.getAttribute("readingOrder");
1170
- return o && (o === "0" ? r.readingDirection = P.ReadingDirection.Auto : o === "1" ? r.readingDirection = P.ReadingDirection.LeftToRight : o === "2" ? r.readingDirection = P.ReadingDirection.RightToLeft : console.warn(`invalid readingOrder: ${o}`)), Object.keys(r).length > 0 && (s.alignment = r), s;
1171
- }
1172
- processProtection(t, e, s) {
1173
- if (!e) return;
1174
- const r = {}, o = e.getAttribute("locked");
1175
- o && !f(o) && (r.edit = !0);
1176
- const i = e.getAttribute("hidden");
1177
- return i && f(i) && (r.formulaHidden = !0), Object.keys(r).length > 0 && (s.protection = r), s;
1178
- }
1179
- processDXF(t, e, s) {
1180
- if (!e) return;
1181
- const r = e.childNodes;
1182
- for (let o = 0; o < r.length; o++) {
1183
- const i = r.item(o);
1184
- if (i.nodeType === 1 && i.localName === "font") {
1185
- const n = {};
1186
- this.processFont(t, i, n), s.font = n;
1187
- } else if (i.nodeType === 1 && i.localName === "fill") {
1188
- const n = [];
1189
- this.processFill(t, i, n, 0), n.length > 0 && n[0] && (s.fill = n[0]);
1190
- } else if (i.nodeType === 1 && i.localName === "border") {
1191
- const n = [];
1192
- this.processBorder(t, i, n, 0, !1), n.length > 0 && n[0] && (s.border = n[0]);
1193
- }
1194
- }
1195
- }
1196
- processDXFs(t, e, s) {
1197
- if (!e) return;
1198
- t.getVisitorParamsState().set("processingDXFs", !0);
1199
- const r = /* @__PURE__ */ new Map();
1200
- t.getVisitorParamsState().set("dxfs", r);
1201
- const o = e.childNodes;
1202
- for (let i = 0; i < o.length; i++) {
1203
- const n = o.item(i);
1204
- if (n.nodeType === 1 && n.localName === "dxf") {
1205
- const l = {};
1206
- this.processDXF(t, n, l);
1207
- const a = s.length;
1208
- r.set(a, l), s.push(l);
1209
- }
1210
- }
1211
- t.getVisitorParamsState().delete("processingDXFs");
1212
- }
1213
- processTableStyle(t, e, s, r, o = !1) {
1214
- const i = e.getAttribute("name"), n = { name: i };
1215
- e.hasAttribute("table") && (n.table = f(e.getAttribute("table"))), e.hasAttribute("pivot") && (n.pivot = f(e.getAttribute("pivot"))), o && !n.pivot && r.unshift(null);
1216
- const l = e.childNodes;
1217
- for (let a = 0; a < l.length; a++) {
1218
- const c = l.item(a);
1219
- if (c.nodeType === 1 && c.localName === "tableStyleElement") {
1220
- const h = c.getAttribute("type"), p = c.getAttribute("dxfId");
1221
- let g = r?.[p];
1222
- g || (console.warn("invalid dfx id", p), g = {}), n[h] = g;
1223
- let d = null;
1224
- c.hasAttribute("size") && (d = parseInt(c.getAttribute("size"))), d && !isNaN(d) && (g.size = d);
1225
- }
1226
- }
1227
- delete n.name, s[i] = n;
1228
- }
1229
- processTableStyles(t, e, s, r, o) {
1230
- if (!e) return;
1231
- const i = {}, n = e.getAttribute("defaultTableStyle");
1232
- n && (i.defaultTableStyle = n);
1233
- const l = e.getAttribute("defaultPivotStyle");
1234
- l && (i.defaultPivotStyle = l);
1235
- const a = e.childNodes, c = {};
1236
- for (let h = 0; h < a.length; h++) {
1237
- const p = a.item(h);
1238
- p.nodeType === 1 && p.localName === "tableStyle" && this.processTableStyle(t, p, c, r, o);
1239
- }
1240
- return Object.keys(c).length > 0 && (i.styles = c), Object.keys(i).length > 0 && (s.tables = i), s;
1241
- }
1242
- processCellStyles(t, e, s, r, o) {
1243
- if (!e) return;
1244
- const i = e.childNodes;
1245
- for (let n = 0; n < i.length; n++) {
1246
- const l = i.item(n);
1247
- if (l.nodeType === 1 && l.localName === "cellStyle") {
1248
- const a = parseInt(l.getAttribute("xfId")), c = l.getAttribute("name");
1249
- if (o.set(a, c), !r[a]) continue;
1250
- const h = { name: c, style: r[a] };
1251
- l.getAttribute("hidden") && (h.hidden = f(l.getAttribute("hidden"))), l.getAttribute("iLevel") && (h.iLevel = parseInt(l.getAttribute("iLevel"))), s.push(h);
1252
- }
1253
- }
1254
- }
1255
- afterVisit(t, e, s) {
1256
- }
1257
- }
1258
- class Vt extends Q {
1259
- visit(t, e, s) {
1260
- return this.processSheetRefs(t, t.evaluate("sheets", e), s), this.processBookViews(t, t.evaluate("bookViews", e), s), this.processDefinedNames(t, t.evaluate("definedNames", e), s), this.processCalcPr(t, t.evaluate("calcPr", e), s), this.processWorkbookProtection(t, t.evaluate("workbookProtection", e), s), this.processWorkbookPr(t, t.evaluate("workbookPr", e), s), s;
1261
- }
1262
- processPassword(t, e, s, r = "password") {
1263
- if (!e) return;
1264
- const o = {};
1265
- t.copyFromAttribute(e, "algorithmName", o, "algorithmName"), t.copyFromAttribute(e, "hashValue", o, "hashValue"), t.copyFromAttribute(e, "saltValue", o, "saltValue", t.BOOLEAN_COPY), t.copyFromAttribute(e, "spinCount", o, "spinCount", t.INT_COPY), Object.keys(o).length > 0 && (s[r] = o);
1266
- }
1267
- processWorkbookProtection(t, e, s) {
1268
- if (!e) return;
1269
- const r = {};
1270
- this.processPassword(t, t.evaluate("workbookPassword", e), r), this.processPassword(t, t.evaluate("revisionsPassword", e), r, "revisionsPassword");
1271
- const o = (i) => i !== !0 && i !== "1" && i !== "on" && i !== "true" && (i === !1 || i === "0" || i === "off" || i === "false" || null);
1272
- return t.copyFromAttribute(e, "lockStructure", r, "structure", o), t.copyFromAttribute(e, "lockWindows", r, "windows", o), t.copyFromAttribute(e, "lockRevision", r, "revision", o), s.protection = r, s;
1273
- }
1274
- processCalcPr(t, e, s) {
1275
- e && (s.calc = {});
1276
- }
1277
- processSheetRefs(t, e, s) {
1278
- if (!e) return;
1279
- const r = [], o = e.childNodes;
1280
- for (let i = 0; i < o.length; i++) {
1281
- const n = o.item(i);
1282
- n.nodeType === 1 && n.localName === "sheet" && this.processSheetRef(t, n, r);
1283
- }
1284
- s.sheets = r;
1285
- }
1286
- processSheetRef(t, e, s) {
1287
- const r = {};
1288
- t.copyFromAttribute(e, "name", r, "name"), t.copyFromAttribute(e, "state", r, "visibility");
1289
- const o = e.getAttribute("r:id"), i = t.getRef(o);
1290
- i && (r.sheet = i), s.push(r);
1291
- }
1292
- processBookViews(t, e, s) {
1293
- if (!e) return;
1294
- const r = e.childNodes;
1295
- let o = 0;
1296
- for (let i = 0; o < 1 && i < e.childNodes.length; i++) {
1297
- const n = r.item(i);
1298
- n.nodeType === 1 && n.localName === "workbookView" && (this.processWorkbookView(t, n, s), o++);
1299
- }
1300
- }
1301
- processWorkbookView(t, e, s) {
1302
- if (!e) return;
1303
- const r = {};
1304
- t.copyFromAttribute(e, "activeTab", r, "activeSheetId", [t.INT_COPY, (o) => o + 1]), e.hasAttribute("activeTab") || (r.activeSheetId = 1), t.copyFromAttribute(e, "showHorizontalScroll", r, "showHorizontalScrollbar", t.BOOLEAN_COPY), t.copyFromAttribute(e, "showVerticalScroll", r, "showVerticalScrollbar", t.BOOLEAN_COPY), t.copyFromAttribute(e, "showSheetTabs", r, "showTabs", t.BOOLEAN_COPY), t.copyFromAttribute(e, "tabRatio", r, "tabRatio", [t.FLOAT_COPY, (o) => o]), Object.keys(r).length > 0 && (s.view = r);
1305
- }
1306
- processDefineName(t, e, s, r) {
1307
- if (!e) return;
1308
- const o = {}, i = e.firstChild;
1309
- if (i && i.nodeType === 3 && (o.ref = i.textContent), t.copyFromAttribute(e, "name", o), t.copyFromAttribute(e, "comment", o), t.copyFromAttribute(e, "hidden", o, "hidden", t.BOOLEAN_COPY), e.hasAttribute("localSheetId")) {
1310
- const n = e.getAttribute("localSheetId");
1311
- if (!r[n]?.name) return void console.warn(`Defined name '${e.getAttribute("name")}' references a sheet with localSheetId '${n}' which does not exist.`);
1312
- o.scope = r[n].name;
1313
- }
1314
- t.copyFromAttribute(e, "customMenu", o), t.copyFromAttribute(e, "description", o), t.copyFromAttribute(e, "statusBar", o), t.copyFromAttribute(e, "help", o), t.copyFromAttribute(e, "shortcutKey", o), t.copyFromAttribute(e, "function", o, "function", t.BOOLEAN_COPY), t.copyFromAttribute(e, "functionGroupId", o, "functionGroupId", t.INT_COPY), t.copyFromAttribute(e, "publishToServer", o, "publishToServer", t.BOOLEAN_COPY), t.copyFromAttribute(e, "vbProcedure", o, "vbProcedure", t.BOOLEAN_COPY), t.copyFromAttribute(e, "xlm", o, "xlm", t.BOOLEAN_COPY), Object.keys(o).length > 0 && s.push(o);
1315
- }
1316
- processDefinedNames(t, e, s) {
1317
- if (!e) return;
1318
- const r = [], o = e.childNodes;
1319
- for (let i = 0; i < o.length; i++) {
1320
- const n = o.item(i);
1321
- n.nodeType === 1 && n.localName === "definedName" && this.processDefineName(t, n, r, s.sheets);
1322
- }
1323
- r.length > 0 && (s.names = r);
1324
- }
1325
- processWorkbookPr(t, e, s) {
1326
- e && t.copyFromAttribute(e, "date1904", s, "date1904", t.BOOLEAN_COPY);
1327
- }
1328
- afterVisit(t, e, s) {
1329
- }
1330
- }
1331
- class St {
1332
- visit(t, e, s) {
1333
- return t.copyFromAttribute(e, "name", s), t.copyFromAttribute(e, "displayName", s), t.copyFromAttribute(e, "ref", s), t.copyFromAttribute(e, "headerRowCount", s, "headerRowCount", t.INT_COPY), t.copyFromAttribute(e, "totalsRowCount", s, "totalsRowCount", t.INT_COPY), this.processTableColumns(t, e, s), this.processTableStyleInfo(t, e, s), s;
1334
- }
1335
- processTableStyleInfo(t, e, s) {
1336
- if (!e) return;
1337
- const r = e.childNodes, o = {};
1338
- for (let i = 0; i < r.length; i++) {
1339
- const n = r.item(i);
1340
- n.nodeType === 1 && n.localName === "tableStyleInfo" && (t.copyFromAttribute(n, "name", o), t.copyFromAttribute(n, "showColumnStripes", o, "showColumnStripes", t.BOOLEAN_COPY), t.copyFromAttribute(n, "showFirstColumn", o, "showFirstColumn", t.BOOLEAN_COPY), t.copyFromAttribute(n, "showLastColumn", o, "showLastColumn", t.BOOLEAN_COPY), t.copyFromAttribute(n, "showRowStripes", o, "showRowStripes", t.BOOLEAN_COPY));
1341
- }
1342
- Object.keys(o).length > 0 && (s.styleOptions = o);
1343
- }
1344
- processTableColumn(t, e, s) {
1345
- if (!e) return null;
1346
- const r = e.childNodes;
1347
- for (let o = 0; o < r.length; o++) {
1348
- const i = r.item(o);
1349
- if (i.nodeType === 1 && i.localName === "tableColumn") {
1350
- const n = {};
1351
- t.copyFromAttribute(i, "name", n), t.copyFromAttribute(i, "uniqueName", n), s.push(n);
1352
- }
1353
- }
1354
- return s;
1355
- }
1356
- processTableColumns(t, e, s) {
1357
- const r = e.childNodes, o = [];
1358
- for (let i = 0; i < r.length; i++) {
1359
- const n = r.item(i);
1360
- n.nodeType === 1 && n.localName === "tableColumns" && this.processTableColumn(t, n, o);
1361
- }
1362
- o.length > 0 && (s.columns = o);
1363
- }
1364
- }
1365
- class kt {
1366
- visit(t, e, s) {
1367
- return s;
1368
- }
1369
- }
1370
- class E {
1371
- visit(t, e, s) {
1372
- if (!e) return;
1373
- const r = {};
1374
- return t.copyFromAttribute(e, "editAs", r, "anchorType"), r.anchor = {}, this.processOffsetCoord(t, t.evaluate("from", e), r.anchor, "from"), this.processOffsetCoord(t, t.evaluate("to", e), r.anchor, "to"), s.movables || (s.movables = []), s.movables.push(r), r;
1375
- }
1376
- processOffsetCoord(t, e, s, r) {
1377
- if (!e) return;
1378
- const o = { c: 0, r: 0, x: 0, y: 0 };
1379
- return t.evaluate("col", e) && (o.c = parseInt(t.evaluate("col", e).textContent)), t.evaluate("row", e) && (o.r = parseInt(t.evaluate("row", e).textContent)), t.evaluate("colOff", e) && (o.x = x(t.evaluate("colOff", e).textContent)), t.evaluate("rowOff", e) && (o.y = x(t.evaluate("rowOff", e).textContent)), r === "from" ? s.tl = o : s.br = o, s;
1380
- }
1381
- }
1382
- class U {
1383
- visit(t, e, s) {
1384
- if (!e) return;
1385
- const r = t.evaluate("*/cNvPr", e);
1386
- return r && (t.copyFromAttribute(r, "name", s), t.copyFromAttribute(r, "desc", s), t.copyFromAttribute(r, "hidden", s, "hidden", t.BOOLEAN_COPY), t.copyFromAttribute(r, "id", s)), s;
1387
- }
1388
- }
1389
- class xt extends U {
1390
- visit(t, e, s) {
1391
- if (!e) return;
1392
- s = super.visit(t, e, s);
1393
- const r = t.evaluate("nvGraphicFramePr/cNvGraphicFramePr", e);
1394
- if (r) {
1395
- const n = t.evaluate("graphicFrameLocks", r);
1396
- if (n) {
1397
- n.hasAttribute("noChangeAspect") && (s.lockAspect = n.getAttribute("noChangeAspect") === "1");
1398
- const l = {};
1399
- Object.keys(l).length > 0 && (s.locks = l);
1400
- }
1401
- }
1402
- let o = { type: "graphicFrame", json: {} };
1403
- const i = t.evaluate("graphic/graphicData", e).childNodes;
1404
- for (let n = 0; n < i.length; n++) {
1405
- const l = i.item(n);
1406
- if (l.nodeType === 1) try {
1407
- let a = l.localName;
1408
- a === "chart" && (a = "chart"), o.type = a;
1409
- const c = l.getAttribute("r:id");
1410
- c && (o.json = t.getRef(c));
1411
- } catch (a) {
1412
- console.warn("Unable to parse graphicFrame", a);
1413
- }
1414
- }
1415
- return o && (s.content = o), o;
1416
- }
1417
- }
1418
- class z extends U {
1419
- visit(t, e, s) {
1420
- if (!e) return;
1421
- s = super.visit(t, e, s);
1422
- const r = t.evaluate("nvSpPr/cNvSpPr", e);
1423
- if (r) {
1424
- const i = t.evaluate("spLocks", r);
1425
- if (i) {
1426
- i.hasAttribute("noChangeAspect") && (s.lockAspect = i.getAttribute("noChangeAspect") === "1");
1427
- const n = {};
1428
- Object.keys(n).length > 0 && (s.locks = n);
1429
- }
1430
- }
1431
- t.warn(`Unable to import '${s.name}', shapes are not supported.`);
1432
- const o = {};
1433
- return s.content = { type: "sp", json: o }, o;
1434
- }
1435
- }
1436
- class Lt extends U {
1437
- visit(t, e, s) {
1438
- if (!e) return;
1439
- const r = super.visit(t, e, s), o = t.evaluate("nvPicPr/cNvPicPr", e);
1440
- if (o) {
1441
- t.copyFromAttribute(e, "preferRelativeResize", r, "preferRelativeResize", t.BOOLEAN_COPY);
1442
- const a = t.evaluate("picLocks", o);
1443
- if (a) {
1444
- a.hasAttribute("noChangeAspect") && (r.lockAspect = a.getAttribute("noChangeAspect") === "1");
1445
- const c = {};
1446
- t.copyFromAttribute(a, "noChangeArrowheads", r, "noChangeArrowheads", t.BOOLEAN_COPY), t.copyFromAttribute(a, "noChangeShapeType", r, "noChangeShapeType", t.BOOLEAN_COPY), t.copyFromAttribute(a, "noEditPoints", r, "noEditPoints", t.BOOLEAN_COPY), t.copyFromAttribute(a, "noAdjustHandles", r, "noAdjustHandles", t.BOOLEAN_COPY), t.copyFromAttribute(a, "noCrop", r, "noCrop", t.BOOLEAN_COPY), t.copyFromAttribute(a, "noGrp", r, "noGrp", t.BOOLEAN_COPY), t.copyFromAttribute(a, "noMove", r, "noMove", t.BOOLEAN_COPY), t.copyFromAttribute(a, "noResize", r, "noResize", t.BOOLEAN_COPY), t.copyFromAttribute(a, "noRot", r, "noRot", t.BOOLEAN_COPY), t.copyFromAttribute(a, "noSelect", r, "noSelect", t.BOOLEAN_COPY), Object.keys(c).length > 0 && (r.locks = c);
1447
- }
1448
- }
1449
- const i = t.evaluate("blipFill/blip", e);
1450
- let n;
1451
- if (i) {
1452
- const a = i.getAttribute("r:embed") ?? i.getAttribute("embed");
1453
- if (!a) return void console.warn("no rId found for blip", i);
1454
- n = t.getRef(a, !0);
1455
- }
1456
- const l = { resId: n };
1457
- return s.content = { type: "picture", json: l }, r;
1458
- }
1459
- }
1460
- class It extends z {
1461
- visit(t, e, s) {
1462
- if (!e) return;
1463
- s = super.visit(t, e, s);
1464
- const r = t.evaluate("nvGrpSpPr/cNvGrpSpPr", e);
1465
- if (r) {
1466
- const i = t.evaluate("grpSpLocks", r);
1467
- if (i) {
1468
- i.hasAttribute("noChangeAspect") && (s.lockAspect = i.getAttribute("noChangeAspect") === "1");
1469
- const n = {};
1470
- Object.keys(n).length > 0 && (s.locks = n);
1471
- }
1472
- }
1473
- t.warn(`Unable to import '${s.name}', group shapes are not supported.`);
1474
- const o = {};
1475
- return s.content = { type: "grpSp", json: o }, o;
1476
- }
1477
- }
1478
- class Bt extends z {
1479
- visit(t, e, s) {
1480
- if (!e) return;
1481
- s = super.visit(t, e, s);
1482
- const r = t.evaluate("nvCxnSpPr/cNvCxnSpPr", e);
1483
- if (r) {
1484
- const i = t.evaluate("cxnSpLocks", r);
1485
- if (i) {
1486
- i.hasAttribute("noChangeAspect") && (s.lockAspect = i.getAttribute("noChangeAspect") === "1");
1487
- const n = {};
1488
- Object.keys(n).length > 0 && (s.locks = n);
1489
- }
1490
- }
1491
- t.warn(`Unable to import '${s.name}', connection shapes are not supported.`);
1492
- const o = {};
1493
- return s.content = { type: "cxnSp", json: o }, o;
1494
- }
1495
- }
1496
- const $ = "richTypes";
1497
- class _t {
1498
- visit(t, e, s) {
1499
- let r = t.getVisitorParamsState().get($);
1500
- r || (r = [], t.getVisitorParamsState().set($, r));
1501
- const o = e.childNodes, i = o.length;
1502
- for (let n = 0; n < i; n++) {
1503
- const l = o.item(n);
1504
- if (l.nodeType === 1 && l.localName === "s") {
1505
- const a = { type: l.getAttribute("t") ?? "n", keys: [] };
1506
- this.processKeys(t, l, a), r.push(a);
1507
- }
1508
- }
1509
- return s.richTypes = r, r;
1510
- }
1511
- processKeys(t, e, s) {
1512
- const r = e.childNodes, o = r.length, i = s.keys;
1513
- for (let n = 0; n < o; n++) {
1514
- const l = r.item(n);
1515
- if (l.nodeType === 1 && l.localName === "k") {
1516
- const a = l.getAttribute("n"), c = l.getAttribute("t");
1517
- i.push([a, c]);
1518
- }
1519
- }
1520
- }
1521
- }
1522
- const K = "richData";
1523
- class jt {
1524
- visit(t, e, s) {
1525
- let r = t.getVisitorParamsState().get("richTypes");
1526
- if (!r) return void t.warn("RichValueFound but not type.");
1527
- let o = t.getVisitorParamsState().get(K);
1528
- o || (o = [], t.getVisitorParamsState().set(K, o));
1529
- const i = e.childNodes, n = i.length;
1530
- for (let l = 0; l < n; l++) {
1531
- const a = i.item(l);
1532
- if (a.nodeType === 1 && a.localName === "rv") {
1533
- const c = r[a.getAttribute("s")], h = { type: c.type };
1534
- this.processValues(t, a, h, c);
1535
- const p = this.mapType(t, h);
1536
- o.push(p);
1537
- }
1538
- }
1539
- return s.richData = o, o;
1540
- }
1541
- mapType(t, e) {
1542
- if (e.type === "_error") {
1543
- const s = e.errorType;
1544
- if (s) try {
1545
- e = et.getBuiltInById(s + 1);
1546
- } catch {
1547
- }
1548
- }
1549
- return e;
1550
- }
1551
- processValues(t, e, s, r) {
1552
- const o = e.childNodes, i = o.length;
1553
- r.type;
1554
- const n = r.keys;
1555
- for (let l = 0; l < i; l++) {
1556
- const a = o.item(l);
1557
- if (a.nodeType === 1 && a.localName === "v") {
1558
- const c = n[l];
1559
- if (!c) return void t.warn("Invalid richData");
1560
- const h = c[0], p = c[1];
1561
- let g = a.textContent;
1562
- p === "i" && (g = Number(g)), s[h] = g;
1563
- }
1564
- }
1565
- }
1566
- }
1567
- class Rt {
1568
- visit(t, e, s) {
1569
- if (!e) return;
1570
- const r = [];
1571
- return this.processAuthors(t, t.evaluate("authors", e), r), r.length > 0 && (s.authors = r), s.comments = [], s;
1572
- }
1573
- processAuthors(t, e, s) {
1574
- if (!e) return;
1575
- const r = e.childNodes;
1576
- for (let o = 0; o < r.length; o++) {
1577
- const i = r.item(o);
1578
- if (i.nodeType === 1 && i.localName === "author") {
1579
- const n = i.firstChild;
1580
- n && n.nodeType === 3 && s.push(n.textContent);
1581
- }
1582
- }
1583
- }
1584
- }
1585
- class Et {
1586
- visit(t, e, s) {
1587
- if (!e) return;
1588
- const r = {};
1589
- return t.copyFromAttribute(e, "ref", r), t.copyFromAttribute(e, "authorId", r, "authorId", t.INT_COPY), r.asNote = !0, s.comments || (s.comments = []), s.comments.push(r), r;
1590
- }
1591
- }
1592
- class Yt {
1593
- visit(t, e, s) {
1594
- if (!e) return;
1595
- const r = [];
1596
- return s.comments = r, r;
1597
- }
1598
- }
1599
- class Dt {
1600
- visit(t, e, s) {
1601
- if (!e) return;
1602
- const r = {};
1603
- return t.copyFromAttribute(e, "id", r, "id", L), t.copyFromAttribute(e, "personId", r, "personId", L), t.copyFromAttribute(e, "ref", r), t.copyFromAttribute(e, "parentId", r, "parentId", L), t.copyFromAttribute(e, "dT", r), e.hasAttribute("done") && (r.done = f(e.getAttribute("done"))), s.push(r), r;
1604
- }
1605
- }
1606
- class Mt {
1607
- visit(t, e, s) {
1608
- const r = [], o = e.childNodes;
1609
- for (let i = 0; i < o.length; i++) {
1610
- const n = o.item(i);
1611
- if (n.nodeType === 1 && n.localName === "person") {
1612
- const l = {};
1613
- t.copyFromAttribute(n, "id", l, "id", L), t.copyFromAttribute(n, "displayName", l), t.copyFromAttribute(n, "userId", l, "userId", L), t.copyFromAttribute(n, "providerId", l), r.push(l);
1614
- }
1615
- }
1616
- return r.length > 0 && (s.persons = r), r;
1617
- }
1618
- }
1619
- const Ut = {};
1620
- class zt {
1621
- constructor(t, e) {
1622
- this.path = t, this.visitor = e;
1623
- }
1624
- }
1625
- class Xt {
1626
- constructor() {
1627
- this.visitorsByXmlTagName = /* @__PURE__ */ new Map(), this.scopedVisitorsByXmlTagName = /* @__PURE__ */ new Map(), this.visitorParamsState = null, this.registerVisitor("Relationships", new ct()), this.registerVisitor("spPr", new M()), this.registerVisitor("txBody", new F()), this.registerVisitor("txPr", new F()), this.registerVisitor("c:chartSpace", new ut()), this.registerVisitor("c:chartSpace", new ht(), "chart"), this.registerVisitor("c:plotArea", new pt()), this.registerVisitor("c:barChart", new gt()), this.registerVisitor("c:doughnutChart", new S()), this.registerVisitor("c:lineChart", new S()), this.registerVisitor("c:ofPieType", new S()), this.registerVisitor("c:pieChart", new S()), this.registerVisitor("c:scatterChart", new S()), this.registerVisitor("c:barChart", new N("dataLabels"), "dLbls"), this.registerVisitor("c:doughnutChart", new N("dataLabels"), "dLbls"), this.registerVisitor("c:lineChart", new N("dataLabels"), "dLbls"), this.registerVisitor("c:ofPieType", new N("dataLabels"), "dLbls"), this.registerVisitor("c:pieChart", new N("dataLabels"), "dLbls"), this.registerVisitor("c:scatterChart", new N("dataLabels"), "dLbls"), this.registerVisitor("c:ser", new dt()), this.registerVisitor("c:dPt", new mt()), this.registerVisitor("c:marker", new bt()), this.registerVisitor("c:catAx", new R()), this.registerVisitor("c:valAx", new R()), this.registerVisitor("c:dateAx", new R()), this.registerVisitor("c:majorGridlines", new j("gridLinesMajor")), this.registerVisitor("c:minorGridlines", new j("gridLinesMinor")), this.registerVisitor("c:chartSpace", null, "txPr"), this.registerVisitor("c:catAx", new F("labels.text"), "txPr"), this.registerVisitor("c:valAx", new F("labels.text"), "txPr"), this.registerVisitor("c:dateAx", new F("labels.text"), "txPr"), this.registerVisitor("c:legend", new At()), this.registerVisitor("c:legend", new F("labels.text"), "txPr"), this.registerVisitor("c:legendEntry", new ft()), this.registerVisitor("c:ser", new yt(), "extLst/ext/invertSolidFillFmt/spPr"), this.registerVisitor("c:ser", new N("labels"), "dLbls"), this.registerVisitor("c:dLbl", new N("points")), this.registerVisitor("c:title", new X()), this.registerVisitor("c:title", null, "tx/rich"), this.registerVisitor("c:title", null, "txPr"), this.registerVisitor("c:layout", new vt()), this.registerVisitor("c:dispUnits", new j("dispUnits")), this.registerVisitor("c:dispUnitsLbl", new X("displayUnitsLabel")), this.registerVisitor("c:dispUnitsLbl", new F(), "tx/rich"), this.registerVisitor("a:theme", new Ft()), this.registerVisitor("a:theme", new Ct(), "themeElements/clrScheme"), this.registerVisitor("a:theme", new wt(), "themeElements/fontScheme"), this.registerVisitor("autoFilter", new Nt()), this.registerVisitor("sortState", new Ot()), this.registerVisitor("s:workbook", new Vt()), this.registerVisitor("styleSheet", new Tt()), this.registerVisitor("table", new St()), this.registerVisitor("hlinkClick", new Pt()), this.registerVisitor("wsDr", new kt()), this.registerVisitor("twoCellAnchor", new E()), this.registerVisitor("oneCellAnchor", new E()), this.registerVisitor("absoluteAnchor", new E()), this.registerVisitor("graphicFrame", new xt()), this.registerVisitor("sp", new z()), this.registerVisitor("grpSp", new It()), this.registerVisitor("cxnSp", new Bt()), this.registerVisitor("pic", new Lt()), this.registerVisitor("rvStructures", new _t()), this.registerVisitor("rvData", new jt()), this.registerVisitor("comments", new Rt()), this.registerVisitor("commentList", new Et(), "comment"), this.registerVisitor("comment", new F("content"), "text"), this.registerVisitor("ThreadedComments", new Yt()), this.registerVisitor("threadedComment", new Dt()), this.registerVisitor("threadedComment", new F("content"), "text"), this.registerVisitor("personList", new Mt());
1628
- }
1629
- registerVisitor(t, e, s = null) {
1630
- t.indexOf(":") === -1 && (t = "*:" + t);
1631
- const r = t.split(":"), o = r.length > 1 ? r[1] : r[0];
1632
- if (!s) return this.visitorsByXmlTagName.set(o, e), void this.visitorsByXmlTagName.set(t, e);
1633
- let i = this.scopedVisitorsByXmlTagName.get(o);
1634
- i || (i = [], this.scopedVisitorsByXmlTagName.set(o, i), this.scopedVisitorsByXmlTagName.set(t, i)), i.push(new zt(s, e));
1635
- }
1636
- getVisitorParamsState() {
1637
- return this.visitorParamsState;
1638
- }
1639
- convert(t, e, s = Ut) {
1640
- const r = t.documentElement;
1641
- this.visitorParamsState && !s?.paramMap || (this.visitorParamsState = s?.paramMap ?? /* @__PURE__ */ new Map());
1642
- const o = {};
1643
- let i = this.visitorsByXmlTagName.get(r.nodeName);
1644
- if (i || (i = this.visitorsByXmlTagName.get(r.localName)), !i) throw new Error(`A visitor for the root element: '${r.nodeName}' or '${r.localName}' must be registered.`);
1645
- const n = "/" + r.localName, l = new _(null, this, n, r, o, e, s), a = [];
1646
- this._doWalk(i, l, a, r, o, e, s);
1647
- for (let c = 0; c < a.length; c++) {
1648
- const h = a[c];
1649
- try {
1650
- h.visitor?.afterVisit?.(h.context, h.elemParent, h.jsonParent);
1651
- } catch (p) {
1652
- console.warn(`Error in afterVisit: ${h.context.getPath()}`, p);
1653
- }
1654
- }
1655
- return o;
1656
- }
1657
- _walkScoped(t, e, s, r, o, i, n) {
1658
- const l = this.scopedVisitorsByXmlTagName.get(t);
1659
- for (let a = 0; l && a < l.length; a++) {
1660
- const c = l[a];
1661
- let h = null;
1662
- try {
1663
- h = e.evaluate(c.path, r);
1664
- } catch {
1665
- console.warn(`"Invalid path '${c.path}' for '${t}'.`);
1666
- }
1667
- if (!h) continue;
1668
- const p = (g) => {
1669
- let d = g.localName, v = g.parentNode;
1670
- for (; v && v !== r; ) d = v.localName + "/" + d, v = v.parentNode;
1671
- const O = e.getPath() + "/" + d;
1672
- if (c.visitor) {
1673
- const B = new _(e, this, O, e.getElemRoot(), e.getJsonRoot(), i, n);
1674
- this._doWalk(c.visitor, B, s, g, o, i, n);
1675
- }
1676
- };
1677
- if (h.length > 0) {
1678
- const g = h;
1679
- for (let d = 0; d < g.length; d++) p(g.item(d));
1680
- } else p(h);
1681
- }
1682
- }
1683
- _doWalk(t, e, s, r, o, i, n) {
1684
- let l = null;
1685
- t && (s.push({ visitor: t, context: e, elemParent: r, jsonParent: o }), l = t.visit(e, r, o)), l || (l = o);
1686
- const a = r.localName;
1687
- this._walkScoped(a, e, s, r, l, i, n);
1688
- const c = r.childNodes;
1689
- for (let h = 0; h < c.length; h++) {
1690
- const p = c.item(h);
1691
- if (p.nodeType === 1) {
1692
- const g = p, d = g.localName, v = this.visitorsByXmlTagName.get(d), O = e.getPath() + "/" + d, B = new _(e, this, O, e.getElemRoot(), e.getJsonRoot(), i, n);
1693
- this._doWalk(v, B, s, g, l ?? o, i, n);
1694
- }
1695
- }
1696
- return l;
1697
- }
1698
- }
1699
- export {
1700
- Xt as FromOOXMLConverter,
1701
- Xt as default
1702
- };