@rhc-office/sdk 6.6.266 → 6.6.268

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 (40) hide show
  1. package/dist/browser/document-viewer.js +1 -1
  2. package/dist/browser/document-viewer.js.map +1 -1
  3. package/dist/index.d.ts +1 -0
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +666 -523
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.umd.cjs +1 -1
  8. package/dist/index.umd.cjs.map +1 -1
  9. package/dist/tools/AnnotationToolImpl.d.ts +47 -0
  10. package/dist/tools/AnnotationToolImpl.d.ts.map +1 -0
  11. package/dist/tools/CryptoToolImpl.d.ts +9 -0
  12. package/dist/tools/CryptoToolImpl.d.ts.map +1 -0
  13. package/dist/tools/DigitalSignToolImpl.d.ts +27 -0
  14. package/dist/tools/DigitalSignToolImpl.d.ts.map +1 -0
  15. package/dist/tools/DocumentToolImpl.d.ts +1 -0
  16. package/dist/tools/DocumentToolImpl.d.ts.map +1 -1
  17. package/dist/tools/SignServerToolImpl.d.ts +19 -0
  18. package/dist/tools/SignServerToolImpl.d.ts.map +1 -0
  19. package/dist/tools/SymbologyToolImpl.d.ts +8 -0
  20. package/dist/tools/SymbologyToolImpl.d.ts.map +1 -0
  21. package/dist/tools/TemplateSignToolImpl.d.ts +13 -0
  22. package/dist/tools/TemplateSignToolImpl.d.ts.map +1 -0
  23. package/dist/tools/index.d.ts +6 -0
  24. package/dist/tools/index.d.ts.map +1 -1
  25. package/dist/viewer/DocumentSDK.d.ts +0 -1
  26. package/dist/viewer/DocumentSDK.d.ts.map +1 -1
  27. package/dist/viewer/SdkCallbackRegistry.d.ts +3 -0
  28. package/dist/viewer/SdkCallbackRegistry.d.ts.map +1 -1
  29. package/package.json +1 -1
  30. package/src/index.ts +1 -0
  31. package/src/tools/AnnotationToolImpl.ts +263 -0
  32. package/src/tools/CryptoToolImpl.ts +27 -0
  33. package/src/tools/DigitalSignToolImpl.ts +155 -0
  34. package/src/tools/DocumentToolImpl.ts +24 -2
  35. package/src/tools/SignServerToolImpl.ts +92 -0
  36. package/src/tools/SymbologyToolImpl.ts +34 -0
  37. package/src/tools/TemplateSignToolImpl.ts +51 -0
  38. package/src/tools/index.ts +6 -0
  39. package/src/viewer/DocumentSDK.ts +13 -114
  40. package/src/viewer/SdkCallbackRegistry.ts +9 -0
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
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 K = /* @__PURE__ */ ((t) => (t.DEFAULT = "default", t.COMPACT = "compact", t.HIDE = "none", t))(K || {});
2
+ const w = "RIGHT_CENTER", M = "REGULAR_ESM", O = "auto", S = "__RHC_OFFICE_DIGITAL_SIGN_ENVIRONMENT__", A = {
3
3
  defaults: {
4
4
  bjca: {
5
5
  pin: ""
@@ -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: O,
21
+ signatureType: M
22
22
  },
23
23
  signServer: {
24
24
  authSource: "Password",
@@ -38,216 +38,343 @@ const w = "RIGHT_CENTER", _ = "REGULAR_ESM", F = "auto", b = "__RHC_OFFICE_DIGIT
38
38
  usbKeyType: 14
39
39
  }
40
40
  }
41
- }, O = (n) => ({
41
+ }, _ = (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
+ }), F = (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
+ }), h = (t) => ({
78
+ defaults: _(t.defaults),
79
+ signServer: F(t.signServer)
80
+ }), L = (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
+ }), G = (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
+ } : _(t), H = (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
+ } : F(t), U = (t, n) => ({
129
+ defaults: G(t.defaults, n.defaults),
130
+ signServer: H(t.signServer, n.signServer)
131
+ }), q = (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
+ }), Q = () => globalThis, p = () => {
161
+ const t = Q();
162
+ return t[S] || (t[S] = {
163
+ current: h(A),
164
+ defaults: h(A),
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 = {
166
+ }), t[S];
167
+ }, je = () => p().current, Xe = (t) => {
168
+ const n = p();
169
+ return n.defaults = h(t), n.current = U(n.defaults, n.overrides), n.current;
170
+ }, Je = (t) => {
171
+ const n = p();
172
+ return n.current = h(t), n.overrides = L(t), n.current;
173
+ }, Ze = (t) => {
174
+ const n = p();
175
+ return n.overrides = q(n.overrides, L(t)), n.current = U(n.current, t), n.current;
176
+ }, et = (t) => {
177
+ const n = p();
178
+ return t && (n.defaults = h(t)), n.overrides = {}, n.current = h(n.defaults), n.current;
179
+ }, tt = {
180
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(
181
+ RSA_MODE: O,
182
+ SIGNATURE_TYPE: M
183
+ }, f = (t) => {
184
+ if (t.length !== 0)
185
+ return t.length === 1 ? t[0] : t;
186
+ }, c = (t, n, e) => new Proxy(
187
187
  {},
188
188
  {
189
- get: (i, r) => {
190
- if (r === "then")
189
+ get: (i, a) => {
190
+ if (a === "then")
191
191
  return;
192
- if (typeof r == "symbol")
193
- return r === Symbol.toStringTag ? n : void 0;
194
- const a = t[r];
195
- return a ? (...o) => {
196
- if (a.kind === "callbackRegister") {
197
- a.callback?.(e.callbacks, o);
192
+ if (typeof a == "symbol")
193
+ return a === Symbol.toStringTag ? t : void 0;
194
+ const r = n[a];
195
+ return r ? (...s) => {
196
+ if (r.kind === "callbackRegister") {
197
+ r.callback?.(e.callbacks, s);
198
198
  return;
199
199
  }
200
- if (a.kind === "stateGetter")
201
- return a.state?.(e.state.snapshot(), o);
202
- const s = a.adapterMethod ?? r;
203
- if (a.kind === "query")
204
- return e.bridge.request(n, s, T(o));
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);
200
+ if (r.kind === "stateGetter")
201
+ return r.state?.(e.state.snapshot(), s);
202
+ const o = r.adapterMethod ?? a;
203
+ if (r.kind === "query")
204
+ return e.bridge.request(t, o, f(s));
205
+ if (r.kind === "callbackQuery") {
206
+ const l = s.find((d) => typeof d == "function"), m = s.filter((d) => typeof d != "function");
207
+ e.bridge.request(t, o, f(m)).then((d) => {
208
+ const k = r.mapCallbackResult?.(d) ?? [d];
209
+ l?.(...k);
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
+ e.bridge.request(t, o, f(s)).catch(e.onAsyncError);
214
+ } : (...s) => {
215
+ const o = new Error(`${t}.${a} is not implemented by the SDK adapter.`);
216
+ e.onAsyncError(o);
217
217
  };
218
218
  }
219
219
  }
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
- };
220
+ ), z = {
221
+ addAnnotationEventCallback: {
222
+ kind: "callbackRegister",
223
+ callback: (t, n) => {
224
+ const e = n[0];
225
+ typeof e == "function" && t.annotationEvents.push(e);
226
+ }
227
+ },
228
+ addAnnotationPersistCallback: {
229
+ kind: "callbackRegister",
230
+ callback: (t, n) => {
231
+ const e = n[0];
232
+ typeof e == "function" && t.annotationPersist.push(e);
233
+ }
234
+ },
235
+ addAnnotationRetrieveCallback: {
236
+ kind: "callbackRegister",
237
+ callback: (t, n) => {
238
+ const e = n[0];
239
+ typeof e == "function" && t.annotationRetrieve.push(e);
240
+ }
241
+ },
242
+ addDigitalAnnotationRetrieveCallback: {
243
+ kind: "callbackRegister",
244
+ callback: (t, n) => {
245
+ const e = n[0];
246
+ typeof e == "function" && t.digitalAnnotationRetrieve.push(
247
+ e
248
+ );
249
+ }
250
+ },
251
+ isInAnnotationMode: {
252
+ kind: "stateGetter",
253
+ state: (t) => t.annotationEnabled
254
+ },
255
+ getAnnotations: { kind: "stateGetter", state: () => [] },
256
+ getAnnotationsCount: { kind: "stateGetter", state: () => 0 },
257
+ queryAnnotationsBy: { kind: "stateGetter", state: () => [] },
258
+ setToolSource: { kind: "command" },
259
+ openAnnotationView: { kind: "command" },
260
+ closeAnnotationView: { kind: "command" },
261
+ openTextAnnotationView: { kind: "command" },
262
+ setTextAnnotationFontColor: { kind: "command" },
263
+ setTextAnnotationFontSize: { kind: "command" },
264
+ closeTextAnnotationView: { kind: "command" },
265
+ createTextAnnotation: { kind: "command" },
266
+ setPersistToDocument: { kind: "command" },
267
+ saveAnnotations: { kind: "callbackQuery" },
268
+ saveTextAnnotations: { kind: "command" },
269
+ clearAnnotations: { kind: "command" },
270
+ clearTextAnnotations: { kind: "command" },
271
+ undoAnnotation: { kind: "command" },
272
+ redoAnnotation: { kind: "command" },
273
+ selectAnnotationTool: { kind: "command" },
274
+ showAnnotationColorPicker: { kind: "command" },
275
+ setAnnotationPenType: { kind: "command" },
276
+ appendAnnotations: { kind: "callbackQuery" },
277
+ batchAppendAnnotations: { kind: "callbackQuery" },
278
+ setAnnotationPenColor: { kind: "command" },
279
+ setAnnotationPenWidth: { kind: "command" },
280
+ setAnnotationPenThickness: { kind: "command" },
281
+ enableAnnotationsInfoView: { kind: "command" },
282
+ enableAnnotationsDeletion: { kind: "command" },
283
+ enableAnnotationsDeletionOnlyByAuthor: { kind: "command" },
284
+ listDigitalStamps: { kind: "command" },
285
+ listAnnotations: { kind: "command" },
286
+ deleteAnnotationsBy: { kind: "command" },
287
+ deleteAnnotationsById: { kind: "command" },
288
+ addDigitalAnnotation: { kind: "command" },
289
+ addInkAnnotationCallback: { kind: "callbackRegister" }
290
+ };
291
+ class W {
292
+ constructor(n) {
293
+ this.setToolSource = (e) => this.adapter.setToolSource(e), this.openAnnotationView = (e) => this.adapter.openAnnotationView(e), this.closeAnnotationView = (e) => this.adapter.closeAnnotationView(e), this.openTextAnnotationView = () => this.adapter.openTextAnnotationView(), this.setTextAnnotationFontColor = (e) => this.adapter.setTextAnnotationFontColor(e), this.setTextAnnotationFontSize = (e) => this.adapter.setTextAnnotationFontSize(e), this.closeTextAnnotationView = (e) => this.adapter.closeTextAnnotationView(e), this.createTextAnnotation = (e) => this.adapter.createTextAnnotation(e), this.setPersistToDocument = (e) => this.adapter.setPersistToDocument(e), this.saveAnnotations = (e) => this.adapter.saveAnnotations(e), this.saveTextAnnotations = () => this.adapter.saveTextAnnotations(), this.clearAnnotations = () => this.adapter.clearAnnotations(), this.clearTextAnnotations = () => this.adapter.clearTextAnnotations(), this.undoAnnotation = () => this.adapter.undoAnnotation(), this.redoAnnotation = () => this.adapter.redoAnnotation(), this.selectAnnotationTool = (e) => this.adapter.selectAnnotationTool(e), this.showAnnotationColorPicker = () => this.adapter.showAnnotationColorPicker(), this.setAnnotationPenType = (e) => this.adapter.setAnnotationPenType(e), this.appendAnnotations = (e, i) => this.adapter.appendAnnotations(e, i), this.batchAppendAnnotations = (e, i) => this.adapter.batchAppendAnnotations(e, i), this.setAnnotationPenColor = (e) => this.adapter.setAnnotationPenColor(e), this.setAnnotationPenWidth = (e) => this.adapter.setAnnotationPenWidth(e), this.setAnnotationPenThickness = (e) => this.adapter.setAnnotationPenThickness(e), this.enableAnnotationsInfoView = (e) => this.adapter.enableAnnotationsInfoView(e), this.enableAnnotationsDeletion = (e) => this.adapter.enableAnnotationsDeletion(e), this.enableAnnotationsDeletionOnlyByAuthor = (e) => this.adapter.enableAnnotationsDeletionOnlyByAuthor(e), this.listDigitalStamps = () => this.adapter.listDigitalStamps(), this.isInAnnotationMode = () => this.adapter.isInAnnotationMode(), this.listAnnotations = (e) => this.adapter.listAnnotations(e), this.getAnnotations = () => this.adapter.getAnnotations(), this.getAnnotationsCount = () => this.adapter.getAnnotationsCount(), this.queryAnnotationsBy = (e) => this.adapter.queryAnnotationsBy(e), this.deleteAnnotationsBy = (e, i) => this.adapter.deleteAnnotationsBy(e, i), this.deleteAnnotationsById = (e, i) => this.adapter.deleteAnnotationsById(e, i), this.addDigitalAnnotation = (e) => this.adapter.addDigitalAnnotation(e), this.addInkAnnotationCallback = (e) => this.adapter.addInkAnnotationCallback(e), this.addAnnotationEventCallback = (e) => this.adapter.addAnnotationEventCallback(e), this.addAnnotationPersistCallback = (e) => this.adapter.addAnnotationPersistCallback(e), this.addAnnotationRetrieveCallback = (e) => this.adapter.addAnnotationRetrieveCallback(e), this.addDigitalAnnotationRetrieveCallback = (e) => this.adapter.addDigitalAnnotationRetrieveCallback(e), this.adapter = c(
294
+ "annotation",
295
+ z,
296
+ n
297
+ );
298
+ }
299
+ }
300
+ const $ = {
301
+ configSecurityProvider: { kind: "command" },
302
+ getSecurityProviders: { kind: "query" }
303
+ };
304
+ class Y {
305
+ constructor(n) {
306
+ this.configSecurityProvider = (e) => this.adapter.configSecurityProvider(e), this.getSecurityProviders = () => this.adapter.getSecurityProviders(), this.adapter = c("crypto", $, n);
307
+ }
308
+ }
309
+ const j = {
310
+ addDigitalSignatureRetrieveCallback: {
311
+ kind: "callbackRegister",
312
+ callback: (t, n) => {
313
+ const e = n[0];
314
+ typeof e == "function" && t.digitalSignatureRetrieve.push(e);
229
315
  }
316
+ },
317
+ addDigitalSignatureParseCallback: {
318
+ kind: "callbackRegister",
319
+ callback: (t, n) => {
320
+ const e = n[0];
321
+ typeof e == "function" && t.digitalSignatureParse.push(e);
322
+ }
323
+ },
324
+ addDigitalSignCallback: {
325
+ kind: "callbackRegister",
326
+ callback: (t, n) => {
327
+ const e = n[0];
328
+ typeof e == "function" && t.digitalSign.push(e);
329
+ }
330
+ },
331
+ setCryptoProvider: { kind: "command" },
332
+ setSealSource: { kind: "command" },
333
+ setDefaultStampPassword: { kind: "command" },
334
+ setDefaultSealPassword: { kind: "command" },
335
+ setDefaultKeystorePassword: { kind: "command" },
336
+ setDefaultUSBKeyPassword: { kind: "command" },
337
+ setupExternalSealServer: { kind: "command" },
338
+ setDigitalSignOptions: { kind: "command" },
339
+ setExternalDigitalSignOptions: { kind: "command" },
340
+ setPDFDigitalSignCaptionOptions: { kind: "command" },
341
+ addDigitalSignature: { kind: "callbackQuery" },
342
+ addDigitalSignatureBySelectedSearchHighlight: { kind: "command" },
343
+ listDigitalSignatures: { kind: "callbackQuery" },
344
+ getDigitalSignatures: { kind: "stateGetter", state: () => [] },
345
+ getDigitalSignaturesCount: { kind: "stateGetter", state: () => 0 },
346
+ enableDigitalSignatureInfoView: { kind: "command" },
347
+ enableDigitalSignatureRevocation: { kind: "command" }
348
+ };
349
+ class X {
350
+ constructor(n) {
351
+ this.addDigitalSignatureRetrieveCallback = (e) => this.adapter.addDigitalSignatureRetrieveCallback(e), this.addDigitalSignatureParseCallback = (e) => this.adapter.addDigitalSignatureParseCallback(e), this.setCryptoProvider = (e, i, a) => this.adapter.setCryptoProvider(e, i, a), 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 = c(
352
+ "digitalSign",
353
+ j,
354
+ n
355
+ );
230
356
  }
231
- ), z = {
357
+ }
358
+ const J = "rhc-office.editor-adapter", Z = 1, ee = "__RHC_OFFICE_EDITOR_ADAPTER__", R = "rhcOfficeAdapterReady", E = "rhcOfficeAdapterEvent", N = "data-rhc-office-reader-id", te = {
232
359
  addDocumentOpenedCallback: {
233
360
  kind: "callbackRegister",
234
- callback: (n, t) => {
235
- const e = t[0];
236
- typeof e == "function" && n.documentOpened.push(e);
361
+ callback: (t, n) => {
362
+ const e = n[0];
363
+ typeof e == "function" && t.documentOpened.push(e);
237
364
  }
238
365
  },
239
366
  addDocumentSavedCallback: {
240
367
  kind: "callbackRegister",
241
- callback: (n, t) => {
242
- const e = t[0];
243
- typeof e == "function" && n.documentSaved.push(e);
368
+ callback: (t, n) => {
369
+ const e = n[0];
370
+ typeof e == "function" && t.documentSaved.push(e);
244
371
  }
245
372
  },
246
373
  addDocumentClosedCallback: {
247
374
  kind: "callbackRegister",
248
- callback: (n, t) => {
249
- const e = t[0];
250
- typeof e == "function" && n.documentClosed.push(e);
375
+ callback: (t, n) => {
376
+ const e = n[0];
377
+ typeof e == "function" && t.documentClosed.push(e);
251
378
  }
252
379
  },
253
380
  openPDFDocument: { kind: "callbackQuery", adapterMethod: "open" },
@@ -263,83 +390,96 @@ const w = "RIGHT_CENTER", _ = "REGULAR_ESM", F = "auto", b = "__RHC_OFFICE_DIGIT
263
390
  saveAs: { kind: "query" },
264
391
  getDocumentContent: {
265
392
  kind: "callbackQuery",
266
- mapCallbackResult: (n) => {
267
- const t = n;
268
- return [t?.fileCacheId, t?.fileBuffer];
393
+ mapCallbackResult: (t) => {
394
+ const n = t;
395
+ return [n?.fileCacheId, n?.fileBuffer];
269
396
  }
270
397
  },
271
398
  closeDocument: { kind: "callbackQuery" },
272
399
  isDocumentOpened: {
273
400
  kind: "stateGetter",
274
- state: (n) => n.documentOpened
401
+ state: (t) => t.documentOpened
275
402
  },
276
403
  isDocumentModified: {
277
404
  kind: "stateGetter",
278
- state: (n) => n.documentModified
405
+ state: (t) => t.documentModified
279
406
  },
280
407
  print: { kind: "command" },
281
408
  createPreview: { kind: "command" }
282
409
  };
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(
410
+ class ne {
411
+ constructor(n) {
412
+ 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, a) => this.adapter.save(e, i, a), this.saveAs = (e) => {
413
+ const i = this.context.bridge.getReaderId();
414
+ if (!i)
415
+ return Promise.resolve({
416
+ success: !1,
417
+ action: "save-as",
418
+ filename: e?.filename,
419
+ error: "Reader is not mounted or does not expose saveAs."
420
+ });
421
+ const a = document.querySelector(
422
+ `[${N}="${i}"]`
423
+ );
424
+ return typeof a?.saveAs == "function" ? a.saveAs(e) : this.adapter.saveAs(e);
425
+ }, this.getDocumentContent = (e) => this.adapter.getDocumentContent(e), this.closeDocument = (e, i, a) => this.adapter.closeDocument(e, i, a), 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(
286
426
  "document",
287
- z,
288
- t
427
+ te,
428
+ n
289
429
  );
290
430
  }
291
431
  }
292
- const $ = {
432
+ const ie = {
293
433
  clearFind: { kind: "command" },
294
434
  findNext: { kind: "command" },
295
435
  findPrevious: { kind: "command" }
296
436
  };
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);
437
+ class ae {
438
+ constructor(n) {
439
+ this.clearFind = () => this.adapter.clearFind(), this.findNext = (e) => this.adapter.findNext(e), this.findPrevious = (e) => this.adapter.findPrevious(e), this.adapter = c("find", ie, n);
300
440
  }
301
441
  }
302
- const Y = {
442
+ const re = {
303
443
  configFileUpload: { kind: "command" },
304
444
  setHttpHeaders: { kind: "command" },
305
445
  setHttpFormFields: { kind: "command" }
306
446
  };
307
- class X {
308
- constructor(t) {
447
+ class se {
448
+ constructor(n) {
309
449
  this.configFileUpload = (e) => this.adapter.configFileUpload(e), this.setHttpHeaders = (e) => this.adapter.setHttpHeaders(e), this.setHttpFormFields = (e) => this.adapter.setHttpFormFields(e), this.adapter = c(
310
450
  "networking",
311
- Y,
312
- t
451
+ re,
452
+ n
313
453
  );
314
454
  }
315
455
  }
316
- const J = (n) => ({
456
+ const oe = (t) => ({
317
457
  addPageChangeCallback: {
318
458
  kind: "callbackRegister",
319
- callback: (t, e) => {
459
+ callback: (n, e) => {
320
460
  const i = e[0];
321
- typeof i == "function" && t.pageChange.push(i);
461
+ typeof i == "function" && n.pageChange.push(i);
322
462
  }
323
463
  },
324
464
  addPageModeChangeCallback: {
325
465
  kind: "callbackRegister",
326
- callback: (t, e) => {
466
+ callback: (n, e) => {
327
467
  const i = e[0];
328
- typeof i == "function" && t.pageModeChange.push(i);
468
+ typeof i == "function" && n.pageModeChange.push(i);
329
469
  }
330
470
  },
331
471
  getPageCount: {
332
472
  kind: "callbackRegister",
333
- callback: (t, e) => {
473
+ callback: (n, e) => {
334
474
  const i = e[0];
335
- typeof i == "function" && i(n.state.snapshot().pageCount);
475
+ typeof i == "function" && i(t.state.snapshot().pageCount);
336
476
  }
337
477
  },
338
478
  getPageIndex: {
339
479
  kind: "callbackRegister",
340
- callback: (t, e) => {
480
+ callback: (n, e) => {
341
481
  const i = e[0];
342
- typeof i == "function" && i(n.state.snapshot().pageIndex);
482
+ typeof i == "function" && i(t.state.snapshot().pageIndex);
343
483
  }
344
484
  },
345
485
  setSinglePageViewMode: { kind: "command" },
@@ -363,16 +503,16 @@ const J = (n) => ({
363
503
  gotoPreviousPage: { kind: "command" },
364
504
  rotatePage: { kind: "command" }
365
505
  });
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(
506
+ class de {
507
+ constructor(n) {
508
+ 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, a, r) => this.adapter.setPageBlendColor(e, i, a, r), this.gotoPage = (e, i, a) => this.adapter.gotoPage(e, i, a), this.gotoNextPage = () => this.adapter.gotoNextPage(), this.gotoPreviousPage = () => this.adapter.gotoPreviousPage(), this.rotatePage = (e) => this.adapter.rotatePage(e), this.adapter = c(
369
509
  "page",
370
- J(t),
371
- t
510
+ oe(n),
511
+ n
372
512
  );
373
513
  }
374
514
  }
375
- const ee = {
515
+ const le = {
376
516
  open: { kind: "command" },
377
517
  setFormFieldValue: { kind: "command" },
378
518
  setFormFieldReadonly: { kind: "command" },
@@ -386,65 +526,138 @@ const ee = {
386
526
  },
387
527
  toKeyValue: {
388
528
  kind: "callbackQuery",
389
- mapCallbackResult: (n) => [Array.isArray(n) ? n : []]
529
+ mapCallbackResult: (t) => [Array.isArray(t) ? t : []]
390
530
  }
391
531
  };
392
- class te {
393
- constructor(t) {
532
+ class ce {
533
+ constructor(n) {
394
534
  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(
395
535
  "pdfFormFiller",
396
- ee,
397
- t
536
+ le,
537
+ n
398
538
  );
399
539
  }
400
540
  }
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] ?? "");
408
- return r ? [r] : [];
541
+ class ue extends Error {
542
+ constructor(n, e) {
543
+ super(`[Phase 1] ${n}.${e} is not implemented yet.`), this.name = "SDKPhase1NotImplementedError";
544
+ }
545
+ }
546
+ const he = (t, n) => () => {
547
+ throw new ue(t, n);
548
+ }, nt = (t) => new Proxy(
549
+ {},
550
+ {
551
+ get: (n, e) => {
552
+ if (e !== "then")
553
+ return typeof e == "symbol" ? e === Symbol.toStringTag ? t : void 0 : he(t, e);
554
+ }
409
555
  }
410
- const e = E(t[0] ?? ""), i = E(t[1] ?? "");
411
- 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) {
415
- this.setFieldName = (r) => {
416
- this.key = r;
417
- }, this.setFieldValue = (r) => {
418
- this.value = r;
419
- }, this.setDescription = (r) => {
420
- this.description = r;
421
- }, this.key = t, this.value = e, this.description = i;
556
+ ), me = /\s*,\s*/, ge = /\s*-\s*/, b = (t) => {
557
+ const n = Number.parseInt(t.trim(), 10);
558
+ return !Number.isFinite(n) || n <= 0 ? null : n;
559
+ }, pe = (t) => {
560
+ const n = t.split(ge);
561
+ if (n.length === 1) {
562
+ const a = b(n[0] ?? "");
563
+ return a ? [a] : [];
564
+ }
565
+ const e = b(n[0] ?? ""), i = b(n[1] ?? "");
566
+ return !e || !i || i < e ? [] : Array.from({ length: i - e + 1 }, (a, r) => e + r);
567
+ }, ke = (t) => t ? t.split(me).flatMap((e) => pe(e)).filter((e, i, a) => a.indexOf(e) === i) : [];
568
+ class Se {
569
+ constructor(n, e, i) {
570
+ this.setFieldName = (a) => {
571
+ this.key = a;
572
+ }, this.setFieldValue = (a) => {
573
+ this.value = a;
574
+ }, this.setDescription = (a) => {
575
+ this.description = a;
576
+ }, this.key = n, this.value = e, this.description = i;
422
577
  }
423
578
  }
424
- class se {
579
+ class fe {
425
580
  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;
581
+ 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) => {
582
+ this.signType = n;
583
+ }, this.isCrossPageSideSign = () => this.signType === 2 || this.signType === 3, this.getSealPosition = () => this.sealPosition, this.setSignOnPageSides = (n) => {
584
+ n >= 0 && n <= 3 && (this.signType = n);
585
+ }, this.setSignPositionOnPageSides = (n) => {
586
+ this.sealPosition = n;
587
+ }, this.setPageRange = (n) => {
588
+ this.pageRange = n;
589
+ }, this.getPageRange = () => this.pageRange, this.getPageRanges = () => ke(this.pageRange), this.setSignUserData = (n) => {
590
+ this.signUserData = n;
591
+ }, this.setPrintMargin = (n) => {
592
+ this.printMargin = n;
593
+ }, this.getPrintMargin = () => this.printMargin ?? 0, this.setSignReason = (n) => {
594
+ this.signReason = n;
595
+ }, this.getSignReason = () => this.signReason, this.setSignLocation = (n) => {
596
+ this.signLocation = n;
597
+ }, this.getSignLocation = () => this.signLocation, this.setDefaultStampPassword = (n) => {
598
+ this.defaultStampPassword = n;
444
599
  };
445
600
  }
446
601
  }
447
- const de = /* @__PURE__ */ new Set([2, 5]), le = (n) => ({
602
+ const be = {
603
+ setSignServer: { kind: "command" },
604
+ addSignServerAuthCallback: {
605
+ kind: "callbackRegister",
606
+ callback: (t, n) => {
607
+ const e = n[0];
608
+ typeof e == "function" && t.signServerAuth.push(e);
609
+ }
610
+ },
611
+ setSignServerDefaultLogin: { kind: "command" },
612
+ setDefaultSignServerLogin: { kind: "command" },
613
+ setSignServerDefaultPassword: { kind: "command" },
614
+ setDefaultSignServerPassword: { kind: "command" },
615
+ loginNTKOSignServer: { kind: "command" },
616
+ loginSignServer: { kind: "callbackQuery" },
617
+ signOutSignServer: { kind: "command" },
618
+ isAuthenticatedOnSignServer: { kind: "stateGetter", state: () => !1 },
619
+ setSignServerLoginFromUSBKey: { kind: "command" },
620
+ setUserAuthSource: { kind: "command" }
621
+ };
622
+ class Te {
623
+ constructor(n) {
624
+ 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, a) => this.adapter.loginNTKOSignServer(e, i, a), this.loginSignServer = (e, i, a, r) => this.adapter.loginSignServer(e, i, a, r), 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 = c(
625
+ "signServer",
626
+ be,
627
+ n
628
+ );
629
+ }
630
+ }
631
+ const ve = {
632
+ createPDF417Barcode: { kind: "command" }
633
+ };
634
+ class Ae {
635
+ constructor(n) {
636
+ this.createPDF417Barcode = (e, i, a, r, s, o, l) => this.adapter.createPDF417Barcode(e, i, a, r, s, o, l), this.adapter = c(
637
+ "symbology",
638
+ ve,
639
+ n
640
+ );
641
+ }
642
+ }
643
+ const Re = {
644
+ setup: { kind: "command" },
645
+ create: { kind: "command" },
646
+ getMarkups: { kind: "callbackQuery" },
647
+ removeMarkup: { kind: "command" },
648
+ removeAllMarkups: { kind: "command" },
649
+ sign: { kind: "callbackQuery" }
650
+ };
651
+ class Ee {
652
+ constructor(n) {
653
+ 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 = c(
654
+ "templateSign",
655
+ Re,
656
+ n
657
+ );
658
+ }
659
+ }
660
+ const ye = /* @__PURE__ */ new Set([2, 5]), Pe = (t) => ({
448
661
  showToolbarMenu: { kind: "command" },
449
662
  hideToolbarMenu: { kind: "command" },
450
663
  setupToolbarMenu: { kind: "command" },
@@ -470,88 +683,88 @@ const de = /* @__PURE__ */ new Set([2, 5]), le = (n) => ({
470
683
  exitBookViewMode: { kind: "command" },
471
684
  isBookViewActivated: {
472
685
  kind: "stateGetter",
473
- state: () => de.has(n.state.snapshot().pageMode)
686
+ state: () => ye.has(t.state.snapshot().pageMode)
474
687
  },
475
688
  requestFullScreen: { kind: "command" },
476
689
  exitFullScreen: { kind: "command" },
477
690
  invalidateView: { kind: "command" }
478
691
  });
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);
692
+ class De {
693
+ constructor(n) {
694
+ 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, a) => this.adapter.setupRibbonMenuItem(e, i, a), 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", Pe(n), n);
482
695
  }
483
696
  }
484
- const ue = (n) => {
485
- if (!n)
697
+ const Ce = (t) => {
698
+ if (!t)
486
699
  return;
487
- const t = n.trim().toLowerCase();
488
- if (t === "application")
700
+ const n = t.trim().toLowerCase();
701
+ if (n === "application")
489
702
  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);
703
+ if (n === "light" || n === "dark" || n === "high-contrast" || n === "auto")
704
+ return n;
705
+ }, x = (t) => {
706
+ const n = new URL(t, globalThis.location?.href ?? "http://localhost/");
707
+ return n.hash = "", n.pathname.endsWith("/") || (n.pathname = `${n.pathname}/`), n.toString();
708
+ }, Ie = (t) => new URL("editors.bootstrap.js", t).toString(), we = (t, n) => {
709
+ const e = x(t);
497
710
  return {
498
- ...t,
711
+ ...n,
499
712
  appUrl: e,
500
- scrollIntoView: t.scrollIntoView ?? !0,
501
- theme: ue(t.theme)
713
+ scrollIntoView: n.scrollIntoView ?? !0,
714
+ theme: Ce(n.theme)
502
715
  };
503
- }, u = "rhc-office-editor", R = "__RHC_OFFICE_SDK_READER_LOADER__", B = () => {
504
- const n = globalThis;
505
- return n[R] || (n[R] = {
716
+ }, u = "rhc-office-editor", T = "__RHC_OFFICE_SDK_READER_LOADER__", B = () => {
717
+ const t = globalThis;
718
+ return t[T] || (t[T] = {
506
719
  activeAppUrl: null,
507
720
  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";
721
+ }), t[T];
722
+ }, Me = (t) => Array.from(document.querySelectorAll("script")).find((n) => n.src === t) ?? null;
723
+ class y extends Error {
724
+ constructor(n) {
725
+ super(`Failed to load reader bootstrap script: ${n}`), this.name = "ReaderScriptLoadError";
513
726
  }
514
727
  }
515
- class ge extends Error {
516
- constructor(t, e) {
728
+ class Oe extends Error {
729
+ constructor(n, e) {
517
730
  super(
518
- `Reader Web Component "${u}" is already bound to ${t} and cannot be reloaded from ${e}.`
731
+ `Reader Web Component "${u}" is already bound to ${n} and cannot be reloaded from ${e}.`
519
732
  ), this.name = "ReaderSourceConflictError";
520
733
  }
521
734
  }
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);
735
+ const V = (t) => {
736
+ const n = B();
737
+ if (n.activeAppUrl && n.activeAppUrl !== t)
738
+ throw new Oe(n.activeAppUrl, t);
739
+ }, _e = (t) => {
740
+ const n = B();
741
+ V(t);
742
+ const e = n.loadPromises.get(t);
530
743
  if (e)
531
744
  return e;
532
745
  if (globalThis.customElements?.get(u)) {
533
- t.activeAppUrl = n;
534
- const o = Promise.resolve();
535
- return t.loadPromises.set(n, o), o;
746
+ n.activeAppUrl = t;
747
+ const s = Promise.resolve();
748
+ return n.loadPromises.set(t, s), s;
536
749
  }
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));
750
+ const i = Ie(t), a = Me(i);
751
+ n.activeAppUrl = t;
752
+ const r = new Promise((s, o) => {
753
+ const l = (k) => {
754
+ k?.remove(), o(new y(i));
542
755
  }, m = () => {
543
756
  globalThis.customElements.whenDefined(u).then(() => {
544
- o();
545
- }).catch(s);
757
+ s();
758
+ }).catch(o);
546
759
  };
547
- if (r) {
760
+ if (a) {
548
761
  if (globalThis.customElements?.get(u)) {
549
- o();
762
+ s();
550
763
  return;
551
764
  }
552
- r.addEventListener(
765
+ a.addEventListener(
553
766
  "error",
554
- () => s(new S(i)),
767
+ () => o(new y(i)),
555
768
  {
556
769
  once: !0
557
770
  }
@@ -559,44 +772,44 @@ const x = (n) => {
559
772
  return;
560
773
  }
561
774
  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;
775
+ d.src = i, d.async = !0, d.dataset.rhcOfficeSdkReader = t, d.addEventListener("load", m, { once: !0 }), d.addEventListener("error", () => l(d), { once: !0 }), document.head.appendChild(d);
776
+ }).catch((s) => {
777
+ throw n.loadPromises.delete(t), !globalThis.customElements?.get(u) && n.activeAppUrl === t && (n.activeAppUrl = null), s;
565
778
  });
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;
779
+ return n.loadPromises.set(t, r), r;
780
+ }, Fe = 5e3, Le = 5e3, Ue = () => {
781
+ const t = globalThis.crypto;
782
+ return typeof t?.randomUUID == "function" ? t.randomUUID() : `adapter-${Date.now()}-${Math.random().toString(36).slice(2)}`;
783
+ }, g = () => globalThis[ee];
784
+ class Ne extends Error {
785
+ constructor(n, e, i) {
786
+ super(e), this.name = "ReaderBridgeError", this.code = n, this.details = i;
574
787
  }
575
788
  }
576
- class Pe {
577
- constructor(t) {
578
- this.readerId = null, this.readyTimeoutMs = t?.readyTimeoutMs ?? ve, this.requestTimeoutMs = t?.requestTimeoutMs ?? Re;
789
+ class xe {
790
+ constructor(n) {
791
+ this.readerId = null, this.readyTimeoutMs = n?.readyTimeoutMs ?? Le, this.requestTimeoutMs = n?.requestTimeoutMs ?? Fe;
579
792
  }
580
- configureTimeouts(t) {
581
- this.readyTimeoutMs = t?.readyTimeoutMs ?? this.readyTimeoutMs, this.requestTimeoutMs = t?.requestTimeoutMs ?? this.requestTimeoutMs;
793
+ configureTimeouts(n) {
794
+ this.readyTimeoutMs = n?.readyTimeoutMs ?? this.readyTimeoutMs, this.requestTimeoutMs = n?.requestTimeoutMs ?? this.requestTimeoutMs;
582
795
  }
583
- setReaderId(t) {
584
- this.readerId = t;
796
+ setReaderId(n) {
797
+ this.readerId = n;
585
798
  }
586
799
  getReaderId() {
587
800
  return this.readerId;
588
801
  }
589
- async request(t, e, i, r) {
590
- const a = await this.requestRaw(t, e, i, r);
591
- if (a.ok)
592
- return a.result;
593
- throw new Se(
594
- a.error.code,
595
- a.error.message,
596
- a.error.details
802
+ async request(n, e, i, a) {
803
+ const r = await this.requestRaw(n, e, i, a);
804
+ if (r.ok)
805
+ return r.result;
806
+ throw new Ne(
807
+ r.error.code,
808
+ r.error.message,
809
+ r.error.details
597
810
  );
598
811
  }
599
- async requestRaw(t, e, i, r) {
812
+ async requestRaw(n, e, i, a) {
600
813
  if (!this.readerId)
601
814
  return {
602
815
  ok: !1,
@@ -606,8 +819,8 @@ class Pe {
606
819
  message: "Reader is not mounted."
607
820
  }
608
821
  };
609
- const a = await this.waitForAdapter(this.readerId, r?.timeoutMs);
610
- if (!a)
822
+ const r = await this.waitForAdapter(this.readerId, a?.timeoutMs);
823
+ if (!r)
611
824
  return {
612
825
  ok: !1,
613
826
  requestId: "",
@@ -616,45 +829,45 @@ class Pe {
616
829
  message: "Editor adapter is not available."
617
830
  }
618
831
  };
619
- const o = {
620
- protocol: fe,
621
- version: be,
622
- requestId: ye(),
832
+ const s = {
833
+ protocol: J,
834
+ version: Z,
835
+ requestId: Ue(),
623
836
  readerId: this.readerId,
624
- tool: t,
837
+ tool: n,
625
838
  method: e,
626
839
  params: i
627
840
  };
628
841
  return this.withTimeout(
629
- a.request(o),
630
- o.requestId,
631
- r?.timeoutMs ?? this.requestTimeoutMs
842
+ r.request(s),
843
+ s.requestId,
844
+ a?.timeoutMs ?? this.requestTimeoutMs
632
845
  );
633
846
  }
634
847
  getCapabilities() {
635
848
  return this.readerId ? g()?.getCapabilities(this.readerId) ?? null : null;
636
849
  }
637
- async waitForAdapter(t, e = this.readyTimeoutMs) {
850
+ async waitForAdapter(n, e = this.readyTimeoutMs) {
638
851
  const i = g();
639
- return i?.getCapabilities(t) ? i : new Promise((r) => {
640
- 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)
852
+ return i?.getCapabilities(n) ? i : new Promise((a) => {
853
+ let r;
854
+ const s = () => {
855
+ r && clearTimeout(r), globalThis.removeEventListener(R, o);
856
+ }, o = (l) => {
857
+ if ((l instanceof CustomEvent ? l.detail : void 0)?.readerId !== n)
645
858
  return;
646
859
  const d = g();
647
- o(), r(d ?? null);
860
+ s(), a(d ?? null);
648
861
  };
649
- globalThis.addEventListener(P, s), a = setTimeout(() => {
650
- o(), r(g()?.getCapabilities(t) ? g() : null);
862
+ globalThis.addEventListener(R, o), r = setTimeout(() => {
863
+ s(), a(g()?.getCapabilities(n) ? g() : null);
651
864
  }, e);
652
865
  });
653
866
  }
654
- async withTimeout(t, e, i) {
655
- return new Promise((r) => {
656
- const a = setTimeout(() => {
657
- r({
867
+ async withTimeout(n, e, i) {
868
+ return new Promise((a) => {
869
+ const r = setTimeout(() => {
870
+ a({
658
871
  ok: !1,
659
872
  requestId: e,
660
873
  error: {
@@ -663,22 +876,22 @@ class Pe {
663
876
  }
664
877
  });
665
878
  }, i);
666
- t.then((o) => r(o)).catch((o) => {
667
- r({
879
+ n.then((s) => a(s)).catch((s) => {
880
+ a({
668
881
  ok: !1,
669
882
  requestId: e,
670
883
  error: {
671
884
  code: "EXECUTION_FAILED",
672
- message: o instanceof Error ? o.message : String(o)
885
+ message: s instanceof Error ? s.message : String(s)
673
886
  }
674
887
  });
675
888
  }).finally(() => {
676
- clearTimeout(a);
889
+ clearTimeout(r);
677
890
  });
678
891
  });
679
892
  }
680
893
  }
681
- const A = {
894
+ const P = {
682
895
  annotationEnabled: !1,
683
896
  documentModified: !1,
684
897
  documentOpened: !1,
@@ -687,35 +900,35 @@ const A = {
687
900
  pageMode: 0,
688
901
  zoomLevel: 100
689
902
  };
690
- class Ce {
903
+ class Be {
691
904
  constructor() {
692
- this.state = { ...A };
905
+ this.state = { ...P };
693
906
  }
694
907
  reset() {
695
- this.state = { ...A };
908
+ this.state = { ...P };
696
909
  }
697
- update(t) {
698
- t && (this.state = {
910
+ update(n) {
911
+ n && (this.state = {
699
912
  ...this.state,
700
- ...t
913
+ ...n
701
914
  });
702
915
  }
703
- setDocumentOpened(t) {
916
+ setDocumentOpened(n) {
704
917
  this.state = {
705
918
  ...this.state,
706
- documentOpened: t
919
+ documentOpened: n
707
920
  };
708
921
  }
709
922
  snapshot() {
710
923
  return { ...this.state };
711
924
  }
712
925
  }
713
- class Ae {
926
+ class Ve {
714
927
  constructor() {
715
- this.annotationEvents = [], this.annotationPersist = [], this.annotationRetrieve = [], this.digitalAnnotationRetrieve = [], this.digitalSignatureParse = [], this.digitalSignatureRetrieve = [], this.documentClosed = [], this.documentOpened = [], this.documentSaved = [], this.pageChange = [], this.pageModeChange = [];
928
+ 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
929
  }
717
- emit(t, e) {
718
- switch (t) {
930
+ emit(n, e) {
931
+ switch (n) {
719
932
  case "documentOpened":
720
933
  case "documentLoaded":
721
934
  this.documentOpened.forEach((i) => i("ok", ""));
@@ -729,19 +942,19 @@ class Ae {
729
942
  case "pageChange": {
730
943
  const i = e;
731
944
  this.pageChange.forEach(
732
- (r) => r(i.pageIndex ?? 1, i.pageCount ?? 0)
945
+ (a) => a(i.pageIndex ?? 1, i.pageCount ?? 0)
733
946
  );
734
947
  return;
735
948
  }
736
949
  case "pageModeChange": {
737
950
  const i = e;
738
- this.pageModeChange.forEach((r) => r(i.pageMode ?? 0));
951
+ this.pageModeChange.forEach((a) => a(i.pageMode ?? 0));
739
952
  return;
740
953
  }
741
954
  case "annotationEvent": {
742
955
  const i = e;
743
956
  this.annotationEvents.forEach(
744
- (r) => r(i.event ?? "annotationEvent", i.payload)
957
+ (a) => a(i.event ?? "annotationEvent", i.payload)
745
958
  );
746
959
  return;
747
960
  }
@@ -756,6 +969,9 @@ class Ae {
756
969
  (i) => i(Array.isArray(e) ? e : [])
757
970
  );
758
971
  return;
972
+ case "digitalSign":
973
+ this.digitalSign.forEach((i) => i(e));
974
+ return;
759
975
  case "digitalSignatureRetrieve":
760
976
  this.digitalSignatureRetrieve.forEach(
761
977
  (i) => i(Array.isArray(e) ? e : [])
@@ -766,92 +982,80 @@ class Ae {
766
982
  (i) => i(Array.isArray(e) ? e : [])
767
983
  );
768
984
  return;
985
+ case "signServerAuth":
986
+ this.signServerAuth.forEach((i) => i(e));
987
+ return;
769
988
  default:
770
989
  return;
771
990
  }
772
991
  }
773
992
  }
774
- const De = [
993
+ const Ke = [
775
994
  "documentLoaded",
776
995
  "documentStateChange",
777
996
  "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;
997
+ ], Ge = "readerReady", He = "readerUnload", v = "readerError", qe = () => typeof globalThis.crypto?.randomUUID == "function" ? globalThis.crypto.randomUUID() : `rhc-reader-${Date.now()}-${Math.random().toString(36).slice(2)}`, D = (t, n) => ({
998
+ appUrl: n?.appUrl ?? null,
999
+ configuration: n,
1000
+ element: t
1001
+ }), Qe = (t) => {
1002
+ if (typeof t == "string") {
1003
+ const n = document.getElementById(t);
1004
+ if (!n)
1005
+ throw new Error(`Reader container "${t}" was not found.`);
1006
+ if (!(n instanceof HTMLDivElement))
1007
+ throw new Error(`Reader container "${t}" must be a div element.`);
1008
+ return n;
790
1009
  }
791
- if (!(n instanceof HTMLDivElement))
1010
+ if (!(t instanceof HTMLDivElement))
792
1011
  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;
1012
+ return t;
1013
+ }, ze = () => {
1014
+ const t = typeof globalThis.matchMedia == "function";
1015
+ return (t ? globalThis.matchMedia("(prefers-contrast: more)").matches : !1) ? "high-contrast" : (t ? globalThis.matchMedia("(prefers-color-scheme: dark)").matches : !1) ? "dark" : "light";
1016
+ }, C = (t, n) => {
1017
+ const e = t;
799
1018
  if (typeof e.addEventListener == "function") {
800
- e.addEventListener("change", t);
1019
+ e.addEventListener("change", n);
801
1020
  return;
802
1021
  }
803
- typeof e.addListener == "function" && e.addListener(t);
804
- }, I = (n, t) => {
805
- const e = n;
1022
+ typeof e.addListener == "function" && e.addListener(n);
1023
+ }, I = (t, n) => {
1024
+ const e = t;
806
1025
  if (typeof e.removeEventListener == "function") {
807
- e.removeEventListener("change", t);
1026
+ e.removeEventListener("change", n);
808
1027
  return;
809
1028
  }
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;
1029
+ typeof e.removeListener == "function" && e.removeListener(n);
1030
+ }, We = (t, n) => {
1031
+ n.style && (t.style.cssText = n.style), t.style.display || (t.style.display = "block"), t.style.width ? n.width && (t.style.width = n.width) : t.style.width = n.width ?? "100%", t.style.height ? n.height && (t.style.height = n.height) : t.style.height = n.height ?? "100%";
1032
+ }, $e = (t, n) => {
1033
+ const e = n.theme;
815
1034
  if (!e)
816
- return n.removeAttribute("theme"), null;
1035
+ return t.removeAttribute("theme"), null;
817
1036
  if (e !== "auto")
818
- return n.setAttribute("theme", e), null;
1037
+ return t.setAttribute("theme", e), null;
819
1038
  const i = () => {
820
- n.setAttribute("theme", Fe());
1039
+ t.setAttribute("theme", ze());
821
1040
  };
822
1041
  if (i(), typeof globalThis.matchMedia != "function")
823
1042
  return null;
824
- const r = globalThis.matchMedia("(prefers-color-scheme: dark)"), a = globalThis.matchMedia("(prefers-contrast: more)"), o = () => {
1043
+ const a = globalThis.matchMedia("(prefers-color-scheme: dark)"), r = globalThis.matchMedia("(prefers-contrast: more)"), s = () => {
825
1044
  i();
826
1045
  };
827
- return M(r, o), M(a, o), () => {
828
- I(r, o), I(a, o);
1046
+ return C(a, s), C(r, s), () => {
1047
+ I(a, s), I(r, s);
829
1048
  };
830
1049
  };
831
- class Ue {
832
- constructor(t) {
833
- this.bridge = new Pe(), this.callbacks = new Ae(), this.readerState = new Ce(), this.bridgeToolContext = {
1050
+ class Ye {
1051
+ constructor(n) {
1052
+ this.bridge = new xe(), this.callbacks = new Ve(), this.readerState = new Be(), this.bridgeToolContext = {
834
1053
  bridge: this.bridge,
835
1054
  callbacks: this.callbacks,
836
1055
  debug: () => this.debugEnabled,
837
1056
  onAsyncError: (e) => this.reportAdapterError(e),
838
1057
  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) => {
1058
+ }, this.documentTool = new ne(this.bridgeToolContext), this.uiTool = new De(this.bridgeToolContext), this.pageTool = new de(this.bridgeToolContext), this.findTool = new ae(this.bridgeToolContext), this.signServerTool = new Te(this.bridgeToolContext), this.digitalSignTool = new X(this.bridgeToolContext), this.symbologyTool = new Ae(this.bridgeToolContext), this.annotationTool = new W(this.bridgeToolContext), this.templateSignTool = new Ee(this.bridgeToolContext), this.pdfFormFiller = new ce(this.bridgeToolContext), this.networkingTool = new se(this.bridgeToolContext), this.cryptoTool = new Y(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
1059
  this.debugEnabled = e;
856
1060
  }, this.changeLanguage = () => {
857
1061
  }, this.setLicense = (e, i) => {
@@ -878,50 +1082,50 @@ class Ue {
878
1082
  this.unloadCallbacks.push(e);
879
1083
  }, this.setReaderEventListener = (e) => {
880
1084
  this.readerEventListener = e;
881
- }, 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);
1085
+ }, this.embedReader = (e, i, a) => {
1086
+ const r = Qe(e), s = x(i);
1087
+ V(s);
1088
+ const o = we(s, a), l = this.mountToken + 1;
1089
+ this.removeReader(), this.mountToken = l, this.removed = !1, this.hostContainer = r, this.normalizedConfiguration = o, this.mountReader(r, o, l);
886
1090
  }, this.removeReader = () => {
887
1091
  const e = !!(this.readerElement || this.hostContainer);
888
1092
  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
1093
  return;
890
1094
  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) => {
1095
+ this.emitReaderEvent(He, i), this.unloadCallbacks.forEach((a) => a());
1096
+ }, 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 fe(), this.createKVField = (e, i, a) => new Se(e, i, a), this.mountReader = async (e, i, a) => {
893
1097
  try {
894
- if (await ke(i.appUrl), this.mountToken !== r)
1098
+ if (await _e(i.appUrl), this.mountToken !== a)
895
1099
  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)
1100
+ const r = document.createElement(u), s = qe();
1101
+ if (r.setAttribute(N, s), this.readerId = s, this.bridge.setReaderId(s), We(r, i), this.themeCleanup = $e(r, i), this.bindNativeReaderEvents(r), e.replaceChildren(r), this.readerElement = r, await Promise.resolve(), this.mountToken !== a)
898
1102
  return;
899
1103
  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());
902
- } catch (a) {
903
- if (this.mountToken !== r)
1104
+ const o = D(r, i);
1105
+ this.emitReaderEvent(Ge, o), this.readyCallbacks.forEach((l) => l());
1106
+ } catch (r) {
1107
+ if (this.mountToken !== a)
904
1108
  return;
905
- this.reportReaderError(a);
1109
+ this.reportReaderError(r);
906
1110
  }
907
1111
  }, this.bindNativeReaderEvents = (e) => {
908
1112
  this.cleanupNativeEventForwarders();
909
- const i = (r) => {
910
- const a = r instanceof CustomEvent ? r.detail : null;
911
- !a || a.readerId !== this.readerId || (this.readerState.update(a.statePatch), this.callbacks.emit(a.event, a.payload), this.emitReaderEvent(a.event, a.payload));
1113
+ const i = (a) => {
1114
+ const r = a instanceof CustomEvent ? a.detail : null;
1115
+ !r || r.readerId !== this.readerId || (this.readerState.update(r.statePatch), this.callbacks.emit(r.event, r.payload), this.emitReaderEvent(r.event, r.payload));
912
1116
  };
913
- e.addEventListener(C, i), this.nativeEventCleanupCallbacks.push(() => {
1117
+ e.addEventListener(E, i), this.nativeEventCleanupCallbacks.push(() => {
914
1118
  e.removeEventListener(
915
- C,
1119
+ E,
916
1120
  i
917
1121
  );
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);
1122
+ }), Ke.forEach((a) => {
1123
+ const r = (s) => {
1124
+ const o = s instanceof CustomEvent ? s.detail : s;
1125
+ a === "documentLoaded" && this.readerState.setDocumentOpened(!0), this.emitReaderEvent(a, o), a === "documentError" && this.emitReaderEvent(v, o);
922
1126
  };
923
- e.addEventListener(r, a), this.nativeEventCleanupCallbacks.push(() => {
924
- e.removeEventListener(r, a);
1127
+ e.addEventListener(a, r), this.nativeEventCleanupCallbacks.push(() => {
1128
+ e.removeEventListener(a, r);
925
1129
  });
926
1130
  });
927
1131
  }, this.cleanupNativeEventForwarders = () => {
@@ -935,98 +1139,37 @@ class Ue {
935
1139
  }, this.reportAdapterError = (e) => {
936
1140
  this.debugEnabled && console.error("[RHC Office SDK] Adapter command failed", e), this.emitReaderEvent(v, e);
937
1141
  }, this.bridge.configureTimeouts({
938
- readyTimeoutMs: t?.adapterReadyTimeoutMs,
939
- requestTimeoutMs: t?.adapterRequestTimeoutMs
1142
+ readyTimeoutMs: n?.adapterReadyTimeoutMs,
1143
+ requestTimeoutMs: n?.adapterRequestTimeoutMs
940
1144
  });
941
1145
  }
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
1146
  }
1020
- const He = (n) => new Ue(n);
1147
+ const it = (t) => new Ye(t);
1021
1148
  export {
1022
- Ge as DIGITAL_SIGN_DEFAULTS,
1023
- Ue as DocumentSDK,
1149
+ W as AnnotationToolImpl,
1150
+ Y as CryptoToolImpl,
1151
+ tt as DIGITAL_SIGN_DEFAULTS,
1152
+ fe as DigitalSignOptions,
1153
+ X as DigitalSignToolImpl,
1154
+ Ye as DocumentSDK,
1155
+ ne as DocumentToolImpl,
1156
+ ae as FindToolImpl,
1157
+ Se as KVField,
1158
+ se as NetworkingToolImpl,
1159
+ de as PageToolImpl,
1160
+ ce as PdfFormFillerImpl,
1161
+ ue as SDKPhase1NotImplementedError,
1162
+ Te as SignServerToolImpl,
1163
+ Ae as SymbologyToolImpl,
1164
+ Ee as TemplateSignToolImpl,
1165
+ De as UIToolImpl,
1024
1166
  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
1167
+ it as createNewDocumentSdk,
1168
+ nt as createPhase1ToolPlaceholder,
1169
+ je as getDigitalSignEnvironment,
1170
+ Xe as initializeDigitalSignEnvironment,
1171
+ Ze as patchDigitalSignEnvironment,
1172
+ et as resetDigitalSignEnvironment,
1173
+ Je as setDigitalSignEnvironment
1031
1174
  };
1032
1175
  //# sourceMappingURL=index.js.map