Files
fad_oa/ruoyi-ui/public/file-viewer/assets/wasm-C3ukMqzA.js

1 line
1.8 KiB
JavaScript

var e=class{loadedFonts=new Set;fetcher=fetch;setFetcher(e){this.fetcher=e}async loadFonts(e,t){let r=Function(`m`,`return import(m)`),i=this.fetcher||=await(async function(){let{fetchBuilder:e,FileSystemCache:t}=await r(`node-fetch-cache`),n=new t({cacheDirectory:`.cache/typst/fonts`}),i=e.withCache(n);return function(e,t){let n=setTimeout(()=>{console.warn(`font fetching is stucking:`,e)},15e3);return i(e,t).finally(()=>{clearTimeout(n)})}})(),a=t.filter(e=>e instanceof Uint8Array||typeof e==`object`&&`info`in e?!0:this.loadedFonts.has(e)?!1:(this.loadedFonts.add(e),!0)),o=await Promise.all(a.map(async t=>{if(t instanceof Uint8Array){await e.add_raw_font(t);return}if(typeof t==`object`&&`info`in t){await e.add_lazy_font(t,`blob`in t?t.blob:n(t));return}return new Uint8Array(await(await i(t)).arrayBuffer())}));for(let t of o)t&&await e.add_raw_font(t)}async build(e,t,n){let r={ref:this,builder:t,hooks:n};for(let t of e?.beforeBuild??[])await t(void 0,r);return n.latelyBuild&&n.latelyBuild(r),await t.build()}};async function t(t,n,r,i){return await n.init(t?.getModule?.()),await new e().build(t,new r,i)}function n(e){return()=>{let t=new XMLHttpRequest;return t.overrideMimeType(`text/plain; charset=x-user-defined`),t.open(`GET`,e.url,!1),t.send(null),t.status===200&&(t.response instanceof String||typeof t.response==`string`)?Uint8Array.from(t.response,e=>e.charCodeAt(0)):new Uint8Array}}var r=Symbol.for(`reflexo-obj`),i;(function(e){e[e.PIXEL_PER_PT=3]=`PIXEL_PER_PT`})(i||={});var a=e=>{let t=!1,n;return()=>t?n:(t=!0,n=e())},o=class{wasmBin;initOnce;constructor(e){if(typeof e!=`function`)throw Error(`initFn is not a function`);this.initOnce=a(async()=>{await e(this.wasmBin)})}async init(e){this.wasmBin=e,await this.initOnce()}};export{n as a,t as i,i as n,r,o as t};