@rhc-office/sdk 6.6.393 → 6.6.395

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 X = /* @__PURE__ */ ((t) => (t.DEFAULT = "default", t.COMPACT = "compact", t.HIDE = "none", t))(X || {});
2
- const B = "RIGHT_CENTER", V = "REGULAR_ESM", K = "auto", f = "__RHC_OFFICE_DIGITAL_SIGN_ENVIRONMENT__", P = {
2
+ const x = "RIGHT_CENTER", V = "REGULAR_ESM", K = "auto", S = "__RHC_OFFICE_DIGITAL_SIGN_ENVIRONMENT__", A = {
3
3
  defaults: {
4
4
  bjca: {
5
5
  pin: ""
6
6
  },
7
7
  deviceType: "client",
8
- edgePosition: B,
8
+ edgePosition: x,
9
9
  plugin: {
10
10
  pin: "",
11
11
  usbKeyType: 14
@@ -25,7 +25,7 @@ const B = "RIGHT_CENTER", V = "REGULAR_ESM", K = "auto", f = "__RHC_OFFICE_DIGIT
25
25
  usbKeyType: 14
26
26
  }
27
27
  }
28
- }, G = (t) => ({
28
+ }, z = (t) => ({
29
29
  bjca: {
30
30
  pin: t.bjca.pin
31
31
  },
@@ -37,7 +37,7 @@ const B = "RIGHT_CENTER", V = "REGULAR_ESM", K = "auto", f = "__RHC_OFFICE_DIGIT
37
37
  },
38
38
  rsaMode: t.rsaMode,
39
39
  signatureType: t.signatureType
40
- }), q = (t) => ({
40
+ }), G = (t) => ({
41
41
  authSource: t.authSource,
42
42
  defaultLogin: t.defaultLogin,
43
43
  defaultPassword: t.defaultPassword,
@@ -48,9 +48,9 @@ const B = "RIGHT_CENTER", V = "REGULAR_ESM", K = "auto", f = "__RHC_OFFICE_DIGIT
48
48
  checkCertificateBinding: t.usbKey.checkCertificateBinding,
49
49
  usbKeyType: t.usbKey.usbKeyType
50
50
  }
51
- }), g = (t) => ({
52
- defaults: G(t.defaults),
53
- signServer: q(t.signServer)
51
+ }), m = (t) => ({
52
+ defaults: z(t.defaults),
53
+ signServer: G(t.signServer)
54
54
  }), E = (t) => ({
55
55
  defaults: t.defaults ? {
56
56
  ...t.defaults,
@@ -73,7 +73,7 @@ const B = "RIGHT_CENTER", V = "REGULAR_ESM", K = "auto", f = "__RHC_OFFICE_DIGIT
73
73
  },
74
74
  rsaMode: n.rsaMode ?? t.rsaMode,
75
75
  signatureType: n.signatureType ?? t.signatureType
76
- } : G(t), Z = (t, n) => n ? {
76
+ } : z(t), Z = (t, n) => n ? {
77
77
  authSource: n.authSource ?? t.authSource,
78
78
  defaultLogin: n.defaultLogin ?? t.defaultLogin,
79
79
  defaultPassword: n.defaultPassword ?? t.defaultPassword,
@@ -84,7 +84,7 @@ const B = "RIGHT_CENTER", V = "REGULAR_ESM", K = "auto", f = "__RHC_OFFICE_DIGIT
84
84
  checkCertificateBinding: n.usbKey?.checkCertificateBinding ?? t.usbKey.checkCertificateBinding,
85
85
  usbKeyType: n.usbKey?.usbKeyType ?? t.usbKey.usbKeyType
86
86
  }
87
- } : q(t), z = (t, n) => ({
87
+ } : G(t), q = (t, n) => ({
88
88
  defaults: J(t.defaults, n.defaults),
89
89
  signServer: Z(t.signServer, n.signServer)
90
90
  }), ee = (t, n) => {
@@ -113,32 +113,32 @@ const B = "RIGHT_CENTER", V = "REGULAR_ESM", K = "auto", f = "__RHC_OFFICE_DIGIT
113
113
  };
114
114
  }, te = () => globalThis, p = () => {
115
115
  const t = te();
116
- return t[f] || (t[f] = {
117
- current: g(P),
118
- defaults: g(P),
116
+ return t[S] || (t[S] = {
117
+ current: m(A),
118
+ defaults: m(A),
119
119
  overrides: {}
120
- }), t[f];
121
- }, mt = () => p().current, pt = () => {
120
+ }), t[S];
121
+ }, St = () => p().current, Rt = () => {
122
122
  const t = p();
123
123
  return {
124
- current: g(t.current),
125
- defaults: g(t.defaults),
124
+ current: m(t.current),
125
+ defaults: m(t.defaults),
126
126
  overrides: E(t.overrides)
127
127
  };
128
- }, bt = (t) => {
128
+ }, kt = (t) => {
129
129
  const n = p();
130
- return n.defaults = g(t), n.current = z(n.defaults, n.overrides), n.current;
131
- }, St = (t) => {
130
+ return n.defaults = m(t), n.current = q(n.defaults, n.overrides), n.current;
131
+ }, Tt = (t) => {
132
132
  const n = p();
133
- return n.current = g(t), n.overrides = E(t), n.current;
134
- }, ft = (t) => {
133
+ return n.current = m(t), n.overrides = E(t), n.current;
134
+ }, yt = (t) => {
135
135
  const n = p();
136
- return n.overrides = ee(n.overrides, E(t)), n.current = z(n.current, t), n.current;
137
- }, Rt = (t) => {
136
+ return n.overrides = ee(n.overrides, E(t)), n.current = q(n.current, t), n.current;
137
+ }, vt = (t) => {
138
138
  const n = p();
139
- return t && (n.defaults = g(t)), n.overrides = {}, n.current = g(n.defaults), n.current;
140
- }, kt = {
141
- EDGE_POSITION: B,
139
+ return t && (n.defaults = m(t)), n.overrides = {}, n.current = m(n.defaults), n.current;
140
+ }, Et = {
141
+ EDGE_POSITION: x,
142
142
  RSA_MODE: K,
143
143
  SIGNATURE_TYPE: V
144
144
  }, R = (t) => {
@@ -254,15 +254,63 @@ class ae {
254
254
  }
255
255
  }
