PageSourceSearch

https://connect.aviloo.com/_next/static/chunks/bf765b38.ee558245f246168d.js

js aviloo.com collected 2026-10-03 19:32:05 UTC 305,361 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7384],{9152:(e,t,n)=>{n.r(t),n.d(t,{createPdfiumEngine:()=>x});var r,o=n(108),i=n(6285),a=n(5704),l=(r="file:///app/node_modules/@embedpdf/snippet/dist/direct-engine-DdrQKpgq.js",async function(e={}){var t,o,i=new Promise((e,n)=>{t=e,o=n
vendor: 16,735 bytes, line 1
1});["_EPDF_GetMetaKeyCount","_EPDF_GetMetaKeyName","_EPDF_GetMetaTrapped","_EPDF_GetPageBoxByIndex","_EPDF_GetPageRotationByIndex","_EPDF_GetPageSizeByIndexNormalized","_EPDF_HasMetaText","_EPDF_IsEncrypted","_EPDF_IsOwnerUnlocked","_EPDF_LoadPageNormalized","_EPDF_PNG_EncodeRGBA","_EPDF_RemoveEncryption","_EPDF_RenderAnnotBitmap","_EPDF_RenderAnnotBitmapUnrotated","_EPDF_SetEncryption","_EPDF_SetMetaText","_EPDF_SetMetaTrapped","_EPDF_UnlockOwnerPermissions","_EPDFAction_CreateGoTo","_EPDFAction_CreateGoToNamed","_EPDFAction_CreateLaunch","_EPDFAction_CreateRemoteGoToByName","_EPDFAction_CreateRemoteGoToDest","_EPDFAction_CreateURI","_EPDFAnnot_ApplyRedaction","_EPDFAnnot_ClearBorderEffect","_EPDFAnnot_ClearColor","_EPDFAnnot_ClearMKColor","_EPDFAnnot_ClearRectangleDifferences","_EPDFAnnot_ExportAppearanceAsDocument","_EPDFAnnot_ExportMultipleAppearancesAsDocument","_EPDFAnnot_Flatten","_EPDFAnnot_GenerateAppearance","_EPDFAnnot_GenerateAppearanceWithBlend","_EPDFAnnot_GenerateFormFieldAP","_EPDFAnnot_GetAPMatrix","_EPDFAnnot_GetAvailableAppearanceModes","_EPDFAnnot_GetBlendMode","_EPDFAnnot_GetBorderDashPattern","_EPDFAnnot_GetBorderDashPatternCount","_EPDFAnnot_GetBorderEffect","_EPDFAnnot_GetBorderStyle","_EPDFAnnot_GetButtonExportValue","_EPDFAnnot_GetCalloutLine","_EPDFAnnot_GetCalloutLineCount","_EPDFAnnot_GetColor","_EPDFAnnot_GetDefaultAppearance","_EPDFAnnot_GetExtendedRotation","_EPDFAnnot_GetFormFieldObjectNumber","_EPDFAnnot_GetFormFieldRawValue","_EPDFAnnot_GetIntent","_EPDFAnnot_GetLineEndings","_EPDFAnnot_GetMKColor","_EPDFAnnot_GetName","_EPDFAnnot_GetObjectNumber","_EPDFAnnot_GetOpacity","_EPDFAnnot_GetOverlayText","_EPDFAnnot_GetOverlayTextRepeat","_EPDFAnnot_GetRect","_EPDFAnnot_GetRectangleDifferences","_EPDFAnnot_GetReplyType","_EPDFAnnot_GetRichContent","_EPDFAnnot_GetRotate","_EPDFAnnot_GetTextAlignment","_EPDFAnnot_GetUnrotatedRect","_EPDFAnnot_GetVerticalAlignment","_EPDFAnnot_HasAppearanceStream","_EPDFAnnot_SetAction","_EPDFAnnot_SetAPMatrix","_EPDFAnnot_SetAppearanceFromPage","_EPDFAnnot_SetBorderDashPattern","_EPDFAnnot_SetBorderEffect","_EPDFAnnot_SetBorderStyle","_EPDFAnnot_SetCalloutLine","_EPDFAnnot_SetColor","_EPDFAnnot_SetDefaultAppearance","_EPDFAnnot_SetExtendedRotation","_EPDFAnnot_SetFormFieldName","_EPDFAnnot_SetFormFieldOptions","_EPDFAnnot_SetFormFieldValue","_EPDFAnnot_SetIntent","_EPDFAnnot_SetLine","_EPDFAnnot_SetLineEndings","_EPDFAnnot_SetLinkedAnnot","_EPDFAnnot_SetMKColor","_EPDFAnnot_SetName","_EPDFAnnot_SetNumberValue","_EPDFAnnot_SetOpacity","_EPDFAnnot_SetOverlayText","_EPDFAnnot_SetOverlayTextRepeat","_EPDFAnnot_SetRectangleDifferences","_EPDFAnnot_SetReplyType","_EPDFAnnot_SetRotate","_EPDFAnnot_SetTextAlignment","_EPDFAnnot_SetUnrotatedRect","_EPDFAnnot_SetVerticalAlignment","_EPDFAnnot_SetVertices","_EPDFAnnot_ShareFormField","_EPDFAnnot_UpdateAppearanceToRect","_EPDFAttachment_GetDescription","_EPDFAttachment_GetIntegerValue","_EPDFAttachment_SetDescription","_EPDFAttachment_SetSubtype","_EPDFBookmark_AppendChild","_EPDFBookmark_Clear","_EPDFBookmark_ClearTarget","_EPDFBookmark_Create","_EPDFBookmark_Delete","_EPDFBookmark_InsertAfter","_EPDFBookmark_SetAction","_EPDFBookmark_SetDest","_EPDFBookmark_SetTitle","_EPDFCatalog_GetLanguage","_EPDFDest_CreateRemoteView","_EPDFDest_CreateRemoteXYZ","_EPDFDest_CreateView","_EPDFDest_CreateXYZ","_EPDFDoc_GetPageObjectNumberByIndex","_EPDFDoc_LoadPageByObjectNumber","_EPDFImageObj_SetJpeg","_EPDFImageObj_SetPng","_EPDFNamedDest_Remove","_EPDFNamedDest_SetDest","_EPDFPage_ApplyRedactions","_EPDFPage_CreateAnnot","_EPDFPage_CreateFormField","_EPDFPage_GetAnnotByName","_EPDFPage_GetAnnotByObjectNumber","_EPDFPage_GetAnnotCountRaw","_EPDFPage_GetAnnotRaw","_EPDFPage_GetObjectNumber","_EPDFPage_MoveAnnots","_EPDFPage_RemoveAnnot","_EPDFPage_RemoveAnnotByName","_EPDFPage_RemoveAnnotByObjectNumber","_EPDFPage_RemoveAnnotRaw","_EPDFText_RedactInQuads","_EPDFText_RedactInRect","_FORM_CanRedo","_FORM_CanUndo","_FORM_DoDocumentAAction","_FORM_DoDocumentJSAction","_FORM_DoDocumentOpenAction","_FORM_DoPageAAction","_FORM_ForceToKillFocus","_FORM_GetFocusedAnnot","_FORM_GetFocusedText","_FORM_GetSelectedText","_FORM_IsIndexSelected","_FORM_OnAfterLoadPage","_FORM_OnBeforeClosePage","_FORM_OnChar","_FORM_OnFocus","_FORM_OnKeyDown","_FORM_OnKeyUp","_FORM_OnLButtonDoubleClick","_FORM_OnLButtonDown","_FORM_OnLButtonUp","_FORM_OnMouseMove","_FORM_OnMouseWheel","_FORM_OnRButtonDown","_FORM_OnRButtonUp","_FORM_Redo","_FORM_ReplaceAndKeepSelection","_FORM_ReplaceSelection","_FORM_SelectAllText","_FORM_SetFocusedAnnot","_FORM_SetIndexSelected","_FORM_Undo","_FPDF_AddInstalledFont","_FPDF_CloseDocument","_FPDF_ClosePage","_FPDF_CloseXObject","_FPDF_CopyViewerPreferences","_FPDF_CountNamedDests","_FPDF_CreateClipPath","_FPDF_CreateNewDocument","_FPDF_DestroyClipPath","_FPDF_DestroyLibrary","_FPDF_DeviceToPage","_FPDF_DocumentHasValidCrossReferenceTable","_FPDF_FFLDraw","_FPDF_FreeDefaultSystemFontInfo","_FPDF_GetDefaultSystemFontInfo","_FPDF_GetDefaultTTFMap","_FPDF_GetDefaultTTFMapCount","_FPDF_GetDefaultTTFMapEntry","_FPDF_GetDocPermissions","_FPDF_GetDocUserPermissions","_FPDF_GetFileIdentifier","_FPDF_GetFileVersion","_FPDF_GetFormType","_FPDF_GetLastError","_FPDF_GetMetaText","_FPDF_GetNamedDest","_FPDF_GetNamedDestByName","_FPDF_GetPageAAction","_FPDF_GetPageBoundingBox","_FPDF_GetPageCount","_FPDF_GetPageHeight","_FPDF_GetPageHeightF","_FPDF_GetPageLabel","_FPDF_GetPageSizeByIndex","_FPDF_GetPageSizeByIndexF","_FPDF_GetPageWidth","_FPDF_GetPageWidthF","_FPDF_GetSecurityHandlerRevision","_FPDF_GetSignatureCount","_FPDF_GetSignatureObject","_FPDF_GetTrailerEnds","_FPDF_GetXFAPacketContent","_FPDF_GetXFAPacketCount","_FPDF_GetXFAPacketName","_FPDF_ImportNPagesToOne","_FPDF_ImportPages","_FPDF_ImportPagesByIndex","_FPDF_InitLibrary","_FPDF_InitLibraryWithConfig","_FPDF_LoadCustomDocument","_FPDF_LoadDocument","_FPDF_LoadMemDocument","_FPDF_LoadMemDocument64","_FPDF_LoadPage","_FPDF_LoadXFA","_FPDF_MovePages","_FPDF_NewFormObjectFromXObject","_FPDF_NewXObjectFromPage","_FPDF_PageToDevice","_FPDF_RemoveFormFieldHighlight","_FPDF_RenderPage_Close","_FPDF_RenderPage_Continue","_FPDF_RenderPageBitmap","_FPDF_RenderPageBitmap_Start","_FPDF_RenderPageBitmapWithColorScheme_Start","_FPDF_RenderPageBitmapWithMatrix","_FPDF_SaveAsCopy","_FPDF_SaveWithVersion","_FPDF_SetFormFieldHighlightAlpha","_FPDF_SetFormFieldHighlightColor","_FPDF_SetSandBoxPolicy","_FPDF_SetSystemFontInfo","_FPDF_StructElement_Attr_CountChildren","_FPDF_StructElement_Attr_GetBlobValue","_FPDF_StructElement_Attr_GetBooleanValue","_FPDF_StructElement_Attr_GetChildAtIndex","_FPDF_StructElement_Attr_GetCount","_FPDF_StructElement_Attr_GetName","_FPDF_StructElement_Attr_GetNumberValue","_FPDF_StructElement_Attr_GetStringValue","_FPDF_StructElement_Attr_GetType","_FPDF_StructElement_Attr_GetValue","_FPDF_StructElement_CountChildren","_FPDF_StructElement_GetActualText","_FPDF_StructElement_GetAltText","_FPDF_StructElement_GetAttributeAtIndex","_FPDF_StructElement_GetAttributeCount","_FPDF_StructElement_GetChildAtIndex","_FPDF_StructElement_GetChildMarkedContentID","_FPDF_StructElement_GetID","_FPDF_StructElement_GetLang","_FPDF_StructElement_GetMarkedContentID","_FPDF_StructElement_GetMarkedContentIdAtIndex","_FPDF_StructElement_GetMarkedContentIdCount","_FPDF_StructElement_GetObjType","_FPDF_StructElement_GetParent","_FPDF_StructElement_GetStringAttribute","_FPDF_StructElement_GetTitle","_FPDF_StructElement_GetType","_FPDF_StructTree_Close","_FPDF_StructTree_CountChildren","_FPDF_StructTree_GetChildAtIndex","_FPDF_StructTree_GetForPage","_FPDF_VIEWERREF_GetDuplex","_FPDF_VIEWERREF_GetName","_FPDF_VIEWERREF_GetNumCopies","_FPDF_VIEWERREF_GetPrintPageRange","_FPDF_VIEWERREF_GetPrintPageRangeCount","_FPDF_VIEWERREF_GetPrintPageRangeElement","_FPDF_VIEWERREF_GetPrintScaling","_FPDFAction_GetDest","_FPDFAction_GetFilePath","_FPDFAction_GetType","_FPDFAction_GetURIPath","_FPDFAnnot_AddFileAttachment","_FPDFAnnot_AddInkStroke","_FPDFAnnot_AppendAttachmentPoints","_FPDFAnnot_AppendObject","_FPDFAnnot_CountAttachmentPoints","_FPDFAnnot_GetAP","_FPDFAnnot_GetAttachmentPoints","_FPDFAnnot_GetBorder","_FPDFAnnot_GetColor","_FPDFAnnot_GetFileAttachment","_FPDFAnnot_GetFlags","_FPDFAnnot_GetFocusableSubtypes","_FPDFAnnot_GetFocusableSubtypesCount","_FPDFAnnot_GetFontColor","_FPDFAnnot_GetFontSize","_FPDFAnnot_GetFormAdditionalActionJavaScript","_FPDFAnnot_GetFormControlCount","_FPDFAnnot_GetFormControlIndex","_FPDFAnnot_GetFormFieldAlternateName","_FPDFAnnot_GetFormFieldAtPoint","_FPDFAnnot_GetFormFieldExportValue","_FPDFAnnot_GetFormFieldFlags","_FPDFAnnot_GetFormFieldName","_FPDFAnnot_GetFormFieldType","_FPDFAnnot_GetFormFieldValue","_FPDFAnnot_GetInkListCount","_FPDFAnnot_GetInkListPath","_FPDFAnnot_GetLine","_FPDFAnnot_GetLink","_FPDFAnnot_GetLinkedAnnot","_FPDFAnnot_GetNumberValue","_FPDFAnnot_GetObject","_FPDFAnnot_GetObjectCount","_FPDFAnnot_GetOptionCount","_FPDFAnnot_GetOptionLabel","_FPDFAnnot_GetRect","_FPDFAnnot_GetStringValue","_FPDFAnnot_GetSubtype","_FPDFAnnot_GetValueType","_FPDFAnnot_GetVertices","_FPDFAnnot_HasAttachmentPoints","_FPDFAnnot_HasKey","_FPDFAnnot_IsChecked","_FPDFAnnot_IsObjectSupportedSubtype","_FPDFAnnot_IsOptionSelected","_FPDFAnnot_IsSupportedSubtype","_FPDFAnnot_RemoveInkList","_FPDFAnnot_RemoveObject","_FPDFAnnot_SetAP","_FPDFAnnot_SetAttachmentPoints","_FPDFAnnot_SetBorder","_FPDFAnnot_SetColor","_FPDFAnnot_SetFlags","_FPDFAnnot_SetFocusableSubtypes","_FPDFAnnot_SetFontColor","_FPDFAnnot_SetFormFieldFlags","_FPDFAnnot_SetRect","_FPDFAnnot_SetStringValue","_FPDFAnnot_SetURI","_FPDFAnnot_UpdateObject","_FPDFAttachment_GetFile","_FPDFAttachment_GetName","_FPDFAttachment_GetStringValue","_FPDFAttachment_GetSubtype","_FPDFAttachment_GetValueType","_FPDFAttachment_HasKey","_FPDFAttachment_SetFile","_FPDFAttachment_SetStringValue","_FPDFAvail_Create","_FPDFAvail_Destroy","_FPDFAvail_GetDocument","_FPDFAvail_GetFirstPageNum","_FPDFAvail_IsDocAvail","_FPDFAvail_IsFormAvail","_FPDFAvail_IsLinearized","_FPDFAvail_IsPageAvail","_FPDFBitmap_Create","_FPDFBitmap_CreateEx","_FPDFBitmap_Destroy","_FPDFBitmap_FillRect","_FPDFBitmap_GetBuffer","_FPDFBitmap_GetFormat","_FPDFBitmap_GetHeight","_FPDFBitmap_GetStride","_FPDFBitmap_GetWidth","_FPDFBookmark_Find","_FPDFBookmark_GetAction","_FPDFBookmark_GetCount","_FPDFBookmark_GetDest","_FPDFBookmark_GetFirstChild","_FPDFBookmark_GetNextSibling","_FPDFBookmark_GetTitle","_FPDFCatalog_GetLanguage","_FPDFCatalog_IsTagged","_FPDFCatalog_SetLanguage","_FPDFClipPath_CountPaths","_FPDFClipPath_CountPathSegments","_FPDFClipPath_GetPathSegment","_FPDFDest_GetDestPageIndex","_FPDFDest_GetLocationInPage","_FPDFDest_GetView","_FPDFDoc_AddAttachment","_FPDFDoc_CloseJavaScriptAction","_FPDFDoc_DeleteAttachment","_FPDFDOC_ExitFormFillEnvironment","_FPDFDoc_GetAttachment","_FPDFDoc_GetAttachmentCount","_FPDFDoc_GetJavaScriptAction","_FPDFDoc_GetJavaScriptActionCount","_FPDFDoc_GetPageMode","_FPDFDOC_InitFormFillEnvironment","_FPDFFont_Close","_FPDFFont_GetAscent","_FPDFFont_GetBaseFontName","_FPDFFont_GetDescent","_FPDFFont_GetFamilyName","_FPDFFont_GetFlags","_FPDFFont_GetFontData","_FPDFFont_GetGlyphPath","_FPDFFont_GetGlyphWidth","_FPDFFont_GetIsEmbedded","_FPDFFont_GetItalicAngle","_FPDFFont_GetWeight","_FPDFFormObj_CountObjects","_FPDFFormObj_GetObject","_FPDFFormObj_RemoveObject","_FPDFGlyphPath_CountGlyphSegments","_FPDFGlyphPath_GetGlyphPathSegment","_FPDFImageObj_GetBitmap","_FPDFImageObj_GetIccProfileDataDecoded","_FPDFImageObj_GetImageDataDecoded","_FPDFImageObj_GetImageDataRaw","_FPDFImageObj_GetImageFilter","_FPDFImageObj_GetImageFilterCount","_FPDFImageObj_GetImageMetadata","_FPDFImageObj_GetImagePixelSize","_FPDFImageObj_GetRenderedBitmap","_FPDFImageObj_LoadJpegFile","_FPDFImageObj_LoadJpegFileInline","_FPDFImageObj_SetBitmap","_FPDFImageObj_SetMatrix","_FPDFJavaScriptAction_GetName","_FPDFJavaScriptAction_GetScript","_FPDFLink_CloseWebLinks","_FPDFLink_CountQuadPoints","_FPDFLink_CountRects","_FPDFLink_CountWebLinks","_FPDFLink_Enumerate","_FPDFLink_GetAction","_FPDFLink_GetAnnot","_FPDFLink_GetAnnotRect","_FPDFLink_GetDest","_FPDFLink_GetLinkAtPoint","_FPDFLink_GetLinkZOrderAtPoint","_FPDFLink_GetQuadPoints","_FPDFLink_GetRect","_FPDFLink_GetTextRange","_FPDFLink_GetURL","_FPDFLink_LoadWebLinks","_FPDFPage_CloseAnnot","_FPDFPage_CountObjects","_FPDFPage_CreateAnnot","_FPDFPage_Delete","_FPDFPage_Flatten","_FPDFPage_FormFieldZOrderAtPoint","_FPDFPage_GenerateContent","_FPDFPage_GetAnnot","_FPDFPage_GetAnnotCount","_FPDFPage_GetAnnotIndex","_FPDFPage_GetArtBox","_FPDFPage_GetBleedBox","_FPDFPage_GetCropBox","_FPDFPage_GetDecodedThumbnailData","_FPDFPage_GetMediaBox","_FPDFPage_GetObject","_FPDFPage_GetRawThumbnailData","_FPDFPage_GetRotation","_FPDFPage_GetThumbnailAsBitmap","_FPDFPage_GetTrimBox","_FPDFPage_HasFormFieldAtPoint","_FPDFPage_HasTransparency","_FPDFPage_InsertClipPath","_FPDFPage_InsertObject","_FPDFPage_InsertObjectAtIndex","_FPDFPage_New","_FPDFPage_RemoveAnnot","_FPDFPage_RemoveObject","_FPDFPage_SetArtBox","_FPDFPage_SetBleedBox","_FPDFPage_SetCropBox","_FPDFPage_SetMediaBox","_FPDFPage_SetRotation","_FPDFPage_SetTrimBox","_FPDFPage_TransformAnnots","_FPDFPage_TransFormWithClip","_FPDFPageObj_AddMark","_FPDFPageObj_CountMarks","_FPDFPageObj_CreateNewPath","_FPDFPageObj_CreateNewRect","_FPDFPageObj_CreateTextObj","_FPDFPageObj_Destroy","_FPDFPageObj_GetBounds","_FPDFPageObj_GetClipPath","_FPDFPageObj_GetDashArray","_FPDFPageObj_GetDashCount","_FPDFPageObj_GetDashPhase","_FPDFPageObj_GetFillColor","_FPDFPageObj_GetIsActive","_FPDFPageObj_GetLineCap","_FPDFPageObj_GetLineJoin","_FPDFPageObj_GetMark","_FPDFPageObj_GetMarkedContentID","_FPDFPageObj_GetMatrix","_FPDFPageObj_GetRotatedBounds","_FPDFPageObj_GetStrokeColor","_FPDFPageObj_GetStrokeWidth","_FPDFPageObj_GetType","_FPDFPageObj_HasTransparency","_FPDFPageObj_NewImageObj","_FPDFPageObj_NewTextObj","_FPDFPageObj_RemoveMark","_FPDFPageObj_SetBlendMode","_FPDFPageObj_SetDashArray","_FPDFPageObj_SetDashPhase","_FPDFPageObj_SetFillColor","_FPDFPageObj_SetIsActive","_FPDFPageObj_SetLineCap","_FPDFPageObj_SetLineJoin","_FPDFPageObj_SetMatrix","_FPDFPageObj_SetStrokeColor","_FPDFPageObj_SetStrokeWidth","_FPDFPageObj_Transform","_FPDFPageObj_TransformClipPath","_FPDFPageObj_TransformF","_FPDFPageObjMark_CountParams","_FPDFPageObjMark_GetName","_FPDFPageObjMark_GetParamBlobValue","_FPDFPageObjMark_GetParamFloatValue","_FPDFPageObjMark_GetParamIntValue","_FPDFPageObjMark_GetParamKey","_FPDFPageObjMark_GetParamStringValue","_FPDFPageObjMark_GetParamValueType","_FPDFPageObjMark_RemoveParam","_FPDFPageObjMark_SetBlobParam","_FPDFPageObjMark_SetFloatParam","_FPDFPageObjMark_SetIntParam","_FPDFPageObjMark_SetStringParam","_FPDFPath_BezierTo","_FPDFPath_Close","_FPDFPath_CountSegments","_FPDFPath_GetDrawMode","_FPDFPath_GetPathSegment","_FPDFPath_LineTo","_FPDFPath_MoveTo","_FPDFPath_SetDrawMode","_FPDFPathSegment_GetClose","_FPDFPathSegment_GetPoint","_FPDFPathSegment_GetType","_FPDFSignatureObj_GetByteRange","_FPDFSignatureObj_GetContents","_FPDFSignatureObj_GetDocMDPPermission","_FPDFSignatureObj_GetReason","_FPDFSignatureObj_GetSubFilter","_FPDFSignatureObj_GetTime","_FPDFText_ClosePage","_FPDFText_CountChars","_FPDFText_CountRects","_FPDFText_FindClose","_FPDFText_FindNext","_FPDFText_FindPrev","_FPDFText_FindStart","_FPDFText_GetBoundedText","_FPDFText_GetCharAngle","_FPDFText_GetCharBox","_FPDFText_GetCharIndexAtPos","_FPDFText_GetCharIndexFromTextIndex","_FPDFText_GetCharOrigin","_FPDFText_GetFillColor","_FPDFText_GetFontInfo","_FPDFText_GetFontSize","_FPDFText_GetFontWeight","_FPDFText_GetLooseCharBox","_FPDFText_GetMatrix","_FPDFText_GetRect","_FPDFText_GetSchCount","_FPDFText_GetSchResultIndex","_FPDFText_GetStrokeColor","_FPDFText_GetText","_FPDFText_GetTextIndexFromCharIndex","_FPDFText_GetTextObject","_FPDFText_GetUnicode","_FPDFText_HasUnicodeMapError","_FPDFText_IsGenerated","_FPDFText_IsHyphen","_FPDFText_LoadCidType2Font","_FPDFText_LoadFont","_FPDFText_LoadPage","_FPDFText_LoadStandardFont","_FPDFText_SetCharcodes","_FPDFText_SetText","_FPDFTextObj_GetFont","_FPDFTextObj_GetFontSize","_FPDFTextObj_GetRenderedBitmap","_FPDFTextObj_GetText","_FPDFTextObj_GetTextRenderMode","_FPDFTextObj_SetTextRenderMode","_PDFiumExt_CloseFileWriter","_PDFiumExt_CloseFormFillInfo","_PDFiumExt_ExitFormFillEnvironment","_PDFiumExt_GetFileWriterData","_PDFiumExt_GetFileWriterSize","_PDFiumExt_Init","_PDFiumExt_InitFormFillEnvironment","_PDFiumExt_OpenFileWriter","_PDFiumExt_OpenFormFillInfo","_PDFiumExt_SaveAsCopy","_malloc","_free","_memory","___indirect_function_table","onRuntimeInitialized"].forEach(e=>{Object.getOwnPropertyDescriptor(i,e)||Object.defineProperty(i,e,{get:()=>
1W("You are getting "+e+" on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"),set:()=>W("You are setting "+e+" on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")})});var l="object"==typeof window,s="function"==typeof importScripts;"object"==typeof a&&"object"==typeof a.versions&&"string"==typeof a.versions.node&&a.type;var u,m,F=!l&&!s,d=Object.assign({},e),P="./this.program",_="";if(F){if("object"==typeof window||"function"==typeof importScripts)throw Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");m=e=>{if("function"==typeof readbuffer)return new Uint8Array(readbuffer(e));let t=read(e,"binary");return x("object"==typeof t),t},u=e=>new Promise((t,n)=>{setTimeout(()=>t(m(e)))}),globalThis.clearTimeout??=e=>{},globalThis.setTimeout??=e=>"function"==typeof e?e():W(),"undefined"!=typeof print&&(globalThis.console??={},console.log=print,console.warn=console.error=globalThis.printErr??print)}else{if(!l&&!s)throw Error("environment detection error");
vendor: 37,008 bytes, line 1
1if(s?_=self.location.href:"undefined"!=typeof document&&document.currentScript&&(_=document.currentScript.src),r&&(_=r),_=_.startsWith("blob:")?"":_.substr(0,_.replace(/[?#].*/,"").lastIndexOf("/")+1),"object"!=typeof window&&"function"!=typeof importScripts)throw Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");s&&(m=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),u=e=>(x(!J(e),"readAsync does not work with file:// URLs"),fetch(e,{credentials:"same-origin"}).then(e=>e.ok?e.arrayBuffer():Promise.reject(Error(e.status+" : "+e.url))))}var g,c=e.print||console.log.bind(console),h=e.printErr||console.error.bind(console);Object.assign(e,d),d=null,Object.getOwnPropertyDescriptor(e,g="fetchSettings")&&W(`\`Module.${g}\` was supplied but \`${g}\` not included in INCOMING_MODULE_JS_API`),e.arguments&&e.arguments,ee("arguments","arguments_"),e.thisProgram&&(P=e.thisProgram),ee("thisProgram","thisProgram"),x(void 0===e.memoryInitializerPrefixURL,"Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"),x(void 0===e.pthreadMainPrefixURL,"Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"),x(void 0===e.cdInitializerPrefixURL,"Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"),x(void 0===e.filePackagePrefixURL,"Module.filePackagePrefixURL option was removed, use Module.locateFile instead"),x(void 0===e.read,"Module.read option was removed"),x(void 0===e.readAsync,"Module.readAsync option was removed (modify readAsync in JS)"),x(void 0===e.readBinary,"Module.readBinary option was removed (modify readBinary in JS)"),x(void 0===e.setWindowTitle,"Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)"),x(void 0===e.TOTAL_MEMORY,"Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"),ee("asm","wasmExports"),ee("readAsync","readAsync"),ee("readBinary","readBinary"),ee("setWindowTitle","setWindowTitle");var D,p=e.wasmBinary;ee("wasmBinary","wasmBinary"),"object"!=typeof WebAssembly&&h("no native wasm support detected");var f,b,A,E,M,y,G,S,C=!1;function x(e,t){e||W("Assertion failed"+(t?": "+t:""))}function T(){var t=D.buffer;e.HEAP8=f=new Int8Array(t),e.HEAP16=A=new Int16Array(t),e.HEAPU8=b=new Uint8Array(t),e.HEAPU16=E=new Uint16Array(t),e.HEAP32=M=new Int32Array(t),e.HEAPU32=y=new Uint32Array(t),e.HEAPF32=G=new Float32Array(t),e.HEAPF64=S=new Float64Array(t)}function O(){if(!C){var e=e2();0==e&&(e+=4);var t=y[e>>2],n=y[e+4>>2];0x2135467==t&&0x89bacdfe==n||W(`Stack overflow! Stack cookie has been overwritten at ${ea(e)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${ea(n)} ${ea(t)}`),0x63736d65!=y[0]&&W("Runtime error: The application has corrupted its heap memory area (address zero)!")}}x(!e.STACK_SIZE,"STACK_SIZE can no longer be set at runtime.  Use -sSTACK_SIZE at link time"),x("undefined"!=typeof Int32Array&&"undefined"!=typeof Float64Array&&null!=Int32Array.prototype.subarray&&null!=Int32Array.prototype.set,"JS engine does not provide full typed array support"),x(!e.wasmMemory,"Use of `wasmMemory` detected.  Use -sIMPORTED_MEMORY to define wasmMemory externally"),x(!e.INITIAL_MEMORY,"Detected runtime INITIAL_MEMORY setting.  Use -sIMPORTED_MEMORY to define wasmMemory dynamically");var v=[],R=[],k=[],w=!1;function I(e){v.unshift(e)}function j(e){k.unshift(e)}x(Math.imul,"This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),x(Math.fround,"This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),x(Math.clz32,"This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),x(Math.trunc,"This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");var B=0,L=null,N=null,V={};function U(e){for(var t=e;;){if(!V[e])return e;e=t+Math.random()}}function $(t){B++,e.monitorRunDependencies?.(B),t?(x(!V[t]),V[t]=1,null===L&&"undefined"!=typeof setInterval&&(L=setInterval(()=>{if(C)return clearInterval(L),void(L=null);var e=!1;for(var t in V)e||(e=!0,h("still waiting on run dependencies:")),h(`dependency: ${t}`);e&&h("(end of list)")},1e4))):h("warning: run dependency added without ID")}function z(t){if(B--,e.monitorRunDependencies?.(B),t?(x(V[t]),delete V[t]):h("warning: run dependency removed without ID"),0==B&&(null!==L&&(clearInterval(L),L=null),N)){var n=N;N=null,n()}}function W(t){e.onAbort?.(t),h(t="Aborted("+t+")"),C=!0;var n=new WebAssembly.RuntimeError(t);throw o(n),n}var H,K,X,Y=e=>e.startsWith("data:application/octet-stream;base64,"),J=e=>e.startsWith("file://");function q(e,t){return(...n)=>{x(w,`native function \`${e}\` called before runtime initialization`);var r=eX[e];return x(r,`exported native function \`${e}\` not found`),x(n.length<=t,`native function \`${e}\` called with ${n.length} args but expects ${t}`),r(...n)}}function Q(e){if(e==H&&p)return new Uint8Array(p);if(m)return m(e);throw"both async and sync fetching of the wasm failed"}function Z(e,t,n){return(p?Promise.resolve().then(()=>Q(e)):u(e).then(e=>new Uint8Array(e),()=>Q(e))).then(e=>WebAssembly.instantiate(e,t)).then(n,e=>{h(`failed to asynchronously prepare wasm: ${e}`),J(H)&&h(`warning: Loading from a file URI (${H}) is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing`),W(e)})}if((()=>{var e=new Int16Array(1),t=new Int8Array(e.buffer);if(e[0]=25459,115!==t[0]||99!==t[1])throw"Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)"})(),e.ENVIRONMENT)throw Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)");function ee(t,n,r=!0){Object.getOwnPropertyDescriptor(e,t)||Object.defineProperty(e,t,{configurable:!0,get(){W(`\`Module.${t}\` has been replaced by \`${n}\``+(r?" (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)":""))}})}function et(e){return"FS_createPath"===e||"FS_createDataFile"===e||"FS_createPreloadedFile"===e||"FS_unlink"===e||"addRunDependency"===e||"FS_createLazyFile"===e||"FS_createDevice"===e||"removeRunDependency"===e}function en(e,t){"undefined"==typeof globalThis||Object.getOwnPropertyDescriptor(globalThis,e)||Object.defineProperty(globalThis,e,{configurable:!0,get(){t()}})}function er(e,t){en(e,()=>{eu(`\`${e}\` is not longer defined by emscripten. ${t}`)})}function eo(t){Object.getOwnPropertyDescriptor(e,t)||Object.defineProperty(e,t,{configurable:!0,get(){var e=`'${t}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`;et(t)&&(e+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"),W(e)}})}er("buffer","Please use HEAP8.buffer or wasmMemory.buffer"),er("asm","Please use wasmExports instead");var ei=t=>{t.forEach(t=>t(e))};e.noExitRuntime;var ea=e=>(x("number"==typeof e),"0x"+(e>>>=0).toString(16).padStart(8,"0")),el=e=>e4(e),es=()=>e6(),eu=e=>{eu.shown||={},eu.shown[e]||(eu.shown[e]=1,h(e))},em="undefined"!=typeof TextDecoder?new TextDecoder:void 0,eF=(e,t=0,n=NaN)=>{for(var r=t+n,o=t;e[o]&&!(o>=r);)++o;if(o-t>16&&e.buffer&&em)return em.decode(e.subarray(t,o));for(var i="";t<o;){var a=e[t++];if(128&a){var l=63&e[t++];if(192!=(224&a)){var s=63&e[t++];if(224==(240&a)?a=(15&a)<<12|l<<6|s:(240!=(248&a)&&eu("Invalid UTF-8 leading byte "+ea(a)+" encountered when deserializing a UTF-8 string in wasm memory to a JS string!"),a=(7&a)<<18|l<<12|s<<6|63&e[t++]),a<65536)i+=String.fromCharCode(a);else{var u=a-65536;i+=String.fromCharCode(55296|u>>10,56320|1023&u)}}else i+=String.fromCharCode((31&a)<<6|l)}else i+=String.fromCharCode(a)}return i},ed=(e,t)=>(x("number"==typeof e,`UTF8ToString expects a number (got ${typeof e})`),e?eF(b,e,t):"");function eP(){x(null!=eO.varargs);var e=M[eO.varargs>>2];return eO.varargs+=4,e}var e_={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var n=0,r=e.length-1;r>=0;r--){var o=e[r];"."===o?e.splice(r,1):".."===o?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n;n--)e.unshift("..");return e},normalize:e=>{var t=e_.isAbs(e),n="/"===e.substr(-1);return(e=e_.normalizeArray(e.split("/").filter(e=>!!e),!t).join("/"))||t||(e="."),e&&n&&(e+="/"),(t?"/":"")+e},dirname:e=>{var t=e_.splitPath(e),n=t[0],r=t[1];return n||r?(r&&(r=r.substr(0,r.length-1)),n+r):"."},basename:e=>{if("/"===e)return"/";var t=(e=(e=e_.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return -1===t?e:e.substr(t+1)},join:(...e)=>e_.normalize(e.join("/")),join2:(e,t)=>e_.normalize(e+"/"+t)},eg=e=>(eg=(()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return e=>crypto.getRandomValues(e);W("no cryptographic support found for randomDevice. consider polyfilling it if you want to use something insecure like Math.random(), e.g. put this in a --pre-js: var crypto = { getRandomValues: (array) => { for (var i = 0; i < array.length; i++) array[i] = (Math.random()*256)|0 } };")})())(e),ec={resolve:(...e)=>{for(var t="",n=!1,r=e.length-1;r>=-1&&!n;r--){var o=r>=0?e[r]:eT.cwd();if("string"!=typeof o)throw TypeError("Arguments to path.resolve must be strings");if(!o)return"";t=o+"/"+t,n=e_.isAbs(o)}return(n?"/":"")+(t=e_.normalizeArray(t.split("/").filter(e=>!!e),!n).join("/"))||"."},relative:(e,t)=>{function n(e){for(var t=0;t<e.length&&""===e[t];t++);for(var n=e.length-1;n>=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=ec.resolve(e).substr(1),t=ec.resolve(t).substr(1);for(var r=n(e.split("/")),o=n(t.split("/")),i=Math.min(r.length,o.length),a=i,l=0;l<i;l++)if(r[l]!==o[l]){a=l;break}var s=[];for(l=a;l<r.length;l++)s.push("..");return(s=s.concat(o.slice(a))).join("/")}},eh=[],eD=e=>{for(var t=0,n=0;n<e.length;++n){var r=e.charCodeAt(n);r<=127?t++:r<=2047?t+=2:r>=55296&&r<=57343?(t+=4,++n):t+=3}return t},ep=(e,t,n,r)=>{if(x("string"==typeof e,`stringToUTF8Array expects a string (got ${typeof e})`),!(r>0))return 0;for(var o=n,i=n+r-1,a=0;a<e.length;++a){var l=e.charCodeAt(a);if(l>=55296&&l<=57343&&(l=65536+((1023&l)<<10)|1023&e.charCodeAt(++a)),l<=127){if(n>=i)break;t[n++]=l}else if(l<=2047){if(n+1>=i)break;t[n++]=192|l>>6,t[n++]=128|63&l}else if(l<=65535){if(n+2>=i)break;t[n++]=224|l>>12,t[n++]=128|l>>6&63,t[n++]=128|63&l}else{if(n+3>=i)break;l>1114111&&eu("Invalid Unicode code point "+ea(l)+" encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF)."),t[n++]=240|l>>18,t[n++]=128|l>>12&63,t[n++]=128|l>>6&63,t[n++]=128|63&l}}return t[n]=0,n-o};function ef(e,t,n){var r=Array(eD(e)+1),o=ep(e,r,0,r.length);return r.length=o,r}var eb,eA,eE={ttys:[],init(){},shutdown(){},register(e,t){eE.ttys[e]={input:[],output:[],ops:t},eT.registerDevice(e,eE.stream_ops)},stream_ops:{open(e){var t=eE.ttys[e.node.rdev];if(!t)throw new eT.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,n,r,o){if(!e.tty||!e.tty.ops.get_char)throw new eT.ErrnoError(60);for(var i,a=0,l=0;l<r;l++){try{i=e.tty.ops.get_char(e.tty)}catch(e){throw new eT.ErrnoError(29)}if(void 0===i&&0===a)throw new eT.ErrnoError(6);if(null==i)break;a++,t[n+l]=i}return a&&(e.node.timestamp=Date.now()),a},write(e,t,n,r,o){if(!e.tty||!e.tty.ops.put_char)throw new eT.ErrnoError(60);try{for(var i=0;i<r;i++)e.tty.ops.put_char(e.tty,t[n+i])}catch(e){throw new eT.ErrnoError(29)}return r&&(e.node.timestamp=Date.now()),i}},default_tty_ops:{get_char:e=>(()=>{if(!eh.length){var e=null;if("undefined"!=typeof window&&"function"==typeof window.prompt?null!==(e=window.prompt("Input: "))&&(e+="\n"):"function"==typeof readline&&(e=readline())&&(e+="\n"),!e)return null;eh=ef(e)}return eh.shift()})(),put_char(e,t){null===t||10===t?(c(eF(e.output)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(c(eF(e.output)),e.output=[])},ioctl_tcgets:e=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(e,t,n)=>0,ioctl_tiocgwinsz:e=>[24,80]},default_tty1_ops:{put_char(e,t){null===t||10===t?(h(eF(e.output)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(h(eF(e.output)),e.output=[])}}},eM=(e,t)=>(x(t,"alignment argument is required"),Math.ceil(e/t)*t),ey=e=>{var t,n=eZ(65536,e=eM(e,65536));return n&&(t=e,b.fill(0,n,n+t)),n},eG={ops_table:null,mount:e=>eG.createNode(null,"/",16895,0),createNode(e,t,n,r){if(eT.isBlkdev(n)||eT.isFIFO(n))throw new eT.ErrnoError(63);eG.ops_table||={dir:{node:{getattr:eG.node_ops.getattr,setattr:eG.node_ops.setattr,lookup:eG.node_ops.lookup,mknod:eG.node_ops.mknod,rename:eG.node_ops.rename,unlink:eG.node_ops.unlink,rmdir:eG.node_ops.rmdir,readdir:eG.node_ops.readdir,symlink:eG.node_ops.symlink},stream:{llseek:eG.stream_ops.llseek}},file:{node:{getattr:eG.node_ops.getattr,setattr:eG.node_ops.setattr},stream:{llseek:eG.stream_ops.llseek,read:eG.stream_ops.read,write:eG.stream_ops.write,allocate:eG.stream_ops.allocate,mmap:eG.stream_ops.mmap,msync:eG.stream_ops.msync}},link:{node:{getattr:eG.node_ops.getattr,setattr:eG.node_ops.setattr,readlink:eG.node_ops.readlink},stream:{}},chrdev:{node:{getattr:eG.node_ops.getattr,setattr:eG.node_ops.setattr},stream:eT.chrdev_stream_ops}};var o=eT.createNode(e,t,n,r);return eT.isDir(o.mode)?(o.node_ops=eG.ops_table.dir.node,o.stream_ops=eG.ops_table.dir.stream,o.contents={}):eT.isFile(o.mode)?(o.node_ops=eG.ops_table.file.node,o.stream_ops=eG.ops_table.file.stream,o.usedBytes=0,o.contents=null):eT.isLink(o.mode)?(o.node_ops=eG.ops_table.link.node,o.stream_ops=eG.ops_table.link.stream):eT.isChrdev(o.mode)&&(o.node_ops=eG.ops_table.chrdev.node,o.stream_ops=eG.ops_table.chrdev.stream),o.timestamp=Date.now(),e&&(e.contents[t]=o,e.timestamp=o.timestamp),o},getFileDataAsTypedArray:e=>e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0),expandFileStorage(e,t){var n=e.contents?e.contents.length:0;if(!(n>=t)){t=Math.max(t,n*(n<1048576?2:1.125)>>>0),0!=n&&(t=Math.max(t,256));var r=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(r.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,t){if(e.usedBytes!=t)if(0==t)e.contents=null,e.usedBytes=0;else{var n=e.contents;e.contents=new Uint8Array(t),n&&e.contents.set(n.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=eT.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,eT.isDir(e.mode)?t.size=4096:eT.isFile(e.mode)?t.size=e.usedBytes:eT.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){void 0!==t.mode&&(e.mode=t.mode),void 0!==t.timestamp&&(e.timestamp=t.timestamp),void 0!==t.size&&eG.resizeFileStorage(e,t.size)},lookup(e,t){throw eT.genericErrors[44]},mknod:(e,t,n,r)=>eG.createNode(e,t,n,r),rename(e,t,n){if(eT.isDir(e.mode)){var r;try{r=eT.lookupNode(t,n)}catch(e){}if(r)for(var o in r.contents)throw new eT.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=n,t.contents[n]=e,t.timestamp=e.parent.timestamp},unlink(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir(e,t){var n=eT.lookupNode(e,t);for(var r in n.contents)throw new eT.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir(e){var t=[".",".."];for(var n of Object.keys(e.contents))t.push(n);return t},symlink(e,t,n){var r=eG.createNode(e,t,41471,0);return r.link=n,r},readlink(e){if(!eT.isLink(e.mode))throw new eT.ErrnoError(28);return e.link}},stream_ops:{read(e,t,n,r,o){var i=e.node.contents;if(o>=e.node.usedBytes)return 0;var a=Math.min(e.node.usedBytes-o,r);if(x(a>=0),a>8&&i.subarray)t.set(i.subarray(o,o+a),n);else for(var l=0;l<a;l++)t[n+l]=i[o+l];return a},write(e,t,n,r,o,i){if(x(!(t instanceof ArrayBuffer)),t.buffer===f.buffer&&(i=!1),!r)return 0;var a=e.node;if(a.timestamp=Date.now(),t.subarray&&(!a.contents||a.contents.subarray)){if(i)return x(0===o,"canOwn must imply no weird position inside the file"),a.contents=t.subarray(n,n+r),a.usedBytes=r,r;if(0===a.usedBytes&&0===o)return a.contents=t.slice(n,n+r),a.usedBytes=r,r;if(o+r<=a.usedBytes)return a.contents.set(t.subarray(n,n+r),o),r}if(eG.expandFileStorage(a,o+r),a.contents.subarray&&t.subarray)a.contents.set(t.subarray(n,n+r),o);else for(var l=0;l<r;l++)a.contents[o+l]=t[n+l];return a.usedBytes=Math.max(a.usedBytes,o+r),r},llseek(e,t,n){var r=t;if(1===n?r+=e.position:2===n&&eT.isFile(e.node.mode)&&(r+=e.node.usedBytes),r<0)throw new eT.ErrnoError(28);return r},allocate(e,t,n){eG.expandFileStorage(e.node,t+n),e.node.usedBytes=Math.max(e.node.usedBytes,t+n)},mmap(e,t,n,r,o){if(!eT.isFile(e.node.mode))throw new eT.ErrnoError(43);var i,a,l=e.node.contents;if(2&o||!l||l.buffer!==f.buffer){if(a=!0,!(i=ey(t)))throw new eT.ErrnoError(48);l&&((n>0||n+t<l.length)&&(l=l.subarray?l.subarray(n,n+t):Array.prototype.slice.call(l,n,n+t)),f.set(l,i))}else a=!1,i=l.byteOffset;return{ptr:i,allocated:a}},msync:(e,t,n,r,o)=>(eG.stream_ops.write(e,t,0,r,n,!1),0)}},eS=e.preloadPlugins||[],eC=(e,t)=>{var n=0;return e&&(n|=365),t&&(n|=146),n},ex={EPERM:63,ENOENT:44,ESRCH:71,EINTR:27,EIO:29,ENXIO:60,E2BIG:1,ENOEXEC:45,EBADF:8,ECHILD:12,EAGAIN:6,EWOULDBLOCK:6,ENOMEM:48,EACCES:2,EFAULT:21,ENOTBLK:105,EBUSY:10,EEXIST:20,EXDEV:75,ENODEV:43,ENOTDIR:54,EISDIR:31,EINVAL:28,ENFILE:41,EMFILE:33,ENOTTY:59,ETXTBSY:74,EFBIG:22,ENOSPC:51,ESPIPE:70,EROFS:69,EMLINK:34,EPIPE:64,EDOM:18,ERANGE:68,ENOMSG:49,EIDRM:24,ECHRNG:106,EL2NSYNC:156,EL3HLT:107,EL3RST:108,ELNRNG:109,EUNATCH:110,ENOCSI:111,EL2HLT:112,EDEADLK:16,ENOLCK:46,EBADE:113,EBADR:114,EXFULL:115,ENOANO:104,EBADRQC:103,EBADSLT:102,EDEADLOCK:16,EBFONT:101,ENOSTR:100,ENODATA:116,ETIME:117,ENOSR:118,ENONET:119,ENOPKG:120,EREMOTE:121,ENOLINK:47,EADV:122,ESRMNT:123,ECOMM:124,EPROTO:65,EMULTIHOP:36,EDOTDOT:125,EBADMSG:9,ENOTUNIQ:126,EBADFD:127,EREMCHG:128,ELIBACC:129,ELIBBAD:130,ELIBSCN:131,ELIBMAX:132,ELIBEXEC:133,ENOSYS:52,ENOTEMPTY:55,ENAMETOOLONG:37,ELOOP:32,EOPNOTSUPP:138,EPFNOSUPPORT:139,ECONNRESET:15,ENOBUFS:42,EAFNOSUPPORT:5,EPROTOTYPE:67,ENOTSOCK:57,ENOPROTOOPT:50,ESHUTDOWN:140,ECONNREFUSED:14,EADDRINUSE:3,ECONNABORTED:13,ENETUNREACH:40,ENETDOWN:38,ETIMEDOUT:73,EHOSTDOWN:142,EHOSTUNREACH:23,EINPROGRESS:26,EALREADY:7,EDESTADDRREQ:17,EMSGSIZE:35,EPROTONOSUPPORT:66,ESOCKTNOSUPPORT:137,EADDRNOTAVAIL:4,ENETRESET:39,EISCONN:30,ENOTCONN:53,ETOOMANYREFS:141,EUSERS:136,EDQUOT:19,ESTALE:72,ENOTSUP:138,ENOMEDIUM:148,EILSEQ:25,EOVERFLOW:61,ECANCELED:11,ENOTRECOVERABLE:56,EOWNERDEAD:62,ESTRPIPE:135},eT={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:class extends Error{constructor(e){for(var t in super(w?(e=>ed(eq(e)))(e):""),this.name="ErrnoError",this.errno=e,ex)if(ex[t]===e){this.code=t;break}}},genericErrors:{},filesystems:null,syncFSRequests:0,readFiles:{},FSStream:class{constructor(){this.shared={}}get object(){return this.node}set object(e){this.node=e}get isRead(){return 1!=(2097155&this.flags)}get isWrite(){return!!(2097155&this.flags)}get isAppend(){return 1024&this.flags}get flags(){return this.shared.flags}set flags(e){this.shared.flags=e}get position(){return this.shared.position}set position(e){this.shared.position=e}},FSNode:class{constructor(e,t,n,r){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=eT.nextInode++,this.name=t,this.mode=n,this.node_ops={},this.stream_ops={},this.rdev=r,this.readMode=365,this.writeMode=146}get read(){return(this.mode&this.readMode)===this.readMode}set read(e){e?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(e){e?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return eT.isDir(this.mode)}get isDevice(){return eT.isChrdev(this.mode)}},lookupPath(e,t={}){if(!(e=ec.resolve(e)))return{path:"",node:null};if((t=Object.assign({follow_mount:!0,recurse_count:0},t)).recurse_count>8)throw new eT.ErrnoError(32);for(var n=e.split("/").filter(e=>!!e),r=eT.root,o="/",i=0;i<n.length;i++){var a=i===n.length-1;if(a&&t.parent)break;if(r=eT.lookupNode(r,n[i]),o=e_.join2(o,n[i]),eT.isMountpoint(r)&&(!a||a&&t.follow_mount)&&(r=r.mounted.root),!a||t.follow)for(var l=0;eT.isLink(r.mode);){var s=eT.readlink(o);if(o=ec.resolve(e_.dirname(o),s),r=eT.lookupPath(o,{recurse_count:t.recurse_count+1}).node,l++>40)throw new eT.ErrnoError(32)}}return{path:o,node:r}},getPath(e){for(var t;;){if(eT.isRoot(e)){var n=e.mount.mountpoint;return t?"/"!==n[n.length-1]?`${n}/${t}`:n+t:n}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var n=0,r=0;r<t.length;r++)n=(n<<5)-n+t.charCodeAt(r)|0;return(e+n>>>0)%eT.nameTable.length},hashAddNode(e){var t=eT.hashName(e.parent.id,e.name);e.name_next=eT.nameTable[t],eT.nameTable[t]=e},hashRemoveNode(e){var t=eT.hashName(e.parent.id,e.name);if(eT.nameTable[t]===e)eT.nameTable[t]=e.name_next;else for(var n=eT.nameTable[t];n;){if(n.name_next===e){n.name_next=e.name_next;break}n=n.name_next}},lookupNode(e,t){var n=eT.mayLookup(e);if(n)throw new eT.ErrnoError(n);for(var r=eT.hashName(e.id,t),o=eT.nameTable[r];o;o=o.name_next){var i=o.name;if(o.parent.id===e.id&&i===t)return o}return eT.lookup(e,t)},createNode(e,t,n,r){x("object"==typeof e);var o=new eT.FSNode(e,t,n,r);return eT.hashAddNode(o),o},destroyNode(e){eT.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>32768==(61440&e),isDir:e=>16384==(61440&e),isLink:e=>40960==(61440&e),isChrdev:e=>8192==(61440&e),isBlkdev:e=>24576==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>!(49152&~e),flagsToPermissionString(e){var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t},nodePermissions:(e,t)=>eT.ignorePermissions||(!t.includes("r")||292&e.mode)&&(!t.includes("w")||146&e.mode)&&(!t.includes("x")||73&e.mode)?0:2,mayLookup:e=>eT.isDir(e.mode)?eT.nodePermissions(e,"x")||2*!e.node_ops.lookup:54,mayCreate(e,t){try{return eT.lookupNode(e,t),20}catch(e){}return eT.nodePermissions(e,"wx")},mayDelete(e,t,n){try{r=eT.lookupNode(e,t)}catch(e){return e.errno}var r,o=eT.nodePermissions(e,"wx");if(o)return o;if(n){if(!eT.isDir(r.mode))return 54;if(eT.isRoot(r)||eT.getPath(r)===eT.cwd())return 10}else if(eT.isDir(r.mode))return 31;return 0},mayOpen:(e,t)=>e?eT.isLink(e.mode)?32:eT.isDir(e.mode)&&("r"!==eT.flagsToPermissionString(t)||512&t)?31:eT.nodePermissions(e,eT.flagsToPermissionString(t)):44,MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=eT.MAX_OPEN_FDS;e++)if(!eT.streams[e])return e;throw new eT.ErrnoError(33)},getStreamChecked(e){var t=eT.getStream(e);if(!t)throw new eT.ErrnoError(8);return t},getStream:e=>eT.streams[e],createStream:(e,t=-1)=>(x(t>=-1),e=Object.assign(new eT.FSStream,e),-1==t&&(t=eT.nextfd()),e.fd=t,eT.streams[t]=e,e),closeStream(e){eT.streams[e]=null},dupStream(e,t=-1){var n=eT.createStream(e,t);return n.stream_ops?.dup?.(n),n},chrdev_stream_ops:{open(e){var t=eT.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open?.(e)},llseek(){throw new eT.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,t)=>e<<8|t,registerDevice(e,t){eT.devices[e]={stream_ops:t}},getDevice:e=>eT.devices[e],getMounts(e){for(var t=[],n=[e];n.length;){var r=n.pop();t.push(r),n.push(...r.mounts)}return t},syncfs(e,t){"function"==typeof e&&(t=e,e=!1),eT.syncFSRequests++,eT.syncFSRequests>1&&h(`warning: ${eT.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var n=eT.getMounts(eT.root.mount),r=0;function o(e){return x(eT.syncFSRequests>0),eT.syncFSRequests--,t(e)}function i(e){if(e)return i.errored?void 0:(i.errored=!0,o(e));++r>=n.length&&o(null)}n.forEach(t=>{if(!t.type.syncfs)return i(null);t.type.syncfs(t,e,i)})},mount(e,t,n){if("string"==typeof e)throw e;var r,o="/"===n,i=!n;if(o&&eT.root)throw new eT.ErrnoError(10);if(!o&&!i){var a=eT.lookupPath(n,{follow_mount:!1});if(n=a.path,r=a.node,eT.isMountpoint(r))throw new eT.ErrnoError(10);if(!eT.isDir(r.mode))throw new eT.ErrnoError(54)}var l={type:e,opts:t,mountpoint:n,mounts:[]},s=e.mount(l);return s.mount=l,l.root=s,o?eT.root=s:r&&(r.mounted=l,r.mount&&r.mount.mounts.push(l)),s},unmount(e){var t=eT.lookupPath(e,{follow_mount:!1});if(!eT.isMountpoint(t.node))throw new eT.ErrnoError(28);var n=t.node,r=n.mounted,o=eT.getMounts(r);Object.keys(eT.nameTable).forEach(e=>{for(var t=eT.nameTable[e];t;){var n=t.name_next;o.includes(t.mount)&&eT.destroyNode(t),t=n}}),n.mounted=null;var i=n.mount.mounts.indexOf(r);x(-1!==i),n.mount.mounts.splice(i,1)},lookup:(e,t)=>e.node_ops.lookup(e,t),mknod(e,t,n){var r=eT.lookupPath(e,{parent:!0}).node,o=e_.basename(e);if(!o||"."===o||".."===o)throw new eT.ErrnoError(28);var i=eT.mayCreate(r,o);if(i)throw new eT.ErrnoError(i);if(!r.node_ops.mknod)throw new eT.ErrnoError(63);return r.node_ops.mknod(r,o,t,n)},create:(e,t)=>(t=(void 0!==t?t:438)&4095|32768,eT.mknod(e,t,0)),mkdir:(e,t)=>(t=(void 0!==t?t:511)&1023|16384,eT.mknod(e,t,0)),mkdirTree(e,t){for(var n=e.split("/"),r="",o=0;o<n.length;++o)if(n[o]){r+="/"+n[o];try{eT.mkdir(r,t)}catch(e){if(20!=e.errno)throw e}}},mkdev:(e,t,n)=>(void 0===n&&(n=t,t=438),t|=8192,eT.mknod(e,t,n)),symlink(e,t){if(!ec.resolve(e))throw new eT.ErrnoError(44);var n=eT.lookupPath(t,{parent:!0}).node;if(!n)throw new eT.ErrnoError(44);var r=e_.basename(t),o=eT.mayCreate(n,r);if(o)throw new eT.ErrnoError(o);if(!n.node_ops.symlink)throw new eT.ErrnoError(63);return n.node_ops.symlink(n,r,e)},rename(e,t){var n,r,o=e_.dirname(e),i=e_.dirname(t),a=e_.basename(e),l=e_.basename(t);if(n=eT.lookupPath(e,{parent:!0}).node,r=eT.lookupPath(t,{parent:!0}).node,!n||!r)throw new eT.ErrnoError(44);if(n.mount!==r.mount)throw new eT.ErrnoError(75);var s,u=eT.lookupNode(n,a),m=ec.relative(e,i);if("."!==m.charAt(0))throw new eT.ErrnoError(28);if("."!==(m=ec.relative(t,o)).charAt(0))throw new eT.ErrnoError(55);try{s=eT.lookupNode(r,l)}catch(e){}if(u!==s){var F=eT.isDir(u.mode),d=eT.mayDelete(n,a,F);if(d||(d=s?eT.mayDelete(r,l,F):eT.mayCreate(r,l)))throw new eT.ErrnoError(d);if(!n.node_ops.rename)throw new eT.ErrnoError(63);if(eT.isMountpoint(u)||s&&eT.isMountpoint(s))throw new eT.ErrnoError(10);if(r!==n&&(d=eT.nodePermissions(n,"w")))throw new eT.ErrnoError(d);eT.hashRemoveNode(u);try{n.node_ops.rename(u,r,l),u.parent=r}catch(e){throw e}finally{eT.hashAddNode(u)}}},rmdir(e){var t=eT.lookupPath(e,{parent:!0}).node,n=e_.basename(e),r=eT.lookupNode(t,n),o=eT.mayDelete(t,n,!0);if(o)throw new eT.ErrnoError(o);if(!t.node_ops.rmdir)throw new eT.ErrnoError(63);if(eT.isMountpoint(r))throw new eT.ErrnoError(10);t.node_ops.rmdir(t,n),eT.destroyNode(r)},readdir(e){var t=eT.lookupPath(e,{follow:!0}).node;if(!t.node_ops.readdir)throw new eT.ErrnoError(54);return t.node_ops.readdir(t)},unlink(e){var t=eT.lookupPath(e,{parent:!0}).node;if(!t)throw new eT.ErrnoError(44);var n=e_.basename(e),r=eT.lookupNode(t,n),o=eT.mayDelete(t,n,!1);if(o)throw new eT.ErrnoError(o);if(!t.node_ops.unlink)throw new eT.ErrnoError(63);if(eT.isMountpoint(r))throw new eT.ErrnoError(10);t.node_ops.unlink(t,n),eT.destroyNode(r)},readlink(e){var t=eT.lookupPath(e).node;if(!t)throw new eT.ErrnoError(44);if(!t.node_ops.readlink)throw new eT.ErrnoError(28);return ec.resolve(eT.getPath(t.parent),t.node_ops.readlink(t))},stat(e,t){var n=eT.lookupPath(e,{follow:!t}).node;if(!n)throw new eT.ErrnoError(44);if(!n.node_ops.getattr)throw new eT.ErrnoError(63);return n.node_ops.getattr(n)},lstat:e=>eT.stat(e,!0),chmod(e,t,n){var r;if(!(r="string"==typeof e?eT.lookupPath(e,{follow:!n}).node:e).node_ops.setattr)throw new eT.ErrnoError(63);r.node_ops.setattr(r,{mode:4095&t|-4096&r.mode,timestamp:Date.now()})},lchmod(e,t){eT.chmod(e,t,!0)},fchmod(e,t){var n=eT.getStreamChecked(e);eT.chmod(n.node,t)},chown(e,t,n,r){var o;if(!(o="string"==typeof e?eT.lookupPath(e,{follow:!r}).node:e).node_ops.setattr)throw new eT.ErrnoError(63);o.node_ops.setattr(o,{timestamp:Date.now()})},lchown(e,t,n){eT.chown(e,t,n,!0)},fchown(e,t,n){var r=eT.getStreamChecked(e);eT.chown(r.node,t,n)},truncate(e,t){if(t<0)throw new eT.ErrnoError(28);if(!(n="string"==typeof e?eT.lookupPath(e,{follow:!0}).node:e).node_ops.setattr)throw new eT.ErrnoError(63);if(eT.isDir(n.mode))throw new eT.ErrnoError(31);if(!eT.isFile(n.mode))throw new eT.ErrnoError(28);var n,r=eT.nodePermissions(n,"w");if(r)throw new eT.ErrnoError(r);n.node_ops.setattr(n,{size:t,timestamp:Date.now()})},ftruncate(e,t){var n=eT.getStreamChecked(e);if(!(2097155&n.flags))throw new eT.ErrnoError(28);eT.truncate(n.node,t)},utime(e,t,n){var r=eT.lookupPath(e,{follow:!0}).node;r.node_ops.setattr(r,{timestamp:Math.max(t,n)})},open(t,n,r){if(""===t)throw new eT.ErrnoError(44);if(r=64&(n="string"==typeof n?(e=>{var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===t)throw Error(`Unknown file open mode: ${e}`);return t})(n):n)?4095&(r=void 0===r?438:r)|32768:0,"object"==typeof t)o=t;else{t=e_.normalize(t);try{o=eT.lookupPath(t,{follow:!(131072&n)}).node}catch(e){}}var o,i=!1;if(64&n)if(o){if(128&n)throw new eT.ErrnoError(20)}else o=eT.mknod(t,r,0),i=!0;if(!o)throw new eT.ErrnoError(44);if(eT.isChrdev(o.mode)&&(n&=-513),65536&n&&!eT.isDir(o.mode))throw new eT.ErrnoError(54);if(!i){var a=eT.mayOpen(o,n);if(a)throw new eT.ErrnoError(a)}512&n&&!i&&eT.truncate(o,0),n&=-131713;var l=eT.createStream({node:o,path:eT.getPath(o),flags:n,seekable:!0,position:0,stream_ops:o.stream_ops,ungotten:[],error:!1});return l.stream_ops.open&&l.stream_ops.open(l),!e.logReadFiles||1&n||t in eT.readFiles||(eT.readFiles[t]=1),l},close(e){if(eT.isClosed(e))throw new eT.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{eT.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,t,n){if(eT.isClosed(e))throw new eT.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new eT.ErrnoError(70);if(0!=n&&1!=n&&2!=n)throw new eT.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,n),e.ungotten=[],e.position},read(e,t,n,r,o){if(x(n>=0),r<0||o<0)throw new eT.ErrnoError(28);if(eT.isClosed(e)||1==(2097155&e.flags))throw new eT.ErrnoError(8);if(eT.isDir(e.node.mode))throw new eT.ErrnoError(31);if(!e.stream_ops.read)throw new eT.ErrnoError(28);var i=void 0!==o;if(i){if(!e.seekable)throw new eT.ErrnoError(70)}else o=e.position;var a=e.stream_ops.read(e,t,n,r,o);return i||(e.position+=a),a},write(e,t,n,r,o,i){if(x(n>=0),r<0||o<0)throw new eT.ErrnoError(28);if(eT.isClosed(e)||!(2097155&e.flags))throw new eT.ErrnoError(8);if(eT.isDir(e.node.mode))throw new eT.ErrnoError(31);if(!e.stream_ops.write)throw new eT.ErrnoError(28);e.seekable&&1024&e.flags&&eT.llseek(e,0,2);var a=void 0!==o;if(a){if(!e.seekable)throw new eT.ErrnoError(70)}else o=e.position;var l=e.stream_ops.write(e,t,n,r,o,i);return a||(e.position+=l),l},allocate(e,t,n){if(eT.isClosed(e))throw new eT.ErrnoError(8);if(t<0||n<=0)throw new eT.ErrnoError(28);if(!(2097155&e.flags))throw new eT.ErrnoError(8);if(!eT.isFile(e.node.mode)&&!eT.isDir(e.node.mode))throw new eT.ErrnoError(43);if(!e.stream_ops.allocate)throw new eT.ErrnoError(138);e.stream_ops.allocate(e,t,n)},mmap(e,t,n,r,o){if(2&r&&!(2&o)&&2!=(2097155&e.flags)||1==(2097155&e.flags))throw new eT.ErrnoError(2);if(!e.stream_ops.mmap)throw new eT.ErrnoError(43);if(!t)throw new eT.ErrnoError(28);return e.stream_ops.mmap(e,t,n,r,o)},msync:(e,t,n,r,o)=>(x(n>=0),e.stream_ops.msync?e.stream_ops.msync(e,t,n,r,o):0),ioctl(e,t,n){if(!e.stream_ops.ioctl)throw new eT.ErrnoError(59);return e.stream_ops.ioctl(e,t,n)},readFile(e,t={}){if(t.flags=t.flags||0,t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding)throw Error(`Invalid encoding type "${t.encoding}"`);var n,r=eT.open(e,t.flags),o=eT.stat(e).size,i=new Uint8Array(o);return eT.read(r,i,0,o,0),"utf8"===t.encoding?n=eF(i):"binary"===t.encoding&&(n=i),eT.close(r),n},writeFile(e,t,n={}){n.flags=n.flags||577;var r=eT.open(e,n.flags,n.mode);if("string"==typeof t){var o=new Uint8Array(eD(t)+1),i=ep(t,o,0,o.length);eT.write(r,o,0,i,void 0,n.canOwn)}else{if(!ArrayBuffer.isView(t))throw Error("Unsupported data type");eT.write(r,t,0,t.byteLength,void 0,n.canOwn)}eT.close(r)},cwd:()=>eT.currentPath,chdir(e){var t=eT.lookupPath(e,{follow:!0});if(null===t.node)throw new eT.ErrnoError(44);if(!eT.isDir(t.node.mode))throw new eT.ErrnoError(54);var n=eT.nodePermissions(t.node,"x");if(n)throw new eT.ErrnoError(n);eT.currentPath=t.path},createDefaultDirectories(){eT.mkdir("/tmp"),eT.mkdir("/home"),eT.mkdir("/home/web_user")},createDefaultDevices(){eT.mkdir("/dev"),eT.registerDevice(eT.makedev(1,3),{read:()=>0,write:(e,t,n,r,o)=>r}),eT.mkdev("/dev/null",eT.makedev(1,3)),eE.register(eT.makedev(5,0),eE.default_tty_ops),eE.register(eT.makedev(6,0),eE.default_tty1_ops),eT.mkdev("/dev/tty",eT.makedev(5,0)),eT.mkdev("/dev/tty1",eT.makedev(6,0));var e=new Uint8Array(1024),t=0,n=()=>(0===t&&(t=eg(e).byteLength),e[--t]);eT.createDevice("/dev","random",n),eT.createDevice("/dev","urandom",n),eT.mkdir("/dev/shm"),eT.mkdir("/dev/shm/tmp")},createSpecialDirectories(){eT.mkdir("/proc");var e=eT.mkdir("/proc/self");eT.mkdir("/proc/self/fd"),eT.mount({mount(){var t=eT.createNode(e,"fd",16895,73);return t.node_ops={lookup(e,t){var n=eT.getStreamChecked(+t),r={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>n.path}};return r.parent=r,r}},t}},{},"/proc/self/fd")},createStandardStreams(e,t,n){e?eT.createDevice("/dev","stdin",e):eT.symlink("/dev/tty","/dev/stdin"),t?eT.createDevice("/dev","stdout",null,t):eT.symlink("/dev/tty","/dev/stdout"),n?eT.createDevice("/dev","stderr",null,n):eT.symlink("/dev/tty1","/dev/stderr");var r=eT.open("/dev/stdin",0),o=eT.open("/dev/stdout",1),i=eT.open("/dev/stderr",1);x(0===r.fd,`invalid handle for stdin (${r.fd})`),x(1===o.fd,`invalid handle for stdout (${o.fd})`),x(2===i.fd,`invalid handle for stderr (${i.fd})`)},staticInit(){[44].forEach(e=>{eT.genericErrors[e]=new eT.ErrnoError(e),eT.genericErrors[e].stack="<generic error, no stack>"}),eT.nameTable=Array(4096),eT.mount(eG,{},"/"),eT.createDefaultDirectories(),eT.createDefaultDevices(),eT.createSpecialDirectories(),eT.filesystems={MEMFS:eG}},init(t,n,r){x(!eT.initialized,"FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)"),eT.initialized=!0,t??=e.stdin,n??=e.stdout,r??=e.stderr,eT.createStandardStreams(t,n,r)},quit(){eT.initialized=!1,eQ(0);for(var e=0;e<eT.streams.length;e++){var t=eT.streams[e];t&&eT.close(t)}},findObject(e,t){var n=eT.analyzePath(e,t);return n.exists?n.object:null},analyzePath(e,t){try{e=(r=eT.lookupPath(e,{follow:!t})).path}catch(e){}var n={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var r=eT.lookupPath(e,{parent:!0});n.parentExists=!0,n.parentPath=r.path,n.parentObject=r.node,n.name=e_.basename(e),r=eT.lookupPath(e,{follow:!t}),n.exists=!0,n.path=r.path,n.object=r.node,n.name=r.node.name,n.isRoot="/"===r.path}catch(e){n.error=e.errno}return n},createPath(e,t,n,r){e="string"==typeof e?e:eT.getPath(e);for(var o=t.split("/").reverse();o.length;){var i=o.pop();if(i){var a=e_.join2(e,i);try{eT.mkdir(a)}catch(e){}e=a}}return a},createFile(e,t,n,r,o){var i=e_.join2("string"==typeof e?e:eT.getPath(e),t),a=eC(r,o);return eT.create(i,a)},createDataFile(e,t,n,r,o,i){var a=t;e&&(e="string"==typeof e?e:eT.getPath(e),a=t?e_.join2(e,t):e);var l=eC(r,o),s=eT.create(a,l);if(n){if("string"==typeof n){for(var u=Array(n.length),m=0,F=n.length;m<F;++m)u[m]=n.charCodeAt(m);n=u}eT.chmod(s,146|l);var d=eT.open(s,577);eT.write(d,n,0,n.length,0,i),eT.close(d),eT.chmod(s,l)}},createDevice(e,t,n,r){var o=e_.join2("string"==typeof e?e:eT.getPath(e),t),i=eC(!!n,!!r);eT.createDevice.major??=64;var a=eT.makedev(eT.createDevice.major++,0);return eT.registerDevice(a,{open(e){e.seekable=!1},close(e){r?.buffer?.length&&r(10)},read(e,t,r,o,i){for(var a,l=0,s=0;s<o;s++){try{a=n()}catch(e){throw new eT.ErrnoError(29)}if(void 0===a&&0===l)throw new eT.ErrnoError(6);if(null==a)break;l++,t[r+s]=a}return l&&(e.node.timestamp=Date.now()),l},write(e,t,n,o,i){for(var a=0;a<o;a++)try{r(t[n+a])}catch(e){throw new eT.ErrnoError(29)}return o&&(e.node.timestamp=Date.now()),a}}),eT.mkdev(o,i,a)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;
1if("undefined"!=typeof XMLHttpRequest)throw Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");try{e.contents=m(e.url),e.usedBytes=e.contents.length}catch(e){throw new eT.ErrnoError(29)}},createLazyFile(e,t,n,r,o){class i{constructor(){this.lengthKnown=!1,this.chunks=[]}get(e){if(!(e>this.length-1||e<0)){var t=e%this.chunkSize,n=e/this.chunkSize|0;return this.getter(n)[t]}}setDataGetter(e){this.getter=e}cacheLength(){var e=new XMLHttpRequest;if(e.open("HEAD",n,!1),e.send(null),!(e.status>=200&&e.status<300||304===e.status))throw Error("Couldn't load "+n+". Status: "+e.status);var t,r=Number(e.getResponseHeader("Content-length")),o=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t,i=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t,a=1048576;o||(a=r);var l=this;l.setDataGetter(e=>{var t=e*a,o=(e+1)*a-1;if(o=Math.min(o,r-1),void 0===l.chunks[e]&&(l.chunks[e]=((e,t)=>{if(e>t)throw Error("invalid range ("+e+", "+t+") or no bytes requested!");if(t>r-1)throw Error("only "+r+" bytes available! programmer error!");var o=new XMLHttpRequest;if(o.open("GET",n,!1),r!==a&&o.setRequestHeader("Range","bytes="+e+"-"+t),o.responseType="arraybuffer",o.overrideMimeType&&o.overrideMimeType("text/plain; charset=x-user-defined"),o.send(null),!(o.status>=200&&o.status<300||304===o.status))throw Error("Couldn't load "+n+". Status: "+o.status);return void 0!==o.response?new Uint8Array(o.response||[]):ef(o.responseText||"")})(t,o)),void 0===l.chunks[e])throw Error("doXHR failed!");return l.chunks[e]}),!i&&r||(a=r=1,a=r=this.getter(0).length,c("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=r,this._chunkSize=a,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if("undefined"!=typeof XMLHttpRequest){if(!s)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var a={isDevice:!1,contents:new i}}else a={isDevice:!1,url:n};var l=eT.createFile(e,t,a,r,o);a.contents?l.contents=a.contents:a.url&&(l.contents=null,l.url=a.url),Object.defineProperties(l,{usedBytes:{get:function(){return this.contents.length}}});var u={};function m(e,t,n,r,o){var i=e.node.contents;if(o>=i.length)return 0;var a=Math.min(i.length-o,r);if(x(a>=0),i.slice)for(var l=0;l<a;l++)t[n+l]=i[o+l];else for(l=0;l<a;l++)t[n+l]=i.get(o+l);return a}return Object.keys(l.stream_ops).forEach(e=>{var t=l.stream_ops[e];u[e]=(...e)=>(eT.forceLoadFile(l),t(...e))}),u.read=(e,t,n,r,o)=>(eT.forceLoadFile(l),m(e,t,n,r,o)),u.mmap=(e,t,n,r,o)=>{eT.forceLoadFile(l);var i=ey(t);if(!i)throw new eT.ErrnoError(48);return m(e,f,i,t,n),{ptr:i,allocated:!0}},l.stream_ops=u,l},absolutePath(){W("FS.absolutePath has been removed; use PATH_FS.resolve instead")},createFolder(){W("FS.createFolder has been removed; use FS.mkdir instead")},createLink(){W("FS.createLink has been removed; use FS.symlink instead")},joinPath(){W("FS.joinPath has been removed; use PATH.join instead")},mmapAlloc(){W("FS.mmapAlloc has been replaced by the top level function mmapAlloc")},standardizePath(){W("FS.standardizePath has been removed; use PATH.normalize instead")}},eO={DEFAULT_POLLMASK:5,calculateAt(e,t,n){var r;if(e_.isAbs(t))return t;if(r=-100===e?eT.cwd():eO.getStreamFromFD(e).path,0==t.length){if(!n)throw new eT.ErrnoError(44);return r}return e_.join2(r,t)},doStat(e,t,n){var r=e(t);M[n>>2]=r.dev,M[n+4>>2]=r.mode,y[n+8>>2]=r.nlink,M[n+12>>2]=r.uid,M[n+16>>2]=r.gid,M[n+20>>2]=r.rdev,X=[r.size>>>0,+Math.abs(K=r.size)>=1?K>0?Math.floor(K/0x100000000)>>>0:~~Math.ceil((K-(~~K>>>0))/0x100000000)>>>0:0],M[n+24>>2]=X[0],M[n+28>>2]=X[1],M[n+32>>2]=4096,M[n+36>>2]=r.blocks;var o=r.atime.getTime(),i=r.mtime.getTime(),a=r.ctime.getTime();return X=[Math.floor(o/1e3)>>>0,+Math.abs(K=Math.floor(o/1e3))>=1?K>0?Math.floor(K/0x100000000)>>>0:~~Math.ceil((K-(~~K>>>0))/0x100000000)>>>0:0],M[n+40>>2]=X[0],M[n+44>>2]=X[1],y[n+48>>2]=o%1e3*1e6,X=[Math.floor(i/1e3)>>>0,+Math.abs(K=Math.floor(i/1e3))>=1?K>0?Math.floor(K/0x100000000)>>>0:~~Math.ceil((K-(~~K>>>0))/0x100000000)>>>0:0],M[n+56>>2]=X[0],M[n+60>>2]=X[1],y[n+64>>2]=i%1e3*1e6,X=[Math.floor(a/1e3)>>>0,+Math.abs(K=Math.floor(a/1e3))>=1?K>0?Math.floor(K/0x100000000)>>>0:~~Math.ceil((K-(~~K>>>0))/0x100000000)>>>0:0],M[n+72>>2]=X[0],M[n+76>>2]=X[1],y[n+80>>2]=a%1e3*1e6,X=[r.ino>>>0,+Math.abs(K=r.ino)>=1?K>0?Math.floor(K/0x100000000)>>>0:~~Math.ceil((K-(~~K>>>0))/0x100000000)>>>0:0],M[n+88>>2]=X[0],M[n+92>>2]=X[1],0}
1,doMsync(e,t,n,r,o){if(!eT.isFile(t.node.mode))throw new eT.ErrnoError(43);if(2&r)return 0;var i=b.slice(e,e+n);eT.msync(t,i,o,n,r)},getStreamFromFD:e=>eT.getStreamChecked(e),varargs:void 0,getStr:e=>ed(e)},ev=(e,t)=>(x(e==e>>>0||e==(0|e)),x(t===(0|t)),t+2097152>>>0<4194305-!!e?(e>>>0)+0x100000000*t:NaN),eR=(e,t,n)=>(x("number"==typeof n,"stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),ep(e,b,t,n)),ek=[0,31,60,91,121,152,182,213,244,274,305,335],ew=[0,31,59,90,120,151,181,212,243,273,304,334],eI=e=>{var t=D.buffer,n=(e-t.byteLength+65535)/65536|0;try{return D.grow(n),T(),1}catch(n){h(`growMemory: Attempted to grow heap from ${t.byteLength} bytes to ${e} bytes, but got error: ${n}`)}},ej={},eB=()=>{if(!eB.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:P||"./this.program"};for(var t in ej)void 0===ej[t]?delete e[t]:e[t]=ej[t];var n=[];for(var t in e)n.push(`${t}=${e[t]}`);eB.strings=n}return eB.strings},eL=[],eN=e=>{var t=eL[e];return t||(e>=eL.length&&(eL.length=e+1),eL[e]=t=eb.get(e)),x(eb.get(e)==t,"JavaScript-side Wasm function table mirror is out of date!"),t},eV="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0,eU=(e,t)=>{x(e<16384),e<128?t.push(e):t.push(e%128|128,e>>7)},e$=[],ez=(e,t)=>{eb.set(e,t),eL[e]=eb.get(e)},eW=e=>e3(e),eH=(t,n,r,o,i)=>{var a,l,s={string:e=>{var t,n,r=0;return null!=e&&0!==e&&(n=eW(t=eD(e)+1),eR(e,n,t),r=n),r},array:e=>{var t=eW(e.length);return x(e.length>=0,"writeArrayToMemory array must have a length (should be an array or typed array)"),f.set(e,t),t}},u=(x(a=e["_"+t],"Cannot call unknown function "+t+", make sure it is exported"),a),m=[],F=0;if(x("array"!==n,'Return type should not be "array".'),o)for(var d=0;d<o.length;d++){var P=s[r[d]];P?(0===F&&(F=es()),m[d]=P(o[d])):m[d]=o[d]}var _=u(...m);return l=_,0!==F&&el(F),_="string"===n?ed(l):"boolean"===n?!!l:l};eT.createPreloadedFile=(e,t,n,r,o,i,a,l,s,m)=>{var F,d=t?ec.resolve(e_.join2(e,t)):e,P=U(`cp ${d}`);function _(n){var u,F;function _(n){m?.(),l||eT.createDataFile(e,t,n,r,o,s),i?.(),z(P)}u=()=>{a?.(),z(P)},"undefined"!=typeof Browser&&Browser.init(),F=!1,eS.forEach(e=>{F||e.canHandle(d)&&(e.handle(n,d,_,u),F=!0)}),F||_(n)}$(P),"string"==typeof n?(F=U(`al ${n}`),u(n).then(e=>{x(e,`Loading data file "${n}" failed (no arrayBuffer).`),_(new Uint8Array(e)),F&&z(F)},e=>{if(!a)throw`Loading data file "${n}" failed.`;a()}),F&&$(F)):_(n)},eT.staticInit();var eK={__assert_fail:(e,t,n,r)=>{W(`Assertion failed: ${ed(e)}, at: `+[t?ed(t):"unknown filename",n,r?ed(r):"unknown function"])},__syscall_fcntl64:function(e,t,n){eO.varargs=n;try{var r=eO.getStreamFromFD(e);switch(t){case 0:if((o=eP())<0)break;for(;eT.streams[o];)o++;return eT.dupStream(r,o).fd;case 1:case 2:case 13:case 14:return 0;case 3:return r.flags;case 4:var o=eP();return r.flags|=o,0;case 12:return A[(o=eP())+0>>1]=2,0}return -28}catch(e){if(void 0===eT||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_fstat64:function(e,t){try{var n=eO.getStreamFromFD(e);return eO.doStat(eT.stat,n.path,t)}catch(e){if(void 0===eT||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_ftruncate64:function(e,t,n){var r=ev(t,n);try{return isNaN(r)?61:(eT.ftruncate(e,r),0)}catch(e){if(void 0===eT||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_getdents64:function(e,t,n){try{var r=eO.getStreamFromFD(e);r.getdents||=eT.readdir(r.path);for(var o=0,i=eT.llseek(r,0,1),a=Math.floor(i/280);a<r.getdents.length&&o+280<=n;){var l,s,u=r.getdents[a];if("."===u)l=r.node.id,s=4;else if(".."===u)l=eT.lookupPath(r.path,{parent:!0}).node.id,s=4;else{var m=eT.lookupNode(r.node,u);l=m.id,s=eT.isChrdev(m.mode)?2:eT.isDir(m.mode)?4:eT.isLink(m.mode)?10:8}x(l),X=[l>>>0,(K=l,+Math.abs(K)>=1?K>0?Math.floor(K/0x100000000)>>>0:~~Math.ceil((K-(~~K>>>0))/0x100000000)>>>0:0)],M[t+o>>2]=X[0],M[t+o+4>>2]=X[1],X=[(a+1)*280>>>0,(K=(a+1)*280,+Math.abs(K)>=1?K>0?Math.floor(K/0x100000000)>>>0:~~Math.ceil((K-(~~K>>>0))/0x100000000)>>>0:0)],M[t+o+8>>2]=X[0],M[t+o+12>>2]=X[1],A[t+o+16>>1]=280,f[t+o+18]=s,eR(u,t+o+19,256),o+=280,a+=1}return eT.llseek(r,280*a,0),o}catch(e){if(void 0===eT||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_ioctl:function(e,t,n){eO.varargs=n;try{var r=eO.getStreamFromFD(e);switch(t){case 21509:case 21510:case 21511:case 21512:case 21524:case 21515:return r.tty?0:-59;case 21505:if(!r.tty)return -59;if(r.tty.ops.ioctl_tcgets){var o=r.tty.ops.ioctl_tcgets(r),i=eP();M[i>>2]=o.c_iflag||0,M[i+4>>2]=o.c_oflag||0,M[i+8>>2]=o.c_cflag||0,M[i+12>>2]=o.c_lflag||0;for(var a=0;a<32;a++)f[i+a+17]=o.c_cc[a]||0}return 0;case 21506:case 21507:case 21508:if(!r.tty)return -59;if(r.tty.ops.ioctl_tcsets){var l=M[(i=eP())>>2],s=M[i+4>>2],u=M[i+8>>2],m=M[i+12>>2],F=[];for(a=0;a<32;a++)F.push(f[i+a+17]);return r.tty.ops.ioctl_tcsets(r.tty,t,{c_iflag:l,c_oflag:s,c_cflag:u,c_lflag:m,c_cc:F})}return 0;case 21519:return r.tty?(M[(i=eP())>>2]=0,0):-59;case 21520:return r.tty?-28:-59;case 21531:return i=eP(),eT.ioctl(r,t,i);case 21523:if(!r.tty)return -59;if(r.tty.ops.ioctl_tiocgwinsz){var d=r.tty.ops.ioctl_tiocgwinsz(r.tty);A[(i=eP())>>1]=d[0],A[i+2>>1]=d[1]}return 0;default:return -28}}catch(e){if(void 0===eT||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_lstat64:function(e,t){try{return e=eO.getStr(e),eO.doStat(eT.lstat,e,t)}catch(e){if(void 0===eT||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_newfstatat:function(e,t,n,r){try{t=eO.getStr(t);var o=256&r,i=4096&r;return x(!(r&=-6401),`unknown flags in __syscall_newfstatat: ${r}`),t=eO.calculateAt(e,t,i),eO.doStat(o?eT.lstat:eT.stat,t,n)}catch(e){if(void 0===eT||"ErrnoError"!==e.name)throw e;return-e.errno}}
1,__syscall_openat:function(e,t,n,r){eO.varargs=r;try{t=eO.getStr(t),t=eO.calculateAt(e,t);var o=r?eP():0;return eT.open(t,n,o).fd}catch(e){if(void 0===eT||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_rmdir:function(e){try{return e=eO.getStr(e),eT.rmdir(e),0}catch(e){if(void 0===eT||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_stat64:function(e,t){try{return e=eO.getStr(e),eO.doStat(eT.stat,e,t)}catch(e){if(void 0===eT||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_unlinkat:function(e,t,n){try{return t=eO.getStr(t),t=eO.calculateAt(e,t),0===n?eT.unlink(t):512===n?eT.rmdir(t):W("Invalid flags passed to unlinkat"),0}catch(e){if(void 0===eT||"ErrnoError"!==e.name)throw e;return-e.errno}},_abort_js:()=>{W("native code called abort()")},_emscripten_memcpy_js:(e,t,n)=>b.copyWithin(e,t,t+n),_emscripten_throw_longjmp:()=>{throw 1/0},_gmtime_js:function(e,t,n){var r=new Date(1e3*ev(e,t));M[n>>2]=r.getUTCSeconds(),M[n+4>>2]=r.getUTCMinutes(),M[n+8>>2]=r.getUTCHours(),M[n+12>>2]=r.getUTCDate(),M[n+16>>2]=r.getUTCMonth(),M[n+20>>2]=r.getUTCFullYear()-1900,M[n+24>>2]=r.getUTCDay();var o=Date.UTC(r.getUTCFullYear(),0,1,0,0,0,0),i=(r.getTime()-o)/864e5|0;M[n+28>>2]=i},_localtime_js:function(e,t,n){var r,o=new Date(1e3*ev(e,t));M[n>>2]=o.getSeconds(),M[n+4>>2]=o.getMinutes(),M[n+8>>2]=o.getHours(),M[n+12>>2]=o.getDate(),M[n+16>>2]=o.getMonth(),M[n+20>>2]=o.getFullYear()-1900,M[n+24>>2]=o.getDay();var i=0|((r=o.getFullYear())%4!=0||r%100==0&&r%400!=0?ew:ek)[o.getMonth()]+o.getDate()-1;M[n+28>>2]=i,M[n+36>>2]=-60*o.getTimezoneOffset();var a=new Date(o.getFullYear(),0,1),l=new Date(o.getFullYear(),6,1).getTimezoneOffset(),s=a.getTimezoneOffset(),u=0|(l!=s&&o.getTimezoneOffset()==Math.min(s,l));M[n+32>>2]=u},_tzset_js:(e,t,n,r)=>{var o=(new Date).getFullYear(),i=new Date(o,0,1),a=new Date(o,6,1),l=i.getTimezoneOffset(),s=a.getTimezoneOffset(),u=Math.max(l,s);y[e>>2]=60*u,M[t>>2]=Number(l!=s);var m=e=>{var t=Math.abs(e);return`UTC${e>=0?"-":"+"}${String(Math.floor(t/60)).padStart(2,"0")}${String(t%60).padStart(2,"0")}`},F=m(l),d=m(s);x(F),x(d),x(16>=eD(F),`timezone name truncated to fit in TZNAME_MAX (${F})`),x(16>=eD(d),`timezone name truncated to fit in TZNAME_MAX (${d})`),s<l?(eR(F,n,17),eR(d,r,17)):(eR(F,r,17),eR(d,n,17))},emscripten_date_now:()=>Date.now(),emscripten_resize_heap:e=>{var t=b.length;if(x((e>>>=0)>t),e>0x80000000)return h(`Cannot enlarge memory, requested ${e} bytes, but the limit is 2147483648 bytes!`),!1;for(var n=1;n<=4;n*=2){var r=t*(1+.2/n);r=Math.min(r,e+0x6000000);var o=Math.min(0x80000000,eM(Math.max(e,r),65536));if(eI(o))return!0}return h(`Failed to grow the heap from ${t} bytes to ${o} bytes, not enough memory!`),!1},environ_get:(e,t)=>{var n=0;return eB().forEach((r,o)=>{var i=t+n;y[e+4*o>>2]=i,((e,t)=>{for(var n=0;n<e.length;++n)x(e.charCodeAt(n)===(255&e.charCodeAt(n))),f[t++]=e.charCodeAt(n);f[t]=0})(r,i),n+=r.length+1}),0},environ_sizes_get:(e,t)=>{var n=eB();y[e>>2]=n.length;var r=0;return n.forEach(e=>r+=e.length+1),y[t>>2]=r,0},fd_close:function(e){try{var t=eO.getStreamFromFD(e);return eT.close(t),0}catch(e){if(void 0===eT||"ErrnoError"!==e.name)throw e;return e.errno}},fd_read:function(e,t,n,r){try{var o=((e,t,n,r)=>{for(var o=0,i=0;i<n;i++){var a=y[t>>2],l=y[t+4>>2];t+=8;var s=eT.read(e,f,a,l,void 0);if(s<0)return -1;if(o+=s,s<l)break}return o})(eO.getStreamFromFD(e),t,n);return y[r>>2]=o,0}catch(e){if(void 0===eT||"ErrnoError"!==e.name)throw e;return e.errno}},fd_seek:function(e,t,n,r,o){var i=ev(t,n);try{if(isNaN(i))return 61;var a=eO.getStreamFromFD(e);return eT.llseek(a,i,r),X=[a.position>>>0,(K=a.position,+Math.abs(K)>=1?K>0?Math.floor(K/0x100000000)>>>0:~~Math.ceil((K-(~~K>>>0))/0x100000000)>>>0:0)],M[o>>2]=X[0],M[o+4>>2]=X[1],a.getdents&&0===i&&0===r&&(a.getdents=null),0}catch(e){if(void 0===eT||"ErrnoError"!==e.name)throw e;return e.errno}},fd_sync:function(e){try{var t=eO.getStreamFromFD(e);return t.stream_ops?.fsync?t.stream_ops.fsync(t):0}catch(e){if(void 0===eT||"ErrnoError"!==e.name)throw e;return e.errno}},fd_write:function(e,t,n,r){try{var o=((e,t,n,r)=>{for(var o=0,i=0;i<n;i++){var a=y[t>>2],l=y[t+4>>2];t+=8;var s=eT.write(e,f,a,l,void 0);if(s<0)return -1;if(o+=s,s<l)break}return o}
1)(eO.getStreamFromFD(e),t,n);return y[r>>2]=o,0}catch(e){if(void 0===eT||"ErrnoError"!==e.name)throw e;return e.errno}},invoke_ii:function(e,t){var n=es();try{return eN(e)(t)}catch(e){if(el(n),e!==e+0)throw e;e0(1,0)}},invoke_iii:function(e,t,n){var r=es();try{return eN(e)(t,n)}catch(e){if(el(r),e!==e+0)throw e;e0(1,0)}},invoke_iiii:function(e,t,n,r){var o=es();try{return eN(e)(t,n,r)}catch(e){if(el(o),e!==e+0)throw e;e0(1,0)}},invoke_iiiii:function(e,t,n,r,o){var i=es();try{return eN(e)(t,n,r,o)}catch(e){if(el(i),e!==e+0)throw e;e0(1,0)}},invoke_v:function(e){var t=es();try{eN(e)()}catch(e){if(el(t),e!==e+0)throw e;e0(1,0)}},invoke_vi:function(e,t){var n=es();try{eN(e)(t)}catch(e){if(el(n),e!==e+0)throw e;e0(1,0)}},invoke_vii:function(e,t,n){var r=es();try{eN(e)(t,n)}catch(e){if(el(r),e!==e+0)throw e;e0(1,0)}},invoke_viii:function(e,t,n,r){var o=es();try{eN(e)(t,n,r)}catch(e){if(el(o),e!==e+0)throw e;e0(1,0)}},invoke_viiii:function(e,t,n,r,o){var i=es();try{eN(e)(t,n,r,o)}catch(e){if(el(i),e!==e+0)throw e;e0(1,0)}},invoke_viiiiiiiii:function(e,t,n,r,o,i,a,l,s,u){var m=es();try{eN(e)(t,n,r,o,i,a,l,s,u)}catch(e){if(el(m),e!==e+0)throw e;e0(1,0)}}},eX=function(){var t={env:eK,wasi_snapshot_preview1:eK};function r(t,n){var r;return e.wasmExports=eX=t.exports,x(D=eX.memory,"memory not found in wasm exports"),T(),x(eb=eX.__indirect_function_table,"table not found in wasm exports"),r=eX.__wasm_call_ctors,R.unshift(r),z("wasm-instantiate"),eX}$("wasm-instantiate");var i,a=e;if(e.instantiateWasm)try{return e.instantiateWasm(t,r)}catch(e){h(`Module.instantiateWasm callback failed with error: ${e}`),o(e)}return(H??=function(){if(e.locateFile){var t="pdfium.wasm";return Y(t)?t:e.locateFile?e.locateFile(t,_):_+t}return F?"pdfium.wasm":new n.U(n(6611)).href}(),i=function(t){x(e===a,"the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"),a=null,r(t.instance)},p||"function"!=typeof WebAssembly.instantiateStreaming||Y(H)||"function"!=typeof fetch?Z(H,t,i):fetch(H,{credentials:"same-origin"}).then(e=>WebAssembly.instantiateStreaming(e,t).then(i,function(e){return h(`wasm streaming compile failed: ${e}`),h("falling back to ArrayBuffer instantiation"),Z(H,t,i)}))).catch(o),{}}();e._PDFiumExt_Init=q("PDFiumExt_Init",0),e._FPDF_InitLibraryWithConfig=q("FPDF_InitLibraryWithConfig",1),e._PDFiumExt_OpenFileWriter=q("PDFiumExt_OpenFileWriter",0),e._PDFiumExt_GetFileWriterSize=q("PDFiumExt_GetFileWriterSize",1),e._PDFiumExt_GetFileWriterData=q("PDFiumExt_GetFileWriterData",3),e._PDFiumExt_CloseFileWriter=q("PDFiumExt_CloseFileWriter",1),e._PDFiumExt_SaveAsCopy=q("PDFiumExt_SaveAsCopy",2),e._FPDF_SaveAsCopy=q("FPDF_SaveAsCopy",3),e._PDFiumExt_OpenFormFillInfo=q("PDFiumExt_OpenFormFillInfo",0),e._PDFiumExt_CloseFormFillInfo=q("PDFiumExt_CloseFormFillInfo",1),e._PDFiumExt_InitFormFillEnvironment=q("PDFiumExt_InitFormFillEnvironment",2),e._FPDFDOC_InitFormFillEnvironment=q("FPDFDOC_InitFormFillEnvironment",2),e._PDFiumExt_ExitFormFillEnvironment=q("PDFiumExt_ExitFormFillEnvironment",1),e._FPDFDOC_ExitFormFillEnvironment=q("FPDFDOC_ExitFormFillEnvironment",1),e._EPDFNamedDest_SetDest=q("EPDFNamedDest_SetDest",3),e._EPDFNamedDest_Remove=q("EPDFNamedDest_Remove",2),e._EPDFDest_CreateView=q("EPDFDest_CreateView",4),e._EPDFDest_CreateXYZ=q("EPDFDest_CreateXYZ",7),e._EPDFDest_CreateRemoteView=q("EPDFDest_CreateRemoteView",5),e._EPDFDest_CreateRemoteXYZ=q("EPDFDest_CreateRemoteXYZ",8),e._EPDFAction_CreateGoTo=q("EPDFAction_CreateGoTo",2),e._EPDFAction_CreateGoToNamed=q("EPDFAction_CreateGoToNamed",2),e._EPDFAction_CreateLaunch=q("EPDFAction_CreateLaunch",2),e._EPDFAction_CreateRemoteGoToByName=q("EPDFAction_CreateRemoteGoToByName",3),e._EPDFAction_CreateRemoteGoToDest=q("EPDFAction_CreateRemoteGoToDest",3),e._EPDFAction_CreateURI=q("EPDFAction_CreateURI",2),e._EPDFBookmark_Create=q("EPDFBookmark_Create",2),e._EPDFBookmark_Delete=q("EPDFBookmark_Delete",2),e._EPDFBookmark_AppendChild=q("EPDFBookmark_AppendChild",3),e._EPDFBookmark_InsertAfter=q("EPDFBookmark_InsertAfter",4),e._EPDFBookmark_Clear=q("EPDFBookmark_Clear",1),e._EPDFBookmark_SetTitle=q("EPDFBookmark_SetTitle",2),e._EPDFBookmark_SetDest=q("EPDFBookmark_SetDest",3),e._EPDFBookmark_SetAction=q("EPDFBookmark_SetAction",3),e._EPDFBookmark_ClearTarget=q("EPDFBookmark_ClearTarget",1),e._EPDF_PNG_EncodeRGBA=q("EPDF_PNG_EncodeRGBA",6),e._FPDFAnnot_IsSupportedSubtype=q("FPDFAnnot_IsSupportedSubtype",1),e._FPDFPage_CreateAnnot=q("FPDFPage_CreateAnnot",2),e._FPDFPage_GetAnnotCount=q("FPDFPage_GetAnnotCount",1),e._FPDFPage_GetAnnot=q("FPDFPage_GetAnnot",2),e._FPDFPage_GetAnnotIndex=q("FPDFPage_GetAnnotIndex",2),e._FPDFPage_CloseAnnot=q("FPDFPage_CloseAnnot",1),e._FPDFPage_RemoveAnnot=q("FPDFPage_RemoveAnnot",2),e._FPDFAnnot_GetSubtype=q("FPDFAnnot_GetSubtype",1),e._FPDFAnnot_IsObjectSupportedSubtype=q("FPDFAnnot_IsObjectSupportedSubtype",1),e._FPDFAnnot_UpdateObject=q("FPDFAnnot_UpdateObject",2),e._FPDFAnnot_AddInkStroke=q("FPDFAnnot_AddInkStroke",3),e._FPDFAnnot_RemoveInkList=q("FPDFAnnot_RemoveInkList",1),e._FPDFAnnot_AppendObject=q("FPDFAnnot_AppendObject",2),e._FPDFAnnot_GetObjectCount=q("FPDFAnnot_GetObjectCount",1),e._FPDFAnnot_GetObject=q("FPDFAnnot_GetObject",2),e._FPDFAnnot_RemoveObject=q("FPDFAnnot_RemoveObject",2),e._FPDFAnnot_SetColor=q("FPDFAnnot_SetColor",6),e._FPDFAnnot_GetColor=q("FPDFAnnot_GetColor",6),e._FPDFAnnot_HasAttachmentPoints=q("FPDFAnnot_HasAttachmentPoints",1),e._FPDFAnnot_SetAttachmentPoints=q("FPDFAnnot_SetAttachmentPoints",3),e._FPDFAnnot_AppendAttachmentPoints=q("FPDFAnnot_AppendAttachmentPoints",2),e._FPDFAnnot_CountAttachmentPoints=q("FPDFAnnot_CountAttachmentPoints",1),e._FPDFAnnot_GetAttachmentPoints=q("FPDFAnnot_GetAttachmentPoints",3),e._FPDFAnnot_SetRect=q("FPDFAnnot_SetRect",2),e._FPDFAnnot_GetRect=q("FPDFAnnot_GetRect",2),e._FPDFAnnot_GetVertices=q("FPDFAnnot_GetVertices",3),e._FPDFAnnot_GetInkListCount=q("FPDFAnnot_GetInkListCount",1),e._FPDFAnnot_GetInkListPath=q("FPDFAnnot_GetInkListPath",4),e._FPDFAnnot_GetLine=q("FPDFAnnot_GetLine",3),e._FPDFAnnot_SetBorder=q("FPDFAnnot_SetBorder",4),e._FPDFAnnot_GetBorder=q("FPDFAnnot_GetBorder",4),e._FPDFAnnot_HasKey=q("FPDFAnnot_HasKey",2),e._FPDFAnnot_GetValueType=q("FPDFAnnot_GetValueType",2),e._FPDFAnnot_SetStringValue=q("FPDFAnnot_SetStringValue",3),e._FPDFAnnot_GetStringValue=q("FPDFAnnot_GetStringValue",4),e._FPDFAnnot_GetNumberValue=q("FPDFAnnot_GetNumberValue",3),e._EPDFAnnot_SetNumberValue=q("EPDFAnnot_SetNumberValue",3),e._FPDFAnnot_SetAP=q("FPDFAnnot_SetAP",3),e._FPDFAnnot_GetAP=q("FPDFAnnot_GetAP",4),e._FPDFAnnot_GetLinkedAnnot=q("FPDFAnnot_GetLinkedAnnot",2),e._FPDFAnnot_GetFlags=q("FPDFAnnot_GetFlags",1),e._FPDFAnnot_SetFlags=q("FPDFAnnot_SetFlags",2),e._FPDFAnnot_GetFormField
1Flags=q("FPDFAnnot_GetFormFieldFlags",2),e._FPDFAnnot_SetFormFieldFlags=q("FPDFAnnot_SetFormFieldFlags",3),e._FPDFAnnot_GetFormFieldAtPoint=q("FPDFAnnot_GetFormFieldAtPoint",3),e._FPDFAnnot_GetFormFieldName=q("FPDFAnnot_GetFormFieldName",4),e._FPDFAnnot_GetFormFieldType=q("FPDFAnnot_GetFormFieldType",2),e._FPDFAnnot_GetFormAdditionalActionJavaScript=q("FPDFAnnot_GetFormAdditionalActionJavaScript",5),e._FPDFAnnot_GetFormFieldAlternateName=q("FPDFAnnot_GetFormFieldAlternateName",4),e._FPDFAnnot_GetFormFieldValue=q("FPDFAnnot_GetFormFieldValue",4),e._FPDFAnnot_GetOptionCount=q("FPDFAnnot_GetOptionCount",2),e._FPDFAnnot_GetOptionLabel=q("FPDFAnnot_GetOptionLabel",5),e._FPDFAnnot_IsOptionSelected=q("FPDFAnnot_IsOptionSelected",3),e._FPDFAnnot_GetFontSize=q("FPDFAnnot_GetFontSize",3),e._FPDFAnnot_SetFontColor=q("FPDFAnnot_SetFontColor",5),e._FPDFAnnot_GetFontColor=q("FPDFAnnot_GetFontColor",5),e._FPDFAnnot_IsChecked=q("FPDFAnnot_IsChecked",2),e._FPDFAnnot_SetFocusableSubtypes=q("FPDFAnnot_SetFocusableSubtypes",3),e._FPDFAnnot_GetFocusableSubtypesCount=q("FPDFAnnot_GetFocusableSubtypesCount",1),e._FPDFAnnot_GetFocusableSubtypes=q("FPDFAnnot_GetFocusableSubtypes",3),e._FPDFAnnot_GetLink=q("FPDFAnnot_GetLink",1),e._FPDFAnnot_GetFormControlCount=q("FPDFAnnot_GetFormControlCount",2),e._FPDFAnnot_GetFormControlIndex=q("FPDFAnnot_GetFormControlIndex",2),e._FPDFAnnot_GetFormFieldExportValue=q("FPDFAnnot_GetFormFieldExportValue",4),e._FPDFAnnot_SetURI=q("FPDFAnnot_SetURI",2),e._EPDFAnnot_SetAction=q("EPDFAnnot_SetAction",2),e._FPDFAnnot_GetFileAttachment=q("FPDFAnnot_GetFileAttachment",1),e._FPDFAnnot_AddFileAttachment=q("FPDFAnnot_AddFileAttachment",2),e._EPDFAnnot_SetColor=q("EPDFAnnot_SetColor",5),e._EPDFAnnot_GetColor=q("EPDFAnnot_GetColor",5),e._EPDFAnnot_ClearColor=q("EPDFAnnot_ClearColor",2),e._EPDFAnnot_SetOpacity=q("EPDFAnnot_SetOpacity",2),e._EPDFAnnot_GetOpacity=q("EPDFAnnot_GetOpacity",2),e._EPDFAnnot_GetBorderEffect=q("EPDFAnnot_GetBorderEffect",2),e._EPDFAnnot_SetBorderEffect=q("EPDFAnnot_SetBorderEffect",2),e._EPDFAnnot_ClearBorderEffect=q("EPDFAnnot_ClearBorderEffect",1),e._EPDFAnnot_GetRectangleDifferences=q("EPDFAnnot_GetRectangleDifferences",5),e._EPDFAnnot_SetRectangleDifferences=q("EPDFAnnot_SetRectangleDifferences",5),e._EPDFAnnot_ClearRectangleDifferences=q("EPDFAnnot_ClearRectangleDifferences",1),e._EPDFAnnot_GetBorderDashPatternCount=q("EPDFAnnot_GetBorderDashPatternCount",1),e._EPDFAnnot_GetBorderDashPattern=q("EPDFAnnot_GetBorderDashPattern",3),e._EPDFAnnot_SetBorderDashPattern=q("EPDFAnnot_SetBorderDashPattern",3),e._EPDFAnnot_GetBorderStyle=q("EPDFAnnot_GetBorderStyle",2),e._EPDFAnnot_SetBorderStyle=q("EPDFAnnot_SetBorderStyle",3),e._EPDFAnnot_GenerateAppearance=q("EPDFAnnot_GenerateAppearance",1),e._EPDFAnnot_GenerateAppearanceWithBlend=q("EPDFAnnot_GenerateAppearanceWithBlend",2),e._EPDFAnnot_GetBlendMode=q("EPDFAnnot_GetBlendMode",1),e._EPDFAnnot_SetIntent=q("EPDFAnnot_SetIntent",2),e._EPDFAnnot_GetIntent=q("EPDFAnnot_GetIntent",3),e._EPDFAnnot_GetRichContent=q("EPDFAnnot_GetRichContent",3),e._EPDFAnnot_SetLineEndings=q("EPDFAnnot_SetLineEndings",3),e._EPDFAnnot_GetLineEndings=q("EPDFAnnot_GetLineEndings",3),e._EPDFAnnot_SetVertices=q("EPDFAnnot_SetVertices",3),e._EPDFAnnot_SetLine=q("EPDFAnnot_SetLine",3),e._EPDFAnnot_SetDefaultAppearance=q("EPDFAnnot_SetDefaultAppearance",6),e._EPDFAnnot_GetDefaultAppearance=q("EPDFAnnot_GetDefaultAppearance",6),e._EPDFAnnot_SetTextAlignment=q("EPDFAnnot_SetTextAlignment",2),e._EPDFAnnot_GetTextAlignment=q("EPDFAnnot_GetTextAlignment",1),e._EPDFAnnot_SetVerticalAlignment=q("EPDFAnnot_SetVerticalAlignment",2),e._EPDFAnnot_GetVerticalAlignment=q("EPDFAnnot_GetVerticalAlignment",1),e._EPDFPage_GetAnnotByName=q("EPDFPage_GetAnnotByName",2),e._EPDFPage_RemoveAnnotByName=q("EPDFPage_RemoveAnnotByName",2),e._EPDFAnnot_SetLinkedAnnot=q("EPDFAnnot_SetLinkedAnnot",3),e._EPDFPage_GetAnnotCountRaw=q("EPDFPage_GetAnnotCountRaw",2),e._EPDFPage_GetAnnotRaw=q("EPDFPage_GetAnnotRaw",3),e._EPDFPage_RemoveAnnotRaw=q("EPDFPage_RemoveAnnotRaw",3),e._EPDFAnnot_SetName=q("EPDFAnnot_SetName",2),e._EPDFAnnot_GetName=q("EPDFAnnot_GetName",1),e._EPDFAnnot_UpdateAppearanceToRect=q("EPDFAnnot_UpdateAppearanceToRect",2),e._EPDFPage_CreateAnnot=q("EPDFPage_CreateAnnot",2),e._EPDFAnnot_SetRotate=q("EPDFAnnot_SetRotate",2),e._EPDFAnnot_GetRotate=q("EPDFAnnot_GetRotate",2),e._EPDFAnnot_GetReplyType=q("EPDFAnnot_GetReplyType",1),e._EPDFAnnot_SetReplyType=q("EPDFAnnot_SetReplyType",2),e._EPDFAnnot_SetOverlayText=q("EPDFAnnot_SetOverlayText",2),e._EPDFAnnot_GetOverlayText=q("EPDFAnnot_GetOverlayText",3),e._EPDFAnnot_SetOverlayTextRepeat=q("EPDFAnnot_SetOverlayTextRepeat",2),e._EPDFAnnot_GetOverlayTextRepeat=q("EPDFAnnot_GetOverlayTextRepeat",1),e._EPDFAnnot_ApplyRedaction=q("EPDFAnnot_ApplyRedaction",2),e._EPDFPage_ApplyRedactions=q("EPDFPage_ApplyRedactions",1),e._EPDFAnnot_Flatten=q("EPDFAnnot_Flatten",2),e._EPDFAnnot_SetAppearanceFromPage=q("EPDFAnnot_SetAppearanceFromPage",3),e._EPDFAnnot_ExportAppearanceAsDocument=q("EPDFAnnot_ExportAppearanceAsDocument",1),e._EPDFAnnot_ExportMultipleAppearancesAsDocument=q("EPDFAnnot_ExportMultipleAppearancesAsDocument",2),e._EPDFAnnot_SetExtendedRotation=q("EPDFAnnot_SetExtendedRotation",2),e._EPDFAnnot_GetExtendedRotation=q("EPDFAnnot_GetExtendedRotation",2),e._EPDFAnnot_SetUnrotatedRect=q("EPDFAnnot_SetUnrotatedRect",2),e._EPDFAnnot_GetUnrotatedRect=q("EPDFAnnot_GetUnrotatedRect",2),e._EPDFAnnot_GetRect=q("EPDFAnnot_GetRect",2),e._EPDFAnnot_SetAPMatrix=q("EPDFAnnot_SetAPMatrix",3),e._EPDFAnnot_GetAPMatrix=q("EPDFAnnot_GetAPMatrix",3),e._EPDFAnnot_GetAvailableAppearanceModes=q("EPDFAnnot_GetAvailableAppearanceModes",1),e._EPDFAnnot_HasAppearanceStream=q("EPDFAnnot_HasAppearanceStream",2),e._EPDFAnnot_SetMKColor=q("EPDFAnnot_SetMKColor",5),e._EPDFAnnot_GetMKColor=q("EPDFAnnot_GetMKColor",5),e._EPDFAnnot_ClearMKColor=q("EPDFAnnot_ClearMKColor",2),e._EPDFPage_CreateFormField=q("EPDFPage_CreateFormField",4),e._EPDFAnnot_GenerateFormFieldAP=q("EPDFAnnot_GenerateFormFieldAP",1),e._EPDFAnnot_GetButtonExportValue=q("EPDFAnnot_GetButtonExportValue",3),e._EPDFAnnot_GetFormFieldRawValue=q("EPDFAnnot_GetFormFieldRawValue",4),e._EPDFAnnot_SetFormFieldValue=q("EPDFAnnot_SetFormFieldValue",3),e._EPDFAnnot_SetFormFieldName=q("EPDFAnnot_SetFormFieldName",3),e._EPDFAnnot_GetFormFieldObjectNumber=q("EPDFAnnot_GetFormFieldObjectNumber",2),e._EPDFAnnot_ShareFormField=q("EPDFAnnot_ShareFormField",3),e._EPDFAnnot_GetCalloutLineCount=q("EPDFAnnot_GetCalloutLineCount",1),e._EPDFAnnot_GetCalloutLine=q("EPDFAnnot_GetCalloutLine",3),e._EPDFAnnot_SetCalloutLine=q("EPDFAnnot_SetCalloutLine",3),e._EPDFAnnot_SetFormFieldOptions=q("EPDFAnnot_SetFormFieldOptions",4),e._EPDFAnnot_GetObjectNumber=q("EPDFAnnot_GetObjectNumber",1),e._EPDFPage_GetAnnotByObjectNumber=q("EPDFPage_GetAnnotByObjectNumber",2),e._EPDFPage_RemoveAnnot=q("EPDFPage_RemoveAnnot",2),e._EPDFPage_RemoveAnnotByObjectNumber=q("EPDFPage_RemoveAnnotByObjectNumber",2),e._EPDFPage_MoveAnnots=q("EPDFPage_MoveAnnots",4),e._FPDFDoc_GetAttachmentCount=q("FPDFDoc_GetAttachmentCount",1),e._FPDFDoc_AddAttachment=q("FPDFDoc_AddAttachment",2),e._FPDFDoc_GetAttachment=q("FPDFDoc_GetAttachment",2),e._FPDFDoc_DeleteAttachment=q("FPDFDoc_DeleteAttachment",2),e._FPDFAttachment_GetName=q("FPDFAttachment_GetName",3),e._FPDFAttachment_HasKey=q("FPDFAttachment_HasKey",2),e._FPDFAttachment_GetValueType=q("FPDFAttachment_GetValueType",2),e._FPDFAttachment_SetStringValue=q("FPDFAttachment_SetStringValue",3),e._FPDFAttachment_GetStringValue=q("FPDFAttachment_GetStringValue",4),e._FPDFAttachment_SetFile=q("FPDFAttachment_SetFile",4),e._FPDFAttachment_GetFile=q("FPDFAttachment_GetFile",4),e._FPDFAttachment_GetSubtype=q("FPDFAttachment_GetSubtype",3),e._EPDFAttachment_SetSubtype=q("EPDFAttachment_SetSubtype",2),e._EPDFAttachment_SetDescription=q("EPDFAttachment_SetDescription",2),e._EPDFAttachment_GetDescription=q("EPDFAttachment_GetDescription",3),e._EPDFAttachment_GetIntegerValue=q("EPDFAttachment_GetIntegerValue",3),e._FPDFCatalog_IsTagged=q("FPDFCatalog_IsTagged",1),e._FPDFCatalog_GetLanguage=q("FPDFCatalog_GetLanguage",3),e._FPDFCatalog_SetLanguage=q("FPDFCatalog_SetLanguage",2),e._EPDFCatalog_GetLanguage=q("EPDFCatalog_GetLanguage",3),e._FPDFAvail_Create=q("FPDFAvail_Create",2),e._FPDFAvail_Destroy=q("FPDFAvail_Destroy",1),e._FPDFAvail_IsDocAvail=q("FPDFAvail_IsDocAvail",2),e._FPDFAvail_GetDocument=q("FPDFAvail_GetDocument",2),e._FPDFAvail_GetFirstPageNum=q("FPDFAvail_GetFirstPageNum",1),e._FPDFAvail_IsPageAvail=q("FPDFAvail_IsPageAvail",3),e._FPDFAvail_IsFormAvail=q("FPDFAvail_IsFormAvail",2),e._FPDFAvail_IsLinearized=q("FPDFAvail_IsLinearized",1),e._FPDFBookmark_GetFirstChild=q("FPDFBookmark_GetFirstChild",2),e._FPDFBookmark_GetNextSibling=q("FPDFBookmark_GetNextSibling",2),e._FPDFBookmark_GetTitle=q("FPDFBookmark_GetTitle",3),e._FPDFBookmark_GetCount=q("FPDFBookmark_GetCount",1),e._FPDFBookmark_Find=q("FPDFBookmark_Find",2),e._FPDFBookmark_GetDest=q("FPDFBookmark_GetDest",2),e._FPDFBookmark_GetAction=q("FPDFBookmark_GetAction",1),e._FPDFAction_GetType=q("FPDFAction_GetType",1),e._FPDFAction_GetDest=q("FPDFAction_GetDest",2),e._FPDFAction_GetFilePath=q("FPDFAction_GetFilePath",3),e._FPDFAction_GetURIPath=q("FPDFAction_GetURIPath",4),e._FPDFDest_GetDestPageIndex=q("FPDFDest_GetDestPageIndex",2),e._FPDFDest_GetView=q("FPDFDest_GetView",3),e._FPDFDest_GetLocationInPage=q("FPDFDest_GetLocationInPage",7),e._FPDFLink_GetLinkAtPoint=q("FPDFLink_GetLinkAtPoint",3),e._FPDFLink_GetLinkZOrderAtPoint=q("FPDFLink_GetLinkZOrderAtPoint",3),e._FPDFLink_GetDest=q("FPDFLink_GetDest",2),e._FPDFLink_GetAction=q("FPDFLink_GetAction",1),e._FPDFLink_Enumerate=q("FPDFLink_Enumerate",3),e._FPDFLink_GetAnnot=q("FPDFLink_GetAnnot",2),e._FPDFLink_GetAnnotRect=q("FPDFLink_GetAnnotRect",2),e._FPDFLink_CountQuadPoints=q("FPDFLink_CountQuadPoints",1),e._FPDFLink_GetQuadPoints=q("FPDFLink_GetQuadPoints",3),e._FPDF_GetPageAAction=q("FPDF_GetPageAAction",2),e._FPDF_GetFileIdentifier=q("FPDF_GetFileIdentifier",4),e._FPDF_GetMetaText=q("FPDF_GetMetaText",4),e._FPDF_GetPageLabel=q("FPDF_GetPageLabel",4),e._EPDF_SetMetaText=q("EPDF_SetMetaText",3),e._EPDF_HasMetaText=q("EPDF_HasMetaText",2),e._EPDF_GetMetaTrapped=q("EPDF_GetMetaTrapped",1),e._EPDF_SetMetaTrapped=q("EPDF_SetMetaTrapped",2),e._EPDF_GetMetaKeyCount=q("EPDF_GetMetaKeyCount",2),e._EPDF_GetMetaKeyName=q("EPDF_GetMetaKeyName",5),e._FPDFPageObj_NewImageObj=q("FPDFPageObj_NewImageObj",1),e._FPDFImageObj_LoadJpegFile=q("FPDFImageObj_LoadJpegFile",4),e._FPDFImageObj_LoadJpegFileInline=q("FPDFImageObj_LoadJpegFileInline",4),e._FPDFImageObj_SetMatr
1ix=q("FPDFImageObj_SetMatrix",7),e._FPDFImageObj_SetBitmap=q("FPDFImageObj_SetBitmap",4),e._FPDFImageObj_GetBitmap=q("FPDFImageObj_GetBitmap",1),e._FPDFImageObj_GetRenderedBitmap=q("FPDFImageObj_GetRenderedBitmap",3),e._FPDFImageObj_GetImageDataDecoded=q("FPDFImageObj_GetImageDataDecoded",3),e._FPDFImageObj_GetImageDataRaw=q("FPDFImageObj_GetImageDataRaw",3),e._FPDFImageObj_GetImageFilterCount=q("FPDFImageObj_GetImageFilterCount",1),e._FPDFImageObj_GetImageFilter=q("FPDFImageObj_GetImageFilter",4),e._FPDFImageObj_GetImageMetadata=q("FPDFImageObj_GetImageMetadata",3),e._FPDFImageObj_GetImagePixelSize=q("FPDFImageObj_GetImagePixelSize",3),e._FPDFImageObj_GetIccProfileDataDecoded=q("FPDFImageObj_GetIccProfileDataDecoded",5),e._EPDFImageObj_SetPng=q("EPDFImageObj_SetPng",5),e._EPDFImageObj_SetJpeg=q("EPDFImageObj_SetJpeg",5),e._FPDF_CreateNewDocument=q("FPDF_CreateNewDocument",0),e._FPDFPage_Delete=q("FPDFPage_Delete",2),e._FPDF_MovePages=q("FPDF_MovePages",4),e._FPDFPage_New=q("FPDFPage_New",4),e._FPDFPage_GetRotation=q("FPDFPage_GetRotation",1),e._FPDFPage_InsertObject=q("FPDFPage_InsertObject",2),e._FPDFPage_InsertObjectAtIndex=q("FPDFPage_InsertObjectAtIndex",3),e._FPDFPage_RemoveObject=q("FPDFPage_RemoveObject",2),e._FPDFPage_CountObjects=q("FPDFPage_CountObjects",1),e._FPDFPage_GetObject=q("FPDFPage_GetObject",2),e._FPDFPage_HasTransparency=q("FPDFPage_HasTransparency",1),e._FPDFPageObj_Destroy=q("FPDFPageObj_Destroy",1),e._FPDFPageObj_GetMarkedContentID=q("FPDFPageObj_GetMarkedContentID",1),e._FPDFPageObj_CountMarks=q("FPDFPageObj_CountMarks",1),e._FPDFPageObj_GetMark=q("FPDFPageObj_GetMark",2),e._FPDFPageObj_AddMark=q("FPDFPageObj_AddMark",2),e._FPDFPageObj_RemoveMark=q("FPDFPageObj_RemoveMark",2),e._FPDFPageObjMark_GetName=q("FPDFPageObjMark_GetName",4),e._FPDFPageObjMark_CountParams=q("FPDFPageObjMark_CountParams",1),e._FPDFPageObjMark_GetParamKey=q("FPDFPageObjMark_GetParamKey",5),e._FPDFPageObjMark_GetParamValueType=q("FPDFPageObjMark_GetParamValueType",2),e._FPDFPageObjMark_GetParamIntValue=q("FPDFPageObjMark_GetParamIntValue",3),e._FPDFPageObjMark_GetParamFloatValue=q("FPDFPageObjMark_GetParamFloatValue",3),e._FPDFPageObjMark_GetParamStringValue=q("FPDFPageObjMark_GetParamStringValue",5),e._FPDFPageObjMark_GetParamBlobValue=q("FPDFPageObjMark_GetParamBlobValue",5),e._FPDFPageObj_HasTransparency=q("FPDFPageObj_HasTransparency",1),e._FPDFPageObjMark_SetIntParam=q("FPDFPageObjMark_SetIntParam",5),e._FPDFPageObjMark_SetFloatParam=q("FPDFPageObjMark_SetFloatParam",5),e._FPDFPageObjMark_SetStringParam=q("FPDFPageObjMark_SetStringParam",5),e._FPDFPageObjMark_SetBlobParam=q("FPDFPageObjMark_SetBlobParam",6),e._FPDFPageObjMark_RemoveParam=q("FPDFPageObjMark_RemoveParam",3),e._FPDFPageObj_GetType=q("FPDFPageObj_GetType",1),e._FPDFPageObj_GetIsActive=q("FPDFPageObj_GetIsActive",2),e._FPDFPageObj_SetIsActive=q("FPDFPageObj_SetIsActive",2),e._FPDFPage_GenerateContent=q("FPDFPage_GenerateContent",1),e._FPDFPageObj_Transform=q("FPDFPageObj_Transform",7),e._FPDFPageObj_TransformF=q("FPDFPageObj_TransformF",2),e._FPDFPageObj_GetMatrix=q("FPDFPageObj_GetMatrix",2),e._FPDFPageObj_SetMatrix=q("FPDFPageObj_SetMatrix",2),e._FPDFPageObj_SetBlendMode=q("FPDFPageObj_SetBlendMode",2),e._FPDFPage_TransformAnnots=q("FPDFPage_TransformAnnots",7),e._FPDFPage_SetRotation=q("FPDFPage_SetRotation",2),e._FPDFPageObj_SetFillColor=q("FPDFPageObj_SetFillColor",5),e._FPDFPageObj_GetFillColor=q("FPDFPageObj_GetFillColor",5),e._FPDFPageObj_GetBounds=q("FPDFPageObj_GetBounds",5),e._FPDFPageObj_GetRotatedBounds=q("FPDFPageObj_GetRotatedBounds",2),e._FPDFPageObj_SetStrokeColor=q("FPDFPageObj_SetStrokeColor",5),e._FPDFPageObj_GetStrokeColor=q("FPDFPageObj_GetStrokeColor",5),e._FPDFPageObj_SetStrokeWidth=q("FPDFPageObj_SetStrokeWidth",2),e._FPDFPageObj_GetStrokeWidth=q("FPDFPageObj_GetStrokeWidth",2),e._FPDFPageObj_GetLineJoin=q("FPDFPageObj_GetLineJoin",1),e._FPDFPageObj_SetLineJoin=q("FPDFPageObj_SetLineJoin",2),e._FPDFPageObj_GetLineCap=q("FPDFPageObj_GetLineCap",1),e._FPDFPageObj_SetLineCap=q("FPDFPageObj_SetLineCap",2),e._FPDFPageObj_GetDashPhase=q("FPDFPageObj_GetDashPhase",2),e._FPDFPageObj_SetDashPhase=q("FPDFPageObj_SetDashPhase",2),e._FPDFPageObj_GetDashCount=q("FPDFPageObj_GetDashCount",1),e._FPDFPageObj_GetDashArray=q("FPDFPageObj_GetDashArray",3),e._FPDFPageObj_SetDashArray=q("FPDFPageObj_SetDashArray",4),e._FPDFFormObj_CountObjects=q("FPDFFormObj_CountObjects",1),e._FPDFFormObj_GetObject=q("FPDFFormObj_GetObject",2),e._FPDFFormObj_RemoveObject=q("FPDFFormObj_RemoveObject",2),e._FPDFPageObj_CreateNewPath=q("FPDFPageObj_CreateNewPath",2),e._FPDFPageObj_CreateNewRect=q("FPDFPageObj_CreateNewRect",4),e._FPDFPath_CountSegments=q("FPDFPath_CountSegments",1),e._FPDFPath_GetPathSegment=q("FPDFPath_GetPathSegment",2),e._FPDFPath_MoveTo=q("FPDFPath_MoveTo",3),e._FPDFPath_
1LineTo=q("FPDFPath_LineTo",3),e._FPDFPath_BezierTo=q("FPDFPath_BezierTo",7),e._FPDFPath_Close=q("FPDFPath_Close",1),e._FPDFPath_SetDrawMode=q("FPDFPath_SetDrawMode",3),e._FPDFPath_GetDrawMode=q("FPDFPath_GetDrawMode",3),e._FPDFPathSegment_GetPoint=q("FPDFPathSegment_GetPoint",3),e._FPDFPathSegment_GetType=q("FPDFPathSegment_GetType",1),e._FPDFPathSegment_GetClose=q("FPDFPathSegment_GetClose",1),e._FPDFPageObj_NewTextObj=q("FPDFPageObj_NewTextObj",3),e._FPDFText_SetText=q("FPDFText_SetText",2),e._FPDFText_SetCharcodes=q("FPDFText_SetCharcodes",3),e._FPDFText_LoadFont=q("FPDFText_LoadFont",5),e._FPDFText_LoadStandardFont=q("FPDFText_LoadStandardFont",2),e._FPDFText_LoadCidType2Font=q("FPDFText_LoadCidType2Font",6),e._FPDFTextObj_GetFontSize=q("FPDFTextObj_GetFontSize",2),e._FPDFTextObj_GetText=q("FPDFTextObj_GetText",4),e._FPDFTextObj_GetRenderedBitmap=q("FPDFTextObj_GetRenderedBitmap",4),e._FPDFFont_Close=q("FPDFFont_Close",1),e._FPDFPageObj_CreateTextObj=q("FPDFPageObj_CreateTextObj",3),e._FPDFTextObj_GetTextRenderMode=q("FPDFTextObj_GetTextRenderMode",1),e._FPDFTextObj_SetTextRenderMode=q("FPDFTextObj_SetTextRenderMode",2),e._FPDFTextObj_GetFont=q("FPDFTextObj_GetFont",1),e._FPDFFont_GetBaseFontName=q("FPDFFont_GetBaseFontName",3),e._FPDFFont_GetFamilyName=q("FPDFFont_GetFamilyName",3),e._FPDFFont_GetFontData=q("FPDFFont_GetFontData",4),e._FPDFFont_GetIsEmbedded=q("FPDFFont_GetIsEmbedded",1),e._FPDFFont_GetFlags=q("FPDFFont_GetFlags",1),e._FPDFFont_GetWeight=q("FPDFFont_GetWeight",1),e._FPDFFont_GetItalicAngle=q("FPDFFont_GetItalicAngle",2),e._FPDFFont_GetAscent=q("FPDFFont_GetAscent",3),e._FPDFFont_GetDescent=q("FPDFFont_GetDescent",3),e._FPDFFont_GetGlyphWidth=q("FPDFFont_GetGlyphWidth",4),e._FPDFFont_GetGlyphPath=q("FPDFFont_GetGlyphPath",3),e._FPDFGlyphPath_CountGlyphSegments=q("FPDFGlyphPath_CountGlyphSegments",1),e._FPDFGlyphPath_GetGlyphPathSegment=q("FPDFGlyphPath_GetGlyphPathSegment",2),e._EPDFText_RedactInRect=q("EPDFText_RedactInRect",4),e._EPDFText_RedactInQuads=q("EPDFText_RedactInQuads",5),e._FPDFDoc_GetPageMode=q("FPDFDoc_GetPageMode",1),e._FPDFPage_Flatten=q("FPDFPage_Flatten",2),e._FPDFPage_HasFormFieldAtPoint=q("FPDFPage_HasFormFieldAtPoint",4),e._FPDFPage_FormFieldZOrderAtPoint=q("FPDFPage_FormFieldZOrderAtPoint",4),e._malloc=q("malloc",1),e._free=q("free",1),e._FORM_OnMouseMove=q("FORM_OnMouseMove",5),e._FORM_OnMouseWheel=q("FORM_OnMouseWheel",6),e._FORM_OnFocus=q("FORM_OnFocus",5),e._FORM_OnLButtonDown=q("FORM_OnLButtonDown",5),e._FORM_OnLButtonUp=q("FORM_OnLButtonUp",5),e._FORM_OnLButtonDoubleClick=q("FORM_OnLButtonDoubleClick",5),e._FORM_OnRButtonDown=q("FORM_OnRButtonDown",5),e._FORM_OnRButtonUp=q("FORM_OnRButtonUp",5),e._FORM_OnKeyDown=q("FORM_OnKeyDown",4),e._FORM_OnKeyUp=q("FORM_OnKeyUp",4),e._FORM_OnChar=q("FORM_OnChar",4),e._FORM_GetFocusedText=q("FORM_GetFocusedText",4),e._FORM_GetSelectedText=q("FORM_GetSelectedText",4),e._FORM_ReplaceAndKeepSelection=q("FORM_ReplaceAndKeepSelection",3),e._FORM_ReplaceSelection=q("FORM_ReplaceSelection",3),e._FORM_SelectAllText=q("FORM_SelectAllText",2),e._FORM_CanUndo=q("FORM_CanUndo",2),e._FORM_CanRedo=q("FORM_CanRedo",2),e._FORM_Undo=q("FORM_Undo",2),e._FORM_Redo=q("FORM_Redo",2),e._FORM_ForceToKillFocus=q("FORM_ForceToKillFocus",1),e._FORM_GetFocusedAnnot=q("FORM_GetFocusedAnnot",3),e._FORM_SetFocusedAnnot=q("FORM_SetFocusedAnnot",2),e._FPDF_FFLDraw=q("FPDF_FFLDraw",9),e._FPDF_SetFormFieldHighlightColor=q("FPDF_SetFormFieldHighlightColor",3),e._FPDF_SetFormFieldHighlightAlpha=q("FPDF_SetFormFieldHighlightAlpha",2),e._FPDF_RemoveFormFieldHighlight=q("FPDF_RemoveFormFieldHighlight",1),e._FORM_OnAfterLoadPage=q("FORM_OnAfterLoadPage",2),e._FORM_OnBeforeClosePage=q("FORM_OnBeforeClosePage",2),e._FORM_DoDocumentJSAction=q("FORM_DoDocumentJSAction",1),e._FORM_DoDocumentOpenAction=q("FORM_DoDocumentOpenAction",1),e._FORM_DoDocumentAAction=q("FORM_DoDocumentAAction",2),e._FORM_DoPageAAction=q("FORM_DoPageAAction",3),e._FORM_SetIndexSelected=q("FORM_SetIndexSelected",4),e._FORM_IsIndexSelected=q("FORM_IsIndexSelected",3),e._FPDFDoc_GetJavaScriptActionCount=q("FPDFDoc_GetJavaScriptActionCount",1),e._FPDFDoc_GetJavaScriptAction=q("FPDFDoc_GetJavaScriptAction",2),e._FPDFDoc_CloseJavaScriptAction=q("FPDFDoc_CloseJavaScriptAction",1),e._FPDFJavaScriptAction_GetName=q("FPDFJavaScriptAction_GetName",3),e._FPDFJavaScriptAction_GetScript=q("FPDFJavaScriptAction_GetScript",3),e._FPDF_ImportPagesByIndex=q("FPDF_ImportPagesByIndex",5),e._FPDF_ImportPages=q("FPDF_ImportPages",4),e._FPDF_ImportNPagesToOne=q("FPDF_ImportNPagesToOne",5),e._FPDF_NewXObjectFromPage=q("FPDF_NewXObjectFromPage",3),e._FPDF_CloseXObject=q("FPDF_CloseXObject",1),e._FPDF_NewFormObjectFromXObject=q("FPDF_NewFormObjectFromXObject",1),e._FPDF_CopyViewerPreferences=q("FPDF_CopyViewerPreferences",2),e._FPDF_RenderPageBitmapWithColorScheme_Start=q("FPDF_RenderPageBitmapWithColorScheme_Start",10),e._FPDF_RenderPageBitmap_Start=q("FPDF_RenderPageBitmap_Start",9),e._FPDF_RenderPage_Continue=q("FPDF_RenderPage_Continue",2),e._FPDF_RenderPage_Close=q("FPDF_RenderPage_Close",1),e._FPDF_SaveWithVersion=q("FPDF_SaveWithVersion",4),e._FPDFText_GetCharIndexFromTextIndex=q("FPDFText_GetCharIndexFromTextIndex",2),e._FPDFText_GetTextIndexFromCharIndex=q("FPDFText_GetTextIndexFromCharIndex",2),e._FPDF_GetSignatureCount=q("FPDF_GetSignatureCount",1),e._FPDF_GetSignatureObject=q("FPDF_GetSignatureObject",2),e._FPDFSignatureObj_GetContents=q("FPDFSignatureObj_GetContents",3),e._FPDFSignatureObj_GetByteRange=q("FPDFSignatureObj_GetByteRange",3),e._FPDFSignatureObj_GetSubFilter=q("FPDFSignatureObj_GetSubFilter",3),e._FPDFSignatureObj_GetReason=q("FPDFSignatureObj_GetReason",3),e._FPDFSignatureObj_GetTime=q("FPDFSignatureObj_GetTime",3),e._FPDFSignatureObj_GetDocMDPPermission=q("FPDFSignatureObj_GetDocMDPPermission",1),e._FPDF_StructTree_GetForPage=q("FPDF_StructTree_GetForPage",1),e._FPDF_StructTree_Close=q("FPDF_StructTree_Close",1),e._FPDF_StructTree_CountChildren=q("FPDF_StructTree_CountChildren",1),e._FPDF_StructTree_GetChildAtIndex=q("FPDF_StructTree_GetChildAtIndex",2),e._FPDF_StructElement_GetAltText=q("FPDF_StructElement_GetAltText",3),e._FPDF_StructElement_GetActualText=q("FPDF_StructElement_GetActualText",3),e._FPDF_StructElement_GetID=q("FPDF_StructElement_GetID",3),e._FPDF_StructElement_GetLang=q("FPDF_StructElement_GetLang",3),e._FPDF_StructElement_GetAttributeCount=q("FPDF_StructElement_GetAttributeCount",1),e._FPDF_StructElement_GetAttributeAtIndex=q("FPDF_StructElement_GetAttributeAtIndex",2),e._FPDF_StructElement_GetStringAttribute=q("FPDF_StructElement_GetStringAttribute",4),e._FPDF_StructElement_GetMarkedContentID=q("FPDF_StructElement_GetMarkedContentID",1),e._FPDF_StructElement_GetType=q("FPDF_StructElement_GetType",3),e._FPDF_StructElement_GetObjType=q("FPDF_StructElement_GetObjType",3),e._FPDF_StructElement_GetTitle=q("FPDF_StructElement_GetTitle",3),e._FPDF_StructElement_CountChildren=q("FPDF_StructElement_CountChildren",1),e._FPDF_StructElement_GetChildAtIndex=q("FPDF_StructElement_GetChildAtIndex",2),e._FPDF_StructElement_GetChildMarkedContentID=q("FPDF_StructElement_GetChildMarkedContentID",2),e._FPDF_StructElement_GetParent=q("FPDF_StructElement_GetParent",1),e._FPDF_StructElement_Attr_GetCount=q("FPDF_StructElement_Attr_GetCount",1),e._FPDF_StructElement_Attr_GetName=q("FPDF_StructElement_Attr_GetName",5),e._FPDF_StructElement_Attr_GetValue=q("FPDF_StructElement_Attr_GetValue",2),e._FPDF_StructElement_Attr_GetType=q("FPDF_StructElement_Attr_GetType",1),e._FPDF_StructElement_Attr_GetBooleanValue=q("FPDF_StructElement_Attr_GetBooleanValue",2),e._FPDF_StructElement_Attr_GetNumberValue=q("FPDF_StructElement_Attr_GetNumberValue",2),e._FPDF_StructElement_Attr_GetStringValue=q("FPDF_StructElement_Attr_GetStringValue",4),e._FPDF_StructElement_Attr_GetBlobValue=q("FPDF_StructElement_Attr_GetBlobValue",4),e._FPDF_StructElement_Attr_CountChildren=q("FPDF_StructElement_Attr_CountChildren",1),e._FPDF_StructElement_Attr_GetChildAtIndex=q("FPDF_StructElement_Attr_GetChildAtIndex",2),e._FPDF_StructElement_GetMarkedContentIdCount=q("FPDF_StructElement_GetMarkedContentIdCount",1),e._FPDF_StructElement_GetMarkedContentIdAtIndex=q("FPDF_StructElement_GetMarkedContentIdAtIndex",2),e._FPDF_AddInstalledFont=q("FPDF_AddInstalledFont",3),e._FPDF_SetSystemFontInfo=q("FPDF_SetSystemFontInfo",1),e._FPDF_GetDefaultTTFMap=q("FPDF_GetDefaultTTFMap",0),e._FPDF_GetDefaultTTFMapCount=q("FPDF_GetDefaultTTFMapCount",0),e._FPDF_GetDefaultTTFMapEntry=q("FPDF_GetDefaultTTFMapEntry",1),e._FPDF_GetDefaultSystemFontInfo=q("FPDF_GetDefaultSystemFontInfo",0),e._FPDF_FreeDefaultSystemFontInfo=q("FPDF_FreeDefaultSystemFontInfo",1),e._FPDFText_LoadPage=q("FPDFText_LoadPage",1),e._FPDFText_ClosePage=q("FPDFText_ClosePage",1),e._FPDFText_CountChars=q("FPDFText_CountChars",1),e._FPDFText_GetUnicode=q("FPDFText_GetUnicode",2),e._FPDFText_GetTextObject=q("FPDFText_GetTextObject",2),e._FPDFText_IsGenerated=q("FPDFText_IsGenerated",2),e._FPDFText_IsHyphen=q("FPDFText_IsHyphen",2),e._FPDFText_HasUnicodeMapError=q("FPDFText_HasUnicodeMapError",2),e._FPDFText_GetFontSize=q("FPDFText_GetFontSize",2),e._FPDFText_GetFontInfo=q("FPDFText_GetFontInfo",5),e._FPDFText_GetFontWeight=q("FPDFText_GetFontWeight",2),e._FPDFText_GetFillColor=q("FPDFText_GetFillColor",6),e._FPDFText_GetStrokeColor=q("FPDFText_GetStrokeColor",6),e._FPDFText_GetCharAngle=q("FPDFText_GetCharAngle",2),e._FPDFText_GetCharBox=q("FPDFText_GetCharBox",6),e._FPDFText_GetL
1ooseCharBox=q("FPDFText_GetLooseCharBox",3),e._FPDFText_GetMatrix=q("FPDFText_GetMatrix",3),e._FPDFText_GetCharOrigin=q("FPDFText_GetCharOrigin",4),e._FPDFText_GetCharIndexAtPos=q("FPDFText_GetCharIndexAtPos",5),e._FPDFText_GetText=q("FPDFText_GetText",4),e._FPDFText_CountRects=q("FPDFText_CountRects",3),e._FPDFText_GetRect=q("FPDFText_GetRect",6),e._FPDFText_GetBoundedText=q("FPDFText_GetBoundedText",7),e._FPDFText_FindStart=q("FPDFText_FindStart",4),e._FPDFText_FindNext=q("FPDFText_FindNext",1),e._FPDFText_FindPrev=q("FPDFText_FindPrev",1),e._FPDFText_GetSchResultIndex=q("FPDFText_GetSchResultIndex",1),e._FPDFText_GetSchCount=q("FPDFText_GetSchCount",1),e._FPDFText_FindClose=q("FPDFText_FindClose",1),e._FPDFLink_LoadWebLinks=q("FPDFLink_LoadWebLinks",1),e._FPDFLink_CountWebLinks=q("FPDFLink_CountWebLinks",1),e._FPDFLink_GetURL=q("FPDFLink_GetURL",4),e._FPDFLink_CountRects=q("FPDFLink_CountRects",2),e._FPDFLink_GetRect=q("FPDFLink_GetRect",7),e._FPDFLink_GetTextRange=q("FPDFLink_GetTextRange",4),e._FPDFLink_CloseWebLinks=q("FPDFLink_CloseWebLinks",1),e._FPDFPage_GetDecodedThumbnailData=q("FPDFPage_GetDecodedThumbnailData",3),e._FPDFPage_GetRawThumbnailData=q("FPDFPage_GetRawThumbnailData",3),e._FPDFPage_GetThumbnailAsBitmap=q("FPDFPage_GetThumbnailAsBitmap",1),e._FPDFPage_SetMediaBox=q("FPDFPage_SetMediaBox",5),e._FPDFPage_SetCropBox=q("FPDFPage_SetCropBox",5),e._FPDFPage_SetBleedBox=q("FPDFPage_SetBleedBox",5),e._FPDFPage_SetTrimBox=q("FPDFPage_SetTrimBox",5),e._FPDFPage_SetArtBox=q("FPDFPage_SetArtBox",5),e._FPDFPage_GetMediaBox=q("FPDFPage_GetMediaBox",5),e._FPDFPage_GetCropBox=q("FPDFPage_GetCropBox",5),e._FPDFPage_GetBleedBox=q("FPDFPage_GetBleedBox",5),e._FPDFPage_GetTrimBox=q("FPDFPage_GetTrimBox",5),e._FPDFPage_GetArtBox=q("FPDFPage_GetArtBox",5),e._FPDFPage_TransFormWithClip=q("FPDFPage_TransFormWithClip",3),e._FPDFPageObj_TransformClipPath=q("FPDFPageObj_TransformClipPath",7),e._FPDFPageObj_GetClipPath=q("FPDFPageObj_GetClipPath",1),e._FPDFClipPath_CountPaths=q("FPDFClipPath_CountPaths",1),e._FPDFClipPath_CountPathSegments=q("FPDFClipPath_CountPathSegments",2),e._FPDFClipPath_GetPathSegment=q("FPDFClipPath_GetPathSegment",3),e._FPDF_CreateClipPath=q("FPDF_CreateClipPath",4),e._FPDF_DestroyClipPath=q("FPDF_DestroyClipPath",1),e._FPDFPage_InsertClipPath=q("FPDFPage_InsertClipPath",2),e._FPDF_InitLibrary=q("FPDF_InitLibrary",0),e._FPDF_DestroyLibrary=q("FPDF_DestroyLibrary",0),e._FPDF_SetSandBoxPolicy=q("FPDF_SetSandBoxPolicy",2),e._FPDF_LoadDocument=q("FPDF_LoadDocument",2),e._FPDF_GetFormType=q("FPDF_GetFormType",1),e._FPDF_LoadXFA=q("FPDF_LoadXFA",1),e._FPDF_LoadMemDocument=q("FPDF_LoadMemDocument",3),e._FPDF_LoadMemDocument64=q("FPDF_LoadMemDocument64",3),e._FPDF_LoadCustomDocument=q("FPDF_LoadCustomDocument",2),e._FPDF_GetFileVersion=q("FPDF_GetFileVersion",2),e._FPDF_DocumentHasValidCrossReferenceTable=q("FPDF_DocumentHasValidCrossReferenceTable",1),e._FPDF_GetDocPermissions=q("FPDF_GetDocPermissions",1),e._FPDF_GetDocUserPermissions=q("FPDF_GetDocUserPermissions",1),e._FPDF_GetSecurityHandlerRevision=q("FPDF_GetSecurityHandlerRevision",1),e._EPDF_SetEncryption=q("EPDF_SetEncryption",4),e._EPDF_RemoveEncryption=q("EPDF_RemoveEncryption",1),e._EPDF_UnlockOwnerPermissions=q("EPDF_UnlockOwnerPermissions",2),e._EPDF_IsEncrypted=q("EPDF_IsEncrypted",1),e._EPDF_IsOwnerUnlocked=q("EPDF_IsOwnerUnlocked",1),e._FPDF_GetPageCount=q("FPDF_GetPageCount",1),e._FPDF_LoadPage=q("FPDF_LoadPage",2),e._EPDFDoc_LoadPageByObjectNumber=q("EPDFDoc_LoadPageByObjectNumber",2),e._EPDFDoc_GetPageObjectNumberByIndex=q("EPDFDoc_GetPageObjectNumberByIndex",2),e._EPDFPage_GetObjectNumber=q("EPDFPage_GetObjectNumber",1),e._FPDF_GetPageWidthF=q("FPDF_GetPageWidthF",1),e._FPDF_GetPageWidth=q("FPDF_GetPageWidth",1),e._FPDF_GetPageHeightF=q("FPDF_GetPageHeightF",1),e._FPDF_GetPageHeight=q("FPDF_GetPageHeight",1),e._FPDF_GetPageBoundingBox=q("FPDF_GetPageBoundingBox",2),e._FPDF_RenderPageBitmap=q("FPDF_RenderPageBitmap",8),e._FPDF_RenderPageBitmapWithMatrix=q("FPDF_RenderPageBitmapWithMatrix",5),e._EPDF_RenderAnnotBitmap=q("EPDF_RenderAnnotBitmap",6),e._EPDF_RenderAnnotBitmapUnrotated=q("EPDF_RenderAnnotBitmapUnrotated",6),e._FPDF_ClosePage=q("FPDF_ClosePage",1),e._FPDF_CloseDocument=q("FPDF_CloseDocument",1),e._FPDF_GetLastError=q("FPDF_GetLastError",0),e._FPDF_DeviceToPage=q("FPDF_DeviceToPage",10),e._FPDF_PageToDevice=q("FPDF_PageToDevice",10),e._FPDFBitmap_Create=q("FPDFBitmap_Create",3),e._FPDFBitmap_CreateEx=q("FPDFBitmap_CreateEx",5),e._FPDFBitmap_GetFormat=q("FPDFBitmap_GetFormat",1),e._FPDFBitmap_FillRect=q("FPDFBitmap_FillRect",6),e._FPDFBitmap_GetBuffer=q("FPDFBitmap_GetBuffer",1),e._FPDFBitmap_GetWidth=q("FPDFBitmap_GetWidth",1),e._FPDFBitmap_GetHeight=q("FPDFBitmap_GetHeight",1),e._FPDFBitmap_GetStride=q("FPDFBitmap_GetStride",1),e._FPDFBitmap_Destroy=q("FPDFBitmap_Destroy",1),e._FPDF_GetPageSizeByIndexF=q("FPDF_GetPageSizeByIndexF",3),e._EPDF_GetPageRotationByIndex=q("EPDF_GetPageRotationByIndex",2),e._EPDF_GetPageBoxByIndex=q("EPDF_GetPageBoxByIndex",4),e._EPDF_GetPageSizeByIndexNormalized=q("EPDF_GetPageSizeByIndexNormalized",3),e._EPDF_LoadPageNormalized=q("EPDF_LoadPageNormalized",3),e._FPDF_GetPageSizeByIndex=q("FPDF_GetPageSizeByIndex",4),e._FPDF_VIEWERREF_GetPrintScaling=q("FPDF_VIEWERREF_GetPrintScaling",1),e._FPDF_VIEWERREF_GetNumCopies=q("FPDF_VIEWERREF_GetNumCopies",1),e._FPDF_VIEWERREF_GetPrintPageRange=q("FPDF_VIEWERREF_GetPrintPageRange",1),e._FPDF_VIEWERREF_GetPrintPageRangeCount=q("FPDF_VIEWERREF_GetPrintPageRangeCount",1),e._FPDF_VIEWERREF_GetPrintPageRangeElement=q("FPDF_VIEWERREF_GetPrintPageRangeElement",2),e._FPDF_VIEWERREF_GetDuplex=q("FPDF_VIEWERREF_GetDuplex",1),e._FPDF_VIEWERREF_GetName=q("FPDF_VIEWERREF_GetName",4),e._FPDF_CountNamedDests=q("FPDF_CountNamedDests",1),e._FPDF_GetNamedDestByName=q("FPDF_GetNamedDestByName",2),e._FPDF_GetNamedDest=q("FPDF_GetNamedDest",4),e._FPDF_GetXFAPacketCount=q("FPDF_GetXFAPacketCount",1),e._FPDF_GetXFAPacketName=q("FPDF_GetXFAPacketName",4),e._FPDF_GetXFAPacketContent=q("FPDF_GetXFAPacketContent",5),e._FPDF_GetTrailerEnds=q("FPDF_GetTrailerEnds",3);var eY,eJ,eq=q("strerror",1),eQ=q("fflush",1),eZ=q("emscripten_builtin_memalign",2),e0=q("setThrew",2),e1=()=>(e1=eX.emscripten_stack_init)(),e2=()=>(e2=eX.emscripten_stack_get_end)(),e4=e=>(e4=eX._emscripten_stack_restore)(e),e3=e=>(e3=eX._emscripten_stack_alloc)(e),e6=()=>(e6=eX.emscripten_stack_get_current)();function e5(){var n,r;function o(){var n;eY||(eY=1,e.calledRun=1,C||(x(!w),w=!0,O(),e.noFSInit||eT.initialized||eT.init(
1),eT.ignorePermissions=!1,ei(R),t(e),e.onRuntimeInitialized?.(),x(!e._main,'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]'),O(),(n=e.postRun)&&("function"==typeof n&&(n=[n]),n.forEach(j)),ei(k)))}B>0||(e1(),x(!(3&(r=e2()))),0==r&&(r+=4),y[r>>2]=0x2135467,y[r+4>>2]=0x89bacdfe,y[0]=0x63736d65,!eJ&&(eJ=1,(n=e.preRun)&&("function"==typeof n&&(n=[n]),n.forEach(I)),ei(v),B>0)||(e.setStatus?(e.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>e.setStatus(""),1),o()},1)):o(),O()))}if(e.dynCall_j=q("dynCall_j",1),e.dynCall_ji=q("dynCall_ji",2),e.dynCall_iiij=q("dynCall_iiij",5),e.dynCall_jji=q("dynCall_jji",4),e.dynCall_iji=q("dynCall_iji",4),e.dynCall_viijii=q("dynCall_viijii",7),e.dynCall_jij=q("dynCall_jij",4),e.dynCall_iij=q("dynCall_iij",4),e.dynCall_iiji=q("dynCall_iiji",5),e.dynCall_jiji=q("dynCall_jiji",5),e.dynCall_iiiiij=q("dynCall_iiiiij",7),e.dynCall_iiiiijj=q("dynCall_iiiiijj",9),e.dynCall_iiiiiijj=q("dynCall_iiiiiijj",10),e.dynCall_viji=q("dynCall_viji",5),e.wasmExports=eX,e.ccall=eH,e.cwrap=(e,t,n,r)=>(...r)=>eH(e,t,n,r),e.addFunction=(e,t)=>{x(void 0!==e);var n=(eA||(eA=new WeakMap,((e,t)=>{if(eA)for(var n=0;n<0+t;n++){var r=eN(n);r&&eA.set(r,n)}})(0,eb.length)),eA.get(e)||0);if(n)return n;var r=(()=>{if(e$.length)return e$.pop();try{eb.grow(1)}catch(e){if(!(e instanceof RangeError))throw e;throw"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH."}return eb.length-1})();try{ez(r,e)}catch(n){if(!(n instanceof TypeError))throw n;x(void 0!==t,"Missing signature argument to addFunction: "+e),ez(r,((e,t)=>{if(x(!t.includes("j"),"i64 not permitted in function signatures when WASM_BIGINT is disabled"),"function"==typeof WebAssembly.Function)return new WebAssembly.Function((e=>{x(!e.includes("j"),"i64 not permitted in function signatures when WASM_BIGINT is disabled");for(var t={i:"i32",j:"i64",f:"f32",d:"f64",e:"externref",p:"i32"},n={parameters:[],results:"v"==e[0]?[]:[t[e[0]]]},r=1;r<e.length;++r)x(e[r]in t,"invalid signature char: "+e[r]),n.parameters.push(t[e[r]]);return n})(t),e);var n=[1],r=t.slice(0,1),o=t.slice(1),i={i:127,p:127,j:126,f:125,d:124,e:111};n.push(96),eU(o.length,n);for(var a=0;a<o.length;++a)x(o[a]in i,"invalid signature char: "+o[a]),n.push(i[o[a]]);"v"==r?n.push(0):n.push(1,i[r]);var l=[0,97,115,109,1,0,0,0,1];eU(n.length,l),l.push(...n),l.push(2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0);var s=new WebAssembly.Module(new Uint8Array(l));return new WebAssembly.Instance(s,{e:{f:e}}).exports.f})(e,t))}return eA.set(e,r),r},e.removeFunction=e=>{eA.delete(eN(e)),ez(e,null),e$.push(e)},e.setValue=function(e,t,n="i8"){switch(n.endsWith("*")&&(n="*"),n){case"i1":case"i8":f[e]=t;break;case"i16":A[e>>1]=t;break;case"i32":M[e>>2]=t;break;case"i64":W("to do setValue(i64) use WASM_BIGINT");case"float":G[e>>2]=t;break;case"double":S[e>>3]=t;break;case"*":y[e>>2]=t;break;default:W(`invalid type for setValue: ${n}`)}},e.getValue=function(e,t="i8"){switch(t.endsWith("*")&&(t="*"),t){case"i1":case"i8":return f[e];case"i16":return A[e>>1];case"i32":return M[e>>2];case"i64":W("to do getValue(i64) use WASM_BIGINT");case"float":return G[e>>2];case"double":return S[e>>3];case"*":return y[e>>2];default:W(`invalid type for getValue: ${t}`)}},e.UTF8ToString=ed,e.stringToUTF8=eR,e.UTF16ToString=(e,t)=>{x(e%2==0,"Pointer passed to UTF16ToString must be aligned to two bytes!");for(var n=e,r=n>>1,o=r+t/2;!(r>=o)&&E[r];)++r;if((n=r<<1)-e>32&&eV)return eV.decode(b.subarray(e,n));for(var i="",a=0;!(a>=t/2);++a){var l=A[e+2*a>>1];if(0==l)break;i+=String.fromCharCode(l)}return i},e.stringToUTF16=(e,t,n)=>{if(x(t%2==0,"Pointer passed to stringToUTF16 must be aligned to two bytes!"),x("number"==typeof n,"stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),(n??=0x7fffffff)<2)return 0;for(var r=t,o=(n-=2)<2*e.length?n/2:e.length,i=0;i<o;++i){var a=e.charCodeAt(i);A[t>>1]=a,t+=2}return A[t>>1]=0,t-r},["writeI53ToI64","writeI53ToI64Clamped","writeI53ToI64Signaling","
1writeI53ToU64Clamped","writeI53ToU64Signaling","readI53FromI64","readI53FromU64","convertI32PairToI53","convertU32PairToI53","getTempRet0","setTempRet0","exitJS","inetPton4","inetNtop4","inetPton6","inetNtop6","readSockaddr","writeSockaddr","emscriptenLog","readEmAsmArgs","jstoi_q","listenOnce","autoResumeAudioContext","dynCallLegacy","getDynCaller","dynCall","handleException","keepRuntimeAlive","runtimeKeepalivePush","runtimeKeepalivePop","callUserCallback","maybeExit","asmjsMangle","HandleAllocator","getNativeTypeSize","STACK_SIZE","STACK_ALIGN","POINTER_SIZE","ASSERTIONS","reallyNegative","unSign","strLen","reSign","formatString","intArrayToString","AsciiToString","lengthBytesUTF16","UTF32ToString","stringToUTF32","lengthBytesUTF32","stringToNewUTF8","registerKeyEventCallback","maybeCStringToJsString","findEventTarget","getBoundingClientRect","fillMouseEventData","registerMouseEventCallback","registerWheelEventCallback","registerUiEventCallback","registerFocusEventCallback","fillDeviceOrientationEventData","registerDeviceOrientationEventCallback","fillDeviceMotionEventData","registerDeviceMotionEventCallback","screenOrientation","fillOrientationChangeEventData","registerOrientationChangeEventCallback","fillFullscreenChangeEventData","registerFullscreenChangeEventCallback","JSEvents_requestFullscreen","JSEvents_resizeCanvasForFullscreen","registerRestoreOldStyle","hideEverythingExceptGivenElement","restoreHiddenElements","setLetterbox","softFullscreenResizeWebGLRenderTarget","doRequestFullscreen","fillPointerlockChangeEventData","registerPointerlockChangeEventCallback","registerPointerlockErrorEventCallback","requestPointerLock","fillVisibilityChangeEventData","registerVisibilityChangeEventCallback","registerTouchEventCallback","fillGamepadEventData","registerGamepadEventCallback","registerBeforeUnloadEventCallback","fillBatteryEventData","battery","registerBatteryEventCallback","setCanvasElementSize","getCanvasElementSize","jsStackTrace","getCallstack","convertPCtoSourceLocation","checkWasiClock","wasiRightsToMuslOFlags","wasiOFlagsToMuslOFlags","createDyncallWrapper","safeSetTimeout","setImmediateWrapped","clearImmediateWrapped","polyfillSetImmediate","registerPostMainLoop","registerPreMainLoop","getPromise","makePromise","idsToPromises","makePromiseCallback","ExceptionInfo","findMatchingCatch","Browser_asyncPrepareDataCounter","safeRequestAnimationFrame","arraySum","addDays","getSocketFromFD","getSocketAddress","FS_unlink","FS_mkdirTree","_setNetworkCallback","heapObjectForWebGLType","toTypedArrayIndex","webgl_enable_ANGLE_instanced_arrays","webgl_enable_OES_vertex_array_object","webgl_enable_WEBGL_draw_buffers","webgl_enable_WEBGL_multi_draw","webgl_enable_EXT_polygon_offset_clamp","webgl_enable_EXT_clip_control","webgl_enable_WEBGL_polygon_mode","emscriptenWebGLGet","computeUnpackAlignedImageSize","colorChannelsInGlTextureFormat","emscriptenWebGLGetTexPixelData","emscriptenWebGLGetUniform","webglGetUniformLocation","webglPrepareUniformLocationsBeforeFirstUse","webglGetLeftBracePos","emscriptenWebGLGetVertexAttrib","__glGetActiveAttribOrUniform","writeGLArray","registerWebGlEventCallback","runAndAbortIfError","ALLOC_NORMAL","ALLOC_STACK","allocate","writeStringToMemory","writeAsciiToMemory","setErrNo","demangle","stackTrace"].forEach(function(e){en(e,()=>{var t=`\`${e}\` is a library symbol and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line`,n=e;n.startsWith("_")||(n="$"+e),t+=` (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='${n}')`,et(e)&&(t+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"),eu(t)}),eo(e)}),["run","addOnPreRun","addOnInit","addOnPreMain","addOnExit","addOnPostRun","addRunDependency","removeRunDependency","out","err","callMain","abort","wasmMemory","writeStackCookie","checkStackCookie","convertI32PairToI53Checked","stackSave","stackRestore","stackAlloc","ptrToString","zeroMemory","getHeapMax","growMemory","ENV","ERRNO_CODES","strError","DNS","Protocols","Sockets","initRandomFill","randomFill","timers","warnOnce","readEmAsmArgsArray","jstoi_s","getExecutableName","asyncLoad","alignMemory","mmapAlloc","wasmTable","noExitRuntime","getCFunc","uleb128Encode","sigToWasmTypes","generateFuncType","convertJsFunctionToWasm","freeTableIndexes","functionsInTableMap","getEmptyTableSlot","updateTableMap","getFunctionAddress","PATH","PATH_FS","UTF8Decoder","UTF8ArrayToString","stringToUTF8Array","lengthBytesUTF8","intArrayFromString","stringToAscii","UTF16Decoder","stringToUTF8OnStack","writeArrayToMemory","JSEvents","specialHTMLTargets","findCanvasEventTarget","currentFullscreenStrategy","restoreOldWindowedStyle","UNWIND_CACHE","ExitStatus","getEnvStrings","doReadv","doWritev","promiseMap","uncaughtExceptionCount","exceptionLast","exceptionCaught","Browser","getPreloadedImageData__data","wget","MONTH_DAYS_REGULAR","MONTH_DAYS_LEAP","MONTH_DAYS_REGULAR_CUMULATIVE","MONTH_DAYS_LEAP_CUMULATIVE","isLeapYear","ydayFromDate","SYSCALLS","preloadPlugins","FS_createPreloadedFile","FS_modeStringToFlags","FS_getMode","FS_stdin_getChar_buffer","FS_stdin_getChar","FS_createPath","FS_createDevice","FS_readFile","FS","FS_createDataFile","FS_createLazyFile","MEMFS","TTY","PIPEFS","SOCKFS","tempFixedLengthArray","miniTempWebGLFloatBuffers","miniTempWebGLIntBuffers","GL","AL","GLUT","EGL","GLEW","IDBStore","SDL","SDL_gfx","allocateUTF8","allocateUTF8OnStack","print","printErr"].forEach(eo),N=function e(){eY||e5(),eY||(N=e)},e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();for(let t of(e5(),Object.keys(e)))t in e||Object.defineProperty(e,t,{configurable:!0,get(){W(`Access to module property ('${t}') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.`)}});return i});let s
vendor: 36,911 bytes, line 1
1={EPDF_GetMetaKeyCount:[["number","boolean"],"number"],EPDF_GetMetaKeyName:[["number","number","boolean","number","number"],"number"],EPDF_GetMetaTrapped:[["number"],"number"],EPDF_GetPageBoxByIndex:[["number","number","number","number"],"boolean"],EPDF_GetPageRotationByIndex:[["number","number"],"number"],EPDF_GetPageSizeByIndexNormalized:[["number","number","number"],"boolean"],EPDF_HasMetaText:[["number","string"],"boolean"],EPDF_IsEncrypted:[["number"],"boolean"],EPDF_IsOwnerUnlocked:[["number"],"boolean"],EPDF_LoadPageNormalized:[["number","number","number"],"number"],EPDF_PNG_EncodeRGBA:[["number","number","number","number","number","number"],"number"],EPDF_RemoveEncryption:[["number"],"boolean"],EPDF_RenderAnnotBitmap:[["number","number","number","number","number","number"],"boolean"],EPDF_RenderAnnotBitmapUnrotated:[["number","number","number","number","number","number"],"boolean"],EPDF_SetEncryption:[["number","string","string","number"],"boolean"],EPDF_SetMetaText:[["number","string","number"],"boolean"],EPDF_SetMetaTrapped:[["number","number"],"boolean"],EPDF_UnlockOwnerPermissions:[["number","string"],"boolean"],EPDFAction_CreateGoTo:[["number","number"],"number"],EPDFAction_CreateGoToNamed:[["number","string"],"number"],EPDFAction_CreateLaunch:[["number","number"],"number"],EPDFAction_CreateRemoteGoToByName:[["number","number","number"],"number"],EPDFAction_CreateRemoteGoToDest:[["number","number","number"],"number"],EPDFAction_CreateURI:[["number","string"],"number"],EPDFAnnot_ApplyRedaction:[["number","number"],"boolean"],EPDFAnnot_ClearBorderEffect:[["number"],"boolean"],EPDFAnnot_ClearColor:[["number","number"],"boolean"],EPDFAnnot_ClearMKColor:[["number","number"],"boolean"],EPDFAnnot_ClearRectangleDifferences:[["number"],"boolean"],EPDFAnnot_ExportAppearanceAsDocument:[["number"],"number"],EPDFAnnot_ExportMultipleAppearancesAsDocument:[["number","number"],"number"],EPDFAnnot_Flatten:[["number","number"],"boolean"],EPDFAnnot_GenerateAppearance:[["number"],"boolean"],EPDFAnnot_GenerateAppearanceWithBlend:[["number","number"],"boolean"],EPDFAnnot_GenerateFormFieldAP:[["number"],"boolean"],EPDFAnnot_GetAPMatrix:[["number","number","number"],"boolean"],EPDFAnnot_GetAvailableAppearanceModes:[["number"],"number"],EPDFAnnot_GetBlendMode:[["number"],"number"],EPDFAnnot_GetBorderDashPattern:[["number","number","number"],"boolean"],EPDFAnnot_GetBorderDashPatternCount:[["number"],"number"],EPDFAnnot_GetBorderEffect:[["number","number"],"boolean"],EPDFAnnot_GetBorderStyle:[["number","number"],"number"],EPDFAnnot_GetButtonExportValue:[["number","number","number"],"number"],EPDFAnnot_GetCalloutLine:[["number","number","number"],"number"],EPDFAnnot_GetCalloutLineCount:[["number"],"number"],EPDFAnnot_GetColor:[["number","number","number","number","number"],"boolean"],EPDFAnnot_GetDefaultAppearance:[["number","number","number","number","number","number"],"boolean"],EPDFAnnot_GetExtendedRotation:[["number","number"],"boolean"],EPDFAnnot_GetFormFieldObjectNumber:[["number","number"],"number"],EPDFAnnot_GetFormFieldRawValue:[["number","number","number","number"],"number"],EPDFAnnot_GetIntent:[["number","number","number"],"number"],EPDFAnnot_GetLineEndings:[["number","number","number"],"boolean"],EPDFAnnot_GetMKColor:[["number","number","number","number","number"],"boolean"],EPDFAnnot_GetName:[["number"],"number"],EPDFAnnot_GetObjectNumber:[["number"],"number"],EPDFAnnot_GetOpacity:[["number","number"],"boolean"],EPDFAnnot_GetOverlayText:[["number","number","number"],"number"],EPDFAnnot_GetOverlayTextRepeat:[["number"],"boolean"],EPDFAnnot_GetRect:[["number","number"],"boolean"],EPDFAnnot_GetRectangleDifferences:[["number","number","number","number","number"],"boolean"],EPDFAnnot_GetReplyType:[["number"],"number"],EPDFAnnot_GetRichContent:[["number","number","number"],"number"],EPDFAnnot_GetRotate:[["number","number"],"boolean"],EPDFAnnot_GetTextAlignment:[["number"],"number"],EPDFAnnot_GetUnrotatedRect:[["number","number"],"boolean"],EPDFAnnot_GetVerticalAlignment:[["number"],"number"],EPDFAnnot_HasAppearanceStream:[["number","number"],"boolean"],EPDFAnnot_SetAction:[["number","number"],"boolean"],EPDFAnnot_SetAPMatrix:[["number","number","number"],"boolean"],EPDFAnnot_SetAppearanceFromPage:[["number","number","number"],"boolean"],EPDFAnnot_SetBorderDashPattern:[["number","number","number"],"boolean"],EPDFAnnot_SetBorderEffect:[["number","number"],"boolean"],EPDFAnnot_SetBorderStyle:[["number","number","number"],"boolean"],EPDFAnnot_SetCalloutLine:[["number","number","number"],"boolean"],EPDFAnnot_SetColor:[["number","number","number","number","number"],"boolean"],EPDFAnnot_SetDefaultAppearance:[["number","number","number","number","number","number"],"boolean"],EPDFAnnot_SetExtendedRotation:[["number","number"],"boolean"],EPDFAnnot_SetFormFieldName:[["number","number","number"],"boolean"],EPDFAnnot_SetFormFieldOptions:[["number","number","number","number"],"boolean"],EPDFAnnot_SetFormFieldValue:[["number","number","number"],"boolean"],EPDFAnnot_SetIntent:[["number","string"],"boolean"],EPDFAnnot_SetLine:[["number","number","number"],"boolean"],EPDFAnnot_SetLineEndings:[["number","number","number"],"boolean"],EPDFAnnot_SetLinkedAnnot:[["number","string","number"],"boolean"],EPDFAnnot_SetMKColor:[["number","number","number","number","number"],"boolean"],EPDFAnnot_SetName:[["number","number"],"boolean"],EPDFAnnot_SetNumberValue:[["number","string","number"],"boolean"],EPDFAnnot_SetOpacity:[["number","number"],"boolean"],EPDFAnnot_SetOverlayText:[["number","number"],"boolean"],EPDFAnnot_SetOverlayTextRepeat:[["number","boolean"],"boolean"],EPDFAnnot_SetRectangleDifferences:[["number","number","number","number","number"],"boolean"],EPDFAnnot_SetReplyType:[["number","number"],"boolean"],EPDFAnnot_SetRotate:[["number","number"],"boolean"],EPDFAnnot_SetTextAlignment:[["number","number"],"boolean"],EPDFAnnot_SetUnrotatedRect:[["number","number"],"boolean"],EPDFAnnot_SetVerticalAlignment:[["number","number"],"boolean"],EPDFAnnot_SetVertices:[["number","number","number"],"boolean"],EPDFAnnot_ShareFormField:[["number","number","number"],"boolean"],EPDFAnnot_UpdateAppearanceToRect:[["number","number"],"boolean"],EPDFAttachment_GetDescription:[["number","number","number"],"number"],EPDFAttachment_GetIntegerValue:[["number","string","number"],"boolean"],EPDFAttachment_SetDescription:[["number","number"],"boolean"],EPDFAttachment_SetSubtype:[["number","string"],"boolean"],EPDFBookmark_AppendChild:[["number","number","number"],"number"],EPDFBookmark_Clear:[["number"],"boolean"],EPDFBookmark_ClearTarget:[["number"],"boolean"],EPDFBookmark_Create:[["number","number"],"number"],EPDFBookmark_Delete:[["number","number"],"boolean"],EPDFBookmark_InsertAfter:[["number","number","number","number"],"number"],EPDFBookmark_SetAction:[["number","number","number"],"boolean"],EPDFBookmark_SetDest:[["number","number","number"],"boolean"],EPDFBookmark_SetTitle:[["number","number"],"boolean"],EPDFCatalog_GetLanguage:[["number","number","number"],"number"],EPDFDest_CreateRemoteView:[["number","number","number","number","number"],"number"],EPDFDest_CreateRemoteXYZ:[["number","number","boolean","number","boolean","number","boolean","number"],"number"],EPDFDest_CreateView:[["number","number","number","number"],"number"],EPDFDest_CreateXYZ:[["number","boolean","number","boolean","number","boolean","number"],"number"],EPDFDoc_GetPageObjectNumberByIndex:[["number","number"],"number"],EPDFDoc_LoadPageByObjectNumber:[["number","number"],"number"],EPDFImageObj_SetJpeg:[["number","number","number","number","number"],"boolean"],EPDFImageObj_SetPng:[["number","number","number","number","number"],"boolean"],EPDFNamedDest_Remove:[["number","string"],"boolean"],EPDFNamedDest_SetDest:[["number","string","number"],"boolean"],EPDFPage_ApplyRedactions:[["number"],"boolean"],EPDFPage_CreateAnnot:[["number","number"],"number"],EPDFPage_CreateFormField:[["number","number","number","number"],"number"],EPDFPage_GetAnnotByName:[["number","number"],"number"],EPDFPage_GetAnnotByObjectNumber:[["number","number"],"number"],EPDFPage_GetAnnotCountRaw:[["number","number"],"number"],EPDFPage_GetAnnotRaw:[["number","number","number"],"number"],EPDFPage_GetObjectNumber:[["number"],"number"],EPDFPage_MoveAnnots:[["number","number","number","number"],"boolean"],EPDFPage_RemoveAnnot:[["number","number"],"boolean"],EPDFPage_RemoveAnnotByName:[["number","number"],"boolean"],EPDFPage_RemoveAnnotByObjectNumber:[["number","number"],"boolean"],EPDFPage_RemoveAnnotRaw:[["number","number","number"],"boolean"],EPDFText_RedactInQuads:[["number","number","number","boolean","boolean"],"boolean"],EPDFText_RedactInRect:[["number","number","boolean","boolean"],"boolean"],FORM_CanRedo:[["number","number"],"boolean"],FORM_CanUndo:[["number","number"],"boolean"],FORM_DoDocumentAAction:[["number","number"],null],FORM_DoDocumentJSAction:[["number"],null],FORM_DoDocumentOpenAction:[["number"],null],FORM_DoPageAAction:[["number","number","number"],null],FORM_ForceToKillFocus:[["number"],"boolean"],FORM_GetFocusedAnnot:[["number","number","number"],"boolean"],FORM_GetFocusedText:[["number","number","number","number"],"number"],FORM_GetSelectedText:[["number","number","number","number"],"number"],FORM_IsIndexSelected:[["number","number","number"],"boolean"],FORM_OnAfterLoadPage:[["number","number"],null],FORM_OnBeforeClosePage:[["number","number"],null],FORM_OnChar:[["number","number","number","number"],"boolean"],FORM_OnFocus:[["number","number","number","number","number"],"boolean"],FORM_OnKeyDown:[["number","number","number","number"],"boolean"],FORM_OnKeyUp:[["number","number","number","number"],"boolean"],FORM_OnLButtonDoubleClick:[["number","number","number","number","number"],"boolean"],FORM_OnLButtonDown:[["number","number","number","number","number"],"boolean"],FORM_OnLButtonUp:[["number","number","number","number","number"],"boolean"],FORM_OnMouseMove:[["number","number","number","number","number"],"boolean"],FORM_OnMouseWheel:[["number","number","number","number","number","number"],"boolean"],FORM_OnRButtonDown:[["number","number","number","number","number"],"boolean"],FORM_OnRButtonUp:[["number","number","number","number","number"],"boolean"],FORM_Redo:[["number","number"],"boolean"],FORM_ReplaceAndKeepSelection:[["number","number","number"],null],FORM_ReplaceSelection:[["number","number","number"],null],FORM_SelectAllText:[["number","number"],"boolean"],FORM_SetFocusedAnnot:[["number","number"],"boolean"],FORM_SetIndexSelected:[["number","number","number","boolean"],"boolean"],FORM_Undo:[["number","number"],"boolean"],FPDF_AddInstalledFont:[["number","number","number"],null],FPDF_CloseDocument:[["number"],null],FPDF_ClosePage:[["number"],null],FPDF_CloseXObject:[["number"],null],FPDF_CopyViewerPreferences:[["number","number"],"boolean"],FPDF_CountNamedDests:[["number"],"number"],FPDF_CreateClipPath:[["number","number","number","number"],"number"],FPDF_CreateNewDocument:[[],"number"],FPDF_DestroyClipPath:[["number"],null],FPDF_DestroyLibrary:[[],null],FPDF_DeviceToPage:[["number","number","number","number","number","number","number","number","number","number"],"boolean"],FPDF_DocumentHasValidCrossReferenceTable:[["number"],"boolean"],FPDF_FFLDraw:[["number","number","number","number","number","number","number","number","number"],null],FPDF_FreeDefaultSystemFontInfo:[["number"],null],FPDF_GetDefaultSystemFontInfo:[[],"number"],FPDF_GetDefaultTTFMap:[[],"number"],FPDF_GetDefaultTTFMapCount:[[],"number"],FPDF_GetDefaultTTFMapEntry:[["number"],"number"],FPDF_GetDocPermissions:[["number"],"number"],FPDF_GetDocUserPermissions:[["number"],"number"],FPDF_GetFileIdentifier:[["number","number","number","number"],"number"],FPDF_GetFileVersion:[["number","number"],"boolean"],FPDF_GetFormType:[["number"],"number"],FPDF_GetLastError:[[],"number"],FPDF_GetMetaText:[["number","string","number","number"],"number"],FPDF_GetNamedDest:[["number","number","number","number"],"number"],FPDF_GetNamedDestByName:[["number","string"],"number"],FPDF_GetPageAAction:[["number","number"],"number"],FPDF_GetPageBoundingBox:[["number","number"],"boolean"],FPDF_GetPageCount:[["number"],"number"],FPDF_GetPageHeight:[["number"],"number"],FPDF_GetPageHeightF:[["number"],"number"],FPDF_GetPageLabel:[["number","number","number","number"],"number"],FPDF_GetPageSizeByIndex:[["number","number","number","number"],"number"],FPDF_GetPageSizeByIndexF:[["number","number","number"],"boolean"],FPDF_GetPageWidth:[["number"],"number"],FPDF_GetPageWidthF:[["number"],"number"],FPDF_GetSecurityHandlerRevision:[["number"],"number"],FPDF_GetSignatureCount:[["number"],"number"],FPDF_GetSignatureObject:[["number","number"],"number"],FPDF_GetTrailerEnds:[["number","number","number"],"number"],FPDF_GetXFAPacketContent:[["number","number","number","number","number"],"boolean"],FPDF_GetXFAPacketCount:[["number"],"number"],FPDF_GetXFAPacketName:[["number","number","number","number"],"number"],FPDF_ImportNPagesToOne:[["number","number","number","number","number"],"number"],FPDF_ImportPages:[["number","number","string","number"],"boolean"],FPDF_ImportPagesByIndex:[["number","number","number","number","number"],"boolean"],FPDF_InitLibrary:[[],null],FPDF_InitLibraryWithConfig:[["number"],null],FPDF_LoadCustomDocument:[["number","string"],"number"],FPDF_LoadDocument:[["number","string"],"number"],FPDF_LoadMemDocument:[["number","number","string"],"number"],FPDF_LoadMemDocument64:[["number","number","string"],"number"],FPDF_LoadPage:[["number","number"],"number"],FPDF_LoadXFA:[["number"],"boolean"],FPDF_MovePages:[["number","number","number","number"],"boolean"],FPDF_NewFormObjectFromXObject:[["number"],"number"],FPDF_NewXObjectFromPage:[["number","number","number"],"number"],FPDF_PageToDevice:[["number","number","number","number","number","number","number","number","number","number"],"boolean"],FPDF_RemoveFormFieldHighlight:[["number"],null],FPDF_RenderPage_Close:[["number"],null],FPDF_RenderPage_Continue:[["number","number"],"number"],FPDF_RenderPageBitmap:[["number","number","number","number","number","number","number","number"],null],FPDF_RenderPageBitmap_Start:[["number","number","number","number","number","number","number","number","number"],"number"],FPDF_RenderPageBitmapWithColorScheme_Start:[["number","number","number","number","number","number","number","number","number","number"],"number"],FPDF_RenderPageBitmapWithMatrix:[["number","number","number","number","number"],null],FPDF_SaveAsCopy:[["number","number","number"],"boolean"],FPDF_SaveWithVersion:[["number","number","number","number"],"boolean"],FPDF_SetFormFieldHighlightAlpha:[["number","number"],null],FPDF_SetFormFieldHighlightColor:[["number","number","number"],null],FPDF_SetSandBoxPolicy:[["number","boolean"],null],FPDF_SetSystemFontInfo:[["number"],null],FPDF_StructElement_Attr_CountChildren:[["number"],"number"],FPDF_StructElement_Attr_GetBlobValue:[["number","number","number","number"],"boolean"],FPDF_StructElement_Attr_GetBooleanValue:[["number","number"],"boolean"],FPDF_StructElement_Attr_GetChildAtIndex:[["number","number"],"number"],FPDF_StructElement_Attr_GetCount:[["number"],"number"],FPDF_StructElement_Attr_GetName:[["number","number","number","number","number"],"boolean"],FPDF_StructElement_Attr_GetNumberValue:[["number","number"],"boolean"],FPDF_StructElement_Attr_GetStringValue:[["number","number","number","number"],"boolean"],FPDF_StructElement_Attr_GetType:[["number"],"number"],FPDF_StructElement_Attr_GetValue:[["number","string"],"number"],FPDF_StructElement_CountChildren:[["number"],"number"],FPDF_StructElement_GetActualText:[["number","number","number"],"number"],FPDF_StructElement_GetAltText:[["number","number","number"],"number"],FPDF_StructElement_GetAttributeAtIndex:[["number","number"],"number"],FPDF_StructElement_GetAttributeCount:[["number"],"number"],FPDF_StructElement_GetChildAtIndex:[["number","number"],"number"],FPDF_StructElement_GetChildMarkedContentID:[["number","number"],"number"],FPDF_StructElement_GetID:[["number","number","number"],"number"],FPDF_StructElement_GetLang:[["number","number","number"],"number"],FPDF_StructElement_GetMarkedContentID:[["number"],"number"],FPDF_StructElement_GetMarkedContentIdAtIndex:[["number","number"],"number"],FPDF_StructElement_GetMarkedContentIdCount:[["number"],"number"],FPDF_StructElement_GetObjType:[["number","number","number"],"number"],FPDF_StructElement_GetParent:[["number"],"number"],FPDF_StructElement_GetStringAttribute:[["number","string","number","number"],"number"],FPDF_StructElement_GetTitle:[["number","number","number"],"number"],FPDF_StructElement_GetType:[["number","number","number"],"number"],FPDF_StructTree_Close:[["number"],null],FPDF_StructTree_CountChildren:[["number"],"number"],FPDF_StructTree_GetChildAtIndex:[["number","number"],"number"],FPDF_StructTree_GetForPage:[["number"],"number"],FPDF_VIEWERREF_GetDuplex:[["number"],"number"],FPDF_VIEWERREF_GetName:[["number","string","number","number"],"number"],FPDF_VIEWERREF_GetNumCopies:[["number"],"number"],FPDF_VIEWERREF_GetPrintPageRange:[["number"],"number"],FPDF_VIEWERREF_GetPrintPageRangeCount:[["number"],"number"],FPDF_VIEWERREF_GetPrintPageRangeElement:[["number","number"],"number"],FPDF_VIEWERREF_GetPrintScaling:[["number"],"boolean"],FPDFAction_GetDest:[["number","number"],"number"],FPDFAction_GetFilePath:[["number","number","number"],"number"],FPDFAction_GetType:[["number"],"number"],FPDFAction_GetURIPath:[["number","number","number","number"],"number"],FPDFAnnot_AddFileAttachment:[["number","number"],"number"],FPDFAnnot_AddInkStroke:[["number","number","number"],"number"],FPDFAnnot_AppendAttachmentPoints:[["number","number"],"boolean"],FPDFAnnot_AppendObject:[["number","number"],"boolean"],FPDFAnnot_CountAttachmentPoints:[["number"],"number"],FPDFAnnot_GetAP:[["number","number","number","number"],"number"],FPDFAnnot_GetAttachmentPoints:[["number","number","number"],"boolean"],FPDFAnnot_GetBorder:[["number","number","number","number"],"boolean"],FPDFAnnot_GetColor:[["number","number","number","number","number","number"],"boolean"],FPDFAnnot_GetFileAttachment:[["number"],"number"],FPDFAnnot_GetFlags:[["number"],"number"],FPDFAnnot_GetFocusableSubtypes:[["number","number","number"],"boolean"],FPDFAnnot_GetFocusableSubtypesCount:[["number"],"number"],FPDFAnnot_GetFontColor:[["number","number","number","number","number"],"boolean"],FPDFAnnot_GetFontSize:[["number","number","number"],"boolean"],FPDFAnnot_GetFormAdditionalActionJavaScript:[["number","number","number","number","number"],"number"],FPDFAnnot_GetFormControlCount:[["number","number"],"number"],FPDFAnnot_GetFormControlIndex:[["number","number"],"number"],FPDFAnnot_GetFormFieldAlternateName:[["number","number","number","number"],"number"],FPDFAnnot_GetFormFieldAtPoint:[["number","number","number"],"number"],FPDFAnnot_GetFormFieldExportValue:[["number","number","number","number"],"number"],FPDFAnnot_GetFormFieldFlags:[["number","number"],"number"],FPDFAnnot_GetFormFieldName:[["number","number","number","number"],"number"],FPDFAnnot_GetFormFieldType:[["number","number"],"number"],FPDFAnnot_GetFormFieldValue:[["number","number","number","number"],"number"],FPDFAnnot_GetInkListCount:[["number"],"number"],FPDFAnnot_GetInkListPath:[["number","number","number","number"],"number"],FPDFAnnot_GetLine:[["number","number","number"],"boolean"],FPDFAnnot_GetLink:[["number"],"number"],FPDFAnnot_GetLinkedAnnot:[["number","string"],"number"],FPDFAnnot_GetNumberValue:[["number","string","number"],"boolean"],FPDFAnnot_GetObject:[["number","number"],"number"],FPDFAnnot_GetObjectCount:[["number"],"number"],FPDFAnnot_GetOptionCount:[["number","number"],"number"],FPDFAnnot_GetOptionLabel:[["number","number","number","number","number"],"number"],FPDFAnnot_GetRect:[["number","number"],"boolean"],FPDFAnnot_GetStringValue:[["number","string","number","number"],"number"],FPDFAnnot_GetSubtype:[["number"],"number"],FPDFAnnot_GetValueType:[["number","string"],"number"],FPDFAnnot_GetVertices:[["number","number","number"],"number"],FPDFAnnot_HasAttachmentPoints:[["number"],"boolean"],FPDFAnnot_HasKey:[["number","string"],"boolean"],FPDFAnnot_IsChecked:[["number","number"],"boolean"],FPDFAnnot_IsObjectSupportedSubtype:[["number"],"boolean"],FPDFAnnot_IsOptionSelected:[["number","number","number"],"boolean"],FPDFAnnot_IsSupportedSubtype:[["number"],"boolean"],FPDFAnnot_RemoveInkList:[["number"],"boolean"],FPDFAnnot_RemoveObject:[["number","number"],"boolean"],FPDFAnnot_SetAP:[["number","number","number"],"boolean"],FPDFAnnot_SetAttachmentPoints:[["number","number","number"],"boolean"],FPDFAnnot_SetBorder:[["number","number","number","number"],"boolean"],FPDFAnnot_SetColor:[["number","number","number","number","number","number"],"boolean"],FPDFAnnot_SetFlags:[["number","number"],"boolean"],FPDFAnnot_SetFocusableSubtypes:[["number","number","number"],"boolean"],FPDFAnnot_SetFontColor:[["number","number","number","number","number"],"boolean"],FPDFAnnot_SetFormFieldFlags:[["number","number","number"],"boolean"],FPDFAnnot_SetRect:[["number","number"],"boolean"],FPDFAnnot_SetStringValue:[["number","string","number"],"boolean"],FPDFAnnot_SetURI:[["number","number"],"boolean"],FPDFAnnot_UpdateObject:[["number","number"],"boolean"],FPDFAttachment_GetFile:[["number","number","number","number"],"boolean"],FPDFAttachment_GetName:[["number","number","number"],"number"],FPDFAttachment_GetStringValue:[["number","string","number","number"],"number"],FPDFAttachment_GetSubtype:[["number","number","number"],"number"],FPDFAttachment_GetValueType:[["number","string"],"number"],FPDFAttachment_HasKey:[["number","string"],"boolean"],FPDFAttachment_SetFile:[["number","number","number","number"],"boolean"],FPDFAttachment_SetStringValue:[["number","string","number"],"boolean"],FPDFAvail_Create:[["number","number"],"number"],FPDFAvail_Destroy:[["number"],null],FPDFAvail_GetDocument:[["number","string"],"number"],FPDFAvail_GetFirstPageNum:[["number"],"number"],FPDFAvail_IsDocAvail:[["number","number"],"number"],FPDFAvail_IsFormAvail:[["number","number"],"number"],FPDFAvail_IsLinearized:[["number"],"number"],FPDFAvail_IsPageAvail:[["number","number","number"],"number"],FPDFBitmap_Create:[["number","number","number"],"number"],FPDFBitmap_CreateEx:[["number","number","number","number","number"],"number"],FPDFBitmap_Destroy:[["number"],null],FPDFBitmap_FillRect:[["number","number","number","number","number","number"],"boolean"],FPDFBitmap_GetBuffer:[["number"],"number"],FPDFBitmap_GetFormat:[["number"],"number"],FPDFBitmap_GetHeight:[["number"],"number"],FPDFBitmap_GetStride:[["number"],"number"],FPDFBitmap_GetWidth:[["number"],"number"],FPDFBookmark_Find:[["number","number"],"number"],FPDFBookmark_GetAction:[["number"],"number"],FPDFBookmark_GetCount:[["number"],"number"],FPDFBookmark_GetDest:[["number","number"],"number"],FPDFBookmark_GetFirstChild:[["number","number"],"number"],FPDFBookmark_GetNextSibling:[["number","number"],"number"],FPDFBookmark_GetTitle:[["number","number","number"],"number"],FPDFCatalog_GetLanguage:[["number","number","number"],"number"],FPDFCatalog_IsTagged:[["number"],"boolean"],FPDFCatalog_SetLanguage:[["number","number"],"boolean"],FPDFClipPath_CountPaths:[["number"],"number"],FPDFClipPath_CountPathSegments:[["number","number"],"number"],FPDFClipPath_GetPathSegment:[["number","number","number"],"number"],FPDFDest_GetDestPageIndex:[["number","number"],"number"],FPDFDest_GetLocationInPage:[["number","number","number","number","number","number","number"],"boolean"],FPDFDest_GetView:[["number","number","number"],"number"],FPDFDoc_AddAttachment:[["number","number"],"number"],FPDFDoc_CloseJavaScriptAction:[["number"],null],FPDFDoc_DeleteAttachment:[["number","number"],"boolean"],FPDFDOC_ExitFormFillEnvironment:[["number"],null],FPDFDoc_GetAttachment:[["number","number"],"number"],FPDFDoc_GetAttachmentCount:[["number"],"number"],FPDFDoc_GetJavaScriptAction:[["number","number"],"number"],FPDFDoc_GetJavaScriptActionCount:[["number"],"number"],FPDFDoc_GetPageMode:[["number"],"number"],FPDFDOC_InitFormFillEnvironment:[["number","number"],"number"],FPDFFont_Close:[["number"],null],FPDFFont_GetAscent:[["number","number","number"],"boolean"],FPDFFont_GetBaseFontName:[["number","number","number"],"number"],FPDFFont_GetDescent:[["number","number","number"],"boolean"],FPDFFont_GetFamilyName:[["number","number","number"],"number"],FPDFFont_GetFlags:[["number"],"number"],FPDFFont_GetFontData:[["number","number","number","number"],"boolean"],FPDFFont_GetGlyphPath:[["number","number","number"],"number"],FPDFFont_GetGlyphWidth:[["number","number","number","number"],"boolean"],FPDFFont_GetIsEmbedded:[["number"],"number"],FPDFFont_GetItalicAngle:[["number","number"],"boolean"],FPDFFont_GetWeight:[["number"],"number"],FPDFFormObj_CountObjects:[["number"],"number"],FPDFFormObj_GetObject:[["number","number"],"number"],FPDFFormObj_RemoveObject:[["number","number"],"boolean"],FPDFGlyphPath_CountGlyphSegments:[["number"],"number"],FPDFGlyphPath_GetGlyphPathSegment:[["number","number"],"number"],FPDFImageObj_GetBitmap:[["number"],"number"],FPDFImageObj_GetIccProfileDataDecoded:[["number","number","number","number","number"],"boolean"],FPDFImageObj_GetImageDataDecoded:[["number","number","number"],"number"],FPDFImageObj_GetImageDataRaw:[["number","number","number"],"number"],FPDFImageObj_GetImageFilter:[["number","number","number","number"],"number"],FPDFImageObj_GetImageFilterCount:[["number"],"number"],FPDFImageObj_GetImageMetadata:[["number","number","number"],"boolean"],FPDFImageObj_GetImagePixelSize:[["number","number","number"],"boolean"],FPDFImageObj_GetRenderedBitmap:[["number","number","number"],"number"],FPDFImageObj_LoadJpegFile:[["number","number","number","number"],"boolean"],FPDFImageObj_LoadJpegFileInline:[["number","number","number","number"],"boolean"],FPDFImageObj_SetBitmap:[["number","number","number","number"],"boolean"],FPDFImageObj_SetMatrix:[["number","number","number","number","number","number","number"],"boolean"],FPDFJavaScriptAction_GetName:[["number","number","number"],"number"],FPDFJavaScriptAction_GetScript:[["number","number","number"],"number"],FPDFLink_CloseWebLinks:[["number"],null],FPDFLink_CountQuadPoints:[["number"],"number"],FPDFLink_CountRects:[["number","number"],"number"],FPDFLink_CountWebLinks:[["number"],"number"],FPDFLink_Enumerate:[["number","number","number"],"boolean"],FPDFLink_GetAction:[["number"],"number"],FPDFLink_GetAnnot:[["number","number"],"number"],FPDFLink_GetAnnotRect:[["number","number"],"boolean"],FPDFLink_GetDest:[["number","number"],"number"],FPDFLink_GetLinkAtPoint:[["number","number","number"],"number"],FPDFLink_GetLinkZOrderAtPoint:[["number","number","number"],"number"],FPDFLink_GetQuadPoints:[["number","number","number"],"boolean"],FPDFLink_GetRect:[["number","number","number","number","number","number","number"],"boolean"],FPDFLink_GetTextRange:[["number","number","number","number"],"boolean"],FPDFLink_GetURL:[["number","number","number","number"],"number"],FPDFLink_LoadWebLinks:[["number"],"number"],FPDFPage_CloseAnnot:[["number"],null],FPDFPage_CountObjects:[["number"],"number"],FPDFPage_CreateAnnot:[["number","number"],"number"],FPDFPage_Delete:[["number","number"],null],FPDFPage_Flatten:[["number","number"],"number"],FPDFPage_FormFieldZOrderAtPoint:[["number","number","number","number"],"number"],FPDFPage_GenerateContent:[["number"],"boolean"],FPDFPage_GetAnnot:[["number","number"],"number"],FPDFPage_GetAnnotCount:[["number"],"number"],FPDFPage_GetAnnotIndex:[["number","number"],"number"],FPDFPage_GetArtBox:[["number","number","number","number","number"],"boolean"],FPDFPage_GetBleedBox:[["number","number","number","number","number"],"boolean"],FPDFPage_GetCropBox:[["number","number","number","number","number"],"boolean"],FPDFPage_GetDecodedThumbnailData:[["number","number","number"],"number"],FPDFPage_GetMediaBox:[["number","number","number","number","number"],"boolean"],FPDFPage_GetObject:[["number","number"],"number"],FPDFPage_GetRawThumbnailData:[["number","number","number"],"number"],FPDFPage_GetRotation:[["number"],"number"],FPDFPage_GetThumbnailAsBitmap:[["number"],"number"],FPDFPage_GetTrimBox:[["number","number","number","number","number"],"boolean"],FPDFPage_HasFormFieldAtPoint:[["number","number","number","number"],"number"],FPDFPage_HasTransparency:[["number"],"boolean"],FPDFPage_InsertClipPath:[["number","number"],null],FPDFPage_InsertObject:[["number","number"],null],FPDFPage_InsertObjectAtIndex:[["number","number","number"],"boolean"],FPDFPage_New:[["number","number","number","number"],"number"],FPDFPage_RemoveAnnot:[["number","number"],"boolean"],FPDFPage_RemoveObject:[["number","number"],"boolean"],FPDFPage_SetArtBox:[["number","number","number","number","number"],null],FPDFPage_SetBleedBox:[["number","number","number","number","number"],null],FPDFPage_SetCropBox:[["number","number","number","number","number"],null],FPDFPage_SetMediaBox:[["number","number","number","number","number"],null],FPDFPage_SetRotation:[["number","number"],null],FPDFPage_SetTrimBox:[["number","number","number","number","number"],null],FPDFPage_TransformAnnots:[["number","number","number","number","number","number","number"],null],FPDFPage_TransFormWithClip:[["number","number","number"],"boolean"],FPDFPageObj_AddMark:[["number","string"],"number"],FPDFPageObj_CountMarks:[["number"],"number"],FPDFPageObj_CreateNewPath:[["number","number"],"number"],FPDFPageObj_CreateNewRect:[["number","number","number","number"],"number"],FPDFPageObj_CreateTextObj:[["number","number","number"],"number"],FPDFPageObj_Destroy:[["number"],null],FPDFPageObj_GetBounds:[["number","number","number","number","number"],"boolean"],FPDFPageObj_GetClipPath:[["number"],"number"],FPDFPageObj_GetDashArray:[["number","number","number"],"boolean"],FPDFPageObj_GetDashCount:[["number"],"number"],FPDFPageObj_GetDashPhase:[["number","number"],"boolean"],FPDFPageObj_GetFillColor:[["number","number","number","number","number"],"boolean"],FPDFPageObj_GetIsActive:[["number","number"],"boolean"],FPDFPageObj_GetLineCap:[["number"],"number"],FPDFPageObj_GetLineJoin:[["number"],"number"],FPDFPageObj_GetMark:[["number","number"],"number"],FPDFPageObj_GetMarkedContentID:[["number"],"number"],FPDFPageObj_GetMatrix:[["number","number"],"boolean"],FPDFPageObj_GetRotatedBounds:[["number","number"],"boolean"],FPDFPageObj_GetStrokeColor:[["number","number","number","number","number"],"boolean"],FPDFPageObj_GetStrokeWidth:[["number","number"],"boolean"],FPDFPageObj_GetType:[["number"],"number"],FPDFPageObj_HasTransparency:[["number"],"boolean"],FPDFPageObj_NewImageObj:[["number"],"number"],FPDFPageObj_NewTextObj:[["number","string","number"],"number"],FPDFPageObj_RemoveMark:[["number","number"],"boolean"],FPDFPageObj_SetBlendMode:[["number","string"],null],FPDFPageObj_SetDashArray:[["number","number","number","number"],"boolean"],FPDFPageObj_SetDashPhase:[["number","number"],"boolean"],FPDFPageObj_SetFillColor:[["number","number","number","number","number"],"boolean"],FPDFPageObj_SetIsActive:[["number","boolean"],"boolean"],FPDFPageObj_SetLineCap:[["number","number"],"boolean"],FPDFPageObj_SetLineJoin:[["number","number"],"boolean"],FPDFPageObj_SetMatrix:[["number","number"],"boolean"],FPDFPageObj_SetStrokeColor:[["number","number","number","number","number"],"boolean"],FPDFPageObj_SetStrokeWidth:[["number","number"],"boolean"],FPDFPageObj_Transform:[["number","number","number","number","number","number","number"],null],FPDFPageObj_TransformClipPath:[["number","number","number","number","number","number","number"],null],FPDFPageObj_TransformF:[["number","number"],"boolean"],FPDFPageObjMark_CountParams:[["number"],"number"],FPDFPageObjMark_GetName:[["number","number","number","number"],"boolean"],FPDFPageObjMark_GetParamBlobValue:[["number","string","number","number","number"],"boolean"],FPDFPageObjMark_GetParamFloatValue:[["number","string","number"],"boolean"],FPDFPageObjMark_GetParamIntValue:[["number","string","number"],"boolean"],FPDFPageObjMark_GetParamKey:[["number","number","number","number","number"],"boolean"],FPDFPageObjMark_GetParamStringValue:[["number","string","number","number","number"],"boolean"],FPDFPageObjMark_GetParamValueType:[["number","string"],"number"],FPDFPageObjMark_RemoveParam:[["number","number","string"],"boolean"],FPDFPageObjMark_SetBlobParam:[["number","number","number","string","number","number"],"boolean"],FPDFPageObjMark_SetFloatParam:[["number","number","number","string","number"],"boolean"],FPDFPageObjMark_SetIntParam:[["number","number","number","string","number"],"boolean"],FPDFPageObjMark_SetStringParam:[["number","number","number","string","string"],"boolean"],FPDFPath_BezierTo:[["number","number","number","number","number","number","number"],"boolean"],FPDFPath_Close:[["number"],"boolean"],FPDFPath_CountSegments:[["number"],"number"],FPDFPath_GetDrawMode:[["number","number","number"],"boolean"],FPDFPath_GetPathSegment:[["number","number"],"number"],FPDFPath_LineTo:[["number","number","number"],"boolean"],FPDFPath_MoveTo:[["number","number","number"],"boolean"],FPDFPath_SetDrawMode:[["number","number","boolean"],"boolean"],FPDFPathSegment_GetClose:[["number"],"boolean"],FPDFPathSegment_GetPoint:[["number","number","number"],"boolean"],FPDFPathSegment_GetType:[["number"],"number"],FPDFSignatureObj_GetByteRange:[["number","number","number"],"number"],FPDFSignatureObj_GetContents:[["number","number","number"],"number"],FPDFSignatureObj_GetDocMDPPermission:[["number"],"number"],FPDFSignatureObj_GetReason:[["number","number","number"],"number"],FPDFSignatureObj_GetSubFilter:[["number","number","number"],"number"],FPDFSignatureObj_GetTime:[["number","number","number"],"number"],FPDFText_ClosePage:[["number"],null],FPDFText_CountChars:[["number"],"number"],FPDFText_CountRects:[["number","number","number"],"number"],FPDFText_FindClose:[["number"],null],FPDFText_FindNext:[["number"],"boolean"],FPDFText_FindPrev:[["number"],"boolean"],FPDFText_FindStart:[["number","number","number","number"],"number"],FPDFText_GetBoundedText:[["number","number","number","number","number","number","number"],"number"],FPDFText_GetCharAngle:[["number","number"],"number"],FPDFText_GetCharBox:[["number","number","number","number","number","number"],"boolean"],FPDFText_GetCharIndexAtPos:[["number","number","number","number","number"],"number"],FPDFText_GetCharIndexFromTextIndex:[["number","number"],"number"],FPDFText_GetCharOrigin:[["number","number","number","number"],"boolean"],FPDFText_GetFillColor:[["number","number","number","number","number","number"],"boolean"],FPDFText_GetFontInfo:[["number","number","number","number","number"],"number"],FPDFText_GetFontSize:[["number","number"],"number"],FPDFText_GetFontWeight:[["number","number"],"number"],FPDFText_GetLooseCharBox:[["number","number","number"],"boolean"],FPDFText_GetMatrix:[["number","number","number"],"boolean"],FPDFText_GetRect:[["number","number","number","number","number","number"],"boolean"],FPDFText_GetSchCount:[["number"],"number"],FPDFText_GetSchResultIndex:[["number"],"number"],FPDFText_GetStrokeColor:[["number","number","number","number","number","number"],"boolean"],FPDFText_GetText:[["number","number","number","number"],"number"],FPDFText_GetTextIndexFromCharIndex:[["number","number"],"number"],FPDFText_GetTextObject:[["number","number"],"number"],FPDFText_GetUnicode:[["number","number"],"number"],FPDFText_HasUnicodeMapError:[["number","number"],"number"],FPDFText_IsGenerated:[["number","number"],"number"],FPDFText_IsHyphen:[["number","number"],"number"],FPDFText_LoadCidType2Font:[["number","number","number","string","number","number"],"number"],FPDFText_LoadFont:[["number","number","number","number","boolean"],"number"],FPDFText_LoadPage:[["number"],"number"],FPDFText_LoadStandardFont:[["number","string"],"number"],FPDFText_SetCharcodes:[["number","number","number"],"boolean"],FPDFText_SetText:[["number","number"],"boolean"],FPDFTextObj_GetFont:[["number"],"number"],FPDFTextObj_GetFontSize:[["number","number"],"boolean"],FPDFTextObj_GetRenderedBitmap:[["number","number","number","number"],"number"],FPDFTextObj_GetText:[["number","number","number","number"],"number"],FPDFTextObj_GetTextRenderMode:[["number"],"number"],FPDFTextObj_SetTextRenderMode:[["number","number"],"boolean"],PDFiumExt_CloseFileWriter:[["number"],null],PDFiumExt_CloseFormFillInfo:[["number"],null],PDFiumExt_ExitFormFillEnvironment:[["number"],null],PDFiumExt_GetFileWriterData:[["number","number","number"],"number"],PDFiumExt_GetFileWriterSize:[["number"],"number"],PDFiumExt_Init:[[],null],PDFiumExt_InitFormFillEnvironment:[["number","number"],"number"],PDFiumExt_OpenFileWriter:[[],"number"],PDFiumExt_OpenFormFillInfo:[[],"number"],PDFiumExt_SaveAsCopy:[["number","number"],"number"]};async function 
1u(e){return async function(e){let t={pdfium:e};for(let n in s){let r=s[n][0],o=s[n][1];t[n]=e.cwrap(n,o,r)}return t}(await l(e))}function m(e,t,n,r=100){let o,i=e.wasmExports.malloc(r);for(let t=0;t<r;t++)e.HEAP8[i+t]=0;let a=t(i,r);if(a>r){e.wasmExports.free(i),i=e.wasmExports.malloc(a);for(let t=0;t<a;t++)e.HEAP8[i+t]=0;t(i,a),o=n(i)}else o=n(i);return e.wasmExports.free(i),o}function F(e,t){let n=t(0,0),r=e.wasmExports.malloc(n);t(r,n);let o=new ArrayBuffer(n),i=new DataView(o);for(let t=0;t<n;t++)i.setInt8(t,e.getValue(r+t,"i8"));return e.wasmExports.free(r),o}let d=new Set(["Title","Author","Subject","Keywords","Producer","Creator","CreationDate","ModDate","Trapped"]),P=e=>e,_={pageTtl:5e3,maxPagesPerDocument:10,normalizeRotation:!1};class g{constructor(e,t,n={}){this.pdfium=e,this.memoryManager=t,this.docs=new Map,this.config={..._,...n}}setDocument(e,t,n,r=!1){let o=this.docs.get(e);if(!o){let i={...this.config,normalizeRotation:r};o=new c(t,n,this.pdfium,this.memoryManager,i),this.docs.set(e,o)}}getContext(e){return this.docs.get(e)}closeDocument(e){let t=this.docs.get(e);return!!t&&(this.docs.delete(e),t.dispose(),!0)}closeAllDocuments(){for(let e of this.docs.values())e.dispose();this.docs.clear()}updateConfig(e){for(let t of(Object.assign(this.config,e),this.docs.values()))t.updateConfig(this.config)}getCacheStats(){let e={},t=0;for(let[n,r]of this.docs.entries()){let o=r.getCacheSize();e[n]=o,t+=o}return{documents:this.docs.size,totalPages:t,pagesByDocument:e}}}class c{constructor(e,t,n,r,o){this.filePtr=e,this.docPtr=t,this.memoryManager=r,this.disposed=!1,this.normalizeRotation=o.normalizeRotation,this.pageCache=new h(n,t,o)}acquirePage(e){return this.pageCache.acquire(e)}borrowPage(e,t){return this.pageCache.borrowPage(e,t)}updateConfig(e){this.pageCache.updateConfig(e)}getCacheSize(){return this.pageCache.size()}dispose(){this.disposed||(this.disposed=!0,this.pageCache.forceReleaseAll(),this.pageCache.pdf.FPDF_CloseDocument(this.docPtr),this.memoryManager.free(this.filePtr))}}class h{constructor(e,t,n){this.pdf=e,this.docPtr=t,this.cache=new Map,this.accessOrder=[],this.config=n}acquire(e){let t=this.cache.get(e);if(!t){let n;this.evictIfNeeded(),n=this.config.normalizeRotation?this.pdf.EPDF_LoadPageNormalized(this.docPtr,e,0):this.pdf.FPDF_LoadPage(this.docPtr,e),t=new D(this.pdf,this.docPtr,e,n,this.config.pageTtl,()=>{this.cache.delete(e),this.removeFromAccessOrder(e)}),this.cache.set(e,t)}return this.updateAccessOrder(e),t.clearExpiryTimer(),t.bumpRefCount(),t}borrowPage(e,t){let n=this.cache.has(e),r=this.acquire(e);try{return t(r)}finally{n?r.release():r.disposeImmediate()}}forceReleaseAll(){for(let e of this.cache.values())e.disposeImmediate();this.cache.clear(),this.accessOrder.length=0}updateConfig(e){for(let t of(this.config=e,this.cache.values()))t.updateTtl(e.pageTtl);this.evictIfNeeded()}size(){return this.cache.size}evictIfNeeded(){for(;this.cache.size>=this.config.maxPagesPerDocument;){let e=this.accessOrder[0];if(void 0===e)break;{let t=this.cache.get(e);if(t){if(0!==t.getRefCount())break;t.disposeImmediate()}else this.removeFromAccessOrder(e)}}}updateAccessOrder(e){this.removeFromAccessOrder(e),this.accessOrder.push(e)}removeFromAccessOrder(e){let t=this.accessOrder.indexOf(e);t>-1&&this.accessOrder.splice(t,1)}}class D{constructor(e,t,n,r,o,i){this.pdf=e,this.docPtr=t,this.pageIdx=n,this.pagePtr=r,this.onFinalDispose=i,this.refCount=0,this.disposed=!1,this.ttl=o}bumpRefCount(){if(this.disposed)throw Error("Context already disposed");this.refCount++}getRefCount(){return this.refCount}clearExpiryTimer(){this.expiryTimer&&(clearTimeout(this.expiryTimer),this.expiryTimer=void 0)}updateTtl(e){this.ttl=e,this.expiryTimer&&0===this.refCount&&(this.clearExpiryTimer(),this.expiryTimer=setTimeout(()=>this.disposeImmediate(),this.ttl))}release(){this.disposed||(this.refCount--,0===this.refCount&&(this.expiryTimer=setTimeout(()=>this.disposeImmediate(),this.ttl)))}disposeImmediate(){this.disposed||(this.disposed=!0,this.clearExpiryTimer(),void 0!==this.textPagePtr&&this.pdf.FPDFText_ClosePage(this.textPagePtr),this.pdf.FPDF_ClosePage(this.pagePtr),this.onFinalDispose())}getTextPage(){return this.ensureAlive(),void 0===this.textPagePtr&&(this.textPagePtr=this.pdf.FPDFText_LoadPage(this.pagePtr)),this.textPagePtr}withAnnotation(e,t){this.ensureAlive();let n=this.pdf.FPDFPage_GetAnnot(this.pagePtr,e);try{return t(n)}finally{this.pdf.FPDFPage_CloseAnnot(n)}}withFormHandle(e){this.ensureAlive();let t=this.pdf.PDFiumExt_OpenFormFillInfo(),n=this.pdf.PDFiumExt_InitFormFillEnvironment(this.docPtr,t);this.pdf.FORM_OnAfterLoadPage(this.pagePtr,n);try{return e(n)}finally{this.pdf.FORM_OnBeforeClosePage(this.pagePtr,n),this.pdf.PDFiumExt_ExitFormFillEnvironment(n),this.pdf.PDFiumExt_CloseFormFillInfo(t)}}ensureAlive(){if(this.disposed)throw Error("PageContext already disposed")}}let p={MAX_TOTAL_MEMORY:0x80000000},f="PDFiumEngine",b="MemoryManager";class A{constructor(e,t){this.pdfiumModule=e,this.logger=t,this.allocations=new Map,this.totalAllocated=0}malloc(e){if(this.totalAllocated+e>p.MAX_TOTAL_MEMORY)throw Error(`Total memory usage would exceed limit: ${this.totalAllocated+e} > ${p.MAX_TOTAL_MEMORY}`);let t=this.pdfiumModule.pdfium.wasmExports.malloc(e);if(!t)throw Error(`Failed to allocate ${e} bytes`);let n={ptr:t,size:e,timestamp:Date.now(),stack:this.logger.isEnabled("debug")?Error().stack:void 0};return this.allocations.set(t,n),this.totalAllocated+=e,t}free(e){let t=this.allocations.get(e);t?(this.totalAllocated-=t.size,this.allocations.delete(e)):this.logger.warn(f,b,`Freeing untracked pointer: ${e}`),this.pdfiumModule.pdfium.wasmExports.free(e)}getStats(){return{totalAllocated:this.totalAllocated,allocationCount:this.allocations.size,allocations:this.logger.isEnabled("debug")?Array.from(this.allocations.values()):[]}}checkLeaks(){if(this.allocations.size>0)for(let[e,t]of(this.logger.warn(f,b,`Potential memory leak: ${this.allocations.size} unfreed allocations`),this.allocations))this.logger.warn(f,b,`  - ${e}: ${t.size} bytes`,t.stack)}}let E="pdfium",M="font-fallback";class y{constructor(e,t=new o.N){this.fontHandles=new Map,this.fontCache=new Map,this.nextHandleId=1,this.module=null,this.enabled=!1,this.structPtr=0,this.releaseFnPtr=0,this.enumFontsFnPtr=0,this.mapFontFnPtr=0,this.getFontFnPtr=0,this.getFontDataFnPtr=0,this.getFaceNameFnPtr=0,this.getFontCharsetFnPtr=0,this.deleteFontFnPtr=0,this.fontConfig=e,this.logger=t}initialize(e){if(this.enabled)return void this.logger.warn(E,M,"Font fallback already initialized");this.module=e;let t=e.pdfium;if("function"==typeof t.addFunction)try{if(this.structPtr=t.wasmExports.malloc(36),!this.structPtr)throw Error("Failed to allocate FPDF_SYSFONTINFO struct");for(let e=0;e<36;e++)t.setValue(this.structPtr+e,0,"i8");this.releaseFnPtr=t.addFunction(e=>{},"vi"),this.enumFontsFnPtr=t.addFunction((e,t)=>{},"vii"),this.mapFontFnPtr=t.addFunction((e,n,r,o,i,a,l)=>{let s=a?t.UTF8ToString(a):"",u=this.mapFont(n,r,o,i,s);return l&&t.setValue(l,0,"i32"),u},"iiiiiiii"),this.getFontFnPtr=t.addFunction((e,n)=>{let r=n?t.UTF8ToString(n):"";return this.mapFont(400,0,0,0,r)},"iii"),this.getFontDataFnPtr=t.addFunction((e,t,n,r,o)=>this.getFontData(t,n,r,o),"iiiiii"),this.getFaceNameFnPtr=t.addFunction((e,t,n,r)=>0,"iiiii"),this.getFontCharsetFnPtr=t.addFunction((e,t)=>{let n=this.fontHandles.get(t);return(null==n?void 0:n.charset)??0},"iii"),this.deleteFontFnPtr=t.addFunction((e,t)=>{this.deleteFont(t)},"vii"),t.setValue(this.structPtr+0,1,"i32"),t.setValue(this.structPtr+4,this.releaseFnPtr,"i32"),t.setValue(this.structPtr+8,this.enumFontsFnPtr,"i32"),t.setValue(this.structPtr+12,this.mapFontFnPtr,"i32"),t.setValue(this.structPtr+16,this.getFontFnPtr,"i32"),t.setValue(this.structPtr+20,this.getFontDataFnPtr,"i32"),t.setValue(this.structPtr+24,this.getFaceNameFnPtr,"i32"),t.setValue(this.structPtr+28,this.getFontCharsetFnPtr,"i32"),t.setValue(this.structPtr+32,this.deleteFontFnPtr,"i32"),e.FPDF_SetSystemFontInfo(this.structPtr),this.enabled=!0,this.logger.info(E,M,"Font fallback system initialized (pure TypeScript)",Object.keys(this.fontConfig.fonts))}catch(e){throw this.logger.error(E,M,"Failed to initialize font fallback",e),this.cleanup(),e}else this.logger.error(E,M,"addFunction not available. Make sure WASM is compiled with -sALLOW_TABLE_GROWTH")}disable(){this.enabled&&this.module&&(this.module.FPDF_SetSystemFontInfo(0),this.cleanup(),this.enabled=!1,this.logger.debug(E,M,"Font fallback system disabled"))}cleanup(){if(!this.module)return;let e=this.module.pdfium;this.structPtr&&(e.wasmExports.free(this.structPtr),this.structPtr=0);let t=t=>{if(t&&"function"==typeof e.removeFunction)try{e.removeFunction(t)}catch{}};t(this.releaseFnPtr),t(this.enumFontsFnPtr),t(this.mapFontFnPtr),t(this.getFontFnPtr),t(this.getFontDataFnPtr),t(this.getFaceNameFnPtr),t(this.getFontCharsetFnPtr),t(this.deleteFontFnPtr),this.releaseFnPtr=0,this.enumFontsFnPtr=0,this.mapFontFnPtr=0,this.getFontFnPtr=0,this.getFontDataFnPtr=0,this.getFaceNameFnPtr=0,this.getFontCharsetFnPtr=0,this.deleteFontFnPtr=0}isEnabled(){return this.enabled}getStats(){return{handleCount:this.fontHandles.size,cacheSize:this.fontCache.size,cachedUrls:Array.from(this.fontCache.keys())}}async preloadFonts(e){let t=[...new Set(e.map(e=>this.getFontUrlForCharset(e)).filter(e=>null!==e))];await Promise.all(t.map(async e=>{if(!this.fontCache.has(e))try{let t=await this.fetchFontAsync(e);t&&(this.fontCache.set(e,t),this.logger.debug(E,M,`Pre-loaded font: ${e}`))}catch(t){this.logger.warn(E,M,`Failed to pre-load font: ${e}`,t)}}))}mapFont(e,t,n,r,o){let i=0!==t;this.logger.debug(E,M,"MapFont called",{weight:e,italic:i,charset:n,pitchFamily:r,face:o});let a=this.findBestFontMatch(n,e,i);if(!a)return this.logger.debug(E,M,`No font configured for charset ${n}`),0;let l={id:this.nextHandleId++,charset:n,weight:e,italic:i,url:a.url,data:null};return this.fontHandles.set(l.id,l),this.logger.debug(E,M,`Created font handle ${l.id} for ${a.url} (requested: weight=${e}, italic=${i}, matched: weight=${a.matchedWeight}, italic=${a.matchedItalic})`),l.id}getFontData(e,t,n,r){let o=this.fontHandles.get(e);if(!o)return this.logger.warn(E,M,`Unknown font handle: ${e}`),0;if(o.data||(this.fontCache.has(o.url)?o.data=this.fontCache.get(o.url):(o.data=this.fetchFontSync(o.url),o.data&&this.fontCache.set(o.url,o.data))),!o.data)return this.logger.warn(E,M,`Failed to load font: ${o.url}`),0;let i=o.data;return 0!==t?(this.logger.debug(E,M,`Table ${t} requested - returning 0 to request whole file`),0):(0===n||r<i.length||this.module&&(this.module.pdfium.HEAPU8.set(i,n),this.logger.debug(E,M,`Copied ${i.length} bytes to buffer for handle ${e}`)),i.length)}deleteFont(e){this.fontHandles.get(e)&&(this.logger.debug(E,M,`Deleting font handle ${e}`),this.fontHandles.delete(e))}
1findBestFontMatch(e,t,n){let{fonts:r,defaultFont:o,baseUrl:i}=this.fontConfig,a=r[e]??o;if(!a)return null;let l=this.normalizeToVariants(a);if(0===l.length)return null;let s=this.selectBestVariant(l,t,n),u=s.url;return!i||u.startsWith("http://")||u.startsWith("https://")||u.startsWith("/")||(u=`${i}/${u}`),{url:u,matchedWeight:s.weight??400,matchedItalic:s.italic??!1}}normalizeToVariants(e){return"string"==typeof e?[{url:e,weight:400,italic:!1}]:Array.isArray(e)?e.map(e=>({url:e.url,weight:e.weight??400,italic:e.italic??!1})):[{url:e.url,weight:e.weight??400,italic:e.italic??!1}]}selectBestVariant(e,t,n){if(1===e.length)return e[0];let r=e.filter(e=>(e.italic??!1)===n),o=r.length>0?r:e,i=o[0],a=Math.abs((i.weight??400)-t);for(let e of o){let n=e.weight??400,r=Math.abs(n-t);if(r<a)i=e,a=r;else if(r===a){let r=i.weight??400;t>=500?n>r&&(i=e):n<r&&(i=e)}}return i}getFontUrlForCharset(e){let t=this.findBestFontMatch(e,400,!1);return(null==t?void 0:t.url)??null}fetchFontSync(e){if(this.logger.debug(E,M,`Fetching font synchronously: ${e}`),this.fontConfig.fontLoader)try{let t=this.fontConfig.fontLoader(e);return t?this.logger.info(E,M,`Loaded font via custom loader: ${e} (${t.length} bytes)`):this.logger.warn(E,M,`Custom font loader returned null for: ${e}`),t}catch(t){return this.logger.error(E,M,`Error in custom font loader: ${e}`,t),null}try{let t=new XMLHttpRequest;if(t.open("GET",e,!1),t.responseType="arraybuffer",t.send(),200===t.status){let n=new Uint8Array(t.response);return this.logger.info(E,M,`Loaded font: ${e} (${n.length} bytes)`),n}return this.logger.error(E,M,`Failed to load font: ${e} (HTTP ${t.status})`),null}catch(t){return this.logger.error(E,M,`Error fetching font: ${e}`,t),null}}async fetchFontAsync(e){if(this.fontConfig.fontLoader)try{return this.fontConfig.fontLoader(e)}catch{return null}try{let t=await fetch(e);if(t.ok){let e=await t.arrayBuffer();return new Uint8Array(e)}return null}catch{return null}}}let G="PDFiumEngine",S="Engine";class C{constructor(e,t={}){this.pdfiumModule=e,this.memoryLeakCheckInterval=null,this.fontFallbackManager=null;let{logger:n=new o.N,fontFallback:r}=t;this.logger=n,this.memoryManager=new A(this.pdfiumModule,this.logger),this.cache=new g(this.pdfiumModule,this.memoryManager),this.logger.isEnabled("debug")&&(this.memoryLeakCheckInterval=setInterval(()=>{this.memoryManager.checkLeaks()},1e4)),this.logger.debug(G,S,"initialize"),this.logger.perf(G,S,"Initialize","Begin","General"),this.pdfiumModule.PDFiumExt_Init(),this.logger.perf(G,S,"Initialize","End","General"),r&&(this.fontFallbackManager=new y(r,this.logger),this.fontFallbackManager.initialize(this.pdfiumModule),this.logger.info(G,S,"Font fallback system enabled"))}destroy(){return this.logger.debug(G,S,"destroy"),this.logger.perf(G,S,"Destroy","Begin","General"),this.fontFallbackManager&&(this.fontFallbackManager.disable(),this.fontFallbackManager=null),this.pdfiumModule.FPDF_DestroyLibrary(),this.memoryLeakCheckInterval&&(clearInterval(this.memoryLeakCheckInterval),this.memoryLeakCheckInterval=null),this.logger.perf(G,S,"Destroy","End","General"),o.a.resolve(!0)}getFontFallbackManager(){return this.fontFallbackManager}withWString(e,t){let n=2*(e.length+1),r=this.memoryManager.malloc(n);try{return this.pdfiumModule.pdfium.stringToUTF16(e,r,n),t(r)}finally{this.memoryManager.free(r)}}withFloatArray(e,t){let n=e??[],r=4*n.length,o=r?this.memoryManager.malloc(r):0;try{if(r)for(let e=0;e<n.length;e++)this.pdfiumModule.pdfium.setValue(o+4*e,n[e],"float");return t(o,n.length)}finally{r&&this.memoryManager.free(o)}}openDocumentBuffer(e,t){this.logger.debug(G,S,"openDocumentBuffer",e,t),this.logger.perf(G,S,"OpenDocumentBuffer","Begin",e.id);let n=(null==t?void 0:t.normalizeRotation)??!1,r=new Uint8Array(e.content),i=r.length,a=this.memoryManager.malloc(i);this.pdfiumModule.pdfium.HEAPU8.set(r,a);let l=this.pdfiumModule.FPDF_LoadMemDocument(a,i,(null==t?void 0:t.password)??"");if(!l){let t=this.pdfiumModule.FPDF_GetLastError();return this.logger.error(G,S,`FPDF_LoadMemDocument failed with ${t}`),this.memoryManager.free(a),this.logger.perf(G,S,"OpenDocumentBuffer","End",e.id),o.a.reject({code:t,message:"FPDF_LoadMemDocument failed"})}let s=this.pdfiumModule.FPDF_GetPageCount(l),u=[],m=this.memoryManager.malloc(8),F=this.memoryManager.malloc(16);for(let t=0;t<s;t++){if(!(n?this.pdfiumModule.EPDF_GetPageSizeByIndexNormalized(l,t,m):this.pdfiumModule.FPDF_GetPageSizeByIndexF(l,t,m))){let t=this.pdfiumModule.FPDF_GetLastError();return this.logger.error(G,S,`${n?"EPDF_GetPageSizeByIndexNormalized":"FPDF_GetPageSizeByIndexF"} failed with ${t}`),this.memoryManager.free(m),this.memoryManager.free(F),this.pdfiumModule.FPDF_CloseDocument(l),this.memoryManager.free(a),this.logger.perf(G,S,"OpenDocumentBuffer","End",e.id),o.a.reject({code:t,message:(n?"EPDF_GetPageSizeByIndexNormalized":"FPDF_GetPageSizeByIndexF")+" failed"})}let r=this.pdfiumModule.EPDF_GetPageRotationByIndex(l,t),i=this.pdfiumModule.EPDFDoc_GetPageObjectNumberByIndex(l,t),s=this.readPageBoxes(l,t,F),d={index:t,size:{width:this.pdfiumModule.pdfium.getValue(m,"float"),height:this.pdfiumModule.pdfium.getValue(m+4,"float")},rotation:r,objectNumber:i,boxes:s};u.push(d)}this.memoryManager.free(m),this.memoryManager.free(F);let d=this.pdfiumModule.EPDF_IsEncrypted(l),P=this.pdfiumModule.EPDF_IsOwner
1Unlocked(l),_=this.pdfiumModule.FPDF_GetDocPermissions(l),g={id:e.id,pageCount:s,pages:u,isEncrypted:d,isOwnerUnlocked:P,permissions:_,normalizedRotation:n};return this.cache.setDocument(e.id,a,l,n),this.logger.perf(G,S,"OpenDocumentBuffer","End",e.id),o.a.resolve(g)}createDocument(e){this.logger.debug(G,S,"createDocument",e),this.logger.perf(G,S,"CreateDocument","Begin",e);let t=this.pdfiumModule.FPDF_CreateNewDocument();return t?(this.cache.setDocument(e,0,t,!1),this.logger.perf(G,S,"CreateDocument","End",e),o.a.resolve({id:e,pageCount:0,pages:[],isEncrypted:!1,isOwnerUnlocked:!0,permissions:0xffffffff,normalizedRotation:!1})):(this.logger.perf(G,S,"CreateDocument","End",e),o.a.reject({code:o.P.CantCreateNewDoc,message:"can not create new document"}))}getMetadata(e){this.logger.debug(G,S,"getMetadata",e),this.logger.perf(G,S,"GetMetadata","Begin",e.id);let t=this.cache.getContext(e.id);if(!t)return this.logger.perf(G,S,"GetMetadata","End",e.id),o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let n=this.readMetaText(t.docPtr,"CreationDate"),r=this.readMetaText(t.docPtr,"ModDate"),i={title:this.readMetaText(t.docPtr,"Title"),author:this.readMetaText(t.docPtr,"Author"),subject:this.readMetaText(t.docPtr,"Subject"),keywords:this.readMetaText(t.docPtr,"Keywords"),producer:this.readMetaText(t.docPtr,"Producer"),creator:this.readMetaText(t.docPtr,"Creator"),creationDate:n?(0,o.p)(n)??null:null,modificationDate:r?(0,o.p)(r)??null:null,trapped:this.getMetaTrapped(t.docPtr),custom:this.readAllMeta(t.docPtr,!0)};return this.logger.perf(G,S,"GetMetadata","End",e.id),o.a.resolve(i)}setMetadata(e,t){this.logger.debug(G,S,"setMetadata",e,t),this.logger.perf(G,S,"SetMetadata","Begin",e.id);let n=this.cache.getContext(e.id);if(!n)return this.logger.perf(G,S,"SetMetadata","End",e.id),o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let r=!0;for(let[e,o]of[["title","Title"],["author","Author"],["subject","Subject"],["keywords","Keywords"],["producer","Producer"],["creator","Creator"]]){let i=t[e];if(void 0===i)continue;let a=null===i?null:i;this.setMetaText(n.docPtr,o,a)||(r=!1)}let i=(e,i)=>{let a=t[e];if(void 0===a)return;if(null===a)return void(this.setMetaText(n.docPtr,i,null)||(r=!1));let l=(0,o.y)(a);this.setMetaText(n.docPtr,i,l)||(r=!1)};if(i("creationDate","CreationDate"),i("modificationDate","ModDate"),void 0!==t.trapped&&(this.setMetaTrapped(n.docPtr,t.trapped??null)||(r=!1)),void 0!==t.custom)for(let[e,o]of Object.entries(t.custom))!function(e){if(!e||e.length>127||d.has(e)||"/"===e[0])return!1;for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32||n>126)return!1}return!0}(e)?this.logger.warn(G,S,"Invalid custom metadata key skipped",e):this.setMetaText(n.docPtr,e,o??null)||(r=!1);return this.logger.perf(G,S,"SetMetadata","End",e.id),r?o.a.resolve(!0):o.a.reject({code:o.P.Unknown,message:"one or more metadata fields could not be written"})}getDocPermissions(e){this.logger.debug(G,S,"getDocPermissions",e),this.logger.perf(G,S,"getDocPermissions","Begin",e.id);let t=this.cache.getContext(e.id);if(!t)return this.logger.perf(G,S,"getDocPermissions","End",e.id),o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let n=this.pdfiumModule.FPDF_GetDocPermissions(t.docPtr);return o.a.resolve(n)}getDocUserPermissions(e){this.logger.debug(G,S,"getDocUserPermissions",e),this.logger.perf(G,S,"getDocUserPermissions","Begin",e.id);let t=this.cache.getContext(e.id);if(!t)return this.logger.perf(G,S,"getDocUserPermissions","End",e.id),o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let n=this.pdfiumModule.FPDF_GetDocUserPermissions(t.docPtr);return o.a.resolve(n)}getSignatures(e){this.logger.debug(G,S,"getSignatures",e),this.logger.perf(G,S,"GetSignatures","Begin",e.id);let t=this.cache.getContext(e.id);if(!t)return this.logger.perf(G,S,"GetSignatures","End",e.id),o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let n=[],r=this.pdfiumModule.FPDF_GetSignatureCount(t.docPtr);for(let e=0;e<r;e++){let r=this.pdfiumModule.FPDF_GetSignatureObject(t.docPtr,e),o=F(this.pdfiumModule.pdfium,(e,t)=>this.pdfiumModule.FPDFSignatureObj_GetContents(r,e,t)),i=F(this.pdfiumModule.pdfium,(e,t)=>4*this.pdfiumModule.FPDFSignatureObj_GetByteRange(r,e,t)),a=F(this.pdfiumModule.pdfium,(e,t)=>this.pdfiumModule.FPDFSignatureObj_GetSubFilter(r,e,t)),l=m(this.pdfiumModule.pdfium,(e,t)=>this.pdfiumModule.FPDFSignatureObj_GetReason(r,e,t),this.pdfiumModule.pdfium.UTF16ToString),s=m(this.pdfiumModule.pdfium,(e,t)=>this.pdfiumModule.FPDFSignatureObj_GetTime(r,e,t),this.pdfiumModule.pdfium.UTF8ToString),u=this.pdfiumModule.FPDFSignatureObj_GetDocMDPPermission(r);n.push({contents:o,byteRange:i,subFilter:a,reason:l,time:s,docMDP:u})}return this.logger.perf(G,S,"GetSignatures","End",e.id),o.a.resolve(n)}getBookmarks(e){this.logger.debug(G,S,"getBookmarks",e),this.logger.perf(G,S,"GetBookmarks","Begin",e.id);let t=this.cache.getContext(e.id);if(!t)return this.logger.perf(G,S,"getBookmarks","End",e.id),o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let n=this.readPdfBookmarks(t.docPtr,0);return this.logger.perf(G,S,"GetBookmarks","End",e.id),o.a.resolve({bookmarks:n})}setBookmarks(e,t){this.logger.debug(G,S,"setBookmarks",e,t),this.logger.perf(G,S,"SetBookmarks","Begin",e.id);let n=this.cache.getContext(e.id);if(!n)return this.logger.perf(G,S,"SetBookmarks","End",e.id),o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});if(!this.pdfiumModule.EPDFBookmark_Clear(n.docPtr))return this.logger.perf(G,S,"SetBookmarks","End",e.id),o.a.reject({code:o.P.Unknown,message:"failed to clear existing bookmarks"});let r=(e,t)=>{var o;for(let i of t){let t=this.withWString(i.title??"",t=>this.pdfiumModule.EPDFBookmark_AppendChild(n.docPtr,e,t));if(!t||i.target&&!this.applyBookmarkTarget(n.docPtr,t,i.target)||(null==(o=i.children)?void 0:o.length)&&!r(t,i.children))return!1}return!0},i=r(0,t);return this.logger.perf(G,S,"SetBookmarks","End",e.id),i?o.a.resolve(!0):o.a.reject({code:o.P.Unknown,message:"failed to build bookmark tree"})}deleteBookmarks(e){this.logger.debug(G,S,"deleteBookmarks",e),this.logger.perf(G,S,"DeleteBookmarks","Begin",e.id);let t=this.cache.getContext(e.id);if(!t)return this.logger.perf(G,S,"DeleteBookmarks","End",e.id),o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let n=this.pdfiumModule.EPDFBookmark_Clear(t.docPtr);return this.logger.perf(G,S,"DeleteBookmarks","End",e.id),n?o.a.resolve(!0):o.a.reject({code:o.P.Unknown,message:"failed to clear bookmarks"})}renderPageRaw(e,t,n){this.logger.debug(G,S,"renderPage",e,t,n),this.logger.perf(G,S,"RenderPage","Begin",`${e.id}-${t.index}`);let r={origin:{x:0,y:0},size:t.size},o=this.renderRectEncoded(e,t,r,n);return this.logger.perf(G,S,"RenderPage","End",`${e.id}-${t.index}`),o}renderPageRect(e,t,n,r){this.logger.debug(G,S,"renderPageRect",e,t,n,r),this.logger.perf(G,S,"RenderPageRect","Begin",`${e.id}-${t.index}`);let o=this.renderRectEncoded(e,t,n,r);return this.logger.perf(G,S,"RenderPageRect","End",`${e.id}-${t.index}`),o}getDocumentJavaScriptActions(e){this.logger.debug(G,S,"getDocumentJavaScriptActions",e);let t=this.cache.getContext(e.id);if(!t)return o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let n=this.pdfiumModule.FPDFDoc_GetJavaScriptActionCount(t.docPtr);if(n<0)return o.a.reject({code:o.P.Unknown,message:"failed to read document javascript actions"});let r=[];for(let e=0;e<n;e++){let n=this.pdfiumModule.FPDFDoc_GetJavaScriptAction(t.docPtr,e);if(n)try{let t=m(this.pdfiumModule.pdfium,(e,t)=>this.pdfiumModule.FPDFJavaScriptAction_GetName(n,e,t),this.pdfiumModule.pdfium.UTF16ToString)??"",i=m(this.pdfiumModule.pdfium,(e,t)=>this.pdfiumModule.FPDFJavaScriptAction_GetScript(n,e,t),this.pdfiumModule.pdfium.UTF16ToString)??"";if(!i)continue;r.push({id:`document:${e}:${t}`,trigger:o.b.DocumentNamed,name:t,script:i})}finally{this.pdfiumModule.FPDFDoc_CloseJavaScriptAction(n)}}return o.a.resolve(r)}getPageAnnoWidgets(e,t){this.logger.debug(G,S,"getPageAnnoWidgets",e,t),this.logger.perf(G,S,"GetPageAnnoWidgets","Begin",`${e.id}-${t.index}`);let n=this.cache.getContext(e.id);if(!n)return this.logger.perf(G,S,"GetPageAnnoWidgets","End",`${e.id}-${t.index}`),o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let r=this.readPageAnnoWidgets(e,n,t);return this.logger.perf(G,S,"GetPageAnnoWidgets","End",`${e.id}-${t.index}`),this.logger.debug(G,S,"GetPageAnnoWidgets",`${e.id}-${t.index}`,r),o.a.resolve(r)}getPageWidgetJavaScriptActions(e,t){this.logger.debug(G,S,"getPageWidgetJavaScriptActions",e,t);let n=this.cache.getContext(e.id);if(!n)return o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let r=[];return n.borrowPage(t.index,e=>{e.withFormHandle(n=>{let i=this.pdfiumModule.FPDFPage_GetAnnotCount(e.pagePtr);for(let a=0;a<i;a++)e.withAnnotation(a,e=>{if(this.pdfiumModule.FPDFAnnot_GetSubtype(e)!==o.c.WIDGET)return;let i=this.getAnnotString(e,"NM");i||(i=(0,o.u)(),this.setAnnotString(e,"NM",i));let a=m(this.pdfiumModule.pdfium,(t,r)=>this.pdfiumModule.FPDFAnnot_GetFormFieldName(n,e,t,r),this.pdfiumModule.pdfium.UTF16ToString)??"";for(let l of[{event:o.e.KEY_STROKE,eventType:o.d.Keystroke,trigger:o.b.WidgetKeystroke},{event:o.e.FORMAT,eventType:o.d.Format,trigger:o.b.WidgetFormat},{event:o.e.VALIDATE,eventType:o.d.Validate,trigger:o.b.WidgetValidate},{event:o.e.CALCULATE,eventType:o.d.Calculate,trigger:o.b.WidgetCalculate}]){let o=m(this.pdfiumModule.pdfium,(t,r)=>this.pdfiumModule.FPDFAnnot_GetFormAdditionalActionJavaScript(n,e,l.event,t,r),this.pdfiumModule.pdfium.UTF16ToString)??"";o&&r.push({id:`widget:${t.index}:${i}:${l.eventType}`,trigger:l.trigger,eventType:l.eventType,pageIndex:t.index,annotationId:i,fieldName:a,script:o})}})})}),o.a.resolve(r)}regenerateWidgetAppearances(e,t,n){let r=this.cache.getContext(e.id);if(!r)return o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let i=new Set(n),a=0;return r.borrowPage(t.index,e=>{let t=this.pdfiumModule.FPDFPage_GetAnnotCount(e.pagePtr);for(let n=0;n<t;n++)e.withAnnotation(n,e=>{let t=this.getAnnotString(e,"NM");t&&i.has(t)&&(this.pdfiumModule.EPDFAnnot_GenerateFormFieldAP(e),a++)});a>0&&this.pdfiumModule.FPDFPage_GenerateContent(e.pagePtr)}),o.a.resolve(a>0)}getPageAnnotations(e,t){this.logger.debug(G,S,"getPageAnnotations",e,t),this.logger.perf(G,S,"GetPageAnnotations","Begin",`${e.id}-${t.index}`);let n=this.cache.getContext(e.id);if(!n)return this.logger.perf(G,S,"GetPageAnnotations","End",`${e.id}-${t.index}`),o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let r=this.readPageAnnotations(e,n,t);return this.logger.perf(G,S,"GetPageAnnotations","End",`${e.id}-${t.index}`),this.logger.debug(G,S,"GetPageAnnotations",`${e.id}-${t.index}`,r),o.a.resolve(r)}createPageAnnotation(e,t,n,r){var i;let a,l,s;this.logger.debug(G,S,"createPageAnnotation",e,t,n),this.logger.perf(G,S,"CreatePageAnnotation","Begin",`${e.id}-${t.index}`);let u=this.cache.getContext(e.id);if(!u)return this.logger.perf(G,S,"CreatePageAnnotation","End",`${e.id}-${t.index}`),o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let m=u.acquirePage(t.index);if(n.type===o.c.WIDGET){l=this.pdfiumModule.PDFiumExt_OpenFormFillInfo(),s=this.pdfiumModule.PDFiumExt_InitFormFillEnvironment(u.docPtr,l),this.pdfiumModule.FORM_OnAfterLoadPage(m.pagePtr,s);let e=(null==(i=n.field)?void 0:i.name)??"";a=this.withWString(e,e=>this.pdfiumModule.EPDFPage_CreateFormField(m.pagePtr,s,n.field.type,e))}else a=this.pdfiumModule.EPDFPage_CreateAnnot(m.pagePtr,n.type);if(!a)return this.logger.perf(G,S,"CreatePageAnnotation","End",`${e.id}-${t.index}`),m.release(),o.a.reject({code:o.P.CantCreateAnnot,message:"can not create annotation with specified type"});if(n.id||(n.id=(0,o.u)()),!this.setAnnotString(a,"NM",n.id))return this.pdfiumModule.FPDFPage_CloseAnnot(a),m.release(),o.a.reject({code:o.P.CantSetAnnotString,message:"can not set the name of the annotation"});if(!this.setPageAnnoRect(e,t,a,n.rect))return this.pdfiumModule.FPDFPage_CloseAnnot(a),m.release(),this.logger.perf(G,S,"CreatePageAnnotation","End",`${e.id}-${t.index}`),o.a.reject({code:o.P.CantSetAnnotRect,message:"can not set the rect of the annotation"});let F=this.prepareAnnotationForSave(n),d=!1;switch(F.type){case o.c.INK:d=this.addInkStroke(e,t,m.pagePtr,a,F);break;case o.c.STAMP:d=this.addStampContent(e,u.docPtr,t,m.pagePtr,a,F,r);break;case o.c.TEXT:d=this.addTextContent(e,t,m.pagePtr,a,F);break;case o.c.FREETEXT:d=this.addFreeTextContent(e,t,m.pagePtr,a,F);break;case o.c.LINE:d=this.addLineContent(e,t,m.pagePtr,a,F);break;case o.c.POLYLINE:case o.c.POLYGON:d=this.addPolyContent(e,t,m.pagePtr,a,F);break;case o.c.CIRCLE:case o.c.SQUARE:d=this.addShapeContent(e,t,m.pagePtr,a,F);break;case o.c.UNDERLINE:case o.c.STRIKEOUT:case o.c.SQUIGGLY:case o.c.HIGHLIGHT:d=this.addTextMarkupContent(e,t,m.pagePtr,a,F);break;case o.c.LINK:d=this.addLinkContent(e,t,u.docPtr,m.pagePtr,a,F);break;case o.c.CARET:d=this.addCaretContent(e,t,m.pagePtr,a,F);break;case o.c.REDACT:d=this.addRedactContent(e,t,m.pagePtr,a,F);break;case o.c.WIDGET:if(void 0!==s)switch(F.field.type){case o.f.TEXTFIELD:d=this.addTextFieldContent(s,a,F);break;case o.f.CHECKBOX:case o.f.RADIOBUTTON:d=this.addToggleFieldContent(s,a,F);break;case o.f.COMBOBOX:case o.f.LISTBOX:d=this.addChoiceFieldContent(s,a,F)}}return void 0!==s&&(this.pdfiumModule.FORM_OnBeforeClosePage(m.pagePtr,s),this.pdfiumModule.PDFiumExt_ExitFormFillEnvironment(s)),void 0!==l&&this.pdfiumModule.PDFiumExt_CloseFormFillInfo(l),d?(n.type===o.c.WIDGET?this.pdfiumModule.EPDFAnnot_GenerateFormFieldAP(a):void 0!==n.blendMode?this.pdfiumModule.EPDFAnnot_GenerateAppearanceWithBlend(a,n.blendMode):this.pdfiumModule.EPDFAnnot_GenerateAppearance(a),this.pdfiumModule.FPDFPage_GenerateContent(m.pagePtr),this.pdfiumModule.FPDFPage_CloseAnnot(a),m.release(),this.logger.perf(G,S,"CreatePageAnnotation","End",`${e.id}-${t.index}`),o.a.resolve(n.id)):(this.removeAnnotationByName(m.pagePtr,n.id),this.pdfiumModule.FPDFPage_CloseAnnot(a),m.release(),this.logger.perf(G,S,"CreatePageAnnotation","End",`${e.id}-${t.index}`),o.a.reject({code:o.P.CantSetAnnotContent,message:"can not add content of the annotation"}))}updatePageAnnotation(e,t,n,r){this.logger.debug(G,S,"updatePageAnnotation",e,t,n),this.logger.perf(G,S,"UpdatePageAnnotation","Begin",`${e.id}-${t.index}`);let i=this.cache.getContext(e.id);if(!i)return this.logger.perf(G,S,"UpdatePageAnnotation","End",`${e.id}-${t.index}`),o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let a=i.acquirePage(t.index),l=this.getAnnotationByName(a.pagePtr,n.id);if(!l)return a.release(),this.logger.perf(G,S,"UpdatePageAnnotation","End",`${e.id}-${t.index}`),o.a.reject({code:o.P.NotFound,message:"annotation not found"});if(!this.setPageAnnoRect(e,t,l,n.rect))return this.pdfiumModule.FPDFPage_CloseAnnot(l),a.release(),this.logger.perf(G,S,"UpdatePageAnnotation","End",`${e.id}-${t.index}`),o.a.reject({code:o.P.CantSetAnnotRect,message:"failed to move annotation"});let s=this.prepareAnnotationForSave(n),u=!1;switch(s.type){case o.c.INK:if(!this.pdfiumModule.FPDFAnnot_RemoveInkList(l))break;u=this.addInkStroke(e,t,a.pagePtr,l,s);break;case o.c.STAMP:u=this.addStampContent(e,i.docPtr,t,a.pagePtr,l,s);break;case o.c.TEXT:u=this.addTextContent(e,t,a.pagePtr,l,s);break;case o.c.FREETEXT:u=this.addFreeTextContent(e,t,a.pagePtr,l,s);break;case o.c.CIRCLE:case o.c.SQUARE:u=this.addShapeContent(e,t,a.pagePtr,l,s);break;case o.c.LINE:u=this.addLineContent(e,t,a.pagePtr,l,s);break;case o.c.POLYGON:case o.c.POLYLINE:u=this.addPolyContent(e,t,a.pagePtr,l,s);break;case o.c.HIGHLIGHT:case o.c.UNDERLINE:case o.c.STRIKEOUT:case o.c.SQUIGGLY:u=this.addTextMarkupContent(e,t,a.pagePtr,l,s);break;case o.c.LINK:u=this.addLinkContent(e,t,i.docPtr,a.pagePtr,l,s);break;case o.c.CARET:u=this.addCaretContent(e,t,a.pagePtr,l,s);break;case o.c.REDACT:u=this.addRedactContent(e,t,a.pagePtr,l,s);break;
1case o.c.WIDGET:a.withFormHandle(e=>{switch(s.field.type){case o.f.TEXTFIELD:u=this.addTextFieldContent(e,l,s);break;case o.f.CHECKBOX:case o.f.RADIOBUTTON:u=this.addToggleFieldContent(e,l,s);break;case o.f.COMBOBOX:case o.f.LISTBOX:u=this.addChoiceFieldContent(e,l,s)}});break;default:u=!1}return u&&!1!==(null==r?void 0:r.regenerateAppearance)&&(n.type===o.c.WIDGET?this.pdfiumModule.EPDFAnnot_GenerateFormFieldAP(l):void 0!==n.blendMode?this.pdfiumModule.EPDFAnnot_GenerateAppearanceWithBlend(l,n.blendMode):this.pdfiumModule.EPDFAnnot_GenerateAppearance(l),this.pdfiumModule.FPDFPage_GenerateContent(a.pagePtr)),this.pdfiumModule.FPDFPage_CloseAnnot(l),a.release(),this.logger.perf(G,S,"UpdatePageAnnotation","End",`${e.id}-${t.index}`),u?o.a.resolve(!0):o.a.reject({code:o.P.CantSetAnnotContent,message:"failed to update annotation"})}removePageAnnotation(e,t,n){this.logger.debug(G,S,"removePageAnnotation",e,t,n),this.logger.perf(G,S,"RemovePageAnnotation","Begin",`${e.id}-${t.index}`);let r=this.cache.getContext(e.id);if(!r)return this.logger.perf(G,S,"RemovePageAnnotation","End",`${e.id}-${t.index}`),o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let i=r.acquirePage(t.index),a=!1;return(a=this.removeAnnotationByName(i.pagePtr,n.id))?(a=this.pdfiumModule.FPDFPage_GenerateContent(i.pagePtr))||this.logger.error(G,S,"FPDFPage_GenerateContent Failed",`${e.id}-${t.index}`):this.logger.error(G,S,"FPDFPage_RemoveAnnot Failed",`${e.id}-${t.index}`),i.release(),this.logger.perf(G,S,"RemovePageAnnotation","End",`${e.id}-${t.index}`),o.a.resolve(a)}getPageTextRects(e,t){this.logger.debug(G,S,"getPageTextRects",e,t),this.logger.perf(G,S,"GetPageTextRects","Begin",`${e.id}-${t.index}`);let n=this.cache.getContext(e.id);if(!n)return this.logger.perf(G,S,"GetPageTextRects","End",`${e.id}-${t.index}`),o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let r=n.acquirePage(t.index),i=this.pdfiumModule.FPDFText_LoadPage(r.pagePtr),a=this.readPageTextRects(t,r.docPtr,r.pagePtr,i);return this.pdfiumModule.FPDFText_ClosePage(i),r.release(),this.logger.perf(G,S,"GetPageTextRects","End",`${e.id}-${t.index}`),o.a.resolve(a)}renderThumbnailRaw(e,t,n){let{scaleFactor:r=1,...i}=n??{};if(this.logger.debug(G,S,"renderThumbnail",e,t,n),this.logger.perf(G,S,"RenderThumbnail","Begin",`${e.id}-${t.index}`),!this.cache.getContext(e.id))return this.logger.perf(G,S,"RenderThumbnail","End",`${e.id}-${t.index}`),o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let a=this.renderPageRaw(e,t,{scaleFactor:Math.max(r,.5),...i});return this.logger.perf(G,S,"RenderThumbnail","End",`${e.id}-${t.index}`),a}getAttachments(e){this.logger.debug(G,S,"getAttachments",e),this.logger.perf(G,S,"GetAttachments","Begin",e.id);let t=this.cache.getContext(e.id);if(!t)return this.logger.perf(G,S,"GetAttachments","End",e.id),o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let n=[],r=this.pdfiumModule.FPDFDoc_GetAttachmentCount(t.docPtr);for(let e=0;e<r;e++){let r=this.readPdfAttachment(t.docPtr,e);n.push(r)}return this.logger.perf(G,S,"GetAttachments","End",e.id),o.a.resolve(n)}addAttachment(e,t){this.logger.debug(G,S,"addAttachment",e,null==t?void 0:t.name),this.logger.perf(G,S,"AddAttachment","Begin",e.id);let n=this.cache.getContext(e.id);if(!n)return this.logger.perf(G,S,"AddAttachment","End",e.id),o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let{name:r,description:i,mimeType:a,data:l}=t??{};if(!r)return this.logger.perf(G,S,"AddAttachment","End",e.id),o.a.reject({code:o.P.NotFound,message:"attachment name is required"});if(!l||(Uint8Array,0===l.byteLength))return this.logger.perf(G,S,"AddAttachment","End",e.id),o.a.reject({code:o.P.NotFound,message:"attachment data is empty"});let s=this.withWString(r,e=>this.pdfiumModule.FPDFDoc_AddAttachment(n.docPtr,e));if(!s)return this.logger.perf(G,S,"AddAttachment","End",e.id),o.a.reject({code:o.P.Unknown,message:`An attachment named "${r}" already exists`});this.withWString(i,e=>this.pdfiumModule.EPDFAttachment_SetDescription(s,e)),this.pdfiumModule.EPDFAttachment_SetSubtype(s,a);let u=l instanceof Uint8Array?l:new Uint8Array(l),m=u.byteLength,F=this.memoryManager.malloc(m);try{if(this.pdfiumModule.pdfium.HEAPU8.set(u,F),!this.pdfiumModule.FPDFAttachment_SetFile(s,n.docPtr,F,m))return this.logger.perf(G,S,"AddAttachment","End",e.id),o.a.reject({code:o.P.Unknown,message:"failed to write attachment bytes"})}finally{this.memoryManager.free(F)}return this.logger.perf(G,S,"AddAttachment","End",e.id),o.a.resolve(!0)}removeAttachment(e,t){this.logger.debug(G,S,"deleteAttachment",e,t),this.logger.perf(G,S,"DeleteAttachment","Begin",e.id);let n=this.cache.getContext(e.id);if(!n)return this.logger.perf(G,S,"DeleteAttachment","End",e.id),o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let r=this.pdfiumModule.FPDFDoc_GetAttachmentCount(n.docPtr);if(t.index<0||t.index>=r)return this.logger.perf(G,S,"DeleteAttachment","End",e.id),o.a.reject({code:o.P.Unknown,message:`attachment index ${t.index} out of range`});let i=this.pdfiumModule.FPDFDoc_DeleteAttachment(n.docPtr,t.index);return this.logger.perf(G,S,"DeleteAttachment","End",e.id),i?o.a.resolve(!0):o.a.reject({code:o.P.Unknown,message:"failed to delete attachment"})}readAttachmentContent(e,t){this.logger.debug(G,S,"readAttachmentContent",e,t),this.logger.perf(G,S,"ReadAttachmentContent","Begin",e.id);let n=this.cache.getContext(e.id);if(!n)return this.logger.perf(G,S,"ReadAttachmentContent","End",e.id),o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let r=this.pdfiumModule.FPDFDoc_GetAttachment(n.docPtr,t.index),i=this.memoryManager.malloc(4);if(!this.pdfiumModule.FPDFAttachment_GetFile(r,0,0,i))return this.memoryManager.free(i),this.logger.perf(G,S,"ReadAttachmentContent","End",e.id),o.a.reject({code:o.P.CantReadAttachmentSize,message:"can not read attachment size"});let a=this.pdfiumModule.pdfium.getValue(i,"i32")>>>0,l=this.memoryManager.malloc(a);if(!this.pdfiumModule.FPDFAttachment_GetFile(r,l,a,i))return this.memoryManager.free(i),this.memoryManager.free(l),this.logger.perf(G,S,"ReadAttachmentContent","End",e.id),o.a.reject({code:o.P.CantReadAttachmentContent,message:"can not read attachment content"});let s=new ArrayBuffer(a),u=new DataView(s);for(let e=0;e<a;e++)u.setInt8(e,this.pdfiumModule.pdfium.getValue(l+e,"i8"));return this.memoryManager.free(i),this.memoryManager.free(l),this.logger.perf(G,S,"ReadAttachmentContent","End",e.id),o.a.resolve(s)}setFormFieldValue(e,t,n,r){this.logger.debug(G,S,"SetFormFieldValue",e,n,r),this.logger.perf(G,S,"SetFormFieldValue","Begin",`${e.id}-${n.id}`);let i=this.cache.getContext(e.id);if(!i)return this.logger.debug(G,S,"SetFormFieldValue","document is not opened"),this.logger.perf(G,S,"SetFormFieldValue","End",`${e.id}-${n.id}`),o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let a=i.acquirePage(t.index);try{return a.withFormHandle(e=>{let t=this.getAnnotationByName(a.pagePtr,n.id);if(!t)return o.a.reject({code:o.P.NotFound,message:"annotation not found"});try{if(!this.pdfiumModule.FORM_SetFocusedAnnot(e,t))return o.a.reject({code:o.P.CantFocusAnnot,message:"failed to set focused annotation"});switch(r.kind){case"text":{if(!this.pdfiumModule.FORM_SelectAllText(e,a.pagePtr))return this.pdfiumModule.FORM_ForceToKillFocus(e),o.a.reject({code:o.P.CantSelectText,message:"failed to select all text"});let t=2*(r.text.length+1),n=this.memoryManager.malloc(t);this.pdfiumModule.pdfium.stringToUTF16(r.text,n,t),this.pdfiumModule.FORM_ReplaceSelection(e,a.pagePtr,n),this.memoryManager.free(n);break}case"selection":if(!this.pdfiumModule.FORM_SetIndexSelected(e,a.pagePtr,r.index,r.isSelected))return this.pdfiumModule.FORM_ForceToKillFocus(e),o.a.reject({code:o.P.CantSelectOption,message:"failed to set index selected"});break;case"checked":if(!!this.pdfiumModule.FPDFAnnot_IsChecked(e,t)!==r.checked&&!this.pdfiumModule.FORM_OnChar(e,a.pagePtr,13,0))return this.pdfiumModule.FORM_ForceToKillFocus(e),o.a.reject({code:o.P.CantCheckField,message:"failed to set field checked"})}return this.pdfiumModule.FORM_ForceToKillFocus(e),this.pdfiumModule.EPDFAnnot_GenerateFormFieldAP(t),o.a.resolve(!0)}finally{this.pdfiumModule.FPDFPage_CloseAnnot(t)}})}finally{a.release()}}setFormFieldState(e,t,n,r){this.logger.debug(G,S,"SetFormFieldState",e,n,r),this.logger.perf(G,S,"SetFormFieldState","Begin",`${e.id}-${n.id}`);let i=this.cache.getContext(e.id);if(!i)return this.logger.debug(G,S,"SetFormFieldState","document is not opened"),this.logger.perf(G,S,"SetFormFieldState","End",`${e.id}-${n.id}`),o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let a=i.acquirePage(t.index);try{return a.withFormHandle(t=>{let i=this.getAnnotationByName(a.pagePtr,n.id);if(!i)return o.a.reject({code:o.P.NotFound,message:"annotation not found"});try{if(!this.pdfiumModule.FORM_SetFocusedAnnot(t,i))return o.a.reject({code:o.P.CantFocusAnnot,message:"failed to set focused annotation"});switch(r.type){case o.f.TEXTFIELD:{if(!this.pdfiumModule.FORM_SelectAllText(t,a.pagePtr))return this.pdfiumModule.FORM_ForceToKillFocus(t),o.a.reject({code:o.P.CantSelectText,message:"failed to select all text"});let e=2*(r.value.length+1),n=this.memoryManager.malloc(e);this.pdfiumModule.pdfium.stringToUTF16(r.value,n,e),this.pdfiumModule.FORM_ReplaceSelection(t,a.pagePtr,n),this.memoryManager.free(n);break}case o.f.CHECKBOX:case o.f.RADIOBUTTON:if(!!this.pdfiumModule.FPDFAnnot_IsChecked(t,i)!=(null!=n.exportValue&&r.value===n.exportValue)&&!this.pdfiumModule.FORM_OnChar(t,a.pagePtr,13,0))return this.pdfiumModule.FORM_ForceToKillFocus(t),o.a.reject({code:o.P.CantCheckField,message:"failed to set field checked"});break;case o.f.COMBOBOX:{let e=r.options.findIndex(e=>e.isSelected);if(e>=0&&!this.pdfiumModule.FORM_SetIndexSelected(t,a.pagePtr,e,!0))return this.pdfiumModule.FORM_ForceToKillFocus(t),o.a.reject({code:o.P.CantSelectOption,message:"failed to set index selected"});break}case o.f.LISTBOX:for(let e=0;e<r.options.length;e++)if(!this.pdfiumModule.FORM_SetIndexSelected(t,a.pagePtr,e,r.options[e].isSelected))return this.pdfiumModule.FORM_ForceToKillFocus(t),o.a.reject({code:o.P.CantSelectOption,message:"failed to set index selected"})}return this.pdfiumModule.FORM_ForceToKillFocus(t),r.type!==o.f.CHECKBOX&&r.type!==o.f.RADIOBUTTON&&this.pdfiumModule.EPDFAnnot_GenerateFormFieldAP(i),this.logger.perf(G,S,"SetFormFieldState","End",`${e.id}-${n.id}`),o.a.resolve(!0)}finally{this.pdfiumModule.FPDFPage_CloseAnnot(i)}})}finally{a.release()}}renameWidgetField(e,t,n,r){this.logger.debug(G,S,"RenameWidgetField",e,n,r),this.logger.perf(G,S,"RenameWidgetField","Begin",`${e.id}-${n.id}`);let i=this.cache.getContext(e.id);if(!i)return this.logger.perf(G,S,"RenameWidgetField","End",`${e.id}-${n.id}`),o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let a=i.acquirePage(t.index);try{return a.withFormHandle(t=>{let i=this.getAnnotationByName(a.pagePtr,n.id);if(!i)return o.a.reject({code:o.P.NotFound,message:"annotation not found"});try{return this.withWString(r,e=>this.pdfiumModule.EPDFAnnot_SetFormFieldName(t,i,e))?(this.logger.perf(G,S,"RenameWidgetField","End",`${e.id}-${n.id}`),o.a.resolve(!0)):o.a.reject({code:o.P.CantSetAnnotString,message:"failed to rename widget field"})}finally{this.pdfiumModule.FPDFPage_CloseAnnot(i)}})}finally{a.release()}}shareWidgetField(e,t,n,r,i){this.logger.debug(G,S,"ShareWidgetField",e,n,i),this.logger.perf(G,S,"ShareWidgetField","Begin",`${e.id}-${n.id}-${i.id}`);let a=this.cache.getContext(e.id);if(!a)return this.logger.perf(G,S,"ShareWidgetField","End",`${e.id}-${n.id}-${i.id}`),o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let l=a.acquirePage(t.index),s=r.index===t.index?l:a.acquirePage(r.index);try{return l.withFormHandle(t=>{let r=!1;s!==l&&(this.pdfiumModule.FORM_OnAfterLoadPage(s.pagePtr,t),r=!0);let a=this.getAnnotationByName(l.pagePtr,n.id),u=this.getAnnotationByName(s.pagePtr,i.id);if(!a||!u)return a&&this.pdfiumModule.FPDFPage_CloseAnnot(a),u&&this.pdfiumModule.FPDFPage_CloseAnnot(u),r&&this.pdfiumModule.FORM_OnBeforeClosePage(s.pagePtr,t),o.a.reject({code:o.P.NotFound,message:"annotation not found"});try{return this.pdfiumModule.EPDFAnnot_ShareFormField(t,a,u)?(this.logger.perf(G,S,"ShareWidgetField","End",`${e.id}-${n.id}-${i.id}`),o.a.resolve(!0)):o.a.reject({code:o.P.Unknown,message:"failed to share widget field"})}finally{this.pdfiumModule.FPDFPage_CloseAnnot(a),this.pdfiumModule.FPDFPage_CloseAnnot(u),r&&this.pdfiumModule.FORM_OnBeforeClosePage(s.pagePtr,t)}})}finally{l.release(),s!==l&&s.release()}}flattenPage(e,t,n){let{flag:r=o.g.Display}=n??{};this.logger.debug(G,S,"flattenPage",e,t,r),this.logger.perf(G,S,"flattenPage","Begin",e.id);let i=this.cache.getContext(e.id);if(!i)return this.logger.perf(G,S,"flattenPage","End",e.id),o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let a=i.acquirePage(t.index),l=this.pdfiumModule.FPDFPage_Flatten(a.pagePtr,r);return a.release(),this.logger.perf(G,S,"flattenPage","End",e.id),o.a.resolve(l)}extractPages(e,t){this.logger.debug(G,S,"extractPages",e,t),this.logger.perf(G,S,"ExtractPages","Begin",e.id);let n=this.cache.getContext(e.id);if(!n)return this.logger.perf(G,S,"ExtractPages","End",e.id),o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let r=this.pdfiumModule.FPDF_CreateNewDocument();if(!r)return this.logger.perf(G,S,"ExtractPages","End",e.id),o.a.reject({code:o.P.CantCreateNewDoc,message:"can not create new document"});let i=this.memoryManager.malloc(4*t.length);for(let e=0;e<t.length;e++)this.pdfiumModule.pdfium.setValue(i+4*e,t[e],"i32");if(!this.pdfiumModule.FPDF_ImportPagesByIndex(r,n.docPtr,i,t.length,0))return this.pdfiumModule.FPDF_CloseDocument(r),this.logger.perf(G,S,"ExtractPages","End",e.id),o.a.reject({code:o.P.CantImportPages,message:"can not import pages to new document"});let a=this.saveDocument(r);return this.pdfiumModule.FPDF_CloseDocument(r),this.logger.perf(G,S,"ExtractPages","End",e.id),o.a.resolve(a)}importPages(e,t,n,r){this.logger.debug(G,S,"importPages",e.id,t.id,n),this.logger.perf(G,S,"ImportPages","Begin",e.id);let i=this.cache.getContext(e.id);if(!i)return this.logger.perf(G,S,"ImportPages","End",e.id),o.a.reject({code:o.P.DocNotOpen,message:"destination document is not open"});let a=this.cache.getContext(t.id);if(!a)return this.logger.perf(G,S,"ImportPages","End",e.id),o.a.reject({code:o.P.DocNotOpen,message:"source document is not open"});let l=r??this.pdfiumModule.FPDF_GetPageCount(i.docPtr),s=this.memoryManager.malloc(4*n.length);for(let e=0;e<n.length;e++)this.pdfiumModule.pdfium.setValue(s+4*e,n[e],"i32");if(!this.pdfiumModule.FPDF_ImportPagesByIndex(i.docPtr,a.docPtr,s,n.length,l))return this.memoryManager.free(s),this.logger.perf(G,S,"ImportPages","End",e.id),o.a.reject({code:o.P.CantImportPages,message:"can not import pages into destination document"});this.memoryManager.free(s);let u=[],m=this.memoryManager.malloc(8),F=i.normalizeRotation;for(let t=0;t<n.length;t++){let n=l+t;if(!(F?this.pdfiumModule.EPDF_GetPageSizeByIndexNormalized(i.docPtr,n,m):this.pdfiumModule.FPDF_GetPageSizeByIndexF(i.docPtr,n,m)))return this.memoryManager.free(m),this.logger.perf(G,S,"ImportPages","End",e.id),o.a.reject({code:o.P.Unknown,message:`failed to read metadata for imported page ${n}`});let r=this.pdfiumModule.EPDF_GetPageRotationByIndex(i.docPtr,n),a=this.pdfiumModule.EPDFDoc_GetPageObjectNumberByIndex(i.docPtr,n);u.push({index:n,size:{width:this.pdfiumModule.pdfium.getValue(m,"float"),height:this.pdfiumModule.pdfium.getValue(m+4,"float")},rotation:r,objectNumber:a})}return this.memoryManager.free(m),this.logger.perf(G,S,"ImportPages","End",e.id),o.a.resolve(u)}deletePage(e,t){this.logger.debug(G,S,"deletePage",e.id,t),this.logger.perf(G,S,"DeletePage","Begin",e.id);let n=this.cache.getContext(e.id);if(!n)return this.logger.perf(G,S,"DeletePage","End",e.id),o.a.reject({code:o.P.DocNotOpen,message:"document is not open"});let r=this.pdfiumModule.FPDF_GetPageCount(n.docPtr);return t<0||t>=r?(this.logger.perf(G,S,"DeletePage","End",e.id),o.a.reject({code:o.P.CantDeletePage,message:`page index ${t} out of range (0..${r-1})`})):(this.pdfiumModule.FPDFPage_Delete(n.docPtr,t),this.logger.perf(G,S,"DeletePage","End",e.id),o.a.resolve(!0))}ex
1tractText(e,t){this.logger.debug(G,S,"extractText",e,t),this.logger.perf(G,S,"ExtractText","Begin",e.id);let n=this.cache.getContext(e.id);if(!n)return this.logger.perf(G,S,"ExtractText","End",e.id),o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let r=[];for(let e=0;e<t.length;e++){let o=n.acquirePage(t[e]),i=this.pdfiumModule.FPDFText_LoadPage(o.pagePtr),a=this.pdfiumModule.FPDFText_CountChars(i),l=this.memoryManager.malloc(2*(a+1));this.pdfiumModule.FPDFText_GetText(i,0,a,l);let s=this.pdfiumModule.pdfium.UTF16ToString(l);this.memoryManager.free(l),r.push(s),this.pdfiumModule.FPDFText_ClosePage(i),o.release()}let i=r.join("\n\n");return this.logger.perf(G,S,"ExtractText","End",e.id),o.a.resolve(i)}getTextSlices(e,t){if(this.logger.debug(G,S,"getTextSlices",e,t),this.logger.perf(G,S,"GetTextSlices","Begin",e.id),0===t.length)return this.logger.perf(G,S,"GetTextSlices","End",e.id),o.a.resolve([]);let n=this.cache.getContext(e.id);if(!n)return this.logger.perf(G,S,"GetTextSlices","End",e.id),o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});try{let r=Array(t.length),i=new Map;for(let[e,a]of(t.forEach((e,t)=>{(i.get(e.pageIndex)??i.set(e.pageIndex,[]).get(e.pageIndex)).push({slice:e,pos:t})}),i)){let t=n.acquirePage(e),i=t.getTextPage();for(let{slice:e,pos:t}of a){let n=this.memoryManager.malloc(2*(e.charCount+1));this.pdfiumModule.FPDFText_GetText(i,e.charIndex,e.charCount,n),r[t]=(0,o.h)(this.pdfiumModule.pdfium.UTF16ToString(n)),this.memoryManager.free(n)}t.release()}return this.logger.perf(G,S,"GetTextSlices","End",e.id),o.a.resolve(r)}catch(t){return this.logger.error(G,S,"getTextSlices error",t),this.logger.perf(G,S,"GetTextSlices","End",e.id),o.a.reject({code:o.P.Unknown,message:String(t)})}}merge(e){this.logger.debug(G,S,"merge",e);let t=e.map(e=>e.id).join(".");this.logger.perf(G,S,"Merge","Begin",t);let n=this.pdfiumModule.FPDF_CreateNewDocument();if(!n)return this.logger.perf(G,S,"Merge","End",t),o.a.reject({code:o.P.CantCreateNewDoc,message:"can not create new document"});let r=[];for(let i of e.reverse()){let e=new Uint8Array(i.content),a=e.length,l=this.memoryManager.malloc(a);this.pdfiumModule.pdfium.HEAPU8.set(e,l);let s=this.pdfiumModule.FPDF_LoadMemDocument(l,a,"");if(!s){let e=this.pdfiumModule.FPDF_GetLastError();for(let t of(this.logger.error(G,S,`FPDF_LoadMemDocument failed with ${e}`),this.memoryManager.free(l),r))this.pdfiumModule.FPDF_CloseDocument(t.docPtr),this.memoryManager.free(t.filePtr);return this.logger.perf(G,S,"Merge","End",t),o.a.reject({code:e,message:"FPDF_LoadMemDocument failed"})}if(r.push({filePtr:l,docPtr:s}),!this.pdfiumModule.FPDF_ImportPages(n,s,"",0)){for(let e of(this.pdfiumModule.FPDF_CloseDocument(n),r))this.pdfiumModule.FPDF_CloseDocument(e.docPtr),this.memoryManager.free(e.filePtr);return this.logger.perf(G,S,"Merge","End",t),o.a.reject({code:o.P.CantImportPages,message:"can not import pages to new document"})}}let i=this.saveDocument(n);for(let e of(this.pdfiumModule.FPDF_CloseDocument(n),r))this.pdfiumModule.FPDF_CloseDocument(e.docPtr),this.memoryManager.free(e.filePtr);let a={id:`${Math.random()}`,content:i};return this.logger.perf(G,S,"Merge","End",t),o.a.resolve(a)}mergePages(e){let t=e.map(e=>`${e.docId}:${e.pageIndices.join(",")}`).join("|");this.logger.debug(G,S,"mergePages",e),this.logger.perf(G,S,"MergePages","Begin",t);let n=this.pdfiumModule.FPDF_CreateNewDocument();if(!n)return this.logger.perf(G,S,"MergePages","End",t),o.a.reject({code:o.P.CantCreateNewDoc,message:"Cannot create new document"});try{for(let t of[...e].reverse()){let e=this.cache.getContext(t.docId);if(!e){this.logger.warn(G,S,`Document ${t.docId} is not open, skipping`);continue}let r=this.pdfiumModule.FPDF_GetPageCount(e.docPtr),o=t.pageIndices.filter(e=>e>=0&&e<r);if(0===o.length)continue;let i=o.map(e=>e+1).join(",");if(!this.pdfiumModule.FPDF_ImportPages(n,e.docPtr,i,0))throw Error(`Failed to import pages ${i} from document ${t.docId}`)}let r=this.saveDocument(n),i={id:`${Math.random()}`,content:r};return this.logger.perf(G,S,"MergePages","End",t),o.a.resolve(i)}catch(e){return this.logger.error(G,S,"mergePages failed",e),this.logger.perf(G,S,"MergePages","End",t),o.a.reject({code:o.P.CantImportPages,message:e instanceof Error?e.message:"Failed to merge pages"})}finally{n&&this.pdfiumModule.FPDF_CloseDocument(n)}}setDocumentEncryption(e,t,n,r){this.logger.debug(G,S,"setDocumentEncryption",e,r);let i=this.cache.getContext(e.id);if(!i)return o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let a=this.pdfiumModule.EPDF_SetEncryption(i.docPtr,t,n,r);return o.a.resolve(a)}removeEncryption(e){this.logger.debug(G,S,"removeEncryption",e);let t=this.cache.getContext(e.id);if(!t)return o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let n=this.pdfiumModule.EPDF_RemoveEncryption(t.docPtr);return o.a.resolve(n)}unlockOwnerPermissions(e,t){this.logger.debug(G,S,"unlockOwnerPermissions",e.id);let n=this.cache.getContext(e.id);if(!n)return o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});
1let r=this.pdfiumModule.EPDF_UnlockOwnerPermissions(n.docPtr,t);return o.a.resolve(r)}isEncrypted(e){this.logger.debug(G,S,"isEncrypted",e.id);let t=this.cache.getContext(e.id);if(!t)return o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let n=this.pdfiumModule.EPDF_IsEncrypted(t.docPtr);return o.a.resolve(n)}isOwnerUnlocked(e){this.logger.debug(G,S,"isOwnerUnlocked",e.id);let t=this.cache.getContext(e.id);if(!t)return o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let n=this.pdfiumModule.EPDF_IsOwnerUnlocked(t.docPtr);return o.a.resolve(n)}saveAsCopy(e){this.logger.debug(G,S,"saveAsCopy",e),this.logger.perf(G,S,"SaveAsCopy","Begin",e.id);let t=this.cache.getContext(e.id);if(!t)return this.logger.perf(G,S,"SaveAsCopy","End",e.id),o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let n=this.saveDocument(t.docPtr);return this.logger.perf(G,S,"SaveAsCopy","End",e.id),o.a.resolve(n)}closeDocument(e){return this.logger.debug(G,S,"closeDocument",e),this.logger.perf(G,S,"CloseDocument","Begin",e.id),this.cache.closeDocument(e.id),this.logger.perf(G,S,"CloseDocument","End",e.id),o.a.resolve(!0)}closeAllDocuments(){return this.logger.debug(G,S,"closeAllDocuments"),this.logger.perf(G,S,"CloseAllDocuments","Begin"),this.cache.closeAllDocuments(),this.logger.perf(G,S,"CloseAllDocuments","End"),o.a.resolve(!0)}addTextContent(e,t,n,r,i){if(!this.setAnnotationName(r,i.name??i.icon??o.i.Comment)||i.state&&!this.setAnnotString(r,"State",i.state)||i.stateModel&&!this.setAnnotString(r,"StateModel",i.stateModel)||!this.setAnnotationOpacity(r,i.opacity??1))return!1;let a=i.strokeColor??i.color??"#FFFF00";return!!this.setAnnotationColor(r,a,o.j.Color)&&!(!i.flags&&!this.setAnnotationFlags(r,["print","noZoom","noRotate"]))&&this.applyBaseAnnotationProperties(e,t,n,r,i)}addCaretContent(e,t,n,r,i){return i.strokeColor&&this.setAnnotationColor(r,i.strokeColor,o.j.Color),void 0!==i.opacity&&this.setAnnotationOpacity(r,i.opacity),i.intent&&this.setAnnotIntent(r,i.intent),this.setRectangleDifferences(r,i.rectangleDifferences),this.applyBaseAnnotationProperties(e,t,n,r,i)}addFreeTextContent(e,t,n,r,i){if(!this.setBorderStyle(r,o.k.SOLID,i.strokeWidth??0)||!this.setAnnotationOpacity(r,i.opacity??1)||!this.setAnnotationTextAlignment(r,i.textAlign)||!this.setAnnotationVerticalAlignment(r,i.verticalAlign))return!1;let a=i.strokeColor??i.fontColor;if(!this.setAnnotationDefaultAppearance(r,i.fontFamily===o.l.Unknown?o.l.Helvetica:i.fontFamily,i.fontSize,a)||(i.strokeColor&&i.strokeColor!==i.fontColor&&this.setAnnotationColor(r,i.fontColor,o.j.TextColor),i.intent&&!this.setAnnotIntent(r,i.intent))||i.calloutLine&&i.calloutLine.length>=2&&!this.setCalloutLine(e,t,r,i.calloutLine)||void 0!==i.lineEnding&&!this.setLineEndings(r,o.m.None,i.lineEnding))return!1;let l=i.color??i.backgroundColor;if(l&&"transparent"!==l){if(!this.setAnnotationColor(r,l??"#FFFFFF",o.j.Color))return!1}else if(!this.pdfiumModule.EPDFAnnot_ClearColor(r,o.j.Color))return!1;return this.setRectangleDifferences(r,i.rectangleDifferences),this.applyBaseAnnotationProperties(e,t,n,r,i)}addTextFieldContent(e,t,n){if(!this.setAnnotationDefaultAppearance(t,n.fontFamily,n.fontSize,n.fontColor)||!this.setBorderStyle(t,o.k.SOLID,n.strokeWidth??1))return!1;n.strokeColor&&"transparent"!==n.strokeColor?this.setMKColor(t,0,n.strokeColor):this.clearMKColor(t,0),n.color&&"transparent"!==n.color?this.setMKColor(t,1,n.color):this.clearMKColor(t,1);let r=n.field.flag??o.n.NONE;this.pdfiumModule.FPDFAnnot_SetFormFieldFlags(e,t,r),n.field.name&&this.withWString(n.field.name,n=>this.pdfiumModule.EPDFAnnot_SetFormFieldName(e,t,n)),this.withWString(n.field.value??"",n=>this.pdfiumModule.EPDFAnnot_SetFormFieldValue(e,t,n));let i=n.field;return null!=i.maxLen&&i.maxLen>0&&this.pdfiumModule.EPDFAnnot_SetNumberValue(t,"MaxLen",i.maxLen),!0}addToggleFieldContent(e,t,n){if(!this.setBorderStyle(t,o.k.SOLID,n.strokeWidth??1))return!1;n.strokeColor&&"transparent"!==n.strokeColor?this.setMKColor(t,0,n.strokeColor):this.clearMKColor(t,0),n.color&&"transparent"!==n.color?this.setMKColor(t,1,n.color):this.clearMKColor(t,1);let r=n.field.flag??o.n.NONE;return n.field.type===o.f.RADIOBUTTON&&(r|=o.n.BUTTON_RADIO|o.n.BUTTON_NOTOGGLETOOFF),this.pdfiumModule.FPDFAnnot_SetFormField
1Flags(e,t,r),n.field.name&&this.withWString(n.field.name,n=>this.pdfiumModule.EPDFAnnot_SetFormFieldName(e,t,n)),!0}addChoiceFieldContent(e,t,n){if(!this.setAnnotationDefaultAppearance(t,n.fontFamily,n.fontSize,n.fontColor)||!this.setBorderStyle(t,o.k.SOLID,n.strokeWidth??1))return!1;n.strokeColor&&"transparent"!==n.strokeColor?this.setMKColor(t,0,n.strokeColor):this.clearMKColor(t,0),n.color&&"transparent"!==n.color?this.setMKColor(t,1,n.color):this.clearMKColor(t,1);let r=n.field.flag??o.n.NONE;n.field.type===o.f.COMBOBOX&&(r|=131072),this.pdfiumModule.FPDFAnnot_SetFormFieldFlags(e,t,r),n.field.name&&this.withWString(n.field.name,n=>this.pdfiumModule.EPDFAnnot_SetFormFieldName(e,t,n));let i=n.field.options??[];if(i.length>0){let n=this.memoryManager.malloc(4*i.length),r=[];try{for(let e=0;e<i.length;e++){let t=i[e].label,o=2*(t.length+1),a=this.memoryManager.malloc(o);this.pdfiumModule.pdfium.stringToUTF16(t,a,o),r.push(a),this.pdfiumModule.pdfium.setValue(n+4*e,a,"*")}this.pdfiumModule.EPDFAnnot_SetFormFieldOptions(e,t,n,i.length)}finally{for(let e of r)this.memoryManager.free(P(e));this.memoryManager.free(n)}}let a=i.find(e=>e.isSelected),l=(null==a?void 0:a.label)??n.field.value??"";return this.withWString(l,n=>this.pdfiumModule.EPDFAnnot_SetFormFieldValue(e,t,n)),!0}setMKColor(e,t,n){let{red:r,green:i,blue:a}=(0,o.w)(n);return this.pdfiumModule.EPDFAnnot_SetMKColor(e,t,255&r,255&i,255&a)}clearMKColor(e,t){return this.pdfiumModule.EPDFAnnot_ClearMKColor(e,t)}getMKColor(e,t){let n=this.memoryManager.malloc(4),r=this.memoryManager.malloc(4),i=this.memoryManager.malloc(4);try{if(!this.pdfiumModule.EPDFAnnot_GetMKColor(e,t,n,r,i))return;let a=255&this.pdfiumModule.pdfium.getValue(n,"i32"),l=255&this.pdfiumModule.pdfium.getValue(r,"i32"),s=255&this.pdfiumModule.pdfium.getValue(i,"i32");return(0,o.o)({red:a,green:l,blue:s})}finally{this.memoryManager.free(i),this.memoryManager.free(r),this.memoryManager.free(n)}}addInkStroke(e,t,n,r,i){if(!this.setBorderStyle(r,o.k.SOLID,i.strokeWidth)||!this.setInkList(e,t,r,i.inkList)||!this.setAnnotationOpacity(r,i.opacity??1))return!1;let a=i.strokeColor??i.color??"#FFFF00";return!!this.setAnnotationColor(r,a,o.j.Color)&&this.applyBaseAnnotationProperties(e,t,n,r,i)}addLineContent(e,t,n,r,i){var a,l;if(!this.setLinePoints(e,t,r,i.linePoints.start,i.linePoints.end)||!this.setLineEndings(r,(null==(a=i.lineEndings)?void 0:a.start)??o.m.None,(null==(l=i.lineEndings)?void 0:l.end)??o.m.None)||!this.setBorderStyle(r,i.strokeStyle,i.strokeWidth)||!this.setBorderDashPattern(r,i.strokeDashArray??[])||i.intent&&!this.setAnnotIntent(r,i.intent))return!1;if(i.color&&"transparent"!==i.color){if(!this.setAnnotationColor(r,i.color??"#FFFF00",o.j.InteriorColor))return!1}else if(!this.pdfiumModule.EPDFAnnot_ClearColor(r,o.j.InteriorColor))return!1;return!!this.setAnnotationOpacity(r,i.opacity??1)&&!!this.setAnnotationColor(r,i.strokeColor??"#FFFF00",o.j.Color)&&this.applyBaseAnnotationProperties(e,t,n,r,i)}addPolyContent(e,t,n,r,i){var a,l;if(i.type===o.c.POLYLINE&&!this.setLineEndings(r,(null==(a=i.lineEndings)?void 0:a.start)??o.m.None,(null==(l=i.lineEndings)?void 0:l.end)??o.m.None)||!this.setPdfAnnoVertices(e,t,r,i.vertices)||!this.setBorderStyle(r,i.strokeStyle,i.strokeWidth)||!this.setBorderDashPattern(r,i.strokeDashArray??[])||i.intent&&!this.setAnnotIntent(r,i.intent))return!1;if(i.color&&"transparent"!==i.color){if(!this.setAnnotationColor(r,i.color??"#FFFF00",o.j.InteriorColor))return!1}else if(!this.pdfiumModule.EPDFAnnot_ClearColor(r,o.j.InteriorColor))return!1;return!!this.setAnnotationOpacity(r,i.opacity??1)&&!!this.setAnnotationColor(r,i.strokeColor??"#FFFF00",o.j.Color)&&(i.type===o.c.POLYGON&&(this.setRectangleDifferences(r,i.rectangleDifferences),this.setBorderEffect(r,i.cloudyBorderIntensity)),this.applyBaseAnnotationProperties(e,t,n,r,i))}addLinkContent(e,t,n,r,i,a){let l=a.strokeStyle??o.k.UNDERLINE,s=a.strokeWidth??2;return!!this.setBorderStyle(i,l,s)&&!(a.strokeDashArray&&!this.setBorderDashPattern(i,a.strokeDashArray))&&!(a.strokeColor&&!this.setAnnotationColor(i,a.strokeColor,o.j.Color))&&!(a.target&&!this.applyLinkTarget(n,i,a.target))&&this.applyBaseAnnotationProperties(e,t,r,i,a)}addShapeContent(e,t,n,r,i){if(!this.setBorderStyle(r,i.strokeStyle,i.strokeWidth)||
1!this.setBorderDashPattern(r,i.strokeDashArray??[]))return!1;if(i.color&&"transparent"!==i.color){if(!this.setAnnotationColor(r,i.color??"#FFFF00",o.j.InteriorColor))return!1}else if(!this.pdfiumModule.EPDFAnnot_ClearColor(r,o.j.InteriorColor))return!1;return!!this.setAnnotationOpacity(r,i.opacity??1)&&!!this.setAnnotationColor(r,i.strokeColor??"#FFFF00",o.j.Color)&&(this.setRectangleDifferences(r,i.rectangleDifferences),this.setBorderEffect(r,i.cloudyBorderIntensity),this.applyBaseAnnotationProperties(e,t,n,r,i))}addTextMarkupContent(e,t,n,r,i){if(!this.syncQuadPointsAnno(e,t,r,i.segmentRects)||!this.setAnnotationOpacity(r,i.opacity??1))return!1;let a=i.strokeColor??i.color??"#FFFF00";return!!this.setAnnotationColor(r,a,o.j.Color)&&this.applyBaseAnnotationProperties(e,t,n,r,i)}addRedactContent(e,t,n,r,i){if(!this.syncQuadPointsAnno(e,t,r,i.segmentRects)||!this.setAnnotationOpacity(r,i.opacity??1))return!1;if(i.color&&"transparent"!==i.color){if(!this.setAnnotationColor(r,i.color,o.j.InteriorColor))return!1}else if(!this.pdfiumModule.EPDFAnnot_ClearColor(r,o.j.InteriorColor))return!1;if(i.overlayColor&&"transparent"!==i.overlayColor){if(!this.setAnnotationColor(r,i.overlayColor,o.j.OverlayColor))return!1}else if(!this.pdfiumModule.EPDFAnnot_ClearColor(r,o.j.OverlayColor))return!1;if(i.strokeColor&&"transparent"!==i.strokeColor){if(!this.setAnnotationColor(r,i.strokeColor,o.j.Color))return!1}else if(!this.pdfiumModule.EPDFAnnot_ClearColor(r,o.j.Color))return!1;if(!this.setOverlayText(r,i.overlayText)||void 0!==i.overlayTextRepeat&&!this.setOverlayTextRepeat(r,i.overlayTextRepeat))return!1;if(void 0!==i.fontFamily||void 0!==i.fontSize){let e=null==i.fontFamily||i.fontFamily===o.l.Unknown?o.l.Helvetica:i.fontFamily;
1if(!this.setAnnotationDefaultAppearance(r,e,i.fontSize??12,i.fontColor??"#000000"))return!1}return!(void 0!==i.textAlign&&!this.setAnnotationTextAlignment(r,i.textAlign))&&this.applyBaseAnnotationProperties(e,t,n,r,i)}addStampContent(e,t,n,r,i,a,l){let s=a.name??a.icon;if(s&&!this.setAnnotationName(i,s))return!1;if(l&&"data"in l&&l.data){let s=(0,o.q)(l.data);if(!s)return!1;if("application/pdf"===s.mimeType){if(!this.setAppearanceFromPdf(t,i,l.data))return!1}else{for(let e=this.pdfiumModule.FPDFAnnot_GetObjectCount(i)-1;e>=0;e--)this.pdfiumModule.FPDFAnnot_RemoveObject(i,e);if("image/png"===s.mimeType){if(!this.addPngImageObject(e,t,n,r,i,a.rect,l.data))return!1}else if("image/jpeg"===s.mimeType&&!this.addJpegImageObject(e,t,n,r,i,a.rect,l.data))return!1}}else if(l&&"imageData"in l&&l.imageData){for(let e=this.pdfiumModule.FPDFAnnot_GetObjectCount(i)-1;e>=0;e--)this.pdfiumModule.FPDFAnnot_RemoveObject(i,e);if(!this.addImageObject(e,t,n,r,i,a.rect,l.imageData))return!1}else if(l&&"appearance"in l&&l.appearance&&!this.setAppearanceFromPdf(t,i,l.appearance))return!1;return!!this.applyBaseAnnotationProperties(e,n,r,i,a)&&!!this.pdfiumModule.EPDFAnnot_UpdateAppearanceToRect(i,o.r.Cover)}setAppearanceFromPdf(e,t,n){let r=new Uint8Array(n),o=this.memoryManager.malloc(r.byteLength);this.pdfiumModule.pdfium.HEAPU8.set(r,o);let i=this.pdfiumModule.FPDF_LoadMemDocument(o,r.byteLength,"");if(!i)return this.memoryManager.free(o),!1;let a=this.pdfiumModule.EPDFAnnot_SetAppearanceFromPage(t,i,0);return this.pdfiumModule.FPDF_CloseDocument(i),this.memoryManager.free(o),!!a}addImageObject(e,t,n,r,o,i,a){let l=a.width*a.height,s=this.memoryManager.malloc(4*l);if(!s)return!1;for(let e=0;e<l;e++){let t=a.data[4*e],n=a.data[4*e+1],r=a.data[4*e+2],o=a.data[4*e+3];this.pdfiumModule.pdfium.setValue(s+4*e,r,"i8"),this.pdfiumModule.pdfium.setValue(s+4*e+1,n,"i8"),this.pdfiumModule.pdfium.setValue(s+4*e+2,t,"i8"),this.pdfiumModule.pdfium.setValue(s+4*e+3,o,"i8")}let u=this.pdfiumModule.FPDFBitmap_CreateEx(a.width,a.height,4,s,0);if(!u)return this.memoryManager.free(s),!1;let m=this.pdfiumModule.FPDFPageObj_NewImageObj(t);if(!m)return this.pdfiumModule.FPDFBitmap_Destroy(u),this.memoryManager.free(s),!1;if(!this.pdfiumModule.FPDFImageObj_SetBitmap(r,0,m,u))return this.pdfiumModule.FPDFBitmap_Destroy(u),this.pdfiumModule.FPDFPageObj_Destroy(m),this.memoryManager.free(s),!1;let F=this.memoryManager.malloc(24);if(this.pdfiumModule.pdfium.setValue(F,i.size.width,"float"),this.pdfiumModule.pdfium.setValue(F+4,0,"float"),this.pdfiumModule.pdfium.setValue(F+8,0,"float"),this.pdfiumModule.pdfium.setValue(F+12,i.size.height,"float"),this.pdfiumModule.pdfium.setValue(F+16,0,"float"),this.pdfiumModule.pdfium.setValue(F+20,0,"float"),!this.pdfiumModule.FPDFPageObj_SetMatrix(m,F))return this.memoryManager.free(F),this.pdfiumModule.FPDFBitmap_Destroy(u),this.pdfiumModule.FPDFPageObj_Destroy(m),this.memoryManager.free(s),!1;this.memoryManager.free(F);let d=this.convertDevicePointToPagePoint(e,n,{x:i.origin.x,y:i.origin.y+i.size.height});return this.pdfiumModule.FPDFPageObj_Transform(m,1,0,0,1,d.x,d.y),this.pdfiumModule.FPDFAnnot_AppendObject(o,m)?(this.pdfiumModule.FPDFBitmap_Destroy(u),this.memoryManager.free(s),!0):(this.pdfiumModule.FPDFBitmap_Destroy(u),this.pdfiumModule.FPDFPageObj_Destroy(m),this.memoryManager.free(s),!1)}addPngImageObject(e,t,n,r,o,i,a){let l=this.pdfiumModule.FPDFPageObj_NewImageObj(t);if(!l)return!1;let s=new Uint8Array(a),u=this.memoryManager.malloc(s.byteLength);if(!u)return this.pdfiumModule.FPDFPageObj_Destroy(l),!1;if(this.pdfiumModule.pdfium.HEAPU8.set(s,u),!this.pdfiumModule.EPDFImageObj_SetPng(r,0,l,u,s.byteLength))return this.memoryManager.free(u),this.pdfiumModule.FPDFPageObj_Destroy(l),!1;this.memoryManager.free(u);let m=this.memoryManager.malloc(24);if(this.pdfiumModule.pdfium.setValue(m,i.size.width,"float"),this.pdfiumModule.pdfium.setValue(m+4,0,"float"),this.pdfiumModule.pdfium.setValue(m+8,0,"float"),this.pdfiumModule.pdfium.setValue(m+12,i.size.height,"float"),this.pdfiumModule.pdfium.setValue(m+16,0,"float"),this.pdfiumModule.pdfium.setValue(m+20,0,"float"),!this.pdfiumModule.FPDFPageObj_SetMatr
1ix(l,m))return this.memoryManager.free(m),this.pdfiumModule.FPDFPageObj_Destroy(l),!1;this.memoryManager.free(m);let F=this.convertDevicePointToPagePoint(e,n,{x:i.origin.x,y:i.origin.y+i.size.height});return this.pdfiumModule.FPDFPageObj_Transform(l,1,0,0,1,F.x,F.y),!!this.pdfiumModule.FPDFAnnot_AppendObject(o,l)||(this.pdfiumModule.FPDFPageObj_Destroy(l),!1)}addJpegImageObject(e,t,n,r,o,i,a){let l=this.pdfiumModule.FPDFPageObj_NewImageObj(t);if(!l)return!1;let s=new Uint8Array(a),u=this.memoryManager.malloc(s.byteLength);if(!u)return this.pdfiumModule.FPDFPageObj_Destroy(l),!1;if(this.pdfiumModule.pdfium.HEAPU8.set(s,u),!this.pdfiumModule.EPDFImageObj_SetJpeg(r,0,l,u,s.byteLength))return this.memoryManager.free(u),this.pdfiumModule.FPDFPageObj_Destroy(l),!1;this.memoryManager.free(u);let m=this.memoryManager.malloc(24);if(this.pdfiumModule.pdfium.setValue(m,i.size.width,"float"),this.pdfiumModule.pdfium.setValue(m+4,0,"float"),this.pdfiumModule.pdfium.setValue(m+8,0,"float"),this.pdfiumModule.pdfium.setValue(m+12,i.size.height,"float"),this.pdfiumModule.pdfium.setValue(m+16,0,"float"),this.pdfiumModule.pdfium.setValue(m+20,0,"float"),!this.pdfiumModule.FPDFPageObj_SetMatrix(l,m))return this.memoryManager.free(m),this.pdfiumModule.FPDFPageObj_Destroy(l),!1;this.memoryManager.free(m);let F=this.convertDevicePointToPagePoint(e,n,{x:i.origin.x,y:i.origin.y+i.size.height});return this.pdfiumModule.FPDFPageObj_Transform(l,1,0,0,1,F.x,F.y),!!this.pdfiumModule.FPDFAnnot_AppendObject(o,l)||(this.pdfiumModule.FPDFPageObj_Destroy(l),!1)}saveDocument(e){let t=this.pdfiumModule.PDFiumExt_OpenFileWriter();this.pdfiumModule.PDFiumExt_SaveAsCopy(e,t);let n=this.pdfiumModule.PDFiumExt_GetFileWriterSize(t),r=this.memoryManager.malloc(n);this.pdfiumModule.PDFiumExt_GetFileWriterData(t,r,n);let o=new ArrayBuffer(n),i=new DataView(o);for(let e=0;e<n;e++)i.setInt8(e,this.pdfiumModule.pdfium.getValue(r+e,"i8"));return this.memoryManager.free(r),this.pdfiumModule.PDFiumExt_CloseFileWriter(t),o}readCatalogLanguage(e){let t=this.pdfiumModule.EPDFCatalog_GetLanguage(e,0,0)>>>0;return 0===t?null:2===t?"":m(this.pdfiumModule.pdfium,(t,n)=>this.pdfiumModule.EPDFCatalog_GetLanguage(e,t,n),this.pdfiumModule.pdfium.UTF16ToString,t)}readMetaText(e,t){if(!this.pdfiumModule.EPDF_HasMetaText(e,t))return null;let n=this.pdfiumModule.FPDF_GetMetaText(e,t,0,0);return 2===n?"":m(this.pdfiumModule.pdfium,(n,r)=>this.pdfiumModule.FPDF_GetMetaText(e,t,n,r),this.pdfiumModule.pdfium.UTF16ToString,n)}setMetaText(e,t,n){if(null==n||0===n.length)return!!this.pdfiumModule.EPDF_SetMetaText(e,t,0);let r=2*(n.length+1),o=this.memoryManager.malloc(r);try{return this.pdfiumModule.pdfium.stringToUTF16(n,o,r),!!this.pdfiumModule.EPDF_SetMetaText(e,t,o)}finally{this.memoryManager.free(o)}}getMetaTrapped(e){let t=Number(this.pdfiumModule.EPDF_GetMetaTrapped(e));switch(t){case o.t.NotSet:case o.t.True:case o.t.False:case o.t.Unknown:return t;default:return o.t.Unknown}}setMetaTrapped(e,t){let n=null==t||void 0===t?o.t.NotSet:t;return(n===o.t.NotSet||n===o.t.True||n===o.t.False||n===o.t.Unknown)&&!!this.pdfiumModule.EPDF_SetMetaTrapped(e,n)}getMetaKeyCount(e,t){return 0|Number(this.pdfiumModule.EPDF_GetMetaKeyCount(e,t))}getMetaKeyName(e,t,n){let r=this.pdfiumModule.EPDF_GetMetaKeyName(e,t,n,0,0);return r?m(this.pdfiumModule.pdfium,(r,o)=>this.pdfiumModule.EPDF_GetMetaKeyName(e,t,n,r,o),this.pdfiumModule.pdfium.UTF8ToString,r):null}readAllMeta(e,t=!0){let n=this.getMetaKeyCount(e,t),r={};for(let o=0;o<n;o++){let n=this.getMetaKeyName(e,o,t);n&&(r[n]=this.readMetaText(e,n))}return r}readPdfBookmarks(e,t=0){let n=this.pdfiumModule.FPDFBookmark_GetFirstChild(e,t),r=[];for(;n;){let t=this.readPdfBookmark(e,n);r.push(t),n=this.pdfiumModule.FPDFBookmark_GetNextSibling(e,n)}return r}readPdfBookmark(e,t){let n=m(this.pdfiumModule.pdfium,(e,n)=>this.pdfiumModule.FPDFBookmark_GetTitle(t,e,n),this.pdfiumModule.pdfium.UTF16ToString),r=this.readPdfBookmarks(e,t);return{title:n,target:this.readPdfBookmarkTarget(e,()=>this.pdfiumModule.FPDFBookmark_GetAction(t),()=>this.pdfiumModule.FPDFBookmark_GetDest(e,t)),children:r}}readPageTextRects(e,t,n,r){let o=this.pdfiumModule.FPDFText_CountRects(r,0,-1),i=[];for(let t=0;t<o;t++){let o=this.memoryManager.malloc(8),a=this.memoryManager.malloc(8),l=this.memoryManager.malloc(8),s=this.memoryManager.malloc(8);if(!this.pdfiumModule.FPDFText_GetRect(r,t,a,o,l,s)){this.memoryManager.free(a),this.memoryManager.free(o),this.memoryManager.free(l),this.memoryManager.free(s);continue}let u=this.pdfiumModule.pdfium.getValue(a,"double"),m=this.pdfiumModule.pdfium.getValue(o,"double"),F=this.pdfiumModule.pdfium.getValue(l,"double"),d=this.pdfiumModule.pdfium.getValue(s,"double");this.memoryManager.free(a),this.memoryManager.free(o),this.memoryManager.free(l),this.memoryManager.free(s);let P=this.memoryManager.malloc(4),_=this.memoryManager.malloc(4);this.pdfiumModule.FPDF_PageToDevice(n,0,0,e.size.width,e.size.height,0,u,m,P,_);let g=this.pdfiumModule.pdfium.getValue(P,"i32"),c=this.pdfiumModule.pdfium.getValue(_,"i32");this.memoryManager.free(P),this.memoryManager.free(_);let h={origin:{x:g,y:c}
1,size:{width:Math.ceil(Math.abs(F-u)),height:Math.ceil(Math.abs(m-d))}},D=this.pdfiumModule.FPDFText_GetBoundedText(r,u,m,F,d,0,0),p=2*(D+1),f=this.memoryManager.malloc(p);this.pdfiumModule.FPDFText_GetBoundedText(r,u,m,F,d,f,D);let b=this.pdfiumModule.pdfium.UTF16ToString(f);this.memoryManager.free(f);let A=this.pdfiumModule.FPDFText_GetCharIndexAtPos(r,u,m,2,2),E="",M=h.size.height;if(A>=0){M=this.pdfiumModule.FPDFText_GetFontSize(r,A);let e=this.pdfiumModule.FPDFText_GetFontInfo(r,A,0,0,0)+1,t=this.memoryManager.malloc(e),n=this.memoryManager.malloc(4);this.pdfiumModule.FPDFText_GetFontInfo(r,A,t,e,n),E=this.pdfiumModule.pdfium.UTF8ToString(t),this.memoryManager.free(t),this.memoryManager.free(n)}let y={content:b,rect:h,font:{family:E,size:M}};i.push(y)}return i}getPageGeometry(e,t){let n="getPageGeometry";this.logger.perf(G,S,n,"Begin",e.id);let r=this.cache.getContext(e.id);if(!r)return this.logger.perf(G,S,n,"End",e.id),o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let i=r.acquirePage(t.index),a=i.getTextPage(),l=this.pdfiumModule.FPDFText_CountChars(a),s=[];for(let e=0;e<l;e++){let n=this.readGlyphInfo(t,i.pagePtr,a,e);s.push(n)}let u=this.buildRunsFromGlyphs(s,a);return i.release(),this.logger.perf(G,S,n,"End",e.id),o.a.resolve({runs:u})}buildRunsFromGlyphs(e,t){let n=[],r=null,o=null,i=null;for(let a=0;a<e.length;a++){let l=e[a],s=this.pdfiumModule.FPDFText_GetTextObject(t,a);if(s!==o&&(o=s,r={rect:{x:l.origin.x,y:l.origin.y,width:l.size.width,height:l.size.height},charStart:a,glyphs:[],fontSize:this.pdfiumModule.FPDFText_GetFontSize(t,a)},i={minX:l.origin.x,minY:l.origin.y,maxX:l.origin.x+l.size.width,maxY:l.origin.y+l.size.height},n.push(r)),r.glyphs.push({x:l.origin.x,y:l.origin.y,width:l.size.width,height:l.size.height,flags:l.isEmpty?2:+!!l.isSpace,...l.tightOrigin&&{tightX:l.tightOrigin.x,tightY:l.tightOrigin.y},...l.tightSize&&{tightWidth:l.tightSize.width,tightHeight:l.tightSize.height}}),l.isEmpty)continue;let u=l.origin.x+l.size.width,m=l.origin.y+l.size.height;i.minX=Math.min(i.minX,l.origin.x),i.minY=Math.min(i.minY,l.origin.y),i.maxX=Math.max(i.maxX,u),i.maxY=Math.max(i.maxY,m),r.rect.x=i.minX,r.rect.y=i.minY,r.rect.width=i.maxX-i.minX,r.rect.height=i.maxY-i.minY}return n}getPageTextRuns(e,t){let n="getPageTextRuns";this.logger.perf(G,S,n,"Begin",e.id);let r=this.cache.getContext(e.id);if(!r)return this.logger.perf(G,S,n,"End",e.id),o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let i=r.acquirePage(t.index),a=i.getTextPage(),l=this.pdfiumModule.FPDFText_CountChars(a),s=[],u=0,m=null,F=null,d=0,P=null,_=null,g=e=>{if(null===m||null===F||null===P||null===_)return;let t=e-u;if(t<=0)return;let n=this.memoryManager.malloc(2*(t+1));this.pdfiumModule.FPDFText_GetText(a,u,t,n);let r=(0,o.h)(this.pdfiumModule.pdfium.UTF16ToString(n));this.memoryManager.free(n),s.push({text:r,rect:{origin:{x:_.minX,y:_.minY},size:{width:Math.max(1,_.maxX-_.minX),height:Math.max(1,_.maxY-_.minY)}},font:F,fontSize:d,color:P,charIndex:u,charCount:t})},c=this.memoryManager.malloc(4),h=this.memoryManager.malloc(4),D=this.memoryManager.malloc(4),p=this.memoryManager.malloc(4),f=this.memoryManager.malloc(16),b=this.memoryManager.malloc(4),A=this.memoryManager.malloc(4),E=this.memoryManager.malloc(4),M=this.memoryManager.malloc(4),y=this.memoryManager.malloc(4);for(let e=0;e<l;e++){let n=this.pdfiumModule.FPDFText_GetUnicode(a,e);if(65534===n||65533===n)continue;let r=this.pdfiumModule.FPDFText_GetTextObject(a,e);if(0===r)continue;let o=this.pdfiumModule.FPDFText_GetFontSize(a,e);this.pdfiumModule.FPDFText_GetFillColor(a,e,c,h,D,p);let l=255&this.pdfiumModule.pdfium.getValue(c,"i32"),s=255&this.pdfiumModule.pdfium.getValue(h,"i32"),G=255&this.pdfiumModule.pdfium.getValue(D,"i32"),S=255&this.pdfiumModule.pdfium.getValue(p,"i32"),C=this.readFontInfoFromTextObject(r,y);if((null===m||r!==m||C.name!==F.name||Math.abs(o-d)>.01||l!==P.red||s!==P.green||G!==P.blue)&&(g(e),m=r,F=C,d=o,P={red:l,green:s,blue:G,alpha:S},u=e,_=null),this.pdfiumModule.FPDFText_GetLooseCharBox(a,e,f)){let e=this.pdfiumModule.pdfium.getValue(f,"float"),n=this.pdfiumModule.pdfium.getValue(f+4,"float"),r=this.pdfiumModule.pdfium.getValue(f+8,"float"),o=this.pdfiumModule.pdfium.getValue(f+12,"float");
1if(e!==r&&n!==o){this.pdfiumModule.FPDF_PageToDevice(i.pagePtr,0,0,t.size.width,t.size.height,0,e,n,b,A),this.pdfiumModule.FPDF_PageToDevice(i.pagePtr,0,0,t.size.width,t.size.height,0,r,o,E,M);let a=this.pdfiumModule.pdfium.getValue(b,"i32"),l=this.pdfiumModule.pdfium.getValue(A,"i32"),s=this.pdfiumModule.pdfium.getValue(E,"i32"),u=this.pdfiumModule.pdfium.getValue(M,"i32"),m=Math.min(a,s),F=Math.min(l,u),d=Math.abs(s-a),P=Math.abs(u-l);null===_?_={minX:m,minY:F,maxX:m+d,maxY:F+P}:(_.minX=Math.min(_.minX,m),_.minY=Math.min(_.minY,F),_.maxX=Math.max(_.maxX,m+d),_.maxY=Math.max(_.maxY,F+P))}}}return g(l),[c,h,D,p,f,b,A,E,M,y].forEach(e=>this.memoryManager.free(e)),i.release(),this.logger.perf(G,S,n,"End",e.id),o.a.resolve({runs:s})}readFontInfoFromTextObject(e,t){let n=this.pdfiumModule.FPDFTextObj_GetFont(e),r="",o="",i=400,a=!1,l=!1,s=!1;if(n){let e=this.pdfiumModule.FPDFFont_GetBaseFontName(n,0,0);if(e>0){let t=this.memoryManager.malloc(e+1);this.pdfiumModule.FPDFFont_GetBaseFontName(n,t,e+1),r=this.pdfiumModule.pdfium.UTF8ToString(t),this.memoryManager.free(t)}let u=this.pdfiumModule.FPDFFont_GetFamilyName(n,0,0);if(u>0){let e=this.memoryManager.malloc(u+1);this.pdfiumModule.FPDFFont_GetFamilyName(n,e,u+1),o=this.pdfiumModule.pdfium.UTF8ToString(e),this.memoryManager.free(e)}i=this.pdfiumModule.FPDFFont_GetWeight(n),s=0!==this.pdfiumModule.FPDFFont_GetIsEmbedded(n),this.pdfiumModule.FPDFFont_GetItalicAngle(n,t)&&(a=0!==this.pdfiumModule.pdfium.getValue(t,"i32")),l=!!(1&this.pdfiumModule.FPDFFont_GetFlags(n))}return{name:r,familyName:o,weight:i,italic:a,monospaced:l,embedded:s}}readGlyphInfo(e,t,n,r){let o=this.memoryManager.malloc(4),i=this.memoryManager.malloc(4),a=this.memoryManager.malloc(4),l=this.memoryManager.malloc(4),s=this.memoryManager.malloc(16),u=this.memoryManager.malloc(8),m=this.memoryManager.malloc(8),F=this.memoryManager.malloc(8),d=this.memoryManager.malloc(8),P=[s,o,i,a,l,u,m,F,d],_,g,c=0,h=0,D=0,p=0,f=!1;if(this.pdfiumModule.FPDFText_GetLooseCharBox(n,r,s)){let b=this.pdfiumModule.pdfium.getValue(s,"float"),A=this.pdfiumModule.pdfium.getValue(s+4,"float"),E=this.pdfiumModule.pdfium.getValue(s+8,"float"),M=this.pdfiumModule.pdfium.getValue(s+12,"float");if(b===E||A===M)return P.forEach(e=>this.memoryManager.free(e)),{origin:{x:0,y:0},size:{width:0,height:0},isEmpty:!0};this.pdfiumModule.FPDF_PageToDevice(t,0,0,e.size.width,e.size.height,0,b,A,o,i),this.pdfiumModule.FPDF_PageToDevice(t,0,0,e.size.width,e.size.height,0,E,M,a,l);let y=this.pdfiumModule.pdfium.getValue(o,"i32"),G=this.pdfiumModule.pdfium.getValue(i,"i32"),S=this.pdfiumModule.pdfium.getValue(a,"i32"),C=this.pdfiumModule.pdfium.getValue(l,"i32");if(c=Math.min(y,S),h=Math.min(G,C),D=Math.max(1,Math.abs(S-y)),p=Math.max(1,Math.abs(C-G)),this.pdfiumModule.FPDFText_GetCharBox(n,r,u,m,F,d)){let n=this.pdfiumModule.pdfium.getValue(u,"double"),r=this.pdfiumModule.pdfium.getValue(m,"double"),s=this.pdfiumModule.pdfium.getValue(F,"double"),P=this.pdfiumModule.pdfium.getValue(d,"double");this.pdfiumModule.FPDF_PageToDevice(t,0,0,e.size.width,e.size.height,0,n,P,o,i),this.pdfiumModule.FPDF_PageToDevice(t,0,0,e.size.width,e.size.height,0,r,s,a,l);let c=this.pdfiumModule.pdfium.getValue(o,"i32"),h=this.pdfiumModule.pdfium.getValue(i,"i32"),D=this.pdfiumModule.pdfium.getValue(a,"i32"),p=this.pdfiumModule.pdfium.getValue(l,"i32");_={x:Math.min(c,D),y:Math.min(h,p)},g={width:Math.max(1,Math.abs(D-c)),height:Math.max(1,Math.abs(p-h))}}f=32===this.pdfiumModule.FPDFText_GetUnicode(n,r)}return P.forEach(e=>this.memoryManager.free(e)),{origin:{x:c,y:h},size:{width:D,height:p},..._&&{tightOrigin:_},...g&&{tightSize:g},...f&&{isSpace:f}}}getPageGlyphs(e,t){this.logger.debug(G,S,"getPageGlyphs",e,t),this.logger.perf(G,S,"getPageGlyphs","Begin",e.id);let n=this.cache.getContext(e.id);if(!n)return this.logger.perf(G,S,"getPageGlyphs","End",e.id),o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let r=n.acquirePage(t.index),i=r.getTextPage(),a=this.pdfiumModule.FPDFText_CountChars(i),l=Array(a);for(let e=0;e<a;e++){let n=this.readGlyphInfo(t,r.pagePtr,i,e);n.isEmpty||(l[e]={...n})}return r.release(),this.logger.perf(G,S,"getPageGlyphs","End",e.id),o.a.resolve(l)}readCharBox(e,t,n,r){let o=this.memoryManager.malloc(8),i=this.memoryManager.malloc(8),a=this.memoryManager.malloc(8),l=this.memoryManager.malloc(8),s=0,u=0,m=0,F=0;if(this.pdfiumModule.FPDFText_GetCharBox(n,r,i,l,a,o)){let n=this.pdfiumModule.pdfium.getValue(o,"double"),r=this.pdfiumModule.pdfium.getValue(i,"double"),d=this.pdfiumModule.pdfium.getValue(a,"double"),P=this.pdfiumModule.pdfium.getValue(l,"double"),_=this.memoryManager.malloc(4),g=this.memoryManager.malloc(4);this.pdfiumModule.FPDF_PageToDevice(t,0,0,e.size.width,e.size.height,0,r,n,_,g),s=this.pdfiumModule.pdfium.getValue(_,"i32"),u=this.pdfiumModule.pdfium.getValue(g,"i32"),this.memoryManager.free(_),this.memoryManager.free(g),m=Math.ceil(Math.abs(P-r)),F=Math.ceil(Math.abs(n-d))}return this.memoryManager.free(o),this.memoryManager.free(i),this.memoryManager.free(a),this.memoryManager.free(l),{origin:{x:s,y:u},size:{width:m,height:F}}}readPageAnnotations(e,t,n){return t.borrowPage(n.index,r=>r.withFormHandle(o=>{let i=this.pdfiumModule.FPDFPage_GetAnnotCount(r.pagePtr),a=[];for(let l=0;l<i;l++)r.withAnnotation(l,r=>{let i=this.readPageAnnotation(e,t.docPtr,n,r,o);i&&a.push(i)});return a}))}readPageAnnoWidgets(e,t,n){return t.borrowPage(n.index,t=>t.withFormHandle(r=>{let o=this.pdfiumModule.FPDFPage_GetAnnotCount(t.pagePtr),i=[];for(let a=0;a<o;a++)t.withAnnotation(a,t=>{let o=this.readPageAnnoWidget(e,n,t,r);o&&i.push(o)});return i}))}readPageAnnotationsRaw(e,t,n,r){let o=this.pdfiumModule.EPDFPage_GetAnnotCountRaw(t.docPtr,n.index);if(o<=0)return[];let i=[];for(let a=0;a<o;++a){let o=this.pdfiumModule.EPDFPage_GetAnnotRaw(t.docPtr,n.index,a);if(o)try{let a=this.readPageAnnotation(e,t.docPtr,n,o,r);a&&i.push(a)}finally{this.pdfiumModule.FPDFPage_CloseAnnot(o)}}return i}readPageAnnoWidget(e,t,n,r){let i=this.getAnnotString(n,"NM");if(i||(i=(0,o.u)(),this.setAnnotString(n,"NM",i)),this.pdfiumModule.FPDFAnnot_GetSubtype(n)===o.c.WIDGET)return this.readPdfWidgetAnno(e,t,n,r,i)}getPageAnnotationsRaw(e,t){this.logger.debug(G,S,"getPageAnnotationsRaw",e,t),this.logger.perf(G,S,"GetPageAnnotationsRaw","Begin",`${e.id}-${t.index}`);let n=this.cache.getContext(e.id);if(!n)return o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let r=this.pdfiumModule.PDFiumExt_OpenFormFillInfo(),i=this.pdfiumModule.PDFiumExt_InitFormFillEnvironment(n.docPtr,r);try{let r=this.readPageAnnotationsRaw(e,n,t,i);return this.logger.perf(G,S,"GetPageAnnotationsRaw","End",`${e.id}-${t.index}`),this.logger.debug(G,S,"getPageAnnotationsRaw",`${e.id}-${t.index}`,r),o.a.resolve(r)}finally{this.pdfiumModule.PDFiumExt_ExitFormFillEnvironment(i),this.pdfiumModule.PDFiumExt_CloseFormFillInfo(r)}}readPageAnnotation(e,t,n,r,i){let a,l=this.getAnnotString(r,"NM");l||(l=(0,o.u)(),this.setAnnotString(r,"NM",l));let s=this.pdfiumModule.FPDFAnnot_GetSubtype(r);switch(s){case o.c.TEXT:a=this.readPdfTextAnno(e,n,r,l);break;case o.c.FREETEXT:a=this.readPdfFreeTextAnno(e,n,r,l);break;case o.c.LINK:a=this.readPdfLinkAnno(e,n,t,r,l);break;case o.c.WIDGET:if(void 0!==i)return this.readPdfWidgetAnno(e,n,r,i,l);break;case o.c.FILEATTACHMENT:a=this.readPdfFileAttachmentAnno(e,n,r,l);break;case o.c.INK:a=this.readPdfInkAnno(e,n,r,l);break;case o.c.POLYGON:a=this.readPdfPolygonAnno(e,n,r,l);break;case o.c.POLYLINE:a=this.readPdfPolylineAnno(e,n,r,l);break;case o.c.LINE:a=this.readPdfLineAnno(e,n,r,l);break;case o.c.HIGHLIGHT:a=this.readPdfHighlightAnno(e,n,r,l);break;case o.c.STAMP:a=this.readPdfStampAnno(e,n,r,l);break;case o.c.SQUARE:a=this.readPdfSquareAnno(e,n,r,l);break;case o.c.CIRCLE:a=this.readPdfCircleAnno(e,n,r,l);break;case o.c.UNDERLINE:a=this.readPdfUnderlineAnno(e,n,r,l);break;case o.c.SQUIGGLY:a=this.readPdfSquigglyAnno(e,n,r,l);break;case o.c.STRIKEOUT:a=this.readPdfStrikeOutAnno(e,n,r,l);break;case o.c.CARET:a=this.readPdfCaretAnno(e,n,r,l);break;case o.c.REDACT:a=this.readPdfRedactAnno(e,n,r,l);break;default:a=this.readPdfAnno(e,n,s,r,l)}if(a){a=this.reverseRotateAnnotationOnLoad(a);let e=this.pdfiumModule.EPDFAnnot_GetAvailableAppearanceModes(r);e&&(a.appearanceModes=e)}return a}reverseRotateAnnotationOnLoad(e){let t=e.rotation,n=e.unrotatedRect;if(!t||0===t||!n)return e;let r={x:n.origin.x+n.size.width/2,y:n.origin.y+n.size.height/2};switch(e.type){case o.c.INK:{let n=e.inkList.map(e=>({points:e.points.map(e=>this.rotatePointForSave(e,r,-t))}));return{...e,inkList:n}}case o.c.LINE:return{...e,linePoints:{start:this.rotatePointForSave(e.linePoints.start,r,-t),end:this.rotatePointForSave(e.linePoints.end,r,-t)}};case o.c.POLYGON:return{...e,vertices:e.vertices.map(e=>this.rotatePointForSave(e,r,-t))};case o.c.POLYLINE:return{...e,vertices:e.vertices.map(e=>this.rotatePointForSave(e,r,-t))};default:return e}}
1readAnnotationColor(e,t=o.j.Color){let n,r=this.memoryManager.malloc(4),i=this.memoryManager.malloc(4),a=this.memoryManager.malloc(4);return this.pdfiumModule.EPDFAnnot_GetColor(e,t,r,i,a)&&(n={red:255&this.pdfiumModule.pdfium.getValue(r,"i32"),green:255&this.pdfiumModule.pdfium.getValue(i,"i32"),blue:255&this.pdfiumModule.pdfium.getValue(a,"i32")}),this.memoryManager.free(r),this.memoryManager.free(i),this.memoryManager.free(a),n}getAnnotationColor(e,t=o.j.Color){let n=this.readAnnotationColor(e,t);return n?(0,o.o)(n):void 0}setAnnotationColor(e,t,n=o.j.Color){let r=(0,o.w)(t);return this.pdfiumModule.EPDFAnnot_SetColor(e,n,255&r.red,255&r.green,255&r.blue)}getAnnotationOpacity(e){let t=this.memoryManager.malloc(4),n=this.pdfiumModule.EPDFAnnot_GetOpacity(e,t)?this.pdfiumModule.pdfium.getValue(t,"i32"):255;return this.memoryManager.free(t),(0,o.v)(n)}setAnnotationOpacity(e,t){let n=(0,o.O)(t);return this.pdfiumModule.EPDFAnnot_SetOpacity(e,255&n)}getAnnotationRotation(e){let t=this.memoryManager.malloc(4);if(!this.pdfiumModule.EPDFAnnot_GetRotate(e,t))return this.memoryManager.free(t),0;let n=this.pdfiumModule.pdfium.getValue(t,"float");return this.memoryManager.free(t),n}setAnnotationRotation(e,t){return!!this.pdfiumModule.EPDFAnnot_SetRotate(e,t)}getAnnotExtendedRotation(e){let t=this.memoryManager.malloc(4);if(!this.pdfiumModule.EPDFAnnot_GetExtendedRotation(e,t))return this.memoryManager.free(t),0;let n=this.pdfiumModule.pdfium.getValue(t,"float");return this.memoryManager.free(t),n}setAnnotExtendedRotation(e,t){return!!this.pdfiumModule.EPDFAnnot_SetExtendedRotation(e,t)}readAnnotUnrotatedRect(e){let t=this.memoryManager.malloc(16);if(!this.pdfiumModule.EPDFAnnot_GetUnrotatedRect(e,t))return this.memoryManager.free(t),null;let n=this.pdfiumModule.pdfium.getValue(t,"float"),r=this.pdfiumModule.pdfium.getValue(t+4,"float"),o=this.pdfiumModule.pdfium.getValue(t+8,"float"),i=this.pdfiumModule.pdfium.getValue(t+12,"float");return this.memoryManager.free(t),0===n&&0===r&&0===o&&0===i?null:{left:n,top:r,right:o,bottom:i}}setAnnotUnrotatedRect(e,t,n,r){let o=r.origin.x,i=r.origin.y,a=r.origin.x+r.size.width,l=r.origin.y+r.size.height,s=this.convertDevicePointToPagePoint(e,t,{x:o,y:i}),u=this.convertDevicePointToPagePoint(e,t,{x:a,y:i}),m=this.convertDevicePointToPagePoint(e,t,{x:a,y:l}),F=this.convertDevicePointToPagePoint(e,t,{x:o,y:l}),d=Math.min(s.x,u.x,m.x,F.x),P=Math.max(s.x,u.x,m.x,F.x),_=Math.min(s.y,u.y,m.y,F.y),g=Math.max(s.y,u.y,m.y,F.y);d>P&&([d,P]=[P,d]),_>g&&([_,g]=[g,_]);let c=this.memoryManager.malloc(16),h=this.pdfiumModule.pdfium;h.setValue(c+0,d,"float"),h.setValue(c+4,g,"float"),h.setValue(c+8,P,"float"),h.setValue(c+12,_,"float");let D=this.pdfiumModule.EPDFAnnot_SetUnrotatedRect(n,c);return this.memoryManager.free(c),!!D}getAnnotationTextAlignment(e){return this.pdfiumModule.EPDFAnnot_GetTextAlignment(e)}setAnnotationTextAlignment(e,t){return!!this.pdfiumModule.EPDFAnnot_SetTextAlignment(e,t)}getAnnotationVerticalAlignment(e){return this.pdfiumModule.EPDFAnnot_GetVerticalAlignment(e)}setAnnotationVerticalAlignment(e,t){return!!this.pdfiumModule.EPDFAnnot_SetVerticalAlignment(e,t)}getOverlayText(e){let t=this.pdfiumModule.EPDFAnnot_GetOverlayText(e,0,0);if(0===t)return;let n=2*(t+1),r=this.memoryManager.malloc(n);this.pdfiumModule.EPDFAnnot_GetOverlayText(e,r,n);let o=this.pdfiumModule.pdfium.UTF16ToString(r);return this.memoryManager.free(r),o||void 0}setOverlayText(e,t){return t?this.withWString(t,t=>this.pdfiumModule.EPDFAnnot_SetOverlayText(e,t)):this.pdfiumModule.EPDFAnnot_SetOverlayText(e,0)}getOverlayTextRepeat(e){return this.pdfiumModule.EPDFAnnot_GetOverlayTextRepeat(e)}setOverlayTextRepeat(e,t){return this.pdfiumModule.EPDFAnnot_SetOverlayTextRepeat(e,t)}getAnnotationDefaultAppearance(e){let t=this.memoryManager.malloc(4),n=this.memoryManager.malloc(4),r=this.memoryManager.malloc(4),i=this.memoryManager.malloc(4),a=this.memoryManager.malloc(4);if(!this.pdfiumModule.EPDFAnnot_GetDefaultAppearance(e,t,n,r,i,a))return void[t,n,r,i,a].forEach(e=>this.memoryManager.free(e));let l=this.pdfiumModule.pdfium,s=l.getValue(t,"i32"),u=l.getValue(n,"float"),m=255&l.getValue(r,"i32"),F=255&l.getValue(i,"i32"),d=255&l.getValue(a,"i32");
1return[t,n,r,i,a].forEach(e=>this.memoryManager.free(e)),{fontFamily:s,fontSize:u,fontColor:(0,o.o)({red:m,green:F,blue:d})}}setAnnotationDefaultAppearance(e,t,n,r){let{red:i,green:a,blue:l}=(0,o.w)(r);return!!this.pdfiumModule.EPDFAnnot_SetDefaultAppearance(e,t,n,255&i,255&a,255&l)}getBorderStyle(e){let t=this.memoryManager.malloc(4),n=0,r=o.k.UNKNOWN,i=!1;return r=this.pdfiumModule.EPDFAnnot_GetBorderStyle(e,t),n=this.pdfiumModule.pdfium.getValue(t,"float"),i=r!==o.k.UNKNOWN,this.memoryManager.free(t),{ok:i,style:r,width:n}}setBorderStyle(e,t,n){let r=t===o.k.CLOUDY?o.k.SOLID:t;return this.pdfiumModule.EPDFAnnot_SetBorderStyle(e,r,n)}getAnnotationName(e){return this.pdfiumModule.EPDFAnnot_GetName(e)}setAnnotationName(e,t){return this.pdfiumModule.EPDFAnnot_SetName(e,t)}getReplyType(e){return this.pdfiumModule.EPDFAnnot_GetReplyType(e)}setReplyType(e,t){return this.pdfiumModule.EPDFAnnot_SetReplyType(e,t??o.x.Unknown)}getBorderEffect(e){let t=this.memoryManager.malloc(4),n=!!this.pdfiumModule.EPDFAnnot_GetBorderEffect(e,t),r=n?this.pdfiumModule.pdfium.getValue(t,"float"):0;return this.memoryManager.free(t),{ok:n,intensity:r}}getRectangleDifferences(e){let t=this.memoryManager.malloc(4),n=this.memoryManager.malloc(4),r=this.memoryManager.malloc(4),o=this.memoryManager.malloc(4),i=!!this.pdfiumModule.EPDFAnnot_GetRectangleDifferences(e,t,n,r,o),a=this.pdfiumModule.pdfium,l=a.getValue(t,"float"),s=a.getValue(n,"float"),u=a.getValue(r,"float"),m=a.getValue(o,"float");return this.memoryManager.free(t),this.memoryManager.free(n),this.memoryManager.free(r),this.memoryManager.free(o),{ok:i,left:l,top:m,right:u,bottom:s}}setRectangleDifferences(e,t){return t?this.pdfiumModule.EPDFAnnot_SetRectangleDifferences(e,t.left,t.bottom,t.right,t.top):this.pdfiumModule.EPDFAnnot_ClearRectangleDifferences(e)}setBorderEffect(e,t){return void 0===t||t<=0?this.pdfiumModule.EPDFAnnot_ClearBorderEffect(e):this.pdfiumModule.EPDFAnnot_SetBorderEffect(e,t)}getAnnotationDate(e,t){let n=this.getAnnotString(e,t);return n?(0,o.p)(n):void 0}setAnnotationDate(e,t,n){let r=(0,o.y)(n);return this.setAnnotString(e,t,r)}getAttachmentDate(e,t){let n=this.getAttachmentString(e,t);return n?(0,o.p)(n):void 0}setAttachmentDate(e,t,n){let r=(0,o.y)(n);return this.setAttachmentString(e,t,r)}getBorderDashPattern(e){let t=this.pdfiumModule.EPDFAnnot_GetBorderDashPatternCount(e);if(0===t)return{ok:!1,pattern:[]};let n=this.memoryManager.malloc(4*t),r=!!this.pdfiumModule.EPDFAnnot_GetBorderDashPattern(e,n,t),o=[];if(r){let e=this.pdfiumModule.pdfium;for(let r=0;r<t;r++)o.push(e.getValue(n+4*r,"float"))}return this.memoryManager.free(n),{ok:r,pattern:o}}setBorderDashPattern(e,t){if(!t||0===t.length)return this.pdfiumModule.EPDFAnnot_SetBorderDashPattern(e,0,0);let n=t.map(e=>Number.isFinite(e)&&e>0?e:0).filter(e=>e>0);if(0===n.length)return this.pdfiumModule.EPDFAnnot_SetBorderDashPattern(e,0,0);let r=4*n.length,o=this.memoryManager.malloc(r);for(let e=0;e<n.length;e++)this.pdfiumModule.pdfium.setValue(o+4*e,n[e],"float");let i=!!this.pdfiumModule.EPDFAnnot_SetBorderDashPattern(e,o,n.length);return this.memoryManager.free(o),i}getLineEndings(e){let t=this.memoryManager.malloc(4),n=this.memoryManager.malloc(4);if(!this.pdfiumModule.EPDFAnnot_GetLineEndings(e,t,n))return this.memoryManager.free(t),void this.memoryManager.free(n);let r=this.pdfiumModule.pdfium.getValue(t,"i32"),o=this.pdfiumModule.pdfium.getValue(n,"i32");return this.memoryManager.free(t),this.memoryManager.free(n),{start:r,end:o}}setLineEndings(e,t,n){return!!this.pdfiumModule.EPDFAnnot_SetLineEndings(e,t,n)}getLinePoints(e,t,n){let r=this.memoryManager.malloc(8),o=this.memoryManager.malloc(8);if(!this.pdfiumModule.FPDFAnnot_GetLine(n,r,o))return this.memoryManager.free(r),void this.memoryManager.free(o);let i=this.pdfiumModule.pdfium,a=i.getValue(r+0,"float"),l=i.getValue(r+4,"float"),s=i.getValue(o+0,"float"),u=i.getValue(o+4,"float");return this.memoryManager.free(r),this.memoryManager.free(o),{start:this.convertPagePointToDevicePoint(e,t,{x:a,y:l}),end:this.convertPagePointToDevicePoint(e,t,{x:s,y:u})}}setLinePoints(e,t,n,r,o){let i=this.convertDevicePointToPagePoint(e,t,r),a=this.convertDevicePointToPagePoint(e,t,o);if(!i||!a)return!1;let l=this.memoryManager.malloc(16),s=this.pdfiumModule.pdfium;s.setValue(l+0,i.x,"float"),s.setValue(l+4,i.y,"float"),s.setValue(l+8,a.x,"float"),s.setValue(l+12,a.y,"float");let u=this.pdfiumModule.EPDFAnnot_SetLine(n,l,l+8);return this.memoryManager.free(l),!!u}
1getQuadPointsAnno(e,t,n){let r=this.pdfiumModule.FPDFAnnot_CountAttachmentPoints(n);if(0===r)return[];let i=[];for(let o=0;o<r;o++){let r=this.memoryManager.malloc(32);if(this.pdfiumModule.FPDFAnnot_GetAttachmentPoints(n,o,r)){let n=[],o=[];for(let e=0;e<4;e++){let t=r+8*e;n.push(this.pdfiumModule.pdfium.getValue(t,"float")),o.push(this.pdfiumModule.pdfium.getValue(t+4,"float"))}let a=this.convertPagePointToDevicePoint(e,t,{x:n[0],y:o[0]}),l=this.convertPagePointToDevicePoint(e,t,{x:n[1],y:o[1]}),s=this.convertPagePointToDevicePoint(e,t,{x:n[2],y:o[2]}),u=this.convertPagePointToDevicePoint(e,t,{x:n[3],y:o[3]});i.push({p1:a,p2:l,p3:s,p4:u})}this.memoryManager.free(r)}return i.map(o.z)}syncQuadPointsAnno(e,t,n,r){let i=this.pdfiumModule.pdfium,a=this.pdfiumModule.FPDFAnnot_CountAttachmentPoints(n),l=this.memoryManager.malloc(32),s=n=>{let r=(0,o.A)(n),a=this.convertDevicePointToPagePoint(e,t,r.p1),s=this.convertDevicePointToPagePoint(e,t,r.p2),u=this.convertDevicePointToPagePoint(e,t,r.p3),m=this.convertDevicePointToPagePoint(e,t,r.p4);i.setValue(l+0,a.x,"float"),i.setValue(l+4,a.y,"float"),i.setValue(l+8,s.x,"float"),i.setValue(l+12,s.y,"float"),i.setValue(l+16,m.x,"float"),i.setValue(l+20,m.y,"float"),i.setValue(l+24,u.x,"float"),i.setValue(l+28,u.y,"float")},u=Math.min(a,r.length);for(let e=0;e<u;e++)if(s(r[e]),!this.pdfiumModule.FPDFAnnot_SetAttachmentPoints(n,e,l))return this.memoryManager.free(l),!1;for(let e=a;e<r.length;e++)if(s(r[e]),!this.pdfiumModule.FPDFAnnot_AppendAttachmentPoints(n,l))return this.memoryManager.free(l),!1;return this.memoryManager.free(l),!0}redactTextInRects(e,t,n,r){let{recurseForms:i=!0,drawBlackBoxes:a=!1}=r??{};this.logger.debug("PDFiumEngine","Engine","redactTextInQuads",e.id,t.index,n.length);let l="RedactTextInQuads";this.logger.perf("PDFiumEngine","Engine",l,"Begin",`${e.id}-${t.index}`);let s=this.cache.getContext(e.id);if(!s)return this.logger.perf("PDFiumEngine","Engine",l,"End",`${e.id}-${t.index}`),o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let u=(n??[]).filter(e=>{var t,n,r,o;return e&&Number.isFinite(null==(t=e.origin)?void 0:t.x)&&Number.isFinite(null==(n=e.origin)?void 0:n.y)&&Number.isFinite(null==(r=e.size)?void 0:r.width)&&Number.isFinite(null==(o=e.size)?void 0:o.height)&&e.size.width>0&&e.size.height>0});if(0===u.length)return this.logger.perf("PDFiumEngine","Engine",l,"End",`${e.id}-${t.index}`),o.a.resolve(!1);let m=s.acquirePage(t.index),{ptr:F,count:d}=this.allocFSQuadsBufferFromRects(e,t,u),P=!1;try{P=!!this.pdfiumModule.EPDFText_RedactInQuads(m.pagePtr,F,d,!!i,!1)}finally{this.memoryManager.free(F)}return P&&(P=!!this.pdfiumModule.FPDFPage_GenerateContent(m.pagePtr)),m.disposeImmediate(),this.logger.perf("PDFiumEngine","Engine",l,"End",`${e.id}-${t.index}`),o.a.resolve(!!P)}applyRedaction(e,t,n){this.logger.debug(G,S,"applyRedaction",e.id,t.index,n.id);let r="ApplyRedaction";this.logger.perf(G,S,r,"Begin",`${e.id}-${t.index}`);let i=this.cache.getContext(e.id);if(!i)return this.logger.perf(G,S,r,"End",`${e.id}-${t.index}`),o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let a=i.acquirePage(t.index),l=this.getAnnotationByName(a.pagePtr,n.id);if(!l)return a.release(),this.logger.perf(G,S,r,"End",`${e.id}-${t.index}`),o.a.reject({code:o.P.NotFound,message:"annotation not found"});let s=this.pdfiumModule.EPDFAnnot_ApplyRedaction(a.pagePtr,l);return this.pdfiumModule.FPDFPage_CloseAnnot(l),s&&this.pdfiumModule.FPDFPage_GenerateContent(a.pagePtr),a.disposeImmediate(),this.logger.perf(G,S,r,"End",`${e.id}-${t.index}`),o.a.resolve(!!s)}applyAllRedactions(e,t){this.logger.debug(G,S,"applyAllRedactions",e.id,t.index);let n="ApplyAllRedactions";this.logger.perf(G,S,n,"Begin",`${e.id}-${t.index}`);let r=this.cache.getContext(e.id);if(!r)return this.logger.perf(G,S,n,"End",`${e.id}-${t.index}`),o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let i=r.acquirePage(t.index),a=this.pdfiumModule.EPDFPage_ApplyRedactions(i.pagePtr);return a&&this.pdfiumModule.FPDFPage_GenerateContent(i.pagePtr),i.disposeImmediate(),this.logger.perf(G,S,n,"End",`${e.id}-${t.index}`),o.a.resolve(!!a)}flattenAnnotation(e,t,n){this.logger.debug(G,S,"flattenAnnotation",e.id,t.index,n.id);let r="FlattenAnnotation";this.logger.perf(G,S,r,"Begin",`${e.id}-${t.index}`);let i=this.cache.getContext(e.id);if(!i)return this.logger.perf(G,S,r,"End",`${e.id}-${t.index}`),o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let a=i.acquirePage(t.index),l=this.getAnnotationByName(a.pagePtr,n.id);if(!l)return a.release(),this.logger.perf(G,S,r,"End",`${e.id}-${t.index}`),o.a.reject({code:o.P.NotFound,message:"annotation not found"});let s=this.pdfiumModule.EPDFAnnot_Flatten(a.pagePtr,l);return this.pdfiumModule.FPDFPage_CloseAnnot(l),s&&this.pdfiumModule.FPDFPage_GenerateContent(a.pagePtr),a.disposeImmediate(),this.logger.perf(G,S,r,"End",`${e.id}-${t.index}`),o.a.resolve(!!s)}exportAnnotationAppearanceAsPdf(e,t,n){this.logger.debug(G,S,"exportAnnotationAppearanceAsPdf",e.id,t.index,n.id);let r="ExportAnnotationAppearanceAsPdf";this.logger.perf(G,S,r,"Begin",`${e.id}-${t.index}`);let i=this.cache.getContext(e.id);if(!i)return this.logger.perf(G,S,r,"End",`${e.id}-${t.index}`),o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let a=i.acquirePage(t.index),l=this.getAnnotationByName(a.pagePtr,n.id);if(!l)return a.release(),this.logger.perf(G,S,r,"End",`${e.id}-${t.index}`),o.a.reject({code:o.P.NotFound,message:"annotation not found"});let s=this.pdfiumModule.EPDFAnnot_ExportAppearanceAsDocument(l);
1if(this.pdfiumModule.FPDFPage_CloseAnnot(l),!s)return a.release(),this.logger.perf(G,S,r,"End",`${e.id}-${t.index}`),o.a.reject({code:o.P.CantCreateNewDoc,message:"can not export annotation as pdf"});try{return o.a.resolve(this.saveDocument(s))}finally{this.pdfiumModule.FPDF_CloseDocument(s),a.release(),this.logger.perf(G,S,r,"End",`${e.id}-${t.index}`)}}exportAnnotationsAppearanceAsPdf(e,t,n){this.logger.debug(G,S,"exportAnnotationsAppearanceAsPdf",e.id,t.index,n.map(e=>e.id));let r="ExportAnnotationsAppearanceAsPdf";this.logger.perf(G,S,r,"Begin",`${e.id}-${t.index}`);let i=this.cache.getContext(e.id);if(!i)return this.logger.perf(G,S,r,"End",`${e.id}-${t.index}`),o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});if(0===n.length)return this.logger.perf(G,S,r,"End",`${e.id}-${t.index}`),o.a.reject({code:o.P.NotFound,message:"no annotations provided"});let a=i.acquirePage(t.index),l=[];for(let i of n){let n=this.getAnnotationByName(a.pagePtr,i.id);if(!n){for(let e of l)this.pdfiumModule.FPDFPage_CloseAnnot(e);return a.release(),this.logger.perf(G,S,r,"End",`${e.id}-${t.index}`),o.a.reject({code:o.P.NotFound,message:`annotation not found: ${i.id}`})}l.push(n)}let s=4*l.length,u=this.memoryManager.malloc(s);for(let e=0;e<l.length;e++)this.pdfiumModule.pdfium.setValue(u+4*e,l[e],"i32");let m=this.pdfiumModule.EPDFAnnot_ExportMultipleAppearancesAsDocument(u,l.length);for(let e of(this.memoryManager.free(u),l))this.pdfiumModule.FPDFPage_CloseAnnot(e);
1if(!m)return a.release(),this.logger.perf(G,S,r,"End",`${e.id}-${t.index}`),o.a.reject({code:o.P.CantCreateNewDoc,message:"can not export annotations as pdf"});try{return o.a.resolve(this.saveDocument(m))}finally{this.pdfiumModule.FPDF_CloseDocument(m),a.release(),this.logger.perf(G,S,r,"End",`${e.id}-${t.index}`)}}allocFSQuadsBufferFromRects(e,t,n){let r=n.length,i=this.memoryManager.malloc(32*r),a=this.pdfiumModule.pdfium;for(let l=0;l<r;l++){let r=n[l],s=(0,o.A)(r),u=this.convertDevicePointToPagePoint(e,t,s.p1),m=this.convertDevicePointToPagePoint(e,t,s.p2),F=this.convertDevicePointToPagePoint(e,t,s.p3),d=this.convertDevicePointToPagePoint(e,t,s.p4),P=i+32*l;a.setValue(P+0,u.x,"float"),a.setValue(P+4,u.y,"float"),a.setValue(P+8,m.x,"float"),a.setValue(P+12,m.y,"float"),a.setValue(P+16,d.x,"float"),a.setValue(P+20,d.y,"float"),a.setValue(P+24,F.x,"float"),a.setValue(P+28,F.y,"float")}return{ptr:i,count:r}}getInkList(e,t,n){let r=[],o=this.pdfiumModule.FPDFAnnot_GetInkListCount(n);if(o<=0)return r;let i=this.pdfiumModule.pdfium;for(let a=0;a<o;a++){let o=[],l=this.pdfiumModule.FPDFAnnot_GetInkListPath(n,a,0,0);if(l>0){let r=this.memoryManager.malloc(8*l);this.pdfiumModule.FPDFAnnot_GetInkListPath(n,a,r,l);for(let n=0;n<l;n++){let a=r+8*n,l=i.getValue(a+0,"float"),s=i.getValue(a+4,"float"),u=this.convertPagePointToDevicePoint(e,t,{x:l,y:s});o.push({x:u.x,y:u.y})}this.memoryManager.free(r)}r.push({points:o})}return r}setInkList(e,t,n,r){let o=this.pdfiumModule.pdfium;for(let i of r){let r=i.points.length;if(0===r)continue;let a=this.memoryManager.malloc(8*r);for(let n=0;n<r;n++){let r=i.points[n],l=this.convertDevicePointToPagePoint(e,t,r);o.setValue(a+8*n+0,l.x,"float"),o.setValue(a+8*n+4,l.y,"float")}let l=this.pdfiumModule.FPDFAnnot_AddInkStroke(n,a,r);if(this.memoryManager.free(a),-1===l)return!1}return!0}readPdfTextAnno(e,t,n,r){let i=this.readPageAnnoRect(n),a=this.convertPageRectToDeviceRect(e,t,i),l=this.getAnnotString(n,"State"),s=this.getAnnotString(n,"StateModel"),u=this.getAnnotationColor(n),m=this.getAnnotationOpacity(n),F=this.getAnnotationName(n);return{pageIndex:t.index,id:r,type:o.c.TEXT,rect:a,strokeColor:u??"#FFFF00",color:u??"#FFFF00",opacity:m,state:l,stateModel:s,name:F,icon:F,...this.readBaseAnnotationProperties(e,t,n)}}readPdfFreeTextAnno(e,t,n,r){let i=this.readPageAnnoRect(n),a=this.convertPageRectToDeviceRect(e,t,i),l=this.getAnnotString(n,"DS"),s=this.getAnnotationDefaultAppearance(n),u=this.getAnnotationColor(n),m=this.getAnnotationColor(n,o.j.TextColor),F=this.getBorderStyle(n),d=this.getAnnotationTextAlignment(n),P=this.getAnnotationVerticalAlignment(n),_=this.getAnnotationOpacity(n),g=this.getAnnotRichContent(n),c=this.getRectangleDifferences(n),h=this.getAnnotIntent(n),D=this.getCalloutLine(e,t,n),p=this.getLineEndings(n);return{pageIndex:t.index,id:r,type:o.c.FREETEXT,rect:a,fontFamily:(null==s?void 0:s.fontFamily)??o.l.Unknown,fontSize:(null==s?void 0:s.fontSize)??12,fontColor:m??(null==s?void 0:s.fontColor)??"#000000",verticalAlign:P,color:u,backgroundColor:u,opacity:_,textAlign:d,defaultStyle:l,richContent:g,...c.ok&&{rectangleDifferences:{left:c.left,top:c.top,right:c.right,bottom:c.bottom}},...h&&{intent:h},...D&&{calloutLine:D},...p&&{lineEnding:p.end},...F.width>0?{strokeWidth:F.width,strokeColor:(null==s?void 0:s.fontColor)??"#000000"}:"FreeTextCallout"===h?{strokeWidth:1,strokeColor:(null==s?void 0:s.fontColor)??"#000000"}:{},...this.readBaseAnnotationProperties(e,t,n)}}readPdfLinkAnno(e,t,n,r,i){let a,l=this.pdfiumModule.FPDFAnnot_GetLink(r);if(!l)return;let s=this.readPageAnnoRect(r),u=this.convertPageRectToDeviceRect(e,t,s),{style:m,width:F}=this.getBorderStyle(r),d=this.getAnnotationColor(r,o.j.Color);if(m===o.k.DASHED){let{ok:e,pattern:t}=this.getBorderDashPattern(r);e&&(a=t)}let P=this.readPdfLinkAnnoTarget(n,()=>this.pdfiumModule.FPDFLink_GetAction(l),()=>this.pdfiumModule.FPDFLink_GetDest(n,l));return{pageIndex:t.index,id:i,type:o.c.LINK,rect:u,target:P,strokeColor:d,strokeWidth:F,strokeStyle:m,strokeDashArray:a,...this.readBaseAnnotationProperties(e,t,r)}}readPdfWidgetAnno(e,t,n,r,i){let a=this.readPageAnnoRect(n);this.getAnnotationFlags(n);let l=this.getAnnotationDefaultAppearance(n),s=this.convertPageRectToDeviceRect(e,t,a),u=this.readPdfWidgetAnnoField(r,n),m=this.readButtonExportValue(n),F=this.getMKColor(n,0),d=this.getMKColor(n,1),{width:P}=this.getBorderStyle(n);return{pageIndex:t.index,id:i,type:o.c.WIDGET,fontFamily:(null==l?void 0:l.fontFamily)??o.l.Unknown,fontSize:(null==l?void 0:l.fontSize)??12,fontColor:(null==l?void 0:l.fontColor)??"#000000",rect:s,field:u,...void 0!==m&&{exportValue:m},strokeWidth:P,strokeColor:F??"transparent",color:d??"transparent",...this.readBaseAnnotationProperties(e,t,n)}}readPdfFileAttachmentAnno(e,t,n,r){let i=this.readPageAnnoRect(n),a=this.convertPageRectToDeviceRect(e,t,i);return{pageIndex:t.index,id:r,type:o.c.FILEATTACHMENT,rect:a,...this.readBaseAnnotationProperties(e,t,n)}}readPdfInkAnno(e,t,n,r){let i=this.readPageAnnoRect(n),a=this.convertPageRectToDeviceRect(e,t,i),l=this.getAnnotationColor(n)??"#FF0000",s=this.getAnnotationOpacity(n),{width:u}=this.getBorderStyle(n),m=this.getInkList(e,t,n),F=this.getAnnotIntent(n);return{pageIndex:t.index,id:r,type:o.c.INK,rect:a,...F&&{intent:F},strokeColor:l,color:l,opacity:s,strokeWidth:0===u?1:u,inkList:m,...this.readBaseAnnotationProperties(e,t,n)}}readPdfPolygonAnno(e,t,n,r){let i,a=this.readPageAnnoRect(n),l=this.convertPageRectToDeviceRect(e,t,a),s=this.readPdfAnnoVertices(e,t,n),u=this.getAnnotationColor(n),m=this.getAnnotationColor(n,o.j.InteriorColor),F=this.getAnnotationOpacity(n),{style:d,width:P}=this.getBorderStyle(n);if(d===o.k.DASHED){let{ok:e,pattern:t}=this.getBorderDashPattern(n);e&&(i=t)}if(s.length>1){let e=s[0],t=s[s.length-1];e.x===t.x&&e.y===t.y&&s.pop()}let _=this.getRectangleDifferences(n),g=this.getBorderEffect(n);return{pageIndex:t.index,id:r,type:o.c.POLYGON,rect:l,strokeColor:u??"#FF0000",color:m??"transparent",opacity:F,strokeWidth:0===P?1:P,strokeStyle:d,strokeDashArray:i,vertices:s,...g.ok&&{cloudyBorderIntensity:g.intensity},..._.ok&&{rectangleDifferences:{left:_.left,top:_.top,right:_.right,bottom:_.bottom}},...this.readBaseAnnotationProperties(e,t,n)}}readPdfPolylineAnno(e,t,n,r){let i,a=this.readPageAnnoRect(n),l=this.convertPageRectToDeviceRect(e,t,a),s=this.readPdfAnnoVertices(e,t,n),u=this.getAnnotationColor(n),m=this.getAnnotationColor(n,o.j.InteriorColor),F=this.getAnnotationOpacity(n),{style:d,width:P}=this.getBorderStyle(n);if(d===o.k.DASHED){let{ok:e,pattern:t}=this.getBorderDashPattern(n);e&&(i=t)}let _=this.getLineEndings(n);return{pageIndex:t.index,id:r,type:o.c.POLYLINE,rect:l,strokeColor:u??"#FF0000",color:m??"transparent",opacity:F,strokeWidth:0===P?1:P,strokeStyle:d,strokeDashArray:i,lineEndings:_,vertices:s,...this.readBaseAnnotationProperties(e,t,n)}}readPdfLineAnno(e,t,n,r){let i,a=this.readPageAnnoRect(n),l=this.convertPageRectToDeviceRect(e,t,a),s=this.getLinePoints(e,t,n
1),u=this.getLineEndings(n),m=this.getAnnotationColor(n),F=this.getAnnotationColor(n,o.j.InteriorColor),d=this.getAnnotationOpacity(n),{style:P,width:_}=this.getBorderStyle(n);if(P===o.k.DASHED){let{ok:e,pattern:t}=this.getBorderDashPattern(n);e&&(i=t)}return{pageIndex:t.index,id:r,type:o.c.LINE,rect:l,strokeWidth:0===_?1:_,strokeStyle:P,strokeDashArray:i,strokeColor:m??"#FF0000",color:F??"transparent",opacity:d,linePoints:s||{start:{x:0,y:0},end:{x:0,y:0}},lineEndings:u||{start:o.m.None,end:o.m.None},...this.readBaseAnnotationProperties(e,t,n)}}readPdfHighlightAnno(e,t,n,r){let i=this.readPageAnnoRect(n),a=this.convertPageRectToDeviceRect(e,t,i),l=this.getQuadPointsAnno(e,t,n),s=this.getAnnotationColor(n)??"#FFFF00",u=this.getAnnotationOpacity(n);return{pageIndex:t.index,id:r,type:o.c.HIGHLIGHT,rect:a,segmentRects:l,strokeColor:s,color:s,opacity:u,...this.readBaseAnnotationProperties(e,t,n)}}readPdfUnderlineAnno(e,t,n,r){let i=this.readPageAnnoRect(n),a=this.convertPageRectToDeviceRect(e,t,i),l=this.getQuadPointsAnno(e,t,n),s=this.getAnnotationColor(n)??"#FF0000",u=this.getAnnotationOpacity(n);return{pageIndex:t.index,id:r,type:o.c.UNDERLINE,rect:a,segmentRects:l,strokeColor:s,color:s,opacity:u,...this.readBaseAnnotationProperties(e,t,n)}}readPdfStrikeOutAnno(e,t,n,r){let i=this.readPageAnnoRect(n),a=this.convertPageRectToDeviceRect(e,t,i),l=this.getQuadPointsAnno(e,t,n),s=this.getAnnotationColor(n)??"#FF0000",u=this.getAnnotationOpacity(n);return{pageIndex:t.index,id:r,type:o.c.STRIKEOUT,rect:a,segmentRects:l,strokeColor:s,color:s,opacity:u,...this.readBaseAnnotationProperties(e,t,n)}}readPdfSquigglyAnno(e,t,n,r){let i=this.readPageAnnoRect(n),a=this.convertPageRectToDeviceRect(e,t,i),l=this.getQuadPointsAnno(e,t,n),s=this.getAnnotationColor(n)??"#FF0000",u=this.getAnnotationOpacity(n);return{pageIndex:t.index,id:r,type:o.c.SQUIGGLY,rect:a,segmentRects:l,strokeColor:s,color:s,opacity:u,...this.readBaseAnnotationProperties(e,t,n)}}readPdfCaretAnno(e,t,n,r){let i=this.readPageAnnoRect(n),a=this.convertPageRectToDeviceRect(e,t,i),l=this.getAnnotationColor(n),s=this.getAnnotationOpacity(n),u=this.getAnnotIntent(n),m=this.getRectangleDifferences(n);return{pageIndex:t.index,id:r,type:o.c.CARET,rect:a,strokeColor:l,opacity:s,intent:u,...m.ok&&{rectangleDifferences:{left:m.left,top:m.top,right:m.right,bottom:m.bottom}},...this.readBaseAnnotationProperties(e,t,n)}}readPdfRedactAnno(e,t,n,r){let i=this.readPageAnnoRect(n),a=this.convertPageRectToDeviceRect(e,t,i),l=this.getQuadPointsAnno(e,t,n),s=this.getAnnotationColor(n,o.j.InteriorColor),u=this.getAnnotationColor(n,o.j.OverlayColor),m=this.getAnnotationColor(n,o.j.Color),F=this.getAnnotationOpacity(n),d=this.getOverlayText(n),P=this.getOverlayTextRepeat(n),_=this.getAnnotationDefaultAppearance(n),g=this.getAnnotationTextAlignment(n);return{pageIndex:t.index,id:r,type:o.c.REDACT,rect:a,segmentRects:l,color:s,overlayColor:u,strokeColor:m,opacity:F,overlayText:d,overlayTextRepeat:P,fontFamily:null==_?void 0:_.fontFamily,fontSize:null==_?void 0:_.fontSize,fontColor:null==_?void 0:_.fontColor,textAlign:g,...this.readBaseAnnotationProperties(e,t,n)}}readPdfStampAnno(e,t,n,r){let i=this.readPageAnnoRect(n),a=this.convertPageRectToDeviceRect(e,t,i),l=this.getAnnotationName(n);
1return{pageIndex:t.index,id:r,type:o.c.STAMP,rect:a,name:l,icon:l,...this.readBaseAnnotationProperties(e,t,n)}}readPdfPageObject(e){switch(this.pdfiumModule.FPDFPageObj_GetType(e)){case o.B.PATH:return this.readPathObject(e);case o.B.IMAGE:return this.readImageObject(e);case o.B.FORM:return this.readFormObject(e)}}readPathObject(e){let t=this.pdfiumModule.FPDFPath_CountSegments(e),n=this.memoryManager.malloc(4),r=this.memoryManager.malloc(4),i=this.memoryManager.malloc(4),a=this.memoryManager.malloc(4);this.pdfiumModule.FPDFPageObj_GetBounds(e,n,r,i,a);let l={left:this.pdfiumModule.pdfium.getValue(n,"float"),bottom:this.pdfiumModule.pdfium.getValue(r,"float"),right:this.pdfiumModule.pdfium.getValue(i,"float"),top:this.pdfiumModule.pdfium.getValue(a,"float")};this.memoryManager.free(n),this.memoryManager.free(r),this.memoryManager.free(i),this.memoryManager.free(a);let s=[];for(let n=0;n<t;n++){let t=this.readPdfSegment(e,n);s.push(t)}let u=this.readPdfPageObjectTransformMatrix(e);return{type:o.B.PATH,bounds:l,segments:s,matrix:u}}readPdfSegment(e,t){let n=this.pdfiumModule.FPDFPath_GetPathSegment(e,t),r=this.pdfiumModule.FPDFPathSegment_GetType(n),o=this.pdfiumModule.FPDFPathSegment_GetClose(n),i=this.memoryManager.malloc(4),a=this.memoryManager.malloc(4);this.pdfiumModule.FPDFPathSegment_GetPoint(n,i,a);let l=this.pdfiumModule.pdfium.getValue(i,"float"),s=this.pdfiumModule.pdfium.getValue(a,"float");return this.memoryManager.free(i),this.memoryManager.free(a),{type:r,point:{x:l,y:s},isClosed:o}}readImageObject(e){let t=this.pdfiumModule.FPDFImageObj_GetBitmap(e),n=this.pdfiumModule.FPDFBitmap_GetBuffer(t),r=this.pdfiumModule.FPDFBitmap_GetWidth(t),i=this.pdfiumModule.FPDFBitmap_GetHeight(t),a=this.pdfiumModule.FPDFBitmap_GetFormat(t),l=r*i,s=new Uint8ClampedArray(4*l);for(let e=0;e<l;e++)if(2===a){let t=this.pdfiumModule.pdfium.getValue(n+3*e,"i8"),r=this.pdfiumModule.pdfium.getValue(n+3*e+1,"i8"),o=this.pdfiumModule.pdfium.getValue(n+3*e+2,"i8");s[4*e]=o,s[4*e+1]=r,s[4*e+2]=t,s[4*e+3]=100}let u=this.readPdfPageObjectTransformMatrix(e);return{type:o.B.IMAGE,imageData:{data:s,width:r,height:i},matrix:u}}readFormObject(e){let t=this.pdfiumModule.FPDFFormObj_CountObjects(e),n=[];for(let r=0;r<t;r++){let t=this.pdfiumModule.FPDFFormObj_GetObject(e,r),o=this.readPdfPageObject(t);o&&n.push(o)}let r=this.readPdfPageObjectTransformMatrix(e);return{type:o.B.FORM,objects:n,matrix:r}}readPdfPageObjectTransformMatrix(e){let t=this.memoryManager.malloc(24);if(this.pdfiumModule.FPDFPageObj_GetMatrix(e,t)){let e=this.pdfiumModule.pdfium.getValue(t,"float"),n=this.pdfiumModule.pdfium.getValue(t+4,"float"),r=this.pdfiumModule.pdfium.getValue(t+8,"float"),o=this.pdfiumModule.pdfium.getValue(t+12,"float"),i=this.pdfiumModule.pdfium.getValue(t+16,"float"),a=this.pdfiumModule.pdfium.getValue(t+20,"float");return this.memoryManager.free(t),{a:e,b:n,c:r,d:o,e:i,f:a}}return this.memoryManager.free(t),{a:1,b:0,c:0,d:1,e:0,f:0}}readStampAnnotationContents(e){let t=[],n=this.pdfiumModule.FPDFAnnot_GetObjectCount(e);for(let r=0;r<n;r++){let n=this.pdfiumModule.FPDFAnnot_GetObject(e,r),o=this.readPdfPageObject(n);o&&t.push(o)}return t}getStrokeWidth(e){let t=this.memoryManager.malloc(4),n=this.memoryManager.malloc(4),r=this.memoryManager.malloc(4),o=this.pdfiumModule.FPDFAnnot_GetBorder(e,t,n,r)?this.pdfiumModule.pdfium.getValue(r,"float"):1;return this.memoryManager.free(t),this.memoryManager.free(n),this.memoryManager.free(r),o}getAnnotationFlags(e){let t=this.pdfiumModule.FPDFAnnot_GetFlags(e);return(0,o.C)(t)}setAnnotationFlags(e,t){let n=(0,o.D)(t);return this.pdfiumModule.FPDFAnnot_SetFlags(e,n)}readPdfCircleAnno(e,t,n,r){let i,a=this.readPageAnnoRect(n),l=this.convertPageRectToDeviceRect(e,t,a),s=this.getAnnotationColor(n,o.j.InteriorColor),u=this.getAnnotationColor(n),m=this.getAnnotationOpacity(n),{style:F,width:d}=this.getBorderStyle(n);if(F===o.k.DASHED){let{ok:e,pattern:t}=this.getBorderDashPattern(n);e&&(i=t)}let P=this.getRectangleDifferences(n),_=this.getBorderEffect(n);return{pageIndex:t.index,id:r,type:o.c.CIRCLE,rect:l,color:s??"transparent",opacity:m,strokeWidth:d,strokeColor:u??"#FF0000",strokeStyle:F,...void 0!==i&&{strokeDashArray:i},..._.ok&&{cloudyBorderIntensity:_.intensity},...P.ok&&{rectangleDifferences:{left:P.left,top:P.top,right:P.right,bottom:P.bottom}},...this.readBaseAnnotationProperties(e,t,n)}}readPdfSquareAnno(e,t,n,r){let i,a=this.readPageAnnoRect(n),l=this.convertPageRectToDeviceRect(e,t,a),s=this.getAnnotationColor(n,o.j.InteriorColor),u=this.getAnnotationColor(n),m=this.getAnnotationOpacity(n),{style:F,width:d}=this.getBorderStyle(n);if(F===o.k.DASHED){let{ok:e,pattern:t}=this.getBorderDashPattern(n);e&&(i=t)}let P=this.getRectangleDifferences(n),_=this.getBorderEffect(n);return{pageIndex:t.index,id:r,type:o.c.SQUARE,rect:l,color:s??"transparent",opacity:m,strokeColor:u??"#FF0000",strokeWidth:d,strokeStyle:F,...void 0!==i&&{strokeDashArray:i},..._.ok&&{cloudyBorderIntensity:_.intensity},...P.ok&&{rectangleDifferences:{left:P.left,top:P.top,right:P.right,bottom:P.bottom}},...this.readBaseAnnotationProperties(e,t,n)}}readPdfAnno(e,t,n,r,o){let i=this.readPageAnnoRect(r),a=this.convertPageRectToDeviceRect(e,t,i);return{pageIndex:t.index,id:o,type:n,rect:a,...this.readBaseAnnotationProperties(e,t,r)}}getInReplyToId(e){let t=this.pdfiumModule.FPDFAnnot_GetLinkedAnnot(e,"IRT");if(!t)return;let n=this.getAnnotString(t,"NM");return n||(n=(0,o.u)(),this.setAnnotString(t,"NM",n)),this.pdfiumModule.FPDFPage_CloseAnnot(t),n}setInReplyToId(e,t,n){if(!n)return this.pdfiumModule.EPDFAnnot_SetLinkedAnnot(t,"IRT",0);let r=this.getAnnotationByName(e,n);return!!r&&this.pdfiumModule.EPDFAnnot_SetLinkedAnnot(t,"IRT",r)}rotatePointForSave(e,t,n){let r=n*Math.PI/180,o=Math.cos(r),i=Math.sin(r),a=e.x-t.x,l=e.y-t.y;return{x:t.x+a*o-l*i,y:t.y+a*i+l*o}}prepareAnnotationForSave(e){let t=e.rotation,n=e.unrotatedRect;if(!t||0===t||!n)return e;let r={x:n.origin.x+n.size.width/2,y:n.origin.y+n.size.height/2};switch(e.type){case o.c.INK:{let n=e.inkList.map(e=>({points:e.points.map(e=>this.rotatePointForSave(e,r,t))}));return{...e,inkList:n}}case o.c.LINE:return{...e,linePoints:{start:this.rotatePointForSave(e.linePoints.start,r,t),end:this.rotatePointForSave(e.linePoints.end,r,t)}};case o.c.POLYGON:return{...e,vertices:e.vertices.map(e=>this.rotatePointForSave(e,r,t))};case o.c.POLYLINE:return{...e,vertices:e.vertices.map(e=>this.rotatePointForSave(e,r,t))};default:return e}}applyBaseAnnotationProperties(e,t,n,r,o){if(!this.setAnnotString(r,"T",o.author||"")||!this.setAnnotString(r,"Contents",o.contents??"")||o.subject&&!this.setAnnotString(r,"Subj",o.subject)||o.modified&&!this.setAnnotationDate(r,"M",o.modified)||o.created&&!this.setAnnotationDate(r,"CreationDate",o.created)||o.flags&&!this.setAnnotationFlags(r,o.flags))return!1;let i=this.getAnnotCustom(r)??{},a={...i,...o.custom??{}};if(delete a.unrotatedRect,delete a.rotation,Object.keys(a).length>0){if(!this.setAnnotCustom(r,a))return!1}else if(Object.keys(i).length>0&&!this.setAnnotCustom(r,null))return!1;if(void 0!==o.rotation){let e=o.rotation?(360-o.rotation)%360:0;this.setAnnotExtendedRotation(r,e)}return o.unrotatedRect?this.setAnnotUnrotatedRect(e,t,r,o.unrotatedRect):o.rotation&&0!==o.rotation&&this.setAnnotUnrotatedRect(e,t,r,o.rect),!!this.setInReplyToId(n,r,o.inReplyToId)&&!!this.setReplyType(r,o.replyType)}readBaseAnnotationProperties(e,t,n){let r=this.getAnnotString(n,"T"),i=this.getAnnotString(n,"Contents")||"",a=this.getAnnotationDate(n,"M"),l=this.getAnnotationDate(n,"CreationDate"),s=this.getAnnotString(n,"Subj"),u=this.getAnnotationFlags(n),m=this.getAnnotCustom(n),F=this.getInReplyToId(n),d=this.getReplyType(n),P=this.pdfiumModule.EPDFAnnot_GetBlendM
1ode(n),_=this.getAnnotExtendedRotation(n),g=0!==_?(360-_)%360:0,c=this.readAnnotUnrotatedRect(n),h=c?this.convertPageRectToDeviceRect(e,t,c):void 0;return{author:r,contents:i,modified:a,created:l,flags:u,custom:m,blendMode:P,...s&&{subject:s},...F&&{inReplyToId:F},...d&&d!==o.x.Reply&&{replyType:d},...0!==g&&{rotation:g},...void 0!==h&&{unrotatedRect:h}}}getAnnotString(e,t){let n=this.pdfiumModule.FPDFAnnot_GetStringValue(e,t,0,0);if(0===n)return;let r=2*(n+1),o=this.memoryManager.malloc(r);this.pdfiumModule.FPDFAnnot_GetStringValue(e,t,o,r);let i=this.pdfiumModule.pdfium.UTF16ToString(o);return this.memoryManager.free(o),i||void 0}readButtonExportValue(e){let t=this.pdfiumModule.EPDFAnnot_GetButtonExportValue(e,0,0);if(0===t)return;let n=2*(t+1),r=this.memoryManager.malloc(n);this.pdfiumModule.EPDFAnnot_GetButtonExportValue(e,r,n);let o=this.pdfiumModule.pdfium.UTF16ToString(r);return this.memoryManager.free(r),o||void 0}getAttachmentString(e,t){let n=this.pdfiumModule.FPDFAttachment_GetStringValue(e,t,0,0);if(0===n)return;let r=2*(n+1),o=this.memoryManager.malloc(r);this.pdfiumModule.FPDFAttachment_GetStringValue(e,t,o,r);let i=this.pdfiumModule.pdfium.UTF16ToString(o);return this.memoryManager.free(o),i||void 0}getAttachmentNumber(e,t){let n=this.memoryManager.malloc(4);try{if(!this.pdfiumModule.EPDFAttachment_GetIntegerValue(e,t,n))return;return this.pdfiumModule.pdfium.getValue(n,"i32")>>>0}finally{this.memoryManager.free(n)}}getAnnotCustom(e){let t=this.getAnnotString(e,"EPDFCustom");if(t)try{return JSON.parse(t)}catch(e){return console.warn("Failed to parse annotation custom data as JSON:",e),void console.warn("Invalid JSON string:",t)}}setAnnotCustom(e,t){if(null==t)return this.setAnnotString(e,"EPDFCustom","");try{let n=JSON.stringify(t);return this.setAnnotString(e,"EPDFCustom",n)}catch(e){return console.warn("Failed to stringify annotation custom data as JSON:",e),console.warn("Invalid data object:",t),!1}}getAnnotIntent(e){let t=this.pdfiumModule.EPDFAnnot_GetIntent(e,0,0);if(0===t)return;let n=2*(t+1),r=this.memoryManager.malloc(n);this.pdfiumModule.EPDFAnnot_GetIntent(e,r,n);let o=this.pdfiumModule.pdfium.UTF16ToString(r);return this.memoryManager.free(r),o&&"undefined"!==o?o:void 0}setAnnotIntent(e,t){return this.pdfiumModule.EPDFAnnot_SetIntent(e,t)}getAnnotRichContent(e){let t=this.pdfiumModule.EPDFAnnot_GetRichContent(e,0,0);if(0===t)return;let n=2*(t+1),r=this.memoryManager.malloc(n);this.pdfiumModule.EPDFAnnot_GetRichContent(e,r,n);let o=this.pdfiumModule.pdfium.UTF16ToString(r);return this.memoryManager.free(r),o||void 0}getAnnotationByName(e,t){return this.withWString(t,t=>this.pdfiumModule.EPDFPage_GetAnnotByName(e,t))}removeAnnotationByName(e,t){return this.withWString(t,t=>this.pdfiumModule.EPDFPage_RemoveAnnotByName(e,t))}setAnnotString(e,t,n){return this.withWString(n,n=>this.pdfiumModule.FPDFAnnot_SetStringValue(e,t,n))}setAttachmentString(e,t,n){return this.withWString(n,n=>this.pdfiumModule.FPDFAttachment_SetStringValue(e,t,n))}readPdfAnnoVertices(e,t,n){let r=[],o=this.pdfiumModule.FPDFAnnot_GetVertices(n,0,0),i=this.memoryManager.malloc(8*o);this.pdfiumModule.FPDFAnnot_GetVertices(n,i,o);for(let n=0;n<o;n++){let o=this.pdfiumModule.pdfium.getValue(i+8*n,"float"),a=this.pdfiumModule.pdfium.getValue(i+8*n+4,"float"),{x:l,y:s}=this.convertPagePointToDevicePoint(e,t,{x:o,y:a}),u=r[r.length-1];u&&u.x===l&&u.y===s||r.push({x:l,y:s})}return this.memoryManager.free(i),r}setPdfAnnoVertices(e,t,n,r){let o=this.pdfiumModule.pdfium,i=this.memoryManager.malloc(8*r.length);r.forEach((n,r)=>{let a=this.convertDevicePointToPagePoint(e,t,n);o.setValue(i+8*r+0,a.x,"float"),o.setValue(i+8*r+4,a.y,"float")});let a=this.pdfiumModule.EPDFAnnot_SetVertices(n,i,r.length);return this.memoryManager.free(i),a}getCalloutLine(e,t,n){let r=this.pdfiumModule.EPDFAnnot_GetCalloutLineCount(n);if(0===r)return;let o=this.memoryManager.malloc(8*r);if(0===this.pdfiumModule.EPDFAnnot_GetCalloutLine(n,o,r))return void this.memoryManager.free(o);let i=[];for(let n=0;n<r;n++){let r=this.pdfiumModule.pdfium.getValue(o+8*n,"float"),a=this.pdfiumModule.pdfium.getValue(o+8*n+4,"float");i.push(this.convertPagePointToDevicePoint(e,t,{x:r,y:a}))}return this.memoryManager.free(o),i}setCalloutLine(e,t,n,r){let o=this.pdfiumModule.pdfium,i=this.memoryManager.malloc(8*r.length);r.forEach((n,r)=>{let a=this.convertDevicePointToPagePoint(e,t,n);o.setValue(i+8*r+0,a.x,"float"),o.setValue(i+8*r+4,a.y,"float")});let a=this.pdfiumModule.EPDFAnnot_SetCalloutLine(n,i,r.length);return this.memoryManager.free(i),a}readPdfBookmarkTarget(e,t,n){let r=t();if(r)return{type:"action",action:this.readPdfAction(e,r)};{let t=n();if(t)return{type:"destination",destination:this.readPdfDestination(e,t)}}}readPdfWidgetAnnoField(e,t){let n=this.pdfiumModule.FPDFAnnot_GetFormField
1Flags(e,t),r=this.pdfiumModule.FPDFAnnot_GetFormFieldType(e,t),i=m(this.pdfiumModule.pdfium,(n,r)=>this.pdfiumModule.FPDFAnnot_GetFormFieldName(e,t,n,r),this.pdfiumModule.pdfium.UTF16ToString),a=m(this.pdfiumModule.pdfium,(n,r)=>this.pdfiumModule.FPDFAnnot_GetFormFieldAlternateName(e,t,n,r),this.pdfiumModule.pdfium.UTF16ToString),l=m(this.pdfiumModule.pdfium,(n,r)=>this.pdfiumModule.EPDFAnnot_GetFormFieldRawValue(e,t,n,r),this.pdfiumModule.pdfium.UTF16ToString),s=this.pdfiumModule.EPDFAnnot_GetFormFieldObjectNumber(e,t),u={flag:n,name:i,alternateName:a,value:l,fieldObjectId:s>0?s:void 0};switch(r){case o.f.TEXTFIELD:{let e,n=this.memoryManager.malloc(4);return this.pdfiumModule.FPDFAnnot_GetNumberValue(t,"MaxLen",n)&&(e=this.pdfiumModule.pdfium.getValue(n,"float")),this.memoryManager.free(n),{...u,type:r,maxLen:e}}case o.f.CHECKBOX:return{...u,type:r};case o.f.RADIOBUTTON:case o.f.COMBOBOX:case o.f.LISTBOX:return{...u,type:r,options:this.readWidgetOptions(e,t)};case o.f.PUSHBUTTON:case o.f.SIGNATURE:default:return{...u,type:r}}}readWidgetOptions(e,t){let n=[],r=this.pdfiumModule.FPDFAnnot_GetOptionCount(e,t);for(let o=0;o<r;o++){let r=m(this.pdfiumModule.pdfium,(n,r)=>this.pdfiumModule.FPDFAnnot_GetOptionLabel(e,t,o,n,r),this.pdfiumModule.pdfium.UTF16ToString),i=this.pdfiumModule.FPDFAnnot_IsOptionSelected(e,t,o);n.push({label:r,isSelected:i})}return n}renderPageAnnotationRaw(e,t,n,r){let{scaleFactor:i=1,rotation:a=o.R.Degree0,dpr:l=1,mode:s=o.E.Normal}=r??{};this.logger.debug(G,S,"renderPageAnnotation",e,t,n,r),this.logger.perf(G,S,"RenderPageAnnotation","Begin",`${e.id}-${t.index}-${n.id}`);let u=new o.T,m=this.cache.getContext(e.id);if(!m)return this.logger.perf(G,S,"RenderPageAnnotation","End",`${e.id}-${t.index}-${n.id}`),o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let F=m.acquirePage(t.index),d=this.getAnnotationByName(F.pagePtr,n.id);if(!d)return this.logger.perf(G,S,"RenderPageAnnotation","End",`${e.id}-${t.index}-${n.id}`),F.release(),o.a.reject({code:o.P.NotFound,message:"annotation not found"});let P=!!this.pdfiumModule.EPDFAnnot_HasAppearanceStream(d,s);if(P||n.type!==o.c.WIDGET||this.pdfiumModule.FPDFAnnot_HasKey(d,"AP")||(this.pdfiumModule.EPDFAnnot_GenerateFormFieldAP(d),P=!!this.pdfiumModule.EPDFAnnot_HasAppearanceStream(d,s)),!P)return this.pdfiumModule.FPDFPage_CloseAnnot(d),F.release(),this.logger.perf(G,S,"RenderPageAnnotation","End",`${e.id}-${t.index}-${n.id}`),u.resolve({data:new Uint8ClampedArray(4),width:1,height:1}),u;let _=Math.max(.01,i*l),g=!!(null==r?void 0:r.unrotated)&&!!n.unrotatedRect,c=g?n.unrotatedRect:n.rect,h=(0,o.F)((0,o.G)(t.size,c,a,_)),D=Math.max(1,h.size.width),p=Math.max(1,h.size.height),f=4*D,b=f*p,A=this.memoryManager.malloc(b),E=this.pdfiumModule.FPDFBitmap_CreateEx(D,p,4,A,f);this.pdfiumModule.FPDFBitmap_FillRect(E,0,0,D,p,0);let M=(0,o.H)(c,a,D,p),y=this.memoryManager.malloc(24);new Float32Array(this.pdfiumModule.pdfium.HEAPF32.buffer,y,6).set([M.a,M.b,M.c,M.d,M.e,M.f]);let C=!1;try{C=g?!!this.pdfiumModule.EPDF_RenderAnnotBitmapUnrotated(E,F.pagePtr,d,s,y,16):!!this.pdfiumModule.EPDF_RenderAnnotBitmap(E,F.pagePtr,d,s,y,16)}finally{this.memoryManager.free(y),this.pdfiumModule.FPDFBitmap_Destroy(E),this.pdfiumModule.FPDFPage_CloseAnnot(d),F.release()}if(!C)return this.memoryManager.free(A),this.logger.perf(G,S,"RenderPageAnnotation","End",`${e.id}-${t.index}-${n.id}`),o.a.reject({code:o.P.Unknown,message:"EPDF_RenderAnnotBitmap failed"});let x={data:new Uint8ClampedArray(this.pdfiumModule.pdfium.HEAPU8.subarray(A,A+b)),width:D,height:p};return u.resolve(x),this.memoryManager.free(A),u}renderPageAnnotationsRaw(e,t,n){let{scaleFactor:r=1,rotation:i=o.R.Degree0,dpr:a=1}=n??{};this.logger.debug(G,S,"renderPageAnnotationsRaw",e,t,n),this.logger.perf(G,S,"RenderPageAnnotationsRaw","Begin",`${e.id}-${t.index}`);let l=this.cache.getContext(e.id);if(!l)return this.logger.perf(G,S,"RenderPageAnnotationsRaw","End",`${e.id}-${t.index}`),o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let s=l.acquirePage(t.index),u={},m=Math.max(.01,r*a),F=this.pdfiumModule.FPDFPage_GetAnnotCount(s.pagePtr);for(let n=0;n<F;n++){let r=this.pdfiumModule.FPDFPage_GetAnnot(s.pagePtr,n);if(r)try{let n=this.getAnnotString(r,"NM");
1if(!n||0!==this.getAnnotExtendedRotation(r)&&this.readAnnotUnrotatedRect(r))continue;let a=this.pdfiumModule.EPDFAnnot_GetAvailableAppearanceModes(r);if(!a)continue;let l={};for(let{bit:n,mode:u,key:F}of[{bit:o.I,mode:o.E.Normal,key:"normal"},{bit:o.J,mode:o.E.Rollover,key:"rollover"},{bit:o.K,mode:o.E.Down,key:"down"}]){if(!(a&n))continue;let o=this.renderSingleAnnotAppearance(e,t,s,r,u,i,m);o&&(l[F]=o)}(l.normal||l.rollover||l.down)&&(u[n]=l)}finally{this.pdfiumModule.FPDFPage_CloseAnnot(r)}}s.release(),this.logger.perf(G,S,"RenderPageAnnotationsRaw","End",`${e.id}-${t.index}`);let d=new o.T;return d.resolve(u),d}renderSingleAnnotAppearance(e,t,n,r,i,a,l){if(!this.pdfiumModule.EPDFAnnot_HasAppearanceStream(r,i)&&(this.pdfiumModule.FPDFAnnot_GetSubtype(r)!==o.c.WIDGET||this.pdfiumModule.FPDFAnnot_HasKey(r,"AP")||(this.pdfiumModule.EPDFAnnot_GenerateFormFieldAP(r),!this.pdfiumModule.EPDFAnnot_HasAppearanceStream(r,i))))return null;let s=this.readPageAnnoRect(r),u=this.convertPageRectToDeviceRect(e,t,s),m=(0,o.F)((0,o.G)(t.size,u,a,l)),F=Math.max(1,m.size.width),d=Math.max(1,m.size.height),P=4*F,_=P*d,g=this.memoryManager.malloc(_),c=this.pdfiumModule.FPDFBitmap_CreateEx(F,d,4,g,P);this.pdfiumModule.FPDFBitmap_FillRect(c,0,0,F,d,0);let h=(0,o.H)(u,a,F,d),D=this.memoryManager.malloc(24);new Float32Array(this.pdfiumModule.pdfium.HEAPF32.buffer,D,6).set([h.a,h.b,h.c,h.d,h.e,h.f]);let p=!1;try{p=!!this.pdfiumModule.EPDF_RenderAnnotBitmap(c,n.pagePtr,r,i,D,16)}finally{this.memoryManager.free(D),this.pdfiumModule.FPDFBitmap_Destroy(c)}if(!p)return this.memoryManager.free(g),null;let f={data:new Uint8ClampedArray(this.pdfiumModule.pdfium.HEAPU8.subarray(g,g+_)),width:F,height:d};return this.memoryManager.free(g),{data:f,rect:u}}renderRectEncoded(e,t,n,r){let i=new o.T,a=(null==r?void 0:r.rotation)??o.R.Degree0,l=this.cache.getContext(e.id);if(!l)return o.a.reject({code:o.P.DocNotOpen,message:"document does not open"});let s=Math.max(.01,(null==r?void 0:r.scaleFactor)??1)*Math.max(1,(null==r?void 0:r.dpr)??1),u=n.size.width,m=n.size.height,F=!(1&~a),d=Math.max(1,Math.round((F?m:u)*s)),P=Math.max(1,Math.round((F?u:m)*s)),_=4*d,g=_*P,c=l.acquirePage(t.index),h=(null==r?void 0:r.withForms)??!1,D=this.memoryManager.malloc(g),p=this.pdfiumModule.FPDFBitmap_CreateEx(d,P,4,D,_),f=0xffffffff*(null==r||!r.transparentBackground);this.pdfiumModule.FPDFBitmap_FillRect(p,0,0,d,P,f);let b=(0,o.H)(n,a,d,P),A=this.memoryManager.malloc(24);new Float32Array(this.pdfiumModule.pdfium.HEAPF32.buffer,A,6).set([b.a,b.b,b.c,b.d,b.e,b.f]);let E=this.memoryManager.malloc(16);new Float32Array(this.pdfiumModule.pdfium.HEAPF32.buffer,E,4).set([0,0,d,P]);let M=16;(null==r?void 0:r.withAnnotations)&&(M|=1);try{this.pdfiumModule.FPDF_RenderPageBitmapWithMatrix(p,c.pagePtr,A,E,M),h&&c.withFormHandle(e=>{let{startX:r,startY:i,formsWidth:l,formsHeight:s}=function(e,t,n,r){let i,a,l=t.origin.x,s=t.origin.y,u=l+t.size.width,m=s+t.size.height,F=n.width,d=n.height,P=Math.hypot(e.a,e.b),_=Math.hypot(e.c,e.d),g=!(1&~r),c=g?Math.max(1,Math.round(d*P)):Math.max(1,Math.round(F*P)),h=g?Math.max(1,Math.round(F*_)):Math.max(1,Math.round(d*_));switch(r){case o.R.Degree0:i=-Math.round(l*P),a=-Math.round(s*_);break;case o.R.Degree90:i=Math.round((m-d)*P),a=-Math.round(l*_);break;case o.R.Degree180:i=Math.round((u-F)*P),a=Math.round((m-d)*_);break;case o.R.Degree270:i=-Math.round(s*P),a=Math.round((u-F)*_);break;default:i=-Math.round(l*P),a=-Math.round(s*_)}return{startX:i,startY:a,formsWidth:c,formsHeight:h,scaleX:P,scaleY:_}}(b,n,t.size,a);this.pdfiumModule.FPDF_FFLDraw(e,p,c.pagePtr,r,i,l,s,a,M)})}finally{c.release(),this.memoryManager.free(A),this.memoryManager.free(E)}this.logger.perf(G,S,"RenderRectEncodedData","Begin",`${e.id}-${t.index}`);let y=this.pdfiumModule.pdfium.HEAPU8.subarray(D,D+g);this.logger.perf(G,S,"RenderRectEncodedData","End",`${e.id}-${t.index}`),this.logger.perf(G,S,"RenderRectEncodedImageData","Begin",`${e.id}-${t.index}`);let C={data:new Uint8ClampedArray(y),width:d,height:P};return this.logger.perf(G,S,"RenderRectEncodedImageData","End",`${e.id}-${t.index}`),i.resolve(C),this.pdfiumModule.FPDFBitmap_Destroy(p),this.memoryManager.free(D),i}readPdfLinkAnnoTarget(e,t,n){let r=n();if(r)return{type:"destination",destination:this.readPdfDestination(e,r)};{let n=t();if(n)return{type:"action",action:this.readPdfAction(e,n)}}}createLocalDestPtr(e,t){var n,r;let i=this.pdfiumModule.FPDF_LoadPage(e,t.pageIndex);if(!i)return 0;try{if(t.zoom.mode===o.L.XYZ){let{x:e,y:n,zoom:r}=t.zoom.params;return this.pdfiumModule.EPDFDest_CreateXYZ(i,!0,e,!0,n,!0,r)}let e,a=[];switch(t.zoom.mode){case o.L.FitPage:e=o.L.FitPage;break;case o.L.FitHorizontal:e=o.L.FitHorizontal,a=[(null==(n=t.view)?void 0:n[0])??0];break;case o.L.FitVertical:e=o.L.FitVertical,a=[(null==(r=t.view)?void 0:r[0])??0];break;case o.L.FitRectangle:{let n=t.view??[];a=[n[0]??0,n[1]??0,n[2]??0,n[3]??0],e=o.L.FitRectangle}break;case o.L.Unknown:default:return 0}return this.withFloatArray(a,(t,n)=>this.pdfiumModule.EPDFDest_CreateView(i,e,t,n))}finally{this.pdfiumModule.FPDF_ClosePage(i)}}applyBookmarkTarget(e,t,n){if("destination"===n.type){let r=this.createLocalDestPtr(e,n.destination);return!!r&&!!this.pdfiumModule.EPDFBookmark_SetDest(e,t,r)}let r=n.action;switch(r.type){case o.M.Goto:{let n=this.createLocalDestPtr(e,r.destination);if(!n)return!1;let o=this.pdfiumModule.EPDFAction_CreateGoTo(e,n);return!!o&&!!this.pdfiumModule.EPDFBookmark_SetAction(e,t,o)}case o.M.URI:{let n=this.pdfiumModule.EPDFAction_CreateURI(e,r.uri);return!!n&&!!this.pdfiumModule.EPDFBookmark_SetAction(e,t,n)}case o.M.LaunchAppOrOpenFile:{let n=this.withWString(r.path,t=>this.pdfiumModule.EPDFAction_CreateLaunch(e,t));return!!n&&!!this.pdfiumModule.EPDFBookmark_SetAction(e,t,n)}case o.M.RemoteGoto:case o.M.Unsupported:default:return!1}}applyLinkTarget(e,t,n){if("destination"===n.type){let r=this.createLocalDestPtr(e,n.destination);if(!r)return!1;let o=this.pdfiumModule.EPDFAction_CreateGoTo(e,r);return!!o&&!!this.pdfiumModule.EPDFAnnot_SetAction(t,o)}let r=n.action;switch(r.type){case o.M.Goto:{let n=this.createLocalDestPtr(e,r.destination);if(!n)return!1;let o=this.pdfiumModule.EPDFAction_CreateGoTo(e,n);return!!o&&!!this.pdfiumModule.EPDFAnnot_SetAction(t,o)}case o.M.URI:{let n=this.pdfiumModule.EPDFAction_CreateURI(e,r.uri);return!!n&&!!this.pdfiumModule.EPDFAnnot_SetAction(t,n)}case o.M.LaunchAppOrOpenFile:{let n=this.withWString(r.path,t=>this.pdfiumModule.EPDFAction_CreateLaunch(e,t));return!!n&&!!this.pdfiumModule.EPDFAnnot_SetAction(t,n)}case o.M.RemoteGoto:case o.M.Unsupported:default:return!1}}readPdfAction(e,t){let n;switch(this.pdfiumModule.FPDFAction_GetType(t)){case o.M.Unsupported:n={type:o.M.Unsupported};break;case o.M.Goto:{let r=this.pdfiumModule.FPDFAction_GetDest(e,t);if(r){let t=this.readPdfDestination(e,r);n={type:o.M.Goto,destination:t}}else n={type:o.M.Unsupported}}break;case o.M.RemoteGoto:n={type:o.M.Unsupported};break;case o.M.URI:{let r=m(this.pdfiumModule.pdfium,(n,r)=>this.pdfiumModule.FPDFAction_GetURIPath(e,t,n,r),this.pdfiumModule.pdfium.UTF8ToString);n={type:o.M.URI,uri:r}}break;case o.M.LaunchAppOrOpenFile:{let e=m(this.pdfiumModule.pdfium,(e,n)=>this.pdfiumModule.FPDFAction_GetFilePath(t,e,n),this.pdfiumModule.pdfium.UTF8ToString);n={type:o.M.LaunchAppOrOpenFile,path:e}}}return n}readPdfDestination(e,t){let n=this.pdfiumModule.FPDFDest_GetDestPageIndex(e,t),r=this.memoryManager.malloc(4),i=this.memoryManager.malloc(16),a=this.pdfiumModule.FPDFDest_GetView(t,r,i),l=this.pdfiumModule.pdfium.getValue(r,"i32"),s=[];for(let e=0;e<l;e++){let t=i+4*e;s.push(this.pdfiumModule.pdfium.getValue(t,"float"))}if(this.memoryManager.free(r),this.memoryManager.free(i),a===o.L.XYZ){let e=this.memoryManager.malloc(1),r=this.memoryManager.malloc(1),o=this.memoryManager.malloc(1),i=this.memoryManager.malloc(4),l=this.memoryManager.malloc(4),u=this.memoryManager.malloc(4);if(this.pdfiumModule.FPDFDest_GetLocationInPage(t,e,r,o,i,l,u)){let t=this.pdfiumModule.pdfium.getValue(e,"i8"),m=this.pdfiumModule.pdfium.getValue(r,"i8"),F=this.pdfiumModule.pdfium.getValue(o,"i8"),d=t?this.pdfiumModule.pdfium.getValue(i,"float"):0,P=m?this.pdfiumModule.pdfium.getValue(l,"float"):0,_=F?this.pdfiumModule.pdfium.getValue(u,"float"):0;return this.memoryManager.free(e),this.memoryManager.free(r),this.memoryManager.free(o),this.memoryManager.free(i),this.memoryManager.free(l),this.memoryManager.free(u),{pageIndex:n,zoom:{mode:a,params:{x:d,y:P,zoom:_}},view:s}}return this.memoryManager.free(e),this.memoryManager.free(r),this.memoryManager.free(o),this.memoryManager.free(i),this.memoryManager.free(l),this.memoryManager.free(u),{pageIndex:n,zoom:{mode:a,params:{x:0,y:0,zoom:0}},view:s}}return{pageIndex:n,zoom:{mode:a},view:s}}readPdfAttachment(e,t){let n=this.pdfiumModule.FPDFDoc_GetAttachment(e,t),r=m(this.pdfiumModule.pdfium,(e,t)=>this.pdfiumModule.FPDFAttachment_GetName(n,e,t),this.pdfiumModule.pdfium.UTF16ToString),o=m(this.pdfiumModule.pdfium,(e,t)=>this.pdfiumModule.EPDFAttachment_GetDescription(n,e,t),this.pdfiumModule.pdfium.UTF16ToString),i=m(this.pdfiumModule.pdfium,(e,t)=>this.pdfiumModule.FPDFAttachment_GetSubtype(n,e,t),this.pdfiumModule.pdfium.UTF16ToString),a=this.getAttachmentDate(n,"CreationDate"),l=m(this.pdfiumModule.pdfium,(e,t)=>this.pdfiumModule.FPDFAttachment_GetStringValue(n,"Checksum",e,t),this.pdfiumModule.pdfium.UTF16ToString);return{index:t,name:r,description:o,mimeType:i,size:this.getAttachmentNumber(n,"Size"),creationDate:a,checksum:l}}readPageBoxes(e,t,n){let r=r=>{if(this.pdfiumModule.EPDF_GetPageBoxByIndex(e,t,r,n))return{left:this.pdfiumModule.pdfium.getValue(n,"float"),top:this.pdfiumModule.pdfium.getValue(n+4,"float"),right:this.pdfiumModule.pdfium.getValue(n+8,"float"),bottom:this.pdfiumModule.pdfium.getValue(n+12,"float")}},o=r(0),i=r(1);if(!o||!i)return;let a={media:o,crop:i},l=r(2);l&&(a.bleed=l);let s=r(3);s&&(a.trim=s);let u=r(4);return u&&(a.art=u),a}getPageOrigin(e){var t;let n=null==(t=e.boxes)?void 0:t.crop;return n?{x:n.left,y:n.bottom}:{x:0,y:0}}convertDevicePointToPagePoint(e,t,n){let r,o=t.size.width,i=t.size.height,a=e.normalizedRotation?0:3&t.rotation,l=this.getPageOrigin(t);return{x:(r=0===a?{x:n.x,y:i-n.y}:1===a?{x:n.y,y:n.x}:2===a?{x:o-n.x,y:n.y}:{x:i-n.y,y:o-n.x}
1).x+l.x,y:r.y+l.y}}convertPagePointToDevicePoint(e,t,n){let r=t.size.width,o=t.size.height,i=e.normalizedRotation?0:3&t.rotation,a=this.getPageOrigin(t),l=n.x-a.x,s=n.y-a.y;return 0===i?{x:l,y:o-s}:1===i?{x:s,y:l}:2===i?{x:r-l,y:s}:{x:r-s,y:o-l}}convertPageRectToDeviceRect(e,t,n){let{x:r,y:o}=this.convertPagePointToDevicePoint(e,t,{x:n.left,y:n.top});return{origin:{x:r,y:o},size:{width:Math.abs(n.right-n.left),height:Math.abs(n.top-n.bottom)}}}readPageAnnoAppearanceStreams(e){return{normal:this.readPageAnnoAppearanceStream(e,o.E.Normal),rollover:this.readPageAnnoAppearanceStream(e,o.E.Rollover),down:this.readPageAnnoAppearanceStream(e,o.E.Down)}}readPageAnnoAppearanceStream(e,t=o.E.Normal){let n=2*(this.pdfiumModule.FPDFAnnot_GetAP(e,t,0,0)+1),r=this.memoryManager.malloc(n);this.pdfiumModule.FPDFAnnot_GetAP(e,t,r,n);let i=this.pdfiumModule.pdfium.UTF16ToString(r);return this.memoryManager.free(r),i}setPageAnnoAppearanceStream(e,t=o.E.Normal,n){let r=2*(n.length+1),i=this.memoryManager.malloc(r);try{return this.pdfiumModule.pdfium.stringToUTF16(n,i,r),!!this.pdfiumModule.FPDFAnnot_SetAP(e,t,i)}finally{this.memoryManager.free(i)}}setPageAnnoRect(e,t,n,r){let o=r.origin.x,i=r.origin.y,a=r.origin.x+r.size.width,l=r.origin.y+r.size.height,s=this.convertDevicePointToPagePoint(e,t,{x:o,y:i}),u=this.convertDevicePointToPagePoint(e,t,{x:a,y:i}),m=this.convertDevicePointToPagePoint(e,t,{x:a,y:l}),F=this.convertDevicePointToPagePoint(e,t,{x:o,y:l}),d=Math.min(s.x,u.x,m.x,F.x),P=Math.max(s.x,u.x,m.x,F.x),_=Math.min(s.y,u.y,m.y,F.y),g=Math.max(s.y,u.y,m.y,F.y);d>P&&([d,P]=[P,d]),_>g&&([_,g]=[g,_]);let c=this.memoryManager.malloc(16),h=this.pdfiumModule.pdfium;h.setValue(c+0,d,"float"),h.setValue(c+4,g,"float"),h.setValue(c+8,P,"float"),h.setValue(c+12,_,"float");let D=this.pdfiumModule.FPDFAnnot_SetRect(n,c);return this.memoryManager.free(c),!!D}readPageAnnoRect(e){let t=this.memoryManager.malloc(16),n={left:0,top:0,right:0,bottom:0};return this.pdfiumModule.EPDFAnnot_GetRect(e,t)&&(n.left=this.pdfiumModule.pdfium.getValue(t,"float"),n.top=this.pdfiumModule.pdfium.getValue(t+4,"float"),n.right=this.pdfiumModule.pdfium.getValue(t+8,"float"),n.bottom=this.pdfiumModule.pdfium.getValue(t+12,"float")),this.memoryManager.free(t),n}getHighlightRects(e,t,n,r,o){let i=this.pdfiumModule.FPDFText_CountRects(n,r,o),a=[],l=this.memoryManager.malloc(8),s=this.memoryManager.malloc(8),u=this.memoryManager.malloc(8),m=this.memoryManager.malloc(8);for(let r=0;r<i;r++){if(!this.pdfiumModule.FPDFText_GetRect(n,r,l,s,u,m))continue;let o=this.pdfiumModule.pdfium.getValue(l,"double"),i=this.pdfiumModule.pdfium.getValue(s,"double"),F=this.pdfiumModule.pdfium.getValue(u,"double"),d=this.pdfiumModule.pdfium.getValue(m,"double"),P=this.convertPagePointToDevicePoint(e,t,{x:o,y:i}),_=this.convertPagePointToDevicePoint(e,t,{x:F,y:i}),g=this.convertPagePointToDevicePoint(e,t,{x:F,y:d}),c=this.convertPagePointToDevicePoint(e,t,{x:o,y:d}),h=[P.x,_.x,g.x,c.x],D=[P.y,_.y,g.y,c.y],p=Math.min(...h),f=Math.min(...D),b=Math.max(...h)-p,A=Math.max(...D)-f;a.push({origin:{x:p,y:f},size:{width:Math.ceil(b),height:Math.ceil(A)}})}return this.memoryManager.free(l),this.memoryManager.free(s),this.memoryManager.free(u),this.memoryManager.free(m),a}searchInPage(e,t,n,r){this.logger.debug(G,S,"searchInPage",e,t,n,r),this.logger.perf(G,S,"SearchInPage","Begin",`${e.id}-${t.index}`);let i=this.cache.getContext(e.id);if(!i)return this.logger.perf(G,S,"PreparePrintDocument","End",e.id),o.a.reject({code:o.P.DocNotOpen,message:"Document is not open"});let a=2*(n.length+1),l=this.memoryManager.malloc(a);this.pdfiumModule.pdfium.stringToUTF16(n,l,a);try{let n=this.searchAllInPage(e,i,t,l,r);return o.a.resolve(n)}finally{this.memoryManager.free(l)}}getAnnotationsBatch(e,t){this.logger.debug(G,S,"getAnnotationsBatch",e.id,t.length);let n=new o.T;return queueMicrotask(()=>{this.logger.perf(G,S,"GetAnnotationsBatch","Begin",e.id);let r=this.cache.getContext(e.id);if(!r)return void n.reject({code:o.P.DocNotOpen,message:"Document is not open"});let i={},a=t.length,l=this.pdfiumModule.PDFiumExt_OpenFormFillInfo(),s=this.pdfiumModule.PDFiumExt_InitFormFillEnvironment(r.docPtr,l);try{for(let o=0;o<t.length;o++){let l=t[o],u=this.readPageAnnotationsRaw(e,r,l,s);i[l.index]=u,n.progress({pageIndex:l.index,result:u,completed:o+1,total:a})}}finally{this.pdfiumModule.PDFiumExt_ExitFormFillEnvironment(s),this.pdfiumModule.PDFiumExt_CloseFormFillInfo(l)}this.logger.perf(G,S,"GetAnnotationsBatch","End",e.id),n.resolve(i)}),n}searchBatch(e,t,n,r){this.logger.debug(G,S,"searchBatch",e.id,t.length,n);let i=new o.T;return queueMicrotask(()=>{this.logger.perf(G,S,"SearchBatch","Begin",e.id);let a=this.cache.getContext(e.id);if(!a)return void i.reject({code:o.P.DocNotOpen,message:"Document is not open"});let l=2*(n.length+1),s=this.memoryManager.malloc(l);this.pdfiumModule.pdfium.stringToUTF16(n,s,l);try{let n={},o=t.length;for(let l=0;l<t.length;l++){let u=t[l],m=this.searchAllInPage(e,a,u,s,r);n[u.index]=m,i.progress({pageIndex:u.index,result:m,completed:l+1,total:o})}this.logger.perf(G,S,"SearchBatch","End",e.id),i.resolve(n)}finally{this.memoryManager.free(s)}}),i}buildContext(e,t,n,r=30){let o=/[\s\u00A0.,;:!?()\[\]{}<>/\\\-"'`"”\u2013\u2014]/,i=t;for(;i>0&&o.test(e[i-1]);)i--;let a=0;for(;i>0&&a<r;)i--,o.test(e[i])||a++;i=(t=>{for(;t>0&&!o.test(e[t-1]);)t--;return t})(i);let l=t+n;for(;l<e.length&&o.test(e[l]);)l++;for(a=0;l<e.length&&a<r;)o.test(e[l])||a++,l++;l=(t=>{for(;t<e.length&&!o.test(e[t]);)t++;return t})(l);let s=e.slice(i,t).replace(/\s+/g," ").trimStart(),u=e.slice(t,t+n),m=e.slice(t+n,l).replace(/\s+/g," ").trimEnd();return{before:this.tidy(s),match:this.tidy(u),after:this.tidy(m),truncatedLeft:i>0,truncatedRight:l<e.length}}tidy(e){return e.replace(/-\uFFFE\s*/g,"").replace(/[\uFFFE\u00AD\u200B\u2060\uFEFF]/g,"").replace(/\s+/g," ")}searchAllInPage(e,t,n,r,o){return t.borrowPage(n.index,t=>{let i=t.getTextPage(),a=this.pdfiumModule.FPDFText_CountChars(i),l=this.memoryManager.malloc(2*(a+1));this.pdfiumModule.FPDFText_GetText(i,0,a,l);let s=this.pdfiumModule.pdfium.UTF16ToString(l);this.memoryManager.free(l);let u=[],m=this.pdfiumModule.FPDFText_FindStart(i,r,o,0);for(;this.pdfiumModule.FPDFText_FindNext(m);){let t=this.pdfiumModule.FPDFText_GetSchResultIndex(m),r=this.pdfiumModule.FPDFText_GetSchCount(m),o=this.getHighlightRects(e,n,i,t,r),a=this.buildContext(s,t,r);u.push({pageIndex:n.index,charIndex:t,charCount:r,rects:o,context:a})}return this.pdfiumModule.FPDFText_FindClose(m),u})}preparePrintDocument(e,t){let{includeAnnotations:n=!0,pageRange:r=null}=t??{};this.logger.debug(G,S,"preparePrintDocument",e,t),this.logger.perf(G,S,"PreparePrintDocument","Begin",e.id);let i=this.cache.getContext(e.id);if(!i)return this.logger.perf(G,S,"PreparePrintDocument","End",e.id),o.a.reject({code:o.P.DocNotOpen,message:"Document is not open"});let a=this.pdfiumModule.FPDF_CreateNewDocument();if(!a)return this.logger.perf(G,S,"PreparePrintDocument","End",e.id),o.a.reject({code:o.P.CantCreateNewDoc,message:"Cannot create print document"});try{let t=this.sanitizePageRange(r,e.pageCount);if(!this.pdfiumModule.FPDF_ImportPages(a,i.docPtr,t??"",0))return this.pdfiumModule.FPDF_CloseDocument(a),this.logger.error(G,S,"Failed to import pages for printing"),this.logger.perf(G,S,"PreparePrintDocument","End",e.id),o.a.reject({code:o.P.CantImportPages,message:"Failed to import pages for printing"});if(!n){let t=this.removeAnnotationsFromPrintDocument(a);if(!t.success)return this.pdfiumModule.FPDF_CloseDocument(a),this.logger.error(G,S,`Failed to remove annotations: ${t.error}`),this.logger.perf(G,S,"PreparePrintDocument","End",e.id),o.a.reject({code:o.P.Unknown,message:`Failed to prepare print document: ${t.error}`});this.logger.debug(G,S,`Removed ${t.annotationsRemoved} annotations from ${t.pagesProcessed} pages`)}let l=this.saveDocument(a);return this.pdfiumModule.FPDF_CloseDocument(a),this.logger.perf(G,S,"PreparePrintDocument","End",e.id),o.a.resolve(l)}catch(t){return a&&this.pdfiumModule.FPDF_CloseDocument(a),this.logger.error(G,S,"preparePrintDocument failed",t),this.logger.perf(G,S,"PreparePrintDocument","End",e.id),o.a.reject({code:o.P.Unknown,message:t instanceof Error?t.message:"Failed to prepare print document"})}}removeAnnotationsFromPrintDocument(e){let t=0,n=0;try{let r=this.pdfiumModule.FPDF_GetPageCount(e);for(let o=0;o<r;o++){let r=this.pdfiumModule.EPDFPage_GetAnnotCountRaw(e,o);if(r<=0){n++;continue}let i=0;for(let n=r-1;n>=0;n--)this.pdfiumModule.EPDFPage_RemoveAnnotRaw(e,o,n)?(i++,t++):this.logger.warn(G,S,`Failed to remove annotation ${n} from page ${o}`);if(i>0){let t=this.pdfiumModule.FPDF_LoadPage(e,o);t&&(this.pdfiumModule.FPDFPage_GenerateContent(t),this.pdfiumModule.FPDF_ClosePage(t))}n++}return{success:!0,annotationsRemoved:t,pagesProcessed:n}}catch(e){return{success:!1,annotationsRemoved:t,pagesProcessed:n,error:e instanceof Error?e.message:"Unknown error during annotation removal"}}}sanitizePageRange(e,t){if(!e||""===e.trim())return null;try{let n=[];for(let r of e.split(",")){let e=r.trim();if(e.includes("-")){let[r,o]=e.split("-").map(e=>e.trim()),i=parseInt(r,10),a=parseInt(o,10);if(isNaN(i)||isNaN(a)){this.logger.warn(G,S,`Invalid range: ${e}`);continue}let l=Math.max(1,Math.min(i,t)),s=Math.max(1,Math.min(a,t));for(let e=l;e<=s;e++)n.includes(e)||n.push(e)}else{let r=parseInt(e,10);if(isNaN(r)){this.logger.warn(G,S,`Invalid page number: ${e}`);continue}let o=Math.max(1,Math.min(r,t));n.includes(o)||n.push(o)}}if(0===n.length)return this.logger.warn(G,S,"No valid pages in range, using all pages"),null;n.sort((e,t)=>
1e-t);let r=[],o=n[0],i=n[0];for(let e=1;e<n.length;e++)n[e]===i+1||(o===i?r.push(o.toString()):i-o==1?(r.push(o.toString()),r.push(i.toString())):r.push(`${o}-${i}`),o=n[e]),i=n[e];o===i?r.push(o.toString()):i-o==1?(r.push(o.toString()),r.push(i.toString())):r.push(`${o}-${i}`);let a=r.join(",");return this.logger.debug(G,S,`Sanitized page range: "${e}" -> "${a}"`),a}catch(e){return this.logger.error(G,S,`Error sanitizing page range: ${e}`),null}}}async function x(e,t){let n=await fetch(e),r=await n.arrayBuffer(),o=new C(await u({wasmBinary:r}),{logger:null==t?void 0:t.logger,fontFallback:null==t?void 0:t.fontFallback});return new i.P(o,{imageConverter:i.b,logger:null==t?void 0:t.logger})}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.