etiquetas.js 1.0.0-alpha.10 → 1.0.0-alpha.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -87,8 +87,9 @@ var __asyncGenerator = (__this, __arguments, generator) => {
87
87
  return generator = generator.apply(__this, __arguments), it2[__knownSymbol("asyncIterator")] = () => it2, method("next"), method("throw"), method("return"), it2;
88
88
  };
89
89
  var __forAwait = (obj, it2, method) => (it2 = obj[__knownSymbol("asyncIterator")]) ? it2.call(obj) : (obj = obj[__knownSymbol("iterator")](), it2 = {}, method = (key, fn) => (fn = obj[key]) && (it2[key] = (arg) => new Promise((yes, no, done) => (arg = fn.call(obj, arg), done = arg.done, Promise.resolve(arg.value).then((value) => yes({ value, done }), no)))), method("next"), method("return"), it2);
90
- var _Util_static, getExtremumOnCurve_fn, getExtremum_fn, _regex, _toolbar, _colorPicker, _editor, _buttons, _altText, _comment, _signatureDescriptionButton, _l10nRemove, _EditorToolbar_static, pointerDown_fn, _EditorToolbar_instances, focusIn_fn, focusOut_fn, addListenersToElement_fn, divider_get, _buttons2, _toolbar2, _uiManager, _HighlightToolbar_instances, render_fn, getLastPoint_fn, addHighlightButton_fn, _id, _baseId, _id2, _cache, _ImageManager_instances, get_fn, _commands, _locked, _maxSize, _position, _KeyboardManager_instances, serialize_fn, _abortController, _activeEditor, _allEditors, _allLayers, _altTextManager, _annotationStorage, _changedExistingAnnotations, _commandManager, _commentManager, _copyPasteAC, _currentDrawingSession, _currentPageIndex, _deletedAnnotationsElementIds, _draggingEditors, _editorTypes, _editorsToRescale, _enableHighlightFloatingButton, _enableUpdatedAddImage, _enableNewAltTextWhenAddingImage, _filterFactory, _focusMainContainerTimeoutId, _focusManagerAC, _highlightColors, _highlightWhenShiftUp, _highlightToolbar, _idManager, _isEnabled, _isWaiting, _keyboardManagerAC, _lastActiveElement, _mainHighlightColorPicker, _missingCanvases, _mlManager, _mode, _selectedEditors, _selectedTextNode, _signatureManager, _pageColors, _showAllStates, _previousStates, _translation, _translationTimeoutId, _container, _viewer, _viewerAlert, _updateModeCapability, _AnnotationEditorUIManager_instances, getAnchorElementForSelection_fn, getLayerForTextLayer_fn, displayHighlightToolbar_fn, selectionChange_fn, onSelectEnd_fn, addSelectionListener_fn, addFocusManager_fn, removeFocusManager_fn, addKeyboardManager_fn, removeKeyboardManager_fn, addCopyPasteListeners_fn, removeCopyPasteListeners_fn, addDragAndDropListeners_fn, dispatchUpdateStates_fn, dispatchUpdateUI_fn, enableAll_fn, disableAll_fn, addEditorToLayer_fn, lastSelectedEditor_get, isEmpty_fn, selectEditors_fn, _altText2, _altTextDecorative, _altTextButton, _altTextButtonLabel, _altTextTooltip, _altTextTooltipTimeout, _altTextWasFromKeyBoard, _badge, _editor2, _guessedText, _textWithDisclaimer, _useNewAltTextFlow, _l10nNewButton, _AltText_instances, label_get, setState_fn, _commentButton, _commentWasFromKeyBoard, _editor3, _initialText, _text, _date, _deleted, _container2, _isPinching, _isPinchingStopped, _isPinchingDisabled, _onPinchStart, _onPinching, _onPinchEnd, _pointerDownAC, _signal, _touchInfo, _touchManagerAC, _touchMoveAC, _TouchManager_instances, onTouchStart_fn, onTouchMove_fn, onTouchEnd_fn, _accessibilityData, _allResizerDivs, _altText3, _comment2, _disabled, _dragPointerId, _dragPointerType, _keepAspectRatio, _resizersDiv, _lastPointerCoords, _savedDimensions, _focusAC, _focusedResizerName, _hasBeenClicked, _initialRect, _isEditing, _isInEditMode, _isResizerEnabledForKeyboard, _moveInDOMTimeout, _prevDragX, _prevDragY, _telemetryTimeouts, _touchManager, _isDraggable, _zIndex, _AnnotationEditor_instances, translate_fn, _AnnotationEditor_static, rotatePoint_fn, getRotationMatrix_fn, createResizers_fn, resizerPointerdown_fn, resize_fn, addResizeToUndoStack_fn, resizerPointermove_fn, touchPinchStartCallback_fn, touchPinchCallback_fn, touchPinchEndCallback_fn, selectOnPointerEvent_fn, setUpDragSession_fn, addFocusListeners_fn, resizerKeydown_fn, resizerBlur_fn, resizerFocus_fn, setResizerTabIndex_fn, stopResizing_fn, _modified, _modifiedIds, _storage, _AnnotationStorage_instances, setModified_fn, _serializable, _systemFonts, _listeners, _deferred, _messageAC, _MessageHandler_instances, onMessage_fn, createStreamSink_fn, processStreamMessage_fn, deleteStreamController_fn, _enableHWA, _baseUrl, __cache, __defs, _docId, _document, __hcmCache, _id3, _DOMFilterFactory_instances, cache_get, hcmCache_get, defs_get, createTables_fn, createUrl_fn, addLuminosityConversion_fn, addGrayConversion_fn, createFilter_fn, appendFeFunc_fn, addTransferMapConversion_fn, addTransferMapAlphaConversion_fn, getRGB_fn, _CanvasGraphics_instances, restoreInitialState_fn, drawFilter_fn, getScaledPath_fn, _port, _src, _map, _data, _isDisplay, _isPrint, _userSet, _visible, _cachedGetHash, _groups, _initialHash, _order, _OptionalContentConfig_instances, evaluateVisibilityExpression_fn, _objs, _PDFObjects_instances, ensureObj_fn, _g, _capability, _container3, _disableProcessItems, _fontInspectorEnabled, _lang, _layoutTextParams, _pageHeight, _pageWidth, _reader, _rootContainer, _rotation, _scale, _styleCache, _textContentItemsStr, _textContentSource, _textDivs, _textDivProperties, _transform, _ascentCache, _canvasContexts, _canvasCtxFonts, _minFontSize, _pendingTextLayers, _TextLayer_instances, processItems_fn, appendText_fn, layout_fn, _TextLayer_static, getCtx_fn, ensureCtxFont_fn, ensureMinFontSizeComputed_fn, getAscent_fn, _docId2, _capability2, _progressiveDoneListeners, _progressiveReadListeners, _progressListeners, _rangeListeners, _pendingCleanup, _PDFPageProxy_instances, tryCleanup_fn, _capability3, _messageHandler, _port2, _webWorker, _fakeWorkerId, _isWorkerDisabled, _workerPorts, _PDFWorker_instances, resolve_fn, initializeFromPort_fn, initialize_fn, setupFakeWorker_fn, _PDFWorker_static, mainThreadWorkerMessageHandler_get, _methodPromises, _pageCache, _pagePromises, _pageRefCache, _passwordCapability, _WorkerTransport_instances, cacheSimpleMethod_fn, _internalRenderTask, _rAF, _canvasInUse, _button, _buttonSwatch, _defaultColor, _dropdown, _dropdownWasFromKeyboard, _isMainColorPicker, _editor4, _eventBus, _openDropdownAC, _uiManager2, _l10nColor, _ColorPicker_instances, getDropdownRoot_fn, colorSelect_fn, keyDown_fn, openDropdown_fn, pointerDown_fn2, isDropdownVisible_get, _input, _editor5, _uiManager3, _l10nColor2, _updates, _hasBorder, _popupElement, _AnnotationElement_instances, setRectEdited_fn, _LinkAnnotationElement_instances, setInternalLink_fn, bindAttachment_fn, bindSetOCGState_fn, _boundKeyDown, _boundHide, _boundShow, _boundToggle, _color, _container4, _contentsObj, _dateObj, _elements, _parent, _parentRect, _pinned, _popup, _popupAbortController, _position2, _rect, _richText, _titleObj, _updates2, _wasVisible, _PopupElement_instances, addEventListeners_fn, html_get, fontSize_get, fontColor_get, makePopupContent_fn, keyDown_fn2, setPosition_fn, toggle_fn, show_fn, hide_fn, _line, _square, _circle, _polyline, _polylinesGroupElement, _polylines, _InkAnnotationElement_instances, getTransform_fn, _trigger, _FileAttachmentAnnotationElement_instances, download_fn, _accessibilityManager, _annotationCanvasMap, _editableAnnotations, _structTreeLayer, _AnnotationLayer_instances, appendElement_fn, setAnnotationCanvasMap_fn, _color2, _content, _editorDivId, _editModeAC, _fontSize, _FreeTextEditor_instances, updateFontSize_fn, updateColor_fn, extractText_fn, setEditorDimensions_fn, _FreeTextEditor_static, getNodeContent_fn, setContent_fn, serializeContent_fn, deserializeContent_fn, hasElementChanged_fn, _box, _bottom, _innerMargin, _isLTR, _top, _last, _lastX, _lastY, _min, _min_dist, _scaleFactor, _thickness, _points, _MIN_DIST, _MIN_DIFF, _MIN, _FreeDrawOutliner_instances, getLastCoords_fn, toSVGPathTwoPoints_fn, toSVGPathStart_fn, toSVGPathEnd_fn, getOutlineTwoPoints_fn, getOutlineStart_fn, getOutlineEnd_fn, _box2, _bbox, _innerMargin2, _isLTR2, _points2, _scaleFactor2, _outline, _FreeDrawOutline_instances, computeMinMax_fn, _box3, _lastPoint, _verticalEdges, _intervals, _HighlightOutliner_instances, getOutlines_fn, binarySearch_fn, insert_fn, remove_fn, breakEdge_fn, _box4, _outlines, _anchorNode, _anchorOffset, _boxes, _clipPathId, _colorPicker2, _focusOutlines, _focusNode, _focusOffset, _highlightDiv, _highlightOutlines, _id4, _isFreeHighlight, _lastPoint2, _opacity, _outlineId, _text2, _thickness2, _methodOfCreation, _HighlightEditor_instances, createOutlines_fn, createFreeOutlines_fn, updateColor_fn2, updateThickness_fn, changeThickness_fn, cleanDrawLayer_fn, addToDrawLayer_fn, _HighlightEditor_static, rotateBbox_fn, keydown_fn, setCaret_fn, getRotation_fn, serializeBoxes_fn, serializeOutlines_fn, highlightMove_fn, endHighlight_fn, hasElementChanged_fn2, _svgProperties, _drawOutlines, _mustBeCommitted, _currentDraw, _currentDrawingAC, _currentDrawingOptions, _currentPointerId, _currentPointerType, _currentPointerIds, _currentMoveTimestamp, _DrawingEditor_instances, createDrawOutlines_fn, createDrawing_fn, cleanDrawLayer_fn2, addToDrawLayer_fn2, convertToParentSpace_fn, convertToDrawSpace_fn, updateBbox_fn, rotateBox_fn, _last2, _line2, _lines, _rotation2, _thickness3, _points3, _lastSVGPath, _lastIndex, _outlines2, _parentWidth, _parentHeight, _InkDrawOutliner_instances, normalizePoint_fn, _bbox2, _currentRotation, _innerMargin3, _lines2, _parentWidth2, _parentHeight2, _parentScale, _rotation3, _thickness4, _InkDrawOutline_instances, getMarginComponents_fn, getBBoxWithNoMargin_fn, computeBbox_fn, updateThickness_fn2, _InkEditor_instances, hasElementChanged_fn3, _PARAMETERS, _SignatureExtractor_static, neighborIndexToId_fn, _neighborIdToIndex, clockwiseNonZero_fn, counterClockwiseNonZero_fn, findContours_fn, douglasPeuckerHelper_fn, douglasPeucker_fn, bilateralFilter_fn, getHistogram_fn, toUint8_fn, guessThreshold_fn, getGrayPixels_fn, _isExtracted, _description, _signatureData, _signatureUUID, _bitmap, _bitmapId, _bitmapPromise, _bitmapUrl, _bitmapFile, _bitmapFileName, _canvas3, _missingCanvas, _resizeTimeoutId, _isSvg, _hasBeenAddedInUndoStack, _StampEditor_instances, getBitmapFetched_fn, getBitmapDone_fn, getBitmap_fn, createCanvas_fn, scaleBitmap_fn, drawBitmap_fn, serializeBitmap_fn, hasElementChanged_fn4, _accessibilityManager2, _allowClick, _annotationLayer, _clickAC, _editorFocusTimeoutId, _editors, _hadPointerDown, _isDisabling, _isEnabling, _drawingAC, _focusedElement, _textLayer, _textSelectionAC, _textLayerDblClickAC, _lastPointerDownTimestamp, _uiManager4, _editorTypes2, _AnnotationEditorLayer_instances, textLayerPointerDown_fn, currentEditorType_get, createNewEditor_fn, getCenterPoint_fn, cleanup_fn, _parent2, _mapping, _toUpdate, _id5, _DrawLayer_static, setBox_fn, _DrawLayer_instances, createSVG_fn, createClipPath_fn, updateProperties_fn;
90
+ var _Util_static, getExtremumOnCurve_fn, getExtremum_fn, _regex, _toolbar, _colorPicker, _editor, _buttons, _altText, _comment, _signatureDescriptionButton, _l10nRemove, _EditorToolbar_static, pointerDown_fn, _EditorToolbar_instances, focusIn_fn, focusOut_fn, addListenersToElement_fn, divider_get, _buttons2, _toolbar2, _uiManager, _FloatingToolbar_instances, render_fn, getLastPoint_fn, makeButton_fn, _id, _baseId, _id2, _cache, _ImageManager_instances, get_fn, _commands, _locked, _maxSize, _position, _KeyboardManager_instances, serialize_fn, _abortController, _activeEditor, _allEditableAnnotations, _allEditors, _allLayers, _altTextManager, _annotationStorage, _changedExistingAnnotations, _commandManager, _commentManager, _copyPasteAC, _currentDrawingSession, _currentPageIndex, _deletedAnnotationsElementIds, _draggingEditors, _editorTypes, _editorsToRescale, _enableHighlightFloatingButton, _enableUpdatedAddImage, _enableNewAltTextWhenAddingImage, _filterFactory, _focusMainContainerTimeoutId, _focusManagerAC, _highlightColors, _highlightWhenShiftUp, _floatingToolbar, _idManager, _isEnabled, _isPointerDown, _isWaiting, _keyboardManagerAC, _lastActiveElement, _mainHighlightColorPicker, _missingCanvases, _mlManager, _mode, _selectedEditors, _selectedTextNode, _signatureManager, _pageColors, _showAllStates, _pdfDocument, _previousStates, _translation, _translationTimeoutId, _container, _viewer, _viewerAlert, _updateModeCapability, _AnnotationEditorUIManager_instances, getAnchorElementForSelection_fn, getLayerForTextLayer_fn, displayFloatingToolbar_fn, selectionChange_fn, onSelectEnd_fn, addSelectionListener_fn, addFocusManager_fn, removeFocusManager_fn, addKeyboardManager_fn, removeKeyboardManager_fn, addCopyPasteListeners_fn, removeCopyPasteListeners_fn, addDragAndDropListeners_fn, dispatchUpdateStates_fn, dispatchUpdateUI_fn, enableAll_fn, disableAll_fn, addEditorToLayer_fn, lastSelectedEditor_get, isEmpty_fn, selectEditors_fn, _altText2, _altTextDecorative, _altTextButton, _altTextButtonLabel, _altTextTooltip, _altTextTooltipTimeout, _altTextWasFromKeyBoard, _badge, _editor2, _guessedText, _textWithDisclaimer, _useNewAltTextFlow, _l10nNewButton, _AltText_instances, label_get, setState_fn, _commentButton, _commentWasFromKeyBoard, _editor3, _initialText, _text, _date, _deleted, _container2, _isPinching, _isPinchingStopped, _isPinchingDisabled, _onPinchStart, _onPinching, _onPinchEnd, _pointerDownAC, _signal, _touchInfo, _touchManagerAC, _touchMoveAC, _TouchManager_instances, onTouchStart_fn, onTouchMove_fn, onTouchEnd_fn, _accessibilityData, _allResizerDivs, _altText3, _comment2, _disabled, _dragPointerId, _dragPointerType, _keepAspectRatio, _resizersDiv, _lastPointerCoords, _savedDimensions, _focusAC, _focusedResizerName, _hasBeenClicked, _initialRect, _isEditing, _isInEditMode, _isResizerEnabledForKeyboard, _moveInDOMTimeout, _prevDragX, _prevDragY, _telemetryTimeouts, _touchManager, _isDraggable, _zIndex, _AnnotationEditor_instances, translate_fn, _AnnotationEditor_static, rotatePoint_fn, getRotationMatrix_fn, createResizers_fn, resizerPointerdown_fn, resize_fn, addResizeToUndoStack_fn, resizerPointermove_fn, touchPinchStartCallback_fn, touchPinchCallback_fn, touchPinchEndCallback_fn, selectOnPointerEvent_fn, setUpDragSession_fn, addFocusListeners_fn, resizerKeydown_fn, resizerBlur_fn, resizerFocus_fn, setResizerTabIndex_fn, stopResizing_fn, _modified, _modifiedIds, _storage, _AnnotationStorage_instances, setModified_fn, _serializable, _systemFonts, _listeners, _deferred, _messageAC, _MessageHandler_instances, onMessage_fn, createStreamSink_fn, processStreamMessage_fn, deleteStreamController_fn, _enableHWA, _baseUrl, __cache, __defs, _docId, _document, __hcmCache, _id3, _DOMFilterFactory_instances, cache_get, hcmCache_get, defs_get, createTables_fn, createUrl_fn, addLuminosityConversion_fn, addGrayConversion_fn, createFilter_fn, appendFeFunc_fn, addTransferMapConversion_fn, addTransferMapAlphaConversion_fn, getRGB_fn, _simple, _incremental, _namedDependencies, _savesStack, _markedContentStack, _baseTransformStack, _clipBox, _pendingBBox, _pendingBBoxIdx, _pendingDependencies, _operations, _fontBBoxTrustworthy, _canvasWidth, _canvasHeight, _dependencyTracker, _opIdx, _nestingLevel, _outerDependencies, _savesLevel, _CanvasGraphics_instances, restoreInitialState_fn, drawFilter_fn, getScaledPath_fn, _port, _src, _map, _data, _isDisplay, _isPrint, _userSet, _visible, _cachedGetHash, _groups, _initialHash, _order, _OptionalContentConfig_instances, evaluateVisibilityExpression_fn, _objs, _PDFObjects_instances, ensureObj_fn, _g, _capability, _container3, _disableProcessItems, _fontInspectorEnabled, _lang, _layoutTextParams, _pageHeight, _pageWidth, _reader, _rootContainer, _rotation, _scale, _styleCache, _textContentItemsStr, _textContentSource, _textDivs, _textDivProperties, _transform, _ascentCache, _canvasContexts, _canvasCtxFonts, _minFontSize, _pendingTextLayers, _TextLayer_instances, processItems_fn, appendText_fn, layout_fn, _TextLayer_static, getCtx_fn, ensureCtxFont_fn, ensureMinFontSizeComputed_fn, getAscent_fn, _docId2, _capability2, _progressiveDoneListeners, _progressiveReadListeners, _progressListeners, _rangeListeners, _pendingCleanup, _PDFPageProxy_instances, tryCleanup_fn, _capability3, _messageHandler, _port2, _webWorker, _fakeWorkerId, _isWorkerDisabled, _workerPorts, _PDFWorker_instances, resolve_fn, initializeFromPort_fn, initialize_fn, setupFakeWorker_fn, _PDFWorker_static, mainThreadWorkerMessageHandler_get, _methodPromises, _pageCache, _pagePromises, _pageRefCache, _passwordCapability, _WorkerTransport_instances, cacheSimpleMethod_fn, _internalRenderTask, _rAF, _canvasInUse, _button, _buttonSwatch, _defaultColor, _dropdown, _dropdownWasFromKeyboard, _isMainColorPicker, _editor4, _eventBus, _openDropdownAC, _uiManager2, _l10nColor, _ColorPicker_instances, getDropdownRoot_fn, colorSelect_fn, keyDown_fn, openDropdown_fn, pointerDown_fn2, isDropdownVisible_get, _input, _editor5, _uiManager3, _l10nColor2, _updates, _hasBorder, _popupElement, _AnnotationElement_instances, changeLightness_fn, setRectEdited_fn, _LinkAnnotationElement_instances, setInternalLink_fn, bindAttachment_fn, bindSetOCGState_fn, _boundKeyDown, _boundHide, _boundShow, _boundToggle, _color, _container4, _contentsObj, _dateObj, _elements, _eventBus2, _parent, _parentRect, _pinned, _popup, _popupAbortController, _position2, _commentButton2, _commentButtonPosition, _commentButtonColor, _rect, _richText, _titleObj, _updates2, _wasVisible, _PopupElement_instances, addEventListeners_fn, setCommentButtonPosition_fn, renderCommentButton_fn, html_get, fontSize_get, fontColor_get, makePopupContent_fn, keyDown_fn2, setPosition_fn, toggle_fn, show_fn, hide_fn, _line, _square, _circle, _polyline, _polylinesGroupElement, _polylines, _InkAnnotationElement_instances, getTransform_fn, _trigger, _FileAttachmentAnnotationElement_instances, download_fn, _accessibilityManager, _annotationCanvasMap, _editableAnnotations, _structTreeLayer, _AnnotationLayer_instances, appendElement_fn, setAnnotationCanvasMap_fn, _color2, _content, _editorDivId, _editModeAC, _fontSize, _FreeTextEditor_instances, updateFontSize_fn, updateColor_fn, extractText_fn, setEditorDimensions_fn, _FreeTextEditor_static, getNodeContent_fn, setContent_fn, serializeContent_fn, deserializeContent_fn, hasElementChanged_fn, _box, _bottom, _innerMargin, _isLTR, _top, _last, _lastX, _lastY, _min, _min_dist, _scaleFactor, _thickness, _points, _MIN_DIST, _MIN_DIFF, _MIN, _FreeDrawOutliner_instances, getLastCoords_fn, toSVGPathTwoPoints_fn, toSVGPathStart_fn, toSVGPathEnd_fn, getOutlineTwoPoints_fn, getOutlineStart_fn, getOutlineEnd_fn, _box2, _bbox, _innerMargin2, _isLTR2, _points2, _scaleFactor2, _outline, _FreeDrawOutline_instances, computeMinMax_fn, _box3, _lastPoint, _verticalEdges, _intervals, _HighlightOutliner_instances, getOutlines_fn, binarySearch_fn, insert_fn, remove_fn, breakEdge_fn, _box4, _outlines, _anchorNode, _anchorOffset, _boxes, _clipPathId, _colorPicker2, _focusOutlines, _focusNode, _focusOffset, _highlightDiv, _highlightOutlines, _id4, _isFreeHighlight, _lastPoint2, _opacity, _outlineId, _text2, _thickness2, _methodOfCreation, _HighlightEditor_instances, createOutlines_fn, createFreeOutlines_fn, updateColor_fn2, updateThickness_fn, changeThickness_fn, cleanDrawLayer_fn, addToDrawLayer_fn, _HighlightEditor_static, rotateBbox_fn, keydown_fn, setCaret_fn, getRotation_fn, serializeBoxes_fn, serializeOutlines_fn, highlightMove_fn, endHighlight_fn, hasElementChanged_fn2, _svgProperties, _drawOutlines, _mustBeCommitted, _currentDraw, _currentDrawingAC, _currentDrawingOptions, _currentPointerId, _currentPointerType, _currentPointerIds, _currentMoveTimestamp, _DrawingEditor_instances, createDrawOutlines_fn, createDrawing_fn, cleanDrawLayer_fn2, addToDrawLayer_fn2, convertToParentSpace_fn, convertToDrawSpace_fn, updateBbox_fn, rotateBox_fn, _last2, _line2, _lines, _rotation2, _thickness3, _points3, _lastSVGPath, _lastIndex, _outlines2, _parentWidth, _parentHeight, _InkDrawOutliner_instances, normalizePoint_fn, _bbox2, _currentRotation, _innerMargin3, _lines2, _parentWidth2, _parentHeight2, _parentScale, _rotation3, _thickness4, _InkDrawOutline_instances, getMarginComponents_fn, getBBoxWithNoMargin_fn, computeBbox_fn, updateThickness_fn2, _InkEditor_instances, hasElementChanged_fn3, _PARAMETERS, _SignatureExtractor_static, neighborIndexToId_fn, _neighborIdToIndex, clockwiseNonZero_fn, counterClockwiseNonZero_fn, findContours_fn, douglasPeuckerHelper_fn, douglasPeucker_fn, bilateralFilter_fn, getHistogram_fn, toUint8_fn, guessThreshold_fn, getGrayPixels_fn, _isExtracted, _description, _signatureData, _signatureUUID, _bitmap, _bitmapId, _bitmapPromise, _bitmapUrl, _bitmapFile, _bitmapFileName, _canvas3, _missingCanvas, _resizeTimeoutId, _isSvg, _hasBeenAddedInUndoStack, _StampEditor_instances, getBitmapFetched_fn, getBitmapDone_fn, getBitmap_fn, createCanvas_fn, scaleBitmap_fn, drawBitmap_fn, serializeBitmap_fn, hasElementChanged_fn4, _accessibilityManager2, _allowClick, _annotationLayer, _clickAC, _editorFocusTimeoutId, _editors, _hadPointerDown, _isDisabling, _isEnabling, _drawingAC, _focusedElement, _textLayer, _textSelectionAC, _textLayerDblClickAC, _lastPointerDownTimestamp, _uiManager4, _editorTypes2, _AnnotationEditorLayer_instances, textLayerPointerDown_fn, currentEditorType_get, createNewEditor_fn, getCenterPoint_fn, cleanup_fn, _parent2, _mapping, _toUpdate, _id5, _DrawLayer_static, setBox_fn, _DrawLayer_instances, createSVG_fn, createClipPath_fn, updateProperties_fn;
91
91
  import axios from "axios";
92
+ import require$$0 from "react";
92
93
  const API_BASE_URL = "https://db33.dev.dinabox.net/api";
