@pdftron/pdfjs-express 8.6.0 → 8.7.0
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/package.json +1 -1
- package/public/core/22.chunk.js +7 -7
- package/public/core/23.chunk.js +7 -7
- package/public/core/AndroidContentPartRetriever.chunk.js +2 -2
- package/public/core/ArrayBufferPdfPartRetriever.chunk.js +1 -1
- package/public/core/AzurePartRetriever.chunk.js +2 -2
- package/public/core/ContentEdit.chunk.js +28 -28
- package/public/core/ExternalAnnotationMerger.chunk.js +13 -14
- package/public/core/ExternalPdfPartRetriever.chunk.js +6 -6
- package/public/core/HttpPartRetriever.chunk.js +12 -12
- package/public/core/IOSPartRetriever.chunk.js +2 -2
- package/public/core/LocalPartRetriever.chunk.js +4 -4
- package/public/core/LocalPdfPartRetriever.chunk.js +3 -3
- package/public/core/PDFInfoVersion1.chunk.js +16 -16
- package/public/core/SelectionInfoOld.chunk.js +14 -14
- package/public/core/StreamingPartRetriever.chunk.js +9 -9
- package/public/core/WebDBPartRetriever.chunk.js +2 -2
- package/public/core/WebViewerServerPartRetriever.chunk.js +41 -38
- package/public/core/WinRTPartRetriever.chunk.js +2 -3
- package/public/core/pdfjs/PDFJSDocumentType.js +154 -151
- package/public/core/pikaday.chunk.js +33 -33
- package/public/core/vendors.ascii85.chunk.js +6 -6
- package/public/core/vendors.ascii85.quill.chunk.js +34 -34
- package/public/core/vendors.pako.chunk.js +80 -80
- package/public/core/vendors.quill.chunk.js +394 -394
- package/public/core/webviewer-core.min.js +2793 -2758
- package/public/ui/chunks/10.chunk.js +1 -1
- package/public/ui/chunks/100.chunk.js +1 -1
- package/public/ui/chunks/101.chunk.js +1 -1
- package/public/ui/chunks/102.chunk.js +1 -1
- package/public/ui/chunks/103.chunk.js +1 -1
- package/public/ui/chunks/104.chunk.js +1 -1
- package/public/ui/chunks/105.chunk.js +1 -1
- package/public/ui/chunks/106.chunk.js +1 -1
- package/public/ui/chunks/107.chunk.js +1 -1
- package/public/ui/chunks/108.chunk.js +1 -1
- package/public/ui/chunks/109.chunk.js +1 -1
- package/public/ui/chunks/11.chunk.js +1 -1
- package/public/ui/chunks/110.chunk.js +1 -1
- package/public/ui/chunks/111.chunk.js +1 -1
- package/public/ui/chunks/112.chunk.js +1 -1
- package/public/ui/chunks/113.chunk.js +1 -1
- package/public/ui/chunks/114.chunk.js +1 -1
- package/public/ui/chunks/115.chunk.js +1 -1
- package/public/ui/chunks/116.chunk.js +1 -1
- package/public/ui/chunks/117.chunk.js +1 -1
- package/public/ui/chunks/118.chunk.js +1 -1
- package/public/ui/chunks/119.chunk.js +1 -1
- package/public/ui/chunks/12.chunk.js +1 -1
- package/public/ui/chunks/120.chunk.js +1 -1
- package/public/ui/chunks/121.chunk.js +1 -1
- package/public/ui/chunks/122.chunk.js +1 -1
- package/public/ui/chunks/123.chunk.js +1 -1
- package/public/ui/chunks/124.chunk.js +1 -1
- package/public/ui/chunks/125.chunk.js +1 -1
- package/public/ui/chunks/126.chunk.js +1 -1
- package/public/ui/chunks/127.chunk.js +1 -1
- package/public/ui/chunks/128.chunk.js +1 -1
- package/public/ui/chunks/129.chunk.js +1 -1
- package/public/ui/chunks/13.chunk.js +1 -1
- package/public/ui/chunks/130.chunk.js +1 -1
- package/public/ui/chunks/131.chunk.js +1 -1
- package/public/ui/chunks/132.chunk.js +1 -1
- package/public/ui/chunks/133.chunk.js +1 -1
- package/public/ui/chunks/134.chunk.js +1 -1
- package/public/ui/chunks/135.chunk.js +1 -1
- package/public/ui/chunks/136.chunk.js +1 -1
- package/public/ui/chunks/137.chunk.js +1 -1
- package/public/ui/chunks/138.chunk.js +1 -1
- package/public/ui/chunks/139.chunk.js +1 -1
- package/public/ui/chunks/14.chunk.js +1 -1
- package/public/ui/chunks/140.chunk.js +1 -1
- package/public/ui/chunks/141.chunk.js +1 -1
- package/public/ui/chunks/142.chunk.js +1 -1
- package/public/ui/chunks/143.chunk.js +1 -1
- package/public/ui/chunks/144.chunk.js +1 -1
- package/public/ui/chunks/145.chunk.js +1 -1
- package/public/ui/chunks/15.chunk.js +1 -1
- package/public/ui/chunks/16.chunk.js +1 -1
- package/public/ui/chunks/17.chunk.js +1 -1
- package/public/ui/chunks/18.chunk.js +1 -1
- package/public/ui/chunks/19.chunk.js +1 -1
- package/public/ui/chunks/2.chunk.js +1 -1
- package/public/ui/chunks/20.chunk.js +1 -1
- package/public/ui/chunks/21.chunk.js +1 -1
- package/public/ui/chunks/22.chunk.js +1 -1
- package/public/ui/chunks/23.chunk.js +1 -1
- package/public/ui/chunks/24.chunk.js +1 -1
- package/public/ui/chunks/25.chunk.js +1 -1
- package/public/ui/chunks/26.chunk.js +1 -1
- package/public/ui/chunks/27.chunk.js +1 -1
- package/public/ui/chunks/28.chunk.js +1 -1
- package/public/ui/chunks/29.chunk.js +1 -1
- package/public/ui/chunks/3.chunk.js +1 -1
- package/public/ui/chunks/30.chunk.js +1 -1
- package/public/ui/chunks/31.chunk.js +1 -1
- package/public/ui/chunks/32.chunk.js +1 -1
- package/public/ui/chunks/33.chunk.js +1 -1
- package/public/ui/chunks/34.chunk.js +1 -1
- package/public/ui/chunks/35.chunk.js +1 -1
- package/public/ui/chunks/36.chunk.js +1 -1
- package/public/ui/chunks/37.chunk.js +1 -1
- package/public/ui/chunks/38.chunk.js +1 -1
- package/public/ui/chunks/39.chunk.js +1 -1
- package/public/ui/chunks/4.chunk.js +1 -1
- package/public/ui/chunks/40.chunk.js +1 -1
- package/public/ui/chunks/41.chunk.js +1 -1
- package/public/ui/chunks/42.chunk.js +1 -1
- package/public/ui/chunks/43.chunk.js +1 -1
- package/public/ui/chunks/44.chunk.js +1 -1
- package/public/ui/chunks/45.chunk.js +1 -1
- package/public/ui/chunks/46.chunk.js +1 -1
- package/public/ui/chunks/47.chunk.js +1 -1
- package/public/ui/chunks/48.chunk.js +1 -1
- package/public/ui/chunks/49.chunk.js +1 -1
- package/public/ui/chunks/5.chunk.js +1 -1
- package/public/ui/chunks/50.chunk.js +1 -1
- package/public/ui/chunks/51.chunk.js +1 -1
- package/public/ui/chunks/52.chunk.js +1 -1
- package/public/ui/chunks/53.chunk.js +1 -1
- package/public/ui/chunks/54.chunk.js +1 -1
- package/public/ui/chunks/55.chunk.js +1 -1
- package/public/ui/chunks/56.chunk.js +1 -1
- package/public/ui/chunks/57.chunk.js +1 -1
- package/public/ui/chunks/58.chunk.js +1 -1
- package/public/ui/chunks/59.chunk.js +1 -1
- package/public/ui/chunks/6.chunk.js +1 -1
- package/public/ui/chunks/60.chunk.js +1 -1
- package/public/ui/chunks/61.chunk.js +1 -1
- package/public/ui/chunks/62.chunk.js +1 -1
- package/public/ui/chunks/63.chunk.js +1 -1
- package/public/ui/chunks/64.chunk.js +1 -1
- package/public/ui/chunks/65.chunk.js +1 -1
- package/public/ui/chunks/66.chunk.js +1 -1
- package/public/ui/chunks/67.chunk.js +1 -1
- package/public/ui/chunks/68.chunk.js +1 -1
- package/public/ui/chunks/69.chunk.js +1 -1
- package/public/ui/chunks/7.chunk.js +1 -1
- package/public/ui/chunks/70.chunk.js +1 -1
- package/public/ui/chunks/71.chunk.js +1 -1
- package/public/ui/chunks/72.chunk.js +1 -1
- package/public/ui/chunks/73.chunk.js +1 -1
- package/public/ui/chunks/74.chunk.js +1 -1
- package/public/ui/chunks/75.chunk.js +1 -1
- package/public/ui/chunks/76.chunk.js +1 -1
- package/public/ui/chunks/77.chunk.js +1 -1
- package/public/ui/chunks/78.chunk.js +1 -1
- package/public/ui/chunks/79.chunk.js +1 -1
- package/public/ui/chunks/8.chunk.js +1 -1
- package/public/ui/chunks/80.chunk.js +1 -1
- package/public/ui/chunks/81.chunk.js +1 -1
- package/public/ui/chunks/82.chunk.js +1 -1
- package/public/ui/chunks/83.chunk.js +1 -1
- package/public/ui/chunks/84.chunk.js +1 -1
- package/public/ui/chunks/85.chunk.js +1 -1
- package/public/ui/chunks/86.chunk.js +1 -1
- package/public/ui/chunks/87.chunk.js +1 -1
- package/public/ui/chunks/88.chunk.js +1 -1
- package/public/ui/chunks/89.chunk.js +1 -1
- package/public/ui/chunks/9.chunk.js +1 -1
- package/public/ui/chunks/90.chunk.js +1 -1
- package/public/ui/chunks/91.chunk.js +1 -1
- package/public/ui/chunks/92.chunk.js +1 -1
- package/public/ui/chunks/93.chunk.js +1 -1
- package/public/ui/chunks/94.chunk.js +1 -1
- package/public/ui/chunks/95.chunk.js +1 -1
- package/public/ui/chunks/96.chunk.js +1 -1
- package/public/ui/chunks/97.chunk.js +1 -1
- package/public/ui/chunks/98.chunk.js +1 -1
- package/public/ui/chunks/99.chunk.js +1 -1
- package/public/ui/chunks/vendors.html2canvas.chunk.js +1 -1
- package/public/ui/i18n/translation-bn.json +50 -14
- package/public/ui/i18n/translation-de.json +51 -15
- package/public/ui/i18n/translation-el.json +50 -14
- package/public/ui/i18n/translation-en.json +33 -40
- package/public/ui/i18n/translation-es.json +49 -13
- package/public/ui/i18n/translation-fr.json +49 -13
- package/public/ui/i18n/translation-hi.json +51 -15
- package/public/ui/i18n/translation-id.json +50 -14
- package/public/ui/i18n/translation-it.json +49 -13
- package/public/ui/i18n/translation-ja.json +51 -15
- package/public/ui/i18n/translation-ko.json +52 -24
- package/public/ui/i18n/translation-ms.json +50 -14
- package/public/ui/i18n/translation-nl.json +51 -15
- package/public/ui/i18n/translation-pt_br.json +50 -14
- package/public/ui/i18n/translation-ru.json +49 -13
- package/public/ui/i18n/translation-tr.json +49 -13
- package/public/ui/i18n/translation-uk.json +50 -14
- package/public/ui/i18n/translation-vi.json +51 -15
- package/public/ui/i18n/translation-zh_cn.json +50 -14
- package/public/ui/i18n/translation-zh_tw.json +50 -14
- package/public/ui/style.css +25 -19
- package/public/ui/style.css.map +1 -1
- package/public/ui/webviewer-ui.min.js +15 -15
- package/public/ui/webviewer-ui.min.js.map +1 -1
- package/webviewer.min.js +1 -1
|
@@ -603,20 +603,22 @@ return styleStr},rcElement=document.createElementNS("","contents-richtext"),body
|
|
|
603
603
|
textStyleLocations[i+1]);i=document.createElementNS("","span");cssStyle=serializeStyle(cssStyle);i.textContent=location;cssStyle&&i.setAttribute("style",cssStyle);rootElement.appendChild(i)});body.appendChild(rootElement);rcElement.appendChild(body);return rcElement},deserializeRichText:function(rcElement){var parseStyle=function(styleStr){var result={};if(!styleStr)return result;styleStr.split(";").forEach(function(style){style=style.split(":");result[style[0]]=style[1]});return result},extractNodes=
|
|
604
604
|
function(rootEle){var result=[];if(!rootEle)return result;rootEle.childNodes.forEach(function(node){node.nodeType===Node.TEXT_NODE||1===node.childNodes.length&&node.childNodes[0].nodeType===Node.TEXT_NODE?result.push(node):result=Object(tslib__WEBPACK_IMPORTED_MODULE_0__.d)(result,extractNodes(node))});return result},body=rcElement.querySelector("body");rcElement=rcElement.textContent;var style$jscomp$0=null,globalStyle=null;if(body){var location_1=0;globalStyle=parseStyle(body.getAttribute("style"));
|
|
605
605
|
style$jscomp$0={};style$jscomp$0[location_1]=globalStyle;body=extractNodes(body);body.length&&body.forEach(function(node){style$jscomp$0[location_1]=node.getAttribute?Object(tslib__WEBPACK_IMPORTED_MODULE_0__.a)(Object(tslib__WEBPACK_IMPORTED_MODULE_0__.a)({},globalStyle),parseStyle(node.getAttribute("style"))):Object(tslib__WEBPACK_IMPORTED_MODULE_0__.a)({},globalStyle);location_1+=node.textContent.length})}return{style:style$jscomp$0,globalStyle:globalStyle,contents:rcElement}},prepareLinksForInsertion:function(xfdfString,
|
|
606
|
-
pageNumber){var _a,xfdfDoc=(new DOMParser).parseFromString(xfdfString,"text/xml"),annotElements=null===(_a=xfdfDoc.querySelector("annots"))||void 0===_a?void 0:_a.children;if(!annotElements)return xfdfString;for(xfdfString=annotElements.length-1;0<=xfdfString;xfdfString--)_a=annotElements[xfdfString],"link"!==_a.tagName.toLowerCase()?_a.remove():_a.setAttribute("page",""+(pageNumber-1));return(new XMLSerializer).serializeToString(xfdfDoc)}
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
"
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
606
|
+
pageNumber){var _a,xfdfDoc=(new DOMParser).parseFromString(xfdfString,"text/xml"),annotElements=null===(_a=xfdfDoc.querySelector("annots"))||void 0===_a?void 0:_a.children;if(!annotElements)return xfdfString;for(xfdfString=annotElements.length-1;0<=xfdfString;xfdfString--)_a=annotElements[xfdfString],"link"!==_a.tagName.toLowerCase()?_a.remove():_a.setAttribute("page",""+(pageNumber-1));return(new XMLSerializer).serializeToString(xfdfDoc)},serializeMeasurementCaptionOptions:function(measurementCaptionOptions,
|
|
607
|
+
pageMatrix){pageMatrix=serializeRect(measurementCaptionOptions.captionRect,pageMatrix);measurementCaptionOptions=JSON.parse(JSON.stringify(measurementCaptionOptions));measurementCaptionOptions.captionRect=pageMatrix;return JSON.stringify(measurementCaptionOptions)},deserializeMeasurementCaptionOptions:function(optionString,pageMatrix){optionString=JSON.parse(optionString);pageMatrix=deserializeRect(optionString.captionRect,pageMatrix);optionString.captionRect=pageMatrix;return optionString}}},function(module,
|
|
608
|
+
__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,"a",function(){return ASM});__webpack_require__.d(__webpack_exports__,"d",function(){return WASM});__webpack_require__.d(__webpack_exports__,"b",function(){return JS_WORKER});__webpack_require__.d(__webpack_exports__,"c",function(){return THREADED_WASM});var ASM="asm",WASM="ems",JS_WORKER="jsworker",THREADED_WASM="wasm-threads"},function(module,exports,__webpack_require__){function Duplex(options){if(!(this instanceof
|
|
609
|
+
Duplex))return new Duplex(options);Readable.call(this,options);Writable.call(this,options);options&&!1===options.readable&&(this.readable=!1);options&&!1===options.writable&&(this.writable=!1);this.allowHalfOpen=!0;options&&!1===options.allowHalfOpen&&(this.allowHalfOpen=!1);this.once("end",onend)}function onend(){this.allowHalfOpen||this._writableState.ended||pna.nextTick(onEndNT,this)}function onEndNT(self){self.end()}var pna=__webpack_require__(48);exports=Object.keys||function(obj){var keys=[],
|
|
610
|
+
key;for(key in obj)keys.push(key);return keys};module.exports=Duplex;module=Object.create(__webpack_require__(42));module.inherits=__webpack_require__(28);var Readable=__webpack_require__(67),Writable=__webpack_require__(61);module.inherits(Duplex,Readable);__webpack_require__=exports(Writable.prototype);for(module=0;module<__webpack_require__.length;module++)exports=__webpack_require__[module],Duplex.prototype[exports]||(Duplex.prototype[exports]=Writable.prototype[exports]);Object.defineProperty(Duplex.prototype,
|
|
611
|
+
"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});Object.defineProperty(Duplex.prototype,"destroyed",{get:function(){return void 0===this._readableState||void 0===this._writableState?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(value){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=value,this._writableState.destroyed=value)}});Duplex.prototype._destroy=function(err,cb){this.push(null);
|
|
612
|
+
this.end();pna.nextTick(cb,err)}},function(module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,"AnnotationManagerEvents",function(){return AnnotationManagerEvents});__webpack_require__.d(__webpack_exports__,"AnnotationManagerPrivateEvents",function(){return AnnotationManagerPrivateEvents});__webpack_require__.d(__webpack_exports__,"DocumentViewerEvents",function(){return DocumentViewerEvents});__webpack_require__.d(__webpack_exports__,
|
|
613
|
+
"DocumentViewerPrivateEvents",function(){return DocumentViewerPrivateEvents});__webpack_require__.d(__webpack_exports__,"ContentEditEvents",function(){return ContentEditEvents});__webpack_require__.d(__webpack_exports__,"MeasurementManagerEvents",function(){return MeasurementManagerEvents});__webpack_require__.d(__webpack_exports__,"AnnotationChangedActions",function(){return AnnotationChangedActions});var AnnotationManagerEvents={ANNOTATION_SELECTED:"annotationSelected",ANNOTATION_DESELECTED:"annotationDeselected",
|
|
614
|
+
ANNOTATION_DOUBLE_CLICKED:"annotationDoubleClicked",ANNOTATION_CHANGED:"annotationChanged",UPDATE_ANNOTATION_PERMISSION:"updateAnnotationPermission",ANNOTATIONS_DRAWN:"annotationsDrawn",ANNOTATION_HIDDEN:"annotationHidden",SET_NOTE_TEXT:"setNoteText",ADD_REPLY:"addReply",DELETE_REPLY:"deleteReply",FIELD_CHANGED:"fieldChanged",FILE_ATTACHMENT_DATA_AVAILABLE:"fileAttachmentDataAvailable"},AnnotationManagerPrivateEvents={ANNOTATION_CHANGED_EDITBOX:"annotationChanged.editbox",ANNOTATION_DOUBLE_CLICKED_EDITBOX:"annotationDoubleClicked.editbox",
|
|
615
|
+
ANNOTATION_SELECTED_CROP_TOOL:"annotationSelected.cropTool",ANNOTATION_CHANGED_CROP_TOOL:"annotationChanged.cropTool"},DocumentViewerEvents={ACTIVE_SEARCH_RESULT_CHANGED:"activeSearchResultChanged",SEARCH_RESULTS_CHANGED:"searchResultsChanged",MOUSE_LEFT_UP:"mouseLeftUp",MOUSE_LEFT_DOWN:"mouseLeftDown",CLICK:"click",TAP:"tap",DBL_CLICK:"dblClick",KEY_DOWN:"keyDown",KEY_UP:"keyUp",MOUSE_ENTER:"mouseEnter",MOUSE_MOVE:"mouseMove",MOUSE_LEAVE:"mouseLeave",MOUSE_RIGHT_DOWN:"mouseRightDown",MOUSE_RIGHT_UP:"mouseRightUp",
|
|
616
|
+
DOCUMENT_UNLOADED:"documentUnloaded",ANNOTATIONS_LOADED:"annotationsLoaded",BEFORE_DOCUMENT_LOADED:"beforeDocumentLoaded",DOCUMENT_LOADED:"documentLoaded",DISPLAY_PAGE_LOCATION:"displayPageLocation",NOTIFY:"notify",SEARCH_IN_PROGRESS:"searchInProgress",TEXT_SELECTED:"textSelected",TOOL_MODE_UPDATED:"toolModeUpdated",FIT_MODE_UPDATED:"fitModeUpdated",ROTATION_UPDATED:"rotationUpdated",ZOOM_UPDATED:"zoomUpdated",PAGE_NUMBER_UPDATED:"pageNumberUpdated",PAGES_UPDATED:"pagesUpdated",PAGE_COMPLETE:"pageComplete",
|
|
617
|
+
DISPLAY_MODE_UPDATED:"displayModeUpdated",BEGIN_RENDERING:"beginRendering",FINISHED_RENDERING:"finishedRendering",CLIENT_SIDE_DOCUMENT_LOADED:"clientSideDocumentLoaded",TOOL_UPDATED:"toolUpdated",EMBEDDED_THUMBNAIL_COMPLETE:"embeddedThumbnailComplete",READ_ONLY_MODE_CHANGED:"readOnlyModeChanged"},DocumentViewerPrivateEvents={ANNOTATIONS_LOADED_INTERNAL:"annotationsLoaded.internal",DOCUMENT_READY_ANNOTS_LOADED:"documentReady.annotsLoaded",PAUSE:"PAUSE",RESUME:"RESUME",END_OF_DOCUMENT_RESULT:"endOfDocumentResult",
|
|
618
|
+
CONTENT_REMOVED_ANNOT_MANAGER:"contentRemoved.annotManager",MOUSE_MOVE_HOVER:"mouseMove.hover",BACKEND_SWITCH:"backendSwitch",PAGE_PROGRESSIVE_UPDATE:"pageProgressiveUpdate",ROTATION_UPDATED_TEXT_TOOL:"rotationUpdated.textTool",VISIBLE_PAGES_CHANGED:"visiblePagesChanged",DOCUMENT_READY:"documentReady",BOOKMARKS_UPDATED:"bookmarksUpdated",CONTENT_REMOVED:"contentRemoved"},ContentEditEvents={TEXT_CONTENT_UPDATED:"textContentUpdated",EDIT_BOXES_AVAILABLE:"editBoxesAvailable"},MeasurementManagerEvents=
|
|
619
|
+
{SCALE_UPDATED:"scaleUpdated"},AnnotationChangedActions={ADD:"add",DELETE:"delete",MODIFY:"modify"}},function(module,__webpack_exports__,__webpack_require__){module=function(){return function(_found_str,_found_start_itr,_found_end_itr,_ambient,_result_str_start,_result_str_end){this._found_str=_found_str;this._found_start_itr=_found_start_itr;this._found_end_itr=_found_end_itr;this._ambient=_ambient;this._result_str_start=_result_str_start;this._result_str_end=_result_str_end;this._found_str=_found_str;
|
|
620
|
+
this._found_start_itr=_found_start_itr||0;this._found_end_itr=_found_end_itr||0;this._ambient=_ambient;this._result_str_start=_result_str_start||0;this._result_str_end=_result_str_end||0}}();__webpack_exports__.a=module},function(module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,"a",function(){return XODText_TextSearchLowlevelReEscape});var XODText_TextSearchLowlevelReEscape=RegExp("[-[\\]{}()*+?.,\\\\^$|#\\s]","g");module=function(){return function(text,options){this.isRegex=
|
|
621
|
+
options&&("r"===options||"w"===options);this.text=(options&&"w"===options?text.replace(/(\*+|.|\n)/g,function(found){if("*"===found.charAt(0)){if(1===found.length)return".*?";var num_asterisks=found.length/2|0;return 1===((found.length|0)&1)?"*".repeat(num_asterisks).replace(XODText_TextSearchLowlevelReEscape,"\\$&")+".*?":"*".repeat(num_asterisks).replace(XODText_TextSearchLowlevelReEscape,"\\$&")}return found.replace(XODText_TextSearchLowlevelReEscape,"\\$&")}):text).replaceAll("\n"," ")}}();__webpack_exports__.b=
|
|
620
622
|
module},function(module,__webpack_exports__,__webpack_require__){var _Matrix2D__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(13);__webpack_require__.d(__webpack_exports__,"a",function(){return _Matrix2D__WEBPACK_IMPORTED_MODULE_0__.a});var _Point2D__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(19);__webpack_require__.d(__webpack_exports__,"b",function(){return _Point2D__WEBPACK_IMPORTED_MODULE_1__.a});__webpack_require__(12);__webpack_require__(43);__webpack_require__(38);__webpack_require__(54);
|
|
621
623
|
__webpack_require__(44);__webpack_require__(7);__webpack_require__(16);__webpack_require__(81);__webpack_require__(82);__webpack_require__(83);__webpack_require__(21);__webpack_require__(45);__webpack_require__(55);__webpack_require__(34);__webpack_require__(35);module=__webpack_require__(86);__webpack_require__.n(module)},function(module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,"b",function(){return isNullOrEmpty});__webpack_require__.d(__webpack_exports__,
|
|
622
624
|
"a",function(){return insertString});var isNullOrEmpty=function(s){return!s||!s.length},insertString=function(s,index,value){if(!value)return s;if(!index)return value+s;var s1=s.substr(0,index);s=s.substr(index);return s1+value+s}},function(module,__webpack_exports__,__webpack_require__){module=function(){function Highlight(){this._length=this._position=this._page_num=0}Highlight.prototype._initDefault=function(){this._length=this._position=this._page_num=0};Highlight.prototype._initMembers=function(pg,
|
|
@@ -1924,144 +1926,145 @@ this._m_BufRegByHyphenPos.sort(highlight_on);this._m_SrcHyphenPos.sort(highlight
|
|
|
1924
1926
|
_e)};TextSearchLowLevel.prototype._continousInPDF=function(offset,start,end){Object(logger__WEBPACK_IMPORTED_MODULE_1__.a)(0<=start&&start<=end&&start<offset.length&&end<offset.length);start=offset[start];offset=offset[end];if(start===offset||start+1===offset)return!0;for(end=!0;0<=start&&start<offset-1;)if(!this._m_OffsetMissing[++start]){end=!1;break}return end};return TextSearchLowLevel})()},function(module,__webpack_exports__,__webpack_require__){function createPageEndEvent(pageNumber){return{ambientStr:"",
|
|
1925
1927
|
resultStr:"",resultStrStart:-1,resultStrEnd:-1,pageNum:pageNumber,resultCode:_ResultCode__WEBPACK_IMPORTED_MODULE_2__.a.PAGE,quads:[],ambient_str:"",result_str:"",result_str_start:-1,result_str_end:-1,page_num:pageNumber}}var tslib__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(3),_SearchMode__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(7),_ResultCode__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(16),_Quad__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(12),_namespaces_Core_Workers_BackendType__WEBPACK_IMPORTED_MODULE_4__=
|
|
1926
1928
|
__webpack_require__(102),_constants_events__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(33);(function(){function PDFTextSearch(){var _this=this;this.onSearchCallback=function(){};this.isSearchUpOn=!1;this.currentSearchID=this.currentPage=0;this.searchBatchSize=50;this.initialSearchResultForSearchUp=this.initialSearchResultForSearchDown=this.lastSearch=null;Object(_namespaces_Core_Workers_BackendType__WEBPACK_IMPORTED_MODULE_4__.a)().then(function(type){_this.isUsingThreadedWorkers="wasm-threads"===
|
|
1927
|
-
type})}PDFTextSearch.prototype.cancelSearch=function(){this.currentSearchID++};PDFTextSearch.prototype.shouldStopSearching=function(searchID){return searchID!==this.currentSearchID};PDFTextSearch.prototype.resultCallBack=function(results,searchID){var _this=this;results.forEach(function(result){var _a;if(!_this.shouldStopSearching(searchID)){_this.resultFound=!0;for(_this.doc.getDocumentViewer().viewerPageManager.setPageSelectedText(result.page_num-1,result.out_str);!_this.isSearchUpOn&&_this.currentPage<
|
|
1929
|
+
type})}PDFTextSearch.prototype.cancelSearch=function(){this.currentSearchID++};PDFTextSearch.prototype.shouldStopSearching=function(searchID){return searchID!==this.currentSearchID};PDFTextSearch.prototype.resultCallBack=function(results,searchID){var _this=this;results.forEach(function(result){var _a,_b,_c;if(!_this.shouldStopSearching(searchID)){_this.resultFound=!0;for(_this.doc.getDocumentViewer().viewerPageManager.setPageSelectedText(result.page_num-1,result.out_str);!_this.isSearchUpOn&&_this.currentPage<
|
|
1928
1930
|
result.page_num||_this.isSearchUpOn&&_this.currentPage>result.page_num;)_this.onSearchCallback(createPageEndEvent(_this.currentPage)),_this.isSearchUpOn?_this.currentPage--:_this.currentPage++;var pageMatrix=_this.doc.getPages()[result.page_num-1].matrix,quads=[];(null===(_a=result.highlights)||void 0===_a?0:_a.length)&&result.highlights.forEach(function(highlight){highlight.quads.forEach(function(q){pageMatrix.transformQuad(q);var quad=new _Quad__WEBPACK_IMPORTED_MODULE_3__.a;quad.x1=q[0];quad.x2=
|
|
1929
|
-
q[2];quad.x3=q[4];quad.x4=q[6];quad.y1=q[1];quad.y2=q[3];quad.y3=q[5];quad.y4=q[7];quads.push(quad)})});
|
|
1930
|
-
result.ambient_str.indexOf(result.out_str):-1,result_str_end:result.ambient_str?result.ambient_str.indexOf(result.out_str)+result.out_str.length:-1,page_num:result.page_num};_this.onSearchCallback(result)}})};PDFTextSearch.prototype.fireRemainingEvents=
|
|
1931
|
-
this.onSearchCallback({ambientStr:"",resultStr:"",resultStrStart:-1,resultStrEnd:-1,pageNum:0,resultCode:_ResultCode__WEBPACK_IMPORTED_MODULE_2__.a.DONE,quads:[],ambient_str:"",result_str:"",result_str_start:-1,result_str_end:-1,page_num:0})};PDFTextSearch.prototype.searchDown=
|
|
1932
|
-
{
|
|
1933
|
-
currentPage});if(start.length){var nextIndex=this.lastSearch.index+1;this.lastSearch.searchUp&&(nextIndex=start.length-this.lastSearch.index);nextIndex===start.length?(start=results.filter(function(result){return result.page_num>currentPage}),this.lastSearch=currentPage!==end&&start.length?
|
|
1934
|
-
start[
|
|
1935
|
-
end)this.
|
|
1936
|
-
this.lastSearch.index+1;this.lastSearch.searchUp||(nextIndex=end.length-this.lastSearch.index);nextIndex===end.length?(end=results.filter(function(result){return result.page_num<currentPage}),this.lastSearch=
|
|
1937
|
-
end[
|
|
1938
|
-
this.searchEndPage),Promise.resolve(!0);var searchStart=this.isSearchUpOn?Math.max(start,end-this.searchBatchSize):start,searchEnd=this.isSearchUpOn?end:Math.min(start+this.searchBatchSize,end);return this.doc.textSearch(this.searchPattern,
|
|
1939
|
-
Promise.resolve(!0);_this.resultCallBack(results,searchID);var searchNextBatch=function(){return _this.pauseSearch&&!_this.isUsingThreadedWorkers?new Promise(function(resolve){_this.doc.getDocumentViewer().addEventListener(_constants_events__WEBPACK_IMPORTED_MODULE_5__.DocumentViewerEvents.FINISHED_RENDERING,
|
|
1940
|
-
return searchNextBatch()})};PDFTextSearch.prototype.convertMode=function(mode){var newMode=0;newMode=mode&_SearchMode__WEBPACK_IMPORTED_MODULE_1__.a.WILD_CARD|mode&_SearchMode__WEBPACK_IMPORTED_MODULE_1__.a.REGEX?newMode|1:newMode;newMode=mode&_SearchMode__WEBPACK_IMPORTED_MODULE_1__.a.CASE_SENSITIVE?newMode|
|
|
1941
|
-
_SearchMode__WEBPACK_IMPORTED_MODULE_1__.a.PAGE_STOP?newMode|16:newMode;newMode=mode&_SearchMode__WEBPACK_IMPORTED_MODULE_1__.a.HIGHLIGHT?newMode|32:newMode;return newMode=mode&_SearchMode__WEBPACK_IMPORTED_MODULE_1__.a.AMBIENT_STRING?newMode|64:newMode};PDFTextSearch.prototype.setSearchBatchSize=function(searchBatchSize){this.searchBatchSize=
|
|
1942
|
-
this.isSearchUpOn:this.searchStartPage=startPage||1;this.searchEndPage=1===currentPage?doc.getPageCount():currentPage;break;case isMatching&&!this.isSearchUpOn:this.searchStartPage=currentPage===doc.getPageCount()?1:currentPage;this.searchEndPage=endPage||doc.getPageCount();break;case !isMatching:this.searchStartPage=1,this.initialSearchResultForSearchUp=
|
|
1943
|
-
mode,start_page,end_page,onSearchCallback,isFullSearch){var _this=this;this.currentSearchID++;this.resultFound=!1;this.doc&&this.doc!==doc||(doc.getDocumentViewer().addEventListener(_constants_events__WEBPACK_IMPORTED_MODULE_5__.DocumentViewerEvents.BEGIN_RENDERING,function(){_this.pauseSearch=!0}),doc.getDocumentViewer().addEventListener(_constants_events__WEBPACK_IMPORTED_MODULE_5__.DocumentViewerEvents.FINISHED_RENDERING,
|
|
1944
|
-
this.isSearchUpOn=!!(mode&_SearchMode__WEBPACK_IMPORTED_MODULE_1__.a.SEARCH_UP);this.isFullSearch=isFullSearch;this.searchPattern=pattern;mode&_SearchMode__WEBPACK_IMPORTED_MODULE_1__.a.WILD_CARD&&(this.searchPattern=pattern.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replaceAll("**","[TEMPEscape]").replaceAll("*","[A-z]*").replaceAll("[TEMPEscape]","\\*"));this.searchPattern=this.searchPattern.replaceAll("\n","");this.searchMode=
|
|
1945
|
-
this.updateSearchPageInfo(start_page,end_page,doc,pattern===this.lastSearch.out_str):this.updateSearchPageInfo(start_page,end_page,doc,pattern.toLocaleLowerCase()===this.lastSearch.out_str.toLocaleLowerCase()):(this.searchStartPage=start_page||1,this.searchEndPage=doc.getPageCount());this.currentPage=this.isSearchUpOn?this.searchEndPage:this.searchStartPage;return this.searchTillDone(this.searchStartPage,
|
|
1946
|
-
__webpack_require__){var logger__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(0),_selectionInfo_constants__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(14),_Quad__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(12),_Matrix2D__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(13),_TextSelectionBlock__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(44),_Point2D__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(19),
|
|
1947
|
-
__webpack_require__(1),_helpers_arrayHelper__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(4);(function(){function TextLocator(doc){this._m_Str="";this._m_PrePage=-1;this._m_Quads=[];this._m_Texts="";this._m_Pages=doc.getPages();this._m_Words=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.b;this._m_Words.initDefault();this._m_Blocks=[];this._m_Surrtxts=[];this._m_Selidxs=
|
|
1948
|
-
[],i=0;i<sz;++i){var q=new _Quad__WEBPACK_IMPORTED_MODULE_2__.a,pos=8*i;q._setCoordinates(this._m_Quads[pos],this._m_Quads[pos+1],this._m_Quads[pos+2],this._m_Quads[pos+3],this._m_Quads[pos+4],this._m_Quads[pos+5],this._m_Quads[pos+6],this._m_Quads[pos+7]);quads.push(q)}return quads};TextLocator.prototype.getTexts=function(){return this._m_Texts};TextLocator.prototype._isWhitespace=
|
|
1949
|
-
s)?!0:!1};TextLocator.prototype._selectByRect=function(page_number,sel_rect){--page_number;Object(_helpers_arrayHelper__WEBPACK_IMPORTED_MODULE_8__.b)(this._m_Quads);this._m_Texts="";sel_rect.normalize();for(var page_texts=[],all_pages_str="",i,i_1=page_number-1;i_1<page_number+2;i_1++)this._performMiscPageSetup(i_1)&&(page_texts.push({idx:i_1,txt:this._m_Str}),all_pages_str+=this._m_Str);
|
|
1950
|
-
var quad=Array(8),line,lend=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.a;lend.initDefault();var wend=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.e;wend.initDefault();var to_append=[],new_line_start=!1;for(line=this._m_Words.getFirstLine();!line.equal(lend);line=line.getNextLine())if(line.getBBox(i_1),i_1.normalize(),!sel_rect.notIntersect(i_1)){var tmp_selidxs=
|
|
1951
|
-
i_1.setFromQuad(quad),!sel_rect.notIntersect(i_1)){num_chars=i.getStringLen();var str_id=i.getStringPos();-1===first_selected_glyph_index&&(first_selected_glyph_index=str_id);var k=to_append.length;if(0<num_chars&&0<k){new_line_start&&("\n"!==to_append[0]&&(this._isWhitespace(to_append[k-1])?to_append[k-1]="\n":to_append.push("\n")),new_line_start
|
|
1952
|
-
k<this._m_Str.length&&(k<num_chars?this._m_Texts+=this._m_Str.charAt(str_id+k):to_append.push(this._m_Str.charAt(str_id+k)));if(0<num_chars){k=i_1.x2-i_1.x1;var y=i_1.y2-i_1.y1;this._storeQuad(quad,Math.sqrt(k*k+y*y)/num_chars*3)}num_chars=str_id+num_chars}new_line_start=!0;tmp_selidxs[0]=first_selected_glyph_index;for(i=first_selected_glyph_index=
|
|
1953
|
-
page_texts[i].txt.length);tmp_surrtxts[0]=all_pages_str.substring(Math.max(0,first_selected_glyph_index-100),first_selected_glyph_index);if(-1!==num_chars){tmp_selidxs[1]=num_chars;for(i=first_selected_glyph_index=0;i<page_texts.length;i++)if(page_texts[i].idx===page_number){first_selected_glyph_index+=num_chars;break}else page_texts[i].idx<
|
|
1954
|
-
null!==tmp_selidxs[1]&&this._m_Selidxs.push(tmp_selidxs);null!==tmp_surrtxts[0]&&null!==tmp_surrtxts[1]&&this._m_Surrtxts.push(tmp_surrtxts)}return 0<this._m_Quads.length};TextLocator.prototype._cmptTextDirection=function(){var line,lend=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.a;lend.initDefault();var q1=Array(8),q2=Array(8),histogram=
|
|
1955
|
-
wend=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.e;wend.initDefault();var w1=line.getFirstWord(),w2=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.e;w2.initDefault();for(var word=line.getFirstWord();!word.equal(wend);word=word.getNextWord())w2=word;w1.getGlyphQuad(0,q1);g1.x=(q1[0]+q1[2]+q1[4]+
|
|
1956
|
-
g2);g1=Math.floor(2*Math.atan2(g2.y-g1.y,g2.x-g1.x)/Math.PI+.5);0>g1&&(g1+=4);histogram[g1]+=wend}line=0;lend=histogram[0];for(q1=1;4>q1;q1++)histogram[q1]>lend&&(line=q1,lend=histogram[q1]);this._m_Direction=90*line;this._m_Horizontal=2>Math.abs(this._m_Direction)||2>Math.abs(this._m_Direction-
|
|
1957
|
-
all_pages_str="",i;for(i=page_idx-1;i<page_idx+2;i++)this._performMiscPageSetup(i)&&(page_texts.push({idx:i,txt:this._m_Str}),all_pages_str+=this._m_Str);if(0===page_texts.length||0===all_pages_str.length||!this._performMiscPageSetup(page_idx))return!1;var bbox=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.d,
|
|
1958
|
-
[],new_line_start=!1;for(line=this._m_Words.getFirstLine();!line.equal(lend);line=line.getNextLine())if(line.getBBox(bbox),bbox.normalize(),!sel_rect.notIntersect(bbox)){var tmp_selidxs=[null,null],tmp_surrtxts=[null,null],last_selected_glyph_index=-1,first_selected_word_on_line=!0;for(word=line.getFirstWord();!word.equal(wend);word=
|
|
1959
|
-
if(0<num_chars&&0<sz){new_line_start&&("\n"!==to_append[0]&&(this._isWhitespace(to_append[sz-1])?to_append[sz-1]="\n":to_append.push("\n")),new_line_start=!1);for(i=0;i<to_append.length;++i)this._m_Texts+=to_append[i];Object(_helpers_arrayHelper__WEBPACK_IMPORTED_MODULE_8__.b)(to_append)}sz=0;var front_chop=Array(8),back_chop=
|
|
1960
|
-
var ch_bbox=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.d;word.getGlyphQuad(k,i);ch_bbox.setFromQuad(i);if(sel_rect.notIntersect(ch_bbox))0===sz?front_chop_flag=!0:back_chop_flag=!0;else{last_selected_glyph_index=current_glyph_idx_in_pg_txt;sz++;if(1===sz){if(first_selected_word_on_line){tmp_selidxs[0]=current_glyph_idx_in_pg_txt;
|
|
1961
|
-
page_idx&&(first_selected_word_on_line+=page_texts[i].txt.length);tmp_surrtxts[0]=all_pages_str.substring(Math.max(0,first_selected_word_on_line-100),first_selected_word_on_line);first_selected_word_on_line=!1}front_chop_flag&&word.getGlyphQuad(k,front_chop)}word.getGlyphQuad(k,back_chop);k<num_chars?this._m_Texts+=this._m_Str.charAt(current_glyph_idx_in_pg_txt):
|
|
1962
|
-
this._chopQuad(quad,front_chop,!0),back_chop_flag&&this._chopQuad(quad,back_chop,!1),bbox.setFromQuad(quad),num_chars=bbox.x2-bbox.x1,str_id=bbox.y2-bbox.y1,this._storeQuad(quad,Math.sqrt(num_chars*num_chars+str_id*str_id)/sz*3))}new_line_start=!0;if(-1!==last_selected_glyph_index){tmp_selidxs[1]=last_selected_glyph_index;for(i=word=0;i<page_texts.length;i++)if(page_texts[i].idx===
|
|
1963
|
-
all_pages_str.substr(word+1,100)}null!==tmp_selidxs[0]&&null!==tmp_selidxs[1]&&this._m_Selidxs.push(tmp_selidxs);null!==tmp_surrtxts[0]&&null!==tmp_surrtxts[1]&&this._m_Surrtxts.push(tmp_surrtxts)}return 0<this._m_Quads.length};TextLocator.prototype.getRectangularSelectionFromSurroundingTexts=function(input_page_idx,surrounding_text_pairs,text_to_match){for(var quads=[],
|
|
1964
|
-
surrounding_text_pairs[i][0],surrounding_text_pairs[i][1]);if(result.status)-1!==output_page_idx||void 0===result.pgidx||null===result.pgidx||isNaN(result.pgidx)||(output_page_idx=result.pgidx),result.pgidx===output_page_idx&&Array.prototype.push.apply(quads,result.value),found_text+=this._m_Texts;else break}-1===output_page_idx&&(output_page_idx=0);return 0===
|
|
1965
|
-
TextLocator.prototype.getStructuralSelectionFromSurroundingTexts=function(page_idx,pre_text,post_text,text_to_match){if(20>=pre_text.length||20>=post_text.length)return{status:!1};var page_texts=[],all_pages_str="",chunk_relative_whitespace_indices=[],remove_whitespace=!0,last_iterated_page_text_end_index=0,i,j;for(i=page_idx-1;i<page_idx+2;i++)if(this._performMiscPageSetup(i))if(page_texts.push({idx:i,
|
|
1966
|
-
0;j<this._m_Pages[i].text._m_Whitespace_Indices.length;j++)chunk_relative_whitespace_indices.push(this._m_Pages[i].text._m_Whitespace_Indices[j]+last_iterated_page_text_end_index);last_iterated_page_text_end_index+=this._m_Str.length}else remove_whitespace=!1;if(0===page_texts.length||0===all_pages_str.length)return{status:!1};last_iterated_page_text_end_index=[];i=0;remove_whitespace?(page_idx=
|
|
1967
|
-
page_idx.length||page_idx.length<pre_text.length||(j=page_idx.indexOf(pre_text),0>j));)last_iterated_page_text_end_index.push(i+j+pre_text.length),page_idx=page_idx.substr(j+1),i+=j+1;if(0===last_iterated_page_text_end_index.length)return{status:!1};pre_text=[];i=last_iterated_page_text_end_index[0]+1;remove_whitespace?(page_idx=all_pages_str.replace(/( |\n)/gm,"").substring(last_iterated_page_text_end_index[0]+
|
|
1968
|
-
1);for(;!(0===page_idx.length||page_idx.length<post_text.length||(j=page_idx.indexOf(post_text),0>j));)pre_text.push(i+j),page_idx=page_idx.substr(j+1),i+=j+1;if(0===pre_text.length)return{status:!1};post_text=[];for(i=0;i<last_iterated_page_text_end_index.length;i++)for(page_idx=0;page_idx<pre_text.length;page_idx++)if(last_iterated_page_text_end_index[i]+1<=pre_text[page_idx]&&(j=
|
|
1969
|
-
if(1!==post_text.length)return{status:!1};if(remove_whitespace){for(i=0;i<chunk_relative_whitespace_indices.length&&!(post_text[0][0]<chunk_relative_whitespace_indices[i]);i++)post_text[0][0]++;for(i=0;i<chunk_relative_whitespace_indices.length&&!(post_text[0][1]<chunk_relative_whitespace_indices[i]);i++)post_text[0][1]++}remove_whitespace=[0,0];chunk_relative_whitespace_indices
|
|
1970
|
-
post_text[0][0]<last_iterated_page_text_end_index+pre_text.length){chunk_relative_whitespace_indices=page_texts[i].idx;remove_whitespace[0]=post_text[0][0]-last_iterated_page_text_end_index;break}last_iterated_page_text_end_index+=pre_text.length}if(-1===chunk_relative_whitespace_indices)return{status:!1};page_idx=-1;for(i=last_iterated_page_text_end_index=
|
|
1971
|
-
pre_text.length){page_idx=page_texts[i].idx;remove_whitespace[1]=post_text[0][1]-last_iterated_page_text_end_index;break}last_iterated_page_text_end_index+=pre_text.length}if(-1===page_idx)return{status:!1};if(chunk_relative_whitespace_indices===page_idx){all_pages_str=this.getStructuralSelectionFromTextIndices(chunk_relative_whitespace_indices,
|
|
1972
|
-
""))return{status:!1};all_pages_str.pgidx=chunk_relative_whitespace_indices;return all_pages_str}return{status:!1}}for(i=0;i<page_texts.length&&page_texts[i].idx!==chunk_relative_whitespace_indices;i++);page_texts=this.getStructuralSelectionFromTextIndices(chunk_relative_whitespace_indices,remove_whitespace[0],page_texts[i].txt.length-1);this._m_Texts=
|
|
1973
|
-
""))return{status:!1};page_texts.pgidx=chunk_relative_whitespace_indices;return page_texts}return{status:!1}};TextLocator.prototype.getRectangularSelectionFromTextIndices=function(page_idx,index_pairs,text_to_match){for(var quads=[],found_text="",i=0;i<index_pairs.length;i++){var i1=Number(index_pairs[i][0]),i2=Number(index_pairs[i][1]);
|
|
1974
|
-
{status:!1};i1=this.getStructuralSelectionFromTextIndices(page_idx,i1,i2);if(i1.status)Array.prototype.push.apply(quads,i1.value),found_text+=this._m_Texts;else return{status:!1}}return 0===quads.length||found_text.replace(/( |\n)/gm,"")!==text_to_match.replace(/( |\n)/gm,"")?{status:!1}:{status:!0,value:quads}};TextLocator.prototype.getStructuralSelectionFromTextIndices=
|
|
1975
|
-
wend.initDefault();page_idx=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.a;page_idx.initDefault();this._m_Texts=this._m_Str.substring(start_index,Math.min(end_index+1,this._m_Str.length));if(text_to_match&&this._m_Texts.replace(/( |\n)/gm,"")!==text_to_match.replace(/( |\n)/gm,""))return{status:!1};text_to_match=0;for(var first_line_in_block,
|
|
1976
|
-
this._m_Blocks[text_to_match]._m_last_line;if(last_line_in_block.getLastWord().getStringPos()+last_line_in_block.getLastWord().getNumGlyphs()>=start_index&&first_line_in_block.getFirstWord().getStringPos()<=start_index)break;text_to_match++}for(var start_block=this._m_Blocks[text_to_match],start_line=start_block._m_first_line;;){if(start_line.equal(page_idx))return{status:!1};
|
|
1977
|
-
start_index&&start_line.getFirstWord().getStringPos()<=start_index)break;if(start_line.equal(start_block._m_last_line)||start_line.equal(page_idx))return{status:!1};start_line=start_line.getNextLine()}}for(var start_word=start_line.getFirstWord();;){if(start_word.equal(wend))return{status:!1};if(start_word.getStringPos()+start_word.getNumGlyphs()>=start_index&&start_word.getStringPos()<=
|
|
1978
|
-
first_line_in_block=this._m_Blocks[end_block_idx]._m_first_line;last_line_in_block=this._m_Blocks[end_block_idx]._m_last_line;if(last_line_in_block.getLastWord().getStringPos()+last_line_in_block.getLastWord().getNumGlyphs()>=end_index&&first_line_in_block.getFirstWord().getStringPos()<=end_index)break;end_block_idx++}for(var end_line=this._m_Blocks[end_block_idx]._m_first_line;;){if(end_line.equal(page_idx))return{status:!1};
|
|
1979
|
-
end_line.getLastWord().getNumGlyphs()>=end_index&&end_line.getFirstWord().getStringPos()<=end_index)break;if(end_line.equal(start_block._m_last_line))return{status:!1};end_line=end_line.getNextLine()}}for(start_block=end_line.getFirstWord();;){if(start_block.equal(wend))return{status:!1};if(start_block.getStringPos()+start_block.getNumGlyphs()>=end_index&&start_block.getStringPos()<=end_index)break;start_block=
|
|
1980
|
-
end_block_idx;blocknum++)if(first_line_in_block=this._m_Blocks[blocknum]._m_first_line,last_line_in_block=this._m_Blocks[blocknum]._m_last_line,blocknum===text_to_match&&blocknum!==end_block_idx)for(first_line_in_block=start_line;!first_line_in_block.equal(page_idx);first_line_in_block=first_line_in_block.getNextLine()){if(this._sameDirection(first_line_in_block.getDirection())){var temp_quad=Array(8);first_line_in_block.equal(start_line)?
|
|
1981
|
-
start_word.getStringPos(),start_word.getNumGlyphs()-1),temp_quad):(first_line_in_block.getFirstWord().getBBox(rect),temp_quad[0]=rect[0],temp_quad[1]=rect[3],temp_quad[6]=rect[0],temp_quad[7]=rect[1]);first_line_in_block.getLastWord().getBBox(rect);temp_quad[2]=rect[2];temp_quad[3]=rect[3];temp_quad[4]=rect[2];temp_quad[5]=rect[1];wend.push(temp_quad);if(first_line_in_block.equal(last_line_in_block))break}}else if(blocknum!==text_to_match&&
|
|
1982
|
-
if(this._sameDirection(first_line_in_block.getDirection())&&(temp_quad=Array(8),first_line_in_block.equal(end_line)?start_block.getGlyphQuadInWordQuadFormat(Math.min(end_index-start_block.getStringPos(),start_block.getNumGlyphs()-1),temp_quad):(first_line_in_block.getLastWord().getBBox(rect),temp_quad[2]=rect[2],temp_quad[3]=rect[3],temp_quad[4]=rect[2],temp_quad[5]=
|
|
1983
|
-
rect[1],wend.push(temp_quad),first_line_in_block.equal(end_line)))break}else if(blocknum===text_to_match&&blocknum===end_block_idx)for(first_line_in_block=start_line;;first_line_in_block=first_line_in_block.getNextLine()){if(first_line_in_block.equal(page_idx))return{status:!1};if(this._sameDirection(first_line_in_block.getDirection())&&(temp_quad=Array(8),first_line_in_block.equal(start_line)
|
|
1984
|
-
start_word.getNumGlyphs()-1),temp_quad),first_line_in_block.getLastWord().getBBox(rect),temp_quad[2]=rect[2],temp_quad[3]=rect[3],temp_quad[4]=rect[2],temp_quad[5]=rect[1]):!first_line_in_block.equal(start_line)&&first_line_in_block.equal(end_line)?(start_block.getGlyphQuadInWordQuadFormat(Math.min(end_index-start_block.getStringPos(),start_block.getNumGlyphs()-1),temp_quad),
|
|
1985
|
-
rect[1]):first_line_in_block.equal(start_line)&&first_line_in_block.equal(end_line)?(start_word.getGlyphQuadInWordQuadFormat(Math.min(start_index-start_word.getStringPos(),start_word.getNumGlyphs()-1),temp_quad),rect[0]=temp_quad[6],rect[1]=temp_quad[7],rect[2]=temp_quad[2],rect[3]=temp_quad[3],start_block.getGlyphQuadInWordQuadFormat(Math.min(end_index-start_block.getStringPos(),
|
|
1986
|
-
(first_line_in_block.getFirstWord().getBBox(rect),temp_quad[0]=rect[0],temp_quad[1]=rect[3],temp_quad[6]=rect[0],temp_quad[7]=rect[1],first_line_in_block.getLastWord().getBBox(rect),temp_quad[2]=rect[2],temp_quad[3]=rect[3],temp_quad[4]=rect[2],temp_quad[5]=rect[1]),wend.push(temp_quad),first_line_in_block.equal(end_line)))break}else for(;!(first_line_in_block.equal(page_idx)||
|
|
1987
|
-
temp_quad[0]=rect[0],temp_quad[1]=rect[3],temp_quad[6]=rect[0],temp_quad[7]=rect[1],first_line_in_block.getLastWord().getBBox(rect),temp_quad[2]=rect[2],temp_quad[3]=rect[3],temp_quad[4]=rect[2],temp_quad[5]=rect[1],wend.push(temp_quad),first_line_in_block.equal(last_line_in_block)));first_line_in_block=first_line_in_block.getNextLine());return{status:!0,value:wend}};TextLocator.prototype.selectByStruct=
|
|
1988
|
-
this._m_Texts="";for(var page_texts=[],all_pages_str="",i_3=page_idx-1;i_3<page_idx+2;i_3++)this._performMiscPageSetup(i_3)&&(page_texts.push({idx:i_3,txt:this._m_Str}),all_pages_str+=this._m_Str);if(0===page_texts.length||0===all_pages_str.length||!this._performMiscPageSetup(page_idx))return!1;var min_dist1;i_3=Array(8);var qq=Array(8),b=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.d,min_line_dist1=
|
|
1989
|
-
min_line_dist1.initDefault();min_line_dist2.initDefault();var is_horiz_line1=this._m_Horizontal,is_horiz_line2=this._m_Horizontal,lend=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.a;lend.initDefault();var wend=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.e;wend.initDefault();var tmpPoint1=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c;tmpPoint1.init(sel_rect.x1,sel_rect.y1);
|
|
1990
|
-
sel_pt1_y,min_line_dist1,min_line_dist2);min_line_dist1=tmpPoint1._first_line;min_line_dist2=tmpPoint1._last_line;if(min_line_dist1.equal(lend)||min_line_dist2.equal(lend))return!1;var min_w1=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.e;tmpPoint1=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.e;min_w1.initDefault();tmpPoint1.initDefault();var min_dist2=
|
|
1991
|
-
if(is_horiz_line1){var sel_pt1_x=sel_rect.x1;sel_pt1_y=sel_rect.y1}else sel_pt1_y=i_3[0],i_3[0]=i_3[1],i_3[1]=sel_pt1_y,sel_pt1_y=i_3[2],i_3[2]=i_3[3],i_3[3]=sel_pt1_y,sel_pt1_x=sel_rect.y1,sel_pt1_y=sel_rect.x1;var d=(i_3[3]+i_3[1])/2;if(i_3[2]<=sel_pt1_x){var xd=i_3[2]-sel_pt1_x;d-=sel_pt1_y;d=xd*xd+d*d}else i_3[0]>=sel_pt1_x?
|
|
1992
|
-
is_horiz_line2?(sel_pt1_x=sel_rect.x2,sel_pt1_y=sel_rect.y2):(sel_pt1_y=i_3[0],i_3[0]=i_3[1],i_3[1]=sel_pt1_y,sel_pt1_y=i_3[2],i_3[2]=i_3[3],i_3[3]=sel_pt1_y,sel_pt1_x=sel_rect.y2,sel_pt1_y=sel_rect.x2),d=(i_3[3]+i_3[1])/2,i_3[2]<=sel_pt1_x?(xd=i_3[2]-sel_pt1_x,d-=sel_pt1_y,d=xd*xd+d*d):i_3[0]>=
|
|
1993
|
-
_selectionInfo_constants__WEBPACK_IMPORTED_MODULE_1__.a.MAX;var gnum=min_w1.getNumGlyphs();for(sel_pt1_x=0;sel_pt1_x<gnum;++sel_pt1_x)min_w1.getGlyphQuad(sel_pt1_x,i_3),xd=(i_3[0]+i_3[2]+i_3[4]+i_3[6])/4,d=(i_3[1]+i_3[3]+i_3[5]+i_3[7])/4,xd-=sel_rect.x1,d-=sel_rect.y1,d=xd*xd+d*d,d<min_dist1&&
|
|
1994
|
-
4,xd-=sel_rect.x2,d-=sel_rect.y2,d=xd*xd+d*d,d<min_dist2&&(min_dist2=d,sel_pt1_y=sel_pt1_x);min_dist1=word+min_w1.getStringPos();min_dist2=sel_pt1_y+tmpPoint1.getStringPos();min_dist2<min_dist1&&(sel_pt1_x=min_dist1,min_dist1=min_dist2,min_dist2=sel_pt1_x);this._m_Selidxs.push([min_dist1,min_dist2]);
|
|
1995
|
-
d[0]=all_pages_str.substring(Math.max(0,xd-100),xd);for(sel_pt1_x=min_dist1=0;sel_pt1_x<page_texts.length;sel_pt1_x++)if(page_texts[sel_pt1_x].idx===page_idx){min_dist1+=min_dist2;break}else page_texts[sel_pt1_x].idx<page_idx&&(min_dist1+=page_texts[sel_pt1_x].txt.length);d[1]=all_pages_str.substr(min_dist1+
|
|
1996
|
-
if(all_pages_str===min_dist2){page_idx>page_texts&&(all_pages_str=min_w1,min_w1=tmpPoint1,tmpPoint1=all_pages_str,all_pages_str=word,word=sel_pt1_y,sel_pt1_y=all_pages_str);min_line_dist1.getBBox(b);if(page_idx===page_texts&&word===sel_pt1_y&&(all_pages_str=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.d
|
|
1997
|
-
min_w1.getGlyphQuad(word,i_3);Object(logger__WEBPACK_IMPORTED_MODULE_0__.a)(is_horiz_line1===is_horiz_line2);is_horiz_line2=min_w1.getStringPos();Object(logger__WEBPACK_IMPORTED_MODULE_0__.a)(word<=all_pages_str);for(is_horiz_line1=word;is_horiz_line1<=all_pages_str;++is_horiz_line1)is_horiz_line2+
|
|
1998
|
-
Math.sqrt(is_horiz_line1*is_horiz_line1+is_horiz_line2*is_horiz_line2),is_horiz_line1=is_horiz_line1/(all_pages_str+1)*3,this._chopQuad(qq,i_3,!0),page_idx===page_texts&&(sel_rect=Array(8),tmpPoint1.getGlyphQuad(sel_pt1_y,sel_rect),this._chopQuad(qq,sel_rect,!1)),this._storeQuad(qq,is_horiz_line1));
|
|
1999
|
-
0;is_horiz_line1<=all_pages_str;++is_horiz_line1)sel_rect+is_horiz_line1<this._m_Str.length&&(this._m_Texts+=this._m_Str.charAt(sel_rect+is_horiz_line1));0<all_pages_str&&(word.getQuad(qq),is_horiz_line1=qq[0]-qq[2],is_horiz_line2=qq[1]-qq[3],is_horiz_line1=Math.sqrt(is_horiz_line1*is_horiz_line1+
|
|
2000
|
-
page_texts){wend=tmpPoint1.getStringPos();Object(logger__WEBPACK_IMPORTED_MODULE_0__.a)(sel_pt1_y<=all_pages_str);for(is_horiz_line1=0;is_horiz_line1<=sel_pt1_y;++is_horiz_line1)wend+is_horiz_line1<this._m_Str.length&&(this._m_Texts+=this._m_Str.charAt(wend+is_horiz_line1));0<all_pages_str&&(tmpPoint1.getQuad(qq),
|
|
2001
|
-
this._chopQuad(qq,i_3,!1),this._storeQuad(qq,is_horiz_line1))}}else{all_pages_str>min_dist2&&(is_horiz_line1=min_line_dist1,min_line_dist1=min_line_dist2,min_line_dist2=is_horiz_line1,all_pages_str=min_w1,min_w1=tmpPoint1,tmpPoint1=all_pages_str,all_pages_str=word,word=sel_pt1_y,sel_pt1_y=all_pages_str);min_line_dist1.getBBox(b);
|
|
2002
|
-
i_3);all_pages_str=min_w1.getStringLen();is_horiz_line2=min_w1.getStringPos();Object(logger__WEBPACK_IMPORTED_MODULE_0__.a)(word<=all_pages_str);for(is_horiz_line1=word;is_horiz_line1<=all_pages_str;++is_horiz_line1)is_horiz_line2+is_horiz_line1<this._m_Str.length&&(this._m_Texts+=this._m_Str.charAt(is_horiz_line2+is_horiz_line1));
|
|
2003
|
-
is_horiz_line1=is_horiz_line1/all_pages_str*3,this._chopQuad(qq,i_3,!0),this._storeQuad(qq,is_horiz_line1));for(word=min_w1=min_w1.getNextWord();!word.equal(wend);word=word.getNextWord()){all_pages_str=word.getStringLen();min_w1=word.getStringPos();for(is_horiz_line1=0;is_horiz_line1<=all_pages_str;++is_horiz_line1)min_w1+
|
|
2004
|
-
qq[3],is_horiz_line1=Math.sqrt(is_horiz_line1*is_horiz_line1+is_horiz_line2*is_horiz_line2),is_horiz_line1=is_horiz_line1/all_pages_str*3,this._storeQuad(qq,is_horiz_line1))}for(min_line_dist1=min_line_dist1.getNextLine();!min_line_dist1.equal(min_line_dist2)&&!min_line_dist1.equal(lend);min_line_dist1=min_line_dist1.getNextLine())if(this._sameDirection(min_line_dist1.getDirection()))for(min_line_dist1.getBBox(b),
|
|
2005
|
-
word.getStringLen();min_w1=word.getStringPos();for(is_horiz_line1=0;is_horiz_line1<=all_pages_str;++is_horiz_line1)min_w1+is_horiz_line1<this._m_Str.length&&(this._m_Texts+=this._m_Str.charAt(min_w1+is_horiz_line1));0<all_pages_str&&(word.getQuad(qq),is_horiz_line1=qq[0]-qq[2],is_horiz_line2=qq[1]-qq[3],is_horiz_line1=Math.sqrt(is_horiz_line1*is_horiz_line1+is_horiz_line2*is_horiz_line2),is_horiz_line1=is_horiz_line1/
|
|
2006
|
-
new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.d;all_pages_str.intersectRect(b,sel_rect)||(tmpPoint1=min_line_dist2.getWord(min_line_dist2.getNumWords()-1),sel_pt1_y=tmpPoint1.getNumGlyphs()-1);for(word=min_line_dist2.getFirstWord();!word.equal(wend)&&!word.equal(tmpPoint1);word=word.getNextWord()){all_pages_str=word.getStringLen();sel_rect=word.getStringPos();for(is_horiz_line1=0;is_horiz_line1<=all_pages_str;++is_horiz_line1)sel_rect+
|
|
2007
|
-
is_horiz_line1));0<all_pages_str&&(word.getQuad(qq),is_horiz_line1=qq[0]-qq[2],is_horiz_line2=qq[1]-qq[3],is_horiz_line1=Math.sqrt(is_horiz_line1*is_horiz_line1+is_horiz_line2*is_horiz_line2),is_horiz_line1=is_horiz_line1/all_pages_str*3,this._storeQuad(qq,is_horiz_line1))}tmpPoint1.getGlyphQuad(sel_pt1_y,i_3);all_pages_str=tmpPoint1.getStringLen();is_horiz_line2=tmpPoint1.getStringPos();Object(logger__WEBPACK_IMPORTED_MODULE_0__.a)(sel_pt1_y<=
|
|
2008
|
-
is_horiz_line1<this._m_Str.length&&(this._m_Texts+=this._m_Str.charAt(is_horiz_line2+is_horiz_line1));0<all_pages_str&&(tmpPoint1.getQuad(qq),is_horiz_line1=qq[0]-qq[2],is_horiz_line2=qq[1]-qq[3],is_horiz_line1=Math.sqrt(is_horiz_line1*is_horiz_line1+is_horiz_line2*is_horiz_line2),is_horiz_line1=is_horiz_line1/all_pages_str*3,this._chopQuad(qq,i_3,!1),this._storeQuad(qq,is_horiz_line1))}return 0<this._m_Quads.length};
|
|
2009
|
-
this._m_Pages.length)return!1;if(0>=this._m_PrePage||this._m_PrePage!==page_idx){var spi=this._m_Pages[page_idx].text;if(null==spi||!spi.ready())return!1;this._m_Words=spi;this._m_Str=this._m_Words.getStr();this._cmptTextDirection();this._cmptBlocks();this._m_PrePage=page_idx}return!0};TextLocator.prototype._storeQuad=function(quad,tra_thresh){var sz=this._m_Quads.length/8;if(sz){var des_q=Array(8);sz=8*(sz-1);
|
|
2010
|
-
quad,1,!0,tra_thresh))for(i=0;8>i;++i)this._m_Quads[sz+i]=des_q[i];else for(i=0;8>i;++i)this._m_Quads.push(quad[i])}else for(var i=0;8>i;++i)this._m_Quads.push(quad[i])};TextLocator.prototype._chopQuad=function(word_quad_to_be_chopped,quad_of_first_or_last_glyph_in_word,is_glyph_first_glyph_in_word){var bottom_left_of_word=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c;bottom_left_of_word.init(word_quad_to_be_chopped[0],
|
|
2011
|
-
bottom_right_of_word.init(word_quad_to_be_chopped[2],word_quad_to_be_chopped[3]);var distance_between_word_start_and_end=_selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c.minus(bottom_right_of_word,bottom_left_of_word);distance_between_word_start_and_end.normalize()&&(is_glyph_first_glyph_in_word?(bottom_right_of_word=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c,bottom_right_of_word.init(quad_of_first_or_last_glyph_in_word[0],
|
|
2012
|
-
_selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c.minus(bottom_right_of_word,bottom_left_of_word).dot(distance_between_word_start_and_end),distance_between_word_start_and_end=_selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c.multiply(distance_between_word_start_and_end,quad_of_first_or_last_glyph_in_word),word_quad_to_be_chopped[0]+=distance_between_word_start_and_end.x,word_quad_to_be_chopped[1]+=distance_between_word_start_and_end.y,
|
|
2013
|
-
distance_between_word_start_and_end.y):(bottom_left_of_word=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c,bottom_left_of_word.init(quad_of_first_or_last_glyph_in_word[2],quad_of_first_or_last_glyph_in_word[3]),quad_of_first_or_last_glyph_in_word=_selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c.minus(bottom_left_of_word,bottom_right_of_word).dot(distance_between_word_start_and_end),distance_between_word_start_and_end=
|
|
2014
|
-
quad_of_first_or_last_glyph_in_word),word_quad_to_be_chopped[2]+=distance_between_word_start_and_end.x,word_quad_to_be_chopped[3]+=distance_between_word_start_and_end.y,word_quad_to_be_chopped[4]+=distance_between_word_start_and_end.x,word_quad_to_be_chopped[5]+=distance_between_word_start_and_end.y))};TextLocator.prototype._getTextRotationMatrix=function(angle){var m0=_Matrix2D__WEBPACK_IMPORTED_MODULE_3__.a.rotationMatrix(0),
|
|
2015
|
-
m180=_Matrix2D__WEBPACK_IMPORTED_MODULE_3__.a.rotationMatrix(3.14159265),m270=_Matrix2D__WEBPACK_IMPORTED_MODULE_3__.a.rotationMatrix(3.14159265*1.5);switch(parseInt(angle/90+.1,10)){case 0:return m0;case 1:return m90;case 2:return m180;case 3:return m270;case 4:return m0;default:return m0}};TextLocator.prototype._sameDirection=function(){return!0};TextLocator.prototype._transformToNormalFlow=function(box,angle){angle=this._getTextRotationMatrix(angle);
|
|
2016
|
-
box.y1);tmpPoint2D=angle.mult(tmpPoint2D);box.x1=tmpPoint2D.x;box.y1=tmpPoint2D.y;tmpPoint2D=new _Point2D__WEBPACK_IMPORTED_MODULE_5__.a(box.x2,box.y2);tmpPoint2D=angle.mult(tmpPoint2D);box.x2=tmpPoint2D.x;box.y2=tmpPoint2D.y;box.normalize()};TextLocator.prototype._cmptBlocks=function(){Object(_helpers_arrayHelper__WEBPACK_IMPORTED_MODULE_8__.b)(this._m_Blocks);var line,end=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.a;end.initDefault();
|
|
2017
|
-
current_block=new _TextSelectionBlock__WEBPACK_IMPORTED_MODULE_4__.a,block_initialized=!1;for(line=this._m_Words.getFirstLine();!line.equal(end);line=line.getNextLine())if(this._sameDirection(line.getDirection())){line.getBBox(b);b.normalize();var orig_box=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.d;orig_box.initRect(b);this._transformToNormalFlow(b,this._m_Direction);block_initialized?(this._m_Blocks.push(current_block),current_block=
|
|
2018
|
-
current_block._m_transformed_bbox.initRect(b),current_block._m_first_line=line,current_block._m_last_line=line):(current_block._m_bbox.initRect(orig_box),current_block._m_transformed_bbox.initRect(b),current_block._m_first_line=line,current_block._m_last_line=line,block_initialized=!0)}block_initialized&&this._m_Blocks.push(current_block)};TextLocator.prototype._findLineByPoint=function(block,pt,out_line){out_line=
|
|
2019
|
-
best_line=block._m_first_line,line=block._m_first_line;;line=line.getNextLine()){if(!this._sameDirection(line.getDirection()))if(line.equal(block._m_last_line))break;else continue;line.getBBox(b);this._transformToNormalFlow(b,this._m_Direction);var ycenter=(b.y1+b.y2)/2;Math.abs(ycenter-pt.y)<out_line&&(best_line=line,out_line=Math.abs(ycenter-pt.y));if(line.equal(block._m_last_line))break}return out_line=
|
|
2020
|
-
x1),w=_selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c.minus(p,x1),c1=w.dot(v);if(0>=c1)return w.dot(w);w=v.dot(v);if(w<=c1)return p=_selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c.minus(p,x2),p.dot(p);x1=_selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c.plus(x1,_selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c.multiply(v,c1/w));p=_selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c.minus(p,
|
|
2021
|
-
|
|
2022
|
-
bbox.y2),new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c(bbox.x1,bbox.y1),pt);return Math.min(d1,d2,d3,pt)};TextLocator.prototype._findStructuralBounds=function(pt1,pt2,first_line,last_line){var start_block_matched=-1,end_block_matched=-1,end_block_precise=!1,start_block_precise=!1,rmx=this._getTextRotationMatrix(this._m_Direction),
|
|
2023
|
-
p1.y);pt1=rmx.mult(pt1);p1.x=pt1.x;p1.y=pt1.y;pt1=new _Point2D__WEBPACK_IMPORTED_MODULE_5__.a(p2.x,p2.y);pt1=rmx.mult(pt1);p2.x=pt1.x;p2.y=pt1.y;pt2=0;for(var sz=this._m_Blocks.length;pt2<sz;++pt2)rmx=this._m_Blocks[pt2],0>start_block_matched&&rmx._m_transformed_bbox.contains(p1.x,p1.y)&&(start_block_matched=
|
|
2024
|
-
for(pt1=0;pt1<this._m_Blocks.length;++pt1)rmx.push(0);pt1=Math.max(start_block_matched,end_block_matched);var sel=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.d;sel.initCoordinates(p1.x,p1.y,p2.x,p2.y);sel.inflateSquare(.1);0<=pt1&&sel.union(this._m_Blocks[pt1]._m_transformed_bbox);var rtmp=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.d;
|
|
2025
|
-
rtmp.intersectRect(box,sel)&&(rmx[pt2]=1)}sz=rmx.indexOf(1);for(sel=pt2=rmx.indexOf(1);-1!==pt2;){sel=pt2;pt2++;if(pt2>=rmx.length)break;pt2=rmx.indexOf(1,pt2)}if(0>sz)return new _ResultFindStructuralBounds__WEBPACK_IMPORTED_MODULE_6__.a(first_line,last_line);rmx=pt2=!1;rtmp=Math.max.apply(Math,this._m_Blocks.map(function(b){return b._m_bbox.y2}));
|
|
2026
|
-
0===p1.x&&0===p1.y,p2.y>rtmp&&(pt2=!0));if(0>pt1)start_block_matched=sz,end_block_matched=sel,start_block_precise=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.d,start_block_precise.initRect(this._m_Blocks[start_block_matched]._m_transformed_bbox),end_block_precise=(p1.x-start_block_precise.x1)*(p1.x-start_block_precise.x2),end_block_precise=0<
|
|
2027
|
-
pt1=0<pt1?Math.min(Math.abs(p1.y-start_block_precise.y1),Math.abs(p1.y-start_block_precise.y2)):0,end_block_precise=end_block_precise*end_block_precise+pt1*pt1,pt1=Math.min(Math.abs(p2.x-start_block_precise.x1),Math.abs(p2.x-start_block_precise.x2)),sz=(p2.y-start_block_precise.y1)*(p2.y-start_block_precise.y2),sz=0<sz?Math.min(Math.abs(p2.y-
|
|
2028
|
-
start_block_precise&&(start_block_precise=start_block_matched,start_block_matched=end_block_matched,end_block_matched=start_block_precise);else{box=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.d;box.initRect(this._m_Blocks[pt1]._m_transformed_bbox);rtmp=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c;start_block_precise?rtmp.initPoint(p2):
|
|
2029
|
-
rtmp.y));var other=box=void 0;pt1-sz>Math.max(sel-pt1,0)?(box=Math.min(pt1,sz),other=sel):(box=Math.max(pt1,sel),other=sz);pt2&&!end_block_precise?(end_block_matched=this._m_Blocks.length,box=end_block_matched-1):box!==pt1&&(end_block_precise=Array(3),pt2=Array(3),end_block_precise[0]=
|
|
2030
|
-
end_block_precise[3]=box?this.Dist2BBox(rtmp,this._m_Blocks[box-1]._m_transformed_bbox):end_block_precise[1],pt2[0]=other,pt2[1]=box,pt2[2]=pt1,pt1=1,end_block_precise[0]<end_block_precise[1]&&(pt1=0),end_block_precise[2]<end_block_precise[pt1]&&(pt1=2),1!==pt1&&end_block_precise[3]<
|
|
2031
|
-
p1,first_line),last_line=this._findLineByPoint(this._m_Blocks[end_block_matched],p2,last_line));return new _ResultFindStructuralBounds__WEBPACK_IMPORTED_MODULE_6__.a(first_line,last_line)};return TextLocator})()},function(module,
|
|
2032
|
-
__webpack_require__
|
|
2033
|
-
offset){this._m_mtx=[];this._container={};var identity_mtx=new _textSelection_Matrix2D__WEBPACK_IMPORTED_MODULE_1__.a;identity_mtx.set(1,0,0,1,0,0);this._m_mtx.push(identity_mtx);this._font_container=
|
|
2034
|
-
null}SelectionContext.prototype.getLetter=function(id){return this._container[id]};SelectionContext.prototype._getTsWidth=function(bbox,text_mtx){var new_bbox=new _SelectionRect__WEBPACK_IMPORTED_MODULE_5__.a;
|
|
2035
|
-
"Font "+font+" file not found");return this._font_container[font]};SelectionContext.prototype._transformBboxToTextSpace=function(this_font,bbox){var font_mtx=new _textSelection_Matrix2D__WEBPACK_IMPORTED_MODULE_1__.a,
|
|
2036
|
-
|
|
2037
|
-
mtx.set(
|
|
2038
|
-
function(text,x,y,font){if(!this._custom_glyph_mode){this.translate(x,y);x=0;for(y=text.length;x<y;){var first_utf16_codeunit=text.charCodeAt(x),initialIndex=
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
this._container[this._offset]=new _Letter__WEBPACK_IMPORTED_MODULE_2__.a(initialIndex,second_utf16_codeunit);this._offset++}this.lastMapping=null}};
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
SelectionContext.prototype.
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
function(){this.
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
set:function(val){this.font=val},enumerable:!1,configurable:!0});return SelectionContext}()},function(module,
|
|
2053
|
-
__webpack_require__(
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
lineBoundingBox[
|
|
2059
|
-
minX=Math.min(glyphQuad_1[
|
|
2060
|
-
|
|
2061
|
-
numGlyphs[4]=x_right,numGlyphs[5]=
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
1931
|
+
q[2];quad.x3=q[4];quad.x4=q[6];quad.y1=q[1];quad.y2=q[3];quad.y3=q[5];quad.y4=q[7];quads.push(quad)})});var isRTL=_this.doc.getDocumentViewer().testForRightToLeft(_this.searchPattern);_a=isRTL?null===(_b=result.out_str)||void 0===_b?void 0:_b.split("").reverse().join(""):result.out_str;_b=isRTL?null===(_c=result.ambient_str)||void 0===_c?void 0:_c.replace(result.out_str,_a):result.ambient_str;result={ambientStr:_b||"",resultStr:_a||"",resultStrStart:result.ambient_str?result.first_idx_within_ambient_str:
|
|
1932
|
+
-1,resultStrEnd:result.ambient_str?result.first_idx_within_ambient_str+result.out_str.length:-1,pageNum:result.page_num,resultCode:_ResultCode__WEBPACK_IMPORTED_MODULE_2__.a.FOUND,quads:quads,ambient_str:_b||"",result_str:_a,result_str_start:result.ambient_str?result.ambient_str.indexOf(result.out_str):-1,result_str_end:result.ambient_str?result.ambient_str.indexOf(result.out_str)+result.out_str.length:-1,page_num:result.page_num};_this.onSearchCallback(result)}})};PDFTextSearch.prototype.fireRemainingEvents=
|
|
1933
|
+
function(lastPageNumber,startPage,endPage){for(;!this.isSearchUpOn&&lastPageNumber<=endPage||this.isSearchUpOn&&lastPageNumber>=startPage;)this.onSearchCallback(createPageEndEvent(lastPageNumber)),this.isSearchUpOn?lastPageNumber--:lastPageNumber++;this.onSearchCallback({ambientStr:"",resultStr:"",resultStrStart:-1,resultStrEnd:-1,pageNum:0,resultCode:_ResultCode__WEBPACK_IMPORTED_MODULE_2__.a.DONE,quads:[],ambient_str:"",result_str:"",result_str_start:-1,result_str_end:-1,page_num:0})};PDFTextSearch.prototype.searchDown=
|
|
1934
|
+
function(results,start,end){1!==start&&this.initialSearchResultForSearchDown||(this.initialSearchResultForSearchDown=Object(tslib__WEBPACK_IMPORTED_MODULE_0__.a)(Object(tslib__WEBPACK_IMPORTED_MODULE_0__.a)({index:0},results[0]),{searchUp:!1}));if(!this.lastSearch||this.lastSearch.page_num<start)this.lastSearch=Object(tslib__WEBPACK_IMPORTED_MODULE_0__.a)(Object(tslib__WEBPACK_IMPORTED_MODULE_0__.a)({index:0},results[0]),{searchUp:!1});else{var currentPage=this.lastSearch.page_num;currentPage===this.initialSearchResultForSearchDown.page_num&&
|
|
1935
|
+
(this.initialSearchResultForSearchDown=Object(tslib__WEBPACK_IMPORTED_MODULE_0__.a)(Object(tslib__WEBPACK_IMPORTED_MODULE_0__.a)({index:0},results[0]),{searchUp:!1}));start=results.filter(function(rs){return rs.page_num===currentPage});if(start.length){var nextIndex=this.lastSearch.index+1;this.lastSearch.searchUp&&(nextIndex=start.length-this.lastSearch.index);nextIndex===start.length?(start=results.filter(function(result){return result.page_num>currentPage}),this.lastSearch=currentPage!==end&&start.length?
|
|
1936
|
+
Object(tslib__WEBPACK_IMPORTED_MODULE_0__.a)(Object(tslib__WEBPACK_IMPORTED_MODULE_0__.a)({index:0},start[0]),{searchUp:!1}):this.initialSearchResultForSearchDown):this.lastSearch=Object(tslib__WEBPACK_IMPORTED_MODULE_0__.a)(Object(tslib__WEBPACK_IMPORTED_MODULE_0__.a)({index:nextIndex},start[nextIndex]),{searchUp:!1})}else this.lastSearch=Object(tslib__WEBPACK_IMPORTED_MODULE_0__.a)(Object(tslib__WEBPACK_IMPORTED_MODULE_0__.a)({index:0},results[0]),{searchUp:!1})}};PDFTextSearch.prototype.isSearchUp=
|
|
1937
|
+
function(results,start,end){end!==this.doc.getPageCount()&&this.initialSearchResultForSearchUp||(this.initialSearchResultForSearchUp=Object(tslib__WEBPACK_IMPORTED_MODULE_0__.a)(Object(tslib__WEBPACK_IMPORTED_MODULE_0__.a)({index:0},results[0]),{searchUp:!0}));if(!this.lastSearch||this.lastSearch.page_num>end)this.lastSearch=Object(tslib__WEBPACK_IMPORTED_MODULE_0__.a)(Object(tslib__WEBPACK_IMPORTED_MODULE_0__.a)({index:0},results[0]),{searchUp:!0});else{var currentPage=this.lastSearch.page_num;currentPage===
|
|
1938
|
+
this.initialSearchResultForSearchUp.page_num&&(this.initialSearchResultForSearchUp=Object(tslib__WEBPACK_IMPORTED_MODULE_0__.a)(Object(tslib__WEBPACK_IMPORTED_MODULE_0__.a)({index:0},results[0]),{searchUp:!0}));end=results.filter(function(rs){return rs.page_num===currentPage});if(end.length){var nextIndex=this.lastSearch.index+1;this.lastSearch.searchUp||(nextIndex=end.length-this.lastSearch.index);nextIndex===end.length?(end=results.filter(function(result){return result.page_num<currentPage}),this.lastSearch=
|
|
1939
|
+
currentPage!==start&&end.length?Object(tslib__WEBPACK_IMPORTED_MODULE_0__.a)(Object(tslib__WEBPACK_IMPORTED_MODULE_0__.a)({index:0},end[0]),{searchUp:!0}):this.initialSearchResultForSearchUp):this.lastSearch=Object(tslib__WEBPACK_IMPORTED_MODULE_0__.a)(Object(tslib__WEBPACK_IMPORTED_MODULE_0__.a)({index:nextIndex},end[nextIndex]),{searchUp:!0})}else this.lastSearch=Object(tslib__WEBPACK_IMPORTED_MODULE_0__.a)(Object(tslib__WEBPACK_IMPORTED_MODULE_0__.a)({index:0},results[0]),{searchUp:!0})}};PDFTextSearch.prototype.getLatestSearch=
|
|
1940
|
+
function(results,start,end){this.isSearchUpOn?this.isSearchUp(results,start,end):this.searchDown(results,start,end)};PDFTextSearch.prototype.searchTillDone=function(start,end,searchID){var _this=this;if(start>end)return this.fireRemainingEvents(this.currentPage,this.searchStartPage,this.searchEndPage),Promise.resolve(!0);var searchStart=this.isSearchUpOn?Math.max(start,end-this.searchBatchSize):start,searchEnd=this.isSearchUpOn?end:Math.min(start+this.searchBatchSize,end);return this.doc.textSearch(this.searchPattern,
|
|
1941
|
+
this.searchMode,searchStart,searchEnd).then(function(results){if(_this.shouldStopSearching(searchID))return Promise.resolve(!1);if(!_this.isFullSearch&&0<results.length)return _this.getLatestSearch(results,start,end),_this.resultCallBack([_this.lastSearch],searchID),Promise.resolve(!0);_this.resultCallBack(results,searchID);var searchNextBatch=function(){return _this.pauseSearch&&!_this.isUsingThreadedWorkers?new Promise(function(resolve){_this.doc.getDocumentViewer().addEventListener(_constants_events__WEBPACK_IMPORTED_MODULE_5__.DocumentViewerEvents.FINISHED_RENDERING,
|
|
1942
|
+
function(){_this.pauseSearch=!1;resolve(searchNextBatch())},{once:!0})}):_this.isSearchUpOn?_this.searchTillDone(start,searchStart-1,searchID):_this.searchTillDone(searchEnd+1,end,searchID)};return searchNextBatch()})};PDFTextSearch.prototype.convertMode=function(mode){var newMode=0;newMode=mode&_SearchMode__WEBPACK_IMPORTED_MODULE_1__.a.WILD_CARD|mode&_SearchMode__WEBPACK_IMPORTED_MODULE_1__.a.REGEX?newMode|1:newMode;newMode=mode&_SearchMode__WEBPACK_IMPORTED_MODULE_1__.a.CASE_SENSITIVE?newMode|
|
|
1943
|
+
2:newMode;newMode=mode&_SearchMode__WEBPACK_IMPORTED_MODULE_1__.a.WHOLE_WORD?newMode|4:newMode;newMode=mode&_SearchMode__WEBPACK_IMPORTED_MODULE_1__.a.SEARCH_UP?newMode|8:newMode;newMode=mode&_SearchMode__WEBPACK_IMPORTED_MODULE_1__.a.PAGE_STOP?newMode|16:newMode;newMode=mode&_SearchMode__WEBPACK_IMPORTED_MODULE_1__.a.HIGHLIGHT?newMode|32:newMode;return newMode=mode&_SearchMode__WEBPACK_IMPORTED_MODULE_1__.a.AMBIENT_STRING?newMode|64:newMode};PDFTextSearch.prototype.setSearchBatchSize=function(searchBatchSize){this.searchBatchSize=
|
|
1944
|
+
searchBatchSize};PDFTextSearch.prototype.updateSearchPageInfo=function(startPage,endPage,doc,isMatching){var currentPage=this.lastSearch.page_num;switch(!0){case isMatching&&this.isSearchUpOn:this.searchStartPage=startPage||1;this.searchEndPage=1===currentPage?doc.getPageCount():currentPage;break;case isMatching&&!this.isSearchUpOn:this.searchStartPage=currentPage===doc.getPageCount()?1:currentPage;this.searchEndPage=endPage||doc.getPageCount();break;case !isMatching:this.searchStartPage=1,this.initialSearchResultForSearchUp=
|
|
1945
|
+
this.initialSearchResultForSearchDown=this.lastSearch=null,this.searchEndPage=doc.getPageCount()}};PDFTextSearch.prototype.search=function(doc,pattern,mode,start_page,end_page,onSearchCallback,isFullSearch){var _this=this;this.currentSearchID++;this.resultFound=!1;this.doc&&this.doc!==doc||(doc.getDocumentViewer().addEventListener(_constants_events__WEBPACK_IMPORTED_MODULE_5__.DocumentViewerEvents.BEGIN_RENDERING,function(){_this.pauseSearch=!0}),doc.getDocumentViewer().addEventListener(_constants_events__WEBPACK_IMPORTED_MODULE_5__.DocumentViewerEvents.FINISHED_RENDERING,
|
|
1946
|
+
function(){_this.pauseSearch=!1}));this.doc=doc;this.onSearchCallback=onSearchCallback;this.isSearchUpOn=!!(mode&_SearchMode__WEBPACK_IMPORTED_MODULE_1__.a.SEARCH_UP);this.isFullSearch=isFullSearch;this.searchPattern=pattern;mode&_SearchMode__WEBPACK_IMPORTED_MODULE_1__.a.WILD_CARD&&(this.searchPattern=pattern.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replaceAll("**","[TEMPEscape]").replaceAll("*","[A-z]*").replaceAll("[TEMPEscape]","\\*"));this.searchPattern=this.searchPattern.replaceAll("\n","");this.searchMode=
|
|
1947
|
+
this.convertMode(mode);!isFullSearch&&this.lastSearch?mode&_SearchMode__WEBPACK_IMPORTED_MODULE_1__.a.CASE_SENSITIVE?this.updateSearchPageInfo(start_page,end_page,doc,pattern===this.lastSearch.out_str):this.updateSearchPageInfo(start_page,end_page,doc,pattern.toLocaleLowerCase()===this.lastSearch.out_str.toLocaleLowerCase()):(this.searchStartPage=start_page||1,this.searchEndPage=doc.getPageCount());this.currentPage=this.isSearchUpOn?this.searchEndPage:this.searchStartPage;return this.searchTillDone(this.searchStartPage,
|
|
1948
|
+
this.searchEndPage,this.currentSearchID)};return PDFTextSearch})()},function(module,__webpack_exports__,__webpack_require__){var logger__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(0),_selectionInfo_constants__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(14),_Quad__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(12),_Matrix2D__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(13),_TextSelectionBlock__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(44),_Point2D__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(19),
|
|
1949
|
+
_ResultFindStructuralBounds__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(45),_selectionInfo__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(1),_helpers_arrayHelper__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(4);(function(){function TextLocator(doc){this._m_Str="";this._m_PrePage=-1;this._m_Quads=[];this._m_Texts="";this._m_Pages=doc.getPages();this._m_Words=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.b;this._m_Words.initDefault();this._m_Blocks=[];this._m_Surrtxts=[];this._m_Selidxs=
|
|
1950
|
+
[];this._m_Direction=0;this._m_Horizontal=!1}TextLocator.prototype.getQuads=function(){for(var sz=this._m_Quads.length/8,quads=[],i=0;i<sz;++i){var q=new _Quad__WEBPACK_IMPORTED_MODULE_2__.a,pos=8*i;q._setCoordinates(this._m_Quads[pos],this._m_Quads[pos+1],this._m_Quads[pos+2],this._m_Quads[pos+3],this._m_Quads[pos+4],this._m_Quads[pos+5],this._m_Quads[pos+6],this._m_Quads[pos+7]);quads.push(q)}return quads};TextLocator.prototype.getTexts=function(){return this._m_Texts};TextLocator.prototype._isWhitespace=
|
|
1951
|
+
function(s){s=s.charCodeAt(0);return 32===s||1<=s&&31>=s||160===s||8192<=s&&(8207>=s||8232<=s&&8239>=s||8298<=s&&8303>=s)?!0:!1};TextLocator.prototype._selectByRect=function(page_number,sel_rect){--page_number;Object(_helpers_arrayHelper__WEBPACK_IMPORTED_MODULE_8__.b)(this._m_Quads);this._m_Texts="";sel_rect.normalize();for(var page_texts=[],all_pages_str="",i,i_1=page_number-1;i_1<page_number+2;i_1++)this._performMiscPageSetup(i_1)&&(page_texts.push({idx:i_1,txt:this._m_Str}),all_pages_str+=this._m_Str);
|
|
1952
|
+
if(0===page_texts.length||0===all_pages_str.length||!this._performMiscPageSetup(page_number))return!1;i_1=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.d;var quad=Array(8),line,lend=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.a;lend.initDefault();var wend=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.e;wend.initDefault();var to_append=[],new_line_start=!1;for(line=this._m_Words.getFirstLine();!line.equal(lend);line=line.getNextLine())if(line.getBBox(i_1),i_1.normalize(),!sel_rect.notIntersect(i_1)){var tmp_selidxs=
|
|
1953
|
+
[null,null],tmp_surrtxts=[null,null],first_selected_glyph_index=-1;var num_chars=-1;for(i=line.getFirstWord();!i.equal(wend);i=i.getNextWord())if(i.getQuad(quad),i_1.setFromQuad(quad),!sel_rect.notIntersect(i_1)){num_chars=i.getStringLen();var str_id=i.getStringPos();-1===first_selected_glyph_index&&(first_selected_glyph_index=str_id);var k=to_append.length;if(0<num_chars&&0<k){new_line_start&&("\n"!==to_append[0]&&(this._isWhitespace(to_append[k-1])?to_append[k-1]="\n":to_append.push("\n")),new_line_start=
|
|
1954
|
+
!1);for(k=0;k<to_append.length;++k)this._m_Texts+=to_append[k];Object(_helpers_arrayHelper__WEBPACK_IMPORTED_MODULE_8__.b)(to_append)}for(k=0;k<=num_chars;++k)str_id+k<this._m_Str.length&&(k<num_chars?this._m_Texts+=this._m_Str.charAt(str_id+k):to_append.push(this._m_Str.charAt(str_id+k)));if(0<num_chars){k=i_1.x2-i_1.x1;var y=i_1.y2-i_1.y1;this._storeQuad(quad,Math.sqrt(k*k+y*y)/num_chars*3)}num_chars=str_id+num_chars}new_line_start=!0;tmp_selidxs[0]=first_selected_glyph_index;for(i=first_selected_glyph_index=
|
|
1955
|
+
0;i<page_texts.length;i++)if(page_texts[i].idx===page_number){first_selected_glyph_index+=tmp_selidxs[0];break}else page_texts[i].idx<page_number&&(first_selected_glyph_index+=page_texts[i].txt.length);tmp_surrtxts[0]=all_pages_str.substring(Math.max(0,first_selected_glyph_index-100),first_selected_glyph_index);if(-1!==num_chars){tmp_selidxs[1]=num_chars;for(i=first_selected_glyph_index=0;i<page_texts.length;i++)if(page_texts[i].idx===page_number){first_selected_glyph_index+=num_chars;break}else page_texts[i].idx<
|
|
1956
|
+
page_number&&(first_selected_glyph_index+=page_texts[i].txt.length);tmp_surrtxts[1]=all_pages_str.substr(first_selected_glyph_index+1,100)}null!==tmp_selidxs[0]&&null!==tmp_selidxs[1]&&this._m_Selidxs.push(tmp_selidxs);null!==tmp_surrtxts[0]&&null!==tmp_surrtxts[1]&&this._m_Surrtxts.push(tmp_surrtxts)}return 0<this._m_Quads.length};TextLocator.prototype._cmptTextDirection=function(){var line,lend=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.a;lend.initDefault();var q1=Array(8),q2=Array(8),histogram=
|
|
1957
|
+
[0,0,0,0];for(line=this._m_Words.getFirstLine();!line.equal(lend);line=line.getNextLine()){var g1=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c,g2=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c,wend=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.e;wend.initDefault();var w1=line.getFirstWord(),w2=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.e;w2.initDefault();for(var word=line.getFirstWord();!word.equal(wend);word=word.getNextWord())w2=word;w1.getGlyphQuad(0,q1);g1.x=(q1[0]+q1[2]+q1[4]+
|
|
1958
|
+
q1[6])/4;g1.y=(q1[1]+q1[3]+q1[5]+q1[7])/4;w2.getGlyphQuad(w2.getNumGlyphs()-1,q2);g2.x=(q2[0]+q2[2]+q2[4]+q2[6])/4;g2.y=(q2[1]+q2[3]+q2[5]+q2[7])/4;wend=_selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c.distance(g1,g2);g1=Math.floor(2*Math.atan2(g2.y-g1.y,g2.x-g1.x)/Math.PI+.5);0>g1&&(g1+=4);histogram[g1]+=wend}line=0;lend=histogram[0];for(q1=1;4>q1;q1++)histogram[q1]>lend&&(line=q1,lend=histogram[q1]);this._m_Direction=90*line;this._m_Horizontal=2>Math.abs(this._m_Direction)||2>Math.abs(this._m_Direction-
|
|
1959
|
+
180)};TextLocator.prototype.selectGlyphsByRect=function(page_idx,sel_rect){Object(_helpers_arrayHelper__WEBPACK_IMPORTED_MODULE_8__.b)(this._m_Quads);this._m_Texts="";sel_rect.normalize();var page_texts=[],all_pages_str="",i;for(i=page_idx-1;i<page_idx+2;i++)this._performMiscPageSetup(i)&&(page_texts.push({idx:i,txt:this._m_Str}),all_pages_str+=this._m_Str);if(0===page_texts.length||0===all_pages_str.length||!this._performMiscPageSetup(page_idx))return!1;var bbox=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.d,
|
|
1960
|
+
quad=Array(8),k,line,lend=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.a;lend.initDefault();var word,wend=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.e;wend.initDefault();var to_append=[],new_line_start=!1;for(line=this._m_Words.getFirstLine();!line.equal(lend);line=line.getNextLine())if(line.getBBox(bbox),bbox.normalize(),!sel_rect.notIntersect(bbox)){var tmp_selidxs=[null,null],tmp_surrtxts=[null,null],last_selected_glyph_index=-1,first_selected_word_on_line=!0;for(word=line.getFirstWord();!word.equal(wend);word=
|
|
1961
|
+
word.getNextWord())if(word.getQuad(quad),bbox.setFromQuad(quad),!sel_rect.notIntersect(bbox)){var num_chars=word.getStringLen();var str_id=word.getStringPos(),sz=to_append.length;if(0<num_chars&&0<sz){new_line_start&&("\n"!==to_append[0]&&(this._isWhitespace(to_append[sz-1])?to_append[sz-1]="\n":to_append.push("\n")),new_line_start=!1);for(i=0;i<to_append.length;++i)this._m_Texts+=to_append[i];Object(_helpers_arrayHelper__WEBPACK_IMPORTED_MODULE_8__.b)(to_append)}sz=0;var front_chop=Array(8),back_chop=
|
|
1962
|
+
Array(8),front_chop_flag=!1,back_chop_flag=!1;for(k=0;k<num_chars;++k){var current_glyph_idx_in_pg_txt=str_id+k;if(current_glyph_idx_in_pg_txt<this._m_Str.length){i=Array(8);var ch_bbox=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.d;word.getGlyphQuad(k,i);ch_bbox.setFromQuad(i);if(sel_rect.notIntersect(ch_bbox))0===sz?front_chop_flag=!0:back_chop_flag=!0;else{last_selected_glyph_index=current_glyph_idx_in_pg_txt;sz++;if(1===sz){if(first_selected_word_on_line){tmp_selidxs[0]=current_glyph_idx_in_pg_txt;
|
|
1963
|
+
for(i=first_selected_word_on_line=0;i<page_texts.length;i++)if(page_texts[i].idx===page_idx){first_selected_word_on_line+=current_glyph_idx_in_pg_txt;break}else page_texts[i].idx<page_idx&&(first_selected_word_on_line+=page_texts[i].txt.length);tmp_surrtxts[0]=all_pages_str.substring(Math.max(0,first_selected_word_on_line-100),first_selected_word_on_line);first_selected_word_on_line=!1}front_chop_flag&&word.getGlyphQuad(k,front_chop)}word.getGlyphQuad(k,back_chop);k<num_chars?this._m_Texts+=this._m_Str.charAt(current_glyph_idx_in_pg_txt):
|
|
1964
|
+
to_append.push(this._m_Str.charAt(current_glyph_idx_in_pg_txt))}}}"\n"!==to_append[num_chars]&&to_append.push(" ");0<sz&&(front_chop_flag&&this._chopQuad(quad,front_chop,!0),back_chop_flag&&this._chopQuad(quad,back_chop,!1),bbox.setFromQuad(quad),num_chars=bbox.x2-bbox.x1,str_id=bbox.y2-bbox.y1,this._storeQuad(quad,Math.sqrt(num_chars*num_chars+str_id*str_id)/sz*3))}new_line_start=!0;if(-1!==last_selected_glyph_index){tmp_selidxs[1]=last_selected_glyph_index;for(i=word=0;i<page_texts.length;i++)if(page_texts[i].idx===
|
|
1965
|
+
page_idx){word+=last_selected_glyph_index;break}else page_texts[i].idx<page_idx&&(word+=page_texts[i].txt.length);tmp_surrtxts[1]=all_pages_str.substr(word+1,100)}null!==tmp_selidxs[0]&&null!==tmp_selidxs[1]&&this._m_Selidxs.push(tmp_selidxs);null!==tmp_surrtxts[0]&&null!==tmp_surrtxts[1]&&this._m_Surrtxts.push(tmp_surrtxts)}return 0<this._m_Quads.length};TextLocator.prototype.getRectangularSelectionFromSurroundingTexts=function(input_page_idx,surrounding_text_pairs,text_to_match){for(var quads=[],
|
|
1966
|
+
output_page_idx=-1,found_text="",i=0;i<surrounding_text_pairs.length;i++){var result=this.getStructuralSelectionFromSurroundingTexts(input_page_idx,surrounding_text_pairs[i][0],surrounding_text_pairs[i][1]);if(result.status)-1!==output_page_idx||void 0===result.pgidx||null===result.pgidx||isNaN(result.pgidx)||(output_page_idx=result.pgidx),result.pgidx===output_page_idx&&Array.prototype.push.apply(quads,result.value),found_text+=this._m_Texts;else break}-1===output_page_idx&&(output_page_idx=0);return 0===
|
|
1967
|
+
quads.length||found_text.replace(/( |\n)/gm,"")!==text_to_match.replace(/( |\n)/gm,"")?{status:!1}:{status:!0,value:quads,pgidx:output_page_idx}};TextLocator.prototype.getStructuralSelectionFromSurroundingTexts=function(page_idx,pre_text,post_text,text_to_match){if(20>=pre_text.length||20>=post_text.length)return{status:!1};var page_texts=[],all_pages_str="",chunk_relative_whitespace_indices=[],remove_whitespace=!0,last_iterated_page_text_end_index=0,i,j;for(i=page_idx-1;i<page_idx+2;i++)if(this._performMiscPageSetup(i))if(page_texts.push({idx:i,
|
|
1968
|
+
txt:this._m_Str}),all_pages_str+=this._m_Str,null!==this._m_Pages[i].text._m_Whitespace_Indices){for(j=0;j<this._m_Pages[i].text._m_Whitespace_Indices.length;j++)chunk_relative_whitespace_indices.push(this._m_Pages[i].text._m_Whitespace_Indices[j]+last_iterated_page_text_end_index);last_iterated_page_text_end_index+=this._m_Str.length}else remove_whitespace=!1;if(0===page_texts.length||0===all_pages_str.length)return{status:!1};last_iterated_page_text_end_index=[];i=0;remove_whitespace?(page_idx=
|
|
1969
|
+
all_pages_str.replace(/( |\n)/gm,""),pre_text=pre_text.replace(/( |\n)/gm,"")):page_idx=all_pages_str;for(;!(0===page_idx.length||page_idx.length<pre_text.length||(j=page_idx.indexOf(pre_text),0>j));)last_iterated_page_text_end_index.push(i+j+pre_text.length),page_idx=page_idx.substr(j+1),i+=j+1;if(0===last_iterated_page_text_end_index.length)return{status:!1};pre_text=[];i=last_iterated_page_text_end_index[0]+1;remove_whitespace?(page_idx=all_pages_str.replace(/( |\n)/gm,"").substring(last_iterated_page_text_end_index[0]+
|
|
1970
|
+
1),post_text=post_text.replace(/( |\n)/gm,"")):page_idx=all_pages_str.substring(last_iterated_page_text_end_index[0]+1);for(;!(0===page_idx.length||page_idx.length<post_text.length||(j=page_idx.indexOf(post_text),0>j));)pre_text.push(i+j),page_idx=page_idx.substr(j+1),i+=j+1;if(0===pre_text.length)return{status:!1};post_text=[];for(i=0;i<last_iterated_page_text_end_index.length;i++)for(page_idx=0;page_idx<pre_text.length;page_idx++)if(last_iterated_page_text_end_index[i]+1<=pre_text[page_idx]&&(j=
|
|
1971
|
+
[],j.push(last_iterated_page_text_end_index[i]),j.push(pre_text[page_idx]),post_text.push(j)),1<post_text.length)return{status:!1};if(1!==post_text.length)return{status:!1};if(remove_whitespace){for(i=0;i<chunk_relative_whitespace_indices.length&&!(post_text[0][0]<chunk_relative_whitespace_indices[i]);i++)post_text[0][0]++;for(i=0;i<chunk_relative_whitespace_indices.length&&!(post_text[0][1]<chunk_relative_whitespace_indices[i]);i++)post_text[0][1]++}remove_whitespace=[0,0];chunk_relative_whitespace_indices=
|
|
1972
|
+
-1;for(i=last_iterated_page_text_end_index=0;i<page_texts.length;i++){pre_text=page_texts[i].txt;if(post_text[0][0]>=last_iterated_page_text_end_index&&post_text[0][0]<last_iterated_page_text_end_index+pre_text.length){chunk_relative_whitespace_indices=page_texts[i].idx;remove_whitespace[0]=post_text[0][0]-last_iterated_page_text_end_index;break}last_iterated_page_text_end_index+=pre_text.length}if(-1===chunk_relative_whitespace_indices)return{status:!1};page_idx=-1;for(i=last_iterated_page_text_end_index=
|
|
1973
|
+
0;i<page_texts.length;i++){pre_text=page_texts[i].txt;if(post_text[0][1]>=last_iterated_page_text_end_index&&post_text[0][1]<last_iterated_page_text_end_index+pre_text.length){page_idx=page_texts[i].idx;remove_whitespace[1]=post_text[0][1]-last_iterated_page_text_end_index;break}last_iterated_page_text_end_index+=pre_text.length}if(-1===page_idx)return{status:!1};if(chunk_relative_whitespace_indices===page_idx){all_pages_str=this.getStructuralSelectionFromTextIndices(chunk_relative_whitespace_indices,
|
|
1974
|
+
remove_whitespace[0],remove_whitespace[1]-1);if(all_pages_str.status){if(text_to_match&&this._m_Texts.replace(/( |\n)/gm,"")!==text_to_match.replace(/( |\n)/gm,""))return{status:!1};all_pages_str.pgidx=chunk_relative_whitespace_indices;return all_pages_str}return{status:!1}}for(i=0;i<page_texts.length&&page_texts[i].idx!==chunk_relative_whitespace_indices;i++);page_texts=this.getStructuralSelectionFromTextIndices(chunk_relative_whitespace_indices,remove_whitespace[0],page_texts[i].txt.length-1);this._m_Texts=
|
|
1975
|
+
all_pages_str.substring(post_text[0][0],post_text[0][1]);if(page_texts.status){if(text_to_match&&this._m_Texts.replace(/( |\n)/gm,"")!==text_to_match.replace(/( |\n)/gm,""))return{status:!1};page_texts.pgidx=chunk_relative_whitespace_indices;return page_texts}return{status:!1}};TextLocator.prototype.getRectangularSelectionFromTextIndices=function(page_idx,index_pairs,text_to_match){for(var quads=[],found_text="",i=0;i<index_pairs.length;i++){var i1=Number(index_pairs[i][0]),i2=Number(index_pairs[i][1]);
|
|
1976
|
+
if(isNaN(i1)||isNaN(i2))return Object(logger__WEBPACK_IMPORTED_MODULE_0__.f)("getRectangularSelectionFromTextIndices: could not parse index-based selectors as numbers."),{status:!1};i1=this.getStructuralSelectionFromTextIndices(page_idx,i1,i2);if(i1.status)Array.prototype.push.apply(quads,i1.value),found_text+=this._m_Texts;else return{status:!1}}return 0===quads.length||found_text.replace(/( |\n)/gm,"")!==text_to_match.replace(/( |\n)/gm,"")?{status:!1}:{status:!0,value:quads}};TextLocator.prototype.getStructuralSelectionFromTextIndices=
|
|
1977
|
+
function(page_idx,start_index,end_index,text_to_match){if(!this._performMiscPageSetup(page_idx))return{status:!1};var wend=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.e;wend.initDefault();page_idx=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.a;page_idx.initDefault();this._m_Texts=this._m_Str.substring(start_index,Math.min(end_index+1,this._m_Str.length));if(text_to_match&&this._m_Texts.replace(/( |\n)/gm,"")!==text_to_match.replace(/( |\n)/gm,""))return{status:!1};text_to_match=0;for(var first_line_in_block,
|
|
1978
|
+
last_line_in_block;;){if(text_to_match>=this._m_Blocks.length)return{status:!1};first_line_in_block=this._m_Blocks[text_to_match]._m_first_line;last_line_in_block=this._m_Blocks[text_to_match]._m_last_line;if(last_line_in_block.getLastWord().getStringPos()+last_line_in_block.getLastWord().getNumGlyphs()>=start_index&&first_line_in_block.getFirstWord().getStringPos()<=start_index)break;text_to_match++}for(var start_block=this._m_Blocks[text_to_match],start_line=start_block._m_first_line;;){if(start_line.equal(page_idx))return{status:!1};
|
|
1979
|
+
if(this._sameDirection(start_line.getDirection())){if(start_line.getLastWord().getStringPos()+start_line.getLastWord().getNumGlyphs()>=start_index&&start_line.getFirstWord().getStringPos()<=start_index)break;if(start_line.equal(start_block._m_last_line)||start_line.equal(page_idx))return{status:!1};start_line=start_line.getNextLine()}}for(var start_word=start_line.getFirstWord();;){if(start_word.equal(wend))return{status:!1};if(start_word.getStringPos()+start_word.getNumGlyphs()>=start_index&&start_word.getStringPos()<=
|
|
1980
|
+
start_index)break;start_word=start_word.getNextWord()}for(var end_block_idx=0;;){if(end_block_idx>=this._m_Blocks.length)return{status:!1};first_line_in_block=this._m_Blocks[end_block_idx]._m_first_line;last_line_in_block=this._m_Blocks[end_block_idx]._m_last_line;if(last_line_in_block.getLastWord().getStringPos()+last_line_in_block.getLastWord().getNumGlyphs()>=end_index&&first_line_in_block.getFirstWord().getStringPos()<=end_index)break;end_block_idx++}for(var end_line=this._m_Blocks[end_block_idx]._m_first_line;;){if(end_line.equal(page_idx))return{status:!1};
|
|
1981
|
+
if(this._sameDirection(end_line.getDirection())){if(end_line.getLastWord().getStringPos()+end_line.getLastWord().getNumGlyphs()>=end_index&&end_line.getFirstWord().getStringPos()<=end_index)break;if(end_line.equal(start_block._m_last_line))return{status:!1};end_line=end_line.getNextLine()}}for(start_block=end_line.getFirstWord();;){if(start_block.equal(wend))return{status:!1};if(start_block.getStringPos()+start_block.getNumGlyphs()>=end_index&&start_block.getStringPos()<=end_index)break;start_block=
|
|
1982
|
+
start_block.getNextWord()}wend=[];for(var rect=Array(4),blocknum=text_to_match;blocknum<=end_block_idx;blocknum++)if(first_line_in_block=this._m_Blocks[blocknum]._m_first_line,last_line_in_block=this._m_Blocks[blocknum]._m_last_line,blocknum===text_to_match&&blocknum!==end_block_idx)for(first_line_in_block=start_line;!first_line_in_block.equal(page_idx);first_line_in_block=first_line_in_block.getNextLine()){if(this._sameDirection(first_line_in_block.getDirection())){var temp_quad=Array(8);first_line_in_block.equal(start_line)?
|
|
1983
|
+
start_word.getGlyphQuadInWordQuadFormat(Math.min(start_index-start_word.getStringPos(),start_word.getNumGlyphs()-1),temp_quad):(first_line_in_block.getFirstWord().getBBox(rect),temp_quad[0]=rect[0],temp_quad[1]=rect[3],temp_quad[6]=rect[0],temp_quad[7]=rect[1]);first_line_in_block.getLastWord().getBBox(rect);temp_quad[2]=rect[2];temp_quad[3]=rect[3];temp_quad[4]=rect[2];temp_quad[5]=rect[1];wend.push(temp_quad);if(first_line_in_block.equal(last_line_in_block))break}}else if(blocknum!==text_to_match&&
|
|
1984
|
+
blocknum===end_block_idx)for(;;first_line_in_block=first_line_in_block.getNextLine()){if(first_line_in_block.equal(page_idx))return{status:!1};if(this._sameDirection(first_line_in_block.getDirection())&&(temp_quad=Array(8),first_line_in_block.equal(end_line)?start_block.getGlyphQuadInWordQuadFormat(Math.min(end_index-start_block.getStringPos(),start_block.getNumGlyphs()-1),temp_quad):(first_line_in_block.getLastWord().getBBox(rect),temp_quad[2]=rect[2],temp_quad[3]=rect[3],temp_quad[4]=rect[2],temp_quad[5]=
|
|
1985
|
+
rect[1]),first_line_in_block.getFirstWord().getBBox(rect),temp_quad[0]=rect[0],temp_quad[1]=rect[3],temp_quad[6]=rect[0],temp_quad[7]=rect[1],wend.push(temp_quad),first_line_in_block.equal(end_line)))break}else if(blocknum===text_to_match&&blocknum===end_block_idx)for(first_line_in_block=start_line;;first_line_in_block=first_line_in_block.getNextLine()){if(first_line_in_block.equal(page_idx))return{status:!1};if(this._sameDirection(first_line_in_block.getDirection())&&(temp_quad=Array(8),first_line_in_block.equal(start_line)&&
|
|
1986
|
+
!first_line_in_block.equal(end_line)?(start_word.getGlyphQuadInWordQuadFormat(Math.min(start_index-start_word.getStringPos(),start_word.getNumGlyphs()-1),temp_quad),first_line_in_block.getLastWord().getBBox(rect),temp_quad[2]=rect[2],temp_quad[3]=rect[3],temp_quad[4]=rect[2],temp_quad[5]=rect[1]):!first_line_in_block.equal(start_line)&&first_line_in_block.equal(end_line)?(start_block.getGlyphQuadInWordQuadFormat(Math.min(end_index-start_block.getStringPos(),start_block.getNumGlyphs()-1),temp_quad),
|
|
1987
|
+
first_line_in_block.getFirstWord().getBBox(rect),temp_quad[0]=rect[0],temp_quad[1]=rect[3],temp_quad[6]=rect[0],temp_quad[7]=rect[1]):first_line_in_block.equal(start_line)&&first_line_in_block.equal(end_line)?(start_word.getGlyphQuadInWordQuadFormat(Math.min(start_index-start_word.getStringPos(),start_word.getNumGlyphs()-1),temp_quad),rect[0]=temp_quad[6],rect[1]=temp_quad[7],rect[2]=temp_quad[2],rect[3]=temp_quad[3],start_block.getGlyphQuadInWordQuadFormat(Math.min(end_index-start_block.getStringPos(),
|
|
1988
|
+
start_block.getNumGlyphs()-1),temp_quad),temp_quad[0]=rect[0],temp_quad[1]=rect[3],temp_quad[6]=rect[0],temp_quad[7]=rect[1]):(first_line_in_block.getFirstWord().getBBox(rect),temp_quad[0]=rect[0],temp_quad[1]=rect[3],temp_quad[6]=rect[0],temp_quad[7]=rect[1],first_line_in_block.getLastWord().getBBox(rect),temp_quad[2]=rect[2],temp_quad[3]=rect[3],temp_quad[4]=rect[2],temp_quad[5]=rect[1]),wend.push(temp_quad),first_line_in_block.equal(end_line)))break}else for(;!(first_line_in_block.equal(page_idx)||
|
|
1989
|
+
this._sameDirection(first_line_in_block.getDirection())&&(temp_quad=Array(8),first_line_in_block.getFirstWord().getBBox(rect),temp_quad[0]=rect[0],temp_quad[1]=rect[3],temp_quad[6]=rect[0],temp_quad[7]=rect[1],first_line_in_block.getLastWord().getBBox(rect),temp_quad[2]=rect[2],temp_quad[3]=rect[3],temp_quad[4]=rect[2],temp_quad[5]=rect[1],wend.push(temp_quad),first_line_in_block.equal(last_line_in_block)));first_line_in_block=first_line_in_block.getNextLine());return{status:!0,value:wend}};TextLocator.prototype.selectByStruct=
|
|
1990
|
+
function(page_idx,sel_rect){Object(_helpers_arrayHelper__WEBPACK_IMPORTED_MODULE_8__.b)(this._m_Quads);this._m_Texts="";for(var page_texts=[],all_pages_str="",i_3=page_idx-1;i_3<page_idx+2;i_3++)this._performMiscPageSetup(i_3)&&(page_texts.push({idx:i_3,txt:this._m_Str}),all_pages_str+=this._m_Str);if(0===page_texts.length||0===all_pages_str.length||!this._performMiscPageSetup(page_idx))return!1;var min_dist1;i_3=Array(8);var qq=Array(8),b=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.d,min_line_dist1=
|
|
1991
|
+
new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.a,min_line_dist2=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.a;min_line_dist1.initDefault();min_line_dist2.initDefault();var is_horiz_line1=this._m_Horizontal,is_horiz_line2=this._m_Horizontal,lend=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.a;lend.initDefault();var wend=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.e;wend.initDefault();var tmpPoint1=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c;tmpPoint1.init(sel_rect.x1,sel_rect.y1);
|
|
1992
|
+
var sel_pt1_y=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c;sel_pt1_y.init(sel_rect.x2,sel_rect.y2);tmpPoint1=this._findStructuralBounds(tmpPoint1,sel_pt1_y,min_line_dist1,min_line_dist2);min_line_dist1=tmpPoint1._first_line;min_line_dist2=tmpPoint1._last_line;if(min_line_dist1.equal(lend)||min_line_dist2.equal(lend))return!1;var min_w1=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.e;tmpPoint1=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.e;min_w1.initDefault();tmpPoint1.initDefault();var min_dist2=
|
|
1993
|
+
min_dist1=_selectionInfo_constants__WEBPACK_IMPORTED_MODULE_1__.a.MAX;for(var word=min_line_dist1.getFirstWord();!word.equal(wend);word=word.getNextWord()){word.getBBox(i_3);if(is_horiz_line1){var sel_pt1_x=sel_rect.x1;sel_pt1_y=sel_rect.y1}else sel_pt1_y=i_3[0],i_3[0]=i_3[1],i_3[1]=sel_pt1_y,sel_pt1_y=i_3[2],i_3[2]=i_3[3],i_3[3]=sel_pt1_y,sel_pt1_x=sel_rect.y1,sel_pt1_y=sel_rect.x1;var d=(i_3[3]+i_3[1])/2;if(i_3[2]<=sel_pt1_x){var xd=i_3[2]-sel_pt1_x;d-=sel_pt1_y;d=xd*xd+d*d}else i_3[0]>=sel_pt1_x?
|
|
1994
|
+
(xd=i_3[0]-sel_pt1_x,d-=sel_pt1_y,d=xd*xd+d*d):(d-=sel_pt1_y,d*=d);d<min_dist1&&(min_dist1=d,min_w1=word)}for(word=min_line_dist2.getFirstWord();!word.equal(wend);word=word.getNextWord())word.getBBox(i_3),is_horiz_line2?(sel_pt1_x=sel_rect.x2,sel_pt1_y=sel_rect.y2):(sel_pt1_y=i_3[0],i_3[0]=i_3[1],i_3[1]=sel_pt1_y,sel_pt1_y=i_3[2],i_3[2]=i_3[3],i_3[3]=sel_pt1_y,sel_pt1_x=sel_rect.y2,sel_pt1_y=sel_rect.x2),d=(i_3[3]+i_3[1])/2,i_3[2]<=sel_pt1_x?(xd=i_3[2]-sel_pt1_x,d-=sel_pt1_y,d=xd*xd+d*d):i_3[0]>=
|
|
1995
|
+
sel_pt1_x?(xd=i_3[0]-sel_pt1_x,d-=sel_pt1_y,d=xd*xd+d*d):(d-=sel_pt1_y,d*=d),d<min_dist2&&(min_dist2=d,tmpPoint1=word);if(min_w1.equal(wend)||tmpPoint1.equal(wend))return!1;sel_pt1_y=word=0;min_dist2=min_dist1=_selectionInfo_constants__WEBPACK_IMPORTED_MODULE_1__.a.MAX;var gnum=min_w1.getNumGlyphs();for(sel_pt1_x=0;sel_pt1_x<gnum;++sel_pt1_x)min_w1.getGlyphQuad(sel_pt1_x,i_3),xd=(i_3[0]+i_3[2]+i_3[4]+i_3[6])/4,d=(i_3[1]+i_3[3]+i_3[5]+i_3[7])/4,xd-=sel_rect.x1,d-=sel_rect.y1,d=xd*xd+d*d,d<min_dist1&&
|
|
1996
|
+
(min_dist1=d,word=sel_pt1_x);gnum=tmpPoint1.getNumGlyphs();for(sel_pt1_x=0;sel_pt1_x<gnum;++sel_pt1_x)tmpPoint1.getGlyphQuad(sel_pt1_x,i_3),xd=(i_3[0]+i_3[2]+i_3[4]+i_3[6])/4,d=(i_3[1]+i_3[3]+i_3[5]+i_3[7])/4,xd-=sel_rect.x2,d-=sel_rect.y2,d=xd*xd+d*d,d<min_dist2&&(min_dist2=d,sel_pt1_y=sel_pt1_x);min_dist1=word+min_w1.getStringPos();min_dist2=sel_pt1_y+tmpPoint1.getStringPos();min_dist2<min_dist1&&(sel_pt1_x=min_dist1,min_dist1=min_dist2,min_dist2=sel_pt1_x);this._m_Selidxs.push([min_dist1,min_dist2]);
|
|
1997
|
+
d=[null,null];for(sel_pt1_x=xd=0;sel_pt1_x<page_texts.length;sel_pt1_x++)if(page_texts[sel_pt1_x].idx===page_idx){xd+=min_dist1;break}else page_texts[sel_pt1_x].idx<page_idx&&(xd+=page_texts[sel_pt1_x].txt.length);d[0]=all_pages_str.substring(Math.max(0,xd-100),xd);for(sel_pt1_x=min_dist1=0;sel_pt1_x<page_texts.length;sel_pt1_x++)if(page_texts[sel_pt1_x].idx===page_idx){min_dist1+=min_dist2;break}else page_texts[sel_pt1_x].idx<page_idx&&(min_dist1+=page_texts[sel_pt1_x].txt.length);d[1]=all_pages_str.substr(min_dist1+
|
|
1998
|
+
1,100);null!==d[0]&&null!==d[1]&&this._m_Surrtxts.push(d);all_pages_str=min_line_dist1.getCurrentNum();min_dist2=min_line_dist2.getCurrentNum();page_idx=min_w1.getCurrentNum();page_texts=tmpPoint1.getCurrentNum();if(all_pages_str===min_dist2){page_idx>page_texts&&(all_pages_str=min_w1,min_w1=tmpPoint1,tmpPoint1=all_pages_str,all_pages_str=word,word=sel_pt1_y,sel_pt1_y=all_pages_str);min_line_dist1.getBBox(b);if(page_idx===page_texts&&word===sel_pt1_y&&(all_pages_str=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.d,
|
|
1999
|
+
!all_pages_str.intersectRect(b,sel_rect)))return!1;page_idx===page_texts?(sel_pt1_y<word&&(all_pages_str=word,word=sel_pt1_y,sel_pt1_y=all_pages_str),all_pages_str=sel_pt1_y):all_pages_str=min_w1.getStringLen();min_w1.getGlyphQuad(word,i_3);Object(logger__WEBPACK_IMPORTED_MODULE_0__.a)(is_horiz_line1===is_horiz_line2);is_horiz_line2=min_w1.getStringPos();Object(logger__WEBPACK_IMPORTED_MODULE_0__.a)(word<=all_pages_str);for(is_horiz_line1=word;is_horiz_line1<=all_pages_str;++is_horiz_line1)is_horiz_line2+
|
|
2000
|
+
is_horiz_line1<this._m_Str.length&&(this._m_Texts+=this._m_Str.charAt(is_horiz_line2+is_horiz_line1));0<=all_pages_str&&(min_w1.getQuad(qq),is_horiz_line1=qq[0]-qq[2],is_horiz_line2=qq[1]-qq[3],is_horiz_line1=Math.sqrt(is_horiz_line1*is_horiz_line1+is_horiz_line2*is_horiz_line2),is_horiz_line1=is_horiz_line1/(all_pages_str+1)*3,this._chopQuad(qq,i_3,!0),page_idx===page_texts&&(sel_rect=Array(8),tmpPoint1.getGlyphQuad(sel_pt1_y,sel_rect),this._chopQuad(qq,sel_rect,!1)),this._storeQuad(qq,is_horiz_line1));
|
|
2001
|
+
for(word=min_w1=min_w1.getNextWord();!word.equal(wend)&&word.getCurrentNum()<tmpPoint1.getCurrentNum();word=word.getNextWord()){all_pages_str=word.getStringLen();sel_rect=word.getStringPos();for(is_horiz_line1=0;is_horiz_line1<=all_pages_str;++is_horiz_line1)sel_rect+is_horiz_line1<this._m_Str.length&&(this._m_Texts+=this._m_Str.charAt(sel_rect+is_horiz_line1));0<all_pages_str&&(word.getQuad(qq),is_horiz_line1=qq[0]-qq[2],is_horiz_line2=qq[1]-qq[3],is_horiz_line1=Math.sqrt(is_horiz_line1*is_horiz_line1+
|
|
2002
|
+
is_horiz_line2*is_horiz_line2),is_horiz_line1=is_horiz_line1/all_pages_str*3,this._storeQuad(qq,is_horiz_line1))}tmpPoint1.getGlyphQuad(sel_pt1_y,i_3);all_pages_str=tmpPoint1.getStringLen();if(page_idx!==page_texts){wend=tmpPoint1.getStringPos();Object(logger__WEBPACK_IMPORTED_MODULE_0__.a)(sel_pt1_y<=all_pages_str);for(is_horiz_line1=0;is_horiz_line1<=sel_pt1_y;++is_horiz_line1)wend+is_horiz_line1<this._m_Str.length&&(this._m_Texts+=this._m_Str.charAt(wend+is_horiz_line1));0<all_pages_str&&(tmpPoint1.getQuad(qq),
|
|
2003
|
+
is_horiz_line1=qq[0]-qq[2],is_horiz_line2=qq[1]-qq[3],is_horiz_line1=Math.sqrt(is_horiz_line1*is_horiz_line1+is_horiz_line2*is_horiz_line2),is_horiz_line1=is_horiz_line1/all_pages_str*3,this._chopQuad(qq,i_3,!1),this._storeQuad(qq,is_horiz_line1))}}else{all_pages_str>min_dist2&&(is_horiz_line1=min_line_dist1,min_line_dist1=min_line_dist2,min_line_dist2=is_horiz_line1,all_pages_str=min_w1,min_w1=tmpPoint1,tmpPoint1=all_pages_str,all_pages_str=word,word=sel_pt1_y,sel_pt1_y=all_pages_str);min_line_dist1.getBBox(b);
|
|
2004
|
+
all_pages_str=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.d;all_pages_str.intersectRect(b,sel_rect)||(min_w1=min_line_dist1.getFirstWord(),word=0);min_w1.getGlyphQuad(word,i_3);all_pages_str=min_w1.getStringLen();is_horiz_line2=min_w1.getStringPos();Object(logger__WEBPACK_IMPORTED_MODULE_0__.a)(word<=all_pages_str);for(is_horiz_line1=word;is_horiz_line1<=all_pages_str;++is_horiz_line1)is_horiz_line2+is_horiz_line1<this._m_Str.length&&(this._m_Texts+=this._m_Str.charAt(is_horiz_line2+is_horiz_line1));
|
|
2005
|
+
0<all_pages_str&&(min_w1.getQuad(qq),is_horiz_line1=qq[0]-qq[2],is_horiz_line2=qq[1]-qq[3],is_horiz_line1=Math.sqrt(is_horiz_line1*is_horiz_line1+is_horiz_line2*is_horiz_line2),is_horiz_line1=is_horiz_line1/all_pages_str*3,this._chopQuad(qq,i_3,!0),this._storeQuad(qq,is_horiz_line1));for(word=min_w1=min_w1.getNextWord();!word.equal(wend);word=word.getNextWord()){all_pages_str=word.getStringLen();min_w1=word.getStringPos();for(is_horiz_line1=0;is_horiz_line1<=all_pages_str;++is_horiz_line1)min_w1+
|
|
2006
|
+
is_horiz_line1<this._m_Str.length&&(this._m_Texts+=this._m_Str.charAt(min_w1+is_horiz_line1));0<all_pages_str&&(word.getQuad(qq),is_horiz_line1=qq[0]-qq[2],is_horiz_line2=qq[1]-qq[3],is_horiz_line1=Math.sqrt(is_horiz_line1*is_horiz_line1+is_horiz_line2*is_horiz_line2),is_horiz_line1=is_horiz_line1/all_pages_str*3,this._storeQuad(qq,is_horiz_line1))}for(min_line_dist1=min_line_dist1.getNextLine();!min_line_dist1.equal(min_line_dist2)&&!min_line_dist1.equal(lend);min_line_dist1=min_line_dist1.getNextLine())if(this._sameDirection(min_line_dist1.getDirection()))for(min_line_dist1.getBBox(b),
|
|
2007
|
+
word=min_line_dist1.getFirstWord();!word.equal(wend);word=word.getNextWord()){all_pages_str=word.getStringLen();min_w1=word.getStringPos();for(is_horiz_line1=0;is_horiz_line1<=all_pages_str;++is_horiz_line1)min_w1+is_horiz_line1<this._m_Str.length&&(this._m_Texts+=this._m_Str.charAt(min_w1+is_horiz_line1));0<all_pages_str&&(word.getQuad(qq),is_horiz_line1=qq[0]-qq[2],is_horiz_line2=qq[1]-qq[3],is_horiz_line1=Math.sqrt(is_horiz_line1*is_horiz_line1+is_horiz_line2*is_horiz_line2),is_horiz_line1=is_horiz_line1/
|
|
2008
|
+
all_pages_str*3,this._storeQuad(qq,is_horiz_line1))}min_line_dist2.getBBox(b);all_pages_str=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.d;all_pages_str.intersectRect(b,sel_rect)||(tmpPoint1=min_line_dist2.getWord(min_line_dist2.getNumWords()-1),sel_pt1_y=tmpPoint1.getNumGlyphs()-1);for(word=min_line_dist2.getFirstWord();!word.equal(wend)&&!word.equal(tmpPoint1);word=word.getNextWord()){all_pages_str=word.getStringLen();sel_rect=word.getStringPos();for(is_horiz_line1=0;is_horiz_line1<=all_pages_str;++is_horiz_line1)sel_rect+
|
|
2009
|
+
is_horiz_line1<this._m_Str.length&&(this._m_Texts+=this._m_Str.charAt(sel_rect+is_horiz_line1));0<all_pages_str&&(word.getQuad(qq),is_horiz_line1=qq[0]-qq[2],is_horiz_line2=qq[1]-qq[3],is_horiz_line1=Math.sqrt(is_horiz_line1*is_horiz_line1+is_horiz_line2*is_horiz_line2),is_horiz_line1=is_horiz_line1/all_pages_str*3,this._storeQuad(qq,is_horiz_line1))}tmpPoint1.getGlyphQuad(sel_pt1_y,i_3);all_pages_str=tmpPoint1.getStringLen();is_horiz_line2=tmpPoint1.getStringPos();Object(logger__WEBPACK_IMPORTED_MODULE_0__.a)(sel_pt1_y<=
|
|
2010
|
+
all_pages_str);for(is_horiz_line1=0;is_horiz_line1<=sel_pt1_y;++is_horiz_line1)is_horiz_line2+is_horiz_line1<this._m_Str.length&&(this._m_Texts+=this._m_Str.charAt(is_horiz_line2+is_horiz_line1));0<all_pages_str&&(tmpPoint1.getQuad(qq),is_horiz_line1=qq[0]-qq[2],is_horiz_line2=qq[1]-qq[3],is_horiz_line1=Math.sqrt(is_horiz_line1*is_horiz_line1+is_horiz_line2*is_horiz_line2),is_horiz_line1=is_horiz_line1/all_pages_str*3,this._chopQuad(qq,i_3,!1),this._storeQuad(qq,is_horiz_line1))}return 0<this._m_Quads.length};
|
|
2011
|
+
TextLocator.prototype._performMiscPageSetup=function(page_idx){if(0>page_idx||page_idx>=this._m_Pages.length)return!1;if(0>=this._m_PrePage||this._m_PrePage!==page_idx){var spi=this._m_Pages[page_idx].text;if(null==spi||!spi.ready())return!1;this._m_Words=spi;this._m_Str=this._m_Words.getStr();this._cmptTextDirection();this._cmptBlocks();this._m_PrePage=page_idx}return!0};TextLocator.prototype._storeQuad=function(quad,tra_thresh){var sz=this._m_Quads.length/8;if(sz){var des_q=Array(8);sz=8*(sz-1);
|
|
2012
|
+
for(i=0;8>i;++i)des_q[i]=this._m_Quads[sz+i];if(_Quad__WEBPACK_IMPORTED_MODULE_2__.a._merge(des_q,quad,1,!0,tra_thresh))for(i=0;8>i;++i)this._m_Quads[sz+i]=des_q[i];else for(i=0;8>i;++i)this._m_Quads.push(quad[i])}else for(var i=0;8>i;++i)this._m_Quads.push(quad[i])};TextLocator.prototype._chopQuad=function(word_quad_to_be_chopped,quad_of_first_or_last_glyph_in_word,is_glyph_first_glyph_in_word){var bottom_left_of_word=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c;bottom_left_of_word.init(word_quad_to_be_chopped[0],
|
|
2013
|
+
word_quad_to_be_chopped[1]);var bottom_right_of_word=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c;bottom_right_of_word.init(word_quad_to_be_chopped[2],word_quad_to_be_chopped[3]);var distance_between_word_start_and_end=_selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c.minus(bottom_right_of_word,bottom_left_of_word);distance_between_word_start_and_end.normalize()&&(is_glyph_first_glyph_in_word?(bottom_right_of_word=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c,bottom_right_of_word.init(quad_of_first_or_last_glyph_in_word[0],
|
|
2014
|
+
quad_of_first_or_last_glyph_in_word[1]),quad_of_first_or_last_glyph_in_word=_selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c.minus(bottom_right_of_word,bottom_left_of_word).dot(distance_between_word_start_and_end),distance_between_word_start_and_end=_selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c.multiply(distance_between_word_start_and_end,quad_of_first_or_last_glyph_in_word),word_quad_to_be_chopped[0]+=distance_between_word_start_and_end.x,word_quad_to_be_chopped[1]+=distance_between_word_start_and_end.y,
|
|
2015
|
+
word_quad_to_be_chopped[6]+=distance_between_word_start_and_end.x,word_quad_to_be_chopped[7]+=distance_between_word_start_and_end.y):(bottom_left_of_word=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c,bottom_left_of_word.init(quad_of_first_or_last_glyph_in_word[2],quad_of_first_or_last_glyph_in_word[3]),quad_of_first_or_last_glyph_in_word=_selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c.minus(bottom_left_of_word,bottom_right_of_word).dot(distance_between_word_start_and_end),distance_between_word_start_and_end=
|
|
2016
|
+
_selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c.multiply(distance_between_word_start_and_end,quad_of_first_or_last_glyph_in_word),word_quad_to_be_chopped[2]+=distance_between_word_start_and_end.x,word_quad_to_be_chopped[3]+=distance_between_word_start_and_end.y,word_quad_to_be_chopped[4]+=distance_between_word_start_and_end.x,word_quad_to_be_chopped[5]+=distance_between_word_start_and_end.y))};TextLocator.prototype._getTextRotationMatrix=function(angle){var m0=_Matrix2D__WEBPACK_IMPORTED_MODULE_3__.a.rotationMatrix(0),
|
|
2017
|
+
m90=_Matrix2D__WEBPACK_IMPORTED_MODULE_3__.a.rotationMatrix(1.570796325),m180=_Matrix2D__WEBPACK_IMPORTED_MODULE_3__.a.rotationMatrix(3.14159265),m270=_Matrix2D__WEBPACK_IMPORTED_MODULE_3__.a.rotationMatrix(3.14159265*1.5);switch(parseInt(angle/90+.1,10)){case 0:return m0;case 1:return m90;case 2:return m180;case 3:return m270;case 4:return m0;default:return m0}};TextLocator.prototype._sameDirection=function(){return!0};TextLocator.prototype._transformToNormalFlow=function(box,angle){angle=this._getTextRotationMatrix(angle);
|
|
2018
|
+
var tmpPoint2D=new _Point2D__WEBPACK_IMPORTED_MODULE_5__.a(box.x1,box.y1);tmpPoint2D=angle.mult(tmpPoint2D);box.x1=tmpPoint2D.x;box.y1=tmpPoint2D.y;tmpPoint2D=new _Point2D__WEBPACK_IMPORTED_MODULE_5__.a(box.x2,box.y2);tmpPoint2D=angle.mult(tmpPoint2D);box.x2=tmpPoint2D.x;box.y2=tmpPoint2D.y;box.normalize()};TextLocator.prototype._cmptBlocks=function(){Object(_helpers_arrayHelper__WEBPACK_IMPORTED_MODULE_8__.b)(this._m_Blocks);var line,end=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.a;end.initDefault();
|
|
2019
|
+
var b=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.d,current_block=new _TextSelectionBlock__WEBPACK_IMPORTED_MODULE_4__.a,block_initialized=!1;for(line=this._m_Words.getFirstLine();!line.equal(end);line=line.getNextLine())if(this._sameDirection(line.getDirection())){line.getBBox(b);b.normalize();var orig_box=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.d;orig_box.initRect(b);this._transformToNormalFlow(b,this._m_Direction);block_initialized?(this._m_Blocks.push(current_block),current_block=
|
|
2020
|
+
new _TextSelectionBlock__WEBPACK_IMPORTED_MODULE_4__.a,current_block._m_bbox.initRect(orig_box),current_block._m_transformed_bbox.initRect(b),current_block._m_first_line=line,current_block._m_last_line=line):(current_block._m_bbox.initRect(orig_box),current_block._m_transformed_bbox.initRect(b),current_block._m_first_line=line,current_block._m_last_line=line,block_initialized=!0)}block_initialized&&this._m_Blocks.push(current_block)};TextLocator.prototype._findLineByPoint=function(block,pt,out_line){out_line=
|
|
2021
|
+
_selectionInfo_constants__WEBPACK_IMPORTED_MODULE_1__.a.MAX;for(var b=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.d,best_line=block._m_first_line,line=block._m_first_line;;line=line.getNextLine()){if(!this._sameDirection(line.getDirection()))if(line.equal(block._m_last_line))break;else continue;line.getBBox(b);this._transformToNormalFlow(b,this._m_Direction);var ycenter=(b.y1+b.y2)/2;Math.abs(ycenter-pt.y)<out_line&&(best_line=line,out_line=Math.abs(ycenter-pt.y));if(line.equal(block._m_last_line))break}return out_line=
|
|
2022
|
+
best_line};TextLocator.prototype.Dist2LineSegmentSquared=function(x1,x2,p){var v=_selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c.minus(x2,x1),w=_selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c.minus(p,x1),c1=w.dot(v);if(0>=c1)return w.dot(w);w=v.dot(v);if(w<=c1)return p=_selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c.minus(p,x2),p.dot(p);x1=_selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c.plus(x1,_selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c.multiply(v,c1/w));p=_selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c.minus(p,
|
|
2023
|
+
x1);return p.dot(p)};TextLocator.prototype.Dist2BBox=function(pt,bbox){var d1=this.Dist2LineSegmentSquared(new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c(bbox.x1,bbox.y1),new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c(bbox.x2,bbox.y1),pt),d2=this.Dist2LineSegmentSquared(new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c(bbox.x2,bbox.y1),new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c(bbox.x2,bbox.y2),pt),d3=this.Dist2LineSegmentSquared(new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c(bbox.x2,
|
|
2024
|
+
bbox.y2),new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c(bbox.x1,bbox.y2),pt);pt=this.Dist2LineSegmentSquared(new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c(bbox.x1,bbox.y2),new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c(bbox.x1,bbox.y1),pt);return Math.min(d1,d2,d3,pt)};TextLocator.prototype._findStructuralBounds=function(pt1,pt2,first_line,last_line){var start_block_matched=-1,end_block_matched=-1,end_block_precise=!1,start_block_precise=!1,rmx=this._getTextRotationMatrix(this._m_Direction),
|
|
2025
|
+
p1=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c,p2=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c;p1.initPoint(pt1);p2.initPoint(pt2);pt1=new _Point2D__WEBPACK_IMPORTED_MODULE_5__.a(p1.x,p1.y);pt1=rmx.mult(pt1);p1.x=pt1.x;p1.y=pt1.y;pt1=new _Point2D__WEBPACK_IMPORTED_MODULE_5__.a(p2.x,p2.y);pt1=rmx.mult(pt1);p2.x=pt1.x;p2.y=pt1.y;pt2=0;for(var sz=this._m_Blocks.length;pt2<sz;++pt2)rmx=this._m_Blocks[pt2],0>start_block_matched&&rmx._m_transformed_bbox.contains(p1.x,p1.y)&&(start_block_matched=
|
|
2026
|
+
pt2,start_block_precise=!0),0>end_block_matched&&rmx._m_transformed_bbox.contains(p2.x,p2.y)&&(end_block_matched=pt2,end_block_precise=!0);if(!start_block_precise||!end_block_precise){rmx=[];for(pt1=0;pt1<this._m_Blocks.length;++pt1)rmx.push(0);pt1=Math.max(start_block_matched,end_block_matched);var sel=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.d;sel.initCoordinates(p1.x,p1.y,p2.x,p2.y);sel.inflateSquare(.1);0<=pt1&&sel.union(this._m_Blocks[pt1]._m_transformed_bbox);var rtmp=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.d;
|
|
2027
|
+
pt2=0;for(sz=this._m_Blocks.length;pt2<sz;++pt2){var box=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.d;box.initRect(this._m_Blocks[pt2]._m_transformed_bbox);rtmp.intersectRect(box,sel)&&(rmx[pt2]=1)}sz=rmx.indexOf(1);for(sel=pt2=rmx.indexOf(1);-1!==pt2;){sel=pt2;pt2++;if(pt2>=rmx.length)break;pt2=rmx.indexOf(1,pt2)}if(0>sz)return new _ResultFindStructuralBounds__WEBPACK_IMPORTED_MODULE_6__.a(first_line,last_line);rmx=pt2=!1;rtmp=Math.max.apply(Math,this._m_Blocks.map(function(b){return b._m_bbox.y2}));
|
|
2028
|
+
box=this._m_Pages[this._m_PrePage];void 0!==box.x2&&void 0!==box.y2&&(pt2=Math.round(p2.x)>=Math.round(box.x2)&&Math.round(p2.y)>=Math.round(box.y2),rmx=0===p1.x&&0===p1.y,p2.y>rtmp&&(pt2=!0));if(0>pt1)start_block_matched=sz,end_block_matched=sel,start_block_precise=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.d,start_block_precise.initRect(this._m_Blocks[start_block_matched]._m_transformed_bbox),end_block_precise=(p1.x-start_block_precise.x1)*(p1.x-start_block_precise.x2),end_block_precise=0<
|
|
2029
|
+
end_block_precise?Math.min(Math.abs(p1.x-start_block_precise.x1),Math.abs(p1.x-start_block_precise.x2)):0,pt1=(p1.y-start_block_precise.y1)*(p1.y-start_block_precise.y2),pt1=0<pt1?Math.min(Math.abs(p1.y-start_block_precise.y1),Math.abs(p1.y-start_block_precise.y2)):0,end_block_precise=end_block_precise*end_block_precise+pt1*pt1,pt1=Math.min(Math.abs(p2.x-start_block_precise.x1),Math.abs(p2.x-start_block_precise.x2)),sz=(p2.y-start_block_precise.y1)*(p2.y-start_block_precise.y2),sz=0<sz?Math.min(Math.abs(p2.y-
|
|
2030
|
+
start_block_precise.y1),Math.abs(p2.y-start_block_precise.y2)):0,start_block_precise=pt1*pt1+sz*sz,pt2?end_block_matched=this._m_Blocks.length-1:!rmx&&end_block_precise>start_block_precise&&(start_block_precise=start_block_matched,start_block_matched=end_block_matched,end_block_matched=start_block_precise);else{box=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.d;box.initRect(this._m_Blocks[pt1]._m_transformed_bbox);rtmp=new _selectionInfo__WEBPACK_IMPORTED_MODULE_7__.c;start_block_precise?rtmp.initPoint(p2):
|
|
2031
|
+
rtmp.initPoint(p1);Object(logger__WEBPACK_IMPORTED_MODULE_0__.a)(!(start_block_precise&&end_block_precise)&&!(!start_block_precise&&!end_block_precise));Object(logger__WEBPACK_IMPORTED_MODULE_0__.a)(!box.contains(rtmp.x,rtmp.y));var other=box=void 0;pt1-sz>Math.max(sel-pt1,0)?(box=Math.min(pt1,sz),other=sel):(box=Math.max(pt1,sel),other=sz);pt2&&!end_block_precise?(end_block_matched=this._m_Blocks.length,box=end_block_matched-1):box!==pt1&&(end_block_precise=Array(3),pt2=Array(3),end_block_precise[0]=
|
|
2032
|
+
this.Dist2BBox(rtmp,this._m_Blocks[other]._m_transformed_bbox),end_block_precise[1]=this.Dist2BBox(rtmp,this._m_Blocks[box]._m_transformed_bbox),end_block_precise[2]=this.Dist2BBox(rtmp,this._m_Blocks[pt1]._m_transformed_bbox),end_block_precise[3]=box?this.Dist2BBox(rtmp,this._m_Blocks[box-1]._m_transformed_bbox):end_block_precise[1],pt2[0]=other,pt2[1]=box,pt2[2]=pt1,pt1=1,end_block_precise[0]<end_block_precise[1]&&(pt1=0),end_block_precise[2]<end_block_precise[pt1]&&(pt1=2),1!==pt1&&end_block_precise[3]<
|
|
2033
|
+
end_block_precise[pt1]&&(pt1=1),box=pt2[pt1]);start_block_precise?end_block_matched=box:start_block_matched=box}start_block_matched=rmx?0:start_block_matched}0<=start_block_matched&&0<=end_block_matched&&(first_line=this._findLineByPoint(this._m_Blocks[start_block_matched],p1,first_line),last_line=this._findLineByPoint(this._m_Blocks[end_block_matched],p2,last_line));return new _ResultFindStructuralBounds__WEBPACK_IMPORTED_MODULE_6__.a(first_line,last_line)};return TextLocator})()},function(module,
|
|
2034
|
+
__webpack_exports__,__webpack_require__){var logger__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(0),_textSelection_Matrix2D__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(13),_Letter__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(56),_nsIDOMTextMetrics__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(57),_nsIDOMCanvasGradient__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(46),_SelectionRect__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(20),_helpers_arrayHelper__WEBPACK_IMPORTED_MODULE_6__=
|
|
2035
|
+
__webpack_require__(4),SelectionCanvas=function(){function SelectionCanvas(container,offset){this._context=new SelectionContext(container,offset)}SelectionCanvas.prototype.getContext=function(){return this._context};return SelectionCanvas}(),SelectionContext=function(){function SelectionContext(container,offset){this._m_mtx=[];this._container={};var identity_mtx=new _textSelection_Matrix2D__WEBPACK_IMPORTED_MODULE_1__.a;identity_mtx.set(1,0,0,1,0,0);this._m_mtx.push(identity_mtx);this._font_container=
|
|
2036
|
+
container;this._offset=offset||0;this._m_y=this._m_x=0;this.canvas={width:0,height:0};this.font=null;this.lineWidth=0;this.fillStyle=this.strokeStyle=this.lineCap=null;this.miterLimit=this.globalAlpha=0;this.lineJoin=null;this._custom_glyph_mode=!1;this.w=0;this.f=this.s=this.c=null;this.i=this.a=0;this.j=null}SelectionContext.prototype.getLetter=function(id){return this._container[id]};SelectionContext.prototype._getTsWidth=function(bbox,text_mtx){var new_bbox=new _SelectionRect__WEBPACK_IMPORTED_MODULE_5__.a;
|
|
2037
|
+
new_bbox.initRect(bbox);text_mtx.transformBbox(new_bbox);return new_bbox.width()};SelectionContext.prototype._getCurrentFont=function(font){if(this._font_container[font])return this._font_container[font];font=font.split(" ")[1];Object(logger__WEBPACK_IMPORTED_MODULE_0__.a)(!!this._font_container[font],"Font "+font+" file not found");return this._font_container[font]};SelectionContext.prototype._transformBboxToTextSpace=function(this_font,bbox){var font_mtx=new _textSelection_Matrix2D__WEBPACK_IMPORTED_MODULE_1__.a,
|
|
2038
|
+
units_per_em=this_font.getUnitsPerEm();this_font=this_font.getFontSize();font_mtx.set(this_font/units_per_em,0,0,this_font/units_per_em,0,0);font_mtx.transformBbox(bbox)};SelectionContext.prototype.save=function(){var mtx=new _textSelection_Matrix2D__WEBPACK_IMPORTED_MODULE_1__.a;mtx.initMatrix(Object(_helpers_arrayHelper__WEBPACK_IMPORTED_MODULE_6__.d)(this._m_mtx));this._m_mtx.push(mtx)};SelectionContext.prototype.restore=function(){this._m_mtx.pop()};SelectionContext.prototype.transform=function(m11,
|
|
2039
|
+
m12,m21,m22,dx,dy){var mtx=new _textSelection_Matrix2D__WEBPACK_IMPORTED_MODULE_1__.a;mtx.set(m11,m12,m21,m22,dx,dy);Object(_helpers_arrayHelper__WEBPACK_IMPORTED_MODULE_6__.d)(this._m_mtx).concat(mtx)};SelectionContext.prototype.rotate=function(radians){var mtx=new _textSelection_Matrix2D__WEBPACK_IMPORTED_MODULE_1__.a,c=Math.cos(radians);radians=Math.sin(radians);mtx.set(c,radians,-radians,c,0,0);Object(_helpers_arrayHelper__WEBPACK_IMPORTED_MODULE_6__.d)(this._m_mtx).concat(mtx)};SelectionContext.prototype.translate=
|
|
2040
|
+
function(x,y){this._m_x=x;this._m_y=y};SelectionContext.prototype.setLineDash=function(segments){};SelectionContext.prototype.fillRect=function(x,y,width,height){};SelectionContext.prototype.fillText=function(text,x,y){var this_font=this._getCurrentFont(this.font);this._fillTextImpl(text,x,y,this_font)};SelectionContext.prototype._fillTextImpl=function(text,x,y,font){if(!this._custom_glyph_mode){this.translate(x,y);x=0;for(y=text.length;x<y;){var first_utf16_codeunit=text.charCodeAt(x),initialIndex=
|
|
2041
|
+
x;if(55296<=first_utf16_codeunit&&55551>=first_utf16_codeunit){var second_utf16_codeunit=text.charCodeAt(x+1);first_utf16_codeunit=String.fromCodePoint((first_utf16_codeunit-55296<<10)+(second_utf16_codeunit-56320)+65536);x+=2}else first_utf16_codeunit=String.fromCodePoint(first_utf16_codeunit),x++;initialIndex=this.lastMapping&&initialIndex in this.lastMapping?this.lastMapping[initialIndex]:first_utf16_codeunit;first_utf16_codeunit=font.getBbox(first_utf16_codeunit);this._transformBboxToTextSpace(font,
|
|
2042
|
+
first_utf16_codeunit);second_utf16_codeunit=first_utf16_codeunit.y1;first_utf16_codeunit.y1=first_utf16_codeunit.y2;first_utf16_codeunit.y2=second_utf16_codeunit;first_utf16_codeunit.x1+=this._m_x;first_utf16_codeunit.x2+=this._m_x;first_utf16_codeunit.y1+=this._m_y;first_utf16_codeunit.y2+=this._m_y;this._m_x+=first_utf16_codeunit.width();second_utf16_codeunit=Array(8);second_utf16_codeunit[0]=first_utf16_codeunit.x1;second_utf16_codeunit[1]=first_utf16_codeunit.y1;second_utf16_codeunit[2]=first_utf16_codeunit.x2;
|
|
2043
|
+
second_utf16_codeunit[3]=first_utf16_codeunit.y1;second_utf16_codeunit[4]=first_utf16_codeunit.x2;second_utf16_codeunit[5]=first_utf16_codeunit.y2;second_utf16_codeunit[6]=first_utf16_codeunit.x1;second_utf16_codeunit[7]=first_utf16_codeunit.y2;Object(_helpers_arrayHelper__WEBPACK_IMPORTED_MODULE_6__.d)(this._m_mtx).transformQuad(second_utf16_codeunit);this._container[this._offset]=new _Letter__WEBPACK_IMPORTED_MODULE_2__.a(initialIndex,second_utf16_codeunit);this._offset++}this.lastMapping=null}};
|
|
2044
|
+
SelectionContext.prototype.measureText=function(text){var this_font=this._getCurrentFont(this.font);return this._measureTextImpl(text,this_font)};SelectionContext.prototype._measureTextImpl=function(text,font){var total_width=0;if(!this._custom_glyph_mode)for(var i=0,len=text.length;i<len;){var first_utf16_codeunit=text.charCodeAt(i);if(55296<=first_utf16_codeunit&&55551>=first_utf16_codeunit){var second_utf16_codeunit=text.charCodeAt(i+1);first_utf16_codeunit=font.getBbox(String.fromCodePoint((first_utf16_codeunit-
|
|
2045
|
+
55296<<10)+(second_utf16_codeunit-56320)+65536));i+=2}else first_utf16_codeunit=font.getBbox(String.fromCodePoint(first_utf16_codeunit)),i++;this._transformBboxToTextSpace(font,first_utf16_codeunit);total_width+=first_utf16_codeunit.width()}return new _nsIDOMTextMetrics__WEBPACK_IMPORTED_MODULE_3__.a(total_width)};SelectionContext.prototype.strokeRect=function(){};SelectionContext.prototype.createLinearGradient=function(){return new _nsIDOMCanvasGradient__WEBPACK_IMPORTED_MODULE_4__.a};SelectionContext.prototype.createRadialGradient=
|
|
2046
|
+
function(){return new _nsIDOMCanvasGradient__WEBPACK_IMPORTED_MODULE_4__.a};SelectionContext.prototype.createPattern=function(){};SelectionContext.prototype.addColorStop=function(){};SelectionContext.prototype.beginPath=function(){};SelectionContext.prototype.closePath=function(){};SelectionContext.prototype.fill=function(){};SelectionContext.prototype.stroke=function(){};SelectionContext.prototype.clip=function(){};SelectionContext.prototype.moveTo=function(){};SelectionContext.prototype.lineTo=
|
|
2047
|
+
function(){};SelectionContext.prototype.quadraticCurveTo=function(){};SelectionContext.prototype.bezierCurveTo=function(){};SelectionContext.prototype.rect=function(){};SelectionContext.prototype.drawImage=function(image){image instanceof SelectionCanvas&&(image=image.getContext(),Object.assign(this._container,image._container),this._offset=image._offset)};SelectionContext.prototype.setTransform=function(){};SelectionContext.prototype.strokeText=function(){};SelectionContext.prototype.getImageData=
|
|
2048
|
+
function(){return new XODText.ImageData};SelectionContext.prototype.putImageData=function(){};SelectionContext.prototype.scale=function(){};SelectionContext.prototype.beginTransparencyGroup=function(){var identity_mtx=new _textSelection_Matrix2D__WEBPACK_IMPORTED_MODULE_1__.a;identity_mtx.set(1,0,0,1,0,0);this._m_mtx=[identity_mtx];this._m_y=this._m_x=0};SelectionContext.prototype.shouldProcessIfClipped=function(){return!0};SelectionContext.prototype.S=function(){this.save()};SelectionContext.prototype.r=
|
|
2049
|
+
function(){this.restore()};SelectionContext.prototype.t=function(m11,m12,m21,m22,dx,dy){this.transform(m11,m12,m21,m22,dx,dy)};SelectionContext.prototype.ro=function(radians){this.rotate(radians)};SelectionContext.prototype.T=function(x,y){this.translate(x,y)};SelectionContext.prototype.L=function(x0,y0,x1,y1){return this.createLinearGradient()};SelectionContext.prototype.R=function(x0,y0,r0,x1,y1,r1){return this.createRadialGradient()};SelectionContext.prototype.P=function(image,repetition){this.createPattern()};
|
|
2050
|
+
SelectionContext.prototype.A=function(){};SelectionContext.prototype.b=function(){this.beginPath()};SelectionContext.prototype.z=function(){this.closePath()};SelectionContext.prototype.F=function(){this.fill()};SelectionContext.prototype.X=function(){this.stroke()};SelectionContext.prototype.cr=function(){this.strokeRect()};SelectionContext.prototype.C=function(){this.clip()};SelectionContext.prototype.M=function(x,y){this.moveTo()};SelectionContext.prototype.l=function(x,y){this.lineTo()};SelectionContext.prototype.q=
|
|
2051
|
+
function(cpx,cpy,x,y){this.quadraticCurveTo()};SelectionContext.prototype.B=function(cp1x,cp1y,cp2x,cp2y,x,y){this.bezierCurveTo()};SelectionContext.prototype.x=function(text,x,y){var this_font=this._getCurrentFont(this.font);this._fillTextImpl(text,x,y,this_font)};SelectionContext.prototype.m=function(text){var this_font=this._getCurrentFont(this.font);return this._measureTextImpl(text,this_font)};SelectionContext.prototype.I=function(image,dx,dy){this.drawImage()};SelectionContext.prototype.Z=function(m11,
|
|
2052
|
+
m12,m21,m22,dx,dy){this.setTransform()};SelectionContext.prototype.d=function(x,y,width,height){return this.getImageData()};SelectionContext.prototype.D=function(imagedata,dx,dy){this.putImageData()};SelectionContext.prototype.e=function(x,y){this.scale()};SelectionContext.prototype.tm=function(mapping){this.lastMapping=mapping};SelectionContext.prototype.fillTextCustom=function(text,x,y){var this_font=this._getCurrentFont(this.font);this._fillTextImpl(text,x,y,this_font)};SelectionContext.prototype.xc=
|
|
2053
|
+
function(text,x,y){var this_font=this._getCurrentFont(this.font);this._fillTextImpl(text,x,y,this_font)};SelectionContext.prototype.cgb=function(){Object(logger__WEBPACK_IMPORTED_MODULE_0__.a)(!this._custom_glyph_mode,"Custom Glyphs begin offset is incorrect");this._custom_glyph_mode=!0};SelectionContext.prototype.cge=function(){Object(logger__WEBPACK_IMPORTED_MODULE_0__.a)(this._custom_glyph_mode,"Custom Glyphs end offset is incorrect");this._custom_glyph_mode=!1};SelectionContext.prototype.xw=function(text,
|
|
2054
|
+
x,y){1<text.length&&(text=text.substr(0,text.length-1));this.x(text,x,y)};SelectionContext.prototype.xcw=function(text,x,y){1<text.length&&(text=text.substr(0,text.length-1));this.xc(text,x,y)};SelectionContext.prototype.createCanvas=function(){return new SelectionCanvas(this._font_container,this._offset)};Object.defineProperty(SelectionContext.prototype,"n",{get:function(){return this.font},set:function(val){this.font=val},enumerable:!1,configurable:!0});return SelectionContext}()},function(module,
|
|
2055
|
+
__webpack_exports__,__webpack_require__){var logger__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(0),_textSelection_Quad__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(12),_Line__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(29),_Word__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(23),_SelectionRect__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(20),_helpers_arrayHelper__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(4),_ArrayEnumerator__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(24),
|
|
2056
|
+
_namespaces_XMLParser_XMLParser__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(104);module=function(){function SelectionInfo(){this._m_Lines=[];this.m_Offsets=[];this.m_Quads=[];this.m_Ready=!1;this._m_Whitespace_Indices=null;this.m_Str=""}SelectionInfo.prototype.clear=function(){this.m_Str="";Object(_helpers_arrayHelper__WEBPACK_IMPORTED_MODULE_5__.b)(this.m_Offsets);Object(_helpers_arrayHelper__WEBPACK_IMPORTED_MODULE_5__.b)(this.m_Quads);this.m_Ready=!1};SelectionInfo.prototype.initDefault=function(){this.m_Offsets=
|
|
2057
|
+
[];this.m_Quads=[];this.m_Ready=!1};SelectionInfo.prototype.applyMatrix=function(matrix){function correctionFunction(quads){for(var length=quads.length,i=0;i<length;i+=8){var pt1=matrix.mult({x:quads[i],y:quads[i+1]}),pt2=matrix.mult({x:quads[i+2],y:quads[i+3]}),pt3=matrix.mult({x:quads[i+4],y:quads[i+5]}),pt4=matrix.mult({x:quads[i+6],y:quads[i+7]}),quad=new _textSelection_Quad__WEBPACK_IMPORTED_MODULE_1__.a;quad._setCoordinates(pt1.x,pt1.y,pt2.x,pt2.y,pt3.x,pt3.y,pt4.x,pt4.y);pt1=quad.getPoints();
|
|
2058
|
+
quads[i]=pt1.x1;quads[i+1]=pt1.y1;quads[i+2]=pt1.x2;quads[i+3]=pt1.y2;quads[i+4]=pt1.x3;quads[i+5]=pt1.y3;quads[i+6]=pt1.x4;quads[i+7]=pt1.y4}}correctionFunction(this.m_Quads);this._m_Lines.forEach(function(line){correctionFunction(line._m_quad);line._m_Words.forEach(function(word){correctionFunction(word._m_quad);word._m_glyph_quads.forEach(function(gQuad){correctionFunction(gQuad)})})})};SelectionInfo.prototype.parseFromOld=function(oldSelInfo){this.m_Quads=oldSelInfo.m_Quads;this.m_Offsets=oldSelInfo.m_Offsets;
|
|
2059
|
+
this.m_Str=oldSelInfo.m_Str;this.m_Ready=oldSelInfo.m_Ready;this._m_Lines=function(struct,quads,str){function parseQuad(arr,offset){return arr.slice(offset,offset+8)}function getGenericWord(){var word=new _Word__WEBPACK_IMPORTED_MODULE_3__.a;word.m_Pos=struct[pos+1];word._m_CurNum=wordNum;wordNum++;var strPos=struct[pos+1];word._m_Str=str.slice(strPos,strPos+struct[pos+2]);word._m_Str_pos=strPos;strPos=struct[pos];for(var i=0;i<strPos;++i)word._m_glyph_quads.push(parseQuad(quads,8*(word.m_Pos+i)));
|
|
2060
|
+
prevWord&&(prevWord._m_next_word=word);return prevWord=word}function parseSimpleWord(lineBoundingBox){var word=getGenericWord(),numGlyphs=struct[pos],x_left=struct[pos+3],x_right=struct[pos+4];if(x_left===x_right){x_left=Math.min(lineBoundingBox.x1,lineBoundingBox.x2);x_right=Math.max(lineBoundingBox.x1,lineBoundingBox.x2);var top=word._m_glyph_quads[0];lineBoundingBox=word._m_glyph_quads[numGlyphs-1];lineBoundingBox=[top[1],top[3],top[5],top[7],lineBoundingBox[1],lineBoundingBox[3],lineBoundingBox[5],
|
|
2061
|
+
lineBoundingBox[7]];top=Math.min.apply(null,lineBoundingBox);lineBoundingBox=Math.max.apply(null,lineBoundingBox);for(var i=0;i<numGlyphs;++i)for(var glyphQuad_1=word._m_glyph_quads[i],minX=Math.min(glyphQuad_1[0],glyphQuad_1[2],glyphQuad_1[4]),j=0;8>j;j+=2)glyphQuad_1[j]=glyphQuad_1[j]===minX?x_left:x_right}else for(top=Math.min(lineBoundingBox.y1,lineBoundingBox.y2),lineBoundingBox=Math.max(lineBoundingBox.y1,lineBoundingBox.y2),i=0;i<numGlyphs;++i)for(glyphQuad_1=word._m_glyph_quads[i],minX=Math.min(glyphQuad_1[1],
|
|
2062
|
+
glyphQuad_1[3],glyphQuad_1[5]),j=1;8>j;j+=2)glyphQuad_1[j]=glyphQuad_1[j]===minX?lineBoundingBox:top;numGlyphs=word._m_quad;j=word._m_glyph_quads[0];i=j[2]-j[0];j=j[3]-j[1];0<i?(numGlyphs[0]=x_left,numGlyphs[1]=lineBoundingBox,numGlyphs[2]=x_right,numGlyphs[3]=lineBoundingBox,numGlyphs[4]=x_right,numGlyphs[5]=top,numGlyphs[6]=x_left,numGlyphs[7]=top):0>i?(numGlyphs[0]=x_left,numGlyphs[1]=top,numGlyphs[2]=x_right,numGlyphs[3]=top,numGlyphs[4]=x_right,numGlyphs[5]=lineBoundingBox,numGlyphs[6]=x_left,
|
|
2063
|
+
numGlyphs[7]=lineBoundingBox):0<j?(numGlyphs[0]=x_left,numGlyphs[1]=top,numGlyphs[2]=x_left,numGlyphs[3]=lineBoundingBox,numGlyphs[4]=x_right,numGlyphs[5]=lineBoundingBox,numGlyphs[6]=x_right,numGlyphs[7]=top):0>j?(numGlyphs[0]=x_right,numGlyphs[1]=lineBoundingBox,numGlyphs[2]=x_right,numGlyphs[3]=top,numGlyphs[4]=x_left,numGlyphs[5]=top,numGlyphs[6]=x_left,numGlyphs[7]=lineBoundingBox):(numGlyphs[0]=x_left,numGlyphs[1]=lineBoundingBox,numGlyphs[2]=x_right,numGlyphs[3]=lineBoundingBox,numGlyphs[4]=
|
|
2064
|
+
x_right,numGlyphs[5]=top,numGlyphs[6]=x_left,numGlyphs[7]=top);pos+=5;return word}function parseUnsimpleWord(){var word=getGenericWord();word._m_quad=parseQuad(struct,pos+3);pos+=11;return word}function parseLine(lineNum){var line=new _Line__WEBPACK_IMPORTED_MODULE_2__.a;line._m_CurNum=lineNum;var simple=0<struct[pos];if(simple){var wordsOffset=6;lineNum=struct[pos];var quad=line._m_quad,pt1=struct.slice(pos+2,pos+4),pt2=struct.slice(pos+4,pos+6);quad[0]=pt1[0];quad[1]=pt1[1];quad[2]=pt2[0];quad[3]=
|
|
2065
|
+
pt1[1];quad[4]=pt2[0];quad[5]=pt2[1];quad[6]=pt1[0];quad[7]=pt2[1]}else wordsOffset=10,lineNum=-struct[pos],line._m_quad=parseQuad(struct,pos+2);simple=simple?parseSimpleWord:parseUnsimpleWord;quad=new _SelectionRect__WEBPACK_IMPORTED_MODULE_4__.a;line.getBBox(quad);pos+=wordsOffset;prevWord=null;for(wordsOffset=0;wordsOffset<lineNum;++wordsOffset)line._m_Words.push(simple(quad));line._m_Str=line._m_Words.map(function(word){return word._m_Str}).join(" ");line._m_Str_pos=line._m_Words[0]?line._m_Words[0]._m_Str_pos:
|
|
2066
|
+
0;prevLine&&(prevLine._m_next_line=line);return prevLine=line}var pos=0,prevLine=null,prevWord=null,wordNum=0;return function(){var lines=[],numLines=struct[pos];pos++;for(var i=0;i<numLines;++i)lines.push(parseLine(i));return lines}()}(oldSelInfo.m_Struct,this.m_Quads,this.m_Str)};SelectionInfo.prototype._getUnicodeString=function(bytes){for(var result="",i=0,c,c2,c3;i<bytes.length;)c=bytes.charCodeAt(i),9===c?(result+=String.fromCharCode(10),i++):128>c?(result+=String.fromCharCode(c),i++):191<c&&
|
|
2067
|
+
224>c?(c2=bytes.charCodeAt(i+1),result+=String.fromCharCode((c&31)<<6|c2&63),i+=2):(c2=bytes.charCodeAt(i+1),c3=bytes.charCodeAt(i+2),result+=String.fromCharCode((c&15)<<12|(c2&63)<<6|c3&63),i+=3);return result};SelectionInfo.prototype._processWord=function(word_mapping,context){var word=new _Word__WEBPACK_IMPORTED_MODULE_3__.a;word_mapping=word_mapping.split(",");word_mapping=Object(_ArrayEnumerator__WEBPACK_IMPORTED_MODULE_6__.a)(word_mapping);for(var last_index=-1;word_mapping.moveNext();){var word_map=
|
|
2065
2068
|
word_mapping.current.split(":"),word_offset=parseInt(word_map[0],10),word_length=0;1<word_map.length&&(word_length=parseInt(word_map[1],10));last_index===word_offset&&(++word_offset,--word_length);for(last_index=word_offset+word_length;word_offset<=last_index;word_offset++){word_map=context.getLetter(word_offset);word_length=word_map.getChar();word.addChar(word_length,word_map.getQuad());for(var i=0;i<word_length.length;++i)this.m_Offsets.push(word_offset),Object(_helpers_arrayHelper__WEBPACK_IMPORTED_MODULE_5__.a)(this.m_Quads,
|
|
2066
2069
|
word_map.getQuad())}}return word};SelectionInfo.prototype.parse=function(parser,context){var line_id=0,word_id=0,str_pos=0;do{for(var elem_name;parser.advance();)if(elem_name=parser.getElementName(),"F"===elem_name)parser.increaseDepth();else if("P"===elem_name)parser.increaseDepth();else if("L"===elem_name){parser.increaseDepth();elem_name=new _Line__WEBPACK_IMPORTED_MODULE_2__.a;elem_name._setCurrentNum(line_id++);0<this._m_Lines.length&&this._m_Lines[this._m_Lines.length-1].setNextLine(elem_name);
|
|
2067
2070
|
this._m_Lines.push(elem_name);var words=parser.getCharData().split(" ");for(words=Object(_ArrayEnumerator__WEBPACK_IMPORTED_MODULE_6__.a)(words);words.moveNext();){var word_map=words.current;if(0<elem_name.getNumWords()){this.m_Str+=" ";this.m_Offsets.push(-1);str_pos++;var last_quad=Array(8);elem_name.getLastWord().getQuad(last_quad);Object(_helpers_arrayHelper__WEBPACK_IMPORTED_MODULE_5__.a)(this.m_Quads,last_quad)}word_map=this._processWord(word_map,context);word_map._setCurrentNum(word_id++);
|