1import { AppUtils } from "./AppUtils.js"; 2import { BaseApp } from "./BaseApp.js"; 3import { pdf } from "./Services/PdfService.js"; 4class SplitApp extends BaseApp { 5 pnlFile = this.querySelector(".panel-file"); 6 txtFrom = this.querySelector("#txt-from"); 7 txtTo = this.querySelector("#txt-to"); 8 constructor() { 9 super(); 10 } 11 async processAsync() { 12 const file = this.pnlFile.file; 13 if (!file?.file) { 14 return 1; 15 } 16 const pages = this.pageInput; 17 if (!pages) { 18 return 3; 19 } 20 const fileArr = await file.file.arrayBuffer(); 21 this.currLocalResult = await pdf.splitFilesAsync(fileArr, pages); 22 const [name,] = AppUtils.getFileNameParts(file.name); 23 this.currLocalResultName = name + "-splitted.pdf"; 24 return this.currLocalResult ? 4 : 3; 25 } 26 get pageInput() { 27 this.txtFrom.disabled = false; 28 this.txtTo.disabled = false; 29 if (!this.txtFrom.reportValidity()) { 30 return; 31 } 32 if (!this.txtTo.reportValidity()) { 33 return; 34 } 35 this.txtFrom.disabled = true; 36 this.txtTo.disabled = true; 37 const from = parseInt(this.txtFrom.value); 38 let to = parseInt(this.txtTo.value); 39 if (from > to) { 40 to = from; 41 this.txtTo.value = to.toString(); 42 } 43 const result = []; 44 for (let i = from - 1; i < to; i++) { 45 result.push(i); 46 } 47 return result; 48 } 49 static register() { 50 BaseApp.register(); 51 customElements.define("split-app", this); 52 } 53} 54SplitApp.register(); 55//# sourceMappingURL=SplitApp.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.