@libresign/pdf-elements 0.1.2 → 0.2.1

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.
@@ -2676,7 +2676,7 @@ __webpack_require__.d(__webpack_exports__, {
2676
2676
  "default": () => (/* binding */ entry_lib)
2677
2677
  });
2678
2678
 
2679
- // UNUSED EXPORTS: PDFElements
2679
+ // UNUSED EXPORTS: PDFElements, setWorkerPath
2680
2680
 
2681
2681
  ;// ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
2682
2682
  /* eslint-disable no-var */
@@ -2696,958 +2696,6 @@ if (typeof window !== 'undefined') {
2696
2696
  // Indicate to webpack that this file can be concatenated
2697
2697
  /* harmony default export */ const setPublicPath = (null);
2698
2698
 
2699
- ;// ./node_modules/babel-loader/lib/index.js??clonedRuleSet-83.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/PDFElements.vue?vue&type=template&id=5a4a7f3b&scoped=true
2700
- var render = function render() {
2701
- var _vm = this,
2702
- _c = _vm._self._c;
2703
- return _c('div', {
2704
- staticClass: "pdf-elements-root",
2705
- style: {
2706
- width: _vm.width,
2707
- height: _vm.height
2708
- }
2709
- }, [_vm.pdfDocuments.length ? _c('div', {
2710
- staticClass: "pages-container",
2711
- style: {
2712
- transform: `scale(${_vm.visualScale / _vm.scale})`,
2713
- transformOrigin: 'top center'
2714
- }
2715
- }, _vm._l(_vm.pdfDocuments, function (pdfDoc, docIndex) {
2716
- return _c('div', {
2717
- key: docIndex
2718
- }, _vm._l(pdfDoc.pages, function (page, pIndex) {
2719
- return _c('div', {
2720
- key: `${docIndex}-${pIndex}`,
2721
- staticClass: "page-slot"
2722
- }, [_c('div', {
2723
- staticClass: "page-wrapper",
2724
- on: {
2725
- "mousedown": function ($event) {
2726
- return _vm.selectPage(docIndex, pIndex);
2727
- },
2728
- "touchstart": function ($event) {
2729
- return _vm.selectPage(docIndex, pIndex);
2730
- }
2731
- }
2732
- }, [_c('div', {
2733
- staticClass: "page-canvas",
2734
- class: {
2735
- 'shadow-outline': docIndex === _vm.selectedDocIndex && pIndex === _vm.selectedPageIndex
2736
- }
2737
- }, [_c('PDFPage', {
2738
- ref: `page${docIndex}-${pIndex}`,
2739
- refInFor: true,
2740
- attrs: {
2741
- "page": page,
2742
- "scale": _vm.scale
2743
- },
2744
- on: {
2745
- "onMeasure": function ($event) {
2746
- return _vm.onMeasure($event, docIndex, pIndex);
2747
- }
2748
- }
2749
- }), _c('div', {
2750
- staticClass: "overlay"
2751
- }, [_vm.isAddingMode && _vm.previewPageDocIndex === docIndex && _vm.previewPageIndex === pIndex && _vm.previewElement && _vm.previewVisible ? _c('div', {
2752
- staticClass: "preview-element",
2753
- style: {
2754
- left: `${_vm.previewPosition.x * _vm.previewScale.x}px`,
2755
- top: `${_vm.previewPosition.y * _vm.previewScale.y}px`,
2756
- width: `${_vm.previewElement.width * _vm.previewScale.x}px`,
2757
- height: `${_vm.previewElement.height * _vm.previewScale.y}px`
2758
- }
2759
- }, [_vm._t("custom", null, {
2760
- "object": _vm.previewElement,
2761
- "isSelected": false
2762
- })], 2) : _vm._e(), _vm._l(pdfDoc.allObjects[pIndex], function (object) {
2763
- return _c('DraggableElement', {
2764
- key: object.id,
2765
- ref: `draggable${docIndex}-${pIndex}-${object.id}`,
2766
- refInFor: true,
2767
- attrs: {
2768
- "object": object,
2769
- "pages-scale": _vm.getRenderPageScale(docIndex, pIndex),
2770
- "page-width": _vm.getPageWidth(docIndex, pIndex),
2771
- "page-height": _vm.getPageHeight(docIndex, pIndex),
2772
- "on-update": payload => _vm.updateObject(docIndex, object.id, payload),
2773
- "on-delete": () => _vm.deleteObject(docIndex, object.id),
2774
- "on-drag-start": (mouseX, mouseY, pointerOffset, dragShift) => _vm.startDraggingElement(docIndex, pIndex, object, mouseX, mouseY, pointerOffset, dragShift),
2775
- "on-drag-move": _vm.updateDraggingPosition,
2776
- "on-drag-end": _vm.stopDraggingElement,
2777
- "is-being-dragged-globally": _vm.isDraggingElement && _vm.draggingObject && _vm.draggingObject.id === object.id,
2778
- "dragging-client-pos": _vm.draggingClientPosition,
2779
- "current-doc-index": docIndex,
2780
- "current-page-index": pIndex,
2781
- "global-drag-doc-index": _vm.draggingDocIndex,
2782
- "global-drag-page-index": _vm.draggingPageIndex,
2783
- "show-selection-ui": _vm.showSelectionHandles && !_vm.hideSelectionUI && object.resizable !== false,
2784
- "show-default-actions": _vm.showElementActions && !_vm.hideSelectionUI
2785
- },
2786
- scopedSlots: _vm._u([{
2787
- key: "default",
2788
- fn: function (slotProps) {
2789
- return [_vm._t(slotProps.object.type ? `element-${slotProps.object.type}` : 'custom', function () {
2790
- return [_vm._t("custom", null, {
2791
- "object": slotProps.object,
2792
- "onDelete": slotProps.onDelete,
2793
- "onResize": slotProps.onResize
2794
- })];
2795
- }, {
2796
- "object": slotProps.object,
2797
- "onDelete": slotProps.onDelete,
2798
- "onResize": slotProps.onResize
2799
- })];
2800
- }
2801
- }, {
2802
- key: "actions",
2803
- fn: function (slotProps) {
2804
- return [_vm._t("actions", null, {
2805
- "object": slotProps.object,
2806
- "onDelete": slotProps.onDelete
2807
- })];
2808
- }
2809
- }], null, true)
2810
- });
2811
- })], 2)], 1), _vm.showPageFooter ? _c('div', {
2812
- staticClass: "page-footer"
2813
- }, [_c('span', [_vm._v(_vm._s(pdfDoc.name))]), _c('span', [_vm._v(_vm._s(_vm.formatPageNumber(pIndex + 1, pdfDoc.numPages)))])]) : _vm._e()])]);
2814
- }), 0);
2815
- }), 0) : _vm._e(), _vm.isDraggingElement && _vm.draggingObject ? _c('div', {
2816
- staticClass: "drag-portal",
2817
- style: {
2818
- position: 'fixed',
2819
- left: `${_vm.draggingClientPosition.x}px`,
2820
- top: `${_vm.draggingClientPosition.y}px`,
2821
- width: `${_vm.draggingObject.width * _vm.draggingScale}px`,
2822
- height: `${_vm.draggingObject.height * _vm.draggingScale}px`,
2823
- pointerEvents: 'none'
2824
- }
2825
- }, [_vm._t(_vm.draggingObject.type ? `element-${_vm.draggingObject.type}` : 'custom', function () {
2826
- return [_vm._t("custom", null, {
2827
- "object": _vm.draggingObject,
2828
- "isSelected": false
2829
- })];
2830
- }, {
2831
- "object": _vm.draggingObject,
2832
- "isSelected": false
2833
- })], 2) : _vm._e()]);
2834
- };
2835
- var staticRenderFns = [];
2836
-
2837
- // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.push.js
2838
- var es_array_push = __webpack_require__(4114);
2839
- // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.constructor.js
2840
- var es_iterator_constructor = __webpack_require__(8111);
2841
- // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.filter.js
2842
- var es_iterator_filter = __webpack_require__(2489);
2843
- // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.find.js
2844
- var es_iterator_find = __webpack_require__(116);
2845
- // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.for-each.js
2846
- var es_iterator_for_each = __webpack_require__(7588);
2847
- // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.map.js
2848
- var es_iterator_map = __webpack_require__(1701);
2849
- ;// ./node_modules/debounce/index.js
2850
- function debounce(function_, wait = 100, options = {}) {
2851
- if (typeof function_ !== 'function') {
2852
- throw new TypeError(`Expected the first parameter to be a function, got \`${typeof function_}\`.`);
2853
- }
2854
-
2855
- if (wait < 0) {
2856
- throw new RangeError('`wait` must not be negative.');
2857
- }
2858
-
2859
- if (typeof options === 'boolean') {
2860
- throw new TypeError('The `options` parameter must be an object, not a boolean. Use `{immediate: true}` instead.');
2861
- }
2862
-
2863
- const {immediate} = options;
2864
-
2865
- let storedContext;
2866
- let storedArguments;
2867
- let timeoutId;
2868
- let timestamp;
2869
- let result;
2870
-
2871
- function run() {
2872
- const callContext = storedContext;
2873
- const callArguments = storedArguments;
2874
- storedContext = undefined;
2875
- storedArguments = undefined;
2876
- result = function_.apply(callContext, callArguments);
2877
- return result;
2878
- }
2879
-
2880
- function later() {
2881
- const last = Date.now() - timestamp;
2882
-
2883
- if (last < wait && last >= 0) {
2884
- timeoutId = setTimeout(later, wait - last);
2885
- } else {
2886
- timeoutId = undefined;
2887
-
2888
- if (!immediate) {
2889
- result = run();
2890
- }
2891
- }
2892
- }
2893
-
2894
- const debounced = function (...arguments_) {
2895
- if (
2896
- storedContext
2897
- && this !== storedContext
2898
- && Object.getPrototypeOf(this) === Object.getPrototypeOf(storedContext)
2899
- ) {
2900
- throw new Error('Debounced method called with different contexts of the same prototype.');
2901
- }
2902
-
2903
- storedContext = this; // eslint-disable-line unicorn/no-this-assignment
2904
- storedArguments = arguments_;
2905
- timestamp = Date.now();
2906
-
2907
- const callNow = immediate && !timeoutId;
2908
-
2909
- if (!timeoutId) {
2910
- timeoutId = setTimeout(later, wait);
2911
- }
2912
-
2913
- if (callNow) {
2914
- result = run();
2915
- return result;
2916
- }
2917
-
2918
- return undefined;
2919
- };
2920
-
2921
- Object.defineProperty(debounced, 'isPending', {
2922
- get() {
2923
- return timeoutId !== undefined;
2924
- },
2925
- });
2926
-
2927
- debounced.clear = () => {
2928
- if (!timeoutId) {
2929
- return;
2930
- }
2931
-
2932
- clearTimeout(timeoutId);
2933
- timeoutId = undefined;
2934
- storedContext = undefined;
2935
- storedArguments = undefined;
2936
- };
2937
-
2938
- debounced.flush = () => {
2939
- if (!timeoutId) {
2940
- return;
2941
- }
2942
-
2943
- debounced.trigger();
2944
- };
2945
-
2946
- debounced.trigger = () => {
2947
- result = run();
2948
-
2949
- debounced.clear();
2950
- };
2951
-
2952
- return debounced;
2953
- }
2954
-
2955
- ;// ./node_modules/babel-loader/lib/index.js??clonedRuleSet-83.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/PDFPage.vue?vue&type=template&id=2c9e224a&scoped=true
2956
- var PDFPagevue_type_template_id_2c9e224a_scoped_true_render = function render() {
2957
- var _vm = this,
2958
- _c = _vm._self._c;
2959
- return _c('canvas', {
2960
- ref: "canvas"
2961
- });
2962
- };
2963
- var PDFPagevue_type_template_id_2c9e224a_scoped_true_staticRenderFns = [];
2964
-
2965
- ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-83.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/PDFPage.vue?vue&type=script&lang=js
2966
- /* harmony default export */ const PDFPagevue_type_script_lang_js = ({
2967
- name: 'PDFPage',
2968
- props: {
2969
- page: {
2970
- type: Promise,
2971
- required: true
2972
- },
2973
- scale: {
2974
- type: Number,
2975
- default: 1
2976
- }
2977
- },
2978
- data() {
2979
- return {
2980
- dynamicScale: this.scale,
2981
- isRendering: false,
2982
- boundMeasure: null
2983
- };
2984
- },
2985
- watch: {
2986
- scale(newScale) {
2987
- this.dynamicScale = newScale;
2988
- this.render();
2989
- }
2990
- },
2991
- mounted() {
2992
- this.boundMeasure = this.measure.bind(this);
2993
- window.addEventListener('resize', this.boundMeasure);
2994
- this.render();
2995
- },
2996
- beforeUnmount() {
2997
- if (this.boundMeasure) {
2998
- window.removeEventListener('resize', this.boundMeasure);
2999
- }
3000
- },
3001
- methods: {
3002
- getCanvasMeasurement() {
3003
- return {
3004
- canvasWidth: this.$refs.canvas.width,
3005
- canvasHeight: this.$refs.canvas.height
3006
- };
3007
- },
3008
- measure() {
3009
- this.$emit('onMeasure', {
3010
- scale: this.dynamicScale
3011
- });
3012
- },
3013
- async render() {
3014
- if (this.isRendering) return;
3015
- this.isRendering = true;
3016
- try {
3017
- const _page = await this.page;
3018
- const canvas = this.$refs.canvas;
3019
- const context = canvas.getContext('2d');
3020
- const viewport = _page.getViewport({
3021
- scale: this.dynamicScale
3022
- });
3023
- canvas.width = viewport.width;
3024
- canvas.height = viewport.height;
3025
- await _page.render({
3026
- canvasContext: context,
3027
- viewport
3028
- }).promise;
3029
- this.measure();
3030
- } finally {
3031
- this.isRendering = false;
3032
- }
3033
- }
3034
- }
3035
- });
3036
- ;// ./src/components/PDFPage.vue?vue&type=script&lang=js
3037
- /* harmony default export */ const components_PDFPagevue_type_script_lang_js = (PDFPagevue_type_script_lang_js);
3038
- ;// ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-55.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-55.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-55.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/PDFPage.vue?vue&type=style&index=0&id=2c9e224a&prod&scoped=true&lang=css
3039
- // extracted by mini-css-extract-plugin
3040
-
3041
- ;// ./src/components/PDFPage.vue?vue&type=style&index=0&id=2c9e224a&prod&scoped=true&lang=css
3042
-
3043
- ;// ./node_modules/@vue/vue-loader-v15/lib/runtime/componentNormalizer.js
3044
- /* globals __VUE_SSR_CONTEXT__ */
3045
-
3046
- // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
3047
- // This module is a runtime utility for cleaner component module output and will
3048
- // be included in the final webpack user bundle.
3049
-
3050
- function normalizeComponent(
3051
- scriptExports,
3052
- render,
3053
- staticRenderFns,
3054
- functionalTemplate,
3055
- injectStyles,
3056
- scopeId,
3057
- moduleIdentifier /* server only */,
3058
- shadowMode /* vue-cli only */
3059
- ) {
3060
- // Vue.extend constructor export interop
3061
- var options =
3062
- typeof scriptExports === 'function' ? scriptExports.options : scriptExports
3063
-
3064
- // render functions
3065
- if (render) {
3066
- options.render = render
3067
- options.staticRenderFns = staticRenderFns
3068
- options._compiled = true
3069
- }
3070
-
3071
- // functional template
3072
- if (functionalTemplate) {
3073
- options.functional = true
3074
- }
3075
-
3076
- // scopedId
3077
- if (scopeId) {
3078
- options._scopeId = 'data-v-' + scopeId
3079
- }
3080
-
3081
- var hook
3082
- if (moduleIdentifier) {
3083
- // server build
3084
- hook = function (context) {
3085
- // 2.3 injection
3086
- context =
3087
- context || // cached call
3088
- (this.$vnode && this.$vnode.ssrContext) || // stateful
3089
- (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
3090
- // 2.2 with runInNewContext: true
3091
- if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
3092
- context = __VUE_SSR_CONTEXT__
3093
- }
3094
- // inject component styles
3095
- if (injectStyles) {
3096
- injectStyles.call(this, context)
3097
- }
3098
- // register component module identifier for async chunk inferrence
3099
- if (context && context._registeredComponents) {
3100
- context._registeredComponents.add(moduleIdentifier)
3101
- }
3102
- }
3103
- // used by ssr in case component is cached and beforeCreate
3104
- // never gets called
3105
- options._ssrRegister = hook
3106
- } else if (injectStyles) {
3107
- hook = shadowMode
3108
- ? function () {
3109
- injectStyles.call(
3110
- this,
3111
- (options.functional ? this.parent : this).$root.$options.shadowRoot
3112
- )
3113
- }
3114
- : injectStyles
3115
- }
3116
-
3117
- if (hook) {
3118
- if (options.functional) {
3119
- // for template-only hot-reload because in that case the render fn doesn't
3120
- // go through the normalizer
3121
- options._injectStyles = hook
3122
- // register for functional component in vue file
3123
- var originalRender = options.render
3124
- options.render = function renderWithStyleInjection(h, context) {
3125
- hook.call(context)
3126
- return originalRender(h, context)
3127
- }
3128
- } else {
3129
- // inject component registration as beforeCreate hook
3130
- var existing = options.beforeCreate
3131
- options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
3132
- }
3133
- }
3134
-
3135
- return {
3136
- exports: scriptExports,
3137
- options: options
3138
- }
3139
- }
3140
-
3141
- ;// ./src/components/PDFPage.vue
3142
-
3143
-
3144
-
3145
- ;
3146
-
3147
-
3148
- /* normalize component */
3149
-
3150
- var component = normalizeComponent(
3151
- components_PDFPagevue_type_script_lang_js,
3152
- PDFPagevue_type_template_id_2c9e224a_scoped_true_render,
3153
- PDFPagevue_type_template_id_2c9e224a_scoped_true_staticRenderFns,
3154
- false,
3155
- null,
3156
- "2c9e224a",
3157
- null
3158
-
3159
- )
3160
-
3161
- /* harmony default export */ const PDFPage = (component.exports);
3162
- ;// ./node_modules/babel-loader/lib/index.js??clonedRuleSet-83.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/DraggableElement.vue?vue&type=template&id=55db89ce&scoped=true
3163
- var DraggableElementvue_type_template_id_55db89ce_scoped_true_render = function render() {
3164
- var _vm = this,
3165
- _c = _vm._self._c;
3166
- return _c('div', {
3167
- staticClass: "draggable-wrapper"
3168
- }, [_vm.isSelected && !_vm.isBeingDraggedGlobally && _vm.showSelectionUi && _vm.showDefaultActions ? _c('div', {
3169
- staticClass: "actions-toolbar",
3170
- style: _vm.toolbarStyle
3171
- }, [_vm._t("actions", function () {
3172
- return [_c('button', {
3173
- staticClass: "action-btn",
3174
- attrs: {
3175
- "type": "button",
3176
- "title": "Delete"
3177
- },
3178
- on: {
3179
- "click": function ($event) {
3180
- $event.stopPropagation();
3181
- return _vm.onDelete.apply(null, arguments);
3182
- }
3183
- }
3184
- }, [_c('svg', {
3185
- attrs: {
3186
- "width": "16",
3187
- "height": "16",
3188
- "viewBox": "0 0 16 16",
3189
- "fill": "currentColor"
3190
- }
3191
- }, [_c('path', {
3192
- attrs: {
3193
- "d": "M6.5 1h3a.5.5 0 0 1 .5.5v1H6v-1a.5.5 0 0 1 .5-.5ZM11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3A1.5 1.5 0 0 0 5 1.5v1H2.5a.5.5 0 0 0 0 1h.5v10.5A1.5 1.5 0 0 0 4.5 15h7a1.5 1.5 0 0 0 1.5-1.5V3.5h.5a.5.5 0 0 0 0-1H11Zm1 1v10.5a.5.5 0 0 1-.5.5h-7a.5.5 0 0 1-.5-.5V3.5h8Z"
3194
- }
3195
- })])])];
3196
- }, {
3197
- "object": _vm.object,
3198
- "onDelete": _vm.onDelete
3199
- })], 2) : _vm._e(), _c('div', {
3200
- staticClass: "draggable-element",
3201
- class: {
3202
- selected: _vm.isSelected && _vm.showSelectionUi
3203
- },
3204
- style: [_vm.elementStyle, _vm.dragElementStyle],
3205
- attrs: {
3206
- "draggable": "false"
3207
- },
3208
- on: {
3209
- "dragstart": function ($event) {
3210
- $event.preventDefault();
3211
- },
3212
- "mousedown": _vm.handleElementClick,
3213
- "touchstart": _vm.handleElementClick
3214
- }
3215
- }, [_vm._t("default", null, {
3216
- "object": _vm.object,
3217
- "isSelected": _vm.isSelected,
3218
- "onDelete": _vm.onDelete,
3219
- "onResize": _vm.startResizeFromSlot
3220
- }), _vm.isSelected && _vm.showSelectionUi ? _vm._l(_vm.resizeDirections, function (dir) {
3221
- return _c('button', {
3222
- key: dir,
3223
- staticClass: "resize-handle",
3224
- class: `handle-${dir}`,
3225
- attrs: {
3226
- "type": "button"
3227
- },
3228
- on: {
3229
- "mousedown": function ($event) {
3230
- $event.stopPropagation();
3231
- $event.preventDefault();
3232
- return _vm.startResize(dir, $event);
3233
- },
3234
- "touchstart": function ($event) {
3235
- $event.stopPropagation();
3236
- $event.preventDefault();
3237
- return _vm.startResize(dir, $event);
3238
- }
3239
- }
3240
- });
3241
- }) : _vm._e()], 2)]);
3242
- };
3243
- var DraggableElementvue_type_template_id_55db89ce_scoped_true_staticRenderFns = [];
3244
-
3245
- ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-83.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/DraggableElement.vue?vue&type=script&lang=js
3246
- /* harmony default export */ const DraggableElementvue_type_script_lang_js = ({
3247
- name: 'DraggableElement',
3248
- props: {
3249
- object: {
3250
- type: Object,
3251
- required: true
3252
- },
3253
- pagesScale: {
3254
- type: Number,
3255
- default: 1
3256
- },
3257
- pageWidth: {
3258
- type: Number,
3259
- required: true
3260
- },
3261
- pageHeight: {
3262
- type: Number,
3263
- required: true
3264
- },
3265
- onUpdate: {
3266
- type: Function,
3267
- default: () => {}
3268
- },
3269
- onDelete: {
3270
- type: Function,
3271
- default: () => {}
3272
- },
3273
- onDragStart: {
3274
- type: Function,
3275
- default: () => {}
3276
- },
3277
- onDragMove: {
3278
- type: Function,
3279
- default: () => {}
3280
- },
3281
- onDragEnd: {
3282
- type: Function,
3283
- default: () => {}
3284
- },
3285
- isBeingDraggedGlobally: {
3286
- type: Boolean,
3287
- default: false
3288
- },
3289
- draggingClientPos: {
3290
- type: Object,
3291
- default: () => ({
3292
- x: 0,
3293
- y: 0
3294
- })
3295
- },
3296
- currentDocIndex: {
3297
- type: Number,
3298
- default: -1
3299
- },
3300
- currentPageIndex: {
3301
- type: Number,
3302
- default: -1
3303
- },
3304
- globalDragDocIndex: {
3305
- type: Number,
3306
- default: -1
3307
- },
3308
- globalDragPageIndex: {
3309
- type: Number,
3310
- default: -1
3311
- },
3312
- showSelectionUi: {
3313
- type: Boolean,
3314
- default: true
3315
- },
3316
- showDefaultActions: {
3317
- type: Boolean,
3318
- default: true
3319
- }
3320
- },
3321
- data() {
3322
- return {
3323
- isSelected: false,
3324
- mode: 'idle',
3325
- direction: '',
3326
- startX: 0,
3327
- startY: 0,
3328
- startLeft: 0,
3329
- startTop: 0,
3330
- startWidth: 0,
3331
- startHeight: 0,
3332
- offsetX: 0,
3333
- offsetY: 0,
3334
- resizeOffsetX: 0,
3335
- resizeOffsetY: 0,
3336
- resizeOffsetW: 0,
3337
- resizeOffsetH: 0,
3338
- aspectRatio: 1,
3339
- lastMouseX: 0,
3340
- lastMouseY: 0,
3341
- pointerOffsetDoc: {
3342
- x: 0,
3343
- y: 0
3344
- },
3345
- currentPageRect: null,
3346
- rafId: null
3347
- };
3348
- },
3349
- computed: {
3350
- resizeDirections() {
3351
- return ['top-left', 'top-right', 'bottom-left', 'bottom-right'];
3352
- },
3353
- elementStyle() {
3354
- const scale = this.pagesScale || 1;
3355
- const currentX = this.object.x + this.offsetX + this.resizeOffsetX;
3356
- const currentY = this.object.y + this.offsetY + this.resizeOffsetY;
3357
- const currentWidth = this.object.width + this.resizeOffsetW;
3358
- const currentHeight = this.object.height + this.resizeOffsetH;
3359
- return {
3360
- left: `${currentX * scale}px`,
3361
- top: `${currentY * scale}px`,
3362
- width: `${currentWidth * scale}px`,
3363
- height: `${currentHeight * scale}px`
3364
- };
3365
- },
3366
- toolbarStyle() {
3367
- const scale = this.pagesScale || 1;
3368
- const x = this.object.x + this.offsetX + this.resizeOffsetX;
3369
- const y = this.object.y + this.offsetY + this.resizeOffsetY;
3370
- const width = this.object.width + this.resizeOffsetW;
3371
- return {
3372
- left: `${(x + width / 2) * scale}px`,
3373
- top: `${(y - 48) * scale}px`,
3374
- transform: 'translateX(-50%)'
3375
- };
3376
- },
3377
- dragElementStyle() {
3378
- if (!this.isBeingDraggedGlobally || !this.draggingClientPos) {
3379
- return {};
3380
- }
3381
- return {
3382
- opacity: 0,
3383
- pointerEvents: 'none'
3384
- };
3385
- }
3386
- },
3387
- mounted() {
3388
- this.handleClickOutside = this.handleClickOutside.bind(this);
3389
- this.boundHandleMove = this.handleMove.bind(this);
3390
- this.boundStopInteraction = this.stopInteraction.bind(this);
3391
- document.addEventListener('mousedown', this.handleClickOutside);
3392
- document.addEventListener('touchstart', this.handleClickOutside);
3393
- },
3394
- beforeUnmount() {
3395
- document.removeEventListener('mousedown', this.handleClickOutside);
3396
- document.removeEventListener('touchstart', this.handleClickOutside);
3397
- window.removeEventListener('mousemove', this.boundHandleMove);
3398
- window.removeEventListener('mouseup', this.boundStopInteraction);
3399
- window.removeEventListener('touchmove', this.boundHandleMove);
3400
- window.removeEventListener('touchend', this.boundStopInteraction);
3401
- if (this.rafId) cancelAnimationFrame(this.rafId);
3402
- },
3403
- methods: {
3404
- handleElementClick(event) {
3405
- if (event.target.closest('.delete-handle') || event.target.closest('[data-stop-drag]') || event.target.closest('.actions-toolbar')) {
3406
- return;
3407
- }
3408
- event.preventDefault();
3409
- this.isSelected = true;
3410
- this.startDrag(event);
3411
- },
3412
- handleClickOutside(event) {
3413
- if (this.$el && !this.$el.contains(event.target)) {
3414
- this.isSelected = false;
3415
- }
3416
- },
3417
- startResizeFromSlot(direction, event) {
3418
- if (!direction || !event) return;
3419
- this.startResize(direction, event);
3420
- },
3421
- startDrag(event) {
3422
- if (event.target.classList.contains('delete')) return;
3423
- if (event.target.classList.contains('resize-handle')) return;
3424
- this.mode = 'drag';
3425
- this.startX = event.type.includes('touch') ? event.touches[0].clientX : event.clientX;
3426
- this.startY = event.type.includes('touch') ? event.touches[0].clientY : event.clientY;
3427
- this.startLeft = this.object.x;
3428
- this.startTop = this.object.y;
3429
- this.offsetX = 0;
3430
- this.offsetY = 0;
3431
- this.resetResizeOffsets();
3432
- const elementRect = this.$el.querySelector('.draggable-element').getBoundingClientRect();
3433
- this.pointerOffsetDoc.x = this.startX - elementRect.left;
3434
- this.pointerOffsetDoc.y = this.startY - elementRect.top;
3435
- const pageRect = this.capturePageRect();
3436
- this.currentPageRect = pageRect;
3437
- let dragElementShift = {
3438
- x: 0,
3439
- y: 0
3440
- };
3441
- if (pageRect) {
3442
- const expectedLeft = pageRect.left + this.object.x * this.pagesScale;
3443
- const expectedTop = pageRect.top + this.object.y * this.pagesScale;
3444
- dragElementShift = {
3445
- x: elementRect.left - expectedLeft,
3446
- y: elementRect.top - expectedTop
3447
- };
3448
- }
3449
- this.onDragStart(this.startX, this.startY, {
3450
- ...this.pointerOffsetDoc
3451
- }, dragElementShift);
3452
- window.addEventListener('mousemove', this.boundHandleMove);
3453
- window.addEventListener('mouseup', this.boundStopInteraction);
3454
- window.addEventListener('touchmove', this.boundHandleMove);
3455
- window.addEventListener('touchend', this.boundStopInteraction);
3456
- },
3457
- startResize(direction, event) {
3458
- this.mode = 'resize';
3459
- this.direction = direction;
3460
- this.startX = event.type.includes('touch') ? event.touches[0].clientX : event.clientX;
3461
- this.startY = event.type.includes('touch') ? event.touches[0].clientY : event.clientY;
3462
- this.startLeft = this.object.x;
3463
- this.startTop = this.object.y;
3464
- this.startWidth = this.object.width;
3465
- this.startHeight = this.object.height;
3466
- this.aspectRatio = this.startWidth / this.startHeight;
3467
- this.offsetX = 0;
3468
- this.offsetY = 0;
3469
- this.resetResizeOffsets();
3470
- window.addEventListener('mousemove', this.boundHandleMove);
3471
- window.addEventListener('mouseup', this.boundStopInteraction);
3472
- window.addEventListener('touchmove', this.boundHandleMove);
3473
- window.addEventListener('touchend', this.boundStopInteraction);
3474
- },
3475
- handleMove(event) {
3476
- if (this.mode === 'idle') return;
3477
- event.preventDefault();
3478
- if (this.rafId) return;
3479
- this.rafId = requestAnimationFrame(() => {
3480
- const currentX = event.type.includes('touch') ? event.touches[0]?.clientX : event.clientX;
3481
- const currentY = event.type.includes('touch') ? event.touches[0]?.clientY : event.clientY;
3482
- if (currentX === undefined || currentY === undefined) return;
3483
- this.lastMouseX = currentX;
3484
- this.lastMouseY = currentY;
3485
- const deltaX = (currentX - this.startX) / this.pagesScale;
3486
- const deltaY = (currentY - this.startY) / this.pagesScale;
3487
- if (this.mode === 'drag') {
3488
- const pageRect = this.currentPageRect;
3489
- if (pageRect) {
3490
- const newElementLeft = currentX - this.pointerOffsetDoc.x;
3491
- const newElementTop = currentY - this.pointerOffsetDoc.y;
3492
- const newX = (newElementLeft - pageRect.left) / this.pagesScale;
3493
- const newY = (newElementTop - pageRect.top) / this.pagesScale;
3494
- this.offsetX = newX - this.object.x;
3495
- this.offsetY = newY - this.object.y;
3496
- } else {
3497
- this.offsetX = deltaX;
3498
- this.offsetY = deltaY;
3499
- }
3500
- this.onDragMove(currentX, currentY);
3501
- if (this.isBeingDraggedGlobally) {
3502
- this.onUpdate({
3503
- _globalDrag: true,
3504
- _mouseX: currentX,
3505
- _mouseY: currentY
3506
- });
3507
- }
3508
- this.rafId = null;
3509
- return;
3510
- }
3511
- const minSize = 16;
3512
- let newWidth = this.startWidth;
3513
- let newHeight = this.startHeight;
3514
- let newLeft = this.startLeft;
3515
- let newTop = this.startTop;
3516
- const widthChange = this.direction.includes('right') ? deltaX : this.direction.includes('left') ? -deltaX : 0;
3517
- newWidth = this.startWidth + widthChange;
3518
- if (newWidth < minSize) newWidth = minSize;
3519
- newHeight = newWidth / this.aspectRatio;
3520
- if (this.direction.includes('left')) {
3521
- newLeft = this.startLeft + (this.startWidth - newWidth);
3522
- if (newLeft < 0) {
3523
- const overflow = -newLeft;
3524
- newLeft = 0;
3525
- newWidth = newWidth - overflow;
3526
- newHeight = newWidth / this.aspectRatio;
3527
- }
3528
- }
3529
- if (this.direction.includes('top')) {
3530
- newTop = this.startTop + (this.startHeight - newHeight);
3531
- if (newTop < 0) {
3532
- const overflow = -newTop;
3533
- newTop = 0;
3534
- newHeight = newHeight - overflow;
3535
- newWidth = newHeight * this.aspectRatio;
3536
- if (this.direction.includes('left')) {
3537
- newLeft = this.startLeft + (this.startWidth - newWidth);
3538
- }
3539
- }
3540
- }
3541
- if (newLeft + newWidth > this.pageWidth) {
3542
- const excess = newLeft + newWidth - this.pageWidth;
3543
- newWidth -= excess;
3544
- newHeight = newWidth / this.aspectRatio;
3545
- }
3546
- if (newTop + newHeight > this.pageHeight) {
3547
- const excess = newTop + newHeight - this.pageHeight;
3548
- newHeight -= excess;
3549
- newWidth = newHeight * this.aspectRatio;
3550
- if (this.direction.includes('left')) {
3551
- newLeft = this.startLeft + (this.startWidth - newWidth);
3552
- }
3553
- }
3554
- this.resizeOffsetX = newLeft - this.object.x;
3555
- this.resizeOffsetY = newTop - this.object.y;
3556
- this.resizeOffsetW = newWidth - this.object.width;
3557
- this.resizeOffsetH = newHeight - this.object.height;
3558
- this.rafId = null;
3559
- });
3560
- },
3561
- stopInteraction() {
3562
- if (this.mode === 'idle') return;
3563
- if (this.mode === 'drag' && (this.offsetX !== 0 || this.offsetY !== 0)) {
3564
- if (this.isBeingDraggedGlobally) {
3565
- this.onUpdate({
3566
- _globalDrag: true,
3567
- _mouseX: this.lastMouseX,
3568
- _mouseY: this.lastMouseY
3569
- });
3570
- } else {
3571
- const x = Math.max(0, Math.min(this.object.x + this.offsetX, this.pageWidth - this.object.width));
3572
- const y = Math.max(0, Math.min(this.object.y + this.offsetY, this.pageHeight - this.object.height));
3573
- this.onUpdate({
3574
- x,
3575
- y
3576
- });
3577
- }
3578
- }
3579
- if (this.mode === 'resize' && (this.resizeOffsetW !== 0 || this.resizeOffsetH !== 0 || this.resizeOffsetX !== 0 || this.resizeOffsetY !== 0)) {
3580
- const x = this.object.x + this.resizeOffsetX;
3581
- const y = this.object.y + this.resizeOffsetY;
3582
- const width = this.object.width + this.resizeOffsetW;
3583
- const height = this.object.height + this.resizeOffsetH;
3584
- this.onUpdate({
3585
- x,
3586
- y,
3587
- width,
3588
- height
3589
- });
3590
- }
3591
- this.resetOffsets();
3592
- this.onDragEnd();
3593
- window.removeEventListener('mousemove', this.boundHandleMove);
3594
- window.removeEventListener('mouseup', this.boundStopInteraction);
3595
- window.removeEventListener('touchmove', this.boundHandleMove);
3596
- window.removeEventListener('touchend', this.boundStopInteraction);
3597
- },
3598
- capturePageRect() {
3599
- const wrapper = this.$el.closest('.page-wrapper');
3600
- if (!wrapper) return null;
3601
- const canvas = wrapper.querySelector('canvas');
3602
- return canvas ? canvas.getBoundingClientRect() : null;
3603
- },
3604
- resetResizeOffsets() {
3605
- this.resizeOffsetX = 0;
3606
- this.resizeOffsetY = 0;
3607
- this.resizeOffsetW = 0;
3608
- this.resizeOffsetH = 0;
3609
- },
3610
- resetOffsets() {
3611
- this.mode = 'idle';
3612
- this.offsetX = 0;
3613
- this.offsetY = 0;
3614
- this.resetResizeOffsets();
3615
- this.pointerOffsetDoc = {
3616
- x: 0,
3617
- y: 0
3618
- };
3619
- this.currentPageRect = null;
3620
- }
3621
- }
3622
- });
3623
- ;// ./src/components/DraggableElement.vue?vue&type=script&lang=js
3624
- /* harmony default export */ const components_DraggableElementvue_type_script_lang_js = (DraggableElementvue_type_script_lang_js);
3625
- ;// ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-55.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-55.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-55.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/DraggableElement.vue?vue&type=style&index=0&id=55db89ce&prod&scoped=true&lang=css
3626
- // extracted by mini-css-extract-plugin
3627
-
3628
- ;// ./src/components/DraggableElement.vue?vue&type=style&index=0&id=55db89ce&prod&scoped=true&lang=css
3629
-
3630
- ;// ./src/components/DraggableElement.vue
3631
-
3632
-
3633
-
3634
- ;
3635
-
3636
-
3637
- /* normalize component */
3638
-
3639
- var DraggableElement_component = normalizeComponent(
3640
- components_DraggableElementvue_type_script_lang_js,
3641
- DraggableElementvue_type_template_id_55db89ce_scoped_true_render,
3642
- DraggableElementvue_type_template_id_55db89ce_scoped_true_staticRenderFns,
3643
- false,
3644
- null,
3645
- "55db89ce",
3646
- null
3647
-
3648
- )
3649
-
3650
- /* harmony default export */ const DraggableElement = (DraggableElement_component.exports);
3651
2699
  ;// ./node_modules/pdfjs-dist/build/pdf.mjs
3652
2700
  /**
3653
2701
  * @licstart The following is the entire license notice for the
@@ -15986,7 +15034,7 @@ for (const op in OPS) {
15986
15034
  }
15987
15035
 
15988
15036
  ;// ./src/display/worker_options.js
15989
- class GlobalWorkerOptions {
15037
+ class pdf_GlobalWorkerOptions {
15990
15038
  static #port = null;
15991
15039
  static #src = "";
15992
15040
  static get workerPort() {
@@ -18118,7 +17166,7 @@ function getDocument(src = {}) {
18118
17166
  if (!worker) {
18119
17167
  worker = PDFWorker.create({
18120
17168
  verbosity,
18121
- port: GlobalWorkerOptions.workerPort
17169
+ port: pdf_GlobalWorkerOptions.workerPort
18122
17170
  });
18123
17171
  task._worker = worker;
18124
17172
  }
@@ -18871,7 +17919,7 @@ class PDFWorker {
18871
17919
  static {
18872
17920
  if (isNodeJS) {
18873
17921
  this.#isWorkerDisabled = true;
18874
- GlobalWorkerOptions.workerSrc ||= "./pdf.worker.mjs";
17922
+ pdf_GlobalWorkerOptions.workerSrc ||= "./pdf.worker.mjs";
18875
17923
  }
18876
17924
  this._isSameOrigin = (baseUrl, otherUrl) => {
18877
17925
  const base = URL.parse(baseUrl);
@@ -19043,8 +18091,8 @@ class PDFWorker {
19043
18091
  return new PDFWorker(params);
19044
18092
  }
19045
18093
  static get workerSrc() {
19046
- if (GlobalWorkerOptions.workerSrc) {
19047
- return GlobalWorkerOptions.workerSrc;
18094
+ if (pdf_GlobalWorkerOptions.workerSrc) {
18095
+ return pdf_GlobalWorkerOptions.workerSrc;
19048
18096
  }
19049
18097
  throw new Error('No "GlobalWorkerOptions.workerSrc" specified.');
19050
18098
  }
@@ -29583,472 +28631,1427 @@ class AnnotationEditorLayer {
29583
28631
  this.#allowClick = true;
29584
28632
  return;
29585
28633
  }
29586
- const currentMode = this.#uiManager.getMode();
29587
- if (currentMode === AnnotationEditorType.STAMP || currentMode === AnnotationEditorType.SIGNATURE) {
29588
- this.#uiManager.unselectAll();
29589
- return;
28634
+ const currentMode = this.#uiManager.getMode();
28635
+ if (currentMode === AnnotationEditorType.STAMP || currentMode === AnnotationEditorType.SIGNATURE) {
28636
+ this.#uiManager.unselectAll();
28637
+ return;
28638
+ }
28639
+ this.createAndAddNewEditor(event, false);
28640
+ }
28641
+ pointerdown(event) {
28642
+ if (this.#uiManager.getMode() === AnnotationEditorType.HIGHLIGHT) {
28643
+ this.enableTextSelection();
28644
+ }
28645
+ if (this.#hadPointerDown) {
28646
+ this.#hadPointerDown = false;
28647
+ return;
28648
+ }
28649
+ const {
28650
+ isMac
28651
+ } = util_FeatureTest.platform;
28652
+ if (event.button !== 0 || event.ctrlKey && isMac) {
28653
+ return;
28654
+ }
28655
+ if (event.target !== this.div) {
28656
+ return;
28657
+ }
28658
+ this.#hadPointerDown = true;
28659
+ if (this.#currentEditorType?.isDrawer) {
28660
+ this.startDrawingSession(event);
28661
+ return;
28662
+ }
28663
+ const editor = this.#uiManager.getActive();
28664
+ this.#allowClick = !editor || editor.isEmpty();
28665
+ }
28666
+ startDrawingSession(event) {
28667
+ this.div.focus({
28668
+ preventScroll: true
28669
+ });
28670
+ if (this.#drawingAC) {
28671
+ this.#currentEditorType.startDrawing(this, this.#uiManager, false, event);
28672
+ return;
28673
+ }
28674
+ this.#uiManager.setCurrentDrawingSession(this);
28675
+ this.#drawingAC = new AbortController();
28676
+ const signal = this.#uiManager.combinedSignal(this.#drawingAC);
28677
+ this.div.addEventListener("blur", ({
28678
+ relatedTarget
28679
+ }) => {
28680
+ if (relatedTarget && !this.div.contains(relatedTarget)) {
28681
+ this.#focusedElement = null;
28682
+ this.commitOrRemove();
28683
+ }
28684
+ }, {
28685
+ signal
28686
+ });
28687
+ this.#currentEditorType.startDrawing(this, this.#uiManager, false, event);
28688
+ }
28689
+ pause(on) {
28690
+ if (on) {
28691
+ const {
28692
+ activeElement
28693
+ } = document;
28694
+ if (this.div.contains(activeElement)) {
28695
+ this.#focusedElement = activeElement;
28696
+ }
28697
+ return;
28698
+ }
28699
+ if (this.#focusedElement) {
28700
+ setTimeout(() => {
28701
+ this.#focusedElement?.focus();
28702
+ this.#focusedElement = null;
28703
+ }, 0);
28704
+ }
28705
+ }
28706
+ endDrawingSession(isAborted = false) {
28707
+ if (!this.#drawingAC) {
28708
+ return null;
28709
+ }
28710
+ this.#uiManager.setCurrentDrawingSession(null);
28711
+ this.#drawingAC.abort();
28712
+ this.#drawingAC = null;
28713
+ this.#focusedElement = null;
28714
+ return this.#currentEditorType.endDrawing(isAborted);
28715
+ }
28716
+ findNewParent(editor, x, y) {
28717
+ const layer = this.#uiManager.findParent(x, y);
28718
+ if (layer === null || layer === this) {
28719
+ return false;
28720
+ }
28721
+ layer.changeParent(editor);
28722
+ return true;
28723
+ }
28724
+ commitOrRemove() {
28725
+ if (this.#drawingAC) {
28726
+ this.endDrawingSession();
28727
+ return true;
28728
+ }
28729
+ return false;
28730
+ }
28731
+ onScaleChanging() {
28732
+ if (!this.#drawingAC) {
28733
+ return;
28734
+ }
28735
+ this.#currentEditorType.onScaleChangingWhenDrawing(this);
28736
+ }
28737
+ destroy() {
28738
+ this.commitOrRemove();
28739
+ if (this.#uiManager.getActive()?.parent === this) {
28740
+ this.#uiManager.commitOrRemove();
28741
+ this.#uiManager.setActiveEditor(null);
28742
+ }
28743
+ if (this.#editorFocusTimeoutId) {
28744
+ clearTimeout(this.#editorFocusTimeoutId);
28745
+ this.#editorFocusTimeoutId = null;
28746
+ }
28747
+ for (const editor of this.#editors.values()) {
28748
+ this.#accessibilityManager?.removePointerInTextLayer(editor.contentDiv);
28749
+ editor.setParent(null);
28750
+ editor.isAttachedToDOM = false;
28751
+ editor.div.remove();
28752
+ }
28753
+ this.div = null;
28754
+ this.#editors.clear();
28755
+ this.#uiManager.removeLayer(this);
28756
+ }
28757
+ #cleanup() {
28758
+ for (const editor of this.#editors.values()) {
28759
+ if (editor.isEmpty()) {
28760
+ editor.remove();
28761
+ }
28762
+ }
28763
+ }
28764
+ render({
28765
+ viewport
28766
+ }) {
28767
+ this.viewport = viewport;
28768
+ setLayerDimensions(this.div, viewport);
28769
+ for (const editor of this.#uiManager.getEditors(this.pageIndex)) {
28770
+ this.add(editor);
28771
+ editor.rebuild();
28772
+ }
28773
+ this.updateMode();
28774
+ }
28775
+ update({
28776
+ viewport
28777
+ }) {
28778
+ this.#uiManager.commitOrRemove();
28779
+ this.#cleanup();
28780
+ const oldRotation = this.viewport.rotation;
28781
+ const rotation = viewport.rotation;
28782
+ this.viewport = viewport;
28783
+ setLayerDimensions(this.div, {
28784
+ rotation
28785
+ });
28786
+ if (oldRotation !== rotation) {
28787
+ for (const editor of this.#editors.values()) {
28788
+ editor.rotate(rotation);
28789
+ }
28790
+ }
28791
+ }
28792
+ get pageDimensions() {
28793
+ const {
28794
+ pageWidth,
28795
+ pageHeight
28796
+ } = this.viewport.rawDims;
28797
+ return [pageWidth, pageHeight];
28798
+ }
28799
+ get scale() {
28800
+ return this.#uiManager.viewParameters.realScale;
28801
+ }
28802
+ }
28803
+
28804
+ ;// ./src/display/draw_layer.js
28805
+
28806
+
28807
+ class DrawLayer {
28808
+ #parent = null;
28809
+ #mapping = new Map();
28810
+ #toUpdate = new Map();
28811
+ static #id = 0;
28812
+ constructor({
28813
+ pageIndex
28814
+ }) {
28815
+ this.pageIndex = pageIndex;
28816
+ }
28817
+ setParent(parent) {
28818
+ if (!this.#parent) {
28819
+ this.#parent = parent;
28820
+ return;
28821
+ }
28822
+ if (this.#parent !== parent) {
28823
+ if (this.#mapping.size > 0) {
28824
+ for (const root of this.#mapping.values()) {
28825
+ root.remove();
28826
+ parent.append(root);
28827
+ }
28828
+ }
28829
+ this.#parent = parent;
28830
+ }
28831
+ }
28832
+ static get _svgFactory() {
28833
+ return shadow(this, "_svgFactory", new DOMSVGFactory());
28834
+ }
28835
+ static #setBox(element, [x, y, width, height]) {
28836
+ const {
28837
+ style
28838
+ } = element;
28839
+ style.top = `${100 * y}%`;
28840
+ style.left = `${100 * x}%`;
28841
+ style.width = `${100 * width}%`;
28842
+ style.height = `${100 * height}%`;
28843
+ }
28844
+ #createSVG() {
28845
+ const svg = DrawLayer._svgFactory.create(1, 1, true);
28846
+ this.#parent.append(svg);
28847
+ svg.setAttribute("aria-hidden", true);
28848
+ return svg;
28849
+ }
28850
+ #createClipPath(defs, pathId) {
28851
+ const clipPath = DrawLayer._svgFactory.createElement("clipPath");
28852
+ defs.append(clipPath);
28853
+ const clipPathId = `clip_${pathId}`;
28854
+ clipPath.setAttribute("id", clipPathId);
28855
+ clipPath.setAttribute("clipPathUnits", "objectBoundingBox");
28856
+ const clipPathUse = DrawLayer._svgFactory.createElement("use");
28857
+ clipPath.append(clipPathUse);
28858
+ clipPathUse.setAttribute("href", `#${pathId}`);
28859
+ clipPathUse.classList.add("clip");
28860
+ return clipPathId;
28861
+ }
28862
+ #updateProperties(element, properties) {
28863
+ for (const [key, value] of Object.entries(properties)) {
28864
+ if (value === null) {
28865
+ element.removeAttribute(key);
28866
+ } else {
28867
+ element.setAttribute(key, value);
28868
+ }
28869
+ }
28870
+ }
28871
+ draw(properties, isPathUpdatable = false, hasClip = false) {
28872
+ const id = DrawLayer.#id++;
28873
+ const root = this.#createSVG();
28874
+ const defs = DrawLayer._svgFactory.createElement("defs");
28875
+ root.append(defs);
28876
+ const path = DrawLayer._svgFactory.createElement("path");
28877
+ defs.append(path);
28878
+ const pathId = `path_p${this.pageIndex}_${id}`;
28879
+ path.setAttribute("id", pathId);
28880
+ path.setAttribute("vector-effect", "non-scaling-stroke");
28881
+ if (isPathUpdatable) {
28882
+ this.#toUpdate.set(id, path);
29590
28883
  }
29591
- this.createAndAddNewEditor(event, false);
28884
+ const clipPathId = hasClip ? this.#createClipPath(defs, pathId) : null;
28885
+ const use = DrawLayer._svgFactory.createElement("use");
28886
+ root.append(use);
28887
+ use.setAttribute("href", `#${pathId}`);
28888
+ this.updateProperties(root, properties);
28889
+ this.#mapping.set(id, root);
28890
+ return {
28891
+ id,
28892
+ clipPathId: `url(#${clipPathId})`
28893
+ };
29592
28894
  }
29593
- pointerdown(event) {
29594
- if (this.#uiManager.getMode() === AnnotationEditorType.HIGHLIGHT) {
29595
- this.enableTextSelection();
28895
+ drawOutline(properties, mustRemoveSelfIntersections) {
28896
+ const id = DrawLayer.#id++;
28897
+ const root = this.#createSVG();
28898
+ const defs = DrawLayer._svgFactory.createElement("defs");
28899
+ root.append(defs);
28900
+ const path = DrawLayer._svgFactory.createElement("path");
28901
+ defs.append(path);
28902
+ const pathId = `path_p${this.pageIndex}_${id}`;
28903
+ path.setAttribute("id", pathId);
28904
+ path.setAttribute("vector-effect", "non-scaling-stroke");
28905
+ let maskId;
28906
+ if (mustRemoveSelfIntersections) {
28907
+ const mask = DrawLayer._svgFactory.createElement("mask");
28908
+ defs.append(mask);
28909
+ maskId = `mask_p${this.pageIndex}_${id}`;
28910
+ mask.setAttribute("id", maskId);
28911
+ mask.setAttribute("maskUnits", "objectBoundingBox");
28912
+ const rect = DrawLayer._svgFactory.createElement("rect");
28913
+ mask.append(rect);
28914
+ rect.setAttribute("width", "1");
28915
+ rect.setAttribute("height", "1");
28916
+ rect.setAttribute("fill", "white");
28917
+ const use = DrawLayer._svgFactory.createElement("use");
28918
+ mask.append(use);
28919
+ use.setAttribute("href", `#${pathId}`);
28920
+ use.setAttribute("stroke", "none");
28921
+ use.setAttribute("fill", "black");
28922
+ use.setAttribute("fill-rule", "nonzero");
28923
+ use.classList.add("mask");
29596
28924
  }
29597
- if (this.#hadPointerDown) {
29598
- this.#hadPointerDown = false;
29599
- return;
28925
+ const use1 = DrawLayer._svgFactory.createElement("use");
28926
+ root.append(use1);
28927
+ use1.setAttribute("href", `#${pathId}`);
28928
+ if (maskId) {
28929
+ use1.setAttribute("mask", `url(#${maskId})`);
29600
28930
  }
29601
- const {
29602
- isMac
29603
- } = util_FeatureTest.platform;
29604
- if (event.button !== 0 || event.ctrlKey && isMac) {
28931
+ const use2 = use1.cloneNode();
28932
+ root.append(use2);
28933
+ use1.classList.add("mainOutline");
28934
+ use2.classList.add("secondaryOutline");
28935
+ this.updateProperties(root, properties);
28936
+ this.#mapping.set(id, root);
28937
+ return id;
28938
+ }
28939
+ finalizeDraw(id, properties) {
28940
+ this.#toUpdate.delete(id);
28941
+ this.updateProperties(id, properties);
28942
+ }
28943
+ updateProperties(elementOrId, properties) {
28944
+ if (!properties) {
29605
28945
  return;
29606
28946
  }
29607
- if (event.target !== this.div) {
28947
+ const {
28948
+ root,
28949
+ bbox,
28950
+ rootClass,
28951
+ path
28952
+ } = properties;
28953
+ const element = typeof elementOrId === "number" ? this.#mapping.get(elementOrId) : elementOrId;
28954
+ if (!element) {
29608
28955
  return;
29609
28956
  }
29610
- this.#hadPointerDown = true;
29611
- if (this.#currentEditorType?.isDrawer) {
29612
- this.startDrawingSession(event);
29613
- return;
28957
+ if (root) {
28958
+ this.#updateProperties(element, root);
29614
28959
  }
29615
- const editor = this.#uiManager.getActive();
29616
- this.#allowClick = !editor || editor.isEmpty();
29617
- }
29618
- startDrawingSession(event) {
29619
- this.div.focus({
29620
- preventScroll: true
29621
- });
29622
- if (this.#drawingAC) {
29623
- this.#currentEditorType.startDrawing(this, this.#uiManager, false, event);
29624
- return;
28960
+ if (bbox) {
28961
+ DrawLayer.#setBox(element, bbox);
29625
28962
  }
29626
- this.#uiManager.setCurrentDrawingSession(this);
29627
- this.#drawingAC = new AbortController();
29628
- const signal = this.#uiManager.combinedSignal(this.#drawingAC);
29629
- this.div.addEventListener("blur", ({
29630
- relatedTarget
29631
- }) => {
29632
- if (relatedTarget && !this.div.contains(relatedTarget)) {
29633
- this.#focusedElement = null;
29634
- this.commitOrRemove();
29635
- }
29636
- }, {
29637
- signal
29638
- });
29639
- this.#currentEditorType.startDrawing(this, this.#uiManager, false, event);
29640
- }
29641
- pause(on) {
29642
- if (on) {
28963
+ if (rootClass) {
29643
28964
  const {
29644
- activeElement
29645
- } = document;
29646
- if (this.div.contains(activeElement)) {
29647
- this.#focusedElement = activeElement;
28965
+ classList
28966
+ } = element;
28967
+ for (const [className, value] of Object.entries(rootClass)) {
28968
+ classList.toggle(className, value);
29648
28969
  }
29649
- return;
29650
28970
  }
29651
- if (this.#focusedElement) {
29652
- setTimeout(() => {
29653
- this.#focusedElement?.focus();
29654
- this.#focusedElement = null;
29655
- }, 0);
28971
+ if (path) {
28972
+ const defs = element.firstElementChild;
28973
+ const pathElement = defs.firstElementChild;
28974
+ this.#updateProperties(pathElement, path);
29656
28975
  }
29657
28976
  }
29658
- endDrawingSession(isAborted = false) {
29659
- if (!this.#drawingAC) {
29660
- return null;
28977
+ updateParent(id, layer) {
28978
+ if (layer === this) {
28979
+ return;
29661
28980
  }
29662
- this.#uiManager.setCurrentDrawingSession(null);
29663
- this.#drawingAC.abort();
29664
- this.#drawingAC = null;
29665
- this.#focusedElement = null;
29666
- return this.#currentEditorType.endDrawing(isAborted);
28981
+ const root = this.#mapping.get(id);
28982
+ if (!root) {
28983
+ return;
28984
+ }
28985
+ layer.#parent.append(root);
28986
+ this.#mapping.delete(id);
28987
+ layer.#mapping.set(id, root);
29667
28988
  }
29668
- findNewParent(editor, x, y) {
29669
- const layer = this.#uiManager.findParent(x, y);
29670
- if (layer === null || layer === this) {
29671
- return false;
28989
+ remove(id) {
28990
+ this.#toUpdate.delete(id);
28991
+ if (this.#parent === null) {
28992
+ return;
29672
28993
  }
29673
- layer.changeParent(editor);
29674
- return true;
28994
+ this.#mapping.get(id).remove();
28995
+ this.#mapping.delete(id);
29675
28996
  }
29676
- commitOrRemove() {
29677
- if (this.#drawingAC) {
29678
- this.endDrawingSession();
29679
- return true;
28997
+ destroy() {
28998
+ this.#parent = null;
28999
+ for (const root of this.#mapping.values()) {
29000
+ root.remove();
29680
29001
  }
29681
- return false;
29002
+ this.#mapping.clear();
29003
+ this.#toUpdate.clear();
29682
29004
  }
29683
- onScaleChanging() {
29684
- if (!this.#drawingAC) {
29685
- return;
29005
+ }
29006
+
29007
+ ;// ./src/pdf.js
29008
+
29009
+
29010
+
29011
+
29012
+
29013
+
29014
+
29015
+
29016
+
29017
+
29018
+
29019
+
29020
+
29021
+
29022
+
29023
+
29024
+ {
29025
+ globalThis._pdfjsTestingUtils = {
29026
+ HighlightOutliner: HighlightOutliner
29027
+ };
29028
+ }
29029
+ globalThis.pdfjsLib = {
29030
+ AbortException: AbortException,
29031
+ AnnotationEditorLayer: AnnotationEditorLayer,
29032
+ AnnotationEditorParamsType: AnnotationEditorParamsType,
29033
+ AnnotationEditorType: AnnotationEditorType,
29034
+ AnnotationEditorUIManager: AnnotationEditorUIManager,
29035
+ AnnotationLayer: AnnotationLayer,
29036
+ AnnotationMode: AnnotationMode,
29037
+ AnnotationType: AnnotationType,
29038
+ applyOpacity: applyOpacity,
29039
+ build: build,
29040
+ ColorPicker: ColorPicker,
29041
+ createValidAbsoluteUrl: createValidAbsoluteUrl,
29042
+ CSSConstants: CSSConstants,
29043
+ DOMSVGFactory: DOMSVGFactory,
29044
+ DrawLayer: DrawLayer,
29045
+ FeatureTest: util_FeatureTest,
29046
+ fetchData: fetchData,
29047
+ findContrastColor: findContrastColor,
29048
+ getDocument: getDocument,
29049
+ getFilenameFromUrl: getFilenameFromUrl,
29050
+ getPdfFilenameFromUrl: getPdfFilenameFromUrl,
29051
+ getRGB: getRGB,
29052
+ getUuid: getUuid,
29053
+ getXfaPageViewport: getXfaPageViewport,
29054
+ GlobalWorkerOptions: pdf_GlobalWorkerOptions,
29055
+ ImageKind: util_ImageKind,
29056
+ InvalidPDFException: InvalidPDFException,
29057
+ isDataScheme: isDataScheme,
29058
+ isPdfFile: isPdfFile,
29059
+ isValidExplicitDest: isValidExplicitDest,
29060
+ MathClamp: MathClamp,
29061
+ noContextMenu: noContextMenu,
29062
+ normalizeUnicode: normalizeUnicode,
29063
+ OPS: OPS,
29064
+ OutputScale: OutputScale,
29065
+ PasswordResponses: PasswordResponses,
29066
+ PDFDataRangeTransport: PDFDataRangeTransport,
29067
+ PDFDateString: PDFDateString,
29068
+ PDFWorker: PDFWorker,
29069
+ PermissionFlag: PermissionFlag,
29070
+ PixelsPerInch: PixelsPerInch,
29071
+ RenderingCancelledException: RenderingCancelledException,
29072
+ renderRichText: renderRichText,
29073
+ ResponseException: ResponseException,
29074
+ setLayerDimensions: setLayerDimensions,
29075
+ shadow: shadow,
29076
+ SignatureExtractor: SignatureExtractor,
29077
+ stopEvent: stopEvent,
29078
+ SupportedImageMimeTypes: SupportedImageMimeTypes,
29079
+ TextLayer: TextLayer,
29080
+ TouchManager: TouchManager,
29081
+ updateUrlHash: updateUrlHash,
29082
+ Util: Util,
29083
+ VerbosityLevel: VerbosityLevel,
29084
+ version: version,
29085
+ XfaLayer: XfaLayer
29086
+ };
29087
+
29088
+
29089
+
29090
+ //# sourceMappingURL=pdf.mjs.map
29091
+ ;// ./node_modules/pdfjs-dist/build/pdf.worker.min.mjs
29092
+ const pdf_worker_min_namespaceObject = __webpack_require__.p + "pdf.worker.min.mjs";
29093
+ ;// ./node_modules/babel-loader/lib/index.js??clonedRuleSet-83.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/PDFElements.vue?vue&type=template&id=00b0fcba&scoped=true
29094
+ var render = function render() {
29095
+ var _vm = this,
29096
+ _c = _vm._self._c;
29097
+ return _c('div', {
29098
+ staticClass: "pdf-elements-root",
29099
+ style: {
29100
+ width: _vm.width,
29101
+ height: _vm.height
29686
29102
  }
29687
- this.#currentEditorType.onScaleChangingWhenDrawing(this);
29688
- }
29689
- destroy() {
29690
- this.commitOrRemove();
29691
- if (this.#uiManager.getActive()?.parent === this) {
29692
- this.#uiManager.commitOrRemove();
29693
- this.#uiManager.setActiveEditor(null);
29103
+ }, [_vm.pdfDocuments.length ? _c('div', {
29104
+ staticClass: "pages-container",
29105
+ style: {
29106
+ transform: `scale(${_vm.visualScale / _vm.scale})`,
29107
+ transformOrigin: 'top center'
29694
29108
  }
29695
- if (this.#editorFocusTimeoutId) {
29696
- clearTimeout(this.#editorFocusTimeoutId);
29697
- this.#editorFocusTimeoutId = null;
29109
+ }, _vm._l(_vm.pdfDocuments, function (pdfDoc, docIndex) {
29110
+ return _c('div', {
29111
+ key: docIndex
29112
+ }, _vm._l(pdfDoc.pages, function (page, pIndex) {
29113
+ return _c('div', {
29114
+ key: `${docIndex}-${pIndex}`,
29115
+ staticClass: "page-slot"
29116
+ }, [_c('div', {
29117
+ staticClass: "page-wrapper",
29118
+ on: {
29119
+ "mousedown": function ($event) {
29120
+ return _vm.selectPage(docIndex, pIndex);
29121
+ },
29122
+ "touchstart": function ($event) {
29123
+ return _vm.selectPage(docIndex, pIndex);
29124
+ }
29125
+ }
29126
+ }, [_c('div', {
29127
+ staticClass: "page-canvas",
29128
+ class: {
29129
+ 'shadow-outline': docIndex === _vm.selectedDocIndex && pIndex === _vm.selectedPageIndex
29130
+ }
29131
+ }, [_c('PDFPage', {
29132
+ ref: `page${docIndex}-${pIndex}`,
29133
+ refInFor: true,
29134
+ attrs: {
29135
+ "page": page,
29136
+ "scale": _vm.scale
29137
+ },
29138
+ on: {
29139
+ "onMeasure": function ($event) {
29140
+ return _vm.onMeasure($event, docIndex, pIndex);
29141
+ }
29142
+ }
29143
+ }), _c('div', {
29144
+ staticClass: "overlay"
29145
+ }, [_vm.isAddingMode && _vm.previewPageDocIndex === docIndex && _vm.previewPageIndex === pIndex && _vm.previewElement && _vm.previewVisible ? _c('div', {
29146
+ staticClass: "preview-element",
29147
+ style: {
29148
+ left: `${_vm.previewPosition.x * _vm.previewScale.x}px`,
29149
+ top: `${_vm.previewPosition.y * _vm.previewScale.y}px`,
29150
+ width: `${_vm.previewElement.width * _vm.previewScale.x}px`,
29151
+ height: `${_vm.previewElement.height * _vm.previewScale.y}px`
29152
+ }
29153
+ }, [_vm._t("custom", null, {
29154
+ "object": _vm.previewElement,
29155
+ "isSelected": false
29156
+ })], 2) : _vm._e(), _vm._l(pdfDoc.allObjects[pIndex], function (object) {
29157
+ return _c('DraggableElement', {
29158
+ key: object.id,
29159
+ ref: `draggable${docIndex}-${pIndex}-${object.id}`,
29160
+ refInFor: true,
29161
+ attrs: {
29162
+ "object": object,
29163
+ "pages-scale": _vm.getRenderPageScale(docIndex, pIndex),
29164
+ "page-width": _vm.getPageWidth(docIndex, pIndex),
29165
+ "page-height": _vm.getPageHeight(docIndex, pIndex),
29166
+ "on-update": payload => _vm.updateObject(docIndex, object.id, payload),
29167
+ "on-delete": () => _vm.deleteObject(docIndex, object.id),
29168
+ "on-drag-start": (mouseX, mouseY, pointerOffset, dragShift) => _vm.startDraggingElement(docIndex, pIndex, object, mouseX, mouseY, pointerOffset, dragShift),
29169
+ "on-drag-move": _vm.updateDraggingPosition,
29170
+ "on-drag-end": _vm.stopDraggingElement,
29171
+ "is-being-dragged-globally": _vm.isDraggingElement && _vm.draggingObject && _vm.draggingObject.id === object.id,
29172
+ "dragging-client-pos": _vm.draggingClientPosition,
29173
+ "current-doc-index": docIndex,
29174
+ "current-page-index": pIndex,
29175
+ "global-drag-doc-index": _vm.draggingDocIndex,
29176
+ "global-drag-page-index": _vm.draggingPageIndex,
29177
+ "show-selection-ui": _vm.showSelectionHandles && !_vm.hideSelectionUI && object.resizable !== false,
29178
+ "show-default-actions": _vm.showElementActions && !_vm.hideSelectionUI
29179
+ },
29180
+ scopedSlots: _vm._u([{
29181
+ key: "default",
29182
+ fn: function (slotProps) {
29183
+ return [_vm._t(slotProps.object.type ? `element-${slotProps.object.type}` : 'custom', function () {
29184
+ return [_vm._t("custom", null, {
29185
+ "object": slotProps.object,
29186
+ "onDelete": slotProps.onDelete,
29187
+ "onResize": slotProps.onResize
29188
+ })];
29189
+ }, {
29190
+ "object": slotProps.object,
29191
+ "onDelete": slotProps.onDelete,
29192
+ "onResize": slotProps.onResize
29193
+ })];
29194
+ }
29195
+ }, {
29196
+ key: "actions",
29197
+ fn: function (slotProps) {
29198
+ return [_vm._t("actions", null, {
29199
+ "object": slotProps.object,
29200
+ "onDelete": slotProps.onDelete
29201
+ })];
29202
+ }
29203
+ }], null, true)
29204
+ });
29205
+ })], 2)], 1), _vm.showPageFooter ? _c('div', {
29206
+ staticClass: "page-footer"
29207
+ }, [_c('span', [_vm._v(_vm._s(pdfDoc.name))]), _c('span', [_vm._v(_vm._s(_vm.formatPageNumber(pIndex + 1, pdfDoc.numPages)))])]) : _vm._e()])]);
29208
+ }), 0);
29209
+ }), 0) : _vm._e(), _vm.isDraggingElement && _vm.draggingObject ? _c('div', {
29210
+ staticClass: "drag-portal",
29211
+ style: {
29212
+ position: 'fixed',
29213
+ left: `${_vm.draggingClientPosition.x}px`,
29214
+ top: `${_vm.draggingClientPosition.y}px`,
29215
+ width: `${_vm.draggingObject.width * _vm.draggingScale}px`,
29216
+ height: `${_vm.draggingObject.height * _vm.draggingScale}px`,
29217
+ pointerEvents: 'none'
29698
29218
  }
29699
- for (const editor of this.#editors.values()) {
29700
- this.#accessibilityManager?.removePointerInTextLayer(editor.contentDiv);
29701
- editor.setParent(null);
29702
- editor.isAttachedToDOM = false;
29703
- editor.div.remove();
29219
+ }, [_vm._t(_vm.draggingObject.type ? `element-${_vm.draggingObject.type}` : 'custom', function () {
29220
+ return [_vm._t("custom", null, {
29221
+ "object": _vm.draggingObject,
29222
+ "isSelected": false
29223
+ })];
29224
+ }, {
29225
+ "object": _vm.draggingObject,
29226
+ "isSelected": false
29227
+ })], 2) : _vm._e()]);
29228
+ };
29229
+ var staticRenderFns = [];
29230
+
29231
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.push.js
29232
+ var es_array_push = __webpack_require__(4114);
29233
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.constructor.js
29234
+ var es_iterator_constructor = __webpack_require__(8111);
29235
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.filter.js
29236
+ var es_iterator_filter = __webpack_require__(2489);
29237
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.find.js
29238
+ var es_iterator_find = __webpack_require__(116);
29239
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.for-each.js
29240
+ var es_iterator_for_each = __webpack_require__(7588);
29241
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.map.js
29242
+ var es_iterator_map = __webpack_require__(1701);
29243
+ ;// ./node_modules/debounce/index.js
29244
+ function debounce(function_, wait = 100, options = {}) {
29245
+ if (typeof function_ !== 'function') {
29246
+ throw new TypeError(`Expected the first parameter to be a function, got \`${typeof function_}\`.`);
29247
+ }
29248
+
29249
+ if (wait < 0) {
29250
+ throw new RangeError('`wait` must not be negative.');
29251
+ }
29252
+
29253
+ if (typeof options === 'boolean') {
29254
+ throw new TypeError('The `options` parameter must be an object, not a boolean. Use `{immediate: true}` instead.');
29255
+ }
29256
+
29257
+ const {immediate} = options;
29258
+
29259
+ let storedContext;
29260
+ let storedArguments;
29261
+ let timeoutId;
29262
+ let timestamp;
29263
+ let result;
29264
+
29265
+ function run() {
29266
+ const callContext = storedContext;
29267
+ const callArguments = storedArguments;
29268
+ storedContext = undefined;
29269
+ storedArguments = undefined;
29270
+ result = function_.apply(callContext, callArguments);
29271
+ return result;
29272
+ }
29273
+
29274
+ function later() {
29275
+ const last = Date.now() - timestamp;
29276
+
29277
+ if (last < wait && last >= 0) {
29278
+ timeoutId = setTimeout(later, wait - last);
29279
+ } else {
29280
+ timeoutId = undefined;
29281
+
29282
+ if (!immediate) {
29283
+ result = run();
29284
+ }
29285
+ }
29286
+ }
29287
+
29288
+ const debounced = function (...arguments_) {
29289
+ if (
29290
+ storedContext
29291
+ && this !== storedContext
29292
+ && Object.getPrototypeOf(this) === Object.getPrototypeOf(storedContext)
29293
+ ) {
29294
+ throw new Error('Debounced method called with different contexts of the same prototype.');
29295
+ }
29296
+
29297
+ storedContext = this; // eslint-disable-line unicorn/no-this-assignment
29298
+ storedArguments = arguments_;
29299
+ timestamp = Date.now();
29300
+
29301
+ const callNow = immediate && !timeoutId;
29302
+
29303
+ if (!timeoutId) {
29304
+ timeoutId = setTimeout(later, wait);
29305
+ }
29306
+
29307
+ if (callNow) {
29308
+ result = run();
29309
+ return result;
29310
+ }
29311
+
29312
+ return undefined;
29313
+ };
29314
+
29315
+ Object.defineProperty(debounced, 'isPending', {
29316
+ get() {
29317
+ return timeoutId !== undefined;
29318
+ },
29319
+ });
29320
+
29321
+ debounced.clear = () => {
29322
+ if (!timeoutId) {
29323
+ return;
29324
+ }
29325
+
29326
+ clearTimeout(timeoutId);
29327
+ timeoutId = undefined;
29328
+ storedContext = undefined;
29329
+ storedArguments = undefined;
29330
+ };
29331
+
29332
+ debounced.flush = () => {
29333
+ if (!timeoutId) {
29334
+ return;
29335
+ }
29336
+
29337
+ debounced.trigger();
29338
+ };
29339
+
29340
+ debounced.trigger = () => {
29341
+ result = run();
29342
+
29343
+ debounced.clear();
29344
+ };
29345
+
29346
+ return debounced;
29347
+ }
29348
+
29349
+ ;// ./node_modules/babel-loader/lib/index.js??clonedRuleSet-83.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/PDFPage.vue?vue&type=template&id=2c9e224a&scoped=true
29350
+ var PDFPagevue_type_template_id_2c9e224a_scoped_true_render = function render() {
29351
+ var _vm = this,
29352
+ _c = _vm._self._c;
29353
+ return _c('canvas', {
29354
+ ref: "canvas"
29355
+ });
29356
+ };
29357
+ var PDFPagevue_type_template_id_2c9e224a_scoped_true_staticRenderFns = [];
29358
+
29359
+ ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-83.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/PDFPage.vue?vue&type=script&lang=js
29360
+ /* harmony default export */ const PDFPagevue_type_script_lang_js = ({
29361
+ name: 'PDFPage',
29362
+ props: {
29363
+ page: {
29364
+ type: Promise,
29365
+ required: true
29366
+ },
29367
+ scale: {
29368
+ type: Number,
29369
+ default: 1
29704
29370
  }
29705
- this.div = null;
29706
- this.#editors.clear();
29707
- this.#uiManager.removeLayer(this);
29708
- }
29709
- #cleanup() {
29710
- for (const editor of this.#editors.values()) {
29711
- if (editor.isEmpty()) {
29712
- editor.remove();
29713
- }
29371
+ },
29372
+ data() {
29373
+ return {
29374
+ dynamicScale: this.scale,
29375
+ isRendering: false,
29376
+ boundMeasure: null
29377
+ };
29378
+ },
29379
+ watch: {
29380
+ scale(newScale) {
29381
+ this.dynamicScale = newScale;
29382
+ this.render();
29714
29383
  }
29715
- }
29716
- render({
29717
- viewport
29718
- }) {
29719
- this.viewport = viewport;
29720
- setLayerDimensions(this.div, viewport);
29721
- for (const editor of this.#uiManager.getEditors(this.pageIndex)) {
29722
- this.add(editor);
29723
- editor.rebuild();
29384
+ },
29385
+ mounted() {
29386
+ this.boundMeasure = this.measure.bind(this);
29387
+ window.addEventListener('resize', this.boundMeasure);
29388
+ this.render();
29389
+ },
29390
+ beforeUnmount() {
29391
+ if (this.boundMeasure) {
29392
+ window.removeEventListener('resize', this.boundMeasure);
29724
29393
  }
29725
- this.updateMode();
29726
- }
29727
- update({
29728
- viewport
29729
- }) {
29730
- this.#uiManager.commitOrRemove();
29731
- this.#cleanup();
29732
- const oldRotation = this.viewport.rotation;
29733
- const rotation = viewport.rotation;
29734
- this.viewport = viewport;
29735
- setLayerDimensions(this.div, {
29736
- rotation
29737
- });
29738
- if (oldRotation !== rotation) {
29739
- for (const editor of this.#editors.values()) {
29740
- editor.rotate(rotation);
29394
+ },
29395
+ methods: {
29396
+ getCanvasMeasurement() {
29397
+ return {
29398
+ canvasWidth: this.$refs.canvas.width,
29399
+ canvasHeight: this.$refs.canvas.height
29400
+ };
29401
+ },
29402
+ measure() {
29403
+ this.$emit('onMeasure', {
29404
+ scale: this.dynamicScale
29405
+ });
29406
+ },
29407
+ async render() {
29408
+ if (this.isRendering) return;
29409
+ this.isRendering = true;
29410
+ try {
29411
+ const _page = await this.page;
29412
+ const canvas = this.$refs.canvas;
29413
+ const context = canvas.getContext('2d');
29414
+ const viewport = _page.getViewport({
29415
+ scale: this.dynamicScale
29416
+ });
29417
+ canvas.width = viewport.width;
29418
+ canvas.height = viewport.height;
29419
+ await _page.render({
29420
+ canvasContext: context,
29421
+ viewport
29422
+ }).promise;
29423
+ this.measure();
29424
+ } finally {
29425
+ this.isRendering = false;
29741
29426
  }
29742
29427
  }
29743
29428
  }
29744
- get pageDimensions() {
29745
- const {
29746
- pageWidth,
29747
- pageHeight
29748
- } = this.viewport.rawDims;
29749
- return [pageWidth, pageHeight];
29750
- }
29751
- get scale() {
29752
- return this.#uiManager.viewParameters.realScale;
29753
- }
29754
- }
29429
+ });
29430
+ ;// ./src/components/PDFPage.vue?vue&type=script&lang=js
29431
+ /* harmony default export */ const components_PDFPagevue_type_script_lang_js = (PDFPagevue_type_script_lang_js);
29432
+ ;// ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-55.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-55.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-55.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/PDFPage.vue?vue&type=style&index=0&id=2c9e224a&prod&scoped=true&lang=css
29433
+ // extracted by mini-css-extract-plugin
29755
29434
 
29756
- ;// ./src/display/draw_layer.js
29435
+ ;// ./src/components/PDFPage.vue?vue&type=style&index=0&id=2c9e224a&prod&scoped=true&lang=css
29757
29436
 
29437
+ ;// ./node_modules/@vue/vue-loader-v15/lib/runtime/componentNormalizer.js
29438
+ /* globals __VUE_SSR_CONTEXT__ */
29758
29439
 
29759
- class DrawLayer {
29760
- #parent = null;
29761
- #mapping = new Map();
29762
- #toUpdate = new Map();
29763
- static #id = 0;
29764
- constructor({
29765
- pageIndex
29766
- }) {
29767
- this.pageIndex = pageIndex;
29768
- }
29769
- setParent(parent) {
29770
- if (!this.#parent) {
29771
- this.#parent = parent;
29772
- return;
29773
- }
29774
- if (this.#parent !== parent) {
29775
- if (this.#mapping.size > 0) {
29776
- for (const root of this.#mapping.values()) {
29777
- root.remove();
29778
- parent.append(root);
29779
- }
29780
- }
29781
- this.#parent = parent;
29782
- }
29783
- }
29784
- static get _svgFactory() {
29785
- return shadow(this, "_svgFactory", new DOMSVGFactory());
29786
- }
29787
- static #setBox(element, [x, y, width, height]) {
29788
- const {
29789
- style
29790
- } = element;
29791
- style.top = `${100 * y}%`;
29792
- style.left = `${100 * x}%`;
29793
- style.width = `${100 * width}%`;
29794
- style.height = `${100 * height}%`;
29795
- }
29796
- #createSVG() {
29797
- const svg = DrawLayer._svgFactory.create(1, 1, true);
29798
- this.#parent.append(svg);
29799
- svg.setAttribute("aria-hidden", true);
29800
- return svg;
29440
+ // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
29441
+ // This module is a runtime utility for cleaner component module output and will
29442
+ // be included in the final webpack user bundle.
29443
+
29444
+ function normalizeComponent(
29445
+ scriptExports,
29446
+ render,
29447
+ staticRenderFns,
29448
+ functionalTemplate,
29449
+ injectStyles,
29450
+ scopeId,
29451
+ moduleIdentifier /* server only */,
29452
+ shadowMode /* vue-cli only */
29453
+ ) {
29454
+ // Vue.extend constructor export interop
29455
+ var options =
29456
+ typeof scriptExports === 'function' ? scriptExports.options : scriptExports
29457
+
29458
+ // render functions
29459
+ if (render) {
29460
+ options.render = render
29461
+ options.staticRenderFns = staticRenderFns
29462
+ options._compiled = true
29801
29463
  }
29802
- #createClipPath(defs, pathId) {
29803
- const clipPath = DrawLayer._svgFactory.createElement("clipPath");
29804
- defs.append(clipPath);
29805
- const clipPathId = `clip_${pathId}`;
29806
- clipPath.setAttribute("id", clipPathId);
29807
- clipPath.setAttribute("clipPathUnits", "objectBoundingBox");
29808
- const clipPathUse = DrawLayer._svgFactory.createElement("use");
29809
- clipPath.append(clipPathUse);
29810
- clipPathUse.setAttribute("href", `#${pathId}`);
29811
- clipPathUse.classList.add("clip");
29812
- return clipPathId;
29464
+
29465
+ // functional template
29466
+ if (functionalTemplate) {
29467
+ options.functional = true
29813
29468
  }
29814
- #updateProperties(element, properties) {
29815
- for (const [key, value] of Object.entries(properties)) {
29816
- if (value === null) {
29817
- element.removeAttribute(key);
29818
- } else {
29819
- element.setAttribute(key, value);
29820
- }
29821
- }
29469
+
29470
+ // scopedId
29471
+ if (scopeId) {
29472
+ options._scopeId = 'data-v-' + scopeId
29822
29473
  }
29823
- draw(properties, isPathUpdatable = false, hasClip = false) {
29824
- const id = DrawLayer.#id++;
29825
- const root = this.#createSVG();
29826
- const defs = DrawLayer._svgFactory.createElement("defs");
29827
- root.append(defs);
29828
- const path = DrawLayer._svgFactory.createElement("path");
29829
- defs.append(path);
29830
- const pathId = `path_p${this.pageIndex}_${id}`;
29831
- path.setAttribute("id", pathId);
29832
- path.setAttribute("vector-effect", "non-scaling-stroke");
29833
- if (isPathUpdatable) {
29834
- this.#toUpdate.set(id, path);
29474
+
29475
+ var hook
29476
+ if (moduleIdentifier) {
29477
+ // server build
29478
+ hook = function (context) {
29479
+ // 2.3 injection
29480
+ context =
29481
+ context || // cached call
29482
+ (this.$vnode && this.$vnode.ssrContext) || // stateful
29483
+ (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
29484
+ // 2.2 with runInNewContext: true
29485
+ if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
29486
+ context = __VUE_SSR_CONTEXT__
29487
+ }
29488
+ // inject component styles
29489
+ if (injectStyles) {
29490
+ injectStyles.call(this, context)
29491
+ }
29492
+ // register component module identifier for async chunk inferrence
29493
+ if (context && context._registeredComponents) {
29494
+ context._registeredComponents.add(moduleIdentifier)
29495
+ }
29835
29496
  }
29836
- const clipPathId = hasClip ? this.#createClipPath(defs, pathId) : null;
29837
- const use = DrawLayer._svgFactory.createElement("use");
29838
- root.append(use);
29839
- use.setAttribute("href", `#${pathId}`);
29840
- this.updateProperties(root, properties);
29841
- this.#mapping.set(id, root);
29842
- return {
29843
- id,
29844
- clipPathId: `url(#${clipPathId})`
29845
- };
29497
+ // used by ssr in case component is cached and beforeCreate
29498
+ // never gets called
29499
+ options._ssrRegister = hook
29500
+ } else if (injectStyles) {
29501
+ hook = shadowMode
29502
+ ? function () {
29503
+ injectStyles.call(
29504
+ this,
29505
+ (options.functional ? this.parent : this).$root.$options.shadowRoot
29506
+ )
29507
+ }
29508
+ : injectStyles
29846
29509
  }
29847
- drawOutline(properties, mustRemoveSelfIntersections) {
29848
- const id = DrawLayer.#id++;
29849
- const root = this.#createSVG();
29850
- const defs = DrawLayer._svgFactory.createElement("defs");
29851
- root.append(defs);
29852
- const path = DrawLayer._svgFactory.createElement("path");
29853
- defs.append(path);
29854
- const pathId = `path_p${this.pageIndex}_${id}`;
29855
- path.setAttribute("id", pathId);
29856
- path.setAttribute("vector-effect", "non-scaling-stroke");
29857
- let maskId;
29858
- if (mustRemoveSelfIntersections) {
29859
- const mask = DrawLayer._svgFactory.createElement("mask");
29860
- defs.append(mask);
29861
- maskId = `mask_p${this.pageIndex}_${id}`;
29862
- mask.setAttribute("id", maskId);
29863
- mask.setAttribute("maskUnits", "objectBoundingBox");
29864
- const rect = DrawLayer._svgFactory.createElement("rect");
29865
- mask.append(rect);
29866
- rect.setAttribute("width", "1");
29867
- rect.setAttribute("height", "1");
29868
- rect.setAttribute("fill", "white");
29869
- const use = DrawLayer._svgFactory.createElement("use");
29870
- mask.append(use);
29871
- use.setAttribute("href", `#${pathId}`);
29872
- use.setAttribute("stroke", "none");
29873
- use.setAttribute("fill", "black");
29874
- use.setAttribute("fill-rule", "nonzero");
29875
- use.classList.add("mask");
29876
- }
29877
- const use1 = DrawLayer._svgFactory.createElement("use");
29878
- root.append(use1);
29879
- use1.setAttribute("href", `#${pathId}`);
29880
- if (maskId) {
29881
- use1.setAttribute("mask", `url(#${maskId})`);
29510
+
29511
+ if (hook) {
29512
+ if (options.functional) {
29513
+ // for template-only hot-reload because in that case the render fn doesn't
29514
+ // go through the normalizer
29515
+ options._injectStyles = hook
29516
+ // register for functional component in vue file
29517
+ var originalRender = options.render
29518
+ options.render = function renderWithStyleInjection(h, context) {
29519
+ hook.call(context)
29520
+ return originalRender(h, context)
29521
+ }
29522
+ } else {
29523
+ // inject component registration as beforeCreate hook
29524
+ var existing = options.beforeCreate
29525
+ options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
29882
29526
  }
29883
- const use2 = use1.cloneNode();
29884
- root.append(use2);
29885
- use1.classList.add("mainOutline");
29886
- use2.classList.add("secondaryOutline");
29887
- this.updateProperties(root, properties);
29888
- this.#mapping.set(id, root);
29889
- return id;
29890
29527
  }
29891
- finalizeDraw(id, properties) {
29892
- this.#toUpdate.delete(id);
29893
- this.updateProperties(id, properties);
29528
+
29529
+ return {
29530
+ exports: scriptExports,
29531
+ options: options
29894
29532
  }
29895
- updateProperties(elementOrId, properties) {
29896
- if (!properties) {
29897
- return;
29898
- }
29899
- const {
29900
- root,
29901
- bbox,
29902
- rootClass,
29903
- path
29904
- } = properties;
29905
- const element = typeof elementOrId === "number" ? this.#mapping.get(elementOrId) : elementOrId;
29906
- if (!element) {
29907
- return;
29533
+ }
29534
+
29535
+ ;// ./src/components/PDFPage.vue
29536
+
29537
+
29538
+
29539
+ ;
29540
+
29541
+
29542
+ /* normalize component */
29543
+
29544
+ var component = normalizeComponent(
29545
+ components_PDFPagevue_type_script_lang_js,
29546
+ PDFPagevue_type_template_id_2c9e224a_scoped_true_render,
29547
+ PDFPagevue_type_template_id_2c9e224a_scoped_true_staticRenderFns,
29548
+ false,
29549
+ null,
29550
+ "2c9e224a",
29551
+ null
29552
+
29553
+ )
29554
+
29555
+ /* harmony default export */ const PDFPage = (component.exports);
29556
+ ;// ./node_modules/babel-loader/lib/index.js??clonedRuleSet-83.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/DraggableElement.vue?vue&type=template&id=55db89ce&scoped=true
29557
+ var DraggableElementvue_type_template_id_55db89ce_scoped_true_render = function render() {
29558
+ var _vm = this,
29559
+ _c = _vm._self._c;
29560
+ return _c('div', {
29561
+ staticClass: "draggable-wrapper"
29562
+ }, [_vm.isSelected && !_vm.isBeingDraggedGlobally && _vm.showSelectionUi && _vm.showDefaultActions ? _c('div', {
29563
+ staticClass: "actions-toolbar",
29564
+ style: _vm.toolbarStyle
29565
+ }, [_vm._t("actions", function () {
29566
+ return [_c('button', {
29567
+ staticClass: "action-btn",
29568
+ attrs: {
29569
+ "type": "button",
29570
+ "title": "Delete"
29571
+ },
29572
+ on: {
29573
+ "click": function ($event) {
29574
+ $event.stopPropagation();
29575
+ return _vm.onDelete.apply(null, arguments);
29576
+ }
29577
+ }
29578
+ }, [_c('svg', {
29579
+ attrs: {
29580
+ "width": "16",
29581
+ "height": "16",
29582
+ "viewBox": "0 0 16 16",
29583
+ "fill": "currentColor"
29584
+ }
29585
+ }, [_c('path', {
29586
+ attrs: {
29587
+ "d": "M6.5 1h3a.5.5 0 0 1 .5.5v1H6v-1a.5.5 0 0 1 .5-.5ZM11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3A1.5 1.5 0 0 0 5 1.5v1H2.5a.5.5 0 0 0 0 1h.5v10.5A1.5 1.5 0 0 0 4.5 15h7a1.5 1.5 0 0 0 1.5-1.5V3.5h.5a.5.5 0 0 0 0-1H11Zm1 1v10.5a.5.5 0 0 1-.5.5h-7a.5.5 0 0 1-.5-.5V3.5h8Z"
29588
+ }
29589
+ })])])];
29590
+ }, {
29591
+ "object": _vm.object,
29592
+ "onDelete": _vm.onDelete
29593
+ })], 2) : _vm._e(), _c('div', {
29594
+ staticClass: "draggable-element",
29595
+ class: {
29596
+ selected: _vm.isSelected && _vm.showSelectionUi
29597
+ },
29598
+ style: [_vm.elementStyle, _vm.dragElementStyle],
29599
+ attrs: {
29600
+ "draggable": "false"
29601
+ },
29602
+ on: {
29603
+ "dragstart": function ($event) {
29604
+ $event.preventDefault();
29605
+ },
29606
+ "mousedown": _vm.handleElementClick,
29607
+ "touchstart": _vm.handleElementClick
29908
29608
  }
29909
- if (root) {
29910
- this.#updateProperties(element, root);
29609
+ }, [_vm._t("default", null, {
29610
+ "object": _vm.object,
29611
+ "isSelected": _vm.isSelected,
29612
+ "onDelete": _vm.onDelete,
29613
+ "onResize": _vm.startResizeFromSlot
29614
+ }), _vm.isSelected && _vm.showSelectionUi ? _vm._l(_vm.resizeDirections, function (dir) {
29615
+ return _c('button', {
29616
+ key: dir,
29617
+ staticClass: "resize-handle",
29618
+ class: `handle-${dir}`,
29619
+ attrs: {
29620
+ "type": "button"
29621
+ },
29622
+ on: {
29623
+ "mousedown": function ($event) {
29624
+ $event.stopPropagation();
29625
+ $event.preventDefault();
29626
+ return _vm.startResize(dir, $event);
29627
+ },
29628
+ "touchstart": function ($event) {
29629
+ $event.stopPropagation();
29630
+ $event.preventDefault();
29631
+ return _vm.startResize(dir, $event);
29632
+ }
29633
+ }
29634
+ });
29635
+ }) : _vm._e()], 2)]);
29636
+ };
29637
+ var DraggableElementvue_type_template_id_55db89ce_scoped_true_staticRenderFns = [];
29638
+
29639
+ ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-83.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/DraggableElement.vue?vue&type=script&lang=js
29640
+ /* harmony default export */ const DraggableElementvue_type_script_lang_js = ({
29641
+ name: 'DraggableElement',
29642
+ props: {
29643
+ object: {
29644
+ type: Object,
29645
+ required: true
29646
+ },
29647
+ pagesScale: {
29648
+ type: Number,
29649
+ default: 1
29650
+ },
29651
+ pageWidth: {
29652
+ type: Number,
29653
+ required: true
29654
+ },
29655
+ pageHeight: {
29656
+ type: Number,
29657
+ required: true
29658
+ },
29659
+ onUpdate: {
29660
+ type: Function,
29661
+ default: () => {}
29662
+ },
29663
+ onDelete: {
29664
+ type: Function,
29665
+ default: () => {}
29666
+ },
29667
+ onDragStart: {
29668
+ type: Function,
29669
+ default: () => {}
29670
+ },
29671
+ onDragMove: {
29672
+ type: Function,
29673
+ default: () => {}
29674
+ },
29675
+ onDragEnd: {
29676
+ type: Function,
29677
+ default: () => {}
29678
+ },
29679
+ isBeingDraggedGlobally: {
29680
+ type: Boolean,
29681
+ default: false
29682
+ },
29683
+ draggingClientPos: {
29684
+ type: Object,
29685
+ default: () => ({
29686
+ x: 0,
29687
+ y: 0
29688
+ })
29689
+ },
29690
+ currentDocIndex: {
29691
+ type: Number,
29692
+ default: -1
29693
+ },
29694
+ currentPageIndex: {
29695
+ type: Number,
29696
+ default: -1
29697
+ },
29698
+ globalDragDocIndex: {
29699
+ type: Number,
29700
+ default: -1
29701
+ },
29702
+ globalDragPageIndex: {
29703
+ type: Number,
29704
+ default: -1
29705
+ },
29706
+ showSelectionUi: {
29707
+ type: Boolean,
29708
+ default: true
29709
+ },
29710
+ showDefaultActions: {
29711
+ type: Boolean,
29712
+ default: true
29911
29713
  }
29912
- if (bbox) {
29913
- DrawLayer.#setBox(element, bbox);
29714
+ },
29715
+ data() {
29716
+ return {
29717
+ isSelected: false,
29718
+ mode: 'idle',
29719
+ direction: '',
29720
+ startX: 0,
29721
+ startY: 0,
29722
+ startLeft: 0,
29723
+ startTop: 0,
29724
+ startWidth: 0,
29725
+ startHeight: 0,
29726
+ offsetX: 0,
29727
+ offsetY: 0,
29728
+ resizeOffsetX: 0,
29729
+ resizeOffsetY: 0,
29730
+ resizeOffsetW: 0,
29731
+ resizeOffsetH: 0,
29732
+ aspectRatio: 1,
29733
+ lastMouseX: 0,
29734
+ lastMouseY: 0,
29735
+ pointerOffsetDoc: {
29736
+ x: 0,
29737
+ y: 0
29738
+ },
29739
+ currentPageRect: null,
29740
+ rafId: null
29741
+ };
29742
+ },
29743
+ computed: {
29744
+ resizeDirections() {
29745
+ return ['top-left', 'top-right', 'bottom-left', 'bottom-right'];
29746
+ },
29747
+ elementStyle() {
29748
+ const scale = this.pagesScale || 1;
29749
+ const currentX = this.object.x + this.offsetX + this.resizeOffsetX;
29750
+ const currentY = this.object.y + this.offsetY + this.resizeOffsetY;
29751
+ const currentWidth = this.object.width + this.resizeOffsetW;
29752
+ const currentHeight = this.object.height + this.resizeOffsetH;
29753
+ return {
29754
+ left: `${currentX * scale}px`,
29755
+ top: `${currentY * scale}px`,
29756
+ width: `${currentWidth * scale}px`,
29757
+ height: `${currentHeight * scale}px`
29758
+ };
29759
+ },
29760
+ toolbarStyle() {
29761
+ const scale = this.pagesScale || 1;
29762
+ const x = this.object.x + this.offsetX + this.resizeOffsetX;
29763
+ const y = this.object.y + this.offsetY + this.resizeOffsetY;
29764
+ const width = this.object.width + this.resizeOffsetW;
29765
+ return {
29766
+ left: `${(x + width / 2) * scale}px`,
29767
+ top: `${(y - 48) * scale}px`,
29768
+ transform: 'translateX(-50%)'
29769
+ };
29770
+ },
29771
+ dragElementStyle() {
29772
+ if (!this.isBeingDraggedGlobally || !this.draggingClientPos) {
29773
+ return {};
29774
+ }
29775
+ return {
29776
+ opacity: 0,
29777
+ pointerEvents: 'none'
29778
+ };
29914
29779
  }
29915
- if (rootClass) {
29916
- const {
29917
- classList
29918
- } = element;
29919
- for (const [className, value] of Object.entries(rootClass)) {
29920
- classList.toggle(className, value);
29780
+ },
29781
+ mounted() {
29782
+ this.handleClickOutside = this.handleClickOutside.bind(this);
29783
+ this.boundHandleMove = this.handleMove.bind(this);
29784
+ this.boundStopInteraction = this.stopInteraction.bind(this);
29785
+ document.addEventListener('mousedown', this.handleClickOutside);
29786
+ document.addEventListener('touchstart', this.handleClickOutside);
29787
+ },
29788
+ beforeUnmount() {
29789
+ document.removeEventListener('mousedown', this.handleClickOutside);
29790
+ document.removeEventListener('touchstart', this.handleClickOutside);
29791
+ window.removeEventListener('mousemove', this.boundHandleMove);
29792
+ window.removeEventListener('mouseup', this.boundStopInteraction);
29793
+ window.removeEventListener('touchmove', this.boundHandleMove);
29794
+ window.removeEventListener('touchend', this.boundStopInteraction);
29795
+ if (this.rafId) cancelAnimationFrame(this.rafId);
29796
+ },
29797
+ methods: {
29798
+ handleElementClick(event) {
29799
+ if (event.target.closest('.delete-handle') || event.target.closest('[data-stop-drag]') || event.target.closest('.actions-toolbar')) {
29800
+ return;
29801
+ }
29802
+ event.preventDefault();
29803
+ this.isSelected = true;
29804
+ this.startDrag(event);
29805
+ },
29806
+ handleClickOutside(event) {
29807
+ if (this.$el && !this.$el.contains(event.target)) {
29808
+ this.isSelected = false;
29809
+ }
29810
+ },
29811
+ startResizeFromSlot(direction, event) {
29812
+ if (!direction || !event) return;
29813
+ this.startResize(direction, event);
29814
+ },
29815
+ startDrag(event) {
29816
+ if (event.target.classList.contains('delete')) return;
29817
+ if (event.target.classList.contains('resize-handle')) return;
29818
+ this.mode = 'drag';
29819
+ this.startX = event.type.includes('touch') ? event.touches[0].clientX : event.clientX;
29820
+ this.startY = event.type.includes('touch') ? event.touches[0].clientY : event.clientY;
29821
+ this.startLeft = this.object.x;
29822
+ this.startTop = this.object.y;
29823
+ this.offsetX = 0;
29824
+ this.offsetY = 0;
29825
+ this.resetResizeOffsets();
29826
+ const elementRect = this.$el.querySelector('.draggable-element').getBoundingClientRect();
29827
+ this.pointerOffsetDoc.x = this.startX - elementRect.left;
29828
+ this.pointerOffsetDoc.y = this.startY - elementRect.top;
29829
+ const pageRect = this.capturePageRect();
29830
+ this.currentPageRect = pageRect;
29831
+ let dragElementShift = {
29832
+ x: 0,
29833
+ y: 0
29834
+ };
29835
+ if (pageRect) {
29836
+ const expectedLeft = pageRect.left + this.object.x * this.pagesScale;
29837
+ const expectedTop = pageRect.top + this.object.y * this.pagesScale;
29838
+ dragElementShift = {
29839
+ x: elementRect.left - expectedLeft,
29840
+ y: elementRect.top - expectedTop
29841
+ };
29842
+ }
29843
+ this.onDragStart(this.startX, this.startY, {
29844
+ ...this.pointerOffsetDoc
29845
+ }, dragElementShift);
29846
+ window.addEventListener('mousemove', this.boundHandleMove);
29847
+ window.addEventListener('mouseup', this.boundStopInteraction);
29848
+ window.addEventListener('touchmove', this.boundHandleMove);
29849
+ window.addEventListener('touchend', this.boundStopInteraction);
29850
+ },
29851
+ startResize(direction, event) {
29852
+ this.mode = 'resize';
29853
+ this.direction = direction;
29854
+ this.startX = event.type.includes('touch') ? event.touches[0].clientX : event.clientX;
29855
+ this.startY = event.type.includes('touch') ? event.touches[0].clientY : event.clientY;
29856
+ this.startLeft = this.object.x;
29857
+ this.startTop = this.object.y;
29858
+ this.startWidth = this.object.width;
29859
+ this.startHeight = this.object.height;
29860
+ this.aspectRatio = this.startWidth / this.startHeight;
29861
+ this.offsetX = 0;
29862
+ this.offsetY = 0;
29863
+ this.resetResizeOffsets();
29864
+ window.addEventListener('mousemove', this.boundHandleMove);
29865
+ window.addEventListener('mouseup', this.boundStopInteraction);
29866
+ window.addEventListener('touchmove', this.boundHandleMove);
29867
+ window.addEventListener('touchend', this.boundStopInteraction);
29868
+ },
29869
+ handleMove(event) {
29870
+ if (this.mode === 'idle') return;
29871
+ event.preventDefault();
29872
+ if (this.rafId) return;
29873
+ this.rafId = requestAnimationFrame(() => {
29874
+ const currentX = event.type.includes('touch') ? event.touches[0]?.clientX : event.clientX;
29875
+ const currentY = event.type.includes('touch') ? event.touches[0]?.clientY : event.clientY;
29876
+ if (currentX === undefined || currentY === undefined) return;
29877
+ this.lastMouseX = currentX;
29878
+ this.lastMouseY = currentY;
29879
+ const deltaX = (currentX - this.startX) / this.pagesScale;
29880
+ const deltaY = (currentY - this.startY) / this.pagesScale;
29881
+ if (this.mode === 'drag') {
29882
+ const pageRect = this.currentPageRect;
29883
+ if (pageRect) {
29884
+ const newElementLeft = currentX - this.pointerOffsetDoc.x;
29885
+ const newElementTop = currentY - this.pointerOffsetDoc.y;
29886
+ const newX = (newElementLeft - pageRect.left) / this.pagesScale;
29887
+ const newY = (newElementTop - pageRect.top) / this.pagesScale;
29888
+ this.offsetX = newX - this.object.x;
29889
+ this.offsetY = newY - this.object.y;
29890
+ } else {
29891
+ this.offsetX = deltaX;
29892
+ this.offsetY = deltaY;
29893
+ }
29894
+ this.onDragMove(currentX, currentY);
29895
+ if (this.isBeingDraggedGlobally) {
29896
+ this.onUpdate({
29897
+ _globalDrag: true,
29898
+ _mouseX: currentX,
29899
+ _mouseY: currentY
29900
+ });
29901
+ }
29902
+ this.rafId = null;
29903
+ return;
29904
+ }
29905
+ const minSize = 16;
29906
+ let newWidth = this.startWidth;
29907
+ let newHeight = this.startHeight;
29908
+ let newLeft = this.startLeft;
29909
+ let newTop = this.startTop;
29910
+ const widthChange = this.direction.includes('right') ? deltaX : this.direction.includes('left') ? -deltaX : 0;
29911
+ newWidth = this.startWidth + widthChange;
29912
+ if (newWidth < minSize) newWidth = minSize;
29913
+ newHeight = newWidth / this.aspectRatio;
29914
+ if (this.direction.includes('left')) {
29915
+ newLeft = this.startLeft + (this.startWidth - newWidth);
29916
+ if (newLeft < 0) {
29917
+ const overflow = -newLeft;
29918
+ newLeft = 0;
29919
+ newWidth = newWidth - overflow;
29920
+ newHeight = newWidth / this.aspectRatio;
29921
+ }
29922
+ }
29923
+ if (this.direction.includes('top')) {
29924
+ newTop = this.startTop + (this.startHeight - newHeight);
29925
+ if (newTop < 0) {
29926
+ const overflow = -newTop;
29927
+ newTop = 0;
29928
+ newHeight = newHeight - overflow;
29929
+ newWidth = newHeight * this.aspectRatio;
29930
+ if (this.direction.includes('left')) {
29931
+ newLeft = this.startLeft + (this.startWidth - newWidth);
29932
+ }
29933
+ }
29934
+ }
29935
+ if (newLeft + newWidth > this.pageWidth) {
29936
+ const excess = newLeft + newWidth - this.pageWidth;
29937
+ newWidth -= excess;
29938
+ newHeight = newWidth / this.aspectRatio;
29939
+ }
29940
+ if (newTop + newHeight > this.pageHeight) {
29941
+ const excess = newTop + newHeight - this.pageHeight;
29942
+ newHeight -= excess;
29943
+ newWidth = newHeight * this.aspectRatio;
29944
+ if (this.direction.includes('left')) {
29945
+ newLeft = this.startLeft + (this.startWidth - newWidth);
29946
+ }
29947
+ }
29948
+ this.resizeOffsetX = newLeft - this.object.x;
29949
+ this.resizeOffsetY = newTop - this.object.y;
29950
+ this.resizeOffsetW = newWidth - this.object.width;
29951
+ this.resizeOffsetH = newHeight - this.object.height;
29952
+ this.rafId = null;
29953
+ });
29954
+ },
29955
+ stopInteraction() {
29956
+ if (this.mode === 'idle') return;
29957
+ if (this.mode === 'drag' && (this.offsetX !== 0 || this.offsetY !== 0)) {
29958
+ if (this.isBeingDraggedGlobally) {
29959
+ this.onUpdate({
29960
+ _globalDrag: true,
29961
+ _mouseX: this.lastMouseX,
29962
+ _mouseY: this.lastMouseY
29963
+ });
29964
+ } else {
29965
+ const x = Math.max(0, Math.min(this.object.x + this.offsetX, this.pageWidth - this.object.width));
29966
+ const y = Math.max(0, Math.min(this.object.y + this.offsetY, this.pageHeight - this.object.height));
29967
+ this.onUpdate({
29968
+ x,
29969
+ y
29970
+ });
29971
+ }
29921
29972
  }
29973
+ if (this.mode === 'resize' && (this.resizeOffsetW !== 0 || this.resizeOffsetH !== 0 || this.resizeOffsetX !== 0 || this.resizeOffsetY !== 0)) {
29974
+ const x = this.object.x + this.resizeOffsetX;
29975
+ const y = this.object.y + this.resizeOffsetY;
29976
+ const width = this.object.width + this.resizeOffsetW;
29977
+ const height = this.object.height + this.resizeOffsetH;
29978
+ this.onUpdate({
29979
+ x,
29980
+ y,
29981
+ width,
29982
+ height
29983
+ });
29984
+ }
29985
+ this.resetOffsets();
29986
+ this.onDragEnd();
29987
+ window.removeEventListener('mousemove', this.boundHandleMove);
29988
+ window.removeEventListener('mouseup', this.boundStopInteraction);
29989
+ window.removeEventListener('touchmove', this.boundHandleMove);
29990
+ window.removeEventListener('touchend', this.boundStopInteraction);
29991
+ },
29992
+ capturePageRect() {
29993
+ const wrapper = this.$el.closest('.page-wrapper');
29994
+ if (!wrapper) return null;
29995
+ const canvas = wrapper.querySelector('canvas');
29996
+ return canvas ? canvas.getBoundingClientRect() : null;
29997
+ },
29998
+ resetResizeOffsets() {
29999
+ this.resizeOffsetX = 0;
30000
+ this.resizeOffsetY = 0;
30001
+ this.resizeOffsetW = 0;
30002
+ this.resizeOffsetH = 0;
30003
+ },
30004
+ resetOffsets() {
30005
+ this.mode = 'idle';
30006
+ this.offsetX = 0;
30007
+ this.offsetY = 0;
30008
+ this.resetResizeOffsets();
30009
+ this.pointerOffsetDoc = {
30010
+ x: 0,
30011
+ y: 0
30012
+ };
30013
+ this.currentPageRect = null;
29922
30014
  }
29923
- if (path) {
29924
- const defs = element.firstElementChild;
29925
- const pathElement = defs.firstElementChild;
29926
- this.#updateProperties(pathElement, path);
29927
- }
29928
- }
29929
- updateParent(id, layer) {
29930
- if (layer === this) {
29931
- return;
29932
- }
29933
- const root = this.#mapping.get(id);
29934
- if (!root) {
29935
- return;
29936
- }
29937
- layer.#parent.append(root);
29938
- this.#mapping.delete(id);
29939
- layer.#mapping.set(id, root);
29940
- }
29941
- remove(id) {
29942
- this.#toUpdate.delete(id);
29943
- if (this.#parent === null) {
29944
- return;
29945
- }
29946
- this.#mapping.get(id).remove();
29947
- this.#mapping.delete(id);
29948
- }
29949
- destroy() {
29950
- this.#parent = null;
29951
- for (const root of this.#mapping.values()) {
29952
- root.remove();
29953
- }
29954
- this.#mapping.clear();
29955
- this.#toUpdate.clear();
29956
30015
  }
29957
- }
29958
-
29959
- ;// ./src/pdf.js
29960
-
29961
-
29962
-
29963
-
29964
-
29965
-
29966
-
29967
-
29968
-
29969
-
30016
+ });
30017
+ ;// ./src/components/DraggableElement.vue?vue&type=script&lang=js
30018
+ /* harmony default export */ const components_DraggableElementvue_type_script_lang_js = (DraggableElementvue_type_script_lang_js);
30019
+ ;// ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-55.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-55.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-55.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/DraggableElement.vue?vue&type=style&index=0&id=55db89ce&prod&scoped=true&lang=css
30020
+ // extracted by mini-css-extract-plugin
29970
30021
 
30022
+ ;// ./src/components/DraggableElement.vue?vue&type=style&index=0&id=55db89ce&prod&scoped=true&lang=css
29971
30023
 
30024
+ ;// ./src/components/DraggableElement.vue
29972
30025
 
29973
30026
 
29974
30027
 
30028
+ ;
29975
30029
 
29976
- {
29977
- globalThis._pdfjsTestingUtils = {
29978
- HighlightOutliner: HighlightOutliner
29979
- };
29980
- }
29981
- globalThis.pdfjsLib = {
29982
- AbortException: AbortException,
29983
- AnnotationEditorLayer: AnnotationEditorLayer,
29984
- AnnotationEditorParamsType: AnnotationEditorParamsType,
29985
- AnnotationEditorType: AnnotationEditorType,
29986
- AnnotationEditorUIManager: AnnotationEditorUIManager,
29987
- AnnotationLayer: AnnotationLayer,
29988
- AnnotationMode: AnnotationMode,
29989
- AnnotationType: AnnotationType,
29990
- applyOpacity: applyOpacity,
29991
- build: build,
29992
- ColorPicker: ColorPicker,
29993
- createValidAbsoluteUrl: createValidAbsoluteUrl,
29994
- CSSConstants: CSSConstants,
29995
- DOMSVGFactory: DOMSVGFactory,
29996
- DrawLayer: DrawLayer,
29997
- FeatureTest: util_FeatureTest,
29998
- fetchData: fetchData,
29999
- findContrastColor: findContrastColor,
30000
- getDocument: getDocument,
30001
- getFilenameFromUrl: getFilenameFromUrl,
30002
- getPdfFilenameFromUrl: getPdfFilenameFromUrl,
30003
- getRGB: getRGB,
30004
- getUuid: getUuid,
30005
- getXfaPageViewport: getXfaPageViewport,
30006
- GlobalWorkerOptions: GlobalWorkerOptions,
30007
- ImageKind: util_ImageKind,
30008
- InvalidPDFException: InvalidPDFException,
30009
- isDataScheme: isDataScheme,
30010
- isPdfFile: isPdfFile,
30011
- isValidExplicitDest: isValidExplicitDest,
30012
- MathClamp: MathClamp,
30013
- noContextMenu: noContextMenu,
30014
- normalizeUnicode: normalizeUnicode,
30015
- OPS: OPS,
30016
- OutputScale: OutputScale,
30017
- PasswordResponses: PasswordResponses,
30018
- PDFDataRangeTransport: PDFDataRangeTransport,
30019
- PDFDateString: PDFDateString,
30020
- PDFWorker: PDFWorker,
30021
- PermissionFlag: PermissionFlag,
30022
- PixelsPerInch: PixelsPerInch,
30023
- RenderingCancelledException: RenderingCancelledException,
30024
- renderRichText: renderRichText,
30025
- ResponseException: ResponseException,
30026
- setLayerDimensions: setLayerDimensions,
30027
- shadow: shadow,
30028
- SignatureExtractor: SignatureExtractor,
30029
- stopEvent: stopEvent,
30030
- SupportedImageMimeTypes: SupportedImageMimeTypes,
30031
- TextLayer: TextLayer,
30032
- TouchManager: TouchManager,
30033
- updateUrlHash: updateUrlHash,
30034
- Util: Util,
30035
- VerbosityLevel: VerbosityLevel,
30036
- version: version,
30037
- XfaLayer: XfaLayer
30038
- };
30039
30030
 
30031
+ /* normalize component */
30040
30032
 
30033
+ var DraggableElement_component = normalizeComponent(
30034
+ components_DraggableElementvue_type_script_lang_js,
30035
+ DraggableElementvue_type_template_id_55db89ce_scoped_true_render,
30036
+ DraggableElementvue_type_template_id_55db89ce_scoped_true_staticRenderFns,
30037
+ false,
30038
+ null,
30039
+ "55db89ce",
30040
+ null
30041
+
30042
+ )
30041
30043
 
30042
- //# sourceMappingURL=pdf.mjs.map
30043
- ;// ./node_modules/pdfjs-dist/build/pdf.worker.min.mjs
30044
- const pdf_worker_min_namespaceObject = __webpack_require__.p + "pdf.worker.min.mjs";
30044
+ /* harmony default export */ const DraggableElement = (DraggableElement_component.exports);
30045
30045
  ;// ./src/utils/asyncReader.js
30046
30046
  // SPDX-FileCopyrightText: 2026 LibreCode coop and contributors
30047
30047
  // SPDX-License-Identifier: AGPL-3.0-or-later
30048
30048
 
30049
30049
 
30050
30050
 
30051
- GlobalWorkerOptions.workerSrc = pdf_worker_min_namespaceObject;
30051
+ pdf_GlobalWorkerOptions.workerSrc = pdf_worker_min_namespaceObject;
30052
+ function setWorkerPath(path) {
30053
+ GlobalWorkerOptions.workerSrc = path;
30054
+ }
30052
30055
  function readAsArrayBuffer(file) {
30053
30056
  return new Promise((resolve, reject) => {
30054
30057
  const reader = new FileReader();
@@ -30117,6 +30120,10 @@ function readAsPDF(file) {
30117
30120
  pageCountFormat: {
30118
30121
  type: String,
30119
30122
  default: '{currentPage} of {totalPages}'
30123
+ },
30124
+ autoFitZoom: {
30125
+ type: Boolean,
30126
+ default: false
30120
30127
  }
30121
30128
  },
30122
30129
  data() {
@@ -30189,6 +30196,9 @@ function readAsPDF(file) {
30189
30196
  this.$el?.addEventListener('wheel', this.boundHandleWheel, {
30190
30197
  passive: false
30191
30198
  });
30199
+ if (this.autoFitZoom) {
30200
+ window.addEventListener('resize', this.adjustZoomToFit);
30201
+ }
30192
30202
  },
30193
30203
  beforeUnmount() {
30194
30204
  if (this.zoomRafId) {
@@ -30206,6 +30216,9 @@ function readAsPDF(file) {
30206
30216
  window.removeEventListener('scroll', this.onViewportScroll);
30207
30217
  window.removeEventListener('resize', this.onViewportScroll);
30208
30218
  this.$el?.removeEventListener('scroll', this.onViewportScroll);
30219
+ if (this.autoFitZoom) {
30220
+ window.removeEventListener('resize', this.adjustZoomToFit);
30221
+ }
30209
30222
  if (this.viewportRafId) {
30210
30223
  window.cancelAnimationFrame(this.viewportRafId);
30211
30224
  this.viewportRafId = 0;
@@ -30248,6 +30261,11 @@ function readAsPDF(file) {
30248
30261
  this.$emit('pdf-elements:end-init', {
30249
30262
  docsCount: docs.length
30250
30263
  });
30264
+ this.$nextTick(() => {
30265
+ if (this.autoFitZoom) {
30266
+ this.adjustZoomToFit();
30267
+ }
30268
+ });
30251
30269
  }
30252
30270
  },
30253
30271
  selectPage(docIndex, pageIndex) {
@@ -30684,15 +30702,36 @@ function readAsPDF(file) {
30684
30702
  const doc = this.pdfDocuments[docIndex];
30685
30703
  const pagesScale = doc.pagesScale[pageIndex] || 1;
30686
30704
  return pageRef.getCanvasMeasurement().canvasHeight / pagesScale;
30705
+ },
30706
+ calculateOptimalScale(maxPageWidth) {
30707
+ const containerWidth = this.$el?.clientWidth || 0;
30708
+ if (!containerWidth || !maxPageWidth) return 1;
30709
+ const availableWidth = containerWidth - 40;
30710
+ return Math.max(0.1, Math.min(2, availableWidth / maxPageWidth));
30711
+ },
30712
+ adjustZoomToFit() {
30713
+ if (!this.autoFitZoom || !this.pdfDocuments.length) return;
30714
+ const canvases = this.$el?.querySelectorAll('canvas');
30715
+ if (!canvases?.length) return;
30716
+ const maxCanvasWidth = Math.max(...Array.from(canvases).map(canvas => canvas.width / (this.scale || 1)));
30717
+ const optimalScale = this.calculateOptimalScale(maxCanvasWidth);
30718
+ if (Math.abs(optimalScale - this.scale) > 0.01) {
30719
+ this.scale = optimalScale;
30720
+ this.visualScale = optimalScale;
30721
+ this.pdfDocuments.forEach(doc => {
30722
+ doc.pagesScale = doc.pagesScale.map(() => this.scale);
30723
+ });
30724
+ this.cachePageBounds();
30725
+ }
30687
30726
  }
30688
30727
  }
30689
30728
  });
30690
30729
  ;// ./src/components/PDFElements.vue?vue&type=script&lang=js
30691
30730
  /* harmony default export */ const components_PDFElementsvue_type_script_lang_js = (PDFElementsvue_type_script_lang_js);
30692
- ;// ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-55.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-55.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-55.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/PDFElements.vue?vue&type=style&index=0&id=5a4a7f3b&prod&scoped=true&lang=css
30731
+ ;// ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-55.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-55.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-55.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/PDFElements.vue?vue&type=style&index=0&id=00b0fcba&prod&scoped=true&lang=css
30693
30732
  // extracted by mini-css-extract-plugin
30694
30733
 
30695
- ;// ./src/components/PDFElements.vue?vue&type=style&index=0&id=5a4a7f3b&prod&scoped=true&lang=css
30734
+ ;// ./src/components/PDFElements.vue?vue&type=style&index=0&id=00b0fcba&prod&scoped=true&lang=css
30696
30735
 
30697
30736
  ;// ./src/components/PDFElements.vue
30698
30737
 
@@ -30709,7 +30748,7 @@ var PDFElements_component = normalizeComponent(
30709
30748
  staticRenderFns,
30710
30749
  false,
30711
30750
  null,
30712
- "5a4a7f3b",
30751
+ "00b0fcba",
30713
30752
  null
30714
30753
 
30715
30754
  )
@@ -30720,6 +30759,10 @@ var PDFElements_component = normalizeComponent(
30720
30759
  // SPDX-License-Identifier: AGPL-3.0-or-later
30721
30760
 
30722
30761
 
30762
+
30763
+ pdf_GlobalWorkerOptions.workerSrc = pdf_worker_min_namespaceObject;
30764
+
30765
+
30723
30766
  PDFElements.install = function (Vue) {
30724
30767
  if (PDFElements.install.installed) return;
30725
30768
  Vue.component(PDFElements.name, PDFElements);