dwt 17.1.10 → 17.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -37
- package/dist/addon/dbrjs/dbr-8.6.1.full.wasm +0 -0
- package/dist/addon/dbrjs/dbr-8.6.1.full.wasm.js +134 -0
- package/dist/addon/dbrjs/dbr-8.6.1.worker.js +113 -0
- package/dist/addon/dbrjs/dbr.js +11 -11
- 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 +783 -639
- package/dist/dynamsoft.webtwain.min.mjs +788 -642
- package/dist/src/dynamsoft.crypto-1.7.2.wasm +0 -0
- package/dist/src/dynamsoft.imageProc-1.7.2.wasm +0 -0
- package/dist/src/dynamsoft.imageProc-sn-1.7.2.wasm +0 -0
- package/dist/src/dynamsoft.imagecore-1.7.2.wasm +0 -0
- package/dist/src/dynamsoft.imageio-1.7.2.wasm +0 -0
- package/dist/src/dynamsoft.imageio_wasm-1.7.2.js +115 -0
- package/dist/src/dynamsoft.lts.js +9 -9
- package/dist/src/dynamsoft.pdfReader-1.7.2.wasm +0 -0
- package/dist/src/dynamsoft.pdfReader_wasm-1.7.2.js +90 -0
- package/dist/src/dynamsoft.pdfWriter-1.7.2.wasm +0 -0
- package/dist/src/dynamsoft.viewer.css +3 -2
- package/dist/src/dynamsoft.viewer.js +2 -2
- package/dist/src/dynamsoft.webtwain.css +294 -60
- package/dist/src/{dynamsoft.crypto-1.7.1.wasm → fastcomp/dynamsoft.crypto-1.7.2.wasm} +0 -0
- package/dist/src/fastcomp/dynamsoft.imageProc-1.7.2.wasm +0 -0
- package/dist/src/fastcomp/dynamsoft.imagecore-1.7.2.wasm +0 -0
- package/dist/src/fastcomp/dynamsoft.imageio-1.7.2.wasm +0 -0
- package/dist/src/fastcomp/dynamsoft.imageio_wasm-1.7.2.js +115 -0
- package/dist/src/fastcomp/dynamsoft.pdfWriter-1.7.2.wasm +0 -0
- package/dist/types/Addon.Camera.d.ts +108 -0
- package/dist/types/Dynamsoft.Enum.d.ts +2 -1
- package/dist/types/Dynamsoft.d.ts +17 -0
- package/dist/types/WebTwain.Buffer.d.ts +29 -1
- package/dist/types/WebTwain.Edit.d.ts +18 -0
- package/dist/types/WebTwain.Viewer.d.ts +48 -3
- package/dist/types/index.d.ts +2 -2
- package/package.json +3 -3
- package/samples/1.AcquireImage.html +1 -1
- package/samples/10.ScanOrCapture.html +16 -3
- package/samples/2.CustomScan.html +1 -1
- package/samples/3.LoadAndSaveImages.html +1 -1
- package/samples/4.PDFRasterizer.html +17 -2
- package/samples/5.Edit.html +1 -1
- package/samples/6.Navigation.html +1 -1
- package/samples/7.Thumbnail.html +1 -1
- package/samples/8.OCRADocument.html +1 -1
- package/samples/9.ReadBarcode.html +1 -1
- package/dist/addon/dbrjs/dbr-8.2.5.full.wasm +0 -0
- package/dist/addon/dbrjs/dbr-8.2.5.full.wasm.js +0 -243
- package/dist/addon/dbrjs/dbr-8.2.5.worker.js +0 -112
- package/dist/src/dynamsoft.imageProc-1.7.1.wasm +0 -0
- package/dist/src/dynamsoft.imagecore-1.7.1.wasm +0 -0
- package/dist/src/dynamsoft.imageio-1.7.1.wasm +0 -0
- package/dist/src/dynamsoft.imageio_wasm-1.7.1.js +0 -106
- package/dist/src/dynamsoft.pdfReader-1.7.1.wasm +0 -0
- package/dist/src/dynamsoft.pdfWriter-1.7.1.wasm +0 -0
- package/dist/types/README.md +0 -16
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! Date:
|
|
2
|
-
!function(t){var e={};function i(n){if(e[n])return e[n].exports;var s=e[n]={i:n,l:!1,exports:{}};return t[n].call(s.exports,s,s.exports,i),s.l=!0,s.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 s in t)i.d(n,s,function(e){return t[e]}.bind(null,s));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=7)}([function(t,e,i){"use strict";i.d(e,"c",(function(){return s})),i.d(e,"f",(function(){return o})),i.d(e,"d",(function(){return r})),i.d(e,"e",(function(){return a})),i.d(e,"b",(function(){return l})),i.d(e,"a",(function(){return h}));var n="undefined"!=typeof window,s=(n&&window,!!n&&window.document.documentElement,{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"}),o={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"},r={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"},a={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"},l={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"},h={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."}}},function(t,e,i){"use strict";function n(t){return Array.isArray?Array.isArray(t):"[object Array]"===Object.prototype.toString.call(t)}function s(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 r(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 _(){return"ontouchstart"in document.documentElement}function p(){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]:o(t[i])?g(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 y(t,e){var i=this,n=0,s=null;return function(){var o=+new Date;o-n<e?(clearTimeout(s),s=setTimeout((function(){n=o,t.apply(i)}),e)):(n=o,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 w(){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 I(){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 R(t){for(var e=t.parentNode.children,i=0;i<e.length;i++)if(e[i]===t)return i}function x(t,e){for(var i=t.parentNode,n=i.children,s=0,o=0;o<n.length;o++){var a=n[o];if(r(e)){if(!e(a,i))continue;if(a===t)return s;s++}else if(a===t)return o}return-1}function O(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).substr(2);return e.length<11&&(e+=Math.random().toString(35).substr(2)),t=Math.max(Math.min(Math.round(t),11),8),e=e.substr(0,t)}function A(t){var e;if(n(t))e=[];else{if(!o(t))return t;e={}}for(var i in t){var s=t[i];n(t)||o(t)?e[i]=A(s):e[i]=s}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={},s=1,o=null,r=+new Date;return function(t,e){var i=s++;return n[i]=t,null===o&&(o=setInterval((function(){var t=+new Date,e=n;for(var i in n={},0,e)Object.prototype.hasOwnProperty.call(e,i)&&(e[i](t),r=t);t-r>2500&&(clearInterval(o),o=null)}),1e3/60)),i}(t)}function B(){var t=window;return t?t.devicePixelRatio?t.devicePixelRatio:t.screen.deviceXDPI&&t.screen.logicalXDPI?t.screen.deviceXDPI/t.screen.logicalXDPI:1:1}function D(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 N(t){var e=Object.prototype.toString.call(t),i=window.URL||window.webkitURL;return"[object Blob]"===e?{type:"object",data:i.createObjectURL(t)}:/\[object ArrayBuffer\]|\[object \w+Array\]/.test(e)?{type:"object",data:i.createObjectURL(new Blob([t]))}:(/data:image\/\w+;base64/.test(t),{type:"string",data:t})}function U(t){var e=window.URL||window.webkitURL;if(/^blob:/.test(t))return e.revokeObjectURL(t)}function k(t,e,i,n,s){var o=t+i/2,r=e+n/2,a=V(t,e,o,r,s),l=V(t+i,e,o,r,s),h=V(t+i,e+n,o,r,s),u=V(t,e+n,o,r,s),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 V(t,e,i,n,s){return s=s/180*Math.PI,{x:(t-i)*Math.cos(s)-(e-n)*Math.sin(s)+i,y:(t-i)*Math.sin(s)+(e-n)*Math.cos(s)+n}}i.d(e,"l",(function(){return n})),i.d(e,"J",(function(){return s})),i.d(e,"v",(function(){return o})),i.d(e,"r",(function(){return r})),i.d(e,"x",(function(){return a})),i.d(e,"w",(function(){return l})),i.d(e,"u",(function(){return h})),i.d(e,"m",(function(){return u})),i.d(e,"o",(function(){return c})),i.d(e,"n",(function(){return d})),i.d(e,"t",(function(){return _})),i.d(e,"s",(function(){return p})),i.d(e,"p",(function(){return v})),i.d(e,"F",(function(){return f})),i.d(e,"a",(function(){return m})),i.d(e,"z",(function(){return g})),i.d(e,"A",(function(){return b})),i.d(e,"H",(function(){return y})),i.d(e,"G",(function(){return E})),i.d(e,"B",(function(){return C})),i.d(e,"i",(function(){return S})),i.d(e,"q",(function(){return w})),i.d(e,"y",(function(){return T})),i.d(e,"e",(function(){return I})),i.d(e,"g",(function(){return R})),i.d(e,"h",(function(){return x})),i.d(e,"j",(function(){return O})),i.d(e,"k",(function(){return P})),i.d(e,"I",(function(){return L})),i.d(e,"c",(function(){return A})),i.d(e,"C",(function(){return M})),i.d(e,"d",(function(){return B})),i.d(e,"f",(function(){return D})),i.d(e,"b",(function(){return N})),i.d(e,"D",(function(){return U})),i.d(e,"E",(function(){return k}))},function(t,e,i){"use strict";i.d(e,"a",(function(){return s}));var n=undefined&&undefined.__spreadArrays||function(){for(var t=0,e=0,i=arguments.length;e<i;e++)t+=arguments[e].length;var n=Array(t),s=0;for(e=0;e<i;e++)for(var o=arguments[e],r=0,a=o.length;r<a;r++,s++)n[s]=o[r];return n},s=function(){function t(){this._events={}}return t.prototype.on=function(t,e){this._events[t]||(this._events[t]=[]),this._events[t].push(e)},t.prototype.emit=function(t){for(var e,i=[],s=1;s<arguments.length;s++)i[s-1]=arguments[s];var o=this._events[t];if(!o||0===o.length)return!1;for(var r=o.length,a=0;a<r;a++)null===(e=o[a])||void 0===e||e.call.apply(e,n([null],i))},t.prototype.off=function(t,e){var i=this._events[t];if(!i)return!1;if(e)for(var n=i.length,s=0;s<n;s++){var o=i[s];o===e&&i.splice(s,1),o=null}else i&&(i.length=0);i=null},t}()},function(t,e,i){"use strict";var n=i(1),s=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,s=t.maxY;return{x:Math.floor(e),y:Math.floor(n),width:Math.floor(i-e),height:Math.floor(s-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,s=e.minY,o=e.maxY,r=this.probePoints[2*t],a=this.probePoints[2*t+1];return t<4?r===n&&a===o?"se":r===n&&a===s?"ne":r===i&&a===s?"nw":r===i&&a===o?"sw":null:r===n?"e":a===o?"s":r===i?"w":a===s?"n":null},t.prototype.onStartHandler=function(t,e,i){var n=this.isBoxSelected(t,e);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))},t.prototype.onMoveHandler=function(t,e,i){if(this.isPointSelected||this.isMoveBox){var n=this.probePoints.slice();if(this.isPointSelected){var s=this.activeProbePoint;i!==undefined&&(s=i),n="normal"===this.mode?this._movePointNormal(n,s,t,e):this._movePointFree(n,s,t,e),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 o=t-this._lastX,r=e-this._lastY;if(0===o&&0===r)return;n=this._moveBox(n,o,r),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 s=this._checkRectConvexity(this.probePoints);if(t===i&&e===n||!s)return this.probePoints=this.vertexes.slice().concat(this.midpoints),void(this.slopeRatio=this._calcSlopeRatio(this.probePoints).slice(0,4));this.vertexes=this.probePoints.slice(0,8),this.midpoints=this.probePoints.slice(8,16)}},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 s=0,o=0;if(this.keepAspectRatio){var r=this._getMaxPoint(),a=r.minX,l=r.maxX,h=r.minY,u=r.maxY,c=this.checkPointPosition(e),d=(l-a)/(u-h);0===d||d===Infinity||d===-Infinity||isNaN(d)?d=this._lastWhr:this._lastWhr=d,s=0,o=0;var _="width";if(e<4){if(s=i-t[2*e],o=n-t[2*e+1],0===s||0===o)return t;_="width"}else{var p=e-4;if("e"===c?(e=(p+1)%4,_="width"):"s"===c?(e=p,_="height"):"w"===c?(e=p,_="width"):"n"===c&&(e=(p+1)%4,_="height"),s=i-t[2*p],o=n-t[2*p+1],0===s||0===o)return t}"height"===_?(s=o*d,"ne"!==c&&"sw"!==c&&"n"!==c&&"w"!==c||(s=-s)):(o=s/d,"ne"!==c&&"sw"!==c&&"n"!==c&&"w"!==c||(o=-o));var v=t[2*e]+s,f=t[2*e+1]+o;v<0?(s=0-t[2*e],o=0):v>this.width?(s=this.width-t[2*e],o=0):f<0?(o=0-t[2*e+1],s=0):f>this.height&&(o=this.height-t[2*e+1],s=0),t[2*e]+=s,t[2*e+1]+=o;m=(e+1)%4,g=(e+3)%4;e%2?(t[2*m]+=s,t[2*g+1]+=o):(t[2*m+1]+=o,t[2*g]+=s)}else if(e<4){if(s=i-t[2*e],o=n-t[2*e+1],0===s&&0===o)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 b=e-4,y=this.slopeRatio[b%4];0===y?(t[(2*b+3)%8]=n,t[(2*b+1)%8]=n):y!==Infinity&&y!==-Infinity||(t[(2*b+2)%8]=i,t[(2*b+0)%8]=i)}return t},t.prototype._movePointFree=function(t,e,i,n){if(i=Math.max(0,Math.min(this.width,i)),n=Math.max(0,Math.min(this.height,n)),e<4){var s=i-t[2*e],o=n-t[2*e+1];if(0===s&&0===o)return t;t[2*e]=i,t[2*e+1]=n}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]),s=Math.max(t[0],t[2],t[4],t[6]),o=Math.min(t[1],t[3],t[5],t[7]),r=Math.max(t[1],t[3],t[5],t[7]);n+e<0&&(e=-n),s+e>this.width&&(e=this.width-s),o+i<0&&(i=-o),r+i>this.height&&(i=this.height-r);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,s=i.maxX,o=i.minY,r=i.maxY;return t>=n&&t<=s&&e>=o&&e<=r}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(),s=n.minX,o=n.maxX,r=n.minY,a=n.maxY,l=Math.min(Math.max(i,.1*(o-s)),3*i)*this.dpr,h=Math.min(Math.max(i,.1*(a-r)),3*i)*this.dpr,u=8;"free"===this.mode&&(u=4);for(var c=0;c<u;c++){var d=this.probePoints[2*c],_=this.probePoints[2*c+1];if(t<=d+l&&t>=d-l&&e<=_+h&&e>=_-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]),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 o=t.slice().concat(t.slice(0,2));if(this.slopeRatio.length)for(var r=0;r<2;r++){if(this.slopeRatio[r]!==this.slopeRatio[r+2])if(this._calcIntersection(o.slice(2*r,2*r+2),o.slice(2*r+2,2*r+4),o.slice(2*r+4,2*r+6),o.slice(2*r+6,2*r+8)))return!1}return e*i*n*s>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 s=(e[2*n]+e[2*n+2])/2,o=(e[2*n+1]+e[2*n+3])/2;i.push(s,o)}return i},t.prototype._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},t.prototype._calcIntersection=function(t,e,i,n){if(this._isRectCross(t,e,i,n)&&this._isLineSegmentCross(t,e,i,n)){var s,o=void 0,r=void 0;if(o=(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]),0===o||0===r){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 s=r/o,o=(t[0]-e[0])*(n[1]-i[1])-(e[1]-t[1])*(i[0]-n[0]),[s,(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]))/o]}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 s=Math.min,o=Math.max;return s(t[0],e[0])<=o(i[0],n[0])&&s(i[0],n[0])<=o(t[0],e[0])&&s(t[1],e[1])<=o(i[1],n[1])&&s(i[1],n[1])<=o(t[1],e[1])},t.prototype._isLineSegmentCross=function(t,e,i,n){var s,o;return!(((s=t[0]*(i[1]-e[1])+e[0]*(t[1]-i[1])+i[0]*(e[1]-t[1]))^(o=t[0]*(n[1]-e[1])+e[0]*(t[1]-n[1])+n[0]*(e[1]-t[1])))>=0&&0!==s&&0!==o)&&!(((s=i[0]*(t[1]-n[1])+n[0]*(i[1]-t[1])+t[0]*(n[1]-i[1]))^(o=i[0]*(e[1]-n[1])+n[0]*(i[1]-e[1])+e[0]*(n[1]-i[1])))>=0&&0!==s&&0!==o)},t}();i.d(e,"a",(function(){return o}));var o=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.d)(),i=new s({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.d)(),o=new s({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(o),o},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,s=t-this._startX,o=e-this._startY,r=null,a=2/this.zoom;!this._activeBoxId&&t-this._startX<-a&&e-this._startY<-a?(r=0,this.aspectRatio>0&&(o=s/this.aspectRatio)):!this._activeBoxId&&t-this._startX>a&&e-this._startY<-a?(r=1,this.aspectRatio>0&&(o=-s/this.aspectRatio)):!this._activeBoxId&&t-this._startX>a&&e-this._startY>a?(r=2,this.aspectRatio>0&&(o=s/this.aspectRatio)):!this._activeBoxId&&t-this._startX<-a&&e-this._startY>a&&(r=3,this.aspectRatio>0&&(o=-s/this.aspectRatio));var l=[t,this._startY+o,this._startX,this._startY+o,this._startX,this._startY,t,this._startY],h=[this._startX,this._startY,this._startX,this._startY+o,t,this._startY+o,t,this._startY];if(null!==r){for(var u=[],c=0;c<4;c++)r%2?(u.push(h[2*(r+c)%8]),u.push(h[(2*(r+c)+1)%8])):(u.push(l[2*(r+c)%8]),u.push(l[(2*(r+c)+1)%8]));return n=this.addBox(u,["topLeft","topRight","bottomRight","bottomLeft"][r]),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,r),n.onMoveHandler(t,e,r),void(r=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 s=this.cropBoxes[n],o=s.isBoxSelected(t,e);if(null!==o){var r="move";return-1!==o&&(r=s.checkPointPosition(o)),{part:o,type:s.type,position:r}}}return null},t}()},,function(t,e,i){},,function(t,e,i){"use strict";i.r(e);i(5);var n,s=i(1),o=i(0),r=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.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=this,e=this._element,i=Object(s.t)(),n="mousedown",o="mousemove",r="mouseup";i&&(n="touchstart",o="touchmove",r="touchend",i=!0),e.addEventListener(n,(function(e){var n,s=t._packageEvent(e);t._mouseDownItem=t.getTarget(e),t._startX=s.clientX,t._startY=s.clientY,null===(n=t.onPointDown)||void 0===n||n.call(t,s),i?t._rightClickTimer=setTimeout((function(){var e;null===(e=t.onRightClick)||void 0===e||e.call(t,s),t._mouseDownItem=null}),500):2===s.button&&(t._rightClickItem=t.getTarget(s))}),{passive:!1}),e.addEventListener(o,(function(e){var i,n=t._packageEvent(e);null===(i=t.onPointMove)||void 0===i||i.call(t,n);var o=Math.abs(n.clientX-t._startX),r=Math.abs(n.clientY-t._startY);(o>5||r>5)&&(clearTimeout(t._rightClickTimer),Object(s.t)()&&(t._mouseDownItem=null))}),{passive:!1}),e.addEventListener(r,(function(e){var i,n,s=t._packageEvent(e);t._mouseUpItem=t.getTarget(s),null===(i=t.onPointUp)||void 0===i||i.call(t,s),clearTimeout(t._rightClickTimer),t.getTarget(s)===t._rightClickItem&&2===s.button?null===(n=t.onRightClick)||void 0===n||n.call(t,s):t._mouseDownItem===t._mouseUpItem&&t._clickHandler(s),t._rightClickItem=null})),e.addEventListener("mouseover",(function(e){var i;if(!Object(s.t)()){var n=e.fromElement;n===undefined&&(n=e.relatedTarget);var o=e.toElement;o===undefined&&(o=e.target),t.getTarget(e,n)!==t.getTarget(e,o)&&(null===(i=t.onPointOver)||void 0===i||i.call(t,e))}})),e.addEventListener("mouseout",(function(e){var i;if(!Object(s.t)()){var n=e.fromElement;n===undefined&&(n=e.target);var o=e.toElement;o===undefined&&(o=e.relatedTarget),t.getTarget(e,n)!==t.getTarget(e,o)&&(null===(i=t.onPointOut)||void 0===i||i.call(t,e))}}))},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}(),a=undefined&&undefined.__spreadArrays||function(){for(var t=0,e=0,i=arguments.length;e<i;e++)t+=arguments[e].length;var n=Array(t),s=0;for(e=0;e<i;e++)for(var o=arguments[e],r=0,a=o.length;r<a;r++,s++)n[s]=o[r];return n},l=function(){function t(t,e,i){this.useMyEvent=!0,this._unbindList=[],this._viewerContainer=null,this._pubSub=e,this._postfix=t,this._viewerContainer=i}return t.prototype.uiEventInit=function(){var t=this,e=function(e){var i,n,s="#"+e+t._postfix;return null===(n=null===(i=t._viewerContainer)||void 0===i?void 0:i.el)||void 0===n?void 0:n.querySelector(s)},i=o.c.CLICK,n=(o.c.MOUSE_DOWN,o.c.MOUSE_MOVE),a=o.c.MOUSE_UP;"ontouchend"in document.documentElement&&(o.c.TOUCH_START,n=o.c.TOUCH_MOVE,a=o.c.TOUCH_END);var l=this._unbindList;l.push(Object(s.a)(window,o.c.RESIZE,s.H.call(this,this._viewerResize,40))),l.push(Object(s.a)(window,"load",(function(e){t._viewerResize(e)}))),l.push(Object(s.a)(document,n,(function(e){t._documentMouseMove(e)}))),l.push(Object(s.a)(document,a,(function(e){t._documentMouseUp(e)}))),l.push(Object(s.a)(window,"message",(function(e){"up"===e.data.type&&t._documentMouseUp()}))),l.push(Object(s.a)(document,o.c.CLICK,(function(e){t._documentClick(e)}))),l.push(Object(s.a)(document,"keydown",(function(e){t.emit(o.e.DOCUMENT_KEY_DOWN,e)}))),l.push(Object(s.a)(document,"keyup",(function(e){t.emit(o.e.DOCUMENT_KEY_UP,e)})));var h=this._viewerContainer.el;Object(s.a)(h,"dragstart",(function(){return!1})),Object(s.a)(h,i,(function(e){t._viewerClick(e)})),Object(s.a)(h,o.c.CONTEXTMENU,(function(e){t._viewerRightClick(e)})),Object(s.a)(h,"dragover",(function(t){Object(s.B)(t)})),Object(s.a)(h,"drop",(function(e){t._dropFile(e)})),Object(s.a)(e("navChange"),i,(function(e){t._setSelectedSidetype(e)})),Object(s.a)(e("besides"),i,(function(e){t._sidebarClick(e)})),Object(s.a)(e("stretchBar"),o.c.MOUSE_DOWN,(function(e){t._sidebarStretchStart(e)})),Object(s.a)(e("defaultTag"),i,(function(){t._openDefaultTag()})),Object(s.a)(e("treeLists"),i,(function(e){t._fileListClick(e)})),Object(s.a)(e("treeLists"),o.c.CONTEXTMENU,(function(e){t._fileListRightClick(e)})),Object(s.a)(e("treeLists"),"keyup",(function(e){t._fileListKeyUp(e)})),Object(s.a)(e("addFolder"),o.c.CLICK,(function(e){t._addNewFolder(e)})),Object(s.a)(e("tagLists"),i,(function(e){t._tagListClick(e)})),Object(s.a)(e("tagLists"),o.c.CONTEXTMENU,(function(e){t._tagListRightClick(e)})),Object(s.a)(e("tagLists"),"keyup",(function(e){t._tagListKeyUp(e)})),Object(s.a)(e("addTag"),i,(function(e){t._addNewTag(e)}));var u=e("canvasEventLayer");Object(s.a)(u,"touchstart",(function(e){t._canvasTouchStart(e)}),{passive:!1}),Object(s.a)(u,"mousedown",(function(e){t._canvasMouseDown(e)})),Object(s.a)(u,"touchmove",(function(e){t._canvasTouchMove(e)}),{passive:!1}),Object(s.a)(u,"mousemove",(function(e){t._canvasMouseMove(e)})),Object(s.a)(u,"touchend",(function(e){t._canvasTouchEnd(e)})),Object(s.a)(u,"mouseup",(function(e){t._canvasMouseUp(e)})),Object(s.a)(u,"wheel",(function(e){t._canvasWheel(e)}),{passive:!1}),Object(s.a)(u,"click",(function(t){Object(s.G)(t)}));var c=new r(e("canvasEventLayer"));c.onClick=function(e){t.emit(o.d.CANVAS_CLICK,e)},c.onRightClick=function(e){t.emit(o.d.CANVAS_RIGHT_CLICK,e)},c.onDoubleClick=function(e){t.emit(o.d.CANVAS_DOUBLE_CLICK,e)},c.onPointOver=function(e){t.emit(o.d.CANVAS_MOUSE_OVER,e)},c.onPointOut=function(e){t.emit(o.d.CANVAS_MOUSE_OUT,e)},c=null,Object(s.a)(e("canvasScroll"),"scroll",(function(e){t._canvasScroll(e)})),Object(s.a)(e("tabList"),i,(function(e){t._tabListClick(e)})),Object(s.a)(e("pagerInput"),"blur",(function(e){t._pagerBlur(e)})),Object(s.a)(e("pagerInput"),"keyup",(function(t){13===t.keyCode&&t.target.blur()}))},t.prototype.unbindEvents=function(){this._unbindList.forEach((function(t){Object(s.r)(t)&&t()})),this._unbindList=[]},t.prototype.emit=function(t){for(var e,i=[],n=1;n<arguments.length;n++)i[n-1]=arguments[n];(e=this._pubSub).emit.apply(e,a([t],i))},t.prototype._viewerResize=function(t){this.emit(o.e.VIEWER_RESIZE,t)},t.prototype._documentMouseUp=function(t){this.emit(o.e.DOCUMENT_POINTER_UP,t),this.emit(o.d.DOCUMENT_UP,t),this.emit(o.f.DOCUMENT_POINTER_UP,t)},t.prototype._documentMouseMove=function(t){this.emit(o.e.DOCUMENT_POINTER_MOVE,t),this.emit(o.d.DOCUMENT_MOVE,t),this.emit(o.f.DOCUMENT_POINTER_MOVE,t)},t.prototype._documentClick=function(t){this.emit(o.e.DOCUMENT_CLICK,t),this.emit(o.f.DOCUMENT_CLICK,t)},t.prototype._viewerClick=function(t){this.emit(o.e.VIEWER_CLICK,t)},t.prototype._viewerRightClick=function(t){Object(s.B)(t),this.emit(o.e.VIEWER_RIGHT_CLICK,t)},t.prototype._viewerMove=function(t){this.emit(o.e.VIEWER_MOVE,t)},t.prototype._dropFile=function(t){Object(s.B)(t),this.emit(o.f.FILE_DROP,t)},t.prototype._setSelectedSidetype=function(t){},t.prototype._sidebarClick=function(t){Object(s.G)(t),this.emit(o.e.SIDEBAR_CLICK),this.emit(o.f.SIDEBAR_CLICK)},t.prototype._sidebarStretchStart=function(t){this.emit(o.e.SIDEBAR_STRETCH_START,t)},t.prototype._openDefaultTag=function(){this.emit(o.e.OPEN_DEFAULT_TAG)},t.prototype._fileListClick=function(t){this.emit(o.e.FILE_LIST_CLICK,t),this.emit(o.f.FILE_LIST_CLICK,t)},t.prototype._fileListRightClick=function(t){this.emit(o.e.FILE_LIST_RIGHT_CLICK,t),this.emit(o.f.FILE_LIST_RIGHT_CLICK,t)},t.prototype._fileListKeyUp=function(t){this.emit(o.e.FILE_KEY_UP,t),this.emit(o.f.FILE_KEY_UP,t)},t.prototype._addNewFolder=function(t){this.emit(o.e.ADD_NEW_FOLDER,t)},t.prototype._tagListClick=function(t){this.emit(o.e.TAG_LIST_CLICK,t),this.emit(o.f.TAG_LIST_CLICK,t)},t.prototype._tagListRightClick=function(t){this.emit(o.e.TAG_LIST_RIGHT_CLICK,t),this.emit(o.f.TAG_LIST_RIGHT_CLICK,t)},t.prototype._tagListKeyUp=function(t){this.emit(o.e.TAG_KEY_UP,t),this.emit(o.f.TAG_KEY_UP,t)},t.prototype._addNewTag=function(t){this.emit(o.e.ADD_NEW_TAG,t)},t.prototype._canvasTouchStart=function(t){this.emit(o.d.CANVAS_TOUCH_START,t)},t.prototype._canvasTouchMove=function(t){this.emit(o.d.CANVAS_TOUCH_MOVE,t)},t.prototype._canvasTouchEnd=function(t){this.emit(o.d.CANVAS_TOUCH_END,t)},t.prototype._canvasMouseDown=function(t){this.emit(o.d.CANVAS_MOUSE_DOWN,t)},t.prototype._canvasMouseMove=function(t){this.emit(o.d.CANVAS_MOUSE_MOVE,t)},t.prototype._canvasMouseUp=function(t){this.emit(o.d.CANVAS_MOUSE_UP,t)},t.prototype._canvasWheel=function(t){this.emit(o.d.CANVAS_WHEEL,t),Object(s.B)(t)},t.prototype._canvasScroll=function(t){this.emit(o.d.CANVAS_SCROLL,t)},t.prototype._tabListClick=function(t){this.emit(o.e.TAB_LIST_CLICK,t)},t.prototype._pagerBlur=function(t){this.emit(o.e.PAGER_BLUR,t)},t}(),h=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(s.v)(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(s.v)(t))return!1;for(var e in t)t[e]!==undefined&&(this[e]=t[e]);return!0},t.prototype._updateAttributes=function(t){if(Object(s.p)(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}(),u=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)}),c=function(t){function e(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];return t.apply(this,e)||this}return u(e,t),e}(h),d=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 s=t.call(this,e,i,n)||this;return s.groups={},s}return d(e,t),e}(h),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)}}(),v=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;return s.buttons={},s._setGroupClass(),s}return p(e,t),e.prototype._setGroupClass=function(){var t;null===(t=this.element)||void 0===t||t.classList.add("dvs-groupType")},e}(h),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)}}(),m=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;return s.onButtonClick="",s.iconClass="",s.text="",s.title="",s}return f(e,t),e.prototype._updateAttributes=function(t){var e=this;if(Object(s.p)(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(s.x)(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(o.e.CUSTOM_BUTTON_CLICK,e.onButtonClick,t)}:t.onclick=null,!0},e}(h),g=function(){function t(t){var e=t.el,i=t.sequence,n=t.isFull,o=t.pubsub,r=t.container;this.uid="",this.element=null,this.sequence=0,this.isFull=!1,this._visibility=!0,this.uid=Object(s.I)(11),this.element=e,this.sequence=i,this._pubsub=o,this.isFull=n,this._container=r,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(o.e.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(o.e.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(o.e.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(o.e.VIEWER_RESIZE)},t}(),b=function(){function t(t){var e=t.postfix,i=t.container,n=t.uiConfig,s=t.pubsub;this._postfix="",this._pubsub=null,this.uiConfig=null,this._assembledConfig={},this._customElements={},this.contentContainer=null,this.viewerContainer=null,this._postfix=e,this._pubsub=s,this.uiConfig=n,this.viewerContainer={el:this.initUi(i)}}return t.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)},t.prototype.initUi=function(t,e){if(e){if(!Object(s.v)(e))return null;Object(s.A)(e,this.uiConfig)}if(Object(s.x)(t)&&(t=document.getElementById(t)),!Object(s.p)(t))return null;var i=this._assemblyConfig(this.uiConfig);this._assembledConfig=i;var n=new c(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},t.prototype._createContainers=function(t,e){for(var i in t){var n=null,o=t[i];if("sidebar"===i)n=this._initSidebar();else if("hiddenBox"===i)n=this._initHiddenBox();else if(this._assembledConfig[i]){var r=this._initToolbarItem(this._assembledConfig[i]);n=null==r?void 0:r.element}else{n=new c(this._postfix,{name:i,tagName:Object(s.x)(o)?o:undefined,visibility:this.uiConfig.toolbars[i]===undefined||this.uiConfig.toolbars[i]}).element}n&&(Object(s.v)(t[i])&&this._createContainers(o,n),e.appendChild(n))}return!0},t.prototype._initToolbarItem=function(t){if(!t.visibility)return null;var e=new _(this._postfix,t,this._pubsub);for(var i in t.groups){var n=t.groups[i];!n.name&&(n.name=i);var s=this._initGroupItem(n);s&&e.element.appendChild(s.element)}return e},t.prototype._initGroupItem=function(t){if(!1===t.visibility)return null;t.visibility=!0;var e=new v(this._postfix,t,this._pubsub);for(var i in t.buttons){var n=t.buttons[i];!n.name&&(n.name=i);var s=this._initButtonItem(n);s&&s.forEach((function(t){e.element.appendChild(t.element)}))}var o=new m(this._postfix,{name:"showBefore",visibility:!0,location:e.name,tagName:"SPAN",iconClass:"ds-dvs-ui-move_right"},this._pubsub),r=new m(this._postfix,{name:"showAfter",visibility:!0,location:e.name,tagName:"SPAN",iconClass:"ds-dvs-ui-move_left"},this._pubsub);return e.element.appendChild(o.element),e.element.appendChild(r.element),e},t.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"}],o=[];return n.forEach((function(n){o.push(new m(e._postfix,{visibility:t.visibility,name:n.name,sequence:n.sequence,location:t.location,text:n.text||"",tagName:n.tagName,title:i[t.name]}))})),o}return Object(s.z)({title:i[t.name]},t),[new m(this._postfix,t,this._pubsub)]}},t.prototype._assemblyConfig=function(t){var e,i,n,r={},a={},l=t.toolbars,h=t.groups,u=t.buttons;for(var c in l){var d=Boolean(l[c]);r[c]={name:c,visibility:d,groups:(null===(n=l[c])||void 0===n?void 0:n.groups)||{}}}for(var _ in h)a[_]=h[_];for(var p in u){var v=u[p];(f=a[_=v.location])?(f.buttons=f.buttons||{},Object(s.A)(((e={})[p]=v,e),f.buttons)):this._pubsub.emit(o.d.ERROR,{code:80024,message:"The group "+_+" is not exist."})}for(var _ in a){var f,m=r[c=(f=a[_]).location];m?Object(s.A)(((i={})[_]=f,i),m.groups):this._pubsub.emit(o.d.ERROR,{code:80024,message:"The toolbar "+c+" is not exist."})}return r},t.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 s=new c(this._postfix,{name:"sidebar",visibility:t.showSidebar&&(i||n)}),o="",r='<ul id="navChange'+this._postfix+'" class="dvs-navChange">',a='<ul id="paneShow'+this._postfix+'" class="dvs-paneShow">';return r+='<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++,r+='<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++,o+=(r+="</ul>")+(a+="</ul>"),o+='<div id="stretchBar'+this._postfix+'" class="dvs-stretchBar"></div>',s.element.innerHTML=o,s.element},t.prototype._initHiddenBox=function(){this.uiConfig;return new c(this._postfix,{name:"hiddenBox"}).element},t.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},t.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 o=n.querySelector("#content"+this._postfix),r=n.querySelector("#header"+this._postfix),a=this._myQueryById("showImageArea"+this._postfix);return r&&Object(s.k)(r,i.children[0],i),a&&o&&a.appendChild(o),n&&n.parentNode&&n.parentNode.removeChild(n),this.contentContainer=null,!0},t.prototype.createCustomElement=function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=!1),Object(s.x)(t)&&(t=document.getElementById(t)),!Object(s.p)(t))return null;var n=new g({el:t,sequence:e,isFull:i,pubsub:this._pubsub,container:this._myQueryById("container"+this._postfix)}),o=n.uid;return this._customElements[o]=n,n},t.prototype.removeAllCustomElements=function(){for(var t in this._customElements)this._customElements[t].element=null,this._customElements[t]=null;this._customElements=null},t}(),y=function(){function t(t,e,i){this._canvasItem=null,this.renderImg=null,this.imgSrc=null,this.uid="",this.tags=[],this.optimization=!1,this._pubsub=null,this._dataStore=null,this._showPage=!1,this._showSelectBox=!1,this._currentPage=-1,this._isSelected=!1,this._tempData={currentPage:-1,showPage:!1,showSelectBox:!1,isSelected:!1},this.allowCrossOrigin=!0,this.fitRatio=0,this._canvasWidth=0,this._canvasHeight=0,this._devicePixelRatio=1,this._rectArr=[],this._pubsub=e,this._dataStore=i,this._devicePixelRatio=Object(s.d)(),t&&this.init(t)}return t.prototype.init=function(t){for(var e in t)e!==undefined&&t[e]&&(this[e]=t[e]);this.renderImg=null},t.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)},t.prototype.emptyPage=function(){this.renderImg&&(this.renderImg.onload=null),this.renderImg=null,this._canvasItem&&(this._canvasItem.width=0,this._canvasItem.height=0)},t.prototype.dispose=function(){this.emptyPage(),this.imgSrc=null},t.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,s=this.height,o=this._devicePixelRatio,r=this._dataStore.getMid(this.uid);if((null==r?void 0:r.tempWidth)&&(null==r?void 0:r.tempHeight)){var a=Math.min(n/o/r.tempWidth,s/o/r.tempHeight,1);n=Math.floor(a*r.tempWidth),s=Math.floor(a*r.tempHeight)}var l=this.imgSrc;l.indexOf("blob:")<0&&(l+="&width="+n+"&height="+s),i.src=l,i.onload=function(){e._renderImage(t)},this.renderImg=i}},t.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 s=this._canvasItem.getContext("2d"),o=.99*t-n,r=.99*e-n;s.save(),s.beginPath(),s.lineWidth=i,s.fillStyle="rgba(255,255,255,0.8)",s.strokeStyle="#a79898",s.arc(o,r,n,0,2*Math.PI),s.closePath(),s.fill(),s.stroke(),s.textAlign="center",s.textBaseline="middle",s.fillStyle="#333",s.font=n+"px normal",s.fillText(String(this._currentPage),o,r+n/8,n),s.restore()}},t.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 s=this._canvasItem.getContext("2d"),o=.99*t-i,r=.99*e-i;s.save(),s.lineWidth=i/10,s.fillStyle="#fff",s.strokeStyle="#333",s.fillRect(o,r,i,i),s.strokeRect(o,r,i,i),this._isSelected&&(s.save(),s.beginPath(),s.lineCap="round",s.lineJoin="round",s.moveTo(o+.25*i,r+.5*i),s.lineTo(o+.5*i,r+.7*i),s.lineTo(o+5*i/6,r+.3*i),s.stroke(),s.closePath(),s.restore()),s.restore()}},t.prototype.renderOptimizedPage=function(t,e,i,n){var s=this;if(void 0===n&&(n=0),!(n>=2))if(this.renderImg&&(this.renderImg.onload=null),0!==this.width&&0!==this.height){var o=(this.width-e)/2,r=(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,o,r+u.start_y)}l.restore(),this.renderPage(),this.renderBox(),this.drawRect()}}}else setTimeout((function(){s.renderOptimizedPage(t,e,i,n++)}),20)},t.prototype._renderImage=function(t){void 0===t&&(t=!0);var e=this.renderImg;if(e&&this._canvasItem){var i=this._canvasItem.getContext("2d");if(i){i.save(),i.clearRect(0,0,this._canvasItem.width,this._canvasItem.height);var n=this._calDrawImagePos(e),s=n.left,r=n.top,a=n.width,l=n.height;i.drawImage(e,s,r,a,l),i.restore(),this.renderPage(),this.renderBox(),this.drawRect(),t&&this._pubsub.emit(o.f.VIEWER_PAGE_RENDERED,this._currentPage-1)}}},t.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 s=this._devicePixelRatio;if(!this.optimization){var o=this.width,r=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(o/s/a.tempWidth,r/s/a.tempHeight,1);o=Math.floor(l*a.tempWidth),r=Math.floor(l*a.tempHeight)}var h=Math.max(e/o,i/r);this.fitRatio=h,e/=h,i/=h}return n={left:(this.width-e*s)/2,top:(this.height-i*s)/2,width:e*s,height:i*s}},t.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(t.prototype,"width",{get:function(){return this._canvasWidth},set:function(t){this._setCanvasWidth(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this._canvasHeight},set:function(t){this._setCanvasHeight(t)},enumerable:!1,configurable:!0}),t.prototype.setTempData=function(t){this._tempData=t},t.prototype._setCanvasWidth=function(t){this._canvasItem&&(this._canvasWidth=t,this._canvasItem.width=t)},t.prototype._setCanvasHeight=function(t){this._canvasItem&&(this._canvasHeight=t,this._canvasItem.height=t)},t.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 s=this._checkIfRenderPageOrBox();if(Math.abs(i-this.width)<=2&&Math.abs(n-this.height)<=2&&this.renderImg&&!s)return!1;this.width=i,this.height=n,t&&-1===this.imgSrc.indexOf("blob:")&&(this.renderImg=null),this.render()},t.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},t.prototype.setRect=function(t,e){this._rectArr=t,e&&(this._boxColor=e)},t.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,s=0;s<t.length;s++)for(var o=t[s],r=0;r+1<8;r+=2){var a=e,l=o.probePoints[r]/n,h=o.probePoints[r+1]/n,u=o.midpoints[r]/n,c=o.midpoints[r+1]/n;this._drawPoint(this._transformRect(l,h),a),this._drawPoint(this._transformRect(u,c),e);var d=o.probePoints[(r+2)%8]/n,_=o.probePoints[(r+3)%8]/n;d!==undefined&&_!==undefined&&this._drawLine(this._transformRect(l,h),this._transformRect(d,_),e,o.dashLine)}}},t.prototype._transformRect=function(t,e){var i=this.renderImg,n=i.naturalWidth,s=i.naturalHeight,o=this.fitRatio;return{x:this.width/2+(t-n/2)/o*this._devicePixelRatio,y:this.height/2+(e-s/2)/o*this._devicePixelRatio}},t.prototype._drawPoint=function(t,e){var i=t.x,n=t.y;if(this._canvasItem){var s=this._canvasItem.getContext("2d");s.save(),s.lineWidth=this._devicePixelRatio,s.strokeStyle=e,s.strokeRect(i-4*this._devicePixelRatio,n-4*this._devicePixelRatio,8*this._devicePixelRatio,8*this._devicePixelRatio),s.restore()}},t.prototype._drawLine=function(t,e,i,n){var s=this,o=t.x,r=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*s._devicePixelRatio})))}catch(u){}h.lineWidth=this._devicePixelRatio,h.strokeStyle=i,h.beginPath(),h.moveTo(o,r),h.lineTo(a,l),h.stroke(),h.restore()}},t}(),E=function(){function t(t){void 0===t&&(t=[]),this.array=[],this.array=Object(s.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(s.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}(),C=undefined&&undefined.__spreadArrays||function(){for(var t=0,e=0,i=arguments.length;e<i;e++)t+=arguments[e].length;var n=Array(t),s=0;for(e=0;e<i;e++)for(var o=arguments[e],r=0,a=o.length;r<a;r++,s++)n[s]=o[r];return n},S=function(){function t(t,e,i,n,s){this.uid="",this._pubSub=null,this._viewerPub=null,this._viewerContainer=null,this._postfix="",this._thumbnailElement=null,this._dataStore=null,this.isInner=!1,this._iObserver=null,this._size=180,this._mouseShape="pointer",this._scrollDirection="vertical",this._sequence=0,this._location="horizontal",this._showThumbnail=!0,this._showPageNumber=!1,this._showSelectBox=!1,this._showRemoveBtn=!1,this._fullThumbnail=!1,this.allowPageDragging=!0,this._allowResizing=!1,this.allowHover=!0,this.allowKeyboardControl=!0,this.autoChangeIndex=!1,this.rows=1,this.columns=1,this._background="rgba(67,66,70,1)",this._border="1px solid rgba(27,27,29,1)",this._pageBackground="rgba(0,0,0,0)",this._pageBorder="1px solid rgba(128,128,128,1)",this._selectedPageBackground="rgba(127,133,251,1)",this._selectedPageBorder="1px solid rgba(255,0,0,1)",this.hoverPageBackground="rgba(196,250,248,1)",this.hoverPageBorder="1px solid rgba(255,255,0,1)",this.placeholderBackground="rgba(255,192,203,1)",this._pageMargin=10,this._pageMarginNumber=0,this._currentPageMargin=-1,this.isDrag=!1,this.ifDragMoves=!1,this._dragTimer=null,this._dragStart=!1,this.needClick=!0,this.thumbMoveOption={napX:0,napY:0,clickX:0,clickY:0,target:null},this._stretchItem=null,this._isStretching=!1,this._isCrop=!1,this._topImageIndex=-1,this._prtScrollOnce=!1,this._calculateTopIndex=-1,this._showIndexes=new E,this._renderIndexes=new E,this._renderUids=new E,this._tempThumbnailSize={width:1,height:1},this._splitTimer=null,this.selectedIndexes=[],this.currentIndex=-1,this._thumbnailCanvas=[],this._uidTbCanvas={},this._eventList={},this._renderTimer=null,this._viewerPub=e,this._viewerContainer=i,this._postfix=n,this._dataStore=s,this._thumbnailInit(t),this._pubQuery=function(t){var e;return null===(e=null==i?void 0:i.el)||void 0===e?void 0:e.querySelector("#"+t)}}return t.prototype._thumbnailInit=function(t){this._initThumbnailUi(t.uid),this._initThumbnailConfig(t),this._initIntersectionObserver(),this._bindSelfEvents(),this._bindUiEvent()},t.prototype._initThumbnailConfig=function(t){for(var e in this._pubSub=t.pubsub,t)"pubsub"!==(e=e.replace("canvas",""))&&(this[e]=t[e])},t.prototype._initThumbnailUi=function(t){var e=new c(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)}},t.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(t.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(t.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(t.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(t.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(t.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 s={vertical:"#content"+this._postfix,horizontal:"#middle"+this._postfix,canvas:"#innerThumbnail"+this._postfix};(i=null==n?void 0:n.querySelector(s[t]))&&i.appendChild(this._thumbnailElement),this._updateStretchBars(),this.size=this._size,this._setSplitBarDelay(),this._resizeViewer(!0)}},enumerable:!1,configurable:!0}),Object.defineProperty(t.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(t.prototype,"showPageNumber",{get:function(){return this._showPageNumber},set:function(t){this._showPageNumber=t,this.renderCanvas()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"showSelectBox",{get:function(){return this._showSelectBox},set:function(t){this._showSelectBox=t,this.renderCanvas()},enumerable:!1,configurable:!0}),Object.defineProperty(t.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(t.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(t.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(t.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(t.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(t.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 s=i[n];s.classList.contains("dvs-activeThumb")||(s.style.background=t)}},enumerable:!1,configurable:!0}),Object.defineProperty(t.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 s=i[n];s.classList.contains("dvs-activeThumb")||(s.style.border=t)}},enumerable:!1,configurable:!0}),Object.defineProperty(t.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(t.prototype,"allowResizing",{get:function(){return this._allowResizing},set:function(t){this._allowResizing=t,this._updateStretchBars()},enumerable:!1,configurable:!0}),Object.defineProperty(t.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}),t.prototype._bindSelfEvents=function(){var t,e=((t={})[o.e.UPDATE_THUMBNAIL_PROP]=this._updateProps,t[o.e.SCROLL_TO]=this.scrollTo,t[o.e.SET_VIEW_MODE]=this.setViewMode,t);for(var i in this._eventList=e,e)this._pubSub.on(i,e[i].bind(this));this._viewerPub.on(o.e.DOCUMENT_POINTER_MOVE,this._documentMouseMove.bind(this)),this._viewerPub.on(o.e.DOCUMENT_POINTER_UP,this._documentMouseUp.bind(this))},t.prototype._bindUiEvent=function(){var t=this,e=this._thumbnailElement;if(e){var i=new r(e);i.onPointDown=function(e){t._thumbnailDragStart(e),t._thumbnailPointerDown(e)},i.onPointMove=function(e){t._thumbnailDragMove(e),t._thumbnailPointerMove(e)},i.onPointUp=function(e){t._thumbnailPointerUp(e)},i.onClick=function(e){t._thumbnailClick(e)},i.onRightClick=function(e){t._thumbnailRightClick(e)},i.onDoubleClick=function(e){t._thumbnailDoubleClick(e)},i.onPointOver=function(e){t._thumbnailMouseOver(e)},i.onPointOut=function(e){t._thumbnailMouseOut(e)},i.getTarget=function(e,i){return i!==undefined?t.getImageItem(i):t.getImageItem(e)},i=null,Object(s.a)(e.querySelector(".dvs-thumbLists"),"scroll",(function(){t._thumbnailScroll()})),Object(s.a)(e,Object(s.t)()?"touchstart":"mousedown",(function(e){t._thumbnailStretchStart(e)}),{passive:!1}),Object(s.a)(e,"click",(function(e){t._viewerPub.emit(o.d.UPDATE_FOCUS,{viewerId:t._postfix.replace("-",""),thumbnailId:t.uid}),Object(s.G)(e)}))}},t.prototype.unbindEvents=function(){for(var t in this._eventList)this._pubSub.off(t)},t.prototype.unbindUi=function(){var t,e,i;this._thumbnailCanvas.forEach((function(t){t.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},t.prototype.updateContent=function(t){void 0===t&&(t=[]),this._patch(t),this._updateElements(),this.renderCanvas()},t.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}}},t.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,s=0;s<n;s++){var o=t._thumbnailCanvas[s];~i.indexOf(o.uid)?(o.setTempData({showPage:t.showPageNumber,showSelectBox:t.showSelectBox,currentPage:s+1,isSelected:-1!==e.indexOf(s)}),o.resizeCanvasSize(1===t.rows&&1===t.columns&&t.isInner)):null==o||o.emptyPage()}}),100)},t.prototype.keydownCallBack=function(t){this._emit(o.f.KEY_DOWN,t),this.selectImageByKey(t)},t.prototype.keyupCallBack=function(t){this._emit(o.f.KEY_UP,t)},t.prototype.selectImageByKey=function(t){if(this.allowKeyboardControl&&this._thumbnailCanvas.length){var e=this.selectedIndexes.slice().pop(),i=this.rows,n=this.columns,r="vertical"===this.scrollDirection,a=e;switch(t.key){case"ArrowUp":case"Up":if(r)a-=n;else{if(Math.floor((a-1)/i)!==Math.floor(a/i))return;a-=1}break;case"ArrowDown":case"Down":if(r)a+=n;else{if(Math.floor((a+1)/i)!==Math.floor(a/i))return;a+=1}break;case"ArrowLeft":case"Left":if(r){if(Math.floor((a-1)/n)!==Math.floor(a/n))return;a-=1}else a-=i;break;case"ArrowRight":case"Right":if(r){if(Math.floor((a+1)/n)!==Math.floor(a/n))return;a+=1}else a+=i;break;default:return}this._viewerEmit(o.b.GOTO_PAGE,a),Object(s.B)(t)}},t.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)}},t.prototype.handleInnerProp=function(t,e){t in this&&(this[t]=e)},t.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))}},t.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))}},t.prototype._addNodes=function(t,e,i){var n,r,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=_._initNode(i);l.push(n);var h=document.createElement("li");h.style.background=_.pageBackground,h.style.border=_.pageBorder;var u=document.createElement("canvas");if(u.className="dvs-thumbnailCanvas",u.width=0,u.height=0,h.appendChild(u),n._canvasItem=u,!_.isInner){var d=document.createElement("span");d.className="dvs-thumbnail-remove",d.onclick=function(){var t=Object(s.g)(h);a._emit(o.f.REMOVE_PAGE,t)},h.appendChild(d)}null===(r=_._iObserver)||void 0===r||r.observe(h),c.appendChild(h)},_=this,p=e;p<=i;p++)d(p);Object(s.k)(c,u,h),(n=this._thumbnailCanvas).splice.apply(n,C([e,0],l))}},t.prototype._removeNodes=function(t,e,i){var n;t.splice(e,i-e+1);var s=this._myQuery("thumbLists"+this.uid);if(s&&s.children&&s.children.length)for(var o=e;o<=i;o++){var r=s.children[e];if(r){var a=r["dvs-uid"],l=r["dvs-defaultIndex"];this._showIndexes["delete"](l),this._renderIndexes["delete"](l),this._renderUids["delete"](a),null===(n=this._iObserver)||void 0===n||n.unobserve(r),s.removeChild(r)}}},t.prototype._patch=function(t){for(var e,i=this._thumbnailCanvas,n=0,s=i.length-1,o=0,r=t.length-1;n<=s&&o<=r;){var a=i[n],l=i[s],h=t[o],u=t[r];if(this._sameNode(a,h))++n,++o,a.updateData(h);else if(this._sameNode(l,u))--s,--r,l.updateData(u);else if(this._sameNode(a,u))a.updateData(u),this._moveNode(i,n,s);else if(this._sameNode(l,h))l.updateData(h),this._moveNode(i,s,n);else{e===undefined&&(e=this._createKeyHashList(i,n,s));var c=e[null==h?void 0:h.uid];c!==undefined?(i[c].updateData(h),this._moveNode(i,c,n)):(this._addNodes(t,o,o),s++),++o,++n}}n>s?this._addNodes(t,o,r):o>r&&this._removeNodes(i,n,s)},t.prototype._sameNode=function(t,e){return(null==t?void 0:t.uid)===(null==e?void 0:e.uid)},t.prototype._moveNode=function(t,e,i){var n=t.splice(e,1)[0];t.splice(i,0,n);var o=this._myQuery("thumbLists"+this.uid),r=o.removeChild(o.children[e]);r&&Object(s.k)(r,o.children[i],o)},t.prototype._initNode=function(t,e){var i={uid:t.uid,imgSrc:t.data,tags:t.tags};if(!e)return new y(i,this._pubSub,this._dataStore);e.init(i)},t.prototype._createKeyHashList=function(t,e,i){var n,s,o,r={};for(n=e;n<=i;++n)(s=null==(o=t[n])?void 0:o.uid)&&(r[s]=n);return r},t.prototype.selectThumbnailByIndexes=function(t){Object(s.l)(t)?this.selectedIndexes=t:t=this.selectedIndexes,this.clearAbsolute(),this._updateSelectedPageStyle(),(this.showPageNumber||this.showSelectBox)&&this.renderCanvas()},t.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,s=0;s<n;s++){var o=i[s],r=-1!==e.indexOf(s);this._selectThumbnailByNode(o,r)}},t.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))},t.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 s=this._myQuery("thumbLists"+this.uid);if(!s)return;s.style.marginTop=s.style.marginTop?"":"0.1px",this.renderCanvas()}return this.showLatestPage(),!0},t.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,s=this._getCurrentPageMargin(i,n,e);this._pageMarginNumber=s,this._setPageSize(i,n,e,s);var o=e.clientWidth-1,r=e.clientHeight-1;o===i&&r===n||this._setPageSize(o,r,e,s),this.renderCanvas()},t.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,s=t.clientHeight;i.width===n&&i.height===s||(i.width=n,i.height=s,this._emit(o.f.THUMBNAIL_STRETCH,e.width,e.height))}return this.updatePageLayout(),!0},t.prototype._getCurrentPageMargin=function(t,e,i){var n=this.rows,s=this.columns,o=this._pageMargin;if(o=String(o),/%$/.test(o)){var r=parseInt(o),a=Math.min(1/(s+1),1/(n+1));o=(r=Math.min(r/100,a))*e-1}else if(/em$/.test(o)){if(this._currentPageMargin<0){var l=parseInt(o),h=parseInt(window.getComputedStyle(i).fontSize);this._currentPageMargin=l*h}o=this._currentPageMargin}else o=parseInt(o);return t&&o*(s+1)>t+5&&(o=t/(s+1)),e&&o*(n+1)>e+5&&(o=e/(n+1)),o},t.prototype._setPageSize=function(t,e,i,n){if(null==i?void 0:i.children)for(var s=this.rows,o=this.columns,r=1===this.columns&&1===this.rows,a=((t-(o+1)*n)/o).toFixed(2),l=((e-(s+1)*n)/s).toFixed(2),h=i.children,u="vertical"===this._scrollDirection,c=0;c<h.length;c++){var d=h[c];r?(d.style.width=u?t+"px":"100%",d.style.height=u?"100%":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")}},t.prototype.updateDisplayedUidsIE=function(){var t=this;if(this.isDrag||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(o.e.MERGE_DISPLAYED_UIDS,n.slice(),this.uid)},t.prototype.updateDisplayedUids=function(){if(!this.showThumbnail||this.isDrag)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(o.e.MERGE_DISPLAYED_UIDS,i,this.uid)},t.prototype._handleObservePages=function(t){var e=this;t.forEach((function(t){var i=t.intersectionRect,n=t.target,s=(null==n||n["dvs-uid"],null==n?void 0:n["dvs-defaultIndex"]);(null==i?void 0:i.width)>0||(null==i?void 0:i.height)>0?e._showIndexes.add(s):e._showIndexes["delete"](s)}));var i=this._getRenderIndexes(this._showIndexes.array.slice());this._renderIndexes.array=i,this.updateDisplayedUids(),this.renderCanvas()},t.prototype._getRenderIndexes=function(t){var e=this,i=e.rows,n=e.columns,s=e.scrollDirection,o=e._thumbnailCanvas;if(!o)return[];var r=this._thumbnailCanvas.length,a=0;t.forEach((function(t){r=Math.min(t,r),a=Math.max(t,a)}));for(var l=[],h=r;h<=a;h++)o[h]&&l.push(h);if("vertical"===s){for(h=r-3*n;h<r;h++)o[h]&&l.push(h);for(var u=a+1;u<a+3*n;u++)o[u]&&l.push(u)}else{for(h=r-3*i;h<r;h++)o[h]&&l.push(h);for(u=a+1;u<a+3*i;u++)o[u]&&l.push(u)}return l},t.prototype.triggerTopImageChange=function(t){void 0===t&&(t=""),this.updateDisplayedUidsIE(),this._updateTopPageIndex(t)},t.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(),s=this.scrollDirection,o=-1,r=-1,a=i.children[t],l=a.getBoundingClientRect(),h=parseInt(i.style.padding);"vertical"===s?(r=0,l.top<=n.top?o=a.offsetTop-h+1:l.bottom>=n.bottom&&(o=a.offsetTop-n.height+l.height+h+1)):(o=0,l.left<=n.left?r=a.offsetLeft-h+1:l.right>=n.right&&(r=a.offsetLeft-n.width+l.width+h+1)),-1!==o&&(i.scrollTop=o),-1!==r&&(i.scrollLeft=r)}return this.triggerTopImageChange(e),!0},t.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()},t.prototype._updateTopPageIndex=function(t){void 0===t&&(t="");var e=this._thumbnailElement;if(!this.showThumbnail||!e||this.ifDragMoves)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._emit(o.f.TOP_PAGE_CHANGED,n,t),"scroll"===t&&this.autoChangeIndex&&(this._prtScrollOnce=!0,this._viewerEmit(o.d.SET_SELECTED_INDEXES,[n]))},t.prototype._getDisplayedImagesIE=function(){for(var t=this._calDisplayedIndexes(),e=t[0],i=t[1],n=[],s=e;s<=i;s++)s>=0&&n.push(s);return this._calculateTopIndex=e,n},t.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(),s=-1,o=0,r=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);o=(s=((u=Math.floor(u))+1)*this.columns)+(r+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);o=(s=((u=Math.floor(u))+1)*this.rows)+r*(a+1)-1}for(;!this._thumbnailCanvas[s]&&s>-1;)s--;for(;!this._thumbnailCanvas[o]&&o>s;)o--;return[s,o]},t.prototype.emptyHiddenPages=function(){},t.prototype.dragThumbnail=function(t){return!(t.ctrlKey||t.shiftKey||t.metaKey)&&(0===t.button&&this._dragStartFunction(t))},t.prototype.dragStartMobile=function(t){var e=this,i=t.changedTouches[0];return this._dragTimer=setTimeout((function(){document.addEventListener("touchmove",s.B,{passive:!1}),e._dragStartFunction(i)}),300),!0},t.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;n.classList.contains("dvs-activeThumb")||(this.selectedIndexes=[Object(s.g)(n)],this._updateSelectedPageStyle(),this.needClick=!1);var o=n.getBoundingClientRect(),r=t.clientX-o.left,a=t.clientY-o.top;return this.thumbMoveOption={napX:r,napY:a,clickX:t.pageX,clickY:t.pageY,target:n},this.isDrag=!0,this._dragStart=!0,!0},t.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],o=document.createElement("li");o.className="dvs-replaceBlock",Object(s.F)(o,{backgroundColor:this.placeholderBackground,margin:n.style.margin,width:n.style.width,height:n.style.height}),o["dvs-defaultIndex"]=n["dvs-defaultIndex"],Object(s.k)(o,n,t)}t.classList.add("hideReplaceBlock")},t.prototype.dragMove=function(t){return this._dragMoveFunction(t)},t.prototype.dragMoveMobile=function(t){var e=t.changedTouches[0];return clearTimeout(this._dragTimer),this._dragMoveFunction(e)},t.prototype._dragMoveFunction=function(t){if(this.isDrag){var e=this.thumbMoveOption,i=e.napX,n=e.napY,r=e.clickX,a=e.clickY,l=e.target,h=t.pageX,u=t.pageY;if(Math.abs(h-r)<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._emit(o.f.DRAG_START,{index:c,pageX:t.pageX,pageY:t.pageY},t)),this.ifDragMoves=!0;for(var _=d.scrollTop,p=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 b=this._thumbnailCanvas[m];if(-1!==f.indexOf(b.uid)){var y=b._canvasItem.parentNode;if(!y.classList.contains("dvs-activeThumb")){var E=y.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 w=Object(s.g)(y),T=d.querySelectorAll("li.dvs-replaceBlock"),I=Object(s.g)(T[0]),R=0;R<T.length;R++){var x=T[R];w<I?Object(s.k)(x,y,d):Object(s.j)(x,y)}return d.scrollTop=_,d.scrollLeft=p,!0}g++}}}var O=d.getBoundingClientRect(),P=t.clientY-O.top-n,L=t.clientX-O.left-i+p,A=P+_;d.classList.remove("hideReplaceBlock");for(var M=this._myQueryAll("thumbLists"+this.uid+">li.dvs-activeThumb"),B=0;B<M.length;B++){var D=M[B];D.classList.add("dvs-absolute"),D.style.left=L+5*B+"px",D.style.top=A+5*B+"px"}this._emit(o.f.DRAG_MOVE,{index:c,pageX:t.pageX,pageY:t.pageY},t),Object(s.B)(t)}},t.prototype.dragUp=function(){return this._dragUpFunction()},t.prototype.dragUpMobile=function(){return document.removeEventListener("touchmove",s.B),clearTimeout(this._dragTimer),this._dragUpFunction()},t.prototype._dragUpFunction=function(){if(this.isDrag){this.thumbMoveOption=null,this.isDrag=!1;var t=this.ifDragMoves;if(this.clearAbsolute(),!t)return!1;for(var e=this._myQuery("thumbLists"+this.uid),i=e.children.length,n=[],s=[],r=[],a=this.selectedIndexes.slice(0),l=[],h=0;h<i;h++){var u=e.children[h],c=u["dvs-defaultIndex"];if(r.push(c),u.classList.contains("dvs-activeThumb")){var d=a.indexOf(c);-1!==d&&(l[d]=h,c!==h&&s.push([c,h]))}n[h]=this._thumbnailCanvas[c]}this._thumbnailCanvas=n,this.selectedIndexes=l,this._updateElements(),this._viewerEmit(o.d.REORDER_THUMBNAIL,r,l.slice()),s.length&&this._emit(o.f.DRAG_DONE,s)}},t.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(s.B)(t))},t.prototype.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(),o=n.classList;o.contains("dvs-stretchRight")?(e=t.clientX-s.left<0?0:t.clientX-s.left,n.style.left=e+"px"):o.contains("dvs-stretchLeft")?(e=s.right-t.clientX<0?0:s.right-t.clientX,n.style.left=s.width-e+"px"):o.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")},t.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),s=0,r=this._thumbnailElement.getBoundingClientRect(),a=r.width-i,l=r.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),s=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*s,100).toFixed(2)+"%",this._emit(o.d.CHANGE_THUMBNAIL_VIEW_PROP,{_size:this.size}),this._resizeViewer()},t.prototype._updateStretchBars=function(){var t=this._allowResizing,e=this._location,i=this._sequence,n="horizontal"===e&&t&&i>=0?"remove":"add",s="vertical"===e&&t&&i>=0?"remove":"add",o="horizontal"===e&&t&&i<0?"remove":"add",r="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[o]("dvs-nodisplay"),null==u||u.classList[s]("dvs-nodisplay"),null==c||c.classList[r]("dvs-nodisplay")},t.prototype._updateProps=function(t){for(var e in t)this[e]=t[e]},t.prototype._imageClickCallback=function(t,e){var i=this.selectedIndexes.slice();if(!e.ctrlKey&&!e.metaKey||e.shiftKey)if(!e.shiftKey||e.ctrlKey||e.metaKey)if((e.ctrlKey||e.metaKey)&&e.shiftKey){var n=i.slice(0);l=n[n.length-1];n.push(t);var s=t,r=t;n.forEach((function(t){t<s?s=t:t>r&&(r=t)}));var a=[];for(u=s;u<=r;u++)u!==l&&a.push(u);l>=0&&a.push(l),i=a}else this.needClick?i=[t]:this.needClick=!0;else{var l;if((l=i[i.length-1])===undefined)i.push(t);else{var h=[];if(l<t)for(var u=t;u>=l;u--)h.push(u);else for(var c=t;c<=l;c++)h.push(c);i=h}}else{var d=i.indexOf(t);if(-1===d)i.push(t);else{if(1===i.length)return!1;i.splice(d,1)}}return this._viewerEmit(o.d.SET_SELECTED_INDEXES,i),!0},t.prototype._thumbnailDragStart=function(t){return Object(s.t)()?this.dragStartMobile(t):this.dragThumbnail(t)},t.prototype._thumbnailDragMove=function(t){return Object(s.t)()?this.dragMoveMobile(t):this.dragMove(t)},t.prototype._thumbnailDragUp=function(){return Object(s.t)()?this.dragUpMobile():this.dragUp()},t.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._emit(o.f.PAGE_MOUSE_OVER,{index:i,pageX:t.pageX,pageY:t.pageY},t)}else this._emit(o.f.PAGE_MOUSE_OVER,{index:-1,pageX:t.pageX,pageY:t.pageY},t)}},t.prototype._thumbnailMouseOut=function(t){if(this.allowHover&&!this.ifDragMoves){var e=this.getImageItem(t);if(e){var i=e["dvs-defaultIndex"];this._emit(o.f.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._emit(o.f.PAGE_MOUSE_OUT,{index:-1,pageX:t.pageX,pageY:t.pageY},t)}},t.prototype._thumbnailClick=function(t){if(!this.ifDragMoves){var e=this.getImageItem(t);if(e){var i=e["dvs-defaultIndex"];this._imageClickCallback(i,t),this._emit(o.f.PAGE_CLICK,{index:i,pageX:t.pageX,pageY:t.pageY},t)}else this._emit(o.f.PAGE_CLICK,{index:-1,pageX:t.pageX,pageY:t.pageY},t)}},t.prototype._thumbnailRightClick=function(t){var e=this.getImageItem(t);if(e){if(this.ifDragMoves)return!1;var i=e["dvs-defaultIndex"];this._emit(o.f.PAGE_RIGHT_CLICK,{index:i,pageX:t.pageX,pageY:t.pageY},t),this._emit(o.f.PAGE_CONTEXTMENU,{index:i,pageX:t.pageX,pageY:t.pageY},t),-1!==this.selectedIndexes.indexOf(i)||Object(s.t)()&&this.allowPageDragging||this._emit(o.d.SET_SELECTED_INDEXES,[i])}else this._emit(o.f.PAGE_RIGHT_CLICK,{index:-1,pageX:t.pageX,pageY:t.pageY},t),this._emit(o.f.PAGE_CONTEXTMENU,{index:-1,pageX:t.pageX,pageY:t.pageY},t)},t.prototype._thumbnailDoubleClick=function(t){var e=this.getImageItem(t);if(e){var i=e["dvs-defaultIndex"];this._emit(o.f.PAGE_DOUBLE_CLICK,{index:i,pageX:t.pageX,pageY:t.pageY},t)}else this._emit(o.f.PAGE_DOUBLE_CLICK,{index:-1,pageX:t.pageX,pageY:t.pageY},t)},t.prototype._thumbnailPointerDown=function(t){var e=this.getImageItem(t);if(e){var i=e["dvs-defaultIndex"];this._emit(o.f.PAGE_MOUSE_DOWN,{index:i,pageX:t.pageX,pageY:t.pageY},t)}else this._emit(o.f.PAGE_MOUSE_DOWN,{index:-1,pageX:t.pageX,pageY:t.pageY},t)},t.prototype._thumbnailPointerMove=function(t){var e,i,n,s,r,a;if(this.ifDragMoves){if(!(this.isInner?null===(n=null===(i=null===(e=this._viewerPub)||void 0===e?void 0:e._events)||void 0===i?void 0:i[o.f.PAGE_MOUSE_MOVE])||void 0===n?void 0:n.length:null===(a=null===(r=null===(s=this._pubSub)||void 0===s?void 0:s._events)||void 0===r?void 0:r[o.f.PAGE_MOUSE_MOVE])||void 0===a?void 0:a.length))return;var l=this._getPointIndex(t);this._emit(o.f.PAGE_MOUSE_MOVE,{index:l,pageX:t.pageX,pageY:t.pageY},t)}else{var h=this.getImageItem(t);if(h){var u=h["dvs-defaultIndex"];this._emit(o.f.PAGE_MOUSE_MOVE,{index:u,pageX:t.pageX,pageY:t.pageY},t)}else this._emit(o.f.PAGE_MOUSE_MOVE,{index:-1,pageX:t.pageX,pageY:t.pageY},t)}},t.prototype._thumbnailPointerUp=function(t){if(this.ifDragMoves){var e=this._getPointIndex(t);this._emit(o.f.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._emit(o.f.PAGE_MOUSE_UP,{index:n,pageX:t.pageX,pageY:t.pageY},t)}else this._emit(o.f.PAGE_MOUSE_UP,{index:-1,pageX:t.pageX,pageY:t.pageY},t)}},t.prototype._thumbnailScroll=function(){this.triggerTopImageChange("scroll")},t.prototype._thumbnailStretchStart=function(t){this.stretchStart(t)},t.prototype._documentMouseMove=function(t){this.stretchMove(t)},t.prototype._documentMouseUp=function(){this.stretchEnd(),this._thumbnailDragUp()},t.prototype.getImageItem=function(t){var e,i,n;if(!t)return null;if(!(n=Object(s.p)(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},t.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 o=n.children,r=0;r<o.length;r++){var a=o[r];if(this._checkPointOnElement(t,a)&&!(null===(i=a.classList)||void 0===i?void 0:i.contains("dvs-activeThumb")))return Object(s.h)(a,(function(t){var e;return!(null===(e=t.classList)||void 0===e?void 0:e.contains("dvs-activeThumb"))}))}return-1},t.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 o=i[n];Object(s.k)(o,e[n],t),o.classList.remove("dvs-absolute"),o.style.left=null,o.style.top=null}for(var r=0;r<e.length;r++){var a=e[r];t.removeChild(a)}"vertical"===this.scrollDirection?t.style.overflowY="auto":t.style.overflowX="auto"},t.prototype.setPercent=function(t){var e=this._thumbnailElement;e&&(e.style.flex="0 0 "+t+"%",e.style.msFlex="0 0 "+t+"%")},t.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},t.prototype.getUidByIndex=function(t){var e;return null===(e=this._thumbnailCanvas[t])||void 0===e?void 0:e.uid},t.prototype._resizeViewer=function(t){void 0===t&&(t=!1),t?this._viewerEmit(o.e.VIEWER_RESIZE,this.uid,this.showLatestPage.bind(this)):this._viewerEmit(o.e.VIEWER_RESIZE)},t.prototype._setSplitBarDelay=function(){var t=this;this.isInner||(clearTimeout(this._splitTimer),this._splitTimer=setTimeout((function(){t._viewerEmit("onSetSplitBar")}),50))},t.prototype._checkPointOnElement=function(t,e){var i,n;if(!t||!e)return!1;var s=-1,o=-1;if(null===(i=t.changedTouches)||void 0===i?void 0:i[0]){var r=null===(n=t.changedTouches)||void 0===n?void 0:n[0];s=r.clientX,o=r.clientY}else{var a=t;s=a.clientX,o=a.clientY}var l=e.getBoundingClientRect();return s>=l.left&&o>=l.top&&s<=l.right&&o<=l.bottom},t.prototype._emit=function(t){for(var e,i=[],n=1;n<arguments.length;n++)i[n-1]=arguments[n];(e=this._pubSub).emit.apply(e,C([t],i))},t.prototype._viewerEmit=function(t){for(var e,i=[],n=1;n<arguments.length;n++)i[n-1]=arguments[n];(e=this._viewerPub).emit.apply(e,C([t],i))},t}(),w=i(3),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)}}(),I=function(t){function e(e,i,n,s,r){var a=t.call(this,e,i,n,s,r)||this;return a.isInner=!0,a._isCrop=!1,a.cropIndex=-1,a.cropUid="",a._originEvents=[],a._tbEvents=[],a._viewerEvents=[],a.cropManager=new w.a(0,0),a.cropManager.selectedCallback=function(t){var e=a.selectedIndexes.slice().pop(),i=a._thumbnailCanvas[e];i&&i.renderImg&&a._viewerPub.emit(o.f.PAGE_AREA_SELECTED,e,t)},a.cropManager.unselectedCallback=function(){for(var t=a.cropIndex,e=a._thumbnailCanvas.length,i=0;i<e;i++){var n=a._thumbnailCanvas[i];a.cropUid===n.uid&&(a.cropManager.cropBoxes=[],n.renderImg?a.setPageRect(n):n.setRect([]))}a._viewerPub.emit(o.f.PAGE_AREA_UNSELECTED,t)},a._initEvents(),a}return T(e,t),e.prototype._initEvents=function(){var t=this,e=[o.d.CANVAS_MOUSE_DOWN,o.d.CANVAS_MOUSE_MOVE,o.d.CANVAS_MOUSE_UP,o.d.CANVAS_CLICK,o.d.CANVAS_RIGHT_CLICK,o.d.CANVAS_DOUBLE_CLICK,o.d.CANVAS_MOUSE_OVER,o.d.CANVAS_MOUSE_OUT],i=[o.f.PAGE_MOUSE_DOWN,o.f.PAGE_MOUSE_MOVE,o.f.PAGE_MOUSE_UP,o.f.PAGE_CLICK,o.f.PAGE_RIGHT_CLICK,o.f.PAGE_DOUBLE_CLICK,o.f.PAGE_MOUSE_OVER,o.f.PAGE_MOUSE_OUT];this._originEvents=i;for(var n=0;n<e.length;n++)this._packageEvent(i[n],e[n]);this._tbEvents=[[o.f.DRAG_DONE,function(e){t._viewerPub.emit(o.d.CANVAS_DRAG_DONE,e)}],[o.f.TOP_PAGE_CHANGED,function(e,i){t._viewerPub.emit(o.f.TOP_PAGE_CHANGED,e,i)}],[o.f.PAGE_MOUSE_DOWN,function(e,i){t._cropStart(e,i)}],[o.e.DOCUMENT_POINTER_UP,function(e){t._cropUp(e)}],[o.f.VIEWER_PAGE_RENDERED,function(e){t._viewerPub.emit(o.f.VIEWER_PAGE_RENDERED,e)}]],this._tbEvents.forEach((function(e){t._pubSub.on(e[0],e[1])})),this._viewerEvents=[[o.e.DOCUMENT_POINTER_MOVE,function(e){t._cropMove(e)}],[o.e.DOCUMENT_POINTER_UP,function(e){t._cropUp(e)}],[o.d.CLEAR_SLT_BOX,function(){t.cropManager.clear()}]],this._viewerEvents.forEach((function(e){t._viewerPub.on(e[0],e[1])}))},e.prototype._initThumbnailConfig=function(t){this._pubSub=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.prototype.dispose=function(){var t=this;this._originEvents.forEach((function(e){t._pubSub.off(e)})),this._tbEvents.forEach((function(e){t._pubSub.off(e[0])})),this._viewerEvents.forEach((function(e){t._viewerPub.off(e[0])})),this._originEvents=[],this._tbEvents=[],this._viewerEvents=[]},e.prototype._packageEvent=function(t,e){var i=this;this._pubSub.on(t,(function(t,n){var s=t.index,o=t.pageX,r=t.pageY;if(-1===s)i._viewerPub.emit(e,n,{index:s,imageX:-1,imageY:-1,pageX:o,pageY:r});else{if(!i._thumbnailCanvas[s])return;var a=i._getOriginPosition(s,n),l=a.imageX,h=a.imageY;i._viewerPub.emit(e,n,{index:s,imageX:l,imageY:h,pageX:o,pageY:r})}}))},e.prototype._getOriginPosition=function(t,e,i){var n;void 0===i&&(i=!0);var s=null,o=null,r=null===(n=this._thumbnailElement.querySelector(".dvs-thumbLists"))||void 0===n?void 0:n.children;if(r){if(this.ifDragMoves)for(var a=-1,l=0;l<r.length;l++){var h=r[l];if(!(null==h?void 0:h.classList.contains("dvs-activeThumb"))&&t===++a){s=h,o=this._thumbnailCanvas[h["dvs-defaultIndex"]];break}}else s=r[t],o=this._thumbnailCanvas[t];if(s){var u=s.getBoundingClientRect(),c=this._dataStore.getMetadata(o.uid);if(!o.renderImg||!(null==c?void 0:c.width)||!(null==c?void 0:c.height))return{imageX:-1,imageY:-1};var d=e.clientX-u.left,_=e.clientY-u.top,p=o.renderImg.naturalWidth,v=o.renderImg.naturalHeight,f=o.fitRatio,m=d-(u.width-p/f)/2,g=_-(u.height-v/f)/2;if(i&&(m<0||g<0||m>p/f||g>v/f))return{imageX:-1,imageY:-1};var b=c.width/p;return{imageX:Math.floor(m*f*b),imageY:Math.floor(g*f*b)}}}},e.prototype._cropStart=function(t,e){var i=t.index,n=this.selectedIndexes.slice().pop();if(-1!==i&&n===i&&this._isCrop){var r=this._thumbnailCanvas[i];if(r&&r.renderImg){var a=this._getOriginPosition(i,e),l=a.imageX,h=a.imageY;if(-1!==l&&-1!==h){var u=this._dataStore.getMetadata(r.uid);if(!(null==u?void 0:u.width)||!u.height)return this._pubSub.emit(o.d.ERROR,o.a.META_DATA_NOT_EXIST),!1;var c=u.width/r.renderImg.naturalWidth,d=r.fitRatio,_=this.cropManager;_.setZoom(1/d/c),_.setPageSize(u.width,u.height),_.onStartHandler(l,h,e.ctrlKey),r.setRect(_.cropBoxes,this.selectedBoxLineColor),Object(s.B)(e)}}}},e.prototype._cropMove=function(t){if(this.showThumbnail&&this._isCrop){var e=this.selectedIndexes.slice().pop();if(-1!==e){var i=this._thumbnailCanvas[e];if(i){var n=this._getOriginPosition(e,t,!1),s=n.imageX,r=n.imageY,a=this.cropManager,l=a.checkSelectForCursor(s,r);if(l){var h="move"===l.position?"move":l.position+"-resize";this._viewerPub.emit(o.e.CHANGE_CANVAS_CURSOR,h)}else this._viewerPub.emit(o.e.CHANGE_CANVAS_CURSOR,"");a.mouseDown&&(a.setKeepAspectRatio(t.shiftKey),a.onMoveHandler(s,r,!1),this.setPageRect(i))}}}},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(t,e){e||this.cropManager.clear(),Object(s.l)(t)||(t=[t]);var i=this.selectedIndexes.slice().pop(),n=this._thumbnailCanvas[i],r=this._dataStore.getMetadata(n.uid);this.cropManager.setPageSize(r.width,r.height);for(var a=t.length,l=0;l<a;l++){var h=t[l];this.cropManager.addBox([h.left,h.top,h.left+h.width,h.top,h.left+h.width,h.top+h.height,h.left,h.top+h.height],"bottomRight")}var u=this.cropManager.getRectArr();this.setPageRect(n),this._viewerPub.emit(o.f.PAGE_AREA_SELECTED,i,u),this._viewerPub.emit(o.f.VIEWER_PAGE_RENDERED,i,u)},e.prototype.setKeepAspectRatio=function(t){},e.prototype.setAspectRatio=function(t){this.cropManager.setAspectRatio(t)},e.prototype.clearSelectedBoxes=function(t){this.cropManager.clear()},e}(S),R=i(2),x=undefined&&undefined.__spreadArrays||function(){for(var t=0,e=0,i=arguments.length;e<i;e++)t+=arguments[e].length;var n=Array(t),s=0;for(e=0;e<i;e++)for(var o=arguments[e],r=0,a=o.length;r<a;r++,s++)n[s]=o[r];return n},O=function(){function t(t,e,i,n){this._viewerContainer=null,this._dataStore=null,this._thumbnails={},this.innerThumbnail=null,this._selectedIndexes=[],this._displayedUidsManage={},this._thumbnailContents=[],this._lastShowUid="",this._displayTimer=null,this.postfix=t,this._pubSub=e,this._viewerContainer=i,this._dataStore=n,this._bindEvents()}return t.prototype.createThumbnail=function(t){var e=t.uid;e||(e=Object(s.I)(11),t.uid=e);var i=new S(t,this._pubSub,this._viewerContainer,this.postfix,this._dataStore);return this._thumbnails[e]=i,i.updateContent(this._thumbnailContents),i.selectThumbnailByIndexes(this._selectedIndexes),!0},t.prototype.createInnerThumbnail=function(t){var e={uid:this.postfix,pubsub:new R.a,size:"100%",background:t.canvasBackground,mouseShape:t.canvasMouseShape,border:t.canvasBorder,location:"canvas",allowResizing:!1,showThumbnail:!1};Object(s.z)(t,e),this.innerThumbnail=new I(e,this._pubSub,this._viewerContainer,this.postfix,this._dataStore)},t.prototype.removeThumbnail=function(t){var e=this._thumbnails[t];return!!e&&(e.unbindEvents(),e.unbindUi(),this.emit("onSetSplitBar"),delete this._thumbnails[t],!0)},t.prototype.removeAllThumbnail=function(){var t,e,i;for(var n in this._thumbnails)this.removeThumbnail(n);null===(t=this.innerThumbnail)||void 0===t||t.unbindEvents(),null===(e=this.innerThumbnail)||void 0===e||e.dispose(),null===(i=this.innerThumbnail)||void 0===i||i.unbindUi(),this._thumbnails={},this._viewerContainer=null,this.off(o.e.MERGE_DISPLAYED_UIDS),this.off(o.e.UPDATE_THB_ITEM)},t.prototype.on=function(t,e){this._pubSub.on(t,e.bind(this))},t.prototype.off=function(t,e){this._pubSub.off(t,e)},t.prototype.emit=function(t){for(var e,i=[],n=1;n<arguments.length;n++)i[n-1]=arguments[n];(e=this._pubSub).emit.apply(e,x([t],i))},t.prototype._bindEvents=function(){var t=this;this.on(o.e.MERGE_DISPLAYED_UIDS,(function(e,i){t._displayedUidsManage[i]=e,clearTimeout(t._displayTimer),t._displayTimer=setTimeout((function(){var e=new E;for(var i in t._displayedUidsManage){var n=t._displayedUidsManage[i];e.array=e.concat(n)}t.emit(o.d.DISPLAYED_IMAGE_CHANGED,e.array.slice())}),100)})),this.on(o.e.UPDATE_THB_ITEM,(function(e){t._updatePageItem(e)}))},t.prototype.calculateSize=function(){var t;for(var e in this._thumbnails)this._thumbnails[e].calculateSize();null===(t=this.innerThumbnail)||void 0===t||t.calculateSize()},t.prototype.updateAllDisplayed=function(){var t;for(var e in this._thumbnails)this._thumbnails[e].updateDisplayedUidsIE();null===(t=this.innerThumbnail)||void 0===t||t.updateDisplayedUidsIE()},t.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)},t.prototype.updatePagesLayout=function(){var t;for(var e in this._thumbnails)this._thumbnails[e].updatePageLayout();null===(t=this.innerThumbnail)||void 0===t||t.updatePageLayout()},t.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)},t.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 s in this._thumbnails)this._thumbnails[s].updatePageItem(t);null===(e=this.innerThumbnail)||void 0===e||e.updatePageItem(t)},t.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)},t.prototype.pageChangeCallback=function(t,e,i){var n,s=this._thumbnailContents,o=this.innerThumbnail,r=this._lastShowUid,a=null===(n=s[e])||void 0===n?void 0:n.uid;a!==undefined&&r===a||(o.clearSelectedBoxes(),o.cropIndex=e,o.cropUid=a,this._lastShowUid=a)},t.prototype.keydownCallback=function(t,e){var i=this._thumbnails[e];i?i.keydownCallBack(t):e===this.innerThumbnail.uid&&(this.innerThumbnail.keydownCallBack(t),this.emit(o.d.CANVAS_KEY_DOWN,t))},t.prototype.keyupCallback=function(t,e){var i=this._thumbnails[e];i?i.keyupCallBack(t):e===this.innerThumbnail.uid&&(this.innerThumbnail.keyupCallBack(t),this.emit(o.d.CANVAS_KEY_UP,t))},t}(),P=function(){function t(t,e,i){this._pub=null,this._xOver=!1,this._yOver=!1,this.isMyScroll=!1,this.buttonMove=!1,this._isButtonScroll=!1,this._unbindList=[],this._postfix=t,this._pub=e,this._myQuery=function(t,e){var n;return void 0===e&&(e="#"),null===(n=null==i?void 0:i.el)||void 0===n?void 0:n.querySelector(e+t)},this._myQueryAll=function(t,e){var n;return void 0===e&&(e="#"),null===(n=null==i?void 0:i.el)||void 0===n?void 0:n.querySelectorAll(e+t)}}return t.prototype.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(),e._pub.emit("_onCanvasResize")})),i},t.prototype.setScroller=function(t,e){var i=Object(s.i)("outer"+this._postfix);if(!i)return!1;var n=i.scrollLeft,o=i.scrollTop;return n===t&&o===e||(this.isMyScroll=!0),i.scrollLeft=t,i.scrollTop=e,!0},t.prototype.setOuterSize=function(t,e){var i=Object(s.i)("outer"+this._postfix),n=Object(s.i)("inner"+this._postfix),o=!1,r=!1;if(!i||!n)return!1;t>i.offsetWidth?(i.style.overflowX="auto",o=!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";var a=this._xOver!==o,l=this._yOver!==r;return this._xOver=o,this._yOver=r,a||l},t.prototype.setViewPort=function(){var t=Object(s.i)("outer"+this._postfix),e=Object(s.i)("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)"},t.prototype._addButtonScroll=function(){var t=this,e=[],i=this._myQueryAll("dvs-groupType",".");if(i){var n=Object(s.t)();this._pub.on(o.e.DOCUMENT_POINTER_MOVE,(function(e){n?t.buttonScrollMoveMobile(e):t.buttonScrollMove(e)})),this._pub.on(o.e.DOCUMENT_POINTER_UP,(function(){t.buttonScrollEndFun()})),[].forEach.call(i,(function(i){"ontouchstart"in document.documentElement?Object(s.a)(i,o.c.TOUCH_START,(function(e){t.buttonScrollStartMobile(e)})):Object(s.a)(i,o.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 r=i.querySelector(".dvs-showAfter");r&&(r.onclick=function(){i.scrollLeft=i.scrollWidth-i.clientWidth,t._updateShowMore(i)})}))}},t.prototype.buttonScrollStart=function(t){return(!t.button||0===t.button)&&(this._buttonScrollStartFun(t),!0)},t.prototype.buttonScrollStartMobile=function(t){var e=t.changedTouches[0];return!!e&&(this._buttonScrollStartFun(e),!0)},t.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}},t.prototype.buttonScrollMove=function(t){return this._buttonScrollMoveFun(t),!0},t.prototype.buttonScrollMoveMobile=function(t){var e=t.changedTouches[0];return!!e&&(this._buttonScrollMoveFun(e),!0)},t.prototype._buttonScrollMoveFun=function(t){if(!this._isButtonScroll)return!1;var e=this._scrollStartInfo,i=e.x,n=e.y,o=e.left,r=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=o-l,a.scrollTop=r-h,this._updateShowMore(a),Object(s.B)(t))}},t.prototype.buttonScrollEndFun=function(){this._isButtonScroll=!1,this._scrollStartInfo={},document.removeEventListener(o.c.TOUCH_MOVE,s.B)},t.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,s=t.querySelector(".dvs-showBefore");if(!s||"SPAN"!==s.tagName)return!1;i&&t.clientWidth>=60?s.classList.remove("dvs-nodisplay"):s.classList.add("dvs-nodisplay");t.children.length;var o=t.querySelector(".dvs-showAfter");n&&t.clientWidth>=60?o.classList.remove("dvs-nodisplay"):o.classList.add("dvs-nodisplay"),e=t.scrollLeft,s.style.left=e+"px",o.style.right=-e+"px"},t.prototype.updateAllGroupShowMore=function(){var t=this,e=this._myQueryAll("dvs-groupType",".");e&&[].forEach.call(e,(function(e){t._updateShowMore(e)}))},t.prototype.unbindEvents=function(){this._unbindList.forEach((function(t){null==t||t()}))},t}(),L=function(){function t(t,e){this._currentPage=-1,this._totalPage=0,this._postfix=t,this._pubsub=e}return t.prototype.goToPage=function(t){this._pubsub.emit(o.b.GOTO_PAGE,t)},t.prototype.getCurrentPage=function(){return this._currentPage},t.prototype.setCurrentPage=function(t){return!!Object(s.u)(t)&&(this._currentPage=t,!0)},t.prototype.getTotalPage=function(){return this._totalPage},t.prototype.setTotalPage=function(t){return!!Object(s.u)(t)&&(this._totalPage=t,!0)},t.prototype.updatePage=function(t){var e=document.getElementById("pagerInput"+this._postfix),i=document.getElementById("pagerLabel"+this._postfix),n=t.cur,s=t.total;this.setCurrentPage(n),this.setTotalPage(s);var o=s?n+1:0;if(e&&i){e.value=o,i.innerText=String(s),e.style.fontSize="16px";var r=16*String(s).length+"px";e.style.width=r}},t.prototype.pageBlur=function(t){var e=t.target,i=parseInt(e.value);e.value=String(this._currentPage+1),this.goToPage(i-1)},t}(),A=function(){function t(t){this.id="",this.name="",this.type="",this.iconClass="",this._init(t)}return t.prototype._init=function(t){if(s.v)for(var e=Object.keys(t),i=0;i<e.length;i++){var n=e[i];n!==undefined&&(this[n]=t[n])}},t}(),M=function(){function t(t,e,i,n,s){return this.createVNode(t,e,i,n,s)}return t.prototype.createVNode=function(t,e,i,n,s){void 0===e&&(e={}),void 0===i&&(i=[]),void 0===s&&(s="");var o={el:n,tagName:t,sel:"",data:e,children:i,text:s};return this._updateVNode(o)},t.prototype._updateVNode=function(t){var e=this;Object(s.v)(t.data)||(t.data={}),Object(s.l)(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}(),B={createVnode:function(t,e,i,n,o){if(void 0===e&&(e={}),void 0===i&&(i=[]),Object(s.v)(e)&&Object(s.l)(i))return new M(t,e,i,n,o)},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,s,o,r={};for(n=e;n<=i;++n)(o=t[n])&&o.data&&(s=o.data.key)&&(r[s]=n);return r},removeVnodes:function(t,e,i){for(;e<=i;){var n=t[e];if(null!=n&&n.el){var s=n.el.parentElement;s&&s.removeChild(n.el)}++e}},addVnodes:function(t,e,i,n,o){for(var r=function(){var o=i[n];if(o){if(!o.el)o.el=document.createElement(o.tagName),Object.keys(o.data).forEach((function(t){"class"===t?o.el.className=o.data[t]:"style"===t?o.el.setAttribute(t,o.data[t]):o.el[t]=o.data[t]}));o.text&&(o.el.textContent=o.text),Object(s.k)(o.el,e,t);var r=o.children;r&&r.length&&a.addVnodes(o.el,null,r,0,r.length)}++n},a=this;n<=o;)r()},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,s=e.children;t!==e&&(""!==e.text&&t.text!==e.text?i.textContent=e.text:n.length&&s.length&&n!==s?this.updateChildren(i,n,s):s&&s.length?this.addVnodes(i,null,s,0,s.length):n&&n.length&&this.removeVnodes(n,0,n.length))},updateChildren:function(t,e,i){for(var n,o,r,a,l=0,h=0,u=e.length-1,c=i.length-1,d=e[0],_=e[u],p=i[0],v=i[c];l<=u&&h<=c;)null==d?d=e[++l]:null==_?_=e[--u]:null==p?p=i[++h]:null==v?v=i[--c]:this.sameVnode(d,p)?(this.patchVnode(d,p),d=e[++l],p=i[++h]):this.sameVnode(_,v)?(this.patchVnode(_,v),_=e[--u],v=i[--c]):this.sameVnode(d,v)?(this.patchVnode(d,v),Object(s.k)(d.el,_.el.nextSibling,t),d=e[++l],v=i[--c]):this.sameVnode(_,p)?(this.patchVnode(_,p),Object(s.k)(_.el,d.el,t),_=e[--u],p=i[++h]):(n===undefined&&(n=this.createKeyHashList(e,l,u)),(o=n[p.data.key])===undefined?(this.addVnodes(t,d.el,i,h,h),p=i[++h]):((r=e[o]).sel!==p.sel?this.addVnodes(t,d.el,e,o,o):(this.patchVnode(r,p),Object(s.k)(p.el,d.el,t),e[o]=null),p=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(s.k)(e.el,i.nextSibling,n),n.removeChild(t.el),t=null)}return e}},D=function(){function t(t,e,i){this._viewerContainer=null,this._postfix="",this._pubsub=null,this._tabList=[],this._tabVNode=null,this._selectedTabId="",this._postfix=t,this._pubsub=e,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=B.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=B.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,s=0;s<n.length;s++){var o=n[s];null==o||o.classList[(null==o?void 0:o.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 A(t)},t.prototype._createVirtualTab=function(t){for(var e,i=B.createVnode,n=i("DIV"),s=0,o=t.length;s<o;s++){var r=t[s],a=i("DIV",{"class":"dvs-tabItem "+(r.id===this._selectedTabId?"activeTab":""),id:r.uid,key:r.uid,title:r.name},[i("SPAN",{"class":r.iconClass||""}),i("SPAN",{"class":"dvs-tabText"},[],null,r.name),i("A",{"class":"ds-dvs-ui-iconfont ds-dvs-ui-cancle dvs-closeTab","dvs-id":r.uid})]);null===(e=n.children)||void 0===e||e.push(a)}return n},t}(),N=function(){function t(t){var e=t.postfix,i=t.pubsub,n=t.viewerContainer;this._postfix="",this._pubsub=null,this._viewerContainer=null,this._width=0,this._height=0,this._innerWidth=0,this._innerHeight=0,this._scrollLeft=0,this._scrollTop=0,this._canvasList=[],this._postfix=e,this._pubsub=i,this._viewerContainer=n}return t.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)},t.prototype.canvasRenderInit=function(){this._createCanvas("main"),this._createCanvas("cropper"),this._createSlider()},t.prototype.updateCanvasInnerSize=function(){var t,e=this._query("canvasScroll"),i=null===(t=this._query("innerThumbnail"))||void 0===t?void 0:t.querySelector(".dvs-thumbLists");if(!e||!i)return!1;var n=e.offsetWidth||i.offsetWidth,s=e.offsetHeight||i.offsetHeight;if(0===n||0===s)return!1;this._pubsub.emit("_setCanvasSize",{width:n,height:s})},t.prototype.updateScrollSize=function(t){var e=t.width,i=t.height,n=t.x,o=t.y;if(e>0&&i>0){this._innerWidth=e,this._innerHeight=i;var r=this._query("scrollInner");r&&(r.style.width=e-1+"px",r.style.height=i-1+"px")}if(n!==this._scrollLeft||o!==this._scrollTop){var a=this._query("canvasScroll");a&&(this._scrollLeft=a.scrollLeft=n,this._scrollTop=a.scrollTop=o),a=null}var l=this._query("canvasWrapper"),h=this._query("canvasScroll");if(l&&h){var u=h.clientWidth,c=h.clientHeight;if(0===u||0===c)return;l.style.width=u+"px",l.style.height=c+"px";for(var d=Object(s.d)(),_=null==l?void 0:l.children,p=0;p<_.length;p++){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}}},t.prototype._createSlider=function(){var t=this._query("viewPort");if(!t)return null;var e=document.createElement("div");e.className="dvs-slideWrapper";for(var i=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,this._pubsub.emit(o.d.BIND_SLIDE_COMPONENT,e),e=null},t.prototype._removeSlider=function(){var t=this._query("viewPort");if(!t)return null;var e=t.querySelector(".dvs-slideWrapper");this._pubsub.emit(o.d.UNBIND_SLIDE_COMPONENT),e&&t.removeChild(e),e=null},t.prototype._createCanvas=function(t){var e,i=this._query("canvasWrapper");if(!i)return null;var n=document.createElement("canvas");n.id=t+"Canvas"+this._postfix,n.className="dvs-canvas dvs-"+t,i.appendChild(n),this._pubsub.emit("_bindCanvas",((e={})[t]=n,e)),this._canvasList.push(t),n=null},t.prototype._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),this._pubsub.emit("_unbindCanvas",t);for(var n=0;n<this._canvasList.length;n++)if(this._canvasList[n]===t){this._canvasList.splice(n,1);break}return i},t.prototype.removeAllCanvas=function(){for(var t=0;t<this._canvasList.length;t++)this._removeCanvas(this._canvasList[t])&&t--;this._removeSlider()},t}(),U=undefined&&undefined.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,o){function r(t){try{l(n.next(t))}catch(e){o(e)}}function a(t){try{l(n["throw"](t))}catch(e){o(e)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(r,a)}l((n=n.apply(t,e||[])).next())}))},k=undefined&&undefined.__generator||function(t,e){var i,n,s,o,r={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return o={next:a(0),"throw":a(1),"return":a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;r;)try{if(i=1,n&&(s=2&o[0]?n["return"]:o[0]?n["throw"]||((s=n["return"])&&s.call(n),0):n.next)&&!(s=s.call(n,o[1])).done)return s;switch(n=0,s&&(o=[2&o[0],s.value]),o[0]){case 0:case 1:s=o;break;case 4:return r.label++,{value:o[1],done:!1};case 5:r.label++,n=o[1],o=[0];continue;case 7:o=r.ops.pop(),r.trys.pop();continue;default:if(!(s=r.trys,(s=s.length>0&&s[s.length-1])||6!==o[0]&&2!==o[0])){r=0;continue}if(3===o[0]&&(!s||o[1]>s[0]&&o[1]<s[3])){r.label=o[1];break}if(6===o[0]&&r.label<s[1]){r.label=s[1],s=o;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(o);break}s[2]&&r.ops.pop(),r.trys.pop();continue}o=e.call(t,r)}catch(a){o=[6,a],n=0}finally{i=s=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},V=undefined&&undefined.__spreadArrays||function(){for(var t=0,e=0,i=arguments.length;e<i;e++)t+=arguments[e].length;var n=Array(t),s=0;for(e=0;e<i;e++)for(var o=arguments[e],r=0,a=o.length;r<a;r++,s++)n[s]=o[r];return n},G=function(){function t(t,e){var i=e.pubsub,n=e.viewerContainer,s=e.postfix,o=e.selectedBoxColor;this.webcam=null,this.isVideoShow=!1,this._pubsub=null,this._viewerContainer=null,this._savePhotoCallback=null,this._resultImgSrc="",this._displayMode="picture",this._fillMode=!1,this._showPage="",this._controlBox=null,this._cropManager=new w.a(0,0),this._selectedBoxColor="#fff",this._isDetecting=!1,this._isMouseDown=!1,this._isProcessing=!1,this._pubsub=i,this._viewerContainer=n,this._postfix=s,this._selectedBoxColor=o,this._initWebcam(t)}return t.prototype._initWebcam=function(t){this.webcam=new t,this.setSelectedBoxColor(this._selectedBoxColor,!1)},t.prototype.on=function(t,e){this._pubsub.on(t,e.bind(this))},t.prototype.emit=function(t){for(var e,i=[],n=1;n<arguments.length;n++)i[n-1]=arguments[n];(e=this._pubsub).emit.apply(e,V([t],i))},t.prototype.off=function(t,e){this._pubsub.off(t,e)},t.prototype.webcamOn=function(t,e){this.webcam.on(t,e)},t.prototype.webcamOff=function(t,e){this.webcam.off(t,e)},t.prototype.captureCallback=function(){var t=this;if(!this._isProcessing){var e=this.webcam,i=this._cropManager;this._isProcessing=!0,"document"===this._displayMode?e.detectArea().then((function(n){t.showEditUi();var s=e._video;t._fillMode?i.setPageSize(s.clientWidth/e.pixelRatio,s.clientHeight/e.pixelRatio):i.setPageSize(s.videoWidth,s.videoHeight),i.addFreeBox(n),e.drawSelectedArea(i.cropBoxes[0].probePoints.slice()),t._isProcessing=!1})):(e.pause(),e.capture().then((function(e){var i=URL.createObjectURL(e);t.showSaveUi(i),t._isProcessing=!1})))}},t.prototype.backCallback=function(){if(!this._isProcessing){var t=this.webcam;"document"===this._displayMode?(this.showEditUi(),t.drawSelectedArea(this._cropManager.cropBoxes[0].probePoints.slice())):this.showHomeUi(!0)}},t.prototype.remakeCallback=function(){this.showHomeUi(!0)},t.prototype.confirmCallback=function(){var t;if(!this._isProcessing){var e=this._resultImgSrc;this.showHomeUi(),null===(t=this._savePhotoCallback)||void 0===t||t.call(this,e)}},t.prototype.detectCallback=function(){if(!this._isProcessing){var t=this._queryEl(".detectBtn");if(!t)return!1;var e=t.classList.toggle("selectedBtn");e?this.webcam.bindRealTimeRender(5):this.webcam.unbindRealTimeRender(),this._isDetecting=e}},t.prototype.perspectiveCallback=function(){var t=this;if(!this._isProcessing){var e=this._cropManager.cropBoxes[0].vertexes.slice(),i=this.webcam;this._isProcessing=!0,i.perspective(e).then((function(e){t.showSaveUi(e),t._isProcessing=!1}))}},t.prototype.mouseMoveCallback=function(t){var e;if(this._isMouseDown){if("ontouchmove"in document.documentElement&&(t=null===(e=t.changedTouches)||void 0===e?void 0:e[0]),!t)return;var i=this._getPagePosition(t),n=i[0],s=i[1];this._cropManager.onMoveHandler(n,s,!0),this.webcamResize()}},t.prototype.mouseUpCallback=function(t){this._isMouseDown&&(this._isMouseDown=!1,this._cropManager.onEndHandler(),this.webcamResize())},t.prototype.mousedownCallback=function(t){var e;if("edit"===this._showPage){if(this._isMouseDown=!0,Object(s.B)(t),"ontouchstart"in document.documentElement&&(t=null===(e=t.changedTouches)||void 0===e?void 0:e[0]),!t)return;var i=this._getPagePosition(t),n=i[0],o=i[1];this._cropManager.onStartHandler(n,o,!0)}},t.prototype.setSelectedBoxColor=function(t,e){void 0===e&&(e=!0),this.webcam.setSelectedBoxColor(t,e)},t.prototype.showVideo=function(t,e,i,n,s){return void 0===n&&(n="picture"),void 0===s&&(s=!1),U(this,void 0,void 0,(function(){var r,a,l,h,u=this;return k(this,(function(c){switch(c.label){case 0:return c.trys.push([0,7,,8]),this._isProcessing=!0,a=t.element,this.webcam.bindUI(a,!0,s?"cover":"contain"),this.webcam._cvsDrawArea.onmousedown=this.webcam._cvsDrawArea.ontouchstart=function(t){u.mousedownCallback(t)},l=document.createElement("div"),this._controlBox=l,l.id="controlBox"+this._postfix,l.className="camera-controlBox",a.appendChild(this._controlBox),e?[4,this.webcam.selectSource(e)]:[3,2];case 1:c.sent(),c.label=2;case 2:return i&&i.width&&i.height?[4,this.webcam.play(undefined,i.width,i.height)]:[3,4];case 3:return r=c.sent(),[3,6];case 4:return[4,this.webcam.play()];case 5:r=c.sent(),c.label=6;case 6:return this.isVideoShow=!0,[3,8];case 7:return h=c.sent(),t.dispose(),this.isVideoShow=!1,this._isProcessing=!1,[2,Promise.reject(h)];case 8:return t.show(),this._displayMode=n,this._fillMode=s,this._hideToolbars(),this.showHomeUi(),this._isProcessing=!1,this.emit(o.e.VIEWER_RESIZE),[2,r]}}))}))},t.prototype.showHomeUi=function(t){void 0===t&&(t=!1);var e=this._controlBox;if(e){this._showPage="home";var i=this.webcam;i._video.style.width=null,e.className="camera-controlBox dvs-homeControl",this._fillMode&&e.classList.add("dvs-suspend"),t&&(URL.revokeObjectURL(this._resultImgSrc),this._resultImgSrc=""),this._cropManager.clear(),i.resume(),"picture"===this._displayMode?i.bindControlBox(e,{detectBtn:{className:"camera-empty",iconClass:"",onButtonClick:""}}):i.bindControlBox(e),i.hideResultImage(),this.webcamResize();var n=e.getBoundingClientRect(),s=e.querySelector(".captureBtn"),o=e.querySelector(".detectBtn");this._changeButtonSize(s,2*n.height/3,1*n.height/3),this._changeButtonSize(o,n.height/2,n.height/3),this._isDetecting&&this.detectCallback()}},t.prototype.showEditUi=function(){var t=this._controlBox;if(t){this._showPage="edit";var e=this.webcam;t.className="camera-controlBox dvs-editControl",e.pause(),e.bindConfirmBox(t),e.unbindRealTimeRender(),e.hideResultImage();var i=t.getBoundingClientRect(),n=t.querySelector(".remakeBtn"),s=t.querySelector(".perspectiveBtn");if(this._changeButtonSize(n,2*i.height/3,2*i.height/3),this._changeButtonSize(s,2*i.height/3,2*i.height/3),this._fillMode){var o=e._video,r=this._queryEl(".dvs-cameraContainer");o.style.width=r.clientWidth*o.clientHeight/r.clientHeight+"px"}this.webcamResize()}},t.prototype.showSaveUi=function(t){var e=this._controlBox;if(e){this._showPage="save";var i=this.webcam;e.className="camera-controlBox dvs-saveControl","picture"===this._displayMode?i.bindSaveBox(e,{remakeBtn:{className:"camera-saveEmpty",iconClass:"",onButtonClick:""}}):i.bindSaveBox(e),this._resultImgSrc=t,i.unbindRealTimeRender(),i.showResultImage(t),this.webcamResize();var n=e.getBoundingClientRect(),s=e.querySelector(".backBtn"),o=e.querySelector(".remakeBtn "),r=e.querySelector(".confirmBtn");this._changeButtonSize(o,n.height/2,n.height/3),this._changeButtonSize(s,n.height/2,n.height/3),this._changeButtonSize(r,n.height/2,n.height/3)}},t.prototype.closeVideo=function(){if(this.isVideoShow){this.isVideoShow=!1,this._showPage="";var t=this.webcam;t.stop(),this._showToolbars(),t.unbindRealTimeRender(),t.emptyTempCanvas(),URL.revokeObjectURL(this._resultImgSrc),this._resultImgSrc="",this._isDetecting=!1,this.emit("video-closed"),this.emit(o.e.VIEWER_RESIZE),this.emit(o.e.UPDATE_PAGES_LAYOUT),this.emit(o.e.SHOW_LATEST_PAGE)}},t.prototype.webcamResize=function(){var t=this.webcam;t&&(this._cropManager.setZoom(t.pixelRatio),t.webcamResize())},t.prototype.drawSelectedArea=function(){this._cropManager.cropBoxes.length&&"edit"===this._showPage&&this.webcam.drawSelectedArea(this._cropManager.cropBoxes[0].probePoints.slice())},t.prototype.bindAreaDetectFunction=function(t){return this.webcam.bindAreaDetectFunction(t)},t.prototype.bindPerspectiveFunction=function(t){return this.webcam.bindPerspectiveFunction(t)},t.prototype.bindLicenseCallback=function(t){return this.webcam.bindLicenseCallback(t)},t.prototype.bindSavePhotoCallback=function(t){return this._savePhotoCallback=t,!0},t.prototype._hideToolbars=function(){var t,e,i,n,s,o,r,a,l,h=this._queryEl("#header"+this._postfix),u=this._queryEl("#topMenu"+this._postfix),c=this._queryEl("#bottomMenu"+this._postfix),d=this._queryEl("#viewPort"+this._postfix),_=this._queryEl("#videoContainer"+this._postfix);if(h&&(null===(t=h.classList)||void 0===t||t.add("dvs-hideToolbars")),u&&(null===(e=u.classList)||void 0===e||e.add("dvs-hideToolbars")),c&&(null===(i=c.classList)||void 0===i||i.add("dvs-hideToolbars")),d&&(null===(n=d.classList)||void 0===n||n.add("dvs-hideToolbars")),_&&(null===(s=_.classList)||void 0===s||s.remove("dvs-hideToolbars")),(null===(o=window.screen)||void 0===o?void 0:o.availWidth)<500){var p=null===(a=null===(r=this._viewerContainer)||void 0===r?void 0:r.el)||void 0===a?void 0:a.querySelectorAll(".dvs-Thumbnail");if(p){for(var v=0;v<p.length;v++)null===(l=p[v])||void 0===l||l.classList.add("dvs-hideToolbars");this.emit("onSetSplitBar")}}},t.prototype._showToolbars=function(){var t,e,i,n,s,o,r,a,l,h=this._queryEl("#header"+this._postfix),u=this._queryEl("#topMenu"+this._postfix),c=this._queryEl("#bottomMenu"+this._postfix),d=this._queryEl("#viewPort"+this._postfix),_=this._queryEl("#videoContainer"+this._postfix);if(h&&(null===(t=h.classList)||void 0===t||t.remove("dvs-hideToolbars")),u&&(null===(e=u.classList)||void 0===e||e.remove("dvs-hideToolbars")),c&&(null===(i=c.classList)||void 0===i||i.remove("dvs-hideToolbars")),d&&(null===(n=d.classList)||void 0===n||n.remove("dvs-hideToolbars")),_&&(null===(s=_.classList)||void 0===s||s.remove("dvs-hideToolbars")),(null===(o=window.screen)||void 0===o?void 0:o.availWidth)<500){var p=null===(a=null===(r=this._viewerContainer)||void 0===r?void 0:r.el)||void 0===a?void 0:a.querySelectorAll(".dvs-Thumbnail");if(p){for(var v=0;v<p.length;v++)null===(l=p[v])||void 0===l||l.classList.remove("dvs-hideToolbars");this.emit("onSetSplitBar")}}},t.prototype._queryEl=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)},t.prototype._getPagePosition=function(t){var e=this.webcam,i=this.webcam._cvsDrawArea.getBoundingClientRect(),n=t.clientX-i.left,s=t.clientY-i.top;return e.getRealPosition(n,s)},t.prototype._changeButtonSize=function(t,e,i){e=Math.round(e),i=Math.round(i),t.style.width=e+"px",t.style.height=e+"px",t.style.flex="0 0 "+e+"px",t.children[0].style.fontSize=i+"px"},t}(),j=undefined&&undefined.__spreadArrays||function(){for(var t=0,e=0,i=arguments.length;e<i;e++)t+=arguments[e].length;var n=Array(t),s=0;for(e=0;e<i;e++)for(var o=arguments[e],r=0,a=o.length;r<a;r++,s++)n[s]=o[r];return n},H=function(){function t(t,e,i,n,s){this._sideRender=null,this._thumbnailRender=null,this._directoryRender=null,this._tagRender=null,this._scrollRender=null,this._pagerRender=null,this._tabRender=null,this._canvasRender=null,this._cameraRender=null,this._uiRender=null,this._viewPubsub=null,this._dataStore=null,this._uiEventControl=null,this.uiConfig=null,this._viewerContainer=null,this.containerBox=null,this.useMyEvent=!0,this.topMenuColor="#3a393b",this.topMenuBorder="1px solid #1b1b1d",this.headerColor="#2a292b",this.footerColor="#434246",this.asideMenuColor="#434246",this.viewerBorderColor="#1b1b1d",this.canvasBackground="#434246",this.canvasBorder="0px solid #1b1b1d",this.canvasMouseShape="default",this.outerBorder="1px solid #1b1b1d",this._webcamItem=null,this._videoImageReady=!0,this._updateVideoTimer=null,this.showViewer=!0,this.showTopMenu=!0,this.showHeader=!0,this.showSidebar=!1,this.showTab=!1,this.showAside=!1,this.showMain=!0,this.showFooter=!0,this.showVideoContainer=!1,this.width="100%",this.height="100%",this.showWidth=-1,this.showHeight=-1,this._eventList={},this._resizeTimer=null,this._showLatestQueue={},this.postfix=i,this._viewPubsub=n,this.uiConfig=e,this._dataStore=s,this._initViewer(t,e)}return t.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)},t.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)},t.prototype._initViewer=function(t,e){if(!t)return!1;if(Object(s.x)(t))t=document.getElementById(t);else if(!Object(s.p)(t))return!1;return this.containerBox=t,this._createMember(e,t),this._initMember(),this._initStatus(e),this._bindUiEvent(),this._bindButtonEvent(),!0},t.prototype._createMember=function(t,e){var i=this.postfix,n=this._viewPubsub;this._uiRender=new b({postfix:i,container:e,uiConfig:t,pubsub:n});var s=this._uiRender.viewerContainer;this._viewerContainer=s,this._thumbnailRender=new O(i,n,s,this._dataStore),this._scrollRender=new P(i,n,s),this._pagerRender=new L(i,n),this._uiEventControl=new l(i,n,s),this._tabRender=new D(i,n,s),this._canvasRender=new N({postfix:i,pubsub:n,viewerContainer:s})},t.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()},t.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)},t.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},t.prototype.updateUiSetting=function(t){},t.prototype._bindUiEvent=function(){var t,e=((t={})[o.e.VIEWER_RESIZE]=this._resizeViewer,t[o.e.DOCUMENT_POINTER_MOVE]=this._documentMouseMove,t[o.e.DOCUMENT_POINTER_UP]=this._documentMouseUp,t[o.e.DOCUMENT_CLICK]=this._documentClick,t[o.e.VIEWER_CLICK]=this._viewerClick,t[o.e.VIEWER_RIGHT_CLICK]=this._viewerRightClick,t[o.e.VIEWER_MOVE]=this._viewerMove,t[o.e.SIDEBAR_CLICK]=this._sideBarClick,t[o.e.SIDEBAR_STRETCH_START]=this._sidebarStretchStart,t[o.e.OPEN_DEFAULT_TAG]=this._openDefaultTag,t[o.e.FILE_LIST_CLICK]=this._fileListClick,t[o.e.FILE_LIST_RIGHT_CLICK]=this._fileListRightClick,t[o.e.FILE_KEY_UP]=this._fileListKeyUp,t[o.e.ADD_NEW_FOLDER]=this._addNewFolder,t[o.e.TAG_LIST_CLICK]=this._tagListClick,t[o.e.TAG_LIST_RIGHT_CLICK]=this._tagListRightClick,t[o.e.TAG_KEY_UP]=this._tagListKeyUp,t[o.e.ADD_NEW_TAG]=this._addNewTag,t[o.e.PAGER_BLUR]=this._pagerBlur,t[o.e.SET_SCROLLER_SIZE]=this._setScrollerSize,t[o.e.CHANGE_CANVAS_CURSOR]=this.setCanvasCursorTemp,t[o.d.SHOW_CANVAS_LOADING]=this._setShowLoadingImage,t[o.e.TAB_CHANGED]=this._tabChanged,t[o.e.TAB_LIST_CLICK]=this._tabListClick,t[o.e.CLOSE_SAVE_SETTING_BOX]=this._closeSaveSettingBox,t.onPanelChange=this._togglePaneBox,t.onSetSplitBar=this._setSplitBar,t[o.e.SHOW_LATEST_PAGE]=this._showLatestPage,t[o.e.UPDATE_PAGES_LAYOUT]=this._updatePagesLayout,t[o.e.CUSTOM_BUTTON_CLICK]=this._customButtonClick,t[o.e.TAG_REFRESH]=this._tagRefresh,t[o.e.TAG_SELECTED]=this._tagSelectedCallback,t[o.e.IMAGE_SELECTED]=this._imageSelectedCallback,t[o.e.FILE_REFRESH]=this._directoryRefresh,t[o.e.FILE_SELECTED]=this._fileSelectedCallback,t[o.e.PAGER_CHANGED]=this._pagerRefresh,t[o.e.THUMBNAIL_CHANGED]=this._thumbnailRefresh,t);for(var i in e)this._viewOn(i,e[i]);this._eventList=e},t.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},t.prototype._bindButtonEvent=function(){var t=this,e=this.uiConfig.buttons;Object.keys(e).forEach((function(i){var n,r,a=e[i],l=null===(r=null===(n=t._viewerContainer)||void 0===n?void 0:n.el)||void 0===r?void 0:r.querySelector("#"+i+t.postfix);if(!l)return!1;l.classList.add("dvs-iconColor"),a.iconClass===undefined&&l.classList.add("dvs-emptyBtn"),a.onButtonClick&&Object(s.a)(l,o.c.CLICK,(function(e){t._scrollRender.buttonMove?t._scrollRender.buttonMove=!1:(e.changedTouches,t._viewEmit(a.onButtonClick,e))}))}))},t.prototype._viewOn=function(t,e){this._viewPubsub.on(t,e.bind(this))},t.prototype._viewOff=function(t,e){this._viewPubsub.off(t,e)},t.prototype._viewEmit=function(t){for(var e,i=[],n=1;n<arguments.length;n++)i[n-1]=arguments[n];(e=this._viewPubsub).emit.apply(e,j([t],i))},t.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(o.d.CANVAS_VISIBILITY_CHANGED,this.showViewer&&this.showMain),t?(i.classList.remove("dvs-disabled"),this._resizeViewer(),this._showLatestPage()):i.classList.add("dvs-disabled"),!0)},t.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)},t.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)},t.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},t.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)},t.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(o.d.CANVAS_VISIBILITY_CHANGED,this.showMain&&this.showViewer),this._resizeViewer(),!0)},t.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)},t.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)},t.prototype.setHeaderColor=function(t){var e=this._myQuery("header"+this.postfix);return this.headerColor=t,e&&(e.style.background=t),!0},t.prototype.setTopMenuColor=function(t){var e=this._myQuery("topMenu"+this.postfix);return this.topMenuColor=t,e&&(e.style.background=t),!0},t.prototype.setTopMenuBorder=function(t){var e=this._myQuery("topMenu"+this.postfix);return this.topMenuBorder=t,e&&(e.style.border=t),this._resizeViewer(),!0},t.prototype.setFooterColor=function(t){var e=this._myQuery("bottomMenu"+this.postfix);return this.footerColor=t,e&&(e.style.background=t),!0},t.prototype.setAsideMenuColor=function(t){this.asideMenuColor=t;var e=this._myQuery("asideMenu"+this.postfix);return e&&(e.style.background=t),!0},t.prototype.setViewerBorderColor=function(t){var e,i=null===(e=this._viewerContainer)||void 0===e?void 0:e.el,n=this._myQuery("Thumbnail"+this.postfix),s=this._myQuery("content"+this.postfix),o=this._myQuery("middle"+this.postfix);i&&(i.style.borderColor=t),n&&(n.style.borderColor=t),s&&(s.style.borderColor=t),o&&(o.style.borderColor=t),this.viewerBorderColor=t},t.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),s=this._myQuery("middle"+this.postfix);if(n&&s){var o=t.split(" ");n.style.borderStyle=o[1],n.style.borderColor=o[2],s.style.borderStyle=o[1],s.style.borderColor=o[2],this._setSplitBar()}this._resizeViewer()},t.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},t.prototype.getViewerWidth=function(){var t,e=null===(t=this._viewerContainer)||void 0===t?void 0:t.el;return e?e.offsetWidth:this.width},t.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},t.prototype.getViewerHeight=function(){var t,e=null===(t=this._viewerContainer)||void 0===t?void 0:t.el;return e?e.offsetHeight:this.height},t.prototype.setSidebarWidth=function(t){var e,i=null===(e=this._sideRender)||void 0===e?void 0:e.setSidebarWidth(t);return this._resizeViewer(),i},t.prototype.getSidebarWidth=function(){var t;return null===(t=this._sideRender)||void 0===t?void 0:t.getSidebarWidth()},t.prototype.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 o=i[n];if(null==o?void 0:o.classList.contains("dvs-customElement"))break;o.classList.contains("dvs-videoContainer")?t?o.classList.remove("dvs-hideVideoContainer"):o.classList.add("dvs-hideVideoContainer"):t?o.classList.add("dvs-hideVideoContainer"):o.classList.remove("dvs-hideVideoContainer")}return this.showVideoContainer=t,t||(this._resizeViewer(),this._showLatestPage()),!0},t.prototype.switchToTagTab=function(){var t=this._myQuery("TagsNav"+this.postfix),e=t&&t.children[0];return!!e&&(e.click(),!0)},t.prototype.switchToTreeTab=function(){var t=this._myQuery("DirctoryTreeNav"+this.postfix),e=t&&t.children[0];return!!e&&(e.click(),!0)},t.prototype.showGroup=function(t){var e=this._myQuery(t+this.postfix);return!!e&&(e.classList.remove("dvs-disabled"),e.classList.remove("dvs-noDisplay"),!0)},t.prototype.hideGroup=function(t){var e=this._myQuery(t+this.postfix);return!!e&&(e.classList.add("dvs-disabled"),e.classList.add("dvs-noDisplay"),!0)},t.prototype._documentMouseMove=function(t){this._cameraRender&&this._cameraRender.mouseMoveCallback(t)},t.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())))},t.prototype.documentKeyDown=function(t,e){e?this._thumbnailRender.keydownCallback(t,e):this._viewEmit(o.d.CANVAS_KEY_DOWN,t)},t.prototype.documentKeyUp=function(t,e){e?this._thumbnailRender.keyupCallback(t,e):this._viewEmit(o.d.CANVAS_KEY_UP,t)},t.prototype._documentClick=function(t){this._viewEmit(o.d.UPDATE_FOCUS,{viewerId:undefined,thumbnailId:undefined})},t.prototype.styleChange=function(){var t;if(!this.showViewer)return!1;if(this.uiConfig.buttonResize.ifResize)if(Object(s.t)()){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()},t.prototype._viewerClick=function(t){},t.prototype._viewerRightClick=function(t){},t.prototype._viewerMove=function(t){var e;null===(e=this._sideRender)||void 0===e||e.stretchMouseMove(t)},t.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 r={oriData:URL.createObjectURL(s),minData:null,metadata:{width:500,height:600},tags:[]};i.push(r)}}this._viewEmit(o.d.APPEND_SYNC_DROP,i)},t.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||i.width===this.showWidth&&i.height===this.showHeight)return!1;this.showWidth=i.width,this.showHeight=i.height,this._viewEmit(o.f.RESIZE,i.width,i.height)},t.prototype.createThumbnail=function(t){return this._thumbnailRender.createThumbnail(t)},t.prototype.createInnerThumbnail=function(){this._thumbnailRender.createInnerThumbnail(this.uiConfig.canvasConfig)},t.prototype.removeThumbnail=function(t){var e=this._thumbnailRender.removeThumbnail(t);return this._setSplitBar(),e},t.prototype._sideBarClick=function(t){var e;null===(e=this._sideRender)||void 0===e||e.setShowNavigationBox(!1)},t.prototype._sidebarStretchStart=function(t){var e;null===(e=this._sideRender)||void 0===e||e.stretchMouseDown(t)},t.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(""))},t.prototype._fileListClick=function(t){var e=this._directoryRender;e&&(e.confirmFolder(t),e.cancelFolder(t),e.enterFolder(t))},t.prototype._fileListRightClick=function(t){},t.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()}},t.prototype._addNewFolder=function(t){var e;null===(e=this._directoryRender)||void 0===e||e.addNewFolder(t)},t.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)},t.prototype._tagListRightClick=function(t){},t.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()}},t.prototype._addNewTag=function(t){var e;null===(e=this._tagRender)||void 0===e||e.addNewTag(t)},t.prototype._pagerBlur=function(t){this._pagerRender.pageBlur(t)},t.prototype.setInnerTbProp=function(t,e){var i;this._handleInnerProp(t,e),null===(i=this._thumbnailRender.innerThumbnail)||void 0===i||i.handleInnerProp(t,e)},t.prototype._handleInnerProp=function(t,e){this[t]=e;var i="set"+t.replace(/^[a-z]{1}/,(function(t){return t.toUpperCase()}));Object(s.r)(this[i])&&this[i](e)},t.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)},t.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()},t.prototype.setCanvasMouseShape=function(t,e){void 0===e&&(e=!1),e||(this.canvasMouseShape=t,this._viewEmit(o.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)},t.prototype.setCanvasCursorTemp=function(t){this.setCanvasMouseShape(t||this.canvasMouseShape,!0)},t.prototype.setSelectedBoxLineColor=function(t){var e;this._thumbnailRender.innerThumbnail.setSelectedBoxLineColor(t),null===(e=this._cameraRender)||void 0===e||e.setSelectedBoxColor(t)},t.prototype.setOperationMode=function(t){this._thumbnailRender.innerThumbnail.setOperationMode(t)},t.prototype.setSelectedBoxes=function(t,e){this._thumbnailRender.innerThumbnail.setSelectedBoxes(t,e)},t.prototype.clearSelectedBoxes=function(t){this._thumbnailRender.innerThumbnail.clearSelectedBoxes(t)},t.prototype.setKeepAspectRatio=function(t){this._thumbnailRender.innerThumbnail.setKeepAspectRatio(t)},t.prototype.setAspectRatio=function(t){this._thumbnailRender.innerThumbnail.setAspectRatio(t)},t.prototype._setScrollerSize=function(t){this._canvasRender.updateScrollSize(t)},t.prototype._tabChanged=function(t){this._tabRender.updateTabList(t)},t.prototype._tabListClick=function(t){var e=t.target;if(null==e?void 0:e.classList.contains("dvs-closeTab"))null==e||e["dvs-id"]},t.prototype._tagRefresh=function(t){var e;null===(e=this._tagRender)||void 0===e||e.updateTagList(t)},t.prototype._tagSelectedCallback=function(t){var e;null===(e=this._tagRender)||void 0===e||e.selectTagByName(t)},t.prototype._imageSelectedCallback=function(t){return this._thumbnailRender.updateSelectedIndexes(t)},t.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")},t.prototype._fileSelectedCallback=function(t){var e;null===(e=this._directoryRender)||void 0===e||e.selectFileByName(t)},t.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)},t.prototype._thumbnailRefresh=function(t){this._thumbnailRender.updateContents(t)},t.prototype.setDisplayMode=function(t){var e,i,n=this._myQuery("viewPort"+this.postfix),s=this._thumbnailRender.innerThumbnail;if("single"===t)s.clearSelectedBoxes(),null===(e=this._myQuery("innerThumbnail"+this.postfix))||void 0===e||e.classList.add("dvs-disabled"),null==n||n.classList.remove("dvs-disabled"),s.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"),s.showThumbnail=!0}return this._resizeViewer(),!0},t.prototype.setViewMode=function(t,e){return this._thumbnailRender.innerThumbnail.setViewMode(t,e)},t.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)},t.prototype._customButtonClick=function(t,e){this._scrollRender.buttonMove?this._scrollRender.buttonMove=!1:this._viewEmit(t,e)},t.prototype._closeSaveSettingBox=function(){},t.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),s=this._thumbnailRender._thumbnails[n[0]];if(!s||!(null==s?void 0:s.showThumbnail)||(null==s?void 0:s.fullThumbnail)||(null===(t=this._cameraRender)||void 0===t?void 0:t.isVideoShow))e.style.borderWidth="0px",i.style.borderWidth="0px";else{var o=this.outerBorder.split(" ")[0],r="horizontal"===s.location,a=s.sequence,l=this._getBorderWidth(o,r,a);r?(e.style.borderWidth=l,i.style.borderWidth="0px"):(i.style.borderWidth=l,e.style.borderWidth="0px")}this._resizeViewer()},t.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,o=36*(i/1920<n/1080?i/1920:n/1080)*window.devicePixelRatio,r=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(o,h),u),d=Math.floor(1.875*c);if(r&&r.clientWidth>0){r.classList.add("dvs-resizeButton"),Object(s.F)(r,{flexBasis:d+"px",height:d+"px"});for(var _=0;_<r.children.length;_++){r.children[_].style.fontSize=c+"px"}}if(a&&a.clientWidth>0){a.classList.add("dvs-resizeButton"),Object(s.F)(a,{fontSize:c+"px",flexBasis:d+"px",height:d+"px",justifyContent:"flex-start"});for(_=0;_<a.children.length;_++){a.children[_].style.fontSize=c+"px"}}},t.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)},t.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"},t.prototype._updatePagesLayout=function(){this._thumbnailRender.updatePagesLayout()},t.prototype._showLatestPage=function(t){this._thumbnailRender.showLatestPage(t)},t.prototype.setButtonClass=function(t){var e=this.uiConfig.buttons,i=this._myQuery(""+t+this.postfix);if(i){var n=e[t],s=n.iconClass?" "+n.iconClass:"",o=n.cssStyle?" "+n.cssStyle:"",r=i.classList.contains("dvs-disabled")?" dvs-disabled":"",a=n.setClass||"";return i.className="ds-dvs-ui-iconfont dvs-iconColor dvs-"+t+r+s+o+" "+a,!0}return!1},t.prototype.setGroupClass=function(t,e){var i=this.uiConfig.groups,n=this._myQuery(t+this.postfix);if(n){var s=i[t].cssStyle?" "+i[t].cssStyle:"",o=n.classList.contains("dvs-disabled")?" dvs-disabled":"";return n.className="dvs-"+t+" dvs-groupType"+o+s+" "+e,!0}return!1},t.prototype.fullScreen=function(){var t,e=null===(t=this._viewerContainer)||void 0===t?void 0:t.el,i=Object(s.y)(e);return this._resizeViewer(),i},t.prototype.cancelFullScreen=function(){var t=Object(s.q)()&&Object(s.e)();return this._resizeViewer(),t},t.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)},t.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)},t.prototype.createCustomElement=function(t,e,i){return void 0===e&&(e=0),void 0===i&&(i=!1),this._uiRender.createCustomElement(t,e,i)},t.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,s=this._videoSize,o=s.imageWidth,r=s.imageHeight;if(i/o-1<n/r-1){var a=i/o;e.style.width=i+"px",e.style.height=r*a+"px"}else{a=n/r;e.style.width=o*a+"px",e.style.height=n+"px"}this._videoSize.imageBoxWidth=e.clientWidth,this._videoSize.imageBoxHeight=e.clientHeight}},t.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)},t.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}},t.prototype.getViewerElement=function(){var t;return(null===(t=this._viewerContainer)||void 0===t?void 0:t.el)||null},t.prototype.bindContent=function(t){return this._uiRender.bindContent(t)},t.prototype.unbindContent=function(){return this._uiRender.unbindContent()},t.prototype.setLoadingImage=function(t){if(!t)return!1;var e=this._myQuery("loadingImage"+this.postfix);return e&&(e.src=t),!0},t.prototype._setShowLoadingImage=function(t){var e=this._myQuery("loadingLayer"+this.postfix);e&&(t?e.classList.remove("dvs-disabled"):e.classList.add("dvs-disabled"))},t.prototype.bindCamera=function(t){try{return this._cameraRender=new G(t,{pubsub:this._viewPubsub,viewerContainer:this._viewerContainer,postfix:this.postfix,selectedBoxColor:this._thumbnailRender.innerThumbnail.selectedBoxLineColor}),this._initCameraEvents(),this._viewEmit(o.d.ERROR,o.a.OK),!0}catch(e){return this._viewEmit(o.d.ERROR,o.a.CAMERA_CLASS_INVALID),!1}},t.prototype.showVideo=function(t,e,i,n){if(!this._cameraRender)return this._viewEmit(o.d.ERROR,o.a.CAMERA_CLASS_REQUIRE),Promise.reject(o.a.CAMERA_CLASS_REQUIRE);if(this._cameraRender.isVideoShow)return Promise.reject(o.a.CAMERA_EXIST);var s=document.createElement("div");return s.id="cameraContainer"+this.postfix,s.className="dvs-cameraContainer",this._webcamItem=this.createCustomElement(s,0,!0),this._webcamItem.hide(),this._viewEmit(o.d.ERROR,o.a.OK),this._cameraRender.showVideo(this._webcamItem,t,e,i,n)},t.prototype.closeVideo=function(){return this._cameraRender?this._cameraRender.isVideoShow?(this._webcamItem&&this._webcamItem.dispose(),this._cameraRender.closeVideo(),this._viewEmit(o.d.ERROR,o.a.OK),!0):(this._viewEmit(o.d.ERROR,o.a.CAMERA_NOT_EXIST),!1):(this._viewEmit(o.d.ERROR,o.a.CAMERA_CLASS_REQUIRE),!1)},t.prototype._initCameraEvents=function(){var t=this,e=this._cameraRender,i={onExitCamera:function(){t.closeVideo()},onCapture:function(){e.captureCallback()},onDetect:function(){e.detectCallback()},onRemake:function(){e.remakeCallback()},onPerspective:function(){e.perspectiveCallback()},onBack:function(){e.backCallback()},onConfirm:function(){e.confirmCallback()},webcamResize:function(){e.drawSelectedArea()},"video-error":function(e){t._viewEmit("video-error",e)}};for(var n in i)e.webcamOn(n,i[n])},t.prototype.bindAreaDetectFunction=function(t){return this._cameraRender?(this._viewEmit(o.d.ERROR,o.a.OK),this._cameraRender.bindAreaDetectFunction(t)):(this._viewEmit(o.d.ERROR,o.a.CAMERA_CLASS_REQUIRE),!1)},t.prototype.bindPerspectiveFunction=function(t){return this._cameraRender?(this._viewEmit(o.d.ERROR,o.a.OK),this._cameraRender.bindPerspectiveFunction(t)):(this._viewEmit(o.d.ERROR,o.a.CAMERA_CLASS_REQUIRE),!1)},t.prototype.bindLicenseCallback=function(t){return Object(s.r)(t)?(this._viewEmit(o.d.ERROR,o.a.OK),!0):(this._viewEmit(o.d.ERROR,o.a.PARAM_TYPE),!1)},t.prototype.bindSavePhotoCallback=function(t){return this._cameraRender?(this._viewEmit(o.d.ERROR,o.a.OK),this._cameraRender.bindSavePhotoCallback(t)):(this._viewEmit(o.d.ERROR,o.a.CAMERA_CLASS_REQUIRE),!1)},t}();i.d(e,"ViewUi",(function(){return H})),window.Dynamsoft=window.Dynamsoft||{},window.Dynamsoft.ViewUi=H}]);
|
|
1
|
+
/*! Date: 01/12/2022 10:08:27 */
|
|
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 u})),i.d(e,"a",(function(){return h}));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"},u={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"},h={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 u(t){return"number"==typeof t&&!isNaN(t)}function h(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]:h(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),u=N(t+i,e+n,r,s,o),h=N(t,e+n,r,s,o),c=[l.x,a.x,h.x,u.x].sort((function(t,e){return t-e})),d=[l.y,a.y,h.y,u.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 u})),i.d(e,"n",(function(){return h})),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){a(t)&&(k.log("revokeObjectURL:"+t),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,u=Promise.resolve(!0);if(1===a.length){var h=null===(i=a[0])||void 0===i?void 0:(e=i.fn).call.apply(e,o([null],r));return h instanceof Promise?h:u}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&&(u=u.then((function(){return i})))},d=0;d<l;d++)c(d);return u},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,u=s.minY,h=s.maxY,c=this.checkPointPosition(e),d=(l-a)/(h-u);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],u=n-l*i,h=-u/l,c=u,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]+=h-p:v===Infinity||v===-Infinity?t[(2*a+3)%8]+=c-d:(t[(2*a+2)%8]=(f-u)/(l-v),t[(2*a+3)%8]=(l*f-v*u)/(l-v)),0===m?t[(2*a+0)%8]+=h-p:m===Infinity||m===-Infinity?t[(2*a+1)%8]+=c-d:(t[(2*a+0)%8]=(g-u)/(l-m),t[(2*a+1)%8]=(l*g-m*u)/(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,u=Math.min(Math.max(i,.1*(a-s)),3*i)*this.dpr,h=8;"free"===this.mode&&(h=8);for(var c=0;c<h;c++){var d=this.probePoints[2*c],p=this.probePoints[2*c+1];if(t<=d+l&&t>=d-l&&e<=p+u&&e>=p-u&&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),u=a[0],h=a[1],c=l[0],d=l[1];if(h[0]===c[0]&&h[1]===c[1])return h;if(u[0]===d[0]&&u[1]===d[1])return u;if(this._isOnLine(h,l)&&this._isOnLine(c,a))return[c,h];if(this._isOnLine(u,l)&&this._isOnLine(d,a))return[u,d];if(this._isOnLine(u,l)&&this._isOnLine(h,l))return[u,h];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],u=[this._startX,this._startY,this._startX,this._startY+r,t,this._startY+r,t,this._startY];if(null!==s){for(var h=[],c=0;c<4;c++)s%2?(h.push(u[2*(s+c)%8]),h.push(u[(2*(s+c)+1)%8])):(h.push(l[2*(s+c)%8]),h.push(l[(2*(s+c)+1)%8]));return n=this.addBox(h,["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)}),u=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 u,h=this._unbindList;u=Object(o.c)(window,r.c.RESIZE,o.H.call(this,this._viewerResize,40)),h.push(u),u=Object(o.c)(window,"load",(function(t){e._viewerResize(t)})),h.push(u),u=Object(o.c)(document,a,(function(t){e._documentMouseMove(t)})),h.push(u),u=Object(o.c)(document,l,(function(t){e._documentMouseUp(t)})),h.push(u),u=Object(o.c)(window,"message",(function(t){"up"===t.data.type&&e._documentMouseUp()})),h.push(u),u=Object(o.c)(document,r.c.CLICK,(function(t){e._documentClick(t)})),h.push(u),u=Object(o.c)(document,"keydown",(function(i){t.prototype._emit.call(e,r.f.DOCUMENT_KEY_DOWN,i)})),h.push(u),u=Object(o.c)(document,"keyup",(function(i){t.prototype._emit.call(e,r.f.DOCUMENT_KEY_UP,i)})),h.push(u);var c=this._viewerContainer.el;u=Object(o.c)(c,"dragstart",(function(){return!1})),h.push(u),u=Object(o.c)(c,n,(function(t){e._viewerClick(t)})),h.push(u),u=Object(o.c)(c,r.c.CONTEXTMENU,(function(t){e._viewerRightClick(t)})),h.push(u),u=Object(o.c)(c,"dragover",(function(t){Object(o.C)(t)})),h.push(u),u=Object(o.c)(c,"drop",(function(t){e._dropFile(t)})),h.push(u),u=Object(o.c)(i("navChange"),n,(function(t){e._setSelectedSidetype(t)})),h.push(u),u=Object(o.c)(i("besides"),n,(function(t){e._sidebarClick(t)})),h.push(u),u=Object(o.c)(i("stretchBar"),r.c.MOUSE_DOWN,(function(t){e._sidebarStretchStart(t)})),h.push(u),u=Object(o.c)(i("defaultTag"),n,(function(){e._openDefaultTag()})),h.push(u),u=Object(o.c)(i("treeLists"),n,(function(t){e._fileListClick(t)})),h.push(u),u=Object(o.c)(i("treeLists"),r.c.CONTEXTMENU,(function(t){e._fileListRightClick(t)})),h.push(u),u=Object(o.c)(i("treeLists"),"keyup",(function(t){e._fileListKeyUp(t)})),h.push(u),u=Object(o.c)(i("addFolder"),r.c.CLICK,(function(t){e._addNewFolder(t)})),h.push(u),u=Object(o.c)(i("tagLists"),n,(function(t){e._tagListClick(t)})),h.push(u),u=Object(o.c)(i("tagLists"),r.c.CONTEXTMENU,(function(t){e._tagListRightClick(t)})),h.push(u),u=Object(o.c)(i("tagLists"),"keyup",(function(t){e._tagListKeyUp(t)})),h.push(u),u=Object(o.c)(i("addTag"),n,(function(t){e._addNewTag(t)})),h.push(u);var d=i("canvasEventLayer");u=Object(o.c)(d,"touchstart",(function(t){e._canvasTouchStart(t)}),{passive:!1}),h.push(u),u=Object(o.c)(d,"mousedown",(function(t){e._canvasMouseDown(t)})),h.push(u),u=Object(o.c)(d,"touchmove",(function(t){e._canvasTouchMove(t)}),{passive:!1}),h.push(u),u=Object(o.c)(d,"mousemove",(function(t){e._canvasMouseMove(t)})),h.push(u),u=Object(o.c)(d,"touchend",(function(t){e._canvasTouchEnd(t)})),h.push(u),u=Object(o.c)(d,"mouseup",(function(t){e._canvasMouseUp(t)})),h.push(u),u=Object(o.c)(d,"wheel",(function(t){e._canvasWheel(t)}),{passive:!1}),h.push(u),u=Object(o.c)(d,"click",(function(t){Object(o.G)(t)})),h.push(u);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,u=Object(o.c)(i("canvasScroll"),"scroll",(function(t){e._canvasScroll(t)})),h.push(u),u=Object(o.c)(i("tabList"),n,(function(t){e._tabListClick(t)})),h.push(u),u=Object(o.c)(i("pagerInput"),"blur",(function(t){e._pagerBlur(t)})),h.push(u),u=Object(o.c)(i("pagerInput"),"keyup",(function(t){13===t.keyCode&&t.target.blur()})),h.push(u)},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),Object(o.C)(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),h=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}(h),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}(h),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}(h),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}(h),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,u=t.groups,h=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 u)a[p]=u[p];for(var _ in h){var v=h[_];(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=0,this._canvasItem.height=0)},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.emptyPage(),this.imgSrc=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 u=0;u<t.length;u++){var h=t[u];l.putImageData(h.target,r,s+h.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,u=o.height;n.drawImage(i,s,a,l,u),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 u=Math.max(e/r,i/s);this.fitRatio=u,e/=u,i/=u}return n={left:(this.width-e*o)/2,top:(this.height-i*o)/2,width:e*o,height: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,u=r.probePoints[s+1]/n,h=r.midpoints[s]/n,c=r.midpoints[s+1]/n;this._drawPoint(this._transformRect(l,u),a),this._drawPoint(this._transformRect(h,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,u),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 u=this._canvasItem.getContext("2d");u.save();try{u.setLineDash(n.map((function(t){return t*o._devicePixelRatio})))}catch(h){}u.lineWidth=this._devicePixelRatio,u.strokeStyle=i,u.beginPath(),u.moveTo(r,s),u.lineTo(a,l),u.stroke(),u.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=[],u=this._myQuery("thumbLists"+this.uid);if(u){for(var h=u.children[e],c=document.createDocumentFragment(),d=function(e){var i=t[e],n=p._initNode(i);l.push(n);var u=document.createElement("li");u.style.background=p.pageBackground,u.style.border=p.pageBorder;var h=document.createElement("canvas");if(h.className="dvs-thumbnailCanvas",h.width=0,h.height=0,u.appendChild(h),n._canvasItem=h,!p.isInner){var d=document.createElement("span");d.className="dvs-thumbnail-remove",d.onclick=function(){var t=Object(o.h)(u);a._pubSub._emit(r.g.REMOVE_PAGE,t)},u.appendChild(d)}null===(s=p._iObserver)||void 0===s||s.observe(u),c.appendChild(u)},p=this,_=e;_<=i;_++)d(_);Object(o.l)(c,h,u),(n=this._thumbnailCanvas).splice.apply(n,w([e,0],l))}},e.prototype._removeNodes=function(t,e,i){var n;t.splice(e,i-e+1);var o=this._myQuery("thumbLists"+this.uid);if(o&&o.children&&o.children.length)for(var r=e;r<=i;r++){var s=o.children[e];if(s){var a=s["dvs-uid"];this._showUids["delete"](a),this._renderUids["delete"](a),this._getViewIndexesByUids(),null===(n=this._iObserver)||void 0===n||n.unobserve(s),o.removeChild(s)}}},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],u=t[r];if(this._sameNode(s,l))++i,++o,s.updateData(l);else if(this._sameNode(a,u))--n,--r,a.updateData(u);else if(this._sameNode(s,u))s.updateData(u),this._moveNode(e,i,n);else if(this._sameNode(a,l))a.updateData(l),this._moveNode(e,n,i);else{for(var h=void 0,c=i;c<=n;c++){if(e[c].uid===(null==l?void 0:l.uid)){h=c;break}}h!==undefined?(e[h].updateData(l),this._moveNode(e,h,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),u=parseInt(window.getComputedStyle(i).fontSize);this._currentPageMargin=l*u}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),u=i.children,h="vertical"===this._scrollDirection,c=0;c<u.length;c++){var d=u[c];s?(d.style.width=h?Math.floor(t)+"px":"100%",d.style.height=h?"100%":Math.floor(e)+"px",i.style.padding="0px",d.style.margin=0===c?"0px":h?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===u.length-1&&(d.style[h?"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=[],u=s;u<=a;u++)r[u]&&l.push(u);if("vertical"===o){for(u=s-3*n;u<s;u++)r[u]&&l.push(u);for(var h=a+1;h<a+3*n;h++)r[h]&&l.push(h)}else{for(u=s-3*i;u<s;u++)r[u]&&l.push(u);for(h=a+1;h<a+3*i;h++)r[h]&&l.push(h)}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(),u=parseInt(i.style.padding);"vertical"===o?(s=0,l.top<=n.top?r=a.offsetTop-u+1:l.bottom>=n.bottom&&(r=a.offsetTop-n.height+l.height+u+1)):(r=0,l.left<=n.left?s=a.offsetLeft-u+1:l.right>=n.right&&(s=a.offsetLeft-n.width+l.width+u+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,u=Math.floor(n.height),h=(l+1-u-(parseInt(i.style.marginTop)||parseInt(i.style.marginBottom)))/(u+this._pageMarginNumber);r=(o=((h=Math.floor(h))+1)*this.columns)+(s+1)*a-1}else{var c=t.scrollLeft,d=Math.floor(n.width);h=(c+1-d-(parseInt(i.style.marginLeft)||parseInt(i.style.marginRight)))/(d+this._pageMarginNumber);r=(o=((h=Math.floor(h))+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,u=t.pageX,h=t.pageY;if(Math.abs(u-s)<10&&Math.abs(h-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=[],u=0;u<i;u++){var h=e.children[u],c=h["dvs-defaultIndex"];if(s.push(c),h.classList.contains("dvs-activeThumb")){var d=a.indexOf(c);-1!==d&&(l[d]=u,c!==u&&o.push([c,u]))}n[u]=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,u=null===(t=this._pubQuery("showImageArea"+this._postfix))||void 0===t?void 0:t.getBoundingClientRect();i=Math.min(i,u.width),n=Math.min(n,u.height),o=e.classList.contains("dvs-stretchRight")?i/u.width:e.classList.contains("dvs-stretchLeft")?a/u.width:e.classList.contains("dvs-stretchTop")?l/u.height:n/u.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),u=this._myQuery("stretchBarRight"+a),h=this._myQuery("stretchBarTop"+a),c=this._myQuery("stretchBarBottom"+a);null==l||l.classList[n]("dvs-nodisplay"),null==u||u.classList[r]("dvs-nodisplay"),null==h||h.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);u=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!==u&&l.push(c);u>=0&&l.push(u),i=l}else this.needClick?i=[t]:this.needClick=!0;else{var u;if((u=i[i.length-1])===undefined)i.push(t);else{var h=[];if(u<t)for(var c=t;c>=u;c--)h.push(c);else for(var d=t;d<=u;d++)h.push(d);i=h}}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 u=this._getPointIndex(t);this._pubSub._emit(r.g.PAGE_MOUSE_MOVE,{index:u,pageX:t.pageX,pageY:t.pageY},t)}else{var h=this.getImageItem(t);if(h){var c=h["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),u=l.imageX,h=l.imageY;t.prototype._emit.call(n,i,o,{index:r,imageX:u,imageY:h,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 u=s[l];if(!(null==u?void 0:u.classList.contains("dvs-activeThumb"))&&t===++a){o=u,r=this._thumbnailCanvas[u["dvs-defaultIndex"]];break}}else o=s[t],r=this._thumbnailCanvas[t];if(o){var h=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-h.left,p=e.clientY-h.top,_=r.renderImg.naturalWidth,v=r.renderImg.naturalHeight,f=r.fitRatio,m=d-(h.width-_/f)/2,g=p-(h.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,u=a.imageY;if(-1!==l&&-1!==u){var h=this._dataStore.getMetadata(s.uid);if(!(null==h?void 0:h.width)||!h.height)return this._pubSub._emit(r.d.ERROR,r.a.META_DATA_NOT_EXIST),!1;var c=h.width/s.renderImg.naturalWidth,d=s.fitRatio,p=this.cropManager;p.setZoom(1/d/c),p.setPageSize(h.width,h.height),p.onStartHandler(l,u,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,u=l.checkSelectForCursor(s,a);if(u){var h="move"===u.position?"move":u.position+"-resize";t.prototype._emit.call(this,r.f.CHANGE_CANVAS_CURSOR,h)}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,u=0;u<l;u++){var h=e[u];this.cropManager.addBox([h.left,h.top,h.left+h.width,h.top,h.left+h.width,h.top+h.height,h.left,h.top+h.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,u=t.clientY-n;(Math.abs(l)>5||Math.abs(u)>5)&&(this.buttonMove=!0,a.scrollLeft=r-l,a.scrollTop=s-u,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,u=0,h=e.length-1,c=i.length-1,d=e[0],p=e[h],_=i[0],v=i[c];l<=h&&u<=c;)null==d?d=e[++l]:null==p?p=e[--h]:null==_?_=i[++u]:null==v?v=i[--c]:this.sameVnode(d,_)?(this.patchVnode(d,_),d=e[++l],_=i[++u]):this.sameVnode(p,v)?(this.patchVnode(p,v),p=e[--h],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[--h],_=i[++u]):(n===undefined&&(n=this.createKeyHashList(e,l,h)),(r=n[_.data.key])===undefined?(this.addVnodes(t,d.el,i,u,u),_=i[++u]):((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[++u]));l>h?(a=i[c+1]?i[c+1].el:null,this.addVnodes(t,a,i,u,c)):u>c&&this.removeVnodes(e,l,h)},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"),u=this._query("canvasScroll");if(l&&u){var h=u.clientWidth,c=u.clientHeight;l.style.width=h+"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=h*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 u(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,u=l.maxSize,h=l.minSize,c=Math.max(Math.min(r,u),h),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,u,h,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===(u=this._directoryRender)||void 0===u||u.dispose(),this._directoryRender=null,null===(h=this._tagRender)||void 0===h||h.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}]);
|