@rhc-office/sdk 6.6.367 → 6.6.384

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,18 +1,11 @@
1
1
  var Y = /* @__PURE__ */ ((t) => (t.DEFAULT = "default", t.COMPACT = "compact", t.HIDE = "none", t))(Y || {});
2
- const U = "RIGHT_CENTER", N = "REGULAR_ESM", B = "auto", k = "__RHC_OFFICE_DIGITAL_SIGN_ENVIRONMENT__", E = {
2
+ const U = "RIGHT_CENTER", N = "REGULAR_ESM", B = "auto", f = "__RHC_OFFICE_DIGITAL_SIGN_ENVIRONMENT__", E = {
3
3
  defaults: {
4
4
  bjca: {
5
5
  pin: ""
6
6
  },
7
7
  deviceType: "client",
8
8
  edgePosition: U,
9
- kol: {
10
- appId: "",
11
- appName: "",
12
- pin: "",
13
- serviceUrl: "",
14
- token: ""
15
- },
16
9
  plugin: {
17
10
  pin: "",
18
11
  usbKeyType: 14
@@ -25,12 +18,6 @@ const U = "RIGHT_CENTER", N = "REGULAR_ESM", B = "auto", k = "__RHC_OFFICE_DIGIT
25
18
  defaultLogin: "",
26
19
  defaultPassword: "",
27
20
  defaultServer: "",
28
- kol: {
29
- appId: "",
30
- appName: "",
31
- serviceUrl: "",
32
- token: ""
33
- },
34
21
  macAddress: "",
35
22
  token: "",
36
23
  usbKey: {
@@ -44,30 +31,17 @@ const U = "RIGHT_CENTER", N = "REGULAR_ESM", B = "auto", k = "__RHC_OFFICE_DIGIT
44
31
  },
45
32
  deviceType: t.deviceType,
46
33
  edgePosition: t.edgePosition,
47
- kol: {
48
- appId: t.kol.appId,
49
- appName: t.kol.appName,
50
- pin: t.kol.pin,
51
- serviceUrl: t.kol.serviceUrl,
52
- token: t.kol.token
53
- },
54
34
  plugin: {
55
35
  pin: t.plugin.pin,
56
36
  usbKeyType: t.plugin.usbKeyType
57
37
  },
58
38
  rsaMode: t.rsaMode,
59
39
  signatureType: t.signatureType
60
- }), K = (t) => ({
40
+ }), V = (t) => ({
61
41
  authSource: t.authSource,
62
42
  defaultLogin: t.defaultLogin,
63
43
  defaultPassword: t.defaultPassword,
64
44
  defaultServer: t.defaultServer,
65
- kol: {
66
- appId: t.kol.appId,
67
- appName: t.kol.appName,
68
- serviceUrl: t.kol.serviceUrl,
69
- token: t.kol.token
70
- },
71
45
  macAddress: t.macAddress,
72
46
  token: t.token,
73
47
  usbKey: {
@@ -76,17 +50,15 @@ const U = "RIGHT_CENTER", N = "REGULAR_ESM", B = "auto", k = "__RHC_OFFICE_DIGIT
76
50
  }
77
51
  }), g = (t) => ({
78
52
  defaults: x(t.defaults),
79
- signServer: K(t.signServer)
80
- }), y = (t) => ({
53
+ signServer: V(t.signServer)
54
+ }), v = (t) => ({
81
55
  defaults: t.defaults ? {
82
56
  ...t.defaults,
83
57
  bjca: t.defaults.bjca ? { ...t.defaults.bjca } : void 0,
84
- kol: t.defaults.kol ? { ...t.defaults.kol } : void 0,
85
58
  plugin: t.defaults.plugin ? { ...t.defaults.plugin } : void 0
86
59
  } : void 0,
87
60
  signServer: t.signServer ? {
88
61
  ...t.signServer,
89
- kol: t.signServer.kol ? { ...t.signServer.kol } : void 0,
90
62
  usbKey: t.signServer.usbKey ? { ...t.signServer.usbKey } : void 0
91
63
  } : void 0
92
64
  }), W = (t, n) => n ? {
@@ -95,13 +67,6 @@ const U = "RIGHT_CENTER", N = "REGULAR_ESM", B = "auto", k = "__RHC_OFFICE_DIGIT
95
67
  },
96
68
  deviceType: n.deviceType ?? t.deviceType,
97
69
  edgePosition: n.edgePosition ?? t.edgePosition,
98
- kol: {
99
- appId: n.kol?.appId ?? t.kol.appId,
100
- appName: n.kol?.appName ?? t.kol.appName,
101
- pin: n.kol?.pin ?? t.kol.pin,
102
- serviceUrl: n.kol?.serviceUrl ?? t.kol.serviceUrl,
103
- token: n.kol?.token ?? t.kol.token
104
- },
105
70
  plugin: {
106
71
  pin: n.plugin?.pin ?? t.plugin.pin,
107
72
  usbKeyType: n.plugin?.usbKeyType ?? t.plugin.usbKeyType
@@ -113,35 +78,23 @@ const U = "RIGHT_CENTER", N = "REGULAR_ESM", B = "auto", k = "__RHC_OFFICE_DIGIT
113
78
  defaultLogin: n.defaultLogin ?? t.defaultLogin,
114
79
  defaultPassword: n.defaultPassword ?? t.defaultPassword,
115
80
  defaultServer: n.defaultServer ?? t.defaultServer,
116
- kol: {
117
- appId: n.kol?.appId ?? t.kol.appId,
118
- appName: n.kol?.appName ?? t.kol.appName,
119
- serviceUrl: n.kol?.serviceUrl ?? t.kol.serviceUrl,
120
- token: n.kol?.token ?? t.kol.token
121
- },
122
81
  macAddress: n.macAddress ?? t.macAddress,
123
82
  token: n.token ?? t.token,
124
83
  usbKey: {
125
84
  checkCertificateBinding: n.usbKey?.checkCertificateBinding ?? t.usbKey.checkCertificateBinding,
126
85
  usbKeyType: n.usbKey?.usbKeyType ?? t.usbKey.usbKeyType
127
86
  }
128
- } : K(t), V = (t, n) => ({
87
+ } : V(t), K = (t, n) => ({
129
88
  defaults: W(t.defaults, n.defaults),
130
89
  signServer: $(t.signServer, n.signServer)
131
90
  }), X = (t, n) => {
132
91
  const e = t.defaults?.bjca || n.defaults?.bjca ? {
133
92
  ...t.defaults?.bjca,
134
93
  ...n.defaults?.bjca
135
- } : void 0, i = t.defaults?.kol || n.defaults?.kol ? {
136
- ...t.defaults?.kol,
137
- ...n.defaults?.kol
138
- } : void 0, r = t.defaults?.plugin || n.defaults?.plugin ? {
94
+ } : void 0, i = t.defaults?.plugin || n.defaults?.plugin ? {
139
95
  ...t.defaults?.plugin,
140
96
  ...n.defaults?.plugin
141
- } : void 0, a = t.signServer?.kol || n.signServer?.kol ? {
142
- ...t.signServer?.kol,
143
- ...n.signServer?.kol
144
- } : void 0, s = t.signServer?.usbKey || n.signServer?.usbKey ? {
97
+ } : void 0, r = t.signServer?.usbKey || n.signServer?.usbKey ? {
145
98
  ...t.signServer?.usbKey,
146
99
  ...n.signServer?.usbKey
147
100
  } : void 0;
@@ -150,47 +103,45 @@ const U = "RIGHT_CENTER", N = "REGULAR_ESM", B = "auto", k = "__RHC_OFFICE_DIGIT
150
103
  ...t.defaults,
151
104
  ...n.defaults,
152
105
  ...e ? { bjca: e } : {},
153
- ...i ? { kol: i } : {},
154
- ...r ? { plugin: r } : {}
106
+ ...i ? { plugin: i } : {}
155
107
  } : void 0,
156
108
  signServer: t.signServer || n.signServer ? {
157
109
  ...t.signServer,
158
110
  ...n.signServer,
159
- ...a ? { kol: a } : {},
160
- ...s ? { usbKey: s } : {}
111
+ ...r ? { usbKey: r } : {}
161
112
  } : void 0
162
113
  };
163
114
  }, J = () => globalThis, p = () => {
164
115
  const t = J();
165
- return t[k] || (t[k] = {
116
+ return t[f] || (t[f] = {
166
117
  current: g(E),
167
118
  defaults: g(E),
168
119
  overrides: {}
169
- }), t[k];
170
- }, lt = () => p().current, ct = () => {
120
+ }), t[f];
121
+ }, ct = () => p().current, ht = () => {
171
122
  const t = p();
172
123
  return {
173
124
  current: g(t.current),
174
125
  defaults: g(t.defaults),
175
- overrides: y(t.overrides)
126
+ overrides: v(t.overrides)
176
127
  };
177
- }, ht = (t) => {
178
- const n = p();
179
- return n.defaults = g(t), n.current = V(n.defaults, n.overrides), n.current;
180
128
  }, gt = (t) => {
181
129
  const n = p();
182
- return n.current = g(t), n.overrides = y(t), n.current;
130
+ return n.defaults = g(t), n.current = K(n.defaults, n.overrides), n.current;
183
131
  }, mt = (t) => {
184
132
  const n = p();
185
- return n.overrides = X(n.overrides, y(t)), n.current = V(n.current, t), n.current;
133
+ return n.current = g(t), n.overrides = v(t), n.current;
186
134
  }, pt = (t) => {
135
+ const n = p();
136
+ return n.overrides = X(n.overrides, v(t)), n.current = K(n.current, t), n.current;
137
+ }, bt = (t) => {
187
138
  const n = p();
188
139
  return t && (n.defaults = g(t)), n.overrides = {}, n.current = g(n.defaults), n.current;
189
- }, bt = {
140
+ }, St = {
190
141
  EDGE_POSITION: U,
191
142
  RSA_MODE: B,
192
143
  SIGNATURE_TYPE: N
193
- }, f = (t) => {
144
+ }, R = (t) => {
194
145
  if (t.length !== 0)
195
146
  return t.length === 1 ? t[0] : t;
196
147
  }, d = (t, n, e) => new Proxy(
@@ -211,16 +162,16 @@ const U = "RIGHT_CENTER", N = "REGULAR_ESM", B = "auto", k = "__RHC_OFFICE_DIGIT
211
162
  return a.state?.(e.state.snapshot(), s);
212
163
  const o = a.adapterMethod ?? r;
213
164
  if (a.kind === "query")
214
- return e.bridge.request(t, o, f(s));
165
+ return e.bridge.request(t, o, R(s));
215
166
  if (a.kind === "callbackQuery") {
216
167
  const c = s.find((h) => typeof h == "function"), l = s.filter((h) => typeof h != "function");
217
- e.bridge.request(t, o, f(l)).then((h) => {
168
+ e.bridge.request(t, o, R(l)).then((h) => {
218
169
  const j = a.mapCallbackResult?.(h) ?? [h];
219
170
  c?.(...j);
220
171
  }).catch(e.onAsyncError);
221
172
  return;
222
173
  }
223
- const u = e.bridge.request(t, o, f(s)).catch((c) => {
174
+ const u = e.bridge.request(t, o, R(s)).catch((c) => {
224
175
  e.onAsyncError(c);
225
176
  });
226
177
  if (a.returnsResult)
@@ -416,7 +367,7 @@ const oe = "rhc-office.editor-adapter", de = 1, ue = "__RHC_OFFICE_EDITOR_ADAPTE
416
367
  };
417
368
  class ce {
418
369
  constructor(n) {
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) => this.adapter.setUploadUrl(e), this.save = (e, i, r) => this.adapter.save(e, i, r), this.saveAs = (e) => {
370
+ 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) => {
420
371
  const i = this.context.bridge.getReaderId();
421
372
  if (!i)
422
373
  return Promise.resolve({
@@ -476,7 +427,7 @@ const be = () => ({
476
427
  rotateRight: { kind: "command", returnsResult: !0 },
477
428
  undo: { kind: "command", returnsResult: !0 }
478
429
  }), Se = (t) => t instanceof Uint8Array ? t : new Uint8Array(t);
479
- class ke {
430
+ class fe {
480
431
  constructor(n) {
481
432
  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(
482
433
  "pageArrange",
@@ -485,7 +436,7 @@ class ke {
485
436
  );
486
437
  }
487
438
  }
488
- const fe = (t) => ({
439
+ const Re = (t) => ({
489
440
  addPageChangeCallback: {
490
441
  kind: "callbackRegister",
491
442
  callback: (n, e) => {
@@ -535,11 +486,11 @@ const fe = (t) => ({
535
486
  gotoPreviousPage: { kind: "command" },
536
487
  rotatePage: { kind: "command" }
537
488
  });
538
- class Re {
489
+ class ke {
539
490
  constructor(n) {
540
491
  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(
541
492
  "page",
542
- fe(n),
493
+ Re(n),
543
494
  n
544
495
  );
545
496
  }
@@ -561,7 +512,7 @@ const Te = {
561
512
  mapCallbackResult: (t) => [Array.isArray(t) ? t : []]
562
513
  }
563
514
  };
564
- class ve {
515
+ class ye {
565
516
  constructor(n) {
566
517
  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(
567
518
  "pdfFormFiller",
@@ -570,18 +521,18 @@ class ve {
570
521
  );
571
522
  }
572
523
  }
573
- const ye = /\s*,\s*/, Ee = /\s*-\s*/, R = (t) => {
524
+ const ve = /\s*,\s*/, Ee = /\s*-\s*/, k = (t) => {
574
525
  const n = Number.parseInt(t.trim(), 10);
575
526
  return !Number.isFinite(n) || n <= 0 ? null : n;
576
527
  }, Pe = (t) => {
577
528
  const n = t.split(Ee);
578
529
  if (n.length === 1) {
579
- const r = R(n[0] ?? "");
530
+ const r = k(n[0] ?? "");
580
531
  return r ? [r] : [];
581
532
  }
582
- const e = R(n[0] ?? ""), i = R(n[1] ?? "");
533
+ const e = k(n[0] ?? ""), i = k(n[1] ?? "");
583
534
  return !e || !i || i < e ? [] : Array.from({ length: i - e + 1 }, (r, a) => e + a);
584
- }, Ce = (t) => t ? t.split(ye).flatMap((e) => Pe(e)).filter((e, i, r) => r.indexOf(e) === i) : [];
535
+ }, Ce = (t) => t ? t.split(ve).flatMap((e) => Pe(e)).filter((e, i, r) => r.indexOf(e) === i) : [];
585
536
  class De {
586
537
  constructor(n, e, i) {
587
538
  this.setFieldName = (r) => {
@@ -720,6 +671,7 @@ const Ne = /* @__PURE__ */ new Set([2, 5]), Be = (t) => ({
720
671
  setWatermark: { kind: "command" },
721
672
  setCompactMode: { kind: "command" },
722
673
  setRulerVisible: { kind: "command" },
674
+ setStatusBarVisible: { kind: "command" },
723
675
  toggleSidebar: { kind: "command" },
724
676
  enterBookViewMode: {
725
677
  kind: "callbackQuery",
@@ -742,13 +694,13 @@ class xe {
742
694
  ), 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(
743
695
  "setupRibbonMenu",
744
696
  "showRibbonMenu/hideRibbonMenu/setupRibbonMenuTab"
745
- ), 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);
697
+ ), 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 = d("ui", Be(n), n);
746
698
  }
747
699
  warnLegacyRibbonMethod(n, e) {
748
700
  console.warn(`[RHC Office SDK] ui.${n} is deprecated. Use ui.${e} instead.`);
749
701
  }
750
702
  }
751
- const Ke = (t) => {
703
+ const Ve = (t) => {
752
704
  if (!t)
753
705
  return;
754
706
  const n = t.trim().toLowerCase();
@@ -759,12 +711,12 @@ const Ke = (t) => {
759
711
  }, q = (t) => {
760
712
  const n = new URL(t, globalThis.location?.href ?? "http://localhost/");
761
713
  return n.hash = "", n.pathname.endsWith("/") || (n.pathname = `${n.pathname}/`), n.toString();
762
- }, Ve = (t) => new URL("editors.bootstrap.js", t).toString(), Ge = (t, n) => {
714
+ }, Ke = (t) => new URL("editors.bootstrap.js", t).toString(), Ge = (t, n) => {
763
715
  const e = q(t);
764
716
  return {
765
717
  ...n,
766
718
  appUrl: e,
767
- theme: Ke(n.theme)
719
+ theme: Ve(n.theme)
768
720
  };
769
721
  }, m = "rhc-office-editor", T = "__RHC_OFFICE_SDK_READER_LOADER__", H = () => {
770
722
  const t = globalThis;
@@ -800,7 +752,7 @@ const z = (t) => {
800
752
  const s = Promise.resolve();
801
753
  return n.loadPromises.set(t, s), s;
802
754
  }
803
- const i = Ve(t), r = qe(i);
755
+ const i = Ke(t), r = qe(i);
804
756
  n.activeAppUrl = t;
805
757
  const a = new Promise((s, o) => {
806
758
  const u = (h) => {
@@ -1082,11 +1034,22 @@ const S = "__RHC_OFFICE_READER_RUNTIME__", tt = "__rhcOfficeReaderRuntimeConfig"
1082
1034
  "documentLoaded",
1083
1035
  "documentStateChange",
1084
1036
  "documentError"
1085
- ], 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)}`, _ = (t, n) => ({
1037
+ ], it = "readerReady", rt = "readerUnload", y = "readerError", at = () => typeof globalThis.crypto?.randomUUID == "function" ? globalThis.crypto.randomUUID() : `rhc-reader-${Date.now()}-${Math.random().toString(36).slice(2)}`, _ = (t, n) => ({
1086
1038
  appUrl: n?.appUrl ?? null,
1087
1039
  configuration: n,
1088
1040
  element: t
1089
- }), st = (t) => {
1041
+ }), st = (t, n) => {
1042
+ if (!t)
1043
+ return;
1044
+ const e = typeof t == "string" ? t.trim() : t.userName.trim();
1045
+ if (!e)
1046
+ return;
1047
+ const i = n == null ? "" : String(n).trim(), r = typeof t == "string" || t.userId === void 0 || t.userId === null ? "" : String(t.userId).trim(), a = i || r;
1048
+ return {
1049
+ sessionUser: e,
1050
+ ...a ? { sessionUserId: a } : {}
1051
+ };
1052
+ }, ot = (t) => {
1090
1053
  if (typeof t == "string") {
1091
1054
  const n = document.getElementById(t);
1092
1055
  if (!n)
@@ -1098,7 +1061,7 @@ const S = "__RHC_OFFICE_READER_RUNTIME__", tt = "__rhcOfficeReaderRuntimeConfig"
1098
1061
  if (!(t instanceof HTMLDivElement))
1099
1062
  throw new Error("Reader container must be a div element.");
1100
1063
  return t;
1101
- }, ot = () => {
1064
+ }, dt = () => {
1102
1065
  const t = typeof globalThis.matchMedia == "function";
1103
1066
  return (t ? globalThis.matchMedia("(prefers-contrast: more)").matches : !1) ? "high-contrast" : (t ? globalThis.matchMedia("(prefers-color-scheme: dark)").matches : !1) ? "dark" : "light";
1104
1067
  }, O = (t, n) => {
@@ -1115,7 +1078,7 @@ const S = "__RHC_OFFICE_READER_RUNTIME__", tt = "__rhcOfficeReaderRuntimeConfig"
1115
1078
  return;
1116
1079
  }
1117
1080
  typeof e.removeListener == "function" && e.removeListener(n);
1118
- }, dt = (t) => {
1081
+ }, ut = (t) => {
1119
1082
  t.style.display || (t.style.display = "block"), t.style.width || (t.style.width = "100%"), t.style.height || (t.style.height = "100%");
1120
1083
  }, F = (t, n) => {
1121
1084
  const e = n;
@@ -1124,7 +1087,7 @@ const S = "__RHC_OFFICE_READER_RUNTIME__", tt = "__rhcOfficeReaderRuntimeConfig"
1124
1087
  if (e !== "auto")
1125
1088
  return t.setAttribute("theme", e), null;
1126
1089
  const i = () => {
1127
- t.setAttribute("theme", ot());
1090
+ t.setAttribute("theme", dt());
1128
1091
  };
1129
1092
  if (i(), typeof globalThis.matchMedia != "function")
1130
1093
  return null;
@@ -1135,7 +1098,7 @@ const S = "__RHC_OFFICE_READER_RUNTIME__", tt = "__rhcOfficeReaderRuntimeConfig"
1135
1098
  L(r, s), L(a, s);
1136
1099
  };
1137
1100
  };
1138
- class ut {
1101
+ class lt {
1139
1102
  constructor(n) {
1140
1103
  this.bridge = new $e(), this.callbacks = new et(), this.readerState = new Xe(), this.bridgeToolContext = {
1141
1104
  bridge: this.bridge,
@@ -1143,7 +1106,7 @@ class ut {
1143
1106
  debug: () => this.debugEnabled,
1144
1107
  onAsyncError: (e) => this.reportAdapterError(e),
1145
1108
  state: this.readerState
1146
- }, this.documentTool = new ce(this.bridgeToolContext), this.uiTool = new xe(this.bridgeToolContext), this.pageTool = new Re(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) => {
1109
+ }, this.documentTool = new ce(this.bridgeToolContext), this.uiTool = new xe(this.bridgeToolContext), this.pageTool = new ke(this.bridgeToolContext), this.pageArrangeTool = new fe(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 ye(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) => {
1147
1110
  this.debugEnabled = e;
1148
1111
  }, this.changeLanguage = (e) => {
1149
1112
  this.readerElement && this.readerElement.setAttribute("language", e);
@@ -1155,17 +1118,7 @@ class ut {
1155
1118
  }, this.setSessionUser = (e) => {
1156
1119
  this.sessionUser = e;
1157
1120
  }, this.setSessionUserId = (e) => {
1158
- if (typeof this.sessionUser == "string" || !this.sessionUser) {
1159
- this.sessionUser = {
1160
- userName: typeof this.sessionUser == "string" ? this.sessionUser : "",
1161
- userId: e
1162
- };
1163
- return;
1164
- }
1165
- this.sessionUser = {
1166
- ...this.sessionUser,
1167
- userId: e
1168
- };
1121
+ this.sessionUserId = e;
1169
1122
  }, this.setSessionData = (e) => {
1170
1123
  this.sessionData = e;
1171
1124
  }, this.isReaderReady = () => this.isReady, this.isReaderDestroyed = () => this.removed && !this.isReady, this.addReaderReadyCallback = (e) => {
@@ -1175,7 +1128,7 @@ class ut {
1175
1128
  }, this.setReaderEventListener = (e) => {
1176
1129
  this.readerEventListener = e;
1177
1130
  }, this.embedReader = (e, i, r) => {
1178
- const a = st(e), s = q(i);
1131
+ const a = ot(e), s = q(i);
1179
1132
  z(s);
1180
1133
  const o = Ge(s, r), u = this.mountToken + 1;
1181
1134
  this.removeReader(), this.mountToken = u, this.removed = !1, this.hostContainer = a, this.normalizedConfiguration = o, this.mountReader(a, o, u);
@@ -1190,9 +1143,12 @@ class ut {
1190
1143
  if (await ze(i.appUrl), this.mountToken !== r)
1191
1144
  return;
1192
1145
  const a = document.createElement(m), s = at();
1193
- a.setAttribute(G, s), this.readerId = s, this.bridge.setReaderId(s), dt(a), this.applyReaderRuntimeConfig(a, i);
1146
+ a.setAttribute(G, s), this.readerId = s, this.bridge.setReaderId(s), ut(a), this.applyReaderRuntimeConfig(a, i);
1194
1147
  const o = i.compactViewer === !0 && i.keepPCMenu !== !0;
1195
- if (a.toggleAttribute("data-sdk-compact-mode", o), a.setAttribute("language", i.language ?? "zh_CN"), this.themeCleanup = F(a, i.theme), this.bindNativeReaderEvents(a), e.replaceChildren(a), this.readerElement = a, await Promise.resolve(), this.mountToken !== r)
1148
+ if (a.toggleAttribute("data-sdk-compact-mode", o), a.toggleAttribute("data-sdk-ribbon-hidden", i.ribbonMenu === !1), a.toggleAttribute(
1149
+ "data-sdk-ribbon-title-hidden",
1150
+ i.ribbonTitle === !1
1151
+ ), a.setAttribute("language", i.language ?? "zh_CN"), this.themeCleanup = F(a, i.theme), this.bindNativeReaderEvents(a), e.replaceChildren(a), this.readerElement = a, await Promise.resolve(), this.mountToken !== r)
1196
1152
  return;
1197
1153
  const u = await this.bridge.waitForReady();
1198
1154
  if (this.mountToken !== r)
@@ -1221,7 +1177,7 @@ class ut {
1221
1177
  }), nt.forEach((r) => {
1222
1178
  const a = (s) => {
1223
1179
  const o = s instanceof CustomEvent ? s.detail : s;
1224
- r === "documentLoaded" && this.readerState.setDocumentOpened(!0), this.emitReaderEvent(r, o), r === "documentError" && this.emitReaderEvent(v, o);
1180
+ r === "documentLoaded" && this.readerState.setDocumentOpened(!0), this.emitReaderEvent(r, o), r === "documentError" && this.emitReaderEvent(y, o);
1225
1181
  };
1226
1182
  e.addEventListener(r, a), this.nativeEventCleanupCallbacks.push(() => {
1227
1183
  e.removeEventListener(r, a);
@@ -1234,9 +1190,9 @@ class ut {
1234
1190
  }, this.emitReaderEvent = (e, i) => {
1235
1191
  this.readerEventListener?.(e, i);
1236
1192
  }, this.reportReaderError = (e) => {
1237
- this.isReady = !1, this.debugEnabled && console.error("[RHC Office SDK] Reader mount failed", e), this.emitReaderEvent(v, e);
1193
+ this.isReady = !1, this.debugEnabled && console.error("[RHC Office SDK] Reader mount failed", e), this.emitReaderEvent(y, e);
1238
1194
  }, this.reportAdapterError = (e) => {
1239
- this.debugEnabled && console.error("[RHC Office SDK] Adapter command failed", e), this.emitReaderEvent(v, e);
1195
+ this.debugEnabled && console.error("[RHC Office SDK] Adapter command failed", e), this.emitReaderEvent(y, e);
1240
1196
  }, this.bridge.configureTimeouts({
1241
1197
  readyTimeoutMs: n?.readyTimeoutMs,
1242
1198
  requestTimeoutMs: n?.requestTimeoutMs
@@ -1244,18 +1200,19 @@ class ut {
1244
1200
  }
1245
1201
  applyReaderRuntimeConfig(n, e) {
1246
1202
  this.restoreReaderRuntimeConfig();
1247
- const i = {
1203
+ const i = st(this.sessionUser, this.sessionUserId), r = {
1248
1204
  hostKind: "server",
1249
1205
  server: {
1250
1206
  baseUrl: e.appUrl
1251
- }
1252
- }, r = n;
1253
- r[tt] = i;
1254
- const a = globalThis, s = a[S];
1207
+ },
1208
+ ...i ? { identity: i } : {}
1209
+ }, a = n;
1210
+ a[tt] = r;
1211
+ const s = globalThis, o = s[S];
1255
1212
  this.runtimeRestoreState = {
1256
- hadPreviousRuntime: s !== void 0,
1257
- ...s !== void 0 ? { previousRuntime: s } : {}
1258
- }, a[S] = i;
1213
+ hadPreviousRuntime: o !== void 0,
1214
+ ...o !== void 0 ? { previousRuntime: o } : {}
1215
+ }, s[S] = r;
1259
1216
  }
1260
1217
  restoreReaderRuntimeConfig() {
1261
1218
  if (!this.runtimeRestoreState)
@@ -1264,33 +1221,33 @@ class ut {
1264
1221
  this.runtimeRestoreState.hadPreviousRuntime ? n[S] = this.runtimeRestoreState.previousRuntime : Reflect.deleteProperty(n, S), this.runtimeRestoreState = null;
1265
1222
  }
1266
1223
  }
1267
- const St = (t) => new ut(t);
1224
+ const ft = (t) => new lt(t);
1268
1225
  export {
1269
1226
  ne as AnnotationToolImpl,
1270
1227
  re as CryptoToolImpl,
1271
- bt as DIGITAL_SIGN_DEFAULTS,
1228
+ St as DIGITAL_SIGN_DEFAULTS,
1272
1229
  Ae as DigitalSignOptions,
1273
1230
  se as DigitalSignToolImpl,
1274
- ut as DocumentSDK,
1231
+ lt as DocumentSDK,
1275
1232
  ce as DocumentToolImpl,
1276
1233
  ge as FindToolImpl,
1277
1234
  De as KVField,
1278
1235
  pe as NetworkingToolImpl,
1279
- ke as PageArrangeToolImpl,
1280
- Re as PageToolImpl,
1281
- ve as PdfFormFillerImpl,
1236
+ fe as PageArrangeToolImpl,
1237
+ ke as PageToolImpl,
1238
+ ye as PdfFormFillerImpl,
1282
1239
  we as SecurityToolImpl,
1283
1240
  _e as SignServerToolImpl,
1284
1241
  Le as SymbologyToolImpl,
1285
1242
  Ue as TemplateSignToolImpl,
1286
1243
  xe as UIToolImpl,
1287
1244
  Y as WatermarkDisplay,
1288
- St as createNewDocumentSdk,
1289
- lt as getDigitalSignEnvironment,
1290
- ct as getDigitalSignEnvironmentSource,
1291
- ht as initializeDigitalSignEnvironment,
1292
- mt as patchDigitalSignEnvironment,
1293
- pt as resetDigitalSignEnvironment,
1294
- gt as setDigitalSignEnvironment
1245
+ ft as createNewDocumentSdk,
1246
+ ct as getDigitalSignEnvironment,
1247
+ ht as getDigitalSignEnvironmentSource,
1248
+ gt as initializeDigitalSignEnvironment,
1249
+ pt as patchDigitalSignEnvironment,
1250
+ bt as resetDigitalSignEnvironment,
1251
+ mt as setDigitalSignEnvironment
1295
1252
  };
1296
1253
  //# sourceMappingURL=index.js.map