@progress/kendo-vue-pdf-viewer 9.2.0-develop.2

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.
package/LICENSE.md ADDED
@@ -0,0 +1,11 @@
1
+ # Kendo UI for Vue
2
+
3
+ This package is part of the [Kendo UI for Vue](https://www.telerik.com/kendo-vue-ui/) suite.
4
+
5
+ ## License
6
+
7
+ This is commercial software. To use it, you need to agree to the [**Telerik End User License Agreement for Kendo UI**](https://www.telerik.com/purchase/license-agreement/kendo-ui). If you do not own a commercial license, this file shall be governed by the trial license terms.
8
+
9
+ All available Kendo UI commercial licenses may be obtained at https://www.telerik.com/purchase/kendo-ui.
10
+
11
+ *Copyright © 2022 Progress Software Corporation and/or one of its subsidiaries or affiliates. All Rights Reserved.*
package/NOTICE.txt ADDED
@@ -0,0 +1,109 @@
1
+
2
+ Progress Kendo UI for Vue 2026 Updated July 2026
3
+
4
+ ----------------------------------------------------------------------------------------------------------------------------
5
+ NOTICES REPORT
6
+ ----------------------------------------------------------------------------------------------------------------------------
7
+
8
+ Portions of the Products include certain open source and commercial third-party components listed below ("Third-Party
9
+ Components"). The authors of the Third-Party Components require Progress Software Corporation ("PSC") to include the
10
+ following notices and additional licensing terms as a condition of PSC's use of such Third-Party Components. You
11
+ acknowledge that the authors of the Third-Party Components have no obligation to provide support to you for the Third-Party
12
+ Components or the Product. You hereby undertake to comply with all licenses related to the applicable Third-Party
13
+ Components. Notwithstanding anything to the contrary, to the extent that any of the terms and conditions of the Progress
14
+ Agreement conflict, vary, or are in addition to the terms and conditions of the aforementioned third-party licenses for these
15
+ technologies, such terms and conditions are offered by PSC alone and not by any other party.
16
+
17
+ ----------------------------------------------------------------------------------------------------------------------------
18
+ Report Content
19
+ - General License Information
20
+ - Components
21
+ - License Data and Text
22
+ ----------------------------------------------------------------------------------------------------------------------------
23
+
24
+ General License Information:
25
+
26
+ ----------------------------------------------------------------------------------------------------------------------------
27
+
28
+ GENERATIVE ARTIFICIAL INTELLIGENCE INTEGRATION
29
+ If the Software documentation specifies integration with some form of generative artificial intelligence (AI), then the
30
+ Software will include a configuration to connect to AI. You acknowledge that a separate license or subscription access
31
+ to AI governed by the terms and conditions of a license agreement from AI licensor will be required for use and access of
32
+ AI capabilities integrated with the Software. You will be responsible to comply with the terms of such license agreement
33
+ for a valid use of AI. You acknowledge and accept that Progress is not a party to the license agreement between You
34
+ and AI licensor for AI use, and as a result Progress does not have any control over AI and its availability, and Progress
35
+ disclaims any and all liabilities for any output, error, damages, loss, etc., or any other result of Your use of AI
36
+ integrated with the Software.
37
+
38
+ ----------------------------------------------------------------------------------------------------------------------------
39
+
40
+ NOTICE FROM PROGRESS SOFTWARE CORPORATION: Additional notices may be included in the release notes or other
41
+ documentation that accompanies updates received in connection with support of the Product.
42
+
43
+ ----------------------------------------------------------------------------------------------------------------------------
44
+
45
+ Components:
46
+
47
+ | -------------------------------------- | ------------------------------------- | ---------------------------------------- |
48
+ | Component | Origin | License |
49
+ | -------------------------------------- | ------------------------------------- | ---------------------------------------- |
50
+ | @progress/jszip-esm 1.0.4 | https://github.com/telerik/jszip-esm# | MIT License |
51
+ | | readme | |
52
+ | @progress/pako-esm 1.0.1 | https://github.com/telerik/pako-esm#r | MIT License |
53
+ | | eadme | |
54
+ | prosemirror-commands 1.7.1 | https://github.com/prosemirror/prosem | MIT License |
55
+ | | irror-commands#readme | |
56
+ | prosemirror-dropcursor 1.8.2 | https://github.com/prosemirror/prosem | MIT License |
57
+ | | irror-dropcursor#readme | |
58
+ | prosemirror-gapcursor 1.4.0 | https://github.com/prosemirror/prosem | MIT License |
59
+ | | irror-gapcursor#readme | |
60
+ | prosemirror-history 1.5.0 | https://github.com/prosemirror/prosem | MIT License |
61
+ | | irror-history#readme | |
62
+ | prosemirror-inputrules 1.5.1 | https://github.com/prosemirror/prosem | MIT License |
63
+ | | irror-inputrules#readme | |
64
+ | prosemirror-keymap 1.2.3 | https://github.com/prosemirror/prosem | MIT License |
65
+ | | irror-keymap#readme | |
66
+ | prosemirror-model 1.25.4 | https://github.com/prosemirror/prosem | MIT License |
67
+ | | irror-model#readme | |
68
+ | prosemirror-schema-list 1.5.1 | https://github.com/prosemirror/prosem | MIT License |
69
+ | | irror-schema-list#readme | |
70
+ | prosemirror-state 1.4.4 | https://github.com/prosemirror/prosem | MIT License |
71
+ | | irror-state#readme | |
72
+ | prosemirror-tables 1.8.5 | https://github.com/prosemirror/prosem | MIT License |
73
+ | | irror-tables#readme | |
74
+ | prosemirror-transform 1.10.5 | https://github.com/prosemirror/prosem | MIT License |
75
+ | | irror-transform#readme | |
76
+ | prosemirror-view 1.41.6 | https://github.com/prosemirror/prosem | MIT License |
77
+ | | irror-view#readme | |
78
+ | -------------------------------------- | ------------------------------------- | ---------------------------------------- |
79
+
80
+ -------------------------------------------------------------------------------------------------------------------------
81
+ License Data and Text:
82
+ -------------------------------------------------------------------------------------------------------------------------
83
+
84
+ MIT License
85
+ (@progress/jszip-esm 1.0.4, @progress/pako-esm 1.0.1, prosemirror-commands 1.7.1, prosemirror-dropcursor 1.8.2, prosemirror-gapcursor 1.4.0, prosemirror-history 1.5.0, prosemirror-inputrules 1.5.1, prosemirror-keymap 1.2.3, prosemirror-model 1.25.4, prosemirror-schema-list 1.5.1, prosemirror-state 1.4.4, prosemirror-tables 1.8.5, prosemirror-transform 1.10.5, prosemirror-view 1.41.6)
86
+
87
+ The MIT License
88
+ ===============
89
+
90
+ [Copyright notice for each component version subject to this license can be located via the origin url provided in the Component Summary above]
91
+
92
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
93
+ this software and associated documentation files (the "Software"), to deal in the
94
+ Software without restriction, including without limitation the rights to use,
95
+ copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
96
+ Software, and to permit persons to whom the Software is furnished to do so,
97
+ subject to the following conditions:
98
+
99
+ The above copyright notice and this permission notice shall be included in all
100
+ copies or substantial portions of the Software.
101
+
102
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
103
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
104
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
105
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
106
+ AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
107
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
108
+
109
+ ---
package/PDFViewer.d.ts ADDED
@@ -0,0 +1,266 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ import { PropType } from 'vue';
9
+ import { UploadOnAddEvent } from '@progress/kendo-vue-upload';
10
+ import { SaveOptions } from '@progress/kendo-file-saver';
11
+ import { PDFDocumentProxy, TypedArray } from '@progress/kendo-pdfviewer-common';
12
+ export type PDFViewerTool = 'pager' | 'spacer' | 'zoomInOut' | 'zoom' | 'selection' | 'search' | 'open' | 'download' | 'print';
13
+ export interface PDFViewerEvent {
14
+ target: any;
15
+ }
16
+ export interface ErrorEvent extends PDFViewerEvent {
17
+ error: Error | {
18
+ message: string;
19
+ };
20
+ }
21
+ export interface DownloadEvent extends PDFViewerEvent {
22
+ blob: Blob;
23
+ fileName: string;
24
+ saveOptions: SaveOptions;
25
+ }
26
+ export type LoadEvent = PDFViewerEvent;
27
+ export interface ZoomEvent extends PDFViewerEvent {
28
+ zoom: number;
29
+ }
30
+ export interface PageEvent extends PDFViewerEvent {
31
+ page: number;
32
+ }
33
+ export interface PDFViewerProps {
34
+ url?: string;
35
+ data?: string;
36
+ arrayBuffer?: ArrayBuffer;
37
+ typedArray?: TypedArray;
38
+ style?: Record<string, string>;
39
+ dir?: string;
40
+ saveFileName?: string;
41
+ saveOptions?: SaveOptions;
42
+ tools?: PDFViewerTool[];
43
+ zoomLevels?: {
44
+ id: number;
45
+ priority: number;
46
+ value: number;
47
+ text: string;
48
+ type: string;
49
+ locationString?: string;
50
+ }[];
51
+ zoom?: number;
52
+ defaultZoom?: number;
53
+ minZoom?: number;
54
+ maxZoom?: number;
55
+ zoomRate?: number;
56
+ toolbar?: any;
57
+ content?: any;
58
+ loader?: any;
59
+ }
60
+ declare const PDFViewer: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
61
+ url: PropType<string>;
62
+ data: PropType<string>;
63
+ arrayBuffer: PropType<ArrayBuffer>;
64
+ typedArray: PropType<TypedArray>;
65
+ dir: {
66
+ type: PropType<string>;
67
+ validator: (value: any) => any;
68
+ };
69
+ saveFileName: PropType<string>;
70
+ saveOptions: PropType<SaveOptions>;
71
+ tools: {
72
+ type: PropType<PDFViewerTool[]>;
73
+ default: () => ("search" | "spacer" | "pager" | "selection" | "open" | "zoomInOut" | "zoom" | "download" | "print")[];
74
+ };
75
+ zoomLevels: {
76
+ type: PropType<{
77
+ id: number;
78
+ priority: number;
79
+ value: number;
80
+ text: string;
81
+ type: string;
82
+ locationString?: string;
83
+ }[]>;
84
+ default: () => ({
85
+ id: number;
86
+ priority: number;
87
+ value: number;
88
+ text: string;
89
+ type: string;
90
+ locationString: string;
91
+ } | {
92
+ id: number;
93
+ priority: number;
94
+ value: number;
95
+ text: string;
96
+ type: string;
97
+ locationString?: undefined;
98
+ })[];
99
+ };
100
+ zoom: PropType<number>;
101
+ defaultZoom: {
102
+ type: PropType<number>;
103
+ default: number;
104
+ };
105
+ minZoom: {
106
+ type: PropType<number>;
107
+ default: number;
108
+ };
109
+ maxZoom: {
110
+ type: PropType<number>;
111
+ default: number;
112
+ };
113
+ zoomRate: {
114
+ type: PropType<number>;
115
+ default: number;
116
+ };
117
+ toolbar: PropType<any>;
118
+ content: PropType<any>;
119
+ loader: PropType<any>;
120
+ }>, {}, {
121
+ stateZoom: number;
122
+ hasDocument: boolean;
123
+ loading: boolean;
124
+ skip: number;
125
+ enabledSelection: boolean;
126
+ showSearch: boolean;
127
+ matches: number;
128
+ currentMatch: number;
129
+ matchCase: boolean;
130
+ searchText: string;
131
+ showLicenseWatermark: boolean;
132
+ currentRtl: boolean;
133
+ }, {
134
+ currentZoom(): number;
135
+ currentZoomLevel(): any;
136
+ currentDir(): string;
137
+ }, {
138
+ localize(key: string): string;
139
+ getTarget(): {
140
+ element: any;
141
+ props: any;
142
+ document: any;
143
+ pages: any;
144
+ };
145
+ setScaleFactor(scaleFactor: number): void;
146
+ loadDocument(): void;
147
+ onDone({ pdfPages, pdfDoc, zoom: documentZoom }: {
148
+ pdfPages: any[];
149
+ pdfDoc: PDFDocumentProxy;
150
+ zoom: number;
151
+ }): void;
152
+ onError(reason?: string | Error): void;
153
+ triggerOnLoad(): void;
154
+ triggerOnDownload(blob: Blob, fileName: string, saveOptions: SaveOptions): boolean;
155
+ initScroller(): void;
156
+ initSearch(wrapper: HTMLDivElement): void;
157
+ reload(pdfDoc: PDFDocumentProxy, zoomLev: number, currentPageNumber: number): void;
158
+ onSearchClick(): void;
159
+ onSearchTextChange(e: any): void;
160
+ onMatchCaseClick(): void;
161
+ onNextMatch(): void;
162
+ onPrevMatch(): void;
163
+ onClose(): void;
164
+ onTextBoxKeyDown(e: KeyboardEvent): void;
165
+ onPageChange(e: any): void;
166
+ onScroll(e: Event): void;
167
+ onZoomIn(e: Event): void;
168
+ onZoomOut(e: Event): void;
169
+ onZoomLevelChange(e: any): void;
170
+ onTextSelection(): void;
171
+ onPinning(): void;
172
+ onDownloadClick(): void;
173
+ onPrintClick(): void;
174
+ onAdd(e: UploadOnAddEvent): void;
175
+ onFileOpen(e: MouseEvent): void;
176
+ renderLoader(): import("vue/jsx-runtime").JSX.Element;
177
+ renderToolbar(): import("vue/jsx-runtime").JSX.Element;
178
+ renderContent(): import("vue/jsx-runtime").JSX.Element;
179
+ }, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
180
+ error: (event: ErrorEvent) => true;
181
+ load: (event: LoadEvent) => true;
182
+ download: (event: DownloadEvent) => true;
183
+ zoom: (event: ZoomEvent) => true;
184
+ pagechange: (event: PageEvent) => true;
185
+ }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
186
+ url: PropType<string>;
187
+ data: PropType<string>;
188
+ arrayBuffer: PropType<ArrayBuffer>;
189
+ typedArray: PropType<TypedArray>;
190
+ dir: {
191
+ type: PropType<string>;
192
+ validator: (value: any) => any;
193
+ };
194
+ saveFileName: PropType<string>;
195
+ saveOptions: PropType<SaveOptions>;
196
+ tools: {
197
+ type: PropType<PDFViewerTool[]>;
198
+ default: () => ("search" | "spacer" | "pager" | "selection" | "open" | "zoomInOut" | "zoom" | "download" | "print")[];
199
+ };
200
+ zoomLevels: {
201
+ type: PropType<{
202
+ id: number;
203
+ priority: number;
204
+ value: number;
205
+ text: string;
206
+ type: string;
207
+ locationString?: string;
208
+ }[]>;
209
+ default: () => ({
210
+ id: number;
211
+ priority: number;
212
+ value: number;
213
+ text: string;
214
+ type: string;
215
+ locationString: string;
216
+ } | {
217
+ id: number;
218
+ priority: number;
219
+ value: number;
220
+ text: string;
221
+ type: string;
222
+ locationString?: undefined;
223
+ })[];
224
+ };
225
+ zoom: PropType<number>;
226
+ defaultZoom: {
227
+ type: PropType<number>;
228
+ default: number;
229
+ };
230
+ minZoom: {
231
+ type: PropType<number>;
232
+ default: number;
233
+ };
234
+ maxZoom: {
235
+ type: PropType<number>;
236
+ default: number;
237
+ };
238
+ zoomRate: {
239
+ type: PropType<number>;
240
+ default: number;
241
+ };
242
+ toolbar: PropType<any>;
243
+ content: PropType<any>;
244
+ loader: PropType<any>;
245
+ }>> & Readonly<{
246
+ onError?: (event: ErrorEvent) => any;
247
+ onLoad?: (event: PDFViewerEvent) => any;
248
+ onPagechange?: (event: PageEvent) => any;
249
+ onZoom?: (event: ZoomEvent) => any;
250
+ onDownload?: (event: DownloadEvent) => any;
251
+ }>, {
252
+ zoomLevels: {
253
+ id: number;
254
+ priority: number;
255
+ value: number;
256
+ text: string;
257
+ type: string;
258
+ locationString?: string;
259
+ }[];
260
+ defaultZoom: number;
261
+ minZoom: number;
262
+ maxZoom: number;
263
+ zoomRate: number;
264
+ tools: PDFViewerTool[];
265
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
266
+ export { PDFViewer };
package/PDFViewer.js ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("vue"),n=require("@progress/kendo-vue-buttons"),_=require("@progress/kendo-vue-inputs"),z=require("@progress/kendo-vue-data-tools"),C=require("@progress/kendo-vue-upload"),x=require("@progress/kendo-vue-dropdowns"),S=require("@progress/kendo-vue-indicators"),l=require("@progress/kendo-vue-common"),c=require("@progress/kendo-svg-icons");require("pdfjs-dist/build/pdf.worker.min.mjs");const b=require("./package-metadata.js"),i=require("@progress/kendo-pdfviewer-common"),a=require("./messages.js");function w(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!s.isVNode(e)}const y=["pager","spacer","zoomInOut","zoom","selection","spacer","search","open","download","print"],u={minZoom:.5,maxZoom:4,tools:[...y],zoomRate:.25,zoomLevels:[{id:1,priority:1,value:1,text:"Actual width",type:"ActualWidth",locationString:a.actualWidth},{id:2,priority:2,value:1,text:"Fit to width",type:"FitToWidth",locationString:a.fitToWidth},{id:3,priority:3,value:1,text:"Fit to page",type:"FitToPage",locationString:a.fitToPage},{id:4,priority:4,value:.5,text:"50%",type:""},{id:5,priority:5,value:.75,text:"75%",type:""},{id:6,priority:100,value:1,text:"100%",type:""},{id:7,priority:7,value:1.25,text:"125%",type:""},{id:8,priority:8,value:1.5,text:"150%",type:""},{id:9,priority:9,value:2,text:"200%",type:""},{id:10,priority:10,value:3,text:"300%",type:""},{id:11,priority:11,value:4,text:"400%",type:""}],defaultZoom:i.DEFAULT_ZOOM_LEVEL},T=[".k-toolbar > button",".k-toolbar .k-combobox > input",".k-toolbar .k-button-group > button",".k-toolbar .k-pager > a",".k-toolbar .k-pager input"],V=(e,t)=>e.priority>t.priority?-1:e.priority<t.priority?1:0,E=s.defineComponent({name:"KendoPDFViewer",emits:{error:e=>!0,load:e=>!0,download:e=>!0,zoom:e=>!0,pagechange:e=>!0},props:{url:String,data:String,arrayBuffer:Object,typedArray:Object,dir:{type:String,validator:function(e){return[null,"ltr","rtl"].includes(e)}},saveFileName:String,saveOptions:Object,tools:{type:Array,default:()=>[...y]},zoomLevels:{type:Array,default:()=>u.zoomLevels},zoom:Number,defaultZoom:{type:Number,default:u.defaultZoom},minZoom:{type:Number,default:u.minZoom},maxZoom:{type:Number,default:u.maxZoom},zoomRate:{type:Number,default:u.zoomRate},toolbar:[String,Function,Object],content:[String,Function,Object],loader:[String,Function,Object]},inject:{kendoLocalizationService:{default:null}},data(){return{stateZoom:this.$props.defaultZoom,hasDocument:!1,loading:!0,skip:0,enabledSelection:!0,showSearch:!1,matches:0,currentMatch:0,matchCase:!1,searchText:"",showLicenseWatermark:!1,currentRtl:!1}},created(){l.validatePackage(b.packageMetadata),this.showLicenseWatermark=l.shouldShowValidationUI(b.packageMetadata),this._licenseMessage=l.getLicenseMessage(b.packageMetadata),this._pagesEl=null,this._pdfViewerEl=null,this._scroller=null,this._search=null,this._document=null,this._pages=[],this._zoom=null},computed:{currentZoom(){return this.$props.zoom===void 0?this.stateZoom:this.$props.zoom},currentZoomLevel(){const o=this.$props.zoomLevels.slice().sort(V).find(r=>r.value===this.currentZoom)||{text:this.currentZoom*100+"%",value:this.currentZoom,id:this.currentZoom,locationString:""};return o.locationString?{...o,text:this.localize(o.locationString)}:o},currentDir(){return this.$props.dir!==void 0?this.$props.dir:this.currentRtl?"rtl":"ltr"}},watch:{url(){this.loadDocument()},data(){this.loadDocument()},arrayBuffer(){this.loadDocument()},currentZoom(e,t){this.setScaleFactor(e),this._pagesEl&&this._document&&e!==this._zoom&&this.reload(this._document,e,this.skip)}},mounted(){this.currentRtl=l.isRtl(this._pdfViewerEl),this.loadDocument()},updated(){this.currentRtl=l.isRtl(this._pdfViewerEl)},beforeUnmount(){this._scroller&&this._scroller.destroy(),this._search&&this._search.destroy(),this._document=null,this._pages=[]},methods:{localize(e){const t=this.kendoLocalizationService;return t?t.toLanguageString(e,a.messages[e]):a.messages[e]},getTarget(){return{element:this._pdfViewerEl,props:this.$props,document:this._document,pages:this._pages}},setScaleFactor(e){this._pagesEl&&this._pagesEl.style.setProperty("--scale-factor",String(e))},loadDocument(){if(this._pagesEl)if(this.$props.url||this.$props.data||this.$props.arrayBuffer){this.loading=!0,i.removeChildren(this._pagesEl);const e=this._pagesEl;setTimeout(()=>{i.loadPDF({url:this.$props.url,data:this.$props.data,arrayBuffer:this.$props.arrayBuffer,dom:e,zoom:this.currentZoom,done:this.onDone,error:this.onError}),this.setScaleFactor(this.currentZoom)})}else this._document=null,this._pages=[],this.hasDocument=!1,this.loading=!1,i.removeChildren(this._pagesEl)},onDone({pdfPages:e,pdfDoc:t,zoom:o}){this._document=t,this._pages=e,this._zoom=o,this.initScroller(),this.loading=!1,this.hasDocument=!0,this.triggerOnLoad(),this._pagesEl&&i.scrollToPage(this._pagesEl,0)},onError(e){this._document=null,this._pages=[],this.loading=!1,this.hasDocument=!1;const t=typeof e=="string"?{message:e}:e,o={error:t!=null?t:this.localize(a.popupBlocked),target:this.getTarget()};this.$emit("error",o)},triggerOnLoad(){const e={target:this.getTarget()};this.$emit("load",e)},triggerOnDownload(e,t,o){const r={target:this.getTarget(),blob:e,fileName:t,saveOptions:o};return this.$emit("download",r),!1},initScroller(){var e;this._scroller&&this._scroller.destroy(),this._scroller=new i.Scroller((e=this._pagesEl)==null?void 0:e.parentNode,{filter:".k-page",events:{}}),this._scroller.disablePanEventsTracking()},initSearch(e){const t=Array.from(e.querySelectorAll(".k-text-layer"));this._search=new i.SearchService({textContainers:t||[],highlightClass:"k-search-highlight",highlightMarkClass:"k-search-highlight-mark",charClass:"k-text-char"})},reload(e,t,o){this._pagesEl&&this._pdfViewerEl&&(this.loading=!0,i.removeChildren(this._pagesEl),i.reloadDocument({pdfDoc:e,zoom:t,dom:this._pagesEl,done:r=>{this._pages=r,this._zoom=t,this.loading=!1,this._pagesEl&&o>0&&i.scrollToPage(this._pagesEl,o)},error:this.onError}))},onSearchClick(){this.showSearch=!0,this.initSearch(this._pagesEl)},onSearchTextChange(e){const t=e.value,o=this._search.search({text:t,matchCase:this.matchCase});this.currentMatch=o.length?1:0,this.matches=o.length,this.searchText=t},onMatchCaseClick(){const e=this._search.search({text:this.searchText,matchCase:!this.matchCase});this.currentMatch=e.length?1:0,this.matches=e.length,this.matchCase=!this.matchCase},onNextMatch(){i.goToNextSearchMatch({search:this._search,scroller:this._scroller}),this.currentMatch=this.currentMatch+1>this.matches?1:this.currentMatch+1},onPrevMatch(){i.goToPreviousSearchMatch({search:this._search,scroller:this._scroller}),this.currentMatch=this.currentMatch-1<1?this.matches:this.currentMatch-1},onClose(){this._search.destroy(),this.currentMatch=0,this.matches=0,this.matchCase=!1,this.searchText="",this.showSearch=!1},onTextBoxKeyDown(e){e.key==="Enter"?(e.preventDefault(),i.goToNextSearchMatch({search:this._search,scroller:this._scroller}),this.currentMatch=this.currentMatch+1>this.matches?1:this.currentMatch+1):e.key==="Escape"&&this.onClose()},onPageChange(e){if(this._pagesEl){const t=e.skip;i.scrollToPage(this._pagesEl,t);const o={page:t+1,target:this.getTarget()};this.$emit("pagechange",o)}this.skip=e.skip},onScroll(e){if(this._pdfViewerEl){const t=i.currentPage(this._pdfViewerEl);if(t!==this.skip){this.skip=t;const o={page:t+1,target:this.getTarget()};this.$emit("pagechange",o)}}},onZoomIn(e){const t=Math.min(this.currentZoom+this.$props.zoomRate,this.$props.maxZoom);if(t!==this.currentZoom&&this._document){this.stateZoom=t;const o={zoom:t,target:this.getTarget()};this.$emit("zoom",o)}},onZoomOut(e){const t=Math.max(this.currentZoom-this.$props.zoomRate,this.$props.minZoom);if(t!==this.currentZoom&&this._document){this.stateZoom=t;const o={zoom:t,target:this.getTarget()};this.$emit("zoom",o)}},onZoomLevelChange(e){const t=e.value===null?{text:"100%",value:1}:{...e.value};if(t.value===void 0){const r=Number.parseFloat(t.text);typeof r=="number"&&!Number.isNaN(r)?t.value=r/100:t.value=1}let o=t?i.calculateZoomLevel(t.value,t.type,this.currentZoom,this._pagesEl):1;if(o=Math.round(o*100)/100,this.currentZoom!==o&&this._document){this.stateZoom=o;const r={zoom:o,target:this.getTarget()};this.$emit("zoom",r)}},onTextSelection(){this._scroller.disablePanEventsTracking(),this.enabledSelection=!0},onPinning(){this._scroller.enablePanEventsTracking(),this.enabledSelection=!1},onDownloadClick(){i.download({pdf:this._document,error:this.onError},this.$props.saveFileName,this.$props.saveOptions,this.triggerOnDownload)},onPrintClick(){this.loading=!0;const e=o=>{this.loading=!1,this.onError(o)},t=()=>{this.loading=!1};i.print(this._pages,t,e)},onAdd(e){var o;const t=e.newState;(o=t[0])!=null&&o.getRawFile&&t[0].getRawFile().arrayBuffer().then(p=>{if(this._pagesEl){this.loading=!0,i.removeChildren(this._pagesEl);const h=this.$props.zoom===void 0?this.$props.defaultZoom:this.$props.zoom;i.loadPDF({arrayBuffer:p,dom:this._pagesEl,zoom:h,done:this.onDone,error:this.onError}),this.stateZoom=h}})},onFileOpen(e){const t=e.target;if(t instanceof Element&&t.parentNode){const o=t.closest(".k-toolbar"),r=o==null?void 0:o.querySelector(".k-upload input");r&&r.click()}},renderLoader(){return this.loading?s.createVNode("div",{class:"k-loader-container k-loader-container-md k-loader-top"},[s.createVNode("div",{class:"k-overlay"},null),s.createVNode("div",{class:"k-loader-container-inner "},[s.createVNode(S.Loader,{size:"large"},null)])]):null},renderToolbar(){const e=s.createVNode(z.Pager,{previousNext:!0,type:"input",skip:this.skip,take:1,total:this._pages?this._pages.length:0,info:!1,onPagechange:this.onPageChange},null),t=s.createVNode(n.ToolbarSpacer,null,null),o=s.createVNode(n.ButtonGroup,{class:"k-toolbar-button-group k-button-group-solid"},{default:()=>[s.createVNode(n.Button,{class:"k-group-start",fillMode:"flat",themeColor:"base",title:this.localize(a.zoomOut),disabled:this.currentZoom<=this.$props.minZoom||!this.hasDocument,onClick:this.onZoomOut,icon:"zoom-out",svgIcon:c.zoomOutIcon},null),s.createVNode(n.Button,{class:"k-group-end",fillMode:"flat",themeColor:"base",title:this.localize(a.zoomIn),disabled:this.currentZoom>=this.$props.maxZoom||!this.hasDocument,onClick:this.onZoomIn,icon:"zoom-in",svgIcon:c.zoomInIcon},null)]}),r=s.createVNode(x.ComboBox,{class:"k-toolbar-combobox",disabled:!this.hasDocument,dataItems:this.$props.zoomLevels.map(d=>({...d,text:d.locationString?this.localize(d.locationString):d.text})),dataItemKey:"id",textField:"text",value:this.hasDocument?this.currentZoomLevel:null,allowCustom:!0,onChange:this.onZoomLevelChange,placeholder:this.localize(a.zoomLevel)},null),p=s.createVNode(n.ButtonGroup,{class:"k-toolbar-button-group k-button-group-solid"},{default:()=>[s.createVNode(n.Button,{class:"k-group-start",fillMode:"flat",themeColor:"base",title:this.localize(a.enableSelection),icon:"pointer",svgIcon:c.pointerIcon,disabled:!this.hasDocument,togglable:!0,selected:this.enabledSelection&&this.hasDocument,onClick:this.onTextSelection},null),s.createVNode(n.Button,{class:"k-group-end",fillMode:"flat",themeColor:"base",title:this.localize(a.enablePanning),icon:"hand",svgIcon:c.handIcon,disabled:!this.hasDocument,togglable:!0,selected:!this.enabledSelection&&this.hasDocument,onClick:this.onPinning},null)]}),h=s.createVNode(n.Button,{class:"k-toolbar-button",fillMode:"flat",themeColor:"base",title:this.localize(a.search),icon:"search",svgIcon:c.searchIcon,disabled:!this.hasDocument,onClick:this.onSearchClick,"aria-haspopup":"dialog"},null),m=s.createVNode("span",null,[s.createVNode(n.Button,{class:"k-toolbar-button",fillMode:"flat",themeColor:"base",title:this.localize(a.open),icon:"folder-open",svgIcon:c.folderOpenIcon,onClick:this.onFileOpen},null),s.createVNode("div",{style:{display:"none"}},[s.createVNode(C.Upload,{restrictions:{allowedExtensions:[".pdf"]},onAdd:this.onAdd,autoUpload:!1,defaultFiles:[],multiple:!1,accept:".pdf,.PDF",withCredentials:!1},null)])]),g=s.createVNode(n.Button,{class:"k-toolbar-button",fillMode:"flat",themeColor:"base",title:this.localize(a.download),icon:"download",svgIcon:c.downloadIcon,disabled:!this.hasDocument,onClick:this.onDownloadClick},null),f=s.createVNode(n.Button,{class:"k-toolbar-button",fillMode:"flat",themeColor:"base",title:this.localize(a.print),icon:"print",svgIcon:c.printIcon,disabled:!this.hasDocument,onClick:this.onPrintClick},null),v={pager:e,spacer:t,zoomInOut:o,zoom:r,selection:p,search:h,open:m,download:g,print:f},k=(this.$props.tools||u.tools).map(d=>v[d]);return s.createVNode(n.Toolbar,{buttons:T,overflow:"none",class:"k-pdf-viewer-toolbar",dir:this.currentDir},w(k)?k:{default:()=>[k]})},renderContent(){const e=()=>s.createVNode(s.Fragment,null,[s.createVNode(_.InputSeparator,null,null),s.createVNode("span",{class:"k-input-suffix"},[s.createVNode(n.Button,{icon:"convert-lowercase",svgIcon:c.convertLowercaseIcon,title:this.localize(a.matchCase),fillMode:"flat",togglable:!0,selected:this.matchCase,onClick:this.onMatchCaseClick},null)])]);return s.createVNode("div",{class:l.classNames("k-canvas k-pdf-viewer-canvas k-pos-relative k-overflow-auto",{"k-enable-text-select":this.enabledSelection,"k-enable-panning":!this.enabledSelection}),tabindex:0,role:"document","aria-label":this.localize(a.canvasAriaLabel),onScroll:this.onScroll},[this.showSearch?s.createVNode("div",{class:"k-search-panel k-pos-sticky k-top-center",role:"dialog","aria-label":this.localize(a.searchPanelAriaLabel)},[s.createVNode(_.TextBox,{value:this.searchText,onInput:this.onSearchTextChange,placeholder:this.localize(a.search),onKeydown:this.onTextBoxKeyDown,suffix:e},null),s.createVNode("span",{class:"k-search-matches"},[s.createVNode("span",null,[this.currentMatch]),s.createTextVNode(" "),this.localize(a.searchOf),s.createVNode("span",null,[this.matches])]),s.createVNode(n.Button,{title:this.localize(a.prevMatch),fillMode:"flat",icon:"arrow-up",svgIcon:c.arrowUpIcon,disabled:this.matches===0,onClick:this.onPrevMatch},null),s.createVNode(n.Button,{title:this.localize(a.nextMatch),fillMode:"flat",icon:"arrow-down",svgIcon:c.arrowDownIcon,disabled:this.matches===0,onClick:this.onNextMatch},null),s.createVNode(n.Button,{title:this.localize(a.close),fillMode:"flat",icon:"x",svgIcon:c.xIcon,onClick:this.onClose},null)]):null,s.createVNode("div",{ref:t=>{this._pagesEl=t},class:"k-pdf-viewer-pages"},null)])}},render(){const e=this.renderLoader(),t=this.renderToolbar(),o=this.renderContent(),r=l.templateRendering.call(this,this.$props.toolbar,l.getListeners.call(this)),p=l.templateRendering.call(this,this.$props.content,l.getListeners.call(this)),h=l.templateRendering.call(this,this.$props.loader,l.getListeners.call(this)),m=l.getTemplate.call(this,{h:s.h,template:r,defaultRendering:t,additionalProps:{defaultRendering:t}}),g=l.getTemplate.call(this,{h:s.h,template:p,defaultRendering:o,additionalProps:{defaultRendering:o}}),f=l.getTemplate.call(this,{h:s.h,template:h,defaultRendering:e,additionalProps:{defaultRendering:e}});return s.createVNode("div",{class:"k-pdf-viewer",dir:this.$props.dir,ref:v=>{this._pdfViewerEl=v}},[f,m,g,this.showLicenseWatermark?s.createVNode(l.WatermarkOverlay,{message:this._licenseMessage},null):null])}});exports.PDFViewer=E;