@rhc-office/sdk 6.6.351 → 6.6.363

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
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 = {
2
+ const F = "RIGHT_CENTER", U = "REGULAR_ESM", N = "auto", k = "__RHC_OFFICE_DIGITAL_SIGN_ENVIRONMENT__", y = {
3
3
  defaults: {
4
4
  bjca: {
5
5
  pin: ""
6
6
  },
7
7
  deviceType: "client",
8
- edgePosition: L,
8
+ edgePosition: F,
9
9
  kol: {
10
10
  appId: "",
11
11
  appName: "",
@@ -17,8 +17,8 @@ const L = "RIGHT_CENTER", F = "REGULAR_ESM", U = "auto", S = "__RHC_OFFICE_DIGIT
17
17
  pin: "",
18
18
  usbKeyType: 14
19
19
  },
20
- rsaMode: U,
21
- signatureType: F
20
+ rsaMode: N,
21
+ signatureType: U
22
22
  },
23
23
  signServer: {
24
24
  authSource: "Password",
@@ -38,7 +38,7 @@ const L = "RIGHT_CENTER", F = "REGULAR_ESM", U = "auto", S = "__RHC_OFFICE_DIGIT
38
38
  usbKeyType: 14
39
39
  }
40
40
  }
41
- }, N = (t) => ({
41
+ }, B = (t) => ({
42
42
  bjca: {
43
43
  pin: t.bjca.pin
44
44
  },
@@ -57,7 +57,7 @@ const L = "RIGHT_CENTER", F = "REGULAR_ESM", U = "auto", S = "__RHC_OFFICE_DIGIT
57
57
  },
58
58
  rsaMode: t.rsaMode,
59
59
  signatureType: t.signatureType
60
- }), B = (t) => ({
60
+ }), x = (t) => ({
61
61
  authSource: t.authSource,
62
62
  defaultLogin: t.defaultLogin,
63
63
  defaultPassword: t.defaultPassword,
@@ -75,9 +75,9 @@ const L = "RIGHT_CENTER", F = "REGULAR_ESM", U = "auto", S = "__RHC_OFFICE_DIGIT
75
75
  usbKeyType: t.usbKey.usbKeyType
76
76
  }
77
77
  }), m = (t) => ({
78
- defaults: N(t.defaults),
79
- signServer: B(t.signServer)
80
- }), x = (t) => ({
78
+ defaults: B(t.defaults),
79
+ signServer: x(t.signServer)
80
+ }), V = (t) => ({
81
81
  defaults: t.defaults ? {
82
82
  ...t.defaults,
83
83
  bjca: t.defaults.bjca ? { ...t.defaults.bjca } : void 0,
@@ -108,7 +108,7 @@ const L = "RIGHT_CENTER", F = "REGULAR_ESM", U = "auto", S = "__RHC_OFFICE_DIGIT
108
108
  },
109
109
  rsaMode: n.rsaMode ?? t.rsaMode,
110
110
  signatureType: n.signatureType ?? t.signatureType
111
- } : N(t), j = (t, n) => n ? {
111
+ } : B(t), j = (t, n) => n ? {
112
112
  authSource: n.authSource ?? t.authSource,
113
113
  defaultLogin: n.defaultLogin ?? t.defaultLogin,
114
114
  defaultPassword: n.defaultPassword ?? t.defaultPassword,
@@ -125,10 +125,10 @@ const L = "RIGHT_CENTER", F = "REGULAR_ESM", U = "auto", S = "__RHC_OFFICE_DIGIT
125
125
  checkCertificateBinding: n.usbKey?.checkCertificateBinding ?? t.usbKey.checkCertificateBinding,
126
126
  usbKeyType: n.usbKey?.usbKeyType ?? t.usbKey.usbKeyType
127
127
  }
128
- } : B(t), V = (t, n) => ({
128
+ } : x(t), K = (t, n) => ({
129
129
  defaults: $(t.defaults, n.defaults),
130
130
  signServer: j(t.signServer, n.signServer)
131
- }), Y = (t, n) => ({
131
+ }), X = (t, n) => ({
132
132
  defaults: t.defaults || n.defaults ? {
133
133
  ...t.defaults,
134
134
  ...n.defaults,
@@ -157,30 +157,30 @@ const L = "RIGHT_CENTER", F = "REGULAR_ESM", U = "auto", S = "__RHC_OFFICE_DIGIT
157
157
  ...n.signServer?.usbKey ?? {}
158
158
  }
159
159
  } : void 0
160
- }), X = () => globalThis, b = () => {
161
- const t = X();
162
- return t[S] || (t[S] = {
163
- current: m(v),
164
- defaults: m(v),
160
+ }), J = () => globalThis, b = () => {
161
+ const t = J();
162
+ return t[k] || (t[k] = {
163
+ current: m(y),
164
+ defaults: m(y),
165
165
  overrides: {}
166
- }), t[S];
167
- }, dt = () => b().current, ut = (t) => {
166
+ }), t[k];
167
+ }, lt = () => b().current, ct = (t) => {
168
168
  const n = b();
169
- return n.defaults = m(t), n.current = V(n.defaults, n.overrides), n.current;
170
- }, lt = (t) => {
169
+ return n.defaults = m(t), n.current = K(n.defaults, n.overrides), n.current;
170
+ }, ht = (t) => {
171
171
  const n = b();
172
- return n.current = m(t), n.overrides = x(t), n.current;
173
- }, ct = (t) => {
172
+ return n.current = m(t), n.overrides = V(t), n.current;
173
+ }, gt = (t) => {
174
174
  const n = b();
175
- return n.overrides = Y(n.overrides, x(t)), n.current = V(n.current, t), n.current;
176
- }, ht = (t) => {
175
+ return n.overrides = X(n.overrides, V(t)), n.current = K(n.current, t), n.current;
176
+ }, mt = (t) => {
177
177
  const n = b();
178
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) => {
179
+ }, pt = {
180
+ EDGE_POSITION: F,
181
+ RSA_MODE: N,
182
+ SIGNATURE_TYPE: U
183
+ }, R = (t) => {
184
184
  if (t.length !== 0)
185
185
  return t.length === 1 ? t[0] : t;
186
186
  }, d = (t, n, e) => new Proxy(
@@ -201,16 +201,16 @@ const L = "RIGHT_CENTER", F = "REGULAR_ESM", U = "auto", S = "__RHC_OFFICE_DIGIT
201
201
  return a.state?.(e.state.snapshot(), s);
202
202
  const o = a.adapterMethod ?? r;
203
203
  if (a.kind === "query")
204
- return e.bridge.request(t, o, k(s));
204
+ return e.bridge.request(t, o, R(s));
205
205
  if (a.kind === "callbackQuery") {
206
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);
207
+ e.bridge.request(t, o, R(l)).then((h) => {
208
+ const Y = a.mapCallbackResult?.(h) ?? [h];
209
+ c?.(...Y);
210
210
  }).catch(e.onAsyncError);
211
211
  return;
212
212
  }
