@meerrec/wasm-pptx 0.0.0-stage → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +17 -2
- package/package.json +34 -4
- package/pkg/doc_converter_pptx_wasm.d.ts +204 -0
- package/pkg/doc_converter_pptx_wasm.js +863 -0
- package/pkg/doc_converter_pptx_wasm_bg.wasm +0 -0
- package/pkg/doc_converter_pptx_wasm_bg.wasm.d.ts +24 -0
- package/pkg/package.json +16 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 doc-converter contributors
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @meerrec/wasm-pptx
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Ленивый модуль просмотра PPTX: воркер грузит его по URL при открытии `.pptx`,
|
|
4
|
+
поэтому в основной бандл он не входит. Точка входа —
|
|
5
|
+
`pkg/doc_converter_pptx_wasm.js` рядом с `pkg/doc_converter_pptx_wasm_bg.wasm`;
|
|
6
|
+
каталог `pkg/` генерирует `wasm-pack` (скрипт `scripts/build-wasm.sh`), руками
|
|
7
|
+
его править не нужно.
|
|
8
|
+
|
|
9
|
+
## Установка
|
|
10
|
+
|
|
11
|
+
Пакет публикуется в `registry.npmjs.org` (`@meerrec/wasm-pptx`), зеркало —
|
|
12
|
+
GitHub Packages этого репозитория. Реестр и токен с правом `read:packages` —
|
|
13
|
+
в `~/.npmrc` (см. корневой [README](https://github.com/meerrec/wasm-converter#readme)).
|
|
14
|
+
|
|
15
|
+
## Ссылки
|
|
16
|
+
|
|
17
|
+
- Корневой [README](https://github.com/meerrec/wasm-converter#readme) — установка, быстрый старт, бюджеты.
|
|
18
|
+
- [ADR-0033](https://github.com/meerrec/wasm-converter/blob/main/docs/adr/0033-pptx-plugin.md) — скоуп и границы плагина PPTX.
|
package/package.json
CHANGED
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meerrec/wasm-pptx",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"description": "wasm-bindgen output of the lazy PPTX viewer module. Generated by wasm-pack — do not edit.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/meerrec/wasm-converter.git",
|
|
9
|
+
"directory": "packages/wasm-pptx"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/meerrec/wasm-converter#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/meerrec/wasm-converter/issues"
|
|
14
|
+
},
|
|
15
|
+
"type": "module",
|
|
16
|
+
"main": "./pkg/doc_converter_pptx_wasm.js",
|
|
17
|
+
"module": "./pkg/doc_converter_pptx_wasm.js",
|
|
18
|
+
"types": "./pkg/doc_converter_pptx_wasm.d.ts",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./pkg/doc_converter_pptx_wasm.d.ts",
|
|
22
|
+
"import": "./pkg/doc_converter_pptx_wasm.js"
|
|
23
|
+
},
|
|
24
|
+
"./pkg/*": "./pkg/*"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"pkg",
|
|
28
|
+
"README.md",
|
|
29
|
+
"LICENSE"
|
|
30
|
+
],
|
|
31
|
+
"sideEffects": false,
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "echo 'build via scripts/build-wasm.sh from repo root'",
|
|
34
|
+
"clean": "rm -rf pkg"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Собрать кадр слайда в буфер вызывающего — путь без `SharedArrayBuffer`.
|
|
6
|
+
*
|
|
7
|
+
* Байты пишутся в готовый массив: воркер держит два и заполняет то один, то
|
|
8
|
+
* другой, поэтому на кадр нет ни аллокации под сам кадр, ни копии из памяти
|
|
9
|
+
* wasm в JS (копия в память painter'а неизбежна: он живёт в другом модуле).
|
|
10
|
+
* `written: false` вместе с `bytes` больше длины буфера означает, что буфер
|
|
11
|
+
* мал: воркер вырастит его и повторит сборку.
|
|
12
|
+
*
|
|
13
|
+
* # Errors
|
|
14
|
+
* Если презентация не открыта, слайда с таким индексом нет или окно описано
|
|
15
|
+
* неверно.
|
|
16
|
+
*/
|
|
17
|
+
export function pptx_build_display_list_into(out: Uint8Array, viewport: any, slide: number): any;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Собрать кадр слайда сразу в слот ring'а.
|
|
21
|
+
*
|
|
22
|
+
* Возвращает `written: false`, если свободного слота не было: кадр теряется,
|
|
23
|
+
* но следующий за ним рисуется — так и задумано, догонять прокрутку
|
|
24
|
+
* устаревшими кадрами незачем. Второй случай `written: false` — кадр больше
|
|
25
|
+
* слота: `bytes` скажет, насколько.
|
|
26
|
+
*
|
|
27
|
+
* # Errors
|
|
28
|
+
* Если презентация не открыта, слайда с таким индексом нет, окно описано
|
|
29
|
+
* неверно или SAB не тот.
|
|
30
|
+
*/
|
|
31
|
+
export function pptx_build_display_list_sab(sab: SharedArrayBuffer, slot_capacity: number, viewport: any, slide: number): any;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Закрыть презентацию и освободить память.
|
|
35
|
+
*/
|
|
36
|
+
export function pptx_close(): void;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Экспортировать презентацию в HTML — самостоятельную страницу со
|
|
40
|
+
* встроенными стилями, а не фрагмент.
|
|
41
|
+
*
|
|
42
|
+
* Разметка — у [`doc_converter_pptx::export::to_html`].
|
|
43
|
+
*
|
|
44
|
+
* # Errors
|
|
45
|
+
* Если байты не OOXML-пакет или `ppt/presentation.xml` не разбирается.
|
|
46
|
+
*/
|
|
47
|
+
export function pptx_export_html(bytes: Uint8Array): string;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Экспортировать презентацию в Markdown: слайды заголовками второго уровня,
|
|
51
|
+
* маркеры списков — `-`/`1.` с отступом уровня.
|
|
52
|
+
*
|
|
53
|
+
* Разметка — у [`doc_converter_pptx::export::to_markdown`].
|
|
54
|
+
*
|
|
55
|
+
* # Errors
|
|
56
|
+
* Если байты не OOXML-пакет или `ppt/presentation.xml` не разбирается.
|
|
57
|
+
*/
|
|
58
|
+
export function pptx_export_markdown(bytes: Uint8Array): string;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Экспортировать презентацию в обычный текст: конспект из текстовых рамок.
|
|
62
|
+
*
|
|
63
|
+
* Разметка — у [`doc_converter_pptx::export::to_text`].
|
|
64
|
+
*
|
|
65
|
+
* # Errors
|
|
66
|
+
* Если байты не OOXML-пакет или `ppt/presentation.xml` не разбирается.
|
|
67
|
+
*/
|
|
68
|
+
export function pptx_export_text(bytes: Uint8Array): string;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Байты картинки по её id.
|
|
72
|
+
*
|
|
73
|
+
* Возвращается `Uint8Array` — копия байтов из памяти wasm; буфер принадлежит
|
|
74
|
+
* интерфейсу, и дальше его можно отдать `postMessage` с transferables.
|
|
75
|
+
*
|
|
76
|
+
* # Errors
|
|
77
|
+
* Если презентация не открыта или картинки с таким id нет.
|
|
78
|
+
*/
|
|
79
|
+
export function pptx_image_bytes(id: number): Uint8Array;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Картинки открытой презентации: id, MIME-тип и длина байтов.
|
|
83
|
+
*
|
|
84
|
+
* Байты в список не входят: их забирает [`pptx_image_bytes`] по одному id,
|
|
85
|
+
* чтобы не копировать разом всю media презентации. В списке только части, на
|
|
86
|
+
* которые ссылается хотя бы один `p:pic`: остальные разбор не читает.
|
|
87
|
+
*
|
|
88
|
+
* # Errors
|
|
89
|
+
* Если презентация не открыта.
|
|
90
|
+
*/
|
|
91
|
+
export function pptx_images(): any;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Открыта ли презентация. Нужно интерфейсу, чтобы не рисовать пустоту.
|
|
95
|
+
*/
|
|
96
|
+
export function pptx_is_open(): boolean;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Открыть презентацию из байтов: разобрать, разложить слайды, запомнить.
|
|
100
|
+
*
|
|
101
|
+
* Раскладка считается здесь и один раз: размер слайда задан презентацией, а
|
|
102
|
+
* не окном. Предыдущая презентация закрывается.
|
|
103
|
+
*
|
|
104
|
+
* # Errors
|
|
105
|
+
* Если байты не OOXML-пакет, `ppt/presentation.xml` не разбирается, в
|
|
106
|
+
* презентации нет слайдов или раскладка упирается в `Error`.
|
|
107
|
+
*/
|
|
108
|
+
export function pptx_open(bytes: Uint8Array): any;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Открыть презентацию из байтов, отдав их без копирования.
|
|
112
|
+
*
|
|
113
|
+
* # Errors
|
|
114
|
+
* То же, что у [`pptx_open`].
|
|
115
|
+
*/
|
|
116
|
+
export function pptx_open_bytes(bytes: Uint8Array): any;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Взвести или снять флаг кооперативной отмены (ADR-0032).
|
|
120
|
+
*
|
|
121
|
+
* Раскладка проверяет его между слайдами. Флаг одноразовый: операция,
|
|
122
|
+
* которая его заметила, гасит его сама, — иначе отмена, пришедшая после
|
|
123
|
+
* операции, ждала бы следующую.
|
|
124
|
+
*/
|
|
125
|
+
export function set_cancel(flag: boolean): void;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Дописать чанк. Возвращает накопленный размер — прогресс для диагностики.
|
|
129
|
+
*
|
|
130
|
+
* # Errors
|
|
131
|
+
* Если поток с таким id не заведён.
|
|
132
|
+
*/
|
|
133
|
+
export function stream_append(id: number, bytes: Uint8Array): bigint;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Отменить поток: буфер освобождается, id больше не действителен.
|
|
137
|
+
*/
|
|
138
|
+
export function stream_free(id: number): void;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Завести поток: id, под которым воркер будет слать чанки.
|
|
142
|
+
*/
|
|
143
|
+
export function stream_new(): number;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Завершить поток: разобрать накопленный буфер как презентацию (ADR-0031 §6).
|
|
147
|
+
*
|
|
148
|
+
* Буфер изымается из реестра — поток одноразовый, — презентация встаёт в
|
|
149
|
+
* `PRES`, как при `pptx_open`. Ответ — тот же список слайдов.
|
|
150
|
+
*
|
|
151
|
+
* # Errors
|
|
152
|
+
* Если поток неизвестен, буфер пуст (оборванный поток) или байты не
|
|
153
|
+
* OOXML-пакет.
|
|
154
|
+
*/
|
|
155
|
+
export function stream_open_pptx(id: number): any;
|
|
156
|
+
|
|
157
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
158
|
+
|
|
159
|
+
export interface InitOutput {
|
|
160
|
+
readonly memory: WebAssembly.Memory;
|
|
161
|
+
readonly pptx_build_display_list_into: (a: number, b: number, c: number, d: number) => void;
|
|
162
|
+
readonly pptx_build_display_list_sab: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
163
|
+
readonly pptx_close: () => void;
|
|
164
|
+
readonly pptx_export_html: (a: number, b: number) => void;
|
|
165
|
+
readonly pptx_export_markdown: (a: number, b: number) => void;
|
|
166
|
+
readonly pptx_export_text: (a: number, b: number) => void;
|
|
167
|
+
readonly pptx_image_bytes: (a: number, b: number) => void;
|
|
168
|
+
readonly pptx_images: (a: number) => void;
|
|
169
|
+
readonly pptx_is_open: () => number;
|
|
170
|
+
readonly pptx_open: (a: number, b: number, c: number) => void;
|
|
171
|
+
readonly pptx_open_bytes: (a: number, b: number) => void;
|
|
172
|
+
readonly set_cancel: (a: number) => void;
|
|
173
|
+
readonly stream_append: (a: number, b: number, c: number, d: number) => void;
|
|
174
|
+
readonly stream_free: (a: number) => void;
|
|
175
|
+
readonly stream_new: () => number;
|
|
176
|
+
readonly stream_open_pptx: (a: number, b: number) => void;
|
|
177
|
+
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
178
|
+
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
179
|
+
readonly __wbindgen_export3: (a: number) => void;
|
|
180
|
+
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
181
|
+
readonly __wbindgen_export4: (a: number, b: number, c: number) => void;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
188
|
+
* a precompiled `WebAssembly.Module`.
|
|
189
|
+
*
|
|
190
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
191
|
+
*
|
|
192
|
+
* @returns {InitOutput}
|
|
193
|
+
*/
|
|
194
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
198
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
199
|
+
*
|
|
200
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
201
|
+
*
|
|
202
|
+
* @returns {Promise<InitOutput>}
|
|
203
|
+
*/
|
|
204
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
|
@@ -0,0 +1,863 @@
|
|
|
1
|
+
/* @ts-self-types="./doc_converter_pptx_wasm.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Собрать кадр слайда в буфер вызывающего — путь без `SharedArrayBuffer`.
|
|
5
|
+
*
|
|
6
|
+
* Байты пишутся в готовый массив: воркер держит два и заполняет то один, то
|
|
7
|
+
* другой, поэтому на кадр нет ни аллокации под сам кадр, ни копии из памяти
|
|
8
|
+
* wasm в JS (копия в память painter'а неизбежна: он живёт в другом модуле).
|
|
9
|
+
* `written: false` вместе с `bytes` больше длины буфера означает, что буфер
|
|
10
|
+
* мал: воркер вырастит его и повторит сборку.
|
|
11
|
+
*
|
|
12
|
+
* # Errors
|
|
13
|
+
* Если презентация не открыта, слайда с таким индексом нет или окно описано
|
|
14
|
+
* неверно.
|
|
15
|
+
* @param {Uint8Array} out
|
|
16
|
+
* @param {any} viewport
|
|
17
|
+
* @param {number} slide
|
|
18
|
+
* @returns {any}
|
|
19
|
+
*/
|
|
20
|
+
export function pptx_build_display_list_into(out, viewport, slide) {
|
|
21
|
+
try {
|
|
22
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
23
|
+
wasm.pptx_build_display_list_into(retptr, addBorrowedObject(out), addHeapObject(viewport), slide);
|
|
24
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
25
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
26
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
27
|
+
if (r2) {
|
|
28
|
+
throw takeObject(r1);
|
|
29
|
+
}
|
|
30
|
+
return takeObject(r0);
|
|
31
|
+
} finally {
|
|
32
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
33
|
+
heap[stack_pointer++] = undefined;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Собрать кадр слайда сразу в слот ring'а.
|
|
39
|
+
*
|
|
40
|
+
* Возвращает `written: false`, если свободного слота не было: кадр теряется,
|
|
41
|
+
* но следующий за ним рисуется — так и задумано, догонять прокрутку
|
|
42
|
+
* устаревшими кадрами незачем. Второй случай `written: false` — кадр больше
|
|
43
|
+
* слота: `bytes` скажет, насколько.
|
|
44
|
+
*
|
|
45
|
+
* # Errors
|
|
46
|
+
* Если презентация не открыта, слайда с таким индексом нет, окно описано
|
|
47
|
+
* неверно или SAB не тот.
|
|
48
|
+
* @param {SharedArrayBuffer} sab
|
|
49
|
+
* @param {number} slot_capacity
|
|
50
|
+
* @param {any} viewport
|
|
51
|
+
* @param {number} slide
|
|
52
|
+
* @returns {any}
|
|
53
|
+
*/
|
|
54
|
+
export function pptx_build_display_list_sab(sab, slot_capacity, viewport, slide) {
|
|
55
|
+
try {
|
|
56
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
57
|
+
wasm.pptx_build_display_list_sab(retptr, addHeapObject(sab), slot_capacity, addHeapObject(viewport), slide);
|
|
58
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
59
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
60
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
61
|
+
if (r2) {
|
|
62
|
+
throw takeObject(r1);
|
|
63
|
+
}
|
|
64
|
+
return takeObject(r0);
|
|
65
|
+
} finally {
|
|
66
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Закрыть презентацию и освободить память.
|
|
72
|
+
*/
|
|
73
|
+
export function pptx_close() {
|
|
74
|
+
wasm.pptx_close();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Экспортировать презентацию в HTML — самостоятельную страницу со
|
|
79
|
+
* встроенными стилями, а не фрагмент.
|
|
80
|
+
*
|
|
81
|
+
* Разметка — у [`doc_converter_pptx::export::to_html`].
|
|
82
|
+
*
|
|
83
|
+
* # Errors
|
|
84
|
+
* Если байты не OOXML-пакет или `ppt/presentation.xml` не разбирается.
|
|
85
|
+
* @param {Uint8Array} bytes
|
|
86
|
+
* @returns {string}
|
|
87
|
+
*/
|
|
88
|
+
export function pptx_export_html(bytes) {
|
|
89
|
+
let deferred2_0;
|
|
90
|
+
let deferred2_1;
|
|
91
|
+
try {
|
|
92
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
93
|
+
wasm.pptx_export_html(retptr, addHeapObject(bytes));
|
|
94
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
95
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
96
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
97
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
98
|
+
var ptr1 = r0;
|
|
99
|
+
var len1 = r1;
|
|
100
|
+
if (r3) {
|
|
101
|
+
ptr1 = 0; len1 = 0;
|
|
102
|
+
throw takeObject(r2);
|
|
103
|
+
}
|
|
104
|
+
deferred2_0 = ptr1;
|
|
105
|
+
deferred2_1 = len1;
|
|
106
|
+
return getStringFromWasm0(ptr1, len1);
|
|
107
|
+
} finally {
|
|
108
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
109
|
+
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Экспортировать презентацию в Markdown: слайды заголовками второго уровня,
|
|
115
|
+
* маркеры списков — `-`/`1.` с отступом уровня.
|
|
116
|
+
*
|
|
117
|
+
* Разметка — у [`doc_converter_pptx::export::to_markdown`].
|
|
118
|
+
*
|
|
119
|
+
* # Errors
|
|
120
|
+
* Если байты не OOXML-пакет или `ppt/presentation.xml` не разбирается.
|
|
121
|
+
* @param {Uint8Array} bytes
|
|
122
|
+
* @returns {string}
|
|
123
|
+
*/
|
|
124
|
+
export function pptx_export_markdown(bytes) {
|
|
125
|
+
let deferred2_0;
|
|
126
|
+
let deferred2_1;
|
|
127
|
+
try {
|
|
128
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
129
|
+
wasm.pptx_export_markdown(retptr, addHeapObject(bytes));
|
|
130
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
131
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
132
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
133
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
134
|
+
var ptr1 = r0;
|
|
135
|
+
var len1 = r1;
|
|
136
|
+
if (r3) {
|
|
137
|
+
ptr1 = 0; len1 = 0;
|
|
138
|
+
throw takeObject(r2);
|
|
139
|
+
}
|
|
140
|
+
deferred2_0 = ptr1;
|
|
141
|
+
deferred2_1 = len1;
|
|
142
|
+
return getStringFromWasm0(ptr1, len1);
|
|
143
|
+
} finally {
|
|
144
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
145
|
+
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Экспортировать презентацию в обычный текст: конспект из текстовых рамок.
|
|
151
|
+
*
|
|
152
|
+
* Разметка — у [`doc_converter_pptx::export::to_text`].
|
|
153
|
+
*
|
|
154
|
+
* # Errors
|
|
155
|
+
* Если байты не OOXML-пакет или `ppt/presentation.xml` не разбирается.
|
|
156
|
+
* @param {Uint8Array} bytes
|
|
157
|
+
* @returns {string}
|
|
158
|
+
*/
|
|
159
|
+
export function pptx_export_text(bytes) {
|
|
160
|
+
let deferred2_0;
|
|
161
|
+
let deferred2_1;
|
|
162
|
+
try {
|
|
163
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
164
|
+
wasm.pptx_export_text(retptr, addHeapObject(bytes));
|
|
165
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
166
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
167
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
168
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
169
|
+
var ptr1 = r0;
|
|
170
|
+
var len1 = r1;
|
|
171
|
+
if (r3) {
|
|
172
|
+
ptr1 = 0; len1 = 0;
|
|
173
|
+
throw takeObject(r2);
|
|
174
|
+
}
|
|
175
|
+
deferred2_0 = ptr1;
|
|
176
|
+
deferred2_1 = len1;
|
|
177
|
+
return getStringFromWasm0(ptr1, len1);
|
|
178
|
+
} finally {
|
|
179
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
180
|
+
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Байты картинки по её id.
|
|
186
|
+
*
|
|
187
|
+
* Возвращается `Uint8Array` — копия байтов из памяти wasm; буфер принадлежит
|
|
188
|
+
* интерфейсу, и дальше его можно отдать `postMessage` с transferables.
|
|
189
|
+
*
|
|
190
|
+
* # Errors
|
|
191
|
+
* Если презентация не открыта или картинки с таким id нет.
|
|
192
|
+
* @param {number} id
|
|
193
|
+
* @returns {Uint8Array}
|
|
194
|
+
*/
|
|
195
|
+
export function pptx_image_bytes(id) {
|
|
196
|
+
try {
|
|
197
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
198
|
+
wasm.pptx_image_bytes(retptr, id);
|
|
199
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
200
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
201
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
202
|
+
if (r2) {
|
|
203
|
+
throw takeObject(r1);
|
|
204
|
+
}
|
|
205
|
+
return takeObject(r0);
|
|
206
|
+
} finally {
|
|
207
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Картинки открытой презентации: id, MIME-тип и длина байтов.
|
|
213
|
+
*
|
|
214
|
+
* Байты в список не входят: их забирает [`pptx_image_bytes`] по одному id,
|
|
215
|
+
* чтобы не копировать разом всю media презентации. В списке только части, на
|
|
216
|
+
* которые ссылается хотя бы один `p:pic`: остальные разбор не читает.
|
|
217
|
+
*
|
|
218
|
+
* # Errors
|
|
219
|
+
* Если презентация не открыта.
|
|
220
|
+
* @returns {any}
|
|
221
|
+
*/
|
|
222
|
+
export function pptx_images() {
|
|
223
|
+
try {
|
|
224
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
225
|
+
wasm.pptx_images(retptr);
|
|
226
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
227
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
228
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
229
|
+
if (r2) {
|
|
230
|
+
throw takeObject(r1);
|
|
231
|
+
}
|
|
232
|
+
return takeObject(r0);
|
|
233
|
+
} finally {
|
|
234
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Открыта ли презентация. Нужно интерфейсу, чтобы не рисовать пустоту.
|
|
240
|
+
* @returns {boolean}
|
|
241
|
+
*/
|
|
242
|
+
export function pptx_is_open() {
|
|
243
|
+
const ret = wasm.pptx_is_open();
|
|
244
|
+
return ret !== 0;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Открыть презентацию из байтов: разобрать, разложить слайды, запомнить.
|
|
249
|
+
*
|
|
250
|
+
* Раскладка считается здесь и один раз: размер слайда задан презентацией, а
|
|
251
|
+
* не окном. Предыдущая презентация закрывается.
|
|
252
|
+
*
|
|
253
|
+
* # Errors
|
|
254
|
+
* Если байты не OOXML-пакет, `ppt/presentation.xml` не разбирается, в
|
|
255
|
+
* презентации нет слайдов или раскладка упирается в `Error`.
|
|
256
|
+
* @param {Uint8Array} bytes
|
|
257
|
+
* @returns {any}
|
|
258
|
+
*/
|
|
259
|
+
export function pptx_open(bytes) {
|
|
260
|
+
try {
|
|
261
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
262
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
|
|
263
|
+
const len0 = WASM_VECTOR_LEN;
|
|
264
|
+
wasm.pptx_open(retptr, ptr0, len0);
|
|
265
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
266
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
267
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
268
|
+
if (r2) {
|
|
269
|
+
throw takeObject(r1);
|
|
270
|
+
}
|
|
271
|
+
return takeObject(r0);
|
|
272
|
+
} finally {
|
|
273
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Открыть презентацию из байтов, отдав их без копирования.
|
|
279
|
+
*
|
|
280
|
+
* # Errors
|
|
281
|
+
* То же, что у [`pptx_open`].
|
|
282
|
+
* @param {Uint8Array} bytes
|
|
283
|
+
* @returns {any}
|
|
284
|
+
*/
|
|
285
|
+
export function pptx_open_bytes(bytes) {
|
|
286
|
+
try {
|
|
287
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
288
|
+
wasm.pptx_open_bytes(retptr, addHeapObject(bytes));
|
|
289
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
290
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
291
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
292
|
+
if (r2) {
|
|
293
|
+
throw takeObject(r1);
|
|
294
|
+
}
|
|
295
|
+
return takeObject(r0);
|
|
296
|
+
} finally {
|
|
297
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Взвести или снять флаг кооперативной отмены (ADR-0032).
|
|
303
|
+
*
|
|
304
|
+
* Раскладка проверяет его между слайдами. Флаг одноразовый: операция,
|
|
305
|
+
* которая его заметила, гасит его сама, — иначе отмена, пришедшая после
|
|
306
|
+
* операции, ждала бы следующую.
|
|
307
|
+
* @param {boolean} flag
|
|
308
|
+
*/
|
|
309
|
+
export function set_cancel(flag) {
|
|
310
|
+
wasm.set_cancel(flag);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Дописать чанк. Возвращает накопленный размер — прогресс для диагностики.
|
|
315
|
+
*
|
|
316
|
+
* # Errors
|
|
317
|
+
* Если поток с таким id не заведён.
|
|
318
|
+
* @param {number} id
|
|
319
|
+
* @param {Uint8Array} bytes
|
|
320
|
+
* @returns {bigint}
|
|
321
|
+
*/
|
|
322
|
+
export function stream_append(id, bytes) {
|
|
323
|
+
try {
|
|
324
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
325
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
|
|
326
|
+
const len0 = WASM_VECTOR_LEN;
|
|
327
|
+
wasm.stream_append(retptr, id, ptr0, len0);
|
|
328
|
+
var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
|
|
329
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
330
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
331
|
+
if (r3) {
|
|
332
|
+
throw takeObject(r2);
|
|
333
|
+
}
|
|
334
|
+
return BigInt.asUintN(64, r0);
|
|
335
|
+
} finally {
|
|
336
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Отменить поток: буфер освобождается, id больше не действителен.
|
|
342
|
+
* @param {number} id
|
|
343
|
+
*/
|
|
344
|
+
export function stream_free(id) {
|
|
345
|
+
wasm.stream_free(id);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Завести поток: id, под которым воркер будет слать чанки.
|
|
350
|
+
* @returns {number}
|
|
351
|
+
*/
|
|
352
|
+
export function stream_new() {
|
|
353
|
+
const ret = wasm.stream_new();
|
|
354
|
+
return ret >>> 0;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Завершить поток: разобрать накопленный буфер как презентацию (ADR-0031 §6).
|
|
359
|
+
*
|
|
360
|
+
* Буфер изымается из реестра — поток одноразовый, — презентация встаёт в
|
|
361
|
+
* `PRES`, как при `pptx_open`. Ответ — тот же список слайдов.
|
|
362
|
+
*
|
|
363
|
+
* # Errors
|
|
364
|
+
* Если поток неизвестен, буфер пуст (оборванный поток) или байты не
|
|
365
|
+
* OOXML-пакет.
|
|
366
|
+
* @param {number} id
|
|
367
|
+
* @returns {any}
|
|
368
|
+
*/
|
|
369
|
+
export function stream_open_pptx(id) {
|
|
370
|
+
try {
|
|
371
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
372
|
+
wasm.stream_open_pptx(retptr, id);
|
|
373
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
374
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
375
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
376
|
+
if (r2) {
|
|
377
|
+
throw takeObject(r1);
|
|
378
|
+
}
|
|
379
|
+
return takeObject(r0);
|
|
380
|
+
} finally {
|
|
381
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
function __wbg_get_imports() {
|
|
385
|
+
const import0 = {
|
|
386
|
+
__proto__: null,
|
|
387
|
+
__wbg_Error_30c8987f7c2ed4e2: function(arg0, arg1) {
|
|
388
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
389
|
+
return addHeapObject(ret);
|
|
390
|
+
},
|
|
391
|
+
__wbg_String_8564e559799eccda: function(arg0, arg1) {
|
|
392
|
+
const ret = String(getObject(arg1));
|
|
393
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
394
|
+
const len1 = WASM_VECTOR_LEN;
|
|
395
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
396
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
397
|
+
},
|
|
398
|
+
__wbg___wbindgen_boolean_get_5b446f51afd21013: function(arg0) {
|
|
399
|
+
const v = getObject(arg0);
|
|
400
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
401
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
402
|
+
},
|
|
403
|
+
__wbg___wbindgen_debug_string_4687d8d8c2017d52: function(arg0, arg1) {
|
|
404
|
+
const ret = debugString(getObject(arg1));
|
|
405
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
406
|
+
const len1 = WASM_VECTOR_LEN;
|
|
407
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
408
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
409
|
+
},
|
|
410
|
+
__wbg___wbindgen_in_92f62ee1427d9e49: function(arg0, arg1) {
|
|
411
|
+
const ret = getObject(arg0) in getObject(arg1);
|
|
412
|
+
return ret;
|
|
413
|
+
},
|
|
414
|
+
__wbg___wbindgen_is_object_3c45d4f2dde4e749: function(arg0) {
|
|
415
|
+
const val = getObject(arg0);
|
|
416
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
417
|
+
return ret;
|
|
418
|
+
},
|
|
419
|
+
__wbg___wbindgen_is_undefined_8865fb403f8fe9d8: function(arg0) {
|
|
420
|
+
const ret = getObject(arg0) === undefined;
|
|
421
|
+
return ret;
|
|
422
|
+
},
|
|
423
|
+
__wbg___wbindgen_jsval_loose_eq_677f21e468d6b461: function(arg0, arg1) {
|
|
424
|
+
const ret = getObject(arg0) == getObject(arg1);
|
|
425
|
+
return ret;
|
|
426
|
+
},
|
|
427
|
+
__wbg___wbindgen_number_get_2e0e7dee9f701a71: function(arg0, arg1) {
|
|
428
|
+
const obj = getObject(arg1);
|
|
429
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
430
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
431
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
432
|
+
},
|
|
433
|
+
__wbg___wbindgen_string_get_0380ccaa2f57f0d9: function(arg0, arg1) {
|
|
434
|
+
const obj = getObject(arg1);
|
|
435
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
436
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
437
|
+
var len1 = WASM_VECTOR_LEN;
|
|
438
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
439
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
440
|
+
},
|
|
441
|
+
__wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {
|
|
442
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
443
|
+
},
|
|
444
|
+
__wbg_byteLength_33579c70f2766cb9: function(arg0) {
|
|
445
|
+
const ret = getObject(arg0).byteLength;
|
|
446
|
+
return ret;
|
|
447
|
+
},
|
|
448
|
+
__wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
|
|
449
|
+
const ret = getObject(arg0)[getObject(arg1)];
|
|
450
|
+
return addHeapObject(ret);
|
|
451
|
+
},
|
|
452
|
+
__wbg_instanceof_ArrayBuffer_a99f175873e5d9b8: function(arg0) {
|
|
453
|
+
let result;
|
|
454
|
+
try {
|
|
455
|
+
result = getObject(arg0) instanceof ArrayBuffer;
|
|
456
|
+
} catch (_) {
|
|
457
|
+
result = false;
|
|
458
|
+
}
|
|
459
|
+
const ret = result;
|
|
460
|
+
return ret;
|
|
461
|
+
},
|
|
462
|
+
__wbg_instanceof_Uint8Array_828cef2aaacafc31: function(arg0) {
|
|
463
|
+
let result;
|
|
464
|
+
try {
|
|
465
|
+
result = getObject(arg0) instanceof Uint8Array;
|
|
466
|
+
} catch (_) {
|
|
467
|
+
result = false;
|
|
468
|
+
}
|
|
469
|
+
const ret = result;
|
|
470
|
+
return ret;
|
|
471
|
+
},
|
|
472
|
+
__wbg_length_7f3c00c40364105e: function(arg0) {
|
|
473
|
+
const ret = getObject(arg0).length;
|
|
474
|
+
return ret;
|
|
475
|
+
},
|
|
476
|
+
__wbg_load_07055e23cc1692bf: function() { return handleError(function (arg0, arg1) {
|
|
477
|
+
const ret = Atomics.load(getObject(arg0), arg1 >>> 0);
|
|
478
|
+
return ret;
|
|
479
|
+
}, arguments); },
|
|
480
|
+
__wbg_new_1dbf7428bba60a42: function(arg0) {
|
|
481
|
+
const ret = new Uint8Array(getObject(arg0));
|
|
482
|
+
return addHeapObject(ret);
|
|
483
|
+
},
|
|
484
|
+
__wbg_new_320e2e208176b20f: function(arg0) {
|
|
485
|
+
const ret = new Int32Array(getObject(arg0));
|
|
486
|
+
return addHeapObject(ret);
|
|
487
|
+
},
|
|
488
|
+
__wbg_new_617a8cdb8bb1130e: function() {
|
|
489
|
+
const ret = new Object();
|
|
490
|
+
return addHeapObject(ret);
|
|
491
|
+
},
|
|
492
|
+
__wbg_new_ee2291f50781bf1d: function() {
|
|
493
|
+
const ret = new Array();
|
|
494
|
+
return addHeapObject(ret);
|
|
495
|
+
},
|
|
496
|
+
__wbg_new_from_slice_9a868026ffa4208a: function(arg0, arg1) {
|
|
497
|
+
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
498
|
+
return addHeapObject(ret);
|
|
499
|
+
},
|
|
500
|
+
__wbg_new_with_byte_offset_and_length_2f5d7fc2a828b74d: function(arg0, arg1, arg2) {
|
|
501
|
+
const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
|
|
502
|
+
return addHeapObject(ret);
|
|
503
|
+
},
|
|
504
|
+
__wbg_now_aa4ccb83129e9e55: function() {
|
|
505
|
+
const ret = Date.now();
|
|
506
|
+
return ret;
|
|
507
|
+
},
|
|
508
|
+
__wbg_prototypesetcall_bc27214492979395: function(arg0, arg1, arg2) {
|
|
509
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
510
|
+
},
|
|
511
|
+
__wbg_set_575d3ddb70fe831d: function(arg0, arg1, arg2) {
|
|
512
|
+
getObject(arg0).set(getArrayU8FromWasm0(arg1, arg2));
|
|
513
|
+
},
|
|
514
|
+
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
515
|
+
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
516
|
+
},
|
|
517
|
+
__wbg_set_bea140a88be9b277: function(arg0, arg1, arg2) {
|
|
518
|
+
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
519
|
+
},
|
|
520
|
+
__wbg_store_37cdae4ca57cbc24: function() { return handleError(function (arg0, arg1, arg2) {
|
|
521
|
+
const ret = Atomics.store(getObject(arg0), arg1 >>> 0, arg2);
|
|
522
|
+
return ret;
|
|
523
|
+
}, arguments); },
|
|
524
|
+
__wbg_subarray_002b94d5e13d1411: function(arg0, arg1, arg2) {
|
|
525
|
+
const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
|
|
526
|
+
return addHeapObject(ret);
|
|
527
|
+
},
|
|
528
|
+
__wbindgen_generic_0000000000000001: function(arg0) {
|
|
529
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
530
|
+
const ret = arg0;
|
|
531
|
+
return addHeapObject(ret);
|
|
532
|
+
},
|
|
533
|
+
__wbindgen_generic_0000000000000002: function(arg0, arg1) {
|
|
534
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
535
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
536
|
+
return addHeapObject(ret);
|
|
537
|
+
},
|
|
538
|
+
__wbindgen_generic_0000000000000003: function(arg0) {
|
|
539
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
540
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
541
|
+
return addHeapObject(ret);
|
|
542
|
+
},
|
|
543
|
+
__wbindgen_object_clone_ref: function(arg0) {
|
|
544
|
+
const ret = getObject(arg0);
|
|
545
|
+
return addHeapObject(ret);
|
|
546
|
+
},
|
|
547
|
+
__wbindgen_object_drop_ref: function(arg0) {
|
|
548
|
+
takeObject(arg0);
|
|
549
|
+
},
|
|
550
|
+
};
|
|
551
|
+
return {
|
|
552
|
+
__proto__: null,
|
|
553
|
+
"./doc_converter_pptx_wasm_bg.js": import0,
|
|
554
|
+
};
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
function addHeapObject(obj) {
|
|
558
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
559
|
+
const idx = heap_next;
|
|
560
|
+
heap_next = heap[idx];
|
|
561
|
+
|
|
562
|
+
heap[idx] = obj;
|
|
563
|
+
return idx;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
function addBorrowedObject(obj) {
|
|
567
|
+
if (stack_pointer == 1) throw new Error('out of js stack');
|
|
568
|
+
heap[--stack_pointer] = obj;
|
|
569
|
+
return stack_pointer;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
function debugString(val) {
|
|
573
|
+
// primitive types
|
|
574
|
+
const type = typeof val;
|
|
575
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
576
|
+
return `${val}`;
|
|
577
|
+
}
|
|
578
|
+
if (type == 'string') {
|
|
579
|
+
return `"${val}"`;
|
|
580
|
+
}
|
|
581
|
+
if (type == 'symbol') {
|
|
582
|
+
const description = val.description;
|
|
583
|
+
if (description == null) {
|
|
584
|
+
return 'Symbol';
|
|
585
|
+
} else {
|
|
586
|
+
return `Symbol(${description})`;
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
if (type == 'function') {
|
|
590
|
+
const name = val.name;
|
|
591
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
592
|
+
return `Function(${name})`;
|
|
593
|
+
} else {
|
|
594
|
+
return 'Function';
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
// objects
|
|
598
|
+
if (Array.isArray(val)) {
|
|
599
|
+
const length = val.length;
|
|
600
|
+
let debug = '[';
|
|
601
|
+
if (length > 0) {
|
|
602
|
+
debug += debugString(val[0]);
|
|
603
|
+
}
|
|
604
|
+
for(let i = 1; i < length; i++) {
|
|
605
|
+
debug += ', ' + debugString(val[i]);
|
|
606
|
+
}
|
|
607
|
+
debug += ']';
|
|
608
|
+
return debug;
|
|
609
|
+
}
|
|
610
|
+
// Test for built-in
|
|
611
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
612
|
+
let className;
|
|
613
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
614
|
+
className = builtInMatches[1];
|
|
615
|
+
} else {
|
|
616
|
+
// Failed to match the standard '[object ClassName]'
|
|
617
|
+
return toString.call(val);
|
|
618
|
+
}
|
|
619
|
+
if (className == 'Object') {
|
|
620
|
+
// we're a user defined class or Object
|
|
621
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
622
|
+
// easier than looping through ownProperties of `val`.
|
|
623
|
+
try {
|
|
624
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
625
|
+
} catch (_) {
|
|
626
|
+
return 'Object';
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
// errors
|
|
630
|
+
if (val instanceof Error) {
|
|
631
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
632
|
+
}
|
|
633
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
634
|
+
return className;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
function dropObject(idx) {
|
|
638
|
+
if (idx < 1028) return;
|
|
639
|
+
heap[idx] = heap_next;
|
|
640
|
+
heap_next = idx;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
644
|
+
ptr = ptr >>> 0;
|
|
645
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
let cachedDataViewMemory0 = null;
|
|
649
|
+
function getDataViewMemory0() {
|
|
650
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
651
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
652
|
+
}
|
|
653
|
+
return cachedDataViewMemory0;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
function getStringFromWasm0(ptr, len) {
|
|
657
|
+
return decodeText(ptr >>> 0, len);
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
let cachedUint8ArrayMemory0 = null;
|
|
661
|
+
function getUint8ArrayMemory0() {
|
|
662
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
663
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
664
|
+
}
|
|
665
|
+
return cachedUint8ArrayMemory0;
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
function getObject(idx) { return heap[idx]; }
|
|
669
|
+
|
|
670
|
+
function handleError(f, args) {
|
|
671
|
+
try {
|
|
672
|
+
return f.apply(this, args);
|
|
673
|
+
} catch (e) {
|
|
674
|
+
wasm.__wbindgen_export3(addHeapObject(e));
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
let heap = new Array(1024).fill(undefined);
|
|
679
|
+
heap.push(undefined, null, true, false);
|
|
680
|
+
|
|
681
|
+
let heap_next = heap.length;
|
|
682
|
+
|
|
683
|
+
function isLikeNone(x) {
|
|
684
|
+
return x === undefined || x === null;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
688
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
689
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
690
|
+
WASM_VECTOR_LEN = arg.length;
|
|
691
|
+
return ptr;
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
695
|
+
if (realloc === undefined) {
|
|
696
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
697
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
698
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
699
|
+
WASM_VECTOR_LEN = buf.length;
|
|
700
|
+
return ptr;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
let len = arg.length;
|
|
704
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
705
|
+
|
|
706
|
+
const mem = getUint8ArrayMemory0();
|
|
707
|
+
|
|
708
|
+
let offset = 0;
|
|
709
|
+
|
|
710
|
+
for (; offset < len; offset++) {
|
|
711
|
+
const code = arg.charCodeAt(offset);
|
|
712
|
+
if (code > 0x7F) break;
|
|
713
|
+
mem[ptr + offset] = code;
|
|
714
|
+
}
|
|
715
|
+
if (offset !== len) {
|
|
716
|
+
if (offset !== 0) {
|
|
717
|
+
arg = arg.slice(offset);
|
|
718
|
+
}
|
|
719
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
720
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
721
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
722
|
+
|
|
723
|
+
offset += ret.written;
|
|
724
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
WASM_VECTOR_LEN = offset;
|
|
728
|
+
return ptr;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
let stack_pointer = 1024;
|
|
732
|
+
|
|
733
|
+
function takeObject(idx) {
|
|
734
|
+
const ret = getObject(idx);
|
|
735
|
+
dropObject(idx);
|
|
736
|
+
return ret;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
740
|
+
cachedTextDecoder.decode();
|
|
741
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
742
|
+
let numBytesDecoded = 0;
|
|
743
|
+
function decodeText(ptr, len) {
|
|
744
|
+
numBytesDecoded += len;
|
|
745
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
746
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
747
|
+
cachedTextDecoder.decode();
|
|
748
|
+
numBytesDecoded = len;
|
|
749
|
+
}
|
|
750
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
const cachedTextEncoder = new TextEncoder();
|
|
754
|
+
|
|
755
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
756
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
757
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
758
|
+
view.set(buf);
|
|
759
|
+
return {
|
|
760
|
+
read: arg.length,
|
|
761
|
+
written: buf.length
|
|
762
|
+
};
|
|
763
|
+
};
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
let WASM_VECTOR_LEN = 0;
|
|
767
|
+
|
|
768
|
+
let wasmModule, wasmInstance, wasm;
|
|
769
|
+
function __wbg_finalize_init(instance, module) {
|
|
770
|
+
wasmInstance = instance;
|
|
771
|
+
wasm = instance.exports;
|
|
772
|
+
wasmModule = module;
|
|
773
|
+
cachedDataViewMemory0 = null;
|
|
774
|
+
cachedUint8ArrayMemory0 = null;
|
|
775
|
+
return wasm;
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
async function __wbg_load(module, imports) {
|
|
779
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
780
|
+
if (!module.ok) {
|
|
781
|
+
throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
785
|
+
try {
|
|
786
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
787
|
+
} catch (e) {
|
|
788
|
+
const validResponse = expectedResponseType(module.type);
|
|
789
|
+
|
|
790
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
791
|
+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
792
|
+
|
|
793
|
+
} else { throw e; }
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
const bytes = await module.arrayBuffer();
|
|
798
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
799
|
+
} else {
|
|
800
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
801
|
+
|
|
802
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
803
|
+
return { instance, module };
|
|
804
|
+
} else {
|
|
805
|
+
return instance;
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
function expectedResponseType(type) {
|
|
810
|
+
switch (type) {
|
|
811
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
812
|
+
}
|
|
813
|
+
return false;
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
function initSync(module) {
|
|
818
|
+
if (wasm !== undefined) return wasm;
|
|
819
|
+
|
|
820
|
+
|
|
821
|
+
if (module !== undefined) {
|
|
822
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
823
|
+
({module} = module)
|
|
824
|
+
} else {
|
|
825
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
const imports = __wbg_get_imports();
|
|
830
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
831
|
+
module = new WebAssembly.Module(module);
|
|
832
|
+
}
|
|
833
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
834
|
+
return __wbg_finalize_init(instance, module);
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
async function __wbg_init(module_or_path) {
|
|
838
|
+
if (wasm !== undefined) return wasm;
|
|
839
|
+
|
|
840
|
+
|
|
841
|
+
if (module_or_path !== undefined) {
|
|
842
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
843
|
+
({module_or_path} = module_or_path)
|
|
844
|
+
} else {
|
|
845
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
if (module_or_path === undefined) {
|
|
850
|
+
module_or_path = new URL('doc_converter_pptx_wasm_bg.wasm', import.meta.url);
|
|
851
|
+
}
|
|
852
|
+
const imports = __wbg_get_imports();
|
|
853
|
+
|
|
854
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
855
|
+
module_or_path = fetch(module_or_path);
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
859
|
+
|
|
860
|
+
return __wbg_finalize_init(instance, module);
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
export { initSync, __wbg_init as default };
|
|
Binary file
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const pptx_build_display_list_into: (a: number, b: number, c: number, d: number) => void;
|
|
5
|
+
export const pptx_build_display_list_sab: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
6
|
+
export const pptx_close: () => void;
|
|
7
|
+
export const pptx_export_html: (a: number, b: number) => void;
|
|
8
|
+
export const pptx_export_markdown: (a: number, b: number) => void;
|
|
9
|
+
export const pptx_export_text: (a: number, b: number) => void;
|
|
10
|
+
export const pptx_image_bytes: (a: number, b: number) => void;
|
|
11
|
+
export const pptx_images: (a: number) => void;
|
|
12
|
+
export const pptx_is_open: () => number;
|
|
13
|
+
export const pptx_open: (a: number, b: number, c: number) => void;
|
|
14
|
+
export const pptx_open_bytes: (a: number, b: number) => void;
|
|
15
|
+
export const set_cancel: (a: number) => void;
|
|
16
|
+
export const stream_append: (a: number, b: number, c: number, d: number) => void;
|
|
17
|
+
export const stream_free: (a: number) => void;
|
|
18
|
+
export const stream_new: () => number;
|
|
19
|
+
export const stream_open_pptx: (a: number, b: number) => void;
|
|
20
|
+
export const __wbindgen_export: (a: number, b: number) => number;
|
|
21
|
+
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
22
|
+
export const __wbindgen_export3: (a: number) => void;
|
|
23
|
+
export const __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
24
|
+
export const __wbindgen_export4: (a: number, b: number, c: number) => void;
|
package/pkg/package.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "doc-converter-pptx-wasm",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "2.0.1",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"files": [
|
|
7
|
+
"doc_converter_pptx_wasm_bg.wasm",
|
|
8
|
+
"doc_converter_pptx_wasm.js",
|
|
9
|
+
"doc_converter_pptx_wasm.d.ts"
|
|
10
|
+
],
|
|
11
|
+
"main": "doc_converter_pptx_wasm.js",
|
|
12
|
+
"types": "doc_converter_pptx_wasm.d.ts",
|
|
13
|
+
"sideEffects": [
|
|
14
|
+
"./snippets/*"
|
|
15
|
+
]
|
|
16
|
+
}
|