93
94
  const apiClient = axios.create({
94
95
  baseURL: API_BASE_URL,
@@ -11529,7 +11530,7 @@ function(t2) {
11529
11530
  */
11530
11531
  function(t2) {
11531
11532
  function e2() {
11532
- return (n.canvg ? Promise.resolve(n.canvg) : import("./index.es-BNBDSL51.js")).catch(function(t3) {
11533
+ return (n.canvg ? Promise.resolve(n.canvg) : import("./index.es-eEPQXFRd.js")).catch(function(t3) {
11533
11534
  return Promise.reject(new Error("Could not load canvg: " + t3));
11534
11535
  }).then(function(t3) {
11535
11536
  return t3.default ? t3.default : t3;
@@ -12991,7 +12992,7 @@ lodash.exports;
12991
12992
  var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto = Object2.prototype;
12992
12993
  var coreJsData = context["__core-js_shared__"];
12993
12994
  var funcToString = funcProto.toString;
12994
- var hasOwnProperty2 = objectProto.hasOwnProperty;
12995
+ var hasOwnProperty = objectProto.hasOwnProperty;
12995
12996
  var idCounter = 0;
12996
12997
  var maskSrcKey = function() {
12997
12998
  var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
@@ -13001,7 +13002,7 @@ lodash.exports;
13001
13002
  var objectCtorString = funcToString.call(Object2);
13002
13003
  var oldDash = root._;
13003
13004
  var reIsNative = RegExp2(
13004
- "^" + funcToString.call(hasOwnProperty2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
13005
+ "^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
13005
13006
  );
13006
13007
  var Buffer2 = moduleExports ? context.Buffer : undefined$1, Symbol2 = context.Symbol, Uint8Array2 = context.Uint8Array, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : undefined$1, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : undefined$1, symIterator = Symbol2 ? Symbol2.iterator : undefined$1, symToStringTag = Symbol2 ? Symbol2.toStringTag : undefined$1;
13007
13008
  var defineProperty = function() {
@@ -13024,7 +13025,7 @@ lodash.exports;
13024
13025
  if (value instanceof LodashWrapper) {
13025
13026
  return value;
13026
13027
  }
13027
- if (hasOwnProperty2.call(value, "__wrapped__")) {
13028
+ if (hasOwnProperty.call(value, "__wrapped__")) {
13028
13029
  return wrapperClone(value);
13029
13030
  }
13030
13031
  }
@@ -13185,11 +13186,11 @@ lodash.exports;
13185
13186
  var result2 = data[key];
13186
13187
  return result2 === HASH_UNDEFINED ? undefined$1 : result2;
13187
13188
  }
13188
- return hasOwnProperty2.call(data, key) ? data[key] : undefined$1;
13189
+ return hasOwnProperty.call(data, key) ? data[key] : undefined$1;
13189
13190
  }
13190
13191
  function hashHas(key) {
13191
13192
  var data = this.__data__;
13192
- return nativeCreate ? data[key] !== undefined$1 : hasOwnProperty2.call(data, key);
13193
+ return nativeCreate ? data[key] !== undefined$1 : hasOwnProperty.call(data, key);
13193
13194
  }
13194
13195
  function hashSet(key, value) {
13195
13196
  var data = this.__data__;
@@ -13346,7 +13347,7 @@ lodash.exports;
13346
13347
  function arrayLikeKeys(value, inherited) {
13347
13348
  var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result2 = skipIndexes ? baseTimes(value.length, String2) : [], length = result2.length;
13348
13349
  for (var key in value) {
13349
- if ((inherited || hasOwnProperty2.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
13350
+ if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
13350
13351
  (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
13351
13352
  isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
13352
13353
  isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
@@ -13373,7 +13374,7 @@ lodash.exports;
13373
13374
  }
13374
13375
  function assignValue(object2, key, value) {
13375
13376
  var objValue = object2[key];
13376
- if (!(hasOwnProperty2.call(object2, key) && eq(objValue, value)) || value === undefined$1 && !(key in object2)) {
13377
+ if (!(hasOwnProperty.call(object2, key) && eq(objValue, value)) || value === undefined$1 && !(key in object2)) {
13377
13378
  baseAssignValue(object2, key, value);
13378
13379
  }
13379
13380
  }
@@ -13648,7 +13649,7 @@ lodash.exports;
13648
13649
  return value > other;
13649
13650
  }
13650
13651
  function baseHas(object2, key) {
13651
- return object2 != null && hasOwnProperty2.call(object2, key);
13652
+ return object2 != null && hasOwnProperty.call(object2, key);
13652
13653
  }
13653
13654
  function baseHasIn(object2, key) {
13654
13655
  return object2 != null && key in Object2(object2);
@@ -13735,7 +13736,7 @@ lodash.exports;
13735
13736
  return objIsArr || isTypedArray(object2) ? equalArrays(object2, other, bitmask, customizer, equalFunc, stack) : equalByTag(object2, other, objTag, bitmask, customizer, equalFunc, stack);
13736
13737
  }
13737
13738
  if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
13738
- var objIsWrapped = objIsObj && hasOwnProperty2.call(object2, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty2.call(other, "__wrapped__");
13739
+ var objIsWrapped = objIsObj && hasOwnProperty.call(object2, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
13739
13740
  if (objIsWrapped || othIsWrapped) {
13740
13741
  var objUnwrapped = objIsWrapped ? object2.value() : object2, othUnwrapped = othIsWrapped ? other.value() : other;
13741
13742
  stack || (stack = new Stack());
@@ -13816,7 +13817,7 @@ lodash.exports;
13816
13817
  }
13817
13818
  var result2 = [];
13818
13819
  for (var key in Object2(object2)) {
13819
- if (hasOwnProperty2.call(object2, key) && key != "constructor") {
13820
+ if (hasOwnProperty.call(object2, key) && key != "constructor") {
13820
13821
  result2.push(key);
13821
13822
  }
13822
13823
  }
@@ -13828,7 +13829,7 @@ lodash.exports;
13828
13829
  }
13829
13830
  var isProto = isPrototype(object2), result2 = [];
13830
13831
  for (var key in object2) {
13831
- if (!(key == "constructor" && (isProto || !hasOwnProperty2.call(object2, key)))) {
13832
+ if (!(key == "constructor" && (isProto || !hasOwnProperty.call(object2, key)))) {
13832
13833
  result2.push(key);
13833
13834
  }
13834
13835
  }
@@ -14771,7 +14772,7 @@ lodash.exports;
14771
14772
  return func(number);
14772
14773
  };
14773
14774
  }
14774
- var createSet = !(Set2 && 1 / setToArray(new Set2([, -0]))[1] == INFINITY) ? noop2 : function(values3) {
14775
+ var createSet = !(Set2 && 1 / setToArray(new Set2([, -0]))[1] == INFINITY) ? noop : function(values3) {
14775
14776
  return new Set2(values3);
14776
14777
  };
14777
14778
  function createToPairs(keysFunc) {
@@ -14841,7 +14842,7 @@ lodash.exports;
14841
14842
  return setWrapToString(setter(result2, newData), func, bitmask);
14842
14843
  }
14843
14844
  function customDefaultsAssignIn(objValue, srcValue, key, object2) {
14844
- if (objValue === undefined$1 || eq(objValue, objectProto[key]) && !hasOwnProperty2.call(object2, key)) {
14845
+ if (objValue === undefined$1 || eq(objValue, objectProto[key]) && !hasOwnProperty.call(object2, key)) {
14845
14846
  return srcValue;
14846
14847
  }
14847
14848
  return objValue;
@@ -14954,7 +14955,7 @@ lodash.exports;
14954
14955
  var index = objLength;
14955
14956
  while (index--) {
14956
14957
  var key = objProps[index];
14957
- if (!(isPartial ? key in other : hasOwnProperty2.call(other, key))) {
14958
+ if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
14958
14959
  return false;
14959
14960
  }
14960
14961
  }
@@ -14998,11 +14999,11 @@ lodash.exports;
14998
14999
  function getAllKeysIn(object2) {
14999
15000
  return baseGetAllKeys(object2, keysIn, getSymbolsIn);
15000
15001
  }
15001
- var getData = !metaMap ? noop2 : function(func) {
15002
+ var getData = !metaMap ? noop : function(func) {
15002
15003
  return metaMap.get(func);
15003
15004
  };
15004
15005
  function getFuncName(func) {
15005
- var result2 = func.name + "", array = realNames[result2], length = hasOwnProperty2.call(realNames, result2) ? array.length : 0;
15006
+ var result2 = func.name + "", array = realNames[result2], length = hasOwnProperty.call(realNames, result2) ? array.length : 0;
15006
15007
  while (length--) {
15007
15008
  var data = array[length], otherFunc = data.func;
15008
15009
  if (otherFunc == null || otherFunc == func) {
@@ -15012,7 +15013,7 @@ lodash.exports;
15012
15013
  return result2;
15013
15014
  }
15014
15015
  function getHolder(func) {
15015
- var object2 = hasOwnProperty2.call(lodash2, "placeholder") ? lodash2 : func;
15016
+ var object2 = hasOwnProperty.call(lodash2, "placeholder") ? lodash2 : func;
15016
15017
  return object2.placeholder;
15017
15018
  }
15018
15019
  function getIteratee() {
@@ -15037,7 +15038,7 @@ lodash.exports;
15037
15038
  return baseIsNative(value) ? value : undefined$1;
15038
15039
  }
15039
15040
  function getRawTag(value) {
15040
- var isOwn = hasOwnProperty2.call(value, symToStringTag), tag = value[symToStringTag];
15041
+ var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
15041
15042
  try {
15042
15043
  value[symToStringTag] = undefined$1;
15043
15044
  var unmasked = true;
@@ -15134,7 +15135,7 @@ lodash.exports;
15134
15135
  }
15135
15136
  function initCloneArray(array) {
15136
15137
  var length = array.length, result2 = new array.constructor(length);
15137
- if (length && typeof array[0] == "string" && hasOwnProperty2.call(array, "index")) {
15138
+ if (length && typeof array[0] == "string" && hasOwnProperty.call(array, "index")) {
15138
15139
  result2.index = array.index;
15139
15140
  result2.input = array.input;
15140
15141
  }
@@ -15905,7 +15906,7 @@ lodash.exports;
15905
15906
  return baseWrapperValue(this.__wrapped__, this.__actions__);
15906
15907
  }
15907
15908
  var countBy = createAggregator(function(result2, value, key) {
15908
- if (hasOwnProperty2.call(result2, key)) {
15909
+ if (hasOwnProperty.call(result2, key)) {
15909
15910
  ++result2[key];
15910
15911
  } else {
15911
15912
  baseAssignValue(result2, key, 1);
@@ -15943,7 +15944,7 @@ lodash.exports;
15943
15944
  return func(collection, getIteratee(iteratee2, 3));
15944
15945
  }
15945
15946
  var groupBy2 = createAggregator(function(result2, value, key) {
15946
- if (hasOwnProperty2.call(result2, key)) {
15947
+ if (hasOwnProperty.call(result2, key)) {
15947
15948
  result2[key].push(value);
15948
15949
  } else {
15949
15950
  baseAssignValue(result2, key, [value]);
@@ -16340,7 +16341,7 @@ lodash.exports;
16340
16341
  var isArguments = baseIsArguments(/* @__PURE__ */ function() {
16341
16342
  return arguments;
16342
16343
  }()) ? baseIsArguments : function(value) {
16343
- return isObjectLike(value) && hasOwnProperty2.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
16344
+ return isObjectLike(value) && hasOwnProperty.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
16344
16345
  };
16345
16346
  var isArray = Array2.isArray;
16346
16347
  var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
@@ -16373,7 +16374,7 @@ lodash.exports;
16373
16374
  return !baseKeys(value).length;
16374
16375
  }
16375
16376
  for (var key in value) {
16376
- if (hasOwnProperty2.call(value, key)) {
16377
+ if (hasOwnProperty.call(value, key)) {
16377
16378
  return false;
16378
16379
  }
16379
16380
  }
@@ -16451,7 +16452,7 @@ lodash.exports;
16451
16452
  if (proto === null) {
16452
16453
  return true;
16453
16454
  }
16454
- var Ctor = hasOwnProperty2.call(proto, "constructor") && proto.constructor;
16455
+ var Ctor = hasOwnProperty.call(proto, "constructor") && proto.constructor;
16455
16456
  return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
16456
16457
  }
16457
16458
  var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
@@ -16543,7 +16544,7 @@ lodash.exports;
16543
16544
  return;
16544
16545
  }
16545
16546
  for (var key in source) {
16546
- if (hasOwnProperty2.call(source, key)) {
16547
+ if (hasOwnProperty.call(source, key)) {
16547
16548
  assignValue(object2, key, source[key]);
16548
16549
  }
16549
16550
  }
@@ -16578,7 +16579,7 @@ lodash.exports;
16578
16579
  while (++propsIndex < propsLength) {
16579
16580
  var key = props[propsIndex];
16580
16581
  var value = object2[key];
16581
- if (value === undefined$1 || eq(value, objectProto[key]) && !hasOwnProperty2.call(object2, key)) {
16582
+ if (value === undefined$1 || eq(value, objectProto[key]) && !hasOwnProperty.call(object2, key)) {
16582
16583
  object2[key] = source[key];
16583
16584
  }
16584
16585
  }
@@ -16633,7 +16634,7 @@ lodash.exports;
16633
16634
  if (value != null && typeof value.toString != "function") {
16634
16635
  value = nativeObjectToString.call(value);
16635
16636
  }
16636
- if (hasOwnProperty2.call(result2, value)) {
16637
+ if (hasOwnProperty.call(result2, value)) {
16637
16638
  result2[value].push(key);
16638
16639
  } else {
16639
16640
  result2[value] = [key];
@@ -16948,7 +16949,7 @@ lodash.exports;
16948
16949
  (options.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$",
16949
16950
  "g"
16950
16951
  );
16951
- var sourceURL = "//# sourceURL=" + (hasOwnProperty2.call(options, "sourceURL") ? (options.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n";
16952
+ var sourceURL = "//# sourceURL=" + (hasOwnProperty.call(options, "sourceURL") ? (options.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n";
16952
16953
  string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
16953
16954
  interpolateValue || (interpolateValue = esTemplateValue);
16954
16955
  source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
@@ -16967,7 +16968,7 @@ lodash.exports;
16967
16968
  return match;
16968
16969
  });
16969
16970
  source += "';\n";
16970
- var variable = hasOwnProperty2.call(options, "variable") && options.variable;
16971
+ var variable = hasOwnProperty.call(options, "variable") && options.variable;
16971
16972
  if (!variable) {
16972
16973
  source = "with (obj) {\n" + source + "\n}\n";
16973
16974
  } else if (reForbiddenIdentifierChars.test(variable)) {
@@ -17186,7 +17187,7 @@ lodash.exports;
17186
17187
  }
17187
17188
  return this;
17188
17189
  }
17189
- function noop2() {
17190
+ function noop() {
17190
17191
  }
17191
17192
  function nthArg(n2) {
17192
17193
  n2 = toInteger(n2);
@@ -17541,7 +17542,7 @@ lodash.exports;
17541
17542
  lodash2.multiply = multiply;
17542
17543
  lodash2.nth = nth;
17543
17544
  lodash2.noConflict = noConflict;
17544
- lodash2.noop = noop2;
17545
+ lodash2.noop = noop;
17545
17546
  lodash2.now = now;
17546
17547
  lodash2.pad = pad;
17547
17548
  lodash2.padEnd = padEnd;
@@ -17594,7 +17595,7 @@ lodash.exports;
17594
17595
  mixin(lodash2, function() {
17595
17596
  var source = {};
17596
17597
  baseForOwn(lodash2, function(func, methodName) {
17597
- if (!hasOwnProperty2.call(lodash2.prototype, methodName)) {
17598
+ if (!hasOwnProperty.call(lodash2.prototype, methodName)) {
17598
17599
  source[methodName] = func;
17599
17600
  }
17600
17601
  });
@@ -17734,7 +17735,7 @@ lodash.exports;
17734
17735
  var lodashFunc = lodash2[methodName];
17735
17736
  if (lodashFunc) {
17736
17737
  var key = lodashFunc.name + "";
17737
- if (!hasOwnProperty2.call(realNames, key)) {
17738
+ if (!hasOwnProperty.call(realNames, key)) {
17738
17739
  realNames[key] = [];
17739
17740
  }
17740
17741
  realNames[key].push({ "name": methodName, "func": lodashFunc });
@@ -26536,7 +26537,7 @@ function validateInput(global2, document2, current) {
26536
26537
  }
26537
26538
  }
26538
26539
  }
26539
- function assign$2(target, s2, s1, s22, s3) {
26540
+ function assign$1(target, s2, s1, s22, s3) {
26540
26541
  if (target == null) {
26541
26542
  throw new TypeError("Cannot convert undefined or null to object");
26542
26543
  }
@@ -26558,7 +26559,7 @@ function parseInput(d2, current) {
26558
26559
  var document2 = doc.getDocumentOptions();
26559
26560
  var global2 = doc.getGlobalOptions();
26560
26561
  validateInput(global2, document2, current);
26561
- var options = assign$2({}, global2, document2, current);
26562
+ var options = assign$1({}, global2, document2, current);
26562
26563
  var win;
26563
26564
  if (typeof window !== "undefined") {
26564
26565
  win = window;
@@ -26583,13 +26584,13 @@ function parseStyles(gInput, dInput, cInput) {
26583
26584
  var global_1 = gInput[prop2];
26584
26585
  var document_1 = dInput[prop2];
26585
26586
  var current = cInput[prop2];
26586
- styleOptions.columnStyles = assign$2({}, global_1, document_1, current);
26587
+ styleOptions.columnStyles = assign$1({}, global_1, document_1, current);
26587
26588
  } else {
26588
26589
  var allOptions = [gInput, dInput, cInput];
26589
26590
  var styles = allOptions.map(function(opts) {
26590
26591
  return opts[prop2] || {};
26591
26592
  });
26592
- styleOptions[prop2] = assign$2({}, styles[0], styles[1], styles[2]);
26593
+ styleOptions[prop2] = assign$1({}, styles[0], styles[1], styles[2]);
26593
26594
  }
26594
26595
  };
26595
26596
  for (var _i = 0, _a2 = Object.keys(styleOptions); _i < _a2.length; _i++) {
@@ -27351,13 +27352,13 @@ function cellStyles(sectionName, column, rowIndex, themeName, styles, scaleFacto
27351
27352
  } else if (sectionName === "foot") {
27352
27353
  sectionStyles = styles.footStyles;
27353
27354
  }
27354
- var otherStyles = assign$2({}, theme.table, theme[sectionName], styles.styles, sectionStyles);
27355
+ var otherStyles = assign$1({}, theme.table, theme[sectionName], styles.styles, sectionStyles);
27355
27356
  var columnStyles = styles.columnStyles[column.dataKey] || styles.columnStyles[column.index] || {};
27356
27357
  var colStyles = sectionName === "body" ? columnStyles : {};
27357
- var rowStyles = sectionName === "body" && rowIndex % 2 === 0 ? assign$2({}, theme.alternateRow, styles.alternateRowStyles) : {};
27358
+ var rowStyles = sectionName === "body" && rowIndex % 2 === 0 ? assign$1({}, theme.alternateRow, styles.alternateRowStyles) : {};
27358
27359
  var defaultStyle = defaultStyles(scaleFactor);
27359
- var themeStyles = assign$2({}, defaultStyle, otherStyles, rowStyles, colStyles);
27360
- return assign$2(themeStyles, cellInputStyles);
27360
+ var themeStyles = assign$1({}, defaultStyle, otherStyles, rowStyles, colStyles);
27361
+ return assign$1(themeStyles, cellInputStyles);
27361
27362
  }
27362
27363
  function getColumnsCanFitInPage(doc, table, config) {
27363
27364
  var _a2;
@@ -27436,7 +27437,7 @@ function drawTable(jsPDFDoc, table) {
27436
27437
  cursor.y = margin.top;
27437
27438
  }
27438
27439
  table.callWillDrawPageHooks(doc, cursor);
27439
- var startPos = assign$2({}, cursor);
27440
+ var startPos = assign$1({}, cursor);
27440
27441
  table.startPageNumber = doc.pageNumber();
27441
27442
  if (settings.horizontalPageBreak) {
27442
27443
  printTableWithHorizontalPageBreak(doc, table, startPos, cursor);
@@ -27569,7 +27570,7 @@ function modifyRowToFit(row, remainingPageSpace, table, doc) {
27569
27570
  cell.text = [cell.text];
27570
27571
  }
27571
27572
  var remainderCell = new Cell(cell.raw, cell.styles, cell.section);
27572
- remainderCell = assign$2(remainderCell, cell);
27573
+ remainderCell = assign$1(remainderCell, cell);
27573
27574
  remainderCell.text = [];
27574
27575
  var remainingLineCount = getRemainingLineCount(cell, remainingPageSpace, doc);
27575
27576
  if (cell.text.length > remainingLineCount) {
@@ -27915,7 +27916,7 @@ function generateTableSVG(items, options = {}) {
27915
27916
  height = 100,
27916
27917
  cellPadding = 5,
27917
27918
  fontSize: fontSize2 = 12,
27918
- headerColor = "#f0f0f0",
27919
+ headerColor = "#000000",
27919
27920
  borderColor = "#000000"
27920
27921
  } = options;
27921
27922
  const headers = ["ID", "Nome", "Qtd", "Dimensões"];
@@ -28406,13 +28407,39 @@ const makeBarCode = (mainObject) => {
28406
28407
  const variableManager = new VariableManager();
28407
28408
  let bar = v2.originBarcode === "PERSONALIZADO" ? variableManager.processTemplate(v2.customBarcode, extendedData.variableProps) || "null" : variableManager.processTemplate(v2.originBarcode, extendedData.variableProps);
28408
28409
  if (!bar.includes("null") && bar.length > 0) {
28410
+ const aspectRatio = vWidth / vHeight;
28409
28411
  let canvas2 = document$2.createElement("canvas");
28410
- canvas2.width = 400;
28411
- canvas2.height = 200;
28412
+ let canvasWidth, canvasHeight;
28413
+ if (aspectRatio > 5) {
28414
+ canvasWidth = 5e3;
28415
+ canvasHeight = Math.round(5e3 / aspectRatio);
28416
+ canvasHeight = Math.max(canvasHeight, 300);
28417
+ } else if (aspectRatio < 0.2) {
28418
+ canvasHeight = 5e3;
28419
+ canvasWidth = Math.round(5e3 * aspectRatio);
28420
+ canvasWidth = Math.max(canvasWidth, 300);
28421
+ } else {
28422
+ canvasHeight = 1e3;
28423
+ canvasWidth = Math.round(1e3 * aspectRatio);
28424
+ }
28425
+ canvas2.width = canvasWidth;
28426
+ canvas2.height = canvasHeight;
28412
28427
  let px = width * y2 + (verticalSpace * y2 + marginLeft2) + vLeft;
28413
28428
  let py = height * x2 + (horizontalSpace * x2 + marginTop2) + vTop;
28414
28429
  try {
28415
- JsBarcode$1(canvas2, bar);
28430
+ const barWidth = Math.max(1, Math.min(3, canvasWidth / 100));
28431
+ JsBarcode$1(canvas2, bar, {
28432
+ format: v2.barcodeFormat || "CODE128",
28433
+ width: barWidth,
28434
+ // Largura adaptativa das barras
28435
+ height: canvasHeight * 0.8,
28436
+ // Altura proporcional ao canvas
28437
+ displayValue: false,
28438
+ // Não mostrar valor do código (texto escondido)
28439
+ margin: Math.max(canvasHeight * 0.1, 10),
28440
+ // Margem proporcional com mínimo
28441
+ background: "#ffffff"
28442
+ });
28416
28443
  } catch (error) {
28417
28444
  console.error("Erro ao gerar código de barras:", error);
28418
28445
  canvas2 = document$2.createElement("canvas");
@@ -28444,26 +28471,23 @@ const makeBarCode = (mainObject) => {
28444
28471
  };
28445
28472
  const makeLamination$1 = (mainObject) => {
28446
28473
  const {
28474
+ v: v2,
28447
28475
  width,
28448
- height,
28449
- x: x2,
28450
- y: y2,
28451
28476
  verticalSpace,
28452
28477
  horizontalSpace,
28453
- marginTop: marginTop2,
28454
- marginLeft: marginLeft2,
28478
+ vHeight,
28455
28479
  vLeft,
28480
+ vWidth,
28456
28481
  vTop,
28482
+ marginLeft: marginLeft2,
28483
+ marginTop: marginTop2,
28484
+ height,
28485
+ x: x2,
28486
+ y: y2,
28457
28487
  pdfInstance,
28458
- vHeight,
28459
- vWidth,
28460
- partList,
28461
- indexLabel,
28462
- v: v2,
28463
28488
  vl,
28464
28489
  actualData
28465
28490
  } = mainObject;
28466
- console.log("actualData =>", actualData);
28467
28491
  let edgeData, materialId;
28468
28492
  if (actualData && actualData.edges) {
28469
28493
  edgeData = {
@@ -28822,7 +28846,7 @@ function insertFiguresToPdf(_e) {
28822
28846
  theme: "grid",
28823
28847
  // Estilo da tabela
28824
28848
  styles: {
28825
- fontSize: 4,
28849
+ fontSize: 8,
28826
28850
  cellPadding: 0.5,
28827
28851
  // lineHeight: 0.6,
28828
28852
  minCellHeight: 1.8
@@ -29433,446 +29457,7 @@ const createStoreImpl = (createState) => {
29433
29457
  return api;
29434
29458
  };
29435
29459
  const createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
29436
- var react = { exports: {} };
29437
- var react_production = {};
29438
- /**
29439
- * @license React
29440
- * react.production.js
29441
- *
29442
- * Copyright (c) Meta Platforms, Inc. and affiliates.
29443
- *
29444
- * This source code is licensed under the MIT license found in the
29445
- * LICENSE file in the root directory of this source tree.
29446
- */
29447
- var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
29448
- function getIteratorFn(maybeIterable) {
29449
- if (null === maybeIterable || "object" !== typeof maybeIterable) return null;
29450
- maybeIterable = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable["@@iterator"];
29451
- return "function" === typeof maybeIterable ? maybeIterable : null;
29452
- }
29453
- var ReactNoopUpdateQueue = {
29454
- isMounted: function() {
29455
- return false;
29456
- },
29457
- enqueueForceUpdate: function() {
29458
- },
29459
- enqueueReplaceState: function() {
29460
- },
29461
- enqueueSetState: function() {
29462
- }
29463
- }, assign$1 = Object.assign, emptyObject = {};
29464
- function Component(props, context, updater) {
29465
- this.props = props;
29466
- this.context = context;
29467
- this.refs = emptyObject;
29468
- this.updater = updater || ReactNoopUpdateQueue;
29469
- }
29470
- Component.prototype.isReactComponent = {};
29471
- Component.prototype.setState = function(partialState, callback) {
29472
- if ("object" !== typeof partialState && "function" !== typeof partialState && null != partialState)
29473
- throw Error(
29474
- "takes an object of state variables to update or a function which returns an object of state variables."
29475
- );
29476
- this.updater.enqueueSetState(this, partialState, callback, "setState");
29477
- };
29478
- Component.prototype.forceUpdate = function(callback) {
29479
- this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
29480
- };
29481
- function ComponentDummy() {
29482
- }
29483
- ComponentDummy.prototype = Component.prototype;
29484
- function PureComponent(props, context, updater) {
29485
- this.props = props;
29486
- this.context = context;
29487
- this.refs = emptyObject;
29488
- this.updater = updater || ReactNoopUpdateQueue;
29489
- }
29490
- var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
29491
- pureComponentPrototype.constructor = PureComponent;
29492
- assign$1(pureComponentPrototype, Component.prototype);
29493
- pureComponentPrototype.isPureReactComponent = true;
29494
- var isArrayImpl = Array.isArray, ReactSharedInternals = { H: null, A: null, T: null, S: null, V: null }, hasOwnProperty = Object.prototype.hasOwnProperty;
29495
- function ReactElement(type, key, self2, source, owner, props) {
29496
- self2 = props.ref;
29497
- return {
29498
- $$typeof: REACT_ELEMENT_TYPE,
29499
- type,
29500
- key,
29501
- ref: void 0 !== self2 ? self2 : null,
29502
- props
29503
- };
29504
- }
29505
- function cloneAndReplaceKey(oldElement, newKey) {
29506
- return ReactElement(
29507
- oldElement.type,
29508
- newKey,
29509
- void 0,
29510
- void 0,
29511
- void 0,
29512
- oldElement.props
29513
- );
29514
- }
29515
- function isValidElement(object2) {
29516
- return "object" === typeof object2 && null !== object2 && object2.$$typeof === REACT_ELEMENT_TYPE;
29517
- }
29518
- function escape$1(key) {
29519
- var escaperLookup = { "=": "=0", ":": "=2" };
29520
- return "$" + key.replace(/[=:]/g, function(match) {
29521
- return escaperLookup[match];
29522
- });
29523
- }
29524
- var userProvidedKeyEscapeRegex = /\/+/g;
29525
- function getElementKey(element, index) {
29526
- return "object" === typeof element && null !== element && null != element.key ? escape$1("" + element.key) : index.toString(36);
29527
- }
29528
- function noop$1() {
29529
- }
29530
- function resolveThenable(thenable) {
29531
- switch (thenable.status) {
29532
- case "fulfilled":
29533
- return thenable.value;
29534
- case "rejected":
29535
- throw thenable.reason;
29536
- default:
29537
- switch ("string" === typeof thenable.status ? thenable.then(noop$1, noop$1) : (thenable.status = "pending", thenable.then(
29538
- function(fulfilledValue) {
29539
- "pending" === thenable.status && (thenable.status = "fulfilled", thenable.value = fulfilledValue);
29540
- },
29541
- function(error) {
29542
- "pending" === thenable.status && (thenable.status = "rejected", thenable.reason = error);
29543
- }
29544
- )), thenable.status) {
29545
- case "fulfilled":
29546
- return thenable.value;
29547
- case "rejected":
29548
- throw thenable.reason;
29549
- }
29550
- }
29551
- throw thenable;
29552
- }
29553
- function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
29554
- var type = typeof children;
29555
- if ("undefined" === type || "boolean" === type) children = null;
29556
- var invokeCallback = false;
29557
- if (null === children) invokeCallback = true;
29558
- else
29559
- switch (type) {
29560
- case "bigint":
29561
- case "string":
29562
- case "number":
29563
- invokeCallback = true;
29564
- break;
29565
- case "object":
29566
- switch (children.$$typeof) {
29567
- case REACT_ELEMENT_TYPE:
29568
- case REACT_PORTAL_TYPE:
29569
- invokeCallback = true;
29570
- break;
29571
- case REACT_LAZY_TYPE:
29572
- return invokeCallback = children._init, mapIntoArray(
29573
- invokeCallback(children._payload),
29574
- array,
29575
- escapedPrefix,
29576
- nameSoFar,
29577
- callback
29578
- );
29579
- }
29580
- }
29581
- if (invokeCallback)
29582
- return callback = callback(children), invokeCallback = "" === nameSoFar ? "." + getElementKey(children, 0) : nameSoFar, isArrayImpl(callback) ? (escapedPrefix = "", null != invokeCallback && (escapedPrefix = invokeCallback.replace(userProvidedKeyEscapeRegex, "$&/") + "/"), mapIntoArray(callback, array, escapedPrefix, "", function(c2) {
29583
- return c2;
29584
- })) : null != callback && (isValidElement(callback) && (callback = cloneAndReplaceKey(
29585
- callback,
29586
- escapedPrefix + (null == callback.key || children && children.key === callback.key ? "" : ("" + callback.key).replace(
29587
- userProvidedKeyEscapeRegex,
29588
- "$&/"
29589
- ) + "/") + invokeCallback
29590
- )), array.push(callback)), 1;
29591
- invokeCallback = 0;
29592
- var nextNamePrefix = "" === nameSoFar ? "." : nameSoFar + ":";
29593
- if (isArrayImpl(children))
29594
- for (var i = 0; i < children.length; i++)
29595
- nameSoFar = children[i], type = nextNamePrefix + getElementKey(nameSoFar, i), invokeCallback += mapIntoArray(
29596
- nameSoFar,
29597
- array,
29598
- escapedPrefix,
29599
- type,
29600
- callback
29601
- );
29602
- else if (i = getIteratorFn(children), "function" === typeof i)
29603
- for (children = i.call(children), i = 0; !(nameSoFar = children.next()).done; )
29604
- nameSoFar = nameSoFar.value, type = nextNamePrefix + getElementKey(nameSoFar, i++), invokeCallback += mapIntoArray(
29605
- nameSoFar,
29606
- array,
29607
- escapedPrefix,
29608
- type,
29609
- callback
29610
- );
29611
- else if ("object" === type) {
29612
- if ("function" === typeof children.then)
29613
- return mapIntoArray(
29614
- resolveThenable(children),
29615
- array,
29616
- escapedPrefix,
29617
- nameSoFar,
29618
- callback
29619
- );
29620
- array = String(children);
29621
- throw Error(
29622
- "Objects are not valid as a React child (found: " + ("[object Object]" === array ? "object with keys {" + Object.keys(children).join(", ") + "}" : array) + "). If you meant to render a collection of children, use an array instead."
29623
- );
29624
- }
29625
- return invokeCallback;
29626
- }
29627
- function mapChildren(children, func, context) {
29628
- if (null == children) return children;
29629
- var result = [], count = 0;
29630
- mapIntoArray(children, result, "", "", function(child) {
29631
- return func.call(context, child, count++);
29632
- });
29633
- return result;
29634
- }
29635
- function lazyInitializer(payload) {
29636
- if (-1 === payload._status) {
29637
- var ctor = payload._result;
29638
- ctor = ctor();
29639
- ctor.then(
29640
- function(moduleObject) {
29641
- if (0 === payload._status || -1 === payload._status)
29642
- payload._status = 1, payload._result = moduleObject;
29643
- },
29644
- function(error) {
29645
- if (0 === payload._status || -1 === payload._status)
29646
- payload._status = 2, payload._result = error;
29647
- }
29648
- );
29649
- -1 === payload._status && (payload._status = 0, payload._result = ctor);
29650
- }
29651
- if (1 === payload._status) return payload._result.default;
29652
- throw payload._result;
29653
- }
29654
- var reportGlobalError = "function" === typeof reportError ? reportError : function(error) {
29655
- if ("object" === typeof window && "function" === typeof window.ErrorEvent) {
29656
- var event = new window.ErrorEvent("error", {
29657
- bubbles: true,
29658
- cancelable: true,
29659
- message: "object" === typeof error && null !== error && "string" === typeof error.message ? String(error.message) : String(error),
29660
- error
29661
- });
29662
- if (!window.dispatchEvent(event)) return;
29663
- } else if ("object" === typeof process && "function" === typeof process.emit) {
29664
- process.emit("uncaughtException", error);
29665
- return;
29666
- }
29667
- console.error(error);
29668
- };
29669
- function noop() {
29670
- }
29671
- react_production.Children = {
29672
- map: mapChildren,
29673
- forEach: function(children, forEachFunc, forEachContext) {
29674
- mapChildren(
29675
- children,
29676
- function() {
29677
- forEachFunc.apply(this, arguments);
29678
- },
29679
- forEachContext
29680
- );
29681
- },
29682
- count: function(children) {
29683
- var n2 = 0;
29684
- mapChildren(children, function() {
29685
- n2++;
29686
- });
29687
- return n2;
29688
- },
29689
- toArray: function(children) {
29690
- return mapChildren(children, function(child) {
29691
- return child;
29692
- }) || [];
29693
- },
29694
- only: function(children) {
29695
- if (!isValidElement(children))
29696
- throw Error(
29697
- "React.Children.only expected to receive a single React element child."
29698
- );
29699
- return children;
29700
- }
29701
- };
29702
- react_production.Component = Component;
29703
- react_production.Fragment = REACT_FRAGMENT_TYPE;
29704
- react_production.Profiler = REACT_PROFILER_TYPE;
29705
- react_production.PureComponent = PureComponent;
29706
- react_production.StrictMode = REACT_STRICT_MODE_TYPE;
29707
- react_production.Suspense = REACT_SUSPENSE_TYPE;
29708
- react_production.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals;
29709
- react_production.__COMPILER_RUNTIME = {
29710
- __proto__: null,
29711
- c: function(size) {
29712
- return ReactSharedInternals.H.useMemoCache(size);
29713
- }
29714
- };
29715
- react_production.cache = function(fn) {
29716
- return function() {
29717
- return fn.apply(null, arguments);
29718
- };
29719
- };
29720
- react_production.cloneElement = function(element, config, children) {
29721
- if (null === element || void 0 === element)
29722
- throw Error(
29723
- "The argument must be a React element, but you passed " + element + "."
29724
- );
29725
- var props = assign$1({}, element.props), key = element.key, owner = void 0;
29726
- if (null != config)
29727
- for (propName in void 0 !== config.ref && (owner = void 0), void 0 !== config.key && (key = "" + config.key), config)
29728
- !hasOwnProperty.call(config, propName) || "key" === propName || "__self" === propName || "__source" === propName || "ref" === propName && void 0 === config.ref || (props[propName] = config[propName]);
29729
- var propName = arguments.length - 2;
29730
- if (1 === propName) props.children = children;
29731
- else if (1 < propName) {
29732
- for (var childArray = Array(propName), i = 0; i < propName; i++)
29733
- childArray[i] = arguments[i + 2];
29734
- props.children = childArray;
29735
- }
29736
- return ReactElement(element.type, key, void 0, void 0, owner, props);
29737
- };
29738
- react_production.createContext = function(defaultValue) {
29739
- defaultValue = {
29740
- $$typeof: REACT_CONTEXT_TYPE,
29741
- _currentValue: defaultValue,
29742
- _currentValue2: defaultValue,
29743
- _threadCount: 0,
29744
- Provider: null,
29745
- Consumer: null
29746
- };
29747
- defaultValue.Provider = defaultValue;
29748
- defaultValue.Consumer = {
29749
- $$typeof: REACT_CONSUMER_TYPE,
29750
- _context: defaultValue
29751
- };
29752
- return defaultValue;
29753
- };
29754
- react_production.createElement = function(type, config, children) {
29755
- var propName, props = {}, key = null;
29756
- if (null != config)
29757
- for (propName in void 0 !== config.key && (key = "" + config.key), config)
29758
- hasOwnProperty.call(config, propName) && "key" !== propName && "__self" !== propName && "__source" !== propName && (props[propName] = config[propName]);
29759
- var childrenLength = arguments.length - 2;
29760
- if (1 === childrenLength) props.children = children;
29761
- else if (1 < childrenLength) {
29762
- for (var childArray = Array(childrenLength), i = 0; i < childrenLength; i++)
29763
- childArray[i] = arguments[i + 2];
29764
- props.children = childArray;
29765
- }
29766
- if (type && type.defaultProps)
29767
- for (propName in childrenLength = type.defaultProps, childrenLength)
29768
- void 0 === props[propName] && (props[propName] = childrenLength[propName]);
29769
- return ReactElement(type, key, void 0, void 0, null, props);
29770
- };
29771
- react_production.createRef = function() {
29772
- return { current: null };
29773
- };
29774
- react_production.forwardRef = function(render2) {
29775
- return { $$typeof: REACT_FORWARD_REF_TYPE, render: render2 };
29776
- };
29777
- react_production.isValidElement = isValidElement;
29778
- react_production.lazy = function(ctor) {
29779
- return {
29780
- $$typeof: REACT_LAZY_TYPE,
29781
- _payload: { _status: -1, _result: ctor },
29782
- _init: lazyInitializer
29783
- };
29784
- };
29785
- react_production.memo = function(type, compare) {
29786
- return {
29787
- $$typeof: REACT_MEMO_TYPE,
29788
- type,
29789
- compare: void 0 === compare ? null : compare
29790
- };
29791
- };
29792
- react_production.startTransition = function(scope) {
29793
- var prevTransition = ReactSharedInternals.T, currentTransition = {};
29794
- ReactSharedInternals.T = currentTransition;
29795
- try {
29796
- var returnValue = scope(), onStartTransitionFinish = ReactSharedInternals.S;
29797
- null !== onStartTransitionFinish && onStartTransitionFinish(currentTransition, returnValue);
29798
- "object" === typeof returnValue && null !== returnValue && "function" === typeof returnValue.then && returnValue.then(noop, reportGlobalError);
29799
- } catch (error) {
29800
- reportGlobalError(error);
29801
- } finally {
29802
- ReactSharedInternals.T = prevTransition;
29803
- }
29804
- };
29805
- react_production.unstable_useCacheRefresh = function() {
29806
- return ReactSharedInternals.H.useCacheRefresh();
29807
- };
29808
- react_production.use = function(usable) {
29809
- return ReactSharedInternals.H.use(usable);
29810
- };
29811
- react_production.useActionState = function(action, initialState2, permalink) {
29812
- return ReactSharedInternals.H.useActionState(action, initialState2, permalink);
29813
- };
29814
- react_production.useCallback = function(callback, deps) {
29815
- return ReactSharedInternals.H.useCallback(callback, deps);
29816
- };
29817
- react_production.useContext = function(Context2) {
29818
- return ReactSharedInternals.H.useContext(Context2);
29819
- };
29820
- react_production.useDebugValue = function() {
29821
- };
29822
- react_production.useDeferredValue = function(value, initialValue) {
29823
- return ReactSharedInternals.H.useDeferredValue(value, initialValue);
29824
- };
29825
- react_production.useEffect = function(create2, createDeps, update) {
29826
- var dispatcher = ReactSharedInternals.H;
29827
- if ("function" === typeof update)
29828
- throw Error(
29829
- "useEffect CRUD overload is not enabled in this build of React."
29830
- );
29831
- return dispatcher.useEffect(create2, createDeps);
29832
- };
29833
- react_production.useId = function() {
29834
- return ReactSharedInternals.H.useId();
29835
- };
29836
- react_production.useImperativeHandle = function(ref, create2, deps) {
29837
- return ReactSharedInternals.H.useImperativeHandle(ref, create2, deps);
29838
- };
29839
- react_production.useInsertionEffect = function(create2, deps) {
29840
- return ReactSharedInternals.H.useInsertionEffect(create2, deps);
29841
- };
29842
- react_production.useLayoutEffect = function(create2, deps) {
29843
- return ReactSharedInternals.H.useLayoutEffect(create2, deps);
29844
- };
29845
- react_production.useMemo = function(create2, deps) {
29846
- return ReactSharedInternals.H.useMemo(create2, deps);
29847
- };
29848
- react_production.useOptimistic = function(passthrough, reducer2) {
29849
- return ReactSharedInternals.H.useOptimistic(passthrough, reducer2);
29850
- };
29851
- react_production.useReducer = function(reducer2, initialArg, init2) {
29852
- return ReactSharedInternals.H.useReducer(reducer2, initialArg, init2);
29853
- };
29854
- react_production.useRef = function(initialValue) {
29855
- return ReactSharedInternals.H.useRef(initialValue);
29856
- };
29857
- react_production.useState = function(initialState2) {
29858
- return ReactSharedInternals.H.useState(initialState2);
29859
- };
29860
- react_production.useSyncExternalStore = function(subscribe, getSnapshot, getServerSnapshot) {
29861
- return ReactSharedInternals.H.useSyncExternalStore(
29862
- subscribe,
29863
- getSnapshot,
29864
- getServerSnapshot
29865
- );
29866
- };
29867
- react_production.useTransition = function() {
29868
- return ReactSharedInternals.H.useTransition();
29869
- };
29870
- react_production.version = "19.1.0";
29871
- {
29872
- react.exports = react_production;
29873
- }
29874
- var reactExports = react.exports;
29875
- const ReactExports = /* @__PURE__ */ getDefaultExportFromCjs(reactExports);
29460
+ const ReactExports = {};
29876
29461
  var withSelector = { exports: {} };
29877
29462
  var withSelector_production = {};
29878
29463
  var shim$2 = { exports: {} };
@@ -29886,7 +29471,7 @@ var useSyncExternalStoreShim_production = {};
29886
29471
  * This source code is licensed under the MIT license found in the
29887
29472
  * LICENSE file in the root directory of this source tree.
29888
29473
  */
29889
- var React$1 = reactExports;
29474
+ var React$1 = require$$0;
29890
29475
  function is$1(x2, y2) {
29891
29476
  return x2 === y2 && (0 !== x2 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2;
29892
29477
  }
@@ -29941,7 +29526,7 @@ var shimExports = shim$2.exports;
29941
29526
  * This source code is licensed under the MIT license found in the
29942
29527
  * LICENSE file in the root directory of this source tree.
29943
29528
  */
29944
- var React = reactExports, shim = shimExports;
29529
+ var React = require$$0, shim = shimExports;
29945
29530
  function is(x2, y2) {
29946
29531
  return x2 === y2 && (0 !== x2 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2;
29947
29532
  }
@@ -30142,6 +29727,7 @@ const AnnotationEditorType = {
30142
29727
  HIGHLIGHT: 9,
30143
29728
  STAMP: 13,
30144
29729
  INK: 15,
29730
+ POPUP: 16,
30145
29731
  SIGNATURE: 101,
30146
29732
  COMMENT: 102
30147
29733
  };
@@ -30530,6 +30116,9 @@ class Util {
30530
30116
  static makeHexColor(r, g2, b2) {
30531
30117
  return `#${hexNumbers[r]}${hexNumbers[g2]}${hexNumbers[b2]}`;
30532
30118
  }
30119
+ static domMatrixToTransform(dm) {
30120
+ return [dm.a, dm.b, dm.c, dm.d, dm.e, dm.f];
30121
+ }
30533
30122
  static scaleMinMax(transform2, minMax) {
30534
30123
  let temp;
30535
30124
  if (transform2[0]) {
@@ -30577,6 +30166,9 @@ class Util {
30577
30166
  static transform(m1, m2) {
30578
30167
  return [m1[0] * m2[0] + m1[2] * m2[1], m1[1] * m2[0] + m1[3] * m2[1], m1[0] * m2[2] + m1[2] * m2[3], m1[1] * m2[2] + m1[3] * m2[3], m1[0] * m2[4] + m1[2] * m2[5] + m1[4], m1[1] * m2[4] + m1[3] * m2[5] + m1[5]];
30579
30168
  }
30169
+ static multiplyByDOMMatrix(m2, md) {
30170
+ return [m2[0] * md.a + m2[2] * md.b, m2[1] * md.a + m2[3] * md.b, m2[0] * md.c + m2[2] * md.d, m2[1] * md.c + m2[3] * md.d, m2[0] * md.e + m2[2] * md.f + m2[4], m2[1] * md.e + m2[3] * md.f + m2[5]];
30171
+ }
30580
30172
  static applyTransform(p2, m2, pos = 0) {
30581
30173
  const p0 = p2[pos];
30582
30174
  const p1 = p2[pos + 1];
@@ -31345,12 +30937,14 @@ const _EditorToolbar = class _EditorToolbar {
31345
30937
  editToolbar.classList.add("editToolbar", "hidden");
31346
30938
  editToolbar.setAttribute("role", "toolbar");
31347
30939
  const signal = __privateGet(this, _editor)._uiManager._signal;
31348
- editToolbar.addEventListener("contextmenu", noContextMenu, {
31349
- signal
31350
- });
31351
- editToolbar.addEventListener("pointerdown", __privateMethod(_EditorToolbar, _EditorToolbar_static, pointerDown_fn), {
31352
- signal
31353
- });
30940
+ if (signal instanceof AbortSignal && !signal.aborted) {
30941
+ editToolbar.addEventListener("contextmenu", noContextMenu, {
30942
+ signal
30943
+ });
30944
+ editToolbar.addEventListener("pointerdown", __privateMethod(_EditorToolbar, _EditorToolbar_static, pointerDown_fn), {
30945
+ signal
30946
+ });
30947
+ }
31354
30948
  const buttons = __privateSet(this, _buttons, document.createElement("div"));
31355
30949
  buttons.className = "buttons";
31356
30950
  editToolbar.append(buttons);
@@ -31385,15 +30979,16 @@ const _EditorToolbar = class _EditorToolbar {
31385
30979
  _uiManager: _uiManager5
31386
30980
  } = __privateGet(this, _editor);
31387
30981
  const button = document.createElement("button");
31388
- button.className = "delete";
30982
+ button.classList.add("basic", "deleteButton");
31389
30983
  button.tabIndex = 0;
31390
30984
  button.setAttribute("data-l10n-id", __privateGet(_EditorToolbar, _l10nRemove)[editorType]);
31391
- __privateMethod(this, _EditorToolbar_instances, addListenersToElement_fn).call(this, button);
31392
- button.addEventListener("click", (e2) => {
31393
- _uiManager5.delete();
31394
- }, {
31395
- signal: _uiManager5._signal
31396
- });
30985
+ if (__privateMethod(this, _EditorToolbar_instances, addListenersToElement_fn).call(this, button)) {
30986
+ button.addEventListener("click", (e2) => {
30987
+ _uiManager5.delete();
30988
+ }, {
30989
+ signal: _uiManager5._signal
30990
+ });
30991
+ }
31397
30992
  __privateGet(this, _buttons).append(button);
31398
30993
  }
31399
30994
  addAltText(altText) {
@@ -31413,7 +31008,7 @@ const _EditorToolbar = class _EditorToolbar {
31413
31008
  return;
31414
31009
  }
31415
31010
  __privateMethod(this, _EditorToolbar_instances, addListenersToElement_fn).call(this, button);
31416
- __privateGet(this, _buttons).prepend(button, __privateGet(this, _EditorToolbar_instances, divider_get));
31011
+ __privateGet(this, _buttons).append(button, __privateGet(this, _EditorToolbar_instances, divider_get));
31417
31012
  __privateSet(this, _comment, comment);
31418
31013
  comment.toolbar = this;
31419
31014
  }
@@ -31489,6 +31084,9 @@ focusOut_fn = function(e2) {
31489
31084
  };
31490
31085
  addListenersToElement_fn = function(element) {
31491
31086
  const signal = __privateGet(this, _editor)._uiManager._signal;
31087
+ if (!(signal instanceof AbortSignal) || signal.aborted) {
31088
+ return false;
31089
+ }
31492
31090
  element.addEventListener("focusin", __privateMethod(this, _EditorToolbar_instances, focusIn_fn).bind(this), {
31493
31091
  capture: true,
31494
31092
  signal
@@ -31500,6 +31098,7 @@ addListenersToElement_fn = function(element) {
31500
31098
  element.addEventListener("contextmenu", noContextMenu, {
31501
31099
  signal
31502
31100
  });
31101
+ return true;
31503
31102
  };
31504
31103
  divider_get = function() {
31505
31104
  const divider = document.createElement("div");
@@ -31509,19 +31108,19 @@ divider_get = function() {
31509
31108
  __privateAdd(_EditorToolbar, _EditorToolbar_static);
31510
31109
  __privateAdd(_EditorToolbar, _l10nRemove, null);
31511
31110
  let EditorToolbar = _EditorToolbar;
31512
- class HighlightToolbar {
31111
+ class FloatingToolbar {
31513
31112
  constructor(uiManager) {
31514
- __privateAdd(this, _HighlightToolbar_instances);
31113
+ __privateAdd(this, _FloatingToolbar_instances);
31515
31114
  __privateAdd(this, _buttons2, null);
31516
31115
  __privateAdd(this, _toolbar2, null);
31517
31116
  __privateAdd(this, _uiManager);
31518
31117
  __privateSet(this, _uiManager, uiManager);
31519
31118
  }
31520
31119
  show(parent, boxes, isLTR) {
31521
- const [x2, y2] = __privateMethod(this, _HighlightToolbar_instances, getLastPoint_fn).call(this, boxes, isLTR);
31120
+ const [x2, y2] = __privateMethod(this, _FloatingToolbar_instances, getLastPoint_fn).call(this, boxes, isLTR);
31522
31121
  const {
31523
31122
  style
31524
- } = __privateGet(this, _toolbar2) || __privateSet(this, _toolbar2, __privateMethod(this, _HighlightToolbar_instances, render_fn).call(this));
31123
+ } = __privateGet(this, _toolbar2) || __privateSet(this, _toolbar2, __privateMethod(this, _FloatingToolbar_instances, render_fn).call(this));
31525
31124
  parent.append(__privateGet(this, _toolbar2));
31526
31125
  style.insetInlineEnd = `${100 * x2}%`;
31527
31126
  style.top = `calc(${100 * y2}% + var(--editor-toolbar-vert-offset))`;
@@ -31533,18 +31132,28 @@ class HighlightToolbar {
31533
31132
  _buttons2 = new WeakMap();
31534
31133
  _toolbar2 = new WeakMap();
31535
31134
  _uiManager = new WeakMap();
31536
- _HighlightToolbar_instances = new WeakSet();
31135
+ _FloatingToolbar_instances = new WeakSet();
31537
31136
  render_fn = function() {
31538
31137
  const editToolbar = __privateSet(this, _toolbar2, document.createElement("div"));
31539
31138
  editToolbar.className = "editToolbar";
31540
31139
  editToolbar.setAttribute("role", "toolbar");
31541
- editToolbar.addEventListener("contextmenu", noContextMenu, {
31542
- signal: __privateGet(this, _uiManager)._signal
31543
- });
31140
+ const signal = __privateGet(this, _uiManager)._signal;
31141
+ if (signal instanceof AbortSignal && !signal.aborted) {
31142
+ editToolbar.addEventListener("contextmenu", noContextMenu, {
31143
+ signal
31144
+ });
31145
+ }
31544
31146
  const buttons = __privateSet(this, _buttons2, document.createElement("div"));
31545
31147
  buttons.className = "buttons";
31546
31148
  editToolbar.append(buttons);
31547
- __privateMethod(this, _HighlightToolbar_instances, addHighlightButton_fn).call(this);
31149
+ if (__privateGet(this, _uiManager).hasCommentManager()) {
31150
+ __privateMethod(this, _FloatingToolbar_instances, makeButton_fn).call(this, "commentButton", `pdfjs-comment-floating-button`, "pdfjs-comment-floating-button-label", () => {
31151
+ __privateGet(this, _uiManager).commentSelection("floating_button");
31152
+ });
31153
+ }
31154
+ __privateMethod(this, _FloatingToolbar_instances, makeButton_fn).call(this, "highlightButton", `pdfjs-highlight-floating-button1`, "pdfjs-highlight-floating-button-label", () => {
31155
+ __privateGet(this, _uiManager).highlightSelection("floating_button");
31156
+ });
31548
31157
  return editToolbar;
31549
31158
  };
31550
31159
  getLastPoint_fn = function(boxes, isLTR) {
@@ -31571,24 +31180,24 @@ getLastPoint_fn = function(boxes, isLTR) {
31571
31180
  }
31572
31181
  return [isLTR ? 1 - lastX : lastX, lastY];
31573
31182
  };
31574
- addHighlightButton_fn = function() {
31183
+ makeButton_fn = function(buttonClass, l10nId, labelL10nId, clickHandler) {
31575
31184
  const button = document.createElement("button");
31576
- button.className = "highlightButton";
31185
+ button.classList.add("basic", buttonClass);
31577
31186
  button.tabIndex = 0;
31578
- button.setAttribute("data-l10n-id", `pdfjs-highlight-floating-button1`);
31187
+ button.setAttribute("data-l10n-id", l10nId);
31579
31188
  const span = document.createElement("span");
31580
31189
  button.append(span);
31581
31190
  span.className = "visuallyHidden";
31582
- span.setAttribute("data-l10n-id", "pdfjs-highlight-floating-button-label");
31191
+ span.setAttribute("data-l10n-id", labelL10nId);
31583
31192
  const signal = __privateGet(this, _uiManager)._signal;
31584
- button.addEventListener("contextmenu", noContextMenu, {
31585
- signal
31586
- });
31587
- button.addEventListener("click", () => {
31588
- __privateGet(this, _uiManager).highlightSelection("floating_button");
31589
- }, {
31590
- signal
31591
- });
31193
+ if (signal instanceof AbortSignal && !signal.aborted) {
31194
+ button.addEventListener("contextmenu", noContextMenu, {
31195
+ signal
31196
+ });
31197
+ button.addEventListener("click", clickHandler, {
31198
+ signal
31199
+ });
31200
+ }
31592
31201
  __privateGet(this, _buttons2).append(button);
31593
31202
  };
31594
31203
  function bindEvents(obj, element, names) {
@@ -32006,6 +31615,7 @@ const _AnnotationEditorUIManager = class _AnnotationEditorUIManager {
32006
31615
  __privateAdd(this, _AnnotationEditorUIManager_instances);
32007
31616
  __privateAdd(this, _abortController, new AbortController());
32008
31617
  __privateAdd(this, _activeEditor, null);
31618
+ __privateAdd(this, _allEditableAnnotations, null);
32009
31619
  __privateAdd(this, _allEditors, /* @__PURE__ */ new Map());
32010
31620
  __privateAdd(this, _allLayers, /* @__PURE__ */ new Map());
32011
31621
  __privateAdd(this, _altTextManager, null);
@@ -32029,9 +31639,10 @@ const _AnnotationEditorUIManager = class _AnnotationEditorUIManager {
32029
31639
  __privateAdd(this, _focusManagerAC, null);
32030
31640
  __privateAdd(this, _highlightColors, null);
32031
31641
  __privateAdd(this, _highlightWhenShiftUp, false);
32032
- __privateAdd(this, _highlightToolbar, null);
31642
+ __privateAdd(this, _floatingToolbar, null);
32033
31643
  __privateAdd(this, _idManager, new IdManager());
32034
31644
  __privateAdd(this, _isEnabled, false);
31645
+ __privateAdd(this, _isPointerDown, false);
32035
31646
  __privateAdd(this, _isWaiting, false);
32036
31647
  __privateAdd(this, _keyboardManagerAC, null);
32037
31648
  __privateAdd(this, _lastActiveElement, null);
@@ -32044,6 +31655,7 @@ const _AnnotationEditorUIManager = class _AnnotationEditorUIManager {
32044
31655
  __privateAdd(this, _signatureManager, null);
32045
31656
  __privateAdd(this, _pageColors, null);
32046
31657
  __privateAdd(this, _showAllStates, null);
31658
+ __privateAdd(this, _pdfDocument, null);
32047
31659
  __privateAdd(this, _previousStates, {
32048
31660
  isEditing: false,
32049
31661
  isEmpty: true,
@@ -32065,6 +31677,7 @@ const _AnnotationEditorUIManager = class _AnnotationEditorUIManager {
32065
31677
  __privateSet(this, _altTextManager, altTextManager);
32066
31678
  __privateSet(this, _commentManager, commentManager);
32067
31679
  __privateSet(this, _signatureManager, signatureManager);
31680
+ __privateSet(this, _pdfDocument, pdfDocument);
32068
31681
  this._eventBus = eventBus;
32069
31682
  eventBus._on("editingaction", this.onEditingAction.bind(this), {
32070
31683
  signal
@@ -32084,6 +31697,18 @@ const _AnnotationEditorUIManager = class _AnnotationEditorUIManager {
32084
31697
  eventBus._on("switchannotationeditorparams", (evt) => this.updateParams(evt.type, evt.value), {
32085
31698
  signal
32086
31699
  });
31700
+ window.addEventListener("pointerdown", () => {
31701
+ __privateSet(this, _isPointerDown, true);
31702
+ }, {
31703
+ capture: true,
31704
+ signal
31705
+ });
31706
+ window.addEventListener("pointerup", () => {
31707
+ __privateSet(this, _isPointerDown, false);
31708
+ }, {
31709
+ capture: true,
31710
+ signal
31711
+ });
32087
31712
  __privateMethod(this, _AnnotationEditorUIManager_instances, addSelectionListener_fn).call(this);
32088
31713
  __privateMethod(this, _AnnotationEditorUIManager_instances, addDragAndDropListeners_fn).call(this);
32089
31714
  __privateMethod(this, _AnnotationEditorUIManager_instances, addKeyboardManager_fn).call(this);
@@ -32181,10 +31806,11 @@ const _AnnotationEditorUIManager = class _AnnotationEditorUIManager {
32181
31806
  (_d = __privateGet(this, _altTextManager)) == null ? void 0 : _d.destroy();
32182
31807
  (_e = __privateGet(this, _commentManager)) == null ? void 0 : _e.destroy();
32183
31808
  (_f = __privateGet(this, _signatureManager)) == null ? void 0 : _f.destroy();
32184
- (_g2 = __privateGet(this, _highlightToolbar)) == null ? void 0 : _g2.hide();
32185
- __privateSet(this, _highlightToolbar, null);
31809
+ (_g2 = __privateGet(this, _floatingToolbar)) == null ? void 0 : _g2.hide();
31810
+ __privateSet(this, _floatingToolbar, null);
32186
31811
  (_h = __privateGet(this, _mainHighlightColorPicker)) == null ? void 0 : _h.destroy();
32187
31812
  __privateSet(this, _mainHighlightColorPicker, null);
31813
+ __privateSet(this, _allEditableAnnotations, null);
32188
31814
  if (__privateGet(this, _focusMainContainerTimeoutId)) {
32189
31815
  clearTimeout(__privateGet(this, _focusMainContainerTimeoutId));
32190
31816
  __privateSet(this, _focusMainContainerTimeoutId, null);
@@ -32194,6 +31820,7 @@ const _AnnotationEditorUIManager = class _AnnotationEditorUIManager {
32194
31820
  __privateSet(this, _translationTimeoutId, null);
32195
31821
  }
32196
31822
  (_i = this._editorUndoBar) == null ? void 0 : _i.destroy();
31823
+ __privateSet(this, _pdfDocument, null);
32197
31824
  }
32198
31825
  combinedSignal(ac) {
32199
31826
  return AbortSignal.any([this._signal, ac.signal]);
@@ -32362,7 +31989,7 @@ const _AnnotationEditorUIManager = class _AnnotationEditorUIManager {
32362
31989
  this.commitOrRemove();
32363
31990
  this.viewParameters.rotation = pagesRotation;
32364
31991
  }
32365
- highlightSelection(methodOfCreation = "") {
31992
+ highlightSelection(methodOfCreation = "", comment = false) {
32366
31993
  const selection = document.getSelection();
32367
31994
  if (!selection || selection.isCollapsed) {
32368
31995
  return;
@@ -32384,7 +32011,7 @@ const _AnnotationEditorUIManager = class _AnnotationEditorUIManager {
32384
32011
  const layer = __privateMethod(this, _AnnotationEditorUIManager_instances, getLayerForTextLayer_fn).call(this, textLayer);
32385
32012
  const isNoneMode = __privateGet(this, _mode) === AnnotationEditorType.NONE;
32386
32013
  const callback = () => {
32387
- layer == null ? void 0 : layer.createAndAddNewEditor({
32014
+ const editor = layer == null ? void 0 : layer.createAndAddNewEditor({
32388
32015
  x: 0,
32389
32016
  y: 0
32390
32017
  }, false, {
@@ -32399,6 +32026,9 @@ const _AnnotationEditorUIManager = class _AnnotationEditorUIManager {
32399
32026
  if (isNoneMode) {
32400
32027
  this.showAllEditors("highlight", true, true);
32401
32028
  }
32029
+ if (comment) {
32030
+ editor == null ? void 0 : editor.editComment();
32031
+ }
32402
32032
  };
32403
32033
  if (isNoneMode) {
32404
32034
  this.switchToMode(AnnotationEditorType.HIGHLIGHT, callback);
@@ -32406,6 +32036,9 @@ const _AnnotationEditorUIManager = class _AnnotationEditorUIManager {
32406
32036
  }
32407
32037
  callback();
32408
32038
  }
32039
+ commentSelection(methodOfCreation = "") {
32040
+ this.highlightSelection(methodOfCreation, true);
32041
+ }
32409
32042
  addToAnnotationStorage(editor) {
32410
32043
  if (!editor.isEmpty() && __privateGet(this, _annotationStorage) && !__privateGet(this, _annotationStorage).has(editor.id)) {
32411
32044
  __privateGet(this, _annotationStorage).setValue(editor.id, editor);
@@ -32601,6 +32234,9 @@ const _AnnotationEditorUIManager = class _AnnotationEditorUIManager {
32601
32234
  case "highlightSelection":
32602
32235
  this.highlightSelection("context_menu");
32603
32236
  break;
32237
+ case "commentSelection":
32238
+ this.commentSelection("context_menu");
32239
+ break;
32604
32240
  }
32605
32241
  }
32606
32242
  setEditingState(isEditing) {
@@ -32657,7 +32293,7 @@ const _AnnotationEditorUIManager = class _AnnotationEditorUIManager {
32657
32293
  }
32658
32294
  updateMode(mode, editId = null, isFromKeyboard = false, mustEnterInEditMode = false, editComment = false) {
32659
32295
  return __async(this, null, function* () {
32660
- var _a2, _b2, _c;
32296
+ var _a2, _b2, _c, _d, _e;
32661
32297
  if (__privateGet(this, _mode) === mode) {
32662
32298
  return;
32663
32299
  }
@@ -32669,16 +32305,23 @@ const _AnnotationEditorUIManager = class _AnnotationEditorUIManager {
32669
32305
  }
32670
32306
  __privateSet(this, _updateModeCapability, Promise.withResolvers());
32671
32307
  (_a2 = __privateGet(this, _currentDrawingSession)) == null ? void 0 : _a2.commitOrRemove();
32308
+ if (__privateGet(this, _mode) === AnnotationEditorType.POPUP) {
32309
+ (_b2 = __privateGet(this, _commentManager)) == null ? void 0 : _b2.hideSidebar();
32310
+ }
32672
32311
  __privateSet(this, _mode, mode);
32673
32312
  if (mode === AnnotationEditorType.NONE) {
32674
32313
  this.setEditingState(false);
32675
32314
  __privateMethod(this, _AnnotationEditorUIManager_instances, disableAll_fn).call(this);
32676
- (_b2 = this._editorUndoBar) == null ? void 0 : _b2.hide();
32315
+ (_c = this._editorUndoBar) == null ? void 0 : _c.hide();
32677
32316
  __privateGet(this, _updateModeCapability).resolve();
32678
32317
  return;
32679
32318
  }
32680
32319
  if (mode === AnnotationEditorType.SIGNATURE) {
32681
- yield (_c = __privateGet(this, _signatureManager)) == null ? void 0 : _c.loadSignatures();
32320
+ yield (_d = __privateGet(this, _signatureManager)) == null ? void 0 : _d.loadSignatures();
32321
+ }
32322
+ if (mode === AnnotationEditorType.POPUP) {
32323
+ __privateGet(this, _allEditableAnnotations) || __privateSet(this, _allEditableAnnotations, yield __privateGet(this, _pdfDocument).getAnnotationsByType(new Set(__privateGet(this, _editorTypes).map((editorClass) => editorClass._editorType))));
32324
+ (_e = __privateGet(this, _commentManager)) == null ? void 0 : _e.showSidebar(__privateGet(this, _allEditableAnnotations));
32682
32325
  }
32683
32326
  this.setEditingState(true);
32684
32327
  yield __privateMethod(this, _AnnotationEditorUIManager_instances, enableAll_fn).call(this);
@@ -33258,6 +32901,7 @@ const _AnnotationEditorUIManager = class _AnnotationEditorUIManager {
33258
32901
  };
33259
32902
  _abortController = new WeakMap();
33260
32903
  _activeEditor = new WeakMap();
32904
+ _allEditableAnnotations = new WeakMap();
33261
32905
  _allEditors = new WeakMap();
33262
32906
  _allLayers = new WeakMap();
33263
32907
  _altTextManager = new WeakMap();
@@ -33280,9 +32924,10 @@ _focusMainContainerTimeoutId = new WeakMap();
33280
32924
  _focusManagerAC = new WeakMap();
33281
32925
  _highlightColors = new WeakMap();
33282
32926
  _highlightWhenShiftUp = new WeakMap();
33283
- _highlightToolbar = new WeakMap();
32927
+ _floatingToolbar = new WeakMap();
33284
32928
  _idManager = new WeakMap();
33285
32929
  _isEnabled = new WeakMap();
32930
+ _isPointerDown = new WeakMap();
33286
32931
  _isWaiting = new WeakMap();
33287
32932
  _keyboardManagerAC = new WeakMap();
33288
32933
  _lastActiveElement = new WeakMap();
@@ -33295,6 +32940,7 @@ _selectedTextNode = new WeakMap();
33295
32940
  _signatureManager = new WeakMap();
33296
32941
  _pageColors = new WeakMap();
33297
32942
  _showAllStates = new WeakMap();
32943
+ _pdfDocument = new WeakMap();
33298
32944
  _previousStates = new WeakMap();
33299
32945
  _translation = new WeakMap();
33300
32946
  _translationTimeoutId = new WeakMap();
@@ -33322,7 +32968,7 @@ getLayerForTextLayer_fn = function(textLayer) {
33322
32968
  }
33323
32969
  return null;
33324
32970
  };
33325
- displayHighlightToolbar_fn = function() {
32971
+ displayFloatingToolbar_fn = function() {
33326
32972
  const selection = document.getSelection();
33327
32973
  if (!selection || selection.isCollapsed) {
33328
32974
  return;
@@ -33333,15 +32979,15 @@ displayHighlightToolbar_fn = function() {
33333
32979
  if (!boxes) {
33334
32980
  return;
33335
32981
  }
33336
- __privateGet(this, _highlightToolbar) || __privateSet(this, _highlightToolbar, new HighlightToolbar(this));
33337
- __privateGet(this, _highlightToolbar).show(textLayer, boxes, this.direction === "ltr");
32982
+ __privateGet(this, _floatingToolbar) || __privateSet(this, _floatingToolbar, new FloatingToolbar(this));
32983
+ __privateGet(this, _floatingToolbar).show(textLayer, boxes, this.direction === "ltr");
33338
32984
  };
33339
32985
  selectionChange_fn = function() {
33340
32986
  var _a2, _b2, _c;
33341
32987
  const selection = document.getSelection();
33342
32988
  if (!selection || selection.isCollapsed) {
33343
32989
  if (__privateGet(this, _selectedTextNode)) {
33344
- (_a2 = __privateGet(this, _highlightToolbar)) == null ? void 0 : _a2.hide();
32990
+ (_a2 = __privateGet(this, _floatingToolbar)) == null ? void 0 : _a2.hide();
33345
32991
  __privateSet(this, _selectedTextNode, null);
33346
32992
  __privateMethod(this, _AnnotationEditorUIManager_instances, dispatchUpdateStates_fn).call(this, {
33347
32993
  hasSelectedText: false
@@ -33359,7 +33005,7 @@ selectionChange_fn = function() {
33359
33005
  const textLayer = anchorElement.closest(".textLayer");
33360
33006
  if (!textLayer) {
33361
33007
  if (__privateGet(this, _selectedTextNode)) {
33362
- (_b2 = __privateGet(this, _highlightToolbar)) == null ? void 0 : _b2.hide();
33008
+ (_b2 = __privateGet(this, _floatingToolbar)) == null ? void 0 : _b2.hide();
33363
33009
  __privateSet(this, _selectedTextNode, null);
33364
33010
  __privateMethod(this, _AnnotationEditorUIManager_instances, dispatchUpdateStates_fn).call(this, {
33365
33011
  hasSelectedText: false
@@ -33367,7 +33013,7 @@ selectionChange_fn = function() {
33367
33013
  }
33368
33014
  return;
33369
33015
  }
33370
- (_c = __privateGet(this, _highlightToolbar)) == null ? void 0 : _c.hide();
33016
+ (_c = __privateGet(this, _floatingToolbar)) == null ? void 0 : _c.hide();
33371
33017
  __privateSet(this, _selectedTextNode, anchorNode);
33372
33018
  __privateMethod(this, _AnnotationEditorUIManager_instances, dispatchUpdateStates_fn).call(this, {
33373
33019
  hasSelectedText: true
@@ -33382,31 +33028,36 @@ selectionChange_fn = function() {
33382
33028
  if (!this.isShiftKeyDown) {
33383
33029
  const activeLayer = __privateGet(this, _mode) === AnnotationEditorType.HIGHLIGHT ? __privateMethod(this, _AnnotationEditorUIManager_instances, getLayerForTextLayer_fn).call(this, textLayer) : null;
33384
33030
  activeLayer == null ? void 0 : activeLayer.toggleDrawing();
33385
- const ac = new AbortController();
33386
- const signal = this.combinedSignal(ac);
33387
- const pointerup = (e2) => {
33388
- if (e2.type === "pointerup" && e2.button !== 0) {
33389
- return;
33390
- }
33391
- ac.abort();
33031
+ if (__privateGet(this, _isPointerDown)) {
33032
+ const ac = new AbortController();
33033
+ const signal = this.combinedSignal(ac);
33034
+ const pointerup = (e2) => {
33035
+ if (e2.type === "pointerup" && e2.button !== 0) {
33036
+ return;
33037
+ }
33038
+ ac.abort();
33039
+ activeLayer == null ? void 0 : activeLayer.toggleDrawing(true);
33040
+ if (e2.type === "pointerup") {
33041
+ __privateMethod(this, _AnnotationEditorUIManager_instances, onSelectEnd_fn).call(this, "main_toolbar");
33042
+ }
33043
+ };
33044
+ window.addEventListener("pointerup", pointerup, {
33045
+ signal
33046
+ });
33047
+ window.addEventListener("blur", pointerup, {
33048
+ signal
33049
+ });
33050
+ } else {
33392
33051
  activeLayer == null ? void 0 : activeLayer.toggleDrawing(true);
33393
- if (e2.type === "pointerup") {
33394
- __privateMethod(this, _AnnotationEditorUIManager_instances, onSelectEnd_fn).call(this, "main_toolbar");
33395
- }
33396
- };
33397
- window.addEventListener("pointerup", pointerup, {
33398
- signal
33399
- });
33400
- window.addEventListener("blur", pointerup, {
33401
- signal
33402
- });
33052
+ __privateMethod(this, _AnnotationEditorUIManager_instances, onSelectEnd_fn).call(this, "main_toolbar");
33053
+ }
33403
33054
  }
33404
33055
  };
33405
33056
  onSelectEnd_fn = function(methodOfCreation = "") {
33406
33057
  if (__privateGet(this, _mode) === AnnotationEditorType.HIGHLIGHT) {
33407
33058
  this.highlightSelection(methodOfCreation);
33408
33059
  } else if (__privateGet(this, _enableHighlightFloatingButton)) {
33409
- __privateMethod(this, _AnnotationEditorUIManager_instances, displayHighlightToolbar_fn).call(this);
33060
+ __privateMethod(this, _AnnotationEditorUIManager_instances, displayFloatingToolbar_fn).call(this);
33410
33061
  }
33411
33062
  };
33412
33063
  addSelectionListener_fn = function() {
@@ -33880,6 +33531,9 @@ class Comment {
33880
33531
  comment.tabIndex = "0";
33881
33532
  comment.setAttribute("data-l10n-id", "pdfjs-editor-edit-comment-button");
33882
33533
  const signal = __privateGet(this, _editor3)._uiManager._signal;
33534
+ if (!(signal instanceof AbortSignal) || signal.aborted) {
33535
+ return comment;
33536
+ }
33883
33537
  comment.addEventListener("contextmenu", noContextMenu, {
33884
33538
  signal
33885
33539
  });
@@ -34632,7 +34286,6 @@ const _AnnotationEditor = class _AnnotationEditor {
34632
34286
  }
34633
34287
  this._editToolbar = new EditorToolbar(this);
34634
34288
  this.div.append(this._editToolbar.render());
34635
- this._editToolbar.addButton("comment", this.addCommentButton());
34636
34289
  const {
34637
34290
  toolbarButtons
34638
34291
  } = this;
@@ -34641,6 +34294,7 @@ const _AnnotationEditor = class _AnnotationEditor {
34641
34294
  yield this._editToolbar.addButton(name, tool);
34642
34295
  }
34643
34296
  }
34297
+ this._editToolbar.addButton("comment", this.addCommentButton());
34644
34298
  this._editToolbar.addButton("delete");
34645
34299
  return this._editToolbar;
34646
34300
  });
@@ -34752,9 +34406,18 @@ const _AnnotationEditor = class _AnnotationEditor {
34752
34406
  }
34753
34407
  addComment(serialized) {
34754
34408
  if (this.hasEditedComment) {
34409
+ const DEFAULT_POPUP_WIDTH = 180;
34410
+ const DEFAULT_POPUP_HEIGHT = 100;
34411
+ const [, , , trY] = serialized.rect;
34412
+ const [pageWidth] = this.pageDimensions;
34413
+ const [pageX] = this.pageTranslation;
34414
+ const blX = pageX + pageWidth + 1;
34415
+ const blY = trY - DEFAULT_POPUP_HEIGHT;
34416
+ const trX = blX + DEFAULT_POPUP_WIDTH;
34755
34417
  serialized.popup = {
34756
34418
  contents: this.comment.text,
34757
- deleted: this.comment.deleted
34419
+ deleted: this.comment.deleted,
34420
+ rect: [blX, blY, trX, trY]
34758
34421
  };
34759
34422
  }
34760
34423
  }
@@ -34871,6 +34534,9 @@ const _AnnotationEditor = class _AnnotationEditor {
34871
34534
  throw new Error("Invalid rotation");
34872
34535
  }
34873
34536
  }
34537
+ getPDFRect() {
34538
+ return this.getRect(0, 0);
34539
+ }
34874
34540
  onceAdded(focus) {
34875
34541
  }
34876
34542
  isEmpty() {
@@ -35225,6 +34891,10 @@ const _AnnotationEditor = class _AnnotationEditor {
35225
34891
  __privateSet(this, _disabled, true);
35226
34892
  }
35227
34893
  renderAnnotationElement(annotation) {
34894
+ if (this.deleted) {
34895
+ annotation.hide();
34896
+ return null;
34897
+ }
35228
34898
  let content2 = annotation.container.querySelector(".annotationContent");
35229
34899
  if (!content2) {
35230
34900
  content2 = document.createElement("div");
@@ -37319,6 +36989,493 @@ class NodeWasmFactory extends BaseWasmFactory {
37319
36989
  });
37320
36990
  }
37321
36991
  }
36992
+ const FORCED_DEPENDENCY_LABEL = "__forcedDependency";
36993
+ class CanvasDependencyTracker {
36994
+ constructor(canvas2) {
36995
+ __privateAdd(this, _simple, {
36996
+ __proto__: null
36997
+ });
36998
+ __privateAdd(this, _incremental, {
36999
+ __proto__: null,
37000
+ transform: [],
37001
+ moveText: [],
37002
+ sameLineText: [],
37003
+ [FORCED_DEPENDENCY_LABEL]: []
37004
+ });
37005
+ __privateAdd(this, _namedDependencies, /* @__PURE__ */ new Map());
37006
+ __privateAdd(this, _savesStack, []);
37007
+ __privateAdd(this, _markedContentStack, []);
37008
+ __privateAdd(this, _baseTransformStack, [[1, 0, 0, 1, 0, 0]]);
37009
+ __privateAdd(this, _clipBox, [-Infinity, -Infinity, Infinity, Infinity]);
37010
+ __privateAdd(this, _pendingBBox, new Float64Array([Infinity, Infinity, -Infinity, -Infinity]));
37011
+ __privateAdd(this, _pendingBBoxIdx, -1);
37012
+ __privateAdd(this, _pendingDependencies, /* @__PURE__ */ new Set());
37013
+ __privateAdd(this, _operations, /* @__PURE__ */ new Map());
37014
+ __privateAdd(this, _fontBBoxTrustworthy, /* @__PURE__ */ new Map());
37015
+ __privateAdd(this, _canvasWidth);
37016
+ __privateAdd(this, _canvasHeight);
37017
+ __privateSet(this, _canvasWidth, canvas2.width);
37018
+ __privateSet(this, _canvasHeight, canvas2.height);
37019
+ }
37020
+ save(opIdx) {
37021
+ __privateSet(this, _simple, {
37022
+ __proto__: __privateGet(this, _simple)
37023
+ });
37024
+ __privateSet(this, _incremental, {
37025
+ __proto__: __privateGet(this, _incremental),
37026
+ transform: {
37027
+ __proto__: __privateGet(this, _incremental).transform
37028
+ },
37029
+ moveText: {
37030
+ __proto__: __privateGet(this, _incremental).moveText
37031
+ },
37032
+ sameLineText: {
37033
+ __proto__: __privateGet(this, _incremental).sameLineText
37034
+ },
37035
+ [FORCED_DEPENDENCY_LABEL]: {
37036
+ __proto__: __privateGet(this, _incremental)[FORCED_DEPENDENCY_LABEL]
37037
+ }
37038
+ });
37039
+ __privateSet(this, _clipBox, {
37040
+ __proto__: __privateGet(this, _clipBox)
37041
+ });
37042
+ __privateGet(this, _savesStack).push([opIdx, null]);
37043
+ return this;
37044
+ }
37045
+ restore(opIdx) {
37046
+ const previous = Object.getPrototypeOf(__privateGet(this, _simple));
37047
+ if (previous === null) {
37048
+ return this;
37049
+ }
37050
+ __privateSet(this, _simple, previous);
37051
+ __privateSet(this, _incremental, Object.getPrototypeOf(__privateGet(this, _incremental)));
37052
+ __privateSet(this, _clipBox, Object.getPrototypeOf(__privateGet(this, _clipBox)));
37053
+ const lastPair = __privateGet(this, _savesStack).pop();
37054
+ if (lastPair !== void 0) {
37055
+ lastPair[1] = opIdx;
37056
+ }
37057
+ return this;
37058
+ }
37059
+ recordOpenMarker(idx) {
37060
+ __privateGet(this, _savesStack).push([idx, null]);
37061
+ return this;
37062
+ }
37063
+ getOpenMarker() {
37064
+ if (__privateGet(this, _savesStack).length === 0) {
37065
+ return null;
37066
+ }
37067
+ return __privateGet(this, _savesStack).at(-1)[0];
37068
+ }
37069
+ recordCloseMarker(idx) {
37070
+ const lastPair = __privateGet(this, _savesStack).pop();
37071
+ if (lastPair !== void 0) {
37072
+ lastPair[1] = idx;
37073
+ }
37074
+ return this;
37075
+ }
37076
+ beginMarkedContent(opIdx) {
37077
+ __privateGet(this, _markedContentStack).push([opIdx, null]);
37078
+ return this;
37079
+ }
37080
+ endMarkedContent(opIdx) {
37081
+ const lastPair = __privateGet(this, _markedContentStack).pop();
37082
+ if (lastPair !== void 0) {
37083
+ lastPair[1] = opIdx;
37084
+ }
37085
+ return this;
37086
+ }
37087
+ pushBaseTransform(ctx) {
37088
+ __privateGet(this, _baseTransformStack).push(Util.multiplyByDOMMatrix(__privateGet(this, _baseTransformStack).at(-1), ctx.getTransform()));
37089
+ return this;
37090
+ }
37091
+ popBaseTransform() {
37092
+ if (__privateGet(this, _baseTransformStack).length > 1) {
37093
+ __privateGet(this, _baseTransformStack).pop();
37094
+ }
37095
+ return this;
37096
+ }
37097
+ recordSimpleData(name, idx) {
37098
+ __privateGet(this, _simple)[name] = idx;
37099
+ return this;
37100
+ }
37101
+ recordIncrementalData(name, idx) {
37102
+ __privateGet(this, _incremental)[name].push(idx);
37103
+ return this;
37104
+ }
37105
+ resetIncrementalData(name, idx) {
37106
+ __privateGet(this, _incremental)[name].length = 0;
37107
+ return this;
37108
+ }
37109
+ recordNamedData(name, idx) {
37110
+ __privateGet(this, _namedDependencies).set(name, idx);
37111
+ return this;
37112
+ }
37113
+ recordFutureForcedDependency(name, idx) {
37114
+ this.recordIncrementalData(FORCED_DEPENDENCY_LABEL, idx);
37115
+ return this;
37116
+ }
37117
+ inheritSimpleDataAsFutureForcedDependencies(names) {
37118
+ for (const name of names) {
37119
+ if (name in __privateGet(this, _simple)) {
37120
+ this.recordFutureForcedDependency(name, __privateGet(this, _simple)[name]);
37121
+ }
37122
+ }
37123
+ return this;
37124
+ }
37125
+ inheritPendingDependenciesAsFutureForcedDependencies() {
37126
+ for (const dep of __privateGet(this, _pendingDependencies)) {
37127
+ this.recordFutureForcedDependency(FORCED_DEPENDENCY_LABEL, dep);
37128
+ }
37129
+ return this;
37130
+ }
37131
+ resetBBox(idx) {
37132
+ __privateSet(this, _pendingBBoxIdx, idx);
37133
+ __privateGet(this, _pendingBBox)[0] = Infinity;
37134
+ __privateGet(this, _pendingBBox)[1] = Infinity;
37135
+ __privateGet(this, _pendingBBox)[2] = -Infinity;
37136
+ __privateGet(this, _pendingBBox)[3] = -Infinity;
37137
+ return this;
37138
+ }
37139
+ get hasPendingBBox() {
37140
+ return __privateGet(this, _pendingBBoxIdx) !== -1;
37141
+ }
37142
+ recordClipBox(idx, ctx, minX, maxX, minY, maxY) {
37143
+ const transform2 = Util.multiplyByDOMMatrix(__privateGet(this, _baseTransformStack).at(-1), ctx.getTransform());
37144
+ const clipBox = [Infinity, Infinity, -Infinity, -Infinity];
37145
+ Util.axialAlignedBoundingBox([minX, minY, maxX, maxY], transform2, clipBox);
37146
+ const intersection = Util.intersect(__privateGet(this, _clipBox), clipBox);
37147
+ if (intersection) {
37148
+ __privateGet(this, _clipBox)[0] = intersection[0];
37149
+ __privateGet(this, _clipBox)[1] = intersection[1];
37150
+ __privateGet(this, _clipBox)[2] = intersection[2];
37151
+ __privateGet(this, _clipBox)[3] = intersection[3];
37152
+ } else {
37153
+ __privateGet(this, _clipBox)[0] = __privateGet(this, _clipBox)[1] = Infinity;
37154
+ __privateGet(this, _clipBox)[2] = __privateGet(this, _clipBox)[3] = -Infinity;
37155
+ }
37156
+ return this;
37157
+ }
37158
+ recordBBox(idx, ctx, minX, maxX, minY, maxY) {
37159
+ const clipBox = __privateGet(this, _clipBox);
37160
+ if (clipBox[0] === Infinity) {
37161
+ return this;
37162
+ }
37163
+ const transform2 = Util.multiplyByDOMMatrix(__privateGet(this, _baseTransformStack).at(-1), ctx.getTransform());
37164
+ if (clipBox[0] === -Infinity) {
37165
+ Util.axialAlignedBoundingBox([minX, minY, maxX, maxY], transform2, __privateGet(this, _pendingBBox));
37166
+ return this;
37167
+ }
37168
+ const bbox = [Infinity, Infinity, -Infinity, -Infinity];
37169
+ Util.axialAlignedBoundingBox([minX, minY, maxX, maxY], transform2, bbox);
37170
+ __privateGet(this, _pendingBBox)[0] = Math.min(__privateGet(this, _pendingBBox)[0], Math.max(bbox[0], clipBox[0]));
37171
+ __privateGet(this, _pendingBBox)[1] = Math.min(__privateGet(this, _pendingBBox)[1], Math.max(bbox[1], clipBox[1]));
37172
+ __privateGet(this, _pendingBBox)[2] = Math.max(__privateGet(this, _pendingBBox)[2], Math.min(bbox[2], clipBox[2]));
37173
+ __privateGet(this, _pendingBBox)[3] = Math.max(__privateGet(this, _pendingBBox)[3], Math.min(bbox[3], clipBox[3]));
37174
+ return this;
37175
+ }
37176
+ recordCharacterBBox(idx, ctx, font, scale = 1, x2 = 0, y2 = 0, getMeasure) {
37177
+ const fontBBox = font.bbox;
37178
+ let isBBoxTrustworthy;
37179
+ let computedBBox;
37180
+ if (fontBBox) {
37181
+ isBBoxTrustworthy = fontBBox[2] !== fontBBox[0] && fontBBox[3] !== fontBBox[1] && __privateGet(this, _fontBBoxTrustworthy).get(font);
37182
+ if (isBBoxTrustworthy !== false) {
37183
+ computedBBox = [0, 0, 0, 0];
37184
+ Util.axialAlignedBoundingBox(fontBBox, font.fontMatrix, computedBBox);
37185
+ if (scale !== 1 || x2 !== 0 || y2 !== 0) {
37186
+ Util.scaleMinMax([scale, 0, 0, -scale, x2, y2], computedBBox);
37187
+ }
37188
+ if (isBBoxTrustworthy) {
37189
+ return this.recordBBox(idx, ctx, computedBBox[0], computedBBox[2], computedBBox[1], computedBBox[3]);
37190
+ }
37191
+ }
37192
+ }
37193
+ if (!getMeasure) {
37194
+ return this.recordFullPageBBox(idx);
37195
+ }
37196
+ const measure = getMeasure();
37197
+ if (fontBBox && computedBBox && isBBoxTrustworthy === void 0) {
37198
+ isBBoxTrustworthy = computedBBox[0] <= x2 - measure.actualBoundingBoxLeft && computedBBox[2] >= x2 + measure.actualBoundingBoxRight && computedBBox[1] <= y2 - measure.actualBoundingBoxAscent && computedBBox[3] >= y2 + measure.actualBoundingBoxDescent;
37199
+ __privateGet(this, _fontBBoxTrustworthy).set(font, isBBoxTrustworthy);
37200
+ if (isBBoxTrustworthy) {
37201
+ return this.recordBBox(idx, ctx, computedBBox[0], computedBBox[2], computedBBox[1], computedBBox[3]);
37202
+ }
37203
+ }
37204
+ return this.recordBBox(idx, ctx, x2 - measure.actualBoundingBoxLeft, x2 + measure.actualBoundingBoxRight, y2 - measure.actualBoundingBoxAscent, y2 + measure.actualBoundingBoxDescent);
37205
+ }
37206
+ recordFullPageBBox(idx) {
37207
+ __privateGet(this, _pendingBBox)[0] = Math.max(0, __privateGet(this, _clipBox)[0]);
37208
+ __privateGet(this, _pendingBBox)[1] = Math.max(0, __privateGet(this, _clipBox)[1]);
37209
+ __privateGet(this, _pendingBBox)[2] = Math.min(__privateGet(this, _canvasWidth), __privateGet(this, _clipBox)[2]);
37210
+ __privateGet(this, _pendingBBox)[3] = Math.min(__privateGet(this, _canvasHeight), __privateGet(this, _clipBox)[3]);
37211
+ return this;
37212
+ }
37213
+ getSimpleIndex(dependencyName) {
37214
+ return __privateGet(this, _simple)[dependencyName];
37215
+ }
37216
+ recordDependencies(idx, dependencyNames) {
37217
+ const pendingDependencies = __privateGet(this, _pendingDependencies);
37218
+ const simple = __privateGet(this, _simple);
37219
+ const incremental = __privateGet(this, _incremental);
37220
+ for (const name of dependencyNames) {
37221
+ if (name in __privateGet(this, _simple)) {
37222
+ pendingDependencies.add(simple[name]);
37223
+ } else if (name in incremental) {
37224
+ incremental[name].forEach(pendingDependencies.add, pendingDependencies);
37225
+ }
37226
+ }
37227
+ return this;
37228
+ }
37229
+ copyDependenciesFromIncrementalOperation(idx, name) {
37230
+ const operations = __privateGet(this, _operations);
37231
+ const pendingDependencies = __privateGet(this, _pendingDependencies);
37232
+ for (const depIdx of __privateGet(this, _incremental)[name]) {
37233
+ operations.get(depIdx).dependencies.forEach(pendingDependencies.add, pendingDependencies.add(depIdx));
37234
+ }
37235
+ return this;
37236
+ }
37237
+ recordNamedDependency(idx, name) {
37238
+ if (__privateGet(this, _namedDependencies).has(name)) {
37239
+ __privateGet(this, _pendingDependencies).add(__privateGet(this, _namedDependencies).get(name));
37240
+ }
37241
+ return this;
37242
+ }
37243
+ recordOperation(idx, preserveBbox = false) {
37244
+ this.recordDependencies(idx, [FORCED_DEPENDENCY_LABEL]);
37245
+ const dependencies = new Set(__privateGet(this, _pendingDependencies));
37246
+ const pairs = __privateGet(this, _savesStack).concat(__privateGet(this, _markedContentStack));
37247
+ const bbox = __privateGet(this, _pendingBBoxIdx) === idx ? {
37248
+ minX: __privateGet(this, _pendingBBox)[0],
37249
+ minY: __privateGet(this, _pendingBBox)[1],
37250
+ maxX: __privateGet(this, _pendingBBox)[2],
37251
+ maxY: __privateGet(this, _pendingBBox)[3]
37252
+ } : null;
37253
+ __privateGet(this, _operations).set(idx, {
37254
+ bbox,
37255
+ pairs,
37256
+ dependencies
37257
+ });
37258
+ if (!preserveBbox) {
37259
+ __privateSet(this, _pendingBBoxIdx, -1);
37260
+ }
37261
+ __privateGet(this, _pendingDependencies).clear();
37262
+ return this;
37263
+ }
37264
+ bboxToClipBoxDropOperation(idx) {
37265
+ if (__privateGet(this, _pendingBBoxIdx) !== -1) {
37266
+ __privateSet(this, _pendingBBoxIdx, -1);
37267
+ __privateGet(this, _clipBox)[0] = Math.max(__privateGet(this, _clipBox)[0], __privateGet(this, _pendingBBox)[0]);
37268
+ __privateGet(this, _clipBox)[1] = Math.max(__privateGet(this, _clipBox)[1], __privateGet(this, _pendingBBox)[1]);
37269
+ __privateGet(this, _clipBox)[2] = Math.min(__privateGet(this, _clipBox)[2], __privateGet(this, _pendingBBox)[2]);
37270
+ __privateGet(this, _clipBox)[3] = Math.min(__privateGet(this, _clipBox)[3], __privateGet(this, _pendingBBox)[3]);
37271
+ }
37272
+ __privateGet(this, _pendingDependencies).clear();
37273
+ return this;
37274
+ }
37275
+ _takePendingDependencies() {
37276
+ const pendingDependencies = __privateGet(this, _pendingDependencies);
37277
+ __privateSet(this, _pendingDependencies, /* @__PURE__ */ new Set());
37278
+ return pendingDependencies;
37279
+ }
37280
+ _extractOperation(idx) {
37281
+ const operation = __privateGet(this, _operations).get(idx);
37282
+ __privateGet(this, _operations).delete(idx);
37283
+ return operation;
37284
+ }
37285
+ _pushPendingDependencies(dependencies) {
37286
+ for (const dep of dependencies) {
37287
+ __privateGet(this, _pendingDependencies).add(dep);
37288
+ }
37289
+ }
37290
+ take() {
37291
+ __privateGet(this, _fontBBoxTrustworthy).clear();
37292
+ return Array.from(__privateGet(this, _operations), ([idx, {
37293
+ bbox,
37294
+ pairs,
37295
+ dependencies
37296
+ }]) => {
37297
+ var _a2, _b2, _c, _d;
37298
+ pairs.forEach((pair) => pair.forEach(dependencies.add, dependencies));
37299
+ dependencies.delete(idx);
37300
+ return {
37301
+ minX: ((_a2 = bbox == null ? void 0 : bbox.minX) != null ? _a2 : 0) / __privateGet(this, _canvasWidth),
37302
+ maxX: ((_b2 = bbox == null ? void 0 : bbox.maxX) != null ? _b2 : __privateGet(this, _canvasWidth)) / __privateGet(this, _canvasWidth),
37303
+ minY: ((_c = bbox == null ? void 0 : bbox.minY) != null ? _c : 0) / __privateGet(this, _canvasHeight),
37304
+ maxY: ((_d = bbox == null ? void 0 : bbox.maxY) != null ? _d : __privateGet(this, _canvasHeight)) / __privateGet(this, _canvasHeight),
37305
+ dependencies: Array.from(dependencies).sort((a2, b2) => a2 - b2),
37306
+ idx
37307
+ };
37308
+ });
37309
+ }
37310
+ }
37311
+ _simple = new WeakMap();
37312
+ _incremental = new WeakMap();
37313
+ _namedDependencies = new WeakMap();
37314
+ _savesStack = new WeakMap();
37315
+ _markedContentStack = new WeakMap();
37316
+ _baseTransformStack = new WeakMap();
37317
+ _clipBox = new WeakMap();
37318
+ _pendingBBox = new WeakMap();
37319
+ _pendingBBoxIdx = new WeakMap();
37320
+ _pendingDependencies = new WeakMap();
37321
+ _operations = new WeakMap();
37322
+ _fontBBoxTrustworthy = new WeakMap();
37323
+ _canvasWidth = new WeakMap();
37324
+ _canvasHeight = new WeakMap();
37325
+ const _CanvasNestedDependencyTracker = class _CanvasNestedDependencyTracker {
37326
+ constructor(dependencyTracker, opIdx) {
37327
+ __privateAdd(this, _dependencyTracker);
37328
+ __privateAdd(this, _opIdx);
37329
+ __privateAdd(this, _nestingLevel, 0);
37330
+ __privateAdd(this, _outerDependencies);
37331
+ __privateAdd(this, _savesLevel, 0);
37332
+ if (dependencyTracker instanceof _CanvasNestedDependencyTracker) {
37333
+ return dependencyTracker;
37334
+ }
37335
+ __privateSet(this, _dependencyTracker, dependencyTracker);
37336
+ __privateSet(this, _outerDependencies, dependencyTracker._takePendingDependencies());
37337
+ __privateSet(this, _opIdx, opIdx);
37338
+ }
37339
+ save(opIdx) {
37340
+ __privateWrapper(this, _savesLevel)._++;
37341
+ __privateGet(this, _dependencyTracker).save(__privateGet(this, _opIdx));
37342
+ return this;
37343
+ }
37344
+ restore(opIdx) {
37345
+ if (__privateGet(this, _savesLevel) > 0) {
37346
+ __privateGet(this, _dependencyTracker).restore(__privateGet(this, _opIdx));
37347
+ __privateWrapper(this, _savesLevel)._--;
37348
+ }
37349
+ return this;
37350
+ }
37351
+ recordOpenMarker(idx) {
37352
+ __privateWrapper(this, _nestingLevel)._++;
37353
+ return this;
37354
+ }
37355
+ getOpenMarker() {
37356
+ return __privateGet(this, _nestingLevel) > 0 ? __privateGet(this, _opIdx) : __privateGet(this, _dependencyTracker).getOpenMarker();
37357
+ }
37358
+ recordCloseMarker(idx) {
37359
+ __privateWrapper(this, _nestingLevel)._--;
37360
+ return this;
37361
+ }
37362
+ beginMarkedContent(opIdx) {
37363
+ return this;
37364
+ }
37365
+ endMarkedContent(opIdx) {
37366
+ return this;
37367
+ }
37368
+ pushBaseTransform(ctx) {
37369
+ __privateGet(this, _dependencyTracker).pushBaseTransform(ctx);
37370
+ return this;
37371
+ }
37372
+ popBaseTransform() {
37373
+ __privateGet(this, _dependencyTracker).popBaseTransform();
37374
+ return this;
37375
+ }
37376
+ recordSimpleData(name, idx) {
37377
+ __privateGet(this, _dependencyTracker).recordSimpleData(name, __privateGet(this, _opIdx));
37378
+ return this;
37379
+ }
37380
+ recordIncrementalData(name, idx) {
37381
+ __privateGet(this, _dependencyTracker).recordIncrementalData(name, __privateGet(this, _opIdx));
37382
+ return this;
37383
+ }
37384
+ resetIncrementalData(name, idx) {
37385
+ __privateGet(this, _dependencyTracker).resetIncrementalData(name, __privateGet(this, _opIdx));
37386
+ return this;
37387
+ }
37388
+ recordNamedData(name, idx) {
37389
+ return this;
37390
+ }
37391
+ recordFutureForcedDependency(name, idx) {
37392
+ __privateGet(this, _dependencyTracker).recordFutureForcedDependency(name, __privateGet(this, _opIdx));
37393
+ return this;
37394
+ }
37395
+ inheritSimpleDataAsFutureForcedDependencies(names) {
37396
+ __privateGet(this, _dependencyTracker).inheritSimpleDataAsFutureForcedDependencies(names);
37397
+ return this;
37398
+ }
37399
+ inheritPendingDependenciesAsFutureForcedDependencies() {
37400
+ __privateGet(this, _dependencyTracker).inheritPendingDependenciesAsFutureForcedDependencies();
37401
+ return this;
37402
+ }
37403
+ resetBBox(idx) {
37404
+ if (!__privateGet(this, _dependencyTracker).hasPendingBBox) {
37405
+ __privateGet(this, _dependencyTracker).resetBBox(__privateGet(this, _opIdx));
37406
+ }
37407
+ return this;
37408
+ }
37409
+ get hasPendingBBox() {
37410
+ return __privateGet(this, _dependencyTracker).hasPendingBBox;
37411
+ }
37412
+ recordClipBox(idx, ctx, minX, maxX, minY, maxY) {
37413
+ __privateGet(this, _dependencyTracker).recordClipBox(__privateGet(this, _opIdx), ctx, minX, maxX, minY, maxY);
37414
+ return this;
37415
+ }
37416
+ recordBBox(idx, ctx, minX, maxX, minY, maxY) {
37417
+ __privateGet(this, _dependencyTracker).recordBBox(__privateGet(this, _opIdx), ctx, minX, maxX, minY, maxY);
37418
+ return this;
37419
+ }
37420
+ recordCharacterBBox(idx, ctx, font, scale, x2, y2, getMeasure) {
37421
+ __privateGet(this, _dependencyTracker).recordCharacterBBox(__privateGet(this, _opIdx), ctx, font, scale, x2, y2, getMeasure);
37422
+ return this;
37423
+ }
37424
+ recordFullPageBBox(idx) {
37425
+ __privateGet(this, _dependencyTracker).recordFullPageBBox(__privateGet(this, _opIdx));
37426
+ return this;
37427
+ }
37428
+ getSimpleIndex(dependencyName) {
37429
+ return __privateGet(this, _dependencyTracker).getSimpleIndex(dependencyName);
37430
+ }
37431
+ recordDependencies(idx, dependencyNames) {
37432
+ __privateGet(this, _dependencyTracker).recordDependencies(__privateGet(this, _opIdx), dependencyNames);
37433
+ return this;
37434
+ }
37435
+ copyDependenciesFromIncrementalOperation(idx, name) {
37436
+ __privateGet(this, _dependencyTracker).copyDependenciesFromIncrementalOperation(__privateGet(this, _opIdx), name);
37437
+ return this;
37438
+ }
37439
+ recordNamedDependency(idx, name) {
37440
+ __privateGet(this, _dependencyTracker).recordNamedDependency(__privateGet(this, _opIdx), name);
37441
+ return this;
37442
+ }
37443
+ recordOperation(idx) {
37444
+ __privateGet(this, _dependencyTracker).recordOperation(__privateGet(this, _opIdx), true);
37445
+ const operation = __privateGet(this, _dependencyTracker)._extractOperation(__privateGet(this, _opIdx));
37446
+ for (const depIdx of operation.dependencies) {
37447
+ __privateGet(this, _outerDependencies).add(depIdx);
37448
+ }
37449
+ __privateGet(this, _outerDependencies).delete(__privateGet(this, _opIdx));
37450
+ __privateGet(this, _outerDependencies).delete(null);
37451
+ return this;
37452
+ }
37453
+ bboxToClipBoxDropOperation(idx) {
37454
+ __privateGet(this, _dependencyTracker).bboxToClipBoxDropOperation(__privateGet(this, _opIdx));
37455
+ return this;
37456
+ }
37457
+ recordNestedDependencies() {
37458
+ __privateGet(this, _dependencyTracker)._pushPendingDependencies(__privateGet(this, _outerDependencies));
37459
+ }
37460
+ take() {
37461
+ throw new Error("Unreachable");
37462
+ }
37463
+ };
37464
+ _dependencyTracker = new WeakMap();
37465
+ _opIdx = new WeakMap();
37466
+ _nestingLevel = new WeakMap();
37467
+ _outerDependencies = new WeakMap();
37468
+ _savesLevel = new WeakMap();
37469
+ let CanvasNestedDependencyTracker = _CanvasNestedDependencyTracker;
37470
+ const Dependencies = {
37471
+ stroke: ["path", "transform", "filter", "strokeColor", "strokeAlpha", "lineWidth", "lineCap", "lineJoin", "miterLimit", "dash"],
37472
+ fill: ["path", "transform", "filter", "fillColor", "fillAlpha", "globalCompositeOperation", "SMask"],
37473
+ imageXObject: ["transform", "SMask", "filter", "fillAlpha", "strokeAlpha", "globalCompositeOperation"],
37474
+ rawFillPath: ["filter", "fillColor", "fillAlpha"],
37475
+ showText: ["transform", "leading", "charSpacing", "wordSpacing", "hScale", "textRise", "moveText", "textMatrix", "font", "filter", "fillColor", "textRenderingMode", "SMask", "fillAlpha", "strokeAlpha", "globalCompositeOperation"],
37476
+ transform: ["transform"],
37477
+ transformAndFill: ["transform", "fillColor"]
37478
+ };
37322
37479
  const PathType = {
37323
37480
  FILL: "Fill",
37324
37481
  STROKE: "Stroke",
@@ -37637,6 +37794,7 @@ const _TilingPattern = class _TilingPattern {
37637
37794
  this.baseTransform = baseTransform;
37638
37795
  }
37639
37796
  createPatternCanvas(owner) {
37797
+ var _a2, _b2, _c, _d;
37640
37798
  const {
37641
37799
  bbox,
37642
37800
  operatorList,
@@ -37684,12 +37842,14 @@ const _TilingPattern = class _TilingPattern {
37684
37842
  graphics.groupLevel = owner.groupLevel;
37685
37843
  this.setFillAndStrokeStyleToContext(graphics, paintType, color2);
37686
37844
  tmpCtx.translate(-dimx.scale * x0, -dimy.scale * y0);
37687
- graphics.transform(dimx.scale, 0, 0, dimy.scale, 0, 0);
37845
+ graphics.transform(0, dimx.scale, 0, 0, dimy.scale, 0, 0);
37688
37846
  tmpCtx.save();
37847
+ (_a2 = graphics.dependencyTracker) == null ? void 0 : _a2.save();
37689
37848
  this.clipBbox(graphics, x0, y0, x1, y1);
37690
37849
  graphics.baseTransform = getCurrentTransform(graphics.ctx);
37691
37850
  graphics.executeOperatorList(operatorList);
37692
37851
  graphics.endDrawing();
37852
+ (_d = (_b2 = graphics.dependencyTracker) == null ? void 0 : (_c = _b2.restore()).recordNestedDependencies) == null ? void 0 : _d.call(_c);
37693
37853
  tmpCtx.restore();
37694
37854
  if (redrawHorizontally || redrawVertically) {
37695
37855
  const image2 = tmpCanvas.canvas;
@@ -38000,7 +38160,7 @@ function drawImageAtIntegerCoords(ctx, srcImg, srcX, srcY, srcW, srcH, destX, de
38000
38160
  return [scaleX * destW, scaleY * destH];
38001
38161
  }
38002
38162
  class CanvasExtraState {
38003
- constructor(width, height) {
38163
+ constructor(width, height, preInit) {
38004
38164
  __publicField(this, "alphaIsShape", false);
38005
38165
  __publicField(this, "fontSize", 0);
38006
38166
  __publicField(this, "fontSizeScale", 1);
@@ -38026,6 +38186,7 @@ class CanvasExtraState {
38026
38186
  __publicField(this, "lineWidth", 1);
38027
38187
  __publicField(this, "activeSMask", null);
38028
38188
  __publicField(this, "transferMaps", "none");
38189
+ preInit == null ? void 0 : preInit(this);
38029
38190
  this.clipBox = new Float32Array([0, 0, width, height]);
38030
38191
  this.minMax = MIN_MAX_INIT.slice();
38031
38192
  }
@@ -38234,7 +38395,7 @@ const _CanvasGraphics = class _CanvasGraphics {
38234
38395
  constructor(canvasCtx, commonObjs, objs, canvasFactory, filterFactory, {
38235
38396
  optionalContentConfig,
38236
38397
  markedContentStack = null
38237
- }, annotationCanvasMap, pageColors) {
38398
+ }, annotationCanvasMap, pageColors, dependencyTracker) {
38238
38399
  __privateAdd(this, _CanvasGraphics_instances);
38239
38400
  this.ctx = canvasCtx;
38240
38401
  this.current = new CanvasExtraState(this.ctx.canvas.width, this.ctx.canvas.height);
@@ -38268,9 +38429,12 @@ const _CanvasGraphics = class _CanvasGraphics {
38268
38429
  this._cachedScaleForStroking = [-1, 0];
38269
38430
  this._cachedGetSinglePixelWidth = null;
38270
38431
  this._cachedBitmapsMap = /* @__PURE__ */ new Map();
38432
+ this.dependencyTracker = dependencyTracker != null ? dependencyTracker : null;
38271
38433
  }
38272
- getObject(data, fallback = null) {
38434
+ getObject(opIdx, data, fallback = null) {
38435
+ var _a2;
38273
38436
  if (typeof data === "string") {
38437
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordNamedDependency(opIdx, data);
38274
38438
  return data.startsWith("g_") ? this.commonObjs.get(data) : this.objs.get(data);
38275
38439
  }
38276
38440
  return fallback;
@@ -38306,7 +38470,8 @@ const _CanvasGraphics = class _CanvasGraphics {
38306
38470
  this.viewportScale = viewport.scale;
38307
38471
  this.baseTransform = getCurrentTransform(this.ctx);
38308
38472
  }
38309
- executeOperatorList(operatorList, executionStartIdx, continueCallback, stepper) {
38473
+ executeOperatorList(operatorList, executionStartIdx, continueCallback, stepper, filteredOperationIndexes) {
38474
+ var _a2, _b2;
38310
38475
  const argsArray = operatorList.argsArray;
38311
38476
  const fnArray = operatorList.fnArray;
38312
38477
  let i = executionStartIdx || 0;
@@ -38319,21 +38484,29 @@ const _CanvasGraphics = class _CanvasGraphics {
38319
38484
  let steps = 0;
38320
38485
  const commonObjs = this.commonObjs;
38321
38486
  const objs = this.objs;
38322
- let fnId;
38487
+ let fnId, fnArgs;
38323
38488
  while (true) {
38324
38489
  if (stepper !== void 0 && i === stepper.nextBreakPoint) {
38325
38490
  stepper.breakIt(i, continueCallback);
38326
38491
  return i;
38327
38492
  }
38328
- fnId = fnArray[i];
38329
- if (fnId !== OPS.dependency) {
38330
- this[fnId].apply(this, argsArray[i]);
38331
- } else {
38332
- for (const depObjId of argsArray[i]) {
38333
- const objsPool = depObjId.startsWith("g_") ? commonObjs : objs;
38334
- if (!objsPool.has(depObjId)) {
38335
- objsPool.get(depObjId, continueCallback);
38336
- return i;
38493
+ if (!filteredOperationIndexes || filteredOperationIndexes.has(i)) {
38494
+ fnId = fnArray[i];
38495
+ fnArgs = (_a2 = argsArray[i]) != null ? _a2 : null;
38496
+ if (fnId !== OPS.dependency) {
38497
+ if (fnArgs === null) {
38498
+ this[fnId](i);
38499
+ } else {
38500
+ this[fnId](i, ...fnArgs);
38501
+ }
38502
+ } else {
38503
+ for (const depObjId of fnArgs) {
38504
+ (_b2 = this.dependencyTracker) == null ? void 0 : _b2.recordNamedData(depObjId, i);
38505
+ const objsPool = depObjId.startsWith("g_") ? commonObjs : objs;
38506
+ if (!objsPool.has(depObjId)) {
38507
+ objsPool.get(depObjId, continueCallback);
38508
+ return i;
38509
+ }
38337
38510
  }
38338
38511
  }
38339
38512
  }
@@ -38399,7 +38572,8 @@ const _CanvasGraphics = class _CanvasGraphics {
38399
38572
  paintHeight
38400
38573
  };
38401
38574
  }
38402
- _createMaskCanvas(img) {
38575
+ _createMaskCanvas(opIdx, img) {
38576
+ var _a2, _b2;
38403
38577
  const ctx = this.ctx;
38404
38578
  const {
38405
38579
  width,
@@ -38421,6 +38595,7 @@ const _CanvasGraphics = class _CanvasGraphics {
38421
38595
  if (cachedImage && !isPatternFill) {
38422
38596
  const offsetX2 = Math.round(Math.min(currentTransform[0], currentTransform[2]) + currentTransform[4]);
38423
38597
  const offsetY2 = Math.round(Math.min(currentTransform[1], currentTransform[3]) + currentTransform[5]);
38598
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordDependencies(opIdx, Dependencies.transformAndFill);
38424
38599
  return {
38425
38600
  canvas: cachedImage,
38426
38601
  offsetX: offsetX2,
@@ -38463,81 +38638,98 @@ const _CanvasGraphics = class _CanvasGraphics {
38463
38638
  this.cachedCanvases.delete("fillCanvas");
38464
38639
  cache.set(cacheKey, fillCanvas.canvas);
38465
38640
  }
38641
+ (_b2 = this.dependencyTracker) == null ? void 0 : _b2.recordDependencies(opIdx, Dependencies.transformAndFill);
38466
38642
  return {
38467
38643
  canvas: fillCanvas.canvas,
38468
38644
  offsetX: Math.round(offsetX),
38469
38645
  offsetY: Math.round(offsetY)
38470
38646
  };
38471
38647
  }
38472
- setLineWidth(width) {
38648
+ setLineWidth(opIdx, width) {
38649
+ var _a2;
38650
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("lineWidth", opIdx);
38473
38651
  if (width !== this.current.lineWidth) {
38474
38652
  this._cachedScaleForStroking[0] = -1;
38475
38653
  }
38476
38654
  this.current.lineWidth = width;
38477
38655
  this.ctx.lineWidth = width;
38478
38656
  }
38479
- setLineCap(style) {
38657
+ setLineCap(opIdx, style) {
38658
+ var _a2;
38659
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("lineCap", opIdx);
38480
38660
  this.ctx.lineCap = LINE_CAP_STYLES[style];
38481
38661
  }
38482
- setLineJoin(style) {
38662
+ setLineJoin(opIdx, style) {
38663
+ var _a2;
38664
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("lineJoin", opIdx);
38483
38665
  this.ctx.lineJoin = LINE_JOIN_STYLES[style];
38484
38666
  }
38485
- setMiterLimit(limit) {
38667
+ setMiterLimit(opIdx, limit) {
38668
+ var _a2;
38669
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("miterLimit", opIdx);
38486
38670
  this.ctx.miterLimit = limit;
38487
38671
  }
38488
- setDash(dashArray, dashPhase) {
38672
+ setDash(opIdx, dashArray, dashPhase) {
38673
+ var _a2;
38674
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("dash", opIdx);
38489
38675
  const ctx = this.ctx;
38490
38676
  if (ctx.setLineDash !== void 0) {
38491
38677
  ctx.setLineDash(dashArray);
38492
38678
  ctx.lineDashOffset = dashPhase;
38493
38679
  }
38494
38680
  }
38495
- setRenderingIntent(intent) {
38681
+ setRenderingIntent(opIdx, intent) {
38496
38682
  }
38497
- setFlatness(flatness) {
38683
+ setFlatness(opIdx, flatness) {
38498
38684
  }
38499
- setGState(states) {
38685
+ setGState(opIdx, states) {
38686
+ var _a2, _b2, _c, _d, _e;
38500
38687
  for (const [key, value] of states) {
38501
38688
  switch (key) {
38502
38689
  case "LW":
38503
- this.setLineWidth(value);
38690
+ this.setLineWidth(opIdx, value);
38504
38691
  break;
38505
38692
  case "LC":
38506
- this.setLineCap(value);
38693
+ this.setLineCap(opIdx, value);
38507
38694
  break;
38508
38695
  case "LJ":
38509
- this.setLineJoin(value);
38696
+ this.setLineJoin(opIdx, value);
38510
38697
  break;
38511
38698
  case "ML":
38512
- this.setMiterLimit(value);
38699
+ this.setMiterLimit(opIdx, value);
38513
38700
  break;
38514
38701
  case "D":
38515
- this.setDash(value[0], value[1]);
38702
+ this.setDash(opIdx, value[0], value[1]);
38516
38703
  break;
38517
38704
  case "RI":
38518
- this.setRenderingIntent(value);
38705
+ this.setRenderingIntent(opIdx, value);
38519
38706
  break;
38520
38707
  case "FL":
38521
- this.setFlatness(value);
38708
+ this.setFlatness(opIdx, value);
38522
38709
  break;
38523
38710
  case "Font":
38524
- this.setFont(value[0], value[1]);
38711
+ this.setFont(opIdx, value[0], value[1]);
38525
38712
  break;
38526
38713
  case "CA":
38714
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("strokeAlpha", opIdx);
38527
38715
  this.current.strokeAlpha = value;
38528
38716
  break;
38529
38717
  case "ca":
38718
+ (_b2 = this.dependencyTracker) == null ? void 0 : _b2.recordSimpleData("fillAlpha", opIdx);
38530
38719
  this.ctx.globalAlpha = this.current.fillAlpha = value;
38531
38720
  break;
38532
38721
  case "BM":
38722
+ (_c = this.dependencyTracker) == null ? void 0 : _c.recordSimpleData("globalCompositeOperation", opIdx);
38533
38723
  this.ctx.globalCompositeOperation = value;
38534
38724
  break;
38535
38725
  case "SMask":
38726
+ (_d = this.dependencyTracker) == null ? void 0 : _d.recordSimpleData("SMask", opIdx);
38536
38727
  this.current.activeSMask = value ? this.tempSMask : null;
38537
38728
  this.tempSMask = null;
38538
38729
  this.checkSMaskState();
38539
38730
  break;
38540
38731
  case "TR":
38732
+ (_e = this.dependencyTracker) == null ? void 0 : _e.recordSimpleData("filter", opIdx);
38541
38733
  this.ctx.filter = this.current.transferMaps = this.filterFactory.addFilter(value);
38542
38734
  break;
38543
38735
  }
@@ -38554,7 +38746,7 @@ const _CanvasGraphics = class _CanvasGraphics {
38554
38746
  this.endSMaskMode();
38555
38747
  }
38556
38748
  }
38557
- beginSMaskMode() {
38749
+ beginSMaskMode(opIdx) {
38558
38750
  if (this.inSMaskMode) {
38559
38751
  throw new Error("beginSMaskMode called while already in smask mode");
38560
38752
  }
@@ -38567,7 +38759,7 @@ const _CanvasGraphics = class _CanvasGraphics {
38567
38759
  ctx.setTransform(this.suspendedCtx.getTransform());
38568
38760
  copyCtxState(this.suspendedCtx, ctx);
38569
38761
  mirrorContextOperations(ctx, this.suspendedCtx);
38570
- this.setGState([["BM", "source-over"]]);
38762
+ this.setGState(opIdx, [["BM", "source-over"]]);
38571
38763
  }
38572
38764
  endSMaskMode() {
38573
38765
  if (!this.inSMaskMode) {
@@ -38657,7 +38849,8 @@ const _CanvasGraphics = class _CanvasGraphics {
38657
38849
  layerCtx.drawImage(maskCanvas, maskX, maskY, width, height, layerOffsetX, layerOffsetY, width, height);
38658
38850
  layerCtx.restore();
38659
38851
  }
38660
- save() {
38852
+ save(opIdx) {
38853
+ var _a2;
38661
38854
  if (this.inSMaskMode) {
38662
38855
  copyCtxState(this.ctx, this.suspendedCtx);
38663
38856
  }
@@ -38665,8 +38858,11 @@ const _CanvasGraphics = class _CanvasGraphics {
38665
38858
  const old = this.current;
38666
38859
  this.stateStack.push(old);
38667
38860
  this.current = old.clone();
38861
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.save(opIdx);
38668
38862
  }
38669
- restore() {
38863
+ restore(opIdx) {
38864
+ var _a2;
38865
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.restore(opIdx);
38670
38866
  if (this.stateStack.length === 0) {
38671
38867
  if (this.inSMaskMode) {
38672
38868
  this.endSMaskMode();
@@ -38683,18 +38879,24 @@ const _CanvasGraphics = class _CanvasGraphics {
38683
38879
  this._cachedScaleForStroking[0] = -1;
38684
38880
  this._cachedGetSinglePixelWidth = null;
38685
38881
  }
38686
- transform(a2, b2, c2, d2, e2, f2) {
38882
+ transform(opIdx, a2, b2, c2, d2, e2, f2) {
38883
+ var _a2;
38884
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordIncrementalData("transform", opIdx);
38687
38885
  this.ctx.transform(a2, b2, c2, d2, e2, f2);
38688
38886
  this._cachedScaleForStroking[0] = -1;
38689
38887
  this._cachedGetSinglePixelWidth = null;
38690
38888
  }
38691
- constructPath(op, data, minMax) {
38889
+ constructPath(opIdx, op, data, minMax) {
38692
38890
  let [path] = data;
38693
38891
  if (!minMax) {
38694
38892
  path || (path = data[0] = new Path2D());
38695
- this[op](path);
38893
+ this[op](opIdx, path);
38696
38894
  return;
38697
38895
  }
38896
+ if (this.dependencyTracker !== null) {
38897
+ const outerExtraSize = op === OPS.stroke ? this.current.lineWidth / 2 : 0;
38898
+ this.dependencyTracker.resetBBox(opIdx).recordBBox(opIdx, this.ctx, minMax[0] - outerExtraSize, minMax[2] + outerExtraSize, minMax[1] - outerExtraSize, minMax[3] + outerExtraSize).recordDependencies(opIdx, ["transform"]);
38899
+ }
38698
38900
  if (!(path instanceof Path2D)) {
38699
38901
  const path2d = data[0] = new Path2D();
38700
38902
  for (let i = 0, ii = path.length; i < ii; ) {
@@ -38719,12 +38921,14 @@ const _CanvasGraphics = class _CanvasGraphics {
38719
38921
  path = path2d;
38720
38922
  }
38721
38923
  Util.axialAlignedBoundingBox(minMax, getCurrentTransform(this.ctx), this.current.minMax);
38722
- this[op](path);
38924
+ this[op](opIdx, path);
38925
+ this._pathStartIdx = opIdx;
38723
38926
  }
38724
- closePath() {
38927
+ closePath(opIdx) {
38725
38928
  this.ctx.closePath();
38726
38929
  }
38727
- stroke(path, consumePath = true) {
38930
+ stroke(opIdx, path, consumePath = true) {
38931
+ var _a2;
38728
38932
  const ctx = this.ctx;
38729
38933
  const strokeColor = this.current.strokeColor;
38730
38934
  ctx.globalAlpha = this.current.strokeAlpha;
@@ -38744,21 +38948,24 @@ const _CanvasGraphics = class _CanvasGraphics {
38744
38948
  this.rescaleAndStroke(path, true);
38745
38949
  }
38746
38950
  }
38951
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordDependencies(opIdx, Dependencies.stroke);
38747
38952
  if (consumePath) {
38748
- this.consumePath(path, this.current.getClippedPathBoundingBox(PathType.STROKE, getCurrentTransform(this.ctx)));
38953
+ this.consumePath(opIdx, path, this.current.getClippedPathBoundingBox(PathType.STROKE, getCurrentTransform(this.ctx)));
38749
38954
  }
38750
38955
  ctx.globalAlpha = this.current.fillAlpha;
38751
38956
  }
38752
- closeStroke(path) {
38753
- this.stroke(path);
38957
+ closeStroke(opIdx, path) {
38958
+ this.stroke(opIdx, path);
38754
38959
  }
38755
- fill(path, consumePath = true) {
38960
+ fill(opIdx, path, consumePath = true) {
38961
+ var _a2, _b2, _c;
38756
38962
  const ctx = this.ctx;
38757
38963
  const fillColor = this.current.fillColor;
38758
38964
  const isPatternFill = this.current.patternFill;
38759
38965
  let needRestore = false;
38760
38966
  if (isPatternFill) {
38761
38967
  const baseTransform = fillColor.isModifyingCurrentTransform() ? ctx.getTransform() : null;
38968
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.save(opIdx);
38762
38969
  ctx.save();
38763
38970
  ctx.fillStyle = fillColor.getPattern(ctx, this, getCurrentTransformInverse(ctx), PathType.FILL);
38764
38971
  if (baseTransform) {
@@ -38777,88 +38984,115 @@ const _CanvasGraphics = class _CanvasGraphics {
38777
38984
  ctx.fill(path);
38778
38985
  }
38779
38986
  }
38987
+ (_b2 = this.dependencyTracker) == null ? void 0 : _b2.recordDependencies(opIdx, Dependencies.fill);
38780
38988
  if (needRestore) {
38781
38989
  ctx.restore();
38990
+ (_c = this.dependencyTracker) == null ? void 0 : _c.restore(opIdx);
38782
38991
  }
38783
38992
  if (consumePath) {
38784
- this.consumePath(path, intersect);
38993
+ this.consumePath(opIdx, path, intersect);
38785
38994
  }
38786
38995
  }
38787
- eoFill(path) {
38996
+ eoFill(opIdx, path) {
38788
38997
  this.pendingEOFill = true;
38789
- this.fill(path);
38998
+ this.fill(opIdx, path);
38790
38999
  }
38791
- fillStroke(path) {
38792
- this.fill(path, false);
38793
- this.stroke(path, false);
38794
- this.consumePath(path);
39000
+ fillStroke(opIdx, path) {
39001
+ this.fill(opIdx, path, false);
39002
+ this.stroke(opIdx, path, false);
39003
+ this.consumePath(opIdx, path);
38795
39004
  }
38796
- eoFillStroke(path) {
39005
+ eoFillStroke(opIdx, path) {
38797
39006
  this.pendingEOFill = true;
38798
- this.fillStroke(path);
39007
+ this.fillStroke(opIdx, path);
38799
39008
  }
38800
- closeFillStroke(path) {
38801
- this.fillStroke(path);
39009
+ closeFillStroke(opIdx, path) {
39010
+ this.fillStroke(opIdx, path);
38802
39011
  }
38803
- closeEOFillStroke(path) {
39012
+ closeEOFillStroke(opIdx, path) {
38804
39013
  this.pendingEOFill = true;
38805
- this.fillStroke(path);
39014
+ this.fillStroke(opIdx, path);
38806
39015
  }
38807
- endPath(path) {
38808
- this.consumePath(path);
39016
+ endPath(opIdx, path) {
39017
+ this.consumePath(opIdx, path);
38809
39018
  }
38810
- rawFillPath(path) {
39019
+ rawFillPath(opIdx, path) {
39020
+ var _a2;
38811
39021
  this.ctx.fill(path);
39022
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordDependencies(opIdx, Dependencies.rawFillPath).recordOperation(opIdx);
38812
39023
  }
38813
- clip() {
39024
+ clip(opIdx) {
39025
+ var _a2;
39026
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordFutureForcedDependency("clipMode", opIdx);
38814
39027
  this.pendingClip = NORMAL_CLIP;
38815
39028
  }
38816
- eoClip() {
39029
+ eoClip(opIdx) {
39030
+ var _a2;
39031
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordFutureForcedDependency("clipMode", opIdx);
38817
39032
  this.pendingClip = EO_CLIP;
38818
39033
  }
38819
- beginText() {
39034
+ beginText(opIdx) {
39035
+ var _a2;
38820
39036
  this.current.textMatrix = null;
38821
39037
  this.current.textMatrixScale = 1;
38822
39038
  this.current.x = this.current.lineX = 0;
38823
39039
  this.current.y = this.current.lineY = 0;
39040
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordOpenMarker(opIdx).resetIncrementalData("sameLineText").resetIncrementalData("moveText", opIdx);
38824
39041
  }
38825
- endText() {
39042
+ endText(opIdx) {
38826
39043
  const paths = this.pendingTextPaths;
38827
39044
  const ctx = this.ctx;
38828
- if (paths === void 0) {
38829
- return;
39045
+ if (this.dependencyTracker) {
39046
+ const {
39047
+ dependencyTracker
39048
+ } = this;
39049
+ if (paths !== void 0) {
39050
+ dependencyTracker.recordFutureForcedDependency("textClip", dependencyTracker.getOpenMarker()).recordFutureForcedDependency("textClip", opIdx);
39051
+ }
39052
+ dependencyTracker.recordCloseMarker(opIdx);
38830
39053
  }
38831
- const newPath = new Path2D();
38832
- const invTransf = ctx.getTransform().invertSelf();
38833
- for (const {
38834
- transform: transform2,
38835
- x: x2,
38836
- y: y2,
38837
- fontSize: fontSize2,
38838
- path
38839
- } of paths) {
38840
- if (!path) {
38841
- continue;
39054
+ if (paths !== void 0) {
39055
+ const newPath = new Path2D();
39056
+ const invTransf = ctx.getTransform().invertSelf();
39057
+ for (const {
39058
+ transform: transform2,
39059
+ x: x2,
39060
+ y: y2,
39061
+ fontSize: fontSize2,
39062
+ path
39063
+ } of paths) {
39064
+ if (!path) {
39065
+ continue;
39066
+ }
39067
+ newPath.addPath(path, new DOMMatrix(transform2).preMultiplySelf(invTransf).translate(x2, y2).scale(fontSize2, -fontSize2));
38842
39068
  }
38843
- newPath.addPath(path, new DOMMatrix(transform2).preMultiplySelf(invTransf).translate(x2, y2).scale(fontSize2, -fontSize2));
39069
+ ctx.clip(newPath);
38844
39070
  }
38845
- ctx.clip(newPath);
38846
39071
  delete this.pendingTextPaths;
38847
39072
  }
38848
- setCharSpacing(spacing) {
39073
+ setCharSpacing(opIdx, spacing) {
39074
+ var _a2;
39075
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("charSpacing", opIdx);
38849
39076
  this.current.charSpacing = spacing;
38850
39077
  }
38851
- setWordSpacing(spacing) {
39078
+ setWordSpacing(opIdx, spacing) {
39079
+ var _a2;
39080
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("wordSpacing", opIdx);
38852
39081
  this.current.wordSpacing = spacing;
38853
39082
  }
38854
- setHScale(scale) {
39083
+ setHScale(opIdx, scale) {
39084
+ var _a2;
39085
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("hScale", opIdx);
38855
39086
  this.current.textHScale = scale / 100;
38856
39087
  }
38857
- setLeading(leading) {
39088
+ setLeading(opIdx, leading) {
39089
+ var _a2;
39090
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("leading", opIdx);
38858
39091
  this.current.leading = -leading;
38859
39092
  }
38860
- setFont(fontRefName, size) {
38861
- var _a2;
39093
+ setFont(opIdx, fontRefName, size) {
39094
+ var _a2, _b2;
39095
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("font", opIdx).recordNamedDependency(opIdx, fontRefName);
38862
39096
  const fontObj = this.commonObjs.get(fontRefName);
38863
39097
  const current = this.current;
38864
39098
  if (!fontObj) {
@@ -38880,7 +39114,7 @@ const _CanvasGraphics = class _CanvasGraphics {
38880
39114
  return;
38881
39115
  }
38882
39116
  const name = fontObj.loadedName || "sans-serif";
38883
- const typeface = ((_a2 = fontObj.systemFontInfo) == null ? void 0 : _a2.css) || `"${name}", ${fontObj.fallbackName}`;
39117
+ const typeface = ((_b2 = fontObj.systemFontInfo) == null ? void 0 : _b2.css) || `"${name}", ${fontObj.fallbackName}`;
38884
39118
  let bold = "normal";
38885
39119
  if (fontObj.black) {
38886
39120
  bold = "900";
@@ -38897,21 +39131,29 @@ const _CanvasGraphics = class _CanvasGraphics {
38897
39131
  this.current.fontSizeScale = size / browserFontSize;
38898
39132
  this.ctx.font = `${italic} ${bold} ${browserFontSize}px ${typeface}`;
38899
39133
  }
38900
- setTextRenderingMode(mode) {
39134
+ setTextRenderingMode(opIdx, mode) {
39135
+ var _a2;
39136
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("textRenderingMode", opIdx);
38901
39137
  this.current.textRenderingMode = mode;
38902
39138
  }
38903
- setTextRise(rise) {
39139
+ setTextRise(opIdx, rise) {
39140
+ var _a2;
39141
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("textRise", opIdx);
38904
39142
  this.current.textRise = rise;
38905
39143
  }
38906
- moveText(x2, y2) {
39144
+ moveText(opIdx, x2, y2) {
39145
+ var _a2;
39146
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.resetIncrementalData("sameLineText").recordIncrementalData("moveText", opIdx);
38907
39147
  this.current.x = this.current.lineX += x2;
38908
39148
  this.current.y = this.current.lineY += y2;
38909
39149
  }
38910
- setLeadingMoveText(x2, y2) {
38911
- this.setLeading(-y2);
38912
- this.moveText(x2, y2);
39150
+ setLeadingMoveText(opIdx, x2, y2) {
39151
+ this.setLeading(opIdx, -y2);
39152
+ this.moveText(opIdx, x2, y2);
38913
39153
  }
38914
- setTextMatrix(matrix2) {
39154
+ setTextMatrix(opIdx, matrix2) {
39155
+ var _a2;
39156
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("textMatrix", opIdx);
38915
39157
  const {
38916
39158
  current
38917
39159
  } = this;
@@ -38920,10 +39162,13 @@ const _CanvasGraphics = class _CanvasGraphics {
38920
39162
  current.x = current.lineX = 0;
38921
39163
  current.y = current.lineY = 0;
38922
39164
  }
38923
- nextLine() {
38924
- this.moveText(0, this.current.leading);
39165
+ nextLine(opIdx) {
39166
+ var _a2, _b2;
39167
+ this.moveText(opIdx, 0, this.current.leading);
39168
+ (_b2 = this.dependencyTracker) == null ? void 0 : _b2.recordIncrementalData("moveText", (_a2 = this.dependencyTracker.getSimpleIndex("leading")) != null ? _a2 : opIdx);
38925
39169
  }
38926
- paintChar(character, x2, y2, patternFillTransform, patternStrokeTransform) {
39170
+ paintChar(opIdx, character, x2, y2, patternFillTransform, patternStrokeTransform) {
39171
+ var _a2, _b2, _c, _d;
38927
39172
  const ctx = this.ctx;
38928
39173
  const current = this.current;
38929
39174
  const font = current.font;
@@ -38941,12 +39186,14 @@ const _CanvasGraphics = class _CanvasGraphics {
38941
39186
  ctx.save();
38942
39187
  ctx.translate(x2, y2);
38943
39188
  ctx.scale(fontSize2, -fontSize2);
39189
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordCharacterBBox(opIdx, ctx, font);
38944
39190
  let currentTransform;
38945
39191
  if (fillStrokeMode === TextRenderingMode.FILL || fillStrokeMode === TextRenderingMode.FILL_STROKE) {
38946
39192
  if (patternFillTransform) {
38947
39193
  currentTransform = ctx.getTransform();
38948
39194
  ctx.setTransform(...patternFillTransform);
38949
- ctx.fill(__privateMethod(this, _CanvasGraphics_instances, getScaledPath_fn).call(this, path, currentTransform, patternFillTransform));
39195
+ const scaledPath = __privateMethod(this, _CanvasGraphics_instances, getScaledPath_fn).call(this, path, currentTransform, patternFillTransform);
39196
+ ctx.fill(scaledPath);
38950
39197
  } else {
38951
39198
  ctx.fill(path);
38952
39199
  }
@@ -38975,8 +39222,12 @@ const _CanvasGraphics = class _CanvasGraphics {
38975
39222
  } else {
38976
39223
  if (fillStrokeMode === TextRenderingMode.FILL || fillStrokeMode === TextRenderingMode.FILL_STROKE) {
38977
39224
  ctx.fillText(character, x2, y2);
39225
+ (_b2 = this.dependencyTracker) == null ? void 0 : _b2.recordCharacterBBox(opIdx, ctx, font, fontSize2, x2, y2, () => ctx.measureText(character));
38978
39226
  }
38979
39227
  if (fillStrokeMode === TextRenderingMode.STROKE || fillStrokeMode === TextRenderingMode.FILL_STROKE) {
39228
+ if (this.dependencyTracker) {
39229
+ (_c = this.dependencyTracker) == null ? void 0 : _c.recordCharacterBBox(opIdx, ctx, font, fontSize2, x2, y2, () => ctx.measureText(character)).recordDependencies(opIdx, Dependencies.stroke);
39230
+ }
38980
39231
  ctx.strokeText(character, x2, y2);
38981
39232
  }
38982
39233
  }
@@ -38989,6 +39240,7 @@ const _CanvasGraphics = class _CanvasGraphics {
38989
39240
  fontSize: fontSize2,
38990
39241
  path
38991
39242
  });
39243
+ (_d = this.dependencyTracker) == null ? void 0 : _d.recordCharacterBBox(opIdx, ctx, font, fontSize2, x2, y2);
38992
39244
  }
38993
39245
  }
38994
39246
  get isFontSubpixelAAEnabled() {
@@ -39007,14 +39259,24 @@ const _CanvasGraphics = class _CanvasGraphics {
39007
39259
  }
39008
39260
  return shadow(this, "isFontSubpixelAAEnabled", enabled);
39009
39261
  }
39010
- showText(glyphs) {
39262
+ showText(opIdx, glyphs) {
39263
+ var _a2, _b2, _c, _d;
39264
+ if (this.dependencyTracker) {
39265
+ this.dependencyTracker.recordDependencies(opIdx, Dependencies.showText).copyDependenciesFromIncrementalOperation(opIdx, "sameLineText").resetBBox(opIdx);
39266
+ if (this.current.textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG) {
39267
+ this.dependencyTracker.recordFutureForcedDependency("textClip", opIdx).inheritPendingDependenciesAsFutureForcedDependencies();
39268
+ }
39269
+ }
39011
39270
  const current = this.current;
39012
39271
  const font = current.font;
39013
39272
  if (font.isType3Font) {
39014
- return this.showType3Text(glyphs);
39273
+ this.showType3Text(opIdx, glyphs);
39274
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordOperation(opIdx).recordIncrementalData("sameLineText", opIdx);
39275
+ return void 0;
39015
39276
  }
39016
39277
  const fontSize2 = current.fontSize;
39017
39278
  if (fontSize2 === 0) {
39279
+ (_b2 = this.dependencyTracker) == null ? void 0 : _b2.recordOperation(opIdx);
39018
39280
  return void 0;
39019
39281
  }
39020
39282
  const ctx = this.ctx;
@@ -39076,7 +39338,12 @@ const _CanvasGraphics = class _CanvasGraphics {
39076
39338
  chars2.push(glyph.unicode);
39077
39339
  width += glyph.width;
39078
39340
  }
39079
- ctx.fillText(chars2.join(""), 0, 0);
39341
+ const joinedChars = chars2.join("");
39342
+ ctx.fillText(joinedChars, 0, 0);
39343
+ if (this.dependencyTracker !== null) {
39344
+ const measure = ctx.measureText(joinedChars);
39345
+ this.dependencyTracker.recordBBox(opIdx, this.ctx, -measure.actualBoundingBoxLeft, measure.actualBoundingBoxRight, -measure.actualBoundingBoxAscent, measure.actualBoundingBoxDescent).recordOperation(opIdx).recordIncrementalData("sameLineText", opIdx);
39346
+ }
39080
39347
  current.x += width * widthAdvanceScale * textHScale;
39081
39348
  ctx.restore();
39082
39349
  this.compose();
@@ -39106,8 +39373,10 @@ const _CanvasGraphics = class _CanvasGraphics {
39106
39373
  scaledX = x2 / fontSizeScale;
39107
39374
  scaledY = 0;
39108
39375
  }
39376
+ let measure;
39109
39377
  if (font.remeasure && width > 0) {
39110
- const measuredWidth = ctx.measureText(character).width * 1e3 / fontSize2 * fontSizeScale;
39378
+ measure = ctx.measureText(character);
39379
+ const measuredWidth = measure.width * 1e3 / fontSize2 * fontSizeScale;
39111
39380
  if (width < measuredWidth && this.isFontSubpixelAAEnabled) {
39112
39381
  const characterScaleX = width / measuredWidth;
39113
39382
  restoreNeeded = true;
@@ -39121,12 +39390,15 @@ const _CanvasGraphics = class _CanvasGraphics {
39121
39390
  if (this.contentVisible && (glyph.isInFont || font.missingFile)) {
39122
39391
  if (simpleFillText && !accent) {
39123
39392
  ctx.fillText(character, scaledX, scaledY);
39393
+ (_c = this.dependencyTracker) == null ? void 0 : _c.recordCharacterBBox(opIdx, ctx, measure ? {
39394
+ bbox: null
39395
+ } : font, fontSize2 / fontSizeScale, scaledX, scaledY, () => measure != null ? measure : ctx.measureText(character));
39124
39396
  } else {
39125
- this.paintChar(character, scaledX, scaledY, patternFillTransform, patternStrokeTransform);
39397
+ this.paintChar(opIdx, character, scaledX, scaledY, patternFillTransform, patternStrokeTransform);
39126
39398
  if (accent) {
39127
39399
  const scaledAccentX = scaledX + fontSize2 * accent.offset.x / fontSizeScale;
39128
39400
  const scaledAccentY = scaledY - fontSize2 * accent.offset.y / fontSizeScale;
39129
- this.paintChar(accent.fontChar, scaledAccentX, scaledAccentY, patternFillTransform, patternStrokeTransform);
39401
+ this.paintChar(opIdx, accent.fontChar, scaledAccentX, scaledAccentY, patternFillTransform, patternStrokeTransform);
39130
39402
  }
39131
39403
  }
39132
39404
  }
@@ -39143,9 +39415,10 @@ const _CanvasGraphics = class _CanvasGraphics {
39143
39415
  }
39144
39416
  ctx.restore();
39145
39417
  this.compose();
39418
+ (_d = this.dependencyTracker) == null ? void 0 : _d.recordOperation(opIdx).recordIncrementalData("sameLineText", opIdx);
39146
39419
  return void 0;
39147
39420
  }
39148
- showType3Text(glyphs) {
39421
+ showType3Text(opIdx, glyphs) {
39149
39422
  const ctx = this.ctx;
39150
39423
  const current = this.current;
39151
39424
  const font = current.font;
@@ -39170,6 +39443,8 @@ const _CanvasGraphics = class _CanvasGraphics {
39170
39443
  }
39171
39444
  ctx.translate(current.x, current.y + current.textRise);
39172
39445
  ctx.scale(textHScale, fontDirection);
39446
+ const dependencyTracker = this.dependencyTracker;
39447
+ this.dependencyTracker = dependencyTracker ? new CanvasNestedDependencyTracker(dependencyTracker, opIdx) : null;
39173
39448
  for (i = 0; i < glyphsLength; ++i) {
39174
39449
  glyph = glyphs[i];
39175
39450
  if (typeof glyph === "number") {
@@ -39196,16 +39471,22 @@ const _CanvasGraphics = class _CanvasGraphics {
39196
39471
  current.x += width * textHScale;
39197
39472
  }
39198
39473
  ctx.restore();
39474
+ if (dependencyTracker) {
39475
+ this.dependencyTracker.recordNestedDependencies();
39476
+ this.dependencyTracker = dependencyTracker;
39477
+ }
39199
39478
  }
39200
- setCharWidth(xWidth, yWidth) {
39479
+ setCharWidth(opIdx, xWidth, yWidth) {
39201
39480
  }
39202
- setCharWidthAndBounds(xWidth, yWidth, llx, lly, urx, ury) {
39481
+ setCharWidthAndBounds(opIdx, xWidth, yWidth, llx, lly, urx, ury) {
39482
+ var _a2;
39203
39483
  const clip = new Path2D();
39204
39484
  clip.rect(llx, lly, urx - llx, ury - lly);
39205
39485
  this.ctx.clip(clip);
39206
- this.endPath();
39486
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordBBox(opIdx, this.ctx, llx, urx, lly, ury).recordClipBox(opIdx, this.ctx, llx, urx, lly, ury);
39487
+ this.endPath(opIdx);
39207
39488
  }
39208
- getColorN_Pattern(IR) {
39489
+ getColorN_Pattern(opIdx, IR) {
39209
39490
  let pattern;
39210
39491
  if (IR[0] === "TilingPattern") {
39211
39492
  const baseTransform = this.baseTransform || getCurrentTransform(this.ctx);
@@ -39213,44 +39494,56 @@ const _CanvasGraphics = class _CanvasGraphics {
39213
39494
  createCanvasGraphics: (ctx) => new _CanvasGraphics(ctx, this.commonObjs, this.objs, this.canvasFactory, this.filterFactory, {
39214
39495
  optionalContentConfig: this.optionalContentConfig,
39215
39496
  markedContentStack: this.markedContentStack
39216
- })
39497
+ }, void 0, void 0, this.dependencyTracker ? new CanvasNestedDependencyTracker(this.dependencyTracker, opIdx) : null)
39217
39498
  };
39218
39499
  pattern = new TilingPattern(IR, this.ctx, canvasGraphicsFactory, baseTransform);
39219
39500
  } else {
39220
- pattern = this._getPattern(IR[1], IR[2]);
39501
+ pattern = this._getPattern(opIdx, IR[1], IR[2]);
39221
39502
  }
39222
39503
  return pattern;
39223
39504
  }
39224
- setStrokeColorN() {
39225
- this.current.strokeColor = this.getColorN_Pattern(arguments);
39505
+ setStrokeColorN(opIdx, ...args) {
39506
+ var _a2;
39507
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("strokeColor", opIdx);
39508
+ this.current.strokeColor = this.getColorN_Pattern(opIdx, args);
39226
39509
  this.current.patternStroke = true;
39227
39510
  }
39228
- setFillColorN() {
39229
- this.current.fillColor = this.getColorN_Pattern(arguments);
39511
+ setFillColorN(opIdx, ...args) {
39512
+ var _a2;
39513
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("fillColor", opIdx);
39514
+ this.current.fillColor = this.getColorN_Pattern(opIdx, args);
39230
39515
  this.current.patternFill = true;
39231
39516
  }
39232
- setStrokeRGBColor(color2) {
39517
+ setStrokeRGBColor(opIdx, color2) {
39518
+ var _a2;
39519
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("strokeColor", opIdx);
39233
39520
  this.ctx.strokeStyle = this.current.strokeColor = color2;
39234
39521
  this.current.patternStroke = false;
39235
39522
  }
39236
- setStrokeTransparent() {
39523
+ setStrokeTransparent(opIdx) {
39524
+ var _a2;
39525
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("strokeColor", opIdx);
39237
39526
  this.ctx.strokeStyle = this.current.strokeColor = "transparent";
39238
39527
  this.current.patternStroke = false;
39239
39528
  }
39240
- setFillRGBColor(color2) {
39529
+ setFillRGBColor(opIdx, color2) {
39530
+ var _a2;
39531
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("fillColor", opIdx);
39241
39532
  this.ctx.fillStyle = this.current.fillColor = color2;
39242
39533
  this.current.patternFill = false;
39243
39534
  }
39244
- setFillTransparent() {
39535
+ setFillTransparent(opIdx) {
39536
+ var _a2;
39537
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("fillColor", opIdx);
39245
39538
  this.ctx.fillStyle = this.current.fillColor = "transparent";
39246
39539
  this.current.patternFill = false;
39247
39540
  }
39248
- _getPattern(objId, matrix2 = null) {
39541
+ _getPattern(opIdx, objId, matrix2 = null) {
39249
39542
  let pattern;
39250
39543
  if (this.cachedPatterns.has(objId)) {
39251
39544
  pattern = this.cachedPatterns.get(objId);
39252
39545
  } else {
39253
- pattern = getShadingPattern(this.getObject(objId));
39546
+ pattern = getShadingPattern(this.getObject(opIdx, objId));
39254
39547
  this.cachedPatterns.set(objId, pattern);
39255
39548
  }
39256
39549
  if (matrix2) {
@@ -39258,13 +39551,14 @@ const _CanvasGraphics = class _CanvasGraphics {
39258
39551
  }
39259
39552
  return pattern;
39260
39553
  }
39261
- shadingFill(objId) {
39554
+ shadingFill(opIdx, objId) {
39555
+ var _a2;
39262
39556
  if (!this.contentVisible) {
39263
39557
  return;
39264
39558
  }
39265
39559
  const ctx = this.ctx;
39266
- this.save();
39267
- const pattern = this._getPattern(objId);
39560
+ this.save(opIdx);
39561
+ const pattern = this._getPattern(opIdx, objId);
39268
39562
  ctx.fillStyle = pattern.getPattern(ctx, this, getCurrentTransformInverse(ctx), PathType.SHADING);
39269
39563
  const inv = getCurrentTransformInverse(ctx);
39270
39564
  if (inv) {
@@ -39279,8 +39573,9 @@ const _CanvasGraphics = class _CanvasGraphics {
39279
39573
  } else {
39280
39574
  this.ctx.fillRect(-1e10, -1e10, 2e10, 2e10);
39281
39575
  }
39576
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.resetBBox(opIdx).recordFullPageBBox(opIdx).recordDependencies(opIdx, Dependencies.transform).recordDependencies(opIdx, Dependencies.fill).recordOperation(opIdx);
39282
39577
  this.compose(this.current.getClippedPathBoundingBox());
39283
- this.restore();
39578
+ this.restore(opIdx);
39284
39579
  }
39285
39580
  beginInlineImage() {
39286
39581
  unreachable("Should not call beginInlineImage");
@@ -39288,14 +39583,15 @@ const _CanvasGraphics = class _CanvasGraphics {
39288
39583
  beginImageData() {
39289
39584
  unreachable("Should not call beginImageData");
39290
39585
  }
39291
- paintFormXObjectBegin(matrix2, bbox) {
39586
+ paintFormXObjectBegin(opIdx, matrix2, bbox) {
39587
+ var _a2;
39292
39588
  if (!this.contentVisible) {
39293
39589
  return;
39294
39590
  }
39295
- this.save();
39591
+ this.save(opIdx);
39296
39592
  this.baseTransformStack.push(this.baseTransform);
39297
39593
  if (matrix2) {
39298
- this.transform(...matrix2);
39594
+ this.transform(opIdx, ...matrix2);
39299
39595
  }
39300
39596
  this.baseTransform = getCurrentTransform(this.ctx);
39301
39597
  if (bbox) {
@@ -39304,21 +39600,23 @@ const _CanvasGraphics = class _CanvasGraphics {
39304
39600
  const clip = new Path2D();
39305
39601
  clip.rect(x0, y0, x1 - x0, y1 - y0);
39306
39602
  this.ctx.clip(clip);
39307
- this.endPath();
39603
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordClipBox(opIdx, this.ctx, x0, x1, y0, y1);
39604
+ this.endPath(opIdx);
39308
39605
  }
39309
39606
  }
39310
- paintFormXObjectEnd() {
39607
+ paintFormXObjectEnd(opIdx) {
39311
39608
  if (!this.contentVisible) {
39312
39609
  return;
39313
39610
  }
39314
- this.restore();
39611
+ this.restore(opIdx);
39315
39612
  this.baseTransform = this.baseTransformStack.pop();
39316
39613
  }
39317
- beginGroup(group) {
39614
+ beginGroup(opIdx, group) {
39615
+ var _a2;
39318
39616
  if (!this.contentVisible) {
39319
39617
  return;
39320
39618
  }
39321
- this.save();
39619
+ this.save(opIdx);
39322
39620
  if (this.inSMaskMode) {
39323
39621
  this.endSMaskMode();
39324
39622
  this.current.activeSMask = null;
@@ -39374,18 +39672,21 @@ const _CanvasGraphics = class _CanvasGraphics {
39374
39672
  transferMap: group.smask.transferMap || null,
39375
39673
  startTransformInverse: null
39376
39674
  });
39377
- } else {
39675
+ }
39676
+ if (!group.smask || this.dependencyTracker) {
39378
39677
  currentCtx.setTransform(1, 0, 0, 1, 0, 0);
39379
39678
  currentCtx.translate(offsetX, offsetY);
39380
39679
  currentCtx.save();
39381
39680
  }
39382
39681
  copyCtxState(currentCtx, groupCtx);
39383
39682
  this.ctx = groupCtx;
39384
- this.setGState([["BM", "source-over"], ["ca", 1], ["CA", 1]]);
39683
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.inheritSimpleDataAsFutureForcedDependencies(["fillAlpha", "strokeAlpha", "globalCompositeOperation"]).pushBaseTransform(currentCtx);
39684
+ this.setGState(opIdx, [["BM", "source-over"], ["ca", 1], ["CA", 1]]);
39385
39685
  this.groupStack.push(currentCtx);
39386
39686
  this.groupLevel++;
39387
39687
  }
39388
- endGroup(group) {
39688
+ endGroup(opIdx, group) {
39689
+ var _a2;
39389
39690
  if (!this.contentVisible) {
39390
39691
  return;
39391
39692
  }
@@ -39394,13 +39695,17 @@ const _CanvasGraphics = class _CanvasGraphics {
39394
39695
  const ctx = this.groupStack.pop();
39395
39696
  this.ctx = ctx;
39396
39697
  this.ctx.imageSmoothingEnabled = false;
39698
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.popBaseTransform();
39397
39699
  if (group.smask) {
39398
39700
  this.tempSMask = this.smaskStack.pop();
39399
- this.restore();
39701
+ this.restore(opIdx);
39702
+ if (this.dependencyTracker) {
39703
+ this.ctx.restore();
39704
+ }
39400
39705
  } else {
39401
39706
  this.ctx.restore();
39402
39707
  const currentMtx = getCurrentTransform(this.ctx);
39403
- this.restore();
39708
+ this.restore(opIdx);
39404
39709
  this.ctx.save();
39405
39710
  this.ctx.setTransform(...currentMtx);
39406
39711
  const dirtyBox = MIN_MAX_INIT.slice();
@@ -39410,11 +39715,11 @@ const _CanvasGraphics = class _CanvasGraphics {
39410
39715
  this.compose(dirtyBox);
39411
39716
  }
39412
39717
  }
39413
- beginAnnotation(id, rect, transform2, matrix2, hasOwnCanvas) {
39718
+ beginAnnotation(opIdx, id, rect, transform2, matrix2, hasOwnCanvas) {
39414
39719
  __privateMethod(this, _CanvasGraphics_instances, restoreInitialState_fn).call(this);
39415
39720
  resetCtxToDefault(this.ctx);
39416
39721
  this.ctx.save();
39417
- this.save();
39722
+ this.save(opIdx);
39418
39723
  if (this.baseTransform) {
39419
39724
  this.ctx.setTransform(...this.baseTransform);
39420
39725
  }
@@ -39448,17 +39753,17 @@ const _CanvasGraphics = class _CanvasGraphics {
39448
39753
  resetCtxToDefault(this.ctx);
39449
39754
  } else {
39450
39755
  resetCtxToDefault(this.ctx);
39451
- this.endPath();
39756
+ this.endPath(opIdx);
39452
39757
  const clip = new Path2D();
39453
39758
  clip.rect(rect[0], rect[1], width, height);
39454
39759
  this.ctx.clip(clip);
39455
39760
  }
39456
39761
  }
39457
39762
  this.current = new CanvasExtraState(this.ctx.canvas.width, this.ctx.canvas.height);
39458
- this.transform(...transform2);
39459
- this.transform(...matrix2);
39763
+ this.transform(opIdx, ...transform2);
39764
+ this.transform(opIdx, ...matrix2);
39460
39765
  }
39461
- endAnnotation() {
39766
+ endAnnotation(opIdx) {
39462
39767
  if (this.annotationCanvas) {
39463
39768
  this.ctx.restore();
39464
39769
  __privateMethod(this, _CanvasGraphics_instances, drawFilter_fn).call(this);
@@ -39467,47 +39772,55 @@ const _CanvasGraphics = class _CanvasGraphics {
39467
39772
  delete this.annotationCanvas;
39468
39773
  }
39469
39774
  }
39470
- paintImageMaskXObject(img) {
39775
+ paintImageMaskXObject(opIdx, img) {
39776
+ var _a2;
39471
39777
  if (!this.contentVisible) {
39472
39778
  return;
39473
39779
  }
39474
39780
  const count = img.count;
39475
- img = this.getObject(img.data, img);
39781
+ img = this.getObject(opIdx, img.data, img);
39476
39782
  img.count = count;
39477
39783
  const ctx = this.ctx;
39478
- const mask = this._createMaskCanvas(img);
39784
+ const mask = this._createMaskCanvas(opIdx, img);
39479
39785
  const maskCanvas = mask.canvas;
39480
39786
  ctx.save();
39481
39787
  ctx.setTransform(1, 0, 0, 1, 0, 0);
39482
39788
  ctx.drawImage(maskCanvas, mask.offsetX, mask.offsetY);
39789
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.resetBBox(opIdx).recordBBox(opIdx, this.ctx, mask.offsetX, mask.offsetX + maskCanvas.width, mask.offsetY, mask.offsetY + maskCanvas.height).recordOperation(opIdx);
39483
39790
  ctx.restore();
39484
39791
  this.compose();
39485
39792
  }
39486
- paintImageMaskXObjectRepeat(img, scaleX, skewX = 0, skewY = 0, scaleY, positions) {
39793
+ paintImageMaskXObjectRepeat(opIdx, img, scaleX, skewX = 0, skewY = 0, scaleY, positions) {
39794
+ var _a2, _b2, _c;
39487
39795
  if (!this.contentVisible) {
39488
39796
  return;
39489
39797
  }
39490
- img = this.getObject(img.data, img);
39798
+ img = this.getObject(opIdx, img.data, img);
39491
39799
  const ctx = this.ctx;
39492
39800
  ctx.save();
39493
39801
  const currentTransform = getCurrentTransform(ctx);
39494
39802
  ctx.transform(scaleX, skewX, skewY, scaleY, 0, 0);
39495
- const mask = this._createMaskCanvas(img);
39803
+ const mask = this._createMaskCanvas(opIdx, img);
39496
39804
  ctx.setTransform(1, 0, 0, 1, mask.offsetX - currentTransform[4], mask.offsetY - currentTransform[5]);
39805
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.resetBBox(opIdx);
39497
39806
  for (let i = 0, ii = positions.length; i < ii; i += 2) {
39498
39807
  const trans = Util.transform(currentTransform, [scaleX, skewX, skewY, scaleY, positions[i], positions[i + 1]]);
39499
39808
  ctx.drawImage(mask.canvas, trans[4], trans[5]);
39809
+ (_b2 = this.dependencyTracker) == null ? void 0 : _b2.recordBBox(opIdx, this.ctx, trans[4], trans[4] + mask.canvas.width, trans[5], trans[5] + mask.canvas.height);
39500
39810
  }
39501
39811
  ctx.restore();
39502
39812
  this.compose();
39813
+ (_c = this.dependencyTracker) == null ? void 0 : _c.recordOperation(opIdx);
39503
39814
  }
39504
- paintImageMaskXObjectGroup(images) {
39815
+ paintImageMaskXObjectGroup(opIdx, images) {
39816
+ var _a2, _b2, _c;
39505
39817
  if (!this.contentVisible) {
39506
39818
  return;
39507
39819
  }
39508
39820
  const ctx = this.ctx;
39509
39821
  const fillColor = this.current.fillColor;
39510
39822
  const isPatternFill = this.current.patternFill;
39823
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.resetBBox(opIdx).recordDependencies(opIdx, Dependencies.transformAndFill);
39511
39824
  for (const image2 of images) {
39512
39825
  const {
39513
39826
  data,
@@ -39518,7 +39831,7 @@ const _CanvasGraphics = class _CanvasGraphics {
39518
39831
  const maskCanvas = this.cachedCanvases.getCanvas("maskCanvas", width, height);
39519
39832
  const maskCtx = maskCanvas.context;
39520
39833
  maskCtx.save();
39521
- const img = this.getObject(data, image2);
39834
+ const img = this.getObject(opIdx, data, image2);
39522
39835
  putBinaryImageMask(maskCtx, img);
39523
39836
  maskCtx.globalCompositeOperation = "source-in";
39524
39837
  maskCtx.fillStyle = isPatternFill ? fillColor.getPattern(maskCtx, this, getCurrentTransformInverse(ctx), PathType.FILL) : fillColor;
@@ -39528,26 +39841,28 @@ const _CanvasGraphics = class _CanvasGraphics {
39528
39841
  ctx.transform(...transform2);
39529
39842
  ctx.scale(1, -1);
39530
39843
  drawImageAtIntegerCoords(ctx, maskCanvas.canvas, 0, 0, width, height, 0, -1, 1, 1);
39844
+ (_b2 = this.dependencyTracker) == null ? void 0 : _b2.recordBBox(opIdx, ctx, 0, width, 0, height);
39531
39845
  ctx.restore();
39532
39846
  }
39533
39847
  this.compose();
39848
+ (_c = this.dependencyTracker) == null ? void 0 : _c.recordOperation(opIdx);
39534
39849
  }
39535
- paintImageXObject(objId) {
39850
+ paintImageXObject(opIdx, objId) {
39536
39851
  if (!this.contentVisible) {
39537
39852
  return;
39538
39853
  }
39539
- const imgData = this.getObject(objId);
39854
+ const imgData = this.getObject(opIdx, objId);
39540
39855
  if (!imgData) {
39541
39856
  warn("Dependent image isn't ready yet");
39542
39857
  return;
39543
39858
  }
39544
- this.paintInlineImageXObject(imgData);
39859
+ this.paintInlineImageXObject(opIdx, imgData);
39545
39860
  }
39546
- paintImageXObjectRepeat(objId, scaleX, scaleY, positions) {
39861
+ paintImageXObjectRepeat(opIdx, objId, scaleX, scaleY, positions) {
39547
39862
  if (!this.contentVisible) {
39548
39863
  return;
39549
39864
  }
39550
- const imgData = this.getObject(objId);
39865
+ const imgData = this.getObject(opIdx, objId);
39551
39866
  if (!imgData) {
39552
39867
  warn("Dependent image isn't ready yet");
39553
39868
  return;
@@ -39564,7 +39879,7 @@ const _CanvasGraphics = class _CanvasGraphics {
39564
39879
  h: height
39565
39880
  });
39566
39881
  }
39567
- this.paintInlineImageXObjectGroup(imgData, map);
39882
+ this.paintInlineImageXObjectGroup(opIdx, imgData, map);
39568
39883
  }
39569
39884
  applyTransferMapsToCanvas(ctx) {
39570
39885
  if (this.current.transferMaps !== "none") {
@@ -39590,14 +39905,15 @@ const _CanvasGraphics = class _CanvasGraphics {
39590
39905
  tmpCtx.filter = "none";
39591
39906
  return tmpCanvas.canvas;
39592
39907
  }
39593
- paintInlineImageXObject(imgData) {
39908
+ paintInlineImageXObject(opIdx, imgData) {
39909
+ var _a2;
39594
39910
  if (!this.contentVisible) {
39595
39911
  return;
39596
39912
  }
39597
39913
  const width = imgData.width;
39598
39914
  const height = imgData.height;
39599
39915
  const ctx = this.ctx;
39600
- this.save();
39916
+ this.save(opIdx);
39601
39917
  const {
39602
39918
  filter
39603
39919
  } = ctx;
@@ -39618,11 +39934,13 @@ const _CanvasGraphics = class _CanvasGraphics {
39618
39934
  }
39619
39935
  const scaled = this._scaleImage(imgToPaint, getCurrentTransformInverse(ctx));
39620
39936
  ctx.imageSmoothingEnabled = getImageSmoothingEnabled(getCurrentTransform(ctx), imgData.interpolate);
39937
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.resetBBox(opIdx).recordBBox(opIdx, ctx, 0, width, -height, 0).recordDependencies(opIdx, Dependencies.imageXObject).recordOperation(opIdx);
39621
39938
  drawImageAtIntegerCoords(ctx, scaled.img, 0, 0, scaled.paintWidth, scaled.paintHeight, 0, -height, width, height);
39622
39939
  this.compose();
39623
- this.restore();
39940
+ this.restore(opIdx);
39624
39941
  }
39625
- paintInlineImageXObjectGroup(imgData, map) {
39942
+ paintInlineImageXObjectGroup(opIdx, imgData, map) {
39943
+ var _a2, _b2, _c;
39626
39944
  if (!this.contentVisible) {
39627
39945
  return;
39628
39946
  }
@@ -39638,32 +39956,41 @@ const _CanvasGraphics = class _CanvasGraphics {
39638
39956
  putBinaryImageData(tmpCtx, imgData);
39639
39957
  imgToPaint = this.applyTransferMapsToCanvas(tmpCtx);
39640
39958
  }
39959
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.resetBBox(opIdx);
39641
39960
  for (const entry of map) {
39642
39961
  ctx.save();
39643
39962
  ctx.transform(...entry.transform);
39644
39963
  ctx.scale(1, -1);
39645
39964
  drawImageAtIntegerCoords(ctx, imgToPaint, entry.x, entry.y, entry.w, entry.h, 0, -1, 1, 1);
39965
+ (_b2 = this.dependencyTracker) == null ? void 0 : _b2.recordBBox(opIdx, ctx, 0, 1, -1, 0);
39646
39966
  ctx.restore();
39647
39967
  }
39968
+ (_c = this.dependencyTracker) == null ? void 0 : _c.recordOperation(opIdx);
39648
39969
  this.compose();
39649
39970
  }
39650
- paintSolidColorImageMask() {
39971
+ paintSolidColorImageMask(opIdx) {
39972
+ var _a2;
39651
39973
  if (!this.contentVisible) {
39652
39974
  return;
39653
39975
  }
39976
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.resetBBox(opIdx).recordBBox(opIdx, this.ctx, 0, 1, 0, 1).recordDependencies(opIdx, Dependencies.fill).recordOperation(opIdx);
39654
39977
  this.ctx.fillRect(0, 0, 1, 1);
39655
39978
  this.compose();
39656
39979
  }
39657
- markPoint(tag) {
39980
+ markPoint(opIdx, tag) {
39658
39981
  }
39659
- markPointProps(tag, properties) {
39982
+ markPointProps(opIdx, tag, properties) {
39660
39983
  }
39661
- beginMarkedContent(tag) {
39984
+ beginMarkedContent(opIdx, tag) {
39985
+ var _a2;
39986
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.beginMarkedContent(opIdx);
39662
39987
  this.markedContentStack.push({
39663
39988
  visible: true
39664
39989
  });
39665
39990
  }
39666
- beginMarkedContentProps(tag, properties) {
39991
+ beginMarkedContentProps(opIdx, tag, properties) {
39992
+ var _a2;
39993
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.beginMarkedContent(opIdx);
39667
39994
  if (tag === "OC") {
39668
39995
  this.markedContentStack.push({
39669
39996
  visible: this.optionalContentConfig.isVisible(properties)
@@ -39675,15 +40002,18 @@ const _CanvasGraphics = class _CanvasGraphics {
39675
40002
  }
39676
40003
  this.contentVisible = this.isContentVisible();
39677
40004
  }
39678
- endMarkedContent() {
40005
+ endMarkedContent(opIdx) {
40006
+ var _a2;
40007
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.endMarkedContent(opIdx);
39679
40008
  this.markedContentStack.pop();
39680
40009
  this.contentVisible = this.isContentVisible();
39681
40010
  }
39682
- beginCompat() {
40011
+ beginCompat(opIdx) {
39683
40012
  }
39684
- endCompat() {
40013
+ endCompat(opIdx) {
39685
40014
  }
39686
- consumePath(path, clipBox) {
40015
+ consumePath(opIdx, path, clipBox) {
40016
+ var _a2, _b2;
39687
40017
  const isEmpty = this.current.isEmptyClip();
39688
40018
  if (this.pendingClip) {
39689
40019
  this.current.updateClipFromPath();
@@ -39701,6 +40031,9 @@ const _CanvasGraphics = class _CanvasGraphics {
39701
40031
  }
39702
40032
  }
39703
40033
  this.pendingClip = null;
40034
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.bboxToClipBoxDropOperation(opIdx).recordFutureForcedDependency("clipPath", opIdx);
40035
+ } else {
40036
+ (_b2 = this.dependencyTracker) == null ? void 0 : _b2.recordOperation(opIdx);
39704
40037
  }
39705
40038
  this.current.startNewPathAndClipBox(this.current.clipBox);
39706
40039
  }
@@ -42075,7 +42408,7 @@ function getDocument(src = {}) {
42075
42408
  }
42076
42409
  const docParams = {
42077
42410
  docId,
42078
- apiVersion: "5.4.54",
42411
+ apiVersion: "5.4.149",
42079
42412
  data,
42080
42413
  password,
42081
42414
  disableAutoFetch,
@@ -42316,6 +42649,9 @@ class PDFDocumentProxy {
42316
42649
  getAttachments() {
42317
42650
  return this._transport.getAttachments();
42318
42651
  }
42652
+ getAnnotationsByType(types, pageIndexesToSkip) {
42653
+ return this._transport.getAnnotationsByType(types, pageIndexesToSkip);
42654
+ }
42319
42655
  getJSActions() {
42320
42656
  return this._transport.getDocJSActions();
42321
42657
  }
@@ -42386,6 +42722,7 @@ class PDFPageProxy {
42386
42722
  this.objs = new PDFObjects();
42387
42723
  this._intentStates = /* @__PURE__ */ new Map();
42388
42724
  this.destroyed = false;
42725
+ this.recordedGroups = null;
42389
42726
  }
42390
42727
  get pageNumber() {
42391
42728
  return this._pageIndex + 1;
@@ -42454,9 +42791,11 @@ class PDFPageProxy {
42454
42791
  annotationCanvasMap = null,
42455
42792
  pageColors = null,
42456
42793
  printAnnotationStorage = null,
42457
- isEditing = false
42794
+ isEditing = false,
42795
+ recordOperations = false,
42796
+ filteredOperationIndexes = null
42458
42797
  }) {
42459
- var _a2, _b2;
42798
+ var _a2, _b2, _c;
42460
42799
  (_a2 = this._stats) == null ? void 0 : _a2.time("Overall");
42461
42800
  const intentArgs = this._transport.getRenderingIntent(intent, annotationMode, printAnnotationStorage, isEditing);
42462
42801
  const {
@@ -42486,9 +42825,21 @@ class PDFPageProxy {
42486
42825
  (_b2 = this._stats) == null ? void 0 : _b2.time("Page Request");
42487
42826
  this._pumpOperatorList(intentArgs);
42488
42827
  }
42828
+ const shouldRecordOperations = !this.recordedGroups && (recordOperations || this._pdfBug && ((_c = globalThis.StepperManager) == null ? void 0 : _c.enabled));
42489
42829
  const complete = (error) => {
42490
- var _a3;
42830
+ var _a3, _b3, _c2;
42491
42831
  intentState.renderTasks.delete(internalRenderTask);
42832
+ if (shouldRecordOperations) {
42833
+ const recordedGroups = (_a3 = internalRenderTask.gfx) == null ? void 0 : _a3.dependencyTracker.take();
42834
+ if (recordedGroups) {
42835
+ (_b3 = internalRenderTask.stepper) == null ? void 0 : _b3.setOperatorGroups(recordedGroups);
42836
+ if (recordOperations) {
42837
+ this.recordedGroups = recordedGroups;
42838
+ }
42839
+ } else if (recordOperations) {
42840
+ this.recordedGroups = [];
42841
+ }
42842
+ }
42492
42843
  if (intentPrint) {
42493
42844
  __privateSet(this, _pendingCleanup, true);
42494
42845
  }
@@ -42505,7 +42856,7 @@ class PDFPageProxy {
42505
42856
  if (this._stats) {
42506
42857
  this._stats.timeEnd("Rendering");
42507
42858
  this._stats.timeEnd("Overall");
42508
- if ((_a3 = globalThis.Stats) == null ? void 0 : _a3.enabled) {
42859
+ if ((_c2 = globalThis.Stats) == null ? void 0 : _c2.enabled) {
42509
42860
  globalThis.Stats.add(this.pageNumber, this._stats);
42510
42861
  }
42511
42862
  }
@@ -42515,6 +42866,7 @@ class PDFPageProxy {
42515
42866
  params: {
42516
42867
  canvas: canvas2,
42517
42868
  canvasContext,
42869
+ dependencyTracker: shouldRecordOperations ? new CanvasDependencyTracker(canvas2) : null,
42518
42870
  viewport,
42519
42871
  transform: transform2,
42520
42872
  background
@@ -42529,7 +42881,8 @@ class PDFPageProxy {
42529
42881
  useRequestAnimationFrame: !intentPrint,
42530
42882
  pdfBug: this._pdfBug,
42531
42883
  pageColors,
42532
- enableHWA: this._transport.enableHWA
42884
+ enableHWA: this._transport.enableHWA,
42885
+ filteredOperationIndexes
42533
42886
  });
42534
42887
  (intentState.renderTasks || (intentState.renderTasks = /* @__PURE__ */ new Set())).add(internalRenderTask);
42535
42888
  const renderTask = internalRenderTask.task;
@@ -43498,6 +43851,12 @@ class WorkerTransport {
43498
43851
  getAttachments() {
43499
43852
  return this.messageHandler.sendWithPromise("GetAttachments", null);
43500
43853
  }
43854
+ getAnnotationsByType(types, pageIndexesToSkip) {
43855
+ return this.messageHandler.sendWithPromise("GetAnnotationsByType", {
43856
+ types,
43857
+ pageIndexesToSkip
43858
+ });
43859
+ }
43501
43860
  getDocJSActions() {
43502
43861
  return __privateMethod(this, _WorkerTransport_instances, cacheSimpleMethod_fn).call(this, "GetDocJSActions");
43503
43862
  }
@@ -43626,7 +43985,8 @@ const _InternalRenderTask = class _InternalRenderTask {
43626
43985
  useRequestAnimationFrame = false,
43627
43986
  pdfBug = false,
43628
43987
  pageColors = null,
43629
- enableHWA = false
43988
+ enableHWA = false,
43989
+ filteredOperationIndexes = null
43630
43990
  }) {
43631
43991
  __privateAdd(this, _rAF, null);
43632
43992
  this.callback = callback;
@@ -43655,6 +44015,8 @@ const _InternalRenderTask = class _InternalRenderTask {
43655
44015
  this._canvas = params.canvas;
43656
44016
  this._canvasContext = params.canvas ? null : params.canvasContext;
43657
44017
  this._enableHWA = enableHWA;
44018
+ this._dependencyTracker = params.dependencyTracker;
44019
+ this._filteredOperationIndexes = filteredOperationIndexes;
43658
44020
  }
43659
44021
  get completed() {
43660
44022
  return this.capability.promise.catch(function() {
@@ -43682,7 +44044,8 @@ const _InternalRenderTask = class _InternalRenderTask {
43682
44044
  const {
43683
44045
  viewport,
43684
44046
  transform: transform2,
43685
- background
44047
+ background,
44048
+ dependencyTracker
43686
44049
  } = this.params;
43687
44050
  const canvasContext = this._canvasContext || this._canvas.getContext("2d", {
43688
44051
  alpha: false,
@@ -43690,7 +44053,7 @@ const _InternalRenderTask = class _InternalRenderTask {
43690
44053
  });
43691
44054
  this.gfx = new CanvasGraphics(canvasContext, this.commonObjs, this.objs, this.canvasFactory, this.filterFactory, {
43692
44055
  optionalContentConfig
43693
- }, this.annotationCanvasMap, this.pageColors);
44056
+ }, this.annotationCanvasMap, this.pageColors, dependencyTracker);
43694
44057
  this.gfx.beginDrawing({
43695
44058
  transform: transform2,
43696
44059
  viewport,
@@ -43753,7 +44116,7 @@ const _InternalRenderTask = class _InternalRenderTask {
43753
44116
  if (this.cancelled) {
43754
44117
  return;
43755
44118
  }
43756
- this.operatorListIdx = this.gfx.executeOperatorList(this.operatorList, this.operatorListIdx, this._continueBound, this.stepper);
44119
+ this.operatorListIdx = this.gfx.executeOperatorList(this.operatorList, this.operatorListIdx, this._continueBound, this.stepper, this._filteredOperationIndexes);
43757
44120
  if (this.operatorListIdx === this.operatorList.argsArray.length) {
43758
44121
  this.running = false;
43759
44122
  if (this.operatorList.lastChunk) {
@@ -43769,8 +44132,8 @@ _rAF = new WeakMap();
43769
44132
  _canvasInUse = new WeakMap();
43770
44133
  __privateAdd(_InternalRenderTask, _canvasInUse, /* @__PURE__ */ new WeakSet());
43771
44134
  let InternalRenderTask = _InternalRenderTask;
43772
- const version = "5.4.54";
43773
- const build = "295fb3ec4";
44135
+ const version = "5.4.149";
44136
+ const build = "9e2e9e209";
43774
44137
  const _ColorPicker = class _ColorPicker {
43775
44138
  constructor({
43776
44139
  editor = null,
@@ -44457,6 +44820,7 @@ const _AnnotationElement = class _AnnotationElement {
44457
44820
  this.renderForms = parameters.renderForms;
44458
44821
  this.svgFactory = parameters.svgFactory;
44459
44822
  this.annotationStorage = parameters.annotationStorage;
44823
+ this.enableComment = parameters.enableComment;
44460
44824
  this.enableScripting = parameters.enableScripting;
44461
44825
  this.hasJSActions = parameters.hasJSActions;
44462
44826
  this._fieldObjects = parameters.fieldObjects;
@@ -44480,6 +44844,61 @@ const _AnnotationElement = class _AnnotationElement {
44480
44844
  get hasPopupData() {
44481
44845
  return _AnnotationElement._hasPopupData(this.data);
44482
44846
  }
44847
+ get hasCommentButton() {
44848
+ return this.enableComment && this._isEditable && this.hasPopupElement;
44849
+ }
44850
+ get commentButtonPosition() {
44851
+ const {
44852
+ quadPoints,
44853
+ rect
44854
+ } = this.data;
44855
+ let maxX = -Infinity;
44856
+ let maxY = -Infinity;
44857
+ if ((quadPoints == null ? void 0 : quadPoints.length) >= 8) {
44858
+ for (let i = 0; i < quadPoints.length; i += 8) {
44859
+ if (quadPoints[i + 1] > maxY) {
44860
+ maxY = quadPoints[i + 1];
44861
+ maxX = quadPoints[i + 2];
44862
+ } else if (quadPoints[i + 1] === maxY) {
44863
+ maxX = Math.max(maxX, quadPoints[i + 2]);
44864
+ }
44865
+ }
44866
+ return [maxX, maxY];
44867
+ }
44868
+ if (rect) {
44869
+ return [rect[2], rect[3]];
44870
+ }
44871
+ return null;
44872
+ }
44873
+ get commentButtonColor() {
44874
+ var _a2;
44875
+ if (!this.data.color) {
44876
+ return null;
44877
+ }
44878
+ const [r, g2, b2] = this.data.color;
44879
+ const opacity2 = (_a2 = this.data.opacity) != null ? _a2 : 1;
44880
+ const oppositeOpacity = 255 * (1 - opacity2);
44881
+ return __privateMethod(this, _AnnotationElement_instances, changeLightness_fn).call(this, Math.min(r + oppositeOpacity, 255), Math.min(g2 + oppositeOpacity, 255), Math.min(b2 + oppositeOpacity, 255));
44882
+ }
44883
+ _normalizePoint(point) {
44884
+ const {
44885
+ page: {
44886
+ view
44887
+ },
44888
+ viewport: {
44889
+ rawDims: {
44890
+ pageWidth,
44891
+ pageHeight,
44892
+ pageX,
44893
+ pageY
44894
+ }
44895
+ }
44896
+ } = this.parent;
44897
+ point[1] = view[3] - point[1] + view[1];
44898
+ point[0] = 100 * (point[0] - pageX) / pageWidth;
44899
+ point[1] = 100 * (point[1] - pageY) / pageHeight;
44900
+ return point;
44901
+ }
44483
44902
  updateEdited(params) {
44484
44903
  var _a2;
44485
44904
  if (!this.container) {
@@ -44537,7 +44956,8 @@ const _AnnotationElement = class _AnnotationElement {
44537
44956
  const {
44538
44957
  style
44539
44958
  } = container;
44540
- style.zIndex = this.parent.zIndex++;
44959
+ style.zIndex = this.parent.zIndex;
44960
+ this.parent.zIndex += 2;
44541
44961
  if (data.alternativeText) {
44542
44962
  container.title = data.alternativeText;
44543
44963
  }
@@ -44958,6 +45378,30 @@ _updates = new WeakMap();
44958
45378
  _hasBorder = new WeakMap();
44959
45379
  _popupElement = new WeakMap();
44960
45380
  _AnnotationElement_instances = new WeakSet();
45381
+ changeLightness_fn = function(r, g2, b2) {
45382
+ r /= 255;
45383
+ g2 /= 255;
45384
+ b2 /= 255;
45385
+ const max2 = Math.max(r, g2, b2);
45386
+ const min = Math.min(r, g2, b2);
45387
+ const l2 = (max2 + min) / 2;
45388
+ const newL = ((1 + Math.sqrt(l2)) / 2 * 100).toFixed(2);
45389
+ if (max2 === min) {
45390
+ return `hsl(0, 0%, ${newL}%)`;
45391
+ }
45392
+ const d2 = max2 - min;
45393
+ let h2;
45394
+ if (max2 === r) {
45395
+ h2 = (g2 - b2) / d2 + (g2 < b2 ? 6 : 0);
45396
+ } else if (max2 === g2) {
45397
+ h2 = (b2 - r) / d2 + 2;
45398
+ } else {
45399
+ h2 = (r - g2) / d2 + 4;
45400
+ }
45401
+ h2 = (h2 * 60).toFixed(2);
45402
+ const s2 = (d2 / (1 - Math.abs(2 * l2 - 1)) * 100).toFixed(2);
45403
+ return `hsl(${h2}, ${s2}%, ${newL}%)`;
45404
+ };
44961
45405
  setRectEdited_fn = function(rect) {
44962
45406
  const {
44963
45407
  container: {
@@ -46164,7 +46608,8 @@ class PopupAnnotationElement extends AnnotationElement {
46164
46608
  parentRect: this.data.parentRect || null,
46165
46609
  parent: this.parent,
46166
46610
  elements: this.elements,
46167
- open: this.data.open
46611
+ open: this.data.open,
46612
+ eventBus: this.linkService.eventBus
46168
46613
  });
46169
46614
  const elementIds = [];
46170
46615
  for (const element of this.elements) {
@@ -46189,7 +46634,8 @@ class PopupElement {
46189
46634
  parent,
46190
46635
  rect,
46191
46636
  parentRect,
46192
- open: open2
46637
+ open: open2,
46638
+ eventBus = null
46193
46639
  }) {
46194
46640
  __privateAdd(this, _PopupElement_instances);
46195
46641
  __privateAdd(this, _boundKeyDown, __privateMethod(this, _PopupElement_instances, keyDown_fn2).bind(this));
@@ -46201,12 +46647,16 @@ class PopupElement {
46201
46647
  __privateAdd(this, _contentsObj, null);
46202
46648
  __privateAdd(this, _dateObj, null);
46203
46649
  __privateAdd(this, _elements, null);
46650
+ __privateAdd(this, _eventBus2, null);
46204
46651
  __privateAdd(this, _parent, null);
46205
46652
  __privateAdd(this, _parentRect, null);
46206
46653
  __privateAdd(this, _pinned, false);
46207
46654
  __privateAdd(this, _popup, null);
46208
46655
  __privateAdd(this, _popupAbortController, null);
46209
46656
  __privateAdd(this, _position2, null);
46657
+ __privateAdd(this, _commentButton2, null);
46658
+ __privateAdd(this, _commentButtonPosition, null);
46659
+ __privateAdd(this, _commentButtonColor, null);
46210
46660
  __privateAdd(this, _rect, null);
46211
46661
  __privateAdd(this, _richText, null);
46212
46662
  __privateAdd(this, _titleObj, null);
@@ -46221,6 +46671,7 @@ class PopupElement {
46221
46671
  __privateSet(this, _rect, rect);
46222
46672
  __privateSet(this, _parentRect, parentRect);
46223
46673
  __privateSet(this, _elements, elements);
46674
+ __privateSet(this, _eventBus2, eventBus);
46224
46675
  __privateSet(this, _dateObj, PDFDateString.toDateObject(modificationDate));
46225
46676
  this.trigger = elements.flatMap((e2) => e2.getElementsToTriggerPopup());
46226
46677
  __privateMethod(this, _PopupElement_instances, addEventListeners_fn).call(this);
@@ -46376,12 +46827,16 @@ _container4 = new WeakMap();
46376
46827
  _contentsObj = new WeakMap();
46377
46828
  _dateObj = new WeakMap();
46378
46829
  _elements = new WeakMap();
46830
+ _eventBus2 = new WeakMap();
46379
46831
  _parent = new WeakMap();
46380
46832
  _parentRect = new WeakMap();
46381
46833
  _pinned = new WeakMap();
46382
46834
  _popup = new WeakMap();
46383
46835
  _popupAbortController = new WeakMap();
46384
46836
  _position2 = new WeakMap();
46837
+ _commentButton2 = new WeakMap();
46838
+ _commentButtonPosition = new WeakMap();
46839
+ _commentButtonColor = new WeakMap();
46385
46840
  _rect = new WeakMap();
46386
46841
  _richText = new WeakMap();
46387
46842
  _titleObj = new WeakMap();
@@ -46414,6 +46869,66 @@ addEventListeners_fn = function() {
46414
46869
  signal
46415
46870
  });
46416
46871
  }
46872
+ __privateMethod(this, _PopupElement_instances, renderCommentButton_fn).call(this);
46873
+ };
46874
+ setCommentButtonPosition_fn = function() {
46875
+ const element = __privateGet(this, _elements).find((e2) => e2.hasCommentButton);
46876
+ if (!element) {
46877
+ return;
46878
+ }
46879
+ __privateSet(this, _commentButtonPosition, element._normalizePoint(element.commentButtonPosition));
46880
+ __privateSet(this, _commentButtonColor, element.commentButtonColor);
46881
+ };
46882
+ renderCommentButton_fn = function() {
46883
+ if (__privateGet(this, _commentButton2)) {
46884
+ return;
46885
+ }
46886
+ if (!__privateGet(this, _commentButtonPosition)) {
46887
+ __privateMethod(this, _PopupElement_instances, setCommentButtonPosition_fn).call(this);
46888
+ }
46889
+ if (!__privateGet(this, _commentButtonPosition)) {
46890
+ return;
46891
+ }
46892
+ const button = __privateSet(this, _commentButton2, document.createElement("button"));
46893
+ button.className = "annotationCommentButton";
46894
+ const parentContainer = __privateGet(this, _elements)[0].container;
46895
+ button.style.zIndex = parentContainer.style.zIndex + 1;
46896
+ button.tabIndex = 0;
46897
+ const {
46898
+ signal
46899
+ } = __privateGet(this, _popupAbortController);
46900
+ button.addEventListener("hover", __privateGet(this, _boundToggle), {
46901
+ signal
46902
+ });
46903
+ button.addEventListener("keydown", __privateGet(this, _boundKeyDown), {
46904
+ signal
46905
+ });
46906
+ button.addEventListener("click", () => {
46907
+ var _a2;
46908
+ const [{
46909
+ data: {
46910
+ id: editId
46911
+ },
46912
+ annotationEditorType: mode
46913
+ }] = __privateGet(this, _elements);
46914
+ (_a2 = __privateGet(this, _eventBus2)) == null ? void 0 : _a2.dispatch("switchannotationeditormode", {
46915
+ source: this,
46916
+ editId,
46917
+ mode,
46918
+ editComment: true
46919
+ });
46920
+ }, {
46921
+ signal
46922
+ });
46923
+ const {
46924
+ style
46925
+ } = button;
46926
+ style.left = `calc(${__privateGet(this, _commentButtonPosition)[0]}%)`;
46927
+ style.top = `calc(${__privateGet(this, _commentButtonPosition)[1]}% - var(--comment-button-dim))`;
46928
+ if (__privateGet(this, _commentButtonColor)) {
46929
+ style.backgroundColor = __privateGet(this, _commentButtonColor);
46930
+ }
46931
+ parentContainer.after(button);
46417
46932
  };
46418
46933
  html_get = function() {
46419
46934
  const richText = __privateGet(this, _richText);
@@ -46848,6 +47363,33 @@ class InkAnnotationElement extends AnnotationElement {
46848
47363
  addHighlightArea() {
46849
47364
  this.container.classList.add("highlightArea");
46850
47365
  }
47366
+ get commentButtonPosition() {
47367
+ const {
47368
+ inkLists,
47369
+ rect
47370
+ } = this.data;
47371
+ if ((inkLists == null ? void 0 : inkLists.length) >= 1) {
47372
+ let maxX = -Infinity;
47373
+ let maxY = -Infinity;
47374
+ for (const inkList of inkLists) {
47375
+ for (let i = 0, ii = inkList.length; i < ii; i += 2) {
47376
+ if (inkList[i + 1] > maxY) {
47377
+ maxY = inkList[i + 1];
47378
+ maxX = inkList[i];
47379
+ } else if (inkList[i + 1] === maxY) {
47380
+ maxX = Math.max(maxX, inkList[i]);
47381
+ }
47382
+ }
47383
+ }
47384
+ if (maxX !== Infinity) {
47385
+ return [maxX, maxY];
47386
+ }
47387
+ }
47388
+ if (rect) {
47389
+ return [rect[2], rect[3]];
47390
+ }
47391
+ return null;
47392
+ }
46851
47393
  }
46852
47394
  _polylinesGroupElement = new WeakMap();
46853
47395
  _polylines = new WeakMap();
@@ -47121,6 +47663,7 @@ const _AnnotationLayer = class _AnnotationLayer {
47121
47663
  renderForms: params.renderForms !== false,
47122
47664
  svgFactory: new DOMSVGFactory(),
47123
47665
  annotationStorage: params.annotationStorage || new AnnotationStorage(),
47666
+ enableComment: params.enableComment === true,
47124
47667
  enableScripting: params.enableScripting === true,
47125
47668
  hasJSActions: params.hasJSActions,
47126
47669
  fieldObjects: params.fieldObjects,
@@ -47690,6 +48233,10 @@ const _FreeTextEditor = class _FreeTextEditor extends AnnotationEditor {
47690
48233
  get contentDiv() {
47691
48234
  return this.editorDiv;
47692
48235
  }
48236
+ getPDFRect() {
48237
+ const padding = _FreeTextEditor._internalPadding * this.parentScale;
48238
+ return this.getRect(padding, padding);
48239
+ }
47693
48240
  static deserialize(data, parent, uiManager) {
47694
48241
  return __async(this, null, function* () {
47695
48242
  var _a2;
@@ -47752,8 +48299,7 @@ const _FreeTextEditor = class _FreeTextEditor extends AnnotationEditor {
47752
48299
  if (this.deleted) {
47753
48300
  return this.serializeDeleted();
47754
48301
  }
47755
- const padding = _FreeTextEditor._internalPadding * this.parentScale;
47756
- const rect = this.getRect(padding, padding);
48302
+ const rect = this.getPDFRect();
47757
48303
  const color2 = AnnotationEditor._colorManager.convert(this.isAttachedToDOM ? getComputedStyle(this.editorDiv).color : __privateGet(this, _color2));
47758
48304
  const serialized = {
47759
48305
  annotationType: AnnotationEditorType.FREETEXT,
@@ -47778,6 +48324,9 @@ const _FreeTextEditor = class _FreeTextEditor extends AnnotationEditor {
47778
48324
  }
47779
48325
  renderAnnotationElement(annotation) {
47780
48326
  const content2 = super.renderAnnotationElement(annotation);
48327
+ if (!content2) {
48328
+ return null;
48329
+ }
47781
48330
  const {
47782
48331
  style
47783
48332
  } = content2;
@@ -47789,9 +48338,8 @@ const _FreeTextEditor = class _FreeTextEditor extends AnnotationEditor {
47789
48338
  div.append(line ? document.createTextNode(line) : document.createElement("br"));
47790
48339
  content2.append(div);
47791
48340
  }
47792
- const padding = _FreeTextEditor._internalPadding * this.parentScale;
47793
48341
  const params = {
47794
- rect: this.getRect(padding, padding)
48342
+ rect: this.getPDFRect()
47795
48343
  };
47796
48344
  params.popup = this.hasEditedComment ? this.comment : {
47797
48345
  text: __privateGet(this, _content)
@@ -49139,7 +49687,7 @@ const _HighlightEditor = class _HighlightEditor extends AnnotationEditor {
49139
49687
  if (this.deleted) {
49140
49688
  return this.serializeDeleted();
49141
49689
  }
49142
- const rect = this.getRect(0, 0);
49690
+ const rect = this.getPDFRect();
49143
49691
  const color2 = AnnotationEditor._colorManager.convert(this._uiManager.getNonHCMColor(this.color));
49144
49692
  const serialized = {
49145
49693
  annotationType: AnnotationEditorType.HIGHLIGHT,
@@ -49161,8 +49709,12 @@ const _HighlightEditor = class _HighlightEditor extends AnnotationEditor {
49161
49709
  return serialized;
49162
49710
  }
49163
49711
  renderAnnotationElement(annotation) {
49712
+ if (this.deleted) {
49713
+ annotation.hide();
49714
+ return null;
49715
+ }
49164
49716
  const params = {
49165
- rect: this.getRect(0, 0)
49717
+ rect: this.getPDFRect()
49166
49718
  };
49167
49719
  if (this.hasEditedComment) {
49168
49720
  params.popup = this.comment;
@@ -49992,7 +50544,7 @@ const _DrawingEditor = class _DrawingEditor extends AnnotationEditor {
49992
50544
  }
49993
50545
  renderAnnotationElement(annotation) {
49994
50546
  annotation.updateEdited({
49995
- rect: this.getRect(0, 0)
50547
+ rect: this.getPDFRect()
49996
50548
  });
49997
50549
  return null;
49998
50550
  }
@@ -51028,6 +51580,10 @@ const _InkEditor = class _InkEditor extends DrawingEditor {
51028
51580
  return serialized;
51029
51581
  }
51030
51582
  renderAnnotationElement(annotation) {
51583
+ if (this.deleted) {
51584
+ annotation.hide();
51585
+ return null;
51586
+ }
51031
51587
  const {
51032
51588
  points,
51033
51589
  rect
@@ -52469,7 +53025,7 @@ const _StampEditor = class _StampEditor extends AnnotationEditor {
52469
53025
  annotationType: AnnotationEditorType.STAMP,
52470
53026
  bitmapId: __privateGet(this, _bitmapId),
52471
53027
  pageIndex: this.pageIndex,
52472
- rect: this.getRect(0, 0),
53028
+ rect: this.getPDFRect(),
52473
53029
  rotation: this.rotation,
52474
53030
  isSvg: __privateGet(this, _isSvg),
52475
53031
  structTreeParentId: this._structTreeParentId
@@ -52525,8 +53081,12 @@ const _StampEditor = class _StampEditor extends AnnotationEditor {
52525
53081
  return serialized;
52526
53082
  }
52527
53083
  renderAnnotationElement(annotation) {
53084
+ if (this.deleted) {
53085
+ annotation.hide();
53086
+ return null;
53087
+ }
52528
53088
  const params = {
52529
- rect: this.getRect(0, 0)
53089
+ rect: this.getPDFRect()
52530
53090
  };
52531
53091
  if (this.hasEditedComment) {
52532
53092
  params.popup = this.comment;
@@ -57994,7 +58554,7 @@ const convertPdfToImages = (_0, ..._1) => __async(void 0, [_0, ..._1], function*
57994
58554
  console.log(`🔄 Convertendo PDF para imagens: ${pageCount} páginas`);
57995
58555
  for (let pageNum = 1; pageNum <= pageCount; pageNum++) {
57996
58556
  const page = yield pdf.getPage(pageNum);
57997
- const viewport = page.getViewport({ scale });
58557
+ const viewport = page.getViewport({ scale: 5 });
57998
58558
  const canvas2 = document.createElement("canvas");
57999
58559
  const context = canvas2.getContext("2d");
58000
58560
  canvas2.height = viewport.height;
@@ -59419,4 +59979,4 @@ export {
59419
59979
  sendToPrinter as y,
59420
59980
  validateLabelData as z
59421
59981
  };
59422
- //# sourceMappingURL=index-BOlnSrKc.js.map
59982
+ //# sourceMappingURL=index-Bl0CvwuC.js.map