256
256
  const se = {
257
+ addAttachmentChangedCallback: {
258
+ kind: "callbackRegister",
259
+ callback: (t, n) => {
260
+ const e = n[0];
261
+ typeof e == "function" && t.attachmentChanged.push(e);
262
+ }
263
+ },
264
+ addAttachment: { kind: "command", returnsResult: !0 },
265
+ clearAttachments: { kind: "command", returnsResult: !0 },
266
+ deleteAttachment: { kind: "command", returnsResult: !0 },
267
+ getAttachmentFile: { kind: "query" },
268
+ getAttachments: { kind: "query" }
269
+ }, oe = async (t) => {
270
+ if (t instanceof Uint8Array)
271
+ return t.slice();
272
+ if (t instanceof ArrayBuffer)
273
+ return new Uint8Array(t.slice(0));
274
+ if (ArrayBuffer.isView(t)) {
275
+ const n = t;
276
+ return new Uint8Array(n.buffer.slice(n.byteOffset, n.byteOffset + n.byteLength));
277
+ }
278
+ return new Uint8Array(await t.arrayBuffer());
279
+ }, de = (t, n) => {
280
+ const e = { ...n }, i = typeof File < "u" && t instanceof File, r = typeof Blob < "u" && t instanceof Blob;
281
+ if (i ? (e.fileName = e.fileName || t.name, e.mimeType = e.mimeType || t.type) : r && (e.fileName = e.fileName || "attachment.bin", e.mimeType = e.mimeType || t.type), e.fileName = typeof e.fileName == "string" ? e.fileName.trim() : "", !e.fileName)
282
+ throw new Error("Attachment fileName is required for binary attachment input.");
283
+ return e.mimeType = typeof e.mimeType == "string" ? e.mimeType.trim() : "", e.mimeType = e.mimeType || void 0, e;
284
+ };
285
+ class ue {
286
+ constructor(n) {
287
+ this.getAttachments = () => this.adapter.getAttachments(), this.getAttachmentFile = (e) => this.adapter.getAttachmentFile(e), this.addAttachment = async (e, i) => {
288
+ const r = await oe(e), a = de(e, i);
289
+ if (r.byteLength === 0)
290
+ throw new Error("Attachment content cannot be empty.");
291
+ if (typeof a.maxSizeBytes == "number" && r.byteLength > a.maxSizeBytes)
292
+ throw new Error("Attachment content exceeds maxSizeBytes.");
293
+ return this.addAttachmentCommand({
294
+ content: r,
295
+ options: a
296
+ });
297
+ }, this.deleteAttachment = (e, i) => this.adapter.deleteAttachment(e, i), this.clearAttachments = (e) => this.adapter.clearAttachments(e), this.addAttachmentChangedCallback = (e) => this.adapter.addAttachmentChangedCallback(e), this.adapter = u(
298
+ "attachment",
299
+ se,
300
+ n
301
+ ), this.addAttachmentCommand = this.adapter.addAttachment;
302
+ }
303
+ }
304
+ const le = {
257
305
  configSecurityProvider: { kind: "command" },
258
306
  getSecurityProviders: { kind: "query" }
259
307
  };
