1import"./BMrxR1rr.js";import{f as dn,g as E,p as S,w as gt,l as ut,$ as v,H as lt,s as ht,a as Dt,V as oe,m as Mn,M as an,b as yn,X,Z as _e,T as tt,q as qe,Q as mt,v as St,d as Ct,K as Gn,L as Sn,D as Ie,y as Cn,e as sn,x as xt,h as xn,i as un,J as nt,n as Tn,o as On,U as Ve,j as Qe,I as Ft,k as ln,r as mn,t as Tt,O as vn,F as Rn,_ as kn,P as Te,N as me,u as wn}from"./FgZcHOKl.js";import{h as In,l as Bn}from"./BS2JuC9e.js";var Ot,jn=(Ot=import.meta.url,async function(Y={}){var t,n,o,e=Y,a=new Promise((r,i)=>{n=r,o=i
vendor: 16,658 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(
1r=>{Object.getOwnPropertyDescriptor(a,r)||Object.defineProperty(a,r,{get:()=>H("You are getting "+r+" 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:()=>H("You are setting "+r+" 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 u=typeof window=="object",l=typeof importScripts=="function";typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type;var F,P,_=!u&&!l,f=Object.assign({},e),p="./this.program",M="";if(_){if(typeof window=="object"||typeof importScripts=="function")throw new 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?)");P=r=>{if(typeof readbuffer=="function")return new Uint8Array(readbuffer(r));let i=read(r,"binary");return x(typeof i=="object"),i},F=r=>new Promise((i,m)=>{setTimeout(()=>i(P(r)))}),globalThis.clearTimeout??=r=>{},globalThis.setTimeout??=r=>typeof r=="function"?r():H(),typeof print<"u"&&(globalThis.console??={},console.log=print,console.warn=console.error=globalThis.printErr??print)}else{if(!u&&!l)throw new Error("environment detection error");
1if(l?M=self.location.href:typeof document<"u"&&document.currentScript&&(M=document.currentScript.src),Ot&&(M=Ot),M=M.startsWith("blob:")?"":M.substr(0,M.replace(/[?#].*/,"").lastIndexOf("/")+1),typeof window!="object"&&typeof importScripts!="function")throw new 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?)");l&&(P=r=>{var i=new XMLHttpRequest;return i.open("GET",r,!1),i.responseType="arraybuffer",i.send(null),new Uint8Array(i.response)}),F=r=>(x(!Le(r),"readAsync does not work with file:// URLs"),fetch(r,{credentials:"same-origin"}).then(i=>i.ok?i.arrayBuffer():Promise.reject(new Error(i.status+" : "+i.url))))}var y,T=e.print||console.log.bind(console),C=e.printErr||console.error.bind(console);Object.assign(e,f),f=null,y="fetchSettings",Object.getOwnPropertyDescriptor(e,y)&&H(`\`Module.${y}\` was supplied but \`${y}\` not included in INCOMING_MODULE_JS_API`),e.arguments&&e.arguments,ze("arguments","arguments_"),e.thisProgram&&(p=e.thisProgram),ze("thisProgram","thisProgram"),x(e.memoryInitializerPrefixURL===void 0,"Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"),x(e.pthreadMainPrefixURL===void 0,"Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"),x(e.cdInitializerPrefixURL===void 0,"Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"),x(e.filePackagePrefixURL===void 0,"Module.filePackagePrefixURL option was removed, use Module.locateFile instead"),x(e.read===void 0,"Module.read option was removed"),x(e.readAsync===void 0,"Module.readAsync option was removed (modify readAsync in JS)"),x(e.readBinary===void 0,"Module.readBinary option was removed (modify readBinary in JS)"),x(e.setWindowTitle===void 0,"Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)"),x(e.TOTAL_MEMORY===void 0,"Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"),ze("asm","wasmExports"),ze("readAsync","readAsync"),ze("readBinary","readBinary"),ze("setWindowTitle","setWindowTitle");var R,N=e.wasmBinary;ze("wasmBinary","wasmBinary"),typeof WebAssembly!="object"&&C("no native wasm support detected");var V,K,z,q,k,$,ae,J,se=!1;function x(r,i){r||H("Assertion failed"+(i?": "+i:""))}function ge(){var r=R.buffer;e.HEAP8=V=new Int8Array(r),e.HEAP16=z=new Int16Array(r),e.HEAPU8=K=new Uint8Array(r),e.HEAPU16=q=new Uint16Array(r),e.HEAP32=k=new Int32Array(r),e.HEAPU32=$=new Uint32Array(r),e.HEAPF32=ae=new Float32Array(r),e.HEAPF64=J=new Float64Array(r)}function Pe(){if(!se){var r=Gt();r==0&&(r+=4);var i=$[r>>2],m=$[r+4>>2];i==34821223&&m==2310721022||H(`Stack overflow! Stack cookie has been overwritten at ${ot(r)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${ot(m)} ${ot(i)}`),$[0]!=1668509029&&H("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(typeof Int32Array<"u"&&typeof Float64Array<"u"&&Int32Array.prototype.subarray!=null&&Int32Array.prototype.set!=null,"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 be=[],Be=[],Me=[],he=!1;function Oe(r){be.unshift(r)}function ve(r){Me.unshift(r)}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 de=0,De=null,ye=null,Ae={};function Re(r){for(var i=r;;){if(!Ae[r])return r;r=i+Math.random()}}function Ge(r){de++,e.monitorRunDependencies?.(de),r?(x(!Ae[r]),Ae[r]=1,De===null&&typeof setInterval<"u"&&(De=setInterval(()=>{if(se)return clearInterval(De),void(De=null);var i=!1;for(var m in Ae)i||(i=!0,C("still waiting on run dependencies:")),C(`dependency: ${m}`);i&&C("(end of list)")},1e4))):C("warning: run dependency added without ID")}function ce(r){if(de--,e.monitorRunDependencies?.(de),r?(x(Ae[r]),delete Ae[r]):C("warning: run dependency removed without ID"),de==0&&(De!==null&&(clearInterval(De),De=null),ye)){var i=ye;ye=null,i()}}function H(r){e.onAbort?.(r),C(r="Aborted("+r+")"),se=!0;var i=new WebAssembly.RuntimeError(r);throw o(i),i}var Se,U,ne,je=r=>r.startsWith("data:application/octet-stream;base64,"),Le=r=>r.startsWith("file://");function s(r,i){return(...m)=>{x(he,`native function \`${r}\` called before runtime initialization`);var c=fe[r];return x(c,`exported native function \`${r}\` not found`),x(m.length<=i,`native function \`${r}\` called with ${m.length} args but expects ${i}`),c(...m)}}function cn(){if(e.locateFile){var r="pdfium.wasm";return je(r)?r:(i=r,e.locateFile?e.locateFile(i,M):M+i)}var i;
1return _?"pdfium.wasm":new URL(""+new URL("pdfium.BJ2Yip8Q.wasm",import.meta.url).href,import.meta.url).href}function It(r){if(r==Se&&N)return new Uint8Array(N);if(P)return P(r);throw"both async and sync fetching of the wasm failed"}function Bt(r,i,m){return(function(c){return N?Promise.resolve().then(()=>It(c)):F(c).then(g=>new Uint8Array(g),()=>It(c))})(r).then(c=>WebAssembly.instantiate(c,i)).then(m,c=>{C(`failed to asynchronously prepare wasm: ${c}`),Le(Se)&&C(`warning: Loading from a file URI (${Se}) 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`),H(c)})}if((()=>{var r=new Int16Array(1),i=new Int8Array(r.buffer);if(r[0]=25459,i[0]!==115||i[1]!==99)throw"Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)"})(),e.ENVIRONMENT)throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)");function ze(r,i,m=!0){Object.getOwnPropertyDescriptor(e,r)||Object.defineProperty(e,r,{configurable:!0,get(){H(`\`Module.${r}\` has been replaced by \`${i}\``+(m?" (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 jt(r){return r==="FS_createPath"||r==="FS_createDataFile"||r==="FS_createPreloadedFile"||r==="FS_unlink"||r==="addRunDependency"||r==="FS_createLazyFile"||r==="FS_createDevice"||r==="removeRunDependency"}function Lt(r,i){typeof globalThis>"u"||Object.getOwnPropertyDescriptor(globalThis,r)||Object.defineProperty(globalThis,r,{configurable:!0,get(){i()}})}function Nt(r,i){Lt(r,()=>{We(`\`${r}\` is not longer defined by emscripten. ${i}`)})}function Vt(r){Object.getOwnPropertyDescriptor(e,r)||Object.defineProperty(e,r,{configurable:!0,get(){var i=`'${r}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`;jt(r)&&(i+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"),H(i)}})}Nt("buffer","Please use HEAP8.buffer or wasmMemory.buffer"),Nt("asm","Please use wasmExports instead");var ft=r=>{r.forEach(i=>i(e))};e.noExitRuntime;var ot=r=>(x(typeof r=="number"),"0x"+(r>>>=0).toString(16).padStart(8,"0")),Ce=r=>tn(r),xe=()=>on(),We=r=>{We.shown||={},We.shown[r]||(We.shown[r]=1,C(r))},Ut=typeof TextDecoder<"u"?new TextDecoder:void 0,Ze=(r,i=0,m=NaN)=>{for(var c=i+m,g=i;r[g]&&!(g>=c);)++g;if(g-i>16&&r.buffer&&Ut)return Ut.decode(r.subarray(i,g));for(var b="";i<g;){var A=r[i++];if(128&A){var G=63&r[i++];if((224&A)!=192){var O=63&r[i++];if((240&A)==224?A=(15&A)<<12|G<<6|O:((248&A)!=240&&We("Invalid UTF-8 leading byte "+ot(A)+" encountered when deserializing a UTF-8 string in wasm memory to a JS string!"),A=(7&A)<<18|G<<12|O<<6|63&r[i++]),A<65536)b+=String.fromCharCode(A);else{var B=A-65536;b+=String.fromCharCode(55296|B>>10,56320|1023&B)}}else b+=String.fromCharCode((31&A)<<6|G)}else b+=String.fromCharCode(A)}return b},He=(r,i)=>(x(typeof r=="number",`UTF8ToString expects a number (got ${typeof r})`),r?Ze(K,r,i):"");function dt(){x(Q.varargs!=null);var r=k[+Q.varargs>>2];return Q.varargs+=4,r}var et=dt,ee={isAbs:r=>r.charAt(0)==="/",splitPath:r=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(r).slice(1),normalizeArray:(r,i)=>{for(var m=0,c=r.length-1;c>=0;c--){var g=r[c];g==="."?r.splice(c,1):g===".."?(r.splice(c,1),m++):m&&(r.splice(c,1),m--)}if(i)for(;m;m--)r.unshift("..");return r},normalize:r=>{var i=ee.isAbs(r),m=r.substr(-1)==="/";return(r=ee.normalizeArray(r.split("/").filter(c=>!!c),!i).join("/"))||i||(r="."),r&&m&&(r+="/"),(i?"/":"")+r},dirname:r=>{var i=ee.splitPath(r),m=i[0],c=i[1];return m||c?(c&&(c=c.substr(0,c.length-1)),m+c):"."},basename:r=>{if(r==="/")return"/";var i=(r=(r=ee.normalize(r)).replace(/\/$/,"")).lastIndexOf("/");return i===-1?r:r.substr(i+1)},join:(...r)=>ee.normalize(r.join("/")),join2:(r,i)=>ee.normalize(r+"/"+i)},$t=r=>($t=(()=>
1{if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return i=>crypto.getRandomValues(i);H("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 } };")})())(r),Ne={resolve:(...r)=>{for(var i="",m=!1,c=r.length-1;c>=-1&&!m;c--){var g=c>=0?r[c]:d.cwd();if(typeof g!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!g)return"";i=g+"/"+i,m=ee.isAbs(g)}return(m?"/":"")+(i=ee.normalizeArray(i.split("/").filter(b=>!!b),!m).join("/"))||"."},relative:(r,i)=>{function m(B){for(var j=0;j<B.length&&B[j]==="";j++);for(var w=B.length-1;w>=0&&B[w]==="";w--);return j>w?[]:B.slice(j,w-j+1)}r=Ne.resolve(r).substr(1),i=Ne.resolve(i).substr(1);for(var c=m(r.split("/")),g=m(i.split("/")),b=Math.min(c.length,g.length),A=b,G=0;G<b;G++)if(c[G]!==g[G]){A=G;break}var O=[];for(G=A;G<c.length;G++)O.push("..");return(O=O.concat(g.slice(A))).join("/")}},pt=[],rt=r=>{for(var i=0,m=0;m<r.length;++m){var c=r.charCodeAt(m);c<=127?i++:c<=2047?i+=2:c>=55296&&c<=57343?(i+=4,++m):i+=3}return i},bt=(r,i,m,c)=>{if(x(typeof r=="string",`stringToUTF8Array expects a string (got ${typeof r})`),!(c>0))return 0;for(var g=m,b=m+c-1,A=0;A<r.length;++A){var G=r.charCodeAt(A);if(G>=55296&&G<=57343&&(G=65536+((1023&G)<<10)|1023&r.charCodeAt(++A)),G<=127){if(m>=b)break;i[m++]=G}else if(G<=2047){if(m+1>=b)break;i[m++]=192|G>>6,i[m++]=128|63&G}else if(G<=65535){if(m+2>=b)break;i[m++]=224|G>>12,i[m++]=128|G>>6&63,i[m++]=128|63&G}else{if(m+3>=b)break;G>1114111&&We("Invalid Unicode code point "+ot(G)+" encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF)."),i[m++]=240|G>>18,i[m++]=128|G>>12&63,i[m++]=128|G>>6&63,i[m++]=128|63&G}}return i[m]=0,m-g};function zt(r,i,m){var c=rt(r)+1,g=new Array(c),b=bt(r,g,0,g.length);return g.length=b,g}var Ue,Ke,Xe={ttys:[],init(){},shutdown(){},register(r,i){Xe.ttys[r]={input:[],output:[],ops:i},d.registerDevice(r,Xe.stream_ops)},stream_ops:{open(r){var i=Xe.ttys[r.node.rdev];if(!i)throw new d.ErrnoError(43);r.tty=i,r.seekable=!1},close(r){r.tty.ops.fsync(r.tty)},fsync(r){r.tty.ops.fsync(r.tty)},read(r,i,m,c,g){if(!r.tty||!r.tty.ops.get_char)throw new d.ErrnoError(60);for(var b=0,A=0;A<c;A++){var G;try{G=r.tty.ops.get_char(r.tty)}catch{throw new d.ErrnoError(29)}if(G===void 0&&b===0)throw new d.ErrnoError(6);if(G==null)break;b++,i[m+A]=G}return b&&(r.node.timestamp=Date.now()),b},write(r,i,m,c,g){if(!r.tty||!r.tty.ops.put_char)throw new d.ErrnoError(60);try{for(var b=0;b<c;b++)r.tty.ops.put_char(r.tty,i[m+b])}catch{throw new d.ErrnoError(29)}return c&&(r.node.timestamp=Date.now()),b}},default_tty_ops:{get_char:r=>(()=>{if(!pt.length){var i=null;if(typeof window<"u"&&typeof window.prompt=="function"?(i=window.prompt("Input: "))!==null&&(i+=` 2`):typeof readline=="function"&&(i=readline())&&(i+=` 3`),!i)return null;pt=zt(i)}return pt.shift()})(),put_char(r,i){i===null||i===10?(T(Ze(r.output)),r.output=[]):i!=0&&r.output.push(i)},fsync(r){r.output&&r.output.length>0&&(T(Ze(r.output)),r.output=[])},ioctl_tcgets:r=>({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:(r,i,m)=>0,ioctl_tiocgwinsz:r=>[24,80]},default_tty1_ops:{put_char(r,i){i===null||i===10?(C(Ze(r.output)),r.output=[]):i!=0&&r.output.push(i)},fsync(r){r.output&&r.output.length>0&&(C(Ze(r.output)),r.output=[])}}},Wt=(r,i)=>(x(i,"alignment argument is required"),Math.ceil(r/i)*i),Ht=r=>{r=Wt(r,65536);var i=An(65536,r);return i&&((m,c)=>{K.fill(0,m,m+c)})(i,r),i},W={ops_table:null,mount:r=>W.createNode(null,"/",16895,0),createNode(r,i,m,c){if(d.isBlkdev(m)||d.isFIFO(m))throw new d.ErrnoError(63);W.ops_table||={dir:{node:{getattr:W.node_ops.getattr,setattr:W.node_ops.setattr,lookup:W.node_ops.lookup,mknod:W.node_ops.mknod,rename:W.node_ops.rename,unlink:W.node_ops.unlink,rmdir:W.node_ops.rmdir,readdir:W.no
3de_ops.readdir,symlink:W.node_ops.symlink},stream:{llseek:W.stream_ops.llseek}},file:{node:{getattr:W.node_ops.getattr,setattr:W.node_ops.setattr},stream:{llseek:W.stream_ops.llseek,read:W.stream_ops.read,write:W.stream_ops.write,allocate:W.stream_ops.allocate,mmap:W.stream_ops.mmap,msync:W.stream_ops.msync}},link:{node:{getattr:W.node_ops.getattr,setattr:W.node_ops.setattr,readlink:W.node_ops.readlink},stream:{}},chrdev:{node:{getattr:W.node_ops.getattr,setattr:W.node_ops.setattr},stream:d.chrdev_stream_ops}};var g=d.createNode(r,i,m,c);return d.isDir(g.mode)?(g.node_ops=W.ops_table.dir.node,g.stream_ops=W.ops_table.dir.stream,g.contents={}):d.isFile(g.mode)?(g.node_ops=W.ops_table.file.node,g.stream_ops=W.ops_table.file.stream,g.usedBytes=0,g.contents=null):d.isLink(g.mode)?(g.node_ops=W.ops_table.link.node,g.stream_ops=W.ops_table.link.stream):d.isChrdev(g.mode)&&(g.node_ops=W.ops_table.chrdev.node,g.stream_ops=W.ops_table.chrdev.stream),g.timestamp=Date.now(),r&&(r.contents[i]=g,r.timestamp=g.timestamp),g},getFileDataAsTypedArray:r=>r.contents?r.contents.subarray?r.contents.subarray(0,r.usedBytes):new Uint8Array(r.contents):new Uint8Array(0),expandFileStorage(r,i){var m=r.contents?r.contents.length:0;if(!(m>=i)){i=Math.max(i,m*(m<1048576?2:1.125)>>>0),m!=0&&(i=Math.max(i,256));var c=r.contents;r.contents=new Uint8Array(i),r.usedBytes>0&&r.contents.set(c.subarray(0,r.usedBytes),0)}},resizeFileStorage(r,i){if(r.usedBytes!=i)if(i==0)r.contents=null,r.usedBytes=0;else{var m=r.contents;r.contents=new Uint8Array(i),m&&r.contents.set(m.subarray(0,Math.min(i,r.usedBytes))),r.usedBytes=i}},node_ops:{getattr(r){var i={};return i.dev=d.isChrdev(r.mode)?r.id:1,i.ino=r.id,i.mode=r.mode,i.nlink=1,i.uid=0,i.gid=0,i.rdev=r.rdev,d.isDir(r.mode)?i.size=4096:d.isFile(r.mode)?i.size=r.usedBytes:d.isLink(r.mode)?i.size=r.link.length:i.size=0,i.atime=new Date(r.timestamp),i.mtime=new Date(r.timestamp),i.ctime=new Date(r.timestamp),i.blksize=4096,i.blocks=Math.ceil(i.size/i.blksize),i},setattr(r,i){i.mode!==void 0&&(r.mode=i.mode),i.timestamp!==void 0&&(r.timestamp=i.timestamp),i.size!==void 0&&W.resizeFileStorage(r,i.size)},lookup(r,i){throw d.genericErrors[44]},mknod:(r,i,m,c)=>W.createNode(r,i,m,c),rename(r,i,m){if(d.isDir(r.mode)){var c;try{c=d.lookupNode(i,m)}catch{}if(c)for(var g in c.contents)throw new d.ErrnoError(55)}delete r.parent.contents[r.name],r.parent.timestamp=Date.now(),r.name=m,i.contents[m]=r,i.timestamp=r.parent.timestamp},unlink(r,i){delete r.contents[i],r.timestamp=Date.now()},rmdir(r,i){var m=d.lookupNode(r,i);for(var c in m.contents)throw new d.ErrnoError(55);delete r.contents[i],r.timestamp=Date.now()},readdir(r){var i=[".",".."];for(var m of Object.keys(r.contents))i.push(m);return i},symlink(r,i,m){var c=W.createNode(r,i,41471,0);return c.link=m,c},readlink(r){if(!d.isLink(r.mode))throw new d.ErrnoError(28);return r.link}},stream_ops:{read(r,i,m,c,g){var b=r.node.contents;if(g>=r.node.usedBytes)return 0;var A=Math.min(r.node.usedBytes-g,c);if(x(A>=0),A>8&&b.subarray)i.set(b.subarray(g,g+A),m);else for(var G=0;G<A;G++)i[m+G]=b[g+G];return A},write(r,i,m,c,g,b){if(x(!(i instanceof ArrayBuffer)),i.buffer===V.buffer&&(b=!1),!c)return 0;var A=r.node;if(A.timestamp=Date.now(),i.subarray&&(!A.contents||A.contents.subarray)){if(b)return x(g===0,"canOwn must imply no weird position inside the file"),A.contents=i.subarray(m,m+c),A.usedBytes=c,c;if(A.usedBytes===0&&g===0)return A.contents=i.slice(m,m+c),A.usedBytes=c,c;if(g+c<=A.usedBytes)return A.contents.set(i.subarray(m,m+c),g),c}if(W.expandFileStorage(A,g+c),A.contents.subarray&&i.subarray)A.contents.set(i.subarray(m,m+c),g);else for(var G=0;G<c;G++)A.contents[g+G]=i[m+G];return A.usedBytes=Math.max(A.usedBytes,g+c),c},llseek(r,i,m){var c=i;if(m===1?c+=r.position:m===2&&d.isFile(r.node.mode)&&(c+=r.node.usedBytes),c<0)throw new d.ErrnoError(28);return c},allocate(r,i,m){W.expandFileStorage(r.node,i+m),r.node.usedBytes=Math.max(r.node.usedBytes,i+m)},mmap(r,i,m,c,g){if(!d.isFile(r.node.mode))throw new d.ErrnoError(43);var b,A,G=r.node.contents;if(2&g||!G||G.buffer!==V.buffer){if(A=!0,!(b=Ht(i)))throw new d.ErrnoError(48);G&&((m>
vendor: 4,100 bytes, line 3
30||m+i<G.length)&&(G=G.subarray?G.subarray(m,m+i):Array.prototype.slice.call(G,m,m+i)),V.set(G,b))}else A=!1,b=G.byteOffset;return{ptr:b,allocated:A}},msync:(r,i,m,c,g)=>(W.stream_ops.write(r,i,0,c,m,!1),0)}},Pn=e.preloadPlugins||[],At=(r,i)=>{var m=0;return r&&(m|=365),i&&(m|=146),m},Kt={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},d={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:class extends Error{constructor(r){for(var i in super(he?(m=>He(pn(m)))(r):""),this.name="ErrnoError",this.errno=r,Kt)if(Kt[i]===r){this.code=i;break}}},genericErrors:{},filesystems:null,syncFSRequests:0,readFiles:{},FSStream:class{constructor(){this.shared={}}get object(){return this.node}set object(r){this.node=r}get isRead(){return(2097155&this.flags)!=1}get isWrite(){return!!(2097155&this.flags)}get isAppend(){return 1024&this.flags}get flags(){return this.shared.flags}set flags(r){this.shared.flags=r}get position(){return this.shared.position}set position(r){this.shared.position=r}},FSNode:class{constructor(r,i,m,c){r||(r=this),this.parent=r,this.mount=r.mount,this.mounted=null,this.id=d.nextInode++,this.name=i,this.mode=m,this.node_ops={},this.stream_ops={},this.rdev=c,this.readMode=365,this.writeMode=146}get read(){return(this.mode&this.readMode)===this.readMode}set read(r){r?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(r){r?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return d.isDir(this.mode)}get isDevice(){return d.isChrdev(this.mode)}},lookupPath(r,i={}){if(!(r=Ne.resolve(r)))return{path:"",node:null};if((i=Object.assign({follow_mount:!0,recurse_count:0},i)).recurse_count>8)throw new d.ErrnoError(32);for(var m=r.split("/").filter(B=>!!B),c=d.root,g="/",b=0;b<m.length;b++){var A=b===m.length-1;if(A&&i.parent)break;if(c=d.lookupNode(c,m[b]),g=ee.join2(g,m[b]),d.isMountpoint(c)&&(!A||A&&i.follow_mount)&&(c=c.mounted.root),!A||i.follow)for(var G=0;d.isLink(c.mode);){var O=d.readlink(g);if(g=Ne.resolve(ee.dirname(g),O),c=d.lookupPath(g,{recurse_count:i.recurse_count+1}).node,G++>40)throw new d.ErrnoError(32)}}return{path:g,node:c}},getPath(r){for(var i;;){if(d.isRoot(r)){var m=r.mount.mountpoint;return i?m[m.length-1]!=="/"?`${m}/${i}`:m+i:m}i=i?`${r.name}/${i}`:r.name,r=r.parent}},hashName(r,i){for(var m=0,c=0;c<i.length;c++)m=(m<<5)-m+i.charCodeAt(c)|0;return(r+m>>>0)%d.nameTable.length},hashAddNode(r){var i=d.hashName(r.parent.id,r.name);r.name_next=d.nameTable[i],d.nameTable[i]=r},hashRemoveNode(r){var i=d.hashName(r.parent.id,r.name);if(d.nameTable[i]===r)d.nameTable[i]=r.name_next;else for(var m=d.nameTable[i];m;
vendor: 6,833 bytes, line 3
3){if(m.name_next===r){m.name_next=r.name_next;break}m=m.name_next}},lookupNode(r,i){var m=d.mayLookup(r);if(m)throw new d.ErrnoError(m);for(var c=d.hashName(r.id,i),g=d.nameTable[c];g;g=g.name_next){var b=g.name;if(g.parent.id===r.id&&b===i)return g}return d.lookup(r,i)},createNode(r,i,m,c){x(typeof r=="object");var g=new d.FSNode(r,i,m,c);return d.hashAddNode(g),g},destroyNode(r){d.hashRemoveNode(r)},isRoot:r=>r===r.parent,isMountpoint:r=>!!r.mounted,isFile:r=>(61440&r)==32768,isDir:r=>(61440&r)==16384,isLink:r=>(61440&r)==40960,isChrdev:r=>(61440&r)==8192,isBlkdev:r=>(61440&r)==24576,isFIFO:r=>(61440&r)==4096,isSocket:r=>!(49152&~r),flagsToPermissionString(r){var i=["r","w","rw"][3&r];return 512&r&&(i+="w"),i},nodePermissions:(r,i)=>d.ignorePermissions||(!i.includes("r")||292&r.mode)&&(!i.includes("w")||146&r.mode)&&(!i.includes("x")||73&r.mode)?0:2,mayLookup(r){if(!d.isDir(r.mode))return 54;var i=d.nodePermissions(r,"x");return i||(r.node_ops.lookup?0:2)},mayCreate(r,i){try{return d.lookupNode(r,i),20}catch{}return d.nodePermissions(r,"wx")},mayDelete(r,i,m){var c;try{c=d.lookupNode(r,i)}catch(b){return b.errno}var g=d.nodePermissions(r,"wx");if(g)return g;if(m){if(!d.isDir(c.mode))return 54;if(d.isRoot(c)||d.getPath(c)===d.cwd())return 10}else if(d.isDir(c.mode))return 31;return 0},mayOpen:(r,i)=>r?d.isLink(r.mode)?32:d.isDir(r.mode)&&(d.flagsToPermissionString(i)!=="r"||512&i)?31:d.nodePermissions(r,d.flagsToPermissionString(i)):44,MAX_OPEN_FDS:4096,nextfd(){for(var r=0;r<=d.MAX_OPEN_FDS;r++)if(!d.streams[r])return r;throw new d.ErrnoError(33)},getStreamChecked(r){var i=d.getStream(r);if(!i)throw new d.ErrnoError(8);return i},getStream:r=>d.streams[r],createStream:(r,i=-1)=>(x(i>=-1),r=Object.assign(new d.FSStream,r),i==-1&&(i=d.nextfd()),r.fd=i,d.streams[i]=r,r),closeStream(r){d.streams[r]=null},dupStream(r,i=-1){var m=d.createStream(r,i);return m.stream_ops?.dup?.(m),m},chrdev_stream_ops:{open(r){var i=d.getDevice(r.node.rdev);r.stream_ops=i.stream_ops,r.stream_ops.open?.(r)},llseek(){throw new d.ErrnoError(70)}},major:r=>r>>8,minor:r=>255&r,makedev:(r,i)=>r<<8|i,registerDevice(r,i){d.devices[r]={stream_ops:i}},getDevice:r=>d.devices[r],getMounts(r){for(var i=[],m=[r];m.length;){var c=m.pop();i.push(c),m.push(...c.mounts)}return i},syncfs(r,i){typeof r=="function"&&(i=r,r=!1),d.syncFSRequests++,d.syncFSRequests>1&&C(`warning: ${d.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var m=d.getMounts(d.root.mount),c=0;function g(A){return x(d.syncFSRequests>0),d.syncFSRequests--,i(A)}function b(A){if(A)return b.errored?void 0:(b.errored=!0,g(A));++c>=m.length&&g(null)}m.forEach(A=>{if(!A.type.syncfs)return b(null);A.type.syncfs(A,r,b)})},mount(r,i,m){if(typeof r=="string")throw r;var c,g=m==="/",b=!m;if(g&&d.root)throw new d.ErrnoError(10);if(!g&&!b){var A=d.lookupPath(m,{follow_mount:!1});if(m=A.path,c=A.node,d.isMountpoint(c))throw new d.ErrnoError(10);if(!d.isDir(c.mode))throw new d.ErrnoError(54)}var G={type:r,opts:i,mountpoint:m,mounts:[]},O=r.mount(G);return O.mount=G,G.root=O,g?d.root=O:c&&(c.mounted=G,c.mount&&c.mount.mounts.push(G)),O},unmount(r){var i=d.lookupPath(r,{follow_mount:!1});if(!d.isMountpoint(i.node))throw new d.ErrnoError(28);var m=i.node,c=m.mounted,g=d.getMounts(c);Object.keys(d.nameTable).forEach(A=>{for(var G=d.nameTable[A];G;){var O=G.name_next;g.includes(G.mount)&&d.destroyNode(G),G=O}}),m.mounted=null;var b=m.mount.mounts.indexOf(c);x(b!==-1),m.mount.mounts.splice(b,1)},lookup:(r,i)=>r.node_ops.lookup(r,i),mknod(r,i,m){var c=d.lookupPath(r,{parent:!0}).node,g=ee.basename(r);if(!g||g==="."||g==="..")throw new d.ErrnoError(28);var b=d.mayCreate(c,g);if(b)throw new d.ErrnoError(b);if(!c.node_ops.mknod)throw new d.ErrnoError(63);return c.node_ops.mknod(c,g,i,m)},create:(r,i)=>(i=i!==void 0?i:438,i&=4095,i|=32768,d.mknod(r,i,0)),mkdir:(r,i)=>(i=i!==void 0?i:511,i&=1023,i|=16384,d.mknod(r,i,0)),mkdirTree(r,i){for(var m=r.split("/"),c="",g=0;g<m.length;++g)if(m[g]){c+="/"+m[g];try{d.mkdir(c,i)}catch(b){if(b.errno!=20)throw b}}},mkdev:(r,i,m)=>(m===void 0&&(m=i,i=438),i|=8192,d.mknod(r,i,m)),symlink(r,i){if(!Ne.resolve(r))throw new d.ErrnoError(44);var m=d.lookupPath(i,{parent:!0}).node;if(!m)throw new d.ErrnoError(44);var c=ee.basename(i),g=d.mayCreate(m,c);if(g)throw new d.ErrnoError(g);if(!m.node_ops.symlink)throw new d.ErrnoError(63);return m.node_ops.symlink(m,c,r)},rename(r,i){var m,c,g=ee.dirname(r),b=ee.dirname(i),A=ee.basename(r),G=ee.basename(i);if(m=d.lookupPath(r,{parent:!0}).node,c=d.lookupPath(i,{parent:!0}).node,!m||!c)throw new d.ErrnoError(44);if(m.mount!==c.mount)throw new d.ErrnoError(75);var O,B=d.lookupNode(m,A),j=Ne.relative(r,b);if(j.charAt(0)!==".")throw new d.ErrnoError(28);if((j=Ne.relative(i,g)).charAt(0)!==".")throw new d.ErrnoError(55);try{O=d.lookupNode(c,G)}catch{}if(B!==O){var w=d.isDir(B.mode),I=d.mayDelete(m,A,w);if(I)throw new d.ErrnoError(I);if(I=O?d.mayDelete(c,G,w):d.mayCreate(c,G))throw new d.ErrnoError(I);if(!m.node_ops.rename)throw new d.ErrnoError(63);if(d.isMountpoint(B)||O&&d.isMountpoint(O))throw new d.ErrnoError(10);if(c!==m&&(I=d.nodePermissions(m,"w")))throw new d.ErrnoError(I);d.hashRemoveNode(B);try{m.node_ops.rename(B,c,G),B.parent=c}catch(L){throw L}finally{d.hashAddNode(B)}}},rmdir(r){var i=d.lookupPath(r,{parent:!0}).node,m=ee.basename(r),c=d.lookupNode(i,m),g=d.mayDelete(i,m,!0);if(g)throw new d.ErrnoError(g);if(!i.node_ops.rmdir)throw new d.ErrnoError(63);if(d.isMountpoint(c))throw new d.ErrnoError(10);i.node_ops.rmdir(i,m),d.destroyNode(c)},readdir(r){var i=d.lookupPath(r,{follow:!0}).node;if(!i.node_ops.readdir)throw new d.ErrnoError(54);return i.node_ops.readdir(i)},unlink(r){var i=d.lookupPath(r,{parent:!0}).node;if(!i)throw new d.ErrnoError(44);var m=ee.basename(r),c=d.lookupNode(i,m),g=d.mayDelete(i,m,!1);if(g)throw new d.ErrnoError(g);if(!i.node_ops.unlink)throw new d.ErrnoError(63);if(d.isMountpoint(c))throw new d.ErrnoError(10);i.node_ops.unlink(i,m),d.destroyNode(c)},readlink(r){var i=d.lookupPath(r).node;if(!i)throw new d.ErrnoError(44);if(!i.node_ops.readlink)throw new d.ErrnoError(28);return Ne.resolve(d.getPath(i.parent),i.node_ops.readlink(i))},stat(r,i){var m=d.lookupPath(r,{follow:!i}).node;if(!m)throw new d.ErrnoError(44);if(!m.node_ops.getattr)throw new d.ErrnoError(63);return m.node_ops.getattr(m)},lstat:r=>d.stat(r,!0),chmod(r,i,m){var c;if(!(c=typeof r=="string"?d.lookupPath(r,{follow:!m}).node:r).node_ops.setattr)throw new d.ErrnoError(63);c.node_ops.setattr(c,{mode:4095&i|-4096&c.mode,timestamp:Date.now()})},lchmod(r,i){d.chmod(r,i,!0)},fchmod(r,i){var m=d.getStreamChecked(r);d.chmod(m.node,i)},chown(r,i,m,c){var g;if(!(g=typeof r=="string"?d.lookupPath(r,{follow:!c}).node:r).node_ops.setattr)throw new d.ErrnoError(63);g.node_ops.setattr(g,{timestamp:Date.now()})}
3,lchown(r,i,m){d.chown(r,i,m,!0)},fchown(r,i,m){var c=d.getStreamChecked(r);d.chown(c.node,i,m)},truncate(r,i){if(i<0)throw new d.ErrnoError(28);var m;if(!(m=typeof r=="string"?d.lookupPath(r,{follow:!0}).node:r).node_ops.setattr)throw new d.ErrnoError(63);if(d.isDir(m.mode))throw new d.ErrnoError(31);if(!d.isFile(m.mode))throw new d.ErrnoError(28);var c=d.nodePermissions(m,"w");if(c)throw new d.ErrnoError(c);m.node_ops.setattr(m,{size:i,timestamp:Date.now()})},ftruncate(r,i){var m=d.getStreamChecked(r);if(!(2097155&m.flags))throw new d.ErrnoError(28);d.truncate(m.node,i)},utime(r,i,m){var c=d.lookupPath(r,{follow:!0}).node;c.node_ops.setattr(c,{timestamp:Math.max(i,m)})},open(r,i,m){if(r==="")throw new d.ErrnoError(44);var c;if(m=64&(i=typeof i=="string"?(G=>{var O={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[G];if(O===void 0)throw new Error(`Unknown file open mode: ${G}`);return O})(i):i)?4095&(m=m===void 0?438:m)|32768:0,typeof r=="object")c=r;else{r=ee.normalize(r);try{c=d.lookupPath(r,{follow:!(131072&i)}).node}catch{}}var g=!1;if(64&i)if(c){if(128&i)throw new d.ErrnoError(20)}else c=d.mknod(r,m,0),g=!0;if(!c)throw new d.ErrnoError(44);if(d.isChrdev(c.mode)&&(i&=-513),65536&i&&!d.isDir(c.mode))throw new d.ErrnoError(54);if(!g){var b=d.mayOpen(c,i);if(b)throw new d.ErrnoError(b)}512&i&&!g&&d.truncate(c,0),i&=-131713;var A=d.createStream({node:c,path:d.getPath(c),flags:i,seekable:!0,position:0,stream_ops:c.stream_ops,ungotten:[],error:!1});return A.stream_ops.open&&A.stream_ops.open(A),!e.logReadFiles||1&i||r in d.readFiles||(d.readFiles[r]=1),A},close(r){if(d.isClosed(r))throw new d.ErrnoError(8);r.getdents&&(r.getdents=null);try{r.stream_ops.close&&r.stream_ops.close(r)}catch(i){throw i}finally{d.closeStream(r.fd)}r.fd=null},isClosed:r=>r.fd===null,llseek(r,i,m){if(d.isClosed(r))throw new d.ErrnoError(8);if(!r.seekable||!r.stream_ops.llseek)throw new d.ErrnoError(70);if(m!=0&&m!=1&&m!=2)throw new d.ErrnoError(28);return r.position=r.stream_ops.llseek(r,i,m),r.ungotten=[],r.position},read(r,i,m,c,g){if(x(m>=0),c<0||g<0)throw new d.ErrnoError(28);if(d.isClosed(r))throw new d.ErrnoError(8);if((2097155&r.flags)==1)throw new d.ErrnoError(8);if(d.isDir(r.node.mode))throw new d.ErrnoError(31);if(!r.stream_ops.read)throw new d.ErrnoError(28);var b=g!==void 0;if(b){if(!r.seekable)throw new d.ErrnoError(70)}else g=r.position;var A=r.stream_ops.read(r,i,m,c,g);return b||(r.position+=A),A},write(r,i,m,c,g,b){if(x(m>=0),c<0||g<0)throw new d.ErrnoError(28);if(d.isClosed(r))throw new d.ErrnoError(8);if(!(2097155&r.flags))throw new d.ErrnoError(8);if(d.isDir(r.node.mode))throw new d.ErrnoError(31);if(!r.stream_ops.write)throw new d.ErrnoError(28);r.seekable&&1024&r.flags&&d.llseek(r,0,2);var A=g!==void 0;if(A){if(!r.seekable)throw new d.ErrnoError(70)}else g=r.position;var G=r.stream_ops.write(r,i,m,c,g,b);return A||(r.position+=G),G},allocate(r,i,m){if(d.isClosed(r))throw new d.ErrnoError(8);if(i<0||m<=0)throw new d.ErrnoError(28);if(!(2097155&r.flags))throw new d.ErrnoError(8);if(!d.isFile(r.node.mode)&&!d.isDir(r.node.mode))throw new d.ErrnoError(43);if(!r.stream_ops.allocate)throw new d.ErrnoError(138);r.stream_ops.allocate(r,i,m)},mmap(r,i,m,c,g){if(2&c&&!(2&g)&&(2097155&r.flags)!=2)throw new d.ErrnoError(2);if((2097155&r.flags)==1)throw new d.ErrnoError(2);if(!r.stream_ops.mmap)throw new d.ErrnoError(43);if(!i)throw new d.ErrnoError(28);return r.stream_ops.mmap(r,i,m,c,g)},msync:(r,i,m,c,g)=>(x(m>=0),r.stream_ops.msync?r.stream_ops.msync(r,i,m,c,g):0),ioctl(r,i,m){if(!r.stream_ops.ioctl)throw new d.ErrnoError(59);return r.stream_ops.ioctl(r,i,m)},readFile(r,i={}){if(i.flags=i.flags||0,i.encoding=i.encoding||"binary",i.encoding!=="utf8"&&i.encoding!=="binary")throw new Error(`Invalid encoding type "${i.encoding}"`);var m,c=d.open(r,i.flags),g=d.stat(r).size,b=new Uint8Array(g);return d.read(c,b,0,g,0),i.encoding==="utf8"?m=Ze(b):i.encoding==="binary"&&(m=b),d.close(c),m},writeFile(r,i,m={}){m.flags=m.flags||577;var c=d.open(r,m.flags,m.mode);if(typeof i=="string"){var g=new Uint8Array(rt(i)+1),b=bt(i,g,0,g.length);d.write(c,g,0,b,void 0,m.canOwn)}else{if(!ArrayBuffer.isView(i))throw new Error("Unsupported data type");d.write(c,i,0,i.byteLength,void 0,m.canOwn)}d.close(c)},cwd:()=>d.currentPath,chdir(r){var i=d.lookupPath(r,{follow:!0});if(i.node===null)throw new d.ErrnoError(44);if(!d.isDir(i.node.mode))throw new d.ErrnoError(54);var m=d.nodePermissions(i.node,"x");if(m)throw new d.ErrnoError(m);d.currentPath=i.path},createDefaultDirectories(){d.mkdir("/tmp"),d.mkdir("/home"),d.mkdir("/home/web_user")},createDefaultDevices(){d.mkdir("/dev"),d.registerDevice(d.makedev(1,3),{read:()=>0,write:(c,g,b,A,G)=>A}),d.mkdev("/dev/null",d.makedev(1,3)),Xe.register(d.makedev(5,0),Xe.default_tty_ops),Xe.register(d.makedev(6,0),Xe.default_tty1_ops),d.mkdev("/dev/tty",d.makedev(5,0)),d.mkdev("/dev/tty1",d.makedev(6,0));
3var r=new Uint8Array(1024),i=0,m=()=>(i===0&&(i=$t(r).byteLength),r[--i]);d.createDevice("/dev","random",m),d.createDevice("/dev","urandom",m),d.mkdir("/dev/shm"),d.mkdir("/dev/shm/tmp")},createSpecialDirectories(){d.mkdir("/proc");var r=d.mkdir("/proc/self");d.mkdir("/proc/self/fd"),d.mount({mount(){var i=d.createNode(r,"fd",16895,73);return i.node_ops={lookup(m,c){var g=+c,b=d.getStreamChecked(g),A={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>b.path}};return A.parent=A,A}},i}},{},"/proc/self/fd")},createStandardStreams(r,i,m){r?d.createDevice("/dev","stdin",r):d.symlink("/dev/tty","/dev/stdin"),i?d.createDevice("/dev","stdout",null,i):d.symlink("/dev/tty","/dev/stdout"),m?d.createDevice("/dev","stderr",null,m):d.symlink("/dev/tty1","/dev/stderr");var c=d.open("/dev/stdin",0),g=d.open("/dev/stdout",1),b=d.open("/dev/stderr",1);x(c.fd===0,`invalid handle for stdin (${c.fd})`),x(g.fd===1,`invalid handle for stdout (${g.fd})`),x(b.fd===2,`invalid handle for stderr (${b.fd})`)},staticInit(){[44].forEach(r=>{d.genericErrors[r]=new d.ErrnoError(r),d.genericErrors[r].stack="<generic error, no stack>"}),d.nameTable=new Array(4096),d.mount(W,{},"/"),d.createDefaultDirectories(),d.createDefaultDevices(),d.createSpecialDirectories(),d.filesystems={MEMFS:W}},init(r,i,m){x(!d.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)"),d.initialized=!0,r??=e.stdin,i??=e.stdout,m??=e.stderr,d.createStandardStreams(r,i,m)},quit(){d.initialized=!1,bn(0);for(var r=0;r<d.streams.length;r++){var i=d.streams[r];i&&d.close(i)}},findObject(r,i){var m=d.analyzePath(r,i);return m.exists?m.object:null},analyzePath(r,i){try{r=(c=d.lookupPath(r,{follow:!i})).path}catch{}var m={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var c=d.lookupPath(r,{parent:!0});m.parentExists=!0,m.parentPath=c.path,m.parentObject=c.node,m.name=ee.basename(r),c=d.lookupPath(r,{follow:!i}),m.exists=!0,m.path=c.path,m.object=c.node,m.name=c.node.name,m.isRoot=c.path==="/"}catch(g){m.error=g.errno}return m},createPath(r,i,m,c){r=typeof r=="string"?r:d.getPath(r);for(var g=i.split("/").reverse();g.length;){var b=g.pop();if(b){var A=ee.join2(r,b);try{d.mkdir(A)}catch{}r=A}}return A},createFile(r,i,m,c,g){var b=ee.join2(typeof r=="string"?r:d.getPath(r),i),A=At(c,g);return d.create(b,A)},createDataFile(r,i,m,c,g,b){var A=i;r&&(r=typeof r=="string"?r:d.getPath(r),A=i?ee.join2(r,i):r);var G=At(c,g),O=d.create(A,G);if(m){if(typeof m=="string"){for(var B=new Array(m.length),j=0,w=m.length;j<w;++j)B[j]=m.charCodeAt(j);m=B}d.chmod(O,146|G);var I=d.open(O,577);d.write(I,m,0,m.length,0,b),d.close(I),d.chmod(O,G)}},createDevice(r,i,m,c){var g=ee.join2(typeof r=="string"?r:d.getPath(r),i),b=At(!!m,!!c);d.createDevice.major??=64;var A=d.makedev(d.createDevice.major++,0);return d.registerDevice(A,{open(G){G.seekable=!1},close(G){c?.buffer?.length&&c(10)},read(G,O,B,j,w){for(var I=0,L=0;L<j;L++){var te;try{te=m()}catch{throw new d.ErrnoError(29)}if(te===void 0&&I===0)throw new d.ErrnoError(6);if(te==null)break;I++,O[B+L]=te}return I&&(G.node.timestamp=Date.now()),I},write(G,O,B,j,w){for(var I=0;I<j;I++)try{c(O[B+I])}catch{throw new d.ErrnoError(29)}return j&&(G.node.timestamp=Date.now()),I}}),d.mkdev(g,b,A)},forceLoadFile(r){if(r.isDevice||r.isFolder||r.link||r.contents)return!0;if(typeof XMLHttpRequest<"u")throw new 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{r.contents=P(r.url),r.usedBytes=r.contents.length}catch{throw new d.ErrnoError(29)}},createLazyFile(r,i,m,c,g){class b{constructor(){this.lengthKnown=!1,this.chunks=[]}get(w){if(!(w>this.length-1||w<0)){var I=w%this.chunkSize,L=w/this.chunkSize|0;return this.getter(L)[I]}}setDataGetter(w){this.getter=w}cacheLength(){var w=new XMLHttpRequest;if(w.open("HEAD",m,!1),w.send(null),!(w.status>=200&&w.status<300||w.status===304))throw new Error("Couldn't load "+m+". Status: "+w.status);var I,L=Number(w.getResponseHeader("Content-length")),te=(I=w.getResponseHeader("Accept-Ranges"))&&I==="bytes",Z=(I=w.getResponseHeader("Content-Encoding"))&&I==="gzip",re=1048576;te||(re=L);var ie=this;ie.setDataGetter(we=>{var Je=we*re,$e=(we+1)*re-1;if($e=Math.min($e,L-1),ie.chunks[we]===void 0&&(ie.chunks[we]=((st,_t)=>{if(st>_t)throw new Error("invalid range ("+st+", "+_t+") or no bytes requested!");if(_t>L-1)throw new Error("only "+L+" bytes available! programmer error!");var pe=new XMLHttpRequest;if(pe.open("GET",m,!1),L!==re&&pe.setRequestHeader("Range","bytes="+st+"-"+_t),pe.responseType="arraybuffer",pe.overrideMimeType&&pe.overrideMimeType("text/plain;
3 charset=x-user-defined"),pe.send(null),!(pe.status>=200&&pe.status<300||pe.status===304))throw new Error("Couldn't load "+m+". Status: "+pe.status);return pe.response!==void 0?new Uint8Array(pe.response||[]):zt(pe.responseText||"")})(Je,$e)),ie.chunks[we]===void 0)throw new Error("doXHR failed!");return ie.chunks[we]}),!Z&&L||(re=L=1,L=this.getter(0).length,re=L,T("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=L,this._chunkSize=re,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(typeof XMLHttpRequest<"u"){if(!l)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 b}}else A={isDevice:!1,url:m};var G=d.createFile(r,i,A,c,g);A.contents?G.contents=A.contents:A.url&&(G.contents=null,G.url=A.url),Object.defineProperties(G,{usedBytes:{get:function(){return this.contents.length}}});var O={};function B(j,w,I,L,te){var Z=j.node.contents;if(te>=Z.length)return 0;var re=Math.min(Z.length-te,L);if(x(re>=0),Z.slice)for(var ie=0;ie<re;ie++)w[I+ie]=Z[te+ie];else for(ie=0;ie<re;ie++)w[I+ie]=Z.get(te+ie);return re}return Object.keys(G.stream_ops).forEach(j=>{var w=G.stream_ops[j];O[j]=(...I)=>(d.forceLoadFile(G),w(...I))}),O.read=(j,w,I,L,te)=>(d.forceLoadFile(G),B(j,w,I,L,te)),O.mmap=(j,w,I,L,te)=>{d.forceLoadFile(G);var Z=Ht(w);if(!Z)throw new d.ErrnoError(48);return B(j,V,Z,w,I),{ptr:Z,allocated:!0}},G.stream_ops=O,G},absolutePath(){H("FS.absolutePath has been removed; use PATH_FS.resolve instead")},createFolder(){H("FS.createFolder has been removed; use FS.mkdir instead")},createLink(){H("FS.createLink has been removed; use FS.symlink instead")},joinPath(){H("FS.joinPath has been removed; use PATH.join instead")},mmapAlloc(){H("FS.mmapAlloc has been replaced by the top level function mmapAlloc")},standardizePath(){H("FS.standardizePath has been removed; use PATH.normalize instead")}},Q={DEFAULT_POLLMASK:5,calculateAt(r,i,m){if(ee.isAbs(i))return i;var c;if(c=r===-100?d.cwd():Q.getStreamFromFD(r).path,i.length==0){if(!m)throw new d.ErrnoError(44);return c}return ee.join2(c,i)},doStat(r,i,m){var c=r(i);k[m>>2]=c.dev,k[m+4>>2]=c.mode,$[m+8>>2]=c.nlink,k[m+12>>2]=c.uid,k[m+16>>2]=c.gid,k[m+20>>2]=c.rdev,ne=[c.size>>>0,(U=c.size,+Math.abs(U)>=1?U>0?+Math.floor(U/4294967296)>>>0:~~+Math.ceil((U-+(~~U>>>0))/4294967296)>>>0:0)],k[m+24>>2]=ne[0],k[m+28>>2]=ne[1],k[m+32>>2]=4096,k[m+36>>2]=c.blocks;var g=c.atime.getTime(),b=c.mtime.getTime(),A=c.ctime.getTime();return ne=[Math.floor(g/1e3)>>>0,(U=Math.floor(g/1e3),+Math.abs(U)>=1?U>0?+Math.floor(U/4294967296)>>>0:~~+Math.ceil((U-+(~~U>>>0))/4294967296)>>>0:0)],k[m+40>>2]=ne[0],k[m+44>>2]=ne[1],$[m+48>>2]=g%1e3*1e3*1e3,ne=[Math.floor(b/1e3)>>>0,(U=Math.floor(b/1e3),+Math.abs(U)>=1?U>0?+Math.floor(U/4294967296)>>>0:~~+Math.ceil((U-+(~~U>>>0))/4294967296)>>>0:0)],k[m+56>>2]=ne[0],k[m+60>>2]=ne[1],$[m+64>>2]=b%1e3*1e3*1e3,ne=[Math.floor(A/1e3)>>>0,(U=Math.floor(A/1e3),+Math.abs(U)>=1?U>0?+Math.floor(U/4294967296)>>>0:~~+Math.ceil((U-+(~~U>>>0))/4294967296)>>>0:0)],k[m+72>>2]=ne[0],k[m+76>>2]=ne[1],$[m+80>>2]=A%1e3*1e3*1e3,ne=[c.ino>>>0,(U=c.ino,+Math.abs(U)>=1?U>0?+Math.floor(U/4294967296)>>>0:~~+Math.ceil((U-+(~~U>>>0))/4294967296)>>>0:0)],k[m+88>>2]=ne[0],k[m+92>>2]=ne[1],0},doMsync(r,i,m,c,g){if(!d.isFile(i.node.mode))throw new d.ErrnoError(43);if(2&c)return 0;var b=K.slice(r,r+m);d.msync(i,b,g,m,c)},getStreamFromFD:r=>d.getStreamChecked(r),varargs:void 0,getStr:r=>He(r)},ct=(r,i)=>(x(r==r>>>0||r==(0|r)),x(i===(0|i)),i+2097152>>>0<4194305-!!r?(r>>>0)+4294967296*i:NaN),Ye=(r,i,m)=>(x(typeof m=="number","stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),bt(r,K,i,m)),_n=[0,31,60,91,121,152,182,213,244,274,305,335],gn=[0,31,59,90,120,151,181,212,243,273,304,334],hn=r=>{var i=R.buffer,m=(r-i.byteLength+65535)/65536|0;try{return R.grow(m),ge(),1}catch(c){C(`growMemory: Attempted to grow heap from ${i.byteLength} bytes to ${r} bytes, but got error: ${c}`)}},Et={},at=()=>{if(!at.strings){var r={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:p||"./this.program"};for(var i in Et)Et[i]===void 0?delete r[i]:r[i]=Et[i];var m=[];for(var i in r)m.push(`${i}=${r[i]}`);at.strings=m}return at.strings},it=[],Ee=r=>{var i=it[r];
3return i||(r>=it.length&&(it.length=r+1),it[r]=i=Ue.get(r)),x(Ue.get(r)==i,"JavaScript-side Wasm function table mirror is out of date!"),i},Xt=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0,Yt=(r,i)=>{x(r<16384),r<128?i.push(r):i.push(r%128|128,r>>7)},Dn=(r,i)=>{if(x(!i.includes("j"),"i64 not permitted in function signatures when WASM_BIGINT is disabled"),typeof WebAssembly.Function=="function")return new WebAssembly.Function((b=>{x(!b.includes("j"),"i64 not permitted in function signatures when WASM_BIGINT is disabled");for(var A={i:"i32",j:"i64",f:"f32",d:"f64",e:"externref",p:"i32"},G={parameters:[],results:b[0]=="v"?[]:[A[b[0]]]},O=1;O<b.length;++O)x(b[O]in A,"invalid signature char: "+b[O]),G.parameters.push(A[b[O]]);return G})(i),r);var m=[1];((b,A)=>{var G=b.slice(0,1),O=b.slice(1),B={i:127,p:127,j:126,f:125,d:124,e:111};A.push(96),Yt(O.length,A);for(var j=0;j<O.length;++j)x(O[j]in B,"invalid signature char: "+O[j]),A.push(B[O[j]]);G=="v"?A.push(0):A.push(1,B[G])})(i,m);var c=[0,97,115,109,1,0,0,0,1];Yt(m.length,c),c.push(...m),c.push(2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0);var g=new WebAssembly.Module(new Uint8Array(c));return new WebAssembly.Instance(g,{e:{f:r}}).exports.f},fn=r=>(Ke||(Ke=new WeakMap,((i,m)=>{if(Ke)for(var c=i;c<i+m;c++){var g=Ee(c);g&&Ke.set(g,c)}})(0,Ue.length)),Ke.get(r)||0),Mt=[],yt=(r,i)=>{Ue.set(r,i),it[r]=Ue.get(r)},Jt=r=>nn(r),qt=(r,i,m,c,g)=>{var b={string:I=>{var L=0;return I!=null&&I!==0&&(L=(te=>{var Z=rt(te)+1,re=Jt(Z);return Ye(te,re,Z),re})(I)),L},array:I=>{var L,te,Z=Jt(I.length);return te=Z,x((L=I).length>=0,"writeArrayToMemory array must have a length (should be an array or typed array)"),V.set(L,te),Z}},A=(I=>{var L=e["_"+I];return x(L,"Cannot call unknown function "+I+", make sure it is exported"),L})(r),G=[],O=0;if(x(i!=="array",'Return type should not be "array".'),c)for(var B=0;B<c.length;B++){var j=b[m[B]];j?(O===0&&(O=xe()),G[B]=j(c[B])):G[B]=c[B]}var w=A(...G);return w=(function(I){return O!==0&&Ce(O),(function(L){return i==="string"?He(L):i==="boolean"?!!L:L})(I)})(w)};d.createPreloadedFile=(r,i,m,c,g,b,A,G,O,B)=>{var j=i?Ne.resolve(ee.join2(r,i)):r,w=Re(`cp ${j}`);function I(L){function te(Z){B?.(),G||((re,ie,we,Je,$e,st)=>{d.createDataFile(re,ie,we,Je,$e,st)})(r,i,Z,c,g,O),b?.(),ce(w)}((Z,re,ie,we)=>{typeof Browser<"u"&&Browser.init();var Je=!1;return Pn.forEach($e=>{Je||$e.canHandle(re)&&($e.handle(Z,re,ie,we),Je=!0)}),Je})(L,j,te,()=>{A?.(),ce(w)})||te(L)}Ge(w),typeof m=="string"?((L,te,Z)=>{var re=Re(`al ${L}`);F(L).then(ie=>{x(ie,`Loading data file "${L}" failed (no arrayBuffer).`),te(new Uint8Array(ie)),re&&ce(re)},ie=>{if(!Z)throw`Loading data file "${L}" failed.`;Z()}),re&&Ge(re)})(m,I,A):I(m)},d.staticInit();var Qt={__assert_fail:(r,i,m,c)=>{H(`Assertion failed: ${He(r)}, at: `+[i?He(i):"unknown filename",m,c?He(c):"unknown function"])},__syscall_fcntl64:function(r,i,m){Q.varargs=m;try{var c=Q.getStreamFromFD(r);switch(i){case 0:if((g=dt())<0)return-28;for(;d.streams[g];)g++;return d.dupStream(c,g).fd;case 1:case 2:case 13:case 14:return 0;case 3:return c.flags;case 4:var g=dt();return c.flags|=g,0;case 12:return g=et(),z[g+0>>1]=2,0}return-28}catch(b){if(d===void 0||b.name!=="ErrnoError")throw b;return-b.errno}},__syscall_fstat64:function(r,i){try{var m=Q.getStreamFromFD(r);return Q.doStat(d.stat,m.path,i)}catch(c){if(d===void 0||c.name!=="ErrnoError")throw c;return-c.errno}},__syscall_ftruncate64:function(r,i,m){var c=ct(i,m);try{return isNaN(c)?61:(d.ftruncate(r,c),0)}catch(g){if(d===void 0||g.name!=="ErrnoError")throw g;return-g.errno}},__syscall_getdents64:function(r,i,m){try{var c=Q.getStreamFromFD(r);c.getdents||=d.readdir(c.path);for(var g=280,b=0,A=d.llseek(c,0,1),G=Math.floor(A/g);G<c.getdents.length&&b+g<=m;){var O,B,j=c.getdents[G];if(j===".")O=c.node.id,B=4;else if(j==="..")O=d.lookupPath(c.path,{parent:!0}).node.id,B=4;else{var w=d.lookupNode(c.node,j);O=w.id,B=d.isChrdev(w.mode)?2:d.isDir(w.mode)?4:d.isLink(w.mode)?10:8}x(O),ne=[O>>>0,(U=O,+Math.abs(U)>=1?U>0?+Math.floor(U/4294967296)>>>0:~~+Math.ceil((U-+(~~U>>>0))/4294967296)>>>0:0)],k[i+b>>2]=ne[0],k[i+b+4>>2]=ne[1],ne=[(G+1)*g>>>0,(U=(G+1)*g,+Math.abs(U)>=1?U>0?+Math.floor(U/4294967296)>>>0:~~+Math.ceil((U-+(~~U>>>0))/4294967296)>>>0:0)],k[i+b+8>>2]=ne[0],k[i+b+12>>2]=ne[1],z[i+b+16>>1]=280,V[i+b+18]=B,Ye(j,i+b+19,256),b+=g,G+=1}return d.llseek(c,G*g,0),b}
vendor: 7,892 bytes, line 3
3catch(I){if(d===void 0||I.name!=="ErrnoError")throw I;return-I.errno}},__syscall_ioctl:function(r,i,m){Q.varargs=m;try{var c=Q.getStreamFromFD(r);switch(i){case 21509:case 21510:case 21511:case 21512:case 21524:case 21515:return c.tty?0:-59;case 21505:if(!c.tty)return-59;if(c.tty.ops.ioctl_tcgets){var g=c.tty.ops.ioctl_tcgets(c),b=et();k[b>>2]=g.c_iflag||0,k[b+4>>2]=g.c_oflag||0,k[b+8>>2]=g.c_cflag||0,k[b+12>>2]=g.c_lflag||0;for(var A=0;A<32;A++)V[b+A+17]=g.c_cc[A]||0;return 0}return 0;case 21506:case 21507:case 21508:if(!c.tty)return-59;if(c.tty.ops.ioctl_tcsets){b=et();var G=k[b>>2],O=k[b+4>>2],B=k[b+8>>2],j=k[b+12>>2],w=[];for(A=0;A<32;A++)w.push(V[b+A+17]);return c.tty.ops.ioctl_tcsets(c.tty,i,{c_iflag:G,c_oflag:O,c_cflag:B,c_lflag:j,c_cc:w})}return 0;case 21519:return c.tty?(b=et(),k[b>>2]=0,0):-59;case 21520:return c.tty?-28:-59;case 21531:return b=et(),d.ioctl(c,i,b);case 21523:if(!c.tty)return-59;if(c.tty.ops.ioctl_tiocgwinsz){var I=c.tty.ops.ioctl_tiocgwinsz(c.tty);b=et(),z[b>>1]=I[0],z[b+2>>1]=I[1]}return 0;default:return-28}}catch(L){if(d===void 0||L.name!=="ErrnoError")throw L;return-L.errno}},__syscall_lstat64:function(r,i){try{return r=Q.getStr(r),Q.doStat(d.lstat,r,i)}catch(m){if(d===void 0||m.name!=="ErrnoError")throw m;return-m.errno}},__syscall_newfstatat:function(r,i,m,c){try{i=Q.getStr(i);var g=256&c,b=4096&c;return x(!(c&=-6401),`unknown flags in __syscall_newfstatat: ${c}`),i=Q.calculateAt(r,i,b),Q.doStat(g?d.lstat:d.stat,i,m)}catch(A){if(d===void 0||A.name!=="ErrnoError")throw A;return-A.errno}},__syscall_openat:function(r,i,m,c){Q.varargs=c;try{i=Q.getStr(i),i=Q.calculateAt(r,i);var g=c?dt():0;return d.open(i,m,g).fd}catch(b){if(d===void 0||b.name!=="ErrnoError")throw b;return-b.errno}},__syscall_rmdir:function(r){try{return r=Q.getStr(r),d.rmdir(r),0}catch(i){if(d===void 0||i.name!=="ErrnoError")throw i;return-i.errno}},__syscall_stat64:function(r,i){try{return r=Q.getStr(r),Q.doStat(d.stat,r,i)}catch(m){if(d===void 0||m.name!=="ErrnoError")throw m;return-m.errno}},__syscall_unlinkat:function(r,i,m){try{return i=Q.getStr(i),i=Q.calculateAt(r,i),m===0?d.unlink(i):m===512?d.rmdir(i):H("Invalid flags passed to unlinkat"),0}catch(c){if(d===void 0||c.name!=="ErrnoError")throw c;return-c.errno}},_abort_js:()=>{H("native code called abort()")},_emscripten_memcpy_js:(r,i,m)=>K.copyWithin(r,i,i+m),_emscripten_throw_longjmp:()=>{throw 1/0},_gmtime_js:function(r,i,m){var c=ct(r,i),g=new Date(1e3*c);k[m>>2]=g.getUTCSeconds(),k[m+4>>2]=g.getUTCMinutes(),k[m+8>>2]=g.getUTCHours(),k[m+12>>2]=g.getUTCDate(),k[m+16>>2]=g.getUTCMonth(),k[m+20>>2]=g.getUTCFullYear()-1900,k[m+24>>2]=g.getUTCDay();var b=Date.UTC(g.getUTCFullYear(),0,1,0,0,0,0),A=(g.getTime()-b)/864e5|0;k[m+28>>2]=A},_localtime_js:function(r,i,m){var c=ct(r,i),g=new Date(1e3*c);k[m>>2]=g.getSeconds(),k[m+4>>2]=g.getMinutes(),k[m+8>>2]=g.getHours(),k[m+12>>2]=g.getDate(),k[m+16>>2]=g.getMonth(),k[m+20>>2]=g.getFullYear()-1900,k[m+24>>2]=g.getDay();var b=0|(j=>{var w;return((w=j.getFullYear())%4!=0||w%100==0&&w%400!=0?gn:_n)[j.getMonth()]+j.getDate()-1})(g);k[m+28>>2]=b,k[m+36>>2]=-60*g.getTimezoneOffset();var A=new Date(g.getFullYear(),0,1),G=new Date(g.getFullYear(),6,1).getTimezoneOffset(),O=A.getTimezoneOffset(),B=0|(G!=O&&g.getTimezoneOffset()==Math.min(O,G));k[m+32>>2]=B},_tzset_js:(r,i,m,c)=>{var g=new Date().getFullYear(),b=new Date(g,0,1),A=new Date(g,6,1),G=b.getTimezoneOffset(),O=A.getTimezoneOffset(),B=Math.max(G,O);$[r>>2]=60*B,k[i>>2]=+(G!=O);var j=L=>{var te=L>=0?"-":"+",Z=Math.abs(L);return`UTC${te}${String(Math.floor(Z/60)).padStart(2,"0")}${String(Z%60).padStart(2,"0")}`},w=j(G),I=j(O);x(w),x(I),x(rt(w)<=16,`timezone name truncated to fit in TZNAME_MAX (${w})`),x(rt(I)<=16,`timezone name truncated to fit in TZNAME_MAX (${I})`),O<G?(Ye(w,m,17),Ye(I,c,17)):(Ye(w,c,17),Ye(I,m,17))},emscripten_date_now:()=>Date.now(),emscripten_resize_heap:r=>{var i=K.length;x((r>>>=0)>i);var m=2147483648;if(r>m)return C(`Cannot enlarge memory, requested ${r} bytes, but the limit is 2147483648 bytes!`),!1;for(var c=1;c<=4;c*=2){var g=i*(1+.2/c);g=Math.min(g,r+100663296);var b=Math.min(m,Wt(Math.max(r,g),65536));if(hn(b))return!0}return C(`Failed to grow the heap from ${i} bytes to ${b} bytes, not enough memory!`),!1},environ_get:(r,i)=>{var m=0;return at().forEach((c,g)=>{var b=i+m;$[r+4*g>>2]=b,((A,G)=>{for(var O=0;O<A.length;++O)x(A.charCodeAt(O)===(255&A.charCodeAt(O))),V[G++]=A.charCodeAt(O);V[G]=0})(c,b),m+=c.length+1}),0},environ_sizes_get:(r,i)=>{var m=at();$[r>>2]=m.length;var c=0;return m.forEach(g=>c+=g.length+1),$[i>>2]=c,0},fd_close:function(r){try{var i=Q.getStreamFromFD(r);return d.close(i),0}catch(m){if(d===void 0||m.name!=="ErrnoError")throw m;return m.errno}},fd_read:function(r,i,m,c){try{var g=((b,A,G,O)=>{for(var B=0,j=0;j<G;j++){var w=$[A>>2],I=$[A+4>>2];A+=8;var L=d.read(b,V,w,I,O);if(L<0)return-1;if(B+=L,L<I)break}return B})(Q.getStreamFromFD(r),i,m);return $[c>>2]=g,0}catch(b){if(d===void 0||b.name!=="ErrnoError")throw b;return b.errno}},fd_seek:function(r,i,m,c,g){var b=ct(i,m);try{if(isNaN(b))return 61;var A=Q.getStreamFromFD(r);return d.llseek(A,b,c),ne=[A.position>>>0,(U=A.position,+Math.abs(U)>=1?U>0?+Math.floor(U/4294967296)>>>0:~~+Math.ceil((U-+(~~U>>>0))/4294967296)>>>0:0)],k[g>>2]=ne[0],k[g+4>>2]=ne[1],A.getdents&&b===0&&c===0&&(A.getdents=null),0}catch(G){if(d===void 0||G.name!=="ErrnoError")throw G;return G.errno}},fd_sync:function(r){try{var i=Q.getStreamFromFD(r);return i.stream_ops?.fsync?i.stream_ops.fsync(i):0}catch(m){if(d===void 0||m.name!=="ErrnoError")throw m;return m.errno}},fd_write:function(r,i,m,c){try{var g=((b,A,G,O)=>{for(var B=0,j=0;j<G;j++){var w=$[A>>2],I=$[A+4>>2];A+=8;var L=d.write(b,V,w,I,O);if(L<0)return-1;if(B+=L,L<I)break}return B})(Q.getStreamFromFD(r),i,m);return $[c>>2]=g,0}catch(b){if(d===void 0||b.name!=="ErrnoError")throw b;return b.errno}},invoke_ii:function(r,i){var m=xe();try{return Ee(r)(i)}catch(c){if(Ce(m),c!==c+0)throw c;ke(1,0)}},invoke_iii:function(r,i,m){var c=xe();try{return Ee(r)(i,m)}catch(g){if(Ce(c),g!==g+0)throw g;ke(1,0)}},invoke_iiii:function(r,i,m,c){var g=xe();try{return Ee(r)(i,m,c)}catch(b){if(Ce(g),b!==b+0)throw b;ke(1,0)}},invoke_iiiii:function(r,i,m,c,g){var b=xe();try{return Ee(r)(i,m,c,g)}catch(A){if(Ce(b),A!==A+0)throw A;ke(1,0)}},invoke_v:function(r){var i=xe();try{Ee(r)()}catch(m){if(Ce(i),m!==m+0)throw m;ke(1,0)}},invoke_vi:function(r,i){var m=xe();try{Ee(r)(i)}catch(c){if(Ce(m),c!==c+0)throw c;ke(1,0)}},invoke_vii:function(r,i,m){var c=xe();try{Ee(r)(i,m)}catch(g){if(Ce(c),g!==g+0)throw g;ke(1,0)}},invoke_viii:function(r,i,m,c){var g=xe();try{Ee(r)(i,m,c)}catch(b){if(Ce(g),b!==b+0)throw b;ke(1,0)}},invoke_viiii:function(r,i,m,c,g){var b=xe();try{Ee(r)(i,m,c,g)}catch(A){if(Ce(b),A!==A+0)throw A;ke(1,0)}},invoke_viiiiiiiii:function(r,i,m,c,g,b,A,G,O,B){var j=xe();try{Ee(r)(i,m,c,g,b,A,G,O,B)}catch(w){if(Ce(j),w!==w+0)throw w;ke(1,0)}}},fe=(function(){var r={env:Qt,wasi_snapshot_preview1:Qt};function i(G,O){var B;return fe=G.exports,e.wasmExports=fe,x(R=fe.memory,"memory not found in wasm exports"),ge(),x(Ue=fe.__indirect_function_table,"table not found in wasm exports"),B=fe.__wasm_call_ctors,Be.unshift(B),ce("wasm-instantiate"),fe}Ge("wasm-instantiate");var m,c,g,b,A=e;if(e.instantiateWasm)try{return e.instantiateWasm(r,i)}catch(G){C(`Module.instantiateWasm callback failed with error: ${G}`),o(G)}return Se??=cn(),(m=N,c=Se,g=r,b=function(G){x(e===A,"the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"),A=null,i(G.instance)},m||typeof WebAssembly.instantiateStreaming!="function"||je(c)||typeof fetch!="function"?Bt(c,g,b):fetch(c,{credentials:"same-origin"}).then(G=>WebAssembly.instantiateStreaming(G,g).then(b,function(O){return C(`wasm streaming compile failed: ${O}`),C("falling back to ArrayBuffer instantiation"),Bt(c,g,b)}
3))).catch(o),{}})();e._PDFiumExt_Init=s("PDFiumExt_Init",0),e._FPDF_InitLibraryWithConfig=s("FPDF_InitLibraryWithConfig",1),e._PDFiumExt_OpenFileWriter=s("PDFiumExt_OpenFileWriter",0),e._PDFiumExt_GetFileWriterSize=s("PDFiumExt_GetFileWriterSize",1),e._PDFiumExt_GetFileWriterData=s("PDFiumExt_GetFileWriterData",3),e._PDFiumExt_CloseFileWriter=s("PDFiumExt_CloseFileWriter",1),e._PDFiumExt_SaveAsCopy=s("PDFiumExt_SaveAsCopy",2),e._FPDF_SaveAsCopy=s("FPDF_SaveAsCopy",3),e._PDFiumExt_OpenFormFillInfo=s("PDFiumExt_OpenFormFillInfo",0),e._PDFiumExt_CloseFormFillInfo=s("PDFiumExt_CloseFormFillInfo",1),e._PDFiumExt_InitFormFillEnvironment=s("PDFiumExt_InitFormFillEnvironment",2),e._FPDFDOC_InitFormFillEnvironment=s("FPDFDOC_InitFormFillEnvironment",2),e._PDFiumExt_ExitFormFillEnvironment=s("PDFiumExt_ExitFormFillEnvironment",1),e._FPDFDOC_ExitFormFillEnvironment=s("FPDFDOC_ExitFormFillEnvironment",1),e._EPDFNamedDest_SetDest=s("EPDFNamedDest_SetDest",3),e._EPDFNamedDest_Remove=s("EPDFNamedDest_Remove",2),e._EPDFDest_CreateView=s("EPDFDest_CreateView",4),e._EPDFDest_CreateXYZ=s("EPDFDest_CreateXYZ",7),e._EPDFDest_CreateRemoteView=s("EPDFDest_CreateRemoteView",5),e._EPDFDest_CreateRemoteXYZ=s("EPDFDest_CreateRemoteXYZ",8),e._EPDFAction_CreateGoTo=s("EPDFAction_CreateGoTo",2),e._EPDFAction_CreateGoToNamed=s("EPDFAction_CreateGoToNamed",2),e._EPDFAction_CreateLaunch=s("EPDFAction_CreateLaunch",2),e._EPDFAction_CreateRemoteGoToByName=s("EPDFAction_CreateRemoteGoToByName",3),e._EPDFAction_CreateRemoteGoToDest=s("EPDFAction_CreateRemoteGoToDest",3),e._EPDFAction_CreateURI=s("EPDFAction_CreateURI",2),e._EPDFBookmark_Create=s("EPDFBookmark_Create",2),e._EPDFBookmark_Delete=s("EPDFBookmark_Delete",2),e._EPDFBookmark_AppendChild=s("EPDFBookmark_AppendChild",3),e._EPDFBookmark_InsertAfter=s("EPDFBookmark_InsertAfter",4),e._EPDFBookmark_Clear=s("EPDFBookmark_Clear",1),e._EPDFBookmark_SetTitle=s("EPDFBookmark_SetTitle",2),e._EPDFBookmark_SetDest=s("EPDFBookmark_SetDest",3),e._EPDFBookmark_SetAction=s("EPDFBookmark_SetAction",3),e._EPDFBookmark_ClearTarget=s("EPDFBookmark_ClearTarget",1),e._EPDF_PNG_EncodeRGBA=s("EPDF_PNG_EncodeRGBA",6),e._FPDFAnnot_IsSupportedSubtype=s("FPDFAnnot_IsSupportedSubtype",1),e._FPDFPage_CreateAnnot=s("FPDFPage_CreateAnnot",2),e._FPDFPage_GetAnnotCount=s("FPDFPage_GetAnnotCount",1),e._FPDFPage_GetAnnot=s("FPDFPage_GetAnnot",2),e._FPDFPage_GetAnnotIndex=s("FPDFPage_GetAnnotIndex",2),e._FPDFPage_CloseAnnot=s("FPDFPage_CloseAnnot",1),e._FPDFPage_RemoveAnnot=s("FPDFPage_RemoveAnnot",2),e._FPDFAnnot_GetSubtype=s("FPDFAnnot_GetSubtype",1),e._FPDFAnnot_IsObjectSupportedSubtype=s("FPDFAnnot_IsObjectSupportedSubtype",1),e._FPDFAnnot_UpdateObject=s("FPDFAnnot_UpdateObject",2),e._FPDFAnnot_AddInkStroke=s("FPDFAnnot_AddInkStroke",3),e._FPDFAnnot_RemoveInkList=s("FPDFAnnot_RemoveInkList",1),e._FPDFAnnot_AppendObject=s("FPDFAnnot_AppendObject",2),e._FPDFAnnot_GetObjectCount=s("FPDFAnnot_GetObjectCount",1),e._FPDFAnnot_GetObject=s("FPDFAnnot_GetObject",2),e._FPDFAnnot_RemoveObject=s("FPDFAnnot_RemoveObject",2),e._FPDFAnnot_SetColor=s("FPDFAnnot_SetColor",6),e._FPDFAnnot_GetColor=s("FPDFAnnot_GetColor",6),e._FPDFAnnot_HasAttachmentPoints=s("FPDFAnnot_HasAttachmentPoints",1),e._FPDFAnnot_SetAttachmentPoints=s("FPDFAnnot_SetAttachmentPoints",3),e._FPDFAnnot_AppendAttachmentPoints=s("FPDFAnnot_AppendAttachmentPoints",2),e._FPDFAnnot_CountAttachmentPoints=s("FPDFAnnot_CountAttachmentPoints",1),e._FPDFAnnot_GetAttachmentPoints=s("FPDFAnnot_GetAttachmentPoints",3),e._FPDFAnnot_SetRect=s("FPDFAnnot_SetRect",2),e._FPDFAnnot_GetRect=s("FPDFAnnot_GetRect",2),e._FPDFAnnot_GetVertices=s("FPDFAnnot_GetVertices",3),e._FPDFAnnot_GetInkListCount=s("FPDFAnnot_GetInkListCount",1),e._FPDFAnnot_GetInkListPath=s("FPDFAnnot_GetInkListPath",4),e._FPDFAnnot_GetLine=s("FPDFAnnot_GetLine",3),e._FPDFAnnot_SetBorder=s("FPDFAnnot_SetBorder",4),e._FPDFAnnot_GetBorder=s("FPDFAnnot_GetBorder",4),e._FPDFAnnot_HasKey=s("FPDFAnnot_HasKey",2),e._FPDFAnnot_GetValueType=s("FPDFAnnot_GetValueType",2),e._FPDFAnnot_SetStringValue=s("FPDFAnnot_SetStringValue",3),e._FPDFAnnot_GetStringValue=s("FPDFAnnot_GetStringValue",4),e._FPDFAnnot_GetNumberValue=s("FPDFAnnot_GetNumberValue",3),e._EPDFAnnot_SetNumberValue=s("EPDFAnnot_SetNumberValue",3),e._FPDFAnnot_SetAP=s("FPD
3FAnnot_SetAP",3),e._FPDFAnnot_GetAP=s("FPDFAnnot_GetAP",4),e._FPDFAnnot_GetLinkedAnnot=s("FPDFAnnot_GetLinkedAnnot",2),e._FPDFAnnot_GetFlags=s("FPDFAnnot_GetFlags",1),e._FPDFAnnot_SetFlags=s("FPDFAnnot_SetFlags",2),e._FPDFAnnot_GetFormFieldFlags=s("FPDFAnnot_GetFormFieldFlags",2),e._FPDFAnnot_SetFormFieldFlags=s("FPDFAnnot_SetFormFieldFlags",3),e._FPDFAnnot_GetFormFieldAtPoint=s("FPDFAnnot_GetFormFieldAtPoint",3),e._FPDFAnnot_GetFormFieldName=s("FPDFAnnot_GetFormFieldName",4),e._FPDFAnnot_GetFormFieldType=s("FPDFAnnot_GetFormFieldType",2),e._FPDFAnnot_GetFormAdditionalActionJavaScript=s("FPDFAnnot_GetFormAdditionalActionJavaScript",5),e._FPDFAnnot_GetFormFieldAlternateName=s("FPDFAnnot_GetFormFieldAlternateName",4),e._FPDFAnnot_GetFormFieldValue=s("FPDFAnnot_GetFormFieldValue",4),e._FPDFAnnot_GetOptionCount=s("FPDFAnnot_GetOptionCount",2),e._FPDFAnnot_GetOptionLabel=s("FPDFAnnot_GetOptionLabel",5),e._FPDFAnnot_IsOptionSelected=s("FPDFAnnot_IsOptionSelected",3),e._FPDFAnnot_GetFontSize=s("FPDFAnnot_GetFontSize",3),e._FPDFAnnot_SetFontColor=s("FPDFAnnot_SetFontColor",5),e._FPDFAnnot_GetFontColor=s("FPDFAnnot_GetFontColor",5),e._FPDFAnnot_IsChecked=s("FPDFAnnot_IsChecked",2),e._FPDFAnnot_SetFocusableSubtypes=s("FPDFAnnot_SetFocusableSubtypes",3),e._FPDFAnnot_GetFocusableSubtypesCount=s("FPDFAnnot_GetFocusableSubtypesCount",1),e._FPDFAnnot_GetFocusableSubtypes=s("FPDFAnnot_GetFocusableSubtypes",3),e._FPDFAnnot_GetLink=s("FPDFAnnot_GetLink",1),e._FPDFAnnot_GetFormControlCount=s("FPDFAnnot_GetFormControlCount",2),e._FPDFAnnot_GetFormControlIndex=s("FPDFAnnot_GetFormControlIndex",2),e._FPDFAnnot_GetFormFieldExportValue=s("FPDFAnnot_GetFormFieldExportValue",4),e._FPDFAnnot_SetURI=s("FPDFAnnot_SetURI",2),e._EPDFAnnot_SetAction=s("EPDFAnnot_SetAction",2),e._FPDFAnnot_GetFileAttachment=s("FPDFAnnot_GetFileAttachment",1),e._FPDFAnnot_AddFileAttachment=s("FPDFAnnot_AddFileAttachment",2),e._EPDFAnnot_SetColor=s("EPDFAnnot_SetColor",5),e._EPDFAnnot_GetColor=s("EPDFAnnot_GetColor",5),e._EPDFAnnot_ClearColor=s("EPDFAnnot_ClearColor",2),e._EPDFAnnot_SetOpacity=s("EPDFAnnot_SetOpacity",2),e._EPDFAnnot_GetOpacity=s("EPDFAnnot_GetOpacity",2),e._EPDFAnnot_GetBorderEffect=s("EPDFAnnot_GetBorderEffect",2),e._EPDFAnnot_SetBorderEffect=s("EPDFAnnot_SetBorderEffect",2),e._EPDFAnnot_ClearBorderEffect=s("EPDFAnnot_ClearBorderEffect",1),e._EPDFAnnot_GetRectangleDifferences=s("EPDFAnnot_GetRectangleDifferences",5),e._EPDFAnnot_SetRectangleDifferences=s("EPDFAnnot_SetRectangleDifferences",5),e._EPDFAnnot_ClearRectangleDifferences=s("EPDFAnnot_ClearRectangleDifferences",1),e._EPDFAnnot_GetBorderDashPatternCount=s("EPDFAnnot_GetBorderDashPatternCount",1),e._EPDFAnnot_GetBorderDashPattern=s("EPDFAnnot_GetBorderDashPattern",3),e._EPDFAnnot_SetBorderDashPattern=s("EPDFAnnot_SetBorderDashPattern",3),e._EPDFAnnot_GetBorderStyle=s("EPDFAnnot_GetBorderStyle",2),e._EPDFAnnot_SetBorderStyle=s("EPDFAnnot_SetBorderStyle",3),e._EPDFAnnot_GenerateAppearance=s("EPDFAnnot_GenerateAppearance",1),e._EPDFAnnot_GenerateAppearanceWithBlend=s("EPDFAnnot_GenerateAppearanceWithBlend",2),e._EPDFAnnot_GetBlendMode=s("EPDFAnnot_GetBlendMode",1),e._EPDFAnnot_SetIntent=s("EPDFAnnot_SetIntent",2),e._EPDFAnnot_GetIntent=s("EPDFAnnot_GetIntent",3),e._EPDFAnnot_GetRichContent=s("EPDFAnnot_GetRichContent",3),e._EPDFAnnot_SetLineEndings=s("EPDFAnnot_SetLineEndings",3),e._EPDFAnnot_GetLineEndings=s("EPDFAnnot_GetLineEndings",3),e._EPDFAnnot_SetVertices=s("EPDFAnnot_SetVertices",3),e._EPDFAnnot_SetLine=s("EPDFAnnot_SetLine",3),e._EPDFAnnot_SetDefaultAppearance=s("EPDFAnnot_SetDefaultAppearance",6),e._EPDFAnnot_GetDefaultAppearance=s("EPDFAnnot_GetDefaultAppearance",6),e._EPDFAnnot_SetTextAlignment=s("EPDFAnnot_SetTextAlignment",2),e._EPDFAnnot_GetTextAlignment=s("EPDFAnnot_GetTextAlignment",1),e._EPDFAnnot_SetVerticalAlignment=s("EPDFAnnot_SetVerticalAlignment",2),e._EPDFAnnot_GetVerticalAlignment=s("EPDFAnnot_GetVerticalAlignment",1),e._EPDFPage_GetAnnotByName=s("EPDFPage_GetAnnotByName",2),e._EPDFPage_RemoveAnnotByName=s("EPDFPage_RemoveAnnotByName",2),e._EPDFAnnot_SetLinkedAnnot=s("EPDFAnnot_SetLinkedAnnot",3),e._EPDFPage_GetAnnotCountRaw=s("EPDFPage_GetAnnotCountRaw",2),e._EPDFPage_GetAnnotRaw=s("EPDFPage_GetAnnotRaw",3),e._EPDFPage_RemoveAnnotRaw=s("EPDFPage_RemoveAnnotRaw",3),e._EPDFAnnot_SetName=s("EPDFAnnot_SetName",2),e._EPDFAnnot_GetName=s("EPDFAnnot_GetName",1),e._EPDFAnnot_UpdateAppearanceToRect=s("EPDFAnnot_UpdateAppearanceToRect",2),e._EPDFPage_CreateAnnot=s("EPDFPage_CreateAnnot",2),e._EPDFAnnot_SetRotate=s("EPDFAnnot_SetRotate",2),e._EPDFAnnot_GetRotate=s("EPDFAnnot_GetRotate",2),e._EPDFAnnot_GetReplyType=s("EPDFAnnot_GetReplyType",1),e._EPDFAnnot_SetReplyType=s("EPDFAnnot_SetReplyType",2),e._EPDFAnnot_SetOverlayText=s("EPDFAnnot_SetOverlayText",2),e._EPDFAnnot_GetOverlayText=s("EPDFAnnot_GetOverlayText",3),e._EPDFAnnot_SetOverlayTextRepeat=s("EPDFAnnot_SetOverlayTextRepeat",2),e._EPDFAnnot_GetOverlayTextRepeat=s("EPDFAnnot_GetOverlayTextRepeat",1),e._EPDFAnnot_ApplyRedaction=s("EPDFAnnot_ApplyRedaction",2),e._EPDFPage_ApplyRedactions=s("EPDFPage_ApplyRedactions",1),e._EPDFAnnot_Flatten=s("EPDFAnnot_Flatten",2),e._EPDFAnnot_SetAppearanceFromPage=s("EPDFAnnot_SetAppearanceFromPage",3),e._EPDFAnnot_ExportAppearanceAsDocument=s("EPDFAnnot_ExportAppearanceAsDocument",1),e._EPDFAnnot_ExportMultipleAppearancesAsDocument=s("EPDFAnnot_ExportMultipleAppearancesAsDocument",2),e._EPDFAnnot_SetExtendedRotation=s("EPDFAnnot_SetExtendedRotation",2),e._EPDFAnnot_GetExtendedRotation=s("EPDFAnnot_GetExtendedRotation",2),e._EPDFAnnot_SetUnrotatedRect=s("EPDFAnnot_SetUnrotatedRect",2),e._EPDFAnnot_GetUnrotatedRect=s("EPDFAnnot_GetUnrotatedRect",2),e._EPDFAnnot_GetRect=s("EPDFAnnot_GetRect",2),e._EPDFAnnot_SetAPMatrix=s("EPDFAnnot_SetAPMatrix",3),e._EPDFAnnot_GetAPMatrix=s("EPDFAnnot_GetAPMatrix",3),e._EPDFAnnot_GetAvailableAppearanceModes=s("EPDFAnnot_GetAvailableAppearanceModes",1),e._EPDFAnnot_HasAppearanceStream=s("EPDFAnnot_HasAppearanceStream",2),e._EPDFAnnot_SetMKColor=s("EPDFAnnot_SetMKColor",5),e._EPDFAnnot_GetMKColor=s("EPDFAnnot_GetMKColor",5),e._EPDFAnnot_ClearMKColor=s("EPDFAnnot_ClearMKColor",2),e._EPDFPage_CreateFormField=s("EPDFPage_CreateFormField",4),e._EPDFAnnot_GenerateFormFieldAP=s("EPDFAnnot_GenerateFormFieldAP",1),e._EPDFAnnot_GetButtonExportValue=s("EPDFAnnot_GetButtonExportValue",3),e._EPDFAnnot_GetFormFieldRawValue=s("EPDFAnnot_GetFormFieldRawValue",4),e._EPDFAnnot_SetFormFieldValue=s("EPDFAnnot_SetFormFieldValue",3),e._EPDFAnnot_SetFormFieldName=s("EPDFAnnot_SetFormFieldName",3),e._EPDFAnnot_GetFormFieldObjectNumber=s("EPDFAnnot_GetFormFieldObjectNumber",2),e._EPDFAnnot_ShareFormField=s("EPDFAnnot_ShareFormField",3),e._EPDFAnnot_GetCalloutLineCount=s("EPDFAnnot_GetCalloutLineCount",1),e._EPDFAnnot_GetCalloutLine=s("EPDFAnnot_GetCalloutLine",3),e._EPDFAnnot_SetCalloutLine=s("EPDFAnnot_SetCalloutLine",3),e._EPDFAnnot_SetFormFieldOptions=s("EPDFAnnot_SetFormFieldOptions",4),e._EPDFAnnot_GetObjectNumber=s("EPDFAnnot_GetObjectNumber",1),e._EPDFPage_GetAnnotByObjectNumber=s("EPDFPage_GetAnnotByObjectNumber",2),e._EPDFPage_RemoveAnnot=s("EPDFPage_RemoveAnnot",2),e._EPDFPage_RemoveAnnotByObjectNumber=s("EPDFPage_RemoveAnnotByObjectNumber",2),e._EPDFPage_MoveAnnots=s("EPDFPage_MoveAnnots",4),e._FPDFDoc_GetAttachmentCount=s("FPDFDoc_GetAttachmentCount",1),e._FPDFDoc_AddAttachment=s("FPDFDoc_AddAttachment",2),e._FPDFDoc_GetAttachment=s("FPDFDoc_GetAttachment",2),e._FPDFDoc_DeleteAttachment=s("FPDFDoc_DeleteAttachment",2),e._FPDFAttachment_GetName=s("FPDFAttachment_GetName",3),e._FPDFAttachment_HasKey=s("FPDFAttachment_HasKey",2),e._FPDFAttachment_GetValueType=s("FPD
3FAttachment_GetValueType",2),e._FPDFAttachment_SetStringValue=s("FPDFAttachment_SetStringValue",3),e._FPDFAttachment_GetStringValue=s("FPDFAttachment_GetStringValue",4),e._FPDFAttachment_SetFile=s("FPDFAttachment_SetFile",4),e._FPDFAttachment_GetFile=s("FPDFAttachment_GetFile",4),e._FPDFAttachment_GetSubtype=s("FPDFAttachment_GetSubtype",3),e._EPDFAttachment_SetSubtype=s("EPDFAttachment_SetSubtype",2),e._EPDFAttachment_SetDescription=s("EPDFAttachment_SetDescription",2),e._EPDFAttachment_GetDescription=s("EPDFAttachment_GetDescription",3),e._EPDFAttachment_GetIntegerValue=s("EPDFAttachment_GetIntegerValue",3),e._FPDFCatalog_IsTagged=s("FPDFCatalog_IsTagged",1),e._FPDFCatalog_GetLanguage=s("FPDFCatalog_GetLanguage",3),e._FPDFCatalog_SetLanguage=s("FPDFCatalog_SetLanguage",2),e._EPDFCatalog_GetLanguage=s("EPDFCatalog_GetLanguage",3),e._FPDFAvail_Create=s("FPDFAvail_Create",2),e._FPDFAvail_Destroy=s("FPDFAvail_Destroy",1),e._FPDFAvail_IsDocAvail=s("FPDFAvail_IsDocAvail",2),e._FPDFAvail_GetDocument=s("FPDFAvail_GetDocument",2),e._FPDFAvail_GetFirstPageNum=s("FPDFAvail_GetFirstPageNum",1),e._FPDFAvail_IsPageAvail=s("FPDFAvail_IsPageAvail",3),e._FPDFAvail_IsFormAvail=s("FPDFAvail_IsFormAvail",2),e._FPDFAvail_IsLinearized=s("FPDFAvail_IsLinearized",1),e._FPDFBookmark_GetFirstChild=s("FPDFBookmark_GetFirstChild",2),e._FPDFBookmark_GetNextSibling=s("FPDFBookmark_GetNextSibling",2),e._FPDFBookmark_GetTitle=s("FPDFBookmark_GetTitle",3),e._FPDFBookmark_GetCount=s("FPDFBookmark_GetCount",1),e._FPDFBookmark_Find=s("FPDFBookmark_Find",2),e._FPDFBookmark_GetDest=s("FPDFBookmark_GetDest",2),e._FPDFBookmark_GetAction=s("FPDFBookmark_GetAction",1),e._FPDFAction_GetType=s("FPD
3FAction_GetType",1),e._FPDFAction_GetDest=s("FPDFAction_GetDest",2),e._FPDFAction_GetFilePath=s("FPDFAction_GetFilePath",3),e._FPDFAction_GetURIPath=s("FPDFAction_GetURIPath",4),e._FPDFDest_GetDestPageIndex=s("FPDFDest_GetDestPageIndex",2),e._FPDFDest_GetView=s("FPDFDest_GetView",3),e._FPDFDest_GetLocationInPage=s("FPDFDest_GetLocationInPage",7),e._FPDFLink_GetLinkAtPoint=s("FPDFLink_GetLinkAtPoint",3),e._FPDFLink_GetLinkZOrderAtPoint=s("FPDFLink_GetLinkZOrderAtPoint",3),e._FPDFLink_GetDest=s("FPDFLink_GetDest",2),e._FPDFLink_GetAction=s("FPDFLink_GetAction",1),e._FPDFLink_Enumerate=s("FPDFLink_Enumerate",3),e._FPDFLink_GetAnnot=s("FPDFLink_GetAnnot",2),e._FPDFLink_GetAnnotRect=s("FPDFLink_GetAnnotRect",2),e._FPDFLink_CountQuadPoints=s("FPDFLink_CountQuadPoints",1),e._FPDFLink_GetQuadPoints=s("FPDFLink_GetQuadPoints",3),e._FPDF_GetPageAAction=s("FPDF_GetPageAAction",2),e._FPDF_GetFileIdentifier=s("FPDF_GetFileIdentifier",4),e._FPDF_GetMetaText=s("FPDF_GetMetaText",4),e._FPDF_GetPageLabel=s("FPDF_GetPageLabel",4),e._EPDF_SetMetaText=s("EPDF_SetMetaText",3),e._EPDF_HasMetaText=s("EPDF_HasMetaText",2),e._EPDF_GetMetaTrapped=s("EPDF_GetMetaTrapped",1),e._EPDF_SetMetaTrapped=s("EPDF_SetMetaTrapped",2),e._EPDF_GetMetaKeyCount=s("EPDF_GetMetaKeyCount",2),e._EPDF_GetMetaKeyName=s("EPDF_GetMetaKeyName",5),e._FPDFPageObj_NewImageObj=s("FPDFPageObj_NewImageObj",1),e._FPDFImageObj_LoadJpegFile=s("FPDFImageObj_LoadJpegFile",4),e._FPDFImageObj_LoadJpegFileInline=s("FPDFImageObj_LoadJpegFileInline",4),e._FPDFImageObj_SetMatrix=s("FPDFImageObj_SetMatrix",7),e._FPDFImageObj_SetBitmap=s("FPDFImageObj_SetBitmap",4),e._FPDFImageObj_GetBitmap=s("FPDFImageObj_GetBitmap",1),e._FPDFImageObj_GetRenderedBitmap=s("FPDFImageObj_GetRenderedBitmap",3),e._FPDFImageObj_GetImageDataDecoded=s("FPDFImageObj_GetImageDataDecoded",3),e._FPDFImageObj_GetImageDataRaw=s("FPDFImageObj_GetImageDataRaw",3),e._FPDFImageObj_GetImageFilterCount=s("FPDFImageObj_GetImageFilterCount",1),e._FPDFImageObj_GetImageFilter=s("FPDFImageObj_GetImageFilter",4),e._FPDFImageObj_GetImageMetadata=s("FPDFImageObj_GetImageMetadata",3),e._FPDFImageObj_GetImagePixelSize=s("FPDFImageObj_GetImagePixelSize",3),e._FPDFImageObj_GetIccProfileDataDecoded=s("FPDFImageObj_GetIccProfileDataDecoded",5),e._EPDFImageObj_SetPng=s("EPDFImageObj_SetPng",5),e._EPDFImageObj_SetJpeg=s("EPDFImageObj_SetJpeg",5),e._FPDF_CreateNewDocument=s("FPDF_CreateNewDocument",0),e._FPDFPage_Delete=s("FPDFPage_Delete",2),e._FPDF_MovePages=s("FPDF_MovePages",4),e._FPDFPage_New=s("FPDFPage_New",4),e._FPDFPage_GetRotation=s("FPDFPage_GetRotation",1),e._FPDFPage_InsertObject=s("FPDFPage_InsertObject",2),e._FPDFPage_InsertObjectAtIndex=s("FPDFPage_InsertObjectAtIndex",3),e._FPDFPage_RemoveObject=s("FPDFPage_RemoveObject",2),e._FPDFPage_CountObjects=s("FPDFPage_CountObjects",1),e._FPDFPage_GetObject=s("FPDFPage_GetObject",2),e._FPDFPage_HasTransparency=s("FPDFPage_HasTransparency",1),e._FPDFPageObj_Destroy=s("FPDFPageObj_Destroy",1),e._FPDFPageObj_GetMarkedContentID=s("FPDFPageObj_GetMarkedContentID",1),e._FPDFPageObj_CountMarks=s("FPDFPageObj_CountMarks",1),e._FPDFPageObj_GetMark=s("FPDFPageObj_GetMark",2),e._FPDFPageObj_AddMark=s("FPDFPageObj_AddMark",2),e._FPDFPageObj_RemoveMark=s("FPDFPageObj_RemoveMark",2),e._FPDFPageObjMark_GetName=s("FPDFPageObjMark_GetName",4),e._FPDFPageObjMark_CountParams=s("FPDFPageObjMark_CountParams",1),e._FPDFPageObjMark_GetParamKey=s("FPDFPageObjMark_GetParamKey",5),e._FPDFPageObjMark_GetParamValueType=s("FPDFPageObjMark_GetParamValueType",2),e._FPDFPageObjMark_GetParamIntValue=s("FPDFPageObjMark_GetParamIntValue",3),e._FPDFPageObjMark_GetParamFloatValue=s("FPDFPageObjMark_GetParamFloatValue",3),e._FPDFPageObjMark_GetParamStringValue=s("FPDFPageObjMark_GetParamStringValue",5),e._FPDFPageObjMark_GetParamBlobValue=s("FPDFPageObjMark_GetParamBlobValue",5),e._FPDFPageObj_HasTransparency=s("FPDFPageObj_HasTransparency",1),e._FPDFPageObjMark_SetIntParam=s("FPDFPageObjMark_SetIntParam",5),e._FPDFPageObjMark_SetFloatParam=s("FPDFPageObjMark_SetFloatParam",5),e._FPDFPageObjMark_SetStringParam=s("FPDFPageObjMark_SetStringParam",5),e._FPDFPageObjMark_SetBlobParam=s("FPD
3FPageObjMark_SetBlobParam",6),e._FPDFPageObjMark_RemoveParam=s("FPDFPageObjMark_RemoveParam",3),e._FPDFPageObj_GetType=s("FPDFPageObj_GetType",1),e._FPDFPageObj_GetIsActive=s("FPDFPageObj_GetIsActive",2),e._FPDFPageObj_SetIsActive=s("FPDFPageObj_SetIsActive",2),e._FPDFPage_GenerateContent=s("FPDFPage_GenerateContent",1),e._FPDFPageObj_Transform=s("FPDFPageObj_Transform",7),e._FPDFPageObj_TransformF=s("FPDFPageObj_TransformF",2),e._FPDFPageObj_GetMatrix=s("FPDFPageObj_GetMatrix",2),e._FPDFPageObj_SetMatrix=s("FPDFPageObj_SetMatrix",2),e._FPDFPageObj_SetBlendMode=s("FPDFPageObj_SetBlendMode",2),e._FPDFPage_TransformAnnots=s("FPDFPage_TransformAnnots",7),e._FPDFPage_SetRotation=s("FPDFPage_SetRotation",2),e._FPDFPageObj_SetFillColor=s("FPDFPageObj_SetFillColor",5),e._FPDFPageObj_GetFillColor=s("FPDFPageObj_GetFillColor",5),e._FPDFPageObj_GetBounds=s("FPDFPageObj_GetBounds",5),e._FPDFPageObj_GetRotatedBounds=s("FPDFPageObj_GetRotatedBounds",2),e._FPDFPageObj_SetStrokeColor=s("FPDFPageObj_SetStrokeColor",5),e._FPDFPageOb
3j_GetStrokeColor=s("FPDFPageObj_GetStrokeColor",5),e._FPDFPageObj_SetStrokeWidth=s("FPDFPageObj_SetStrokeWidth",2),e._FPDFPageObj_GetStrokeWidth=s("FPDFPageObj_GetStrokeWidth",2),e._FPDFPageObj_GetLineJoin=s("FPDFPageObj_GetLineJoin",1),e._FPDFPageObj_SetLineJoin=s("FPDFPageObj_SetLineJoin",2),e._FPDFPageObj_GetLineCap=s("FPDFPageObj_GetLineCap",1),e._FPDFPageObj_SetLineCap=s("FPDFPageObj_SetLineCap",2),e._FPDFPageObj_GetDashPhase=s("FPDFPageObj_GetDashPhase",2),e._FPDFPageObj_SetDashPhase=s("FPDFPageObj_SetDashPhase",2),e._FPDFPageObj_GetDashCount=s("FPDFPageObj_GetDashCount",1),e._FPDFPageObj_GetDashArray=s("FPDFPageObj_GetDashArray",3),e._FPDFPageObj_SetDashArray=s("FPDFPageObj_SetDashArray",4),e._FPDFFormObj_CountObjects=s("FPDFFormObj_CountObjects",1),e._FPDFFormObj_GetObject=s("FPDFFormObj_GetObject",2),e._FPDFFormObj_RemoveObject=s("FPDFFormObj_RemoveObject",2),e._FPDFPageObj_CreateNewPath=s("FPDFPageObj_CreateNewPath",2),e._FPDFPageObj_CreateNewRect=s("FPDFPageObj_CreateNewRect",4),e._FPDFPath_CountSegments=s("FPDFPath_CountSegments",1),e._FPDFPath_GetPathSegment=s("FPDFPath_GetPathSegment",2),e._FPDFPath_MoveTo=s("FPDFPath_MoveTo",3),e._FPDFPath_LineTo=s("FPDFPath_LineTo",3),e._FPDFPath_BezierTo=s("FPDFPath_BezierTo",7),e._FPDFPath_Close=s("FPDFPath_Close",1),e._FPDFPath_SetDrawMode=s("FPDFPath_SetDrawMode",3),e._FPDFPath_GetDrawMode=s("FPDFPath_GetDrawMode",3),e._FPDFPathSegment_GetPoint=s("FPDFPathSegment_GetPoint",3),e._FPDFPathSegment_GetType=s("FPD
3FPathSegment_GetType",1),e._FPDFPathSegment_GetClose=s("FPDFPathSegment_GetClose",1),e._FPDFPageObj_NewTextObj=s("FPDFPageObj_NewTextObj",3),e._FPDFText_SetText=s("FPDFText_SetText",2),e._FPDFText_SetCharcodes=s("FPDFText_SetCharcodes",3),e._FPDFText_LoadFont=s("FPDFText_LoadFont",5),e._FPDFText_LoadStandardFont=s("FPDFText_LoadStandardFont",2),e._FPDFText_LoadCidType2Font=s("FPDFText_LoadCidType2Font",6),e._FPDFTextObj_GetFontSize=s("FPDFTextObj_GetFontSize",2),e._FPDFTextObj_GetText=s("FPDFTextObj_GetText",4),e._FPDFTextObj_GetRenderedBitmap=s("FPDFTextObj_GetRenderedBitmap",4),e._FPDFFont_Close=s("FPDFFont_Close",1),e._FPDFPageObj_CreateTextObj=s("FPDFPageObj_CreateTextObj",3),e._FPDFTextObj_GetTextRenderMode=s("FPDFTextObj_GetTextRenderMode",1),e._FPDFTextObj_SetTextRenderMode=s("FPDFTextObj_SetTextRenderMode",2),e._FPDFTextObj_GetFont=s("FPDFTextObj_GetFont",1),e._FPDFFont_GetBaseFontName=s("FPDFFont_GetBaseFontName",3),e._FPDFFont_GetFamilyName=s("FPDFFont_GetFamilyName",3),e._FPDFFont_GetFontData=s("FPDFFont_GetFontData",4),e._FPDFFont_GetIsEmbedded=s("FPDFFont_GetIsEmbedded",1),e._FPDFFont_GetFlags=s("FPDFFont_GetFlags",1),e._FPDFFont_GetWeight=s("FPDFFont_GetWeight",1),e._FPDFFont_GetItalicAngle=s("FPDFFont_GetItalicAngle",2),e._FPDFFont_GetAscent=s("FPDFFont_GetAscent",3),e._FPDFFont_GetDescent=s("FPDFFont_GetDescent",3),e._FPDFFont_GetGlyphWidth=s("FPDFFont_GetGlyphWidth",4),e._FPDFFont_GetGlyphPath=s("FPDFFont_GetGlyphPath",3),e._FPDFGlyphPath_CountGlyphSegments=s("FPDFGlyphPath_CountGlyphSegments",1),e._FPDFGlyphPath_GetGlyphPathSegment=s("FPDFGlyphPath_GetGlyphPathSegment",2),e._EPDFText_RedactInRect=s("EPDFText_RedactInRect",4),e._EPDFText_RedactInQuads=s("EPDFText_RedactInQuads",5),e._FPDFDoc_GetPageMode=s("FPDFDoc_GetPageMode",1),e._FPDFPage_Flatten=s("FPDFPage_Flatten",2),e._FPDFPage_HasFormFieldAtPoint=s("FPDFPage_HasFormFieldAtPoint",4),e._FPDFPage_FormFieldZOrderAtPoint=s("FPDFPage_FormFieldZOrderAtPoint",4),e._malloc=s("malloc",1),e._free=s("free",1),e._FORM_OnMouseMove=s("FORM_OnMouseMove",5),e._FORM_OnMouseWheel=s("FORM_OnMouseWheel",6),e._FORM_OnFocus=s("FORM_OnFocus",5),e._FORM_OnLButtonDown=s("FORM_OnLButtonDown",5),e._FORM_OnLButtonUp=s("FORM_OnLButtonUp",5),e._FORM_OnLButtonDoubleClick=s("FORM_OnLButtonDoubleClick",5),e._FORM_OnRButtonDown=s("FORM_OnRButtonDown",5),e._FORM_OnRButtonUp=s("FORM_OnRButtonUp",5),e._FORM_OnKeyDown=s("FORM_OnKeyDown",4),e._FORM_OnKeyUp=s("FORM_OnKeyUp",4),e._FORM_OnChar=s("FORM_OnChar",4),e._FORM_GetFocusedText=s("FORM_GetFocusedText",4),e._FORM_GetSelectedText=s("FORM_GetSelectedText",4),e._FORM_ReplaceAndKeepSelection=s("FORM_ReplaceAndKeepSelection",3),e._FORM_ReplaceSelection=s("FORM_ReplaceSelection",3),e._FORM_SelectAllText=s("FORM_SelectAllText",2),e._FORM_CanUndo=s("FORM_CanUndo",2),e._FORM_CanRedo=s("FORM_CanRedo",2),e._FORM_Undo=s("FORM_Undo",2),e._FORM_Redo=s("FORM_Redo",2),e._FORM_ForceToKillFocus=s("FORM_ForceToKillFocus",1),e._FORM_GetFocusedAnnot=s("FORM_GetFocusedAnnot",3),e._FORM_SetFocusedAnnot=s("FORM_SetFocusedAnnot",2),e._FPDF_FFLDraw=s("FPDF_FFLDraw",9),e._FPDF_SetFormFieldHighlightColor=s("FPDF_SetFormFieldHighlightColor",3),e._FPDF_SetFormFieldHighlightAlpha=s("FPDF_SetFormFieldHighlightAlpha",2),e._FPDF_RemoveFormFieldHighlight=s("FPDF_RemoveFormFieldHighlight",1),e._FORM_OnAfterLoadPage=s("FORM_OnAfterLoadPage",2),e._FORM_OnBeforeClosePage=s("FORM_OnBeforeClosePage",2),e._FORM_DoDocumentJSAction=s("FORM_DoDocumentJSAction",1),e._FORM_DoDocumentOpenAction=s("FORM_DoDocumentOpenAction",1),e._FORM_DoDocumentAAction=s("FORM_DoDocumentAAction",2),e._FORM_DoPageAAction=s("FORM_DoPageAAction",3),e._FORM_SetIndexSelected=s("FORM_SetIndexSelected",4),e._FORM_IsIndexSelected=s("FORM_IsIndexSelected",3),e._FPDFDoc_GetJavaScriptActionCount=s("FPDFDoc_GetJavaScriptActionCount",1),e._FPDFDoc_GetJavaScriptAction=s("FPDFDoc_GetJavaScriptAction",2),e._FPDFDoc_CloseJavaScriptAction=s("FPDFDoc_CloseJavaScriptAction",1),e._FPDFJavaScriptAction_GetName=s("FPDFJavaScriptAction_GetName",3),e._FPDFJavaScriptAction_GetScript=s("FPDFJavaScriptAction_GetScript",3),e._FPDF_ImportPagesByIndex=s("FPDF_ImportPagesByIndex",5),e._FPDF_ImportPages=s("FPDF_ImportPages",4),e._FPDF_ImportNPagesToOne=s("FPD
3F_ImportNPagesToOne",5),e._FPDF_NewXObjectFromPage=s("FPDF_NewXObjectFromPage",3),e._FPDF_CloseXObject=s("FPDF_CloseXObject",1),e._FPDF_NewFormObjectFromXObject=s("FPDF_NewFormObjectFromXObject",1),e._FPDF_CopyViewerPreferences=s("FPDF_CopyViewerPreferences",2),e._FPDF_RenderPageBitmapWithColorScheme_Start=s("FPDF_RenderPageBitmapWithColorScheme_Start",10),e._FPDF_RenderPageBitmap_Start=s("FPDF_RenderPageBitmap_Start",9),e._FPDF_RenderPage_Continue=s("FPDF_RenderPage_Continue",2),e._FPDF_RenderPage_Close=s("FPDF_RenderPage_Close",1),e._FPDF_SaveWithVersion=s("FPDF_SaveWithVersion",4),e._FPDFText_GetCharIndexFromTextIndex=s("FPDFText_GetCharIndexFromTextIndex",2),e._FPDFText_GetTextIndexFromCharIndex=s("FPDFText_GetTextIndexFromCharIndex",2),e._FPDF_GetSignatureCount=s("FPDF_GetSignatureCount",1),e._FPDF_GetSignatureObject=s("FPDF_GetSignatureObject",2),e._FPDFSignatureObj_GetContents=s("FPDFSignatureObj_GetContents",3),e._FPDFSignatureObj_GetByteRange=s("FPDFSignatureObj_GetByteRange",3),e._FPDFSignatureObj_GetSubFilter=s("FPDFSignatureObj_GetSubFilter",3),e._FPDFSignatureObj_GetReason=s("FPDFSignatureObj_GetReason",3),e._FPDFSignatureObj_GetTime=s("FPDFSignatureObj_GetTime",3),e._FPDFSignatureObj_GetDocMDPPermission=s("FPDFSignatureObj_GetDocMDPPermission",1),e._FPDF_StructTree_GetForPage=s("FPDF_StructTree_GetForPage",1),e._FPDF_StructTree_Close=s("FPDF_StructTree_Close",1),e._FPDF_StructTree_CountChildren=s("FPDF_StructTree_CountChildren",1),e._FPDF_StructTree_GetChildAtIndex=s("FPDF_StructTree_GetChildAtIndex",2),e._FPDF_StructElement_GetAltText=s("FPDF_StructElement_GetAltText",3),e._FPDF_StructElement_GetActualText=s("FPDF_StructElement_GetActualText",3),e._FPDF_StructElement_GetID=s("FPDF_StructElement_GetID",3),e._FPDF_StructElement_GetLang=s("FPDF_StructElement_GetLang",3),e._FPDF_StructElement_GetAttributeCount=s("FPDF_StructElement_GetAttributeCount",1),e._FPDF_StructElement_GetAttributeAtIndex=s("FPDF_StructElement_GetAttributeAtIndex",2),e._FPDF_StructElement_GetStringAttribute=s("FPDF_StructElement_GetStringAttribute",4),e._FPDF_StructElement_GetMarkedContentID=s("FPDF_StructElement_GetMarkedContentID",1),e._FPDF_StructElement_GetType=s("FPD
3F_StructElement_GetType",3),e._FPDF_StructElement_GetObjType=s("FPDF_StructElement_GetObjType",3),e._FPDF_StructElement_GetTitle=s("FPDF_StructElement_GetTitle",3),e._FPDF_StructElement_CountChildren=s("FPDF_StructElement_CountChildren",1),e._FPDF_StructElement_GetChildAtIndex=s("FPDF_StructElement_GetChildAtIndex",2),e._FPDF_StructElement_GetChildMarkedContentID=s("FPDF_StructElement_GetChildMarkedContentID",2),e._FPDF_StructElement_GetParent=s("FPDF_StructElement_GetParent",1),e._FPDF_StructElement_Attr_GetCount=s("FPDF_StructElement_Attr_GetCount",1),e._FPDF_StructElement_Attr_GetName=s("FPDF_StructElement_Attr_GetName",5),e._FPDF_StructElement_Attr_GetValue=s("FPDF_StructElement_Attr_GetValue",2),e._FPDF_StructElement_Attr_GetType=s("FPDF_StructElement_Attr_GetType",1),e._FPDF_StructElement_Attr_GetBooleanValue=s("FPDF_StructElement_Attr_GetBooleanValue",2),e._FPDF_StructElement_Attr_GetNumberValue=s("FPDF_StructElement_Attr_GetNumberValue",2),e._FPDF_StructElement_Attr_GetStringValue=s("FPDF_StructElement_Attr_GetStringValue",4),e._FPDF_StructElement_Attr_GetBlobValue=s("FPDF_StructElement_Attr_GetBlobValue",4),e._FPDF_StructElement_Attr_CountChildren=s("FPDF_StructElement_Attr_CountChildren",1),e._FPDF_StructElement_Attr_GetChildAtIndex=s("FPDF_StructElement_Attr_GetChildAtIndex",2),e._FPDF_StructElement_GetMarkedContentIdCount=s("FPDF_StructElement_GetMarkedContentIdCount",1),e._FPDF_StructElement_GetMarkedContentIdAtIndex=s("FPDF_StructElement_GetMarkedContentIdAtIndex",2),e._FPDF_AddInstalledFont=s("FPDF_AddInstalledFont",3),e._FPDF_SetSystemFontInfo=s("FPDF_SetSystemFontInfo",1),e._FPDF_GetDefaultTTFMap=s("FPDF_GetDefaultTTFMap",0),e._FPDF_GetDefaultTTFMapCount=s("FPDF_GetDefaultTTFMapCount",0),e._FPDF_GetDefaultTTFMapEntry=s("FPDF_GetDefaultTTFMapEntry",1),e._FPDF_GetDefaultSystemFontInfo=s("FPDF_GetDefaultSystemFontInfo",0),e._FPDF_FreeDefaultSystemFontInfo=s("FPDF_FreeDefaultSystemFontInfo",1),e._FPDFText_LoadPage=s("FPDFText_LoadPage",1),e._FPDFText_ClosePage=s("FPDFText_ClosePage",1),e._FPDFText_CountChars=s("FPDFText_CountChars",1),e._FPDFText_GetUnicode=s("FPDFText_GetUnicode",2),e._FPDFText_GetTextObject=s("FPDFText_GetTextObject",2),e._FPDFText_IsGenerated=s("FPDFText_IsGenerated",2),e._FPDFText_IsHyphen=s("FPDFText_IsHyphen",2),e._FPDFText_HasUnicodeMapError=s("FPDFText_HasUnicodeMapError",2),e._FPDFText_GetFontSize=s("FPDFText_GetFontSize",2),e._FPDFText_GetFontInfo=s("FPDFText_GetFontInfo",5),e._FPDFText_GetFontWeight=s("FPDFText_GetFontWeight",2),e._FPDFText_GetFillColor=s("FPDFText_GetFillColor",6),e._FPDFText_GetStrokeColor=s("FPDFText_GetStrokeColor",6),e._FPDFText_GetCharAngle=s("FPDFText_GetCharAngle",2),e._FPDFText_GetCharBox=s("FPDFText_GetCharBox",6),e._FPDFText_GetLooseCharBox=s("FPDFText_GetLooseCharBox",3),e._FPDFText_GetMatrix=s("FPDFText_GetMatrix",3),e._FPDFText_GetCharOrigin=s("FPDFText_GetCharOrigin",4),e._FPDFText_GetCharIndexAtPos=s("FPDFText_GetCharIndexAtPos",5),e._FPDFText_GetText=s("FPDFText_GetText",4),e._FPDFText_CountRects=s("FPDFText_CountRects",3),e._FPDFText_GetRect=s("FPDFText_GetRect",6),e._FPDFText_GetBoundedText=s("FPDFText_GetBoundedText",7),e._FPDFText_FindStart=s("FPDFText_FindStart",4),e._FPDFText_FindNext=s("FPDFText_FindNext",1),e._FPDFText_FindPrev=s("FPDFText_FindPrev",1),e._FPDFText_GetSchResultIndex=s("FPDFText_GetSchResultIndex",1),e._FPDFText_GetSchCount=s("FPDFText_GetSchCount",1),e._FPDFText_FindClose=s("FPDFText_FindClose",1),e._FPDFLink_LoadWebLinks=s("FPDFLink_LoadWebLinks",1),e._FPDFLink_CountWebLinks=s("FPDFLink_CountWebLinks",1),e._FPDFLink_GetURL=s("FPDFLink_GetURL",4),e._FPDFLink_CountRects=s("FPDFLink_CountRects",2),e._FPDFLink_GetRect=s("FPDFLink_GetRect",7),e._FPDFLink_GetTextRange=s("FPDFLink_GetTextRange",4),e._FPDFLink_CloseWebLinks=s("FPDFLink_CloseWebLinks",1),e._FPDFPage_GetDecodedThumbnailData=s("FPDFPage_GetDecodedThumbnailData",3),e._FPDFPage_GetRawThumbnailData=s("FPDFPage_GetRawThumbnailData",3),e._FPDFPage_GetThumbnailAsBitmap=s("FPDFPage_GetThumbnailAsBitmap",1),e._FPDFPage_SetMediaBox=s("FPDFPage_SetMediaBox",5),e._FPDFPage_SetCropBox=s("FPDFPage_SetCropBox",5),e._FPDFPage_SetBleedBox=s("FPDFPage_SetBleedBox",5),e._FPDFPage_SetTrimBox=s("FPDFPage_SetTrimBox",5),e._FPDFPage_SetArtBox=s("FPDFPage_SetArtBox",5),e._FPDFPage_GetMediaBox=s("FPDFPage_GetMediaBox",5),e._FPDFPage_GetCropBox=s("FPDFPage_GetCropBox",5),e._FPDFPage_GetBleedBox=s("FPDFPage_GetBleedBox",5),e._FPDFPage_GetTrimBox=s("FPDFPage_GetTrimBox",5),e._FPDFPage_GetArtBox=s("FPDFPage_GetArtBox",5),e._FPDFPage_TransF
3ormWithClip=s("FPDFPage_TransFormWithClip",3),e._FPDFPageObj_TransformClipPath=s("FPDFPageObj_TransformClipPath",7),e._FPDFPageObj_GetClipPath=s("FPDFPageObj_GetClipPath",1),e._FPDFClipPath_CountPaths=s("FPDFClipPath_CountPaths",1),e._FPDFClipPath_CountPathSegments=s("FPDFClipPath_CountPathSegments",2),e._FPDFClipPath_GetPathSegment=s("FPDFClipPath_GetPathSegment",3),e._FPDF_CreateClipPath=s("FPDF_CreateClipPath",4),e._FPDF_DestroyClipPath=s("FPDF_DestroyClipPath",1),e._FPDFPage_InsertClipPath=s("FPDFPage_InsertClipPath",2),e._FPDF_InitLibrary=s("FPDF_InitLibrary",0),e._FPDF_DestroyLibrary=s("FPDF_DestroyLibrary",0),e._FPDF_SetSandBoxPolicy=s("FPDF_SetSandBoxPolicy",2),e._FPDF_LoadDocument=s("FPDF_LoadDocument",2),e._FPDF_GetFormType=s("FPDF_GetFormType",1),e._FPDF_LoadXFA=s("FPDF_LoadXFA",1),e._FPDF_LoadMemDocument=s("FPDF_LoadMemDocument",3),e._FPDF_LoadMemDocument64=s("FPDF_LoadMemDocument64",3),e._FPDF_LoadCustomDocument=s("FPDF_LoadCustomDocument",2),e._FPDF_GetFileVersion=s("FPDF_GetFileVersion",2),e._FPDF_DocumentHasValidCrossReferenceTable=s("FPDF_DocumentHasValidCrossReferenceTable",1),e._FPDF_GetDocPermissions=s("FPDF_GetDocPermissions",1),e._FPDF_GetDocUserPermissions=s("FPDF_GetDocUserPermissions",1),e._FPDF_GetSecurityHandlerRevision=s("FPDF_GetSecurityHandlerRevision",1),e._EPDF_SetEncryption=s("EPDF_SetEncryption",4),e._EPDF_RemoveEncryption=s("EPDF_RemoveEncryption",1),e._EPDF_UnlockOwnerPermissions=s("EPDF_UnlockOwnerPermissions",2),e._EPDF_IsEncrypted=s("EPDF_IsEncrypted",1),e._EPDF_IsOwnerUnlocked=s("EPDF_IsOwnerUnlocked",1),e._FPDF_GetPageCount=s("FPDF_GetPageCount",1),e._FPDF_LoadPage=s("FPDF_LoadPage",2),e._EPDFDoc_LoadPageByObjectNumber=s("EPDFDoc_LoadPageByObjectNumber",2),e._EPDFDoc_GetPageObjectNumberByIndex=s("EPDFDoc_GetPageObjectNumberByIndex",2),e._EPDFPage_GetObjectNumber=s("EPDFPage_GetObjectNumber",1),e._FPDF_GetPageWidthF=s("FPDF_GetPageWidthF",1),e._FPDF_GetPageWidth=s("FPDF_GetPageWidth",1),e._FPDF_GetPageHeightF=s("FPDF_GetPageHeightF",1),e._FPDF_GetPageHeight=s("FPDF_GetPageHeight",1),e._FPDF_GetPageBoundingBox=s("FPDF_GetPageBoundingBox",2),e._FPDF_RenderPageBitmap=s("FPDF_RenderPageBitmap",8),e._FPDF_RenderPageBitmapWithMatrix=s("FPDF_RenderPageBitmapWithMatrix",5),e._EPDF_RenderAnnotBitmap=s("EPDF_RenderAnnotBitmap",6),e._EPDF_RenderAnnotBitmapUnrotated=s("EPDF_RenderAnnotBitmapUnrotated",6),e._FPDF_ClosePage=s("FPDF_ClosePage",1),e._FPDF_CloseDocument=s("FPDF_CloseDocument",1),e._FPDF_GetLastError=s("FPDF_GetLastError",0),e._FPDF_DeviceToPage=s("FPDF_DeviceToPage",10),e._FPDF_PageToDevice=s("FPDF_PageToDevice",10),e._FPDFBitmap_Create=s("FPDFBitmap_Create",3),e._FPDFBitmap_CreateEx=s("FPDFBitmap_CreateEx",5),e._FPDFBitmap_GetFormat=s("FPDFBitmap_GetFormat",1),e._FPDFBitmap_FillRect=s("FPDFBitmap_FillRect",6),e._FPDFBitmap_GetBuffer=s("FPDFBitmap_GetBuffer",1),e._FPDFBitmap_GetWidth=s("FPDFBitmap_GetWidth",1),e._FPDFBitmap_GetHeight=s("FPDFBitmap_GetHeight",1),e._FPDFBitmap_GetStride=s("FPDFBitmap_GetStride",1),e._FPDFBitmap_Destroy=s("FPDFBitmap_Destroy",1),e._FPDF_GetPageSizeByIndexF=s("FPDF_GetPageSizeByIndexF",3),e._EPDF_GetPageRotationByIndex=s("EPDF_GetPageRotationByIndex",2),e._EPDF_GetPageBoxByIndex=s("EPDF_GetPageBoxByIndex",4),e._EPDF_GetPageSizeByIndexNormalized=s("EPDF_GetPageSizeByIndexNormalized",3),e._EPDF_LoadPageNormalized=s("EPDF_LoadPageNormalized",3),e._FPDF_GetPageSizeByIndex=s("FPDF_GetPageSizeByIndex",4),e._FPDF_VIEWERREF_GetPrintScaling=s("FPDF_VIEWERREF_GetPrintScaling",1),e._FPDF_VIEWERREF_GetNumCopies=s("FPDF_VIEWERREF_GetNumCopies",1),e._FPDF_VIEWERREF_GetPrintPageRange=s("FPDF_VIEWERREF_GetPrintPageRange",1),e._FPDF_VIEWERREF_GetPrintPageRangeCount=s("FPDF_VIEWERREF_GetPrintPageRangeCount",1),e._FPDF_VIEWERREF_GetPrintPageRangeElement=s("FPDF_VIEWERREF_GetPrintPageRangeElement",2),e._FPDF_VIEWERREF_GetDuplex=s("FPDF_VIEWERREF_GetDuplex",1),e._FPDF_VIEWERREF_GetName=s("FPDF_VIEWERREF_GetName",4),e._FPDF_CountNamedDests=s("FPDF_CountNamedDests",1),e._FPDF_GetNamedDestByName=s("FPDF_GetNamedDestByName",2),e._FPDF_GetNamedDest=s("FPDF_GetNamedDest",4),e._FPDF_GetXFAPacketCount=s("FPDF_GetXFAPacketCount",1),e._FPDF_GetXFAPacketName=s("FPDF_GetXFAPacketName",4),e._FPDF_GetXFAPacketContent=s("FPDF_GetXFAPacketContent",5),e._FPDF_GetTrailerEnds=s("FPDF_GetTrailerEnds",3);var Pt,Zt,pn=s("strerror",1),bn=s("fflush",1),An=s("emscripten_builtin_memalign",2),ke=s("setThrew",2),en=()=>(en=fe.emscripten_stack_init)(),Gt=()=>(Gt=fe.emscripten_stack_get_end)(),tn=r=>(tn=fe._emscripten_stack_restore)(r),nn=r=>(nn=fe._emscripten_stack_alloc)(r),on=()=>(on=fe.emscripten_stack_get_current)();function En(){var r;en(),x(!(3&(r=Gt()))),r==0&&(r+=4),$[r>>2]=34821223,$[r+4>>2]=2310721022,$[0]=1668509029}function rn(){var r;function i(){Pt||(Pt=1,e.calledRun=1,se||(x(!he),he=!0,Pe(),e.noFSInit||d.initialized||d.init(),d.ignorePermissions=!1,ft(Be),n(e),e.onRuntimeInitialized?.(),x(!e._main,'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]'),(function(){Pe();var m=e.postRun;m&&(typeof m=="function"&&(m=[m]),m.forEach(ve)),ft(Me)})()))}de>
30||(En(),!Zt&&(Zt=1,(r=e.preRun)&&(typeof r=="function"&&(r=[r]),r.forEach(Oe)),ft(be),de>0)||(e.setStatus?(e.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>e.setStatus(""),1),i()},1)):i(),Pe()))}if(e.dynCall_j=s("dynCall_j",1),e.dynCall_ji=s("dynCall_ji",2),e.dynCall_iiij=s("dynCall_iiij",5),e.dynCall_jji=s("dynCall_jji",4),e.dynCall_iji=s("dynCall_iji",4),e.dynCall_viijii=s("dynCall_viijii",7),e.dynCall_jij=s("dynCall_jij",4),e.dynCall_iij=s("dynCall_iij",4),e.dynCall_iiji=s("dynCall_iiji",5),e.dynCall_jiji=s("dynCall_jiji",5),e.dynCall_iiiiij=s("dynCall_iiiiij",7),e.dynCall_iiiiijj=s("dynCall_iiiiijj",9),e.dynCall_iiiiiijj=s("dynCall_iiiiiijj",10),e.dynCall_viji=s("dynCall_viji",5),e.wasmExports=fe,e.ccall=qt,e.cwrap=(r,i,m,c)=>(...g)=>qt(r,i,m,g),e.addFunction=(r,i)=>{x(r!==void 0);var m=fn(r);if(m)return m;var c=(()=>{if(Mt.length)return Mt.pop();try{Ue.grow(1)}catch(b){throw b instanceof RangeError?"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.":b}return Ue.length-1})();try{yt(c,r)}catch(b){if(!(b instanceof TypeError))throw b;x(i!==void 0,"Missing signature argument to addFunction: "+r);var g=Dn(r,i);yt(c,g)}return Ke.set(r,c),c},e.removeFunction=r=>{Ke.delete(Ee(r)),yt(r,null),Mt.push(r)},e.setValue=function(r,i,m="i8"){switch(m.endsWith("*")&&(m="*"),m){case"i1":case"i8":V[r]=i;break;case"i16":z[r>>1]=i;break;case"i32":k[r>>2]=i;break;case"i64":H("to do setValue(i64) use WASM_BIGINT");case"float":ae[r>>2]=i;break;case"double":J[r>>3]=i;break;case"*":$[r>>2]=i;break;default:H(`invalid type for setValue: ${m}`)}},e.getValue=function(r,i="i8"){switch(i.endsWith("*")&&(i="*"),i){case"i1":case"i8":return V[r];case"i16":return z[r>>1];case"i32":return k[r>>2];case"i64":H("to do getValue(i64) use WASM_BIGINT");case"float":return ae[r>>2];case"double":return J[r>>3];case"*":return $[r>>2];default:H(`invalid type for getValue: ${i}`)}},e.UTF8ToString=He,e.stringToUTF8=Ye,e.UTF16ToString=(r,i)=>{x(r%2==0,"Pointer passed to UTF16ToString must be aligned to two bytes!");for(var m=r,c=m>>1,g=c+i/2;!(c>=g)&&q[c];)++c;if((m=c<<1)-r>32&&Xt)return Xt.decode(K.subarray(r,m));for(var b="",A=0;!(A>=i/2);++A){var G=z[r+2*A>>1];if(G==0)break;b+=String.fromCharCode(G)}return b},e.stringToUTF16=(r,i,m)=>{if(x(i%2==0,"Pointer passed to stringToUTF16 must be aligned to two bytes!"),x(typeof m=="number","stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),m??=2147483647,m<2)return 0;for(var c=i,g=(m-=2)<2*r.length?m/2:r.length,b=0;b<g;++b){var A=r.charCodeAt(b);z[i>>1]=A,i+=2}return z[i>>1]=0,i-c},["writeI53ToI64","writeI53ToI64Clamped","writeI53ToI64Signaling","
3writeI53ToU64Clamped","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(r){Lt(r,()=>{var i=`\`${r}\` 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`,m=r;m.startsWith("_")||(m="$"+r),i+=` (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='${m}')`,jt(r)&&(i+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"),We(i)}),Vt(r)}),["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(Vt),ye=function r(){Pt||rn(),Pt||(ye=r)},e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();rn(),t=a;for(const r of Object.keys(e))r in Y||Object.defineProperty(Y,r,{configurable:!0,get(){H(`Access to module property ('${r}') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.`)}});return t});const vt
vendor: 36,911 bytes, line 3
3={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
3Ln(Y){return(async function(t){const n={pdfium:t};for(const o in vt){const e=o,a=vt[e][0],u=vt[e][1];n[e]=t.cwrap(o,u,a)}return n})(await jn(Y))}function Fe(Y,t,n,o=100){let e=Y.wasmExports.malloc(o);for(let l=0;l<o;l++)Y.HEAP8[e+l]=0;const a=t(e,o);let u;if(a>o){Y.wasmExports.free(e),e=Y.wasmExports.malloc(a);for(let l=0;l<a;l++)Y.HEAP8[e+l]=0;t(e,a),u=n(e)}else u=n(e);return Y.wasmExports.free(e),u}function Rt(Y,t){const n=t(0,0),o=Y.wasmExports.malloc(n);t(o,n);const e=new ArrayBuffer(n),a=new DataView(e);for(let u=0;u<n;u++)a.setInt8(u,Y.getValue(o+u,"i8"));return Y.wasmExports.free(o),e}const Nn=new Set(["Title","Author","Subject","Keywords","Producer","Creator","CreationDate","ModDate","Trapped"]);function Vn(Y){if(!Y||Y.length>127||Nn.has(Y)||Y[0]==="/")return!1;for(let t=0;t<Y.length;t++){const n=Y.charCodeAt(t);if(n<32||n>126)return!1}return!0}const Un=Y=>Y,$n={pageTtl:5e3,maxPagesPerDocument:10,normalizeRotation:!1};class zn{constructor(t,n,o={}){this.pdfium=t,this.memoryManager=n,this.docs=new Map,this.config={...$n,...o}}setDocument(t,n,o,e=!1){let a=this.docs.get(t);if(!a){const u={...this.config,normalizeRotation:e};a=new Wn(n,o,this.pdfium,this.memoryManager,u),this.docs.set(t,a)}}getContext(t){return this.docs.get(t)}closeDocument(t){const n=this.docs.get(t);return!!n&&(this.docs.delete(t),n.dispose(),!0)}closeAllDocuments(){for(const t of this.docs.values())t.dispose();this.docs.clear()}updateConfig(t){Object.assign(this.config,t);for(const n of this.docs.values())n.updateConfig(this.config)}getCacheStats(){const t={};let n=0;for(const[o,e]of this.docs.entries()){const a=e.getCacheSize();t[o]=a,n+=a}return{documents:this.docs.size,totalPages:n,pagesByDocument:t}}}class Wn{constructor(t,n,o,e,a){this.filePtr=t,this.docPtr=n,this.memoryManager=e,this.disposed=!1,this.normalizeRotation=a.normalizeRotation,this.pageCache=new Hn(o,n,a)}acquirePage(t){return this.pageCache.acquire(t)}borrowPage(t,n){return this.pageCache.borrowPage(t,n)}updateConfig(t){this.pageCache.updateConfig(t)}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 Hn{constructor(t,n,o){this.pdf=t,this.docPtr=n,this.cache=new Map,this.accessOrder=[],this.config=o}acquire(t){let n=this.cache.get(t);if(!n){let o;this.evictIfNeeded(),o=this.config.normalizeRotation?this.pdf.EPDF_LoadPageNormalized(this.docPtr,t,0):this.pdf.FPDF_LoadPage(this.docPtr,t),n=new Kn(this.pdf,this.docPtr,t,o,this.config.pageTtl,()=>{this.cache.delete(t),this.removeFromAccessOrder(t)}),this.cache.set(t,n)}return this.updateAccessOrder(t),n.clearExpiryTimer(),n.bumpRefCount(),n}borrowPage(t,n){const o=this.cache.has(t),e=this.acquire(t);try{return n(e)}finally{o?e.release():e.disposeImmediate()}}forceReleaseAll(){for(const t of this.cache.values())t.disposeImmediate();this.cache.clear(),this.accessOrder.length=0}updateConfig(t){this.config=t;for(const n of this.cache.values())n.updateTtl(t.pageTtl);this.evictIfNeeded()}size(){return this.cache.size}evictIfNeeded(){for(;this.cache.size>=this.config.maxPagesPerDocument;){const t=this.accessOrder[0];if(t===void 0)break;{const n=this.cache.get(t);if(n){if(n.getRefCount()!==0)break;n.disposeImmediate()}else this.removeFromAccessOrder(t)}}}updateAccessOrder(t){this.removeFromAccessOrder(t),this.accessOrder.push(t)}removeFromAccessOrder(t){const n=this.accessOrder.indexOf(t);n>-1&&this.accessOrder.splice(n,1)}}class Kn{constructor(t,n,o,e,a,u){this.pdf=t,this.docPtr=n,this.pageIdx=o,this.pagePtr=e,this.onFinalDispose=u,this.refCount=0,this.disposed=!1,this.ttl=a}bumpRefCount(){if(this.disposed)throw new Error("Context already disposed");this.refCount++}getRefCount(){return this.refCount}clearExpiryTimer(){this.expiryTimer&&(clearTimeout(this.expiryTimer),this.expiryTimer=void 0)}updateTtl(t){this.ttl=t,this.expiryTimer&&this.refCount===0&&(this.clearExpiryTimer(),this.expiryTimer=setTimeout(()=>this.disposeImmediate(),this.ttl))}release(){this.disposed||(this.refCount--,this.refCount===0&&(this.expiryTimer=setTimeout(()=>this.disposeImmediate(),this.ttl)))}disposeImmediate(){this.disposed||(this.disposed=!0,this.clearExpiryTimer(),this.textPagePtr!==void 0&&this.pdf.FPDFText_ClosePage(this.textPagePtr),this.pdf.FPDF_ClosePage(this.pagePtr),this.onFinalDispose())}getTextPage(){return this.ensureAlive(),this.textPagePtr===void 0&&(this.textPagePtr=this.pdf.FPDFText_LoadPage(this.pagePtr)),this.textPagePtr}withAnnotation(t,n){this.ensureAlive();const o=this.pdf.FPDFPage_GetAnnot(this.pagePtr,t);try{return n(o)}finally{this.pdf.FPDFPage_CloseAnnot(o)}}withFormHandle(t){this.ensureAlive();const n=this.pdf.PDFiumExt_OpenFormFillInfo(),o=this.pdf.PDFiumExt_InitFormFillEnvironment(this.docPtr,n);this.pdf.FORM_OnAfterLoadPage(this.pagePtr,o);try{return t(o)}finally{this.pdf.FORM_OnBeforeClosePage(this.pagePtr,o),this.pdf.PDFiumExt_ExitFormFillEnvironment(o),this.pdf.PDFiumExt_CloseFormFillInfo(n)}}ensureAlive(){if(this.disposed)throw new Error("PageContext already disposed")}}const Fn={MAX_TOTAL_MEMORY:2147483648},kt="PDFiumEngine",wt="MemoryManager";class Xn{constructor(t,n){this.pdfiumModule=t,this.logger=n,this.allocations=new Map,this.totalAllocated=0}malloc(t){if(this.totalAllocated+t>Fn.MAX_TOTAL_MEMORY)throw new Error(`Total memory usage would exceed limit: ${this.totalAllocated+t} > ${Fn.MAX_TOTAL_MEMORY}`);const n=this.pdfiumModule.pdfium.wasmExports.malloc(t);
3if(!n)throw new Error(`Failed to allocate ${t} bytes`);const o={ptr:n,size:t,timestamp:Date.now(),stack:this.logger.isEnabled("debug")?new Error().stack:void 0};return this.allocations.set(n,o),this.totalAllocated+=t,n}free(t){const n=this.allocations.get(t);n?(this.totalAllocated-=n.size,this.allocations.delete(t)):this.logger.warn(kt,wt,`Freeing untracked pointer: ${t}`),this.pdfiumModule.pdfium.wasmExports.free(t)}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){this.logger.warn(kt,wt,`Potential memory leak: ${this.allocations.size} unfreed allocations`);for(const[t,n]of this.allocations)this.logger.warn(kt,wt,` - ${t}: ${n.size} bytes`,n.stack)}}}const ue="pdfium",le="font-fallback";class Yn{constructor(t,n=new dn){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=t,this.logger=n}initialize(t){if(this.enabled)return void this.logger.warn(ue,le,"Font fallback already initialized");this.module=t;const n=t.pdfium;if(typeof n.addFunction=="function")try{if(this.structPtr=n.wasmExports.malloc(36),!this.structPtr)throw new Error("Failed to allocate FPDF_SYSFONTINFO struct");for(let o=0;o<36;o++)n.setValue(this.structPtr+o,0,"i8");this.releaseFnPtr=n.addFunction(o=>{},"vi"),this.enumFontsFnPtr=n.addFunction((o,e)=>{},"vii"),this.mapFontFnPtr=n.addFunction((o,e,a,u,l,F,P)=>{const _=F?n.UTF8ToString(F):"",f=this.mapFont(e,a,u,l,_);return P&&n.setValue(P,0,"i32"),f},"iiiiiiii"),this.getFontFnPtr=n.addFunction((o,e)=>{const a=e?n.UTF8ToString(e):"";return this.mapFont(400,0,0,0,a)},"iii"),this.getFontDataFnPtr=n.addFunction((o,e,a,u,l)=>this.getFontData(e,a,u,l),"iiiiii"),this.getFaceNameFnPtr=n.addFunction((o,e,a,u)=>0,"iiiii"),this.getFontCharsetFnPtr=n.addFunction((o,e)=>{const a=this.fontHandles.get(e);return a?.charset??0},"iii"),this.deleteFontFnPtr=n.addFunction((o,e)=>{this.deleteFont(e)},"vii"),n.setValue(this.structPtr+0,1,"i32"),n.setValue(this.structPtr+4,this.releaseFnPtr,"i32"),n.setValue(this.structPtr+8,this.enumFontsFnPtr,"i32"),n.setValue(this.structPtr+12,this.mapFontFnPtr,"i32"),n.setValue(this.structPtr+16,this.getFontFnPtr,"i32"),n.setValue(this.structPtr+20,this.getFontDataFnPtr,"i32"),n.setValue(this.structPtr+24,this.getFaceNameFnPtr,"i32"),n.setValue(this.structPtr+28,this.getFontCharsetFnPtr,"i32"),n.setValue(this.structPtr+32,this.deleteFontFnPtr,"i32"),t.FPDF_SetSystemFontInfo(this.structPtr),this.enabled=!0,this.logger.info(ue,le,"Font fallback system initialized (pure TypeScript)",Object.keys(this.fontConfig.fonts))}catch(o){throw this.logger.error(ue,le,"Failed to initialize font fallback",o),this.cleanup(),o}else this.logger.error(ue,le,"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(ue,le,"Font fallback system disabled"))}cleanup(){if(!this.module)return;const t=this.module.pdfium;this.structPtr&&(t.wasmExports.free(this.structPtr),this.structPtr=0);const n=o=>{if(o&&typeof t.removeFunction=="function")try{t.removeFunction(o)}catch{}};n(this.releaseFnPtr),n(this.enumFontsFnPtr),n(this.mapFontFnPtr),n(this.getFontFnPtr),n(this.getFontDataFnPtr),n(this.getFaceNameFnPtr),n(this.getFontCharsetFnPtr),n(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(t){const n=t.map(e=>this.getFontUrlForCharset(e)).filter(e=>e!==null),o=[...new Set(n)];await Promise.all(o.map(async e=>{if(!this.fontCache.has(e))try{const a=await this.fetchFontAsync(e);a&&(this.fontCache.set(e,a),this.logger.debug(ue,le,`Pre-loaded font: ${e}`))}catch(a){this.logger.warn(ue,le,`Failed to pre-load font: ${e}`,a)}}))}mapFont(t,n,o,e,a){const u=n!==0;this.logger.debug(ue,le,"MapFont called",{weight:t,italic:u,charset
3:o,pitchFamily:e,face:a});const l=this.findBestFontMatch(o,t,u);if(!l)return this.logger.debug(ue,le,`No font configured for charset ${o}`),0;const F={id:this.nextHandleId++,charset:o,weight:t,italic:u,url:l.url,data:null};return this.fontHandles.set(F.id,F),this.logger.debug(ue,le,`Created font handle ${F.id} for ${l.url} (requested: weight=${t}, italic=${u}, matched: weight=${l.matchedWeight}, italic=${l.matchedItalic})`),F.id}getFontData(t,n,o,e){const a=this.fontHandles.get(t);if(!a)return this.logger.warn(ue,le,`Unknown font handle: ${t}`),0;if(a.data||(this.fontCache.has(a.url)?a.data=this.fontCache.get(a.url):(a.data=this.fetchFontSync(a.url),a.data&&this.fontCache.set(a.url,a.data))),!a.data)return this.logger.warn(ue,le,`Failed to load font: ${a.url}`),0;const u=a.data;return n!==0?(this.logger.debug(ue,le,`Table ${n} requested - returning 0 to request whole file`),0):(o===0||e<u.length||this.module&&(this.module.pdfium.HEAPU8.set(u,o),this.logger.debug(ue,le,`Copied ${u.length} bytes to buffer for handle ${t}`)),u.length)}deleteFont(t){this.fontHandles.get(t)&&(this.logger.debug(ue,le,`Deleting font handle ${t}`),this.fontHandles.delete(t))}findBestFontMatch(t,n,o){const{fonts:e,defaultFont:a,baseUrl:u}=this.fontConfig,l=e[t]??a;if(!l)return null;const F=this.normalizeToVariants(l);if(F.length===0)return null;const P=this.selectBestVariant(F,n,o);let _=P.url;return!u||_.startsWith("http://")||_.startsWith("https://")||_.startsWith("/")||(_=`${u}/${_}`),{url:_,matchedWeight:P.weight??400,matchedItalic:P.italic??!1}}normalizeToVariants(t){return typeof t=="string"?[{url:t,weight:400,italic:!1}]:Array.isArray(t)?t.map(n=>({url:n.url,weight:n.weight??400,italic:n.italic??!1})):[{url:t.url,weight:t.weight??400,italic:t.italic??!1}]}selectBestVariant(t,n,o){if(t.length===1)return t[0];const e=t.filter(F=>(F.italic??!1)===o),a=e.length>0?e:t;let u=a[0],l=Math.abs((u.weight??400)-n);for(const F of a){const P=F.weight??400,_=Math.abs(P-n);if(_<l)u=F,l=_;else if(_===l){const f=u.weight??400;n>=500?P>f&&(u=F):P<f&&(u=F)}}return u}getFontUrlForCharset(t){const n=this.findBestFontMatch(t,400,!1);return n?.url??null}fetchFontSync(t){if(this.logger.debug(ue,le,`Fetching font synchronously: ${t}`),this.fontConfig.fontLoader)try{const n=this.fontConfig.fontLoader(t);return n?this.logger.info(ue,le,`Loaded font via custom loader: ${t} (${n.length} bytes)`):this.logger.warn(ue,le,`Custom font loader returned null for: ${t}`),n}catch(n){return this.logger.error(ue,le,`Error in custom font loader: ${t}`,n),null}try{const n=new XMLHttpRequest;if(n.open("GET",t,!1),n.responseType="arraybuffer",n.send(),n.status===200){const o=new Uint8Array(n.response);return this.logger.info(ue,le,`Loaded font: ${t} (${o.length} bytes)`),o}return this.logger.error(ue,le,`Failed to load font: ${t} (HTTP ${n.status})`),null}catch(n){return this.logger.error(ue,le,`Error fetching font: ${t}`,n),null}}async fetchFontAsync(t){if(this.fontConfig.fontLoader)try{return this.fontConfig.fontLoader(t)}catch{return null}try{const n=await fetch(t);if(n.ok){const o=await n.arrayBuffer();return new Uint8Array(o)}return null}catch{return null}}}const h="PDFiumEngine",D="Engine";class Jn{constructor(t,n={}){this.pdfiumModule=t,this.memoryLeakCheckInterval=null,this.fontFallbackManager=null;const{logger:o=new dn,fontFallback:e}=n;this.logger=o,this.memoryManager=new Xn(this.pdfiumModule,this.logger),this.cache=new zn(this.pdfiumModule,this.memoryManager),this.logger.isEnabled("debug")&&(this.memoryLeakCheckInterval=setInterval(()=>{this.memoryManager.checkLeaks()},1e4)),this.logger.debug(h,D,"initialize"),this.logger.perf(h,D,"Initialize","Begin","General"),this.pdfiumModule.PDFiumExt_Init(),this.logger.perf(h,D,"Initialize","End","General"),e&&(this.fontFallbackManager=new Yn(e,this.logger),this.fontFallbackManager.initialize(this.pdfiumModule),this.logger.info(h,D,"Font fallback system enabled"))}destroy(){return this.logger.debug(h,D,"destroy"),this.logger.perf(h,D,"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(h,D,"Destroy","End","General"),E.resolve(!0)}getFontFallbackManager(){return this.fontFallbackManager}withWString(t,n){const o=2*(t.length+1),e=this.memoryManager.malloc(o);try{return this.pdfiumModule.pdfium.stringToUTF16(t,e,o),n(e)}finally{this.memoryManager.free(e)}}withFloatArray(t,n){const o=t??[],e=4*o.length,a=e?this.memoryManager.malloc(e):0;try{if(e)for(let u=0;u<o.length;u++)this.pdfiumModule.pdfium.setValue(a+4*u,o[u],"float");return n(a,o.length)}finally{e&&this.memoryManager.free(a)}}openDocumentBuffer(t,n){this.logger.debug(h,D,"openDocumentBuffer",t,n
vendor: 38,830 bytes, lines 3-5
3),this.logger.perf(h,D,"OpenDocumentBuffer","Begin",t.id);const o=n?.normalizeRotation??!1,e=new Uint8Array(t.content),a=e.length,u=this.memoryManager.malloc(a);this.pdfiumModule.pdfium.HEAPU8.set(e,u);const l=this.pdfiumModule.FPDF_LoadMemDocument(u,a,n?.password??"");if(!l){const C=this.pdfiumModule.FPDF_GetLastError();return this.logger.error(h,D,`FPDF_LoadMemDocument failed with ${C}`),this.memoryManager.free(u),this.logger.perf(h,D,"OpenDocumentBuffer","End",t.id),E.reject({code:C,message:"FPDF_LoadMemDocument failed"})}const F=this.pdfiumModule.FPDF_GetPageCount(l),P=[],_=this.memoryManager.malloc(8),f=this.memoryManager.malloc(16);for(let C=0;C<F;C++){if(!(o?this.pdfiumModule.EPDF_GetPageSizeByIndexNormalized(l,C,_):this.pdfiumModule.FPDF_GetPageSizeByIndexF(l,C,_))){const z=this.pdfiumModule.FPDF_GetLastError();return this.logger.error(h,D,`${o?"EPDF_GetPageSizeByIndexNormalized":"FPDF_GetPageSizeByIndexF"} failed with ${z}`),this.memoryManager.free(_),this.memoryManager.free(f),this.pdfiumModule.FPDF_CloseDocument(l),this.memoryManager.free(u),this.logger.perf(h,D,"OpenDocumentBuffer","End",t.id),E.reject({code:z,message:(o?"EPDF_GetPageSizeByIndexNormalized":"FPDF_GetPageSizeByIndexF")+" failed"})}const R=this.pdfiumModule.EPDF_GetPageRotationByIndex(l,C),N=this.pdfiumModule.EPDFDoc_GetPageObjectNumberByIndex(l,C),V=this.readPageBoxes(l,C,f),K={index:C,size:{width:this.pdfiumModule.pdfium.getValue(_,"float"),height:this.pdfiumModule.pdfium.getValue(_+4,"float")},rotation:R,objectNumber:N,boxes:V};P.push(K)}this.memoryManager.free(_),this.memoryManager.free(f);const p=this.pdfiumModule.EPDF_IsEncrypted(l),M=this.pdfiumModule.EPDF_IsOwnerUnlocked(l),y=this.pdfiumModule.FPDF_GetDocPermissions(l),T={id:t.id,pageCount:F,pages:P,isEncrypted:p,isOwnerUnlocked:M,permissions:y,normalizedRotation:o};return this.cache.setDocument(t.id,u,l,o),this.logger.perf(h,D,"OpenDocumentBuffer","End",t.id),E.resolve(T)}createDocument(t){this.logger.debug(h,D,"createDocument",t),this.logger.perf(h,D,"CreateDocument","Begin",t);const n=this.pdfiumModule.FPDF_CreateNewDocument();if(!n)return this.logger.perf(h,D,"CreateDocument","End",t),E.reject({code:S.CantCreateNewDoc,message:"can not create new document"});const o={id:t,pageCount:0,pages:[],isEncrypted:!1,isOwnerUnlocked:!0,permissions:4294967295,normalizedRotation:!1};return this.cache.setDocument(t,0,n,!1),this.logger.perf(h,D,"CreateDocument","End",t),E.resolve(o)}getMetadata(t){this.logger.debug(h,D,"getMetadata",t),this.logger.perf(h,D,"GetMetadata","Begin",t.id);const n=this.cache.getContext(t.id);if(!n)return this.logger.perf(h,D,"GetMetadata","End",t.id),E.reject({code:S.DocNotOpen,message:"document does not open"});const o=this.readMetaText(n.docPtr,"CreationDate"),e=this.readMetaText(n.docPtr,"ModDate"),a={title:this.readMetaText(n.docPtr,"Title"),author:this.readMetaText(n.docPtr,"Author"),subject:this.readMetaText(n.docPtr,"Subject"),keywords:this.readMetaText(n.docPtr,"Keywords"),producer:this.readMetaText(n.docPtr,"Producer"),creator:this.readMetaText(n.docPtr,"Creator"),creationDate:o?gt(o)??null:null,modificationDate:e?gt(e)??null:null,trapped:this.getMetaTrapped(n.docPtr),custom:this.readAllMeta(n.docPtr,!0)};return this.logger.perf(h,D,"GetMetadata","End",t.id),E.resolve(a)}setMetadata(t,n){this.logger.debug(h,D,"setMetadata",t,n),this.logger.perf(h,D,"SetMetadata","Begin",t.id);const o=this.cache.getContext(t.id);if(!o)return this.logger.perf(h,D,"SetMetadata","End",t.id),E.reject({code:S.DocNotOpen,message:"document does not open"});const e=[["title","Title"],["author","Author"],["subject","Subject"],["keywords","Keywords"],["producer","Producer"],["creator","Creator"]];let a=!0;for(const[l,F]of e){const P=n[l];if(P===void 0)continue;const _=P===null?null:P;this.setMetaText(o.docPtr,F,_)||(a=!1)}const u=(l,F)=>{const P=n[l];if(P===void 0)return;if(P===null)return void(this.setMetaText(o.docPtr,F,null)||(a=!1));const _=xt(P);this.setMetaText(o.docPtr,F,_)||(a=!1)};if(u("creationDate","CreationDate"),u("modificationDate","ModDate"),n.trapped!==void 0&&(this.setMetaTrapped(o.docPtr,n.trapped??null)||(a=!1)),n.custom!==void 0)for(const[l,F]of Object.entries(n.custom))Vn(l)?this.setMetaText(o.docPtr,l,F??null)||(a=!1):this.logger.warn(h,D,"Invalid custom metadata key skipped",l);return this.logger.perf(h,D,"SetMetadata","End",t.id),a?E.resolve(!0):E.reject({code:S.Unknown,message:"one or more metadata fields could not be written"})}getDocPermissions(t){this.logger.debug(h,D,"getDocPermissions",t),this.logger.perf(h,D,"getDocPermissions","Begin",t.id);const n=this.cache.getContext(t.id);if(!n)return this.logger.perf(h,D,"getDocPermissions","End",t.id),E.reject({code:S.DocNotOpen,message:"document does not open"});const o=this.pdfiumModule.FPDF_GetDocPermissions(n.docPtr);return E.resolve(o)}getDocUserPermissions(t){this.logger.debug(h,D,"getDocUserPermissions",t),this.logger.perf(h,D,"getDocUserPermissions","Begin",t.id);const n=this.cache.getContext(t.id);if(!n)return this.logger.perf(h,D,"getDocUserPermissions","End",t.id),E.reject({code:S.DocNotOpen,message:"document does not open"});const o=this.pdfiumModule.FPDF_GetDocUserPermissions(n.docPtr);return E.resolve(o)}getSignatures(t){this.logger.debug(h,D,"getSignatures",t),this.logger.perf(h,D,"GetSignatures","Begin",t.id);const n=this.cache.getContext(t.id);if(!n)return this.logger.perf(h,D,"GetSignatures","End",t.id),E.reject({code:S.DocNotOpen,message:"document does not open"});const o=[],e=this.pdfiumModule.FPDF_GetSignatureCount(n.docPtr);for(let a=0;a<e;a++){const u=this.pdfiumModule.FPDF_GetSignatureObject(n.docPtr,a),l=Rt(this.pdfiumModule.pdfium,(M,y)=>this.pdfiumModule.FPDFSignatureObj_GetContents(u,M,y)),F=Rt(this.pdfiumModule.pdfium,(M,y)=>4*this.pdfiumModule.FPDFSignatureObj_GetByteRange(u,M,y)),P=Rt(this.pdfiumModule.pdfium,(M,y)=>this.pdfiumModule.FPDFSignatureObj_GetSubFilter(u,M,y)),_=Fe(this.pdfiumModule.pdfium,(M,y)=>this.pdfiumModule.FPDFSignatureObj_GetReason(u,M,y),this.pdfiumModule.pdfium.UTF16ToString),f=Fe(this.pdfiumModule.pdfium,(M,y)=>this.pdfiumModule.FPDFSignatureObj_GetTime(u,M,y),this.pdfiumModule.pdfium.UTF8ToString),p=this.pdfiumModule.FPDFSignatureObj_GetDocMDPPermission(u);o.push({contents:l,byteRange:F,subFilter:P,reason:_,time:f,docMDP:p})}return this.logger.perf(h,D,"GetSignatures","End",t.id),E.resolve(o)}getBookmarks(t){this.logger.debug(h,D,"getBookmarks",t),this.logger.perf(h,D,"GetBookmarks","Begin",t.id);const n=this.cache.getContext(t.id);if(!n)return this.logger.perf(h,D,"getBookmarks","End",t.id),E.reject({code:S.DocNotOpen,message:"document does not open"});const o=this.readPdfBookmarks(n.docPtr,0);return this.logger.perf(h,D,"GetBookmarks","End",t.id),E.resolve({bookmarks:o})}setBookmarks(t,n){this.logger.debug(h,D,"setBookmarks",t,n),this.logger.perf(h,D,"SetBookmarks","Begin",t.id);const o=this.cache.getContext(t.id);if(!o)return this.logger.perf(h,D,"SetBookmarks","End",t.id),E.reject({code:S.DocNotOpen,message:"document does not open"});if(!this.pdfiumModule.EPDFBookmark_Clear(o.docPtr))return this.logger.perf(h,D,"SetBookmarks","End",t.id),E.reject({code:S.Unknown,message:"failed to clear existing bookmarks"});const e=(u,l)=>{var F;for(const P of l){const _=this.withWString(P.title??"",f=>this.pdfiumModule.EPDFBookmark_AppendChild(o.docPtr,u,f));if(!_||P.target&&!this.applyBookmarkTarget(o.docPtr,_,P.target)||(F=P.children)!=null&&F.length&&!e(_,P.children))return!1}return!0},a=e(0,n);return this.logger.perf(h,D,"SetBookmarks","End",t.id),a?E.resolve(!0):E.reject({code:S.Unknown,message:"failed to build bookmark tree"})}deleteBookmarks(t){this.logger.debug(h,D,"deleteBookmarks",t),this.logger.perf(h,D,"DeleteBookmarks","Begin",t.id);const n=this.cache.getContext(t.id);if(!n)return this.logger.perf(h,D,"DeleteBookmarks","End",t.id),E.reject({code:S.DocNotOpen,message:"document does not open"});const o=this.pdfiumModule.EPDFBookmark_Clear(n.docPtr);return this.logger.perf(h,D,"DeleteBookmarks","End",t.id),o?E.resolve(!0):E.reject({code:S.Unknown,message:"failed to clear bookmarks"})}renderPageRaw(t,n,o){this.logger.debug(h,D,"renderPage",t,n,o),this.logger.perf(h,D,"RenderPage","Begin",`${t.id}-${n.index}`);const e={origin:{x:0,y:0},size:n.size},a=this.renderRectEncoded(t,n,e,o);return this.logger.perf(h,D,"RenderPage","End",`${t.id}-${n.index}`),a}renderPageRect(t,n,o,e){this.logger.debug(h,D,"renderPageRect",t,n,o,e),this.logger.perf(h,D,"RenderPageRect","Begin",`${t.id}-${n.index}`);const a=this.renderRectEncoded(t,n,o,e);return this.logger.perf(h,D,"RenderPageRect","End",`${t.id}-${n.index}`),a}getDocumentJavaScriptActions(t){this.logger.debug(h,D,"getDocumentJavaScriptActions",t);const n=this.cache.getContext(t.id);if(!n)return E.reject({code:S.DocNotOpen,message:"document does not open"});const o=this.pdfiumModule.FPDFDoc_GetJavaScriptActionCount(n.docPtr);if(o<0)return E.reject({code:S.Unknown,message:"failed to read document javascript actions"});const e=[];for(let a=0;a<o;a++){const u=this.pdfiumModule.FPDFDoc_GetJavaScriptAction(n.docPtr,a);if(u)try{const l=Fe(this.pdfiumModule.pdfium,(P,_)=>this.pdfiumModule.FPDFJavaScriptAction_GetName(u,P,_),this.pdfiumModule.pdfium.UTF16ToString)??"",F=Fe(this.pdfiumModule.pdfium,(P,_)=>this.pdfiumModule.FPDFJavaScriptAction_GetScript(u,P,_),this.pdfiumModule.pdfium.UTF16ToString)??"";if(!F)continue;e.push({id:`document:${a}:${l}`,trigger:ut.DocumentNamed,name:l,script:F})}finally{this.pdfiumModule.FPDFDoc_CloseJavaScriptAction(u)}}return E.resolve(e)}getPageAnnoWidgets(t,n){this.logger.debug(h,D,"getPageAnnoWidgets",t,n),this.logger.perf(h,D,"GetPageAnnoWidgets","Begin",`${t.id}-${n.index}`);const o=this.cache.getContext(t.id);if(!o)return this.logger.perf(h,D,"GetPageAnnoWidgets","End",`${t.id}-${n.index}`),E.reject({code:S.DocNotOpen,message:"document does not open"});const e=this.readPageAnnoWidgets(t,o,n);return this.logger.perf(h,D,"GetPageAnnoWidgets","End",`${t.id}-${n.index}`),this.logger.debug(h,D,"GetPageAnnoWidgets",`${t.id}-${n.index}`,e),E.resolve(e)}getPageWidgetJavaScriptActions(t,n){this.logger.debug(h,D,"getPageWidgetJavaScriptActions",t,n);const o=this.cache.getContext(t.id);if(!o)return E.reject({code:S.DocNotOpen,message:"document does not open"});const e=[];return o.borrowPage(n.index,a=>{a.withFormHandle(u=>{const l=this.pdfiumModule.FPDFPage_GetAnnotCount(a.pagePtr);for(let F=0;F<l;F++)a.withAnnotation(F,P=>{if(this.pdfiumModule.FPDFAnnot_GetSubtype(P)!==v.WIDGET)return;let _=this.getAnnotString(P,"NM");_||(_=lt(),this.setAnnotString(P,"NM",_));const f=Fe(this.pdfiumModule.pdfium,(M,y)=>this.pdfiumModule.FPDFAnnot_GetFormFieldName(u,P,M,y),this.pdfiumModule.pdfium.UTF16ToString)??"",p=[{event:Dt.KEY_STROKE,eventType:ht.Keystroke,trigger:ut.WidgetKeystroke},{event:Dt.FORMAT,eventType:ht.Format,trigger:ut.WidgetFormat},{event:Dt.VALIDATE,eventType:ht.Validate,trigger:ut.WidgetValidate},{event:Dt.CALCULATE,eventType:ht.Calculate,trigger:ut.WidgetCalculate}];for(const M of p){const y=Fe(this.pdfiumModule.pdfium,(T,C)=>this.pdfiumModule.FPDFAnnot_GetFormAdditionalActionJavaScript(u,P,M.event,T,C),this.pdfiumModule.pdfium.UTF16ToString)??"";y&&e.push({id:`widget:${n.index}:${_}:${M.eventType}`,trigger:M.trigger,eventType:M.eventType,pageIndex:n.index,annotationId:_,fieldName:f,script:y})}})})}),E.resolve(e)}regenerateWidgetAppearances(t,n,o){const e=this.cache.getContext(t.id);if(!e)return E.reject({code:S.DocNotOpen,message:"document does not open"});const a=new Set(o);let u=0;return e.borrowPage(n.index,l=>{const F=this.pdfiumModule.FPDFPage_GetAnnotCount(l.pagePtr);for(let P=0;P<F;P++)l.withAnnotation(P,_=>{const f=this.getAnnotString(_,"NM");f&&a.has(f)&&(this.pdfiumModule.EPDFAnnot_GenerateFormFieldAP(_),u++)});u>0&&this.pdfiumModule.FPDFPage_GenerateContent(l.pagePtr)}),E.resolve(u>0)}getPageAnnotations(t,n){this.logger.debug(h,D,"getPageAnnotations",t,n),this.logger.perf(h,D,"GetPageAnnotations","Begin",`${t.id}-${n.index}`);const o=this.cache.getContext(t.id);if(!o)return this.logger.perf(h,D,"GetPageAnnotations","End",`${t.id}-${n.index}`),E.reject({code:S.DocNotOpen,message:"document does not open"});const e=this.readPageAnnotations(t,o,n);return this.logger.perf(h,D,"GetPageAnnotations","End",`${t.id}-${n.index}`),this.logger.debug(h,D,"GetPageAnnotations",`${t.id}-${n.index}`,e),E.resolve(e)}createPageAnnotation(t,n,o,e){var a;this.logger.debug(h,D,"createPageAnnotation",t,n,o),this.logger.perf(h,D,"CreatePageAnnotation","Begin",`${t.id}-${n.index}`);const u=this.cache.getContext(t.id);if(!u)return this.logger.perf(h,D,"CreatePageAnnotation","End",`${t.id}-${n.index}`),E.reject({code:S.DocNotOpen,message:"document does not open"});const l=u.acquirePage(n.index);let F,P,_;if(o.type===v.WIDGET){const M=o;P=this.pdfiumModule.PDFiumExt_OpenFormFillInfo(),_=this.pdfiumModule.PDFiumExt_InitFormFillEnvironment(u.docPtr,P),this.pdfiumModule.FORM_OnAfterLoadPage(l.pagePtr,_);const y=((a=M.field)==null?void 0:a.name)??"";F=this.withWString(y,T=>this.pdfiumModule.EPDFPage_CreateFormField(l.pagePtr,_,M.field.type,T))}else F=this.pdfiumModule.EPDFPage_CreateAnnot(l.pagePtr,o.type);if(!F)return this.logger.perf(h,D,"CreatePageAnnotation","End",`${t.id}-${n.index}`),l.release(),E.reject({code:S.CantCreateAnnot,message:"can not create annotation with specified type"});if(o.id||(o.id=lt()),!this.setAnnotString(F,"NM",o.id))return this.pdfiumModule.FPDFPage_CloseAnnot(F),l.release(),E.reject({code:S.CantSetAnnotString,message:"can not set the name of the annotation"});if(!this.setPageAnnoRect(t,n,F,o.rect))return this.pdfiumModule.FPDFPage_CloseAnnot(F),l.release(),this.logger.perf(h,D,"CreatePageAnnotation","End",`${t.id}-${n.index}`),E.reject({code:S.CantSetAnnotRect,message:"can not set the rect of the annotation"});const f=this.prepareAnnotationForSave(o);let p=!1;switch(f.type){case v.INK:p=this.addInkStroke(t,n,l.pagePtr,F,f);break;case v.STAMP:p=this.addStampContent(t,u.docPtr,n,l.pagePtr,F,f,e);break;case v.TEXT:p=this.addTextContent(t,n,l.pagePtr,F,f);break;case v.FREETEXT:p=this.addFreeTextContent(t,n,l.pagePtr,F,f);break;case v.LINE:p=this.addLineContent(t,n,l.pagePtr,F,f);break;case v.POLYLINE:case v.POLYGON:p=this.addPolyContent(t,n,l.pagePtr,F,f);break;case v.CIRCLE:case v.SQUARE:p=this.addShapeContent(t,n,l.pagePtr,F,f);break;case v.UNDERLINE:case v.STRIKEOUT:case v.SQUIGGLY:case v.HIGHLIGHT:p=this.addTextMarkupContent(t,n,l.pagePtr,F,f);break;case v.LINK:p=this.addLinkContent(t,n,u.docPtr,l.pagePtr,F,f);break;case v.CARET:p=this.addCaretContent(t,n,l.pagePtr,F,f);break;case v.REDACT:p=this.addRedactContent(t,n,l.pagePtr,F,f);break;case v.WIDGET:{const M=f;if(_!==void 0)switch(M.field.type){case oe.TEXTFIELD:p=this.addTextFieldContent(_,F,M);break;case oe.CHECKBOX:case oe.RADIOBUTTON:p=this.addToggleFieldContent(_,F,M);break;case oe.COMBOBOX:case oe.LISTBOX:p=this.addChoiceFieldContent(_,F,M)}break}}return _!==void 0&&(this.pdfiumModule.FORM_OnBeforeClosePage(l.pagePtr,_),this.pdfiumModule.PDFiumExt_ExitFormFillEnvironment(_)),P!==void 0&&this.pdfiumModule.PDFiumExt_CloseFormFillInfo(P),p?(o.type===v.WIDGET?this.pdfiumModule.EPDFAnnot_GenerateFormFieldAP(F):o.blendMode!==void 0?this.pdfiumModule.EPDFAnnot_GenerateAppearanceWithBlend(F,o.blendMode):this.pdfiumModule.EPDFAnnot_GenerateAppearance(F),this.pdfiumModule.FPDFPage_GenerateContent(l.pagePtr),this.pdfiumModule.FPDFPage_CloseAnnot(F),l.release(),this.logger.perf(h,D,"CreatePageAnnotation","End",`${t.id}-${n.index}`),E.resolve(o.id)):(this.removeAnnotationByName(l.pagePtr,o.id),this.pdfiumModule.FPDFPage_CloseAnnot(F),l.release(),this.logger.perf(h,D,"CreatePageAnnotation","End",`${t.id}-${n.index}`),E.reject({code:S.CantSetAnnotContent,message:"can not add content of the annotation"}))}updatePageAnnotation(t,n,o,e){this.logger.debug(h,D,"updatePageAnnotation",t,n,o),this.logger.perf(h,D,"UpdatePageAnnotation","Begin",`${t.id}-${n.index}`);const a=this.cache.getContext(t.id);if(!a)return this.logger.perf(h,D,"UpdatePageAnnotation","End",`${t.id}-${n.index}`),E.reject({code:S.DocNotOpen,message:"document does not open"});const u=a.acquirePage(n.index),l=this.getAnnotationByName(u.pagePtr,o.id);if(!l)return u.release(),this.logger.perf(h,D,"UpdatePageAnnotation","End",`${t.id}-${n.index}`),E.reject({code:S.NotFound,message:"annotation not found"});if(!this.setPageAnnoRect(t,n,l,o.rect))return this.pdfiumModule.FPDFPage_CloseAnnot(l),u.release(),this.logger.perf(h,D,"UpdatePageAnnotation","End",`${t.id}-${n.index}`),E.reject({code:S.CantSetAnnotRect,message:"failed to move annotation"});const F=this.prepareAnnotationForSave(o);let P=!1;switch(F.type){case v.INK:if(!this.pdfiumModule.FPDFAnnot_RemoveInkList(l))break;P=this.addInkStroke(t,n,u.pagePtr,l,F);break;case v.STAMP:P=this.addStampContent(t,a.docPtr,n,u.pagePtr,l,F);break;case v.TEXT:P=this.addTextContent(t,n,u.pagePtr,l,F);break;case v.FREETEXT:P=this.addFreeTextContent(t,n,u.pagePtr,l,F);break;case v.CIRCLE:case v.SQUARE:P=this.addShapeContent(t,n,u.pagePtr,l,F);break;case v.LINE:P=this.addLineContent(t,n,u.pagePtr,l,F);break;case v.POLYGON:case v.POLYLINE:P=this.addPolyContent(t,n,u.pagePtr,l,F);break;case v.HIGHLIGHT:case v.UNDERLINE:case v.STRIKEOUT:case v.SQUIGGLY:P=this.addTextMarkupContent(t,n,u.pagePtr,l,F);break;case v.LINK:P=this.addLinkContent(t,n,a.docPtr,u.pagePtr,l,F);break;case v.CARET:P=this.addCaretContent(t,n,u.pagePtr,l,F);break;case v.REDACT:P=this.addRedactContent(t,n,u.pagePtr,l,F);break;case v.WIDGET:{const _=F;u.withFormHandle(f=>{switch(_.field.type){case oe.TEXTFIELD:P=this.addTextFieldContent(f,l,_);break;case oe.CHECKBOX:case oe.RADIOBUTTON:P=this.addToggleFieldContent(f,l,_);break;case oe.COMBOBOX:case oe.LISTBOX:P=this.addChoiceFieldContent(f,l,_)}});break}default:P=!1}return P&&e?.regenerateAppearance!==!1&&(o.type===v.WIDGET?this.pdfiumModule.EPDFAnnot_GenerateFormFieldAP(l):o.blendMode!==void 0?this.pdfiumModule.EPDFAnnot_GenerateAppearanceWithBlend(l,o.blendMode):this.pdfiumModule.EPDFAnnot_GenerateAppearance(l),this.pdfiumModule.FPDFPage_GenerateContent(u.pagePtr)),this.pdfiumModule.FPDFPage_CloseAnnot(l),u.release(),this.logger.perf(h,D,"UpdatePageAnnotation","End",`${t.id}-${n.index}`),P?E.resolve(!0):E.reject({code:S.CantSetAnnotContent,message:"failed to update annotation"})}removePageAnnotation(t,n,o){this.logger.debug(h,D,"removePageAnnotation",t,n,o),this.logger.perf(h,D,"RemovePageAnnotation","Begin",`${t.id}-${n.index}`);const e=this.cache.getContext(t.id);if(!e)return this.logger.perf(h,D,"RemovePageAnnotation","End",`${t.id}-${n.index}`),E.reject({code:S.DocNotOpen,message:"document does not open"});const a=e.acquirePage(n.index);let u=!1;return u=this.removeAnnotationByName(a.pagePtr,o.id),u?(u=this.pdfiumModule.FPDFPage_GenerateContent(a.pagePtr),u||this.logger.error(h,D,"FPDFPage_GenerateContent Failed",`${t.id}-${n.index}`)):this.logger.error(h,D,"FPDFPage_RemoveAnnot Failed",`${t.id}-${n.index}`),a.release(),this.logger.perf(h,D,"RemovePageAnnotation","End",`${t.id}-${n.index}`),E.resolve(u)}getPageTextRects(t,n){this.logger.debug(h,D,"getPageTextRects",t,n),this.logger.perf(h,D,"GetPageTextRects","Begin",`${t.id}-${n.index}`);const o=this.cache.getContext(t.id);if(!o)return this.logger.perf(h,D,"GetPageTextRects","End",`${t.id}-${n.index}`),E.reject({code:S.DocNotOpen,message:"document does not open"});const e=o.acquirePage(n.index),a=this.pdfiumModule.FPDFText_LoadPage(e.pagePtr),u=this.readPageTextRects(n,e.docPtr,e.pagePtr,a);return this.pdfiumModule.FPDFText_ClosePage(a),e.release(),this.logger.perf(h,D,"GetPageTextRects","End",`${t.id}-${n.index}`),E.resolve(u)}renderThumbnailRaw(t,n,o){const{scaleFactor:e=1,...a}=o??{};if(this.logger.debug(h,D,"renderThumbnail",t,n,o),this.logger.perf(h,D,"RenderThumbnail","Begin",`${t.id}-${n.index}`),!this.cache.getContext(t.id))return this.logger.perf(h,D,"RenderThumbnail","End",`${t.id}-${n.index}`),E.reject({code:S.DocNotOpen,message:"document does not open"});const u=this.renderPageRaw(t,n,{scaleFactor:Math.max(e,.5),...a});return this.logger.perf(h,D,"RenderThumbnail","End",`${t.id}-${n.index}`),u}getAttachments(t){this.logger.debug(h,D,"getAttachments",t),this.logger.perf(h,D,"GetAttachments","Begin",t.id);const n=this.cache.getContext(t.id);if(!n)return this.logger.perf(h,D,"GetAttachments","End",t.id),E.reject({code:S.DocNotOpen,message:"document does not open"});const o=[],e=this.pdfiumModule.FPDFDoc_GetAttachmentCount(n.docPtr);for(let a=0;a<e;a++){const u=this.readPdfAttachment(n.docPtr,a);o.push(u)}return this.logger.perf(h,D,"GetAttachments","End",t.id),E.resolve(o)}addAttachment(t,n){this.logger.debug(h,D,"addAttachment",t,n?.name),this.logger.perf(h,D,"AddAttachment","Begin",t.id);const o=this.cache.getContext(t.id);if(!o)return this.logger.perf(h,D,"AddAttachment","End",t.id),E.reject({code:S.DocNotOpen,message:"document does not open"});const{name:e,description:a,mimeType:u,data:l}=n??{};if(!e)return this.logger.perf(h,D,"AddAttachment","End",t.id),E.reject({code:S.NotFound,message:"attachment name is required"});if(!l||l.byteLength===0)return this.logger.perf(h,D,"AddAttachment","End",t.id),E.reject({code:S.NotFound,message:"attachment data is empty"});const F=this.withWString(e,p=>this.pdfiumModule.FPDFDoc_AddAttachment(o.docPtr,p));if(!F)return this.logger.perf(h,D,"AddAttachment","End",t.id),E.reject({code:S.Unknown,message:`An attachment named "${e}" already exists`});this.withWString(a,p=>this.pdfiumModule.EPDFAttachment_SetDescription(F,p)),this.pdfiumModule.EPDFAttachment_SetSubtype(F,u);const P=l instanceof Uint8Array?l:new Uint8Array(l),_=P.byteLength,f=this.memoryManager.malloc(_);try{if(this.pdfiumModule.pdfium.HEAPU8.set(P,f),!this.pdfiumModule.FPDFAttachment_SetFile(F,o.docPtr,f,_))return this.logger.perf(h,D,"AddAttachment","End",t.id),E.reject({code:S.Unknown,message:"failed to write attachment bytes"})}finally{this.memoryManager.free(f)}return this.logger.perf(h,D,"AddAttachment","End",t.id),E.resolve(!0)}removeAttachment(t,n){this.logger.debug(h,D,"deleteAttachment",t,n),this.logger.perf(h,D,"DeleteAttachment","Begin",t.id);const o=this.cache.getContext(t.id);if(!o)return this.logger.perf(h,D,"DeleteAttachment","End",t.id),E.reject({code:S.DocNotOpen,message:"document does not open"});const e=this.pdfiumModule.FPDFDoc_GetAttachmentCount(o.docPtr);if(n.index<0||n.index>=e)return this.logger.perf(h,D,"DeleteAttachment","End",t.id),E.reject({code:S.Unknown,message:`attachment index ${n.index} out of range`});const a=this.pdfiumModule.FPDFDoc_DeleteAttachment(o.docPtr,n.index);return this.logger.perf(h,D,"DeleteAttachment","End",t.id),a?E.resolve(!0):E.reject({code:S.Unknown,message:"failed to delete attachment"})}readAttachmentContent(t,n){this.logger.debug(h,D,"readAttachmentContent",t,n),this.logger.perf(h,D,"ReadAttachmentContent","Begin",t.id);const o=this.cache.getContext(t.id);if(!o)return this.logger.perf(h,D,"ReadAttachmentContent","End",t.id),E.reject({code:S.DocNotOpen,message:"document does not open"});const e=this.pdfiumModule.FPDFDoc_GetAttachment(o.docPtr,n.index),a=this.memoryManager.malloc(4);if(!this.pdfiumModule.FPDFAttachment_GetFile(e,0,0,a))return this.memoryManager.free(a),this.logger.perf(h,D,"ReadAttachmentContent","End",t.id),E.reject({code:S.CantReadAttachmentSize,message:"can not read attachment size"});const u=this.pdfiumModule.pdfium.getValue(a,"i32")>>>0,l=this.memoryManager.malloc(u);if(!this.pdfiumModule.FPDFAttachment_GetFile(e,l,u,a))return this.memoryManager.free(a),this.memoryManager.free(l),this.logger.perf(h,D,"ReadAttachmentContent","End",t.id),E.reject({code:S.CantReadAttachmentContent,message:"can not read attachment content"});const F=new ArrayBuffer(u),P=new DataView(F);for(let _=0;_<u;_++)P.setInt8(_,this.pdfiumModule.pdfium.getValue(l+_,"i8"));return this.memoryManager.free(a),this.memoryManager.free(l),this.logger.perf(h,D,"ReadAttachmentContent","End",t.id),E.resolve(F)}setFormFieldValue(t,n,o,e){this.logger.debug(h,D,"SetFormFieldValue",t,o,e),this.logger.perf(h,D,"SetFormFieldValue","Begin",`${t.id}-${o.id}`);const a=this.cache.getContext(t.id);if(!a)return this.logger.debug(h,D,"SetFormFieldValue","document is not opened"),this.logger.perf(h,D,"SetFormFieldValue","End",`${t.id}-${o.id}`),E.reject({code:S.DocNotOpen,message:"document does not open"});const u=a.acquirePage(n.index);try{return u.withFormHandle(l=>{const F=this.getAnnotationByName(u.pagePtr,o.id);if(!F)return E.reject({code:S.NotFound,message:"annotation not found"});try{if(!this.pdfiumModule.FORM_SetFocusedAnnot(l,F))return E.reject({code:S.CantFocusAnnot,message:"failed to set focused annotation"});switch(e.kind){case"text":{if(!this.pdfiumModule.FORM_SelectAllText(l,u.pagePtr))return this.pdfiumModule.FORM_ForceToKillFocus(l),E.reject({code:S.CantSelectText,message:"failed to select all text"});const P=2*(e.text.length+1),_=this.memoryManager.malloc(P);this.pdfiumModule.pdfium.stringToUTF16(e.text,_,P),this.pdfiumModule.FORM_ReplaceSelection(l,u.pagePtr,_),this.memoryManager.free(_);break}case"selection":if(!this.pdfiumModule.FORM_SetIndexSelected(l,u.pagePtr,e.index,e.isSelected))return this.pdfiumModule.FORM_ForceToKillFocus(l),E.reject({code:S.CantSelectOption,message:"failed to set index selected"});break;case"checked":{if(!!this.pdfiumModule.FPDFAnnot_IsChecked(l,F)!==e.checked&&!this.pdfiumModule.FORM_OnChar(l,u.pagePtr,13,0))return this.pdfiumModule.FORM_ForceToKillFocus(l),E.reject({code:S.CantCheckField,message:"failed to set field checked"});break}}return this.pdfiumModule.FORM_ForceToKillFocus(l),this.pdfiumModule.EPDFAnnot_GenerateFormFieldAP(F),E.resolve(!0)}finally{this.pdfiumModule.FPDFPage_CloseAnnot(F)}})}finally{u.release()}}setFormFieldState(t,n,o,e){this.logger.debug(h,D,"SetFormFieldState",t,o,e),this.logger.perf(h,D,"SetFormFieldState","Begin",`${t.id}-${o.id}`);const a=this.cache.getContext(t.id);if(!a)return this.logger.debug(h,D,"SetFormFieldState","document is not opened"),this.logger.perf(h,D,"SetFormFieldState","End",`${t.id}-${o.id}`),E.reject({code:S.DocNotOpen,message:"document does not open"});const u=a.acquirePage(n.index);try{return u.withFormHandle(l=>{const F=this.getAnnotationByName(u.pagePtr,o.id);if(!F)return E.reject({code:S.NotFound,message:"annotation not found"});try{if(!this.pdfiumModule.FORM_SetFocusedAnnot(l,F))return E.reject({code:S.CantFocusAnnot,message:"failed to set focused annotation"});switch(e.type){case oe.TEXTFIELD:{if(!this.pdfiumModule.FORM_SelectAllText(l,u.pagePtr))return this.pdfiumModule.FORM_ForceToKillFocus(l),E.reject({code:S.CantSelectText,message:"failed to select all text"});const P=2*(e.value.length+1),_=this.memoryManager.malloc(P);this.pdfiumModule.pdfium.stringToUTF16(e.value,_,P),this.pdfiumModule.FORM_ReplaceSelection(l,u.pagePtr,_),this.memoryManager.free(_);break}case oe.CHECKBOX:case oe.RADIOBUTTON:{if(!!this.pdfiumModule.FPDFAnnot_IsChecked(l,F)!==(o.exportValue!=null&&e.value===o.exportValue)&&!this.pdfiumModule.FORM_OnChar(l,u.pagePtr,13,0))return this.pdfiumModule.FORM_ForceToKillFocus(l),E.reject({code:S.CantCheckField,message:"failed to set field checked"});break}case oe.COMBOBOX:{const P=e.options.findIndex(_=>_.isSelected);if(P>=0&&!this.pdfiumModule.FORM_SetIndexSelected(l,u.pagePtr,P,!0))return this.pdfiumModule.FORM_ForceToKillFocus(l),E.reject({code:S.CantSelectOption,message:"failed to set index selected"});break}case oe.LISTBOX:for(let P=0;P<e.options.length;P++)if(!this.pdfiumModule.FORM_SetIndexSelected(l,u.pagePtr,P,e.options[P].isSelected))return this.pdfiumModule.FORM_ForceToKillFocus(l),E.reject({code:S.CantSelectOption,message:"failed to set index selected"})}return this.pdfiumModule.FORM_ForceToKillFocus(l),e.type!==oe.CHECKBOX&&e.type!==oe.RADIOBUTTON&&this.pdfiumModule.EPDFAnnot_GenerateFormFieldAP(F),this.logger.perf(h,D,"SetFormFieldState","End",`${t.id}-${o.id}`),E.resolve(!0)}finally{this.pdfiumModule.FPDFPage_CloseAnnot(F)}})}finally{u.release()}}renameWidgetField(t,n,o,e){this.logger.debug(h,D,"RenameWidgetField",t,o,e),this.logger.perf(h,D,"RenameWidgetField","Begin",`${t.id}-${o.id}`);const a=this.cache.getContext(t.id);if(!a)return this.logger.perf(h,D,"RenameWidgetField","End",`${t.id}-${o.id}`),E.reject({code:S.DocNotOpen,message:"document does not open"});const u=a.acquirePage(n.index);try{return u.withFormHandle(l=>{const F=this.getAnnotationByName(u.pagePtr,o.id);if(!F)return E.reject({code:S.NotFound,message:"annotation not found"});try{return this.withWString(e,P=>this.pdfiumModule.EPDFAnnot_SetFormFieldName(l,F,P))?(this.logger.perf(h,D,"RenameWidgetField","End",`${t.id}-${o.id}`),E.resolve(!0)):E.reject({code:S.CantSetAnnotString,message:"failed to rename widget field"})}finally{this.pdfiumModule.FPDFPage_CloseAnnot(F)}})}finally{u.release()}}shareWidgetField(t,n,o,e,a){this.logger.debug(h,D,"ShareWidgetField",t,o,a),this.logger.perf(h,D,"ShareWidgetField","Begin",`${t.id}-${o.id}-${a.id}`);const u=this.cache.getContext(t.id);if(!u)return this.logger.perf(h,D,"ShareWidgetField","End",`${t.id}-${o.id}-${a.id}`),E.reject({code:S.DocNotOpen,message:"document does not open"});const l=u.acquirePage(n.index),F=e.index===n.index?l:u.acquirePage(e.index);try{return l.withFormHandle(P=>{let _=!1;F!==l&&(this.pdfiumModule.FORM_OnAfterLoadPage(F.pagePtr,P),_=!0);const f=this.getAnnotationByName(l.pagePtr,o.id),p=this.getAnnotationByName(F.pagePtr,a.id);if(!f||!p)return f&&this.pdfiumModule.FPDFPage_CloseAnnot(f),p&&this.pdfiumModule.FPDFPage_CloseAnnot(p),_&&this.pdfiumModule.FORM_OnBeforeClosePage(F.pagePtr,P),E.reject({code:S.NotFound,message:"annotation not found"});try{return this.pdfiumModule.EPDFAnnot_ShareFormField(P,f,p)?(this.logger.perf(h,D,"ShareWidgetField","End",`${t.id}-${o.id}-${a.id}`),E.resolve(!0)):E.reject({code:S.Unknown,message:"failed to share widget field"})}finally{this.pdfiumModule.FPDFPage_CloseAnnot(f),this.pdfiumModule.FPDFPage_CloseAnnot(p),_&&this.pdfiumModule.FORM_OnBeforeClosePage(F.pagePtr,P)}})}finally{l.release(),F!==l&&F.release()}}flattenPage(t,n,o){const{flag:e=Mn.Display}=o??{};this.logger.debug(h,D,"flattenPage",t,n,e),this.logger.perf(h,D,"flattenPage","Begin",t.id);const a=this.cache.getContext(t.id);if(!a)return this.logger.perf(h,D,"flattenPage","End",t.id),E.reject({code:S.DocNotOpen,message:"document does not open"});const u=a.acquirePage(n.index),l=this.pdfiumModule.FPDFPage_Flatten(u.pagePtr,e);return u.release(),this.logger.perf(h,D,"flattenPage","End",t.id),E.resolve(l)}extractPages(t,n){this.logger.debug(h,D,"extractPages",t,n),this.logger.perf(h,D,"ExtractPages","Begin",t.id);const o=this.cache.getContext(t.id);if(!o)return this.logger.perf(h,D,"ExtractPages","End",t.id),E.reject({code:S.DocNotOpen,message:"document does not open"});const e=this.pdfiumModule.FPDF_CreateNewDocument();if(!e)return this.logger.perf(h,D,"ExtractPages","End",t.id),E.reject({code:S.CantCreateNewDoc,message:"can not create new document"});const a=this.memoryManager.malloc(4*n.length);for(let l=0;l<n.length;l++)this.pdfiumModule.pdfium.setValue(a+4*l,n[l],"i32");if(!this.pdfiumModule.FPDF_ImportPagesByIndex(e,o.docPtr,a,n.length,0))return this.pdfiumModule.FPDF_CloseDocument(e),this.logger.perf(h,D,"ExtractPages","End",t.id),E.reject({code:S.CantImportPages,message:"can not import pages to new document"});const u=this.saveDocument(e);return this.pdfiumModule.FPDF_CloseDocument(e),this.logger.perf(h,D,"ExtractPages","End",t.id),E.resolve(u)}importPages(t,n,o,e){this.logger.debug(h,D,"importPages",t.id,n.id,o),this.logger.perf(h,D,"ImportPages","Begin",t.id);const a=this.cache.getContext(t.id);if(!a)return this.logger.perf(h,D,"ImportPages","End",t.id),E.reject({code:S.DocNotOpen,message:"destination document is not open"});const u=this.cache.getContext(n.id);if(!u)return this.logger.perf(h,D,"ImportPages","End",t.id),E.reject({code:S.DocNotOpen,message:"source document is not open"});const l=e??this.pdfiumModule.FPDF_GetPageCount(a.docPtr),F=this.memoryManager.malloc(4*o.length);for(let p=0;p<o.length;p++)this.pdfiumModule.pdfium.setValue(F+4*p,o[p],"i32");if(!this.pdfiumModule.FPDF_ImportPagesByIndex(a.docPtr,u.docPtr,F,o.length,l))return this.memoryManager.free(F),this.logger.perf(h,D,"ImportPages","End",t.id),E.reject({code:S.CantImportPages,message:"can not import pages into destination document"});this.memoryManager.free(F);const P=[],_=this.memoryManager.malloc(8),f=a.normalizeRotation;for(let p=0;p<o.length;p++){const M=l+p;if(!(f?this.pdfiumModule.EPDF_GetPageSizeByIndexNormalized(a.docPtr,M,_):this.pdfiumModule.FPDF_GetPageSizeByIndexF(a.docPtr,M,_)))return this.memoryManager.free(_),this.logger.perf(h,D,"ImportPages","End",t.id),E.reject({code:S.Unknown,message:`failed to read metadata for imported page ${M}`});const y=this.pdfiumModule.EPDF_GetPageRotationByIndex(a.docPtr,M),T=this.pdfiumModule.EPDFDoc_GetPageObjectNumberByIndex(a.docPtr,M);P.push({index:M,size:{width:this.pdfiumModule.pdfium.getValue(_,"float"),height:this.pdfiumModule.pdfium.getValue(_+4,"float")},rotation:y,objectNumber:T})}return this.memoryManager.free(_),this.logger.perf(h,D,"ImportPages","End",t.id),E.resolve(P)}deletePage(t,n){this.logger.debug(h,D,"deletePage",t.id,n),this.logger.perf(h,D,"DeletePage","Begin",t.id);const o=this.cache.getContext(t.id);if(!o)return this.logger.perf(h,D,"DeletePage","End",t.id),E.reject({code:S.DocNotOpen,message:"document is not open"});const e=this.pdfiumModule.FPDF_GetPageCount(o.docPtr);return n<0||n>=e?(this.logger.perf(h,D,"DeletePage","End",t.id),E.reject({code:S.CantDeletePage,message:`page index ${n} out of range (0..${e-1})`})):(this.pdfiumModule.FPDFPage_Delete(o.docPtr,n),this.logger.perf(h,D,"DeletePage","End",t.id),E.resolve(!0))}extractText(t,n){this.logger.debug(h,D,"extractText",t,n),this.logger.perf(h,D,"ExtractText","Begin",t.id);const o=this.cache.getContext(t.id);if(!o)return this.logger.perf(h,D,"ExtractText","End",t.id),E.reject({code:S.DocNotOpen,message:"document does not open"});const e=[];for(let u=0;u<n.length;u++){const l=o.acquirePage(n[u]),F=this.pdfiumModule.FPDFText_LoadPage(l.pagePtr),P=this.pdfiumModule.FPDFText_CountChars(F),_=this.memoryManager.malloc(2*(P+1));this.pdfiumModule.FPDFText_GetText(F,0,P,_);const f=this.pdfiumModule.pdfium.UTF16ToString(_);this.memoryManager.free(_),e.push(f),this.pdfiumModule.FPDFText_ClosePage(F),l.release()}const a=e.join(` 4 5`);return this.logger.perf(h,D,"ExtractText","End",t.id),E.resolve(a)}getTextSlices(t,n){if(this.logger.debug(h,D,"getTextSlices",t,n),this.logger.perf(h,D,"GetTextSlices","Begin",t.id),n.length===0)return this.logger.perf(h,D,"GetTextSlices","End",t.id),E.resolve([]);const o=this.cache.getContext(t.id);if(!o)return this.logger.perf(h,D,"GetTextSlices","End",t.id),E.reject({code:S.DocNotOpen,message:"document does not open"});try{const e=new Array(n.length),a=new Map;n.forEach((u,l)=>{(a.get(u.pageIndex)??a.set(u.pageIndex,[]).get(u.pageIndex)).push({slice:u,pos:l})});for(const[u,l]of a){const F=o.acquirePage(u),P=F.getTextPage();for(const{slice:_,pos:f}of l){const p=this.memoryManager.malloc(2*(_.charCount+1));this.pdfiumModule.FPDFText_GetText(P,_.charIndex,_.charCount,p),e[f]=an(this.pdfiumModule.pdfium.UTF16ToString(p)),this.memoryManager.free(p)}F.release()}return this.logger.perf(h,D,"GetTextSlices","End",t.id),E.resolve(e)}catch(e){return this.logger.error(h,D,"getTextSlices error",e),this.logger.perf(h,D,"GetTextSlices","End",t.id),E.reject({code:S.Unknown,message:String(e)})}}merge(t){this.logger.debug(h,D,"merge",t);const n=t.map(l=>l.id).join(".");this.logger.perf(h,D,"Merge","Begin",n);const o=this.pdfiumModule.FPDF_CreateNewDocument();if(!o)return this.logger.perf(h,D,"Merge","End",n),E.reject({code:S.CantCreateNewDoc,message:"can not create new document"});const e=[];for(const l of t.reverse()){const F=new Uint8Array(l.content),P=F.length,_=this.memoryManager.malloc(P);this.pdfiumModule.pdfium.HEAPU8.set(F,_);const f=this.pdfiumModule.FPDF_LoadMemDocument(_,P,"");if(!f){const p=this.pdfiumModule.FPDF_GetLastError();this.logger.error(h,D,`FPDF_LoadMemDocument failed with ${p}`),this.memoryManager.free(_);for(const M of e)this.pdfiumModule.FPDF_CloseDocument(M.docPtr),this.memoryManager.free(M.filePtr);return this.logger.perf(h,D,"Merge","End",n),E.reject({code:p,message:"FPDF_LoadMemDocument failed"})}if(e.push({filePtr:_,docPtr:f}),!this.pdfiumModule.FPDF_ImportPages(o,f,"",0)){this.pdfiumModule.FPDF_CloseDocument(o);for(const p of e)this.pdfiumModule.FPDF_CloseDocument(p.docPtr),this.memoryManager.free(p.filePtr);return this.logger.perf(h,D,"Merge","End",n),E.reject({code:S.CantImportPages,message:"can not import pages to new document"})}}const a=this.saveDocument(o);this.pdfiumModule.FPDF_CloseDocument(o);for(const l of e)this.pdfiumModule.FPDF_CloseDocument(l.docPtr),this.memoryManager.free(l.filePtr);const u={id:`${Math.random()}`,content:a};return this.logger.perf(h,D,"Merge","End",n),E.resolve(u)}mergePages(t){const n=t.map(e=>`${e.docId}:${e.pageIndices.join(",")}`).join("|");this.logger.debug(h,D,"mergePages",t),this.logger.perf(h,D,"MergePages","Begin",n);const o=this.pdfiumModule.FPDF_CreateNewDocument();if(!o)return this.logger.perf(h,D,"MergePages","End",n),E.reject({code:S.CantCreateNewDoc,message:"Cannot create new document"});try{for(const u of[...t].reverse()){const l=this.cache.getContext(u.docId);if(!l){this.logger.warn(h,D,`Document ${u.docId} is not open, skipping`);continue}const F=this.pdfiumModule.FPDF_GetPageCount(l.docPtr),P=u.pageIndices.filter(f=>f>=0&&f<F);if(P.length===0)continue;const _=P.map(f=>f+1).join(",");if(!this.pdfiumModule.FPDF_ImportPages(o,l.docPtr,_,0))throw new Error(`Failed to import pages ${_} from document ${u.docId}`)}const e=this.saveDocument(o),a={id:`${Math.random()}`,content:e};return this.logger.perf(h,D,"MergePages","End",n),E.resolve(a)}catch(e){return this.logger.error(h,D,"mergePages failed",e),this.logger.perf(h,D,"MergePages","End",n),E.reject({code:S.CantImportPages,message:e instanceof Error?e.message:"Failed to merge pages"})}finally{o&&this.pdfiumModule.FPDF_CloseDocument(o)}}setDocumentEncryption(t,n,o,e){this.logger.debug(h,D,"setDocumentEncryption",t,e);const a=this.cache.getContext(t.id);if(!a)return E.reject({code:S.DocNotOpen,message:"document does not open"});const u=this.pdfiumModule.EPDF_SetEncryption(a.docPtr,n,o,e);return E.resolve(u)}removeEncryption(t){this.logger.debug(h,D,"removeEncryption",t);const n=this.cache.getContext(t.id);if(!n)return E.reject({code:S.DocNotOpen,message:"document does not open"});const o=this.pdfiumModule.EPDF_RemoveEncryption(n.docPtr);return E.resolve(o)}unlockOwnerPermissions(t,n){this.logger.debug(h,D,"unlockOwnerPermissions",t.id);const o=this.cache.getContext(t.id);if(!o)return E.reject({code:S.DocNotOpen,message:"document does not open"});
5const e=this.pdfiumModule.EPDF_UnlockOwnerPermissions(o.docPtr,n);return E.resolve(e)}isEncrypted(t){this.logger.debug(h,D,"isEncrypted",t.id);const n=this.cache.getContext(t.id);if(!n)return E.reject({code:S.DocNotOpen,message:"document does not open"});const o=this.pdfiumModule.EPDF_IsEncrypted(n.docPtr);return E.resolve(o)}isOwnerUnlocked(t){this.logger.debug(h,D,"isOwnerUnlocked",t.id);const n=this.cache.getContext(t.id);if(!n)return E.reject({code:S.DocNotOpen,message:"document does not open"});const o=this.pdfiumModule.EPDF_IsOwnerUnlocked(n.docPtr);return E.resolve(o)}saveAsCopy(t){this.logger.debug(h,D,"saveAsCopy",t),this.logger.perf(h,D,"SaveAsCopy","Begin",t.id);const n=this.cache.getContext(t.id);if(!n)return this.logger.perf(h,D,"SaveAsCopy","End",t.id),E.reject({code:S.DocNotOpen,message:"document does not open"});const o=this.saveDocument(n.docPtr);return this.logger.perf(h,D,"SaveAsCopy","End",t.id),E.resolve(o)}closeDocument(t){return this.logger.debug(h,D,"closeDocument",t),this.logger.perf(h,D,"CloseDocument","Begin",t.id),this.cache.closeDocument(t.id),this.logger.perf(h,D,"CloseDocument","End",t.id),E.resolve(!0)}closeAllDocuments(){return this.logger.debug(h,D,"closeAllDocuments"),this.logger.perf(h,D,"CloseAllDocuments","Begin"),this.cache.closeAllDocuments(),this.logger.perf(h,D,"CloseAllDocuments","End"),E.resolve(!0)}addTextContent(t,n,o,e,a){if(!this.setAnnotationName(e,a.name??a.icon??yn.Comment)||a.state&&!this.setAnnotString(e,"State",a.state)||a.stateModel&&!this.setAnnotString(e,"StateModel",a.stateModel)||!this.setAnnotationOpacity(e,a.opacity??1))return!1;const u=a.strokeColor??a.color??"#FFFF00";return!!this.setAnnotationColor(e,u,X.Color)&&!(!a.flags&&!this.setAnnotationFlags(e,["print","noZoom","noRotate"]))&&this.applyBaseAnnotationProperties(t,n,o,e,a)}addCaretContent(t,n,o,e,a){return a.strokeColor&&this.setAnnotationColor(e,a.strokeColor,X.Color),a.opacity!==void 0&&this.setAnnotationOpacity(e,a.opacity),a.intent&&this.setAnnotIntent(e,a.intent),this.setRectangleDifferences(e,a.rectangleDifferences),this.applyBaseAnnotationProperties(t,n,o,e,a)}addFreeTextContent(t,n,o,e,a){if(!this.setBorderStyle(e,_e.SOLID,a.strokeWidth??0)||!this.setAnnotationOpacity(e,a.opacity??1)||!this.setAnnotationTextAlignment(e,a.textAlign)||!this.setAnnotationVerticalAlignment(e,a.verticalAlign))return!1;const u=a.strokeColor??a.fontColor;if(!this.setAnnotationDefaultAppearance(e,a.fontFamily===tt.Unknown?tt.Helvetica:a.fontFamily,a.fontSize,u)||(a.strokeColor&&a.strokeColor!==a.fontColor&&this.setAnnotationColor(e,a.fontColor,X.TextColor),a.intent&&!this.setAnnotIntent(e,a.intent))||a.calloutLine&&a.calloutLine.length>=2&&!this.setCalloutLine(t,n,e,a.calloutLine)||a.lineEnding!==void 0&&!this.setLineEndings(e,qe.None,a.lineEnding))return!1;const l=a.color??a.backgroundColor;if(l&&l!=="transparent"){if(!this.setAnnotationColor(e,l??"#FFFFFF",X.Color))return!1}else if(!this.pdfiumModule.EPDFAnnot_ClearColor(e,X.Color))return!1;return this.setRectangleDifferences(e,a.rectangleDifferences),this.applyBaseAnnotationProperties(t,n,o,e,a)}addTextFieldContent(t,n,o){if(!this.setAnnotationDefaultAppearance(n,o.fontFamily,o.fontSize,o.fontColor)||!this.setBorderStyle(n,_e.SOLID,o.strokeWidth??1))return!1;o.strokeColor&&o.strokeColor!=="transparent"?this.setMKColor(n,0,o.strokeColor):this.clearMKColor(n,0),o.color&&o.color!=="transparent"?this.setMKColor(n,1,o.color):this.clearMKColor(n,1);const e=o.field.flag??mt.NONE;this.pdfiumModule.FPDFAnnot_SetFormFieldFlags(t,n,e),o.field.name&&this.withWString(o.field.name,u=>this.pdfiumModule.EPDFAnnot_SetFormFieldName(t,n,u)),this.withWString(o.field.value??"",u=>this.pdfiumModule.EPDFAnnot_SetFormFieldValue(t,n,u));const a=o.field;return a.maxLen!=null&&a.maxLen>0&&this.pdfiumModule.EPDFAnnot_SetNumberValue(n,"MaxLen",a.maxLen),!0}addToggleFieldContent(t,n,o){if(!this.setBorderStyle(n,_e.SOLID,o.strokeWidth??1))return!1;o.strokeColor&&o.strokeColor!=="transparent"?this.setMKColor(n,0,o.strokeColor):this.clearMKColor(n,0),o.color&&o.color!=="transparent"?this.setMKColor(n,1,o.color):this.clearMKColor(n,1);let e=o.field.flag??mt.NONE;return o.field.type===oe.RADIOBUTTON&&(e|=mt.BUTTON_RADIO|mt.BUTTON_NOTOGGLETOOFF),this.pdfiumModule.FPDFAnnot_SetFormField
5Flags(t,n,e),o.field.name&&this.withWString(o.field.name,a=>this.pdfiumModule.EPDFAnnot_SetFormFieldName(t,n,a)),!0}addChoiceFieldContent(t,n,o){if(!this.setAnnotationDefaultAppearance(n,o.fontFamily,o.fontSize,o.fontColor)||!this.setBorderStyle(n,_e.SOLID,o.strokeWidth??1))return!1;o.strokeColor&&o.strokeColor!=="transparent"?this.setMKColor(n,0,o.strokeColor):this.clearMKColor(n,0),o.color&&o.color!=="transparent"?this.setMKColor(n,1,o.color):this.clearMKColor(n,1);let e=o.field.flag??mt.NONE;o.field.type===oe.COMBOBOX&&(e|=1<<17),this.pdfiumModule.FPDFAnnot_SetFormFieldFlags(t,n,e),o.field.name&&this.withWString(o.field.name,F=>this.pdfiumModule.EPDFAnnot_SetFormFieldName(t,n,F));const a=o.field.options??[];if(a.length>0){const P=this.memoryManager.malloc(a.length*4),_=[];try{for(let f=0;f<a.length;f++){const p=a[f].label,M=2*(p.length+1),y=this.memoryManager.malloc(M);this.pdfiumModule.pdfium.stringToUTF16(p,y,M),_.push(y),this.pdfiumModule.pdfium.setValue(P+f*4,y,"*")}this.pdfiumModule.EPDFAnnot_SetFormFieldOptions(t,n,P,a.length)}finally{for(const f of _)this.memoryManager.free(Un(f));this.memoryManager.free(P)}}const u=a.find(F=>F.isSelected),l=u?.label??o.field.value??"";return this.withWString(l,F=>this.pdfiumModule.EPDFAnnot_SetFormFieldValue(t,n,F)),!0}setMKColor(t,n,o){const{red:e,green:a,blue:u}=St(o);return this.pdfiumModule.EPDFAnnot_SetMKColor(t,n,255&e,255&a,255&u)}clearMKColor(t,n){return this.pdfiumModule.EPDFAnnot_ClearMKColor(t,n)}getMKColor(t,n){const o=this.memoryManager.malloc(4),e=this.memoryManager.malloc(4),a=this.memoryManager.malloc(4);try{if(!this.pdfiumModule.EPDFAnnot_GetMKColor(t,n,o,e,a))return;const u=255&this.pdfiumModule.pdfium.getValue(o,"i32"),l=255&this.pdfiumModule.pdfium.getValue(e,"i32"),F=255&this.pdfiumModule.pdfium.getValue(a,"i32");return Ct({red:u,green:l,blue:F})}finally{this.memoryManager.free(a),this.memoryManager.free(e),this.memoryManager.free(o)}}addInkStroke(t,n,o,e,a){if(!this.setBorderStyle(e,_e.SOLID,a.strokeWidth)||!this.setInkList(t,n,e,a.inkList)||!this.setAnnotationOpacity(e,a.opacity??1))return!1;const u=a.strokeColor??a.color??"#FFFF00";return!!this.setAnnotationColor(e,u,X.Color)&&this.applyBaseAnnotationProperties(t,n,o,e,a)}addLineContent(t,n,o,e,a){var u,l;if(!this.setLinePoints(t,n,e,a.linePoints.start,a.linePoints.end)||!this.setLineEndings(e,((u=a.lineEndings)==null?void 0:u.start)??qe.None,((l=a.lineEndings)==null?void 0:l.end)??qe.None)||!this.setBorderStyle(e,a.strokeStyle,a.strokeWidth)||!this.setBorderDashPattern(e,a.strokeDashArray??[])||a.intent&&!this.setAnnotIntent(e,a.intent))return!1;if(a.color&&a.color!=="transparent"){if(!this.setAnnotationColor(e,a.color??"#FFFF00",X.InteriorColor))return!1}else if(!this.pdfiumModule.EPDFAnnot_ClearColor(e,X.InteriorColor))return!1;return!!this.setAnnotationOpacity(e,a.opacity??1)&&!!this.setAnnotationColor(e,a.strokeColor??"#FFFF00",X.Color)&&this.applyBaseAnnotationProperties(t,n,o,e,a)}addPolyContent(t,n,o,e,a){var u,l;if(a.type===v.POLYLINE&&!this.setLineEndings(e,((u=a.lineEndings)==null?void 0:u.start)??qe.None,((l=a.lineEndings)==null?void 0:l.end)??qe.None)||!this.setPdfAnnoVertices(t,n,e,a.vertices)||!this.setBorderStyle(e,a.strokeStyle,a.strokeWidth)||!this.setBorderDashPattern(e,a.strokeDashArray??[])||a.intent&&!this.setAnnotIntent(e,a.intent))return!1;if(a.color&&a.color!=="transparent"){if(!this.setAnnotationColor(e,a.color??"#FFFF00",X.InteriorColor))return!1}else if(!this.pdfiumModule.EPDFAnnot_ClearColor(e,X.InteriorColor))return!1;if(!this.setAnnotationOpacity(e,a.opacity??1)||!this.setAnnotationColor(e,a.strokeColor??"#FFFF00",X.Color))return!1;if(a.type===v.POLYGON){const F=a;this.setRectangleDifferences(e,F.rectangleDifferences),this.setBorderEffect(e,F.cloudyBorderIntensity)}return this.applyBaseAnnotationProperties(t,n,o,e,a)}addLinkContent(t,n,o,e,a,u){const l=u.strokeStyle??_e.UNDERLINE,F=u.strokeWidth??2;return!!this.setBorderStyle(a,l,F)&&!(u.strokeDashArray&&!this.setBorderDashPattern(a,u.strokeDashArray))&&!(u.strokeColor&&!this.setAnnotationColor(a,u.strokeColor,X.Color))&&!(u.target&&!this.applyLinkTarget(o,a,u.target))&&this.applyBaseAnnotationProperties(t,n,e,a,u)}addShapeContent(t,n,o,e,a){if(!this.setBorderStyle(e,a.strokeStyle,a.strokeWidth)||
5!this.setBorderDashPattern(e,a.strokeDashArray??[]))return!1;if(a.color&&a.color!=="transparent"){if(!this.setAnnotationColor(e,a.color??"#FFFF00",X.InteriorColor))return!1}else if(!this.pdfiumModule.EPDFAnnot_ClearColor(e,X.InteriorColor))return!1;return!!this.setAnnotationOpacity(e,a.opacity??1)&&!!this.setAnnotationColor(e,a.strokeColor??"#FFFF00",X.Color)&&(this.setRectangleDifferences(e,a.rectangleDifferences),this.setBorderEffect(e,a.cloudyBorderIntensity),this.applyBaseAnnotationProperties(t,n,o,e,a))}addTextMarkupContent(t,n,o,e,a){if(!this.syncQuadPointsAnno(t,n,e,a.segmentRects)||!this.setAnnotationOpacity(e,a.opacity??1))return!1;const u=a.strokeColor??a.color??"#FFFF00";return!!this.setAnnotationColor(e,u,X.Color)&&this.applyBaseAnnotationProperties(t,n,o,e,a)}addRedactContent(t,n,o,e,a){if(!this.syncQuadPointsAnno(t,n,e,a.segmentRects)||!this.setAnnotationOpacity(e,a.opacity??1))return!1;if(a.color&&a.color!=="transparent"){if(!this.setAnnotationColor(e,a.color,X.InteriorColor))return!1}else if(!this.pdfiumModule.EPDFAnnot_ClearColor(e,X.InteriorColor))return!1;if(a.overlayColor&&a.overlayColor!=="transparent"){if(!this.setAnnotationColor(e,a.overlayColor,X.OverlayColor))return!1}else if(!this.pdfiumModule.EPDFAnnot_ClearColor(e,X.OverlayColor))return!1;if(a.strokeColor&&a.strokeColor!=="transparent"){if(!this.setAnnotationColor(e,a.strokeColor,X.Color))return!1}else if(!this.pdfiumModule.EPDFAnnot_ClearColor(e,X.Color))return!1;if(!this.setOverlayText(e,a.overlayText)||a.overlayTextRepeat!==void 0&&!this.setOverlayTextRepeat(e,a.overlayTextRepeat))return!1;if(a.fontFamily!==void 0||a.fontSize!==void 0){const u=a.fontFamily==null||a.fontFamily===tt.Unknown?tt.Helvetica:a.fontFamily;if(!this.setAnnotationDefaultAppearance(e,u,a.fontSize??12,a.fontColor??"#000000"))return!1}return!(a.textAlign!==void 0&&!this.setAnnotationTextAlignment(e,a.textAlign))&&this.applyBaseAnnotationProperties(t,n,o,e,a)}addStampContent(t,n,o,e,a,u,l){const F=u.name??u.icon;if(F&&!this.setAnnotationName(a,F))return!1;if(l&&"data"in l&&l.data){const P=Gn(l.data);if(!P)return!1;if(P.mimeType==="application/pdf"){if(!this.setAppearanceFromPdf(n,a,l.data))return!1}else{for(let _=this.pdfiumModule.FPDFAnnot_GetObjectCount(a)-1;_>=0;_--)this.pdfiumModule.FPDFAnnot_RemoveObject(a,_);if(P.mimeType==="image/png"){if(!this.addPngImageObject(t,n,o,e,a,u.rect,l.data))return!1}else if(P.mimeType==="image/jpeg"&&!this.addJpegImageObject(t,n,o,e,a,u.rect,l.data))return!1}}else if(l&&"imageData"in l&&l.imageData){for(let P=this.pdfiumModule.FPDFAnnot_GetObjectCount(a)-1;P>=0;P--)this.pdfiumModule.FPDFAnnot_RemoveObject(a,P);if(!this.addImageObject(t,n,o,e,a,u.rect,l.imageData))return!1}else if(l&&"appearance"in l&&l.appearance&&!this.setAppearanceFromPdf(n,a,l.appearance))return!1;return!!this.applyBaseAnnotationProperties(t,o,e,a,u)&&!!this.pdfiumModule.EPDFAnnot_UpdateAppearanceToRect(a,Sn.Cover)}setAppearanceFromPdf(t,n,o){const e=new Uint8Array(o),a=this.memoryManager.malloc(e.byteLength);this.pdfiumModule.pdfium.HEAPU8.set(e,a);const u=this.pdfiumModule.FPDF_LoadMemDocument(a,e.byteLength,"");if(!u)return this.memoryManager.free(a),!1;const l=this.pdfiumModule.EPDFAnnot_SetAppearanceFromPage(n,u,0);return this.pdfiumModule.FPDF_CloseDocument(u),this.memoryManager.free(a),!!l}addImageObject(t,n,o,e,a,u,l){const F=l.width*l.height,P=this.memoryManager.malloc(4*F);if(!P)return!1;for(let y=0;y<F;y++){const T=l.data[4*y],C=l.data[4*y+1],R=l.data[4*y+2],N=l.data[4*y+3];this.pdfiumModule.pdfium.setValue(P+4*y,R,"i8"),this.pdfiumModule.pdfium.setValue(P+4*y+1,C,"i8"),this.pdfiumModule.pdfium.setValue(P+4*y+2,T,"i8"),this.pdfiumModule.pdfium.setValue(P+4*y+3,N,"i8")}const _=this.pdfiumModule.FPDFBitmap_CreateEx(l.width,l.height,4,P,0);if(!_)return this.memoryManager.free(P),!1;const f=this.pdfiumModule.FPDFPageObj_NewImageObj(n);if(!f)return this.pdfiumModule.FPDFBitmap_Destroy(_),this.memoryManager.free(P),!1;if(!this.pdfiumModule.FPDFImageObj_SetBitmap(e,0,f,_))return this.pdfiumModule.FPDFBitmap_Destroy(_),this.pdfiumModule.FPDFPageObj_Destroy(f),this.memoryManager.free(P),!1;const p=this.memoryManager.malloc(24);if(this.pdfiumModule.pdfium.setValue(p,u.size.width,"float"),this.pdfiumModule.pdfium.setValue(p+4,0,"float"),this.pdfiumModule.pdfium.setValue(p+8,0,"float"),this.pdfiumModule.pdfium.setValue(p+12,u.size.height,"float"),this.pdfiumModule.pdfium.setValue(p+16,0,"float"),this.pdfiumModule.pdfium.setValue(p+20,0,"float"),!this.pdfiumModule.FPDFPageObj_SetMatr
vendor: 37,006 bytes, line 5
5ix(f,p))return this.memoryManager.free(p),this.pdfiumModule.FPDFBitmap_Destroy(_),this.pdfiumModule.FPDFPageObj_Destroy(f),this.memoryManager.free(P),!1;this.memoryManager.free(p);const M=this.convertDevicePointToPagePoint(t,o,{x:u.origin.x,y:u.origin.y+u.size.height});return this.pdfiumModule.FPDFPageObj_Transform(f,1,0,0,1,M.x,M.y),this.pdfiumModule.FPDFAnnot_AppendObject(a,f)?(this.pdfiumModule.FPDFBitmap_Destroy(_),this.memoryManager.free(P),!0):(this.pdfiumModule.FPDFBitmap_Destroy(_),this.pdfiumModule.FPDFPageObj_Destroy(f),this.memoryManager.free(P),!1)}addPngImageObject(t,n,o,e,a,u,l){const F=this.pdfiumModule.FPDFPageObj_NewImageObj(n);if(!F)return!1;const P=new Uint8Array(l),_=this.memoryManager.malloc(P.byteLength);if(!_)return this.pdfiumModule.FPDFPageObj_Destroy(F),!1;if(this.pdfiumModule.pdfium.HEAPU8.set(P,_),!this.pdfiumModule.EPDFImageObj_SetPng(e,0,F,_,P.byteLength))return this.memoryManager.free(_),this.pdfiumModule.FPDFPageObj_Destroy(F),!1;this.memoryManager.free(_);const f=this.memoryManager.malloc(24);if(this.pdfiumModule.pdfium.setValue(f,u.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,u.size.height,"float"),this.pdfiumModule.pdfium.setValue(f+16,0,"float"),this.pdfiumModule.pdfium.setValue(f+20,0,"float"),!this.pdfiumModule.FPDFPageObj_SetMatrix(F,f))return this.memoryManager.free(f),this.pdfiumModule.FPDFPageObj_Destroy(F),!1;this.memoryManager.free(f);const p=this.convertDevicePointToPagePoint(t,o,{x:u.origin.x,y:u.origin.y+u.size.height});return this.pdfiumModule.FPDFPageObj_Transform(F,1,0,0,1,p.x,p.y),!!this.pdfiumModule.FPDFAnnot_AppendObject(a,F)||(this.pdfiumModule.FPDFPageObj_Destroy(F),!1)}addJpegImageObject(t,n,o,e,a,u,l){const F=this.pdfiumModule.FPDFPageObj_NewImageObj(n);if(!F)return!1;const P=new Uint8Array(l),_=this.memoryManager.malloc(P.byteLength);if(!_)return this.pdfiumModule.FPDFPageObj_Destroy(F),!1;if(this.pdfiumModule.pdfium.HEAPU8.set(P,_),!this.pdfiumModule.EPDFImageObj_SetJpeg(e,0,F,_,P.byteLength))return this.memoryManager.free(_),this.pdfiumModule.FPDFPageObj_Destroy(F),!1;this.memoryManager.free(_);const f=this.memoryManager.malloc(24);if(this.pdfiumModule.pdfium.setValue(f,u.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,u.size.height,"float"),this.pdfiumModule.pdfium.setValue(f+16,0,"float"),this.pdfiumModule.pdfium.setValue(f+20,0,"float"),!this.pdfiumModule.FPDFPageObj_SetMatrix(F,f))return this.memoryManager.free(f),this.pdfiumModule.FPDFPageObj_Destroy(F),!1;this.memoryManager.free(f);const p=this.convertDevicePointToPagePoint(t,o,{x:u.origin.x,y:u.origin.y+u.size.height});return this.pdfiumModule.FPDFPageObj_Transform(F,1,0,0,1,p.x,p.y),!!this.pdfiumModule.FPDFAnnot_AppendObject(a,F)||(this.pdfiumModule.FPDFPageObj_Destroy(F),!1)}saveDocument(t){const n=this.pdfiumModule.PDFiumExt_OpenFileWriter();this.pdfiumModule.PDFiumExt_SaveAsCopy(t,n);const o=this.pdfiumModule.PDFiumExt_GetFileWriterSize(n),e=this.memoryManager.malloc(o);this.pdfiumModule.PDFiumExt_GetFileWriterData(n,e,o);const a=new ArrayBuffer(o),u=new DataView(a);for(let l=0;l<o;l++)u.setInt8(l,this.pdfiumModule.pdfium.getValue(e+l,"i8"));return this.memoryManager.free(e),this.pdfiumModule.PDFiumExt_CloseFileWriter(n),a}readCatalogLanguage(t){const n=this.pdfiumModule.EPDFCatalog_GetLanguage(t,0,0)>>>0;return n===0?null:n===2?"":Fe(this.pdfiumModule.pdfium,(o,e)=>this.pdfiumModule.EPDFCatalog_GetLanguage(t,o,e),this.pdfiumModule.pdfium.UTF16ToString,n)}readMetaText(t,n){if(!this.pdfiumModule.EPDF_HasMetaText(t,n))return null;const o=this.pdfiumModule.FPDF_GetMetaText(t,n,0,0);return o===2?"":Fe(this.pdfiumModule.pdfium,(e,a)=>this.pdfiumModule.FPDF_GetMetaText(t,n,e,a),this.pdfiumModule.pdfium.UTF16ToString,o)}setMetaText(t,n,o){if(o==null||o.length===0)return!!this.pdfiumModule.EPDF_SetMetaText(t,n,0);const e=2*(o.length+1),a=this.memoryManager.malloc(e);try{return this.pdfiumModule.pdfium.stringToUTF16(o,a,e),!!this.pdfiumModule.EPDF_SetMetaText(t,n,a)}finally{this.memoryManager.free(a)}}getMetaTrapped(t){const n=Number(this.pdfiumModule.EPDF_GetMetaTrapped(t));switch(n){case Ie.NotSet:case Ie.True:case Ie.False:case Ie.Unknown:return n;default:return Ie.Unknown}}setMetaTrapped(t,n){const o=n==null||n===void 0?Ie.NotSet:n;return!(o!==Ie.NotSet&&o!==Ie.True&&o!==Ie.False&&o!==Ie.Unknown)&&!!this.pdfiumModule.EPDF_SetMetaTrapped(t,o)}getMetaKeyCount(t,n){return 0|Number(this.pdfiumModule.EPDF_GetMetaKeyCount(t,n))}getMetaKeyName(t,n,o){const e=this.pdfiumModule.EPDF_GetMetaKeyName(t,n,o,0,0);return e?Fe(this.pdfiumModule.pdfium,(a,u)=>this.pdfiumModule.EPDF_GetMetaKeyName(t,n,o,a,u),this.pdfiumModule.pdfium.UTF8ToString,e):null}readAllMeta(t,n=!0){const o=this.getMetaKeyCount(t,n),e={};for(let a=0;a<o;a++){const u=this.getMetaKeyName(t,a,n);u&&(e[u]=this.readMetaText(t,u))}return e}readPdfBookmarks(t,n=0){let o=this.pdfiumModule.FPDFBookmark_GetFirstChild(t,n);const e=[];for(;o;){const a=this.readPdfBookmark(t,o);e.push(a),o=this.pdfiumModule.FPDFBookmark_GetNextSibling(t,o)}return e}readPdfBookmark(t,n){const o=Fe(this.pdfiumModule.pdfium,(a,u)=>this.pdfiumModule.FPDFBookmark_GetTitle(n,a,u),this.pdfiumModule.pdfium.UTF16ToString),e=this.readPdfBookmarks(t,n);return{title:o,target:this.readPdfBookmarkTarget(t,()=>this.pdfiumModule.FPDFBookmark_GetAction(n),()=>this.pdfiumModule.FPDFBookmark_GetDest(t,n)),children:e}}readPageTextRects(t,n,o,e){const a=this.pdfiumModule.FPDFText_CountRects(e,0,-1),u=[];for(let l=0;l<a;l++){const F=this.memoryManager.malloc(8),P=this.memoryManager.malloc(8),_=this.memoryManager.malloc(8),f=this.memoryManager.malloc(8);if(!this.pdfiumModule.FPDFText_GetRect(e,l,P,F,_,f)){this.memoryManager.free(P),this.memoryManager.free(F),this.memoryManager.free(_),this.memoryManager.free(f);continue}const p=this.pdfiumModule.pdfium.getValue(P,"double"),M=this.pdfiumModule.pdfium.getValue(F,"double"),y=this.pdfiumModule.pdfium.getValue(_,"double"),T=this.pdfiumModule.pdfium.getValue(f,"double");this.memoryManager.free(P),this.memoryManager.free(F),this.memoryManager.free(_),this.memoryManager.free(f);const C=this.memoryManager.malloc(4),R=this.memoryManager.malloc(4);this.pdfiumModule.FPDF_PageToDevice(o,0,0,t.size.width,t.size.height,0,p,M,C,R);const N=this.pdfiumModule.pdfium.getValue(C,"i32"),V=this.pdfiumModule.pdfium.getValue(R,"i32");this.memoryManager.free(C),this.memoryManager.free(R);const K={origin:{x:N,y:V},size:{width:Math.ceil(Math.abs(y-p)),height:Math.ceil(Math.abs(M-T))}},z=this.pdfiumModule.FPDFText_GetBoundedText(e,p,M,y,T,0,0),q=2*(z+1),k=this.memoryManager.malloc(q);this.pdfiumModule.FPDFText_GetBoundedText(e,p,M,y,T,k,z);const $=this.pdfiumModule.pdfium.UTF16ToString(k);this.memoryManager.free(k);const ae=this.pdfiumModule.FPDFText_GetCharIndexAtPos(e,p,M,2,2);let J="",se=K.size.height;if(ae>=0){se=this.pdfiumModule.FPDFText_GetFontSize(e,ae);const ge=this.pdfiumModule.FPDFText_GetFontInfo(e,ae,0,0,0)+1,Pe=this.memoryManager.malloc(ge),be=this.memoryManager.malloc(4);this.pdfiumModule.FPDFText_GetFontInfo(e,ae,Pe,ge,be),J=this.pdfiumModule.pdfium.UTF8ToString(Pe),this.memoryManager.free(Pe),this.memoryManager.free(be)}const x={content:$,rect:K,font:{family:J,size:se}};u.push(x)}return u}getPageGeometry(t,n){const o="getPageGeometry";this.logger.perf(h,D,o,"Begin",t.id);const e=this.cache.getContext(t.id);if(!e)return this.logger.perf(h,D,o,"End",t.id),E.reject({code:S.DocNotOpen,message:"document does not open"});const a=e.acquirePage(n.index),u=a.getTextPage(),l=this.pdfiumModule.FPDFText_CountChars(u),F=[];for(let _=0;_<l;_++){const f=this.readGlyphInfo(n,a.pagePtr,u,_);F.push(f)}const P=this.buildRunsFromGlyphs(F,u);return a.release(),this.logger.perf(h,D,o,"End",t.id),E.resolve({runs:P})}buildRunsFromGlyphs(t,n){const o=[];let e=null,a=null,u=null;for(let l=0;l<t.length;l++){const F=t[l],P=this.pdfiumModule.FPDFText_GetTextObject(n,l);if(P!==a&&(a=P,e={rect:{x:F.origin.x,y:F.origin.y,width:F.size.width,height:F.size.height},charStart:l,glyphs:[],fontSize:this.pdfiumModule.FPDFText_GetFontSize(n,l)},u={minX:F.origin.x,minY:F.origin.y,maxX:F.origin.x+F.size.width,maxY:F.origin.y+F.size.height},o.push(e)),e.glyphs.push({x:F.origin.x,y:F.origin.y,width:F.size.width,height:F.size.height,flags:F.isEmpty?2:F.isSpace?1:0,...F.tightOrigin&&{tightX:F.tightOrigin.x,tightY:F.tightOrigin.y},...F.tightSize&&{tightWidth:F.tightSize.width,tightHeight:F.tightSize.height}}),F.isEmpty)continue;const _=F.origin.x+F.size.width,f=F.origin.y+F.size.height;u.minX=Math.min(u.minX,F.origin.x),u.minY=Math.min(u.minY,F.origin.y),u.maxX=Math.max(u.maxX,_),u.maxY=Math.max(u.maxY,f),e.rect.x=u.minX,e.rect.y=u.minY,e.rect.width=u.maxX-u.minX,e.rect.height=u.maxY-u.minY}return o}getPageTextRuns(t,n){const o="getPageTextRuns";this.logger.perf(h,D,o,"Begin",t.id);const e=this.cache.getContext(t.id);if(!e)return this.logger.perf(h,D,o,"End",t.id),E.reject({code:S.DocNotOpen,message:"document does not open"});const a=e.acquirePage(n.index),u=a.getTextPage(),l=this.pdfiumModule.FPDFText_CountChars(u),F=[];let P=0,_=null,f=null,p=0,M=null,y=null;const T=J=>{if(_===null||f===null||M===null||y===null)return;const se=J-P;if(se<=0)return;const x=this.memoryManager.malloc(2*(se+1));this.pdfiumModule.FPDFText_GetText(u,P,se,x);const ge=an(this.pdfiumModule.pdfium.UTF16ToString(x));this.memoryManager.free(x),F.push({text:ge,rect:{origin:{x:y.minX,y:y.minY},size:{width:Math.max(1,y.maxX-y.minX),height:Math.max(1,y.maxY-y.minY)}},font:f,fontSize:p,color:M,charIndex:P,charCount:se})},C=this.memoryManager.malloc(4),R=this.memoryManager.malloc(4),N=this.memoryManager.malloc(4),V=this.memoryManager.malloc(4),K=this.memoryManager.malloc(16),z=this.memoryManager.malloc(4),q=this.memoryManager.malloc(4),k=this.memoryManager.malloc(4),$=this.memoryManager.malloc(4),ae=this.memoryManager.malloc(4);for(let J=0;J<l;J++){const se=this.pdfiumModule.FPDFText_GetUnicode(u,J);if(se===65534||se===65533)continue;const x=this.pdfiumModule.FPDFText_GetTextObject(u,J);if(x===0)continue;const ge=this.pdfiumModule.FPDFText_GetFontSize(u,J);this.pdfiumModule.FPDFText_GetFillColor(u,J,C,R,N,V);const Pe=255&this.pdfiumModule.pdfium.getValue(C,"i32"),be=255&this.pdfiumModule.pdfium.getValue(R,"i32"),Be=255&this.pdfiumModule.pdfium.getValue(N,"i32"),Me=255&this.pdfiumModule.pdfium.getValue(V,"i32"),he=this.readFontInfoFromTextObject(x,ae);if((_===null||x!==_||he.name!==f.name||Math.abs(ge-p)>.01||Pe!==M.red||be!==M.green||Be!==M.blue)&&(T(J),_=x,f=he,p=ge,M={red:Pe,green:be,blue:Be,alpha:Me},P=J,y=null),this.pdfiumModule.FPDFText_GetLooseCharBox(u,J,K)){const Oe=this.pdfiumModule.pdfium.getValue(K,"float"),ve=this.pdfiumModule.pdfium.getValue(K+4,"float"),de=this.pdfiumModule.pdfium.getValue(K+8,"float"),De=this.pdfiumModule.pdfium.getValue(K+12,"float");if(Oe!==de&&ve!==De){this.pdfiumModule.FPDF_PageToDevice(a.pagePtr,0,0,n.size.width,n.size.height,0,Oe,ve,z,q),this.pdfiumModule.FPDF_PageToDevice(a.pagePtr,0,0,n.size.width,n.size.height,0,de,De,k,$);const ye=this.pdfiumModule.pdfium.getValue(z,"i32"),Ae=this.pdfiumModule.pdfium.getValue(q,"i32"),Re=this.pdfiumModule.pdfium.getValue(k,"i32"),Ge=this.pdfiumModule.pdfium.getValue($,"i32"),ce=Math.min(ye,Re),H=Math.min(Ae,Ge),Se=Math.abs(Re-ye),U=Math.abs(Ge-Ae);y===null?y={minX:ce,minY:H,maxX:ce+Se,maxY:H+U}:(y.minX=Math.min(y.minX,ce),y.minY=Math.min(y.minY,H),y.maxX=Math.max(y.maxX,ce+Se),y.maxY=Math.max(y.maxY,H+U))}}}return T(l),[C,R,N,V,K,z,q,k,$,ae].forEach(J=>this.memoryManager.free(J)),a.release(),this.logger.perf(h,D,o,"End",t.id),E.resolve({runs:F})}readFontInfoFromTextObject(t,n){const o=this.pdfiumModule.FPDFTextObj_GetFont(t);let e="",a="",u=400,l=!1,F=!1,P=!1;if(o){const _=this.pdfiumModule.FPDFFont_GetBaseFontName(o,0,0);if(_>0){const p=this.memoryManager.malloc(_+1);this.pdfiumModule.FPDFFont_GetBaseFontName(o,p,_+1),e=this.pdfiumModule.pdfium.UTF8ToString(p),this.memoryManager.free(p)}const f=this.pdfiumModule.FPDFFont_GetFamilyName(o,0,0);if(f>0){const p=this.memoryManager.malloc(f+1);this.pdfiumModule.FPDFFont_GetFamilyName(o,p,f+1),a=this.pdfiumModule.pdfium.UTF8ToString(p),this.memoryManager.free(p)}u=this.pdfiumModule.FPDFFont_GetWeight(o),P=this.pdfiumModule.FPDFFont_GetIsEmbedded(o)!==0,this.pdfiumModule.FPDFFont_GetItalicAngle(o,n)&&(l=this.pdfiumModule.pdfium.getValue(n,"i32")!==0),F=!!(1&this.pdfiumModule.FPDFFont_GetFlags(o))}return{name:e,familyName:a,weight:u,italic:l,monospaced:F,embedded:P}}readGlyphInfo(t,n,o,e){const a=this.memoryManager.malloc(4),u=this.memoryManager.malloc(4),l=this.memoryManager.malloc(4),F=this.memoryManager.malloc(4),P=this.memoryManager.malloc(16),_=this.memoryManager.malloc(8),f=this.memoryManager.malloc(8),p=this.memoryManager.malloc(8),M=this.memoryManager.malloc(8),y=[P,a,u,l,F,_,f,p,M];let T,C,R=0,N=0,V=0,K=0,z=!1;if(this.pdfiumModule.FPDFText_GetLooseCharBox(o,e,P)){const q=this.pdfiumModule.pdfium.getValue(P,"float"),k=this.pdfiumModule.pdfium.getValue(P+4,"float"),$=this.pdfiumModule.pdfium.getValue(P+8,"float"),ae=this.pdfiumModule.pdfium.getValue(P+12,"float");if(q===$||k===ae)return y.forEach(Pe=>this.memoryManager.free(Pe)),{origin:{x:0,y:0},size:{width:0,height:0},isEmpty:!0};this.pdfiumModule.FPDF_PageToDevice(n,0,0,t.size.width,t.size.height,0,q,k,a,u),this.pdfiumModule.FPDF_PageToDevice(n,0,0,t.size.width,t.size.height,0,$,ae,l,F);const J=this.pdfiumModule.pdfium.getValue(a,"i32"),se=this.pdfiumModule.pdfium.getValue(u,"i32"),x=this.pdfiumModule.pdfium.getValue(l,"i32"),ge=this.pdfiumModule.pdfium.getValue(F,"i32");if(R=Math.min(J,x),N=Math.min(se,ge),V=Math.max(1,Math.abs(x-J)),K=Math.max(1,Math.abs(ge-se)),this.pdfiumModule.FPDFText_GetCharBox(o,e,_,f,p,M)){const Pe=this.pdfiumModule.pdfium.getValue(_,"double"),be=this.pdfiumModule.pdfium.getValue(f,"double"),Be=this.pdfiumModule.pdfium.getValue(p,"double"),Me=this.pdfiumModule.pdfium.getValue(M,"double");this.pdfiumModule.FPDF_PageToDevice(n,0,0,t.size.width,t.size.height,0,Pe,Me,a,u),this.pdfiumModule.FPDF_PageToDevice(n,0,0,t.size.width,t.size.height,0,be,Be,l,F);const he=this.pdfiumModule.pdfium.getValue(a,"i32"),Oe=this.pdfiumModule.pdfium.getValue(u,"i32"),ve=this.pdfiumModule.pdfium.getValue(l,"i32"),de=this.pdfiumModule.pdfium.getValue(F,"i32");T={x:Math.min(he,ve),y:Math.min(Oe,de)},C={width:Math.max(1,Math.abs(ve-he)),height:Math.max(1,Math.abs(de-Oe))}}z=this.pdfiumModule.FPDFText_GetUnicode(o,e)===32}return y.forEach(q=>this.memoryManager.free(q)),{origin:{x:R,y:N},size:{width:V,height:K},...T&&{tightOrigin:T},...C&&{tightSize:C},...z&&{isSpace:z}}}getPageGlyphs(t,n){this.logger.debug(h,D,"getPageGlyphs",t,n),this.logger.perf(h,D,"getPageGlyphs","Begin",t.id);const o=this.cache.getContext(t.id);if(!o)return this.logger.perf(h,D,"getPageGlyphs","End",t.id),E.reject({code:S.DocNotOpen,message:"document does not open"});const e=o.acquirePage(n.index),a=e.getTextPage(),u=this.pdfiumModule.FPDFText_CountChars(a),l=new Array(u);for(let F=0;F<u;F++){const P=this.readGlyphInfo(n,e.pagePtr,a,F);P.isEmpty||(l[F]={...P})}return e.release(),this.logger.perf(h,D,"getPageGlyphs","End",t.id),E.resolve(l)}readCharBox(t,n,o,e){const a=this.memoryManager.malloc(8),u=this.memoryManager.malloc(8),l=this.memoryManager.malloc(8),F=this.memoryManager.malloc(8);let P=0,_=0,f=0,p=0;if(this.pdfiumModule.FPDFText_GetCharBox(o,e,u,F,l,a)){const M=this.pdfiumModule.pdfium.getValue(a,"double"),y=this.pdfiumModule.pdfium.getValue(u,"double"),T=this.pdfiumModule.pdfium.getValue(l,"double"),C=this.pdfiumModule.pdfium.getValue(F,"double"),R=this.memoryManager.malloc(4),N=this.memoryManager.malloc(4);this.pdfiumModule.FPDF_PageToDevice(n,0,0,t.size.width,t.size.height,0,y,M,R,N),P=this.pdfiumModule.pdfium.getValue(R,"i32"),_=this.pdfiumModule.pdfium.getValue(N,"i32"),this.memoryManager.free(R),this.memoryManager.free(N),f=Math.ceil(Math.abs(C-y)),p=Math.ceil(Math.abs(M-T))}return this.memoryManager.free(a),this.memoryManager.free(u),this.memoryManager.free(l),this.memoryManager.free(F),{origin:{x:P,y:_},size:{width:f,height:p}}}readPageAnnotations(t,n,o){return n.borrowPage(o.index,e=>e.withFormHandle(a=>{const u=this.pdfiumModule.FPDFPage_GetAnnotCount(e.pagePtr),l=[];for(let F=0;F<u;F++)e.withAnnotation(F,P=>{const _=this.readPageAnnotation(t,n.docPtr,o,P,a);_&&l.push(_)});return l}))}readPageAnnoWidgets(t,n,o){return n.borrowPage(o.index,e=>e.withFormHandle(a=>{const u=this.pdfiumModule.FPDFPage_GetAnnotCount(e.pagePtr),l=[];for(let F=0;F<u;F++)e.withAnnotation(F,P=>{const _=this.readPageAnnoWidget(t,o,P,a);_&&l.push(_)});return l}))}readPageAnnotationsRaw(t,n,o,e){const a=this.pdfiumModule.EPDFPage_GetAnnotCountRaw(n.docPtr,o.index);if(a<=0)return[];const u=[];for(let l=0;l<a;++l){const F=this.pdfiumModule.EPDFPage_GetAnnotRaw(n.docPtr,o.index,l);if(F)try{const P=this.readPageAnnotation(t,n.docPtr,o,F,e);P&&u.push(P)}finally{this.pdfiumModule.FPDFPage_CloseAnnot(F)}}return u}readPageAnnoWidget(t,n,o,e){let a=this.getAnnotString(o,"NM");if(a||(a=lt(),this.setAnnotString(o,"NM",a)),this.pdfiumModule.FPDFAnnot_GetSubtype(o)===v.WIDGET)return this.readPdfWidgetAnno(t,n,o,e,a)}getPageAnnotationsRaw(t,n){this.logger.debug(h,D,"getPageAnnotationsRaw",t,n),this.logger.perf(h,D,"GetPageAnnotationsRaw","Begin",`${t.id}-${n.index}`);const o=this.cache.getContext(t.id);if(!o)return E.reject({code:S.DocNotOpen,message:"document does not open"});const e=this.pdfiumModule.PDFiumExt_OpenFormFillInfo(),a=this.pdfiumModule.PDFiumExt_InitFormFillEnvironment(o.docPtr,e);try{const u=this.readPageAnnotationsRaw(t,o,n,a);return this.logger.perf(h,D,"GetPageAnnotationsRaw","End",`${t.id}-${n.index}`),this.logger.debug(h,D,"getPageAnnotationsRaw",`${t.id}-${n.index}`,u),E.resolve(u)}finally{this.pdfiumModule.PDFiumExt_ExitFormFillEnvironment(a),this.pdfiumModule.PDFiumExt_CloseFormFillInfo(e)}}readPageAnnotation(t,n,o,e,a){let u=this.getAnnotString(e,"NM");u||(u=lt(),this.setAnnotString(e,"NM",u));const l=this.pdfiumModule.FPDFAnnot_GetSubtype(e);let F;switch(l){case v.TEXT:F=this.readPdfTextAnno(t,o,e,u);break;case v.FREETEXT:F=this.readPdfFreeTextAnno(t,o,e,u);break;case v.LINK:F=this.readPdfLinkAnno(t,o,n,e,u);break;case v.WIDGET:if(a!==void 0)return this.readPdfWidgetAnno(t,o,e,a,u);break;case v.FILEATTACHMENT:F=this.readPdfFileAttachmentAnno(t,o,e,u);break;case v.INK:F=this.readPdfInkAnno(t,o,e,u);break;case v.POLYGON:F=this.readPdfPolygonAnno(t,o,e,u);break;case v.POLYLINE:F=this.readPdfPolylineAnno(t,o,e,u);break;case v.LINE:F=this.readPdfLineAnno(t,o,e,u);break;case v.HIGHLIGHT:F=this.readPdfHighlightAnno(t,o,e,u);break;case v.STAMP:F=this.readPdfStampAnno(t,o,e,u);break;case v.SQUARE:F=this.readPdfSquareAnno(t,o,e,u);break;case v.CIRCLE:F=this.readPdfCircleAnno(t,o,e,u);break;case v.UNDERLINE:F=this.readPdfUnderlineAnno(t,o,e,u);break;case v.SQUIGGLY:F=this.readPdfSquigglyAnno(t,o,e,u);break;case v.STRIKEOUT:F=this.readPdfStrikeOutAnno(t,o,e,u);break;case v.CARET:F=this.readPdfCaretAnno(t,o,e,u);break;case v.REDACT:F=this.readPdfRedactAnno(t,o,e,u);break;default:F=this.readPdfAnno(t,o,l,e,u)}if(F){F=this.reverseRotateAnnotationOnLoad(F);const P=this.pdfiumModule.EPDFAnnot_GetAvailableAppearanceModes(e);P&&(F.appearanceModes=P)}return F}reverseRotateAnnotationOnLoad(t){const n=t.rotation,o=t.unrotatedRect;if(!n||n===0||!o)return t;const e={x:o.origin.x+o.size.width/2,y:o.origin.y+o.size.height/2};switch(t.type){case v.INK:{const a=t,u=a.inkList.map(l=>({points:l.points.map(F=>this.rotatePointForSave(F,e,-n))}));return{...a,inkList:u}}case v.LINE:{const a=t;return{...a,linePoints:{start:this.rotatePointForSave(a.linePoints.start,e,-n),end:this.rotatePointForSave(a.linePoints.end,e,-n)}}}case v.POLYGON:{const a=t;return{...a,vertices:a.vertices.map(u=>this.rotatePointForSave(u,e,-n))}}case v.POLYLINE:{const a=t;return{...a,vertices:a.vertices.map(u=>this.rotatePointForSave(u,e,-n))}}default:return t}}readAnnotationColor(t,n=X.Color){const o=this.memoryManager.malloc(4),e=this.memoryManager.malloc(4),a=this.memoryManager.malloc(4);let u;return this.pdfiumModule.EPDFAnnot_GetColor(t,n,o,e,a)&&(u={red:255&this.pdfiumModule.pdfium.getValue(o,"i32"),green:255&this.pdfiumModule.pdfium.getValue(e,"i32"),blue:255&this.pdfiumModule.pdfium.getValue(a,"i32")}),this.memoryManager.free(o),this.memoryManager.free(e),this.memoryManager.free(a),u}getAnnotationColor(t,n=X.Color){const o=this.readAnnotationColor(t,n);return o?Ct(o):void 0}setAnnotationColor(t,n,o=X.Color){const e=St(n);return this.pdfiumModule.EPDFAnnot_SetColor(t,o,255&e.red,255&e.green,255&e.blue)}getAnnotationOpacity(t){const n=this.memoryManager.malloc(4),o=this.pdfiumModule.EPDFAnnot_GetOpacity(t,n)?this.pdfiumModule.pdfium.getValue(n,"i32"):255;return this.memoryManager.free(n),Cn(o)}setAnnotationOpacity(t,n){const o=wn(n);return this.pdfiumModule.EPDFAnnot_SetOpacity(t,255&o)}getAnnotationRotation(t){const n=this.memoryManager.malloc(4);if(!this.pdfiumModule.EPDFAnnot_GetRotate(t,n))return this.memoryManager.free(n),0;const o=this.pdfiumModule.pdfium.getValue(n,"float");return this.memoryManager.free(n),o}setAnnotationRotation(t,n){return!!this.pdfiumModule.EPDFAnnot_SetRotate(t,n)}getAnnotExtendedRotation(t){const n=this.memoryManager.malloc(4);if(!this.pdfiumModule.EPDFAnnot_GetExtendedRotation(t,n))return this.memoryManager.free(n),0;const o=this.pdfiumModule.pdfium.getValue(n,"float");return this.memoryManager.free(n),o}setAnnotExtendedRotation(t,n){return!!this.pdfiumModule.EPDFAnnot_SetExtendedRotation(t,n)}readAnnotUnrotatedRect(t){const n=this.memoryManager.malloc(16);if(!this.pdfiumModule.EPDFAnnot_GetUnrotatedRect(t,n))return this.memoryManager.free(n),null;const o=this.pdfiumModule.pdfium.getValue(n,"float"),e=this.pdfiumModule.pdfium.getValue(n+4,"float"),a=this.pdfiumModule.pdfium.getValue(n+8,"float"),u=this.pdfiumModule.pdfium.getValue(n+12,"float");return this.memoryManager.free(n),o===0&&e===0&&a===0&&u===0?null:{left:o,top:e,right:a,bottom:u}}setAnnotUnrotatedRect(t,n,o,e){const a=e.origin.x,u=e.origin.y,l=e.origin.x+e.size.width,F=e.origin.y+e.size.height,P=this.convertDevicePointToPagePoint(t,n,{x:a,y:u}),_=this.convertDevicePointToPagePoint(t,n,{x:l,y:u}),f=this.convertDevicePointToPagePoint(t,n,{x:l,y:F}),p=this.convertDevicePointToPagePoint(t,n,{x:a,y:F});let M=Math.min(P.x,_.x,f.x,p.x),y=Math.max(P.x,_.x,f.x,p.x),T=Math.min(P.y,_.y,f.y,p.y),C=Math.max(P.y,_.y,f.y,p.y);M>y&&([M,y]=[y,M]),T>C&&([T,C]=[C,T]);const R=this.memoryManager.malloc(16),N=this.pdfiumModule.pdfium;N.setValue(R+0,M,"float"),N.setValue(R+4,C,"float"),N.setValue(R+8,y,"float"),N.setValue(R+12,T,"float");const V=this.pdfiumModule.EPDFAnnot_SetUnrotatedRect(o,R);return this.memoryManager.free(R),!!V}getAnnotationTextAlignment(t){return this.pdfiumModule.EPDFAnnot_GetTextAlignment(t)}setAnnotationTextAlignment(t,n){return!!this.pdfiumModule.EPDFAnnot_SetTextAlignment(t,n)}getAnnotationVerticalAlignment(t){return this.pdfiumModule.EPDFAnnot_GetVerticalAlignment(t)}setAnnotationVerticalAlignment(t,n){return!!this.pdfiumModule.EPDFAnnot_SetVerticalAlignment(t,n)}getOverlayText(t){const n=this.pdfiumModule.EPDFAnnot_GetOverlayText(t,0,0);if(n===0)return;const o=2*(n+1),e=this.memoryManager.malloc(o);this.pdfiumModule.EPDFAnnot_GetOverlayText(t,e,o);const a=this.pdfiumModule.pdfium.UTF16ToString(e);return this.memoryManager.free(e),a||void 0}setOverlayText(t,n){return n?this.withWString(n,o=>this.pdfiumModule.EPDFAnnot_SetOverlayText(t,o)):this.pdfiumModule.EPDFAnnot_SetOverlayText(t,0)}getOverlayTextRepeat(t){return this.pdfiumModule.EPDFAnnot_GetOverlayTextRepeat(t)}setOverlayTextRepeat(t,n){return this.pdfiumModule.EPDFAnnot_SetOverlayTextRepeat(t,n)}getAnnotationDefaultAppearance(t){const n=this.memoryManager.malloc(4),o=this.memoryManager.malloc(4),e=this.memoryManager.malloc(4),a=this.memoryManager.malloc(4),u=this.memoryManager.malloc(4);if(!this.pdfiumModule.EPDFAnnot_GetDefaultAppearance(t,n,o,e,a,u))return void[n,o,e,a,u].forEach(M=>this.memoryManager.free(M));const l=this.pdfiumModule.pdfium,F=l.getValue(n,"i32"),P=l.getValue(o,"float"),_=255&l.getValue(e,"i32"),f=255&l.getValue(a,"i32"),p=255&l.getValue(u,"i32");return[n,o,e,a,u].forEach(M=>this.memoryManager.free(M)),{fontFamily:F,fontSize:P,fontColor:Ct({red:_,green:f,blue:p})}}setAnnotationDefaultAppearance(t,n,o,e){const{red:a,green:u,blue:l}=St(e);return!!this.pdfiumModule.EPDFAnnot_SetDefaultAppearance(t,n,o,255&a,255&u,255&l)}getBorderStyle(t){const n=this.memoryManager.malloc(4);let o=0,e=_e.UNKNOWN,a=!1;return e=this.pdfiumModule.EPDFAnnot_GetBorderStyle(t,n),o=this.pdfiumModule.pdfium.getValue(n,"float"),a=e!==_e.UNKNOWN,this.memoryManager.free(n),{ok:a,style:e,width:o}}setBorderStyle(t,n,o){const e=n===_e.CLOUDY?_e.SOLID:n;return this.pdfiumModule.EPDFAnnot_SetBorderStyle(t,e,o)}getAnnotationName(t){return this.pdfiumModule.EPDFAnnot_GetName(t)}setAnnotationName(t,n){return this.pdfiumModule.EPDFAnnot_SetName(t,n)}getReplyType(t){return this.pdfiumModule.EPDFAnnot_GetReplyType(t)}setReplyType(t,n){return this.pdfiumModule.EPDFAnnot_SetReplyType(t,n??sn.Unknown)}getBorderEffect(t){const n=this.memoryManager.malloc(4),o=!!this.pdfiumModule.EPDFAnnot_GetBorderEffect(t,n),e=o?this.pdfiumModule.pdfium.getValue(n,"float"):0;return this.memoryManager.free(n),{ok:o,intensity:e}}getRectangleDifferences(t){const n=this.memoryManager.malloc(4),o=this.memoryManager.malloc(4),e=this.memoryManager.malloc(4),a=this.memoryManager.malloc(4),u=!!this.pdfiumModule.EPDFAnnot_GetRectangleDifferences(t,n,o,e,a),l=this.pdfiumModule.pdfium,F=l.getValue(n,"float"),P=l.getValue(o,"float"),_=l.getValue(e,"float"),f=l.getValue(a,"float");return this.memoryManager.free(n),this.memoryManager.free(o),this.memoryManager.free(e),this.memoryManager.free(a),{ok:u,left:F,top:f,right:_,bottom:P}}setRectangleDifferences(t,n){return n?this.pdfiumModule.EPDFAnnot_SetRectangleDifferences(t,n.left,n.bottom,n.right,n.top):this.pdfiumModule.EPDFAnnot_ClearRectangleDifferences(t)}setBorderEffect(t,n){return n===void 0||n<=0?this.pdfiumModule.EPDFAnnot_ClearBorderEffect(t):this.pdfiumModule.EPDFAnnot_SetBorderEffect(t,n)}getAnnotationDate(t,n){const o=this.getAnnotString(t,n);return o?gt(o):void 0}setAnnotationDate(t,n,o){const e=xt(o);return this.setAnnotString(t,n,e)}getAttachmentDate(t,n){const o=this.getAttachmentString(t,n);return o?gt(o):void 0}setAttachmentDate(t,n,o){const e=xt(o);return this.setAttachmentString(t,n,e)}getBorderDashPattern(t){const n=this.pdfiumModule.EPDFAnnot_GetBorderDashPatternCount(t);if(n===0)return{ok:!1,pattern:[]};const o=this.memoryManager.malloc(4*n),e=!!this.pdfiumModule.EPDFAnnot_GetBorderDashPattern(t,o,n),a=[];if(e){const u=this.pdfiumModule.pdfium;for(let l=0;l<n;l++)a.push(u.getValue(o+4*l,"float"))}return this.memoryManager.free(o),{ok:e,pattern:a}}setBorderDashPattern(t,n){if(!n||n.length===0)return this.pdfiumModule.EPDFAnnot_SetBorderDashPattern(t,0,0);const o=n.map(l=>Number.isFinite(l)&&l>0?l:0).filter(l=>l>0);if(o.length===0)return this.pdfiumModule.EPDFAnnot_SetBorderDashPattern(t,0,0);const e=4*o.length,a=this.memoryManager.malloc(e);for(let l=0;l<o.length;l++)this.pdfiumModule.pdfium.setValue(a+4*l,o[l],"float");const u=!!this.pdfiumModule.EPDFAnnot_SetBorderDashPattern(t,a,o.length);return this.memoryManager.free(a),u}getLineEndings(t){const n=this.memoryManager.malloc(4),o=this.memoryManager.malloc(4);if(!this.pdfiumModule.EPDFAnnot_GetLineEndings(t,n,o))return this.memoryManager.free(n),void this.memoryManager.free(o);const e=this.pdfiumModule.pdfium.getValue(n,"i32"),a=this.pdfiumModule.pdfium.getValue(o,"i32");return this.memoryManager.free(n),this.memoryManager.free(o),{start:e,end:a}}setLineEndings(t,n,o){return!!this.pdfiumModule.EPDFAnnot_SetLineEndings(t,n,o)}getLinePoints(t,n,o){const e=this.memoryManager.malloc(8),a=this.memoryManager.malloc(8);if(!this.pdfiumModule.FPDFAnnot_GetLine(o,e,a))return this.memoryManager.free(e),void this.memoryManager.free(a);const u=this.pdfiumModule.pdfium,l=u.getValue(e+0,"float"),F=u.getValue(e+4,"float"),P=u.getValue(a+0,"float"),_=u.getValue(a+4,"float");return this.memoryManager.free(e),this.memoryManager.free(a),{start:this.convertPagePointToDevicePoint(t,n,{x:l,y:F}),end:this.convertPagePointToDevicePoint(t,n,{x:P,y:_})}}setLinePoints(t,n,o,e,a){const u=this.convertDevicePointToPagePoint(t,n,e),l=this.convertDevicePointToPagePoint(t,n,a);if(!u||!l)return!1;const F=this.memoryManager.malloc(16),P=this.pdfiumModule.pdfium;P.setValue(F+0,u.x,"float"),P.setValue(F+4,u.y,"float"),P.setValue(F+8,l.x,"float"),P.setValue(F+12,l.y,"float");const _=this.pdfiumModule.EPDFAnnot_SetLine(o,F,F+8);return this.memoryManager.free(F),!!_}getQuadPointsAnno(t,n,o){const e=this.pdfiumModule.FPDFAnnot_CountAttachmentPoints(o);if(e===0)return[];const a=[];for(let u=0;u<e;u++){const l=this.memoryManager.malloc(32);if(this.pdfiumModule.FPDFAnnot_GetAttachmentPoints(o,u,l)){const F=[],P=[];for(let y=0;y<4;y++){const T=l+8*y;F.push(this.pdfiumModule.pdfium.getValue(T,"float")),P.push(this.pdfiumModule.pdfium.getValue(T+4,"float"))}const _=this.convertPagePointToDevicePoint(t,n,{x:F[0],y:P[0]}),f=this.convertPagePointToDevicePoint(t,n,{x:F[1],y:P[1]}),p=this.convertPagePointToDevicePoint(t,n,{x:F[2],y:P[2]}),M=this.convertPagePointToDevicePoint(t,n,{x:F[3],y:P[3]});a.push({p1:_,p2:f,p3:p,p4:M})}this.memoryManager.free(l)}return a.map(xn)}syncQuadPointsAnno(t,n,o,e){const a=this.pdfiumModule.pdfium,u=this.pdfiumModule.FPDFAnnot_CountAttachmentPoints(o),l=this.memoryManager.malloc(32),F=_=>{const f=un(_),p=this.convertDevicePointToPagePoint(t,n,f.p1),M=this.convertDevicePointToPagePoint(t,n,f.p2),y=this.convertDevicePointToPagePoint(t,n,f.p3),T=this.convertDevicePointToPagePoint(t,n,f.p4);a.setValue(l+0,p.x,"float"),a.setValue(l+4,p.y,"float"),a.setValue(l+8,M.x,"float"),a.setValue(l+12,M.y,"float"),a.setValue(l+16,T.x,"float"),a.setValue(l+20,T.y,"float"),a.setValue(l+24,y.x,"float"),a.setValue(l+28,y.y,"float")},P=Math.min(u,e.length);for(let _=0;_<P;_++)if(F(e[_]),!this.pdfiumModule.FPDFAnnot_SetAttachmentPoints(o,_,l))return this.memoryManager.free(l),!1;for(let _=u;_<e.length;_++)if(F(e[_]),!this.pdfiumModule.FPDFAnnot_AppendAttachmentPoints(o,l))return this.memoryManager.free(l),!1;return this.memoryManager.free(l),!0}redactTextInRects(t,n,o,e){const{recurseForms:a=!0,drawBlackBoxes:u=!1}=e??{};this.logger.debug("PDFiumEngine","Engine","redactTextInQuads",t.id,n.index,o.length);const l="RedactTextInQuads";this.logger.perf("PDFiumEngine","Engine",l,"Begin",`${t.id}-${n.index}`);const F=this.cache.getContext(t.id);if(!F)return this.logger.perf("PDFiumEngine","Engine",l,"End",`${t.id}-${n.index}`),E.reject({code:S.DocNotOpen,message:"document does not open"});const P=(o??[]).filter(y=>{var T,C,R,N;return y&&Number.isFinite((T=y.origin)==null?void 0:T.x)&&Number.isFinite((C=y.origin)==null?void 0:C.y)&&Number.isFinite((R=y.size)==null?void 0:R.width)&&Number.isFinite((N=y.size)==null?void 0:N.height)&&y.size.width>0&&y.size.height>0});if(P.length===0)return this.logger.perf("PDFiumEngine","Engine",l,"End",`${t.id}-${n.index}`),E.resolve(!1);const _=F.acquirePage(n.index),{ptr:f,count:p}=this.allocFSQuadsBufferFromRects(t,n,P);let M=!1;try{M=!!this.pdfiumModule.EPDFText_RedactInQuads(_.pagePtr,f,p,!!a,!1)}finally{this.memoryManager.free(f)}return M&&(M=!!this.pdfiumModule.FPDFPage_GenerateContent(_.pagePtr)),_.disposeImmediate(),this.logger.perf("PDFiumEngine","Engine",l,"End",`${t.id}-${n.index}`),E.resolve(!!M)}applyRedaction(t,n,o){this.logger.debug(h,D,"applyRedaction",t.id,n.index,o.id);const e="ApplyRedaction";this.logger.perf(h,D,e,"Begin",`${t.id}-${n.index}`);const a=this.cache.getContext(t.id);if(!a)return this.logger.perf(h,D,e,"End",`${t.id}-${n.index}`),E.reject({code:S.DocNotOpen,message:"document does not open"});const u=a.acquirePage(n.index),l=this.getAnnotationByName(u.pagePtr,o.id);if(!l)return u.release(),this.logger.perf(h,D,e,"End",`${t.id}-${n.index}`),E.reject({code:S.NotFound,message:"annotation not found"});const F=this.pdfiumModule.EPDFAnnot_ApplyRedaction(u.pagePtr,l);return this.pdfiumModule.FPDFPage_CloseAnnot(l),F&&this.pdfiumModule.FPDFPage_GenerateContent(u.pagePtr),u.disposeImmediate(),this.logger.perf(h,D,e,"End",`${t.id}-${n.index}`),E.resolve(!!F)}applyAllRedactions(t,n){this.logger.debug(h,D,"applyAllRedactions",t.id,n.index);const o="ApplyAllRedactions";this.logger.perf(h,D,o,"Begin",`${t.id}-${n.index}`);const e=this.cache.getContext(t.id);if(!e)return this.logger.perf(h,D,o,"End",`${t.id}-${n.index}`),E.reject({code:S.DocNotOpen,message:"document does not open"});const a=e.acquirePage(n.index),u=this.pdfiumModule.EPDFPage_ApplyRedactions(a.pagePtr);return u&&this.pdfiumModule.FPDFPage_GenerateContent(a.pagePtr),a.disposeImmediate(),this.logger.perf(h,D,o,"End",`${t.id}-${n.index}`),E.resolve(!!u)}flattenAnnotation(t,n,o){this.logger.debug(h,D,"flattenAnnotation",t.id,n.index,o.id);const e="FlattenAnnotation";this.logger.perf(h,D,e,"Begin",`${t.id}-${n.index}`);const a=this.cache.getContext(t.id);if(!a)return this.logger.perf(h,D,e,"End",`${t.id}-${n.index}`),E.reject({code:S.DocNotOpen,message:"document does not open"});const u=a.acquirePage(n.index),l=this.getAnnotationByName(u.pagePtr,o.id);if(!l)return u.release(),this.logger.perf(h,D,e,"End",`${t.id}-${n.index}`),E.reject({code:S.NotFound,message:"annotation not found"});const F=this.pdfiumModule.EPDFAnnot_Flatten(u.pagePtr,l);return this.pdfiumModule.FPDFPage_CloseAnnot(l),F&&this.pdfiumModule.FPDFPage_GenerateContent(u.pagePtr),u.disposeImmediate(),this.logger.perf(h,D,e,"End",`${t.id}-${n.index}`),E.resolve(!!F)}exportAnnotationAppearanceAsPdf(t,n,o){this.logger.debug(h,D,"exportAnnotationAppearanceAsPdf",t.id,n.index,o.id);const e="ExportAnnotationAppearanceAsPdf";this.logger.perf(h,D,e,"Begin",`${t.id}-${n.index}`);const a=this.cache.getContext(t.id);if(!a)return this.logger.perf(h,D,e,"End",`${t.id}-${n.index}`),E.reject({code:S.DocNotOpen,message:"document does not open"});const u=a.acquirePage(n.index),l=this.getAnnotationByName(u.pagePtr,o.id);if(!l)return u.release(),this.logger.perf(h,D,e,"End",`${t.id}-${n.index}`),E.reject({code:S.NotFound,message:"annotation not found"});const F=this.pdfiumModule.EPDFAnnot_ExportAppearanceAsDocument(l);if(this.pdfiumModule.FPDFPage_CloseAnnot(l),!F)return u.release(),this.logger.perf(h,D,e,"End",`${t.id}-${n.index}`),E.reject({code:S.CantCreateNewDoc,message:"can not export annotation as pdf"});try{return E.resolve(this.saveDocument(F))}finally{this.pdfiumModule.FPDF_CloseDocument(F),u.release(),this.logger.perf(h,D,e,"End",`${t.id}-${n.index}`)}}exportAnnotationsAppearanceAsPdf(t,n,o){this.logger.debug(h,D,"exportAnnotationsAppearanceAsPdf",t.id,n.index,o.map(f=>f.id));const e="ExportAnnotationsAppearanceAsPdf";this.logger.perf(h,D,e,"Begin",`${t.id}-${n.index}`);const a=this.cache.getContext(t.id);if(!a)return this.logger.perf(h,D,e,"End",`${t.id}-${n.index}`),E.reject({code:S.DocNotOpen,message:"document does not open"});if(o.length===0)return this.logger.perf(h,D,e,"End",`${t.id}-${n.index}`),E.reject({code:S.NotFound,message:"no annotations provided"});const u=a.acquirePage(n.index),l=[];for(const f of o){const p=this.getAnnotationByName(u.pagePtr,f.id);if(!p){for(const M of l)this.pdfiumModule.FPDFPage_CloseAnnot(M);return u.release(),this.logger.perf(h,D,e,"End",`${t.id}-${n.index}`),E.reject({code:S.NotFound,message:`annotation not found: ${f.id}`})}l.push(p)}const F=4*l.length,P=this.memoryManager.malloc(F);for(let f=0;f<l.length;f++)this.pdfiumModule.pdfium.setValue(P+4*f,l[f],"i32");const _=this.pdfiumModule.EPDFAnnot_ExportMultipleAppearancesAsDocument(P,l.length);this.memoryManager.free(P);for(const f of l)this.pdfiumModule.FPDFPage_CloseAnnot(f);if(!_)return u.release(),this.logger.perf(h,D,e,"End",`${t.id}-${n.index}`),E.reject({code:S.CantCreateNewDoc,message:"can not export annotations as pdf"});try{return E.resolve(this.saveDocument(_))}finally{this.pdfiumModule.FPDF_CloseDocument(_),u.release(),this.logger.perf(h,D,e,"End",`${t.id}-${n.index}`)}}allocFSQuadsBufferFromRects(t,n,o){const e=o.length,a=this.memoryManager.malloc(32*e),u=this.pdfiumModule.pdfium;for(let l=0;l<e;l++){const F=o[l],P=un(F),_=this.convertDevicePointToPagePoint(t,n,P.p1),f=this.convertDevicePointToPagePoint(t,n,P.p2),p=this.convertDevicePointToPagePoint(t,n,P.p3),M=this.convertDevicePointToPagePoint(t,n,P.p4),y=a+32*l;u.setValue(y+0,_.x,"float"),u.setValue(y+4,_.y,"float"),u.setValue(y+8,f.x,"float"),u.setValue(y+12,f.y,"float"),u.setValue(y+16,M.x,"float"),u.setValue(y+20,M.y,"float"),u.setValue(y+24,p.x,"float"),u.setValue(y+28,p.y,"float")}return{ptr:a,count:e}}getInkList(t,n,o){const e=[],a=this.pdfiumModule.FPDFAnnot_GetInkListCount(o);if(a<=0)return e;const u=this.pdfiumModule.pdfium;for(let l=0;l<a;l++){const F=[],P=this.pdfiumModule.FPDFAnnot_GetInkListPath(o,l,0,0
5);if(P>0){const _=this.memoryManager.malloc(8*P);this.pdfiumModule.FPDFAnnot_GetInkListPath(o,l,_,P);for(let f=0;f<P;f++){const p=_+8*f,M=u.getValue(p+0,"float"),y=u.getValue(p+4,"float"),T=this.convertPagePointToDevicePoint(t,n,{x:M,y});F.push({x:T.x,y:T.y})}this.memoryManager.free(_)}e.push({points:F})}return e}setInkList(t,n,o,e){const a=this.pdfiumModule.pdfium;for(const u of e){const l=u.points.length;if(l===0)continue;const F=this.memoryManager.malloc(8*l);for(let _=0;_<l;_++){const f=u.points[_],p=this.convertDevicePointToPagePoint(t,n,f);a.setValue(F+8*_+0,p.x,"float"),a.setValue(F+8*_+4,p.y,"float")}const P=this.pdfiumModule.FPDFAnnot_AddInkStroke(o,F,l);if(this.memoryManager.free(F),P===-1)return!1}return!0}readPdfTextAnno(t,n,o,e){const a=this.readPageAnnoRect(o),u=this.convertPageRectToDeviceRect(t,n,a),l=this.getAnnotString(o,"State"),F=this.getAnnotString(o,"StateModel"),P=this.getAnnotationColor(o),_=this.getAnnotationOpacity(o),f=this.getAnnotationName(o);return{pageIndex:n.index,id:e,type:v.TEXT,rect:u,strokeColor:P??"#FFFF00",color:P??"#FFFF00",opacity:_,state:l,stateModel:F,name:f,icon:f,...this.readBaseAnnotationProperties(t,n,o)}}readPdfFreeTextAnno(t,n,o,e){const a=this.readPageAnnoRect(o),u=this.convertPageRectToDeviceRect(t,n,a),l=this.getAnnotString(o,"DS"),F=this.getAnnotationDefaultAppearance(o),P=this.getAnnotationColor(o),_=this.getAnnotationColor(o,X.TextColor),f=this.getBorderStyle(o),p=this.getAnnotationTextAlignment(o),M=this.getAnnotationVerticalAlignment(o),y=this.getAnnotationOpacity(o),T=this.getAnnotRichContent(o),C=this.getRectangleDifferences(o),R=this.getAnnotIntent(o),N=this.getCalloutLine(t,n,o),V=this.getLineEndings(o);return{pageIndex:n.index,id:e,type:v.FREETEXT,rect:u,fontFamily:F?.fontFamily??tt.Unknown,fontSize:F?.fontSize??12,fontColor:_??F?.fontColor??"#000000",verticalAlign:M,color:P,backgroundColor:P,opacity:y,textAlign:p,defaultStyle:l,richContent:T,...C.ok&&{rectangleDifferences:{left:C.left,top:C.top,right:C.right,bottom:C.bottom}},...R&&{intent:R},...N&&{calloutLine:N},...V&&{lineEnding:V.end},...f.width>0?{strokeWidth:f.width,strokeColor:F?.fontColor??"#000000"}:R==="FreeTextCallout"?{strokeWidth:1,strokeColor:F?.fontColor??"#000000"}:{},...this.readBaseAnnotationProperties(t,n,o)}}readPdfLinkAnno(t,n,o,e,a){const u=this.pdfiumModule.FPDFAnnot_GetLink(e);if(!u)return;const l=this.readPageAnnoRect(e),F=this.convertPageRectToDeviceRect(t,n,l),{style:P,width:_}=this.getBorderStyle(e),f=this.getAnnotationColor(e,X.Color);let p;if(P===_e.DASHED){const{ok:y,pattern:T}=this.getBorderDashPattern(e);y&&(p=T)}const M=this.readPdfLinkAnnoTarget(o,()=>this.pdfiumModule.FPDFLink_GetAction(u),()=>this.pdfiumModule.FPDFLink_GetDest(o,u));return{pageIndex:n.index,id:a,type:v.LINK,rect:F,target:M,strokeColor:f,strokeWidth:_,strokeStyle:P,strokeDashArray:p,...this.readBaseAnnotationProperties(t,n,e)}}readPdfWidgetAnno(t,n,o,e,a){const u=this.readPageAnnoRect(o);this.getAnnotationFlags(o);const l=this.getAnnotationDefaultAppearance(o),F=this.convertPageRectToDeviceRect(t,n,u),P=this.readPdfWidgetAnnoField(e,o),_=this.readButtonExportValue(o),f=this.getMKColor(o,0),p=this.getMKColor(o,1),{width:M}=this.getBorderStyle(o);return{pageIndex:n.index,id:a,type:v.WIDGET,fontFamily:l?.fontFamily??tt.Unknown,fontSize:l?.fontSize??12,fontColor:l?.fontColor??"#000000",rect:F,field:P,..._!==void 0&&{exportValue:_},strokeWidth:M,strokeColor:f??"transparent",color:p??"transparent",...this.readBaseAnnotationProperties(t,n,o)}}readPdfFileAttachmentAnno(t,n,o,e){const a=this.readPageAnnoRect(o),u=this.convertPageRectToDeviceRect(t,n,a);return{pageIndex:n.index,id:e,type:v.FILEATTACHMENT,rect:u,...this.readBaseAnnotationProperties(t,n,o)}}readPdfInkAnno(t,n,o,e){const a=this.readPageAnnoRect(o),u=this.convertPageRectToDeviceRect(t,n,a),l=this.getAnnotationColor(o)??"#FF0000",F=this.getAnnotationOpacity(o),{width:P}=this.getBorderStyle(o),_=this.getInkList(t,n,o),f=this.getAnnotIntent(o);return{pageIndex:n.index,id:e,type:v.INK,rect:u,...f&&{intent:f},strokeColor:l,color:l,opacity:F,strokeWidth:P===0?1:P,inkList:_,...this.readBaseAnnotationProperties(t,n,o)}}readPdfPolygonAnno(t,n,o,e){const a=this.readPageAnnoRect(o),u=this.convertPageRectToDeviceRect(t,n,a),l=this.readPdfAnnoVertices(t,n,o),F=this.getAnnotationColor(o),P=this.getAnnotationColor(o,X.InteriorColor),_=this.getAnnotationOpacity(o),{style:f,width:p}=this.getBorderStyle(o);let M;if(f===_e.DASHED){const{ok:C,pattern:R}=this.getBorderDashPattern(o);C&&(M=R)}if(l.length>1){const C=l[0],R=l[l.length-1];C.x===R.x&&C.y===R.y&&l.pop()}const y=this.getRectangleDifferences(o),T=this.getBorderEffect(o);return{pageIndex:n.index,id:e,type:v.POLYGON,rect:u,strokeColor:F??"#FF0000",color:P??"transparent",opacity:_,strokeWidth:p===0?1:p,strokeStyle:f,strokeDashArray:M,vertices:l,...T.ok&&{cloudyBorderIntensity:T.intensity},...y.ok&&{rectangleDifferences:{left:y.left,top:y.top,right:y.right,bottom:y.bottom}},...this.readBaseAnnotationProperties(t,n,o)}}readPdfPolylineAnno(t,n,o,e){const a=this.readPageAnnoRect(o),u=this.convertPageRectToDeviceRect(t,n,a),l=this.readPdfAnnoVertices(t,n,o),F=this.getAnnotationColor(o),P=this.getAnnotationColor(o,X.InteriorColor),_=this.getAnnotationOpacity(o),{style:f,width:p}=this.getBorderStyle(o);let M;if(f===_e.DASHED){const{ok:T,pattern:C}=this.getBorderDashPattern(o);T&&(M=C)}const y=this.getLineEndings(o);return{pageIndex:n.index,id:e,type:v.POLYLINE,rect:u,strokeColor:F??"#FF0000",color:P??"transparent",opacity:_,strokeWidth:p===0?1:p,strokeStyle:f,strokeDashArray:M,lineEndings:y,vertices:l,...this.readBaseAnnotationProperties(t,n,o)}}readPdfLineAnno(t,n,o,e){const a=this.readPageAnnoRect(o),u=this.convertPageRectToDeviceRect(t,n,a),l=this.getLinePoints(t,n,o),F=this.getLineEndings(o),P=this.getAnnotationColor(o),_=this.getAnnotationColor(o,X.InteriorColor),f=this.getAnnotationOpacity(o),{style:p,width:M}=this.getBorderStyle(o);let y;if(p===_e.DASHED){const{ok:T,pattern:C}=this.getBorderDashPattern(o);T&&(y=C)}return{pageIndex:n.index,id:e,type:v.LINE,rect:u,strokeWidth:M===0?1:M,strokeStyle:p,strokeDashArray:y,strokeColor:P??"#FF0000",color:_??"transparent",opacity:f,linePoints:l||{start:{x:0,y:0},end:{x:0,y:0}},lineEndings:F||{start:qe.None,end:qe.None},...this.readBaseAnnotationProperties(t,n,o)}}readPdfHighlightAnno(t,n,o,e){const a=this.readPageAnnoRect(o),u=this.convertPageRectToDeviceRect(t,n,a),l=this.getQuadPointsAnno(t,n,o),F=this.getAnnotationColor(o)??"#FFFF00",P=this.getAnnotationOpacity(o);return{pageIndex:n.index,id:e,type:v.HIGHLIGHT,rect:u,segmentRects:l,strokeColor:F,color:F,opacity:P,...this.readBaseAnnotationProperties(t,n,o)}}readPdfUnderlineAnno(t,n,o,e){const a=this.readPageAnnoRect(o),u=this.convertPageRectToDeviceRect(t,n,a),l=this.getQuadPointsAnno(t,n,o),F=this.getAnnotationColor(o)??"#FF0000",P=this.getAnnotationOpacity(o);return{pageIndex:n.index,id:e,type:v.UNDERLINE,rect:u,segmentRects:l,strokeColor:F,color:F,opacity:P,...this.readBaseAnnotationProperties(t,n,o)}}readPdfStrikeOutAnno(t,n,o,e){const a=this.readPageAnnoRect(o),u=this.convertPageRectToDeviceRect(t,n,a),l=this.getQuadPointsAnno(t,n,o),F=this.getAnnotationColor(o)??"#FF0000",P=this.getAnnotationOpacity(o);return{pageIndex:n.index,id:e,type:v.STRIKEOUT,rect:u,segmentRects:l,strokeColor:F,color:F,opacity:P,...this.readBaseAnnotationProperties(t,n,o)}}readPdfSquigglyAnno(t,n,o,e){const a=this.readPageAnnoRect(o),u=this.convertPageRectToDeviceRect(t,n,a),l=this.getQuadPointsAnno(t,n,o),F=this.getAnnotationColor(o)??"#FF0000",P=this.getAnnotationOpacity(o);return{pageIndex:n.index,id:e,type:v.SQUIGGLY,rect:u,segmentRects:l,strokeColor:F,color:F,opacity:P,...this.readBaseAnnotationProperties(t,n,o)}}readPdfCaretAnno(t,n,o,e){const a=this.readPageAnnoRect(o),u=this.convertPageRectToDeviceRect(t,n,a),l=this.getAnnotationColor(o),F=this.getAnnotationOpacity(o),P=this.getAnnotIntent(o),_=this.getRectangleDifferences(o);return{pageIndex:n.index,id:e,type:v.CARET,rect:u,strokeColor:l,opacity:F,intent:P,..._.ok&&{rectangleDifferences:{left:_.left,top:_.top,right:_.right,bottom:_.bottom}},...this.readBaseAnnotationProperties(t,n,o)}}readPdfRedactAnno(t,n,o,e){const a=this.readPageAnnoRect(o),u=this.convertPageRectToDeviceRect(t,n,a),l=this.getQuadPointsAnno(t,n,o),F=this.getAnnotationColor(o,X.InteriorColor),P=this.getAnnotationColor(o,X.OverlayColor),_=this.getAnnotationColor(o,X.Color),f=this.getAnnotationOpacity(o),p=this.getOverlayText(o),M=this.getOverlayTextRepeat(o),y=this.getAnnotationDefaultAppearance(o),T=this.getAnnotationTextAlignment(o);return{pageIndex:n.index,id:e,type:v.REDACT,rect:u,segmentRects:l,color:F,overlayColor:P,strokeColor:_,opacity:f,overlayText:p,overlayTextRepeat:M,fontFamily:y?.fontFamily,fontSize:y?.fontSize,fontColor:y?.fontColor,textAlign:T,...this.readBaseAnnotationProperties(t,n,o)}}readPdfStampAnno(t,n,o,e){const a=this.readPageAnnoRect(o),u=this.convertPageRectToDeviceRect(t,n,a),l=this.getAnnotationName(o);
vendor: 6,159 bytes, line 5
5return{pageIndex:n.index,id:e,type:v.STAMP,rect:u,name:l,icon:l,...this.readBaseAnnotationProperties(t,n,o)}}readPdfPageObject(t){switch(this.pdfiumModule.FPDFPageObj_GetType(t)){case nt.PATH:return this.readPathObject(t);case nt.IMAGE:return this.readImageObject(t);case nt.FORM:return this.readFormObject(t)}}readPathObject(t){const n=this.pdfiumModule.FPDFPath_CountSegments(t),o=this.memoryManager.malloc(4),e=this.memoryManager.malloc(4),a=this.memoryManager.malloc(4),u=this.memoryManager.malloc(4);this.pdfiumModule.FPDFPageObj_GetBounds(t,o,e,a,u);const l={left:this.pdfiumModule.pdfium.getValue(o,"float"),bottom:this.pdfiumModule.pdfium.getValue(e,"float"),right:this.pdfiumModule.pdfium.getValue(a,"float"),top:this.pdfiumModule.pdfium.getValue(u,"float")};this.memoryManager.free(o),this.memoryManager.free(e),this.memoryManager.free(a),this.memoryManager.free(u);const F=[];for(let _=0;_<n;_++){const f=this.readPdfSegment(t,_);F.push(f)}const P=this.readPdfPageObjectTransformMatrix(t);return{type:nt.PATH,bounds:l,segments:F,matrix:P}}readPdfSegment(t,n){const o=this.pdfiumModule.FPDFPath_GetPathSegment(t,n),e=this.pdfiumModule.FPDFPathSegment_GetType(o),a=this.pdfiumModule.FPDFPathSegment_GetClose(o),u=this.memoryManager.malloc(4),l=this.memoryManager.malloc(4);this.pdfiumModule.FPDFPathSegment_GetPoint(o,u,l);const F=this.pdfiumModule.pdfium.getValue(u,"float"),P=this.pdfiumModule.pdfium.getValue(l,"float");return this.memoryManager.free(u),this.memoryManager.free(l),{type:e,point:{x:F,y:P},isClosed:a}}readImageObject(t){const n=this.pdfiumModule.FPDFImageObj_GetBitmap(t),o=this.pdfiumModule.FPDFBitmap_GetBuffer(n),e=this.pdfiumModule.FPDFBitmap_GetWidth(n),a=this.pdfiumModule.FPDFBitmap_GetHeight(n),u=this.pdfiumModule.FPDFBitmap_GetFormat(n),l=e*a,F=new Uint8ClampedArray(4*l);for(let f=0;f<l;f++)if(u===2){const p=this.pdfiumModule.pdfium.getValue(o+3*f,"i8"),M=this.pdfiumModule.pdfium.getValue(o+3*f+1,"i8"),y=this.pdfiumModule.pdfium.getValue(o+3*f+2,"i8");F[4*f]=y,F[4*f+1]=M,F[4*f+2]=p,F[4*f+3]=100}const P={data:F,width:e,height:a},_=this.readPdfPageObjectTransformMatrix(t);return{type:nt.IMAGE,imageData:P,matrix:_}}readFormObject(t){const n=this.pdfiumModule.FPDFFormObj_CountObjects(t),o=[];for(let a=0;a<n;a++){const u=this.pdfiumModule.FPDFFormObj_GetObject(t,a),l=this.readPdfPageObject(u);l&&o.push(l)}const e=this.readPdfPageObjectTransformMatrix(t);return{type:nt.FORM,objects:o,matrix:e}}readPdfPageObjectTransformMatrix(t){const n=this.memoryManager.malloc(24);if(this.pdfiumModule.FPDFPageObj_GetMatrix(t,n)){const o=this.pdfiumModule.pdfium.getValue(n,"float"),e=this.pdfiumModule.pdfium.getValue(n+4,"float"),a=this.pdfiumModule.pdfium.getValue(n+8,"float"),u=this.pdfiumModule.pdfium.getValue(n+12,"float"),l=this.pdfiumModule.pdfium.getValue(n+16,"float"),F=this.pdfiumModule.pdfium.getValue(n+20,"float");return this.memoryManager.free(n),{a:o,b:e,c:a,d:u,e:l,f:F}}return this.memoryManager.free(n),{a:1,b:0,c:0,d:1,e:0,f:0}}readStampAnnotationContents(t){const n=[],o=this.pdfiumModule.FPDFAnnot_GetObjectCount(t);for(let e=0;e<o;e++){const a=this.pdfiumModule.FPDFAnnot_GetObject(t,e),u=this.readPdfPageObject(a);u&&n.push(u)}return n}getStrokeWidth(t){const n=this.memoryManager.malloc(4),o=this.memoryManager.malloc(4),e=this.memoryManager.malloc(4),a=this.pdfiumModule.FPDFAnnot_GetBorder(t,n,o,e)?this.pdfiumModule.pdfium.getValue(e,"float"):1;return this.memoryManager.free(n),this.memoryManager.free(o),this.memoryManager.free(e),a}getAnnotationFlags(t){const n=this.pdfiumModule.FPDFAnnot_GetFlags(t);return Tn(n)}setAnnotationFlags(t,n){const o=On(n);return this.pdfiumModule.FPDFAnnot_SetFlags(t,o)}readPdfCircleAnno(t,n,o,e){const a=this.readPageAnnoRect(o),u=this.convertPageRectToDeviceRect(t,n,a),l=this.getAnnotationColor(o,X.InteriorColor),F=this.getAnnotationColor(o),P=this.getAnnotationOpacity(o),{style:_,width:f}=this.getBorderStyle(o);let p;if(_===_e.DASHED){const{ok:T,pattern:C}=this.getBorderDashPattern(o);T&&(p=C)}const M=this.getRectangleDifferences(o),y=this.getBorderEffect(o);return{pageIndex:n.index,id:e,type:v.CIRCLE,rect:u,color:l??"transparent",opacity:P,strokeWidth:f,strokeColor:F??"#FF0000",strokeStyle:_,...p!==void 0&&{strokeDashArray:p},...y.ok&&{cloudyBorderIntensity:y.intensity},...M.ok&&{rectangleDifferences:{left:M.left,top:M.top,right:M.right,bottom:M.bottom}},...this.readBaseAnnotationProperties(t,n,o)}}readPdfSquareAnno(t,n,o,e){const a=this.readPageAnnoRect(o),u=this.convertPageRectToDeviceRect(t,n,a),l=this.getAnnotationColor(o,X.InteriorColor),F=this.getAnnotationColor(o),P=this.getAnnotationOpacity(o),{style:_,width:f}=this.getBorderStyle(o);let p;if(_===_e.DASHED){const{ok:T,pattern:C}=this.getBorderDashPattern(o);T&&(p=C)}const M=this.getRectangleDifferences(o),y=this.getBorderEffect(o);return{pageIndex:n.index,id:e,type:v.SQUARE,rect:u,color:l??"transparent",opacity:P,strokeColor:F??"#FF0000",strokeWidth:f,strokeStyle:_,...p!==void 0&&{strokeDashArray:p},...y.ok&&{cloudyBorderIntensity:y.intensity},...M.ok&&{rectangleDifferences:{left:M.left,top:M.top,right:M.right,bottom:M.bottom}},...this.readBaseAnnotationProperties(t,n,o)}}readPdfAnno(t,n,o,e,a){const u=this.readPageAnnoRect(e),l=this.convertPageRectToDeviceRect(t,n,u);return{pageIndex:n.index,id:a,type:o,rect:l,...this.readBaseAnnotationProperties(t,n,e)}}getInReplyToId(t){const n=this.pdfiumModule.FPDFAnnot_GetLinkedAnnot(t,"IRT");if(!n)return;let o=this.getAnnotString(n,"NM");return o||(o=lt(),this.setAnnotString(n,"NM",o)),this.pdfiumModule.FPDFPage_CloseAnnot(n),o}setInReplyToId(t,n,o){if(!o)return this.pdfiumModule.EPDFAnnot_SetLinkedAnnot(n,"IRT",0);const e=this.getAnnotationByName(t,o);return!!e&&this.pdfiumModule.EPDFAnnot_SetLinkedAnnot(n,"IRT",e)}rotatePointForSave(t,n,o){const e=o*Math.PI/180,a=Math.cos(e),u=Math.sin(e),l=t.x-n.x,F=t.y-n.y;return{x:n.x+l*a-F*u,y:n.y+l*u+F*a}}prepareAnnotationForSave(t){const n=t.rotation,o=t.unrotatedRect;if(!n||n===0||!o)return t;const e={x:o.origin.x+o.size.width/2,y:o.origin.y+o.size.height/2};switch(t.type){case v.INK:{const a=t,u=a.inkList.map(l=>({points:l.points.map(F=>this.rotatePointForSave(F,e,n))}
5));return{...a,inkList:u}}case v.LINE:{const a=t;return{...a,linePoints:{start:this.rotatePointForSave(a.linePoints.start,e,n),end:this.rotatePointForSave(a.linePoints.end,e,n)}}}case v.POLYGON:{const a=t;return{...a,vertices:a.vertices.map(u=>this.rotatePointForSave(u,e,n))}}case v.POLYLINE:{const a=t;return{...a,vertices:a.vertices.map(u=>this.rotatePointForSave(u,e,n))}}default:return t}}applyBaseAnnotationProperties(t,n,o,e,a){if(!this.setAnnotString(e,"T",a.author||"")||!this.setAnnotString(e,"Contents",a.contents??"")||a.subject&&!this.setAnnotString(e,"Subj",a.subject)||a.modified&&!this.setAnnotationDate(e,"M",a.modified)||a.created&&!this.setAnnotationDate(e,"CreationDate",a.created)||a.flags&&!this.setAnnotationFlags(e,a.flags))return!1;const u=this.getAnnotCustom(e)??{},l={...u,...a.custom??{}};if(delete l.unrotatedRect,delete l.rotation,Object.keys(l).length>0){if(!this.setAnnotCustom(e,l))return!1}else if(Object.keys(u).length>0&&!this.setAnnotCustom(e,null))return!1;if(a.rotation!==void 0){const F=a.rotation?(360-a.rotation)%360:0;this.setAnnotExtendedRotation(e,F)}return a.unrotatedRect?this.setAnnotUnrotatedRect(t,n,e,a.unrotatedRect):a.rotation&&a.rotation!==0&&this.setAnnotUnrotatedRect(t,n,e,a.rect),!!this.setInReplyToId(o,e,a.inReplyToId)&&!!this.setReplyType(e,a.replyType)}readBaseAnnotationProperties(t,n,o){const e=this.getAnnotString(o,"T"),a=this.getAnnotString(o,"Contents")||"",u=this.getAnnotationDate(o,"M"),l=this.getAnnotationDate(o,"CreationDate"),F=this.getAnnotString(o,"Subj"),P=this.getAnnotationFlags(o),_=this.getAnnotCustom(o),f=this.getInReplyToId(o),p=this.getReplyType(o),M=this.pdfiumModule.EPDFAnnot_GetBlendMode(o),y=this.getAnnotExtendedRotation(o),T=y!==0?(360-y)%360:0,C=this.readAnnotUnrotatedRect(o),R=C?this.convertPageRectToDeviceRect(t,n,C):void 0;return{author:e,contents:a,modified:u,created:l,flags:P,custom:_,blendMode:M,...F&&{subject:F},...f&&{inReplyToId:f},...p&&p!==sn.Reply&&{replyType:p},...T!==0&&{rotation:T},...R!==void 0&&{unrotatedRect:R}}}getAnnotString(t,n){const o=this.pdfiumModule.FPDFAnnot_GetStringValue(t,n,0,0);if(o===0)return;const e=2*(o+1),a=this.memoryManager.malloc(e);this.pdfiumModule.FPDFAnnot_GetStringValue(t,n,a,e);const u=this.pdfiumModule.pdfium.UTF16ToString(a);return this.memoryManager.free(a),u||void 0}readButtonExportValue(t){const n=this.pdfiumModule.EPDFAnnot_GetButtonExportValue(t,0,0);if(n===0)return;const o=2*(n+1),e=this.memoryManager.malloc(o);this.pdfiumModule.EPDFAnnot_GetButtonExportValue(t,e,o);const a=this.pdfiumModule.pdfium.UTF16ToString(e);return this.memoryManager.free(e),a||void 0}getAttachmentString(t,n){const o=this.pdfiumModule.FPDFAttachment_GetStringValue(t,n,0,0);if(o===0)return;const e=2*(o+1),a=this.memoryManager.malloc(e);this.pdfiumModule.FPDFAttachment_GetStringValue(t,n,a,e);const u=this.pdfiumModule.pdfium.UTF16ToString(a);return this.memoryManager.free(a),u||void 0}getAttachmentNumber(t,n){const o=this.memoryManager.malloc(4);try{return this.pdfiumModule.EPDFAttachment_GetIntegerValue(t,n,o)?this.pdfiumModule.pdfium.getValue(o,"i32")>>>0:void 0}finally{this.memoryManager.free(o)}}getAnnotCustom(t){const n=this.getAnnotString(t,"EPDFCustom");if(n)try{return JSON.parse(n)}catch(o){return console.warn("Failed to parse annotation custom data as JSON:",o),void console.warn("Invalid JSON string:",n)}}setAnnotCustom(t,n){if(n==null)return this.setAnnotString(t,"EPDFCustom","");try{const o=JSON.stringify(n);return this.setAnnotString(t,"EPDFCustom",o)}catch(o){return console.warn("Failed to stringify annotation custom data as JSON:",o),console.warn("Invalid data object:",n),!1}}getAnnotIntent(t){const n=this.pdfiumModule.EPDFAnnot_GetIntent(t,0,0);if(n===0)return;const o=2*(n+1),e=this.memoryManager.malloc(o);this.pdfiumModule.EPDFAnnot_GetIntent(t,e,o);const a=this.pdfiumModule.pdfium.UTF16ToString(e);return this.memoryManager.free(e),a&&a!=="undefined"?a:void 0}setAnnotIntent(t,n){return this.pdfiumModule.EPDFAnnot_SetIntent(t,n)}getAnnotRichContent(t){const n=this.pdfiumModule.EPDFAnnot_GetRichContent(t,0,0);if(n===0)return;const o=2*(n+1),e=this.memoryManager.malloc(o);this.pdfiumModule.EPDFAnnot_GetRichContent(t,e,o);const a=this.pdfiumModule.pdfium.UTF16ToString(e);return this.memoryManager.free(e),a||void 0}getAnnotationByName(t,n){return this.withWString(n,o=>this.pdfiumModule.EPDFPage_GetAnnotByName(t,o))}removeAnnotationByName(t,n){return this.withWString(n,o=>this.pdfiumModule.EPDFPage_RemoveAnnotByName(t,o))}setAnnotString(t,n,o){return this.withWString(o,e=>this.pdfiumModule.FPDFAnnot_SetStringValue(t,n,e))}setAttachmentString(t,n,o){return this.withWString(o,e=>this.pdfiumModule.FPDFAttachment_SetStringValue(t,n,e))}readPdfAnnoVertices(t,n,o){const e=[],a=this.pdfiumModule.FPDFAnnot_GetVertices(o,0,0),u=this.memoryManager.malloc(8*a);this.pdfiumModule.FPDFAnnot_GetVertices(o,u,a);for(let l=0;l<a;l++){const F=this.pdfiumModule.pdfium.getValue(u+8*l,"float"),P=this.pdfiumModule.pdfium.getValue(u+8*l+4,"float"),{x:_,y:f}=this.convertPagePointToDevicePoint(t,n,{x:F,y:P}),p=e[e.length-1];p&&p.x===_&&p.y===f||e.push({x:_,y:f})}return this.memoryManager.free(u),e}setPdfAnnoVertices(t,n,o,e){const a=this.pdfiumModule.pdfium,u=this.memoryManager.malloc(8*e.length);e.forEach((F,P)=>{const _=this.convertDevicePointToPagePoint(t,n,F);a.setValue(u+8*P+0,_.x,"float"),a.setValue(u+8*P+4,_.y,"float")});const l=this.pdfiumModule.EPDFAnnot_SetVertices(o,u,e.length);return this.memoryManager.free(u),l}getCalloutLine(t,n,o){const e=this.pdfiumModule.EPDFAnnot_GetCalloutLineCount(o);if(e===0)return;const a=this.memoryManager.malloc(8*e);if(this.pdfiumModule.EPDFAnnot_GetCalloutLine(o,a,e)===0)return void this.memoryManager.free(a);const u=[];for(let l=0;l<e;l++){const F=this.pdfiumModule.pdfium.getValue(a+8*l,"float"),P=this.pdfiumModule.pdfium.getValue(a+8*l+4,"float");u.push(this.convertPagePointToDevicePoint(t,n,{x:F,y:P}))}return this.memoryManager.free(a),u}setCalloutLine(t,n,o,e){const a=this.pdfiumModule.pdfium,u=this.memoryManager.malloc(8*e.length);e.forEach((F,P)=>{const _=this.convertDevicePointToPagePoint(t,n,F);a.setValue(u+8*P+0,_.x,"float"),a.setValue(u+8*P+4,_.y,"float")});const l=this.pdfiumModule.EPDFAnnot_SetCalloutLine(o,u,e.length);return this.memoryManager.free(u),l}readPdfBookmarkTarget(t,n,o){const e=n();if(e)return{type:"action",action:this.readPdfAction(t,e)};{const a=o();if(a)return{type:"destination",destination:this.readPdfDestination(t,a)}}}readPdfWidgetAnnoField(t,n){const o=this.pdfiumModule.FPDFAnnot_GetFormField
vendor: 25,007 bytes, line 5
5Flags(t,n),e=this.pdfiumModule.FPDFAnnot_GetFormFieldType(t,n),a=Fe(this.pdfiumModule.pdfium,(_,f)=>this.pdfiumModule.FPDFAnnot_GetFormFieldName(t,n,_,f),this.pdfiumModule.pdfium.UTF16ToString),u=Fe(this.pdfiumModule.pdfium,(_,f)=>this.pdfiumModule.FPDFAnnot_GetFormFieldAlternateName(t,n,_,f),this.pdfiumModule.pdfium.UTF16ToString),l=Fe(this.pdfiumModule.pdfium,(_,f)=>this.pdfiumModule.EPDFAnnot_GetFormFieldRawValue(t,n,_,f),this.pdfiumModule.pdfium.UTF16ToString),F=this.pdfiumModule.EPDFAnnot_GetFormFieldObjectNumber(t,n),P={flag:o,name:a,alternateName:u,value:l,fieldObjectId:F>0?F:void 0};switch(e){case oe.TEXTFIELD:{let _;const f=this.memoryManager.malloc(4);return this.pdfiumModule.FPDFAnnot_GetNumberValue(n,"MaxLen",f)&&(_=this.pdfiumModule.pdfium.getValue(f,"float")),this.memoryManager.free(f),{...P,type:e,maxLen:_}}case oe.CHECKBOX:return{...P,type:e};case oe.RADIOBUTTON:case oe.COMBOBOX:case oe.LISTBOX:return{...P,type:e,options:this.readWidgetOptions(t,n)};case oe.PUSHBUTTON:case oe.SIGNATURE:default:return{...P,type:e}}}readWidgetOptions(t,n){const o=[],e=this.pdfiumModule.FPDFAnnot_GetOptionCount(t,n);for(let a=0;a<e;a++){const u=Fe(this.pdfiumModule.pdfium,(F,P)=>this.pdfiumModule.FPDFAnnot_GetOptionLabel(t,n,a,F,P),this.pdfiumModule.pdfium.UTF16ToString),l=this.pdfiumModule.FPDFAnnot_IsOptionSelected(t,n,a);o.push({label:u,isSelected:l})}return o}renderPageAnnotationRaw(t,n,o,e){const{scaleFactor:a=1,rotation:u=Qe.Degree0,dpr:l=1,mode:F=Ve.Normal}=e??{};this.logger.debug(h,D,"renderPageAnnotation",t,n,o,e),this.logger.perf(h,D,"RenderPageAnnotation","Begin",`${t.id}-${n.index}-${o.id}`);const P=new Ft,_=this.cache.getContext(t.id);if(!_)return this.logger.perf(h,D,"RenderPageAnnotation","End",`${t.id}-${n.index}-${o.id}`),E.reject({code:S.DocNotOpen,message:"document does not open"});const f=_.acquirePage(n.index),p=this.getAnnotationByName(f.pagePtr,o.id);if(!p)return this.logger.perf(h,D,"RenderPageAnnotation","End",`${t.id}-${n.index}-${o.id}`),f.release(),E.reject({code:S.NotFound,message:"annotation not found"});let M=!!this.pdfiumModule.EPDFAnnot_HasAppearanceStream(p,F);if(M||o.type!==v.WIDGET||this.pdfiumModule.FPDFAnnot_HasKey(p,"AP")||(this.pdfiumModule.EPDFAnnot_GenerateFormFieldAP(p),M=!!this.pdfiumModule.EPDFAnnot_HasAppearanceStream(p,F)),!M)return this.pdfiumModule.FPDFPage_CloseAnnot(p),f.release(),this.logger.perf(h,D,"RenderPageAnnotation","End",`${t.id}-${n.index}-${o.id}`),P.resolve({data:new Uint8ClampedArray(4),width:1,height:1}),P;const y=Math.max(.01,a*l),T=!!e?.unrotated&&!!o.unrotatedRect,C=T?o.unrotatedRect:o.rect,R=ln(mn(n.size,C,u,y)),N=Math.max(1,R.size.width),V=Math.max(1,R.size.height),K=4*N,z=K*V,q=this.memoryManager.malloc(z),k=this.pdfiumModule.FPDFBitmap_CreateEx(N,V,4,q,K);this.pdfiumModule.FPDFBitmap_FillRect(k,0,0,N,V,0);const $=Tt(C,u,N,V),ae=this.memoryManager.malloc(24);new Float32Array(this.pdfiumModule.pdfium.HEAPF32.buffer,ae,6).set([$.a,$.b,$.c,$.d,$.e,$.f]);let J=!1;try{J=T?!!this.pdfiumModule.EPDF_RenderAnnotBitmapUnrotated(k,f.pagePtr,p,F,ae,16):!!this.pdfiumModule.EPDF_RenderAnnotBitmap(k,f.pagePtr,p,F,ae,16)}finally{this.memoryManager.free(ae),this.pdfiumModule.FPDFBitmap_Destroy(k),this.pdfiumModule.FPDFPage_CloseAnnot(p),f.release()}if(!J)return this.memoryManager.free(q),this.logger.perf(h,D,"RenderPageAnnotation","End",`${t.id}-${n.index}-${o.id}`),E.reject({code:S.Unknown,message:"EPDF_RenderAnnotBitmap failed"});const se=this.pdfiumModule.pdfium.HEAPU8.subarray(q,q+z),x={data:new Uint8ClampedArray(se),width:N,height:V};return P.resolve(x),this.memoryManager.free(q),P}renderPageAnnotationsRaw(t,n,o){const{scaleFactor:e=1,rotation:a=Qe.Degree0,dpr:u=1}=o??{};this.logger.debug(h,D,"renderPageAnnotationsRaw",t,n,o),this.logger.perf(h,D,"RenderPageAnnotationsRaw","Begin",`${t.id}-${n.index}`);const l=this.cache.getContext(t.id);if(!l)return this.logger.perf(h,D,"RenderPageAnnotationsRaw","End",`${t.id}-${n.index}`),E.reject({code:S.DocNotOpen,message:"document does not open"});const F=l.acquirePage(n.index),P={},_=Math.max(.01,e*u),f=this.pdfiumModule.FPDFPage_GetAnnotCount(F.pagePtr);for(let M=0;M<f;M++){const y=this.pdfiumModule.FPDFPage_GetAnnot(F.pagePtr,M);if(y)try{const T=this.getAnnotString(y,"NM");if(!T||this.getAnnotExtendedRotation(y)!==0&&this.readAnnotUnrotatedRect(y))continue;const C=this.pdfiumModule.EPDFAnnot_GetAvailableAppearanceModes(y);if(!C)continue;const R={},N=[{bit:vn,mode:Ve.Normal,key:"normal"},{bit:Rn,mode:Ve.Rollover,key:"rollover"},{bit:kn,mode:Ve.Down,key:"down"}];for(const{bit:V,mode:K,key:z}of N){if(!(C&V))continue;const q=this.renderSingleAnnotAppearance(t,n,F,y,K,a,_);q&&(R[z]=q)}(R.normal||R.rollover||R.down)&&(P[T]=R)}finally{this.pdfiumModule.FPDFPage_CloseAnnot(y)}}F.release(),this.logger.perf(h,D,"RenderPageAnnotationsRaw","End",`${t.id}-${n.index}`);const p=new Ft;return p.resolve(P),p}renderSingleAnnotAppearance(t,n,o,e,a,u,l){if(!this.pdfiumModule.EPDFAnnot_HasAppearanceStream(e,a)&&(this.pdfiumModule.FPDFAnnot_GetSubtype(e)!==v.WIDGET||this.pdfiumModule.FPDFAnnot_HasKey(e,"AP")||(this.pdfiumModule.EPDFAnnot_GenerateFormFieldAP(e),!this.pdfiumModule.EPDFAnnot_HasAppearanceStream(e,a))))return null;const F=this.readPageAnnoRect(e),P=this.convertPageRectToDeviceRect(t,n,F),_=ln(mn(n.size,P,u,l)),f=Math.max(1,_.size.width),p=Math.max(1,_.size.height),M=4*f,y=M*p,T=this.memoryManager.malloc(y),C=this.pdfiumModule.FPDFBitmap_CreateEx(f,p,4,T,M);this.pdfiumModule.FPDFBitmap_FillRect(C,0,0,f,p,0);const R=Tt(P,u,f,p),N=this.memoryManager.malloc(24);new Float32Array(this.pdfiumModule.pdfium.HEAPF32.buffer,N,6).set([R.a,R.b,R.c,R.d,R.e,R.f]);let V=!1;try{V=!!this.pdfiumModule.EPDF_RenderAnnotBitmap(C,o.pagePtr,e,a,N,16)}finally{this.memoryManager.free(N),this.pdfiumModule.FPDFBitmap_Destroy(C)}if(!V)return this.memoryManager.free(T),null;const K=this.pdfiumModule.pdfium.HEAPU8.subarray(T,T+y),z={data:new Uint8ClampedArray(K),width:f,height:p};return this.memoryManager.free(T),{data:z,rect:P}}renderRectEncoded(t,n,o,e){const a=new Ft,u=e?.rotation??Qe.Degree0,l=this.cache.getContext(t.id);if(!l)return E.reject({code:S.DocNotOpen,message:"document does not open"});const F=Math.max(.01,e?.scaleFactor??1)*Math.max(1,e?.dpr??1),P=o.size.width,_=o.size.height,f=!(1&~u),p=Math.max(1,Math.round((f?_:P)*F)),M=Math.max(1,Math.round((f?P:_)*F)),y=4*p,T=y*M,C=l.acquirePage(n.index),R=e?.withForms??!1,N=this.memoryManager.malloc(T),V=this.pdfiumModule.FPDFBitmap_CreateEx(p,M,4,N,y),K=e?.transparentBackground?0:4294967295;this.pdfiumModule.FPDFBitmap_FillRect(V,0,0,p,M,K);const z=Tt(o,u,p,M),q=this.memoryManager.malloc(24);new Float32Array(this.pdfiumModule.pdfium.HEAPF32.buffer,q,6).set([z.a,z.b,z.c,z.d,z.e,z.f]);const k=this.memoryManager.malloc(16);new Float32Array(this.pdfiumModule.pdfium.HEAPF32.buffer,k,4).set([0,0,p,M]);let $=16;e?.withAnnotations&&($|=1);try{this.pdfiumModule.FPDF_RenderPageBitmapWithMatrix(V,C.pagePtr,q,k,$),R&&C.withFormHandle(se=>{const x=(function(Me,he,Oe,ve){const de=he.origin.x,De=he.origin.y,ye=de+he.size.width,Ae=De+he.size.height,Re=Oe.width,Ge=Oe.height,ce=Math.hypot(Me.a,Me.b),H=Math.hypot(Me.c,Me.d),Se=!(1&~ve),U=Se?Math.max(1,Math.round(Ge*ce)):Math.max(1,Math.round(Re*ce)),ne=Se?Math.max(1,Math.round(Re*H)):Math.max(1,Math.round(Ge*H));let je,Le;switch(ve){case Qe.Degree0:je=-Math.round(de*ce),Le=-Math.round(De*H);break;case Qe.Degree90:je=Math.round((Ae-Ge)*ce),Le=-Math.round(de*H);break;case Qe.Degree180:je=Math.round((ye-Re)*ce),Le=Math.round((Ae-Ge)*H);break;case Qe.Degree270:je=-Math.round(De*ce),Le=Math.round((ye-Re)*H);break;default:je=-Math.round(de*ce),Le=-Math.round(De*H)}return{startX:je,startY:Le,formsWidth:U,formsHeight:ne,scaleX:ce,scaleY:H}})(z,o,n.size,u),{startX:ge,startY:Pe,formsWidth:be,formsHeight:Be}=x;this.pdfiumModule.FPDF_FFLDraw(se,V,C.pagePtr,ge,Pe,be,Be,u,$)})}finally{C.release(),this.memoryManager.free(q),this.memoryManager.free(k)}this.logger.perf(h,D,"RenderRectEncodedData","Begin",`${t.id}-${n.index}`);const ae=this.pdfiumModule.pdfium.HEAPU8.subarray(N,N+T);this.logger.perf(h,D,"RenderRectEncodedData","End",`${t.id}-${n.index}`),this.logger.perf(h,D,"RenderRectEncodedImageData","Begin",`${t.id}-${n.index}`);const J={data:new Uint8ClampedArray(ae),width:p,height:M};return this.logger.perf(h,D,"RenderRectEncodedImageData","End",`${t.id}-${n.index}`),a.resolve(J),this.pdfiumModule.FPDFBitmap_Destroy(V),this.memoryManager.free(N),a}readPdfLinkAnnoTarget(t,n,o){const e=o();if(e)return{type:"destination",destination:this.readPdfDestination(t,e)};{const a=n();if(a)return{type:"action",action:this.readPdfAction(t,a)}}}createLocalDestPtr(t,n){var o,e;const a=this.pdfiumModule.FPDF_LoadPage(t,n.pageIndex);if(!a)return 0;try{if(n.zoom.mode===Te.XYZ){const{x:F,y:P,zoom:_}=n.zoom.params;return this.pdfiumModule.EPDFDest_CreateXYZ(a,!0,F,!0,P,!0,_)}let u,l=[];switch(n.zoom.mode){case Te.FitPage:u=Te.FitPage;break;case Te.FitHorizontal:u=Te.FitHorizontal,l=[((o=n.view)==null?void 0:o[0])??0];break;case Te.FitVertical:u=Te.FitVertical,l=[((e=n.view)==null?void 0:e[0])??0];break;case Te.FitRectangle:{const F=n.view??[];l=[F[0]??0,F[1]??0,F[2]??0,F[3]??0],u=Te.FitRectangle}break;case Te.Unknown:default:return 0}return this.withFloatArray(l,(F,P)=>this.pdfiumModule.EPDFDest_CreateView(a,u,F,P))}finally{this.pdfiumModule.FPDF_ClosePage(a)}}applyBookmarkTarget(t,n,o){if(o.type==="destination"){const a=this.createLocalDestPtr(t,o.destination);return a?!!this.pdfiumModule.EPDFBookmark_SetDest(t,n,a):!1}const e=o.action;switch(e.type){case me.Goto:{const a=this.createLocalDestPtr(t,e.destination);if(!a)return!1;const u=this.pdfiumModule.EPDFAction_CreateGoTo(t,a);return!!u&&!!this.pdfiumModule.EPDFBookmark_SetAction(t,n,u)}case me.URI:{const a=this.pdfiumModule.EPDFAction_CreateURI(t,e.uri);return!!a&&!!this.pdfiumModule.EPDFBookmark_SetAction(t,n,a)}case me.LaunchAppOrOpenFile:{const a=this.withWString(e.path,u=>this.pdfiumModule.EPDFAction_CreateLaunch(t,u));return!!a&&!!this.pdfiumModule.EPDFBookmark_SetAction(t,n,a)}case me.RemoteGoto:case me.Unsupported:default:return!1}}applyLinkTarget(t,n,o){if(o.type==="destination"){const a=this.createLocalDestPtr(t,o.destination);if(!a)return!1;const u=this.pdfiumModule.EPDFAction_CreateGoTo(t,a);return!!u&&!!this.pdfiumModule.EPDFAnnot_SetAction(n,u)}const e=o.action;switch(e.type){case me.Goto:{const a=this.createLocalDestPtr(t,e.destination);if(!a)return!1;const u=this.pdfiumModule.EPDFAction_CreateGoTo(t,a);return!!u&&!!this.pdfiumModule.EPDFAnnot_SetAction(n,u)}case me.URI:{const a=this.pdfiumModule.EPDFAction_CreateURI(t,e.uri);return!!a&&!!this.pdfiumModule.EPDFAnnot_SetAction(n,a)}case me.LaunchAppOrOpenFile:{const a=this.withWString(e.path,u=>this.pdfiumModule.EPDFAction_CreateLaunch(t,u));return!!a&&!!this.pdfiumModule.EPDFAnnot_SetAction(n,a)}case me.RemoteGoto:case me.Unsupported:default:return!1}}readPdfAction(t,n){let o;switch(this.pdfiumModule.FPDFAction_GetType(n)){case me.Unsupported:o={type:me.Unsupported};break;case me.Goto:{const e=this.pdfiumModule.FPDFAction_GetDest(t,n);if(e){const a=this.readPdfDestination(t,e);o={type:me.Goto,destination:a}}else o={type:me.Unsupported}}break;case me.RemoteGoto:o={type:me.Unsupported};break;case me.URI:{const e=Fe(this.pdfiumModule.pdfium,(a,u)=>this.pdfiumModule.FPDFAction_GetURIPath(t,n,a,u),this.pdfiumModule.pdfium.UTF8ToString);o={type:me.URI,uri:e}}break;case me.LaunchAppOrOpenFile:{const e=Fe(this.pdfiumModule.pdfium,(a,u)=>this.pdfiumModule.FPDFAction_GetFilePath(n,a,u),this.pdfiumModule.pdfium.UTF8ToString);o={type:me.LaunchAppOrOpenFile,path:e}}}return o}readPdfDestination(t,n){const o=this.pdfiumModule.FPDFDest_GetDestPageIndex(t,n),e=this.memoryManager.malloc(4),a=this.memoryManager.malloc(16),u=this.pdfiumModule.FPDFDest_GetView(n,e,a),l=this.pdfiumModule.pdfium.getValue(e,"i32"),F=[];for(let P=0;P<l;P++){const _=a+4*P;F.push(this.pdfiumModule.pdfium.getValue(_,"float"))}if(this.memoryManager.free(e),this.memoryManager.free(a),u===Te.XYZ){const P=this.memoryManager.malloc(1),_=this.memoryManager.malloc(1),f=this.memoryManager.malloc(1),p=this.memoryManager.malloc(4),M=this.memoryManager.malloc(4),y=this.memoryManager.malloc(4);if(this.pdfiumModule.FPDFDest_GetLocationInPage(n,P,_,f,p,M,y)){const T=this.pdfiumModule.pdfium.getValue(P,"i8"),C=this.pdfiumModule.pdfium.getValue(_,"i8"),R=this.pdfiumModule.pdfium.getValue(f,"i8"),N=T?this.pdfiumModule.pdfium.getValue(p,"float"):0,V=C?this.pdfiumModule.pdfium.getValue(M,"float"):0,K=R?this.pdfiumModule.pdfium.getValue(y,"float"):0;return this.memoryManager.free(P),this.memoryManager.free(_),this.memoryManager.free(f),this.memoryManager.free(p),this.memoryManager.free(M),this.memoryManager.free(y),{pageIndex:o,zoom:{mode:u,params:{x:N,y:V,zoom:K}},view:F}}return this.memoryManager.free(P),this.memoryManager.free(_),this.memoryManager.free(f),this.memoryManager.free(p),this.memoryManager.free(M),this.memoryManager.free(y),{pageIndex:o,zoom:{mode:u,params:{x:0,y:0,zoom:0}},view:F}}return{pageIndex:o,zoom:{mode:u},view:F}}readPdfAttachment(t,n){const o=this.pdfiumModule.FPDFDoc_GetAttachment(t,n),e=Fe(this.pdfiumModule.pdfium,(P,_)=>this.pdfiumModule.FPDFAttachment_GetName(o,P,_),this.pdfiumModule.pdfium.UTF16ToString),a=Fe(this.pdfiumModule.pdfium,(P,_)=>this.pdfiumModule.EPDFAttachment_GetDescription(o,P,_),this.pdfiumModule.pdfium.UTF16ToString),u=Fe(this.pdfiumModule.pdfium,(P,_)=>this.pdfiumModule.FPDFAttachment_GetSubtype(o,P,_),this.pdfiumModule.pdfium.UTF16ToString),l=this.getAttachmentDate(o,"CreationDate"),F=Fe(this.pdfiumModule.pdfium,(P,_)=>this.pdfiumModule.FPDFAttachment_GetStringValue(o,"Checksum",P,_),this.pdfiumModule.pdfium.UTF16ToString);return{index:n,name:e,description:a,mimeType:u,size:this.getAttachmentNumber(o,"Size"),creationDate:l,checksum:F}}readPageBoxes(t,n,o){const e=f=>{if(this.pdfiumModule.EPDF_GetPageBoxByIndex(t,n,f,o))return{left:this.pdfiumModule.pdfium.getValue(o,"float"),top:this.pdfiumModule.pdfium.getValue(o+4,"float"),right:this.pdfiumModule.pdfium.getValue(o+8,"float"),bottom:this.pdfiumModule.pdfium.getValue(o+12,"float")}},a=e(0),u=e(1);if(!a||!u)return;const l={media:a,crop:u},F=e(2);F&&(l.bleed=F);const P=e(3);P&&(l.trim=P);const _=e(4);return _&&(l.art=_),l}getPageOrigin(t){var n;const o=(n=t.boxes)==null?void 0:n.crop;return o?{x:o.left,y:o.bottom}:{x:0,y:0}}convertDevicePointToPagePoint(t,n,o){const e=n.size.width,a=n.size.height,u=t.normalizedRotation?0:3&n.rotation,l=this.getPageOrigin(n);let F;return F=u===0?{x:o.x,y:a-o.y}:u===1?{x:o.y,y:o.x}:u===2?{x:e-o.x,y:o.y}:{x:a-o.y,y:e-o.x},{x:F.x+l.x,y:F.y+l.y}}convertPagePointToDevicePoint(t,n,o){const e=n.size.width,a=n.size.height,u=t.normalizedRotation?0:3&n.rotation,l=this.getPageOrigin(n),F=o.x-l.x,P=o.y-l.y;return u===0?{x:F,y:a-P}:u===1?{x:P,y:F}:u===2?{x:e-F,y:P}:{x:e-P,y:a-F}}convertPageRectToDeviceRect(t,n,o){const{x:e,y:a}=this.convertPagePointToDevicePoint(t,n,{x:o.left,y:o.top});return{origin:{x:e,y:a},size:{width:Math.abs(o.right-o.left),height:Math.abs(o.top-o.bottom)}}}readPageAnnoAppearanceStreams(t){return{normal:this.readPageAnnoAppearanceStream(t,Ve.Normal),rollover:this.readPageAnnoAppearanceStream(t,Ve.Rollover),down:this.readPageAnnoAppearanceStream(t,Ve.Down)}}readPageAnnoAppearanceStream(t,n=Ve.Normal){const o=2*(this.pdfiumModule.FPDFAnnot_GetAP(t,n,0,0)+1),e=this.memoryManager.malloc(o);this.pdfiumModule.FPDFAnnot_GetAP(t,n,e,o);const a=this.pdfiumModule.pdfium.UTF16ToString(e);return this.memoryManager.free(e),a}setPageAnnoAppearanceStream(t,n=Ve.Normal,o){const e=2*(o.length+1),a=this.memoryManager.malloc(e);try{return this.pdfiumModule.pdfium.stringToUTF16(o,a,e),!!this.pdfiumModule.FPDFAnnot_SetAP(t,n,a)}finally{this.memoryManager.free(a)}}setPageAnnoRect(t,n,o,e){const a=e.origin.x,u=e.origin.y,l=e.origin.x+e.size.width,F=e.origin.y+e.size.height,P=this.convertDevicePointToPagePoint(t,n,{x:a,y:u}),_=this.convertDevicePointToPagePoint(t,n,{x:l,y:u}),f=this.convertDevicePointToPagePoint(t,n,{x:l,y:F}),p=this.convertDevicePointToPagePoint(t,n,{x:a,y:F});let M=Math.min(P.x,_.x,f.x,p.x),y=Math.max(P.x,_.x,f.x,p.x),T=Math.min(P.y,_.y,f.y,p.y),C=Math.max(P.y,_.y,f.y,p.y);M>y&&([M,y]=[y,M]),T>C&&([T,C]=[C,T]);const R=this.memoryManager.malloc(16),N=this.pdfiumModule.pdfium;N.setValue(R+0,M,"float"),N.setValue(R+4,C,"float"),N.setValue(R+8,y,"float"),N.setValue(R+12,T,"float");const V=this.pdfiumModule.FPDFAnnot_SetRect(o,R);return this.memoryManager.free(R),!!V}readPageAnnoRect(t){const n=this.memoryManager.malloc(16),o={left:0,top:0,right:0,bottom:0};return this.pdfiumModule.EPDFAnnot_GetRect(t,n)&&(o.left=this.pdfiumModule.pdfium.getValue(n,"float"),o.top=this.pdfiumModule.pdfium.getValue(n+4,"float"),o.right=this.pdfiumModule.pdfium.getValue(n+8,"float"),o.bottom=this.pdfiumModule.pdfium.getValue(n+12,"float")),this.memoryManager.free(n),o}getHighlightRects(t,n,o,e,a){const u=this.pdfiumModule.FPDFText_CountRects(o,e,a),l=[],F=this.memoryManager.malloc(8),P=this.memoryManager.malloc(8),_=this.memoryManager.malloc(8),f=this.memoryManager.malloc(8);for(let p=0;p<u;p++){if(!this.pdfiumModule.FPDFText_GetRect(o,p,F,P,_,f))continue;const M=this.pdfiumModule.pdfium.getValue(F,"double"),y=this.pdfiumModule.pdfium.getValue(P,"double"),T=this.pdfiumModule.pdfium.getValue(_,"double"),C=this.pdfiumModule.pdfium.getValue(f,"double"),R=this.convertPagePointToDevicePoint(t,n,{x:M,y}),N=this.convertPagePointToDevicePoint(t,n,{x:T,y}),V=this.convertPagePointToDevicePoint(t,n,{x:T,y:C}),K=this.convertPagePointToDevicePoint(t,n,{x:M,y:C}),z=[R.x,N.x,V.x,K.x],q=[R.y,N.y,V.y,K.y],k=Math.min(...z),$=Math.min(...q),ae=Math.max(...z)-k,J=Math.max(...q)-$;l.push({origin:{x:k,y:$},size:{width:Math.ceil(ae),height:Math.ceil(J)}})}return this.memoryManager.free(F),this.memoryManager.free(P),this.memoryManager.free(_),this.memoryManager.free(f),l}searchInPage(t,n,o,e){this.logger.debug(h,D,"searchInPage",t,n,o,e),this.logger.perf(h,D,"SearchInPage","Begin",`${t.id}-${n.index}`);const a=this.cache.getContext(t.id);if(!a)return this.logger.perf(h,D,"PreparePrintDocument","End",t.id),E.reject({code:S.DocNotOpen,message:"Document is not open"});const u=2*(o.length+1),l=this.memoryManager.malloc(u);this.pdfiumModule.pdfium.stringToUTF16(o,l,u);try{const F=this.searchAllInPage(t,a,n,l,e);return E.resolve(F)}finally{this.memoryManager.free(l)}}getAnnotationsBatch(t,n){this.logger.debug(h,D,"getAnnotationsBatch",t.id,n.length);const o=new Ft;return queueMicrotask(()=>{this.logger.perf(h,D,"GetAnnotationsBatch","Begin",t.id);const e=this.cache.getContext(t.id);if(!e)return void o.reject({code:S.DocNotOpen,message:"Document is not open"});const a={},u=n.length,l=this.pdfiumModule.PDFiumExt_OpenFormFillInfo(),F=this.pdfiumModule.PDFiumExt_InitFormFillEnvironment(e.docPtr,l);try{for(let P=0;P<n.length;P++){const _=n[P],f=this.readPageAnnotationsRaw(t,e,_,F);a[_.index]=f,o.progress({pageIndex:_.index,result:f,completed:P+1,total:u})}}finally{this.pdfiumModule.PDFiumExt_ExitFormFillEnvironment(F),this.pdfiumModule.PDFiumExt_CloseFormFillInfo(l)}this.logger.perf(h,D,"GetAnnotationsBatch","End",t.id),o.resolve(a)}),o}searchBatch(t,n,o,e){this.logger.debug(h,D,"searchBatch",t.id,n.length,o);const a=new Ft;return queueMicrotask(()=>{this.logger.perf(h,D,"SearchBatch","Begin",t.id);const u=this.cache.getContext(t.id);if(!u)return void a.reject({code:S.DocNotOpen,message:"Document is not open"});const l=2*(o.length+1),F=this.memoryManager.malloc(l);this.pdfiumModule.pdfium.stringToUTF16(o,F,l);try{const P={},_=n.length;for(let f=0;f<n.length;f++){const p=n[f],M=this.searchAllInPage(t,u,p,F,e);P[p.index]=M,a.progress({pageIndex:p.index,result:M,completed:f+1,total:_})}this.logger.perf(h,D,"SearchBatch","End",t.id),a.resolve(P)}finally{this.memoryManager.free(F)}}),a}buildContext(t,n,o,e=30){const a=/[\s\u00A0.,;:!?()\[\]{}<>/\\\-"'`"â\u2013\u2014]/;let u=n;for(;u>0&&a.test(t[u-1]);)u--;let l=0;for(;u>0&&l<e;)u--,a.test(t[u])||l++;u=(p=>{for(;p>0&&!a.test(t[p-1]);)p--;return p})(u);let F=n+o;for(;F<t.length&&a.test(t[F]);)F++;for(l=0;F<t.length&&l<e;)a.test(t[F])||l++,F++;F=(p=>{for(;p<t.length&&!a.test(t[p]);)p++;return p})(F);const P=t.slice(u,n).replace(/\s+/g," ").trimStart(),_=t.slice(n,n+o),f=t.slice(n+o,F).replace(/\s+/g," ").trimEnd();return{before:this.tidy(P),match:this.tidy(_),after:this.tidy(f),truncatedLeft:u>0,truncatedRight:F<t.length}}tidy(t){return t.replace(/-\uFFFE\s*/g,"").replace(/[\uFFFE\u00AD\u200B\u2060\uFEFF]/g,"").replace(/\s+/g," ")}searchAllInPage(t,n,o,e,a){return n.borrowPage(o.index,u=>{const l=u.getTextPage(),F=this.pdfiumModule.FPDFText_CountChars(l),P=this.memoryManager.malloc(2*(F+1));this.pdfiumModule.FPDFText_GetText(l,0,F,P);const _=this.pdfiumModule.pdfium.UTF16ToString(P);this.memoryManager.free(P);const f=[],p=this.pdfiumModule.FPDFText_FindStart(l,e,a,0);for(;this.pdfiumModule.FPDFText_FindNext(p);){const M=this.pdfiumModule.FPDFText_GetSchResultIndex(p),y=this.pdfiumModule.FPDFText_GetSchCount(p),T=this.getHighlightRects(t,o,l,M,y),C=this.buildContext(_,M,y);f.push({pageIndex:o.index,charIndex:M,charCount:y,rects:T,context:C})}return this.pdfiumModule.FPDFText_FindClose(p),f})}preparePrintDocument(t,n){const{includeAnnotations:o=!0,pageRange:e=null}=n??{};this.logger.debug(h,D,"preparePrintDocument",t,n),this.logger.perf(h,D,"PreparePrintDocument","Begin",t.id);const a=this.cache.getContext(t.id);if(!a)return this.logger.perf(h,D,"PreparePrintDocument","End",t.id),E.reject({code:S.DocNotOpen,message:"Document is not open"});const u=this.pdfiumModule.FPDF_CreateNewDocument();if(!u)return this.logger.perf(h,D,"PreparePrintDocument","End",t.id),E.reject({code:S.CantCreateNewDoc,message:"Cannot create print document"});try{const l=this.sanitizePageRange(e,t.pageCount);if(!this.pdfiumModule.FPDF_ImportPages(u,a.docPtr,l??"",0))return this.pdfiumModule.FPDF_CloseDocument(u),this.logger.error(h,D,"Failed to import pages for printing"),this.logger.perf(h,D,"PreparePrintDocument","End",t.id),E.reject({code:S.CantImportPages,message:"Failed to import pages for printing"});if(!o){const P=this.removeAnnotationsFromPrintDocument(u);if(!P.success)return this.pdfiumModule.FPDF_CloseDocument(u),this.logger.error(h,D,`Failed to remove annotations: ${P.error}`),this.logger.perf(h,D,"PreparePrintDocument","End",t.id),E.reject({code:S.Unknown,message:`Failed to prepare print document: ${P.error}`});this.logger.debug(h,D,`Removed ${P.annotationsRemoved} annotations from ${P.pagesProcessed} pages`)}const F=this.saveDocument(u);return this.pdfiumModule.FPDF_CloseDocument(u),this.logger.perf(h,D,"PreparePrintDocument","End",t.id),E.resolve(F)}catch(l){return u&&this.pdfiumModule.FPDF_CloseDocument(u),this.logger.error(h,D,"preparePrintDocument failed",l),this.logger.perf(h,D,"PreparePrintDocument","End",t.id),E.reject({code:S.Unknown,message:l instanceof Error?l.message:"Failed to prepare print document"})}}removeAnnotationsFromPrintDocument(t){let n=0,o=0;try{const e=this.pdfiumModule.FPDF_GetPageCount(t);for(let a=0;a<e;a++){const u=this.pdfiumModule.EPDFPage_GetAnnotCountRaw(t,a);if(u<=0){o++;continue}let l=0;for(let F=u-1;F>=0;F--)this.pdfiumModule.EPDFPage_RemoveAnnotRaw(t,a,F)?(l++,n++):this.logger.warn(h,D,`Failed to remove annotation ${F} from page ${a}`);if(l>0){const F=this.pdfiumModule.FPDF_LoadPage(t,a);F&&(this.pdfiumModule.FPDFPage_GenerateContent(F),this.pdfiumModule.FPDF_ClosePage(F))}o++}return{success:!0,annotationsRemoved:n,pagesProcessed:o}}catch(e){return{success:!1,annotationsRemoved:n,pagesProcessed:o,error:e instanceof Error?e.message:"Unknown error during annotation removal"}}}sanitizePageRange(t,n){if(!t||t.trim()==="")return null;try{const o=[],e=t.split(",");for(const P of e){const _=P.trim();if(_.includes("-")){const[f,p]=_.split("-").map(R=>R.trim()),M=parseInt(f,10),y=parseInt(p,10);if(isNaN(M)||isNaN(y)){this.logger.warn(h,D,`Invalid range: ${_}`);continue}const T=Math.max(1,Math.min(M,n)),C=Math.max(1,Math.min(y,n));for(let R=T;R<=C;R++)o.includes(R)||o.push(R)}else{const f=parseInt(_,10);if(isNaN(f)){this.logger.warn(h,D,`Invalid page number: ${_}`);continue}const p=Math.max(1,Math.min(f,n));o.includes(p)||o.push(p)}}if(o.length===0)return this.logger.warn(h,D,"No valid pages in range, using all pages"),null;o.sort((P,_)=>P-_);const a=[];let u=o[0],l=o[0];for(let P=1;P<o.length;P++)o[P]===l+1||(u===l?a.push(u.toString()):l-u===1?(a.push(u.toString()),a.push(l.toString())):a.push(`${u}-${l}`),u=o[P]),l=o[P];u===l?a.push(u.toString()):l-u===1?(a.push(u.toString()),a.push(l.toString())):a.push(`${u}-${l}`);const F=a.join(",");return this.logger.debug(h,D,`Sanitized page range: "${t}" -> "${F}"`),F}catch(o){return this.logger.error(h,D,`Error sanitizing page range: ${o}`),null}}}async function eo(Y,t){const n=await fetch(Y),o=await n.arrayBuffer(),e=await Ln({wasmBinary:o}),a=new Jn(e,{logger:t?.logger,fontFallback:t?.fontFallback});return new In(a,{imageConverter:Bn,logger:t?.logger})}export{eo as createPdfiumEngine};
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.