@rhc-office/sdk 6.6.264 → 6.6.268

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/README.md +3 -4
  2. package/dist/api/callbacks.d.ts +0 -1
  3. package/dist/api/callbacks.d.ts.map +1 -1
  4. package/dist/api/crypto-tool.d.ts +12 -1
  5. package/dist/api/crypto-tool.d.ts.map +1 -1
  6. package/dist/api/document-sdk.d.ts +0 -6
  7. package/dist/api/document-sdk.d.ts.map +1 -1
  8. package/dist/api/sign-tool.d.ts +43 -1
  9. package/dist/api/sign-tool.d.ts.map +1 -1
  10. package/dist/browser/document-viewer.js +1 -1
  11. package/dist/browser/document-viewer.js.map +1 -1
  12. package/dist/index.d.ts +1 -3
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +670 -556
  15. package/dist/index.js.map +1 -1
  16. package/dist/index.umd.cjs +1 -1
  17. package/dist/index.umd.cjs.map +1 -1
  18. package/dist/tools/AnnotationToolImpl.d.ts +47 -0
  19. package/dist/tools/AnnotationToolImpl.d.ts.map +1 -0
  20. package/dist/tools/CryptoToolImpl.d.ts +9 -0
  21. package/dist/tools/CryptoToolImpl.d.ts.map +1 -0
  22. package/dist/tools/DigitalSignToolImpl.d.ts +27 -0
  23. package/dist/tools/DigitalSignToolImpl.d.ts.map +1 -0
  24. package/dist/tools/DocumentToolImpl.d.ts +1 -0
  25. package/dist/tools/DocumentToolImpl.d.ts.map +1 -1
  26. package/dist/tools/SignServerToolImpl.d.ts +19 -0
  27. package/dist/tools/SignServerToolImpl.d.ts.map +1 -0
  28. package/dist/tools/SymbologyToolImpl.d.ts +8 -0
  29. package/dist/tools/SymbologyToolImpl.d.ts.map +1 -0
  30. package/dist/tools/TemplateSignToolImpl.d.ts +13 -0
  31. package/dist/tools/TemplateSignToolImpl.d.ts.map +1 -0
  32. package/dist/tools/index.d.ts +6 -0
  33. package/dist/tools/index.d.ts.map +1 -1
  34. package/dist/viewer/DocumentSDK.d.ts +0 -8
  35. package/dist/viewer/DocumentSDK.d.ts.map +1 -1
  36. package/dist/viewer/ReaderStateStore.d.ts +0 -1
  37. package/dist/viewer/ReaderStateStore.d.ts.map +1 -1
  38. package/dist/viewer/SdkCallbackRegistry.d.ts +4 -2
  39. package/dist/viewer/SdkCallbackRegistry.d.ts.map +1 -1
  40. package/package.json +1 -1
  41. package/src/api/callbacks.ts +4 -17
  42. package/src/api/crypto-tool.ts +13 -1
  43. package/src/api/document-sdk.ts +0 -9
  44. package/src/api/sign-tool.ts +62 -1
  45. package/src/index.ts +1 -3
  46. package/src/tools/AnnotationToolImpl.ts +263 -0
  47. package/src/tools/CryptoToolImpl.ts +27 -0
  48. package/src/tools/DigitalSignToolImpl.ts +155 -0
  49. package/src/tools/DocumentToolImpl.ts +24 -2
  50. package/src/tools/SignServerToolImpl.ts +92 -0
  51. package/src/tools/SymbologyToolImpl.ts +34 -0
  52. package/src/tools/TemplateSignToolImpl.ts +51 -0
  53. package/src/tools/index.ts +6 -0
  54. package/src/viewer/DocumentSDK.ts +13 -157
  55. package/src/viewer/ReaderBridgeClient.ts +1 -1
  56. package/src/viewer/ReaderStateStore.ts +0 -2
  57. package/src/viewer/SdkCallbackRegistry.ts +8 -8
  58. package/dist/api/ekey-tool.d.ts +0 -8
  59. package/dist/api/ekey-tool.d.ts.map +0 -1
  60. package/dist/api/extension-tool.d.ts +0 -5
  61. package/dist/api/extension-tool.d.ts.map +0 -1
  62. package/dist/api/review-tool.d.ts +0 -71
  63. package/dist/api/review-tool.d.ts.map +0 -1
  64. package/src/api/ekey-tool.ts +0 -11
  65. package/src/api/extension-tool.ts +0 -5
  66. package/src/api/review-tool.ts +0 -105
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # 软航版式文档服务(RHC Office) SDK
2
2
 
3
- `@rhc-office/sdk` 是软航版式文档服务的 Web 端阅读器集成 SDK。它负责在第三方应用中加载阅读器、挂载阅读器 Web Component,并把本地或网络文档打开、网络文件保存回传、多文档阅读、页面控制、UI 配置、批注、打印、保存导出、PDF 表单填充、数字签章和审阅协同等能力封装成统一的工具接口,便于业务系统把阅读器嵌入到自己的门户、业务审批、档案管理、合同管理或在线预览流程中。
3
+ `@rhc-office/sdk` 是软航版式文档服务的 Web 端阅读器集成 SDK。它负责在第三方应用中加载阅读器、挂载阅读器 Web Component,并把本地或网络文档打开、网络文件保存回传、多文档阅读、页面控制、UI 配置、批注、打印、保存导出、PDF 表单填充和数字签章等能力封装成统一的工具接口,便于业务系统把阅读器嵌入到自己的门户、业务审批、档案管理、合同管理或在线预览流程中。
4
4
 
5
5
  ## 功能特性
6
6
 
@@ -15,10 +15,9 @@
15
15
  - 批注能力:支持进入/退出批注视图、文本批注、手写批注、图章批注、模板签标记、批注导入导出、批注列表查询、画笔样式配置、撤销、重做、清空以及保存批注。
16
16
  - 打印与预览:提供阅读器侧打印和预览入口,可接入阅读器的高保真打印流程;OFD/PDF 场景可由阅读器生成适合系统打印的 PDF 输出,满足矢量化或版式保真打印需求。
17
17
  - PDF 表单填充:支持打开表单填充模式、设置字段值、控制字段只读状态、提交、清空,并导出表单键值数据。
18
- - 数字签章:支持签章参数配置、签章服务登录、USB Key/EKey 认证、外部印章服务、签章回调、签章列表读取、签章验签、签章信息展示和吊销检查等业务流程。
18
+ - 数字签章:支持签章参数配置、签章服务登录、USB Key 认证、外部印章服务、签章回调、签章列表读取、签章验签、签章信息展示和吊销检查等业务流程。
19
19
  - 模板签与骑缝签:支持创建常规印模、单侧骑缝印模、对称骑缝印模和校核印模,支持列举、删除印模,并可按模板印模执行签章。
20
- - 审阅协同:支持创建和打开审阅会话、管理审阅参与者和审阅文档、嵌入审阅视图、控制发言人,以及按参与者控制批注权限。
21
- - 扩展和安全能力:支持浏览器扩展连接状态监听、安全 Provider 配置、签章/验签 Provider 管理,以及 PDF417 条码生成等扩展场景。
20
+ - 安全和扩展能力:支持安全 Provider 配置、签章/验签 Provider 管理,以及 PDF417 条码生成等扩展场景。
22
21
  - 事件和状态:支持监听阅读器就绪、卸载、文档打开、保存、关闭、页码变化等事件,便于宿主应用同步业务状态。
23
22
  - 数字签名环境配置:支持在挂载阅读器前注入签章默认参数和签章服务配置,便于不同业务系统统一签章环境。
24
23
 
@@ -21,5 +21,4 @@ export type DigitalSignatureRetrieveCallback = (digitalSignature: any[]) => void
21
21
  export type DigitalSignatureParseCallback = (digitalSignature: any[]) => void;
22
22
  export type DocumentServerAuthCallback = (credentials: string) => void;
23
23
  export type TextAnnotationModifiedCallback = (event: string, annotation: ITextAnnotationInfo) => void;
24
- export type ExtensionStateChangedCallback = (state: 'connected' | 'disconnected') => void;
25
24
  //# sourceMappingURL=callbacks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"callbacks.d.ts","sourceRoot":"","sources":["../../src/api/callbacks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAEhF,MAAM,MAAM,mBAAmB,GAAG,MAAM,IAAI,CAAC;AAC7C,MAAM,MAAM,oBAAoB,GAAG,MAAM,IAAI,CAAC;AAE9C,MAAM,MAAM,sBAAsB,GAAG,CACnC,MAAM,EAAE,MAAM,EACd,KAAK,CAAC,EAAE,GAAG,EACX,OAAO,CAAC,EAAE,GAAG,KACV,IAAI,CAAC;AAEV,MAAM,MAAM,qBAAqB,GAAG,CAAC,QAAQ,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;AAE7D,MAAM,MAAM,wBAAwB,GAAG,CAAC,YAAY,EAAE,GAAG,KAAK,OAAO,CAAC;AAEtE,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;AAE7D,MAAM,MAAM,kBAAkB,GAAG,CAC/B,SAAS,EAAE,MAAM,EACjB,SAAS,EA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AM,6BAA6B,GAAG,CAAC,gBAAgB,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;AAE9E,MAAM,MAAM,0BAA0B,GAAG,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;AAEvE,MAAM,MAAM,8BAA8B,GAAG,CAC3C,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,mBAAmB,KAC5B,IAAI,CAAC"}
@@ -1,5 +1,16 @@
1
+ /**
2
+ * 支持的算法提供者厂商。
3
+ *
4
+ * - `CE`: 默认基础实现
5
+ * - `SCE`: 基于服务器软件的算法实现
6
+ * - `HCE:*`: 服务器加密机,冒号后为加密机类型
7
+ * - `BeCE`: 浏览器插件
8
+ * - `KolPKI`: 格尔中间件 PKI 服务,USB 硬件 Key
9
+ * - `BJCAPKI`: 北京 CA 中间件 PKI 服务,USB 硬件 Key
10
+ */
11
+ export type SecurityProviderName = 'CE' | 'SCE' | `HCE:${string}` | 'BeCE' | 'KolPKI' | 'BJCAPKI';
1
12
  export type SecurityProviderInfo = {
2
- providerName: string;
13
+ providerName: SecurityProviderName;
3
14
  applyFor: 'DocSign' | 'DocSignVerification';
4
15
  };
