dwt 17.2.3 → 17.3.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/LICENSE.txt +24 -22
- package/README.md +28 -28
- package/dist/addon/dbrjs/dbr-8.8.7.full.wasm +0 -0
- package/dist/addon/dbrjs/dbr-8.8.7.full.wasm.js +285 -0
- package/dist/addon/dbrjs/dbr-8.8.7.worker.js +113 -0
- package/dist/addon/dbrjs/dbr.js +22 -11
- package/dist/addon/dynamsoft.webtwain.addon.camera.css +7 -0
- package/dist/dist/DynamsoftServiceSetup-arm64.deb +0 -0
- package/dist/dist/DynamsoftServiceSetup-mips64el.deb +0 -0
- package/dist/dist/DynamsoftServiceSetup.deb +0 -0
- package/dist/dist/DynamsoftServiceSetup.msi +0 -0
- package/dist/dist/DynamsoftServiceSetup.pkg +0 -0
- package/dist/dist/DynamsoftServiceSetup.rpm +0 -0
- package/dist/dynamsoft.webtwain.min.js +258 -369
- package/dist/dynamsoft.webtwain.min.mjs +266 -374
- package/dist/src/{dynamsoft.crypto-1.7.2.wasm → dynamsoft.crypto-1.7.3.wasm} +0 -0
- package/dist/src/{dynamsoft.imageProc-1.7.2.wasm → dynamsoft.imageProc-1.7.3.wasm} +0 -0
- package/dist/src/{dynamsoft.imageProc-sn-1.7.2.wasm → dynamsoft.imageProc-sn-1.7.3.wasm} +0 -0
- package/dist/src/{dynamsoft.imagecore-1.7.2.wasm → dynamsoft.imagecore-1.7.3.wasm} +0 -0
- package/dist/src/dynamsoft.imageio-1.7.3.wasm +0 -0
- package/dist/src/dynamsoft.imageio_wasm-1.7.3.js +34 -0
- package/dist/src/dynamsoft.lts.js +2 -2
- package/dist/src/{dynamsoft.pdfReader-1.7.2.wasm → dynamsoft.pdfReader-1.7.3.wasm} +0 -0
- package/dist/src/dynamsoft.pdfReader_wasm-1.7.3.js +34 -0
- package/dist/src/{dynamsoft.pdfWriter-1.7.2.wasm → dynamsoft.pdfWriter-1.7.3.wasm} +0 -0
- package/dist/src/dynamsoft.viewer.css +2 -3
- package/dist/src/dynamsoft.viewer.js +1 -2
- package/dist/src/dynamsoft.webtwain.css +1 -29
- package/dist/src/fastcomp/{dynamsoft.crypto-1.7.2.wasm → dynamsoft.crypto-1.7.3.wasm} +0 -0
- package/dist/src/fastcomp/{dynamsoft.imageProc-1.7.2.wasm → dynamsoft.imageProc-1.7.3.wasm} +0 -0
- package/dist/src/fastcomp/{dynamsoft.imagecore-1.7.2.wasm → dynamsoft.imagecore-1.7.3.wasm} +0 -0
- package/dist/src/fastcomp/dynamsoft.imageio-1.7.3.wasm +0 -0
- package/dist/src/fastcomp/dynamsoft.imageio_wasm-1.7.3.js +34 -0
- package/dist/src/fastcomp/{dynamsoft.pdfWriter-1.7.2.wasm → dynamsoft.pdfWriter-1.7.3.wasm} +0 -0
- package/dist/types/Addon.Camera.d.ts +147 -97
- package/dist/types/Addon.PDF.d.ts +20 -11
- package/dist/types/Dynamsoft.Enum.d.ts +12 -1
- package/dist/types/Dynamsoft.d.ts +14 -18
- package/dist/types/WebTwain.Acquire.d.ts +26 -16
- package/dist/types/WebTwain.Buffer.d.ts +63 -15
- package/dist/types/WebTwain.IO.d.ts +1 -1
- package/dist/types/WebTwain.Util.d.ts +1 -1
- package/dist/types/WebTwain.Viewer.d.ts +107 -9
- package/dist/types/index.d.ts +1 -1
- package/dist/types/tsconfig.json +0 -1
- package/package.json +2 -2
- package/samples/{1.AcquireImage.html → AcquireImage.html} +1 -1
- package/samples/{2.CustomScan.html → CustomScan.html} +1 -1
- package/samples/{5.Edit.html → Edit.html} +1 -1
- package/samples/{3.LoadAndSaveImages.html → LoadAndSaveImages.html} +1 -1
- package/samples/{6.Navigation.html → Navigation.html} +1 -1
- package/samples/{4.PDFRasterizer.html → PDFRasterizer.html} +1 -1
- package/samples/{9.ReadBarcode.html → ReadBarcode.html} +1 -1
- package/samples/{10.ScanOrCapture.html → ScanOrCapture.html} +1 -1
- package/samples/{7.Thumbnail.html → Thumbnail.html} +1 -1
- package/samples/{11.mobilebrowsercapture.html → mobilebrowsercapture.html} +3 -0
- package/dist/addon/dbrjs/dbr-8.6.1.full.wasm +0 -0
- package/dist/addon/dbrjs/dbr-8.6.1.full.wasm.js +0 -134
- package/dist/addon/dbrjs/dbr-8.6.1.worker.js +0 -113
- package/dist/src/dynamsoft.imageio-1.7.2.wasm +0 -0
- package/dist/src/dynamsoft.imageio_wasm-1.7.2.js +0 -115
- package/dist/src/dynamsoft.pdfReader_wasm-1.7.2.js +0 -90
- package/dist/src/fastcomp/dynamsoft.imageio-1.7.2.wasm +0 -0
- package/dist/src/fastcomp/dynamsoft.imageio_wasm-1.7.2.js +0 -115
- package/samples/8.OCRADocument.html +0 -160
|
@@ -1,2 +1 @@
|
|
|
1
|
-
/*! Date: 02/17/2022 17:57:07 */
|
|
2
|
-
!function(t){var e={};function i(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,i),o.l=!0,o.exports}i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)i.d(n,o,function(e){return t[e]}.bind(null,o));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=8)}([function(t,e,i){"use strict";i.d(e,"e",(function(){return o})),i.d(e,"c",(function(){return r})),i.d(e,"g",(function(){return s})),i.d(e,"d",(function(){return a})),i.d(e,"f",(function(){return l})),i.d(e,"b",(function(){return h})),i.d(e,"a",(function(){return u}));var n="undefined"!=typeof window,o=(n&&window,!!n&&window.document.documentElement,{PREVIOUS:"prev",NEXT:"next"}),r={CLICK:"click",KEYDOWN:"keydown",TOUCH_START:"touchstart",TOUCH_MOVE:"touchmove",TOUCH_END:"touchend",MOUSE_DOWN:"mousedown",MOUSE_MOVE:"mousemove",MOUSE_UP:"mouseup",MOUSE_OVER:"mouseover",MOUSE_OUT:"mouseout",CHANGE:"change",SCROLL:"scroll",CONTEXTMENU:"contextmenu",RESIZE:"resize"},s={IMAGE_SELECTED:"imageSelected",PAGE_CLICK:"click",PAGE_MOUSE_DOWN:"mousedown",PAGE_MOUSE_MOVE:"mousemove",PAGE_MOUSE_UP:"mouseup",PAGE_MOUSE_OVER:"mouseover",PAGE_MOUSE_OUT:"mouseout",PAGE_DOUBLE_CLICK:"dblclick",PAGE_RIGHT_CLICK:"rightclick",PAGE_CONTEXTMENU:"contextmenu",DRAG_START:"dragstart",DRAG_MOVE:"dragmove",DRAG_DONE:"dragdone",KEY_DOWN:"keydown",KEY_UP:"keyup",RESIZE:"resize",TOP_PAGE_CHANGED:"topPageChanged",BUFFER_CHANGED:"bufferChanged",THUMBNAIL_STRETCH:"resize",REMOVE_PAGE:"removePage",FILE_KEY_UP:"fileKeyUp",FILE_LIST_CLICK:"fileListClick",FILE_LIST_RIGHT_CLICK:"fileListRightClick",TAG_KEY_UP:"tagKeyUp",TAG_LIST_CLICK:"tagListClick",TAG_LIST_RIGHT_CLICK:"tagListRightClick",PAGE_AREA_SELECTED:"pageAreaSelected",PAGE_AREA_UNSELECTED:"pageAreaUnselected",VIEWER_PAGE_RENDERED:"pageRendered",DOCUMENT_KEY_UP:"onDocumentKeyUp",DOCUMENT_POINTER_UP:"onDocumentPointerUp",DOCUMENT_POINTER_MOVE:"onDocumentPointerMove",DOCUMENT_CLICK:"onDocumentClick",SIDEBAR_CLICK:"onSidebarClick",FILE_DROP:"onDrop",WHEEL:"wheel"},a={APPEND_SYNC_DROP:"_appendSyncDrop",UPDATE_UI_SETTING:"_updateUISetting",UPDATE_FOCUS:"_updateFocus",CANVAS_VISIBILITY_CHANGED:"_canvasVisibilityChanged",SET_SELECTED_INDEXES:"_SetSelectedIndexes",DOCUMENT_UP:"_documentUp",DOCUMENT_MOVE:"_documentMove",DISPLAYED_IMAGE_CHANGED:"_displayedImageChanged",REORDER_THUMBNAIL:"_onReOrderThumbnail",CHANGE_THUMBNAIL_VIEW_PROP:"_changeThumbnailViewProp",UPDATE_INNER_THUMBNAIL_PAGE:"_updateInnerThumbnailPage",ERROR:"_updateErrorMessage",LOG:"_updateLogMessage",CLEAR_SLT_BOX:"_clearSltBox",DIRECTORY_CHANGED:"_DirectoryChanged",BIND_SLIDE_COMPONENT:"_bindSlideComponent",UNBIND_SLIDE_COMPONENT:"_unbindSlideComponent",BIND_CANVAS:"_bindCanvas",UNBIND_CANVAS:"_unbindCanvas",SET_CANVAS_SIZE:"_setCanvasSize",CANVAS_TOUCH_START:"_canvasTouchstart",CANVAS_TOUCH_MOVE:"_canvasTouchmove",CANVAS_TOUCH_END:"_canvasTouchend",CANVAS_MOUSE_DOWN:"_canvasMousedown",CANVAS_MOUSE_UP:"_canvasMouseup",CANVAS_MOUSE_MOVE:"_canvasMousemove",CANVAS_MOUSE_OVER:"_canvasMouseOver",CANVAS_MOUSE_OUT:"_canvasMouseOut",CANVAS_WHEEL:"_canvasWheel",CANVAS_SCROLL:"_canvasScroll",CANVAS_CLICK:"_canvasClick",CANVAS_DOUBLE_CLICK:"_canvasDoubleClick",CANVAS_RIGHT_CLICK:"_canvasRightClick",CANVAS_KEY_DOWN:"_canvasKeyDown",CANVAS_KEY_UP:"_canvasKeyUp",CANVAS_RESIZE:"_canvasResize",CANVAS_DRAG_START:"_canvasDragStart",CANVAS_DRAG_MOVE:"_canvasDragMove",CANVAS_DRAG_DONE:"_canvasDragDone",CANVAS_DEFAULT_CURSOR:"_canvasDefaultCursor",SHOW_CANVAS_LOADING:"_showCanvasLoading",DB_SAVE_OK:"_addDataToDBSuccess",DB_SAVE_FAILED:"_addDataToDBFailed",AFTER_RENDER:"_afterRender",CURRENT_CHANGED:"_currentChanged"},l={VIEWER_RESIZE:"_viewerResizeUI",VIEWER_CLICK:"_mouseClickUI",VIEWER_RIGHT_CLICK:"_viewerRightClickUI",VIEWER_MOVE:"_mouseMoveUI",SHOW_LATEST_PAGE:"_showLatestPage",UPDATE_PAGES_LAYOUT:"_updatePagesLayout",DOCUMENT_POINTER_MOVE:"_documentPointerMoveUI",DOCUMENT_POINTER_UP:"_documentPointerUpUI",DOCUMENT_KEY_DOWN:"_documentKeyDownUI",DOCUMENT_KEY_UP:"_documentKeyUpUI",DOCUMENT_CLICK:"_documentClickUI",SIDEBAR_CLICK:"_sideBarClickUI",SIDEBAR_STRETCH_START:"_sidebarStretchStartUI",FILE_LIST_CLICK:"_fileListClickUI",FILE_LIST_RIGHT_CLICK:"_fileListRightClickUI",FILE_KEY_UP:"_fileListKeyUpUI",ADD_NEW_FOLDER:"_addNewFolderUI",FILE_REFRESH:"_directoryRefreshUI",FILE_SELECTED:"_fileSelectedUI",TAG_LIST_CLICK:"_tagListClickUI",TAG_LIST_RIGHT_CLICK:"tagListRightClickUI",TAG_KEY_UP:"_tagKeyUpUI",ADD_NEW_TAG:"_addNewTagUI",TAG_REFRESH:"_tagRefreshUI",TAG_SELECTED:"_tagSelectedUI",OPEN_DEFAULT_TAG:"_openDefaultTagUI",IMAGE_SELECTED:"_imageSelectedUI",THUMBNAIL_CHANGED:"_thumbnailChangedUI",UPDATE_THB_ITEM:"_updateThbItem",UPDATE_THUMBNAIL_PROP:"_updateThumbnailPropUI",SCROLL_TO:"_scrollToUI",SET_VIEW_MODE:"_setViewModeUI",MERGE_DISPLAYED_UIDS:"_mergeDisplayedUidsUi",PAGER_BLUR:"_pagerBlurUI",PAGER_CHANGED:"_pagerChangedUI",SET_SCROLLER_SIZE:"_setScrollerSizeUI",CHANGE_CANVAS_CURSOR:"_changeCanvasCursorUI",TAB_CHANGED:"_tabChangedUI",TAB_LIST_CLICK:"_tabListClickUI",CLOSE_SAVE_SETTING_BOX:"_closeSaveSettingBoxUI",CUSTOM_BUTTON_CLICK:"_customButtonClickUI"},h={UPDATE_FOR_VIEWER:"_updateForViewer",LOAD_TO_VIEWER:"_loadToViewer",OPEN_TO_VIEWER:"_openToViewer",LOAD_PAGE:"_loadPage",LOAD_PAGE_OK:"_loadPageOk",SET_CURRENT_INDEX:"_setCurrentIndex",REMOVE_VIEWER_UID:"_removeViewerUid",GOTO_PAGE:"_gotoPage",CHANGE_PAGE:"_changePage",REORDER_PAGE:"_reorderPage",REMOVE_PAGE:"_removePage",OVERLAY_RECTANGLE:"_overlayRectangle",EDIT:"_editPage",UPDATE_THUMBNAIL_PAGE:"_updateThumbnailPage",REMOVE_FROM_TAG:"_removeFromTag",LOAD_TAG:"_loadToTag",OPEN_TAG:"_openTag",REMOVE_PAGE_TAG:"_removePageTag",ADD_PAGE_TAG:"_addPageTag",EMPTY_TAG:"_emptyTag",RENAME_TAG:"_renameTag",TAG_CHANGED:"_tagChanged",APPEND_SYNC:"_appendSync",UPDATE_SYNC:"_updateSync",REMOVE_FROM_FILE:"_removeFromFile",LOAD_FILE:"_loadToFile",APPEND_TO_OPEN_TAG:"_appendToOpenTag",APPEND_TO_OPEN_ALL:"_appendToOpenAll",REMOVE_FROM_ALL:"_removeFromAll",REMOVE_FILE:"_removeFile"},u={OK:{code:0,message:"ok."},PARAM_TYPE:{code:80001,message:"The parameter type is wrong."},PARAMETER_RANGE:{code:80002,message:"The parameter is out of range."},IMG_NOT_EXIST:{code:80003,message:"The image does not exist."},IMG_LOAD_FAILED:{code:80004,message:"The image load failed."},BACK_TO_TOP:{code:80005,message:"The current folder is root folder."},FILE_NOT_EXIST:{code:80006,message:"The file does not exist."},IMG_HAVE_EXIST:{code:80007,message:"The image has existed."},EMPTY_IN_ARRAY:{code:80008,message:"There is some empty element in array."},TAG_NOT_EXIST:{code:80009,message:"Tag does not exist."},TAG_HAVE_EXIST:{code:80010,message:"The tag already exists."},ELEMENT_NOT_EXIST:{code:80011,message:"Element does not exist."},PAGE_NOT_EXIST:{code:80012,message:"Page does not exist."},PARAMETER_INVALID:{code:80013,message:"The parameter is invalid."},URL_INVALID:{code:80014,message:"The url is invalid."},FOLDER_NOT_EXIST:{code:80015,message:"The folder does not exist."},COLOR_INVALID:{code:80016,message:"The color is invalid."},IMG_STORAGE_FAILED:{code:80017,message:"Failed to save image to database."},IMG_REMOVE_FAILED:{code:80018,message:"Failed to remove image from database by uid."},PATH_ERROR:{code:80019,message:"The path of file or folder does not exist."},BROWSER_NOT_SUPPORT:{code:80020,message:"Your browser does not support full screen."},SIZE_INVALID:{code:80021,message:"The size is invalid."},OPERATION_MODE_ERROR:{code:80022,message:"The operation mode is error."},BORDER_INVALID:{code:80023,message:"The border is invalid."},CAMERA_CLASS_REQUIRE:{code:80025,message:"The camera class is required."},VIEW_UI_REQUIRE:{code:80026,message:"The constructor of view ui is required."},WEBCAM_LICENSE_INVALID:{code:80027,message:"The license of webcam is invalid."},CAMERA_EXIST:{code:80028,message:"The video is shown."},CAMERA_CLASS_INVALID:{code:80029,message:"The camera class is invalid."},META_DATA_NOT_EXIST:{code:80030,message:"The metadata is not exist."},CAMERA_NOT_EXIST:{code:80031,message:"The video is not shown."},FILE_EXIST:{code:80032,message:"The file already exists."}}},function(t,e,i){"use strict";function n(t){return Array.isArray?Array.isArray(t):"[object Array]"===Object.prototype.toString.call(t)}function o(t){if(Array.isArray(t)){for(var e=0;e<t.length;e++)for(var i=e+1;i<t.length;i++)t[e]===t[i]&&(t.splice(i,1),i--);return t}}function r(t){return"[object Object]"===Object.prototype.toString.call(t)}function s(t){return"function"==typeof t}function a(t){return"string"==typeof t}function l(t){var e=String(t);return!!/^\d+(px|em)$|^\d+$|^(100|[1-9]?\d(\.\d\d?\d?)?)%$/.test(e)}function h(t){return"number"==typeof t&&!isNaN(t)}function u(t){return"[object Boolean]"===Object.prototype.toString.call(t)}function c(t){var e=document.createElement("span");return e.style.background=t,!!e.style.background}function d(t){var e=document.createElement("span");return e.style.border=t,!(!e.style.border&&""!==t)}function p(){return"ontouchstart"in document.documentElement}function _(){return document.documentMode!==undefined}function v(t){return t instanceof HTMLElement||"[object ShadowRoot]"===Object.prototype.toString.call(t)}function f(t,e){if(a(e))t.style.cssText=e;else for(var i in e)t.style[i]=e[i]}function m(t,e,i,n){if(t)return t.addEventListener(e,i,n),function(){t.removeEventListener(e,i)}}function g(t,e){for(var i in t)e[i]===undefined?e[i]=t[i]:r(t[i])&&r(e[i])?g(t[i],e[i]):e[i]=t[i]}function y(t,e){for(var i in t){var n=t[i],o=e[i];o===undefined?e[i]=t[i]:u(n)&&r(o)?o.visibility=n:r(n)&&r(o)?y(t[i],e[i]):e[i]=t[i]}}function b(t,e){var i=this,n=0,o=null;return function(){var r=+new Date;r-n<e?(clearTimeout(o),o=setTimeout((function(){n=r,t.apply(i)}),e)):(n=r,t.apply(i))}}function E(t){t&&t.stopPropagation?t.stopPropagation():t&&(t.cancelBubble=!0)}function C(t){t.preventDefault?t.preventDefault():t.returnValue=!1}function S(t){return""===t||t===undefined?null:document.getElementById(t)}function I(){var t=window.document;return t.fullscreenElement||t.msFullscreenElement||t.mozFullScreenElement||t.webkitFullscreenElement||!1}function T(t){return t.requestFullscreen?(t.requestFullscreen(),!0):t.mozRequestFullScreen?(t.mozRequestFullScreen(),!0):t.msRequestFullscreen?(t.msRequestFullscreen(),!0):t.oRequestFullscreen?(t.oRequestFullscreen(),!0):t.webkitRequestFullscreen?(t.webkitRequestFullScreen(),!0):(alert("Your browser does not support full screen!"),!1)}function w(){var t=window.document;return t.exitFullScreen?(t.exitFullScreen(),!0):t.mozCancelFullScreen?(t.mozCancelFullScreen(),!0):t.webkitExitFullscreen?(t.webkitExitFullscreen(),!0):t.msExitFullscreen?(t.msExitFullscreen(),!0):void 0}function O(t){for(var e=t.parentNode.children,i=0;i<e.length;i++)if(e[i]===t)return i}function R(t,e){for(var i=t.parentNode,n=i.children,o=0,r=0;r<n.length;r++){var a=n[r];if(s(e)){if(!e(a,i))continue;if(a===t)return o;o++}else if(a===t)return r}return-1}function x(t,e){var i=e.parentNode;i.lastChild==e?i.appendChild(t):P(t,e.nextSibling,i)}function P(t,e,i){e===undefined?i.appendChild(t):i.insertBefore(t,e)}function L(t){var e=Math.random().toString(35).substring(2);return e.length<11&&(e+=Math.random().toString(35).substring(2)),t=Math.max(Math.min(Math.round(t),11),8),e=e.substring(0,t)}function A(t){var e;if(n(t))e=[];else{if(!r(t))return t;e={}}for(var i in t){var o=t[i];n(t)||r(t)?e[i]=A(o):e[i]=o}return e}function M(t){var e=window.requestAnimationFrame||window.webkitRequestAnimationFrame,i=!!e;if(e&&!/requestAnimationFrame\(\)\s*\{\s*\[native code\]\s*\}/i.test(e.toString())&&(i=!1),i)return e(t);var n={},o=1,r=null,s=+new Date;return function(t,e){var i=o++;return n[i]=t,null===r&&(r=setInterval((function(){var t=+new Date,e=n;for(var i in n={},0,e)Object.prototype.hasOwnProperty.call(e,i)&&(e[i](t),s=t);t-s>2500&&(clearInterval(r),r=null)}),1e3/60)),i}(t)}function D(){var t=window;return t?t.devicePixelRatio?t.devicePixelRatio:t.screen.deviceXDPI&&t.screen.logicalXDPI?t.screen.deviceXDPI/t.screen.logicalXDPI:1:1}function B(t){var e=new Date,i={"M+":e.getMonth()+1,"d+":e.getDate(),"h+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds(),"q+":Math.floor((e.getMonth()+3)/3),S:e.getMilliseconds()};for(var n in/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(e.getFullYear()+"").substr(4-RegExp.$1.length))),i)new RegExp("("+n+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?i[n]:("00"+i[n]).substr((""+i[n]).length)));return t}function U(t,e,i,n,o){var r=t+i/2,s=e+n/2,a=N(t,e,r,s,o),l=N(t+i,e,r,s,o),h=N(t+i,e+n,r,s,o),u=N(t,e+n,r,s,o),c=[l.x,a.x,u.x,h.x].sort((function(t,e){return t-e})),d=[l.y,a.y,u.y,h.y].sort((function(t,e){return t-e}));return{x:c[0],y:d[0],width:c[3]-c[0],height:d[3]-d[0]}}function N(t,e,i,n,o){return o=o/180*Math.PI,{x:(t-i)*Math.cos(o)-(e-n)*Math.sin(o)+i,y:(t-i)*Math.sin(o)+(e-n)*Math.cos(o)+n}}i.d(e,"m",(function(){return n})),i.d(e,"J",(function(){return o})),i.d(e,"w",(function(){return r})),i.d(e,"s",(function(){return s})),i.d(e,"y",(function(){return a})),i.d(e,"x",(function(){return l})),i.d(e,"v",(function(){return h})),i.d(e,"n",(function(){return u})),i.d(e,"p",(function(){return c})),i.d(e,"o",(function(){return d})),i.d(e,"u",(function(){return p})),i.d(e,"t",(function(){return _})),i.d(e,"q",(function(){return v})),i.d(e,"F",(function(){return f})),i.d(e,"c",(function(){return m})),i.d(e,"A",(function(){return g})),i.d(e,"B",(function(){return y})),i.d(e,"H",(function(){return b})),i.d(e,"G",(function(){return E})),i.d(e,"C",(function(){return C})),i.d(e,"j",(function(){return S})),i.d(e,"r",(function(){return I})),i.d(e,"z",(function(){return T})),i.d(e,"f",(function(){return w})),i.d(e,"h",(function(){return O})),i.d(e,"i",(function(){return R})),i.d(e,"k",(function(){return x})),i.d(e,"l",(function(){return P})),i.d(e,"I",(function(){return L})),i.d(e,"d",(function(){return A})),i.d(e,"D",(function(){return M})),i.d(e,"e",(function(){return D})),i.d(e,"g",(function(){return B})),i.d(e,"E",(function(){return U})),i.d(e,"b",(function(){return k})),i.d(e,"a",(function(){return V}));var k={log:function(t){window.Dynamsoft&&window.Dynamsoft.Lib.debug&&window.Dynamsoft.Lib.log(t)}},V={windowURL:window.URL||window.webkitURL,createURL:function(t){return a(t)?t:V.createURLWithType(t).data},createURLWithType:function(t){if(a(t)||undefined===t)return{type:"string",data:t};if(t instanceof Blob)return{type:"object",data:V.createObjectURL(t)};if(t.imageData&&t.imageData instanceof Blob)return{type:"object",data:V.createObjectURL(t.imageData)};if(t.imageData){var e=Object.prototype.toString.call(t.imageData);if(/\[object \w+Array\]/.test(e))return{type:"object",data:V.createObjectURL(new Blob([t.imageData]))}}else{e=Object.prototype.toString.call(t);if(/\[object \w+Array\]/.test(e))return{type:"object",data:V.createObjectURL(new Blob([t]))}}return/data:image\/\w+;base64/.test(t)?{type:"string",data:t}:{type:"object",data:t}},createObjectURL:function(t){if(!t)return"";var e=V.windowURL.createObjectURL(t);return k.log("createObjectURL:"+e),e},revokeObjectURL:function(t){k.log("revokeObjectURL:"+t),a(t)&&0==t.indexOf("blob:http")&&V.windowURL.revokeObjectURL(t)}}},function(t,e,i){"use strict";i.d(e,"a",(function(){return r})),i.d(e,"b",(function(){return s}));var n=i(1),o=undefined&&undefined.__spreadArrays||function(){for(var t=0,e=0,i=arguments.length;e<i;e++)t+=arguments[e].length;var n=Array(t),o=0;for(e=0;e<i;e++)for(var r=arguments[e],s=0,a=r.length;s<a;s++,o++)n[o]=r[s];return n},r=function(){function t(t){this._evtIds=[],this._oPub=null,this._bDisposePub=!1,t?this._oPub=t:(this._oPub=new s,this._bDisposePub=!0)}return t.prototype.getPublishSubscribe=function(){return this._oPub},t.prototype._on=function(t,e){var i=this._oPub.on(t,e);this.push(t,i)},t.prototype._emit=function(t){for(var e,i=[],n=1;n<arguments.length;n++)i[n-1]=arguments[n];null===(e=this._oPub)||void 0===e||e.emit.apply(e,o([t],i))},t.prototype._off=function(t,e){var i;null===(i=this._oPub)||void 0===i||i.off(t,e)},t.prototype.push=function(t,e){this._evtIds.push({name:t,id:e})},t.prototype.dispose=function(){if(this._oPub){for(var t=this._evtIds.length,e=0;e<t;e++){var i=this._evtIds[e];this._oPub.offById(i.name,i.id)}this._bDisposePub&&this._oPub&&this._oPub.dispose()}this._oPub=null},t}(),s=function(){function t(){this._events={}}return t.prototype.on=function(t,e){this._events[t]||(this._events[t]=[]);var i=Object(n.I)(10);return this._events[t].push({fn:e,evtId:i}),i},t.prototype.emit=function(t){for(var e,i,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var s=this._events[t];if(!s||0===s.length)return!1;for(var a=s.length,l=0;l<a;l++)null===(i=s[l])||void 0===i||(e=i.fn).call.apply(e,o([null],n))},t.prototype.emitEx=function(t){for(var e,i,n,r=[],s=1;s<arguments.length;s++)r[s-1]=arguments[s];var a=this._events[t];if(!a||0===a.length)return Promise.resolve(!0);var l=a.length,h=Promise.resolve(!0);if(1===a.length){var u=null===(i=a[0])||void 0===i?void 0:(e=i.fn).call.apply(e,o([null],r));return u instanceof Promise?u:h}for(var c=function(t){var e,i=null===(n=a[t])||void 0===n?void 0:(e=n.fn).call.apply(e,o([null],r));i instanceof Promise&&(h=h.then((function(){return i})))},d=0;d<l;d++)c(d);return h},t.prototype.off=function(t,e){var i=this._events[t];if(!i)return!1;if(e)for(var n=i.length,o=0;o<n;o++){var r=i[o];r&&r.fn===e&&i.splice(o,1),r=null}else i&&(i.length=0);i=null},t.prototype.offById=function(t,e){var i=this._events[t];if(!i)return!1;if(e)for(var n=i.length,o=0;o<n;o++){var r=i[o];if(r&&r.evtId===e){i.splice(o,1);break}r=null}else i&&(i.length=0);i=null},t.prototype.dispose=function(){for(var t=Object.keys(this._events),e=0,i=t.length;e<i;e++){var n=t[e],o=this._events[n];o&&o.splice(0),o=null}this._events={}},t}()},function(t,e,i){"use strict";var n=i(1),o=function(){function t(t){var e=this;this.uid=null,this.mode="normal",this.vertexes=[],this.midpoints=[],this.probePoints=[],this.slopeRatio=[],this.isCrop=!1,this.ctrlRadius=4,this.sensorRadius=4,this.defaultLineColor="rgba(0,0,0,1)",this.defaultFirstPointColor="rgba(255,0,0,1)",this.invalidLineColor="rgba(255,0,0,1)",this.invalidFirstPointColor="rgba(0,0,0,1)",this.lineColor="rgba(0,0,0,1)",this.firstPointColor="rgba(0,0,0,1)",this.pointFillColor="rgba(255,255,255,0)",this.lineWidth=1,this.dashLine=[4,2],this.isPointSelected=!1,this.activeProbePoint=null,this.moveLeft=0,this.moveTop=0,this.isMoveBox=!1,this.width=0,this.height=0,this.type="bottomRight",this.keepAspectRatio=!1,this.aspectRatio=0,this._startX=null,this._startY=null,this._lastX=null,this._lastY=null,this._lastWhr=1,this.zoom=1,this.dpr=1,this.uid=Object(n.I)(11),Object.keys(t).forEach((function(i){e[i]=t[i]})),this._initBox()}return t.prototype.getRect=function(){if("free"===this.mode)return null;var t=this._getMaxPoint(),e=t.minX,i=t.maxX,n=t.minY,o=t.maxY;return{x:Math.floor(e),y:Math.floor(n),width:Math.floor(i-e),height:Math.floor(o-n)}},t.prototype._initBox=function(){this.midpoints=this._calcMidpoint(this.vertexes),this.probePoints=this.vertexes.slice().concat(this.midpoints.slice()),this.slopeRatio=this._calcSlopeRatio(this.vertexes)},t.prototype._getMaxPoint=function(){return{minX:Math.min(this.probePoints[0],this.probePoints[2],this.probePoints[4],this.probePoints[6]),maxX:Math.max(this.probePoints[0],this.probePoints[2],this.probePoints[4],this.probePoints[6]),minY:Math.min(this.probePoints[1],this.probePoints[3],this.probePoints[5],this.probePoints[7]),maxY:Math.max(this.probePoints[1],this.probePoints[3],this.probePoints[5],this.probePoints[7])}},t.prototype.checkPointPosition=function(t){var e=this._getMaxPoint(),i=e.minX,n=e.maxX,o=e.minY,r=e.maxY,s=this.probePoints[2*t],a=this.probePoints[2*t+1];return t<4?s===n&&a===r?"se":s===n&&a===o?"ne":s===i&&a===o?"nw":s===i&&a===r?"sw":null:s===n?"e":a===r?"s":s===i?"w":a===o?"n":null},t.prototype.onStartHandler=function(t,e,i){var n=this.isBoxSelected(t,e);if(i!==undefined&&(n=i),null!==n&&(this._startX=t,this._startY=e,this._lastX=t,this._lastY=e,-1===n?(this.isPointSelected=!1,this.activeProbePoint=null,"normal"===this.mode&&(this.isMoveBox=!0)):(this.isPointSelected=!0,this.activeProbePoint=n,this.isMoveBox=!1),"free"===this.mode&&n>3)){var o=n-4;this.k1=this.slopeRatio[(o+1)%4],this.b1=this.probePoints[(2*o+3)%8]-this.k1*this.probePoints[(2*o+2)%8],this.k2=this.slopeRatio[(o+3)%4],this.b2=this.probePoints[(2*o+1)%8]-this.k2*this.probePoints[(2*o+0)%8]}},t.prototype.onMoveHandler=function(t,e,i){if(this.isPointSelected||this.isMoveBox){var n=this.probePoints.slice();if(this.isPointSelected){var o=this.activeProbePoint;i!==undefined&&(o=i),"normal"===this.mode?n=this._movePointNormal(n,o,t,e):(n=this._movePointFree(n,o,t,e),this.slopeRatio=this._calcSlopeRatio(this.probePoints).slice(0,4)),this.probePoints=n.slice(),this._checkRectConvexity(this.probePoints)?(this.lineColor=this.defaultLineColor,this.firstPointColor=this.defaultFirstPointColor):(this.lineColor=this.invalidLineColor,this.firstPointColor=this.invalidFirstPointColor)}else if(this.isMoveBox){var r=t-this._lastX,s=e-this._lastY;if(0===r&&0===s)return;n=this._moveBox(n,r,s),this.probePoints=n.slice()}var a=this._calcMidpoint(this.probePoints);this.probePoints=this.probePoints.slice(0,8).concat(a),this.midpoints=a,this._lastX=t,this._lastY=e}},t.prototype.onEndHandler=function(){this.lineColor=this.defaultLineColor,this.firstPointColor=this.defaultFirstPointColor;var t=this._startX,e=this._startY;this._startX=0,this._startY=0;var i=this._lastX,n=this._lastY;if(this.isPointSelected||this.isMoveBox){this.isPointSelected=!1,this.isMoveBox=!1,this.activeProbePoint=null;var o=this._checkRectConvexity(this.probePoints);(t===i&&e===n||!o)&&(this.probePoints=this.vertexes.slice().concat(this.midpoints)),this.vertexes=this.probePoints.slice(0,8),this.midpoints=this._calcMidpoint(this.probePoints),this.probePoints=this.probePoints.slice(0,8).concat(this.midpoints),this.slopeRatio=this._calcSlopeRatio(this.probePoints).slice(0,4)}},t.prototype._checkEdge=function(t,e){return t>=0&&t<=this.width&&e>=0&&e<this.height},t.prototype._movePointNormal=function(t,e,i,n){i=Math.max(0,Math.min(this.width,i)),n=Math.max(0,Math.min(this.height,n));var o=0,r=0;if(this.keepAspectRatio){var s=this._getMaxPoint(),a=s.minX,l=s.maxX,h=s.minY,u=s.maxY,c=this.checkPointPosition(e),d=(l-a)/(u-h);0===d||d===Infinity||d===-Infinity||isNaN(d)?d=this._lastWhr:this._lastWhr=d,o=0,r=0;var p="width";if(e<4){if(o=i-t[2*e],r=n-t[2*e+1],0===o||0===r)return t;p="width"}else{var _=e-4;if("e"===c?(e=(_+1)%4,p="width"):"s"===c?(e=_,p="height"):"w"===c?(e=_,p="width"):"n"===c&&(e=(_+1)%4,p="height"),o=i-t[2*_],r=n-t[2*_+1],0===o||0===r)return t}"height"===p?(o=r*d,"ne"!==c&&"sw"!==c&&"n"!==c&&"w"!==c||(o=-o)):(r=o/d,"ne"!==c&&"sw"!==c&&"n"!==c&&"w"!==c||(r=-r));var v=t[2*e]+o,f=t[2*e+1]+r;v<0?(o=0-t[2*e],r=0):v>this.width?(o=this.width-t[2*e],r=0):f<0?(r=0-t[2*e+1],o=0):f>this.height&&(r=this.height-t[2*e+1],o=0),t[2*e]+=o,t[2*e+1]+=r;m=(e+1)%4,g=(e+3)%4;e%2?(t[2*m]+=o,t[2*g+1]+=r):(t[2*m+1]+=r,t[2*g]+=o)}else if(e<4){if(o=i-t[2*e],r=n-t[2*e+1],0===o&&0===r)return t;t[2*e]=i,t[2*e+1]=n;var m=(e+1)%4,g=(e+3)%4;e%2?(t[2*m]=i,t[2*g+1]=n):(t[2*m+1]=n,t[2*g]=i)}else{var y=e-4,b=this.slopeRatio[y%4];0===b?(t[(2*y+3)%8]=n,t[(2*y+1)%8]=n):b!==Infinity&&b!==-Infinity||(t[(2*y+2)%8]=i,t[(2*y+0)%8]=i)}return t},t.prototype._movePointFree=function(t,e,i,n){i=Math.max(0,Math.min(this.width,i)),n=Math.max(0,Math.min(this.height,n));var o=t.slice();if(e<4){var r=i-t[2*e],s=n-t[2*e+1];if(0===r&&0===s)return t;t[2*e]=i,t[2*e+1]=n}else{var a=e-4,l=this.slopeRatio[a%4],h=n-l*i,u=-h/l,c=h,d=t[(2*a+9)%8]-l*t[(2*a+8)%8],p=-d/l,_=this,v=_.k1,f=_.b1,m=_.k2,g=_.b2;0===l?(t[(2*a+3)%8]=n,v!==Infinity&&v!==-Infinity&&(t[(2*a+2)%8]=(n-f)/v),t[(2*a+1)%8]=n,m!==Infinity&&m!==-Infinity&&(t[(2*a+0)%8]=(n-g)/m)):l===Infinity||l===-Infinity?(t[(2*a+2)%8]=i,t[(2*a+3)%8]=v*i+f,t[(2*a+0)%8]=i,t[(2*a+1)%8]=m*i+g):(0===v?t[(2*a+2)%8]+=u-p:v===Infinity||v===-Infinity?t[(2*a+3)%8]+=c-d:(t[(2*a+2)%8]=(f-h)/(l-v),t[(2*a+3)%8]=(l*f-v*h)/(l-v)),0===m?t[(2*a+0)%8]+=u-p:m===Infinity||m===-Infinity?t[(2*a+1)%8]+=c-d:(t[(2*a+0)%8]=(g-h)/(l-m),t[(2*a+1)%8]=(l*g-m*h)/(l-m)));for(var y=0;y<4;y++){var b=t[2*y],E=t[2*y+1];if(b<0||b>this.width||E<0||E>this.height)return o}}return t},t.prototype._moveBox=function(t,e,i){if("normal"===this.mode){var n=Math.min(t[0],t[2],t[4],t[6]),o=Math.max(t[0],t[2],t[4],t[6]),r=Math.min(t[1],t[3],t[5],t[7]),s=Math.max(t[1],t[3],t[5],t[7]);n+e<0&&(e=-n),o+e>this.width&&(e=this.width-o),r+i<0&&(i=-r),s+i>this.height&&(i=this.height-s);for(var a=0;a<4;a++)t[2*a]+=e,t[2*a+1]+=i}return t},t.prototype._isPointOnBox=function(t,e){if("normal"===this.mode){var i=this._getMaxPoint(),n=i.minX,o=i.maxX,r=i.minY,s=i.maxY;return t>=n&&t<=o&&e>=r&&e<=s}return!1},t.prototype.isBoxSelected=function(t,e){var i=this._isPointOnBox(t,e),n=this.isCtrlPointSelected(t,e);return null!==n?n:i?-1:null},t.prototype.isCtrlPointSelected=function(t,e){var i=this.sensorRadius/this.zoom,n=this._getMaxPoint(),o=n.minX,r=n.maxX,s=n.minY,a=n.maxY,l=Math.min(Math.max(i,.1*(r-o)),3*i)*this.dpr,h=Math.min(Math.max(i,.1*(a-s)),3*i)*this.dpr,u=8;"free"===this.mode&&(u=8);for(var c=0;c<u;c++){var d=this.probePoints[2*c],p=this.probePoints[2*c+1];if(t<=d+l&&t>=d-l&&e<=p+h&&e>=p-h&&t>=0&&t<=this.width&&e>=0&&e<=this.height)return c}return null},t.prototype._checkRectConvexity=function(t){var e=(t[6]-t[0])*(t[3]-t[1])-(t[7]-t[1])*(t[2]-t[0]),i=(t[0]-t[2])*(t[5]-t[3])-(t[1]-t[3])*(t[4]-t[2]),n=(t[2]-t[4])*(t[7]-t[5])-(t[3]-t[5])*(t[6]-t[4]),o=(t[4]-t[6])*(t[1]-t[7])-(t[5]-t[7])*(t[0]-t[6]);if(e*i*n*o<0)return!1;var r=t.slice().concat(t.slice(0,2));if(this.slopeRatio.length)for(var s=0;s<2;s++){if(this.slopeRatio[s]!==this.slopeRatio[s+2])if(this._calcIntersection(r.slice(2*s,2*s+2),r.slice(2*s+2,2*s+4),r.slice(2*s+4,2*s+6),r.slice(2*s+6,2*s+8)))return!1}return e*i*n*o>0},t.prototype._calcMidpoint=function(t){for(var e=t.slice(0,8).concat(t[0],t[1]),i=[],n=0;n<4;n++){var o=(e[2*n]+e[2*n+2])/2,r=(e[2*n+1]+e[2*n+3])/2;i.push(o,r)}return i},t.prototype._calcSlopeRatio=function(t){for(var e=[],i=null,n=t.slice(0,8).concat(t[0],t[1]),o=0;o<4;o++)i=n[2*o+3]-n[2*o+1]==0&&n[2*o+2]-n[2*o]==0?0:(n[2*o+3]-n[2*o+1])/(n[2*o+2]-n[2*o]),e.push(i);return e},t.prototype._calcIntersection=function(t,e,i,n){if(this._isRectCross(t,e,i,n)&&this._isLineSegmentCross(t,e,i,n)){var o,r=void 0,s=void 0;if(r=(n[0]-i[0])*(t[1]-e[1])-(e[0]-t[0])*(i[1]-n[1]),s=(t[1]-i[1])*(e[0]-t[0])*(n[0]-i[0])+i[0]*(n[1]-i[1])*(e[0]-t[0])-t[0]*(e[1]-t[1])*(n[0]-i[0]),0===r||0===s){var a=this._getLine(t,e),l=this._getLine(i,n),h=a[0],u=a[1],c=l[0],d=l[1];if(u[0]===c[0]&&u[1]===c[1])return u;if(h[0]===d[0]&&h[1]===d[1])return h;if(this._isOnLine(u,l)&&this._isOnLine(c,a))return[c,u];if(this._isOnLine(h,l)&&this._isOnLine(d,a))return[h,d];if(this._isOnLine(h,l)&&this._isOnLine(u,l))return[h,u];if(this._isOnLine(c,l)&&this._isOnLine(d,l))return[c,d]}return o=s/r,r=(t[0]-e[0])*(n[1]-i[1])-(e[1]-t[1])*(i[0]-n[0]),[o,(s=e[1]*(t[0]-e[0])*(n[1]-i[1])+(n[0]-e[0])*(n[1]-i[1])*(t[1]-e[1])-n[1]*(i[0]-n[0])*(e[1]-t[1]))/r]}return!1},t.prototype._getLine=function(t,e){return t[0]===e[0]?t[1]<e[1]?[t,e]:[e,t]:t[0]<e[0]?[t,e]:[e,t]},t.prototype._isOnLine=function(t,e){return e[0][0]===e[1][0]?t[1]>=e[0][1]&&t[1]<=e[1][1]:t[0]>=e[0][0]&&t[0]<=e[1][0]},t.prototype._isRectCross=function(t,e,i,n){var o=Math.min,r=Math.max;return o(t[0],e[0])<=r(i[0],n[0])&&o(i[0],n[0])<=r(t[0],e[0])&&o(t[1],e[1])<=r(i[1],n[1])&&o(i[1],n[1])<=r(t[1],e[1])},t.prototype._isLineSegmentCross=function(t,e,i,n){var o,r;return!(((o=t[0]*(i[1]-e[1])+e[0]*(t[1]-i[1])+i[0]*(e[1]-t[1]))^(r=t[0]*(n[1]-e[1])+e[0]*(t[1]-n[1])+n[0]*(e[1]-t[1])))>=0&&0!==o&&0!==r)&&!(((o=i[0]*(t[1]-n[1])+n[0]*(i[1]-t[1])+t[0]*(n[1]-i[1]))^(r=i[0]*(e[1]-n[1])+n[0]*(i[1]-e[1])+e[0]*(n[1]-i[1])))>=0&&0!==o&&0!==r)},t}();i.d(e,"a",(function(){return r}));var r=function(){function t(t,e){this._activeBoxId=null,this._startX=null,this._startY=null,this._addNewFlag=null,this._drawingFlag=!1,this.cropBoxes=[],this.width=0,this.height=0,this.zoom=1,this.aspectRatio=0,this.keepAspectRatio=!1,this.mouseDown=!1,this.unselectedCallback=null,this.selectedCallback=null,this.width=t,this.height=e}return t.prototype.setKeepAspectRatio=function(t){this.keepAspectRatio=t,this._drawingFlag||this.cropBoxes.forEach((function(e){e.keepAspectRatio=t}))},t.prototype.setAspectRatio=function(t){this.aspectRatio=t},t.prototype.setZoom=function(t){this.zoom=t,this.cropBoxes.forEach((function(e){e.zoom=t}))},t.prototype.setPageSize=function(t,e){this.width=t,this.height=e},t.prototype.getRectArr=function(){var t=[];return this.cropBoxes.forEach((function(e,i){var n=Object.assign({index:i},e.getRect());t.push(n)})),t},t.prototype.clear=function(){var t;this.cropBoxes.length>0&&(null===(t=this.unselectedCallback)||void 0===t||t.call(this)),this.cropBoxes=[]},t.prototype.addFreeBox=function(t){var e=Object(n.e)(),i=new o({vertexes:t.slice(),width:this.width,height:this.height,mode:"free",dpr:e});return this.cropBoxes.push(i),i},t.prototype.addBox=function(t,e){var i=Object(n.e)(),r=new o({vertexes:t.slice(),width:this.width,height:this.height,type:e,mode:"normal",aspectRatio:this.aspectRatio,keepAspectRatio:this.keepAspectRatio,zoom:this.zoom,dpr:i});return this.cropBoxes.push(r),r},t.prototype.removeBox=function(t){return t===undefined&&this.clear(),!(t<0||t>=this.cropBoxes.length)&&(this.cropBoxes.splice(t,1),!0)},t.prototype.getBoxByUid=function(t){for(var e=this.cropBoxes.length,i=0;i<e;i++)if(this.cropBoxes[i].uid===t)return this.cropBoxes[i];return null},t.prototype.onStartHandler=function(t,e,i){this._startX=t,this._startY=e,this.mouseDown=!0;var n=this.checkSelect(t,e);if(null===n)return i||this.clear(),void(this._activeBoxId=null);this._activeBoxId=this.cropBoxes[n].uid,this.getBoxByUid(this._activeBoxId).onStartHandler(t,e)},t.prototype.onMoveHandler=function(t,e,i){if(this.mouseDown){var n=null,o=t-this._startX,r=e-this._startY,s=null,a=2/this.zoom;!this._activeBoxId&&t-this._startX<-a&&e-this._startY<-a?(s=0,this.aspectRatio>0&&(r=o/this.aspectRatio)):!this._activeBoxId&&t-this._startX>a&&e-this._startY<-a?(s=1,this.aspectRatio>0&&(r=-o/this.aspectRatio)):!this._activeBoxId&&t-this._startX>a&&e-this._startY>a?(s=2,this.aspectRatio>0&&(r=o/this.aspectRatio)):!this._activeBoxId&&t-this._startX<-a&&e-this._startY>a&&(s=3,this.aspectRatio>0&&(r=-o/this.aspectRatio));var l=[t,this._startY+r,this._startX,this._startY+r,this._startX,this._startY,t,this._startY],h=[this._startX,this._startY,this._startX,this._startY+r,t,this._startY+r,t,this._startY];if(null!==s){for(var u=[],c=0;c<4;c++)s%2?(u.push(h[2*(s+c)%8]),u.push(h[(2*(s+c)+1)%8])):(u.push(l[2*(s+c)%8]),u.push(l[(2*(s+c)+1)%8]));return n=this.addBox(u,["topLeft","topRight","bottomRight","bottomLeft"][s]),this.aspectRatio>0?n.keepAspectRatio=!0:n.keepAspectRatio=!1,this._drawingFlag=!0,this._addNewFlag=this.keepAspectRatio,this._activeBoxId=n.uid,n.onStartHandler(this._startX,this._startY,s),n.onMoveHandler(t,e,s),void(s=null)}this._activeBoxId&&(n=this.getBoxByUid(this._activeBoxId)),n&&n.onMoveHandler(t,e)}},t.prototype.onEndHandler=function(){var t;if(this.mouseDown&&(this.mouseDown=!1,this._drawingFlag=!1,this._activeBoxId)){var e=this.getBoxByUid(this._activeBoxId);null!==this._addNewFlag&&(e.keepAspectRatio=this._addNewFlag,this._addNewFlag=null),e.onEndHandler(),this.cropBoxes.length>0&&(null===(t=this.selectedCallback)||void 0===t||t.call(this,this.getRectArr())),this._activeBoxId=null}},t.prototype.checkSelect=function(t,e){var i=this.cropBoxes.length;if(0===i)return null;for(var n=i-1;n>=0;n--){if(null!==this.cropBoxes[n].isBoxSelected(t,e))return n}return null},t.prototype.checkSelectForCursor=function(t,e){var i=this.cropBoxes.length;if(0===i)return null;for(var n=i-1;n>=0;n--){var o=this.cropBoxes[n],r=o.isBoxSelected(t,e);if(null!==r){var s="move";return-1!==r&&(s=o.checkPointPosition(r)),{part:r,type:o.type,position:s}}}return null},t.prototype.dispose=function(){this.unselectedCallback=null,this.selectedCallback=null},t}()},,,function(t,e,i){},,function(t,e,i){"use strict";i.r(e);i(6);var n,o=i(1),r=i(0),s=function(){function t(t){this._clickItem=null,this._clickTimer=null,this._rightClickItem=null,this._rightClickTimer=null,this._mouseDownItem=null,this._startX=0,this._startY=0,this._mouseUpItem=null,this._evtList=[],this.onClick=null,this.onRightClick=null,this.onDoubleClick=null,this.onPointDown=null,this.onPointMove=null,this.onPointUp=null,this.onPointOver=null,this.onPointOut=null,this._element=t,this._registerEvents()}return t.prototype._registerEvents=function(){var t,e=this,i=this._element,n=Object(o.u)(),r="mousedown",s="mousemove",a="mouseup";n&&(r="touchstart",s="touchmove",a="touchend",n=!0),t=Object(o.c)(i,r,(function(t){var i,o=e._packageEvent(t);e._mouseDownItem=e.getTarget(t),e._startX=o.clientX,e._startY=o.clientY,null===(i=e.onPointDown)||void 0===i||i.call(e,o),n?e._rightClickTimer=setTimeout((function(){var t;null===(t=e.onRightClick)||void 0===t||t.call(e,o),e._mouseDownItem=null}),500):2===o.button&&(e._rightClickItem=e.getTarget(o))}),{passive:!1}),this._evtList.push(t),t=Object(o.c)(i,s,(function(t){var i,n=e._packageEvent(t);null===(i=e.onPointMove)||void 0===i||i.call(e,n);var r=Math.abs(n.clientX-e._startX),s=Math.abs(n.clientY-e._startY);(r>5||s>5)&&(clearTimeout(e._rightClickTimer),Object(o.u)()&&(e._mouseDownItem=null))}),{passive:!1}),this._evtList.push(t),t=Object(o.c)(i,a,(function(t){var i,n,o=e._packageEvent(t);e._mouseUpItem=e.getTarget(o),null===(i=e.onPointUp)||void 0===i||i.call(e,o),clearTimeout(e._rightClickTimer),e.getTarget(o)===e._rightClickItem&&2===o.button?null===(n=e.onRightClick)||void 0===n||n.call(e,o):e._mouseDownItem===e._mouseUpItem&&e._clickHandler(o),e._rightClickItem=null})),this._evtList.push(t),t=Object(o.c)(i,"mouseover",(function(t){var i;if(!Object(o.u)()){var n=t.fromElement;n===undefined&&(n=t.relatedTarget);var r=t.toElement;r===undefined&&(r=t.target),e.getTarget(t,n)!==e.getTarget(t,r)&&(null===(i=e.onPointOver)||void 0===i||i.call(e,t))}})),this._evtList.push(t),t=Object(o.c)(i,"mouseout",(function(t){var i;if(!Object(o.u)()){var n=t.fromElement;n===undefined&&(n=t.target);var r=t.toElement;r===undefined&&(r=t.relatedTarget),e.getTarget(t,n)!==e.getTarget(t,r)&&(null===(i=e.onPointOut)||void 0===i||i.call(e,t))}})),this._evtList.push(t)},t.prototype._unregisterEvents=function(){this._evtList.forEach((function(t){Object(o.s)(t)&&t()})),this._evtList.splice(0)},t.prototype._clickHandler=function(t){var e=this,i=this._packageEvent(t);clearTimeout(this._clickTimer),this.getTarget(t)===this._clickItem?(this._clickItem=null,setTimeout((function(){var t;null===(t=e.onDoubleClick)||void 0===t||t.call(e,i)}))):this._mouseDownItem===this._mouseUpItem&&(this._clickItem=this.getTarget(i),setTimeout((function(){var t;null===(t=e.onClick)||void 0===t||t.call(e,i)}))),this._mouseDownItem=null,this._mouseUpItem=null,this._clickTimer=setTimeout((function(){e._clickItem=null}),500)},t.prototype._packageEvent=function(t){var e,i=null===(e=t.changedTouches)||void 0===e?void 0:e[0];if(!i)return t;for(var n in i)t[n]===undefined&&(t[n]=i[n]);return t},t.prototype.getTarget=function(t,e){return e!==undefined?e:t.target},t.prototype.dispose=function(){this._unregisterEvents(),this._element=null,this._clickItem=null,this._clickTimer=null,this._rightClickItem=null,this._rightClickTimer=null,this._mouseDownItem=null,this._mouseUpItem=null,this.onClick=null,this.onRightClick=null,this.onDoubleClick=null,this.onPointDown=null,this.onPointMove=null,this.onPointUp=null,this.onPointOver=null,this.onPointOut=null},t}(),a=i(2),l=undefined&&undefined.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),h=function(t){function e(e,i,n){var o=t.call(this,i)||this;return o.useMyEvent=!0,o._unbindList=[],o._customCanvas=null,o._viewerContainer=null,o._postfix=e,o._viewerContainer=n,o}return l(e,t),e.prototype.uiEventInit=function(){var e=this,i=function(t){var i,n,o="#"+t+e._postfix;return null===(n=null===(i=e._viewerContainer)||void 0===i?void 0:i.el)||void 0===n?void 0:n.querySelector(o)},n=r.c.CLICK,a=(r.c.MOUSE_DOWN,r.c.MOUSE_MOVE),l=r.c.MOUSE_UP;"ontouchend"in document.documentElement&&(r.c.TOUCH_START,a=r.c.TOUCH_MOVE,l=r.c.TOUCH_END);var h,u=this._unbindList;h=Object(o.c)(window,r.c.RESIZE,o.H.call(this,this._viewerResize,40)),u.push(h),h=Object(o.c)(window,"load",(function(t){e._viewerResize(t)})),u.push(h),h=Object(o.c)(document,a,(function(t){e._documentMouseMove(t)})),u.push(h),h=Object(o.c)(document,l,(function(t){e._documentMouseUp(t)})),u.push(h),h=Object(o.c)(window,"message",(function(t){"up"===t.data.type&&e._documentMouseUp()})),u.push(h),h=Object(o.c)(document,r.c.CLICK,(function(t){e._documentClick(t)})),u.push(h),h=Object(o.c)(document,"keydown",(function(i){t.prototype._emit.call(e,r.f.DOCUMENT_KEY_DOWN,i)})),u.push(h),h=Object(o.c)(document,"keyup",(function(i){t.prototype._emit.call(e,r.f.DOCUMENT_KEY_UP,i)})),u.push(h);var c=this._viewerContainer.el;h=Object(o.c)(c,"dragstart",(function(){return!1})),u.push(h),h=Object(o.c)(c,n,(function(t){e._viewerClick(t)})),u.push(h),h=Object(o.c)(c,r.c.CONTEXTMENU,(function(t){e._viewerRightClick(t)})),u.push(h),h=Object(o.c)(c,"dragover",(function(t){Object(o.C)(t)})),u.push(h),h=Object(o.c)(c,"drop",(function(t){e._dropFile(t)})),u.push(h),h=Object(o.c)(i("navChange"),n,(function(t){e._setSelectedSidetype(t)})),u.push(h),h=Object(o.c)(i("besides"),n,(function(t){e._sidebarClick(t)})),u.push(h),h=Object(o.c)(i("stretchBar"),r.c.MOUSE_DOWN,(function(t){e._sidebarStretchStart(t)})),u.push(h),h=Object(o.c)(i("defaultTag"),n,(function(){e._openDefaultTag()})),u.push(h),h=Object(o.c)(i("treeLists"),n,(function(t){e._fileListClick(t)})),u.push(h),h=Object(o.c)(i("treeLists"),r.c.CONTEXTMENU,(function(t){e._fileListRightClick(t)})),u.push(h),h=Object(o.c)(i("treeLists"),"keyup",(function(t){e._fileListKeyUp(t)})),u.push(h),h=Object(o.c)(i("addFolder"),r.c.CLICK,(function(t){e._addNewFolder(t)})),u.push(h),h=Object(o.c)(i("tagLists"),n,(function(t){e._tagListClick(t)})),u.push(h),h=Object(o.c)(i("tagLists"),r.c.CONTEXTMENU,(function(t){e._tagListRightClick(t)})),u.push(h),h=Object(o.c)(i("tagLists"),"keyup",(function(t){e._tagListKeyUp(t)})),u.push(h),h=Object(o.c)(i("addTag"),n,(function(t){e._addNewTag(t)})),u.push(h);var d=i("canvasEventLayer");h=Object(o.c)(d,"touchstart",(function(t){e._canvasTouchStart(t)}),{passive:!1}),u.push(h),h=Object(o.c)(d,"mousedown",(function(t){e._canvasMouseDown(t)})),u.push(h),h=Object(o.c)(d,"touchmove",(function(t){e._canvasTouchMove(t)}),{passive:!1}),u.push(h),h=Object(o.c)(d,"mousemove",(function(t){e._canvasMouseMove(t)})),u.push(h),h=Object(o.c)(d,"touchend",(function(t){e._canvasTouchEnd(t)})),u.push(h),h=Object(o.c)(d,"mouseup",(function(t){e._canvasMouseUp(t)})),u.push(h),h=Object(o.c)(d,"wheel",(function(t){e._canvasWheel(t)}),{passive:!1}),u.push(h),h=Object(o.c)(d,"click",(function(t){Object(o.G)(t)})),u.push(h);var p=new s(i("canvasEventLayer"));p.onClick=function(i){t.prototype._emit.call(e,r.d.CANVAS_CLICK,i)},p.onRightClick=function(i){t.prototype._emit.call(e,r.d.CANVAS_RIGHT_CLICK,i)},p.onDoubleClick=function(i){t.prototype._emit.call(e,r.d.CANVAS_DOUBLE_CLICK,i)},p.onPointOver=function(i){t.prototype._emit.call(e,r.d.CANVAS_MOUSE_OVER,i)},p.onPointOut=function(i){t.prototype._emit.call(e,r.d.CANVAS_MOUSE_OUT,i)},this._customCanvas=p,p=null,h=Object(o.c)(i("canvasScroll"),"scroll",(function(t){e._canvasScroll(t)})),u.push(h),h=Object(o.c)(i("tabList"),n,(function(t){e._tabListClick(t)})),u.push(h),h=Object(o.c)(i("pagerInput"),"blur",(function(t){e._pagerBlur(t)})),u.push(h),h=Object(o.c)(i("pagerInput"),"keyup",(function(t){13===t.keyCode&&t.target.blur()})),u.push(h)},e.prototype.unbindEvents=function(){this._unbindList.forEach((function(t){Object(o.s)(t)&&t()})),this._unbindList=[],this._customCanvas&&(this._customCanvas.dispose(),this._customCanvas=null)},e.prototype._viewerResize=function(e){t.prototype._emit.call(this,r.f.VIEWER_RESIZE,e)},e.prototype._documentMouseUp=function(e){t.prototype._emit.call(this,r.f.DOCUMENT_POINTER_UP,e),t.prototype._emit.call(this,r.d.DOCUMENT_UP,e),t.prototype._emit.call(this,r.g.DOCUMENT_POINTER_UP,e)},e.prototype._documentMouseMove=function(e){t.prototype._emit.call(this,r.f.DOCUMENT_POINTER_MOVE,e),t.prototype._emit.call(this,r.d.DOCUMENT_MOVE,e),t.prototype._emit.call(this,r.g.DOCUMENT_POINTER_MOVE,e)},e.prototype._documentClick=function(e){t.prototype._emit.call(this,r.f.DOCUMENT_CLICK,e),t.prototype._emit.call(this,r.g.DOCUMENT_CLICK,e)},e.prototype._viewerClick=function(e){t.prototype._emit.call(this,r.f.VIEWER_CLICK,e)},e.prototype._viewerRightClick=function(e){Object(o.C)(e),t.prototype._emit.call(this,r.f.VIEWER_RIGHT_CLICK,e)},e.prototype._viewerMove=function(e){t.prototype._emit.call(this,r.f.VIEWER_MOVE,e)},e.prototype._dropFile=function(e){Object(o.C)(e),t.prototype._emit.call(this,r.g.FILE_DROP,e)},e.prototype._setSelectedSidetype=function(t){},e.prototype._sidebarClick=function(e){Object(o.G)(e),t.prototype._emit.call(this,r.f.SIDEBAR_CLICK),t.prototype._emit.call(this,r.g.SIDEBAR_CLICK)},e.prototype._sidebarStretchStart=function(e){t.prototype._emit.call(this,r.f.SIDEBAR_STRETCH_START,e)},e.prototype._openDefaultTag=function(){t.prototype._emit.call(this,r.f.OPEN_DEFAULT_TAG)},e.prototype._fileListClick=function(e){t.prototype._emit.call(this,r.f.FILE_LIST_CLICK,e),t.prototype._emit.call(this,r.g.FILE_LIST_CLICK,e)},e.prototype._fileListRightClick=function(e){t.prototype._emit.call(this,r.f.FILE_LIST_RIGHT_CLICK,e),t.prototype._emit.call(this,r.g.FILE_LIST_RIGHT_CLICK,e)},e.prototype._fileListKeyUp=function(e){t.prototype._emit.call(this,r.f.FILE_KEY_UP,e),t.prototype._emit.call(this,r.g.FILE_KEY_UP,e)},e.prototype._addNewFolder=function(e){t.prototype._emit.call(this,r.f.ADD_NEW_FOLDER,e)},e.prototype._tagListClick=function(e){t.prototype._emit.call(this,r.f.TAG_LIST_CLICK,e),t.prototype._emit.call(this,r.g.TAG_LIST_CLICK,e)},e.prototype._tagListRightClick=function(e){t.prototype._emit.call(this,r.f.TAG_LIST_RIGHT_CLICK,e),t.prototype._emit.call(this,r.g.TAG_LIST_RIGHT_CLICK,e)},e.prototype._tagListKeyUp=function(e){t.prototype._emit.call(this,r.f.TAG_KEY_UP,e),t.prototype._emit.call(this,r.g.TAG_KEY_UP,e)},e.prototype._addNewTag=function(e){t.prototype._emit.call(this,r.f.ADD_NEW_TAG,e)},e.prototype._canvasTouchStart=function(e){t.prototype._emit.call(this,r.d.CANVAS_TOUCH_START,e)},e.prototype._canvasTouchMove=function(e){t.prototype._emit.call(this,r.d.CANVAS_TOUCH_MOVE,e)},e.prototype._canvasTouchEnd=function(e){t.prototype._emit.call(this,r.d.CANVAS_TOUCH_END,e)},e.prototype._canvasMouseDown=function(e){t.prototype._emit.call(this,r.d.CANVAS_MOUSE_DOWN,e)},e.prototype._canvasMouseMove=function(e){t.prototype._emit.call(this,r.d.CANVAS_MOUSE_MOVE,e)},e.prototype._canvasMouseUp=function(e){t.prototype._emit.call(this,r.d.CANVAS_MOUSE_UP,e)},e.prototype._canvasWheel=function(e){t.prototype._emit.call(this,r.d.CANVAS_WHEEL,e)},e.prototype._canvasScroll=function(e){t.prototype._emit.call(this,r.d.CANVAS_SCROLL,e)},e.prototype._tabListClick=function(e){t.prototype._emit.call(this,r.f.TAB_LIST_CLICK,e)},e.prototype._pagerBlur=function(e){t.prototype._emit.call(this,r.f.PAGER_BLUR,e)},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.unbindEvents()},e}(a.a),u=function(){function t(t,e,i){this._pubsub=null,this.element=null,this.containerEl=null,this.location="",this.visibility=!0,this.cssStyle="",this.tagName="div",this.name="",this._postfix=t,this._pubsub=i,this.element=this._createElement(e)}return t.prototype.bindElement=function(t,e){var i=this._createElement(e);return this.containerEl=t,!!i&&(t.appendChild(i),!0)},t.prototype.setAttributes=function(t){return!!Object(o.w)(t)&&(this._initConfig(t),this._updateAttributes(),!0)},t.prototype._createElement=function(t){var e,i;this.element&&(null===(i=null===(e=this.containerEl)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,this.element),this.element=null),this._initConfig(t);var n=document.createElement(this.tagName);return this._updateAttributes(n),n},t.prototype._initConfig=function(t){if(!Object(o.w)(t))return!1;for(var e in t)t[e]!==undefined&&(this[e]=t[e]);return!0},t.prototype._updateAttributes=function(t){if(Object(o.q)(t)||(t=this.element),!t)return!1;if(t.className=this.visibility?"":" dvs-disabled",this.name&&t.classList.add("dvs-"+this.name),this.cssStyle&&t.classList.add(this.cssStyle),this.name&&(t.id=""+(this.name+this._postfix)),this.sequence!==undefined){var e=null==t?void 0:t.style;"string"==typeof e.msFlexOrder?e.msFlexOrder=this.sequence:e.order=this.sequence}return!0},t}(),c=undefined&&undefined.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),d=function(t){function e(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];return t.apply(this,e)||this}return c(e,t),e}(u),p=undefined&&undefined.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),_=function(t){function e(e,i,n){var o=t.call(this,e,i,n)||this;return o.groups={},o}return p(e,t),e}(u),v=undefined&&undefined.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),f=function(t){function e(e,i,n){var o=t.call(this,e,i,n)||this;return o.buttons={},o._setGroupClass(),o}return v(e,t),e.prototype._setGroupClass=function(){var t;null===(t=this.element)||void 0===t||t.classList.add("dvs-groupType")},e}(u),m=undefined&&undefined.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),g=function(t){function e(e,i,n){var o=t.call(this,e,i,n)||this;return o.onButtonClick="",o.iconClass="",o.text="",o.title="",o}return m(e,t),e.prototype._updateAttributes=function(t){var e=this;if(Object(o.q)(t)||(t=this.element),!t)return!1;if(t.className=("ds-dvs-ui-iconfont dvs-"+this.name+" "+(this.cssStyle||"")+" "+(this.iconClass||"")+" "+(this.visibility?"":"dvs-nodisplay")).trim(),t.id=""+(this.name+this._postfix),this.text&&Object(o.y)(this.text))if("input"===this.tagName)t.value=this.text||"";else{var i=document.createElement("span");i.innerText=this.text||"",t.appendChild(i)}var n=null==t?void 0:t.style;return"string"==typeof n.msFlexOrder?n.msFlexOrder=this.sequence:n.order=this.sequence,this.title&&(t.title=this.title),this.onButtonClick?t.onclick=function(t){e.onButtonClick&&e._pubsub.emit(r.f.CUSTOM_BUTTON_CLICK,e.onButtonClick,t)}:t.onclick=null,!0},e}(u),y=function(){function t(t){var e=t.el,i=t.sequence,n=t.isFull,r=t.pubsub,s=t.container;this.uid="",this.element=null,this.sequence=0,this.isFull=!1,this._visibility=!0,this.uid=Object(o.I)(11),this.element=e,this.sequence=i,this._pubsub=r,this.isFull=n,this._container=s,this._bindElement()}return t.prototype.show=function(){var t,e;return!this._visibility&&(this._visibility=!0,null===(e=null===(t=this.element)||void 0===t?void 0:t.classList)||void 0===e||e.remove("dvs-nodisplay"),this._pubsub.emit(r.f.VIEWER_RESIZE),!0)},t.prototype.hide=function(){var t,e;return!!this._visibility&&(this._visibility=!1,null===(e=null===(t=this.element)||void 0===t?void 0:t.classList)||void 0===e||e.add("dvs-nodisplay"),this._pubsub.emit(r.f.VIEWER_RESIZE),!0)},t.prototype.dispose=function(){var t,e;for(var i in null===(e=null===(t=this.element)||void 0===t?void 0:t.parentNode)||void 0===e||e.removeChild(this.element),this._pubsub.emit(r.f.VIEWER_RESIZE),this)delete this[i];return!0},t.prototype._bindElement=function(){var t=this._container;if(!t)return!1;var e=this.element;this.isFull?e.classList.add("dvs-upper-full"):e.classList.remove("dvs-upper-full"),e.style.order=String(this.sequence),e.style.msFlexOrder=String(this.sequence),e.classList.add("dvs-customElement"),this._visibility||e.classList.add("dvs-nodisplay"),t.appendChild(e),this._container=null,this._pubsub.emit(r.f.VIEWER_RESIZE)},t}(),b=undefined&&undefined.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),E=function(t){function e(e){var i=e.postfix,n=e.container,o=e.uiConfig,r=e.pubsub,s=t.call(this,r)||this;return s._postfix="",s.uiConfig=null,s._assembledConfig={},s._customElements={},s.contentContainer=null,s.viewerContainer=null,s._postfix=i,s.uiConfig=o,s.viewerContainer={el:s.initUi(n)},s}return b(e,t),e.prototype._myQueryById=function(t){var e,i;return null===(i=null===(e=this.viewerContainer)||void 0===e?void 0:e.el)||void 0===i?void 0:i.querySelector("#"+t)},e.prototype.initUi=function(t,e){if(e){if(!Object(o.w)(e))return null;Object(o.B)(e,this.uiConfig)}if(Object(o.y)(t)&&(t=document.getElementById(t)),!Object(o.q)(t))return null;var i=this._assemblyConfig(this.uiConfig);this._assembledConfig=i;var n=new d(this._postfix,{name:"WebViewer"});return this._createContainers({header:{},body:{sidebar:{},showImageArea:{content:{topMenu:{},tabList:{},middle:{asideMenu:{},container:{viewPort:{canvasWrapper:{canvasEventLayer:{},loadingLayer:{loadingImage:"img"}},canvasScroll:{scrollInner:{}}},videoContainer:{videoImage:"img"},innerThumbnail:{}}},bottomMenu:{}}}},hiddenBox:{}},n.element),t.appendChild(n.element),n.element},e.prototype._createContainers=function(t,e){for(var i in t){var n=null,r=t[i];if("sidebar"===i)n=this._initSidebar();else if("hiddenBox"===i)n=this._initHiddenBox();else if(this._assembledConfig[i]){var s=this._initToolbarItem(this._assembledConfig[i]);n=null==s?void 0:s.element}else{n=new d(this._postfix,{name:i,tagName:Object(o.y)(r)?r:undefined,visibility:this.uiConfig.toolbars[i]===undefined||this.uiConfig.toolbars[i]}).element}n&&(Object(o.w)(t[i])&&this._createContainers(r,n),e.appendChild(n))}return!0},e.prototype._initToolbarItem=function(t){if(!t.visibility)return null;var e=new _(this._postfix,t,this._oPub);for(var i in t.groups){var n=t.groups[i];!n.name&&(n.name=i);var o=this._initGroupItem(n);o&&e.element.appendChild(o.element)}return e},e.prototype._initGroupItem=function(t){if(!1===t.visibility)return null;t.visibility=!0;var e=new f(this._postfix,t,this._oPub);for(var i in t.buttons){var n=t.buttons[i];!n.name&&(n.name=i);var o=this._initButtonItem(n);o&&o.forEach((function(t){e.element.appendChild(t.element)}))}var r=new g(this._postfix,{name:"showBefore",visibility:!0,location:e.name,tagName:"SPAN",iconClass:"ds-dvs-ui-move_right dvs-nodisplay"},this._oPub),s=new g(this._postfix,{name:"showAfter",visibility:!0,location:e.name,tagName:"SPAN",iconClass:"ds-dvs-ui-move_left dvs-nodisplay"},this._oPub);return e.element.appendChild(r.element),e.element.appendChild(s.element),e},e.prototype._initButtonItem=function(t){var e=this;if(!1!==t.visibility){t.visibility=!0;var i=this.uiConfig.tipsConfig;if("pagination"===t.name){var n=[{name:"pagerInput",sequence:t.sequence,tagName:"input",text:"0"},{name:"pageBreak",sequence:t.sequence,tagName:"p",text:""},{name:"pagerLabel",sequence:t.sequence,tagName:"label",text:"0"}],r=[];return n.forEach((function(n){r.push(new g(e._postfix,{visibility:t.visibility,name:n.name,sequence:n.sequence,location:t.location,text:n.text||"",tagName:n.tagName,title:i[t.name]}))})),r}return Object(o.A)({title:i[t.name]},t),[new g(this._postfix,t,this._oPub)]}},e.prototype._assemblyConfig=function(t){var e,i,n,s={},a={},l=t.toolbars,h=t.groups,u=t.buttons;for(var c in l){var d=Boolean(l[c]);s[c]={name:c,visibility:d,groups:(null===(n=l[c])||void 0===n?void 0:n.groups)||{}}}for(var p in h)a[p]=h[p];for(var _ in u){var v=u[_];(f=a[p=v.location])?(f.buttons=f.buttons||{},Object(o.B)(((e={})[_]=v,e),f.buttons)):this._emit(r.d.ERROR,{code:80024,message:"The group "+p+" is not exist."})}for(var p in a){var f,m=s[c=(f=a[p]).location];m?Object(o.B)(((i={})[p]=f,i),m.groups):this._emit(r.d.ERROR,{code:80024,message:"The toolbar "+c+" is not exist."})}return s},e.prototype._initSidebar=function(){var t=this.uiConfig,e=0,i=t.tree&&t.tree.visibility,n=t.tag&&t.tag.visibility;if(!i&&!n)return null;var o=new d(this._postfix,{name:"sidebar",visibility:t.showSidebar&&(i||n)}),r="",s='<ul id="navChange'+this._postfix+'" class="dvs-navChange">',a='<ul id="paneShow'+this._postfix+'" class="dvs-paneShow">';return s+='<li id="DirctoryTreeNav'+this._postfix+'" sidetype="tree" class="dvs-DirctoryTreeNav'+(0===e?" activeTab":"")+" "+(i?"":"dvs-disabled")+'">\n <div class="ds-dvs-ui-iconfont '+t.tree.iconClass+'"></div>\n </li>',a+='<li id="DirctoryTree'+this._postfix+'" sidetype="tree" class="dvs-DirctoryTree'+(e?" dvs-nodisplay":"")+" "+(i?"":"dvs-disabled")+'">\n <ul class="treeLists" id="treeLists'+this._postfix+"\"></ul>\n <div id='addFolderBox"+this._postfix+"' class='dvs-addFolderBox'>\n <div id='addFolder"+this._postfix+"' class='dvs-addFolder'>Add folder</div>\n </div>\n </li>\n ",i&&e++,s+='<li id="TagsNav'+this._postfix+'" sidetype="tag" class="dvs-TagsNav'+(0===e?" activeTab":"")+" "+(n?"":"dvs-disabled")+' ">\n <div class="ds-dvs-ui-iconfont '+t.tag.iconClass+'"></div>\n </li>',a+='<li id="Tags'+this._postfix+'" sidetype="tag" class="dvs-Tags'+(e?" dvs-nodisplay":"")+" "+(n?"":"dvs-disabled")+'">\n \n <ul id="tagLists'+this._postfix+'" class="tagLists"></ul>\n <div id=\'addTagBox'+this._postfix+"' class='dvs-addTagBox'>\n <div id='addTag"+this._postfix+"' class='dvs-addTag'>Add tag</div>\n </div>\n </li>",n&&e++,r+=(s+="</ul>")+(a+="</ul>"),r+='<div id="stretchBar'+this._postfix+'" class="dvs-stretchBar"></div>',o.element.innerHTML=r,o.element},e.prototype._initHiddenBox=function(){this.uiConfig;return new d(this._postfix,{name:"hiddenBox"}).element},e.prototype.bindContent=function(t){var e=this._myQueryById("content"+this._postfix),i=this._myQueryById("header"+this._postfix);if(!t||!i||!e)return!1;var n=document.createElement("div");return n.setAttribute("style","display:flex;flex-direction:column;width:100%;height:100%;"),n.id="contentContainer"+this._postfix,n.appendChild(i),n.appendChild(e),t.appendChild(n),this.contentContainer=n,!0},e.prototype.unbindContent=function(t){var e;void 0===t&&(t=!1);var i=null===(e=this.viewerContainer)||void 0===e?void 0:e.el,n=this.contentContainer;if(!i||!n)return!1;var r=n.querySelector("#content"+this._postfix),s=n.querySelector("#header"+this._postfix),a=this._myQueryById("showImageArea"+this._postfix);return s&&Object(o.l)(s,i.children[0],i),a&&r&&a.appendChild(r),n&&n.parentNode&&n.parentNode.removeChild(n),this.contentContainer=null,!0},e.prototype.createCustomElement=function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=!1),Object(o.y)(t)&&(t=document.getElementById(t)),!Object(o.q)(t))return null;var n=new y({el:t,sequence:e,isFull:i,pubsub:this._oPub,container:this._myQueryById("container"+this._postfix)}),r=n.uid;return this._customElements[r]=n,n},e.prototype.removeAllCustomElements=function(){for(var t in this._customElements)this._customElements[t].element=null,this._customElements[t]=null;this._customElements=null},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.uiConfig=null,this._assembledConfig=null;for(var e=Object.keys(this._customElements),i=0,n=e.length;i<n;i++){var o=e[i],r=this._customElements[o];r&&r.dispose(),r=null}this._customElements=null,this.contentContainer=null,this.viewerContainer&&(this.viewerContainer.el=null),this.viewerContainer=null},e}(a.a),C=undefined&&undefined.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),S=function(t){function e(e,i,n){var r=t.call(this,i)||this;return r._canvasItem=null,r.renderImg=null,r.imgSrc=null,r.uid="",r.tags=[],r.optimization=!1,r._dataStore=null,r._showPage=!1,r._showSelectBox=!1,r._currentPage=-1,r._isSelected=!1,r._checkboxColor="#333",r._tempData={currentPage:-1,showPage:!1,showSelectBox:!1,isSelected:!1,checkboxColor:"#333"},r.allowCrossOrigin=!0,r.fitRatio=0,r._canvasWidth=0,r._canvasHeight=0,r._devicePixelRatio=1,r._rectArr=[],r._dataStore=n,r._devicePixelRatio=Object(o.e)(),e&&r.init(e),r}return C(e,t),e.prototype.init=function(t){for(var e in t)e!==undefined&&t[e]&&(this[e]=t[e]);this.renderImg=null},e.prototype.updateData=function(t){var e=t.data,i=t.tags,n=t.optimization;e!==this.imgSrc&&(this.imgSrc=e,this.renderImg&&(this.renderImg.onload=null),this.renderImg=null,this.tags=i,this.optimization=n)},e.prototype.emptyPage=function(){this.renderImg&&(this.renderImg.onload=null),this.renderImg=null,this._canvasItem&&(this._canvasItem.width=1,this._canvasItem.height=1,this._canvasItem.getContext("2d").clearRect(0,0,1,1),this._canvasItem.width=0,this._canvasItem.height=0)},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.emptyPage(),this.imgSrc=null,this._canvasItem=null},e.prototype.render=function(t){var e=this;if(void 0===t&&(t=!0),!this._canvasItem||this._canvasItem.clientWidth<=0||this._canvasItem.clientHeight<=0)return!1;if(this.renderImg)this.renderImg.complete&&(this.renderImg.onload=null,this._renderImage(t));else{if(!this.imgSrc)return this._clearCanvas(),!1;var i=this.renderImg||new Image;this.allowCrossOrigin&&(i.crossOrigin="anonymous");var n=this.width,o=this.height,r=this._devicePixelRatio,s=this._dataStore.getMid(this.uid);if((null==s?void 0:s.tempWidth)&&(null==s?void 0:s.tempHeight)){var a=Math.min(n/r/s.tempWidth,o/r/s.tempHeight,1);n=Math.floor(a*s.tempWidth),o=Math.floor(a*s.tempHeight)}var l=this.imgSrc;i.src=l,i.onload=function(){e._renderImage(t),i.onload=null},this.renderImg=i}},e.prototype.renderPage=function(){if(this.renderImg&&this._showPage&&this._canvasItem){var t=this.width,e=this.height,i=this._devicePixelRatio,n=Math.min(t,e)/10;n=Math.max(10*i,n),n=Math.min(20*i,n);var o=this._canvasItem.getContext("2d"),r=.99*t-n,s=.99*e-n;o.save(),o.beginPath(),o.lineWidth=i,o.fillStyle="rgba(255,255,255,0.8)",o.strokeStyle="#a79898",o.arc(r,s,n,0,2*Math.PI),o.closePath(),o.fill(),o.stroke(),o.textAlign="center",o.textBaseline="middle",o.fillStyle="#333",o.font=n+"px normal",o.fillText(String(this._currentPage),r,s+n/8,n),o.restore()}},e.prototype.renderBox=function(){if(this.renderImg&&this._showSelectBox&&this._canvasItem){var t=this.width,e=this.height,i=Math.min(t,e)/7,n=this._devicePixelRatio;i=Math.max(15*n,i),i=Math.min(40*n,i);var o=this._canvasItem.getContext("2d"),r=.01*t,s=.01*e;o.save(),o.lineWidth=i/10,o.fillStyle="rgba(255,255,255,0.8)",o.strokeStyle=this._checkboxColor,o.fillRect(r,s,i,i),o.strokeRect(r,s,i,i),this._isSelected&&(o.save(),o.beginPath(),o.lineCap="round",o.lineJoin="round",o.moveTo(r+.25*i,s+.5*i),o.lineTo(r+.5*i,s+.7*i),o.lineTo(r+5*i/6,s+.3*i),o.stroke(),o.closePath(),o.restore()),o.restore()}},e.prototype.renderOptimizedPage=function(t,e,i,n){var o=this;if(void 0===n&&(n=0),!(n>=2))if(this.renderImg&&(this.renderImg.onload=null),0!==this.width&&0!==this.height){var r=(this.width-e)/2,s=(this.height-i)/2,a=this._canvasItem;if(a){var l=a.getContext("2d");if(l){l.save(),l.clearRect(0,0,a.width,a.height);for(var h=0;h<t.length;h++){var u=t[h];l.putImageData(u.target,r,s+u.start_y)}l.restore(),this.renderPage(),this.renderBox(),this.drawRect()}}}else setTimeout((function(){o.renderOptimizedPage(t,e,i,n++)}),20)},e.prototype._renderImage=function(e){void 0===e&&(e=!0);var i=this.renderImg;if(i&&this._canvasItem){var n=this._canvasItem.getContext("2d");if(n){n.save(),n.clearRect(0,0,this._canvasItem.width,this._canvasItem.height);var o=this._calDrawImagePos(i),s=o.left,a=o.top,l=o.width,h=o.height;n.drawImage(i,s,a,l,h),n.restore(),this.renderPage(),this.renderBox(),this.drawRect(),e&&t.prototype._emit.call(this,r.g.VIEWER_PAGE_RENDERED,this._currentPage-1)}}},e.prototype._calDrawImagePos=function(t){var e=t.naturalWidth,i=t.naturalHeight,n={left:0,top:0,width:0,height:0};if(this.width<=0||this.height<=0)return n;var o=this._devicePixelRatio;if(!this.optimization){var r=this.width,s=this.height,a=this._dataStore.getMid(this.uid);if((null==a?void 0:a.tempWidth)&&(null==a?void 0:a.tempHeight)){var l=Math.min(r/o/a.tempWidth,s/o/a.tempHeight,1);r=Math.floor(l*a.tempWidth),s=Math.floor(l*a.tempHeight)}var h=Math.max(e/r,i/s);this.fitRatio=h,e/=h,i/=h}return n={left:Math.floor((this.width-e*o)/2),top:Math.floor((this.height-i*o)/2),width:Math.floor(e*o),height:Math.floor(i*o)}},e.prototype._clearCanvas=function(){if(this._canvasItem){var t=this._canvasItem.getContext("2d");t&&t.clearRect(0,0,this._canvasItem.width,this._canvasItem.height)}},Object.defineProperty(e.prototype,"width",{get:function(){return this._canvasItem?this._canvasItem.width:0},set:function(t){this._setCanvasWidth(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._canvasItem?this._canvasItem.height:0},set:function(t){this._setCanvasHeight(t)},enumerable:!1,configurable:!0}),e.prototype.setTempData=function(t){this._tempData=t},e.prototype._setCanvasWidth=function(t){this._canvasItem&&(this._canvasWidth=t,this._canvasItem.width=t)},e.prototype._setCanvasHeight=function(t){this._canvasItem&&(this._canvasHeight=t,this._canvasItem.height=t)},e.prototype.resizeCanvasSize=function(t){void 0===t&&(t=!1);var e=this._canvasItem;if(!e||!this.renderImg&&!this.imgSrc)return!1;var i=e.clientWidth*this._devicePixelRatio,n=e.clientHeight*this._devicePixelRatio;if(i<=0||n<=0)return!1;var o=this._checkIfRenderPageOrBox();if(Math.abs(i-this.width)<=2&&Math.abs(n-this.height)<=2&&this.renderImg&&!o)return!1;this.width!==i&&(this.width=i),this.height!==n&&(this.height=n),t&&-1===this.imgSrc.indexOf("blob:")&&(this.renderImg=null),this.render()},e.prototype._checkIfRenderPageOrBox=function(){var t=!1;for(var e in this._tempData){var i=this["_"+e],n=this._tempData[e];if(n===i)this._tempData[e]=i;else switch(this["_"+e]=n,e){case"currentPage":this._showPage&&(t=!0);break;case"isSelected":this._showSelectBox&&(t=!0);break;default:t=!0}}return t},e.prototype.setRect=function(t,e){this._rectArr=t,e&&(this._boxColor=e)},e.prototype.drawRect=function(){var t=this._rectArr;if(0!==t.length&&this.renderImg){var e=this._boxColor,i=this._dataStore.getMid(this.uid);if((null==i?void 0:i.tempWidth)&&(null==i?void 0:i.tempHeight))for(var n=i.tempWidth/this.renderImg.naturalWidth,o=0;o<t.length;o++)for(var r=t[o],s=0;s+1<8;s+=2){var a=e,l=r.probePoints[s]/n,h=r.probePoints[s+1]/n,u=r.midpoints[s]/n,c=r.midpoints[s+1]/n;this._drawPoint(this._transformRect(l,h),a),this._drawPoint(this._transformRect(u,c),e);var d=r.probePoints[(s+2)%8]/n,p=r.probePoints[(s+3)%8]/n;d!==undefined&&p!==undefined&&this._drawLine(this._transformRect(l,h),this._transformRect(d,p),e,r.dashLine)}}},e.prototype._transformRect=function(t,e){var i=this.renderImg,n=i.naturalWidth,o=i.naturalHeight,r=this.fitRatio;return{x:this.width/2+(t-n/2)/r*this._devicePixelRatio,y:this.height/2+(e-o/2)/r*this._devicePixelRatio}},e.prototype._drawPoint=function(t,e){var i=t.x,n=t.y;if(this._canvasItem){var o=this._canvasItem.getContext("2d");o.save(),o.lineWidth=this._devicePixelRatio,o.strokeStyle=e,o.strokeRect(i-4*this._devicePixelRatio,n-4*this._devicePixelRatio,8*this._devicePixelRatio,8*this._devicePixelRatio),o.restore()}},e.prototype._drawLine=function(t,e,i,n){var o=this,r=t.x,s=t.y,a=e.x,l=e.y;if(this._canvasItem){var h=this._canvasItem.getContext("2d");h.save();try{h.setLineDash(n.map((function(t){return t*o._devicePixelRatio})))}catch(u){}h.lineWidth=this._devicePixelRatio,h.strokeStyle=i,h.beginPath(),h.moveTo(r,s),h.lineTo(a,l),h.stroke(),h.restore()}},e}(a.a),I=function(){function t(t){void 0===t&&(t=[]),this.array=[],this.array=Object(o.J)(t)}return t.prototype.add=function(t){return!~this.array.indexOf(t)&&(this.array.push(t),!0)},t.prototype["delete"]=function(t){var e=this.array.indexOf(t);return!!~e&&(this.array.splice(e,1),!0)},t.prototype.concat=function(t){return Object(o.J)(this.array.concat(t))},t.prototype.equal=function(t){if(t.length!==this.array.length)return!1;if(!t.length)return!0;for(var e=0;e<this.array.length;e++)if(this.array[e]!==t[e])return!1;return!0},t}(),T=undefined&&undefined.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),w=undefined&&undefined.__spreadArrays||function(){for(var t=0,e=0,i=arguments.length;e<i;e++)t+=arguments[e].length;var n=Array(t),o=0;for(e=0;e<i;e++)for(var r=arguments[e],s=0,a=r.length;s<a;s++,o++)n[o]=r[s];return n},O=function(t){function e(e,i,n,o,r){var s=t.call(this,i)||this;return s.uid="",s._pubSub=null,s._viewerContainer=null,s._postfix="",s._thumbnailElement=null,s._dataStore=null,s.isInner=!1,s._iObserver=null,s._customThumbnailEvent=null,s._size=180,s._mouseShape="pointer",s._scrollDirection="vertical",s._sequence=0,s._location="horizontal",s._showThumbnail=!0,s._showPageNumber=!1,s._showSelectBox=!1,s._checkboxColor="",s._showRemoveBtn=!1,s._fullThumbnail=!1,s._multipleMode=!1,s.allowPageDragging=!0,s._allowResizing=!1,s.allowHover=!0,s.allowKeyboardControl=!0,s.autoChangeIndex=!1,s.rows=1,s.columns=1,s._background="rgba(67,66,70,1)",s._border="1px solid rgba(27,27,29,1)",s._pageBackground="rgba(0,0,0,0)",s._pageBorder="1px solid rgba(128,128,128,1)",s._selectedPageBackground="rgba(127,133,251,1)",s._selectedPageBorder="1px solid rgba(255,0,0,1)",s.hoverPageBackground="rgba(196,250,248,1)",s.hoverPageBorder="1px solid rgba(255,255,0,1)",s.placeholderBackground="rgba(255,192,203,1)",s._pageMargin=10,s._pageMarginNumber=0,s._currentPageMargin=-1,s.isDrag=!1,s.ifDragMoves=!1,s._dragTimer=null,s._dragStart=!1,s.needClick=!0,s.thumbMoveOption={napX:0,napY:0,clickX:0,clickY:0,target:null},s._stretchItem=null,s._isStretching=!1,s._isCrop=!1,s._topImageIndex=-1,s._prtScrollOnce=!1,s._calculateTopIndex=-1,s._showUids=new I,s._showIndexes=new I,s._renderIndexes=new I,s._renderUids=new I,s._tempThumbnailSize={width:1,height:1},s._splitTimer=null,s.selectedIndexes=[],s.currentIndex=-1,s._thumbnailCanvas=[],s._uidTbCanvas={},s._eventList={},s._renderTimer=null,s.isDragUp=!1,s._viewerContainer=n,s._postfix=o,s._dataStore=r,s._thumbnailInit(e),s._pubQuery=function(t){var e;return null===(e=null==n?void 0:n.el)||void 0===e?void 0:e.querySelector("#"+t)},s}return T(e,t),e.prototype._thumbnailInit=function(t){this._initThumbnailUi(t.uid),this._initThumbnailConfig(t),this._initIntersectionObserver(),this._bindSelfEvents(),this._bindUiEvent()},e.prototype._initThumbnailConfig=function(t){for(var e in this._pubSub=new a.a(t.pubsub),t)"pubsub"!==(e=e.replace("canvas",""))&&(this[e]=t[e])},e.prototype._initThumbnailUi=function(t){var e=new d(t,{name:"Thumbnail"}),i="horizontal"===this.location?"":"dvs-nodisplay",n="vertical"===this.location?"":"dvs-nodisplay";e.element.innerHTML="\n <div id='stretchBarLeft"+t+"' class='dvs-stretchBar dvs-stretchLeft "+i+"'></div>\n <div id='stretchBarTop"+t+"' class='dvs-stretchBar dvs-stretchTop "+n+"'></div>\n <div id='stretchBarRight"+t+"' class='dvs-stretchBar dvs-stretchRight "+i+"'></div>\n <div id='stretchBarBottom"+t+"' class='dvs-stretchBar dvs-stretchBottom "+n+"'></div>\n <ul id=\"thumbLists"+t+'" class="dvs-thumbLists"></ul>\n ',this._thumbnailElement=e.element,this._myQuery=function(t){var e;return null===(e=this._thumbnailElement)||void 0===e?void 0:e.querySelector("#"+t)},this._myQueryAll=function(t){var e;return null===(e=this._thumbnailElement)||void 0===e?void 0:e.querySelectorAll("#"+t)}},e.prototype._initIntersectionObserver=function(){var t=this;if(window.IntersectionObserver&&this._thumbnailElement){var e=new IntersectionObserver((function(e){t._handleObservePages(e)}),{root:this._thumbnailElement.querySelector(".dvs-thumbLists")});this._iObserver=e}},Object.defineProperty(e.prototype,"size",{get:function(){return this._size},set:function(t){this._size=t,t=String(t),this._fullThumbnail?t="100%":/\d+$/.test(t)&&(t+="px");var e=this._thumbnailElement;e&&(e.style.flex="0 0 "+t,e.style.msFlex="0 0 "+t,"vertical"===this.location?(e.style.width="100%",e.style.maxWidth="100%",e.style.height=t,e.style.maxHeight=t):(e.style.width=t,e.style.maxWidth=t,e.style.height="100%",e.style.maxHeight="100%"),this._resizeViewer())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mouseShape",{get:function(){return this._mouseShape},set:function(t){this._mouseShape=t;var e=this._thumbnailElement;e&&(e.style.cursor=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scrollDirection",{get:function(){return this._scrollDirection},set:function(t){this._scrollDirection=t;var e=this._thumbnailElement;if(e){var i=e.querySelector("#thumbLists"+this.uid);"vertical"===t?(i.style.flexDirection="row",i.style.overflowX="hidden",i.style.overflowY="auto"):(i.style.flexDirection="column",i.style.overflowX="auto",i.style.overflowY="hidden"),this._resizeViewer(!0)}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sequence",{get:function(){return this._sequence},set:function(t){this._sequence=t;var e=this._thumbnailElement;e&&(e.style.order=String(t),e.style.msFlexOrder=t,this._updateStretchBars(),this._setSplitBarDelay())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"location",{get:function(){return this._location},set:function(t){var e;this._location=t;var i=null,n=null===(e=this._viewerContainer)||void 0===e?void 0:e.el;if(n&&this._thumbnailElement){var o={vertical:"#content"+this._postfix,horizontal:"#middle"+this._postfix,canvas:"#innerThumbnail"+this._postfix};(i=null==n?void 0:n.querySelector(o[t]))&&i.appendChild(this._thumbnailElement),this._updateStretchBars(),this.size=this._size,this._setSplitBarDelay(),this._resizeViewer(!0)}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"showThumbnail",{get:function(){return this._showThumbnail},set:function(t){this._showThumbnail=t;var e=this._thumbnailElement;e&&(t?e.classList.remove("dvs-disabled"):e.classList.add("dvs-disabled"),this.updatePageLayout(),this._resizeViewer(!0),this._setSplitBarDelay())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"showPageNumber",{get:function(){return this._showPageNumber},set:function(t){this._showPageNumber=t,this.renderCanvas()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"showSelectBox",{get:function(){return this._showSelectBox},set:function(t){this._showSelectBox=t,this.renderCanvas()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fullThumbnail",{get:function(){return this._fullThumbnail},set:function(t){this._fullThumbnail=t,this.size=this._size;var e=this._myQuery("thumbnailStretchBarRight"+this.uid);e&&(t?e.classList.add("dvs-nodisplay"):e.classList.remove("dvs-nodisplay"))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"background",{get:function(){return this._background},set:function(t){this._background=t;var e=this._myQuery("thumbLists"+this.uid);e&&(e.style.background=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"border",{get:function(){return this._border},set:function(t){this._border=t;var e=this._thumbnailElement;e&&(e.style.border=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"selectedPageBorder",{get:function(){return this._selectedPageBorder},set:function(t){this._selectedPageBorder=t;for(var e=this._myQueryAll("thumbLists"+this.uid+">li.dvs-activeThumb"),i=0;i<e.length;i++){e[i].style.border=t}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"selectedPageBackground",{get:function(){return this._selectedPageBackground},set:function(t){this._selectedPageBackground=t;for(var e=this._myQueryAll("thumbLists"+this.uid+">li.dvs-activeThumb"),i=0;i<e.length;i++){e[i].style.background=t}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pageBackground",{get:function(){return this._pageBackground},set:function(t){this._pageBackground=t;var e=this._myQuery("thumbLists"+this.uid);if(e&&e.children)for(var i=e.children,n=0;n<i.length;n++){var o=i[n];o.classList.contains("dvs-activeThumb")||(o.style.background=t)}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pageBorder",{get:function(){return this._pageBorder},set:function(t){this._pageBorder=t;var e=this._myQuery("thumbLists"+this.uid);if(e&&e.children)for(var i=e.children,n=0;n<i.length;n++){var o=i[n];o.classList.contains("dvs-activeThumb")||(o.style.border=t)}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pageMargin",{get:function(){return this._pageMargin},set:function(t){this._pageMargin=t,this._currentPageMargin=-1,this._resizeViewer(!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"allowResizing",{get:function(){return this._allowResizing},set:function(t){this._allowResizing=t,this._updateStretchBars()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"showRemoveBtn",{get:function(){return this._showRemoveBtn},set:function(t){var e,i;this._showRemoveBtn=t,t?null===(e=this._thumbnailElement)||void 0===e||e.classList.remove("dvs-hide-remove-btn"):null===(i=this._thumbnailElement)||void 0===i||i.classList.add("dvs-hide-remove-btn")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"multipleMode",{get:function(){return this._multipleMode},set:function(t){t!==this._multipleMode&&(this._multipleMode=t,this._showSelectBox=t,this.renderCanvas())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"checkboxColor",{get:function(){return this._checkboxColor},set:function(t){t!==this._checkboxColor&&(this._checkboxColor=t,this.renderCanvas())},enumerable:!1,configurable:!0}),e.prototype._bindSelfEvents=function(){var e,i=this,n=((e={})[r.f.UPDATE_THUMBNAIL_PROP]=this._updateProps,e[r.f.SCROLL_TO]=this.scrollTo,e[r.f.SET_VIEW_MODE]=this.setViewMode,e);for(var o in this._eventList=n,n)this._pubSub._on(o,n[o].bind(this));t.prototype._on.call(this,r.f.DOCUMENT_POINTER_MOVE,this._documentMouseMove.bind(this)),t.prototype._on.call(this,r.f.DOCUMENT_POINTER_UP,this._documentMouseUp.bind(this)),t.prototype._on.call(this,r.g.BUFFER_CHANGED,(function(t){"remove"===t.action&&(i._prtScrollOnce=!0)}))},e.prototype._bindUiEvent=function(){var e=this,i=this._thumbnailElement;if(i){var n=new s(i);n.onPointDown=function(t){e._thumbnailDragStart(t),e._thumbnailPointerDown(t)},n.onPointMove=function(t){e._thumbnailDragMove(t),e._thumbnailPointerMove(t)},n.onPointUp=function(t){e._thumbnailPointerUp(t)},n.onClick=function(t){e._thumbnailClick(t)},n.onRightClick=function(t){e._thumbnailRightClick(t)},n.onDoubleClick=function(t){e._thumbnailDoubleClick(t)},n.onPointOver=function(t){e._thumbnailMouseOver(t)},n.onPointOut=function(t){e._thumbnailMouseOut(t)},n.getTarget=function(t,i){return i!==undefined?e.getImageItem(i):e.getImageItem(t)},this._customThumbnailEvent=n,Object(o.c)(i.querySelector(".dvs-thumbLists"),"scroll",(function(){e._thumbnailScroll()})),Object(o.c)(i,Object(o.u)()?"touchstart":"mousedown",(function(t){e._thumbnailStretchStart(t)}),{passive:!1}),Object(o.c)(i,"click",(function(i){t.prototype._emit.call(e,r.d.UPDATE_FOCUS,{viewerId:e._postfix.replace("-",""),thumbnailId:e.uid}),Object(o.G)(i)}))}},e.prototype.unbindEvents=function(){var t;if(null===(t=this._customThumbnailEvent)||void 0===t||t.dispose(),this._customThumbnailEvent=null,this._pubSub)for(var e in this._eventList)this._pubSub._off(e)},e.prototype.unbindUi=function(){var t,e,i;this.unbindEvents();var n=this._thumbnailCanvas;if(n)for(var o=0;o<n.length;o++){var r=n[o];r&&r.dispose()}this._thumbnailCanvas=null,this._viewerContainer=null,this._stretchItem=null,null===(t=this._iObserver)||void 0===t||t.disconnect(),this._iObserver=null,null===(i=null===(e=this._thumbnailElement)||void 0===e?void 0:e.parentElement)||void 0===i||i.removeChild(this._thumbnailElement),this._thumbnailElement=null},e.prototype.updateContent=function(t){void 0===t&&(t=[]),this._patch(t),this._updateElements(),this.renderCanvas()},e.prototype.updatePageItem=function(t){var e=this._thumbnailCanvas;if(e)for(var i=0;i<e.length;i++){var n=e[i];if(n.uid===t.uid){n.updateData(t),-1!==this._renderUids.array.indexOf(t.uid)&&n.resizeCanvasSize(this.isInner&&1===this.rows&&1===this.columns);break}}},e.prototype.renderCanvas=function(){var t=this;this._renderTimer&&clearTimeout(this._renderTimer),this._renderTimer=setTimeout((function(){var e=t.selectedIndexes;if(t._thumbnailCanvas)for(var i=t._renderUids.array,n=t._thumbnailCanvas.length,o=0;o<n;o++){var r=t._thumbnailCanvas[o];~i.indexOf(r.uid)?(r.setTempData({showPage:t.showPageNumber,showSelectBox:t.showSelectBox,currentPage:o+1,isSelected:-1!==e.indexOf(o),checkboxColor:t.checkboxColor}),r.resizeCanvasSize(1===t.rows&&1===t.columns&&t.isInner)):null==r||r.emptyPage()}}),100)},e.prototype.keydownCallBack=function(t){this.selectImageByKey(t),this._pubSub._emit(r.g.KEY_DOWN,t)},e.prototype.keyupCallBack=function(t){this._pubSub._emit(r.g.KEY_UP,t)},e.prototype.selectImageByKey=function(t){if(this.allowKeyboardControl&&this._thumbnailCanvas.length){var e=this.selectedIndexes.slice().pop(),i=this.rows,n=this.columns,s="vertical"===this.scrollDirection,a=e;switch(t.key){case"ArrowUp":case"Up":if(s)a-=n;else{if(Math.floor((a-1)/i)!==Math.floor(a/i))return;a-=1}break;case"ArrowDown":case"Down":if(s)a+=n;else{if(Math.floor((a+1)/i)!==Math.floor(a/i))return;a+=1}break;case"ArrowLeft":case"Left":if(s){if(Math.floor((a-1)/n)!==Math.floor(a/n))return;a-=1}else a-=i;break;case"ArrowRight":case"Right":if(s){if(Math.floor((a+1)/n)!==Math.floor(a/n))return;a+=1}else a+=i;break;default:return}this._viewerEmit(r.b.GOTO_PAGE,a),Object(o.C)(t)}},e.prototype._updateElements=function(){var t=this._myQuery("thumbLists"+this.uid);if(!t)return!1;for(var e=0;e<t.children.length;e++){var i=t.children[e],n=this._thumbnailCanvas[e];n&&i&&(i["dvs-defaultIndex"]=e,i["dvs-tags"]=n.tags,i["dvs-uid"]=n.uid)}},e.prototype.handleInnerProp=function(t,e){t in this&&(this[t]=e)},e.prototype.setHoverColor=function(t){if(this.allowHover){var e=this.getImageItem(t);e&&(e.classList.contains("dvs-activeThumb")||(e.style.background=this.hoverPageBackground,e.style.border=this.hoverPageBorder))}},e.prototype.setImageColor=function(t){if(this.allowHover){var e=this.getImageItem(t);e&&(e.classList.contains("dvs-activeThumb")?(e.style.background=this.selectedPageBackground,e.style.border=this.selectedPageBorder):(e.style.background=this._pageBackground,e.style.border=this.pageBorder))}},e.prototype._addNodes=function(t,e,i){var n,s,a=this,l=[],h=this._myQuery("thumbLists"+this.uid);if(h){for(var u=h.children[e],c=document.createDocumentFragment(),d=function(e){var i=t[e],n=p._initNode(i);l.push(n);var h=document.createElement("li");h.style.background=p.pageBackground,h.style.border=p.pageBorder;var u=document.createElement("canvas");if(u.className="dvs-thumbnailCanvas",u.width=0,u.height=0,h.appendChild(u),n._canvasItem=u,!p.isInner){var d=document.createElement("span");d.className="dvs-thumbnail-remove",d.onclick=function(){var t=Object(o.h)(h);a._pubSub._emit(r.g.REMOVE_PAGE,t)},h.appendChild(d)}null===(s=p._iObserver)||void 0===s||s.observe(h),c.appendChild(h)},p=this,_=e;_<=i;_++)d(_);Object(o.l)(c,u,h),(n=this._thumbnailCanvas).splice.apply(n,w([e,0],l))}},e.prototype._removeNodes=function(t,e,i){var n,o=t.splice(e,i-e+1),r=this._myQuery("thumbLists"+this.uid);if(r&&r.children&&r.children.length){for(var s=e;s<=i;s++){var a=r.children[e];if(a){var l=a["dvs-uid"];this._showUids["delete"](l),this._renderUids["delete"](l),this._getViewIndexesByUids(),null===(n=this._iObserver)||void 0===n||n.unobserve(a),r.removeChild(a)}}o.forEach((function(t){return t.dispose()}))}},e.prototype._patch=function(t){for(var e=this._thumbnailCanvas,i=0,n=e.length-1,o=0,r=t.length-1;i<=n&&o<=r;){var s=e[i],a=e[n],l=t[o],h=t[r];if(this._sameNode(s,l))++i,++o,s.updateData(l);else if(this._sameNode(a,h))--n,--r,a.updateData(h);else if(this._sameNode(s,h))s.updateData(h),this._moveNode(e,i,n);else if(this._sameNode(a,l))a.updateData(l),this._moveNode(e,n,i);else{for(var u=void 0,c=i;c<=n;c++){if(e[c].uid===(null==l?void 0:l.uid)){u=c;break}}u!==undefined?(e[u].updateData(l),this._moveNode(e,u,i)):(this._addNodes(t,o,o),n++),++o,++i}}i>n?this._addNodes(t,o,r):o>r&&this._removeNodes(e,i,n)},e.prototype._sameNode=function(t,e){return(null==t?void 0:t.uid)===(null==e?void 0:e.uid)},e.prototype._moveNode=function(t,e,i){var n=t.splice(e,1)[0];t.splice(i,0,n);var r=this._myQuery("thumbLists"+this.uid),s=r.removeChild(r.children[e]);s&&Object(o.l)(s,r.children[i],r)},e.prototype._initNode=function(t,e){var i={uid:t.uid,imgSrc:t.data,tags:t.tags};if(!e)return new S(i,this._pubSub.getPublishSubscribe(),this._dataStore);e.init(i)},e.prototype._createKeyHashList=function(t,e,i){var n,o,r,s={};for(n=e;n<=i;++n)(o=null==(r=t[n])?void 0:r.uid)&&(s[o]=n);return s},e.prototype.selectThumbnailByIndexes=function(t){Object(o.m)(t)?this.selectedIndexes=t:t=this.selectedIndexes,this.clearAbsolute(),this._updateSelectedPageStyle(),(this.showPageNumber||this.showSelectBox)&&this.renderCanvas()},e.prototype._updateSelectedPageStyle=function(){var t=this._myQuery("thumbLists"+this.uid);if(!t)return!1;var e=this.selectedIndexes,i=t.children;if(i&&i.length)for(var n=i.length,o=0;o<n;o++){var r=i[o],s=-1!==e.indexOf(o);this._selectThumbnailByNode(r,s)}},e.prototype._selectThumbnailByNode=function(t,e){t&&(e?(t.classList.add("dvs-activeThumb"),t.style.border=this.selectedPageBorder,t.style.background=this.selectedPageBackground):(t.classList.remove("dvs-activeThumb"),t.style.border=this.pageBorder,t.style.background=this.pageBackground))},e.prototype.setViewMode=function(t,e){var i,n;if(this.rows=e,this.columns=t,1===e&&1===t?null===(i=this._thumbnailElement)||void 0===i||i.classList.add("dvs-hide-remove-btn"):this.showRemoveBtn&&(null===(n=this._thumbnailElement)||void 0===n||n.classList.remove("dvs-hide-remove-btn")),10===document.documentMode){var o=this._myQuery("thumbLists"+this.uid);if(!o)return;o.style.marginTop=o.style.marginTop?"":"0.1px",this.renderCanvas()}return this.showLatestPage(),!0},e.prototype.updatePageLayout=function(){var t;if(!this.showThumbnail)return!1;var e=this._myQuery("thumbLists"+this.uid);if(!(null===(t=null==e?void 0:e.children)||void 0===t?void 0:t.length))return!1;var i=e.clientWidth-1,n=e.clientHeight-1,o=this._getCurrentPageMargin(i,n,e);this._pageMarginNumber=o,this._setPageSize(i,n,e,o);var r=e.clientWidth-1,s=e.clientHeight-1;r===i&&s===n||this._setPageSize(r,s,e,o),this.renderCanvas()},e.prototype.calculateSize=function(){var t=this._thumbnailElement;if(t){var e=t.getBoundingClientRect();if(0==e.width||0==e.height)return!1;var i=this._tempThumbnailSize,n=t.clientWidth,o=t.clientHeight;i.width===n&&i.height===o||(i.width=n,i.height=o,this._pubSub._emit(r.g.THUMBNAIL_STRETCH,e.width,e.height))}return this.updatePageLayout(),!0},e.prototype._getCurrentPageMargin=function(t,e,i){var n=this.rows,o=this.columns,r=this._pageMargin;if(r=String(r),/%$/.test(r)){var s=parseInt(r),a=Math.min(1/(o+1),1/(n+1));r=(s=Math.min(s/100,a))*e-1}else if(/em$/.test(r)){if(this._currentPageMargin<0){var l=parseInt(r),h=parseInt(window.getComputedStyle(i).fontSize);this._currentPageMargin=l*h}r=this._currentPageMargin}else r=parseInt(r);return t&&r*(o+1)>t+5&&(r=t/(o+1)),e&&r*(n+1)>e+5&&(r=e/(n+1)),r},e.prototype._setPageSize=function(t,e,i,n){if(null==i?void 0:i.children)for(var o=this.rows,r=this.columns,s=1===this.columns&&1===this.rows,a=Math.floor((t-(r+1)*n)/r),l=Math.floor((e-(o+1)*n)/o),h=i.children,u="vertical"===this._scrollDirection,c=0;c<h.length;c++){var d=h[c];s?(d.style.width=u?Math.floor(t)+"px":"100%",d.style.height=u?"100%":Math.floor(e)+"px",i.style.padding="0px",d.style.margin=0===c?"0px":u?n+"px 0px 0px":"0px 0px 0px "+n+"px "):(d.style.margin="0px "+n+"px "+n+"px 0px",i.style.padding=n+"px 0px 0px "+n+"px",c===h.length-1&&(d.style[u?"marginBottom":"marginRight"]=n+1+"px"),d.style.width=a+"px",d.style.height=l+"px")}},e.prototype.updateDisplayedUidsIE=function(){var t=this;if(window.IntersectionObserver)return!1;if(!this.showThumbnail||!this._thumbnailCanvas)return!1;var e=this._getDisplayedImagesIE(),i=this._getRenderIndexes(e);this._renderIndexes.array=i;var n=i.map((function(e){var i;return null===(i=t._thumbnailCanvas[e])||void 0===i?void 0:i.uid}));this._renderUids.array=n,this.renderCanvas(),this._viewerEmit(r.f.MERGE_DISPLAYED_UIDS,n.slice(),this.uid)},e.prototype.updateDisplayedUids=function(){if(!this.showThumbnail)return!1;var t=this._thumbnailCanvas;if(!t.length)return this._showIndexes.array=[],this._renderIndexes.array=[],void(this._renderUids.array=[]);var e=this._renderIndexes.array.slice(0),i=[];e.forEach((function(e){t[e]&&i.push(t[e].uid)})),this._renderUids.array=i,this._viewerEmit(r.f.MERGE_DISPLAYED_UIDS,i,this.uid)},e.prototype._handleObservePages=function(t){var e=this;t.forEach((function(t){var i=t.intersectionRect,n=t.target,o=null==n?void 0:n["dvs-uid"];null==n||n["dvs-defaultIndex"];(null==i?void 0:i.width)>0||(null==i?void 0:i.height)>0?e._showUids.add(o):e._showUids["delete"](o)})),this._getViewIndexesByUids(),this.updateDisplayedUids(),this.renderCanvas()},e.prototype._getRenderIndexes=function(t){var e=this,i=e.rows,n=e.columns,o=e.scrollDirection,r=e._thumbnailCanvas;if(!r)return[];var s=this._thumbnailCanvas.length,a=0;t.forEach((function(t){s=Math.min(t,s),a=Math.max(t,a)}));for(var l=[],h=s;h<=a;h++)r[h]&&l.push(h);if("vertical"===o){for(h=s-3*n;h<s;h++)r[h]&&l.push(h);for(var u=a+1;u<a+3*n;u++)r[u]&&l.push(u)}else{for(h=s-3*i;h<s;h++)r[h]&&l.push(h);for(u=a+1;u<a+3*i;u++)r[u]&&l.push(u)}return l},e.prototype._getViewIndexesByUids=function(){var t=this._showUids,e=[];this._thumbnailCanvas.forEach((function(i,n){t.array.indexOf(i.uid)>-1&&e.push(n)})),this._showIndexes.array=e;var i=this._getRenderIndexes(e.slice());this._renderIndexes.array=i},e.prototype.triggerTopImageChange=function(t){void 0===t&&(t=""),this.updateDisplayedUidsIE(),this._updateTopPageIndex(t)},e.prototype.scrollTo=function(t,e){if(void 0===e&&(e=""),!this.showThumbnail||this._prtScrollOnce)return this._prtScrollOnce=!1,!0;var i=this._myQuery("thumbLists"+this.uid);if(!i||i.clientWidth<=0||i.clientHeight<=0||t>i.children.length-1||i.children.length<=0||t<0)return!1;if(i.scrollHeight>i.clientHeight||i.scrollWidth>i.clientWidth){var n=i.getBoundingClientRect(),o=this.scrollDirection,r=-1,s=-1,a=i.children[t],l=a.getBoundingClientRect(),h=parseInt(i.style.padding);"vertical"===o?(s=0,l.top<=n.top?r=a.offsetTop-h+1:l.bottom>=n.bottom&&(r=a.offsetTop-n.height+l.height+h+1)):(r=0,l.left<=n.left?s=a.offsetLeft-h+1:l.right>=n.right&&(s=a.offsetLeft-n.width+l.width+h+1)),-1!==r&&(i.scrollTop=r),-1!==s&&(i.scrollLeft=s)}return this.triggerTopImageChange(e),!0},e.prototype.showLatestPage=function(t){var e;t===undefined&&(t=this.currentIndex),this.currentIndex=t,(null===(e=this._thumbnailCanvas)||void 0===e?void 0:e.length)?(this.updatePageLayout(),this.scrollTo(t)):this.triggerTopImageChange()},e.prototype._updateTopPageIndex=function(t){void 0===t&&(t="");var e=this._thumbnailElement;if(!this.showThumbnail||!e)return!1;if(window.IntersectionObserver){var i=this._calDisplayedIndexes()[0];this._calculateTopIndex=i}var n=this._calculateTopIndex;if(this._thumbnailCanvas[n]||(n=-1,t=""),this._topImageIndex===n)return!1;this._topImageIndex=n,this._pubSub._emit(r.g.TOP_PAGE_CHANGED,n,t),"scroll"===t&&this.autoChangeIndex&&(this._prtScrollOnce=!0,this._viewerEmit(r.d.SET_SELECTED_INDEXES,[n]))},e.prototype._getDisplayedImagesIE=function(){for(var t=this._calDisplayedIndexes(),e=t[0],i=t[1],n=[],o=e;o<=i;o++)o>=0&&n.push(o);return this._calculateTopIndex=e,n},e.prototype._calDisplayedIndexes=function(){var t=this._myQuery("thumbLists"+this.uid),e=null==t?void 0:t.getBoundingClientRect();if(!e||!e.width)return[-1,-1];var i=t.children[0];if(!i)return[-1,-1];var n=i.getBoundingClientRect(),o=-1,r=0,s=this.rows,a=this.columns;if("vertical"===this.scrollDirection){var l=t.scrollTop,h=Math.floor(n.height),u=(l+1-h-(parseInt(i.style.marginTop)||parseInt(i.style.marginBottom)))/(h+this._pageMarginNumber);r=(o=((u=Math.floor(u))+1)*this.columns)+(s+1)*a-1}else{var c=t.scrollLeft,d=Math.floor(n.width);u=(c+1-d-(parseInt(i.style.marginLeft)||parseInt(i.style.marginRight)))/(d+this._pageMarginNumber);r=(o=((u=Math.floor(u))+1)*this.rows)+s*(a+1)-1}for(;!this._thumbnailCanvas[o]&&o>-1;)o--;for(;!this._thumbnailCanvas[r]&&r>o;)r--;return[o,r]},e.prototype.emptyHiddenPages=function(){},e.prototype.dragThumbnail=function(t){return this.isDragUp=!1,!(t.ctrlKey||t.shiftKey||t.metaKey)&&(0===t.button&&this._dragStartFunction(t))},e.prototype.dragStartMobile=function(t){var e=this;this.isDragUp=!1;var i=t.changedTouches[0];return this.needClick=!0,this._dragTimer=setTimeout((function(){document.addEventListener("touchmove",o.C,{passive:!1}),e._dragStartFunction(i)}),300),!0},e.prototype._dragStartFunction=function(t){if(!this.allowPageDragging||this._isCrop)return!1;var e=this.rows,i=this.columns;if(1===e&&1===i)return!1;var n=this.getImageItem(t);if(!n)return!1;this._multipleMode||n.classList.contains("dvs-activeThumb")||(this.selectedIndexes=[Object(o.h)(n)],this._updateSelectedPageStyle(),this.needClick=!1);var r=n.getBoundingClientRect(),s=t.clientX-r.left,a=t.clientY-r.top;return this.thumbMoveOption={napX:s,napY:a,clickX:t.pageX,clickY:t.pageY,target:n},this.isDrag=!0,this._dragStart=!0,!0},e.prototype._initReplaceBlocks=function(){for(var t=this._myQuery("thumbLists"+this.uid),e=t.querySelectorAll(".dvs-activeThumb"),i=0;i<e.length;i++){var n=e[i],r=document.createElement("li");r.className="dvs-replaceBlock",Object(o.F)(r,{backgroundColor:this.placeholderBackground,margin:n.style.margin,width:n.style.width,height:n.style.height}),r["dvs-defaultIndex"]=n["dvs-defaultIndex"],Object(o.l)(r,n,t)}t.classList.add("hideReplaceBlock")},e.prototype.dragMove=function(t){return this._dragMoveFunction(t)},e.prototype.dragMoveMobile=function(t){var e=t.changedTouches[0];return clearTimeout(this._dragTimer),this._dragMoveFunction(e)},e.prototype._dragMoveFunction=function(t){if(this.selectedIndexes.length&&this.isDrag){var e=this.thumbMoveOption,i=e.napX,n=e.napY,s=e.clickX,a=e.clickY,l=e.target,h=t.pageX,u=t.pageY;if(Math.abs(h-s)<10&&Math.abs(u-a)<10&&!this.ifDragMoves)return;var c=l["dvs-defaultIndex"],d=this._myQuery("thumbLists"+this.uid);if(!d)return;this._dragStart&&(this._dragStart=!1,this._initReplaceBlocks(),this._thumbnailCanvas.length<=this.rows*this.columns&&(d.style.overflow="hidden"),this._pubSub._emit(r.g.DRAG_START,{index:c,pageX:t.pageX,pageY:t.pageY},t)),this.ifDragMoves=!0;for(var p=d.scrollTop,_=d.scrollLeft,v=l.getBoundingClientRect(),f=this._renderUids.array.slice(),m=0,g=0;m<this._thumbnailCanvas.length&&g<f.length&&0!==f.length;m++){var y=this._thumbnailCanvas[m];if(-1!==f.indexOf(y.uid)){var b=y._canvasItem.parentNode;if(!b.classList.contains("dvs-activeThumb")){var E=b.getBoundingClientRect(),C=E.left-v.left,S=E.top-v.top;if(Math.abs(C)<=v.width/2&&Math.abs(S)<=v.height/2){for(var I=Object(o.h)(b),T=d.querySelectorAll("li.dvs-replaceBlock"),w=Object(o.h)(T[0]),O=0;O<T.length;O++){var R=T[O];I<w?Object(o.l)(R,b,d):Object(o.k)(R,b)}return d.scrollTop=p,d.scrollLeft=_,!0}g++}}}var x=d.getBoundingClientRect(),P=t.clientY-x.top-n,L=t.clientX-x.left-i+_,A=P+p;d.classList.remove("hideReplaceBlock");for(var M=this._myQueryAll("thumbLists"+this.uid+">li.dvs-activeThumb"),D=0;D<M.length;D++){var B=M[D];B.classList.add("dvs-absolute"),B.style.left=L+5*D+"px",B.style.top=A+5*D+"px"}this._pubSub._emit(r.g.DRAG_MOVE,{index:c,pageX:t.pageX,pageY:t.pageY},t),Object(o.C)(t)}},e.prototype.dragUp=function(){return this._dragUpFunction()},e.prototype.dragUpMobile=function(){return document.removeEventListener("touchmove",o.C),clearTimeout(this._dragTimer),this._dragUpFunction()},e.prototype._dragUpFunction=function(){if(this.isDrag){this.thumbMoveOption=null,this.isDrag=!1;var t=this.ifDragMoves;if(this.clearAbsolute(),!t)return!1;this.isDragUp=!0;for(var e=this._myQuery("thumbLists"+this.uid),i=e.children.length,n=[],o=[],s=[],a=this.selectedIndexes.slice(0),l=[],h=0;h<i;h++){var u=e.children[h],c=u["dvs-defaultIndex"];if(s.push(c),u.classList.contains("dvs-activeThumb")){var d=a.indexOf(c);-1!==d&&(l[d]=h,c!==h&&o.push([c,h]))}n[h]=this._thumbnailCanvas[c]}this._thumbnailCanvas=n,this.selectedIndexes=l,this._updateElements(),this._viewerEmit(r.d.REORDER_THUMBNAIL,s,l.slice()),o.length&&this._pubSub._emit(r.g.DRAG_DONE,o)}},e.prototype.stretchStart=function(t){if(1===t.button)return!1;var e=t.target;if(!(null==e?void 0:e.classList.contains("dvs-stretchBar")))return!1;this.fullThumbnail||(e.classList.add("dvs-streching"),this._stretchItem=e,this._isStretching=!0,Object(o.C)(t))},e.prototype.stretchMove=function(t){if(!this._isStretching)return!1;var e,i,n=this._stretchItem;if(!n||!this._thumbnailElement)return!1;var o=this._thumbnailElement.getBoundingClientRect(),r=n.classList;r.contains("dvs-stretchRight")?(e=t.clientX-o.left<0?0:t.clientX-o.left,n.style.left=e+"px"):r.contains("dvs-stretchLeft")?(e=o.right-t.clientX<0?0:o.right-t.clientX,n.style.left=o.width-e+"px"):r.contains("dvs-stretchTop")?(i=o.bottom-t.clientY<0?0:o.bottom-t.clientY,n.style.top=o.height-i+"px"):(i=t.clientY-o.top<0?0:t.clientY-o.top,n.style.top=i+"px")},e.prototype.stretchEnd=function(){var t;if(!this._isStretching||!this._thumbnailElement)return!1;var e=this._stretchItem;if(!e)return!1;this._stretchItem=null,this._isStretching=!1;var i=parseInt(e.style.left),n=parseInt(e.style.top),o=0,s=this._thumbnailElement.getBoundingClientRect(),a=s.width-i,l=s.height-n,h=null===(t=this._pubQuery("showImageArea"+this._postfix))||void 0===t?void 0:t.getBoundingClientRect();i=Math.min(i,h.width),n=Math.min(n,h.height),o=e.classList.contains("dvs-stretchRight")?i/h.width:e.classList.contains("dvs-stretchLeft")?a/h.width:e.classList.contains("dvs-stretchTop")?l/h.height:n/h.height,e.style.left=null,e.style.top=null,e.classList.remove("dvs-streching"),this.size=Math.min(100*o,100).toFixed(2)+"%",this._pubSub._emit(r.d.CHANGE_THUMBNAIL_VIEW_PROP,{_size:this.size}),this._resizeViewer()},e.prototype._updateStretchBars=function(){var t=this._allowResizing,e=this._location,i=this._sequence,n="horizontal"===e&&t&&i>=0?"remove":"add",o="vertical"===e&&t&&i>=0?"remove":"add",r="horizontal"===e&&t&&i<0?"remove":"add",s="vertical"===e&&t&&i<0?"remove":"add",a=this.uid,l=this._myQuery("stretchBarLeft"+a),h=this._myQuery("stretchBarRight"+a),u=this._myQuery("stretchBarTop"+a),c=this._myQuery("stretchBarBottom"+a);null==l||l.classList[n]("dvs-nodisplay"),null==h||h.classList[r]("dvs-nodisplay"),null==u||u.classList[o]("dvs-nodisplay"),null==c||c.classList[s]("dvs-nodisplay")},e.prototype._updateProps=function(t){for(var e in t)this[e]=t[e]},e.prototype._imageClickCallback=function(t,e){var i=this.selectedIndexes.slice();if((e.ctrlKey||e.metaKey||this._multipleMode)&&!e.shiftKey){var n=i.indexOf(t);if(-1===n)i.push(t);else{if(this.isDragUp)return void(this.isDragUp=!1);if(1===i.length&&!this._multipleMode)return!1;i.splice(n,1),this._prtScrollOnce=!0}}else if(!e.shiftKey||e.ctrlKey||e.metaKey)if((e.ctrlKey||e.metaKey)&&e.shiftKey){var o=i.slice(0);h=o[o.length-1];o.push(t);var s=t,a=t;o.forEach((function(t){t<s?s=t:t>a&&(a=t)}));var l=[];for(c=s;c<=a;c++)c!==h&&l.push(c);h>=0&&l.push(h),i=l}else this.needClick?i=[t]:this.needClick=!0;else{var h;if((h=i[i.length-1])===undefined)i.push(t);else{var u=[];if(h<t)for(var c=t;c>=h;c--)u.push(c);else for(var d=t;d<=h;d++)u.push(d);i=u}}return this._viewerEmit(r.d.SET_SELECTED_INDEXES,i),!0},e.prototype._thumbnailDragStart=function(t){return Object(o.u)()?this.dragStartMobile(t):this.dragThumbnail(t)},e.prototype._thumbnailDragMove=function(t){return Object(o.u)()?this.dragMoveMobile(t):this.dragMove(t)},e.prototype._thumbnailDragUp=function(){return Object(o.u)()?this.dragUpMobile():this.dragUp()},e.prototype._thumbnailMouseOver=function(t){if(this.allowHover&&!this.ifDragMoves){var e=this.getImageItem(t);if(e){e.classList.contains("dvs-activeThumb")||(e.style.background=this.hoverPageBackground,e.style.border=this.hoverPageBorder);var i=e["dvs-defaultIndex"];this._pubSub._emit(r.g.PAGE_MOUSE_OVER,{index:i,pageX:t.pageX,pageY:t.pageY},t)}else this._pubSub._emit(r.g.PAGE_MOUSE_OVER,{index:-1,pageX:t.pageX,pageY:t.pageY},t)}},e.prototype._thumbnailMouseOut=function(t){if(this.allowHover&&!this.ifDragMoves){var e=this.getImageItem(t);if(e){var i=e["dvs-defaultIndex"];this._pubSub._emit(r.g.PAGE_MOUSE_OUT,{index:i,pageX:t.pageX,pageY:t.pageY},t),e.classList.contains("dvs-activeThumb")?(e.style.background=this.selectedPageBackground,e.style.border=this.selectedPageBorder):(e.style.background=this._pageBackground,e.style.border=this.pageBorder)}else this._pubSub._emit(r.g.PAGE_MOUSE_OUT,{index:-1,pageX:t.pageX,pageY:t.pageY},t)}},e.prototype._thumbnailClick=function(t){if(!this.ifDragMoves&&!this.isDragUp){var e=this.getImageItem(t);if(e){var i=e["dvs-defaultIndex"];this._imageClickCallback(i,t),this._pubSub._emit(r.g.PAGE_CLICK,{index:i,pageX:t.pageX,pageY:t.pageY},t)}else this._pubSub._emit(r.g.PAGE_CLICK,{index:-1,pageX:t.pageX,pageY:t.pageY},t)}},e.prototype._thumbnailRightClick=function(t){var e=this.getImageItem(t);if(e){if(this.ifDragMoves)return!1;var i=e["dvs-defaultIndex"];this._pubSub._emit(r.g.PAGE_RIGHT_CLICK,{index:i,pageX:t.pageX,pageY:t.pageY},t),this._pubSub._emit(r.g.PAGE_CONTEXTMENU,{index:i,pageX:t.pageX,pageY:t.pageY},t),-1!==this.selectedIndexes.indexOf(i)||Object(o.u)()&&this.allowPageDragging||this._pubSub._emit(r.d.SET_SELECTED_INDEXES,[i])}else this._pubSub._emit(r.g.PAGE_RIGHT_CLICK,{index:-1,pageX:t.pageX,pageY:t.pageY},t),this._pubSub._emit(r.g.PAGE_CONTEXTMENU,{index:-1,pageX:t.pageX,pageY:t.pageY},t)},e.prototype._thumbnailDoubleClick=function(t){var e=this.getImageItem(t);if(e){var i=e["dvs-defaultIndex"];this._pubSub._emit(r.g.PAGE_DOUBLE_CLICK,{index:i,pageX:t.pageX,pageY:t.pageY},t)}else this._pubSub._emit(r.g.PAGE_DOUBLE_CLICK,{index:-1,pageX:t.pageX,pageY:t.pageY},t)},e.prototype._thumbnailPointerDown=function(t){var e=this.getImageItem(t);if(e){var i=e["dvs-defaultIndex"];this._pubSub._emit(r.g.PAGE_MOUSE_DOWN,{index:i,pageX:t.pageX,pageY:t.pageY},t)}else this._pubSub._emit(r.g.PAGE_MOUSE_DOWN,{index:-1,pageX:t.pageX,pageY:t.pageY},t)},e.prototype._thumbnailPointerMove=function(t){var e,i,n,o,s,a,l;if(this.ifDragMoves){if(!(this.isInner?null===(n=null===(i=null===(e=this._oPub)||void 0===e?void 0:e._events)||void 0===i?void 0:i[r.g.PAGE_MOUSE_MOVE])||void 0===n?void 0:n.length:null===(l=null===(a=null===(s=null===(o=this._pubSub)||void 0===o?void 0:o.getPublishSubscribe())||void 0===s?void 0:s._events)||void 0===a?void 0:a[r.g.PAGE_MOUSE_MOVE])||void 0===l?void 0:l.length))return;var h=this._getPointIndex(t);this._pubSub._emit(r.g.PAGE_MOUSE_MOVE,{index:h,pageX:t.pageX,pageY:t.pageY},t)}else{var u=this.getImageItem(t);if(u){var c=u["dvs-defaultIndex"];this._pubSub._emit(r.g.PAGE_MOUSE_MOVE,{index:c,pageX:t.pageX,pageY:t.pageY},t)}else this._pubSub._emit(r.g.PAGE_MOUSE_MOVE,{index:-1,pageX:t.pageX,pageY:t.pageY},t)}},e.prototype._thumbnailPointerUp=function(t){if(this.ifDragMoves){var e=this._getPointIndex(t);this._pubSub._emit(r.g.PAGE_MOUSE_UP,{index:e,pageX:t.pageX,pageY:t.pageY},t)}else{var i=this.getImageItem(t);if(i){var n=i["dvs-defaultIndex"];this._pubSub._emit(r.g.PAGE_MOUSE_UP,{index:n,pageX:t.pageX,pageY:t.pageY},t)}else this._pubSub._emit(r.g.PAGE_MOUSE_UP,{index:-1,pageX:t.pageX,pageY:t.pageY},t)}},e.prototype._thumbnailScroll=function(){this.triggerTopImageChange("scroll")},e.prototype._thumbnailStretchStart=function(t){this.stretchStart(t)},e.prototype._documentMouseMove=function(t){this.stretchMove(t)},e.prototype._documentMouseUp=function(){this.stretchEnd(),this._thumbnailDragUp()},e.prototype.getImageItem=function(t){var e,i,n;if(!t)return null;if(!(n=Object(o.q)(t)?t:t.target)||(null===(e=n.classList)||void 0===e?void 0:e.contains("dvs-replaceBlock")))return null;if("CANVAS"===n.tagName)n=n.parentNode;else{if(n===(null===(i=this._thumbnailElement)||void 0===i?void 0:i.querySelector(".dvs-thumbLists")))return!1;if("LI"!==n.tagName)return null}return n},e.prototype._getPointIndex=function(t){var e,i,n=null===(e=this._thumbnailElement)||void 0===e?void 0:e.querySelector(".dvs-thumbLists");if(!n)return-1;for(var r=n.children,s=0;s<r.length;s++){var a=r[s];if(this._checkPointOnElement(t,a)&&!(null===(i=a.classList)||void 0===i?void 0:i.contains("dvs-activeThumb")))return Object(o.i)(a,(function(t){var e;return!(null===(e=t.classList)||void 0===e?void 0:e.contains("dvs-activeThumb"))}))}return-1},e.prototype.clearAbsolute=function(){var t=this._myQuery("thumbLists"+this.uid);if(!t)return!1;var e=this._myQueryAll("thumbLists"+this.uid+">li.dvs-replaceBlock");this.ifDragMoves=!1,this.isDrag=!1;for(var i=this._myQueryAll("thumbLists"+this.uid+">li.dvs-absolute"),n=0;n<i.length;n++){var r=i[n];Object(o.l)(r,e[n],t),r.classList.remove("dvs-absolute"),r.style.left=null,r.style.top=null}for(var s=0;s<e.length;s++){var a=e[s];t.removeChild(a)}"vertical"===this.scrollDirection?t.style.overflowY="auto":t.style.overflowX="auto"},e.prototype.setPercent=function(t){var e=this._thumbnailElement;e&&(e.style.flex="0 0 "+t+"%",e.style.msFlex="0 0 "+t+"%")},e.prototype.getIndexByUid=function(t){for(var e,i=0;i<this._thumbnailCanvas.length;i++)if(t===(null===(e=this._thumbnailCanvas[i])||void 0===e?void 0:e.uid))return i;return-1},e.prototype.getUidByIndex=function(t){var e;return null===(e=this._thumbnailCanvas[t])||void 0===e?void 0:e.uid},e.prototype._resizeViewer=function(t){void 0===t&&(t=!1),t?this._viewerEmit(r.f.VIEWER_RESIZE,this.uid,this.showLatestPage.bind(this)):this._viewerEmit(r.f.VIEWER_RESIZE)},e.prototype._setSplitBarDelay=function(){var t=this;this.isInner||(clearTimeout(this._splitTimer),this._splitTimer=setTimeout((function(){t._viewerEmit("onSetSplitBar")}),50))},e.prototype._checkPointOnElement=function(t,e){var i,n;if(!t||!e)return!1;var o=-1,r=-1;if(null===(i=t.changedTouches)||void 0===i?void 0:i[0]){var s=null===(n=t.changedTouches)||void 0===n?void 0:n[0];o=s.clientX,r=s.clientY}else{var a=t;o=a.clientX,r=a.clientY}var l=e.getBoundingClientRect();return o>=l.left&&r>=l.top&&o<=l.right&&r<=l.bottom},e.prototype._viewerEmit=function(e){for(var i=[],n=1;n<arguments.length;n++)i[n-1]=arguments[n];t.prototype._emit.apply(this,w([e],i))},e.prototype.dispose=function(){var e;this.unbindUi(),t.prototype.dispose.call(this),null===(e=this._pubSub)||void 0===e||e.dispose(),this._pubSub=null,this._viewerContainer=null,this._thumbnailElement=null},e}(a.a),R=i(3),x=undefined&&undefined.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),P=function(t){function e(e,i,n,o,s){var a=t.call(this,e,i,n,o,s)||this;return a.isInner=!0,a._isCrop=!1,a.cropIndex=-1,a.cropUid="",a._originEvents=[],a._tbEvents=[],a._viewerEvents=[],a.cropManager=new R.a(0,0),a.cropManager.selectedCallback=function(e){var i=a.selectedIndexes.slice().pop(),n=a._thumbnailCanvas[i];n&&n.renderImg&&t.prototype._emit.call(a,r.g.PAGE_AREA_SELECTED,i,e)},a.cropManager.unselectedCallback=function(){for(var e=a.cropIndex,i=a._thumbnailCanvas.length,n=0;n<i;n++){var o=a._thumbnailCanvas[n];a.cropUid===o.uid&&(a.cropManager.cropBoxes=[],o.renderImg?a.setPageRect(o):o.setRect([]))}t.prototype._emit.call(a,r.g.PAGE_AREA_UNSELECTED,e)},a._initEvents(),a}return x(e,t),e.prototype._initEvents=function(){var e=this,i=[r.d.CANVAS_MOUSE_DOWN,r.d.CANVAS_MOUSE_MOVE,r.d.CANVAS_MOUSE_UP,r.d.CANVAS_CLICK,r.d.CANVAS_RIGHT_CLICK,r.d.CANVAS_DOUBLE_CLICK,r.d.CANVAS_MOUSE_OVER,r.d.CANVAS_MOUSE_OUT],n=[r.g.PAGE_MOUSE_DOWN,r.g.PAGE_MOUSE_MOVE,r.g.PAGE_MOUSE_UP,r.g.PAGE_CLICK,r.g.PAGE_RIGHT_CLICK,r.g.PAGE_DOUBLE_CLICK,r.g.PAGE_MOUSE_OVER,r.g.PAGE_MOUSE_OUT];this._originEvents=n;for(var o=0;o<i.length;o++)this._packageEvent(n[o],i[o]);this._tbEvents=[[r.g.DRAG_DONE,function(i){t.prototype._emit.call(e,r.d.CANVAS_DRAG_DONE,i)}],[r.g.TOP_PAGE_CHANGED,function(i,n){t.prototype._emit.call(e,r.g.TOP_PAGE_CHANGED,i,n)}],[r.g.PAGE_MOUSE_DOWN,function(t,i){e._cropStart(t,i)}],[r.f.DOCUMENT_POINTER_UP,function(t){e._cropUp(t)}],[r.g.VIEWER_PAGE_RENDERED,function(i){t.prototype._emit.call(e,r.g.VIEWER_PAGE_RENDERED,i)}]],this._tbEvents.forEach((function(t){var i;null===(i=e._pubSub)||void 0===i||i._on(t[0],t[1])})),this._viewerEvents=[[r.f.DOCUMENT_POINTER_MOVE,function(t){e._cropMove(t)}],[r.f.DOCUMENT_POINTER_UP,function(t){e._cropUp(t)}],[r.d.CLEAR_SLT_BOX,function(){e.cropManager.clear()}]],this._viewerEvents.forEach((function(t){e._on(t[0],t[1])}))},e.prototype._initThumbnailConfig=function(t){this._pubSub=new a.a(t.pubsub);for(var e=Object.keys(t),i=0;i<e.length;i++){var n=e[i],o=t[n];"pubsub"!==n&&o!==undefined&&(this[n]=o)}},e.prototype.dispose=function(){var e,i=this;this._viewerEvents.forEach((function(t){i._off(t[0])})),t.prototype.dispose.call(this),this._pubSub&&(this._originEvents.forEach((function(t){i._pubSub._off(t)})),this._tbEvents.forEach((function(t){i._pubSub._off(t[0])}))),this._originEvents=[],this._tbEvents=[],this._viewerEvents=[],null===(e=this.cropManager)||void 0===e||e.dispose(),this.cropManager=null},e.prototype._packageEvent=function(e,i){var n=this;this._pubSub._on(e,(function(e,o){var r=e.index,s=e.pageX,a=e.pageY;if(-1===r)t.prototype._emit.call(n,i,o,{index:r,imageX:-1,imageY:-1,pageX:s,pageY:a});else{if(!n._thumbnailCanvas[r])return;var l=n._getOriginPosition(r,o),h=l.imageX,u=l.imageY;t.prototype._emit.call(n,i,o,{index:r,imageX:h,imageY:u,pageX:s,pageY:a})}}))},e.prototype._getOriginPosition=function(t,e,i){var n;void 0===i&&(i=!0);var o=null,r=null,s=null===(n=this._thumbnailElement.querySelector(".dvs-thumbLists"))||void 0===n?void 0:n.children;if(s){if(this.ifDragMoves)for(var a=-1,l=0;l<s.length;l++){var h=s[l];if(!(null==h?void 0:h.classList.contains("dvs-activeThumb"))&&t===++a){o=h,r=this._thumbnailCanvas[h["dvs-defaultIndex"]];break}}else o=s[t],r=this._thumbnailCanvas[t];if(o){var u=o.getBoundingClientRect(),c=this._dataStore.getMetadata(r.uid);if(!r.renderImg||!(null==c?void 0:c.width)||!(null==c?void 0:c.height))return{imageX:-1,imageY:-1};var d=e.clientX-u.left,p=e.clientY-u.top,_=r.renderImg.naturalWidth,v=r.renderImg.naturalHeight,f=r.fitRatio,m=d-(u.width-_/f)/2,g=p-(u.height-v/f)/2;if(i&&(m<0||g<0||m>_/f||g>v/f))return{imageX:-1,imageY:-1};var y=c.width/_;return{imageX:Math.floor(m*f*y),imageY:Math.floor(g*f*y)}}}},e.prototype._cropStart=function(t,e){var i=t.index,n=this.selectedIndexes.slice().pop();if(-1!==i&&n===i&&this._isCrop){var s=this._thumbnailCanvas[i];if(s&&s.renderImg){var a=this._getOriginPosition(i,e),l=a.imageX,h=a.imageY;if(-1!==l&&-1!==h){var u=this._dataStore.getMetadata(s.uid);if(!(null==u?void 0:u.width)||!u.height)return this._pubSub._emit(r.d.ERROR,r.a.META_DATA_NOT_EXIST),!1;var c=u.width/s.renderImg.naturalWidth,d=s.fitRatio,p=this.cropManager;p.setZoom(1/d/c),p.setPageSize(u.width,u.height),p.onStartHandler(l,h,e.ctrlKey),s.setRect(p.cropBoxes,this.selectedBoxLineColor),Object(o.C)(e)}}}},e.prototype._cropMove=function(e){if(this.showThumbnail&&this._isCrop){var i=this.selectedIndexes.slice().pop();if(-1!==i){var n=this._thumbnailCanvas[i];if(n){var o=this._getOriginPosition(i,e,!1),s=o.imageX,a=o.imageY,l=this.cropManager,h=l.checkSelectForCursor(s,a);if(h){var u="move"===h.position?"move":h.position+"-resize";t.prototype._emit.call(this,r.f.CHANGE_CANVAS_CURSOR,u)}else t.prototype._emit.call(this,r.f.CHANGE_CANVAS_CURSOR,"");l.mouseDown&&(l.setKeepAspectRatio(e.shiftKey),l.onMoveHandler(s,a,!1),this.setPageRect(n))}}}},e.prototype._cropUp=function(t){if(this._isCrop&&this.cropManager.mouseDown){this.selectedIndexes.slice().pop();this.cropManager.onEndHandler()}},e.prototype.setPageRect=function(t,e){if(void 0===e&&(e=this.selectedBoxLineColor),t){var i=this.cropManager.cropBoxes;t.setRect(i,e),t.render(!1)}},e.prototype._updateInnerPage=function(t){t.data,t.index,t.uid,t.width,t.height;return!1},e.prototype.setSelectedBoxLineColor=function(t){this.selectedBoxLineColor=t;var e=this.selectedIndexes.slice().pop(),i=this._thumbnailCanvas[e];i&&this._isCrop&&this.setPageRect(i,t)},e.prototype.setOperationMode=function(t){1===t?this._isCrop=!0:(this._isCrop=!1,this.clearSelectedBoxes())},e.prototype.setSelectedBoxes=function(e,i){i||this.cropManager.clear(),Object(o.m)(e)||(e=[e]);var n=this.selectedIndexes.slice().pop(),s=this._thumbnailCanvas[n],a=this._dataStore.getMetadata(s.uid);this.cropManager.setPageSize(a.width,a.height);for(var l=e.length,h=0;h<l;h++){var u=e[h];this.cropManager.addBox([u.left,u.top,u.left+u.width,u.top,u.left+u.width,u.top+u.height,u.left,u.top+u.height],"bottomRight")}var c=this.cropManager.getRectArr();this.setPageRect(s),t.prototype._emit.call(this,r.g.PAGE_AREA_SELECTED,n,c),t.prototype._emit.call(this,r.g.VIEWER_PAGE_RENDERED,n,c)},e.prototype.setKeepAspectRatio=function(t){},e.prototype.setAspectRatio=function(t){this.cropManager.setAspectRatio(t)},e.prototype.clearSelectedBoxes=function(t){this.cropManager.clear()},e}(O),L=undefined&&undefined.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),A=function(t){function e(e,i,n,o){var r=t.call(this,i)||this;return r._viewerContainer=null,r._dataStore=null,r._thumbnails={},r.innerThumbnail=null,r._selectedIndexes=[],r._displayedUidsManage={},r._thumbnailContents=[],r._lastShowUid="",r._displayTimer=null,r.postfix=e,r._viewerContainer=n,r._dataStore=o,r._bindEvents(),r}return L(e,t),e.prototype.createThumbnail=function(t){var e=t.uid;e||(e=Object(o.I)(11),t.uid=e);var i=new O(t,this._oPub,this._viewerContainer,this.postfix,this._dataStore);return this._thumbnails[e]=i,i.updateContent(this._thumbnailContents),i.selectThumbnailByIndexes(this._selectedIndexes),!0},e.prototype.createInnerThumbnail=function(t){var e={uid:this.postfix,pubsub:new a.b,size:"100%",background:t.canvasBackground,mouseShape:t.canvasMouseShape,border:t.canvasBorder,location:"canvas",allowResizing:!1,showThumbnail:!1};Object(o.A)(t,e),this.innerThumbnail=new P(e,this._oPub,this._viewerContainer,this.postfix,this._dataStore)},e.prototype.removeThumbnail=function(e){var i=this._thumbnails[e];return!!i&&(i.unbindUi(),t.prototype._emit.call(this,"onSetSplitBar"),delete this._thumbnails[e],!0)},e.prototype.removeAllThumbnail=function(){var t,e;for(var i in this._thumbnails)this.removeThumbnail(i);null===(t=this.innerThumbnail)||void 0===t||t.unbindUi(),null===(e=this.innerThumbnail)||void 0===e||e.dispose(),this._thumbnails={},this._viewerContainer=null,this._off(r.f.MERGE_DISPLAYED_UIDS),this._off(r.f.UPDATE_THB_ITEM)},e.prototype.on=function(t,e){this._on(t,e.bind(this))},e.prototype._bindEvents=function(){var e=this;this.on(r.f.MERGE_DISPLAYED_UIDS,(function(i,n){e._displayedUidsManage[n]=i,clearTimeout(e._displayTimer),e._displayTimer=setTimeout((function(){var i=new I;for(var n in e._displayedUidsManage){var o=e._displayedUidsManage[n];i.array=i.concat(o)}t.prototype._emit.call(e,r.d.DISPLAYED_IMAGE_CHANGED,i.array.slice())}),100)})),this.on(r.f.UPDATE_THB_ITEM,(function(t){e._updatePageItem(t)}))},e.prototype.calculateSize=function(){var t;for(var e in this._thumbnails)this._thumbnails[e].calculateSize();null===(t=this.innerThumbnail)||void 0===t||t.calculateSize()},e.prototype.updateAllDisplayed=function(){var t;for(var e in this._thumbnails)this._thumbnails[e].updateDisplayedUidsIE();null===(t=this.innerThumbnail)||void 0===t||t.updateDisplayedUidsIE()},e.prototype.showLatestPage=function(t){var e;for(var i in this._thumbnails)this._thumbnails[i].showLatestPage(t);null===(e=this.innerThumbnail)||void 0===e||e.showLatestPage(t)},e.prototype.updatePagesLayout=function(){var t;for(var e in this._thumbnails)this._thumbnails[e].updatePageLayout();null===(t=this.innerThumbnail)||void 0===t||t.updatePageLayout()},e.prototype.updateContents=function(t){var e;for(var i in this._thumbnailContents=t,this._thumbnails)this._thumbnails[i].updateContent(t);null===(e=this.innerThumbnail)||void 0===e||e.updateContent(t)},e.prototype._updatePageItem=function(t){for(var e,i=this._thumbnailContents,n=0;n<i.length;n++)if(i[n].uid===t.uid){i[n]=t;break}for(var o in this._thumbnails)this._thumbnails[o].updatePageItem(t);null===(e=this.innerThumbnail)||void 0===e||e.updatePageItem(t)},e.prototype.updateSelectedIndexes=function(t){var e;for(var i in this._selectedIndexes=t,this._thumbnails)this._thumbnails[i].selectThumbnailByIndexes(t);null===(e=this.innerThumbnail)||void 0===e||e.selectThumbnailByIndexes(t)},e.prototype.pageChangeCallback=function(t,e,i){var n,o=this._thumbnailContents,r=this.innerThumbnail,s=this._lastShowUid,a=null===(n=o[e])||void 0===n?void 0:n.uid;a!==undefined&&s===a||(r.clearSelectedBoxes(),r.cropIndex=e,r.cropUid=a,this._lastShowUid=a)},e.prototype.keydownCallback=function(e,i){var n=this._thumbnails[i];n?n.keydownCallBack(e):i===this.innerThumbnail.uid&&(this.innerThumbnail.keydownCallBack(e),t.prototype._emit.call(this,r.d.CANVAS_KEY_DOWN,e))},e.prototype.keyupCallback=function(e,i){var n=this._thumbnails[i];n?n.keyupCallBack(e):i===this.innerThumbnail.uid&&(this.innerThumbnail.keyupCallBack(e),t.prototype._emit.call(this,r.d.CANVAS_KEY_UP,e))},e.prototype.dispose=function(){var e;t.prototype.dispose.call(this);for(var i=Object.keys(this._thumbnails),n=0,o=i.length;n<o;n++){var r=i[n],s=this._thumbnails[r];s&&s.dispose(),s=null}this._thumbnails=null,null===(e=this.innerThumbnail)||void 0===e||e.dispose(),this.innerThumbnail=null,this._viewerContainer=null,this._dataStore=null},e}(a.a),M=undefined&&undefined.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),D=function(t){function e(e,i,n){var o=t.call(this,i)||this;return o._xOver=!1,o._yOver=!1,o.isMyScroll=!1,o.buttonMove=!1,o._isButtonScroll=!1,o._unbindList=[],o._postfix=e,o._myQuery=function(t,e){var i;return void 0===e&&(e="#"),null===(i=null==n?void 0:n.el)||void 0===i?void 0:i.querySelector(e+t)},o._myQueryAll=function(t,e){var i;return void 0===e&&(e="#"),null===(i=null==n?void 0:n.el)||void 0===i?void 0:i.querySelectorAll(e+t)},o}return M(e,t),e.prototype.getImageSize=function(e){var i=this,n=this.setOuterSize(e.width,e.height);return this.setScroller(e.x,e.y),n&&setTimeout((function(){i.setViewPort(),t.prototype._emit.call(i,"_onCanvasResize")})),n},e.prototype.setScroller=function(t,e){var i=Object(o.j)("outer"+this._postfix);if(!i)return!1;var n=i.scrollLeft,r=i.scrollTop;return n===t&&r===e||(this.isMyScroll=!0),i.scrollLeft=t,i.scrollTop=e,!0},e.prototype.setOuterSize=function(t,e){var i=Object(o.j)("outer"+this._postfix),n=Object(o.j)("inner"+this._postfix),r=!1,s=!1;if(!i||!n)return!1;t>i.offsetWidth?(i.style.overflowX="auto",r=!0):i.style.overflowX="hidden",e>i.offsetHeight?(i.style.overflowY="auto",s=!0):i.style.overflowY="hidden",n.style.width=t+"px",n.style.height=e+"px";var a=this._xOver!==r,l=this._yOver!==s;return this._xOver=r,this._yOver=s,a||l},e.prototype.setViewPort=function(){var t=Object(o.j)("outer"+this._postfix),e=Object(o.j)("viewPort"+this._postfix);if(!t||!e)return!1;var i=t.offsetWidth-t.clientWidth,n=t.offsetHeight-t.clientHeight;e.style.width="calc(100% - "+i+"px)",e.style.height="calc(100% - "+n+"px)"},e.prototype._addButtonScroll=function(){var t=this,e=[],i=this._myQueryAll("dvs-groupType",".");if(i){var n=Object(o.u)();this._on(r.f.DOCUMENT_POINTER_MOVE,(function(e){n?t.buttonScrollMoveMobile(e):t.buttonScrollMove(e)})),this._on(r.f.DOCUMENT_POINTER_UP,(function(){t.buttonScrollEndFun()})),[].forEach.call(i,(function(i){"ontouchstart"in document.documentElement?Object(o.c)(i,r.c.TOUCH_START,(function(e){t.buttonScrollStartMobile(e)})):Object(o.c)(i,r.c.MOUSE_DOWN,(function(e){t.buttonScrollStart(e)})),t._unbindList=e;var n=i.querySelector(".dvs-showBefore");n&&(n.onclick=function(){i.scrollLeft=0,t._updateShowMore(i)});var s=i.querySelector(".dvs-showAfter");s&&(s.onclick=function(){i.scrollLeft=i.scrollWidth-i.clientWidth,t._updateShowMore(i)})}))}},e.prototype.buttonScrollStart=function(t){return(!t.button||0===t.button)&&(this._buttonScrollStartFun(t),!0)},e.prototype.buttonScrollStartMobile=function(t){var e=t.changedTouches[0];return!!e&&(this._buttonScrollStartFun(e),!0)},e.prototype._buttonScrollStartFun=function(t){var e,i=t.target;if(i&&i.classList.contains("dvs-groupType"))e=i;else{if(!(i&&i.parentNode&&i.parentNode.classList.contains("dvs-groupType")))return!1;e=i.parentNode}this._isButtonScroll=!0,this._scrollStartInfo={x:t.clientX,y:t.clientY,left:e.scrollLeft,top:e.scrollTop,item:e}},e.prototype.buttonScrollMove=function(t){return this._buttonScrollMoveFun(t),!0},e.prototype.buttonScrollMoveMobile=function(t){var e=t.changedTouches[0];return!!e&&(this._buttonScrollMoveFun(e),!0)},e.prototype._buttonScrollMoveFun=function(t){if(!this._isButtonScroll)return!1;var e=this._scrollStartInfo,i=e.x,n=e.y,r=e.left,s=e.top,a=e.item;if(a.scrollWidth>a.clientWidth){var l=t.clientX-i,h=t.clientY-n;(Math.abs(l)>5||Math.abs(h)>5)&&(this.buttonMove=!0,a.scrollLeft=r-l,a.scrollTop=s-h,this._updateShowMore(a),Object(o.C)(t))}},e.prototype.buttonScrollEndFun=function(){this._isButtonScroll=!1,this._scrollStartInfo={},document.removeEventListener(r.c.TOUCH_MOVE,o.C)},e.prototype._updateShowMore=function(t){if(!t)return!1;if(0==t.children.length)return!1;t.scrollWidth-t.clientWidth>=5?t.style.justifyContent="flex-start":t.style.justifyContent="";var e=t.scrollLeft,i=e>=5,n=e+t.clientWidth<t.scrollWidth-5,o=t.querySelector(".dvs-showBefore");if(!o||"SPAN"!==o.tagName)return!1;i&&t.clientWidth>=60?o.classList.remove("dvs-nodisplay"):o.classList.add("dvs-nodisplay");t.children.length;var r=t.querySelector(".dvs-showAfter");n&&t.clientWidth>=60?r.classList.remove("dvs-nodisplay"):r.classList.add("dvs-nodisplay"),e=t.scrollLeft,o.style.left=e+"px",r.style.right=-e+"px"},e.prototype.updateAllGroupShowMore=function(){var t=this,e=this._myQueryAll("dvs-groupType",".");e&&[].forEach.call(e,(function(e){t._updateShowMore(e)}))},e.prototype.unbindEvents=function(){this._unbindList.forEach((function(t){null==t||t()}))},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.unbindEvents()},e}(a.a),B=undefined&&undefined.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),U=function(t){function e(e,i){var n=t.call(this,i)||this;return n._currentPage=-1,n._totalPage=0,n._postfix=e,n}return B(e,t),e.prototype.goToPage=function(t){this._emit(r.b.GOTO_PAGE,t)},e.prototype.getCurrentPage=function(){return this._currentPage},e.prototype.setCurrentPage=function(t){return!!Object(o.v)(t)&&(this._currentPage=t,!0)},e.prototype.getTotalPage=function(){return this._totalPage},e.prototype.setTotalPage=function(t){return!!Object(o.v)(t)&&(this._totalPage=t,!0)},e.prototype.updatePage=function(t){var e=document.getElementById("pagerInput"+this._postfix),i=document.getElementById("pagerLabel"+this._postfix),n=t.cur,o=t.total;this.setCurrentPage(n),this.setTotalPage(o);var r=o?n+1:0;if(e&&i){e.value=r,i.innerText=String(o),e.style.fontSize="16px";var s=16*String(o).length+"px";e.style.width=s}},e.prototype.pageBlur=function(t){var e=t.target,i=parseInt(e.value);e.value=String(this._currentPage+1),this.goToPage(i-1)},e}(a.a),N=function(){function t(t){this.id="",this.name="",this.type="",this.iconClass="",this._init(t)}return t.prototype._init=function(t){if(o.w)for(var e=Object.keys(t),i=0;i<e.length;i++){var n=e[i];n!==undefined&&(this[n]=t[n])}},t}(),k=function(){function t(t,e,i,n,o){return this.createVNode(t,e,i,n,o)}return t.prototype.createVNode=function(t,e,i,n,o){void 0===e&&(e={}),void 0===i&&(i=[]),void 0===o&&(o="");var r={el:n,tagName:t,sel:"",data:e,children:i,text:o};return this._updateVNode(r)},t.prototype._updateVNode=function(t){var e=this;Object(o.w)(t.data)||(t.data={}),Object(o.m)(t.children)||(t.children=[]);var i=t.data.id,n=t.tagName;return i?(n+="#"+i,t.sel=n):t.data["class"]&&(n+="."+t.data["class"],t.sel=n),t.children.forEach((function(t){return e._updateVNode(t)})),t},t}(),V={createVnode:function(t,e,i,n,r){if(void 0===e&&(e={}),void 0===i&&(i=[]),Object(o.w)(e)&&Object(o.m)(i))return new k(t,e,i,n,r)},sameVnode:function(t,e){return e.data.key===t.data.key&&e.data.key!==undefined||(e.tagName===t.tagName||e.text===t.text&&t.text!==undefined)},createKeyHashList:function(t,e,i){var n,o,r,s={};for(n=e;n<=i;++n)(r=t[n])&&r.data&&(o=r.data.key)&&(s[o]=n);return s},removeVnodes:function(t,e,i){for(;e<=i;){var n=t[e];if(null!=n&&n.el){var o=n.el.parentElement;o&&o.removeChild(n.el)}++e}},addVnodes:function(t,e,i,n,r){for(var s=function(){var r=i[n];if(r){if(!r.el)r.el=document.createElement(r.tagName),Object.keys(r.data).forEach((function(t){"class"===t?r.el.className=r.data[t]:"style"===t?r.el.setAttribute(t,r.data[t]):r.el[t]=r.data[t]}));r.text&&(r.el.textContent=r.text),Object(o.l)(r.el,e,t);var s=r.children;s&&s.length&&a.addVnodes(r.el,null,s,0,s.length)}++n},a=this;n<=r;)s()},addOneVnode:function(t,e,i){if(!t||!t.children)return!1;var n=t.children[e]&&t.children[e].el;return t.children.splice(e,0,i),this.addVnodes(t.el,n,[i],0,0)},patchVnode:function(t,e){var i=e.el=t.el;Object.keys(e.data).forEach((function(i){t.el[i]!==e.data[i]&&("class"===i||"style"===i?t.el.setAttribute(i,e.data[i]):t.el[i]=e.data[i],t.data[i]=e.data[i])}));var n=t.children,o=e.children;t!==e&&(""!==e.text&&t.text!==e.text?i.textContent=e.text:n.length&&o.length&&n!==o?this.updateChildren(i,n,o):o&&o.length?this.addVnodes(i,null,o,0,o.length):n&&n.length&&this.removeVnodes(n,0,n.length))},updateChildren:function(t,e,i){for(var n,r,s,a,l=0,h=0,u=e.length-1,c=i.length-1,d=e[0],p=e[u],_=i[0],v=i[c];l<=u&&h<=c;)null==d?d=e[++l]:null==p?p=e[--u]:null==_?_=i[++h]:null==v?v=i[--c]:this.sameVnode(d,_)?(this.patchVnode(d,_),d=e[++l],_=i[++h]):this.sameVnode(p,v)?(this.patchVnode(p,v),p=e[--u],v=i[--c]):this.sameVnode(d,v)?(this.patchVnode(d,v),Object(o.l)(d.el,p.el.nextSibling,t),d=e[++l],v=i[--c]):this.sameVnode(p,_)?(this.patchVnode(p,_),Object(o.l)(p.el,d.el,t),p=e[--u],_=i[++h]):(n===undefined&&(n=this.createKeyHashList(e,l,u)),(r=n[_.data.key])===undefined?(this.addVnodes(t,d.el,i,h,h),_=i[++h]):((s=e[r]).sel!==_.sel?this.addVnodes(t,d.el,e,r,r):(this.patchVnode(s,_),Object(o.l)(_.el,d.el,t),e[r]=null),_=i[++h]));l>u?(a=i[c+1]?i[c+1].el:null,this.addVnodes(t,a,i,h,c)):h>c&&this.removeVnodes(e,l,u)},patch:function(t,e){if(this.sameVnode(t,e))this.patchVnode(t,e);else{var i=t.el,n=i.parentNode;null!==n&&(Object(o.l)(e.el,i.nextSibling,n),n.removeChild(t.el),t=null)}return e}},j=function(){function t(t,e,i){this._viewerContainer=null,this._postfix="",this._tabList=[],this._tabVNode=null,this._selectedTabId="",this._postfix=t,this._viewerContainer=i}return t.prototype.tabRenderInit=function(){var t,e,i=null===(e=null===(t=this._viewerContainer)||void 0===t?void 0:t.el)||void 0===e?void 0:e.querySelector("#tabList"+this._postfix);this._tabVNode=V.createVnode("DIV",{},[],i)},t.prototype.tabDestroy=function(){this._tabVNode=null},t.prototype.updateTabList=function(t){var e=t.selectedTabId,i=t.tabs;this._updateTabData(i);var n=this._createVirtualTab(i);this._tabVNode=V.patch(this._tabVNode,n),this.selectTabById(e)},t.prototype.getSelectedIndex=function(){for(var t,e=0;e<this._tabList.length;e++)if((null===(t=this._tabList[e])||void 0===t?void 0:t.id)===this._selectedTabId)return e;return-1},t.prototype.selectTabByIndex=function(t){var e;return this._tabList[t]!==undefined&&(this._selectedTabId=null===(e=this._tabList[t])||void 0===e?void 0:e.id,this._updateSelectedStyle(),!0)},t.prototype.selectTabById=function(t){this._selectedTabId=t,this._updateSelectedStyle()},t.prototype.closeTabById=function(t){},t.prototype._updateSelectedStyle=function(){var t,e,i=null===(e=null===(t=this._viewerContainer)||void 0===t?void 0:t.el)||void 0===e?void 0:e.querySelector("#tabList"+this._postfix);if(i)for(var n=null==i?void 0:i.children,o=0;o<n.length;o++){var r=n[o];null==r||r.classList[(null==r?void 0:r.id)===this._selectedTabId?"add":"remove"]("dvs-activeTab")}},t.prototype._updateTabData=function(t){for(var e=[],i=0;i<t.length;i++){var n=this._createTabItem(t[i]);e.push(n)}this._tabList=e},t.prototype._createTabItem=function(t){return new N(t)},t.prototype._createVirtualTab=function(t){for(var e,i=V.createVnode,n=i("DIV"),o=0,r=t.length;o<r;o++){var s=t[o],a=i("DIV",{"class":"dvs-tabItem "+(s.id===this._selectedTabId?"activeTab":""),id:s.uid,key:s.uid,title:s.name},[i("SPAN",{"class":s.iconClass||""}),i("SPAN",{"class":"dvs-tabText"},[],null,s.name),i("A",{"class":"ds-dvs-ui-iconfont ds-dvs-ui-cancle dvs-closeTab","dvs-id":s.uid})]);null===(e=n.children)||void 0===e||e.push(a)}return n},t.prototype.dispose=function(){},t}(),G=undefined&&undefined.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),H=function(t){function e(e){var i=e.postfix,n=e.pubsub,o=e.viewerContainer,r=t.call(this,n)||this;return r._postfix="",r._viewerContainer=null,r._width=0,r._height=0,r._innerWidth=0,r._innerHeight=0,r._scrollLeft=0,r._scrollTop=0,r._canvasList=[],r._postfix=i,r._viewerContainer=o,r}return G(e,t),e.prototype._query=function(t){var e,i;return null===(i=null===(e=this._viewerContainer)||void 0===e?void 0:e.el)||void 0===i?void 0:i.querySelector("#"+t+this._postfix)},e.prototype.canvasRenderInit=function(){this._createCanvas("main"),this._createCanvas("cropper"),this._createSlider()},e.prototype.updateCanvasInnerSize=function(){var e,i=this._query("canvasScroll"),n=null===(e=this._query("innerThumbnail"))||void 0===e?void 0:e.querySelector(".dvs-thumbLists");if(!i||!n)return!1;var o=i.offsetWidth||n.offsetWidth,r=i.offsetHeight||n.offsetHeight;if(0===o||0===r)return!1;t.prototype._emit.call(this,"_setCanvasSize",{width:o,height:r})},e.prototype.updateScrollSize=function(t){var e=t.width,i=t.height,n=t.x,r=t.y;if(e>0&&i>0){this._innerWidth=e,this._innerHeight=i;var s=this._query("scrollInner");s&&(s.style.width=e-1+"px",s.style.height=i-1+"px")}if(n!==this._scrollLeft||r!==this._scrollTop){var a=this._query("canvasScroll");a&&(this._scrollLeft=a.scrollLeft=n,this._scrollTop=a.scrollTop=r),a=null}var l=this._query("canvasWrapper"),h=this._query("canvasScroll");if(l&&h){var u=h.clientWidth,c=h.clientHeight;l.style.width=u+"px",l.style.height=c+"px";for(var d=Object(o.e)(),p=null==l?void 0:l.children,_=0;_<p.length;_++){var v=p[_];if("CANVAS"===v.tagName){var f=u*d,m=c*d;v.width!==f&&(v.width=f),v.height!==m&&(v.height=m)}v=null}}},e.prototype._createSlider=function(){var e=this._query("viewPort");if(!e)return null;var i=document.createElement("div");i.className="dvs-slideWrapper";for(var n=0;n++<3;){var o=document.createElement("div"),s=document.createElement("img");o.className="dvs-slideItem",s.className="dvs-slideImg",o.appendChild(s),i.appendChild(o)}e.appendChild(i),e=null,t.prototype._emit.call(this,r.d.BIND_SLIDE_COMPONENT,i),i=null},e.prototype._removeSlider=function(){var e=this._query("viewPort");if(!e)return null;var i=e.querySelector(".dvs-slideWrapper");t.prototype._emit.call(this,r.d.UNBIND_SLIDE_COMPONENT),i&&e.removeChild(i),i=null},e.prototype._createCanvas=function(e){var i,n=this._query("canvasWrapper");if(!n)return null;var o=document.createElement("canvas");o.id=e+"Canvas"+this._postfix,o.className="dvs-canvas dvs-"+e,n.appendChild(o),t.prototype._emit.call(this,"_bindCanvas",((i={})[e]=o,i)),this._canvasList.push(e),o=null},e.prototype._removeCanvas=function(e){var i=this._query("canvasWrapper");if(!i)return null;var n=this._query(e+"Canvas");if(!n)return null;i.removeChild(n),t.prototype._emit.call(this,"_unbindCanvas",e);for(var o=0;o<this._canvasList.length;o++)if(this._canvasList[o]===e){this._canvasList.splice(o,1);break}return n},e.prototype.removeAllCanvas=function(){for(var t=0;t<this._canvasList.length;t++)this._removeCanvas(this._canvasList[t])&&t--;this._removeSlider()},e.prototype.dispose=function(){t.prototype.dispose.call(this)},e}(a.a),F=undefined&&undefined.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Y=undefined&&undefined.__spreadArrays||function(){for(var t=0,e=0,i=arguments.length;e<i;e++)t+=arguments[e].length;var n=Array(t),o=0;for(e=0;e<i;e++)for(var r=arguments[e],s=0,a=r.length;s<a;s++,o++)n[o]=r[s];return n},W=function(t){function e(e,i,n,o,r){var s=t.call(this,o)||this;return s._sideRender=null,s._thumbnailRender=null,s._directoryRender=null,s._tagRender=null,s._scrollRender=null,s._pagerRender=null,s._tabRender=null,s._canvasRender=null,s._cameraRender=null,s._uiRender=null,s._dataStore=null,s._uiEventControl=null,s.uiConfig=null,s._viewerContainer=null,s.containerBox=null,s.useMyEvent=!0,s.topMenuColor="#3a393b",s.topMenuBorder="1px solid #1b1b1d",s.headerColor="#2a292b",s.footerColor="#434246",s.asideMenuColor="#434246",s.viewerBorderColor="#1b1b1d",s.canvasBackground="#434246",s.canvasBorder="0px solid #1b1b1d",s.canvasMouseShape="default",s.outerBorder="1px solid #1b1b1d",s._webcamItem=null,s._videoImageReady=!0,s._updateVideoTimer=null,s.showViewer=!0,s.showTopMenu=!0,s.showHeader=!0,s.showSidebar=!1,s.showTab=!1,s.showAside=!1,s.showMain=!0,s.showFooter=!0,s.showVideoContainer=!1,s.width="100%",s.height="100%",s.showWidth=-1,s.showHeight=-1,s._eventList={},s._resizeTimer=null,s._showLatestQueue={},s.postfix=n,s.uiConfig=i,s._dataStore=r,s._initViewer(e,i),s}return F(e,t),e.prototype._myQuery=function(t){var e,i;return null===(i=null===(e=this._viewerContainer)||void 0===e?void 0:e.el)||void 0===i?void 0:i.querySelector("#"+t)},e.prototype._myQueryAll=function(t){var e,i;return null===(i=null===(e=this._viewerContainer)||void 0===e?void 0:e.el)||void 0===i?void 0:i.querySelectorAll("#"+t)},e.prototype._initViewer=function(t,e){if(!t)return!1;if(Object(o.y)(t))t=document.getElementById(t);else if(!Object(o.q)(t))return!1;return this.containerBox=t,this._createMember(e,t),this._initMember(),this._initStatus(e),this._bindUiEvent(),this._bindButtonEvent(),!0},e.prototype._createMember=function(t,e){var i=this.postfix,n=this._oPub;this._uiRender=new E({postfix:i,container:e,uiConfig:t,pubsub:n});var o=this._uiRender.viewerContainer;this._viewerContainer=o,this._thumbnailRender=new A(i,n,o,this._dataStore),this._scrollRender=new D(i,n,o),this._pagerRender=new U(i,n),this._uiEventControl=new h(i,n,o),this._tabRender=new j(i,n,o),this._canvasRender=new H({postfix:i,pubsub:n,viewerContainer:o})},e.prototype._initMember=function(){var t;null===(t=this._sideRender)||void 0===t||t.sidebarInit(),this._scrollRender._addButtonScroll(),this._uiEventControl.uiEventInit(),this._tabRender.tabRenderInit(),this._canvasRender.canvasRenderInit()},e.prototype._initStatus=function(t){this.setViewerWidth(t.width),this.setViewerHeight(t.height),this.setShowViewer(t.showViewer),this.setOuterBorder(t.outerBorder),this.setFooterColor(t.footerColor),this.setHeaderColor(t.headerColor),this.setTopMenuColor(t.topMenuColor),this.setTopMenuBorder(t.topMenuBorder),this.setShowMain(t.showMain),this.setSidebarWidth(t.sidebarWidth),this.setShowVideoContainer(t.showVideoContainer),this.setShowTab(t.showTab),this.setCanvasBackground(t.canvasConfig.canvasBackground),this.setCanvasMouseShape(t.canvasConfig.canvasMouseShape),this.setCanvasBorder(t.canvasConfig.canvasBorder),this.setLoadingImage(t.canvasConfig.loadingImageUrl),this._setShowLoadingImage(!1)},e.prototype.unbindView=function(){var t,e=null===(t=this._viewerContainer)||void 0===t?void 0:t.el;if(!e)return!1;var i=e.parentNode;return i&&(this._unbindStatus(),i.removeChild(e),i=e=null,this._viewerContainer.el=null),!0},e.prototype.updateUiSetting=function(t){},e.prototype._bindUiEvent=function(){var t,e=((t={})[r.f.VIEWER_RESIZE]=this._resizeViewer,t[r.f.DOCUMENT_POINTER_MOVE]=this._documentMouseMove,t[r.f.DOCUMENT_POINTER_UP]=this._documentMouseUp,t[r.f.DOCUMENT_CLICK]=this._documentClick,t[r.f.VIEWER_CLICK]=this._viewerClick,t[r.f.VIEWER_RIGHT_CLICK]=this._viewerRightClick,t[r.f.VIEWER_MOVE]=this._viewerMove,t[r.f.SIDEBAR_CLICK]=this._sideBarClick,t[r.f.SIDEBAR_STRETCH_START]=this._sidebarStretchStart,t[r.f.OPEN_DEFAULT_TAG]=this._openDefaultTag,t[r.f.FILE_LIST_CLICK]=this._fileListClick,t[r.f.FILE_LIST_RIGHT_CLICK]=this._fileListRightClick,t[r.f.FILE_KEY_UP]=this._fileListKeyUp,t[r.f.ADD_NEW_FOLDER]=this._addNewFolder,t[r.f.TAG_LIST_CLICK]=this._tagListClick,t[r.f.TAG_LIST_RIGHT_CLICK]=this._tagListRightClick,t[r.f.TAG_KEY_UP]=this._tagListKeyUp,t[r.f.ADD_NEW_TAG]=this._addNewTag,t[r.f.PAGER_BLUR]=this._pagerBlur,t[r.f.SET_SCROLLER_SIZE]=this._setScrollerSize,t[r.f.CHANGE_CANVAS_CURSOR]=this.setCanvasCursorTemp,t[r.d.SHOW_CANVAS_LOADING]=this._setShowLoadingImage,t[r.f.TAB_CHANGED]=this._tabChanged,t[r.f.TAB_LIST_CLICK]=this._tabListClick,t[r.f.CLOSE_SAVE_SETTING_BOX]=this._closeSaveSettingBox,t.onPanelChange=this._togglePaneBox,t.onSetSplitBar=this._setSplitBar,t[r.f.SHOW_LATEST_PAGE]=this._showLatestPage,t[r.f.UPDATE_PAGES_LAYOUT]=this._updatePagesLayout,t[r.f.CUSTOM_BUTTON_CLICK]=this._customButtonClick,t[r.f.TAG_REFRESH]=this._tagRefresh,t[r.f.TAG_SELECTED]=this._tagSelectedCallback,t[r.f.IMAGE_SELECTED]=this._imageSelectedCallback,t[r.f.FILE_REFRESH]=this._directoryRefresh,t[r.f.FILE_SELECTED]=this._fileSelectedCallback,t[r.f.PAGER_CHANGED]=this._pagerRefresh,t[r.f.THUMBNAIL_CHANGED]=this._thumbnailRefresh,t);for(var i in e)this._viewOn(i,e[i]);this._eventList=e},e.prototype._unbindStatus=function(){for(var t=Object.keys(this._eventList),e=0;e<t.length;e++){var i=t[e];this._viewOff(i)}this._eventList=null,this._uiEventControl.unbindEvents(),this._tabRender=null,this._tagRender=null,this._directoryRender=null,this._thumbnailRender.removeAllThumbnail(),this._canvasRender.removeAllCanvas(),this._scrollRender.unbindEvents(),this._uiRender.unbindContent(),this._cameraRender=null,this._webcamItem=null},e.prototype._bindButtonEvent=function(){var t=this,e=this.uiConfig.buttons;Object.keys(e).forEach((function(i){var n,s,a=e[i],l=null===(s=null===(n=t._viewerContainer)||void 0===n?void 0:n.el)||void 0===s?void 0:s.querySelector("#"+i+t.postfix);if(!l)return!1;l.classList.add("dvs-iconColor"),a.iconClass===undefined&&l.classList.add("dvs-emptyBtn"),a.onButtonClick&&Object(o.c)(l,r.c.CLICK,(function(e){t._scrollRender.buttonMove?t._scrollRender.buttonMove=!1:(e.changedTouches,t._viewEmit(a.onButtonClick,e))}))}))},e.prototype._viewOn=function(t,e){this._on(t,e.bind(this))},e.prototype._viewOff=function(t,e){this._off(t,e)},e.prototype._viewEmit=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];this._emit.apply(this,Y([t],e))},e.prototype.setShowViewer=function(t){var e,i=null===(e=this._viewerContainer)||void 0===e?void 0:e.el;return this.showViewer=t,!!i&&(this._viewEmit(r.d.CANVAS_VISIBILITY_CHANGED,this.showViewer&&this.showMain),t?(i.classList.remove("dvs-disabled"),this._resizeViewer(),this._showLatestPage()):i.classList.add("dvs-disabled"),!0)},e.prototype.setShowTopMenu=function(t){var e=this._myQuery("topMenu"+this.postfix);return this.showTopMenu=t,!!e&&(t?e.classList.remove("dvs-disabled"):e.classList.add("dvs-disabled"),this._resizeViewer(),!0)},e.prototype.setShowHeader=function(t){var e=this._myQuery("header"+this.postfix);return this.showHeader=t,!!e&&(t?e.classList.remove("dvs-disabled"):e.classList.add("dvs-disabled"),this._resizeViewer(),!0)},e.prototype.setShowSidebar=function(t){var e;this.showSidebar=t;var i=null===(e=this._sideRender)||void 0===e?void 0:e.setShowSidebar(t);return this._resizeViewer(),i},e.prototype.setShowAside=function(t){var e=this._myQuery("asideMenu"+this.postfix);return this.showAside=t,!!e&&(t?e.classList.remove("dvs-disabled"):e.classList.add("dvs-disabled"),this._resizeViewer(),!0)},e.prototype.setShowMain=function(t){var e=this._myQuery("container"+this.postfix);return this.showMain=t,!!e&&(t?e.classList.remove("dvs-disabled"):e.classList.add("dvs-disabled"),this._viewEmit(r.d.CANVAS_VISIBILITY_CHANGED,this.showMain&&this.showViewer),this._resizeViewer(),!0)},e.prototype.setShowFooter=function(t){var e=this._myQuery("bottomMenu"+this.postfix);return this.showFooter=t,!!e&&(t?e.classList.remove("dvs-disabled"):e.classList.add("dvs-disabled"),this._resizeViewer(),!0)},e.prototype.setShowTab=function(t){var e=this._myQuery("tabList"+this.postfix);return this.showTab=t,!!e&&(t?e.classList.remove("dvs-disabled"):e.classList.add("dvs-disabled"),this._resizeViewer(),!0)},e.prototype.setHeaderColor=function(t){var e=this._myQuery("header"+this.postfix);return this.headerColor=t,e&&(e.style.background=t),!0},e.prototype.setTopMenuColor=function(t){var e=this._myQuery("topMenu"+this.postfix);return this.topMenuColor=t,e&&(e.style.background=t),!0},e.prototype.setTopMenuBorder=function(t){var e=this._myQuery("topMenu"+this.postfix);return this.topMenuBorder=t,e&&(e.style.border=t),this._resizeViewer(),!0},e.prototype.setFooterColor=function(t){var e=this._myQuery("bottomMenu"+this.postfix);return this.footerColor=t,e&&(e.style.background=t),!0},e.prototype.setAsideMenuColor=function(t){this.asideMenuColor=t;var e=this._myQuery("asideMenu"+this.postfix);return e&&(e.style.background=t),!0},e.prototype.setViewerBorderColor=function(t){var e,i=null===(e=this._viewerContainer)||void 0===e?void 0:e.el,n=this._myQuery("Thumbnail"+this.postfix),o=this._myQuery("content"+this.postfix),r=this._myQuery("middle"+this.postfix);i&&(i.style.borderColor=t),n&&(n.style.borderColor=t),o&&(o.style.borderColor=t),r&&(r.style.borderColor=t),this.viewerBorderColor=t},e.prototype.setOuterBorder=function(t){var e;this.outerBorder=t;var i=null===(e=this._viewerContainer)||void 0===e?void 0:e.el;i&&(i.style.border=t);var n=this._myQuery("container"+this.postfix),o=this._myQuery("middle"+this.postfix);if(n&&o){var r=t.split(" ");n.style.borderStyle=r[1],n.style.borderColor=r[2],o.style.borderStyle=r[1],o.style.borderColor=r[2],this._setSplitBar()}this._resizeViewer()},e.prototype.setViewerWidth=function(t){var e,i=null===(e=this._viewerContainer)||void 0===e?void 0:e.el;if(this.width=t,!i)return!1;var n=String(t);return/\d+$/.test(n)&&(t=n+"px"),i.style.width=""+t,this._resizeViewer(),this._showLatestPage(),!0},e.prototype.getViewerWidth=function(){var t,e=null===(t=this._viewerContainer)||void 0===t?void 0:t.el;return e?e.offsetWidth:this.width},e.prototype.setViewerHeight=function(t){var e,i=null===(e=this._viewerContainer)||void 0===e?void 0:e.el;if(this.height=t,!i)return!1;var n=String(t);return/\d+$/.test(n)&&(t=n+"px"),i.style.height=""+t,this._resizeViewer(),this._showLatestPage(),!0},e.prototype.getViewerHeight=function(){var t,e=null===(t=this._viewerContainer)||void 0===t?void 0:t.el;return e?e.offsetHeight:this.height},e.prototype.setSidebarWidth=function(t){var e,i=null===(e=this._sideRender)||void 0===e?void 0:e.setSidebarWidth(t);return this._resizeViewer(),i},e.prototype.getSidebarWidth=function(){var t;return null===(t=this._sideRender)||void 0===t?void 0:t.getSidebarWidth()},e.prototype.setShowVideoContainer=function(t){var e=this._myQuery("container"+this.postfix);if(!e)return!1;for(var i=e.children,n=0,o=i.length;n<o;n++){var r=i[n];if(null==r?void 0:r.classList.contains("dvs-customElement"))break;r.classList.contains("dvs-videoContainer")?t?r.classList.remove("dvs-hideVideoContainer"):r.classList.add("dvs-hideVideoContainer"):t?r.classList.add("dvs-hideVideoContainer"):r.classList.remove("dvs-hideVideoContainer")}return this.showVideoContainer=t,t||(this._resizeViewer(),this._showLatestPage()),!0},e.prototype.switchToTagTab=function(){var t=this._myQuery("TagsNav"+this.postfix),e=t&&t.children[0];return!!e&&(e.click(),!0)},e.prototype.switchToTreeTab=function(){var t=this._myQuery("DirctoryTreeNav"+this.postfix),e=t&&t.children[0];return!!e&&(e.click(),!0)},e.prototype.showGroup=function(t){var e=this._myQuery(t+this.postfix);return!!e&&(e.classList.remove("dvs-disabled"),e.classList.remove("dvs-noDisplay"),!0)},e.prototype.hideGroup=function(t){var e=this._myQuery(t+this.postfix);return!!e&&(e.classList.add("dvs-disabled"),e.classList.add("dvs-noDisplay"),!0)},e.prototype._documentMouseMove=function(t){this._cameraRender&&this._cameraRender.mouseMoveCallback(t)},e.prototype._documentMouseUp=function(t){var e,i;return!(!(null===(e=this._viewerContainer)||void 0===e?void 0:e.el)||!t)&&((!t.button||0===t.button)&&(this._cameraRender&&this._cameraRender.mouseUpCallback(t),void(null===(i=this._sideRender)||void 0===i||i.stretchMouseUp())))},e.prototype.documentKeyDown=function(t,e){e?this._thumbnailRender.keydownCallback(t,e):this._viewEmit(r.d.CANVAS_KEY_DOWN,t)},e.prototype.documentKeyUp=function(t,e){e?this._thumbnailRender.keyupCallback(t,e):this._viewEmit(r.d.CANVAS_KEY_UP,t)},e.prototype._documentClick=function(t){this._viewEmit(r.d.UPDATE_FOCUS,{viewerId:undefined,thumbnailId:undefined})},e.prototype.styleChange=function(){var t;if(!this.showViewer)return!1;if(this.uiConfig.buttonResize.ifResize)if(Object(o.u)()){var e=null===(t=this._viewerContainer)||void 0===t?void 0:t.el;if(!e)return;e.classList.add("DWT_imageEditor"),e=null}else this._changeButtonSize();var i=this._myQuery("topMenuRight"+this.postfix);i&&(i.parentElement.style.paddingRight=(i.getBoundingClientRect().width||0)+"px"),this._thumbnailRender.calculateSize(),this._thumbnailRender.updateAllDisplayed(),this.updateVideoSize(),this._scrollRender.updateAllGroupShowMore(),this._canvasRender.updateCanvasInnerSize(),this._sendViewSize()},e.prototype._viewerClick=function(t){},e.prototype._viewerRightClick=function(t){},e.prototype._viewerMove=function(t){var e;null===(e=this._sideRender)||void 0===e||e.stretchMouseMove(t)},e.prototype._dropFile=function(t){for(var e=t.dataTransfer.files,i=[],n=0;n<e.length;n++){var s=e[n];if(/^image\/(?!tiff)/.test(s.type)){var a={oriData:o.a.createObjectURL(s),minData:null,metadata:{width:500,height:600},tags:[]};i.push(a)}}this._viewEmit(r.d.APPEND_SYNC_DROP,i)},e.prototype._sendViewSize=function(){var t,e=null===(t=this._viewerContainer)||void 0===t?void 0:t.el;if(!e)return!1;var i=e.getBoundingClientRect();if(0===i.width||0===i.height||Math.round(i.width)===Math.round(this.showWidth)&&Math.round(i.height)===Math.round(this.showHeight))return!1;this.showWidth=Math.round(i.width),this.showHeight=Math.round(i.height),this._viewEmit(r.g.RESIZE,i.width,i.height)},e.prototype.createThumbnail=function(t){return this._thumbnailRender.createThumbnail(t)},e.prototype.createInnerThumbnail=function(){this._thumbnailRender.createInnerThumbnail(this.uiConfig.canvasConfig)},e.prototype.removeThumbnail=function(t){var e=this._thumbnailRender.removeThumbnail(t);return this._setSplitBar(),e},e.prototype._sideBarClick=function(t){var e;null===(e=this._sideRender)||void 0===e||e.setShowNavigationBox(!1)},e.prototype._sidebarStretchStart=function(t){var e;null===(e=this._sideRender)||void 0===e||e.stretchMouseDown(t)},e.prototype._openDefaultTag=function(){this._directoryRender&&this._tagRender&&(this._viewEmit("_onOpenAll"),this._myQuery("defaultTag"+this.postfix).classList.add("dvs-activeAllImage"),this._tagRender.selectTagByName(""),this._directoryRender.selectFileByName(""))},e.prototype._fileListClick=function(t){var e=this._directoryRender;e&&(e.confirmFolder(t),e.cancelFolder(t),e.enterFolder(t))},e.prototype._fileListRightClick=function(t){},e.prototype._fileListKeyUp=function(t){if(13===t.keyCode){var e=t.target.nextSibling.children[0];e&&e.click()}else if(27===t.keyCode){var i=t.target.nextSibling.children[1];i&&i.click()}},e.prototype._addNewFolder=function(t){var e;null===(e=this._directoryRender)||void 0===e||e.addNewFolder(t)},e.prototype._tagListClick=function(t){var e=t.target,i=this._tagRender;if(!e||!i)return!1;e.classList.contains("confirmTag")||e.classList.contains("renameConfirmTag")?i.confirmTag(e):e.classList.contains("cancelTag")?i.cancelTag(e):e.classList.contains("dvs-quickEdit")?i.quickRenameTag(e):e.classList.contains("dvs-quickDel")?i.quickDelTag(e):i.showTagContent(t)},e.prototype._tagListRightClick=function(t){},e.prototype._tagListKeyUp=function(t){if(13===t.keyCode){var e=t.target.nextSibling.children[0];e&&e.click()}else if(27===t.keyCode){var i=t.target.nextSibling.children[1];i&&i.click()}},e.prototype._addNewTag=function(t){var e;null===(e=this._tagRender)||void 0===e||e.addNewTag(t)},e.prototype._pagerBlur=function(t){this._pagerRender.pageBlur(t)},e.prototype.setInnerTbProp=function(t,e){var i;this._handleInnerProp(t,e),null===(i=this._thumbnailRender.innerThumbnail)||void 0===i||i.handleInnerProp(t,e)},e.prototype._handleInnerProp=function(t,e){this[t]=e;var i="set"+t.replace(/^[a-z]{1}/,(function(t){return t.toUpperCase()}));Object(o.s)(this[i])&&this[i](e)},e.prototype.setCanvasBackground=function(t){var e;this.canvasBackground=t;var i=this._myQuery("mainCanvas"+this.postfix);i&&(i.style.background="",setTimeout((function(){i.style.background=t}))),this._thumbnailRender.innerThumbnail&&(this._thumbnailRender.innerThumbnail.background=t);var n=null===(e=this._viewerContainer.el)||void 0===e?void 0:e.querySelector(".dvs-slideWrapper");n&&(n.style.background=t)},e.prototype.setCanvasBorder=function(t){this.canvasBorder=t;var e=this._myQuery("viewPort"+this.postfix);e&&(e.style.border=t),this._thumbnailRender.innerThumbnail&&(this._thumbnailRender.innerThumbnail.border=t),this._resizeViewer()},e.prototype.setCanvasMouseShape=function(t,e){void 0===e&&(e=!1),e||(this.canvasMouseShape=t,this._viewEmit(r.d.CANVAS_DEFAULT_CURSOR,t));var i=this._myQuery("canvasWrapper"+this.postfix);i&&(i.style.cursor=t),this._thumbnailRender.innerThumbnail&&(this._thumbnailRender.innerThumbnail.mouseShape=t)},e.prototype.setCanvasCursorTemp=function(t){this.setCanvasMouseShape(t||this.canvasMouseShape,!0)},e.prototype.setSelectedBoxLineColor=function(t){var e;this._thumbnailRender.innerThumbnail.setSelectedBoxLineColor(t),null===(e=this._cameraRender)||void 0===e||e.setSelectedBoxColor(t)},e.prototype.setOperationMode=function(t){this._thumbnailRender.innerThumbnail.setOperationMode(t)},e.prototype.setSelectedBoxes=function(t,e){this._thumbnailRender.innerThumbnail.setSelectedBoxes(t,e)},e.prototype.clearSelectedBoxes=function(t){this._thumbnailRender.innerThumbnail.clearSelectedBoxes(t)},e.prototype.setKeepAspectRatio=function(t){this._thumbnailRender.innerThumbnail.setKeepAspectRatio(t)},e.prototype.setAspectRatio=function(t){this._thumbnailRender.innerThumbnail.setAspectRatio(t)},e.prototype._setScrollerSize=function(t){this._canvasRender.updateScrollSize(t)},e.prototype._tabChanged=function(t){this._tabRender.updateTabList(t)},e.prototype._tabListClick=function(t){var e=t.target;if(null==e?void 0:e.classList.contains("dvs-closeTab"))null==e||e["dvs-id"]},e.prototype._tagRefresh=function(t){var e;null===(e=this._tagRender)||void 0===e||e.updateTagList(t)},e.prototype._tagSelectedCallback=function(t){var e;null===(e=this._tagRender)||void 0===e||e.selectTagByName(t)},e.prototype._imageSelectedCallback=function(t){return this._thumbnailRender.updateSelectedIndexes(t)},e.prototype._directoryRefresh=function(t){if(!this._myQuery("treeLists"+this.postfix)||!this._directoryRender)return!1;this._directoryRender.updateDirectory(t);var e=this._myQuery("addFolder"+this.postfix);e&&e.style&&(e.style.pointerEvents="auto")},e.prototype._fileSelectedCallback=function(t){var e;null===(e=this._directoryRender)||void 0===e||e.selectFileByName(t)},e.prototype._pagerRefresh=function(t){var e=t.cur,i=t.total,n=this._pagerRender.getCurrentPage();this._pagerRender.getTotalPage();this._thumbnailRender.pageChangeCallback(n,e,i),this._pagerRender.updatePage(t),this._showLatestPage(e)},e.prototype._thumbnailRefresh=function(t){this._thumbnailRender.updateContents(t)},e.prototype.setDisplayMode=function(t){var e,i,n=this._myQuery("viewPort"+this.postfix),o=this._thumbnailRender.innerThumbnail;if("single"===t)o.clearSelectedBoxes(),null===(e=this._myQuery("innerThumbnail"+this.postfix))||void 0===e||e.classList.add("dvs-disabled"),null==n||n.classList.remove("dvs-disabled"),o.showThumbnail=!1;else{if("continuous"!==t)return!1;null==n||n.classList.add("dvs-disabled"),null===(i=this._myQuery("innerThumbnail"+this.postfix))||void 0===i||i.classList.remove("dvs-disabled"),o.showThumbnail=!0}return this._resizeViewer(),!0},e.prototype.setViewMode=function(t,e){return this._thumbnailRender.innerThumbnail.setViewMode(t,e)},e.prototype._togglePaneBox=function(){var t,e,i=null===(t=this._sideRender)||void 0===t?void 0:t.getShowNavigation();null===(e=this._sideRender)||void 0===e||e.setShowNavigationBox(!i)},e.prototype._customButtonClick=function(t,e){this._scrollRender.buttonMove?this._scrollRender.buttonMove=!1:this._viewEmit(t,e)},e.prototype._closeSaveSettingBox=function(){},e.prototype._setSplitBar=function(){var t,e=this._myQuery("container"+this.postfix),i=this._myQuery("middle"+this.postfix);if(!e||!i)return!1;var n=Object.keys(this._thumbnailRender._thumbnails),o=this._thumbnailRender._thumbnails[n[0]];if(!o||!(null==o?void 0:o.showThumbnail)||(null==o?void 0:o.fullThumbnail)||(null===(t=this._cameraRender)||void 0===t?void 0:t.isVideoShow))e.style.borderWidth="0px",i.style.borderWidth="0px";else{var r=this.outerBorder.split(" ")[0],s="horizontal"===o.location,a=o.sequence,l=this._getBorderWidth(r,s,a);s?(e.style.borderWidth=l,i.style.borderWidth="0px"):(i.style.borderWidth=l,e.style.borderWidth="0px")}this._resizeViewer()},e.prototype._changeButtonSize=function(){var t,e=null===(t=this._viewerContainer)||void 0===t?void 0:t.el;if(!e)return!1;e.classList.add("dvs-buttonResize");var i=e.clientWidth,n=e.clientHeight,r=36*(i/1920<n/1080?i/1920:n/1080)*window.devicePixelRatio,s=this._myQuery("topMenu"+this.postfix),a=this._myQuery("bottomMenu"+this.postfix),l=this.uiConfig.buttonResize,h=l.maxSize,u=l.minSize,c=Math.max(Math.min(r,h),u),d=Math.floor(1.875*c);if(s&&s.clientWidth>0){s.classList.add("dvs-resizeButton"),Object(o.F)(s,{flexBasis:d+"px",height:d+"px"});for(var p=0;p<s.children.length;p++){s.children[p].style.fontSize=c+"px"}}if(a&&a.clientWidth>0){a.classList.add("dvs-resizeButton"),Object(o.F)(a,{fontSize:c+"px",flexBasis:d+"px",height:d+"px",justifyContent:"flex-start"});for(p=0;p<a.children.length;p++){a.children[p].style.fontSize=c+"px"}}},e.prototype._resizeViewer=function(t,e){var i=this;t&&e&&(this._showLatestQueue[t]=e),clearTimeout(this._resizeTimer),this._resizeTimer=setTimeout((function(){var t,e;for(var n in i.styleChange(),i._showLatestQueue)null===(e=(t=i._showLatestQueue)[n])||void 0===e||e.call(t,i._pagerRender.getCurrentPage());i._showLatestQueue={}}),20)},e.prototype._getBorderWidth=function(t,e,i){var n="";return n+=!e&&i<0?t:"0px",n+=" ",n+=e&&i>=0?t:"0px",n+=" ",n+=!e&&i>=0?t:"0px",n+=" ",n+=e&&i<0?t:"0px"},e.prototype._updatePagesLayout=function(){this._thumbnailRender.updatePagesLayout()},e.prototype._showLatestPage=function(t){this._thumbnailRender.showLatestPage(t)},e.prototype.setButtonClass=function(t){var e=this.uiConfig.buttons,i=this._myQuery(""+t+this.postfix);if(i){var n=e[t],o=n.iconClass?" "+n.iconClass:"",r=n.cssStyle?" "+n.cssStyle:"",s=i.classList.contains("dvs-disabled")?" dvs-disabled":"",a=n.setClass||"";return i.className="ds-dvs-ui-iconfont dvs-iconColor dvs-"+t+s+o+r+" "+a,!0}return!1},e.prototype.setGroupClass=function(t,e){var i=this.uiConfig.groups,n=this._myQuery(t+this.postfix);if(n){var o=i[t].cssStyle?" "+i[t].cssStyle:"",r=n.classList.contains("dvs-disabled")?" dvs-disabled":"";return n.className="dvs-"+t+" dvs-groupType"+r+o+" "+e,!0}return!1},e.prototype.fullScreen=function(){var t,e=null===(t=this._viewerContainer)||void 0===t?void 0:t.el,i=Object(o.z)(e);return this._resizeViewer(),i},e.prototype.cancelFullScreen=function(){var t=Object(o.r)()&&Object(o.f)();return this._resizeViewer(),t},e.prototype.fullPage=function(){var t,e=null===(t=this._viewerContainer)||void 0===t?void 0:t.el;return!!e&&(e.classList.add("fitPage"),this.cancelFullScreen(),this._resizeViewer(),!0)},e.prototype.cancelFullPage=function(){var t,e=null===(t=this._viewerContainer)||void 0===t?void 0:t.el;return!!e&&(e.classList.remove("fitPage"),this.cancelFullScreen(),this._resizeViewer(),!0)},e.prototype.createCustomElement=function(t,e,i){return void 0===e&&(e=0),void 0===i&&(i=!1),this._uiRender.createCustomElement(t,e,i)},e.prototype.updateVideoSize=function(){if(this._videoSize&&this.showVideoContainer){var t=this._myQuery("videoContainer"+this.postfix),e=this._myQuery("videoImage"+this.postfix);if(!t||!e)return!1;var i=t.clientWidth,n=t.clientHeight,o=this._videoSize,r=o.imageWidth,s=o.imageHeight;if(i/r-1<n/s-1){var a=i/r;e.style.width=i+"px",e.style.height=s*a+"px"}else{a=n/s;e.style.width=r*a+"px",e.style.height=n+"px"}this._videoSize.imageBoxWidth=e.clientWidth,this._videoSize.imageBoxHeight=e.clientHeight}},e.prototype.updateVideoContainer=function(t){var e=this;return this._videoImageReady?this._updateVideoImage(t):(clearTimeout(this._updateVideoTimer),this._updateVideoTimer=setTimeout((function(){e._updateVideoImage(t)}),200),!0)},e.prototype._updateVideoImage=function(t){var e=this,i=this._myQuery("videoImage"+this.postfix);if(!i)return!1;i.src=t,clearTimeout(this._updateVideoTimer),this._videoImageReady=!1,i.onload=function(){e._videoImageReady=!0,i.style.display="",e._videoSize&&e._videoSize.imageWidth===i.naturalWidth&&e._videoSize.imageHeight===i.naturalHeight&&e._videoSize.imageBoxWidth===i.clientWidth&&e._videoSize.imageBoxHeight===i.clientHeight||(e._videoSize={imageWidth:i.naturalWidth,imageHeight:i.naturalHeight,imageBoxWidth:i.clientWidth,imageBoxHeight:i.clientHeight},e.updateVideoSize())},i.onerror=function(){e._videoImageReady=!0,i.style.display="none",i.onload=null}},e.prototype.getViewerElement=function(){var t;return(null===(t=this._viewerContainer)||void 0===t?void 0:t.el)||null},e.prototype.bindContent=function(t){return this._uiRender.bindContent(t)},e.prototype.unbindContent=function(){return this._uiRender.unbindContent()},e.prototype.setLoadingImage=function(t){if(!t)return!1;var e=this._myQuery("loadingImage"+this.postfix);return e&&(e.src=t),!0},e.prototype._setShowLoadingImage=function(t){var e=this._myQuery("loadingLayer"+this.postfix);e&&(t?e.classList.remove("dvs-disabled"):e.classList.add("dvs-disabled"))},e.prototype.dispose=function(){var e,i,n,o,r,s,a,l,h,u,c;t.prototype.dispose.call(this),this.unbindView(),this.unbindContent(),null===(e=this._uiRender)||void 0===e||e.dispose(),this._uiRender=null,null===(i=this._thumbnailRender)||void 0===i||i.dispose(),this._thumbnailRender=null,null===(n=this._scrollRender)||void 0===n||n.dispose(),this._scrollRender=null,null===(o=this._pagerRender)||void 0===o||o.dispose(),this._pagerRender=null,null===(r=this._uiEventControl)||void 0===r||r.dispose(),this._uiEventControl=null,null===(s=this._tabRender)||void 0===s||s.dispose(),this._tabRender=null,null===(a=this._canvasRender)||void 0===a||a.dispose(),this._canvasRender=null,null===(l=this._sideRender)||void 0===l||l.dispose(),this._sideRender=null,null===(h=this._directoryRender)||void 0===h||h.dispose(),this._directoryRender=null,null===(u=this._tagRender)||void 0===u||u.dispose(),this._tagRender=null,null===(c=this._cameraRender)||void 0===c||c.dispose(),this._cameraRender=null,this._viewerContainer=null,this.containerBox=null},e}(a.a);i.d(e,"ViewUi",(function(){return W})),window.Dynamsoft=window.Dynamsoft||{},window.Dynamsoft.ViewUi=W}]);
|
|
1
|
+
/*! 20220624 190905 */!function(){function i(t,e){return(i=Object.setPrototypeOf||function i(t,e){return t.__proto__=e,t})(t,e)}function h(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,i(t,e)}function a(t){return Array.isArray?Array.isArray(t):"[object Array]"===Object.prototype.toString.call(t)}function O(t){if(Array.isArray(t)){for(var e=0;e<t.length;e++)for(var i=e+1;i<t.length;i++)t[e]===t[i]&&(t.splice(i,1),i--);return t}}function o(t){return"[object Object]"===Object.prototype.toString.call(t)}function l(t){return"function"==typeof t}function u(t){return"string"==typeof t}function p(t){return"number"==typeof t&&!isNaN(t)}function c(){return"ontouchstart"in document.documentElement}function r(t){return t instanceof HTMLElement||"[object ShadowRoot]"===Object.prototype.toString.call(t)}function d(t,e){if(u(e))t.style.cssText=e;else for(var i in e)t.style[i]=e[i]}function _(t,e,i,n){if(t)return t.addEventListener(e,i,n),function(){t.removeEventListener(e,i)}}function f(t,e){for(var i in t)e[i]!==undefined&&o(t[i])&&o(e[i])?f(t[i],e[i]):e[i]=t[i]}function b(t,e){for(var i in t){var n=t[i],s=e[i];s===undefined?e[i]=t[i]:u(n)&&o(s)?s.visibility=n:o(n)&&o(s)?b(t[i],e[i]):e[i]=t[i]}}function v(t){t&&t.stopPropagation?t.stopPropagation():t&&(t.cancelBubble=!0)}function P(t){t.preventDefault?t.preventDefault():t.returnValue=!1}function m(t){return""===t||t===undefined?null:document.getElementById(t)}function R(t){for(var e=t.parentNode.children,i=0;i<e.length;i++)if(e[i]===t)return i}function L(t,e,i){e===undefined?i.appendChild(t):i.insertBefore(t,e)}function g(t){var e=Math.random().toString(35).substring(2);return e.length<11&&(e+=Math.random().toString(35).substring(2)),t=Math.max(Math.min(Math.round(t),11),8),e=e.substring(0,t)}function y(){var t=window;if(t){if(t.devicePixelRatio)return t.devicePixelRatio;if(t.screen.deviceXDPI&&t.screen.logicalXDPI)return t.screen.deviceXDPI/t.screen.logicalXDPI}return 1}var e=function(t){window.Dynamsoft&&window.Dynamsoft.Lib.debug&&window.Dynamsoft.Lib.log(t)},n={windowURL:window.URL||window.webkitURL,createURL:function(t){return u(t)?t:n.createURLWithType(t).data},createURLWithType:function(t){if(u(t)||undefined===t)return{type:"string",data:t};if(t instanceof Blob)return{type:"object",data:n.createObjectURL(t)};if(t.imageData&&t.imageData instanceof Blob)return{type:"object",data:n.createObjectURL(t.imageData)};if(t.imageData){var e=Object.prototype.toString.call(t.imageData);if(/\[object \w+Array\]/.test(e))return{type:"object",data:n.createObjectURL(new Blob([t.imageData]))}}else{e=Object.prototype.toString.call(t);if(/\[object \w+Array\]/.test(e))return{type:"object",data:n.createObjectURL(new Blob([t]))}}return/data:image\/\w+;base64/.test(t)?{type:"string",data:t}:{type:"object",data:t}},createObjectURL:function(t){if(!t)return"";t=n.windowURL.createObjectURL(t);return e("createObjectURL:"+t),t},revokeObjectURL:function(t){e("revokeObjectURL:"+t),u(t)&&0==t.indexOf("blob:http")&&n.windowURL.revokeObjectURL(t)}},t="undefined"!=typeof window,N=t?window:{},w=(t&&0 in window.document.documentElement,t&&0 in N,"click"),W="touchstart",V="touchmove",Y="touchend",X="mousedown",A="mousemove",F="mouseup",H="contextmenu",Q="resize",q="click",s="mousedown",x="mousemove",C="mouseup",j="mouseover",K="mouseout",G="dblclick",$="rightclick",J="contextmenu",Z="dragstart",tt="dragmove",et="dragdone",it="keydown",nt="keyup",st="resize",rt="topPageChanged",ot="bufferChanged",at="resize",lt="removePage",ht="fileKeyUp",ut="fileListClick",ct="fileListRightClick",dt="tagKeyUp",_t="tagListClick",pt="tagListRightClick",ft="pageAreaSelected",vt="pageAreaUnselected",S="pageRendered",mt="onDocumentPointerUp",gt="onDocumentPointerMove",bt="onDocumentClick",yt="onSidebarClick",wt="onDrop",xt="_updateFocus",Ct="_canvasVisibilityChanged",I="_SetSelectedIndexes",St="_documentUp",It="_documentMove",kt="_displayedImageChanged",Mt="_onReOrderThumbnail",Bt="_changeThumbnailViewProp",Tt="_updateErrorMessage",Pt="_clearSltBox",Rt="_bindSlideComponent",Lt="_unbindSlideComponent",Et="_canvasTouchstart",Ut="_canvasTouchmove",zt="_canvasTouchend",Dt="_canvasMousedown",Ot="_canvasMouseup",Nt="_canvasMousemove",Wt="_canvasMouseOver",Vt="_canvasMouseOut",Yt="_canvasWheel",Xt="_canvasScroll",At="_canvasClick",Ft="_canvasDoubleClick",Ht="_canvasRightClick",Qt="_canvasKeyDown",qt="_canvasKeyUp",jt="_canvasDragDone",Kt="_canvasDefaultCursor",Gt="_showCanvasLoading",k="_viewerResizeUI",$t="_mouseClickUI",Jt="_viewerRightClickUI",Zt="_mouseMoveUI",te="_showLatestPage",ee="_updatePagesLayout",M="_documentPointerMoveUI",B="_documentPointerUpUI",ie="_documentKeyDownUI",ne="_documentKeyUpUI",se="_documentClickUI",re="_sideBarClickUI",oe="_sidebarStretchStartUI",ae="_fileListClickUI",le="_fileListRightClickUI",he="_fileListKeyUpUI",ue="_addNewFolderUI",ce="_directoryRefreshUI",de="_fileSelectedUI",_e="_tagListClickUI",pe="tagListRightClickUI",fe="_tagKeyUpUI",ve="_addNewTagUI",me="_tagRefreshUI",ge="_tagSelectedUI",be="_openDefaultTagUI",ye="_imageSelectedUI",we="_thumbnailChangedUI",xe="_updateThbItem",Ce="_updateThumbnailPropUI",Se="_scrollToUI",Ie="_setViewModeUI",T="_mergeDisplayedUidsUi",ke="_pagerBlurUI",Me="_pagerChangedUI",Be="_setScrollerSizeUI",Te="_changeCanvasCursorUI",Pe="_tabChangedUI",Re="_tabListClickUI",Le="_closeSaveSettingBoxUI",Ee="_customButtonClickUI",Ue="_gotoPage",ze={code:80030,message:"The metadata is not exist."},De=function(){function t(t){this._clickItem=null,this._clickTimer=null,this._rightClickItem=null,this._rightClickTimer=null,this._mouseDownItem=null,this._startX=0,this._startY=0,this._mouseUpItem=null,this._evtList=[],this.onClick=null,this.onRightClick=null,this.onDoubleClick=null,this.onPointDown=null,this.onPointMove=null,this.onPointUp=null,this.onPointOver=null,this.onPointOut=null,this._element=t,this._registerEvents()}var e=t.prototype;return e._registerEvents=function(){var n=this,t=this._element,i=c(),e="mousedown",s="mousemove",r="mouseup";i&&(e="touchstart",s="touchmove",r="touchend",i=!0),e=_(t,e,function(t){var e=n._packageEvent(t);n._mouseDownItem=n.getTarget(t),n._startX=e.clientX,n._startY=e.clientY,null!=(t=n.onPointDown)&&t.call(n,e),i?n._rightClickTimer=setTimeout(function(){var t;null!=(t=n.onRightClick)&&t.call(n,e),n._mouseDownItem=null},500):2===e.button&&(n._rightClickItem=n.getTarget(e))},{passive:!1}),this._evtList.push(e),e=_(t,s,function(t){var t=n._packageEvent(t),e=(null!=(e=n.onPointMove)&&e.call(n,t),Math.abs(t.clientX-n._startX)),t=Math.abs(t.clientY-n._startY);(5<e||5<t)&&(clearTimeout(n._rightClickTimer),c()&&(n._mouseDownItem=null))},{passive:!1}),this._evtList.push(e),e=_(t,r,function(t){var e,t=n._packageEvent(t);n._mouseUpItem=n.getTarget(t),null!=(e=n.onPointUp)&&e.call(n,t),clearTimeout(n._rightClickTimer),n.getTarget(t)===n._rightClickItem&&2===t.button?null!=(e=n.onRightClick)&&e.call(n,t):n._mouseDownItem===n._mouseUpItem&&n._clickHandler(t),n._rightClickItem=null}),this._evtList.push(e),e=_(t,"mouseover",function(t){var e,i;c()||((i=t.fromElement)===undefined&&(i=t.relatedTarget),(e=t.toElement)===undefined&&(e=t.target),n.getTarget(t,i)!==n.getTarget(t,e)&&null!=(i=n.onPointOver)&&i.call(n,t))}),this._evtList.push(e),e=_(t,"mouseout",function(t){var e,i;c()||((i=t.fromElement)===undefined&&(i=t.target),(e=t.toElement)===undefined&&(e=t.relatedTarget),n.getTarget(t,i)!==n.getTarget(t,e)&&null!=(i=n.onPointOut)&&i.call(n,t))}),this._evtList.push(e)},e._unregisterEvents=function(){this._evtList.forEach(function(t){l(t)&&t()}),this._evtList.splice(0)},e._clickHandler=function(t){var e=this,i=this._packageEvent(t);clearTimeout(this._clickTimer),this.getTarget(t)===this._clickItem?(this._clickItem=null,setTimeout(function(){var t;null!=(t=e.onDoubleClick)&&t.call(e,i)})):this._mouseDownItem===this._mouseUpItem&&(this._clickItem=this.getTarget(i),setTimeout(function(){var t;null!=(t=e.onClick)&&t.call(e,i)})),this._mouseDownItem=null,this._mouseUpItem=null,this._clickTimer=setTimeout(function(){e._clickItem=null},500)},e._packageEvent=function(t){var e,i,n=null==(e=t.changedTouches)?void 0:e[0];if(!n)return t;for(i in n)t[i]===undefined&&(t[i]=n[i]);return t},e.getTarget=function(t,e){return e!==undefined?e:t.target},e.dispose=function(){this._unregisterEvents(),this._element=null,this._clickItem=null,this._clickTimer=null,this._rightClickItem=null,this._rightClickTimer=null,this._mouseDownItem=null,this._mouseUpItem=null,this.onClick=null,this.onRightClick=null,this.onDoubleClick=null,this.onPointDown=null,this.onPointMove=null,this.onPointUp=null,this.onPointOver=null,this.onPointOut=null},t}(),E=function(){function t(t){this._evtIds=[],this._oPub=null,this._bDisposePub=!1,t?this._oPub=t:(this._oPub=new Oe,this._bDisposePub=!0)}var e=t.prototype;return e.getPublishSubscribe=function(){return this._oPub},e._on=function(t,e){e=this._oPub.on(t,e);this.push(t,e)},e._emit=function(t){for(var e,i=arguments.length,n=new Array(1<i?i-1:0),s=1;s<i;s++)n[s-1]=arguments[s];null!=(e=this._oPub)&&e.emit.apply(e,[t].concat(n))},e._off=function(t,e){var i;null!=(i=this._oPub)&&i.off(t,e)},e._offById=function(t,e){var i;null!=(i=this._oPub)&&i.offById(t,e)},e.push=function(t,e){this._evtIds.push({name:t,id:e})},e.dispose=function(){if(this._oPub){for(var t=this._evtIds.length,e=0;e<t;e++){var i=this._evtIds[e];this._oPub.offById(i.name,i.id)}this._bDisposePub&&this._oPub&&this._oPub.dispose()}this._oPub=null},t}(),Oe=function(){function t(){this._events={}}var e=t.prototype;return e.on=function(t,e){this._events[t]||(this._events[t]=[]);var i=g(10);return this._events[t].push({fn:e,evtId:i}),i},e.emit=function(t){var e=this._events[t];if(!e||0===e.length)return!1;for(var i=e.length,n=arguments.length,s=new Array(1<n?n-1:0),r=1;r<n;r++)s[r-1]=arguments[r];for(var o,a=0;a<i;a++)null!=(o=e[a])&&(o=o.fn).call.apply(o,[null].concat(s))},e.emitEx=function(t){var i=this._events[t];if(!i||0===i.length)return Promise.resolve(!0);for(var e=i.length,n=Promise.resolve(!0),s=arguments.length,r=new Array(1<s?s-1:0),o=1;o<s;o++)r[o-1]=arguments[o];if(1===i.length)return(t=null==(t=i[0])?void 0:(t=t.fn).call.apply(t,[null].concat(r)))instanceof Promise?t:n;for(var a=function a(t){var e=null==(t=i[t])?void 0:(t=t.fn).call.apply(t,[null].concat(r));e instanceof Promise&&(n=n.then(function(){return e}))},l=0;l<e;l++)a(l);return n},e.off=function(t,e){var i=this._events[t];if(!i)return!1;if(e)for(var n=i.length-1;0<=n;n--){var s=i[n];s&&s.fn===e&&i.splice(n,1),s=null}else i&&(i.length=0)},e.offById=function(t,e){var i=this._events[t];if(!i)return!1;if(e)for(var n=i.length-1;0<=n;n--){var s=i[n];if(s&&s.evtId===e){i.splice(n,1);break}s=null}else i&&(i.length=0)},e.dispose=function(){for(var t=Object.keys(this._events),e=0,i=t.length;e<i;e++){var n=t[e],n=this._events[n];n&&n.splice(0),n=null}this._events={}},t}(),Ne=function(a){function t(t,e,i){e=a.call(this,e)||this;return e.useMyEvent=!0,e._unbindList=[],e._customCanvas=null,e._viewerContainer=null,e._postfix=t,e._viewerContainer=i,e}h(t,a);var e=t.prototype;return e.uiEventInit=function(){var i=this,n=function n(t){var e,t="#"+t+i._postfix;return null==(e=i._viewerContainer)||null==(e=e.el)?void 0:e.querySelector(t)},t=w,e=A,s=F,r=("ontouchend"in document.documentElement&&(e=V,s=Y),this._unbindList),o=_(window,Q,function(e,i){var n=this,s=0,r=null;return function(){var t=+new Date;t-s<i?(clearTimeout(r),r=setTimeout(function(){s=t,e.apply(n)},i)):(s=t,e.apply(n))}}.call(this,this._viewerResize,40)),e=(r.push(o),o=_(window,"load",function(t){i._viewerResize(t)}),r.push(o),o=_(document,e,function(t){i._documentMouseMove(t)}),r.push(o),o=_(document,s,function(t){i._documentMouseUp(t)}),r.push(o),o=_(window,"message",function(t){"up"===t.data.type&&i._documentMouseUp()}),r.push(o),o=_(document,w,function(t){i._documentClick(t)}),r.push(o),o=_(document,"keydown",function(t){a.prototype._emit.call(i,ie,t)}),r.push(o),o=_(document,"keyup",function(t){a.prototype._emit.call(i,ne,t)}),r.push(o),this._viewerContainer.el),s=(o=_(e,"dragstart",function(){return!1}),r.push(o),o=_(e,t,function(t){i._viewerClick(t)}),r.push(o),o=_(e,H,function(t){i._viewerRightClick(t)}),r.push(o),o=_(e,"dragover",function(t){P(t)}),r.push(o),o=_(e,"drop",function(t){i._dropFile(t)}),r.push(o),o=_(n("navChange"),t,function(t){i._setSelectedSidetype(t)}),r.push(o),o=_(n("besides"),t,function(t){i._sidebarClick(t)}),r.push(o),o=_(n("stretchBar"),X,function(t){i._sidebarStretchStart(t)}),r.push(o),o=_(n("defaultTag"),t,function(){i._openDefaultTag()}),r.push(o),o=_(n("treeLists"),t,function(t){i._fileListClick(t)}),r.push(o),o=_(n("treeLists"),H,function(t){i._fileListRightClick(t)}),r.push(o),o=_(n("treeLists"),"keyup",function(t){i._fileListKeyUp(t)}),r.push(o),o=_(n("addFolder"),w,function(t){i._addNewFolder(t)}),r.push(o),o=_(n("tagLists"),t,function(t){i._tagListClick(t)}),r.push(o),o=_(n("tagLists"),H,function(t){i._tagListRightClick(t)}),r.push(o),o=_(n("tagLists"),"keyup",function(t){i._tagListKeyUp(t)}),r.push(o),o=_(n("addTag"),t,function(t){i._addNewTag(t)}),r.push(o),n("canvasEventLayer")),e=(o=_(s,"touchstart",function(t){i._canvasTouchStart(t)},{passive:!1}),r.push(o),o=_(s,"mousedown",function(t){i._canvasMouseDown(t)}),r.push(o),o=_(s,"touchmove",function(t){i._canvasTouchMove(t)},{passive:!1}),r.push(o),o=_(s,"mousemove",function(t){i._canvasMouseMove(t)}),r.push(o),o=_(s,"touchend",function(t){i._canvasTouchEnd(t)}),r.push(o),o=_(s,"mouseup",function(t){i._canvasMouseUp(t)}),r.push(o),o=_(s,"wheel",function(t){i._canvasWheel(t)},{passive:!1}),r.push(o),o=_(s,"click",function(t){v(t)}),r.push(o),new De(n("canvasEventLayer")));e.onClick=function(t){a.prototype._emit.call(i,At,t)},e.onRightClick=function(t){a.prototype._emit.call(i,Ht,t)},e.onDoubleClick=function(t){a.prototype._emit.call(i,Ft,t)},e.onPointOver=function(t){a.prototype._emit.call(i,Wt,t)},e.onPointOut=function(t){a.prototype._emit.call(i,Vt,t)},this._customCanvas=e,e=null,o=_(n("canvasScroll"),"scroll",function(t){i._canvasScroll(t)}),r.push(o),o=_(n("tabList"),t,function(t){i._tabListClick(t)}),r.push(o),o=_(n("pagerInput"),"blur",function(t){i._pagerBlur(t)}),r.push(o),o=_(n("pagerInput"),"keyup",function(t){13===t.keyCode&&t.target.blur()}),r.push(o)},e.unbindEvents=function(){this._unbindList.forEach(function(t){l(t)&&t()}),this._unbindList=[],this._customCanvas&&(this._customCanvas.dispose(),this._customCanvas=null)},e._viewerResize=function(t){a.prototype._emit.call(this,k,t)},e._documentMouseUp=function(t){a.prototype._emit.call(this,B,t),a.prototype._emit.call(this,St,t),a.prototype._emit.call(this,mt,t)},e._documentMouseMove=function(t){a.prototype._emit.call(this,M,t),a.prototype._emit.call(this,It,t),a.prototype._emit.call(this,gt,t)},e._documentClick=function(t){a.prototype._emit.call(this,se,t),a.prototype._emit.call(this,bt,t)},e._viewerClick=function(t){a.prototype._emit.call(this,$t,t)},e._viewerRightClick=function(t){P(t),a.prototype._emit.call(this,Jt,t)},e._viewerMove=function(t){a.prototype._emit.call(this,Zt,t)},e._dropFile=function(t){P(t),a.prototype._emit.call(this,wt,t)},e._setSelectedSidetype=function(t){},e._sidebarClick=function(t){v(t),a.prototype._emit.call(this,re),a.prototype._emit.call(this,yt)},e._sidebarStretchStart=function(t){a.prototype._emit.call(this,oe,t)},e._openDefaultTag=function(){a.prototype._emit.call(this,be)},e._fileListClick=function(t){a.prototype._emit.call(this,ae,t),a.prototype._emit.call(this,ut,t)},e._fileListRightClick=function(t){a.prototype._emit.call(this,le,t),a.prototype._emit.call(this,ct,t)},e._fileListKeyUp=function(t){a.prototype._emit.call(this,he,t),a.prototype._emit.call(this,ht,t)},e._addNewFolder=function(t){a.prototype._emit.call(this,ue,t)},e._tagListClick=function(t){a.prototype._emit.call(this,_e,t),a.prototype._emit.call(this,_t,t)},e._tagListRightClick=function(t){a.prototype._emit.call(this,pe,t),a.prototype._emit.call(this,pt,t)},e._tagListKeyUp=function(t){a.prototype._emit.call(this,fe,t),a.prototype._emit.call(this,dt,t)},e._addNewTag=function(t){a.prototype._emit.call(this,ve,t)},e._canvasTouchStart=function(t){a.prototype._emit.call(this,Et,t)},e._canvasTouchMove=function(t){a.prototype._emit.call(this,Ut,t)},e._canvasTouchEnd=function(t){a.prototype._emit.call(this,zt,t)},e._canvasMouseDown=function(t){a.prototype._emit.call(this,Dt,t)},e._canvasMouseMove=function(t){a.prototype._emit.call(this,Nt,t)},e._canvasMouseUp=function(t){a.prototype._emit.call(this,Ot,t)},e._canvasWheel=function(t){a.prototype._emit.call(this,Yt,t)},e._canvasScroll=function(t){a.prototype._emit.call(this,Xt,t)},e._tabListClick=function(t){a.prototype._emit.call(this,Re,t)},e._pagerBlur=function(t){a.prototype._emit.call(this,ke,t)},e.dispose=function(){a.prototype.dispose.call(this),this.unbindEvents()},t}(E),t=function(){function t(t,e,i){this._pubsub=null,this.element=null,this.containerEl=null,this.location="",this.visibility=!0,this.cssStyle="",this.tagName="div",this.name="",this._postfix=t,this._pubsub=i,this.element=this._createElement(e)}var e=t.prototype;return e.bindElement=function(t,e){e=this._createElement(e);return this.containerEl=t,!!e&&(t.appendChild(e),!0)},e.setAttributes=function(t){return!!o(t)&&(this._initConfig(t),this._updateAttributes(),!0)},e._createElement=function(t){this.element&&(null!=(i=this.containerEl)&&null!=(e=i.removeChild)&&e.call(i,this.element),this.element=null),this._initConfig(t);var e,i=document.createElement(this.tagName);return this._updateAttributes(i),i},e._initConfig=function(t){if(!o(t))return!1;for(var e in t)t[e]!==undefined&&(this[e]=t[e]);return!0},e._updateAttributes=function(t){return!!(t=r(t)?t:this.element)&&(t.className=this.visibility?"":" dvs-disabled",this.name&&t.classList.add("dvs-"+this.name),this.cssStyle&&t.classList.add(this.cssStyle),this.name&&(t.id="".concat(this.name+this._postfix)),this.sequence!==undefined&&("string"==typeof(t=null==(t=t)?void 0:t.style).msFlexOrder?t.msFlexOrder=this.sequence:t.order=this.sequence),!0)},t}(),U=function(n){function t(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return n.call.apply(n,[this].concat(e))||this}return h(t,n),t}(t),We=function(n){function t(t,e,i){t=n.call(this,t,e,i)||this;return t.groups={},t}return h(t,n),t}(t),Ve=function(n){function t(t,e,i){t=n.call(this,t,e,i)||this;return t.buttons={},t._setGroupClass(),t}return h(t,n),t.prototype._setGroupClass=function(){var t;null!=(t=this.element)&&t.classList.add("dvs-groupType")},t}(t),z=function(n){function t(t,e,i){t=n.call(this,t,e,i)||this;return t.onButtonClick="",t.iconClass="",t.text="",t.title="",t}return h(t,n),t.prototype._updateAttributes=function(t){var e=this;if(!(t=r(t)?t:this.element))return!1;t.className="ds-dvs-ui-iconfont dvs-".concat(this.name," ").concat(this.cssStyle||""," ").concat(this.iconClass||""," ").concat(this.visibility?"":"dvs-nodisplay").trim(),t.id="".concat(this.name+this._postfix),this.text&&u(this.text)&&("input"===this.tagName?t.value=this.text||"":((i=document.createElement("span")).innerText=this.text||"",t.appendChild(i)));var i=null==(i=t)?void 0:i.style;return"string"==typeof i.msFlexOrder?i.msFlexOrder=this.sequence:i.order=this.sequence,this.title&&(t.title=this.title),this.onButtonClick?t.onclick=function(t){e.onButtonClick&&e._pubsub.emit(Ee,e.onButtonClick,t)}:t.onclick=null,!0},t}(t),Ye=function(){function t(t){var e=t.el,i=t.sequence,n=t.isFull,s=t.pubsub,t=t.container;this.uid="",this.element=null,this.sequence=0,this.isFull=!1,this._visibility=!0,this.uid=g(11),this.element=e,this.sequence=i,this._pubsub=s,this.isFull=n,this._container=t,this._bindElement()}var e=t.prototype;return e.show=function(){var t;return!this._visibility&&(this._visibility=!0,null!=(t=this.element)&&null!=(t=t.classList)&&t.remove("dvs-nodisplay"),this._pubsub.emit(k),!0)},e.hide=function(){var t;return!!this._visibility&&(this._visibility=!1,null!=(t=this.element)&&null!=(t=t.classList)&&t.add("dvs-nodisplay"),this._pubsub.emit(k),!0)},e.dispose=function(){var t,e;for(e in null==(t=this.element)||null!=(t=t.parentNode)&&t.removeChild(this.element),this._pubsub.emit(k),this)delete this[e];return!0},e._bindElement=function(){var t=this._container;if(!t)return!1;var e=this.element;this.isFull?e.classList.add("dvs-upper-full"):e.classList.remove("dvs-upper-full"),e.style.order=String(this.sequence),e.style.msFlexOrder=String(this.sequence),e.classList.add("dvs-customElement"),this._visibility||e.classList.add("dvs-nodisplay"),t.appendChild(e),this._container=null,this._pubsub.emit(k)},t}(),Xe=function(s){function t(t){var e=t.postfix,i=t.container,n=t.uiConfig,t=t.pubsub,t=s.call(this,t)||this;return t._postfix="",t.uiConfig=null,t._assembledConfig={},t._customElements={},t.contentContainer=null,t.viewerContainer=null,t._postfix=e,t.uiConfig=n,t.viewerContainer={el:t.initUi(i)},t}h(t,s);var e=t.prototype;return e._myQueryById=function(t){var e;return null==(e=this.viewerContainer)||null==(e=e.el)?void 0:e.querySelector("#"+t)},e.initUi=function(t,e){if(e){if(!o(e))return null;b(e,this.uiConfig)}if(!r(t=u(t)?document.getElementById(t):t))return null;e=this._assembleConfig(this.uiConfig),this._assembledConfig=e,e=new U(this._postfix,{name:"WebViewer"});return this._createContainers({header:{},body:{sidebar:{},showImageArea:{content:{topMenu:{},tabList:{},middle:{asideMenu:{},container:{viewPort:{canvasWrapper:{canvasEventLayer:{},loadingLayer:{loadingImage:"img"}},canvasScroll:{scrollInner:{}}},videoContainer:{videoImage:"img"},innerThumbnail:{}}},bottomMenu:{}}}},hiddenBox:{}},e.element),t.appendChild(e.element),e.element},e._createContainers=function(t,e){for(var i in t){var n,s=null,r=t[i];(s="sidebar"===i?this._initSidebar():"hiddenBox"===i?this._initHiddenBox():this._assembledConfig[i]?null==(n=this._initToolbarItem(this._assembledConfig[i]))?void 0:n.element:new U(this._postfix,{name:i,tagName:u(r)?r:undefined,visibility:this.uiConfig.toolbars[i]===undefined||this.uiConfig.toolbars[i]}).element)&&(o(t[i])&&this._createContainers(r,s),e.appendChild(s))}return!0},e._initToolbarItem=function(t){if(!t.visibility)return null;var e,i=new We(this._postfix,t,this._oPub);for(e in t.groups){var n=t.groups[e],n=(n.name||(n.name=e),this._initGroupItem(n));n&&i.element.appendChild(n.element)}return i},e._initGroupItem=function(t){if(!1===t.visibility)return null;t.visibility=!0;var e,i=new Ve(this._postfix,t,this._oPub);for(e in t.buttons){var n=t.buttons[e],n=(n.name||(n.name=e),this._initButtonItem(n));n&&n.forEach(function(t){i.element.appendChild(t.element)})}var s=new z(this._postfix,{name:"showBefore",visibility:!0,location:i.name,tagName:"SPAN",iconClass:"ds-dvs-ui-move_right dvs-nodisplay"},this._oPub),r=new z(this._postfix,{name:"showAfter",visibility:!0,location:i.name,tagName:"SPAN",iconClass:"ds-dvs-ui-move_left dvs-nodisplay"},this._oPub);return i.element.appendChild(s.element),i.element.appendChild(r.element),i},e._initButtonItem=function(e){var i,t,n,s=this;if(!1!==e.visibility)return e.visibility=!0,i=this.uiConfig.tipsConfig,"pagination"===e.name?(t=[{name:"pagerInput",sequence:e.sequence,tagName:"input",text:"0"},{name:"pageBreak",sequence:e.sequence,tagName:"p",text:""},{name:"pagerLabel",sequence:e.sequence,tagName:"label",text:"0"}],n=[],t.forEach(function(t){n.push(new z(s._postfix,{visibility:e.visibility,name:t.name,sequence:t.sequence,location:e.location,text:t.text||"",tagName:t.tagName,title:i[e.name]}))}),n):(f({title:i[e.name]},e),[new z(this._postfix,e,this._oPub)])},e._assembleConfig=function(t){var e,i,n,s,r={},o={},a=t.toolbars,l=t.groups,h=t.buttons;for(e in a){var u=Boolean(a[e]);r[e]={name:e,visibility:u,groups:(null==(u=a[e])?void 0:u.groups)||{}}}for(i in l)o[i]=l[i];for(n in h){var c,d=h[n],_=d.location,p=o[_];p?(p.buttons=p.buttons||{},b(((c={})[n]=d,c),p.buttons)):this._emit(Tt,{code:80024,message:"The group ".concat(_," is not exist.")})}for(s in o){var f,v=o[s],m=v.location,g=r[m];g?b(((f={})[s]=v,f),g.groups):this._emit(Tt,{code:80024,message:"The toolbar ".concat(m," is not exist.")})}return r},e._initSidebar=function(){var t=this.uiConfig,e=0,i=t.tree&&t.tree.visibility,n=t.tag&&t.tag.visibility;if(!i&&!n)return null;var s=new U(this._postfix,{name:"sidebar",visibility:t.showSidebar&&(i||n)}),r="",o='<ul id="navChange'.concat(this._postfix,'" class="dvs-navChange">'),a='<ul id="paneShow'.concat(this._postfix,'" class="dvs-paneShow">');return o+='<li id="DirctoryTreeNav'.concat(this._postfix,'" sidetype="tree" class="dvs-DirctoryTreeNav').concat(0===e?" dvs-activeTab":""," ").concat(i?"":"dvs-disabled",'">\n <div class="ds-dvs-ui-iconfont ').concat(t.tree.iconClass,'"></div>\n </li>'),a+='<li id="DirctoryTree'.concat(this._postfix,'" sidetype="tree" class="dvs-DirctoryTree').concat(e?" dvs-nodisplay":""," ").concat(i?"":"dvs-disabled",'">\n <ul id="treeLists').concat(this._postfix,'" class="dvs-treeLists"></ul>\n <div id=\'addFolderBox').concat(this._postfix,"' class='dvs-addFolderBox'>\n <div id='addFolder").concat(this._postfix,"' class='dvs-addFolder'>Add folder</div>\n </div>\n </li>\n "),i&&e++,o+='<li id="TagsNav'.concat(this._postfix,'" sidetype="tag" class="dvs-TagsNav').concat(0===e?" dvs-activeTab":""," ").concat(n?"":"dvs-disabled",' ">\n <div class="ds-dvs-ui-iconfont ').concat(t.tag.iconClass,'"></div>\n </li>'),a+='<li id="Tags'.concat(this._postfix,'" sidetype="tag" class="dvs-Tags').concat(e?" dvs-nodisplay":""," ").concat(n?"":"dvs-disabled",'">\n \n <ul id="tagLists').concat(this._postfix,'" class="dvs-tagLists"></ul>\n <div id=\'addTagBox').concat(this._postfix,"' class='dvs-addTagBox'>\n <div id='addTag").concat(this._postfix,"' class='dvs-addTag'>Add tag</div>\n </div>\n </li>"),n&&e++,r=(r+=(o+="</ul>")+(a+="</ul>"))+'<div id="stretchBar'.concat(this._postfix,'" class="dvs-stretchBar"></div>'),s.element.innerHTML=r,s.element},e._initHiddenBox=function(){this.uiConfig;return new U(this._postfix,{name:"hiddenBox"}).element},e.bindContent=function(t){var e=this._myQueryById("content"+this._postfix),i=this._myQueryById("header"+this._postfix);if(!t||!i||!e)return!1;var n=document.createElement("div");return n.setAttribute("style","display:flex;flex-direction:column;width:100%;height:100%;"),n.id="contentContainer"+this._postfix,n.appendChild(i),n.appendChild(e),t.appendChild(n),this.contentContainer=n,!0},e.unbindContent=function(t){void 0===t&&(t=!1);var t=null==(t=this.viewerContainer)?void 0:t.el,e=this.contentContainer;if(!t||!e)return!1;var i=e.querySelector("#content"+this._postfix),n=e.querySelector("#header"+this._postfix),s=this._myQueryById("showImageArea"+this._postfix);return n&&L(n,t.children[0],t),s&&i&&s.appendChild(i),e&&e.parentNode&&e.parentNode.removeChild(e),!(this.contentContainer=null)},e.createCustomElement=function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=!1),!r(t=u(t)?document.getElementById(t):t))return null;t=new Ye({el:t,sequence:e,isFull:i,pubsub:this._oPub,container:this._myQueryById("container"+this._postfix)}),e=t.uid;return this._customElements[e]=t},e.removeAllCustomElements=function(){for(var t in this._customElements)this._customElements[t].element=null,this._customElements[t]=null;this._customElements=null},e.dispose=function(){s.prototype.dispose.call(this),this.uiConfig=null,this._assembledConfig=null;for(var t=Object.keys(this._customElements),e=0,i=t.length;e<i;e++){var n=t[e],n=this._customElements[n];n&&n.dispose(),n=null}this._customElements=null,this.contentContainer=null,this.viewerContainer&&(this.viewerContainer.el=null),this.viewerContainer=null},t}(E);function Ae(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Fe(t,e,i){e&&Ae(t.prototype,e),i&&Ae(t,i),Object.defineProperty(t,"prototype",{writable:!1})}var He=function(){function t(t,e){this.useWorker=!0,this.workers_archive=[],this.taskUid=null,this.useWorker=t,this.cores=2,this.workerBlobURL=e}var e=t.prototype;return e.resize=function(t,e,i,n,s,r){return this.useWorker?this.resizeWithWorker(t,e,i,n,s,r):this.resizeWithoutWorker(t,n,s,r)},e.resizeWithoutWorker=function(t,e,i,D){for(var n=t.width,s=t.height,r=(e=Math.round(e),s/(i=Math.round(i))),o=t.getContext("2d"),a=[],l=2*Math.ceil(s/this.cores/2),h=[],u=-1,c=0;c<this.cores;c++){var d,_=u+1;s<=_||(u=_+l-1,u=Math.min(u,s-1),d=l,d=Math.min(l,s-_),a[c]={},a[c].source=o.getImageData(0,_,n,l),a[c].target=!0,a[c].start_y=Math.ceil(_/r),a[c].height=d,_={width_source:n,height_source:a[c].height,width:e,height:Math.ceil(a[c].height/r),core:c,source:a[c].source.data.buffer||a[c].source.data},h[c]=_)}for(var p=h.length,f=[],v=0;v<p;v++){for(var m=h[v],O=m.core,g=m.width_source,b=m.height_source,y=m.width,w=m.height,x=g/y,C=b/w,N=Math.ceil(x/2),W=Math.ceil(C/2),S=new Uint8ClampedArray(m.source),m=(S.length,y*w*4),V=new ArrayBuffer(m),I=new Uint8ClampedArray(V,0,m),k=0;k<w;k++)for(var M=0;M<y;M++){for(var B=4*(M+k*y),T=0,P=0,Y=0,X=0,A=0,F=0,H=0,Q=k*C,q=Math.floor(M*x),j=Math.ceil((M+1)*x),K=Math.floor(k*C),G=Math.ceil((k+1)*C),j=Math.min(j,g),G=Math.min(G,b),R=K;R<G;R++)for(var $=Math.abs(Q-R)/W,J=M*x,Z=$*$,L=q;L<j;L++){var E=Math.abs(J-L)/N,E=Math.sqrt(Z+E*E);1<=E||(H+=(T=2*E*E*E-3*E*E+1)*S[3+(E=4*(L+R*g))],Y+=T,X+=(T=S[3+E]<255?T*S[3+E]/250:T)*S[E],A+=T*S[1+E],F+=T*S[2+E],P+=T)}I[B]=X/P,I[1+B]=A/P,I[2+B]=F/P,I[3+B]=H/Y}f.push({core:O,target:I})}for(var U=0;U<p;U++){var tt=f[U],et=Math.ceil(a[U].height/r);if(a[U].target=o.createImageData(e,et),a[U].target.data.set)a[U].target.data.set(tt.target);else for(var it=a[U].target.data.length,z=0;z<it;z++)a[U].target.data[z]=tt.target[z]}return Promise.resolve(a)},e.resizeWithWorker=function(t,e,i,l,n,s){for(var h=this,r=Math.floor(e),o=Math.floor(i),a=(l=Math.round(l),o/(n=Math.round(n))),u=t.getContext("2d"),c=[],d=2*Math.ceil(o/this.cores/2),_=-1,p=0;p<this.cores;p++){var f,v,m=_+1;o<=m||(_=m+d-1,_=Math.min(_,o-1),f=d,f=Math.min(d,o-m),c[p]={},c[p].source=u.getImageData(0,m,r,d),c[p].target=!0,v=Math.ceil(m/a),c[p].start_y=v,c[p].height=f,c[p].height_part=Math.ceil((m+f)/a)-v)}t=u=null;for(var g=[],b=function b(t){if(c[t]==undefined)return"continue";var a=new Worker(h.workerBlobURL),e=new Promise(function(r,o){a.onmessage=function(t){a.terminate(),a.onmessage=null,a.onerror=null,a=null,t.data.taskUid!==h.taskUid&&o(!1);var e=t.data.core,i=c[e].height_part;if(c[e].target=document.createElement("canvas").getContext("2d").createImageData(l,i),c[e].target.data.set)c[e].target.data.set(t.data.target);else for(var n=c[e].target.data.length,s=0;s<n;s++)c[e].target.data[s]=t.data.target[s];r(e)},a.onerror=function(t){a.terminate(),a.onmessage=null,a.onerror=null,a=null,o(t)}}),e=(g.push(e),{width_source:r,height_source:c[t].height,width:l,height:c[t].height_part,core:t,source:c[t].source.data.buffer||c[t].source.data,taskUid:s});try{a.postMessage(e,[e.source])}catch(i){a.postMessage(e)}},y=0;y<this.cores;y++)b(y);return Promise.all(g).then(function(t){return Promise.resolve(c)}).catch(function(t){return Promise.reject(t)})},t}(),Qe=function(_){function t(t,e,i,n,s,r,o){e=_.call(this,e)||this;return e._canvasItem=null,e.renderImg=null,e.imgSrc=null,e.uid="",e.tags=[],e.optimization=!1,e._dataStore=null,e._showPageNumber=!1,e._showCheckbox=!1,e._currentPage=-1,e._isSelected=!1,e.currentPage=-1,e.isSelected=!1,e._latestState={currentPage:-1,_showPageNumber:!1,_showCheckbox:!1,isSelected:!1,checkbox:{},pageNumber:{}},e.allowCrossOrigin=!0,e.fitRatio=0,e._canvasWidth=0,e._canvasHeight=0,e._rectArr=[],e.checkbox={visibility:"hidden",width:"",height:"",minWidth:0,maxWidth:1e4,minHeight:0,maxHeight:1e4,background:"#fff",borderWidth:0,borderRadius:0,borderColor:"#000",opacity:1,left:0,top:0,right:"",bottom:"",checkMarkColor:"#000",checkMarkLineWidth:1,lineCap:"butt",lineJoin:"miter"},e.pageNumber={visibility:"hidden",width:"",height:"",minWidth:0,maxWidth:1e4,minHeight:0,maxHeight:1e4,background:"#fff",borderWidth:0,borderRadius:0,borderColor:"#000",opacity:1,color:"#000",fontSize:12,fontFamily:"sans-serif",textAlign:"center",textBaseline:"middle",left:"",top:"",right:"",bottom:""},e.workBlobURL=null,e.optimizeImage=!0,e.workerTimer=null,e.workBlobURL=r,e.hermite=new He(!0,e.workBlobURL),e.optimizeImage=o,document.documentMode===undefined&&!c()||(e.optimizeImage=!1),e._dataStore=i,t&&e.init(t),e.updateCheckboxConfig(n),e.updatePageNumberConfig(s),e}h(t,_);var e=t.prototype;return e.setOptimizeImage=function(t){this.optimizeImage!==t&&(this.optimizeImage=t)},e.updateCheckboxConfig=function(t){Object.assign(this.checkbox,t)},e.updatePageNumberConfig=function(t){Object.assign(this.pageNumber,t)},e.init=function(t){for(var e in t)e!==undefined&&t[e]&&(this[e]=t[e]);this.renderImg=null},e.updateData=function(t){var e=t.data,i=t.tags,t=t.optimization;e!==this.imgSrc&&(this.imgSrc=e,this.renderImg&&(this.renderImg.onload=null),this.renderImg=null,this.tags=i,this.optimization=t)},e.emptyPage=function(){this.renderImg&&(this.renderImg.onload=null),this.renderImg=null,this._canvasItem&&(this._canvasItem.width=1,this._canvasItem.height=1,this._canvasItem.getContext("2d").clearRect(0,0,1,1),this._canvasItem.width=0,this._canvasItem.height=0)},e.dispose=function(){_.prototype.dispose.call(this),this.emptyPage(),this.imgSrc=null,this._canvasItem=null},e.render=function(t){var e=this;if(void 0===t&&(t=!0),!this._canvasItem||this._canvasItem.clientWidth<=0||this._canvasItem.clientHeight<=0)return!1;if(this.renderImg)this.renderImg.complete&&(this.renderImg.onload=null,this._renderImage(t));else{if(!this.imgSrc)return this._clearCanvas(),!1;var i=this.renderImg||new Image,n=(this.allowCrossOrigin&&(i.crossOrigin="anonymous"),this.width),s=this.height,r=this.dpr,o=this._dataStore.getMid(this.uid),a=o.tempWidth,o=o.tempHeight;a&&o&&(r=Math.min(n/r/a,s/r/o,1),n=Math.floor(r*a),s=Math.floor(r*o)),i.src=this.imgSrc,i.onload=function(){e._renderImage(t),i.onload=null},this.renderImg=i}},e._renderImage=function(t){var r,e,o,a,l,h,u=this,c=(void 0===t&&(t=!0),this.renderImg),d=this._canvasItem;c&&d&&((r=d.getContext("2d"))&&(e=this._calDrawImagePos(c),o=e.left,a=e.top,l=e.width,h=e.height,r.save(),r.clearRect(0,0,d.width,d.height),r.drawImage(c,o,a,l,h),r.restore(),this._renderPageNumber(),this._renderCheckbox(),this.drawRect(),this.workerTimer&&clearTimeout(this.workerTimer),this.optimizeImage&&this.hermite&&(this.workerTimer=setTimeout(function(){var t=document.createElement("canvas"),e=(t.id="optimizeMinImage_".concat(u.uid),t.getContext("2d")),i=c.naturalWidth,n=c.naturalHeight,s=g(11);t.width=i,t.height=n,e.drawImage(c,0,0),u.hermite.taskUid=s,u.hermite.resize(t,i,n,l,h,s).then(function(t){r.save(),r.clearRect(0,0,d.width,d.height),t.forEach(function(t){var e=Math.round(o),i=Math.round(t.start_y+a);r.putImageData(t.target,e,i)}),r.restore(),u._renderPageNumber(),u._renderCheckbox(),u.drawRect()}).catch(function(t){})},100)),t&&_.prototype._emit.call(this,S,this._currentPage-1)))},e._calDrawImagePos=function(t){var e=t.naturalWidth,t=t.naturalHeight,i={left:0,top:0,width:0,height:0};if(this.width<=0||this.height<=0)return i;var n,s,r,o,a=this.dpr;return this.optimization||(s=this.width,r=this.height,null!=(n=this._dataStore.getMid(this.uid))&&n.tempWidth&&null!=n&&n.tempHeight&&(o=Math.min(s/a/n.tempWidth,r/a/n.tempHeight,1),s=Math.floor(o*n.tempWidth),r=Math.floor(o*n.tempHeight)),o=Math.max(e/s,t/r),e/=this.fitRatio=o,t/=o),i={left:Math.floor((this.width-e*a)/2),top:Math.floor((this.height-t*a)/2),width:Math.floor(e*a),height:Math.floor(t*a)}},e._renderPageNumber=function(){var t=this.renderImg,e=this._canvasItem,i=this.pageNumber;t&&e&&"visible"===i.visibility&&(t=this._normalizeStyle(i),(e=e.getContext("2d")).save(),e.globalAlpha=i.opacity,this._renderOutlinePath(e,t,"out"),e.clip(),this._renderOutlinePath(e,t,"in"),this._renderBackground(e,i),this._renderOutlinePath(e,t,"center"),this._renderBorder(e,t,i),this._renderText(String(this._currentPage),e,t,i),e.restore())},e._renderCheckbox=function(){var t=this.renderImg,e=this._canvasItem,i=this.checkbox;t&&e&&"visible"===i.visibility&&(t=this._normalizeStyle(i),(e=e.getContext("2d")).save(),e.globalAlpha=i.opacity,this._renderOutlinePath(e,t,"out"),e.clip(),this._renderOutlinePath(e,t,"in"),this._renderBackground(e,i),this._renderOutlinePath(e,t,"center"),this._renderBorder(e,t,i),this._isSelected&&this._renderCheckMark(e,t,i),e.restore())},e._normalizeStyle=function(t){var e=this.width,i=this.height,n=t.width,s=t.height,r=t.left,o=t.top,a=t.right,l=t.bottom,h=t.translateX,u=t.translateY,c=t.borderRadius,d=t.borderWidth,_=t.fontSize,t=t.checkMarkLineWidth,e=(p(d=this._normalizeToPixel(d,0))||(d=0),_!==undefined&&p(_=this._normalizeToPixel(_,0))||(_=0),t!==undefined&&p(t=this._normalizeToPixel(t,0))||(t=0),n=this._normalizeToPixel(n,e),s=this._normalizeToPixel(s,i),r=this._normalizeToPixel(r,e),o=this._normalizeToPixel(o,i),a=this._normalizeToPixel(a,e),l=this._normalizeToPixel(l,i),(n=p(n)?n:p(r)&&p(a)?e-r-a:0)<2*d&&(n=2*d),(s=p(s)?s:p(l)&&p(o)?i-o-l:0)<2*d&&(s=2*d),p(a)&&!p(r)&&(r=e-n-a),p(l)&&!p(o)&&(o=i-s-l),p(r)||(r=0),p(o)||(o=0),h=this._normalizeToPixel(h,n),u=this._normalizeToPixel(u,s),p(h)&&(r+=h),p(u)&&(o+=u),this._normalizeToPixel(c,n)),a=this._normalizeToPixel(c,s);return p(e)&&p(a)?(e=Math.max(0,Math.min(e,n/2)),a=Math.max(0,Math.min(a,s/2)),p(c)&&(a=e=Math.min(e,a))):a=e=0,{left:r,top:o,width:n,height:s,borderRadiusX:e,borderRadiusY:a,borderWidth:d,fontSize:_,checkMarkLineWidth:t}},e._normalizeToPixel=function(t,e){if(p(t))return t*this.dpr;if(u(t)){if(!(t=t.trim()).length)return t;var i=t.match(/^-?\d+\.?\d?%$/);if(i)return parseFloat(i[0])/100*e;i=t.match(/^-?\d+\.?\d?px$/);if(i)return parseFloat(i[0])*this.dpr}return""},e._renderText=function(t,e,i,n){var s=i.left,r=i.top,o=i.width,a=i.height,i=i.fontSize,l=n.color,h=n.fontFamily,u=n.textAlign,n=n.textBaseline;e.textAlign=u,e.textBaseline=n,e.fillStyle=l,e.font="".concat(i,"px ").concat(h),e.fillText(t,s+o/2,r+a/2+i/8,o)},e._renderCheckMark=function(t,e,i){var n=e.left,s=e.top,r=e.width,o=e.height,a=e.borderWidth,e=e.checkMarkLineWidth,l=i.checkMarkColor,h=i.lineCap,i=i.lineJoin,u=Math.max(Math.min(r-2*a,o-2*a),0);0!==u&&(r<o?(n+=a,s=s+a+(o-r)/2):(n=n+a+(r-o)/2,s+=a),t.beginPath(),t.moveTo(n+.15*u,s+.5*u),t.lineTo(n+.4*u,s+.8*u),t.lineTo(n+.85*u,s+.2*u),t.lineCap=h,t.lineJoin=i,t.lineWidth=e,t.strokeStyle=l,t.stroke())},e._renderBackground=function(t,e){e=e.background;e&&(t.fillStyle=e,t.fill())},e._renderOutlinePath=function(t,e,i){var n=e.left,s=e.top,r=e.width,o=e.height,a=e.borderWidth,l=e.borderRadiusX,e=e.borderRadiusY,h=0,u=("center"===(i=void 0===i?"out":i)?h=a/2:"in"===i&&(h=a),[{x:n+l,y:s+e,start:Math.PI,end:3*Math.PI/2},{x:n+r-l,y:s+e,start:3*Math.PI/2,end:2*Math.PI},{x:n+r-l,y:s+o-e,start:0,end:Math.PI/2},{x:n+l,y:s+o-e,start:Math.PI/2,end:Math.PI}]),c=Math.max(l-h,0),d=Math.max(e-h,0);if(t.beginPath(),t.ellipse)for(var _=0;_<4;_++){var p=u[_],f=p.x,v=p.y,m=p.start,p=p.end;t.ellipse(f,v,c,d,0,m,p)}else t.rect(n,s,r,o);t.closePath()},e._renderBorder=function(t,e,i){i=i.borderColor,e=e.borderWidth;e&&(t.strokeStyle=i,t.lineWidth=e,t.stroke())},e._clearCanvas=function(){var t;!this._canvasItem||(t=this._canvasItem.getContext("2d"))&&t.clearRect(0,0,this._canvasItem.width,this._canvasItem.height)},e.setLatestState=function(t){this._latestState=t},e._setCanvasWidth=function(t){this._canvasItem&&(this._canvasWidth=t,this._canvasItem.width=t)},e._setCanvasHeight=function(t){this._canvasItem&&(this._canvasHeight=t,this._canvasItem.height=t)},e.resizeCanvasSize=function(t){void 0===t&&(t=!1);var e=this._canvasItem;if(!e||!this.renderImg&&!this.imgSrc)return!1;var i,n=e.clientWidth*this.dpr,e=e.clientHeight*this.dpr;return!(n<=0||e<=0)&&(i=this._checkIfRenderPageOrBox(),!(Math.abs(n-this.width)<=2&&Math.abs(e-this.height)<=2&&this.renderImg&&!i)&&(this.width!==n&&(this.width=n),this.height!==e&&(this.height=e),t&&-1===this.imgSrc.indexOf("blob:")&&(this.renderImg=null),void this.render()))},e._checkIfRenderPageOrBox=function(){var t,e=!1;for(t in this._latestState){var i=this["_"+t],n=this._latestState[t];if(!this.isEqual(i,n))switch(this["_"+t]=n,t){case"currentPage":"visible"===this.pageNumber.visibility&&(e=!0);break;case"isSelected":"visible"===this.checkbox.visibility&&(e=!0);break;default:e=!0}}return e},e.isEqual=function(t,e){if(o(t)){if(!o(e))return!1;for(var i=Object.keys(e),n=0,s=i.length;n<s;n++){var r=i[n];if(t[r]!==e[r])return!1}return!0}return t===e},e.setRect=function(t){this._rectArr=t},e.drawRect=function(){var t=this._rectArr;if(0!==t.length&&this.renderImg){var e=this._dataStore.getMid(this.uid);if(null!=e&&e.tempWidth&&null!=e&&e.tempHeight&&this._canvasItem)for(var i=this._canvasItem.getContext("2d"),n=this.dpr,s=e.tempWidth/this.renderImg.naturalWidth,r=0;r<t.length;r++){for(var o=t[r],a=o.cropBoxStyle,l=a.ctrlBorderWidth,h=a.ctrlBackground,u=a.ctrlBorderColor,c=a.ctrlBorderRadius,d=a.ctrlWidth,_=a.ctrlHeight,p=a.borderColor,f=a.borderWidth,v=a.invalidBorderColor,m=a.invalidCtrlBorderColor,g=a.background,b=a.dashLine,a=a.enableConcaveBorderColor,y=o.probePoints.slice(0,8),w=o.midpoints.slice(0,8),x=0;x<4;x++){var C=this._transformRect(y[2*x]/s,y[2*x+1]/s),S=this._transformRect(w[2*x]/s,w[2*x+1]/s);y[2*x]=C.x,y[2*x+1]=C.y,w[2*x]=S.x,w[2*x+1]=S.y}i.save();try{i.setLineDash(b.map(function(t){return t*n}))}catch(B){}i.fillStyle=g,i.lineWidth=f*n,a&&!o.isConvex?i.strokeStyle=v:i.strokeStyle=p,i.beginPath(),i.moveTo(y[0],y[1]),i.lineTo(y[2],y[3]),i.lineTo(y[4],y[5]),i.lineTo(y[6],y[7]),i.closePath(),i.stroke(),i.restore(),i.lineWidth=l*n,i.fillStyle=h,a&&!o.isConvex?i.strokeStyle=m:i.strokeStyle=u;for(var I=Math.min(c,d/2)*n,k=Math.min(c,_/2)*n,M=0;M<4;M++)this._drawRoundedRectangle(i,{x:y[2*M],y:y[2*M+1],width:d*n,height:_*n,radiusX:I,radiusY:k}),i.stroke(),""!==h&&i.fill(),this._drawRoundedRectangle(i,{x:w[2*M],y:w[2*M+1],width:d*n,height:_*n,radiusX:I,radiusY:k}),i.stroke(),""!==h&&i.fill()}}},e._transformRect=function(t,e){var i=this.renderImg,n=i.naturalWidth,i=i.naturalHeight,s=this.fitRatio;return{x:this.width/2+(t-n/2)/s*this.dpr,y:this.height/2+(e-i/2)/s*this.dpr}},e._drawRoundedRectangle=function(t,e){var i=e.width,n=e.height,s=e.radiusX,r=e.radiusY,o=e.x,e=e.y,a=[{x:o-i/2+s,y:e-n/2+r,start:Math.PI,end:3*Math.PI/2},{x:o+i/2-s,y:e-n/2+r,start:3*Math.PI/2,end:2*Math.PI},{x:o+i/2-s,y:e+n/2-r,start:0,end:Math.PI/2},{x:o-i/2+s,y:e+n/2-r,start:Math.PI/2,end:Math.PI}];if(t.beginPath(),t.ellipse)for(var l=0;l<4;l++){var h=a[l];t.ellipse(h.x,h.y,s,r,0,h.start,h.end)}else t.rect(o-i/2,e-n/2,i,n);t.closePath()},Fe(t,[{key:"dpr",get:y},{key:"width",get:function(){return this._canvasItem?this._canvasItem.width:0},set:function(t){this._setCanvasWidth(t)}},{key:"height",get:function(){return this._canvasItem?this._canvasItem.height:0},set:function(t){this._setCanvasHeight(t)}}]),t}(E),D=function(){function t(t){void 0===t&&(t=[]),this.array=[],this.array=O(t)}var e=t.prototype;return e.add=function(t){return!~this.array.indexOf(t)&&(this.array.push(t),!0)},e.delete=function(t){t=this.array.indexOf(t);return-1<t&&(this.array.splice(t,1),!0)},e.concat=function(t){return O(this.array.concat(t))},e.equal=function(t){if(t.length!==this.array.length)return!1;if(!t.length)return!0;for(var e=0;e<this.array.length;e++)if(this.array[e]!==t[e])return!1;return!0},t}(),qe=function(o){function t(t,e,i,n,s,r){e=o.call(this,e)||this;return e.uid="",e._pubSub=null,e._viewerContainer=null,e._postfix="",e._thumbnailElement=null,e._dataStore=null,e.isInner=!1,e._iObserver=null,e._customThumbnailEvent=null,e._size=180,e._mouseShape="pointer",e._scrollDirection="vertical",e._sequence=0,e._location="horizontal",e._showThumbnail=!0,e._showPageNumber=!1,e._pageNumberConfig={},e._checkboxConfig={},e._optimizeImage=!0,e._showRemoveBtn=!1,e._fullThumbnail=!1,e._multipleMode=!1,e.allowPageDragging=!0,e._allowResizing=!1,e.allowHover=!0,e.allowKeyboardControl=!0,e.autoChangeIndex=!1,e.rows=1,e.columns=1,e._background="rgba(67,66,70,1)",e._border="1px solid rgba(27,27,29,1)",e._pageBackground="rgba(0,0,0,0)",e._pageBorder="1px solid rgba(128,128,128,1)",e._selectedPageBackground="rgba(127,133,251,1)",e._selectedPageBorder="1px solid rgba(255,0,0,1)",e.hoverPageBackground="rgba(196,250,248,1)",e.hoverPageBorder="1px solid rgba(255,255,0,1)",e.placeholderBackground="rgba(255,192,203,1)",e._pageMargin=10,e._pageMarginNumber=0,e._currentPageMargin=-1,e.isDrag=!1,e.ifDragMoves=!1,e._dragTimer=null,e._dragStart=!1,e.needClick=!0,e.thumbMoveOption={napX:0,napY:0,clickX:0,clickY:0,target:null},e._stretchItem=null,e._isStretching=!1,e._isCrop=!1,e._topImageIndex=-1,e._prtScrollOnce=!1,e._calculateTopIndex=-1,e._showUids=new D,e._showIndexes=new D,e._renderIndexes=new D,e._renderUids=new D,e._tempThumbnailSize={width:1,height:1},e._splitTimer=null,e.selectedIndexes=[],e.currentIndex=-1,e._thumbnailCanvas=[],e._uidTbCanvas={},e._eventList={},e._renderTimer=null,e.isDragUp=!1,e.cropBoxStyle={borderWidth:1,borderColor:"#000",invalidBorderColor:"#000",dashLine:[4,2],background:"",ctrlBorderWidth:1,ctrlBorderRadius:0,ctrlBorderColor:"#000",invalidCtrlBorderColor:"#000",ctrlBackground:"",ctrlWidth:8,ctrlHeight:8,enableConcaveBorderColor:!1},e.workBlobURL=null,e._viewerContainer=i,e._postfix=n,e._dataStore=s,e.workBlobURL=r,Object.assign(e.cropBoxStyle,t.cropBoxStyle||{}),e._thumbnailInit(t),e}h(t,o);var e=t.prototype;return e._thumbnailInit=function(t){this._initThumbnailUi(t.uid),this._initThumbnailConfig(t),this._initIntersectionObserver(),this._bindSelfEvents(),this._bindUiEvent()},e._initThumbnailConfig=function(t){for(var e in this._pubSub=new E(t.pubsub),t)"pubsub"!==(e=e.replace("canvas",""))&&(this[e]=t[e])},e._initThumbnailUi=function(t){var e=new U(t,{name:"Thumbnail"}),i="horizontal"===this.location?"":"dvs-nodisplay",n="vertical"===this.location?"":"dvs-nodisplay";e.element.innerHTML="\n <div id='stretchBarLeft".concat(t,"' class='dvs-stretchBar dvs-stretchLeft ").concat(i,"'></div>\n <div id='stretchBarTop").concat(t,"' class='dvs-stretchBar dvs-stretchTop ").concat(n,"'></div>\n <div id='stretchBarRight").concat(t,"' class='dvs-stretchBar dvs-stretchRight ").concat(i,"'></div>\n <div id='stretchBarBottom").concat(t,"' class='dvs-stretchBar dvs-stretchBottom ").concat(n,"'></div>\n <ul id=\"thumbLists").concat(t,'" class="dvs-thumbLists"></ul>\n '),this._thumbnailElement=e.element},e._initIntersectionObserver=function(){var t,e=this;window.IntersectionObserver&&this._thumbnailElement&&(t=new IntersectionObserver(function(t){e._handleObservePages(t)},{root:this._thumbnailElement.querySelector(".dvs-thumbLists")}),this._iObserver=t)},e._bindSelfEvents=function(){var t,e,i=this,n=((t={})[Ce]=this._updateProps,t[Se]=this.scrollTo,t[Ie]=this.setViewMode,t);for(e in this._eventList=n)this._pubSub._on(e,n[e].bind(this));o.prototype._on.call(this,M,this._documentMouseMove.bind(this)),o.prototype._on.call(this,B,this._documentMouseUp.bind(this)),o.prototype._on.call(this,ot,function(t){"remove"===t.action&&(i._prtScrollOnce=!0)})},e._bindUiEvent=function(){var t,i=this,e=this._thumbnailElement;e&&((t=new De(e)).onPointDown=function(t){i._thumbnailDragStart(t),i._thumbnailPointerDown(t)},t.onPointMove=function(t){i._thumbnailDragMove(t),i._thumbnailPointerMove(t)},t.onPointUp=function(t){i._thumbnailPointerUp(t)},t.onClick=function(t){i._thumbnailClick(t)},t.onRightClick=function(t){i._thumbnailRightClick(t)},t.onDoubleClick=function(t){i._thumbnailDoubleClick(t)},t.onPointOver=function(t){i._thumbnailMouseOver(t)},t.onPointOut=function(t){i._thumbnailMouseOut(t)},t.getTarget=function(t,e){return e!==undefined?i.getImageItem(e):i.getImageItem(t)},this._customThumbnailEvent=t,_(e.querySelector(".dvs-thumbLists"),"scroll",function(){i._thumbnailScroll()}),_(e,c()?"touchstart":"mousedown",function(t){i._thumbnailStretchStart(t)},{passive:!1}),_(e,"click",function(t){o.prototype._emit.call(i,xt,{viewerId:i._postfix.replace("-",""),thumbnailId:i.uid}),v(t)}))},e.unbindEvents=function(){var t;if(null!=(t=this._customThumbnailEvent)&&t.dispose(),this._customThumbnailEvent=null,this._pubSub)for(var e in this._eventList)this._pubSub._off(e)},e.unbindUi=function(){this.unbindEvents();var t,e=this._thumbnailCanvas;if(e)for(var i=0;i<e.length;i++){var n=e[i];n&&n.dispose()}this._thumbnailCanvas=null,this._viewerContainer=null,(this._stretchItem=null)!=(t=this._iObserver)&&t.disconnect(),(this._iObserver=null)!=(t=this._thumbnailElement)&&null!=(t=t.parentElement)&&t.removeChild(this._thumbnailElement),this._thumbnailElement=null},e.updateContent=function(t){this._patch(t=void 0===t?[]:t),this._updateElements(),this.renderCanvas()},e.updatePageItem=function(t){var e=this._thumbnailCanvas;if(e)for(var i=0;i<e.length;i++){var n=e[i];if(n.uid===t.uid){n.updateData(t),-1!==this._renderUids.array.indexOf(t.uid)&&n.resizeCanvasSize(this.isInner&&1===this.rows&&1===this.columns);break}}},e.renderCanvas=function(){var r=this;this._renderTimer&&clearTimeout(this._renderTimer),this._renderTimer=setTimeout(function(){if(r._thumbnailCanvas)for(var t=r.selectedIndexes,e=r._renderUids.array,i=r._thumbnailCanvas.length,n=0;n<i;n++){var s=r._thumbnailCanvas[n];-1<e.indexOf(s.uid)?(s.setLatestState({currentPage:n+1,isSelected:-1!==t.indexOf(n),showPageNumber:"visible"===r.pageNumber.visibility,showCheckbox:"visible"===r.checkbox.visibility,checkbox:Object.assign({},r.checkbox),pageNumber:Object.assign({},r.pageNumber)}),s.resizeCanvasSize(1===r.rows&&1===r.columns&&r.isInner)):null!=s&&s.emptyPage()}},100)},e.keydownCallBack=function(t){this.selectImageByKey(t),this._pubSub._emit(it,t)},e.keyupCallBack=function(t){this._pubSub._emit(nt,t)},e.selectImageByKey=function(t){if(this.allowKeyboardControl&&this._thumbnailCanvas.length){var e=this.selectedIndexes.slice().pop(),i=this.rows,n=this.columns,s="vertical"===this.scrollDirection,r=e;switch(t.key){case"ArrowUp":case"Up":if(s)r-=n;else{if(Math.floor((r-1)/i)!==Math.floor(r/i))return;r-=1}break;case"ArrowDown":case"Down":if(s)r+=n;else{if(Math.floor((r+1)/i)!==Math.floor(r/i))return;r+=1}break;case"ArrowLeft":case"Left":if(s){if(Math.floor((r-1)/n)!==Math.floor(r/n))return;r-=1}else r-=i;break;case"ArrowRight":case"Right":if(s){if(Math.floor((r+1)/n)!==Math.floor(r/n))return;r+=1}else r+=i;break;default:return}this._viewerEmit(Ue,r),P(t)}},e._updateElements=function(){var t=this._myQuery("thumbLists"+this.uid);if(!t)return!1;for(var e=0;e<t.children.length;e++){var i=t.children[e],n=this._thumbnailCanvas[e];n&&i&&(i["dvs-defaultIndex"]=e,i["dvs-tags"]=n.tags,i["dvs-uid"]=n.uid)}},e.handleInnerProp=function(t,e){t in this&&(this[t]=e)},e.setHoverColor=function(t){this.allowHover&&(t=this.getImageItem(t))&&!t.classList.contains("dvs-activeThumb")&&(t.style.background=this.hoverPageBackground,t.style.border=this.hoverPageBorder)},e.setImageColor=function(t){!this.allowHover||(t=this.getImageItem(t))&&(t.classList.contains("dvs-activeThumb")?(t.style.background=this.selectedPageBackground,t.style.border=this.selectedPageBorder):(t.style.background=this._pageBackground,t.style.border=this.pageBorder))},e._addNodes=function(n,t,e){var s=this,r=[],i=this._myQuery("thumbLists"+this.uid);if(i){for(var o=i.children[t],a=document.createDocumentFragment(),l=function l(t){var t=n[t],t=s._initNode(t),e=(r.push(t),document.createElement("li")),i=(e.style.background=s.pageBackground,e.style.border=s.pageBorder,document.createElement("canvas"));i.className="dvs-thumbnailCanvas",i.width=0,i.height=0,e.appendChild(i),t._canvasItem=i,s.isInner||((t=document.createElement("span")).className="dvs-thumbnail-remove",t.onclick=function(){var t=R(e);s._pubSub._emit(lt,t)},e.appendChild(t)),null!=(i=s._iObserver)&&i.observe(e),a.appendChild(e)},h=t;h<=e;h++)l(h);L(a,o,i),(o=this._thumbnailCanvas).splice.apply(o,[t,0].concat(r))}},e._removeNodes=function(t,e,i){var t=t.splice(e,i-e+1),n=this._myQuery("thumbLists"+this.uid);if(n&&n.children&&n.children.length){for(var s=e;s<=i;s++){var r,o=n.children[e];o&&(r=o["dvs-uid"],this._showUids.delete(r),this._renderUids.delete(r),this._getViewIndexesByUids(),null!=(r=this._iObserver)&&r.unobserve(o),n.removeChild(o))}t.forEach(function(t){return t.dispose()})}},e._patch=function(t){for(var e=this._thumbnailCanvas,i=0,n=e.length-1,s=0,r=t.length-1;i<=n&&s<=r;){var o=e[i],a=e[n],l=t[s],h=t[r];if(this._sameNode(o,l))++i,++s,o.updateData(l);else if(this._sameNode(a,h))--n,--r,a.updateData(h);else if(this._sameNode(o,h))o.updateData(h),this._moveNode(e,i,n);else if(this._sameNode(a,l))a.updateData(l),this._moveNode(e,n,i);else{for(var u=void 0,c=i;c<=n;c++)if(e[c].uid===(null==l?void 0:l.uid)){u=c;break}u!==undefined?(e[u].updateData(l),this._moveNode(e,u,i)):(this._addNodes(t,s,s),n++),++s,++i}}n<i?this._addNodes(t,s,r):r<s&&this._removeNodes(e,i,n)},e._sameNode=function(t,e){return(null==t?void 0:t.uid)===(null==e?void 0:e.uid)},e._moveNode=function(t,e,i){var n=t.splice(e,1)[0],n=(t.splice(i,0,n),this._myQuery("thumbLists"+this.uid)),t=n.removeChild(n.children[e]);t&&L(t,n.children[i],n)},e._initNode=function(t,e){t={uid:t.uid,imgSrc:t.data,tags:t.tags};if(!e)return new Qe(t,this._pubSub.getPublishSubscribe(),this._dataStore,this.checkbox,this.pageNumber,this.workBlobURL,this.optimizeImage);e.init(t)},e.selectThumbnailByIndexes=function(t){a(t)?this.selectedIndexes=t:t=this.selectedIndexes,this.clearAbsolute(),this._updateSelectedPageStyle(),!this.showPageNumber&&"visible"!==this.checkbox.visibility||this.renderCanvas()},e._updateSelectedPageStyle=function(){var t=this._myQuery("thumbLists"+this.uid);if(!t)return!1;var e=this.selectedIndexes,i=t.children;if(i&&i.length)for(var n=i.length,s=0;s<n;s++){var r=i[s],o=-1!==e.indexOf(s);this._selectThumbnailByNode(r,o)}},e._selectThumbnailByNode=function(t,e){t&&(e?(t.classList.add("dvs-activeThumb"),t.style.border=this.selectedPageBorder,t.style.background=this.selectedPageBackground):(t.classList.remove("dvs-activeThumb"),t.style.border=this.pageBorder,t.style.background=this.pageBackground))},e.setViewMode=function(t,e){if(this.rows===e&&this.columns===t||this._thumbnailCanvas.forEach(function(t){t.emptyPage()}),this.rows=e,this.columns=t,1===e&&1===t?null!=(e=this._thumbnailElement)&&e.classList.add("dvs-hide-remove-btn"):this.showRemoveBtn&&null!=(t=this._thumbnailElement)&&t.classList.remove("dvs-hide-remove-btn"),10===document.documentMode){e=this._myQuery("thumbLists"+this.uid);if(!e)return;e.style.marginTop=e.style.marginTop?"":"0.1px",this.renderCanvas()}return this.showLatestPage(),!0},e.updatePageLayout=function(){if(!this.showThumbnail)return!1;var t=this._myQuery("thumbLists"+this.uid);if(null==t||null==(e=t.children)||!e.length)return!1;var e=t.clientWidth-1,i=t.clientHeight-1,n=this._getCurrentPageMargin(e,i,t),s=(this._pageMarginNumber=n,this._setPageSize(e,i,t,n),t.clientWidth-1),r=t.clientHeight-1;s==e&&r==i||this._setPageSize(s,r,t,n),this.renderCanvas()},e.calculateSize=function(){var t=this._thumbnailElement;if(t){var e=t.getBoundingClientRect();if(0==e.width||0==e.height)return!1;var i=this._tempThumbnailSize,n=t.clientWidth,t=t.clientHeight;i.width===n&&i.height===t||(i.width=n,i.height=t,this._pubSub._emit(at,e.width,e.height))}return this.updatePageLayout(),!0},e._getCurrentPageMargin=function(t,e,i){var n,s,r=this.rows,o=this.columns,a=this._pageMargin;return a=String(a),a=/%$/.test(a)?(s=parseInt(a),n=Math.min(1/(o+1),1/(r+1)),(s=Math.min(s/100,n))*e-1):/em$/.test(a)?(this._currentPageMargin<0&&(n=parseInt(a),s=parseInt(window.getComputedStyle(i).fontSize),this._currentPageMargin=n*s),this._currentPageMargin):parseInt(a),t&&t+5<a*(o+1)&&(a=t/(o+1)),a=e&&e+5<a*(r+1)?e/(r+1):a},e._setPageSize=function(t,e,i,n){if(null!=i&&i.children)for(var s=this.rows,r=this.columns,o=1===this.columns&&1===this.rows,a=Math.floor((t-(r+1)*n)/r),l=Math.floor((e-(s+1)*n)/s),h=i.children,u="vertical"===this._scrollDirection,c=0;c<h.length;c++){var d=h[c];o?(d.style.width=u?Math.floor(t)+"px":"100%",d.style.height=u?"100%":Math.floor(e)+"px",i.style.padding="0px",d.style.margin=0===c?"0px":u?"".concat(n,"px 0px 0px"):"0px 0px 0px ".concat(n,"px ")):(d.style.margin="0px ".concat(n,"px ").concat(n,"px 0px"),i.style.padding="".concat(n,"px 0px 0px ").concat(n,"px"),c===h.length-1&&(d.style[u?"marginBottom":"marginRight"]=n+1+"px"),d.style.width=a+"px",d.style.height=l+"px")}},e.updateDisplayedUidsIE=function(){var e=this;if(window.IntersectionObserver)return!1;if(!this.showThumbnail||!this._thumbnailCanvas)return!1;var t=this._getDisplayedImagesIE(),t=this._getRenderIndexes(t),t=(this._renderIndexes.array=t).map(function(t){return null==(t=e._thumbnailCanvas[t])?void 0:t.uid});this._renderUids.array=t,this.renderCanvas(),this._viewerEmit(T,t.slice(),this.uid)},e.updateDisplayedUids=function(){if(!this.showThumbnail)return!1;var e=this._thumbnailCanvas;if(!e.length)return this._showIndexes.array=[],this._renderIndexes.array=[],void(this._renderUids.array=[]);var t=this._renderIndexes.array.slice(0),i=[];t.forEach(function(t){e[t]&&i.push(e[t].uid)}),this._renderUids.array=i,this._viewerEmit(T,i,this.uid)},e._handleObservePages=function(t){var i=this;t.forEach(function(t){var e=t.intersectionRect,t=t.target,t=null==t?void 0:t["dvs-uid"];0<(null==e?void 0:e.width)||0<(null==e?void 0:e.height)?i._showUids.add(t):i._showUids.delete(t)}),this._getViewIndexesByUids(),this.updateDisplayedUids(),this.renderCanvas()},e._getRenderIndexes=function(t){var e=this.rows,i=this.columns,n=this.scrollDirection,s=this._thumbnailCanvas;if(!s)return[];for(var r=this._thumbnailCanvas.length,o=0,a=(t.forEach(function(t){r=Math.min(t,r),o=Math.max(t,o)}),[]),l=r;l<=o;l++)s[l]&&a.push(l);if("vertical"===n){for(var h=r-3*i;h<r;h++)s[h]&&a.push(h);for(var u=o+1;u<o+3*i;u++)s[u]&&a.push(u)}else{for(var c=r-3*e;c<r;c++)s[c]&&a.push(c);for(var d=o+1;d<o+3*e;d++)s[d]&&a.push(d)}return a},e._getViewIndexesByUids=function(){var i=this._showUids,n=[],t=(this._thumbnailCanvas.forEach(function(t,e){-1<i.array.indexOf(t.uid)&&n.push(e)}),this._showIndexes.array=n,this._getRenderIndexes(n.slice()));this._renderIndexes.array=t},e.triggerTopImageChange=function(t){void 0===t&&(t=""),this.updateDisplayedUidsIE(),this._updateTopPageIndex(t)},e.scrollTo=function(t,e){if(void 0===e&&(e=""),!this.showThumbnail||this._prtScrollOnce)return!(this._prtScrollOnce=!1);var i,n,s,r,o,a,l=this._myQuery("thumbLists"+this.uid);return!(!l||l.clientWidth<=0||l.clientHeight<=0||t>l.children.length-1||l.children.length<=0||t<0)&&((l.scrollHeight>l.clientHeight||l.scrollWidth>l.clientWidth)&&(i=l.getBoundingClientRect(),n=this.scrollDirection,r=s=-1,o=(t=l.children[t]).getBoundingClientRect(),a=parseInt(l.style.padding),"vertical"===n?(r=0,o.top<=i.top?s=t.offsetTop-a+1:o.bottom>=i.bottom&&(s=t.offsetTop-i.height+o.height+a+1)):(s=0,o.left<=i.left?r=t.offsetLeft-a+1:o.right>=i.right&&(r=t.offsetLeft-i.width+o.width+a+1)),-1!==s&&(l.scrollTop=s),-1!==r&&(l.scrollLeft=r)),this.triggerTopImageChange(e),!0)},e.showLatestPage=function(t){var e;t===undefined&&(t=this.currentIndex),this.currentIndex=t,null!=(e=this._thumbnailCanvas)&&e.length?(this.updatePageLayout(),this.scrollTo(t)):this.triggerTopImageChange()},e._updateTopPageIndex=function(t){void 0===t&&(t="");var e=this._thumbnailElement;if(!this.showThumbnail||!e)return!1;window.IntersectionObserver&&(e=this._calDisplayedIndexes()[0],this._calculateTopIndex=e);e=this._calculateTopIndex;if(this._thumbnailCanvas[e]||(e=-1,t=""),this._topImageIndex===e)return!1;this._topImageIndex=e,this._pubSub._emit(rt,e,t),"scroll"===t&&this.autoChangeIndex&&(this._prtScrollOnce=!0,this._viewerEmit(I,[e]))},e._getDisplayedImagesIE=function(){for(var t=this._calDisplayedIndexes(),e=t[0],i=t[1],n=[],s=e;s<=i;s++)0<=s&&n.push(s);return this._calculateTopIndex=e,n},e._calDisplayedIndexes=function(){var t=this._myQuery("thumbLists"+this.uid),e=null==t?void 0:t.getBoundingClientRect();if(!e||!e.width)return[-1,-1];e=t.children[0];if(!e)return[-1,-1];var i,n=e.getBoundingClientRect(),s=-1,r=0,o=this.rows,a=this.columns;for(r="vertical"===this.scrollDirection?(i=(t.scrollTop+1-(i=Math.floor(n.height))-(parseInt(e.style.marginTop)||parseInt(e.style.marginBottom)))/(i+this._pageMarginNumber),(s=((i=Math.floor(i))+1)*this.columns)+(o+1)*a-1):(t=(t.scrollLeft+1-(i=Math.floor(n.width))-(parseInt(e.style.marginLeft)||parseInt(e.style.marginRight)))/(i+this._pageMarginNumber),(s=((t=Math.floor(t))+1)*this.rows)+o*(a+1)-1);!this._thumbnailCanvas[s]&&-1<s;)s--;for(;!this._thumbnailCanvas[r]&&s<r;)r--;return[s,r]},e.dragThumbnail=function(t){return this.isDragUp=!1,!(t.ctrlKey||t.shiftKey||t.metaKey)&&(0===t.button&&this._dragStartFunction(t))},e.dragStartMobile=function(t){var e=this,i=(this.isDragUp=!1,t.changedTouches[0]);return this.needClick=!0,this._dragTimer=setTimeout(function(){document.addEventListener("touchmove",P,{passive:!1}),e._dragStartFunction(i)},300),!0},e._dragStartFunction=function(t){if(!this.allowPageDragging||this._isCrop)return!1;var e=this.rows,i=this.columns;if(1===e&&1===i)return!1;e=this.getImageItem(t);if(!e)return!1;this._multipleMode||e.classList.contains("dvs-activeThumb")||(this.selectedIndexes=[R(e)],this._updateSelectedPageStyle(),this.needClick=!1);var i=e.getBoundingClientRect(),n=t.clientX-i.left,i=t.clientY-i.top;return this.thumbMoveOption={napX:n,napY:i,clickX:t.pageX,clickY:t.pageY,target:e},this.isDrag=!0,this._dragStart=!0},e._initReplaceBlocks=function(){for(var t=this._myQuery("thumbLists"+this.uid),e=t.querySelectorAll(".dvs-activeThumb"),i=0;i<e.length;i++){var n=e[i],s=document.createElement("li");s.className="dvs-replaceBlock",d(s,{backgroundColor:this.placeholderBackground,margin:n.style.margin,width:n.style.width,height:n.style.height}),s["dvs-defaultIndex"]=n["dvs-defaultIndex"],L(s,n,t)}t.classList.add("div-hideReplaceBlock")},e.dragMove=function(t){return this._dragMoveFunction(t)},e.dragMoveMobile=function(t){t=t.changedTouches[0];return clearTimeout(this._dragTimer),this._dragMoveFunction(t)},e._dragMoveFunction=function(t){var e,i;if(this.selectedIndexes.length&&this.isDrag){var n=this.thumbMoveOption,s=n.napX,r=n.napY,o=n.clickX,a=n.clickY,n=n.target,l=t.pageX,h=t.pageY;if(!(Math.abs(l-o)<10&&Math.abs(h-a)<10)||this.ifDragMoves){var l=n["dvs-defaultIndex"],u=this._myQuery("thumbLists"+this.uid);if(u){this._dragStart&&(this._dragStart=!1,this._initReplaceBlocks(),this._thumbnailCanvas.length<=this.rows*this.columns&&(u.style.overflow="hidden"),this._pubSub._emit(Z,{index:l,pageX:t.pageX,pageY:t.pageY},t)),this.ifDragMoves=!0;for(var c=u.scrollTop,d=u.scrollLeft,_=n.getBoundingClientRect(),p=this._renderUids.array.slice(),f=0,v=0;f<this._thumbnailCanvas.length&&v<p.length&&0!==p.length;f++){var m=this._thumbnailCanvas[f],g=p.indexOf(m.uid);if(-1!==g){var b=m._canvasItem.parentNode;if(!b.classList.contains("dvs-activeThumb")){g=b.getBoundingClientRect(),m=g.left-_.left,g=g.top-_.top;if(Math.abs(m)<=_.width/2&&Math.abs(g)<=_.height/2){for(var y=R(b),w=u.querySelectorAll("li.dvs-replaceBlock"),x=R(w[0]),C=0;C<w.length;C++){var S=w[C];y<x?L(S,b,u):(S=S,i=void 0,(i=(e=b).parentNode).lastChild==e?i.appendChild(S):L(S,e.nextSibling,i))}return u.scrollTop=c,u.scrollLeft=d,!0}v++}}}for(var o=u.getBoundingClientRect(),h=t.clientY-o.top-r,I=t.clientX-o.left-s+d,k=h+c,M=(u.classList.remove("div-hideReplaceBlock"),this._myQueryAll("thumbLists".concat(this.uid,">li.dvs-activeThumb"))),B=0;B<M.length;B++){var T=M[B];T.classList.add("dvs-absolute"),T.style.left="".concat(I+5*B,"px"),T.style.top="".concat(k+5*B,"px")}this._pubSub._emit(tt,{index:l,pageX:t.pageX,pageY:t.pageY},t),P(t)}}}},e.dragUp=function(){return this._dragUpFunction()},e.dragUpMobile=function(){return document.removeEventListener("touchmove",P),clearTimeout(this._dragTimer),this._dragUpFunction()},e._dragUpFunction=function(){if(this.isDrag){this.thumbMoveOption=null,this.isDrag=!1;var t=this.ifDragMoves;if(this.clearAbsolute(),!t)return this._viewerEmit(I,this.selectedIndexes.slice()),!1;this.isDragUp=!0;for(var e=this._myQuery("thumbLists"+this.uid),i=e.children.length,n=[],s=[],r=[],o=this.selectedIndexes.slice(0),a=[],l=0;l<i;l++){var h=e.children[l],u=h["dvs-defaultIndex"];r.push(u),!h.classList.contains("dvs-activeThumb")||-1!==(h=o.indexOf(u))&&u!==(a[h]=l)&&s.push([u,l]),n[l]=this._thumbnailCanvas[u]}this._thumbnailCanvas=n,this.selectedIndexes=a,this._updateElements(),this._viewerEmit(Mt,r,a.slice()),s.length&&this._pubSub._emit(et,s)}},e.stretchStart=function(t){return 1!==t.button&&(!(null==(e=t.target)||!e.classList.contains("dvs-stretchBar"))&&void(this.fullThumbnail||(e.classList.add("dvs-streching"),this._stretchItem=e,this._isStretching=!0,P(t))));var e},e.stretchMove=function(t){if(!this._isStretching)return!1;var e,i,n=this._stretchItem;if(!n||!this._thumbnailElement)return!1;var s=this._thumbnailElement.getBoundingClientRect(),r=n.classList;r.contains("dvs-stretchRight")?(e=t.clientX-s.left<0?0:t.clientX-s.left,n.style.left=e+"px"):r.contains("dvs-stretchLeft")?(e=s.right-t.clientX<0?0:s.right-t.clientX,n.style.left=s.width-e+"px"):r.contains("dvs-stretchTop")?(i=s.bottom-t.clientY<0?0:s.bottom-t.clientY,n.style.top=s.height-i+"px"):(i=t.clientY-s.top<0?0:t.clientY-s.top,n.style.top=i+"px")},e.stretchEnd=function(){if(!this._isStretching||!this._thumbnailElement)return!1;var t=this._stretchItem;if(!t)return!1;this._stretchItem=null,this._isStretching=!1;var e=parseInt(t.style.left),i=parseInt(t.style.top),n=0,s=this._thumbnailElement.getBoundingClientRect(),r=s.width-e,s=s.height-i,o=null==(o=this._pubQuery("showImageArea"+this._postfix))?void 0:o.getBoundingClientRect(),e=Math.min(e,o.width),i=Math.min(i,o.height),n=t.classList.contains("dvs-stretchRight")?e/o.width:t.classList.contains("dvs-stretchLeft")?r/o.width:t.classList.contains("dvs-stretchTop")?s/o.height:i/o.height;t.style.left=null,t.style.top=null,t.classList.remove("dvs-streching"),this.size=Math.min(100*n,100).toFixed(2)+"%",this._pubSub._emit(Bt,{_size:this.size}),this._resizeViewer()},e._updateStretchBars=function(){var t=this._allowResizing,e=this._location,i=this._sequence,n="horizontal"===e&&t&&0<=i?"remove":"add",s="vertical"===e&&t&&0<=i?"remove":"add",r="horizontal"===e&&t&&i<0?"remove":"add",e="vertical"===e&&t&&i<0?"remove":"add",t=this.uid,i=this._myQuery("stretchBarLeft".concat(t)),o=this._myQuery("stretchBarRight".concat(t)),a=this._myQuery("stretchBarTop".concat(t)),t=this._myQuery("stretchBarBottom".concat(t));null!=i&&i.classList[n]("dvs-nodisplay"),null!=o&&o.classList[r]("dvs-nodisplay"),null!=a&&a.classList[s]("dvs-nodisplay"),null!=t&&t.classList[e]("dvs-nodisplay")},e._updateProps=function(t){for(var e in t)this[e]=t[e]},e._imageClickCallback=function(t,e){var i=this.selectedIndexes.slice();if((e.ctrlKey||e.metaKey||this._multipleMode)&&!e.shiftKey){var n=i.indexOf(t);if(-1===n)i.push(t);else{if(this.isDragUp)return void(this.isDragUp=!1);if(1===i.length&&!this._multipleMode)return!1;i.splice(n,1),this._prtScrollOnce=!0}}else if(!e.shiftKey||e.ctrlKey||e.metaKey)if((e.ctrlKey||e.metaKey)&&e.shiftKey){for(var n=i.slice(0),s=n[n.length-1],r=(n.push(t),t),o=t,a=(n.forEach(function(t){t<r?r=t:o<t&&(o=t)}),[]),l=r;l<=o;l++)l!==s&&a.push(l);0<=s&&a.push(s),i=a}else this.needClick?i=[t]:this.needClick=!0;else{var h=i[i.length-1];if(h===undefined)i.push(t);else{var u=[];if(h<t)for(var c=t;h<=c;c--)u.push(c);else for(var d=t;d<=h;d++)u.push(d);i=u}}return this._viewerEmit(I,i),!0},e._thumbnailDragStart=function(t){return c()?this.dragStartMobile(t):this.dragThumbnail(t)},e._thumbnailDragMove=function(t){return c()?this.dragMoveMobile(t):this.dragMove(t)},e._thumbnailDragUp=function(){return c()?this.dragUpMobile():this.dragUp()},e._thumbnailMouseOver=function(t){var e;this.allowHover&&!this.ifDragMoves&&((e=this.getImageItem(t))?(e.classList.contains("dvs-activeThumb")||(e.style.background=this.hoverPageBackground,e.style.border=this.hoverPageBorder),e=e["dvs-defaultIndex"],this._pubSub._emit(j,{index:e,pageX:t.pageX,pageY:t.pageY},t)):this._pubSub._emit(j,{index:-1,pageX:t.pageX,pageY:t.pageY},t))},e._thumbnailMouseOut=function(t){var e,i;this.allowHover&&!this.ifDragMoves&&((e=this.getImageItem(t))?(i=e["dvs-defaultIndex"],this._pubSub._emit(K,{index:i,pageX:t.pageX,pageY:t.pageY},t),e.classList.contains("dvs-activeThumb")?(e.style.background=this.selectedPageBackground,e.style.border=this.selectedPageBorder):(e.style.background=this._pageBackground,e.style.border=this.pageBorder)):this._pubSub._emit(K,{index:-1,pageX:t.pageX,pageY:t.pageY},t))},e._thumbnailClick=function(t){var e;this.ifDragMoves||this.isDragUp||((e=this.getImageItem(t))?(e=e["dvs-defaultIndex"],this._imageClickCallback(e,t),this._pubSub._emit(q,{index:e,pageX:t.pageX,pageY:t.pageY},t)):this._pubSub._emit(q,{index:-1,pageX:t.pageX,pageY:t.pageY},t))},e._thumbnailRightClick=function(t){var e=this.getImageItem(t);if(e){if(this.ifDragMoves)return!1;e=e["dvs-defaultIndex"];this._pubSub._emit($,{index:e,pageX:t.pageX,pageY:t.pageY},t),this._pubSub._emit(J,{index:e,pageX:t.pageX,pageY:t.pageY},t),-1!==this.selectedIndexes.indexOf(e)||c()&&this.allowPageDragging||this._pubSub._emit(I,[e])}else this._pubSub._emit($,{index:-1,pageX:t.pageX,pageY:t.pageY},t),this._pubSub._emit(J,{index:-1,pageX:t.pageX,pageY:t.pageY},t)},e._thumbnailDoubleClick=function(t){var e=this.getImageItem(t);e?(e=e["dvs-defaultIndex"],this._pubSub._emit(G,{index:e,pageX:t.pageX,pageY:t.pageY},t)):this._pubSub._emit(G,{index:-1,pageX:t.pageX,pageY:t.pageY},t)},e._thumbnailPointerDown=function(t){var e=this.getImageItem(t);e?(e=e["dvs-defaultIndex"],this._pubSub._emit(s,{index:e,pageX:t.pageX,pageY:t.pageY},t)):this._pubSub._emit(s,{index:-1,pageX:t.pageX,pageY:t.pageY},t)},e._thumbnailPointerMove=function(t){var e;this.ifDragMoves?(this.isInner?null==(e=this._oPub)||null==(e=e._events)||null==(e=e[x])?void 0:e.length:null==(e=this._pubSub)||null==(e=e.getPublishSubscribe())||null==(e=e._events)||null==(e=e[x])?void 0:e.length)&&(e=this._getPointIndex(t),this._pubSub._emit(x,{index:e,pageX:t.pageX,pageY:t.pageY},t)):(e=this.getImageItem(t))?(e=e["dvs-defaultIndex"],this._pubSub._emit(x,{index:e,pageX:t.pageX,pageY:t.pageY},t)):this._pubSub._emit(x,{index:-1,pageX:t.pageX,pageY:t.pageY},t)},e._thumbnailPointerUp=function(t){var e;this.ifDragMoves?(e=this._getPointIndex(t),this._pubSub._emit(C,{index:e,pageX:t.pageX,pageY:t.pageY},t)):(e=this.getImageItem(t))?(e=e["dvs-defaultIndex"],this._pubSub._emit(C,{index:e,pageX:t.pageX,pageY:t.pageY},t)):this._pubSub._emit(C,{index:-1,pageX:t.pageX,pageY:t.pageY},t)},e._thumbnailScroll=function(){this.triggerTopImageChange("scroll")},e._thumbnailStretchStart=function(t){this.stretchStart(t)},e._documentMouseMove=function(t){this.stretchMove(t)},e._documentMouseUp=function(){this.stretchEnd(),this._thumbnailDragUp()},e.getImageItem=function(t){var e;if(!t)return null;if(!(t=r(t)?t:t.target)||null!=(e=t.classList)&&e.contains("dvs-replaceBlock"))return null;if("CANVAS"===t.tagName)t=t.parentNode;else{if(t===(null==(e=this._thumbnailElement)?void 0:e.querySelector(".dvs-thumbLists")))return!1;if("LI"!==t.tagName)return null}return t},e._getPointIndex=function(t){var e=null==(e=this._thumbnailElement)?void 0:e.querySelector(".dvs-thumbLists");if(!e)return-1;for(var i=e.children,n=0;n<i.length;n++){var s,r=i[n];if(this._checkPointOnElement(t,r)&&(null==(s=r.classList)||!s.contains("dvs-activeThumb")))return function(t,e){for(var i=t.parentNode,n=i.children,s=0,r=0;r<n.length;r++){var o=n[r];if(l(e)){if(e(o,i)){if(o===t)return s;s++}}else if(o===t)return r}return-1}(r,function(t){return!(null!=(t=t.classList)&&t.contains("dvs-activeThumb"))})}return-1},e.clearAbsolute=function(){var t=this._myQuery("thumbLists"+this.uid);if(!t)return!1;for(var e=this._myQueryAll("thumbLists".concat(this.uid,">li.dvs-replaceBlock")),i=(this.ifDragMoves=!1,this.isDrag=!1,this._myQueryAll("thumbLists".concat(this.uid,">li.dvs-absolute"))),n=0;n<i.length;n++){var s=i[n];L(s,e[n],t),s.classList.remove("dvs-absolute"),s.style.left=null,s.style.top=null}for(var r=0;r<e.length;r++){var o=e[r];t.removeChild(o)}"vertical"===this.scrollDirection?t.style.overflowY="auto":t.style.overflowX="auto"},e.setPercent=function(t){var e=this._thumbnailElement;e&&(e.style.flex="0 0 ".concat(t,"%"),e.style.msFlex="0 0 ".concat(t,"%"))},e.getIndexByUid=function(t){for(var e,i=0;i<this._thumbnailCanvas.length;i++)if(t===(null==(e=this._thumbnailCanvas[i])?void 0:e.uid))return i;return-1},e.getUidByIndex=function(t){return null==(t=this._thumbnailCanvas[t])?void 0:t.uid},e._resizeViewer=function(t){(t=void 0===t?!1:t)?this._viewerEmit(k,this.uid,this.showLatestPage.bind(this)):this._viewerEmit(k)},e._setSplitBarDelay=function(){var t=this;this.isInner||(clearTimeout(this._splitTimer),this._splitTimer=setTimeout(function(){t._viewerEmit("onSetSplitBar")},50))},e._checkPointOnElement=function(t,e){if(!t||!e)return!1;var i=-1,n=-1,s=(n=null!=(s=t.changedTouches)&&s[0]?(i=(s=null==(s=t.changedTouches)?void 0:s[0]).clientX,s.clientY):(i=t.clientX,t.clientY),e.getBoundingClientRect());return i>=s.left&&n>=s.top&&i<=s.right&&n<=s.bottom},e._myQuery=function(t){var e;return null==(e=this._thumbnailElement)?void 0:e.querySelector("#"+t)},e._myQueryAll=function(t){var e;return null==(e=this._thumbnailElement)?void 0:e.querySelectorAll("#"+t)},e._pubQuery=function(t){var e;return null==(e=this._viewerContainer)||null==(e=e.el)?void 0:e.querySelector("#"+t)},e._viewerEmit=function(t){for(var e,i=arguments.length,n=new Array(1<i?i-1:0),s=1;s<i;s++)n[s-1]=arguments[s];(e=o.prototype._emit).call.apply(e,[this,t].concat(n))},e.dispose=function(){var t;this.unbindUi(),o.prototype.dispose.call(this),null!=(t=this._pubSub)&&t.dispose(),this._pubSub=null,this._viewerContainer=null,this._thumbnailElement=null},Fe(t,[{key:"selectedBoxLineColor",set:function(t){Object.assign(this.cropBoxStyle,{borderColor:t,ctrlBorderColor:t})}},{key:"optimizeImage",get:function(){return this._optimizeImage},set:function(e){this._optimizeImage=e,this._thumbnailCanvas.forEach(function(t){t.setOptimizeImage(e)}),this.renderCanvas()}},{key:"multiSelectMode",get:function(){return this._multipleMode},set:function(t){this._multipleMode=t}},{key:"checkbox",get:function(){return this._checkboxConfig},set:function(t){var e=this;Object.assign(this._checkboxConfig,t),this._thumbnailCanvas.forEach(function(t){t.updateCheckboxConfig(e._checkboxConfig)}),this.renderCanvas()}},{key:"pageNumber",get:function(){return this._pageNumberConfig},set:function(t){var e=this;Object.assign(this._pageNumberConfig,t),this._thumbnailCanvas.forEach(function(t){t.updatePageNumberConfig(e._pageNumberConfig)}),this._showPageNumber="visible"===this._pageNumberConfig.visibility,this.renderCanvas()}},{key:"size",get:function(){return this._size},set:function(t){this._size=t,t=String(t),this._fullThumbnail?t="100%":/\d+$/.test(t)&&(t+="px");var e=this._thumbnailElement;e&&(e.style.flex="0 0 ".concat(t),e.style.msFlex="0 0 ".concat(t),"vertical"===this.location?(e.style.width="100%",e.style.maxWidth="100%",e.style.height=t,e.style.maxHeight=t):(e.style.width=t,e.style.maxWidth=t,e.style.height="100%",e.style.maxHeight="100%"),this._resizeViewer())}},{key:"mouseShape",get:function(){return this._mouseShape},set:function(t){this._mouseShape=t;var e=this._thumbnailElement;e&&(e.style.cursor=t)}},{key:"scrollDirection",get:function(){return this._scrollDirection},set:function(t){this._scrollDirection=t;var e=this._thumbnailElement;e&&(e=e.querySelector("#thumbLists"+this.uid),"vertical"===t?(e.style.flexDirection="row",e.style.overflowX="hidden",e.style.overflowY="auto"):(e.style.flexDirection="column",e.style.overflowX="auto",e.style.overflowY="hidden"),this._resizeViewer(!0))}},{key:"sequence",get:function(){return this._sequence},set:function(t){this._sequence=t;var e=this._thumbnailElement;e&&(e.style.order=String(t),e.style.msFlexOrder=t,this._updateStretchBars(),this._setSplitBarDelay())}},{key:"location",get:function(){return this._location},set:function(t){this._location=t;var e,i=null,n=null==(n=this._viewerContainer)?void 0:n.el;n&&this._thumbnailElement&&(e={vertical:"#content"+this._postfix,horizontal:"#middle"+this._postfix,canvas:"#innerThumbnail"+this._postfix},(i=null==n?void 0:n.querySelector(e[t]))&&i.appendChild(this._thumbnailElement),this._updateStretchBars(),this.size=this._size,this._setSplitBarDelay(),this._resizeViewer(!0))}},{key:"showThumbnail",get:function(){return this._showThumbnail},set:function(t){this._showThumbnail=t;var e=this._thumbnailElement;e&&(t?e.classList.remove("dvs-disabled"):e.classList.add("dvs-disabled"),this.updatePageLayout(),this._resizeViewer(!0),this._setSplitBarDelay())}},{key:"showPageNumber",get:function(){return this._showPageNumber},set:function(t){var e=this;this._showPageNumber=t,this.pageNumber.visibility=t?"visible":"hidden",this._thumbnailCanvas.forEach(function(t){t.updatePageNumberConfig(e._pageNumberConfig)}),this.renderCanvas()}},{key:"fullThumbnail",get:function(){return this._fullThumbnail},set:function(t){this._fullThumbnail=t,this.size=this._size;var e=this._myQuery("thumbnailStretchBarRight"+this.uid);e&&(t?e.classList.add("dvs-nodisplay"):e.classList.remove("dvs-nodisplay"))}},{key:"background",get:function(){return this._background},set:function(t){this._background=t;var e=this._myQuery("thumbLists"+this.uid);e&&(e.style.background=t)}},{key:"border",get:function(){return this._border},set:function(t){this._border=t;var e=this._thumbnailElement;e&&(e.style.border=t)}},{key:"selectedPageBorder",get:function(){return this._selectedPageBorder},set:function(t){this._selectedPageBorder=t;for(var e=this._myQueryAll("thumbLists".concat(this.uid,">li.dvs-activeThumb")),i=0;i<e.length;i++)e[i].style.border=t}},{key:"selectedPageBackground",get:function(){return this._selectedPageBackground},set:function(t){this._selectedPageBackground=t;for(var e=this._myQueryAll("thumbLists".concat(this.uid,">li.dvs-activeThumb")),i=0;i<e.length;i++)e[i].style.background=t}},{key:"pageBackground",get:function(){return this._pageBackground},set:function(t){this._pageBackground=t;var e=this._myQuery("thumbLists"+this.uid);if(e&&e.children)for(var i=e.children,n=0;n<i.length;n++){var s=i[n];s.classList.contains("dvs-activeThumb")||(s.style.background=t)}}},{key:"pageBorder",get:function(){return this._pageBorder},set:function(t){this._pageBorder=t;var e=this._myQuery("thumbLists"+this.uid);if(e&&e.children)for(var i=e.children,n=0;n<i.length;n++){var s=i[n];s.classList.contains("dvs-activeThumb")||(s.style.border=t)}}},{key:"pageMargin",get:function(){return this._pageMargin},set:function(t){this._pageMargin=t,this._currentPageMargin=-1,this._resizeViewer(!0)}},{key:"allowResizing",get:function(){return this._allowResizing},set:function(t){this._allowResizing=t,this._updateStretchBars()}},{key:"showRemoveBtn",get:function(){return this._showRemoveBtn},set:function(t){(this._showRemoveBtn=t)?null!=(t=this._thumbnailElement)&&t.classList.remove("dvs-hide-remove-btn"):null!=(t=this._thumbnailElement)&&t.classList.add("dvs-hide-remove-btn")}}]),t}(E);function je(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var Ke=function(){function t(e){var i=this;this.uid=null,this.mode="normal",this.vertexes=[],this.midpoints=[],this.probePoints=[],this.slopeRatio=[],this.isCrop=!1,this.isConvex=!0,this.isPointSelected=!1,this.activeProbePoint=null,this.moveLeft=0,this.moveTop=0,this.isMoveBox=!1,this.width=0,this.height=0,this.type="bottomRight",this.keepAspectRatio=!1,this.aspectRatio=0,this._startX=null,this._startY=null,this._lastX=null,this._lastY=null,this._lastWhr=1,this.zoom=1,this.dpr=1,this.cropBoxStyle={ctrlWidth:8,ctrlHeight:8},this.uid=g(11),Object.keys(e).forEach(function(t){i[t]=e[t]}),this._initBox()}var e=t.prototype;return e.getRect=function(){if("free"===this.mode)return null;var t=this._getMaxPoint(),e=t.minX,i=t.maxX,n=t.minY,t=t.maxY;return{x:Math.floor(e),y:Math.floor(n),width:Math.floor(i-e),height:Math.floor(t-n)}},e._initBox=function(){this.midpoints=this._calcMidpoint(this.vertexes),this.probePoints=this.vertexes.slice().concat(this.midpoints.slice()),this.slopeRatio=this._calcSlopeRatio(this.vertexes)},e._getMaxPoint=function(){return{minX:Math.min(this.probePoints[0],this.probePoints[2],this.probePoints[4],this.probePoints[6]),maxX:Math.max(this.probePoints[0],this.probePoints[2],this.probePoints[4],this.probePoints[6]),minY:Math.min(this.probePoints[1],this.probePoints[3],this.probePoints[5],this.probePoints[7]),maxY:Math.max(this.probePoints[1],this.probePoints[3],this.probePoints[5],this.probePoints[7])}},e.checkPointPosition=function(t){var e=this._getMaxPoint(),i=e.minX,n=e.maxX,s=e.minY,e=e.maxY,r=this.probePoints[2*t],o=this.probePoints[2*t+1];return t<4?r===n&&o===e?"se":r===n&&o===s?"ne":r===i&&o===s?"nw":r===i&&o===e?"sw":null:r===n?"e":o===e?"s":r===i?"w":o===s?"n":null},e.onStartHandler=function(t,e,i){var n=this.isBoxSelected(t,e);null!==(n=i!==undefined?i:n)&&(this._startX=t,this._startY=e,this._lastX=t,this._lastY=e,-1===n?(this.isPointSelected=!1,this.activeProbePoint=null,"normal"===this.mode&&(this.isMoveBox=!0)):(this.isPointSelected=!0,this.activeProbePoint=n,this.isMoveBox=!1),"free"===this.mode&&3<n&&(this.k1=this.slopeRatio[(1+(i=n-4))%4],this.b1=this.probePoints[(2*i+3)%8]-this.k1*this.probePoints[(2*i+2)%8],this.k2=this.slopeRatio[(3+i)%4],this.b2=this.probePoints[(2*i+1)%8]-this.k2*this.probePoints[(2*i+0)%8]))},e.onMoveHandler=function(t,e,i){if(this.isPointSelected||this.isMoveBox){var n=this.probePoints.slice();if(this.isPointSelected){var s=this.activeProbePoint,i=(i!==undefined&&(s=i),"normal"===this.mode?n=this._movePointNormal(n,s,t,e):(n=this._movePointFree(n,s,t,e),this.slopeRatio=this._calcSlopeRatio(this.probePoints).slice(0,4)),this.probePoints=n.slice(),this._checkRectConvexity(this.probePoints));this.isConvex=!!i}else if(this.isMoveBox){s=t-this._lastX,i=e-this._lastY;if(0==s&&0==i)return;n=this._moveBox(n,s,i),this.probePoints=n.slice()}s=this._calcMidpoint(this.probePoints);this.probePoints=this.probePoints.slice(0,8).concat(s),this.midpoints=s,this._lastX=t,this._lastY=e}},e.onEndHandler=function(){this.isConvex=!0;var t,e=this._startX,i=this._startY,n=(this._startX=0,this._startY=0,this._lastX),s=this._lastY;(this.isPointSelected||this.isMoveBox)&&(this.isPointSelected=!1,this.isMoveBox=!1,this.activeProbePoint=null,t=this._checkRectConvexity(this.probePoints),(e!==n||i!==s)&&t||(this.probePoints=this.vertexes.slice().concat(this.midpoints)),this.vertexes=this.probePoints.slice(0,8),this.midpoints=this._calcMidpoint(this.probePoints),this.probePoints=this.probePoints.slice(0,8).concat(this.midpoints),this.slopeRatio=this._calcSlopeRatio(this.probePoints).slice(0,4))},e._checkEdge=function(t,e){return 0<=t&&t<=this.width&&0<=e&&e<this.height},e._movePointNormal=function(t,e,i,n){i=Math.max(0,Math.min(this.width,i)),n=Math.max(0,Math.min(this.height,n));var s=0,r=0;if(this.keepAspectRatio){var o=this._getMaxPoint(),a=o.minX,l=o.maxX,h=o.minY,o=o.maxY,u=this.checkPointPosition(e),l=(l-a)/(o-h),a=(0===l||l===Infinity||l===-Infinity||isNaN(l)?l=this._lastWhr:this._lastWhr=l,r=s=0,"width");if(e<4){if(s=i-t[2*e],r=n-t[2*e+1],0===s||0===r)return t;a="width"}else{o=e-4;if("e"===u?(e=(1+o)%4,a="width"):"s"===u?(e=o,a="height"):"w"===u?(e=o,a="width"):"n"===u&&(e=(1+o)%4,a="height"),s=i-t[2*o],r=n-t[2*o+1],0===s||0===r)return t}"height"===a?(s=r*l,"ne"!==u&&"sw"!==u&&"n"!==u&&"w"!==u||(s=-s)):(r=s/l,"ne"!==u&&"sw"!==u&&"n"!==u&&"w"!==u||(r=-r));h=t[2*e]+s,o=t[2*e+1]+r,a=(h<0?(s=0-t[2*e],r=0):h>this.width?(s=this.width-t[2*e],r=0):o<0?(r=0-t[2*e+1],s=0):o>this.height&&(r=this.height-t[2*e+1],s=0),t[2*e]+=s,t[2*e+1]+=r,(e+1)%4),l=(e+3)%4;e%2?(t[2*a]+=s,t[2*l+1]+=r):(t[2*a+1]+=r,t[2*l]+=s)}else if(e<4){if(s=i-t[2*e],r=n-t[2*e+1],0===s&&0===r)return t;t[2*e]=i,t[2*e+1]=n;u=(e+1)%4,h=(e+3)%4;e%2?(t[2*u]=i,t[2*h+1]=n):(t[2*u+1]=n,t[2*h]=i)}else{o=e-4,a=this.slopeRatio[o%4];0===a?(t[(2*o+3)%8]=n,t[(2*o+1)%8]=n):a!==Infinity&&a!==-Infinity||(t[(2*o+2)%8]=i,t[(2*o+0)%8]=i)}return t},e._movePointFree=function(t,e,i,n){i=Math.max(0,Math.min(this.width,i)),n=Math.max(0,Math.min(this.height,n));var s=t.slice();if(e<4){var r=i-t[2*e],o=n-t[2*e+1];if(0==r&&0==o)return t;t[2*e]=i,t[2*e+1]=n}else{var r=e-4,o=this.slopeRatio[r%4],e=n-o*i,a=-e/o,l=e,h=t[(2*r+9)%8]-o*t[(2*r+8)%8],u=-h/o,c=this.k1,d=this.b1,_=this.k2,p=this.b2;0===o?(t[(2*r+3)%8]=n,c!==Infinity&&c!==-Infinity&&(t[(2*r+2)%8]=(n-d)/c),t[(2*r+1)%8]=n,_!==Infinity&&_!==-Infinity&&(t[(2*r+0)%8]=(n-p)/_)):o===Infinity||o===-Infinity?(t[(2*r+2)%8]=i,t[(2*r+3)%8]=c*i+d,t[(2*r+0)%8]=i,t[(2*r+1)%8]=_*i+p):(0===c?t[(2*r+2)%8]+=a-u:c===Infinity||c===-Infinity?t[(2*r+3)%8]+=l-h:(t[(2*r+2)%8]=(d-e)/(o-c),t[(2*r+3)%8]=(o*d-c*e)/(o-c)),0===_?t[(2*r+0)%8]+=a-u:_===Infinity||_===-Infinity?t[(2*r+1)%8]+=l-h:(t[(2*r+0)%8]=(p-e)/(o-_),t[(2*r+1)%8]=(o*p-_*e)/(o-_)));for(var f=0;f<4;f++){var v=t[2*f],m=t[2*f+1];if(v<0||v>this.width||m<0||m>this.height)return s}}return t},e._moveBox=function(t,e,i){if("normal"===this.mode){var n=Math.min(t[0],t[2],t[4],t[6]),s=Math.max(t[0],t[2],t[4],t[6]),r=Math.min(t[1],t[3],t[5],t[7]),o=Math.max(t[1],t[3],t[5],t[7]);s+(e=n+e<0?-n:e)>this.width&&(e=this.width-s),o+(i=r+i<0?-r:i)>this.height&&(i=this.height-o);for(var a=0;a<4;a++)t[2*a]+=e,t[2*a+1]+=i}return t},e._isPointOnBox=function(t,e){var i,n,s,r;return"normal"===this.mode&&(i=(r=this._getMaxPoint()).minX,n=r.maxX,s=r.minY,r=r.maxY,i<=t&&t<=n&&s<=e&&e<=r)},e.isBoxSelected=function(t,e){var i=this._isPointOnBox(t,e),t=this.isCtrlPointSelected(t,e);return null!==t?t:i?-1:null},e.isCtrlPointSelected=function(t,e){for(var i=this.cropBoxStyle.ctrlWidth/this.zoom/2,n=this.cropBoxStyle.ctrlHeight/this.zoom/2,s=this._getMaxPoint(),r=s.minX,o=s.maxX,a=s.minY,s=s.maxY,i=Math.min(Math.max(i,.1*(o-r)),3*i),n=Math.min(Math.max(n,.1*(s-a)),3*n),l=0;l<8;l++){var h=this.probePoints[2*l],u=this.probePoints[2*l+1];if(t<=h+i&&h-i<=t&&e<=u+n&&u-n<=e&&0<=t&&t<=this.width&&0<=e&&e<=this.height)return l}return null},e._checkRectConvexity=function(t){var e=(t[6]-t[0])*(t[3]-t[1])-(t[7]-t[1])*(t[2]-t[0]),i=(t[0]-t[2])*(t[5]-t[3])-(t[1]-t[3])*(t[4]-t[2]),n=(t[2]-t[4])*(t[7]-t[5])-(t[3]-t[5])*(t[6]-t[4]),s=(t[4]-t[6])*(t[1]-t[7])-(t[5]-t[7])*(t[0]-t[6]);if(e*i*n*s<0)return!1;var r=t.slice().concat(t.slice(0,2));if(this.slopeRatio.length)for(var o=0;o<2;o++)if(this.slopeRatio[o]!==this.slopeRatio[o+2])if(this._calcIntersection(r.slice(2*o,2*o+2),r.slice(2*o+2,2*o+4),r.slice(2*o+4,2*o+6),r.slice(2*o+6,2*o+8)))return!1;return 0<e*i*n*s},e._calcMidpoint=function(t){for(var e=t.slice(0,8).concat(t[0],t[1]),i=[],n=0;n<4;n++){var s=(e[2*n]+e[2*n+2])/2,r=(e[2*n+1]+e[2*n+3])/2;i.push(s,r)}return i},e._calcSlopeRatio=function(t){for(var e=[],i=null,n=t.slice(0,8).concat(t[0],t[1]),s=0;s<4;s++)i=n[2*s+3]-n[2*s+1]==0&&n[2*s+2]-n[2*s]==0?0:(n[2*s+3]-n[2*s+1])/(n[2*s+2]-n[2*s]),e.push(i);return e},e._calcIntersection=function(t,e,i,n){if(this._isRectCross(t,e,i,n)&&this._isLineSegmentCross(t,e,i,n)){var s=(n[0]-i[0])*(t[1]-e[1])-(e[0]-t[0])*(i[1]-n[1]),r=(t[1]-i[1])*(e[0]-t[0])*(n[0]-i[0])+i[0]*(n[1]-i[1])*(e[0]-t[0])-t[0]*(e[1]-t[1])*(n[0]-i[0]);if(0==s||0===r){var o=this._getLine(t,e),a=this._getLine(i,n),l=o[0],h=o[1],u=a[0],c=a[1];if(h[0]===u[0]&&h[1]===u[1])return h;if(l[0]===c[0]&&l[1]===c[1])return l;if(this._isOnLine(h,a)&&this._isOnLine(u,o))return[u,h];if(this._isOnLine(l,a)&&this._isOnLine(c,o))return[l,c];if(this._isOnLine(l,a)&&this._isOnLine(h,a))return[l,h];if(this._isOnLine(u,a)&&this._isOnLine(c,a))return[u,c]}return o=r/s,s=(t[0]-e[0])*(n[1]-i[1])-(e[1]-t[1])*(i[0]-n[0]),[o,(r=e[1]*(t[0]-e[0])*(n[1]-i[1])+(n[0]-e[0])*(n[1]-i[1])*(t[1]-e[1])-n[1]*(i[0]-n[0])*(e[1]-t[1]))/s]}return!1},e._getLine=function(t,e){return t[0]===e[0]?t[1]<e[1]?[t,e]:[e,t]:t[0]<e[0]?[t,e]:[e,t]},e._isOnLine=function(t,e){return e[0][0]===e[1][0]?t[1]>=e[0][1]&&t[1]<=e[1][1]:t[0]>=e[0][0]&&t[0]<=e[1][0]},e._isRectCross=function(t,e,i,n){var s=Math.min,r=Math.max;return s(t[0],e[0])<=r(i[0],n[0])&&s(i[0],n[0])<=r(t[0],e[0])&&s(t[1],e[1])<=r(i[1],n[1])&&s(i[1],n[1])<=r(t[1],e[1])},e._isLineSegmentCross=function(t,e,i,n){var s=t[0]*(i[1]-e[1])+e[0]*(t[1]-i[1])+i[0]*(e[1]-t[1]),r=t[0]*(n[1]-e[1])+e[0]*(t[1]-n[1])+n[0]*(e[1]-t[1]);return!(0<=(s^r)&&0!==s&&0!==r)&&!(0<=((s=i[0]*(t[1]-n[1])+n[0]*(i[1]-t[1])+t[0]*(n[1]-i[1]))^(r=i[0]*(e[1]-n[1])+n[0]*(i[1]-e[1])+e[0]*(n[1]-i[1])))&&0!==s&&0!==r)},t}(),Ge=function(){function t(t,e,i){this._activeBoxId=null,this._startX=null,this._startY=null,this._addNewFlag=null,this._drawingFlag=!1,this.cropBoxes=[],this.width=0,this.height=0,this.zoom=1,this.aspectRatio=0,this.keepAspectRatio=!1,this.mouseDown=!1,this.unselectedCallback=null,this.selectedCallback=null,this.cropBoxStyle={},this.width=t,this.height=e,Object.assign(this.cropBoxStyle,i)}var e=t.prototype;return e.setCropBoxStyle=function(e){Object.assign(this.cropBoxStyle,e),this.cropBoxes.forEach(function(t){Object.assign(t.cropBoxStyle,e)})},e.updateDpr=function(e){this.cropBoxes.forEach(function(t){t.dpr=e})},e.setKeepAspectRatio=function(e){this.keepAspectRatio=e,this._drawingFlag||this.cropBoxes.forEach(function(t){t.keepAspectRatio=e})},e.setAspectRatio=function(t){this.aspectRatio=t},e.setZoom=function(e){this.zoom=e,this.cropBoxes.forEach(function(t){t.zoom=e})},e.setPageSize=function(t,e){this.width=t,this.height=e},e.getRectArr=function(){var i=[];return this.cropBoxes.forEach(function(t,e){e=Object.assign({index:e},t.getRect());i.push(e)}),i},e.clear=function(){var t;0<this.cropBoxes.length&&null!=(t=this.unselectedCallback)&&t.call(this),this.cropBoxes=[]},e.addFreeBox=function(t){var e=y(),t=new Ke({cropBoxStyle:this.cropBoxStyle,vertexes:t.slice(),width:this.width,height:this.height,mode:"free",dpr:e});return this.cropBoxes.push(t),t},e.addBox=function(t,e){var i=y(),t=new Ke({cropBoxStyle:this.cropBoxStyle,vertexes:t.slice(),width:this.width,height:this.height,type:e,mode:"normal",aspectRatio:this.aspectRatio,keepAspectRatio:this.keepAspectRatio,zoom:this.zoom,dpr:i});return this.cropBoxes.push(t),t},e.removeBox=function(t){return t===undefined&&this.clear(),!(t<0||t>=this.cropBoxes.length)&&(this.cropBoxes.splice(t,1),!0)},e.getBoxByUid=function(t){for(var e=this.cropBoxes.length,i=0;i<e;i++)if(this.cropBoxes[i].uid===t)return this.cropBoxes[i];return null},e.onStartHandler=function(t,e,i){this._startX=t,this._startY=e,this.mouseDown=!0;var n=this.checkSelect(t,e);if(null===n)return i||this.clear(),void(this._activeBoxId=null);this._activeBoxId=this.cropBoxes[n].uid,this.getBoxByUid(this._activeBoxId).onStartHandler(t,e)},e.onMoveHandler=function(t,e,i){if(this.mouseDown){var n=null,s=t-this._startX,r=e-this._startY,o=null,a=2/this.zoom,l=(!this._activeBoxId&&t-this._startX<-a&&e-this._startY<-a?(o=0)<this.aspectRatio&&(r=s/this.aspectRatio):!this._activeBoxId&&t-this._startX>a&&e-this._startY<-a?(o=1,0<this.aspectRatio&&(r=-s/this.aspectRatio)):!this._activeBoxId&&t-this._startX>a&&e-this._startY>a?(o=2,0<this.aspectRatio&&(r=s/this.aspectRatio)):!this._activeBoxId&&t-this._startX<-a&&e-this._startY>a&&(o=3,0<this.aspectRatio&&(r=-s/this.aspectRatio)),[t,this._startY+r,this._startX,this._startY+r,this._startX,this._startY,t,this._startY]),h=[this._startX,this._startY,this._startX,this._startY+r,t,this._startY+r,t,this._startY];if(null!==o){for(var u=[],c=0;c<4;c++)o%2?(u.push(h[2*(o+c)%8]),u.push(h[(2*(o+c)+1)%8])):(u.push(l[2*(o+c)%8]),u.push(l[(2*(o+c)+1)%8]));n=this.addBox(u,["topLeft","topRight","bottomRight","bottomLeft"][o]);return 0<this.aspectRatio?n.keepAspectRatio=!0:n.keepAspectRatio=!1,this._drawingFlag=!0,this._addNewFlag=this.keepAspectRatio,this._activeBoxId=n.uid,n.onStartHandler(this._startX,this._startY,o),n.onMoveHandler(t,e,o),void(o=null)}(n=this._activeBoxId?this.getBoxByUid(this._activeBoxId):n)&&n.onMoveHandler(t,e)}},e.onEndHandler=function(){var t;this.mouseDown&&(this.mouseDown=!1,this._drawingFlag=!1,this._activeBoxId&&(t=this.getBoxByUid(this._activeBoxId),null!==this._addNewFlag&&(t.keepAspectRatio=this._addNewFlag,this._addNewFlag=null),t.onEndHandler(),0<this.cropBoxes.length&&null!=(t=this.selectedCallback)&&t.call(this,this.getRectArr()),this._activeBoxId=null))},e.checkSelect=function(t,e){var i=this.cropBoxes.length;if(0===i)return null;for(var n=i-1;0<=n;n--)if(null!==this.cropBoxes[n].isBoxSelected(t,e))return n;return null},e.checkSelectForCursor=function(t,e){var i=this.cropBoxes.length;if(0===i)return null;for(var n=i-1;0<=n;n--){var s,r=this.cropBoxes[n],o=r.isBoxSelected(t,e);if(null!==o)return s="move",-1!==o&&(s=r.checkPointPosition(o)),{part:o,type:r.type,position:s}}return null},e.dispose=function(){this.unselectedCallback=null,this.selectedCallback=null},t}(),$e=function(l){function t(t,e,i,n,s,r){var o=l.call(this,t,e,i,n,s,r)||this;return o.isInner=!0,o._isCrop=!1,o.cropIndex=-1,o.cropUid="",o._originEvents=[],o._tbEvents=[],o._viewerEvents=[],o.cropManager=new Ge(0,0,o.cropBoxStyle),o.cropManager.selectedCallback=function(t){var e=o.selectedIndexes.slice().pop(),i=o._thumbnailCanvas[e];i&&i.renderImg&&l.prototype._emit.call(je(o),ft,e,t)},o.cropManager.unselectedCallback=function(){for(var t=o.cropIndex,e=o._thumbnailCanvas.length,i=0;i<e;i++){var n=o._thumbnailCanvas[i];o.cropUid===n.uid&&(o.cropManager.cropBoxes=[],n.renderImg?o.setPageRect(n):n.setRect([]))}l.prototype._emit.call(je(o),vt,t)},o._initEvents(),o}h(t,l);var e=t.prototype;return e._initEvents=function(){var i=this,t=[Dt,Nt,Ot,At,Ht,Ft,Wt,Vt],e=[s,x,C,q,$,G,j,K];this._originEvents=e;for(var n=0;n<t.length;n++)this._packageEvent(e[n],t[n]);this._tbEvents=[[et,function(t){l.prototype._emit.call(i,jt,t)}],[rt,function(t,e){l.prototype._emit.call(i,rt,t,e)}],[s,function(t,e){i._cropStart(t,e)}],[B,function(t){i._cropUp(t)}],[S,function(t){l.prototype._emit.call(i,S,t)}]],this._tbEvents.forEach(function(t){var e;null!=(e=i._pubSub)&&e._on(t[0],t[1])}),this._viewerEvents=[[M,function(t){i._cropMove(t)}],[B,function(t){i._cropUp(t)}],[Pt,function(){i.cropManager.clear()}]],this._viewerEvents.forEach(function(t){i._on(t[0],t[1])})},e._initThumbnailConfig=function(t){this._pubSub=new E(t.pubsub);for(var e=Object.keys(t),i=0;i<e.length;i++){var n=e[i],s=t[n];"pubsub"!==n&&s!==undefined&&(this[n]=s)}},e.dispose=function(){var t,e=this;this._viewerEvents.forEach(function(t){e._off(t[0])}),l.prototype.dispose.call(this),this._pubSub&&(this._originEvents.forEach(function(t){e._pubSub._off(t)}),this._tbEvents.forEach(function(t){e._pubSub._off(t[0])})),this._originEvents=[],this._tbEvents=[],this._viewerEvents=[],null!=(t=this.cropManager)&&t.dispose(),this.cropManager=null},e._packageEvent=function(t,o){var a=this;this._pubSub._on(t,function(t,e){var i,n,s=t.index,r=t.pageX,t=t.pageY;-1===s?l.prototype._emit.call(a,o,e,{index:s,imageX:-1,imageY:-1,pageX:r,pageY:t}):a._thumbnailCanvas[s]&&(i=(n=a._getOriginPosition(s,e)).imageX,n=n.imageY,l.prototype._emit.call(a,o,e,{index:s,imageX:i,imageY:n,pageX:r,pageY:t}))})},e._getOriginPosition=function(t,e,i){void 0===i&&(i=!0);var n=null,s=null,r=null==(h=this._thumbnailElement.querySelector(".dvs-thumbLists"))?void 0:h.children;if(r){if(this.ifDragMoves)for(var o=-1,a=0;a<r.length;a++){var l=r[a];if((null==l||!l.classList.contains("dvs-activeThumb"))&&t===++o){s=this._thumbnailCanvas[(n=l)["dvs-defaultIndex"]];break}}else n=r[t],s=this._thumbnailCanvas[t];if(n){var h=n.getBoundingClientRect(),u=this._dataStore.getMid(s.uid);if(!s.renderImg||null==u||!u.tempWidth||null==u||!u.tempHeight)return{imageX:-1,imageY:-1};var c=e.clientX-h.left,e=e.clientY-h.top,d=s.renderImg.naturalWidth,_=s.renderImg.naturalHeight,p=s.fitRatio,c=c-(h.width-d/p)/2,e=e-(h.height-_/p)/2;return i&&(c<0||e<0||d/p<c||_/p<e)?{imageX:-1,imageY:-1}:(h=u.tempWidth/d,{imageX:Math.floor(c*p*h),imageY:Math.floor(e*p*h)})}}},e._cropStart=function(t,e){var t=t.index,i=this.selectedIndexes.slice().pop();if(-1!==t&&i===t&&this._isCrop){i=this._thumbnailCanvas[t];if(i&&i.renderImg){var t=this._getOriginPosition(t,e),n=t.imageX,t=t.imageY;if(-1!==n&&-1!==t){var s=this._dataStore.getMid(i.uid);if(null==s||!s.tempWidth||!s.tempHeight)return this._pubSub._emit(Tt,ze),!1;var r=s.tempWidth/i.renderImg.naturalWidth,o=i.fitRatio,a=this.cropManager;a.setZoom(1/o/r),a.setPageSize(s.tempWidth,s.tempHeight),a.onStartHandler(n,t,e.ctrlKey),i.setRect(a.cropBoxes),P(e)}}}},e._cropMove=function(t){var e,i,n,s,r;this.showThumbnail&&this._isCrop&&(-1!==(n=this.selectedIndexes.slice().pop())&&(e=this._thumbnailCanvas[n])&&(i=(n=this._getOriginPosition(n,t,!1)).imageX,n=n.imageY,(r=(s=this.cropManager).checkSelectForCursor(i,n))?(r="move"===r.position?"move":r.position+"-resize",l.prototype._emit.call(this,Te,r)):l.prototype._emit.call(this,Te,""),s.mouseDown&&(s.setKeepAspectRatio(t.shiftKey),s.onMoveHandler(i,n,!1),this.setPageRect(e))))},e._cropUp=function(t){this._isCrop&&this.cropManager.mouseDown&&this.cropManager.onEndHandler()},e.setPageRect=function(t){var e;t&&(e=this.cropManager.cropBoxes,t.setRect(e),t.render(!1))},e.setCropBoxStyle=function(t){Object.assign(this.cropBoxStyle,t),this.cropManager.setCropBoxStyle(this.cropBoxStyle);t=this.selectedIndexes.slice().pop(),t=this._thumbnailCanvas[t];t&&this._isCrop&&this.setPageRect(t)},e.setSelectedBoxLineColor=function(t){Object.assign(this.cropBoxStyle,{borderColor:t,ctrlBorderColor:t}),this.cropManager.setCropBoxStyle(this.cropBoxStyle);t=this.selectedIndexes.slice().pop(),t=this._thumbnailCanvas[t];t&&this._isCrop&&this.setPageRect(t)},e.setOperationMode=function(t){1===t?this._isCrop=!0:(this._isCrop=!1,this.clearSelectedBoxes())},e.setSelectedBoxes=function(t,e){e||this.cropManager.clear(),a(t)||(t=[t]);for(var e=this.selectedIndexes.slice().pop(),i=this._thumbnailCanvas[e],n=this._dataStore.getMid(i.uid),s=(this.cropManager.setPageSize((null==n?void 0:n.tempWidth)||0,(null==n?void 0:n.tempHeight)||0),t.length),r=0;r<s;r++){var o=t[r];this.cropManager.addBox([o.left,o.top,o.left+o.width,o.top,o.left+o.width,o.top+o.height,o.left,o.top+o.height],"bottomRight")}n=this.cropManager.getRectArr();this.setPageRect(i),l.prototype._emit.call(this,ft,e,n),l.prototype._emit.call(this,S,e,n)},e.setKeepAspectRatio=function(t){this.cropManager.setKeepAspectRatio(t)},e.setAspectRatio=function(t){this.cropManager.setAspectRatio(t)},e.clearSelectedBoxes=function(t){this.cropManager.clear()},t}(qe),Je=function(r){function t(t,e,i,n,s){e=r.call(this,e)||this;return e._viewerContainer=null,e._dataStore=null,e._thumbnails={},e.innerThumbnail=null,e._selectedIndexes=[],e._displayedUidsManage={},e._thumbnailContents=[],e._lastShowUid="",e._displayTimer=null,e.workBlobURL=null,e.postfix=t,e._viewerContainer=i,e._dataStore=n,e.workBlobURL=s,e._bindEvents(),e}h(t,r);var e=t.prototype;return e.createThumbnail=function(t){var e=t.uid,t=(e||(e=g(11),t.uid=e),new qe(t,this._oPub,this._viewerContainer,this.postfix,this._dataStore,this.workBlobURL));return(this._thumbnails[e]=t).updateContent(this._thumbnailContents),t.selectThumbnailByIndexes(this._selectedIndexes),!0},e.createInnerThumbnail=function(t){var e={uid:this.postfix,pubsub:new Oe,size:"100%",background:t.canvasBackground,mouseShape:t.canvasMouseShape,border:t.canvasBorder,location:"canvas",allowResizing:!1,showThumbnail:!1};f(t,e),this.innerThumbnail=new $e(e,this._oPub,this._viewerContainer,this.postfix,this._dataStore,this.workBlobURL)},e.removeThumbnail=function(t){var e=this._thumbnails[t];return!!e&&(e.unbindUi(),r.prototype._emit.call(this,"onSetSplitBar"),delete this._thumbnails[t],!0)},e.removeAllThumbnail=function(){var t,e;for(e in this._thumbnails)this.removeThumbnail(e);null!=(t=this.innerThumbnail)&&t.unbindUi(),null!=(t=this.innerThumbnail)&&t.dispose(),this._thumbnails={},this._viewerContainer=null,this._off(T),this._off(xe)},e.on=function(t,e){this._on(t,e.bind(this))},e._bindEvents=function(){var n=this;this.on(T,function(t,e){n._displayedUidsManage[e]=t,clearTimeout(n._displayTimer),n._displayTimer=setTimeout(function(){var t,e=new D;for(t in n._displayedUidsManage){var i=n._displayedUidsManage[t];e.array=e.concat(i)}r.prototype._emit.call(n,kt,e.array.slice())},100)}),this.on(xe,function(t){n._updatePageItem(t)})},e.calculateSize=function(){var t,e;for(e in this._thumbnails)this._thumbnails[e].calculateSize();null!=(t=this.innerThumbnail)&&t.calculateSize()},e.updateAllDisplayed=function(){var t,e;for(e in this._thumbnails)this._thumbnails[e].updateDisplayedUidsIE();null!=(t=this.innerThumbnail)&&t.updateDisplayedUidsIE()},e.showLatestPage=function(t){var e,i;for(i in this._thumbnails)this._thumbnails[i].showLatestPage(t);null!=(e=this.innerThumbnail)&&e.showLatestPage(t)},e.updatePagesLayout=function(){var t,e;for(e in this._thumbnails)this._thumbnails[e].updatePageLayout();null!=(t=this.innerThumbnail)&&t.updatePageLayout()},e.updateContents=function(t){var e,i;for(i in this._thumbnailContents=t,this._thumbnails)this._thumbnails[i].updateContent(t);null!=(e=this.innerThumbnail)&&e.updateContent(t)},e._updatePageItem=function(t){for(var e,i,n=this._thumbnailContents,s=0;s<n.length;s++)if(n[s].uid===t.uid){n[s]=t;break}for(i in this._thumbnails)this._thumbnails[i].updatePageItem(t);null!=(e=this.innerThumbnail)&&e.updatePageItem(t)},e.updateSelectedIndexes=function(t){var e,i;for(i in this._selectedIndexes=t,this._thumbnails)this._thumbnails[i].selectThumbnailByIndexes(t);null!=(e=this.innerThumbnail)&&e.selectThumbnailByIndexes(t)},e.pageChangeCallback=function(t,e,i){var n=this._thumbnailContents,s=this.innerThumbnail,r=this._lastShowUid,n=null==(n=n[e])?void 0:n.uid;n!==undefined&&r===n||(s.clearSelectedBoxes(),s.cropIndex=e,s.cropUid=n,this._lastShowUid=n)},e.keydownCallback=function(t,e){var i=this._thumbnails[e];i?i.keydownCallBack(t):e===this.innerThumbnail.uid&&(this.innerThumbnail.keydownCallBack(t),r.prototype._emit.call(this,Qt,t))},e.keyupCallback=function(t,e){var i=this._thumbnails[e];i?i.keyupCallBack(t):e===this.innerThumbnail.uid&&(this.innerThumbnail.keyupCallBack(t),r.prototype._emit.call(this,qt,t))},e.dispose=function(){r.prototype.dispose.call(this);for(var t,e=Object.keys(this._thumbnails),i=0,n=e.length;i<n;i++){var s=e[i],s=this._thumbnails[s];s&&s.dispose(),s=null}(this._thumbnails=null)!=(t=this.innerThumbnail)&&t.dispose(),this.innerThumbnail=null,this._viewerContainer=null,this._dataStore=null},t}(E),Ze=function(n){function t(t,e,i){e=n.call(this,e)||this;return e._xOver=!1,e._yOver=!1,e.isMyScroll=!1,e.buttonMove=!1,e._isButtonScroll=!1,e._unbindList=[],e._postfix=t,e._viewerContainer=i,e}h(t,n);var e=t.prototype;return e._myQuery=function(t,e){var i;return void 0===e&&(e="#"),null==(i=this._viewerContainer)||null==(i=i.el)?void 0:i.querySelector(e+t)},e._myQueryAll=function(t,e){var i;return void 0===e&&(e="#"),null==(i=this._viewerContainer)||null==(i=i.el)?void 0:i.querySelectorAll(e+t)},e.getImageSize=function(t){var e=this,i=this.setOuterSize(t.width,t.height);return this.setScroller(t.x,t.y),i&&setTimeout(function(){e.setViewPort(),n.prototype._emit.call(e,"_onCanvasResize")}),i},e.setScroller=function(t,e){var i=m("outer"+this._postfix);if(!i)return!1;var n=i.scrollLeft,s=i.scrollTop;return n===t&&s===e||(this.isMyScroll=!0),i.scrollLeft=t,i.scrollTop=e,!0},e.setOuterSize=function(t,e){var i=m("outer"+this._postfix),n=m("inner"+this._postfix),s=!1,r=!1;if(!i||!n)return!1;t>i.offsetWidth?(i.style.overflowX="auto",s=!0):i.style.overflowX="hidden",e>i.offsetHeight?(i.style.overflowY="auto",r=!0):i.style.overflowY="hidden",n.style.width=t+"px",n.style.height=e+"px";i=this._xOver!==s,t=this._yOver!==r;return this._xOver=s,this._yOver=r,i||t},e.setViewPort=function(){var t=m("outer"+this._postfix),e=m("viewPort"+this._postfix);if(!t||!e)return!1;var i=t.offsetWidth-t.clientWidth,t=t.offsetHeight-t.clientHeight;e.style.width="calc(100% - ".concat(i,"px)"),e.style.height="calc(100% - ".concat(t,"px)")},e._addButtonScroll=function(){var e,i=this,n=[],t=this._myQueryAll("dvs-groupType",".");t&&(e=c(),this._on(M,function(t){e?i.buttonScrollMoveMobile(t):i.buttonScrollMove(t)}),this._on(B,function(){i.buttonScrollEndFun()}),[].forEach.call(t,function(t){"ontouchstart"in document.documentElement?_(t,W,function(t){i.buttonScrollStartMobile(t)}):_(t,X,function(t){i.buttonScrollStart(t)}),i._unbindList=n;var e=t.querySelector(".dvs-showBefore"),e=(e&&(e.onclick=function(){t.scrollLeft=0,i._updateShowMore(t)}),t.querySelector(".dvs-showAfter"));e&&(e.onclick=function(){t.scrollLeft=t.scrollWidth-t.clientWidth,i._updateShowMore(t)})}))},e.buttonScrollStart=function(t){return(!t.button||0===t.button)&&(this._buttonScrollStartFun(t),!0)},e.buttonScrollStartMobile=function(t){t=t.changedTouches[0];return!!t&&(this._buttonScrollStartFun(t),!0)},e._buttonScrollStartFun=function(t){var e,i=t.target;if(i&&i.classList.contains("dvs-groupType"))e=i;else{if(!(i&&i.parentNode&&i.parentNode.classList.contains("dvs-groupType")))return!1;e=i.parentNode}this._isButtonScroll=!0,this._scrollStartInfo={x:t.clientX,y:t.clientY,left:e.scrollLeft,top:e.scrollTop,item:e}},e.buttonScrollMove=function(t){return this._buttonScrollMoveFun(t),!0},e.buttonScrollMoveMobile=function(t){t=t.changedTouches[0];return!!t&&(this._buttonScrollMoveFun(t),!0)},e._buttonScrollMoveFun=function(t){if(!this._isButtonScroll)return!1;var e=this._scrollStartInfo,i=e.x,n=e.y,s=e.left,r=e.top,e=e.item;e.scrollWidth>e.clientWidth&&(i=t.clientX-i,n=t.clientY-n,(5<Math.abs(i)||5<Math.abs(n))&&(this.buttonMove=!0,e.scrollLeft=s-i,e.scrollTop=r-n,this._updateShowMore(e),P(t)))},e.buttonScrollEndFun=function(){this._isButtonScroll=!1,this._scrollStartInfo={},document.removeEventListener(V,P)},e._updateShowMore=function(t){if(!t||0==t.children.length)return!1;5<=t.scrollWidth-t.clientWidth?t.style.justifyContent="flex-start":t.style.justifyContent="";var e=t.scrollLeft,i=5<=e,n=e+t.clientWidth<t.scrollWidth-5,s=t.querySelector(".dvs-showBefore");if(!s||"SPAN"!==s.tagName)return!1;i&&60<=t.clientWidth?s.classList.remove("dvs-nodisplay"):s.classList.add("dvs-nodisplay");i=t.querySelector(".dvs-showAfter");n&&60<=t.clientWidth?i.classList.remove("dvs-nodisplay"):i.classList.add("dvs-nodisplay"),e=t.scrollLeft,s.style.left=e+"px",i.style.right=-e+"px"},e.updateAllGroupShowMore=function(){var e=this,t=this._myQueryAll("dvs-groupType",".");t&&[].forEach.call(t,function(t){e._updateShowMore(t)})},e.unbindEvents=function(){this._unbindList.forEach(function(t){null!=t&&t()})},e.dispose=function(){n.prototype.dispose.call(this),this.unbindEvents()},t}(E),ti=function(i){function t(t,e){e=i.call(this,e)||this;return e._currentPage=-1,e._totalPage=0,e._postfix=t,e}h(t,i);var e=t.prototype;return e.goToPage=function(t){this._emit(Ue,t)},e.getCurrentPage=function(){return this._currentPage},e.setCurrentPage=function(t){return!!p(t)&&(this._currentPage=t,!0)},e.getTotalPage=function(){return this._totalPage},e.setTotalPage=function(t){return!!p(t)&&(this._totalPage=t,!0)},e.updatePage=function(t){var e=document.getElementById("pagerInput"+this._postfix),i=document.getElementById("pagerLabel"+this._postfix),n=t.cur,t=t.total;this.setCurrentPage(n),this.setTotalPage(t),e&&i&&(e.value=t?n+1:0,i.innerText=String(t),e.style.fontSize="16px",n=16*String(t).length+"px",e.style.width=n)},e.pageBlur=function(t){var t=t.target,e=parseInt(t.value);t.value=String(this._currentPage+1),this.goToPage(e-1)},t}(E),ei=function(){function t(t){this.id="",this.name="",this.type="",this.iconClass="",this._init(t)}return t.prototype._init=function(t){for(var e=Object.keys(t),i=0;i<e.length;i++){var n=e[i];n!==undefined&&(this[n]=t[n])}},t}(),ii=function(){function t(t,e,i,n,s){return this.createVNode(t,e,i,n,s)}var e=t.prototype;return e.createVNode=function(t,e,i,n,s){return this._updateVNode({el:n,tagName:t,sel:"",data:e=void 0===e?{}:e,children:i=void 0===i?[]:i,text:s=void 0===s?"":s})},e._updateVNode=function(t){var e=this,i=(o(t.data)||(t.data={}),a(t.children)||(t.children=[]),t.data.id),n=t.tagName;return i?(n+="#".concat(i),t.sel=n):t.data.class&&(n+=".".concat(t.data.class),t.sel=n),t.children.forEach(function(t){return e._updateVNode(t)}),t},t}(),ni={createVnode:function(t,e,i,n,s){if(void 0===i&&(i=[]),o(e=void 0===e?{}:e)&&a(i))return new ii(t,e,i,n,s)},sameVnode:function(t,e){return e.data.key===t.data.key&&e.data.key!==undefined||(e.tagName===t.tagName||e.text===t.text&&t.text!==undefined)},createKeyHashList:function(t,e,i){for(var n,s={},r=e;r<=i;++r)(n=t[r])&&n.data&&(n=n.data.key)&&(s[n]=r);return s},removeVnodes:function(t,e,i){for(;e<=i;){var n,s=t[e];null==s||!s.el||(n=s.el.parentElement)&&n.removeChild(s.el),++e}},addVnodes:function(i,n,s,r,t){for(var o=this,a=function a(){var t,e=s[r];e&&(e.el||(e.el=document.createElement(e.tagName),Object.keys(e.data).forEach(function(t){"class"===t?e.el.className=e.data[t]:"style"===t?e.el.setAttribute(t,e.data[t]):e.el[t]=e.data[t]})),e.text&&(e.el.textContent=e.text),L(e.el,n,i),(t=e.children)&&t.length&&o.addVnodes(e.el,null,t,0,t.length)),++r};r<=t;)a()},addOneVnode:function(t,e,i){if(!t||!t.children)return!1;var n=t.children[e]&&t.children[e].el;return t.children.splice(e,0,i),this.addVnodes(t.el,n,[i],0,0)},patchVnode:function(e,i){var t=i.el=e.el,n=(Object.keys(i.data).forEach(function(t){e.el[t]!==i.data[t]&&("class"===t||"style"===t?e.el.setAttribute(t,i.data[t]):e.el[t]=i.data[t],e.data[t]=i.data[t])}),e.children),s=i.children;e!==i&&(""!==i.text&&e.text!==i.text?t.textContent=i.text:n.length&&s.length&&n!==s?this.updateChildren(t,n,s):s&&s.length?this.addVnodes(t,null,s,0,s.length):n&&n.length&&this.removeVnodes(n,0,n.length))},updateChildren:function(t,e,i){for(var n,s,r,o,a=0,l=0,h=e.length-1,u=i.length-1,c=e[0],d=e[h],_=i[0],p=i[u];a<=h&&l<=u;)null==c?c=e[++a]:null==d?d=e[--h]:null==_?_=i[++l]:null==p?p=i[--u]:this.sameVnode(c,_)?(this.patchVnode(c,_),c=e[++a],_=i[++l]):this.sameVnode(d,p)?(this.patchVnode(d,p),d=e[--h],p=i[--u]):this.sameVnode(c,p)?(this.patchVnode(c,p),L(c.el,d.el.nextSibling,t),c=e[++a],p=i[--u]):_=(this.sameVnode(d,_)?(this.patchVnode(d,_),L(d.el,c.el,t),d=e[--h]):(s=(n=n===undefined?this.createKeyHashList(e,a,h):n)[_.data.key])===undefined?this.addVnodes(t,c.el,i,l,l):(r=e[s]).sel!==_.sel?this.addVnodes(t,c.el,e,s,s):(this.patchVnode(r,_),L(_.el,c.el,t),e[s]=null),i[++l]);h<a?(o=i[u+1]?i[u+1].el:null,this.addVnodes(t,o,i,l,u)):u<l&&this.removeVnodes(e,a,h)},patch:function(t,e){var i,n;return this.sameVnode(t,e)?this.patchVnode(t,e):null!==(n=(i=t.el).parentNode)&&(L(e.el,i.nextSibling,n),n.removeChild(t.el),t=null),e}},si=function(){function t(t,e,i){this._viewerContainer=null,this._postfix="",this._tabList=[],this._tabVNode=null,this._selectedTabId="",this._postfix=t,this._viewerContainer=i}var e=t.prototype;return e.tabRenderInit=function(){var t=null==(t=this._viewerContainer)||null==(t=t.el)?void 0:t.querySelector("#tabList"+this._postfix);this._tabVNode=ni.createVnode("DIV",{},[],t)},e.tabDestroy=function(){this._tabVNode=null},e.updateTabList=function(t){var e=t.selectedTabId,t=t.tabs,t=(this._updateTabData(t),this._createVirtualTab(t));this._tabVNode=ni.patch(this._tabVNode,t),this.selectTabById(e)},e.getSelectedIndex=function(){for(var t,e=0;e<this._tabList.length;e++)if((null==(t=this._tabList[e])?void 0:t.id)===this._selectedTabId)return e;return-1},e.selectTabByIndex=function(t){return this._tabList[t]!==undefined&&(this._selectedTabId=null==(t=this._tabList[t])?void 0:t.id,this._updateSelectedStyle(),!0)},e.selectTabById=function(t){this._selectedTabId=t,this._updateSelectedStyle()},e.closeTabById=function(t){},e._updateSelectedStyle=function(){var t=null==(t=this._viewerContainer)||null==(t=t.el)?void 0:t.querySelector("#tabList"+this._postfix);if(t)for(var e=null==t?void 0:t.children,i=0;i<e.length;i++){var n=e[i];null!=n&&n.classList[(null==n?void 0:n.id)===this._selectedTabId?"add":"remove"]("dvs-activeTab")}},e._updateTabData=function(t){for(var e=[],i=0;i<t.length;i++){var n=this._createTabItem(t[i]);e.push(n)}this._tabList=e},e._createTabItem=function(t){return new ei(t)},e._createVirtualTab=function(t){for(var e=ni.createVnode,i=e("DIV"),n=0,s=t.length;n<s;n++){var r,o=t[n],o=e("DIV",{class:"dvs-tabItem ".concat(o.id===this._selectedTabId?"dvs-activeTab":""),id:o.uid,key:o.uid,title:o.name},[e("SPAN",{class:o.iconClass||""}),e("SPAN",{class:"dvs-tabText"},[],null,o.name),e("A",{class:"ds-dvs-ui-iconfont ds-dvs-ui-cancel dvs-closeTab","dvs-id":o.uid})]);null!=(r=i.children)&&r.push(o)}return i},e.dispose=function(){},t}(),ri=function(r){function t(t){var e=t.postfix,i=t.pubsub,t=t.viewerContainer,i=r.call(this,i)||this;return i._postfix="",i._viewerContainer=null,i._width=0,i._height=0,i._innerWidth=0,i._innerHeight=0,i._scrollLeft=0,i._scrollTop=0,i._canvasList=[],i._postfix=e,i._viewerContainer=t,i}h(t,r);var e=t.prototype;return e._query=function(t){var e;return null==(e=this._viewerContainer)||null==(e=e.el)?void 0:e.querySelector("#"+t+this._postfix)},e.canvasRenderInit=function(){this._createCanvas("main"),this._createCanvas("cropper"),this._createSlider()},e.updateCanvasInnerSize=function(){var t,e=this._query("canvasScroll"),i=null==(i=this._query("innerThumbnail"))?void 0:i.querySelector(".dvs-thumbLists");return!(!e||!i)&&(t=e.offsetWidth||i.offsetWidth,e=e.offsetHeight||i.offsetHeight,0!==t&&0!==e&&void r.prototype._emit.call(this,"_setCanvasSize",{width:t,height:e}))},e.updateScrollSize=function(t){var e=t.width,i=t.height,n=t.x,t=t.y,s=(0<e&&0<i&&(this._innerWidth=e,this._innerHeight=i,(s=this._query("scrollInner"))&&(s.style.width=e-1+"px",s.style.height=i-1+"px")),n===this._scrollLeft&&t===this._scrollTop||((e=this._query("canvasScroll"))&&(this._scrollLeft=e.scrollLeft=n,this._scrollTop=e.scrollTop=t),e=null),this._query("canvasWrapper")),i=this._query("canvasScroll");if(s&&i)for(var r=i.clientWidth,o=i.clientHeight,a=(s.style.width=r+"px",s.style.height=o+"px",y()),l=null==s?void 0:s.children,h=0;h<l.length;h++){var u,c,d=l[h];"CANVAS"===d.tagName&&(c=o*a,d.width!==(u=r*a)&&(d.width=u),d.height!==c&&(d.height=c)),d=null}},e._createSlider=function(){var t=this._query("viewPort");if(!t)return null;for(var e=document.createElement("div"),i=(e.className="dvs-slideWrapper",0);i++<3;){var n=document.createElement("div"),s=document.createElement("img");n.className="dvs-slideItem",s.className="dvs-slideImg",n.appendChild(s),e.appendChild(n)}t.appendChild(e),t=null,r.prototype._emit.call(this,Rt,e)},e._removeSlider=function(){var t=this._query("viewPort");if(!t)return null;var e=t.querySelector(".dvs-slideWrapper");r.prototype._emit.call(this,Lt),e&&t.removeChild(e)},e._createCanvas=function(t){var e=this._query("canvasWrapper");if(!e)return null;var i=document.createElement("canvas");i.id=t+"Canvas"+this._postfix,i.className="dvs-canvas dvs-"+t,e.appendChild(i),r.prototype._emit.call(this,"_bindCanvas",((e={})[t]=i,e)),this._canvasList.push(t)},e._removeCanvas=function(t){var e=this._query("canvasWrapper");if(!e)return null;var i=this._query(t+"Canvas");if(!i)return null;e.removeChild(i),r.prototype._emit.call(this,"_unbindCanvas",t);for(var n=0;n<this._canvasList.length;n++)if(this._canvasList[n]===t){this._canvasList.splice(n,1);break}return i},e.removeAllCanvas=function(){for(var t=0;t<this._canvasList.length;t++)this._removeCanvas(this._canvasList[t])&&t--;this._removeSlider()},e.dispose=function(){r.prototype.dispose.call(this)},t}(E),N=function(o){function t(t,e,i,n,s,r){n=o.call(this,n)||this;return n._sideRender=null,n._thumbnailRender=null,n._directoryRender=null,n._tagRender=null,n._scrollRender=null,n._pagerRender=null,n._tabRender=null,n._canvasRender=null,n._uiRender=null,n._dataStore=null,n._uiEventControl=null,n.uiConfig=null,n._viewerContainer=null,n.containerBox=null,n.useMyEvent=!0,n.topMenuColor="#3a393b",n.topMenuBorder="1px solid #1b1b1d",n.headerColor="#2a292b",n.footerColor="#434246",n.asideMenuColor="#434246",n.viewerBorderColor="#1b1b1d",n.canvasBackground="#434246",n.canvasBorder="0px solid #1b1b1d",n.canvasMouseShape="default",n.outerBorder="1px solid #1b1b1d",n._videoImageReady=!0,n._updateVideoTimer=null,n.showViewer=!0,n.showTopMenu=!0,n.showHeader=!0,n.showSidebar=!1,n.showTab=!1,n.showAside=!1,n.showMain=!0,n.showFooter=!0,n.showVideoContainer=!1,n.width="100%",n.height="100%",n.showWidth=-1,n.showHeight=-1,n._eventList={},n._resizeTimer=null,n._showLatestQueue={},n.postfix=i,n.uiConfig=e,n._dataStore=s,n.workBlobURL=r,n._initViewer(t,e),n}h(t,o);var e=t.prototype;return e._myQuery=function(t){var e;return null==(e=this._viewerContainer)||null==(e=e.el)?void 0:e.querySelector("#"+t)},e._myQueryAll=function(t){var e;return null==(e=this._viewerContainer)||null==(e=e.el)?void 0:e.querySelectorAll("#"+t)},e._initViewer=function(t,e){if(!t)return!1;if(u(t))t=document.getElementById(t);else if(!r(t))return!1;return this.containerBox=t,this._createMember(e,t),this._initMember(),this._initStatus(e),this._bindUiEvent(),this._bindButtonEvent(),!0},e._createMember=function(t,e){var i=this.postfix,n=this._oPub,e=(this._uiRender=new Xe({postfix:i,container:e,uiConfig:t,pubsub:n}),this._uiRender.viewerContainer);this._viewerContainer=e,this._thumbnailRender=new Je(i,n,e,this._dataStore,this.workBlobURL),this._scrollRender=new Ze(i,n,e),this._pagerRender=new ti(i,n),this._uiEventControl=new Ne(i,n,e),this._tabRender=new si(i,n,e),this._canvasRender=new ri({postfix:i,pubsub:n,viewerContainer:e})},e._initMember=function(){var t;null!=(t=this._sideRender)&&t.sidebarInit(),this._scrollRender._addButtonScroll(),this._uiEventControl.uiEventInit(),this._tabRender.tabRenderInit(),this._canvasRender.canvasRenderInit()},e._initStatus=function(t){this.setViewerWidth(t.width),this.setViewerHeight(t.height),this.setShowViewer(t.showViewer),this.setOuterBorder(t.outerBorder),this.setFooterColor(t.footerColor),this.setHeaderColor(t.headerColor),this.setTopMenuColor(t.topMenuColor),this.setTopMenuBorder(t.topMenuBorder),this.setShowMain(t.showMain),this.setSidebarWidth(t.sidebarWidth),this.setShowVideoContainer(t.showVideoContainer),this.setShowTab(t.showTab),this.setCanvasBackground(t.canvasConfig.canvasBackground),this.setCanvasMouseShape(t.canvasConfig.canvasMouseShape),this.setCanvasBorder(t.canvasConfig.canvasBorder),this.setLoadingImage(t.canvasConfig.loadingImageUrl),this._setShowLoadingImage(!1)},e.unbindView=function(){var t=null==(t=this._viewerContainer)?void 0:t.el;if(!t)return!1;var e=t.parentNode;return e&&(this._unbindStatus(),e.removeChild(t),e=null,this._viewerContainer.el=null),!0},e.updateUiSetting=function(t){},e._bindUiEvent=function(){(t={})[k]=this._resizeViewer,t[M]=this._documentMouseMove,t[B]=this._documentMouseUp,t[se]=this._documentClick,t[$t]=this._viewerClick,t[Jt]=this._viewerRightClick,t[Zt]=this._viewerMove,t[re]=this._sideBarClick,t[oe]=this._sidebarStretchStart,t[be]=this._openDefaultTag,t[ae]=this._fileListClick,t[le]=this._fileListRightClick,t[he]=this._fileListKeyUp,t[ue]=this._addNewFolder,t[_e]=this._tagListClick,t[pe]=this._tagListRightClick,t[fe]=this._tagListKeyUp,t[ve]=this._addNewTag,t[ke]=this._pagerBlur,t[Be]=this._setScrollerSize,t[Te]=this.setCanvasCursorTemp,t[Gt]=this._setShowLoadingImage,t[Pe]=this._tabChanged,t[Re]=this._tabListClick,t[Le]=this._closeSaveSettingBox,t.onPanelChange=this._togglePaneBox,t.onSetSplitBar=this._setSplitBar,t[te]=this._showLatestPage,t[ee]=this._updatePagesLayout,t[Ee]=this._customButtonClick,t[me]=this._tagRefresh,t[ge]=this._tagSelectedCallback,t[ye]=this._imageSelectedCallback,t[ce]=this._directoryRefresh,t[de]=this._fileSelectedCallback,t[Me]=this._pagerRefresh,t[we]=this._thumbnailRefresh;var t,e,i=t;for(e in i)this._viewOn(e,i[e]);this._eventList=i},e._unbindStatus=function(){for(var t=Object.keys(this._eventList),e=0;e<t.length;e++){var i=t[e];this._viewOff(i)}this._eventList=null,this._uiEventControl.unbindEvents(),this._tabRender=null,this._tagRender=null,this._directoryRender=null,this._thumbnailRender.removeAllThumbnail(),this._canvasRender.removeAllCanvas(),this._scrollRender.unbindEvents(),this._uiRender.unbindContent()},e._bindButtonEvent=function(){var n=this,s=this.uiConfig.buttons;Object.keys(s).forEach(function(t){var e,i=s[t],t=null==(e=n._viewerContainer)||null==(e=e.el)?void 0:e.querySelector("#".concat(t).concat(n.postfix));if(!t)return!1;t.classList.add("dvs-iconColor"),i.iconClass===undefined&&t.classList.add("dvs-emptyBtn"),i.onButtonClick&&_(t,w,function(t){n._scrollRender.buttonMove?n._scrollRender.buttonMove=!1:(t.changedTouches,n._viewEmit(i.onButtonClick,t))})})},e._viewOn=function(t,e){this._on(t,e.bind(this))},e._viewOff=function(t,e){this._off(t,e)},e._viewEmit=function(t){for(var e=arguments.length,i=new Array(1<e?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];this._emit.apply(this,[t].concat(i))},e.setShowViewer=function(t){var e=null==(e=this._viewerContainer)?void 0:e.el;return this.showViewer=t,!!e&&(this._viewEmit(Ct,this.showViewer&&this.showMain),t?(e.classList.remove("dvs-disabled"),this._resizeViewer(),this._showLatestPage()):e.classList.add("dvs-disabled"),!0)},e.setShowTopMenu=function(t){var e=this._myQuery("topMenu"+this.postfix);return this.showTopMenu=t,!!e&&(t?e.classList.remove("dvs-disabled"):e.classList.add("dvs-disabled"),this._resizeViewer(),!0)},e.setShowHeader=function(t){var e=this._myQuery("header"+this.postfix);return this.showHeader=t,!!e&&(t?e.classList.remove("dvs-disabled"):e.classList.add("dvs-disabled"),this._resizeViewer(),!0)},e.setShowSidebar=function(t){this.showSidebar=t;var e,t=null==(e=this._sideRender)?void 0:e.setShowSidebar(t);return this._resizeViewer(),t},e.setShowAside=function(t){var e=this._myQuery("asideMenu"+this.postfix);return this.showAside=t,!!e&&(t?e.classList.remove("dvs-disabled"):e.classList.add("dvs-disabled"),this._resizeViewer(),!0)},e.setShowMain=function(t){var e=this._myQuery("container"+this.postfix);return this.showMain=t,!!e&&(t?e.classList.remove("dvs-disabled"):e.classList.add("dvs-disabled"),this._viewEmit(Ct,this.showMain&&this.showViewer),this._resizeViewer(),!0)},e.setShowFooter=function(t){var e=this._myQuery("bottomMenu"+this.postfix);return this.showFooter=t,!!e&&(t?e.classList.remove("dvs-disabled"):e.classList.add("dvs-disabled"),this._resizeViewer(),!0)},e.setShowTab=function(t){var e=this._myQuery("tabList"+this.postfix);return this.showTab=t,!!e&&(t?e.classList.remove("dvs-disabled"):e.classList.add("dvs-disabled"),this._resizeViewer(),!0)},e.setHeaderColor=function(t){if(!t)return!0;var e=this._myQuery("header"+this.postfix);return this.headerColor=t,e&&(e.style.background=t),!0},e.setTopMenuColor=function(t){if(!t)return!0;var e=this._myQuery("topMenu"+this.postfix);return this.topMenuColor=t,e&&(e.style.background=t),!0},e.setTopMenuBorder=function(t){if(!t)return!0;var e=this._myQuery("topMenu"+this.postfix);return this.topMenuBorder=t,e&&(e.style.border=t),this._resizeViewer(),!0},e.setFooterColor=function(t){if(!t)return!0;var e=this._myQuery("bottomMenu"+this.postfix);return this.footerColor=t,e&&(e.style.background=t),!0},e.setAsideMenuColor=function(t){if(!t)return!0;this.asideMenuColor=t;var e=this._myQuery("asideMenu"+this.postfix);return e&&(e.style.background=t),!0},e.setViewerBorderColor=function(t){var e,i,n,s;t&&(e=null==(e=this._viewerContainer)?void 0:e.el,i=this._myQuery("Thumbnail"+this.postfix),n=this._myQuery("content"+this.postfix),s=this._myQuery("middle"+this.postfix),e&&(e.style.borderColor=t),i&&(i.style.borderColor=t),n&&(n.style.borderColor=t),s&&(s.style.borderColor=t),this.viewerBorderColor=t)},e.setOuterBorder=function(t){var e,i;t&&(this.outerBorder=t,(e=null==(e=this._viewerContainer)?void 0:e.el)&&(e.style.border=t),e=this._myQuery("container"+this.postfix),i=this._myQuery("middle"+this.postfix),e&&i&&(t=t.split(" "),e.style.borderStyle=t[1],e.style.borderColor=t[2],i.style.borderStyle=t[1],i.style.borderColor=t[2],this._setSplitBar()),this._resizeViewer())},e.setViewerWidth=function(t){var e=null==(e=this._viewerContainer)?void 0:e.el;if(this.width=t,!e)return!1;var i=String(t);return/\d+$/.test(i)&&(t=i+"px"),e.style.width="".concat(t),this._resizeViewer(),this._showLatestPage(),!0},e.getViewerWidth=function(){var t=null==(t=this._viewerContainer)?void 0:t.el;return t?t.offsetWidth:this.width},e.setViewerHeight=function(t){var e=null==(e=this._viewerContainer)?void 0:e.el;if(this.height=t,!e)return!1;var i=String(t);return/\d+$/.test(i)&&(t=i+"px"),e.style.height="".concat(t),this._resizeViewer(),this._showLatestPage(),!0},e.getViewerHeight=function(){var t=null==(t=this._viewerContainer)?void 0:t.el;return t?t.offsetHeight:this.height},e.setSidebarWidth=function(t){var e,t=null==(e=this._sideRender)?void 0:e.setSidebarWidth(t);return this._resizeViewer(),t},e.getSidebarWidth=function(){var t;return null==(t=this._sideRender)?void 0:t.getSidebarWidth()},e.setShowVideoContainer=function(t){var e=this._myQuery("container"+this.postfix);if(!e)return!1;for(var i=e.children,n=0,s=i.length;n<s;n++){var r=i[n];if(null!=r&&r.classList.contains("dvs-customElement"))break;r.classList.contains("dvs-videoContainer")?t?r.classList.remove("dvs-hideVideoContainer"):r.classList.add("dvs-hideVideoContainer"):t?r.classList.add("dvs-hideVideoContainer"):r.classList.remove("dvs-hideVideoContainer")}return(this.showVideoContainer=t)||(this._resizeViewer(),this._showLatestPage()),!0},e.switchToTagTab=function(){var t=this._myQuery("TagsNav"+this.postfix),t=t&&t.children[0];return!!t&&(t.click(),!0)},e.switchToTreeTab=function(){var t=this._myQuery("DirctoryTreeNav"+this.postfix),t=t&&t.children[0];return!!t&&(t.click(),!0)},e.showGroup=function(t){t=this._myQuery(t+this.postfix);return!!t&&(t.classList.remove("dvs-disabled"),t.classList.remove("dvs-noDisplay"),!0)},e.hideGroup=function(t){t=this._myQuery(t+this.postfix);return!!t&&(t.classList.add("dvs-disabled"),t.classList.add("dvs-noDisplay"),!0)},e._documentMouseMove=function(t){},e._documentMouseUp=function(t){var e;return!(null==(e=this._viewerContainer)||!e.el||!t)&&((!t.button||0===t.button)&&void(null!=(e=this._sideRender)&&e.stretchMouseUp()))},e.documentKeyDown=function(t,e){e?this._thumbnailRender.keydownCallback(t,e):this._viewEmit(Qt,t)},e.documentKeyUp=function(t,e){e?this._thumbnailRender.keyupCallback(t,e):this._viewEmit(qt,t)},e._documentClick=function(t){this._viewEmit(xt,{viewerId:undefined,thumbnailId:undefined})},e.styleChange=function(){if(!this.showViewer)return!1;if(this.uiConfig.buttonResize.ifResize)if(c()){var t=null==(t=this._viewerContainer)?void 0:t.el;if(!t)return;t.classList.add("dynamsoft-dwt-imageEditor"),t=null}else this._changeButtonSize();t=this._myQuery("topMenuRight"+this.postfix);t&&(t.parentElement.style.paddingRight=(t.getBoundingClientRect().width||0)+"px"),this._thumbnailRender.calculateSize(),this._thumbnailRender.updateAllDisplayed(),this.updateVideoSize(),this._scrollRender.updateAllGroupShowMore(),this._canvasRender.updateCanvasInnerSize(),this._sendViewSize()},e._viewerClick=function(t){},e._viewerRightClick=function(t){},e._viewerMove=function(t){var e;null!=(e=this._sideRender)&&e.stretchMouseMove(t)},e._sendViewSize=function(){var t=null==(t=this._viewerContainer)?void 0:t.el;return!!t&&(0!==(t=t.getBoundingClientRect()).width&&0!==t.height&&(Math.round(t.width)!==Math.round(this.showWidth)||Math.round(t.height)!==Math.round(this.showHeight))&&(this.showWidth=Math.round(t.width),this.showHeight=Math.round(t.height),void this._viewEmit(st,t.width,t.height)))},e.createThumbnail=function(t){return this._thumbnailRender.createThumbnail(t)},e.createInnerThumbnail=function(){this._thumbnailRender.createInnerThumbnail(this.uiConfig.canvasConfig)},e.removeThumbnail=function(t){t=this._thumbnailRender.removeThumbnail(t);return this._setSplitBar(),t},e._sideBarClick=function(t){var e;null!=(e=this._sideRender)&&e.setShowNavigationBox(!1)},e._sidebarStretchStart=function(t){var e;null!=(e=this._sideRender)&&e.stretchMouseDown(t)},e._openDefaultTag=function(){this._directoryRender&&this._tagRender&&(this._viewEmit("_onOpenAll"),this._myQuery("defaultTag"+this.postfix).classList.add("dvs-activeAllImage"),this._tagRender.selectTagByName(""),this._directoryRender.selectFileByName(""))},e._fileListClick=function(t){var e=this._directoryRender;e&&(e.confirmFolder(t),e.cancelFolder(t),e.enterFolder(t))},e._fileListRightClick=function(t){},e._fileListKeyUp=function(t){var e;13===t.keyCode?(e=t.target.nextSibling.children[0])&&e.click():27===t.keyCode&&(e=t.target.nextSibling.children[1])&&e.click()},e._addNewFolder=function(t){var e;null!=(e=this._directoryRender)&&e.addNewFolder(t)},e._tagListClick=function(t){var e=t.target,i=this._tagRender;if(!e||!i)return!1;e.classList.contains("confirmTag")||e.classList.contains("renameConfirmTag")?i.confirmTag(e):e.classList.contains("cancelTag")?i.cancelTag(e):e.classList.contains("dvs-quickEdit")?i.quickRenameTag(e):e.classList.contains("dvs-quickDel")?i.quickDelTag(e):i.showTagContent(t)},e._tagListRightClick=function(t){},e._tagListKeyUp=function(t){var e;13===t.keyCode?(e=t.target.nextSibling.children[0])&&e.click():27===t.keyCode&&(e=t.target.nextSibling.children[1])&&e.click()},e._addNewTag=function(t){var e;null!=(e=this._tagRender)&&e.addNewTag(t)},e._pagerBlur=function(t){this._pagerRender.pageBlur(t)},e.setInnerTbProp=function(t,e){var i;this._handleInnerProp(t,e),null!=(i=this._thumbnailRender.innerThumbnail)&&i.handleInnerProp(t,e)},e._handleInnerProp=function(t,e){this[t]=e;t="set"+t.replace(/^[a-z]{1}/,function(t){return t.toUpperCase()});l(this[t])&&this[t](e)},e.setCanvasBackground=function(t){this.canvasBackground=t;var e=this._myQuery("mainCanvas"+this.postfix),i=(e&&(e.style.background="",setTimeout(function(){e.style.background=t})),this._thumbnailRender.innerThumbnail&&(this._thumbnailRender.innerThumbnail.background=t),null==(i=this._viewerContainer.el)?void 0:i.querySelector(".dvs-slideWrapper"));i&&(i.style.background=t)},e.setCanvasBorder=function(t){this.canvasBorder=t;var e=this._myQuery("viewPort"+this.postfix);e&&(e.style.border=t),this._thumbnailRender.innerThumbnail&&(this._thumbnailRender.innerThumbnail.border=t),this._resizeViewer()},e.setCanvasMouseShape=function(t,e){(e=void 0===e?!1:e)||(this.canvasMouseShape=t,this._viewEmit(Kt,t));e=this._myQuery("canvasWrapper"+this.postfix);e&&(e.style.cursor=t),this._thumbnailRender.innerThumbnail&&(this._thumbnailRender.innerThumbnail.mouseShape=t)},e.setCanvasCursorTemp=function(t){this.setCanvasMouseShape(t||this.canvasMouseShape,!0)},e.setCropBoxStyle=function(t){this._thumbnailRender.innerThumbnail.setCropBoxStyle(t)},e.setSelectedBoxLineColor=function(t){this._thumbnailRender.innerThumbnail.setSelectedBoxLineColor(t)},e.setOperationMode=function(t){this._thumbnailRender.innerThumbnail.setOperationMode(t)},e.setSelectedBoxes=function(t,e){this._thumbnailRender.innerThumbnail.setSelectedBoxes(t,e)},e.clearSelectedBoxes=function(t){this._thumbnailRender.innerThumbnail.clearSelectedBoxes(t)},e.setKeepAspectRatio=function(t){this._thumbnailRender.innerThumbnail.setKeepAspectRatio(t)},e.setAspectRatio=function(t){this._thumbnailRender.innerThumbnail.setAspectRatio(t)},e._setScrollerSize=function(t){this._canvasRender.updateScrollSize(t)},e._tabChanged=function(t){this._tabRender.updateTabList(t)},e._tabListClick=function(t){t=t.target;null==t||!t.classList.contains("dvs-closeTab")||null!=t&&t["dvs-id"]},e._tagRefresh=function(t){var e;null!=(e=this._tagRender)&&e.updateTagList(t)},e._tagSelectedCallback=function(t){var e;null!=(e=this._tagRender)&&e.selectTagByName(t)},e._imageSelectedCallback=function(t){return this._thumbnailRender.updateSelectedIndexes(t)},e._directoryRefresh=function(t){if(!this._myQuery("treeLists"+this.postfix)||!this._directoryRender)return!1;this._directoryRender.updateDirectory(t);t=this._myQuery("addFolder"+this.postfix);t&&t.style&&(t.style.pointerEvents="auto")},e._fileSelectedCallback=function(t){var e;null!=(e=this._directoryRender)&&e.selectFileByName(t)},e._pagerRefresh=function(t){var e=t.cur,i=t.total,n=this._pagerRender.getCurrentPage();this._pagerRender.getTotalPage();this._thumbnailRender.pageChangeCallback(n,e,i),this._pagerRender.updatePage(t),this._showLatestPage(e)},e._thumbnailRefresh=function(t){this._thumbnailRender.updateContents(t)},e.setDisplayMode=function(t){var e,i=this._myQuery("viewPort"+this.postfix),n=this._thumbnailRender.innerThumbnail;if("single"===t)n.clearSelectedBoxes(),null!=(e=this._myQuery("innerThumbnail"+this.postfix))&&e.classList.add("dvs-disabled"),null!=i&&i.classList.remove("dvs-disabled"),n.showThumbnail=!1;else{if("continuous"!==t)return!1;null!=i&&i.classList.add("dvs-disabled"),null!=(e=this._myQuery("innerThumbnail"+this.postfix))&&e.classList.remove("dvs-disabled"),n.showThumbnail=!0}return this._resizeViewer(),!0},e.setViewMode=function(t,e){return this._thumbnailRender.innerThumbnail.setViewMode(t,e)},e._togglePaneBox=function(){var t,e=null==(e=this._sideRender)?void 0:e.getShowNavigation();null!=(t=this._sideRender)&&t.setShowNavigationBox(!e)},e._customButtonClick=function(t,e){this._scrollRender.buttonMove?this._scrollRender.buttonMove=!1:this._viewEmit(t,e)},e._closeSaveSettingBox=function(){},e._setSplitBar=function(){var t=this._myQuery("container"+this.postfix),e=this._myQuery("middle"+this.postfix);if(!t||!e)return!1;var i,n,s=Object.keys(this._thumbnailRender._thumbnails),s=this._thumbnailRender._thumbnails[s[0]];!s||null==s||!s.showThumbnail||null!=s&&s.fullThumbnail?(t.style.borderWidth="0px",e.style.borderWidth="0px"):(n=this.outerBorder.split(" ")[0],i="horizontal"===s.location,s=s.sequence,n=this._getBorderWidth(n,i,s),i?(t.style.borderWidth=n,e.style.borderWidth="0px"):(e.style.borderWidth=n,t.style.borderWidth="0px")),this._resizeViewer()},e._changeButtonSize=function(){var t=null==(t=this._viewerContainer)?void 0:t.el;if(!t)return!1;t.classList.add("dvs-buttonResize");var e=t.clientWidth,t=t.clientHeight,e=36*(e/1920<t/1080?e/1920:t/1080)*window.devicePixelRatio,i=this._myQuery("topMenu"+this.postfix),n=this._myQuery("bottomMenu"+this.postfix),t=this.uiConfig.buttonResize,s=t.maxSize,t=t.minSize,r=Math.max(Math.min(e,s),t),e=Math.floor(1.875*r);if(i&&0<i.clientWidth){i.classList.add("dvs-resizeButton"),d(i,{flexBasis:e+"px",height:e+"px"});for(var o=0;o<i.children.length;o++)i.children[o].style.fontSize=r+"px"}if(n&&0<n.clientWidth){n.classList.add("dvs-resizeButton"),d(n,{fontSize:r+"px",flexBasis:e+"px",height:e+"px",justifyContent:"flex-start"});for(var a=0;a<n.children.length;a++)n.children[a].style.fontSize=r+"px"}},e._resizeViewer=function(t,e){var i=this;t&&e&&(this._showLatestQueue[t]=e),clearTimeout(this._resizeTimer),this._resizeTimer=setTimeout(function(){for(var t in i.styleChange(),i._showLatestQueue){var e;null!=(t=(e=i._showLatestQueue)[t])&&t.call(e,i._pagerRender.getCurrentPage())}i._showLatestQueue={}},20)},e._getBorderWidth=function(t,e,i){var n="";return(n+=!e&&i<0?t:"0px")+" "+(e&&0<=i?t:"0px")+" "+(!e&&0<=i?t:"0px")+" "+(e&&i<0?t:"0px")},e._updatePagesLayout=function(){this._thumbnailRender.updatePagesLayout()},e._showLatestPage=function(t){this._thumbnailRender.showLatestPage(t)},e.setButtonClass=function(t){var e,i,n,s=this.uiConfig.buttons,r=this._myQuery("".concat(t).concat(this.postfix));return!!r&&(e=(s=s[t]).iconClass?" "+s.iconClass:"",i=s.cssStyle?" "+s.cssStyle:"",n=r.classList.contains("dvs-disabled")?" dvs-disabled":"",s=s.setClass||"",r.className="ds-dvs-ui-iconfont dvs-iconColor dvs-".concat(t).concat(n).concat(e).concat(i," ").concat(s),!0)},e.setGroupClass=function(t,e){var i,n=this.uiConfig.groups,s=this._myQuery(t+this.postfix);return!!s&&(n=n[t].cssStyle?" "+n[t].cssStyle:"",i=s.classList.contains("dvs-disabled")?" dvs-disabled":"",s.className="dvs-".concat(t," dvs-groupType").concat(i).concat(n," ").concat(e),!0)},e.fullScreen=function(){var t=null==(t=this._viewerContainer)?void 0:t.el,t=(t=t).requestFullscreen?(t.requestFullscreen(),!0):t.mozRequestFullScreen?(t.mozRequestFullScreen(),!0):t.msRequestFullscreen?(t.msRequestFullscreen(),!0):t.oRequestFullscreen?(t.oRequestFullscreen(),!0):t.webkitRequestFullscreen?(t.webkitRequestFullScreen(),!0):(alert("Your browser does not support full screen!"),!1);return this._resizeViewer(),t},e.cancelFullScreen=function(){var t=!!((t=window.document).fullscreenElement||t.msFullscreenElement||t.mozFullScreenElement||t.webkitFullscreenElement)&&((t=window.document).exitFullScreen?(t.exitFullScreen(),!0):t.mozCancelFullScreen?(t.mozCancelFullScreen(),!0):t.webkitExitFullscreen?(t.webkitExitFullscreen(),!0):t.msExitFullscreen?(t.msExitFullscreen(),!0):void 0);return this._resizeViewer(),t},e.fullPage=function(){var t=null==(t=this._viewerContainer)?void 0:t.el;return!!t&&(t.classList.add("fitPage"),this.cancelFullScreen(),this._resizeViewer(),!0)},e.cancelFullPage=function(){var t=null==(t=this._viewerContainer)?void 0:t.el;return!!t&&(t.classList.remove("fitPage"),this.cancelFullScreen(),this._resizeViewer(),!0)},e.createCustomElement=function(t,e,i){return this._uiRender.createCustomElement(t,e=void 0===e?0:e,i=void 0===i?!1:i)},e.updateVideoSize=function(){if(this._videoSize&&this.showVideoContainer){var t=this._myQuery("videoContainer"+this.postfix),e=this._myQuery("videoImage"+this.postfix);if(!t||!e)return!1;var i,n=t.clientWidth,t=t.clientHeight,s=this._videoSize,r=s.imageWidth,s=s.imageHeight;n/r-1<t/s-1?(i=n/r,e.style.width=n+"px",e.style.height=s*i+"px"):(e.style.width=r*(t/s)+"px",e.style.height=t+"px"),this._videoSize.imageBoxWidth=e.clientWidth,this._videoSize.imageBoxHeight=e.clientHeight}},e.updateVideoContainer=function(t){var e=this;return this._videoImageReady?this._updateVideoImage(t):(clearTimeout(this._updateVideoTimer),this._updateVideoTimer=setTimeout(function(){e._updateVideoImage(t)},200),!0)},e._updateVideoImage=function(t){var e=this,i=this._myQuery("videoImage"+this.postfix);if(!i)return!1;i.src=t,clearTimeout(this._updateVideoTimer),this._videoImageReady=!1,i.onload=function(){e._videoImageReady=!0,i.style.display="",e._videoSize&&e._videoSize.imageWidth===i.naturalWidth&&e._videoSize.imageHeight===i.naturalHeight&&e._videoSize.imageBoxWidth===i.clientWidth&&e._videoSize.imageBoxHeight===i.clientHeight||(e._videoSize={imageWidth:i.naturalWidth,imageHeight:i.naturalHeight,imageBoxWidth:i.clientWidth,imageBoxHeight:i.clientHeight},e.updateVideoSize())},i.onerror=function(){e._videoImageReady=!0,i.style.display="none",i.onload=null}},e.getViewerElement=function(){var t;return(null==(t=this._viewerContainer)?void 0:t.el)||null},e.bindContent=function(t){return this._uiRender.bindContent(t)},e.unbindContent=function(){return this._uiRender.unbindContent()},e.setLoadingImage=function(t){if(!t)return!1;var e=this._myQuery("loadingImage"+this.postfix);return e&&(e.src=t),!0},e._setShowLoadingImage=function(t){var e=this._myQuery("loadingLayer"+this.postfix);e&&(t?e.classList.remove("dvs-disabled"):e.classList.add("dvs-disabled"))},e.dispose=function(){var t;o.prototype.dispose.call(this),this.unbindView(),this.unbindContent(),null!=(t=this._uiRender)&&t.dispose(),(this._uiRender=null)!=(t=this._thumbnailRender)&&t.dispose(),(this._thumbnailRender=null)!=(t=this._scrollRender)&&t.dispose(),(this._scrollRender=null)!=(t=this._pagerRender)&&t.dispose(),(this._pagerRender=null)!=(t=this._uiEventControl)&&t.dispose(),(this._uiEventControl=null)!=(t=this._tabRender)&&t.dispose(),(this._tabRender=null)!=(t=this._canvasRender)&&t.dispose(),(this._canvasRender=null)!=(t=this._sideRender)&&t.dispose(),(this._sideRender=null)!=(t=this._directoryRender)&&t.dispose(),(this._directoryRender=null)!=(t=this._tagRender)&&t.dispose(),this._tagRender=null,this._viewerContainer=null,this.containerBox=null},t}(E);window.Dynamsoft=window.Dynamsoft||{},window.Dynamsoft.ViewUi=N}();
|