213
- const u = e.bridge.request(t, o, k(s)).catch((c) => {
213
+ const u = e.bridge.request(t, o, R(s)).catch((c) => {
214
214
  e.onAsyncError(c);
215
215
  });
216
216
  if (a.returnsResult)
@@ -221,7 +221,7 @@ const L = "RIGHT_CENTER", F = "REGULAR_ESM", U = "auto", S = "__RHC_OFFICE_DIGIT
221
221
  };
222
222
  }
223
223
  }
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) => {
224
+ ), Z = (t) => typeof t == "object" && t !== null && !Array.isArray(t) && "id" in t, E = (t) => t.annotations?.filter(Z).map((n) => ({ ...n })) ?? [], ee = (t) => {
225
225
  switch (t) {
226
226
  case "select":
227
227
  case "pen":
@@ -241,7 +241,7 @@ const L = "RIGHT_CENTER", F = "REGULAR_ESM", U = "auto", S = "__RHC_OFFICE_DIGIT
241
241
  default:
242
242
  return "none";
243
243
  }
244
- }, ee = {
244
+ }, te = {
245
245
  addAnnotationEventCallback: {
246
246
  kind: "callbackRegister",
247
247
  callback: (t, n) => {
@@ -255,15 +255,15 @@ const L = "RIGHT_CENTER", F = "REGULAR_ESM", U = "auto", S = "__RHC_OFFICE_DIGIT
255
255
  },
256
256
  getAnnotationMode: {
257
257
  kind: "stateGetter",
258
- state: (t) => Z(t.annotationMode)
258
+ state: (t) => ee(t.annotationMode)
259
259
  },
260
260
  getAnnotations: {
261
261
  kind: "stateGetter",
262
- state: (t) => y(t)
262
+ state: (t) => E(t)
263
263
  },
264
264
  getAnnotationsCount: {
265
265
  kind: "stateGetter",
266
- state: (t) => y(t).length
266
+ state: (t) => E(t).length
267
267
  },
268
268
  openAnnotationView: { kind: "command" },
269
269
  closeAnnotationView: { kind: "command" },
@@ -275,29 +275,32 @@ const L = "RIGHT_CENTER", F = "REGULAR_ESM", U = "auto", S = "__RHC_OFFICE_DIGIT
275
275
  canRedoAnnotation: { kind: "query" },
276
276
  selectAnnotationTool: { kind: "command" },
277
277
  selectAnnotationStamp: { kind: "command" },
278
+ getCustomStamps: { kind: "query" },
279
+ addCustomTextStamp: { kind: "query" },
280
+ addCustomImageStamp: { kind: "query" },
278
281
  setAnnotationPenColor: { kind: "command" },
279
282
  setAnnotationPenWidth: { kind: "command" },
280
283
  setAnnotationPenStyle: { kind: "command" }
281
284
  };
282
- class te {
285
+ class ne {
283
286
  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(
287
+ 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.getCustomStamps = () => this.adapter.getCustomStamps(), this.addCustomTextStamp = (e) => this.adapter.addCustomTextStamp(e), this.addCustomImageStamp = (e) => this.adapter.addCustomImageStamp(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
288
  "annotation",
286
- ee,
289
+ te,
287
290
  n
288
291
  );
289
292
  }
290
293
  }
291
- const ne = {
294
+ const ie = {
292
295
  configSecurityProvider: { kind: "command" },
293
296
  getSecurityProviders: { kind: "query" }
294
297
  };
295
- class ie {
298
+ class re {
296
299
  constructor(n) {
297
- this.configSecurityProvider = (e) => this.adapter.configSecurityProvider(e), this.getSecurityProviders = () => this.adapter.getSecurityProviders(), this.adapter = d("crypto", ne, n);
300
+ this.configSecurityProvider = (e) => this.adapter.configSecurityProvider(e), this.getSecurityProviders = () => this.adapter.getSecurityProviders(), this.adapter = d("crypto", ie, n);
298
301
  }
299
302
  }
300
- const E = (t) => t.digitalSignatures ? [...t.digitalSignatures] : [], re = {
303
+ const P = (t) => t.digitalSignatures ? [...t.digitalSignatures] : [], ae = {
301
304
  addDigitalSignatureRetrieveCallback: {
302
305
  kind: "callbackRegister",
303
306
  callback: (t, n) => {
@@ -334,25 +337,25 @@ const E = (t) => t.digitalSignatures ? [...t.digitalSignatures] : [], re = {
334
337
  listDigitalSignatures: { kind: "callbackQuery" },
335
338
  getDigitalSignatures: {
336
339
  kind: "stateGetter",
337
- state: (t) => E(t)
340
+ state: (t) => P(t)
338
341
  },
339
342
  getDigitalSignaturesCount: {
340
343
  kind: "stateGetter",
341
- state: (t) => E(t).length
344
+ state: (t) => P(t).length
342
345
  },
343
346
  enableDigitalSignatureInfoView: { kind: "command" },
344
347
  enableDigitalSignatureRevocation: { kind: "command" }
345
348
  };
346
- class ae {
349
+ class se {
347
350
  constructor(n) {
348
351
  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
352
  "digitalSign",
350
- re,
353
+ ae,
351
354
  n
352
355
  );
353
356
  }
354
357
  }
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 = {
358
+ const oe = "rhc-office.editor-adapter", de = 1, ue = "__RHC_OFFICE_EDITOR_ADAPTER__", C = "rhcOfficeAdapterReady", A = "rhcOfficeAdapterEvent", G = "data-rhc-office-reader-id", le = {
356
359
  addDocumentOpenedCallback: {
357
360
  kind: "callbackRegister",
358
361
  callback: (t, n) => {
@@ -401,7 +404,7 @@ const se = "rhc-office.editor-adapter", oe = 1, de = "__RHC_OFFICE_EDITOR_ADAPTE
401
404
  print: { kind: "command" },
402
405
  createPreview: { kind: "command" }
403
406
  };
404
- class le {
407
+ class ce {
405
408
  constructor(n) {
406
409
  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
410
  const i = this.context.bridge.getReaderId();
@@ -413,41 +416,41 @@ class le {
413
416
  error: "Reader is not mounted or does not expose saveAs."
414
417
  });
415
418
  const r = document.querySelector(
416
- `[${K}="${i}"]`
419
+ `[${G}="${i}"]`
417
420
  );
418
421
  return typeof r?.saveAs == "function" ? r.saveAs(e) : this.adapter.saveAs(e);
419
422
  }, 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(
420
423
  "document",
421
- ue,
424
+ le,
422
425
  n
423
426
  );
424
427
  }
425
428
  }
426
- const ce = {
429
+ const he = {
427
430
  clearFind: { kind: "command" },
428
431
  findNext: { kind: "command" },
429
432
  findPrevious: { kind: "command" }
430
433
  };
431
- class he {
434
+ class ge {
432
435
  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);
436
+ this.clearFind = () => this.adapter.clearFind(), this.findNext = (e) => this.adapter.findNext(e), this.findPrevious = (e) => this.adapter.findPrevious(e), this.adapter = d("find", he, n);
434
437
  }
435
438
  }
436
- const ge = {
439
+ const me = {
437
440
  configFileUpload: { kind: "command" },
438
441
  setHttpHeaders: { kind: "command" },
439
442
  setHttpFormFields: { kind: "command" }
440
443
  };
441
- class me {
444
+ class pe {
442
445
  constructor(n) {
443
446
  this.configFileUpload = (e) => this.adapter.configFileUpload(e), this.setHttpHeaders = (e) => this.adapter.setHttpHeaders(e), this.setHttpFormFields = (e) => this.adapter.setHttpFormFields(e), this.adapter = d(
444
447
  "networking",
445
- ge,
448
+ me,
446
449
  n
447
450
  );
448
451
  }
449
452
  }
450
- const pe = () => ({
453
+ const be = () => ({
451
454
  clearContent: { kind: "command", returnsResult: !0 },
452
455
  commit: { kind: "command", returnsResult: !0 },
453
456
  deletePages: { kind: "command", returnsResult: !0 },
@@ -462,17 +465,17 @@ const pe = () => ({
462
465
  rotateLeft: { kind: "command", returnsResult: !0 },
463
466
  rotateRight: { kind: "command", returnsResult: !0 },
464
467
  undo: { kind: "command", returnsResult: !0 }
465
- }), be = (t) => t instanceof Uint8Array ? t : new Uint8Array(t);
466
- class Se {
468
+ }), Se = (t) => t instanceof Uint8Array ? t : new Uint8Array(t);
469
+ class ke {
467
470
  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(
471
+ 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(Se(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
472
  "pageArrange",
470
- pe(),
473
+ be(),
471
474
  n
472
475
  );
473
476
  }
474
477
  }
475
- const ke = (t) => ({
478
+ const Re = (t) => ({
476
479
  addPageChangeCallback: {
477
480
  kind: "callbackRegister",
478
481
  callback: (n, e) => {
@@ -526,12 +529,12 @@ class fe {
526
529
  constructor(n) {
527
530
  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(
528
531
  "page",
529
- ke(n),
532
+ Re(n),
530
533
  n
531
534
  );
532
535
  }
533
536
  }
534
- const Re = {
537
+ const Te = {
535
538
  open: { kind: "command" },
536
539
  setFormFieldValue: { kind: "command" },
537
540
  setFormFieldReadonly: { kind: "command" },
@@ -548,28 +551,28 @@ const Re = {
548
551
  mapCallbackResult: (t) => [Array.isArray(t) ? t : []]
549
552
  }
550
553
  };
551
- class Te {
554
+ class ve {
552
555
  constructor(n) {
553
556
  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(
554
557
  "pdfFormFiller",
555
- Re,
558
+ Te,
556
559
  n
557
560
  );
558
561
  }
559
562
  }
560
- const ve = /\s*,\s*/, ye = /\s*-\s*/, f = (t) => {
563
+ const ye = /\s*,\s*/, Ee = /\s*-\s*/, f = (t) => {
561
564
  const n = Number.parseInt(t.trim(), 10);
562
565
  return !Number.isFinite(n) || n <= 0 ? null : n;
563
- }, Ee = (t) => {
564
- const n = t.split(ye);
566
+ }, Pe = (t) => {
567
+ const n = t.split(Ee);
565
568
  if (n.length === 1) {
566
569
  const r = f(n[0] ?? "");
567
570
  return r ? [r] : [];
568
571
  }
569
572
  const e = f(n[0] ?? ""), i = f(n[1] ?? "");
570
573
  return !e || !i || i < e ? [] : Array.from({ length: i - e + 1 }, (r, a) => e + a);
571
- }, Pe = (t) => t ? t.split(ve).flatMap((e) => Ee(e)).filter((e, i, r) => r.indexOf(e) === i) : [];
572
- class Ce {
574
+ }, Ce = (t) => t ? t.split(ye).flatMap((e) => Pe(e)).filter((e, i, r) => r.indexOf(e) === i) : [];
575
+ class Ae {
573
576
  constructor(n, e, i) {
574
577
  this.setFieldName = (r) => {
575
578
  this.key = r;
@@ -590,7 +593,7 @@ class De {
590
593
  this.sealPosition = n;
591
594
  }, this.setPageRange = (n) => {
592
595
  this.pageRange = n;
593
- }, this.getPageRange = () => this.pageRange, this.getPageRanges = () => Pe(this.pageRange), this.setSignUserData = (n) => {
596
+ }, this.getPageRange = () => this.pageRange, this.getPageRanges = () => Ce(this.pageRange), this.setSignUserData = (n) => {
594
597
  this.signUserData = n;
595
598
  }, this.setPrintMargin = (n) => {
596
599
  this.printMargin = n;
@@ -603,23 +606,23 @@ class De {
603
606
  };
604
607
  }
605
608
  }
606
- const Ae = {
609
+ const Me = {
607
610
  getSecuritySettings: { kind: "query" },
608
611
  isSecuritySettingsLocalEditable: { kind: "query" },
609
612
  setSecuritySettingsLocalEditable: { kind: "query" },
610
613
  setSecuritySettings: { kind: "query" },
611
614
  openSecuritySettingsDialog: { kind: "command" }
612
615
  };
613
- class Me {
616
+ class we {
614
617
  constructor(n) {
615
618
  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
619
  "security",
617
- Ae,
620
+ Me,
618
621
  n
619
622
  );
620
623
  }
621
624
  }
622
- const we = {
625
+ const Ie = {
623
626
  setSignServer: { kind: "command" },
624
627
  addSignServerAuthCallback: {
625
628
  kind: "callbackRegister",
@@ -639,11 +642,11 @@ const we = {
639
642
  setSignServerLoginFromUSBKey: { kind: "command" },
640
643
  setUserAuthSource: { kind: "command" }
641
644
  };
642
- class Ie {
645
+ class _e {
643
646
  constructor(n) {
644
647
  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
648
  "signServer",
646
- we,
649
+ Ie,
647
650
  n
648
651
  );
649
652
  }
@@ -651,7 +654,7 @@ class Ie {
651
654
  const Oe = {
652
655
  createPDF417Barcode: { kind: "command" }
653
656
  };
654
- class _e {
657
+ class Le {
655
658
  constructor(n) {
656
659
  this.createPDF417Barcode = (e, i, r, a, s, o, u) => this.adapter.createPDF417Barcode(e, i, r, a, s, o, u), this.adapter = d(
657
660
  "symbology",
@@ -660,7 +663,7 @@ class _e {
660
663
  );
661
664
  }
662
665
  }
663
- const Le = {
666
+ const Fe = {
664
667
  setup: { kind: "command" },
665
668
  create: { kind: "command" },
666
669
  getMarkups: { kind: "callbackQuery" },
@@ -668,16 +671,16 @@ const Le = {
668
671
  removeAllMarkups: { kind: "command" },
669
672
  sign: { kind: "callbackQuery" }
670
673
  };
671
- class Fe {
674
+ class Ue {
672
675
  constructor(n) {
673
676
  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
677
  "templateSign",
675
- Le,
678
+ Fe,
676
679
  n
677
680
  );
678
681
  }
679
682
  }
680
- const Ue = /* @__PURE__ */ new Set([2, 5]), Ne = (t) => ({
683
+ const Ne = /* @__PURE__ */ new Set([2, 5]), Be = (t) => ({
681
684
  showToolbarMenu: { kind: "command" },
682
685
  hideToolbarMenu: { kind: "command" },
683
686
  setupToolbarMenu: { kind: "command" },
@@ -715,13 +718,13 @@ const Ue = /* @__PURE__ */ new Set([2, 5]), Ne = (t) => ({
715
718
  exitBookViewMode: { kind: "command" },
716
719
  isBookViewActivated: {
717
720
  kind: "stateGetter",
718
- state: () => Ue.has(t.state.snapshot().pageMode)
721
+ state: () => Ne.has(t.state.snapshot().pageMode)
719
722
  },
720
723
  requestFullScreen: { kind: "command" },
721
724
  exitFullScreen: { kind: "command" },
722
725
  invalidateView: { kind: "command" }
723
726
  });
724
- class Be {
727
+ class xe {
725
728
  constructor(n) {
726
729
  this.showToolbarMenu = () => (this.warnLegacyRibbonMethod("showToolbarMenu", "showRibbonMenu"), this.showRibbonMenu()), this.hideToolbarMenu = () => (this.warnLegacyRibbonMethod("hideToolbarMenu", "hideRibbonMenu"), this.hideRibbonMenu()), this.setupToolbarMenu = (e) => (this.warnLegacyRibbonMethod(
727
730
  "setupToolbarMenu",
@@ -729,13 +732,13 @@ class Be {
729
732
  ), 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
733
  "setupRibbonMenu",
731
734
  "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);
735
+ ), 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", Be(n), n);
733
736
  }
734
737
  warnLegacyRibbonMethod(n, e) {
735
738
  console.warn(`[RHC Office SDK] ui.${n} is deprecated. Use ui.${e} instead.`);
736
739
  }
737
740
  }
738
- const xe = (t) => {
741
+ const Ve = (t) => {
739
742
  if (!t)
740
743
  return;
741
744
  const n = t.trim().toLowerCase();
@@ -743,42 +746,42 @@ const xe = (t) => {
743
746
  return "auto";
744
747
  if (n === "light" || n === "dark" || n === "high-contrast" || n === "auto")
745
748
  return n;
746
- }, G = (t) => {
749
+ }, q = (t) => {
747
750
  const n = new URL(t, globalThis.location?.href ?? "http://localhost/");
748
751
  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);
752
+ }, Ke = (t) => new URL("editors.bootstrap.js", t).toString(), Ge = (t, n) => {
753
+ const e = q(t);
751
754
  return {
752
755
  ...n,
753
756
  appUrl: e,
754
- theme: xe(n.theme)
757
+ theme: Ve(n.theme)
755
758
  };
756
- }, g = "rhc-office-editor", R = "__RHC_OFFICE_SDK_READER_LOADER__", q = () => {
759
+ }, g = "rhc-office-editor", T = "__RHC_OFFICE_SDK_READER_LOADER__", H = () => {
757
760
  const t = globalThis;
758
- return t[R] || (t[R] = {
761
+ return t[T] || (t[T] = {
759
762
  activeAppUrl: null,
760
763
  loadPromises: /* @__PURE__ */ new Map()
761
- }), t[R];
762
- }, Ge = (t) => Array.from(document.querySelectorAll("script")).find((n) => n.src === t) ?? null;
764
+ }), t[T];
765
+ }, qe = (t) => Array.from(document.querySelectorAll("script")).find((n) => n.src === t) ?? null;
763
766
  class D extends Error {
764
767
  constructor(n) {
765
768
  super(`Failed to load reader bootstrap script: ${n}`), this.name = "ReaderScriptLoadError";
766
769
  }
767
770
  }
768
- class qe extends Error {
771
+ class He extends Error {
769
772
  constructor(n, e) {
770
773
  super(
771
774
  `Reader Web Component "${g}" is already bound to ${n} and cannot be reloaded from ${e}.`
772
775
  ), this.name = "ReaderSourceConflictError";
773
776
  }
774
777
  }
775
- const H = (t) => {
776
- const n = q();
778
+ const z = (t) => {
779
+ const n = H();
777
780
  if (n.activeAppUrl && n.activeAppUrl !== t)
778
- throw new qe(n.activeAppUrl, t);
779
- }, He = (t) => {
780
- const n = q();
781
- H(t);
781
+ throw new He(n.activeAppUrl, t);
782
+ }, ze = (t) => {
783
+ const n = H();
784
+ z(t);
782
785
  const e = n.loadPromises.get(t);
783
786
  if (e)
784
787
  return e;
@@ -787,7 +790,7 @@ const H = (t) => {
787
790
  const s = Promise.resolve();
788
791
  return n.loadPromises.set(t, s), s;
789
792
  }
790
- const i = Ve(t), r = Ge(i);
793
+ const i = Ke(t), r = qe(i);
791
794
  n.activeAppUrl = t;
792
795
  const a = new Promise((s, o) => {
793
796
  const u = (h) => {
@@ -817,10 +820,10 @@ const H = (t) => {
817
820
  throw n.loadPromises.delete(t), !globalThis.customElements?.get(g) && n.activeAppUrl === t && (n.activeAppUrl = null), s;
818
821
  });
819
822
  return n.loadPromises.set(t, a), a;
820
- }, ze = 5e3, Qe = 5e3, We = () => {
823
+ }, Qe = 5e3, Ye = 5e3, We = () => {
821
824
  const t = globalThis.crypto;
822
825
  return typeof t?.randomUUID == "function" ? t.randomUUID() : `adapter-${Date.now()}-${Math.random().toString(36).slice(2)}`;
823
- }, p = () => globalThis[de];
826
+ }, p = () => globalThis[ue];
824
827
  class $e extends Error {
825
828
  constructor(n, e, i) {
826
829
  super(e), this.name = "ReaderBridgeError", this.code = n, this.details = i;
@@ -828,7 +831,7 @@ class $e extends Error {
828
831
  }
829
832
  class je {
830
833
  constructor(n) {
831
- this.readerId = null, this.readyTimeoutMs = n?.readyTimeoutMs ?? Qe, this.requestTimeoutMs = n?.requestTimeoutMs ?? ze;
834
+ this.readerId = null, this.readyTimeoutMs = n?.readyTimeoutMs ?? Ye, this.requestTimeoutMs = n?.requestTimeoutMs ?? Qe;
832
835
  }
833
836
  configureTimeouts(n) {
834
837
  this.readyTimeoutMs = n?.readyTimeoutMs ?? this.readyTimeoutMs, this.requestTimeoutMs = n?.requestTimeoutMs ?? this.requestTimeoutMs;
@@ -870,8 +873,8 @@ class je {
870
873
  }
871
874
  };
872
875
  const s = {
873
- protocol: se,
874
- version: oe,
876
+ protocol: oe,
877
+ version: de,
875
878
  requestId: We(),
876
879
  readerId: this.readerId,
877
880
  tool: n,
@@ -895,14 +898,14 @@ class je {
895
898
  return i?.getCapabilities(n) ? i : new Promise((r) => {
896
899
  let a;
897
900
  const s = () => {
898
- a && clearTimeout(a), globalThis.removeEventListener(P, o);
901
+ a && clearTimeout(a), globalThis.removeEventListener(C, o);
899
902
  }, o = (u) => {
900
903
  if ((u instanceof CustomEvent ? u.detail : void 0)?.readerId !== n)
901
904
  return;
902
905
  const l = p();
903
906
  s(), r(l ?? null);
904
907
  };
905
- globalThis.addEventListener(P, o), a = setTimeout(() => {
908
+ globalThis.addEventListener(C, o), a = setTimeout(() => {
906
909
  s(), r(p()?.getCapabilities(n) ? p() : null);
907
910
  }, e);
908
911
  });
@@ -934,7 +937,7 @@ class je {
934
937
  });
935
938
  }
936
939
  }
937
- const A = {
940
+ const M = {
938
941
  annotationEnabled: !1,
939
942
  documentModified: !1,
940
943
  documentOpened: !1,
@@ -943,12 +946,12 @@ const A = {
943
946
  pageMode: 0,
944
947
  zoomLevel: 100
945
948
  };
946
- class Ye {
949
+ class Xe {
947
950
  constructor() {
948
- this.state = { ...A };
951
+ this.state = { ...M };
949
952
  }
950
953
  reset() {
951
- this.state = { ...A };
954
+ this.state = { ...M };
952
955
  }
953
956
  update(n) {
954
957
  n && (this.state = {
@@ -972,18 +975,18 @@ class Ye {
972
975
  };
973
976
  }
974
977
  }
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))
978
+ const Je = (t) => typeof t == "object" && t !== null && !Array.isArray(t) ? t : void 0, Q = (t) => typeof t == "object" && t !== null && !Array.isArray(t), w = (t) => {
979
+ if (!Q(t))
977
980
  return;
978
981
  const n = {};
979
982
  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))
983
+ }, Ze = (t) => {
984
+ if (!Q(t))
982
985
  return {
983
986
  success: !0,
984
987
  status: "ok"
985
988
  };
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";
989
+ const n = w(t.state), e = w(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
990
  return {
988
991
  success: r,
989
992
  status: a,
@@ -991,7 +994,7 @@ const Xe = (t) => typeof t == "object" && t !== null && !Array.isArray(t) ? t :
991
994
  state: n ?? e
992
995
  };
993
996
  };
994
- class Ze {
997
+ class et {
995
998
  constructor() {
996
999
  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 = [];
997
1000
  }
@@ -999,7 +1002,7 @@ class Ze {
999
1002
  switch (n) {
1000
1003
  case "documentOpened":
1001
1004
  case "documentLoaded": {
1002
- const i = Je(e);
1005
+ const i = Ze(e);
1003
1006
  this.documentOpened.forEach(
1004
1007
  (r) => r(i.status ?? "ok", i.error ?? "", i)
1005
1008
  );
@@ -1028,7 +1031,7 @@ class Ze {
1028
1031
  this.annotationEvents.forEach(
1029
1032
  (r) => r(
1030
1033
  i.event ?? "annotationEvent",
1031
- Xe(i.payload)
1034
+ Je(i.payload)
1032
1035
  )
1033
1036
  );
1034
1037
  return;
@@ -1065,15 +1068,15 @@ class Ze {
1065
1068
  }
1066
1069
  }
1067
1070
  }
1068
- const et = [
1071
+ const S = "__RHC_OFFICE_READER_RUNTIME__", tt = "__rhcOfficeReaderRuntimeConfig", nt = [
1069
1072
  "documentLoaded",
1070
1073
  "documentStateChange",
1071
1074
  "documentError"
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) => ({
1075
+ ], it = "readerReady", rt = "readerUnload", v = "readerError", at = () => typeof globalThis.crypto?.randomUUID == "function" ? globalThis.crypto.randomUUID() : `rhc-reader-${Date.now()}-${Math.random().toString(36).slice(2)}`, I = (t, n) => ({
1073
1076
  appUrl: n?.appUrl ?? null,
1074
1077
  configuration: n,
1075
1078
  element: t
1076
- }), rt = (t) => {
1079
+ }), st = (t) => {
1077
1080
  if (typeof t == "string") {
1078
1081
  const n = document.getElementById(t);
1079
1082
  if (!n)
@@ -1085,10 +1088,10 @@ const et = [
1085
1088
  if (!(t instanceof HTMLDivElement))
1086
1089
  throw new Error("Reader container must be a div element.");
1087
1090
  return t;
1088
- }, at = () => {
1091
+ }, ot = () => {
1089
1092
  const t = typeof globalThis.matchMedia == "function";
1090
1093
  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) => {
1094
+ }, _ = (t, n) => {
1092
1095
  const e = t;
1093
1096
  if (typeof e.addEventListener == "function") {
1094
1097
  e.addEventListener("change", n);
@@ -1102,35 +1105,35 @@ const et = [
1102
1105
  return;
1103
1106
  }
1104
1107
  typeof e.removeListener == "function" && e.removeListener(n);
1105
- }, st = (t) => {
1108
+ }, dt = (t) => {
1106
1109
  t.style.display || (t.style.display = "block"), t.style.width || (t.style.width = "100%"), t.style.height || (t.style.height = "100%");
1107
- }, _ = (t, n) => {
1110
+ }, L = (t, n) => {
1108
1111
  const e = n;
1109
1112
  if (!e)
1110
1113
  return t.removeAttribute("theme"), null;
1111
1114
  if (e !== "auto")
1112
1115
  return t.setAttribute("theme", e), null;
1113
1116
  const i = () => {
1114
- t.setAttribute("theme", at());
1117
+ t.setAttribute("theme", ot());
1115
1118
  };
1116
1119
  if (i(), typeof globalThis.matchMedia != "function")
1117
1120
  return null;
1118
1121
  const r = globalThis.matchMedia("(prefers-color-scheme: dark)"), a = globalThis.matchMedia("(prefers-contrast: more)"), s = () => {
1119
1122
  i();
1120
1123
  };
1121
- return I(r, s), I(a, s), () => {
1124
+ return _(r, s), _(a, s), () => {
1122
1125
  O(r, s), O(a, s);
1123
1126
  };
1124
1127
  };
1125
- class ot {
1128
+ class ut {
1126
1129
  constructor(n) {
1127
- this.bridge = new je(), this.callbacks = new Ze(), this.readerState = new Ye(), this.bridgeToolContext = {
1130
+ this.bridge = new je(), this.callbacks = new et(), this.readerState = new Xe(), this.bridgeToolContext = {
1128
1131
  bridge: this.bridge,
1129
1132
  callbacks: this.callbacks,
1130
1133
  debug: () => this.debugEnabled,
1131
1134
  onAsyncError: (e) => this.reportAdapterError(e),
1132
1135
  state: this.readerState
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) => {
1136
+ }, this.documentTool = new ce(this.bridgeToolContext), this.uiTool = new xe(this.bridgeToolContext), this.pageTool = new fe(this.bridgeToolContext), this.pageArrangeTool = new ke(this.bridgeToolContext), this.findTool = new ge(this.bridgeToolContext), this.signServerTool = new _e(this.bridgeToolContext), this.digitalSignTool = new se(this.bridgeToolContext), this.symbologyTool = new Le(this.bridgeToolContext), this.annotationTool = new ne(this.bridgeToolContext), this.templateSignTool = new Ue(this.bridgeToolContext), this.pdfFormFiller = new ve(this.bridgeToolContext), this.networkingTool = new pe(this.bridgeToolContext), this.cryptoTool = new re(this.bridgeToolContext), this.securityTool = new we(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.runtimeRestoreState = null, this.nativeEventCleanupCallbacks = [], this.themeCleanup = null, this.enableDebug = (e) => {
1134
1137
  this.debugEnabled = e;
1135
1138
  }, this.changeLanguage = (e) => {
1136
1139
  this.readerElement && this.readerElement.setAttribute("language", e);
@@ -1138,7 +1141,7 @@ class ot {
1138
1141
  this.themeCleanup?.(), this.themeCleanup = null, this.normalizedConfiguration = this.normalizedConfiguration ? {
1139
1142
  ...this.normalizedConfiguration,
1140
1143
  theme: e
1141
- } : null, this.readerElement && (this.themeCleanup = _(this.readerElement, e));
1144
+ } : null, this.readerElement && (this.themeCleanup = L(this.readerElement, e));
1142
1145
  }, this.setSessionUser = (e) => {
1143
1146
  this.sessionUser = e;
1144
1147
  }, this.setSessionUserId = (e) => {
@@ -1162,24 +1165,24 @@ class ot {
1162
1165
  }, this.setReaderEventListener = (e) => {
1163
1166
  this.readerEventListener = e;
1164
1167
  }, this.embedReader = (e, i, r) => {
1165
- const a = rt(e), s = G(i);
1166
- H(s);
1167
- const o = Ke(s, r), u = this.mountToken + 1;
1168
+ const a = st(e), s = q(i);
1169
+ z(s);
1170
+ const o = Ge(s, r), u = this.mountToken + 1;
1168
1171
  this.removeReader(), this.mountToken = u, this.removed = !1, this.hostContainer = a, this.normalizedConfiguration = o, this.mountReader(a, o, u);
1169
1172
  }, this.removeReader = () => {
1170
1173
  const e = !!(this.readerElement || this.hostContainer);
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)
1174
+ if (this.mountToken += 1, this.cleanupNativeEventForwarders(), this.cleanupThemeBinding(), this.restoreReaderRuntimeConfig(), 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)
1172
1175
  return;
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) => {
1176
+ const i = I(null, null);
1177
+ this.emitReaderEvent(rt, i), this.unloadCallbacks.forEach((r) => r());
1178
+ }, 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 Ae(e, i, r), this.mountReader = async (e, i, r) => {
1176
1179
  try {
1177
- if (await He(i.appUrl), this.mountToken !== r)
1180
+ if (await ze(i.appUrl), this.mountToken !== r)
1178
1181
  return;
1179
- const a = document.createElement(g), s = it();
1180
- a.setAttribute(K, s), this.readerId = s, this.bridge.setReaderId(s), st(a);
1182
+ const a = document.createElement(g), s = at();
1183
+ a.setAttribute(G, s), this.readerId = s, this.bridge.setReaderId(s), dt(a), this.applyReaderRuntimeConfig(a, i);
1181
1184
  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)
1185
+ if (a.toggleAttribute("data-sdk-compact-mode", o), a.setAttribute("language", i.language ?? "zh_CN"), this.themeCleanup = L(a, i.theme), this.bindNativeReaderEvents(a), e.replaceChildren(a), this.readerElement = a, await Promise.resolve(), this.mountToken !== r)
1183
1186
  return;
1184
1187
  const u = await this.bridge.waitForReady();
1185
1188
  if (this.mountToken !== r)
@@ -1187,8 +1190,8 @@ class ot {
1187
1190
  if (!u)
1188
1191
  throw new Error("Editor adapter is not available.");
1189
1192
  this.isReady = !0;
1190
- const c = w(a, i);
1191
- this.emitReaderEvent(tt, c), this.readyCallbacks.forEach((l) => l());
1193
+ const c = I(a, i);
1194
+ this.emitReaderEvent(it, c), this.readyCallbacks.forEach((l) => l());
1192
1195
  } catch (a) {
1193
1196
  if (this.mountToken !== r)
1194
1197
  return;
@@ -1200,15 +1203,15 @@ class ot {
1200
1203
  const a = r instanceof CustomEvent ? r.detail : null;
1201
1204
  !a || a.readerId !== this.readerId || (this.readerState.update(a.statePatch), this.callbacks.emit(a.event, a.payload), this.emitReaderEvent(a.event, a.payload));
1202
1205
  };
1203
- e.addEventListener(C, i), this.nativeEventCleanupCallbacks.push(() => {
1206
+ e.addEventListener(A, i), this.nativeEventCleanupCallbacks.push(() => {
1204
1207
  e.removeEventListener(
1205
- C,
1208
+ A,
1206
1209
  i
1207
1210
  );
1208
- }), et.forEach((r) => {
1211
+ }), nt.forEach((r) => {
1209
1212
  const a = (s) => {
1210
1213
  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);
1214
+ r === "documentLoaded" && this.readerState.setDocumentOpened(!0), this.emitReaderEvent(r, o), r === "documentError" && this.emitReaderEvent(v, o);
1212
1215
  };
1213
1216
  e.addEventListener(r, a), this.nativeEventCleanupCallbacks.push(() => {
1214
1217
  e.removeEventListener(r, a);
@@ -1221,41 +1224,62 @@ class ot {
1221
1224
  }, this.emitReaderEvent = (e, i) => {
1222
1225
  this.readerEventListener?.(e, i);
1223
1226
  }, this.reportReaderError = (e) => {
1224
- this.isReady = !1, this.debugEnabled && console.error("[RHC Office SDK] Reader mount failed", e), this.emitReaderEvent(T, e);
1227
+ this.isReady = !1, this.debugEnabled && console.error("[RHC Office SDK] Reader mount failed", e), this.emitReaderEvent(v, e);
1225
1228
  }, this.reportAdapterError = (e) => {
1226
- this.debugEnabled && console.error("[RHC Office SDK] Adapter command failed", e), this.emitReaderEvent(T, e);
1229
+ this.debugEnabled && console.error("[RHC Office SDK] Adapter command failed", e), this.emitReaderEvent(v, e);
1227
1230
  }, this.bridge.configureTimeouts({
1228
1231
  readyTimeoutMs: n?.readyTimeoutMs,
1229
1232
  requestTimeoutMs: n?.requestTimeoutMs
1230
1233
  });
1231
1234
  }
1235
+ applyReaderRuntimeConfig(n, e) {
1236
+ this.restoreReaderRuntimeConfig();
1237
+ const i = {
1238
+ hostKind: "server",
1239
+ server: {
1240
+ baseUrl: e.appUrl
1241
+ }
1242
+ }, r = n;
1243
+ r[tt] = i;
1244
+ const a = globalThis, s = a[S];
1245
+ this.runtimeRestoreState = {
1246
+ hadPreviousRuntime: s !== void 0,
1247
+ ...s !== void 0 ? { previousRuntime: s } : {}
1248
+ }, a[S] = i;
1249
+ }
1250
+ restoreReaderRuntimeConfig() {
1251
+ if (!this.runtimeRestoreState)
1252
+ return;
1253
+ const n = globalThis;
1254
+ this.runtimeRestoreState.hadPreviousRuntime ? n[S] = this.runtimeRestoreState.previousRuntime : Reflect.deleteProperty(n, S), this.runtimeRestoreState = null;
1255
+ }
1232
1256
  }
1233
- const mt = (t) => new ot(t);
1257
+ const bt = (t) => new ut(t);
1234
1258
  export {
1235
- te as AnnotationToolImpl,
1236
- ie as CryptoToolImpl,
1237
- gt as DIGITAL_SIGN_DEFAULTS,
1259
+ ne as AnnotationToolImpl,
1260
+ re as CryptoToolImpl,
1261
+ pt as DIGITAL_SIGN_DEFAULTS,
1238
1262
  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,
1263
+ se as DigitalSignToolImpl,
1264
+ ut as DocumentSDK,
1265
+ ce as DocumentToolImpl,
1266
+ ge as FindToolImpl,
1267
+ Ae as KVField,
1268
+ pe as NetworkingToolImpl,
1269
+ ke as PageArrangeToolImpl,
1246
1270
  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,
1271
+ ve as PdfFormFillerImpl,
1272
+ we as SecurityToolImpl,
1273
+ _e as SignServerToolImpl,
1274
+ Le as SymbologyToolImpl,
1275
+ Ue as TemplateSignToolImpl,
1276
+ xe as UIToolImpl,
1253
1277
  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
1278
+ bt as createNewDocumentSdk,
1279
+ lt as getDigitalSignEnvironment,
1280
+ ct as initializeDigitalSignEnvironment,
1281
+ gt as patchDigitalSignEnvironment,
1282
+ mt as resetDigitalSignEnvironment,
1283
+ ht as setDigitalSignEnvironment
1260
1284
  };
1261
1285
  //# sourceMappingURL=index.js.map