5
16
  export interface CryptoTool {
@@ -1 +1 @@
1
- {"version":3,"file":"crypto-tool.d.ts","sourceRoot":"","sources":["../../src/api/crypto-tool.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAAG;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,SAAS,GAAG,qBAAqB,CAAC;CAC7C,CAAC;AAEF,MAAM,WAAW,UAAU;IACzB,sBAAsB,CAAC,SAAS,EAAE,oBAAoB,EAAE,GAAG,IAAI,CAAC;IAEhE,oBAAoB,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAAC;CACzD"}
1
+ {"version":3,"file":"crypto-tool.d.ts","sourceRoot":"","sources":["../../src/api/crypto-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,MAAM,oBAAoB,GAAG,IAAI,GAAG,KAAK,GAAG,OAAO,MAAM,EAAE,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC;AAElG,MAAM,MAAM,oBAAoB,GAAG;IACjC,YAAY,EAAE,oBAAoB,CAAC;IACnC,QAAQ,EAAE,SAAS,GAAG,qBAAqB,CAAC;CAC7C,CAAC;AAEF,MAAM,WAAW,UAAU;IACzB,sBAAsB,CAAC,SAAS,EAAE,oBAAoB,EAAE,GAAG,IAAI,CAAC;IAEhE,oBAAoB,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAAC;CACzD"}
@@ -8,12 +8,9 @@ import { FindTool } from './find-tool';
8
8
  import { DigitalSignTool } from './sign-tool';
9
9
  import { SignServerTool } from './sign-server';
10
10
  import { NetworkingTool } from './networking-tool';
11
- import { EkeyTool } from './ekey-tool';
12
- import { ExtensionTool } from './extension-tool';
13
11
  import { SymbologyTool } from './symbology-tool';
14
12
  import { TemplateSignTool } from './template-sign';
15
13
  import { PdfFormFiller } from './pdf-formfiller';
16
- import { ReviewTool } from './review-tool';
17
14
  import { CryptoTool } from './crypto-tool';
18
15
  export interface IReaderEmbedOptions {
19
16
  debug?: boolean;
@@ -92,13 +89,10 @@ export interface IDocumentSDK {
92
89
  getFindTool(): FindTool;
93
90
  getSignServerTool(): SignServerTool;
94
91
  getDigitalSignTool(): DigitalSignTool;
95
- getReviewTool(): ReviewTool;
96
- getEkeyTool(): EkeyTool;
97
92
  getSymbologyTool(): SymbologyTool;
98
93
  getAnnotationTool(): AnnotationTool;
99
94
  getTemplateSignTool(): TemplateSignTool;
100
95
  getPdfFormFiller(): PdfFormFiller;
101
- getExtensionTool(): ExtensionTool;
102
96
  getNetworkingTool(): NetworkingTool;
103
97
  getCryptoTool(): CryptoTool;
104
98
  createDigitalSignOptions(): IDigitalSignOptions;
@@ -1 +1 @@
1
- {"version":3,"file":"document-sdk.d.ts","sourceRoot":"","sources":["../../src/api/document-sdk.ts"],"names":[],"mappings":"AAAA,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Aa,CAAC;IAElC,iBAAiB,IAAI,cAAc,CAAC;IAEpC,mBAAmB,IAAI,gBAAgB,CAAC;IAExC,gBAAgB,IAAI,aAAa,CAAC;IAElC,iBAAiB,IAAI,cAAc,CAAC;IAEpC,aAAa,IAAI,UAAU,CAAC;IAE5B,wBAAwB,IAAI,mBAAmB,CAAC;IAEhD,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;CAC3E"}
@@ -1,9 +1,51 @@
1
1
  import { DigitalSignatureRetrieveCallback, DigitalSignCallback } from './callbacks';
2
2
  import { IDigitalSignOptions } from './common';
3
+ import type { SecurityProviderName } from './crypto-tool';
4
+ export type DigitalSignCryptoProviderUsage = 'DigitalSign' | 'SignatureVerification';
5
+ export type USBKeyType = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16;
6
+ export type CryptoProviderConfiguration = Record<string, unknown>;
7
+ export type BrowserCryptoProviderConfiguration = CryptoProviderConfiguration & {
8
+ /**
9
+ * 浏览器插件签章时使用的 USB 硬件 Key 类型。
10
+ *
11
+ * 1: 海泰
12
+ * 2: 明华
13
+ * 3: 大明五洲
14
+ * 4: 飞天 EPAS 3000
15
+ * 5: 飞天,深圳 CA
16
+ * 6: 九思泰达,深圳 CA
17
+ * 7: 飞天 EPAS 2000
18
+ * 8: 华申 华大 Key
19
+ * 9: 东方中讯 ekey
20
+ * 10: 握奇 ekey
21
+ * 11: 贵州黔南 HTK
22
+ * 12: 飞天,格尔
23
+ * 13: 飞天,坚石诚信
24
+ * 14: 龙脉科技
25
+ * 15: 龙脉天威定制
26
+ * 16: 陕西 CA
27
+ */
28
+ usbKeyType?: USBKeyType;
29
+ };
30
+ export type KolPkiCryptoProviderConfiguration = CryptoProviderConfiguration & {
31
+ kmsAddress: string;
32
+ appName: string;
33
+ appID: string;
34
+ token: string;
35
+ };
36
+ export type HceCryptoProviderConfiguration = CryptoProviderConfiguration & {
37
+ kmsAddress?: string;
38
+ svsAddress?: string;
39
+ cbcKeyId?: string;
40
+ secretKey?: string;
41
+ accessKey?: string;
42
+ secretKeyVersion?: string;
43
+ };
44
+ export type DigitalSignCryptoProviderConfiguration<Provider extends SecurityProviderName = SecurityProviderName> = Provider extends 'BeCE' ? BrowserCryptoProviderConfiguration : Provider extends 'KolPKI' ? KolPkiCryptoProviderConfiguration : Provider extends `HCE:${string}` ? HceCryptoProviderConfiguration : CryptoProviderConfiguration;
3
45
  export interface DigitalSignTool {
4
46
  addDigitalSignatureRetrieveCallback(callback: DigitalSignatureRetrieveCallback): void;
5
47
  addDigitalSignatureParseCallback(callback: (digitalSignature: any[]) => void): void;
6
- setCryptoProvider(usage: 'DigitalSign' | 'SignatureVerification', provider: string, configuration?: any): void;
48
+ setCryptoProvider<Provider extends SecurityProviderName>(usage: DigitalSignCryptoProviderUsage, provider: Provider, configuration?: DigitalSignCryptoProviderConfiguration<Provider>): void;
7
49
  setSealSource(source: 'SignServer' | 'USBKey' | 'ExternalServer'): void;
8
50
  setDefaultStampPassword(stampPassword: string): void;
9
51
  setDefaultSealPassword(sealPassword: string): void;
@@ -1 +1 @@
1
- {"version":3,"file":"sign-tool.d.ts","sourceRoot":"","sources":["../../src/api/sign-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gCAAgC,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,WAAW,eAAe;IAC9B,mCAAmC,CAAC,QAAQ,EAAE,gCAAgC,GAAG,IAAI,CAAC;IAEtF,gCAAgC,CAAC,QAAQ,EAAE,CAAC,gBAAgB,EAAE,GAAG,EAAE,KAAK,IAAI,GAAG,IAAI,CAAC;IAEpF,iBAAiB,CAAC,KAAK,EAAE,aAAa,GAAG,uBAAuB,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa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ACtB,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,GAAG,IAAI,CAAC;IAET,6BAA6B,CAAC,OAAO,EAAE,IAAI,GAAG,OAAO,GAAG,IAAI,CAAC;IAE7D,+BAA+B,CAAC,OAAO,EAAE,IAAI,GAAG,OAAO,GAAG,IAAI,CAAC;IAE/D,mBAAmB,CAAC,OAAO,EAAE,IAAI,GAAG,OAAO,EAAE,QAAQ,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAEnF,4CAA4C,CAAC,OAAO,EAAE,mBAAmB,GAAG,GAAG,GAAG,IAAI,CAAC;IAEvF,qBAAqB,CAAC,QAAQ,CAAC,EAAE,CAAC,gBAAgB,EAAE,GAAG,EAAE,KAAK,IAAI,GAAG,IAAI,CAAC;IAE1E,oBAAoB,IAAI,GAAG,EAAE,CAAC;IAE9B,yBAAyB,IAAI,MAAM,CAAC;IAEpC,8BAA8B,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IAEvD,gCAAgC,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;CAC1D"}
@@ -1,2 +1,2 @@
1
- var RHCOfficeSDK=function(g){"use strict";var M=(n=>(n.DEFAULT="default",n.COMPACT="compact",n.HIDE="none",n))(M||{});const V="RIGHT_CENTER",B="REGULAR_ESM",x="auto",I="__RHC_OFFICE_DIGITAL_SIGN_ENVIRONMENT__",K={defaults:{bjca:{pin:""},deviceType:"client",edgePosition:V,kol:{appId:"",appName:"",pin:"",serviceUrl:"",token:""},plugin:{pin:"",usbKeyType:14},rsaMode:x,signatureType:B},signServer:{authSource:"Password",defaultLogin:"",defaultPassword:"",defaultServer:"",kol:{appId:"",appName:"",serviceUrl:"",token:""},macAddress:"",token:"",usbKey:{checkCertificateBinding:!1,usbKeyType:14}}},H=n=>({bjca:{pin:n.bjca.pin},deviceType:n.deviceType,edgePosition:n.edgePosition,kol:{appId:n.kol.appId,appName:n.kol.appName,pin:n.kol.pin,serviceUrl:n.kol.serviceUrl,token:n.kol.token},plugin:{pin:n.plugin.pin,usbKeyType:n.plugin.usbKeyType},rsaMode:n.rsaMode,signatureType:n.signatureType}),G=n=>({authSource:n.authSource,defaultLogin:n.defaultLogin,defaultPassword:n.defaultPassword,defaultServer:n.defaultServer,kol:{appId:n.kol.appId,appName:n.kol.appName,serviceUrl:n.kol.serviceUrl,token:n.kol.token},macAddress:n.macAddress,token:n.token,usbKey:{checkCertificateBinding:n.usbKey.checkCertificateBinding,usbKeyType:n.usbKey.usbKeyType}}),S=n=>({defaults:H(n.defaults),signServer:G(n.signServer)}),q=n=>({defaults:n.defaults?{...n.defaults,bjca:n.defaults.bjca?{...n.defaults.bjca}:void 0,kol:n.defaults.kol?{...n.defaults.kol}:void 0,plugin:n.defaults.plugin?{...n.defaults.plugin}:void 0}:void 0,signServer:n.signServer?{...n.signServer,kol:n.signServer.kol?{...n.signServer.kol}:void 0,usbKey:n.signServer.usbKey?{...n.signServer.usbKey}:void 0}:void 0}),de=(n,t)=>{var e,i,r,a,o,s,d,h,u,l,m,c,f,p,k,T,E,R,A,D;return t?{bjca:{pin:(i=(e=t.bjca)==null?void 0:e.pin)!=null?i:n.bjca.pin},deviceType:(r=t.deviceType)!=null?r:n.deviceType,edgePosition:(a=t.edgePosition)!=null?a:n.edgePosition,kol:{appId:(s=(o=t.kol)==null?void 0:o.appId)!=null?s:n.kol.appId,appName:(h=(d=t.kol)==null?void 0:d.appName)!=null?h:n.kol.appName,pin:(l=(u=t.kol)==null?void 0:u.pin)!=null?l:n.kol.pin,serviceUrl:(c=(m=t.kol)==null?void 0:m.serviceUrl)!=null?c:n.kol.serviceUrl,token:(p=(f=t.kol)==null?void 0:f.token)!=null?p:n.kol.token},plugin:{pin:(T=(k=t.plugin)==null?void 0:k.pin)!=null?T:n.plugin.pin,usbKeyType:(R=(E=t.plugin)==null?void 0:E.usbKeyType)!=null?R:n.plugin.usbKeyType},rsaMode:(A=t.rsaMode)!=null?A:n.rsaMode,signatureType:(D=t.signatureType)!=null?D:n.signatureType}:H(n)},le=(n,t)=>{var e,i,r,a,o,s,d,h,u,l,m,c,f,p,k,T,E,R;return t?{authSource:(e=t.authSource)!=null?e:n.authSource,defaultLogin:(i=t.defaultLogin)!=null?i:n.defaultLogin,defaultPassword:(r=t.defaultPassword)!=null?r:n.defaultPassword,defaultServer:(a=t.defaultServer)!=null?a:n.defaultServer,kol:{appId:(s=(o=t.kol)==null?void 0:o.appId)!=null?s:n.kol.appId,appName:(h=(d=t.kol)==null?void 0:d.appName)!=null?h:n.kol.appName,serviceUrl:(l=(u=t.kol)==null?void 0:u.serviceUrl)!=null?l:n.kol.serviceUrl,token:(c=(m=t.kol)==null?void 0:m.token)!=null?c:n.kol.token},macAddress:(f=t.macAddress)!=null?f:n.macAddress,token:(p=t.token)!=null?p:n.token,usbKey:{checkCertificateBinding:(T=(k=t.usbKey)==null?void 0:k.checkCertificateBinding)!=null?T:n.usbKey.checkCertificateBinding,usbKeyType:(R=(E=t.usbKey)==null?void 0:E.usbKeyType)!=null?R:n.usbKey.usbKeyType}}:G(n)},Q=(n,t)=>({defaults:de(n.defaults,t.defaults),signServer:le(n.signServer,t.signServer)}),ce=(n,t)=>{var e,i,r,a,o,s,d,h,u,l,m,c,f,p,k,T,E,R,A,D;return{defaults:n.defaults||t.defaults?{...n.defaults,...t.defaults,bjca:{...(i=(e=n.defaults)==null?void 0:e.bjca)!=null?i:{},...(a=(r=t.defaults)==null?void 0:r.bjca)!=null?a:{}},kol:{...(s=(o=n.defaults)==null?void 0:o.kol)!=null?s:{},...(h=(d=t.defaults)==null?void 0:d.kol)!=null?h:{}},plugin:{...(l=(u=n.defaults)==null?void 0:u.plugin)!=null?l:{},...(c=(m=t.defaults)==null?void 0:m.plugin)!=null?c:{}}}:void 0,signServer:n.signServer||t.signServer?{...n.signServer,...t.signServer,kol:{...(p=(f=n.signServer)==null?void 0:f.kol)!=null?p:{},...(T=(k=t.signServer)==null?void 0:k.kol)!=null?T:{}},usbKey:{...(R=(E=n.signServer)==null?void 0:E.usbKey)!=null?R:{},...(D=(A=t.signServer)==null?void 0:A.usbKey)!=null?D:{}}}:void 0}},ue=()=>globalThis,C=()=>{const n=ue();return n[I]||(n[I]={current:S(K),defaults:S(K),overrides:{}}),n[I]},z=()=>C().current,W=n=>{const t=C();return t.defaults=S(n),t.current=Q(t.defaults,t.overrides),t.current},$=n=>{const t=C();return t.current=S(n),t.overrides=q(n),t.current},j=n=>{const t=C();return t.overrides=ce(t.overrides,q(n)),t.current=Q(t.current,n),t.current},Y=n=>{const t=C();return n&&(t.defaults=S(n)),t.overrides={},t.current=S(t.defaults),t.current},X={EDGE_POSITION:V,RSA_MODE:x,SIGNATURE_TYPE:B},w=n=>{if(n.length!==0)return n.length===1?n[0]:n},b=(n,t,e)=>new Proxy({},{get:(i,r)=>{if(r==="then")return;if(typeof r=="symbol")return r===Symbol.toStringTag?n:void 0;const a=t[r];return a?(...o)=>{var d,h,u;if(a.kind==="callbackRegister"){(d=a.callback)==null||d.call(a,e.callbacks,o);return}if(a.kind==="stateGetter")return(h=a.state)==null?void 0:h.call(a,e.state.snapshot(),o);const s=(u=a.adapterMethod)!=null?u:r;if(a.kind==="query")return e.bridge.request(n,s,w(o));if(a.kind==="callbackQuery"){const l=o.find(c=>typeof c=="function"),m=o.filter(c=>typeof c!="function");e.bridge.request(n,s,w(m)).then(c=>{var p,k;const f=(k=(p=a.mapCallbackResult)==null?void 0:p.call(a,c))!=null?k:[c];l==null||l(...f)}).catch(e.onAsyncError);return}e.bridge.request(n,s,w(o)).catch(e.onAsyncError)}:(...o)=>{const s=new Error(`${n}.${r} is not implemented by the SDK adapter.`);e.onAsyncError(s)}}}),v=(n,t)=>new Proxy({},{get:(e,i)=>{if(i!=="then"&&typeof i!="symbol")return(...r)=>{const a=`${n}.${i} is not implemented by the SDK adapter.`;t.onAsyncError(new Error(a))}}}),he={addDocumentOpenedCallback:{kind:"callbackRegister",callback:(n,t)=>{const e=t[0];typeof e=="function"&&n.documentOpened.push(e)}},addDocumentSavedCallback:{kind:"callbackRegister",callback:(n,t)=>{const e=t[0];typeof e=="function"&&n.documentSaved.push(e)}},addDocumentClosedCallback:{kind:"callbackRegister",callback:(n,t)=>{const e=t[0];typeof e=="function"&&n.documentClosed.push(e)}},openPDFDocument:{kind:"callbackQuery",adapterMethod:"open"},openPdfDocument:{kind:"callbackQuery",adapterMethod:"open"},openOFDDocument:{kind:"callbackQuery",adapterMethod:"open"},openOfdDocument:{kind:"callbackQuery",adapterMethod:"open"},openOfficeDocument:{kind:"callbackQuery",adapterMethod:"open"},openImageDocument:{kind:"callbackQuery",adapterMethod:"open"},openTextDocument:{kind:"callbackQuery",adapterMethod:"open"},openFromLocalStorage:{kind:"command"},setUploadUrl:{kind:"command"},save:{kind:"callbackQuery"},saveAs:{kind:"query"},getDocumentContent:{kind:"callbackQuery",mapCallbackResult:n=>{const t=n;return[t==null?void 0:t.fileCacheId,t==null?void 0:t.fileBuffer]}},closeDocument:{kind:"callbackQuery"},isDocumentOpened:{kind:"stateGetter",state:n=>n.documentOpened},isDocumentModified:{kind:"stateGetter",state:n=>n.documentModified},print:{kind:"command"},createPreview:{kind:"command"}};class me{constructor(t){this.addDocumentOpenedCallback=e=>this.adapter.addDocumentOpenedCallback(e),this.addDocumentSavedCallback=e=>this.adapter.addDocumentSavedCallback(e),this.addDocumentClosedCallback=e=>this.adapter.addDocumentClosedCallback(e),this.openPDFDocument=(e,i)=>this.adapter.openPDFDocument(e,i),this.openPdfDocument=(e,i)=>this.adapter.openPdfDocument(e,i),this.openOFDDocument=(e,i)=>this.adapter.openOFDDocument(e,i),this.openOfdDocument=(e,i)=>this.adapter.openOfdDocument(e,i),this.openOfficeDocument=(e,i)=>this.adapter.openOfficeDocument(e,i),this.openImageDocument=(e,i)=>this.adapter.openImageDocument(e,i),this.openTextDocument=(e,i)=>this.adapter.openTextDocument(e,i),this.openFromLocalStorage=()=>this.adapter.openFromLocalStorage(),this.setUploadUrl=e=>this.adapter.setUploadUrl(e),this.save=(e,i,r)=>this.adapter.save(e,i,r),this.saveAs=e=>this.adapter.saveAs(e),this.getDocumentContent=e=>this.adapter.getDocumentContent(e),this.closeDocument=(e,i,r)=>this.adapter.closeDocument(e,i,r),this.isDocumentOpened=()=>this.adapter.isDocumentOpened(),this.isDocumentModified=()=>this.adapter.isDocumentModified(),this.print=()=>this.adapter.print(),this.createPreview=(e,i)=>this.adapter.createPreview(e,i),this.adapter=b("document",he,t)}}const ge={clearFind:{kind:"command"},findNext:{kind:"command"},findPrevious:{kind:"command"}};class pe{constructor(t){this.clearFind=()=>this.adapter.clearFind(),this.findNext=e=>this.adapter.findNext(e),this.findPrevious=e=>this.adapter.findPrevious(e),this.adapter=b("find",ge,t)}}const ke={configFileUpload:{kind:"command"},setHttpHeaders:{kind:"command"},setHttpFormFields:{kind:"command"}};class fe{constructor(t){this.configFileUpload=e=>this.adapter.configFileUpload(e),this.setHttpHeaders=e=>this.adapter.setHttpHeaders(e),this.setHttpFormFields=e=>this.adapter.setHttpFormFields(e),this.adapter=b("networking",ke,t)}}const be=n=>({addPageChangeCallback:{kind:"callbackRegister",callback:(t,e)=>{const i=e[0];typeof i=="function"&&t.pageChange.push(i)}},addPageModeChangeCallback:{kind:"callbackRegister",callback:(t,e)=>{const i=e[0];typeof i=="function"&&t.pageModeChange.push(i)}},getPageCount:{kind:"callbackRegister",callback:(t,e)=>{const i=e[0];typeof i=="function"&&i(n.state.snapshot().pageCount)}},getPageIndex:{kind:"callbackRegister",callback:(t,e)=>{const i=e[0];typeof i=="function"&&i(n.state.snapshot().pageIndex)}},setSinglePageViewMode:{kind:"command"},setTwoPagesViewMode:{kind:"command"},setPageScrollVertical:{kind:"command"},setPageScrollHorizontal:{kind:"command"},setPageCursorPanDrag:{kind:"command"},setPageCursorTextSelect:{kind:"command"},rotateCW:{kind:"command"},rotateCCW:{kind:"command"},autoFitPage:{kind:"command"},fitPageSize:{kind:"command"},fitPageWidth:{kind:"command"},fitPageHeight:{kind:"command"},increasePageScale:{kind:"command"},decreasePageScale:{kind:"command"},setPageScale:{kind:"command"},setPageBlendColor:{kind:"command"},gotoPage:{kind:"command"},gotoNextPage:{kind:"command"},gotoPreviousPage:{kind:"command"},rotatePage:{kind:"command"}});class Te{constructor(t){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=b("page",be(t),t)}}const Ee={open:{kind:"command"},setFormFieldValue:{kind:"command"},setFormFieldReadonly:{kind:"command"},commit:{kind:"callbackQuery",mapCallbackResult:()=>[]},clear:{kind:"callbackQuery",mapCallbackResult:()=>[]},toKeyValue:{kind:"callbackQuery",mapCallbackResult:n=>[Array.isArray(n)?n:[]]}};class Re{constructor(t){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=b("pdfFormFiller",Ee,t)}}const ve=/\s*,\s*/,Se=/\s*-\s*/,_=n=>{const t=Number.parseInt(n.trim(),10);return!Number.isFinite(t)||t<=0?null:t},ye=n=>{var r,a,o;const t=n.split(Se);if(t.length===1){const s=_((r=t[0])!=null?r:"");return s?[s]:[]}const e=_((a=t[0])!=null?a:""),i=_((o=t[1])!=null?o:"");return!e||!i||i<e?[]:Array.from({length:i-e+1},(s,d)=>e+d)},Ce=n=>n?n.split(ve).flatMap(e=>ye(e)).filter((e,i,r)=>r.indexOf(e)===i):[];class Pe{constructor(t,e,i){this.setFieldName=r=>{this.key=r},this.setFieldValue=r=>{this.value=r},this.setDescription=r=>{this.description=r},this.key=t,this.value=e,this.description=i}}class Ae{constructor(){this.fields=[],this.keywordTextFixedPositions=void 0,this.keywordOffsetX=0,this.keywordOffsetY=0,this.bookmarkOffsetX=0,this.bookmarkOffsetY=0,this.printMargin=0,this.grayscaleSealImage=!1,this.signType=0,this.sealPosition=0,this.getSignType=()=>this.signType,this.setSignType=t=>{this.signType=t},this.isCrossPageSideSign=()=>this.signType===2||this.signType===3,this.getSealPosition=()=>this.sealPosition,this.setSignOnPageSides=t=>{t>=0&&t<=3&&(this.signType=t)},this.setSignPositionOnPageSides=t=>{this.sealPosition=t},this.setPageRange=t=>{this.pageRange=t},this.getPageRange=()=>this.pageRange,this.getPageRanges=()=>Ce(this.pageRange),this.setSignUserData=t=>{this.signUserData=t},this.setPrintMargin=t=>{this.printMargin=t},this.getPrintMargin=()=>{var t;return(t=this.printMargin)!=null?t:0},this.setSignReason=t=>{this.signReason=t},this.getSignReason=()=>this.signReason,this.setSignLocation=t=>{this.signLocation=t},this.getSignLocation=()=>this.signLocation,this.setDefaultStampPassword=t=>{this.defaultStampPassword=t}}}const De=new Set([2,5]),Me=n=>({showToolbarMenu:{kind:"command"},hideToolbarMenu:{kind:"command"},setupToolbarMenu:{kind:"command"},showToolbarMenuItem:{kind:"command"},hideToolbarMenuItem:{kind:"command"},setupRibbonMenu:{kind:"command"},setupRibbonMenuItem:{kind:"command"},setupRibbonTitleBar:{kind:"command"},showRibbonMenu:{kind:"command"},hideRibbonMenu:{kind:"command"},showRibbonMenuItem:{kind:"command"},hideRibbonMenuItem:{kind:"command"},showRibbonTitleBar:{kind:"command"},hideRibbonTitleBar:{kind:"command"},selectRibbonMenu:{kind:"command"},setRibbonMenuButtonStyle:{kind:"command"},setWatermark:{kind:"command"},setCompactMode:{kind:"command"},enterBookViewMode:{kind:"callbackQuery",mapCallbackResult:()=>[]},exitBookViewMode:{kind:"command"},isBookViewActivated:{kind:"stateGetter",state:()=>De.has(n.state.snapshot().pageMode)},requestFullScreen:{kind:"command"},exitFullScreen:{kind:"command"},invalidateView:{kind:"command"}});class Ie{constructor(t){this.showToolbarMenu=()=>this.adapter.showToolbarMenu(),this.hideToolbarMenu=()=>this.adapter.hideToolbarMenu(),this.setupToolbarMenu=e=>this.adapter.setupToolbarMenu(e),this.showToolbarMenuItem=e=>this.adapter.showToolbarMenuItem(e),this.hideToolbarMenuItem=e=>this.adapter.hideToolbarMenuItem(e),this.setupRibbonMenu=e=>this.adapter.setupRibbonMenu(e),this.setupRibbonMenuItem=(e,i,r)=>this.adapter.setupRibbonMenuItem(e,i,r),this.setupRibbonTitleBar=e=>this.adapter.setupRibbonTitleBar(e),this.showRibbonMenu=()=>this.adapter.showRibbonMenu(),this.hideRibbonMenu=()=>this.adapter.hideRibbonMenu(),this.showRibbonMenuItem=(e,i)=>this.adapter.showRibbonMenuItem(e,i),this.hideRibbonMenuItem=(e,i)=>this.adapter.hideRibbonMenuItem(e,i),this.showRibbonTitleBar=()=>this.adapter.showRibbonTitleBar(),this.hideRibbonTitleBar=()=>this.adapter.hideRibbonTitleBar(),this.selectRibbonMenu=e=>this.adapter.selectRibbonMenu(e),this.setRibbonMenuButtonStyle=(e,i)=>this.adapter.setRibbonMenuButtonStyle(e,i),this.setWatermark=e=>this.adapter.setWatermark(e),this.setCompactMode=e=>this.adapter.setCompactMode(e),this.enterBookViewMode=e=>this.adapter.enterBookViewMode(e),this.exitBookViewMode=()=>this.adapter.exitBookViewMode(),this.isBookViewActivated=()=>this.adapter.isBookViewActivated(),this.requestFullScreen=()=>this.adapter.requestFullScreen(),this.exitFullScreen=()=>this.adapter.exitFullScreen(),this.invalidateView=()=>this.adapter.invalidateView(),this.adapter=b("ui",Me(t),t)}}const we=n=>{if(!n)return;const t=n.trim().toLowerCase();if(t==="application")return"auto";if(t==="light"||t==="dark"||t==="high-contrast"||t==="auto")return t},J=n=>{var e,i;const t=new URL(n,(i=(e=globalThis.location)==null?void 0:e.href)!=null?i:"http://localhost/");return t.hash="",t.pathname.endsWith("/")||(t.pathname=`${t.pathname}/`),t.toString()},_e=n=>new URL("editors.bootstrap.js",n).toString(),Oe=(n,t)=>{var i;const e=J(n);return{...t,appUrl:e,scrollIntoView:(i=t.scrollIntoView)!=null?i:!0,theme:we(t.theme)}},y="rhc-office-editor",O="__RHC_OFFICE_SDK_READER_LOADER__",Z=()=>{const n=globalThis;return n[O]||(n[O]={activeAppUrl:null,loadPromises:new Map}),n[O]},Fe=n=>{var t;return(t=Array.from(document.querySelectorAll("script")).find(e=>e.src===n))!=null?t:null};class ee extends Error{constructor(t){super(`Failed to load reader bootstrap script: ${t}`),this.name="ReaderScriptLoadError"}}class Le extends Error{constructor(t,e){super(`Reader Web Component "${y}" is already bound to ${t} and cannot be reloaded from ${e}.`),this.name="ReaderSourceConflictError"}}const te=n=>{const t=Z();if(t.activeAppUrl&&t.activeAppUrl!==n)throw new Le(t.activeAppUrl,n)},Ue=n=>{var o;const t=Z();te(n);const e=t.loadPromises.get(n);if(e)return e;if((o=globalThis.customElements)!=null&&o.get(y)){t.activeAppUrl=n;const s=Promise.resolve();return t.loadPromises.set(n,s),s}const i=_e(n),r=Fe(i);t.activeAppUrl=n;const a=new Promise((s,d)=>{var m;const h=c=>{c==null||c.remove(),d(new ee(i))},u=()=>{globalThis.customElements.whenDefined(y).then(()=>{s()}).catch(d)};if(r){if((m=globalThis.customElements)!=null&&m.get(y)){s();return}r.addEventListener("error",()=>d(new ee(i)),{once:!0}),u();return}const l=document.createElement("script");l.src=i,l.async=!0,l.dataset.rhcOfficeSdkReader=n,l.addEventListener("load",u,{once:!0}),l.addEventListener("error",()=>h(l),{once:!0}),document.head.appendChild(l)}).catch(s=>{var d;throw t.loadPromises.delete(n),!((d=globalThis.customElements)!=null&&d.get(y))&&t.activeAppUrl===n&&(t.activeAppUrl=null),s});return t.loadPromises.set(n,a),a},Ne="rhc-office.editor-adapter",Ve=1,Be="__RHC_OFFICE_EDITOR_ADAPTER__",ne="rhcOfficeAdapterReady",ie="rhcOfficeAdapterEvent",xe="data-rhc-office-reader-id",Ke=5e3,He=5e3,Ge=()=>{const n=globalThis.crypto;return typeof(n==null?void 0:n.randomUUID)=="function"?n.randomUUID():`adapter-${Date.now()}-${Math.random().toString(36).slice(2)}`},P=()=>globalThis[Be];class qe extends Error{constructor(t,e,i){super(e),this.name="ReaderBridgeError",this.code=t,this.details=i}}class Qe{constructor(t){var e,i;this.readerId=null,this.readyTimeoutMs=(e=t==null?void 0:t.readyTimeoutMs)!=null?e:He,this.requestTimeoutMs=(i=t==null?void 0:t.requestTimeoutMs)!=null?i:Ke}configureTimeouts(t){var e,i;this.readyTimeoutMs=(e=t==null?void 0:t.readyTimeoutMs)!=null?e:this.readyTimeoutMs,this.requestTimeoutMs=(i=t==null?void 0:t.requestTimeoutMs)!=null?i:this.requestTimeoutMs}setReaderId(t){this.readerId=t}getReaderId(){return this.readerId}async request(t,e,i,r){const a=await this.requestRaw(t,e,i,r);if(a.ok)return a.result;throw new qe(a.error.code,a.error.message,a.error.details)}async requestRaw(t,e,i,r){var s;if(!this.readerId)return{ok:!1,requestId:"",error:{code:"READER_NOT_READY",message:"Reader is not mounted."}};const a=await this.waitForAdapter(this.readerId,r==null?void 0:r.timeoutMs);if(!a)return{ok:!1,requestId:"",error:{code:"ADAPTER_UNAVAILABLE",message:"Editor adapter is not available."}};const o={protocol:Ne,version:Ve,requestId:Ge(),readerId:this.readerId,tool:t,method:e,params:i};return this.withTimeout(a.request(o),o.requestId,(s=r==null?void 0:r.timeoutMs)!=null?s:this.requestTimeoutMs)}getCapabilities(){var t,e;return this.readerId&&(e=(t=P())==null?void 0:t.getCapabilities(this.readerId))!=null?e:null}async waitForAdapter(t,e=this.readyTimeoutMs){const i=P();return i!=null&&i.getCapabilities(t)?i:new Promise(r=>{let a;const o=()=>{a&&clearTimeout(a),globalThis.removeEventListener(ne,s)},s=d=>{const h=d instanceof CustomEvent?d.detail:void 0;if((h==null?void 0:h.readerId)!==t)return;const u=P();o(),r(u!=null?u:null)};globalThis.addEventListener(ne,s),a=setTimeout(()=>{var d;o(),r((d=P())!=null&&d.getCapabilities(t)?P():null)},e)})}async withTimeout(t,e,i){return new Promise(r=>{const a=setTimeout(()=>{r({ok:!1,requestId:e,error:{code:"TIMEOUT",message:`Editor adapter request timed out after ${i}ms.`}})},i);t.then(o=>r(o)).catch(o=>{r({ok:!1,requestId:e,error:{code:"EXECUTION_FAILED",message:o instanceof Error?o.message:String(o)}})}).finally(()=>{clearTimeout(a)})})}}const re={annotationEnabled:!1,documentModified:!1,documentOpened:!1,extensionState:"disconnected",pageCount:0,pageIndex:1,pageMode:0,zoomLevel:100};class ze{constructor(){this.state={...re}}reset(){this.state={...re}}update(t){t&&(this.state={...this.state,...t})}setDocumentOpened(t){this.state={...this.state,documentOpened:t}}snapshot(){return{...this.state}}}class We{constructor(){this.annotationEvents=[],this.annotationPersist=[],this.annotationRetrieve=[],this.digitalAnnotationRetrieve=[],this.digitalSignatureParse=[],this.digitalSignatureRetrieve=[],this.documentClosed=[],this.documentOpened=[],this.documentSaved=[],this.extensionStateChanged=[],this.pageChange=[],this.pageModeChange=[]}emit(t,e){switch(t){case"documentOpened":case"documentLoaded":this.documentOpened.forEach(i=>i("ok",""));return;case"documentSaved":this.documentSaved.forEach(i=>i(e));return;case"documentClosed":this.documentClosed.forEach(i=>i(e));return;case"pageChange":{const i=e;this.pageChange.forEach(r=>{var a,o;return r((a=i.pageIndex)!=null?a:1,(o=i.pageCount)!=null?o:0)});return}case"pageModeChange":{const i=e;this.pageModeChange.forEach(r=>{var a;return r((a=i.pageMode)!=null?a:0)});return}case"annotationEvent":{const i=e;this.annotationEvents.forEach(r=>{var a;return r((a=i.event)!=null?a:"annotationEvent",i.payload)});return}case"annotationPersist":this.annotationPersist.forEach(i=>i(e));return;case"annotationRetrieve":this.annotationRetrieve.forEach(i=>i(e));return;case"digitalAnnotationRetrieve":this.digitalAnnotationRetrieve.forEach(i=>i(Array.isArray(e)?e:[]));return;case"digitalSignatureRetrieve":this.digitalSignatureRetrieve.forEach(i=>i(Array.isArray(e)?e:[]));return;case"digitalSignatureParse":this.digitalSignatureParse.forEach(i=>i(Array.isArray(e)?e:[]));return;case"extensionStateChanged":{const i=e;this.extensionStateChanged.forEach(r=>{var a;return r((a=i.state)!=null?a:"disconnected")});return}default:return}}}const $e=["documentLoaded","documentStateChange","documentError"],je="readerReady",Ye="readerUnload",F="readerError",Xe=()=>{var n;return typeof((n=globalThis.crypto)==null?void 0:n.randomUUID)=="function"?globalThis.crypto.randomUUID():`rhc-reader-${Date.now()}-${Math.random().toString(36).slice(2)}`},ae=(n,t)=>{var e;return{appUrl:(e=t==null?void 0:t.appUrl)!=null?e:null,configuration:t,element:n}},Je=n=>{if(typeof n=="string"){const t=document.getElementById(n);if(!t)throw new Error(`Reader container "${n}" was not found.`);if(!(t instanceof HTMLDivElement))throw new Error(`Reader container "${n}" must be a div element.`);return t}if(!(n instanceof HTMLDivElement))throw new Error("Reader container must be a div element.");return n},Ze=()=>{const n=typeof globalThis.matchMedia=="function";return(n?globalThis.matchMedia("(prefers-contrast: more)").matches:!1)?"high-contrast":(n?globalThis.matchMedia("(prefers-color-scheme: dark)").matches:!1)?"dark":"light"},oe=(n,t)=>{const e=n;if(typeof e.addEventListener=="function"){e.addEventListener("change",t);return}typeof e.addListener=="function"&&e.addListener(t)},se=(n,t)=>{const e=n;if(typeof e.removeEventListener=="function"){e.removeEventListener("change",t);return}typeof e.removeListener=="function"&&e.removeListener(t)},et=(n,t)=>{var e,i;t.style&&(n.style.cssText=t.style),n.style.display||(n.style.display="block"),n.style.width?t.width&&(n.style.width=t.width):n.style.width=(e=t.width)!=null?e:"100%",n.style.height?t.height&&(n.style.height=t.height):n.style.height=(i=t.height)!=null?i:"100%"},tt=(n,t)=>{const e=t.theme;if(!e)return n.removeAttribute("theme"),null;if(e!=="auto")return n.setAttribute("theme",e),null;const i=()=>{n.setAttribute("theme",Ze())};if(i(),typeof globalThis.matchMedia!="function")return null;const r=globalThis.matchMedia("(prefers-color-scheme: dark)"),a=globalThis.matchMedia("(prefers-contrast: more)"),o=()=>{i()};return oe(r,o),oe(a,o),()=>{se(r,o),se(a,o)}};class L{constructor(t){this.bridge=new Qe,this.callbacks=new We,this.readerState=new ze,this.bridgeToolContext={bridge:this.bridge,callbacks:this.callbacks,debug:()=>this.debugEnabled,onAsyncError:e=>this.reportAdapterError(e),state:this.readerState},this.documentTool=new me(this.bridgeToolContext),this.uiTool=new Ie(this.bridgeToolContext),this.pageTool=new Te(this.bridgeToolContext),this.findTool=new pe(this.bridgeToolContext),this.signServerTool=v("signServer",this.bridgeToolContext),this.digitalSignTool=v("digitalSign",this.bridgeToolContext),this.reviewTool=v("review",this.bridgeToolContext),this.ekeyTool=v("ekey",this.bridgeToolContext),this.symbologyTool=v("symbology",this.bridgeToolContext),this.annotationTool=this.createAnnotationTool(),this.templateSignTool=v("templateSign",this.bridgeToolContext),this.pdfFormFiller=new Re(this.bridgeToolContext),this.extensionTool=this.createExtensionTool(),this.networkingTool=new fe(this.bridgeToolContext),this.cryptoTool=v("crypto",this.bridgeToolContext),this.readyCallbacks=[],this.unloadCallbacks=[],this.debugEnabled=!1,this.isReady=!1,this.removed=!1,this.mountToken=0,this.hostContainer=null,this.readerElement=null,this.readerId=null,this.normalizedConfiguration=null,this.nativeEventCleanupCallbacks=[],this.themeCleanup=null,this.enableDebug=e=>{this.debugEnabled=e},this.changeLanguage=()=>{},this.setLicense=(e,i)=>{this.license={license:e,feature:i}},this.setSessionUser=e=>{this.sessionUser=e},this.setSessionUserId=e=>{if(typeof this.sessionUser=="string"||!this.sessionUser){this.sessionUser={userName:typeof this.sessionUser=="string"?this.sessionUser:"",userId:e};return}this.sessionUser={...this.sessionUser,userId:e}},this.setSessionData=e=>{this.sessionData=e},this.isReaderReady=()=>this.isReady,this.isReaderDestroyed=()=>this.removed&&!this.isReady,this.addReaderReadyCallback=e=>{this.readyCallbacks.push(e)},this.addReaderUnloadCallback=e=>{this.unloadCallbacks.push(e)},this.setReaderEventListener=e=>{this.readerEventListener=e},this.embedReader=(e,i,r)=>{const a=Je(e),o=J(i);te(o);const s=Oe(o,r),d=this.mountToken+1;this.removeReader(),this.mountToken=d,this.removed=!1,this.hostContainer=a,this.normalizedConfiguration=s,this.mountReader(a,s,d)},this.removeReader=()=>{var r;const e=!!(this.readerElement||this.hostContainer);if(this.mountToken+=1,this.cleanupNativeEventForwarders(),this.cleanupThemeBinding(),(r=this.readerElement)!=null&&r.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)return;const i=ae(null,null);this.emitReaderEvent(Ye,i),this.unloadCallbacks.forEach(a=>a())},this.getDocumentTool=()=>this.documentTool,this.getUITool=()=>this.uiTool,this.getPageTool=()=>this.pageTool,this.getFindTool=()=>this.findTool,this.getSignServerTool=()=>this.signServerTool,this.getDigitalSignTool=()=>this.digitalSignTool,this.getReviewTool=()=>this.reviewTool,this.getEkeyTool=()=>this.ekeyTool,this.getSymbologyTool=()=>this.symbologyTool,this.getAnnotationTool=()=>this.annotationTool,this.getTemplateSignTool=()=>this.templateSignTool,this.getPdfFormFiller=()=>this.pdfFormFiller,this.getExtensionTool=()=>this.extensionTool,this.getNetworkingTool=()=>this.networkingTool,this.getCryptoTool=()=>this.cryptoTool,this.createDigitalSignOptions=()=>new Ae,this.createKVField=(e,i,r)=>new Pe(e,i,r),this.mountReader=async(e,i,r)=>{try{if(await Ue(i.appUrl),this.mountToken!==r)return;const a=document.createElement(y),o=Xe();if(a.setAttribute(xe,o),this.readerId=o,this.bridge.setReaderId(o),et(a,i),this.themeCleanup=tt(a,i),this.bindNativeReaderEvents(a),e.replaceChildren(a),this.readerElement=a,await Promise.resolve(),this.mountToken!==r)return;i.scrollIntoView&&typeof e.scrollIntoView=="function"&&e.scrollIntoView({behavior:"smooth",block:"nearest"}),this.isReady=!0;const s=ae(a,i);this.emitReaderEvent(je,s),this.readyCallbacks.forEach(d=>d())}catch(a){if(this.mountToken!==r)return;this.reportReaderError(a)}},this.bindNativeReaderEvents=e=>{this.cleanupNativeEventForwarders();const i=r=>{const a=r instanceof CustomEvent?r.detail:null;!a||a.readerId!==this.readerId||(this.readerState.update(a.statePatch),this.callbacks.emit(a.event,a.payload),this.emitReaderEvent(a.event,a.payload))};e.addEventListener(ie,i),this.nativeEventCleanupCallbacks.push(()=>{e.removeEventListener(ie,i)}),$e.forEach(r=>{const a=o=>{const s=o instanceof CustomEvent?o.detail:o;r==="documentLoaded"&&this.readerState.setDocumentOpened(!0),this.emitReaderEvent(r,s),r==="documentError"&&this.emitReaderEvent(F,s)};e.addEventListener(r,a),this.nativeEventCleanupCallbacks.push(()=>{e.removeEventListener(r,a)})})},this.cleanupNativeEventForwarders=()=>{this.nativeEventCleanupCallbacks.splice(0).forEach(e=>e())},this.cleanupThemeBinding=()=>{var e;(e=this.themeCleanup)==null||e.call(this),this.themeCleanup=null},this.emitReaderEvent=(e,i)=>{var r;(r=this.readerEventListener)==null||r.call(this,e,i)},this.reportReaderError=e=>{this.isReady=!1,this.debugEnabled&&console.error("[RHC Office SDK] Reader mount failed",e),this.emitReaderEvent(F,e)},this.reportAdapterError=e=>{this.debugEnabled&&console.error("[RHC Office SDK] Adapter command failed",e),this.emitReaderEvent(F,e)},this.bridge.configureTimeouts({readyTimeoutMs:t==null?void 0:t.adapterReadyTimeoutMs,requestTimeoutMs:t==null?void 0:t.adapterRequestTimeoutMs})}createAnnotationTool(){return b("annotation",{addAnnotationEventCallback:{kind:"callbackRegister",callback:(t,e)=>{const i=e[0];typeof i=="function"&&t.annotationEvents.push(i)}},addAnnotationPersistCallback:{kind:"callbackRegister",callback:(t,e)=>{const i=e[0];typeof i=="function"&&t.annotationPersist.push(i)}},addAnnotationRetrieveCallback:{kind:"callbackRegister",callback:(t,e)=>{const i=e[0];typeof i=="function"&&t.annotationRetrieve.push(i)}},addDigitalAnnotationRetrieveCallback:{kind:"callbackRegister",callback:(t,e)=>{const i=e[0];typeof i=="function"&&t.digitalAnnotationRetrieve.push(i)}},isInAnnotationMode:{kind:"stateGetter",state:t=>t.annotationEnabled},getAnnotations:{kind:"stateGetter",state:()=>[]},getAnnotationsCount:{kind:"stateGetter",state:()=>0},queryAnnotationsBy:{kind:"stateGetter",state:()=>[]},setToolSource:{kind:"command"},openAnnotationView:{kind:"command"},closeAnnotationView:{kind:"command"},openTextAnnotationView:{kind:"command"},setTextAnnotationFontColor:{kind:"command"},setTextAnnotationFontSize:{kind:"command"},closeTextAnnotationView:{kind:"command"},createTextAnnotation:{kind:"command"},setPersistToDocument:{kind:"command"},saveAnnotations:{kind:"callbackQuery"},saveTextAnnotations:{kind:"command"},clearAnnotations:{kind:"command"},clearTextAnnotations:{kind:"command"},undoAnnotation:{kind:"command"},redoAnnotation:{kind:"command"},selectAnnotationTool:{kind:"command"},showAnnotationColorPicker:{kind:"command"},setAnnotationPenType:{kind:"command"},appendAnnotations:{kind:"callbackQuery"},batchAppendAnnotations:{kind:"callbackQuery"},setAnnotationPenColor:{kind:"command"},setAnnotationPenWidth:{kind:"command"},setAnnotationPenThickness:{kind:"command"},enableAnnotationsInfoView:{kind:"command"},enableAnnotationsDeletion:{kind:"command"},enableAnnotationsDeletionOnlyByAuthor:{kind:"command"},listDigitalStamps:{kind:"command"},listAnnotations:{kind:"command"},deleteAnnotationsBy:{kind:"command"},deleteAnnotationsById:{kind:"command"},addDigitalAnnotation:{kind:"command"},addInkAnnotationCallback:{kind:"callbackRegister"}},this.bridgeToolContext)}createExtensionTool(){return b("extension",{addExtensionStateChangedCallback:{kind:"callbackRegister",callback:(t,e)=>{const i=e[0];typeof i=="function"&&t.extensionStateChanged.push(i)}}},this.bridgeToolContext)}}const U=n=>new L(n),N={DocumentSDK:L,WatermarkDisplay:M,DIGITAL_SIGN_DEFAULTS:X,createNewDocumentSdk:U,newDocumentSDK:U,getDigitalSignEnvironment:z,initializeDigitalSignEnvironment:W,patchDigitalSignEnvironment:j,resetDigitalSignEnvironment:Y,setDigitalSignEnvironment:$};return typeof document<"u"&&(n=>{Object.entries(N).forEach(([t,e])=>{Object.defineProperty(n,t,{configurable:!0,enumerable:!0,value:e,writable:!0})}),n.RHCOfficeSDK=N})(document),g.DIGITAL_SIGN_DEFAULTS=X,g.DocumentSDK=L,g.RHCOfficeSDK=N,g.WatermarkDisplay=M,g.createNewDocumentSdk=U,g.getDigitalSignEnvironment=z,g.initializeDigitalSignEnvironment=W,g.patchDigitalSignEnvironment=j,g.resetDigitalSignEnvironment=Y,g.setDigitalSignEnvironment=$,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"}),g}({});
1
+ var RHCOfficeSDK=function(l){"use strict";var C=(n=>(n.DEFAULT="default",n.COMPACT="compact",n.HIDE="none",n))(C||{});const U="RIGHT_CENTER",B="REGULAR_ESM",V="auto",I="__RHC_OFFICE_DIGITAL_SIGN_ENVIRONMENT__",K={defaults:{bjca:{pin:""},deviceType:"client",edgePosition:U,kol:{appId:"",appName:"",pin:"",serviceUrl:"",token:""},plugin:{pin:"",usbKeyType:14},rsaMode:V,signatureType:B},signServer:{authSource:"Password",defaultLogin:"",defaultPassword:"",defaultServer:"",kol:{appId:"",appName:"",serviceUrl:"",token:""},macAddress:"",token:"",usbKey:{checkCertificateBinding:!1,usbKeyType:14}}},G=n=>({bjca:{pin:n.bjca.pin},deviceType:n.deviceType,edgePosition:n.edgePosition,kol:{appId:n.kol.appId,appName:n.kol.appName,pin:n.kol.pin,serviceUrl:n.kol.serviceUrl,token:n.kol.token},plugin:{pin:n.plugin.pin,usbKeyType:n.plugin.usbKeyType},rsaMode:n.rsaMode,signatureType:n.signatureType}),x=n=>({authSource:n.authSource,defaultLogin:n.defaultLogin,defaultPassword:n.defaultPassword,defaultServer:n.defaultServer,kol:{appId:n.kol.appId,appName:n.kol.appName,serviceUrl:n.kol.serviceUrl,token:n.kol.token},macAddress:n.macAddress,token:n.token,usbKey:{checkCertificateBinding:n.usbKey.checkCertificateBinding,usbKeyType:n.usbKey.usbKeyType}}),A=n=>({defaults:G(n.defaults),signServer:x(n.signServer)}),H=n=>({defaults:n.defaults?{...n.defaults,bjca:n.defaults.bjca?{...n.defaults.bjca}:void 0,kol:n.defaults.kol?{...n.defaults.kol}:void 0,plugin:n.defaults.plugin?{...n.defaults.plugin}:void 0}:void 0,signServer:n.signServer?{...n.signServer,kol:n.signServer.kol?{...n.signServer.kol}:void 0,usbKey:n.signServer.usbKey?{...n.signServer.usbKey}:void 0}:void 0}),Re=(n,t)=>{var e,i,a,r,s,o,d,m,h,c,g,u,f,k,S,b,T,v,P,D;return t?{bjca:{pin:(i=(e=t.bjca)==null?void 0:e.pin)!=null?i:n.bjca.pin},deviceType:(a=t.deviceType)!=null?a:n.deviceType,edgePosition:(r=t.edgePosition)!=null?r:n.edgePosition,kol:{appId:(o=(s=t.kol)==null?void 0:s.appId)!=null?o:n.kol.appId,appName:(m=(d=t.kol)==null?void 0:d.appName)!=null?m:n.kol.appName,pin:(c=(h=t.kol)==null?void 0:h.pin)!=null?c:n.kol.pin,serviceUrl:(u=(g=t.kol)==null?void 0:g.serviceUrl)!=null?u:n.kol.serviceUrl,token:(k=(f=t.kol)==null?void 0:f.token)!=null?k:n.kol.token},plugin:{pin:(b=(S=t.plugin)==null?void 0:S.pin)!=null?b:n.plugin.pin,usbKeyType:(v=(T=t.plugin)==null?void 0:T.usbKeyType)!=null?v:n.plugin.usbKeyType},rsaMode:(P=t.rsaMode)!=null?P:n.rsaMode,signatureType:(D=t.signatureType)!=null?D:n.signatureType}:G(n)},ye=(n,t)=>{var e,i,a,r,s,o,d,m,h,c,g,u,f,k,S,b,T,v;return t?{authSource:(e=t.authSource)!=null?e:n.authSource,defaultLogin:(i=t.defaultLogin)!=null?i:n.defaultLogin,defaultPassword:(a=t.defaultPassword)!=null?a:n.defaultPassword,defaultServer:(r=t.defaultServer)!=null?r:n.defaultServer,kol:{appId:(o=(s=t.kol)==null?void 0:s.appId)!=null?o:n.kol.appId,appName:(m=(d=t.kol)==null?void 0:d.appName)!=null?m:n.kol.appName,serviceUrl:(c=(h=t.kol)==null?void 0:h.serviceUrl)!=null?c:n.kol.serviceUrl,token:(u=(g=t.kol)==null?void 0:g.token)!=null?u:n.kol.token},macAddress:(f=t.macAddress)!=null?f:n.macAddress,token:(k=t.token)!=null?k:n.token,usbKey:{checkCertificateBinding:(b=(S=t.usbKey)==null?void 0:S.checkCertificateBinding)!=null?b:n.usbKey.checkCertificateBinding,usbKeyType:(v=(T=t.usbKey)==null?void 0:T.usbKeyType)!=null?v:n.usbKey.usbKeyType}}:x(n)},q=(n,t)=>({defaults:Re(n.defaults,t.defaults),signServer:ye(n.signServer,t.signServer)}),Ee=(n,t)=>{var e,i,a,r,s,o,d,m,h,c,g,u,f,k,S,b,T,v,P,D;return{defaults:n.defaults||t.defaults?{...n.defaults,...t.defaults,bjca:{...(i=(e=n.defaults)==null?void 0:e.bjca)!=null?i:{},...(r=(a=t.defaults)==null?void 0:a.bjca)!=null?r:{}},kol:{...(o=(s=n.defaults)==null?void 0:s.kol)!=null?o:{},...(m=(d=t.defaults)==null?void 0:d.kol)!=null?m:{}},plugin:{...(c=(h=n.defaults)==null?void 0:h.plugin)!=null?c:{},...(u=(g=t.defaults)==null?void 0:g.plugin)!=null?u:{}}}:void 0,signServer:n.signServer||t.signServer?{...n.signServer,...t.signServer,kol:{...(k=(f=n.signServer)==null?void 0:f.kol)!=null?k:{},...(b=(S=t.signServer)==null?void 0:S.kol)!=null?b:{}},usbKey:{...(v=(T=n.signServer)==null?void 0:T.usbKey)!=null?v:{},...(D=(P=t.signServer)==null?void 0:P.usbKey)!=null?D:{}}}:void 0}},Pe=()=>globalThis,y=()=>{const n=Pe();return n[I]||(n[I]={current:A(K),defaults:A(K),overrides:{}}),n[I]},Q=()=>y().current,z=n=>{const t=y();return t.defaults=A(n),t.current=q(t.defaults,t.overrides),t.current},W=n=>{const t=y();return t.current=A(n),t.overrides=H(n),t.current},$=n=>{const t=y();return t.overrides=Ee(t.overrides,H(n)),t.current=q(t.current,n),t.current},j=n=>{const t=y();return n&&(t.defaults=A(n)),t.overrides={},t.current=A(t.defaults),t.current},Y={EDGE_POSITION:U,RSA_MODE:V,SIGNATURE_TYPE:B},w=n=>{if(n.length!==0)return n.length===1?n[0]:n},p=(n,t,e)=>new Proxy({},{get:(i,a)=>{if(a==="then")return;if(typeof a=="symbol")return a===Symbol.toStringTag?n:void 0;const r=t[a];return r?(...s)=>{var d,m,h;if(r.kind==="callbackRegister"){(d=r.callback)==null||d.call(r,e.callbacks,s);return}if(r.kind==="stateGetter")return(m=r.state)==null?void 0:m.call(r,e.state.snapshot(),s);const o=(h=r.adapterMethod)!=null?h:a;if(r.kind==="query")return e.bridge.request(n,o,w(s));if(r.kind==="callbackQuery"){const c=s.find(u=>typeof u=="function"),g=s.filter(u=>typeof u!="function");e.bridge.request(n,o,w(g)).then(u=>{var k,S;const f=(S=(k=r.mapCallbackResult)==null?void 0:k.call(r,u))!=null?S:[u];c==null||c(...f)}).catch(e.onAsyncError);return}e.bridge.request(n,o,w(s)).catch(e.onAsyncError)}:(...s)=>{const o=new Error(`${n}.${a} is not implemented by the SDK adapter.`);e.onAsyncError(o)}}}),De={addAnnotationEventCallback:{kind:"callbackRegister",callback:(n,t)=>{const e=t[0];typeof e=="function"&&n.annotationEvents.push(e)}},addAnnotationPersistCallback:{kind:"callbackRegister",callback:(n,t)=>{const e=t[0];typeof e=="function"&&n.annotationPersist.push(e)}},addAnnotationRetrieveCallback:{kind:"callbackRegister",callback:(n,t)=>{const e=t[0];typeof e=="function"&&n.annotationRetrieve.push(e)}},addDigitalAnnotationRetrieveCallback:{kind:"callbackRegister",callback:(n,t)=>{const e=t[0];typeof e=="function"&&n.digitalAnnotationRetrieve.push(e)}},isInAnnotationMode:{kind:"stateGetter",state:n=>n.annotationEnabled},getAnnotations:{kind:"stateGetter",state:()=>[]},getAnnotationsCount:{kind:"stateGetter",state:()=>0},queryAnnotationsBy:{kind:"stateGetter",state:()=>[]},setToolSource:{kind:"command"},openAnnotationView:{kind:"command"},closeAnnotationView:{kind:"command"},openTextAnnotationView:{kind:"command"},setTextAnnotationFontColor:{kind:"command"},setTextAnnotationFontSize:{kind:"command"},closeTextAnnotationView:{kind:"command"},createTextAnnotation:{kind:"command"},setPersistToDocument:{kind:"command"},saveAnnotations:{kind:"callbackQuery"},saveTextAnnotations:{kind:"command"},clearAnnotations:{kind:"command"},clearTextAnnotations:{kind:"command"},undoAnnotation:{kind:"command"},redoAnnotation:{kind:"command"},selectAnnotationTool:{kind:"command"},showAnnotationColorPicker:{kind:"command"},setAnnotationPenType:{kind:"command"},appendAnnotations:{kind:"callbackQuery"},batchAppendAnnotations:{kind:"callbackQuery"},setAnnotationPenColor:{kind:"command"},setAnnotationPenWidth:{kind:"command"},setAnnotationPenThickness:{kind:"command"},enableAnnotationsInfoView:{kind:"command"},enableAnnotationsDeletion:{kind:"command"},enableAnnotationsDeletionOnlyByAuthor:{kind:"command"},listDigitalStamps:{kind:"command"},listAnnotations:{kind:"command"},deleteAnnotationsBy:{kind:"command"},deleteAnnotationsById:{kind:"command"},addDigitalAnnotation:{kind:"command"},addInkAnnotationCallback:{kind:"callbackRegister"}};class X{constructor(t){this.setToolSource=e=>this.adapter.setToolSource(e),this.openAnnotationView=e=>this.adapter.openAnnotationView(e),this.closeAnnotationView=e=>this.adapter.closeAnnotationView(e),this.openTextAnnotationView=()=>this.adapter.openTextAnnotationView(),this.setTextAnnotationFontColor=e=>this.adapter.setTextAnnotationFontColor(e),this.setTextAnnotationFontSize=e=>this.adapter.setTextAnnotationFontSize(e),this.closeTextAnnotationView=e=>this.adapter.closeTextAnnotationView(e),this.createTextAnnotation=e=>this.adapter.createTextAnnotation(e),this.setPersistToDocument=e=>this.adapter.setPersistToDocument(e),this.saveAnnotations=e=>this.adapter.saveAnnotations(e),this.saveTextAnnotations=()=>this.adapter.saveTextAnnotations(),this.clearAnnotations=()=>this.adapter.clearAnnotations(),this.clearTextAnnotations=()=>this.adapter.clearTextAnnotations(),this.undoAnnotation=()=>this.adapter.undoAnnotation(),this.redoAnnotation=()=>this.adapter.redoAnnotation(),this.selectAnnotationTool=e=>this.adapter.selectAnnotationTool(e),this.showAnnotationColorPicker=()=>this.adapter.showAnnotationColorPicker(),this.setAnnotationPenType=e=>this.adapter.setAnnotationPenType(e),this.appendAnnotations=(e,i)=>this.adapter.appendAnnotations(e,i),this.batchAppendAnnotations=(e,i)=>this.adapter.batchAppendAnnotations(e,i),this.setAnnotationPenColor=e=>this.adapter.setAnnotationPenColor(e),this.setAnnotationPenWidth=e=>this.adapter.setAnnotationPenWidth(e),this.setAnnotationPenThickness=e=>this.adapter.setAnnotationPenThickness(e),this.enableAnnotationsInfoView=e=>this.adapter.enableAnnotationsInfoView(e),this.enableAnnotationsDeletion=e=>this.adapter.enableAnnotationsDeletion(e),this.enableAnnotationsDeletionOnlyByAuthor=e=>this.adapter.enableAnnotationsDeletionOnlyByAuthor(e),this.listDigitalStamps=()=>this.adapter.listDigitalStamps(),this.isInAnnotationMode=()=>this.adapter.isInAnnotationMode(),this.listAnnotations=e=>this.adapter.listAnnotations(e),this.getAnnotations=()=>this.adapter.getAnnotations(),this.getAnnotationsCount=()=>this.adapter.getAnnotationsCount(),this.queryAnnotationsBy=e=>this.adapter.queryAnnotationsBy(e),this.deleteAnnotationsBy=(e,i)=>this.adapter.deleteAnnotationsBy(e,i),this.deleteAnnotationsById=(e,i)=>this.adapter.deleteAnnotationsById(e,i),this.addDigitalAnnotation=e=>this.adapter.addDigitalAnnotation(e),this.addInkAnnotationCallback=e=>this.adapter.addInkAnnotationCallback(e),this.addAnnotationEventCallback=e=>this.adapter.addAnnotationEventCallback(e),this.addAnnotationPersistCallback=e=>this.adapter.addAnnotationPersistCallback(e),this.addAnnotationRetrieveCallback=e=>this.adapter.addAnnotationRetrieveCallback(e),this.addDigitalAnnotationRetrieveCallback=e=>this.adapter.addDigitalAnnotationRetrieveCallback(e),this.adapter=p("annotation",De,t)}}const Ce={configSecurityProvider:{kind:"command"},getSecurityProviders:{kind:"query"}};class J{constructor(t){this.configSecurityProvider=e=>this.adapter.configSecurityProvider(e),this.getSecurityProviders=()=>this.adapter.getSecurityProviders(),this.adapter=p("crypto",Ce,t)}}const Ie={addDigitalSignatureRetrieveCallback:{kind:"callbackRegister",callback:(n,t)=>{const e=t[0];typeof e=="function"&&n.digitalSignatureRetrieve.push(e)}},addDigitalSignatureParseCallback:{kind:"callbackRegister",callback:(n,t)=>{const e=t[0];typeof e=="function"&&n.digitalSignatureParse.push(e)}},addDigitalSignCallback:{kind:"callbackRegister",callback:(n,t)=>{const e=t[0];typeof e=="function"&&n.digitalSign.push(e)}},setCryptoProvider:{kind:"command"},setSealSource:{kind:"command"},setDefaultStampPassword:{kind:"command"},setDefaultSealPassword:{kind:"command"},setDefaultKeystorePassword:{kind:"command"},setDefaultUSBKeyPassword:{kind:"command"},setupExternalSealServer:{kind:"command"},setDigitalSignOptions:{kind:"command"},setExternalDigitalSignOptions:{kind:"command"},setPDFDigitalSignCaptionOptions:{kind:"command"},addDigitalSignature:{kind:"callbackQuery"},addDigitalSignatureBySelectedSearchHighlight:{kind:"command"},listDigitalSignatures:{kind:"callbackQuery"},getDigitalSignatures:{kind:"stateGetter",state:()=>[]},getDigitalSignaturesCount:{kind:"stateGetter",state:()=>0},enableDigitalSignatureInfoView:{kind:"command"},enableDigitalSignatureRevocation:{kind:"command"}};class Z{constructor(t){this.addDigitalSignatureRetrieveCallback=e=>this.adapter.addDigitalSignatureRetrieveCallback(e),this.addDigitalSignatureParseCallback=e=>this.adapter.addDigitalSignatureParseCallback(e),this.setCryptoProvider=(e,i,a)=>this.adapter.setCryptoProvider(e,i,a),this.setSealSource=e=>this.adapter.setSealSource(e),this.setDefaultStampPassword=e=>this.adapter.setDefaultStampPassword(e),this.setDefaultSealPassword=e=>this.adapter.setDefaultSealPassword(e),this.setDefaultKeystorePassword=e=>this.adapter.setDefaultKeystorePassword(e),this.setDefaultUSBKeyPassword=e=>this.adapter.setDefaultUSBKeyPassword(e),this.addDigitalSignCallback=e=>this.adapter.addDigitalSignCallback(e),this.setupExternalSealServer=e=>this.adapter.setupExternalSealServer(e),this.setDigitalSignOptions=e=>this.adapter.setDigitalSignOptions(e),this.setExternalDigitalSignOptions=e=>this.adapter.setExternalDigitalSignOptions(e),this.setPDFDigitalSignCaptionOptions=e=>this.adapter.setPDFDigitalSignCaptionOptions(e),this.addDigitalSignature=(e,i)=>this.adapter.addDigitalSignature(e,i),this.addDigitalSignatureBySelectedSearchHighlight=e=>this.adapter.addDigitalSignatureBySelectedSearchHighlight(e),this.listDigitalSignatures=e=>this.adapter.listDigitalSignatures(e),this.getDigitalSignatures=()=>this.adapter.getDigitalSignatures(),this.getDigitalSignaturesCount=()=>this.adapter.getDigitalSignaturesCount(),this.enableDigitalSignatureInfoView=e=>this.adapter.enableDigitalSignatureInfoView(e),this.enableDigitalSignatureRevocation=e=>this.adapter.enableDigitalSignatureRevocation(e),this.adapter=p("digitalSign",Ie,t)}}const we="rhc-office.editor-adapter",Me=1,Oe="__RHC_OFFICE_EDITOR_ADAPTER__",ee="rhcOfficeAdapterReady",te="rhcOfficeAdapterEvent",ne="data-rhc-office-reader-id",_e={addDocumentOpenedCallback:{kind:"callbackRegister",callback:(n,t)=>{const e=t[0];typeof e=="function"&&n.documentOpened.push(e)}},addDocumentSavedCallback:{kind:"callbackRegister",callback:(n,t)=>{const e=t[0];typeof e=="function"&&n.documentSaved.push(e)}},addDocumentClosedCallback:{kind:"callbackRegister",callback:(n,t)=>{const e=t[0];typeof e=="function"&&n.documentClosed.push(e)}},openPDFDocument:{kind:"callbackQuery",adapterMethod:"open"},openPdfDocument:{kind:"callbackQuery",adapterMethod:"open"},openOFDDocument:{kind:"callbackQuery",adapterMethod:"open"},openOfdDocument:{kind:"callbackQuery",adapterMethod:"open"},openOfficeDocument:{kind:"callbackQuery",adapterMethod:"open"},openImageDocument:{kind:"callbackQuery",adapterMethod:"open"},openTextDocument:{kind:"callbackQuery",adapterMethod:"open"},openFromLocalStorage:{kind:"command"},setUploadUrl:{kind:"command"},save:{kind:"callbackQuery"},saveAs:{kind:"query"},getDocumentContent:{kind:"callbackQuery",mapCallbackResult:n=>{const t=n;return[t==null?void 0:t.fileCacheId,t==null?void 0:t.fileBuffer]}},closeDocument:{kind:"callbackQuery"},isDocumentOpened:{kind:"stateGetter",state:n=>n.documentOpened},isDocumentModified:{kind:"stateGetter",state:n=>n.documentModified},print:{kind:"command"},createPreview:{kind:"command"}};class ie{constructor(t){this.context=t,this.addDocumentOpenedCallback=e=>this.adapter.addDocumentOpenedCallback(e),this.addDocumentSavedCallback=e=>this.adapter.addDocumentSavedCallback(e),this.addDocumentClosedCallback=e=>this.adapter.addDocumentClosedCallback(e),this.openPDFDocument=(e,i)=>this.adapter.openPDFDocument(e,i),this.openPdfDocument=(e,i)=>this.adapter.openPdfDocument(e,i),this.openOFDDocument=(e,i)=>this.adapter.openOFDDocument(e,i),this.openOfdDocument=(e,i)=>this.adapter.openOfdDocument(e,i),this.openOfficeDocument=(e,i)=>this.adapter.openOfficeDocument(e,i),this.openImageDocument=(e,i)=>this.adapter.openImageDocument(e,i),this.openTextDocument=(e,i)=>this.adapter.openTextDocument(e,i),this.openFromLocalStorage=()=>this.adapter.openFromLocalStorage(),this.setUploadUrl=e=>this.adapter.setUploadUrl(e),this.save=(e,i,a)=>this.adapter.save(e,i,a),this.saveAs=e=>{const i=this.context.bridge.getReaderId();if(!i)return Promise.resolve({success:!1,action:"save-as",filename:e==null?void 0:e.filename,error:"Reader is not mounted or does not expose saveAs."});const a=document.querySelector(`[${ne}="${i}"]`);return typeof(a==null?void 0:a.saveAs)=="function"?a.saveAs(e):this.adapter.saveAs(e)},this.getDocumentContent=e=>this.adapter.getDocumentContent(e),this.closeDocument=(e,i,a)=>this.adapter.closeDocument(e,i,a),this.isDocumentOpened=()=>this.adapter.isDocumentOpened(),this.isDocumentModified=()=>this.adapter.isDocumentModified(),this.print=()=>this.adapter.print(),this.createPreview=(e,i)=>this.adapter.createPreview(e,i),this.adapter=p("document",_e,t)}}const Fe={clearFind:{kind:"command"},findNext:{kind:"command"},findPrevious:{kind:"command"}};class ae{constructor(t){this.clearFind=()=>this.adapter.clearFind(),this.findNext=e=>this.adapter.findNext(e),this.findPrevious=e=>this.adapter.findPrevious(e),this.adapter=p("find",Fe,t)}}const Le={configFileUpload:{kind:"command"},setHttpHeaders:{kind:"command"},setHttpFormFields:{kind:"command"}};class re{constructor(t){this.configFileUpload=e=>this.adapter.configFileUpload(e),this.setHttpHeaders=e=>this.adapter.setHttpHeaders(e),this.setHttpFormFields=e=>this.adapter.setHttpFormFields(e),this.adapter=p("networking",Le,t)}}const Ne=n=>({addPageChangeCallback:{kind:"callbackRegister",callback:(t,e)=>{const i=e[0];typeof i=="function"&&t.pageChange.push(i)}},addPageModeChangeCallback:{kind:"callbackRegister",callback:(t,e)=>{const i=e[0];typeof i=="function"&&t.pageModeChange.push(i)}},getPageCount:{kind:"callbackRegister",callback:(t,e)=>{const i=e[0];typeof i=="function"&&i(n.state.snapshot().pageCount)}},getPageIndex:{kind:"callbackRegister",callback:(t,e)=>{const i=e[0];typeof i=="function"&&i(n.state.snapshot().pageIndex)}},setSinglePageViewMode:{kind:"command"},setTwoPagesViewMode:{kind:"command"},setPageScrollVertical:{kind:"command"},setPageScrollHorizontal:{kind:"command"},setPageCursorPanDrag:{kind:"command"},setPageCursorTextSelect:{kind:"command"},rotateCW:{kind:"command"},rotateCCW:{kind:"command"},autoFitPage:{kind:"command"},fitPageSize:{kind:"command"},fitPageWidth:{kind:"command"},fitPageHeight:{kind:"command"},increasePageScale:{kind:"command"},decreasePageScale:{kind:"command"},setPageScale:{kind:"command"},setPageBlendColor:{kind:"command"},gotoPage:{kind:"command"},gotoNextPage:{kind:"command"},gotoPreviousPage:{kind:"command"},rotatePage:{kind:"command"}});class se{constructor(t){this.addPageChangeCallback=e=>this.adapter.addPageChangeCallback(e),this.addPageModeChangeCallback=e=>this.adapter.addPageModeChangeCallback(e),this.getPageCount=e=>this.adapter.getPageCount(e),this.getPageIndex=e=>this.adapter.getPageIndex(e),this.setSinglePageViewMode=()=>this.adapter.setSinglePageViewMode(),this.setTwoPagesViewMode=()=>this.adapter.setTwoPagesViewMode(),this.setPageScrollVertical=()=>this.adapter.setPageScrollVertical(),this.setPageScrollHorizontal=()=>this.adapter.setPageScrollHorizontal(),this.setPageCursorPanDrag=()=>this.adapter.setPageCursorPanDrag(),this.setPageCursorTextSelect=()=>this.adapter.setPageCursorTextSelect(),this.rotateCW=()=>this.adapter.rotateCW(),this.rotateCCW=()=>this.adapter.rotateCCW(),this.autoFitPage=()=>this.adapter.autoFitPage(),this.fitPageSize=()=>this.adapter.fitPageSize(),this.fitPageWidth=()=>this.adapter.fitPageWidth(),this.fitPageHeight=()=>this.adapter.fitPageHeight(),this.increasePageScale=()=>this.adapter.increasePageScale(),this.decreasePageScale=()=>this.adapter.decreasePageScale(),this.setPageScale=e=>this.adapter.setPageScale(e),this.setPageBlendColor=(e,i,a,r)=>this.adapter.setPageBlendColor(e,i,a,r),this.gotoPage=(e,i,a)=>this.adapter.gotoPage(e,i,a),this.gotoNextPage=()=>this.adapter.gotoNextPage(),this.gotoPreviousPage=()=>this.adapter.gotoPreviousPage(),this.rotatePage=e=>this.adapter.rotatePage(e),this.adapter=p("page",Ne(t),t)}}const Ue={open:{kind:"command"},setFormFieldValue:{kind:"command"},setFormFieldReadonly:{kind:"command"},commit:{kind:"callbackQuery",mapCallbackResult:()=>[]},clear:{kind:"callbackQuery",mapCallbackResult:()=>[]},toKeyValue:{kind:"callbackQuery",mapCallbackResult:n=>[Array.isArray(n)?n:[]]}};class oe{constructor(t){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=p("pdfFormFiller",Ue,t)}}class de extends Error{constructor(t,e){super(`[Phase 1] ${t}.${e} is not implemented yet.`),this.name="SDKPhase1NotImplementedError"}}const Be=(n,t)=>()=>{throw new de(n,t)},Ve=n=>new Proxy({},{get:(t,e)=>{if(e!=="then")return typeof e=="symbol"?e===Symbol.toStringTag?n:void 0:Be(n,e)}}),Ke=/\s*,\s*/,Ge=/\s*-\s*/,M=n=>{const t=Number.parseInt(n.trim(),10);return!Number.isFinite(t)||t<=0?null:t},xe=n=>{var a,r,s;const t=n.split(Ge);if(t.length===1){const o=M((a=t[0])!=null?a:"");return o?[o]:[]}const e=M((r=t[0])!=null?r:""),i=M((s=t[1])!=null?s:"");return!e||!i||i<e?[]:Array.from({length:i-e+1},(o,d)=>e+d)},He=n=>n?n.split(Ke).flatMap(e=>xe(e)).filter((e,i,a)=>a.indexOf(e)===i):[];class le{constructor(t,e,i){this.setFieldName=a=>{this.key=a},this.setFieldValue=a=>{this.value=a},this.setDescription=a=>{this.description=a},this.key=t,this.value=e,this.description=i}}class ce{constructor(){this.fields=[],this.keywordTextFixedPositions=void 0,this.keywordOffsetX=0,this.keywordOffsetY=0,this.bookmarkOffsetX=0,this.bookmarkOffsetY=0,this.printMargin=0,this.grayscaleSealImage=!1,this.signType=0,this.sealPosition=0,this.getSignType=()=>this.signType,this.setSignType=t=>{this.signType=t},this.isCrossPageSideSign=()=>this.signType===2||this.signType===3,this.getSealPosition=()=>this.sealPosition,this.setSignOnPageSides=t=>{t>=0&&t<=3&&(this.signType=t)},this.setSignPositionOnPageSides=t=>{this.sealPosition=t},this.setPageRange=t=>{this.pageRange=t},this.getPageRange=()=>this.pageRange,this.getPageRanges=()=>He(this.pageRange),this.setSignUserData=t=>{this.signUserData=t},this.setPrintMargin=t=>{this.printMargin=t},this.getPrintMargin=()=>{var t;return(t=this.printMargin)!=null?t:0},this.setSignReason=t=>{this.signReason=t},this.getSignReason=()=>this.signReason,this.setSignLocation=t=>{this.signLocation=t},this.getSignLocation=()=>this.signLocation,this.setDefaultStampPassword=t=>{this.defaultStampPassword=t}}}const qe={setSignServer:{kind:"command"},addSignServerAuthCallback:{kind:"callbackRegister",callback:(n,t)=>{const e=t[0];typeof e=="function"&&n.signServerAuth.push(e)}},setSignServerDefaultLogin:{kind:"command"},setDefaultSignServerLogin:{kind:"command"},setSignServerDefaultPassword:{kind:"command"},setDefaultSignServerPassword:{kind:"command"},loginNTKOSignServer:{kind:"command"},loginSignServer:{kind:"callbackQuery"},signOutSignServer:{kind:"command"},isAuthenticatedOnSignServer:{kind:"stateGetter",state:()=>!1},setSignServerLoginFromUSBKey:{kind:"command"},setUserAuthSource:{kind:"command"}};class ue{constructor(t){this.setSignServer=e=>this.adapter.setSignServer(e),this.addSignServerAuthCallback=e=>this.adapter.addSignServerAuthCallback(e),this.setSignServerDefaultLogin=e=>this.adapter.setSignServerDefaultLogin(e),this.setDefaultSignServerLogin=e=>this.adapter.setDefaultSignServerLogin(e),this.setSignServerDefaultPassword=e=>this.adapter.setSignServerDefaultPassword(e),this.setDefaultSignServerPassword=e=>this.adapter.setDefaultSignServerPassword(e),this.loginNTKOSignServer=(e,i,a)=>this.adapter.loginNTKOSignServer(e,i,a),this.loginSignServer=(e,i,a,r)=>this.adapter.loginSignServer(e,i,a,r),this.signOutSignServer=()=>this.adapter.signOutSignServer(),this.isAuthenticatedOnSignServer=()=>this.adapter.isAuthenticatedOnSignServer(),this.setSignServerLoginFromUSBKey=(e,i)=>this.adapter.setSignServerLoginFromUSBKey(e,i),this.setUserAuthSource=e=>this.adapter.setUserAuthSource(e),this.adapter=p("signServer",qe,t)}}const Qe={createPDF417Barcode:{kind:"command"}};class he{constructor(t){this.createPDF417Barcode=(e,i,a,r,s,o,d)=>this.adapter.createPDF417Barcode(e,i,a,r,s,o,d),this.adapter=p("symbology",Qe,t)}}const ze={setup:{kind:"command"},create:{kind:"command"},getMarkups:{kind:"callbackQuery"},removeMarkup:{kind:"command"},removeAllMarkups:{kind:"command"},sign:{kind:"callbackQuery"}};class me{constructor(t){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=p("templateSign",ze,t)}}const We=new Set([2,5]),$e=n=>({showToolbarMenu:{kind:"command"},hideToolbarMenu:{kind:"command"},setupToolbarMenu:{kind:"command"},showToolbarMenuItem:{kind:"command"},hideToolbarMenuItem:{kind:"command"},setupRibbonMenu:{kind:"command"},setupRibbonMenuItem:{kind:"command"},setupRibbonTitleBar:{kind:"command"},showRibbonMenu:{kind:"command"},hideRibbonMenu:{kind:"command"},showRibbonMenuItem:{kind:"command"},hideRibbonMenuItem:{kind:"command"},showRibbonTitleBar:{kind:"command"},hideRibbonTitleBar:{kind:"command"},selectRibbonMenu:{kind:"command"},setRibbonMenuButtonStyle:{kind:"command"},setWatermark:{kind:"command"},setCompactMode:{kind:"command"},enterBookViewMode:{kind:"callbackQuery",mapCallbackResult:()=>[]},exitBookViewMode:{kind:"command"},isBookViewActivated:{kind:"stateGetter",state:()=>We.has(n.state.snapshot().pageMode)},requestFullScreen:{kind:"command"},exitFullScreen:{kind:"command"},invalidateView:{kind:"command"}});class ge{constructor(t){this.showToolbarMenu=()=>this.adapter.showToolbarMenu(),this.hideToolbarMenu=()=>this.adapter.hideToolbarMenu(),this.setupToolbarMenu=e=>this.adapter.setupToolbarMenu(e),this.showToolbarMenuItem=e=>this.adapter.showToolbarMenuItem(e),this.hideToolbarMenuItem=e=>this.adapter.hideToolbarMenuItem(e),this.setupRibbonMenu=e=>this.adapter.setupRibbonMenu(e),this.setupRibbonMenuItem=(e,i,a)=>this.adapter.setupRibbonMenuItem(e,i,a),this.setupRibbonTitleBar=e=>this.adapter.setupRibbonTitleBar(e),this.showRibbonMenu=()=>this.adapter.showRibbonMenu(),this.hideRibbonMenu=()=>this.adapter.hideRibbonMenu(),this.showRibbonMenuItem=(e,i)=>this.adapter.showRibbonMenuItem(e,i),this.hideRibbonMenuItem=(e,i)=>this.adapter.hideRibbonMenuItem(e,i),this.showRibbonTitleBar=()=>this.adapter.showRibbonTitleBar(),this.hideRibbonTitleBar=()=>this.adapter.hideRibbonTitleBar(),this.selectRibbonMenu=e=>this.adapter.selectRibbonMenu(e),this.setRibbonMenuButtonStyle=(e,i)=>this.adapter.setRibbonMenuButtonStyle(e,i),this.setWatermark=e=>this.adapter.setWatermark(e),this.setCompactMode=e=>this.adapter.setCompactMode(e),this.enterBookViewMode=e=>this.adapter.enterBookViewMode(e),this.exitBookViewMode=()=>this.adapter.exitBookViewMode(),this.isBookViewActivated=()=>this.adapter.isBookViewActivated(),this.requestFullScreen=()=>this.adapter.requestFullScreen(),this.exitFullScreen=()=>this.adapter.exitFullScreen(),this.invalidateView=()=>this.adapter.invalidateView(),this.adapter=p("ui",$e(t),t)}}const je=n=>{if(!n)return;const t=n.trim().toLowerCase();if(t==="application")return"auto";if(t==="light"||t==="dark"||t==="high-contrast"||t==="auto")return t},pe=n=>{var e,i;const t=new URL(n,(i=(e=globalThis.location)==null?void 0:e.href)!=null?i:"http://localhost/");return t.hash="",t.pathname.endsWith("/")||(t.pathname=`${t.pathname}/`),t.toString()},Ye=n=>new URL("editors.bootstrap.js",n).toString(),Xe=(n,t)=>{var i;const e=pe(n);return{...t,appUrl:e,scrollIntoView:(i=t.scrollIntoView)!=null?i:!0,theme:je(t.theme)}},R="rhc-office-editor",O="__RHC_OFFICE_SDK_READER_LOADER__",ke=()=>{const n=globalThis;return n[O]||(n[O]={activeAppUrl:null,loadPromises:new Map}),n[O]},Je=n=>{var t;return(t=Array.from(document.querySelectorAll("script")).find(e=>e.src===n))!=null?t:null};class Se extends Error{constructor(t){super(`Failed to load reader bootstrap script: ${t}`),this.name="ReaderScriptLoadError"}}class Ze extends Error{constructor(t,e){super(`Reader Web Component "${R}" is already bound to ${t} and cannot be reloaded from ${e}.`),this.name="ReaderSourceConflictError"}}const fe=n=>{const t=ke();if(t.activeAppUrl&&t.activeAppUrl!==n)throw new Ze(t.activeAppUrl,n)},et=n=>{var s;const t=ke();fe(n);const e=t.loadPromises.get(n);if(e)return e;if((s=globalThis.customElements)!=null&&s.get(R)){t.activeAppUrl=n;const o=Promise.resolve();return t.loadPromises.set(n,o),o}const i=Ye(n),a=Je(i);t.activeAppUrl=n;const r=new Promise((o,d)=>{var g;const m=u=>{u==null||u.remove(),d(new Se(i))},h=()=>{globalThis.customElements.whenDefined(R).then(()=>{o()}).catch(d)};if(a){if((g=globalThis.customElements)!=null&&g.get(R)){o();return}a.addEventListener("error",()=>d(new Se(i)),{once:!0}),h();return}const c=document.createElement("script");c.src=i,c.async=!0,c.dataset.rhcOfficeSdkReader=n,c.addEventListener("load",h,{once:!0}),c.addEventListener("error",()=>m(c),{once:!0}),document.head.appendChild(c)}).catch(o=>{var d;throw t.loadPromises.delete(n),!((d=globalThis.customElements)!=null&&d.get(R))&&t.activeAppUrl===n&&(t.activeAppUrl=null),o});return t.loadPromises.set(n,r),r},tt=5e3,nt=5e3,it=()=>{const n=globalThis.crypto;return typeof(n==null?void 0:n.randomUUID)=="function"?n.randomUUID():`adapter-${Date.now()}-${Math.random().toString(36).slice(2)}`},E=()=>globalThis[Oe];class at extends Error{constructor(t,e,i){super(e),this.name="ReaderBridgeError",this.code=t,this.details=i}}class rt{constructor(t){var e,i;this.readerId=null,this.readyTimeoutMs=(e=t==null?void 0:t.readyTimeoutMs)!=null?e:nt,this.requestTimeoutMs=(i=t==null?void 0:t.requestTimeoutMs)!=null?i:tt}configureTimeouts(t){var e,i;this.readyTimeoutMs=(e=t==null?void 0:t.readyTimeoutMs)!=null?e:this.readyTimeoutMs,this.requestTimeoutMs=(i=t==null?void 0:t.requestTimeoutMs)!=null?i:this.requestTimeoutMs}setReaderId(t){this.readerId=t}getReaderId(){return this.readerId}async request(t,e,i,a){const r=await this.requestRaw(t,e,i,a);if(r.ok)return r.result;throw new at(r.error.code,r.error.message,r.error.details)}async requestRaw(t,e,i,a){var o;if(!this.readerId)return{ok:!1,requestId:"",error:{code:"READER_NOT_READY",message:"Reader is not mounted."}};const r=await this.waitForAdapter(this.readerId,a==null?void 0:a.timeoutMs);if(!r)return{ok:!1,requestId:"",error:{code:"ADAPTER_UNAVAILABLE",message:"Editor adapter is not available."}};const s={protocol:we,version:Me,requestId:it(),readerId:this.readerId,tool:t,method:e,params:i};return this.withTimeout(r.request(s),s.requestId,(o=a==null?void 0:a.timeoutMs)!=null?o:this.requestTimeoutMs)}getCapabilities(){var t,e;return this.readerId&&(e=(t=E())==null?void 0:t.getCapabilities(this.readerId))!=null?e:null}async waitForAdapter(t,e=this.readyTimeoutMs){const i=E();return i!=null&&i.getCapabilities(t)?i:new Promise(a=>{let r;const s=()=>{r&&clearTimeout(r),globalThis.removeEventListener(ee,o)},o=d=>{const m=d instanceof CustomEvent?d.detail:void 0;if((m==null?void 0:m.readerId)!==t)return;const h=E();s(),a(h!=null?h:null)};globalThis.addEventListener(ee,o),r=setTimeout(()=>{var d;s(),a((d=E())!=null&&d.getCapabilities(t)?E():null)},e)})}async withTimeout(t,e,i){return new Promise(a=>{const r=setTimeout(()=>{a({ok:!1,requestId:e,error:{code:"TIMEOUT",message:`Editor adapter request timed out after ${i}ms.`}})},i);t.then(s=>a(s)).catch(s=>{a({ok:!1,requestId:e,error:{code:"EXECUTION_FAILED",message:s instanceof Error?s.message:String(s)}})}).finally(()=>{clearTimeout(r)})})}}const be={annotationEnabled:!1,documentModified:!1,documentOpened:!1,pageCount:0,pageIndex:1,pageMode:0,zoomLevel:100};class st{constructor(){this.state={...be}}reset(){this.state={...be}}update(t){t&&(this.state={...this.state,...t})}setDocumentOpened(t){this.state={...this.state,documentOpened:t}}snapshot(){return{...this.state}}}class ot{constructor(){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=[]}emit(t,e){switch(t){case"documentOpened":case"documentLoaded":this.documentOpened.forEach(i=>i("ok",""));return;case"documentSaved":this.documentSaved.forEach(i=>i(e));return;case"documentClosed":this.documentClosed.forEach(i=>i(e));return;case"pageChange":{const i=e;this.pageChange.forEach(a=>{var r,s;return a((r=i.pageIndex)!=null?r:1,(s=i.pageCount)!=null?s:0)});return}case"pageModeChange":{const i=e;this.pageModeChange.forEach(a=>{var r;return a((r=i.pageMode)!=null?r:0)});return}case"annotationEvent":{const i=e;this.annotationEvents.forEach(a=>{var r;return a((r=i.event)!=null?r:"annotationEvent",i.payload)});return}case"annotationPersist":this.annotationPersist.forEach(i=>i(e));return;case"annotationRetrieve":this.annotationRetrieve.forEach(i=>i(e));return;case"digitalAnnotationRetrieve":this.digitalAnnotationRetrieve.forEach(i=>i(Array.isArray(e)?e:[]));return;case"digitalSign":this.digitalSign.forEach(i=>i(e));return;case"digitalSignatureRetrieve":this.digitalSignatureRetrieve.forEach(i=>i(Array.isArray(e)?e:[]));return;case"digitalSignatureParse":this.digitalSignatureParse.forEach(i=>i(Array.isArray(e)?e:[]));return;case"signServerAuth":this.signServerAuth.forEach(i=>i(e));return;default:return}}}const dt=["documentLoaded","documentStateChange","documentError"],lt="readerReady",ct="readerUnload",_="readerError",ut=()=>{var n;return typeof((n=globalThis.crypto)==null?void 0:n.randomUUID)=="function"?globalThis.crypto.randomUUID():`rhc-reader-${Date.now()}-${Math.random().toString(36).slice(2)}`},Te=(n,t)=>{var e;return{appUrl:(e=t==null?void 0:t.appUrl)!=null?e:null,configuration:t,element:n}},ht=n=>{if(typeof n=="string"){const t=document.getElementById(n);if(!t)throw new Error(`Reader container "${n}" was not found.`);if(!(t instanceof HTMLDivElement))throw new Error(`Reader container "${n}" must be a div element.`);return t}if(!(n instanceof HTMLDivElement))throw new Error("Reader container must be a div element.");return n},mt=()=>{const n=typeof globalThis.matchMedia=="function";return(n?globalThis.matchMedia("(prefers-contrast: more)").matches:!1)?"high-contrast":(n?globalThis.matchMedia("(prefers-color-scheme: dark)").matches:!1)?"dark":"light"},ve=(n,t)=>{const e=n;if(typeof e.addEventListener=="function"){e.addEventListener("change",t);return}typeof e.addListener=="function"&&e.addListener(t)},Ae=(n,t)=>{const e=n;if(typeof e.removeEventListener=="function"){e.removeEventListener("change",t);return}typeof e.removeListener=="function"&&e.removeListener(t)},gt=(n,t)=>{var e,i;t.style&&(n.style.cssText=t.style),n.style.display||(n.style.display="block"),n.style.width?t.width&&(n.style.width=t.width):n.style.width=(e=t.width)!=null?e:"100%",n.style.height?t.height&&(n.style.height=t.height):n.style.height=(i=t.height)!=null?i:"100%"},pt=(n,t)=>{const e=t.theme;if(!e)return n.removeAttribute("theme"),null;if(e!=="auto")return n.setAttribute("theme",e),null;const i=()=>{n.setAttribute("theme",mt())};if(i(),typeof globalThis.matchMedia!="function")return null;const a=globalThis.matchMedia("(prefers-color-scheme: dark)"),r=globalThis.matchMedia("(prefers-contrast: more)"),s=()=>{i()};return ve(a,s),ve(r,s),()=>{Ae(a,s),Ae(r,s)}};class F{constructor(t){this.bridge=new rt,this.callbacks=new ot,this.readerState=new st,this.bridgeToolContext={bridge:this.bridge,callbacks:this.callbacks,debug:()=>this.debugEnabled,onAsyncError:e=>this.reportAdapterError(e),state:this.readerState},this.documentTool=new ie(this.bridgeToolContext),this.uiTool=new ge(this.bridgeToolContext),this.pageTool=new se(this.bridgeToolContext),this.findTool=new ae(this.bridgeToolContext),this.signServerTool=new ue(this.bridgeToolContext),this.digitalSignTool=new Z(this.bridgeToolContext),this.symbologyTool=new he(this.bridgeToolContext),this.annotationTool=new X(this.bridgeToolContext),this.templateSignTool=new me(this.bridgeToolContext),this.pdfFormFiller=new oe(this.bridgeToolContext),this.networkingTool=new re(this.bridgeToolContext),this.cryptoTool=new J(this.bridgeToolContext),this.readyCallbacks=[],this.unloadCallbacks=[],this.debugEnabled=!1,this.isReady=!1,this.removed=!1,this.mountToken=0,this.hostContainer=null,this.readerElement=null,this.readerId=null,this.normalizedConfiguration=null,this.nativeEventCleanupCallbacks=[],this.themeCleanup=null,this.enableDebug=e=>{this.debugEnabled=e},this.changeLanguage=()=>{},this.setLicense=(e,i)=>{this.license={license:e,feature:i}},this.setSessionUser=e=>{this.sessionUser=e},this.setSessionUserId=e=>{if(typeof this.sessionUser=="string"||!this.sessionUser){this.sessionUser={userName:typeof this.sessionUser=="string"?this.sessionUser:"",userId:e};return}this.sessionUser={...this.sessionUser,userId:e}},this.setSessionData=e=>{this.sessionData=e},this.isReaderReady=()=>this.isReady,this.isReaderDestroyed=()=>this.removed&&!this.isReady,this.addReaderReadyCallback=e=>{this.readyCallbacks.push(e)},this.addReaderUnloadCallback=e=>{this.unloadCallbacks.push(e)},this.setReaderEventListener=e=>{this.readerEventListener=e},this.embedReader=(e,i,a)=>{const r=ht(e),s=pe(i);fe(s);const o=Xe(s,a),d=this.mountToken+1;this.removeReader(),this.mountToken=d,this.removed=!1,this.hostContainer=r,this.normalizedConfiguration=o,this.mountReader(r,o,d)},this.removeReader=()=>{var a;const e=!!(this.readerElement||this.hostContainer);if(this.mountToken+=1,this.cleanupNativeEventForwarders(),this.cleanupThemeBinding(),(a=this.readerElement)!=null&&a.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)return;const i=Te(null,null);this.emitReaderEvent(ct,i),this.unloadCallbacks.forEach(r=>r())},this.getDocumentTool=()=>this.documentTool,this.getUITool=()=>this.uiTool,this.getPageTool=()=>this.pageTool,this.getFindTool=()=>this.findTool,this.getSignServerTool=()=>this.signServerTool,this.getDigitalSignTool=()=>this.digitalSignTool,this.getSymbologyTool=()=>this.symbologyTool,this.getAnnotationTool=()=>this.annotationTool,this.getTemplateSignTool=()=>this.templateSignTool,this.getPdfFormFiller=()=>this.pdfFormFiller,this.getNetworkingTool=()=>this.networkingTool,this.getCryptoTool=()=>this.cryptoTool,this.createDigitalSignOptions=()=>new ce,this.createKVField=(e,i,a)=>new le(e,i,a),this.mountReader=async(e,i,a)=>{try{if(await et(i.appUrl),this.mountToken!==a)return;const r=document.createElement(R),s=ut();if(r.setAttribute(ne,s),this.readerId=s,this.bridge.setReaderId(s),gt(r,i),this.themeCleanup=pt(r,i),this.bindNativeReaderEvents(r),e.replaceChildren(r),this.readerElement=r,await Promise.resolve(),this.mountToken!==a)return;i.scrollIntoView&&typeof e.scrollIntoView=="function"&&e.scrollIntoView({behavior:"smooth",block:"nearest"}),this.isReady=!0;const o=Te(r,i);this.emitReaderEvent(lt,o),this.readyCallbacks.forEach(d=>d())}catch(r){if(this.mountToken!==a)return;this.reportReaderError(r)}},this.bindNativeReaderEvents=e=>{this.cleanupNativeEventForwarders();const i=a=>{const r=a instanceof CustomEvent?a.detail:null;!r||r.readerId!==this.readerId||(this.readerState.update(r.statePatch),this.callbacks.emit(r.event,r.payload),this.emitReaderEvent(r.event,r.payload))};e.addEventListener(te,i),this.nativeEventCleanupCallbacks.push(()=>{e.removeEventListener(te,i)}),dt.forEach(a=>{const r=s=>{const o=s instanceof CustomEvent?s.detail:s;a==="documentLoaded"&&this.readerState.setDocumentOpened(!0),this.emitReaderEvent(a,o),a==="documentError"&&this.emitReaderEvent(_,o)};e.addEventListener(a,r),this.nativeEventCleanupCallbacks.push(()=>{e.removeEventListener(a,r)})})},this.cleanupNativeEventForwarders=()=>{this.nativeEventCleanupCallbacks.splice(0).forEach(e=>e())},this.cleanupThemeBinding=()=>{var e;(e=this.themeCleanup)==null||e.call(this),this.themeCleanup=null},this.emitReaderEvent=(e,i)=>{var a;(a=this.readerEventListener)==null||a.call(this,e,i)},this.reportReaderError=e=>{this.isReady=!1,this.debugEnabled&&console.error("[RHC Office SDK] Reader mount failed",e),this.emitReaderEvent(_,e)},this.reportAdapterError=e=>{this.debugEnabled&&console.error("[RHC Office SDK] Adapter command failed",e),this.emitReaderEvent(_,e)},this.bridge.configureTimeouts({readyTimeoutMs:t==null?void 0:t.adapterReadyTimeoutMs,requestTimeoutMs:t==null?void 0:t.adapterRequestTimeoutMs})}}const L=n=>new F(n),N={DocumentSDK:F,WatermarkDisplay:C,DIGITAL_SIGN_DEFAULTS:Y,createNewDocumentSdk:L,newDocumentSDK:L,getDigitalSignEnvironment:Q,initializeDigitalSignEnvironment:z,patchDigitalSignEnvironment:$,resetDigitalSignEnvironment:j,setDigitalSignEnvironment:W};return typeof document<"u"&&(n=>{Object.entries(N).forEach(([t,e])=>{Object.defineProperty(n,t,{configurable:!0,enumerable:!0,value:e,writable:!0})}),n.RHCOfficeSDK=N})(document),l.AnnotationToolImpl=X,l.CryptoToolImpl=J,l.DIGITAL_SIGN_DEFAULTS=Y,l.DigitalSignOptions=ce,l.DigitalSignToolImpl=Z,l.DocumentSDK=F,l.DocumentToolImpl=ie,l.FindToolImpl=ae,l.KVField=le,l.NetworkingToolImpl=re,l.PageToolImpl=se,l.PdfFormFillerImpl=oe,l.RHCOfficeSDK=N,l.SDKPhase1NotImplementedError=de,l.SignServerToolImpl=ue,l.SymbologyToolImpl=he,l.TemplateSignToolImpl=me,l.UIToolImpl=ge,l.WatermarkDisplay=C,l.createNewDocumentSdk=L,l.createPhase1ToolPlaceholder=Ve,l.getDigitalSignEnvironment=Q,l.initializeDigitalSignEnvironment=z,l.patchDigitalSignEnvironment=$,l.resetDigitalSignEnvironment=j,l.setDigitalSignEnvironment=W,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"}),l}({});
2
2
  //# sourceMappingURL=document-viewer.js.map