@silurus/ooxml 0.83.2 → 0.84.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/README.md +23 -6
- package/dist/assets/render-worker-BWPpayBu.js +10 -0
- package/dist/assets/render-worker-CiEWCh_T.js +11 -0
- package/dist/assets/render-worker-Cpmy3GDF.js +24 -0
- package/dist/{canvas-viewer-mechanics-DVGK-fLT.js → canvas-viewer-mechanics-CIfhCgYA.js} +1 -1
- package/dist/chart-ex.mjs +4 -4
- package/dist/{comment-ui-runtime-DD5a3x3k.js → comment-ui-runtime-C5qimVMD.js} +5 -5
- package/dist/{comment-ui-runtime-BelHJt73.js → comment-ui-runtime-CdMMApEN.js} +5 -5
- package/dist/comment-ui-runtime-aPzHfV_A.js +2 -0
- package/dist/{comments-AAaNnQTi.js → comments-BAlAyIhb.js} +1 -1
- package/dist/{document-pull-client-DSx36ZsB.js → document-pull-client-BXw6AAhY.js} +2409 -2390
- package/dist/{docx-DojUJSZd.js → docx-BA1vB0V-.js} +16 -14
- package/dist/docx.mjs +5 -5
- package/dist/docx_parser_bg.wasm +0 -0
- package/dist/{dom-interaction-boundary-CepOlXt6.js → dom-interaction-boundary-DS6BVyHA.js} +1 -1
- package/dist/index.mjs +3 -3
- package/dist/{line-distribute-D7A_wnJg.js → line-distribute-MqInuujx.js} +2 -2
- package/dist/{line-metrics-Bpn7OeZD.js → line-metrics-CXyjyYd5.js} +34 -32
- package/dist/math.mjs +2 -2
- package/dist/node.mjs +9 -9
- package/dist/{plot-area-frame-DHV02PJU.js → plot-area-frame-DuXZzovH.js} +623 -663
- package/dist/{pptx-Wh22eziy.js → pptx-C17oBD8Z.js} +17 -15
- package/dist/pptx.mjs +5 -5
- package/dist/pptx_parser_bg.wasm +0 -0
- package/dist/region-map.mjs +2 -2
- package/dist/{render-DtbFbO5c.js → render-CVeGktZG.js} +1 -1
- package/dist/{render-worker-host-CmPBviYJ.js → render-worker-host-BWdhjVH_.js} +1 -1
- package/dist/{render-worker-host-DCLyw6UR.js → render-worker-host-BbhwA24Y.js} +1 -1
- package/dist/{render-worker-host-D1jcACJV.js → render-worker-host-CbaQivE7.js} +1 -1
- package/dist/{renderer-CYr9YTXM.js → renderer-Bmky2yBc.js} +3 -3
- package/dist/{renderer-module-contract-DLbb7zY0.js → renderer-module-contract-C6sYZvTV.js} +4 -3
- package/dist/{resource-measurement-DuiFWzam.js → resource-measurement-esyGbzAF.js} +2 -2
- package/dist/{session-CxT-t0BX.js → session-Cl0RVnMs.js} +3 -3
- package/dist/{slide-pull-client-B9rcJdO4.js → slide-pull-client-BS0EeZo2.js} +113 -107
- package/dist/{three-d-7MaVzQuZ.js → three-d-B7LsKeOS.js} +128 -127
- package/dist/three-d.mjs +4 -4
- package/dist/tiff-contract-Xjn3qXqK.js +69 -0
- package/dist/tiff.mjs +124 -0
- package/dist/types/chart-ex.d.ts +2 -2
- package/dist/types/docx.d.ts +17 -10
- package/dist/types/index.d.ts +26 -16
- package/dist/types/math.d.ts +1 -1
- package/dist/types/node.d.ts +5 -5
- package/dist/types/pptx.d.ts +18 -10
- package/dist/types/region-map.d.ts +2 -2
- package/dist/types/three-d.d.ts +2 -2
- package/dist/types/tiff.d.ts +9 -0
- package/dist/types/xlsx.d.ts +17 -10
- package/dist/{worksheet-pull-client-DyFsDF4A.js → worksheet-pull-client-B0zfEVau.js} +3 -3
- package/dist/{xlsx-C3beLfwZ.js → xlsx-FyKAiNo-.js} +54 -49
- package/dist/xlsx.mjs +5 -5
- package/dist/xlsx_parser_bg.wasm +0 -0
- package/package.json +7 -1
- package/dist/assets/render-worker-4GSYWsM3.js +0 -11
- package/dist/assets/render-worker-DwFpY197.js +0 -10
- package/dist/assets/render-worker-Dw_wQRIh.js +0 -24
- package/dist/comment-ui-runtime-DTGN3Vyy.js +0 -2
- /package/dist/{comment-occurrence-X54si2ob.js → comment-occurrence-C34fWs_F.js} +0 -0
- /package/dist/{highlight-rect-Hes0z_Mj.js → highlight-rect-MaCt0om0.js} +0 -0
- /package/dist/{mathjax-DwIrafQ6.js → mathjax-DPEX346v.js} +0 -0
- /package/dist/{read-only-comment-decoration-DcFevX_Q.js → read-only-comment-decoration-BYCXoSdC.js} +0 -0
- /package/dist/{read-only-comment-margin-DrUX-YrP.js → read-only-comment-margin-C7b3l0ro.js} +0 -0
- /package/dist/{source-key-BklvnEyQ.js → source-key-DORuuFb-.js} +0 -0
- /package/dist/{transfer-R6NjgBKD.js → transfer-vNOFQuvv.js} +0 -0
- /package/dist/{units-BzZ0gAxs.js → units-EJdC96r6.js} +0 -0
- /package/dist/{visible-index-BFE3PWiY.js → visible-index-DwJzuGmJ.js} +0 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { t as e } from "./chunk-DmhlhrBa.js";
|
|
2
|
-
import { B as t, Qt as n, R as r, Vt as i, W as a, Zt as o, a as s, et as c, ft as l, lt as u, z as d } from "./line-metrics-
|
|
3
|
-
import { C as f, E as p, S as m, T as h, _ as g, a as _, b as ee, c as v, d as y, f as te, g as ne, h as re, i as b, l as x, m as ie, n as ae, o as oe, p as se, r as ce, s as le, t as ue, u as de, v as fe, w as pe, x as me, y as he } from "./canvas-viewer-mechanics-
|
|
2
|
+
import { B as t, Qt as n, R as r, Vt as i, W as a, Zt as o, a as s, et as c, ft as l, lt as u, z as d } from "./line-metrics-CXyjyYd5.js";
|
|
3
|
+
import { C as f, E as p, S as m, T as h, _ as g, a as _, b as ee, c as v, d as y, f as te, g as ne, h as re, i as b, l as x, m as ie, n as ae, o as oe, p as se, r as ce, s as le, t as ue, u as de, v as fe, w as pe, x as me, y as he } from "./canvas-viewer-mechanics-CIfhCgYA.js";
|
|
4
4
|
import { a as ge, i as _e, t as ve } from "./bounded-raw-part-cache-C6ro6Ezf.js";
|
|
5
|
-
import { c as ye, i as be, l as xe, n as Se, o as S, r as Ce, s as we, t as Te } from "./dom-interaction-boundary-
|
|
6
|
-
import { A as Ee, C, D as w, E as De, O as T, S as Oe, T as E, _ as ke, a as Ae, b as je, c as Me, d as Ne, f as Pe, g as Fe, h as Ie, j as Le, k as Re, l as ze, m as Be, n as D, o as Ve, p as He, s as Ue, t as O, v as We, w as Ge, x as Ke, y as qe } from "./document-pull-client-
|
|
7
|
-
import {
|
|
8
|
-
import { a as k } from "./units-
|
|
9
|
-
import { n as Xe } from "./renderer-module-contract-
|
|
10
|
-
import { n as Ze, t as A } from "./highlight-rect-
|
|
11
|
-
import { o as j } from "./source-key-
|
|
12
|
-
import { i as Qe, n as M, r as $e, t as et } from "./comments-
|
|
5
|
+
import { c as ye, i as be, l as xe, n as Se, o as S, r as Ce, s as we, t as Te } from "./dom-interaction-boundary-DS6BVyHA.js";
|
|
6
|
+
import { A as Ee, C, D as w, E as De, O as T, S as Oe, T as E, _ as ke, a as Ae, b as je, c as Me, d as Ne, f as Pe, g as Fe, h as Ie, j as Le, k as Re, l as ze, m as Be, n as D, o as Ve, p as He, s as Ue, t as O, v as We, w as Ge, x as Ke, y as qe } from "./document-pull-client-BXw6AAhY.js";
|
|
7
|
+
import { o as Je, s as Ye } from "./tiff-contract-Xjn3qXqK.js";
|
|
8
|
+
import { a as k } from "./units-EJdC96r6.js";
|
|
9
|
+
import { n as Xe } from "./renderer-module-contract-C6sYZvTV.js";
|
|
10
|
+
import { n as Ze, t as A } from "./highlight-rect-MaCt0om0.js";
|
|
11
|
+
import { o as j } from "./source-key-DORuuFb-.js";
|
|
12
|
+
import { i as Qe, n as M, r as $e, t as et } from "./comments-BAlAyIhb.js";
|
|
13
13
|
//#region packages/docx/src/worker.ts?worker&inline
|
|
14
14
|
var tt = "var e=(e,t)=>()=>(e&&(t=e(e=0)),t),t=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,r.unregister(this),e}free(){let e=this.__destroy_into_raw();_.__wbg_docxarchive_free(e,0)}acknowledge_document_chunk(e,t,n){let r=_.docxarchive_acknowledge_document_chunk(this.__wbg_ptr,e,t,n);if(r[1])throw f(r[0])}assert_healthy(){let e=_.docxarchive_assert_healthy(this.__wbg_ptr);if(e[1])throw f(e[0])}cancel_document_cursor(){_.docxarchive_cancel_document_cursor(this.__wbg_ptr)}close_document_session(){_.docxarchive_close_document_session(this.__wbg_ptr)}document_chunk_done(){let e=_.docxarchive_document_chunk_done(this.__wbg_ptr);if(e[2])throw f(e[1]);return e[0]!==0}document_cursor_resource_usage(){let e=_.docxarchive_document_cursor_resource_usage(this.__wbg_ptr);if(e[3])throw f(e[2]);var t=i(e[0],e[1]).slice();return _.__wbindgen_free(e[0],e[1]*1,1),t}extract_image(e){let t=d(e,_.__wbindgen_malloc,_.__wbindgen_realloc),n=g,r=_.docxarchive_extract_image(this.__wbg_ptr,t,n);if(r[3])throw f(r[2]);var a=i(r[0],r[1]).slice();return _.__wbindgen_free(r[0],r[1]*1,1),a}constructor(e,t,n,i){let a=ee(e,_.__wbindgen_malloc),o=g,s=_.docxarchive_new(a,o,!u(t),u(t)?BigInt(0):t,!u(n),u(n)?BigInt(0):n,!u(i),u(i)?BigInt(0):i);if(s[2])throw f(s[1]);return this.__wbg_ptr=s[0]>>>0,r.register(this,this.__wbg_ptr,this),this}open_document_cursor(e,t){let n=_.docxarchive_open_document_cursor(this.__wbg_ptr,e,t);if(n[1])throw f(n[0])}parse(){let e=_.docxarchive_parse(this.__wbg_ptr);if(e[3])throw f(e[2]);var t=i(e[0],e[1]).slice();return _.__wbindgen_free(e[0],e[1]*1,1),t}pull_document_chunk(e,t,n,r){let a=_.docxarchive_pull_document_chunk(this.__wbg_ptr,e,t,n,r);if(a[3])throw f(a[2]);var o=i(a[0],a[1]).slice();return _.__wbindgen_free(a[0],a[1]*1,1),o}resource_usage(){let e=_.docxarchive_resource_usage(this.__wbg_ptr);if(e[3])throw f(e[2]);var t=i(e[0],e[1]).slice();return _.__wbindgen_free(e[0],e[1]*1,1),t}to_markdown(){let e,t;try{let i=_.docxarchive_to_markdown(this.__wbg_ptr);var n=i[0],r=i[1];if(i[3])throw n=0,r=0,f(i[2]);return e=n,t=r,s(n,r)}finally{_.__wbindgen_free(e,t,1)}}};Symbol.dispose&&(t.prototype[Symbol.dispose]=t.prototype.free);function n(){return{__proto__:null,\"./docx_parser_bg.js\":{__proto__:null,__wbg___wbindgen_throw_6b64449b9b9ed33c:function(e,t){throw Error(s(e,t))},__wbg_error_a6fa202b58aa1cd3:function(e,t){let n,r;try{n=e,r=t,console.error(s(e,t))}finally{_.__wbindgen_free(n,r,1)}},__wbg_new_227d7c05414eb861:function(){return Error()},__wbg_stack_3b0d974bbf31e44f:function(e,t){let n=t.stack,r=d(n,_.__wbindgen_malloc,_.__wbindgen_realloc),i=g;o().setInt32(e+4,i,!0),o().setInt32(e+0,r,!0)},__wbindgen_cast_0000000000000001:function(e,t){return s(e,t)},__wbindgen_init_externref_table:function(){let e=_.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}const r=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>_.__wbg_docxarchive_free(e>>>0,1));function i(e,t){return e>>>=0,l().subarray(e/1,e/1+t)}let a=null;function o(){return(a===null||a.buffer.detached===!0||a.buffer.detached===void 0&&a.buffer!==_.memory.buffer)&&(a=new DataView(_.memory.buffer)),a}function s(e,t){return e>>>=0,te(e,t)}let c=null;function l(){return(c===null||c.byteLength===0)&&(c=new Uint8Array(_.memory.buffer)),c}function u(e){return e==null}function ee(e,t){let n=t(e.length*1,1)>>>0;return l().set(e,n/1),g=e.length,n}function d(e,t,n){if(n===void 0){let n=h.encode(e),r=t(n.length,1)>>>0;return l().subarray(r,r+n.length).set(n),g=n.length,r}let r=e.length,i=t(r,1)>>>0,a=l(),o=0;for(;o<r;o++){let t=e.charCodeAt(o);if(t>127)break;a[i+o]=t}if(o!==r){o!==0&&(e=e.slice(o)),i=n(i,r,r=o+e.length*3,1)>>>0;let t=l().subarray(i+o,i+r),a=h.encodeInto(e,t);o+=a.written,i=n(i,r,o,1)>>>0}return g=o,i}function f(e){let t=_.__wbindgen_externrefs.get(e);return _.__externref_table_dealloc(e),t}let p=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0});p.decode();let m=0;function te(e,t){return m+=t,m>=2146435072&&(p=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}),p.decode(),m=t),p.decode(l().subarray(e,e+t))}const h=new TextEncoder;`encodeInto`in h||(h.encodeInto=function(e,t){let n=h.encode(e);return t.set(n),{read:e.length,written:n.length}});let g=0,_;function v(e,t){return _=e.exports,a=null,c=null,_.__wbindgen_start(),_}async function y(e,t){if(typeof Response==`function`&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming==`function`)try{return await WebAssembly.instantiateStreaming(e,t)}catch(t){if(e.ok&&n(e.type)&&e.headers.get(`Content-Type`)!==`application/wasm`)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\",t);else throw t}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}function n(e){switch(e){case`basic`:case`cors`:case`default`:return!0}return!1}}async function b(e){if(_!==void 0)return _;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn(`using deprecated parameters for the initialization function; pass a single object instead`));let t=n();(typeof e==`string`||typeof Request==`function`&&e instanceof Request||typeof URL==`function`&&e instanceof URL)&&(e=fetch(e));let{instance:r,module:i}=await y(await e,t);return v(r,i)}async function ne(e){return _=void 0,a=null,c=null,b(e)}var x=class e extends Error{code;constructor(t,n){super(n),this.name=`OoxmlError`,this.code=t,Object.setPrototypeOf(this,e.prototype)}},S=class e extends Error{code=`ooxml-resource-limit`;details;constructor(t,n){super(t),this.name=`OoxmlResourceLimitError`;let r=n.violation,i=Object.freeze({format:r.format,operation:r.operation,resource:r.resource,metric:r.metric,...r.part===void 0?{}:{part:r.part},limit:r.limit,observed:r.observed,configurable:r.configurable,usage:Object.freeze({archiveEntryCount:r.usage.archiveEntryCount,declaredInflatedBytes:r.usage.declaredInflatedBytes,...r.usage.largestInflatedEntryBytes===void 0?{}:{largestInflatedEntryBytes:r.usage.largestInflatedEntryBytes},distinctInflatedBytes:r.usage.distinctInflatedBytes,operationInflatedBytes:r.usage.operationInflatedBytes})});this.details=Object.freeze({stage:n.stage,violation:i}),Object.setPrototypeOf(this,e.prototype)}},C,w,re=e((()=>{C=1<<25,C*4,w=class e extends RangeError{code=`ooxml-decoded-image-limit`;constructor(t,n,r){super(`OOXML decoded image limit exceeded: ${t} ${r} > ${n}`),this.metric=t,this.limit=n,this.observed=r,this.name=`OoxmlDecodedImageLimitError`,Object.setPrototypeOf(this,e.prototype)}}}));function ie(e){if(!e.startsWith(`data:`))return null;let t=e.indexOf(`,`);if(t===-1)return null;let n=atob(e.slice(t+1)),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return r.buffer}var ae=class{state=`uninitialized`;generationValue=0;readiness;poisonListeners=new Set;constructor(e,t,n){this.initialize=e,this.reinitialize=t,this.normalizeFailure=n}get generation(){return this.generationValue}get poisoned(){return this.state===`poisoned`}onPoison(e){return this.poisonListeners.add(e),()=>this.poisonListeners.delete(e)}async ensureReady(){if(this.state!==`ready`){if(!this.readiness){let e=this.state===`uninitialized`?this.initialize:this.reinitialize;this.readiness=Promise.resolve().then(e).then(()=>{this.generationValue+=1,this.state=`ready`,this.readiness=void 0},e=>{throw this.readiness=void 0,e})}await this.readiness}}run(e){try{return e()}catch(e){let t=this.normalizeFailure(e);throw t?(this.poison(t),t):e}}tryRunReady(e){if(this.state!==`ready`)return{current:!1};let t=this.generationValue,n=this.run(e);return this.state!==`ready`||t!==this.generationValue?{current:!1}:{current:!0,generation:t,value:n}}poison(e){this.state=`poisoned`,this.readiness=void 0;for(let t of this.poisonListeners)t(e)}assertCurrent(e){if(this.state!==`ready`||e!==this.generationValue)throw Error(`WASM archive session belongs to a discarded runtime generation`)}},T=class e extends Error{code=`parser-crashed`;constructor(t){super(t),this.name=`WasmTrapError`,Object.setPrototypeOf(this,e.prototype)}};function E(e){let t=globalThis.WebAssembly?.RuntimeError;return t&&e instanceof t||e instanceof RangeError?!0:e instanceof Error?e.name===`RuntimeError`||e.name===`CompileError`||e.name===`LinkError`||e.name===`InternalError`||e.name===`OOMError`:!1}function oe(e){try{if((typeof e!=`object`||!e)&&typeof e!=`function`)return;let t=Reflect.get(e,`__destroy_into_raw`);typeof t==`function`&&Reflect.apply(t,e,[])}catch{}}function se(e,t){return e({module_or_path:t})}var ce=class{runtime;wasmInput=null;currentArchive=null;constructor(e,t={}){this.init=e,this.options=t,this.runtime=new ae(()=>this.invokeConfigured(this.init),()=>this.invokeConfigured(this.options.reinit??this.init),le),this.runtime.onPoison(()=>this.dropPoisonedArchive())}setWasmInput(e){this.wasmInput=e,this.runtime.ensureReady().catch(()=>void 0)}setWasmUrl(e){this.setWasmInput(e)}get archive(){return this.currentArchive}setArchive(e){this.freeArchive(),this.currentArchive=e}disposeArchive(){this.freeArchive()}get poisoned(){return this.runtime.poisoned}async ensureReady(){await this.runtime.ensureReady()}run(e){return this.runtime.run(e)}poison(){this.runtime.poison(new T(`WASM parser was recycled`))}invokeConfigured(e){return this.wasmInput===null?Promise.reject(Error(`WasmParserHost: setWasmInput was never called`)):se(e,this.wasmInput)}freeArchive(){this.currentArchive!==null&&this.options.freeArchive&&this.options.freeArchive(this.currentArchive),this.currentArchive=null}dropPoisonedArchive(){let e=this.currentArchive;this.currentArchive=null,oe(e)}};function le(e){return E(e)?new T(`WASM parser trapped and was recycled: ${e instanceof Error?e.message:String(e)}`):null}function D(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>0}function O(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return D(t.requiredBytes)&&D(t.offeredBytes)&&t.requiredBytes>t.offeredBytes}var k=class e extends RangeError{code=`ooxml-insufficient-credit`;requiredBytes;offeredBytes;constructor(t){super(`Pull unit requires ${t.requiredBytes} bytes but credit is ${t.offeredBytes}`),this.name=`PullSessionInsufficientCreditError`,this.requiredBytes=t.requiredBytes,this.offeredBytes=t.offeredBytes,Object.setPrototypeOf(this,e.prototype)}};function A(e){if(e instanceof k)return e;let t=e instanceof Error?e.message:String(e);if(!t.startsWith(`OOXML_INSUFFICIENT_CREDIT:`))return;let n;try{n=JSON.parse(t.slice(26))}catch{return}if(!n||typeof n!=`object`||Array.isArray(n))return;let r=n;if(!(r.code!==`ooxml-insufficient-credit`||!O(r)))return new k(r)}function ue(e,t,n){let r=A(e);if(!(!r||r.offeredBytes!==t||r.requiredBytes>n))return r}re();const j=`OOXML_RESOURCE_LIMIT:`;function M(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function N(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return M(t.archiveEntryCount)&&M(t.declaredInflatedBytes)&&(t.largestInflatedEntryBytes===void 0||M(t.largestInflatedEntryBytes))&&M(t.distinctInflatedBytes)&&M(t.operationInflatedBytes)}function P(e){let t;try{t=JSON.parse(new TextDecoder().decode(e))}catch{throw TypeError(`OOXML resource usage checkpoint is not valid JSON`)}if(!N(t))throw TypeError(`OOXML resource usage checkpoint is invalid`);return t}function F(e){return e===`docx`||e===`xlsx`||e===`pptx`}function I(e){return e===`container`||e===`decompression`||e===`parsing`||e===`serialization`||e===`layout`||e===`rendering`||e===`worker`}function L(e,t){return typeof e==`string`&&e.length>0&&e.length<=t&&!/[\\u0000-\\u001f\\u007f]/u.test(e)}function R(e){return L(e,128)&&/^[a-z0-9][a-z0-9-]*$/u.test(e)}function z(e){return!L(e,4096)||e.startsWith(`/`)||e.startsWith(`\\\\`)||e.includes(`\\\\`)||e.includes(`?`)||e.includes(`#`)||e.includes(`://`)||/^[a-z]:/iu.test(e)?!1:e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`)}const B=new Map([[`archive-entry:declared-inflated-bytes`,{stage:`container`,part:`required`}],[`archive-entry:actual-inflated-bytes`,{stage:`decompression`,part:`required`}],[`archive:entry-count`,{stage:`container`,part:`forbidden`}],[`archive:central-directory-bytes`,{stage:`container`,part:`forbidden`,configurable:!1}],[`archive:distinct-inflated-bytes`,{stage:`decompression`,part:`required`}],[`xml-event:bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`xml-context:bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`xml-tree:depth`,{stage:`parsing`,part:`optional`,configurable:!1}],[`worksheet-row:projected-bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`worksheet-shell:projected-bytes`,{stage:`parsing`,part:`optional`,configurable:!1}]]),V=new Set([...B.keys()].map(e=>e.slice(0,e.indexOf(`:`)))),H=new Set([...B.keys()].map(e=>e.slice(e.indexOf(`:`)+1)));function de(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return!F(t.format)||!L(t.operation,256)||!R(t.resource)||!R(t.metric)||!M(t.limit)||!M(t.observed)||typeof t.configurable!=`boolean`||!N(t.usage)?!1:!(`part`in t)||z(t.part)}function U(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;if(!I(t.stage)||!de(t.violation))return!1;let n=t.violation,r=B.get(`${n.resource}:${n.metric}`);return r?t.stage!==r.stage||r.configurable===!1&&n.configurable!==!1?!1:r.part===`required`?n.part!==void 0:r.part===`forbidden`?n.part===void 0:!0:!(V.has(n.resource)&&H.has(n.metric))}function fe(e){return{archiveEntryCount:e.archiveEntryCount,declaredInflatedBytes:e.declaredInflatedBytes,...e.largestInflatedEntryBytes===void 0?{}:{largestInflatedEntryBytes:e.largestInflatedEntryBytes},distinctInflatedBytes:e.distinctInflatedBytes,operationInflatedBytes:e.operationInflatedBytes}}function pe(e){if(!U(e))return;let t=e.violation,n={stage:e.stage,violation:{format:t.format,operation:t.operation,resource:t.resource,metric:t.metric,...t.part===void 0?{}:{part:t.part},limit:t.limit,observed:t.observed,configurable:t.configurable,usage:fe(t.usage)}};return U(n)?n:void 0}function W(e){let t=e.violation;return`OOXML resource limit exceeded${t.part?` for ${t.part}`:``}: ${t.metric} ${t.observed} > ${t.limit}`}function me(e){let t=e instanceof Error?e.message:String(e);if(!t.startsWith(j))return;let n;try{n=JSON.parse(t.slice(21))}catch{return}if(!n||typeof n!=`object`)return;let r=n;if(!(r.code!==`ooxml-resource-limit`||!U(r.details)))return new S(W(r.details),r.details)}function he(e){if(e instanceof w)return{message:e.message,errorName:e.name,code:e.code,decodedImage:{metric:e.metric,limit:e.limit,observed:e.observed}};let t=A(e);if(t)return{message:t.message,errorName:t.name,code:t.code,insufficientCredit:{requiredBytes:t.requiredBytes,offeredBytes:t.offeredBytes}};let n=e instanceof x||e instanceof S?e:me(e);if(n instanceof S){let e=pe(n.details);return e?{message:typeof n.message==`string`?n.message:W(e),errorName:`OoxmlResourceLimitError`,code:`ooxml-resource-limit`,resourceLimit:e}:{message:`Invalid OOXML resource-limit error payload`,errorName:`Error`}}if(n instanceof x)return{message:typeof n.message==`string`?n.message:String(n.message),errorName:L(n.name,128)?n.name:`OoxmlError`,...R(n.code)?{code:n.code}:{}};let r=e instanceof Error?e.message:String(e);if(typeof r==`string`&&r.startsWith(j))return{message:`Invalid OOXML resource-limit payload`,errorName:`Error`};let i=e instanceof Error?e:Error(r),a=i;return{message:typeof i.message==`string`?i.message:String(i.message),errorName:L(i.name,128)?i.name:`Error`,...typeof a.code==`string`?{code:a.code}:{}}}function G(e){try{return he(e)}catch{return{message:`Worker operation failed with an unreadable error`,errorName:`Error`}}}function ge(e){return e.byteOffset===0&&e.byteLength===e.buffer.byteLength&&e.buffer instanceof ArrayBuffer?e.buffer:e.slice().buffer}Object.freeze({maxArchiveEntryBytes:134217728,maxTotalInflatedBytes:268435456,maxArchiveEntries:4096});function _e(e){return[e.maxArchiveEntryBytes===null?0n:BigInt(e.maxArchiveEntryBytes),e.maxTotalInflatedBytes===null?0n:BigInt(e.maxTotalInflatedBytes),e.maxArchiveEntries===null?0n:BigInt(e.maxArchiveEntries)]}const K=`ooxml-pull-v1`;function q(e,t){if(!Number.isSafeInteger(e)||e<=0)throw RangeError(`${t} must be a positive safe integer`)}function ve(e){if(!(typeof e==`string`&&e.length>0||typeof e==`number`&&Number.isSafeInteger(e)&&e>0))throw RangeError(`session id must be a non-empty string or positive safe integer`)}var J=class{owner;queue=Promise.resolve();leases=new Map;retainedBytes=0;retainedCount=0;maxRetainedBytes;maxRetainedCount;cleanups=new Set;pendingFatalCleanups=[];poisonRunning=!1;fatal;constructor(e){this.maxRetainedBytes=e?.maxRetainedBytes??64*1024*1024,this.maxRetainedCount=e?.maxRetainedCount??256,q(this.maxRetainedBytes,`max retained lease bytes`),q(this.maxRetainedCount,`max retained lease count`)}enqueue(e){let t=this.queue.then(e,e);return this.queue=t.then(()=>void 0,()=>void 0),t}acquire(e){return this.owner===void 0?(this.owner=e,!0):this.owner===e}release(e){this.owner===e&&(this.owner=void 0)}retainLease(e,t,n){if(!Number.isSafeInteger(n)||n<0)throw RangeError(`retained lease bytes are invalid`);let r=this.leases.get(e)??new Map;if(r.has(t))throw Error(`driver returned a duplicate lease id`);if(this.retainedCount+1>this.maxRetainedCount)throw RangeError(`retained lease count exceeds limit`);if(this.retainedBytes+n>this.maxRetainedBytes)throw RangeError(`retained lease bytes exceed limit`);r.set(t,n),this.leases.set(e,r),this.retainedCount++,this.retainedBytes+=n}releaseLease(e,t){let n=this.leases.get(e),r=n?.get(t);r!==void 0&&(n?.delete(t),n?.size===0&&this.leases.delete(e),this.retainedCount--,this.retainedBytes-=r)}registerCleanup(e){return this.fatal?(this.poisonRunning?this.pendingFatalCleanups.push(e):this.enqueue(e).catch(()=>void 0),()=>void 0):(this.cleanups.add(e),()=>this.cleanups.delete(e))}get fatalError(){return this.fatal}get registeredHostCount(){return this.cleanups.size}async poison(e){if(this.fatal??=e,this.poisonRunning)return this.fatal;this.poisonRunning=!0,this.pendingFatalCleanups.push(...this.cleanups);try{let e;for(;(e=this.pendingFatalCleanups.shift())!==void 0;)await e().catch(()=>void 0)}finally{this.poisonRunning=!1}return this.fatal}},ye=class{options;coordinator;coordinatorOwner=Symbol(`pull-session-host`);unregisterCleanup;sequence=0;unacked;leases=new Map;activeDriverLeases=new Set;nextWireLeaseId;cancelRequested=!1;cancelComplete=!1;closeRequested=!1;closeComplete=!1;driverCancelComplete=!1;driverCloseComplete=!1;completed=!1;constructor(e){ve(e.sessionId),q(e.operationId,`operation id`),q(e.generation,`generation`),q(e.maxByteCredit,`max byte credit`),e.wireLeaseIdStart!==void 0&&q(e.wireLeaseIdStart,`wire lease id start`),this.options=e,this.coordinator=e.coordinator,this.nextWireLeaseId=e.wireLeaseIdStart??1,this.unregisterCleanup=this.coordinator.registerCleanup(()=>this.forceFatalCleanup())}dispatch(e,t){return this.coordinator.enqueue(async()=>{let n=await this.execute(e);try{t(n.response,n.transfer)}catch(e){throw await this.rollbackFailedPost(n),e}})}async rollbackFailedPost(e){let t=e.response;if(t.kind===`chunk`){let n=t.leaseId===void 0?void 0:this.leases.get(t.leaseId);try{await this.options.driver.disposeInvalidChunk?.({payload:t.payload,byteLength:t.byteLength,done:t.done,leaseId:n?.driverLeaseId,retainedBytes:n?.retainedBytes,transfer:e.transfer})}catch{}}this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);for(let[e,t]of[...this.leases])try{await this.options.driver.releaseLease?.(t.driverLeaseId)}catch{}finally{this.leases.delete(e),this.activeDriverLeases.delete(t.driverLeaseId),this.coordinator.releaseLease(this.coordinatorOwner,e)}if(this.cancelRequested=!0,!this.driverCancelComplete)try{await this.options.driver.cancel?.(),this.driverCancelComplete=!0}catch{}this.unregisterCleanup()}async execute(e){try{if(this.isStaleLifecycle(e)){let t=e.kind===`cancel`?`cancel`:`close`;return this.sameOperationIdentity(e)?{response:this.accepted(e,t,!0)}:{response:this.errorResponse(e,{message:`stale lifecycle targets another session or operation`,errorName:`PullSessionProtocolError`,code:`ooxml-stale-lifecycle`})}}this.validateCommandIdentity(e);let t=this.coordinator.fatalError;if(t)return e.kind===`pull`?{response:this.errorResponse(e,t)}:(e.kind===`cancel`?await this.cancel():e.kind===`close`?await this.close():e.kind===`release`&&await this.release(e.leaseId),{response:this.accepted(e,e.kind)});switch(e.kind){case`pull`:return await this.pull(e);case`ack`:return await this.ack(e.sequence),{response:this.accepted(e,`ack`)};case`release`:return await this.release(e.leaseId),{response:this.accepted(e,`release`)};case`cancel`:return await this.cancel(),{response:this.accepted(e,`cancel`)};case`close`:return await this.close(),{response:this.accepted(e,`close`)}}}catch(t){let n=G(t);return n.code===`ooxml-resource-limit`&&(n=await this.coordinator.poison(n)),{response:this.errorResponse(e,n)}}}async pull(e){if(this.closeRequested||this.cancelRequested||this.completed)throw Error(`pull session is closed`);if(this.unacked)throw Error(`previous chunk is not acknowledged`);if(!Number.isSafeInteger(e.sequence)||e.sequence<0||e.sequence!==this.sequence)throw Error(`pull command sequence mismatch`);if(this.validateHostCredit(e.byteCredit),!this.coordinator.acquire(this.coordinatorOwner))throw Error(`another operation has an unacknowledged package chunk`);let t;try{t=await this.options.driver.pull(e.byteCredit)}catch(e){throw this.coordinator.release(this.coordinatorOwner),e}let n=!1,r=!1,i,a;try{let o=this.options.driver.measureChunk(t),s=this.arrayBufferTransferBytes(t.transfer);if(o<s)throw RangeError(`measured chunk bytes are below ArrayBuffer transfer bytes`);if(a=Math.max(o,s),t.leaseId!==void 0){if(q(t.leaseId,`lease id`),t.retainedBytes===void 0)throw Error(`retained lease bytes are required`);if(this.activeDriverLeases.has(t.leaseId))throw r=!0,Error(`driver returned an active duplicate lease id`);i=this.allocateWireLeaseId(),this.coordinator.retainLease(this.coordinatorOwner,i,t.retainedBytes),this.leases.set(i,{driverLeaseId:t.leaseId,retainedBytes:t.retainedBytes}),this.activeDriverLeases.add(t.leaseId),n=!0}else if(t.retainedBytes!==void 0)throw Error(`retained lease bytes require a lease id`);if(!Number.isSafeInteger(a)||a<0)throw RangeError(`host chunk byte length must be a non-negative safe integer`);if(a>e.byteCredit)throw RangeError(`host chunk exceeds byte credit`)}catch(e){let a;try{await this.options.driver.disposeInvalidChunk?.(t)}catch(e){a=e}if(n&&i!==void 0)try{await this.release(i)}catch(e){a??=e}else if(t.leaseId!==void 0&&!r)try{await this.options.driver.releaseLease?.(t.leaseId)}catch(e){a??=e}if(r)try{await this.cancel()}catch(e){a??=e}throw this.coordinator.release(this.coordinatorOwner),a||e}return this.unacked={sequence:this.sequence,done:t.done},{response:{kind:`chunk`,protocol:K,...this.identity(),requestId:e.requestId,sequence:this.sequence,byteLength:a,done:t.done,payload:t.payload,leaseId:i,usage:this.resourceUsage()},transfer:t.transfer}}async ack(e){if(!Number.isSafeInteger(e)||e<0)throw RangeError(`invalid ack sequence`);if(e<this.sequence)return;if(!this.unacked||e!==this.sequence)throw Error(`ack sequence mismatch`);let t=this.unacked.done;await this.options.driver.acknowledge?.(e),this.unacked=void 0,this.coordinator.release(this.coordinatorOwner),this.sequence++,t&&(this.completed=!0,this.maybeUnregisterCompleted())}async release(e){q(e,`wire lease id`);let t=this.leases.get(e);t&&(await this.options.driver.releaseLease?.(t.driverLeaseId),this.leases.delete(e),this.activeDriverLeases.delete(t.driverLeaseId),this.coordinator.releaseLease(this.coordinatorOwner,e),this.maybeUnregisterCompleted())}async cancel(){if(this.cancelComplete)return;this.cancelRequested=!0,this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);let e;try{await this.releaseAllLeases()}catch(t){e=t}if(!this.driverCancelComplete)try{await this.options.driver.cancel?.(),this.driverCancelComplete=!0}catch(t){e??=t}if(e)throw e;this.cancelComplete=!0,this.unregisterCleanup()}async close(){if(this.closeComplete)return;this.closeRequested=!0,this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);let e;try{await this.releaseAllLeases()}catch(t){e=t}if(!this.driverCloseComplete)try{await this.options.driver.close?.(),this.driverCloseComplete=!0}catch(t){e??=t}if(e)throw e;this.closeComplete=!0,this.unregisterCleanup()}async releaseAllLeases(){let e;for(let t of[...this.leases.keys()])try{await this.release(t)}catch(t){e??=t}if(e)throw e}validateCommandIdentity(e){if(e.protocol!==`ooxml-pull-v1`||e.sessionId!==this.options.sessionId||e.operationId!==this.options.operationId||e.generation!==this.options.generation||!Number.isSafeInteger(e.requestId)||e.requestId<=0)throw Error(`stale or mismatched pull session command`)}validateHostCredit(e){if(q(e,`byte credit`),e>this.options.maxByteCredit)throw RangeError(`byte credit exceeds host maximum`)}accepted(e,t,n=!1){return{kind:`accepted`,protocol:K,...n?{sessionId:e.sessionId,operationId:e.operationId,generation:e.generation}:this.identity(),requestId:e.requestId,command:t,usage:this.resourceUsage()}}identity(){return{sessionId:this.options.sessionId,operationId:this.options.operationId,generation:this.options.generation}}isStaleLifecycle(e){return(e.kind===`cancel`||e.kind===`close`)&&e.protocol===`ooxml-pull-v1`&&Number.isSafeInteger(e.requestId)&&e.requestId>0&&Number.isSafeInteger(e.generation)&&e.generation>0&&e.generation<this.options.generation}sameOperationIdentity(e){return e.sessionId===this.options.sessionId&&e.operationId===this.options.operationId}errorResponse(e,t){return{kind:`error`,protocol:K,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,error:t,usage:this.errorResourceUsage()}}async forceFatalCleanup(){this.cancelRequested=!0,this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);let e;for(let t of[...this.leases.keys()])try{await this.release(t)}catch(t){e??=t}if(!this.driverCancelComplete)try{await this.options.driver.cancel?.(),this.driverCancelComplete=!0}catch(t){e??=t}if(e)throw e;this.unregisterCleanup()}allocateWireLeaseId(){if(!Number.isSafeInteger(this.nextWireLeaseId)||this.nextWireLeaseId<=0)throw RangeError(`wire lease id space exhausted`);return this.nextWireLeaseId++}arrayBufferTransferBytes(e){let t=0;for(let n of e??[])if(n instanceof ArrayBuffer&&(t+=n.byteLength,!Number.isSafeInteger(t)))throw RangeError(`ArrayBuffer transfer bytes overflow`);return t}maybeUnregisterCompleted(){this.completed&&this.leases.size===0&&this.unregisterCleanup()}resourceUsage(){return this.options.driver.resourceUsage?.()}errorResourceUsage(){try{return this.resourceUsage()}catch{return}}};const Y=67108864;var be=class{coordinator=new J;host=null;identity=null;constructor(e,t=e=>e(this.requireArchive())){this.archive=e,this.executeArchive=t}open(e){if(this.host)throw Error(`a DOCX document pull session is already active`);this.executeArchive(t=>{t.open_document_cursor(e.operationId,e.generation)});let t=0;this.identity=e,this.host=new ye({...e,maxByteCredit:Y,coordinator:this.coordinator,driver:{pull:n=>{let r;try{r=this.executeArchive(r=>r.pull_document_chunk(t,e.operationId,e.generation,n))}catch(e){throw ue(e,n,Y)||e}let i=ge(r);return{payload:i,byteLength:i.byteLength,done:this.executeArchive(e=>e.document_chunk_done()),transfer:[i]}},measureChunk:({payload:e})=>e.byteLength,acknowledge:n=>{if(n!==t)throw Error(`DOCX document acknowledgement sequence mismatch`);this.executeArchive(n=>n.acknowledge_document_chunk(t,e.operationId,e.generation)),t+=1},cancel:()=>this.executeArchive(e=>e.cancel_document_cursor()),close:()=>this.executeArchive(e=>e.close_document_session()),resourceUsage:()=>{let e=this.executeArchive(e=>e.document_cursor_resource_usage?.());return e?P(e):void 0}}})}dispatch(e,t){return!this.host||!this.identity?(t({protocol:K,kind:`error`,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,error:G(Error(`DOCX document pull session is not open`))}),Promise.resolve()):this.host.dispatch(e,t)}async reset(){if(this.host)try{this.archive()&&this.executeArchive(e=>e.close_document_session())}finally{this.host=null,this.identity=null,this.coordinator=new J}}requireArchive(){let e=this.archive();if(!e)throw Error(`No docx loaded`);return e}};function xe(e){return!!e&&typeof e==`object`&&e.protocol===`ooxml-pull-v1`}const X=new ce(b,{freeArchive:e=>e.free(),reinit:ne}),Z=new be(()=>X.archive,e=>X.run(()=>{let t=X.archive;if(!t)throw Error(`No docx loaded`);return e(t)}));let Q=0;const $=(e,t)=>self.postMessage(e,t);self.onmessage=async e=>{let n=e.data;if(xe(n)){try{await Z.dispatch(n,$)}catch(e){$({protocol:K,kind:`error`,sessionId:n.sessionId,operationId:n.operationId,generation:n.generation,requestId:n.requestId,error:G(e)})}return}if(n.type===`init`){X.setWasmInput(ie(n.wasmUrl)??n.wasmUrl);return}let r=n.id;try{if(await X.ensureReady(),n.type!==`parse`&&X.archive){let e=X.archive;X.run(()=>e.assert_healthy())}if(n.type===`parse`){await Z.reset();let[e,i,a]=_e(n.resourcePolicy),o=new Uint8Array(n.data);X.run(()=>{let n=new t(o,e,i,a);X.setArchive(n)}),Q+=1;let s={sessionId:Q,operationId:Q,generation:Q};Z.open(s),$({type:`documentSessionOpened`,id:r,...s});return}let e=X.archive;if(n.type===`extractImage`){if(!e)throw Error(`No docx loaded`);let t=X.run(()=>e.extract_image(n.path).buffer),i={type:`imageExtracted`,id:r,bytes:t};self.postMessage(i,[t]);return}if(n.type===`resourceUsage`){if(!e)throw Error(`No docx loaded`);$({type:`resourceUsage`,id:r,usage:P(X.run(()=>e.resource_usage()))});return}if(n.type===`toMarkdown`){if(!e)throw Error(`No docx loaded`);$({type:`markdownRendered`,id:r,markdown:X.run(()=>e.to_markdown())});return}}catch(e){$({type:`error`,id:r,...G(e)})}};", nt = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", tt], { type: "text/javascript;charset=utf-8" });
|
|
15
15
|
function rt(e) {
|
|
@@ -504,6 +504,7 @@ var q = class e {
|
|
|
504
504
|
_threeD;
|
|
505
505
|
_regionMap;
|
|
506
506
|
_chartEx;
|
|
507
|
+
_tiff;
|
|
507
508
|
_worker;
|
|
508
509
|
_bridge;
|
|
509
510
|
_rawParts = new ve({
|
|
@@ -551,7 +552,7 @@ var q = class e {
|
|
|
551
552
|
t = await e.arrayBuffer();
|
|
552
553
|
} else t = n;
|
|
553
554
|
t = p(await h(t, i.password)), c.setSourceBytes(t.byteLength), c.checkpoint("container ready");
|
|
554
|
-
let r = s === "worker" ? (await import("./render-worker-host-
|
|
555
|
+
let r = s === "worker" ? (await import("./render-worker-host-BbhwA24Y.js")).createRenderWorker() : new rt(), l = s === "worker" ? Xe(i) : void 0, u = s === "worker" && !!i.progressiveLayout, d;
|
|
555
556
|
try {
|
|
556
557
|
d = new e(r, s, o, i.wasmUrl), d._metrics = c;
|
|
557
558
|
let n = w(d), f = E(i.currentDate, n.defaultCurrentDateMs, i.showTrackedChanges === !0);
|
|
@@ -564,7 +565,7 @@ var q = class e {
|
|
|
564
565
|
firstPublication: Rt(),
|
|
565
566
|
published: !1,
|
|
566
567
|
settled: !1
|
|
567
|
-
} : void 0), s === "worker" && d._mode === "main" && (c.setMode("main"), console.warn("[ooxml] mode: 'worker' fell back to main-thread rendering because this document requires DOM OpenType vertical glyph selection.")), i.math && d._mode === "worker" && !l?.math && console.warn("[ooxml] a custom math renderer cannot cross the worker boundary; equations will be skipped in mode: 'worker'. Use the math renderer from @silurus/ooxml/math."), i.threeD && d._mode === "worker" && !l?.threeD && console.warn("[ooxml] a custom 3-D chart renderer cannot cross the worker boundary; charts use their 2-D family fallback in mode: 'worker'. Use the renderer from @silurus/ooxml/three-d."), d._threeD = d._mode === "worker" ? void 0 : i.threeD, i.regionMap && d._mode === "worker" && !l?.regionMap && console.warn("[ooxml] a custom Region Map renderer cannot cross the worker boundary; geospatial charts use the unsupported-chart placeholder in mode: 'worker'. Use the renderer from @silurus/ooxml/region-map."), d._regionMap = d._mode === "worker" ? void 0 : i.regionMap, i.chartEx && d._mode === "worker" && !l?.chartEx && console.warn("[ooxml] a custom ChartEx renderer cannot cross the worker boundary; ChartEx charts use the unsupported-chart placeholder in mode: 'worker'. Use the renderer from @silurus/ooxml/chart-ex."), d._chartEx = d._mode === "worker" ? void 0 : i.chartEx, d._mode === "main" && i.useGoogleFonts && d._document && (d._googleFontFaces = await _e(He(d._document), Pe)), d._mode === "main" && d._document?.embeddedFonts?.length) {
|
|
568
|
+
} : void 0), s === "worker" && d._mode === "main" && (c.setMode("main"), console.warn("[ooxml] mode: 'worker' fell back to main-thread rendering because this document requires DOM OpenType vertical glyph selection.")), i.math && d._mode === "worker" && !l?.math && console.warn("[ooxml] a custom math renderer cannot cross the worker boundary; equations will be skipped in mode: 'worker'. Use the math renderer from @silurus/ooxml/math."), i.threeD && d._mode === "worker" && !l?.threeD && console.warn("[ooxml] a custom 3-D chart renderer cannot cross the worker boundary; charts use their 2-D family fallback in mode: 'worker'. Use the renderer from @silurus/ooxml/three-d."), d._threeD = d._mode === "worker" ? void 0 : i.threeD, i.regionMap && d._mode === "worker" && !l?.regionMap && console.warn("[ooxml] a custom Region Map renderer cannot cross the worker boundary; geospatial charts use the unsupported-chart placeholder in mode: 'worker'. Use the renderer from @silurus/ooxml/region-map."), d._regionMap = d._mode === "worker" ? void 0 : i.regionMap, i.chartEx && d._mode === "worker" && !l?.chartEx && console.warn("[ooxml] a custom ChartEx renderer cannot cross the worker boundary; ChartEx charts use the unsupported-chart placeholder in mode: 'worker'. Use the renderer from @silurus/ooxml/chart-ex."), d._chartEx = d._mode === "worker" ? void 0 : i.chartEx, i.tiff && d._mode === "worker" && !l?.tiff && console.warn("[ooxml] a custom TIFF codec cannot cross the worker boundary; TIFF images will be skipped in mode: 'worker'. Use the codec from @silurus/ooxml/tiff."), d._tiff = d._mode === "worker" ? void 0 : i.tiff, d._mode === "main" && i.useGoogleFonts && d._document && (d._googleFontFaces = await _e(He(d._document), Pe)), d._mode === "main" && d._document?.embeddedFonts?.length) {
|
|
568
569
|
let e = d;
|
|
569
570
|
d._embeddedFontFaces = await ot(d._document, (t) => e.getFontBytes(t));
|
|
570
571
|
}
|
|
@@ -1012,7 +1013,8 @@ var q = class e {
|
|
|
1012
1013
|
defaultCurrentDateMs: w(this).defaultCurrentDateMs,
|
|
1013
1014
|
threeD: this._threeD,
|
|
1014
1015
|
regionMap: this._regionMap,
|
|
1015
|
-
chartEx: this._chartEx
|
|
1016
|
+
chartEx: this._chartEx,
|
|
1017
|
+
tiff: this._tiff
|
|
1016
1018
|
});
|
|
1017
1019
|
}
|
|
1018
1020
|
async renderPageToBitmap(e, t = {}) {
|
|
@@ -1770,7 +1772,7 @@ var Jt = Symbol("DocxViewer.borrowedDocument"), Yt = class e {
|
|
|
1770
1772
|
}
|
|
1771
1773
|
}, Xt = 150, Zt = "0 1px 3px rgba(0,0,0,0.2)", Qt = 12, $t = 13, en = Symbol("DocxScrollViewer.borrowedDocument"), tn;
|
|
1772
1774
|
function nn() {
|
|
1773
|
-
return tn ??= import("./comment-ui-runtime-
|
|
1775
|
+
return tn ??= import("./comment-ui-runtime-C5qimVMD.js");
|
|
1774
1776
|
}
|
|
1775
1777
|
var rn = class e {
|
|
1776
1778
|
_documentOwner;
|
package/dist/docx.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Qt as e, Zt as t, a as n } from "./line-metrics-
|
|
2
|
-
import { w as r } from "./canvas-viewer-mechanics-
|
|
3
|
-
import {
|
|
4
|
-
import { a as o, c as s, i as c, l, n as u, o as d, r as f, s as p } from "./docx-
|
|
5
|
-
import { n as m, r as h } from "./comments-
|
|
1
|
+
import { Qt as e, Zt as t, a as n } from "./line-metrics-CXyjyYd5.js";
|
|
2
|
+
import { w as r } from "./canvas-viewer-mechanics-CIfhCgYA.js";
|
|
3
|
+
import { o as i, s as a } from "./tiff-contract-Xjn3qXqK.js";
|
|
4
|
+
import { a as o, c as s, i as c, l, n as u, o as d, r as f, s as p } from "./docx-BA1vB0V-.js";
|
|
5
|
+
import { n as m, r as h } from "./comments-BAlAyIhb.js";
|
|
6
6
|
export { s as DocxDocument, f as DocxScrollViewer, c as DocxViewer, i as OoxmlDecodedImageLimitError, t as OoxmlError, e as OoxmlResourceLimitError, r as autoResize, d as buildDocxHighlightLayer, p as buildDocxTextLayer, a as isOoxmlDecodedImageLimitError, u as noteText, n as openExternalHyperlink, o as readDocxTextSelectionContext, m as resolveCommentAnchorRuns, h as resolveDocxCommentThreads, l as resolveRevisionAnchorRuns };
|
package/dist/docx_parser_bg.wasm
CHANGED
|
Binary file
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "./xlsx-
|
|
2
|
-
import { t } from "./pptx-
|
|
3
|
-
import { t as n } from "./docx-
|
|
1
|
+
import { t as e } from "./xlsx-FyKAiNo-.js";
|
|
2
|
+
import { t } from "./pptx-C17oBD8Z.js";
|
|
3
|
+
import { t as n } from "./docx-BA1vB0V-.js";
|
|
4
4
|
export { n as docx, t as pptx, e as xlsx };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as e, w as t, x as n, yt as r } from "./line-metrics-
|
|
2
|
-
import { _ as i } from "./plot-area-frame-
|
|
1
|
+
import { b as e, w as t, x as n, yt as r } from "./line-metrics-CXyjyYd5.js";
|
|
2
|
+
import { _ as i } from "./plot-area-frame-DuXZzovH.js";
|
|
3
3
|
//#region packages/core/src/fonts/symbol-font.ts
|
|
4
4
|
var a = {
|
|
5
5
|
167: "♣",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { c as e, o as t, r as n } from "./tiff-contract-Xjn3qXqK.js";
|
|
2
|
+
import { an as r, on as i } from "./plot-area-frame-DuXZzovH.js";
|
|
3
|
+
import { L as a } from "./three-d-B7LsKeOS.js";
|
|
4
|
+
import { t as o } from "./mathjax-DPEX346v.js";
|
|
4
5
|
//#region packages/core/src/errors/ooxml-error.ts
|
|
5
6
|
var s = class e extends Error {
|
|
6
7
|
code;
|
|
@@ -22447,7 +22448,7 @@ function Re(e) {
|
|
|
22447
22448
|
}
|
|
22448
22449
|
var A = /* @__PURE__ */ new WeakMap(), ze = /* @__PURE__ */ new WeakSet();
|
|
22449
22450
|
function j(e) {
|
|
22450
|
-
!e || ze.has(e) || (ze.add(e),
|
|
22451
|
+
!e || ze.has(e) || (ze.add(e), i(e));
|
|
22451
22452
|
}
|
|
22452
22453
|
function Be(e) {
|
|
22453
22454
|
j(e);
|
|
@@ -22475,13 +22476,13 @@ function He(e) {
|
|
|
22475
22476
|
let t = Number(e.width), n = Number(e.height);
|
|
22476
22477
|
return Number.isSafeInteger(t) && t > 0 && Number.isSafeInteger(n) && n > 0 ? t * n * 4 : 0;
|
|
22477
22478
|
}
|
|
22478
|
-
function Ue(e,
|
|
22479
|
-
if (!
|
|
22479
|
+
function Ue(e, r) {
|
|
22480
|
+
if (!r) return;
|
|
22480
22481
|
let i = A.get(e);
|
|
22481
|
-
if (!i || i.count === 0 || i.activeBitmaps.has(
|
|
22482
|
-
let a = i.activeBytes + He(
|
|
22483
|
-
if (a > 134217728) throw new t("active-decoded-bytes",
|
|
22484
|
-
i.activeBitmaps.add(
|
|
22482
|
+
if (!i || i.count === 0 || i.activeBitmaps.has(r)) return;
|
|
22483
|
+
let a = i.activeBytes + He(r);
|
|
22484
|
+
if (a > 134217728) throw new t("active-decoded-bytes", n, a);
|
|
22485
|
+
i.activeBitmaps.add(r), i.activeBytes = a;
|
|
22485
22486
|
}
|
|
22486
22487
|
function We(e, t, n) {
|
|
22487
22488
|
let r = [...t.entries].find(([e]) => e !== n);
|
|
@@ -22497,10 +22498,10 @@ function Ge(e, t) {
|
|
|
22497
22498
|
}
|
|
22498
22499
|
t.then((e) => j(e)).catch(() => {});
|
|
22499
22500
|
}
|
|
22500
|
-
function Ke(e, t,
|
|
22501
|
+
function Ke(e, t, r) {
|
|
22501
22502
|
let i = Re(t), a = i.entries, o = a.get(e);
|
|
22502
22503
|
if (o) return a.delete(e), a.set(e, o), o.promise.then((e) => (Ue(t, e), e));
|
|
22503
|
-
let s = Ie(t,
|
|
22504
|
+
let s = Ie(t, r), c = s.then(({ bitmap: e, owned: t }) => t ? e : null), l = s.then(({ bitmap: e, owned: n }) => {
|
|
22504
22505
|
try {
|
|
22505
22506
|
return Ue(t, e), e;
|
|
22506
22507
|
} catch (t) {
|
|
@@ -22511,13 +22512,13 @@ function Ke(e, t, n) {
|
|
|
22511
22512
|
ownedPromise: c,
|
|
22512
22513
|
weight: 0
|
|
22513
22514
|
};
|
|
22514
|
-
for (s.then(({ bitmap:
|
|
22515
|
+
for (s.then(({ bitmap: r, owned: o }) => {
|
|
22515
22516
|
if (a.get(e) === u) {
|
|
22516
|
-
if (u.bitmap =
|
|
22517
|
+
if (u.bitmap = r, !o) {
|
|
22517
22518
|
a.delete(e);
|
|
22518
22519
|
return;
|
|
22519
22520
|
}
|
|
22520
|
-
for (u.weight = He(
|
|
22521
|
+
for (u.weight = He(r), i.retainedBytes += u.weight; i.retainedBytes > n && We(t, i, e););
|
|
22521
22522
|
}
|
|
22522
22523
|
}).catch(() => {}), l.catch(() => {
|
|
22523
22524
|
a.get(e) === u && (a.delete(e), i.retainedBytes -= u.weight, Ge(t, c));
|
|
@@ -22531,13 +22532,14 @@ function Xe(e, t, n, r) {
|
|
|
22531
22532
|
function Ze(e, t, n, r) {
|
|
22532
22533
|
return Xe(`${Ye}${e}`, t, n, r);
|
|
22533
22534
|
}
|
|
22534
|
-
function Qe(t, n,
|
|
22535
|
-
let { widthPt: a = 0, heightPt: o = 0, suppressBoundaryFrame: s = !1 } = i;
|
|
22536
|
-
return Xe(qe,
|
|
22537
|
-
bitmap: await
|
|
22535
|
+
function Qe(e, t, n, i = {}) {
|
|
22536
|
+
let { widthPt: a = 0, heightPt: o = 0, suppressBoundaryFrame: s = !1, tiff: c } = i;
|
|
22537
|
+
return Xe(qe, e, n, async () => ({
|
|
22538
|
+
bitmap: await r(await n(e, t), {
|
|
22538
22539
|
widthPt: a,
|
|
22539
22540
|
heightPt: o,
|
|
22540
|
-
suppressBoundaryFrame: s
|
|
22541
|
+
suppressBoundaryFrame: s,
|
|
22542
|
+
tiff: c
|
|
22541
22543
|
}),
|
|
22542
22544
|
owned: !0
|
|
22543
22545
|
}));
|
|
@@ -22882,15 +22884,15 @@ function Rt(e, t, n, r) {
|
|
|
22882
22884
|
}
|
|
22883
22885
|
e.restore();
|
|
22884
22886
|
}
|
|
22885
|
-
async function zt(
|
|
22886
|
-
let { width:
|
|
22887
|
+
async function zt(t, n) {
|
|
22888
|
+
let { width: r, height: i } = a(t.widthEm * 256, (t.ascentEm + t.descentEm) * 256), s = e(r, i), c = s?.getContext("2d");
|
|
22887
22889
|
if (!s || !c || typeof Path2D > "u") throw Error("Math SVG rasterization requires Canvas 2D and Path2D support");
|
|
22888
|
-
Rt(c, Nt(o(
|
|
22889
|
-
let l = s, u =
|
|
22890
|
+
Rt(c, Nt(o(t.svg, n), t.widthEm, t.ascentEm + t.descentEm), r, i);
|
|
22891
|
+
let l = s, u = r, d = i, f = Mt / 256, p = Math.max(1, Math.round(r * f)), m = Math.max(1, Math.round(i * f));
|
|
22890
22892
|
for (; u > p || d > m;) {
|
|
22891
|
-
let
|
|
22892
|
-
if (!
|
|
22893
|
-
|
|
22893
|
+
let t = Math.max(p, Math.ceil(u / 2)), n = Math.max(m, Math.ceil(d / 2)), r = e(t, n), i = r?.getContext("2d");
|
|
22894
|
+
if (!r || !i) break;
|
|
22895
|
+
i.imageSmoothingEnabled = !0, i.imageSmoothingQuality = "high", i.drawImage(l, 0, 0, t, n), l = r, u = t, d = n;
|
|
22894
22896
|
}
|
|
22895
22897
|
return {
|
|
22896
22898
|
source: l,
|
|
@@ -22898,11 +22900,11 @@ async function zt(e, t) {
|
|
|
22898
22900
|
heightPx: d
|
|
22899
22901
|
};
|
|
22900
22902
|
}
|
|
22901
|
-
function Bt(
|
|
22902
|
-
let
|
|
22903
|
-
if (!
|
|
22904
|
-
let
|
|
22905
|
-
return
|
|
22903
|
+
function Bt(t, n) {
|
|
22904
|
+
let r = e(t.widthPx, t.heightPx);
|
|
22905
|
+
if (!r) return t.source;
|
|
22906
|
+
let i = r.getContext("2d");
|
|
22907
|
+
return i ? (i.drawImage(t.source, 0, 0, t.widthPx, t.heightPx), i.globalCompositeOperation = "source-in", i.fillStyle = n, i.fillRect(0, 0, t.widthPx, t.heightPx), r) : t.source;
|
|
22906
22908
|
}
|
|
22907
22909
|
//#endregion
|
|
22908
22910
|
//#region packages/core/src/canvas/env.ts
|
package/dist/math.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as e } from "./renderer-module-contract-
|
|
2
|
-
import { n as t } from "./mathjax-
|
|
1
|
+
import { t as e } from "./renderer-module-contract-C6sYZvTV.js";
|
|
2
|
+
import { n as t } from "./mathjax-DPEX346v.js";
|
|
3
3
|
//#region packages/core/assets/mathjax-stix2.js?url
|
|
4
4
|
var n = new URL("mathjax-stix2.js", import.meta.url).href, r = null;
|
|
5
5
|
function i(e) {
|
package/dist/node.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { t as e } from "./chunk-DmhlhrBa.js";
|
|
2
|
-
import { t } from "./slide-pull-client-
|
|
3
|
-
import { B as n, F as r, Ft as i, G as a, H as o, I as s, It as c, K as l, P as u, Qt as d, R as f, U as p, Vt as m, ft as h, lt as g, q as ee } from "./line-metrics-
|
|
2
|
+
import { t } from "./slide-pull-client-BS0EeZo2.js";
|
|
3
|
+
import { B as n, F as r, Ft as i, G as a, H as o, I as s, It as c, K as l, P as u, Qt as d, R as f, U as p, Vt as m, ft as h, lt as g, q as ee } from "./line-metrics-CXyjyYd5.js";
|
|
4
4
|
import { t as te } from "./bounded-raw-part-cache-C6ro6Ezf.js";
|
|
5
|
-
import { a as ne, c as re, i as ie, l as ae, r as oe, u as se } from "./document-pull-client-
|
|
6
|
-
import {
|
|
7
|
-
import { t as ue } from "./transfer-
|
|
8
|
-
import { a as de, c as fe, d as pe, l as me, o as he, r as ge, s as _e, t as ve, u as ye } from "./worksheet-pull-client-
|
|
9
|
-
import { a as be, i as xe, n as Se, r as Ce } from "./session-
|
|
10
|
-
import { a as we, n as Te, r as Ee, t as De } from "./render-
|
|
5
|
+
import { a as ne, c as re, i as ie, l as ae, r as oe, u as se } from "./document-pull-client-BXw6AAhY.js";
|
|
6
|
+
import { o as ce, s as le } from "./tiff-contract-Xjn3qXqK.js";
|
|
7
|
+
import { t as ue } from "./transfer-vNOFQuvv.js";
|
|
8
|
+
import { a as de, c as fe, d as pe, l as me, o as he, r as ge, s as _e, t as ve, u as ye } from "./worksheet-pull-client-B0zfEVau.js";
|
|
9
|
+
import { a as be, i as xe, n as Se, r as Ce } from "./session-Cl0RVnMs.js";
|
|
10
|
+
import { a as we, n as Te, r as Ee, t as De } from "./render-CVeGktZG.js";
|
|
11
11
|
import { existsSync as Oe, readFileSync as ke } from "node:fs";
|
|
12
12
|
import { fileURLToPath as Ae } from "node:url";
|
|
13
13
|
import { basename as je, dirname as Me, resolve as Ne } from "node:path";
|
|
@@ -134,7 +134,7 @@ var ze = class {
|
|
|
134
134
|
async renderSlide(e, t, n) {
|
|
135
135
|
return this.assertOpen(), this.enqueueRender(async () => {
|
|
136
136
|
x(this.signal);
|
|
137
|
-
let { renderSlideNode: r } = await import("./render-
|
|
137
|
+
let { renderSlideNode: r } = await import("./render-CVeGktZG.js").then((e) => e.i);
|
|
138
138
|
await r(e, {
|
|
139
139
|
slideWidth: this.slideWidth,
|
|
140
140
|
slideHeight: this.slideHeight,
|