260
- class oe {
308
+ class ce {
261
309
  constructor(n) {
262
- this.configSecurityProvider = (e) => this.adapter.configSecurityProvider(e), this.getSecurityProviders = () => this.adapter.getSecurityProviders(), this.adapter = u("crypto", se, n);
310
+ this.configSecurityProvider = (e) => this.adapter.configSecurityProvider(e), this.getSecurityProviders = () => this.adapter.getSecurityProviders(), this.adapter = u("crypto", le, n);
263
311
  }
264
312
  }
265
- const D = (t) => t.digitalSignatures ? [...t.digitalSignatures] : [], de = {
313
+ const P = (t) => t.digitalSignatures ? [...t.digitalSignatures] : [], he = {
266
314
  addDigitalSignatureRetrieveCallback: {
267
315
  kind: "callbackRegister",
268
316
  callback: (t, n) => {
@@ -299,25 +347,25 @@ const D = (t) => t.digitalSignatures ? [...t.digitalSignatures] : [], de = {
299
347
  listDigitalSignatures: { kind: "callbackQuery" },
300
348
  getDigitalSignatures: {
301
349
  kind: "stateGetter",
302
- state: (t) => D(t)
350
+ state: (t) => P(t)
303
351
  },
304
352
  getDigitalSignaturesCount: {
305
353
  kind: "stateGetter",
306
- state: (t) => D(t).length
354
+ state: (t) => P(t).length
307
355
  },
308
356
  enableDigitalSignatureInfoView: { kind: "command" },
309
357
  enableDigitalSignatureRevocation: { kind: "command" }
310
358
  };
311
- class ue {
359
+ class me {
312
360
  constructor(n) {
313
361
  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 = u(
314
362
  "digitalSign",
315
- de,
363
+ he,
316
364
  n
317
365
  );
318
366
  }
319
367
  }
320
- const le = "rhc-office.editor-adapter", ce = 1, he = "__RHC_OFFICE_EDITOR_ADAPTER__", A = "rhcOfficeAdapterReady", M = "rhcOfficeAdapterEvent", H = "data-rhc-office-reader-id", ge = {
368
+ const ge = "rhc-office.editor-adapter", pe = 1, be = "__RHC_OFFICE_EDITOR_ADAPTER__", D = "rhcOfficeAdapterReady", M = "rhcOfficeAdapterEvent", H = "data-rhc-office-reader-id", fe = {
321
369
  addDocumentOpenedCallback: {
322
370
  kind: "callbackRegister",
323
371
  callback: (t, n) => {
@@ -366,7 +414,7 @@ const le = "rhc-office.editor-adapter", ce = 1, he = "__RHC_OFFICE_EDITOR_ADAPTE
366
414
  print: { kind: "command" },
367
415
  createPreview: { kind: "command" }
368
416
  };
369
- class me {
417
+ class Se {
370
418
  constructor(n) {
371
419
  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, i) => this.adapter.setUploadUrl(e, i), this.save = (e, i, r) => this.adapter.save(e, i, r), this.saveAs = (e) => {
372
420
  const i = this.context.bridge.getReaderId();
@@ -383,36 +431,36 @@ class me {
383
431
  return typeof r?.saveAs == "function" ? r.saveAs(e) : this.adapter.saveAs(e);
384
432
  }, 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 = u(
385
433
  "document",
386
- ge,
434
+ fe,
387
435
  n
388
436
  );
389
437
  }
390
438
  }
391
- const pe = {
439
+ const Re = {
392
440
  clearFind: { kind: "command" },
393
441
  findNext: { kind: "command" },
394
442
  findPrevious: { kind: "command" }
395
443
  };
396
- class be {
444
+ class ke {
397
445
  constructor(n) {
398
- this.clearFind = () => this.adapter.clearFind(), this.findNext = (e) => this.adapter.findNext(e), this.findPrevious = (e) => this.adapter.findPrevious(e), this.adapter = u("find", pe, n);
446
+ this.clearFind = () => this.adapter.clearFind(), this.findNext = (e) => this.adapter.findNext(e), this.findPrevious = (e) => this.adapter.findPrevious(e), this.adapter = u("find", Re, n);
399
447
  }
400
448
  }
401
- const Se = {
449
+ const Te = {
402
450
  configFileUpload: { kind: "command" },
403
451
  setHttpHeaders: { kind: "command" },
404
452
  setHttpFormFields: { kind: "command" }
405
453
  };
406
- class fe {
454
+ class ye {
407
455
  constructor(n) {
408
456
  this.configFileUpload = (e) => this.adapter.configFileUpload(e), this.setHttpHeaders = (e) => this.adapter.setHttpHeaders(e), this.setHttpFormFields = (e) => this.adapter.setHttpFormFields(e), this.adapter = u(
409
457
  "networking",
410
- Se,
458
+ Te,
411
459
  n
412
460
  );
413
461
  }
414
462
  }
415
- const Re = () => ({
463
+ const ve = () => ({
416
464
  clearContent: { kind: "command", returnsResult: !0 },
417
465
  commit: { kind: "command", returnsResult: !0 },
418
466
  deletePages: { kind: "command", returnsResult: !0 },
@@ -427,17 +475,17 @@ const Re = () => ({
427
475
  rotateLeft: { kind: "command", returnsResult: !0 },
428
476
  rotateRight: { kind: "command", returnsResult: !0 },
429
477
  undo: { kind: "command", returnsResult: !0 }
430
- }), ke = (t) => t instanceof Uint8Array ? t : new Uint8Array(t);
431
- class Te {
478
+ }), Ee = (t) => t instanceof Uint8Array ? t : new Uint8Array(t);
479
+ class Ae {
432
480
  constructor(n) {
433
- 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(ke(e), i), this.extractPages = (e, i) => this.adapter.extractPages(e, i), this.undo = () => this.adapter.undo(), this.commit = () => this.adapter.commit(), this.adapter = u(
481
+ 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(Ee(e), i), this.extractPages = (e, i) => this.adapter.extractPages(e, i), this.undo = () => this.adapter.undo(), this.commit = () => this.adapter.commit(), this.adapter = u(
434
482
  "pageArrange",
435
- Re(),
483
+ ve(),
436
484
  n
437
485
  );
438
486
  }
439
487
  }
440
- const ye = (t) => ({
488
+ const Ce = (t) => ({
441
489
  addPageChangeCallback: {
442
490
  kind: "callbackRegister",
443
491
  callback: (n, e) => {
@@ -487,16 +535,16 @@ const ye = (t) => ({
487
535
  gotoPreviousPage: { kind: "command" },
488
536
  rotatePage: { kind: "command" }
489
537
  });
490
- class ve {
538
+ class Pe {
491
539
  constructor(n) {
492
540
  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 = u(
493
541
  "page",
494
- ye(n),
542
+ Ce(n),
495
543
  n
496
544
  );
497
545
  }
498
546
  }
499
- const Ee = {
547
+ const De = {
500
548
  open: { kind: "command" },
501
549
  setFormFieldValue: { kind: "command" },
502
550
  setFormFieldReadonly: { kind: "command" },
@@ -513,28 +561,28 @@ const Ee = {
513
561
  mapCallbackResult: (t) => [Array.isArray(t) ? t : []]
514
562
  }
515
563
  };
516
- class Pe {
564
+ class Me {
517
565
  constructor(n) {
518
566
  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 = u(
519
567
  "pdfFormFiller",
520
- Ee,
568
+ De,
521
569
  n
522
570
  );
523
571
  }
524
572
  }
525
- const Ce = /\s*,\s*/, De = /\s*-\s*/, k = (t) => {
573
+ const we = /\s*,\s*/, Ie = /\s*-\s*/, k = (t) => {
526
574
  const n = Number.parseInt(t.trim(), 10);
527
575
  return !Number.isFinite(n) || n <= 0 ? null : n;
528
- }, Ae = (t) => {
529
- const n = t.split(De);
576
+ }, Oe = (t) => {
577
+ const n = t.split(Ie);
530
578
  if (n.length === 1) {
531
579
  const r = k(n[0] ?? "");
532
580
  return r ? [r] : [];
533
581
  }
534
582
  const e = k(n[0] ?? ""), i = k(n[1] ?? "");
535
583
  return !e || !i || i < e ? [] : Array.from({ length: i - e + 1 }, (r, a) => e + a);
536
- }, Me = (t) => t ? t.split(Ce).flatMap((e) => Ae(e)).filter((e, i, r) => r.indexOf(e) === i) : [];
537
- class we {
584
+ }, _e = (t) => t ? t.split(we).flatMap((e) => Oe(e)).filter((e, i, r) => r.indexOf(e) === i) : [];
585
+ class Le {
538
586
  constructor(n, e, i) {
539
587
  this.setFieldName = (r) => {
540
588
  this.key = r;
@@ -545,7 +593,7 @@ class we {
545
593
  }, this.key = n, this.value = e, this.description = i;
546
594
  }
547
595
  }
548
- class Ie {
596
+ class Fe {
549
597
  constructor() {
550
598
  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) => {
551
599
  this.signType = n;
@@ -555,7 +603,7 @@ class Ie {
555
603
  this.sealPosition = n;
556
604
  }, this.setPageRange = (n) => {
557
605
  this.pageRange = n;
558
- }, this.getPageRange = () => this.pageRange, this.getPageRanges = () => Me(this.pageRange), this.setSignUserData = (n) => {
606
+ }, this.getPageRange = () => this.pageRange, this.getPageRanges = () => _e(this.pageRange), this.setSignUserData = (n) => {
559
607
  this.signUserData = n;
560
608
  }, this.setPrintMargin = (n) => {
561
609
  this.printMargin = n;
@@ -568,23 +616,23 @@ class Ie {
568
616
  };
569
617
  }
570
618
  }
571
- const Oe = {
619
+ const Ne = {
572
620
  getSecuritySettings: { kind: "query" },
573
621
  isSecuritySettingsLocalEditable: { kind: "query" },
574
622
  setSecuritySettingsLocalEditable: { kind: "query" },
575
623
  setSecuritySettings: { kind: "query" },
576
624
  openSecuritySettingsDialog: { kind: "command" }
577
625
  };
578
- class _e {
626
+ class Ue {
579
627
  constructor(n) {
580
628
  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 = u(
581
629
  "security",
582
- Oe,
630
+ Ne,
583
631
  n
584
632
  );
585
633
  }
586
634
  }
587
- const Le = {
635
+ const Be = {
588
636
  setSignServer: { kind: "command" },
589
637
  addSignServerAuthCallback: {
590
638
  kind: "callbackRegister",
@@ -604,28 +652,28 @@ const Le = {
604
652
  setSignServerLoginFromUSBKey: { kind: "command" },
605
653
  setUserAuthSource: { kind: "command" }
606
654
  };
607
- class Fe {
655
+ class xe {
608
656
  constructor(n) {
609
657
  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 = u(
610
658
  "signServer",
611
- Le,
659
+ Be,
612
660
  n
613
661
  );
614
662
  }
615
663
  }
616
- const Ne = {
664
+ const Ve = {
617
665
  createPDF417Barcode: { kind: "command" }
618
666
  };
619
- class Ue {
667
+ class Ke {
620
668
  constructor(n) {
621
669
  this.createPDF417Barcode = (e, i, r, a, s, o, d) => this.adapter.createPDF417Barcode(e, i, r, a, s, o, d), this.adapter = u(
622
670
  "symbology",
623
- Ne,
671
+ Ve,
624
672
  n
625
673
  );
626
674
  }
627
675
  }
628
- const xe = {
676
+ const ze = {
629
677
  setup: { kind: "command" },
630
678
  create: { kind: "command" },
631
679
  getMarkups: { kind: "callbackQuery" },
@@ -633,16 +681,16 @@ const xe = {
633
681
  removeAllMarkups: { kind: "command" },
634
682
  sign: { kind: "callbackQuery" }
635
683
  };
636
- class Be {
684
+ class Ge {
637
685
  constructor(n) {
638
686
  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 = u(
639
687
  "templateSign",
640
- xe,
688
+ ze,
641
689
  n
642
690
  );
643
691
  }
644
692
  }
645
- const Ve = /* @__PURE__ */ new Set([2, 5]), Ke = (t) => ({
693
+ const qe = /* @__PURE__ */ new Set([2, 5]), He = (t) => ({
646
694
  showToolbarMenu: { kind: "command" },
647
695
  hideToolbarMenu: { kind: "command" },
648
696
  setupToolbarMenu: { kind: "command" },
@@ -681,13 +729,13 @@ const Ve = /* @__PURE__ */ new Set([2, 5]), Ke = (t) => ({
681
729
  exitBookViewMode: { kind: "command" },
682
730
  isBookViewActivated: {
683
731
  kind: "stateGetter",
684
- state: () => Ve.has(t.state.snapshot().pageMode)
732
+ state: () => qe.has(t.state.snapshot().pageMode)
685
733
  },
686
734
  requestFullScreen: { kind: "command" },
687
735
  exitFullScreen: { kind: "command" },
688
736
  invalidateView: { kind: "command" }
689
737
  });
690
- class Ge {
738
+ class Qe {
691
739
  constructor(n) {
692
740
  this.showToolbarMenu = () => (this.warnLegacyRibbonMethod("showToolbarMenu", "showRibbonMenu"), this.showRibbonMenu()), this.hideToolbarMenu = () => (this.warnLegacyRibbonMethod("hideToolbarMenu", "hideRibbonMenu"), this.hideRibbonMenu()), this.setupToolbarMenu = (e) => (this.warnLegacyRibbonMethod(
693
741
  "setupToolbarMenu",
@@ -695,13 +743,13 @@ class Ge {
695
743
  ), 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(
696
744
  "setupRibbonMenu",
697
745
  "showRibbonMenu/hideRibbonMenu/setupRibbonMenuTab"
698
- ), 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.setStatusBarVisible = (e) => this.adapter.setStatusBarVisible(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 = u("ui", Ke(n), n);
746
+ ), 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.setStatusBarVisible = (e) => this.adapter.setStatusBarVisible(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 = u("ui", He(n), n);
699
747
  }
700
748
  warnLegacyRibbonMethod(n, e) {
701
749
  console.warn(`[RHC Office SDK] ui.${n} is deprecated. Use ui.${e} instead.`);
702
750
  }
703
751
  }
704
- const qe = (t) => {
752
+ const je = (t) => {
705
753
  if (!t)
706
754
  return;
707
755
  const n = t.trim().toLowerCase();
@@ -712,59 +760,59 @@ const qe = (t) => {
712
760
  }, Q = (t) => {
713
761
  const n = new URL(t, globalThis.location?.href ?? "http://localhost/");
714
762
  return n.hash = "", n.pathname.endsWith("/") || (n.pathname = `${n.pathname}/`), n.toString();
715
- }, ze = (t) => new URL("editors.bootstrap.js", t).toString(), He = (t, n) => {
763
+ }, We = (t) => new URL("editors.bootstrap.js", t).toString(), Ye = (t, n) => {
716
764
  const e = Q(t);
717
765
  return {
718
766
  ...n,
719
767
  appUrl: e,
720
- theme: qe(n.theme)
768
+ theme: je(n.theme)
721
769
  };
722
- }, m = "rhc-office-editor", T = "__RHC_OFFICE_SDK_READER_LOADER__", j = () => {
770
+ }, g = "rhc-office-editor", T = "__RHC_OFFICE_SDK_READER_LOADER__", j = () => {
723
771
  const t = globalThis;
724
772
  return t[T] || (t[T] = {
725
773
  activeAppUrl: null,
726
774
  loadPromises: /* @__PURE__ */ new Map()
727
775
  }), t[T];
728
- }, Qe = (t) => Array.from(document.querySelectorAll("script")).find((n) => n.src === t) ?? null;
776
+ }, $e = (t) => Array.from(document.querySelectorAll("script")).find((n) => n.src === t) ?? null;
729
777
  class w extends Error {
730
778
  constructor(n) {
731
779
  super(`Failed to load reader bootstrap script: ${n}`), this.name = "ReaderScriptLoadError";
732
780
  }
733
781
  }
734
- class je extends Error {
782
+ class Xe extends Error {
735
783
  constructor(n, e) {
736
784
  super(
737
- `Reader Web Component "${m}" is already bound to ${n} and cannot be reloaded from ${e}.`
785
+ `Reader Web Component "${g}" is already bound to ${n} and cannot be reloaded from ${e}.`
738
786
  ), this.name = "ReaderSourceConflictError";
739
787
  }
740
788
  }
741
789
  const W = (t) => {
742
790
  const n = j();
743
791
  if (n.activeAppUrl && n.activeAppUrl !== t)
744
- throw new je(n.activeAppUrl, t);
745
- }, We = (t) => {
792
+ throw new Xe(n.activeAppUrl, t);
793
+ }, Je = (t) => {
746
794
  const n = j();
747
795
  W(t);
748
796
  const e = n.loadPromises.get(t);
749
797
  if (e)
750
798
  return e;
751
- if (globalThis.customElements?.get(m)) {
799
+ if (globalThis.customElements?.get(g)) {
752
800
  n.activeAppUrl = t;
753
801
  const s = Promise.resolve();
754
802
  return n.loadPromises.set(t, s), s;
755
803
  }
756
- const i = ze(t), r = Qe(i);
804
+ const i = We(t), r = $e(i);
757
805
  n.activeAppUrl = t;
758
806
  const a = new Promise((s, o) => {
759
807
  const d = (h) => {
760
808
  h?.remove(), o(new w(i));
761
809
  }, l = () => {
762
- globalThis.customElements.whenDefined(m).then(() => {
810
+ globalThis.customElements.whenDefined(g).then(() => {
763
811
  s();
764
812
  }).catch(o);
765
813
  };
766
814
  if (r) {
767
- if (globalThis.customElements?.get(m)) {
815
+ if (globalThis.customElements?.get(g)) {
768
816
  s();
769
817
  return;
770
818
  }
@@ -780,21 +828,21 @@ const W = (t) => {
780
828
  const c = document.createElement("script");
781
829
  c.src = i, c.async = !0, c.dataset.rhcOfficeSdkReader = t, c.addEventListener("load", l, { once: !0 }), c.addEventListener("error", () => d(c), { once: !0 }), document.head.appendChild(c);
782
830
  }).catch((s) => {
783
- throw n.loadPromises.delete(t), !globalThis.customElements?.get(m) && n.activeAppUrl === t && (n.activeAppUrl = null), s;
831
+ throw n.loadPromises.delete(t), !globalThis.customElements?.get(g) && n.activeAppUrl === t && (n.activeAppUrl = null), s;
784
832
  });
785
833
  return n.loadPromises.set(t, a), a;
786
- }, Ye = 5e3, $e = 5e3, Xe = () => {
834
+ }, Ze = 5e3, et = 5e3, tt = () => {
787
835
  const t = globalThis.crypto;
788
836
  return typeof t?.randomUUID == "function" ? t.randomUUID() : `adapter-${Date.now()}-${Math.random().toString(36).slice(2)}`;
789
- }, b = () => globalThis[he];
790
- class Je extends Error {
837
+ }, b = () => globalThis[be];
838
+ class nt extends Error {
791
839
  constructor(n, e, i) {
792
840
  super(e), this.name = "ReaderBridgeError", this.code = n, this.details = i;
793
841
  }
794
842
  }
795
- class Ze {
843
+ class it {
796
844
  constructor(n) {
797
- this.readerId = null, this.readyTimeoutMs = n?.readyTimeoutMs ?? $e, this.requestTimeoutMs = n?.requestTimeoutMs ?? Ye;
845
+ this.readerId = null, this.readyTimeoutMs = n?.readyTimeoutMs ?? et, this.requestTimeoutMs = n?.requestTimeoutMs ?? Ze;
798
846
  }
799
847
  configureTimeouts(n) {
800
848
  this.readyTimeoutMs = n?.readyTimeoutMs ?? this.readyTimeoutMs, this.requestTimeoutMs = n?.requestTimeoutMs ?? this.requestTimeoutMs;
@@ -809,7 +857,7 @@ class Ze {
809
857
  const a = await this.requestRaw(n, e, i, r);
810
858
  if (a.ok)
811
859
  return a.result;
812
- throw new Je(
860
+ throw new nt(
813
861
  a.error.code,
814
862
  a.error.message,
815
863
  a.error.details
@@ -836,9 +884,9 @@ class Ze {
836
884
  }
837
885
  };
838
886
  const s = {
839
- protocol: le,
840
- version: ce,
841
- requestId: Xe(),
887
+ protocol: ge,
888
+ version: pe,
889
+ requestId: tt(),
842
890
  readerId: this.readerId,
843
891
  tool: n,
844
892
  method: e,
@@ -861,14 +909,14 @@ class Ze {
861
909
  return i?.getCapabilities(n) ? i : new Promise((r) => {
862
910
  let a;
863
911
  const s = () => {
864
- a && clearTimeout(a), globalThis.removeEventListener(A, o);
912
+ a && clearTimeout(a), globalThis.removeEventListener(D, o);
865
913
  }, o = (d) => {
866
914
  if ((d instanceof CustomEvent ? d.detail : void 0)?.readerId !== n)
867
915
  return;
868
916
  const c = b();
869
917
  s(), r(c ?? null);
870
918
  };
871
- globalThis.addEventListener(A, o), a = setTimeout(() => {
919
+ globalThis.addEventListener(D, o), a = setTimeout(() => {
872
920
  s(), r(b()?.getCapabilities(n) ? b() : null);
873
921
  }, e);
874
922
  });
@@ -909,7 +957,7 @@ const I = {
909
957
  pageMode: 0,
910
958
  zoomLevel: 100
911
959
  };
912
- class et {
960
+ class rt {
913
961
  constructor() {
914
962
  this.state = { ...I };
915
963
  }
@@ -938,12 +986,12 @@ class et {
938
986
  };
939
987
  }
940
988
  }
941
- const tt = (t) => typeof t == "object" && t !== null && !Array.isArray(t) ? t : void 0, Y = (t) => typeof t == "object" && t !== null && !Array.isArray(t), O = (t) => {
989
+ const at = (t) => typeof t == "object" && t !== null && !Array.isArray(t) ? t : void 0, Y = (t) => typeof t == "object" && t !== null && !Array.isArray(t), O = (t) => {
942
990
  if (!Y(t))
943
991
  return;
944
992
  const n = {};
945
993
  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;
946
- }, nt = (t) => {
994
+ }, st = (t) => {
947
995
  if (!Y(t))
948
996
  return {
949
997
  success: !0,
@@ -957,15 +1005,15 @@ const tt = (t) => typeof t == "object" && t !== null && !Array.isArray(t) ? t :
957
1005
  state: n ?? e
958
1006
  };
959
1007
  };
960
- class it {
1008
+ class ot {
961
1009
  constructor() {
962
- 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 = [];
1010
+ this.annotationEvents = [], this.annotationPersist = [], this.annotationRetrieve = [], this.attachmentChanged = [], this.digitalAnnotationRetrieve = [], this.digitalSign = [], this.digitalSignatureParse = [], this.digitalSignatureRetrieve = [], this.documentClosed = [], this.documentOpened = [], this.documentSaved = [], this.pageChange = [], this.pageModeChange = [], this.signServerAuth = [];
963
1011
  }
964
1012
  emit(n, e) {
965
1013
  switch (n) {
966
1014
  case "documentOpened":
967
1015
  case "documentLoaded": {
968
- const i = nt(e);
1016
+ const i = st(e);
969
1017
  this.documentOpened.forEach(
970
1018
  (r) => r(i.status ?? "ok", i.error ?? "", i)
971
1019
  );
@@ -994,7 +1042,7 @@ class it {
994
1042
  this.annotationEvents.forEach(
995
1043
  (r) => r(
996
1044
  i.event ?? "annotationEvent",
997
- tt(i.payload)
1045
+ at(i.payload)
998
1046
  )
999
1047
  );
1000
1048
  return;
@@ -1005,6 +1053,9 @@ class it {
1005
1053
  case "annotationRetrieve":
1006
1054
  this.annotationRetrieve.forEach((i) => i(e));
1007
1055
  return;
1056
+ case "attachmentChanged":
1057
+ this.attachmentChanged.forEach((i) => i(e));
1058
+ return;
1008
1059
  case "digitalAnnotationRetrieve":
1009
1060
  this.digitalAnnotationRetrieve.forEach(
1010
1061
  (i) => i(Array.isArray(e) ? e : [])
@@ -1031,11 +1082,11 @@ class it {
1031
1082
  }
1032
1083
  }
1033
1084
  }
1034
- const S = "__RHC_OFFICE_READER_RUNTIME__", y = "__rhcOfficeReaderRuntimeConfig", rt = [
1085
+ const f = "__RHC_OFFICE_READER_RUNTIME__", y = "__rhcOfficeReaderRuntimeConfig", dt = [
1035
1086
  "documentLoaded",
1036
1087
  "documentStateChange",
1037
1088
  "documentError"
1038
- ], at = "readerReady", st = "readerUnload", v = "readerError", ot = () => typeof globalThis.crypto?.randomUUID == "function" ? globalThis.crypto.randomUUID() : `rhc-reader-${Date.now()}-${Math.random().toString(36).slice(2)}`, _ = (t, n) => ({
1089
+ ], ut = "readerReady", lt = "readerUnload", v = "readerError", ct = () => typeof globalThis.crypto?.randomUUID == "function" ? globalThis.crypto.randomUUID() : `rhc-reader-${Date.now()}-${Math.random().toString(36).slice(2)}`, _ = (t, n) => ({
1039
1090
  appUrl: n?.appUrl ?? null,
1040
1091
  configuration: n,
1041
1092
  element: t
@@ -1050,19 +1101,19 @@ const S = "__RHC_OFFICE_READER_RUNTIME__", y = "__rhcOfficeReaderRuntimeConfig",
1050
1101
  sessionUser: e,
1051
1102
  ...a ? { sessionUserId: a } : {}
1052
1103
  };
1053
- }, dt = (t) => {
1104
+ }, ht = (t) => {
1054
1105
  const n = t.trim().replace(/[-_\s]/g, "").toLowerCase();
1055
1106
  return n === "view" ? "VIEW" : n === "annotation" ? "ANNOTATION" : n === "digitalsign" ? "DIGITAL_SIGN" : null;
1056
1107
  }, F = (t) => {
1057
1108
  const n = [];
1058
1109
  return t.split(/[;,]/).forEach((e) => {
1059
- const i = dt(e);
1110
+ const i = ht(e);
1060
1111
  i && !n.includes(i) && n.push(i);
1061
1112
  }), n.length > 0 ? n.join(",") : "VIEW";
1062
- }, ut = (t) => {
1113
+ }, mt = (t) => {
1063
1114
  const n = {};
1064
1115
  return t.canOpenNewFile !== void 0 && (n.canOpenNewFile = t.canOpenNewFile), t.canPrint !== void 0 && (n.canPrint = t.canPrint), t.canDownload !== void 0 && (n.canDownload = t.canDownload), Object.keys(n).length > 0 ? n : void 0;
1065
- }, lt = (t) => {
1116
+ }, gt = (t) => {
1066
1117
  if (typeof t == "string") {
1067
1118
  const n = document.getElementById(t);
1068
1119
  if (!n)
@@ -1074,7 +1125,7 @@ const S = "__RHC_OFFICE_READER_RUNTIME__", y = "__rhcOfficeReaderRuntimeConfig",
1074
1125
  if (!(t instanceof HTMLDivElement))
1075
1126
  throw new Error("Reader container must be a div element.");
1076
1127
  return t;
1077
- }, ct = () => {
1128
+ }, pt = () => {
1078
1129
  const t = typeof globalThis.matchMedia == "function";
1079
1130
  return (t ? globalThis.matchMedia("(prefers-contrast: more)").matches : !1) ? "high-contrast" : (t ? globalThis.matchMedia("(prefers-color-scheme: dark)").matches : !1) ? "dark" : "light";
1080
1131
  }, N = (t, n) => {
@@ -1091,16 +1142,16 @@ const S = "__RHC_OFFICE_READER_RUNTIME__", y = "__rhcOfficeReaderRuntimeConfig",
1091
1142
  return;
1092
1143
  }
1093
1144
  typeof e.removeListener == "function" && e.removeListener(n);
1094
- }, ht = (t) => {
1145
+ }, bt = (t) => {
1095
1146
  t.style.display || (t.style.display = "block"), t.style.width || (t.style.width = "100%"), t.style.height || (t.style.height = "100%");
1096
- }, x = (t, n) => {
1147
+ }, B = (t, n) => {
1097
1148
  const e = n;
1098
1149
  if (!e)
1099
1150
  return t.removeAttribute("theme"), null;
1100
1151
  if (e !== "auto")
1101
1152
  return t.setAttribute("theme", e), null;
1102
1153
  const i = () => {
1103
- t.setAttribute("theme", ct());
1154
+ t.setAttribute("theme", pt());
1104
1155
  };
1105
1156
  if (i(), typeof globalThis.matchMedia != "function")
1106
1157
  return null;
@@ -1111,15 +1162,15 @@ const S = "__RHC_OFFICE_READER_RUNTIME__", y = "__rhcOfficeReaderRuntimeConfig",
1111
1162
  U(r, s), U(a, s);
1112
1163
  };
1113
1164
  };
1114
- class gt {
1165
+ class ft {
1115
1166
  constructor(n) {
1116
- this.bridge = new Ze(), this.callbacks = new it(), this.readerState = new et(), this.bridgeToolContext = {
1167
+ this.bridge = new it(), this.callbacks = new ot(), this.readerState = new rt(), this.bridgeToolContext = {
1117
1168
  bridge: this.bridge,
1118
1169
  callbacks: this.callbacks,
1119
1170
  debug: () => this.debugEnabled,
1120
1171
  onAsyncError: (e) => this.reportAdapterError(e),
1121
1172
  state: this.readerState
1122
- }, this.documentTool = new me(this.bridgeToolContext), this.uiTool = new Ge(this.bridgeToolContext), this.pageTool = new ve(this.bridgeToolContext), this.pageArrangeTool = new Te(this.bridgeToolContext), this.findTool = new be(this.bridgeToolContext), this.signServerTool = new Fe(this.bridgeToolContext), this.digitalSignTool = new ue(this.bridgeToolContext), this.symbologyTool = new Ue(this.bridgeToolContext), this.annotationTool = new ae(this.bridgeToolContext), this.templateSignTool = new Be(this.bridgeToolContext), this.pdfFormFiller = new Pe(this.bridgeToolContext), this.networkingTool = new fe(this.bridgeToolContext), this.cryptoTool = new oe(this.bridgeToolContext), this.securityTool = new _e(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) => {
1173
+ }, this.documentTool = new Se(this.bridgeToolContext), this.uiTool = new Qe(this.bridgeToolContext), this.pageTool = new Pe(this.bridgeToolContext), this.pageArrangeTool = new Ae(this.bridgeToolContext), this.attachmentTool = new ue(this.bridgeToolContext), this.findTool = new ke(this.bridgeToolContext), this.signServerTool = new xe(this.bridgeToolContext), this.digitalSignTool = new me(this.bridgeToolContext), this.symbologyTool = new Ke(this.bridgeToolContext), this.annotationTool = new ae(this.bridgeToolContext), this.templateSignTool = new Ge(this.bridgeToolContext), this.pdfFormFiller = new Me(this.bridgeToolContext), this.networkingTool = new ye(this.bridgeToolContext), this.cryptoTool = new ce(this.bridgeToolContext), this.securityTool = new Ue(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) => {
1123
1174
  this.debugEnabled = e;
1124
1175
  }, this.changeLanguage = (e) => {
1125
1176
  this.readerElement && this.readerElement.setAttribute("language", e);
@@ -1127,7 +1178,7 @@ class gt {
1127
1178
  this.themeCleanup?.(), this.themeCleanup = null, this.normalizedConfiguration = this.normalizedConfiguration ? {
1128
1179
  ...this.normalizedConfiguration,
1129
1180
  theme: e
1130
- } : null, this.readerElement && (this.themeCleanup = x(this.readerElement, e));
1181
+ } : null, this.readerElement && (this.themeCleanup = B(this.readerElement, e));
1131
1182
  }, this.setSessionUser = (e) => {
1132
1183
  this.sessionUser = e, this.syncReaderRuntimeConfig();
1133
1184
  }, this.setSessionUserId = (e) => {
@@ -1141,27 +1192,27 @@ class gt {
1141
1192
  }, this.setReaderEventListener = (e) => {
1142
1193
  this.readerEventListener = e;
1143
1194
  }, this.embedReader = (e, i, r) => {
1144
- const a = lt(e), s = Q(i);
1195
+ const a = gt(e), s = Q(i);
1145
1196
  W(s);
1146
- const o = He(s, r), d = this.mountToken + 1;
1197
+ const o = Ye(s, r), d = this.mountToken + 1;
1147
1198
  this.removeReader(), this.mountToken = d, this.removed = !1, this.hostContainer = a, this.normalizedConfiguration = o, this.mountReader(a, o, d);
1148
1199
  }, this.removeReader = () => {
1149
1200
  const e = !!(this.readerElement || this.hostContainer);
1150
1201
  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)
1151
1202
  return;
1152
1203
  const i = _(null, null);
1153
- this.emitReaderEvent(st, i), this.unloadCallbacks.forEach((r) => r());
1154
- }, 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 Ie(), this.createKVField = (e, i, r) => new we(e, i, r), this.mountReader = async (e, i, r) => {
1204
+ this.emitReaderEvent(lt, i), this.unloadCallbacks.forEach((r) => r());
1205
+ }, this.getDocumentTool = () => this.documentTool, this.getUITool = () => this.uiTool, this.getPageTool = () => this.pageTool, this.getPageArrangeTool = () => this.pageArrangeTool, this.getAttachmentTool = () => this.attachmentTool, 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 Fe(), this.createKVField = (e, i, r) => new Le(e, i, r), this.mountReader = async (e, i, r) => {
1155
1206
  try {
1156
- if (await We(i.appUrl), this.mountToken !== r)
1207
+ if (await Je(i.appUrl), this.mountToken !== r)
1157
1208
  return;
1158
- const a = document.createElement(m), s = ot();
1159
- a.setAttribute(H, s), this.readerId = s, this.bridge.setReaderId(s), ht(a), this.applyReaderRuntimeConfig(a, i);
1209
+ const a = document.createElement(g), s = ct();
1210
+ a.setAttribute(H, s), this.readerId = s, this.bridge.setReaderId(s), bt(a), this.applyReaderRuntimeConfig(a, i);
1160
1211
  const o = i.compactViewer === !0 && i.keepPCMenu !== !0;
1161
1212
  if (a.toggleAttribute("data-sdk-compact-mode", o), a.toggleAttribute("data-sdk-ribbon-hidden", i.ribbonMenu === !1), a.toggleAttribute(
1162
1213
  "data-sdk-ribbon-title-hidden",
1163
1214
  i.ribbonTitle === !1
1164
- ), a.setAttribute("language", i.language ?? "zh_CN"), this.themeCleanup = x(a, i.theme), this.bindNativeReaderEvents(a), e.replaceChildren(a), this.readerElement = a, await Promise.resolve(), this.mountToken !== r)
1215
+ ), a.setAttribute("language", i.language ?? "zh_CN"), this.themeCleanup = B(a, i.theme), this.bindNativeReaderEvents(a), e.replaceChildren(a), this.readerElement = a, await Promise.resolve(), this.mountToken !== r)
1165
1216
  return;
1166
1217
  const d = await this.bridge.waitForReady();
1167
1218
  if (this.mountToken !== r)
@@ -1170,7 +1221,7 @@ class gt {
1170
1221
  throw new Error("Editor adapter is not available.");
1171
1222
  this.isReady = !0;
1172
1223
  const l = _(a, i);
1173
- this.emitReaderEvent(at, l), this.readyCallbacks.forEach((c) => c());
1224
+ this.emitReaderEvent(ut, l), this.readyCallbacks.forEach((c) => c());
1174
1225
  } catch (a) {
1175
1226
  if (this.mountToken !== r)
1176
1227
  return;
@@ -1187,7 +1238,7 @@ class gt {
1187
1238
  M,
1188
1239
  i
1189
1240
  );
1190
- }), rt.forEach((r) => {
1241
+ }), dt.forEach((r) => {
1191
1242
  const a = (s) => {
1192
1243
  const o = s instanceof CustomEvent ? s.detail : s;
1193
1244
  r === "documentLoaded" && this.readerState.setDocumentOpened(!0), this.emitReaderEvent(r, o), r === "documentError" && this.emitReaderEvent(v, o);
@@ -1216,7 +1267,7 @@ class gt {
1216
1267
  const i = L(this.sessionUser, this.sessionUserId), r = {
1217
1268
  feature: F(e.viewMode),
1218
1269
  ...i ?? {}
1219
- }, a = ut(e), s = {
1270
+ }, a = mt(e), s = {
1220
1271
  hostKind: "server",
1221
1272
  ...a ? { embedOptions: a } : {},
1222
1273
  server: {
@@ -1226,11 +1277,11 @@ class gt {
1226
1277
  ...this.sessionData !== void 0 ? { sessionData: this.sessionData } : {}
1227
1278
  }, o = n;
1228
1279
  o[y] = s;
1229
- const d = globalThis, l = d[S];
1280
+ const d = globalThis, l = d[f];
1230
1281
  this.runtimeRestoreState = {
1231
1282
  hadPreviousRuntime: l !== void 0,
1232
1283
  ...l !== void 0 ? { previousRuntime: l } : {}
1233
- }, d[S] = s;
1284
+ }, d[f] = s;
1234
1285
  }
1235
1286
  syncReaderRuntimeConfig() {
1236
1287
  if (!this.readerElement || !this.normalizedConfiguration)
@@ -1249,7 +1300,7 @@ class gt {
1249
1300
  identity: a,
1250
1301
  ...this.sessionData !== void 0 ? { sessionData: this.sessionData } : {}
1251
1302
  };
1252
- n[y] = s, globalThis[S] = s, this.isReady && this.bridge.request("extension", "updateReaderRuntimeConfig", {
1303
+ n[y] = s, globalThis[f] = s, this.isReady && this.bridge.request("extension", "updateReaderRuntimeConfig", {
1253
1304
  identity: a,
1254
1305
  ...this.sessionData !== void 0 ? { sessionData: this.sessionData } : {}
1255
1306
  }).catch((o) => {
@@ -1260,36 +1311,37 @@ class gt {
1260
1311
  if (!this.runtimeRestoreState)
1261
1312
  return;
1262
1313
  const n = globalThis;
1263
- this.runtimeRestoreState.hadPreviousRuntime ? n[S] = this.runtimeRestoreState.previousRuntime : Reflect.deleteProperty(n, S), this.runtimeRestoreState = null;
1314
+ this.runtimeRestoreState.hadPreviousRuntime ? n[f] = this.runtimeRestoreState.previousRuntime : Reflect.deleteProperty(n, f), this.runtimeRestoreState = null;
1264
1315
  }
1265
1316
  }
1266
- const Tt = (t) => new gt(t);
1317
+ const At = (t) => new ft(t);
1267
1318
  export {
1268
1319
  ae as AnnotationToolImpl,
1269
- oe as CryptoToolImpl,
1270
- kt as DIGITAL_SIGN_DEFAULTS,
1271
- Ie as DigitalSignOptions,
1272
- ue as DigitalSignToolImpl,
1273
- gt as DocumentSDK,
1274
- me as DocumentToolImpl,
1275
- be as FindToolImpl,
1276
- we as KVField,
1277
- fe as NetworkingToolImpl,
1278
- Te as PageArrangeToolImpl,
1279
- ve as PageToolImpl,
1280
- Pe as PdfFormFillerImpl,
1281
- _e as SecurityToolImpl,
1282
- Fe as SignServerToolImpl,
1283
- Ue as SymbologyToolImpl,
1284
- Be as TemplateSignToolImpl,
1285
- Ge as UIToolImpl,
1320
+ ue as AttachmentToolImpl,
1321
+ ce as CryptoToolImpl,
1322
+ Et as DIGITAL_SIGN_DEFAULTS,
1323
+ Fe as DigitalSignOptions,
1324
+ me as DigitalSignToolImpl,
1325
+ ft as DocumentSDK,
1326
+ Se as DocumentToolImpl,
1327
+ ke as FindToolImpl,
1328
+ Le as KVField,
1329
+ ye as NetworkingToolImpl,
1330
+ Ae as PageArrangeToolImpl,
1331
+ Pe as PageToolImpl,
1332
+ Me as PdfFormFillerImpl,
1333
+ Ue as SecurityToolImpl,
1334
+ xe as SignServerToolImpl,
1335
+ Ke as SymbologyToolImpl,
1336
+ Ge as TemplateSignToolImpl,
1337
+ Qe as UIToolImpl,
1286
1338
  X as WatermarkDisplay,
1287
- Tt as createNewDocumentSdk,
1288
- mt as getDigitalSignEnvironment,
1289
- pt as getDigitalSignEnvironmentSource,
1290
- bt as initializeDigitalSignEnvironment,
1291
- ft as patchDigitalSignEnvironment,
1292
- Rt as resetDigitalSignEnvironment,
1293
- St as setDigitalSignEnvironment
1339
+ At as createNewDocumentSdk,
1340
+ St as getDigitalSignEnvironment,
1341
+ Rt as getDigitalSignEnvironmentSource,
1342
+ kt as initializeDigitalSignEnvironment,
1343
+ yt as patchDigitalSignEnvironment,
1344
+ vt as resetDigitalSignEnvironment,
1345
+ Tt as setDigitalSignEnvironment
1294
1346
  };
1295
1347
  //# sourceMappingURL=index.js.map