/* THIS IS A GENERATED/BUNDLED FILE BY ESBUILD if you want to view the source, please visit the github repository of this plugin */ var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var __publicField = (obj, key, value) => { __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); return value; }; var __accessCheck = (obj, member, msg) => { if (!member.has(obj)) throw TypeError("Cannot " + msg); }; var __privateGet = (obj, member, getter) => { __accessCheck(obj, member, "read from private field"); return getter ? getter.call(obj) : member.get(obj); }; var __privateAdd = (obj, member, value) => { if (member.has(obj)) throw TypeError("Cannot add the same private member more than once"); member instanceof WeakSet ? member.add(obj) : member.set(obj, value); }; var __privateSet = (obj, member, value, setter) => { __accessCheck(obj, member, "write to private field"); setter ? setter.call(obj, value) : member.set(obj, value); return value; }; var __privateWrapper = (obj, member, setter, getter) => ({ set _(value) { __privateSet(obj, member, value, setter); }, get _() { return __privateGet(obj, member, getter); } }); var __privateMethod = (obj, member, method) => { __accessCheck(obj, member, "access private method"); return method; }; // node_modules/@obsidian-ai-providers/sdk/dist/index.js var require_dist = __commonJS({ "node_modules/@obsidian-ai-providers/sdk/dist/index.js"(exports, module2) { var __defProp2 = Object.defineProperty; var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; var __getOwnPropNames2 = Object.getOwnPropertyNames; var __hasOwnProp2 = Object.prototype.hasOwnProperty; var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); var __export2 = (target, all) => { for (var name in all) __defProp2(target, name, { get: all[name], enumerable: true }); }; var __copyProps2 = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames2(from)) if (!__hasOwnProp2.call(to, key) && key !== except) __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var sdk_exports = {}; __export2(sdk_exports, { initAI: () => initAI2, waitForAI: () => waitForAI3 }); module2.exports = __toCommonJS2(sdk_exports); var import_obsidian4 = require("obsidian"); var FALLBACK_TIMEOUT = 100; var REQUIRED_AI_PROVIDERS_VERSION = 3; var AI_PROVIDERS_READY_EVENT = "ai-providers-ready"; var aiProvidersReadyAiResolver = null; async function waitForAIProviders(app, plugin) { if (aiProvidersReadyAiResolver) { return aiProvidersReadyAiResolver; } const abortController = new AbortController(); let aiProvidersReady = /* @__PURE__ */ __name(() => { }, "aiProvidersReady"); const result = { promise: new Promise((resolve, reject) => { aiProvidersReady = /* @__PURE__ */ __name(() => { app.workspace.off(AI_PROVIDERS_READY_EVENT, aiProvidersReady); aiProvidersReadyAiResolver = null; resolve(app.aiProviders); }, "aiProvidersReady"); if (app.aiProviders) { aiProvidersReady(); } else { const eventRef = app.workspace.on( AI_PROVIDERS_READY_EVENT, aiProvidersReady ); plugin.registerEvent(eventRef); } abortController.signal.addEventListener("abort", () => { app.workspace.off(AI_PROVIDERS_READY_EVENT, aiProvidersReady); aiProvidersReadyAiResolver = null; reject(new Error("Waiting for AI Providers was cancelled")); }); }), cancel: () => abortController.abort() }; if (!app.aiProviders) { aiProvidersReadyAiResolver = result; } return result; } __name(waitForAIProviders, "waitForAIProviders"); var _AIProvidersManager = class { constructor(app, plugin) { this.app = app; this.plugin = plugin; } static getInstance(app, plugin) { if (!this.instance) { if (!app || !plugin) { throw new Error( "AIProvidersManager not initialized. Call initialize() first" ); } this.instance = new _AIProvidersManager(app, plugin); } return this.instance; } static reset() { this.instance = null; } getApp() { return this.app; } getPlugin() { return this.plugin; } }; var AIProvidersManager = _AIProvidersManager; __name(AIProvidersManager, "AIProvidersManager"); AIProvidersManager.instance = null; async function initAI2(app, plugin, onDone, options) { AIProvidersManager.getInstance(app, plugin); let isFallbackShown = false; if (options == null ? void 0 : options.disableFallback) { await onDone(); return; } try { const timeout = setTimeout(async () => { plugin.addSettingTab( new AIProvidersFallbackSettingsTab(app, plugin) ); isFallbackShown = true; }, FALLBACK_TIMEOUT); const aiProvidersAiResolver = await waitForAIProviders(app, plugin); const aiProviders = await aiProvidersAiResolver.promise; clearTimeout(timeout); try { aiProviders.checkCompatibility(REQUIRED_AI_PROVIDERS_VERSION); } catch (error) { console.error(`AI Providers compatibility check failed: ${error}`); if (error.code === "version_mismatch") { plugin.addSettingTab( new AIProvidersFallbackSettingsTab(app, plugin) ); throw new Error( `AI Providers version ${REQUIRED_AI_PROVIDERS_VERSION} is required` ); } throw error; } await onDone(); } finally { if (isFallbackShown && app.plugins) { await app.plugins.disablePlugin(plugin.manifest.id); await app.plugins.enablePlugin(plugin.manifest.id); } } } __name(initAI2, "initAI"); async function waitForAI3() { const manager = AIProvidersManager.getInstance(); return waitForAIProviders(manager.getApp(), manager.getPlugin()); } __name(waitForAI3, "waitForAI"); var AIProvidersFallbackSettingsTab = class extends import_obsidian4.PluginSettingTab { constructor(app, plugin) { super(app, plugin); this.plugin = plugin; } async display() { const { containerEl } = this; containerEl.empty(); const aiProvidersNotice = containerEl.createEl("div"); aiProvidersNotice.addClass("ai-providers-notice"); aiProvidersNotice.appendChild( (0, import_obsidian4.sanitizeHTMLToDom)(`
\u26A0\uFE0F This plugin requires AI Providers plugin to be installed.
Please install and configure AI Providers plugin first.
`) ); } }; __name(AIProvidersFallbackSettingsTab, "AIProvidersFallbackSettingsTab"); } }); // src/main.ts var main_exports = {}; __export(main_exports, { default: () => LocalGPT }); module.exports = __toCommonJS(main_exports); var import_obsidian3 = require("obsidian"); // src/LocalGPTSettingTab.ts var import_obsidian = require("obsidian"); // src/defaultSettings.ts var DEFAULT_SETTINGS = { aiProviders: { main: null, embedding: null, vision: null }, defaults: { creativity: "low", contextLimit: "local" }, actions: [ { name: "\u{1FA84} General help", prompt: "", system: "You are an assistant helping a user write more content in a document based on a prompt. Output in markdown format. Do not use links. Do not include literal content from the original document." }, { name: "\u270D\uFE0F Continue writing", prompt: "Act as a professional editor with many years of experience as a writer. Carefully finalize the following text, add details, use facts and make sure that the meaning and original style are preserved. Purposely write in detail, with examples, so that your reader is comfortable, even if they don't understand the specifics. Don't use clericalisms, evaluations without proof with facts, passive voice. Use Markdown markup language for formatting. Answer only content and nothing else, no introductory words, only substance.", system: "You are an AI assistant that follows instruction extremely well. Help as much as you can." }, { name: "\u{1F36D} Summarize", prompt: "Make a concise summary of the key points of the following text.", system: "You are an AI assistant that follows instruction extremely well. Help as much as you can." }, { name: "\u{1F4D6} Fix spelling and grammar", prompt: "Proofread the below for spelling and grammar.", system: "You are an AI assistant that follows instruction extremely well. Help as much as you can.", replace: true }, { name: "\u2705 Find action items", prompt: 'Act as an assistant helping find action items inside a document. An action item is an extracted task or to-do found inside of an unstructured document. Use Markdown checkbox format: each line starts with "- [ ] "', system: "You are an AI assistant that follows instruction extremely well. Help as much as you can." }, { name: "\u{1F9E0} New System Prompt", prompt: "", system: `You are a highly skilled AI prompt engineer with expertise in creating tailored prompts for a wide range of professional roles. You have a deep knowledge of how to craft prompts that effectively guide the language model to produce high-quality, contextually appropriate responses. Your task is to generate a custom system prompt for different roles based on user input. This involves understanding the specific requirements of each role, the context in which the prompt will be used, and the desired output format. You are skilled in structuring prompts that ensure clarity, relevance, and utility. Create a custom system prompt for an LLM to assist users in generating contextually appropriate and highly effective responses for various roles. The prompt should provide clear instructions to the LLM on how to handle specific scenarios related to the role, including the tone and format of the response. Start by providing a role "You are..." and context as a summary of the situation or background information relevant to the prompt. Define the main objective, outlining what the LLM needs to accomplish. Include instructions on the appropriate style and tone (e.g., formal, casual, technical, empathetic) based on the role and audience. Identify the target audience to tailor the LLM's output effectively. Specify the format of the response, whether it should be a narrative, bullet points, step-by-step guide, code, or another format. Avoid using headings or examples; the prompt should read as a continuous, cohesive set of instructions. ANSWER PROMPT AND NOTHING ELSE!` } ], _version: 8 }; var CREATIVITY = { "": { temperature: 0 }, low: { temperature: 0.2 }, medium: { temperature: 0.5 }, high: { temperature: 1 } }; var SELECTION_KEYWORD = "{{=SELECTION=}}"; var CONTEXT_KEYWORD = "{{=CONTEXT=}}"; var CONTEXT_CONDITION_START = "{{=CONTEXT_START=}}"; var CONTEXT_CONDITION_END = "{{=CONTEXT_END=}}"; // src/LocalGPTSettingTab.ts var import_sdk = __toESM(require_dist()); // src/i18n/de.json var de_default = { commands: { showContextMenu: "Kontextmen\xFC anzeigen", actionPalette: { name: "Aktionspalette", placeholder: "Ihr Prompt... | Enter: senden, Esc: abbrechen", changeProvider: "KI\u2011Provider wechseln", changeModel: "Modell wechseln", changeCreativity: "Kreativit\xE4t \xE4ndern", changeSystemPrompt: "System-Prompt wechseln", unknownModel: "Unbekanntes Modell" } }, statusBar: { enhancing: "\u2728 Verbessern", enhancingWithProgress: "\u2728 Verbessern {{percent}}%" }, notices: { errorGenerating: "Fehler bei der Texterzeugung: {{message}}", errorProcessingRag: "Fehler bei der Verarbeitung verkn\xFCpfter Dokumente: {{message}}. Fahre mit dem Originaltext fort.", importantUpdate: "\uFE0F\u{1F6A8} WICHTIG! Aktualisiere die Local GPT Einstellungen!", newVersion: "\u2B06\uFE0F Local GPT: Eine neue Version ist verf\xFCgbar", actionNameRequired: "Bitte gib einen Namen f\xFCr die Aktion ein.", actionNameExists: 'Eine Aktion mit dem Namen "{{name}}" existiert bereits.', actionRewritten: 'Aktion "{{name}}" \xFCberschrieben', actionAdded: 'Aktion "{{name}}" hinzugef\xFCgt', copied: "Kopiert" }, settings: { mainProvider: "Haupt-AI-Provider", embeddingProvider: "Embedding AI Provider", embeddingProviderDesc: "Optional. Wird f\xFCr \u2728\xA0Erweiterte\xA0Aktionen.", visionProvider: "Vision AI Provider", visionProviderDesc: "Optional. Dies wird f\xFCr Bilder verwendet. Wenn nicht festgelegt, wird der Haupt-AI-Provider verwendet.", creativity: "Kreativit\xE4t", creativityNone: "\u26AA Keine", creativityLow: "\uFE0F\u{1F4A1} Niedrig", creativityMedium: "\u{1F3A8} Mittel", creativityHigh: "\u{1F680} Hoch", actions: "Aktionen", quickAdd: "Schnell hinzuf\xFCgen", quickAddPlaceholder: "Aktion einf\xFCgen", quickAddDesc: 'Sie k\xF6nnen die besten S\xE4tze von Prompts teilen oder einen aus der Community erhalten.=0&&V>5&7,g=[n&31],o=A+6;if(n===7){r=le(e,o-1)&536870911,o+=3;let C=r+7>>3;for(g[0]=e[o++];--C>0;)g.push(e[o++])}else if(n===5||n===6)throw new oe("invalid referred-to flags");t.retainBits=g;let I=4;t.number<=256?I=1:t.number<=65536&&(I=2);let c=[],l,h;for(l=0;l0&&this.rootNode.buildTree(a,a.prefixLength-1)}}decode(A){return this.rootNode.decodeNode(A)}assignPrefixCodes(A){let t=A.length,i=0;for(let I=0;I>2,g=new Uint32Array(e.buffer,A,r);if(Ot.isLittleEndian){for(;n>o-s)&C,o-=s,g=g<=8&&(i[Q++]=g>>I-8&255,I-=8);I>0&&(i[Q++]=(g<<8-I)+(r&(1<<8-I)-1))}this.bufferLength+=A}readBlockPng(){let A=this.rowBytes,t=this.pixBytes,i=this.str.getByte(),s=this.str.getBytes(A);if(this.eof=!s.length,this.eof)return;let a=this.bufferLength,n=this.ensureBuffer(a+A),r=n.subarray(a-A,a);r.length===0&&(r=new Uint8Array(A));let g,o=a,I,c;switch(i){case 0:for(g=0;g>1)+s[g];for(;g>1)+s[g]&255,o++;break;case 4:for(g=0;g>")&&this.buf1!==Ge;){if(!(this.buf1 instanceof M)){PA("Malformed dictionary: key must be a name object"),this.shift();continue}let a=this.buf1.name;if(this.shift(),this.buf1===Ge)break;s.set(a,this.getObj(A))}if(this.buf1===Ge){if(this.recoveryMode)return s;throw new Sa("End of file inside dictionary.")}return Ne(this.buf2,"stream")?this.allowStreams?this.makeStream(s,A):s:(this.shift(),s);default:return t}if(Number.isInteger(t)){if(Number.isInteger(this.buf1)&&Ne(this.buf2,"R")){let i=oA.get(t,this.buf1);return this.shift(),this.shift(),i}return t}return typeof t=="string"&&A?A.decryptString(t):t}findDefaultInlineStreamEnd(A){let{knownCommands:g}=this.lexer,o=A.pos,I=15,c=0,l,h;for(;(l=A.getByte())!==-1;)if(c===0)c=l===69?1:0;else if(c===1)c=l===73?2:0;else if(l===32||l===10||l===13){h=A.pos;let B=A.peekBytes(I),Q=B.length;if(Q===0)break;for(let u=0;u127)){c=0;break}if(c!==2)continue;if(!g){k("findDefaultInlineStreamEnd - `lexer.knownCommands` is undefined.");continue}let E=new dt(new Ie(B.slice()),g);E._hexStringWarn=()=>{};let f=0;for(;;){let u=E.getObj();if(u===Ge){c=0;break}if(u instanceof fe){let d=g[u.cmd];if(d){if(d.variableArgs?f<=d.numArgs:f===d.numArgs)break}else{c=0;break}f=0;continue}f++}if(c===2)break}else c=0;l===-1&&(k("findDefaultInlineStreamEnd: Reached the end of the stream without finding a valid EI marker"),h&&(k(\'... trying to recover by using the last "EI" occurrence.\'),A.skip(-(A.pos-h))));let C=4;return A.skip(-C),l=A.peekByte(),A.skip(C),pt(l)||C--,A.pos-C-o}findDCTDecodeInlineStreamEnd(A){let t=A.pos,i=!1,s,a;for(;(s=A.getByte())!==-1;)if(s===255){switch(A.getByte()){case 0:break;case 255:A.skip(-1);break;case 217:i=!0;break;case 192:case 193:case 194:case 195:case 197:case 198:case 199:case 201:case 202:case 203:case 205:case 206:case 207:case 196:case 204:case 218:case 219:case 220:case 221:case 222:case 223:case 224:case 225:case 226:case 227:case 228:case 229:case 230:case 231:case 232:case 233:case 234:case 235:case 236:case 237:case 238:case 239:case 254:a=A.getUint16(),a>2?A.skip(a-2):A.skip(-2);break}if(i)break}let n=A.pos-t;return s===-1?(k("Inline DCTDecode image stream: EOI marker not found, searching for /EI/ instead."),A.skip(-n),this.findDefaultInlineStreamEnd(A)):(this.inlineStreamSkipEI(A),n)}findASCII85DecodeInlineStreamEnd(A){let s=A.pos,a;for(;(a=A.getByte())!==-1;)if(a===126){let r=A.pos;for(a=A.peekByte();pt(a);)A.skip(),a=A.peekByte();if(a===62){A.skip();break}if(A.pos>r){let g=A.peekBytes(2);if(g[0]===69&&g[1]===73)break}}let n=A.pos-s;return a===-1?(k("Inline ASCII85Decode image stream: EOD marker not found, searching for /EI/ instead."),A.skip(-n),this.findDefaultInlineStreamEnd(A)):(this.inlineStreamSkipEI(A),n)}findASCIIHexDecodeInlineStreamEnd(A){let i=A.pos,s;for(;(s=A.getByte())!==-1&&s!==62;);let a=A.pos-i;return s===-1?(k("Inline ASCIIHexDecode image stream: EOD marker not found, searching for /EI/ instead."),A.skip(-a),this.findDefaultInlineStreamEnd(A)):(this.inlineStreamSkipEI(A),a)}inlineStreamSkipEI(A){let s=0,a;for(;(a=A.getByte())!==-1;)if(s===0)s=a===69?1:0;else if(s===1)s=a===73?2:0;else if(s===2)break}makeInlineImage(A){let t=this.lexer,i=t.stream,s=Object.create(null),a;for(;!Ne(this.buf1,"ID")&&this.buf1!==Ge;){if(!(this.buf1 instanceof M))throw new v("Dictionary key must be a name object");let h=this.buf1.name;if(this.shift(),this.buf1===Ge)break;s[h]=this.getObj(A)}t.beginInlineImagePos!==-1&&(a=i.pos-t.beginInlineImagePos);let n=this.xref.fetchIfRef(s.F||s.Filter),r;if(n instanceof M)r=n.name;else if(Array.isArray(n)){let h=this.xref.fetchIfRef(n[0]);h instanceof M&&(r=h.name)}let g=i.pos,o;switch(r){case"DCT":case"DCTDecode":o=this.findDCTDecodeInlineStreamEnd(i);break;case"A85":case"ASCII85Decode":o=this.findASCII85DecodeInlineStreamEnd(i);break;case"AHx":case"ASCIIHexDecode":o=this.findASCIIHexDecodeInlineStreamEnd(i);break;default:o=this.findDefaultInlineStreamEnd(i)}let I;if(o
>>0;let g=a[n];for(let o=0,I=g.length;o=c&&s<=l){i.charcode=s,i.length=n+1;return}}}i.charcode=0,i.length=1}getCharCodeLength(A){let t=this.codespaceRanges;for(let i=0,s=t.length;i=g&&A<=o)return i+1}}return 1}get length(){return this._map.length}get isIdentityCMap(){if(!(this.name==="Identity-H"||this.name==="Identity-V")||this._map.length!==65536)return!1;for(let A=0;A<65536;A++)if(this._map[A]!==A)return!1;return!0}},Wi=class extends Na{constructor(A,t){super(),this.vertical=A,this.addCodespaceRange(t,0,65535)}mapCidRange(A,t,i){OA("should not call mapCidRange")}mapBfRange(A,t,i){OA("should not call mapBfRange")}mapBfRangeToArray(A,t,i){OA("should not call mapBfRangeToArray")}mapOne(A,t){OA("should not call mapCidOne")}lookup(A){return Number.isInteger(A)&&A<=65535?A:void 0}contains(A){return Number.isInteger(A)&&A<=65535}forEach(A){for(let t=0;t<=65535;t++)A(t,t)}charCodeOf(A){return Number.isInteger(A)&&A<=65535?A:-1}getMap(){let A=new Array(65536);for(let t=0;t<=65535;t++)A[t]=t;return A}get length(){return 65536}get isIdentityCMap(){OA("should not access .isIdentityCMap")}};function ji(e){let A=0;for(let t=0;t"~"||r==="["||r==="]"||r==="("||r===")"||r==="{"||r==="}"||r==="<"||r===">"||r==="/"||r==="%")&&(r="_"),a[n]=r}a=a.join(""),a===""&&(a="Bad_Font_Name"),t.add(Pe(a))}return this.compileIndex(t)}compileTopDicts(A,t,i){let s=[],a=new ai;for(let n of A){i&&(n.removeByName("CIDFontVersion"),n.removeByName("CIDFontRevision"),n.removeByName("CIDFontType"),n.removeByName("CIDCount"),n.removeByName("UIDBase"));let r=new Nr,g=this.compileDict(n,r);s.push(r),a.add(g),r.offset(t)}return a=this.compileIndex(a,s),{trackers:s,output:a}}compilePrivateDicts(A,t,i){for(let s=0,a=A.length;s>8&255,n&255]);else{let r=1+n*2;a=new Uint8Array(r),a[0]=0;let g=0,o=A.charset.length,I=!1;for(let c=1;c>8&255,o&255):g===3?a.push(o>>16&255,o>>8&255,o&255):a.push(o>>>24&255,o>>16&255,o>>8&255,o&255),i[r]&&(o+=i[r].length);for(r=0;r=65520&&e<=65535?0:e>=62976&&e<=63743?Xd()[e]||e:e===173?45:e}function Us(e,A){let t=A[e];if(t!==void 0)return t;if(!e)return-1;if(e[0]==="u"){let i=e.length,s;if(i===7&&e[1]==="n"&&e[2]==="i")s=e.substring(3);else if(i>=5&&i<=7)s=e.substring(1);else return-1;if(s===s.toUpperCase()&&(t=parseInt(s,16),t>=0))return t}return-1}var uo=[[0,127],[128,255],[256,383],[384,591],[592,687,7424,7551,7552,7615],[688,767,42752,42783],[768,879,7616,7679],[880,1023],[11392,11519],[1024,1279,1280,1327,11744,11775,42560,42655],[1328,1423],[1424,1535],[42240,42559],[1536,1791,1872,1919],[1984,2047],[2304,2431],[2432,2559],[2560,2687],[2688,2815],[2816,2943],[2944,3071],[3072,3199],[3200,3327],[3328,3455],[3584,3711],[3712,3839],[4256,4351,11520,11567],[6912,7039],[4352,4607],[7680,7935,11360,11391,42784,43007],[7936,8191],[8192,8303,11776,11903],[8304,8351],[8352,8399],[8400,8447],[8448,8527],[8528,8591],[8592,8703,10224,10239,10496,10623,11008,11263],[8704,8959,10752,11007,10176,10223,10624,10751],[8960,9215],[9216,9279],[9280,9311],[9312,9471],[9472,9599],[9600,9631],[9632,9727],[9728,9983],[9984,10175],[12288,12351],[12352,12447],[12448,12543,12784,12799],[12544,12591,12704,12735],[12592,12687],[43072,43135],[12800,13055],[13056,13311],[44032,55215],[55296,57343],[67840,67871],[19968,40959,11904,12031,12032,12255,12272,12287,13312,19903,131072,173791,12688,12703],[57344,63743],[12736,12783,63744,64255,194560,195103],[64256,64335],[64336,65023],[65056,65071],[65040,65055],[65104,65135],[65136,65279],[65280,65519],[65520,65535],[3840,4095],[1792,1871],[1920,1983],[3456,3583],[4096,4255],[4608,4991,4992,5023,11648,11743],[5024,5119],[5120,5759],[5760,5791],[5792,5887],[6016,6143],[6144,6319],[10240,10495],[40960,42127],[5888,5919,5920,5951,5952,5983,5984,6015],[66304,66351],[66352,66383],[66560,66639],[118784,119039,119040,119295,119296,119375],[119808,120831],[1044480,1048573],[65024,65039,917760,917999],[917504,917631],[6400,6479],[6480,6527],[6528,6623],[6656,6687],[11264,11359],[11568,11647],[19904,19967],[43008,43055],[65536,65663,65664,65791,65792,65855],[65856,65935],[66432,66463],[66464,66527],[66640,66687],[66688,66735],[67584,67647],[68096,68191],[119552,119647],[73728,74751,74752,74879],[119648,119679],[7040,7103],[7168,7247],[7248,7295],[43136,43231],[43264,43311],[43312,43359],[43520,43615],[65936,65999],[66e3,66047],[66208,66271,66176,66207,67872,67903],[127024,127135,126976,127023]];function _d(e,A=-1){if(A!==-1){let t=uo[A];for(let i=0,s=t.length;i=t[i]&&e<=t[i+1])return A}for(let t=0,i=uo.length;t=s[a]&&e<=s[a+1])return t}return-1}var zd=new RegExp("^(\\\\s)|(\\\\p{Mn})|(\\\\p{Cf})$","u"),bI=new Map;function $d(e){let A=bI.get(e);if(A)return A;let t=e.match(zd),i={isWhitespace:!!(t!=null&&t[1]),isZeroWidthDiacritic:!!(t!=null&&t[2]),isInvisibleFormatMark:!!(t!=null&&t[3])};return bI.set(e,i),i}function A2(){bI.clear()}var Cs=!0,Ft={FixedPitch:1,Serif:2,Symbolic:4,Script:8,Nonsymbolic:32,Italic:64,AllCap:65536,SmallCap:131072,ForceBold:262144},O1=[".notdef",".null","nonmarkingreturn","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","nonbreakingspace","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron","Lslash","lslash","Scaron","scaron","Zcaron","zcaron","brokenbar","Eth","eth","Yacute","yacute","Thorn","thorn","minus","multiply","onesuperior","twosuperior","threesuperior","onehalf","onequarter","threequarters","franc","Gbreve","gbreve","Idotaccent","Scedilla","scedilla","Cacute","cacute","Ccaron","ccaron","dcroat"];function Ef(e,A){if(A[e]!==void 0)return e;let t=Us(e,A);if(t!==-1){for(let i in A)if(A[i]===t)return i}return PA("Unable to recover a standard glyph name for: "+e),e}function ff(e,A,t){let i=Object.create(null),s,a,n,r=!!(e.flags&Ft.Symbolic);if(e.isInternalFont)for(n=A,a=0;ai;)i<<=1,s++;let a=i*t;return{range:a,entry:s,rangeShift:t*A-a}}toArray(){let A=this.sfnt,t=this.tables,i=Object.keys(t);i.sort();let s=i.length,a,n,r,g,o,I=$1+s*AE,c=[I];for(a=0;a>>0;I+=C,c.push(I)}let l=new Uint8Array(I);for(a=0;a>>0}mo(l,I+4,C),mo(l,I+8,c[a]),mo(l,I+12,t[o].length),I+=AE}return l}addTable(A,t){if(A in this.tables)throw new Error("Table "+A+" already exists");this.tables[A]=t}},la=!1,Fe={hstem:[1],vstem:[3],vmoveto:[4],rlineto:[5],hlineto:[6],vlineto:[7],rrcurveto:[8],callsubr:[10],flex:[12,35],drop:[12,18],endchar:[14],rmoveto:[21],hmoveto:[22],vhcurveto:[30],hvcurveto:[31]},LI=class{constructor(){this.width=0,this.lsb=0,this.flexing=!1,this.output=[],this.stack=[]}convert(A,t,i){let s=A.length,a=!1,n,r,g;for(let o=0;os)return!0;let a=s-A;for(let n=a;n>8&255,r&255):(r=65536*r|0,this.output.push(255,r>>24&255,r>>16&255,r>>8&255,r&255))}return this.output.push(...t),i?this.stack.splice(a,A):this.stack.length=0,!1}},eE=55665,E2=4330;function _t(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function tE(e,A,t){if(t>=e.length)return new Uint8Array(0);let i=52845,s=22719,a=A|0,n,r;for(n=0;n0;d--)u[d]-=u[d-1];C.setByName(f,u)}n.topDict.privateDict=C;let Q=new ai;for(c=0,l=s.length;c>>0,UA=!1;if(!((G==null?void 0:G.platformId)===yA&&(G==null?void 0:G.encodingId)===aA)){if(yA===0&&(aA===0||aA===1||aA===3))UA=!0;else if(yA===1&&aA===0)UA=!0;else if(yA===3&&aA===1&&(T||!G))UA=!0,q||(BA=!0);else if(q&&yA===3&&aA===0){UA=!0;let Ee=!0;if(cA
cA&&(LA=cA),UA.push({index:aA,offset:LA,endOffset:0})}for(UA.sort((LA,WA)=>LA.offset-WA.offset),aA=0;aA
LA.index-WA.index),aA=0;aA
W&&(W=LA.sizeOfInstructions),TA+=WA,uA(wA,DA,TA)}if(TA===0){let LA=new Uint8Array([0,1,0,0,0,0,0,0,0,0,0,0,0,0,49,0]);for(aA=0,DA=G;aA
0)return!0;let A=this.stream.getByte();return A<0?!1:(this.buffer=A,this.bufferLength=8,!0)}readBits(A){let t=this.buffer,i=this.bufferLength;if(A===32){if(i===0)return(this.stream.getByte()<<24|this.stream.getByte()<<16|this.stream.getByte()<<8|this.stream.getByte())>>>0;t=t<<24|this.stream.getByte()<<16|this.stream.getByte()<<8|this.stream.getByte();let s=this.stream.getByte();return this.buffer=s&(1<>i)>>>0}if(A===8&&i===0)return this.stream.getByte();for(;i>i}align(){this.buffer=0,this.bufferLength=0}readFlag(){return this.readBits(this.context.bitsPerFlag)}readCoordinate(){let A=this.context.bitsPerCoordinate,t=this.readBits(A),i=this.readBits(A),s=this.context.decode,a=A<32?1/((1<r?r:A,t=t>g?g:t,i=i
0&&(u=r[f-1]);let d=s[1];f=0&&VA[E]==="ET";--E)VA[E]="EN";for(let E=n+1;E0&&(f=VA[n-1]);let u=c;E+1Q&&hE(Q)&&(B=Q);for(Q=C;Q>=B;--Q){let E=-1;for(n=0,r=g.length;n>>17,r=r*l&St|r*C&Vt,o^=r,o=o<<13|o>>>19,o=o*5+3864292196):(g=n[B],g=g*c&St|g*h&Vt,g=g<<15|g>>>17,g=g*l&St|g*C&Vt,I^=g,I=I<<13|I>>>19,I=I*5+3864292196);switch(r=0,a){case 3:r^=t[s*4+2]<<16;case 2:r^=t[s*4+1]<<8;case 1:r^=t[s*4],r=r*c&St|r*h&Vt,r=r<<15|r>>>17,r=r*l&St|r*C&Vt,s&1?o^=r:I^=r}this.h1=o,this.h2=I}hexdigest(){let A=this.h1,t=this.h2;return A^=t>>>1,A=A*3981806797&St|A*36045&Vt,t=t*4283543511&St|((t<<16|A>>>16)*2950163797&St)>>>16,A^=t>>>1,A=A*444984403&St|A*60499&Vt,t=t*3301882366&St|((t<<16|A>>>16)*3120437893&St)>>>16,A^=t>>>1,(A>>>0).toString(16).padStart(8,"0")+(t>>>0).toString(16).padStart(8,"0")}};function $g(e,A,t,i,s){let a=e;for(let n=0,r=A.length-1;n0&&Number.isInteger(i.height)&&i.height>0&&(i.width!==h||i.height!==C)&&(k("PDFImage - using the Width/Height of the image data, rather than the image dictionary."),h=i.width,C=i.height),h<1||C<1)throw new v(`Invalid image width: ${h} or height: ${C}`);this.width=h,this.height=C,this.interpolate=I.get("I","Interpolate"),this.imageMask=I.get("IM","ImageMask")||!1,this.matte=I.get("Matte")||!1;let B=i.bitsPerComponent;if(!B&&(B=I.get("BPC","BitsPerComponent"),!B))if(this.imageMask)B=1;else throw new v(`Bits per component missing in image: ${this.imageMask}`);if(this.bpc=B,!this.imageMask){let f=I.getRaw("CS")||I.getRaw("ColorSpace"),u=!!f;if(u)(Q=this.jpxDecoderOptions)!=null&&Q.smaskInData&&(f=M.get("DeviceRGBA"));else if(this.jpxDecoderOptions)f=M.get("DeviceRGBA");else switch(i.numComps){case 1:f=M.get("DeviceGray");break;case 3:f=M.get("DeviceRGB");break;case 4:f=M.get("DeviceCMYK");break;default:throw new Error(`Images with ${i.numComps} color components not supported.`)}this.colorSpace=JA.parse({cs:f,xref:A,resources:s?t:null,pdfFunctionFactory:g,localColorSpaceCache:o}),this.numComps=this.colorSpace.numComps,this.jpxDecoderOptions&&(this.jpxDecoderOptions.numComponents=u?this.numComp:0,this.jpxDecoderOptions.isIndexedColormap=this.colorSpace.name==="Indexed")}if(this.decode=I.getArray("D","Decode"),this.needsDecode=!1,this.decode&&(this.colorSpace&&!this.colorSpace.isDefaultDecode(this.decode,B)||r&&!JA.isDefaultDecode(this.decode,1))){this.needsDecode=!0;let f=(1<>3)*i,g=A.byteLength,o=r===g,I,c;if(s&&(!a||o)?I=A:a?(I=new Uint8Array(r),I.set(A),I.fill(255,g)):I=new Uint8Array(A),a)for(c=0;c>=1}}else{let C=0;for(h=0,c=0,l=n;c
>3,r=await this.getImageBytes(s*n,{internal:!0}),g=this.getComponents(r),o,I;if(a===1){if(I=i*s,this.needsDecode)for(o=0;o0&&A.args[0].count++}var Hg=class{constructor(){this.reset()}check(){return++this.checked