S2OJ/web/js/pdf.js

23 lines
266 KiB
JavaScript
Raw Normal View History

2023-01-30 12:27:53 +00:00
/**
* @licstart The following is the entire license notice for the
* JavaScript code in this page
*
* Copyright 2023 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
*/
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("pdfjs-dist/build/pdf",[],e):"object"==typeof exports?exports["pdfjs-dist/build/pdf"]=e():t["pdfjs-dist/build/pdf"]=t.pdfjsLib=e()}(globalThis,(()=>(()=>{"use strict";var __webpack_modules__=[,(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.VerbosityLevel=e.Util=e.UnknownErrorException=e.UnexpectedResponseException=e.UNSUPPORTED_FEATURES=e.TextRenderingMode=e.RenderingIntentFlag=e.PermissionFlag=e.PasswordResponses=e.PasswordException=e.PageActionEventType=e.OPS=e.MissingPDFException=e.LINE_FACTOR=e.LINE_DESCENT_FACTOR=e.InvalidPDFException=e.ImageKind=e.IDENTITY_MATRIX=e.FormatError=e.FeatureTest=e.FONT_IDENTITY_MATRIX=e.DocumentActionEventType=e.CMapCompressionType=e.BaseException=e.BASELINE_FACTOR=e.AnnotationType=e.AnnotationStateModelType=e.AnnotationReviewState=e.AnnotationReplyType=e.AnnotationMode=e.AnnotationMarkedState=e.AnnotationFlag=e.AnnotationFieldFlag=e.AnnotationEditorType=e.AnnotationEditorPrefix=e.AnnotationEditorParamsType=e.AnnotationBorderStyleType=e.AnnotationActionEventType=e.AbortException=void 0,e.arrayByteLength=c,e.arraysToBytes=function(t){const e=t.length;if(1===e&&t[0]instanceof Uint8Array)return t[0];let s=0;for(let i=0;i<e;i++)s+=c(t[i]);let i=0;const n=new Uint8Array(s);for(let s=0;s<e;s++){let e=t[s];e instanceof Uint8Array||(e="string"==typeof e?l(e):new Uint8Array(e));const r=e.byteLength;n.set(e,i),i+=r}return n},e.assert=function(t,e){t||r(e)},e.bytesToString=function(t){"object"==typeof t&&null!==t&&void 0!==t.length||r("Invalid argument for bytesToString");const e=t.length,s=8192;if(e<s)return String.fromCharCode.apply(null,t);const i=[];for(let n=0;n<e;n+=s){const r=Math.min(n+s,e),a=t.subarray(n,r);i.push(String.fromCharCode.apply(null,a))}return i.join("")},e.createPromiseCapability=function(){const t=Object.create(null);let e=!1;return Object.defineProperty(t,"settled",{get:()=>e}),t.promise=new Promise((function(s,i){t.resolve=function(t){e=!0,s(t)},t.reject=function(t){e=!0,i(t)}})),t},e.createValidAbsoluteUrl=function(t,e=null,s=null){if(!t)return null;try{if(s&&"string"==typeof t){if(s.addDefaultProtocol&&t.startsWith("www.")){const e=t.match(/\./g);e&&e.length>=2&&(t=`http://${t}`)}if(s.tryConvertEncoding)try{t=p(t)}catch(t){}}const i=e?new URL(t,e):new URL(t);if(function(t){if(!t)return!1;switch(t.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(i))return i}catch(t){}return null},e.getModificationDate=function(t=new Date){return[t.getUTCFullYear().toString(),(t.getUTCMonth()+1).toString().padStart(2,"0"),t.getUTCDate().toString().padStart(2,"0"),t.getUTCHours().toString().padStart(2,"0"),t.getUTCMinutes().toString().padStart(2,"0"),t.getUTCSeconds().toString().padStart(2,"0")].join("")},e.getVerbosityLevel=function(){return i},e.info=function(t){i>=s.INFOS&&console.log(`Info: ${t}`)},e.isArrayBuffer=function(t){return"object"==typeof t&&null!==t&&void 0!==t.byteLength},e.isArrayEqual=function(t,e){if(t.length!==e.length)return!1;for(let s=0,i=t.length;s<i;s++)if(t[s]!==e[s])return!1;return!0},e.objectFromMap=function(t){const e=Object.create(null);for(const[s,i]of t)e[s]=i;return e},e.objectSize=function(t){return Object.keys(t).length},e.setVerbosityLevel=function(t){Number.isInteger(t)&&(i=t)},e.shadow=a,e.string32=function(t){return String.fromCharCode(t>>24&255,t>>16&255,t>>8&255,255&t)},e.stringToBytes=l,e.stringToPDFString=function(t){if(t[0]>="ï"){let e;if("þ"===t[0]&&"ÿ"===t[1]?e="utf-16be":"ÿ"===t[0]&&"þ"===t[1]?e="utf-16le":"ï"===t[0]&&"»"===t[1]&&"¿"===t[2]&&(e="utf-8"),e)try{const s=new TextDecoder(e,{fatal:!0}),i=l(t);return s.decode(i)}catch(t){n(`stringToPDFString: "${t}".`)}}const e=[];for(let s=0,i=t.length;s<i;s++){const i=u[t.charCodeAt(s)];e.push(i?String.fromCharCode(i):t.charAt(s))}return e.join("")},e.stringToUTF8String=p,e.unreachable=r,e.utf8StringToString=function(t){return unescape(encodeURIComponent(t))},e.warn=n;e.IDENTITY_MATRIX=[1,0,0,1,0,0];e.F