@progress/kendo-pdfviewer-common 0.3.0-dev.202409251459 → 0.3.0-dev.202410100645

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 (149) hide show
  1. package/dist/es/annotations/annotation-editor-layer-builder.js +139 -0
  2. package/dist/es/annotations/annotation-editor-layer.js +780 -0
  3. package/dist/es/annotations/annotation-editor-ui-manager.js +1690 -0
  4. package/dist/es/annotations/annotation-layer-builder.js +217 -0
  5. package/dist/es/annotations/annotation-layer.js +2793 -0
  6. package/dist/es/annotations/draw-layer-builder.js +65 -0
  7. package/dist/es/annotations/draw-layer.js +220 -0
  8. package/dist/es/annotations/editors/annotation-editor.js +1519 -0
  9. package/dist/es/annotations/editors/free-text-editor.js +783 -0
  10. package/dist/es/annotations/editors/highlight-editor.js +717 -0
  11. package/dist/es/annotations/editors/outliner.js +747 -0
  12. package/dist/es/annotations/helpers/annotation-storage.js +294 -0
  13. package/dist/es/annotations/helpers/color-manager.js +72 -0
  14. package/dist/es/annotations/helpers/command-manager.js +133 -0
  15. package/dist/es/annotations/helpers/id-manager.js +34 -0
  16. package/dist/es/annotations/helpers/image-manager.js +176 -0
  17. package/dist/es/annotations/helpers/text-accessibility-manager.js +212 -0
  18. package/dist/es/annotations/helpers/tools.js +19 -0
  19. package/dist/es/annotations/shared/display_utils.js +1024 -0
  20. package/dist/es/annotations/shared/event_utils.js +213 -0
  21. package/dist/es/annotations/shared/murmurhash3.js +126 -0
  22. package/dist/es/annotations/shared/scripting_utils.js +90 -0
  23. package/dist/es/annotations/shared/ui_utils.js +823 -0
  24. package/dist/es/annotations/shared/utils.js +909 -0
  25. package/dist/es/common/component.js +33 -0
  26. package/dist/es/common/core.js +91 -0
  27. package/dist/es/common/dom.js +11 -0
  28. package/dist/es/common/main.js +4 -0
  29. package/dist/es/common/math.js +1 -0
  30. package/dist/es/enums/PdfViewerInteractionMode.js +6 -0
  31. package/dist/es/links/link-service.js +505 -0
  32. package/dist/es/main.js +2 -0
  33. package/dist/es/scroller.js +29 -30
  34. package/dist/es/text/text-layer-builder.js +288 -0
  35. package/dist/es/utils.js +5 -5
  36. package/dist/es/widget/page.js +762 -0
  37. package/dist/es/widget/pdfviewer.js +1659 -0
  38. package/dist/es2015/annotations/annotation-editor-layer-builder.js +139 -0
  39. package/dist/es2015/annotations/annotation-editor-layer.js +780 -0
  40. package/dist/es2015/annotations/annotation-editor-ui-manager.js +1690 -0
  41. package/dist/es2015/annotations/annotation-layer-builder.js +217 -0
  42. package/dist/es2015/annotations/annotation-layer.js +2793 -0
  43. package/dist/es2015/annotations/draw-layer-builder.js +65 -0
  44. package/dist/es2015/annotations/draw-layer.js +220 -0
  45. package/dist/es2015/annotations/editors/annotation-editor.js +1519 -0
  46. package/dist/es2015/annotations/editors/free-text-editor.js +783 -0
  47. package/dist/es2015/annotations/editors/highlight-editor.js +717 -0
  48. package/dist/es2015/annotations/editors/outliner.js +747 -0
  49. package/dist/es2015/annotations/helpers/annotation-storage.js +294 -0
  50. package/dist/es2015/annotations/helpers/color-manager.js +72 -0
  51. package/dist/es2015/annotations/helpers/command-manager.js +133 -0
  52. package/dist/es2015/annotations/helpers/id-manager.js +34 -0
  53. package/dist/es2015/annotations/helpers/image-manager.js +176 -0
  54. package/dist/es2015/annotations/helpers/text-accessibility-manager.js +212 -0
  55. package/dist/es2015/annotations/helpers/tools.js +19 -0
  56. package/dist/es2015/annotations/shared/display_utils.js +1024 -0
  57. package/dist/es2015/annotations/shared/event_utils.js +213 -0
  58. package/dist/es2015/annotations/shared/murmurhash3.js +126 -0
  59. package/dist/es2015/annotations/shared/scripting_utils.js +90 -0
  60. package/dist/es2015/annotations/shared/ui_utils.js +823 -0
  61. package/dist/es2015/annotations/shared/utils.js +909 -0
  62. package/dist/es2015/common/component.js +33 -0
  63. package/dist/es2015/common/core.js +91 -0
  64. package/dist/es2015/common/dom.js +11 -0
  65. package/dist/es2015/common/main.js +4 -0
  66. package/dist/es2015/common/math.js +1 -0
  67. package/dist/es2015/enums/PdfViewerInteractionMode.js +6 -0
  68. package/dist/es2015/links/link-service.js +505 -0
  69. package/dist/es2015/main.js +2 -0
  70. package/dist/es2015/scroller.js +29 -30
  71. package/dist/es2015/text/text-layer-builder.js +288 -0
  72. package/dist/es2015/utils.js +5 -5
  73. package/dist/es2015/widget/page.js +762 -0
  74. package/dist/es2015/widget/pdfviewer.js +1659 -0
  75. package/dist/npm/annotations/annotation-editor-layer-builder.d.ts +39 -0
  76. package/dist/npm/annotations/annotation-editor-layer-builder.js +142 -0
  77. package/dist/npm/annotations/annotation-editor-layer.d.ts +196 -0
  78. package/dist/npm/annotations/annotation-editor-layer.js +783 -0
  79. package/dist/npm/annotations/annotation-editor-ui-manager.d.ts +281 -0
  80. package/dist/npm/annotations/annotation-editor-ui-manager.js +1694 -0
  81. package/dist/npm/annotations/annotation-layer-builder.d.ts +58 -0
  82. package/dist/npm/annotations/annotation-layer-builder.js +220 -0
  83. package/dist/npm/annotations/annotation-layer.d.ts +134 -0
  84. package/dist/npm/annotations/annotation-layer.js +2794 -0
  85. package/dist/npm/annotations/draw-layer-builder.d.ts +21 -0
  86. package/dist/npm/annotations/draw-layer-builder.js +68 -0
  87. package/dist/npm/annotations/draw-layer.d.ts +33 -0
  88. package/dist/npm/annotations/draw-layer.js +223 -0
  89. package/dist/npm/annotations/editors/annotation-editor.d.ts +349 -0
  90. package/dist/npm/annotations/editors/annotation-editor.js +1523 -0
  91. package/dist/npm/annotations/editors/free-text-editor.d.ts +108 -0
  92. package/dist/npm/annotations/editors/free-text-editor.js +786 -0
  93. package/dist/npm/annotations/editors/highlight-editor.d.ts +114 -0
  94. package/dist/npm/annotations/editors/highlight-editor.js +717 -0
  95. package/dist/npm/annotations/editors/outliner.d.ts +51 -0
  96. package/dist/npm/annotations/editors/outliner.js +750 -0
  97. package/dist/npm/annotations/helpers/annotation-storage.d.ts +98 -0
  98. package/dist/npm/annotations/helpers/annotation-storage.js +299 -0
  99. package/dist/npm/annotations/helpers/color-manager.d.ts +6 -0
  100. package/dist/npm/annotations/helpers/color-manager.js +76 -0
  101. package/dist/npm/annotations/helpers/command-manager.d.ts +42 -0
  102. package/dist/npm/annotations/helpers/command-manager.js +137 -0
  103. package/dist/npm/annotations/helpers/id-manager.d.ts +6 -0
  104. package/dist/npm/annotations/helpers/id-manager.js +38 -0
  105. package/dist/npm/annotations/helpers/image-manager.d.ts +18 -0
  106. package/dist/npm/annotations/helpers/image-manager.js +180 -0
  107. package/dist/npm/annotations/helpers/text-accessibility-manager.d.ts +36 -0
  108. package/dist/npm/annotations/helpers/text-accessibility-manager.js +215 -0
  109. package/dist/npm/annotations/helpers/tools.d.ts +1 -0
  110. package/dist/npm/annotations/helpers/tools.js +23 -0
  111. package/dist/npm/annotations/shared/display_utils.d.ts +6 -0
  112. package/dist/npm/annotations/shared/display_utils.js +1030 -0
  113. package/dist/npm/annotations/shared/event_utils.d.ts +33 -0
  114. package/dist/npm/annotations/shared/event_utils.js +165 -0
  115. package/dist/npm/annotations/shared/murmurhash3.d.ts +8 -0
  116. package/dist/npm/annotations/shared/murmurhash3.js +129 -0
  117. package/dist/npm/annotations/shared/scripting_utils.d.ts +17 -0
  118. package/dist/npm/annotations/shared/scripting_utils.js +93 -0
  119. package/dist/npm/annotations/shared/ui_utils.d.ts +54 -0
  120. package/dist/npm/annotations/shared/ui_utils.js +250 -0
  121. package/dist/npm/annotations/shared/utils.d.ts +148 -0
  122. package/dist/npm/annotations/shared/utils.js +872 -0
  123. package/dist/npm/common/component.d.ts +9 -0
  124. package/dist/npm/common/component.js +37 -0
  125. package/dist/npm/common/core.d.ts +18 -0
  126. package/dist/npm/common/core.js +112 -0
  127. package/dist/npm/common/dom.d.ts +3 -0
  128. package/dist/npm/common/dom.js +17 -0
  129. package/dist/npm/common/main.d.ts +4 -0
  130. package/dist/npm/common/main.js +7 -0
  131. package/dist/npm/common/math.d.ts +1 -0
  132. package/dist/npm/common/math.js +5 -0
  133. package/dist/npm/enums/PdfViewerInteractionMode.d.ts +4 -0
  134. package/dist/npm/enums/PdfViewerInteractionMode.js +9 -0
  135. package/dist/npm/links/link-service.d.ts +116 -0
  136. package/dist/npm/links/link-service.js +501 -0
  137. package/dist/npm/main.d.ts +2 -0
  138. package/dist/npm/main.js +2 -0
  139. package/dist/npm/scroller.d.ts +7 -3
  140. package/dist/npm/scroller.js +32 -32
  141. package/dist/npm/text/text-layer-builder.d.ts +30 -0
  142. package/dist/npm/text/text-layer-builder.js +291 -0
  143. package/dist/npm/utils.d.ts +20 -2
  144. package/dist/npm/utils.js +11 -8
  145. package/dist/npm/widget/page.d.ts +75 -0
  146. package/dist/npm/widget/page.js +763 -0
  147. package/dist/npm/widget/pdfviewer.d.ts +222 -0
  148. package/dist/npm/widget/pdfviewer.js +1663 -0
  149. package/package.json +13 -9
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Simple event bus for an application. Listeners are attached using the `on`
3
+ * and `off` methods. To raise an event, the `dispatch` method shall be used.
4
+ */
5
+ declare class EventBus {
6
+ #private;
7
+ /**
8
+ * @param {string} eventName
9
+ * @param {function} listener
10
+ * @param {Object} [options]
11
+ */
12
+ on(eventName: any, listener: any, options?: any): void;
13
+ /**
14
+ * @param {string} eventName
15
+ * @param {function} listener
16
+ * @param {Object} [options]
17
+ */
18
+ off(eventName: any, listener: any): void;
19
+ /**
20
+ * @param {string} eventName
21
+ * @param {Object} data
22
+ */
23
+ dispatch(eventName: any, data: any): void;
24
+ /**
25
+ * @ignore
26
+ */
27
+ _on(eventName: any, listener: any, options?: any): void;
28
+ /**
29
+ * @ignore
30
+ */
31
+ _off(eventName: any, listener: any): void;
32
+ }
33
+ export { EventBus, };
@@ -0,0 +1,165 @@
1
+ "use strict";
2
+ /* Copyright 2012 Mozilla Foundation
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ // const WaitOnType = {
17
+ // EVENT: "event",
18
+ // TIMEOUT: "timeout",
19
+ // };
20
+ var _EventBus_listeners;
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.EventBus = void 0;
23
+ const tslib_1 = require("tslib");
24
+ // /**
25
+ // * @typedef {Object} WaitOnEventOrTimeoutParameters
26
+ // * @property {Object} target - The event target, can for example be:
27
+ // * `window`, `document`, a DOM element, or an {EventBus} instance.
28
+ // * @property {string} name - The name of the event.
29
+ // * @property {number} delay - The delay, in milliseconds, after which the
30
+ // * timeout occurs (if the event wasn't already dispatched).
31
+ // */
32
+ // /**
33
+ // * Allows waiting for an event or a timeout, whichever occurs first.
34
+ // * Can be used to ensure that an action always occurs, even when an event
35
+ // * arrives late or not at all.
36
+ // *
37
+ // * @param {WaitOnEventOrTimeoutParameters}
38
+ // * @returns {Promise} A promise that is resolved with a {WaitOnType} value.
39
+ // */
40
+ // async function waitOnEventOrTimeout({ target, name, delay = 0 }) {
41
+ // if (
42
+ // typeof target !== "object" ||
43
+ // !(name && typeof name === "string") ||
44
+ // !(Number.isInteger(delay) && delay >= 0)
45
+ // ) {
46
+ // throw new Error("waitOnEventOrTimeout - invalid parameters.");
47
+ // }
48
+ // const { promise, resolve } = Promise.withResolvers();
49
+ // const ac = new AbortController();
50
+ // function handler(type) {
51
+ // ac.abort(); // Remove event listener.
52
+ // clearTimeout(timeout);
53
+ // resolve(type);
54
+ // }
55
+ // const evtMethod = target instanceof EventBus ? "_on" : "addEventListener";
56
+ // target[evtMethod](name, handler.bind(null, WaitOnType.EVENT), {
57
+ // signal: ac.signal,
58
+ // });
59
+ // const timeout = setTimeout(handler.bind(null, WaitOnType.TIMEOUT), delay);
60
+ // return promise;
61
+ // }
62
+ /**
63
+ * Simple event bus for an application. Listeners are attached using the `on`
64
+ * and `off` methods. To raise an event, the `dispatch` method shall be used.
65
+ */
66
+ class EventBus {
67
+ constructor() {
68
+ _EventBus_listeners.set(this, Object.create(null));
69
+ }
70
+ /**
71
+ * @param {string} eventName
72
+ * @param {function} listener
73
+ * @param {Object} [options]
74
+ */
75
+ on(eventName, listener, options = null) {
76
+ this._on(eventName, listener, {
77
+ external: true,
78
+ once: options === null || options === void 0 ? void 0 : options.once,
79
+ signal: options === null || options === void 0 ? void 0 : options.signal,
80
+ });
81
+ }
82
+ /**
83
+ * @param {string} eventName
84
+ * @param {function} listener
85
+ * @param {Object} [options]
86
+ */
87
+ off(eventName, listener) {
88
+ this._off(eventName, listener);
89
+ }
90
+ /**
91
+ * @param {string} eventName
92
+ * @param {Object} data
93
+ */
94
+ dispatch(eventName, data) {
95
+ const eventListeners = tslib_1.__classPrivateFieldGet(this, _EventBus_listeners, "f")[eventName];
96
+ if (!eventListeners || eventListeners.length === 0) {
97
+ return;
98
+ }
99
+ let externalListeners;
100
+ // Making copy of the listeners array in case if it will be modified
101
+ // during dispatch.
102
+ for (const { listener, external, once } of eventListeners.slice(0)) {
103
+ if (once) {
104
+ this._off(eventName, listener);
105
+ }
106
+ if (external) {
107
+ (externalListeners || (externalListeners = [])).push(listener);
108
+ continue;
109
+ }
110
+ listener(data);
111
+ }
112
+ // Dispatch any "external" listeners *after* the internal ones, to give the
113
+ // viewer components time to handle events and update their state first.
114
+ if (externalListeners) {
115
+ for (const listener of externalListeners) {
116
+ listener(data);
117
+ }
118
+ externalListeners = null;
119
+ }
120
+ }
121
+ /**
122
+ * @ignore
123
+ */
124
+ _on(eventName, listener, options = null) {
125
+ var _a;
126
+ let rmAbort = null;
127
+ if ((options === null || options === void 0 ? void 0 : options.signal) instanceof AbortSignal) {
128
+ const { signal } = options;
129
+ if (signal.aborted) {
130
+ // console.error("Cannot use an `aborted` signal.");
131
+ return;
132
+ }
133
+ const onAbort = () => this._off(eventName, listener);
134
+ rmAbort = () => signal.removeEventListener("abort", onAbort);
135
+ signal.addEventListener("abort", onAbort);
136
+ }
137
+ const eventListeners = ((_a = tslib_1.__classPrivateFieldGet(this, _EventBus_listeners, "f"))[eventName] || (_a[eventName] = []));
138
+ eventListeners.push({
139
+ listener,
140
+ external: (options === null || options === void 0 ? void 0 : options.external) === true,
141
+ once: (options === null || options === void 0 ? void 0 : options.once) === true,
142
+ rmAbort,
143
+ });
144
+ }
145
+ /**
146
+ * @ignore
147
+ */
148
+ _off(eventName, listener) {
149
+ var _a;
150
+ const eventListeners = tslib_1.__classPrivateFieldGet(this, _EventBus_listeners, "f")[eventName];
151
+ if (!eventListeners) {
152
+ return;
153
+ }
154
+ for (let i = 0, ii = eventListeners.length; i < ii; i++) {
155
+ const evt = eventListeners[i];
156
+ if (evt.listener === listener) {
157
+ (_a = evt.rmAbort) === null || _a === void 0 ? void 0 : _a.call(evt); // Ensure that the `AbortSignal` listener is removed.
158
+ eventListeners.splice(i, 1);
159
+ return;
160
+ }
161
+ }
162
+ }
163
+ }
164
+ exports.EventBus = EventBus;
165
+ _EventBus_listeners = new WeakMap();
@@ -0,0 +1,8 @@
1
+ declare class MurmurHash3_64 {
2
+ h1: any;
3
+ h2: any;
4
+ constructor(seed: any);
5
+ update(input: any): void;
6
+ hexdigest(): string;
7
+ }
8
+ export { MurmurHash3_64 };
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ /* Copyright 2014 Opera Software ASA
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *
16
+ *
17
+ * Based on https://code.google.com/p/smhasher/wiki/MurmurHash3.
18
+ * Hashes roughly 100 KB per millisecond on i7 3.4 GHz.
19
+ */
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.MurmurHash3_64 = void 0;
22
+ const SEED = 0xc3d2e1f0;
23
+ // Workaround for missing math precision in JS.
24
+ const MASK_HIGH = 0xffff0000;
25
+ const MASK_LOW = 0xffff;
26
+ class MurmurHash3_64 {
27
+ // todo: props
28
+ constructor(seed) {
29
+ // todo: props
30
+ this.h1 = null;
31
+ this.h2 = null;
32
+ this.h1 = seed ? seed & 0xffffffff : SEED;
33
+ this.h2 = seed ? seed & 0xffffffff : SEED;
34
+ }
35
+ update(input) {
36
+ let data, length;
37
+ if (typeof input === "string") {
38
+ data = new Uint8Array(input.length * 2);
39
+ length = 0;
40
+ for (let i = 0, ii = input.length; i < ii; i++) {
41
+ const code = input.charCodeAt(i);
42
+ if (code <= 0xff) {
43
+ data[length++] = code;
44
+ }
45
+ else {
46
+ data[length++] = code >>> 8;
47
+ data[length++] = code & 0xff;
48
+ }
49
+ }
50
+ }
51
+ else if (ArrayBuffer.isView(input)) {
52
+ data = input.slice();
53
+ length = data.byteLength;
54
+ }
55
+ else {
56
+ throw new Error("Invalid data format, must be a string or TypedArray.");
57
+ }
58
+ const blockCounts = length >> 2;
59
+ const tailLength = length - blockCounts * 4;
60
+ // We don't care about endianness here.
61
+ const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
62
+ let k1 = 0, k2 = 0;
63
+ let h1 = this.h1, h2 = this.h2;
64
+ const C1 = 0xcc9e2d51, C2 = 0x1b873593;
65
+ const C1_LOW = C1 & MASK_LOW, C2_LOW = C2 & MASK_LOW;
66
+ for (let i = 0; i < blockCounts; i++) {
67
+ if (i & 1) {
68
+ k1 = dataUint32[i];
69
+ k1 = ((k1 * C1) & MASK_HIGH) | ((k1 * C1_LOW) & MASK_LOW);
70
+ k1 = (k1 << 15) | (k1 >>> 17);
71
+ k1 = ((k1 * C2) & MASK_HIGH) | ((k1 * C2_LOW) & MASK_LOW);
72
+ h1 ^= k1;
73
+ h1 = (h1 << 13) | (h1 >>> 19);
74
+ h1 = h1 * 5 + 0xe6546b64;
75
+ }
76
+ else {
77
+ k2 = dataUint32[i];
78
+ k2 = ((k2 * C1) & MASK_HIGH) | ((k2 * C1_LOW) & MASK_LOW);
79
+ k2 = (k2 << 15) | (k2 >>> 17);
80
+ k2 = ((k2 * C2) & MASK_HIGH) | ((k2 * C2_LOW) & MASK_LOW);
81
+ h2 ^= k2;
82
+ h2 = (h2 << 13) | (h2 >>> 19);
83
+ h2 = h2 * 5 + 0xe6546b64;
84
+ }
85
+ }
86
+ k1 = 0;
87
+ switch (tailLength) {
88
+ case 3:
89
+ k1 ^= data[blockCounts * 4 + 2] << 16;
90
+ /* falls through */
91
+ case 2:
92
+ k1 ^= data[blockCounts * 4 + 1] << 8;
93
+ /* falls through */
94
+ case 1:
95
+ k1 ^= data[blockCounts * 4];
96
+ /* falls through */
97
+ k1 = ((k1 * C1) & MASK_HIGH) | ((k1 * C1_LOW) & MASK_LOW);
98
+ k1 = (k1 << 15) | (k1 >>> 17);
99
+ k1 = ((k1 * C2) & MASK_HIGH) | ((k1 * C2_LOW) & MASK_LOW);
100
+ if (blockCounts & 1) {
101
+ h1 ^= k1;
102
+ }
103
+ else {
104
+ h2 ^= k1;
105
+ }
106
+ break;
107
+ default: break;
108
+ }
109
+ this.h1 = h1;
110
+ this.h2 = h2;
111
+ }
112
+ hexdigest() {
113
+ let h1 = this.h1, h2 = this.h2;
114
+ h1 ^= h2 >>> 1;
115
+ h1 = ((h1 * 0xed558ccd) & MASK_HIGH) | ((h1 * 0x8ccd) & MASK_LOW);
116
+ h2 =
117
+ ((h2 * 0xff51afd7) & MASK_HIGH) |
118
+ (((((h2 << 16) | (h1 >>> 16)) * 0xafd7ed55) & MASK_HIGH) >>> 16);
119
+ h1 ^= h2 >>> 1;
120
+ h1 = ((h1 * 0x1a85ec53) & MASK_HIGH) | ((h1 * 0xec53) & MASK_LOW);
121
+ h2 =
122
+ ((h2 * 0xc4ceb9fe) & MASK_HIGH) |
123
+ (((((h2 << 16) | (h1 >>> 16)) * 0xb9fe1a85) & MASK_HIGH) >>> 16);
124
+ h1 ^= h2 >>> 1;
125
+ return ((h1 >>> 0).toString(16).padStart(8, "0") +
126
+ (h2 >>> 0).toString(16).padStart(8, "0"));
127
+ }
128
+ }
129
+ exports.MurmurHash3_64 = MurmurHash3_64;
@@ -0,0 +1,17 @@
1
+ declare class ColorConverters {
2
+ static CMYK_G([c, y, m, k]: [any, any, any, any]): (string | number)[];
3
+ static G_CMYK([g]: [any]): (string | number)[];
4
+ static G_RGB([g]: [any]): any[];
5
+ static G_rgb([g]: [any]): any[];
6
+ static G_HTML([g]: [any]): string;
7
+ static RGB_G([r, g, b]: [any, any, any]): (string | number)[];
8
+ static RGB_rgb(color: any): any;
9
+ static RGB_HTML(color: any): string;
10
+ static T_HTML(): string;
11
+ static T_rgb(): any[];
12
+ static CMYK_RGB([c, y, m, k]: [any, any, any, any]): (string | number)[];
13
+ static CMYK_rgb([c, y, m, k]: [any, any, any, any]): number[];
14
+ static CMYK_HTML(components: any): string;
15
+ static RGB_CMYK([r, g, b]: [any, any, any]): (string | number)[];
16
+ }
17
+ export { ColorConverters };
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ /* Copyright 2020 Mozilla Foundation
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.ColorConverters = void 0;
18
+ /**
19
+ * PLEASE NOTE: This file is currently imported in both the `../display/` and
20
+ * `../scripting_api/` folders, hence be EXTREMELY careful about
21
+ * introducing any dependencies here since that can lead to an
22
+ * unexpected/unnecessary size increase of the *built* files.
23
+ */
24
+ function makeColorComp(n) {
25
+ return Math.floor(Math.max(0, Math.min(1, n)) * 255)
26
+ .toString(16)
27
+ .padStart(2, "0");
28
+ }
29
+ function scaleAndClamp(x) {
30
+ return Math.max(0, Math.min(255, 255 * x));
31
+ }
32
+ // PDF specifications section 10.3
33
+ class ColorConverters {
34
+ static CMYK_G([c, y, m, k]) {
35
+ return ["G", 1 - Math.min(1, 0.3 * c + 0.59 * m + 0.11 * y + k)];
36
+ }
37
+ static G_CMYK([g]) {
38
+ return ["CMYK", 0, 0, 0, 1 - g];
39
+ }
40
+ static G_RGB([g]) {
41
+ return ["RGB", g, g, g];
42
+ }
43
+ static G_rgb([g]) {
44
+ g = scaleAndClamp(g);
45
+ return [g, g, g];
46
+ }
47
+ static G_HTML([g]) {
48
+ const G = makeColorComp(g);
49
+ return `#${G}${G}${G}`;
50
+ }
51
+ static RGB_G([r, g, b]) {
52
+ return ["G", 0.3 * r + 0.59 * g + 0.11 * b];
53
+ }
54
+ static RGB_rgb(color) {
55
+ return color.map(scaleAndClamp);
56
+ }
57
+ static RGB_HTML(color) {
58
+ return `#${color.map(makeColorComp).join("")}`;
59
+ }
60
+ static T_HTML() {
61
+ return "#00000000";
62
+ }
63
+ static T_rgb() {
64
+ return [null];
65
+ }
66
+ static CMYK_RGB([c, y, m, k]) {
67
+ return [
68
+ "RGB",
69
+ 1 - Math.min(1, c + k),
70
+ 1 - Math.min(1, m + k),
71
+ 1 - Math.min(1, y + k),
72
+ ];
73
+ }
74
+ static CMYK_rgb([c, y, m, k]) {
75
+ return [
76
+ scaleAndClamp(1 - Math.min(1, c + k)),
77
+ scaleAndClamp(1 - Math.min(1, m + k)),
78
+ scaleAndClamp(1 - Math.min(1, y + k)),
79
+ ];
80
+ }
81
+ static CMYK_HTML(components) {
82
+ const rgb = this.CMYK_RGB(components).slice(1);
83
+ return this.RGB_HTML(rgb);
84
+ }
85
+ static RGB_CMYK([r, g, b]) {
86
+ const c = 1 - r;
87
+ const m = 1 - g;
88
+ const y = 1 - b;
89
+ const k = Math.min(c, m, y);
90
+ return ["CMYK", c, m, y, k];
91
+ }
92
+ }
93
+ exports.ColorConverters = ColorConverters;
@@ -0,0 +1,54 @@
1
+ declare const DEFAULT_SCALE = 1;
2
+ declare const RenderingStates: {
3
+ INITIAL: number;
4
+ RUNNING: number;
5
+ PAUSED: number;
6
+ FINISHED: number;
7
+ };
8
+ declare const PresentationModeState: {
9
+ UNKNOWN: number;
10
+ NORMAL: number;
11
+ CHANGING: number;
12
+ FULLSCREEN: number;
13
+ };
14
+ declare const TextLayerMode: {
15
+ DISABLE: number;
16
+ ENABLE: number;
17
+ ENABLE_PERMISSIONS: number;
18
+ };
19
+ declare const ScrollMode: {
20
+ UNKNOWN: number;
21
+ VERTICAL: number;
22
+ HORIZONTAL: number;
23
+ WRAPPED: number;
24
+ PAGE: number;
25
+ };
26
+ /**
27
+ * Scrolls specified element into view of its parent.
28
+ * @param {HTMLElement} element - The element to be visible.
29
+ * @param {Object} [spot] - An object with optional top and left properties,
30
+ * specifying the offset from the top left edge.
31
+ * @param {number} [spot.left]
32
+ * @param {number} [spot.top]
33
+ * @param {boolean} [scrollMatches] - When scrolling search results into view,
34
+ * ignore elements that either: Contains marked content identifiers,
35
+ * or have the CSS-rule `overflow: hidden;` set. The default value is `false`.
36
+ */
37
+ declare function scrollIntoView(element: any, spot: any, scrollMatches?: boolean): void;
38
+ /**
39
+ * Helper function to parse query string (e.g. ?param1=value&param2=...).
40
+ * @param {string} query
41
+ * @returns {Map}
42
+ */
43
+ declare function parseQueryString(query: any): Map<any, any>;
44
+ /**
45
+ * Use binary search to find the index of the first item in a given array which
46
+ * passes a given condition. The items are expected to be sorted in the sense
47
+ * that if the condition is true for one item in the array, then it is also true
48
+ * for all following items.
49
+ *
50
+ * @returns {number} Index of the first array element to pass the test,
51
+ * or |items.length| if no such element exists.
52
+ */
53
+ declare function binarySearchFirstItem(items: any, condition: any, start?: number): any;
54
+ export { binarySearchFirstItem, DEFAULT_SCALE, parseQueryString, PresentationModeState, RenderingStates, scrollIntoView, ScrollMode, TextLayerMode, };