@rhc-office/sdk 6.6.266 → 6.6.351

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 (92) hide show
  1. package/README.md +1 -5
  2. package/dist/api/annotation-tool.d.ts +162 -102
  3. package/dist/api/annotation-tool.d.ts.map +1 -1
  4. package/dist/api/callbacks.d.ts +32 -6
  5. package/dist/api/callbacks.d.ts.map +1 -1
  6. package/dist/api/document-sdk.d.ts +6 -5
  7. package/dist/api/document-sdk.d.ts.map +1 -1
  8. package/dist/api/document-tool.d.ts +16 -11
  9. package/dist/api/document-tool.d.ts.map +1 -1
  10. package/dist/api/menu-visibility.d.ts +6 -1
  11. package/dist/api/menu-visibility.d.ts.map +1 -1
  12. package/dist/api/page-arrange-tool.d.ts +28 -0
  13. package/dist/api/page-arrange-tool.d.ts.map +1 -0
  14. package/dist/api/security-tool.d.ts +21 -0
  15. package/dist/api/security-tool.d.ts.map +1 -0
  16. package/dist/api/ui-tool.d.ts +19 -0
  17. package/dist/api/ui-tool.d.ts.map +1 -1
  18. package/dist/browser/document-viewer.js +1 -1
  19. package/dist/browser/document-viewer.js.map +1 -1
  20. package/dist/index.d.ts +3 -0
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +730 -501
  23. package/dist/index.js.map +1 -1
  24. package/dist/index.umd.cjs +1 -1
  25. package/dist/index.umd.cjs.map +1 -1
  26. package/dist/tools/AnnotationToolImpl.d.ts +25 -0
  27. package/dist/tools/AnnotationToolImpl.d.ts.map +1 -0
  28. package/dist/tools/CryptoToolImpl.d.ts +9 -0
  29. package/dist/tools/CryptoToolImpl.d.ts.map +1 -0
  30. package/dist/tools/DigitalSignToolImpl.d.ts +27 -0
  31. package/dist/tools/DigitalSignToolImpl.d.ts.map +1 -0
  32. package/dist/tools/DocumentToolImpl.d.ts +1 -0
  33. package/dist/tools/DocumentToolImpl.d.ts.map +1 -1
  34. package/dist/tools/PageArrangeToolImpl.d.ts +21 -0
  35. package/dist/tools/PageArrangeToolImpl.d.ts.map +1 -0
  36. package/dist/tools/SecurityToolImpl.d.ts +12 -0
  37. package/dist/tools/SecurityToolImpl.d.ts.map +1 -0
  38. package/dist/tools/SignServerToolImpl.d.ts +19 -0
  39. package/dist/tools/SignServerToolImpl.d.ts.map +1 -0
  40. package/dist/tools/SymbologyToolImpl.d.ts +8 -0
  41. package/dist/tools/SymbologyToolImpl.d.ts.map +1 -0
  42. package/dist/tools/TemplateSignToolImpl.d.ts +13 -0
  43. package/dist/tools/TemplateSignToolImpl.d.ts.map +1 -0
  44. package/dist/tools/UIToolImpl.d.ts +13 -0
  45. package/dist/tools/UIToolImpl.d.ts.map +1 -1
  46. package/dist/tools/index.d.ts +8 -1
  47. package/dist/tools/index.d.ts.map +1 -1
  48. package/dist/viewer/AdapterProtocol.d.ts +3 -1
  49. package/dist/viewer/AdapterProtocol.d.ts.map +1 -1
  50. package/dist/viewer/BridgeToolAdapter.d.ts +1 -0
  51. package/dist/viewer/BridgeToolAdapter.d.ts.map +1 -1
  52. package/dist/viewer/DocumentSDK.d.ts +7 -5
  53. package/dist/viewer/DocumentSDK.d.ts.map +1 -1
  54. package/dist/viewer/ReaderBridgeClient.d.ts +3 -0
  55. package/dist/viewer/ReaderBridgeClient.d.ts.map +1 -1
  56. package/dist/viewer/ReaderConfiguration.d.ts +0 -1
  57. package/dist/viewer/ReaderConfiguration.d.ts.map +1 -1
  58. package/dist/viewer/ReaderStateStore.d.ts +2 -0
  59. package/dist/viewer/ReaderStateStore.d.ts.map +1 -1
  60. package/dist/viewer/SdkCallbackRegistry.d.ts +5 -2
  61. package/dist/viewer/SdkCallbackRegistry.d.ts.map +1 -1
  62. package/package.json +2 -2
  63. package/src/api/annotation-tool.ts +232 -146
  64. package/src/api/callbacks.ts +48 -7
  65. package/src/api/document-sdk.ts +9 -5
  66. package/src/api/document-tool.ts +25 -13
  67. package/src/api/menu-visibility.ts +10 -1
  68. package/src/api/page-arrange-tool.ts +67 -0
  69. package/src/api/security-tool.ts +32 -0
  70. package/src/api/ui-tool.ts +33 -0
  71. package/src/index.ts +3 -0
  72. package/src/tools/AnnotationToolImpl.ts +169 -0
  73. package/src/tools/CryptoToolImpl.ts +27 -0
  74. package/src/tools/DigitalSignToolImpl.ts +166 -0
  75. package/src/tools/DocumentToolImpl.ts +32 -6
  76. package/src/tools/PageArrangeToolImpl.ts +99 -0
  77. package/src/tools/SecurityToolImpl.ts +48 -0
  78. package/src/tools/SignServerToolImpl.ts +92 -0
  79. package/src/tools/SymbologyToolImpl.ts +34 -0
  80. package/src/tools/TemplateSignToolImpl.ts +51 -0
  81. package/src/tools/UIToolImpl.ts +98 -12
  82. package/src/tools/index.ts +8 -1
  83. package/src/viewer/AdapterProtocol.ts +4 -0
  84. package/src/viewer/BridgeToolAdapter.ts +11 -2
  85. package/src/viewer/DocumentSDK.ts +71 -144
  86. package/src/viewer/ReaderBridgeClient.ts +9 -0
  87. package/src/viewer/ReaderConfiguration.ts +0 -2
  88. package/src/viewer/ReaderStateStore.ts +13 -1
  89. package/src/viewer/SdkCallbackRegistry.ts +84 -6
  90. package/dist/tools/Phase1ToolPlaceholder.d.ts +0 -5
  91. package/dist/tools/Phase1ToolPlaceholder.d.ts.map +0 -1
  92. package/src/tools/Phase1ToolPlaceholder.ts +0 -35
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
- var K = /* @__PURE__ */ ((n) => (n.DEFAULT = "default", n.COMPACT = "compact", n.HIDE = "none", n))(K || {});
2
- const w = "RIGHT_CENTER", _ = "REGULAR_ESM", F = "auto", b = "__RHC_OFFICE_DIGITAL_SIGN_ENVIRONMENT__", y = {
1
+ var W = /* @__PURE__ */ ((t) => (t.DEFAULT = "default", t.COMPACT = "compact", t.HIDE = "none", t))(W || {});
2
+ const L = "RIGHT_CENTER", F = "REGULAR_ESM", U = "auto", S = "__RHC_OFFICE_DIGITAL_SIGN_ENVIRONMENT__", v = {
3
3
  defaults: {
4
4
  bjca: {
5
5
  pin: ""
6
6
  },
7
7
  deviceType: "client",
8
- edgePosition: w,
8
+ edgePosition: L,
9
9
  kol: {
10
10
  appId: "",
11
11
  appName: "",
@@ -17,8 +17,8 @@ const w = "RIGHT_CENTER", _ = "REGULAR_ESM", F = "auto", b = "__RHC_OFFICE_DIGIT
17
17
  pin: "",
18
18
  usbKeyType: 14
19
19
  },
20
- rsaMode: F,
21
- signatureType: _
20
+ rsaMode: U,
21
+ signatureType: F
22
22
  },
23
23
  signServer: {
24
24
  authSource: "Password",
@@ -38,216 +38,340 @@ const w = "RIGHT_CENTER", _ = "REGULAR_ESM", F = "auto", b = "__RHC_OFFICE_DIGIT
38
38
  usbKeyType: 14
39
39
  }
40
40
  }
41
- }, O = (n) => ({
41
+ }, N = (t) => ({
42
42
  bjca: {
43
- pin: n.bjca.pin
43
+ pin: t.bjca.pin
44
44
  },
45
- deviceType: n.deviceType,
46
- edgePosition: n.edgePosition,
45
+ deviceType: t.deviceType,
46
+ edgePosition: t.edgePosition,
47
47
  kol: {
48
- appId: n.kol.appId,
49
- appName: n.kol.appName,
50
- pin: n.kol.pin,
51
- serviceUrl: n.kol.serviceUrl,
52
- token: n.kol.token
48
+ appId: t.kol.appId,
49
+ appName: t.kol.appName,
50
+ pin: t.kol.pin,
51
+ serviceUrl: t.kol.serviceUrl,
52
+ token: t.kol.token
53
53
  },
54
54
  plugin: {
55
- pin: n.plugin.pin,
56
- usbKeyType: n.plugin.usbKeyType
55
+ pin: t.plugin.pin,
56
+ usbKeyType: t.plugin.usbKeyType
57
57
  },
58
- rsaMode: n.rsaMode,
59
- signatureType: n.signatureType
60
- }), L = (n) => ({
61
- authSource: n.authSource,
62
- defaultLogin: n.defaultLogin,
63
- defaultPassword: n.defaultPassword,
64
- defaultServer: n.defaultServer,
58
+ rsaMode: t.rsaMode,
59
+ signatureType: t.signatureType
60
+ }), B = (t) => ({
61
+ authSource: t.authSource,
62
+ defaultLogin: t.defaultLogin,
63
+ defaultPassword: t.defaultPassword,
64
+ defaultServer: t.defaultServer,
65
65
  kol: {
66
- appId: n.kol.appId,
67
- appName: n.kol.appName,
68
- serviceUrl: n.kol.serviceUrl,
69
- token: n.kol.token
66
+ appId: t.kol.appId,
67
+ appName: t.kol.appName,
68
+ serviceUrl: t.kol.serviceUrl,
69
+ token: t.kol.token
70
70
  },
71
- macAddress: n.macAddress,
72
- token: n.token,
71
+ macAddress: t.macAddress,
72
+ token: t.token,
73
73
  usbKey: {
74
- checkCertificateBinding: n.usbKey.checkCertificateBinding,
75
- usbKeyType: n.usbKey.usbKeyType
74
+ checkCertificateBinding: t.usbKey.checkCertificateBinding,
75
+ usbKeyType: t.usbKey.usbKeyType
76
76
  }
77
- }), h = (n) => ({
78
- defaults: O(n.defaults),
79
- signServer: L(n.signServer)
80
- }), U = (n) => ({
81
- defaults: n.defaults ? {
82
- ...n.defaults,
83
- bjca: n.defaults.bjca ? { ...n.defaults.bjca } : void 0,
84
- kol: n.defaults.kol ? { ...n.defaults.kol } : void 0,
85
- plugin: n.defaults.plugin ? { ...n.defaults.plugin } : void 0
77
+ }), m = (t) => ({
78
+ defaults: N(t.defaults),
79
+ signServer: B(t.signServer)
80
+ }), x = (t) => ({
81
+ defaults: t.defaults ? {
82
+ ...t.defaults,
83
+ bjca: t.defaults.bjca ? { ...t.defaults.bjca } : void 0,
84
+ kol: t.defaults.kol ? { ...t.defaults.kol } : void 0,
85
+ plugin: t.defaults.plugin ? { ...t.defaults.plugin } : void 0
86
86
  } : void 0,
87
- signServer: n.signServer ? {
88
- ...n.signServer,
89
- kol: n.signServer.kol ? { ...n.signServer.kol } : void 0,
90
- usbKey: n.signServer.usbKey ? { ...n.signServer.usbKey } : void 0
87
+ signServer: t.signServer ? {
88
+ ...t.signServer,
89
+ kol: t.signServer.kol ? { ...t.signServer.kol } : void 0,
90
+ usbKey: t.signServer.usbKey ? { ...t.signServer.usbKey } : void 0
91
91
  } : void 0
92
- }), G = (n, t) => t ? {
92
+ }), $ = (t, n) => n ? {
93
93
  bjca: {
94
- pin: t.bjca?.pin ?? n.bjca.pin
94
+ pin: n.bjca?.pin ?? t.bjca.pin
95
95
  },
96
- deviceType: t.deviceType ?? n.deviceType,
97
- edgePosition: t.edgePosition ?? n.edgePosition,
96
+ deviceType: n.deviceType ?? t.deviceType,
97
+ edgePosition: n.edgePosition ?? t.edgePosition,
98
98
  kol: {
99
- appId: t.kol?.appId ?? n.kol.appId,
100
- appName: t.kol?.appName ?? n.kol.appName,
101
- pin: t.kol?.pin ?? n.kol.pin,
102
- serviceUrl: t.kol?.serviceUrl ?? n.kol.serviceUrl,
103
- token: t.kol?.token ?? n.kol.token
99
+ appId: n.kol?.appId ?? t.kol.appId,
100
+ appName: n.kol?.appName ?? t.kol.appName,
101
+ pin: n.kol?.pin ?? t.kol.pin,
102
+ serviceUrl: n.kol?.serviceUrl ?? t.kol.serviceUrl,
103
+ token: n.kol?.token ?? t.kol.token
104
104
  },
105
105
  plugin: {
106
- pin: t.plugin?.pin ?? n.plugin.pin,
107
- usbKeyType: t.plugin?.usbKeyType ?? n.plugin.usbKeyType
106
+ pin: n.plugin?.pin ?? t.plugin.pin,
107
+ usbKeyType: n.plugin?.usbKeyType ?? t.plugin.usbKeyType
108
108
  },
109
- rsaMode: t.rsaMode ?? n.rsaMode,
110
- signatureType: t.signatureType ?? n.signatureType
111
- } : O(n), H = (n, t) => t ? {
112
- authSource: t.authSource ?? n.authSource,
113
- defaultLogin: t.defaultLogin ?? n.defaultLogin,
114
- defaultPassword: t.defaultPassword ?? n.defaultPassword,
115
- defaultServer: t.defaultServer ?? n.defaultServer,
109
+ rsaMode: n.rsaMode ?? t.rsaMode,
110
+ signatureType: n.signatureType ?? t.signatureType
111
+ } : N(t), j = (t, n) => n ? {
112
+ authSource: n.authSource ?? t.authSource,
113
+ defaultLogin: n.defaultLogin ?? t.defaultLogin,
114
+ defaultPassword: n.defaultPassword ?? t.defaultPassword,
115
+ defaultServer: n.defaultServer ?? t.defaultServer,
116
116
  kol: {
117
- appId: t.kol?.appId ?? n.kol.appId,
118
- appName: t.kol?.appName ?? n.kol.appName,
119
- serviceUrl: t.kol?.serviceUrl ?? n.kol.serviceUrl,
120
- token: t.kol?.token ?? n.kol.token
117
+ appId: n.kol?.appId ?? t.kol.appId,
118
+ appName: n.kol?.appName ?? t.kol.appName,
119
+ serviceUrl: n.kol?.serviceUrl ?? t.kol.serviceUrl,
120
+ token: n.kol?.token ?? t.kol.token
121
121
  },
122
- macAddress: t.macAddress ?? n.macAddress,
123
- token: t.token ?? n.token,
122
+ macAddress: n.macAddress ?? t.macAddress,
123
+ token: n.token ?? t.token,
124
124
  usbKey: {
125
- checkCertificateBinding: t.usbKey?.checkCertificateBinding ?? n.usbKey.checkCertificateBinding,
126
- usbKeyType: t.usbKey?.usbKeyType ?? n.usbKey.usbKeyType
125
+ checkCertificateBinding: n.usbKey?.checkCertificateBinding ?? t.usbKey.checkCertificateBinding,
126
+ usbKeyType: n.usbKey?.usbKeyType ?? t.usbKey.usbKeyType
127
127
  }
128
- } : L(n), N = (n, t) => ({
129
- defaults: G(n.defaults, t.defaults),
130
- signServer: H(n.signServer, t.signServer)
131
- }), q = (n, t) => ({
132
- defaults: n.defaults || t.defaults ? {
133
- ...n.defaults,
128
+ } : B(t), V = (t, n) => ({
129
+ defaults: $(t.defaults, n.defaults),
130
+ signServer: j(t.signServer, n.signServer)
131
+ }), Y = (t, n) => ({
132
+ defaults: t.defaults || n.defaults ? {
134
133
  ...t.defaults,
134
+ ...n.defaults,
135
135
  bjca: {
136
- ...n.defaults?.bjca ?? {},
137
- ...t.defaults?.bjca ?? {}
136
+ ...t.defaults?.bjca ?? {},
137
+ ...n.defaults?.bjca ?? {}
138
138
  },
139
139
  kol: {
140
- ...n.defaults?.kol ?? {},
141
- ...t.defaults?.kol ?? {}
140
+ ...t.defaults?.kol ?? {},
141
+ ...n.defaults?.kol ?? {}
142
142
  },
143
143
  plugin: {
144
- ...n.defaults?.plugin ?? {},
145
- ...t.defaults?.plugin ?? {}
144
+ ...t.defaults?.plugin ?? {},
145
+ ...n.defaults?.plugin ?? {}
146
146
  }
147
147
  } : void 0,
148
- signServer: n.signServer || t.signServer ? {
149
- ...n.signServer,
148
+ signServer: t.signServer || n.signServer ? {
150
149
  ...t.signServer,
150
+ ...n.signServer,
151
151
  kol: {
152
- ...n.signServer?.kol ?? {},
153
- ...t.signServer?.kol ?? {}
152
+ ...t.signServer?.kol ?? {},
153
+ ...n.signServer?.kol ?? {}
154
154
  },
155
155
  usbKey: {
156
- ...n.signServer?.usbKey ?? {},
157
- ...t.signServer?.usbKey ?? {}
156
+ ...t.signServer?.usbKey ?? {},
157
+ ...n.signServer?.usbKey ?? {}
158
158
  }
159
159
  } : void 0
160
- }), Q = () => globalThis, k = () => {
161
- const n = Q();
162
- return n[b] || (n[b] = {
163
- current: h(y),
164
- defaults: h(y),
160
+ }), X = () => globalThis, b = () => {
161
+ const t = X();
162
+ return t[S] || (t[S] = {
163
+ current: m(v),
164
+ defaults: m(v),
165
165
  overrides: {}
166
- }), n[b];
167
- }, Ne = () => k().current, Ve = (n) => {
168
- const t = k();
169
- return t.defaults = h(n), t.current = N(t.defaults, t.overrides), t.current;
170
- }, Be = (n) => {
171
- const t = k();
172
- return t.current = h(n), t.overrides = U(n), t.current;
173
- }, xe = (n) => {
174
- const t = k();
175
- return t.overrides = q(t.overrides, U(n)), t.current = N(t.current, n), t.current;
176
- }, Ke = (n) => {
177
- const t = k();
178
- return n && (t.defaults = h(n)), t.overrides = {}, t.current = h(t.defaults), t.current;
179
- }, Ge = {
180
- EDGE_POSITION: w,
181
- RSA_MODE: F,
182
- SIGNATURE_TYPE: _
183
- }, T = (n) => {
184
- if (n.length !== 0)
185
- return n.length === 1 ? n[0] : n;
186
- }, c = (n, t, e) => new Proxy(
166
+ }), t[S];
167
+ }, dt = () => b().current, ut = (t) => {
168
+ const n = b();
169
+ return n.defaults = m(t), n.current = V(n.defaults, n.overrides), n.current;
170
+ }, lt = (t) => {
171
+ const n = b();
172
+ return n.current = m(t), n.overrides = x(t), n.current;
173
+ }, ct = (t) => {
174
+ const n = b();
175
+ return n.overrides = Y(n.overrides, x(t)), n.current = V(n.current, t), n.current;
176
+ }, ht = (t) => {
177
+ const n = b();
178
+ return t && (n.defaults = m(t)), n.overrides = {}, n.current = m(n.defaults), n.current;
179
+ }, gt = {
180
+ EDGE_POSITION: L,
181
+ RSA_MODE: U,
182
+ SIGNATURE_TYPE: F
183
+ }, k = (t) => {
184
+ if (t.length !== 0)
185
+ return t.length === 1 ? t[0] : t;
186
+ }, d = (t, n, e) => new Proxy(
187
187
  {},
188
188
  {
189
189
  get: (i, r) => {
190
190
  if (r === "then")
191
191
  return;
192
192
  if (typeof r == "symbol")
193
- return r === Symbol.toStringTag ? n : void 0;
194
- const a = t[r];
195
- return a ? (...o) => {
193
+ return r === Symbol.toStringTag ? t : void 0;
194
+ const a = n[r];
195
+ return a ? (...s) => {
196
196
  if (a.kind === "callbackRegister") {
197
- a.callback?.(e.callbacks, o);
197
+ a.callback?.(e.callbacks, s);
198
198
  return;
199
199
  }
200
200
  if (a.kind === "stateGetter")
201
- return a.state?.(e.state.snapshot(), o);
202
- const s = a.adapterMethod ?? r;
201
+ return a.state?.(e.state.snapshot(), s);
202
+ const o = a.adapterMethod ?? r;
203
203
  if (a.kind === "query")
204
- return e.bridge.request(n, s, T(o));
204
+ return e.bridge.request(t, o, k(s));
205
205
  if (a.kind === "callbackQuery") {
206
- const l = o.find((d) => typeof d == "function"), m = o.filter((d) => typeof d != "function");
207
- e.bridge.request(n, s, T(m)).then((d) => {
208
- const f = a.mapCallbackResult?.(d) ?? [d];
209
- l?.(...f);
206
+ const c = s.find((h) => typeof h == "function"), l = s.filter((h) => typeof h != "function");
207
+ e.bridge.request(t, o, k(l)).then((h) => {
208
+ const Q = a.mapCallbackResult?.(h) ?? [h];
209
+ c?.(...Q);
210
210
  }).catch(e.onAsyncError);
211
211
  return;
212
212
  }
213
- e.bridge.request(n, s, T(o)).catch(e.onAsyncError);
214
- } : (...o) => {
215
- const s = new Error(`${n}.${r} is not implemented by the SDK adapter.`);
216
- e.onAsyncError(s);
213
+ const u = e.bridge.request(t, o, k(s)).catch((c) => {
214
+ e.onAsyncError(c);
215
+ });
216
+ if (a.returnsResult)
217
+ return u;
218
+ } : (...s) => {
219
+ const o = new Error(`${t}.${r} is not implemented by the SDK adapter.`);
220
+ e.onAsyncError(o);
217
221
  };
218
222
  }
219
223
  }
220
- ), p = (n, t) => new Proxy(
221
- {},
222
- {
223
- get: (e, i) => {
224
- if (i !== "then" && typeof i != "symbol")
225
- return (...r) => {
226
- const a = `${n}.${i} is not implemented by the SDK adapter.`;
227
- t.onAsyncError(new Error(a));
228
- };
224
+ ), J = (t) => typeof t == "object" && t !== null && !Array.isArray(t) && "id" in t, y = (t) => t.annotations?.filter(J).map((n) => ({ ...n })) ?? [], Z = (t) => {
225
+ switch (t) {
226
+ case "select":
227
+ case "pen":
228
+ case "eraser":
229
+ case "line":
230
+ case "arrow":
231
+ case "rectangle":
232
+ case "circle":
233
+ case "text-highlight":
234
+ case "text-underline":
235
+ case "text-strikethrough":
236
+ case "text-squiggly":
237
+ case "text-note":
238
+ case "stamp":
239
+ return t;
240
+ case "none":
241
+ default:
242
+ return "none";
243
+ }
244
+ }, ee = {
245
+ addAnnotationEventCallback: {
246
+ kind: "callbackRegister",
247
+ callback: (t, n) => {
248
+ const e = n[0];
249
+ typeof e == "function" && t.annotationEvents.push(e);
229
250
  }
251
+ },
252
+ isInAnnotationMode: {
253
+ kind: "stateGetter",
254
+ state: (t) => t.annotationEnabled
255
+ },
256
+ getAnnotationMode: {
257
+ kind: "stateGetter",
258
+ state: (t) => Z(t.annotationMode)
259
+ },
260
+ getAnnotations: {
261
+ kind: "stateGetter",
262
+ state: (t) => y(t)
263
+ },
264
+ getAnnotationsCount: {
265
+ kind: "stateGetter",
266
+ state: (t) => y(t).length
267
+ },
268
+ openAnnotationView: { kind: "command" },
269
+ closeAnnotationView: { kind: "command" },
270
+ saveAnnotations: { kind: "callbackQuery" },
271
+ clearAnnotations: { kind: "command", returnsResult: !0 },
272
+ undoAnnotation: { kind: "command", returnsResult: !0 },
273
+ redoAnnotation: { kind: "command", returnsResult: !0 },
274
+ canUndoAnnotation: { kind: "query" },
275
+ canRedoAnnotation: { kind: "query" },
276
+ selectAnnotationTool: { kind: "command" },
277
+ selectAnnotationStamp: { kind: "command" },
278
+ setAnnotationPenColor: { kind: "command" },
279
+ setAnnotationPenWidth: { kind: "command" },
280
+ setAnnotationPenStyle: { kind: "command" }
281
+ };
282
+ class te {
283
+ constructor(n) {
284
+ this.openAnnotationView = (e) => this.adapter.openAnnotationView(e), this.closeAnnotationView = () => this.adapter.closeAnnotationView(), this.saveAnnotations = (e) => this.adapter.saveAnnotations(e), this.clearAnnotations = () => this.adapter.clearAnnotations(), this.undoAnnotation = () => this.adapter.undoAnnotation(), this.redoAnnotation = () => this.adapter.redoAnnotation(), this.canUndoAnnotation = () => this.adapter.canUndoAnnotation(), this.canRedoAnnotation = () => this.adapter.canRedoAnnotation(), this.selectAnnotationTool = (e, i) => this.adapter.selectAnnotationTool(e, i), this.selectAnnotationStamp = (e) => this.adapter.selectAnnotationStamp(e), this.setAnnotationPenColor = (e) => this.adapter.setAnnotationPenColor(e), this.setAnnotationPenWidth = (e) => this.adapter.setAnnotationPenWidth(e), this.setAnnotationPenStyle = (e) => this.adapter.setAnnotationPenStyle(e), this.isInAnnotationMode = () => this.adapter.isInAnnotationMode(), this.getAnnotationMode = () => this.adapter.getAnnotationMode(), this.getAnnotations = () => this.adapter.getAnnotations(), this.getAnnotationsCount = () => this.adapter.getAnnotationsCount(), this.addAnnotationEventCallback = (e) => this.adapter.addAnnotationEventCallback(e), this.adapter = d(
285
+ "annotation",
286
+ ee,
287
+ n
288
+ );
230
289
  }
231
- ), z = {
290
+ }
291
+ const ne = {
292
+ configSecurityProvider: { kind: "command" },
293
+ getSecurityProviders: { kind: "query" }
294
+ };
295
+ class ie {
296
+ constructor(n) {
297
+ this.configSecurityProvider = (e) => this.adapter.configSecurityProvider(e), this.getSecurityProviders = () => this.adapter.getSecurityProviders(), this.adapter = d("crypto", ne, n);
298
+ }
299
+ }
300
+ const E = (t) => t.digitalSignatures ? [...t.digitalSignatures] : [], re = {
301
+ addDigitalSignatureRetrieveCallback: {
302
+ kind: "callbackRegister",
303
+ callback: (t, n) => {
304
+ const e = n[0];
305
+ typeof e == "function" && t.digitalSignatureRetrieve.push(e);
306
+ }
307
+ },
308
+ addDigitalSignatureParseCallback: {
309
+ kind: "callbackRegister",
310
+ callback: (t, n) => {
311
+ const e = n[0];
312
+ typeof e == "function" && t.digitalSignatureParse.push(e);
313
+ }
314
+ },
315
+ addDigitalSignCallback: {
316
+ kind: "callbackRegister",
317
+ callback: (t, n) => {
318
+ const e = n[0];
319
+ typeof e == "function" && t.digitalSign.push(e);
320
+ }
321
+ },
322
+ setCryptoProvider: { kind: "command" },
323
+ setSealSource: { kind: "command" },
324
+ setDefaultStampPassword: { kind: "command" },
325
+ setDefaultSealPassword: { kind: "command" },
326
+ setDefaultKeystorePassword: { kind: "command" },
327
+ setDefaultUSBKeyPassword: { kind: "command" },
328
+ setupExternalSealServer: { kind: "command" },
329
+ setDigitalSignOptions: { kind: "command" },
330
+ setExternalDigitalSignOptions: { kind: "command" },
331
+ setPDFDigitalSignCaptionOptions: { kind: "command" },
332
+ addDigitalSignature: { kind: "callbackQuery" },
333
+ addDigitalSignatureBySelectedSearchHighlight: { kind: "command" },
334
+ listDigitalSignatures: { kind: "callbackQuery" },
335
+ getDigitalSignatures: {
336
+ kind: "stateGetter",
337
+ state: (t) => E(t)
338
+ },
339
+ getDigitalSignaturesCount: {
340
+ kind: "stateGetter",
341
+ state: (t) => E(t).length
342
+ },
343
+ enableDigitalSignatureInfoView: { kind: "command" },
344
+ enableDigitalSignatureRevocation: { kind: "command" }
345
+ };
346
+ class ae {
347
+ constructor(n) {
348
+ this.addDigitalSignatureRetrieveCallback = (e) => this.adapter.addDigitalSignatureRetrieveCallback(e), this.addDigitalSignatureParseCallback = (e) => this.adapter.addDigitalSignatureParseCallback(e), this.setCryptoProvider = (e, i, r) => this.adapter.setCryptoProvider(e, i, r), this.setSealSource = (e) => this.adapter.setSealSource(e), this.setDefaultStampPassword = (e) => this.adapter.setDefaultStampPassword(e), this.setDefaultSealPassword = (e) => this.adapter.setDefaultSealPassword(e), this.setDefaultKeystorePassword = (e) => this.adapter.setDefaultKeystorePassword(e), this.setDefaultUSBKeyPassword = (e) => this.adapter.setDefaultUSBKeyPassword(e), this.addDigitalSignCallback = (e) => this.adapter.addDigitalSignCallback(e), this.setupExternalSealServer = (e) => this.adapter.setupExternalSealServer(e), this.setDigitalSignOptions = (e) => this.adapter.setDigitalSignOptions(e), this.setExternalDigitalSignOptions = (e) => this.adapter.setExternalDigitalSignOptions(e), this.setPDFDigitalSignCaptionOptions = (e) => this.adapter.setPDFDigitalSignCaptionOptions(e), this.addDigitalSignature = (e, i) => this.adapter.addDigitalSignature(e, i), this.addDigitalSignatureBySelectedSearchHighlight = (e) => this.adapter.addDigitalSignatureBySelectedSearchHighlight(e), this.listDigitalSignatures = (e) => this.adapter.listDigitalSignatures(e), this.getDigitalSignatures = () => this.adapter.getDigitalSignatures(), this.getDigitalSignaturesCount = () => this.adapter.getDigitalSignaturesCount(), this.enableDigitalSignatureInfoView = (e) => this.adapter.enableDigitalSignatureInfoView(e), this.enableDigitalSignatureRevocation = (e) => this.adapter.enableDigitalSignatureRevocation(e), this.adapter = d(
349
+ "digitalSign",
350
+ re,
351
+ n
352
+ );
353
+ }
354
+ }
355
+ const se = "rhc-office.editor-adapter", oe = 1, de = "__RHC_OFFICE_EDITOR_ADAPTER__", P = "rhcOfficeAdapterReady", C = "rhcOfficeAdapterEvent", K = "data-rhc-office-reader-id", ue = {
232
356
  addDocumentOpenedCallback: {
233
357
  kind: "callbackRegister",
234
- callback: (n, t) => {
235
- const e = t[0];
236
- typeof e == "function" && n.documentOpened.push(e);
358
+ callback: (t, n) => {
359
+ const e = n[0];
360
+ typeof e == "function" && t.documentOpened.push(e);
237
361
  }
238
362
  },
239
363
  addDocumentSavedCallback: {
240
364
  kind: "callbackRegister",
241
- callback: (n, t) => {
242
- const e = t[0];
243
- typeof e == "function" && n.documentSaved.push(e);
365
+ callback: (t, n) => {
366
+ const e = n[0];
367
+ typeof e == "function" && t.documentSaved.push(e);
244
368
  }
245
369
  },
246
370
  addDocumentClosedCallback: {
247
371
  kind: "callbackRegister",
248
- callback: (n, t) => {
249
- const e = t[0];
250
- typeof e == "function" && n.documentClosed.push(e);
372
+ callback: (t, n) => {
373
+ const e = n[0];
374
+ typeof e == "function" && t.documentClosed.push(e);
251
375
  }
252
376
  },
253
377
  openPDFDocument: { kind: "callbackQuery", adapterMethod: "open" },
@@ -263,83 +387,118 @@ const w = "RIGHT_CENTER", _ = "REGULAR_ESM", F = "auto", b = "__RHC_OFFICE_DIGIT
263
387
  saveAs: { kind: "query" },
264
388
  getDocumentContent: {
265
389
  kind: "callbackQuery",
266
- mapCallbackResult: (n) => {
267
- const t = n;
268
- return [t?.fileCacheId, t?.fileBuffer];
269
- }
390
+ mapCallbackResult: (t) => [t]
270
391
  },
271
392
  closeDocument: { kind: "callbackQuery" },
272
393
  isDocumentOpened: {
273
394
  kind: "stateGetter",
274
- state: (n) => n.documentOpened
395
+ state: (t) => t.documentOpened
275
396
  },
276
397
  isDocumentModified: {
277
398
  kind: "stateGetter",
278
- state: (n) => n.documentModified
399
+ state: (t) => t.documentModified
279
400
  },
280
401
  print: { kind: "command" },
281
402
  createPreview: { kind: "command" }
282
403
  };
283
- class W {
284
- constructor(t) {
285
- this.addDocumentOpenedCallback = (e) => this.adapter.addDocumentOpenedCallback(e), this.addDocumentSavedCallback = (e) => this.adapter.addDocumentSavedCallback(e), this.addDocumentClosedCallback = (e) => this.adapter.addDocumentClosedCallback(e), this.openPDFDocument = (e, i) => this.adapter.openPDFDocument(e, i), this.openPdfDocument = (e, i) => this.adapter.openPdfDocument(e, i), this.openOFDDocument = (e, i) => this.adapter.openOFDDocument(e, i), this.openOfdDocument = (e, i) => this.adapter.openOfdDocument(e, i), this.openOfficeDocument = (e, i) => this.adapter.openOfficeDocument(e, i), this.openImageDocument = (e, i) => this.adapter.openImageDocument(e, i), this.openTextDocument = (e, i) => this.adapter.openTextDocument(e, i), this.openFromLocalStorage = () => this.adapter.openFromLocalStorage(), this.setUploadUrl = (e) => this.adapter.setUploadUrl(e), this.save = (e, i, r) => this.adapter.save(e, i, r), this.saveAs = (e) => this.adapter.saveAs(e), this.getDocumentContent = (e) => this.adapter.getDocumentContent(e), this.closeDocument = (e, i, r) => this.adapter.closeDocument(e, i, r), this.isDocumentOpened = () => this.adapter.isDocumentOpened(), this.isDocumentModified = () => this.adapter.isDocumentModified(), this.print = () => this.adapter.print(), this.createPreview = (e, i) => this.adapter.createPreview(e, i), this.adapter = c(
404
+ class le {
405
+ constructor(n) {
406
+ this.context = n, this.addDocumentOpenedCallback = (e) => this.adapter.addDocumentOpenedCallback(e), this.addDocumentSavedCallback = (e) => this.adapter.addDocumentSavedCallback(e), this.addDocumentClosedCallback = (e) => this.adapter.addDocumentClosedCallback(e), this.openPDFDocument = (e, i) => this.adapter.openPDFDocument(e, i), this.openPdfDocument = (e, i) => this.adapter.openPdfDocument(e, i), this.openOFDDocument = (e, i) => this.adapter.openOFDDocument(e, i), this.openOfdDocument = (e, i) => this.adapter.openOfdDocument(e, i), this.openOfficeDocument = (e, i) => this.adapter.openOfficeDocument(e, i), this.openImageDocument = (e, i) => this.adapter.openImageDocument(e, i), this.openTextDocument = (e, i) => this.adapter.openTextDocument(e, i), this.openFromLocalStorage = () => this.adapter.openFromLocalStorage(), this.setUploadUrl = (e) => this.adapter.setUploadUrl(e), this.save = (e, i, r) => this.adapter.save(e, i, r), this.saveAs = (e) => {
407
+ const i = this.context.bridge.getReaderId();
408
+ if (!i)
409
+ return Promise.resolve({
410
+ success: !1,
411
+ action: "save-as",
412
+ filename: e?.filename,
413
+ error: "Reader is not mounted or does not expose saveAs."
414
+ });
415
+ const r = document.querySelector(
416
+ `[${K}="${i}"]`
417
+ );
418
+ return typeof r?.saveAs == "function" ? r.saveAs(e) : this.adapter.saveAs(e);
419
+ }, this.getDocumentContent = (e) => this.adapter.getDocumentContent(e), this.closeDocument = (e, i, r) => this.adapter.closeDocument(e, i, r), this.isDocumentOpened = () => this.adapter.isDocumentOpened(), this.isDocumentModified = () => this.adapter.isDocumentModified(), this.print = () => this.adapter.print(), this.createPreview = (e, i) => this.adapter.createPreview(e, i), this.adapter = d(
286
420
  "document",
287
- z,
288
- t
421
+ ue,
422
+ n
289
423
  );
290
424
  }
291
425
  }
292
- const $ = {
426
+ const ce = {
293
427
  clearFind: { kind: "command" },
294
428
  findNext: { kind: "command" },
295
429
  findPrevious: { kind: "command" }
296
430
  };
297
- class j {
298
- constructor(t) {
299
- this.clearFind = () => this.adapter.clearFind(), this.findNext = (e) => this.adapter.findNext(e), this.findPrevious = (e) => this.adapter.findPrevious(e), this.adapter = c("find", $, t);
431
+ class he {
432
+ constructor(n) {
433
+ this.clearFind = () => this.adapter.clearFind(), this.findNext = (e) => this.adapter.findNext(e), this.findPrevious = (e) => this.adapter.findPrevious(e), this.adapter = d("find", ce, n);
300
434
  }
301
435
  }
302
- const Y = {
436
+ const ge = {
303
437
  configFileUpload: { kind: "command" },
304
438
  setHttpHeaders: { kind: "command" },
305
439
  setHttpFormFields: { kind: "command" }
306
440
  };
307
- class X {
308
- constructor(t) {
309
- this.configFileUpload = (e) => this.adapter.configFileUpload(e), this.setHttpHeaders = (e) => this.adapter.setHttpHeaders(e), this.setHttpFormFields = (e) => this.adapter.setHttpFormFields(e), this.adapter = c(
441
+ class me {
442
+ constructor(n) {
443
+ this.configFileUpload = (e) => this.adapter.configFileUpload(e), this.setHttpHeaders = (e) => this.adapter.setHttpHeaders(e), this.setHttpFormFields = (e) => this.adapter.setHttpFormFields(e), this.adapter = d(
310
444
  "networking",
311
- Y,
312
- t
445
+ ge,
446
+ n
447
+ );
448
+ }
449
+ }
450
+ const pe = () => ({
451
+ clearContent: { kind: "command", returnsResult: !0 },
452
+ commit: { kind: "command", returnsResult: !0 },
453
+ deletePages: { kind: "command", returnsResult: !0 },
454
+ duplicatePages: { kind: "command", returnsResult: !0 },
455
+ execute: { kind: "command", returnsResult: !0 },
456
+ extractPages: { kind: "command", returnsResult: !0 },
457
+ getSnapshot: { kind: "query" },
458
+ importDocument: { kind: "command", returnsResult: !0 },
459
+ moveAfter: { kind: "command", returnsResult: !0 },
460
+ moveBefore: { kind: "command", returnsResult: !0 },
461
+ newPage: { kind: "command", returnsResult: !0 },
462
+ rotateLeft: { kind: "command", returnsResult: !0 },
463
+ rotateRight: { kind: "command", returnsResult: !0 },
464
+ undo: { kind: "command", returnsResult: !0 }
465
+ }), be = (t) => t instanceof Uint8Array ? t : new Uint8Array(t);
466
+ class Se {
467
+ constructor(n) {
468
+ this.getSnapshot = () => this.adapter.getSnapshot(), this.execute = (e) => this.adapter.execute(e), this.newPage = (e, i) => this.adapter.newPage(e, i), this.deletePages = (e) => this.adapter.deletePages(e), this.duplicatePages = (e, i) => this.adapter.duplicatePages(e, i), this.rotateLeft = (e) => this.adapter.rotateLeft(e), this.rotateRight = (e) => this.adapter.rotateRight(e), this.clearContent = (e) => this.adapter.clearContent(e), this.moveBefore = (e, i) => this.adapter.moveBefore(e, i), this.moveAfter = (e, i) => this.adapter.moveAfter(e, i), this.importDocument = (e, i) => this.adapter.importDocument(be(e), i), this.extractPages = (e, i) => this.adapter.extractPages(e, i), this.undo = () => this.adapter.undo(), this.commit = () => this.adapter.commit(), this.adapter = d(
469
+ "pageArrange",
470
+ pe(),
471
+ n
313
472
  );
314
473
  }
315
474
  }
316
- const J = (n) => ({
475
+ const ke = (t) => ({
317
476
  addPageChangeCallback: {
318
477
  kind: "callbackRegister",
319
- callback: (t, e) => {
478
+ callback: (n, e) => {
320
479
  const i = e[0];
321
- typeof i == "function" && t.pageChange.push(i);
480
+ typeof i == "function" && n.pageChange.push(i);
322
481
  }
323
482
  },
324
483
  addPageModeChangeCallback: {
325
484
  kind: "callbackRegister",
326
- callback: (t, e) => {
485
+ callback: (n, e) => {
327
486
  const i = e[0];
328
- typeof i == "function" && t.pageModeChange.push(i);
487
+ typeof i == "function" && n.pageModeChange.push(i);
329
488
  }
330
489
  },
331
490
  getPageCount: {
332
491
  kind: "callbackRegister",
333
- callback: (t, e) => {
492
+ callback: (n, e) => {
334
493
  const i = e[0];
335
- typeof i == "function" && i(n.state.snapshot().pageCount);
494
+ typeof i == "function" && i(t.state.snapshot().pageCount);
336
495
  }
337
496
  },
338
497
  getPageIndex: {
339
498
  kind: "callbackRegister",
340
- callback: (t, e) => {
499
+ callback: (n, e) => {
341
500
  const i = e[0];
342
- typeof i == "function" && i(n.state.snapshot().pageIndex);
501
+ typeof i == "function" && i(t.state.snapshot().pageIndex);
343
502
  }
344
503
  },
345
504
  setSinglePageViewMode: { kind: "command" },
@@ -363,16 +522,16 @@ const J = (n) => ({
363
522
  gotoPreviousPage: { kind: "command" },
364
523
  rotatePage: { kind: "command" }
365
524
  });
366
- class Z {
367
- constructor(t) {
368
- this.addPageChangeCallback = (e) => this.adapter.addPageChangeCallback(e), this.addPageModeChangeCallback = (e) => this.adapter.addPageModeChangeCallback(e), this.getPageCount = (e) => this.adapter.getPageCount(e), this.getPageIndex = (e) => this.adapter.getPageIndex(e), this.setSinglePageViewMode = () => this.adapter.setSinglePageViewMode(), this.setTwoPagesViewMode = () => this.adapter.setTwoPagesViewMode(), this.setPageScrollVertical = () => this.adapter.setPageScrollVertical(), this.setPageScrollHorizontal = () => this.adapter.setPageScrollHorizontal(), this.setPageCursorPanDrag = () => this.adapter.setPageCursorPanDrag(), this.setPageCursorTextSelect = () => this.adapter.setPageCursorTextSelect(), this.rotateCW = () => this.adapter.rotateCW(), this.rotateCCW = () => this.adapter.rotateCCW(), this.autoFitPage = () => this.adapter.autoFitPage(), this.fitPageSize = () => this.adapter.fitPageSize(), this.fitPageWidth = () => this.adapter.fitPageWidth(), this.fitPageHeight = () => this.adapter.fitPageHeight(), this.increasePageScale = () => this.adapter.increasePageScale(), this.decreasePageScale = () => this.adapter.decreasePageScale(), this.setPageScale = (e) => this.adapter.setPageScale(e), this.setPageBlendColor = (e, i, r, a) => this.adapter.setPageBlendColor(e, i, r, a), this.gotoPage = (e, i, r) => this.adapter.gotoPage(e, i, r), this.gotoNextPage = () => this.adapter.gotoNextPage(), this.gotoPreviousPage = () => this.adapter.gotoPreviousPage(), this.rotatePage = (e) => this.adapter.rotatePage(e), this.adapter = c(
525
+ class fe {
526
+ constructor(n) {
527
+ this.addPageChangeCallback = (e) => this.adapter.addPageChangeCallback(e), this.addPageModeChangeCallback = (e) => this.adapter.addPageModeChangeCallback(e), this.getPageCount = (e) => this.adapter.getPageCount(e), this.getPageIndex = (e) => this.adapter.getPageIndex(e), this.setSinglePageViewMode = () => this.adapter.setSinglePageViewMode(), this.setTwoPagesViewMode = () => this.adapter.setTwoPagesViewMode(), this.setPageScrollVertical = () => this.adapter.setPageScrollVertical(), this.setPageScrollHorizontal = () => this.adapter.setPageScrollHorizontal(), this.setPageCursorPanDrag = () => this.adapter.setPageCursorPanDrag(), this.setPageCursorTextSelect = () => this.adapter.setPageCursorTextSelect(), this.rotateCW = () => this.adapter.rotateCW(), this.rotateCCW = () => this.adapter.rotateCCW(), this.autoFitPage = () => this.adapter.autoFitPage(), this.fitPageSize = () => this.adapter.fitPageSize(), this.fitPageWidth = () => this.adapter.fitPageWidth(), this.fitPageHeight = () => this.adapter.fitPageHeight(), this.increasePageScale = () => this.adapter.increasePageScale(), this.decreasePageScale = () => this.adapter.decreasePageScale(), this.setPageScale = (e) => this.adapter.setPageScale(e), this.setPageBlendColor = (e, i, r, a) => this.adapter.setPageBlendColor(e, i, r, a), this.gotoPage = (e, i, r) => this.adapter.gotoPage(e, i, r), this.gotoNextPage = () => this.adapter.gotoNextPage(), this.gotoPreviousPage = () => this.adapter.gotoPreviousPage(), this.rotatePage = (e) => this.adapter.rotatePage(e), this.adapter = d(
369
528
  "page",
370
- J(t),
371
- t
529
+ ke(n),
530
+ n
372
531
  );
373
532
  }
374
533
  }
375
- const ee = {
534
+ const Re = {
376
535
  open: { kind: "command" },
377
536
  setFormFieldValue: { kind: "command" },
378
537
  setFormFieldReadonly: { kind: "command" },
@@ -386,65 +545,139 @@ const ee = {
386
545
  },
387
546
  toKeyValue: {
388
547
  kind: "callbackQuery",
389
- mapCallbackResult: (n) => [Array.isArray(n) ? n : []]
548
+ mapCallbackResult: (t) => [Array.isArray(t) ? t : []]
390
549
  }
391
550
  };
392
- class te {
393
- constructor(t) {
394
- this.open = () => this.adapter.open(), this.setFormFieldValue = (e, i) => this.adapter.setFormFieldValue(e, i), this.setFormFieldReadonly = (e, i) => this.adapter.setFormFieldReadonly(e, i), this.commit = (e) => this.adapter.commit(e), this.clear = (e) => this.adapter.clear(e), this.toKeyValue = (e) => this.adapter.toKeyValue(e), this.adapter = c(
551
+ class Te {
552
+ constructor(n) {
553
+ this.open = () => this.adapter.open(), this.setFormFieldValue = (e, i) => this.adapter.setFormFieldValue(e, i), this.setFormFieldReadonly = (e, i) => this.adapter.setFormFieldReadonly(e, i), this.commit = (e) => this.adapter.commit(e), this.clear = (e) => this.adapter.clear(e), this.toKeyValue = (e) => this.adapter.toKeyValue(e), this.adapter = d(
395
554
  "pdfFormFiller",
396
- ee,
397
- t
555
+ Re,
556
+ n
398
557
  );
399
558
  }
400
559
  }
401
- const ne = /\s*,\s*/, ie = /\s*-\s*/, E = (n) => {
402
- const t = Number.parseInt(n.trim(), 10);
403
- return !Number.isFinite(t) || t <= 0 ? null : t;
404
- }, re = (n) => {
405
- const t = n.split(ie);
406
- if (t.length === 1) {
407
- const r = E(t[0] ?? "");
560
+ const ve = /\s*,\s*/, ye = /\s*-\s*/, f = (t) => {
561
+ const n = Number.parseInt(t.trim(), 10);
562
+ return !Number.isFinite(n) || n <= 0 ? null : n;
563
+ }, Ee = (t) => {
564
+ const n = t.split(ye);
565
+ if (n.length === 1) {
566
+ const r = f(n[0] ?? "");
408
567
  return r ? [r] : [];
409
568
  }
410
- const e = E(t[0] ?? ""), i = E(t[1] ?? "");
569
+ const e = f(n[0] ?? ""), i = f(n[1] ?? "");
411
570
  return !e || !i || i < e ? [] : Array.from({ length: i - e + 1 }, (r, a) => e + a);
412
- }, ae = (n) => n ? n.split(ne).flatMap((e) => re(e)).filter((e, i, r) => r.indexOf(e) === i) : [];
413
- class oe {
414
- constructor(t, e, i) {
571
+ }, Pe = (t) => t ? t.split(ve).flatMap((e) => Ee(e)).filter((e, i, r) => r.indexOf(e) === i) : [];
572
+ class Ce {
573
+ constructor(n, e, i) {
415
574
  this.setFieldName = (r) => {
416
575
  this.key = r;
417
576
  }, this.setFieldValue = (r) => {
418
577
  this.value = r;
419
578
  }, this.setDescription = (r) => {
420
579
  this.description = r;
421
- }, this.key = t, this.value = e, this.description = i;
580
+ }, this.key = n, this.value = e, this.description = i;
422
581
  }
423
582
  }
424
- class se {
583
+ class De {
425
584
  constructor() {
426
- this.fields = [], this.keywordTextFixedPositions = void 0, this.keywordOffsetX = 0, this.keywordOffsetY = 0, this.bookmarkOffsetX = 0, this.bookmarkOffsetY = 0, this.printMargin = 0, this.grayscaleSealImage = !1, this.signType = 0, this.sealPosition = 0, this.getSignType = () => this.signType, this.setSignType = (t) => {
427
- this.signType = t;
428
- }, this.isCrossPageSideSign = () => this.signType === 2 || this.signType === 3, this.getSealPosition = () => this.sealPosition, this.setSignOnPageSides = (t) => {
429
- t >= 0 && t <= 3 && (this.signType = t);
430
- }, this.setSignPositionOnPageSides = (t) => {
431
- this.sealPosition = t;
432
- }, this.setPageRange = (t) => {
433
- this.pageRange = t;
434
- }, this.getPageRange = () => this.pageRange, this.getPageRanges = () => ae(this.pageRange), this.setSignUserData = (t) => {
435
- this.signUserData = t;
436
- }, this.setPrintMargin = (t) => {
437
- this.printMargin = t;
438
- }, this.getPrintMargin = () => this.printMargin ?? 0, this.setSignReason = (t) => {
439
- this.signReason = t;
440
- }, this.getSignReason = () => this.signReason, this.setSignLocation = (t) => {
441
- this.signLocation = t;
442
- }, this.getSignLocation = () => this.signLocation, this.setDefaultStampPassword = (t) => {
443
- this.defaultStampPassword = t;
585
+ this.fields = [], this.keywordTextFixedPositions = void 0, this.keywordOffsetX = 0, this.keywordOffsetY = 0, this.bookmarkOffsetX = 0, this.bookmarkOffsetY = 0, this.printMargin = 0, this.grayscaleSealImage = !1, this.signType = 0, this.sealPosition = 0, this.getSignType = () => this.signType, this.setSignType = (n) => {
586
+ this.signType = n;
587
+ }, this.isCrossPageSideSign = () => this.signType === 2 || this.signType === 3, this.getSealPosition = () => this.sealPosition, this.setSignOnPageSides = (n) => {
588
+ n >= 0 && n <= 3 && (this.signType = n);
589
+ }, this.setSignPositionOnPageSides = (n) => {
590
+ this.sealPosition = n;
591
+ }, this.setPageRange = (n) => {
592
+ this.pageRange = n;
593
+ }, this.getPageRange = () => this.pageRange, this.getPageRanges = () => Pe(this.pageRange), this.setSignUserData = (n) => {
594
+ this.signUserData = n;
595
+ }, this.setPrintMargin = (n) => {
596
+ this.printMargin = n;
597
+ }, this.getPrintMargin = () => this.printMargin ?? 0, this.setSignReason = (n) => {
598
+ this.signReason = n;
599
+ }, this.getSignReason = () => this.signReason, this.setSignLocation = (n) => {
600
+ this.signLocation = n;
601
+ }, this.getSignLocation = () => this.signLocation, this.setDefaultStampPassword = (n) => {
602
+ this.defaultStampPassword = n;
444
603
  };
445
604
  }
446
605
  }
447
- const de = /* @__PURE__ */ new Set([2, 5]), le = (n) => ({
606
+ const Ae = {
607
+ getSecuritySettings: { kind: "query" },
608
+ isSecuritySettingsLocalEditable: { kind: "query" },
609
+ setSecuritySettingsLocalEditable: { kind: "query" },
610
+ setSecuritySettings: { kind: "query" },
611
+ openSecuritySettingsDialog: { kind: "command" }
612
+ };
613
+ class Me {
614
+ constructor(n) {
615
+ this.getSecuritySettings = () => this.adapter.getSecuritySettings(), this.setSecuritySettings = (e) => this.adapter.setSecuritySettings(e), this.isSecuritySettingsLocalEditable = () => this.adapter.isSecuritySettingsLocalEditable(), this.setSecuritySettingsLocalEditable = (e) => this.adapter.setSecuritySettingsLocalEditable(e), this.openSecuritySettingsDialog = () => this.adapter.openSecuritySettingsDialog(), this.adapter = d(
616
+ "security",
617
+ Ae,
618
+ n
619
+ );
620
+ }
621
+ }
622
+ const we = {
623
+ setSignServer: { kind: "command" },
624
+ addSignServerAuthCallback: {
625
+ kind: "callbackRegister",
626
+ callback: (t, n) => {
627
+ const e = n[0];
628
+ typeof e == "function" && t.signServerAuth.push(e);
629
+ }
630
+ },
631
+ setSignServerDefaultLogin: { kind: "command" },
632
+ setDefaultSignServerLogin: { kind: "command" },
633
+ setSignServerDefaultPassword: { kind: "command" },
634
+ setDefaultSignServerPassword: { kind: "command" },
635
+ loginNTKOSignServer: { kind: "command" },
636
+ loginSignServer: { kind: "callbackQuery" },
637
+ signOutSignServer: { kind: "command" },
638
+ isAuthenticatedOnSignServer: { kind: "stateGetter", state: () => !1 },
639
+ setSignServerLoginFromUSBKey: { kind: "command" },
640
+ setUserAuthSource: { kind: "command" }
641
+ };
642
+ class Ie {
643
+ constructor(n) {
644
+ this.setSignServer = (e) => this.adapter.setSignServer(e), this.addSignServerAuthCallback = (e) => this.adapter.addSignServerAuthCallback(e), this.setSignServerDefaultLogin = (e) => this.adapter.setSignServerDefaultLogin(e), this.setDefaultSignServerLogin = (e) => this.adapter.setDefaultSignServerLogin(e), this.setSignServerDefaultPassword = (e) => this.adapter.setSignServerDefaultPassword(e), this.setDefaultSignServerPassword = (e) => this.adapter.setDefaultSignServerPassword(e), this.loginNTKOSignServer = (e, i, r) => this.adapter.loginNTKOSignServer(e, i, r), this.loginSignServer = (e, i, r, a) => this.adapter.loginSignServer(e, i, r, a), this.signOutSignServer = () => this.adapter.signOutSignServer(), this.isAuthenticatedOnSignServer = () => this.adapter.isAuthenticatedOnSignServer(), this.setSignServerLoginFromUSBKey = (e, i) => this.adapter.setSignServerLoginFromUSBKey(e, i), this.setUserAuthSource = (e) => this.adapter.setUserAuthSource(e), this.adapter = d(
645
+ "signServer",
646
+ we,
647
+ n
648
+ );
649
+ }
650
+ }
651
+ const Oe = {
652
+ createPDF417Barcode: { kind: "command" }
653
+ };
654
+ class _e {
655
+ constructor(n) {
656
+ this.createPDF417Barcode = (e, i, r, a, s, o, u) => this.adapter.createPDF417Barcode(e, i, r, a, s, o, u), this.adapter = d(
657
+ "symbology",
658
+ Oe,
659
+ n
660
+ );
661
+ }
662
+ }
663
+ const Le = {
664
+ setup: { kind: "command" },
665
+ create: { kind: "command" },
666
+ getMarkups: { kind: "callbackQuery" },
667
+ removeMarkup: { kind: "command" },
668
+ removeAllMarkups: { kind: "command" },
669
+ sign: { kind: "callbackQuery" }
670
+ };
671
+ class Fe {
672
+ constructor(n) {
673
+ this.setup = (e) => this.adapter.setup(e), this.create = (e) => this.adapter.create(e), this.getMarkups = (e) => this.adapter.getMarkups(e), this.removeMarkup = (e, i) => this.adapter.removeMarkup(e, i), this.removeAllMarkups = (e) => this.adapter.removeAllMarkups(e), this.sign = (e) => this.adapter.sign(e), this.adapter = d(
674
+ "templateSign",
675
+ Le,
676
+ n
677
+ );
678
+ }
679
+ }
680
+ const Ue = /* @__PURE__ */ new Set([2, 5]), Ne = (t) => ({
448
681
  showToolbarMenu: { kind: "command" },
449
682
  hideToolbarMenu: { kind: "command" },
450
683
  setupToolbarMenu: { kind: "command" },
@@ -459,10 +692,22 @@ const de = /* @__PURE__ */ new Set([2, 5]), le = (n) => ({
459
692
  hideRibbonMenuItem: { kind: "command" },
460
693
  showRibbonTitleBar: { kind: "command" },
461
694
  hideRibbonTitleBar: { kind: "command" },
695
+ showRibbonTabs: { kind: "command" },
696
+ hideRibbonTabs: { kind: "command" },
462
697
  selectRibbonMenu: { kind: "command" },
698
+ setupRibbonMenuTab: { kind: "command" },
699
+ showRibbonMenuTab: { kind: "command" },
700
+ hideRibbonMenuTab: { kind: "command" },
701
+ enableRibbonMenuTab: { kind: "command" },
702
+ disableRibbonMenuTab: { kind: "command" },
703
+ setupRibbonMenuItemState: { kind: "command" },
704
+ enableRibbonMenuItem: { kind: "command" },
705
+ disableRibbonMenuItem: { kind: "command" },
463
706
  setRibbonMenuButtonStyle: { kind: "command" },
464
707
  setWatermark: { kind: "command" },
465
708
  setCompactMode: { kind: "command" },
709
+ setRulerVisible: { kind: "command" },
710
+ toggleSidebar: { kind: "command" },
466
711
  enterBookViewMode: {
467
712
  kind: "callbackQuery",
468
713
  mapCallbackResult: () => []
@@ -470,133 +715,141 @@ const de = /* @__PURE__ */ new Set([2, 5]), le = (n) => ({
470
715
  exitBookViewMode: { kind: "command" },
471
716
  isBookViewActivated: {
472
717
  kind: "stateGetter",
473
- state: () => de.has(n.state.snapshot().pageMode)
718
+ state: () => Ue.has(t.state.snapshot().pageMode)
474
719
  },
475
720
  requestFullScreen: { kind: "command" },
476
721
  exitFullScreen: { kind: "command" },
477
722
  invalidateView: { kind: "command" }
478
723
  });
479
- class ce {
480
- constructor(t) {
481
- this.showToolbarMenu = () => this.adapter.showToolbarMenu(), this.hideToolbarMenu = () => this.adapter.hideToolbarMenu(), this.setupToolbarMenu = (e) => this.adapter.setupToolbarMenu(e), this.showToolbarMenuItem = (e) => this.adapter.showToolbarMenuItem(e), this.hideToolbarMenuItem = (e) => this.adapter.hideToolbarMenuItem(e), this.setupRibbonMenu = (e) => this.adapter.setupRibbonMenu(e), this.setupRibbonMenuItem = (e, i, r) => this.adapter.setupRibbonMenuItem(e, i, r), this.setupRibbonTitleBar = (e) => this.adapter.setupRibbonTitleBar(e), this.showRibbonMenu = () => this.adapter.showRibbonMenu(), this.hideRibbonMenu = () => this.adapter.hideRibbonMenu(), this.showRibbonMenuItem = (e, i) => this.adapter.showRibbonMenuItem(e, i), this.hideRibbonMenuItem = (e, i) => this.adapter.hideRibbonMenuItem(e, i), this.showRibbonTitleBar = () => this.adapter.showRibbonTitleBar(), this.hideRibbonTitleBar = () => this.adapter.hideRibbonTitleBar(), this.selectRibbonMenu = (e) => this.adapter.selectRibbonMenu(e), this.setRibbonMenuButtonStyle = (e, i) => this.adapter.setRibbonMenuButtonStyle(e, i), this.setWatermark = (e) => this.adapter.setWatermark(e), this.setCompactMode = (e) => this.adapter.setCompactMode(e), this.enterBookViewMode = (e) => this.adapter.enterBookViewMode(e), this.exitBookViewMode = () => this.adapter.exitBookViewMode(), this.isBookViewActivated = () => this.adapter.isBookViewActivated(), this.requestFullScreen = () => this.adapter.requestFullScreen(), this.exitFullScreen = () => this.adapter.exitFullScreen(), this.invalidateView = () => this.adapter.invalidateView(), this.adapter = c("ui", le(t), t);
724
+ class Be {
725
+ constructor(n) {
726
+ this.showToolbarMenu = () => (this.warnLegacyRibbonMethod("showToolbarMenu", "showRibbonMenu"), this.showRibbonMenu()), this.hideToolbarMenu = () => (this.warnLegacyRibbonMethod("hideToolbarMenu", "hideRibbonMenu"), this.hideRibbonMenu()), this.setupToolbarMenu = (e) => (this.warnLegacyRibbonMethod(
727
+ "setupToolbarMenu",
728
+ "showRibbonMenu/hideRibbonMenu/setupRibbonMenuTab"
729
+ ), this.setupRibbonMenu(e)), this.showToolbarMenuItem = (e) => (this.warnLegacyRibbonMethod("showToolbarMenuItem", "showRibbonMenuItem"), this.showRibbonMenuItem(e)), this.hideToolbarMenuItem = (e) => (this.warnLegacyRibbonMethod("hideToolbarMenuItem", "hideRibbonMenuItem"), this.hideRibbonMenuItem(e)), this.setupRibbonMenu = (e) => (this.warnLegacyRibbonMethod(
730
+ "setupRibbonMenu",
731
+ "showRibbonMenu/hideRibbonMenu/setupRibbonMenuTab"
732
+ ), typeof e == "boolean" ? e ? this.showRibbonMenu() : this.hideRibbonMenu() : this.setupRibbonMenuTab(e.menu, { visible: e.visible })), this.setupRibbonMenuItem = (e, i, r) => (this.warnLegacyRibbonMethod("setupRibbonMenuItem", "setupRibbonMenuItemState"), this.setupRibbonMenuItemState(e, { visible: i, config: r })), this.setupRibbonTitleBar = (e) => (this.warnLegacyRibbonMethod("setupRibbonTitleBar", "showRibbonTabs/hideRibbonTabs"), e ? this.showRibbonTabs() : this.hideRibbonTabs()), this.showRibbonMenu = () => this.adapter.showRibbonMenu(), this.hideRibbonMenu = () => this.adapter.hideRibbonMenu(), this.showRibbonMenuItem = (e, i) => (this.warnLegacyRibbonMethod("showRibbonMenuItem", "setupRibbonMenuItemState"), this.setupRibbonMenuItemState(e, { visible: !0, config: i })), this.hideRibbonMenuItem = (e, i) => (this.warnLegacyRibbonMethod("hideRibbonMenuItem", "setupRibbonMenuItemState"), this.setupRibbonMenuItemState(e, { visible: !1, config: i })), this.showRibbonTitleBar = () => (this.warnLegacyRibbonMethod("showRibbonTitleBar", "showRibbonTabs"), this.showRibbonTabs()), this.hideRibbonTitleBar = () => (this.warnLegacyRibbonMethod("hideRibbonTitleBar", "hideRibbonTabs"), this.hideRibbonTabs()), this.showRibbonTabs = () => this.adapter.showRibbonTabs(), this.hideRibbonTabs = () => this.adapter.hideRibbonTabs(), this.selectRibbonMenu = (e) => this.adapter.selectRibbonMenu(e), this.setupRibbonMenuTab = (e, i) => this.adapter.setupRibbonMenuTab(e, i), this.showRibbonMenuTab = (e) => this.adapter.showRibbonMenuTab(e), this.hideRibbonMenuTab = (e) => this.adapter.hideRibbonMenuTab(e), this.enableRibbonMenuTab = (e) => this.adapter.enableRibbonMenuTab(e), this.disableRibbonMenuTab = (e) => this.adapter.disableRibbonMenuTab(e), this.setupRibbonMenuItemState = (e, i) => this.adapter.setupRibbonMenuItemState(e, i), this.enableRibbonMenuItem = (e, i) => this.setupRibbonMenuItemState(e, { disabled: !1, config: i }), this.disableRibbonMenuItem = (e, i) => this.setupRibbonMenuItemState(e, { disabled: !0, config: i }), this.setRibbonMenuButtonStyle = (e, i) => this.adapter.setRibbonMenuButtonStyle(e, i), this.setWatermark = (e) => this.adapter.setWatermark(e), this.setCompactMode = (e) => this.adapter.setCompactMode(e), this.setRulerVisible = (e) => this.adapter.setRulerVisible(e), this.toggleSidebar = () => this.adapter.toggleSidebar(), this.enterBookViewMode = (e) => this.adapter.enterBookViewMode(e), this.exitBookViewMode = () => this.adapter.exitBookViewMode(), this.isBookViewActivated = () => this.adapter.isBookViewActivated(), this.requestFullScreen = () => this.adapter.requestFullScreen(), this.exitFullScreen = () => this.adapter.exitFullScreen(), this.invalidateView = () => this.adapter.invalidateView(), this.adapter = d("ui", Ne(n), n);
733
+ }
734
+ warnLegacyRibbonMethod(n, e) {
735
+ console.warn(`[RHC Office SDK] ui.${n} is deprecated. Use ui.${e} instead.`);
482
736
  }
483
737
  }
484
- const ue = (n) => {
485
- if (!n)
738
+ const xe = (t) => {
739
+ if (!t)
486
740
  return;
487
- const t = n.trim().toLowerCase();
488
- if (t === "application")
741
+ const n = t.trim().toLowerCase();
742
+ if (n === "application")
489
743
  return "auto";
490
- if (t === "light" || t === "dark" || t === "high-contrast" || t === "auto")
491
- return t;
492
- }, V = (n) => {
493
- const t = new URL(n, globalThis.location?.href ?? "http://localhost/");
494
- return t.hash = "", t.pathname.endsWith("/") || (t.pathname = `${t.pathname}/`), t.toString();
495
- }, he = (n) => new URL("editors.bootstrap.js", n).toString(), me = (n, t) => {
496
- const e = V(n);
744
+ if (n === "light" || n === "dark" || n === "high-contrast" || n === "auto")
745
+ return n;
746
+ }, G = (t) => {
747
+ const n = new URL(t, globalThis.location?.href ?? "http://localhost/");
748
+ return n.hash = "", n.pathname.endsWith("/") || (n.pathname = `${n.pathname}/`), n.toString();
749
+ }, Ve = (t) => new URL("editors.bootstrap.js", t).toString(), Ke = (t, n) => {
750
+ const e = G(t);
497
751
  return {
498
- ...t,
752
+ ...n,
499
753
  appUrl: e,
500
- scrollIntoView: t.scrollIntoView ?? !0,
501
- theme: ue(t.theme)
754
+ theme: xe(n.theme)
502
755
  };
503
- }, u = "rhc-office-editor", R = "__RHC_OFFICE_SDK_READER_LOADER__", B = () => {
504
- const n = globalThis;
505
- return n[R] || (n[R] = {
756
+ }, g = "rhc-office-editor", R = "__RHC_OFFICE_SDK_READER_LOADER__", q = () => {
757
+ const t = globalThis;
758
+ return t[R] || (t[R] = {
506
759
  activeAppUrl: null,
507
760
  loadPromises: /* @__PURE__ */ new Map()
508
- }), n[R];
509
- }, pe = (n) => Array.from(document.querySelectorAll("script")).find((t) => t.src === n) ?? null;
510
- class S extends Error {
511
- constructor(t) {
512
- super(`Failed to load reader bootstrap script: ${t}`), this.name = "ReaderScriptLoadError";
761
+ }), t[R];
762
+ }, Ge = (t) => Array.from(document.querySelectorAll("script")).find((n) => n.src === t) ?? null;
763
+ class D extends Error {
764
+ constructor(n) {
765
+ super(`Failed to load reader bootstrap script: ${n}`), this.name = "ReaderScriptLoadError";
513
766
  }
514
767
  }
515
- class ge extends Error {
516
- constructor(t, e) {
768
+ class qe extends Error {
769
+ constructor(n, e) {
517
770
  super(
518
- `Reader Web Component "${u}" is already bound to ${t} and cannot be reloaded from ${e}.`
771
+ `Reader Web Component "${g}" is already bound to ${n} and cannot be reloaded from ${e}.`
519
772
  ), this.name = "ReaderSourceConflictError";
520
773
  }
521
774
  }
522
- const x = (n) => {
523
- const t = B();
524
- if (t.activeAppUrl && t.activeAppUrl !== n)
525
- throw new ge(t.activeAppUrl, n);
526
- }, ke = (n) => {
527
- const t = B();
528
- x(n);
529
- const e = t.loadPromises.get(n);
775
+ const H = (t) => {
776
+ const n = q();
777
+ if (n.activeAppUrl && n.activeAppUrl !== t)
778
+ throw new qe(n.activeAppUrl, t);
779
+ }, He = (t) => {
780
+ const n = q();
781
+ H(t);
782
+ const e = n.loadPromises.get(t);
530
783
  if (e)
531
784
  return e;
532
- if (globalThis.customElements?.get(u)) {
533
- t.activeAppUrl = n;
534
- const o = Promise.resolve();
535
- return t.loadPromises.set(n, o), o;
785
+ if (globalThis.customElements?.get(g)) {
786
+ n.activeAppUrl = t;
787
+ const s = Promise.resolve();
788
+ return n.loadPromises.set(t, s), s;
536
789
  }
537
- const i = he(n), r = pe(i);
538
- t.activeAppUrl = n;
539
- const a = new Promise((o, s) => {
540
- const l = (f) => {
541
- f?.remove(), s(new S(i));
542
- }, m = () => {
543
- globalThis.customElements.whenDefined(u).then(() => {
544
- o();
545
- }).catch(s);
790
+ const i = Ve(t), r = Ge(i);
791
+ n.activeAppUrl = t;
792
+ const a = new Promise((s, o) => {
793
+ const u = (h) => {
794
+ h?.remove(), o(new D(i));
795
+ }, c = () => {
796
+ globalThis.customElements.whenDefined(g).then(() => {
797
+ s();
798
+ }).catch(o);
546
799
  };
547
800
  if (r) {
548
- if (globalThis.customElements?.get(u)) {
549
- o();
801
+ if (globalThis.customElements?.get(g)) {
802
+ s();
550
803
  return;
551
804
  }
552
805
  r.addEventListener(
553
806
  "error",
554
- () => s(new S(i)),
807
+ () => o(new D(i)),
555
808
  {
556
809
  once: !0
557
810
  }
558
- ), m();
811
+ ), c();
559
812
  return;
560
813
  }
561
- const d = document.createElement("script");
562
- d.src = i, d.async = !0, d.dataset.rhcOfficeSdkReader = n, d.addEventListener("load", m, { once: !0 }), d.addEventListener("error", () => l(d), { once: !0 }), document.head.appendChild(d);
563
- }).catch((o) => {
564
- throw t.loadPromises.delete(n), !globalThis.customElements?.get(u) && t.activeAppUrl === n && (t.activeAppUrl = null), o;
814
+ const l = document.createElement("script");
815
+ l.src = i, l.async = !0, l.dataset.rhcOfficeSdkReader = t, l.addEventListener("load", c, { once: !0 }), l.addEventListener("error", () => u(l), { once: !0 }), document.head.appendChild(l);
816
+ }).catch((s) => {
817
+ throw n.loadPromises.delete(t), !globalThis.customElements?.get(g) && n.activeAppUrl === t && (n.activeAppUrl = null), s;
565
818
  });
566
- return t.loadPromises.set(n, a), a;
567
- }, fe = "rhc-office.editor-adapter", be = 1, Te = "__RHC_OFFICE_EDITOR_ADAPTER__", P = "rhcOfficeAdapterReady", C = "rhcOfficeAdapterEvent", Ee = "data-rhc-office-reader-id", Re = 5e3, ve = 5e3, ye = () => {
568
- const n = globalThis.crypto;
569
- return typeof n?.randomUUID == "function" ? n.randomUUID() : `adapter-${Date.now()}-${Math.random().toString(36).slice(2)}`;
570
- }, g = () => globalThis[Te];
571
- class Se extends Error {
572
- constructor(t, e, i) {
573
- super(e), this.name = "ReaderBridgeError", this.code = t, this.details = i;
819
+ return n.loadPromises.set(t, a), a;
820
+ }, ze = 5e3, Qe = 5e3, We = () => {
821
+ const t = globalThis.crypto;
822
+ return typeof t?.randomUUID == "function" ? t.randomUUID() : `adapter-${Date.now()}-${Math.random().toString(36).slice(2)}`;
823
+ }, p = () => globalThis[de];
824
+ class $e extends Error {
825
+ constructor(n, e, i) {
826
+ super(e), this.name = "ReaderBridgeError", this.code = n, this.details = i;
574
827
  }
575
828
  }
576
- class Pe {
577
- constructor(t) {
578
- this.readerId = null, this.readyTimeoutMs = t?.readyTimeoutMs ?? ve, this.requestTimeoutMs = t?.requestTimeoutMs ?? Re;
829
+ class je {
830
+ constructor(n) {
831
+ this.readerId = null, this.readyTimeoutMs = n?.readyTimeoutMs ?? Qe, this.requestTimeoutMs = n?.requestTimeoutMs ?? ze;
579
832
  }
580
- configureTimeouts(t) {
581
- this.readyTimeoutMs = t?.readyTimeoutMs ?? this.readyTimeoutMs, this.requestTimeoutMs = t?.requestTimeoutMs ?? this.requestTimeoutMs;
833
+ configureTimeouts(n) {
834
+ this.readyTimeoutMs = n?.readyTimeoutMs ?? this.readyTimeoutMs, this.requestTimeoutMs = n?.requestTimeoutMs ?? this.requestTimeoutMs;
582
835
  }
583
- setReaderId(t) {
584
- this.readerId = t;
836
+ setReaderId(n) {
837
+ this.readerId = n;
585
838
  }
586
839
  getReaderId() {
587
840
  return this.readerId;
588
841
  }
589
- async request(t, e, i, r) {
590
- const a = await this.requestRaw(t, e, i, r);
842
+ async request(n, e, i, r) {
843
+ const a = await this.requestRaw(n, e, i, r);
591
844
  if (a.ok)
592
845
  return a.result;
593
- throw new Se(
846
+ throw new $e(
594
847
  a.error.code,
595
848
  a.error.message,
596
849
  a.error.details
597
850
  );
598
851
  }
599
- async requestRaw(t, e, i, r) {
852
+ async requestRaw(n, e, i, r) {
600
853
  if (!this.readerId)
601
854
  return {
602
855
  ok: !1,
@@ -616,42 +869,45 @@ class Pe {
616
869
  message: "Editor adapter is not available."
617
870
  }
618
871
  };
619
- const o = {
620
- protocol: fe,
621
- version: be,
622
- requestId: ye(),
872
+ const s = {
873
+ protocol: se,
874
+ version: oe,
875
+ requestId: We(),
623
876
  readerId: this.readerId,
624
- tool: t,
877
+ tool: n,
625
878
  method: e,
626
879
  params: i
627
880
  };
628
881
  return this.withTimeout(
629
- a.request(o),
630
- o.requestId,
882
+ a.request(s),
883
+ s.requestId,
631
884
  r?.timeoutMs ?? this.requestTimeoutMs
632
885
  );
633
886
  }
634
887
  getCapabilities() {
635
- return this.readerId ? g()?.getCapabilities(this.readerId) ?? null : null;
888
+ return this.readerId ? p()?.getCapabilities(this.readerId) ?? null : null;
889
+ }
890
+ async waitForReady(n) {
891
+ return this.readerId ? !!await this.waitForAdapter(this.readerId, n?.timeoutMs) : !1;
636
892
  }
637
- async waitForAdapter(t, e = this.readyTimeoutMs) {
638
- const i = g();
639
- return i?.getCapabilities(t) ? i : new Promise((r) => {
893
+ async waitForAdapter(n, e = this.readyTimeoutMs) {
894
+ const i = p();
895
+ return i?.getCapabilities(n) ? i : new Promise((r) => {
640
896
  let a;
641
- const o = () => {
642
- a && clearTimeout(a), globalThis.removeEventListener(P, s);
643
- }, s = (l) => {
644
- if ((l instanceof CustomEvent ? l.detail : void 0)?.readerId !== t)
897
+ const s = () => {
898
+ a && clearTimeout(a), globalThis.removeEventListener(P, o);
899
+ }, o = (u) => {
900
+ if ((u instanceof CustomEvent ? u.detail : void 0)?.readerId !== n)
645
901
  return;
646
- const d = g();
647
- o(), r(d ?? null);
902
+ const l = p();
903
+ s(), r(l ?? null);
648
904
  };
649
- globalThis.addEventListener(P, s), a = setTimeout(() => {
650
- o(), r(g()?.getCapabilities(t) ? g() : null);
905
+ globalThis.addEventListener(P, o), a = setTimeout(() => {
906
+ s(), r(p()?.getCapabilities(n) ? p() : null);
651
907
  }, e);
652
908
  });
653
909
  }
654
- async withTimeout(t, e, i) {
910
+ async withTimeout(n, e, i) {
655
911
  return new Promise((r) => {
656
912
  const a = setTimeout(() => {
657
913
  r({
@@ -663,13 +919,13 @@ class Pe {
663
919
  }
664
920
  });
665
921
  }, i);
666
- t.then((o) => r(o)).catch((o) => {
922
+ n.then((s) => r(s)).catch((s) => {
667
923
  r({
668
924
  ok: !1,
669
925
  requestId: e,
670
926
  error: {
671
927
  code: "EXECUTION_FAILED",
672
- message: o instanceof Error ? o.message : String(o)
928
+ message: s instanceof Error ? s.message : String(s)
673
929
  }
674
930
  });
675
931
  }).finally(() => {
@@ -687,39 +943,68 @@ const A = {
687
943
  pageMode: 0,
688
944
  zoomLevel: 100
689
945
  };
690
- class Ce {
946
+ class Ye {
691
947
  constructor() {
692
948
  this.state = { ...A };
693
949
  }
694
950
  reset() {
695
951
  this.state = { ...A };
696
952
  }
697
- update(t) {
698
- t && (this.state = {
953
+ update(n) {
954
+ n && (this.state = {
699
955
  ...this.state,
700
- ...t
956
+ ...n,
957
+ annotations: n.annotations ? [...n.annotations] : this.state.annotations,
958
+ digitalSignatures: n.digitalSignatures ? [...n.digitalSignatures] : this.state.digitalSignatures
701
959
  });
702
960
  }
703
- setDocumentOpened(t) {
961
+ setDocumentOpened(n) {
704
962
  this.state = {
705
963
  ...this.state,
706
- documentOpened: t
964
+ documentOpened: n
707
965
  };
708
966
  }
709
967
  snapshot() {
710
- return { ...this.state };
968
+ return {
969
+ ...this.state,
970
+ annotations: this.state.annotations ? [...this.state.annotations] : void 0,
971
+ digitalSignatures: this.state.digitalSignatures ? [...this.state.digitalSignatures] : void 0
972
+ };
711
973
  }
712
974
  }
713
- class Ae {
975
+ const Xe = (t) => typeof t == "object" && t !== null && !Array.isArray(t) ? t : void 0, z = (t) => typeof t == "object" && t !== null && !Array.isArray(t), M = (t) => {
976
+ if (!z(t))
977
+ return;
978
+ const n = {};
979
+ return typeof t.currentPage == "number" && (n.currentPage = t.currentPage), typeof t.documentType == "string" && (n.documentType = t.documentType), typeof t.totalPages == "number" ? n.totalPages = t.totalPages : typeof t.pageCount == "number" && (n.totalPages = t.pageCount), typeof t.zoomLevel == "number" && (n.zoomLevel = t.zoomLevel), Object.keys(n).length > 0 ? n : void 0;
980
+ }, Je = (t) => {
981
+ if (!z(t))
982
+ return {
983
+ success: !0,
984
+ status: "ok"
985
+ };
986
+ const n = M(t.state), e = M(t), i = typeof t.error == "string" ? t.error : void 0, r = typeof t.success == "boolean" ? t.success : !i, a = typeof t.status == "string" ? t.status : r ? "ok" : "error";
987
+ return {
988
+ success: r,
989
+ status: a,
990
+ error: i,
991
+ state: n ?? e
992
+ };
993
+ };
994
+ class Ze {
714
995
  constructor() {
715
- this.annotationEvents = [], this.annotationPersist = [], this.annotationRetrieve = [], this.digitalAnnotationRetrieve = [], this.digitalSignatureParse = [], this.digitalSignatureRetrieve = [], this.documentClosed = [], this.documentOpened = [], this.documentSaved = [], this.pageChange = [], this.pageModeChange = [];
996
+ this.annotationEvents = [], this.annotationPersist = [], this.annotationRetrieve = [], this.digitalAnnotationRetrieve = [], this.digitalSign = [], this.digitalSignatureParse = [], this.digitalSignatureRetrieve = [], this.documentClosed = [], this.documentOpened = [], this.documentSaved = [], this.pageChange = [], this.pageModeChange = [], this.signServerAuth = [];
716
997
  }
717
- emit(t, e) {
718
- switch (t) {
998
+ emit(n, e) {
999
+ switch (n) {
719
1000
  case "documentOpened":
720
- case "documentLoaded":
721
- this.documentOpened.forEach((i) => i("ok", ""));
1001
+ case "documentLoaded": {
1002
+ const i = Je(e);
1003
+ this.documentOpened.forEach(
1004
+ (r) => r(i.status ?? "ok", i.error ?? "", i)
1005
+ );
722
1006
  return;
1007
+ }
723
1008
  case "documentSaved":
724
1009
  this.documentSaved.forEach((i) => i(e));
725
1010
  return;
@@ -741,7 +1026,10 @@ class Ae {
741
1026
  case "annotationEvent": {
742
1027
  const i = e;
743
1028
  this.annotationEvents.forEach(
744
- (r) => r(i.event ?? "annotationEvent", i.payload)
1029
+ (r) => r(
1030
+ i.event ?? "annotationEvent",
1031
+ Xe(i.payload)
1032
+ )
745
1033
  );
746
1034
  return;
747
1035
  }
@@ -756,6 +1044,9 @@ class Ae {
756
1044
  (i) => i(Array.isArray(e) ? e : [])
757
1045
  );
758
1046
  return;
1047
+ case "digitalSign":
1048
+ this.digitalSign.forEach((i) => i(e));
1049
+ return;
759
1050
  case "digitalSignatureRetrieve":
760
1051
  this.digitalSignatureRetrieve.forEach(
761
1052
  (i) => i(Array.isArray(e) ? e : [])
@@ -766,96 +1057,88 @@ class Ae {
766
1057
  (i) => i(Array.isArray(e) ? e : [])
767
1058
  );
768
1059
  return;
1060
+ case "signServerAuth":
1061
+ this.signServerAuth.forEach((i) => i(e));
1062
+ return;
769
1063
  default:
770
1064
  return;
771
1065
  }
772
1066
  }
773
1067
  }
774
- const De = [
1068
+ const et = [
775
1069
  "documentLoaded",
776
1070
  "documentStateChange",
777
1071
  "documentError"
778
- ], Me = "readerReady", Ie = "readerUnload", v = "readerError", we = () => typeof globalThis.crypto?.randomUUID == "function" ? globalThis.crypto.randomUUID() : `rhc-reader-${Date.now()}-${Math.random().toString(36).slice(2)}`, D = (n, t) => ({
779
- appUrl: t?.appUrl ?? null,
780
- configuration: t,
781
- element: n
782
- }), _e = (n) => {
783
- if (typeof n == "string") {
784
- const t = document.getElementById(n);
785
- if (!t)
786
- throw new Error(`Reader container "${n}" was not found.`);
787
- if (!(t instanceof HTMLDivElement))
788
- throw new Error(`Reader container "${n}" must be a div element.`);
789
- return t;
1072
+ ], tt = "readerReady", nt = "readerUnload", T = "readerError", it = () => typeof globalThis.crypto?.randomUUID == "function" ? globalThis.crypto.randomUUID() : `rhc-reader-${Date.now()}-${Math.random().toString(36).slice(2)}`, w = (t, n) => ({
1073
+ appUrl: n?.appUrl ?? null,
1074
+ configuration: n,
1075
+ element: t
1076
+ }), rt = (t) => {
1077
+ if (typeof t == "string") {
1078
+ const n = document.getElementById(t);
1079
+ if (!n)
1080
+ throw new Error(`Reader container "${t}" was not found.`);
1081
+ if (!(n instanceof HTMLDivElement))
1082
+ throw new Error(`Reader container "${t}" must be a div element.`);
1083
+ return n;
790
1084
  }
791
- if (!(n instanceof HTMLDivElement))
1085
+ if (!(t instanceof HTMLDivElement))
792
1086
  throw new Error("Reader container must be a div element.");
793
- return n;
794
- }, Fe = () => {
795
- const n = typeof globalThis.matchMedia == "function";
796
- return (n ? globalThis.matchMedia("(prefers-contrast: more)").matches : !1) ? "high-contrast" : (n ? globalThis.matchMedia("(prefers-color-scheme: dark)").matches : !1) ? "dark" : "light";
797
- }, M = (n, t) => {
798
- const e = n;
1087
+ return t;
1088
+ }, at = () => {
1089
+ const t = typeof globalThis.matchMedia == "function";
1090
+ return (t ? globalThis.matchMedia("(prefers-contrast: more)").matches : !1) ? "high-contrast" : (t ? globalThis.matchMedia("(prefers-color-scheme: dark)").matches : !1) ? "dark" : "light";
1091
+ }, I = (t, n) => {
1092
+ const e = t;
799
1093
  if (typeof e.addEventListener == "function") {
800
- e.addEventListener("change", t);
1094
+ e.addEventListener("change", n);
801
1095
  return;
802
1096
  }
803
- typeof e.addListener == "function" && e.addListener(t);
804
- }, I = (n, t) => {
805
- const e = n;
1097
+ typeof e.addListener == "function" && e.addListener(n);
1098
+ }, O = (t, n) => {
1099
+ const e = t;
806
1100
  if (typeof e.removeEventListener == "function") {
807
- e.removeEventListener("change", t);
1101
+ e.removeEventListener("change", n);
808
1102
  return;
809
1103
  }
810
- typeof e.removeListener == "function" && e.removeListener(t);
811
- }, Oe = (n, t) => {
812
- t.style && (n.style.cssText = t.style), n.style.display || (n.style.display = "block"), n.style.width ? t.width && (n.style.width = t.width) : n.style.width = t.width ?? "100%", n.style.height ? t.height && (n.style.height = t.height) : n.style.height = t.height ?? "100%";
813
- }, Le = (n, t) => {
814
- const e = t.theme;
1104
+ typeof e.removeListener == "function" && e.removeListener(n);
1105
+ }, st = (t) => {
1106
+ t.style.display || (t.style.display = "block"), t.style.width || (t.style.width = "100%"), t.style.height || (t.style.height = "100%");
1107
+ }, _ = (t, n) => {
1108
+ const e = n;
815
1109
  if (!e)
816
- return n.removeAttribute("theme"), null;
1110
+ return t.removeAttribute("theme"), null;
817
1111
  if (e !== "auto")
818
- return n.setAttribute("theme", e), null;
1112
+ return t.setAttribute("theme", e), null;
819
1113
  const i = () => {
820
- n.setAttribute("theme", Fe());
1114
+ t.setAttribute("theme", at());
821
1115
  };
822
1116
  if (i(), typeof globalThis.matchMedia != "function")
823
1117
  return null;
824
- const r = globalThis.matchMedia("(prefers-color-scheme: dark)"), a = globalThis.matchMedia("(prefers-contrast: more)"), o = () => {
1118
+ const r = globalThis.matchMedia("(prefers-color-scheme: dark)"), a = globalThis.matchMedia("(prefers-contrast: more)"), s = () => {
825
1119
  i();
826
1120
  };
827
- return M(r, o), M(a, o), () => {
828
- I(r, o), I(a, o);
1121
+ return I(r, s), I(a, s), () => {
1122
+ O(r, s), O(a, s);
829
1123
  };
830
1124
  };
831
- class Ue {
832
- constructor(t) {
833
- this.bridge = new Pe(), this.callbacks = new Ae(), this.readerState = new Ce(), this.bridgeToolContext = {
1125
+ class ot {
1126
+ constructor(n) {
1127
+ this.bridge = new je(), this.callbacks = new Ze(), this.readerState = new Ye(), this.bridgeToolContext = {
834
1128
  bridge: this.bridge,
835
1129
  callbacks: this.callbacks,
836
1130
  debug: () => this.debugEnabled,
837
1131
  onAsyncError: (e) => this.reportAdapterError(e),
838
1132
  state: this.readerState
839
- }, this.documentTool = new W(this.bridgeToolContext), this.uiTool = new ce(this.bridgeToolContext), this.pageTool = new Z(this.bridgeToolContext), this.findTool = new j(this.bridgeToolContext), this.signServerTool = p(
840
- "signServer",
841
- this.bridgeToolContext
842
- ), this.digitalSignTool = p(
843
- "digitalSign",
844
- this.bridgeToolContext
845
- ), this.symbologyTool = p(
846
- "symbology",
847
- this.bridgeToolContext
848
- ), this.annotationTool = this.createAnnotationTool(), this.templateSignTool = p(
849
- "templateSign",
850
- this.bridgeToolContext
851
- ), this.pdfFormFiller = new te(this.bridgeToolContext), this.networkingTool = new X(this.bridgeToolContext), this.cryptoTool = p(
852
- "crypto",
853
- this.bridgeToolContext
854
- ), this.readyCallbacks = [], this.unloadCallbacks = [], this.debugEnabled = !1, this.isReady = !1, this.removed = !1, this.mountToken = 0, this.hostContainer = null, this.readerElement = null, this.readerId = null, this.normalizedConfiguration = null, this.nativeEventCleanupCallbacks = [], this.themeCleanup = null, this.enableDebug = (e) => {
1133
+ }, this.documentTool = new le(this.bridgeToolContext), this.uiTool = new Be(this.bridgeToolContext), this.pageTool = new fe(this.bridgeToolContext), this.pageArrangeTool = new Se(this.bridgeToolContext), this.findTool = new he(this.bridgeToolContext), this.signServerTool = new Ie(this.bridgeToolContext), this.digitalSignTool = new ae(this.bridgeToolContext), this.symbologyTool = new _e(this.bridgeToolContext), this.annotationTool = new te(this.bridgeToolContext), this.templateSignTool = new Fe(this.bridgeToolContext), this.pdfFormFiller = new Te(this.bridgeToolContext), this.networkingTool = new me(this.bridgeToolContext), this.cryptoTool = new ie(this.bridgeToolContext), this.securityTool = new Me(this.bridgeToolContext), this.readyCallbacks = [], this.unloadCallbacks = [], this.debugEnabled = !1, this.isReady = !1, this.removed = !1, this.mountToken = 0, this.hostContainer = null, this.readerElement = null, this.readerId = null, this.normalizedConfiguration = null, this.nativeEventCleanupCallbacks = [], this.themeCleanup = null, this.enableDebug = (e) => {
855
1134
  this.debugEnabled = e;
856
- }, this.changeLanguage = () => {
857
- }, this.setLicense = (e, i) => {
858
- this.license = { license: e, feature: i };
1135
+ }, this.changeLanguage = (e) => {
1136
+ this.readerElement && this.readerElement.setAttribute("language", e);
1137
+ }, this.setThemeMode = (e) => {
1138
+ this.themeCleanup?.(), this.themeCleanup = null, this.normalizedConfiguration = this.normalizedConfiguration ? {
1139
+ ...this.normalizedConfiguration,
1140
+ theme: e
1141
+ } : null, this.readerElement && (this.themeCleanup = _(this.readerElement, e));
859
1142
  }, this.setSessionUser = (e) => {
860
1143
  this.sessionUser = e;
861
1144
  }, this.setSessionUserId = (e) => {
@@ -879,26 +1162,33 @@ class Ue {
879
1162
  }, this.setReaderEventListener = (e) => {
880
1163
  this.readerEventListener = e;
881
1164
  }, this.embedReader = (e, i, r) => {
882
- const a = _e(e), o = V(i);
883
- x(o);
884
- const s = me(o, r), l = this.mountToken + 1;
885
- this.removeReader(), this.mountToken = l, this.removed = !1, this.hostContainer = a, this.normalizedConfiguration = s, this.mountReader(a, s, l);
1165
+ const a = rt(e), s = G(i);
1166
+ H(s);
1167
+ const o = Ke(s, r), u = this.mountToken + 1;
1168
+ this.removeReader(), this.mountToken = u, this.removed = !1, this.hostContainer = a, this.normalizedConfiguration = o, this.mountReader(a, o, u);
886
1169
  }, this.removeReader = () => {
887
1170
  const e = !!(this.readerElement || this.hostContainer);
888
1171
  if (this.mountToken += 1, this.cleanupNativeEventForwarders(), this.cleanupThemeBinding(), this.readerElement?.parentNode && this.readerElement.parentNode.removeChild(this.readerElement), this.readerElement = null, this.readerId = null, this.bridge.setReaderId(null), this.readerState.reset(), this.hostContainer = null, this.normalizedConfiguration = null, this.isReady = !1, this.removed = !0, !e)
889
1172
  return;
890
- const i = D(null, null);
891
- this.emitReaderEvent(Ie, i), this.unloadCallbacks.forEach((r) => r());
892
- }, this.getDocumentTool = () => this.documentTool, this.getUITool = () => this.uiTool, this.getPageTool = () => this.pageTool, this.getFindTool = () => this.findTool, this.getSignServerTool = () => this.signServerTool, this.getDigitalSignTool = () => this.digitalSignTool, this.getSymbologyTool = () => this.symbologyTool, this.getAnnotationTool = () => this.annotationTool, this.getTemplateSignTool = () => this.templateSignTool, this.getPdfFormFiller = () => this.pdfFormFiller, this.getNetworkingTool = () => this.networkingTool, this.getCryptoTool = () => this.cryptoTool, this.createDigitalSignOptions = () => new se(), this.createKVField = (e, i, r) => new oe(e, i, r), this.mountReader = async (e, i, r) => {
1173
+ const i = w(null, null);
1174
+ this.emitReaderEvent(nt, i), this.unloadCallbacks.forEach((r) => r());
1175
+ }, this.getDocumentTool = () => this.documentTool, this.getUITool = () => this.uiTool, this.getPageTool = () => this.pageTool, this.getPageArrangeTool = () => this.pageArrangeTool, this.getFindTool = () => this.findTool, this.getSignServerTool = () => this.signServerTool, this.getDigitalSignTool = () => this.digitalSignTool, this.getSymbologyTool = () => this.symbologyTool, this.getAnnotationTool = () => this.annotationTool, this.getTemplateSignTool = () => this.templateSignTool, this.getPdfFormFiller = () => this.pdfFormFiller, this.getNetworkingTool = () => this.networkingTool, this.getCryptoTool = () => this.cryptoTool, this.getSecurityTool = () => this.securityTool, this.createDigitalSignOptions = () => new De(), this.createKVField = (e, i, r) => new Ce(e, i, r), this.mountReader = async (e, i, r) => {
893
1176
  try {
894
- if (await ke(i.appUrl), this.mountToken !== r)
1177
+ if (await He(i.appUrl), this.mountToken !== r)
895
1178
  return;
896
- const a = document.createElement(u), o = we();
897
- if (a.setAttribute(Ee, o), this.readerId = o, this.bridge.setReaderId(o), Oe(a, i), this.themeCleanup = Le(a, i), this.bindNativeReaderEvents(a), e.replaceChildren(a), this.readerElement = a, await Promise.resolve(), this.mountToken !== r)
1179
+ const a = document.createElement(g), s = it();
1180
+ a.setAttribute(K, s), this.readerId = s, this.bridge.setReaderId(s), st(a);
1181
+ const o = i.compactViewer === !0 && i.keepPCMenu !== !0;
1182
+ if (a.toggleAttribute("data-sdk-compact-mode", o), a.setAttribute("language", i.language ?? "zh_CN"), this.themeCleanup = _(a, i.theme), this.bindNativeReaderEvents(a), e.replaceChildren(a), this.readerElement = a, await Promise.resolve(), this.mountToken !== r)
898
1183
  return;
899
- i.scrollIntoView && typeof e.scrollIntoView == "function" && e.scrollIntoView({ behavior: "smooth", block: "nearest" }), this.isReady = !0;
900
- const s = D(a, i);
901
- this.emitReaderEvent(Me, s), this.readyCallbacks.forEach((l) => l());
1184
+ const u = await this.bridge.waitForReady();
1185
+ if (this.mountToken !== r)
1186
+ return;
1187
+ if (!u)
1188
+ throw new Error("Editor adapter is not available.");
1189
+ this.isReady = !0;
1190
+ const c = w(a, i);
1191
+ this.emitReaderEvent(tt, c), this.readyCallbacks.forEach((l) => l());
902
1192
  } catch (a) {
903
1193
  if (this.mountToken !== r)
904
1194
  return;
@@ -915,10 +1205,10 @@ class Ue {
915
1205
  C,
916
1206
  i
917
1207
  );
918
- }), De.forEach((r) => {
919
- const a = (o) => {
920
- const s = o instanceof CustomEvent ? o.detail : o;
921
- r === "documentLoaded" && this.readerState.setDocumentOpened(!0), this.emitReaderEvent(r, s), r === "documentError" && this.emitReaderEvent(v, s);
1208
+ }), et.forEach((r) => {
1209
+ const a = (s) => {
1210
+ const o = s instanceof CustomEvent ? s.detail : s;
1211
+ r === "documentLoaded" && this.readerState.setDocumentOpened(!0), this.emitReaderEvent(r, o), r === "documentError" && this.emitReaderEvent(T, o);
922
1212
  };
923
1213
  e.addEventListener(r, a), this.nativeEventCleanupCallbacks.push(() => {
924
1214
  e.removeEventListener(r, a);
@@ -931,102 +1221,41 @@ class Ue {
931
1221
  }, this.emitReaderEvent = (e, i) => {
932
1222
  this.readerEventListener?.(e, i);
933
1223
  }, this.reportReaderError = (e) => {
934
- this.isReady = !1, this.debugEnabled && console.error("[RHC Office SDK] Reader mount failed", e), this.emitReaderEvent(v, e);
1224
+ this.isReady = !1, this.debugEnabled && console.error("[RHC Office SDK] Reader mount failed", e), this.emitReaderEvent(T, e);
935
1225
  }, this.reportAdapterError = (e) => {
936
- this.debugEnabled && console.error("[RHC Office SDK] Adapter command failed", e), this.emitReaderEvent(v, e);
1226
+ this.debugEnabled && console.error("[RHC Office SDK] Adapter command failed", e), this.emitReaderEvent(T, e);
937
1227
  }, this.bridge.configureTimeouts({
938
- readyTimeoutMs: t?.adapterReadyTimeoutMs,
939
- requestTimeoutMs: t?.adapterRequestTimeoutMs
1228
+ readyTimeoutMs: n?.readyTimeoutMs,
1229
+ requestTimeoutMs: n?.requestTimeoutMs
940
1230
  });
941
1231
  }
942
- createAnnotationTool() {
943
- return c(
944
- "annotation",
945
- {
946
- addAnnotationEventCallback: {
947
- kind: "callbackRegister",
948
- callback: (t, e) => {
949
- const i = e[0];
950
- typeof i == "function" && t.annotationEvents.push(i);
951
- }
952
- },
953
- addAnnotationPersistCallback: {
954
- kind: "callbackRegister",
955
- callback: (t, e) => {
956
- const i = e[0];
957
- typeof i == "function" && t.annotationPersist.push(i);
958
- }
959
- },
960
- addAnnotationRetrieveCallback: {
961
- kind: "callbackRegister",
962
- callback: (t, e) => {
963
- const i = e[0];
964
- typeof i == "function" && t.annotationRetrieve.push(i);
965
- }
966
- },
967
- addDigitalAnnotationRetrieveCallback: {
968
- kind: "callbackRegister",
969
- callback: (t, e) => {
970
- const i = e[0];
971
- typeof i == "function" && t.digitalAnnotationRetrieve.push(
972
- i
973
- );
974
- }
975
- },
976
- isInAnnotationMode: {
977
- kind: "stateGetter",
978
- state: (t) => t.annotationEnabled
979
- },
980
- getAnnotations: { kind: "stateGetter", state: () => [] },
981
- getAnnotationsCount: { kind: "stateGetter", state: () => 0 },
982
- queryAnnotationsBy: { kind: "stateGetter", state: () => [] },
983
- setToolSource: { kind: "command" },
984
- openAnnotationView: { kind: "command" },
985
- closeAnnotationView: { kind: "command" },
986
- openTextAnnotationView: { kind: "command" },
987
- setTextAnnotationFontColor: { kind: "command" },
988
- setTextAnnotationFontSize: { kind: "command" },
989
- closeTextAnnotationView: { kind: "command" },
990
- createTextAnnotation: { kind: "command" },
991
- setPersistToDocument: { kind: "command" },
992
- saveAnnotations: { kind: "callbackQuery" },
993
- saveTextAnnotations: { kind: "command" },
994
- clearAnnotations: { kind: "command" },
995
- clearTextAnnotations: { kind: "command" },
996
- undoAnnotation: { kind: "command" },
997
- redoAnnotation: { kind: "command" },
998
- selectAnnotationTool: { kind: "command" },
999
- showAnnotationColorPicker: { kind: "command" },
1000
- setAnnotationPenType: { kind: "command" },
1001
- appendAnnotations: { kind: "callbackQuery" },
1002
- batchAppendAnnotations: { kind: "callbackQuery" },
1003
- setAnnotationPenColor: { kind: "command" },
1004
- setAnnotationPenWidth: { kind: "command" },
1005
- setAnnotationPenThickness: { kind: "command" },
1006
- enableAnnotationsInfoView: { kind: "command" },
1007
- enableAnnotationsDeletion: { kind: "command" },
1008
- enableAnnotationsDeletionOnlyByAuthor: { kind: "command" },
1009
- listDigitalStamps: { kind: "command" },
1010
- listAnnotations: { kind: "command" },
1011
- deleteAnnotationsBy: { kind: "command" },
1012
- deleteAnnotationsById: { kind: "command" },
1013
- addDigitalAnnotation: { kind: "command" },
1014
- addInkAnnotationCallback: { kind: "callbackRegister" }
1015
- },
1016
- this.bridgeToolContext
1017
- );
1018
- }
1019
1232
  }
1020
- const He = (n) => new Ue(n);
1233
+ const mt = (t) => new ot(t);
1021
1234
  export {
1022
- Ge as DIGITAL_SIGN_DEFAULTS,
1023
- Ue as DocumentSDK,
1024
- K as WatermarkDisplay,
1025
- He as createNewDocumentSdk,
1026
- Ne as getDigitalSignEnvironment,
1027
- Ve as initializeDigitalSignEnvironment,
1028
- xe as patchDigitalSignEnvironment,
1029
- Ke as resetDigitalSignEnvironment,
1030
- Be as setDigitalSignEnvironment
1235
+ te as AnnotationToolImpl,
1236
+ ie as CryptoToolImpl,
1237
+ gt as DIGITAL_SIGN_DEFAULTS,
1238
+ De as DigitalSignOptions,
1239
+ ae as DigitalSignToolImpl,
1240
+ ot as DocumentSDK,
1241
+ le as DocumentToolImpl,
1242
+ he as FindToolImpl,
1243
+ Ce as KVField,
1244
+ me as NetworkingToolImpl,
1245
+ Se as PageArrangeToolImpl,
1246
+ fe as PageToolImpl,
1247
+ Te as PdfFormFillerImpl,
1248
+ Me as SecurityToolImpl,
1249
+ Ie as SignServerToolImpl,
1250
+ _e as SymbologyToolImpl,
1251
+ Fe as TemplateSignToolImpl,
1252
+ Be as UIToolImpl,
1253
+ W as WatermarkDisplay,
1254
+ mt as createNewDocumentSdk,
1255
+ dt as getDigitalSignEnvironment,
1256
+ ut as initializeDigitalSignEnvironment,
1257
+ ct as patchDigitalSignEnvironment,
1258
+ ht as resetDigitalSignEnvironment,
1259
+ lt as setDigitalSignEnvironment
1031
1260
  };
1032
1261
  //# sourceMappingURL=index.js.map