MindMap/frontend/node_modules/pdfjs-dist/legacy/image_decoders/pdf.image_decoders.min.mjs

28 lines
146 KiB
JavaScript
Raw Normal View History

/**
* @licstart The following is the entire license notice for the
* JavaScript code in this page
*
* Copyright 2024 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @licend The above is the entire license notice for the
* JavaScript code in this page
*/
/**
* pdfjsVersion = 5.4.149
* pdfjsBuild = 9e2e9e209
*/var e={34:(e,t,r)=>{var n=r(4901);e.exports=function(e){return"object"==typeof e?null!==e:n(e)}},81:(e,t,r)=>{var n=r(9565),i=r(9306),o=r(8551),s=r(6823),a=r(851),c=TypeError;e.exports=function(e,t){var r=arguments.length<2?a(e):t;if(i(r))return o(n(r,e));throw new c(s(e)+" is not iterable")}},283:(e,t,r)=>{var n=r(9504),i=r(9039),o=r(4901),s=r(9297),a=r(3724),c=r(350).CONFIGURABLE,f=r(3706),u=r(1181),l=u.enforce,h=u.get,d=String,p=Object.defineProperty,m=n("".slice),g=n("".replace),y=n([].join),b=a&&!i((function(){return 8!==p((function(){}),"length",{value:8}).length})),w=String(String).split("String"),v=e.exports=function(e,t,r){"Symbol("===m(d(t),0,7)&&(t="["+g(d(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]");r&&r.getter&&(t="get "+t);r&&r.setter&&(t="set "+t);(!s(e,"name")||c&&e.name!==t)&&(a?p(e,"name",{value:t,configurable:!0}):e.name=t);b&&r&&s(r,"arity")&&e.length!==r.arity&&p(e,"length",{value:r.arity});try{r&&s(r,"constructor")&&r.constructor?a&&p(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var n=l(e);s(n,"source")||(n.source=y(w,"string"==typeof t?t:""));return e};Function.prototype.toString=v((function toString(){return o(this)&&h(this).source||f(this)}),"toString")},350:(e,t,r)=>{var n=r(3724),i=r(9297),o=Function.prototype,s=n&&Object.getOwnPropertyDescriptor,a=i(o,"name"),c=a&&"something"===function something(){}.name,f=a&&(!n||n&&s(o,"name").configurable);e.exports={EXISTS:a,PROPER:c,CONFIGURABLE:f}},397:(e,t,r)=>{var n=r(7751);e.exports=n("document","documentElement")},421:e=>{e.exports={}},456:(e,t,r)=>{var n=r(6518),i=r(4576),o=r(9504),s=r(4154),a=r(5169),c=o(1.1.toString),f=i.Uint8Array,u=!f||!f.prototype.toHex||!function(){try{return"ffffffffffffffff"===new f([255,255,255,255,255,255,255,255]).toHex()}catch(e){return!1}}();f&&n({target:"Uint8Array",proto:!0,forced:u},{toHex:function toHex(){s(this);a(this.buffer);for(var e="",t=0,r=this.length;t<r;t++){var n=c(this[t],16);e+=1===n.length?"0"+n:n}return e}})},507:(e,t,r)=>{var n=r(9565);e.exports=function(e,t,r){for(var i,o,s=r?e:e.iterator,a=e.next;!(i=n(a,s)).done;)if(void 0!==(o=t(i.value)))return o}},616:(e,t,r)=>{var n=r(9039);e.exports=!n((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},655:(e,t,r)=>{var n=r(6955),i=String;e.exports=function(e){if("Symbol"===n(e))throw new TypeError("Cannot convert a Symbol value to a string");return i(e)}},679:(e,t,r)=>{var n=r(1625),i=TypeError;e.exports=function(e,t){if(n(t,e))return e;throw new i("Incorrect invocation")}},684:e=>{e.exports=function(e,t){var r="function"==typeof Iterator&&Iterator.prototype[e];if(r)try{r.call({next:null},t).next()}catch(e){return!0}}},741:e=>{var t=Math.ceil,r=Math.floor;e.exports=Math.trunc||function trunc(e){var n=+e;return(n>0?r:t)(n)}},757:(e,t,r)=>{var n=r(7751),i=r(4901),o=r(1625),s=r(7040),a=Object;e.exports=s?function(e){return"symbol"==typeof e}:function(e){var t=n("Symbol");return i(t)&&o(t.prototype,a(e))}},851:(e,t,r)=>{var n=r(6955),i=r(5966),o=r(4117),s=r(6269),a=r(8227)("iterator");e.exports=function(e){if(!o(e))return i(e,a)||i(e,"@@iterator")||s[n(e)]}},944:e=>{var t=TypeError;e.exports=function(e){var r=e&&e.alphabet;if(void 0===r||"base64"===r||"base64url"===r)return r||"base64";throw new t("Incorrect `alphabet` option")}},1072:(e,t,r)=>{var n=r(1828),i=r(8727);e.exports=Object.keys||function keys(e){return n(e,i)}},1103:e=>{e.exports=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}}},1108:(e,t,r)=>{var n=r(6955);e.exports=function(e){var t=n(e);return"BigInt64Array"===t||"BigUint64Array"===t}},1148:(e,t,r)=>{var n=r(6518),i=r(9565),o=r(2652),s=r(9306),a=r(8551),c=r(1767),f=r(9539),u=r(4549)("every",TypeError);n({target:"Iterator",proto:!0,real:!0,forced:u},{every:function every(e){a(this);try{s(e)}catch(e){f(this,"throw",e)}if(u)return i(u,this,e);var t=c(this),r=0;return!o(t,(function(t,n){if(!e(t,r++))return n()}),{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},1181:(e,t,r)=>{var n,i,o,s=r(8622),a=r(4576),c=r(34),f=r(6699),u=r(9297),l=r(7629),h=r(6119),d=r
/*webpackIgnore: true*/
/*@vite-ignore*/
t)).default()}catch(e){util_warn(`JpxImage#getJsModule: ${e}`)}e(r)}static async#U(e,t,r){const n="openjpeg.wasm";try{this.#T||(this.#P?this.#T=await async function fetchBinaryData(e){const t=await fetch(e);if(!t.ok)throw new Error(`Failed to fetch file "${e}" with "${t.statusText}".`);return new Uint8Array(await t.arrayBuffer())}(`${this.#A}${n}`):this.#T=await this.#D.sendWithPromise("FetchBinaryData",{type:"wasmFactory",filename:n}));return r((await WebAssembly.instantiate(this.#T,t)).instance)}catch(t){util_warn(`JpxImage#instantiateWasm: ${t}`);this.#O(e);return null}finally{this.#D=null}}static async decode(e,{numComponents:t=4,isIndexedColormap:r=!1,smaskInData:n=!1,reducePower:i=0}={}){if(!this.#M){const{promise:e,resolve:t}=Promise.withResolvers(),r=[e];this.#S?r.push(G({warn:util_warn,instantiateWasm:this.#U.bind(this,t)})):this.#O(t);this.#M=Promise.race(r)}const o=await this.#M;if(!o)throw new JpxError("OpenJPEG failed to initialize");let s;try{const a=e.length;s=o._malloc(a);o.writeArrayToMemory(e,s);if(o._jp2_decode(s,a,t>0?t:0,!!r,!!n,i)){const{errorMessages:e}=o;if(e){delete o.errorMessages;throw new JpxError(e)}throw new JpxError("Unknown error")}const{imageData:c}=o;o.imageData=null;return c}finally{s&&o._free(s)}}static cleanup(){this.#M=null}static parseImageProperties(e){if(!(e instanceof ArrayBuffer||ArrayBuffer.isView(e)))throw new JpxError("Invalid data format, must be a TypedArray.");let t=(e=new Stream(e)).getByte();for(;t>=0;){const r=t;t=e.getByte();if(65361===(r<<8|t)){e.skip(4);const t=e.getInt32()>>>0,r=e.getInt32()>>>0,n=e.getInt32()>>>0,i=e.getInt32()>>>0;e.skip(16);return{width:t-n,height:r-i,bitsPerComponent:8,componentsCount:e.getUint16()}}}throw new JpxError("No size marker found in JPX stream")}}globalThis.pdfjsImageDecoders={getVerbosityLevel,Jbig2Error,Jbig2Image,JpegError,JpegImage,JpxError,JpxImage,setVerbosityLevel,VerbosityLevel:r};export{Jbig2Error,Jbig2Image,JpegError,JpegImage,JpxError,JpxImage,r as VerbosityLevel,getVerbosityLevel,setVerbosityLevel};