@file-viewer/assets-design 3.2.1 → 3.3.0

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.
@@ -60,7 +60,11 @@ The MIT-licensed DEFLATE implementation is bundled transitively through `ag-psd`
60
60
 
61
61
  Source: <https://github.com/paged-media/core/tree/c7a4b788cc24acd7d5af8843655ec3806ad613a1>, the official npm 0.70.2 `gitHead` and release tag target.
62
62
 
63
- The exact corresponding source archive is <https://codeload.github.com/paged-media/core/tar.gz/c7a4b788cc24acd7d5af8843655ec3806ad613a1> (SHA-256 `58f8eb6e1a0f06b8e2c8babf27d1ae0bad37a21db1ff8243298bdc647eee34a7`). Its IDML import and export dependencies come from <https://codeload.github.com/paged-media/plugin-publish/tar.gz/47ab9d90c8004c32b7d410cc8f2a554b6493a260> (SHA-256 `1053e5d3170d7a8ae01c90534ec7d0dc3821429df84aba6e78cdefedc11cbebe`). Both archives match the immutable Git blobs of those commits.
63
+ The exact core corresponding source archive is <https://codeload.github.com/paged-media/core/tar.gz/c7a4b788cc24acd7d5af8843655ec3806ad613a1> (SHA-256 `58f8eb6e1a0f06b8e2c8babf27d1ae0bad37a21db1ff8243298bdc647eee34a7`). The original lock records IDML import/export commit `47ab9d90c8004c32b7d410cc8f2a554b6493a260` from `paged-media/plugin-publish`. Its complete source is now available in the official migrated archive <https://codeload.github.com/paged-media/paged/tar.gz/0a6ad98729b759f4c698f9e829f5b75d9ae431b9> (3,284,711 bytes; SHA-256 `b12e8384271b88cd27ef4efdd08785a63f6c50e706c4cbae3e75e09b639eca45`), under `modules/publish/`.
64
+
65
+ The fixed official [commit map](https://github.com/paged-media/paged/blob/a86a8867d8cdc78b8f737ad18ef7bd0e48f0b0d6/tooling/import/commit-maps/plugin-publish.tsv) maps that original commit to `0a6ad98729b759f4c698f9e829f5b75d9ae431b9`; the adjacent import manifest preserves the complete repository under `modules/publish/`. All 154 files reconstruct Git subtree `f271f202b6d764e7af4146f6fb12240c8df9a66c`, including the unchanged original license texts. The original commit and Cargo lock identities remain recorded in the native license book.
66
+
67
+ To restore the core build after this repository migration, unpack both pinned archives and point each core `idml-import`/`idml-export` dependency at the matching `modules/publish/crates/idml-import` or `idml-export` directory. Keep the core workspace's existing `[patch."https://github.com/paged-media/core"]` entries so the adapter and core share the same local model types. Both workspaces' Cargo manifests and these paths were checked; no bit-for-bit WASM rebuild is asserted. The distributed 0.70.2 WASM remains unmodified.
64
68
 
65
69
  The package declares `MPL-2.0 OR LicenseRef-PMEL`. File Viewer elects the Mozilla Public License 2.0 option for the distributed JavaScript and WebAssembly runtime. The complete MPL-2.0 text is shipped as `LICENSES/MPL-2.0.txt` and copied next to the self-hosted IDML runtime assets.
66
70
 
@@ -88,10 +92,14 @@ Source: <https://github.com/lddubeau/xmlchars/tree/v2.2.0>
88
92
 
89
93
  The MIT-licensed XML character classifier is bundled transitively through `saxes` in the Adobe container Worker. The complete upstream license is shipped as `LICENSES/xmlchars-MIT.txt`.
90
94
 
91
- ## Stet 0.7.0 / stet-wasm 0.2.0
95
+ ## Stet 0.8.7 / stet-wasm 0.2.0
96
+
97
+ Source: <https://github.com/AndyCappDev/stet/tree/58c7066817f7939789c6f030515c02e94fb0353b>
98
+
99
+ Stet is licensed under `Apache-2.0 OR MIT`. Both complete license texts are shipped unchanged as `LICENSES/Stet-Apache-2.0.txt` and `LICENSES/Stet-MIT.txt`. The reproducible build uses unmodified upstream source and resources. Embedded TrueType/OpenType loading and the host VM ceiling use upstream APIs; `source/postscript/stet-safe-browser.patch` is no longer needed.
92
100
 
93
- Source: <https://github.com/AndyCappDev/stet/tree/3aaf0a76ebd0f9129a715dfa10614d8871d8e965>
101
+ The 35 embedded URW Base35 fonts use Stet's SIL Open Font License 1.1 election. `LICENSES/Stet-URW-Fonts-OFL-1.1.txt` preserves the complete upstream notice, original copyright statements, archived 2017 triple-license declaration, and OFL text. The font bytes match `ArtifexSoftware/urw-base35-fonts` commit `3c0ba3b5687632dfc66526544a4e811fe0ec0cd9`; exact hashes are pinned in `source/postscript/upstream.json`. The old Carlito, Tinos, Cousine and Noto Sans Symbols 2 license URLs remain for compatibility; those fonts are no longer embedded.
94
102
 
95
- Stet is licensed under `Apache-2.0 OR MIT`. Both complete license texts are shipped as `LICENSES/Stet-Apache-2.0.txt` and `LICENSES/Stet-MIT.txt`. File Viewer applies the reproducible patch documented in `POSTSCRIPT-WASM.md`: it adds a browser VM cap and virtual-font loading, removes every compiled reference to the upstream URW Base35 assets and Ghostscript `default_cmyk.icc`, and uses the PLRM DeviceCMYK formula fallback. The package does not redistribute those excluded upstream assets.
103
+ The embedded CMYK profile is `CGATS001Compat-v2-micro.icc` from Clinton Ingram's Compact ICC Profiles, commit `1fabe4a41bef9bac6e8300748177f783773571cb`, under CC0. It is 8,464 bytes with SHA-256 `73e1ba37d2bad5bab2a964f40a9eed96209666efc067c3322626214bbef234a0`. `LICENSES/Stet-CMYK-Profile.txt` preserves upstream provenance and `LICENSES/CC0-1.0.txt` contains the collection's full legal text. It is not Ghostscript's profile. See `POSTSCRIPT-WASM.md` for the reproducible build and safety boundary.
96
104
 
97
- The embedded substitutes are Carlito, Tinos, Cousine, and Noto Sans Symbols 2. Each is distributed under SIL Open Font License 1.1; the corresponding complete texts are shipped in `LICENSES/*-OFL-1.1.txt`. Font binaries come from Google Fonts commit `ade3d1533e06b2b1462ffcde8e08b129627ca360`, and the Tinos project notice is pinned to `googlefonts/tinos` commit `3b4482a99b80ea5fc75f187b1be3120a3f5905b3`. Exact source hashes are enforced by `scripts/build-postscript-wasm.mjs`.
105
+ `LICENSES/Stet_NATIVE_THIRD_PARTY_LICENSES.json` retains 91 packages in the exact locked conservative source profile, including host/build alternatives, with 80 complete original legal materials and the original Rust standard-library source grants. It is bound to the source commit, lock hash and WASM hash; it is not a post-link symbol inventory. Registry legal files are checked against the exact checksum-verified crate archives. The MIT declarations in fax 0.2.6 and fax_derive 0.2.0 omit grant files; the book preserves the unmodified project MIT grant added upstream at `pdf-rs/fax` commit `5d70a161e33b62305f8bce7af3f7fbd011cfaf5d`, with that source recorded explicitly. The jpeg-encoder IJG header and unicode-ident Unicode grant are retained in addition to their MIT/Apache grants. This software is based in part on the work of the Independent JPEG Group.
@@ -1 +1 @@
1
- var f=class e{static __wrap(t){let n=Object.create(e.prototype);return n.__wbg_ptr=t,k.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,k.unregister(this),t}free(){let t=this.__destroy_into_raw();i.__wbg_interpreter_free(t,0)}};Symbol.dispose&&(f.prototype[Symbol.dispose]=f.prototype.free);var x=class e{static __wrap(t){let n=Object.create(e.prototype);return n.__wbg_ptr=t,C.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,C.unregister(this),t}free(){let t=this.__destroy_into_raw();i.__wbg_page_free(t,0)}get height(){return i.page_height(this.__wbg_ptr)>>>0}get rgba(){let t=i.page_rgba(this.__wbg_ptr);var n=V(t[0],t[1]).slice();return i.__wbindgen_free(t[0],t[1]*1,1),n}get width(){return i.page_width(this.__wbg_ptr)>>>0}};Symbol.dispose&&(x.prototype[Symbol.dispose]=x.prototype.free);function v(e,t){b(e,f),i.configure_limits(e.__wbg_ptr,t)}function W(){let e=i.create_interpreter();return f.__wrap(e)}function M(e){return b(e,f),i.page_count(e.__wbg_ptr)>>>0}function F(e,t){return b(e,f),i.page_dimensions(e.__wbg_ptr,t)}function N(e){return b(e,f),i.ps_stream_active(e.__wbg_ptr)!==0}function $(e,t,n,r){b(e,f);let s=K(t,i.__wbindgen_malloc),o=y,a=j(r,i.__wbindgen_malloc,i.__wbindgen_realloc),c=y,_=i.render(e.__wbg_ptr,s,o,n,a,c);if(_[2])throw S(_[1]);return S(_[0])}function B(e,t,n,r,s,o,a,c){b(e,f);let _=i.render_viewport(e.__wbg_ptr,t,n,r,s,o,a,c);if(_[2])throw S(_[1]);return x.__wrap(_[0])}function U(e){b(e,f);let t=i.step_ps_page(e.__wbg_ptr);if(t[2])throw S(t[1]);return S(t[0])}function X(){return{__proto__:null,"./stet_wasm_bg.js":{__proto__:null,__wbg___wbindgen_throw_bb96b2010945f0bc:function(t,n){throw new Error(A(t,n))},__wbg_apply_cb180996ed7fdae9:function(){return J(function(t,n,r){return t.apply(n,r)},arguments)},__wbg_error_757e9472f8410341:function(t,n){let r,s;try{r=t,s=n,console.error(A(t,n))}finally{i.__wbindgen_free(r,s,1)}},__wbg_log_e6372b4fbfc9f81e:function(t){console.log(t)},__wbg_new_116be93542d39019:function(){return new Array},__wbg_new_227d7c05414eb861:function(){return new Error},__wbg_new_from_slice_3eea173078478cfe:function(t,n){return new Uint8Array(V(t,n))},__wbg_push_adb0107829f02d75:function(t,n){return t.push(n)},__wbg_stack_3b0d974bbf31e44f:function(t,n){let r=n.stack,s=j(r,i.__wbindgen_malloc,i.__wbindgen_realloc),o=y;L().setInt32(t+4,o,!0),L().setInt32(t+0,s,!0)},__wbindgen_cast_0000000000000001:function(t){return t},__wbindgen_cast_0000000000000002:function(t,n){return A(t,n)},__wbindgen_init_externref_table:function(){let t=i.__wbindgen_externrefs,n=t.grow(4);t.set(0,void 0),t.set(n+0,void 0),t.set(n+1,null),t.set(n+2,!0),t.set(n+3,!1)}}}}var k=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>i.__wbg_interpreter_free(e,1)),C=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>i.__wbg_page_free(e,1));function Q(e){let t=i.__externref_table_alloc();return i.__wbindgen_externrefs.set(t,e),t}function b(e,t){if(!(e instanceof t))throw new Error(`expected instance of ${t.name}`)}function V(e,t){return e=e>>>0,l().subarray(e/1,e/1+t)}var w=null;function L(){return(w===null||w.buffer.detached===!0||w.buffer.detached===void 0&&w.buffer!==i.memory.buffer)&&(w=new DataView(i.memory.buffer)),w}function A(e,t){return q(e>>>0,t)}var h=null;function l(){return(h===null||h.byteLength===0)&&(h=new Uint8Array(i.memory.buffer)),h}function J(e,t){try{return e.apply(this,t)}catch(n){let r=Q(n);i.__wbindgen_exn_store(r)}}function K(e,t){let n=t(e.length*1,1)>>>0;return l().set(e,n/1),y=e.length,n}function j(e,t,n){if(n===void 0){let c=P.encode(e),_=t(c.length,1)>>>0;return l().subarray(_,_+c.length).set(c),y=c.length,_}let r=e.length,s=t(r,1)>>>0,o=l(),a=0;for(;a<r;a++){let c=e.charCodeAt(a);if(c>127)break;o[s+a]=c}if(a!==r){a!==0&&(e=e.slice(a)),s=n(s,r,r=a+e.length*3,1)>>>0;let c=l().subarray(s+a,s+r),_=P.encodeInto(e,c);a+=_.written,s=n(s,r,a,1)>>>0}return y=a,s}function S(e){let t=i.__wbindgen_externrefs.get(e);return i.__externref_table_dealloc(e),t}var D=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});D.decode();var Z=2146435072,E=0;function q(e,t){return E+=t,E>=Z&&(D=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),D.decode(),E=t),D.decode(l().subarray(e,e+t))}var P=new TextEncoder;"encodeInto"in P||(P.encodeInto=function(e,t){let n=P.encode(e);return t.set(n),{read:e.length,written:n.length}});var y=0,ee,te,i;function ne(e,t){return te=e,i=e.exports,ee=t,w=null,h=null,i.__wbindgen_start(),i}async function re(e,t){if(typeof Response=="function"&&e instanceof Response){if(!e.ok)throw new Error(`failed to fetch Wasm: ${e.status} ${e.statusText} fetching '${e.url}'`);if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(s){if(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",s);else throw s}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let r=await WebAssembly.instantiate(e,t);return r instanceof WebAssembly.Instance?{instance:r,module:e}:r}function n(r){switch(r){case"basic":case"cors":case"default":return!0}return!1}}async function G(e){if(i!==void 0)return i;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")),e===void 0&&(e=new URL("stet_wasm_bg.wasm",import.meta.url));let t=X();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await re(await e,t);return ne(n,r)}var m=Object.freeze({maxFileBytes:33554432,maxPages:100,maxSourceDimension:1e5,maxCanvasDimension:8192,maxRenderedPixels:16777216,maxVmBytes:268435456,minDpi:36,maxDpi:300,workerTimeoutMs:3e4}),d=(e,t,n,r)=>{let s=Number(e);return Number.isFinite(s)?Math.min(r,Math.max(n,Math.floor(s))):t},z=(e={})=>{let t=d(e.minDpi,m.minDpi,18,300),n=Math.max(t,d(e.maxDpi,m.maxDpi,36,600));return{maxFileBytes:d(e.maxFileBytes,m.maxFileBytes,1,64*1024*1024),maxPages:d(e.maxPages,m.maxPages,1,500),maxSourceDimension:d(e.maxSourceDimension,m.maxSourceDimension,1,1e6),maxCanvasDimension:d(e.maxCanvasDimension,m.maxCanvasDimension,1,16384),maxRenderedPixels:d(e.maxRenderedPixels,m.maxRenderedPixels,1,64*1024*1024),maxVmBytes:d(e.maxVmBytes,m.maxVmBytes,16*1024*1024,512*1024*1024),minDpi:t,maxDpi:n,workerTimeoutMs:d(e.workerTimeoutMs,m.workerTimeoutMs,1e3,12e4)}};var T=self,p=class extends Error{constructor(n,r){super(r);this.code=n;this.name="PostscriptWorkerError"}code},R,I,O=()=>{I?.interpreter.free(),I=void 0},se=e=>{if(e.byteLength<4)return!1;let t=new Uint8Array(e,0,Math.min(e.byteLength,32)),n=t[0]===37&&t[1]===33&&t[2]===80&&t[3]===83,r=t[0]===197&&t[1]===208&&t[2]===211&&t[3]===198;return n||r},ie=(e,t,n)=>{let r=F(e,t);if(!r||r.length<3)throw new p("POSTSCRIPT_PAGE_INVALID",`PostScript page ${t+1} has no dimensions.`);let s=Number(r[0]),o=Number(r[1]),a=Number(r[2]);if(![s,o,a].every(Number.isFinite)||s<=0||o<=0||a<=0)throw new p("POSTSCRIPT_PAGE_INVALID",`PostScript page ${t+1} reports invalid dimensions.`);if(s>n.maxSourceDimension||o>n.maxSourceDimension)throw new p("POSTSCRIPT_PAGE_DIMENSION_LIMIT",`PostScript page ${t+1} exceeds the ${n.maxSourceDimension}-unit source-dimension limit.`);let c=n.minDpi/a,_=Math.max(1,Math.round(s*c)),u=Math.max(1,Math.round(o*c));if(_>n.maxCanvasDimension||u>n.maxCanvasDimension||_*u>n.maxRenderedPixels)throw new p("POSTSCRIPT_PAGE_RASTER_LIMIT",`PostScript page ${t+1} cannot fit the configured raster limits even at ${n.minDpi} DPI.`);return{index:t,width:s,height:o,referenceDpi:a}},oe=async(e,t,n,r)=>{O();let s=z(r);if(e.byteLength>s.maxFileBytes)throw new p("POSTSCRIPT_FILE_LIMIT",`PostScript source exceeds the ${s.maxFileBytes}-byte safety limit.`);if(!se(e))throw new p("POSTSCRIPT_SIGNATURE_INVALID","The source is not an Adobe PostScript document or DOS EPS container.");if(R&&R!==n)throw new p("POSTSCRIPT_WASM_URL_CHANGED","A PostScript Worker cannot switch WebAssembly binaries after initialization.");R||(await G({module_or_path:n}),R=n);let o=W();v(o,s.maxVmBytes);try{for($(o,new Uint8Array(e),72,t);N(o);){if(M(o)>=s.maxPages)throw new p("POSTSCRIPT_PAGE_LIMIT",`PostScript execution reached the ${s.maxPages}-page safety limit before the program ended.`);U(o),await new Promise(g=>setTimeout(g,0))}let c=M(o);if(c<1)throw new p("POSTSCRIPT_EMPTY","The PostScript program did not produce a page.");if(c>s.maxPages)throw new p("POSTSCRIPT_PAGE_LIMIT",`PostScript output exceeds the ${s.maxPages}-page safety limit.`);let _=Array.from({length:c},(u,g)=>ie(o,g,s));return I={interpreter:o,limits:s,pages:_},{engine:"stet-wasm",engineVersion:"0.7.0+file-viewer-safe.1",renderBackend:"cpu-tiny-skia",colorFallback:"plrm-device-cmyk",fontSubstitutes:["Carlito","Tinos","Cousine","Noto Sans Symbols 2"],pages:_}}catch(a){throw o.free(),a}},ae=(e,t)=>{if(!I)throw new p("POSTSCRIPT_NOT_OPEN","The PostScript Worker has no open document.");let{interpreter:n,limits:r,pages:s}=I;if(!Number.isSafeInteger(e)||e<0||e>=s.length)throw new p("POSTSCRIPT_PAGE_RANGE",`PostScript page index ${e} is outside 0..${s.length-1}.`);if(!Number.isFinite(t)||t<r.minDpi||t>r.maxDpi)throw new p("POSTSCRIPT_DPI_LIMIT",`PostScript render DPI must be between ${r.minDpi} and ${r.maxDpi}.`);let o=s[e],a=t/o.referenceDpi,c=Math.max(1,Math.round(o.width*a)),_=Math.max(1,Math.round(o.height*a));if(c>r.maxCanvasDimension||_>r.maxCanvasDimension)throw new p("POSTSCRIPT_CANVAS_DIMENSION_LIMIT",`PostScript raster ${c}\xD7${_} exceeds the ${r.maxCanvasDimension}-pixel canvas dimension limit.`);if(c*_>r.maxRenderedPixels)throw new p("POSTSCRIPT_PIXEL_LIMIT",`PostScript raster ${c}\xD7${_} exceeds the ${r.maxRenderedPixels}-pixel limit.`);let u=B(n,e,0,0,o.width,o.height,c,_);try{let g=u.rgba,Y=new Uint8ClampedArray(g.buffer,g.byteOffset,g.byteLength);return{pageIndex:e,dpi:t,width:u.width,height:u.height,rgba:Y}}finally{u.free()}},ce=e=>e instanceof p||e instanceof Error&&"code"in e&&typeof e.code=="string"?e.code:"POSTSCRIPT_ENGINE_FAILURE",_e=async e=>{try{if(e.type==="open"){let r=await oe(e.buffer,e.filename,e.wasmUrl,e.limits),s={id:e.id,ok:!0,type:"open",result:r};T.postMessage(s);return}if(e.type==="destroy"){O();let r={id:e.id,ok:!0,type:"destroy"};T.postMessage(r);return}let t=ae(e.pageIndex,e.dpi),n={id:e.id,ok:!0,type:"renderPage",result:t};T.postMessage(n,[t.rgba.buffer])}catch(t){let n=ce(t);e.type==="open"&&O();let r={id:e.id,ok:!1,error:{name:t instanceof Error?t.name:"Error",code:n,message:t instanceof Error?t.message:String(t),fatal:e.type==="open"||n==="POSTSCRIPT_ENGINE_FAILURE"}};T.postMessage(r)}},H=Promise.resolve();T.addEventListener("message",e=>{H=H.catch(()=>{}).then(()=>_e(e.data))});
1
+ var f=class e{static __wrap(t){let n=Object.create(e.prototype);return n.__wbg_ptr=t,C.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,C.unregister(this),t}free(){let t=this.__destroy_into_raw();i.__wbg_interpreter_free(t,0)}};Symbol.dispose&&(f.prototype[Symbol.dispose]=f.prototype.free);var x=class e{static __wrap(t){let n=Object.create(e.prototype);return n.__wbg_ptr=t,L.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,L.unregister(this),t}free(){let t=this.__destroy_into_raw();i.__wbg_page_free(t,0)}get height(){return i.page_height(this.__wbg_ptr)>>>0}get rgba(){let t=i.page_rgba(this.__wbg_ptr);var n=X(t[0],t[1]).slice();return i.__wbindgen_free(t[0],t[1]*1,1),n}get width(){return i.page_width(this.__wbg_ptr)>>>0}};Symbol.dispose&&(x.prototype[Symbol.dispose]=x.prototype.free);function k(){let e=i.create_interpreter();return f.__wrap(e)}function M(e){return b(e,f),i.page_count(e.__wbg_ptr)>>>0}function W(e,t){return b(e,f),i.page_dimensions(e.__wbg_ptr,t)}function F(e){return b(e,f),i.ps_stream_active(e.__wbg_ptr)!==0}function N(e,t,n,r){b(e,f);let s=Q(t,i.__wbindgen_malloc),o=y,a=V(r,i.__wbindgen_malloc,i.__wbindgen_realloc),c=y,_=i.render(e.__wbg_ptr,s,o,n,a,c);if(_[2])throw S(_[1]);return S(_[0])}function B(e,t,n,r,s,o,a,c){b(e,f);let _=i.render_viewport(e.__wbg_ptr,t,n,r,s,o,a,c);if(_[2])throw S(_[1]);return x.__wrap(_[0])}function $(e,t){b(e,f),i.set_max_vm(e.__wbg_ptr,t)}function U(e){b(e,f);let t=i.step_ps_page(e.__wbg_ptr);if(t[2])throw S(t[1]);return S(t[0])}function Y(){return{__proto__:null,"./stet_wasm_bg.js":{__proto__:null,__wbg___wbindgen_throw_bb96b2010945f0bc:function(t,n){throw new Error(A(t,n))},__wbg_error_757e9472f8410341:function(t,n){let r,s;try{r=t,s=n,console.error(A(t,n))}finally{i.__wbindgen_free(r,s,1)}},__wbg_log_e6372b4fbfc9f81e:function(t){console.log(t)},__wbg_new_116be93542d39019:function(){return new Array},__wbg_new_227d7c05414eb861:function(){return new Error},__wbg_push_adb0107829f02d75:function(t,n){return t.push(n)},__wbg_stack_3b0d974bbf31e44f:function(t,n){let r=n.stack,s=V(r,i.__wbindgen_malloc,i.__wbindgen_realloc),o=y;v().setInt32(t+4,o,!0),v().setInt32(t+0,s,!0)},__wbindgen_cast_0000000000000001:function(t){return t},__wbindgen_cast_0000000000000002:function(t,n){return A(t,n)},__wbindgen_init_externref_table:function(){let t=i.__wbindgen_externrefs,n=t.grow(4);t.set(0,void 0),t.set(n+0,void 0),t.set(n+1,null),t.set(n+2,!0),t.set(n+3,!1)}}}}var C=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>i.__wbg_interpreter_free(e,1)),L=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>i.__wbg_page_free(e,1));function b(e,t){if(!(e instanceof t))throw new Error(`expected instance of ${t.name}`)}function X(e,t){return e=e>>>0,l().subarray(e/1,e/1+t)}var g=null;function v(){return(g===null||g.buffer.detached===!0||g.buffer.detached===void 0&&g.buffer!==i.memory.buffer)&&(g=new DataView(i.memory.buffer)),g}function A(e,t){return K(e>>>0,t)}var h=null;function l(){return(h===null||h.byteLength===0)&&(h=new Uint8Array(i.memory.buffer)),h}function Q(e,t){let n=t(e.length*1,1)>>>0;return l().set(e,n/1),y=e.length,n}function V(e,t,n){if(n===void 0){let c=P.encode(e),_=t(c.length,1)>>>0;return l().subarray(_,_+c.length).set(c),y=c.length,_}let r=e.length,s=t(r,1)>>>0,o=l(),a=0;for(;a<r;a++){let c=e.charCodeAt(a);if(c>127)break;o[s+a]=c}if(a!==r){a!==0&&(e=e.slice(a)),s=n(s,r,r=a+e.length*3,1)>>>0;let c=l().subarray(s+a,s+r),_=P.encodeInto(e,c);a+=_.written,s=n(s,r,a,1)>>>0}return y=a,s}function S(e){let t=i.__wbindgen_externrefs.get(e);return i.__externref_table_dealloc(e),t}var D=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});D.decode();var J=2146435072,E=0;function K(e,t){return E+=t,E>=J&&(D=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),D.decode(),E=t),D.decode(l().subarray(e,e+t))}var P=new TextEncoder;"encodeInto"in P||(P.encodeInto=function(e,t){let n=P.encode(e);return t.set(n),{read:e.length,written:n.length}});var y=0,Z,q,i;function ee(e,t){return q=e,i=e.exports,Z=t,g=null,h=null,i.__wbindgen_start(),i}async function te(e,t){if(typeof Response=="function"&&e instanceof Response){if(!e.ok)throw new Error(`failed to fetch Wasm: ${e.status} ${e.statusText} fetching '${e.url}'`);if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(s){if(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",s);else throw s}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let r=await WebAssembly.instantiate(e,t);return r instanceof WebAssembly.Instance?{instance:r,module:e}:r}function n(r){switch(r){case"basic":case"cors":case"default":return!0}return!1}}async function G(e){if(i!==void 0)return i;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")),e===void 0&&(e=new URL("stet_wasm_bg.wasm",import.meta.url));let t=Y();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await te(await e,t);return ee(n,r)}var u=Object.freeze({maxFileBytes:33554432,maxPages:100,maxSourceDimension:1e5,maxCanvasDimension:8192,maxRenderedPixels:16777216,maxVmBytes:268435456,minDpi:36,maxDpi:300,workerTimeoutMs:3e4}),d=(e,t,n,r)=>{let s=Number(e);return Number.isFinite(s)?Math.min(r,Math.max(n,Math.floor(s))):t},j=(e={})=>{let t=d(e.minDpi,u.minDpi,18,300),n=Math.max(t,d(e.maxDpi,u.maxDpi,36,600));return{maxFileBytes:d(e.maxFileBytes,u.maxFileBytes,1,64*1024*1024),maxPages:d(e.maxPages,u.maxPages,1,500),maxSourceDimension:d(e.maxSourceDimension,u.maxSourceDimension,1,1e6),maxCanvasDimension:d(e.maxCanvasDimension,u.maxCanvasDimension,1,16384),maxRenderedPixels:d(e.maxRenderedPixels,u.maxRenderedPixels,1,64*1024*1024),maxVmBytes:d(e.maxVmBytes,u.maxVmBytes,16*1024*1024,512*1024*1024),minDpi:t,maxDpi:n,workerTimeoutMs:d(e.workerTimeoutMs,u.workerTimeoutMs,1e3,12e4)}};var T=self,p=class extends Error{constructor(n,r){super(r);this.code=n;this.name="PostscriptWorkerError"}code},R,I,O=()=>{I?.interpreter.free(),I=void 0},ne=e=>{if(e.byteLength<4)return!1;let t=new Uint8Array(e,0,Math.min(e.byteLength,32)),n=t[0]===37&&t[1]===33&&t[2]===80&&t[3]===83,r=t[0]===197&&t[1]===208&&t[2]===211&&t[3]===198;return n||r},re=(e,t,n)=>{let r=W(e,t);if(!r||r.length<3)throw new p("POSTSCRIPT_PAGE_INVALID",`PostScript page ${t+1} has no dimensions.`);let s=Number(r[0]),o=Number(r[1]),a=Number(r[2]);if(![s,o,a].every(Number.isFinite)||s<=0||o<=0||a<=0)throw new p("POSTSCRIPT_PAGE_INVALID",`PostScript page ${t+1} reports invalid dimensions.`);if(s>n.maxSourceDimension||o>n.maxSourceDimension)throw new p("POSTSCRIPT_PAGE_DIMENSION_LIMIT",`PostScript page ${t+1} exceeds the ${n.maxSourceDimension}-unit source-dimension limit.`);let c=n.minDpi/a,_=Math.max(1,Math.round(s*c)),m=Math.max(1,Math.round(o*c));if(_>n.maxCanvasDimension||m>n.maxCanvasDimension||_*m>n.maxRenderedPixels)throw new p("POSTSCRIPT_PAGE_RASTER_LIMIT",`PostScript page ${t+1} cannot fit the configured raster limits even at ${n.minDpi} DPI.`);return{index:t,width:s,height:o,referenceDpi:a}},se=async(e,t,n,r)=>{O();let s=j(r);if(e.byteLength>s.maxFileBytes)throw new p("POSTSCRIPT_FILE_LIMIT",`PostScript source exceeds the ${s.maxFileBytes}-byte safety limit.`);if(!ne(e))throw new p("POSTSCRIPT_SIGNATURE_INVALID","The source is not an Adobe PostScript document or DOS EPS container.");if(R&&R!==n)throw new p("POSTSCRIPT_WASM_URL_CHANGED","A PostScript Worker cannot switch WebAssembly binaries after initialization.");R||(await G({module_or_path:n}),R=n);let o=k();$(o,s.maxVmBytes);try{for(N(o,new Uint8Array(e),72,t);F(o);){if(M(o)>=s.maxPages)throw new p("POSTSCRIPT_PAGE_LIMIT",`PostScript execution reached the ${s.maxPages}-page safety limit before the program ended.`);U(o),await new Promise(w=>setTimeout(w,0))}let c=M(o);if(c<1)throw new p("POSTSCRIPT_EMPTY","The PostScript program did not produce a page.");if(c>s.maxPages)throw new p("POSTSCRIPT_PAGE_LIMIT",`PostScript output exceeds the ${s.maxPages}-page safety limit.`);let _=Array.from({length:c},(m,w)=>re(o,w,s));return I={interpreter:o,limits:s,pages:_},{engine:"stet-wasm",engineVersion:"0.8.7",renderBackend:"cpu-tiny-skia",colorProfile:"CGATS001Compat-v2-micro (CC0)",fontSubstitutes:["URW Base35 (OFL-1.1)"],pages:_}}catch(a){throw o.free(),a}},ie=(e,t)=>{if(!I)throw new p("POSTSCRIPT_NOT_OPEN","The PostScript Worker has no open document.");let{interpreter:n,limits:r,pages:s}=I;if(!Number.isSafeInteger(e)||e<0||e>=s.length)throw new p("POSTSCRIPT_PAGE_RANGE",`PostScript page index ${e} is outside 0..${s.length-1}.`);if(!Number.isFinite(t)||t<r.minDpi||t>r.maxDpi)throw new p("POSTSCRIPT_DPI_LIMIT",`PostScript render DPI must be between ${r.minDpi} and ${r.maxDpi}.`);let o=s[e],a=t/o.referenceDpi,c=Math.max(1,Math.round(o.width*a)),_=Math.max(1,Math.round(o.height*a));if(c>r.maxCanvasDimension||_>r.maxCanvasDimension)throw new p("POSTSCRIPT_CANVAS_DIMENSION_LIMIT",`PostScript raster ${c}\xD7${_} exceeds the ${r.maxCanvasDimension}-pixel canvas dimension limit.`);if(c*_>r.maxRenderedPixels)throw new p("POSTSCRIPT_PIXEL_LIMIT",`PostScript raster ${c}\xD7${_} exceeds the ${r.maxRenderedPixels}-pixel limit.`);let m=B(n,e,0,0,o.width,o.height,c,_);try{let w=m.rgba,H=new Uint8ClampedArray(w.buffer,w.byteOffset,w.byteLength);return{pageIndex:e,dpi:t,width:m.width,height:m.height,rgba:H}}finally{m.free()}},oe=e=>e instanceof p||e instanceof Error&&"code"in e&&typeof e.code=="string"?e.code:"POSTSCRIPT_ENGINE_FAILURE",ae=async e=>{try{if(e.type==="open"){let r=await se(e.buffer,e.filename,e.wasmUrl,e.limits),s={id:e.id,ok:!0,type:"open",result:r};T.postMessage(s);return}if(e.type==="destroy"){O();let r={id:e.id,ok:!0,type:"destroy"};T.postMessage(r);return}let t=ie(e.pageIndex,e.dpi),n={id:e.id,ok:!0,type:"renderPage",result:t};T.postMessage(n,[t.rgba.buffer])}catch(t){let n=oe(t);e.type==="open"&&O();let r={id:e.id,ok:!1,error:{name:t instanceof Error?t.name:"Error",code:n,message:t instanceof Error?t.message:String(t),fatal:e.type==="open"||n==="POSTSCRIPT_ENGINE_FAILURE"}};T.postMessage(r)}},z=Promise.resolve();T.addEventListener("message",e=>{z=z.catch(()=>{}).then(()=>ae(e.data))});