kfb-view 3.3.5 → 3.3.6

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.
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see kfb-view.cjs.js.LICENSE.txt */
2
- !function(){var t={2:function(t,e,i){var n=i(6926),o=i(9310);(t.exports=function(t,e){return o[t]||(o[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.6.5",mode:n?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},17:function(t,e,i){var n=i(1605),o=i(1344).filter,r=i(5634),s=i(3638),a=r("filter"),l=s("filter");n({target:"Array",proto:!0,forced:!a||!l},{filter:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}})},54:function(t,e,i){var n,o,r=i(6844),s=i(2192),a=RegExp.prototype.exec,l=String.prototype.replace,c=a,u=(n=/a/,o=/b*/g,a.call(n,"a"),a.call(o,"a"),0!==n.lastIndex||0!==o.lastIndex),h=s.UNSUPPORTED_Y||s.BROKEN_CARET,p=void 0!==/()??/.exec("")[1];(u||p||h)&&(c=function(t){var e,i,n,o,s=this,c=h&&s.sticky,d=r.call(s),f=s.source,v=0,g=t;return c&&(-1===(d=d.replace("y","")).indexOf("g")&&(d+="g"),g=String(t).slice(s.lastIndex),s.lastIndex>0&&(!s.multiline||s.multiline&&"\n"!==t[s.lastIndex-1])&&(f="(?: "+f+")",g=" "+g,v++),i=new RegExp("^(?:"+f+")",d)),p&&(i=new RegExp("^"+f+"$(?!\\s)",d)),u&&(e=s.lastIndex),n=a.call(c?i:s,g),c?n?(n.input=n.input.slice(v),n[0]=n[0].slice(v),n.index=s.lastIndex,s.lastIndex+=n[0].length):s.lastIndex=0:u&&n&&(s.lastIndex=s.global?n.index+n[0].length:e),p&&n&&n.length>1&&l.call(n[0],i,function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(n[o]=void 0)}),n}),t.exports=c},115:function(t,e,i){var n=i(1605),o=i(2074),r=i(8679),s=i(5335),a=i(2612),l=i(3747),c=i(2057),u=i(2998),h=i(5634),p=i(1602),d=i(6845),f=p("isConcatSpreadable"),v=9007199254740991,g="Maximum allowed index exceeded",m=d>=51||!o(function(){var t=[];return t[f]=!1,t.concat()[0]!==t}),y=h("concat"),w=function(t){if(!s(t))return!1;var e=t[f];return void 0!==e?!!e:r(t)};n({target:"Array",proto:!0,forced:!m||!y},{concat:function(t){var e,i,n,o,r,s=a(this),h=u(s,0),p=0;for(e=-1,n=arguments.length;e<n;e++)if(w(r=-1===e?s:arguments[e])){if(p+(o=l(r.length))>v)throw TypeError(g);for(i=0;i<o;i++,p++)i in r&&c(h,p,r[i])}else{if(p>=v)throw TypeError(g);c(h,p++,r)}return h.length=p,h}})},140:function(t,e,i){var n=i(7317),o=i(1229);t.exports="".repeat||function(t){var e=String(o(this)),i="",r=n(t);if(r<0||r==1/0)throw RangeError("Wrong number of repetitions");for(;r>0;(r>>>=1)&&(e+=e))1&r&&(i+=e);return i}},173:function(t,e,i){var n=i(779),o=i(3938),r=i(2612),s=i(3747),a=i(7317),l=i(1229),c=i(7234),u=i(6793),h=Math.max,p=Math.min,d=Math.floor,f=/\$([$&'`]|\d\d?|<[^>]*>)/g,v=/\$([$&'`]|\d\d?)/g,g=function(t){return void 0===t?t:String(t)};n("replace",2,function(t,e,i,n){var m=n.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE,y=n.REPLACE_KEEPS_$0,w=m?"$":"$0";return[function(i,n){var o=l(this),r=null==i?void 0:i[t];return void 0!==r?r.call(i,o,n):e.call(String(o),i,n)},function(t,n){if(!m&&y||"string"==typeof n&&-1===n.indexOf(w)){var r=i(e,t,this,n);if(r.done)return r.value}var l=o(t),d=String(this),f="function"==typeof n;f||(n=String(n));var v=l.global;if(v){var b=l.unicode;l.lastIndex=0}for(var T=[];;){var P=u(l,d);if(null===P)break;if(T.push(P),!v)break;""===String(P[0])&&(l.lastIndex=c(d,s(l.lastIndex),b))}for(var S="",E=0,C=0;C<T.length;C++){P=T[C];for(var _=String(P[0]),O=h(p(a(P.index),d.length),0),R=[],I=1;I<P.length;I++)R.push(g(P[I]));var k=P.groups;if(f){var D=[_].concat(R,O,d);void 0!==k&&D.push(k);var M=String(n.apply(void 0,D))}else M=x(_,d,O,R,k,n);O>=E&&(S+=d.slice(E,O)+M,E=O+_.length)}return S+d.slice(E)}];function x(t,i,n,o,s,a){var l=n+t.length,c=o.length,u=v;return void 0!==s&&(s=r(s),u=f),e.call(a,u,function(e,r){var a;switch(r.charAt(0)){case"$":return"$";case"&":return t;case"`":return i.slice(0,n);case"'":return i.slice(l);case"<":a=s[r.slice(1,-1)];break;default:var u=+r;if(0===u)return e;if(u>c){var h=d(u/10);return 0===h?e:h<=c?void 0===o[h-1]?r.charAt(1):o[h-1]+r.charAt(1):e}a=o[u-1]}return void 0===a?"":a})}})},200:function(t,e,i){var n=function(t){return t&&t.Math==Math&&t};t.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof i.g&&i.g)||Function("return this")()},290:function(t){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},298:function(t,e,i){var n=i(1602),o=i(3105),r=i(3610),s=n("unscopables"),a=Array.prototype;null==a[s]&&r.f(a,s,{configurable:!0,value:o(null)}),t.exports=function(t){a[s][t]=!0}},345:function(t,e,i){var n=i(1605),o=i(3172).values;n({target:"Object",stat:!0},{values:function(t){return o(t)}})},475:function(t,e,i){var n=i(1605),o=i(8664),r=i(5476),s=i(2349),a=[].join,l=o!=Object,c=s("join",",");n({target:"Array",proto:!0,forced:l||!c},{join:function(t){return a.call(r(this),void 0===t?",":t)}})},516:function(t,e,i){var n=i(1344).forEach,o=i(2349),r=i(3638),s=o("forEach"),a=r("forEach");t.exports=s&&a?[].forEach:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}},533:function(t,e,i){var n=i(1605),o=i(2237).left,r=i(2349),s=i(3638),a=r("reduce"),l=s("reduce",{1:0});n({target:"Array",proto:!0,forced:!a||!l},{reduce:function(t){return o(this,t,arguments.length,arguments.length>1?arguments[1]:void 0)}})},540:function(t){t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},557:function(t,e,i){var n=i(1605),o=i(8679),r=[].reverse,s=[1,2];n({target:"Array",proto:!0,forced:String(s)===String(s.reverse())},{reverse:function(){return o(this)&&(this.length=this.length),r.call(this)}})},590:function(t,e,i){var n=i(1605),o=i(5077),r=i(200),s=i(1883),a=i(5335),l=i(3610).f,c=i(4361),u=r.Symbol;if(o&&"function"==typeof u&&(!("description"in u.prototype)||void 0!==u().description)){var h={},p=function(){var t=arguments.length<1||void 0===arguments[0]?void 0:String(arguments[0]),e=this instanceof p?new u(t):void 0===t?u():u(t);return""===t&&(h[e]=!0),e};c(p,u);var d=p.prototype=u.prototype;d.constructor=p;var f=d.toString,v="Symbol(test)"==String(u("test")),g=/^Symbol\((.*)\)[^)]+$/;l(d,"description",{configurable:!0,get:function(){var t=a(this)?this.valueOf():this,e=f.call(t);if(s(h,t))return"";var i=v?e.slice(7,-1):e.replace(g,"$1");return""===i?void 0:i}}),n({global:!0,forced:!0},{Symbol:p})}},665:function(t){var e=0,i=Math.random();t.exports=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++e+i).toString(36)}},779:function(t,e,i){i(7136);var n=i(7485),o=i(2074),r=i(1602),s=i(54),a=i(7712),l=r("species"),c=!o(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")}),u="$0"==="a".replace(/./,"$0"),h=r("replace"),p=!!/./[h]&&""===/./[h]("a","$0"),d=!o(function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var i="ab".split(t);return 2!==i.length||"a"!==i[0]||"b"!==i[1]});t.exports=function(t,e,i,h){var f=r(t),v=!o(function(){var e={};return e[f]=function(){return 7},7!=""[t](e)}),g=v&&!o(function(){var e=!1,i=/a/;return"split"===t&&((i={}).constructor={},i.constructor[l]=function(){return i},i.flags="",i[f]=/./[f]),i.exec=function(){return e=!0,null},i[f](""),!e});if(!v||!g||"replace"===t&&(!c||!u||p)||"split"===t&&!d){var m=/./[f],y=i(f,""[t],function(t,e,i,n,o){return e.exec===s?v&&!o?{done:!0,value:m.call(e,i,n)}:{done:!0,value:t.call(i,e,n)}:{done:!1}},{REPLACE_KEEPS_$0:u,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:p}),w=y[0],x=y[1];n(String.prototype,t,w),n(RegExp.prototype,f,2==e?function(t,e){return x.call(t,this,e)}:function(t){return x.call(t,this)})}h&&a(RegExp.prototype[f],"sham",!0)}},802:function(t,e,i){var n=i(1602);e.f=n},874:function(t,e,i){var n=i(5335);t.exports=function(t,e){if(!n(t))return t;var i,o;if(e&&"function"==typeof(i=t.toString)&&!n(o=i.call(t)))return o;if("function"==typeof(i=t.valueOf)&&!n(o=i.call(t)))return o;if(!e&&"function"==typeof(i=t.toString)&&!n(o=i.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},1113:function(t){t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},1137:function(t,e,i){var n=i(3938),o=i(874);t.exports=function(t){if("string"!==t&&"number"!==t&&"default"!==t)throw TypeError("Incorrect hint");return o(n(this),"number"!==t)}},1229:function(t){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},1272:function(t,e,i){var n=i(9720),o=i(1883),r=i(802),s=i(3610).f;t.exports=function(t){var e=n.Symbol||(n.Symbol={});o(e,t)||s(e,t,{value:r.f(t)})}},1344:function(t,e,i){var n=i(6885),o=i(8664),r=i(2612),s=i(3747),a=i(2998),l=[].push,c=function(t){var e=1==t,i=2==t,c=3==t,u=4==t,h=6==t,p=5==t||h;return function(d,f,v,g){for(var m,y,w=r(d),x=o(w),b=n(f,v,3),T=s(x.length),P=0,S=g||a,E=e?S(d,T):i?S(d,0):void 0;T>P;P++)if((p||P in x)&&(y=b(m=x[P],P,w),t))if(e)E[P]=y;else if(y)switch(t){case 3:return!0;case 5:return m;case 6:return P;case 2:l.call(E,m)}else if(u)return!1;return h?-1:c||u?u:E}};t.exports={forEach:c(0),map:c(1),filter:c(2),some:c(3),every:c(4),find:c(5),findIndex:c(6)}},1412:function(t,e,i){var n=i(1605),o=i(2074),r=i(2612),s=i(7970),a=i(7168);n({target:"Object",stat:!0,forced:o(function(){s(1)}),sham:!a},{getPrototypeOf:function(t){return s(r(t))}})},1601:function(t){t.exports=function(t){return t[1]}},1602:function(t,e,i){var n=i(200),o=i(2),r=i(1883),s=i(665),a=i(1849),l=i(5225),c=o("wks"),u=n.Symbol,h=l?u:u&&u.withoutSetter||s;t.exports=function(t){return r(c,t)||(a&&r(u,t)?c[t]=u[t]:c[t]=h("Symbol."+t)),c[t]}},1605:function(t,e,i){var n=i(200),o=i(7632).f,r=i(7712),s=i(7485),a=i(5975),l=i(4361),c=i(4977);t.exports=function(t,e){var i,u,h,p,d,f=t.target,v=t.global,g=t.stat;if(i=v?n:g?n[f]||a(f,{}):(n[f]||{}).prototype)for(u in e){if(p=e[u],h=t.noTargetGet?(d=o(i,u))&&d.value:i[u],!c(v?u:f+(g?".":"#")+u,t.forced)&&void 0!==h){if(typeof p==typeof h)continue;l(p,h)}(t.sham||h&&h.sham)&&r(p,"sham",!0),s(i,u,p,t)}}},1641:function(t,e,i){var n=i(6347),o=i(290);t.exports=Object.keys||function(t){return n(t,o)}},1849:function(t,e,i){var n=i(2074);t.exports=!!Object.getOwnPropertySymbols&&!n(function(){return!String(Symbol())})},1883:function(t){var e={}.hasOwnProperty;t.exports=function(t,i){return e.call(t,i)}},1988:function(t,e,i){var n=i(1601),o=i.n(n),r=i(6314),s=i.n(r)()(o());s.push([t.id,".openseadragon-navigator{position:absolute;z-index:1}.openseadragon-navigator .navigator-main{position:relative;overflow:hidden;display:block;font-size:0}.openseadragon-navigator .navigator-main .v-line{height:100%;width:1px;line-height:1px;position:absolute;top:0}.openseadragon-navigator .navigator-main .h-line{width:100%;height:1px;line-height:1px;position:absolute;left:0}.openseadragon-navigator .navigator-main .view-rect{top:-1px;background-color:#fff;position:absolute;cursor:pointer;opacity:.5;-webkit-box-sizing:border-box;box-sizing:border-box}.openseadragon-navigator .navigator-main .navigator-color-rect{position:absolute;top:0;left:0;z-index:1}",""]),e.A=s},2057:function(t,e,i){var n=i(874),o=i(3610),r=i(6843);t.exports=function(t,e,i){var s=n(e);s in t?o.f(t,s,r(0,i)):t[s]=i}},2074:function(t){t.exports=function(t){try{return!!t()}catch(e){return!0}}},2157:function(t,e,i){var n=i(1605),o=i(1344).findIndex,r=i(298),s=i(3638),a="findIndex",l=!0,c=s(a);a in[]&&Array(1)[a](function(){l=!1}),n({target:"Array",proto:!0,forced:l||!c},{findIndex:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}}),r(a)},2192:function(t,e,i){var n=i(2074);function o(t,e){return RegExp(t,e)}e.UNSUPPORTED_Y=n(function(){var t=o("a","y");return t.lastIndex=2,null!=t.exec("abcd")}),e.BROKEN_CARET=n(function(){var t=o("^r","gy");return t.lastIndex=2,null!=t.exec("str")})},2237:function(t,e,i){var n=i(9085),o=i(2612),r=i(8664),s=i(3747),a=function(t){return function(e,i,a,l){n(i);var c=o(e),u=r(c),h=s(c.length),p=t?h-1:0,d=t?-1:1;if(a<2)for(;;){if(p in u){l=u[p],p+=d;break}if(p+=d,t?p<0:h<=p)throw TypeError("Reduce of empty array with no initial value")}for(;t?p>=0:h>p;p+=d)p in u&&(l=i(l,u[p],p,c));return l}};t.exports={left:a(!1),right:a(!0)}},2349:function(t,e,i){var n=i(2074);t.exports=function(t,e){var i=[][t];return!!i&&n(function(){i.call(null,e||function(){throw 1},1)})}},2449:function(t,e,i){var n=i(5335),o=i(8569),r=i(1602)("match");t.exports=function(t){var e;return n(t)&&(void 0!==(e=t[r])?!!e:"RegExp"==o(t))}},2588:function(t,e,i){var n=i(2449);t.exports=function(t){if(n(t))throw TypeError("The method doesn't accept regular expressions");return t}},2612:function(t,e,i){var n=i(1229);t.exports=function(t){return Object(n(t))}},2861:function(t,e){var i,n,o,r,s;function a(t){return new a.Viewer(t)}!function(t){t.version={versionStr:"4.1.1",major:parseInt("4",10),minor:parseInt("1",10),revision:parseInt("1",10)};var e,i={"[object Boolean]":"boolean","[object Number]":"number","[object String]":"string","[object Function]":"function","[object AsyncFunction]":"function","[object Promise]":"promise","[object Array]":"array","[object Date]":"date","[object RegExp]":"regexp","[object Object]":"object"},n=Object.prototype.toString,o=Object.prototype.hasOwnProperty;t.isFunction=function(e){return"function"===t.type(e)},t.isArray=Array.isArray||function(e){return"array"===t.type(e)},t.isWindow=function(t){return t&&"object"==typeof t&&"setInterval"in t},t.type=function(t){return null==t?String(t):i[n.call(t)]||"object"},t.isPlainObject=function(e){if(!e||"object"!==a.type(e)||e.nodeType||t.isWindow(e))return!1;if(e.constructor&&!o.call(e,"constructor")&&!o.call(e.constructor.prototype,"isPrototypeOf"))return!1;var i;for(var n in e)i=n;return void 0===i||o.call(e,i)},t.isEmptyObject=function(t){for(var e in t)return!1;return!0},t.freezeObject=function(e){return Object.freeze?t.freezeObject=Object.freeze:t.freezeObject=function(t){return t},t.freezeObject(e)},t.supportsCanvas=(e=document.createElement("canvas"),!(!t.isFunction(e.getContext)||!e.getContext("2d"))),t.isCanvasTainted=function(t){var e=!1;try{t.getContext("2d").getImageData(0,0,1,1)}catch(i){e=!0}return e},t.supportsAddEventListener=!(!document.documentElement.addEventListener||!document.addEventListener),t.supportsRemoveEventListener=!(!document.documentElement.removeEventListener||!document.removeEventListener),t.supportsEventListenerOptions=function(){var e=0;if(t.supportsAddEventListener)try{var i={get capture(){return e++,!1},get once(){return e++,!1},get passive(){return e++,!1}};window.addEventListener("test",null,i),window.removeEventListener("test",null,i)}catch(n){e=0}return e>=3}(),t.getCurrentPixelDensityRatio=function(){if(t.supportsCanvas){var e=document.createElement("canvas").getContext("2d"),i=window.devicePixelRatio||1,n=e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return Math.max(i,1)/n}return 1},t.pixelDensityRatio=t.getCurrentPixelDensityRatio()}(a),function(t){t.extend=function(){var e,i,n,o,r,s,l=arguments[0]||{},c=arguments.length,u=!1,h=1;for("boolean"==typeof l&&(u=l,l=arguments[1]||{},h=2),"object"==typeof l||a.isFunction(l)||(l={}),c===h&&(l=this,--h);h<c;h++)if(null!==(e=arguments[h])||void 0!==e)for(i in e){var p=Object.getOwnPropertyDescriptor(e,i);void 0!==p?p.get||p.set?Object.defineProperty(l,i,p):l!==(o=p.value)&&(u&&o&&(a.isPlainObject(o)||(r=a.isArray(o)))?(n=l[i],r?(r=!1,s=n&&a.isArray(n)?n:[]):s=n&&a.isPlainObject(n)?n:{},l[i]=a.extend(u,s,o)):void 0!==o&&(l[i]=o)):t.console.warn('Could not copy inherited property "'+i+'".')}return l};t.extend(t,{DEFAULT_SETTINGS:{xmlPath:null,tileSources:null,tileHost:null,initialPage:0,crossOriginPolicy:!1,ajaxWithCredentials:!1,loadTilesWithAjax:!1,ajaxHeaders:{},splitHashDataForPost:!1,panHorizontal:!0,panVertical:!0,constrainDuringPan:!1,wrapHorizontal:!1,wrapVertical:!1,visibilityRatio:.5,minPixelRatio:.5,defaultZoomLevel:0,minZoomLevel:null,maxZoomLevel:null,homeFillsViewer:!1,clickTimeThreshold:300,clickDistThreshold:5,dblClickTimeThreshold:300,dblClickDistThreshold:20,springStiffness:6.5,animationTime:1.2,gestureSettingsMouse:{dragToPan:!0,scrollToZoom:!0,clickToZoom:!0,dblClickToZoom:!1,dblClickDragToZoom:!1,pinchToZoom:!1,zoomToRefPoint:!0,flickEnabled:!1,flickMinSpeed:120,flickMomentum:.25,pinchRotate:!1},gestureSettingsTouch:{dragToPan:!0,scrollToZoom:!1,clickToZoom:!1,dblClickToZoom:!0,dblClickDragToZoom:!0,pinchToZoom:!0,zoomToRefPoint:!0,flickEnabled:!0,flickMinSpeed:120,flickMomentum:.25,pinchRotate:!1},gestureSettingsPen:{dragToPan:!0,scrollToZoom:!1,clickToZoom:!0,dblClickToZoom:!1,dblClickDragToZoom:!1,pinchToZoom:!1,zoomToRefPoint:!0,flickEnabled:!1,flickMinSpeed:120,flickMomentum:.25,pinchRotate:!1},gestureSettingsUnknown:{dragToPan:!0,scrollToZoom:!1,clickToZoom:!1,dblClickToZoom:!0,dblClickDragToZoom:!1,pinchToZoom:!0,zoomToRefPoint:!0,flickEnabled:!0,flickMinSpeed:120,flickMomentum:.25,pinchRotate:!1},zoomPerClick:2,zoomPerScroll:1.2,zoomPerDblClickDrag:1.2,zoomPerSecond:1,blendTime:0,alwaysBlend:!1,autoHideControls:!0,immediateRender:!1,minZoomImageRatio:.9,maxZoomPixelRatio:1.1,smoothTileEdgesMinZoom:1.1,iOSDevice:function(){if("object"!=typeof navigator)return!1;var t=navigator.userAgent;return"string"==typeof t&&(-1!==t.indexOf("iPhone")||-1!==t.indexOf("iPad")||-1!==t.indexOf("iPod"))}(),pixelsPerWheelLine:40,pixelsPerArrowPress:40,autoResize:!0,preserveImageSizeOnResize:!1,minScrollDeltaTime:50,rotationIncrement:90,showSequenceControl:!0,sequenceControlAnchor:null,preserveViewport:!1,preserveOverlays:!1,navPrevNextWrap:!1,showNavigationControl:!0,navigationControlAnchor:null,showZoomControl:!0,showHomeControl:!0,showFullPageControl:!0,showRotationControl:!1,showFlipControl:!1,controlsFadeDelay:2e3,controlsFadeLength:1500,mouseNavEnabled:!0,showNavigator:!1,navigatorElement:null,navigatorId:null,navigatorPosition:null,navigatorSizeRatio:.2,navigatorMaintainSizeRatio:!1,navigatorTop:null,navigatorLeft:null,navigatorHeight:null,navigatorWidth:null,navigatorAutoResize:!0,navigatorAutoFade:!0,navigatorRotate:!0,navigatorBackground:"#000",navigatorOpacity:.8,navigatorBorderColor:"#555",navigatorDisplayRegionColor:"#900",degrees:0,flipped:!1,opacity:1,preload:!1,compositeOperation:null,imageSmoothingEnabled:!0,placeholderFillStyle:null,subPixelRoundingForTransparency:null,showReferenceStrip:!1,referenceStripScroll:"horizontal",referenceStripElement:null,referenceStripHeight:null,referenceStripWidth:null,referenceStripPosition:"BOTTOM_LEFT",referenceStripSizeRatio:.2,collectionRows:3,collectionColumns:0,collectionLayout:"horizontal",collectionMode:!1,collectionTileSize:800,collectionTileMargin:80,imageLoaderLimit:0,maxImageCacheCount:200,timeout:3e4,useCanvas:!0,tileRetryMax:0,tileRetryDelay:2500,prefixUrl:"/images/",navImages:{zoomIn:{REST:"zoomin_rest.png",GROUP:"zoomin_grouphover.png",HOVER:"zoomin_hover.png",DOWN:"zoomin_pressed.png"},zoomOut:{REST:"zoomout_rest.png",GROUP:"zoomout_grouphover.png",HOVER:"zoomout_hover.png",DOWN:"zoomout_pressed.png"},home:{REST:"home_rest.png",GROUP:"home_grouphover.png",HOVER:"home_hover.png",DOWN:"home_pressed.png"},fullpage:{REST:"fullpage_rest.png",GROUP:"fullpage_grouphover.png",HOVER:"fullpage_hover.png",DOWN:"fullpage_pressed.png"},rotateleft:{REST:"rotateleft_rest.png",GROUP:"rotateleft_grouphover.png",HOVER:"rotateleft_hover.png",DOWN:"rotateleft_pressed.png"},rotateright:{REST:"rotateright_rest.png",GROUP:"rotateright_grouphover.png",HOVER:"rotateright_hover.png",DOWN:"rotateright_pressed.png"},flip:{REST:"flip_rest.png",GROUP:"flip_grouphover.png",HOVER:"flip_hover.png",DOWN:"flip_pressed.png"},previous:{REST:"previous_rest.png",GROUP:"previous_grouphover.png",HOVER:"previous_hover.png",DOWN:"previous_pressed.png"},next:{REST:"next_rest.png",GROUP:"next_grouphover.png",HOVER:"next_hover.png",DOWN:"next_pressed.png"}},debugMode:!1,debugGridColor:["#437AB2","#1B9E77","#D95F02","#7570B3","#E7298A","#66A61E","#E6AB02","#A6761D","#666666"],silenceMultiImageWarnings:!1},SIGNAL:"----seadragon----",delegate:function(t,e){return function(){var i=arguments;return void 0===i&&(i=[]),e.apply(t,i)}},BROWSERS:{UNKNOWN:0,IE:1,FIREFOX:2,SAFARI:3,CHROME:4,OPERA:5,EDGE:6,CHROMEEDGE:7},SUBPIXEL_ROUNDING_OCCURRENCES:{NEVER:0,ONLY_AT_REST:1,ALWAYS:2},_viewers:new Map,getViewer:function(e){return t._viewers.get(this.getElement(e))},getElement:function(t){return"string"==typeof t&&(t=document.getElementById(t)),t},getElementPosition:function(e){var i,n,r=new t.Point;for(n=o(e=t.getElement(e),i="fixed"===t.getElementStyle(e).position);n;)r.x+=e.offsetLeft,r.y+=e.offsetTop,i&&(r=r.plus(t.getPageScroll())),n=o(e=n,i="fixed"===t.getElementStyle(e).position);return r},getElementOffset:function(e){var i,n,o=(e=t.getElement(e))&&e.ownerDocument,r={top:0,left:0};return o?(i=o.documentElement,void 0!==e.getBoundingClientRect&&(r=e.getBoundingClientRect()),n=o===o.window?o:9===o.nodeType&&(o.defaultView||o.parentWindow),new t.Point(r.left+(n.pageXOffset||i.scrollLeft)-(i.clientLeft||0),r.top+(n.pageYOffset||i.scrollTop)-(i.clientTop||0))):new t.Point},getElementSize:function(e){return e=t.getElement(e),new t.Point(e.clientWidth,e.clientHeight)},getElementStyle:document.documentElement.currentStyle?function(e){return(e=t.getElement(e)).currentStyle}:function(e){return e=t.getElement(e),window.getComputedStyle(e,"")},getCssPropertyWithVendorPrefix:function(e){var i={};return t.getCssPropertyWithVendorPrefix=function(e){if(void 0!==i[e])return i[e];var n=document.createElement("div").style,o=null;if(void 0!==n[e])o=e;else for(var r=["Webkit","Moz","MS","O","webkit","moz","ms","o"],s=t.capitalizeFirstLetter(e),a=0;a<r.length;a++){var l=r[a]+s;if(void 0!==n[l]){o=l;break}}return i[e]=o,o},t.getCssPropertyWithVendorPrefix(e)},capitalizeFirstLetter:function(t){return t.charAt(0).toUpperCase()+t.slice(1)},positiveModulo:function(t,e){var i=t%e;return i<0&&(i+=e),i},pointInElement:function(e,i){e=t.getElement(e);var n=t.getElementOffset(e),o=t.getElementSize(e);return i.x>=n.x&&i.x<n.x+o.x&&i.y<n.y+o.y&&i.y>=n.y},getMousePosition:function(e){if("number"==typeof e.pageX)t.getMousePosition=function(e){var i=new t.Point;return i.x=e.pageX,i.y=e.pageY,i};else{if("number"!=typeof e.clientX)throw new Error("Unknown event mouse position, no known technique.");t.getMousePosition=function(e){var i=new t.Point;return i.x=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,i.y=e.clientY+document.body.scrollTop+document.documentElement.scrollTop,i}}return t.getMousePosition(e)},getPageScroll:function(){var e=document.documentElement||{},i=document.body||{};if("number"==typeof window.pageXOffset)t.getPageScroll=function(){return new t.Point(window.pageXOffset,window.pageYOffset)};else if(i.scrollLeft||i.scrollTop)t.getPageScroll=function(){return new t.Point(document.body.scrollLeft,document.body.scrollTop)};else{if(!e.scrollLeft&&!e.scrollTop)return new t.Point(0,0);t.getPageScroll=function(){return new t.Point(document.documentElement.scrollLeft,document.documentElement.scrollTop)}}return t.getPageScroll()},setPageScroll:function(e){if(void 0!==window.scrollTo)t.setPageScroll=function(t){window.scrollTo(t.x,t.y)};else{var i=t.getPageScroll();if(i.x===e.x&&i.y===e.y)return;document.body.scrollLeft=e.x,document.body.scrollTop=e.y;var n=t.getPageScroll();if(n.x!==i.x&&n.y!==i.y)return void(t.setPageScroll=function(t){document.body.scrollLeft=t.x,document.body.scrollTop=t.y});if(document.documentElement.scrollLeft=e.x,document.documentElement.scrollTop=e.y,(n=t.getPageScroll()).x!==i.x&&n.y!==i.y)return void(t.setPageScroll=function(t){document.documentElement.scrollLeft=t.x,document.documentElement.scrollTop=t.y});t.setPageScroll=function(t){}}t.setPageScroll(e)},getWindowSize:function(){var e=document.documentElement||{},i=document.body||{};if("number"==typeof window.innerWidth)t.getWindowSize=function(){return new t.Point(window.innerWidth,window.innerHeight)};else if(e.clientWidth||e.clientHeight)t.getWindowSize=function(){return new t.Point(document.documentElement.clientWidth,document.documentElement.clientHeight)};else{if(!i.clientWidth&&!i.clientHeight)throw new Error("Unknown window size, no known technique.");t.getWindowSize=function(){return new t.Point(document.body.clientWidth,document.body.clientHeight)}}return t.getWindowSize()},makeCenteredNode:function(e){e=t.getElement(e);var i=[t.makeNeutralElement("div"),t.makeNeutralElement("div"),t.makeNeutralElement("div")];return t.extend(i[0].style,{display:"table",height:"100%",width:"100%"}),t.extend(i[1].style,{display:"table-row"}),t.extend(i[2].style,{display:"table-cell",verticalAlign:"middle",textAlign:"center"}),i[0].appendChild(i[1]),i[1].appendChild(i[2]),i[2].appendChild(e),i[0]},makeNeutralElement:function(t){var e=document.createElement(t),i=e.style;return i.background="transparent none",i.border="none",i.margin="0px",i.padding="0px",i.position="static",e},now:function(){return Date.now?t.now=Date.now:t.now=function(){return(new Date).getTime()},t.now()},makeTransparentImage:function(e){var i=t.makeNeutralElement("img");return i.src=e,i},setElementOpacity:function(e,i,n){var o;e=t.getElement(e),n&&!t.Browser.alpha&&(i=Math.round(i)),t.Browser.opacity?e.style.opacity=i<1?i:"":i<1?(o="alpha(opacity="+Math.round(100*i)+")",e.style.filter=o):e.style.filter=""},setElementTouchActionNone:function(e){void 0!==(e=t.getElement(e)).style.touchAction?e.style.touchAction="none":void 0!==e.style.msTouchAction&&(e.style.msTouchAction="none")},setElementPointerEvents:function(e,i){void 0!==(e=t.getElement(e)).style&&void 0!==e.style.pointerEvents&&(e.style.pointerEvents=i)},setElementPointerEventsNone:function(e){t.setElementPointerEvents(e,"none")},addClass:function(e,i){(e=t.getElement(e)).className?-1===(" "+e.className+" ").indexOf(" "+i+" ")&&(e.className+=" "+i):e.className=i},indexOf:function(t,e,i){return Array.prototype.indexOf?this.indexOf=function(t,e,i){return t.indexOf(e,i)}:this.indexOf=function(t,e,i){var n,o,r=i||0;if(!t)throw new TypeError;if(0===(o=t.length)||r>=o)return-1;for(r<0&&(r=o-Math.abs(r)),n=r;n<o;n++)if(t[n]===e)return n;return-1},this.indexOf(t,e,i)},removeClass:function(e,i){var n,o,r=[];for(n=(e=t.getElement(e)).className.split(/\s+/),o=0;o<n.length;o++)n[o]&&n[o]!==i&&r.push(n[o]);e.className=r.join(" ")},normalizeEventListenerOptions:function(e){return void 0!==e?"boolean"==typeof e?t.supportsEventListenerOptions?{capture:e}:e:t.supportsEventListenerOptions?e:void 0!==e.capture&&e.capture:!!t.supportsEventListenerOptions&&{capture:!1}},addEvent:function(){if(t.supportsAddEventListener)return function(e,i,n,o){o=t.normalizeEventListenerOptions(o),(e=t.getElement(e)).addEventListener(i,n,o)};if(document.documentElement.attachEvent&&document.attachEvent)return function(e,i,n){(e=t.getElement(e)).attachEvent("on"+i,n)};throw new Error("No known event model.")}(),removeEvent:function(){if(t.supportsRemoveEventListener)return function(e,i,n,o){o=t.normalizeEventListenerOptions(o),(e=t.getElement(e)).removeEventListener(i,n,o)};if(document.documentElement.detachEvent&&document.detachEvent)return function(e,i,n){(e=t.getElement(e)).detachEvent("on"+i,n)};throw new Error("No known event model.")}(),cancelEvent:function(t){t.preventDefault()},eventIsCanceled:function(t){return t.defaultPrevented},stopEvent:function(t){t.stopPropagation()},createCallback:function(t,e){var i,n=[];for(i=2;i<arguments.length;i++)n.push(arguments[i]);return function(){var i,o=n.concat([]);for(i=0;i<arguments.length;i++)o.push(arguments[i]);return e.apply(t,o)}},getUrlParameter:function(t){var e=n[t];return e||null},getUrlProtocol:function(t){var e=t.match(/^([a-z]+:)\/\//i);return null===e?window.location.protocol:e[1].toLowerCase()},createAjaxRequest:function(e){var i;try{i=!!new ActiveXObject("Microsoft.XMLHTTP")}catch(n){i=!1}if(i)window.XMLHttpRequest?t.createAjaxRequest=function(t){return t?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest}:t.createAjaxRequest=function(){return new ActiveXObject("Microsoft.XMLHTTP")};else{if(!window.XMLHttpRequest)throw new Error("Browser doesn't support XMLHttpRequest.");t.createAjaxRequest=function(){return new XMLHttpRequest}}return t.createAjaxRequest(e)},makeAjaxRequest:function(e,i,n){var o,r,s,a;t.isPlainObject(e)&&(i=e.success,n=e.error,o=e.withCredentials,r=e.headers,s=e.responseType||null,a=e.postData||null,e=e.url);var l=t.getUrlProtocol(e),c=t.createAjaxRequest("file:"===l);if(!t.isFunction(i))throw new Error("makeAjaxRequest requires a success callback");c.onreadystatechange=function(){4===c.readyState&&(c.onreadystatechange=function(){},c.status>=200&&c.status<300||0===c.status&&"http:"!==l&&"https:"!==l?i(c):t.isFunction(n)?n(c):t.console.error("AJAX request returned %d: %s",c.status,e))};var u=a?"POST":"GET";try{if(c.open(u,e,!0),s&&(c.responseType=s),r)for(var h in r)Object.prototype.hasOwnProperty.call(r,h)&&r[h]&&c.setRequestHeader(h,r[h]);o&&(c.withCredentials=!0),c.send(a)}catch(p){t.console.error("%s while making AJAX request: %s",p.name,p.message),c.onreadystatechange=function(){},t.isFunction(n)&&n(c,p)}return c},jsonp:function(e){var i,n=e.url,o=document.head||document.getElementsByTagName("head")[0]||document.documentElement,r=e.callbackName||"openseadragon"+t.now(),s=window[r],a="$1"+r+"$2",l=e.param||"callback",c=e.callback;n=n.replace(/(=)\?(&|$)|\?\?/i,a),n+=(/\?/.test(n)?"&":"?")+l+"="+r,window[r]=function(e){if(s)window[r]=s;else try{delete window[r]}catch(i){}c&&t.isFunction(c)&&c(e)},i=document.createElement("script"),void 0===e.async&&!1===e.async||(i.async="async"),e.scriptCharset&&(i.charset=e.scriptCharset),i.src=n,i.onload=i.onreadystatechange=function(t,e){(e||!i.readyState||/loaded|complete/.test(i.readyState))&&(i.onload=i.onreadystatechange=null,o&&i.parentNode&&o.removeChild(i),i=void 0)},o.insertBefore(i,o.firstChild)},createFromDZI:function(){throw"OpenSeadragon.createFromDZI is deprecated, use Viewer.open."},parseXml:function(e){if(window.DOMParser)t.parseXml=function(t){return(new DOMParser).parseFromString(t,"text/xml")};else{if(!window.ActiveXObject)throw new Error("Browser doesn't support XML DOM.");t.parseXml=function(t){var e=null;return(e=new ActiveXObject("Microsoft.XMLDOM")).async=!1,e.loadXML(t),e}}return t.parseXml(e)},parseJSON:function(e){return t.parseJSON=window.JSON.parse,t.parseJSON(e)},imageFormatSupported:function(t){return!!i[(t=t||"").toLowerCase()]},setImageFormatsSupported:function(e){t.extend(i,e)}});var e=function(t){};t.console=window.console||{log:e,debug:e,info:e,warn:e,error:e,assert:e},t.Browser={vendor:t.BROWSERS.UNKNOWN,version:0,alpha:!0};var i={bmp:!1,jpeg:!0,jpg:!0,png:!0,tif:!1,wdp:!1},n={};function o(t,e){return e&&t!==document.body?document.body:t.offsetParent}!function(){var e=navigator.appVersion,i=navigator.userAgent;switch(navigator.appName){case"Microsoft Internet Explorer":window.attachEvent&&window.ActiveXObject&&(t.Browser.vendor=t.BROWSERS.IE,t.Browser.version=parseFloat(i.substring(i.indexOf("MSIE")+5,i.indexOf(";",i.indexOf("MSIE")))));break;case"Netscape":window.addEventListener&&(i.indexOf("Edge")>=0?(t.Browser.vendor=t.BROWSERS.EDGE,t.Browser.version=parseFloat(i.substring(i.indexOf("Edge")+5))):i.indexOf("Edg")>=0?(t.Browser.vendor=t.BROWSERS.CHROMEEDGE,t.Browser.version=parseFloat(i.substring(i.indexOf("Edg")+4))):i.indexOf("Firefox")>=0?(t.Browser.vendor=t.BROWSERS.FIREFOX,t.Browser.version=parseFloat(i.substring(i.indexOf("Firefox")+8))):i.indexOf("Safari")>=0?(t.Browser.vendor=i.indexOf("Chrome")>=0?t.BROWSERS.CHROME:t.BROWSERS.SAFARI,t.Browser.version=parseFloat(i.substring(i.substring(0,i.indexOf("Safari")).lastIndexOf("/")+1,i.indexOf("Safari")))):null!==new RegExp("Trident/.*rv:([0-9]{1,}[.0-9]{0,})").exec(i)&&(t.Browser.vendor=t.BROWSERS.IE,t.Browser.version=parseFloat(RegExp.$1)));break;case"Opera":t.Browser.vendor=t.BROWSERS.OPERA,t.Browser.version=parseFloat(e)}var o,r,s,a=window.location.search.substring(1).split("&");for(s=0;s<a.length;s++)if((r=(o=a[s]).indexOf("="))>0){var l=o.substring(0,r),c=o.substring(r+1);try{n[l]=decodeURIComponent(c)}catch(u){t.console.error("Ignoring malformed URL parameter: %s=%s",l,c)}}t.Browser.alpha=!(t.Browser.vendor===t.BROWSERS.CHROME&&t.Browser.version<2),t.Browser.opacity=!0,t.Browser.vendor===t.BROWSERS.IE&&t.Browser.version<11&&t.console.error("Internet Explorer versions < 11 are not supported by OpenSeadragon")}(),function(e){var i=e.requestAnimationFrame||e.mozRequestAnimationFrame||e.webkitRequestAnimationFrame||e.msRequestAnimationFrame,n=e.cancelAnimationFrame||e.mozCancelAnimationFrame||e.webkitCancelAnimationFrame||e.msCancelAnimationFrame;if(i&&n)t.requestAnimationFrame=function(){return i.apply(e,arguments)},t.cancelAnimationFrame=function(){return n.apply(e,arguments)};else{var o,r=[],s=[],a=0;t.requestAnimationFrame=function(e){return r.push([++a,e]),o||(o=setInterval(function(){if(r.length){var e=t.now(),i=s;for(s=r,r=i;s.length;)s.shift()[1](e)}else clearInterval(o),o=void 0},20)),a},t.cancelAnimationFrame=function(t){var e,i;for(e=0,i=r.length;e<i;e+=1)if(r[e][0]===t)return void r.splice(e,1);for(e=0,i=s.length;e<i;e+=1)if(s[e][0]===t)return void s.splice(e,1)}}}(window)}(a),n=[],void 0===(o="function"==typeof(i=function(){return a})?i.apply(e,n):i)||(t.exports=o),r=a,s={supportsFullScreen:!1,isFullScreen:function(){return!1},getFullScreenElement:function(){return null},requestFullScreen:function(){},exitFullScreen:function(){},cancelFullScreen:function(){},fullScreenEventName:"",fullScreenErrorEventName:""},document.exitFullscreen?(s.supportsFullScreen=!0,s.getFullScreenElement=function(){return document.fullscreenElement},s.requestFullScreen=function(t){return t.requestFullscreen()},s.exitFullScreen=function(){document.exitFullscreen()},s.fullScreenEventName="fullscreenchange",s.fullScreenErrorEventName="fullscreenerror"):document.msExitFullscreen?(s.supportsFullScreen=!0,s.getFullScreenElement=function(){return document.msFullscreenElement},s.requestFullScreen=function(t){return t.msRequestFullscreen()},s.exitFullScreen=function(){document.msExitFullscreen()},s.fullScreenEventName="MSFullscreenChange",s.fullScreenErrorEventName="MSFullscreenError"):document.webkitExitFullscreen?(s.supportsFullScreen=!0,s.getFullScreenElement=function(){return document.webkitFullscreenElement},s.requestFullScreen=function(t){return t.webkitRequestFullscreen()},s.exitFullScreen=function(){document.webkitExitFullscreen()},s.fullScreenEventName="webkitfullscreenchange",s.fullScreenErrorEventName="webkitfullscreenerror"):document.webkitCancelFullScreen?(s.supportsFullScreen=!0,s.getFullScreenElement=function(){return document.webkitCurrentFullScreenElement},s.requestFullScreen=function(t){return t.webkitRequestFullScreen()},s.exitFullScreen=function(){document.webkitCancelFullScreen()},s.fullScreenEventName="webkitfullscreenchange",s.fullScreenErrorEventName="webkitfullscreenerror"):document.mozCancelFullScreen&&(s.supportsFullScreen=!0,s.getFullScreenElement=function(){return document.mozFullScreenElement},s.requestFullScreen=function(t){return t.mozRequestFullScreen()},s.exitFullScreen=function(){document.mozCancelFullScreen()},s.fullScreenEventName="mozfullscreenchange",s.fullScreenErrorEventName="mozfullscreenerror"),s.isFullScreen=function(){return null!==s.getFullScreenElement()},s.cancelFullScreen=function(){r.console.error("cancelFullScreen is deprecated. Use exitFullScreen instead."),s.exitFullScreen()},r.extend(r,s),function(t){t.EventSource=function(){this.events={}},t.EventSource.prototype={addOnceHandler:function(t,e,i,n,o){var r=this;n=n||1;var s=0,a=function(i){return++s===n&&r.removeHandler(t,a),e(i)};this.addHandler(t,a,i,o)},addHandler:function(e,i,n,o){var r=this.events[e];if(r||(this.events[e]=r=[]),i&&t.isFunction(i)){var s=r.length,a={handler:i,userData:n||null,priority:o||0};for(r[s]=a;s>0&&r[s-1].priority<r[s].priority;)r[s]=r[s-1],r[s-1]=a,s--}},removeHandler:function(e,i){var n,o=this.events[e],r=[];if(o&&t.isArray(o)){for(n=0;n<o.length;n++)o[n].handler!==i&&r.push(o[n]);this.events[e]=r}},numberOfHandlers:function(t){var e=this.events[t];return e?e.length:0},removeAllHandlers:function(t){if(t)this.events[t]=[];else for(var e in this.events)this.events[e]=[]},getHandler:function(t){var e=this.events[t];return e&&e.length?(e=1===e.length?[e[0]]:Array.apply(null,e),function(t,i){var n,o=e.length;for(n=0;n<o;n++)e[n]&&(i.eventSource=t,i.userData=e[n].userData,e[n].handler(i))}):null},raiseEvent:function(t,e){var i=this.getHandler(t);if(i)return i(this,e||{})}}}(a),function(t){var e=[],i={};t.MouseTracker=function(n){e.push(this);var o=arguments;t.isPlainObject(n)||(n={element:o[0],clickTimeThreshold:o[1],clickDistThreshold:o[2]}),this.hash=Math.random(),this.element=t.getElement(n.element),this.clickTimeThreshold=n.clickTimeThreshold||t.DEFAULT_SETTINGS.clickTimeThreshold,this.clickDistThreshold=n.clickDistThreshold||t.DEFAULT_SETTINGS.clickDistThreshold,this.dblClickTimeThreshold=n.dblClickTimeThreshold||t.DEFAULT_SETTINGS.dblClickTimeThreshold,this.dblClickDistThreshold=n.dblClickDistThreshold||t.DEFAULT_SETTINGS.dblClickDistThreshold,this.userData=n.userData||null,this.stopDelay=n.stopDelay||50,this.preProcessEventHandler=n.preProcessEventHandler||null,this.contextMenuHandler=n.contextMenuHandler||null,this.enterHandler=n.enterHandler||null,this.leaveHandler=n.leaveHandler||null,this.exitHandler=n.exitHandler||null,this.overHandler=n.overHandler||null,this.outHandler=n.outHandler||null,this.pressHandler=n.pressHandler||null,this.nonPrimaryPressHandler=n.nonPrimaryPressHandler||null,this.releaseHandler=n.releaseHandler||null,this.nonPrimaryReleaseHandler=n.nonPrimaryReleaseHandler||null,this.moveHandler=n.moveHandler||null,this.scrollHandler=n.scrollHandler||null,this.clickHandler=n.clickHandler||null,this.dblClickHandler=n.dblClickHandler||null,this.dragHandler=n.dragHandler||null,this.dragEndHandler=n.dragEndHandler||null,this.pinchHandler=n.pinchHandler||null,this.stopHandler=n.stopHandler||null,this.keyDownHandler=n.keyDownHandler||null,this.keyUpHandler=n.keyUpHandler||null,this.keyHandler=n.keyHandler||null,this.focusHandler=n.focusHandler||null,this.blurHandler=n.blurHandler||null;var r=this;i[this.hash]={click:function(e){!function(e,i){var n={originalEvent:i,eventType:"click",pointerType:"mouse",isEmulated:!1};L(e,n),n.preventDefault&&!n.defaultPrevented&&t.cancelEvent(i);n.stopPropagation&&t.stopEvent(i)}(r,e)},dblclick:function(e){!function(e,i){var n={originalEvent:i,eventType:"dblclick",pointerType:"mouse",isEmulated:!1};L(e,n),n.preventDefault&&!n.defaultPrevented&&t.cancelEvent(i);n.stopPropagation&&t.stopEvent(i)}(r,e)},keydown:function(e){!function(e,i){var n=null,o={originalEvent:i,eventType:"keydown",pointerType:"",isEmulated:!1};L(e,o),!e.keyDownHandler||o.preventGesture||o.defaultPrevented||(n={eventSource:e,keyCode:i.keyCode?i.keyCode:i.charCode,ctrl:i.ctrlKey,shift:i.shiftKey,alt:i.altKey,meta:i.metaKey,originalEvent:i,preventDefault:o.preventDefault||o.defaultPrevented,userData:e.userData},e.keyDownHandler(n));(n&&n.preventDefault||o.preventDefault&&!o.defaultPrevented)&&t.cancelEvent(i);o.stopPropagation&&t.stopEvent(i)}(r,e)},keyup:function(e){!function(e,i){var n=null,o={originalEvent:i,eventType:"keyup",pointerType:"",isEmulated:!1};L(e,o),!e.keyUpHandler||o.preventGesture||o.defaultPrevented||(n={eventSource:e,keyCode:i.keyCode?i.keyCode:i.charCode,ctrl:i.ctrlKey,shift:i.shiftKey,alt:i.altKey,meta:i.metaKey,originalEvent:i,preventDefault:o.preventDefault||o.defaultPrevented,userData:e.userData},e.keyUpHandler(n));(n&&n.preventDefault||o.preventDefault&&!o.defaultPrevented)&&t.cancelEvent(i);o.stopPropagation&&t.stopEvent(i)}(r,e)},keypress:function(e){!function(e,i){var n=null,o={originalEvent:i,eventType:"keypress",pointerType:"",isEmulated:!1};L(e,o),!e.keyHandler||o.preventGesture||o.defaultPrevented||(n={eventSource:e,keyCode:i.keyCode?i.keyCode:i.charCode,ctrl:i.ctrlKey,shift:i.shiftKey,alt:i.altKey,meta:i.metaKey,originalEvent:i,preventDefault:o.preventDefault||o.defaultPrevented,userData:e.userData},e.keyHandler(n));(n&&n.preventDefault||o.preventDefault&&!o.defaultPrevented)&&t.cancelEvent(i);o.stopPropagation&&t.stopEvent(i)}(r,e)},focus:function(t){!function(t,e){var i={originalEvent:e,eventType:"focus",pointerType:"",isEmulated:!1};L(t,i),t.focusHandler&&!i.preventGesture&&t.focusHandler({eventSource:t,originalEvent:e,userData:t.userData})}(r,t)},blur:function(t){!function(t,e){var i={originalEvent:e,eventType:"blur",pointerType:"",isEmulated:!1};L(t,i),t.blurHandler&&!i.preventGesture&&t.blurHandler({eventSource:t,originalEvent:e,userData:t.userData})}(r,t)},contextmenu:function(e){!function(e,i){var n=null,o={originalEvent:i,eventType:"contextmenu",pointerType:"mouse",isEmulated:!1};L(e,o),!e.contextMenuHandler||o.preventGesture||o.defaultPrevented||(n={eventSource:e,position:x(y(i),e.element),originalEvent:o.originalEvent,preventDefault:o.preventDefault||o.defaultPrevented,userData:e.userData},e.contextMenuHandler(n));(n&&n.preventDefault||o.preventDefault&&!o.defaultPrevented)&&t.cancelEvent(i);o.stopPropagation&&t.stopEvent(i)}(r,e)},wheel:function(t){!function(t,e){P(t,e,e)}(r,t)},mousewheel:function(t){T(r,t)},DOMMouseScroll:function(t){T(r,t)},MozMousePixelScroll:function(t){T(r,t)},losecapture:function(e){!function(e,i){var n={id:t.MouseTracker.mousePointerId,type:"mouse"},o={originalEvent:i,eventType:"lostpointercapture",pointerType:"mouse",isEmulated:!1};L(e,o),i.target===e.element&&A(e,n,!1);o.stopPropagation&&t.stopEvent(i)}(r,e)},mouseenter:function(t){S(r,t)},mouseleave:function(t){E(r,t)},mouseover:function(t){C(r,t)},mouseout:function(t){_(r,t)},mousedown:function(t){O(r,t)},mouseup:function(t){R(r,t)},mousemove:function(t){k(r,t)},touchstart:function(e){!function(e,i){var n,o,r,s=i.changedTouches.length,a=e.getActivePointersListByType("touch");n=t.now(),a.getLength()>i.touches.length-s&&t.console.warn("Tracked touch contact count doesn't match event.touches.length");var l={originalEvent:i,eventType:"pointerdown",pointerType:"touch",isEmulated:!1};for(L(e,l),o=0;o<s;o++)B(e,l,r={id:i.changedTouches[o].identifier,type:"touch",isPrimary:0===a.getLength(),currentPos:y(i.changedTouches[o]),currentTime:n}),z(e,l,r,0),A(e,r,!0);l.preventDefault&&!l.defaultPrevented&&t.cancelEvent(i);l.stopPropagation&&t.stopEvent(i)}(r,e)},touchend:function(e){!function(e,i){var n,o,r,s=i.changedTouches.length;n=t.now();var a={originalEvent:i,eventType:"pointerup",pointerType:"touch",isEmulated:!1};for(L(e,a),o=0;o<s;o++)H(e,a,r={id:i.changedTouches[o].identifier,type:"touch",currentPos:y(i.changedTouches[o]),currentTime:n},0),A(e,r,!1),N(e,a,r);a.preventDefault&&!a.defaultPrevented&&t.cancelEvent(i);a.stopPropagation&&t.stopEvent(i)}(r,e)},touchmove:function(e){!function(e,i){var n,o,r=i.changedTouches.length;n=t.now();var s={originalEvent:i,eventType:"pointermove",pointerType:"touch",isEmulated:!1};for(L(e,s),o=0;o<r;o++)F(e,s,{id:i.changedTouches[o].identifier,type:"touch",currentPos:y(i.changedTouches[o]),currentTime:n});s.preventDefault&&!s.defaultPrevented&&t.cancelEvent(i);s.stopPropagation&&t.stopEvent(i)}(r,e)},touchcancel:function(e){!function(e,i){var n,o=i.changedTouches.length,r={originalEvent:i,eventType:"pointercancel",pointerType:"touch",isEmulated:!1};for(L(e,r),n=0;n<o;n++)W(e,r,{id:i.changedTouches[n].identifier,type:"touch"});r.stopPropagation&&t.stopEvent(i)}(r,e)},gesturestart:function(e){!function(e,i){t.eventIsCanceled(i)||i.preventDefault()}(0,e)},gesturechange:function(e){!function(e,i){t.eventIsCanceled(i)||i.preventDefault()}(0,e)},gotpointercapture:function(e){!function(e,i){var n={originalEvent:i,eventType:"gotpointercapture",pointerType:g(i),isEmulated:!1};L(e,n),i.target===e.element&&A(e,{id:i.pointerId,type:g(i)},!0);n.stopPropagation&&t.stopEvent(i)}(r,e)},lostpointercapture:function(e){!function(e,i){var n={originalEvent:i,eventType:"lostpointercapture",pointerType:g(i),isEmulated:!1};L(e,n),i.target===e.element&&A(e,{id:i.pointerId,type:g(i)},!1);n.stopPropagation&&t.stopEvent(i)}(r,e)},pointerenter:function(t){S(r,t)},pointerleave:function(t){E(r,t)},pointerover:function(t){C(r,t)},pointerout:function(t){_(r,t)},pointerdown:function(t){O(r,t)},pointerup:function(t){R(r,t)},pointermove:function(t){k(r,t)},pointercancel:function(e){!function(e,i){var n={id:i.pointerId,type:g(i)},o={originalEvent:i,eventType:"pointercancel",pointerType:n.type,isEmulated:!1};L(e,o),W(e,o,n),o.stopPropagation&&t.stopEvent(i)}(r,e)},pointerupcaptured:function(e){!function(e,i){var n=e.getActivePointersListByType(g(i));n.getById(i.pointerId)&&I(e,i);t.stopEvent(i)}(r,e)},pointermovecaptured:function(e){!function(e,i){var n=e.getActivePointersListByType(g(i));n.getById(i.pointerId)&&D(e,i);t.stopEvent(i)}(r,e)},tracking:!1,activePointersLists:[],lastClickPos:null,dblClickTimeOut:null,pinchGPoints:[],lastPinchDist:0,currentPinchDist:0,lastPinchCenter:null,currentPinchCenter:null,sentDragEvent:!1},this.hasGestureHandlers=!!(this.pressHandler||this.nonPrimaryPressHandler||this.releaseHandler||this.nonPrimaryReleaseHandler||this.clickHandler||this.dblClickHandler||this.dragHandler||this.dragEndHandler||this.pinchHandler),this.hasScrollHandler=!!this.scrollHandler,t.MouseTracker.havePointerEvents&&t.setElementPointerEvents(this.element,"auto"),this.exitHandler&&t.console.error("MouseTracker.exitHandler is deprecated. Use MouseTracker.leaveHandler instead."),n.startDisabled||this.setTracking(!0)},t.MouseTracker.prototype={destroy:function(){var t;for(p(this),this.element=null,t=0;t<e.length;t++)if(e[t]===this){e.splice(t,1);break}i[this.hash]=null,delete i[this.hash]},isTracking:function(){return i[this.hash].tracking},setTracking:function(e){return e?function(e){var n,o,r=i[e.hash];if(!r.tracking){for(o=0;o<t.MouseTracker.subscribeEvents.length;o++)n=t.MouseTracker.subscribeEvents[o],t.addEvent(e.element,n,r[n],n===t.MouseTracker.wheelEventName&&{passive:!1,capture:!1});h(e),r.tracking=!0}}(this):p(this),this},getActivePointersListByType:function(e){var n,o,r=i[this.hash],s=r.activePointersLists.length;for(n=0;n<s;n++)if(r.activePointersLists[n].type===e)return r.activePointersLists[n];return o=new t.MouseTracker.GesturePointList(e),r.activePointersLists.push(o),o},getActivePointerCount:function(){var t,e=i[this.hash],n=e.activePointersLists.length,o=0;for(t=0;t<n;t++)o+=e.activePointersLists[t].getLength();return o},preProcessEventHandler:function(){},contextMenuHandler:function(){},enterHandler:function(){},leaveHandler:function(){},exitHandler:function(){},overHandler:function(){},outHandler:function(){},pressHandler:function(){},nonPrimaryPressHandler:function(){},releaseHandler:function(){},nonPrimaryReleaseHandler:function(){},moveHandler:function(){},scrollHandler:function(){},clickHandler:function(){},dblClickHandler:function(){},dragHandler:function(){},dragEndHandler:function(){},pinchHandler:function(){},stopHandler:function(){},keyDownHandler:function(){},keyUpHandler:function(){},keyHandler:function(){},focusHandler:function(){},blurHandler:function(){}};var n,o,r,s,a,l,c=function(){try{return window.self!==window.top}catch(t){return!0}}();function u(t){try{return t.addEventListener&&t.removeEventListener}catch(e){return!1}}function h(t){var e,n,o,r,s,a=i[t.hash],l=a.activePointersLists.length;for(e=0;e<l;e++)if((o=a.activePointersLists[e]).getLength()>0){for(s=[],r=o.asArray(),n=0;n<r.length;n++)s.push(r[n]);for(n=0;n<s.length;n++)j(t,o,s[n])}for(e=0;e<l;e++)a.activePointersLists.pop();a.sentDragEvent=!1}function p(e){var n,o,r=i[e.hash];if(r.tracking){for(o=0;o<t.MouseTracker.subscribeEvents.length;o++)n=t.MouseTracker.subscribeEvents[o],t.removeEvent(e.element,n,r[n],!1);h(e),r.tracking=!1}}function d(t,e){var n=i[t.hash];if("pointerevent"===e)return{upName:"pointerup",upHandler:n.pointerupcaptured,moveName:"pointermove",moveHandler:n.pointermovecaptured};if("mouse"===e)return{upName:"pointerup",upHandler:n.pointerupcaptured,moveName:"pointermove",moveHandler:n.pointermovecaptured};if("touch"===e)return{upName:"touchend",upHandler:n.touchendcaptured,moveName:"touchmove",moveHandler:n.touchmovecaptured};throw new Error("MouseTracker.getCaptureEventParams: Unknown pointer type.")}function f(e,i){var n,o;if(t.MouseTracker.havePointerCapture)if(t.MouseTracker.havePointerEvents){if(!(o=e.getActivePointersListByType(i.type).getById(i.id))||!o.captured)return;try{e.element.releasePointerCapture(i.id)}catch(r){}}else e.element.releaseCapture();else n=d(e,t.MouseTracker.havePointerEvents?"pointerevent":i.type),c&&u(window.top)&&t.removeEvent(window.top,n.upName,n.upHandler,!0),t.removeEvent(t.MouseTracker.captureElement,n.moveName,n.moveHandler,!0),t.removeEvent(t.MouseTracker.captureElement,n.upName,n.upHandler,!0);A(e,i,!1)}function v(e){return t.MouseTracker.havePointerEvents?e.pointerId:t.MouseTracker.mousePointerId}function g(e){return t.MouseTracker.havePointerEvents?e.pointerType||(t.Browser.vendor===t.BROWSERS.IE?"mouse":""):"mouse"}function m(e){return!t.MouseTracker.havePointerEvents||e.isPrimary}function y(e){return t.getMousePosition(e)}function w(t,e){return x(y(t),e)}function x(e,i){var n=t.getElementOffset(i);return e.minus(n)}function b(e,i){return new t.Point((e.x+i.x)/2,(e.y+i.y)/2)}function T(e,i){var n={target:i.target||i.srcElement,type:"wheel",shiftKey:i.shiftKey||!1,clientX:i.clientX,clientY:i.clientY,pageX:i.pageX?i.pageX:i.clientX,pageY:i.pageY?i.pageY:i.clientY,deltaMode:"MozMousePixelScroll"===i.type?0:1,deltaX:0,deltaZ:0};"mousewheel"===t.MouseTracker.wheelEventName?n.deltaY=-i.wheelDelta/t.DEFAULT_SETTINGS.pixelsPerWheelLine:n.deltaY=i.detail,P(e,n,i)}function P(e,i,n){var o,r,s=null;o=i.deltaY<0?1:-1,L(e,r={originalEvent:i,eventType:"wheel",pointerType:"mouse",isEmulated:i!==n}),!e.scrollHandler||r.preventGesture||r.defaultPrevented||(s={eventSource:e,pointerType:"mouse",position:w(i,e.element),scroll:o,shift:i.shiftKey,isTouchEvent:!1,originalEvent:n,preventDefault:r.preventDefault||r.defaultPrevented,userData:e.userData},e.scrollHandler(s)),r.stopPropagation&&t.stopEvent(n),(s&&s.preventDefault||r.preventDefault&&!r.defaultPrevented)&&t.cancelEvent(n)}function S(e,i){var n={id:v(i),type:g(i),isPrimary:m(i),currentPos:y(i),currentTime:t.now()},o={originalEvent:i,eventType:"pointerenter",pointerType:n.type,isEmulated:!1};L(e,o),B(e,o,n)}function E(e,i){var n={id:v(i),type:g(i),isPrimary:m(i),currentPos:y(i),currentTime:t.now()},o={originalEvent:i,eventType:"pointerleave",pointerType:n.type,isEmulated:!1};L(e,o),N(e,o,n)}function C(e,i){var n={id:v(i),type:g(i),isPrimary:m(i),currentPos:y(i),currentTime:t.now()},o={originalEvent:i,eventType:"pointerover",pointerType:n.type,isEmulated:!1};L(e,o),function(t,e,i){var n,o;n=t.getActivePointersListByType(i.type),o=n.getById(i.id),o?i=o:(i.captured=!1,i.insideElementPressed=!1);t.overHandler&&t.overHandler({eventSource:t,pointerType:i.type,position:x(i.currentPos,t.element),buttons:n.buttons,pointers:t.getActivePointerCount(),insideElementPressed:i.insideElementPressed,buttonDownAny:0!==n.buttons,isTouchEvent:"touch"===i.type,originalEvent:e.originalEvent,userData:t.userData})}(e,o,n),o.preventDefault&&!o.defaultPrevented&&t.cancelEvent(i),o.stopPropagation&&t.stopEvent(i)}function _(e,i){var n={id:v(i),type:g(i),isPrimary:m(i),currentPos:y(i),currentTime:t.now()},o={originalEvent:i,eventType:"pointerout",pointerType:n.type,isEmulated:!1};L(e,o),function(t,e,i){var n,o;n=t.getActivePointersListByType(i.type),o=n.getById(i.id),o?i=o:(i.captured=!1,i.insideElementPressed=!1);t.outHandler&&t.outHandler({eventSource:t,pointerType:i.type,position:i.currentPos&&x(i.currentPos,t.element),buttons:n.buttons,pointers:t.getActivePointerCount(),insideElementPressed:i.insideElementPressed,buttonDownAny:0!==n.buttons,isTouchEvent:"touch"===i.type,originalEvent:e.originalEvent,userData:t.userData})}(e,o,n),o.preventDefault&&!o.defaultPrevented&&t.cancelEvent(i),o.stopPropagation&&t.stopEvent(i)}function O(e,i){var n={id:v(i),type:g(i),isPrimary:m(i),currentPos:y(i),currentTime:t.now()},o=t.MouseTracker.havePointerEvents&&"touch"===n.type&&t.Browser.vendor!==t.BROWSERS.IE,r={originalEvent:i,eventType:"pointerdown",pointerType:n.type,isEmulated:!1};L(e,r),z(e,r,n,i.button),r.preventDefault&&!r.defaultPrevented&&t.cancelEvent(i),r.stopPropagation&&t.stopEvent(i),r.shouldCapture&&(o?A(e,n,!0):function(e,i){var n;if(t.MouseTracker.havePointerCapture)if(t.MouseTracker.havePointerEvents)try{e.element.setPointerCapture(i.id)}catch(o){return void t.console.warn("setPointerCapture() called on invalid pointer ID")}else e.element.setCapture(!0);else n=d(e,t.MouseTracker.havePointerEvents?"pointerevent":i.type),c&&u(window.top)&&t.addEvent(window.top,n.upName,n.upHandler,!0),t.addEvent(t.MouseTracker.captureElement,n.upName,n.upHandler,!0),t.addEvent(t.MouseTracker.captureElement,n.moveName,n.moveHandler,!0);A(e,i,!0)}(e,n))}function R(t,e){I(t,e)}function I(e,i){var n,o={originalEvent:i,eventType:"pointerup",pointerType:(n={id:v(i),type:g(i),isPrimary:m(i),currentPos:y(i),currentTime:t.now()}).type,isEmulated:!1};L(e,o),H(e,o,n,i.button),o.preventDefault&&!o.defaultPrevented&&t.cancelEvent(i),o.stopPropagation&&t.stopEvent(i),o.shouldReleaseCapture&&(i.target===e.element?f(e,n):A(e,n,!1))}function k(t,e){D(t,e)}function D(e,i){var n={id:v(i),type:g(i),isPrimary:m(i),currentPos:y(i),currentTime:t.now()},o={originalEvent:i,eventType:"pointermove",pointerType:n.type,isEmulated:!1};L(e,o),F(e,o,n),o.preventDefault&&!o.defaultPrevented&&t.cancelEvent(i),o.stopPropagation&&t.stopEvent(i)}function M(t,e){return e.speed=0,e.direction=0,e.contactPos=e.currentPos,e.contactTime=e.currentTime,e.lastPos=e.currentPos,e.lastTime=e.currentTime,t.add(e)}function j(e,i,n){var o,r=i.getById(n.id);return r?(r.captured&&(t.console.warn("stopTrackingPointer() called on captured pointer"),f(e,r)),i.removeContact(),o=i.removeById(n.id)):o=i.getLength(),o}function L(e,i){i.eventSource=e,i.eventPhase=i.originalEvent&&void 0!==i.originalEvent.eventPhase?i.originalEvent.eventPhase:0,i.defaultPrevented=t.eventIsCanceled(i.originalEvent),i.shouldCapture=!1,i.shouldReleaseCapture=!1,i.userData=e.userData,function(t,e){switch(e.eventType){case"pointermove":case"pointerdown":case"pointerup":e.isStoppable=!0,e.isCancelable=!0,e.preventDefault=!1,e.preventGesture=!t.hasGestureHandlers,e.stopPropagation=!1;break;case"pointerover":case"pointerout":case"contextmenu":case"keydown":case"keyup":case"keypress":e.isStoppable=!0,e.isCancelable=!0,e.preventDefault=!1,e.preventGesture=!1,e.stopPropagation=!1;break;case"wheel":e.isStoppable=!0,e.isCancelable=!0,e.preventDefault=!1,e.preventGesture=!t.hasScrollHandler,e.stopPropagation=!1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":e.isStoppable=!0,e.isCancelable=!1,e.preventDefault=!1,e.preventGesture=!1,e.stopPropagation=!1;break;case"click":e.isStoppable=!0,e.isCancelable=!0,e.preventDefault=!!t.clickHandler,e.preventGesture=!1,e.stopPropagation=!1;break;case"dblclick":e.isStoppable=!0,e.isCancelable=!0,e.preventDefault=!!t.dblClickHandler,e.preventGesture=!1,e.stopPropagation=!1;break;default:e.isStoppable=!1,e.isCancelable=!1,e.preventDefault=!1,e.preventGesture=!1,e.stopPropagation=!1}}(e,i),e.preProcessEventHandler&&e.preProcessEventHandler(i)}function A(e,i,n){var o=e.getActivePointersListByType(i.type),r=o.getById(i.id);r?n&&!r.captured?(r.captured=!0,o.captureCount++):!n&&r.captured&&(r.captured=!1,o.captureCount--,o.captureCount<0&&(o.captureCount=0,t.console.warn("updatePointerCaptured() - pointsList.captureCount went negative"))):t.console.warn("updatePointerCaptured() called on untracked pointer")}function B(t,e,i){var n,o=t.getActivePointersListByType(i.type);(n=o.getById(i.id))?(n.insideElement=!0,n.lastPos=n.currentPos,n.lastTime=n.currentTime,n.currentPos=i.currentPos,n.currentTime=i.currentTime,i=n):(i.captured=!1,i.insideElementPressed=!1,i.insideElement=!0,M(o,i)),t.enterHandler&&t.enterHandler({eventSource:t,pointerType:i.type,position:x(i.currentPos,t.element),buttons:o.buttons,pointers:t.getActivePointerCount(),insideElementPressed:i.insideElementPressed,buttonDownAny:0!==o.buttons,isTouchEvent:"touch"===i.type,originalEvent:e.originalEvent,userData:t.userData})}function N(t,e,i){var n,o,r=t.getActivePointersListByType(i.type);(n=r.getById(i.id))?(n.captured?(n.insideElement=!1,n.lastPos=n.currentPos,n.lastTime=n.currentTime,n.currentPos=i.currentPos,n.currentTime=i.currentTime):j(t,r,n),i=n):(i.captured=!1,i.insideElementPressed=!1),(t.leaveHandler||t.exitHandler)&&(o={eventSource:t,pointerType:i.type,position:i.currentPos&&x(i.currentPos,t.element),buttons:r.buttons,pointers:t.getActivePointerCount(),insideElementPressed:i.insideElementPressed,buttonDownAny:0!==r.buttons,isTouchEvent:"touch"===i.type,originalEvent:e.originalEvent,userData:t.userData},t.leaveHandler&&t.leaveHandler(o),t.exitHandler&&t.exitHandler(o))}function z(e,n,o,r){var s,a=i[e.hash],l=e.getActivePointersListByType(o.type);if(void 0!==n.originalEvent.buttons?l.buttons=n.originalEvent.buttons:0===r?l.buttons|=1:1===r?l.buttons|=4:2===r?l.buttons|=2:3===r?l.buttons|=8:4===r?l.buttons|=16:5===r&&(l.buttons|=32),0!==r)return n.shouldCapture=!1,n.shouldReleaseCapture=!1,void(!e.nonPrimaryPressHandler||n.preventGesture||n.defaultPrevented||(n.preventDefault=!0,e.nonPrimaryPressHandler({eventSource:e,pointerType:o.type,position:x(o.currentPos,e.element),button:r,buttons:l.buttons,isTouchEvent:"touch"===o.type,originalEvent:n.originalEvent,userData:e.userData})));(s=l.getById(o.id))?(s.insideElementPressed=!0,s.insideElement=!0,s.originalTarget=n.originalEvent.target,s.contactPos=o.currentPos,s.contactTime=o.currentTime,s.lastPos=s.currentPos,s.lastTime=s.currentTime,s.currentPos=o.currentPos,s.currentTime=o.currentTime,o=s):(o.captured=!1,o.insideElementPressed=!0,o.insideElement=!0,o.originalTarget=n.originalEvent.target,M(l,o)),l.addContact(),n.preventGesture||n.defaultPrevented?(n.shouldCapture=!1,n.shouldReleaseCapture=!1):(n.shouldCapture=!0,n.shouldReleaseCapture=!1,n.preventDefault=!0,(e.dragHandler||e.dragEndHandler||e.pinchHandler)&&t.MouseTracker.gesturePointVelocityTracker.addPoint(e,o),1===l.contacts?e.pressHandler&&!n.preventGesture&&e.pressHandler({eventSource:e,pointerType:o.type,position:x(o.contactPos,e.element),buttons:l.buttons,isTouchEvent:"touch"===o.type,originalEvent:n.originalEvent,userData:e.userData}):2===l.contacts&&e.pinchHandler&&"touch"===o.type&&(a.pinchGPoints=l.asArray(),a.lastPinchDist=a.currentPinchDist=a.pinchGPoints[0].currentPos.distanceTo(a.pinchGPoints[1].currentPos),a.lastPinchCenter=a.currentPinchCenter=b(a.pinchGPoints[0].currentPos,a.pinchGPoints[1].currentPos)))}function H(e,n,o,r){var s,a,l,c,u=i[e.hash],h=e.getActivePointersListByType(o.type),p=!1;if(void 0!==n.originalEvent.buttons?h.buttons=n.originalEvent.buttons:0===r?h.buttons^=-2:1===r?h.buttons^=-5:2===r?h.buttons^=-3:3===r?h.buttons^=-9:4===r?h.buttons^=-17:5===r&&(h.buttons^=-33),n.shouldCapture=!1,0!==r)return n.shouldReleaseCapture=!1,void(!e.nonPrimaryReleaseHandler||n.preventGesture||n.defaultPrevented||(n.preventDefault=!0,e.nonPrimaryReleaseHandler({eventSource:e,pointerType:o.type,position:x(o.currentPos,e.element),button:r,buttons:h.buttons,isTouchEvent:"touch"===o.type,originalEvent:n.originalEvent,userData:e.userData})));(l=h.getById(o.id))?(h.removeContact(),l.captured&&(p=!0),l.lastPos=l.currentPos,l.lastTime=l.currentTime,l.currentPos=o.currentPos,l.currentTime=o.currentTime,l.insideElement||j(e,h,l),s=l.currentPos,a=l.currentTime):(o.captured=!1,o.insideElementPressed=!1,o.insideElement=!0,M(h,o),l=o),n.preventGesture||n.defaultPrevented||(p?(n.shouldReleaseCapture=!0,n.preventDefault=!0,(e.dragHandler||e.dragEndHandler||e.pinchHandler)&&t.MouseTracker.gesturePointVelocityTracker.removePoint(e,l),0===h.contacts?(e.releaseHandler&&s&&e.releaseHandler({eventSource:e,pointerType:l.type,position:x(s,e.element),buttons:h.buttons,insideElementPressed:l.insideElementPressed,insideElementReleased:l.insideElement,isTouchEvent:"touch"===l.type,originalEvent:n.originalEvent,userData:e.userData}),e.dragEndHandler&&u.sentDragEvent&&e.dragEndHandler({eventSource:e,pointerType:l.type,position:x(l.currentPos,e.element),speed:l.speed,direction:l.direction,shift:n.originalEvent.shiftKey,isTouchEvent:"touch"===l.type,originalEvent:n.originalEvent,userData:e.userData}),u.sentDragEvent=!1,(e.clickHandler||e.dblClickHandler)&&l.insideElement&&(c=a-l.contactTime<=e.clickTimeThreshold&&l.contactPos.distanceTo(s)<=e.clickDistThreshold,e.clickHandler&&e.clickHandler({eventSource:e,pointerType:l.type,position:x(l.currentPos,e.element),quick:c,shift:n.originalEvent.shiftKey,isTouchEvent:"touch"===l.type,originalEvent:n.originalEvent,originalTarget:l.originalTarget,userData:e.userData}),e.dblClickHandler&&c&&(h.clicks++,1===h.clicks?(u.lastClickPos=s,u.dblClickTimeOut=setTimeout(function(){h.clicks=0},e.dblClickTimeThreshold)):2===h.clicks&&(clearTimeout(u.dblClickTimeOut),h.clicks=0,u.lastClickPos.distanceTo(s)<=e.dblClickDistThreshold&&e.dblClickHandler({eventSource:e,pointerType:l.type,position:x(l.currentPos,e.element),shift:n.originalEvent.shiftKey,isTouchEvent:"touch"===l.type,originalEvent:n.originalEvent,userData:e.userData}),u.lastClickPos=null)))):2===h.contacts&&e.pinchHandler&&"touch"===l.type&&(u.pinchGPoints=h.asArray(),u.lastPinchDist=u.currentPinchDist=u.pinchGPoints[0].currentPos.distanceTo(u.pinchGPoints[1].currentPos),u.lastPinchCenter=u.currentPinchCenter=b(u.pinchGPoints[0].currentPos,u.pinchGPoints[1].currentPos))):(n.shouldReleaseCapture=!1,e.releaseHandler&&s&&(e.releaseHandler({eventSource:e,pointerType:l.type,position:x(s,e.element),buttons:h.buttons,insideElementPressed:l.insideElementPressed,insideElementReleased:l.insideElement,isTouchEvent:"touch"===l.type,originalEvent:n.originalEvent,userData:e.userData}),n.preventDefault=!0)))}function F(t,e,n){var o,r,s,a=i[t.hash],l=t.getActivePointersListByType(n.type);void 0!==e.originalEvent.buttons&&(l.buttons=e.originalEvent.buttons),(o=l.getById(n.id))&&(o.lastPos=o.currentPos,o.lastTime=o.currentTime,o.currentPos=n.currentPos,o.currentTime=n.currentTime,e.shouldCapture=!1,e.shouldReleaseCapture=!1,t.stopHandler&&"mouse"===n.type&&(clearTimeout(t.stopTimeOut),t.stopTimeOut=setTimeout(function(){!function(t,e,i){t.stopHandler&&t.stopHandler({eventSource:t,pointerType:i,position:w(e,t.element),buttons:t.getActivePointersListByType(i).buttons,isTouchEvent:"touch"===i,originalEvent:e,userData:t.userData})}(t,e.originalEvent,n.type)},t.stopDelay)),0===l.contacts?t.moveHandler&&t.moveHandler({eventSource:t,pointerType:n.type,position:x(n.currentPos,t.element),buttons:l.buttons,isTouchEvent:"touch"===n.type,originalEvent:e.originalEvent,userData:t.userData}):1===l.contacts?(t.moveHandler&&(o=l.asArray()[0],t.moveHandler({eventSource:t,pointerType:o.type,position:x(o.currentPos,t.element),buttons:l.buttons,isTouchEvent:"touch"===o.type,originalEvent:e.originalEvent,userData:t.userData})),!t.dragHandler||e.preventGesture||e.defaultPrevented||(s=(o=l.asArray()[0]).currentPos.minus(o.lastPos),t.dragHandler({eventSource:t,pointerType:o.type,position:x(o.currentPos,t.element),buttons:l.buttons,delta:s,speed:o.speed,direction:o.direction,shift:e.originalEvent.shiftKey,isTouchEvent:"touch"===o.type,originalEvent:e.originalEvent,userData:t.userData}),e.preventDefault=!0,a.sentDragEvent=!0)):2===l.contacts&&(t.moveHandler&&(r=l.asArray(),t.moveHandler({eventSource:t,pointerType:r[0].type,position:x(b(r[0].currentPos,r[1].currentPos),t.element),buttons:l.buttons,isTouchEvent:"touch"===r[0].type,originalEvent:e.originalEvent,userData:t.userData})),!t.pinchHandler||"touch"!==n.type||e.preventGesture||e.defaultPrevented||(s=a.pinchGPoints[0].currentPos.distanceTo(a.pinchGPoints[1].currentPos))!==a.currentPinchDist&&(a.lastPinchDist=a.currentPinchDist,a.currentPinchDist=s,a.lastPinchCenter=a.currentPinchCenter,a.currentPinchCenter=b(a.pinchGPoints[0].currentPos,a.pinchGPoints[1].currentPos),t.pinchHandler({eventSource:t,pointerType:"touch",gesturePoints:a.pinchGPoints,lastCenter:x(a.lastPinchCenter,t.element),center:x(a.currentPinchCenter,t.element),lastDistance:a.lastPinchDist,distance:a.currentPinchDist,shift:e.originalEvent.shiftKey,originalEvent:e.originalEvent,userData:t.userData}),e.preventDefault=!0)))}function W(t,e,i){var n,o=t.getActivePointersListByType(i.type);(n=o.getById(i.id))&&j(t,o,n)}t.MouseTracker.gesturePointVelocityTracker=(n=[],o=0,r=0,s=function(t,e){return t.hash.toString()+e.type+e.id.toString()},a=function(){var e,i,o,s,a,l,c=n.length,u=t.now();for(s=u-r,r=u,e=0;e<c;e++)(o=(i=n[e]).gPoint).direction=Math.atan2(o.currentPos.y-i.lastPos.y,o.currentPos.x-i.lastPos.x),a=i.lastPos.distanceTo(o.currentPos),i.lastPos=o.currentPos,l=1e3*a/(s+1),o.speed=.75*l+.25*o.speed},{addPoint:function(e,i){var l=s(e,i);n.push({guid:l,gPoint:i,lastPos:i.currentPos}),1===n.length&&(r=t.now(),o=window.setInterval(a,50))},removePoint:function(t,e){var i,r=s(t,e),a=n.length;for(i=0;i<a;i++)if(n[i].guid===r){n.splice(i,1),0===--a&&window.clearInterval(o);break}}}),t.MouseTracker.captureElement=document,t.MouseTracker.wheelEventName=t.Browser.vendor===t.BROWSERS.IE&&t.Browser.version>8||"onwheel"in document.createElement("div")?"wheel":void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll",t.MouseTracker.subscribeEvents=["click","dblclick","keydown","keyup","keypress","focus","blur","contextmenu",t.MouseTracker.wheelEventName],"DOMMouseScroll"===t.MouseTracker.wheelEventName&&t.MouseTracker.subscribeEvents.push("MozMousePixelScroll"),window.PointerEvent?(t.MouseTracker.havePointerEvents=!0,t.MouseTracker.subscribeEvents.push("pointerenter","pointerleave","pointerover","pointerout","pointerdown","pointerup","pointermove","pointercancel"),t.MouseTracker.havePointerCapture=(l=document.createElement("div"),t.isFunction(l.setPointerCapture)&&t.isFunction(l.releasePointerCapture)),t.MouseTracker.havePointerCapture&&t.MouseTracker.subscribeEvents.push("gotpointercapture","lostpointercapture")):(t.MouseTracker.havePointerEvents=!1,t.MouseTracker.subscribeEvents.push("mouseenter","mouseleave","mouseover","mouseout","mousedown","mouseup","mousemove"),t.MouseTracker.mousePointerId="legacy-mouse",t.MouseTracker.havePointerCapture=function(){var e=document.createElement("div");return t.isFunction(e.setCapture)&&t.isFunction(e.releaseCapture)}(),t.MouseTracker.havePointerCapture&&t.MouseTracker.subscribeEvents.push("losecapture"),"ontouchstart"in window&&t.MouseTracker.subscribeEvents.push("touchstart","touchend","touchmove","touchcancel"),"ongesturestart"in window&&t.MouseTracker.subscribeEvents.push("gesturestart","gesturechange")),t.MouseTracker.GesturePointList=function(t){this._gPoints=[],this.type=t,this.buttons=0,this.contacts=0,this.clicks=0,this.captureCount=0},t.MouseTracker.GesturePointList.prototype={getLength:function(){return this._gPoints.length},asArray:function(){return this._gPoints},add:function(t){return this._gPoints.push(t)},removeById:function(t){var e,i=this._gPoints.length;for(e=0;e<i;e++)if(this._gPoints[e].id===t){this._gPoints.splice(e,1);break}return this._gPoints.length},getByIndex:function(t){return t<this._gPoints.length?this._gPoints[t]:null},getById:function(t){var e,i=this._gPoints.length;for(e=0;e<i;e++)if(this._gPoints[e].id===t)return this._gPoints[e];return null},getPrimary:function(t){var e,i=this._gPoints.length;for(e=0;e<i;e++)if(this._gPoints[e].isPrimary)return this._gPoints[e];return null},addContact:function(){++this.contacts,this.contacts>1&&("mouse"===this.type||"pen"===this.type)&&(t.console.warn("GesturePointList.addContact() Implausible contacts value"),this.contacts=1)},removeContact:function(){--this.contacts,this.contacts<0&&(this.contacts=0)}}}(a),function(t){t.ControlAnchor={NONE:0,TOP_LEFT:1,TOP_RIGHT:2,BOTTOM_RIGHT:3,BOTTOM_LEFT:4,ABSOLUTE:5},t.Control=function(e,i,n){var o=e.parentNode;"number"==typeof i&&(t.console.error("Passing an anchor directly into the OpenSeadragon.Control constructor is deprecated; please use an options object instead. Support for this deprecated variant is scheduled for removal in December 2013"),i={anchor:i}),i.attachToViewer=void 0===i.attachToViewer||i.attachToViewer,this.autoFade=void 0===i.autoFade||i.autoFade,this.element=e,this.anchor=i.anchor,this.container=n,this.anchor===t.ControlAnchor.ABSOLUTE?(this.wrapper=t.makeNeutralElement("div"),this.wrapper.style.position="absolute",this.wrapper.style.top="number"==typeof i.top?i.top+"px":i.top,this.wrapper.style.left="number"==typeof i.left?i.left+"px":i.left,this.wrapper.style.height="number"==typeof i.height?i.height+"px":i.height,this.wrapper.style.width="number"==typeof i.width?i.width+"px":i.width,this.wrapper.style.margin="0px",this.wrapper.style.padding="0px",this.element.style.position="relative",this.element.style.top="0px",this.element.style.left="0px",this.element.style.height="100%",this.element.style.width="100%"):(this.wrapper=t.makeNeutralElement("div"),this.wrapper.style.display="inline-block",this.anchor===t.ControlAnchor.NONE&&(this.wrapper.style.width=this.wrapper.style.height="100%")),this.wrapper.appendChild(this.element),i.attachToViewer?this.anchor===t.ControlAnchor.TOP_RIGHT||this.anchor===t.ControlAnchor.BOTTOM_RIGHT?this.container.insertBefore(this.wrapper,this.container.firstChild):this.container.appendChild(this.wrapper):o.appendChild(this.wrapper)},t.Control.prototype={destroy:function(){this.wrapper.removeChild(this.element),this.anchor!==t.ControlAnchor.NONE&&this.container.removeChild(this.wrapper)},isVisible:function(){return"none"!==this.wrapper.style.display},setVisible:function(e){this.wrapper.style.display=e?this.anchor===t.ControlAnchor.ABSOLUTE?"block":"inline-block":"none"},setOpacity:function(e){this.element[t.SIGNAL]&&t.Browser.vendor===t.BROWSERS.IE?t.setElementOpacity(this.element,e,!0):t.setElementOpacity(this.wrapper,e,!0)}}}(a),function(t){function e(t,e){var i,n=t.controls;for(i=n.length-1;i>=0;i--)if(n[i].element===e)return i;return-1}t.ControlDock=function(e){var i,n,o=["topleft","topright","bottomright","bottomleft"];for(t.extend(!0,this,{id:"controldock-"+t.now()+"-"+Math.floor(1e6*Math.random()),container:t.makeNeutralElement("div"),controls:[]},e),this.container.onsubmit=function(){return!1},this.element&&(this.element=t.getElement(this.element),this.element.appendChild(this.container),this.element.style.position="relative",this.container.style.width="100%",this.container.style.height="100%"),n=0;n<o.length;n++)i=o[n],this.controls[i]=t.makeNeutralElement("div"),this.controls[i].style.position="absolute",i.match("left")&&(this.controls[i].style.left="0px"),i.match("right")&&(this.controls[i].style.right="0px"),i.match("top")&&(this.controls[i].style.top="0px"),i.match("bottom")&&(this.controls[i].style.bottom="0px");this.container.appendChild(this.controls.topleft),this.container.appendChild(this.controls.topright),this.container.appendChild(this.controls.bottomright),this.container.appendChild(this.controls.bottomleft)},t.ControlDock.prototype={addControl:function(i,n){var o=null;if(!(e(this,i=t.getElement(i))>=0)){switch(n.anchor){case t.ControlAnchor.TOP_RIGHT:o=this.controls.topright,i.style.position="relative",i.style.paddingRight="0px",i.style.paddingTop="0px";break;case t.ControlAnchor.BOTTOM_RIGHT:o=this.controls.bottomright,i.style.position="relative",i.style.paddingRight="0px",i.style.paddingBottom="0px";break;case t.ControlAnchor.BOTTOM_LEFT:o=this.controls.bottomleft,i.style.position="relative",i.style.paddingLeft="0px",i.style.paddingBottom="0px";break;case t.ControlAnchor.TOP_LEFT:o=this.controls.topleft,i.style.position="relative",i.style.paddingLeft="0px",i.style.paddingTop="0px";break;case t.ControlAnchor.ABSOLUTE:default:case t.ControlAnchor.NONE:o=this.container,i.style.margin="0px",i.style.padding="0px"}this.controls.push(new t.Control(i,n,o)),i.style.display="inline-block"}},removeControl:function(i){var n=e(this,i=t.getElement(i));return n>=0&&(this.controls[n].destroy(),this.controls.splice(n,1)),this},clearControls:function(){for(;this.controls.length>0;)this.controls.pop().destroy();return this},areControlsEnabled:function(){var t;for(t=this.controls.length-1;t>=0;t--)if(this.controls[t].isVisible())return!0;return!1},setControlsEnabled:function(t){var e;for(e=this.controls.length-1;e>=0;e--)this.controls[e].setVisible(t);return this}}}(a),function(t){t.Placement=t.freezeObject({CENTER:0,TOP_LEFT:1,TOP:2,TOP_RIGHT:3,RIGHT:4,BOTTOM_RIGHT:5,BOTTOM:6,BOTTOM_LEFT:7,LEFT:8,properties:{0:{isLeft:!1,isHorizontallyCentered:!0,isRight:!1,isTop:!1,isVerticallyCentered:!0,isBottom:!1},1:{isLeft:!0,isHorizontallyCentered:!1,isRight:!1,isTop:!0,isVerticallyCentered:!1,isBottom:!1},2:{isLeft:!1,isHorizontallyCentered:!0,isRight:!1,isTop:!0,isVerticallyCentered:!1,isBottom:!1},3:{isLeft:!1,isHorizontallyCentered:!1,isRight:!0,isTop:!0,isVerticallyCentered:!1,isBottom:!1},4:{isLeft:!1,isHorizontallyCentered:!1,isRight:!0,isTop:!1,isVerticallyCentered:!0,isBottom:!1},5:{isLeft:!1,isHorizontallyCentered:!1,isRight:!0,isTop:!1,isVerticallyCentered:!1,isBottom:!0},6:{isLeft:!1,isHorizontallyCentered:!0,isRight:!1,isTop:!1,isVerticallyCentered:!1,isBottom:!0},7:{isLeft:!0,isHorizontallyCentered:!1,isRight:!1,isTop:!1,isVerticallyCentered:!1,isBottom:!0},8:{isLeft:!0,isHorizontallyCentered:!1,isRight:!1,isTop:!1,isVerticallyCentered:!0,isBottom:!1}}})}(a),function(t){var e={},i=1;function n(e){return e=t.getElement(e),new t.Point(0===e.clientWidth?1:e.clientWidth,0===e.clientHeight?1:e.clientHeight)}function o(e,i){if(i instanceof t.Overlay)return i;var n=null;if(i.element)n=t.getElement(i.element);else{var o=i.id?i.id:"openseadragon-overlay-"+Math.floor(1e7*Math.random());(n=t.getElement(i.id))||((n=document.createElement("a")).href="#/overlay/"+o),n.id=o,t.addClass(n,i.className?i.className:"openseadragon-overlay")}var r=i.location,s=i.width,a=i.height;if(!r){var l=i.x,c=i.y;if(void 0!==i.px){var u=e.viewport.imageToViewportRectangle(new t.Rect(i.px,i.py,s||0,a||0));l=u.x,c=u.y,s=void 0!==s?u.width:void 0,a=void 0!==a?u.height:void 0}r=new t.Point(l,c)}var h=i.placement;return h&&"string"===t.type(h)&&(h=t.Placement[i.placement.toUpperCase()]),new t.Overlay({element:n,location:r,placement:h,onDraw:i.onDraw,checkResize:i.checkResize,width:s,height:a,rotationMode:i.rotationMode})}function r(t,e){var i;for(i=t.length-1;i>=0;i--)if(t[i].element===e)return i;return-1}function s(e,i){return t.requestAnimationFrame(function(){i(e)})}function a(e){t.requestAnimationFrame(function(){!function(e){var i,n;if(e.controlsShouldFade){for(i=1-(t.now()-e.controlsFadeBeginTime)/e.controlsFadeLength,i=Math.min(1,i),i=Math.max(0,i),n=e.controls.length-1;n>=0;n--)e.controls[n].autoFade&&e.controls[n].setOpacity(i);i>0&&a(e)}}(e)})}function l(e){e.autoHideControls&&(e.controlsShouldFade=!0,e.controlsFadeBeginTime=t.now()+e.controlsFadeDelay,window.setTimeout(function(){a(e)},e.controlsFadeDelay))}function c(t){var e;for(t.controlsShouldFade=!1,e=t.controls.length-1;e>=0;e--)t.controls[e].setOpacity(1)}function u(){c(this)}function h(){l(this)}function p(t){var e={tracker:t.eventSource,position:t.position,originalEvent:t.originalEvent,preventDefault:t.preventDefault};this.raiseEvent("canvas-contextmenu",e),t.preventDefault=e.preventDefault}function d(e){var i={originalEvent:e.originalEvent,preventDefaultAction:!1,preventVerticalPan:e.preventVerticalPan||!this.panVertical,preventHorizontalPan:e.preventHorizontalPan||!this.panHorizontal};if(this.raiseEvent("canvas-key",i),i.preventDefaultAction||e.ctrl||e.alt||e.meta)e.preventDefault=!1;else switch(e.keyCode){case 38:i.preventVerticalPan||(e.shift?this.viewport.zoomBy(1.1):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new t.Point(0,-this.pixelsPerArrowPress))),this.viewport.applyConstraints()),e.preventDefault=!0;break;case 40:i.preventVerticalPan||(e.shift?this.viewport.zoomBy(.9):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new t.Point(0,this.pixelsPerArrowPress))),this.viewport.applyConstraints()),e.preventDefault=!0;break;case 37:i.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new t.Point(-this.pixelsPerArrowPress,0))),this.viewport.applyConstraints()),e.preventDefault=!0;break;case 39:i.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new t.Point(this.pixelsPerArrowPress,0))),this.viewport.applyConstraints()),e.preventDefault=!0;break;case 69:case 187:this.viewport.zoomBy(1.1),this.viewport.applyConstraints(),e.preventDefault=!0;break;case 81:case 189:this.viewport.zoomBy(.9),this.viewport.applyConstraints(),e.preventDefault=!0;break;case 48:this.viewport.goHome(),this.viewport.applyConstraints(),e.preventDefault=!0;break;case 87:i.preventVerticalPan||(e.shift?this.viewport.zoomBy(1.1):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new t.Point(0,-40))),this.viewport.applyConstraints()),e.preventDefault=!0;break;case 83:i.preventVerticalPan||(e.shift?this.viewport.zoomBy(.9):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new t.Point(0,40))),this.viewport.applyConstraints()),e.preventDefault=!0;break;case 65:i.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new t.Point(-40,0))),this.viewport.applyConstraints()),e.preventDefault=!0;break;case 68:i.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new t.Point(40,0))),this.viewport.applyConstraints()),e.preventDefault=!0;break;case 82:e.shift?this.viewport.flipped?this.viewport.setRotation(this.viewport.getRotation()+this.rotationIncrement):this.viewport.setRotation(this.viewport.getRotation()-this.rotationIncrement):this.viewport.flipped?this.viewport.setRotation(this.viewport.getRotation()-this.rotationIncrement):this.viewport.setRotation(this.viewport.getRotation()+this.rotationIncrement),this.viewport.applyConstraints(),e.preventDefault=!0;break;case 70:this.viewport.toggleFlip(),e.preventDefault=!0;break;case 74:this.goToPreviousPage();break;case 75:this.goToNextPage();break;default:e.preventDefault=!1}}function f(t){var e={originalEvent:t.originalEvent};this.raiseEvent("canvas-key-press",e)}function v(i){var n;document.activeElement===this.canvas||this.canvas.focus(),this.viewport.flipped&&(i.position.x=this.viewport.getContainerSize().x-i.position.x);var o={tracker:i.eventSource,position:i.position,quick:i.quick,shift:i.shift,originalEvent:i.originalEvent,originalTarget:i.originalTarget,preventDefaultAction:!1};this.raiseEvent("canvas-click",o),!o.preventDefaultAction&&this.viewport&&i.quick&&(!0===(n=this.gestureSettingsByDeviceType(i.pointerType)).clickToZoom&&(this.viewport.zoomBy(i.shift?1/this.zoomPerClick:this.zoomPerClick,n.zoomToRefPoint?this.viewport.pointFromPixel(i.position,!0):null),this.viewport.applyConstraints()),n.dblClickDragToZoom&&(!0===e[this.hash].draggingToZoom?(e[this.hash].lastClickTime=null,e[this.hash].draggingToZoom=!1):e[this.hash].lastClickTime=t.now()))}function g(t){var e,i={tracker:t.eventSource,position:t.position,shift:t.shift,originalEvent:t.originalEvent,preventDefaultAction:!1};this.raiseEvent("canvas-double-click",i),!i.preventDefaultAction&&this.viewport&&(e=this.gestureSettingsByDeviceType(t.pointerType)).dblClickToZoom&&(this.viewport.zoomBy(t.shift?1/this.zoomPerClick:this.zoomPerClick,e.zoomToRefPoint?this.viewport.pointFromPixel(t.position,!0):null),this.viewport.applyConstraints())}function m(t){var i,n={tracker:t.eventSource,pointerType:t.pointerType,position:t.position,delta:t.delta,speed:t.speed,direction:t.direction,shift:t.shift,originalEvent:t.originalEvent,preventDefaultAction:!1};if(this.raiseEvent("canvas-drag",n),i=this.gestureSettingsByDeviceType(t.pointerType),!n.preventDefaultAction&&this.viewport)if(i.dblClickDragToZoom&&e[this.hash].draggingToZoom){var o=Math.pow(this.zoomPerDblClickDrag,t.delta.y/50);this.viewport.zoomBy(o)}else if(i.dragToPan&&!e[this.hash].draggingToZoom){if(this.panHorizontal||(t.delta.x=0),this.panVertical||(t.delta.y=0),this.viewport.flipped&&(t.delta.x=-t.delta.x),this.constrainDuringPan){var r=this.viewport.deltaPointsFromPixels(t.delta.negate());this.viewport.centerSpringX.target.value+=r.x,this.viewport.centerSpringY.target.value+=r.y;var s=this.viewport.getConstrainedBounds();this.viewport.centerSpringX.target.value-=r.x,this.viewport.centerSpringY.target.value-=r.y,s.xConstrained&&(t.delta.x=0),s.yConstrained&&(t.delta.y=0)}this.viewport.panBy(this.viewport.deltaPointsFromPixels(t.delta.negate()),i.flickEnabled&&!this.constrainDuringPan)}}function y(i){var n,o={tracker:i.eventSource,pointerType:i.pointerType,position:i.position,speed:i.speed,direction:i.direction,shift:i.shift,originalEvent:i.originalEvent,preventDefaultAction:!1};if(this.raiseEvent("canvas-drag-end",o),n=this.gestureSettingsByDeviceType(i.pointerType),!o.preventDefaultAction&&this.viewport){if(!e[this.hash].draggingToZoom&&n.flickEnabled&&i.speed>=n.flickMinSpeed){var r=0;this.panHorizontal&&(r=n.flickMomentum*i.speed*Math.cos(i.direction));var s=0;this.panVertical&&(s=n.flickMomentum*i.speed*Math.sin(i.direction));var a=this.viewport.pixelFromPoint(this.viewport.getCenter(!0)),l=this.viewport.pointFromPixel(new t.Point(a.x-r,a.y-s));this.viewport.panTo(l,!1)}this.viewport.applyConstraints()}n.dblClickDragToZoom&&!0===e[this.hash].draggingToZoom&&(e[this.hash].draggingToZoom=!1)}function w(t){this.raiseEvent("canvas-enter",{tracker:t.eventSource,pointerType:t.pointerType,position:t.position,buttons:t.buttons,pointers:t.pointers,insideElementPressed:t.insideElementPressed,buttonDownAny:t.buttonDownAny,originalEvent:t.originalEvent})}function x(t){this.raiseEvent("canvas-exit",{tracker:t.eventSource,pointerType:t.pointerType,position:t.position,buttons:t.buttons,pointers:t.pointers,insideElementPressed:t.insideElementPressed,buttonDownAny:t.buttonDownAny,originalEvent:t.originalEvent})}function b(i){if(this.raiseEvent("canvas-press",{tracker:i.eventSource,pointerType:i.pointerType,position:i.position,insideElementPressed:i.insideElementPressed,insideElementReleased:i.insideElementReleased,originalEvent:i.originalEvent}),this.gestureSettingsByDeviceType(i.pointerType).dblClickDragToZoom){var n=e[this.hash].lastClickTime,o=t.now();if(null===n)return;o-n<this.dblClickTimeThreshold&&(e[this.hash].draggingToZoom=!0),e[this.hash].lastClickTime=null}}function T(t){this.raiseEvent("canvas-release",{tracker:t.eventSource,pointerType:t.pointerType,position:t.position,insideElementPressed:t.insideElementPressed,insideElementReleased:t.insideElementReleased,originalEvent:t.originalEvent})}function P(t){this.raiseEvent("canvas-nonprimary-press",{tracker:t.eventSource,position:t.position,pointerType:t.pointerType,button:t.button,buttons:t.buttons,originalEvent:t.originalEvent})}function S(t){this.raiseEvent("canvas-nonprimary-release",{tracker:t.eventSource,position:t.position,pointerType:t.pointerType,button:t.button,buttons:t.buttons,originalEvent:t.originalEvent})}function E(t){var e,i,n,o={tracker:t.eventSource,pointerType:t.pointerType,gesturePoints:t.gesturePoints,lastCenter:t.lastCenter,center:t.center,lastDistance:t.lastDistance,distance:t.distance,shift:t.shift,originalEvent:t.originalEvent,preventDefaultPanAction:!1,preventDefaultZoomAction:!1,preventDefaultRotateAction:!1};if(this.raiseEvent("canvas-pinch",o),this.viewport&&(!(e=this.gestureSettingsByDeviceType(t.pointerType)).pinchToZoom||o.preventDefaultPanAction&&o.preventDefaultZoomAction||(i=this.viewport.pointFromPixel(t.center,!0),e.zoomToRefPoint&&!o.preventDefaultPanAction&&(n=this.viewport.pointFromPixel(t.lastCenter,!0).minus(i),this.panHorizontal||(n.x=0),this.panVertical||(n.y=0),this.viewport.panBy(n,!0)),o.preventDefaultZoomAction||this.viewport.zoomBy(t.distance/t.lastDistance,i,!0),this.viewport.applyConstraints()),e.pinchRotate&&!o.preventDefaultRotateAction)){var r=Math.atan2(t.gesturePoints[0].currentPos.y-t.gesturePoints[1].currentPos.y,t.gesturePoints[0].currentPos.x-t.gesturePoints[1].currentPos.x),s=Math.atan2(t.gesturePoints[0].lastPos.y-t.gesturePoints[1].lastPos.y,t.gesturePoints[0].lastPos.x-t.gesturePoints[1].lastPos.x);i=this.viewport.pointFromPixel(t.center,!0),this.viewport.rotateTo(this.viewport.getRotation(!0)+(r-s)*(180/Math.PI),i,!0)}}function C(t){this.raiseEvent("canvas-focus",{tracker:t.eventSource,originalEvent:t.originalEvent})}function _(t){this.raiseEvent("canvas-blur",{tracker:t.eventSource,originalEvent:t.originalEvent})}function O(e){var i,n,o,r;(r=t.now())-this._lastScrollTime>this.minScrollDeltaTime?(this._lastScrollTime=r,i={tracker:e.eventSource,position:e.position,scroll:e.scroll,shift:e.shift,originalEvent:e.originalEvent,preventDefaultAction:!1,preventDefault:!0},this.raiseEvent("canvas-scroll",i),!i.preventDefaultAction&&this.viewport&&(this.viewport.flipped&&(e.position.x=this.viewport.getContainerSize().x-e.position.x),(n=this.gestureSettingsByDeviceType(e.pointerType)).scrollToZoom&&(o=Math.pow(this.zoomPerScroll,e.scroll),this.viewport.zoomBy(o,n.zoomToRefPoint?this.viewport.pointFromPixel(e.position,!0):null),this.viewport.applyConstraints())),e.preventDefault=i.preventDefault):e.preventDefault=!0}function R(t){e[this.hash].mouseInside=!0,c(this),this.raiseEvent("container-enter",{tracker:t.eventSource,pointerType:t.pointerType,position:t.position,buttons:t.buttons,pointers:t.pointers,insideElementPressed:t.insideElementPressed,buttonDownAny:t.buttonDownAny,originalEvent:t.originalEvent})}function I(t){t.pointers<1&&(e[this.hash].mouseInside=!1,e[this.hash].animating||l(this)),this.raiseEvent("container-exit",{tracker:t.eventSource,pointerType:t.pointerType,position:t.position,buttons:t.buttons,pointers:t.pointers,insideElementPressed:t.insideElementPressed,buttonDownAny:t.buttonDownAny,originalEvent:t.originalEvent})}function k(i){!function(i){if(i._opening||!e[i.hash])return;if(i.autoResize||e[i.hash].forceResize){var o;if(i._autoResizePolling){o=n(i.container);var r=e[i.hash].prevContainerSize;o.equals(r)||(e[i.hash].needsResize=!0)}e[i.hash].needsResize&&function(i,n){var o,r=i.viewport,s=r.getZoom(),a=r.getCenter();if(r.resize(n,i.preserveImageSizeOnResize),r.panTo(a,!0),i.preserveImageSizeOnResize)o=e[i.hash].prevContainerSize.x/n.x;else{var l=new t.Point(0,0),c=new t.Point(e[i.hash].prevContainerSize.x,e[i.hash].prevContainerSize.y).distanceTo(l);o=new t.Point(n.x,n.y).distanceTo(l)/c*e[i.hash].prevContainerSize.x/n.x}r.zoomTo(s*o,null,!0),e[i.hash].prevContainerSize=n,e[i.hash].forceRedraw=!0,e[i.hash].needsResize=!1,e[i.hash].forceResize=!1}(i,o||n(i.container))}var s=i.viewport.update(),a=i.world.update()||s;s&&i.raiseEvent("viewport-change");i.referenceStrip&&(a=i.referenceStrip.update(i.viewport)||a);var u=e[i.hash].animating;!u&&a&&(i.raiseEvent("animation-start"),c(i));var h=u&&!a;h&&(e[i.hash].animating=!1);(a||h||e[i.hash].forceRedraw||i.world.needsDraw())&&(!function(t){t.imageLoader.clear(),t.drawer.clear(),t.world.draw(),t.raiseEvent("update-viewport",{})}(i),i._drawOverlays(),i.navigator&&i.navigator.update(i.viewport),e[i.hash].forceRedraw=!1,a&&i.raiseEvent("animation"));h&&(i.raiseEvent("animation-finish"),e[i.hash].mouseInside||l(i));e[i.hash].animating=a}(i),i.isOpen()?i._updateRequestId=s(i,k):i._updateRequestId=!1}function D(t,e){return t?t+e:e}function M(){e[this.hash].lastZoomTime=t.now(),e[this.hash].zoomFactor=this.zoomPerSecond,e[this.hash].zooming=!0,A(this)}function j(){e[this.hash].lastZoomTime=t.now(),e[this.hash].zoomFactor=1/this.zoomPerSecond,e[this.hash].zooming=!0,A(this)}function L(){e[this.hash].zooming=!1}function A(e){t.requestAnimationFrame(t.delegate(e,B))}function B(){var i,n,o;e[this.hash].zooming&&this.viewport&&(n=(i=t.now())-e[this.hash].lastZoomTime,o=Math.pow(e[this.hash].zoomFactor,n/1e3),this.viewport.zoomBy(o),this.viewport.applyConstraints(),e[this.hash].lastZoomTime=i,A(this))}function N(){this.viewport&&(e[this.hash].zooming=!1,this.viewport.zoomBy(this.zoomPerClick/1),this.viewport.applyConstraints())}function z(){this.viewport&&(e[this.hash].zooming=!1,this.viewport.zoomBy(1/this.zoomPerClick),this.viewport.applyConstraints())}function H(){this.buttonGroup&&(this.buttonGroup.emulateEnter(),this.buttonGroup.emulateLeave())}function F(){this.viewport&&this.viewport.goHome()}function W(){this.isFullPage()&&!t.isFullScreen()?this.setFullPage(!1):this.setFullScreen(!this.isFullPage()),this.buttonGroup&&this.buttonGroup.emulateLeave(),this.fullPageButton.element.focus(),this.viewport&&this.viewport.applyConstraints()}function V(){if(this.viewport){var t=this.viewport.getRotation();this.viewport.flipped?t+=this.rotationIncrement:t-=this.rotationIncrement,this.viewport.setRotation(t)}}function U(){if(this.viewport){var t=this.viewport.getRotation();this.viewport.flipped?t-=this.rotationIncrement:t+=this.rotationIncrement,this.viewport.setRotation(t)}}function G(){this.viewport.toggleFlip()}t.Viewer=function(o){var r,a,c=arguments,u=this;if(t.isPlainObject(o)||(o={id:c[0],xmlPath:c.length>1?c[1]:void 0,prefixUrl:c.length>2?c[2]:void 0,controls:c.length>3?c[3]:void 0,overlays:c.length>4?c[4]:void 0}),o.config&&(t.extend(!0,o,o.config),delete o.config),t.extend(!0,this,{id:o.id,hash:o.hash||i++,initialPage:0,element:null,container:null,canvas:null,overlays:[],overlaysContainer:null,previousBody:[],customControls:[],source:null,drawer:null,world:null,viewport:null,navigator:null,collectionViewport:null,collectionDrawer:null,navImages:null,buttonGroup:null,profiler:null},t.DEFAULT_SETTINGS,o),void 0===this.hash)throw new Error("A hash must be defined, either by specifying options.id or options.hash.");for(void 0!==e[this.hash]&&t.console.warn("Hash "+this.hash+" has already been used."),e[this.hash]={fsBoundsDelta:new t.Point(1,1),prevContainerSize:null,animating:!1,forceRedraw:!1,needsResize:!1,forceResize:!1,mouseInside:!1,group:null,zooming:!1,zoomFactor:null,lastZoomTime:null,fullPage:!1,onfullscreenchange:null,lastClickTime:null,draggingToZoom:!1},this._sequenceIndex=0,this._firstOpen=!0,this._updateRequestId=null,this._loadQueue=[],this.currentOverlays=[],this._updatePixelDensityRatioBind=null,this._lastScrollTime=t.now(),t.EventSource.call(this),this.addHandler("open-failed",function(e){var i=t.getString("Errors.OpenFailed",e.eventSource,e.message);u._showMessage(i)}),t.ControlDock.call(this,o),this.xmlPath&&(this.tileSources=[this.xmlPath]),this.element=this.element||document.getElementById(this.id),this.canvas=t.makeNeutralElement("div"),this.canvas.className="openseadragon-canvas",(a=this.canvas.style).width="100%",a.height="100%",a.overflow="hidden",a.position="absolute",a.top="0px",a.left="0px",t.setElementTouchActionNone(this.canvas),""!==o.tabIndex&&(this.canvas.tabIndex=void 0===o.tabIndex?0:o.tabIndex),this.container.className="openseadragon-container",function(t){t.width="100%",t.height="100%",t.position="relative",t.overflow="hidden",t.left="0px",t.top="0px",t.textAlign="left"}(this.container.style),t.setElementTouchActionNone(this.container),this.container.insertBefore(this.canvas,this.container.firstChild),this.element.appendChild(this.container),this.bodyWidth=document.body.style.width,this.bodyHeight=document.body.style.height,this.bodyOverflow=document.body.style.overflow,this.docOverflow=document.documentElement.style.overflow,this.innerTracker=new t.MouseTracker({userData:"Viewer.innerTracker",element:this.canvas,startDisabled:!this.mouseNavEnabled,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,dblClickTimeThreshold:this.dblClickTimeThreshold,dblClickDistThreshold:this.dblClickDistThreshold,contextMenuHandler:t.delegate(this,p),keyDownHandler:t.delegate(this,d),keyHandler:t.delegate(this,f),clickHandler:t.delegate(this,v),dblClickHandler:t.delegate(this,g),dragHandler:t.delegate(this,m),dragEndHandler:t.delegate(this,y),enterHandler:t.delegate(this,w),leaveHandler:t.delegate(this,x),pressHandler:t.delegate(this,b),releaseHandler:t.delegate(this,T),nonPrimaryPressHandler:t.delegate(this,P),nonPrimaryReleaseHandler:t.delegate(this,S),scrollHandler:t.delegate(this,O),pinchHandler:t.delegate(this,E),focusHandler:t.delegate(this,C),blurHandler:t.delegate(this,_)}),this.outerTracker=new t.MouseTracker({userData:"Viewer.outerTracker",element:this.container,startDisabled:!this.mouseNavEnabled,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,dblClickTimeThreshold:this.dblClickTimeThreshold,dblClickDistThreshold:this.dblClickDistThreshold,enterHandler:t.delegate(this,R),leaveHandler:t.delegate(this,I)}),this.toolbar&&(this.toolbar=new t.ControlDock({element:this.toolbar})),this.bindStandardControls(),e[this.hash].prevContainerSize=n(this.container),window.ResizeObserver?(this._autoResizePolling=!1,this._resizeObserver=new ResizeObserver(function(){e[u.hash].needsResize=!0}),this._resizeObserver.observe(this.container,{})):this._autoResizePolling=!0,this.world=new t.World({viewer:this}),this.world.addHandler("add-item",function(t){u.source=u.world.getItemAt(0).source,e[u.hash].forceRedraw=!0,u._updateRequestId||(u._updateRequestId=s(u,k))}),this.world.addHandler("remove-item",function(t){u.world.getItemCount()?u.source=u.world.getItemAt(0).source:u.source=null,e[u.hash].forceRedraw=!0}),this.world.addHandler("metrics-change",function(t){u.viewport&&u.viewport._setContentBounds(u.world.getHomeBounds(),u.world.getContentFactor())}),this.world.addHandler("item-index-change",function(t){u.source=u.world.getItemAt(0).source}),this.viewport=new t.Viewport({containerSize:e[this.hash].prevContainerSize,springStiffness:this.springStiffness,animationTime:this.animationTime,minZoomImageRatio:this.minZoomImageRatio,maxZoomPixelRatio:this.maxZoomPixelRatio,visibilityRatio:this.visibilityRatio,wrapHorizontal:this.wrapHorizontal,wrapVertical:this.wrapVertical,defaultZoomLevel:this.defaultZoomLevel,minZoomLevel:this.minZoomLevel,maxZoomLevel:this.maxZoomLevel,viewer:this,degrees:this.degrees,flipped:this.flipped,navigatorRotate:this.navigatorRotate,homeFillsViewer:this.homeFillsViewer,margins:this.viewportMargins,silenceMultiImageWarnings:this.silenceMultiImageWarnings}),this.viewport._setContentBounds(this.world.getHomeBounds(),this.world.getContentFactor()),this.imageLoader=new t.ImageLoader({jobLimit:this.imageLoaderLimit,timeout:o.timeout,tileRetryMax:this.tileRetryMax,tileRetryDelay:this.tileRetryDelay}),this.tileCache=new t.TileCache({maxImageCacheCount:this.maxImageCacheCount}),this.drawer=new t.Drawer({viewer:this,viewport:this.viewport,element:this.canvas,debugGridColor:this.debugGridColor}),this.overlaysContainer=t.makeNeutralElement("div"),this.canvas.appendChild(this.overlaysContainer),this.drawer.canRotate()||(this.rotateLeft&&(r=this.buttonGroup.buttons.indexOf(this.rotateLeft),this.buttonGroup.buttons.splice(r,1),this.buttonGroup.element.removeChild(this.rotateLeft.element)),this.rotateRight&&(r=this.buttonGroup.buttons.indexOf(this.rotateRight),this.buttonGroup.buttons.splice(r,1),this.buttonGroup.element.removeChild(this.rotateRight.element))),this._addUpdatePixelDensityRatioEvent(),this.showNavigator&&(this.navigator=new t.Navigator({element:this.navigatorElement,id:this.navigatorId,position:this.navigatorPosition,sizeRatio:this.navigatorSizeRatio,maintainSizeRatio:this.navigatorMaintainSizeRatio,top:this.navigatorTop,left:this.navigatorLeft,width:this.navigatorWidth,height:this.navigatorHeight,autoResize:this.navigatorAutoResize,autoFade:this.navigatorAutoFade,prefixUrl:this.prefixUrl,viewer:this,navigatorRotate:this.navigatorRotate,background:this.navigatorBackground,opacity:this.navigatorOpacity,borderColor:this.navigatorBorderColor,displayRegionColor:this.navigatorDisplayRegionColor,crossOriginPolicy:this.crossOriginPolicy,animationTime:this.animationTime})),this.sequenceMode&&this.bindSequenceControls(),this.tileSources&&this.open(this.tileSources),r=0;r<this.customControls.length;r++)this.addControl(this.customControls[r].id,{anchor:this.customControls[r].anchor});t.requestAnimationFrame(function(){l(u)}),void 0===this.imageSmoothingEnabled||this.imageSmoothingEnabled||this.drawer.setImageSmoothingEnabled(this.imageSmoothingEnabled),t._viewers.set(this.element,this)},t.extend(t.Viewer.prototype,t.EventSource.prototype,t.ControlDock.prototype,{isOpen:function(){return!!this.world.getItemCount()},openDzi:function(e){return t.console.error("[Viewer.openDzi] this function is deprecated; use Viewer.open() instead."),this.open(e)},openTileSource:function(e){return t.console.error("[Viewer.openTileSource] this function is deprecated; use Viewer.open() instead."),this.open(e)},get buttons(){return t.console.warn("Viewer.buttons is deprecated; Please use Viewer.buttonGroup"),this.buttonGroup},open:function(e,i){var n=this;if(this.close(),!e)return this;if(this.sequenceMode&&t.isArray(e))return this.referenceStrip&&(this.referenceStrip.destroy(),this.referenceStrip=null),void 0===i||isNaN(i)||(this.initialPage=i),this.tileSources=e,this._sequenceIndex=Math.max(0,Math.min(this.tileSources.length-1,this.initialPage)),this.tileSources.length&&(this.open(this.tileSources[this._sequenceIndex]),this.showReferenceStrip&&this.addReferenceStrip()),this._updateSequenceButtons(this._sequenceIndex),this;if(t.isArray(e)||(e=[e]),!e.length)return this;this._opening=!0;for(var r,s=e.length,a=0,l=0,c=function(){if(a+l===s)if(a){!n._firstOpen&&n.preserveViewport||(n.viewport.goHome(!0),n.viewport.update()),n._firstOpen=!1;var t=e[0];if(t.tileSource&&(t=t.tileSource),n.overlays&&!n.preserveOverlays)for(var i=0;i<n.overlays.length;i++)n.currentOverlays[i]=o(n,n.overlays[i]);n._drawOverlays(),n._opening=!1,n.raiseEvent("open",{source:t})}else n._opening=!1,n.raiseEvent("open-failed",r)},u=function(e){t.isPlainObject(e)&&e.tileSource||(e={tileSource:e}),void 0!==e.index&&(t.console.error("[Viewer.open] setting indexes here is not supported; use addTiledImage instead"),delete e.index),void 0===e.collectionImmediately&&(e.collectionImmediately=!0);var i=e.success;e.success=function(t){if(a++,e.tileSource.overlays)for(var o=0;o<e.tileSource.overlays.length;o++)n.addOverlay(e.tileSource.overlays[o]);i&&i(t),c()};var o=e.error;e.error=function(t){l++,r||(r=t),o&&o(t),c()},n.addTiledImage(e)},h=0;h<e.length;h++)u(e[h]);return this},close:function(){return e[this.hash]?(this._opening=!1,this.navigator&&this.navigator.close(),this.preserveOverlays||(this.clearOverlays(),this.overlaysContainer.innerHTML=""),e[this.hash].animating=!1,this.world.removeAll(),this.imageLoader.clear(),this.raiseEvent("close"),this):this},destroy:function(){if(e[this.hash]){if(this.raiseEvent("before-destroy"),this._removeUpdatePixelDensityRatioEvent(),this.close(),this.clearOverlays(),this.overlaysContainer.innerHTML="",this._resizeObserver&&this._resizeObserver.disconnect(),this.referenceStrip&&(this.referenceStrip.destroy(),this.referenceStrip=null),null!==this._updateRequestId&&(t.cancelAnimationFrame(this._updateRequestId),this._updateRequestId=null),this.drawer&&this.drawer.destroy(),this.navigator&&(this.navigator.destroy(),e[this.navigator.hash]=null,delete e[this.navigator.hash],this.navigator=null),this.buttonGroup)this.buttonGroup.destroy();else if(this.customButtons)for(;this.customButtons.length;)this.customButtons.pop().destroy();if(this.paging&&this.paging.destroy(),this.element)for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild);this.container.onsubmit=null,this.clearControls(),this.innerTracker&&this.innerTracker.destroy(),this.outerTracker&&this.outerTracker.destroy(),e[this.hash]=null,delete e[this.hash],this.canvas=null,this.container=null,t._viewers.delete(this.element),this.element=null,this.raiseEvent("destroy"),this.removeAllHandlers()}},isMouseNavEnabled:function(){return this.innerTracker.isTracking()},setMouseNavEnabled:function(t){return this.innerTracker.setTracking(t),this.outerTracker.setTracking(t),this.raiseEvent("mouse-enabled",{enabled:t}),this},areControlsEnabled:function(){var t,e=this.controls.length;for(t=0;t<this.controls.length;t++)e=e&&this.controls[t].isVisible();return e},setControlsEnabled:function(t){return t?c(this):l(this),this.raiseEvent("controls-enabled",{enabled:t}),this},setDebugMode:function(t){for(var e=0;e<this.world.getItemCount();e++)this.world.getItemAt(e).debugMode=t;this.debugMode=t,this.forceRedraw()},setAjaxHeaders:function(e,i){if(null===e&&(e={}),t.isPlainObject(e)&&(void 0===i&&(i=!0),this.ajaxHeaders=e,i)){for(var n=0;n<this.world.getItemCount();n++)this.world.getItemAt(n)._updateAjaxHeaders(!0);if(this.navigator&&this.navigator.setAjaxHeaders(this.ajaxHeaders,!0),this.referenceStrip&&this.referenceStrip.miniViewers)for(var o in this.referenceStrip.miniViewers)this.referenceStrip.miniViewers[o].setAjaxHeaders(this.ajaxHeaders,!0)}},addButton:function(t){this.buttonGroup.addButton(t)},isFullPage:function(){return e[this.hash].fullPage},setFullPage:function(i){var n,o,r=document.body,s=r.style,a=document.documentElement.style,l=this;if(i===this.isFullPage())return this;var c={fullPage:i,preventDefaultAction:!1};if(this.raiseEvent("pre-full-page",c),c.preventDefaultAction)return this;if(i){for(this.elementSize=t.getElementSize(this.element),this.pageScroll=t.getPageScroll(),this.elementMargin=this.element.style.margin,this.element.style.margin="0",this.elementPadding=this.element.style.padding,this.element.style.padding="0",this.bodyMargin=s.margin,this.docMargin=a.margin,s.margin="0",a.margin="0",this.bodyPadding=s.padding,this.docPadding=a.padding,s.padding="0",a.padding="0",this.bodyWidth=s.width,this.docWidth=a.width,s.width="100%",a.width="100%",this.bodyHeight=s.height,this.docHeight=a.height,s.height="100%",a.height="100%",this.bodyDisplay=s.display,s.display="block",this.previousBody=[],e[this.hash].prevElementParent=this.element.parentNode,e[this.hash].prevNextSibling=this.element.nextSibling,e[this.hash].prevElementWidth=this.element.style.width,e[this.hash].prevElementHeight=this.element.style.height,n=r.childNodes.length,o=0;o<n;o++)this.previousBody.push(r.childNodes[0]),r.removeChild(r.childNodes[0]);this.toolbar&&this.toolbar.element&&(this.toolbar.parentNode=this.toolbar.element.parentNode,this.toolbar.nextSibling=this.toolbar.element.nextSibling,r.appendChild(this.toolbar.element),t.addClass(this.toolbar.element,"fullpage")),t.addClass(this.element,"fullpage"),r.appendChild(this.element),this.element.style.height="100vh",this.element.style.width="100vw",this.toolbar&&this.toolbar.element&&(this.element.style.height=t.getElementSize(this.element).y-t.getElementSize(this.toolbar.element).y+"px"),e[this.hash].fullPage=!0,t.delegate(this,R)({})}else{for(this.element.style.margin=this.elementMargin,this.element.style.padding=this.elementPadding,s.margin=this.bodyMargin,a.margin=this.docMargin,s.padding=this.bodyPadding,a.padding=this.docPadding,s.width=this.bodyWidth,a.width=this.docWidth,s.height=this.bodyHeight,a.height=this.docHeight,s.display=this.bodyDisplay,r.removeChild(this.element),n=this.previousBody.length,o=0;o<n;o++)r.appendChild(this.previousBody.shift());t.removeClass(this.element,"fullpage"),e[this.hash].prevElementParent.insertBefore(this.element,e[this.hash].prevNextSibling),this.toolbar&&this.toolbar.element&&(r.removeChild(this.toolbar.element),t.removeClass(this.toolbar.element,"fullpage"),this.toolbar.parentNode.insertBefore(this.toolbar.element,this.toolbar.nextSibling),delete this.toolbar.parentNode,delete this.toolbar.nextSibling),this.element.style.width=e[this.hash].prevElementWidth,this.element.style.height=e[this.hash].prevElementHeight;var u=0,h=function(){t.setPageScroll(l.pageScroll);var e=t.getPageScroll();++u<10&&(e.x!==l.pageScroll.x||e.y!==l.pageScroll.y)&&t.requestAnimationFrame(h)};t.requestAnimationFrame(h),e[this.hash].fullPage=!1,t.delegate(this,I)({})}return this.navigator&&this.viewport&&this.navigator.update(this.viewport),this.raiseEvent("full-page",{fullPage:i}),this},setFullScreen:function(e){var i=this;if(!t.supportsFullScreen)return this.setFullPage(e);if(t.isFullScreen()===e)return this;var n={fullScreen:e,preventDefaultAction:!1};if(this.raiseEvent("pre-full-screen",n),n.preventDefaultAction)return this;if(e){if(this.setFullPage(!0),!this.isFullPage())return this;this.fullPageStyleWidth=this.element.style.width,this.fullPageStyleHeight=this.element.style.height,this.element.style.width="100%",this.element.style.height="100%";var o=function(){var e=t.isFullScreen();e||(t.removeEvent(document,t.fullScreenEventName,o),t.removeEvent(document,t.fullScreenErrorEventName,o),i.setFullPage(!1),i.isFullPage()&&(i.element.style.width=i.fullPageStyleWidth,i.element.style.height=i.fullPageStyleHeight)),i.navigator&&i.viewport&&setTimeout(function(){i.navigator.update(i.viewport)}),i.raiseEvent("full-screen",{fullScreen:e})};t.addEvent(document,t.fullScreenEventName,o),t.addEvent(document,t.fullScreenErrorEventName,o),t.requestFullScreen(document.body)}else t.exitFullScreen();return this},isVisible:function(){return"hidden"!==this.container.style.visibility},isFullScreen:function(){return t.isFullScreen()&&this.isFullPage()},setVisible:function(t){return this.container.style.visibility=t?"":"hidden",this.raiseEvent("visible",{visible:t}),this},addTiledImage:function(e){t.console.assert(e,"[Viewer.addTiledImage] options is required"),t.console.assert(e.tileSource,"[Viewer.addTiledImage] options.tileSource is required"),t.console.assert(!e.replace||e.index>-1&&e.index<this.world.getItemCount(),"[Viewer.addTiledImage] if options.replace is used, options.index must be a valid index in Viewer.world");var i=this;e.replace&&(e.replaceItem=i.world.getItemAt(e.index)),this._hideMessage(),void 0===e.placeholderFillStyle&&(e.placeholderFillStyle=this.placeholderFillStyle),void 0===e.opacity&&(e.opacity=this.opacity),void 0===e.preload&&(e.preload=this.preload),void 0===e.compositeOperation&&(e.compositeOperation=this.compositeOperation),void 0===e.crossOriginPolicy&&(e.crossOriginPolicy=void 0!==e.tileSource.crossOriginPolicy?e.tileSource.crossOriginPolicy:this.crossOriginPolicy),void 0===e.ajaxWithCredentials&&(e.ajaxWithCredentials=this.ajaxWithCredentials),void 0===e.loadTilesWithAjax&&(e.loadTilesWithAjax=this.loadTilesWithAjax),t.isPlainObject(e.ajaxHeaders)||(e.ajaxHeaders={});var n={options:e};function o(t){for(var o=0;o<i._loadQueue.length;o++)if(i._loadQueue[o]===n){i._loadQueue.splice(o,1);break}0===i._loadQueue.length&&r(n),i.raiseEvent("add-item-failed",t),e.error&&e.error(t)}function r(t){i.collectionMode&&(i.world.arrange({immediately:t.options.collectionImmediately,rows:i.collectionRows,columns:i.collectionColumns,layout:i.collectionLayout,tileSize:i.collectionTileSize,tileMargin:i.collectionTileMargin}),i.world.setAutoRefigureSizes(!0))}function s(){for(var e,n,o;i._loadQueue.length&&(e=i._loadQueue[0]).tileSource;){if(i._loadQueue.splice(0,1),e.options.replace){var s=i.world.getIndexOfItem(e.options.replaceItem);-1!==s&&(e.options.index=s),i.world.removeItem(e.options.replaceItem)}n=new t.TiledImage({viewer:i,source:e.tileSource,viewport:i.viewport,drawer:i.drawer,tileCache:i.tileCache,imageLoader:i.imageLoader,x:e.options.x,y:e.options.y,width:e.options.width,height:e.options.height,fitBounds:e.options.fitBounds,fitBoundsPlacement:e.options.fitBoundsPlacement,clip:e.options.clip,placeholderFillStyle:e.options.placeholderFillStyle,opacity:e.options.opacity,preload:e.options.preload,degrees:e.options.degrees,flipped:e.options.flipped,compositeOperation:e.options.compositeOperation,springStiffness:i.springStiffness,animationTime:i.animationTime,minZoomImageRatio:i.minZoomImageRatio,wrapHorizontal:i.wrapHorizontal,wrapVertical:i.wrapVertical,immediateRender:i.immediateRender,blendTime:i.blendTime,alwaysBlend:i.alwaysBlend,minPixelRatio:i.minPixelRatio,smoothTileEdgesMinZoom:i.smoothTileEdgesMinZoom,iOSDevice:i.iOSDevice,crossOriginPolicy:e.options.crossOriginPolicy,ajaxWithCredentials:e.options.ajaxWithCredentials,loadTilesWithAjax:e.options.loadTilesWithAjax,ajaxHeaders:e.options.ajaxHeaders,debugMode:i.debugMode,subPixelRoundingForTransparency:i.subPixelRoundingForTransparency}),i.collectionMode&&i.world.setAutoRefigureSizes(!1),i.navigator&&(o=t.extend({},e.options,{replace:!1,originalTiledImage:n,tileSource:e.tileSource}),i.navigator.addTiledImage(o)),i.world.addItem(n,{index:e.options.index}),0===i._loadQueue.length&&r(e),1!==i.world.getItemCount()||i.preserveViewport||i.viewport.goHome(!0),e.options.success&&e.options.success({item:n})}}t.isArray(e.tileSource)?setTimeout(function(){o({message:"[Viewer.addTiledImage] Sequences can not be added; add them one at a time instead.",source:e.tileSource,options:e})}):(this._loadQueue.push(n),function(e,i,n,o,r){var s=e;if("string"===t.type(i))if(i.match(/^\s*<.*>\s*$/))i=t.parseXml(i);else if(i.match(/^\s*[{[].*[}\]]\s*$/))try{var a=t.parseJSON(i);i=a}catch(c){}function l(t,e){t.ready?o(t):(t.addHandler("ready",function(){o(t)}),t.addHandler("open-failed",function(t){r({message:t.message,source:e})}))}setTimeout(function(){if("string"===t.type(i))(i=new t.TileSource({url:i,crossOriginPolicy:void 0!==n.crossOriginPolicy?n.crossOriginPolicy:e.crossOriginPolicy,ajaxWithCredentials:e.ajaxWithCredentials,ajaxHeaders:n.ajaxHeaders?n.ajaxHeaders:e.ajaxHeaders,splitHashDataForPost:e.splitHashDataForPost,useCanvas:e.useCanvas,success:function(t){o(t.tileSource)}})).addHandler("open-failed",function(t){r(t)});else if(t.isPlainObject(i)||i.nodeType)if(void 0!==i.crossOriginPolicy||void 0===n.crossOriginPolicy&&void 0===e.crossOriginPolicy||(i.crossOriginPolicy=void 0!==n.crossOriginPolicy?n.crossOriginPolicy:e.crossOriginPolicy),void 0===i.ajaxWithCredentials&&(i.ajaxWithCredentials=e.ajaxWithCredentials),void 0===i.useCanvas&&(i.useCanvas=e.useCanvas),t.isFunction(i.getTileUrl)){var a=new t.TileSource(i);a.getTileUrl=i.getTileUrl,o(a)}else{var c=t.TileSource.determineType(s,i);if(!c)return void r({message:"Unable to load TileSource",source:i});var u=c.prototype.configure.apply(s,[i]);l(new c(u),i)}else l(i,i)})}(this,e.tileSource,e,function(t){n.tileSource=t,s()},function(t){t.options=e,o(t),s()}))},addSimpleImage:function(e){t.console.assert(e,"[Viewer.addSimpleImage] options is required"),t.console.assert(e.url,"[Viewer.addSimpleImage] options.url is required");var i=t.extend({},e,{tileSource:{type:"image",url:e.url}});delete i.url,this.addTiledImage(i)},addLayer:function(e){var i=this;t.console.error("[Viewer.addLayer] this function is deprecated; use Viewer.addTiledImage() instead.");var n=t.extend({},e,{success:function(t){i.raiseEvent("add-layer",{options:e,drawer:t.item})},error:function(t){i.raiseEvent("add-layer-failed",t)}});return this.addTiledImage(n),this},getLayerAtLevel:function(e){return t.console.error("[Viewer.getLayerAtLevel] this function is deprecated; use World.getItemAt() instead."),this.world.getItemAt(e)},getLevelOfLayer:function(e){return t.console.error("[Viewer.getLevelOfLayer] this function is deprecated; use World.getIndexOfItem() instead."),this.world.getIndexOfItem(e)},getLayersCount:function(){return t.console.error("[Viewer.getLayersCount] this function is deprecated; use World.getItemCount() instead."),this.world.getItemCount()},setLayerLevel:function(e,i){return t.console.error("[Viewer.setLayerLevel] this function is deprecated; use World.setItemIndex() instead."),this.world.setItemIndex(e,i)},removeLayer:function(e){return t.console.error("[Viewer.removeLayer] this function is deprecated; use World.removeItem() instead."),this.world.removeItem(e)},forceRedraw:function(){return e[this.hash].forceRedraw=!0,this},forceResize:function(){e[this.hash].needsResize=!0,e[this.hash].forceResize=!0},bindSequenceControls:function(){var e=t.delegate(this,u),i=t.delegate(this,h),n=t.delegate(this,this.goToNextPage),o=t.delegate(this,this.goToPreviousPage),r=this.navImages,s=!0;return this.showSequenceControl&&((this.previousButton||this.nextButton)&&(s=!1),this.previousButton=new t.Button({element:this.previousButton?t.getElement(this.previousButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:t.getString("Tooltips.PreviousPage"),srcRest:D(this.prefixUrl,r.previous.REST),srcGroup:D(this.prefixUrl,r.previous.GROUP),srcHover:D(this.prefixUrl,r.previous.HOVER),srcDown:D(this.prefixUrl,r.previous.DOWN),onRelease:o,onFocus:e,onBlur:i}),this.nextButton=new t.Button({element:this.nextButton?t.getElement(this.nextButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:t.getString("Tooltips.NextPage"),srcRest:D(this.prefixUrl,r.next.REST),srcGroup:D(this.prefixUrl,r.next.GROUP),srcHover:D(this.prefixUrl,r.next.HOVER),srcDown:D(this.prefixUrl,r.next.DOWN),onRelease:n,onFocus:e,onBlur:i}),this.navPrevNextWrap||this.previousButton.disable(),this.tileSources&&this.tileSources.length||this.nextButton.disable(),s&&(this.paging=new t.ButtonGroup({buttons:[this.previousButton,this.nextButton],clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold}),this.pagingControl=this.paging.element,this.toolbar?this.toolbar.addControl(this.pagingControl,{anchor:t.ControlAnchor.BOTTOM_RIGHT}):this.addControl(this.pagingControl,{anchor:this.sequenceControlAnchor||t.ControlAnchor.TOP_LEFT}))),this},bindStandardControls:function(){var e=t.delegate(this,M),i=t.delegate(this,L),n=t.delegate(this,N),o=t.delegate(this,j),r=t.delegate(this,z),s=t.delegate(this,F),a=t.delegate(this,W),l=t.delegate(this,V),c=t.delegate(this,U),p=t.delegate(this,G),d=t.delegate(this,u),f=t.delegate(this,h),v=this.navImages,g=[],m=!0;return this.showNavigationControl&&((this.zoomInButton||this.zoomOutButton||this.homeButton||this.fullPageButton||this.rotateLeftButton||this.rotateRightButton||this.flipButton)&&(m=!1),this.showZoomControl&&(g.push(this.zoomInButton=new t.Button({element:this.zoomInButton?t.getElement(this.zoomInButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:t.getString("Tooltips.ZoomIn"),srcRest:D(this.prefixUrl,v.zoomIn.REST),srcGroup:D(this.prefixUrl,v.zoomIn.GROUP),srcHover:D(this.prefixUrl,v.zoomIn.HOVER),srcDown:D(this.prefixUrl,v.zoomIn.DOWN),onPress:e,onRelease:i,onClick:n,onEnter:e,onExit:i,onFocus:d,onBlur:f})),g.push(this.zoomOutButton=new t.Button({element:this.zoomOutButton?t.getElement(this.zoomOutButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:t.getString("Tooltips.ZoomOut"),srcRest:D(this.prefixUrl,v.zoomOut.REST),srcGroup:D(this.prefixUrl,v.zoomOut.GROUP),srcHover:D(this.prefixUrl,v.zoomOut.HOVER),srcDown:D(this.prefixUrl,v.zoomOut.DOWN),onPress:o,onRelease:i,onClick:r,onEnter:o,onExit:i,onFocus:d,onBlur:f}))),this.showHomeControl&&g.push(this.homeButton=new t.Button({element:this.homeButton?t.getElement(this.homeButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:t.getString("Tooltips.Home"),srcRest:D(this.prefixUrl,v.home.REST),srcGroup:D(this.prefixUrl,v.home.GROUP),srcHover:D(this.prefixUrl,v.home.HOVER),srcDown:D(this.prefixUrl,v.home.DOWN),onRelease:s,onFocus:d,onBlur:f})),this.showFullPageControl&&g.push(this.fullPageButton=new t.Button({element:this.fullPageButton?t.getElement(this.fullPageButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:t.getString("Tooltips.FullPage"),srcRest:D(this.prefixUrl,v.fullpage.REST),srcGroup:D(this.prefixUrl,v.fullpage.GROUP),srcHover:D(this.prefixUrl,v.fullpage.HOVER),srcDown:D(this.prefixUrl,v.fullpage.DOWN),onRelease:a,onFocus:d,onBlur:f})),this.showRotationControl&&(g.push(this.rotateLeftButton=new t.Button({element:this.rotateLeftButton?t.getElement(this.rotateLeftButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:t.getString("Tooltips.RotateLeft"),srcRest:D(this.prefixUrl,v.rotateleft.REST),srcGroup:D(this.prefixUrl,v.rotateleft.GROUP),srcHover:D(this.prefixUrl,v.rotateleft.HOVER),srcDown:D(this.prefixUrl,v.rotateleft.DOWN),onRelease:l,onFocus:d,onBlur:f})),g.push(this.rotateRightButton=new t.Button({element:this.rotateRightButton?t.getElement(this.rotateRightButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:t.getString("Tooltips.RotateRight"),srcRest:D(this.prefixUrl,v.rotateright.REST),srcGroup:D(this.prefixUrl,v.rotateright.GROUP),srcHover:D(this.prefixUrl,v.rotateright.HOVER),srcDown:D(this.prefixUrl,v.rotateright.DOWN),onRelease:c,onFocus:d,onBlur:f}))),this.showFlipControl&&g.push(this.flipButton=new t.Button({element:this.flipButton?t.getElement(this.flipButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:t.getString("Tooltips.Flip"),srcRest:D(this.prefixUrl,v.flip.REST),srcGroup:D(this.prefixUrl,v.flip.GROUP),srcHover:D(this.prefixUrl,v.flip.HOVER),srcDown:D(this.prefixUrl,v.flip.DOWN),onRelease:p,onFocus:d,onBlur:f})),m?(this.buttonGroup=new t.ButtonGroup({buttons:g,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold}),this.navControl=this.buttonGroup.element,this.addHandler("open",t.delegate(this,H)),this.toolbar?this.toolbar.addControl(this.navControl,{anchor:this.navigationControlAnchor||t.ControlAnchor.TOP_LEFT}):this.addControl(this.navControl,{anchor:this.navigationControlAnchor||t.ControlAnchor.TOP_LEFT})):this.customButtons=g),this},currentPage:function(){return this._sequenceIndex},goToPage:function(t){return this.tileSources&&t>=0&&t<this.tileSources.length&&(this._sequenceIndex=t,this._updateSequenceButtons(t),this.open(this.tileSources[t]),this.referenceStrip&&this.referenceStrip.setFocus(t),this.raiseEvent("page",{page:t})),this},addOverlay:function(e,i,n,s){var a;if(a=t.isPlainObject(e)?e:{element:e,location:i,placement:n,onDraw:s},e=t.getElement(a.element),r(this.currentOverlays,e)>=0)return this;var l=o(this,a);return this.currentOverlays.push(l),l.drawHTML(this.overlaysContainer,this.viewport),this.raiseEvent("add-overlay",{element:e,location:a.location,placement:a.placement}),this},updateOverlay:function(i,n,o){var s;return i=t.getElement(i),(s=r(this.currentOverlays,i))>=0&&(this.currentOverlays[s].update(n,o),e[this.hash].forceRedraw=!0,this.raiseEvent("update-overlay",{element:i,location:n,placement:o})),this},removeOverlay:function(i){var n;return i=t.getElement(i),(n=r(this.currentOverlays,i))>=0&&(this.currentOverlays[n].destroy(),this.currentOverlays.splice(n,1),e[this.hash].forceRedraw=!0,this.raiseEvent("remove-overlay",{element:i})),this},clearOverlays:function(){for(;this.currentOverlays.length>0;)this.currentOverlays.pop().destroy();return e[this.hash].forceRedraw=!0,this.raiseEvent("clear-overlay",{}),this},getOverlayById:function(e){var i;return e=t.getElement(e),(i=r(this.currentOverlays,e))>=0?this.currentOverlays[i]:null},_updateSequenceButtons:function(t){this.nextButton&&(this.tileSources&&this.tileSources.length-1!==t?this.nextButton.enable():this.navPrevNextWrap||this.nextButton.disable()),this.previousButton&&(t>0?this.previousButton.enable():this.navPrevNextWrap||this.previousButton.disable())},_showMessage:function(e){this._hideMessage();var i=t.makeNeutralElement("div");i.appendChild(document.createTextNode(e)),this.messageDiv=t.makeCenteredNode(i),t.addClass(this.messageDiv,"openseadragon-message"),this.container.appendChild(this.messageDiv)},_hideMessage:function(){var t=this.messageDiv;t&&(t.parentNode.removeChild(t),delete this.messageDiv)},gestureSettingsByDeviceType:function(t){switch(t){case"mouse":return this.gestureSettingsMouse;case"touch":return this.gestureSettingsTouch;case"pen":return this.gestureSettingsPen;default:return this.gestureSettingsUnknown}},_drawOverlays:function(){var t,e=this.currentOverlays.length;for(t=0;t<e;t++)this.currentOverlays[t].drawHTML(this.overlaysContainer,this.viewport)},_cancelPendingImages:function(){this._loadQueue=[]},removeReferenceStrip:function(){this.showReferenceStrip=!1,this.referenceStrip&&(this.referenceStrip.destroy(),this.referenceStrip=null)},addReferenceStrip:function(){if(this.showReferenceStrip=!0,this.sequenceMode){if(this.referenceStrip)return;this.tileSources.length&&this.tileSources.length>1&&(this.referenceStrip=new t.ReferenceStrip({id:this.referenceStripElement,position:this.referenceStripPosition,sizeRatio:this.referenceStripSizeRatio,scroll:this.referenceStripScroll,height:this.referenceStripHeight,width:this.referenceStripWidth,tileSources:this.tileSources,prefixUrl:this.prefixUrl,useCanvas:this.useCanvas,viewer:this}),this.referenceStrip.setFocus(this._sequenceIndex))}else t.console.warn('Attempting to display a reference strip while "sequenceMode" is off.')},_addUpdatePixelDensityRatioEvent:function(){this._updatePixelDensityRatioBind=this._updatePixelDensityRatio.bind(this),t.addEvent(window,"resize",this._updatePixelDensityRatioBind)},_removeUpdatePixelDensityRatioEvent:function(){t.removeEvent(window,"resize",this._updatePixelDensityRatioBind)},_updatePixelDensityRatio:function(){var e=t.pixelDensityRatio,i=t.getCurrentPixelDensityRatio();e!==i&&(t.pixelDensityRatio=i,this.world.resetItems(),this.forceRedraw())},goToPreviousPage:function(){var t=this._sequenceIndex-1;this.navPrevNextWrap&&t<0&&(t+=this.tileSources.length),this.goToPage(t)},goToNextPage:function(){var t=this._sequenceIndex+1;this.navPrevNextWrap&&t>=this.tileSources.length&&(t=0),this.goToPage(t)},isAnimating:function(){return e[this.hash].animating}})}(a),function(t){function e(t){var e={tracker:t.eventSource,position:t.position,quick:t.quick,shift:t.shift,originalEvent:t.originalEvent,preventDefaultAction:!1};if(this.viewer.raiseEvent("navigator-click",e),!e.preventDefaultAction&&t.quick&&this.viewer.viewport&&(this.panVertical||this.panHorizontal)){this.viewer.viewport.flipped&&(t.position.x=this.viewport.getContainerSize().x-t.position.x);var i=this.viewport.pointFromPixel(t.position);this.panVertical?this.panHorizontal||(i.x=this.viewer.viewport.getCenter(!0).x):i.y=this.viewer.viewport.getCenter(!0).y,this.viewer.viewport.panTo(i),this.viewer.viewport.applyConstraints()}}function i(t){var e={tracker:t.eventSource,position:t.position,delta:t.delta,speed:t.speed,direction:t.direction,shift:t.shift,originalEvent:t.originalEvent,preventDefaultAction:!1};this.viewer.raiseEvent("navigator-drag",e),!e.preventDefaultAction&&this.viewer.viewport&&(this.panHorizontal||(t.delta.x=0),this.panVertical||(t.delta.y=0),this.viewer.viewport.flipped&&(t.delta.x=-t.delta.x),this.viewer.viewport.panBy(this.viewport.deltaPointsFromPixels(t.delta)),this.viewer.constrainDuringPan&&this.viewer.viewport.applyConstraints())}function n(t){t.insideElementPressed&&this.viewer.viewport&&this.viewer.viewport.applyConstraints()}function o(t){var e={tracker:t.eventSource,position:t.position,scroll:t.scroll,shift:t.shift,originalEvent:t.originalEvent,preventDefault:t.preventDefault};this.viewer.raiseEvent("navigator-scroll",e),t.preventDefault=e.preventDefault}function r(t,e){s(t,"rotate("+e+"deg)")}function s(t,e){t.style.webkitTransform=e,t.style.mozTransform=e,t.style.msTransform=e,t.style.oTransform=e,t.style.transform=e}t.Navigator=function(s){var a,l,c,u,h=s.viewer,p=this;function d(t,e){r(p.displayRegionContainer,t),r(p.displayRegion,-t),p.viewport.setRotation(t,e)}(s.element||s.id?(s.element?(s.id&&t.console.warn("Given option.id for Navigator was ignored since option.element was provided and is being used instead."),s.element.id?s.id=s.element.id:s.id="navigator-"+t.now(),this.element=s.element):this.element=document.getElementById(s.id),s.controlOptions={anchor:t.ControlAnchor.NONE,attachToViewer:!1,autoFade:!1}):(s.id="navigator-"+t.now(),this.element=t.makeNeutralElement("div"),s.controlOptions={anchor:t.ControlAnchor.TOP_RIGHT,attachToViewer:!0,autoFade:s.autoFade},s.position&&("BOTTOM_RIGHT"===s.position?s.controlOptions.anchor=t.ControlAnchor.BOTTOM_RIGHT:"BOTTOM_LEFT"===s.position?s.controlOptions.anchor=t.ControlAnchor.BOTTOM_LEFT:"TOP_RIGHT"===s.position?s.controlOptions.anchor=t.ControlAnchor.TOP_RIGHT:"TOP_LEFT"===s.position?s.controlOptions.anchor=t.ControlAnchor.TOP_LEFT:"ABSOLUTE"===s.position&&(s.controlOptions.anchor=t.ControlAnchor.ABSOLUTE,s.controlOptions.top=s.top,s.controlOptions.left=s.left,s.controlOptions.height=s.height,s.controlOptions.width=s.width))),this.element.id=s.id,this.element.className+=" navigator",(s=t.extend(!0,{sizeRatio:t.DEFAULT_SETTINGS.navigatorSizeRatio},s,{element:this.element,tabIndex:-1,showNavigator:!1,mouseNavEnabled:!1,showNavigationControl:!1,showSequenceControl:!1,immediateRender:!0,blendTime:0,animationTime:s.animationTime,autoResize:!1,minZoomImageRatio:1,background:s.background,opacity:s.opacity,borderColor:s.borderColor,displayRegionColor:s.displayRegionColor})).minPixelRatio=this.minPixelRatio=h.minPixelRatio,t.setElementTouchActionNone(this.element),this.borderWidth=2,this.fudge=new t.Point(1,1),this.totalBorderWidths=new t.Point(2*this.borderWidth,2*this.borderWidth).minus(this.fudge),s.controlOptions.anchor!==t.ControlAnchor.NONE&&(c=this.element.style,u=this.borderWidth,c.margin="0px",c.border=u+"px solid "+s.borderColor,c.padding="0px",c.background=s.background,c.opacity=s.opacity,c.overflow="hidden"),this.displayRegion=t.makeNeutralElement("div"),this.displayRegion.id=this.element.id+"-displayregion",this.displayRegion.className="displayregion",function(t,e){t.position="relative",t.top="0px",t.left="0px",t.fontSize="0px",t.overflow="hidden",t.border=e+"px solid "+s.displayRegionColor,t.margin="0px",t.padding="0px",t.background="transparent",t.float="left",t.cssFloat="left",t.styleFloat="left",t.zIndex=999999999,t.cursor="default",t.boxSizing="content-box"}(this.displayRegion.style,this.borderWidth),t.setElementPointerEventsNone(this.displayRegion),t.setElementTouchActionNone(this.displayRegion),this.displayRegionContainer=t.makeNeutralElement("div"),this.displayRegionContainer.id=this.element.id+"-displayregioncontainer",this.displayRegionContainer.className="displayregioncontainer",this.displayRegionContainer.style.width="100%",this.displayRegionContainer.style.height="100%",t.setElementPointerEventsNone(this.displayRegionContainer),t.setElementTouchActionNone(this.displayRegionContainer),h.addControl(this.element,s.controlOptions),this._resizeWithViewer=s.controlOptions.anchor!==t.ControlAnchor.ABSOLUTE&&s.controlOptions.anchor!==t.ControlAnchor.NONE,s.width&&s.height?(this.setWidth(s.width),this.setHeight(s.height)):this._resizeWithViewer&&(a=t.getElementSize(h.element),this.element.style.height=Math.round(a.y*s.sizeRatio)+"px",this.element.style.width=Math.round(a.x*s.sizeRatio)+"px",this.oldViewerSize=a,l=t.getElementSize(this.element),this.elementArea=l.x*l.y),this.oldContainerSize=new t.Point(0,0),t.Viewer.apply(this,[s]),this.displayRegionContainer.appendChild(this.displayRegion),this.element.getElementsByTagName("div")[0].appendChild(this.displayRegionContainer),s.navigatorRotate)&&(d(s.viewer.viewport?s.viewer.viewport.getRotation():s.viewer.degrees||0,!0),s.viewer.addHandler("rotate",function(t){d(t.degrees,t.immediately)}));this.innerTracker.destroy(),this.innerTracker=new t.MouseTracker({userData:"Navigator.innerTracker",element:this.element,dragHandler:t.delegate(this,i),clickHandler:t.delegate(this,e),releaseHandler:t.delegate(this,n),scrollHandler:t.delegate(this,o),preProcessEventHandler:function(t){"wheel"===t.eventType&&(t.preventDefault=!0)}}),this.outerTracker.userData="Navigator.outerTracker",t.setElementPointerEventsNone(this.canvas),t.setElementPointerEventsNone(this.container),this.addHandler("reset-size",function(){p.viewport&&p.viewport.goHome(!0)}),h.world.addHandler("item-index-change",function(t){window.setTimeout(function(){var e=p.world.getItemAt(t.previousIndex);p.world.setItemIndex(e,t.newIndex)},1)}),h.world.addHandler("remove-item",function(t){var e=t.item,i=p._getMatchingItem(e);i&&p.world.removeItem(i)}),this.update(h.viewport)},t.extend(t.Navigator.prototype,t.EventSource.prototype,t.Viewer.prototype,{updateSize:function(){if(this.viewport){var e=new t.Point(0===this.container.clientWidth?1:this.container.clientWidth,0===this.container.clientHeight?1:this.container.clientHeight);e.equals(this.oldContainerSize)||(this.viewport.resize(e,!0),this.viewport.goHome(!0),this.oldContainerSize=e,this.drawer.clear(),this.world.draw())}},setWidth:function(t){this.width=t,this.element.style.width="number"==typeof t?t+"px":t,this._resizeWithViewer=!1,this.updateSize()},setHeight:function(t){this.height=t,this.element.style.height="number"==typeof t?t+"px":t,this._resizeWithViewer=!1,this.updateSize()},setFlip:function(t){return this.viewport.setFlip(t),this.setDisplayTransform(this.viewer.viewport.getFlip()?"scale(-1,1)":"scale(1,1)"),this},setDisplayTransform:function(t){s(this.displayRegion,t),s(this.canvas,t),s(this.element,t)},update:function(e){var i,n,o,s,a,l;if(i=t.getElementSize(this.viewer.element),this._resizeWithViewer&&i.x&&i.y&&!i.equals(this.oldViewerSize)&&(this.oldViewerSize=i,this.maintainSizeRatio||!this.elementArea?(n=i.x*this.sizeRatio,o=i.y*this.sizeRatio):(n=Math.sqrt(this.elementArea*(i.x/i.y)),o=this.elementArea/n),this.element.style.width=Math.round(n)+"px",this.element.style.height=Math.round(o)+"px",this.elementArea||(this.elementArea=n*o),this.updateSize()),e&&this.viewport){if(s=e.getBoundsNoRotate(!0),a=this.viewport.pixelFromPointNoRotate(s.getTopLeft(),!1),l=this.viewport.pixelFromPointNoRotate(s.getBottomRight(),!1).minus(this.totalBorderWidths),!this.navigatorRotate){var c=e.getRotation(!0);r(this.displayRegion,-c)}var u=this.displayRegion.style;u.display=this.world.getItemCount()?"block":"none",u.top=a.y.toFixed(2)+"px",u.left=a.x.toFixed(2)+"px";var h=l.x-a.x,p=l.y-a.y;u.width=Math.round(Math.max(h,0))+"px",u.height=Math.round(Math.max(p,0))+"px"}},addTiledImage:function(e){var i=this,n=e.originalTiledImage;delete e.original;var o=t.extend({},e,{success:function(t){var e=t.item;function o(){i._matchBounds(e,n)}e._originalForNavigator=n,i._matchBounds(e,n,!0),i._matchOpacity(e,n),i._matchCompositeOperation(e,n),n.addHandler("bounds-change",o),n.addHandler("clip-change",o),n.addHandler("opacity-change",function(){i._matchOpacity(e,n)}),n.addHandler("composite-operation-change",function(){i._matchCompositeOperation(e,n)})}});return t.Viewer.prototype.addTiledImage.apply(this,[o])},destroy:function(){return t.Viewer.prototype.destroy.apply(this)},_getMatchingItem:function(t){for(var e,i=this.world.getItemCount(),n=0;n<i;n++)if((e=this.world.getItemAt(n))._originalForNavigator===t)return e;return null},_matchBounds:function(t,e,i){var n=e.getBoundsNoRotate();t.setPosition(n.getTopLeft(),i),t.setWidth(n.width,i),t.setRotation(e.getRotation(),i),t.setClip(e.getClip()),t.setFlip(e.getFlip())},_matchOpacity:function(t,e){t.setOpacity(e.opacity)},_matchCompositeOperation:function(t,e){t.setCompositeOperation(e.compositeOperation)}})}(a),function(t){var e={Errors:{Dzc:"Sorry, we don't support Deep Zoom Collections!",Dzi:"Hmm, this doesn't appear to be a valid Deep Zoom Image.",Xml:"Hmm, this doesn't appear to be a valid Deep Zoom Image.",ImageFormat:"Sorry, we don't support {0}-based Deep Zoom Images.",Security:"It looks like a security restriction stopped us from loading this Deep Zoom Image.",Status:"This space unintentionally left blank ({0} {1}).",OpenFailed:"Unable to open {0}: {1}"},Tooltips:{FullPage:"Toggle full page",Home:"Go home",ZoomIn:"Zoom in",ZoomOut:"Zoom out",NextPage:"Next page",PreviousPage:"Previous page",RotateLeft:"Rotate left",RotateRight:"Rotate right",Flip:"Flip Horizontally"}};t.extend(t,{getString:function(i){var n,o=i.split("."),r=null,s=arguments,a=e;for(n=0;n<o.length-1;n++)a=a[o[n]]||{};return"string"!=typeof(r=a[o[n]])&&(t.console.error("Untranslated source string:",i),r=""),r.replace(/\{\d+\}/g,function(t){var e=parseInt(t.match(/\d+/),10)+1;return e<s.length?s[e]:""})},setString:function(t,i){var n,o=t.split("."),r=e;for(n=0;n<o.length-1;n++)r[o[n]]||(r[o[n]]={}),r=r[o[n]];r[o[n]]=i}})}(a),function(t){t.Point=function(t,e){this.x="number"==typeof t?t:0,this.y="number"==typeof e?e:0},t.Point.prototype={clone:function(){return new t.Point(this.x,this.y)},plus:function(e){return new t.Point(this.x+e.x,this.y+e.y)},minus:function(e){return new t.Point(this.x-e.x,this.y-e.y)},times:function(e){return new t.Point(this.x*e,this.y*e)},divide:function(e){return new t.Point(this.x/e,this.y/e)},negate:function(){return new t.Point(-this.x,-this.y)},distanceTo:function(t){return Math.sqrt(Math.pow(this.x-t.x,2)+Math.pow(this.y-t.y,2))},squaredDistanceTo:function(t){return Math.pow(this.x-t.x,2)+Math.pow(this.y-t.y,2)},apply:function(e){return new t.Point(e(this.x),e(this.y))},equals:function(e){return e instanceof t.Point&&this.x===e.x&&this.y===e.y},rotate:function(e,i){var n,o;if(i=i||new t.Point(0,0),e%90==0){switch(t.positiveModulo(e,360)){case 0:n=1,o=0;break;case 90:n=0,o=1;break;case 180:n=-1,o=0;break;case 270:n=0,o=-1}}else{var r=e*Math.PI/180;n=Math.cos(r),o=Math.sin(r)}var s=n*(this.x-i.x)-o*(this.y-i.y)+i.x,a=o*(this.x-i.x)+n*(this.y-i.y)+i.y;return new t.Point(s,a)},toString:function(){return"("+Math.round(100*this.x)/100+","+Math.round(100*this.y)/100+")"}}}(a),function(t){t.TileSource=function(e,i,n,o,r,s){var a,l,c=this,u=arguments;if(a=t.isPlainObject(e)?e:{width:u[0],height:u[1],tileSize:u[2],tileOverlap:u[3],minLevel:u[4],maxLevel:u[5]},t.EventSource.call(this),t.extend(!0,this,a),!this.success)for(l=0;l<arguments.length;l++)if(t.isFunction(arguments[l])){this.success=arguments[l];break}this.success&&this.addHandler("ready",function(t){c.success(t)}),"string"===t.type(arguments[0])&&(this.url=arguments[0]),this.url?(this.aspectRatio=1,this.dimensions=new t.Point(10,10),this._tileWidth=0,this._tileHeight=0,this.tileOverlap=0,this.minLevel=0,this.maxLevel=0,this.ready=!1,this.getImageInfo(this.url)):(this.ready=!0,this.aspectRatio=a.width&&a.height?a.width/a.height:1,this.dimensions=new t.Point(a.width,a.height),this.tileSize?(this._tileWidth=this._tileHeight=this.tileSize,delete this.tileSize):(this.tileWidth?(this._tileWidth=this.tileWidth,delete this.tileWidth):this._tileWidth=0,this.tileHeight?(this._tileHeight=this.tileHeight,delete this.tileHeight):this._tileHeight=0),this.tileOverlap=a.tileOverlap?a.tileOverlap:0,this.minLevel=a.minLevel?a.minLevel:0,this.maxLevel=void 0!==a.maxLevel&&null!==a.maxLevel?a.maxLevel:a.width&&a.height?Math.ceil(Math.log(Math.max(a.width,a.height))/Math.log(2)):0,this.success&&t.isFunction(this.success)&&this.success(this))},t.TileSource.prototype={getTileSize:function(e){return t.console.error("[TileSource.getTileSize] is deprecated. Use TileSource.getTileWidth() and TileSource.getTileHeight() instead"),this._tileWidth},getTileWidth:function(t){return this._tileWidth?this._tileWidth:this.getTileSize(t)},getTileHeight:function(t){return this._tileHeight?this._tileHeight:this.getTileSize(t)},setMaxLevel:function(t){this.maxLevel=t,this._memoizeLevelScale()},getLevelScale:function(t){return this._memoizeLevelScale(),this.getLevelScale(t)},_memoizeLevelScale:function(){var t,e={};for(t=0;t<=this.maxLevel;t++)e[t]=1/Math.pow(2,this.maxLevel-t);this.getLevelScale=function(t){return e[t]}},getNumTiles:function(e){var i=this.getLevelScale(e),n=Math.ceil(i*this.dimensions.x/this.getTileWidth(e)),o=Math.ceil(i*this.dimensions.y/this.getTileHeight(e));return new t.Point(n,o)},getPixelRatio:function(e){var i=this.dimensions.times(this.getLevelScale(e)),n=1/i.x*t.pixelDensityRatio,o=1/i.y*t.pixelDensityRatio;return new t.Point(n,o)},getClosestLevel:function(){var t,e;for(t=this.minLevel+1;t<=this.maxLevel&&!((e=this.getNumTiles(t)).x>1||e.y>1);t++);return t-1},getTileAtPoint:function(e,i){var n=i.x>=0&&i.x<=1&&i.y>=0&&i.y<=1/this.aspectRatio;t.console.assert(n,"[TileSource.getTileAtPoint] must be called with a valid point.");var o=this.dimensions.x*this.getLevelScale(e),r=i.x*o,s=i.y*o,a=Math.floor(r/this.getTileWidth(e)),l=Math.floor(s/this.getTileHeight(e));i.x>=1&&(a=this.getNumTiles(e).x-1);return i.y>=1/this.aspectRatio-1e-15&&(l=this.getNumTiles(e).y-1),new t.Point(a,l)},getTileBounds:function(e,i,n,o){var r=this.dimensions.times(this.getLevelScale(e)),s=this.getTileWidth(e),a=this.getTileHeight(e),l=0===i?0:s*i-this.tileOverlap,c=0===n?0:a*n-this.tileOverlap,u=s+(0===i?1:2)*this.tileOverlap,h=a+(0===n?1:2)*this.tileOverlap,p=1/r.x;return u=Math.min(u,r.x-l),h=Math.min(h,r.y-c),o?new t.Rect(0,0,u,h):new t.Rect(l*p,c*p,u*p,h*p)},getImageInfo:function(e){var i,n,o,r,s,a,l,c=this;e&&(l=(a=(s=e.split("/"))[s.length-1]).lastIndexOf("."))>-1&&(s[s.length-1]=a.slice(0,l));var u=null;if(this.splitHashDataForPost){var h=e.indexOf("#");-1!==h&&(u=e.substring(h+1),e=e.substr(0,h))}n=function(i){"string"==typeof i&&(i=t.parseXml(i));var n=t.TileSource.determineType(c,i,e);n?(void 0===(r=n.prototype.configure.apply(c,[i,e,u])).ajaxWithCredentials&&(r.ajaxWithCredentials=c.ajaxWithCredentials),o=new n(r),c.ready=!0,c.raiseEvent("ready",{tileSource:o})):c.raiseEvent("open-failed",{message:"Unable to load TileSource",source:e})},e.match(/\.js$/)?(i=e.split("/").pop().replace(".js",""),t.jsonp({url:e,async:!1,callbackName:i,callback:n})):t.makeAjaxRequest({url:e,postData:u,withCredentials:this.ajaxWithCredentials,headers:this.ajaxHeaders,success:function(e){var i=function(e){var i,n,o=e.responseText,r=e.status;if(!e)throw new Error(t.getString("Errors.Security"));if(200!==e.status&&0!==e.status)throw i=404===(r=e.status)?"Not Found":e.statusText,new Error(t.getString("Errors.Status",r,i));if(o.match(/^\s*<.*/))try{n=e.responseXML&&e.responseXML.documentElement?e.responseXML:t.parseXml(o)}catch(s){n=e.responseText}else if(o.match(/\s*[{[].*/))try{n=t.parseJSON(o)}catch(s){n=o}else n=o;return n}(e);n(i)},error:function(i,n){var o;try{o="HTTP "+i.status+" attempting to load TileSource: "+e}catch(r){o=(void 0!==n&&n.toString?n.toString():"Unknown error")+" attempting to load TileSource: "+e}t.console.error(o),c.raiseEvent("open-failed",{message:o,source:e,postData:u})}})},supports:function(t,e){return!1},configure:function(t,e,i){throw new Error("Method not implemented.")},getTileUrl:function(t,e,i){throw new Error("Method not implemented.")},getTilePostData:function(t,e,i){return null},getTileAjaxHeaders:function(t,e,i){return{}},getTileHashKey:function(t,e,i,n,o,r){function s(t){return o?t+"+"+JSON.stringify(o):t}return s("string"!=typeof n?t+"/"+e+"_"+i:n)},tileExists:function(t,e,i){var n=this.getNumTiles(t);return t>=this.minLevel&&t<=this.maxLevel&&e>=0&&i>=0&&e<n.x&&i<n.y},hasTransparency:function(t,e,i,n){return!!t||e.match(".png")},downloadTileStart:function(e){var i=e.userData,n=new Image;i.image=n,i.request=null;var o=function(t){n?(n.onload=n.onerror=n.onabort=null,e.finish(t?null:n,i.request,t)):e.finish(null,i.request,"Image load failed: undefined Image instance.")};n.onload=function(){o()},n.onabort=n.onerror=function(){o("Image load aborted.")},e.loadWithAjax?i.request=t.makeAjaxRequest({url:e.src,withCredentials:e.ajaxWithCredentials,headers:e.ajaxHeaders,responseType:"arraybuffer",postData:e.postData,success:function(t){var e;try{e=new window.Blob([t.response])}catch(s){var i=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder;if("TypeError"===s.name&&i){var r=new i;r.append(t.response),e=r.getBlob()}}0===e.size?o("Empty image response."):n.src=(window.URL||window.webkitURL).createObjectURL(e)},error:function(t){o("Image load aborted - XHR error")}}):(!1!==e.crossOriginPolicy&&(n.crossOrigin=e.crossOriginPolicy),n.src=e.src)},downloadTileAbort:function(t){t.userData.request&&t.userData.request.abort();var e=t.userData.image;t.userData.image&&(e.onload=e.onerror=e.onabort=null)},createTileCache:function(t,e,i){t._data=e},destroyTileCache:function(t){t._data=null,t._renderedContext=null},getTileCacheData:function(t){return t._data},getTileCacheDataAsImage:function(t){return t._data},getTileCacheDataAsContext2D:function(t){if(!t._renderedContext){var e=document.createElement("canvas");e.width=t._data.width,e.height=t._data.height,t._renderedContext=e.getContext("2d"),t._renderedContext.drawImage(t._data,0,0),t._data=null;const i=e.cloneNode(!0);t._copyRenderedContext=i.getContext("2d"),t._copyRenderedContext.drawImage(e,0,0)}return t._renderedContext},getCopyTileCacheDataAsContext2D:function(t){return t._copyRenderedContext||t._renderedContext}},t.extend(!0,t.TileSource.prototype,t.EventSource.prototype),t.TileSource.determineType=function(e,i,n){var o;for(o in a)if(o.match(/.+TileSource$/)&&t.isFunction(a[o])&&t.isFunction(a[o].prototype.supports)&&a[o].prototype.supports.call(e,i,n))return a[o];return t.console.error("No TileSource was able to open %s %s",n,i),null}}(a),function(t){function e(e,i){var n,o,r=i.Image,s=r.Url,a=r.Format,l=r.Size,c=r.DisplayRect||[],u=parseInt(l.Width,10),h=parseInt(l.Height,10),p=parseInt(r.TileSize,10),d=parseInt(r.Overlap,10),f=[];for(o=0;o<c.length;o++)n=c[o].Rect,f.push(new t.DisplayRect(parseInt(n.X,10),parseInt(n.Y,10),parseInt(n.Width,10),parseInt(n.Height,10),parseInt(n.MinLevel,10),parseInt(n.MaxLevel,10)));return t.extend(!0,{width:u,height:h,tileSize:p,tileOverlap:d,minLevel:null,maxLevel:null,tilesUrl:s,fileFormat:a,displayRects:f},i)}t.DziTileSource=function(e,i,n,o,r,s,a,l,c){var u,h,p,d;if(d=t.isPlainObject(e)?e:{width:arguments[0],height:arguments[1],tileSize:arguments[2],tileOverlap:arguments[3],tilesUrl:arguments[4],fileFormat:arguments[5],displayRects:arguments[6],minLevel:arguments[7],maxLevel:arguments[8]},this._levelRects={},this.tilesUrl=d.tilesUrl,this.fileFormat=d.fileFormat,this.displayRects=d.displayRects,this.displayRects)for(u=this.displayRects.length-1;u>=0;u--)for(p=(h=this.displayRects[u]).minLevel;p<=h.maxLevel;p++)this._levelRects[p]||(this._levelRects[p]=[]),this._levelRects[p].push(h);t.TileSource.apply(this,[d])},t.extend(t.DziTileSource.prototype,t.TileSource.prototype,{supports:function(t,e){var i;return t.Image?i=t.Image.xmlns:t.documentElement&&("Image"!==t.documentElement.localName&&"Image"!==t.documentElement.tagName||(i=t.documentElement.namespaceURI)),-1!==(i=(i||"").toLowerCase()).indexOf("schemas.microsoft.com/deepzoom/2008")||-1!==i.indexOf("schemas.microsoft.com/deepzoom/2009")},configure:function(i,n,o){var r;return r=t.isPlainObject(i)?e(this,i):function(i,n){if(!n||!n.documentElement)throw new Error(t.getString("Errors.Xml"));var o,r,s,a,l,c=n.documentElement,u=c.localName||c.tagName,h=n.documentElement.namespaceURI,p=null,d=[];if("Image"===u)try{if(void 0===(a=c.getElementsByTagName("Size")[0])&&(a=c.getElementsByTagNameNS(h,"Size")[0]),p={Image:{xmlns:"http://schemas.microsoft.com/deepzoom/2008",Url:c.getAttribute("Url"),Format:c.getAttribute("Format"),DisplayRect:null,Overlap:parseInt(c.getAttribute("Overlap"),10),TileSize:parseInt(c.getAttribute("TileSize"),10),Size:{Height:parseInt(a.getAttribute("Height"),10),Width:parseInt(a.getAttribute("Width"),10)}}},!t.imageFormatSupported(p.Image.Format))throw new Error(t.getString("Errors.ImageFormat",p.Image.Format.toUpperCase()));for(void 0===(o=c.getElementsByTagName("DisplayRect"))&&(o=c.getElementsByTagNameNS(h,"DisplayRect")[0]),l=0;l<o.length;l++)void 0===(s=(r=o[l]).getElementsByTagName("Rect")[0])&&(s=r.getElementsByTagNameNS(h,"Rect")[0]),d.push({Rect:{X:parseInt(s.getAttribute("X"),10),Y:parseInt(s.getAttribute("Y"),10),Width:parseInt(s.getAttribute("Width"),10),Height:parseInt(s.getAttribute("Height"),10),MinLevel:parseInt(r.getAttribute("MinLevel"),10),MaxLevel:parseInt(r.getAttribute("MaxLevel"),10)}});return d.length&&(p.Image.DisplayRect=d),e(i,p)}catch(v){throw v instanceof Error?v:new Error(t.getString("Errors.Dzi"))}else{if("Collection"===u)throw new Error(t.getString("Errors.Dzc"));if("Error"===u){var f=c.getElementsByTagName("Message")[0].firstChild.nodeValue;throw new Error(f)}}throw new Error(t.getString("Errors.Dzi"))}(this,i),n&&!r.tilesUrl&&(r.tilesUrl=n.replace(/([^/]+?)(\.(dzi|xml|js)?(\?[^/]*)?)?\/?$/,"$1_files/"),-1!==n.search(/\.(dzi|xml|js)\?/)?r.queryParams=n.match(/\?.*/):r.queryParams=""),r},getTileUrl:function(t,e,i){return[this.tilesUrl,t,"/",e,"_",i,".",this.fileFormat,this.queryParams].join("")},tileExists:function(t,e,i){var n,o,r,s,a,l,c,u=this._levelRects[t];if(this.minLevel&&t<this.minLevel||this.maxLevel&&t>this.maxLevel)return!1;if(!u||!u.length)return!0;for(c=u.length-1;c>=0;c--)if(!(t<(n=u[c]).minLevel||t>n.maxLevel)&&(o=this.getLevelScale(t),r=n.x*o,s=n.y*o,a=r+n.width*o,l=s+n.height*o,r=Math.floor(r/this._tileWidth),s=Math.floor(s/this._tileWidth),a=Math.ceil(a/this._tileWidth),l=Math.ceil(l/this._tileWidth),r<=e&&e<a&&s<=i&&i<l))return!0;return!1}})}(a),function(t){function e(t){var e=Array.isArray(t.profile)?t.profile[0]:t.profile,i=-1!==["http://library.stanford.edu/iiif/image-api/compliance.html#level0","http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0","http://iiif.io/api/image/2/level0.json","level0","https://iiif.io/api/image/3/level0.json"].indexOf(e),n=!1;return 2===t.version&&t.profile.length>1&&t.profile[1].supports&&(n=-1!==t.profile[1].supports.indexOf("sizeByW")),3===t.version&&t.extraFeatures&&(n=-1!==t.extraFeatures.indexOf("sizeByWh")),!i||n}function i(t){for(var e=[],i=0;i<t.sizes.length;i++)e.push({url:t._id+"/full/"+t.sizes[i].width+","+(3===t.version?t.sizes[i].height:"")+"/0/default."+t.tileFormat,width:t.sizes[i].width,height:t.sizes[i].height});return e.sort(function(t,e){return t.width-e.width})}function n(e,i,o){var r,s;if(3===e.nodeType&&o)(s=e.nodeValue.trim()).match(/^\d*$/)&&(s=Number(s)),i[o]?(t.isArray(i[o])||(i[o]=[i[o]]),i[o].push(s)):i[o]=s;else if(1===e.nodeType)for(r=0;r<e.childNodes.length;r++)n(e.childNodes[r],i,e.nodeName)}t.IIIFTileSource=function(n){if(t.extend(!0,this,n),this._id=this["@id"]||this.id||this.identifier||null,!(this.height&&this.width&&this._id))throw new Error("IIIF required parameters (width, height, or id) not provided.");if(n.tileSizePerScaleFactor={},this.tileFormat=this.tileFormat||"jpg",this.version=n.version,this.tile_width&&this.tile_height)n.tileWidth=this.tile_width,n.tileHeight=this.tile_height;else if(this.tile_width)n.tileSize=this.tile_width;else if(this.tile_height)n.tileSize=this.tile_height;else if(this.tiles)if(1===this.tiles.length)n.tileWidth=this.tiles[0].width,n.tileHeight=this.tiles[0].height||this.tiles[0].width,this.scale_factors=this.tiles[0].scaleFactors;else{this.scale_factors=[];for(var o=0;o<this.tiles.length;o++)for(var r=0;r<this.tiles[o].scaleFactors.length;r++){var s=this.tiles[o].scaleFactors[r];this.scale_factors.push(s),n.tileSizePerScaleFactor[s]={width:this.tiles[o].width,height:this.tiles[o].height||this.tiles[o].width}}}else if(e(n)){for(var a=Math.min(this.height,this.width),l=[256,512,1024],c=[],u=0;u<l.length;u++)l[u]<=a&&c.push(l[u]);c.length>0?n.tileSize=Math.max.apply(null,c):n.tileSize=a}else this.sizes&&this.sizes.length>0?(this.emulateLegacyImagePyramid=!0,n.levels=i(this),t.extend(!0,n,{width:n.levels[n.levels.length-1].width,height:n.levels[n.levels.length-1].height,tileSize:Math.max(n.height,n.width),tileOverlap:0,minLevel:0,maxLevel:n.levels.length-1}),this.levels=n.levels):t.console.error("Nothing in the info.json to construct image pyramids from");if(!n.maxLevel&&!this.emulateLegacyImagePyramid)if(this.scale_factors){var h=Math.max.apply(null,this.scale_factors);n.maxLevel=Math.round(Math.log(h)*Math.LOG2E)}else n.maxLevel=Number(Math.round(Math.log(Math.max(this.width,this.height),2)));if(this.sizes){var p=this.sizes.length;p!==n.maxLevel&&p!==n.maxLevel+1||(this.levelSizes=this.sizes.slice().sort(function(t,e){return t.width-e.width}),p===n.maxLevel&&this.levelSizes.push({width:this.width,height:this.height}))}t.TileSource.apply(this,[n])},t.extend(t.IIIFTileSource.prototype,t.TileSource.prototype,{supports:function(t,e){return!(!t.protocol||"http://iiif.io/api/image"!==t.protocol)||(!(!t["@context"]||"http://library.stanford.edu/iiif/image-api/1.1/context.json"!==t["@context"]&&"http://iiif.io/api/image/1/context.json"!==t["@context"])||(!(!t.profile||0!==t.profile.indexOf("http://library.stanford.edu/iiif/image-api/compliance.html"))||(!!(t.identifier&&t.width&&t.height)||!(!t.documentElement||"info"!==t.documentElement.tagName||"http://library.stanford.edu/iiif/image-api/ns/"!==t.documentElement.namespaceURI))))},configure:function(e,i,o){if(t.isPlainObject(e)){if(e["@context"]){var r=e["@context"];if(Array.isArray(r))for(var s=0;s<r.length;s++)if("string"==typeof r[s]&&(/^http:\/\/iiif\.io\/api\/image\/[1-3]\/context\.json$/.test(r[s])||"http://library.stanford.edu/iiif/image-api/1.1/context.json"===r[s])){r=r[s];break}switch(r){case"http://iiif.io/api/image/1/context.json":case"http://library.stanford.edu/iiif/image-api/1.1/context.json":e.version=1;break;case"http://iiif.io/api/image/2/context.json":e.version=2;break;case"http://iiif.io/api/image/3/context.json":e.version=3;break;default:t.console.error("Data has a @context property which contains no known IIIF context URI.")}}else e["@context"]="http://iiif.io/api/image/1.0/context.json",e["@id"]=i.replace("/info.json",""),e.version=1;if(e.preferredFormats)for(var l=0;l<e.preferredFormats.length;l++)if(a.imageFormatSupported(e.preferredFormats[l])){e.tileFormat=e.preferredFormats[l];break}return e}var c=function(e){if(!e||!e.documentElement)throw new Error(t.getString("Errors.Xml"));var i=e.documentElement,o=i.tagName,r=null;if("info"===o)try{return n(i,r={}),r}catch(s){throw s instanceof Error?s:new Error(t.getString("Errors.IIIF"))}throw new Error(t.getString("Errors.IIIF"))}(e);return c["@context"]="http://iiif.io/api/image/1.0/context.json",c["@id"]=i.replace("/info.xml",""),c.version=1,c},getTileWidth:function(e){if(this.emulateLegacyImagePyramid)return t.TileSource.prototype.getTileWidth.call(this,e);var i=Math.pow(2,this.maxLevel-e);return this.tileSizePerScaleFactor&&this.tileSizePerScaleFactor[i]?this.tileSizePerScaleFactor[i].width:this._tileWidth},getTileHeight:function(e){if(this.emulateLegacyImagePyramid)return t.TileSource.prototype.getTileHeight.call(this,e);var i=Math.pow(2,this.maxLevel-e);return this.tileSizePerScaleFactor&&this.tileSizePerScaleFactor[i]?this.tileSizePerScaleFactor[i].height:this._tileHeight},getLevelScale:function(e){if(this.emulateLegacyImagePyramid){var i=NaN;return this.levels.length>0&&e>=this.minLevel&&e<=this.maxLevel&&(i=this.levels[e].width/this.levels[this.maxLevel].width),i}return t.TileSource.prototype.getLevelScale.call(this,e)},getNumTiles:function(e){if(this.emulateLegacyImagePyramid)return this.getLevelScale(e)?new t.Point(1,1):new t.Point(0,0);if(this.levelSizes){var i=this.levelSizes[e],n=Math.ceil(i.width/this.getTileWidth(e)),o=Math.ceil(i.height/this.getTileHeight(e));return new t.Point(n,o)}return t.TileSource.prototype.getNumTiles.call(this,e)},getTileAtPoint:function(e,i){if(this.emulateLegacyImagePyramid)return new t.Point(0,0);if(this.levelSizes){var n=i.x>=0&&i.x<=1&&i.y>=0&&i.y<=1/this.aspectRatio;t.console.assert(n,"[TileSource.getTileAtPoint] must be called with a valid point.");var o=this.levelSizes[e].width,r=i.x*o,s=i.y*o,a=Math.floor(r/this.getTileWidth(e)),l=Math.floor(s/this.getTileHeight(e));i.x>=1&&(a=this.getNumTiles(e).x-1);return i.y>=1/this.aspectRatio-1e-15&&(l=this.getNumTiles(e).y-1),new t.Point(a,l)}return t.TileSource.prototype.getTileAtPoint.call(this,e,i)},getTileUrl:function(t,e,i){if(this.emulateLegacyImagePyramid){var n=null;return this.levels.length>0&&t>=this.minLevel&&t<=this.maxLevel&&(n=this.levels[t].url),n}var o,r,s,a,l,c,u,h,p,d,f,v,g,m,y,w=Math.pow(.5,this.maxLevel-t);return this.levelSizes?(o=this.levelSizes[t].width,r=this.levelSizes[t].height):(o=Math.ceil(this.width*w),r=Math.ceil(this.height*w)),s=this.getTileWidth(t),a=this.getTileHeight(t),l=Math.round(s/w),c=Math.round(a/w),y=1===this.version?"native."+this.tileFormat:"default."+this.tileFormat,o<s&&r<a?(v=2===this.version&&o===this.width?"full":3===this.version&&o===this.width&&r===this.height?"max":3===this.version?o+","+r:o+",",u="full"):(h=e*l,p=i*c,d=Math.min(l,this.width-h),f=Math.min(c,this.height-p),u=0===e&&0===i&&d===this.width&&f===this.height?"full":[h,p,d,f].join(","),g=Math.min(s,o-e*s),m=Math.min(a,r-i*a),v=2===this.version&&g===this.width?"full":3===this.version&&g===this.width&&m===this.height?"max":3===this.version?g+","+m:g+","),[this._id,u,v,"0",y].join("/")},__testonly__:{canBeTiled:e,constructLevels:i}})}(a),function(t){t.OsmTileSource=function(e,i,n,o,r){var s;(s=t.isPlainObject(e)?e:{width:arguments[0],height:arguments[1],tileSize:arguments[2],tileOverlap:arguments[3],tilesUrl:arguments[4]}).width&&s.height||(s.width=65572864,s.height=65572864),s.tileSize||(s.tileSize=256,s.tileOverlap=0),s.tilesUrl||(s.tilesUrl="http://tile.openstreetmap.org/"),s.minLevel=8,t.TileSource.apply(this,[s])},t.extend(t.OsmTileSource.prototype,t.TileSource.prototype,{supports:function(t,e){return t.type&&"openstreetmaps"===t.type},configure:function(t,e,i){return t},getTileUrl:function(t,e,i){return this.tilesUrl+(t-8)+"/"+e+"/"+i+".png"}})}(a),function(t){t.TmsTileSource=function(e,i,n,o,r){var s;s=t.isPlainObject(e)?e:{width:arguments[0],height:arguments[1],tileSize:arguments[2],tileOverlap:arguments[3],tilesUrl:arguments[4]};var a,l=256*Math.ceil(s.width/256),c=256*Math.ceil(s.height/256);a=l>c?l/256:c/256,s.maxLevel=Math.ceil(Math.log(a)/Math.log(2))-1,s.tileSize=256,s.width=l,s.height=c,t.TileSource.apply(this,[s])},t.extend(t.TmsTileSource.prototype,t.TileSource.prototype,{supports:function(t,e){return t.type&&"tiledmapservice"===t.type},configure:function(t,e,i){return t},getTileUrl:function(t,e,i){var n=this.getNumTiles(t).y-1;return this.tilesUrl+t+"/"+e+"/"+(n-i)+".png"}})}(a),function(t){t.ZoomifyTileSource=function(t){void 0===t.tileSize&&(t.tileSize=256),void 0===t.fileFormat&&(t.fileFormat="jpg",this.fileFormat=t.fileFormat);var e={x:t.width,y:t.height};for(t.imageSizes=[{x:t.width,y:t.height}],t.gridSize=[this._getGridSize(t.width,t.height,t.tileSize)];parseInt(e.x,10)>t.tileSize||parseInt(e.y,10)>t.tileSize;)e.x=Math.floor(e.x/2),e.y=Math.floor(e.y/2),t.imageSizes.push({x:e.x,y:e.y}),t.gridSize.push(this._getGridSize(e.x,e.y,t.tileSize));t.imageSizes.reverse(),t.gridSize.reverse(),t.minLevel=0,t.maxLevel=t.gridSize.length-1,a.TileSource.apply(this,[t])},t.extend(t.ZoomifyTileSource.prototype,t.TileSource.prototype,{_getGridSize:function(t,e,i){return{x:Math.ceil(t/i),y:Math.ceil(e/i)}},_calculateAbsoluteTileNumber:function(t,e,i){for(var n=0,o={},r=0;r<t;r++)n+=(o=this.gridSize[r]).x*o.y;return n+=(o=this.gridSize[t]).x*i+e},supports:function(t,e){return t.type&&"zoomifytileservice"===t.type},configure:function(t,e,i){return t},getTileUrl:function(t,e,i){var n,o=this._calculateAbsoluteTileNumber(t,e,i);return n=Math.floor(o/256),this.tilesUrl+"TileGroup"+n+"/"+t+"-"+e+"-"+i+"."+this.fileFormat}})}(a),function(t){function e(t,e){return e.levels}t.LegacyTileSource=function(e){var i,n,o;t.isArray(e)&&(i={type:"legacy-image-pyramid",levels:e}),i.levels=function(e){var i,n,o=[];for(n=0;n<e.length;n++)(i=e[n]).height&&i.width&&i.url?o.push({url:i.url,width:Number(i.width),height:Number(i.height)}):t.console.error("Unsupported image format: %s",i.url?i.url:"<no URL>");return o.sort(function(t,e){return t.height-e.height})}(i.levels),i.levels.length>0?(n=i.levels[i.levels.length-1].width,o=i.levels[i.levels.length-1].height):(n=0,o=0,t.console.error("No supported image formats found")),t.extend(!0,i,{width:n,height:o,tileSize:Math.max(o,n),tileOverlap:0,minLevel:0,maxLevel:i.levels.length>0?i.levels.length-1:0}),t.TileSource.apply(this,[i]),this.levels=i.levels},t.extend(t.LegacyTileSource.prototype,t.TileSource.prototype,{supports:function(t,e){return t.type&&"legacy-image-pyramid"===t.type||t.documentElement&&"legacy-image-pyramid"===t.documentElement.getAttribute("type")},configure:function(i,n,o){return t.isPlainObject(i)?e(this,i):function(i,n){if(!n||!n.documentElement)throw new Error(t.getString("Errors.Xml"));var o,r,s=n.documentElement,a=s.tagName,l=null,c=[];if("image"===a)try{for(l={type:s.getAttribute("type"),levels:[]},c=s.getElementsByTagName("level"),r=0;r<c.length;r++)o=c[r],l.levels.push({url:o.getAttribute("url"),width:parseInt(o.getAttribute("width"),10),height:parseInt(o.getAttribute("height"),10)});return e(i,l)}catch(u){throw u instanceof Error?u:new Error("Unknown error parsing Legacy Image Pyramid XML.")}else{if("collection"===a)throw new Error("Legacy Image Pyramid Collections not yet supported.");if("error"===a)throw new Error("Error: "+n)}throw new Error("Unknown element "+a)}(this,i)},getLevelScale:function(t){var e=NaN;return this.levels.length>0&&t>=this.minLevel&&t<=this.maxLevel&&(e=this.levels[t].width/this.levels[this.maxLevel].width),e},getNumTiles:function(e){return this.getLevelScale(e)?new t.Point(1,1):new t.Point(0,0)},getTileUrl:function(t,e,i){var n=null;return this.levels.length>0&&t>=this.minLevel&&t<=this.maxLevel&&(n=this.levels[t].url),n}})}(a),function(t){t.ImageTileSource=function(e){e=t.extend({buildPyramid:!0,crossOriginPolicy:!1,ajaxWithCredentials:!1,useCanvas:!0},e),t.TileSource.apply(this,[e])},t.extend(t.ImageTileSource.prototype,t.TileSource.prototype,{supports:function(t,e){return t.type&&"image"===t.type},configure:function(t,e,i){return t},getImageInfo:function(e){var i=this._image=new Image,n=this;this.crossOriginPolicy&&(i.crossOrigin=this.crossOriginPolicy),this.ajaxWithCredentials&&(i.useCredentials=this.ajaxWithCredentials),t.addEvent(i,"load",function(){n.width=i.naturalWidth,n.height=i.naturalHeight,n.aspectRatio=n.width/n.height,n.dimensions=new t.Point(n.width,n.height),n._tileWidth=n.width,n._tileHeight=n.height,n.tileOverlap=0,n.minLevel=0,n.levels=n._buildLevels(),n.maxLevel=n.levels.length-1,n.ready=!0,n.raiseEvent("ready",{tileSource:n})}),t.addEvent(i,"error",function(){n.raiseEvent("open-failed",{message:"Error loading image at "+e,source:e})}),i.src=e},getLevelScale:function(t){var e=NaN;return t>=this.minLevel&&t<=this.maxLevel&&(e=this.levels[t].width/this.levels[this.maxLevel].width),e},getNumTiles:function(e){return this.getLevelScale(e)?new t.Point(1,1):new t.Point(0,0)},getTileUrl:function(t,e,i){var n=null;return t>=this.minLevel&&t<=this.maxLevel&&(n=this.levels[t].url),n},getContext2D:function(t,e,i){var n=null;return t>=this.minLevel&&t<=this.maxLevel&&(n=this.levels[t].context2D),n},destroy:function(){this._freeupCanvasMemory()},_buildLevels:function(){var e=[{url:this._image.src,width:this._image.naturalWidth,height:this._image.naturalHeight}];if(!this.buildPyramid||!t.supportsCanvas||!this.useCanvas)return delete this._image,e;var i=this._image.naturalWidth,n=this._image.naturalHeight,o=document.createElement("canvas"),r=o.getContext("2d");if(o.width=i,o.height=n,r.drawImage(this._image,0,0,i,n),e[0].context2D=r,delete this._image,t.isCanvasTainted(o))return e;for(;i>=2&&n>=2;){i=Math.floor(i/2),n=Math.floor(n/2);var s=document.createElement("canvas"),a=s.getContext("2d");s.width=i,s.height=n,a.drawImage(o,0,0,i,n),e.splice(0,0,{context2D:a,width:i,height:n}),o=s,r=a}return e},_freeupCanvasMemory:function(){for(var t=0;t<this.levels.length;t++)this.levels[t].context2D&&(this.levels[t].context2D.canvas.height=0,this.levels[t].context2D.canvas.width=0)}})}(a),function(t){t.TileSourceCollection=function(e,i,n,o){t.console.error("TileSourceCollection is deprecated; use World instead")}}(a),function(t){function e(i){t.requestAnimationFrame(function(){!function(i){var n;i.shouldFade&&(n=1-(t.now()-i.fadeBeginTime)/i.fadeLength,n=Math.min(1,n),n=Math.max(0,n),i.imgGroup&&t.setElementOpacity(i.imgGroup,n,!0),n>0&&e(i))}(i)})}function i(e,i){e.element.disabled||(i>=t.ButtonState.GROUP&&e.currentState===t.ButtonState.REST&&(!function(e){e.shouldFade=!1,e.imgGroup&&t.setElementOpacity(e.imgGroup,1,!0)}(e),e.currentState=t.ButtonState.GROUP),i>=t.ButtonState.HOVER&&e.currentState===t.ButtonState.GROUP&&(e.imgHover&&(e.imgHover.style.visibility=""),e.currentState=t.ButtonState.HOVER),i>=t.ButtonState.DOWN&&e.currentState===t.ButtonState.HOVER&&(e.imgDown&&(e.imgDown.style.visibility=""),e.currentState=t.ButtonState.DOWN))}function n(i,n){i.element.disabled||(n<=t.ButtonState.HOVER&&i.currentState===t.ButtonState.DOWN&&(i.imgDown&&(i.imgDown.style.visibility="hidden"),i.currentState=t.ButtonState.HOVER),n<=t.ButtonState.GROUP&&i.currentState===t.ButtonState.HOVER&&(i.imgHover&&(i.imgHover.style.visibility="hidden"),i.currentState=t.ButtonState.GROUP),n<=t.ButtonState.REST&&i.currentState===t.ButtonState.GROUP&&(!function(i){i.shouldFade=!0,i.fadeBeginTime=t.now()+i.fadeDelay,window.setTimeout(function(){e(i)},i.fadeDelay)}(i),i.currentState=t.ButtonState.REST))}t.ButtonState={REST:0,GROUP:1,HOVER:2,DOWN:3},t.Button=function(e){var o=this;t.EventSource.call(this),t.extend(!0,this,{tooltip:null,srcRest:null,srcGroup:null,srcHover:null,srcDown:null,clickTimeThreshold:t.DEFAULT_SETTINGS.clickTimeThreshold,clickDistThreshold:t.DEFAULT_SETTINGS.clickDistThreshold,fadeDelay:0,fadeLength:2e3,onPress:null,onRelease:null,onClick:null,onEnter:null,onExit:null,onFocus:null,onBlur:null,userData:null},e),this.element=e.element||t.makeNeutralElement("div"),e.element||(this.imgRest=t.makeTransparentImage(this.srcRest),this.imgGroup=t.makeTransparentImage(this.srcGroup),this.imgHover=t.makeTransparentImage(this.srcHover),this.imgDown=t.makeTransparentImage(this.srcDown),this.imgRest.alt=this.imgGroup.alt=this.imgHover.alt=this.imgDown.alt=this.tooltip,t.setElementPointerEventsNone(this.imgRest),t.setElementPointerEventsNone(this.imgGroup),t.setElementPointerEventsNone(this.imgHover),t.setElementPointerEventsNone(this.imgDown),this.element.style.position="relative",t.setElementTouchActionNone(this.element),this.imgGroup.style.position=this.imgHover.style.position=this.imgDown.style.position="absolute",this.imgGroup.style.top=this.imgHover.style.top=this.imgDown.style.top="0px",this.imgGroup.style.left=this.imgHover.style.left=this.imgDown.style.left="0px",this.imgHover.style.visibility=this.imgDown.style.visibility="hidden",t.Browser.vendor===t.BROWSERS.FIREFOX&&t.Browser.version<3&&(this.imgGroup.style.top=this.imgHover.style.top=this.imgDown.style.top=""),this.element.appendChild(this.imgRest),this.element.appendChild(this.imgGroup),this.element.appendChild(this.imgHover),this.element.appendChild(this.imgDown)),this.addHandler("press",this.onPress),this.addHandler("release",this.onRelease),this.addHandler("click",this.onClick),this.addHandler("enter",this.onEnter),this.addHandler("exit",this.onExit),this.addHandler("focus",this.onFocus),this.addHandler("blur",this.onBlur),this.currentState=t.ButtonState.GROUP,this.fadeBeginTime=null,this.shouldFade=!1,this.element.style.display="inline-block",this.element.style.position="relative",this.element.title=this.tooltip,this.tracker=new t.MouseTracker({userData:"Button.tracker",element:this.element,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,enterHandler:function(e){e.insideElementPressed?(i(o,t.ButtonState.DOWN),o.raiseEvent("enter",{originalEvent:e.originalEvent})):e.buttonDownAny||i(o,t.ButtonState.HOVER)},focusHandler:function(t){o.tracker.enterHandler(t),o.raiseEvent("focus",{originalEvent:t.originalEvent})},leaveHandler:function(e){n(o,t.ButtonState.GROUP),e.insideElementPressed&&o.raiseEvent("exit",{originalEvent:e.originalEvent})},blurHandler:function(t){o.tracker.leaveHandler(t),o.raiseEvent("blur",{originalEvent:t.originalEvent})},pressHandler:function(e){i(o,t.ButtonState.DOWN),o.raiseEvent("press",{originalEvent:e.originalEvent})},releaseHandler:function(e){e.insideElementPressed&&e.insideElementReleased?(n(o,t.ButtonState.HOVER),o.raiseEvent("release",{originalEvent:e.originalEvent})):e.insideElementPressed?n(o,t.ButtonState.GROUP):i(o,t.ButtonState.HOVER)},clickHandler:function(t){t.quick&&o.raiseEvent("click",{originalEvent:t.originalEvent})},keyHandler:function(t){13===t.keyCode?(o.raiseEvent("click",{originalEvent:t.originalEvent}),o.raiseEvent("release",{originalEvent:t.originalEvent}),t.preventDefault=!0):t.preventDefault=!1}}),n(this,t.ButtonState.REST)},t.extend(t.Button.prototype,t.EventSource.prototype,{notifyGroupEnter:function(){i(this,t.ButtonState.GROUP)},notifyGroupExit:function(){n(this,t.ButtonState.REST)},disable:function(){this.notifyGroupExit(),this.element.disabled=!0,this.tracker.setTracking(!1),t.setElementOpacity(this.element,.2,!0)},enable:function(){this.element.disabled=!1,this.tracker.setTracking(!0),t.setElementOpacity(this.element,1,!0),this.notifyGroupEnter()},destroy:function(){this.imgRest&&(this.element.removeChild(this.imgRest),this.imgRest=null),this.imgGroup&&(this.element.removeChild(this.imgGroup),this.imgGroup=null),this.imgHover&&(this.element.removeChild(this.imgHover),this.imgHover=null),this.imgDown&&(this.element.removeChild(this.imgDown),this.imgDown=null),this.removeAllHandlers(),this.tracker.destroy(),this.element=null}})}(a),function(t){t.ButtonGroup=function(e){t.extend(!0,this,{buttons:[],clickTimeThreshold:t.DEFAULT_SETTINGS.clickTimeThreshold,clickDistThreshold:t.DEFAULT_SETTINGS.clickDistThreshold,labelText:""},e);var i,n=this.buttons.concat([]),o=this;if(this.element=e.element||t.makeNeutralElement("div"),!e.group)for(this.element.style.display="inline-block",i=0;i<n.length;i++)this.element.appendChild(n[i].element);t.setElementTouchActionNone(this.element),this.tracker=new t.MouseTracker({userData:"ButtonGroup.tracker",element:this.element,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,enterHandler:function(t){var e;for(e=0;e<o.buttons.length;e++)o.buttons[e].notifyGroupEnter()},leaveHandler:function(t){var e;if(!t.insideElementPressed)for(e=0;e<o.buttons.length;e++)o.buttons[e].notifyGroupExit()}})},t.ButtonGroup.prototype={addButton:function(t){this.buttons.push(t),this.element.appendChild(t.element)},emulateEnter:function(){this.tracker.enterHandler({eventSource:this.tracker})},emulateLeave:function(){this.tracker.leaveHandler({eventSource:this.tracker})},destroy:function(){for(;this.buttons.length;){var t=this.buttons.pop();this.element.removeChild(t.element),t.destroy()}this.tracker.destroy(),this.element=null}}}(a),function(t){t.Rect=function(e,i,n,o,r){var s,a;this.x="number"==typeof e?e:0,this.y="number"==typeof i?i:0,this.width="number"==typeof n?n:0,this.height="number"==typeof o?o:0,this.degrees="number"==typeof r?r:0,this.degrees=t.positiveModulo(this.degrees,360),this.degrees>=270?(s=this.getTopRight(),this.x=s.x,this.y=s.y,a=this.height,this.height=this.width,this.width=a,this.degrees-=270):this.degrees>=180?(s=this.getBottomRight(),this.x=s.x,this.y=s.y,this.degrees-=180):this.degrees>=90&&(s=this.getBottomLeft(),this.x=s.x,this.y=s.y,a=this.height,this.height=this.width,this.width=a,this.degrees-=90)},t.Rect.fromSummits=function(e,i,n){var o=e.distanceTo(i),r=e.distanceTo(n),s=i.minus(e),a=Math.atan(s.y/s.x);return s.x<0?a+=Math.PI:s.y<0&&(a+=2*Math.PI),new t.Rect(e.x,e.y,o,r,a/Math.PI*180)},t.Rect.prototype={clone:function(){return new t.Rect(this.x,this.y,this.width,this.height,this.degrees)},getAspectRatio:function(){return this.width/this.height},getTopLeft:function(){return new t.Point(this.x,this.y)},getBottomRight:function(){return new t.Point(this.x+this.width,this.y+this.height).rotate(this.degrees,this.getTopLeft())},getTopRight:function(){return new t.Point(this.x+this.width,this.y).rotate(this.degrees,this.getTopLeft())},getBottomLeft:function(){return new t.Point(this.x,this.y+this.height).rotate(this.degrees,this.getTopLeft())},getCenter:function(){return new t.Point(this.x+this.width/2,this.y+this.height/2).rotate(this.degrees,this.getTopLeft())},getSize:function(){return new t.Point(this.width,this.height)},equals:function(e){return e instanceof t.Rect&&this.x===e.x&&this.y===e.y&&this.width===e.width&&this.height===e.height&&this.degrees===e.degrees},times:function(e){return new t.Rect(this.x*e,this.y*e,this.width*e,this.height*e,this.degrees)},translate:function(e){return new t.Rect(this.x+e.x,this.y+e.y,this.width,this.height,this.degrees)},union:function(e){var i=this.getBoundingBox(),n=e.getBoundingBox(),o=Math.min(i.x,n.x),r=Math.min(i.y,n.y),s=Math.max(i.x+i.width,n.x+n.width),a=Math.max(i.y+i.height,n.y+n.height);return new t.Rect(o,r,s-o,a-r)},intersection:function(e){var i=1e-10,n=[],o=this.getTopLeft();e.containsPoint(o,i)&&n.push(o);var r=this.getTopRight();e.containsPoint(r,i)&&n.push(r);var s=this.getBottomLeft();e.containsPoint(s,i)&&n.push(s);var a=this.getBottomRight();e.containsPoint(a,i)&&n.push(a);var l=e.getTopLeft();this.containsPoint(l,i)&&n.push(l);var c=e.getTopRight();this.containsPoint(c,i)&&n.push(c);var u=e.getBottomLeft();this.containsPoint(u,i)&&n.push(u);var h=e.getBottomRight();this.containsPoint(h,i)&&n.push(h);for(var p=this._getSegments(),d=e._getSegments(),f=0;f<p.length;f++)for(var v=p[f],g=0;g<d.length;g++){var m=d[g],y=w(v[0],v[1],m[0],m[1]);y&&n.push(y)}function w(e,n,o,r){var s=n.minus(e),a=r.minus(o),l=-a.x*s.y+s.x*a.y;if(0===l)return null;var c=(s.x*(e.y-o.y)-s.y*(e.x-o.x))/l,u=(a.x*(e.y-o.y)-a.y*(e.x-o.x))/l;return-1e-10<=c&&c<=1-i&&-1e-10<=u&&u<=1-i?new t.Point(e.x+u*s.x,e.y+u*s.y):null}if(0===n.length)return null;for(var x=n[0].x,b=n[0].x,T=n[0].y,P=n[0].y,S=1;S<n.length;S++){var E=n[S];E.x<x&&(x=E.x),E.x>b&&(b=E.x),E.y<T&&(T=E.y),E.y>P&&(P=E.y)}return new t.Rect(x,T,b-x,P-T)},_getSegments:function(){var t=this.getTopLeft(),e=this.getTopRight(),i=this.getBottomLeft(),n=this.getBottomRight();return[[t,e],[e,n],[n,i],[i,t]]},rotate:function(e,i){if(0===(e=t.positiveModulo(e,360)))return this.clone();i=i||this.getCenter();var n=this.getTopLeft().rotate(e,i),o=this.getTopRight().rotate(e,i).minus(n);o=o.apply(function(t){return Math.abs(t)<1e-15?0:t});var r=Math.atan(o.y/o.x);return o.x<0?r+=Math.PI:o.y<0&&(r+=2*Math.PI),new t.Rect(n.x,n.y,this.width,this.height,r/Math.PI*180)},getBoundingBox:function(){if(0===this.degrees)return this.clone();var e=this.getTopLeft(),i=this.getTopRight(),n=this.getBottomLeft(),o=this.getBottomRight(),r=Math.min(e.x,i.x,n.x,o.x),s=Math.max(e.x,i.x,n.x,o.x),a=Math.min(e.y,i.y,n.y,o.y),l=Math.max(e.y,i.y,n.y,o.y);return new t.Rect(r,a,s-r,l-a)},getIntegerBoundingBox:function(){var e=this.getBoundingBox(),i=Math.floor(e.x),n=Math.floor(e.y),o=Math.ceil(e.width+e.x-i),r=Math.ceil(e.height+e.y-n);return new t.Rect(i,n,o,r)},containsPoint:function(t,e){e=e||0;var i=this.getTopLeft(),n=this.getTopRight(),o=this.getBottomLeft(),r=n.minus(i),s=o.minus(i);return(t.x-i.x)*r.x+(t.y-i.y)*r.y>=-e&&(t.x-n.x)*r.x+(t.y-n.y)*r.y<=e&&(t.x-i.x)*s.x+(t.y-i.y)*s.y>=-e&&(t.x-o.x)*s.x+(t.y-o.y)*s.y<=e},toString:function(){return"["+Math.round(100*this.x)/100+", "+Math.round(100*this.y)/100+", "+Math.round(100*this.width)/100+"x"+Math.round(100*this.height)/100+", "+Math.round(100*this.degrees)/100+"deg]"}}}(a),function(t){var e={};function i(t){var e;t.quick&&(e="horizontal"===this.scroll?Math.floor(t.position.x/(this.panelWidth+4)):Math.floor(t.position.y/this.panelHeight),this.viewer.goToPage(e));this.element.focus()}function n(e){if(this.dragging=!0,this.element){var i=Number(this.element.style.marginLeft.replace("px","")),n=Number(this.element.style.marginTop.replace("px","")),o=Number(this.element.style.width.replace("px","")),s=Number(this.element.style.height.replace("px","")),a=t.getElementSize(this.viewer.canvas);"horizontal"===this.scroll?-e.delta.x>0?i>-(o-a.x)&&(this.element.style.marginLeft=i+2*e.delta.x+"px",r(this,a.x,i+2*e.delta.x)):-e.delta.x<0&&i<0&&(this.element.style.marginLeft=i+2*e.delta.x+"px",r(this,a.x,i+2*e.delta.x)):-e.delta.y>0?n>-(s-a.y)&&(this.element.style.marginTop=n+2*e.delta.y+"px",r(this,a.y,n+2*e.delta.y)):-e.delta.y<0&&n<0&&(this.element.style.marginTop=n+2*e.delta.y+"px",r(this,a.y,n+2*e.delta.y))}}function o(e){if(this.element){var i=Number(this.element.style.marginLeft.replace("px","")),n=Number(this.element.style.marginTop.replace("px","")),o=Number(this.element.style.width.replace("px","")),s=Number(this.element.style.height.replace("px","")),a=t.getElementSize(this.viewer.canvas);"horizontal"===this.scroll?e.scroll>0?i>-(o-a.x)&&(this.element.style.marginLeft=i-60*e.scroll+"px",r(this,a.x,i-60*e.scroll)):e.scroll<0&&i<0&&(this.element.style.marginLeft=i-60*e.scroll+"px",r(this,a.x,i-60*e.scroll)):e.scroll<0?n>a.y-s&&(this.element.style.marginTop=n+60*e.scroll+"px",r(this,a.y,n+60*e.scroll)):e.scroll>0&&n<0&&(this.element.style.marginTop=n+60*e.scroll+"px",r(this,a.y,n+60*e.scroll)),e.preventDefault=!0}}function r(e,i,n){var o,r,s,a,l,c;for(o="horizontal"===e.scroll?e.panelWidth:e.panelHeight,r=Math.ceil(i/o)+5,l=r=(r=(s=Math.ceil((Math.abs(n)+i)/o)+1)-r)<0?0:r;l<s&&l<e.panels.length;l++)if(!(c=e.panels[l]).activePanel){var u,h=e.viewer.tileSources[l];u=h.referenceStripThumbnailUrl?{type:"image",url:h.referenceStripThumbnailUrl}:h,a=new t.Viewer({id:c.id,tileSources:[u],element:c,navigatorSizeRatio:e.sizeRatio,showNavigator:!1,mouseNavEnabled:!1,showNavigationControl:!1,showSequenceControl:!1,immediateRender:!0,blendTime:0,animationTime:0,loadTilesWithAjax:e.viewer.loadTilesWithAjax,ajaxHeaders:e.viewer.ajaxHeaders,useCanvas:e.useCanvas}),t.setElementPointerEventsNone(a.canvas),t.setElementPointerEventsNone(a.container),a.innerTracker.setTracking(!1),a.outerTracker.setTracking(!1),e.miniViewers[c.id]=a,c.activePanel=!0}}function s(t){var e=t.eventSource.element;"horizontal"===this.scroll?e.style.marginBottom="0px":e.style.marginLeft="0px"}function a(e){var i=e.eventSource.element;"horizontal"===this.scroll?i.style.marginBottom="-"+t.getElementSize(i).y/2+"px":i.style.marginLeft="-"+t.getElementSize(i).x/2+"px"}function l(t){if(t.ctrl||t.alt||t.meta)t.preventDefault=!1;else switch(t.keyCode){case 38:case 39:o.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null}),t.preventDefault=!0;break;case 40:case 37:o.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null}),t.preventDefault=!0;break;default:t.preventDefault=!1}}function c(t){if(t.ctrl||t.alt||t.meta)t.preventDefault=!1;else switch(t.keyCode){case 61:case 48:case 119:case 87:case 100:o.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null}),t.preventDefault=!0;break;case 45:case 115:case 83:case 97:o.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null}),t.preventDefault=!0;break;default:t.preventDefault=!1}}t.ReferenceStrip=function(u){var h,p,d,f=u.viewer,v=t.getElementSize(f.element);for(u.id||(u.id="referencestrip-"+t.now(),this.element=t.makeNeutralElement("div"),this.element.id=u.id,this.element.className="referencestrip"),u=t.extend(!0,{sizeRatio:t.DEFAULT_SETTINGS.referenceStripSizeRatio,position:t.DEFAULT_SETTINGS.referenceStripPosition,scroll:t.DEFAULT_SETTINGS.referenceStripScroll,clickTimeThreshold:t.DEFAULT_SETTINGS.clickTimeThreshold},u,{element:this.element}),t.extend(this,u),e[this.id]={animating:!1},this.minPixelRatio=this.viewer.minPixelRatio,this.element.tabIndex=0,(p=this.element.style).marginTop="0px",p.marginRight="0px",p.marginBottom="0px",p.marginLeft="0px",p.left="0px",p.bottom="0px",p.border="0px",p.background="#000",p.position="relative",t.setElementTouchActionNone(this.element),t.setElementOpacity(this.element,.8),this.viewer=f,this.tracker=new t.MouseTracker({userData:"ReferenceStrip.tracker",element:this.element,clickHandler:t.delegate(this,i),dragHandler:t.delegate(this,n),scrollHandler:t.delegate(this,o),enterHandler:t.delegate(this,s),leaveHandler:t.delegate(this,a),keyDownHandler:t.delegate(this,l),keyHandler:t.delegate(this,c),preProcessEventHandler:function(t){"wheel"===t.eventType&&(t.preventDefault=!0)}}),u.width&&u.height?(this.element.style.width=u.width+"px",this.element.style.height=u.height+"px",f.addControl(this.element,{anchor:t.ControlAnchor.BOTTOM_LEFT})):"horizontal"===u.scroll?(this.element.style.width=v.x*u.sizeRatio*f.tileSources.length+12*f.tileSources.length+"px",this.element.style.height=v.y*u.sizeRatio+"px",f.addControl(this.element,{anchor:t.ControlAnchor.BOTTOM_LEFT})):(this.element.style.height=v.y*u.sizeRatio*f.tileSources.length+12*f.tileSources.length+"px",this.element.style.width=v.x*u.sizeRatio+"px",f.addControl(this.element,{anchor:t.ControlAnchor.TOP_LEFT})),this.panelWidth=v.x*this.sizeRatio+8,this.panelHeight=v.y*this.sizeRatio+8,this.panels=[],this.miniViewers={},d=0;d<f.tileSources.length;d++)(h=t.makeNeutralElement("div")).id=this.element.id+"-"+d,h.style.width=this.panelWidth+"px",h.style.height=this.panelHeight+"px",h.style.display="inline",h.style.float="left",h.style.cssFloat="left",h.style.styleFloat="left",h.style.padding="2px",t.setElementTouchActionNone(h),t.setElementPointerEventsNone(h),this.element.appendChild(h),h.activePanel=!1,this.panels.push(h);r(this,"vertical"===this.scroll?v.y:v.x,0),this.setFocus(0)},t.ReferenceStrip.prototype={setFocus:function(e){var i,n=this.element.querySelector("#"+this.element.id+"-"+e),o=t.getElementSize(this.viewer.canvas),a=Number(this.element.style.width.replace("px","")),l=Number(this.element.style.height.replace("px","")),c=-Number(this.element.style.marginLeft.replace("px","")),u=-Number(this.element.style.marginTop.replace("px",""));this.currentSelected!==n&&(this.currentSelected&&(this.currentSelected.style.background="#000"),this.currentSelected=n,this.currentSelected.style.background="#999","horizontal"===this.scroll?(i=Number(e)*(this.panelWidth+3))>c+o.x-this.panelWidth?(i=Math.min(i,a-o.x),this.element.style.marginLeft=-i+"px",r(this,o.x,-i)):i<c&&(i=Math.max(0,i-o.x/2),this.element.style.marginLeft=-i+"px",r(this,o.x,-i)):(i=Number(e)*(this.panelHeight+3))>u+o.y-this.panelHeight?(i=Math.min(i,l-o.y),this.element.style.marginTop=-i+"px",r(this,o.y,-i)):i<u&&(i=Math.max(0,i-o.y/2),this.element.style.marginTop=-i+"px",r(this,o.y,-i)),this.currentPage=e,s.call(this,{eventSource:this.tracker}))},update:function(){return!!e[this.id].animating},destroy:function(){if(this.miniViewers)for(var t in this.miniViewers)this.miniViewers[t].destroy();this.tracker.destroy(),this.element&&this.viewer.removeControl(this.element)}}}(a),function(t){t.DisplayRect=function(e,i,n,o,r,s){t.Rect.apply(this,[e,i,n,o]),this.minLevel=r,this.maxLevel=s},t.extend(t.DisplayRect.prototype,t.Rect.prototype)}(a),function(t){t.Spring=function(e){var i=arguments;"object"!=typeof e&&(e={initial:i.length&&"number"==typeof i[0]?i[0]:void 0,springStiffness:i.length>1?i[1].springStiffness:5,animationTime:i.length>1?i[1].animationTime:1.5}),t.console.assert("number"==typeof e.springStiffness&&0!==e.springStiffness,"[OpenSeadragon.Spring] options.springStiffness must be a non-zero number"),t.console.assert("number"==typeof e.animationTime&&e.animationTime>=0,"[OpenSeadragon.Spring] options.animationTime must be a number greater than or equal to 0"),e.exponential&&(this._exponential=!0,delete e.exponential),t.extend(!0,this,e),this.current={value:"number"==typeof this.initial?this.initial:this._exponential?0:1,time:t.now()},t.console.assert(!this._exponential||0!==this.current.value,"[OpenSeadragon.Spring] value must be non-zero for exponential springs"),this.start={value:this.current.value,time:this.current.time},this.target={value:this.current.value,time:this.current.time},this._exponential&&(this.start._logValue=Math.log(this.start.value),this.target._logValue=Math.log(this.target.value),this.current._logValue=Math.log(this.current.value))},t.Spring.prototype={resetTo:function(e){t.console.assert(!this._exponential||0!==e,"[OpenSeadragon.Spring.resetTo] target must be non-zero for exponential springs"),this.start.value=this.target.value=this.current.value=e,this.start.time=this.target.time=this.current.time=t.now(),this._exponential&&(this.start._logValue=Math.log(this.start.value),this.target._logValue=Math.log(this.target.value),this.current._logValue=Math.log(this.current.value))},springTo:function(e){t.console.assert(!this._exponential||0!==e,"[OpenSeadragon.Spring.springTo] target must be non-zero for exponential springs"),this.start.value=this.current.value,this.start.time=this.current.time,this.target.value=e,this.target.time=this.start.time+1e3*this.animationTime,this._exponential&&(this.start._logValue=Math.log(this.start.value),this.target._logValue=Math.log(this.target.value))},shiftBy:function(e){this.start.value+=e,this.target.value+=e,this._exponential&&(t.console.assert(0!==this.target.value&&0!==this.start.value,"[OpenSeadragon.Spring.shiftBy] spring value must be non-zero for exponential springs"),this.start._logValue=Math.log(this.start.value),this.target._logValue=Math.log(this.target.value))},setExponential:function(e){this._exponential=e,this._exponential&&(t.console.assert(0!==this.current.value&&0!==this.target.value&&0!==this.start.value,"[OpenSeadragon.Spring.setExponential] spring value must be non-zero for exponential springs"),this.start._logValue=Math.log(this.start.value),this.target._logValue=Math.log(this.target.value),this.current._logValue=Math.log(this.current.value))},update:function(){var e,i;this.current.time=t.now(),this._exponential?(e=this.start._logValue,i=this.target._logValue):(e=this.start.value,i=this.target.value);var n,o,r=this.current.time>=this.target.time?i:e+(i-e)*(n=this.springStiffness,o=(this.current.time-this.start.time)/(this.target.time-this.start.time),(1-Math.exp(n*-o))/(1-Math.exp(-n))),s=this.current.value;return this._exponential?this.current.value=Math.exp(r):this.current.value=r,s!==this.current.value},isAtTargetValue:function(){return this.current.value===this.target.value}}}(a),function(t){t.ImageJob=function(e){t.extend(!0,this,{timeout:t.DEFAULT_SETTINGS.timeout,jobId:null,tries:0},e),this.data=null,this.userData={},this.errorMsg=null},t.ImageJob.prototype={start:function(){this.tries++;var t=this,e=this.abort;this.jobId=window.setTimeout(function(){t.finish(null,null,"Image load exceeded timeout ("+t.timeout+" ms)")},this.timeout),this.abort=function(){t.source.downloadTileAbort(t),"function"==typeof e&&e()},this.source.downloadTileStart(this)},finish:function(t,e,i){this.data=t,this.request=e,this.errorMsg=i,this.jobId&&window.clearTimeout(this.jobId),this.callback(this)}},t.ImageLoader=function(e){t.extend(!0,this,{jobLimit:t.DEFAULT_SETTINGS.imageLoaderLimit,timeout:t.DEFAULT_SETTINGS.timeout,jobQueue:[],failedTiles:[],jobsInProgress:0},e)},t.ImageLoader.prototype={addJob:function(e){if(!e.source){t.console.error("ImageLoader.prototype.addJob() requires [options.source]. TileSource since new API defines how images are fetched. Creating a dummy TileSource.");var i=t.TileSource.prototype;e.source={downloadTileStart:i.downloadTileStart,downloadTileAbort:i.downloadTileAbort}}var n=this,o={src:e.src,tile:e.tile||{},source:e.source,loadWithAjax:e.loadWithAjax,ajaxHeaders:e.loadWithAjax?e.ajaxHeaders:null,crossOriginPolicy:e.crossOriginPolicy,ajaxWithCredentials:e.ajaxWithCredentials,postData:e.postData,callback:function(t){!function(t,e,i){""!==e.errorMsg&&(null===e.data||void 0===e.data)&&e.tries<1+t.tileRetryMax&&t.failedTiles.push(e);var n;t.jobsInProgress--,(!t.jobLimit||t.jobsInProgress<t.jobLimit)&&t.jobQueue.length>0&&((n=t.jobQueue.shift()).start(),t.jobsInProgress++);t.tileRetryMax>0&&0===t.jobQueue.length&&(!t.jobLimit||t.jobsInProgress<t.jobLimit)&&t.failedTiles.length>0&&(n=t.failedTiles.shift(),setTimeout(function(){n.start()},t.tileRetryDelay),t.jobsInProgress++);i(e.data,e.errorMsg,e.request)}(n,t,e.callback)},abort:e.abort,timeout:this.timeout},r=new t.ImageJob(o);!this.jobLimit||this.jobsInProgress<this.jobLimit?(r.start(),this.jobsInProgress++):this.jobQueue.push(r)},clear:function(){for(var t=0;t<this.jobQueue.length;t++){var e=this.jobQueue[t];"function"==typeof e.abort&&e.abort()}this.jobQueue=[]}}}(a),function(t){t.Tile=function(e,i,n,o,r,s,a,l,c,u,h,p){this.level=e,this.x=i,this.y=n,this.bounds=o,this.sourceBounds=u,this.exists=r,this._url=s,this.postData=h,this.context2D=a,this.loadWithAjax=l,this.ajaxHeaders=c,void 0===p&&(t.console.warn("Tile constructor needs 'cacheKey' variable: creation tile cache in Tile class is deprecated. TileSource.prototype.getTileHashKey will be used."),p=t.TileSource.prototype.getTileHashKey(e,i,n,s,c,h)),this.cacheKey=p,this.loaded=!1,this.loading=!1,this.element=null,this.imgElement=null,this.style=null,this.position=null,this.size=null,this.flipped=!1,this.blendStart=null,this.opacity=null,this.squaredDistance=null,this.visibility=null,this.hasTransparency=!1,this.beingDrawn=!1,this.lastTouchTime=0,this.isRightMost=!1,this.isBottomMost=!1},t.Tile.prototype={toString:function(){return this.level+"/"+this.x+"_"+this.y},_hasTransparencyChannel:function(){return!!this.context2D||this.getUrl().match(".png")},drawHTML:function(e){if(this.cacheImageRecord)if(this.loaded){if(!this.element){var i=this.getImage();if(!i)return;this.element=t.makeNeutralElement("div"),this.imgElement=i.cloneNode(),this.imgElement.style.msInterpolationMode="nearest-neighbor",this.imgElement.style.width="100%",this.imgElement.style.height="100%",this.style=this.element.style,this.style.position="absolute"}this.element.parentNode!==e&&e.appendChild(this.element),this.imgElement.parentNode!==this.element&&this.element.appendChild(this.imgElement),this.style.top=this.position.y+"px",this.style.left=this.position.x+"px",this.style.height=this.size.y+"px",this.style.width=this.size.x+"px",this.flipped&&(this.style.transform="scaleX(-1)"),t.setElementOpacity(this.element,this.opacity)}else t.console.warn("Attempting to draw tile %s when it's not yet loaded.",this.toString());else t.console.warn("[Tile.drawHTML] attempting to draw tile %s when it's not cached",this.toString())},get image(){return t.console.error("[Tile.image] property has been deprecated. Use [Tile.prototype.getImage] instead."),this.getImage()},get url(){return t.console.error("[Tile.url] property has been deprecated. Use [Tile.prototype.getUrl] instead."),this.getUrl()},getImage:function(){return this.cacheImageRecord.getImage()},getUrl:function(){return"function"==typeof this._url?this._url():this._url},getCanvasContext:function(){return this.context2D||this.cacheImageRecord.getRenderedContext()},drawCanvas:function(e,i,n,o,r,s){var a,l,c,u=this.position.times(t.pixelDensityRatio),h=this.size.times(t.pixelDensityRatio);this.context2D||this.cacheImageRecord?(a=this.getCanvasContext(),this.loaded&&a?(e.save(),e.globalAlpha=this.opacity,"number"==typeof n&&1!==n&&(u=u.times(n),h=h.times(n)),o instanceof t.Point&&(u=u.plus(o)),1===e.globalAlpha&&this.hasTransparency&&(r&&(u.x=Math.round(u.x),u.y=Math.round(u.y),h.x=Math.round(h.x),h.y=Math.round(h.y)),e.clearRect(u.x,u.y,h.x,h.y)),this.sourceBounds?(l=Math.min(this.sourceBounds.width,a.canvas.width),c=Math.min(this.sourceBounds.height,a.canvas.height)):(l=a.canvas.width,c=a.canvas.height),e.translate(u.x+h.x/2,0),this.flipped&&e.scale(-1,1),i({context:e,tile:this,rendered:a,initRendered:this.cacheImageRecord?this.cacheImageRecord.getCopyRenderedContext():void 0,sourceWidth:l,sourceHeight:c,position:{original:u,x:-h.x/2,y:u.y},size:h,pixelDensityRatio:t.pixelDensityRatio}),e.restore()):t.console.warn("Attempting to draw tile %s when it's not yet loaded.",this.toString())):t.console.warn("[Tile.drawCanvas] attempting to draw tile %s when it's not cached",this.toString())},getScaleForEdgeSmoothing:function(){var e;if(this.cacheImageRecord)e=this.cacheImageRecord.getRenderedContext();else{if(!this.context2D)return t.console.warn("[Tile.drawCanvas] attempting to get tile scale %s when tile's not cached",this.toString()),1;e=this.context2D}return e.canvas.width/(this.size.x*t.pixelDensityRatio)},getTranslationForEdgeSmoothing:function(e,i,n){var o=Math.max(1,Math.ceil((n.x-i.x)/2)),r=Math.max(1,Math.ceil((n.y-i.y)/2));return new t.Point(o,r).minus(this.position.times(t.pixelDensityRatio).times(e||1).apply(function(t){return t%1}))},unload:function(){this.imgElement&&this.imgElement.parentNode&&this.imgElement.parentNode.removeChild(this.imgElement),this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.element=null,this.imgElement=null,this.loaded=!1,this.loading=!1}}}(a),function(t){t.OverlayPlacement=t.Placement,t.OverlayRotationMode=t.freezeObject({NO_ROTATION:1,EXACT:2,BOUNDING_BOX:3}),t.Overlay=function(e,i,n){var o;o=t.isPlainObject(e)?e:{element:e,location:i,placement:n},this.element=o.element,this.style=o.element.style,this._init(o)},t.Overlay.prototype={_init:function(e){this.location=e.location,this.placement=void 0===e.placement?t.Placement.TOP_LEFT:e.placement,this.onDraw=e.onDraw,this.checkResize=void 0===e.checkResize||e.checkResize,this.width=void 0===e.width?null:e.width,this.height=void 0===e.height?null:e.height,this.rotationMode=e.rotationMode||t.OverlayRotationMode.EXACT,this.location instanceof t.Rect&&(this.width=this.location.width,this.height=this.location.height,this.location=this.location.getTopLeft(),this.placement=t.Placement.TOP_LEFT),this.scales=null!==this.width&&null!==this.height,this.bounds=new t.Rect(this.location.x,this.location.y,this.width,this.height),this.position=this.location},adjust:function(e,i){var n=t.Placement.properties[this.placement];n&&(n.isHorizontallyCentered?e.x-=i.x/2:n.isRight&&(e.x-=i.x),n.isVerticallyCentered?e.y-=i.y/2:n.isBottom&&(e.y-=i.y))},destroy:function(){var e=this.element,i=this.style;e.parentNode&&(e.parentNode.removeChild(e),e.prevElementParent&&(i.display="none",document.body.appendChild(e))),this.onDraw=null,i.top="",i.left="",i.position="",null!==this.width&&(i.width=""),null!==this.height&&(i.height="");var n=t.getCssPropertyWithVendorPrefix("transformOrigin"),o=t.getCssPropertyWithVendorPrefix("transform");n&&o&&(i[n]="",i[o]="")},drawHTML:function(e,i){var n=this.element;n.parentNode!==e&&(n.prevElementParent=n.parentNode,n.prevNextSibling=n.nextSibling,e.appendChild(n),this.style.position="absolute",this.size=t.getElementSize(n));var o=this._getOverlayPositionAndSize(i),r=o.position,s=this.size=o.size,a=o.rotate;if(this.onDraw)this.onDraw(r,s,this.element);else{var l=this.style;l.left=r.x+"px",l.top=r.y+"px",null!==this.width&&(l.width=s.x+"px"),null!==this.height&&(l.height=s.y+"px");var c=t.getCssPropertyWithVendorPrefix("transformOrigin"),u=t.getCssPropertyWithVendorPrefix("transform");c&&u&&(a?(l[c]=this._getTransformOrigin(),l[u]="rotate("+a+"deg)"):(l[c]="",l[u]="")),l.display="block"}},_getOverlayPositionAndSize:function(e){var i=e.pixelFromPoint(this.location,!0),n=this._getSizeInPixels(e);this.adjust(i,n);var o=0;if(e.getRotation(!0)&&this.rotationMode!==t.OverlayRotationMode.NO_ROTATION)if(this.rotationMode===t.OverlayRotationMode.BOUNDING_BOX&&null!==this.width&&null!==this.height){var r=new t.Rect(i.x,i.y,n.x,n.y),s=this._getBoundingBox(r,e.getRotation(!0));i=s.getTopLeft(),n=s.getSize()}else o=e.getRotation(!0);return{position:i,size:n,rotate:o}},_getSizeInPixels:function(e){var i=this.size.x,n=this.size.y;if(null!==this.width||null!==this.height){var o=e.deltaPixelsFromPointsNoRotate(new t.Point(this.width||0,this.height||0),!0);null!==this.width&&(i=o.x),null!==this.height&&(n=o.y)}if(this.checkResize&&(null===this.width||null===this.height)){var r=this.size=t.getElementSize(this.element);null===this.width&&(i=r.x),null===this.height&&(n=r.y)}return new t.Point(i,n)},_getBoundingBox:function(t,e){var i=this._getPlacementPoint(t);return t.rotate(e,i).getBoundingBox()},_getPlacementPoint:function(e){var i=new t.Point(e.x,e.y),n=t.Placement.properties[this.placement];return n&&(n.isHorizontallyCentered?i.x+=e.width/2:n.isRight&&(i.x+=e.width),n.isVerticallyCentered?i.y+=e.height/2:n.isBottom&&(i.y+=e.height)),i},_getTransformOrigin:function(){var e="",i=t.Placement.properties[this.placement];return i?(i.isLeft?e="left":i.isRight&&(e="right"),i.isTop?e+=" top":i.isBottom&&(e+=" bottom"),e):e},update:function(e,i){var n=t.isPlainObject(e)?e:{location:e,placement:i};this._init({location:n.location||this.location,placement:void 0!==n.placement?n.placement:this.placement,onDraw:n.onDraw||this.onDraw,checkResize:n.checkResize||this.checkResize,width:void 0!==n.width?n.width:this.width,height:void 0!==n.height?n.height:this.height,rotationMode:n.rotationMode||this.rotationMode})},getBounds:function(e){t.console.assert(e,"A viewport must now be passed to Overlay.getBounds.");var i=this.width,n=this.height;if(null===i||null===n){var o=e.deltaPointsFromPixelsNoRotate(this.size,!0);null===i&&(i=o.x),null===n&&(n=o.y)}var r=this.location.clone();return this.adjust(r,new t.Point(i,n)),this._adjustBoundsForRotation(e,new t.Rect(r.x,r.y,i,n))},_adjustBoundsForRotation:function(e,i){if(!e||0===e.getRotation(!0)||this.rotationMode===t.OverlayRotationMode.EXACT)return i;if(this.rotationMode===t.OverlayRotationMode.BOUNDING_BOX){if(null===this.width||null===this.height)return i;var n=this._getOverlayPositionAndSize(e);return e.viewerElementToViewportRectangle(new t.Rect(n.position.x,n.position.y,n.size.x,n.size.y))}return i.rotate(-e.getRotation(!0),this._getPlacementPoint(i))}}}(a),function(t){t.Drawer=function(e){t.console.assert(e.viewer,"[Drawer] options.viewer is required");var i=arguments;if(t.isPlainObject(e)||(e={source:i[0],viewport:i[1],element:i[2]}),t.console.assert(e.viewport,"[Drawer] options.viewport is required"),t.console.assert(e.element,"[Drawer] options.element is required"),e.source&&t.console.error("[Drawer] options.source is no longer accepted; use TiledImage instead"),this.viewer=e.viewer,this.viewport=e.viewport,this.debugGridColor="string"==typeof e.debugGridColor?[e.debugGridColor]:e.debugGridColor||t.DEFAULT_SETTINGS.debugGridColor,e.opacity&&t.console.error("[Drawer] options.opacity is no longer accepted; set the opacity on the TiledImage instead"),this.useCanvas=t.supportsCanvas&&(!this.viewer||this.viewer.useCanvas),this.container=t.getElement(e.element),this.canvas=t.makeNeutralElement(this.useCanvas?"canvas":"div"),this.context=this.useCanvas?this.canvas.getContext("2d"):null,this.sketchCanvas=null,this.sketchContext=null,this.element=this.container,this.container.dir="ltr",this.useCanvas){var n=this._calculateCanvasSize();this.canvas.width=n.x,this.canvas.height=n.y}this.canvas.style.width="100%",this.canvas.style.height="100%",this.canvas.style.position="absolute",t.setElementOpacity(this.canvas,this.opacity,!0),t.setElementPointerEventsNone(this.canvas),t.setElementTouchActionNone(this.canvas),this.container.style.textAlign="left",this.container.appendChild(this.canvas),this._imageSmoothingEnabled=!0},t.Drawer.prototype={addOverlay:function(e,i,n,o){return t.console.error("drawer.addOverlay is deprecated. Use viewer.addOverlay instead."),this.viewer.addOverlay(e,i,n,o),this},updateOverlay:function(e,i,n){return t.console.error("drawer.updateOverlay is deprecated. Use viewer.updateOverlay instead."),this.viewer.updateOverlay(e,i,n),this},removeOverlay:function(e){return t.console.error("drawer.removeOverlay is deprecated. Use viewer.removeOverlay instead."),this.viewer.removeOverlay(e),this},clearOverlays:function(){return t.console.error("drawer.clearOverlays is deprecated. Use viewer.clearOverlays instead."),this.viewer.clearOverlays(),this},viewportCoordToDrawerCoord:function(e){var i=this.viewport.pixelFromPointNoRotate(e,!0);return new t.Point(i.x*t.pixelDensityRatio,i.y*t.pixelDensityRatio)},clipWithPolygons:function(t,e){if(this.useCanvas){var i=this._getContext(e);i.beginPath(),t.forEach(function(t){t.forEach(function(t,e){i[0===e?"moveTo":"lineTo"](t.x,t.y)})}),i.clip()}},setOpacity:function(e){t.console.error("drawer.setOpacity is deprecated. Use tiledImage.setOpacity instead.");for(var i=this.viewer.world,n=0;n<i.getItemCount();n++)i.getItemAt(n).setOpacity(e);return this},getOpacity:function(){t.console.error("drawer.getOpacity is deprecated. Use tiledImage.getOpacity instead.");for(var e=this.viewer.world,i=0,n=0;n<e.getItemCount();n++){var o=e.getItemAt(n).getOpacity();o>i&&(i=o)}return i},needsUpdate:function(){return t.console.error("[Drawer.needsUpdate] this function is deprecated. Use World.needsDraw instead."),this.viewer.world.needsDraw()},numTilesLoaded:function(){return t.console.error("[Drawer.numTilesLoaded] this function is deprecated. Use TileCache.numTilesLoaded instead."),this.viewer.tileCache.numTilesLoaded()},reset:function(){return t.console.error("[Drawer.reset] this function is deprecated. Use World.resetItems instead."),this.viewer.world.resetItems(),this},update:function(){return t.console.error("[Drawer.update] this function is deprecated. Use Drawer.clear and World.draw instead."),this.clear(),this.viewer.world.draw(),this},canRotate:function(){return this.useCanvas},destroy:function(){this.canvas.width=1,this.canvas.height=1,this.sketchCanvas=null,this.sketchContext=null},clear:function(){if(this.canvas.innerHTML="",this.useCanvas){var t=this._calculateCanvasSize();if((this.canvas.width!==t.x||this.canvas.height!==t.y)&&(this.canvas.width=t.x,this.canvas.height=t.y,this._updateImageSmoothingEnabled(this.context),null!==this.sketchCanvas)){var e=this._calculateSketchCanvasSize();this.sketchCanvas.width=e.x,this.sketchCanvas.height=e.y,this._updateImageSmoothingEnabled(this.sketchContext)}this._clear()}},_clear:function(t,e){if(this.useCanvas){var i=this._getContext(t);if(e)i.clearRect(e.x,e.y,e.width,e.height);else{var n=i.canvas;i.clearRect(0,0,n.width,n.height)}}},viewportToDrawerRectangle:function(e){var i=this.viewport.pixelFromPointNoRotate(e.getTopLeft(),!0),n=this.viewport.deltaPixelsFromPointsNoRotate(e.getSize(),!0);return new t.Rect(i.x*t.pixelDensityRatio,i.y*t.pixelDensityRatio,n.x*t.pixelDensityRatio,n.y*t.pixelDensityRatio)},drawTile:function(e,i,n,o,r,s,a){if(t.console.assert(e,"[Drawer.drawTile] tile is required"),t.console.assert(i,"[Drawer.drawTile] drawingHandler is required"),this.useCanvas){var l=this._getContext(n);o=o||1,e.drawCanvas(l,i,o,r,s,a)}else e.drawHTML(this.canvas)},_getContext:function(t){var e=this.context;if(t){if(null===this.sketchCanvas){this.sketchCanvas=document.createElement("canvas");var i=this._calculateSketchCanvasSize();if(this.sketchCanvas.width=i.x,this.sketchCanvas.height=i.y,this.sketchContext=this.sketchCanvas.getContext("2d"),0===this.viewport.getRotation()){var n=this;this.viewer.addHandler("rotate",function t(){if(0!==n.viewport.getRotation()){n.viewer.removeHandler("rotate",t);var e=n._calculateSketchCanvasSize();n.sketchCanvas.width=e.x,n.sketchCanvas.height=e.y}})}this._updateImageSmoothingEnabled(this.sketchContext)}e=this.sketchContext}return e},saveContext:function(t){this.useCanvas&&this._getContext(t).save()},restoreContext:function(t){this.useCanvas&&this._getContext(t).restore()},setClip:function(t,e){if(this.useCanvas){var i=this._getContext(e);i.beginPath(),i.rect(t.x,t.y,t.width,t.height),i.clip()}},drawRectangle:function(t,e,i){if(this.useCanvas){var n=this._getContext(i);n.save(),n.fillStyle=e,n.fillRect(t.x,t.y,t.width,t.height),n.restore()}},blendSketch:function(e,i,n,o){var r=e;if(t.isPlainObject(r)||(r={opacity:e,scale:i,translate:n,compositeOperation:o}),this.useCanvas&&this.sketchCanvas){e=r.opacity,o=r.compositeOperation;var s=r.bounds;if(this.context.save(),this.context.globalAlpha=e,o&&(this.context.globalCompositeOperation=o),s)s.x<0&&(s.width+=s.x,s.x=0),s.x+s.width>this.canvas.width&&(s.width=this.canvas.width-s.x),s.y<0&&(s.height+=s.y,s.y=0),s.y+s.height>this.canvas.height&&(s.height=this.canvas.height-s.y),this.context.drawImage(this.sketchCanvas,s.x,s.y,s.width,s.height,s.x,s.y,s.width,s.height);else{i=r.scale||1;var a=(n=r.translate)instanceof t.Point?n:new t.Point(0,0),l=0,c=0;if(n){var u=this.sketchCanvas.width-this.canvas.width,h=this.sketchCanvas.height-this.canvas.height;l=Math.round(u/2),c=Math.round(h/2)}this.context.drawImage(this.sketchCanvas,a.x-l*i,a.y-c*i,(this.canvas.width+2*l)*i,(this.canvas.height+2*c)*i,-l,-c,this.canvas.width+2*l,this.canvas.height+2*c)}this.context.restore()}},drawDebugInfo:function(e,i,n,o){if(this.useCanvas){var r=this.viewer.world.getIndexOfItem(o)%this.debugGridColor.length,s=this.context;s.save(),s.lineWidth=2*t.pixelDensityRatio,s.font="small-caps bold "+13*t.pixelDensityRatio+"px arial",s.strokeStyle=this.debugGridColor[r],s.fillStyle=this.debugGridColor[r],this.viewport.getRotation(!0)%360!=0&&this._offsetForRotation({degrees:this.viewport.getRotation(!0)}),o.getRotation(!0)%360!=0&&this._offsetForRotation({degrees:o.getRotation(!0),point:o.viewport.pixelFromPointNoRotate(o._getRotationPoint(!0),!0)}),o.viewport.getRotation(!0)%360==0&&o.getRotation(!0)%360==0&&o._drawer.viewer.viewport.getFlip()&&o._drawer._flip(),s.strokeRect(e.position.x*t.pixelDensityRatio,e.position.y*t.pixelDensityRatio,e.size.x*t.pixelDensityRatio,e.size.y*t.pixelDensityRatio);var a=(e.position.x+e.size.x/2)*t.pixelDensityRatio,l=(e.position.y+e.size.y/2)*t.pixelDensityRatio;s.translate(a,l),s.rotate(Math.PI/180*-this.viewport.getRotation(!0)),s.translate(-a,-l),0===e.x&&0===e.y&&(s.fillText("Zoom: "+this.viewport.getZoom(),e.position.x*t.pixelDensityRatio,(e.position.y-30)*t.pixelDensityRatio),s.fillText("Pan: "+this.viewport.getBounds().toString(),e.position.x*t.pixelDensityRatio,(e.position.y-20)*t.pixelDensityRatio)),s.fillText("Level: "+e.level,(e.position.x+10)*t.pixelDensityRatio,(e.position.y+20)*t.pixelDensityRatio),s.fillText("Column: "+e.x,(e.position.x+10)*t.pixelDensityRatio,(e.position.y+30)*t.pixelDensityRatio),s.fillText("Row: "+e.y,(e.position.x+10)*t.pixelDensityRatio,(e.position.y+40)*t.pixelDensityRatio),s.fillText("Order: "+n+" of "+i,(e.position.x+10)*t.pixelDensityRatio,(e.position.y+50)*t.pixelDensityRatio),s.fillText("Size: "+e.size.toString(),(e.position.x+10)*t.pixelDensityRatio,(e.position.y+60)*t.pixelDensityRatio),s.fillText("Position: "+e.position.toString(),(e.position.x+10)*t.pixelDensityRatio,(e.position.y+70)*t.pixelDensityRatio),this.viewport.getRotation(!0)%360!=0&&this._restoreRotationChanges(),o.getRotation(!0)%360!=0&&this._restoreRotationChanges(),o.viewport.getRotation(!0)%360==0&&o.getRotation(!0)%360==0&&o._drawer.viewer.viewport.getFlip()&&o._drawer._flip(),s.restore()}},debugRect:function(e){if(this.useCanvas){var i=this.context;i.save(),i.lineWidth=2*t.pixelDensityRatio,i.strokeStyle=this.debugGridColor[0],i.fillStyle=this.debugGridColor[0],i.strokeRect(e.x*t.pixelDensityRatio,e.y*t.pixelDensityRatio,e.width*t.pixelDensityRatio,e.height*t.pixelDensityRatio),i.restore()}},setImageSmoothingEnabled:function(t){this.useCanvas&&(this._imageSmoothingEnabled=t,this._updateImageSmoothingEnabled(this.context),this.viewer.forceRedraw())},_updateImageSmoothingEnabled:function(t){t.msImageSmoothingEnabled=this._imageSmoothingEnabled,t.imageSmoothingEnabled=this._imageSmoothingEnabled},getCanvasSize:function(e){var i=this._getContext(e).canvas;return new t.Point(i.width,i.height)},getCanvasCenter:function(){return new t.Point(this.canvas.width/2,this.canvas.height/2)},_offsetForRotation:function(e){var i=e.point?e.point.times(t.pixelDensityRatio):this.getCanvasCenter(),n=this._getContext(e.useSketch);n.save(),n.translate(i.x,i.y),this.viewer.viewport.flipped?(n.rotate(Math.PI/180*-e.degrees),n.scale(-1,1)):n.rotate(Math.PI/180*e.degrees),n.translate(-i.x,-i.y)},_flip:function(e){var i=(e=e||{}).point?e.point.times(t.pixelDensityRatio):this.getCanvasCenter(),n=this._getContext(e.useSketch);n.translate(i.x,0),n.scale(-1,1),n.translate(-i.x,0)},_restoreRotationChanges:function(t){this._getContext(t).restore()},_calculateCanvasSize:function(){var e=t.pixelDensityRatio,i=this.viewport.getContainerSize();return{x:Math.round(i.x*e),y:Math.round(i.y*e)}},_calculateSketchCanvasSize:function(){var t=this._calculateCanvasSize();if(0===this.viewport.getRotation())return t;var e=Math.ceil(Math.sqrt(t.x*t.x+t.y*t.y));return{x:e,y:e}}}}(a),function(t){t.Viewport=function(e){var i=arguments;i.length&&i[0]instanceof t.Point&&(e={containerSize:i[0],contentSize:i[1],config:i[2]}),e.config&&(t.extend(!0,e,e.config),delete e.config),this._margins=t.extend({left:0,top:0,right:0,bottom:0},e.margins||{}),delete e.margins,e.initialDegrees=e.degrees,delete e.degrees,t.extend(!0,this,{containerSize:null,contentSize:null,zoomPoint:null,rotationPivot:null,viewer:null,springStiffness:t.DEFAULT_SETTINGS.springStiffness,animationTime:t.DEFAULT_SETTINGS.animationTime,minZoomImageRatio:t.DEFAULT_SETTINGS.minZoomImageRatio,maxZoomPixelRatio:t.DEFAULT_SETTINGS.maxZoomPixelRatio,visibilityRatio:t.DEFAULT_SETTINGS.visibilityRatio,wrapHorizontal:t.DEFAULT_SETTINGS.wrapHorizontal,wrapVertical:t.DEFAULT_SETTINGS.wrapVertical,defaultZoomLevel:t.DEFAULT_SETTINGS.defaultZoomLevel,minZoomLevel:t.DEFAULT_SETTINGS.minZoomLevel,maxZoomLevel:t.DEFAULT_SETTINGS.maxZoomLevel,initialDegrees:t.DEFAULT_SETTINGS.degrees,flipped:t.DEFAULT_SETTINGS.flipped,homeFillsViewer:t.DEFAULT_SETTINGS.homeFillsViewer,silenceMultiImageWarnings:t.DEFAULT_SETTINGS.silenceMultiImageWarnings},e),this._updateContainerInnerSize(),this.centerSpringX=new t.Spring({initial:0,springStiffness:this.springStiffness,animationTime:this.animationTime}),this.centerSpringY=new t.Spring({initial:0,springStiffness:this.springStiffness,animationTime:this.animationTime}),this.zoomSpring=new t.Spring({exponential:!0,initial:1,springStiffness:this.springStiffness,animationTime:this.animationTime}),this.degreesSpring=new t.Spring({initial:e.initialDegrees,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._oldCenterX=this.centerSpringX.current.value,this._oldCenterY=this.centerSpringY.current.value,this._oldZoom=this.zoomSpring.current.value,this._oldDegrees=this.degreesSpring.current.value,this._setContentBounds(new t.Rect(0,0,1,1),1),this.goHome(!0),this.update()},t.Viewport.prototype={get degrees(){return t.console.warn("Accessing [Viewport.degrees] is deprecated. Use viewport.getRotation instead."),this.getRotation()},set degrees(e){t.console.warn("Setting [Viewport.degrees] is deprecated. Use viewport.rotateTo, viewport.rotateBy, or viewport.setRotation instead."),this.rotateTo(e)},resetContentSize:function(e){return t.console.assert(e,"[Viewport.resetContentSize] contentSize is required"),t.console.assert(e instanceof t.Point,"[Viewport.resetContentSize] contentSize must be an OpenSeadragon.Point"),t.console.assert(e.x>0,"[Viewport.resetContentSize] contentSize.x must be greater than 0"),t.console.assert(e.y>0,"[Viewport.resetContentSize] contentSize.y must be greater than 0"),this._setContentBounds(new t.Rect(0,0,1,e.y/e.x),e.x),this},setHomeBounds:function(e,i){t.console.error("[Viewport.setHomeBounds] this function is deprecated; The content bounds should not be set manually."),this._setContentBounds(e,i)},_setContentBounds:function(e,i){t.console.assert(e,"[Viewport._setContentBounds] bounds is required"),t.console.assert(e instanceof t.Rect,"[Viewport._setContentBounds] bounds must be an OpenSeadragon.Rect"),t.console.assert(e.width>0,"[Viewport._setContentBounds] bounds.width must be greater than 0"),t.console.assert(e.height>0,"[Viewport._setContentBounds] bounds.height must be greater than 0"),this._contentBoundsNoRotate=e.clone(),this._contentSizeNoRotate=this._contentBoundsNoRotate.getSize().times(i),this._contentBounds=e.rotate(this.getRotation()).getBoundingBox(),this._contentSize=this._contentBounds.getSize().times(i),this._contentAspectRatio=this._contentSize.x/this._contentSize.y,this.viewer&&this.viewer.raiseEvent("reset-size",{contentSize:this._contentSizeNoRotate.clone(),contentFactor:i,homeBounds:this._contentBoundsNoRotate.clone(),contentBounds:this._contentBounds.clone()})},getHomeZoom:function(){if(this.defaultZoomLevel)return this.defaultZoomLevel;var t=this._contentAspectRatio/this.getAspectRatio();return(this.homeFillsViewer?t>=1?t:1:t>=1?1:t)/this._contentBounds.width},getHomeBounds:function(){return this.getHomeBoundsNoRotate().rotate(-this.getRotation())},getHomeBoundsNoRotate:function(){var e=this._contentBounds.getCenter(),i=1/this.getHomeZoom(),n=i/this.getAspectRatio();return new t.Rect(e.x-i/2,e.y-n/2,i,n)},goHome:function(t){return this.viewer&&this.viewer.raiseEvent("home",{immediately:t}),this.fitBounds(this.getHomeBounds(),t)},getMinZoom:function(){var t=this.getHomeZoom();return this.minZoomLevel?this.minZoomLevel:this.minZoomImageRatio*t},getMaxZoom:function(){var t=this.maxZoomLevel;return t||(t=this._contentSize.x*this.maxZoomPixelRatio/this._containerInnerSize.x,t/=this._contentBounds.width),Math.max(t,this.getHomeZoom())},getAspectRatio:function(){return this._containerInnerSize.x/this._containerInnerSize.y},getContainerSize:function(){return new t.Point(this.containerSize.x,this.containerSize.y)},getMargins:function(){return t.extend({},this._margins)},setMargins:function(e){t.console.assert("object"===t.type(e),"[Viewport.setMargins] margins must be an object"),this._margins=t.extend({left:0,top:0,right:0,bottom:0},e),this._updateContainerInnerSize(),this.viewer&&this.viewer.forceRedraw()},getBounds:function(t){return this.getBoundsNoRotate(t).rotate(-this.getRotation(t))},getBoundsNoRotate:function(e){var i=this.getCenter(e),n=1/this.getZoom(e),o=n/this.getAspectRatio();return new t.Rect(i.x-n/2,i.y-o/2,n,o)},getBoundsWithMargins:function(t){return this.getBoundsNoRotateWithMargins(t).rotate(-this.getRotation(t),this.getCenter(t))},getBoundsNoRotateWithMargins:function(t){var e=this.getBoundsNoRotate(t),i=this._containerInnerSize.x*this.getZoom(t);return e.x-=this._margins.left/i,e.y-=this._margins.top/i,e.width+=(this._margins.left+this._margins.right)/i,e.height+=(this._margins.top+this._margins.bottom)/i,e},getCenter:function(e){var i,n,o,r,s,a,l=new t.Point(this.centerSpringX.current.value,this.centerSpringY.current.value),c=new t.Point(this.centerSpringX.target.value,this.centerSpringY.target.value);return e?l:this.zoomPoint?(i=this.pixelFromPoint(this.zoomPoint,!0),r=(o=1/(n=this.getZoom()))/this.getAspectRatio(),s=new t.Rect(l.x-o/2,l.y-r/2,o,r),a=this._pixelFromPoint(this.zoomPoint,s).minus(i).rotate(-this.getRotation(!0)).divide(this._containerInnerSize.x*n),c.plus(a)):c},getZoom:function(t){return t?this.zoomSpring.current.value:this.zoomSpring.target.value},_applyZoomConstraints:function(t){return Math.max(Math.min(t,this.getMaxZoom()),this.getMinZoom())},_applyBoundaryConstraints:function(t){var e=this.viewportToViewerElementRectangle(t).getBoundingBox(),i=this.viewportToViewerElementRectangle(this._contentBoundsNoRotate).getBoundingBox(),n=!1,o=!1;if(this.wrapHorizontal);else{var r,s,a,l=e.x+e.width,c=i.x+i.width;r=e.width>i.width?this.visibilityRatio*i.width:this.visibilityRatio*e.width,s=i.x-l+r,a=c-e.x-r,r>i.width?(e.x+=(s+a)/2,n=!0):a<0?(e.x+=a,n=!0):s>0&&(e.x+=s,n=!0)}if(this.wrapVertical);else{var u,h,p,d=e.y+e.height,f=i.y+i.height;u=e.height>i.height?this.visibilityRatio*i.height:this.visibilityRatio*e.height,h=i.y-d+u,p=f-e.y-u,u>i.height?(e.y+=(h+p)/2,o=!0):p<0?(e.y+=p,o=!0):h>0&&(e.y+=h,o=!0)}var v=n||o,g=v?this.viewerElementToViewportRectangle(e):t.clone();return g.xConstrained=n,g.yConstrained=o,g.constraintApplied=v,g},_raiseConstraintsEvent:function(t){this.viewer&&this.viewer.raiseEvent("constrain",{immediately:t})},applyConstraints:function(t){var e=this.getZoom(),i=this._applyZoomConstraints(e);e!==i&&this.zoomTo(i,this.zoomPoint,t);var n=this.getConstrainedBounds(!1);return n.constraintApplied&&(this.fitBounds(n,t),this._raiseConstraintsEvent(t)),this},ensureVisible:function(t){return this.applyConstraints(t)},_fitBounds:function(e,i){var n=(i=i||{}).immediately||!1,o=i.constraints||!1,r=this.getAspectRatio(),s=e.getCenter(),a=new t.Rect(e.x,e.y,e.width,e.height,e.degrees+this.getRotation()).getBoundingBox();a.getAspectRatio()>=r?a.height=a.width/r:a.width=a.height*r,a.x=s.x-a.width/2,a.y=s.y-a.height/2;var l=1/a.width;if(n)return this.panTo(s,!0),this.zoomTo(l,null,!0),o&&this.applyConstraints(!0),this;var c=this.getCenter(!0),u=this.getZoom(!0);this.panTo(c,!0),this.zoomTo(u,null,!0);var h=this.getBounds(),p=this.getZoom();if(0===p||Math.abs(l/p-1)<1e-8)return this.zoomTo(l,null,!0),this.panTo(s,n),o&&this.applyConstraints(!1),this;if(o){this.panTo(s,!1),l=this._applyZoomConstraints(l),this.zoomTo(l,null,!1);var d=this.getConstrainedBounds();this.panTo(c,!0),this.zoomTo(u,null,!0),this.fitBounds(d)}else{var f=a.rotate(-this.getRotation()).getTopLeft().times(l).minus(h.getTopLeft().times(p)).divide(l-p);this.zoomTo(l,f,n)}return this},fitBounds:function(t,e){return this._fitBounds(t,{immediately:e,constraints:!1})},fitBoundsWithConstraints:function(t,e){return this._fitBounds(t,{immediately:e,constraints:!0})},fitVertically:function(e){var i=new t.Rect(this._contentBounds.x+this._contentBounds.width/2,this._contentBounds.y,0,this._contentBounds.height);return this.fitBounds(i,e)},fitHorizontally:function(e){var i=new t.Rect(this._contentBounds.x,this._contentBounds.y+this._contentBounds.height/2,this._contentBounds.width,0);return this.fitBounds(i,e)},getConstrainedBounds:function(t){var e;return e=this.getBounds(t),this._applyBoundaryConstraints(e)},panBy:function(e,i){var n=new t.Point(this.centerSpringX.target.value,this.centerSpringY.target.value);return this.panTo(n.plus(e),i)},panTo:function(t,e){return e?(this.centerSpringX.resetTo(t.x),this.centerSpringY.resetTo(t.y)):(this.centerSpringX.springTo(t.x),this.centerSpringY.springTo(t.y)),this.viewer&&this.viewer.raiseEvent("pan",{center:t,immediately:e}),this},zoomBy:function(t,e,i){return this.zoomTo(this.zoomSpring.target.value*t,e,i)},zoomTo:function(e,i,n){var o=this;return this.zoomPoint=i instanceof t.Point&&!isNaN(i.x)&&!isNaN(i.y)?i:null,n?this._adjustCenterSpringsForZoomPoint(function(){o.zoomSpring.resetTo(e)}):this.zoomSpring.springTo(e),this.viewer&&this.viewer.raiseEvent("zoom",{zoom:e,refPoint:i,immediately:n}),this},setRotation:function(t,e){return this.rotateTo(t,null,e)},getRotation:function(t){return t?this.degreesSpring.current.value:this.degreesSpring.target.value},setRotationWithPivot:function(t,e,i){return this.rotateTo(t,e,i)},rotateTo:function(e,i,n){if(!this.viewer||!this.viewer.drawer.canRotate())return this;if(this.degreesSpring.target.value===e&&this.degreesSpring.isAtTargetValue())return this;if(this.rotationPivot=i instanceof t.Point&&!isNaN(i.x)&&!isNaN(i.y)?i:null,n)if(this.rotationPivot){if(!(e-this._oldDegrees))return this.rotationPivot=null,this;this._rotateAboutPivot(e)}else this.degreesSpring.resetTo(e);else{var o=t.positiveModulo(this.degreesSpring.current.value,360),r=t.positiveModulo(e,360),s=r-o;s>180?r-=360:s<-180&&(r+=360);var a=o-r;this.degreesSpring.resetTo(e+a),this.degreesSpring.springTo(e)}return this._setContentBounds(this.viewer.world.getHomeBounds(),this.viewer.world.getContentFactor()),this.viewer.forceRedraw(),this.viewer.raiseEvent("rotate",{degrees:e,immediately:!!n,pivot:this.rotationPivot||this.getCenter()}),this},rotateBy:function(t,e,i){return this.rotateTo(this.degreesSpring.target.value+t,e,i)},resize:function(t,e){var i,n=this.getBoundsNoRotate(),o=n;this.containerSize.x=t.x,this.containerSize.y=t.y,this._updateContainerInnerSize(),e&&(i=t.x/this.containerSize.x,o.width=n.width*i,o.height=o.width/this.getAspectRatio()),this.viewer&&this.viewer.raiseEvent("resize",{newContainerSize:t,maintain:e});var r=this.fitBounds(o,!0);return this.viewer&&this.viewer.raiseEvent("after-resize",{newContainerSize:t,maintain:e}),r},_updateContainerInnerSize:function(){this._containerInnerSize=new t.Point(Math.max(1,this.containerSize.x-(this._margins.left+this._margins.right)),Math.max(1,this.containerSize.y-(this._margins.top+this._margins.bottom)))},update:function(){var t=this;this._adjustCenterSpringsForZoomPoint(function(){t.zoomSpring.update()}),this.degreesSpring.isAtTargetValue()&&(this.rotationPivot=null),this.centerSpringX.update(),this.centerSpringY.update(),this.rotationPivot?this._rotateAboutPivot(!0):this.degreesSpring.update();var e=this.centerSpringX.current.value!==this._oldCenterX||this.centerSpringY.current.value!==this._oldCenterY||this.zoomSpring.current.value!==this._oldZoom||this.degreesSpring.current.value!==this._oldDegrees;return this._oldCenterX=this.centerSpringX.current.value,this._oldCenterY=this.centerSpringY.current.value,this._oldZoom=this.zoomSpring.current.value,this._oldDegrees=this.degreesSpring.current.value,e},_rotateAboutPivot:function(t){var e=!0===t,i=this.rotationPivot.minus(this.getCenter());this.centerSpringX.shiftBy(i.x),this.centerSpringY.shiftBy(i.y),e?this.degreesSpring.update():this.degreesSpring.resetTo(t);var n=this.degreesSpring.current.value-this._oldDegrees,o=i.rotate(-1*n).times(-1);this.centerSpringX.shiftBy(o.x),this.centerSpringY.shiftBy(o.y)},_adjustCenterSpringsForZoomPoint:function(t){if(this.zoomPoint){var e=this.pixelFromPoint(this.zoomPoint,!0);t();var i=this.pixelFromPoint(this.zoomPoint,!0).minus(e),n=this.deltaPointsFromPixels(i,!0);this.centerSpringX.shiftBy(n.x),this.centerSpringY.shiftBy(n.y),this.zoomSpring.isAtTargetValue()&&(this.zoomPoint=null)}else t()},deltaPixelsFromPointsNoRotate:function(t,e){return t.times(this._containerInnerSize.x*this.getZoom(e))},deltaPixelsFromPoints:function(t,e){return this.deltaPixelsFromPointsNoRotate(t.rotate(this.getRotation(e)),e)},deltaPointsFromPixelsNoRotate:function(t,e){return t.divide(this._containerInnerSize.x*this.getZoom(e))},deltaPointsFromPixels:function(t,e){return this.deltaPointsFromPixelsNoRotate(t,e).rotate(-this.getRotation(e))},pixelFromPointNoRotate:function(t,e){return this._pixelFromPointNoRotate(t,this.getBoundsNoRotate(e))},pixelFromPoint:function(t,e){return this._pixelFromPoint(t,this.getBoundsNoRotate(e))},_pixelFromPointNoRotate:function(e,i){return e.minus(i.getTopLeft()).times(this._containerInnerSize.x/i.width).plus(new t.Point(this._margins.left,this._margins.top))},_pixelFromPoint:function(t,e){return this._pixelFromPointNoRotate(t.rotate(this.getRotation(!0),this.getCenter(!0)),e)},pointFromPixelNoRotate:function(e,i){var n=this.getBoundsNoRotate(i);return e.minus(new t.Point(this._margins.left,this._margins.top)).divide(this._containerInnerSize.x/n.width).plus(n.getTopLeft())},pointFromPixel:function(t,e){return this.pointFromPixelNoRotate(t,e).rotate(-this.getRotation(e),this.getCenter(e))},_viewportToImageDelta:function(e,i){var n=this._contentBoundsNoRotate.width;return new t.Point(e*this._contentSizeNoRotate.x/n,i*this._contentSizeNoRotate.x/n)},viewportToImageCoordinates:function(e,i){if(e instanceof t.Point)return this.viewportToImageCoordinates(e.x,e.y);if(this.viewer){var n=this.viewer.world.getItemCount();if(n>1)this.silenceMultiImageWarnings||t.console.error("[Viewport.viewportToImageCoordinates] is not accurate with multi-image; use TiledImage.viewportToImageCoordinates instead.");else if(1===n){return this.viewer.world.getItemAt(0).viewportToImageCoordinates(e,i,!0)}}return this._viewportToImageDelta(e-this._contentBoundsNoRotate.x,i-this._contentBoundsNoRotate.y)},_imageToViewportDelta:function(e,i){var n=this._contentBoundsNoRotate.width;return new t.Point(e/this._contentSizeNoRotate.x*n,i/this._contentSizeNoRotate.x*n)},imageToViewportCoordinates:function(e,i){if(e instanceof t.Point)return this.imageToViewportCoordinates(e.x,e.y);if(this.viewer){var n=this.viewer.world.getItemCount();if(n>1)this.silenceMultiImageWarnings||t.console.error("[Viewport.imageToViewportCoordinates] is not accurate with multi-image; use TiledImage.imageToViewportCoordinates instead.");else if(1===n){return this.viewer.world.getItemAt(0).imageToViewportCoordinates(e,i,!0)}}var o=this._imageToViewportDelta(e,i);return o.x+=this._contentBoundsNoRotate.x,o.y+=this._contentBoundsNoRotate.y,o},imageToViewportRectangle:function(e,i,n,o){var r=e;if(r instanceof t.Rect||(r=new t.Rect(e,i,n,o)),this.viewer){var s=this.viewer.world.getItemCount();if(s>1)this.silenceMultiImageWarnings||t.console.error("[Viewport.imageToViewportRectangle] is not accurate with multi-image; use TiledImage.imageToViewportRectangle instead.");else if(1===s){return this.viewer.world.getItemAt(0).imageToViewportRectangle(e,i,n,o,!0)}}var a=this.imageToViewportCoordinates(r.x,r.y),l=this._imageToViewportDelta(r.width,r.height);return new t.Rect(a.x,a.y,l.x,l.y,r.degrees)},viewportToImageRectangle:function(e,i,n,o){var r=e;if(r instanceof t.Rect||(r=new t.Rect(e,i,n,o)),this.viewer){var s=this.viewer.world.getItemCount();if(s>1)this.silenceMultiImageWarnings||t.console.error("[Viewport.viewportToImageRectangle] is not accurate with multi-image; use TiledImage.viewportToImageRectangle instead.");else if(1===s){return this.viewer.world.getItemAt(0).viewportToImageRectangle(e,i,n,o,!0)}}var a=this.viewportToImageCoordinates(r.x,r.y),l=this._viewportToImageDelta(r.width,r.height);return new t.Rect(a.x,a.y,l.x,l.y,r.degrees)},viewerElementToImageCoordinates:function(t){var e=this.pointFromPixel(t,!0);return this.viewportToImageCoordinates(e)},imageToViewerElementCoordinates:function(t){var e=this.imageToViewportCoordinates(t);return this.pixelFromPoint(e,!0)},windowToImageCoordinates:function(e){t.console.assert(this.viewer,"[Viewport.windowToImageCoordinates] the viewport must have a viewer.");var i=e.minus(t.getElementPosition(this.viewer.element));return this.viewerElementToImageCoordinates(i)},imageToWindowCoordinates:function(e){return t.console.assert(this.viewer,"[Viewport.imageToWindowCoordinates] the viewport must have a viewer."),this.imageToViewerElementCoordinates(e).plus(t.getElementPosition(this.viewer.element))},viewerElementToViewportCoordinates:function(t){return this.pointFromPixel(t,!0)},viewportToViewerElementCoordinates:function(t){return this.pixelFromPoint(t,!0)},viewerElementToViewportRectangle:function(e){return t.Rect.fromSummits(this.pointFromPixel(e.getTopLeft(),!0),this.pointFromPixel(e.getTopRight(),!0),this.pointFromPixel(e.getBottomLeft(),!0))},viewportToViewerElementRectangle:function(e){return t.Rect.fromSummits(this.pixelFromPoint(e.getTopLeft(),!0),this.pixelFromPoint(e.getTopRight(),!0),this.pixelFromPoint(e.getBottomLeft(),!0))},windowToViewportCoordinates:function(e){t.console.assert(this.viewer,"[Viewport.windowToViewportCoordinates] the viewport must have a viewer.");var i=e.minus(t.getElementPosition(this.viewer.element));return this.viewerElementToViewportCoordinates(i)},viewportToWindowCoordinates:function(e){return t.console.assert(this.viewer,"[Viewport.viewportToWindowCoordinates] the viewport must have a viewer."),this.viewportToViewerElementCoordinates(e).plus(t.getElementPosition(this.viewer.element))},viewportToImageZoom:function(e){if(this.viewer){var i=this.viewer.world.getItemCount();if(i>1)this.silenceMultiImageWarnings||t.console.error("[Viewport.viewportToImageZoom] is not accurate with multi-image.");else if(1===i){return this.viewer.world.getItemAt(0).viewportToImageZoom(e)}}var n=this._contentSizeNoRotate.x;return e*(this._containerInnerSize.x/n*this._contentBoundsNoRotate.width)},imageToViewportZoom:function(e){if(this.viewer){var i=this.viewer.world.getItemCount();if(i>1)this.silenceMultiImageWarnings||t.console.error("[Viewport.imageToViewportZoom] is not accurate with multi-image.");else if(1===i){return this.viewer.world.getItemAt(0).imageToViewportZoom(e)}}return e*(this._contentSizeNoRotate.x/this._containerInnerSize.x/this._contentBoundsNoRotate.width)},toggleFlip:function(){return this.setFlip(!this.getFlip()),this},getFlip:function(){return this.flipped},setFlip:function(t){return this.flipped===t||(this.flipped=t,this.viewer.navigator&&this.viewer.navigator.setFlip(this.getFlip()),this.viewer.forceRedraw(),this.viewer.raiseEvent("flip",{flipped:t})),this}}}(a),function(t){t.TiledImage=function(e){var i=this;t.console.assert(e.tileCache,"[TiledImage] options.tileCache is required"),t.console.assert(e.drawer,"[TiledImage] options.drawer is required"),t.console.assert(e.viewer,"[TiledImage] options.viewer is required"),t.console.assert(e.imageLoader,"[TiledImage] options.imageLoader is required"),t.console.assert(e.source,"[TiledImage] options.source is required"),t.console.assert(!e.clip||e.clip instanceof t.Rect,"[TiledImage] options.clip must be an OpenSeadragon.Rect if present"),t.EventSource.call(this),this._tileCache=e.tileCache,delete e.tileCache,this._drawer=e.drawer,delete e.drawer,this._imageLoader=e.imageLoader,delete e.imageLoader,e.clip instanceof t.Rect&&(this._clip=e.clip.clone()),delete e.clip;var n=e.x||0;delete e.x;var o=e.y||0;delete e.y,this.normHeight=e.source.dimensions.y/e.source.dimensions.x,this.contentAspectX=e.source.dimensions.x/e.source.dimensions.y;var r=1;e.width?(r=e.width,delete e.width,e.height&&(t.console.error("specifying both width and height to a tiledImage is not supported"),delete e.height)):e.height&&(r=e.height/this.normHeight,delete e.height);var s=e.fitBounds;delete e.fitBounds;var l=e.fitBoundsPlacement||a.Placement.CENTER;delete e.fitBoundsPlacement;var c=e.degrees||0;delete e.degrees;var u=e.ajaxHeaders;delete e.ajaxHeaders,t.extend(!0,this,{viewer:null,tilesMatrix:{},coverage:{},loadingCoverage:{},lastDrawn:[],lastResetTime:0,_midDraw:!1,_needsDraw:!0,_hasOpaqueTile:!1,_tilesLoading:0,springStiffness:t.DEFAULT_SETTINGS.springStiffness,animationTime:t.DEFAULT_SETTINGS.animationTime,minZoomImageRatio:t.DEFAULT_SETTINGS.minZoomImageRatio,wrapHorizontal:t.DEFAULT_SETTINGS.wrapHorizontal,wrapVertical:t.DEFAULT_SETTINGS.wrapVertical,immediateRender:t.DEFAULT_SETTINGS.immediateRender,blendTime:t.DEFAULT_SETTINGS.blendTime,alwaysBlend:t.DEFAULT_SETTINGS.alwaysBlend,minPixelRatio:t.DEFAULT_SETTINGS.minPixelRatio,smoothTileEdgesMinZoom:t.DEFAULT_SETTINGS.smoothTileEdgesMinZoom,iOSDevice:t.DEFAULT_SETTINGS.iOSDevice,debugMode:t.DEFAULT_SETTINGS.debugMode,crossOriginPolicy:t.DEFAULT_SETTINGS.crossOriginPolicy,ajaxWithCredentials:t.DEFAULT_SETTINGS.ajaxWithCredentials,placeholderFillStyle:t.DEFAULT_SETTINGS.placeholderFillStyle,opacity:t.DEFAULT_SETTINGS.opacity,preload:t.DEFAULT_SETTINGS.preload,compositeOperation:t.DEFAULT_SETTINGS.compositeOperation,subPixelRoundingForTransparency:t.DEFAULT_SETTINGS.subPixelRoundingForTransparency},e),this._preload=this.preload,delete this.preload,this._fullyLoaded=!1,this._xSpring=new t.Spring({initial:n,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._ySpring=new t.Spring({initial:o,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._scaleSpring=new t.Spring({initial:r,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._degreesSpring=new t.Spring({initial:c,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._updateForScale(),s&&this.fitBounds(s,l,!0),this._drawingHandler=function(e){i.viewer.raiseEvent("tile-drawing",t.extend({tiledImage:i},e))},this._ownAjaxHeaders={},this.setAjaxHeaders(u,!1)},t.extend(t.TiledImage.prototype,t.EventSource.prototype,{needsDraw:function(){return this._needsDraw},getFullyLoaded:function(){return this._fullyLoaded},_setFullyLoaded:function(t){t!==this._fullyLoaded&&(this._fullyLoaded=t,this.raiseEvent("fully-loaded-change",{fullyLoaded:this._fullyLoaded}))},reset:function(){this._tileCache.clearTilesFor(this),this.lastResetTime=t.now(),this._needsDraw=!0},update:function(){var t=this._xSpring.update(),e=this._ySpring.update(),i=this._scaleSpring.update(),n=this._degreesSpring.update();return!!(t||e||i||n)&&(this._updateForScale(),this._needsDraw=!0,!0)},draw:function(){0!==this.opacity||this._preload?(this._midDraw=!0,this._updateViewport(),this._midDraw=!1):this._needsDraw=!1},destroy:function(){this.reset(),this.source.destroy&&this.source.destroy()},getBounds:function(t){return this.getBoundsNoRotate(t).rotate(this.getRotation(t),this._getRotationPoint(t))},getBoundsNoRotate:function(e){return e?new t.Rect(this._xSpring.current.value,this._ySpring.current.value,this._worldWidthCurrent,this._worldHeightCurrent):new t.Rect(this._xSpring.target.value,this._ySpring.target.value,this._worldWidthTarget,this._worldHeightTarget)},getWorldBounds:function(){return t.console.error("[TiledImage.getWorldBounds] is deprecated; use TiledImage.getBounds instead"),this.getBounds()},getClippedBounds:function(e){var i=this.getBoundsNoRotate(e);if(this._clip){var n=(e?this._worldWidthCurrent:this._worldWidthTarget)/this.source.dimensions.x,o=this._clip.times(n);i=new t.Rect(i.x+o.x,i.y+o.y,o.width,o.height)}return i.rotate(this.getRotation(e),this._getRotationPoint(e))},getTileBounds:function(t,e,i){var n=this.source.getNumTiles(t),o=(n.x+e%n.x)%n.x,r=(n.y+i%n.y)%n.y,s=this.source.getTileBounds(t,o,r);return this.getFlip()&&(s.x=1-s.x-s.width),s.x+=(e-o)/n.x,s.y+=this._worldHeightCurrent/this._worldWidthCurrent*((i-r)/n.y),s},getContentSize:function(){return new t.Point(this.source.dimensions.x,this.source.dimensions.y)},getSizeInWindowCoordinates:function(){var e=this.imageToWindowCoordinates(new t.Point(0,0)),i=this.imageToWindowCoordinates(this.getContentSize());return new t.Point(i.x-e.x,i.y-e.y)},_viewportToImageDelta:function(e,i,n){var o=n?this._scaleSpring.current.value:this._scaleSpring.target.value;return new t.Point(e*(this.source.dimensions.x/o),i*(this.source.dimensions.y*this.contentAspectX/o))},viewportToImageCoordinates:function(e,i,n){var o;return e instanceof t.Point?(n=i,o=e):o=new t.Point(e,i),o=o.rotate(-this.getRotation(n),this._getRotationPoint(n)),n?this._viewportToImageDelta(o.x-this._xSpring.current.value,o.y-this._ySpring.current.value):this._viewportToImageDelta(o.x-this._xSpring.target.value,o.y-this._ySpring.target.value)},_imageToViewportDelta:function(e,i,n){var o=n?this._scaleSpring.current.value:this._scaleSpring.target.value;return new t.Point(e/this.source.dimensions.x*o,i/this.source.dimensions.y/this.contentAspectX*o)},imageToViewportCoordinates:function(e,i,n){e instanceof t.Point&&(n=i,i=e.y,e=e.x);var o=this._imageToViewportDelta(e,i);return n?(o.x+=this._xSpring.current.value,o.y+=this._ySpring.current.value):(o.x+=this._xSpring.target.value,o.y+=this._ySpring.target.value),o.rotate(this.getRotation(n),this._getRotationPoint(n))},imageToViewportRectangle:function(e,i,n,o,r){var s=e;s instanceof t.Rect?r=i:s=new t.Rect(e,i,n,o);var a=this.imageToViewportCoordinates(s.getTopLeft(),r),l=this._imageToViewportDelta(s.width,s.height,r);return new t.Rect(a.x,a.y,l.x,l.y,s.degrees+this.getRotation(r))},viewportToImageRectangle:function(e,i,n,o,r){var s=e;e instanceof t.Rect?r=i:s=new t.Rect(e,i,n,o);var a=this.viewportToImageCoordinates(s.getTopLeft(),r),l=this._viewportToImageDelta(s.width,s.height,r);return new t.Rect(a.x,a.y,l.x,l.y,s.degrees-this.getRotation(r))},viewerElementToImageCoordinates:function(t){var e=this.viewport.pointFromPixel(t,!0);return this.viewportToImageCoordinates(e)},imageToViewerElementCoordinates:function(t){var e=this.imageToViewportCoordinates(t);return this.viewport.pixelFromPoint(e,!0)},windowToImageCoordinates:function(t){var e=t.minus(a.getElementPosition(this.viewer.element));return this.viewerElementToImageCoordinates(e)},imageToWindowCoordinates:function(t){return this.imageToViewerElementCoordinates(t).plus(a.getElementPosition(this.viewer.element))},_viewportToTiledImageRectangle:function(e){var i=this._scaleSpring.current.value;return e=e.rotate(-this.getRotation(!0),this._getRotationPoint(!0)),new t.Rect((e.x-this._xSpring.current.value)/i,(e.y-this._ySpring.current.value)/i,e.width/i,e.height/i,e.degrees)},viewportToImageZoom:function(t){return this._scaleSpring.current.value*this.viewport._containerInnerSize.x/this.source.dimensions.x*t},imageToViewportZoom:function(t){return t/(this._scaleSpring.current.value*this.viewport._containerInnerSize.x/this.source.dimensions.x)},setPosition:function(t,e){var i=this._xSpring.target.value===t.x&&this._ySpring.target.value===t.y;if(e){if(i&&this._xSpring.current.value===t.x&&this._ySpring.current.value===t.y)return;this._xSpring.resetTo(t.x),this._ySpring.resetTo(t.y),this._needsDraw=!0}else{if(i)return;this._xSpring.springTo(t.x),this._ySpring.springTo(t.y),this._needsDraw=!0}i||this._raiseBoundsChange()},setWidth:function(t,e){this._setScale(t,e)},setHeight:function(t,e){this._setScale(t/this.normHeight,e)},setCroppingPolygons:function(e){var i=function(e){return e.map(function(e){try{if(function(e){return e instanceof t.Point||"number"==typeof e.x&&"number"==typeof e.y}(e))return{x:e.x,y:e.y};throw new Error}catch(i){throw new Error("A Provided cropping polygon point is not supported")}})};try{if(!t.isArray(e))throw new Error("Provided cropping polygon is not an array");this._croppingPolygons=e.map(function(t){return i(t)})}catch(n){t.console.error("[TiledImage.setCroppingPolygons] Cropping polygon format not supported"),t.console.error(n),this._croppingPolygons=null}},resetCroppingPolygons:function(){this._croppingPolygons=null},fitBounds:function(e,i,n){i=i||t.Placement.CENTER;var o=t.Placement.properties[i],r=this.contentAspectX,s=0,a=0,l=1,c=1;if(this._clip&&(r=this._clip.getAspectRatio(),l=this._clip.width/this.source.dimensions.x,c=this._clip.height/this.source.dimensions.y,e.getAspectRatio()>r?(s=this._clip.x/this._clip.height*e.height,a=this._clip.y/this._clip.height*e.height):(s=this._clip.x/this._clip.width*e.width,a=this._clip.y/this._clip.width*e.width)),e.getAspectRatio()>r){var u=e.height/c,h=0;o.isHorizontallyCentered?h=(e.width-e.height*r)/2:o.isRight&&(h=e.width-e.height*r),this.setPosition(new t.Point(e.x-s+h,e.y-a),n),this.setHeight(u,n)}else{var p=e.width/l,d=0;o.isVerticallyCentered?d=(e.height-e.width/r)/2:o.isBottom&&(d=e.height-e.width/r),this.setPosition(new t.Point(e.x-s,e.y-a+d),n),this.setWidth(p,n)}},getClip:function(){return this._clip?this._clip.clone():null},setClip:function(e){t.console.assert(!e||e instanceof t.Rect,"[TiledImage.setClip] newClip must be an OpenSeadragon.Rect or null"),e instanceof t.Rect?this._clip=e.clone():this._clip=null,this._needsDraw=!0,this.raiseEvent("clip-change")},getFlip:function(){return!!this.flipped},setFlip:function(t){this.flipped=!!t,this._needsDraw=!0,this._raiseBoundsChange()},getOpacity:function(){return this.opacity},setOpacity:function(t){t!==this.opacity&&(this.opacity=t,this._needsDraw=!0,this.raiseEvent("opacity-change",{opacity:this.opacity}))},getPreload:function(){return this._preload},setPreload:function(t){this._preload=!!t,this._needsDraw=!0},getRotation:function(t){return t?this._degreesSpring.current.value:this._degreesSpring.target.value},setRotation:function(t,e){this._degreesSpring.target.value===t&&this._degreesSpring.isAtTargetValue()||(e?this._degreesSpring.resetTo(t):this._degreesSpring.springTo(t),this._needsDraw=!0,this._raiseBoundsChange())},_getRotationPoint:function(t){return this.getBoundsNoRotate(t).getCenter()},getCompositeOperation:function(){return this.compositeOperation},setCompositeOperation:function(t){t!==this.compositeOperation&&(this.compositeOperation=t,this._needsDraw=!0,this.raiseEvent("composite-operation-change",{compositeOperation:this.compositeOperation}))},setAjaxHeaders:function(e,i){null===e&&(e={}),t.isPlainObject(e)&&(this._ownAjaxHeaders=e,this._updateAjaxHeaders(i))},_updateAjaxHeaders:function(e){if(void 0===e&&(e=!0),t.isPlainObject(this.viewer.ajaxHeaders)?this.ajaxHeaders=t.extend({},this.viewer.ajaxHeaders,this._ownAjaxHeaders):this.ajaxHeaders=this._ownAjaxHeaders,e){var i,n,o,r;for(var s in this.tilesMatrix)for(var a in i=this.source.getNumTiles(s),this.tilesMatrix[s])for(var l in n=(i.x+a%i.x)%i.x,this.tilesMatrix[s][a])if(o=(i.y+l%i.y)%i.y,(r=this.tilesMatrix[s][a][l]).loadWithAjax=this.loadTilesWithAjax,r.loadWithAjax){var c=this.source.getTileAjaxHeaders(s,n,o);r.ajaxHeaders=t.extend({},this.ajaxHeaders,c)}else r.ajaxHeaders=null;for(var u=0;u<this._imageLoader.jobQueue.length;u++){var h=this._imageLoader.jobQueue[u];h.loadWithAjax=h.tile.loadWithAjax,h.ajaxHeaders=h.tile.loadWithAjax?h.tile.ajaxHeaders:null}}},_setScale:function(t,e){var i=this._scaleSpring.target.value===t;if(e){if(i&&this._scaleSpring.current.value===t)return;this._scaleSpring.resetTo(t),this._updateForScale(),this._needsDraw=!0}else{if(i)return;this._scaleSpring.springTo(t),this._updateForScale(),this._needsDraw=!0}i||this._raiseBoundsChange()},_updateForScale:function(){this._worldWidthTarget=this._scaleSpring.target.value,this._worldHeightTarget=this.normHeight*this._scaleSpring.target.value,this._worldWidthCurrent=this._scaleSpring.current.value,this._worldHeightCurrent=this.normHeight*this._scaleSpring.current.value},_raiseBoundsChange:function(){this.raiseEvent("bounds-change")},_isBottomItem:function(){return this.viewer.world.getItemAt(0)===this},_getLevelsInterval:function(){var t=Math.max(this.source.minLevel,Math.floor(Math.log(this.minZoomImageRatio)/Math.log(2))),e=this.viewport.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(0),!0).x*this._scaleSpring.current.value,i=Math.min(Math.abs(this.source.maxLevel),Math.abs(Math.floor(Math.log(e/this.minPixelRatio)/Math.log(2))));return i=Math.max(i,this.source.minLevel||0),{lowestLevel:t=Math.min(t,i),highestLevel:i}},_updateViewport:function(){for(this._needsDraw=!1,this._tilesLoading=0,this.loadingCoverage={};this.lastDrawn.length>0;){this.lastDrawn.pop().beingDrawn=!1}var e=this.viewport,i=this._viewportToTiledImageRectangle(e.getBoundsWithMargins(!0));if(!this.wrapHorizontal&&!this.wrapVertical){var n=this._viewportToTiledImageRectangle(this.getClippedBounds(!0));if(null===(i=i.intersection(n)))return}for(var o=this._getLevelsInterval(),r=o.lowestLevel,s=o.highestLevel,a=null,l=!1,c=t.now(),u=s;u>=r;u--){var h=!1,p=e.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(u),!0).x*this._scaleSpring.current.value;if(u===r||!l&&p>=this.minPixelRatio)h=!0,l=!0;else if(!l)continue;var d=e.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(u),!1).x*this._scaleSpring.current.value,f=e.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(Math.max(this.source.getClosestLevel(),0)),!1).x*this._scaleSpring.current.value,v=this.immediateRender?1:f,g=Math.min(1,(p-.5)/.5),m=v/Math.abs(v-d);if(a=this._updateLevel(l,h,u,g,m,i,c,a),this._providesCoverage(this.coverage,u))break}this._drawTiles(this.lastDrawn),a&&!a.context2D?(this._loadTile(a,c),this._needsDraw=!0,this._setFullyLoaded(!1)):this._setFullyLoaded(0===this._tilesLoading)},_getCornerTiles:function(e,i,n){var o,r,s,a;this.wrapHorizontal?(o=t.positiveModulo(i.x,1),r=t.positiveModulo(n.x,1)):(o=Math.max(0,i.x),r=Math.min(1,n.x));var l=1/this.source.aspectRatio;this.wrapVertical?(s=t.positiveModulo(i.y,l),a=t.positiveModulo(n.y,l)):(s=Math.max(0,i.y),a=Math.min(l,n.y));var c=this.source.getTileAtPoint(e,new t.Point(o,s)),u=this.source.getTileAtPoint(e,new t.Point(r,a)),h=this.source.getNumTiles(e);return this.wrapHorizontal&&(c.x+=h.x*Math.floor(i.x),u.x+=h.x*Math.floor(n.x)),this.wrapVertical&&(c.y+=h.y*Math.floor(i.y/l),u.y+=h.y*Math.floor(n.y/l)),{topLeft:c,bottomRight:u}},_updateLevel:function(t,e,i,n,o,r,s,a){var l=r.getBoundingBox().getTopLeft(),c=r.getBoundingBox().getBottomRight();this.viewer&&this.viewer.raiseEvent("update-level",{tiledImage:this,havedrawn:t,level:i,opacity:n,visibility:o,drawArea:r,topleft:l,bottomright:c,currenttime:s,best:a}),this._resetCoverage(this.coverage,i),this._resetCoverage(this.loadingCoverage,i);var u=this._getCornerTiles(i,l,c),h=u.topLeft,p=u.bottomRight,d=this.source.getNumTiles(i),f=this.viewport.pixelFromPoint(this.viewport.getCenter());this.getFlip()&&(p.x+=1,this.wrapHorizontal||(p.x=Math.min(p.x,d.x-1)));for(var v=h.x;v<=p.x;v++)for(var g=h.y;g<=p.y;g++){var m;if(this.getFlip()){var y=(d.x+v%d.x)%d.x;m=v+d.x-y-y-1}else m=v;null!==r.intersection(this.getTileBounds(i,m,g))&&(a=this._updateTile(e,t,m,g,i,n,o,f,d,s,a))}return a},_updateTile:function(t,e,i,n,o,r,s,a,l,c,u){var h=this._getTile(i,n,o,c,l,this._worldWidthCurrent,this._worldHeightCurrent),p=e;this.viewer&&this.viewer.raiseEvent("update-tile",{tiledImage:this,tile:h}),this._setCoverage(this.coverage,o,i,n,!1);var d=h.loaded||h.loading||this._isCovered(this.loadingCoverage,o,i,n);if(this._setCoverage(this.loadingCoverage,o,i,n,d),!h.exists)return u;if(t&&!p&&(this._isCovered(this.coverage,o,i,n)?this._setCoverage(this.coverage,o,i,n,!0):p=!0),!p)return u;if(this._positionTile(h,this.source.tileOverlap,this.viewport,a,s),!h.loaded)if(h.context2D)this._setTileLoaded(h);else{var f=this._tileCache.getImageRecord(h.cacheKey);f&&this._setTileLoaded(h,f.getData())}h.loaded?this._blendTile(h,i,n,o,r,c)&&(this._needsDraw=!0):h.loading?this._tilesLoading++:d||(u=this._compareTiles(u,h));return u},_getTile:function(e,i,n,o,r,s,a){var l,c,u,h,p,d,f,v,g,m,y=this.tilesMatrix,w=this.source;return y[n]||(y[n]={}),y[n][e]||(y[n][e]={}),y[n][e][i]&&!y[n][e][i].flipped==!this.flipped||(l=(r.x+e%r.x)%r.x,c=(r.y+i%r.y)%r.y,u=this.getTileBounds(n,e,i),h=w.getTileBounds(n,l,c,!0),p=w.tileExists(n,l,c),d=w.getTileUrl(n,l,c),f=w.getTilePostData(n,l,c),this.loadTilesWithAjax?(v=w.getTileAjaxHeaders(n,l,c),t.isPlainObject(this.ajaxHeaders)&&(v=t.extend({},this.ajaxHeaders,v))):v=null,g=w.getContext2D?w.getContext2D(n,l,c):void 0,m=new t.Tile(n,e,i,u,p,d,g,this.loadTilesWithAjax,v,h,f,w.getTileHashKey(n,l,c,d,v,f)),this.getFlip()?0===l&&(m.isRightMost=!0):l===r.x-1&&(m.isRightMost=!0),c===r.y-1&&(m.isBottomMost=!0),m.flipped=this.flipped,y[n][e][i]=m),(m=y[n][e][i]).lastTouchTime=o,m},_loadTile:function(t,e){var i=this;t.loading=!0,this._imageLoader.addJob({src:t.getUrl(),tile:t,source:this.source,postData:t.postData,loadWithAjax:t.loadWithAjax,ajaxHeaders:t.ajaxHeaders,crossOriginPolicy:this.crossOriginPolicy,ajaxWithCredentials:this.ajaxWithCredentials,callback:function(n,o,r){i._onTileLoad(t,e,n,o,r)},abort:function(){t.loading=!1}})},_onTileLoad:function(e,i,n,o,r){if(!n)return t.console.error("Tile %s failed to load: %s - error: %s",e,e.getUrl(),o),this.viewer.raiseEvent("tile-load-failed",{tile:e,tiledImage:this,time:i,message:o,tileRequest:r}),e.loading=!1,void(e.exists=!1);if(e.exists=!0,i<this.lastResetTime)return t.console.warn("Ignoring tile %s loaded before reset: %s",e,e.getUrl()),void(e.loading=!1);var s=this,a=function(){var t=s.source.getClosestLevel();s._setTileLoaded(e,n,t,r)};this._midDraw?window.setTimeout(a,1):a()},_setTileLoaded:function(e,i,n,o){var r=0,s=!1,a=this;function l(){return s&&t.console.error("Event 'tile-loaded' argument getCompletionCallback must be called synchronously. Its return value should be called asynchronously."),r++,c}function c(){0===--r&&(e.loading=!1,e.loaded=!0,e.hasTransparency=a.source.hasTransparency(e.context2D,e.getUrl(),e.ajaxHeaders,e.postData),e.context2D||a._tileCache.cacheTile({data:i,tile:e,cutoff:n,tiledImage:a}),a._needsDraw=!0)}var u=l();this.viewer.raiseEvent("tile-loaded",{tile:e,tiledImage:this,tileRequest:o,get image(){return t.console.error("[tile-loaded] event 'image' has been deprecated. Use 'data' property instead."),i},data:i,getCompletionCallback:l}),s=!0,u()},_positionTile:function(e,i,n,o,r){var s=e.bounds.getTopLeft();s.x*=this._scaleSpring.current.value,s.y*=this._scaleSpring.current.value,s.x+=this._xSpring.current.value,s.y+=this._ySpring.current.value;var a=e.bounds.getSize();a.x*=this._scaleSpring.current.value,a.y*=this._scaleSpring.current.value;var l=n.pixelFromPointNoRotate(s,!0),c=n.pixelFromPointNoRotate(s,!1),u=n.deltaPixelsFromPointsNoRotate(a,!0),h=n.deltaPixelsFromPointsNoRotate(a,!1),p=c.plus(h.divide(2)),d=o.squaredDistanceTo(p);i||(u=u.plus(new t.Point(1,1))),e.isRightMost&&this.wrapHorizontal&&(u.x+=.75),e.isBottomMost&&this.wrapVertical&&(u.y+=.75),e.position=l,e.size=u,e.squaredDistance=d,e.visibility=r},_blendTile:function(t,e,i,n,o,r){var s,a,l=1e3*this.blendTime;if(t.blendStart||(t.blendStart=r),s=r-t.blendStart,a=l?Math.min(1,s/l):1,this.alwaysBlend&&(a*=o),t.opacity=a,this.lastDrawn.push(t),1===a)this._setCoverage(this.coverage,n,e,i,!0),this._hasOpaqueTile=!0;else if(s<l)return!0;return!1},_compareTiles:function(t,e){return t?e.visibility>t.visibility||e.visibility===t.visibility&&e.squaredDistance<t.squaredDistance?e:t:e},_drawTiles:function(o){if(0!==this.opacity&&(0!==o.length||this.placeholderFillStyle)){var r,s,a,l=o[0];l&&(r=this.opacity<1||this.compositeOperation&&"source-over"!==this.compositeOperation||!this._isBottomItem()&&this.source.hasTransparency(l.context2D,l.getUrl(),l.ajaxHeaders,l.postData));var c,u=this.viewport.getZoom(!0),h=this.viewportToImageZoom(u);o.length>1&&h>this.smoothTileEdgesMinZoom&&!this.iOSDevice&&this.getRotation(!0)%360==0&&t.supportsCanvas&&this.viewer.useCanvas&&(r=!0,s=l.getScaleForEdgeSmoothing(),a=l.getTranslationForEdgeSmoothing(s,this._drawer.getCanvasSize(!1),this._drawer.getCanvasSize(!0))),r&&(s||(c=this.viewport.viewportToViewerElementRectangle(this.getClippedBounds(!0)).getIntegerBoundingBox(),this._drawer.viewer.viewport.getFlip()&&(this.viewport.getRotation(!0)%360==0&&this.getRotation(!0)%360==0||(c.x=this._drawer.viewer.container.clientWidth-(c.x+c.width))),c=c.times(t.pixelDensityRatio)),this._drawer._clear(!0,c)),s||(this.viewport.getRotation(!0)%360!=0&&this._drawer._offsetForRotation({degrees:this.viewport.getRotation(!0),useSketch:r}),this.getRotation(!0)%360!=0&&this._drawer._offsetForRotation({degrees:this.getRotation(!0),point:this.viewport.pixelFromPointNoRotate(this._getRotationPoint(!0),!0),useSketch:r}),this.viewport.getRotation(!0)%360==0&&this.getRotation(!0)%360==0&&this._drawer.viewer.viewport.getFlip()&&this._drawer._flip());var p=!1;if(this._clip){this._drawer.saveContext(r);var d=this.imageToViewportRectangle(this._clip,!0);d=d.rotate(-this.getRotation(!0),this._getRotationPoint(!0));var f=this._drawer.viewportToDrawerRectangle(d);s&&(f=f.times(s)),a&&(f=f.translate(a)),this._drawer.setClip(f,r),p=!0}if(this._croppingPolygons){var v=this;this._drawer.saveContext(r);try{var g=this._croppingPolygons.map(function(t){return t.map(function(t){var e=v.imageToViewportCoordinates(t.x,t.y,!0).rotate(-v.getRotation(!0),v._getRotationPoint(!0)),i=v._drawer.viewportCoordToDrawerCoord(e);return s&&(i=i.times(s)),a&&(i=i.plus(a)),i})});this._drawer.clipWithPolygons(g,r)}catch(T){t.console.error(T)}p=!0}if(this.placeholderFillStyle&&!1===this._hasOpaqueTile){var m=this._drawer.viewportToDrawerRectangle(this.getBounds(!0));s&&(m=m.times(s)),a&&(m=m.translate(a));var y=null;y="function"==typeof this.placeholderFillStyle?this.placeholderFillStyle(this,this._drawer.context):this.placeholderFillStyle,this._drawer.drawRectangle(m,y,r)}var w=function(o){if("number"==typeof o)return n(o);if(!o||!t.Browser)return e;var r=o[t.Browser.vendor];i(r)&&(r=o["*"]);return n(r)}(this.subPixelRoundingForTransparency),x=!1;if(w===t.SUBPIXEL_ROUNDING_OCCURRENCES.ALWAYS)x=!0;else if(w===t.SUBPIXEL_ROUNDING_OCCURRENCES.ONLY_AT_REST){x=!(this.viewer&&this.viewer.isAnimating())}for(var b=o.length-1;b>=0;b--)l=o[b],this._drawer.drawTile(l,this._drawingHandler,r,s,a,x,this.source),l.beingDrawn=!0,this.viewer&&this.viewer.raiseEvent("tile-drawn",{tiledImage:this,tile:l});p&&this._drawer.restoreContext(r),s||(this.getRotation(!0)%360!=0&&this._drawer._restoreRotationChanges(r),this.viewport.getRotation(!0)%360!=0&&this._drawer._restoreRotationChanges(r)),r&&(s&&(this.viewport.getRotation(!0)%360!=0&&this._drawer._offsetForRotation({degrees:this.viewport.getRotation(!0),useSketch:!1}),this.getRotation(!0)%360!=0&&this._drawer._offsetForRotation({degrees:this.getRotation(!0),point:this.viewport.pixelFromPointNoRotate(this._getRotationPoint(!0),!0),useSketch:!1})),this._drawer.blendSketch({opacity:this.opacity,scale:s,translate:a,compositeOperation:this.compositeOperation,bounds:c}),s&&(this.getRotation(!0)%360!=0&&this._drawer._restoreRotationChanges(!1),this.viewport.getRotation(!0)%360!=0&&this._drawer._restoreRotationChanges(!1))),s||this.viewport.getRotation(!0)%360==0&&this.getRotation(!0)%360==0&&this._drawer.viewer.viewport.getFlip()&&this._drawer._flip(),this._drawDebugInfo(o)}},_drawDebugInfo:function(e){if(this.debugMode)for(var i=e.length-1;i>=0;i--){var n=e[i];try{this._drawer.drawDebugInfo(n,e.length,i,this)}catch(o){t.console.error(o)}}},_providesCoverage:function(t,e,i,n){var o,r,s,a;if(!t[e])return!1;if(void 0===i||void 0===n){for(s in o=t[e])if(Object.prototype.hasOwnProperty.call(o,s))for(a in r=o[s])if(Object.prototype.hasOwnProperty.call(r,a)&&!r[a])return!1;return!0}return void 0===t[e][i]||void 0===t[e][i][n]||!0===t[e][i][n]},_isCovered:function(t,e,i,n){return void 0===i||void 0===n?this._providesCoverage(t,e+1):this._providesCoverage(t,e+1,2*i,2*n)&&this._providesCoverage(t,e+1,2*i,2*n+1)&&this._providesCoverage(t,e+1,2*i+1,2*n)&&this._providesCoverage(t,e+1,2*i+1,2*n+1)},_setCoverage:function(e,i,n,o,r){e[i]?(e[i][n]||(e[i][n]={}),e[i][n][o]=r):t.console.warn("Setting coverage for a tile before its level's coverage has been reset: %s",i)},_resetCoverage:function(t,e){t[e]={}}});var e=t.SUBPIXEL_ROUNDING_OCCURRENCES.NEVER;function i(e){return e!==t.SUBPIXEL_ROUNDING_OCCURRENCES.ALWAYS&&e!==t.SUBPIXEL_ROUNDING_OCCURRENCES.ONLY_AT_REST&&e!==t.SUBPIXEL_ROUNDING_OCCURRENCES.NEVER}function n(t){return i(t)?e:t}}(a),function(t){var e=function(e){t.console.assert(e,"[TileCache.cacheTile] options is required"),t.console.assert(e.tile,"[TileCache.cacheTile] options.tile is required"),t.console.assert(e.tiledImage,"[TileCache.cacheTile] options.tiledImage is required"),this.tile=e.tile,this.tiledImage=e.tiledImage},i=function(e){t.console.assert(e,"[ImageRecord] options is required"),t.console.assert(e.data,"[ImageRecord] options.data is required"),this._tiles=[],e.create.apply(null,[this,e.data,e.ownerTile]),this._destroyImplementation=e.destroy.bind(null,this),this.getImage=e.getImage.bind(null,this),this.getData=e.getData.bind(null,this),this.getRenderedContext=e.getRenderedContext.bind(null,this),this.getCopyRenderedContext=e.getCopyRenderedContext.bind(null,this)};i.prototype={destroy:function(){this._destroyImplementation(),this._tiles=null},addTile:function(e){t.console.assert(e,"[ImageRecord.addTile] tile is required"),this._tiles.push(e)},removeTile:function(e){for(var i=0;i<this._tiles.length;i++)if(this._tiles[i]===e)return void this._tiles.splice(i,1);t.console.warn("[ImageRecord.removeTile] trying to remove unknown tile",e)},getTileCount:function(){return this._tiles.length}},t.TileCache=function(e){e=e||{},this._maxImageCacheCount=e.maxImageCacheCount||t.DEFAULT_SETTINGS.maxImageCacheCount,this._tilesLoaded=[],this._imagesLoaded=[],this._imagesLoadedCount=0},t.TileCache.prototype={numTilesLoaded:function(){return this._tilesLoaded.length},cacheTile:function(n){t.console.assert(n,"[TileCache.cacheTile] options is required"),t.console.assert(n.tile,"[TileCache.cacheTile] options.tile is required"),t.console.assert(n.tile.cacheKey,"[TileCache.cacheTile] options.tile.cacheKey is required"),t.console.assert(n.tiledImage,"[TileCache.cacheTile] options.tiledImage is required");var o=n.cutoff||0,r=this._tilesLoaded.length,s=this._imagesLoaded[n.tile.cacheKey];if(s||(n.data||(t.console.error("[TileCache.cacheTile] options.image was renamed to options.data. '.image' attribute has been deprecated and will be removed in the future."),n.data=n.image),t.console.assert(n.data,"[TileCache.cacheTile] options.data is required to create an ImageRecord"),s=this._imagesLoaded[n.tile.cacheKey]=new i({data:n.data,ownerTile:n.tile,create:n.tiledImage.source.createTileCache,destroy:n.tiledImage.source.destroyTileCache,getImage:n.tiledImage.source.getTileCacheDataAsImage,getData:n.tiledImage.source.getTileCacheData,getRenderedContext:n.tiledImage.source.getTileCacheDataAsContext2D,getCopyRenderedContext:n.tiledImage.source.getCopyTileCacheDataAsContext2D}),this._imagesLoadedCount++),s.addTile(n.tile),n.tile.cacheImageRecord=s,this._imagesLoadedCount>this._maxImageCacheCount){for(var a,l,c,u,h,p,d=null,f=-1,v=null,g=this._tilesLoaded.length-1;g>=0;g--)(a=(p=this._tilesLoaded[g]).tile).level<=o||a.beingDrawn||(d?(u=a.lastTouchTime,l=d.lastTouchTime,h=a.level,c=d.level,(u<l||u===l&&h>c)&&(d=a,f=g,v=p)):(d=a,f=g,v=p));d&&f>=0&&(this._unloadTile(v),r=f)}this._tilesLoaded[r]=new e({tile:n.tile,tiledImage:n.tiledImage})},clearTilesFor:function(e){var i;t.console.assert(e,"[TileCache.clearTilesFor] tiledImage is required");for(var n=0;n<this._tilesLoaded.length;++n)(i=this._tilesLoaded[n]).tiledImage===e&&(this._unloadTile(i),this._tilesLoaded.splice(n,1),n--)},getImageRecord:function(e){return t.console.assert(e,"[TileCache.getImageRecord] cacheKey is required"),this._imagesLoaded[e]},_unloadTile:function(e){t.console.assert(e,"[TileCache._unloadTile] tileRecord is required");var i=e.tile,n=e.tiledImage;i.unload(),i.cacheImageRecord=null;var o=this._imagesLoaded[i.cacheKey];o.removeTile(i),o.getTileCount()||(o.destroy(),delete this._imagesLoaded[i.cacheKey],this._imagesLoadedCount--),n.viewer.raiseEvent("tile-unloaded",{tile:i,tiledImage:n})}}}(a),function(t){t.World=function(e){var i=this;t.console.assert(e.viewer,"[World] options.viewer is required"),t.EventSource.call(this),this.viewer=e.viewer,this._items=[],this._needsDraw=!1,this._autoRefigureSizes=!0,this._needsSizesFigured=!1,this._delegatedFigureSizes=function(t){i._autoRefigureSizes?i._figureSizes():i._needsSizesFigured=!0},this._figureSizes()},t.extend(t.World.prototype,t.EventSource.prototype,{addItem:function(e,i){if(t.console.assert(e,"[World.addItem] item is required"),t.console.assert(e instanceof t.TiledImage,"[World.addItem] only TiledImages supported at this time"),void 0!==(i=i||{}).index){var n=Math.max(0,Math.min(this._items.length,i.index));this._items.splice(n,0,e)}else this._items.push(e);this._autoRefigureSizes?this._figureSizes():this._needsSizesFigured=!0,this._needsDraw=!0,e.addHandler("bounds-change",this._delegatedFigureSizes),e.addHandler("clip-change",this._delegatedFigureSizes),this.raiseEvent("add-item",{item:e})},getItemAt:function(e){return t.console.assert(void 0!==e,"[World.getItemAt] index is required"),this._items[e]},getIndexOfItem:function(e){return t.console.assert(e,"[World.getIndexOfItem] item is required"),t.indexOf(this._items,e)},getItemCount:function(){return this._items.length},setItemIndex:function(e,i){t.console.assert(e,"[World.setItemIndex] item is required"),t.console.assert(void 0!==i,"[World.setItemIndex] index is required");var n=this.getIndexOfItem(e);if(i>=this._items.length)throw new Error("Index bigger than number of layers.");i!==n&&-1!==n&&(this._items.splice(n,1),this._items.splice(i,0,e),this._needsDraw=!0,this.raiseEvent("item-index-change",{item:e,previousIndex:n,newIndex:i}))},removeItem:function(e){t.console.assert(e,"[World.removeItem] item is required");var i=t.indexOf(this._items,e);-1!==i&&(e.removeHandler("bounds-change",this._delegatedFigureSizes),e.removeHandler("clip-change",this._delegatedFigureSizes),e.destroy(),this._items.splice(i,1),this._figureSizes(),this._needsDraw=!0,this._raiseRemoveItem(e))},removeAll:function(){var t,e;for(this.viewer._cancelPendingImages(),e=0;e<this._items.length;e++)(t=this._items[e]).removeHandler("bounds-change",this._delegatedFigureSizes),t.removeHandler("clip-change",this._delegatedFigureSizes),t.destroy();var i=this._items;for(this._items=[],this._figureSizes(),this._needsDraw=!0,e=0;e<i.length;e++)t=i[e],this._raiseRemoveItem(t)},resetItems:function(){for(var t=0;t<this._items.length;t++)this._items[t].reset()},update:function(){for(var t=!1,e=0;e<this._items.length;e++)t=this._items[e].update()||t;return t},draw:function(){for(var t=0;t<this._items.length;t++)this._items[t].draw();this._needsDraw=!1},needsDraw:function(){for(var t=0;t<this._items.length;t++)if(this._items[t].needsDraw())return!0;return this._needsDraw},getHomeBounds:function(){return this._homeBounds.clone()},getContentFactor:function(){return this._contentFactor},setAutoRefigureSizes:function(t){this._autoRefigureSizes=t,t&this._needsSizesFigured&&(this._figureSizes(),this._needsSizesFigured=!1)},arrange:function(e){var i,n=(e=e||{}).immediately||!1,o=e.layout||t.DEFAULT_SETTINGS.collectionLayout,r=e.rows||t.DEFAULT_SETTINGS.collectionRows,s=e.columns||t.DEFAULT_SETTINGS.collectionColumns,a=e.tileSize||t.DEFAULT_SETTINGS.collectionTileSize,l=a+(e.tileMargin||t.DEFAULT_SETTINGS.collectionTileMargin);i=!e.rows&&s?s:Math.ceil(this._items.length/r);var c,u,h,p,d,f=0,v=0;this.setAutoRefigureSizes(!1);for(var g=0;g<this._items.length;g++)g&&g%i===0&&("horizontal"===o?(v+=l,f=0):(f+=l,v=0)),p=(h=(u=(c=this._items[g]).getBounds()).width>u.height?a:a*(u.width/u.height))*(u.height/u.width),d=new t.Point(f+(a-h)/2,v+(a-p)/2),c.setPosition(d,n),c.setWidth(h,n),"horizontal"===o?f+=l:v+=l;this.setAutoRefigureSizes(!0)},_figureSizes:function(){var e=this._homeBounds?this._homeBounds.clone():null,i=this._contentSize?this._contentSize.clone():null,n=this._contentFactor||0;if(this._items.length){var o=this._items[0],r=o.getBounds();this._contentFactor=o.getContentSize().x/r.width;for(var s=o.getClippedBounds().getBoundingBox(),a=s.x,l=s.y,c=s.x+s.width,u=s.y+s.height,h=1;h<this._items.length;h++)r=(o=this._items[h]).getBounds(),this._contentFactor=Math.max(this._contentFactor,o.getContentSize().x/r.width),s=o.getClippedBounds().getBoundingBox(),a=Math.min(a,s.x),l=Math.min(l,s.y),c=Math.max(c,s.x+s.width),u=Math.max(u,s.y+s.height);this._homeBounds=new t.Rect(a,l,c-a,u-l),this._contentSize=new t.Point(this._homeBounds.width*this._contentFactor,this._homeBounds.height*this._contentFactor)}else this._homeBounds=new t.Rect(0,0,1,1),this._contentSize=new t.Point(1,1),this._contentFactor=1;this._contentFactor===n&&this._homeBounds.equals(e)&&this._contentSize.equals(i)||this.raiseEvent("metrics-change",{})},_raiseRemoveItem:function(t){this.raiseEvent("remove-item",{item:t})}})}(a)},2886:function(t,e,i){var n=i(200),o=i(9965),r=n.WeakMap;t.exports="function"==typeof r&&/native code/.test(o(r))},2982:function(t,e,i){var n=i(1605),o=i(7806),r=i(298);n({target:"Array",proto:!0},{fill:o}),r("fill")},2998:function(t,e,i){var n=i(5335),o=i(8679),r=i(1602)("species");t.exports=function(t,e){var i;return o(t)&&("function"!=typeof(i=t.constructor)||i!==Array&&!o(i.prototype)?n(i)&&null===(i=i[r])&&(i=void 0):i=void 0),new(void 0===i?Array:i)(0===e?0:e)}},3023:function(t,e,i){i(1605)({target:"Object",stat:!0},{is:i(4741)})},3054:function(t,e,i){var n=i(5335),o=i(9686);t.exports=function(t,e,i){var r,s;return o&&"function"==typeof(r=e.constructor)&&r!==i&&n(s=r.prototype)&&s!==i.prototype&&o(t,s),t}},3062:function(t,e,i){var n=i(3129),o=i(8569),r=i(1602)("toStringTag"),s="Arguments"==o(function(){return arguments}());t.exports=n?o:function(t){var e,i,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(i=function(t,e){try{return t[e]}catch(i){}}(e=Object(t),r))?i:s?o(e):"Object"==(n=o(e))&&"function"==typeof e.callee?"Arguments":n}},3105:function(t,e,i){var n,o=i(3938),r=i(5318),s=i(290),a=i(7708),l=i(8890),c=i(3262),u=i(5904),h="prototype",p="script",d=u("IE_PROTO"),f=function(){},v=function(t){return"<"+p+">"+t+"</"+p+">"},g=function(){try{n=document.domain&&new ActiveXObject("htmlfile")}catch(r){}var t,e,i;g=n?function(t){t.write(v("")),t.close();var e=t.parentWindow.Object;return t=null,e}(n):(e=c("iframe"),i="java"+p+":",e.style.display="none",l.appendChild(e),e.src=String(i),(t=e.contentWindow.document).open(),t.write(v("document.F=Object")),t.close(),t.F);for(var o=s.length;o--;)delete g[h][s[o]];return g()};a[d]=!0,t.exports=Object.create||function(t,e){var i;return null!==t?(f[h]=o(t),i=new f,f[h]=null,i[d]=t):i=g(),void 0===e?i:r(i,e)}},3129:function(t,e,i){var n={};n[i(1602)("toStringTag")]="z",t.exports="[object z]"===String(n)},3148:function(t,e,i){var n=i(1605),o=i(2588),r=i(1229);n({target:"String",proto:!0,forced:!i(4177)("includes")},{includes:function(t){return!!~String(r(this)).indexOf(o(t),arguments.length>1?arguments[1]:void 0)}})},3172:function(t,e,i){var n=i(5077),o=i(1641),r=i(5476),s=i(9304).f,a=function(t){return function(e){for(var i,a=r(e),l=o(a),c=l.length,u=0,h=[];c>u;)i=l[u++],n&&!s.call(a,i)||h.push(t?[i,a[i]]:a[i]);return h}};t.exports={entries:a(!0),values:a(!1)}},3262:function(t,e,i){var n=i(200),o=i(5335),r=n.document,s=o(r)&&o(r.createElement);t.exports=function(t){return s?r.createElement(t):{}}},3444:function(t,e,i){var n=i(3938),o=i(9085),r=i(1602)("species");t.exports=function(t,e){var i,s=n(t).constructor;return void 0===s||null==(i=n(s)[r])?e:o(i)}},3534:function(t,e,i){var n=i(1605),o=i(200),r=i(6492),s=i(6926),a=i(5077),l=i(1849),c=i(5225),u=i(2074),h=i(1883),p=i(8679),d=i(5335),f=i(3938),v=i(2612),g=i(5476),m=i(874),y=i(6843),w=i(3105),x=i(1641),b=i(4789),T=i(6509),P=i(8916),S=i(7632),E=i(3610),C=i(9304),_=i(7712),O=i(7485),R=i(2),I=i(5904),k=i(7708),D=i(665),M=i(1602),j=i(802),L=i(1272),A=i(5282),B=i(9206),N=i(1344).forEach,z=I("hidden"),H="Symbol",F="prototype",W=M("toPrimitive"),V=B.set,U=B.getterFor(H),G=Object[F],Z=o.Symbol,q=r("JSON","stringify"),$=S.f,X=E.f,K=T.f,Y=C.f,J=R("symbols"),Q=R("op-symbols"),tt=R("string-to-symbol-registry"),et=R("symbol-to-string-registry"),it=R("wks"),nt=o.QObject,ot=!nt||!nt[F]||!nt[F].findChild,rt=a&&u(function(){return 7!=w(X({},"a",{get:function(){return X(this,"a",{value:7}).a}})).a})?function(t,e,i){var n=$(G,e);n&&delete G[e],X(t,e,i),n&&t!==G&&X(G,e,n)}:X,st=function(t,e){var i=J[t]=w(Z[F]);return V(i,{type:H,tag:t,description:e}),a||(i.description=e),i},at=c?function(t){return"symbol"==typeof t}:function(t){return Object(t)instanceof Z},lt=function(t,e,i){t===G&&lt(Q,e,i),f(t);var n=m(e,!0);return f(i),h(J,n)?(i.enumerable?(h(t,z)&&t[z][n]&&(t[z][n]=!1),i=w(i,{enumerable:y(0,!1)})):(h(t,z)||X(t,z,y(1,{})),t[z][n]=!0),rt(t,n,i)):X(t,n,i)},ct=function(t,e){f(t);var i=g(e),n=x(i).concat(dt(i));return N(n,function(e){a&&!ut.call(i,e)||lt(t,e,i[e])}),t},ut=function(t){var e=m(t,!0),i=Y.call(this,e);return!(this===G&&h(J,e)&&!h(Q,e))&&(!(i||!h(this,e)||!h(J,e)||h(this,z)&&this[z][e])||i)},ht=function(t,e){var i=g(t),n=m(e,!0);if(i!==G||!h(J,n)||h(Q,n)){var o=$(i,n);return!o||!h(J,n)||h(i,z)&&i[z][n]||(o.enumerable=!0),o}},pt=function(t){var e=K(g(t)),i=[];return N(e,function(t){h(J,t)||h(k,t)||i.push(t)}),i},dt=function(t){var e=t===G,i=K(e?Q:g(t)),n=[];return N(i,function(t){!h(J,t)||e&&!h(G,t)||n.push(J[t])}),n};(l||(Z=function(){if(this instanceof Z)throw TypeError("Symbol is not a constructor");var t=arguments.length&&void 0!==arguments[0]?String(arguments[0]):void 0,e=D(t),i=function(t){this===G&&i.call(Q,t),h(this,z)&&h(this[z],e)&&(this[z][e]=!1),rt(this,e,y(1,t))};return a&&ot&&rt(G,e,{configurable:!0,set:i}),st(e,t)},O(Z[F],"toString",function(){return U(this).tag}),O(Z,"withoutSetter",function(t){return st(D(t),t)}),C.f=ut,E.f=lt,S.f=ht,b.f=T.f=pt,P.f=dt,j.f=function(t){return st(M(t),t)},a&&(X(Z[F],"description",{configurable:!0,get:function(){return U(this).description}}),s||O(G,"propertyIsEnumerable",ut,{unsafe:!0}))),n({global:!0,wrap:!0,forced:!l,sham:!l},{Symbol:Z}),N(x(it),function(t){L(t)}),n({target:H,stat:!0,forced:!l},{for:function(t){var e=String(t);if(h(tt,e))return tt[e];var i=Z(e);return tt[e]=i,et[i]=e,i},keyFor:function(t){if(!at(t))throw TypeError(t+" is not a symbol");if(h(et,t))return et[t]},useSetter:function(){ot=!0},useSimple:function(){ot=!1}}),n({target:"Object",stat:!0,forced:!l,sham:!a},{create:function(t,e){return void 0===e?w(t):ct(w(t),e)},defineProperty:lt,defineProperties:ct,getOwnPropertyDescriptor:ht}),n({target:"Object",stat:!0,forced:!l},{getOwnPropertyNames:pt,getOwnPropertySymbols:dt}),n({target:"Object",stat:!0,forced:u(function(){P.f(1)})},{getOwnPropertySymbols:function(t){return P.f(v(t))}}),q)&&n({target:"JSON",stat:!0,forced:!l||u(function(){var t=Z();return"[null]"!=q([t])||"{}"!=q({a:t})||"{}"!=q(Object(t))})},{stringify:function(t,e,i){for(var n,o=[t],r=1;arguments.length>r;)o.push(arguments[r++]);if(n=e,(d(e)||void 0!==t)&&!at(t))return p(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!at(e))return e}),o[1]=e,q.apply(null,o)}});Z[F][W]||_(Z[F],W,Z[F].valueOf),A(Z,H),k[z]=!0},3604:function(t,e,i){var n=i(1605),o=i(1344).every,r=i(2349),s=i(3638),a=r("every"),l=s("every");n({target:"Array",proto:!0,forced:!a||!l},{every:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}})},3610:function(t,e,i){var n=i(5077),o=i(7694),r=i(3938),s=i(874),a=Object.defineProperty;e.f=n?a:function(t,e,i){if(r(t),e=s(e,!0),r(i),o)try{return a(t,e,i)}catch(n){}if("get"in i||"set"in i)throw TypeError("Accessors not supported");return"value"in i&&(t[e]=i.value),t}},3638:function(t,e,i){var n=i(5077),o=i(2074),r=i(1883),s=Object.defineProperty,a={},l=function(t){throw t};t.exports=function(t,e){if(r(a,t))return a[t];e||(e={});var i=[][t],c=!!r(e,"ACCESSORS")&&e.ACCESSORS,u=r(e,0)?e[0]:l,h=r(e,1)?e[1]:void 0;return a[t]=!!i&&!o(function(){if(c&&!n)return!0;var t={length:-1};c?s(t,1,{enumerable:!0,get:l}):t[1]=1,i.call(t,u,h)})}},3747:function(t,e,i){var n=i(7317),o=Math.min;t.exports=function(t){return t>0?o(n(t),9007199254740991):0}},3938:function(t,e,i){var n=i(5335);t.exports=function(t){if(!n(t))throw TypeError(String(t)+" is not an object");return t}},4009:function(t,e,i){var n=i(5077),o=i(200),r=i(4977),s=i(7485),a=i(1883),l=i(8569),c=i(3054),u=i(874),h=i(2074),p=i(3105),d=i(4789).f,f=i(7632).f,v=i(3610).f,g=i(9163).trim,m="Number",y=o[m],w=y.prototype,x=l(p(w))==m,b=function(t){var e,i,n,o,r,s,a,l,c=u(t,!1);if("string"==typeof c&&c.length>2)if(43===(e=(c=g(c)).charCodeAt(0))||45===e){if(88===(i=c.charCodeAt(2))||120===i)return NaN}else if(48===e){switch(c.charCodeAt(1)){case 66:case 98:n=2,o=49;break;case 79:case 111:n=8,o=55;break;default:return+c}for(s=(r=c.slice(2)).length,a=0;a<s;a++)if((l=r.charCodeAt(a))<48||l>o)return NaN;return parseInt(r,n)}return+c};if(r(m,!y(" 0o1")||!y("0b1")||y("+0x1"))){for(var T,P=function(t){var e=arguments.length<1?0:t,i=this;return i instanceof P&&(x?h(function(){w.valueOf.call(i)}):l(i)!=m)?c(new y(b(e)),i,P):b(e)},S=n?d(y):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),E=0;S.length>E;E++)a(y,T=S[E])&&!a(P,T)&&v(P,T,f(y,T));P.prototype=w,w.constructor=P,s(o,m,P)}},4177:function(t,e,i){var n=i(1602)("match");t.exports=function(t){var e=/./;try{"/./"[t](e)}catch(i){try{return e[n]=!1,"/./"[t](e)}catch(o){}}return!1}},4361:function(t,e,i){var n=i(1883),o=i(5816),r=i(7632),s=i(3610);t.exports=function(t,e){for(var i=o(e),a=s.f,l=r.f,c=0;c<i.length;c++){var u=i[c];n(t,u)||a(t,u,l(e,u))}}},4632:function(t,e,i){i(1605)({target:"Object",stat:!0},{setPrototypeOf:i(9686)})},4741:function(t){t.exports=Object.is||function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}},4789:function(t,e,i){var n=i(6347),o=i(290).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return n(t,o)}},4867:function(t,e,i){var n=i(1605),o=i(7317),r=i(7809),s=i(140),a=i(2074),l=1..toFixed,c=Math.floor,u=function(t,e,i){return 0===e?i:e%2==1?u(t,e-1,i*t):u(t*t,e/2,i)};n({target:"Number",proto:!0,forced:l&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==(0xde0b6b3a7640080).toFixed(0))||!a(function(){l.call({})})},{toFixed:function(t){var e,i,n,a,l=r(this),h=o(t),p=[0,0,0,0,0,0],d="",f="0",v=function(t,e){for(var i=-1,n=e;++i<6;)n+=t*p[i],p[i]=n%1e7,n=c(n/1e7)},g=function(t){for(var e=6,i=0;--e>=0;)i+=p[e],p[e]=c(i/t),i=i%t*1e7},m=function(){for(var t=6,e="";--t>=0;)if(""!==e||0===t||0!==p[t]){var i=String(p[t]);e=""===e?i:e+s.call("0",7-i.length)+i}return e};if(h<0||h>20)throw RangeError("Incorrect fraction digits");if(l!=l)return"NaN";if(l<=-1e21||l>=1e21)return String(l);if(l<0&&(d="-",l=-l),l>1e-21)if(i=(e=function(t){for(var e=0,i=t;i>=4096;)e+=12,i/=4096;for(;i>=2;)e+=1,i/=2;return e}(l*u(2,69,1))-69)<0?l*u(2,-e,1):l/u(2,e,1),i*=4503599627370496,(e=52-e)>0){for(v(0,i),n=h;n>=7;)v(1e7,0),n-=7;for(v(u(10,n,1),0),n=e-1;n>=23;)g(1<<23),n-=23;g(1<<n),v(1,1),g(2),f=m()}else v(0,i),v(1<<-e,0),f=m()+s.call("0",h);return f=h>0?d+((a=f.length)<=h?"0."+s.call("0",h-a)+f:f.slice(0,a-h)+"."+f.slice(a-h)):d+f}})},4913:function(t,e,i){var n=i(1605),o=i(5335),r=i(8679),s=i(6539),a=i(3747),l=i(5476),c=i(2057),u=i(1602),h=i(5634),p=i(3638),d=h("slice"),f=p("slice",{ACCESSORS:!0,0:0,1:2}),v=u("species"),g=[].slice,m=Math.max;n({target:"Array",proto:!0,forced:!d||!f},{slice:function(t,e){var i,n,u,h=l(this),p=a(h.length),d=s(t,p),f=s(void 0===e?p:e,p);if(r(h)&&("function"!=typeof(i=h.constructor)||i!==Array&&!r(i.prototype)?o(i)&&null===(i=i[v])&&(i=void 0):i=void 0,i===Array||void 0===i))return g.call(h,d,f);for(n=new(void 0===i?Array:i)(m(f-d,0)),u=0;d<f;d++,u++)d in h&&c(n,u,h[d]);return n.length=u,n}})},4972:function(t,e,i){var n=i(3129),o=i(3062);t.exports=n?{}.toString:function(){return"[object "+o(this)+"]"}},4977:function(t,e,i){var n=i(2074),o=/#|\.prototype\./,r=function(t,e){var i=a[s(t)];return i==c||i!=l&&("function"==typeof e?n(e):!!e)},s=r.normalize=function(t){return String(t).replace(o,".").toLowerCase()},a=r.data={},l=r.NATIVE="N",c=r.POLYFILL="P";t.exports=r},5056:function(t,e,i){t.exports=function(t){var e=i.nc;e&&t.setAttribute("nonce",e)}},5072:function(t){var e=[];function i(t){for(var i=-1,n=0;n<e.length;n++)if(e[n].identifier===t){i=n;break}return i}function n(t,n){for(var r={},s=[],a=0;a<t.length;a++){var l=t[a],c=n.base?l[0]+n.base:l[0],u=r[c]||0,h="".concat(c," ").concat(u);r[c]=u+1;var p=i(h),d={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==p)e[p].references++,e[p].updater(d);else{var f=o(d,n);n.byIndex=a,e.splice(a,0,{identifier:h,updater:f,references:1})}s.push(h)}return s}function o(t,e){var i=e.domAPI(e);i.update(t);return function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;i.update(t=e)}else i.remove()}}t.exports=function(t,o){var r=n(t=t||[],o=o||{});return function(t){t=t||[];for(var s=0;s<r.length;s++){var a=i(r[s]);e[a].references--}for(var l=n(t,o),c=0;c<r.length;c++){var u=i(r[c]);0===e[u].references&&(e[u].updater(),e.splice(u,1))}r=l}}},5073:function(t){t.exports="\t\n\v\f\r                 \u2028\u2029\ufeff"},5077:function(t,e,i){var n=i(2074);t.exports=!n(function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})},5086:function(t,e,i){var n=i(3129),o=i(7485),r=i(4972);n||o(Object.prototype,"toString",r,{unsafe:!0})},5225:function(t,e,i){var n=i(1849);t.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},5231:function(t,e,i){var n=i(1605),o=i(9085),r=i(2612),s=i(2074),a=i(2349),l=[],c=l.sort,u=s(function(){l.sort(void 0)}),h=s(function(){l.sort(null)}),p=a("sort");n({target:"Array",proto:!0,forced:u||!h||!p},{sort:function(t){return void 0===t?c.call(r(this)):c.call(r(this),o(t))}})},5282:function(t,e,i){var n=i(3610).f,o=i(1883),r=i(1602)("toStringTag");t.exports=function(t,e,i){t&&!o(t=i?t:t.prototype,r)&&n(t,r,{configurable:!0,value:e})}},5318:function(t,e,i){var n=i(5077),o=i(3610),r=i(3938),s=i(1641);t.exports=n?Object.defineProperties:function(t,e){r(t);for(var i,n=s(e),a=n.length,l=0;a>l;)o.f(t,i=n[l++],e[i]);return t}},5335:function(t){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},5476:function(t,e,i){var n=i(8664),o=i(1229);t.exports=function(t){return n(o(t))}},5549:function(t){t.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},5634:function(t,e,i){var n=i(2074),o=i(1602),r=i(6845),s=o("species");t.exports=function(t){return r>=51||!n(function(){var e=[];return(e.constructor={})[s]=function(){return{foo:1}},1!==e[t](Boolean).foo})}},5816:function(t,e,i){var n=i(6492),o=i(4789),r=i(8916),s=i(3938);t.exports=n("Reflect","ownKeys")||function(t){var e=o.f(s(t)),i=r.f;return i?e.concat(i(t)):e}},5904:function(t,e,i){var n=i(2),o=i(665),r=n("keys");t.exports=function(t){return r[t]||(r[t]=o(t))}},5975:function(t,e,i){var n=i(200),o=i(7712);t.exports=function(t,e){try{o(n,t,e)}catch(i){n[t]=e}return e}},6048:function(t,e,i){var n=i(7485),o=i(3938),r=i(2074),s=i(6844),a="toString",l=RegExp.prototype,c=l[a],u=r(function(){return"/a/b"!=c.call({source:"a",flags:"b"})}),h=c.name!=a;(u||h)&&n(RegExp.prototype,a,function(){var t=o(this),e=String(t.source),i=t.flags;return"/"+e+"/"+String(void 0===i&&t instanceof RegExp&&!("flags"in l)?s.call(t):i)},{unsafe:!0})},6314:function(t){t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var i="",n=void 0!==e[5];return e[4]&&(i+="@supports (".concat(e[4],") {")),e[2]&&(i+="@media ".concat(e[2]," {")),n&&(i+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),i+=t(e),n&&(i+="}"),e[2]&&(i+="}"),e[4]&&(i+="}"),i}).join("")},e.i=function(t,i,n,o,r){"string"==typeof t&&(t=[[null,t,void 0]]);var s={};if(n)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(s[l]=!0)}for(var c=0;c<t.length;c++){var u=[].concat(t[c]);n&&s[u[0]]||(void 0!==r&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=r),i&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=i):u[2]=i),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),e.push(u))}},e}},6347:function(t,e,i){var n=i(1883),o=i(5476),r=i(8186).indexOf,s=i(7708);t.exports=function(t,e){var i,a=o(t),l=0,c=[];for(i in a)!n(s,i)&&n(a,i)&&c.push(i);for(;e.length>l;)n(a,i=e[l++])&&(~r(c,i)||c.push(i));return c}},6492:function(t,e,i){var n=i(9720),o=i(200),r=function(t){return"function"==typeof t?t:void 0};t.exports=function(t,e){return arguments.length<2?r(n[t])||r(o[t]):n[t]&&n[t][e]||o[t]&&o[t][e]}},6509:function(t,e,i){var n=i(5476),o=i(4789).f,r={}.toString,s="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return s&&"[object Window]"==r.call(t)?function(t){try{return o(t)}catch(e){return s.slice()}}(t):o(n(t))}},6539:function(t,e,i){var n=i(7317),o=Math.max,r=Math.min;t.exports=function(t,e){var i=n(t);return i<0?o(i+e,0):r(i,e)}},6611:function(t,e,i){i(1272)("toPrimitive")},6793:function(t,e,i){var n=i(8569),o=i(54);t.exports=function(t,e){var i=t.exec;if("function"==typeof i){var r=i.call(t,e);if("object"!=typeof r)throw TypeError("RegExp exec method returned something other than an Object or null");return r}if("RegExp"!==n(t))throw TypeError("RegExp#exec called on incompatible receiver");return o.call(t,e)}},6843:function(t){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},6844:function(t,e,i){var n=i(3938);t.exports=function(){var t=n(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}},6845:function(t,e,i){var n,o,r=i(200),s=i(7061),a=r.process,l=a&&a.versions,c=l&&l.v8;c?o=(n=c.split("."))[0]+n[1]:s&&(!(n=s.match(/Edge\/(\d+)/))||n[1]>=74)&&(n=s.match(/Chrome\/(\d+)/))&&(o=n[1]),t.exports=o&&+o},6885:function(t,e,i){var n=i(9085);t.exports=function(t,e,i){if(n(t),void 0===e)return t;switch(i){case 0:return function(){return t.call(e)};case 1:return function(i){return t.call(e,i)};case 2:return function(i,n){return t.call(e,i,n)};case 3:return function(i,n,o){return t.call(e,i,n,o)}}return function(){return t.apply(e,arguments)}}},6926:function(t){t.exports=!1},7061:function(t,e,i){var n=i(6492);t.exports=n("navigator","userAgent")||""},7136:function(t,e,i){var n=i(1605),o=i(54);n({target:"RegExp",proto:!0,forced:/./.exec!==o},{exec:o})},7168:function(t,e,i){var n=i(2074);t.exports=!n(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})},7234:function(t,e,i){var n=i(7804).charAt;t.exports=function(t,e,i){return e+(i?n(t,e).length:1)}},7317:function(t){var e=Math.ceil,i=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?i:e)(t)}},7473:function(t,e,i){var n=i(5335);t.exports=function(t){if(!n(t)&&null!==t)throw TypeError("Can't set "+String(t)+" as a prototype");return t}},7485:function(t,e,i){var n=i(200),o=i(7712),r=i(1883),s=i(5975),a=i(9965),l=i(9206),c=l.get,u=l.enforce,h=String(String).split("String");(t.exports=function(t,e,i,a){var l=!!a&&!!a.unsafe,c=!!a&&!!a.enumerable,p=!!a&&!!a.noTargetGet;"function"==typeof i&&("string"!=typeof e||r(i,"name")||o(i,"name",e),u(i).source=h.join("string"==typeof e?e:"")),t!==n?(l?!p&&t[e]&&(c=!0):delete t[e],c?t[e]=i:o(t,e,i)):c?t[e]=i:s(e,i)})(Function.prototype,"toString",function(){return"function"==typeof this&&c(this).source||a(this)})},7632:function(t,e,i){var n=i(5077),o=i(9304),r=i(6843),s=i(5476),a=i(874),l=i(1883),c=i(7694),u=Object.getOwnPropertyDescriptor;e.f=n?u:function(t,e){if(t=s(t),e=a(e,!0),c)try{return u(t,e)}catch(i){}if(l(t,e))return r(!o.f.call(t,e),t[e])}},7659:function(t){var e={};t.exports=function(t,i){var n=function(t){if(void 0===e[t]){var i=document.querySelector(t);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(n){i=null}e[t]=i}return e[t]}(t);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");n.appendChild(i)}},7694:function(t,e,i){var n=i(5077),o=i(2074),r=i(3262);t.exports=!n&&!o(function(){return 7!=Object.defineProperty(r("div"),"a",{get:function(){return 7}}).a})},7708:function(t){t.exports={}},7712:function(t,e,i){var n=i(5077),o=i(3610),r=i(6843);t.exports=n?function(t,e,i){return o.f(t,e,r(1,i))}:function(t,e,i){return t[e]=i,t}},7746:function(t,e,i){var n=i(1605),o=i(8186).includes,r=i(298);n({target:"Array",proto:!0,forced:!i(3638)("indexOf",{ACCESSORS:!0,1:0})},{includes:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}}),r("includes")},7787:function(t,e,i){var n=i(7712),o=i(1137),r=i(1602)("toPrimitive"),s=Date.prototype;r in s||n(s,r,o)},7804:function(t,e,i){var n=i(7317),o=i(1229),r=function(t){return function(e,i){var r,s,a=String(o(e)),l=n(i),c=a.length;return l<0||l>=c?t?"":void 0:(r=a.charCodeAt(l))<55296||r>56319||l+1===c||(s=a.charCodeAt(l+1))<56320||s>57343?t?a.charAt(l):r:t?a.slice(l,l+2):s-56320+(r-55296<<10)+65536}};t.exports={codeAt:r(!1),charAt:r(!0)}},7806:function(t,e,i){var n=i(2612),o=i(6539),r=i(3747);t.exports=function(t){for(var e=n(this),i=r(e.length),s=arguments.length,a=o(s>1?arguments[1]:void 0,i),l=s>2?arguments[2]:void 0,c=void 0===l?i:o(l,i);c>a;)e[a++]=t;return e}},7809:function(t,e,i){var n=i(8569);t.exports=function(t){if("number"!=typeof t&&"Number"!=n(t))throw TypeError("Incorrect invocation");return+t}},7825:function(t){t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(i){!function(t,e,i){var n="";i.supports&&(n+="@supports (".concat(i.supports,") {")),i.media&&(n+="@media ".concat(i.media," {"));var o=void 0!==i.layer;o&&(n+="@layer".concat(i.layer.length>0?" ".concat(i.layer):""," {")),n+=i.css,o&&(n+="}"),i.media&&(n+="}"),i.supports&&(n+="}");var r=i.sourceMap;r&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),e.styleTagTransform(n,t,e.options)}(e,t,i)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},7899:function(t,e,i){var n=i(1605),o=i(2612),r=i(1641);n({target:"Object",stat:!0,forced:i(2074)(function(){r(1)})},{keys:function(t){return r(o(t))}})},7970:function(t,e,i){var n=i(1883),o=i(2612),r=i(5904),s=i(7168),a=r("IE_PROTO"),l=Object.prototype;t.exports=s?Object.getPrototypeOf:function(t){return t=o(t),n(t,a)?t[a]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?l:null}},8186:function(t,e,i){var n=i(5476),o=i(3747),r=i(6539),s=function(t){return function(e,i,s){var a,l=n(e),c=o(l.length),u=r(s,c);if(t&&i!=i){for(;c>u;)if((a=l[u++])!=a)return!0}else for(;c>u;u++)if((t||u in l)&&l[u]===i)return t||u||0;return!t&&-1}};t.exports={includes:s(!0),indexOf:s(!1)}},8379:function(t,e,i){var n=i(200),o=i(5549),r=i(516),s=i(7712);for(var a in o){var l=n[a],c=l&&l.prototype;if(c&&c.forEach!==r)try{s(c,"forEach",r)}catch(u){c.forEach=r}}},8476:function(t,e,i){var n=i(1605),o=i(516);n({target:"Array",proto:!0,forced:[].forEach!=o},{forEach:o})},8569:function(t){var e={}.toString;t.exports=function(t){return e.call(t).slice(8,-1)}},8636:function(t,e,i){var n=i(1605),o=i(1344).find,r=i(298),s=i(3638),a="find",l=!0,c=s(a);a in[]&&Array(1)[a](function(){l=!1}),n({target:"Array",proto:!0,forced:l||!c},{find:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}}),r(a)},8649:function(t,e,i){var n=i(779),o=i(2449),r=i(3938),s=i(1229),a=i(3444),l=i(7234),c=i(3747),u=i(6793),h=i(54),p=i(2074),d=[].push,f=Math.min,v=4294967295,g=!p(function(){return!RegExp(v,"y")});n("split",2,function(t,e,i){var n;return n="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(t,i){var n=String(s(this)),r=void 0===i?v:i>>>0;if(0===r)return[];if(void 0===t)return[n];if(!o(t))return e.call(n,t,r);for(var a,l,c,u=[],p=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.unicode?"u":"")+(t.sticky?"y":""),f=0,g=new RegExp(t.source,p+"g");(a=h.call(g,n))&&!((l=g.lastIndex)>f&&(u.push(n.slice(f,a.index)),a.length>1&&a.index<n.length&&d.apply(u,a.slice(1)),c=a[0].length,f=l,u.length>=r));)g.lastIndex===a.index&&g.lastIndex++;return f===n.length?!c&&g.test("")||u.push(""):u.push(n.slice(f)),u.length>r?u.slice(0,r):u}:"0".split(void 0,0).length?function(t,i){return void 0===t&&0===i?[]:e.call(this,t,i)}:e,[function(e,i){var o=s(this),r=null==e?void 0:e[t];return void 0!==r?r.call(e,o,i):n.call(String(o),e,i)},function(t,o){var s=i(n,t,this,o,n!==e);if(s.done)return s.value;var h=r(t),p=String(this),d=a(h,RegExp),m=h.unicode,y=(h.ignoreCase?"i":"")+(h.multiline?"m":"")+(h.unicode?"u":"")+(g?"y":"g"),w=new d(g?h:"^(?:"+h.source+")",y),x=void 0===o?v:o>>>0;if(0===x)return[];if(0===p.length)return null===u(w,p)?[p]:[];for(var b=0,T=0,P=[];T<p.length;){w.lastIndex=g?T:0;var S,E=u(w,g?p:p.slice(T));if(null===E||(S=f(c(w.lastIndex+(g?0:T)),p.length))===b)T=l(p,T,m);else{if(P.push(p.slice(b,T)),P.length===x)return P;for(var C=1;C<=E.length-1;C++)if(P.push(E[C]),P.length===x)return P;T=b=S}}return P.push(p.slice(b)),P}]},!g)},8664:function(t,e,i){var n=i(2074),o=i(8569),r="".split;t.exports=n(function(){return!Object("z").propertyIsEnumerable(0)})?function(t){return"String"==o(t)?r.call(t,""):Object(t)}:Object},8679:function(t,e,i){var n=i(8569);t.exports=Array.isArray||function(t){return"Array"==n(t)}},8763:function(t,e,i){var n=i(1605),o=i(6539),r=i(7317),s=i(3747),a=i(2612),l=i(2998),c=i(2057),u=i(5634),h=i(3638),p=u("splice"),d=h("splice",{ACCESSORS:!0,0:0,1:2}),f=Math.max,v=Math.min;n({target:"Array",proto:!0,forced:!p||!d},{splice:function(t,e){var i,n,u,h,p,d,g=a(this),m=s(g.length),y=o(t,m),w=arguments.length;if(0===w?i=n=0:1===w?(i=0,n=m-y):(i=w-2,n=v(f(r(e),0),m-y)),m+i-n>9007199254740991)throw TypeError("Maximum allowed length exceeded");for(u=l(g,n),h=0;h<n;h++)(p=y+h)in g&&c(u,h,g[p]);if(u.length=n,i<n){for(h=y;h<m-n;h++)d=h+i,(p=h+n)in g?g[d]=g[p]:delete g[d];for(h=m;h>m-n+i;h--)delete g[h-1]}else if(i>n)for(h=m-n;h>y;h--)d=h+i-1,(p=h+n-1)in g?g[d]=g[p]:delete g[d];for(h=0;h<i;h++)g[h+y]=arguments[h+2];return g.length=m-n+i,u}})},8890:function(t,e,i){var n=i(6492);t.exports=n("document","documentElement")},8916:function(t,e){e.f=Object.getOwnPropertySymbols},9085:function(t){t.exports=function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function");return t}},9163:function(t,e,i){var n=i(1229),o="["+i(5073)+"]",r=RegExp("^"+o+o+"*"),s=RegExp(o+o+"*$"),a=function(t){return function(e){var i=String(n(e));return 1&t&&(i=i.replace(r,"")),2&t&&(i=i.replace(s,"")),i}};t.exports={start:a(1),end:a(2),trim:a(3)}},9206:function(t,e,i){var n,o,r,s=i(2886),a=i(200),l=i(5335),c=i(7712),u=i(1883),h=i(5904),p=i(7708),d=a.WeakMap;if(s){var f=new d,v=f.get,g=f.has,m=f.set;n=function(t,e){return m.call(f,t,e),e},o=function(t){return v.call(f,t)||{}},r=function(t){return g.call(f,t)}}else{var y=h("state");p[y]=!0,n=function(t,e){return c(t,y,e),e},o=function(t){return u(t,y)?t[y]:{}},r=function(t){return u(t,y)}}t.exports={set:n,get:o,has:r,enforce:function(t){return r(t)?o(t):n(t,{})},getterFor:function(t){return function(e){var i;if(!l(e)||(i=o(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return i}}}},9304:function(t,e){var i={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,o=n&&!i.call({1:2},1);e.f=o?function(t){var e=n(this,t);return!!e&&e.enumerable}:i},9310:function(t,e,i){var n=i(200),o=i(5975),r="__core-js_shared__",s=n[r]||o(r,{});t.exports=s},9581:function(t,e,i){var n=i(1605),o=i(1344).map,r=i(5634),s=i(3638),a=r("map"),l=s("map");n({target:"Array",proto:!0,forced:!a||!l},{map:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}})},9686:function(t,e,i){var n=i(3938),o=i(7473);t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,i={};try{(t=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(i,[]),e=i instanceof Array}catch(r){}return function(i,r){return n(i),o(r),e?t.call(i,r):i.__proto__=r,i}}():void 0)},9720:function(t,e,i){var n=i(200);t.exports=n},9965:function(t,e,i){var n=i(9310),o=Function.toString;"function"!=typeof n.inspectSource&&(n.inspectSource=function(t){return o.call(t)}),t.exports=n.inspectSource}},e={};function i(n){var o=e[n];if(void 0!==o)return o.exports;var r=e[n]={id:n,exports:{}};return t[n].call(r.exports,r,r.exports,i),r.exports}i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,{a:e}),e},i.d=function(t,e){for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.nc=void 0;var n={};!function(){i.r(n),i.d(n,{Area:function(){return Qn},Board:function(){return ho},Cache:function(){return W},Graduation:function(){return xo},Grid:function(){return Oo},KfbView:function(){return rr},Navigator:function(){return hn},OpenSeadragon:function(){return X()},Rotation:function(){return Wi},Shape:function(){return Wn},Tailoring:function(){return Pn},baseNumber:function(){return x},cacheGammaTable:function(){return D},calculatePolygonArea:function(){return E},getAngle:function(){return P},getDistance:function(){return S},getPoint:function(){return b},getRandomId:function(){return C},getRectPoint:function(){return l},getRectPointV2:function(){return c},getRectPoints:function(){return T},getUnitNumber:function(){return _},hslToRgb:function(){return R},isNegNumber:function(){return w},isPointInEllipse:function(){return d},isPointInLine:function(){return g},isPointInMatrix:function(){return p},isPointInPolygon:function(){return v},pointInOtherPoint:function(){return f},pointsToRegion:function(){return m},regionToPoint:function(){return y},rgbToHsl:function(){return O},toGamma:function(){return k}});var t={};i.r(t),i.d(t,{EVENT_ADD_POLYGON_POINT:function(){return fi},EVENT_AREA_MOVE_END:function(){return ri},EVENT_AREA_MOVE_START:function(){return ni},EVENT_AREA_MOVING:function(){return oi},EVENT_CACHE_BACK:function(){return ci},EVENT_CACHE_FORWARD:function(){return ui},EVENT_CANCEL_SELECT_LABEL:function(){return ai},EVENT_DB_CLICK_LABEL:function(){return li},EVENT_DELETE_LABEL:function(){return pi},EVENT_DELETE_POLYGON_POINT:function(){return di},EVENT_END_PAINTING:function(){return Qe},EVENT_GRADUATION_CHANGE:function(){return gi},EVENT_HIDDEN_LABEL:function(){return hi},EVENT_IN_PAINTING:function(){return Je},EVENT_NAVIGATOR_VESTIGE:function(){return vi},EVENT_SELECT_LABEL:function(){return si},EVENT_START_PAINTING:function(){return Ye},EVENT_STOP_PAINTING:function(){return ti},EVENT_TAILORING_REGION:function(){return ei},EVENT_TAILORING_SCREENSHOT:function(){return ii}});var e={};i.r(e),i.d(e,{Arrow:function(){return Dt},Bilateral:function(){return Ht},Brush:function(){return St},Dot:function(){return Ke},Ellipse:function(){return ue},Flag:function(){return We},Font:function(){return Ce},Image:function(){return ji},Line:function(){return $t},Polygon:function(){return ie},Rectangle:function(){return ye},Star:function(){return je}});var o={};i.r(o),i.d(o,{Area:function(){return Qn},Board:function(){return ho},Cache:function(){return W},Graduation:function(){return xo},Grid:function(){return Oo},Navigator:function(){return hn},Rotation:function(){return Wi},Shape:function(){return Wn},Tailoring:function(){return Pn}});var r={};i.r(r),i.d(r,{COMPONENT_AREA:function(){return No},COMPONENT_BOARD:function(){return zo},COMPONENT_CACHE:function(){return Uo},COMPONENT_FRID:function(){return Go},COMPONENT_GRADUATION:function(){return Ho},COMPONENT_NAVIGATOR:function(){return Vo},COMPONENT_ROTATION:function(){return Fo},COMPONENT_SHAPE:function(){return Bo},COMPONENT_TAILORING:function(){return Wo}});i(557),i(5231),i(4867),i(3023),i(5086),i(6048);function s(t){return function(t){if(Array.isArray(t))return a(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return a(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?a(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function l(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=(t.x+e.x)/2,o=(t.y+e.y)/2,r=Math.PI/180*i;return[{x:(t.x-n)*Math.cos(r)-(t.y-o)*Math.sin(r)+n,y:(t.x-n)*Math.sin(r)+(t.y-o)*Math.cos(r)+o},{x:-(t.y-o)*Math.sin(r)+n,y:(t.y-o)*Math.cos(r)+o},{x:(e.x-n)*Math.cos(r)-(t.y-o)*Math.sin(r)+n,y:(e.x-n)*Math.sin(r)+(t.y-o)*Math.cos(r)+o},{x:(t.x-n)*Math.cos(r)-(o-o)*Math.sin(r)+n,y:(t.x-n)*Math.sin(r)+o},{x:n,y:o},{x:(e.x-n)*Math.cos(r)+n,y:(e.x-n)*Math.sin(r)+o},{x:(t.x-n)*Math.cos(r)-(e.y-o)*Math.sin(r)+n,y:(t.x-n)*Math.sin(r)+(e.y-o)*Math.cos(r)+o},{x:-(e.y-o)*Math.sin(r)+n,y:(e.y-o)*Math.cos(r)+o},{x:(e.x-n)*Math.cos(r)-(e.y-o)*Math.sin(r)+n,y:(e.x-n)*Math.sin(r)+(e.y-o)*Math.cos(r)+o}]}function c(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(2===t.length)return l(t[0],t[1],e);var i=(t[0].x+t[3].x)/2,n=(t[0].y+t[3].y)/2;return[t[0],{x:(t[1].x+t[0].x)/2,y:(t[1].y+t[0].y)/2},t[1],{x:(t[2].x+t[0].x)/2,y:(t[2].y+t[0].y)/2},{x:i,y:n},{x:(t[1].x+t[3].x)/2,y:(t[1].y+t[3].y)/2},t[2],{x:(t[2].x+t[3].x)/2,y:(t[2].y+t[3].y)/2},t[3]]}function u(t,e){return t.x*e.y-e.x*t.y}function h(t,e,i){return(e.x-t.x)*(i.y-t.y)-(i.x-t.x)*(e.y-t.y)}function p(t,e,i,n,o){return h(t,e,o)*h(i,n,o)<=0&&h(e,n,o)*h(t,i,o)<=0}function d(t,e,i,n){return(t.x-e.x)*(t.x-e.x)/(i*i)+(t.y-e.y)*(t.y-e.y)/(n*n)<1}function f(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;return p({x:t.x-i,y:t.y-i},{x:t.x+i,y:t.y-i},{x:t.x-i,y:t.y+i},{x:t.x+i,y:t.y+i},e)}function v(t,e){for(var i=t.x,n=t.y,o=0,r=0,s=e.length,a=s-1;r<s;a=r,r++){var l=e[a].x,c=e[a].y,h=e[r].x,p=e[r].y,d=Math.min(c,p),f=Math.max(c,p),v=Math.min(l,h),g=Math.max(l,h);if(n>f);else if(n<d);else if(i>g);else if(i<v)d===n&&n<f?o++:d<n&&n===f||d===n&&n===f||o++;else{var m={x:h-l,y:p-c},y={x:h-l-1e5,y:p-c};u({x:l-i,y:c-n},m)*u(y,m)>0||(d===n&&n<f?o++:d<n&&n===f||d===n&&n===f||o++)}}return o%2==1}function g(t,e){var i=e[0],n=e[1];if(i.y<t.y&&n.y>=t.y||i.y>=t.y&&n.y<t.y){var o=i.x+(t.y-i.y)*(n.x-i.x)/(n.y-i.y);if(Math.abs(o-t.x)<8)return!0}return!1}function m(t){if(!Array.isArray(t)||0===t.length)return{x:0,y:0,width:0,height:0};if(2===t.length)return{x:t[0].x,y:t[0].y,width:t[1].x-t[0].x,height:t[1].y-t[0].y};if(4===t.length)return{x:t[0].x,y:t[0].y,width:S(t[1],t[0])*(t[0].x<t[1].x?1:-1),height:S(t[2],t[0])*(t[0].y<t[2].y?1:-1)};var e=s(t).sort(function(t,e){return t.x-e.x}),i=s(t).sort(function(t,e){return t.y-e.y}),n={x:e[0].x,y:i[0].y},o=e.reverse()[0].x,r=i.reverse()[0].y;return{x:n.x,y:n.y,width:o-n.x,height:r-n.y}}function y(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?{startPoint:{x:t.width<0?t.x+t.width:t.x,y:t.height<0?t.y+t.height:t.y},endPoint:{x:t.width>0?t.x+t.width:t.x,y:t.height>0?t.y+t.height:t.y}}:{startPoint:{x:t.x,y:t.y},endPoint:{x:t.x+t.width,y:t.y+t.height}}}function w(t){if("number"!=typeof t)throw new Error("".concat(t," is not a number"));return 0===t?Object.is(t,-0):t<0}function x(t){if("number"!=typeof t)throw new Error("".concat(t," is not a number"));return 0===t?0:t<0?-1:1}function b(t,e,i){return i=i/180*Math.PI,{x:(e.x-t.x)*Math.cos(i)-(e.y-t.y)*Math.sin(i)+t.x,y:(e.x-t.x)*Math.sin(i)+(e.y-t.y)*Math.cos(i)+t.y}}function T(t){return[t[0],{x:t[1].x,y:t[0].y},{x:t[0].x,y:t[1].y},t[1]]}function P(t,e,i){var n={x:e.x-t.x,y:e.y-t.y},o={x:i.x-t.x,y:i.y-t.y},r=Math.atan2(o.y,o.x)-Math.atan2(n.y,n.x);return r>Math.PI?r-2*Math.PI:r<-Math.PI?r+2*Math.PI:r}function S(t,e){var i=Math.pow(e.x-t.x,2),n=Math.pow(e.y-t.y,2);return Math.sqrt(i+n)}function E(t,e){var i=t.length;if(i<3)return 0;for(var n=0,o=0;o<i;o++){var r=t[o],s=t[(o+1)%i],a=r.x*e,l=r.y*e,c=s.x*e;n+=a*(s.y*e)-c*l}return Math.abs(n/2)}var C=function(){return(4294967296*(1+Math.random())|0).toString(16).substring(1)};function _(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(n)return(t/Math.pow(i,n)).toFixed(2)/1+e[n];for(var o=t;o>=i;)o/=i,n++;return e[n]||(n=e.length-1),(t/Math.pow(i,n)).toFixed(2)/1+e[n]}var O=function(t,e,i){var n=(t/=255)>(e/=255)?t:e,o=n>(i/=255)?n:i,r=t>e?e:t,s=r>i?i:r,a=o-s,l=o+s,c=(o+s)/2,u=0,h=0;return 0===a?{l:c,s:u,h:h}:(t===o&&(h=(e-i)/6/a),e===o&&(h=1/3+(i-t)/6/a),i===o&&(h=2/3+(t-e)/6/a),h<0&&(h+=1),h>1&&(h-=1),{l:c,s:u=c<.5?a/l:a/(2-l),h:h})},R=function(t,e,i){if(0===e)return{r:255*(i>1?1:i),g:255*(i>1?1:i),b:255*(i>1?1:i)};e>1&&(e=1);var n=0,o=2*i-(n=i<.5?i*(1+e):i+e-i*e),r=255*I(o,n,t+1/3),s=255*I(o,n,t),a=255*I(o,n,t-1/3);return{r:r>255?255:r,g:s>255?255:s,b:a>255?255:a}};function I(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),6*i<1?t+6*(e-t)*i:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}for(var k=function(t,e){return t>255&&(t=255),t<0&&(t=0),t/=255,255*Math.pow(t,1/e)},D={},M=0;M<256;M++)for(var j=.01;j<=2;j=(j+.01).toFixed(3)/1)D["".concat(j)]?D["".concat(j)].push(k(M,j)):D["".concat(j)]=[k(M,j)];i(3534),i(590),i(6611),i(4913),i(8763),i(7787),i(4009),i(475),i(9581);var L=function(t){return(t=t.toString())[1]?t:"0"+t},A=function(t){if(t)return function(t){var e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/",n=Object.prototype.toString;if(t)return"[object String]"===(e=t,n).call(e)&&(t=new Date(t)),"number"==typeof t&&(t=new Date(t)),[t.getFullYear(),t.getMonth()+1,t.getDate()].map(L).join(i)}(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-")+" "+function(t){var e,i=Object.prototype.toString;if(t)return"[object String]"===(e=t,i).call(e)&&(t=new Date(t)),[t.getHours(),t.getMinutes(),t.getSeconds()].map(L).join(":")}(t)};function B(t){return B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},B(t)}function N(t){return function(t){if(Array.isArray(t))return z(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return z(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?z(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function z(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function H(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,F(n.key),n)}}function F(t){var e=function(t,e){if("object"!=B(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=B(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==B(e)?e:e+""}var W=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.cacheList=[],this.currentIndex=-1}var e,i,n;return e=t,i=[{key:"init",value:function(t,e){this.cacheList=N(t),this.currentIndex=e}},{key:"add",value:function(t,e){this.currentIndex===this.cacheList.length-1||(this.cacheList=this.cacheList.slice(0,this.currentIndex+1)),this.cacheList.push({type:t,options:e,time:A(new Date)}),this.currentIndex=this.cacheList.length-1}},{key:"getCache",value:function(t){return this.cacheList[t]}},{key:"removeIndex",value:function(t){this.cacheList.splice(t,1)}},{key:"removeAll",value:function(){this.cacheList=[],this.currentIndex=-1}}],i&&H(e.prototype,i),n&&H(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();i(2982),i(8636),i(8476),i(1412),i(4632),i(8379),i(115),i(533),i(7136),i(8649);function V(t){return V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},V(t)}function U(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,G(n.key),n)}}function G(t){var e=function(t,e){if("object"!=V(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=V(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==V(e)?e:e+""}var Z={lineWidth:2,radius:5,fillStyle:"rgba(255, 255, 255, 1)",strokeStyle:"#01d0b0"},q=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Z;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.getConfig(e)}var e,i,n;return e=t,i=[{key:"getConfig",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Z;for(var e in Z)Object.prototype.hasOwnProperty.call(Z,e)&&(t[e]=t[e]||Z[e]);return t}},{key:"setCanvas",value:function(t){this.canvas=t}},{key:"draw",value:function(t,e){var i=this.canvas.getContext("2d"),n=t.x,o=t.y;e=this.getConfig(e),i.beginPath(),i.lineWidth=e.lineWidth,i.arc(n,o,e.radius,0,2*Math.PI,!1),i.fillStyle=e.fillStyle,i.fill(),i.strokeStyle=e.strokeStyle,i.stroke()}}],i&&U(e.prototype,i),n&&U(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}(),$=i(2861),X=i.n($),K="Line",Y="Arrow",J="Bilateral",Q="Rectangle",tt="Ellipse",et="Polygon",it="Font",nt="Star",ot="Flag",rt="Dot",st="Image",at=[it,nt,ot,rt],lt=[Q,tt],ct=[K,Y,J],ut=[et,it,nt,ot,rt],ht=([].concat(lt,[et]),[].concat(ct,[it,ot,st])),pt=[K,Y,J,Q,tt,et,it,nt,ot,rt,st],dt={en:{length:"Length",width:"Width",perimeter:"Perimeter",area:"Area",long_axis:"Long Axis",short_axis:"Short Axis",complete_screenshot:"Double-click within the area to complete screenshot",cancel_screenshot:"Double-click outside or press ESC to cancel screenshot",area_size:"Area size is ",drag_resize:"drag resize"},"zh-cn":{length:"长",width:"宽",perimeter:"周长",area:"面积",long_axis:"长轴",short_axis:"短轴",complete_screenshot:"双击区域内表示完成截图",cancel_screenshot:"双击区域外或按ESC表示取消截图",area_size:"区域大小为:",drag_resize:"拖动调整"}};function ft(t){return ft="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ft(t)}function vt(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function gt(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?vt(Object(i),!0).forEach(function(e){mt(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):vt(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function mt(t,e,i){return(e=wt(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function yt(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,wt(n.key),n)}}function wt(t){var e=function(t,e){if("object"!=ft(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=ft(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ft(e)?e:e+""}var xt=function(){function t(e,i,n,o){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);var r=o||{},s=r.mitt,a=function(t,e){if(null==t)return{};var i,n,o=function(t,e){if(null==t)return{};var i={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(-1!==e.indexOf(n))continue;i[n]=t[n]}return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(n=0;n<r.length;n++)i=r[n],-1===e.indexOf(i)&&{}.propertyIsEnumerable.call(t,i)&&(o[i]=t[i])}return o}(r,["mitt"]);this.mitt=s,this.viewer=e,this.cache=n,this.viewport=e.viewport,this.canvas=i,this.options=a||{},this.thumb=new q,this.thumb.setCanvas(i)}var e,i,n;return e=t,i=[{key:"init",value:function(){}},{key:"getCenterPoint",value:function(t){var e=this.viewport.imageToViewportRectangle(t.x,t.y,t.width,t.height);return l({x:e.x,y:e.y},{x:e.x+e.width,y:e.y+e.height})[4]}},{key:"moveToLabel",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.viewport.panTo(new $.Point(t.x,t.y),e)}},{key:"isContainerLabel",value:function(t,e){var i=this;return!!e.find(function(e){return i.isContainerInRegion(t,e)})}},{key:"isContainerInRegion",value:function(t,e){var i=e.region,n=e.tool,o=e.points,r=e.isClose;if(n===et&&r)return v(t,o);var s={x:i.x,y:i.y},a={x:i.x+i.width,y:i.y},l={x:i.x,y:i.y+i.height},c={x:i.x+i.width,y:i.y+i.height},u={x:i.x+i.width/2,y:i.y+i.height/2};return n===tt?d(t,u,Math.abs(i.width/2),Math.abs(i.height/2|0)):n===Q&&p(s,a,l,c,t)}},{key:"imageToViewerElementRectangle",value:function(t){var e=t.x,i=t.y,n=t.width,o=t.height,r=this.viewport.imageToViewportRectangle(e,i,n,o);return this.viewport.viewportToViewerElementRectangle(r)}},{key:"imageToViewerElementCoordinates",value:function(t,e){return this.viewport.imageToViewerElementCoordinates(new $.Point(t,e))}},{key:"viewerElementToImageRectangle",value:function(t){var e=t.x,i=t.y,n=t.width,o=t.height,r=this.viewport.viewerElementToViewportRectangle(new $.Rect(e,i,n,o,0));return this.viewport.viewportToImageRectangle(r.x,r.y,r.width,r.height)}},{key:"viewerElementToImageCoordinates",value:function(t,e){return this.viewport.viewerElementToImageCoordinates(new $.Point(t,e))}},{key:"imageToViewerElementPoints",value:function(t){var e=this;return(t||[]).map(function(t){var i=e.imageToViewerElementCoordinates(t.x,t.y);return{canMove:t.canMove,x:i.x,y:i.y}})}},{key:"viewerElementToImagePoints",value:function(t){var e=this;return(t||[]).map(function(t){var i=e.viewerElementToImageCoordinates(t.x,t.y);return{canMove:t.canMove,x:i.x,y:i.y}})}},{key:"getImageZoom",value:function(t){return this.viewport.viewportToImageZoom(this.viewport.getZoom(t))}},{key:"translate",value:function(t){var e;return dt[(null!==(e=this.options.lang)&&void 0!==e?e:"zh-cn").toLocaleLowerCase()][t]}},{key:"getMeasureContent",value:function(t){var e={left:0,top:0,angle:0,texts:[]};if(t.points.length<=1)return e;var i=this.getImageZoom(!0)/t.scale,n=m(t.points),o={x:n.x,y:n.y},r={x:n.x+n.width,y:n.y+n.height},s={x:o.x<r.x?o.x:r.x,y:o.y<r.y?o.y:r.y},a={x:o.x>r.x?o.x:r.x,y:o.y>r.y?o.y:r.y};switch(t.tool){case Y:case J:case K:var c={x:o.x<r.x?o.x:r.x,y:o.x<r.x?o.y:r.y},u={x:o.x>r.x?o.x:r.x,y:o.x>r.x?o.y:r.y},h=Math.abs(u.x-c.x),p=Math.abs(u.y-c.y),d=this.imageToViewerElementCoordinates(u.x,u.y);e={left:d.x+10*i,top:d.y,angle:0,texts:["".concat(this.translate("length"),":").concat(this.getUnitNumber(Math.sqrt(h*h+p*p)*this.options.imageCapRes))]};break;case tt:var f=Math.abs(a.x-s.x)/2,v=Math.abs(a.y-s.y)/2,g=(f>v?f:v)*this.options.imageCapRes,y=(f>v?v:f)*this.options.imageCapRes,w=l(s,a)[2],x=this.imageToViewerElementCoordinates(w.x,w.y);e={left:x.x+10*i,top:x.y,angle:0,texts:["".concat(this.translate("long_axis"),":").concat(this.getUnitNumber(g)),"".concat(this.translate("short_axis"),":").concat(this.getUnitNumber(y)),"".concat(this.translate("perimeter"),":").concat(this.getUnitNumber(4*(g-y)+2*Math.PI*y)),"".concat(this.translate("area"),":").concat(this.getUnitNumber(Math.PI*g*y,2),"²")]};break;case Q:var b=Math.abs(a.x-s.x)*this.options.imageCapRes,T=Math.abs(a.y-s.y)*this.options.imageCapRes,P=2*(b+T),S=b*T,C=l(s,a)[2],_=this.imageToViewerElementCoordinates(C.x,C.y);e={left:_.x+10*i,top:_.y,angle:0,texts:["".concat(this.translate("length"),":").concat(this.getUnitNumber(b)),"".concat(this.translate("width"),":").concat(this.getUnitNumber(T)),"".concat(this.translate("perimeter"),":").concat(this.getUnitNumber(P)),"".concat(this.translate("area"),":").concat(this.getUnitNumber(S,2),"²")]};break;case et:var O=t.points,R=l(s,a)[2],I=this.imageToViewerElementCoordinates(R.x,R.y),k=0;O.reduce(function(t,e){return k+=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),e}),e={left:I.x,top:I.y,angle:0,texts:["".concat(this.translate("perimeter"),":").concat(this.getUnitNumber((k*this.options.imageCapRes).toFixed(2))),"".concat(this.translate("area"),":").concat(this.getUnitNumber(E(O,this.options.imageCapRes),2),"²")]};break;default:e={left:0,right:0,angle:0,texts:[]}}var D=t.select&&this.options.measure.selectHandler||this.options.measure.handler;return gt(gt({},e),{},{texts:D?D(e.texts,t):e.texts})}},{key:"getUnitNumber",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=Math.pow(this.options.binary,e);return _(t,this.options.units,i)}},{key:"isInCanvas",value:function(t,e){var i=t.x,n=t.y,o=t.x+t.width,r=t.y+t.height;return!(i>e.x+e.width||n>e.y+e.height||o<e.x||r<e.y)}},{key:"getFontWidth",value:function(t,e){var i=this.canvas.getContext("2d");i.beginPath(),i.font="".concat(e,"px Arial");var n=t.split("\n").sort(function(t,e){return t.length>e.length?-1:1})[0];return i.measureText(n).width}},{key:"change",value:function(){}},{key:"updated",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.options=gt(gt({},this.options),t),this.change()}},{key:"clearCanvas",value:function(){var t=this.canvas.getContext("2d");t.beginPath(),t.clearRect(0,0,this.canvas.width,this.canvas.height)}},{key:"resetCanvasSize",value:function(t){var e=this,i=t.width,n=t.height;this.canvas.width=i,this.canvas.height=n,setTimeout(function(){e.change()},100)}},{key:"destroy",value:function(){this.mitt.$off()}}],i&&yt(e.prototype,i),n&&yt(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function bt(t){return bt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},bt(t)}function Tt(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Pt(n.key),n)}}function Pt(t){var e=function(t,e){if("object"!=bt(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=bt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==bt(e)?e:e+""}var St=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.thumb=new q,this.options={}}var e,i,n;return e=t,i=[{key:"setContent",value:function(t,e){this.canvas=t,this.thumb.setCanvas(t),this.options=e}},{key:"startDraw",value:function(){this.canvas.getContext("2d").beginPath()}},{key:"endDraw",value:function(){var t=this.canvas.getContext("2d");t.stroke(),this.options.fillStyle&&t.fill()}},{key:"drawThumb",value:function(t,e){this.thumb.draw(t,e)}},{key:"drawPoints",value:function(t,e){var i=this;t.forEach(function(t){i.drawThumb(t,e)})}},{key:"draw",value:function(t){}},{key:"drawMeasureInfo",value:function(t,e){var i=e.left,n=e.top,o=e.texts,r=e.angle;if(o.length){var s=this.canvas.getContext("2d");s.save(),s.beginPath(),s.translate(i,n),s.rotate(r);var a=[];s.font="".concat(this.options.measure.fontSize,"px Arial"),o.forEach(function(t){a.push(s.measureText(t).width)});var l=Math.max.apply(Math,a);s.fillStyle=this.options.measure.backgroundColor;var c=20*o.length+16+4*(o.length-1);s.rect(0,0,l+22,c),s.fill(),s.beginPath(),s.fillStyle=this.options.measure.color,o.forEach(function(t,e){s.fillText(t,11,22+24*e)}),s.fill(),s.restore()}}},{key:"clearCanvas",value:function(){this.canvas&&this.canvas.getContext&&this.canvas.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height)}}],i&&Tt(e.prototype,i),n&&Tt(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Et(t){return Et="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Et(t)}function Ct(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,_t(n.key),n)}}function _t(t){var e=function(t,e){if("object"!=Et(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Et(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Et(e)?e:e+""}function Ot(t,e){return Ot=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ot(t,e)}function Rt(t){var e=It();return function(){var i,n=kt(t);if(e){var o=kt(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return function(t,e){if(e&&("object"==Et(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,i)}}function It(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(It=function(){return!!t})()}function kt(t){return kt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},kt(t)}var Dt=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ot(t,e)}(r,t);var e,i,n,o=Rt(r);function r(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),o.call(this)}return e=r,(i=[{key:"draw",value:function(t){var e=t[0],i=t[t.length-1],n=this.canvas.getContext("2d");n.lineWidth=this.options.lineWidth,n.strokeStyle=this.options.strokeStyle,n.moveTo(e.x,e.y),n.lineTo(i.x,i.y),n.drawArrow(e,i)}}])&&Ct(e.prototype,i),n&&Ct(e,n),Object.defineProperty(e,"prototype",{writable:!1}),r}(St);function Mt(t){return Mt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mt(t)}function jt(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Lt(n.key),n)}}function Lt(t){var e=function(t,e){if("object"!=Mt(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Mt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Mt(e)?e:e+""}function At(t,e){return At=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},At(t,e)}function Bt(t){var e=Nt();return function(){var i,n=zt(t);if(e){var o=zt(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return function(t,e){if(e&&("object"==Mt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,i)}}function Nt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Nt=function(){return!!t})()}function zt(t){return zt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},zt(t)}var Ht=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&At(t,e)}(r,t);var e,i,n,o=Bt(r);function r(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),o.call(this)}return e=r,(i=[{key:"draw",value:function(t){var e=t[0],i=t[t.length-1],n=this.canvas.getContext("2d");n.lineWidth=this.options.lineWidth,n.strokeStyle=this.options.strokeStyle,n.moveTo(e.x,e.y),n.lineTo(i.x,i.y),n.drawArrow(e,i),n.drawArrow(i,e)}}])&&jt(e.prototype,i),n&&jt(e,n),Object.defineProperty(e,"prototype",{writable:!1}),r}(St);function Ft(t){return Ft="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ft(t)}function Wt(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Vt(n.key),n)}}function Vt(t){var e=function(t,e){if("object"!=Ft(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Ft(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ft(e)?e:e+""}function Ut(t,e){return Ut=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ut(t,e)}function Gt(t){var e=Zt();return function(){var i,n=qt(t);if(e){var o=qt(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return function(t,e){if(e&&("object"==Ft(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,i)}}function Zt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Zt=function(){return!!t})()}function qt(t){return qt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},qt(t)}var $t=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ut(t,e)}(r,t);var e,i,n,o=Gt(r);function r(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),o.call(this)}return e=r,(i=[{key:"draw",value:function(t){var e=t[0],i=t[t.length-1],n=this.canvas.getContext("2d");n.lineWidth=this.options.lineWidth,n.strokeStyle=this.options.strokeStyle,n.moveTo(e.x,e.y),n.lineTo(i.x,i.y);var o=Math.atan2(i.y-e.y,i.x-e.x),r=5*Math.sin(o),s=5*Math.cos(o);n.moveTo(e.x+r,e.y-s),n.lineTo(e.x-r,e.y+s),n.moveTo(i.x+r,i.y-s),n.lineTo(i.x-r,i.y+s)}}])&&Wt(e.prototype,i),n&&Wt(e,n),Object.defineProperty(e,"prototype",{writable:!1}),r}(St);function Xt(t){return Xt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xt(t)}function Kt(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Yt(n.key),n)}}function Yt(t){var e=function(t,e){if("object"!=Xt(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Xt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Xt(e)?e:e+""}function Jt(t,e){return Jt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Jt(t,e)}function Qt(t){var e=te();return function(){var i,n=ee(t);if(e){var o=ee(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return function(t,e){if(e&&("object"==Xt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,i)}}function te(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(te=function(){return!!t})()}function ee(t){return ee=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ee(t)}var ie=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Jt(t,e)}(r,t);var e,i,n,o=Qt(r);function r(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),o.apply(this,arguments)}return e=r,(i=[{key:"draw",value:function(t){var e=this.canvas.getContext("2d");e.lineWidth=this.options.lineWidth,e.strokeStyle=this.options.strokeStyle,e.moveTo(t[0].x,t[0].y),t.forEach(function(t,i){0!==i&&e.lineTo(t.x,t.y)}),this.options.isClose&&(e.lineTo(t[0].x,t[0].y),this.options.fillStyle&&(e.fillStyle=this.options.fillStyle))}}])&&Kt(e.prototype,i),n&&Kt(e,n),Object.defineProperty(e,"prototype",{writable:!1}),r}(St);function ne(t){return ne="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ne(t)}function oe(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,re(n.key),n)}}function re(t){var e=function(t,e){if("object"!=ne(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=ne(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ne(e)?e:e+""}function se(t,e){return se=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},se(t,e)}function ae(t){var e=le();return function(){var i,n=ce(t);if(e){var o=ce(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return function(t,e){if(e&&("object"==ne(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,i)}}function le(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(le=function(){return!!t})()}function ce(t){return ce=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ce(t)}var ue=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&se(t,e)}(r,t);var e,i,n,o=ae(r);function r(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),o.call(this)}return e=r,i=[{key:"draw",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=t[0],n=t[t.length-1],o=this.canvas.getContext("2d");o.lineWidth=this.options.lineWidth,o.strokeStyle=this.options.strokeStyle,this.options.fillStyle&&(o.fillStyle=this.options.fillStyle),2===t.length&&(t=T(t)),o.save();var r={x:(i.x+n.x)/2,y:(i.y+n.y)/2},s=S(t[1],t[0]),a=S(t[2],t[0]);o.translate(r.x,r.y),e<0&&(e+=360);var l=e%360;o.rotate(l*Math.PI/180),o.drawOval(0,0,s/2,a/2),o.restore()}}],i&&oe(e.prototype,i),n&&oe(e,n),Object.defineProperty(e,"prototype",{writable:!1}),r}(St);function he(t){return he="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},he(t)}function pe(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,de(n.key),n)}}function de(t){var e=function(t,e){if("object"!=he(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=he(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==he(e)?e:e+""}function fe(t,e){return fe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},fe(t,e)}function ve(t){var e=ge();return function(){var i,n=me(t);if(e){var o=me(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return function(t,e){if(e&&("object"==he(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,i)}}function ge(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ge=function(){return!!t})()}function me(t){return me=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},me(t)}var ye=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&fe(t,e)}(r,t);var e,i,n,o=ve(r);function r(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),o.call(this)}return e=r,(i=[{key:"draw",value:function(t){2===t.length&&(t=T(t));var e=this.canvas.getContext("2d");e.lineWidth=this.options.lineWidth,e.strokeStyle=this.options.strokeStyle,this.options.fillStyle&&(e.fillStyle=this.options.fillStyle),e.save(),e.moveTo(t[0].x,t[0].y),e.lineTo(t[1].x,t[1].y),e.lineTo(t[3].x,t[3].y),e.lineTo(t[2].x,t[2].y),e.lineTo(t[0].x,t[0].y),e.restore()}}])&&pe(e.prototype,i),n&&pe(e,n),Object.defineProperty(e,"prototype",{writable:!1}),r}(St);function we(t){return we="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},we(t)}function xe(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,be(n.key),n)}}function be(t){var e=function(t,e){if("object"!=we(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=we(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==we(e)?e:e+""}function Te(t,e){return Te=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Te(t,e)}function Pe(t){var e=Se();return function(){var i,n=Ee(t);if(e){var o=Ee(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return function(t,e){if(e&&("object"==we(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,i)}}function Se(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Se=function(){return!!t})()}function Ee(t){return Ee=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ee(t)}var Ce=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Te(t,e)}(r,t);var e,i,n,o=Pe(r);function r(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),o.call(this)}return e=r,i=[{key:"draw",value:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=t[0],r=this.options.text||"编辑文字",s=this.canvas.getContext("2d");s.fillStyle=this.options.strokeStyle,s.save();var a=n%360;s.translate(o.x,o.y),s.rotate(a*Math.PI/180),s.scale(i,i),s.font="".concat(this.options.fontSize,"px Arial"),r.split("\n").forEach(function(t,i){s.fillText(t,0,0+i*e.options.fontSize)}),s.restore()}}],i&&xe(e.prototype,i),n&&xe(e,n),Object.defineProperty(e,"prototype",{writable:!1}),r}(St);function _e(t){return _e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_e(t)}function Oe(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Re(n.key),n)}}function Re(t){var e=function(t,e){if("object"!=_e(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=_e(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==_e(e)?e:e+""}function Ie(t,e){return Ie=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ie(t,e)}function ke(t){var e=De();return function(){var i,n=Me(t);if(e){var o=Me(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return function(t,e){if(e&&("object"==_e(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,i)}}function De(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(De=function(){return!!t})()}function Me(t){return Me=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Me(t)}var je=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ie(t,e)}(r,t);var e,i,n,o=ke(r);function r(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),o.call(this)}return e=r,i=[{key:"draw",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=this.options.lineWidth,n=t[0];i*=e;var o=.2*Math.PI,r=.3*Math.PI,s=Math.sin(o)*i*2,a=i/2/Math.cos(o),l={x:n.x,y:n.y-i},c={x:n.x+a*Math.sin(o),y:n.y-i+a*Math.cos(o)},u={x:n.x+s*Math.sin(r),y:n.y-i+s*Math.cos(r)},h={x:n.x+a*Math.sin(2*o),y:n.y+a*Math.cos(2*o)},p={x:n.x+i*Math.sin(o),y:n.y+i*Math.cos(o)},d={x:n.x,y:n.y+a},f={x:n.x-i*Math.sin(o),y:n.y+i*Math.cos(o)},v={x:n.x-a*Math.sin(2*o),y:n.y+a*Math.cos(2*o)},g={x:n.x-s*Math.sin(r),y:n.y-i+s*Math.cos(r)},m={x:n.x-a*Math.sin(o),y:n.y-i+a*Math.cos(o)},y=this.canvas.getContext("2d");y.lineWidth=2,y.moveTo(l.x,l.y),y.lineTo(c.x,c.y),y.lineTo(u.x,u.y),y.lineTo(h.x,h.y),y.lineTo(p.x,p.y),y.lineTo(d.x,d.y),y.lineTo(f.x,f.y),y.lineTo(v.x,v.y),y.lineTo(g.x,g.y),y.lineTo(m.x,m.y),y.lineTo(l.x,l.y),y.strokeStyle=this.options.strokeStyle,this.options.fillStyle&&(y.fillStyle=this.options.fillStyle)}}],i&&Oe(e.prototype,i),n&&Oe(e,n),Object.defineProperty(e,"prototype",{writable:!1}),r}(St);function Le(t){return Le="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Le(t)}function Ae(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Be(n.key),n)}}function Be(t){var e=function(t,e){if("object"!=Le(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Le(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Le(e)?e:e+""}function Ne(t,e){return Ne=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ne(t,e)}function ze(t){var e=He();return function(){var i,n=Fe(t);if(e){var o=Fe(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return function(t,e){if(e&&("object"==Le(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,i)}}function He(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(He=function(){return!!t})()}function Fe(t){return Fe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Fe(t)}var We=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ne(t,e)}(r,t);var e,i,n,o=ze(r);function r(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),o.apply(this,arguments)}return e=r,i=[{key:"draw",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=this.options.lineWidth;i*=e;var n=t[0],o=this.canvas.getContext("2d");o.lineWidth=2,o.strokeStyle=this.options.strokeStyle,o.moveTo(n.x,n.y),o.lineTo(n.x,n.y-i);var r=i/5,s={x:n.x+r,y:n.y-i},a={x:n.x+2*r,y:n.y-i-r},l={x:n.x+4*r,y:n.y-i+r},c={x:n.x+i,y:n.y-i};o.bezierCurve([s,a,l,c]),o.moveTo(c.x,c.y),o.lineTo(c.x,c.y+i/2);var u={x:n.x+r,y:n.y-i/2},h={x:n.x+2*r,y:n.y-i/2-r},p={x:n.x+4*r,y:n.y-i/2+r},d={x:n.x+i,y:n.y-i/2};o.bezierCurve([u,h,p,d]),o.moveTo(s.x,s.y),o.lineTo(u.x,u.y)}}],i&&Ae(e.prototype,i),n&&Ae(e,n),Object.defineProperty(e,"prototype",{writable:!1}),r}(St);function Ve(t){return Ve="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ve(t)}function Ue(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ge(n.key),n)}}function Ge(t){var e=function(t,e){if("object"!=Ve(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Ve(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ve(e)?e:e+""}function Ze(t,e){return Ze=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ze(t,e)}function qe(t){var e=$e();return function(){var i,n=Xe(t);if(e){var o=Xe(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return function(t,e){if(e&&("object"==Ve(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,i)}}function $e(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return($e=function(){return!!t})()}function Xe(t){return Xe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Xe(t)}var Ke=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ze(t,e)}(r,t);var e,i,n,o=qe(r);function r(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),o.call(this)}return e=r,i=[{key:"draw",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=this.options.lineWidth;i*=e;var n=t[0],o=this.canvas.getContext("2d"),r=n.x,s=n.y;o.lineWidth=2,o.moveTo(r+i,s),o.arc(r,s,i,0,2*Math.PI,!1),this.options.fillStyle&&(o.fillStyle=this.options.fillStyle),o.strokeStyle=this.options.strokeStyle}}],i&&Ue(e.prototype,i),n&&Ue(e,n),Object.defineProperty(e,"prototype",{writable:!1}),r}(St),Ye=(i(17),i(2157),i(7746),i(345),i(3148),"start-painting"),Je="in-painting",Qe="end-painting",ti="stop-painting",ei="tailoring-region",ii="tailoring-screenshot",ni="area-move-start",oi="area-moving",ri="area-move-end",si="select-label",ai="cancel-select-label",li="db-click-label",ci="cache-back",ui="cache-forward",hi="hidden-label",pi="delete-label",di="delete-polygon-point",fi="add-polygon-point",vi="navigator-vestige",gi="graduation-change";function mi(t){return mi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mi(t)}function yi(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,wi(n.key),n)}}function wi(t){var e=function(t,e){if("object"!=mi(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=mi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==mi(e)?e:e+""}var xi,bi={all:xi=xi||new Map,on:function(t,e){var i=xi.get(t);i?i.push(e):xi.set(t,[e])},off:function(t,e){var i=xi.get(t);i&&(e?i.splice(i.indexOf(e)>>>0,1):xi.set(t,[]))},emit:function(t,e){var i=xi.get(t);i&&i.slice().map(function(t){t(e)}),(i=xi.get("*"))&&i.slice().map(function(i){i(t,e)})}},Ti=function(){function e(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),this.eventList=[],this.key=C()}var i,n,o;return i=e,n=[{key:"$emit",value:function(e,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:document;if(Object.values(t).includes(e))bi.emit("".concat(this.key,"_").concat(e),i);else{var o=new CustomEvent(e,{bubbles:!0,detail:i});n.dispatchEvent(o)}}},{key:"$on",value:function(e,i){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:document;Object.values(t).includes(e)?bi.on("".concat(this.key,"_").concat(e),i):(o.addEventListener(e,i,n),this.eventList.push({target:o,eventName:e,callback:i,options:n}))}},{key:"$once",value:function(t,e){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:document;n.addEventListener(t,function o(r){e(r),n.removeEventListener(t,o,i)},i)}},{key:"$off",value:function(e,i,n){var o=this,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:document;Object.values(t).includes(e)?bi.off("".concat(this.key,"_").concat(e),i):this.eventList.filter(function(t){return!(t.target!==r&&r&&r!==document||t.eventName!==e&&e||t.options!==n&&null!=n||t.callback!==i&&i)}).forEach(function(t){t.target.removeEventListener(t.eventName,t.callback,t.options);var e=o.eventList.findIndex(function(e){return e===t});~e&&o.eventList.splice(e,1)})}},{key:"destroy",value:function(){this.$off(),bi.all.clear()}}],n&&yi(i.prototype,n),o&&yi(i,o),Object.defineProperty(i,"prototype",{writable:!1}),e}();function Pi(t){return Pi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pi(t)}function Si(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function Ei(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Si(Object(i),!0).forEach(function(e){Ci(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Si(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function Ci(t,e,i){return(e=Oi(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function _i(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Oi(n.key),n)}}function Oi(t){var e=function(t,e){if("object"!=Pi(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Pi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Pi(e)?e:e+""}function Ri(t,e){return Ri=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ri(t,e)}function Ii(t){var e=ki();return function(){var i,n=Di(t);if(e){var o=Di(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return function(t,e){if(e&&("object"==Pi(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,i)}}function ki(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ki=function(){return!!t})()}function Di(t){return Di=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Di(t)}var Mi=new Ti,ji=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ri(t,e)}(r,t);var e,i,n,o=Ii(r);function r(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),o.call(this)}return e=r,i=[{key:"draw",value:function(t){var e=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;2===t.length&&(t=T(t));var n=S(t[1],t[0]),o=S(t[2],t[0]),r=Ei(Ei({},t[0]),{},{width:n,height:o});if(this.options.imgLoadSuccess)this.drawImage(this.options.img,r,i);else if(this.options.img){var s=this.options.img;Mi.$once("load",function(){e.drawImage(s,r,i)},!0,s)}}},{key:"drawImage",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=this.canvas.getContext("2d");n.beginPath(),n.save(),n.translate(e.x,e.y),i<0&&(i+=360);var o=i%360;n.rotate(o*Math.PI/180),n.drawImage(t,0,0,e.width,e.height),n.restore()}}],i&&_i(e.prototype,i),n&&_i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),r}(St);function Li(t){return Li="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Li(t)}function Ai(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Bi(n.key),n)}}function Bi(t){var e=function(t,e){if("object"!=Li(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Li(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Li(e)?e:e+""}function Ni(t,e){return Ni=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ni(t,e)}function zi(t){var e=Hi();return function(){var i,n=Fi(t);if(e){var o=Fi(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return function(t,e){if(e&&("object"==Li(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,i)}}function Hi(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Hi=function(){return!!t})()}function Fi(t){return Fi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Fi(t)}var Wi=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ni(t,e)}(r,t);var e,i,n,o=zi(r);function r(t){var e,i=t.viewer,n=t.canvas,s=t.cache,a=t.options;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),(e=o.call(this,i,n,s,a)).isInRotation=!1,e.pointList=[],e.img=new Image(33,18),e.img.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACEAAAASCAYAAADVCrdsAAAAAXNSR0IArs4c6QAAAzFJREFUSA2tVc9Lk3Ecbo4tE7FgOBNtIFhd5kWZsQm7JEkLvNRIAju4gyfREPwLJHBs1WFnSfAPGB0EDyoKqcw86UGw6GJ62SiIzM3Yp+f58P2ONadm9sDD99fz+TzP++593zmuXAAicgvy52AQ9IMe8Cr4DdwDP4CL4DuHw3GI8f8B5g/ANPgL/Bt8h+gN2HTpFGhyA6S54ujoqDgzMyODg4PS09Mjzc3N4na7xev1SigUkvHxcdne3rZyjgwT/ecgKA6An0HJZrPFiYkJ8Xg8gobnsre3V+bm5lhqMYWJ89QwOGwCX4EJ8DaFGO+DeVBWV1eltbW1ZOz3+yWRSKjJzs6OHBwcqGZ2dlaGhoaktra2pB0eHpZCoVBkH2AedJn+dzCnH32baLgEWtA4CWa5kUqlxOVyadPu7m5ZWVnh9pnI5XLFyclJ/Zl4PcFgkEFtkBSKX4J6gabREkPoxvT0NPesWNLptOAJ1wBjY2NyfHxsz75C9xp8CN4Fb4JBMAa+BxWZTEZ8Pp/Wd3Z2Sj6ft/U8Lxo/zvMMcchZXV2d8Go3NjaEt7mhoUEbxONxHhNswsU13tLTgPN74C6oz1JbW5v2GRkZ4Zb2pw/9DH4wRI4L+9DV1NRIY2OjFg4MDBidDs9OM67ch/o6OM+qzc3N0nPS398v7A+9+vEcyDLEF85aWlr0kALLZDIpRYDnAHWPKw2rraF7YvRaH41GSz1tbz7sBnsM8ZGL9vb2E0IWdHV1ydramtHrTxKpZmz3IHwEanDWsd4al4/0M9hliC0uOjo6qopZWF9fL+vr66ZGEtaw2ggRXz3Vs67cuHxOP4MthshwEQgEThQ4nU6JxWKyv79vf5ICpOFq5naP5yB1Wsd69ikPwDn9DDIMscxFOBz+QxiJRCo/wQwbsmZnjdSBenEYtQ/7lQehn8EyQ+hT3NfXpyK+0wsLC1bA8RP4FHScZVx5Rr2pY72CfdmfYehnMM8Q+gc1Ojoq/PQC9tbz1X0BuisNLrJmvemjnwLMi/Shn0GaIeJ2ZcafZu/GRczO06In/5Hpxf7lmGIIL7gIMulb0Hdew8ucs7/xoR99vb8Be6xf/B8l0bwAAAAASUVORK5CYII=",e}return e=r,i=[{key:"init",value:function(t){var e=t.width,i=t.height;this.isInRotation=!0,this.imgWidth=e,this.imgHeight=i,this.rect=new ye,this.rect.setContent(this.canvas,{lineWidth:1,strokeStyle:"#989898"}),this.change()}},{key:"drawRect",value:function(t,e){var i=this.viewport.imageToViewportRectangle(0,0,this.imgWidth,this.imgHeight);this.rect.startDraw(),this.rect.draw([t,e],this.viewport.getRotation(),this.viewport.viewportToViewerElementRectangle(i)),this.rect.endDraw(),this.drawThumbPoint()}},{key:"drawRotation",value:function(){var t=this.imageToViewerElementCoordinates(this.imgWidth/2,-this.imgHeight/15),e=this.imageToViewerElementCoordinates(this.imgWidth/2,this.imgHeight/15),i=this.viewport.getRotation(),n=this.canvas.getContext("2d");n.save(),n.beginPath(),n.translate(e.x,e.y),n.rotate(i/180*Math.PI),n.font="14px Arial";var o=i+"°",r=n.measureText(o).width;n.fillStyle="rgba(0, 0, 0, 0.5)",n.rect(-r/2-10,0,r+20,24),n.fill(),n.beginPath(),n.fillStyle="#FDFDFD",n.fillText(o,-r/2,18),n.restore(),n.save(),n.beginPath(),n.translate(t.x,t.y),n.rotate(i/180*Math.PI),n.drawImage(this.img,-16.5,0,33,18),n.restore()}},{key:"drawPoint",value:function(t,e){this.thumb.draw(t,e)}},{key:"drawThumbPoint",value:function(){var t=this;this.pointList.forEach(function(e,i){t.drawPoint({x:e.x,y:e.y},{radius:5})})}},{key:"onCanvasPress",value:function(t){var e=t.x,i=t.y,n=this.imageToViewerElementCoordinates(this.imgWidth/2,-this.imgHeight/15),o=!!l({x:n.x-16.5,y:n.y},{x:n.x+16.5,y:n.y-18}).find(function(t){return f(t,{x:e,y:i})});this.rotatePoint=o?{x:e,y:i}:void 0}},{key:"onCanvasRelease",value:function(t){t.x,t.y,this.rotatePoint=void 0,this.lastPoint=void 0}},{key:"onCanvasDrag",value:function(t){var e=t.x,i=t.y;if(this.rotatePoint){this.lastPoint||(this.lastPoint={x:e,y:i});var n=P(this.pointList[4],this.lastPoint,{x:e,y:i});if(!isNaN(n/Math.PI*180)){var o=(n/Math.PI*180).toFixed(1)/1;this.viewport.setRotation((this.viewport.getRotation()+o).toFixed(1)/1),this.lastPoint={x:e,y:i}}}}},{key:"onCanvasKey",value:function(t){"Escape"===t.originalEvent.key&&(this.viewport.setRotation(0),this.stopRotation())}},{key:"stopRotation",value:function(){this.clearCanvas(),this.rotatePoint=void 0,this.lastPoint=void 0,this.pointList=[],this.isInRotation=!1}},{key:"change",value:function(){var t=this;this.isInRotation&&(this.clearCanvas(),this.pointList=l({x:0,y:0},{x:this.imgWidth,y:this.imgHeight}).map(function(e){var i=e.x,n=e.y;return t.imageToViewerElementCoordinates(i,n)}),this.drawRect(this.pointList[0],this.pointList[8]),this.drawRotation())}}],i&&Ai(e.prototype,i),n&&Ai(e,n),Object.defineProperty(e,"prototype",{writable:!1}),r}(xt),Vi=i(5072),Ui=i.n(Vi),Gi=i(7825),Zi=i.n(Gi),qi=i(7659),$i=i.n(qi),Xi=i(5056),Ki=i.n(Xi),Yi=i(540),Ji=i.n(Yi),Qi=i(1113),tn=i.n(Qi),en=i(1988),nn={};nn.styleTagTransform=tn(),nn.setAttributes=Ki(),nn.insert=$i().bind(null,"head"),nn.domAPI=Zi(),nn.insertStyleElement=Ji();Ui()(en.A,nn),en.A&&en.A.locals&&en.A.locals;function on(t){return on="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},on(t)}function rn(t){return function(t){if(Array.isArray(t))return sn(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return sn(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?sn(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function sn(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function an(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function ln(t,e,i){return(e=un(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function cn(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,un(n.key),n)}}function un(t){var e=function(t,e){if("object"!=on(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=on(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==on(e)?e:e+""}var hn=function(){function t(e){var i=e.mitt,n=function(t,e){if(null==t)return{};var i,n,o=function(t,e){if(null==t)return{};var i={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(-1!==e.indexOf(n))continue;i[n]=t[n]}return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(n=0;n<r.length;n++)i=r[n],-1===e.indexOf(i)&&{}.propertyIsEnumerable.call(t,i)&&(o[i]=t[i])}return o}(e,["mitt"]);!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.mitt=i,this.options=n,this.viewport=n.viewer.viewport,this.viewer=n.viewer,this.el=n.el,this.height=n.height||150,this.width=n.width||150,this.containerHeight=n.containerHeight||window.innerHeight,this.containerWidth=n.containerWidth||window.innerWidth,this.element=n.element,this.canvas=document.createElement("canvas"),this.pointList=n.pointList||[],this.loadStatus=!1,this.init(),this.vestige=this.options.vestige?function(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?an(Object(i),!0).forEach(function(e){ln(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):an(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}({show:!0,delay:1e3,colors:["rgba(255, 255, 0, .5)","rgba(0, 255, 255, .5)","rgba(255, 0, 255, .5)"],zooms:[5,10,20]},this.options.vestige):{show:!0,delay:1e3,colors:["rgba(255, 255, 0, .5)","rgba(0, 255, 255, .5)","rgba(255, 0, 255, .5)"],zooms:[5,10,20]}}var e,i,n;return e=t,i=[{key:"init",value:function(){var t=this;this.element.innerHTML='<main class="navigator-main">\n <div class="v-line"></div>\n <div class="h-line"></div>\n <div class="view-rect"></div>\n <canvas class="navigator-color-rect"></canvas>\n</main>';var e=this.element.getElementsByClassName("navigator-main")[0];this.rect=this.element.getElementsByClassName("view-rect")[0],this.updateNavigatorImg(this.options.thumbnail),e.appendChild(this.canvas),this.handleMouseDrag(e),this.viewer.addHandler("pan",function(e){t.navigatorChange(t.viewport.getZoom(!0),e.center)}),this.viewer.addHandler("zoom",function(e){t.navigatorChange(e.zoom,e.refPoint)})}},{key:"rectChange",value:function(){var t=this.element.getElementsByClassName("navigator-main")[0],e=this.rect,i=t.getElementsByClassName("v-line")[0],n=t.getElementsByClassName("h-line")[0];i.style.left=Math.round(e.getBoundingClientRect().width/2+e.offsetLeft)+"px",n.style.top=Math.round(e.getBoundingClientRect().height/2+e.offsetTop)+"px",i.style.backgroundColor="red",n.style.backgroundColor="red"}},{key:"rectDraw",value:function(t){var e=this.rect,i={left:e.offsetLeft,top:e.offsetTop,width:e.clientWidth,height:e.clientHeight,scale:rn(this.vestige.zooms).reverse()[t],color:rn(this.vestige.colors).reverse()[t]};this.pointList.push(i),this.drawPointList(this.pointList),this.mitt.$emit(vi,this.pointList)}},{key:"drawPointList",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.pointList;this.pointList=e;var i=this.element.getElementsByClassName("navigator-color-rect")[0].getContext("2d");this.pointList.sort(function(t,e){return t.scale>e.scale?1:-1}).forEach(function(e){t.drawRect(i,e)})}},{key:"drawRect",value:function(t,e){t.beginPath(),t.fillStyle=e.color,t.clearRect(e.left,e.top,e.width+1,e.height+1),t.fillRect(e.left,e.top,e.width+1,e.height+1)}},{key:"navigatorChange",value:function(t,e){this.loadStatus&&(e||(e=this.viewport.getCenter(!0)),this.setViewRect(e))}},{key:"panTo",value:function(t,e){var i=t.x,n=t.y,o=this.viewport.getHomeBounds(),r=this.viewport.viewportToImageRectangle(o),s=2*r.y+r.height,a=2*r.x+r.width,l={x:i/this.canvas.width*a,y:n/this.canvas.height*s};this.viewport.panTo(this.viewport.imageToViewportCoordinates(new $.Point(l.x,l.y)),!1)}},{key:"handleMouseDrag",value:function(t){var e,i,n=this,o=function(o){var r=o.x,s=o.y;i||(i={x:r,y:s}),e||(e={x:r,y:s});var a=r-e.x,l=s-e.y;n.panTo({x:i.x+a,y:i.y+l},t)},r=function t(){e="",i={x:n.centerPoint.x,y:n.centerPoint.y},n.mitt.$off("mousemove",o),n.mitt.$off("mouseup",t)},s=function t(){e="",i={x:n.centerPoint.x,y:n.centerPoint.y},n.mitt.$off("touchmove",a),n.mitt.$off("touchend",t)},a=function(o){var r=o.touches[0].clientX,s=o.touches[0].clientY;i||(i={x:r,y:s}),e||(e={x:r,y:s});var a=r-e.x,l=s-e.y;n.panTo({x:i.x+a,y:i.y+l},t)};this.mitt.$on("mousedown",function(e){n.mitt.$on("selectstart",function(){return 1}),n.mitt.$on("dragstart",function(){return 1}),n.panTo({x:e.x-t.getBoundingClientRect().left,y:e.y-t.getBoundingClientRect().top},t),i={x:n.centerPoint.x,y:n.centerPoint.y},n.mitt.$on("mousemove",o),n.mitt.$on("mouseup",r)},!0,t),this.mitt.$on("touchstart",function(e){var o=e.touches[0].clientX,r=e.touches[0].clientY;n.panTo({x:o-t.getBoundingClientRect().left,y:r-t.getBoundingClientRect().top},t),i={x:n.centerPoint.x,y:n.centerPoint.y},n.mitt.$on("touchmove",a),n.mitt.$on("touchend",s)},!0,t)}},{key:"setViewRect",value:function(t){var e=this;if(!this.rect)throw new Error("找不到对应的导航器遮罩元素");t||(t=this.viewport.getCenter(!0));var i=this.viewport.getHomeBounds(),n=this.viewport.viewportToImageRectangle(i),o=2*n.y+n.height,r=2*n.x+n.width,s=1,a=this.canvas.height,l=this.canvas.width;s=o<=r?a/o:l/r;var c=this.viewport.getHomeZoom(),u=this.viewport.getZoom(),h=o*c/u,p=r*c/u;this.rect.style.cssText="height:".concat(h*s,"px;\n width: ").concat(p*s,"px;");var d=this.viewport.viewportToImageCoordinates(t);this.centerPoint={x:d.x*l/r,y:d.y*a/o};var f=this.centerPoint.y-h*s/2,v=this.centerPoint.x-p*s/2;if(this.rect.style.left=v+"px",this.rect.style.top=f+"px",this.rect.style.border="1px solid red",this.rectChange(),!1!==this.vestige.show){this.clearTimeId&&window.clearTimeout(this.clearTimeId);var g=this.viewport.viewportToImageZoom(u),m=rn(this.vestige.zooms).reverse().findIndex(function(t){return g>=t/(e.options.scale||40)});-1!==m&&(this.clearTimeId=window.setTimeout(function(){e.rectDraw(m)},this.vestige.delay||1e3))}}},{key:"updateNavigatorImg",value:function(t){var e=this;this.options.thumbnail=t;var i=this.canvas.getContext("2d"),n=new Image;n.onload=function(){var t=n.width,o=n.height;if(t>=o){var r=o/(t/e.width);e.canvas.width=e.width,e.canvas.height=r,i.clearRect(0,0,e.canvas.width,e.canvas.height),i.drawImage(n,0,0,e.canvas.width,r)}if(o>t){var s=t/(o/e.height);e.canvas.height=e.height,e.canvas.width=s,i.clearRect(0,0,e.canvas.width,e.canvas.height),i.drawImage(n,0,0,s,e.canvas.height)}e.setViewRect();var a=e.element.getElementsByClassName("navigator-color-rect")[0];a.width=e.canvas.width,a.height=e.canvas.height,e.loadStatus=!0},n.src=this.options.thumbnail}}],i&&cn(e.prototype,i),n&&cn(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function pn(t){return pn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pn(t)}function dn(t){return function(t){if(Array.isArray(t))return fn(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return fn(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?fn(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fn(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function vn(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function gn(t,e,i){return(e=yn(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function mn(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,yn(n.key),n)}}function yn(t){var e=function(t,e){if("object"!=pn(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=pn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==pn(e)?e:e+""}function wn(t,e){return wn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},wn(t,e)}function xn(t){var e=bn();return function(){var i,n=Tn(t);if(e){var o=Tn(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return function(t,e){if(e&&("object"==pn(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,i)}}function bn(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(bn=function(){return!!t})()}function Tn(t){return Tn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Tn(t)}var Pn=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&wn(t,e)}(r,t);var e,i,n,o=xn(r);function r(t){var e,i=t.kv,n=t.viewer,s=t.canvas,a=t.cache,l=t.options;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),(e=o.call(this,n,s,a,l)).kv=i,e.isInTailoring=!1,e.tailoringPoints=[],e.movePointIndex=-1,e.color="#FFF",e.contents=[],e.options=function(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?vn(Object(i),!0).forEach(function(e){gn(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):vn(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}({suffix:"jpeg",quality:.92,resolution:1200,shape:!0},e.options),e.custom=void 0,e}return e=r,i=[{key:"init",value:function(t,e){var i=t.width,n=t.height,o=t.left,r=t.top,s=t.color,a=t.now,c=void 0!==a&&a,u=t.contents,h=void 0===u?[]:u;this.isInTailoring=!0,this.movePointIndex=-1;var p=l({x:o,y:r},{x:o+i,y:r+n});this.tailoringPoints=[p[0],p[2],p[6],p[8]],this.custom=e,c?(this.emitScreenShot(),this.stopTailoring()):(this.color=s||"#FFF",this.contents=(null==h?void 0:h.length)?h:[],this.change())}},{key:"emitTailoringRegion",value:function(){this.mitt.$emit(ei,this.viewerElementToImageRectangle({x:this.tailoringPoints[0].x,y:this.tailoringPoints[0].y,width:this.tailoringPoints[3].x-this.tailoringPoints[0].x,height:this.tailoringPoints[3].y-this.tailoringPoints[0].y}))}},{key:"drawRect",value:function(){var t=this.canvas.getContext("2d");t.beginPath(),t.strokeStyle=this.color,t.lineWidth=1,t.rect(this.tailoringPoints[0].x,this.tailoringPoints[0].y,this.tailoringPoints[3].x-this.tailoringPoints[0].x,this.tailoringPoints[3].y-this.tailoringPoints[0].y),t.stroke()}},{key:"drawTailoring",value:function(){var t,e,i,n,o,r=Math.min.apply(Math,dn(this.tailoringPoints.map(function(t){return t.x}))),s=Math.min.apply(Math,dn(this.tailoringPoints.map(function(t){return t.y}))),a=Math.max.apply(Math,dn(this.tailoringPoints.map(function(t){return t.x}))),l=Math.max.apply(Math,dn(this.tailoringPoints.map(function(t){return t.y}))),c={x:r,y:s},u={x:a,y:s},h={x:r,y:l},p={x:a,y:l},d=a-r>30?30:a-r,f=l-s>30?30:l-s,v=this.canvas.getContext("2d");v.beginPath(),v.strokeStyle=this.color,v.lineWidth=4,v.moveTo(c.x,c.y),v.lineTo(c.x+d,c.y),v.moveTo(c.x,c.y),v.lineTo(c.x,c.y+f),v.moveTo(u.x,u.y),v.lineTo(u.x-d,u.y),v.moveTo(u.x,u.y),v.lineTo(u.x,u.y+f),v.moveTo(h.x,h.y),v.lineTo(h.x+d,h.y),v.moveTo(h.x,h.y),v.lineTo(h.x,h.y-f),v.moveTo(p.x,p.y),v.lineTo(p.x-d,p.y),v.moveTo(p.x,p.y),v.lineTo(p.x,p.y-f),v.stroke(),v.beginPath(),v.fillStyle=this.color,v.font="18px Arial";var g=(u.x-c.x).toFixed(2)/1,m=(p.y-u.y).toFixed(2)/1;v.fillText((null===(t=this.contents)||void 0===t?void 0:t[2])?this.contents[2](g,m):"".concat(this.translate("area_size")).concat(g,"*").concat(m,",").concat(this.translate("drag_resize")),c.x,c.y-50),v.fillText(null!==(e=null===(i=this.contents)||void 0===i?void 0:i[0])&&void 0!==e?e:"".concat(this.translate("complete_screenshot")),c.x,c.y-30),v.fillText(null!==(n=null===(o=this.contents)||void 0===o?void 0:o[1])&&void 0!==n?n:"".concat(this.translate("cancel_screenshot")),c.x,c.y-10),v.stroke(),v.beginPath(),v.fillStyle="#000000";var y=4,w=100;u.x+w+y>this.canvas.width&&(w=-100,y=-4),v.rect(u.x+y,u.y,w,40),v.fill(),v.save(),v.beginPath(),v.translate(u.x+y+w/2,u.y-5),v.fillStyle="#ffffff",v.drawConfirm(),v.restore(),v.save(),v.beginPath(),w<0?v.translate(u.x+w+y,u.y-5):v.translate(u.x+y,u.y-5),v.fillStyle="#ffffff",v.drawCancel(),v.restore()}},{key:"onCanvasPress",value:function(t){var e=t.x,i=t.y;this.movePointIndex=this.tailoringPoints.findIndex(function(t){return f(t,{x:e,y:i},30)});var n=this.tailoringPoints[1],o=new $.Rect(n.x+14,n.y,30,40),r=new $.Rect(n.x+64,n.y,30,40);n.x+100+4>this.canvas.width&&(o=new $.Rect(n.x-94,n.y,30,40),r=new $.Rect(n.x-44,n.y,30,40));var s=new $.Point(e,i);o.containsPoint(s)&&this.stopTailoring(),r.containsPoint(s)&&(this.emitScreenShot(),this.stopTailoring())}},{key:"onCanvasRelease",value:function(t){t.x,t.y,this.movePointIndex=-1,this.lastPoint=void 0}},{key:"onCanvasDrag",value:function(t){var e=this,i=t.x,n=t.y;if(-1!==this.movePointIndex){this.lastPoint||(this.lastPoint={x:i,y:n});var o=i-this.lastPoint.x,r=n-this.lastPoint.y;switch(this.movePointIndex){case 0:this.tailoringPoints[0]={x:this.tailoringPoints[0].x+o,y:this.tailoringPoints[0].y+r},this.tailoringPoints[1]={x:this.tailoringPoints[1].x,y:this.tailoringPoints[1].y+r},this.tailoringPoints[2]={x:this.tailoringPoints[2].x+o,y:this.tailoringPoints[2].y};break;case 1:this.tailoringPoints[0]={x:this.tailoringPoints[0].x,y:this.tailoringPoints[0].y+r},this.tailoringPoints[1]={x:this.tailoringPoints[1].x+o,y:this.tailoringPoints[1].y+r},this.tailoringPoints[3]={x:this.tailoringPoints[3].x+o,y:this.tailoringPoints[3].y};break;case 2:this.tailoringPoints[0]={x:this.tailoringPoints[0].x+o,y:this.tailoringPoints[0].y},this.tailoringPoints[2]={x:this.tailoringPoints[2].x+o,y:this.tailoringPoints[2].y+r},this.tailoringPoints[3]={x:this.tailoringPoints[3].x,y:this.tailoringPoints[3].y+r};break;case 3:this.tailoringPoints[1]={x:this.tailoringPoints[1].x+o,y:this.tailoringPoints[1].y},this.tailoringPoints[2]={x:this.tailoringPoints[2].x,y:this.tailoringPoints[2].y+r},this.tailoringPoints[3]={x:this.tailoringPoints[3].x+o,y:this.tailoringPoints[3].y+r}}this.tailoringPoints.forEach(function(t){t.x<0&&(t.x=0),t.y<0&&(t.y=0),t.x>e.canvas.width&&(t.x=e.canvas.width),t.y>e.canvas.height&&(t.y=e.canvas.height)}),this.clearCanvas(),this.drawRect(),this.drawTailoring(),this.lastPoint={x:i,y:n},this.emitTailoringRegion()}}},{key:"onCanvasKey",value:function(t){"Escape"===t.originalEvent.key&&this.stopTailoring()}},{key:"onCanvasDblClick",value:function(t){this.tailoringPoints.length>0&&this.isPointInMatrix(t)&&this.emitScreenShot(),this.stopTailoring()}},{key:"emitScreenShot",value:function(){this.emitTailoringRegion(),this.mitt.$emit(ii,{base64:this.getScreenCanvasImage(),region:this.viewerElementToImageRectangle({x:this.tailoringPoints[0].x,y:this.tailoringPoints[0].y,width:this.tailoringPoints[3].x-this.tailoringPoints[0].x,height:this.tailoringPoints[3].y-this.tailoringPoints[0].y}),custom:this.custom})}},{key:"isPointInMatrix",value:function(t){var e=Math.min.apply(Math,dn(this.tailoringPoints.map(function(t){return t.x}))),i=Math.min.apply(Math,dn(this.tailoringPoints.map(function(t){return t.y}))),n=Math.max.apply(Math,dn(this.tailoringPoints.map(function(t){return t.x}))),o=Math.max.apply(Math,dn(this.tailoringPoints.map(function(t){return t.y})));return p({x:e,y:i},{x:n,y:i},{x:e,y:o},{x:n,y:o},t)}},{key:"getScreenCanvasImage",value:function(){var t=this.viewer.drawer.canvas,i={x:Math.min.apply(Math,dn(this.tailoringPoints.map(function(t){return t.x}))),y:Math.min.apply(Math,dn(this.tailoringPoints.map(function(t){return t.y})))},n=Math.max.apply(Math,dn(this.tailoringPoints.map(function(t){return t.x}))),o=Math.max.apply(Math,dn(this.tailoringPoints.map(function(t){return t.y}))),r=t.getContext("2d"),s=t.getBoundingClientRect(),a=s.width,l=s.height,c=[t.width,t.height],u=c[0]/a,h=c[1]/l,p=Math.abs(n-i.x)*u,d=Math.abs(o-i.y)*h;if(p.toFixed(5)/1!=0&&d.toFixed(5)/1!=0)try{for(var f,v=r.getImageData(i.x*u,i.y*h,p,d),g=0;g<v.data.length;g+=4)0===v.data[g+3]&&(v.data[g]=255,v.data[g+1]=255,v.data[g+2]=255,v.data[g+3]=255);var m=document.createElement("canvas");m.width=p,m.height=d;var y=m.getContext("2d");y.fillstyle="#fff",y.fillRect(0,0,m.width,m.height),y.putImageData(v,0,0,0,0,p,d);var w=null===(f=this.kv.shape)||void 0===f?void 0:f.canvas;if(w&&this.options.shape&&y.drawImage(w,i.x,i.y,Math.abs(n-i.x),Math.abs(o-i.y),0,0,p,d),m.width>this.options.resolution){var x=document.createElement("canvas");x.width=this.options.resolution,x.height=this.options.resolution/m.width*m.height;var b=x.getContext("2d");return b.fillstyle="#fff",b.fillRect(0,0,x.width,x.height),b.drawImage(m,0,0,m.width,m.height,0,0,x.width,x.height),x.toDataURL("image/".concat(this.options.suffix||"jpeg"),this.options.quality)}return m.toDataURL("image/".concat(this.options.suffix||"jpeg"),this.options.quality)}catch(e){}}},{key:"stopTailoring",value:function(){this.clearCanvas(),this.tailoringPoints=[],this.isInTailoring=!1,this.movePointIndex=-1,this.lastPoint=void 0}},{key:"change",value:function(){this.isInTailoring&&(this.clearCanvas(),this.emitTailoringRegion(),this.drawRect(),this.drawTailoring())}}],i&&mn(e.prototype,i),n&&mn(e,n),Object.defineProperty(e,"prototype",{writable:!1}),r}(xt);i(3604),i(7899);function Sn(t){return Sn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Sn(t)}function En(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Cn(n.key),n)}}function Cn(t){var e=function(t,e){if("object"!=Sn(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Sn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Sn(e)?e:e+""}function _n(t,e){return _n=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_n(t,e)}function On(t){var e=Rn();return function(){var i,n=In(t);if(e){var o=In(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return function(t,e){if(e&&("object"==Sn(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,i)}}function Rn(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Rn=function(){return!!t})()}function In(t){return In=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},In(t)}var kn=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_n(t,e)}(r,t);var e,i,n,o=On(r);function r(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),o.apply(this,arguments)}return e=r,i=[{key:"draw",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=this.canvas.getContext("2d"),o=t.tool,r=t.points;n.beginPath(),n.save(),2===r.length&&(r=T(r));var s=m(r),a={x:s.x+s.width/2,y:s.y+s.height/2};n.translate(a.x,a.y),i<0&&(i+=360);var l=i%360;n.rotate(l*Math.PI/180),o===et?n.drawPolygon(r.map(function(t){return{x:t.x-a.x,y:t.y-a.y}}),!0,!1):o===Q?(n.moveTo(r[0].x-a.x,r[0].y-a.y),n.lineTo(r[0].x+s.width-a.x,r[0].y-a.y),n.lineTo(r[0].x+s.width-a.x,r[0].y+s.height-a.y),n.lineTo(r[0].x-a.x,r[0].y+s.height-a.y),n.lineTo(r[0].x-a.x,r[0].y-a.y)):o===tt&&n.drawOval(0,0,Math.abs(s.width/2),Math.abs(s.height/2),!1),n.closePath(),n.restore(),e.forEach(function(t){var e=t.tool,i=t.points;2===i.length&&(i=T(i)),n.save();var o=m(i),r={x:o.x+o.width/2,y:o.y+o.height/2};n.translate(r.x,r.y),n.rotate(l*Math.PI/180),e===et?n.drawPolygon(i.map(function(t){return{x:t.x-r.x,y:t.y-r.y}}),!0,!0):e===Q?(n.moveTo(i[0].x-r.x,i[0].y-r.y),n.lineTo(i[0].x-r.x,i[0].y+o.height-r.y),n.lineTo(i[0].x+o.width-r.x,i[0].y+o.height-r.y),n.lineTo(i[0].x+o.width-r.x,i[0].y-r.y),n.lineTo(i[0].x-r.x,i[0].y-r.y)):e===tt&&n.drawOval(0,0,Math.abs(o.width/2),Math.abs(o.height/2),!0),n.closePath(),n.restore()}),this.options.fillStyle&&(n.fillStyle=this.options.fillStyle,n.fill())}}],i&&En(e.prototype,i),n&&En(e,n),Object.defineProperty(e,"prototype",{writable:!1}),r}(St);function Dn(t){return Dn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Dn(t)}function Mn(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function jn(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Mn(Object(i),!0).forEach(function(e){Ln(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Mn(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function Ln(t,e,i){return(e=Bn(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function An(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Bn(n.key),n)}}function Bn(t){var e=function(t,e){if("object"!=Dn(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Dn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Dn(e)?e:e+""}function Nn(t,e){return Nn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Nn(t,e)}function zn(t){var e=Hn();return function(){var i,n=Fn(t);if(e){var o=Fn(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return function(t,e){if(e&&("object"==Dn(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,i)}}function Hn(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Hn=function(){return!!t})()}function Fn(t){return Fn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Fn(t)}var Wn=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Nn(t,e)}(s,t);var i,n,o,r=zn(s);function s(t){var i,n=t.viewer,o=t.canvas,a=t.cache,l=t.options;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(i=r.call(this,n,o,a,l)).labelList=[],pt.forEach(function(t){i[t]=new e[t]}),i.combination=new kn,i.delaytimer=[],i}return i=s,(n=[{key:"onCanvasKey",value:function(t){}},{key:"setLabelList",value:function(t){this.labelList=t,this.change()}},{key:"change",value:function(){var t=this;this.clearCanvas();var e=this.viewport.viewportToImageRectangle(this.viewport.getBoundsNoRotate()),i={},n={},o=[],r=[],s=this.labelList.filter(function(s){var a,l,c,u,h;if(!1===s.show)return!1;if(s.custom)return!1;if(!t[s.tool])return!1;if(!t.isInCanvas(s.region,e))return!1;if((lt.includes(s.tool)||s.isClose&&s.tool===et)&&s.fillStyle)o.push(jn(jn({},s),{},{child:[],self:s}));else if(s.tool===st)return r.push(s),!1;var p="".concat(null!==(a=s.strokeStyle)&&void 0!==a?a:"","_").concat(null!==(l=s.lineWidth)&&void 0!==l?l:"","_").concat(null!==(c=s.fillStyle)&&void 0!==c?c:""),d="".concat(null!==(u=s.strokeStyle)&&void 0!==u?u:"","_").concat(null!==(h=s.lineWidth)&&void 0!==h?h:"");return at.includes(s.tool)?i[p]?i[p].push(s):i[p]=[s]:n[d]?n[d].push(s):n[d]=[s],!ht.includes(s.tool)});o.length>0&&s.forEach(function(e){var i=o.find(function(i){return i.self!==e&&e.points.every(function(e){return t.isContainerInRegion(e,i)})});i&&i.child.push(e)}),this.delaytimer&&(clearTimeout(this.delaytimer),this.delaytimer=void 0),r.forEach(function(e){t.drawLabel(e)}),this.deepDrawLabel(i,n,o,1,e)}},{key:"deepDrawLabel",value:function(t,e,i,n,o){var r=this,s=0,a=this.canvas.getContext("2d"),l={};Object.keys(t).forEach(function(e){var i=t[e];a.beginPath(),i.forEach(function(t){s>=4e3?l[e]?l[e].push(t):l[e]=[t]:r.drawLabel(t),s+=t.points.length});var n=null==i?void 0:i[0];(null==n?void 0:n.fillStyle)&&(a.fillStyle=n.fillStyle,a.fill()),a.strokeStyle=n.strokeStyle,a.stroke()});var c={};Object.keys(e).forEach(function(t){var i=e[t];a.beginPath(),i.forEach(function(e){s>=4e3?c[t]?c[t].push(e):c[t]=[e]:r.drawLabel(e),s+=e.points.length});var n=null==i?void 0:i[0];a.lineWidth=n.lineWidth,a.strokeStyle=n.strokeStyle,a.stroke()}),0===Object.keys(l).length&&0===Object.keys(c).length?(this.delaytimer=void 0,i.forEach(function(t){r.combination.setContent(r.canvas,t),r.combination.draw({points:r.imageToViewerElementPoints(t.points),tool:t.tool},t.child.map(function(t){var e=t.points,i=t.tool;return{points:r.imageToViewerElementPoints(e),tool:i}}),r.getAngle(t.angle))})):this.delaytimer=setTimeout(function(){r.deepDrawLabel(l,c,i,n+1,o)},100)}},{key:"getAngle",value:function(t){var e=this.viewport.getRotation()%360;return t?t>e?e-t+360:e-t:e}},{key:"drawLabel",value:function(t){t.viewerElementPoints=this.imageToViewerElementPoints(t.points);var e=t.viewerElementPoints;if(this[t.tool].setContent(this.canvas,t),lt.includes(t.tool))this[t.tool].draw(e,this.getAngle(t.angle));else{var i=this.getImageZoom(!0)/t.scale;this[t.tool].draw(e,i,this.getAngle(t.angle))}}}])&&An(i.prototype,n),o&&An(i,o),Object.defineProperty(i,"prototype",{writable:!1}),s}(xt);function Vn(t){return Vn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vn(t)}function Un(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function Gn(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Un(Object(i),!0).forEach(function(e){Zn(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Un(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function Zn(t,e,i){return(e=$n(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function qn(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,$n(n.key),n)}}function $n(t){var e=function(t,e){if("object"!=Vn(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Vn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Vn(e)?e:e+""}function Xn(t,e){return Xn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Xn(t,e)}function Kn(t){var e=Yn();return function(){var i,n=Jn(t);if(e){var o=Jn(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return function(t,e){if(e&&("object"==Vn(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,i)}}function Yn(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Yn=function(){return!!t})()}function Jn(t){return Jn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Jn(t)}var Qn=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Xn(t,e)}(s,t);var i,n,o,r=Kn(s);function s(t){var i,n=t.viewer,o=t.canvas,a=t.cache,l=t.options;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(i=r.call(this,n,o,a,l)).labelList=[],i.movePoint=void 0,i.currentPressPoint=void 0,i.lastPoint=void 0,i.draging=!1,i.isHover=!1,pt.forEach(function(t){i[t]=new e[t]}),i}return i=s,n=[{key:"drawPoint",value:function(t,e){this.thumb.draw(t,{radius:e?this.options.thumb.activeRadius:this.options.thumb.radius,strokeStyle:e?this.options.thumb.activeColor:this.options.thumb.color,fillStyle:e?this.options.thumb.activeBgColor:this.options.thumb.bgColor})}},{key:"drawLines",value:function(t,e){var i=this,n=this.canvas.getContext("2d");t.forEach(function(o,r){n.beginPath(),n.strokeStyle=a||"#01d0b0",n.lineWidth=2;var s=r===e,a=s?i.options.thumb.activeColor:i.options.thumb.color,l=2*(s?i.options.thumb.activeRadius:i.options.thumb.radius);if(0===r||2===r){var c=t[1],u=2===r?t[5]:t[3],h=c.x>o.x?-1:1,p=u.y>o.y?-1:1;n.moveTo(o.x+5*h,o.y+5*p),n.lineTo(o.x+(5-l)*h,o.y+5*p),n.moveTo(o.x+5*h,o.y+5*p),n.lineTo(o.x+5*h,o.y+(5-l)*p)}else if(1===r||7===r){var d=t[4].y>o.y?-1:1;n.moveTo(o.x,o.y+5*d),n.lineTo(o.x-l/2,o.y+5*d),n.moveTo(o.x,o.y+5*d),n.lineTo(o.x+l/2,o.y+5*d)}else if(3===r||5===r){var f=t[4].x>o.x?-1:1;n.moveTo(o.x+5*f,o.y),n.lineTo(o.x+5*f,o.y-l/2),n.moveTo(o.x+5*f,o.y),n.lineTo(o.x+5*f,o.y+l/2)}else if(4===r&&s)i.drawPoint(o,s);else if(6===r||8===r){var v=8===r?t[5]:t[3],g=t[7],m=v.y>o.y?-1:1,y=g.x>o.x?-1:1;n.moveTo(o.x+5*y,o.y+5*m),n.lineTo(o.x+5*y,o.y+(5-l)*m),n.moveTo(o.x+5*y,o.y+5*m),n.lineTo(o.x+(5-l)*y,o.y+5*m)}n.stroke()})}},{key:"setLabelList",value:function(t){this.labelList=t,this.change()}},{key:"onCanvasPress",value:function(t){var e=this,i=t.x,n=t.y;this.movePoint=void 0,this.currentPressPoint=void 0,this.lastPoint=void 0,this.draging=!1;var o,r=[],s=void 0,a=this.viewport.viewportToImageRectangle(this.viewport.getBoundsNoRotate());this.labelList.forEach(function(t){if(t.tool!==st&&(t.select&&(s=t),t.select=!1,!e.movePoint)){if(!e.isInCanvas(t.region,a))return!1;var o=-1,u=[],h=e.getImageZoom(!0)/t.scale,d=e.imageToViewerElementPoints(t.points),m={x:d[0].x,y:d[0].y},y={x:d[d.length-1].x,y:d[d.length-1].y};if(lt.includes(t.tool))o=(u=c(d)).findIndex(function(t){return f(t,{x:i,y:n})});else if(t.tool===et)o=(u=e.setPointsMove(t,d)).findIndex(function(t){return t.canMove&&f(t,{x:i,y:n})});else if(ct.includes(t.tool)){var w=t.lineWidth||2;u=[m,y],o=f(m,{x:i,y:n},10+w)?1:f(y,{x:i,y:n},10+w)?7:f({x:(y.x+m.x)/2,y:(y.y+m.y)/2},{x:i,y:n},10+w)?4:-1}else if(t.tool===it){var x=e.getFontWidth(t.text,t.fontSize);u=l({x:y.x,y:y.y-t.fontSize*h},{x:y.x+x*h,y:y.y});var T=b(y,{x:i,y:n},-t.angle);o=u.findIndex(function(t,e){return f(t,T)&&4===e})}else if(t.tool===nt){var P=t.lineWidth*h;o=(u=l({x:y.x-P,y:y.y-P},{x:y.x+P,y:y.y+P})).findIndex(function(t){return f(t,{x:i,y:n})})}if(t.tool===rt){var S=t.lineWidth*h;o=(u=l({x:y.x-S,y:y.y-S},{x:y.x+S,y:y.y+S})).findIndex(function(t,e){return f(t,{x:i,y:n})&&4===e})}else if(t.tool===ot){var E=t.lineWidth*h;o=(u=l({x:y.x,y:y.y-E},{x:y.x+E,y:y.y})).findIndex(function(t){return f(t,{x:i,y:n})})}~o?(e.movePoint={position:o,label:t},e.currentPressPoint={x:i,y:n}):t.tool===et?v({x:i,y:n},u)&&r.push(t):ct.includes(t.tool)?g({x:i,y:n},u)&&r.push(t):p(u[0],u[2],u[6],u[8],{x:i,y:n})&&r.push(t)}}),this.movePoint?(this.movePoint.label.select=!0,this.mitt.$emit(si,this.movePoint.label),this.mitt.$emit(ni,this.movePoint.label),this.draging=!0):r.length>0&&(r.sort(function(t,e){return t.tool===rt?-1:t.tool===it?e.tool===rt?1:-1:t.tool===nt?e.tool===rt||e.tool===it?1:-1:t.tool===ot?e.tool===rt||e.tool===it||e.tool===nt?1:-1:Math.abs(t.region.width)-Math.abs(e.region.width)}),(o=r[0]).select=!0),o?this.mitt.$emit(si,o):!this.movePoint&&s&&this.mitt.$emit(ai,s),this.change()}},{key:"onCanvasDblClick",value:function(t){var e=this,i=t.x,n=t.y;setTimeout(function(){var t=e.labelList.find(function(t){return t.select});if((null==t?void 0:t.tool)===et){for(var o=e.imageToViewerElementPoints(t.points),r=-1,s=0,a=o.length,l=a-1;s<a;l=s,s++){var c=o[s],u=o[l];if(g({x:i,y:n},[c,u])){r=s;break}}if(r>-1){var h=e.viewerElementToImageCoordinates(i,n);t.points.splice(r,0,Gn(Gn({},h),{},{canMove:!0})),e.mitt.$emit(fi,t),e.change()}else e.mitt.$emit(li,t)}else e.mitt.$emit(li,t)})}},{key:"onCanvasMove",value:function(t){var e=t.x,i=t.y,n=this.labelList.find(function(t){var e=t.tool,i=t.select;return e===Q&&i});if(n&&!this.movePoint){var o=this.imageToViewerElementPoints(n.points);if(this.isContainerInRegion({x:e,y:i},{isClose:!0,points:o,tool:Q,region:m(o)})){var r={x:(o[o.length-1].x+o[0].x)/2,y:(o[o.length-1].y+o[0].y)/2};f(r,{x:e,y:i})?(this.isHover=!0,this.drawPoint(r,!!this.movePoint)):this.isHover&&(this.isHover=!1,this.change())}}}},{key:"onCanvasRelease",value:function(t){var e=t.x,i=t.y;if(this.movePoint&&!1!==this.options.drag){var n=S(this.currentPressPoint,{x:e,y:i});if(Math.abs(n)>1){var o=this.movePoint.label;this.mitt.$emit(ri,o)}}this.movePoint=void 0,this.currentPressPoint=void 0,this.lastPoint=void 0,this.draging=!1,this.change()}},{key:"onCanvasDrag",value:function(t,e){var i=this,n=t.x,o=t.y;if(!1!==this.options.drag){this.lastPoint||(this.lastPoint={x:n,y:o});var r=this.movePoint.label,s=this.movePoint.position,a=!1!==r.move,l=!1!==r.resize;if((a||l)&&(4!==s||a)&&(4===s||l)){e.preventDefaultAction=!0;var u=this.getImageZoom(!0)/r.scale,h=r.tool,p=this.imageToViewerElementPoints(r.points),d=p[0],f=p[p.length-1],v=n-this.lastPoint.x,g=o-this.lastPoint.y;if(ct.includes(h))4===s&&(p[0]={x:d.x+v,y:d.y+g},p[1]={x:f.x+v,y:f.y+g}),1===s&&(p[0]={x:d.x+v,y:d.y+g}),7===s&&(p[1]={x:f.x+v,y:f.y+g});else if(lt.includes(h)){var y=c(p);switch(s){case 0:p[0]={x:y[0].x+v,y:y[0].y+g},p[1]={x:y[2].x,y:y[2].y+g},p[2]={x:y[6].x+v,y:y[6].y};break;case 1:p[0]={x:y[0].x,y:y[0].y+g},p[1]={x:y[2].x,y:y[2].y+g};break;case 2:p[0]={x:y[0].x,y:y[0].y+g},p[1]={x:y[2].x+v,y:y[2].y+g},p[3]={x:y[8].x+v,y:y[8].y};break;case 3:p[0]={x:y[0].x+v,y:y[0].y},p[2]={x:y[6].x+v,y:y[6].y};break;case 4:p[0]={x:y[0].x+v,y:y[0].y+g},p[1]={x:y[2].x+v,y:y[2].y+g},p[2]={x:y[6].x+v,y:y[6].y+g},p[3]={x:y[8].x+v,y:y[8].y+g};break;case 5:p[1]={x:y[2].x+v,y:y[2].y},p[3]={x:y[8].x+v,y:y[8].y};break;case 6:p[0]={x:y[0].x+v,y:y[0].y},p[2]={x:y[6].x+v,y:y[6].y+g},p[3]={x:y[8].x,y:y[8].y+g};break;case 7:p[2]={x:y[6].x,y:y[6].y+g},p[3]={x:y[8].x,y:y[8].y+g};break;case 8:p[1]={x:y[2].x+v,y:y[2].y},p[2]={x:y[6].x,y:y[6].y+g},p[3]={x:y[8].x+v,y:y[8].y+g}}}else if(h===et){for(var w=p.map(function(t,e){return Gn(Gn({},t),{},{index:e})}).filter(function(t){return t.canMove}),x=void 0,T=void 0,E=0;E<w.length-1;E++){if(0===s){x=w[w.length-1].index,T=w[1].index;break}if(s===w[w.length-1].index){x=w[w.length-2].index,T=w[0].index;break}if(s===w[E].index){x=w[E-1].index,T=w[E+1].index;break}}if(!x&&0!==x||!T&&0!==T)return;var C=p[x],_=p[T],O=p[s],R=P(_,O,{x:n,y:o}),I=P(C,O,{x:n,y:o}),k=S({x:n,y:o},_)/S(O,_),D=S({x:n,y:o},C)/S(O,C);r.points=p.map(function(t,e){if(0===s&&e>=s&&e<=T||s===w[w.length-1].index&&e>=s&&e>=T||0!==s&&s!==w[w.length-1].index&&e>=s&&e<=T){if(k===1/0)return Gn(Gn({},t),i.viewerElementToImageCoordinates(_.x,_.y));var n=b(_,t,180*R/Math.PI);return Gn(Gn({},t),i.viewerElementToImageCoordinates((n.x-_.x)*k+_.x,(n.y-_.y)*k+_.y))}if(0===s&&e>=x||s===w[w.length-1].index&&e<=s&&e>=x||0!==s&&s!==w[w.length-1].index&&e>=x&&e<=s){if(D===1/0)return Gn(Gn({},t),i.viewerElementToImageCoordinates(C.x,C.y));var o=b(C,t,180*I/Math.PI);return Gn(Gn({},t),i.viewerElementToImageCoordinates((o.x-C.x)*D+C.x,(o.y-C.y)*D+C.y))}return Gn(Gn({},t),i.viewerElementToImageCoordinates(t.x,t.y))})}else h===it||h===rt?4===s&&(p[0]={x:f.x+v,y:f.y+g},p[1]={x:f.x+v,y:f.y+g}):h===nt?4===s?(p[0]={x:f.x+v,y:f.y+g},p[1]={x:f.x+v,y:f.y+g}):0===s||2===s?r.lineWidth-=g/u:6!==s&&8!==s||(r.lineWidth+=g/u):h===ot&&(4===s?(p[0]={x:f.x+v,y:f.y+g},p[1]={x:f.x+v,y:f.y+g}):0===s||2===s?r.lineWidth-=g/u:6!==s&&8!==s||(r.lineWidth+=g/u,p[1]={x:f.x,y:f.y+g},p[0]={x:f.x,y:f.y+g}));h!==et&&(r.points=this.viewerElementToImagePoints(p)),r.region=m(r.points),this.mitt.$emit(oi,r),this.lastPoint={x:n,y:o}}}}},{key:"drawThumbPoints",value:function(t,e){var i,n=this;if(!1!==this.options.thumb.show){var o=null===(i=this.movePoint)||void 0===i?void 0:i.position;ct.includes(e)?(this.drawPoint(t[0],1===o),this.drawPoint({x:(t[0].x+t[1].x)/2,y:(t[0].y+t[1].y)/2},4===o),this.drawPoint(t[1],7===o)):e===Q?this.drawLines(c(t),o):lt.includes(e)?c(t).forEach(function(t,e){n.drawPoint(t,o===e)}):e===et?t.forEach(function(t,e){t.canMove&&n.drawPoint(t,o===e)}):e===it||e===rt?this.drawPoint(t[0],4===o):e!==nt&&e!==ot||l(t[0],t[1]).forEach(function(t,e){0!==e&&2!==e&&4!==e&&6!==e&&8!==e||n.drawPoint(t,o===e)})}}},{key:"change",value:function(){this.clearCanvas(),this.showLabelMeasure();var t=this.labelList.find(function(t){return t.select});if(t&&!1!==t.show){var e=this.imageToViewerElementPoints(t.points),i=e[0],n=this.getImageZoom(!0)/t.scale;if(ut.includes(t.tool))if(t.tool===it){var o=this.getFontWidth(t.text,t.fontSize),r=b(i,{x:i.x+o/2*n,y:i.y-t.fontSize/2*n+4},t.angle);this.drawThumbPoints([r],t.tool)}else if(t.tool===nt){var s=t.lineWidth*n;this.drawThumbPoints([{x:i.x-s,y:i.y-s},{x:i.x+s,y:i.y+s}],t.tool)}else if(t.tool===rt)this.drawThumbPoints([{x:i.x,y:i.y}],t.tool);else if(t.tool===ot){var a=t.lineWidth*n;this.drawThumbPoints([{x:i.x,y:i.y-a},{x:i.x+a,y:i.y}],t.tool)}else t.tool===et&&(this.draging?this.drawThumbPoints(e,t.tool):this.drawThumbPoints(this.setPointsMove(t,e),t.tool));else this.drawThumbPoints(this.imageToViewerElementPoints(t.points),t.tool);this[t.tool].setContent(this.canvas,Gn({},t))}}},{key:"showLabelMeasure",value:function(){var t=this,e=this.viewport.viewportToImageRectangle(this.viewport.getBoundsNoRotate()),i=this.getImageZoom(!0)*this.options.scale;this.labelList.forEach(function(n){!1!==n.show&&t.isInCanvas(n.region,e)&&(t.labelDrawingFunc(n),!1!==n.measure&&(n.select||i>=t.options.measure.scale&&t.options.measure.defaultShow)&&t[n.tool].drawMeasureInfo.call(t,n,t.getMeasureContent(n)))})}},{key:"labelDrawingFunc",value:function(t){var e,i;(this.options.labelDrawing||(null===(e=this.options.label)||void 0===e?void 0:e.drawing))&&((null===(i=this.options.label)||void 0===i?void 0:i.drawing)||this.options.labelDrawing)(this.canvas,t,this.imageToViewerElementRectangle(t.region))}},{key:"setPointsMove",value:function(t,e){var i,n=e[0],o=(null===(i=this.options.label)||void 0===i?void 0:i.polygonWidth)||30;return e.forEach(function(i,r){i.canMove=!1,t.points[r].canMove=!1,0!==r&&(f(n,i,o)||f(e[0],i,o))&&r!==e.length-1||(n=i,i.canMove=!0,t.points[r].canMove=!0)}),e}}],n&&qn(i.prototype,n),o&&qn(i,o),Object.defineProperty(i,"prototype",{writable:!1}),s}(xt);var to=function t(){var e,i,n,o,r,s,a,l=this,c=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),c||(c={}),this.id=c.id,this.parent_id=c.parent_id,this.lineWidth=c.lineWidth?c.lineWidth:c.tool===nt?15:c.tool===ot?30:c.tool===rt?10:2,this.strokeStyle=c.strokeStyle||"#027AFF",this.fillStyle=c.fillStyle,this.description=c.description,this.fontSize=c.fontSize||14,this.text=c.text,this.angle=null!==(e=c.angle)&&void 0!==e?e:0,this.measure=c.measure,this.points=c.points,this.tool=c.tool,this.src=c.src,this.scale=c.scale,this.region=c.region,this.move=c.move,this.resize=c.resize,this.isROI=null!==(i=c.isROI)&&void 0!==i&&i,this.isClose=null===(n=c.isClose)||void 0===n||n,this.custom=null!==(o=c.custom)&&void 0!==o&&o,this.select=null!==(r=c.select)&&void 0!==r&&r,this.show=null===(s=c.show)||void 0===s||s,this.subType=c.subType,this.__other__=c.__other__||{},this.__data__=null!==(a=c.__data__)&&void 0!==a?a:c,this.src&&this.tool===st&&(this.img=new Image,this.img.src=this.src,this.imgLoadSuccess=!1,this.img.onload=function(){l.imgLoadSuccess=!0})};function eo(t){return eo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},eo(t)}function io(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function no(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?io(Object(i),!0).forEach(function(e){oo(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):io(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function oo(t,e,i){return(e=so(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function ro(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,so(n.key),n)}}function so(t){var e=function(t,e){if("object"!=eo(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=eo(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==eo(e)?e:e+""}function ao(t,e){return ao=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ao(t,e)}function lo(t){var e=co();return function(){var i,n=uo(t);if(e){var o=uo(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return function(t,e){if(e&&("object"==eo(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,i)}}function co(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(co=function(){return!!t})()}function uo(t){return uo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},uo(t)}var ho=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ao(t,e)}(s,t);var i,n,o,r=lo(s);function s(t){var i,n=t.viewer,o=t.canvas,a=t.cache,l=t.options;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),i=r.call(this,n,o,a,l),pt.forEach(function(t){i[t]=new e[t]}),i.ROIList=[],i.points=[],i.tool=void 0,i.isInDraw=!1,i}return i=s,n=[{key:"startDraw",value:function(t){if(!t.tool)throw new Error("options.tool must not bu null");if("curve"===t.tool)throw new Error("Curve is obsolete. Please use polygon instead");if(!pt.includes(t.tool))throw new Error("".concat(t.tool," is not a effective drawing tool"));this.viewer.canvas.focus(),this.points=[],this.tool=t.tool,this[this.tool].setContent(this.canvas,no(no({strokeStyle:"#027AFF",fillStyle:"",description:"",text:"",measure:!0,clear:!0,isClose:!0,enableDbClickClose:!0},t),{},{lineWidth:t.lineWidth?t.lineWidth:this.tool===nt?15:this.tool===ot?30:this.tool===rt?10:2,tool:void 0})),this.isInDraw=!0}},{key:"updateOptions",value:function(t){if(!t.tool)throw new Error("options.tool must not bu null");if("curve"===t.tool)throw new Error("Curve is obsolete. Please use polygon instead");if(!pt.includes(t.tool))throw new Error("".concat(t.tool," is not a effective drawing tool"));this.viewer.canvas.focus(),this.tool=t.tool,this[this.tool].setContent(this.canvas,no(no({strokeStyle:"#027AFF",fillStyle:"",description:"",text:"",measure:!0,clear:!0,isClose:!0,enableDbClickClose:!0},t),{},{lineWidth:t.lineWidth?t.lineWidth:this.tool===nt?15:this.tool===ot?30:this.tool===rt?10:2,tool:void 0}))}},{key:"setLabelList",value:function(t){this.ROIList=t.filter(function(t){return t.isROI})}},{key:"onCanvasPress",value:function(t){var e=t.x,i=t.y,n=this.viewerElementToImageCoordinates(e,i);if(!this.isInROI(n))return this.points=[],void this.clearCanvas();var o=this.tool;o===et?this.points.push(n):lt.includes(o)?this.points=[n,n,n,n]:this.points=[n],this.clearCanvas(),this[o].startDraw();var r=this.imageToViewerElementPoints(this.points);this[o].draw(r),this[o].endDraw(),this[o].drawPoints(r,{radius:this.options.thumb.radius,strokeStyle:this.options.thumb.color,fillStyle:this.options.thumb.bgColor}),this.mitt.$emit(Ye,this.getPaintOptions())}},{key:"onCanvasDrag",value:function(t){var e=t.position,i=e.x,n=e.y,o=this.viewerElementToImageCoordinates(i,n);if(!this.isInROI(o))return this.points=[],void this.clearCanvas();t.preventDefaultAction=!0;var r=this.tool;if(lt.includes(r)){var s=this.imageToViewerElementCoordinates(this.points[0].x,this.points[0].y);this.points=this.viewerElementToImagePoints(T([s,{x:i,y:n}]))}else ut.includes(r)?r===et?(this.points.push(o),this.setEnablePoints(!1)):at.includes(r)&&(this.points=[o,o]):this.points=[this.points[0]||o,o];this.clearCanvas(),this[r].startDraw();var a=this.imageToViewerElementPoints(this.points);this[r].draw(a),this[r].endDraw(),this[r].drawPoints(a,{radius:this.options.thumb.radius,strokeStyle:this.options.thumb.color,fillStyle:this.options.thumb.bgColor}),this.mitt.$emit(Je,this.getPaintOptions())}},{key:"onCanvasRelease",value:function(t){var e=t.x,i=t.y,n=this.viewerElementToImageCoordinates(e,i);if(!this.isInROI(n)||0===this.points.length)return this.points=[],void this.clearCanvas();var o=this.tool;if(ut.includes(o)){if(at.includes(o))this.points=[n,n];else if(o===et){var r=this.imageToViewerElementCoordinates(this.points[0].x,this.points[0].y),s=this[this.tool].options.enableDbClickClose,a=this[this.tool].options.isClose;if(s){if(!a||!f(r,{x:e,y:i}))return;if(this.setEnablePoints(),this.points.length<5)return}else if(this.setEnablePoints(),this.points.length<5)return this.points=[],void this.clearCanvas()}}else{var l=S(this.imageToViewerElementCoordinates(this.points[0].x,this.points[0].y),{x:e,y:i});if(Math.abs(l)<10)return this.points=[],void this.clearCanvas()}this.mitt.$emit(Qe,this.getPaintOptions()),this[this.tool].options.once?this.endDraw():this[this.tool].options.clear&&(this.points=[],this.clearCanvas())}},{key:"onCanvasDblClick",value:function(t){var e=t.x,i=t.y,n=this.viewerElementToImageCoordinates(e,i);return this.isInROI(n)&&0!==this.points.length?this.tool===et&&(this.setEnablePoints(),this.points.length<5)?(this.points=[],void this.clearCanvas()):(this.mitt.$emit(Qe,this.getPaintOptions()),void(this[this.tool].options.once?(this.mitt.$emit(ti,this.getPaintOptions()),this.endDraw()):this[this.tool].options.clear&&(this.points=[],this.clearCanvas()))):(this.points=[],void this.clearCanvas())}},{key:"onCanvasMove",value:function(t){var e=t.target,i=t.x,n=t.y,o=e.getBoundingClientRect(),r=o.left,s=o.top,a=this.viewerElementToImageCoordinates(i-r,n-s);if(!this.isInROI(a))return this.points=[],void this.clearCanvas();var l=this.tool;if(l===et&&this.points.length>0){this.points.length>1&&this.points.pop(),this.points.push(a),this.clearCanvas(),this[l].startDraw();var c=this.imageToViewerElementPoints(this.points);this[l].draw(c),this[l].endDraw(),this[l].drawPoints(c,{radius:this.options.thumb.radius,strokeStyle:this.options.thumb.color,fillStyle:this.options.thumb.bgColor}),this.mitt.$emit(Je,this.getPaintOptions())}}},{key:"onCanvasKey",value:function(t){var e=t.originalEvent;"Escape"===e.key&&this.isInDraw&&(this.mitt.$emit(ti,this.getPaintOptions()),this.endDraw()),"Delete"!==e.key&&"Backspace"!==e.key||this.tool===et&&this.points.length>1&&(this.points.splice(this.points.length-2,1),this.change())}},{key:"setEnablePoints",value:function(){var t,e=this,i=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n=this.imageToViewerElementPoints(this.points),o=n[0],r=(null===(t=this.options.label)||void 0===t?void 0:t.polygonWidth)||30;if(this.points=this.points.filter(function(t,i){var s=n[i];if(0===i)return!0;if(i===e.points.length-1)return!0;if(f(o,s,r)){var a=n[i+1];return!!a&&180*Math.abs(P(s,o,a))/Math.PI<90&&(o=s,!0)}return o=s,!0}),i&&this.points.length>1){var s=this.points[this.points.length-1],a=this.points[this.points.length-2];f(this.imageToViewerElementCoordinates(s.x,s.y),this.imageToViewerElementCoordinates(a.x,a.y))&&this.points.splice(this.points.length-2,1)}}},{key:"getPaintOptions",value:function(){var t=new to(no(no({},this[this.tool].options),{},{points:this.points,scale:this.getImageZoom(!0),region:m(this.points),tool:this.tool,angle:this.viewport.getRotation()%360}));return t.measure&&this[this.tool].drawMeasureInfo.call(this,t,this.getMeasureContent(no(no({},t),{},{select:!0}))),t}},{key:"isInROI",value:function(t){return this.options.ROI?this[this.tool].options.isROI||this.isContainerLabel(t,this.ROIList):!(this.ROIList.length>0)||this[this.tool].options.isROI||this.isContainerLabel(t,this.ROIList)}},{key:"clearCanvas",value:function(){var t,e;null==this||null===(t=this[this.tool])||void 0===t||null===(e=t.clearCanvas)||void 0===e||e.call(t)}},{key:"endDraw",value:function(){this.clearCanvas(),this.points=[],this.tool=void 0,this.isInDraw=!1}},{key:"change",value:function(){if(this.isInDraw&&0!==this.points.length){var t=this.imageToViewerElementPoints(this.points);this.clearCanvas(),this[this.tool].startDraw(),this[this.tool].draw(t),this[this.tool].endDraw(),this[this.tool].drawPoints(t,{radius:this.options.thumb.radius,strokeStyle:this.options.thumb.color,fillStyle:this.options.thumb.bgColor}),this.mitt.$emit(Je,this.getPaintOptions())}}}],n&&ro(i.prototype,n),o&&ro(i,o),Object.defineProperty(i,"prototype",{writable:!1}),s}(xt);i(173);function po(t){return po="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},po(t)}function fo(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,vo(n.key),n)}}function vo(t){var e=function(t,e){if("object"!=po(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=po(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==po(e)?e:e+""}function go(t,e){return go=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},go(t,e)}function mo(t){var e=yo();return function(){var i,n=wo(t);if(e){var o=wo(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return function(t,e){if(e&&("object"==po(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,i)}}function yo(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(yo=function(){return!!t})()}function wo(t){return wo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},wo(t)}var xo=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&go(t,e)}(r,t);var e,i,n,o=mo(r);function r(t){var e,i=t.viewer,n=t.canvas,s=t.cache,a=t.options;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),(e=o.call(this,i,n,s,a)).microns=a.microns||[5e3,2e3,1500,1250,1e3,800,500,400,250,200,150,125,100,80,60,40,20,10,8,5,4,2,1],e}return e=r,i=[{key:"change",value:function(){var t=this.microns,e=this.viewerElementToImageCoordinates(0,0),i=this.viewerElementToImageCoordinates(50,0).distanceTo(e)*this.options.imageCapRes,n=this.microns.findIndex(function(t){return t<=i});~n?this.setScaleLine(t[n],t[n]/this.options.imageCapRes):this.setScaleLine(t[t.length-1],t[t.length-1]/this.options.imageCapRes)}},{key:"setScaleLine",value:function(t,e){var i=this.imageToViewerElementCoordinates(0,0),n=this.imageToViewerElementCoordinates(e,0).distanceTo(i);this.options.custom?this.mitt.$emit(gi,{width:n,txt:t}):this.paintGraduation({width:n,txt:t})}},{key:"paintGraduation",value:function(t){var e=this,i=t.width,n=t.txt,o=this.canvas.getContext("2d"),r=this.canvas.width,s=this.canvas.height;if(o.beginPath(),o.clearRect(0,0,r,s),this.options.show){var a=this.options,l=a.left,c=a.top,u=a.right,h=a.bottom,p=10,d=s-10;l?p=l:u&&(p=r-u-i),c?d=c:h&&(d=s-h),o.beginPath(),o.strokeStyle="#000000",o.lineWidth=3,o.fillStyle="#000000",o.font="bold 14px Arial";var f=this.options.tick||{height:8,number:5},v=this.getUnitIndex(n*f.number,this.options.units,this.options.binary),g=_(n*f.number,this.options.units,this.options.binary,v),m=o.measureText(g).width;o.fillText(g,p+i*f.number-m/2,d+20),new Array(f.number).fill(1).forEach(function(t,r){o.moveTo(p+i*r,d-f.height),o.lineTo(p+i*r,d),o.lineTo(p+i*(r+1),d),o.lineTo(p+i*(r+1),d-f.height);var s=_(n*r,e.options.units,e.options.binary,v).replace(e.options.units[v],""),a=o.measureText(s).width;o.fillText(s,p+i*r-a/2,d+20)}),o.stroke()}}},{key:"getUnitIndex",value:function(t,e,i){for(var n=t,o=0;n>=i;)n/=i,o++;return e[o]||(o=e.length-1),o}}],i&&fo(e.prototype,i),n&&fo(e,n),Object.defineProperty(e,"prototype",{writable:!1}),r}(xt);function bo(t){return bo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},bo(t)}function To(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Po(n.key),n)}}function Po(t){var e=function(t,e){if("object"!=bo(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=bo(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==bo(e)?e:e+""}function So(t,e){return So=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},So(t,e)}function Eo(t){var e=Co();return function(){var i,n=_o(t);if(e){var o=_o(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return function(t,e){if(e&&("object"==bo(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,i)}}function Co(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Co=function(){return!!t})()}function _o(t){return _o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_o(t)}var Oo=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&So(t,e)}(r,t);var e,i,n,o=Eo(r);function r(t){var e,i=t.viewer,n=t.canvas,s=t.cache,a=t.options;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),(e=o.call(this,i,n,s,a)).options.scale||(e.options.scale=20),e}return e=r,i=[{key:"change",value:function(){var t=this.viewerElementToImageCoordinates(0,0),e=this.viewerElementToImageCoordinates(this.canvas.width,0),i=this.viewerElementToImageCoordinates(0,this.canvas.height),n=this.getImageZoom(!0)*this.options.scale,o=this.options.pxConversion?this.options.imageCapRes:1,r=Math.pow(this.options.binary,this.options.unitsIndex||0),s=40===this.options.scale?this.options.pxConversion?1600/this.options.imageCapRes:3200:this.options.pxConversion?800/this.options.imageCapRes:1600,a=0;if(n>=1){for(;n/2>=1;)a++,n/=2;a&&(s/=Math.pow(2,a))}else if(n<1){for(;2*n<=1;)a++,n*=2;a&&(s*=Math.pow(2,a))}var l=e.distanceTo(t),c=i.distanceTo(t),u=Math.floor(t.x/s),h=Math.floor((e.x+l)/s),p=Math.floor(t.y/s),d=Math.floor((i.y+c)/s),f=this.canvas.getContext("2d");if(f.clearRect(0,0,this.canvas.width,this.canvas.height),this.options.show){f.beginPath(),f.lineWidth=1;for(var v=u;v<=h+1;v++){var g=this.imageToViewerElementCoordinates(v*s,0);f.moveTo(g.x,0),f.lineTo(g.x,this.canvas.height)}for(var m=p;m<=d+1;m++){var y=this.imageToViewerElementCoordinates(0,m*s);f.moveTo(0,y.y),f.lineTo(this.canvas.width,y.y)}f.stroke()}if(this.options.ruler){var w=this.imageToViewerElementCoordinates(s,0).minus(this.imageToViewerElementCoordinates(0,0)).x;f.beginPath(),f.font="14px Arial",f.fillStyle="#fff",f.fillRect(0,0,20,this.canvas.height),f.fillRect(0,0,this.canvas.width,20),f.beginPath(),f.fillStyle="rgba(0, 0, 0, .3)",f.strokeStyle="rgba(0, 0, 0, .8)",f.moveTo(20,20),f.lineTo(20,this.canvas.height),f.moveTo(20,20),f.lineTo(this.canvas.width,20);for(var x=u;x<=h+1;x++){var b=this.imageToViewerElementCoordinates(x*s,0);f.moveTo(b.x,0),f.lineTo(b.x,20);for(var T=1;T<5;T++)f.moveTo(b.x+w/5*T,16),f.lineTo(b.x+w/5*T,20),x!==u&&f.fillText((x*s*o/r).toFixed(2)/1,b.x+5,13)}for(var P=p;P<=d+1;P++){var S=this.imageToViewerElementCoordinates(0,P*s);f.moveTo(0,S.y),f.lineTo(20,S.y);for(var E=1;E<5;E++)f.moveTo(16,S.y+w/5*E),f.lineTo(20,S.y+w/5*E),P!==p&&(f.save(),f.translate(3,S.y+5),f.rotate(Math.PI/2),f.fillText((P*s*o/r).toFixed(0),0,0),f.restore())}f.stroke(),f.beginPath(),f.fillStyle="#fff",f.fillRect(0,0,20,20)}}}],i&&To(e.prototype,i),n&&To(e,n),Object.defineProperty(e,"prototype",{writable:!1}),r}(xt);function Ro(t){return Ro="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ro(t)}function Io(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ko(n.key),n)}}function ko(t){var e=function(t,e){if("object"!=Ro(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Ro(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ro(e)?e:e+""}function Do(t){return function(t){if(Array.isArray(t))return Mo(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Mo(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Mo(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Mo(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}CanvasRenderingContext2D.prototype.clearArc=function(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2*Math.PI;this.beginPath(),this.save(),this.arc(t,e,i,n,o),this.clip(),this.clearRect(t-i,e-i,2*i,2*i),this.restore(),this.closePath()},CanvasRenderingContext2D.prototype.drawArrow=function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:30,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10,o=180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI,r=(o+i)*Math.PI/180,s=(o-i)*Math.PI/180,a=n*Math.cos(r),l=n*Math.sin(r),c=n*Math.cos(s),u=n*Math.sin(s),h=t.x-a,p=e.y-l;this.moveTo(h,p),this.moveTo(t.x,t.y),this.lineTo(e.x,e.y),h=e.x+a,p=e.y+l,this.moveTo(h,p),this.lineTo(e.x,e.y),h=e.x+c,p=e.y+u,this.lineTo(h,p)},CanvasRenderingContext2D.prototype.drawOval=function(t,e,i,n){var o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.save();var r=i>n?i:n,s=i/r,a=n/r;this.scale(s,a),this.moveTo((t+i)/s,e/a),this.arc(t/s,e/a,r,0,2*Math.PI,o),this.closePath(),this.restore()},CanvasRenderingContext2D.prototype.drawPolygon=function(t){for(var e=this,i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=Do(t),r=0,s=0;s<t.length-1;s++)r+=-.5*(t[s+1].y+t[s].y)*(t[s+1].x-t[s].x);r>0?n&&o.reverse():n||o.reverse(),this.moveTo(o[0].x,o[0].y),o.forEach(function(t){e.lineTo(t.x,t.y)}),i&&this.lineTo(o[0].x,o[0].y)};var jo=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.points=e}var e,i,n;return e=t,i=[{key:"calculationPoint",value:function(t){var e=this,i=this.points.length-1,n={x:0,y:0};return this.points.forEach(function(o,r){r?(n.x+=e.factorial(i)/e.factorial(r)/e.factorial(i-r)*o.x*Math.pow(1-t,i-r)*Math.pow(t,r),n.y+=e.factorial(i)/e.factorial(r)/e.factorial(i-r)*o.y*Math.pow(1-t,i-r)*Math.pow(t,r)):(n.x+=o.x*Math.pow(1-t,i-r)*Math.pow(t,r),n.y+=o.y*Math.pow(1-t,i-r)*Math.pow(t,r))}),n}},{key:"factorial",value:function(t){return t<=1?1:t*this.factorial(t-1)}}],i&&Io(e.prototype,i),n&&Io(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();CanvasRenderingContext2D.prototype.bezierCurve=function(){if(1===arguments.length){var t=arguments.length<=0?void 0:arguments[0];if(!Array.isArray(t))throw new SyntaxError("parameter error");if(1===t.length||0===t.length)throw new SyntaxError("Parameter length greater than 1");if(2===t.length&&(this.moveTo(t[0].x,t[0].y),this.lineTo(t[1].x,t[1].y),this.stroke()),3===t.length){var e=t[0];this.moveTo(e.x,e.y),this.quadraticCurveTo(t[1].x,t[1].y,t[2].x,t[2].y),this.stroke()}else if(4===t.length){var i=t[0];this.moveTo(i.x,i.y),this.bezierCurveTo(t[1].x,t[1].y,t[2].x,t[2].y,t[3].x,t[3].y),this.stroke()}else for(var n=new jo(t),o=Do(new Array(101)).map(function(t,e){return n.calculationPoint(e/100)}),r=1;r<101;r++)this.moveTo(o[r-1].x,o[r-1].y),this.lineTo(o[r].x,o[r].y),this.stroke()}else if(4===arguments.length)this.quadraticCurveTo(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2],arguments.length<=3?void 0:arguments[3]);else{if(6!==arguments.length)throw new SyntaxError("parameter error");this.bezierCurveTo(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2],arguments.length<=3?void 0:arguments[3],arguments.length<=4?void 0:arguments[4],arguments.length<=5?void 0:arguments[5])}},CanvasRenderingContext2D.prototype.drawConfirm=function(){this.save(),this.miterLimit=4,this.scale(.046875,.046875),this.save(),this.beginPath(),this.moveTo(836.266667,311.466667),this.lineTo(806.4,281.59999999999997),this.bezierCurveTo(797.866667,273.06666699999994,785.0666669999999,273.06666699999994,776.533333,281.59999999999997),this.lineTo(435.2,622.933333),this.bezierCurveTo(430.933333,627.1999999999999,430.933333,627.1999999999999,426.66666699999996,622.933333),this.lineTo(264.53333399999997,460.79999999999995),this.bezierCurveTo(256.00000099999994,452.2666669999999,243.20000099999996,452.2666669999999,234.66666699999996,460.79999999999995),this.lineTo(204.79999999999995,490.66666699999996),this.bezierCurveTo(196.26666699999996,499.2,196.26666699999996,511.99999999999994,204.79999999999995,520.533334),this.lineTo(422.4,738.133334),this.bezierCurveTo(426.66666699999996,742.400001,435.2,742.400001,439.466667,738.133334),this.lineTo(836.266667,341.333333),this.bezierCurveTo(844.8,332.8,844.8,320,836.266667,311.466667),this.closePath(),this.fill(),this.stroke(),this.restore(),this.restore()},CanvasRenderingContext2D.prototype.drawCancel=function(){this.save(),this.miterLimit=4,this.scale(.046875,.046875),this.save(),this.beginPath(),this.moveTo(768,307.552),this.lineTo(716.448,256),this.lineTo(512,460.448),this.lineTo(307.552,256),this.lineTo(256,307.552),this.lineTo(460.448,512),this.lineTo(256,716.448),this.lineTo(307.552,768),this.lineTo(512,563.552),this.lineTo(716.448,768),this.lineTo(768,716.448),this.lineTo(563.552,512),this.lineTo(768,307.552),this.closePath(),this.fill(),this.stroke(),this.restore(),this.restore()};var Lo=function(t){var e=Object.prototype.toString;return t instanceof Element?"element":{"[object Boolean]":"boolean","[object Number]":"number","[object String]":"string","[object Function]":"function","[object Array]":"array","[object Date]":"date","[object RegExp]":"regExp","[object Undefined]":"undefined","[object Null]":"null","[object Object]":"object"}[e.call(t)]},Ao=function t(e){var i="array"===Lo(e)?[]:{};for(var n in e)e.hasOwnProperty(n)&&(e[n]&&"object"===Lo(e[n])||e[n]&&"array"===Lo(e[n])?i[n]=t(e[n]):e[n]&&"date"===Lo(e[n])?i[n]=new Date(e[n].valueOf()):i[n]=e[n]);return i};var Bo="shape",No="area",zo="board",Ho="graduation",Fo="rotation",Wo="tailoring",Vo="navigator",Uo="cache",Go="grid";function Zo(t){return Zo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zo(t)}function qo(t){return function(t){if(Array.isArray(t))return $o(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return $o(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?$o(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $o(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function Xo(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function Ko(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Xo(Object(i),!0).forEach(function(e){Yo(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Xo(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function Yo(t,e,i){return(e=Qo(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Jo(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Qo(n.key),n)}}function Qo(t){var e=function(t,e){if("object"!=Zo(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Zo(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Zo(e)?e:e+""}function tr(t,e){return tr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},tr(t,e)}function er(t){var e=nr();return function(){var i,n=or(t);if(e){var o=or(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return function(t,e){if(e&&("object"==Zo(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return ir(t)}(this,i)}}function ir(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function nr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(nr=function(){return!!t})()}function or(t){return or=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},or(t)}var rr=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&tr(t,e)}(a,t);var e,i,n,s=er(a);function a(t){var e,i;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),e=s.call(this),!t.el)throw new Error("el must not be null");if(!t.openSeadragonOptions)throw new Error("no openSeadragon options");if("string"===Lo(t.el)&&(e.$el=(i=t.el,document.querySelector(i))),"element"===Lo(t.el)&&(e.$el=t.el),!e.$el)throw new Error("el is not a valid selector string or element object");e.$el.style.position="relative";var n=e.$el.getBoundingClientRect(),l=n.height,c=n.width;return e.$options=Ko(Ko({},t),{},{width:c,height:l}),e.mitt={$on:e.$on,$emit:e.$emit,$off:e.$off,$once:e.$once,key:e.key,eventList:e.eventList},function(t){var e=Ko(Ko(Ko({},{showNavigationControl:!1,navigatorSizeRatio:.25,wrapHorizontal:!1,minScrollDeltaTime:10,zoomPerClick:1,gestureSettingsMouse:{clickToZoom:!1}}),t.$options.openSeadragonOptions),{},{element:t.$el});t.viewer=X()(e),t.viewer.addHandler("tile-drawing",function(e){if("function"===Lo(t.$options.tileDrawing))t.$options.tileDrawing(e);else{var i=e.context,n=e.rendered,o=e.sourceWidth,r=e.sourceHeight,s=e.position,a=e.size;i.drawImage(n.canvas,0,0,o,r,s.x,s.y,a.x,a.y)}})}(ir(e)),function(t){var e=t.$options;Object.values(r).forEach(function(i){var n=i[0].toLocaleUpperCase()+i.substring(1);i===Vo?function(t){var e=t.$options;if(e.navigator=e.navigator||{disabled:!1},!0!==e.navigator.disabled){e.navigator.style||(e.navigator.style="bottom: 0;left: 0;");var i=document.createElement("div");i.setAttribute("class","openseadragon-navigator"),i.style.cssText+=e.navigator.style,t.viewer.container.appendChild(i),t.navigator=new hn(Ko({viewer:t.viewer,containerHeight:e.height,containerWidth:e.width,element:i,scale:e.scale,mitt:t.mitt},e.navigator))}}(t):i===Uo?t.cache=new o[n]:(e[i]=e[i]||{disabled:!1},!0!==e[i].disabled&&(t[i]=new o[n](function(t,e){var i,n,o=t.$options,r=o.pxConversion||{imageCapRes:1,units:[]};return{kv:t,viewer:t.viewer,cache:t.cache,canvas:sr(t),options:Ko(Ko(Ko({mitt:t.mitt,scale:o.scale,lang:o.lang,labelDrawing:o.labelDrawing,label:o.label||{},measure:Ko({backgroundColor:"rgba(0,0,0,.5)",color:"#FFF",fontSize:14,scale:10,defaultShow:!1},o.measure||{})},o[e]),r),{},{units:null!==(i=r.units)&&void 0!==i?i:[null!==(n=r.unit)&&void 0!==n?n:""],thumb:o.thumb?Ko({radius:5,activeRadius:7,activeBgColor:"#01d0b0"},o.thumb):{radius:5,activeRadius:7,activeBgColor:"#01d0b0"}})}}(t,i))))})}(ir(e)),function(t){t.viewer.addHandler("animation",function(){var e;t.change(),(null===(e=t.tailoring)||void 0===e?void 0:e.isInTailoring)&&t.tailoring.emitTailoringRegion()}),t.viewer.addHandler("canvas-press",function(e){var i,n,o,r;(null===(i=t.board)||void 0===i?void 0:i.isInDraw)?t.board.onCanvasPress(e.position):(null===(n=t.rotation)||void 0===n?void 0:n.isInRotation)?t.rotation.onCanvasPress(e.position):(null===(o=t.tailoring)||void 0===o?void 0:o.isInTailoring)?t.tailoring.onCanvasPress(e.position):(null===(r=t.area)||void 0===r?void 0:r.onCanvasPress)&&t.area.onCanvasPress(e.position)}),t.viewer.addHandler("canvas-drag",function(e){var i,n,o,r;if(null===(i=t.board)||void 0===i?void 0:i.isInDraw)t.board.onCanvasDrag(e);else if(null===(n=t.rotation)||void 0===n?void 0:n.rotatePoint)e.preventDefaultAction=!0,t.rotation.onCanvasDrag(e.position),t.change();else if((null===(o=t.tailoring)||void 0===o?void 0:o.movePointIndex)>-1)e.preventDefaultAction=!0,t.tailoring.onCanvasDrag(e.position);else if(null===(r=t.area)||void 0===r?void 0:r.movePoint){var s,a;t.area.onCanvasDrag(e.position,e),t.area.change(),null==t||null===(s=t.shape)||void 0===s||null===(a=s.change)||void 0===a||a.call(s)}}),t.viewer.addHandler("canvas-release",function(e){var i,n,o,r;(null===(i=t.board)||void 0===i?void 0:i.isInDraw)?t.board.onCanvasRelease(e.position):(null===(n=t.rotation)||void 0===n?void 0:n.isInRotation)?t.rotation.onCanvasRelease(e.position):(null===(o=t.tailoring)||void 0===o?void 0:o.isInTailoring)?t.tailoring.onCanvasRelease(e.position):(null===(r=t.area)||void 0===r?void 0:r.onCanvasRelease)&&t.area.onCanvasRelease(e.position)}),t.viewer.addHandler("canvas-key",function(e){var i,n,o,r,s,a,l=e.originalEvent;if(e.preventDefaultAction=t.$options.handleKey?t.$options.handleKey(l.key):(r=l.key,["Escape","Delete","Backspace","z","y"].includes(r)),function(t,e){if("z"===t.key&&t.ctrlKey){if(0===e.cache.currentIndex)return;e.cache.currentIndex--,e.$emit(ci,e.cache.currentIndex)}if("y"===t.key&&t.ctrlKey){if(e.cache.currentIndex===e.cache.cacheList.length-1)return;e.cache.currentIndex++,e.$emit(ui,e.cache.currentIndex)}}(l,t),null===(i=t.board)||void 0===i?void 0:i.isInDraw)null===(s=t.board)||void 0===s||null===(a=s.onCanvasKey)||void 0===a||a.call(s,e);else if(null===(n=t.rotation)||void 0===n?void 0:n.isInRotation){var c,u;null===(c=t.rotation)||void 0===c||null===(u=c.onCanvasKey)||void 0===u||u.call(c,e)}else if(null===(o=t.tailoring)||void 0===o?void 0:o.isInTailoring){var h,p;null===(h=t.tailoring)||void 0===h||null===(p=h.onCanvasKey)||void 0===p||p.call(h,e)}else{var d,f,v,g;!function(t,e){var i=e.labelList.findIndex(function(t){return t.select}),n=e.labelList[i];if("h"===t.key){if(!n)return;n.show=!1,e.$emit(hi,n)}else if("Delete"===t.key||"Backspace"===t.key){var o,r,s;if(!n)return;if((null===(o=e.area)||void 0===o||null===(r=o.movePoint)||void 0===r||null===(s=r.label)||void 0===s?void 0:s.tool)===et){var a=e.area.movePoint;a.label.points.splice(a.position,1),0===a.label.points.length?(e.$emit(pi,n),e.labelList.splice(i,1)):e.$emit(di,a.label),e.area.movePoint=void 0}else e.$emit(pi,n),e.labelList.splice(i,1)}else"Escape"===t.key&&(n&&e.$emit(ai,n),e.labelList.forEach(function(t){t.select=!1,t.show=!0}))}(l,t),null===(d=t.area)||void 0===d||null===(f=d.change)||void 0===f||f.call(d,e),null===(v=t.shape)||void 0===v||null===(g=v.change)||void 0===g||g.call(v,e)}}),t.viewer.addHandler("canvas-double-click",function(e){var i,n;if(null===(i=t.board)||void 0===i?void 0:i.isInDraw)t.board.onCanvasDblClick(e.position);else if(null===(n=t.tailoring)||void 0===n?void 0:n.isInTailoring){var o,r;null===(o=t.tailoring)||void 0===o||null===(r=o.onCanvasDblClick)||void 0===r||r.call(o,e.position)}else{var s,a;null===(s=t.area)||void 0===s||null===(a=s.onCanvasDblClick)||void 0===a||a.call(s,e.position)}}),t.viewer.addHandler("resize",function(e){var i=e.newContainerSize,n=i.x,o=i.y;t.resizeViewContainer({width:n,height:o})}),t.$on("mousemove",function(e){var i;(null===(i=t.board)||void 0===i?void 0:i.isInDraw)&&t.board.onCanvasMove(e)},!0,t.$el);var e,i=!1;t.viewer.addHandler("canvas-contextmenu",function(e){var i;(null===(i=t.board)||void 0===i?void 0:i.isInDraw)&&(e.preventDefault=!0)}),t.viewer.addHandler("canvas-nonprimary-press",function(t){2===t.button&&(i=!0),e=t.position.clone()}),t.viewer.addHandler("canvas-nonprimary-release",function(t){2===t.button&&(i=!1)}),new(X().MouseTracker)({element:t.viewer.canvas,moveHandler:function(n){var o,r;if(i&&(null===(o=t.board)||void 0===o?void 0:o.isInDraw)){if(2!==n.buttons)return void(i=!1);var s=n.position.minus(e);e=n.position.clone(),t.viewer.viewport.panBy(t.viewer.viewport.deltaPointsFromPixels(s.negate()))}else(null===(r=t.area)||void 0===r?void 0:r.onCanvasMove)&&t.area.onCanvasMove(n.position)}})}(ir(e)),e.initLabelList(t.labelList||[]),e.resizeViewContainer(e.$options),e}return e=a,(i=[{key:"initLabelList",value:function(t){var e,i,n,o,r,s;this.labelList=t.map(function(t){var e;if(!(null===(e=t.points)||void 0===e?void 0:e.length)){var i=y(t.region),n=i.startPoint,o=i.endPoint;t.points=[n,o]}return new to(Ko(Ko({},t),{},{region:t.region||m(t.points),__data__:Ao(t)}))}),null===(e=this.board)||void 0===e||null===(i=e.setLabelList)||void 0===i||i.call(e,this.labelList),null===(n=this.shape)||void 0===n||null===(o=n.setLabelList)||void 0===o||o.call(n,this.labelList),null===(r=this.area)||void 0===r||null===(s=r.setLabelList)||void 0===s||s.call(r,this.labelList)}},{key:"appendLabelList",value:function(t){var e,i,n,o,r,s;this.labelList=[].concat(qo(this.labelList),qo(t.map(function(t){var e;if(!(null===(e=t.points)||void 0===e?void 0:e.length)){var i=y(t.region),n=i.startPoint,o=i.endPoint;t.points=[n,o]}return new to(Ko(Ko({},t),{},{region:t.region||m(t.points),__data__:Ao(t)}))}))),null===(e=this.board)||void 0===e||null===(i=e.setLabelList)||void 0===i||i.call(e,this.labelList),null===(n=this.shape)||void 0===n||null===(o=n.setLabelList)||void 0===o||o.call(n,this.labelList),null===(r=this.area)||void 0===r||null===(s=r.setLabelList)||void 0===s||s.call(r,this.labelList)}},{key:"resizeViewContainer",value:function(t){var e=this,i=t.width,n=t.height;this.$options.width=i,this.$options.height=n,Object.values(r).forEach(function(t){var o;(null===(o=e[t])||void 0===o?void 0:o.resetCanvasSize)&&e[t].resetCanvasSize({width:i,height:n})})}},{key:"change",value:function(){var t=this;Object.values(r).forEach(function(e){var i;(null===(i=t[e])||void 0===i?void 0:i.change)&&t[e].change()})}},{key:"destroy",value:function(){var t,e,i=this;this.$off(),null===(t=this.viewer)||void 0===t||null===(e=t.destroy)||void 0===e||e.call(t),this.viewer=void 0,this.$el=void 0,Object.values(r).forEach(function(t){var e,n;null===(e=i[t])||void 0===e||null===(n=e.destroy)||void 0===n||n.call(e),i[t]=void 0})}}])&&Jo(e.prototype,i),n&&Jo(e,n),Object.defineProperty(e,"prototype",{writable:!1}),a}(Ti);function sr(t){var e=t.$options,i=document.createElement("canvas");return i.style.cssText="position: absolute; top: 0;\n left: 0; width: 100%; height: 100%;",i.width=e.width,i.height=e.height,t.viewer.canvas.appendChild(i),i}rr.marks={},pt.forEach(function(t){rr.marks[t.toLocaleUpperCase()]=t}),rr.events=Ko({},t)}(),module.exports=n}();
2
+ !function(){var t={34:function(t,e,i){var n=i(4901);t.exports=function(t){return"object"==typeof t?null!==t:n(t)}},81:function(t,e,i){var n=i(9565),r=i(9306),o=i(8551),a=i(6823),s=i(851),l=TypeError;t.exports=function(t,e){var i=arguments.length<2?s(t):e;if(r(i))return o(n(i,t));throw new l(a(t)+" is not iterable")}},113:function(t,e,i){var n=i(6518),r=i(9213).find,o=i(6469),a="find",s=!0;a in[]&&Array(1)[a](function(){s=!1}),n({target:"Array",proto:!0,forced:s},{find:function(t){return r(this,t,arguments.length>1?arguments[1]:void 0)}}),o(a)},235:function(t,e,i){var n=i(9213).forEach,r=i(4598)("forEach");t.exports=r?[].forEach:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}},283:function(t,e,i){var n=i(9504),r=i(9039),o=i(4901),a=i(9297),s=i(3724),l=i(350).CONFIGURABLE,h=i(3706),u=i(1181),c=u.enforce,p=u.get,f=String,d=Object.defineProperty,v=n("".slice),g=n("".replace),y=n([].join),m=s&&!r(function(){return 8!==d(function(){},"length",{value:8}).length}),w=String(String).split("String"),x=t.exports=function(t,e,i){"Symbol("===v(f(e),0,7)&&(e="["+g(f(e),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),i&&i.getter&&(e="get "+e),i&&i.setter&&(e="set "+e),(!a(t,"name")||l&&t.name!==e)&&(s?d(t,"name",{value:e,configurable:!0}):t.name=e),m&&i&&a(i,"arity")&&t.length!==i.arity&&d(t,"length",{value:i.arity});try{i&&a(i,"constructor")&&i.constructor?s&&d(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(r){}var n=c(t);return a(n,"source")||(n.source=y(w,"string"==typeof e?e:"")),t};Function.prototype.toString=x(function(){return o(this)&&p(this).source||h(this)},"toString")},287:function(t,e,i){i(6518)({target:"Object",stat:!0},{setPrototypeOf:i(2967)})},298:function(t,e,i){var n=i(2195),r=i(5397),o=i(8480).f,a=i(7680),s="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return s&&"Window"===n(t)?function(t){try{return o(t)}catch(e){return a(s)}}(t):o(r(t))}},350:function(t,e,i){var n=i(3724),r=i(9297),o=Function.prototype,a=n&&Object.getOwnPropertyDescriptor,s=r(o,"name"),l=s&&"something"===function(){}.name,h=s&&(!n||n&&a(o,"name").configurable);t.exports={EXISTS:s,PROPER:l,CONFIGURABLE:h}},397:function(t,e,i){var n=i(7751);t.exports=n("document","documentElement")},421:function(t){t.exports={}},511:function(t,e,i){var n=i(9167),r=i(9297),o=i(1951),a=i(4913).f;t.exports=function(t){var e=n.Symbol||(n.Symbol={});r(e,t)||a(e,t,{value:o.f(t)})}},540:function(t){t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},566:function(t,e,i){var n=i(9504),r=i(9306),o=i(34),a=i(9297),s=i(7680),l=i(616),h=Function,u=n([].concat),c=n([].join),p={};t.exports=l?h.bind:function(t){var e=r(this),i=e.prototype,n=s(arguments,1),l=function(){var i=u(n,s(arguments));return this instanceof l?function(t,e,i){if(!a(p,e)){for(var n=[],r=0;r<e;r++)n[r]="a["+r+"]";p[e]=h("C,a","return new C("+c(n,",")+")")}return p[e](t,i)}(e,i.length,i):e.apply(t,i)};return o(i)&&(l.prototype=i),l}},597:function(t,e,i){var n=i(9039),r=i(8227),o=i(9519),a=r("species");t.exports=function(t){return o>=51||!n(function(){var e=[];return(e.constructor={})[a]=function(){return{foo:1}},1!==e[t](Boolean).foo})}},616:function(t,e,i){var n=i(9039);t.exports=!n(function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})},655:function(t,e,i){var n=i(6955),r=String;t.exports=function(t){if("Symbol"===n(t))throw new TypeError("Cannot convert a Symbol value to a string");return r(t)}},687:function(t,e,i){var n=i(4913).f,r=i(9297),o=i(8227)("toStringTag");t.exports=function(t,e,i){t&&!i&&(t=t.prototype),t&&!r(t,o)&&n(t,o,{configurable:!0,value:e})}},741:function(t){var e=Math.ceil,i=Math.floor;t.exports=Math.trunc||function(t){var n=+t;return(n>0?i:e)(n)}},757:function(t,e,i){var n=i(7751),r=i(4901),o=i(1625),a=i(7040),s=Object;t.exports=a?function(t){return"symbol"==typeof t}:function(t){var e=n("Symbol");return r(e)&&o(e.prototype,s(t))}},788:function(t,e,i){var n=i(34),r=i(2195),o=i(8227)("match");t.exports=function(t){var e;return n(t)&&(void 0!==(e=t[o])?!!e:"RegExp"===r(t))}},825:function(t,e,i){var n=i(6518),r=i(7751),o=i(8745),a=i(566),s=i(5548),l=i(8551),h=i(34),u=i(2360),c=i(9039),p=r("Reflect","construct"),f=Object.prototype,d=[].push,v=c(function(){function t(){}return!(p(function(){},[],t)instanceof t)}),g=!c(function(){p(function(){})}),y=v||g;n({target:"Reflect",stat:!0,forced:y,sham:y},{construct:function(t,e){s(t),l(e);var i=arguments.length<3?t:s(arguments[2]);if(g&&!v)return p(t,e,i);if(t===i){switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3])}var n=[null];return o(d,n,e),new(o(a,t,n))}var r=i.prototype,c=u(h(r)?r:f),y=o(t,c,e);return h(y)?y:c}})},851:function(t,e,i){var n=i(6955),r=i(5966),o=i(4117),a=i(6269),s=i(8227)("iterator");t.exports=function(t){if(!o(t))return r(t,s)||r(t,"@@iterator")||a[n(t)]}},875:function(t,e,i){var n=i(6518),r=i(9039),o=i(8981),a=i(2787),s=i(2211);n({target:"Object",stat:!0,forced:r(function(){a(1)}),sham:!s},{getPrototypeOf:function(t){return a(o(t))}})},926:function(t,e,i){var n=i(9306),r=i(8981),o=i(7055),a=i(6198),s=TypeError,l="Reduce of empty array with no initial value",h=function(t){return function(e,i,h,u){var c=r(e),p=o(c),f=a(c);if(n(i),0===f&&h<2)throw new s(l);var d=t?f-1:0,v=t?-1:1;if(h<2)for(;;){if(d in p){u=p[d],d+=v;break}if(d+=v,t?d<0:f<=d)throw new s(l)}for(;t?d>=0:f>d;d+=v)d in p&&(u=i(u,p[d],d,c));return u}};t.exports={left:h(!1),right:h(!0)}},1034:function(t,e,i){var n=i(9565),r=i(9297),o=i(1625),a=i(7979),s=RegExp.prototype;t.exports=function(t){var e=t.flags;return void 0!==e||"flags"in s||r(t,"flags")||!o(s,t)?e:n(a,t)}},1072:function(t,e,i){var n=i(1828),r=i(8727);t.exports=Object.keys||function(t){return n(t,r)}},1088:function(t,e,i){var n=i(6518),r=i(9565),o=i(6395),a=i(350),s=i(4901),l=i(3994),h=i(2787),u=i(2967),c=i(687),p=i(6699),f=i(6840),d=i(8227),v=i(6269),g=i(7657),y=a.PROPER,m=a.CONFIGURABLE,w=g.IteratorPrototype,x=g.BUGGY_SAFARI_ITERATORS,b=d("iterator"),_="keys",T="values",S="entries",P=function(){return this};t.exports=function(t,e,i,a,d,g,E){l(i,e,a);var C,O,R,k=function(t){if(t===d&&L)return L;if(!x&&t&&t in M)return M[t];switch(t){case _:case T:case S:return function(){return new i(this,t)}}return function(){return new i(this)}},I=e+" Iterator",D=!1,M=t.prototype,A=M[b]||M["@@iterator"]||d&&M[d],L=!x&&A||k(d),z="Array"===e&&M.entries||A;if(z&&(C=h(z.call(new t)))!==Object.prototype&&C.next&&(o||h(C)===w||(u?u(C,w):s(C[b])||f(C,b,P)),c(C,I,!0,!0),o&&(v[I]=P)),y&&d===T&&A&&A.name!==T&&(!o&&m?p(M,"name",T):(D=!0,L=function(){return r(A,this)})),d)if(O={values:k(T),keys:g?L:k(_),entries:k(S)},E)for(R in O)(x||D||!(R in M))&&f(M,R,O[R]);else n({target:e,proto:!0,forced:x||D},O);return o&&!E||M[b]===L||f(M,b,L,{name:d}),v[e]=L,O}},1113:function(t){t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},1181:function(t,e,i){var n,r,o,a=i(8622),s=i(4576),l=i(34),h=i(6699),u=i(9297),c=i(7629),p=i(6119),f=i(421),d="Object already initialized",v=s.TypeError,g=s.WeakMap;if(a||c.state){var y=c.state||(c.state=new g);y.get=y.get,y.has=y.has,y.set=y.set,n=function(t,e){if(y.has(t))throw new v(d);return e.facade=t,y.set(t,e),e},r=function(t){return y.get(t)||{}},o=function(t){return y.has(t)}}else{var m=p("state");f[m]=!0,n=function(t,e){if(u(t,m))throw new v(d);return e.facade=t,h(t,m,e),e},r=function(t){return u(t,m)?t[m]:{}},o=function(t){return u(t,m)}}t.exports={set:n,get:r,has:o,enforce:function(t){return o(t)?r(t):n(t,{})},getterFor:function(t){return function(e){var i;if(!l(e)||(i=r(e)).type!==t)throw new v("Incompatible receiver, "+t+" required");return i}}}},1240:function(t,e,i){var n=i(9504);t.exports=n(1..valueOf)},1278:function(t,e,i){var n=i(6518),r=i(3724),o=i(5031),a=i(5397),s=i(7347),l=i(4659);n({target:"Object",stat:!0,sham:!r},{getOwnPropertyDescriptors:function(t){for(var e,i,n=a(t),r=s.f,h=o(n),u={},c=0;h.length>c;)void 0!==(i=r(n,e=h[c++]))&&l(u,e,i);return u}})},1291:function(t,e,i){var n=i(741);t.exports=function(t){var e=+t;return e!=e||0===e?0:n(e)}},1296:function(t,e,i){var n=i(4495);t.exports=n&&!!Symbol.for&&!!Symbol.keyFor},1436:function(t,e,i){var n=i(8227)("match");t.exports=function(t){var e=/./;try{"/./"[t](e)}catch(i){try{return e[n]=!1,"/./"[t](e)}catch(r){}}return!1}},1469:function(t,e,i){var n=i(7433);t.exports=function(t,e){return new(n(t))(0===e?0:e)}},1510:function(t,e,i){var n=i(6518),r=i(7751),o=i(9297),a=i(655),s=i(5745),l=i(1296),h=s("string-to-symbol-registry"),u=s("symbol-to-string-registry");n({target:"Symbol",stat:!0,forced:!l},{for:function(t){var e=a(t);if(o(h,e))return h[e];var i=r("Symbol")(e);return h[e]=i,u[i]=e,i}})},1601:function(t){t.exports=function(t){return t[1]}},1625:function(t,e,i){var n=i(9504);t.exports=n({}.isPrototypeOf)},1699:function(t,e,i){var n=i(6518),r=i(9504),o=i(5749),a=i(7750),s=i(655),l=i(1436),h=r("".indexOf);n({target:"String",proto:!0,forced:!l("includes")},{includes:function(t){return!!~h(s(a(this)),s(o(t)),arguments.length>1?arguments[1]:void 0)}})},1828:function(t,e,i){var n=i(9504),r=i(9297),o=i(5397),a=i(9617).indexOf,s=i(421),l=n([].push);t.exports=function(t,e){var i,n=o(t),h=0,u=[];for(i in n)!r(s,i)&&r(n,i)&&l(u,i);for(;e.length>h;)r(n,i=e[h++])&&(~a(u,i)||l(u,i));return u}},1951:function(t,e,i){var n=i(8227);e.f=n},1988:function(t,e,i){var n=i(1601),r=i.n(n),o=i(6314),a=i.n(o)()(r());a.push([t.id,".openseadragon-navigator{position:absolute;z-index:1}.openseadragon-navigator .navigator-main{position:relative;overflow:hidden;display:block;font-size:0}.openseadragon-navigator .navigator-main .v-line{height:100%;width:1px;line-height:1px;position:absolute;top:0}.openseadragon-navigator .navigator-main .h-line{width:100%;height:1px;line-height:1px;position:absolute;left:0}.openseadragon-navigator .navigator-main .view-rect{top:-1px;background-color:#fff;position:absolute;cursor:pointer;opacity:.5;-webkit-box-sizing:border-box;box-sizing:border-box}.openseadragon-navigator .navigator-main .navigator-color-rect{position:absolute;top:0;left:0;z-index:1}",""]),e.A=a},2008:function(t,e,i){var n=i(6518),r=i(9213).filter;n({target:"Array",proto:!0,forced:!i(597)("filter")},{filter:function(t){return r(this,t,arguments.length>1?arguments[1]:void 0)}})},2010:function(t,e,i){var n=i(3724),r=i(350).EXISTS,o=i(9504),a=i(2106),s=Function.prototype,l=o(s.toString),h=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,u=o(h.exec);n&&!r&&a(s,"name",{configurable:!0,get:function(){try{return u(h,l(this))[1]}catch(t){return""}}})},2062:function(t,e,i){var n=i(6518),r=i(9213).map;n({target:"Array",proto:!0,forced:!i(597)("map")},{map:function(t){return r(this,t,arguments.length>1?arguments[1]:void 0)}})},2106:function(t,e,i){var n=i(283),r=i(4913);t.exports=function(t,e,i){return i.get&&n(i.get,e,{getter:!0}),i.set&&n(i.set,e,{setter:!0}),r.f(t,e,i)}},2140:function(t,e,i){var n={};n[i(8227)("toStringTag")]="z",t.exports="[object z]"===String(n)},2195:function(t,e,i){var n=i(9504),r=n({}.toString),o=n("".slice);t.exports=function(t){return o(r(t),8,-1)}},2211:function(t,e,i){var n=i(9039);t.exports=!n(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})},2259:function(t,e,i){i(511)("iterator")},2333:function(t,e,i){var n=i(1291),r=i(655),o=i(7750),a=RangeError;t.exports=function(t){var e=r(o(this)),i="",s=n(t);if(s<0||s===1/0)throw new a("Wrong number of repetitions");for(;s>0;(s>>>=1)&&(e+=e))1&s&&(i+=e);return i}},2357:function(t,e,i){var n=i(3724),r=i(9039),o=i(9504),a=i(2787),s=i(1072),l=i(5397),h=o(i(8773).f),u=o([].push),c=n&&r(function(){var t=Object.create(null);return t[2]=2,!h(t,2)}),p=function(t){return function(e){for(var i,r=l(e),o=s(r),p=c&&null===a(r),f=o.length,d=0,v=[];f>d;)i=o[d++],n&&!(p?i in r:h(r,i))||u(v,t?[i,r[i]]:r[i]);return v}};t.exports={entries:p(!0),values:p(!1)}},2360:function(t,e,i){var n,r=i(8551),o=i(6801),a=i(8727),s=i(421),l=i(397),h=i(4055),u=i(6119),c="prototype",p="script",f=u("IE_PROTO"),d=function(){},v=function(t){return"<"+p+">"+t+"</"+p+">"},g=function(t){t.write(v("")),t.close();var e=t.parentWindow.Object;return t=null,e},y=function(){try{n=new ActiveXObject("htmlfile")}catch(o){}var t,e,i;y="undefined"!=typeof document?document.domain&&n?g(n):(e=h("iframe"),i="java"+p+":",e.style.display="none",l.appendChild(e),e.src=String(i),(t=e.contentWindow.document).open(),t.write(v("document.F=Object")),t.close(),t.F):g(n);for(var r=a.length;r--;)delete y[c][a[r]];return y()};s[f]=!0,t.exports=Object.create||function(t,e){var i;return null!==t?(d[c]=r(t),i=new d,d[c]=null,i[f]=t):i=y(),void 0===e?i:o.f(i,e)}},2478:function(t,e,i){var n=i(9504),r=i(8981),o=Math.floor,a=n("".charAt),s=n("".replace),l=n("".slice),h=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,u=/\$([$&'`]|\d{1,2})/g;t.exports=function(t,e,i,n,c,p){var f=i+t.length,d=n.length,v=u;return void 0!==c&&(c=r(c),v=h),s(p,v,function(r,s){var h;switch(a(s,0)){case"$":return"$";case"&":return t;case"`":return l(e,0,i);case"'":return l(e,f);case"<":h=c[l(s,1,-1)];break;default:var u=+s;if(0===u)return r;if(u>d){var p=o(u/10);return 0===p?r:p<=d?void 0===n[p-1]?a(s,1):n[p-1]+a(s,1):r}h=n[u-1]}return void 0===h?"":h})}},2529:function(t){t.exports=function(t,e){return{value:t,done:e}}},2675:function(t,e,i){i(6761),i(1510),i(7812),i(3110),i(9773)},2712:function(t,e,i){var n=i(6518),r=i(926).left,o=i(4598),a=i(9519);n({target:"Array",proto:!0,forced:!i(6193)&&a>79&&a<83||!o("reduce")},{reduce:function(t){var e=arguments.length;return r(this,t,e,e>1?arguments[1]:void 0)}})},2777:function(t,e,i){var n=i(9565),r=i(34),o=i(757),a=i(5966),s=i(4270),l=i(8227),h=TypeError,u=l("toPrimitive");t.exports=function(t,e){if(!r(t)||o(t))return t;var i,l=a(t,u);if(l){if(void 0===e&&(e="default"),i=n(l,t,e),!r(i)||o(i))return i;throw new h("Can't convert object to primitive value")}return void 0===e&&(e="number"),s(t,e)}},2787:function(t,e,i){var n=i(9297),r=i(4901),o=i(8981),a=i(6119),s=i(2211),l=a("IE_PROTO"),h=Object,u=h.prototype;t.exports=s?h.getPrototypeOf:function(t){var e=o(t);if(n(e,l))return e[l];var i=e.constructor;return r(i)&&e instanceof i?i.prototype:e instanceof h?u:null}},2796:function(t,e,i){var n=i(9039),r=i(4901),o=/#|\.prototype\./,a=function(t,e){var i=l[s(t)];return i===u||i!==h&&(r(e)?n(e):!!e)},s=a.normalize=function(t){return String(t).replace(o,".").toLowerCase()},l=a.data={},h=a.NATIVE="N",u=a.POLYFILL="P";t.exports=a},2839:function(t,e,i){var n=i(4576).navigator,r=n&&n.userAgent;t.exports=r?String(r):""},2861:function(t,e){var i,n,r,o,a;function s(t){return new s.Viewer(t)}!function(t){t.version={versionStr:"4.1.1",major:parseInt("4",10),minor:parseInt("1",10),revision:parseInt("1",10)};var e,i={"[object Boolean]":"boolean","[object Number]":"number","[object String]":"string","[object Function]":"function","[object AsyncFunction]":"function","[object Promise]":"promise","[object Array]":"array","[object Date]":"date","[object RegExp]":"regexp","[object Object]":"object"},n=Object.prototype.toString,r=Object.prototype.hasOwnProperty;t.isFunction=function(e){return"function"===t.type(e)},t.isArray=Array.isArray||function(e){return"array"===t.type(e)},t.isWindow=function(t){return t&&"object"==typeof t&&"setInterval"in t},t.type=function(t){return null==t?String(t):i[n.call(t)]||"object"},t.isPlainObject=function(e){if(!e||"object"!==s.type(e)||e.nodeType||t.isWindow(e))return!1;if(e.constructor&&!r.call(e,"constructor")&&!r.call(e.constructor.prototype,"isPrototypeOf"))return!1;var i;for(var n in e)i=n;return void 0===i||r.call(e,i)},t.isEmptyObject=function(t){for(var e in t)return!1;return!0},t.freezeObject=function(e){return Object.freeze?t.freezeObject=Object.freeze:t.freezeObject=function(t){return t},t.freezeObject(e)},t.supportsCanvas=(e=document.createElement("canvas"),!(!t.isFunction(e.getContext)||!e.getContext("2d"))),t.isCanvasTainted=function(t){var e=!1;try{t.getContext("2d").getImageData(0,0,1,1)}catch(i){e=!0}return e},t.supportsAddEventListener=!(!document.documentElement.addEventListener||!document.addEventListener),t.supportsRemoveEventListener=!(!document.documentElement.removeEventListener||!document.removeEventListener),t.supportsEventListenerOptions=function(){var e=0;if(t.supportsAddEventListener)try{var i={get capture(){return e++,!1},get once(){return e++,!1},get passive(){return e++,!1}};window.addEventListener("test",null,i),window.removeEventListener("test",null,i)}catch(n){e=0}return e>=3}(),t.getCurrentPixelDensityRatio=function(){if(t.supportsCanvas){var e=document.createElement("canvas").getContext("2d"),i=window.devicePixelRatio||1,n=e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return Math.max(i,1)/n}return 1},t.pixelDensityRatio=t.getCurrentPixelDensityRatio()}(s),function(t){t.extend=function(){var e,i,n,r,o,a,l=arguments[0]||{},h=arguments.length,u=!1,c=1;for("boolean"==typeof l&&(u=l,l=arguments[1]||{},c=2),"object"==typeof l||s.isFunction(l)||(l={}),h===c&&(l=this,--c);c<h;c++)if(null!==(e=arguments[c])||void 0!==e)for(i in e){var p=Object.getOwnPropertyDescriptor(e,i);void 0!==p?p.get||p.set?Object.defineProperty(l,i,p):l!==(r=p.value)&&(u&&r&&(s.isPlainObject(r)||(o=s.isArray(r)))?(n=l[i],o?(o=!1,a=n&&s.isArray(n)?n:[]):a=n&&s.isPlainObject(n)?n:{},l[i]=s.extend(u,a,r)):void 0!==r&&(l[i]=r)):t.console.warn('Could not copy inherited property "'+i+'".')}return l};t.extend(t,{DEFAULT_SETTINGS:{xmlPath:null,tileSources:null,tileHost:null,initialPage:0,crossOriginPolicy:!1,ajaxWithCredentials:!1,loadTilesWithAjax:!1,ajaxHeaders:{},splitHashDataForPost:!1,panHorizontal:!0,panVertical:!0,constrainDuringPan:!1,wrapHorizontal:!1,wrapVertical:!1,visibilityRatio:.5,minPixelRatio:.5,defaultZoomLevel:0,minZoomLevel:null,maxZoomLevel:null,homeFillsViewer:!1,clickTimeThreshold:300,clickDistThreshold:5,dblClickTimeThreshold:300,dblClickDistThreshold:20,springStiffness:6.5,animationTime:1.2,gestureSettingsMouse:{dragToPan:!0,scrollToZoom:!0,clickToZoom:!0,dblClickToZoom:!1,dblClickDragToZoom:!1,pinchToZoom:!1,zoomToRefPoint:!0,flickEnabled:!1,flickMinSpeed:120,flickMomentum:.25,pinchRotate:!1},gestureSettingsTouch:{dragToPan:!0,scrollToZoom:!1,clickToZoom:!1,dblClickToZoom:!0,dblClickDragToZoom:!0,pinchToZoom:!0,zoomToRefPoint:!0,flickEnabled:!0,flickMinSpeed:120,flickMomentum:.25,pinchRotate:!1},gestureSettingsPen:{dragToPan:!0,scrollToZoom:!1,clickToZoom:!0,dblClickToZoom:!1,dblClickDragToZoom:!1,pinchToZoom:!1,zoomToRefPoint:!0,flickEnabled:!1,flickMinSpeed:120,flickMomentum:.25,pinchRotate:!1},gestureSettingsUnknown:{dragToPan:!0,scrollToZoom:!1,clickToZoom:!1,dblClickToZoom:!0,dblClickDragToZoom:!1,pinchToZoom:!0,zoomToRefPoint:!0,flickEnabled:!0,flickMinSpeed:120,flickMomentum:.25,pinchRotate:!1},zoomPerClick:2,zoomPerScroll:1.2,zoomPerDblClickDrag:1.2,zoomPerSecond:1,blendTime:0,alwaysBlend:!1,autoHideControls:!0,immediateRender:!1,minZoomImageRatio:.9,maxZoomPixelRatio:1.1,smoothTileEdgesMinZoom:1.1,iOSDevice:function(){if("object"!=typeof navigator)return!1;var t=navigator.userAgent;return"string"==typeof t&&(-1!==t.indexOf("iPhone")||-1!==t.indexOf("iPad")||-1!==t.indexOf("iPod"))}(),pixelsPerWheelLine:40,pixelsPerArrowPress:40,autoResize:!0,preserveImageSizeOnResize:!1,minScrollDeltaTime:50,rotationIncrement:90,showSequenceControl:!0,sequenceControlAnchor:null,preserveViewport:!1,preserveOverlays:!1,navPrevNextWrap:!1,showNavigationControl:!0,navigationControlAnchor:null,showZoomControl:!0,showHomeControl:!0,showFullPageControl:!0,showRotationControl:!1,showFlipControl:!1,controlsFadeDelay:2e3,controlsFadeLength:1500,mouseNavEnabled:!0,showNavigator:!1,navigatorElement:null,navigatorId:null,navigatorPosition:null,navigatorSizeRatio:.2,navigatorMaintainSizeRatio:!1,navigatorTop:null,navigatorLeft:null,navigatorHeight:null,navigatorWidth:null,navigatorAutoResize:!0,navigatorAutoFade:!0,navigatorRotate:!0,navigatorBackground:"#000",navigatorOpacity:.8,navigatorBorderColor:"#555",navigatorDisplayRegionColor:"#900",degrees:0,flipped:!1,opacity:1,preload:!1,compositeOperation:null,imageSmoothingEnabled:!0,placeholderFillStyle:null,subPixelRoundingForTransparency:null,showReferenceStrip:!1,referenceStripScroll:"horizontal",referenceStripElement:null,referenceStripHeight:null,referenceStripWidth:null,referenceStripPosition:"BOTTOM_LEFT",referenceStripSizeRatio:.2,collectionRows:3,collectionColumns:0,collectionLayout:"horizontal",collectionMode:!1,collectionTileSize:800,collectionTileMargin:80,imageLoaderLimit:0,maxImageCacheCount:200,timeout:3e4,useCanvas:!0,tileRetryMax:0,tileRetryDelay:2500,prefixUrl:"/images/",navImages:{zoomIn:{REST:"zoomin_rest.png",GROUP:"zoomin_grouphover.png",HOVER:"zoomin_hover.png",DOWN:"zoomin_pressed.png"},zoomOut:{REST:"zoomout_rest.png",GROUP:"zoomout_grouphover.png",HOVER:"zoomout_hover.png",DOWN:"zoomout_pressed.png"},home:{REST:"home_rest.png",GROUP:"home_grouphover.png",HOVER:"home_hover.png",DOWN:"home_pressed.png"},fullpage:{REST:"fullpage_rest.png",GROUP:"fullpage_grouphover.png",HOVER:"fullpage_hover.png",DOWN:"fullpage_pressed.png"},rotateleft:{REST:"rotateleft_rest.png",GROUP:"rotateleft_grouphover.png",HOVER:"rotateleft_hover.png",DOWN:"rotateleft_pressed.png"},rotateright:{REST:"rotateright_rest.png",GROUP:"rotateright_grouphover.png",HOVER:"rotateright_hover.png",DOWN:"rotateright_pressed.png"},flip:{REST:"flip_rest.png",GROUP:"flip_grouphover.png",HOVER:"flip_hover.png",DOWN:"flip_pressed.png"},previous:{REST:"previous_rest.png",GROUP:"previous_grouphover.png",HOVER:"previous_hover.png",DOWN:"previous_pressed.png"},next:{REST:"next_rest.png",GROUP:"next_grouphover.png",HOVER:"next_hover.png",DOWN:"next_pressed.png"}},debugMode:!1,debugGridColor:["#437AB2","#1B9E77","#D95F02","#7570B3","#E7298A","#66A61E","#E6AB02","#A6761D","#666666"],silenceMultiImageWarnings:!1},SIGNAL:"----seadragon----",delegate:function(t,e){return function(){var i=arguments;return void 0===i&&(i=[]),e.apply(t,i)}},BROWSERS:{UNKNOWN:0,IE:1,FIREFOX:2,SAFARI:3,CHROME:4,OPERA:5,EDGE:6,CHROMEEDGE:7},SUBPIXEL_ROUNDING_OCCURRENCES:{NEVER:0,ONLY_AT_REST:1,ALWAYS:2},_viewers:new Map,getViewer:function(e){return t._viewers.get(this.getElement(e))},getElement:function(t){return"string"==typeof t&&(t=document.getElementById(t)),t},getElementPosition:function(e){var i,n,o=new t.Point;for(n=r(e=t.getElement(e),i="fixed"===t.getElementStyle(e).position);n;)o.x+=e.offsetLeft,o.y+=e.offsetTop,i&&(o=o.plus(t.getPageScroll())),n=r(e=n,i="fixed"===t.getElementStyle(e).position);return o},getElementOffset:function(e){var i,n,r=(e=t.getElement(e))&&e.ownerDocument,o={top:0,left:0};return r?(i=r.documentElement,void 0!==e.getBoundingClientRect&&(o=e.getBoundingClientRect()),n=r===r.window?r:9===r.nodeType&&(r.defaultView||r.parentWindow),new t.Point(o.left+(n.pageXOffset||i.scrollLeft)-(i.clientLeft||0),o.top+(n.pageYOffset||i.scrollTop)-(i.clientTop||0))):new t.Point},getElementSize:function(e){return e=t.getElement(e),new t.Point(e.clientWidth,e.clientHeight)},getElementStyle:document.documentElement.currentStyle?function(e){return(e=t.getElement(e)).currentStyle}:function(e){return e=t.getElement(e),window.getComputedStyle(e,"")},getCssPropertyWithVendorPrefix:function(e){var i={};return t.getCssPropertyWithVendorPrefix=function(e){if(void 0!==i[e])return i[e];var n=document.createElement("div").style,r=null;if(void 0!==n[e])r=e;else for(var o=["Webkit","Moz","MS","O","webkit","moz","ms","o"],a=t.capitalizeFirstLetter(e),s=0;s<o.length;s++){var l=o[s]+a;if(void 0!==n[l]){r=l;break}}return i[e]=r,r},t.getCssPropertyWithVendorPrefix(e)},capitalizeFirstLetter:function(t){return t.charAt(0).toUpperCase()+t.slice(1)},positiveModulo:function(t,e){var i=t%e;return i<0&&(i+=e),i},pointInElement:function(e,i){e=t.getElement(e);var n=t.getElementOffset(e),r=t.getElementSize(e);return i.x>=n.x&&i.x<n.x+r.x&&i.y<n.y+r.y&&i.y>=n.y},getMousePosition:function(e){if("number"==typeof e.pageX)t.getMousePosition=function(e){var i=new t.Point;return i.x=e.pageX,i.y=e.pageY,i};else{if("number"!=typeof e.clientX)throw new Error("Unknown event mouse position, no known technique.");t.getMousePosition=function(e){var i=new t.Point;return i.x=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,i.y=e.clientY+document.body.scrollTop+document.documentElement.scrollTop,i}}return t.getMousePosition(e)},getPageScroll:function(){var e=document.documentElement||{},i=document.body||{};if("number"==typeof window.pageXOffset)t.getPageScroll=function(){return new t.Point(window.pageXOffset,window.pageYOffset)};else if(i.scrollLeft||i.scrollTop)t.getPageScroll=function(){return new t.Point(document.body.scrollLeft,document.body.scrollTop)};else{if(!e.scrollLeft&&!e.scrollTop)return new t.Point(0,0);t.getPageScroll=function(){return new t.Point(document.documentElement.scrollLeft,document.documentElement.scrollTop)}}return t.getPageScroll()},setPageScroll:function(e){if(void 0!==window.scrollTo)t.setPageScroll=function(t){window.scrollTo(t.x,t.y)};else{var i=t.getPageScroll();if(i.x===e.x&&i.y===e.y)return;document.body.scrollLeft=e.x,document.body.scrollTop=e.y;var n=t.getPageScroll();if(n.x!==i.x&&n.y!==i.y)return void(t.setPageScroll=function(t){document.body.scrollLeft=t.x,document.body.scrollTop=t.y});if(document.documentElement.scrollLeft=e.x,document.documentElement.scrollTop=e.y,(n=t.getPageScroll()).x!==i.x&&n.y!==i.y)return void(t.setPageScroll=function(t){document.documentElement.scrollLeft=t.x,document.documentElement.scrollTop=t.y});t.setPageScroll=function(t){}}t.setPageScroll(e)},getWindowSize:function(){var e=document.documentElement||{},i=document.body||{};if("number"==typeof window.innerWidth)t.getWindowSize=function(){return new t.Point(window.innerWidth,window.innerHeight)};else if(e.clientWidth||e.clientHeight)t.getWindowSize=function(){return new t.Point(document.documentElement.clientWidth,document.documentElement.clientHeight)};else{if(!i.clientWidth&&!i.clientHeight)throw new Error("Unknown window size, no known technique.");t.getWindowSize=function(){return new t.Point(document.body.clientWidth,document.body.clientHeight)}}return t.getWindowSize()},makeCenteredNode:function(e){e=t.getElement(e);var i=[t.makeNeutralElement("div"),t.makeNeutralElement("div"),t.makeNeutralElement("div")];return t.extend(i[0].style,{display:"table",height:"100%",width:"100%"}),t.extend(i[1].style,{display:"table-row"}),t.extend(i[2].style,{display:"table-cell",verticalAlign:"middle",textAlign:"center"}),i[0].appendChild(i[1]),i[1].appendChild(i[2]),i[2].appendChild(e),i[0]},makeNeutralElement:function(t){var e=document.createElement(t),i=e.style;return i.background="transparent none",i.border="none",i.margin="0px",i.padding="0px",i.position="static",e},now:function(){return Date.now?t.now=Date.now:t.now=function(){return(new Date).getTime()},t.now()},makeTransparentImage:function(e){var i=t.makeNeutralElement("img");return i.src=e,i},setElementOpacity:function(e,i,n){var r;e=t.getElement(e),n&&!t.Browser.alpha&&(i=Math.round(i)),t.Browser.opacity?e.style.opacity=i<1?i:"":i<1?(r="alpha(opacity="+Math.round(100*i)+")",e.style.filter=r):e.style.filter=""},setElementTouchActionNone:function(e){void 0!==(e=t.getElement(e)).style.touchAction?e.style.touchAction="none":void 0!==e.style.msTouchAction&&(e.style.msTouchAction="none")},setElementPointerEvents:function(e,i){void 0!==(e=t.getElement(e)).style&&void 0!==e.style.pointerEvents&&(e.style.pointerEvents=i)},setElementPointerEventsNone:function(e){t.setElementPointerEvents(e,"none")},addClass:function(e,i){(e=t.getElement(e)).className?-1===(" "+e.className+" ").indexOf(" "+i+" ")&&(e.className+=" "+i):e.className=i},indexOf:function(t,e,i){return Array.prototype.indexOf?this.indexOf=function(t,e,i){return t.indexOf(e,i)}:this.indexOf=function(t,e,i){var n,r,o=i||0;if(!t)throw new TypeError;if(0===(r=t.length)||o>=r)return-1;for(o<0&&(o=r-Math.abs(o)),n=o;n<r;n++)if(t[n]===e)return n;return-1},this.indexOf(t,e,i)},removeClass:function(e,i){var n,r,o=[];for(n=(e=t.getElement(e)).className.split(/\s+/),r=0;r<n.length;r++)n[r]&&n[r]!==i&&o.push(n[r]);e.className=o.join(" ")},normalizeEventListenerOptions:function(e){return void 0!==e?"boolean"==typeof e?t.supportsEventListenerOptions?{capture:e}:e:t.supportsEventListenerOptions?e:void 0!==e.capture&&e.capture:!!t.supportsEventListenerOptions&&{capture:!1}},addEvent:function(){if(t.supportsAddEventListener)return function(e,i,n,r){r=t.normalizeEventListenerOptions(r),(e=t.getElement(e)).addEventListener(i,n,r)};if(document.documentElement.attachEvent&&document.attachEvent)return function(e,i,n){(e=t.getElement(e)).attachEvent("on"+i,n)};throw new Error("No known event model.")}(),removeEvent:function(){if(t.supportsRemoveEventListener)return function(e,i,n,r){r=t.normalizeEventListenerOptions(r),(e=t.getElement(e)).removeEventListener(i,n,r)};if(document.documentElement.detachEvent&&document.detachEvent)return function(e,i,n){(e=t.getElement(e)).detachEvent("on"+i,n)};throw new Error("No known event model.")}(),cancelEvent:function(t){t.preventDefault()},eventIsCanceled:function(t){return t.defaultPrevented},stopEvent:function(t){t.stopPropagation()},createCallback:function(t,e){var i,n=[];for(i=2;i<arguments.length;i++)n.push(arguments[i]);return function(){var i,r=n.concat([]);for(i=0;i<arguments.length;i++)r.push(arguments[i]);return e.apply(t,r)}},getUrlParameter:function(t){var e=n[t];return e||null},getUrlProtocol:function(t){var e=t.match(/^([a-z]+:)\/\//i);return null===e?window.location.protocol:e[1].toLowerCase()},createAjaxRequest:function(e){var i;try{i=!!new ActiveXObject("Microsoft.XMLHTTP")}catch(n){i=!1}if(i)window.XMLHttpRequest?t.createAjaxRequest=function(t){return t?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest}:t.createAjaxRequest=function(){return new ActiveXObject("Microsoft.XMLHTTP")};else{if(!window.XMLHttpRequest)throw new Error("Browser doesn't support XMLHttpRequest.");t.createAjaxRequest=function(){return new XMLHttpRequest}}return t.createAjaxRequest(e)},makeAjaxRequest:function(e,i,n){var r,o,a,s;t.isPlainObject(e)&&(i=e.success,n=e.error,r=e.withCredentials,o=e.headers,a=e.responseType||null,s=e.postData||null,e=e.url);var l=t.getUrlProtocol(e),h=t.createAjaxRequest("file:"===l);if(!t.isFunction(i))throw new Error("makeAjaxRequest requires a success callback");h.onreadystatechange=function(){4===h.readyState&&(h.onreadystatechange=function(){},h.status>=200&&h.status<300||0===h.status&&"http:"!==l&&"https:"!==l?i(h):t.isFunction(n)?n(h):t.console.error("AJAX request returned %d: %s",h.status,e))};var u=s?"POST":"GET";try{if(h.open(u,e,!0),a&&(h.responseType=a),o)for(var c in o)Object.prototype.hasOwnProperty.call(o,c)&&o[c]&&h.setRequestHeader(c,o[c]);r&&(h.withCredentials=!0),h.send(s)}catch(p){t.console.error("%s while making AJAX request: %s",p.name,p.message),h.onreadystatechange=function(){},t.isFunction(n)&&n(h,p)}return h},jsonp:function(e){var i,n=e.url,r=document.head||document.getElementsByTagName("head")[0]||document.documentElement,o=e.callbackName||"openseadragon"+t.now(),a=window[o],s="$1"+o+"$2",l=e.param||"callback",h=e.callback;n=n.replace(/(=)\?(&|$)|\?\?/i,s),n+=(/\?/.test(n)?"&":"?")+l+"="+o,window[o]=function(e){if(a)window[o]=a;else try{delete window[o]}catch(i){}h&&t.isFunction(h)&&h(e)},i=document.createElement("script"),void 0===e.async&&!1===e.async||(i.async="async"),e.scriptCharset&&(i.charset=e.scriptCharset),i.src=n,i.onload=i.onreadystatechange=function(t,e){(e||!i.readyState||/loaded|complete/.test(i.readyState))&&(i.onload=i.onreadystatechange=null,r&&i.parentNode&&r.removeChild(i),i=void 0)},r.insertBefore(i,r.firstChild)},createFromDZI:function(){throw"OpenSeadragon.createFromDZI is deprecated, use Viewer.open."},parseXml:function(e){if(window.DOMParser)t.parseXml=function(t){return(new DOMParser).parseFromString(t,"text/xml")};else{if(!window.ActiveXObject)throw new Error("Browser doesn't support XML DOM.");t.parseXml=function(t){var e=null;return(e=new ActiveXObject("Microsoft.XMLDOM")).async=!1,e.loadXML(t),e}}return t.parseXml(e)},parseJSON:function(e){return t.parseJSON=window.JSON.parse,t.parseJSON(e)},imageFormatSupported:function(t){return!!i[(t=t||"").toLowerCase()]},setImageFormatsSupported:function(e){t.extend(i,e)}});var e=function(t){};t.console=window.console||{log:e,debug:e,info:e,warn:e,error:e,assert:e},t.Browser={vendor:t.BROWSERS.UNKNOWN,version:0,alpha:!0};var i={bmp:!1,jpeg:!0,jpg:!0,png:!0,tif:!1,wdp:!1},n={};function r(t,e){return e&&t!==document.body?document.body:t.offsetParent}!function(){var e=navigator.appVersion,i=navigator.userAgent;switch(navigator.appName){case"Microsoft Internet Explorer":window.attachEvent&&window.ActiveXObject&&(t.Browser.vendor=t.BROWSERS.IE,t.Browser.version=parseFloat(i.substring(i.indexOf("MSIE")+5,i.indexOf(";",i.indexOf("MSIE")))));break;case"Netscape":window.addEventListener&&(i.indexOf("Edge")>=0?(t.Browser.vendor=t.BROWSERS.EDGE,t.Browser.version=parseFloat(i.substring(i.indexOf("Edge")+5))):i.indexOf("Edg")>=0?(t.Browser.vendor=t.BROWSERS.CHROMEEDGE,t.Browser.version=parseFloat(i.substring(i.indexOf("Edg")+4))):i.indexOf("Firefox")>=0?(t.Browser.vendor=t.BROWSERS.FIREFOX,t.Browser.version=parseFloat(i.substring(i.indexOf("Firefox")+8))):i.indexOf("Safari")>=0?(t.Browser.vendor=i.indexOf("Chrome")>=0?t.BROWSERS.CHROME:t.BROWSERS.SAFARI,t.Browser.version=parseFloat(i.substring(i.substring(0,i.indexOf("Safari")).lastIndexOf("/")+1,i.indexOf("Safari")))):null!==new RegExp("Trident/.*rv:([0-9]{1,}[.0-9]{0,})").exec(i)&&(t.Browser.vendor=t.BROWSERS.IE,t.Browser.version=parseFloat(RegExp.$1)));break;case"Opera":t.Browser.vendor=t.BROWSERS.OPERA,t.Browser.version=parseFloat(e)}var r,o,a,s=window.location.search.substring(1).split("&");for(a=0;a<s.length;a++)if((o=(r=s[a]).indexOf("="))>0){var l=r.substring(0,o),h=r.substring(o+1);try{n[l]=decodeURIComponent(h)}catch(u){t.console.error("Ignoring malformed URL parameter: %s=%s",l,h)}}t.Browser.alpha=!(t.Browser.vendor===t.BROWSERS.CHROME&&t.Browser.version<2),t.Browser.opacity=!0,t.Browser.vendor===t.BROWSERS.IE&&t.Browser.version<11&&t.console.error("Internet Explorer versions < 11 are not supported by OpenSeadragon")}(),function(e){var i=e.requestAnimationFrame||e.mozRequestAnimationFrame||e.webkitRequestAnimationFrame||e.msRequestAnimationFrame,n=e.cancelAnimationFrame||e.mozCancelAnimationFrame||e.webkitCancelAnimationFrame||e.msCancelAnimationFrame;if(i&&n)t.requestAnimationFrame=function(){return i.apply(e,arguments)},t.cancelAnimationFrame=function(){return n.apply(e,arguments)};else{var r,o=[],a=[],s=0;t.requestAnimationFrame=function(e){return o.push([++s,e]),r||(r=setInterval(function(){if(o.length){var e=t.now(),i=a;for(a=o,o=i;a.length;)a.shift()[1](e)}else clearInterval(r),r=void 0},20)),s},t.cancelAnimationFrame=function(t){var e,i;for(e=0,i=o.length;e<i;e+=1)if(o[e][0]===t)return void o.splice(e,1);for(e=0,i=a.length;e<i;e+=1)if(a[e][0]===t)return void a.splice(e,1)}}}(window)}(s),n=[],void 0===(r="function"==typeof(i=function(){return s})?i.apply(e,n):i)||(t.exports=r),o=s,a={supportsFullScreen:!1,isFullScreen:function(){return!1},getFullScreenElement:function(){return null},requestFullScreen:function(){},exitFullScreen:function(){},cancelFullScreen:function(){},fullScreenEventName:"",fullScreenErrorEventName:""},document.exitFullscreen?(a.supportsFullScreen=!0,a.getFullScreenElement=function(){return document.fullscreenElement},a.requestFullScreen=function(t){return t.requestFullscreen()},a.exitFullScreen=function(){document.exitFullscreen()},a.fullScreenEventName="fullscreenchange",a.fullScreenErrorEventName="fullscreenerror"):document.msExitFullscreen?(a.supportsFullScreen=!0,a.getFullScreenElement=function(){return document.msFullscreenElement},a.requestFullScreen=function(t){return t.msRequestFullscreen()},a.exitFullScreen=function(){document.msExitFullscreen()},a.fullScreenEventName="MSFullscreenChange",a.fullScreenErrorEventName="MSFullscreenError"):document.webkitExitFullscreen?(a.supportsFullScreen=!0,a.getFullScreenElement=function(){return document.webkitFullscreenElement},a.requestFullScreen=function(t){return t.webkitRequestFullscreen()},a.exitFullScreen=function(){document.webkitExitFullscreen()},a.fullScreenEventName="webkitfullscreenchange",a.fullScreenErrorEventName="webkitfullscreenerror"):document.webkitCancelFullScreen?(a.supportsFullScreen=!0,a.getFullScreenElement=function(){return document.webkitCurrentFullScreenElement},a.requestFullScreen=function(t){return t.webkitRequestFullScreen()},a.exitFullScreen=function(){document.webkitCancelFullScreen()},a.fullScreenEventName="webkitfullscreenchange",a.fullScreenErrorEventName="webkitfullscreenerror"):document.mozCancelFullScreen&&(a.supportsFullScreen=!0,a.getFullScreenElement=function(){return document.mozFullScreenElement},a.requestFullScreen=function(t){return t.mozRequestFullScreen()},a.exitFullScreen=function(){document.mozCancelFullScreen()},a.fullScreenEventName="mozfullscreenchange",a.fullScreenErrorEventName="mozfullscreenerror"),a.isFullScreen=function(){return null!==a.getFullScreenElement()},a.cancelFullScreen=function(){o.console.error("cancelFullScreen is deprecated. Use exitFullScreen instead."),a.exitFullScreen()},o.extend(o,a),function(t){t.EventSource=function(){this.events={}},t.EventSource.prototype={addOnceHandler:function(t,e,i,n,r){var o=this;n=n||1;var a=0,s=function(i){return++a===n&&o.removeHandler(t,s),e(i)};this.addHandler(t,s,i,r)},addHandler:function(e,i,n,r){var o=this.events[e];if(o||(this.events[e]=o=[]),i&&t.isFunction(i)){var a=o.length,s={handler:i,userData:n||null,priority:r||0};for(o[a]=s;a>0&&o[a-1].priority<o[a].priority;)o[a]=o[a-1],o[a-1]=s,a--}},removeHandler:function(e,i){var n,r=this.events[e],o=[];if(r&&t.isArray(r)){for(n=0;n<r.length;n++)r[n].handler!==i&&o.push(r[n]);this.events[e]=o}},numberOfHandlers:function(t){var e=this.events[t];return e?e.length:0},removeAllHandlers:function(t){if(t)this.events[t]=[];else for(var e in this.events)this.events[e]=[]},getHandler:function(t){var e=this.events[t];return e&&e.length?(e=1===e.length?[e[0]]:Array.apply(null,e),function(t,i){var n,r=e.length;for(n=0;n<r;n++)e[n]&&(i.eventSource=t,i.userData=e[n].userData,e[n].handler(i))}):null},raiseEvent:function(t,e){var i=this.getHandler(t);if(i)return i(this,e||{})}}}(s),function(t){var e=[],i={};t.MouseTracker=function(n){e.push(this);var r=arguments;t.isPlainObject(n)||(n={element:r[0],clickTimeThreshold:r[1],clickDistThreshold:r[2]}),this.hash=Math.random(),this.element=t.getElement(n.element),this.clickTimeThreshold=n.clickTimeThreshold||t.DEFAULT_SETTINGS.clickTimeThreshold,this.clickDistThreshold=n.clickDistThreshold||t.DEFAULT_SETTINGS.clickDistThreshold,this.dblClickTimeThreshold=n.dblClickTimeThreshold||t.DEFAULT_SETTINGS.dblClickTimeThreshold,this.dblClickDistThreshold=n.dblClickDistThreshold||t.DEFAULT_SETTINGS.dblClickDistThreshold,this.userData=n.userData||null,this.stopDelay=n.stopDelay||50,this.preProcessEventHandler=n.preProcessEventHandler||null,this.contextMenuHandler=n.contextMenuHandler||null,this.enterHandler=n.enterHandler||null,this.leaveHandler=n.leaveHandler||null,this.exitHandler=n.exitHandler||null,this.overHandler=n.overHandler||null,this.outHandler=n.outHandler||null,this.pressHandler=n.pressHandler||null,this.nonPrimaryPressHandler=n.nonPrimaryPressHandler||null,this.releaseHandler=n.releaseHandler||null,this.nonPrimaryReleaseHandler=n.nonPrimaryReleaseHandler||null,this.moveHandler=n.moveHandler||null,this.scrollHandler=n.scrollHandler||null,this.clickHandler=n.clickHandler||null,this.dblClickHandler=n.dblClickHandler||null,this.dragHandler=n.dragHandler||null,this.dragEndHandler=n.dragEndHandler||null,this.pinchHandler=n.pinchHandler||null,this.stopHandler=n.stopHandler||null,this.keyDownHandler=n.keyDownHandler||null,this.keyUpHandler=n.keyUpHandler||null,this.keyHandler=n.keyHandler||null,this.focusHandler=n.focusHandler||null,this.blurHandler=n.blurHandler||null;var o=this;i[this.hash]={click:function(e){!function(e,i){var n={originalEvent:i,eventType:"click",pointerType:"mouse",isEmulated:!1};L(e,n),n.preventDefault&&!n.defaultPrevented&&t.cancelEvent(i);n.stopPropagation&&t.stopEvent(i)}(o,e)},dblclick:function(e){!function(e,i){var n={originalEvent:i,eventType:"dblclick",pointerType:"mouse",isEmulated:!1};L(e,n),n.preventDefault&&!n.defaultPrevented&&t.cancelEvent(i);n.stopPropagation&&t.stopEvent(i)}(o,e)},keydown:function(e){!function(e,i){var n=null,r={originalEvent:i,eventType:"keydown",pointerType:"",isEmulated:!1};L(e,r),!e.keyDownHandler||r.preventGesture||r.defaultPrevented||(n={eventSource:e,keyCode:i.keyCode?i.keyCode:i.charCode,ctrl:i.ctrlKey,shift:i.shiftKey,alt:i.altKey,meta:i.metaKey,originalEvent:i,preventDefault:r.preventDefault||r.defaultPrevented,userData:e.userData},e.keyDownHandler(n));(n&&n.preventDefault||r.preventDefault&&!r.defaultPrevented)&&t.cancelEvent(i);r.stopPropagation&&t.stopEvent(i)}(o,e)},keyup:function(e){!function(e,i){var n=null,r={originalEvent:i,eventType:"keyup",pointerType:"",isEmulated:!1};L(e,r),!e.keyUpHandler||r.preventGesture||r.defaultPrevented||(n={eventSource:e,keyCode:i.keyCode?i.keyCode:i.charCode,ctrl:i.ctrlKey,shift:i.shiftKey,alt:i.altKey,meta:i.metaKey,originalEvent:i,preventDefault:r.preventDefault||r.defaultPrevented,userData:e.userData},e.keyUpHandler(n));(n&&n.preventDefault||r.preventDefault&&!r.defaultPrevented)&&t.cancelEvent(i);r.stopPropagation&&t.stopEvent(i)}(o,e)},keypress:function(e){!function(e,i){var n=null,r={originalEvent:i,eventType:"keypress",pointerType:"",isEmulated:!1};L(e,r),!e.keyHandler||r.preventGesture||r.defaultPrevented||(n={eventSource:e,keyCode:i.keyCode?i.keyCode:i.charCode,ctrl:i.ctrlKey,shift:i.shiftKey,alt:i.altKey,meta:i.metaKey,originalEvent:i,preventDefault:r.preventDefault||r.defaultPrevented,userData:e.userData},e.keyHandler(n));(n&&n.preventDefault||r.preventDefault&&!r.defaultPrevented)&&t.cancelEvent(i);r.stopPropagation&&t.stopEvent(i)}(o,e)},focus:function(t){!function(t,e){var i={originalEvent:e,eventType:"focus",pointerType:"",isEmulated:!1};L(t,i),t.focusHandler&&!i.preventGesture&&t.focusHandler({eventSource:t,originalEvent:e,userData:t.userData})}(o,t)},blur:function(t){!function(t,e){var i={originalEvent:e,eventType:"blur",pointerType:"",isEmulated:!1};L(t,i),t.blurHandler&&!i.preventGesture&&t.blurHandler({eventSource:t,originalEvent:e,userData:t.userData})}(o,t)},contextmenu:function(e){!function(e,i){var n=null,r={originalEvent:i,eventType:"contextmenu",pointerType:"mouse",isEmulated:!1};L(e,r),!e.contextMenuHandler||r.preventGesture||r.defaultPrevented||(n={eventSource:e,position:x(m(i),e.element),originalEvent:r.originalEvent,preventDefault:r.preventDefault||r.defaultPrevented,userData:e.userData},e.contextMenuHandler(n));(n&&n.preventDefault||r.preventDefault&&!r.defaultPrevented)&&t.cancelEvent(i);r.stopPropagation&&t.stopEvent(i)}(o,e)},wheel:function(t){!function(t,e){T(t,e,e)}(o,t)},mousewheel:function(t){_(o,t)},DOMMouseScroll:function(t){_(o,t)},MozMousePixelScroll:function(t){_(o,t)},losecapture:function(e){!function(e,i){var n={id:t.MouseTracker.mousePointerId,type:"mouse"},r={originalEvent:i,eventType:"lostpointercapture",pointerType:"mouse",isEmulated:!1};L(e,r),i.target===e.element&&z(e,n,!1);r.stopPropagation&&t.stopEvent(i)}(o,e)},mouseenter:function(t){S(o,t)},mouseleave:function(t){P(o,t)},mouseover:function(t){E(o,t)},mouseout:function(t){C(o,t)},mousedown:function(t){O(o,t)},mouseup:function(t){R(o,t)},mousemove:function(t){I(o,t)},touchstart:function(e){!function(e,i){var n,r,o,a=i.changedTouches.length,s=e.getActivePointersListByType("touch");n=t.now(),s.getLength()>i.touches.length-a&&t.console.warn("Tracked touch contact count doesn't match event.touches.length");var l={originalEvent:i,eventType:"pointerdown",pointerType:"touch",isEmulated:!1};for(L(e,l),r=0;r<a;r++)j(e,l,o={id:i.changedTouches[r].identifier,type:"touch",isPrimary:0===s.getLength(),currentPos:m(i.changedTouches[r]),currentTime:n}),F(e,l,o,0),z(e,o,!0);l.preventDefault&&!l.defaultPrevented&&t.cancelEvent(i);l.stopPropagation&&t.stopEvent(i)}(o,e)},touchend:function(e){!function(e,i){var n,r,o,a=i.changedTouches.length;n=t.now();var s={originalEvent:i,eventType:"pointerup",pointerType:"touch",isEmulated:!1};for(L(e,s),r=0;r<a;r++)N(e,s,o={id:i.changedTouches[r].identifier,type:"touch",currentPos:m(i.changedTouches[r]),currentTime:n},0),z(e,o,!1),B(e,s,o);s.preventDefault&&!s.defaultPrevented&&t.cancelEvent(i);s.stopPropagation&&t.stopEvent(i)}(o,e)},touchmove:function(e){!function(e,i){var n,r,o=i.changedTouches.length;n=t.now();var a={originalEvent:i,eventType:"pointermove",pointerType:"touch",isEmulated:!1};for(L(e,a),r=0;r<o;r++)H(e,a,{id:i.changedTouches[r].identifier,type:"touch",currentPos:m(i.changedTouches[r]),currentTime:n});a.preventDefault&&!a.defaultPrevented&&t.cancelEvent(i);a.stopPropagation&&t.stopEvent(i)}(o,e)},touchcancel:function(e){!function(e,i){var n,r=i.changedTouches.length,o={originalEvent:i,eventType:"pointercancel",pointerType:"touch",isEmulated:!1};for(L(e,o),n=0;n<r;n++)W(e,o,{id:i.changedTouches[n].identifier,type:"touch"});o.stopPropagation&&t.stopEvent(i)}(o,e)},gesturestart:function(e){!function(e,i){t.eventIsCanceled(i)||i.preventDefault()}(0,e)},gesturechange:function(e){!function(e,i){t.eventIsCanceled(i)||i.preventDefault()}(0,e)},gotpointercapture:function(e){!function(e,i){var n={originalEvent:i,eventType:"gotpointercapture",pointerType:g(i),isEmulated:!1};L(e,n),i.target===e.element&&z(e,{id:i.pointerId,type:g(i)},!0);n.stopPropagation&&t.stopEvent(i)}(o,e)},lostpointercapture:function(e){!function(e,i){var n={originalEvent:i,eventType:"lostpointercapture",pointerType:g(i),isEmulated:!1};L(e,n),i.target===e.element&&z(e,{id:i.pointerId,type:g(i)},!1);n.stopPropagation&&t.stopEvent(i)}(o,e)},pointerenter:function(t){S(o,t)},pointerleave:function(t){P(o,t)},pointerover:function(t){E(o,t)},pointerout:function(t){C(o,t)},pointerdown:function(t){O(o,t)},pointerup:function(t){R(o,t)},pointermove:function(t){I(o,t)},pointercancel:function(e){!function(e,i){var n={id:i.pointerId,type:g(i)},r={originalEvent:i,eventType:"pointercancel",pointerType:n.type,isEmulated:!1};L(e,r),W(e,r,n),r.stopPropagation&&t.stopEvent(i)}(o,e)},pointerupcaptured:function(e){!function(e,i){var n=e.getActivePointersListByType(g(i));n.getById(i.pointerId)&&k(e,i);t.stopEvent(i)}(o,e)},pointermovecaptured:function(e){!function(e,i){var n=e.getActivePointersListByType(g(i));n.getById(i.pointerId)&&D(e,i);t.stopEvent(i)}(o,e)},tracking:!1,activePointersLists:[],lastClickPos:null,dblClickTimeOut:null,pinchGPoints:[],lastPinchDist:0,currentPinchDist:0,lastPinchCenter:null,currentPinchCenter:null,sentDragEvent:!1},this.hasGestureHandlers=!!(this.pressHandler||this.nonPrimaryPressHandler||this.releaseHandler||this.nonPrimaryReleaseHandler||this.clickHandler||this.dblClickHandler||this.dragHandler||this.dragEndHandler||this.pinchHandler),this.hasScrollHandler=!!this.scrollHandler,t.MouseTracker.havePointerEvents&&t.setElementPointerEvents(this.element,"auto"),this.exitHandler&&t.console.error("MouseTracker.exitHandler is deprecated. Use MouseTracker.leaveHandler instead."),n.startDisabled||this.setTracking(!0)},t.MouseTracker.prototype={destroy:function(){var t;for(p(this),this.element=null,t=0;t<e.length;t++)if(e[t]===this){e.splice(t,1);break}i[this.hash]=null,delete i[this.hash]},isTracking:function(){return i[this.hash].tracking},setTracking:function(e){return e?function(e){var n,r,o=i[e.hash];if(!o.tracking){for(r=0;r<t.MouseTracker.subscribeEvents.length;r++)n=t.MouseTracker.subscribeEvents[r],t.addEvent(e.element,n,o[n],n===t.MouseTracker.wheelEventName&&{passive:!1,capture:!1});c(e),o.tracking=!0}}(this):p(this),this},getActivePointersListByType:function(e){var n,r,o=i[this.hash],a=o.activePointersLists.length;for(n=0;n<a;n++)if(o.activePointersLists[n].type===e)return o.activePointersLists[n];return r=new t.MouseTracker.GesturePointList(e),o.activePointersLists.push(r),r},getActivePointerCount:function(){var t,e=i[this.hash],n=e.activePointersLists.length,r=0;for(t=0;t<n;t++)r+=e.activePointersLists[t].getLength();return r},preProcessEventHandler:function(){},contextMenuHandler:function(){},enterHandler:function(){},leaveHandler:function(){},exitHandler:function(){},overHandler:function(){},outHandler:function(){},pressHandler:function(){},nonPrimaryPressHandler:function(){},releaseHandler:function(){},nonPrimaryReleaseHandler:function(){},moveHandler:function(){},scrollHandler:function(){},clickHandler:function(){},dblClickHandler:function(){},dragHandler:function(){},dragEndHandler:function(){},pinchHandler:function(){},stopHandler:function(){},keyDownHandler:function(){},keyUpHandler:function(){},keyHandler:function(){},focusHandler:function(){},blurHandler:function(){}};var n,r,o,a,s,l,h=function(){try{return window.self!==window.top}catch(t){return!0}}();function u(t){try{return t.addEventListener&&t.removeEventListener}catch(e){return!1}}function c(t){var e,n,r,o,a,s=i[t.hash],l=s.activePointersLists.length;for(e=0;e<l;e++)if((r=s.activePointersLists[e]).getLength()>0){for(a=[],o=r.asArray(),n=0;n<o.length;n++)a.push(o[n]);for(n=0;n<a.length;n++)A(t,r,a[n])}for(e=0;e<l;e++)s.activePointersLists.pop();s.sentDragEvent=!1}function p(e){var n,r,o=i[e.hash];if(o.tracking){for(r=0;r<t.MouseTracker.subscribeEvents.length;r++)n=t.MouseTracker.subscribeEvents[r],t.removeEvent(e.element,n,o[n],!1);c(e),o.tracking=!1}}function f(t,e){var n=i[t.hash];if("pointerevent"===e)return{upName:"pointerup",upHandler:n.pointerupcaptured,moveName:"pointermove",moveHandler:n.pointermovecaptured};if("mouse"===e)return{upName:"pointerup",upHandler:n.pointerupcaptured,moveName:"pointermove",moveHandler:n.pointermovecaptured};if("touch"===e)return{upName:"touchend",upHandler:n.touchendcaptured,moveName:"touchmove",moveHandler:n.touchmovecaptured};throw new Error("MouseTracker.getCaptureEventParams: Unknown pointer type.")}function d(e,i){var n,r;if(t.MouseTracker.havePointerCapture)if(t.MouseTracker.havePointerEvents){if(!(r=e.getActivePointersListByType(i.type).getById(i.id))||!r.captured)return;try{e.element.releasePointerCapture(i.id)}catch(o){}}else e.element.releaseCapture();else n=f(e,t.MouseTracker.havePointerEvents?"pointerevent":i.type),h&&u(window.top)&&t.removeEvent(window.top,n.upName,n.upHandler,!0),t.removeEvent(t.MouseTracker.captureElement,n.moveName,n.moveHandler,!0),t.removeEvent(t.MouseTracker.captureElement,n.upName,n.upHandler,!0);z(e,i,!1)}function v(e){return t.MouseTracker.havePointerEvents?e.pointerId:t.MouseTracker.mousePointerId}function g(e){return t.MouseTracker.havePointerEvents?e.pointerType||(t.Browser.vendor===t.BROWSERS.IE?"mouse":""):"mouse"}function y(e){return!t.MouseTracker.havePointerEvents||e.isPrimary}function m(e){return t.getMousePosition(e)}function w(t,e){return x(m(t),e)}function x(e,i){var n=t.getElementOffset(i);return e.minus(n)}function b(e,i){return new t.Point((e.x+i.x)/2,(e.y+i.y)/2)}function _(e,i){var n={target:i.target||i.srcElement,type:"wheel",shiftKey:i.shiftKey||!1,clientX:i.clientX,clientY:i.clientY,pageX:i.pageX?i.pageX:i.clientX,pageY:i.pageY?i.pageY:i.clientY,deltaMode:"MozMousePixelScroll"===i.type?0:1,deltaX:0,deltaZ:0};"mousewheel"===t.MouseTracker.wheelEventName?n.deltaY=-i.wheelDelta/t.DEFAULT_SETTINGS.pixelsPerWheelLine:n.deltaY=i.detail,T(e,n,i)}function T(e,i,n){var r,o,a=null;r=i.deltaY<0?1:-1,L(e,o={originalEvent:i,eventType:"wheel",pointerType:"mouse",isEmulated:i!==n}),!e.scrollHandler||o.preventGesture||o.defaultPrevented||(a={eventSource:e,pointerType:"mouse",position:w(i,e.element),scroll:r,shift:i.shiftKey,isTouchEvent:!1,originalEvent:n,preventDefault:o.preventDefault||o.defaultPrevented,userData:e.userData},e.scrollHandler(a)),o.stopPropagation&&t.stopEvent(n),(a&&a.preventDefault||o.preventDefault&&!o.defaultPrevented)&&t.cancelEvent(n)}function S(e,i){var n={id:v(i),type:g(i),isPrimary:y(i),currentPos:m(i),currentTime:t.now()},r={originalEvent:i,eventType:"pointerenter",pointerType:n.type,isEmulated:!1};L(e,r),j(e,r,n)}function P(e,i){var n={id:v(i),type:g(i),isPrimary:y(i),currentPos:m(i),currentTime:t.now()},r={originalEvent:i,eventType:"pointerleave",pointerType:n.type,isEmulated:!1};L(e,r),B(e,r,n)}function E(e,i){var n={id:v(i),type:g(i),isPrimary:y(i),currentPos:m(i),currentTime:t.now()},r={originalEvent:i,eventType:"pointerover",pointerType:n.type,isEmulated:!1};L(e,r),function(t,e,i){var n,r;n=t.getActivePointersListByType(i.type),r=n.getById(i.id),r?i=r:(i.captured=!1,i.insideElementPressed=!1);t.overHandler&&t.overHandler({eventSource:t,pointerType:i.type,position:x(i.currentPos,t.element),buttons:n.buttons,pointers:t.getActivePointerCount(),insideElementPressed:i.insideElementPressed,buttonDownAny:0!==n.buttons,isTouchEvent:"touch"===i.type,originalEvent:e.originalEvent,userData:t.userData})}(e,r,n),r.preventDefault&&!r.defaultPrevented&&t.cancelEvent(i),r.stopPropagation&&t.stopEvent(i)}function C(e,i){var n={id:v(i),type:g(i),isPrimary:y(i),currentPos:m(i),currentTime:t.now()},r={originalEvent:i,eventType:"pointerout",pointerType:n.type,isEmulated:!1};L(e,r),function(t,e,i){var n,r;n=t.getActivePointersListByType(i.type),r=n.getById(i.id),r?i=r:(i.captured=!1,i.insideElementPressed=!1);t.outHandler&&t.outHandler({eventSource:t,pointerType:i.type,position:i.currentPos&&x(i.currentPos,t.element),buttons:n.buttons,pointers:t.getActivePointerCount(),insideElementPressed:i.insideElementPressed,buttonDownAny:0!==n.buttons,isTouchEvent:"touch"===i.type,originalEvent:e.originalEvent,userData:t.userData})}(e,r,n),r.preventDefault&&!r.defaultPrevented&&t.cancelEvent(i),r.stopPropagation&&t.stopEvent(i)}function O(e,i){var n={id:v(i),type:g(i),isPrimary:y(i),currentPos:m(i),currentTime:t.now()},r=t.MouseTracker.havePointerEvents&&"touch"===n.type&&t.Browser.vendor!==t.BROWSERS.IE,o={originalEvent:i,eventType:"pointerdown",pointerType:n.type,isEmulated:!1};L(e,o),F(e,o,n,i.button),o.preventDefault&&!o.defaultPrevented&&t.cancelEvent(i),o.stopPropagation&&t.stopEvent(i),o.shouldCapture&&(r?z(e,n,!0):function(e,i){var n;if(t.MouseTracker.havePointerCapture)if(t.MouseTracker.havePointerEvents)try{e.element.setPointerCapture(i.id)}catch(r){return void t.console.warn("setPointerCapture() called on invalid pointer ID")}else e.element.setCapture(!0);else n=f(e,t.MouseTracker.havePointerEvents?"pointerevent":i.type),h&&u(window.top)&&t.addEvent(window.top,n.upName,n.upHandler,!0),t.addEvent(t.MouseTracker.captureElement,n.upName,n.upHandler,!0),t.addEvent(t.MouseTracker.captureElement,n.moveName,n.moveHandler,!0);z(e,i,!0)}(e,n))}function R(t,e){k(t,e)}function k(e,i){var n,r={originalEvent:i,eventType:"pointerup",pointerType:(n={id:v(i),type:g(i),isPrimary:y(i),currentPos:m(i),currentTime:t.now()}).type,isEmulated:!1};L(e,r),N(e,r,n,i.button),r.preventDefault&&!r.defaultPrevented&&t.cancelEvent(i),r.stopPropagation&&t.stopEvent(i),r.shouldReleaseCapture&&(i.target===e.element?d(e,n):z(e,n,!1))}function I(t,e){D(t,e)}function D(e,i){var n={id:v(i),type:g(i),isPrimary:y(i),currentPos:m(i),currentTime:t.now()},r={originalEvent:i,eventType:"pointermove",pointerType:n.type,isEmulated:!1};L(e,r),H(e,r,n),r.preventDefault&&!r.defaultPrevented&&t.cancelEvent(i),r.stopPropagation&&t.stopEvent(i)}function M(t,e){return e.speed=0,e.direction=0,e.contactPos=e.currentPos,e.contactTime=e.currentTime,e.lastPos=e.currentPos,e.lastTime=e.currentTime,t.add(e)}function A(e,i,n){var r,o=i.getById(n.id);return o?(o.captured&&(t.console.warn("stopTrackingPointer() called on captured pointer"),d(e,o)),i.removeContact(),r=i.removeById(n.id)):r=i.getLength(),r}function L(e,i){i.eventSource=e,i.eventPhase=i.originalEvent&&void 0!==i.originalEvent.eventPhase?i.originalEvent.eventPhase:0,i.defaultPrevented=t.eventIsCanceled(i.originalEvent),i.shouldCapture=!1,i.shouldReleaseCapture=!1,i.userData=e.userData,function(t,e){switch(e.eventType){case"pointermove":case"pointerdown":case"pointerup":e.isStoppable=!0,e.isCancelable=!0,e.preventDefault=!1,e.preventGesture=!t.hasGestureHandlers,e.stopPropagation=!1;break;case"pointerover":case"pointerout":case"contextmenu":case"keydown":case"keyup":case"keypress":e.isStoppable=!0,e.isCancelable=!0,e.preventDefault=!1,e.preventGesture=!1,e.stopPropagation=!1;break;case"wheel":e.isStoppable=!0,e.isCancelable=!0,e.preventDefault=!1,e.preventGesture=!t.hasScrollHandler,e.stopPropagation=!1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":e.isStoppable=!0,e.isCancelable=!1,e.preventDefault=!1,e.preventGesture=!1,e.stopPropagation=!1;break;case"click":e.isStoppable=!0,e.isCancelable=!0,e.preventDefault=!!t.clickHandler,e.preventGesture=!1,e.stopPropagation=!1;break;case"dblclick":e.isStoppable=!0,e.isCancelable=!0,e.preventDefault=!!t.dblClickHandler,e.preventGesture=!1,e.stopPropagation=!1;break;default:e.isStoppable=!1,e.isCancelable=!1,e.preventDefault=!1,e.preventGesture=!1,e.stopPropagation=!1}}(e,i),e.preProcessEventHandler&&e.preProcessEventHandler(i)}function z(e,i,n){var r=e.getActivePointersListByType(i.type),o=r.getById(i.id);o?n&&!o.captured?(o.captured=!0,r.captureCount++):!n&&o.captured&&(o.captured=!1,r.captureCount--,r.captureCount<0&&(r.captureCount=0,t.console.warn("updatePointerCaptured() - pointsList.captureCount went negative"))):t.console.warn("updatePointerCaptured() called on untracked pointer")}function j(t,e,i){var n,r=t.getActivePointersListByType(i.type);(n=r.getById(i.id))?(n.insideElement=!0,n.lastPos=n.currentPos,n.lastTime=n.currentTime,n.currentPos=i.currentPos,n.currentTime=i.currentTime,i=n):(i.captured=!1,i.insideElementPressed=!1,i.insideElement=!0,M(r,i)),t.enterHandler&&t.enterHandler({eventSource:t,pointerType:i.type,position:x(i.currentPos,t.element),buttons:r.buttons,pointers:t.getActivePointerCount(),insideElementPressed:i.insideElementPressed,buttonDownAny:0!==r.buttons,isTouchEvent:"touch"===i.type,originalEvent:e.originalEvent,userData:t.userData})}function B(t,e,i){var n,r,o=t.getActivePointersListByType(i.type);(n=o.getById(i.id))?(n.captured?(n.insideElement=!1,n.lastPos=n.currentPos,n.lastTime=n.currentTime,n.currentPos=i.currentPos,n.currentTime=i.currentTime):A(t,o,n),i=n):(i.captured=!1,i.insideElementPressed=!1),(t.leaveHandler||t.exitHandler)&&(r={eventSource:t,pointerType:i.type,position:i.currentPos&&x(i.currentPos,t.element),buttons:o.buttons,pointers:t.getActivePointerCount(),insideElementPressed:i.insideElementPressed,buttonDownAny:0!==o.buttons,isTouchEvent:"touch"===i.type,originalEvent:e.originalEvent,userData:t.userData},t.leaveHandler&&t.leaveHandler(r),t.exitHandler&&t.exitHandler(r))}function F(e,n,r,o){var a,s=i[e.hash],l=e.getActivePointersListByType(r.type);if(void 0!==n.originalEvent.buttons?l.buttons=n.originalEvent.buttons:0===o?l.buttons|=1:1===o?l.buttons|=4:2===o?l.buttons|=2:3===o?l.buttons|=8:4===o?l.buttons|=16:5===o&&(l.buttons|=32),0!==o)return n.shouldCapture=!1,n.shouldReleaseCapture=!1,void(!e.nonPrimaryPressHandler||n.preventGesture||n.defaultPrevented||(n.preventDefault=!0,e.nonPrimaryPressHandler({eventSource:e,pointerType:r.type,position:x(r.currentPos,e.element),button:o,buttons:l.buttons,isTouchEvent:"touch"===r.type,originalEvent:n.originalEvent,userData:e.userData})));(a=l.getById(r.id))?(a.insideElementPressed=!0,a.insideElement=!0,a.originalTarget=n.originalEvent.target,a.contactPos=r.currentPos,a.contactTime=r.currentTime,a.lastPos=a.currentPos,a.lastTime=a.currentTime,a.currentPos=r.currentPos,a.currentTime=r.currentTime,r=a):(r.captured=!1,r.insideElementPressed=!0,r.insideElement=!0,r.originalTarget=n.originalEvent.target,M(l,r)),l.addContact(),n.preventGesture||n.defaultPrevented?(n.shouldCapture=!1,n.shouldReleaseCapture=!1):(n.shouldCapture=!0,n.shouldReleaseCapture=!1,n.preventDefault=!0,(e.dragHandler||e.dragEndHandler||e.pinchHandler)&&t.MouseTracker.gesturePointVelocityTracker.addPoint(e,r),1===l.contacts?e.pressHandler&&!n.preventGesture&&e.pressHandler({eventSource:e,pointerType:r.type,position:x(r.contactPos,e.element),buttons:l.buttons,isTouchEvent:"touch"===r.type,originalEvent:n.originalEvent,userData:e.userData}):2===l.contacts&&e.pinchHandler&&"touch"===r.type&&(s.pinchGPoints=l.asArray(),s.lastPinchDist=s.currentPinchDist=s.pinchGPoints[0].currentPos.distanceTo(s.pinchGPoints[1].currentPos),s.lastPinchCenter=s.currentPinchCenter=b(s.pinchGPoints[0].currentPos,s.pinchGPoints[1].currentPos)))}function N(e,n,r,o){var a,s,l,h,u=i[e.hash],c=e.getActivePointersListByType(r.type),p=!1;if(void 0!==n.originalEvent.buttons?c.buttons=n.originalEvent.buttons:0===o?c.buttons^=-2:1===o?c.buttons^=-5:2===o?c.buttons^=-3:3===o?c.buttons^=-9:4===o?c.buttons^=-17:5===o&&(c.buttons^=-33),n.shouldCapture=!1,0!==o)return n.shouldReleaseCapture=!1,void(!e.nonPrimaryReleaseHandler||n.preventGesture||n.defaultPrevented||(n.preventDefault=!0,e.nonPrimaryReleaseHandler({eventSource:e,pointerType:r.type,position:x(r.currentPos,e.element),button:o,buttons:c.buttons,isTouchEvent:"touch"===r.type,originalEvent:n.originalEvent,userData:e.userData})));(l=c.getById(r.id))?(c.removeContact(),l.captured&&(p=!0),l.lastPos=l.currentPos,l.lastTime=l.currentTime,l.currentPos=r.currentPos,l.currentTime=r.currentTime,l.insideElement||A(e,c,l),a=l.currentPos,s=l.currentTime):(r.captured=!1,r.insideElementPressed=!1,r.insideElement=!0,M(c,r),l=r),n.preventGesture||n.defaultPrevented||(p?(n.shouldReleaseCapture=!0,n.preventDefault=!0,(e.dragHandler||e.dragEndHandler||e.pinchHandler)&&t.MouseTracker.gesturePointVelocityTracker.removePoint(e,l),0===c.contacts?(e.releaseHandler&&a&&e.releaseHandler({eventSource:e,pointerType:l.type,position:x(a,e.element),buttons:c.buttons,insideElementPressed:l.insideElementPressed,insideElementReleased:l.insideElement,isTouchEvent:"touch"===l.type,originalEvent:n.originalEvent,userData:e.userData}),e.dragEndHandler&&u.sentDragEvent&&e.dragEndHandler({eventSource:e,pointerType:l.type,position:x(l.currentPos,e.element),speed:l.speed,direction:l.direction,shift:n.originalEvent.shiftKey,isTouchEvent:"touch"===l.type,originalEvent:n.originalEvent,userData:e.userData}),u.sentDragEvent=!1,(e.clickHandler||e.dblClickHandler)&&l.insideElement&&(h=s-l.contactTime<=e.clickTimeThreshold&&l.contactPos.distanceTo(a)<=e.clickDistThreshold,e.clickHandler&&e.clickHandler({eventSource:e,pointerType:l.type,position:x(l.currentPos,e.element),quick:h,shift:n.originalEvent.shiftKey,isTouchEvent:"touch"===l.type,originalEvent:n.originalEvent,originalTarget:l.originalTarget,userData:e.userData}),e.dblClickHandler&&h&&(c.clicks++,1===c.clicks?(u.lastClickPos=a,u.dblClickTimeOut=setTimeout(function(){c.clicks=0},e.dblClickTimeThreshold)):2===c.clicks&&(clearTimeout(u.dblClickTimeOut),c.clicks=0,u.lastClickPos.distanceTo(a)<=e.dblClickDistThreshold&&e.dblClickHandler({eventSource:e,pointerType:l.type,position:x(l.currentPos,e.element),shift:n.originalEvent.shiftKey,isTouchEvent:"touch"===l.type,originalEvent:n.originalEvent,userData:e.userData}),u.lastClickPos=null)))):2===c.contacts&&e.pinchHandler&&"touch"===l.type&&(u.pinchGPoints=c.asArray(),u.lastPinchDist=u.currentPinchDist=u.pinchGPoints[0].currentPos.distanceTo(u.pinchGPoints[1].currentPos),u.lastPinchCenter=u.currentPinchCenter=b(u.pinchGPoints[0].currentPos,u.pinchGPoints[1].currentPos))):(n.shouldReleaseCapture=!1,e.releaseHandler&&a&&(e.releaseHandler({eventSource:e,pointerType:l.type,position:x(a,e.element),buttons:c.buttons,insideElementPressed:l.insideElementPressed,insideElementReleased:l.insideElement,isTouchEvent:"touch"===l.type,originalEvent:n.originalEvent,userData:e.userData}),n.preventDefault=!0)))}function H(t,e,n){var r,o,a,s=i[t.hash],l=t.getActivePointersListByType(n.type);void 0!==e.originalEvent.buttons&&(l.buttons=e.originalEvent.buttons),(r=l.getById(n.id))&&(r.lastPos=r.currentPos,r.lastTime=r.currentTime,r.currentPos=n.currentPos,r.currentTime=n.currentTime,e.shouldCapture=!1,e.shouldReleaseCapture=!1,t.stopHandler&&"mouse"===n.type&&(clearTimeout(t.stopTimeOut),t.stopTimeOut=setTimeout(function(){!function(t,e,i){t.stopHandler&&t.stopHandler({eventSource:t,pointerType:i,position:w(e,t.element),buttons:t.getActivePointersListByType(i).buttons,isTouchEvent:"touch"===i,originalEvent:e,userData:t.userData})}(t,e.originalEvent,n.type)},t.stopDelay)),0===l.contacts?t.moveHandler&&t.moveHandler({eventSource:t,pointerType:n.type,position:x(n.currentPos,t.element),buttons:l.buttons,isTouchEvent:"touch"===n.type,originalEvent:e.originalEvent,userData:t.userData}):1===l.contacts?(t.moveHandler&&(r=l.asArray()[0],t.moveHandler({eventSource:t,pointerType:r.type,position:x(r.currentPos,t.element),buttons:l.buttons,isTouchEvent:"touch"===r.type,originalEvent:e.originalEvent,userData:t.userData})),!t.dragHandler||e.preventGesture||e.defaultPrevented||(a=(r=l.asArray()[0]).currentPos.minus(r.lastPos),t.dragHandler({eventSource:t,pointerType:r.type,position:x(r.currentPos,t.element),buttons:l.buttons,delta:a,speed:r.speed,direction:r.direction,shift:e.originalEvent.shiftKey,isTouchEvent:"touch"===r.type,originalEvent:e.originalEvent,userData:t.userData}),e.preventDefault=!0,s.sentDragEvent=!0)):2===l.contacts&&(t.moveHandler&&(o=l.asArray(),t.moveHandler({eventSource:t,pointerType:o[0].type,position:x(b(o[0].currentPos,o[1].currentPos),t.element),buttons:l.buttons,isTouchEvent:"touch"===o[0].type,originalEvent:e.originalEvent,userData:t.userData})),!t.pinchHandler||"touch"!==n.type||e.preventGesture||e.defaultPrevented||(a=s.pinchGPoints[0].currentPos.distanceTo(s.pinchGPoints[1].currentPos))!==s.currentPinchDist&&(s.lastPinchDist=s.currentPinchDist,s.currentPinchDist=a,s.lastPinchCenter=s.currentPinchCenter,s.currentPinchCenter=b(s.pinchGPoints[0].currentPos,s.pinchGPoints[1].currentPos),t.pinchHandler({eventSource:t,pointerType:"touch",gesturePoints:s.pinchGPoints,lastCenter:x(s.lastPinchCenter,t.element),center:x(s.currentPinchCenter,t.element),lastDistance:s.lastPinchDist,distance:s.currentPinchDist,shift:e.originalEvent.shiftKey,originalEvent:e.originalEvent,userData:t.userData}),e.preventDefault=!0)))}function W(t,e,i){var n,r=t.getActivePointersListByType(i.type);(n=r.getById(i.id))&&A(t,r,n)}t.MouseTracker.gesturePointVelocityTracker=(n=[],r=0,o=0,a=function(t,e){return t.hash.toString()+e.type+e.id.toString()},s=function(){var e,i,r,a,s,l,h=n.length,u=t.now();for(a=u-o,o=u,e=0;e<h;e++)(r=(i=n[e]).gPoint).direction=Math.atan2(r.currentPos.y-i.lastPos.y,r.currentPos.x-i.lastPos.x),s=i.lastPos.distanceTo(r.currentPos),i.lastPos=r.currentPos,l=1e3*s/(a+1),r.speed=.75*l+.25*r.speed},{addPoint:function(e,i){var l=a(e,i);n.push({guid:l,gPoint:i,lastPos:i.currentPos}),1===n.length&&(o=t.now(),r=window.setInterval(s,50))},removePoint:function(t,e){var i,o=a(t,e),s=n.length;for(i=0;i<s;i++)if(n[i].guid===o){n.splice(i,1),0===--s&&window.clearInterval(r);break}}}),t.MouseTracker.captureElement=document,t.MouseTracker.wheelEventName=t.Browser.vendor===t.BROWSERS.IE&&t.Browser.version>8||"onwheel"in document.createElement("div")?"wheel":void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll",t.MouseTracker.subscribeEvents=["click","dblclick","keydown","keyup","keypress","focus","blur","contextmenu",t.MouseTracker.wheelEventName],"DOMMouseScroll"===t.MouseTracker.wheelEventName&&t.MouseTracker.subscribeEvents.push("MozMousePixelScroll"),window.PointerEvent?(t.MouseTracker.havePointerEvents=!0,t.MouseTracker.subscribeEvents.push("pointerenter","pointerleave","pointerover","pointerout","pointerdown","pointerup","pointermove","pointercancel"),t.MouseTracker.havePointerCapture=(l=document.createElement("div"),t.isFunction(l.setPointerCapture)&&t.isFunction(l.releasePointerCapture)),t.MouseTracker.havePointerCapture&&t.MouseTracker.subscribeEvents.push("gotpointercapture","lostpointercapture")):(t.MouseTracker.havePointerEvents=!1,t.MouseTracker.subscribeEvents.push("mouseenter","mouseleave","mouseover","mouseout","mousedown","mouseup","mousemove"),t.MouseTracker.mousePointerId="legacy-mouse",t.MouseTracker.havePointerCapture=function(){var e=document.createElement("div");return t.isFunction(e.setCapture)&&t.isFunction(e.releaseCapture)}(),t.MouseTracker.havePointerCapture&&t.MouseTracker.subscribeEvents.push("losecapture"),"ontouchstart"in window&&t.MouseTracker.subscribeEvents.push("touchstart","touchend","touchmove","touchcancel"),"ongesturestart"in window&&t.MouseTracker.subscribeEvents.push("gesturestart","gesturechange")),t.MouseTracker.GesturePointList=function(t){this._gPoints=[],this.type=t,this.buttons=0,this.contacts=0,this.clicks=0,this.captureCount=0},t.MouseTracker.GesturePointList.prototype={getLength:function(){return this._gPoints.length},asArray:function(){return this._gPoints},add:function(t){return this._gPoints.push(t)},removeById:function(t){var e,i=this._gPoints.length;for(e=0;e<i;e++)if(this._gPoints[e].id===t){this._gPoints.splice(e,1);break}return this._gPoints.length},getByIndex:function(t){return t<this._gPoints.length?this._gPoints[t]:null},getById:function(t){var e,i=this._gPoints.length;for(e=0;e<i;e++)if(this._gPoints[e].id===t)return this._gPoints[e];return null},getPrimary:function(t){var e,i=this._gPoints.length;for(e=0;e<i;e++)if(this._gPoints[e].isPrimary)return this._gPoints[e];return null},addContact:function(){++this.contacts,this.contacts>1&&("mouse"===this.type||"pen"===this.type)&&(t.console.warn("GesturePointList.addContact() Implausible contacts value"),this.contacts=1)},removeContact:function(){--this.contacts,this.contacts<0&&(this.contacts=0)}}}(s),function(t){t.ControlAnchor={NONE:0,TOP_LEFT:1,TOP_RIGHT:2,BOTTOM_RIGHT:3,BOTTOM_LEFT:4,ABSOLUTE:5},t.Control=function(e,i,n){var r=e.parentNode;"number"==typeof i&&(t.console.error("Passing an anchor directly into the OpenSeadragon.Control constructor is deprecated; please use an options object instead. Support for this deprecated variant is scheduled for removal in December 2013"),i={anchor:i}),i.attachToViewer=void 0===i.attachToViewer||i.attachToViewer,this.autoFade=void 0===i.autoFade||i.autoFade,this.element=e,this.anchor=i.anchor,this.container=n,this.anchor===t.ControlAnchor.ABSOLUTE?(this.wrapper=t.makeNeutralElement("div"),this.wrapper.style.position="absolute",this.wrapper.style.top="number"==typeof i.top?i.top+"px":i.top,this.wrapper.style.left="number"==typeof i.left?i.left+"px":i.left,this.wrapper.style.height="number"==typeof i.height?i.height+"px":i.height,this.wrapper.style.width="number"==typeof i.width?i.width+"px":i.width,this.wrapper.style.margin="0px",this.wrapper.style.padding="0px",this.element.style.position="relative",this.element.style.top="0px",this.element.style.left="0px",this.element.style.height="100%",this.element.style.width="100%"):(this.wrapper=t.makeNeutralElement("div"),this.wrapper.style.display="inline-block",this.anchor===t.ControlAnchor.NONE&&(this.wrapper.style.width=this.wrapper.style.height="100%")),this.wrapper.appendChild(this.element),i.attachToViewer?this.anchor===t.ControlAnchor.TOP_RIGHT||this.anchor===t.ControlAnchor.BOTTOM_RIGHT?this.container.insertBefore(this.wrapper,this.container.firstChild):this.container.appendChild(this.wrapper):r.appendChild(this.wrapper)},t.Control.prototype={destroy:function(){this.wrapper.removeChild(this.element),this.anchor!==t.ControlAnchor.NONE&&this.container.removeChild(this.wrapper)},isVisible:function(){return"none"!==this.wrapper.style.display},setVisible:function(e){this.wrapper.style.display=e?this.anchor===t.ControlAnchor.ABSOLUTE?"block":"inline-block":"none"},setOpacity:function(e){this.element[t.SIGNAL]&&t.Browser.vendor===t.BROWSERS.IE?t.setElementOpacity(this.element,e,!0):t.setElementOpacity(this.wrapper,e,!0)}}}(s),function(t){function e(t,e){var i,n=t.controls;for(i=n.length-1;i>=0;i--)if(n[i].element===e)return i;return-1}t.ControlDock=function(e){var i,n,r=["topleft","topright","bottomright","bottomleft"];for(t.extend(!0,this,{id:"controldock-"+t.now()+"-"+Math.floor(1e6*Math.random()),container:t.makeNeutralElement("div"),controls:[]},e),this.container.onsubmit=function(){return!1},this.element&&(this.element=t.getElement(this.element),this.element.appendChild(this.container),this.element.style.position="relative",this.container.style.width="100%",this.container.style.height="100%"),n=0;n<r.length;n++)i=r[n],this.controls[i]=t.makeNeutralElement("div"),this.controls[i].style.position="absolute",i.match("left")&&(this.controls[i].style.left="0px"),i.match("right")&&(this.controls[i].style.right="0px"),i.match("top")&&(this.controls[i].style.top="0px"),i.match("bottom")&&(this.controls[i].style.bottom="0px");this.container.appendChild(this.controls.topleft),this.container.appendChild(this.controls.topright),this.container.appendChild(this.controls.bottomright),this.container.appendChild(this.controls.bottomleft)},t.ControlDock.prototype={addControl:function(i,n){var r=null;if(!(e(this,i=t.getElement(i))>=0)){switch(n.anchor){case t.ControlAnchor.TOP_RIGHT:r=this.controls.topright,i.style.position="relative",i.style.paddingRight="0px",i.style.paddingTop="0px";break;case t.ControlAnchor.BOTTOM_RIGHT:r=this.controls.bottomright,i.style.position="relative",i.style.paddingRight="0px",i.style.paddingBottom="0px";break;case t.ControlAnchor.BOTTOM_LEFT:r=this.controls.bottomleft,i.style.position="relative",i.style.paddingLeft="0px",i.style.paddingBottom="0px";break;case t.ControlAnchor.TOP_LEFT:r=this.controls.topleft,i.style.position="relative",i.style.paddingLeft="0px",i.style.paddingTop="0px";break;case t.ControlAnchor.ABSOLUTE:default:case t.ControlAnchor.NONE:r=this.container,i.style.margin="0px",i.style.padding="0px"}this.controls.push(new t.Control(i,n,r)),i.style.display="inline-block"}},removeControl:function(i){var n=e(this,i=t.getElement(i));return n>=0&&(this.controls[n].destroy(),this.controls.splice(n,1)),this},clearControls:function(){for(;this.controls.length>0;)this.controls.pop().destroy();return this},areControlsEnabled:function(){var t;for(t=this.controls.length-1;t>=0;t--)if(this.controls[t].isVisible())return!0;return!1},setControlsEnabled:function(t){var e;for(e=this.controls.length-1;e>=0;e--)this.controls[e].setVisible(t);return this}}}(s),function(t){t.Placement=t.freezeObject({CENTER:0,TOP_LEFT:1,TOP:2,TOP_RIGHT:3,RIGHT:4,BOTTOM_RIGHT:5,BOTTOM:6,BOTTOM_LEFT:7,LEFT:8,properties:{0:{isLeft:!1,isHorizontallyCentered:!0,isRight:!1,isTop:!1,isVerticallyCentered:!0,isBottom:!1},1:{isLeft:!0,isHorizontallyCentered:!1,isRight:!1,isTop:!0,isVerticallyCentered:!1,isBottom:!1},2:{isLeft:!1,isHorizontallyCentered:!0,isRight:!1,isTop:!0,isVerticallyCentered:!1,isBottom:!1},3:{isLeft:!1,isHorizontallyCentered:!1,isRight:!0,isTop:!0,isVerticallyCentered:!1,isBottom:!1},4:{isLeft:!1,isHorizontallyCentered:!1,isRight:!0,isTop:!1,isVerticallyCentered:!0,isBottom:!1},5:{isLeft:!1,isHorizontallyCentered:!1,isRight:!0,isTop:!1,isVerticallyCentered:!1,isBottom:!0},6:{isLeft:!1,isHorizontallyCentered:!0,isRight:!1,isTop:!1,isVerticallyCentered:!1,isBottom:!0},7:{isLeft:!0,isHorizontallyCentered:!1,isRight:!1,isTop:!1,isVerticallyCentered:!1,isBottom:!0},8:{isLeft:!0,isHorizontallyCentered:!1,isRight:!1,isTop:!1,isVerticallyCentered:!0,isBottom:!1}}})}(s),function(t){var e={},i=1;function n(e){return e=t.getElement(e),new t.Point(0===e.clientWidth?1:e.clientWidth,0===e.clientHeight?1:e.clientHeight)}function r(e,i){if(i instanceof t.Overlay)return i;var n=null;if(i.element)n=t.getElement(i.element);else{var r=i.id?i.id:"openseadragon-overlay-"+Math.floor(1e7*Math.random());(n=t.getElement(i.id))||((n=document.createElement("a")).href="#/overlay/"+r),n.id=r,t.addClass(n,i.className?i.className:"openseadragon-overlay")}var o=i.location,a=i.width,s=i.height;if(!o){var l=i.x,h=i.y;if(void 0!==i.px){var u=e.viewport.imageToViewportRectangle(new t.Rect(i.px,i.py,a||0,s||0));l=u.x,h=u.y,a=void 0!==a?u.width:void 0,s=void 0!==s?u.height:void 0}o=new t.Point(l,h)}var c=i.placement;return c&&"string"===t.type(c)&&(c=t.Placement[i.placement.toUpperCase()]),new t.Overlay({element:n,location:o,placement:c,onDraw:i.onDraw,checkResize:i.checkResize,width:a,height:s,rotationMode:i.rotationMode})}function o(t,e){var i;for(i=t.length-1;i>=0;i--)if(t[i].element===e)return i;return-1}function a(e,i){return t.requestAnimationFrame(function(){i(e)})}function s(e){t.requestAnimationFrame(function(){!function(e){var i,n;if(e.controlsShouldFade){for(i=1-(t.now()-e.controlsFadeBeginTime)/e.controlsFadeLength,i=Math.min(1,i),i=Math.max(0,i),n=e.controls.length-1;n>=0;n--)e.controls[n].autoFade&&e.controls[n].setOpacity(i);i>0&&s(e)}}(e)})}function l(e){e.autoHideControls&&(e.controlsShouldFade=!0,e.controlsFadeBeginTime=t.now()+e.controlsFadeDelay,window.setTimeout(function(){s(e)},e.controlsFadeDelay))}function h(t){var e;for(t.controlsShouldFade=!1,e=t.controls.length-1;e>=0;e--)t.controls[e].setOpacity(1)}function u(){h(this)}function c(){l(this)}function p(t){var e={tracker:t.eventSource,position:t.position,originalEvent:t.originalEvent,preventDefault:t.preventDefault};this.raiseEvent("canvas-contextmenu",e),t.preventDefault=e.preventDefault}function f(e){var i={originalEvent:e.originalEvent,preventDefaultAction:!1,preventVerticalPan:e.preventVerticalPan||!this.panVertical,preventHorizontalPan:e.preventHorizontalPan||!this.panHorizontal};if(this.raiseEvent("canvas-key",i),i.preventDefaultAction||e.ctrl||e.alt||e.meta)e.preventDefault=!1;else switch(e.keyCode){case 38:i.preventVerticalPan||(e.shift?this.viewport.zoomBy(1.1):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new t.Point(0,-this.pixelsPerArrowPress))),this.viewport.applyConstraints()),e.preventDefault=!0;break;case 40:i.preventVerticalPan||(e.shift?this.viewport.zoomBy(.9):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new t.Point(0,this.pixelsPerArrowPress))),this.viewport.applyConstraints()),e.preventDefault=!0;break;case 37:i.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new t.Point(-this.pixelsPerArrowPress,0))),this.viewport.applyConstraints()),e.preventDefault=!0;break;case 39:i.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new t.Point(this.pixelsPerArrowPress,0))),this.viewport.applyConstraints()),e.preventDefault=!0;break;case 69:case 187:this.viewport.zoomBy(1.1),this.viewport.applyConstraints(),e.preventDefault=!0;break;case 81:case 189:this.viewport.zoomBy(.9),this.viewport.applyConstraints(),e.preventDefault=!0;break;case 48:this.viewport.goHome(),this.viewport.applyConstraints(),e.preventDefault=!0;break;case 87:i.preventVerticalPan||(e.shift?this.viewport.zoomBy(1.1):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new t.Point(0,-40))),this.viewport.applyConstraints()),e.preventDefault=!0;break;case 83:i.preventVerticalPan||(e.shift?this.viewport.zoomBy(.9):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new t.Point(0,40))),this.viewport.applyConstraints()),e.preventDefault=!0;break;case 65:i.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new t.Point(-40,0))),this.viewport.applyConstraints()),e.preventDefault=!0;break;case 68:i.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new t.Point(40,0))),this.viewport.applyConstraints()),e.preventDefault=!0;break;case 82:e.shift?this.viewport.flipped?this.viewport.setRotation(this.viewport.getRotation()+this.rotationIncrement):this.viewport.setRotation(this.viewport.getRotation()-this.rotationIncrement):this.viewport.flipped?this.viewport.setRotation(this.viewport.getRotation()-this.rotationIncrement):this.viewport.setRotation(this.viewport.getRotation()+this.rotationIncrement),this.viewport.applyConstraints(),e.preventDefault=!0;break;case 70:this.viewport.toggleFlip(),e.preventDefault=!0;break;case 74:this.goToPreviousPage();break;case 75:this.goToNextPage();break;default:e.preventDefault=!1}}function d(t){var e={originalEvent:t.originalEvent};this.raiseEvent("canvas-key-press",e)}function v(i){var n;document.activeElement===this.canvas||this.canvas.focus(),this.viewport.flipped&&(i.position.x=this.viewport.getContainerSize().x-i.position.x);var r={tracker:i.eventSource,position:i.position,quick:i.quick,shift:i.shift,originalEvent:i.originalEvent,originalTarget:i.originalTarget,preventDefaultAction:!1};this.raiseEvent("canvas-click",r),!r.preventDefaultAction&&this.viewport&&i.quick&&(!0===(n=this.gestureSettingsByDeviceType(i.pointerType)).clickToZoom&&(this.viewport.zoomBy(i.shift?1/this.zoomPerClick:this.zoomPerClick,n.zoomToRefPoint?this.viewport.pointFromPixel(i.position,!0):null),this.viewport.applyConstraints()),n.dblClickDragToZoom&&(!0===e[this.hash].draggingToZoom?(e[this.hash].lastClickTime=null,e[this.hash].draggingToZoom=!1):e[this.hash].lastClickTime=t.now()))}function g(t){var e,i={tracker:t.eventSource,position:t.position,shift:t.shift,originalEvent:t.originalEvent,preventDefaultAction:!1};this.raiseEvent("canvas-double-click",i),!i.preventDefaultAction&&this.viewport&&(e=this.gestureSettingsByDeviceType(t.pointerType)).dblClickToZoom&&(this.viewport.zoomBy(t.shift?1/this.zoomPerClick:this.zoomPerClick,e.zoomToRefPoint?this.viewport.pointFromPixel(t.position,!0):null),this.viewport.applyConstraints())}function y(t){var i,n={tracker:t.eventSource,pointerType:t.pointerType,position:t.position,delta:t.delta,speed:t.speed,direction:t.direction,shift:t.shift,originalEvent:t.originalEvent,preventDefaultAction:!1};if(this.raiseEvent("canvas-drag",n),i=this.gestureSettingsByDeviceType(t.pointerType),!n.preventDefaultAction&&this.viewport)if(i.dblClickDragToZoom&&e[this.hash].draggingToZoom){var r=Math.pow(this.zoomPerDblClickDrag,t.delta.y/50);this.viewport.zoomBy(r)}else if(i.dragToPan&&!e[this.hash].draggingToZoom){if(this.panHorizontal||(t.delta.x=0),this.panVertical||(t.delta.y=0),this.viewport.flipped&&(t.delta.x=-t.delta.x),this.constrainDuringPan){var o=this.viewport.deltaPointsFromPixels(t.delta.negate());this.viewport.centerSpringX.target.value+=o.x,this.viewport.centerSpringY.target.value+=o.y;var a=this.viewport.getConstrainedBounds();this.viewport.centerSpringX.target.value-=o.x,this.viewport.centerSpringY.target.value-=o.y,a.xConstrained&&(t.delta.x=0),a.yConstrained&&(t.delta.y=0)}this.viewport.panBy(this.viewport.deltaPointsFromPixels(t.delta.negate()),i.flickEnabled&&!this.constrainDuringPan)}}function m(i){var n,r={tracker:i.eventSource,pointerType:i.pointerType,position:i.position,speed:i.speed,direction:i.direction,shift:i.shift,originalEvent:i.originalEvent,preventDefaultAction:!1};if(this.raiseEvent("canvas-drag-end",r),n=this.gestureSettingsByDeviceType(i.pointerType),!r.preventDefaultAction&&this.viewport){if(!e[this.hash].draggingToZoom&&n.flickEnabled&&i.speed>=n.flickMinSpeed){var o=0;this.panHorizontal&&(o=n.flickMomentum*i.speed*Math.cos(i.direction));var a=0;this.panVertical&&(a=n.flickMomentum*i.speed*Math.sin(i.direction));var s=this.viewport.pixelFromPoint(this.viewport.getCenter(!0)),l=this.viewport.pointFromPixel(new t.Point(s.x-o,s.y-a));this.viewport.panTo(l,!1)}this.viewport.applyConstraints()}n.dblClickDragToZoom&&!0===e[this.hash].draggingToZoom&&(e[this.hash].draggingToZoom=!1)}function w(t){this.raiseEvent("canvas-enter",{tracker:t.eventSource,pointerType:t.pointerType,position:t.position,buttons:t.buttons,pointers:t.pointers,insideElementPressed:t.insideElementPressed,buttonDownAny:t.buttonDownAny,originalEvent:t.originalEvent})}function x(t){this.raiseEvent("canvas-exit",{tracker:t.eventSource,pointerType:t.pointerType,position:t.position,buttons:t.buttons,pointers:t.pointers,insideElementPressed:t.insideElementPressed,buttonDownAny:t.buttonDownAny,originalEvent:t.originalEvent})}function b(i){if(this.raiseEvent("canvas-press",{tracker:i.eventSource,pointerType:i.pointerType,position:i.position,insideElementPressed:i.insideElementPressed,insideElementReleased:i.insideElementReleased,originalEvent:i.originalEvent}),this.gestureSettingsByDeviceType(i.pointerType).dblClickDragToZoom){var n=e[this.hash].lastClickTime,r=t.now();if(null===n)return;r-n<this.dblClickTimeThreshold&&(e[this.hash].draggingToZoom=!0),e[this.hash].lastClickTime=null}}function _(t){this.raiseEvent("canvas-release",{tracker:t.eventSource,pointerType:t.pointerType,position:t.position,insideElementPressed:t.insideElementPressed,insideElementReleased:t.insideElementReleased,originalEvent:t.originalEvent})}function T(t){this.raiseEvent("canvas-nonprimary-press",{tracker:t.eventSource,position:t.position,pointerType:t.pointerType,button:t.button,buttons:t.buttons,originalEvent:t.originalEvent})}function S(t){this.raiseEvent("canvas-nonprimary-release",{tracker:t.eventSource,position:t.position,pointerType:t.pointerType,button:t.button,buttons:t.buttons,originalEvent:t.originalEvent})}function P(t){var e,i,n,r={tracker:t.eventSource,pointerType:t.pointerType,gesturePoints:t.gesturePoints,lastCenter:t.lastCenter,center:t.center,lastDistance:t.lastDistance,distance:t.distance,shift:t.shift,originalEvent:t.originalEvent,preventDefaultPanAction:!1,preventDefaultZoomAction:!1,preventDefaultRotateAction:!1};if(this.raiseEvent("canvas-pinch",r),this.viewport&&(!(e=this.gestureSettingsByDeviceType(t.pointerType)).pinchToZoom||r.preventDefaultPanAction&&r.preventDefaultZoomAction||(i=this.viewport.pointFromPixel(t.center,!0),e.zoomToRefPoint&&!r.preventDefaultPanAction&&(n=this.viewport.pointFromPixel(t.lastCenter,!0).minus(i),this.panHorizontal||(n.x=0),this.panVertical||(n.y=0),this.viewport.panBy(n,!0)),r.preventDefaultZoomAction||this.viewport.zoomBy(t.distance/t.lastDistance,i,!0),this.viewport.applyConstraints()),e.pinchRotate&&!r.preventDefaultRotateAction)){var o=Math.atan2(t.gesturePoints[0].currentPos.y-t.gesturePoints[1].currentPos.y,t.gesturePoints[0].currentPos.x-t.gesturePoints[1].currentPos.x),a=Math.atan2(t.gesturePoints[0].lastPos.y-t.gesturePoints[1].lastPos.y,t.gesturePoints[0].lastPos.x-t.gesturePoints[1].lastPos.x);i=this.viewport.pointFromPixel(t.center,!0),this.viewport.rotateTo(this.viewport.getRotation(!0)+(o-a)*(180/Math.PI),i,!0)}}function E(t){this.raiseEvent("canvas-focus",{tracker:t.eventSource,originalEvent:t.originalEvent})}function C(t){this.raiseEvent("canvas-blur",{tracker:t.eventSource,originalEvent:t.originalEvent})}function O(e){var i,n,r,o;(o=t.now())-this._lastScrollTime>this.minScrollDeltaTime?(this._lastScrollTime=o,i={tracker:e.eventSource,position:e.position,scroll:e.scroll,shift:e.shift,originalEvent:e.originalEvent,preventDefaultAction:!1,preventDefault:!0},this.raiseEvent("canvas-scroll",i),!i.preventDefaultAction&&this.viewport&&(this.viewport.flipped&&(e.position.x=this.viewport.getContainerSize().x-e.position.x),(n=this.gestureSettingsByDeviceType(e.pointerType)).scrollToZoom&&(r=Math.pow(this.zoomPerScroll,e.scroll),this.viewport.zoomBy(r,n.zoomToRefPoint?this.viewport.pointFromPixel(e.position,!0):null),this.viewport.applyConstraints())),e.preventDefault=i.preventDefault):e.preventDefault=!0}function R(t){e[this.hash].mouseInside=!0,h(this),this.raiseEvent("container-enter",{tracker:t.eventSource,pointerType:t.pointerType,position:t.position,buttons:t.buttons,pointers:t.pointers,insideElementPressed:t.insideElementPressed,buttonDownAny:t.buttonDownAny,originalEvent:t.originalEvent})}function k(t){t.pointers<1&&(e[this.hash].mouseInside=!1,e[this.hash].animating||l(this)),this.raiseEvent("container-exit",{tracker:t.eventSource,pointerType:t.pointerType,position:t.position,buttons:t.buttons,pointers:t.pointers,insideElementPressed:t.insideElementPressed,buttonDownAny:t.buttonDownAny,originalEvent:t.originalEvent})}function I(i){!function(i){if(i._opening||!e[i.hash])return;if(i.autoResize||e[i.hash].forceResize){var r;if(i._autoResizePolling){r=n(i.container);var o=e[i.hash].prevContainerSize;r.equals(o)||(e[i.hash].needsResize=!0)}e[i.hash].needsResize&&function(i,n){var r,o=i.viewport,a=o.getZoom(),s=o.getCenter();if(o.resize(n,i.preserveImageSizeOnResize),o.panTo(s,!0),i.preserveImageSizeOnResize)r=e[i.hash].prevContainerSize.x/n.x;else{var l=new t.Point(0,0),h=new t.Point(e[i.hash].prevContainerSize.x,e[i.hash].prevContainerSize.y).distanceTo(l);r=new t.Point(n.x,n.y).distanceTo(l)/h*e[i.hash].prevContainerSize.x/n.x}o.zoomTo(a*r,null,!0),e[i.hash].prevContainerSize=n,e[i.hash].forceRedraw=!0,e[i.hash].needsResize=!1,e[i.hash].forceResize=!1}(i,r||n(i.container))}var a=i.viewport.update(),s=i.world.update()||a;a&&i.raiseEvent("viewport-change");i.referenceStrip&&(s=i.referenceStrip.update(i.viewport)||s);var u=e[i.hash].animating;!u&&s&&(i.raiseEvent("animation-start"),h(i));var c=u&&!s;c&&(e[i.hash].animating=!1);(s||c||e[i.hash].forceRedraw||i.world.needsDraw())&&(!function(t){t.imageLoader.clear(),t.drawer.clear(),t.world.draw(),t.raiseEvent("update-viewport",{})}(i),i._drawOverlays(),i.navigator&&i.navigator.update(i.viewport),e[i.hash].forceRedraw=!1,s&&i.raiseEvent("animation"));c&&(i.raiseEvent("animation-finish"),e[i.hash].mouseInside||l(i));e[i.hash].animating=s}(i),i.isOpen()?i._updateRequestId=a(i,I):i._updateRequestId=!1}function D(t,e){return t?t+e:e}function M(){e[this.hash].lastZoomTime=t.now(),e[this.hash].zoomFactor=this.zoomPerSecond,e[this.hash].zooming=!0,z(this)}function A(){e[this.hash].lastZoomTime=t.now(),e[this.hash].zoomFactor=1/this.zoomPerSecond,e[this.hash].zooming=!0,z(this)}function L(){e[this.hash].zooming=!1}function z(e){t.requestAnimationFrame(t.delegate(e,j))}function j(){var i,n,r;e[this.hash].zooming&&this.viewport&&(n=(i=t.now())-e[this.hash].lastZoomTime,r=Math.pow(e[this.hash].zoomFactor,n/1e3),this.viewport.zoomBy(r),this.viewport.applyConstraints(),e[this.hash].lastZoomTime=i,z(this))}function B(){this.viewport&&(e[this.hash].zooming=!1,this.viewport.zoomBy(this.zoomPerClick/1),this.viewport.applyConstraints())}function F(){this.viewport&&(e[this.hash].zooming=!1,this.viewport.zoomBy(1/this.zoomPerClick),this.viewport.applyConstraints())}function N(){this.buttonGroup&&(this.buttonGroup.emulateEnter(),this.buttonGroup.emulateLeave())}function H(){this.viewport&&this.viewport.goHome()}function W(){this.isFullPage()&&!t.isFullScreen()?this.setFullPage(!1):this.setFullScreen(!this.isFullPage()),this.buttonGroup&&this.buttonGroup.emulateLeave(),this.fullPageButton.element.focus(),this.viewport&&this.viewport.applyConstraints()}function V(){if(this.viewport){var t=this.viewport.getRotation();this.viewport.flipped?t+=this.rotationIncrement:t-=this.rotationIncrement,this.viewport.setRotation(t)}}function U(){if(this.viewport){var t=this.viewport.getRotation();this.viewport.flipped?t-=this.rotationIncrement:t+=this.rotationIncrement,this.viewport.setRotation(t)}}function G(){this.viewport.toggleFlip()}t.Viewer=function(r){var o,s,h=arguments,u=this;if(t.isPlainObject(r)||(r={id:h[0],xmlPath:h.length>1?h[1]:void 0,prefixUrl:h.length>2?h[2]:void 0,controls:h.length>3?h[3]:void 0,overlays:h.length>4?h[4]:void 0}),r.config&&(t.extend(!0,r,r.config),delete r.config),t.extend(!0,this,{id:r.id,hash:r.hash||i++,initialPage:0,element:null,container:null,canvas:null,overlays:[],overlaysContainer:null,previousBody:[],customControls:[],source:null,drawer:null,world:null,viewport:null,navigator:null,collectionViewport:null,collectionDrawer:null,navImages:null,buttonGroup:null,profiler:null},t.DEFAULT_SETTINGS,r),void 0===this.hash)throw new Error("A hash must be defined, either by specifying options.id or options.hash.");for(void 0!==e[this.hash]&&t.console.warn("Hash "+this.hash+" has already been used."),e[this.hash]={fsBoundsDelta:new t.Point(1,1),prevContainerSize:null,animating:!1,forceRedraw:!1,needsResize:!1,forceResize:!1,mouseInside:!1,group:null,zooming:!1,zoomFactor:null,lastZoomTime:null,fullPage:!1,onfullscreenchange:null,lastClickTime:null,draggingToZoom:!1},this._sequenceIndex=0,this._firstOpen=!0,this._updateRequestId=null,this._loadQueue=[],this.currentOverlays=[],this._updatePixelDensityRatioBind=null,this._lastScrollTime=t.now(),t.EventSource.call(this),this.addHandler("open-failed",function(e){var i=t.getString("Errors.OpenFailed",e.eventSource,e.message);u._showMessage(i)}),t.ControlDock.call(this,r),this.xmlPath&&(this.tileSources=[this.xmlPath]),this.element=this.element||document.getElementById(this.id),this.canvas=t.makeNeutralElement("div"),this.canvas.className="openseadragon-canvas",(s=this.canvas.style).width="100%",s.height="100%",s.overflow="hidden",s.position="absolute",s.top="0px",s.left="0px",t.setElementTouchActionNone(this.canvas),""!==r.tabIndex&&(this.canvas.tabIndex=void 0===r.tabIndex?0:r.tabIndex),this.container.className="openseadragon-container",function(t){t.width="100%",t.height="100%",t.position="relative",t.overflow="hidden",t.left="0px",t.top="0px",t.textAlign="left"}(this.container.style),t.setElementTouchActionNone(this.container),this.container.insertBefore(this.canvas,this.container.firstChild),this.element.appendChild(this.container),this.bodyWidth=document.body.style.width,this.bodyHeight=document.body.style.height,this.bodyOverflow=document.body.style.overflow,this.docOverflow=document.documentElement.style.overflow,this.innerTracker=new t.MouseTracker({userData:"Viewer.innerTracker",element:this.canvas,startDisabled:!this.mouseNavEnabled,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,dblClickTimeThreshold:this.dblClickTimeThreshold,dblClickDistThreshold:this.dblClickDistThreshold,contextMenuHandler:t.delegate(this,p),keyDownHandler:t.delegate(this,f),keyHandler:t.delegate(this,d),clickHandler:t.delegate(this,v),dblClickHandler:t.delegate(this,g),dragHandler:t.delegate(this,y),dragEndHandler:t.delegate(this,m),enterHandler:t.delegate(this,w),leaveHandler:t.delegate(this,x),pressHandler:t.delegate(this,b),releaseHandler:t.delegate(this,_),nonPrimaryPressHandler:t.delegate(this,T),nonPrimaryReleaseHandler:t.delegate(this,S),scrollHandler:t.delegate(this,O),pinchHandler:t.delegate(this,P),focusHandler:t.delegate(this,E),blurHandler:t.delegate(this,C)}),this.outerTracker=new t.MouseTracker({userData:"Viewer.outerTracker",element:this.container,startDisabled:!this.mouseNavEnabled,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,dblClickTimeThreshold:this.dblClickTimeThreshold,dblClickDistThreshold:this.dblClickDistThreshold,enterHandler:t.delegate(this,R),leaveHandler:t.delegate(this,k)}),this.toolbar&&(this.toolbar=new t.ControlDock({element:this.toolbar})),this.bindStandardControls(),e[this.hash].prevContainerSize=n(this.container),window.ResizeObserver?(this._autoResizePolling=!1,this._resizeObserver=new ResizeObserver(function(){e[u.hash].needsResize=!0}),this._resizeObserver.observe(this.container,{})):this._autoResizePolling=!0,this.world=new t.World({viewer:this}),this.world.addHandler("add-item",function(t){u.source=u.world.getItemAt(0).source,e[u.hash].forceRedraw=!0,u._updateRequestId||(u._updateRequestId=a(u,I))}),this.world.addHandler("remove-item",function(t){u.world.getItemCount()?u.source=u.world.getItemAt(0).source:u.source=null,e[u.hash].forceRedraw=!0}),this.world.addHandler("metrics-change",function(t){u.viewport&&u.viewport._setContentBounds(u.world.getHomeBounds(),u.world.getContentFactor())}),this.world.addHandler("item-index-change",function(t){u.source=u.world.getItemAt(0).source}),this.viewport=new t.Viewport({containerSize:e[this.hash].prevContainerSize,springStiffness:this.springStiffness,animationTime:this.animationTime,minZoomImageRatio:this.minZoomImageRatio,maxZoomPixelRatio:this.maxZoomPixelRatio,visibilityRatio:this.visibilityRatio,wrapHorizontal:this.wrapHorizontal,wrapVertical:this.wrapVertical,defaultZoomLevel:this.defaultZoomLevel,minZoomLevel:this.minZoomLevel,maxZoomLevel:this.maxZoomLevel,viewer:this,degrees:this.degrees,flipped:this.flipped,navigatorRotate:this.navigatorRotate,homeFillsViewer:this.homeFillsViewer,margins:this.viewportMargins,silenceMultiImageWarnings:this.silenceMultiImageWarnings}),this.viewport._setContentBounds(this.world.getHomeBounds(),this.world.getContentFactor()),this.imageLoader=new t.ImageLoader({jobLimit:this.imageLoaderLimit,timeout:r.timeout,tileRetryMax:this.tileRetryMax,tileRetryDelay:this.tileRetryDelay}),this.tileCache=new t.TileCache({maxImageCacheCount:this.maxImageCacheCount}),this.drawer=new t.Drawer({viewer:this,viewport:this.viewport,element:this.canvas,debugGridColor:this.debugGridColor}),this.overlaysContainer=t.makeNeutralElement("div"),this.canvas.appendChild(this.overlaysContainer),this.drawer.canRotate()||(this.rotateLeft&&(o=this.buttonGroup.buttons.indexOf(this.rotateLeft),this.buttonGroup.buttons.splice(o,1),this.buttonGroup.element.removeChild(this.rotateLeft.element)),this.rotateRight&&(o=this.buttonGroup.buttons.indexOf(this.rotateRight),this.buttonGroup.buttons.splice(o,1),this.buttonGroup.element.removeChild(this.rotateRight.element))),this._addUpdatePixelDensityRatioEvent(),this.showNavigator&&(this.navigator=new t.Navigator({element:this.navigatorElement,id:this.navigatorId,position:this.navigatorPosition,sizeRatio:this.navigatorSizeRatio,maintainSizeRatio:this.navigatorMaintainSizeRatio,top:this.navigatorTop,left:this.navigatorLeft,width:this.navigatorWidth,height:this.navigatorHeight,autoResize:this.navigatorAutoResize,autoFade:this.navigatorAutoFade,prefixUrl:this.prefixUrl,viewer:this,navigatorRotate:this.navigatorRotate,background:this.navigatorBackground,opacity:this.navigatorOpacity,borderColor:this.navigatorBorderColor,displayRegionColor:this.navigatorDisplayRegionColor,crossOriginPolicy:this.crossOriginPolicy,animationTime:this.animationTime})),this.sequenceMode&&this.bindSequenceControls(),this.tileSources&&this.open(this.tileSources),o=0;o<this.customControls.length;o++)this.addControl(this.customControls[o].id,{anchor:this.customControls[o].anchor});t.requestAnimationFrame(function(){l(u)}),void 0===this.imageSmoothingEnabled||this.imageSmoothingEnabled||this.drawer.setImageSmoothingEnabled(this.imageSmoothingEnabled),t._viewers.set(this.element,this)},t.extend(t.Viewer.prototype,t.EventSource.prototype,t.ControlDock.prototype,{isOpen:function(){return!!this.world.getItemCount()},openDzi:function(e){return t.console.error("[Viewer.openDzi] this function is deprecated; use Viewer.open() instead."),this.open(e)},openTileSource:function(e){return t.console.error("[Viewer.openTileSource] this function is deprecated; use Viewer.open() instead."),this.open(e)},get buttons(){return t.console.warn("Viewer.buttons is deprecated; Please use Viewer.buttonGroup"),this.buttonGroup},open:function(e,i){var n=this;if(this.close(),!e)return this;if(this.sequenceMode&&t.isArray(e))return this.referenceStrip&&(this.referenceStrip.destroy(),this.referenceStrip=null),void 0===i||isNaN(i)||(this.initialPage=i),this.tileSources=e,this._sequenceIndex=Math.max(0,Math.min(this.tileSources.length-1,this.initialPage)),this.tileSources.length&&(this.open(this.tileSources[this._sequenceIndex]),this.showReferenceStrip&&this.addReferenceStrip()),this._updateSequenceButtons(this._sequenceIndex),this;if(t.isArray(e)||(e=[e]),!e.length)return this;this._opening=!0;for(var o,a=e.length,s=0,l=0,h=function(){if(s+l===a)if(s){!n._firstOpen&&n.preserveViewport||(n.viewport.goHome(!0),n.viewport.update()),n._firstOpen=!1;var t=e[0];if(t.tileSource&&(t=t.tileSource),n.overlays&&!n.preserveOverlays)for(var i=0;i<n.overlays.length;i++)n.currentOverlays[i]=r(n,n.overlays[i]);n._drawOverlays(),n._opening=!1,n.raiseEvent("open",{source:t})}else n._opening=!1,n.raiseEvent("open-failed",o)},u=function(e){t.isPlainObject(e)&&e.tileSource||(e={tileSource:e}),void 0!==e.index&&(t.console.error("[Viewer.open] setting indexes here is not supported; use addTiledImage instead"),delete e.index),void 0===e.collectionImmediately&&(e.collectionImmediately=!0);var i=e.success;e.success=function(t){if(s++,e.tileSource.overlays)for(var r=0;r<e.tileSource.overlays.length;r++)n.addOverlay(e.tileSource.overlays[r]);i&&i(t),h()};var r=e.error;e.error=function(t){l++,o||(o=t),r&&r(t),h()},n.addTiledImage(e)},c=0;c<e.length;c++)u(e[c]);return this},close:function(){return e[this.hash]?(this._opening=!1,this.navigator&&this.navigator.close(),this.preserveOverlays||(this.clearOverlays(),this.overlaysContainer.innerHTML=""),e[this.hash].animating=!1,this.world.removeAll(),this.imageLoader.clear(),this.raiseEvent("close"),this):this},destroy:function(){if(e[this.hash]){if(this.raiseEvent("before-destroy"),this._removeUpdatePixelDensityRatioEvent(),this.close(),this.clearOverlays(),this.overlaysContainer.innerHTML="",this._resizeObserver&&this._resizeObserver.disconnect(),this.referenceStrip&&(this.referenceStrip.destroy(),this.referenceStrip=null),null!==this._updateRequestId&&(t.cancelAnimationFrame(this._updateRequestId),this._updateRequestId=null),this.drawer&&this.drawer.destroy(),this.navigator&&(this.navigator.destroy(),e[this.navigator.hash]=null,delete e[this.navigator.hash],this.navigator=null),this.buttonGroup)this.buttonGroup.destroy();else if(this.customButtons)for(;this.customButtons.length;)this.customButtons.pop().destroy();if(this.paging&&this.paging.destroy(),this.element)for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild);this.container.onsubmit=null,this.clearControls(),this.innerTracker&&this.innerTracker.destroy(),this.outerTracker&&this.outerTracker.destroy(),e[this.hash]=null,delete e[this.hash],this.canvas=null,this.container=null,t._viewers.delete(this.element),this.element=null,this.raiseEvent("destroy"),this.removeAllHandlers()}},isMouseNavEnabled:function(){return this.innerTracker.isTracking()},setMouseNavEnabled:function(t){return this.innerTracker.setTracking(t),this.outerTracker.setTracking(t),this.raiseEvent("mouse-enabled",{enabled:t}),this},areControlsEnabled:function(){var t,e=this.controls.length;for(t=0;t<this.controls.length;t++)e=e&&this.controls[t].isVisible();return e},setControlsEnabled:function(t){return t?h(this):l(this),this.raiseEvent("controls-enabled",{enabled:t}),this},setDebugMode:function(t){for(var e=0;e<this.world.getItemCount();e++)this.world.getItemAt(e).debugMode=t;this.debugMode=t,this.forceRedraw()},setAjaxHeaders:function(e,i){if(null===e&&(e={}),t.isPlainObject(e)&&(void 0===i&&(i=!0),this.ajaxHeaders=e,i)){for(var n=0;n<this.world.getItemCount();n++)this.world.getItemAt(n)._updateAjaxHeaders(!0);if(this.navigator&&this.navigator.setAjaxHeaders(this.ajaxHeaders,!0),this.referenceStrip&&this.referenceStrip.miniViewers)for(var r in this.referenceStrip.miniViewers)this.referenceStrip.miniViewers[r].setAjaxHeaders(this.ajaxHeaders,!0)}},addButton:function(t){this.buttonGroup.addButton(t)},isFullPage:function(){return e[this.hash].fullPage},setFullPage:function(i){var n,r,o=document.body,a=o.style,s=document.documentElement.style,l=this;if(i===this.isFullPage())return this;var h={fullPage:i,preventDefaultAction:!1};if(this.raiseEvent("pre-full-page",h),h.preventDefaultAction)return this;if(i){for(this.elementSize=t.getElementSize(this.element),this.pageScroll=t.getPageScroll(),this.elementMargin=this.element.style.margin,this.element.style.margin="0",this.elementPadding=this.element.style.padding,this.element.style.padding="0",this.bodyMargin=a.margin,this.docMargin=s.margin,a.margin="0",s.margin="0",this.bodyPadding=a.padding,this.docPadding=s.padding,a.padding="0",s.padding="0",this.bodyWidth=a.width,this.docWidth=s.width,a.width="100%",s.width="100%",this.bodyHeight=a.height,this.docHeight=s.height,a.height="100%",s.height="100%",this.bodyDisplay=a.display,a.display="block",this.previousBody=[],e[this.hash].prevElementParent=this.element.parentNode,e[this.hash].prevNextSibling=this.element.nextSibling,e[this.hash].prevElementWidth=this.element.style.width,e[this.hash].prevElementHeight=this.element.style.height,n=o.childNodes.length,r=0;r<n;r++)this.previousBody.push(o.childNodes[0]),o.removeChild(o.childNodes[0]);this.toolbar&&this.toolbar.element&&(this.toolbar.parentNode=this.toolbar.element.parentNode,this.toolbar.nextSibling=this.toolbar.element.nextSibling,o.appendChild(this.toolbar.element),t.addClass(this.toolbar.element,"fullpage")),t.addClass(this.element,"fullpage"),o.appendChild(this.element),this.element.style.height="100vh",this.element.style.width="100vw",this.toolbar&&this.toolbar.element&&(this.element.style.height=t.getElementSize(this.element).y-t.getElementSize(this.toolbar.element).y+"px"),e[this.hash].fullPage=!0,t.delegate(this,R)({})}else{for(this.element.style.margin=this.elementMargin,this.element.style.padding=this.elementPadding,a.margin=this.bodyMargin,s.margin=this.docMargin,a.padding=this.bodyPadding,s.padding=this.docPadding,a.width=this.bodyWidth,s.width=this.docWidth,a.height=this.bodyHeight,s.height=this.docHeight,a.display=this.bodyDisplay,o.removeChild(this.element),n=this.previousBody.length,r=0;r<n;r++)o.appendChild(this.previousBody.shift());t.removeClass(this.element,"fullpage"),e[this.hash].prevElementParent.insertBefore(this.element,e[this.hash].prevNextSibling),this.toolbar&&this.toolbar.element&&(o.removeChild(this.toolbar.element),t.removeClass(this.toolbar.element,"fullpage"),this.toolbar.parentNode.insertBefore(this.toolbar.element,this.toolbar.nextSibling),delete this.toolbar.parentNode,delete this.toolbar.nextSibling),this.element.style.width=e[this.hash].prevElementWidth,this.element.style.height=e[this.hash].prevElementHeight;var u=0,c=function(){t.setPageScroll(l.pageScroll);var e=t.getPageScroll();++u<10&&(e.x!==l.pageScroll.x||e.y!==l.pageScroll.y)&&t.requestAnimationFrame(c)};t.requestAnimationFrame(c),e[this.hash].fullPage=!1,t.delegate(this,k)({})}return this.navigator&&this.viewport&&this.navigator.update(this.viewport),this.raiseEvent("full-page",{fullPage:i}),this},setFullScreen:function(e){var i=this;if(!t.supportsFullScreen)return this.setFullPage(e);if(t.isFullScreen()===e)return this;var n={fullScreen:e,preventDefaultAction:!1};if(this.raiseEvent("pre-full-screen",n),n.preventDefaultAction)return this;if(e){if(this.setFullPage(!0),!this.isFullPage())return this;this.fullPageStyleWidth=this.element.style.width,this.fullPageStyleHeight=this.element.style.height,this.element.style.width="100%",this.element.style.height="100%";var r=function(){var e=t.isFullScreen();e||(t.removeEvent(document,t.fullScreenEventName,r),t.removeEvent(document,t.fullScreenErrorEventName,r),i.setFullPage(!1),i.isFullPage()&&(i.element.style.width=i.fullPageStyleWidth,i.element.style.height=i.fullPageStyleHeight)),i.navigator&&i.viewport&&setTimeout(function(){i.navigator.update(i.viewport)}),i.raiseEvent("full-screen",{fullScreen:e})};t.addEvent(document,t.fullScreenEventName,r),t.addEvent(document,t.fullScreenErrorEventName,r),t.requestFullScreen(document.body)}else t.exitFullScreen();return this},isVisible:function(){return"hidden"!==this.container.style.visibility},isFullScreen:function(){return t.isFullScreen()&&this.isFullPage()},setVisible:function(t){return this.container.style.visibility=t?"":"hidden",this.raiseEvent("visible",{visible:t}),this},addTiledImage:function(e){t.console.assert(e,"[Viewer.addTiledImage] options is required"),t.console.assert(e.tileSource,"[Viewer.addTiledImage] options.tileSource is required"),t.console.assert(!e.replace||e.index>-1&&e.index<this.world.getItemCount(),"[Viewer.addTiledImage] if options.replace is used, options.index must be a valid index in Viewer.world");var i=this;e.replace&&(e.replaceItem=i.world.getItemAt(e.index)),this._hideMessage(),void 0===e.placeholderFillStyle&&(e.placeholderFillStyle=this.placeholderFillStyle),void 0===e.opacity&&(e.opacity=this.opacity),void 0===e.preload&&(e.preload=this.preload),void 0===e.compositeOperation&&(e.compositeOperation=this.compositeOperation),void 0===e.crossOriginPolicy&&(e.crossOriginPolicy=void 0!==e.tileSource.crossOriginPolicy?e.tileSource.crossOriginPolicy:this.crossOriginPolicy),void 0===e.ajaxWithCredentials&&(e.ajaxWithCredentials=this.ajaxWithCredentials),void 0===e.loadTilesWithAjax&&(e.loadTilesWithAjax=this.loadTilesWithAjax),t.isPlainObject(e.ajaxHeaders)||(e.ajaxHeaders={});var n={options:e};function r(t){for(var r=0;r<i._loadQueue.length;r++)if(i._loadQueue[r]===n){i._loadQueue.splice(r,1);break}0===i._loadQueue.length&&o(n),i.raiseEvent("add-item-failed",t),e.error&&e.error(t)}function o(t){i.collectionMode&&(i.world.arrange({immediately:t.options.collectionImmediately,rows:i.collectionRows,columns:i.collectionColumns,layout:i.collectionLayout,tileSize:i.collectionTileSize,tileMargin:i.collectionTileMargin}),i.world.setAutoRefigureSizes(!0))}function a(){for(var e,n,r;i._loadQueue.length&&(e=i._loadQueue[0]).tileSource;){if(i._loadQueue.splice(0,1),e.options.replace){var a=i.world.getIndexOfItem(e.options.replaceItem);-1!==a&&(e.options.index=a),i.world.removeItem(e.options.replaceItem)}n=new t.TiledImage({viewer:i,source:e.tileSource,viewport:i.viewport,drawer:i.drawer,tileCache:i.tileCache,imageLoader:i.imageLoader,x:e.options.x,y:e.options.y,width:e.options.width,height:e.options.height,fitBounds:e.options.fitBounds,fitBoundsPlacement:e.options.fitBoundsPlacement,clip:e.options.clip,placeholderFillStyle:e.options.placeholderFillStyle,opacity:e.options.opacity,preload:e.options.preload,degrees:e.options.degrees,flipped:e.options.flipped,compositeOperation:e.options.compositeOperation,springStiffness:i.springStiffness,animationTime:i.animationTime,minZoomImageRatio:i.minZoomImageRatio,wrapHorizontal:i.wrapHorizontal,wrapVertical:i.wrapVertical,immediateRender:i.immediateRender,blendTime:i.blendTime,alwaysBlend:i.alwaysBlend,minPixelRatio:i.minPixelRatio,smoothTileEdgesMinZoom:i.smoothTileEdgesMinZoom,iOSDevice:i.iOSDevice,crossOriginPolicy:e.options.crossOriginPolicy,ajaxWithCredentials:e.options.ajaxWithCredentials,loadTilesWithAjax:e.options.loadTilesWithAjax,ajaxHeaders:e.options.ajaxHeaders,debugMode:i.debugMode,subPixelRoundingForTransparency:i.subPixelRoundingForTransparency}),i.collectionMode&&i.world.setAutoRefigureSizes(!1),i.navigator&&(r=t.extend({},e.options,{replace:!1,originalTiledImage:n,tileSource:e.tileSource}),i.navigator.addTiledImage(r)),i.world.addItem(n,{index:e.options.index}),0===i._loadQueue.length&&o(e),1!==i.world.getItemCount()||i.preserveViewport||i.viewport.goHome(!0),e.options.success&&e.options.success({item:n})}}t.isArray(e.tileSource)?setTimeout(function(){r({message:"[Viewer.addTiledImage] Sequences can not be added; add them one at a time instead.",source:e.tileSource,options:e})}):(this._loadQueue.push(n),function(e,i,n,r,o){var a=e;if("string"===t.type(i))if(i.match(/^\s*<.*>\s*$/))i=t.parseXml(i);else if(i.match(/^\s*[{[].*[}\]]\s*$/))try{var s=t.parseJSON(i);i=s}catch(h){}function l(t,e){t.ready?r(t):(t.addHandler("ready",function(){r(t)}),t.addHandler("open-failed",function(t){o({message:t.message,source:e})}))}setTimeout(function(){if("string"===t.type(i))(i=new t.TileSource({url:i,crossOriginPolicy:void 0!==n.crossOriginPolicy?n.crossOriginPolicy:e.crossOriginPolicy,ajaxWithCredentials:e.ajaxWithCredentials,ajaxHeaders:n.ajaxHeaders?n.ajaxHeaders:e.ajaxHeaders,splitHashDataForPost:e.splitHashDataForPost,useCanvas:e.useCanvas,success:function(t){r(t.tileSource)}})).addHandler("open-failed",function(t){o(t)});else if(t.isPlainObject(i)||i.nodeType)if(void 0!==i.crossOriginPolicy||void 0===n.crossOriginPolicy&&void 0===e.crossOriginPolicy||(i.crossOriginPolicy=void 0!==n.crossOriginPolicy?n.crossOriginPolicy:e.crossOriginPolicy),void 0===i.ajaxWithCredentials&&(i.ajaxWithCredentials=e.ajaxWithCredentials),void 0===i.useCanvas&&(i.useCanvas=e.useCanvas),t.isFunction(i.getTileUrl)){var s=new t.TileSource(i);s.getTileUrl=i.getTileUrl,r(s)}else{var h=t.TileSource.determineType(a,i);if(!h)return void o({message:"Unable to load TileSource",source:i});var u=h.prototype.configure.apply(a,[i]);l(new h(u),i)}else l(i,i)})}(this,e.tileSource,e,function(t){n.tileSource=t,a()},function(t){t.options=e,r(t),a()}))},addSimpleImage:function(e){t.console.assert(e,"[Viewer.addSimpleImage] options is required"),t.console.assert(e.url,"[Viewer.addSimpleImage] options.url is required");var i=t.extend({},e,{tileSource:{type:"image",url:e.url}});delete i.url,this.addTiledImage(i)},addLayer:function(e){var i=this;t.console.error("[Viewer.addLayer] this function is deprecated; use Viewer.addTiledImage() instead.");var n=t.extend({},e,{success:function(t){i.raiseEvent("add-layer",{options:e,drawer:t.item})},error:function(t){i.raiseEvent("add-layer-failed",t)}});return this.addTiledImage(n),this},getLayerAtLevel:function(e){return t.console.error("[Viewer.getLayerAtLevel] this function is deprecated; use World.getItemAt() instead."),this.world.getItemAt(e)},getLevelOfLayer:function(e){return t.console.error("[Viewer.getLevelOfLayer] this function is deprecated; use World.getIndexOfItem() instead."),this.world.getIndexOfItem(e)},getLayersCount:function(){return t.console.error("[Viewer.getLayersCount] this function is deprecated; use World.getItemCount() instead."),this.world.getItemCount()},setLayerLevel:function(e,i){return t.console.error("[Viewer.setLayerLevel] this function is deprecated; use World.setItemIndex() instead."),this.world.setItemIndex(e,i)},removeLayer:function(e){return t.console.error("[Viewer.removeLayer] this function is deprecated; use World.removeItem() instead."),this.world.removeItem(e)},forceRedraw:function(){return e[this.hash].forceRedraw=!0,this},forceResize:function(){e[this.hash].needsResize=!0,e[this.hash].forceResize=!0},bindSequenceControls:function(){var e=t.delegate(this,u),i=t.delegate(this,c),n=t.delegate(this,this.goToNextPage),r=t.delegate(this,this.goToPreviousPage),o=this.navImages,a=!0;return this.showSequenceControl&&((this.previousButton||this.nextButton)&&(a=!1),this.previousButton=new t.Button({element:this.previousButton?t.getElement(this.previousButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:t.getString("Tooltips.PreviousPage"),srcRest:D(this.prefixUrl,o.previous.REST),srcGroup:D(this.prefixUrl,o.previous.GROUP),srcHover:D(this.prefixUrl,o.previous.HOVER),srcDown:D(this.prefixUrl,o.previous.DOWN),onRelease:r,onFocus:e,onBlur:i}),this.nextButton=new t.Button({element:this.nextButton?t.getElement(this.nextButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:t.getString("Tooltips.NextPage"),srcRest:D(this.prefixUrl,o.next.REST),srcGroup:D(this.prefixUrl,o.next.GROUP),srcHover:D(this.prefixUrl,o.next.HOVER),srcDown:D(this.prefixUrl,o.next.DOWN),onRelease:n,onFocus:e,onBlur:i}),this.navPrevNextWrap||this.previousButton.disable(),this.tileSources&&this.tileSources.length||this.nextButton.disable(),a&&(this.paging=new t.ButtonGroup({buttons:[this.previousButton,this.nextButton],clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold}),this.pagingControl=this.paging.element,this.toolbar?this.toolbar.addControl(this.pagingControl,{anchor:t.ControlAnchor.BOTTOM_RIGHT}):this.addControl(this.pagingControl,{anchor:this.sequenceControlAnchor||t.ControlAnchor.TOP_LEFT}))),this},bindStandardControls:function(){var e=t.delegate(this,M),i=t.delegate(this,L),n=t.delegate(this,B),r=t.delegate(this,A),o=t.delegate(this,F),a=t.delegate(this,H),s=t.delegate(this,W),l=t.delegate(this,V),h=t.delegate(this,U),p=t.delegate(this,G),f=t.delegate(this,u),d=t.delegate(this,c),v=this.navImages,g=[],y=!0;return this.showNavigationControl&&((this.zoomInButton||this.zoomOutButton||this.homeButton||this.fullPageButton||this.rotateLeftButton||this.rotateRightButton||this.flipButton)&&(y=!1),this.showZoomControl&&(g.push(this.zoomInButton=new t.Button({element:this.zoomInButton?t.getElement(this.zoomInButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:t.getString("Tooltips.ZoomIn"),srcRest:D(this.prefixUrl,v.zoomIn.REST),srcGroup:D(this.prefixUrl,v.zoomIn.GROUP),srcHover:D(this.prefixUrl,v.zoomIn.HOVER),srcDown:D(this.prefixUrl,v.zoomIn.DOWN),onPress:e,onRelease:i,onClick:n,onEnter:e,onExit:i,onFocus:f,onBlur:d})),g.push(this.zoomOutButton=new t.Button({element:this.zoomOutButton?t.getElement(this.zoomOutButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:t.getString("Tooltips.ZoomOut"),srcRest:D(this.prefixUrl,v.zoomOut.REST),srcGroup:D(this.prefixUrl,v.zoomOut.GROUP),srcHover:D(this.prefixUrl,v.zoomOut.HOVER),srcDown:D(this.prefixUrl,v.zoomOut.DOWN),onPress:r,onRelease:i,onClick:o,onEnter:r,onExit:i,onFocus:f,onBlur:d}))),this.showHomeControl&&g.push(this.homeButton=new t.Button({element:this.homeButton?t.getElement(this.homeButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:t.getString("Tooltips.Home"),srcRest:D(this.prefixUrl,v.home.REST),srcGroup:D(this.prefixUrl,v.home.GROUP),srcHover:D(this.prefixUrl,v.home.HOVER),srcDown:D(this.prefixUrl,v.home.DOWN),onRelease:a,onFocus:f,onBlur:d})),this.showFullPageControl&&g.push(this.fullPageButton=new t.Button({element:this.fullPageButton?t.getElement(this.fullPageButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:t.getString("Tooltips.FullPage"),srcRest:D(this.prefixUrl,v.fullpage.REST),srcGroup:D(this.prefixUrl,v.fullpage.GROUP),srcHover:D(this.prefixUrl,v.fullpage.HOVER),srcDown:D(this.prefixUrl,v.fullpage.DOWN),onRelease:s,onFocus:f,onBlur:d})),this.showRotationControl&&(g.push(this.rotateLeftButton=new t.Button({element:this.rotateLeftButton?t.getElement(this.rotateLeftButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:t.getString("Tooltips.RotateLeft"),srcRest:D(this.prefixUrl,v.rotateleft.REST),srcGroup:D(this.prefixUrl,v.rotateleft.GROUP),srcHover:D(this.prefixUrl,v.rotateleft.HOVER),srcDown:D(this.prefixUrl,v.rotateleft.DOWN),onRelease:l,onFocus:f,onBlur:d})),g.push(this.rotateRightButton=new t.Button({element:this.rotateRightButton?t.getElement(this.rotateRightButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:t.getString("Tooltips.RotateRight"),srcRest:D(this.prefixUrl,v.rotateright.REST),srcGroup:D(this.prefixUrl,v.rotateright.GROUP),srcHover:D(this.prefixUrl,v.rotateright.HOVER),srcDown:D(this.prefixUrl,v.rotateright.DOWN),onRelease:h,onFocus:f,onBlur:d}))),this.showFlipControl&&g.push(this.flipButton=new t.Button({element:this.flipButton?t.getElement(this.flipButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:t.getString("Tooltips.Flip"),srcRest:D(this.prefixUrl,v.flip.REST),srcGroup:D(this.prefixUrl,v.flip.GROUP),srcHover:D(this.prefixUrl,v.flip.HOVER),srcDown:D(this.prefixUrl,v.flip.DOWN),onRelease:p,onFocus:f,onBlur:d})),y?(this.buttonGroup=new t.ButtonGroup({buttons:g,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold}),this.navControl=this.buttonGroup.element,this.addHandler("open",t.delegate(this,N)),this.toolbar?this.toolbar.addControl(this.navControl,{anchor:this.navigationControlAnchor||t.ControlAnchor.TOP_LEFT}):this.addControl(this.navControl,{anchor:this.navigationControlAnchor||t.ControlAnchor.TOP_LEFT})):this.customButtons=g),this},currentPage:function(){return this._sequenceIndex},goToPage:function(t){return this.tileSources&&t>=0&&t<this.tileSources.length&&(this._sequenceIndex=t,this._updateSequenceButtons(t),this.open(this.tileSources[t]),this.referenceStrip&&this.referenceStrip.setFocus(t),this.raiseEvent("page",{page:t})),this},addOverlay:function(e,i,n,a){var s;if(s=t.isPlainObject(e)?e:{element:e,location:i,placement:n,onDraw:a},e=t.getElement(s.element),o(this.currentOverlays,e)>=0)return this;var l=r(this,s);return this.currentOverlays.push(l),l.drawHTML(this.overlaysContainer,this.viewport),this.raiseEvent("add-overlay",{element:e,location:s.location,placement:s.placement}),this},updateOverlay:function(i,n,r){var a;return i=t.getElement(i),(a=o(this.currentOverlays,i))>=0&&(this.currentOverlays[a].update(n,r),e[this.hash].forceRedraw=!0,this.raiseEvent("update-overlay",{element:i,location:n,placement:r})),this},removeOverlay:function(i){var n;return i=t.getElement(i),(n=o(this.currentOverlays,i))>=0&&(this.currentOverlays[n].destroy(),this.currentOverlays.splice(n,1),e[this.hash].forceRedraw=!0,this.raiseEvent("remove-overlay",{element:i})),this},clearOverlays:function(){for(;this.currentOverlays.length>0;)this.currentOverlays.pop().destroy();return e[this.hash].forceRedraw=!0,this.raiseEvent("clear-overlay",{}),this},getOverlayById:function(e){var i;return e=t.getElement(e),(i=o(this.currentOverlays,e))>=0?this.currentOverlays[i]:null},_updateSequenceButtons:function(t){this.nextButton&&(this.tileSources&&this.tileSources.length-1!==t?this.nextButton.enable():this.navPrevNextWrap||this.nextButton.disable()),this.previousButton&&(t>0?this.previousButton.enable():this.navPrevNextWrap||this.previousButton.disable())},_showMessage:function(e){this._hideMessage();var i=t.makeNeutralElement("div");i.appendChild(document.createTextNode(e)),this.messageDiv=t.makeCenteredNode(i),t.addClass(this.messageDiv,"openseadragon-message"),this.container.appendChild(this.messageDiv)},_hideMessage:function(){var t=this.messageDiv;t&&(t.parentNode.removeChild(t),delete this.messageDiv)},gestureSettingsByDeviceType:function(t){switch(t){case"mouse":return this.gestureSettingsMouse;case"touch":return this.gestureSettingsTouch;case"pen":return this.gestureSettingsPen;default:return this.gestureSettingsUnknown}},_drawOverlays:function(){var t,e=this.currentOverlays.length;for(t=0;t<e;t++)this.currentOverlays[t].drawHTML(this.overlaysContainer,this.viewport)},_cancelPendingImages:function(){this._loadQueue=[]},removeReferenceStrip:function(){this.showReferenceStrip=!1,this.referenceStrip&&(this.referenceStrip.destroy(),this.referenceStrip=null)},addReferenceStrip:function(){if(this.showReferenceStrip=!0,this.sequenceMode){if(this.referenceStrip)return;this.tileSources.length&&this.tileSources.length>1&&(this.referenceStrip=new t.ReferenceStrip({id:this.referenceStripElement,position:this.referenceStripPosition,sizeRatio:this.referenceStripSizeRatio,scroll:this.referenceStripScroll,height:this.referenceStripHeight,width:this.referenceStripWidth,tileSources:this.tileSources,prefixUrl:this.prefixUrl,useCanvas:this.useCanvas,viewer:this}),this.referenceStrip.setFocus(this._sequenceIndex))}else t.console.warn('Attempting to display a reference strip while "sequenceMode" is off.')},_addUpdatePixelDensityRatioEvent:function(){this._updatePixelDensityRatioBind=this._updatePixelDensityRatio.bind(this),t.addEvent(window,"resize",this._updatePixelDensityRatioBind)},_removeUpdatePixelDensityRatioEvent:function(){t.removeEvent(window,"resize",this._updatePixelDensityRatioBind)},_updatePixelDensityRatio:function(){var e=t.pixelDensityRatio,i=t.getCurrentPixelDensityRatio();e!==i&&(t.pixelDensityRatio=i,this.world.resetItems(),this.forceRedraw())},goToPreviousPage:function(){var t=this._sequenceIndex-1;this.navPrevNextWrap&&t<0&&(t+=this.tileSources.length),this.goToPage(t)},goToNextPage:function(){var t=this._sequenceIndex+1;this.navPrevNextWrap&&t>=this.tileSources.length&&(t=0),this.goToPage(t)},isAnimating:function(){return e[this.hash].animating}})}(s),function(t){function e(t){var e={tracker:t.eventSource,position:t.position,quick:t.quick,shift:t.shift,originalEvent:t.originalEvent,preventDefaultAction:!1};if(this.viewer.raiseEvent("navigator-click",e),!e.preventDefaultAction&&t.quick&&this.viewer.viewport&&(this.panVertical||this.panHorizontal)){this.viewer.viewport.flipped&&(t.position.x=this.viewport.getContainerSize().x-t.position.x);var i=this.viewport.pointFromPixel(t.position);this.panVertical?this.panHorizontal||(i.x=this.viewer.viewport.getCenter(!0).x):i.y=this.viewer.viewport.getCenter(!0).y,this.viewer.viewport.panTo(i),this.viewer.viewport.applyConstraints()}}function i(t){var e={tracker:t.eventSource,position:t.position,delta:t.delta,speed:t.speed,direction:t.direction,shift:t.shift,originalEvent:t.originalEvent,preventDefaultAction:!1};this.viewer.raiseEvent("navigator-drag",e),!e.preventDefaultAction&&this.viewer.viewport&&(this.panHorizontal||(t.delta.x=0),this.panVertical||(t.delta.y=0),this.viewer.viewport.flipped&&(t.delta.x=-t.delta.x),this.viewer.viewport.panBy(this.viewport.deltaPointsFromPixels(t.delta)),this.viewer.constrainDuringPan&&this.viewer.viewport.applyConstraints())}function n(t){t.insideElementPressed&&this.viewer.viewport&&this.viewer.viewport.applyConstraints()}function r(t){var e={tracker:t.eventSource,position:t.position,scroll:t.scroll,shift:t.shift,originalEvent:t.originalEvent,preventDefault:t.preventDefault};this.viewer.raiseEvent("navigator-scroll",e),t.preventDefault=e.preventDefault}function o(t,e){a(t,"rotate("+e+"deg)")}function a(t,e){t.style.webkitTransform=e,t.style.mozTransform=e,t.style.msTransform=e,t.style.oTransform=e,t.style.transform=e}t.Navigator=function(a){var s,l,h,u,c=a.viewer,p=this;function f(t,e){o(p.displayRegionContainer,t),o(p.displayRegion,-t),p.viewport.setRotation(t,e)}(a.element||a.id?(a.element?(a.id&&t.console.warn("Given option.id for Navigator was ignored since option.element was provided and is being used instead."),a.element.id?a.id=a.element.id:a.id="navigator-"+t.now(),this.element=a.element):this.element=document.getElementById(a.id),a.controlOptions={anchor:t.ControlAnchor.NONE,attachToViewer:!1,autoFade:!1}):(a.id="navigator-"+t.now(),this.element=t.makeNeutralElement("div"),a.controlOptions={anchor:t.ControlAnchor.TOP_RIGHT,attachToViewer:!0,autoFade:a.autoFade},a.position&&("BOTTOM_RIGHT"===a.position?a.controlOptions.anchor=t.ControlAnchor.BOTTOM_RIGHT:"BOTTOM_LEFT"===a.position?a.controlOptions.anchor=t.ControlAnchor.BOTTOM_LEFT:"TOP_RIGHT"===a.position?a.controlOptions.anchor=t.ControlAnchor.TOP_RIGHT:"TOP_LEFT"===a.position?a.controlOptions.anchor=t.ControlAnchor.TOP_LEFT:"ABSOLUTE"===a.position&&(a.controlOptions.anchor=t.ControlAnchor.ABSOLUTE,a.controlOptions.top=a.top,a.controlOptions.left=a.left,a.controlOptions.height=a.height,a.controlOptions.width=a.width))),this.element.id=a.id,this.element.className+=" navigator",(a=t.extend(!0,{sizeRatio:t.DEFAULT_SETTINGS.navigatorSizeRatio},a,{element:this.element,tabIndex:-1,showNavigator:!1,mouseNavEnabled:!1,showNavigationControl:!1,showSequenceControl:!1,immediateRender:!0,blendTime:0,animationTime:a.animationTime,autoResize:!1,minZoomImageRatio:1,background:a.background,opacity:a.opacity,borderColor:a.borderColor,displayRegionColor:a.displayRegionColor})).minPixelRatio=this.minPixelRatio=c.minPixelRatio,t.setElementTouchActionNone(this.element),this.borderWidth=2,this.fudge=new t.Point(1,1),this.totalBorderWidths=new t.Point(2*this.borderWidth,2*this.borderWidth).minus(this.fudge),a.controlOptions.anchor!==t.ControlAnchor.NONE&&(h=this.element.style,u=this.borderWidth,h.margin="0px",h.border=u+"px solid "+a.borderColor,h.padding="0px",h.background=a.background,h.opacity=a.opacity,h.overflow="hidden"),this.displayRegion=t.makeNeutralElement("div"),this.displayRegion.id=this.element.id+"-displayregion",this.displayRegion.className="displayregion",function(t,e){t.position="relative",t.top="0px",t.left="0px",t.fontSize="0px",t.overflow="hidden",t.border=e+"px solid "+a.displayRegionColor,t.margin="0px",t.padding="0px",t.background="transparent",t.float="left",t.cssFloat="left",t.styleFloat="left",t.zIndex=999999999,t.cursor="default",t.boxSizing="content-box"}(this.displayRegion.style,this.borderWidth),t.setElementPointerEventsNone(this.displayRegion),t.setElementTouchActionNone(this.displayRegion),this.displayRegionContainer=t.makeNeutralElement("div"),this.displayRegionContainer.id=this.element.id+"-displayregioncontainer",this.displayRegionContainer.className="displayregioncontainer",this.displayRegionContainer.style.width="100%",this.displayRegionContainer.style.height="100%",t.setElementPointerEventsNone(this.displayRegionContainer),t.setElementTouchActionNone(this.displayRegionContainer),c.addControl(this.element,a.controlOptions),this._resizeWithViewer=a.controlOptions.anchor!==t.ControlAnchor.ABSOLUTE&&a.controlOptions.anchor!==t.ControlAnchor.NONE,a.width&&a.height?(this.setWidth(a.width),this.setHeight(a.height)):this._resizeWithViewer&&(s=t.getElementSize(c.element),this.element.style.height=Math.round(s.y*a.sizeRatio)+"px",this.element.style.width=Math.round(s.x*a.sizeRatio)+"px",this.oldViewerSize=s,l=t.getElementSize(this.element),this.elementArea=l.x*l.y),this.oldContainerSize=new t.Point(0,0),t.Viewer.apply(this,[a]),this.displayRegionContainer.appendChild(this.displayRegion),this.element.getElementsByTagName("div")[0].appendChild(this.displayRegionContainer),a.navigatorRotate)&&(f(a.viewer.viewport?a.viewer.viewport.getRotation():a.viewer.degrees||0,!0),a.viewer.addHandler("rotate",function(t){f(t.degrees,t.immediately)}));this.innerTracker.destroy(),this.innerTracker=new t.MouseTracker({userData:"Navigator.innerTracker",element:this.element,dragHandler:t.delegate(this,i),clickHandler:t.delegate(this,e),releaseHandler:t.delegate(this,n),scrollHandler:t.delegate(this,r),preProcessEventHandler:function(t){"wheel"===t.eventType&&(t.preventDefault=!0)}}),this.outerTracker.userData="Navigator.outerTracker",t.setElementPointerEventsNone(this.canvas),t.setElementPointerEventsNone(this.container),this.addHandler("reset-size",function(){p.viewport&&p.viewport.goHome(!0)}),c.world.addHandler("item-index-change",function(t){window.setTimeout(function(){var e=p.world.getItemAt(t.previousIndex);p.world.setItemIndex(e,t.newIndex)},1)}),c.world.addHandler("remove-item",function(t){var e=t.item,i=p._getMatchingItem(e);i&&p.world.removeItem(i)}),this.update(c.viewport)},t.extend(t.Navigator.prototype,t.EventSource.prototype,t.Viewer.prototype,{updateSize:function(){if(this.viewport){var e=new t.Point(0===this.container.clientWidth?1:this.container.clientWidth,0===this.container.clientHeight?1:this.container.clientHeight);e.equals(this.oldContainerSize)||(this.viewport.resize(e,!0),this.viewport.goHome(!0),this.oldContainerSize=e,this.drawer.clear(),this.world.draw())}},setWidth:function(t){this.width=t,this.element.style.width="number"==typeof t?t+"px":t,this._resizeWithViewer=!1,this.updateSize()},setHeight:function(t){this.height=t,this.element.style.height="number"==typeof t?t+"px":t,this._resizeWithViewer=!1,this.updateSize()},setFlip:function(t){return this.viewport.setFlip(t),this.setDisplayTransform(this.viewer.viewport.getFlip()?"scale(-1,1)":"scale(1,1)"),this},setDisplayTransform:function(t){a(this.displayRegion,t),a(this.canvas,t),a(this.element,t)},update:function(e){var i,n,r,a,s,l;if(i=t.getElementSize(this.viewer.element),this._resizeWithViewer&&i.x&&i.y&&!i.equals(this.oldViewerSize)&&(this.oldViewerSize=i,this.maintainSizeRatio||!this.elementArea?(n=i.x*this.sizeRatio,r=i.y*this.sizeRatio):(n=Math.sqrt(this.elementArea*(i.x/i.y)),r=this.elementArea/n),this.element.style.width=Math.round(n)+"px",this.element.style.height=Math.round(r)+"px",this.elementArea||(this.elementArea=n*r),this.updateSize()),e&&this.viewport){if(a=e.getBoundsNoRotate(!0),s=this.viewport.pixelFromPointNoRotate(a.getTopLeft(),!1),l=this.viewport.pixelFromPointNoRotate(a.getBottomRight(),!1).minus(this.totalBorderWidths),!this.navigatorRotate){var h=e.getRotation(!0);o(this.displayRegion,-h)}var u=this.displayRegion.style;u.display=this.world.getItemCount()?"block":"none",u.top=s.y.toFixed(2)+"px",u.left=s.x.toFixed(2)+"px";var c=l.x-s.x,p=l.y-s.y;u.width=Math.round(Math.max(c,0))+"px",u.height=Math.round(Math.max(p,0))+"px"}},addTiledImage:function(e){var i=this,n=e.originalTiledImage;delete e.original;var r=t.extend({},e,{success:function(t){var e=t.item;function r(){i._matchBounds(e,n)}e._originalForNavigator=n,i._matchBounds(e,n,!0),i._matchOpacity(e,n),i._matchCompositeOperation(e,n),n.addHandler("bounds-change",r),n.addHandler("clip-change",r),n.addHandler("opacity-change",function(){i._matchOpacity(e,n)}),n.addHandler("composite-operation-change",function(){i._matchCompositeOperation(e,n)})}});return t.Viewer.prototype.addTiledImage.apply(this,[r])},destroy:function(){return t.Viewer.prototype.destroy.apply(this)},_getMatchingItem:function(t){for(var e,i=this.world.getItemCount(),n=0;n<i;n++)if((e=this.world.getItemAt(n))._originalForNavigator===t)return e;return null},_matchBounds:function(t,e,i){var n=e.getBoundsNoRotate();t.setPosition(n.getTopLeft(),i),t.setWidth(n.width,i),t.setRotation(e.getRotation(),i),t.setClip(e.getClip()),t.setFlip(e.getFlip())},_matchOpacity:function(t,e){t.setOpacity(e.opacity)},_matchCompositeOperation:function(t,e){t.setCompositeOperation(e.compositeOperation)}})}(s),function(t){var e={Errors:{Dzc:"Sorry, we don't support Deep Zoom Collections!",Dzi:"Hmm, this doesn't appear to be a valid Deep Zoom Image.",Xml:"Hmm, this doesn't appear to be a valid Deep Zoom Image.",ImageFormat:"Sorry, we don't support {0}-based Deep Zoom Images.",Security:"It looks like a security restriction stopped us from loading this Deep Zoom Image.",Status:"This space unintentionally left blank ({0} {1}).",OpenFailed:"Unable to open {0}: {1}"},Tooltips:{FullPage:"Toggle full page",Home:"Go home",ZoomIn:"Zoom in",ZoomOut:"Zoom out",NextPage:"Next page",PreviousPage:"Previous page",RotateLeft:"Rotate left",RotateRight:"Rotate right",Flip:"Flip Horizontally"}};t.extend(t,{getString:function(i){var n,r=i.split("."),o=null,a=arguments,s=e;for(n=0;n<r.length-1;n++)s=s[r[n]]||{};return"string"!=typeof(o=s[r[n]])&&(t.console.error("Untranslated source string:",i),o=""),o.replace(/\{\d+\}/g,function(t){var e=parseInt(t.match(/\d+/),10)+1;return e<a.length?a[e]:""})},setString:function(t,i){var n,r=t.split("."),o=e;for(n=0;n<r.length-1;n++)o[r[n]]||(o[r[n]]={}),o=o[r[n]];o[r[n]]=i}})}(s),function(t){t.Point=function(t,e){this.x="number"==typeof t?t:0,this.y="number"==typeof e?e:0},t.Point.prototype={clone:function(){return new t.Point(this.x,this.y)},plus:function(e){return new t.Point(this.x+e.x,this.y+e.y)},minus:function(e){return new t.Point(this.x-e.x,this.y-e.y)},times:function(e){return new t.Point(this.x*e,this.y*e)},divide:function(e){return new t.Point(this.x/e,this.y/e)},negate:function(){return new t.Point(-this.x,-this.y)},distanceTo:function(t){return Math.sqrt(Math.pow(this.x-t.x,2)+Math.pow(this.y-t.y,2))},squaredDistanceTo:function(t){return Math.pow(this.x-t.x,2)+Math.pow(this.y-t.y,2)},apply:function(e){return new t.Point(e(this.x),e(this.y))},equals:function(e){return e instanceof t.Point&&this.x===e.x&&this.y===e.y},rotate:function(e,i){var n,r;if(i=i||new t.Point(0,0),e%90==0){switch(t.positiveModulo(e,360)){case 0:n=1,r=0;break;case 90:n=0,r=1;break;case 180:n=-1,r=0;break;case 270:n=0,r=-1}}else{var o=e*Math.PI/180;n=Math.cos(o),r=Math.sin(o)}var a=n*(this.x-i.x)-r*(this.y-i.y)+i.x,s=r*(this.x-i.x)+n*(this.y-i.y)+i.y;return new t.Point(a,s)},toString:function(){return"("+Math.round(100*this.x)/100+","+Math.round(100*this.y)/100+")"}}}(s),function(t){t.TileSource=function(e,i,n,r,o,a){var s,l,h=this,u=arguments;if(s=t.isPlainObject(e)?e:{width:u[0],height:u[1],tileSize:u[2],tileOverlap:u[3],minLevel:u[4],maxLevel:u[5]},t.EventSource.call(this),t.extend(!0,this,s),!this.success)for(l=0;l<arguments.length;l++)if(t.isFunction(arguments[l])){this.success=arguments[l];break}this.success&&this.addHandler("ready",function(t){h.success(t)}),"string"===t.type(arguments[0])&&(this.url=arguments[0]),this.url?(this.aspectRatio=1,this.dimensions=new t.Point(10,10),this._tileWidth=0,this._tileHeight=0,this.tileOverlap=0,this.minLevel=0,this.maxLevel=0,this.ready=!1,this.getImageInfo(this.url)):(this.ready=!0,this.aspectRatio=s.width&&s.height?s.width/s.height:1,this.dimensions=new t.Point(s.width,s.height),this.tileSize?(this._tileWidth=this._tileHeight=this.tileSize,delete this.tileSize):(this.tileWidth?(this._tileWidth=this.tileWidth,delete this.tileWidth):this._tileWidth=0,this.tileHeight?(this._tileHeight=this.tileHeight,delete this.tileHeight):this._tileHeight=0),this.tileOverlap=s.tileOverlap?s.tileOverlap:0,this.minLevel=s.minLevel?s.minLevel:0,this.maxLevel=void 0!==s.maxLevel&&null!==s.maxLevel?s.maxLevel:s.width&&s.height?Math.ceil(Math.log(Math.max(s.width,s.height))/Math.log(2)):0,this.success&&t.isFunction(this.success)&&this.success(this))},t.TileSource.prototype={getTileSize:function(e){return t.console.error("[TileSource.getTileSize] is deprecated. Use TileSource.getTileWidth() and TileSource.getTileHeight() instead"),this._tileWidth},getTileWidth:function(t){return this._tileWidth?this._tileWidth:this.getTileSize(t)},getTileHeight:function(t){return this._tileHeight?this._tileHeight:this.getTileSize(t)},setMaxLevel:function(t){this.maxLevel=t,this._memoizeLevelScale()},getLevelScale:function(t){return this._memoizeLevelScale(),this.getLevelScale(t)},_memoizeLevelScale:function(){var t,e={};for(t=0;t<=this.maxLevel;t++)e[t]=1/Math.pow(2,this.maxLevel-t);this.getLevelScale=function(t){return e[t]}},getNumTiles:function(e){var i=this.getLevelScale(e),n=Math.ceil(i*this.dimensions.x/this.getTileWidth(e)),r=Math.ceil(i*this.dimensions.y/this.getTileHeight(e));return new t.Point(n,r)},getPixelRatio:function(e){var i=this.dimensions.times(this.getLevelScale(e)),n=1/i.x*t.pixelDensityRatio,r=1/i.y*t.pixelDensityRatio;return new t.Point(n,r)},getClosestLevel:function(){var t,e;for(t=this.minLevel+1;t<=this.maxLevel&&!((e=this.getNumTiles(t)).x>1||e.y>1);t++);return t-1},getTileAtPoint:function(e,i){var n=i.x>=0&&i.x<=1&&i.y>=0&&i.y<=1/this.aspectRatio;t.console.assert(n,"[TileSource.getTileAtPoint] must be called with a valid point.");var r=this.dimensions.x*this.getLevelScale(e),o=i.x*r,a=i.y*r,s=Math.floor(o/this.getTileWidth(e)),l=Math.floor(a/this.getTileHeight(e));i.x>=1&&(s=this.getNumTiles(e).x-1);return i.y>=1/this.aspectRatio-1e-15&&(l=this.getNumTiles(e).y-1),new t.Point(s,l)},getTileBounds:function(e,i,n,r){var o=this.dimensions.times(this.getLevelScale(e)),a=this.getTileWidth(e),s=this.getTileHeight(e),l=0===i?0:a*i-this.tileOverlap,h=0===n?0:s*n-this.tileOverlap,u=a+(0===i?1:2)*this.tileOverlap,c=s+(0===n?1:2)*this.tileOverlap,p=1/o.x;return u=Math.min(u,o.x-l),c=Math.min(c,o.y-h),r?new t.Rect(0,0,u,c):new t.Rect(l*p,h*p,u*p,c*p)},getImageInfo:function(e){var i,n,r,o,a,s,l,h=this;e&&(l=(s=(a=e.split("/"))[a.length-1]).lastIndexOf("."))>-1&&(a[a.length-1]=s.slice(0,l));var u=null;if(this.splitHashDataForPost){var c=e.indexOf("#");-1!==c&&(u=e.substring(c+1),e=e.substr(0,c))}n=function(i){"string"==typeof i&&(i=t.parseXml(i));var n=t.TileSource.determineType(h,i,e);n?(void 0===(o=n.prototype.configure.apply(h,[i,e,u])).ajaxWithCredentials&&(o.ajaxWithCredentials=h.ajaxWithCredentials),r=new n(o),h.ready=!0,h.raiseEvent("ready",{tileSource:r})):h.raiseEvent("open-failed",{message:"Unable to load TileSource",source:e})},e.match(/\.js$/)?(i=e.split("/").pop().replace(".js",""),t.jsonp({url:e,async:!1,callbackName:i,callback:n})):t.makeAjaxRequest({url:e,postData:u,withCredentials:this.ajaxWithCredentials,headers:this.ajaxHeaders,success:function(e){var i=function(e){var i,n,r=e.responseText,o=e.status;if(!e)throw new Error(t.getString("Errors.Security"));if(200!==e.status&&0!==e.status)throw i=404===(o=e.status)?"Not Found":e.statusText,new Error(t.getString("Errors.Status",o,i));if(r.match(/^\s*<.*/))try{n=e.responseXML&&e.responseXML.documentElement?e.responseXML:t.parseXml(r)}catch(a){n=e.responseText}else if(r.match(/\s*[{[].*/))try{n=t.parseJSON(r)}catch(a){n=r}else n=r;return n}(e);n(i)},error:function(i,n){var r;try{r="HTTP "+i.status+" attempting to load TileSource: "+e}catch(o){r=(void 0!==n&&n.toString?n.toString():"Unknown error")+" attempting to load TileSource: "+e}t.console.error(r),h.raiseEvent("open-failed",{message:r,source:e,postData:u})}})},supports:function(t,e){return!1},configure:function(t,e,i){throw new Error("Method not implemented.")},getTileUrl:function(t,e,i){throw new Error("Method not implemented.")},getTilePostData:function(t,e,i){return null},getTileAjaxHeaders:function(t,e,i){return{}},getTileHashKey:function(t,e,i,n,r,o){function a(t){return r?t+"+"+JSON.stringify(r):t}return a("string"!=typeof n?t+"/"+e+"_"+i:n)},tileExists:function(t,e,i){var n=this.getNumTiles(t);return t>=this.minLevel&&t<=this.maxLevel&&e>=0&&i>=0&&e<n.x&&i<n.y},hasTransparency:function(t,e,i,n){return!!t||e.match(".png")},downloadTileStart:function(e){var i=e.userData,n=new Image;i.image=n,i.request=null;var r=function(t){n?(n.onload=n.onerror=n.onabort=null,e.finish(t?null:n,i.request,t)):e.finish(null,i.request,"Image load failed: undefined Image instance.")};n.onload=function(){r()},n.onabort=n.onerror=function(){r("Image load aborted.")},e.loadWithAjax?i.request=t.makeAjaxRequest({url:e.src,withCredentials:e.ajaxWithCredentials,headers:e.ajaxHeaders,responseType:"arraybuffer",postData:e.postData,success:function(t){var e;try{e=new window.Blob([t.response])}catch(a){var i=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder;if("TypeError"===a.name&&i){var o=new i;o.append(t.response),e=o.getBlob()}}0===e.size?r("Empty image response."):n.src=(window.URL||window.webkitURL).createObjectURL(e)},error:function(t){r("Image load aborted - XHR error")}}):(!1!==e.crossOriginPolicy&&(n.crossOrigin=e.crossOriginPolicy),n.src=e.src)},downloadTileAbort:function(t){t.userData.request&&t.userData.request.abort();var e=t.userData.image;t.userData.image&&(e.onload=e.onerror=e.onabort=null)},createTileCache:function(t,e,i){t._data=e},destroyTileCache:function(t){t._data=null,t._renderedContext=null},getTileCacheData:function(t){return t._data},getTileCacheDataAsImage:function(t){return t._data},getTileCacheDataAsContext2D:function(t){if(!t._renderedContext){var e=document.createElement("canvas");e.width=t._data.width,e.height=t._data.height,t._renderedContext=e.getContext("2d"),t._renderedContext.drawImage(t._data,0,0),t._data=null;const i=e.cloneNode(!0);t._copyRenderedContext=i.getContext("2d"),t._copyRenderedContext.drawImage(e,0,0)}return t._renderedContext},getCopyTileCacheDataAsContext2D:function(t){return t._copyRenderedContext||t._renderedContext}},t.extend(!0,t.TileSource.prototype,t.EventSource.prototype),t.TileSource.determineType=function(e,i,n){var r;for(r in s)if(r.match(/.+TileSource$/)&&t.isFunction(s[r])&&t.isFunction(s[r].prototype.supports)&&s[r].prototype.supports.call(e,i,n))return s[r];return t.console.error("No TileSource was able to open %s %s",n,i),null}}(s),function(t){function e(e,i){var n,r,o=i.Image,a=o.Url,s=o.Format,l=o.Size,h=o.DisplayRect||[],u=parseInt(l.Width,10),c=parseInt(l.Height,10),p=parseInt(o.TileSize,10),f=parseInt(o.Overlap,10),d=[];for(r=0;r<h.length;r++)n=h[r].Rect,d.push(new t.DisplayRect(parseInt(n.X,10),parseInt(n.Y,10),parseInt(n.Width,10),parseInt(n.Height,10),parseInt(n.MinLevel,10),parseInt(n.MaxLevel,10)));return t.extend(!0,{width:u,height:c,tileSize:p,tileOverlap:f,minLevel:null,maxLevel:null,tilesUrl:a,fileFormat:s,displayRects:d},i)}t.DziTileSource=function(e,i,n,r,o,a,s,l,h){var u,c,p,f;if(f=t.isPlainObject(e)?e:{width:arguments[0],height:arguments[1],tileSize:arguments[2],tileOverlap:arguments[3],tilesUrl:arguments[4],fileFormat:arguments[5],displayRects:arguments[6],minLevel:arguments[7],maxLevel:arguments[8]},this._levelRects={},this.tilesUrl=f.tilesUrl,this.fileFormat=f.fileFormat,this.displayRects=f.displayRects,this.displayRects)for(u=this.displayRects.length-1;u>=0;u--)for(p=(c=this.displayRects[u]).minLevel;p<=c.maxLevel;p++)this._levelRects[p]||(this._levelRects[p]=[]),this._levelRects[p].push(c);t.TileSource.apply(this,[f])},t.extend(t.DziTileSource.prototype,t.TileSource.prototype,{supports:function(t,e){var i;return t.Image?i=t.Image.xmlns:t.documentElement&&("Image"!==t.documentElement.localName&&"Image"!==t.documentElement.tagName||(i=t.documentElement.namespaceURI)),-1!==(i=(i||"").toLowerCase()).indexOf("schemas.microsoft.com/deepzoom/2008")||-1!==i.indexOf("schemas.microsoft.com/deepzoom/2009")},configure:function(i,n,r){var o;return o=t.isPlainObject(i)?e(this,i):function(i,n){if(!n||!n.documentElement)throw new Error(t.getString("Errors.Xml"));var r,o,a,s,l,h=n.documentElement,u=h.localName||h.tagName,c=n.documentElement.namespaceURI,p=null,f=[];if("Image"===u)try{if(void 0===(s=h.getElementsByTagName("Size")[0])&&(s=h.getElementsByTagNameNS(c,"Size")[0]),p={Image:{xmlns:"http://schemas.microsoft.com/deepzoom/2008",Url:h.getAttribute("Url"),Format:h.getAttribute("Format"),DisplayRect:null,Overlap:parseInt(h.getAttribute("Overlap"),10),TileSize:parseInt(h.getAttribute("TileSize"),10),Size:{Height:parseInt(s.getAttribute("Height"),10),Width:parseInt(s.getAttribute("Width"),10)}}},!t.imageFormatSupported(p.Image.Format))throw new Error(t.getString("Errors.ImageFormat",p.Image.Format.toUpperCase()));for(void 0===(r=h.getElementsByTagName("DisplayRect"))&&(r=h.getElementsByTagNameNS(c,"DisplayRect")[0]),l=0;l<r.length;l++)void 0===(a=(o=r[l]).getElementsByTagName("Rect")[0])&&(a=o.getElementsByTagNameNS(c,"Rect")[0]),f.push({Rect:{X:parseInt(a.getAttribute("X"),10),Y:parseInt(a.getAttribute("Y"),10),Width:parseInt(a.getAttribute("Width"),10),Height:parseInt(a.getAttribute("Height"),10),MinLevel:parseInt(o.getAttribute("MinLevel"),10),MaxLevel:parseInt(o.getAttribute("MaxLevel"),10)}});return f.length&&(p.Image.DisplayRect=f),e(i,p)}catch(v){throw v instanceof Error?v:new Error(t.getString("Errors.Dzi"))}else{if("Collection"===u)throw new Error(t.getString("Errors.Dzc"));if("Error"===u){var d=h.getElementsByTagName("Message")[0].firstChild.nodeValue;throw new Error(d)}}throw new Error(t.getString("Errors.Dzi"))}(this,i),n&&!o.tilesUrl&&(o.tilesUrl=n.replace(/([^/]+?)(\.(dzi|xml|js)?(\?[^/]*)?)?\/?$/,"$1_files/"),-1!==n.search(/\.(dzi|xml|js)\?/)?o.queryParams=n.match(/\?.*/):o.queryParams=""),o},getTileUrl:function(t,e,i){return[this.tilesUrl,t,"/",e,"_",i,".",this.fileFormat,this.queryParams].join("")},tileExists:function(t,e,i){var n,r,o,a,s,l,h,u=this._levelRects[t];if(this.minLevel&&t<this.minLevel||this.maxLevel&&t>this.maxLevel)return!1;if(!u||!u.length)return!0;for(h=u.length-1;h>=0;h--)if(!(t<(n=u[h]).minLevel||t>n.maxLevel)&&(r=this.getLevelScale(t),o=n.x*r,a=n.y*r,s=o+n.width*r,l=a+n.height*r,o=Math.floor(o/this._tileWidth),a=Math.floor(a/this._tileWidth),s=Math.ceil(s/this._tileWidth),l=Math.ceil(l/this._tileWidth),o<=e&&e<s&&a<=i&&i<l))return!0;return!1}})}(s),function(t){function e(t){var e=Array.isArray(t.profile)?t.profile[0]:t.profile,i=-1!==["http://library.stanford.edu/iiif/image-api/compliance.html#level0","http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0","http://iiif.io/api/image/2/level0.json","level0","https://iiif.io/api/image/3/level0.json"].indexOf(e),n=!1;return 2===t.version&&t.profile.length>1&&t.profile[1].supports&&(n=-1!==t.profile[1].supports.indexOf("sizeByW")),3===t.version&&t.extraFeatures&&(n=-1!==t.extraFeatures.indexOf("sizeByWh")),!i||n}function i(t){for(var e=[],i=0;i<t.sizes.length;i++)e.push({url:t._id+"/full/"+t.sizes[i].width+","+(3===t.version?t.sizes[i].height:"")+"/0/default."+t.tileFormat,width:t.sizes[i].width,height:t.sizes[i].height});return e.sort(function(t,e){return t.width-e.width})}function n(e,i,r){var o,a;if(3===e.nodeType&&r)(a=e.nodeValue.trim()).match(/^\d*$/)&&(a=Number(a)),i[r]?(t.isArray(i[r])||(i[r]=[i[r]]),i[r].push(a)):i[r]=a;else if(1===e.nodeType)for(o=0;o<e.childNodes.length;o++)n(e.childNodes[o],i,e.nodeName)}t.IIIFTileSource=function(n){if(t.extend(!0,this,n),this._id=this["@id"]||this.id||this.identifier||null,!(this.height&&this.width&&this._id))throw new Error("IIIF required parameters (width, height, or id) not provided.");if(n.tileSizePerScaleFactor={},this.tileFormat=this.tileFormat||"jpg",this.version=n.version,this.tile_width&&this.tile_height)n.tileWidth=this.tile_width,n.tileHeight=this.tile_height;else if(this.tile_width)n.tileSize=this.tile_width;else if(this.tile_height)n.tileSize=this.tile_height;else if(this.tiles)if(1===this.tiles.length)n.tileWidth=this.tiles[0].width,n.tileHeight=this.tiles[0].height||this.tiles[0].width,this.scale_factors=this.tiles[0].scaleFactors;else{this.scale_factors=[];for(var r=0;r<this.tiles.length;r++)for(var o=0;o<this.tiles[r].scaleFactors.length;o++){var a=this.tiles[r].scaleFactors[o];this.scale_factors.push(a),n.tileSizePerScaleFactor[a]={width:this.tiles[r].width,height:this.tiles[r].height||this.tiles[r].width}}}else if(e(n)){for(var s=Math.min(this.height,this.width),l=[256,512,1024],h=[],u=0;u<l.length;u++)l[u]<=s&&h.push(l[u]);h.length>0?n.tileSize=Math.max.apply(null,h):n.tileSize=s}else this.sizes&&this.sizes.length>0?(this.emulateLegacyImagePyramid=!0,n.levels=i(this),t.extend(!0,n,{width:n.levels[n.levels.length-1].width,height:n.levels[n.levels.length-1].height,tileSize:Math.max(n.height,n.width),tileOverlap:0,minLevel:0,maxLevel:n.levels.length-1}),this.levels=n.levels):t.console.error("Nothing in the info.json to construct image pyramids from");if(!n.maxLevel&&!this.emulateLegacyImagePyramid)if(this.scale_factors){var c=Math.max.apply(null,this.scale_factors);n.maxLevel=Math.round(Math.log(c)*Math.LOG2E)}else n.maxLevel=Number(Math.round(Math.log(Math.max(this.width,this.height),2)));if(this.sizes){var p=this.sizes.length;p!==n.maxLevel&&p!==n.maxLevel+1||(this.levelSizes=this.sizes.slice().sort(function(t,e){return t.width-e.width}),p===n.maxLevel&&this.levelSizes.push({width:this.width,height:this.height}))}t.TileSource.apply(this,[n])},t.extend(t.IIIFTileSource.prototype,t.TileSource.prototype,{supports:function(t,e){return!(!t.protocol||"http://iiif.io/api/image"!==t.protocol)||(!(!t["@context"]||"http://library.stanford.edu/iiif/image-api/1.1/context.json"!==t["@context"]&&"http://iiif.io/api/image/1/context.json"!==t["@context"])||(!(!t.profile||0!==t.profile.indexOf("http://library.stanford.edu/iiif/image-api/compliance.html"))||(!!(t.identifier&&t.width&&t.height)||!(!t.documentElement||"info"!==t.documentElement.tagName||"http://library.stanford.edu/iiif/image-api/ns/"!==t.documentElement.namespaceURI))))},configure:function(e,i,r){if(t.isPlainObject(e)){if(e["@context"]){var o=e["@context"];if(Array.isArray(o))for(var a=0;a<o.length;a++)if("string"==typeof o[a]&&(/^http:\/\/iiif\.io\/api\/image\/[1-3]\/context\.json$/.test(o[a])||"http://library.stanford.edu/iiif/image-api/1.1/context.json"===o[a])){o=o[a];break}switch(o){case"http://iiif.io/api/image/1/context.json":case"http://library.stanford.edu/iiif/image-api/1.1/context.json":e.version=1;break;case"http://iiif.io/api/image/2/context.json":e.version=2;break;case"http://iiif.io/api/image/3/context.json":e.version=3;break;default:t.console.error("Data has a @context property which contains no known IIIF context URI.")}}else e["@context"]="http://iiif.io/api/image/1.0/context.json",e["@id"]=i.replace("/info.json",""),e.version=1;if(e.preferredFormats)for(var l=0;l<e.preferredFormats.length;l++)if(s.imageFormatSupported(e.preferredFormats[l])){e.tileFormat=e.preferredFormats[l];break}return e}var h=function(e){if(!e||!e.documentElement)throw new Error(t.getString("Errors.Xml"));var i=e.documentElement,r=i.tagName,o=null;if("info"===r)try{return n(i,o={}),o}catch(a){throw a instanceof Error?a:new Error(t.getString("Errors.IIIF"))}throw new Error(t.getString("Errors.IIIF"))}(e);return h["@context"]="http://iiif.io/api/image/1.0/context.json",h["@id"]=i.replace("/info.xml",""),h.version=1,h},getTileWidth:function(e){if(this.emulateLegacyImagePyramid)return t.TileSource.prototype.getTileWidth.call(this,e);var i=Math.pow(2,this.maxLevel-e);return this.tileSizePerScaleFactor&&this.tileSizePerScaleFactor[i]?this.tileSizePerScaleFactor[i].width:this._tileWidth},getTileHeight:function(e){if(this.emulateLegacyImagePyramid)return t.TileSource.prototype.getTileHeight.call(this,e);var i=Math.pow(2,this.maxLevel-e);return this.tileSizePerScaleFactor&&this.tileSizePerScaleFactor[i]?this.tileSizePerScaleFactor[i].height:this._tileHeight},getLevelScale:function(e){if(this.emulateLegacyImagePyramid){var i=NaN;return this.levels.length>0&&e>=this.minLevel&&e<=this.maxLevel&&(i=this.levels[e].width/this.levels[this.maxLevel].width),i}return t.TileSource.prototype.getLevelScale.call(this,e)},getNumTiles:function(e){if(this.emulateLegacyImagePyramid)return this.getLevelScale(e)?new t.Point(1,1):new t.Point(0,0);if(this.levelSizes){var i=this.levelSizes[e],n=Math.ceil(i.width/this.getTileWidth(e)),r=Math.ceil(i.height/this.getTileHeight(e));return new t.Point(n,r)}return t.TileSource.prototype.getNumTiles.call(this,e)},getTileAtPoint:function(e,i){if(this.emulateLegacyImagePyramid)return new t.Point(0,0);if(this.levelSizes){var n=i.x>=0&&i.x<=1&&i.y>=0&&i.y<=1/this.aspectRatio;t.console.assert(n,"[TileSource.getTileAtPoint] must be called with a valid point.");var r=this.levelSizes[e].width,o=i.x*r,a=i.y*r,s=Math.floor(o/this.getTileWidth(e)),l=Math.floor(a/this.getTileHeight(e));i.x>=1&&(s=this.getNumTiles(e).x-1);return i.y>=1/this.aspectRatio-1e-15&&(l=this.getNumTiles(e).y-1),new t.Point(s,l)}return t.TileSource.prototype.getTileAtPoint.call(this,e,i)},getTileUrl:function(t,e,i){if(this.emulateLegacyImagePyramid){var n=null;return this.levels.length>0&&t>=this.minLevel&&t<=this.maxLevel&&(n=this.levels[t].url),n}var r,o,a,s,l,h,u,c,p,f,d,v,g,y,m,w=Math.pow(.5,this.maxLevel-t);return this.levelSizes?(r=this.levelSizes[t].width,o=this.levelSizes[t].height):(r=Math.ceil(this.width*w),o=Math.ceil(this.height*w)),a=this.getTileWidth(t),s=this.getTileHeight(t),l=Math.round(a/w),h=Math.round(s/w),m=1===this.version?"native."+this.tileFormat:"default."+this.tileFormat,r<a&&o<s?(v=2===this.version&&r===this.width?"full":3===this.version&&r===this.width&&o===this.height?"max":3===this.version?r+","+o:r+",",u="full"):(c=e*l,p=i*h,f=Math.min(l,this.width-c),d=Math.min(h,this.height-p),u=0===e&&0===i&&f===this.width&&d===this.height?"full":[c,p,f,d].join(","),g=Math.min(a,r-e*a),y=Math.min(s,o-i*s),v=2===this.version&&g===this.width?"full":3===this.version&&g===this.width&&y===this.height?"max":3===this.version?g+","+y:g+","),[this._id,u,v,"0",m].join("/")},__testonly__:{canBeTiled:e,constructLevels:i}})}(s),function(t){t.OsmTileSource=function(e,i,n,r,o){var a;(a=t.isPlainObject(e)?e:{width:arguments[0],height:arguments[1],tileSize:arguments[2],tileOverlap:arguments[3],tilesUrl:arguments[4]}).width&&a.height||(a.width=65572864,a.height=65572864),a.tileSize||(a.tileSize=256,a.tileOverlap=0),a.tilesUrl||(a.tilesUrl="http://tile.openstreetmap.org/"),a.minLevel=8,t.TileSource.apply(this,[a])},t.extend(t.OsmTileSource.prototype,t.TileSource.prototype,{supports:function(t,e){return t.type&&"openstreetmaps"===t.type},configure:function(t,e,i){return t},getTileUrl:function(t,e,i){return this.tilesUrl+(t-8)+"/"+e+"/"+i+".png"}})}(s),function(t){t.TmsTileSource=function(e,i,n,r,o){var a;a=t.isPlainObject(e)?e:{width:arguments[0],height:arguments[1],tileSize:arguments[2],tileOverlap:arguments[3],tilesUrl:arguments[4]};var s,l=256*Math.ceil(a.width/256),h=256*Math.ceil(a.height/256);s=l>h?l/256:h/256,a.maxLevel=Math.ceil(Math.log(s)/Math.log(2))-1,a.tileSize=256,a.width=l,a.height=h,t.TileSource.apply(this,[a])},t.extend(t.TmsTileSource.prototype,t.TileSource.prototype,{supports:function(t,e){return t.type&&"tiledmapservice"===t.type},configure:function(t,e,i){return t},getTileUrl:function(t,e,i){var n=this.getNumTiles(t).y-1;return this.tilesUrl+t+"/"+e+"/"+(n-i)+".png"}})}(s),function(t){t.ZoomifyTileSource=function(t){void 0===t.tileSize&&(t.tileSize=256),void 0===t.fileFormat&&(t.fileFormat="jpg",this.fileFormat=t.fileFormat);var e={x:t.width,y:t.height};for(t.imageSizes=[{x:t.width,y:t.height}],t.gridSize=[this._getGridSize(t.width,t.height,t.tileSize)];parseInt(e.x,10)>t.tileSize||parseInt(e.y,10)>t.tileSize;)e.x=Math.floor(e.x/2),e.y=Math.floor(e.y/2),t.imageSizes.push({x:e.x,y:e.y}),t.gridSize.push(this._getGridSize(e.x,e.y,t.tileSize));t.imageSizes.reverse(),t.gridSize.reverse(),t.minLevel=0,t.maxLevel=t.gridSize.length-1,s.TileSource.apply(this,[t])},t.extend(t.ZoomifyTileSource.prototype,t.TileSource.prototype,{_getGridSize:function(t,e,i){return{x:Math.ceil(t/i),y:Math.ceil(e/i)}},_calculateAbsoluteTileNumber:function(t,e,i){for(var n=0,r={},o=0;o<t;o++)n+=(r=this.gridSize[o]).x*r.y;return n+=(r=this.gridSize[t]).x*i+e},supports:function(t,e){return t.type&&"zoomifytileservice"===t.type},configure:function(t,e,i){return t},getTileUrl:function(t,e,i){var n,r=this._calculateAbsoluteTileNumber(t,e,i);return n=Math.floor(r/256),this.tilesUrl+"TileGroup"+n+"/"+t+"-"+e+"-"+i+"."+this.fileFormat}})}(s),function(t){function e(t,e){return e.levels}t.LegacyTileSource=function(e){var i,n,r;t.isArray(e)&&(i={type:"legacy-image-pyramid",levels:e}),i.levels=function(e){var i,n,r=[];for(n=0;n<e.length;n++)(i=e[n]).height&&i.width&&i.url?r.push({url:i.url,width:Number(i.width),height:Number(i.height)}):t.console.error("Unsupported image format: %s",i.url?i.url:"<no URL>");return r.sort(function(t,e){return t.height-e.height})}(i.levels),i.levels.length>0?(n=i.levels[i.levels.length-1].width,r=i.levels[i.levels.length-1].height):(n=0,r=0,t.console.error("No supported image formats found")),t.extend(!0,i,{width:n,height:r,tileSize:Math.max(r,n),tileOverlap:0,minLevel:0,maxLevel:i.levels.length>0?i.levels.length-1:0}),t.TileSource.apply(this,[i]),this.levels=i.levels},t.extend(t.LegacyTileSource.prototype,t.TileSource.prototype,{supports:function(t,e){return t.type&&"legacy-image-pyramid"===t.type||t.documentElement&&"legacy-image-pyramid"===t.documentElement.getAttribute("type")},configure:function(i,n,r){return t.isPlainObject(i)?e(this,i):function(i,n){if(!n||!n.documentElement)throw new Error(t.getString("Errors.Xml"));var r,o,a=n.documentElement,s=a.tagName,l=null,h=[];if("image"===s)try{for(l={type:a.getAttribute("type"),levels:[]},h=a.getElementsByTagName("level"),o=0;o<h.length;o++)r=h[o],l.levels.push({url:r.getAttribute("url"),width:parseInt(r.getAttribute("width"),10),height:parseInt(r.getAttribute("height"),10)});return e(i,l)}catch(u){throw u instanceof Error?u:new Error("Unknown error parsing Legacy Image Pyramid XML.")}else{if("collection"===s)throw new Error("Legacy Image Pyramid Collections not yet supported.");if("error"===s)throw new Error("Error: "+n)}throw new Error("Unknown element "+s)}(this,i)},getLevelScale:function(t){var e=NaN;return this.levels.length>0&&t>=this.minLevel&&t<=this.maxLevel&&(e=this.levels[t].width/this.levels[this.maxLevel].width),e},getNumTiles:function(e){return this.getLevelScale(e)?new t.Point(1,1):new t.Point(0,0)},getTileUrl:function(t,e,i){var n=null;return this.levels.length>0&&t>=this.minLevel&&t<=this.maxLevel&&(n=this.levels[t].url),n}})}(s),function(t){t.ImageTileSource=function(e){e=t.extend({buildPyramid:!0,crossOriginPolicy:!1,ajaxWithCredentials:!1,useCanvas:!0},e),t.TileSource.apply(this,[e])},t.extend(t.ImageTileSource.prototype,t.TileSource.prototype,{supports:function(t,e){return t.type&&"image"===t.type},configure:function(t,e,i){return t},getImageInfo:function(e){var i=this._image=new Image,n=this;this.crossOriginPolicy&&(i.crossOrigin=this.crossOriginPolicy),this.ajaxWithCredentials&&(i.useCredentials=this.ajaxWithCredentials),t.addEvent(i,"load",function(){n.width=i.naturalWidth,n.height=i.naturalHeight,n.aspectRatio=n.width/n.height,n.dimensions=new t.Point(n.width,n.height),n._tileWidth=n.width,n._tileHeight=n.height,n.tileOverlap=0,n.minLevel=0,n.levels=n._buildLevels(),n.maxLevel=n.levels.length-1,n.ready=!0,n.raiseEvent("ready",{tileSource:n})}),t.addEvent(i,"error",function(){n.raiseEvent("open-failed",{message:"Error loading image at "+e,source:e})}),i.src=e},getLevelScale:function(t){var e=NaN;return t>=this.minLevel&&t<=this.maxLevel&&(e=this.levels[t].width/this.levels[this.maxLevel].width),e},getNumTiles:function(e){return this.getLevelScale(e)?new t.Point(1,1):new t.Point(0,0)},getTileUrl:function(t,e,i){var n=null;return t>=this.minLevel&&t<=this.maxLevel&&(n=this.levels[t].url),n},getContext2D:function(t,e,i){var n=null;return t>=this.minLevel&&t<=this.maxLevel&&(n=this.levels[t].context2D),n},destroy:function(){this._freeupCanvasMemory()},_buildLevels:function(){var e=[{url:this._image.src,width:this._image.naturalWidth,height:this._image.naturalHeight}];if(!this.buildPyramid||!t.supportsCanvas||!this.useCanvas)return delete this._image,e;var i=this._image.naturalWidth,n=this._image.naturalHeight,r=document.createElement("canvas"),o=r.getContext("2d");if(r.width=i,r.height=n,o.drawImage(this._image,0,0,i,n),e[0].context2D=o,delete this._image,t.isCanvasTainted(r))return e;for(;i>=2&&n>=2;){i=Math.floor(i/2),n=Math.floor(n/2);var a=document.createElement("canvas"),s=a.getContext("2d");a.width=i,a.height=n,s.drawImage(r,0,0,i,n),e.splice(0,0,{context2D:s,width:i,height:n}),r=a,o=s}return e},_freeupCanvasMemory:function(){for(var t=0;t<this.levels.length;t++)this.levels[t].context2D&&(this.levels[t].context2D.canvas.height=0,this.levels[t].context2D.canvas.width=0)}})}(s),function(t){t.TileSourceCollection=function(e,i,n,r){t.console.error("TileSourceCollection is deprecated; use World instead")}}(s),function(t){function e(i){t.requestAnimationFrame(function(){!function(i){var n;i.shouldFade&&(n=1-(t.now()-i.fadeBeginTime)/i.fadeLength,n=Math.min(1,n),n=Math.max(0,n),i.imgGroup&&t.setElementOpacity(i.imgGroup,n,!0),n>0&&e(i))}(i)})}function i(e,i){e.element.disabled||(i>=t.ButtonState.GROUP&&e.currentState===t.ButtonState.REST&&(!function(e){e.shouldFade=!1,e.imgGroup&&t.setElementOpacity(e.imgGroup,1,!0)}(e),e.currentState=t.ButtonState.GROUP),i>=t.ButtonState.HOVER&&e.currentState===t.ButtonState.GROUP&&(e.imgHover&&(e.imgHover.style.visibility=""),e.currentState=t.ButtonState.HOVER),i>=t.ButtonState.DOWN&&e.currentState===t.ButtonState.HOVER&&(e.imgDown&&(e.imgDown.style.visibility=""),e.currentState=t.ButtonState.DOWN))}function n(i,n){i.element.disabled||(n<=t.ButtonState.HOVER&&i.currentState===t.ButtonState.DOWN&&(i.imgDown&&(i.imgDown.style.visibility="hidden"),i.currentState=t.ButtonState.HOVER),n<=t.ButtonState.GROUP&&i.currentState===t.ButtonState.HOVER&&(i.imgHover&&(i.imgHover.style.visibility="hidden"),i.currentState=t.ButtonState.GROUP),n<=t.ButtonState.REST&&i.currentState===t.ButtonState.GROUP&&(!function(i){i.shouldFade=!0,i.fadeBeginTime=t.now()+i.fadeDelay,window.setTimeout(function(){e(i)},i.fadeDelay)}(i),i.currentState=t.ButtonState.REST))}t.ButtonState={REST:0,GROUP:1,HOVER:2,DOWN:3},t.Button=function(e){var r=this;t.EventSource.call(this),t.extend(!0,this,{tooltip:null,srcRest:null,srcGroup:null,srcHover:null,srcDown:null,clickTimeThreshold:t.DEFAULT_SETTINGS.clickTimeThreshold,clickDistThreshold:t.DEFAULT_SETTINGS.clickDistThreshold,fadeDelay:0,fadeLength:2e3,onPress:null,onRelease:null,onClick:null,onEnter:null,onExit:null,onFocus:null,onBlur:null,userData:null},e),this.element=e.element||t.makeNeutralElement("div"),e.element||(this.imgRest=t.makeTransparentImage(this.srcRest),this.imgGroup=t.makeTransparentImage(this.srcGroup),this.imgHover=t.makeTransparentImage(this.srcHover),this.imgDown=t.makeTransparentImage(this.srcDown),this.imgRest.alt=this.imgGroup.alt=this.imgHover.alt=this.imgDown.alt=this.tooltip,t.setElementPointerEventsNone(this.imgRest),t.setElementPointerEventsNone(this.imgGroup),t.setElementPointerEventsNone(this.imgHover),t.setElementPointerEventsNone(this.imgDown),this.element.style.position="relative",t.setElementTouchActionNone(this.element),this.imgGroup.style.position=this.imgHover.style.position=this.imgDown.style.position="absolute",this.imgGroup.style.top=this.imgHover.style.top=this.imgDown.style.top="0px",this.imgGroup.style.left=this.imgHover.style.left=this.imgDown.style.left="0px",this.imgHover.style.visibility=this.imgDown.style.visibility="hidden",t.Browser.vendor===t.BROWSERS.FIREFOX&&t.Browser.version<3&&(this.imgGroup.style.top=this.imgHover.style.top=this.imgDown.style.top=""),this.element.appendChild(this.imgRest),this.element.appendChild(this.imgGroup),this.element.appendChild(this.imgHover),this.element.appendChild(this.imgDown)),this.addHandler("press",this.onPress),this.addHandler("release",this.onRelease),this.addHandler("click",this.onClick),this.addHandler("enter",this.onEnter),this.addHandler("exit",this.onExit),this.addHandler("focus",this.onFocus),this.addHandler("blur",this.onBlur),this.currentState=t.ButtonState.GROUP,this.fadeBeginTime=null,this.shouldFade=!1,this.element.style.display="inline-block",this.element.style.position="relative",this.element.title=this.tooltip,this.tracker=new t.MouseTracker({userData:"Button.tracker",element:this.element,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,enterHandler:function(e){e.insideElementPressed?(i(r,t.ButtonState.DOWN),r.raiseEvent("enter",{originalEvent:e.originalEvent})):e.buttonDownAny||i(r,t.ButtonState.HOVER)},focusHandler:function(t){r.tracker.enterHandler(t),r.raiseEvent("focus",{originalEvent:t.originalEvent})},leaveHandler:function(e){n(r,t.ButtonState.GROUP),e.insideElementPressed&&r.raiseEvent("exit",{originalEvent:e.originalEvent})},blurHandler:function(t){r.tracker.leaveHandler(t),r.raiseEvent("blur",{originalEvent:t.originalEvent})},pressHandler:function(e){i(r,t.ButtonState.DOWN),r.raiseEvent("press",{originalEvent:e.originalEvent})},releaseHandler:function(e){e.insideElementPressed&&e.insideElementReleased?(n(r,t.ButtonState.HOVER),r.raiseEvent("release",{originalEvent:e.originalEvent})):e.insideElementPressed?n(r,t.ButtonState.GROUP):i(r,t.ButtonState.HOVER)},clickHandler:function(t){t.quick&&r.raiseEvent("click",{originalEvent:t.originalEvent})},keyHandler:function(t){13===t.keyCode?(r.raiseEvent("click",{originalEvent:t.originalEvent}),r.raiseEvent("release",{originalEvent:t.originalEvent}),t.preventDefault=!0):t.preventDefault=!1}}),n(this,t.ButtonState.REST)},t.extend(t.Button.prototype,t.EventSource.prototype,{notifyGroupEnter:function(){i(this,t.ButtonState.GROUP)},notifyGroupExit:function(){n(this,t.ButtonState.REST)},disable:function(){this.notifyGroupExit(),this.element.disabled=!0,this.tracker.setTracking(!1),t.setElementOpacity(this.element,.2,!0)},enable:function(){this.element.disabled=!1,this.tracker.setTracking(!0),t.setElementOpacity(this.element,1,!0),this.notifyGroupEnter()},destroy:function(){this.imgRest&&(this.element.removeChild(this.imgRest),this.imgRest=null),this.imgGroup&&(this.element.removeChild(this.imgGroup),this.imgGroup=null),this.imgHover&&(this.element.removeChild(this.imgHover),this.imgHover=null),this.imgDown&&(this.element.removeChild(this.imgDown),this.imgDown=null),this.removeAllHandlers(),this.tracker.destroy(),this.element=null}})}(s),function(t){t.ButtonGroup=function(e){t.extend(!0,this,{buttons:[],clickTimeThreshold:t.DEFAULT_SETTINGS.clickTimeThreshold,clickDistThreshold:t.DEFAULT_SETTINGS.clickDistThreshold,labelText:""},e);var i,n=this.buttons.concat([]),r=this;if(this.element=e.element||t.makeNeutralElement("div"),!e.group)for(this.element.style.display="inline-block",i=0;i<n.length;i++)this.element.appendChild(n[i].element);t.setElementTouchActionNone(this.element),this.tracker=new t.MouseTracker({userData:"ButtonGroup.tracker",element:this.element,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,enterHandler:function(t){var e;for(e=0;e<r.buttons.length;e++)r.buttons[e].notifyGroupEnter()},leaveHandler:function(t){var e;if(!t.insideElementPressed)for(e=0;e<r.buttons.length;e++)r.buttons[e].notifyGroupExit()}})},t.ButtonGroup.prototype={addButton:function(t){this.buttons.push(t),this.element.appendChild(t.element)},emulateEnter:function(){this.tracker.enterHandler({eventSource:this.tracker})},emulateLeave:function(){this.tracker.leaveHandler({eventSource:this.tracker})},destroy:function(){for(;this.buttons.length;){var t=this.buttons.pop();this.element.removeChild(t.element),t.destroy()}this.tracker.destroy(),this.element=null}}}(s),function(t){t.Rect=function(e,i,n,r,o){var a,s;this.x="number"==typeof e?e:0,this.y="number"==typeof i?i:0,this.width="number"==typeof n?n:0,this.height="number"==typeof r?r:0,this.degrees="number"==typeof o?o:0,this.degrees=t.positiveModulo(this.degrees,360),this.degrees>=270?(a=this.getTopRight(),this.x=a.x,this.y=a.y,s=this.height,this.height=this.width,this.width=s,this.degrees-=270):this.degrees>=180?(a=this.getBottomRight(),this.x=a.x,this.y=a.y,this.degrees-=180):this.degrees>=90&&(a=this.getBottomLeft(),this.x=a.x,this.y=a.y,s=this.height,this.height=this.width,this.width=s,this.degrees-=90)},t.Rect.fromSummits=function(e,i,n){var r=e.distanceTo(i),o=e.distanceTo(n),a=i.minus(e),s=Math.atan(a.y/a.x);return a.x<0?s+=Math.PI:a.y<0&&(s+=2*Math.PI),new t.Rect(e.x,e.y,r,o,s/Math.PI*180)},t.Rect.prototype={clone:function(){return new t.Rect(this.x,this.y,this.width,this.height,this.degrees)},getAspectRatio:function(){return this.width/this.height},getTopLeft:function(){return new t.Point(this.x,this.y)},getBottomRight:function(){return new t.Point(this.x+this.width,this.y+this.height).rotate(this.degrees,this.getTopLeft())},getTopRight:function(){return new t.Point(this.x+this.width,this.y).rotate(this.degrees,this.getTopLeft())},getBottomLeft:function(){return new t.Point(this.x,this.y+this.height).rotate(this.degrees,this.getTopLeft())},getCenter:function(){return new t.Point(this.x+this.width/2,this.y+this.height/2).rotate(this.degrees,this.getTopLeft())},getSize:function(){return new t.Point(this.width,this.height)},equals:function(e){return e instanceof t.Rect&&this.x===e.x&&this.y===e.y&&this.width===e.width&&this.height===e.height&&this.degrees===e.degrees},times:function(e){return new t.Rect(this.x*e,this.y*e,this.width*e,this.height*e,this.degrees)},translate:function(e){return new t.Rect(this.x+e.x,this.y+e.y,this.width,this.height,this.degrees)},union:function(e){var i=this.getBoundingBox(),n=e.getBoundingBox(),r=Math.min(i.x,n.x),o=Math.min(i.y,n.y),a=Math.max(i.x+i.width,n.x+n.width),s=Math.max(i.y+i.height,n.y+n.height);return new t.Rect(r,o,a-r,s-o)},intersection:function(e){var i=1e-10,n=[],r=this.getTopLeft();e.containsPoint(r,i)&&n.push(r);var o=this.getTopRight();e.containsPoint(o,i)&&n.push(o);var a=this.getBottomLeft();e.containsPoint(a,i)&&n.push(a);var s=this.getBottomRight();e.containsPoint(s,i)&&n.push(s);var l=e.getTopLeft();this.containsPoint(l,i)&&n.push(l);var h=e.getTopRight();this.containsPoint(h,i)&&n.push(h);var u=e.getBottomLeft();this.containsPoint(u,i)&&n.push(u);var c=e.getBottomRight();this.containsPoint(c,i)&&n.push(c);for(var p=this._getSegments(),f=e._getSegments(),d=0;d<p.length;d++)for(var v=p[d],g=0;g<f.length;g++){var y=f[g],m=w(v[0],v[1],y[0],y[1]);m&&n.push(m)}function w(e,n,r,o){var a=n.minus(e),s=o.minus(r),l=-s.x*a.y+a.x*s.y;if(0===l)return null;var h=(a.x*(e.y-r.y)-a.y*(e.x-r.x))/l,u=(s.x*(e.y-r.y)-s.y*(e.x-r.x))/l;return-1e-10<=h&&h<=1-i&&-1e-10<=u&&u<=1-i?new t.Point(e.x+u*a.x,e.y+u*a.y):null}if(0===n.length)return null;for(var x=n[0].x,b=n[0].x,_=n[0].y,T=n[0].y,S=1;S<n.length;S++){var P=n[S];P.x<x&&(x=P.x),P.x>b&&(b=P.x),P.y<_&&(_=P.y),P.y>T&&(T=P.y)}return new t.Rect(x,_,b-x,T-_)},_getSegments:function(){var t=this.getTopLeft(),e=this.getTopRight(),i=this.getBottomLeft(),n=this.getBottomRight();return[[t,e],[e,n],[n,i],[i,t]]},rotate:function(e,i){if(0===(e=t.positiveModulo(e,360)))return this.clone();i=i||this.getCenter();var n=this.getTopLeft().rotate(e,i),r=this.getTopRight().rotate(e,i).minus(n);r=r.apply(function(t){return Math.abs(t)<1e-15?0:t});var o=Math.atan(r.y/r.x);return r.x<0?o+=Math.PI:r.y<0&&(o+=2*Math.PI),new t.Rect(n.x,n.y,this.width,this.height,o/Math.PI*180)},getBoundingBox:function(){if(0===this.degrees)return this.clone();var e=this.getTopLeft(),i=this.getTopRight(),n=this.getBottomLeft(),r=this.getBottomRight(),o=Math.min(e.x,i.x,n.x,r.x),a=Math.max(e.x,i.x,n.x,r.x),s=Math.min(e.y,i.y,n.y,r.y),l=Math.max(e.y,i.y,n.y,r.y);return new t.Rect(o,s,a-o,l-s)},getIntegerBoundingBox:function(){var e=this.getBoundingBox(),i=Math.floor(e.x),n=Math.floor(e.y),r=Math.ceil(e.width+e.x-i),o=Math.ceil(e.height+e.y-n);return new t.Rect(i,n,r,o)},containsPoint:function(t,e){e=e||0;var i=this.getTopLeft(),n=this.getTopRight(),r=this.getBottomLeft(),o=n.minus(i),a=r.minus(i);return(t.x-i.x)*o.x+(t.y-i.y)*o.y>=-e&&(t.x-n.x)*o.x+(t.y-n.y)*o.y<=e&&(t.x-i.x)*a.x+(t.y-i.y)*a.y>=-e&&(t.x-r.x)*a.x+(t.y-r.y)*a.y<=e},toString:function(){return"["+Math.round(100*this.x)/100+", "+Math.round(100*this.y)/100+", "+Math.round(100*this.width)/100+"x"+Math.round(100*this.height)/100+", "+Math.round(100*this.degrees)/100+"deg]"}}}(s),function(t){var e={};function i(t){var e;t.quick&&(e="horizontal"===this.scroll?Math.floor(t.position.x/(this.panelWidth+4)):Math.floor(t.position.y/this.panelHeight),this.viewer.goToPage(e));this.element.focus()}function n(e){if(this.dragging=!0,this.element){var i=Number(this.element.style.marginLeft.replace("px","")),n=Number(this.element.style.marginTop.replace("px","")),r=Number(this.element.style.width.replace("px","")),a=Number(this.element.style.height.replace("px","")),s=t.getElementSize(this.viewer.canvas);"horizontal"===this.scroll?-e.delta.x>0?i>-(r-s.x)&&(this.element.style.marginLeft=i+2*e.delta.x+"px",o(this,s.x,i+2*e.delta.x)):-e.delta.x<0&&i<0&&(this.element.style.marginLeft=i+2*e.delta.x+"px",o(this,s.x,i+2*e.delta.x)):-e.delta.y>0?n>-(a-s.y)&&(this.element.style.marginTop=n+2*e.delta.y+"px",o(this,s.y,n+2*e.delta.y)):-e.delta.y<0&&n<0&&(this.element.style.marginTop=n+2*e.delta.y+"px",o(this,s.y,n+2*e.delta.y))}}function r(e){if(this.element){var i=Number(this.element.style.marginLeft.replace("px","")),n=Number(this.element.style.marginTop.replace("px","")),r=Number(this.element.style.width.replace("px","")),a=Number(this.element.style.height.replace("px","")),s=t.getElementSize(this.viewer.canvas);"horizontal"===this.scroll?e.scroll>0?i>-(r-s.x)&&(this.element.style.marginLeft=i-60*e.scroll+"px",o(this,s.x,i-60*e.scroll)):e.scroll<0&&i<0&&(this.element.style.marginLeft=i-60*e.scroll+"px",o(this,s.x,i-60*e.scroll)):e.scroll<0?n>s.y-a&&(this.element.style.marginTop=n+60*e.scroll+"px",o(this,s.y,n+60*e.scroll)):e.scroll>0&&n<0&&(this.element.style.marginTop=n+60*e.scroll+"px",o(this,s.y,n+60*e.scroll)),e.preventDefault=!0}}function o(e,i,n){var r,o,a,s,l,h;for(r="horizontal"===e.scroll?e.panelWidth:e.panelHeight,o=Math.ceil(i/r)+5,l=o=(o=(a=Math.ceil((Math.abs(n)+i)/r)+1)-o)<0?0:o;l<a&&l<e.panels.length;l++)if(!(h=e.panels[l]).activePanel){var u,c=e.viewer.tileSources[l];u=c.referenceStripThumbnailUrl?{type:"image",url:c.referenceStripThumbnailUrl}:c,s=new t.Viewer({id:h.id,tileSources:[u],element:h,navigatorSizeRatio:e.sizeRatio,showNavigator:!1,mouseNavEnabled:!1,showNavigationControl:!1,showSequenceControl:!1,immediateRender:!0,blendTime:0,animationTime:0,loadTilesWithAjax:e.viewer.loadTilesWithAjax,ajaxHeaders:e.viewer.ajaxHeaders,useCanvas:e.useCanvas}),t.setElementPointerEventsNone(s.canvas),t.setElementPointerEventsNone(s.container),s.innerTracker.setTracking(!1),s.outerTracker.setTracking(!1),e.miniViewers[h.id]=s,h.activePanel=!0}}function a(t){var e=t.eventSource.element;"horizontal"===this.scroll?e.style.marginBottom="0px":e.style.marginLeft="0px"}function s(e){var i=e.eventSource.element;"horizontal"===this.scroll?i.style.marginBottom="-"+t.getElementSize(i).y/2+"px":i.style.marginLeft="-"+t.getElementSize(i).x/2+"px"}function l(t){if(t.ctrl||t.alt||t.meta)t.preventDefault=!1;else switch(t.keyCode){case 38:case 39:r.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null}),t.preventDefault=!0;break;case 40:case 37:r.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null}),t.preventDefault=!0;break;default:t.preventDefault=!1}}function h(t){if(t.ctrl||t.alt||t.meta)t.preventDefault=!1;else switch(t.keyCode){case 61:case 48:case 119:case 87:case 100:r.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null}),t.preventDefault=!0;break;case 45:case 115:case 83:case 97:r.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null}),t.preventDefault=!0;break;default:t.preventDefault=!1}}t.ReferenceStrip=function(u){var c,p,f,d=u.viewer,v=t.getElementSize(d.element);for(u.id||(u.id="referencestrip-"+t.now(),this.element=t.makeNeutralElement("div"),this.element.id=u.id,this.element.className="referencestrip"),u=t.extend(!0,{sizeRatio:t.DEFAULT_SETTINGS.referenceStripSizeRatio,position:t.DEFAULT_SETTINGS.referenceStripPosition,scroll:t.DEFAULT_SETTINGS.referenceStripScroll,clickTimeThreshold:t.DEFAULT_SETTINGS.clickTimeThreshold},u,{element:this.element}),t.extend(this,u),e[this.id]={animating:!1},this.minPixelRatio=this.viewer.minPixelRatio,this.element.tabIndex=0,(p=this.element.style).marginTop="0px",p.marginRight="0px",p.marginBottom="0px",p.marginLeft="0px",p.left="0px",p.bottom="0px",p.border="0px",p.background="#000",p.position="relative",t.setElementTouchActionNone(this.element),t.setElementOpacity(this.element,.8),this.viewer=d,this.tracker=new t.MouseTracker({userData:"ReferenceStrip.tracker",element:this.element,clickHandler:t.delegate(this,i),dragHandler:t.delegate(this,n),scrollHandler:t.delegate(this,r),enterHandler:t.delegate(this,a),leaveHandler:t.delegate(this,s),keyDownHandler:t.delegate(this,l),keyHandler:t.delegate(this,h),preProcessEventHandler:function(t){"wheel"===t.eventType&&(t.preventDefault=!0)}}),u.width&&u.height?(this.element.style.width=u.width+"px",this.element.style.height=u.height+"px",d.addControl(this.element,{anchor:t.ControlAnchor.BOTTOM_LEFT})):"horizontal"===u.scroll?(this.element.style.width=v.x*u.sizeRatio*d.tileSources.length+12*d.tileSources.length+"px",this.element.style.height=v.y*u.sizeRatio+"px",d.addControl(this.element,{anchor:t.ControlAnchor.BOTTOM_LEFT})):(this.element.style.height=v.y*u.sizeRatio*d.tileSources.length+12*d.tileSources.length+"px",this.element.style.width=v.x*u.sizeRatio+"px",d.addControl(this.element,{anchor:t.ControlAnchor.TOP_LEFT})),this.panelWidth=v.x*this.sizeRatio+8,this.panelHeight=v.y*this.sizeRatio+8,this.panels=[],this.miniViewers={},f=0;f<d.tileSources.length;f++)(c=t.makeNeutralElement("div")).id=this.element.id+"-"+f,c.style.width=this.panelWidth+"px",c.style.height=this.panelHeight+"px",c.style.display="inline",c.style.float="left",c.style.cssFloat="left",c.style.styleFloat="left",c.style.padding="2px",t.setElementTouchActionNone(c),t.setElementPointerEventsNone(c),this.element.appendChild(c),c.activePanel=!1,this.panels.push(c);o(this,"vertical"===this.scroll?v.y:v.x,0),this.setFocus(0)},t.ReferenceStrip.prototype={setFocus:function(e){var i,n=this.element.querySelector("#"+this.element.id+"-"+e),r=t.getElementSize(this.viewer.canvas),s=Number(this.element.style.width.replace("px","")),l=Number(this.element.style.height.replace("px","")),h=-Number(this.element.style.marginLeft.replace("px","")),u=-Number(this.element.style.marginTop.replace("px",""));this.currentSelected!==n&&(this.currentSelected&&(this.currentSelected.style.background="#000"),this.currentSelected=n,this.currentSelected.style.background="#999","horizontal"===this.scroll?(i=Number(e)*(this.panelWidth+3))>h+r.x-this.panelWidth?(i=Math.min(i,s-r.x),this.element.style.marginLeft=-i+"px",o(this,r.x,-i)):i<h&&(i=Math.max(0,i-r.x/2),this.element.style.marginLeft=-i+"px",o(this,r.x,-i)):(i=Number(e)*(this.panelHeight+3))>u+r.y-this.panelHeight?(i=Math.min(i,l-r.y),this.element.style.marginTop=-i+"px",o(this,r.y,-i)):i<u&&(i=Math.max(0,i-r.y/2),this.element.style.marginTop=-i+"px",o(this,r.y,-i)),this.currentPage=e,a.call(this,{eventSource:this.tracker}))},update:function(){return!!e[this.id].animating},destroy:function(){if(this.miniViewers)for(var t in this.miniViewers)this.miniViewers[t].destroy();this.tracker.destroy(),this.element&&this.viewer.removeControl(this.element)}}}(s),function(t){t.DisplayRect=function(e,i,n,r,o,a){t.Rect.apply(this,[e,i,n,r]),this.minLevel=o,this.maxLevel=a},t.extend(t.DisplayRect.prototype,t.Rect.prototype)}(s),function(t){t.Spring=function(e){var i=arguments;"object"!=typeof e&&(e={initial:i.length&&"number"==typeof i[0]?i[0]:void 0,springStiffness:i.length>1?i[1].springStiffness:5,animationTime:i.length>1?i[1].animationTime:1.5}),t.console.assert("number"==typeof e.springStiffness&&0!==e.springStiffness,"[OpenSeadragon.Spring] options.springStiffness must be a non-zero number"),t.console.assert("number"==typeof e.animationTime&&e.animationTime>=0,"[OpenSeadragon.Spring] options.animationTime must be a number greater than or equal to 0"),e.exponential&&(this._exponential=!0,delete e.exponential),t.extend(!0,this,e),this.current={value:"number"==typeof this.initial?this.initial:this._exponential?0:1,time:t.now()},t.console.assert(!this._exponential||0!==this.current.value,"[OpenSeadragon.Spring] value must be non-zero for exponential springs"),this.start={value:this.current.value,time:this.current.time},this.target={value:this.current.value,time:this.current.time},this._exponential&&(this.start._logValue=Math.log(this.start.value),this.target._logValue=Math.log(this.target.value),this.current._logValue=Math.log(this.current.value))},t.Spring.prototype={resetTo:function(e){t.console.assert(!this._exponential||0!==e,"[OpenSeadragon.Spring.resetTo] target must be non-zero for exponential springs"),this.start.value=this.target.value=this.current.value=e,this.start.time=this.target.time=this.current.time=t.now(),this._exponential&&(this.start._logValue=Math.log(this.start.value),this.target._logValue=Math.log(this.target.value),this.current._logValue=Math.log(this.current.value))},springTo:function(e){t.console.assert(!this._exponential||0!==e,"[OpenSeadragon.Spring.springTo] target must be non-zero for exponential springs"),this.start.value=this.current.value,this.start.time=this.current.time,this.target.value=e,this.target.time=this.start.time+1e3*this.animationTime,this._exponential&&(this.start._logValue=Math.log(this.start.value),this.target._logValue=Math.log(this.target.value))},shiftBy:function(e){this.start.value+=e,this.target.value+=e,this._exponential&&(t.console.assert(0!==this.target.value&&0!==this.start.value,"[OpenSeadragon.Spring.shiftBy] spring value must be non-zero for exponential springs"),this.start._logValue=Math.log(this.start.value),this.target._logValue=Math.log(this.target.value))},setExponential:function(e){this._exponential=e,this._exponential&&(t.console.assert(0!==this.current.value&&0!==this.target.value&&0!==this.start.value,"[OpenSeadragon.Spring.setExponential] spring value must be non-zero for exponential springs"),this.start._logValue=Math.log(this.start.value),this.target._logValue=Math.log(this.target.value),this.current._logValue=Math.log(this.current.value))},update:function(){var e,i;this.current.time=t.now(),this._exponential?(e=this.start._logValue,i=this.target._logValue):(e=this.start.value,i=this.target.value);var n,r,o=this.current.time>=this.target.time?i:e+(i-e)*(n=this.springStiffness,r=(this.current.time-this.start.time)/(this.target.time-this.start.time),(1-Math.exp(n*-r))/(1-Math.exp(-n))),a=this.current.value;return this._exponential?this.current.value=Math.exp(o):this.current.value=o,a!==this.current.value},isAtTargetValue:function(){return this.current.value===this.target.value}}}(s),function(t){t.ImageJob=function(e){t.extend(!0,this,{timeout:t.DEFAULT_SETTINGS.timeout,jobId:null,tries:0},e),this.data=null,this.userData={},this.errorMsg=null},t.ImageJob.prototype={start:function(){this.tries++;var t=this,e=this.abort;this.jobId=window.setTimeout(function(){t.finish(null,null,"Image load exceeded timeout ("+t.timeout+" ms)")},this.timeout),this.abort=function(){t.source.downloadTileAbort(t),"function"==typeof e&&e()},this.source.downloadTileStart(this)},finish:function(t,e,i){this.data=t,this.request=e,this.errorMsg=i,this.jobId&&window.clearTimeout(this.jobId),this.callback(this)}},t.ImageLoader=function(e){t.extend(!0,this,{jobLimit:t.DEFAULT_SETTINGS.imageLoaderLimit,timeout:t.DEFAULT_SETTINGS.timeout,jobQueue:[],failedTiles:[],jobsInProgress:0},e)},t.ImageLoader.prototype={addJob:function(e){if(!e.source){t.console.error("ImageLoader.prototype.addJob() requires [options.source]. TileSource since new API defines how images are fetched. Creating a dummy TileSource.");var i=t.TileSource.prototype;e.source={downloadTileStart:i.downloadTileStart,downloadTileAbort:i.downloadTileAbort}}var n=this,r={src:e.src,tile:e.tile||{},source:e.source,loadWithAjax:e.loadWithAjax,ajaxHeaders:e.loadWithAjax?e.ajaxHeaders:null,crossOriginPolicy:e.crossOriginPolicy,ajaxWithCredentials:e.ajaxWithCredentials,postData:e.postData,callback:function(t){!function(t,e,i){""!==e.errorMsg&&(null===e.data||void 0===e.data)&&e.tries<1+t.tileRetryMax&&t.failedTiles.push(e);var n;t.jobsInProgress--,(!t.jobLimit||t.jobsInProgress<t.jobLimit)&&t.jobQueue.length>0&&((n=t.jobQueue.shift()).start(),t.jobsInProgress++);t.tileRetryMax>0&&0===t.jobQueue.length&&(!t.jobLimit||t.jobsInProgress<t.jobLimit)&&t.failedTiles.length>0&&(n=t.failedTiles.shift(),setTimeout(function(){n.start()},t.tileRetryDelay),t.jobsInProgress++);i(e.data,e.errorMsg,e.request)}(n,t,e.callback)},abort:e.abort,timeout:this.timeout},o=new t.ImageJob(r);!this.jobLimit||this.jobsInProgress<this.jobLimit?(o.start(),this.jobsInProgress++):this.jobQueue.push(o)},clear:function(){for(var t=0;t<this.jobQueue.length;t++){var e=this.jobQueue[t];"function"==typeof e.abort&&e.abort()}this.jobQueue=[]}}}(s),function(t){t.Tile=function(e,i,n,r,o,a,s,l,h,u,c,p){this.level=e,this.x=i,this.y=n,this.bounds=r,this.sourceBounds=u,this.exists=o,this._url=a,this.postData=c,this.context2D=s,this.loadWithAjax=l,this.ajaxHeaders=h,void 0===p&&(t.console.warn("Tile constructor needs 'cacheKey' variable: creation tile cache in Tile class is deprecated. TileSource.prototype.getTileHashKey will be used."),p=t.TileSource.prototype.getTileHashKey(e,i,n,a,h,c)),this.cacheKey=p,this.loaded=!1,this.loading=!1,this.element=null,this.imgElement=null,this.style=null,this.position=null,this.size=null,this.flipped=!1,this.blendStart=null,this.opacity=null,this.squaredDistance=null,this.visibility=null,this.hasTransparency=!1,this.beingDrawn=!1,this.lastTouchTime=0,this.isRightMost=!1,this.isBottomMost=!1},t.Tile.prototype={toString:function(){return this.level+"/"+this.x+"_"+this.y},_hasTransparencyChannel:function(){return!!this.context2D||this.getUrl().match(".png")},drawHTML:function(e){if(this.cacheImageRecord)if(this.loaded){if(!this.element){var i=this.getImage();if(!i)return;this.element=t.makeNeutralElement("div"),this.imgElement=i.cloneNode(),this.imgElement.style.msInterpolationMode="nearest-neighbor",this.imgElement.style.width="100%",this.imgElement.style.height="100%",this.style=this.element.style,this.style.position="absolute"}this.element.parentNode!==e&&e.appendChild(this.element),this.imgElement.parentNode!==this.element&&this.element.appendChild(this.imgElement),this.style.top=this.position.y+"px",this.style.left=this.position.x+"px",this.style.height=this.size.y+"px",this.style.width=this.size.x+"px",this.flipped&&(this.style.transform="scaleX(-1)"),t.setElementOpacity(this.element,this.opacity)}else t.console.warn("Attempting to draw tile %s when it's not yet loaded.",this.toString());else t.console.warn("[Tile.drawHTML] attempting to draw tile %s when it's not cached",this.toString())},get image(){return t.console.error("[Tile.image] property has been deprecated. Use [Tile.prototype.getImage] instead."),this.getImage()},get url(){return t.console.error("[Tile.url] property has been deprecated. Use [Tile.prototype.getUrl] instead."),this.getUrl()},getImage:function(){return this.cacheImageRecord.getImage()},getUrl:function(){return"function"==typeof this._url?this._url():this._url},getCanvasContext:function(){return this.context2D||this.cacheImageRecord.getRenderedContext()},drawCanvas:function(e,i,n,r,o,a){var s,l,h,u=this.position.times(t.pixelDensityRatio),c=this.size.times(t.pixelDensityRatio);this.context2D||this.cacheImageRecord?(s=this.getCanvasContext(),this.loaded&&s?(e.save(),e.globalAlpha=this.opacity,"number"==typeof n&&1!==n&&(u=u.times(n),c=c.times(n)),r instanceof t.Point&&(u=u.plus(r)),1===e.globalAlpha&&this.hasTransparency&&(o&&(u.x=Math.round(u.x),u.y=Math.round(u.y),c.x=Math.round(c.x),c.y=Math.round(c.y)),e.clearRect(u.x,u.y,c.x,c.y)),this.sourceBounds?(l=Math.min(this.sourceBounds.width,s.canvas.width),h=Math.min(this.sourceBounds.height,s.canvas.height)):(l=s.canvas.width,h=s.canvas.height),e.translate(u.x+c.x/2,0),this.flipped&&e.scale(-1,1),i({context:e,tile:this,rendered:s,initRendered:this.cacheImageRecord?this.cacheImageRecord.getCopyRenderedContext():void 0,sourceWidth:l,sourceHeight:h,position:{original:u,x:-c.x/2,y:u.y},size:c,pixelDensityRatio:t.pixelDensityRatio}),e.restore()):t.console.warn("Attempting to draw tile %s when it's not yet loaded.",this.toString())):t.console.warn("[Tile.drawCanvas] attempting to draw tile %s when it's not cached",this.toString())},getScaleForEdgeSmoothing:function(){var e;if(this.cacheImageRecord)e=this.cacheImageRecord.getRenderedContext();else{if(!this.context2D)return t.console.warn("[Tile.drawCanvas] attempting to get tile scale %s when tile's not cached",this.toString()),1;e=this.context2D}return e.canvas.width/(this.size.x*t.pixelDensityRatio)},getTranslationForEdgeSmoothing:function(e,i,n){var r=Math.max(1,Math.ceil((n.x-i.x)/2)),o=Math.max(1,Math.ceil((n.y-i.y)/2));return new t.Point(r,o).minus(this.position.times(t.pixelDensityRatio).times(e||1).apply(function(t){return t%1}))},unload:function(){this.imgElement&&this.imgElement.parentNode&&this.imgElement.parentNode.removeChild(this.imgElement),this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.element=null,this.imgElement=null,this.loaded=!1,this.loading=!1}}}(s),function(t){t.OverlayPlacement=t.Placement,t.OverlayRotationMode=t.freezeObject({NO_ROTATION:1,EXACT:2,BOUNDING_BOX:3}),t.Overlay=function(e,i,n){var r;r=t.isPlainObject(e)?e:{element:e,location:i,placement:n},this.element=r.element,this.style=r.element.style,this._init(r)},t.Overlay.prototype={_init:function(e){this.location=e.location,this.placement=void 0===e.placement?t.Placement.TOP_LEFT:e.placement,this.onDraw=e.onDraw,this.checkResize=void 0===e.checkResize||e.checkResize,this.width=void 0===e.width?null:e.width,this.height=void 0===e.height?null:e.height,this.rotationMode=e.rotationMode||t.OverlayRotationMode.EXACT,this.location instanceof t.Rect&&(this.width=this.location.width,this.height=this.location.height,this.location=this.location.getTopLeft(),this.placement=t.Placement.TOP_LEFT),this.scales=null!==this.width&&null!==this.height,this.bounds=new t.Rect(this.location.x,this.location.y,this.width,this.height),this.position=this.location},adjust:function(e,i){var n=t.Placement.properties[this.placement];n&&(n.isHorizontallyCentered?e.x-=i.x/2:n.isRight&&(e.x-=i.x),n.isVerticallyCentered?e.y-=i.y/2:n.isBottom&&(e.y-=i.y))},destroy:function(){var e=this.element,i=this.style;e.parentNode&&(e.parentNode.removeChild(e),e.prevElementParent&&(i.display="none",document.body.appendChild(e))),this.onDraw=null,i.top="",i.left="",i.position="",null!==this.width&&(i.width=""),null!==this.height&&(i.height="");var n=t.getCssPropertyWithVendorPrefix("transformOrigin"),r=t.getCssPropertyWithVendorPrefix("transform");n&&r&&(i[n]="",i[r]="")},drawHTML:function(e,i){var n=this.element;n.parentNode!==e&&(n.prevElementParent=n.parentNode,n.prevNextSibling=n.nextSibling,e.appendChild(n),this.style.position="absolute",this.size=t.getElementSize(n));var r=this._getOverlayPositionAndSize(i),o=r.position,a=this.size=r.size,s=r.rotate;if(this.onDraw)this.onDraw(o,a,this.element);else{var l=this.style;l.left=o.x+"px",l.top=o.y+"px",null!==this.width&&(l.width=a.x+"px"),null!==this.height&&(l.height=a.y+"px");var h=t.getCssPropertyWithVendorPrefix("transformOrigin"),u=t.getCssPropertyWithVendorPrefix("transform");h&&u&&(s?(l[h]=this._getTransformOrigin(),l[u]="rotate("+s+"deg)"):(l[h]="",l[u]="")),l.display="block"}},_getOverlayPositionAndSize:function(e){var i=e.pixelFromPoint(this.location,!0),n=this._getSizeInPixels(e);this.adjust(i,n);var r=0;if(e.getRotation(!0)&&this.rotationMode!==t.OverlayRotationMode.NO_ROTATION)if(this.rotationMode===t.OverlayRotationMode.BOUNDING_BOX&&null!==this.width&&null!==this.height){var o=new t.Rect(i.x,i.y,n.x,n.y),a=this._getBoundingBox(o,e.getRotation(!0));i=a.getTopLeft(),n=a.getSize()}else r=e.getRotation(!0);return{position:i,size:n,rotate:r}},_getSizeInPixels:function(e){var i=this.size.x,n=this.size.y;if(null!==this.width||null!==this.height){var r=e.deltaPixelsFromPointsNoRotate(new t.Point(this.width||0,this.height||0),!0);null!==this.width&&(i=r.x),null!==this.height&&(n=r.y)}if(this.checkResize&&(null===this.width||null===this.height)){var o=this.size=t.getElementSize(this.element);null===this.width&&(i=o.x),null===this.height&&(n=o.y)}return new t.Point(i,n)},_getBoundingBox:function(t,e){var i=this._getPlacementPoint(t);return t.rotate(e,i).getBoundingBox()},_getPlacementPoint:function(e){var i=new t.Point(e.x,e.y),n=t.Placement.properties[this.placement];return n&&(n.isHorizontallyCentered?i.x+=e.width/2:n.isRight&&(i.x+=e.width),n.isVerticallyCentered?i.y+=e.height/2:n.isBottom&&(i.y+=e.height)),i},_getTransformOrigin:function(){var e="",i=t.Placement.properties[this.placement];return i?(i.isLeft?e="left":i.isRight&&(e="right"),i.isTop?e+=" top":i.isBottom&&(e+=" bottom"),e):e},update:function(e,i){var n=t.isPlainObject(e)?e:{location:e,placement:i};this._init({location:n.location||this.location,placement:void 0!==n.placement?n.placement:this.placement,onDraw:n.onDraw||this.onDraw,checkResize:n.checkResize||this.checkResize,width:void 0!==n.width?n.width:this.width,height:void 0!==n.height?n.height:this.height,rotationMode:n.rotationMode||this.rotationMode})},getBounds:function(e){t.console.assert(e,"A viewport must now be passed to Overlay.getBounds.");var i=this.width,n=this.height;if(null===i||null===n){var r=e.deltaPointsFromPixelsNoRotate(this.size,!0);null===i&&(i=r.x),null===n&&(n=r.y)}var o=this.location.clone();return this.adjust(o,new t.Point(i,n)),this._adjustBoundsForRotation(e,new t.Rect(o.x,o.y,i,n))},_adjustBoundsForRotation:function(e,i){if(!e||0===e.getRotation(!0)||this.rotationMode===t.OverlayRotationMode.EXACT)return i;if(this.rotationMode===t.OverlayRotationMode.BOUNDING_BOX){if(null===this.width||null===this.height)return i;var n=this._getOverlayPositionAndSize(e);return e.viewerElementToViewportRectangle(new t.Rect(n.position.x,n.position.y,n.size.x,n.size.y))}return i.rotate(-e.getRotation(!0),this._getPlacementPoint(i))}}}(s),function(t){t.Drawer=function(e){t.console.assert(e.viewer,"[Drawer] options.viewer is required");var i=arguments;if(t.isPlainObject(e)||(e={source:i[0],viewport:i[1],element:i[2]}),t.console.assert(e.viewport,"[Drawer] options.viewport is required"),t.console.assert(e.element,"[Drawer] options.element is required"),e.source&&t.console.error("[Drawer] options.source is no longer accepted; use TiledImage instead"),this.viewer=e.viewer,this.viewport=e.viewport,this.debugGridColor="string"==typeof e.debugGridColor?[e.debugGridColor]:e.debugGridColor||t.DEFAULT_SETTINGS.debugGridColor,e.opacity&&t.console.error("[Drawer] options.opacity is no longer accepted; set the opacity on the TiledImage instead"),this.useCanvas=t.supportsCanvas&&(!this.viewer||this.viewer.useCanvas),this.container=t.getElement(e.element),this.canvas=t.makeNeutralElement(this.useCanvas?"canvas":"div"),this.context=this.useCanvas?this.canvas.getContext("2d"):null,this.sketchCanvas=null,this.sketchContext=null,this.element=this.container,this.container.dir="ltr",this.useCanvas){var n=this._calculateCanvasSize();this.canvas.width=n.x,this.canvas.height=n.y}this.canvas.style.width="100%",this.canvas.style.height="100%",this.canvas.style.position="absolute",t.setElementOpacity(this.canvas,this.opacity,!0),t.setElementPointerEventsNone(this.canvas),t.setElementTouchActionNone(this.canvas),this.container.style.textAlign="left",this.container.appendChild(this.canvas),this._imageSmoothingEnabled=!0},t.Drawer.prototype={addOverlay:function(e,i,n,r){return t.console.error("drawer.addOverlay is deprecated. Use viewer.addOverlay instead."),this.viewer.addOverlay(e,i,n,r),this},updateOverlay:function(e,i,n){return t.console.error("drawer.updateOverlay is deprecated. Use viewer.updateOverlay instead."),this.viewer.updateOverlay(e,i,n),this},removeOverlay:function(e){return t.console.error("drawer.removeOverlay is deprecated. Use viewer.removeOverlay instead."),this.viewer.removeOverlay(e),this},clearOverlays:function(){return t.console.error("drawer.clearOverlays is deprecated. Use viewer.clearOverlays instead."),this.viewer.clearOverlays(),this},viewportCoordToDrawerCoord:function(e){var i=this.viewport.pixelFromPointNoRotate(e,!0);return new t.Point(i.x*t.pixelDensityRatio,i.y*t.pixelDensityRatio)},clipWithPolygons:function(t,e){if(this.useCanvas){var i=this._getContext(e);i.beginPath(),t.forEach(function(t){t.forEach(function(t,e){i[0===e?"moveTo":"lineTo"](t.x,t.y)})}),i.clip()}},setOpacity:function(e){t.console.error("drawer.setOpacity is deprecated. Use tiledImage.setOpacity instead.");for(var i=this.viewer.world,n=0;n<i.getItemCount();n++)i.getItemAt(n).setOpacity(e);return this},getOpacity:function(){t.console.error("drawer.getOpacity is deprecated. Use tiledImage.getOpacity instead.");for(var e=this.viewer.world,i=0,n=0;n<e.getItemCount();n++){var r=e.getItemAt(n).getOpacity();r>i&&(i=r)}return i},needsUpdate:function(){return t.console.error("[Drawer.needsUpdate] this function is deprecated. Use World.needsDraw instead."),this.viewer.world.needsDraw()},numTilesLoaded:function(){return t.console.error("[Drawer.numTilesLoaded] this function is deprecated. Use TileCache.numTilesLoaded instead."),this.viewer.tileCache.numTilesLoaded()},reset:function(){return t.console.error("[Drawer.reset] this function is deprecated. Use World.resetItems instead."),this.viewer.world.resetItems(),this},update:function(){return t.console.error("[Drawer.update] this function is deprecated. Use Drawer.clear and World.draw instead."),this.clear(),this.viewer.world.draw(),this},canRotate:function(){return this.useCanvas},destroy:function(){this.canvas.width=1,this.canvas.height=1,this.sketchCanvas=null,this.sketchContext=null},clear:function(){if(this.canvas.innerHTML="",this.useCanvas){var t=this._calculateCanvasSize();if((this.canvas.width!==t.x||this.canvas.height!==t.y)&&(this.canvas.width=t.x,this.canvas.height=t.y,this._updateImageSmoothingEnabled(this.context),null!==this.sketchCanvas)){var e=this._calculateSketchCanvasSize();this.sketchCanvas.width=e.x,this.sketchCanvas.height=e.y,this._updateImageSmoothingEnabled(this.sketchContext)}this._clear()}},_clear:function(t,e){if(this.useCanvas){var i=this._getContext(t);if(e)i.clearRect(e.x,e.y,e.width,e.height);else{var n=i.canvas;i.clearRect(0,0,n.width,n.height)}}},viewportToDrawerRectangle:function(e){var i=this.viewport.pixelFromPointNoRotate(e.getTopLeft(),!0),n=this.viewport.deltaPixelsFromPointsNoRotate(e.getSize(),!0);return new t.Rect(i.x*t.pixelDensityRatio,i.y*t.pixelDensityRatio,n.x*t.pixelDensityRatio,n.y*t.pixelDensityRatio)},drawTile:function(e,i,n,r,o,a,s){if(t.console.assert(e,"[Drawer.drawTile] tile is required"),t.console.assert(i,"[Drawer.drawTile] drawingHandler is required"),this.useCanvas){var l=this._getContext(n);r=r||1,e.drawCanvas(l,i,r,o,a,s)}else e.drawHTML(this.canvas)},_getContext:function(t){var e=this.context;if(t){if(null===this.sketchCanvas){this.sketchCanvas=document.createElement("canvas");var i=this._calculateSketchCanvasSize();if(this.sketchCanvas.width=i.x,this.sketchCanvas.height=i.y,this.sketchContext=this.sketchCanvas.getContext("2d"),0===this.viewport.getRotation()){var n=this;this.viewer.addHandler("rotate",function t(){if(0!==n.viewport.getRotation()){n.viewer.removeHandler("rotate",t);var e=n._calculateSketchCanvasSize();n.sketchCanvas.width=e.x,n.sketchCanvas.height=e.y}})}this._updateImageSmoothingEnabled(this.sketchContext)}e=this.sketchContext}return e},saveContext:function(t){this.useCanvas&&this._getContext(t).save()},restoreContext:function(t){this.useCanvas&&this._getContext(t).restore()},setClip:function(t,e){if(this.useCanvas){var i=this._getContext(e);i.beginPath(),i.rect(t.x,t.y,t.width,t.height),i.clip()}},drawRectangle:function(t,e,i){if(this.useCanvas){var n=this._getContext(i);n.save(),n.fillStyle=e,n.fillRect(t.x,t.y,t.width,t.height),n.restore()}},blendSketch:function(e,i,n,r){var o=e;if(t.isPlainObject(o)||(o={opacity:e,scale:i,translate:n,compositeOperation:r}),this.useCanvas&&this.sketchCanvas){e=o.opacity,r=o.compositeOperation;var a=o.bounds;if(this.context.save(),this.context.globalAlpha=e,r&&(this.context.globalCompositeOperation=r),a)a.x<0&&(a.width+=a.x,a.x=0),a.x+a.width>this.canvas.width&&(a.width=this.canvas.width-a.x),a.y<0&&(a.height+=a.y,a.y=0),a.y+a.height>this.canvas.height&&(a.height=this.canvas.height-a.y),this.context.drawImage(this.sketchCanvas,a.x,a.y,a.width,a.height,a.x,a.y,a.width,a.height);else{i=o.scale||1;var s=(n=o.translate)instanceof t.Point?n:new t.Point(0,0),l=0,h=0;if(n){var u=this.sketchCanvas.width-this.canvas.width,c=this.sketchCanvas.height-this.canvas.height;l=Math.round(u/2),h=Math.round(c/2)}this.context.drawImage(this.sketchCanvas,s.x-l*i,s.y-h*i,(this.canvas.width+2*l)*i,(this.canvas.height+2*h)*i,-l,-h,this.canvas.width+2*l,this.canvas.height+2*h)}this.context.restore()}},drawDebugInfo:function(e,i,n,r){if(this.useCanvas){var o=this.viewer.world.getIndexOfItem(r)%this.debugGridColor.length,a=this.context;a.save(),a.lineWidth=2*t.pixelDensityRatio,a.font="small-caps bold "+13*t.pixelDensityRatio+"px arial",a.strokeStyle=this.debugGridColor[o],a.fillStyle=this.debugGridColor[o],this.viewport.getRotation(!0)%360!=0&&this._offsetForRotation({degrees:this.viewport.getRotation(!0)}),r.getRotation(!0)%360!=0&&this._offsetForRotation({degrees:r.getRotation(!0),point:r.viewport.pixelFromPointNoRotate(r._getRotationPoint(!0),!0)}),r.viewport.getRotation(!0)%360==0&&r.getRotation(!0)%360==0&&r._drawer.viewer.viewport.getFlip()&&r._drawer._flip(),a.strokeRect(e.position.x*t.pixelDensityRatio,e.position.y*t.pixelDensityRatio,e.size.x*t.pixelDensityRatio,e.size.y*t.pixelDensityRatio);var s=(e.position.x+e.size.x/2)*t.pixelDensityRatio,l=(e.position.y+e.size.y/2)*t.pixelDensityRatio;a.translate(s,l),a.rotate(Math.PI/180*-this.viewport.getRotation(!0)),a.translate(-s,-l),0===e.x&&0===e.y&&(a.fillText("Zoom: "+this.viewport.getZoom(),e.position.x*t.pixelDensityRatio,(e.position.y-30)*t.pixelDensityRatio),a.fillText("Pan: "+this.viewport.getBounds().toString(),e.position.x*t.pixelDensityRatio,(e.position.y-20)*t.pixelDensityRatio)),a.fillText("Level: "+e.level,(e.position.x+10)*t.pixelDensityRatio,(e.position.y+20)*t.pixelDensityRatio),a.fillText("Column: "+e.x,(e.position.x+10)*t.pixelDensityRatio,(e.position.y+30)*t.pixelDensityRatio),a.fillText("Row: "+e.y,(e.position.x+10)*t.pixelDensityRatio,(e.position.y+40)*t.pixelDensityRatio),a.fillText("Order: "+n+" of "+i,(e.position.x+10)*t.pixelDensityRatio,(e.position.y+50)*t.pixelDensityRatio),a.fillText("Size: "+e.size.toString(),(e.position.x+10)*t.pixelDensityRatio,(e.position.y+60)*t.pixelDensityRatio),a.fillText("Position: "+e.position.toString(),(e.position.x+10)*t.pixelDensityRatio,(e.position.y+70)*t.pixelDensityRatio),this.viewport.getRotation(!0)%360!=0&&this._restoreRotationChanges(),r.getRotation(!0)%360!=0&&this._restoreRotationChanges(),r.viewport.getRotation(!0)%360==0&&r.getRotation(!0)%360==0&&r._drawer.viewer.viewport.getFlip()&&r._drawer._flip(),a.restore()}},debugRect:function(e){if(this.useCanvas){var i=this.context;i.save(),i.lineWidth=2*t.pixelDensityRatio,i.strokeStyle=this.debugGridColor[0],i.fillStyle=this.debugGridColor[0],i.strokeRect(e.x*t.pixelDensityRatio,e.y*t.pixelDensityRatio,e.width*t.pixelDensityRatio,e.height*t.pixelDensityRatio),i.restore()}},setImageSmoothingEnabled:function(t){this.useCanvas&&(this._imageSmoothingEnabled=t,this._updateImageSmoothingEnabled(this.context),this.viewer.forceRedraw())},_updateImageSmoothingEnabled:function(t){t.msImageSmoothingEnabled=this._imageSmoothingEnabled,t.imageSmoothingEnabled=this._imageSmoothingEnabled},getCanvasSize:function(e){var i=this._getContext(e).canvas;return new t.Point(i.width,i.height)},getCanvasCenter:function(){return new t.Point(this.canvas.width/2,this.canvas.height/2)},_offsetForRotation:function(e){var i=e.point?e.point.times(t.pixelDensityRatio):this.getCanvasCenter(),n=this._getContext(e.useSketch);n.save(),n.translate(i.x,i.y),this.viewer.viewport.flipped?(n.rotate(Math.PI/180*-e.degrees),n.scale(-1,1)):n.rotate(Math.PI/180*e.degrees),n.translate(-i.x,-i.y)},_flip:function(e){var i=(e=e||{}).point?e.point.times(t.pixelDensityRatio):this.getCanvasCenter(),n=this._getContext(e.useSketch);n.translate(i.x,0),n.scale(-1,1),n.translate(-i.x,0)},_restoreRotationChanges:function(t){this._getContext(t).restore()},_calculateCanvasSize:function(){var e=t.pixelDensityRatio,i=this.viewport.getContainerSize();return{x:Math.round(i.x*e),y:Math.round(i.y*e)}},_calculateSketchCanvasSize:function(){var t=this._calculateCanvasSize();if(0===this.viewport.getRotation())return t;var e=Math.ceil(Math.sqrt(t.x*t.x+t.y*t.y));return{x:e,y:e}}}}(s),function(t){t.Viewport=function(e){var i=arguments;i.length&&i[0]instanceof t.Point&&(e={containerSize:i[0],contentSize:i[1],config:i[2]}),e.config&&(t.extend(!0,e,e.config),delete e.config),this._margins=t.extend({left:0,top:0,right:0,bottom:0},e.margins||{}),delete e.margins,e.initialDegrees=e.degrees,delete e.degrees,t.extend(!0,this,{containerSize:null,contentSize:null,zoomPoint:null,rotationPivot:null,viewer:null,springStiffness:t.DEFAULT_SETTINGS.springStiffness,animationTime:t.DEFAULT_SETTINGS.animationTime,minZoomImageRatio:t.DEFAULT_SETTINGS.minZoomImageRatio,maxZoomPixelRatio:t.DEFAULT_SETTINGS.maxZoomPixelRatio,visibilityRatio:t.DEFAULT_SETTINGS.visibilityRatio,wrapHorizontal:t.DEFAULT_SETTINGS.wrapHorizontal,wrapVertical:t.DEFAULT_SETTINGS.wrapVertical,defaultZoomLevel:t.DEFAULT_SETTINGS.defaultZoomLevel,minZoomLevel:t.DEFAULT_SETTINGS.minZoomLevel,maxZoomLevel:t.DEFAULT_SETTINGS.maxZoomLevel,initialDegrees:t.DEFAULT_SETTINGS.degrees,flipped:t.DEFAULT_SETTINGS.flipped,homeFillsViewer:t.DEFAULT_SETTINGS.homeFillsViewer,silenceMultiImageWarnings:t.DEFAULT_SETTINGS.silenceMultiImageWarnings},e),this._updateContainerInnerSize(),this.centerSpringX=new t.Spring({initial:0,springStiffness:this.springStiffness,animationTime:this.animationTime}),this.centerSpringY=new t.Spring({initial:0,springStiffness:this.springStiffness,animationTime:this.animationTime}),this.zoomSpring=new t.Spring({exponential:!0,initial:1,springStiffness:this.springStiffness,animationTime:this.animationTime}),this.degreesSpring=new t.Spring({initial:e.initialDegrees,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._oldCenterX=this.centerSpringX.current.value,this._oldCenterY=this.centerSpringY.current.value,this._oldZoom=this.zoomSpring.current.value,this._oldDegrees=this.degreesSpring.current.value,this._setContentBounds(new t.Rect(0,0,1,1),1),this.goHome(!0),this.update()},t.Viewport.prototype={get degrees(){return t.console.warn("Accessing [Viewport.degrees] is deprecated. Use viewport.getRotation instead."),this.getRotation()},set degrees(e){t.console.warn("Setting [Viewport.degrees] is deprecated. Use viewport.rotateTo, viewport.rotateBy, or viewport.setRotation instead."),this.rotateTo(e)},resetContentSize:function(e){return t.console.assert(e,"[Viewport.resetContentSize] contentSize is required"),t.console.assert(e instanceof t.Point,"[Viewport.resetContentSize] contentSize must be an OpenSeadragon.Point"),t.console.assert(e.x>0,"[Viewport.resetContentSize] contentSize.x must be greater than 0"),t.console.assert(e.y>0,"[Viewport.resetContentSize] contentSize.y must be greater than 0"),this._setContentBounds(new t.Rect(0,0,1,e.y/e.x),e.x),this},setHomeBounds:function(e,i){t.console.error("[Viewport.setHomeBounds] this function is deprecated; The content bounds should not be set manually."),this._setContentBounds(e,i)},_setContentBounds:function(e,i){t.console.assert(e,"[Viewport._setContentBounds] bounds is required"),t.console.assert(e instanceof t.Rect,"[Viewport._setContentBounds] bounds must be an OpenSeadragon.Rect"),t.console.assert(e.width>0,"[Viewport._setContentBounds] bounds.width must be greater than 0"),t.console.assert(e.height>0,"[Viewport._setContentBounds] bounds.height must be greater than 0"),this._contentBoundsNoRotate=e.clone(),this._contentSizeNoRotate=this._contentBoundsNoRotate.getSize().times(i),this._contentBounds=e.rotate(this.getRotation()).getBoundingBox(),this._contentSize=this._contentBounds.getSize().times(i),this._contentAspectRatio=this._contentSize.x/this._contentSize.y,this.viewer&&this.viewer.raiseEvent("reset-size",{contentSize:this._contentSizeNoRotate.clone(),contentFactor:i,homeBounds:this._contentBoundsNoRotate.clone(),contentBounds:this._contentBounds.clone()})},getHomeZoom:function(){if(this.defaultZoomLevel)return this.defaultZoomLevel;var t=this._contentAspectRatio/this.getAspectRatio();return(this.homeFillsViewer?t>=1?t:1:t>=1?1:t)/this._contentBounds.width},getHomeBounds:function(){return this.getHomeBoundsNoRotate().rotate(-this.getRotation())},getHomeBoundsNoRotate:function(){var e=this._contentBounds.getCenter(),i=1/this.getHomeZoom(),n=i/this.getAspectRatio();return new t.Rect(e.x-i/2,e.y-n/2,i,n)},goHome:function(t){return this.viewer&&this.viewer.raiseEvent("home",{immediately:t}),this.fitBounds(this.getHomeBounds(),t)},getMinZoom:function(){var t=this.getHomeZoom();return this.minZoomLevel?this.minZoomLevel:this.minZoomImageRatio*t},getMaxZoom:function(){var t=this.maxZoomLevel;return t||(t=this._contentSize.x*this.maxZoomPixelRatio/this._containerInnerSize.x,t/=this._contentBounds.width),Math.max(t,this.getHomeZoom())},getAspectRatio:function(){return this._containerInnerSize.x/this._containerInnerSize.y},getContainerSize:function(){return new t.Point(this.containerSize.x,this.containerSize.y)},getMargins:function(){return t.extend({},this._margins)},setMargins:function(e){t.console.assert("object"===t.type(e),"[Viewport.setMargins] margins must be an object"),this._margins=t.extend({left:0,top:0,right:0,bottom:0},e),this._updateContainerInnerSize(),this.viewer&&this.viewer.forceRedraw()},getBounds:function(t){return this.getBoundsNoRotate(t).rotate(-this.getRotation(t))},getBoundsNoRotate:function(e){var i=this.getCenter(e),n=1/this.getZoom(e),r=n/this.getAspectRatio();return new t.Rect(i.x-n/2,i.y-r/2,n,r)},getBoundsWithMargins:function(t){return this.getBoundsNoRotateWithMargins(t).rotate(-this.getRotation(t),this.getCenter(t))},getBoundsNoRotateWithMargins:function(t){var e=this.getBoundsNoRotate(t),i=this._containerInnerSize.x*this.getZoom(t);return e.x-=this._margins.left/i,e.y-=this._margins.top/i,e.width+=(this._margins.left+this._margins.right)/i,e.height+=(this._margins.top+this._margins.bottom)/i,e},getCenter:function(e){var i,n,r,o,a,s,l=new t.Point(this.centerSpringX.current.value,this.centerSpringY.current.value),h=new t.Point(this.centerSpringX.target.value,this.centerSpringY.target.value);return e?l:this.zoomPoint?(i=this.pixelFromPoint(this.zoomPoint,!0),o=(r=1/(n=this.getZoom()))/this.getAspectRatio(),a=new t.Rect(l.x-r/2,l.y-o/2,r,o),s=this._pixelFromPoint(this.zoomPoint,a).minus(i).rotate(-this.getRotation(!0)).divide(this._containerInnerSize.x*n),h.plus(s)):h},getZoom:function(t){return t?this.zoomSpring.current.value:this.zoomSpring.target.value},_applyZoomConstraints:function(t){return Math.max(Math.min(t,this.getMaxZoom()),this.getMinZoom())},_applyBoundaryConstraints:function(t){var e=this.viewportToViewerElementRectangle(t).getBoundingBox(),i=this.viewportToViewerElementRectangle(this._contentBoundsNoRotate).getBoundingBox(),n=!1,r=!1;if(this.wrapHorizontal);else{var o,a,s,l=e.x+e.width,h=i.x+i.width;o=e.width>i.width?this.visibilityRatio*i.width:this.visibilityRatio*e.width,a=i.x-l+o,s=h-e.x-o,o>i.width?(e.x+=(a+s)/2,n=!0):s<0?(e.x+=s,n=!0):a>0&&(e.x+=a,n=!0)}if(this.wrapVertical);else{var u,c,p,f=e.y+e.height,d=i.y+i.height;u=e.height>i.height?this.visibilityRatio*i.height:this.visibilityRatio*e.height,c=i.y-f+u,p=d-e.y-u,u>i.height?(e.y+=(c+p)/2,r=!0):p<0?(e.y+=p,r=!0):c>0&&(e.y+=c,r=!0)}var v=n||r,g=v?this.viewerElementToViewportRectangle(e):t.clone();return g.xConstrained=n,g.yConstrained=r,g.constraintApplied=v,g},_raiseConstraintsEvent:function(t){this.viewer&&this.viewer.raiseEvent("constrain",{immediately:t})},applyConstraints:function(t){var e=this.getZoom(),i=this._applyZoomConstraints(e);e!==i&&this.zoomTo(i,this.zoomPoint,t);var n=this.getConstrainedBounds(!1);return n.constraintApplied&&(this.fitBounds(n,t),this._raiseConstraintsEvent(t)),this},ensureVisible:function(t){return this.applyConstraints(t)},_fitBounds:function(e,i){var n=(i=i||{}).immediately||!1,r=i.constraints||!1,o=this.getAspectRatio(),a=e.getCenter(),s=new t.Rect(e.x,e.y,e.width,e.height,e.degrees+this.getRotation()).getBoundingBox();s.getAspectRatio()>=o?s.height=s.width/o:s.width=s.height*o,s.x=a.x-s.width/2,s.y=a.y-s.height/2;var l=1/s.width;if(n)return this.panTo(a,!0),this.zoomTo(l,null,!0),r&&this.applyConstraints(!0),this;var h=this.getCenter(!0),u=this.getZoom(!0);this.panTo(h,!0),this.zoomTo(u,null,!0);var c=this.getBounds(),p=this.getZoom();if(0===p||Math.abs(l/p-1)<1e-8)return this.zoomTo(l,null,!0),this.panTo(a,n),r&&this.applyConstraints(!1),this;if(r){this.panTo(a,!1),l=this._applyZoomConstraints(l),this.zoomTo(l,null,!1);var f=this.getConstrainedBounds();this.panTo(h,!0),this.zoomTo(u,null,!0),this.fitBounds(f)}else{var d=s.rotate(-this.getRotation()).getTopLeft().times(l).minus(c.getTopLeft().times(p)).divide(l-p);this.zoomTo(l,d,n)}return this},fitBounds:function(t,e){return this._fitBounds(t,{immediately:e,constraints:!1})},fitBoundsWithConstraints:function(t,e){return this._fitBounds(t,{immediately:e,constraints:!0})},fitVertically:function(e){var i=new t.Rect(this._contentBounds.x+this._contentBounds.width/2,this._contentBounds.y,0,this._contentBounds.height);return this.fitBounds(i,e)},fitHorizontally:function(e){var i=new t.Rect(this._contentBounds.x,this._contentBounds.y+this._contentBounds.height/2,this._contentBounds.width,0);return this.fitBounds(i,e)},getConstrainedBounds:function(t){var e;return e=this.getBounds(t),this._applyBoundaryConstraints(e)},panBy:function(e,i){var n=new t.Point(this.centerSpringX.target.value,this.centerSpringY.target.value);return this.panTo(n.plus(e),i)},panTo:function(t,e){return e?(this.centerSpringX.resetTo(t.x),this.centerSpringY.resetTo(t.y)):(this.centerSpringX.springTo(t.x),this.centerSpringY.springTo(t.y)),this.viewer&&this.viewer.raiseEvent("pan",{center:t,immediately:e}),this},zoomBy:function(t,e,i){return this.zoomTo(this.zoomSpring.target.value*t,e,i)},zoomTo:function(e,i,n){var r=this;return this.zoomPoint=i instanceof t.Point&&!isNaN(i.x)&&!isNaN(i.y)?i:null,n?this._adjustCenterSpringsForZoomPoint(function(){r.zoomSpring.resetTo(e)}):this.zoomSpring.springTo(e),this.viewer&&this.viewer.raiseEvent("zoom",{zoom:e,refPoint:i,immediately:n}),this},setRotation:function(t,e){return this.rotateTo(t,null,e)},getRotation:function(t){return t?this.degreesSpring.current.value:this.degreesSpring.target.value},setRotationWithPivot:function(t,e,i){return this.rotateTo(t,e,i)},rotateTo:function(e,i,n){if(!this.viewer||!this.viewer.drawer.canRotate())return this;if(this.degreesSpring.target.value===e&&this.degreesSpring.isAtTargetValue())return this;if(this.rotationPivot=i instanceof t.Point&&!isNaN(i.x)&&!isNaN(i.y)?i:null,n)if(this.rotationPivot){if(!(e-this._oldDegrees))return this.rotationPivot=null,this;this._rotateAboutPivot(e)}else this.degreesSpring.resetTo(e);else{var r=t.positiveModulo(this.degreesSpring.current.value,360),o=t.positiveModulo(e,360),a=o-r;a>180?o-=360:a<-180&&(o+=360);var s=r-o;this.degreesSpring.resetTo(e+s),this.degreesSpring.springTo(e)}return this._setContentBounds(this.viewer.world.getHomeBounds(),this.viewer.world.getContentFactor()),this.viewer.forceRedraw(),this.viewer.raiseEvent("rotate",{degrees:e,immediately:!!n,pivot:this.rotationPivot||this.getCenter()}),this},rotateBy:function(t,e,i){return this.rotateTo(this.degreesSpring.target.value+t,e,i)},resize:function(t,e){var i,n=this.getBoundsNoRotate(),r=n;this.containerSize.x=t.x,this.containerSize.y=t.y,this._updateContainerInnerSize(),e&&(i=t.x/this.containerSize.x,r.width=n.width*i,r.height=r.width/this.getAspectRatio()),this.viewer&&this.viewer.raiseEvent("resize",{newContainerSize:t,maintain:e});var o=this.fitBounds(r,!0);return this.viewer&&this.viewer.raiseEvent("after-resize",{newContainerSize:t,maintain:e}),o},_updateContainerInnerSize:function(){this._containerInnerSize=new t.Point(Math.max(1,this.containerSize.x-(this._margins.left+this._margins.right)),Math.max(1,this.containerSize.y-(this._margins.top+this._margins.bottom)))},update:function(){var t=this;this._adjustCenterSpringsForZoomPoint(function(){t.zoomSpring.update()}),this.degreesSpring.isAtTargetValue()&&(this.rotationPivot=null),this.centerSpringX.update(),this.centerSpringY.update(),this.rotationPivot?this._rotateAboutPivot(!0):this.degreesSpring.update();var e=this.centerSpringX.current.value!==this._oldCenterX||this.centerSpringY.current.value!==this._oldCenterY||this.zoomSpring.current.value!==this._oldZoom||this.degreesSpring.current.value!==this._oldDegrees;return this._oldCenterX=this.centerSpringX.current.value,this._oldCenterY=this.centerSpringY.current.value,this._oldZoom=this.zoomSpring.current.value,this._oldDegrees=this.degreesSpring.current.value,e},_rotateAboutPivot:function(t){var e=!0===t,i=this.rotationPivot.minus(this.getCenter());this.centerSpringX.shiftBy(i.x),this.centerSpringY.shiftBy(i.y),e?this.degreesSpring.update():this.degreesSpring.resetTo(t);var n=this.degreesSpring.current.value-this._oldDegrees,r=i.rotate(-1*n).times(-1);this.centerSpringX.shiftBy(r.x),this.centerSpringY.shiftBy(r.y)},_adjustCenterSpringsForZoomPoint:function(t){if(this.zoomPoint){var e=this.pixelFromPoint(this.zoomPoint,!0);t();var i=this.pixelFromPoint(this.zoomPoint,!0).minus(e),n=this.deltaPointsFromPixels(i,!0);this.centerSpringX.shiftBy(n.x),this.centerSpringY.shiftBy(n.y),this.zoomSpring.isAtTargetValue()&&(this.zoomPoint=null)}else t()},deltaPixelsFromPointsNoRotate:function(t,e){return t.times(this._containerInnerSize.x*this.getZoom(e))},deltaPixelsFromPoints:function(t,e){return this.deltaPixelsFromPointsNoRotate(t.rotate(this.getRotation(e)),e)},deltaPointsFromPixelsNoRotate:function(t,e){return t.divide(this._containerInnerSize.x*this.getZoom(e))},deltaPointsFromPixels:function(t,e){return this.deltaPointsFromPixelsNoRotate(t,e).rotate(-this.getRotation(e))},pixelFromPointNoRotate:function(t,e){return this._pixelFromPointNoRotate(t,this.getBoundsNoRotate(e))},pixelFromPoint:function(t,e){return this._pixelFromPoint(t,this.getBoundsNoRotate(e))},_pixelFromPointNoRotate:function(e,i){return e.minus(i.getTopLeft()).times(this._containerInnerSize.x/i.width).plus(new t.Point(this._margins.left,this._margins.top))},_pixelFromPoint:function(t,e){return this._pixelFromPointNoRotate(t.rotate(this.getRotation(!0),this.getCenter(!0)),e)},pointFromPixelNoRotate:function(e,i){var n=this.getBoundsNoRotate(i);return e.minus(new t.Point(this._margins.left,this._margins.top)).divide(this._containerInnerSize.x/n.width).plus(n.getTopLeft())},pointFromPixel:function(t,e){return this.pointFromPixelNoRotate(t,e).rotate(-this.getRotation(e),this.getCenter(e))},_viewportToImageDelta:function(e,i){var n=this._contentBoundsNoRotate.width;return new t.Point(e*this._contentSizeNoRotate.x/n,i*this._contentSizeNoRotate.x/n)},viewportToImageCoordinates:function(e,i){if(e instanceof t.Point)return this.viewportToImageCoordinates(e.x,e.y);if(this.viewer){var n=this.viewer.world.getItemCount();if(n>1)this.silenceMultiImageWarnings||t.console.error("[Viewport.viewportToImageCoordinates] is not accurate with multi-image; use TiledImage.viewportToImageCoordinates instead.");else if(1===n){return this.viewer.world.getItemAt(0).viewportToImageCoordinates(e,i,!0)}}return this._viewportToImageDelta(e-this._contentBoundsNoRotate.x,i-this._contentBoundsNoRotate.y)},_imageToViewportDelta:function(e,i){var n=this._contentBoundsNoRotate.width;return new t.Point(e/this._contentSizeNoRotate.x*n,i/this._contentSizeNoRotate.x*n)},imageToViewportCoordinates:function(e,i){if(e instanceof t.Point)return this.imageToViewportCoordinates(e.x,e.y);if(this.viewer){var n=this.viewer.world.getItemCount();if(n>1)this.silenceMultiImageWarnings||t.console.error("[Viewport.imageToViewportCoordinates] is not accurate with multi-image; use TiledImage.imageToViewportCoordinates instead.");else if(1===n){return this.viewer.world.getItemAt(0).imageToViewportCoordinates(e,i,!0)}}var r=this._imageToViewportDelta(e,i);return r.x+=this._contentBoundsNoRotate.x,r.y+=this._contentBoundsNoRotate.y,r},imageToViewportRectangle:function(e,i,n,r){var o=e;if(o instanceof t.Rect||(o=new t.Rect(e,i,n,r)),this.viewer){var a=this.viewer.world.getItemCount();if(a>1)this.silenceMultiImageWarnings||t.console.error("[Viewport.imageToViewportRectangle] is not accurate with multi-image; use TiledImage.imageToViewportRectangle instead.");else if(1===a){return this.viewer.world.getItemAt(0).imageToViewportRectangle(e,i,n,r,!0)}}var s=this.imageToViewportCoordinates(o.x,o.y),l=this._imageToViewportDelta(o.width,o.height);return new t.Rect(s.x,s.y,l.x,l.y,o.degrees)},viewportToImageRectangle:function(e,i,n,r){var o=e;if(o instanceof t.Rect||(o=new t.Rect(e,i,n,r)),this.viewer){var a=this.viewer.world.getItemCount();if(a>1)this.silenceMultiImageWarnings||t.console.error("[Viewport.viewportToImageRectangle] is not accurate with multi-image; use TiledImage.viewportToImageRectangle instead.");else if(1===a){return this.viewer.world.getItemAt(0).viewportToImageRectangle(e,i,n,r,!0)}}var s=this.viewportToImageCoordinates(o.x,o.y),l=this._viewportToImageDelta(o.width,o.height);return new t.Rect(s.x,s.y,l.x,l.y,o.degrees)},viewerElementToImageCoordinates:function(t){var e=this.pointFromPixel(t,!0);return this.viewportToImageCoordinates(e)},imageToViewerElementCoordinates:function(t){var e=this.imageToViewportCoordinates(t);return this.pixelFromPoint(e,!0)},windowToImageCoordinates:function(e){t.console.assert(this.viewer,"[Viewport.windowToImageCoordinates] the viewport must have a viewer.");var i=e.minus(t.getElementPosition(this.viewer.element));return this.viewerElementToImageCoordinates(i)},imageToWindowCoordinates:function(e){return t.console.assert(this.viewer,"[Viewport.imageToWindowCoordinates] the viewport must have a viewer."),this.imageToViewerElementCoordinates(e).plus(t.getElementPosition(this.viewer.element))},viewerElementToViewportCoordinates:function(t){return this.pointFromPixel(t,!0)},viewportToViewerElementCoordinates:function(t){return this.pixelFromPoint(t,!0)},viewerElementToViewportRectangle:function(e){return t.Rect.fromSummits(this.pointFromPixel(e.getTopLeft(),!0),this.pointFromPixel(e.getTopRight(),!0),this.pointFromPixel(e.getBottomLeft(),!0))},viewportToViewerElementRectangle:function(e){return t.Rect.fromSummits(this.pixelFromPoint(e.getTopLeft(),!0),this.pixelFromPoint(e.getTopRight(),!0),this.pixelFromPoint(e.getBottomLeft(),!0))},windowToViewportCoordinates:function(e){t.console.assert(this.viewer,"[Viewport.windowToViewportCoordinates] the viewport must have a viewer.");var i=e.minus(t.getElementPosition(this.viewer.element));return this.viewerElementToViewportCoordinates(i)},viewportToWindowCoordinates:function(e){return t.console.assert(this.viewer,"[Viewport.viewportToWindowCoordinates] the viewport must have a viewer."),this.viewportToViewerElementCoordinates(e).plus(t.getElementPosition(this.viewer.element))},viewportToImageZoom:function(e){if(this.viewer){var i=this.viewer.world.getItemCount();if(i>1)this.silenceMultiImageWarnings||t.console.error("[Viewport.viewportToImageZoom] is not accurate with multi-image.");else if(1===i){return this.viewer.world.getItemAt(0).viewportToImageZoom(e)}}var n=this._contentSizeNoRotate.x;return e*(this._containerInnerSize.x/n*this._contentBoundsNoRotate.width)},imageToViewportZoom:function(e){if(this.viewer){var i=this.viewer.world.getItemCount();if(i>1)this.silenceMultiImageWarnings||t.console.error("[Viewport.imageToViewportZoom] is not accurate with multi-image.");else if(1===i){return this.viewer.world.getItemAt(0).imageToViewportZoom(e)}}return e*(this._contentSizeNoRotate.x/this._containerInnerSize.x/this._contentBoundsNoRotate.width)},toggleFlip:function(){return this.setFlip(!this.getFlip()),this},getFlip:function(){return this.flipped},setFlip:function(t){return this.flipped===t||(this.flipped=t,this.viewer.navigator&&this.viewer.navigator.setFlip(this.getFlip()),this.viewer.forceRedraw(),this.viewer.raiseEvent("flip",{flipped:t})),this}}}(s),function(t){t.TiledImage=function(e){var i=this;t.console.assert(e.tileCache,"[TiledImage] options.tileCache is required"),t.console.assert(e.drawer,"[TiledImage] options.drawer is required"),t.console.assert(e.viewer,"[TiledImage] options.viewer is required"),t.console.assert(e.imageLoader,"[TiledImage] options.imageLoader is required"),t.console.assert(e.source,"[TiledImage] options.source is required"),t.console.assert(!e.clip||e.clip instanceof t.Rect,"[TiledImage] options.clip must be an OpenSeadragon.Rect if present"),t.EventSource.call(this),this._tileCache=e.tileCache,delete e.tileCache,this._drawer=e.drawer,delete e.drawer,this._imageLoader=e.imageLoader,delete e.imageLoader,e.clip instanceof t.Rect&&(this._clip=e.clip.clone()),delete e.clip;var n=e.x||0;delete e.x;var r=e.y||0;delete e.y,this.normHeight=e.source.dimensions.y/e.source.dimensions.x,this.contentAspectX=e.source.dimensions.x/e.source.dimensions.y;var o=1;e.width?(o=e.width,delete e.width,e.height&&(t.console.error("specifying both width and height to a tiledImage is not supported"),delete e.height)):e.height&&(o=e.height/this.normHeight,delete e.height);var a=e.fitBounds;delete e.fitBounds;var l=e.fitBoundsPlacement||s.Placement.CENTER;delete e.fitBoundsPlacement;var h=e.degrees||0;delete e.degrees;var u=e.ajaxHeaders;delete e.ajaxHeaders,t.extend(!0,this,{viewer:null,tilesMatrix:{},coverage:{},loadingCoverage:{},lastDrawn:[],lastResetTime:0,_midDraw:!1,_needsDraw:!0,_hasOpaqueTile:!1,_tilesLoading:0,springStiffness:t.DEFAULT_SETTINGS.springStiffness,animationTime:t.DEFAULT_SETTINGS.animationTime,minZoomImageRatio:t.DEFAULT_SETTINGS.minZoomImageRatio,wrapHorizontal:t.DEFAULT_SETTINGS.wrapHorizontal,wrapVertical:t.DEFAULT_SETTINGS.wrapVertical,immediateRender:t.DEFAULT_SETTINGS.immediateRender,blendTime:t.DEFAULT_SETTINGS.blendTime,alwaysBlend:t.DEFAULT_SETTINGS.alwaysBlend,minPixelRatio:t.DEFAULT_SETTINGS.minPixelRatio,smoothTileEdgesMinZoom:t.DEFAULT_SETTINGS.smoothTileEdgesMinZoom,iOSDevice:t.DEFAULT_SETTINGS.iOSDevice,debugMode:t.DEFAULT_SETTINGS.debugMode,crossOriginPolicy:t.DEFAULT_SETTINGS.crossOriginPolicy,ajaxWithCredentials:t.DEFAULT_SETTINGS.ajaxWithCredentials,placeholderFillStyle:t.DEFAULT_SETTINGS.placeholderFillStyle,opacity:t.DEFAULT_SETTINGS.opacity,preload:t.DEFAULT_SETTINGS.preload,compositeOperation:t.DEFAULT_SETTINGS.compositeOperation,subPixelRoundingForTransparency:t.DEFAULT_SETTINGS.subPixelRoundingForTransparency},e),this._preload=this.preload,delete this.preload,this._fullyLoaded=!1,this._xSpring=new t.Spring({initial:n,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._ySpring=new t.Spring({initial:r,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._scaleSpring=new t.Spring({initial:o,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._degreesSpring=new t.Spring({initial:h,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._updateForScale(),a&&this.fitBounds(a,l,!0),this._drawingHandler=function(e){i.viewer.raiseEvent("tile-drawing",t.extend({tiledImage:i},e))},this._ownAjaxHeaders={},this.setAjaxHeaders(u,!1)},t.extend(t.TiledImage.prototype,t.EventSource.prototype,{needsDraw:function(){return this._needsDraw},getFullyLoaded:function(){return this._fullyLoaded},_setFullyLoaded:function(t){t!==this._fullyLoaded&&(this._fullyLoaded=t,this.raiseEvent("fully-loaded-change",{fullyLoaded:this._fullyLoaded}))},reset:function(){this._tileCache.clearTilesFor(this),this.lastResetTime=t.now(),this._needsDraw=!0},update:function(){var t=this._xSpring.update(),e=this._ySpring.update(),i=this._scaleSpring.update(),n=this._degreesSpring.update();return!!(t||e||i||n)&&(this._updateForScale(),this._needsDraw=!0,!0)},draw:function(){0!==this.opacity||this._preload?(this._midDraw=!0,this._updateViewport(),this._midDraw=!1):this._needsDraw=!1},destroy:function(){this.reset(),this.source.destroy&&this.source.destroy()},getBounds:function(t){return this.getBoundsNoRotate(t).rotate(this.getRotation(t),this._getRotationPoint(t))},getBoundsNoRotate:function(e){return e?new t.Rect(this._xSpring.current.value,this._ySpring.current.value,this._worldWidthCurrent,this._worldHeightCurrent):new t.Rect(this._xSpring.target.value,this._ySpring.target.value,this._worldWidthTarget,this._worldHeightTarget)},getWorldBounds:function(){return t.console.error("[TiledImage.getWorldBounds] is deprecated; use TiledImage.getBounds instead"),this.getBounds()},getClippedBounds:function(e){var i=this.getBoundsNoRotate(e);if(this._clip){var n=(e?this._worldWidthCurrent:this._worldWidthTarget)/this.source.dimensions.x,r=this._clip.times(n);i=new t.Rect(i.x+r.x,i.y+r.y,r.width,r.height)}return i.rotate(this.getRotation(e),this._getRotationPoint(e))},getTileBounds:function(t,e,i){var n=this.source.getNumTiles(t),r=(n.x+e%n.x)%n.x,o=(n.y+i%n.y)%n.y,a=this.source.getTileBounds(t,r,o);return this.getFlip()&&(a.x=1-a.x-a.width),a.x+=(e-r)/n.x,a.y+=this._worldHeightCurrent/this._worldWidthCurrent*((i-o)/n.y),a},getContentSize:function(){return new t.Point(this.source.dimensions.x,this.source.dimensions.y)},getSizeInWindowCoordinates:function(){var e=this.imageToWindowCoordinates(new t.Point(0,0)),i=this.imageToWindowCoordinates(this.getContentSize());return new t.Point(i.x-e.x,i.y-e.y)},_viewportToImageDelta:function(e,i,n){var r=n?this._scaleSpring.current.value:this._scaleSpring.target.value;return new t.Point(e*(this.source.dimensions.x/r),i*(this.source.dimensions.y*this.contentAspectX/r))},viewportToImageCoordinates:function(e,i,n){var r;return e instanceof t.Point?(n=i,r=e):r=new t.Point(e,i),r=r.rotate(-this.getRotation(n),this._getRotationPoint(n)),n?this._viewportToImageDelta(r.x-this._xSpring.current.value,r.y-this._ySpring.current.value):this._viewportToImageDelta(r.x-this._xSpring.target.value,r.y-this._ySpring.target.value)},_imageToViewportDelta:function(e,i,n){var r=n?this._scaleSpring.current.value:this._scaleSpring.target.value;return new t.Point(e/this.source.dimensions.x*r,i/this.source.dimensions.y/this.contentAspectX*r)},imageToViewportCoordinates:function(e,i,n){e instanceof t.Point&&(n=i,i=e.y,e=e.x);var r=this._imageToViewportDelta(e,i);return n?(r.x+=this._xSpring.current.value,r.y+=this._ySpring.current.value):(r.x+=this._xSpring.target.value,r.y+=this._ySpring.target.value),r.rotate(this.getRotation(n),this._getRotationPoint(n))},imageToViewportRectangle:function(e,i,n,r,o){var a=e;a instanceof t.Rect?o=i:a=new t.Rect(e,i,n,r);var s=this.imageToViewportCoordinates(a.getTopLeft(),o),l=this._imageToViewportDelta(a.width,a.height,o);return new t.Rect(s.x,s.y,l.x,l.y,a.degrees+this.getRotation(o))},viewportToImageRectangle:function(e,i,n,r,o){var a=e;e instanceof t.Rect?o=i:a=new t.Rect(e,i,n,r);var s=this.viewportToImageCoordinates(a.getTopLeft(),o),l=this._viewportToImageDelta(a.width,a.height,o);return new t.Rect(s.x,s.y,l.x,l.y,a.degrees-this.getRotation(o))},viewerElementToImageCoordinates:function(t){var e=this.viewport.pointFromPixel(t,!0);return this.viewportToImageCoordinates(e)},imageToViewerElementCoordinates:function(t){var e=this.imageToViewportCoordinates(t);return this.viewport.pixelFromPoint(e,!0)},windowToImageCoordinates:function(t){var e=t.minus(s.getElementPosition(this.viewer.element));return this.viewerElementToImageCoordinates(e)},imageToWindowCoordinates:function(t){return this.imageToViewerElementCoordinates(t).plus(s.getElementPosition(this.viewer.element))},_viewportToTiledImageRectangle:function(e){var i=this._scaleSpring.current.value;return e=e.rotate(-this.getRotation(!0),this._getRotationPoint(!0)),new t.Rect((e.x-this._xSpring.current.value)/i,(e.y-this._ySpring.current.value)/i,e.width/i,e.height/i,e.degrees)},viewportToImageZoom:function(t){return this._scaleSpring.current.value*this.viewport._containerInnerSize.x/this.source.dimensions.x*t},imageToViewportZoom:function(t){return t/(this._scaleSpring.current.value*this.viewport._containerInnerSize.x/this.source.dimensions.x)},setPosition:function(t,e){var i=this._xSpring.target.value===t.x&&this._ySpring.target.value===t.y;if(e){if(i&&this._xSpring.current.value===t.x&&this._ySpring.current.value===t.y)return;this._xSpring.resetTo(t.x),this._ySpring.resetTo(t.y),this._needsDraw=!0}else{if(i)return;this._xSpring.springTo(t.x),this._ySpring.springTo(t.y),this._needsDraw=!0}i||this._raiseBoundsChange()},setWidth:function(t,e){this._setScale(t,e)},setHeight:function(t,e){this._setScale(t/this.normHeight,e)},setCroppingPolygons:function(e){var i=function(e){return e.map(function(e){try{if(function(e){return e instanceof t.Point||"number"==typeof e.x&&"number"==typeof e.y}(e))return{x:e.x,y:e.y};throw new Error}catch(i){throw new Error("A Provided cropping polygon point is not supported")}})};try{if(!t.isArray(e))throw new Error("Provided cropping polygon is not an array");this._croppingPolygons=e.map(function(t){return i(t)})}catch(n){t.console.error("[TiledImage.setCroppingPolygons] Cropping polygon format not supported"),t.console.error(n),this._croppingPolygons=null}},resetCroppingPolygons:function(){this._croppingPolygons=null},fitBounds:function(e,i,n){i=i||t.Placement.CENTER;var r=t.Placement.properties[i],o=this.contentAspectX,a=0,s=0,l=1,h=1;if(this._clip&&(o=this._clip.getAspectRatio(),l=this._clip.width/this.source.dimensions.x,h=this._clip.height/this.source.dimensions.y,e.getAspectRatio()>o?(a=this._clip.x/this._clip.height*e.height,s=this._clip.y/this._clip.height*e.height):(a=this._clip.x/this._clip.width*e.width,s=this._clip.y/this._clip.width*e.width)),e.getAspectRatio()>o){var u=e.height/h,c=0;r.isHorizontallyCentered?c=(e.width-e.height*o)/2:r.isRight&&(c=e.width-e.height*o),this.setPosition(new t.Point(e.x-a+c,e.y-s),n),this.setHeight(u,n)}else{var p=e.width/l,f=0;r.isVerticallyCentered?f=(e.height-e.width/o)/2:r.isBottom&&(f=e.height-e.width/o),this.setPosition(new t.Point(e.x-a,e.y-s+f),n),this.setWidth(p,n)}},getClip:function(){return this._clip?this._clip.clone():null},setClip:function(e){t.console.assert(!e||e instanceof t.Rect,"[TiledImage.setClip] newClip must be an OpenSeadragon.Rect or null"),e instanceof t.Rect?this._clip=e.clone():this._clip=null,this._needsDraw=!0,this.raiseEvent("clip-change")},getFlip:function(){return!!this.flipped},setFlip:function(t){this.flipped=!!t,this._needsDraw=!0,this._raiseBoundsChange()},getOpacity:function(){return this.opacity},setOpacity:function(t){t!==this.opacity&&(this.opacity=t,this._needsDraw=!0,this.raiseEvent("opacity-change",{opacity:this.opacity}))},getPreload:function(){return this._preload},setPreload:function(t){this._preload=!!t,this._needsDraw=!0},getRotation:function(t){return t?this._degreesSpring.current.value:this._degreesSpring.target.value},setRotation:function(t,e){this._degreesSpring.target.value===t&&this._degreesSpring.isAtTargetValue()||(e?this._degreesSpring.resetTo(t):this._degreesSpring.springTo(t),this._needsDraw=!0,this._raiseBoundsChange())},_getRotationPoint:function(t){return this.getBoundsNoRotate(t).getCenter()},getCompositeOperation:function(){return this.compositeOperation},setCompositeOperation:function(t){t!==this.compositeOperation&&(this.compositeOperation=t,this._needsDraw=!0,this.raiseEvent("composite-operation-change",{compositeOperation:this.compositeOperation}))},setAjaxHeaders:function(e,i){null===e&&(e={}),t.isPlainObject(e)&&(this._ownAjaxHeaders=e,this._updateAjaxHeaders(i))},_updateAjaxHeaders:function(e){if(void 0===e&&(e=!0),t.isPlainObject(this.viewer.ajaxHeaders)?this.ajaxHeaders=t.extend({},this.viewer.ajaxHeaders,this._ownAjaxHeaders):this.ajaxHeaders=this._ownAjaxHeaders,e){var i,n,r,o;for(var a in this.tilesMatrix)for(var s in i=this.source.getNumTiles(a),this.tilesMatrix[a])for(var l in n=(i.x+s%i.x)%i.x,this.tilesMatrix[a][s])if(r=(i.y+l%i.y)%i.y,(o=this.tilesMatrix[a][s][l]).loadWithAjax=this.loadTilesWithAjax,o.loadWithAjax){var h=this.source.getTileAjaxHeaders(a,n,r);o.ajaxHeaders=t.extend({},this.ajaxHeaders,h)}else o.ajaxHeaders=null;for(var u=0;u<this._imageLoader.jobQueue.length;u++){var c=this._imageLoader.jobQueue[u];c.loadWithAjax=c.tile.loadWithAjax,c.ajaxHeaders=c.tile.loadWithAjax?c.tile.ajaxHeaders:null}}},_setScale:function(t,e){var i=this._scaleSpring.target.value===t;if(e){if(i&&this._scaleSpring.current.value===t)return;this._scaleSpring.resetTo(t),this._updateForScale(),this._needsDraw=!0}else{if(i)return;this._scaleSpring.springTo(t),this._updateForScale(),this._needsDraw=!0}i||this._raiseBoundsChange()},_updateForScale:function(){this._worldWidthTarget=this._scaleSpring.target.value,this._worldHeightTarget=this.normHeight*this._scaleSpring.target.value,this._worldWidthCurrent=this._scaleSpring.current.value,this._worldHeightCurrent=this.normHeight*this._scaleSpring.current.value},_raiseBoundsChange:function(){this.raiseEvent("bounds-change")},_isBottomItem:function(){return this.viewer.world.getItemAt(0)===this},_getLevelsInterval:function(){var t=Math.max(this.source.minLevel,Math.floor(Math.log(this.minZoomImageRatio)/Math.log(2))),e=this.viewport.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(0),!0).x*this._scaleSpring.current.value,i=Math.min(Math.abs(this.source.maxLevel),Math.abs(Math.floor(Math.log(e/this.minPixelRatio)/Math.log(2))));return i=Math.max(i,this.source.minLevel||0),{lowestLevel:t=Math.min(t,i),highestLevel:i}},_updateViewport:function(){for(this._needsDraw=!1,this._tilesLoading=0,this.loadingCoverage={};this.lastDrawn.length>0;){this.lastDrawn.pop().beingDrawn=!1}var e=this.viewport,i=this._viewportToTiledImageRectangle(e.getBoundsWithMargins(!0));if(!this.wrapHorizontal&&!this.wrapVertical){var n=this._viewportToTiledImageRectangle(this.getClippedBounds(!0));if(null===(i=i.intersection(n)))return}for(var r=this._getLevelsInterval(),o=r.lowestLevel,a=r.highestLevel,s=null,l=!1,h=t.now(),u=a;u>=o;u--){var c=!1,p=e.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(u),!0).x*this._scaleSpring.current.value;if(u===o||!l&&p>=this.minPixelRatio)c=!0,l=!0;else if(!l)continue;var f=e.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(u),!1).x*this._scaleSpring.current.value,d=e.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(Math.max(this.source.getClosestLevel(),0)),!1).x*this._scaleSpring.current.value,v=this.immediateRender?1:d,g=Math.min(1,(p-.5)/.5),y=v/Math.abs(v-f);if(s=this._updateLevel(l,c,u,g,y,i,h,s),this._providesCoverage(this.coverage,u))break}this._drawTiles(this.lastDrawn),s&&!s.context2D?(this._loadTile(s,h),this._needsDraw=!0,this._setFullyLoaded(!1)):this._setFullyLoaded(0===this._tilesLoading)},_getCornerTiles:function(e,i,n){var r,o,a,s;this.wrapHorizontal?(r=t.positiveModulo(i.x,1),o=t.positiveModulo(n.x,1)):(r=Math.max(0,i.x),o=Math.min(1,n.x));var l=1/this.source.aspectRatio;this.wrapVertical?(a=t.positiveModulo(i.y,l),s=t.positiveModulo(n.y,l)):(a=Math.max(0,i.y),s=Math.min(l,n.y));var h=this.source.getTileAtPoint(e,new t.Point(r,a)),u=this.source.getTileAtPoint(e,new t.Point(o,s)),c=this.source.getNumTiles(e);return this.wrapHorizontal&&(h.x+=c.x*Math.floor(i.x),u.x+=c.x*Math.floor(n.x)),this.wrapVertical&&(h.y+=c.y*Math.floor(i.y/l),u.y+=c.y*Math.floor(n.y/l)),{topLeft:h,bottomRight:u}},_updateLevel:function(t,e,i,n,r,o,a,s){var l=o.getBoundingBox().getTopLeft(),h=o.getBoundingBox().getBottomRight();this.viewer&&this.viewer.raiseEvent("update-level",{tiledImage:this,havedrawn:t,level:i,opacity:n,visibility:r,drawArea:o,topleft:l,bottomright:h,currenttime:a,best:s}),this._resetCoverage(this.coverage,i),this._resetCoverage(this.loadingCoverage,i);var u=this._getCornerTiles(i,l,h),c=u.topLeft,p=u.bottomRight,f=this.source.getNumTiles(i),d=this.viewport.pixelFromPoint(this.viewport.getCenter());this.getFlip()&&(p.x+=1,this.wrapHorizontal||(p.x=Math.min(p.x,f.x-1)));for(var v=c.x;v<=p.x;v++)for(var g=c.y;g<=p.y;g++){var y;if(this.getFlip()){var m=(f.x+v%f.x)%f.x;y=v+f.x-m-m-1}else y=v;null!==o.intersection(this.getTileBounds(i,y,g))&&(s=this._updateTile(e,t,y,g,i,n,r,d,f,a,s))}return s},_updateTile:function(t,e,i,n,r,o,a,s,l,h,u){var c=this._getTile(i,n,r,h,l,this._worldWidthCurrent,this._worldHeightCurrent),p=e;this.viewer&&this.viewer.raiseEvent("update-tile",{tiledImage:this,tile:c}),this._setCoverage(this.coverage,r,i,n,!1);var f=c.loaded||c.loading||this._isCovered(this.loadingCoverage,r,i,n);if(this._setCoverage(this.loadingCoverage,r,i,n,f),!c.exists)return u;if(t&&!p&&(this._isCovered(this.coverage,r,i,n)?this._setCoverage(this.coverage,r,i,n,!0):p=!0),!p)return u;if(this._positionTile(c,this.source.tileOverlap,this.viewport,s,a),!c.loaded)if(c.context2D)this._setTileLoaded(c);else{var d=this._tileCache.getImageRecord(c.cacheKey);d&&this._setTileLoaded(c,d.getData())}c.loaded?this._blendTile(c,i,n,r,o,h)&&(this._needsDraw=!0):c.loading?this._tilesLoading++:f||(u=this._compareTiles(u,c));return u},_getTile:function(e,i,n,r,o,a,s){var l,h,u,c,p,f,d,v,g,y,m=this.tilesMatrix,w=this.source;return m[n]||(m[n]={}),m[n][e]||(m[n][e]={}),m[n][e][i]&&!m[n][e][i].flipped==!this.flipped||(l=(o.x+e%o.x)%o.x,h=(o.y+i%o.y)%o.y,u=this.getTileBounds(n,e,i),c=w.getTileBounds(n,l,h,!0),p=w.tileExists(n,l,h),f=w.getTileUrl(n,l,h),d=w.getTilePostData(n,l,h),this.loadTilesWithAjax?(v=w.getTileAjaxHeaders(n,l,h),t.isPlainObject(this.ajaxHeaders)&&(v=t.extend({},this.ajaxHeaders,v))):v=null,g=w.getContext2D?w.getContext2D(n,l,h):void 0,y=new t.Tile(n,e,i,u,p,f,g,this.loadTilesWithAjax,v,c,d,w.getTileHashKey(n,l,h,f,v,d)),this.getFlip()?0===l&&(y.isRightMost=!0):l===o.x-1&&(y.isRightMost=!0),h===o.y-1&&(y.isBottomMost=!0),y.flipped=this.flipped,m[n][e][i]=y),(y=m[n][e][i]).lastTouchTime=r,y},_loadTile:function(t,e){var i=this;t.loading=!0,this._imageLoader.addJob({src:t.getUrl(),tile:t,source:this.source,postData:t.postData,loadWithAjax:t.loadWithAjax,ajaxHeaders:t.ajaxHeaders,crossOriginPolicy:this.crossOriginPolicy,ajaxWithCredentials:this.ajaxWithCredentials,callback:function(n,r,o){i._onTileLoad(t,e,n,r,o)},abort:function(){t.loading=!1}})},_onTileLoad:function(e,i,n,r,o){if(!n)return t.console.error("Tile %s failed to load: %s - error: %s",e,e.getUrl(),r),this.viewer.raiseEvent("tile-load-failed",{tile:e,tiledImage:this,time:i,message:r,tileRequest:o}),e.loading=!1,void(e.exists=!1);if(e.exists=!0,i<this.lastResetTime)return t.console.warn("Ignoring tile %s loaded before reset: %s",e,e.getUrl()),void(e.loading=!1);var a=this,s=function(){var t=a.source.getClosestLevel();a._setTileLoaded(e,n,t,o)};this._midDraw?window.setTimeout(s,1):s()},_setTileLoaded:function(e,i,n,r){var o=0,a=!1,s=this;function l(){return a&&t.console.error("Event 'tile-loaded' argument getCompletionCallback must be called synchronously. Its return value should be called asynchronously."),o++,h}function h(){0===--o&&(e.loading=!1,e.loaded=!0,e.hasTransparency=s.source.hasTransparency(e.context2D,e.getUrl(),e.ajaxHeaders,e.postData),e.context2D||s._tileCache.cacheTile({data:i,tile:e,cutoff:n,tiledImage:s}),s._needsDraw=!0)}var u=l();this.viewer.raiseEvent("tile-loaded",{tile:e,tiledImage:this,tileRequest:r,get image(){return t.console.error("[tile-loaded] event 'image' has been deprecated. Use 'data' property instead."),i},data:i,getCompletionCallback:l}),a=!0,u()},_positionTile:function(e,i,n,r,o){var a=e.bounds.getTopLeft();a.x*=this._scaleSpring.current.value,a.y*=this._scaleSpring.current.value,a.x+=this._xSpring.current.value,a.y+=this._ySpring.current.value;var s=e.bounds.getSize();s.x*=this._scaleSpring.current.value,s.y*=this._scaleSpring.current.value;var l=n.pixelFromPointNoRotate(a,!0),h=n.pixelFromPointNoRotate(a,!1),u=n.deltaPixelsFromPointsNoRotate(s,!0),c=n.deltaPixelsFromPointsNoRotate(s,!1),p=h.plus(c.divide(2)),f=r.squaredDistanceTo(p);i||(u=u.plus(new t.Point(1,1))),e.isRightMost&&this.wrapHorizontal&&(u.x+=.75),e.isBottomMost&&this.wrapVertical&&(u.y+=.75),e.position=l,e.size=u,e.squaredDistance=f,e.visibility=o},_blendTile:function(t,e,i,n,r,o){var a,s,l=1e3*this.blendTime;if(t.blendStart||(t.blendStart=o),a=o-t.blendStart,s=l?Math.min(1,a/l):1,this.alwaysBlend&&(s*=r),t.opacity=s,this.lastDrawn.push(t),1===s)this._setCoverage(this.coverage,n,e,i,!0),this._hasOpaqueTile=!0;else if(a<l)return!0;return!1},_compareTiles:function(t,e){return t?e.visibility>t.visibility||e.visibility===t.visibility&&e.squaredDistance<t.squaredDistance?e:t:e},_drawTiles:function(r){if(0!==this.opacity&&(0!==r.length||this.placeholderFillStyle)){var o,a,s,l=r[0];l&&(o=this.opacity<1||this.compositeOperation&&"source-over"!==this.compositeOperation||!this._isBottomItem()&&this.source.hasTransparency(l.context2D,l.getUrl(),l.ajaxHeaders,l.postData));var h,u=this.viewport.getZoom(!0),c=this.viewportToImageZoom(u);r.length>1&&c>this.smoothTileEdgesMinZoom&&!this.iOSDevice&&this.getRotation(!0)%360==0&&t.supportsCanvas&&this.viewer.useCanvas&&(o=!0,a=l.getScaleForEdgeSmoothing(),s=l.getTranslationForEdgeSmoothing(a,this._drawer.getCanvasSize(!1),this._drawer.getCanvasSize(!0))),o&&(a||(h=this.viewport.viewportToViewerElementRectangle(this.getClippedBounds(!0)).getIntegerBoundingBox(),this._drawer.viewer.viewport.getFlip()&&(this.viewport.getRotation(!0)%360==0&&this.getRotation(!0)%360==0||(h.x=this._drawer.viewer.container.clientWidth-(h.x+h.width))),h=h.times(t.pixelDensityRatio)),this._drawer._clear(!0,h)),a||(this.viewport.getRotation(!0)%360!=0&&this._drawer._offsetForRotation({degrees:this.viewport.getRotation(!0),useSketch:o}),this.getRotation(!0)%360!=0&&this._drawer._offsetForRotation({degrees:this.getRotation(!0),point:this.viewport.pixelFromPointNoRotate(this._getRotationPoint(!0),!0),useSketch:o}),this.viewport.getRotation(!0)%360==0&&this.getRotation(!0)%360==0&&this._drawer.viewer.viewport.getFlip()&&this._drawer._flip());var p=!1;if(this._clip){this._drawer.saveContext(o);var f=this.imageToViewportRectangle(this._clip,!0);f=f.rotate(-this.getRotation(!0),this._getRotationPoint(!0));var d=this._drawer.viewportToDrawerRectangle(f);a&&(d=d.times(a)),s&&(d=d.translate(s)),this._drawer.setClip(d,o),p=!0}if(this._croppingPolygons){var v=this;this._drawer.saveContext(o);try{var g=this._croppingPolygons.map(function(t){return t.map(function(t){var e=v.imageToViewportCoordinates(t.x,t.y,!0).rotate(-v.getRotation(!0),v._getRotationPoint(!0)),i=v._drawer.viewportCoordToDrawerCoord(e);return a&&(i=i.times(a)),s&&(i=i.plus(s)),i})});this._drawer.clipWithPolygons(g,o)}catch(_){t.console.error(_)}p=!0}if(this.placeholderFillStyle&&!1===this._hasOpaqueTile){var y=this._drawer.viewportToDrawerRectangle(this.getBounds(!0));a&&(y=y.times(a)),s&&(y=y.translate(s));var m=null;m="function"==typeof this.placeholderFillStyle?this.placeholderFillStyle(this,this._drawer.context):this.placeholderFillStyle,this._drawer.drawRectangle(y,m,o)}var w=function(r){if("number"==typeof r)return n(r);if(!r||!t.Browser)return e;var o=r[t.Browser.vendor];i(o)&&(o=r["*"]);return n(o)}(this.subPixelRoundingForTransparency),x=!1;if(w===t.SUBPIXEL_ROUNDING_OCCURRENCES.ALWAYS)x=!0;else if(w===t.SUBPIXEL_ROUNDING_OCCURRENCES.ONLY_AT_REST){x=!(this.viewer&&this.viewer.isAnimating())}for(var b=r.length-1;b>=0;b--)l=r[b],this._drawer.drawTile(l,this._drawingHandler,o,a,s,x,this.source),l.beingDrawn=!0,this.viewer&&this.viewer.raiseEvent("tile-drawn",{tiledImage:this,tile:l});p&&this._drawer.restoreContext(o),a||(this.getRotation(!0)%360!=0&&this._drawer._restoreRotationChanges(o),this.viewport.getRotation(!0)%360!=0&&this._drawer._restoreRotationChanges(o)),o&&(a&&(this.viewport.getRotation(!0)%360!=0&&this._drawer._offsetForRotation({degrees:this.viewport.getRotation(!0),useSketch:!1}),this.getRotation(!0)%360!=0&&this._drawer._offsetForRotation({degrees:this.getRotation(!0),point:this.viewport.pixelFromPointNoRotate(this._getRotationPoint(!0),!0),useSketch:!1})),this._drawer.blendSketch({opacity:this.opacity,scale:a,translate:s,compositeOperation:this.compositeOperation,bounds:h}),a&&(this.getRotation(!0)%360!=0&&this._drawer._restoreRotationChanges(!1),this.viewport.getRotation(!0)%360!=0&&this._drawer._restoreRotationChanges(!1))),a||this.viewport.getRotation(!0)%360==0&&this.getRotation(!0)%360==0&&this._drawer.viewer.viewport.getFlip()&&this._drawer._flip(),this._drawDebugInfo(r)}},_drawDebugInfo:function(e){if(this.debugMode)for(var i=e.length-1;i>=0;i--){var n=e[i];try{this._drawer.drawDebugInfo(n,e.length,i,this)}catch(r){t.console.error(r)}}},_providesCoverage:function(t,e,i,n){var r,o,a,s;if(!t[e])return!1;if(void 0===i||void 0===n){for(a in r=t[e])if(Object.prototype.hasOwnProperty.call(r,a))for(s in o=r[a])if(Object.prototype.hasOwnProperty.call(o,s)&&!o[s])return!1;return!0}return void 0===t[e][i]||void 0===t[e][i][n]||!0===t[e][i][n]},_isCovered:function(t,e,i,n){return void 0===i||void 0===n?this._providesCoverage(t,e+1):this._providesCoverage(t,e+1,2*i,2*n)&&this._providesCoverage(t,e+1,2*i,2*n+1)&&this._providesCoverage(t,e+1,2*i+1,2*n)&&this._providesCoverage(t,e+1,2*i+1,2*n+1)},_setCoverage:function(e,i,n,r,o){e[i]?(e[i][n]||(e[i][n]={}),e[i][n][r]=o):t.console.warn("Setting coverage for a tile before its level's coverage has been reset: %s",i)},_resetCoverage:function(t,e){t[e]={}}});var e=t.SUBPIXEL_ROUNDING_OCCURRENCES.NEVER;function i(e){return e!==t.SUBPIXEL_ROUNDING_OCCURRENCES.ALWAYS&&e!==t.SUBPIXEL_ROUNDING_OCCURRENCES.ONLY_AT_REST&&e!==t.SUBPIXEL_ROUNDING_OCCURRENCES.NEVER}function n(t){return i(t)?e:t}}(s),function(t){var e=function(e){t.console.assert(e,"[TileCache.cacheTile] options is required"),t.console.assert(e.tile,"[TileCache.cacheTile] options.tile is required"),t.console.assert(e.tiledImage,"[TileCache.cacheTile] options.tiledImage is required"),this.tile=e.tile,this.tiledImage=e.tiledImage},i=function(e){t.console.assert(e,"[ImageRecord] options is required"),t.console.assert(e.data,"[ImageRecord] options.data is required"),this._tiles=[],e.create.apply(null,[this,e.data,e.ownerTile]),this._destroyImplementation=e.destroy.bind(null,this),this.getImage=e.getImage.bind(null,this),this.getData=e.getData.bind(null,this),this.getRenderedContext=e.getRenderedContext.bind(null,this),this.getCopyRenderedContext=e.getCopyRenderedContext.bind(null,this)};i.prototype={destroy:function(){this._destroyImplementation(),this._tiles=null},addTile:function(e){t.console.assert(e,"[ImageRecord.addTile] tile is required"),this._tiles.push(e)},removeTile:function(e){for(var i=0;i<this._tiles.length;i++)if(this._tiles[i]===e)return void this._tiles.splice(i,1);t.console.warn("[ImageRecord.removeTile] trying to remove unknown tile",e)},getTileCount:function(){return this._tiles.length}},t.TileCache=function(e){e=e||{},this._maxImageCacheCount=e.maxImageCacheCount||t.DEFAULT_SETTINGS.maxImageCacheCount,this._tilesLoaded=[],this._imagesLoaded=[],this._imagesLoadedCount=0},t.TileCache.prototype={numTilesLoaded:function(){return this._tilesLoaded.length},cacheTile:function(n){t.console.assert(n,"[TileCache.cacheTile] options is required"),t.console.assert(n.tile,"[TileCache.cacheTile] options.tile is required"),t.console.assert(n.tile.cacheKey,"[TileCache.cacheTile] options.tile.cacheKey is required"),t.console.assert(n.tiledImage,"[TileCache.cacheTile] options.tiledImage is required");var r=n.cutoff||0,o=this._tilesLoaded.length,a=this._imagesLoaded[n.tile.cacheKey];if(a||(n.data||(t.console.error("[TileCache.cacheTile] options.image was renamed to options.data. '.image' attribute has been deprecated and will be removed in the future."),n.data=n.image),t.console.assert(n.data,"[TileCache.cacheTile] options.data is required to create an ImageRecord"),a=this._imagesLoaded[n.tile.cacheKey]=new i({data:n.data,ownerTile:n.tile,create:n.tiledImage.source.createTileCache,destroy:n.tiledImage.source.destroyTileCache,getImage:n.tiledImage.source.getTileCacheDataAsImage,getData:n.tiledImage.source.getTileCacheData,getRenderedContext:n.tiledImage.source.getTileCacheDataAsContext2D,getCopyRenderedContext:n.tiledImage.source.getCopyTileCacheDataAsContext2D}),this._imagesLoadedCount++),a.addTile(n.tile),n.tile.cacheImageRecord=a,this._imagesLoadedCount>this._maxImageCacheCount){for(var s,l,h,u,c,p,f=null,d=-1,v=null,g=this._tilesLoaded.length-1;g>=0;g--)(s=(p=this._tilesLoaded[g]).tile).level<=r||s.beingDrawn||(f?(u=s.lastTouchTime,l=f.lastTouchTime,c=s.level,h=f.level,(u<l||u===l&&c>h)&&(f=s,d=g,v=p)):(f=s,d=g,v=p));f&&d>=0&&(this._unloadTile(v),o=d)}this._tilesLoaded[o]=new e({tile:n.tile,tiledImage:n.tiledImage})},clearTilesFor:function(e){var i;t.console.assert(e,"[TileCache.clearTilesFor] tiledImage is required");for(var n=0;n<this._tilesLoaded.length;++n)(i=this._tilesLoaded[n]).tiledImage===e&&(this._unloadTile(i),this._tilesLoaded.splice(n,1),n--)},getImageRecord:function(e){return t.console.assert(e,"[TileCache.getImageRecord] cacheKey is required"),this._imagesLoaded[e]},_unloadTile:function(e){t.console.assert(e,"[TileCache._unloadTile] tileRecord is required");var i=e.tile,n=e.tiledImage;i.unload(),i.cacheImageRecord=null;var r=this._imagesLoaded[i.cacheKey];r.removeTile(i),r.getTileCount()||(r.destroy(),delete this._imagesLoaded[i.cacheKey],this._imagesLoadedCount--),n.viewer.raiseEvent("tile-unloaded",{tile:i,tiledImage:n})}}}(s),function(t){t.World=function(e){var i=this;t.console.assert(e.viewer,"[World] options.viewer is required"),t.EventSource.call(this),this.viewer=e.viewer,this._items=[],this._needsDraw=!1,this._autoRefigureSizes=!0,this._needsSizesFigured=!1,this._delegatedFigureSizes=function(t){i._autoRefigureSizes?i._figureSizes():i._needsSizesFigured=!0},this._figureSizes()},t.extend(t.World.prototype,t.EventSource.prototype,{addItem:function(e,i){if(t.console.assert(e,"[World.addItem] item is required"),t.console.assert(e instanceof t.TiledImage,"[World.addItem] only TiledImages supported at this time"),void 0!==(i=i||{}).index){var n=Math.max(0,Math.min(this._items.length,i.index));this._items.splice(n,0,e)}else this._items.push(e);this._autoRefigureSizes?this._figureSizes():this._needsSizesFigured=!0,this._needsDraw=!0,e.addHandler("bounds-change",this._delegatedFigureSizes),e.addHandler("clip-change",this._delegatedFigureSizes),this.raiseEvent("add-item",{item:e})},getItemAt:function(e){return t.console.assert(void 0!==e,"[World.getItemAt] index is required"),this._items[e]},getIndexOfItem:function(e){return t.console.assert(e,"[World.getIndexOfItem] item is required"),t.indexOf(this._items,e)},getItemCount:function(){return this._items.length},setItemIndex:function(e,i){t.console.assert(e,"[World.setItemIndex] item is required"),t.console.assert(void 0!==i,"[World.setItemIndex] index is required");var n=this.getIndexOfItem(e);if(i>=this._items.length)throw new Error("Index bigger than number of layers.");i!==n&&-1!==n&&(this._items.splice(n,1),this._items.splice(i,0,e),this._needsDraw=!0,this.raiseEvent("item-index-change",{item:e,previousIndex:n,newIndex:i}))},removeItem:function(e){t.console.assert(e,"[World.removeItem] item is required");var i=t.indexOf(this._items,e);-1!==i&&(e.removeHandler("bounds-change",this._delegatedFigureSizes),e.removeHandler("clip-change",this._delegatedFigureSizes),e.destroy(),this._items.splice(i,1),this._figureSizes(),this._needsDraw=!0,this._raiseRemoveItem(e))},removeAll:function(){var t,e;for(this.viewer._cancelPendingImages(),e=0;e<this._items.length;e++)(t=this._items[e]).removeHandler("bounds-change",this._delegatedFigureSizes),t.removeHandler("clip-change",this._delegatedFigureSizes),t.destroy();var i=this._items;for(this._items=[],this._figureSizes(),this._needsDraw=!0,e=0;e<i.length;e++)t=i[e],this._raiseRemoveItem(t)},resetItems:function(){for(var t=0;t<this._items.length;t++)this._items[t].reset()},update:function(){for(var t=!1,e=0;e<this._items.length;e++)t=this._items[e].update()||t;return t},draw:function(){for(var t=0;t<this._items.length;t++)this._items[t].draw();this._needsDraw=!1},needsDraw:function(){for(var t=0;t<this._items.length;t++)if(this._items[t].needsDraw())return!0;return this._needsDraw},getHomeBounds:function(){return this._homeBounds.clone()},getContentFactor:function(){return this._contentFactor},setAutoRefigureSizes:function(t){this._autoRefigureSizes=t,t&this._needsSizesFigured&&(this._figureSizes(),this._needsSizesFigured=!1)},arrange:function(e){var i,n=(e=e||{}).immediately||!1,r=e.layout||t.DEFAULT_SETTINGS.collectionLayout,o=e.rows||t.DEFAULT_SETTINGS.collectionRows,a=e.columns||t.DEFAULT_SETTINGS.collectionColumns,s=e.tileSize||t.DEFAULT_SETTINGS.collectionTileSize,l=s+(e.tileMargin||t.DEFAULT_SETTINGS.collectionTileMargin);i=!e.rows&&a?a:Math.ceil(this._items.length/o);var h,u,c,p,f,d=0,v=0;this.setAutoRefigureSizes(!1);for(var g=0;g<this._items.length;g++)g&&g%i===0&&("horizontal"===r?(v+=l,d=0):(d+=l,v=0)),p=(c=(u=(h=this._items[g]).getBounds()).width>u.height?s:s*(u.width/u.height))*(u.height/u.width),f=new t.Point(d+(s-c)/2,v+(s-p)/2),h.setPosition(f,n),h.setWidth(c,n),"horizontal"===r?d+=l:v+=l;this.setAutoRefigureSizes(!0)},_figureSizes:function(){var e=this._homeBounds?this._homeBounds.clone():null,i=this._contentSize?this._contentSize.clone():null,n=this._contentFactor||0;if(this._items.length){var r=this._items[0],o=r.getBounds();this._contentFactor=r.getContentSize().x/o.width;for(var a=r.getClippedBounds().getBoundingBox(),s=a.x,l=a.y,h=a.x+a.width,u=a.y+a.height,c=1;c<this._items.length;c++)o=(r=this._items[c]).getBounds(),this._contentFactor=Math.max(this._contentFactor,r.getContentSize().x/o.width),a=r.getClippedBounds().getBoundingBox(),s=Math.min(s,a.x),l=Math.min(l,a.y),h=Math.max(h,a.x+a.width),u=Math.max(u,a.y+a.height);this._homeBounds=new t.Rect(s,l,h-s,u-l),this._contentSize=new t.Point(this._homeBounds.width*this._contentFactor,this._homeBounds.height*this._contentFactor)}else this._homeBounds=new t.Rect(0,0,1,1),this._contentSize=new t.Point(1,1),this._contentFactor=1;this._contentFactor===n&&this._homeBounds.equals(e)&&this._contentSize.equals(i)||this.raiseEvent("metrics-change",{})},_raiseRemoveItem:function(t){this.raiseEvent("remove-item",{item:t})}})}(s)},2892:function(t,e,i){var n=i(6518),r=i(6395),o=i(3724),a=i(4576),s=i(9167),l=i(9504),h=i(2796),u=i(9297),c=i(3167),p=i(1625),f=i(757),d=i(2777),v=i(9039),g=i(8480).f,y=i(7347).f,m=i(4913).f,w=i(1240),x=i(3802).trim,b="Number",_=a[b],T=s[b],S=_.prototype,P=a.TypeError,E=l("".slice),C=l("".charCodeAt),O=function(t){var e,i,n,r,o,a,s,l,h=d(t,"number");if(f(h))throw new P("Cannot convert a Symbol value to a number");if("string"==typeof h&&h.length>2)if(h=x(h),43===(e=C(h,0))||45===e){if(88===(i=C(h,2))||120===i)return NaN}else if(48===e){switch(C(h,1)){case 66:case 98:n=2,r=49;break;case 79:case 111:n=8,r=55;break;default:return+h}for(a=(o=E(h,2)).length,s=0;s<a;s++)if((l=C(o,s))<48||l>r)return NaN;return parseInt(o,n)}return+h},R=h(b,!_(" 0o1")||!_("0b1")||_("+0x1")),k=function(t){var e,i=arguments.length<1?0:_(function(t){var e=d(t,"number");return"bigint"==typeof e?e:O(e)}(t));return p(S,e=this)&&v(function(){w(e)})?c(Object(i),this,k):i};k.prototype=S,R&&!r&&(S.constructor=k),n({global:!0,constructor:!0,wrap:!0,forced:R},{Number:k});var I=function(t,e){for(var i,n=o?g(e):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),r=0;n.length>r;r++)u(e,i=n[r])&&!u(t,i)&&m(t,i,y(e,i))};r&&T&&I(s[b],T),(R||r)&&I(s[b],_)},2953:function(t,e,i){var n=i(4576),r=i(7400),o=i(9296),a=i(3792),s=i(6699),l=i(687),h=i(8227)("iterator"),u=a.values,c=function(t,e){if(t){if(t[h]!==u)try{s(t,h,u)}catch(n){t[h]=u}if(l(t,e,!0),r[e])for(var i in a)if(t[i]!==a[i])try{s(t,i,a[i])}catch(n){t[i]=a[i]}}};for(var p in r)c(n[p]&&n[p].prototype,p);c(o,"DOMTokenList")},2967:function(t,e,i){var n=i(6706),r=i(34),o=i(7750),a=i(3506);t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,i={};try{(t=n(Object.prototype,"__proto__","set"))(i,[]),e=i instanceof Array}catch(s){}return function(i,n){return o(i),a(n),r(i)?(e?t(i,n):i.__proto__=n,i):i}}():void 0)},3110:function(t,e,i){var n=i(6518),r=i(7751),o=i(8745),a=i(9565),s=i(9504),l=i(9039),h=i(4901),u=i(757),c=i(7680),p=i(6933),f=i(4495),d=String,v=r("JSON","stringify"),g=s(/./.exec),y=s("".charAt),m=s("".charCodeAt),w=s("".replace),x=s(1..toString),b=/[\uD800-\uDFFF]/g,_=/^[\uD800-\uDBFF]$/,T=/^[\uDC00-\uDFFF]$/,S=!f||l(function(){var t=r("Symbol")("stringify detection");return"[null]"!==v([t])||"{}"!==v({a:t})||"{}"!==v(Object(t))}),P=l(function(){return'"\\udf06\\ud834"'!==v("\udf06\ud834")||'"\\udead"'!==v("\udead")}),E=function(t,e){var i=c(arguments),n=p(e);if(h(n)||void 0!==t&&!u(t))return i[1]=function(t,e){if(h(n)&&(e=a(n,this,d(t),e)),!u(e))return e},o(v,null,i)},C=function(t,e,i){var n=y(i,e-1),r=y(i,e+1);return g(_,t)&&!g(T,r)||g(T,t)&&!g(_,n)?"\\u"+x(m(t,0),16):t};v&&n({target:"JSON",stat:!0,arity:3,forced:S||P},{stringify:function(t,e,i){var n=c(arguments),r=o(S?E:v,null,n);return P&&"string"==typeof r?w(r,b,C):r}})},3167:function(t,e,i){var n=i(4901),r=i(34),o=i(2967);t.exports=function(t,e,i){var a,s;return o&&n(a=e.constructor)&&a!==i&&r(s=a.prototype)&&s!==i.prototype&&o(t,s),t}},3179:function(t,e,i){var n=i(2140),r=i(6955);t.exports=n?{}.toString:function(){return"[object "+r(this)+"]"}},3237:function(t,e){!function(t){var e=function(){function t(){this.firefox=!1,this.ie=!1,this.edge=!1,this.newEdge=!1,this.weChat=!1}return t}(),i=new(function(){function t(){this.browser=new e,this.node=!1,this.wxa=!1,this.worker=!1,this.svgSupported=!1,this.touchEventsSupported=!1,this.pointerEventsSupported=!1,this.domSupported=!1,this.transformSupported=!1,this.transform3dSupported=!1,this.hasGlobalWindow="undefined"!=typeof window}return t}());function n(t,e){var i=e.browser,n=t.match(/Firefox\/([\d.]+)/),r=t.match(/MSIE\s([\d.]+)/)||t.match(/Trident\/.+?rv:(([\d.]+))/),o=t.match(/Edge?\/([\d.]+)/),a=/micromessenger/i.test(t);if(n&&(i.firefox=!0,i.version=n[1]),r&&(i.ie=!0,i.version=r[1]),o&&(i.edge=!0,i.version=o[1],i.newEdge=+o[1].split(".")[0]>18),a&&(i.weChat=!0),e.svgSupported="undefined"!=typeof SVGRect,e.touchEventsSupported="ontouchstart"in window&&!i.ie&&!i.edge,e.pointerEventsSupported="onpointerdown"in window&&(i.edge||i.ie&&+i.version>=11),e.domSupported="undefined"!=typeof document){var s=document.documentElement.style;e.transform3dSupported=(i.ie&&"transition"in s||i.edge||"WebKitCSSMatrix"in window&&"m11"in new WebKitCSSMatrix||"MozPerspective"in s)&&!("OTransition"in s),e.transformSupported=e.transform3dSupported||i.ie&&+i.version>=9}}"object"==typeof wx&&"function"==typeof wx.getSystemInfoSync?(i.wxa=!0,i.touchEventsSupported=!0):"undefined"==typeof document&&"undefined"!=typeof self?i.worker=!0:!i.hasGlobalWindow||"Deno"in window||"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent.indexOf("Node.js")>-1?(i.node=!0,i.svgSupported=!0):n(navigator.userAgent,i);var r=12,o="sans-serif",a=r+"px "+o,s=20,l=100;function h(t){var e={};if("undefined"==typeof JSON)return e;for(var i=0;i<t.length;i++){var n=String.fromCharCode(i+32),r=(t.charCodeAt(i)-s)/l;e[n]=r}return e}var u,c,p=h("007LLmW'55;N0500LLLLLLLLLL00NNNLzWW\\\\WQb\\0FWLg\\bWb\\WQ\\WrWWQ000CL5LLFLL0LL**F*gLLLL5F0LF\\FFF5.5N"),f={createCanvas:function(){return"undefined"!=typeof document&&document.createElement("canvas")},measureText:function(t,e){if(!u){var i=f.createCanvas();u=i&&i.getContext("2d")}if(u)return c!==e&&(c=u.font=e||a),u.measureText(t);t=t||"";var n=/((?:\d+)?\.?\d*)px/.exec(e=e||a),o=n&&+n[1]||r,s=0;if(e.indexOf("mono")>=0)s=o*t.length;else for(var l=0;l<t.length;l++){var h=p[t[l]];s+=null==h?o:h*o}return{width:s}},loadImage:function(t,e,i){var n=new Image;return n.onload=e,n.onerror=i,n.src=t,n}};function d(t){for(var e in f)t[e]&&(f[e]=t[e])}var v=H(["Function","RegExp","Date","Error","CanvasGradient","CanvasPattern","Image","Canvas"],function(t,e){return t["[object "+e+"]"]=!0,t},{}),g=H(["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64"],function(t,e){return t["[object "+e+"Array]"]=!0,t},{}),y=Object.prototype.toString,m=Array.prototype,w=m.forEach,x=m.filter,b=m.slice,_=m.map,T=function(){}.constructor,S=T?T.prototype:null,P="__proto__",E=2311;function C(){return E++}function O(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e]}function R(t){if(null==t||"object"!=typeof t)return t;var e=t,i=y.call(t);if("[object Array]"===i){if(!gt(t)){e=[];for(var n=0,r=t.length;n<r;n++)e[n]=R(t[n])}}else if(g[i]){if(!gt(t)){var o=t.constructor;if(o.from)e=o.from(t);else for(e=new o(t.length),n=0,r=t.length;n<r;n++)e[n]=t[n]}}else if(!v[i]&&!gt(t)&&!it(t))for(var a in e={},t)t.hasOwnProperty(a)&&a!==P&&(e[a]=R(t[a]));return e}function k(t,e,i){if(!J(e)||!J(t))return i?R(e):t;for(var n in e)if(e.hasOwnProperty(n)&&n!==P){var r=t[n],o=e[n];!J(o)||!J(r)||X(o)||X(r)||it(o)||it(r)||tt(o)||tt(r)||gt(o)||gt(r)?!i&&n in t||(t[n]=R(e[n])):k(r,o,i)}return t}function I(t,e){for(var i=t[0],n=1,r=t.length;n<r;n++)i=k(i,t[n],e);return i}function D(t,e){if(Object.assign)Object.assign(t,e);else for(var i in e)e.hasOwnProperty(i)&&i!==P&&(t[i]=e[i]);return t}function M(t,e,i){for(var n=U(e),r=0,o=n.length;r<o;r++){var a=n[r];(i?null!=e[a]:null==t[a])&&(t[a]=e[a])}return t}var A=f.createCanvas;function L(t,e){if(t){if(t.indexOf)return t.indexOf(e);for(var i=0,n=t.length;i<n;i++)if(t[i]===e)return i}return-1}function z(t,e){var i=t.prototype;function n(){}for(var r in n.prototype=e.prototype,t.prototype=new n,i)i.hasOwnProperty(r)&&(t.prototype[r]=i[r]);t.prototype.constructor=t,t.superClass=e}function j(t,e,i){if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames)for(var n=Object.getOwnPropertyNames(e),r=0;r<n.length;r++){var o=n[r];"constructor"!==o&&(i?null!=e[o]:null==t[o])&&(t[o]=e[o])}else M(t,e,i)}function B(t){return!!t&&"string"!=typeof t&&"number"==typeof t.length}function F(t,e,i){if(t&&e)if(t.forEach&&t.forEach===w)t.forEach(e,i);else if(t.length===+t.length)for(var n=0,r=t.length;n<r;n++)e.call(i,t[n],n,t);else for(var o in t)t.hasOwnProperty(o)&&e.call(i,t[o],o,t)}function N(t,e,i){if(!t)return[];if(!e)return ut(t);if(t.map&&t.map===_)return t.map(e,i);for(var n=[],r=0,o=t.length;r<o;r++)n.push(e.call(i,t[r],r,t));return n}function H(t,e,i,n){if(t&&e){for(var r=0,o=t.length;r<o;r++)i=e.call(n,i,t[r],r,t);return i}}function W(t,e,i){if(!t)return[];if(!e)return ut(t);if(t.filter&&t.filter===x)return t.filter(e,i);for(var n=[],r=0,o=t.length;r<o;r++)e.call(i,t[r],r,t)&&n.push(t[r]);return n}function V(t,e,i){if(t&&e)for(var n=0,r=t.length;n<r;n++)if(e.call(i,t[n],n,t))return t[n]}function U(t){if(!t)return[];if(Object.keys)return Object.keys(t);var e=[];for(var i in t)t.hasOwnProperty(i)&&e.push(i);return e}function G(t,e){for(var i=[],n=2;n<arguments.length;n++)i[n-2]=arguments[n];return function(){return t.apply(e,i.concat(b.call(arguments)))}}var q=S&&Y(S.bind)?S.call.bind(S.bind):G;function Z(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];return function(){return t.apply(this,e.concat(b.call(arguments)))}}function X(t){return Array.isArray?Array.isArray(t):"[object Array]"===y.call(t)}function Y(t){return"function"==typeof t}function $(t){return"string"==typeof t}function K(t){return"[object String]"===y.call(t)}function Q(t){return"number"==typeof t}function J(t){var e=typeof t;return"function"===e||!!t&&"object"===e}function tt(t){return!!v[y.call(t)]}function et(t){return!!g[y.call(t)]}function it(t){return"object"==typeof t&&"number"==typeof t.nodeType&&"object"==typeof t.ownerDocument}function nt(t){return null!=t.colorStops}function rt(t){return null!=t.image}function ot(t){return"[object RegExp]"===y.call(t)}function at(t){return t!=t}function st(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var i=0,n=t.length;i<n;i++)if(null!=t[i])return t[i]}function lt(t,e){return null!=t?t:e}function ht(t,e,i){return null!=t?t:null!=e?e:i}function ut(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];return b.apply(t,e)}function ct(t){if("number"==typeof t)return[t,t,t,t];var e=t.length;return 2===e?[t[0],t[1],t[0],t[1]]:3===e?[t[0],t[1],t[2],t[1]]:t}function pt(t,e){if(!t)throw new Error(e)}function ft(t){return null==t?null:"function"==typeof t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}var dt="__ec_primitive__";function vt(t){t[dt]=!0}function gt(t){return t[dt]}var yt=function(){function t(){this.data={}}return t.prototype.delete=function(t){var e=this.has(t);return e&&delete this.data[t],e},t.prototype.has=function(t){return this.data.hasOwnProperty(t)},t.prototype.get=function(t){return this.data[t]},t.prototype.set=function(t,e){return this.data[t]=e,this},t.prototype.keys=function(){return U(this.data)},t.prototype.forEach=function(t){var e=this.data;for(var i in e)e.hasOwnProperty(i)&&t(e[i],i)},t}(),mt="function"==typeof Map;function wt(){return mt?new Map:new yt}var xt=function(){function t(e){var i=X(e);this.data=wt();var n=this;function r(t,e){i?n.set(t,e):n.set(e,t)}e instanceof t?e.each(r):e&&F(e,r)}return t.prototype.hasKey=function(t){return this.data.has(t)},t.prototype.get=function(t){return this.data.get(t)},t.prototype.set=function(t,e){return this.data.set(t,e),e},t.prototype.each=function(t,e){this.data.forEach(function(i,n){t.call(e,i,n)})},t.prototype.keys=function(){var t=this.data.keys();return mt?Array.from(t):t},t.prototype.removeKey=function(t){this.data.delete(t)},t}();function bt(t){return new xt(t)}function _t(t,e){for(var i=new t.constructor(t.length+e.length),n=0;n<t.length;n++)i[n]=t[n];var r=t.length;for(n=0;n<e.length;n++)i[n+r]=e[n];return i}function Tt(t,e){var i;if(Object.create)i=Object.create(t);else{var n=function(){};n.prototype=t,i=new n}return e&&D(i,e),i}function St(t){var e=t.style;e.webkitUserSelect="none",e.userSelect="none",e.webkitTapHighlightColor="rgba(0,0,0,0)",e["-webkit-touch-callout"]="none"}function Pt(t,e){return t.hasOwnProperty(e)}function Et(){}var Ct=180/Math.PI,Ot=Number.EPSILON||Math.pow(2,-52),Rt=Object.freeze({__proto__:null,guid:C,logError:O,clone:R,merge:k,mergeAll:I,extend:D,defaults:M,createCanvas:A,indexOf:L,inherits:z,mixin:j,isArrayLike:B,each:F,map:N,reduce:H,filter:W,find:V,keys:U,bind:q,curry:Z,isArray:X,isFunction:Y,isString:$,isStringSafe:K,isNumber:Q,isObject:J,isBuiltInObject:tt,isTypedArray:et,isDom:it,isGradientObject:nt,isImagePatternObject:rt,isRegExp:ot,eqNaN:at,retrieve:st,retrieve2:lt,retrieve3:ht,slice:ut,normalizeCssArray:ct,assert:pt,trim:ft,setAsPrimitive:vt,isPrimitive:gt,HashMap:xt,createHashMap:bt,concatArray:_t,createObject:Tt,disableUserSelect:St,hasOwn:Pt,noop:Et,RADIAN_TO_DEGREE:Ct,EPSILON:Ot}),kt=function(t,e){return kt=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])},kt(t,e)};function It(t,e){function i(){this.constructor=t}kt(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}function Dt(t,e){return null==t&&(t=0),null==e&&(e=0),[t,e]}function Mt(t,e){return t[0]=e[0],t[1]=e[1],t}function At(t){return[t[0],t[1]]}function Lt(t,e,i){return t[0]=e,t[1]=i,t}function zt(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t}function jt(t,e,i,n){return t[0]=e[0]+i[0]*n,t[1]=e[1]+i[1]*n,t}function Bt(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t}function Ft(t){return Math.sqrt(Ht(t))}var Nt=Ft;function Ht(t){return t[0]*t[0]+t[1]*t[1]}var Wt=Ht;function Vt(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t}function Ut(t,e,i){return t[0]=e[0]/i[0],t[1]=e[1]/i[1],t}function Gt(t,e){return t[0]*e[0]+t[1]*e[1]}function qt(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t}function Zt(t,e){var i=Ft(e);return 0===i?(t[0]=0,t[1]=0):(t[0]=e[0]/i,t[1]=e[1]/i),t}function Xt(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))}var Yt=Xt;function $t(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}var Kt=$t;function Qt(t,e){return t[0]=-e[0],t[1]=-e[1],t}function Jt(t,e,i,n){return t[0]=e[0]+n*(i[0]-e[0]),t[1]=e[1]+n*(i[1]-e[1]),t}function te(t,e,i){var n=e[0],r=e[1];return t[0]=i[0]*n+i[2]*r+i[4],t[1]=i[1]*n+i[3]*r+i[5],t}function ee(t,e,i){return t[0]=Math.min(e[0],i[0]),t[1]=Math.min(e[1],i[1]),t}function ie(t,e,i){return t[0]=Math.max(e[0],i[0]),t[1]=Math.max(e[1],i[1]),t}var ne=Object.freeze({__proto__:null,create:Dt,copy:Mt,clone:At,set:Lt,add:zt,scaleAndAdd:jt,sub:Bt,len:Ft,length:Nt,lenSquare:Ht,lengthSquare:Wt,mul:Vt,div:Ut,dot:Gt,scale:qt,normalize:Zt,distance:Xt,dist:Yt,distanceSquare:$t,distSquare:Kt,negate:Qt,lerp:Jt,applyTransform:te,min:ee,max:ie}),re=function(){function t(t,e){this.target=t,this.topTarget=e&&e.topTarget}return t}(),oe=function(){function t(t){this.handler=t,t.on("mousedown",this._dragStart,this),t.on("mousemove",this._drag,this),t.on("mouseup",this._dragEnd,this)}return t.prototype._dragStart=function(t){for(var e=t.target;e&&!e.draggable;)e=e.parent||e.__hostTarget;e&&(this._draggingTarget=e,e.dragging=!0,this._x=t.offsetX,this._y=t.offsetY,this.handler.dispatchToElement(new re(e,t),"dragstart",t.event))},t.prototype._drag=function(t){var e=this._draggingTarget;if(e){var i=t.offsetX,n=t.offsetY,r=i-this._x,o=n-this._y;this._x=i,this._y=n,e.drift(r,o,t),this.handler.dispatchToElement(new re(e,t),"drag",t.event);var a=this.handler.findHover(i,n,e).target,s=this._dropTarget;this._dropTarget=a,e!==a&&(s&&a!==s&&this.handler.dispatchToElement(new re(s,t),"dragleave",t.event),a&&a!==s&&this.handler.dispatchToElement(new re(a,t),"dragenter",t.event))}},t.prototype._dragEnd=function(t){var e=this._draggingTarget;e&&(e.dragging=!1),this.handler.dispatchToElement(new re(e,t),"dragend",t.event),this._dropTarget&&this.handler.dispatchToElement(new re(this._dropTarget,t),"drop",t.event),this._draggingTarget=null,this._dropTarget=null},t}(),ae=function(){function t(t){t&&(this._$eventProcessor=t)}return t.prototype.on=function(t,e,i,n){this._$handlers||(this._$handlers={});var r=this._$handlers;if("function"==typeof e&&(n=i,i=e,e=null),!i||!t)return this;var o=this._$eventProcessor;null!=e&&o&&o.normalizeQuery&&(e=o.normalizeQuery(e)),r[t]||(r[t]=[]);for(var a=0;a<r[t].length;a++)if(r[t][a].h===i)return this;var s={h:i,query:e,ctx:n||this,callAtLast:i.zrEventfulCallAtLast},l=r[t].length-1,h=r[t][l];return h&&h.callAtLast?r[t].splice(l,0,s):r[t].push(s),this},t.prototype.isSilent=function(t){var e=this._$handlers;return!e||!e[t]||!e[t].length},t.prototype.off=function(t,e){var i=this._$handlers;if(!i)return this;if(!t)return this._$handlers={},this;if(e){if(i[t]){for(var n=[],r=0,o=i[t].length;r<o;r++)i[t][r].h!==e&&n.push(i[t][r]);i[t]=n}i[t]&&0===i[t].length&&delete i[t]}else delete i[t];return this},t.prototype.trigger=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];if(!this._$handlers)return this;var n=this._$handlers[t],r=this._$eventProcessor;if(n)for(var o=e.length,a=n.length,s=0;s<a;s++){var l=n[s];if(!r||!r.filter||null==l.query||r.filter(t,l.query))switch(o){case 0:l.h.call(l.ctx);break;case 1:l.h.call(l.ctx,e[0]);break;case 2:l.h.call(l.ctx,e[0],e[1]);break;default:l.h.apply(l.ctx,e)}}return r&&r.afterTrigger&&r.afterTrigger(t),this},t.prototype.triggerWithContext=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];if(!this._$handlers)return this;var n=this._$handlers[t],r=this._$eventProcessor;if(n)for(var o=e.length,a=e[o-1],s=n.length,l=0;l<s;l++){var h=n[l];if(!r||!r.filter||null==h.query||r.filter(t,h.query))switch(o){case 0:h.h.call(a);break;case 1:h.h.call(a,e[0]);break;case 2:h.h.call(a,e[0],e[1]);break;default:h.h.apply(a,e.slice(1,o-1))}}return r&&r.afterTrigger&&r.afterTrigger(t),this},t}(),se=Math.log(2);function le(t,e,i,n,r,o){var a=n+"-"+r,s=t.length;if(o.hasOwnProperty(a))return o[a];if(1===e){var l=Math.round(Math.log((1<<s)-1&~r)/se);return t[i][l]}for(var h=n|1<<i,u=i+1;n&1<<u;)u++;for(var c=0,p=0,f=0;p<s;p++){var d=1<<p;d&r||(c+=(f%2?-1:1)*t[i][p]*le(t,e-1,u,h,r|d,o),f++)}return o[a]=c,c}function he(t,e){var i=[[t[0],t[1],1,0,0,0,-e[0]*t[0],-e[0]*t[1]],[0,0,0,t[0],t[1],1,-e[1]*t[0],-e[1]*t[1]],[t[2],t[3],1,0,0,0,-e[2]*t[2],-e[2]*t[3]],[0,0,0,t[2],t[3],1,-e[3]*t[2],-e[3]*t[3]],[t[4],t[5],1,0,0,0,-e[4]*t[4],-e[4]*t[5]],[0,0,0,t[4],t[5],1,-e[5]*t[4],-e[5]*t[5]],[t[6],t[7],1,0,0,0,-e[6]*t[6],-e[6]*t[7]],[0,0,0,t[6],t[7],1,-e[7]*t[6],-e[7]*t[7]]],n={},r=le(i,8,0,0,0,n);if(0!==r){for(var o=[],a=0;a<8;a++)for(var s=0;s<8;s++)null==o[s]&&(o[s]=0),o[s]+=((a+s)%2?-1:1)*le(i,7,0===a?1:0,1<<a,1<<s,n)/r*e[a];return function(t,e,i){var n=e*o[6]+i*o[7]+1;t[0]=(e*o[0]+i*o[1]+o[2])/n,t[1]=(e*o[3]+i*o[4]+o[5])/n}}}var ue="___zrEVENTSAVED";function ce(t,e,n,r,o){if(e.getBoundingClientRect&&i.domSupported&&!de(e)){var a=e[ue]||(e[ue]={}),s=fe(pe(e,a),a,o);if(s)return s(t,n,r),!0}return!1}function pe(t,e){var i=e.markers;if(i)return i;i=e.markers=[];for(var n=["left","right"],r=["top","bottom"],o=0;o<4;o++){var a=document.createElement("div"),s=o%2,l=(o>>1)%2;a.style.cssText=["position: absolute","visibility: hidden","padding: 0","margin: 0","border-width: 0","user-select: none","width:0","height:0",n[s]+":0",r[l]+":0",n[1-s]+":auto",r[1-l]+":auto",""].join("!important;"),t.appendChild(a),i.push(a)}return e.clearMarkers=function(){F(i,function(t){t.parentNode&&t.parentNode.removeChild(t)})},i}function fe(t,e,i){for(var n=i?"invTrans":"trans",r=e[n],o=e.srcCoords,a=[],s=[],l=!0,h=0;h<4;h++){var u=t[h].getBoundingClientRect(),c=2*h,p=u.left,f=u.top;a.push(p,f),l=l&&o&&p===o[c]&&f===o[c+1],s.push(t[h].offsetLeft,t[h].offsetTop)}return l&&r?r:(e.srcCoords=a,e[n]=i?he(s,a):he(a,s))}function de(t){return"CANVAS"===t.nodeName.toUpperCase()}var ve=/([&<>"'])/g,ge={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function ye(t){return null==t?"":(t+"").replace(ve,function(t,e){return ge[e]})}var me=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,we=[],xe=i.browser.firefox&&+i.browser.version.split(".")[0]<39;function be(t,e,i,n){return i=i||{},n?_e(t,e,i):xe&&null!=e.layerX&&e.layerX!==e.offsetX?(i.zrX=e.layerX,i.zrY=e.layerY):null!=e.offsetX?(i.zrX=e.offsetX,i.zrY=e.offsetY):_e(t,e,i),i}function _e(t,e,n){if(i.domSupported&&t.getBoundingClientRect){var r=e.clientX,o=e.clientY;if(de(t)){var a=t.getBoundingClientRect();return n.zrX=r-a.left,void(n.zrY=o-a.top)}if(ce(we,t,r,o))return n.zrX=we[0],void(n.zrY=we[1])}n.zrX=n.zrY=0}function Te(t){return t||window.event}function Se(t,e,i){if(null!=(e=Te(e)).zrX)return e;var n=e.type;if(n&&n.indexOf("touch")>=0){var r="touchend"!==n?e.targetTouches[0]:e.changedTouches[0];r&&be(t,r,e,i)}else{be(t,e,e,i);var o=Pe(e);e.zrDelta=o?o/120:-(e.detail||0)/3}var a=e.button;return null==e.which&&void 0!==a&&me.test(e.type)&&(e.which=1&a?1:2&a?3:4&a?2:0),e}function Pe(t){var e=t.wheelDelta;if(e)return e;var i=t.deltaX,n=t.deltaY;return null==i||null==n?e:3*(0!==n?Math.abs(n):Math.abs(i))*(n>0?-1:n<0?1:i>0?-1:1)}function Ee(t,e,i,n){t.addEventListener(e,i,n)}function Ce(t,e,i,n){t.removeEventListener(e,i,n)}var Oe=function(t){t.preventDefault(),t.stopPropagation(),t.cancelBubble=!0},Re=function(){function t(){this._track=[]}return t.prototype.recognize=function(t,e,i){return this._doTrack(t,e,i),this._recognize(t)},t.prototype.clear=function(){return this._track.length=0,this},t.prototype._doTrack=function(t,e,i){var n=t.touches;if(n){for(var r={points:[],touches:[],target:e,event:t},o=0,a=n.length;o<a;o++){var s=n[o],l=be(i,s,{});r.points.push([l.zrX,l.zrY]),r.touches.push(s)}this._track.push(r)}},t.prototype._recognize=function(t){for(var e in De)if(De.hasOwnProperty(e)){var i=De[e](this._track,t);if(i)return i}},t}();function ke(t){var e=t[1][0]-t[0][0],i=t[1][1]-t[0][1];return Math.sqrt(e*e+i*i)}function Ie(t){return[(t[0][0]+t[1][0])/2,(t[0][1]+t[1][1])/2]}var De={pinch:function(t,e){var i=t.length;if(i){var n=(t[i-1]||{}).points,r=(t[i-2]||{}).points||n;if(r&&r.length>1&&n&&n.length>1){var o=ke(n)/ke(r);!isFinite(o)&&(o=1),e.pinchScale=o;var a=Ie(n);return e.pinchX=a[0],e.pinchY=a[1],{type:"pinch",target:t[0].target,event:e}}}}};function Me(){return[1,0,0,1,0,0]}function Ae(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t}function Le(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function ze(t,e,i){var n=e[0]*i[0]+e[2]*i[1],r=e[1]*i[0]+e[3]*i[1],o=e[0]*i[2]+e[2]*i[3],a=e[1]*i[2]+e[3]*i[3],s=e[0]*i[4]+e[2]*i[5]+e[4],l=e[1]*i[4]+e[3]*i[5]+e[5];return t[0]=n,t[1]=r,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t}function je(t,e,i){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4]+i[0],t[5]=e[5]+i[1],t}function Be(t,e,i,n){void 0===n&&(n=[0,0]);var r=e[0],o=e[2],a=e[4],s=e[1],l=e[3],h=e[5],u=Math.sin(i),c=Math.cos(i);return t[0]=r*c+s*u,t[1]=-r*u+s*c,t[2]=o*c+l*u,t[3]=-o*u+c*l,t[4]=c*(a-n[0])+u*(h-n[1])+n[0],t[5]=c*(h-n[1])-u*(a-n[0])+n[1],t}function Fe(t,e,i){var n=i[0],r=i[1];return t[0]=e[0]*n,t[1]=e[1]*r,t[2]=e[2]*n,t[3]=e[3]*r,t[4]=e[4]*n,t[5]=e[5]*r,t}function Ne(t,e){var i=e[0],n=e[2],r=e[4],o=e[1],a=e[3],s=e[5],l=i*a-o*n;return l?(l=1/l,t[0]=a*l,t[1]=-o*l,t[2]=-n*l,t[3]=i*l,t[4]=(n*s-a*r)*l,t[5]=(o*r-i*s)*l,t):null}function He(t){var e=Me();return Le(e,t),e}var We=Object.freeze({__proto__:null,create:Me,identity:Ae,copy:Le,mul:ze,translate:je,rotate:Be,scale:Fe,invert:Ne,clone:He}),Ve=function(){function t(t,e){this.x=t||0,this.y=e||0}return t.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this},t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.set=function(t,e){return this.x=t,this.y=e,this},t.prototype.equal=function(t){return t.x===this.x&&t.y===this.y},t.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this},t.prototype.scale=function(t){this.x*=t,this.y*=t},t.prototype.scaleAndAdd=function(t,e){this.x+=t.x*e,this.y+=t.y*e},t.prototype.sub=function(t){return this.x-=t.x,this.y-=t.y,this},t.prototype.dot=function(t){return this.x*t.x+this.y*t.y},t.prototype.len=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},t.prototype.lenSquare=function(){return this.x*this.x+this.y*this.y},t.prototype.normalize=function(){var t=this.len();return this.x/=t,this.y/=t,this},t.prototype.distance=function(t){var e=this.x-t.x,i=this.y-t.y;return Math.sqrt(e*e+i*i)},t.prototype.distanceSquare=function(t){var e=this.x-t.x,i=this.y-t.y;return e*e+i*i},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},t.prototype.transform=function(t){if(t){var e=this.x,i=this.y;return this.x=t[0]*e+t[2]*i+t[4],this.y=t[1]*e+t[3]*i+t[5],this}},t.prototype.toArray=function(t){return t[0]=this.x,t[1]=this.y,t},t.prototype.fromArray=function(t){this.x=t[0],this.y=t[1]},t.set=function(t,e,i){t.x=e,t.y=i},t.copy=function(t,e){t.x=e.x,t.y=e.y},t.len=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},t.lenSquare=function(t){return t.x*t.x+t.y*t.y},t.dot=function(t,e){return t.x*e.x+t.y*e.y},t.add=function(t,e,i){t.x=e.x+i.x,t.y=e.y+i.y},t.sub=function(t,e,i){t.x=e.x-i.x,t.y=e.y-i.y},t.scale=function(t,e,i){t.x=e.x*i,t.y=e.y*i},t.scaleAndAdd=function(t,e,i,n){t.x=e.x+i.x*n,t.y=e.y+i.y*n},t.lerp=function(t,e,i,n){var r=1-n;t.x=r*e.x+n*i.x,t.y=r*e.y+n*i.y},t}(),Ue=Math.min,Ge=Math.max,qe=Math.abs,Ze=["x","y"],Xe=["width","height"],Ye=new Ve,$e=new Ve,Ke=new Ve,Qe=new Ve,Je=si(),ti=Je.minTv,ei=Je.maxTv,ii=[0,0],ni=function(){function t(e,i,n,r){t.set(this,e,i,n,r)}return t.set=function(t,e,i,n,r){return n<0&&(e+=n,n=-n),r<0&&(i+=r,r=-r),t.x=e,t.y=i,t.width=n,t.height=r,t},t.prototype.union=function(t){var e=Ue(t.x,this.x),i=Ue(t.y,this.y);isFinite(this.x)&&isFinite(this.width)?this.width=Ge(t.x+t.width,this.x+this.width)-e:this.width=t.width,isFinite(this.y)&&isFinite(this.height)?this.height=Ge(t.y+t.height,this.y+this.height)-i:this.height=t.height,this.x=e,this.y=i},t.prototype.applyTransform=function(e){t.applyTransform(this,this,e)},t.prototype.calculateTransform=function(t){var e=this,i=t.width/e.width,n=t.height/e.height,r=Me();return je(r,r,[-e.x,-e.y]),Fe(r,r,[i,n]),je(r,r,[t.x,t.y]),r},t.prototype.intersect=function(e,i,n){return t.intersect(this,e,i,n)},t.intersect=function(e,i,n,r){n&&Ve.set(n,0,0);var o=r&&r.outIntersectRect||null,a=r&&r.clamp;if(o&&(o.x=o.y=o.width=o.height=NaN),!e||!i)return!1;e instanceof t||(e=t.set(ri,e.x,e.y,e.width,e.height)),i instanceof t||(i=t.set(oi,i.x,i.y,i.width,i.height));var s=!!n;Je.reset(r,s);var l=Je.touchThreshold,h=e.x+l,u=e.x+e.width-l,c=e.y+l,p=e.y+e.height-l,f=i.x+l,d=i.x+i.width-l,v=i.y+l,g=i.y+i.height-l;if(h>u||c>p||f>d||v>g)return!1;var y=!(u<f||d<h||p<v||g<c);return(s||o)&&(ii[0]=1/0,ii[1]=0,ai(h,u,f,d,0,s,o,a),ai(c,p,v,g,1,s,o,a),s&&Ve.copy(n,y?Je.useDir?Je.dirMinTv:ti:ei)),y},t.contain=function(t,e,i){return e>=t.x&&e<=t.x+t.width&&i>=t.y&&i<=t.y+t.height},t.prototype.contain=function(e,i){return t.contain(this,e,i)},t.prototype.clone=function(){return new t(this.x,this.y,this.width,this.height)},t.prototype.copy=function(e){t.copy(this,e)},t.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},t.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},t.prototype.isZero=function(){return 0===this.width||0===this.height},t.create=function(e){return new t(e.x,e.y,e.width,e.height)},t.copy=function(t,e){return t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height,t},t.applyTransform=function(e,i,n){if(n){if(n[1]<1e-5&&n[1]>-1e-5&&n[2]<1e-5&&n[2]>-1e-5){var r=n[0],o=n[3],a=n[4],s=n[5];return e.x=i.x*r+a,e.y=i.y*o+s,e.width=i.width*r,e.height=i.height*o,e.width<0&&(e.x+=e.width,e.width=-e.width),void(e.height<0&&(e.y+=e.height,e.height=-e.height))}Ye.x=Ke.x=i.x,Ye.y=Qe.y=i.y,$e.x=Qe.x=i.x+i.width,$e.y=Ke.y=i.y+i.height,Ye.transform(n),Qe.transform(n),$e.transform(n),Ke.transform(n),e.x=Ue(Ye.x,$e.x,Ke.x,Qe.x),e.y=Ue(Ye.y,$e.y,Ke.y,Qe.y);var l=Ge(Ye.x,$e.x,Ke.x,Qe.x),h=Ge(Ye.y,$e.y,Ke.y,Qe.y);e.width=l-e.x,e.height=h-e.y}else e!==i&&t.copy(e,i)},t}(),ri=new ni(0,0,0,0),oi=new ni(0,0,0,0);function ai(t,e,i,n,r,o,a,s){var l=qe(e-i),h=qe(n-t),u=Ue(l,h),c=Ze[r],p=Ze[1-r],f=Xe[r];e<i||n<t?l<h?(o&&(ei[c]=-l),s&&(a[c]=e,a[f]=0)):(o&&(ei[c]=h),s&&(a[c]=t,a[f]=0)):(a&&(a[c]=Ge(t,i),a[f]=Ue(e,n)-a[c]),o&&(u<ii[0]||Je.useDir)&&(ii[0]=Ue(u,ii[0]),(l<h||!Je.bidirectional)&&(ti[c]=l,ti[p]=0,Je.useDir&&Je.calcDirMTV()),(l>=h||!Je.bidirectional)&&(ti[c]=-h,ti[p]=0,Je.useDir&&Je.calcDirMTV())))}function si(){var t=0,e=new Ve,i=new Ve,n={minTv:new Ve,maxTv:new Ve,useDir:!1,dirMinTv:new Ve,touchThreshold:0,bidirectional:!0,negativeSize:!1,reset:function(r,o){n.touchThreshold=0,r&&null!=r.touchThreshold&&(n.touchThreshold=Ge(0,r.touchThreshold)),n.negativeSize=!1,o&&(n.minTv.set(1/0,1/0),n.maxTv.set(0,0),n.useDir=!1,r&&null!=r.direction&&(n.useDir=!0,n.dirMinTv.copy(n.minTv),i.copy(n.minTv),t=r.direction,n.bidirectional=null==r.bidirectional||!!r.bidirectional,n.bidirectional||e.set(Math.cos(t),Math.sin(t))))},calcDirMTV:function(){var o=n.minTv,a=n.dirMinTv,s=o.y*o.y+o.x*o.x,l=Math.sin(t),h=Math.cos(t),u=l*o.y+h*o.x;r(u)?r(o.x)&&r(o.y)&&a.set(0,0):(i.x=s*h/u,i.y=s*l/u,r(i.x)&&r(i.y)?a.set(0,0):(n.bidirectional||e.dot(i)>0)&&i.len()<a.len()&&a.copy(i))}};function r(t){return qe(t)<1e-10}return n}var li="silent";function hi(t,e,i){return{type:t,event:i,target:e.target,topTarget:e.topTarget,cancelBubble:!1,offsetX:i.zrX,offsetY:i.zrY,gestureEvent:i.gestureEvent,pinchX:i.pinchX,pinchY:i.pinchY,pinchScale:i.pinchScale,wheelDelta:i.zrDelta,zrByTouch:i.zrByTouch,which:i.which,stop:ui}}function ui(){Oe(this.event)}var ci=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.handler=null,e}return It(e,t),e.prototype.dispose=function(){},e.prototype.setCursor=function(){},e}(ae),pi=function(){function t(t,e){this.x=t,this.y=e}return t}(),fi=["click","dblclick","mousewheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],di=new ni(0,0,0,0),vi=function(t){function e(e,i,n,r,o){var a=t.call(this)||this;return a._hovered=new pi(0,0),a.storage=e,a.painter=i,a.painterRoot=r,a._pointerSize=o,n=n||new ci,a.proxy=null,a.setHandlerProxy(n),a._draggingMgr=new oe(a),a}return It(e,t),e.prototype.setHandlerProxy=function(t){this.proxy&&this.proxy.dispose(),t&&(F(fi,function(e){t.on&&t.on(e,this[e],this)},this),t.handler=this),this.proxy=t},e.prototype.mousemove=function(t){var e=t.zrX,i=t.zrY,n=mi(this,e,i),r=this._hovered,o=r.target;o&&!o.__zr&&(o=(r=this.findHover(r.x,r.y)).target);var a=this._hovered=n?new pi(e,i):this.findHover(e,i),s=a.target,l=this.proxy;l.setCursor&&l.setCursor(s?s.cursor:"default"),o&&s!==o&&this.dispatchToElement(r,"mouseout",t),this.dispatchToElement(a,"mousemove",t),s&&s!==o&&this.dispatchToElement(a,"mouseover",t)},e.prototype.mouseout=function(t){var e=t.zrEventControl;"only_globalout"!==e&&this.dispatchToElement(this._hovered,"mouseout",t),"no_globalout"!==e&&this.trigger("globalout",{type:"globalout",event:t})},e.prototype.resize=function(){this._hovered=new pi(0,0)},e.prototype.dispatch=function(t,e){var i=this[t];i&&i.call(this,e)},e.prototype.dispose=function(){this.proxy.dispose(),this.storage=null,this.proxy=null,this.painter=null},e.prototype.setCursorStyle=function(t){var e=this.proxy;e.setCursor&&e.setCursor(t)},e.prototype.dispatchToElement=function(t,e,i){var n=(t=t||{}).target;if(!n||!n.silent){for(var r="on"+e,o=hi(e,t,i);n&&(n[r]&&(o.cancelBubble=!!n[r].call(n,o)),n.trigger(e,o),n=n.__hostTarget?n.__hostTarget:n.parent,!o.cancelBubble););o.cancelBubble||(this.trigger(e,o),this.painter&&this.painter.eachOtherLayer&&this.painter.eachOtherLayer(function(t){"function"==typeof t[r]&&t[r].call(t,o),t.trigger&&t.trigger(e,o)}))}},e.prototype.findHover=function(t,e,i){var n=this.storage.getDisplayList(),r=new pi(t,e);if(yi(n,r,t,e,i),this._pointerSize&&!r.target){for(var o=[],a=this._pointerSize,s=a/2,l=new ni(t-s,e-s,a,a),h=n.length-1;h>=0;h--){var u=n[h];u===i||u.ignore||u.ignoreCoarsePointer||u.parent&&u.parent.ignoreCoarsePointer||(di.copy(u.getBoundingRect()),u.transform&&di.applyTransform(u.transform),di.intersect(l)&&o.push(u))}if(o.length)for(var c=4,p=Math.PI/12,f=2*Math.PI,d=0;d<s;d+=c)for(var v=0;v<f;v+=p)if(yi(o,r,t+d*Math.cos(v),e+d*Math.sin(v),i),r.target)return r}return r},e.prototype.processGesture=function(t,e){this._gestureMgr||(this._gestureMgr=new Re);var i=this._gestureMgr;"start"===e&&i.clear();var n=i.recognize(t,this.findHover(t.zrX,t.zrY,null).target,this.proxy.dom);if("end"===e&&i.clear(),n){var r=n.type;t.gestureEvent=r;var o=new pi;o.target=n.target,this.dispatchToElement(o,r,n.event)}},e}(ae);function gi(t,e,i){if(t[t.rectHover?"rectContain":"contain"](e,i)){for(var n=t,r=void 0,o=!1;n;){if(n.ignoreClip&&(o=!0),!o){var a=n.getClipPath();if(a&&!a.contain(e,i))return!1}n.silent&&(r=!0);var s=n.__hostTarget;n=s?n.ignoreHostSilent?null:s:n.parent}return!r||li}return!1}function yi(t,e,i,n,r){for(var o=t.length-1;o>=0;o--){var a=t[o],s=void 0;if(a!==r&&!a.ignore&&(s=gi(a,i,n))&&(!e.topTarget&&(e.topTarget=a),s!==li)){e.target=a;break}}}function mi(t,e,i){var n=t.painter;return e<0||e>n.getWidth()||i<0||i>n.getHeight()}F(["click","mousedown","mouseup","mousewheel","dblclick","contextmenu"],function(t){vi.prototype[t]=function(e){var i,n,r=e.zrX,o=e.zrY,a=mi(this,r,o);if("mouseup"===t&&a||(n=(i=this.findHover(r,o)).target),"mousedown"===t)this._downEl=n,this._downPoint=[e.zrX,e.zrY],this._upEl=n;else if("mouseup"===t)this._upEl=n;else if("click"===t){if(this._downEl!==this._upEl||!this._downPoint||Yt(this._downPoint,[e.zrX,e.zrY])>4)return;this._downPoint=null}this.dispatchToElement(i,t,e)}});var wi=32,xi=7;function bi(t){for(var e=0;t>=wi;)e|=1&t,t>>=1;return t+e}function _i(t,e,i,n){var r=e+1;if(r===i)return 1;if(n(t[r++],t[e])<0){for(;r<i&&n(t[r],t[r-1])<0;)r++;Ti(t,e,r)}else for(;r<i&&n(t[r],t[r-1])>=0;)r++;return r-e}function Ti(t,e,i){for(i--;e<i;){var n=t[e];t[e++]=t[i],t[i--]=n}}function Si(t,e,i,n,r){for(n===e&&n++;n<i;n++){for(var o,a=t[n],s=e,l=n;s<l;)r(a,t[o=s+l>>>1])<0?l=o:s=o+1;var h=n-s;switch(h){case 3:t[s+3]=t[s+2];case 2:t[s+2]=t[s+1];case 1:t[s+1]=t[s];break;default:for(;h>0;)t[s+h]=t[s+h-1],h--}t[s]=a}}function Pi(t,e,i,n,r,o){var a=0,s=0,l=1;if(o(t,e[i+r])>0){for(s=n-r;l<s&&o(t,e[i+r+l])>0;)a=l,(l=1+(l<<1))<=0&&(l=s);l>s&&(l=s),a+=r,l+=r}else{for(s=r+1;l<s&&o(t,e[i+r-l])<=0;)a=l,(l=1+(l<<1))<=0&&(l=s);l>s&&(l=s);var h=a;a=r-l,l=r-h}for(a++;a<l;){var u=a+(l-a>>>1);o(t,e[i+u])>0?a=u+1:l=u}return l}function Ei(t,e,i,n,r,o){var a=0,s=0,l=1;if(o(t,e[i+r])<0){for(s=r+1;l<s&&o(t,e[i+r-l])<0;)a=l,(l=1+(l<<1))<=0&&(l=s);l>s&&(l=s);var h=a;a=r-l,l=r-h}else{for(s=n-r;l<s&&o(t,e[i+r+l])>=0;)a=l,(l=1+(l<<1))<=0&&(l=s);l>s&&(l=s),a+=r,l+=r}for(a++;a<l;){var u=a+(l-a>>>1);o(t,e[i+u])<0?l=u:a=u+1}return l}function Ci(t,e){var i,n,r=xi,o=0,a=[];function s(t,e){i[o]=t,n[o]=e,o+=1}function l(){for(;o>1;){var t=o-2;if(t>=1&&n[t-1]<=n[t]+n[t+1]||t>=2&&n[t-2]<=n[t]+n[t-1])n[t-1]<n[t+1]&&t--;else if(n[t]>n[t+1])break;u(t)}}function h(){for(;o>1;){var t=o-2;t>0&&n[t-1]<n[t+1]&&t--,u(t)}}function u(r){var a=i[r],s=n[r],l=i[r+1],h=n[r+1];n[r]=s+h,r===o-3&&(i[r+1]=i[r+2],n[r+1]=n[r+2]),o--;var u=Ei(t[l],t,a,s,0,e);a+=u,0!==(s-=u)&&0!==(h=Pi(t[a+s-1],t,l,h,h-1,e))&&(s<=h?c(a,s,l,h):p(a,s,l,h))}function c(i,n,o,s){var l=0;for(l=0;l<n;l++)a[l]=t[i+l];var h=0,u=o,c=i;if(t[c++]=t[u++],0!==--s)if(1!==n){for(var p,f,d,v=r;;){p=0,f=0,d=!1;do{if(e(t[u],a[h])<0){if(t[c++]=t[u++],f++,p=0,0===--s){d=!0;break}}else if(t[c++]=a[h++],p++,f=0,1===--n){d=!0;break}}while((p|f)<v);if(d)break;do{if(0!==(p=Ei(t[u],a,h,n,0,e))){for(l=0;l<p;l++)t[c+l]=a[h+l];if(c+=p,h+=p,(n-=p)<=1){d=!0;break}}if(t[c++]=t[u++],0===--s){d=!0;break}if(0!==(f=Pi(a[h],t,u,s,0,e))){for(l=0;l<f;l++)t[c+l]=t[u+l];if(c+=f,u+=f,0===(s-=f)){d=!0;break}}if(t[c++]=a[h++],1===--n){d=!0;break}v--}while(p>=xi||f>=xi);if(d)break;v<0&&(v=0),v+=2}if((r=v)<1&&(r=1),1===n){for(l=0;l<s;l++)t[c+l]=t[u+l];t[c+s]=a[h]}else{if(0===n)throw new Error;for(l=0;l<n;l++)t[c+l]=a[h+l]}}else{for(l=0;l<s;l++)t[c+l]=t[u+l];t[c+s]=a[h]}else for(l=0;l<n;l++)t[c+l]=a[h+l]}function p(i,n,o,s){var l=0;for(l=0;l<s;l++)a[l]=t[o+l];var h=i+n-1,u=s-1,c=o+s-1,p=0,f=0;if(t[c--]=t[h--],0!==--n)if(1!==s){for(var d=r;;){var v=0,g=0,y=!1;do{if(e(a[u],t[h])<0){if(t[c--]=t[h--],v++,g=0,0===--n){y=!0;break}}else if(t[c--]=a[u--],g++,v=0,1===--s){y=!0;break}}while((v|g)<d);if(y)break;do{if(0!==(v=n-Ei(a[u],t,i,n,n-1,e))){for(n-=v,f=1+(c-=v),p=1+(h-=v),l=v-1;l>=0;l--)t[f+l]=t[p+l];if(0===n){y=!0;break}}if(t[c--]=a[u--],1===--s){y=!0;break}if(0!==(g=s-Pi(t[h],a,0,s,s-1,e))){for(s-=g,f=1+(c-=g),p=1+(u-=g),l=0;l<g;l++)t[f+l]=a[p+l];if(s<=1){y=!0;break}}if(t[c--]=t[h--],0===--n){y=!0;break}d--}while(v>=xi||g>=xi);if(y)break;d<0&&(d=0),d+=2}if((r=d)<1&&(r=1),1===s){for(f=1+(c-=n),p=1+(h-=n),l=n-1;l>=0;l--)t[f+l]=t[p+l];t[c]=a[u]}else{if(0===s)throw new Error;for(p=c-(s-1),l=0;l<s;l++)t[p+l]=a[l]}}else{for(f=1+(c-=n),p=1+(h-=n),l=n-1;l>=0;l--)t[f+l]=t[p+l];t[c]=a[u]}else for(p=c-(s-1),l=0;l<s;l++)t[p+l]=a[l]}return i=[],n=[],{mergeRuns:l,forceMergeRuns:h,pushRun:s}}function Oi(t,e,i,n){i||(i=0),n||(n=t.length);var r=n-i;if(!(r<2)){var o=0;if(r<wi)Si(t,i,n,i+(o=_i(t,i,n,e)),e);else{var a=Ci(t,e),s=bi(r);do{if((o=_i(t,i,n,e))<s){var l=r;l>s&&(l=s),Si(t,i,i+l,i+o,e),o=l}a.pushRun(i,o),a.mergeRuns(),r-=o,i+=o}while(0!==r);a.forceMergeRuns()}}}var Ri=1,ki=2,Ii=4,Di=!1;function Mi(){Di||(Di=!0)}function Ai(t,e){return t.zlevel===e.zlevel?t.z===e.z?t.z2-e.z2:t.z-e.z:t.zlevel-e.zlevel}var Li=function(){function t(){this._roots=[],this._displayList=[],this._displayListLen=0,this.displayableSortFunc=Ai}return t.prototype.traverse=function(t,e){for(var i=0;i<this._roots.length;i++)this._roots[i].traverse(t,e)},t.prototype.getDisplayList=function(t,e){e=e||!1;var i=this._displayList;return!t&&i.length||this.updateDisplayList(e),i},t.prototype.updateDisplayList=function(t){this._displayListLen=0;for(var e=this._roots,i=this._displayList,n=0,r=e.length;n<r;n++)this._updateAndAddDisplayable(e[n],null,t);i.length=this._displayListLen,Oi(i,Ai)},t.prototype._updateAndAddDisplayable=function(t,e,i){if(!t.ignore||i){t.beforeUpdate(),t.update(),t.afterUpdate();var n=t.getClipPath(),r=e&&e.length,o=0,a=t.__clipPaths;if(!t.ignoreClip&&(r||n)){if(a||(a=t.__clipPaths=[]),r)for(var s=0;s<e.length;s++)a[o++]=e[s];for(var l=n,h=t;l;)l.parent=h,l.updateTransform(),a[o++]=l,h=l,l=l.getClipPath()}if(a&&(a.length=o),t.childrenRef){for(var u=t.childrenRef(),c=0;c<u.length;c++){var p=u[c];t.__dirty&&(p.__dirty|=Ri),this._updateAndAddDisplayable(p,a,i)}t.__dirty=0}else{var f=t;isNaN(f.z)&&(Mi(),f.z=0),isNaN(f.z2)&&(Mi(),f.z2=0),isNaN(f.zlevel)&&(Mi(),f.zlevel=0),this._displayList[this._displayListLen++]=f}var d=t.getDecalElement&&t.getDecalElement();d&&this._updateAndAddDisplayable(d,a,i);var v=t.getTextGuideLine();v&&this._updateAndAddDisplayable(v,a,i);var g=t.getTextContent();g&&this._updateAndAddDisplayable(g,a,i)}},t.prototype.addRoot=function(t){t.__zr&&t.__zr.storage===this||this._roots.push(t)},t.prototype.delRoot=function(t){if(t instanceof Array)for(var e=0,i=t.length;e<i;e++)this.delRoot(t[e]);else{var n=L(this._roots,t);n>=0&&this._roots.splice(n,1)}},t.prototype.delAllRoots=function(){this._roots=[],this._displayList=[],this._displayListLen=0},t.prototype.getRoots=function(){return this._roots},t.prototype.dispose=function(){this._displayList=null,this._roots=null},t}(),zi=i.hasGlobalWindow&&(window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.msRequestAnimationFrame&&window.msRequestAnimationFrame.bind(window)||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame)||function(t){return setTimeout(t,16)},ji={linear:function(t){return t},quadraticIn:function(t){return t*t},quadraticOut:function(t){return t*(2-t)},quadraticInOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)},cubicIn:function(t){return t*t*t},cubicOut:function(t){return--t*t*t+1},cubicInOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},quarticIn:function(t){return t*t*t*t},quarticOut:function(t){return 1- --t*t*t*t},quarticInOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},quinticIn:function(t){return t*t*t*t*t},quinticOut:function(t){return--t*t*t*t*t+1},quinticInOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},sinusoidalIn:function(t){return 1-Math.cos(t*Math.PI/2)},sinusoidalOut:function(t){return Math.sin(t*Math.PI/2)},sinusoidalInOut:function(t){return.5*(1-Math.cos(Math.PI*t))},exponentialIn:function(t){return 0===t?0:Math.pow(1024,t-1)},exponentialOut:function(t){return 1===t?1:1-Math.pow(2,-10*t)},exponentialInOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))},circularIn:function(t){return 1-Math.sqrt(1-t*t)},circularOut:function(t){return Math.sqrt(1- --t*t)},circularInOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},elasticIn:function(t){var e,i=.1,n=.4;return 0===t?0:1===t?1:(!i||i<1?(i=1,e=n/4):e=n*Math.asin(1/i)/(2*Math.PI),-i*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n))},elasticOut:function(t){var e,i=.1,n=.4;return 0===t?0:1===t?1:(!i||i<1?(i=1,e=n/4):e=n*Math.asin(1/i)/(2*Math.PI),i*Math.pow(2,-10*t)*Math.sin((t-e)*(2*Math.PI)/n)+1)},elasticInOut:function(t){var e,i=.1,n=.4;return 0===t?0:1===t?1:(!i||i<1?(i=1,e=n/4):e=n*Math.asin(1/i)/(2*Math.PI),(t*=2)<1?i*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n)*-.5:i*Math.pow(2,-10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n)*.5+1)},backIn:function(t){var e=1.70158;return t*t*((e+1)*t-e)},backOut:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},backInOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)},bounceIn:function(t){return 1-ji.bounceOut(1-t)},bounceOut:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},bounceInOut:function(t){return t<.5?.5*ji.bounceIn(2*t):.5*ji.bounceOut(2*t-1)+.5}},Bi=Math.pow,Fi=Math.sqrt,Ni=1e-8,Hi=1e-4,Wi=Fi(3),Vi=1/3,Ui=Dt(),Gi=Dt(),qi=Dt();function Zi(t){return t>-Ni&&t<Ni}function Xi(t){return t>Ni||t<-Ni}function Yi(t,e,i,n,r){var o=1-r;return o*o*(o*t+3*r*e)+r*r*(r*n+3*o*i)}function $i(t,e,i,n,r){var o=1-r;return 3*(((e-t)*o+2*(i-e)*r)*o+(n-i)*r*r)}function Ki(t,e,i,n,r,o){var a=n+3*(e-i)-t,s=3*(i-2*e+t),l=3*(e-t),h=t-r,u=s*s-3*a*l,c=s*l-9*a*h,p=l*l-3*s*h,f=0;if(Zi(u)&&Zi(c))Zi(s)?o[0]=0:(S=-l/s)>=0&&S<=1&&(o[f++]=S);else{var d=c*c-4*u*p;if(Zi(d)){var v=c/u,g=-v/2;(S=-s/a+v)>=0&&S<=1&&(o[f++]=S),g>=0&&g<=1&&(o[f++]=g)}else if(d>0){var y=Fi(d),m=u*s+1.5*a*(-c+y),w=u*s+1.5*a*(-c-y);(S=(-s-((m=m<0?-Bi(-m,Vi):Bi(m,Vi))+(w=w<0?-Bi(-w,Vi):Bi(w,Vi))))/(3*a))>=0&&S<=1&&(o[f++]=S)}else{var x=(2*u*s-3*a*c)/(2*Fi(u*u*u)),b=Math.acos(x)/3,_=Fi(u),T=Math.cos(b),S=(-s-2*_*T)/(3*a),P=(g=(-s+_*(T+Wi*Math.sin(b)))/(3*a),(-s+_*(T-Wi*Math.sin(b)))/(3*a));S>=0&&S<=1&&(o[f++]=S),g>=0&&g<=1&&(o[f++]=g),P>=0&&P<=1&&(o[f++]=P)}}return f}function Qi(t,e,i,n,r){var o=6*i-12*e+6*t,a=9*e+3*n-3*t-9*i,s=3*e-3*t,l=0;if(Zi(a))Xi(o)&&(u=-s/o)>=0&&u<=1&&(r[l++]=u);else{var h=o*o-4*a*s;if(Zi(h))r[0]=-o/(2*a);else if(h>0){var u,c=Fi(h),p=(-o-c)/(2*a);(u=(-o+c)/(2*a))>=0&&u<=1&&(r[l++]=u),p>=0&&p<=1&&(r[l++]=p)}}return l}function Ji(t,e,i,n,r,o){var a=(e-t)*r+t,s=(i-e)*r+e,l=(n-i)*r+i,h=(s-a)*r+a,u=(l-s)*r+s,c=(u-h)*r+h;o[0]=t,o[1]=a,o[2]=h,o[3]=c,o[4]=c,o[5]=u,o[6]=l,o[7]=n}function tn(t,e,i,n,r,o,a,s,l,h,u){var c,p,f,d,v,g=.005,y=1/0;Ui[0]=l,Ui[1]=h;for(var m=0;m<1;m+=.05)Gi[0]=Yi(t,i,r,a,m),Gi[1]=Yi(e,n,o,s,m),(d=Kt(Ui,Gi))<y&&(c=m,y=d);y=1/0;for(var w=0;w<32&&!(g<Hi);w++)p=c-g,f=c+g,Gi[0]=Yi(t,i,r,a,p),Gi[1]=Yi(e,n,o,s,p),d=Kt(Gi,Ui),p>=0&&d<y?(c=p,y=d):(qi[0]=Yi(t,i,r,a,f),qi[1]=Yi(e,n,o,s,f),v=Kt(qi,Ui),f<=1&&v<y?(c=f,y=v):g*=.5);return u&&(u[0]=Yi(t,i,r,a,c),u[1]=Yi(e,n,o,s,c)),Fi(y)}function en(t,e,i,n,r,o,a,s,l){for(var h=t,u=e,c=0,p=1/l,f=1;f<=l;f++){var d=f*p,v=Yi(t,i,r,a,d),g=Yi(e,n,o,s,d),y=v-h,m=g-u;c+=Math.sqrt(y*y+m*m),h=v,u=g}return c}function nn(t,e,i,n){var r=1-n;return r*(r*t+2*n*e)+n*n*i}function rn(t,e,i,n){return 2*((1-n)*(e-t)+n*(i-e))}function on(t,e,i,n,r){var o=t-2*e+i,a=2*(e-t),s=t-n,l=0;if(Zi(o))Xi(a)&&(u=-s/a)>=0&&u<=1&&(r[l++]=u);else{var h=a*a-4*o*s;if(Zi(h))(u=-a/(2*o))>=0&&u<=1&&(r[l++]=u);else if(h>0){var u,c=Fi(h),p=(-a-c)/(2*o);(u=(-a+c)/(2*o))>=0&&u<=1&&(r[l++]=u),p>=0&&p<=1&&(r[l++]=p)}}return l}function an(t,e,i){var n=t+i-2*e;return 0===n?.5:(t-e)/n}function sn(t,e,i,n,r){var o=(e-t)*n+t,a=(i-e)*n+e,s=(a-o)*n+o;r[0]=t,r[1]=o,r[2]=s,r[3]=s,r[4]=a,r[5]=i}function ln(t,e,i,n,r,o,a,s,l){var h,u=.005,c=1/0;Ui[0]=a,Ui[1]=s;for(var p=0;p<1;p+=.05)Gi[0]=nn(t,i,r,p),Gi[1]=nn(e,n,o,p),(g=Kt(Ui,Gi))<c&&(h=p,c=g);c=1/0;for(var f=0;f<32&&!(u<Hi);f++){var d=h-u,v=h+u;Gi[0]=nn(t,i,r,d),Gi[1]=nn(e,n,o,d);var g=Kt(Gi,Ui);if(d>=0&&g<c)h=d,c=g;else{qi[0]=nn(t,i,r,v),qi[1]=nn(e,n,o,v);var y=Kt(qi,Ui);v<=1&&y<c?(h=v,c=y):u*=.5}}return l&&(l[0]=nn(t,i,r,h),l[1]=nn(e,n,o,h)),Fi(c)}function hn(t,e,i,n,r,o,a){for(var s=t,l=e,h=0,u=1/a,c=1;c<=a;c++){var p=c*u,f=nn(t,i,r,p),d=nn(e,n,o,p),v=f-s,g=d-l;h+=Math.sqrt(v*v+g*g),s=f,l=d}return h}var un=/cubic-bezier\(([0-9,\.e ]+)\)/;function cn(t){var e=t&&un.exec(t);if(e){var i=e[1].split(","),n=+ft(i[0]),r=+ft(i[1]),o=+ft(i[2]),a=+ft(i[3]);if(isNaN(n+r+o+a))return;var s=[];return function(t){return t<=0?0:t>=1?1:Ki(0,n,o,1,t,s)&&Yi(0,r,a,1,s[0])}}}var pn=function(){function t(t){this._inited=!1,this._startTime=0,this._pausedTime=0,this._paused=!1,this._life=t.life||1e3,this._delay=t.delay||0,this.loop=t.loop||!1,this.onframe=t.onframe||Et,this.ondestroy=t.ondestroy||Et,this.onrestart=t.onrestart||Et,t.easing&&this.setEasing(t.easing)}return t.prototype.step=function(t,e){if(this._inited||(this._startTime=t+this._delay,this._inited=!0),!this._paused){var i=this._life,n=t-this._startTime-this._pausedTime,r=n/i;r<0&&(r=0),r=Math.min(r,1);var o=this.easingFunc,a=o?o(r):r;if(this.onframe(a),1===r){if(!this.loop)return!0;var s=n%i;this._startTime=t-s,this._pausedTime=0,this.onrestart()}return!1}this._pausedTime+=e},t.prototype.pause=function(){this._paused=!0},t.prototype.resume=function(){this._paused=!1},t.prototype.setEasing=function(t){this.easing=t,this.easingFunc=Y(t)?t:ji[t]||cn(t)},t}(),fn=function(){function t(t){this.value=t}return t}(),dn=function(){function t(){this._len=0}return t.prototype.insert=function(t){var e=new fn(t);return this.insertEntry(e),e},t.prototype.insertEntry=function(t){this.head?(this.tail.next=t,t.prev=this.tail,t.next=null,this.tail=t):this.head=this.tail=t,this._len++},t.prototype.remove=function(t){var e=t.prev,i=t.next;e?e.next=i:this.head=i,i?i.prev=e:this.tail=e,t.next=t.prev=null,this._len--},t.prototype.len=function(){return this._len},t.prototype.clear=function(){this.head=this.tail=null,this._len=0},t}(),vn=function(){function t(t){this._list=new dn,this._maxSize=10,this._map={},this._maxSize=t}return t.prototype.put=function(t,e){var i=this._list,n=this._map,r=null;if(null==n[t]){var o=i.len(),a=this._lastRemovedEntry;if(o>=this._maxSize&&o>0){var s=i.head;i.remove(s),delete n[s.key],r=s.value,this._lastRemovedEntry=s}a?a.value=e:a=new fn(e),a.key=t,i.insertEntry(a),n[t]=a}return r},t.prototype.get=function(t){var e=this._map[t],i=this._list;if(null!=e)return e!==i.tail&&(i.remove(e),i.insertEntry(e)),e.value},t.prototype.clear=function(){this._list.clear(),this._map={}},t.prototype.len=function(){return this._list.len()},t}(),gn={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function yn(t){return(t=Math.round(t))<0?0:t>255?255:t}function mn(t){return(t=Math.round(t))<0?0:t>360?360:t}function wn(t){return t<0?0:t>1?1:t}function xn(t){var e=t;return e.length&&"%"===e.charAt(e.length-1)?yn(parseFloat(e)/100*255):yn(parseInt(e,10))}function bn(t){var e=t;return e.length&&"%"===e.charAt(e.length-1)?wn(parseFloat(e)/100):wn(parseFloat(e))}function _n(t,e,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?t+(e-t)*i*6:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}function Tn(t,e,i){return t+(e-t)*i}function Sn(t,e,i,n,r){return t[0]=e,t[1]=i,t[2]=n,t[3]=r,t}function Pn(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}var En=new vn(20),Cn=null;function On(t,e){Cn&&Pn(Cn,e),Cn=En.put(t,Cn||e.slice())}function Rn(t,e){if(t){e=e||[];var i=En.get(t);if(i)return Pn(e,i);var n=(t+="").replace(/ /g,"").toLowerCase();if(n in gn)return Pn(e,gn[n]),On(t,e),e;var r,o=n.length;if("#"===n.charAt(0))return 4===o||5===o?(r=parseInt(n.slice(1,4),16))>=0&&r<=4095?(Sn(e,(3840&r)>>4|(3840&r)>>8,240&r|(240&r)>>4,15&r|(15&r)<<4,5===o?parseInt(n.slice(4),16)/15:1),On(t,e),e):void Sn(e,0,0,0,1):7===o||9===o?(r=parseInt(n.slice(1,7),16))>=0&&r<=16777215?(Sn(e,(16711680&r)>>16,(65280&r)>>8,255&r,9===o?parseInt(n.slice(7),16)/255:1),On(t,e),e):void Sn(e,0,0,0,1):void 0;var a=n.indexOf("("),s=n.indexOf(")");if(-1!==a&&s+1===o){var l=n.substr(0,a),h=n.substr(a+1,s-(a+1)).split(","),u=1;switch(l){case"rgba":if(4!==h.length)return 3===h.length?Sn(e,+h[0],+h[1],+h[2],1):Sn(e,0,0,0,1);u=bn(h.pop());case"rgb":return h.length>=3?(Sn(e,xn(h[0]),xn(h[1]),xn(h[2]),3===h.length?u:bn(h[3])),On(t,e),e):void Sn(e,0,0,0,1);case"hsla":return 4!==h.length?void Sn(e,0,0,0,1):(h[3]=bn(h[3]),kn(h,e),On(t,e),e);case"hsl":return 3!==h.length?void Sn(e,0,0,0,1):(kn(h,e),On(t,e),e);default:return}}Sn(e,0,0,0,1)}}function kn(t,e){var i=(parseFloat(t[0])%360+360)%360/360,n=bn(t[1]),r=bn(t[2]),o=r<=.5?r*(n+1):r+n-r*n,a=2*r-o;return Sn(e=e||[],yn(255*_n(a,o,i+1/3)),yn(255*_n(a,o,i)),yn(255*_n(a,o,i-1/3)),1),4===t.length&&(e[3]=t[3]),e}function In(t){if(t){var e,i,n=t[0]/255,r=t[1]/255,o=t[2]/255,a=Math.min(n,r,o),s=Math.max(n,r,o),l=s-a,h=(s+a)/2;if(0===l)e=0,i=0;else{i=h<.5?l/(s+a):l/(2-s-a);var u=((s-n)/6+l/2)/l,c=((s-r)/6+l/2)/l,p=((s-o)/6+l/2)/l;n===s?e=p-c:r===s?e=1/3+u-p:o===s&&(e=2/3+c-u),e<0&&(e+=1),e>1&&(e-=1)}var f=[360*e,i,h];return null!=t[3]&&f.push(t[3]),f}}function Dn(t,e){var i=Rn(t);if(i){for(var n=0;n<3;n++)i[n]=e<0?i[n]*(1-e)|0:(255-i[n])*e+i[n]|0,i[n]>255?i[n]=255:i[n]<0&&(i[n]=0);return Nn(i,4===i.length?"rgba":"rgb")}}function Mn(t){var e=Rn(t);if(e)return((1<<24)+(e[0]<<16)+(e[1]<<8)+ +e[2]).toString(16).slice(1)}function An(t,e,i){if(e&&e.length&&t>=0&&t<=1){i=i||[];var n=t*(e.length-1),r=Math.floor(n),o=Math.ceil(n),a=e[r],s=e[o],l=n-r;return i[0]=yn(Tn(a[0],s[0],l)),i[1]=yn(Tn(a[1],s[1],l)),i[2]=yn(Tn(a[2],s[2],l)),i[3]=wn(Tn(a[3],s[3],l)),i}}var Ln=An;function zn(t,e,i){if(e&&e.length&&t>=0&&t<=1){var n=t*(e.length-1),r=Math.floor(n),o=Math.ceil(n),a=Rn(e[r]),s=Rn(e[o]),l=n-r,h=Nn([yn(Tn(a[0],s[0],l)),yn(Tn(a[1],s[1],l)),yn(Tn(a[2],s[2],l)),wn(Tn(a[3],s[3],l))],"rgba");return i?{color:h,leftIndex:r,rightIndex:o,value:n}:h}}var jn=zn;function Bn(t,e,i,n){var r=Rn(t);if(t)return r=In(r),null!=e&&(r[0]=mn(Y(e)?e(r[0]):e)),null!=i&&(r[1]=bn(Y(i)?i(r[1]):i)),null!=n&&(r[2]=bn(Y(n)?n(r[2]):n)),Nn(kn(r),"rgba")}function Fn(t,e){var i=Rn(t);if(i&&null!=e)return i[3]=wn(e),Nn(i,"rgba")}function Nn(t,e){if(t&&t.length){var i=t[0]+","+t[1]+","+t[2];return"rgba"!==e&&"hsva"!==e&&"hsla"!==e||(i+=","+t[3]),e+"("+i+")"}}function Hn(t,e){var i=Rn(t);return i?(.299*i[0]+.587*i[1]+.114*i[2])*i[3]/255+(1-i[3])*e:0}function Wn(){return Nn([Math.round(255*Math.random()),Math.round(255*Math.random()),Math.round(255*Math.random())],"rgb")}var Vn=new vn(100);function Un(t){if($(t)){var e=Vn.get(t);return e||(e=Dn(t,-.1),Vn.put(t,e)),e}if(nt(t)){var i=D({},t);return i.colorStops=N(t.colorStops,function(t){return{offset:t.offset,color:Dn(t.color,-.1)}}),i}return t}var Gn=Object.freeze({__proto__:null,parseCssInt:xn,parseCssFloat:bn,parse:Rn,lift:Dn,toHex:Mn,fastLerp:An,fastMapToColor:Ln,lerp:zn,mapToColor:jn,modifyHSL:Bn,modifyAlpha:Fn,stringify:Nn,lum:Hn,random:Wn,liftColor:Un}),qn=Math.round;function Zn(t){var e;if(t&&"transparent"!==t){if("string"==typeof t&&t.indexOf("rgba")>-1){var i=Rn(t);i&&(t="rgb("+i[0]+","+i[1]+","+i[2]+")",e=i[3])}}else t="none";return{color:t,opacity:null==e?1:e}}var Xn=1e-4;function Yn(t){return t<Xn&&t>-Xn}function $n(t){return qn(1e3*t)/1e3}function Kn(t){return qn(1e4*t)/1e4}function Qn(t){return"matrix("+$n(t[0])+","+$n(t[1])+","+$n(t[2])+","+$n(t[3])+","+Kn(t[4])+","+Kn(t[5])+")"}var Jn={left:"start",right:"end",center:"middle",middle:"middle"};function tr(t,e,i){return"top"===i?t+=e/2:"bottom"===i&&(t-=e/2),t}function er(t){return t&&(t.shadowBlur||t.shadowOffsetX||t.shadowOffsetY)}function ir(t){var e=t.style,i=t.getGlobalScale();return[e.shadowColor,(e.shadowBlur||0).toFixed(2),(e.shadowOffsetX||0).toFixed(2),(e.shadowOffsetY||0).toFixed(2),i[0],i[1]].join(",")}function nr(t){return t&&!!t.image}function rr(t){return t&&!!t.svgElement}function or(t){return nr(t)||rr(t)}function ar(t){return"linear"===t.type}function sr(t){return"radial"===t.type}function lr(t){return t&&("linear"===t.type||"radial"===t.type)}function hr(t){return"url(#"+t+")"}function ur(t){var e=t.getGlobalScale(),i=Math.max(e[0],e[1]);return Math.max(Math.ceil(Math.log(i)/Math.log(10)),1)}function cr(t){var e=t.x||0,i=t.y||0,n=(t.rotation||0)*Ct,r=lt(t.scaleX,1),o=lt(t.scaleY,1),a=t.skewX||0,s=t.skewY||0,l=[];return(e||i)&&l.push("translate("+e+"px,"+i+"px)"),n&&l.push("rotate("+n+")"),1===r&&1===o||l.push("scale("+r+","+o+")"),(a||s)&&l.push("skew("+qn(a*Ct)+"deg, "+qn(s*Ct)+"deg)"),l.join(" ")}var pr=i.hasGlobalWindow&&Y(window.btoa)?function(t){return window.btoa(unescape(encodeURIComponent(t)))}:"undefined"!=typeof Buffer?function(t){return Buffer.from(t).toString("base64")}:function(t){return O("Base64 isn't natively supported in the current environment."),null},fr=Array.prototype.slice;function dr(t,e,i){return(e-t)*i+t}function vr(t,e,i,n){for(var r=e.length,o=0;o<r;o++)t[o]=dr(e[o],i[o],n);return t}function gr(t,e,i,n){for(var r=e.length,o=r&&e[0].length,a=0;a<r;a++){t[a]||(t[a]=[]);for(var s=0;s<o;s++)t[a][s]=dr(e[a][s],i[a][s],n)}return t}function yr(t,e,i,n){for(var r=e.length,o=0;o<r;o++)t[o]=e[o]+i[o]*n;return t}function mr(t,e,i,n){for(var r=e.length,o=r&&e[0].length,a=0;a<r;a++){t[a]||(t[a]=[]);for(var s=0;s<o;s++)t[a][s]=e[a][s]+i[a][s]*n}return t}function wr(t,e){for(var i=t.length,n=e.length,r=i>n?e:t,o=Math.min(i,n),a=r[o-1]||{color:[0,0,0,0],offset:0},s=o;s<Math.max(i,n);s++)r.push({offset:a.offset,color:a.color.slice()})}function xr(t,e,i){var n=t,r=e;if(n.push&&r.push){var o=n.length,a=r.length;if(o!==a)if(o>a)n.length=a;else for(var s=o;s<a;s++)n.push(1===i?r[s]:fr.call(r[s]));var l=n[0]&&n[0].length;for(s=0;s<n.length;s++)if(1===i)isNaN(n[s])&&(n[s]=r[s]);else for(var h=0;h<l;h++)isNaN(n[s][h])&&(n[s][h]=r[s][h])}}function br(t){if(B(t)){var e=t.length;if(B(t[0])){for(var i=[],n=0;n<e;n++)i.push(fr.call(t[n]));return i}return fr.call(t)}return t}function _r(t){return t[0]=Math.floor(t[0])||0,t[1]=Math.floor(t[1])||0,t[2]=Math.floor(t[2])||0,t[3]=null==t[3]?1:t[3],"rgba("+t.join(",")+")"}function Tr(t){return B(t&&t[0])?2:1}var Sr=0,Pr=1,Er=2,Cr=3,Or=4,Rr=5,kr=6;function Ir(t){return t===Or||t===Rr}function Dr(t){return t===Pr||t===Er}var Mr=[0,0,0,0],Ar=function(){function t(t){this.keyframes=[],this.discrete=!1,this._invalid=!1,this._needsSort=!1,this._lastFr=0,this._lastFrP=0,this.propName=t}return t.prototype.isFinished=function(){return this._finished},t.prototype.setFinished=function(){this._finished=!0,this._additiveTrack&&this._additiveTrack.setFinished()},t.prototype.needsAnimate=function(){return this.keyframes.length>=1},t.prototype.getAdditiveTrack=function(){return this._additiveTrack},t.prototype.addKeyframe=function(t,e,i){this._needsSort=!0;var n=this.keyframes,r=n.length,o=!1,a=kr,s=e;if(B(e)){var l=Tr(e);a=l,(1===l&&!Q(e[0])||2===l&&!Q(e[0][0]))&&(o=!0)}else if(Q(e)&&!at(e))a=Sr;else if($(e))if(isNaN(+e)){var h=Rn(e);h&&(s=h,a=Cr)}else a=Sr;else if(nt(e)){var u=D({},s);u.colorStops=N(e.colorStops,function(t){return{offset:t.offset,color:Rn(t.color)}}),ar(e)?a=Or:sr(e)&&(a=Rr),s=u}0===r?this.valType=a:a===this.valType&&a!==kr||(o=!0),this.discrete=this.discrete||o;var c={time:t,value:s,rawValue:e,percent:0};return i&&(c.easing=i,c.easingFunc=Y(i)?i:ji[i]||cn(i)),n.push(c),c},t.prototype.prepare=function(t,e){var i=this.keyframes;this._needsSort&&i.sort(function(t,e){return t.time-e.time});for(var n=this.valType,r=i.length,o=i[r-1],a=this.discrete,s=Dr(n),l=Ir(n),h=0;h<r;h++){var u=i[h],c=u.value,p=o.value;u.percent=u.time/t,a||(s&&h!==r-1?xr(c,p,n):l&&wr(c.colorStops,p.colorStops))}if(!a&&n!==Rr&&e&&this.needsAnimate()&&e.needsAnimate()&&n===e.valType&&!e._finished){this._additiveTrack=e;var f=i[0].value;for(h=0;h<r;h++)n===Sr?i[h].additiveValue=i[h].value-f:n===Cr?i[h].additiveValue=yr([],i[h].value,f,-1):Dr(n)&&(i[h].additiveValue=n===Pr?yr([],i[h].value,f,-1):mr([],i[h].value,f,-1))}},t.prototype.step=function(t,e){if(!this._finished){this._additiveTrack&&this._additiveTrack._finished&&(this._additiveTrack=null);var i,n,r,o=null!=this._additiveTrack,a=o?"additiveValue":"value",s=this.valType,l=this.keyframes,h=l.length,u=this.propName,c=s===Cr,p=this._lastFr,f=Math.min;if(1===h)n=r=l[0];else{if(e<0)i=0;else if(e<this._lastFrP){for(i=f(p+1,h-1);i>=0&&!(l[i].percent<=e);i--);i=f(i,h-2)}else{for(i=p;i<h&&!(l[i].percent>e);i++);i=f(i-1,h-2)}r=l[i+1],n=l[i]}if(n&&r){this._lastFr=i,this._lastFrP=e;var d=r.percent-n.percent,v=0===d?1:f((e-n.percent)/d,1);r.easingFunc&&(v=r.easingFunc(v));var g=o?this._additiveValue:c?Mr:t[u];if(!Dr(s)&&!c||g||(g=this._additiveValue=[]),this.discrete)t[u]=v<1?n.rawValue:r.rawValue;else if(Dr(s))s===Pr?vr(g,n[a],r[a],v):gr(g,n[a],r[a],v);else if(Ir(s)){var y=n[a],m=r[a],w=s===Or;t[u]={type:w?"linear":"radial",x:dr(y.x,m.x,v),y:dr(y.y,m.y,v),colorStops:N(y.colorStops,function(t,e){var i=m.colorStops[e];return{offset:dr(t.offset,i.offset,v),color:_r(vr([],t.color,i.color,v))}}),global:m.global},w?(t[u].x2=dr(y.x2,m.x2,v),t[u].y2=dr(y.y2,m.y2,v)):t[u].r=dr(y.r,m.r,v)}else if(c)vr(g,n[a],r[a],v),o||(t[u]=_r(g));else{var x=dr(n[a],r[a],v);o?this._additiveValue=x:t[u]=x}o&&this._addToTarget(t)}}},t.prototype._addToTarget=function(t){var e=this.valType,i=this.propName,n=this._additiveValue;e===Sr?t[i]=t[i]+n:e===Cr?(Rn(t[i],Mr),yr(Mr,Mr,n,1),t[i]=_r(Mr)):e===Pr?yr(t[i],t[i],n,1):e===Er&&mr(t[i],t[i],n,1)},t}(),Lr=function(){function t(t,e,i,n){this._tracks={},this._trackKeys=[],this._maxTime=0,this._started=0,this._clip=null,this._target=t,this._loop=e,e&&n?O("Can' use additive animation on looped animation."):(this._additiveAnimators=n,this._allowDiscrete=i)}return t.prototype.getMaxTime=function(){return this._maxTime},t.prototype.getDelay=function(){return this._delay},t.prototype.getLoop=function(){return this._loop},t.prototype.getTarget=function(){return this._target},t.prototype.changeTarget=function(t){this._target=t},t.prototype.when=function(t,e,i){return this.whenWithKeys(t,e,U(e),i)},t.prototype.whenWithKeys=function(t,e,i,n){for(var r=this._tracks,o=0;o<i.length;o++){var a=i[o],s=r[a];if(!s){s=r[a]=new Ar(a);var l=void 0,h=this._getAdditiveTrack(a);if(h){var u=h.keyframes,c=u[u.length-1];l=c&&c.value,h.valType===Cr&&l&&(l=_r(l))}else l=this._target[a];if(null==l)continue;t>0&&s.addKeyframe(0,br(l),n),this._trackKeys.push(a)}s.addKeyframe(t,br(e[a]),n)}return this._maxTime=Math.max(this._maxTime,t),this},t.prototype.pause=function(){this._clip.pause(),this._paused=!0},t.prototype.resume=function(){this._clip.resume(),this._paused=!1},t.prototype.isPaused=function(){return!!this._paused},t.prototype.duration=function(t){return this._maxTime=t,this._force=!0,this},t.prototype._doneCallback=function(){this._setTracksFinished(),this._clip=null;var t=this._doneCbs;if(t)for(var e=t.length,i=0;i<e;i++)t[i].call(this)},t.prototype._abortedCallback=function(){this._setTracksFinished();var t=this.animation,e=this._abortedCbs;if(t&&t.removeClip(this._clip),this._clip=null,e)for(var i=0;i<e.length;i++)e[i].call(this)},t.prototype._setTracksFinished=function(){for(var t=this._tracks,e=this._trackKeys,i=0;i<e.length;i++)t[e[i]].setFinished()},t.prototype._getAdditiveTrack=function(t){var e,i=this._additiveAnimators;if(i)for(var n=0;n<i.length;n++){var r=i[n].getTrack(t);r&&(e=r)}return e},t.prototype.start=function(t){if(!(this._started>0)){this._started=1;for(var e=this,i=[],n=this._maxTime||0,r=0;r<this._trackKeys.length;r++){var o=this._trackKeys[r],a=this._tracks[o],s=this._getAdditiveTrack(o),l=a.keyframes,h=l.length;if(a.prepare(n,s),a.needsAnimate())if(!this._allowDiscrete&&a.discrete){var u=l[h-1];u&&(e._target[a.propName]=u.rawValue),a.setFinished()}else i.push(a)}if(i.length||this._force){var c=new pn({life:n,loop:this._loop,delay:this._delay||0,onframe:function(t){e._started=2;var n=e._additiveAnimators;if(n){for(var r=!1,o=0;o<n.length;o++)if(n[o]._clip){r=!0;break}r||(e._additiveAnimators=null)}for(o=0;o<i.length;o++)i[o].step(e._target,t);var a=e._onframeCbs;if(a)for(o=0;o<a.length;o++)a[o](e._target,t)},ondestroy:function(){e._doneCallback()}});this._clip=c,this.animation&&this.animation.addClip(c),t&&c.setEasing(t)}else this._doneCallback();return this}},t.prototype.stop=function(t){if(this._clip){var e=this._clip;t&&e.onframe(1),this._abortedCallback()}},t.prototype.delay=function(t){return this._delay=t,this},t.prototype.during=function(t){return t&&(this._onframeCbs||(this._onframeCbs=[]),this._onframeCbs.push(t)),this},t.prototype.done=function(t){return t&&(this._doneCbs||(this._doneCbs=[]),this._doneCbs.push(t)),this},t.prototype.aborted=function(t){return t&&(this._abortedCbs||(this._abortedCbs=[]),this._abortedCbs.push(t)),this},t.prototype.getClip=function(){return this._clip},t.prototype.getTrack=function(t){return this._tracks[t]},t.prototype.getTracks=function(){var t=this;return N(this._trackKeys,function(e){return t._tracks[e]})},t.prototype.stopTracks=function(t,e){if(!t.length||!this._clip)return!0;for(var i=this._tracks,n=this._trackKeys,r=0;r<t.length;r++){var o=i[t[r]];o&&!o.isFinished()&&(e?o.step(this._target,1):1===this._started&&o.step(this._target,0),o.setFinished())}var a=!0;for(r=0;r<n.length;r++)if(!i[n[r]].isFinished()){a=!1;break}return a&&this._abortedCallback(),a},t.prototype.saveTo=function(t,e,i){if(t){e=e||this._trackKeys;for(var n=0;n<e.length;n++){var r=e[n],o=this._tracks[r];if(o&&!o.isFinished()){var a=o.keyframes,s=a[i?0:a.length-1];s&&(t[r]=br(s.rawValue))}}}},t.prototype.__changeFinalValue=function(t,e){e=e||U(t);for(var i=0;i<e.length;i++){var n=e[i],r=this._tracks[n];if(r){var o=r.keyframes;if(o.length>1){var a=o.pop();r.addKeyframe(a.time,t[n]),r.prepare(this._maxTime,r.getAdditiveTrack())}}}},t}();function zr(){return(new Date).getTime()}var jr,Br,Fr=function(t){function e(e){var i=t.call(this)||this;return i._running=!1,i._time=0,i._pausedTime=0,i._pauseStart=0,i._paused=!1,e=e||{},i.stage=e.stage||{},i}return It(e,t),e.prototype.addClip=function(t){t.animation&&this.removeClip(t),this._head?(this._tail.next=t,t.prev=this._tail,t.next=null,this._tail=t):this._head=this._tail=t,t.animation=this},e.prototype.addAnimator=function(t){t.animation=this;var e=t.getClip();e&&this.addClip(e)},e.prototype.removeClip=function(t){if(t.animation){var e=t.prev,i=t.next;e?e.next=i:this._head=i,i?i.prev=e:this._tail=e,t.next=t.prev=t.animation=null}},e.prototype.removeAnimator=function(t){var e=t.getClip();e&&this.removeClip(e),t.animation=null},e.prototype.update=function(t){for(var e=zr()-this._pausedTime,i=e-this._time,n=this._head;n;){var r=n.next;n.step(e,i)?(n.ondestroy(),this.removeClip(n),n=r):n=r}this._time=e,t||(this.trigger("frame",i),this.stage.update&&this.stage.update())},e.prototype._startLoop=function(){var t=this;function e(){t._running&&(zi(e),!t._paused&&t.update())}this._running=!0,zi(e)},e.prototype.start=function(){this._running||(this._time=zr(),this._pausedTime=0,this._startLoop())},e.prototype.stop=function(){this._running=!1},e.prototype.pause=function(){this._paused||(this._pauseStart=zr(),this._paused=!0)},e.prototype.resume=function(){this._paused&&(this._pausedTime+=zr()-this._pauseStart,this._paused=!1)},e.prototype.clear=function(){for(var t=this._head;t;){var e=t.next;t.prev=t.next=t.animation=null,t=e}this._head=this._tail=null},e.prototype.isFinished=function(){return null==this._head},e.prototype.animate=function(t,e){e=e||{},this.start();var i=new Lr(t,e.loop);return this.addAnimator(i),i},e}(ae),Nr=300,Hr=i.domSupported,Wr=(Br={pointerdown:1,pointerup:1,pointermove:1,pointerout:1},{mouse:jr=["click","dblclick","mousewheel","wheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],touch:["touchstart","touchend","touchmove"],pointer:N(jr,function(t){var e=t.replace("mouse","pointer");return Br.hasOwnProperty(e)?e:t})}),Vr={mouse:["mousemove","mouseup"],pointer:["pointermove","pointerup"]},Ur=!1;function Gr(t){var e=t.pointerType;return"pen"===e||"touch"===e}function qr(t){t.touching=!0,null!=t.touchTimer&&(clearTimeout(t.touchTimer),t.touchTimer=null),t.touchTimer=setTimeout(function(){t.touching=!1,t.touchTimer=null},700)}function Zr(t){t&&(t.zrByTouch=!0)}function Xr(t,e){return Se(t.dom,new $r(t,e),!0)}function Yr(t,e){for(var i=e,n=!1;i&&9!==i.nodeType&&!(n=i.domBelongToZr||i!==e&&i===t.painterRoot);)i=i.parentNode;return n}var $r=function(){function t(t,e){this.stopPropagation=Et,this.stopImmediatePropagation=Et,this.preventDefault=Et,this.type=e.type,this.target=this.currentTarget=t.dom,this.pointerType=e.pointerType,this.clientX=e.clientX,this.clientY=e.clientY}return t}(),Kr={mousedown:function(t){t=Se(this.dom,t),this.__mayPointerCapture=[t.zrX,t.zrY],this.trigger("mousedown",t)},mousemove:function(t){t=Se(this.dom,t);var e=this.__mayPointerCapture;!e||t.zrX===e[0]&&t.zrY===e[1]||this.__togglePointerCapture(!0),this.trigger("mousemove",t)},mouseup:function(t){t=Se(this.dom,t),this.__togglePointerCapture(!1),this.trigger("mouseup",t)},mouseout:function(t){Yr(this,(t=Se(this.dom,t)).toElement||t.relatedTarget)||(this.__pointerCapturing&&(t.zrEventControl="no_globalout"),this.trigger("mouseout",t))},wheel:function(t){Ur=!0,t=Se(this.dom,t),this.trigger("mousewheel",t)},mousewheel:function(t){Ur||(t=Se(this.dom,t),this.trigger("mousewheel",t))},touchstart:function(t){Zr(t=Se(this.dom,t)),this.__lastTouchMoment=new Date,this.handler.processGesture(t,"start"),Kr.mousemove.call(this,t),Kr.mousedown.call(this,t)},touchmove:function(t){Zr(t=Se(this.dom,t)),this.handler.processGesture(t,"change"),Kr.mousemove.call(this,t)},touchend:function(t){Zr(t=Se(this.dom,t)),this.handler.processGesture(t,"end"),Kr.mouseup.call(this,t),+new Date-+this.__lastTouchMoment<Nr&&Kr.click.call(this,t)},pointerdown:function(t){Kr.mousedown.call(this,t)},pointermove:function(t){Gr(t)||Kr.mousemove.call(this,t)},pointerup:function(t){Kr.mouseup.call(this,t)},pointerout:function(t){Gr(t)||Kr.mouseout.call(this,t)}};F(["click","dblclick","contextmenu"],function(t){Kr[t]=function(e){e=Se(this.dom,e),this.trigger(t,e)}});var Qr={pointermove:function(t){Gr(t)||Qr.mousemove.call(this,t)},pointerup:function(t){Qr.mouseup.call(this,t)},mousemove:function(t){this.trigger("mousemove",t)},mouseup:function(t){var e=this.__pointerCapturing;this.__togglePointerCapture(!1),this.trigger("mouseup",t),e&&(t.zrEventControl="only_globalout",this.trigger("mouseout",t))}};function Jr(t,e){var n=e.domHandlers;i.pointerEventsSupported?F(Wr.pointer,function(i){eo(e,i,function(e){n[i].call(t,e)})}):(i.touchEventsSupported&&F(Wr.touch,function(i){eo(e,i,function(r){n[i].call(t,r),qr(e)})}),F(Wr.mouse,function(i){eo(e,i,function(r){r=Te(r),e.touching||n[i].call(t,r)})}))}function to(t,e){function n(i){function n(n){n=Te(n),Yr(t,n.target)||(n=Xr(t,n),e.domHandlers[i].call(t,n))}eo(e,i,n,{capture:!0})}i.pointerEventsSupported?F(Vr.pointer,n):i.touchEventsSupported||F(Vr.mouse,n)}function eo(t,e,i,n){t.mounted[e]=i,t.listenerOpts[e]=n,Ee(t.domTarget,e,i,n)}function io(t){var e=t.mounted;for(var i in e)e.hasOwnProperty(i)&&Ce(t.domTarget,i,e[i],t.listenerOpts[i]);t.mounted={}}var no=function(){function t(t,e){this.mounted={},this.listenerOpts={},this.touching=!1,this.domTarget=t,this.domHandlers=e}return t}(),ro=function(t){function e(e,i){var n=t.call(this)||this;return n.__pointerCapturing=!1,n.dom=e,n.painterRoot=i,n._localHandlerScope=new no(e,Kr),Hr&&(n._globalHandlerScope=new no(document,Qr)),Jr(n,n._localHandlerScope),n}return It(e,t),e.prototype.dispose=function(){io(this._localHandlerScope),Hr&&io(this._globalHandlerScope)},e.prototype.setCursor=function(t){this.dom.style&&(this.dom.style.cursor=t||"default")},e.prototype.__togglePointerCapture=function(t){if(this.__mayPointerCapture=null,Hr&&+this.__pointerCapturing^+t){this.__pointerCapturing=t;var e=this._globalHandlerScope;t?to(this,e):io(e)}},e}(ae),oo=1;i.hasGlobalWindow&&(oo=Math.max(window.devicePixelRatio||window.screen&&window.screen.deviceXDPI/window.screen.logicalXDPI||1,1));var ao=oo,so=.4,lo="#333",ho="#ccc",uo="#eee",co=Ae,po=5e-5;function fo(t){return t>po||t<-po}var vo,go=[],yo=[],mo=Me(),wo=Math.abs,xo=function(){function t(){}var e;return t.prototype.getLocalTransform=function(e){return t.getLocalTransform(this,e)},t.prototype.setPosition=function(t){this.x=t[0],this.y=t[1]},t.prototype.setScale=function(t){this.scaleX=t[0],this.scaleY=t[1]},t.prototype.setSkew=function(t){this.skewX=t[0],this.skewY=t[1]},t.prototype.setOrigin=function(t){this.originX=t[0],this.originY=t[1]},t.prototype.needLocalTransform=function(){return fo(this.rotation)||fo(this.x)||fo(this.y)||fo(this.scaleX-1)||fo(this.scaleY-1)||fo(this.skewX)||fo(this.skewY)},t.prototype.updateTransform=function(){var t=this.parent&&this.parent.transform,e=this.needLocalTransform(),i=this.transform;e||t?(i=i||Me(),e?this.getLocalTransform(i):co(i),t&&(e?ze(i,t,i):Le(i,t)),this.transform=i,this._resolveGlobalScaleRatio(i)):i&&(co(i),this.invTransform=null)},t.prototype._resolveGlobalScaleRatio=function(t){var e=this.globalScaleRatio;if(null!=e&&1!==e){this.getGlobalScale(go);var i=go[0]<0?-1:1,n=go[1]<0?-1:1,r=((go[0]-i)*e+i)/go[0]||0,o=((go[1]-n)*e+n)/go[1]||0;t[0]*=r,t[1]*=r,t[2]*=o,t[3]*=o}this.invTransform=this.invTransform||Me(),Ne(this.invTransform,t)},t.prototype.getComputedTransform=function(){for(var t=this,e=[];t;)e.push(t),t=t.parent;for(;t=e.pop();)t.updateTransform();return this.transform},t.prototype.setLocalTransform=function(t){if(t){var e=t[0]*t[0]+t[1]*t[1],i=t[2]*t[2]+t[3]*t[3],n=Math.atan2(t[1],t[0]),r=Math.PI/2+n-Math.atan2(t[3],t[2]);i=Math.sqrt(i)*Math.cos(r),e=Math.sqrt(e),this.skewX=r,this.skewY=0,this.rotation=-n,this.x=+t[4],this.y=+t[5],this.scaleX=e,this.scaleY=i,this.originX=0,this.originY=0}},t.prototype.decomposeTransform=function(){if(this.transform){var t=this.parent,e=this.transform;t&&t.transform&&(t.invTransform=t.invTransform||Me(),ze(yo,t.invTransform,e),e=yo);var i=this.originX,n=this.originY;(i||n)&&(mo[4]=i,mo[5]=n,ze(yo,e,mo),yo[4]-=i,yo[5]-=n,e=yo),this.setLocalTransform(e)}},t.prototype.getGlobalScale=function(t){var e=this.transform;return t=t||[],e?(t[0]=Math.sqrt(e[0]*e[0]+e[1]*e[1]),t[1]=Math.sqrt(e[2]*e[2]+e[3]*e[3]),e[0]<0&&(t[0]=-t[0]),e[3]<0&&(t[1]=-t[1]),t):(t[0]=1,t[1]=1,t)},t.prototype.transformCoordToLocal=function(t,e){var i=[t,e],n=this.invTransform;return n&&te(i,i,n),i},t.prototype.transformCoordToGlobal=function(t,e){var i=[t,e],n=this.transform;return n&&te(i,i,n),i},t.prototype.getLineScale=function(){var t=this.transform;return t&&wo(t[0]-1)>1e-10&&wo(t[3]-1)>1e-10?Math.sqrt(wo(t[0]*t[3]-t[2]*t[1])):1},t.prototype.copyTransform=function(t){_o(this,t)},t.getLocalTransform=function(t,e){e=e||[];var i=t.originX||0,n=t.originY||0,r=t.scaleX,o=t.scaleY,a=t.anchorX,s=t.anchorY,l=t.rotation||0,h=t.x,u=t.y,c=t.skewX?Math.tan(t.skewX):0,p=t.skewY?Math.tan(-t.skewY):0;if(i||n||a||s){var f=i+a,d=n+s;e[4]=-f*r-c*d*o,e[5]=-d*o-p*f*r}else e[4]=e[5]=0;return e[0]=r,e[3]=o,e[1]=p*r,e[2]=c*o,l&&Be(e,e,l),e[4]+=i+h,e[5]+=n+u,e},t.initDefaultProps=((e=t.prototype).scaleX=e.scaleY=e.globalScaleRatio=1,void(e.x=e.y=e.originX=e.originY=e.skewX=e.skewY=e.rotation=e.anchorX=e.anchorY=0)),t}(),bo=["x","y","originX","originY","anchorX","anchorY","rotation","scaleX","scaleY","skewX","skewY"];function _o(t,e){for(var i=0;i<bo.length;i++){var n=bo[i];t[n]=e[n]}}function To(t){vo||(vo=new vn(100)),t=t||a;var e=vo.get(t);return e||(e={font:t,strWidthCache:new vn(500),asciiWidthMap:null,asciiWidthMapTried:!1,stWideCharWidth:f.measureText("国",t).width,asciiCharWidth:f.measureText("a",t).width},vo.put(t,e)),e}function So(t){if(!(Po>=Eo)){t=t||a;for(var e=[],i=+new Date,n=0;n<=127;n++)e[n]=f.measureText(String.fromCharCode(n),t).width;var r=+new Date-i;return r>16?Po=Eo:r>2&&Po++,e}}var Po=0,Eo=5;function Co(t,e){return t.asciiWidthMapTried||(t.asciiWidthMap=So(t.font),t.asciiWidthMapTried=!0),0<=e&&e<=127?null!=t.asciiWidthMap?t.asciiWidthMap[e]:t.asciiCharWidth:t.stWideCharWidth}function Oo(t,e){var i=t.strWidthCache,n=i.get(e);return null==n&&(n=f.measureText(e,t.font).width,i.put(e,n)),n}function Ro(t,e,i,n){return"right"===i?n?t+=e:t-=e:"center"===i&&(n?t+=e/2:t-=e/2),t}function ko(t,e,i,n){return"middle"===i?n?t+=e/2:t-=e/2:"bottom"===i&&(n?t+=e:t-=e),t}function Io(t){return To(t).stWideCharWidth}function Do(t,e){return"string"==typeof t?t.lastIndexOf("%")>=0?parseFloat(t)/100*e:parseFloat(t):t}function Mo(t,e,i){var n=e.position||"inside",r=null!=e.distance?e.distance:5,o=i.height,a=i.width,s=o/2,l=i.x,h=i.y,u="left",c="top";if(n instanceof Array)l+=Do(n[0],i.width),h+=Do(n[1],i.height),u=null,c=null;else switch(n){case"left":l-=r,h+=s,u="right",c="middle";break;case"right":l+=r+a,h+=s,c="middle";break;case"top":l+=a/2,h-=r,u="center",c="bottom";break;case"bottom":l+=a/2,h+=o+r,u="center";break;case"inside":l+=a/2,h+=s,u="center",c="middle";break;case"insideLeft":l+=r,h+=s,c="middle";break;case"insideRight":l+=a-r,h+=s,u="right",c="middle";break;case"insideTop":l+=a/2,h+=r,u="center";break;case"insideBottom":l+=a/2,h+=o-r,u="center",c="bottom";break;case"insideTopLeft":l+=r,h+=r;break;case"insideTopRight":l+=a-r,h+=r,u="right";break;case"insideBottomLeft":l+=r,h+=o-r,c="bottom";break;case"insideBottomRight":l+=a-r,h+=o-r,u="right",c="bottom"}return(t=t||{}).x=l,t.y=h,t.align=u,t.verticalAlign=c,t}var Ao="__zr_normal__",Lo=bo.concat(["ignore"]),zo=H(bo,function(t,e){return t[e]=!0,t},{ignore:!1}),jo={},Bo=new ni(0,0,0,0),Fo=[],No=function(){function t(t){this.id=C(),this.animators=[],this.currentStates=[],this.states={},this._init(t)}return t.prototype._init=function(t){this.attr(t)},t.prototype.drift=function(t,e,i){switch(this.draggable){case"horizontal":e=0;break;case"vertical":t=0}var n=this.transform;n||(n=this.transform=[1,0,0,1,0,0]),n[4]+=t,n[5]+=e,this.decomposeTransform(),this.markRedraw()},t.prototype.beforeUpdate=function(){},t.prototype.afterUpdate=function(){},t.prototype.update=function(){this.updateTransform(),this.__dirty&&this.updateInnerText()},t.prototype.updateInnerText=function(t){var e=this._textContent;if(e&&(!e.ignore||t)){this.textConfig||(this.textConfig={});var i=this.textConfig,n=i.local,r=e.innerTransformable,o=void 0,a=void 0,s=!1;r.parent=n?this:null;var l=!1;r.copyTransform(e);var h=null!=i.position,u=i.autoOverflowArea,c=void 0;if((u||h)&&(c=Bo,i.layoutRect?c.copy(i.layoutRect):c.copy(this.getBoundingRect()),n||c.applyTransform(this.transform)),h){this.calculateTextPosition?this.calculateTextPosition(jo,i,c):Mo(jo,i,c),r.x=jo.x,r.y=jo.y,o=jo.align,a=jo.verticalAlign;var p=i.origin;if(p&&null!=i.rotation){var f=void 0,d=void 0;"center"===p?(f=.5*c.width,d=.5*c.height):(f=Do(p[0],c.width),d=Do(p[1],c.height)),l=!0,r.originX=-r.x+f+(n?0:c.x),r.originY=-r.y+d+(n?0:c.y)}}null!=i.rotation&&(r.rotation=i.rotation);var v=i.offset;v&&(r.x+=v[0],r.y+=v[1],l||(r.originX=-v[0],r.originY=-v[1]));var g=this._innerTextDefaultStyle||(this._innerTextDefaultStyle={});if(u){var y=g.overflowRect=g.overflowRect||new ni(0,0,0,0);r.getLocalTransform(Fo),Ne(Fo,Fo),ni.copy(y,c),y.applyTransform(Fo)}else g.overflowRect=null;var m=void 0,w=void 0,x=void 0;(null==i.inside?"string"==typeof i.position&&i.position.indexOf("inside")>=0:i.inside)&&this.canBeInsideText()?(m=i.insideFill,w=i.insideStroke,null!=m&&"auto"!==m||(m=this.getInsideTextFill()),null!=w&&"auto"!==w||(w=this.getInsideTextStroke(m),x=!0)):(m=i.outsideFill,w=i.outsideStroke,null!=m&&"auto"!==m||(m=this.getOutsideFill()),null!=w&&"auto"!==w||(w=this.getOutsideStroke(m),x=!0)),(m=m||"#000")===g.fill&&w===g.stroke&&x===g.autoStroke&&o===g.align&&a===g.verticalAlign||(s=!0,g.fill=m,g.stroke=w,g.autoStroke=x,g.align=o,g.verticalAlign=a,e.setDefaultTextStyle(g)),e.__dirty|=Ri,s&&e.dirtyStyle(!0)}},t.prototype.canBeInsideText=function(){return!0},t.prototype.getInsideTextFill=function(){return"#fff"},t.prototype.getInsideTextStroke=function(t){return"#000"},t.prototype.getOutsideFill=function(){return this.__zr&&this.__zr.isDarkMode()?ho:lo},t.prototype.getOutsideStroke=function(t){var e=this.__zr&&this.__zr.getBackgroundColor(),i="string"==typeof e&&Rn(e);i||(i=[255,255,255,1]);for(var n=i[3],r=this.__zr.isDarkMode(),o=0;o<3;o++)i[o]=i[o]*n+(r?0:255)*(1-n);return i[3]=1,Nn(i,"rgba")},t.prototype.traverse=function(t,e){},t.prototype.attrKV=function(t,e){"textConfig"===t?this.setTextConfig(e):"textContent"===t?this.setTextContent(e):"clipPath"===t?this.setClipPath(e):"extra"===t?(this.extra=this.extra||{},D(this.extra,e)):this[t]=e},t.prototype.hide=function(){this.ignore=!0,this.markRedraw()},t.prototype.show=function(){this.ignore=!1,this.markRedraw()},t.prototype.attr=function(t,e){if("string"==typeof t)this.attrKV(t,e);else if(J(t))for(var i=U(t),n=0;n<i.length;n++){var r=i[n];this.attrKV(r,t[r])}return this.markRedraw(),this},t.prototype.saveCurrentToNormalState=function(t){this._innerSaveToNormal(t);for(var e=this._normalState,i=0;i<this.animators.length;i++){var n=this.animators[i],r=n.__fromStateTransition;if(!(n.getLoop()||r&&r!==Ao)){var o=n.targetName,a=o?e[o]:e;n.saveTo(a)}}},t.prototype._innerSaveToNormal=function(t){var e=this._normalState;e||(e=this._normalState={}),t.textConfig&&!e.textConfig&&(e.textConfig=this.textConfig),this._savePrimaryToNormal(t,e,Lo)},t.prototype._savePrimaryToNormal=function(t,e,i){for(var n=0;n<i.length;n++){var r=i[n];null==t[r]||r in e||(e[r]=this[r])}},t.prototype.hasState=function(){return this.currentStates.length>0},t.prototype.getState=function(t){return this.states[t]},t.prototype.ensureState=function(t){var e=this.states;return e[t]||(e[t]={}),e[t]},t.prototype.clearStates=function(t){this.useState(Ao,!1,t)},t.prototype.useState=function(t,e,i,n){var r=t===Ao;if(this.hasState()||!r){var o=this.currentStates,a=this.stateTransition;if(!(L(o,t)>=0)||!e&&1!==o.length){var s;if(this.stateProxy&&!r&&(s=this.stateProxy(t)),s||(s=this.states&&this.states[t]),s||r){r||this.saveCurrentToNormalState(s);var l=!!(s&&s.hoverLayer||n);l&&this._toggleHoverLayerFlag(!0),this._applyStateObj(t,s,this._normalState,e,!i&&!this.__inHover&&a&&a.duration>0,a);var h=this._textContent,u=this._textGuide;return h&&h.useState(t,e,i,l),u&&u.useState(t,e,i,l),r?(this.currentStates=[],this._normalState={}):e?this.currentStates.push(t):this.currentStates=[t],this._updateAnimationTargets(),this.markRedraw(),!l&&this.__inHover&&(this._toggleHoverLayerFlag(!1),this.__dirty&=~Ri),s}O("State "+t+" not exists.")}}},t.prototype.useStates=function(t,e,i){if(t.length){var n=[],r=this.currentStates,o=t.length,a=o===r.length;if(a)for(var s=0;s<o;s++)if(t[s]!==r[s]){a=!1;break}if(a)return;for(s=0;s<o;s++){var l=t[s],h=void 0;this.stateProxy&&(h=this.stateProxy(l,t)),h||(h=this.states[l]),h&&n.push(h)}var u=n[o-1],c=!!(u&&u.hoverLayer||i);c&&this._toggleHoverLayerFlag(!0);var p=this._mergeStates(n),f=this.stateTransition;this.saveCurrentToNormalState(p),this._applyStateObj(t.join(","),p,this._normalState,!1,!e&&!this.__inHover&&f&&f.duration>0,f);var d=this._textContent,v=this._textGuide;d&&d.useStates(t,e,c),v&&v.useStates(t,e,c),this._updateAnimationTargets(),this.currentStates=t.slice(),this.markRedraw(),!c&&this.__inHover&&(this._toggleHoverLayerFlag(!1),this.__dirty&=~Ri)}else this.clearStates()},t.prototype.isSilent=function(){for(var t=this;t;){if(t.silent)return!0;var e=t.__hostTarget;t=e?t.ignoreHostSilent?null:e:t.parent}return!1},t.prototype._updateAnimationTargets=function(){for(var t=0;t<this.animators.length;t++){var e=this.animators[t];e.targetName&&e.changeTarget(this[e.targetName])}},t.prototype.removeState=function(t){var e=L(this.currentStates,t);if(e>=0){var i=this.currentStates.slice();i.splice(e,1),this.useStates(i)}},t.prototype.replaceState=function(t,e,i){var n=this.currentStates.slice(),r=L(n,t),o=L(n,e)>=0;r>=0?o?n.splice(r,1):n[r]=e:i&&!o&&n.push(e),this.useStates(n)},t.prototype.toggleState=function(t,e){e?this.useState(t,!0):this.removeState(t)},t.prototype._mergeStates=function(t){for(var e,i={},n=0;n<t.length;n++){var r=t[n];D(i,r),r.textConfig&&D(e=e||{},r.textConfig)}return e&&(i.textConfig=e),i},t.prototype._applyStateObj=function(t,e,i,n,r,o){var a=!(e&&n);e&&e.textConfig?(this.textConfig=D({},n?this.textConfig:i.textConfig),D(this.textConfig,e.textConfig)):a&&i.textConfig&&(this.textConfig=i.textConfig);for(var s={},l=!1,h=0;h<Lo.length;h++){var u=Lo[h],c=r&&zo[u];e&&null!=e[u]?c?(l=!0,s[u]=e[u]):this[u]=e[u]:a&&null!=i[u]&&(c?(l=!0,s[u]=i[u]):this[u]=i[u])}if(!r)for(h=0;h<this.animators.length;h++){var p=this.animators[h],f=p.targetName;p.getLoop()||p.__changeFinalValue(f?(e||i)[f]:e||i)}l&&this._transitionState(t,s,o)},t.prototype._attachComponent=function(t){if(t.__zr&&!t.__hostTarget)throw new Error("Text element has been added to zrender.");if(t===this)throw new Error("Recursive component attachment.");var e=this.__zr;e&&t.addSelfToZr(e),t.__zr=e,t.__hostTarget=this},t.prototype._detachComponent=function(t){t.__zr&&t.removeSelfFromZr(t.__zr),t.__zr=null,t.__hostTarget=null},t.prototype.getClipPath=function(){return this._clipPath},t.prototype.setClipPath=function(t){this._clipPath&&this._clipPath!==t&&this.removeClipPath(),this._attachComponent(t),this._clipPath=t,this.markRedraw()},t.prototype.removeClipPath=function(){var t=this._clipPath;t&&(this._detachComponent(t),this._clipPath=null,this.markRedraw())},t.prototype.getTextContent=function(){return this._textContent},t.prototype.setTextContent=function(t){var e=this._textContent;if(e!==t){if(e&&e!==t&&this.removeTextContent(),t.__zr&&!t.__hostTarget)throw new Error("Text element has been added to zrender.");t.innerTransformable=new xo,this._attachComponent(t),this._textContent=t,this.markRedraw()}},t.prototype.setTextConfig=function(t){this.textConfig||(this.textConfig={}),D(this.textConfig,t),this.markRedraw()},t.prototype.removeTextConfig=function(){this.textConfig=null,this.markRedraw()},t.prototype.removeTextContent=function(){var t=this._textContent;t&&(t.innerTransformable=null,this._detachComponent(t),this._textContent=null,this._innerTextDefaultStyle=null,this.markRedraw())},t.prototype.getTextGuideLine=function(){return this._textGuide},t.prototype.setTextGuideLine=function(t){this._textGuide&&this._textGuide!==t&&this.removeTextGuideLine(),this._attachComponent(t),this._textGuide=t,this.markRedraw()},t.prototype.removeTextGuideLine=function(){var t=this._textGuide;t&&(this._detachComponent(t),this._textGuide=null,this.markRedraw())},t.prototype.markRedraw=function(){this.__dirty|=Ri;var t=this.__zr;t&&(this.__inHover?t.refreshHover():t.refresh()),this.__hostTarget&&this.__hostTarget.markRedraw()},t.prototype.dirty=function(){this.markRedraw()},t.prototype._toggleHoverLayerFlag=function(t){this.__inHover=t;var e=this._textContent,i=this._textGuide;e&&(e.__inHover=t),i&&(i.__inHover=t)},t.prototype.addSelfToZr=function(t){if(this.__zr!==t){this.__zr=t;var e=this.animators;if(e)for(var i=0;i<e.length;i++)t.animation.addAnimator(e[i]);this._clipPath&&this._clipPath.addSelfToZr(t),this._textContent&&this._textContent.addSelfToZr(t),this._textGuide&&this._textGuide.addSelfToZr(t)}},t.prototype.removeSelfFromZr=function(t){if(this.__zr){this.__zr=null;var e=this.animators;if(e)for(var i=0;i<e.length;i++)t.animation.removeAnimator(e[i]);this._clipPath&&this._clipPath.removeSelfFromZr(t),this._textContent&&this._textContent.removeSelfFromZr(t),this._textGuide&&this._textGuide.removeSelfFromZr(t)}},t.prototype.animate=function(t,e,i){var n=t?this[t]:this;if(n){var r=new Lr(n,e,i);return t&&(r.targetName=t),this.addAnimator(r,t),r}O('Property "'+t+'" is not existed in element '+this.id)},t.prototype.addAnimator=function(t,e){var i=this.__zr,n=this;t.during(function(){n.updateDuringAnimation(e)}).done(function(){var e=n.animators,i=L(e,t);i>=0&&e.splice(i,1)}),this.animators.push(t),i&&i.animation.addAnimator(t),i&&i.wakeUp()},t.prototype.updateDuringAnimation=function(t){this.markRedraw()},t.prototype.stopAnimation=function(t,e){for(var i=this.animators,n=i.length,r=[],o=0;o<n;o++){var a=i[o];t&&t!==a.scope?r.push(a):a.stop(e)}return this.animators=r,this},t.prototype.animateTo=function(t,e,i){Ho(this,t,e,i)},t.prototype.animateFrom=function(t,e,i){Ho(this,t,e,i,!0)},t.prototype._transitionState=function(t,e,i,n){for(var r=Ho(this,e,i,n),o=0;o<r.length;o++)r[o].__fromStateTransition=t},t.prototype.getBoundingRect=function(){return null},t.prototype.getPaintRect=function(){return null},t.initDefaultProps=function(){var e=t.prototype;e.type="element",e.name="",e.ignore=e.silent=e.ignoreHostSilent=e.isGroup=e.draggable=e.dragging=e.ignoreClip=e.__inHover=!1,e.__dirty=Ri;var i={};function n(t,e,n){i[t+e+n]||(i[t+e+n]=!0)}function r(t,i,r,o){function a(t,e){Object.defineProperty(e,0,{get:function(){return t[r]},set:function(e){t[r]=e}}),Object.defineProperty(e,1,{get:function(){return t[o]},set:function(e){t[o]=e}})}Object.defineProperty(e,t,{get:function(){return n(t,r,o),this[i]||a(this,this[i]=[]),this[i]},set:function(e){n(t,r,o),this[r]=e[0],this[o]=e[1],this[i]=e,a(this,e)}})}Object.defineProperty&&(r("position","_legacyPos","x","y"),r("scale","_legacyScale","scaleX","scaleY"),r("origin","_legacyOrigin","originX","originY"))}(),t}();function Ho(t,e,i,n,r){var o=[];Zo(t,"",t,e,i=i||{},n,o,r);var a=o.length,s=!1,l=i.done,h=i.aborted,u=function(){s=!0,--a<=0&&(s?l&&l():h&&h())},c=function(){--a<=0&&(s?l&&l():h&&h())};a||l&&l(),o.length>0&&i.during&&o[0].during(function(t,e){i.during(e)});for(var p=0;p<o.length;p++){var f=o[p];u&&f.done(u),c&&f.aborted(c),i.force&&f.duration(i.duration),f.start(i.easing)}return o}function Wo(t,e,i){for(var n=0;n<i;n++)t[n]=e[n]}function Vo(t){return B(t[0])}function Uo(t,e,i){if(B(e[i]))if(B(t[i])||(t[i]=[]),et(e[i])){var n=e[i].length;t[i].length!==n&&(t[i]=new e[i].constructor(n),Wo(t[i],e[i],n))}else{var r=e[i],o=t[i],a=r.length;if(Vo(r))for(var s=r[0].length,l=0;l<a;l++)o[l]?Wo(o[l],r[l],s):o[l]=Array.prototype.slice.call(r[l]);else Wo(o,r,a);o.length=r.length}else t[i]=e[i]}function Go(t,e){return t===e||B(t)&&B(e)&&qo(t,e)}function qo(t,e){var i=t.length;if(i!==e.length)return!1;for(var n=0;n<i;n++)if(t[n]!==e[n])return!1;return!0}function Zo(t,e,i,n,r,o,a,s){for(var l=U(n),h=r.duration,u=r.delay,c=r.additive,p=r.setToFinal,f=!J(o),d=t.animators,v=[],g=0;g<l.length;g++){var y=l[g],m=n[y];if(null!=m&&null!=i[y]&&(f||o[y]))if(!J(m)||B(m)||nt(m))v.push(y);else{if(e){s||(i[y]=m,t.updateDuringAnimation(e));continue}Zo(t,y,i[y],m,r,o&&o[y],a,s)}else s||(i[y]=m,t.updateDuringAnimation(e),v.push(y))}var w=v.length;if(!c&&w)for(var x=0;x<d.length;x++)if((_=d[x]).targetName===e&&_.stopTracks(v)){var b=L(d,_);d.splice(b,1)}if(r.force||(w=(v=W(v,function(t){return!Go(n[t],i[t])})).length),w>0||r.force&&!a.length){var _,T=void 0,S=void 0,P=void 0;if(s)for(S={},p&&(T={}),x=0;x<w;x++)S[y=v[x]]=i[y],p?T[y]=n[y]:i[y]=n[y];else if(p)for(P={},x=0;x<w;x++)P[y=v[x]]=br(i[y]),Uo(i,n,y);(_=new Lr(i,!1,!1,c?W(d,function(t){return t.targetName===e}):null)).targetName=e,r.scope&&(_.scope=r.scope),p&&T&&_.whenWithKeys(0,T,v),P&&_.whenWithKeys(0,P,v),_.whenWithKeys(null==h?500:h,s?S:n,v).delay(u||0),t.addAnimator(_,e),a.push(_)}}j(No,ae),j(No,xo);var Xo=function(t){function e(e){var i=t.call(this)||this;return i.isGroup=!0,i._children=[],i.attr(e),i}return It(e,t),e.prototype.childrenRef=function(){return this._children},e.prototype.children=function(){return this._children.slice()},e.prototype.childAt=function(t){return this._children[t]},e.prototype.childOfName=function(t){for(var e=this._children,i=0;i<e.length;i++)if(e[i].name===t)return e[i]},e.prototype.childCount=function(){return this._children.length},e.prototype.add=function(t){if(t&&(t!==this&&t.parent!==this&&(this._children.push(t),this._doAdd(t)),t.__hostTarget))throw"This elemenet has been used as an attachment";return this},e.prototype.addBefore=function(t,e){if(t&&t!==this&&t.parent!==this&&e&&e.parent===this){var i=this._children,n=i.indexOf(e);n>=0&&(i.splice(n,0,t),this._doAdd(t))}return this},e.prototype.replace=function(t,e){var i=L(this._children,t);return i>=0&&this.replaceAt(e,i),this},e.prototype.replaceAt=function(t,e){var i=this._children,n=i[e];if(t&&t!==this&&t.parent!==this&&t!==n){i[e]=t,n.parent=null;var r=this.__zr;r&&n.removeSelfFromZr(r),this._doAdd(t)}return this},e.prototype._doAdd=function(t){t.parent&&t.parent.remove(t),t.parent=this;var e=this.__zr;e&&e!==t.__zr&&t.addSelfToZr(e),e&&e.refresh()},e.prototype.remove=function(t){var e=this.__zr,i=this._children,n=L(i,t);return n<0||(i.splice(n,1),t.parent=null,e&&t.removeSelfFromZr(e),e&&e.refresh()),this},e.prototype.removeAll=function(){for(var t=this._children,e=this.__zr,i=0;i<t.length;i++){var n=t[i];e&&n.removeSelfFromZr(e),n.parent=null}return t.length=0,this},e.prototype.eachChild=function(t,e){for(var i=this._children,n=0;n<i.length;n++){var r=i[n];t.call(e,r,n)}return this},e.prototype.traverse=function(t,e){for(var i=0;i<this._children.length;i++){var n=this._children[i],r=t.call(e,n);n.isGroup&&!r&&n.traverse(t,e)}return this},e.prototype.addSelfToZr=function(e){t.prototype.addSelfToZr.call(this,e);for(var i=0;i<this._children.length;i++)this._children[i].addSelfToZr(e)},e.prototype.removeSelfFromZr=function(e){t.prototype.removeSelfFromZr.call(this,e);for(var i=0;i<this._children.length;i++)this._children[i].removeSelfFromZr(e)},e.prototype.getBoundingRect=function(t){for(var e=new ni(0,0,0,0),i=t||this._children,n=[],r=null,o=0;o<i.length;o++){var a=i[o];if(!a.ignore&&!a.invisible){var s=a.getBoundingRect(),l=a.getLocalTransform(n);l?(ni.applyTransform(e,s,l),(r=r||e.clone()).union(e)):(r=r||s.clone()).union(s)}}return r||e},e}(No);Xo.prototype.type="group";var Yo={},$o={};function Ko(t){delete $o[t]}function Qo(t){if(!t)return!1;if("string"==typeof t)return Hn(t,1)<so;if(t.colorStops){for(var e=t.colorStops,i=0,n=e.length,r=0;r<n;r++)i+=Hn(e[r].color,1);return(i/=n)<so}return!1}var Jo,ta=function(){function t(t,e,n){var r=this;this._sleepAfterStill=10,this._stillFrameAccum=0,this._needsRefresh=!0,this._needsRefreshHover=!0,this._darkMode=!1,n=n||{},this.dom=e,this.id=t;var o=new Li,a=n.renderer||"canvas";if(Yo[a]||(a=U(Yo)[0]),!Yo[a])throw new Error("Renderer '"+a+"' is not imported. Please import it first.");n.useDirtyRect=null!=n.useDirtyRect&&n.useDirtyRect;var s=new Yo[a](e,o,n,t),l=n.ssr||s.ssrOnly;this.storage=o,this.painter=s;var h,u=i.node||i.worker||l?null:new ro(s.getViewportRoot(),s.root),c=n.useCoarsePointer,p=44;(null==c||"auto"===c?i.touchEventsSupported:!!c)&&(h=lt(n.pointerSize,p)),this.handler=new vi(o,s,u,s.root,h),this.animation=new Fr({stage:{update:l?null:function(){return r._flush(!0)}}}),l||this.animation.start()}return t.prototype.add=function(t){!this._disposed&&t&&(this.storage.addRoot(t),t.addSelfToZr(this),this.refresh())},t.prototype.remove=function(t){!this._disposed&&t&&(this.storage.delRoot(t),t.removeSelfFromZr(this),this.refresh())},t.prototype.configLayer=function(t,e){this._disposed||(this.painter.configLayer&&this.painter.configLayer(t,e),this.refresh())},t.prototype.setBackgroundColor=function(t){this._disposed||(this.painter.setBackgroundColor&&this.painter.setBackgroundColor(t),this.refresh(),this._backgroundColor=t,this._darkMode=Qo(t))},t.prototype.getBackgroundColor=function(){return this._backgroundColor},t.prototype.setDarkMode=function(t){this._darkMode=t},t.prototype.isDarkMode=function(){return this._darkMode},t.prototype.refreshImmediately=function(t){this._disposed||(t||this.animation.update(!0),this._needsRefresh=!1,this.painter.refresh(),this._needsRefresh=!1)},t.prototype.refresh=function(){this._disposed||(this._needsRefresh=!0,this.animation.start())},t.prototype.flush=function(){this._disposed||this._flush(!1)},t.prototype._flush=function(t){var e,i=zr();this._needsRefresh&&(e=!0,this.refreshImmediately(t)),this._needsRefreshHover&&(e=!0,this.refreshHoverImmediately());var n=zr();e?(this._stillFrameAccum=0,this.trigger("rendered",{elapsedTime:n-i})):this._sleepAfterStill>0&&(this._stillFrameAccum++,this._stillFrameAccum>this._sleepAfterStill&&this.animation.stop())},t.prototype.setSleepAfterStill=function(t){this._sleepAfterStill=t},t.prototype.wakeUp=function(){this._disposed||(this.animation.start(),this._stillFrameAccum=0)},t.prototype.refreshHover=function(){this._needsRefreshHover=!0},t.prototype.refreshHoverImmediately=function(){this._disposed||(this._needsRefreshHover=!1,this.painter.refreshHover&&"canvas"===this.painter.getType()&&this.painter.refreshHover())},t.prototype.resize=function(t){this._disposed||(t=t||{},this.painter.resize(t.width,t.height),this.handler.resize())},t.prototype.clearAnimation=function(){this._disposed||this.animation.clear()},t.prototype.getWidth=function(){if(!this._disposed)return this.painter.getWidth()},t.prototype.getHeight=function(){if(!this._disposed)return this.painter.getHeight()},t.prototype.setCursorStyle=function(t){this._disposed||this.handler.setCursorStyle(t)},t.prototype.findHover=function(t,e){if(!this._disposed)return this.handler.findHover(t,e)},t.prototype.on=function(t,e,i){return this._disposed||this.handler.on(t,e,i),this},t.prototype.off=function(t,e){this._disposed||this.handler.off(t,e)},t.prototype.trigger=function(t,e){this._disposed||this.handler.trigger(t,e)},t.prototype.clear=function(){if(!this._disposed){for(var t=this.storage.getRoots(),e=0;e<t.length;e++)t[e]instanceof Xo&&t[e].removeSelfFromZr(this);this.storage.delAllRoots(),this.painter.clear()}},t.prototype.dispose=function(){this._disposed||(this.animation.stop(),this.clear(),this.storage.dispose(),this.painter.dispose(),this.handler.dispose(),this.animation=this.storage=this.painter=this.handler=null,this._disposed=!0,Ko(this.id))},t}();function ea(t,e){var i=new ta(C(),t,e);return $o[i.id]=i,i}function ia(t){t.dispose()}function na(){for(var t in $o)$o.hasOwnProperty(t)&&$o[t].dispose();$o={}}function ra(t){return $o[t]}function oa(t,e){Yo[t]=e}function aa(t){if("function"==typeof Jo)return Jo(t)}function sa(t){Jo=t}var la="6.0.0",ha="__zr_style_"+Math.round(10*Math.random()),ua={shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"#000",opacity:1,blend:"source-over"},ca={style:{shadowBlur:!0,shadowOffsetX:!0,shadowOffsetY:!0,shadowColor:!0,opacity:!0}};ua[ha]=!0;var pa=["z","z2","invisible"],fa=["invisible"],da=function(t){function e(e){return t.call(this,e)||this}var i;return It(e,t),e.prototype._init=function(e){for(var i=U(e),n=0;n<i.length;n++){var r=i[n];"style"===r?this.useStyle(e[r]):t.prototype.attrKV.call(this,r,e[r])}this.style||this.useStyle({})},e.prototype.beforeBrush=function(){},e.prototype.afterBrush=function(){},e.prototype.innerBeforeBrush=function(){},e.prototype.innerAfterBrush=function(){},e.prototype.shouldBePainted=function(t,e,i,n){var r=this.transform;if(this.ignore||this.invisible||0===this.style.opacity||this.culling&&ya(this,t,e)||r&&!r[0]&&!r[3])return!1;if(i&&this.__clipPaths&&this.__clipPaths.length)for(var o=0;o<this.__clipPaths.length;++o)if(this.__clipPaths[o].isZeroArea())return!1;if(n&&this.parent)for(var a=this.parent;a;){if(a.ignore)return!1;a=a.parent}return!0},e.prototype.contain=function(t,e){return this.rectContain(t,e)},e.prototype.traverse=function(t,e){t.call(e,this)},e.prototype.rectContain=function(t,e){var i=this.transformCoordToLocal(t,e);return this.getBoundingRect().contain(i[0],i[1])},e.prototype.getPaintRect=function(){var t=this._paintRect;if(!this._paintRect||this.__dirty){var e=this.transform,i=this.getBoundingRect(),n=this.style,r=n.shadowBlur||0,o=n.shadowOffsetX||0,a=n.shadowOffsetY||0;t=this._paintRect||(this._paintRect=new ni(0,0,0,0)),e?ni.applyTransform(t,i,e):t.copy(i),(r||o||a)&&(t.width+=2*r+Math.abs(o),t.height+=2*r+Math.abs(a),t.x=Math.min(t.x,t.x+o-r),t.y=Math.min(t.y,t.y+a-r));var s=this.dirtyRectTolerance;t.isZero()||(t.x=Math.floor(t.x-s),t.y=Math.floor(t.y-s),t.width=Math.ceil(t.width+1+2*s),t.height=Math.ceil(t.height+1+2*s))}return t},e.prototype.setPrevPaintRect=function(t){t?(this._prevPaintRect=this._prevPaintRect||new ni(0,0,0,0),this._prevPaintRect.copy(t)):this._prevPaintRect=null},e.prototype.getPrevPaintRect=function(){return this._prevPaintRect},e.prototype.animateStyle=function(t){return this.animate("style",t)},e.prototype.updateDuringAnimation=function(t){"style"===t?this.dirtyStyle():this.markRedraw()},e.prototype.attrKV=function(e,i){"style"!==e?t.prototype.attrKV.call(this,e,i):this.style?this.setStyle(i):this.useStyle(i)},e.prototype.setStyle=function(t,e){return"string"==typeof t?this.style[t]=e:D(this.style,t),this.dirtyStyle(),this},e.prototype.dirtyStyle=function(t){t||this.markRedraw(),this.__dirty|=ki,this._rect&&(this._rect=null)},e.prototype.dirty=function(){this.dirtyStyle()},e.prototype.styleChanged=function(){return!!(this.__dirty&ki)},e.prototype.styleUpdated=function(){this.__dirty&=~ki},e.prototype.createStyle=function(t){return Tt(ua,t)},e.prototype.useStyle=function(t){t[ha]||(t=this.createStyle(t)),this.__inHover?this.__hoverStyle=t:this.style=t,this.dirtyStyle()},e.prototype.isStyleObject=function(t){return t[ha]},e.prototype._innerSaveToNormal=function(e){t.prototype._innerSaveToNormal.call(this,e);var i=this._normalState;e.style&&!i.style&&(i.style=this._mergeStyle(this.createStyle(),this.style)),this._savePrimaryToNormal(e,i,pa)},e.prototype._applyStateObj=function(e,i,n,r,o,a){t.prototype._applyStateObj.call(this,e,i,n,r,o,a);var s,l=!(i&&r);if(i&&i.style?o?r?s=i.style:(s=this._mergeStyle(this.createStyle(),n.style),this._mergeStyle(s,i.style)):(s=this._mergeStyle(this.createStyle(),r?this.style:n.style),this._mergeStyle(s,i.style)):l&&(s=n.style),s)if(o){var h=this.style;if(this.style=this.createStyle(l?{}:h),l)for(var u=U(h),c=0;c<u.length;c++)(f=u[c])in s&&(s[f]=s[f],this.style[f]=h[f]);var p=U(s);for(c=0;c<p.length;c++){var f=p[c];this.style[f]=this.style[f]}this._transitionState(e,{style:s},a,this.getAnimationStyleProps())}else this.useStyle(s);var d=this.__inHover?fa:pa;for(c=0;c<d.length;c++)f=d[c],i&&null!=i[f]?this[f]=i[f]:l&&null!=n[f]&&(this[f]=n[f])},e.prototype._mergeStates=function(e){for(var i,n=t.prototype._mergeStates.call(this,e),r=0;r<e.length;r++){var o=e[r];o.style&&(i=i||{},this._mergeStyle(i,o.style))}return i&&(n.style=i),n},e.prototype._mergeStyle=function(t,e){return D(t,e),t},e.prototype.getAnimationStyleProps=function(){return ca},e.initDefaultProps=((i=e.prototype).type="displayable",i.invisible=!1,i.z=0,i.z2=0,i.zlevel=0,i.culling=!1,i.cursor="pointer",i.rectHover=!1,i.incremental=!1,i._rect=null,i.dirtyRectTolerance=0,void(i.__dirty=Ri|ki)),e}(No),va=new ni(0,0,0,0),ga=new ni(0,0,0,0);function ya(t,e,i){return va.copy(t.getBoundingRect()),t.transform&&va.applyTransform(t.transform),ga.width=e,ga.height=i,!va.intersect(ga)}var ma=Math.min,wa=Math.max,xa=Math.sin,ba=Math.cos,_a=2*Math.PI,Ta=Dt(),Sa=Dt(),Pa=Dt();function Ea(t,e,i){if(0!==t.length){for(var n=t[0],r=n[0],o=n[0],a=n[1],s=n[1],l=1;l<t.length;l++)n=t[l],r=ma(r,n[0]),o=wa(o,n[0]),a=ma(a,n[1]),s=wa(s,n[1]);e[0]=r,e[1]=a,i[0]=o,i[1]=s}}function Ca(t,e,i,n,r,o){r[0]=ma(t,i),r[1]=ma(e,n),o[0]=wa(t,i),o[1]=wa(e,n)}var Oa=[],Ra=[];function ka(t,e,i,n,r,o,a,s,l,h){var u=Qi,c=Yi,p=u(t,i,r,a,Oa);l[0]=1/0,l[1]=1/0,h[0]=-1/0,h[1]=-1/0;for(var f=0;f<p;f++){var d=c(t,i,r,a,Oa[f]);l[0]=ma(d,l[0]),h[0]=wa(d,h[0])}for(p=u(e,n,o,s,Ra),f=0;f<p;f++){var v=c(e,n,o,s,Ra[f]);l[1]=ma(v,l[1]),h[1]=wa(v,h[1])}l[0]=ma(t,l[0]),h[0]=wa(t,h[0]),l[0]=ma(a,l[0]),h[0]=wa(a,h[0]),l[1]=ma(e,l[1]),h[1]=wa(e,h[1]),l[1]=ma(s,l[1]),h[1]=wa(s,h[1])}function Ia(t,e,i,n,r,o,a,s){var l=an,h=nn,u=wa(ma(l(t,i,r),1),0),c=wa(ma(l(e,n,o),1),0),p=h(t,i,r,u),f=h(e,n,o,c);a[0]=ma(t,r,p),a[1]=ma(e,o,f),s[0]=wa(t,r,p),s[1]=wa(e,o,f)}function Da(t,e,i,n,r,o,a,s,l){var h=ee,u=ie,c=Math.abs(r-o);if(c%_a<1e-4&&c>1e-4)return s[0]=t-i,s[1]=e-n,l[0]=t+i,void(l[1]=e+n);if(Ta[0]=ba(r)*i+t,Ta[1]=xa(r)*n+e,Sa[0]=ba(o)*i+t,Sa[1]=xa(o)*n+e,h(s,Ta,Sa),u(l,Ta,Sa),(r%=_a)<0&&(r+=_a),(o%=_a)<0&&(o+=_a),r>o&&!a?o+=_a:r<o&&a&&(r+=_a),a){var p=o;o=r,r=p}for(var f=0;f<o;f+=Math.PI/2)f>r&&(Pa[0]=ba(f)*i+t,Pa[1]=xa(f)*n+e,h(s,Pa,s),u(l,Pa,l))}var Ma={M:1,L:2,C:3,Q:4,A:5,Z:6,R:7},Aa=[],La=[],za=[],ja=[],Ba=[],Fa=[],Na=Math.min,Ha=Math.max,Wa=Math.cos,Va=Math.sin,Ua=Math.abs,Ga=Math.PI,qa=2*Ga,Za="undefined"!=typeof Float32Array,Xa=[];function Ya(t){return Math.round(t/Ga*1e8)/1e8%2*Ga}function $a(t,e){var i=Ya(t[0]);i<0&&(i+=qa);var n=i-t[0],r=t[1];r+=n,!e&&r-i>=qa?r=i+qa:e&&i-r>=qa?r=i-qa:!e&&i>r?r=i+(qa-Ya(i-r)):e&&i<r&&(r=i-(qa-Ya(r-i))),t[0]=i,t[1]=r}var Ka=function(){function t(t){this.dpr=1,this._xi=0,this._yi=0,this._x0=0,this._y0=0,this._len=0,t&&(this._saveData=!1),this._saveData&&(this.data=[])}var e;return t.prototype.increaseVersion=function(){this._version++},t.prototype.getVersion=function(){return this._version},t.prototype.setScale=function(t,e,i){(i=i||0)>0&&(this._ux=Ua(i/ao/t)||0,this._uy=Ua(i/ao/e)||0)},t.prototype.setDPR=function(t){this.dpr=t},t.prototype.setContext=function(t){this._ctx=t},t.prototype.getContext=function(){return this._ctx},t.prototype.beginPath=function(){return this._ctx&&this._ctx.beginPath(),this.reset(),this},t.prototype.reset=function(){this._saveData&&(this._len=0),this._pathSegLen&&(this._pathSegLen=null,this._pathLen=0),this._version++},t.prototype.moveTo=function(t,e){return this._drawPendingPt(),this.addData(Ma.M,t,e),this._ctx&&this._ctx.moveTo(t,e),this._x0=t,this._y0=e,this._xi=t,this._yi=e,this},t.prototype.lineTo=function(t,e){var i=Ua(t-this._xi),n=Ua(e-this._yi),r=i>this._ux||n>this._uy;if(this.addData(Ma.L,t,e),this._ctx&&r&&this._ctx.lineTo(t,e),r)this._xi=t,this._yi=e,this._pendingPtDist=0;else{var o=i*i+n*n;o>this._pendingPtDist&&(this._pendingPtX=t,this._pendingPtY=e,this._pendingPtDist=o)}return this},t.prototype.bezierCurveTo=function(t,e,i,n,r,o){return this._drawPendingPt(),this.addData(Ma.C,t,e,i,n,r,o),this._ctx&&this._ctx.bezierCurveTo(t,e,i,n,r,o),this._xi=r,this._yi=o,this},t.prototype.quadraticCurveTo=function(t,e,i,n){return this._drawPendingPt(),this.addData(Ma.Q,t,e,i,n),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,n),this._xi=i,this._yi=n,this},t.prototype.arc=function(t,e,i,n,r,o){this._drawPendingPt(),Xa[0]=n,Xa[1]=r,$a(Xa,o),n=Xa[0];var a=(r=Xa[1])-n;return this.addData(Ma.A,t,e,i,i,n,a,0,o?0:1),this._ctx&&this._ctx.arc(t,e,i,n,r,o),this._xi=Wa(r)*i+t,this._yi=Va(r)*i+e,this},t.prototype.arcTo=function(t,e,i,n,r){return this._drawPendingPt(),this._ctx&&this._ctx.arcTo(t,e,i,n,r),this},t.prototype.rect=function(t,e,i,n){return this._drawPendingPt(),this._ctx&&this._ctx.rect(t,e,i,n),this.addData(Ma.R,t,e,i,n),this},t.prototype.closePath=function(){this._drawPendingPt(),this.addData(Ma.Z);var t=this._ctx,e=this._x0,i=this._y0;return t&&t.closePath(),this._xi=e,this._yi=i,this},t.prototype.fill=function(t){t&&t.fill(),this.toStatic()},t.prototype.stroke=function(t){t&&t.stroke(),this.toStatic()},t.prototype.len=function(){return this._len},t.prototype.setData=function(t){if(this._saveData){var e=t.length;this.data&&this.data.length===e||!Za||(this.data=new Float32Array(e));for(var i=0;i<e;i++)this.data[i]=t[i];this._len=e}},t.prototype.appendPath=function(t){if(this._saveData){t instanceof Array||(t=[t]);for(var e=t.length,i=0,n=this._len,r=0;r<e;r++)i+=t[r].len();var o=this.data;if(Za&&(o instanceof Float32Array||!o)&&(this.data=new Float32Array(n+i),n>0&&o))for(var a=0;a<n;a++)this.data[a]=o[a];for(r=0;r<e;r++){var s=t[r].data;for(a=0;a<s.length;a++)this.data[n++]=s[a]}this._len=n}},t.prototype.addData=function(t,e,i,n,r,o,a,s,l){if(this._saveData){var h=this.data;this._len+arguments.length>h.length&&(this._expandData(),h=this.data);for(var u=0;u<arguments.length;u++)h[this._len++]=arguments[u]}},t.prototype._drawPendingPt=function(){this._pendingPtDist>0&&(this._ctx&&this._ctx.lineTo(this._pendingPtX,this._pendingPtY),this._pendingPtDist=0)},t.prototype._expandData=function(){if(!(this.data instanceof Array)){for(var t=[],e=0;e<this._len;e++)t[e]=this.data[e];this.data=t}},t.prototype.toStatic=function(){if(this._saveData){this._drawPendingPt();var t=this.data;t instanceof Array&&(t.length=this._len,Za&&this._len>11&&(this.data=new Float32Array(t)))}},t.prototype.getBoundingRect=function(){za[0]=za[1]=Ba[0]=Ba[1]=Number.MAX_VALUE,ja[0]=ja[1]=Fa[0]=Fa[1]=-Number.MAX_VALUE;var t,e=this.data,i=0,n=0,r=0,o=0;for(t=0;t<this._len;){var a=e[t++],s=1===t;switch(s&&(r=i=e[t],o=n=e[t+1]),a){case Ma.M:i=r=e[t++],n=o=e[t++],Ba[0]=r,Ba[1]=o,Fa[0]=r,Fa[1]=o;break;case Ma.L:Ca(i,n,e[t],e[t+1],Ba,Fa),i=e[t++],n=e[t++];break;case Ma.C:ka(i,n,e[t++],e[t++],e[t++],e[t++],e[t],e[t+1],Ba,Fa),i=e[t++],n=e[t++];break;case Ma.Q:Ia(i,n,e[t++],e[t++],e[t],e[t+1],Ba,Fa),i=e[t++],n=e[t++];break;case Ma.A:var l=e[t++],h=e[t++],u=e[t++],c=e[t++],p=e[t++],f=e[t++]+p;t+=1;var d=!e[t++];s&&(r=Wa(p)*u+l,o=Va(p)*c+h),Da(l,h,u,c,p,f,d,Ba,Fa),i=Wa(f)*u+l,n=Va(f)*c+h;break;case Ma.R:Ca(r=i=e[t++],o=n=e[t++],r+e[t++],o+e[t++],Ba,Fa);break;case Ma.Z:i=r,n=o}ee(za,za,Ba),ie(ja,ja,Fa)}return 0===t&&(za[0]=za[1]=ja[0]=ja[1]=0),new ni(za[0],za[1],ja[0]-za[0],ja[1]-za[1])},t.prototype._calculateLength=function(){var t=this.data,e=this._len,i=this._ux,n=this._uy,r=0,o=0,a=0,s=0;this._pathSegLen||(this._pathSegLen=[]);for(var l=this._pathSegLen,h=0,u=0,c=0;c<e;){var p=t[c++],f=1===c;f&&(a=r=t[c],s=o=t[c+1]);var d=-1;switch(p){case Ma.M:r=a=t[c++],o=s=t[c++];break;case Ma.L:var v=t[c++],g=(w=t[c++])-o;(Ua(R=v-r)>i||Ua(g)>n||c===e-1)&&(d=Math.sqrt(R*R+g*g),r=v,o=w);break;case Ma.C:var y=t[c++],m=t[c++],w=(v=t[c++],t[c++]),x=t[c++],b=t[c++];d=en(r,o,y,m,v,w,x,b,10),r=x,o=b;break;case Ma.Q:d=hn(r,o,y=t[c++],m=t[c++],v=t[c++],w=t[c++],10),r=v,o=w;break;case Ma.A:var _=t[c++],T=t[c++],S=t[c++],P=t[c++],E=t[c++],C=t[c++],O=C+E;c+=1,f&&(a=Wa(E)*S+_,s=Va(E)*P+T),d=Ha(S,P)*Na(qa,Math.abs(C)),r=Wa(O)*S+_,o=Va(O)*P+T;break;case Ma.R:a=r=t[c++],s=o=t[c++],d=2*t[c++]+2*t[c++];break;case Ma.Z:var R=a-r;g=s-o,d=Math.sqrt(R*R+g*g),r=a,o=s}d>=0&&(l[u++]=d,h+=d)}return this._pathLen=h,h},t.prototype.rebuildPath=function(t,e){var i,n,r,o,a,s,l,h,u,c,p=this.data,f=this._ux,d=this._uy,v=this._len,g=e<1,y=0,m=0,w=0;if(!g||(this._pathSegLen||this._calculateLength(),l=this._pathSegLen,h=e*this._pathLen))t:for(var x=0;x<v;){var b=p[x++],_=1===x;switch(_&&(i=r=p[x],n=o=p[x+1]),b!==Ma.L&&w>0&&(t.lineTo(u,c),w=0),b){case Ma.M:i=r=p[x++],n=o=p[x++],t.moveTo(r,o);break;case Ma.L:a=p[x++],s=p[x++];var T=Ua(a-r),S=Ua(s-o);if(T>f||S>d){if(g){if(y+(X=l[m++])>h){var P=(h-y)/X;t.lineTo(r*(1-P)+a*P,o*(1-P)+s*P);break t}y+=X}t.lineTo(a,s),r=a,o=s,w=0}else{var E=T*T+S*S;E>w&&(u=a,c=s,w=E)}break;case Ma.C:var C=p[x++],O=p[x++],R=p[x++],k=p[x++],I=p[x++],D=p[x++];if(g){if(y+(X=l[m++])>h){Ji(r,C,R,I,P=(h-y)/X,Aa),Ji(o,O,k,D,P,La),t.bezierCurveTo(Aa[1],La[1],Aa[2],La[2],Aa[3],La[3]);break t}y+=X}t.bezierCurveTo(C,O,R,k,I,D),r=I,o=D;break;case Ma.Q:if(C=p[x++],O=p[x++],R=p[x++],k=p[x++],g){if(y+(X=l[m++])>h){sn(r,C,R,P=(h-y)/X,Aa),sn(o,O,k,P,La),t.quadraticCurveTo(Aa[1],La[1],Aa[2],La[2]);break t}y+=X}t.quadraticCurveTo(C,O,R,k),r=R,o=k;break;case Ma.A:var M=p[x++],A=p[x++],L=p[x++],z=p[x++],j=p[x++],B=p[x++],F=p[x++],N=!p[x++],H=L>z?L:z,W=Ua(L-z)>.001,V=j+B,U=!1;if(g&&(y+(X=l[m++])>h&&(V=j+B*(h-y)/X,U=!0),y+=X),W&&t.ellipse?t.ellipse(M,A,L,z,F,j,V,N):t.arc(M,A,H,j,V,N),U)break t;_&&(i=Wa(j)*L+M,n=Va(j)*z+A),r=Wa(V)*L+M,o=Va(V)*z+A;break;case Ma.R:i=r=p[x],n=o=p[x+1],a=p[x++],s=p[x++];var G=p[x++],q=p[x++];if(g){if(y+(X=l[m++])>h){var Z=h-y;t.moveTo(a,s),t.lineTo(a+Na(Z,G),s),(Z-=G)>0&&t.lineTo(a+G,s+Na(Z,q)),(Z-=q)>0&&t.lineTo(a+Ha(G-Z,0),s+q),(Z-=G)>0&&t.lineTo(a,s+Ha(q-Z,0));break t}y+=X}t.rect(a,s,G,q);break;case Ma.Z:if(g){var X;if(y+(X=l[m++])>h){P=(h-y)/X,t.lineTo(r*(1-P)+i*P,o*(1-P)+n*P);break t}y+=X}t.closePath(),r=i,o=n}}},t.prototype.clone=function(){var e=new t,i=this.data;return e.data=i.slice?i.slice():Array.prototype.slice.call(i),e._len=this._len,e},t.prototype.canSave=function(){return!!this._saveData},t.CMD=Ma,t.initDefaultProps=((e=t.prototype)._saveData=!0,e._ux=0,e._uy=0,e._pendingPtDist=0,void(e._version=0)),t}();function Qa(t,e,i,n,r,o,a){if(0===r)return!1;var s=r,l=0;if(a>e+s&&a>n+s||a<e-s&&a<n-s||o>t+s&&o>i+s||o<t-s&&o<i-s)return!1;if(t===i)return Math.abs(o-t)<=s/2;var h=(l=(e-n)/(t-i))*o-a+(t*n-i*e)/(t-i);return h*h/(l*l+1)<=s/2*s/2}function Ja(t,e,i,n,r,o,a,s,l,h,u){if(0===l)return!1;var c=l;return!(u>e+c&&u>n+c&&u>o+c&&u>s+c||u<e-c&&u<n-c&&u<o-c&&u<s-c||h>t+c&&h>i+c&&h>r+c&&h>a+c||h<t-c&&h<i-c&&h<r-c&&h<a-c)&&tn(t,e,i,n,r,o,a,s,h,u,null)<=c/2}function ts(t,e,i,n,r,o,a,s,l){if(0===a)return!1;var h=a;return!(l>e+h&&l>n+h&&l>o+h||l<e-h&&l<n-h&&l<o-h||s>t+h&&s>i+h&&s>r+h||s<t-h&&s<i-h&&s<r-h)&&ln(t,e,i,n,r,o,s,l,null)<=h/2}var es=2*Math.PI;function is(t){return(t%=es)<0&&(t+=es),t}var ns=2*Math.PI;function rs(t,e,i,n,r,o,a,s,l){if(0===a)return!1;var h=a;s-=t,l-=e;var u=Math.sqrt(s*s+l*l);if(u-h>i||u+h<i)return!1;if(Math.abs(n-r)%ns<1e-4)return!0;if(o){var c=n;n=is(r),r=is(c)}else n=is(n),r=is(r);n>r&&(r+=ns);var p=Math.atan2(l,s);return p<0&&(p+=ns),p>=n&&p<=r||p+ns>=n&&p+ns<=r}function os(t,e,i,n,r,o){if(o>e&&o>n||o<e&&o<n)return 0;if(n===e)return 0;var a=(o-e)/(n-e),s=n<e?1:-1;1!==a&&0!==a||(s=n<e?.5:-.5);var l=a*(i-t)+t;return l===r?1/0:l>r?s:0}var as=Ka.CMD,ss=2*Math.PI,ls=1e-4;function hs(t,e){return Math.abs(t-e)<ls}var us=[-1,-1,-1],cs=[-1,-1];function ps(){var t=cs[0];cs[0]=cs[1],cs[1]=t}function fs(t,e,i,n,r,o,a,s,l,h){if(h>e&&h>n&&h>o&&h>s||h<e&&h<n&&h<o&&h<s)return 0;var u=Ki(e,n,o,s,h,us);if(0===u)return 0;for(var c=0,p=-1,f=void 0,d=void 0,v=0;v<u;v++){var g=us[v],y=0===g||1===g?.5:1;Yi(t,i,r,a,g)<l||(p<0&&(p=Qi(e,n,o,s,cs),cs[1]<cs[0]&&p>1&&ps(),f=Yi(e,n,o,s,cs[0]),p>1&&(d=Yi(e,n,o,s,cs[1]))),2===p?g<cs[0]?c+=f<e?y:-y:g<cs[1]?c+=d<f?y:-y:c+=s<d?y:-y:g<cs[0]?c+=f<e?y:-y:c+=s<f?y:-y)}return c}function ds(t,e,i,n,r,o,a,s){if(s>e&&s>n&&s>o||s<e&&s<n&&s<o)return 0;var l=on(e,n,o,s,us);if(0===l)return 0;var h=an(e,n,o);if(h>=0&&h<=1){for(var u=0,c=nn(e,n,o,h),p=0;p<l;p++){var f=0===us[p]||1===us[p]?.5:1;nn(t,i,r,us[p])<a||(us[p]<h?u+=c<e?f:-f:u+=o<c?f:-f)}return u}return f=0===us[0]||1===us[0]?.5:1,nn(t,i,r,us[0])<a?0:o<e?f:-f}function vs(t,e,i,n,r,o,a,s){if((s-=e)>i||s<-i)return 0;var l=Math.sqrt(i*i-s*s);us[0]=-l,us[1]=l;var h=Math.abs(n-r);if(h<1e-4)return 0;if(h>=ss-1e-4){n=0,r=ss;var u=o?1:-1;return a>=us[0]+t&&a<=us[1]+t?u:0}if(n>r){var c=n;n=r,r=c}n<0&&(n+=ss,r+=ss);for(var p=0,f=0;f<2;f++){var d=us[f];if(d+t>a){var v=Math.atan2(s,d);u=o?1:-1,v<0&&(v=ss+v),(v>=n&&v<=r||v+ss>=n&&v+ss<=r)&&(v>Math.PI/2&&v<1.5*Math.PI&&(u=-u),p+=u)}}return p}function gs(t,e,i,n,r){for(var o,a,s=t.data,l=t.len(),h=0,u=0,c=0,p=0,f=0,d=0;d<l;){var v=s[d++],g=1===d;switch(v===as.M&&d>1&&(i||(h+=os(u,c,p,f,n,r))),g&&(p=u=s[d],f=c=s[d+1]),v){case as.M:u=p=s[d++],c=f=s[d++];break;case as.L:if(i){if(Qa(u,c,s[d],s[d+1],e,n,r))return!0}else h+=os(u,c,s[d],s[d+1],n,r)||0;u=s[d++],c=s[d++];break;case as.C:if(i){if(Ja(u,c,s[d++],s[d++],s[d++],s[d++],s[d],s[d+1],e,n,r))return!0}else h+=fs(u,c,s[d++],s[d++],s[d++],s[d++],s[d],s[d+1],n,r)||0;u=s[d++],c=s[d++];break;case as.Q:if(i){if(ts(u,c,s[d++],s[d++],s[d],s[d+1],e,n,r))return!0}else h+=ds(u,c,s[d++],s[d++],s[d],s[d+1],n,r)||0;u=s[d++],c=s[d++];break;case as.A:var y=s[d++],m=s[d++],w=s[d++],x=s[d++],b=s[d++],_=s[d++];d+=1;var T=!!(1-s[d++]);o=Math.cos(b)*w+y,a=Math.sin(b)*x+m,g?(p=o,f=a):h+=os(u,c,o,a,n,r);var S=(n-y)*x/w+y;if(i){if(rs(y,m,x,b,b+_,T,e,S,r))return!0}else h+=vs(y,m,x,b,b+_,T,S,r);u=Math.cos(b+_)*w+y,c=Math.sin(b+_)*x+m;break;case as.R:if(p=u=s[d++],f=c=s[d++],o=p+s[d++],a=f+s[d++],i){if(Qa(p,f,o,f,e,n,r)||Qa(o,f,o,a,e,n,r)||Qa(o,a,p,a,e,n,r)||Qa(p,a,p,f,e,n,r))return!0}else h+=os(o,f,o,a,n,r),h+=os(p,a,p,f,n,r);break;case as.Z:if(i){if(Qa(u,c,p,f,e,n,r))return!0}else h+=os(u,c,p,f,n,r);u=p,c=f}}return i||hs(c,f)||(h+=os(u,c,p,f,n,r)||0),0!==h}function ys(t,e,i){return gs(t,0,!1,e,i)}function ms(t,e,i,n){return gs(t,e,!0,i,n)}var ws=M({fill:"#000",stroke:null,strokePercent:1,fillOpacity:1,strokeOpacity:1,lineDashOffset:0,lineWidth:1,lineCap:"butt",miterLimit:10,strokeNoScale:!1,strokeFirst:!1},ua),xs={style:M({fill:!0,stroke:!0,strokePercent:!0,fillOpacity:!0,strokeOpacity:!0,lineDashOffset:!0,lineWidth:!0,miterLimit:!0},ca.style)},bs=bo.concat(["invisible","culling","z","z2","zlevel","parent"]),_s=function(t){function e(e){return t.call(this,e)||this}var i;return It(e,t),e.prototype.update=function(){var i=this;t.prototype.update.call(this);var n=this.style;if(n.decal){var r=this._decalEl=this._decalEl||new e;r.buildPath===e.prototype.buildPath&&(r.buildPath=function(t){i.buildPath(t,i.shape)}),r.silent=!0;var o=r.style;for(var a in n)o[a]!==n[a]&&(o[a]=n[a]);o.fill=n.fill?n.decal:null,o.decal=null,o.shadowColor=null,n.strokeFirst&&(o.stroke=null);for(var s=0;s<bs.length;++s)r[bs[s]]=this[bs[s]];r.__dirty|=Ri}else this._decalEl&&(this._decalEl=null)},e.prototype.getDecalElement=function(){return this._decalEl},e.prototype._init=function(e){var i=U(e);this.shape=this.getDefaultShape();var n=this.getDefaultStyle();n&&this.useStyle(n);for(var r=0;r<i.length;r++){var o=i[r],a=e[o];"style"===o?this.style?D(this.style,a):this.useStyle(a):"shape"===o?D(this.shape,a):t.prototype.attrKV.call(this,o,a)}this.style||this.useStyle({})},e.prototype.getDefaultStyle=function(){return null},e.prototype.getDefaultShape=function(){return{}},e.prototype.canBeInsideText=function(){return this.hasFill()},e.prototype.getInsideTextFill=function(){var t=this.style.fill;if("none"!==t){if($(t)){var e=Hn(t,0);return e>.5?lo:e>.2?uo:ho}if(t)return ho}return lo},e.prototype.getInsideTextStroke=function(t){var e=this.style.fill;if($(e)){var i=this.__zr;if(!(!i||!i.isDarkMode())==Hn(t,0)<so)return e}},e.prototype.buildPath=function(t,e,i){},e.prototype.pathUpdated=function(){this.__dirty&=~Ii},e.prototype.getUpdatedPathProxy=function(t){return!this.path&&this.createPathProxy(),this.path.beginPath(),this.buildPath(this.path,this.shape,t),this.path},e.prototype.createPathProxy=function(){this.path=new Ka(!1)},e.prototype.hasStroke=function(){var t=this.style,e=t.stroke;return!(null==e||"none"===e||!(t.lineWidth>0))},e.prototype.hasFill=function(){var t=this.style.fill;return null!=t&&"none"!==t},e.prototype.getBoundingRect=function(){var t=this._rect,e=this.style,i=!t;if(i){var n=!1;this.path||(n=!0,this.createPathProxy());var r=this.path;(n||this.__dirty&Ii)&&(r.beginPath(),this.buildPath(r,this.shape,!1),this.pathUpdated()),t=r.getBoundingRect()}if(this._rect=t,this.hasStroke()&&this.path&&this.path.len()>0){var o=this._rectStroke||(this._rectStroke=t.clone());if(this.__dirty||i){o.copy(t);var a=e.strokeNoScale?this.getLineScale():1,s=e.lineWidth;if(!this.hasFill()){var l=this.strokeContainThreshold;s=Math.max(s,null==l?4:l)}a>1e-10&&(o.width+=s/a,o.height+=s/a,o.x-=s/a/2,o.y-=s/a/2)}return o}return t},e.prototype.contain=function(t,e){var i=this.transformCoordToLocal(t,e),n=this.getBoundingRect(),r=this.style;if(t=i[0],e=i[1],n.contain(t,e)){var o=this.path;if(this.hasStroke()){var a=r.lineWidth,s=r.strokeNoScale?this.getLineScale():1;if(s>1e-10&&(this.hasFill()||(a=Math.max(a,this.strokeContainThreshold)),ms(o,a/s,t,e)))return!0}if(this.hasFill())return ys(o,t,e)}return!1},e.prototype.dirtyShape=function(){this.__dirty|=Ii,this._rect&&(this._rect=null),this._decalEl&&this._decalEl.dirtyShape(),this.markRedraw()},e.prototype.dirty=function(){this.dirtyStyle(),this.dirtyShape()},e.prototype.animateShape=function(t){return this.animate("shape",t)},e.prototype.updateDuringAnimation=function(t){"style"===t?this.dirtyStyle():"shape"===t?this.dirtyShape():this.markRedraw()},e.prototype.attrKV=function(e,i){"shape"===e?this.setShape(i):t.prototype.attrKV.call(this,e,i)},e.prototype.setShape=function(t,e){var i=this.shape;return i||(i=this.shape={}),"string"==typeof t?i[t]=e:D(i,t),this.dirtyShape(),this},e.prototype.shapeChanged=function(){return!!(this.__dirty&Ii)},e.prototype.createStyle=function(t){return Tt(ws,t)},e.prototype._innerSaveToNormal=function(e){t.prototype._innerSaveToNormal.call(this,e);var i=this._normalState;e.shape&&!i.shape&&(i.shape=D({},this.shape))},e.prototype._applyStateObj=function(e,i,n,r,o,a){t.prototype._applyStateObj.call(this,e,i,n,r,o,a);var s,l=!(i&&r);if(i&&i.shape?o?r?s=i.shape:(s=D({},n.shape),D(s,i.shape)):(s=D({},r?this.shape:n.shape),D(s,i.shape)):l&&(s=n.shape),s)if(o){this.shape=D({},this.shape);for(var h={},u=U(s),c=0;c<u.length;c++){var p=u[c];"object"==typeof s[p]?this.shape[p]=s[p]:h[p]=s[p]}this._transitionState(e,{shape:h},a)}else this.shape=s,this.dirtyShape()},e.prototype._mergeStates=function(e){for(var i,n=t.prototype._mergeStates.call(this,e),r=0;r<e.length;r++){var o=e[r];o.shape&&(i=i||{},this._mergeStyle(i,o.shape))}return i&&(n.shape=i),n},e.prototype.getAnimationStyleProps=function(){return xs},e.prototype.isZeroArea=function(){return!1},e.extend=function(t){var i=function(e){function i(i){var n=e.call(this,i)||this;return t.init&&t.init.call(n,i),n}return It(i,e),i.prototype.getDefaultStyle=function(){return R(t.style)},i.prototype.getDefaultShape=function(){return R(t.shape)},i}(e);for(var n in t)"function"==typeof t[n]&&(i.prototype[n]=t[n]);return i},e.initDefaultProps=((i=e.prototype).type="path",i.strokeContainThreshold=5,i.segmentIgnoreThreshold=0,i.subPixelOptimize=!1,i.autoBatch=!1,void(i.__dirty=Ri|ki|Ii)),e}(da),Ts=Ka.CMD,Ss=[[],[],[]],Ps=Math.sqrt,Es=Math.atan2;function Cs(t,e){if(e){var i,n,r,o,a,s,l=t.data,h=t.len(),u=Ts.M,c=Ts.C,p=Ts.L,f=Ts.R,d=Ts.A,v=Ts.Q;for(r=0,o=0;r<h;){switch(i=l[r++],o=r,n=0,i){case u:case p:n=1;break;case c:n=3;break;case v:n=2;break;case d:var g=e[4],y=e[5],m=Ps(e[0]*e[0]+e[1]*e[1]),w=Ps(e[2]*e[2]+e[3]*e[3]),x=Es(-e[1]/w,e[0]/m);l[r]*=m,l[r++]+=g,l[r]*=w,l[r++]+=y,l[r++]*=m,l[r++]*=w,l[r++]+=x,l[r++]+=x,o=r+=2;break;case f:s[0]=l[r++],s[1]=l[r++],te(s,s,e),l[o++]=s[0],l[o++]=s[1],s[0]+=l[r++],s[1]+=l[r++],te(s,s,e),l[o++]=s[0],l[o++]=s[1]}for(a=0;a<n;a++){var b=Ss[a];b[0]=l[r++],b[1]=l[r++],te(b,b,e),l[o++]=b[0],l[o++]=b[1]}}t.increaseVersion()}}var Os=Math.sqrt,Rs=Math.sin,ks=Math.cos,Is=Math.PI;function Ds(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Ms(t,e){return(t[0]*e[0]+t[1]*e[1])/(Ds(t)*Ds(e))}function As(t,e){return(t[0]*e[1]<t[1]*e[0]?-1:1)*Math.acos(Ms(t,e))}function Ls(t,e,i,n,r,o,a,s,l,h,u){var c=l*(Is/180),p=ks(c)*(t-i)/2+Rs(c)*(e-n)/2,f=-1*Rs(c)*(t-i)/2+ks(c)*(e-n)/2,d=p*p/(a*a)+f*f/(s*s);d>1&&(a*=Os(d),s*=Os(d));var v=(r===o?-1:1)*Os((a*a*(s*s)-a*a*(f*f)-s*s*(p*p))/(a*a*(f*f)+s*s*(p*p)))||0,g=v*a*f/s,y=v*-s*p/a,m=(t+i)/2+ks(c)*g-Rs(c)*y,w=(e+n)/2+Rs(c)*g+ks(c)*y,x=As([1,0],[(p-g)/a,(f-y)/s]),b=[(p-g)/a,(f-y)/s],_=[(-1*p-g)/a,(-1*f-y)/s],T=As(b,_);if(Ms(b,_)<=-1&&(T=Is),Ms(b,_)>=1&&(T=0),T<0){var S=Math.round(T/Is*1e6)/1e6;T=2*Is+S%2*Is}u.addData(h,m,w,a,s,x,T,c,o)}var zs=/([mlvhzcqtsa])([^mlvhzcqtsa]*)/gi,js=/-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g;function Bs(t){var e=new Ka;if(!t)return e;var i,n=0,r=0,o=n,a=r,s=Ka.CMD,l=t.match(zs);if(!l)return e;for(var h=0;h<l.length;h++){for(var u=l[h],c=u.charAt(0),p=void 0,f=u.match(js)||[],d=f.length,v=0;v<d;v++)f[v]=parseFloat(f[v]);for(var g=0;g<d;){var y=void 0,m=void 0,w=void 0,x=void 0,b=void 0,_=void 0,T=void 0,S=n,P=r,E=void 0,C=void 0;switch(c){case"l":n+=f[g++],r+=f[g++],p=s.L,e.addData(p,n,r);break;case"L":n=f[g++],r=f[g++],p=s.L,e.addData(p,n,r);break;case"m":n+=f[g++],r+=f[g++],p=s.M,e.addData(p,n,r),o=n,a=r,c="l";break;case"M":n=f[g++],r=f[g++],p=s.M,e.addData(p,n,r),o=n,a=r,c="L";break;case"h":n+=f[g++],p=s.L,e.addData(p,n,r);break;case"H":n=f[g++],p=s.L,e.addData(p,n,r);break;case"v":r+=f[g++],p=s.L,e.addData(p,n,r);break;case"V":r=f[g++],p=s.L,e.addData(p,n,r);break;case"C":p=s.C,e.addData(p,f[g++],f[g++],f[g++],f[g++],f[g++],f[g++]),n=f[g-2],r=f[g-1];break;case"c":p=s.C,e.addData(p,f[g++]+n,f[g++]+r,f[g++]+n,f[g++]+r,f[g++]+n,f[g++]+r),n+=f[g-2],r+=f[g-1];break;case"S":y=n,m=r,E=e.len(),C=e.data,i===s.C&&(y+=n-C[E-4],m+=r-C[E-3]),p=s.C,S=f[g++],P=f[g++],n=f[g++],r=f[g++],e.addData(p,y,m,S,P,n,r);break;case"s":y=n,m=r,E=e.len(),C=e.data,i===s.C&&(y+=n-C[E-4],m+=r-C[E-3]),p=s.C,S=n+f[g++],P=r+f[g++],n+=f[g++],r+=f[g++],e.addData(p,y,m,S,P,n,r);break;case"Q":S=f[g++],P=f[g++],n=f[g++],r=f[g++],p=s.Q,e.addData(p,S,P,n,r);break;case"q":S=f[g++]+n,P=f[g++]+r,n+=f[g++],r+=f[g++],p=s.Q,e.addData(p,S,P,n,r);break;case"T":y=n,m=r,E=e.len(),C=e.data,i===s.Q&&(y+=n-C[E-4],m+=r-C[E-3]),n=f[g++],r=f[g++],p=s.Q,e.addData(p,y,m,n,r);break;case"t":y=n,m=r,E=e.len(),C=e.data,i===s.Q&&(y+=n-C[E-4],m+=r-C[E-3]),n+=f[g++],r+=f[g++],p=s.Q,e.addData(p,y,m,n,r);break;case"A":w=f[g++],x=f[g++],b=f[g++],_=f[g++],T=f[g++],Ls(S=n,P=r,n=f[g++],r=f[g++],_,T,w,x,b,p=s.A,e);break;case"a":w=f[g++],x=f[g++],b=f[g++],_=f[g++],T=f[g++],Ls(S=n,P=r,n+=f[g++],r+=f[g++],_,T,w,x,b,p=s.A,e)}}"z"!==c&&"Z"!==c||(p=s.Z,e.addData(p),n=o,r=a),i=p}return e.toStatic(),e}var Fs=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return It(e,t),e.prototype.applyTransform=function(t){},e}(_s);function Ns(t){return null!=t.setData}function Hs(t,e){var i=Bs(t),n=D({},e);return n.buildPath=function(t){var e,n=Ns(t);n&&t.canSave()?(t.appendPath(i),(e=t.getContext())&&t.rebuildPath(e,1)):(e=n?t.getContext():t)&&i.rebuildPath(e,1)},n.applyTransform=function(t){Cs(i,t),this.dirtyShape()},n}function Ws(t,e){return new Fs(Hs(t,e))}function Vs(t,e){var i=Hs(t,e);return function(t){function e(e){var n=t.call(this,e)||this;return n.applyTransform=i.applyTransform,n.buildPath=i.buildPath,n}return It(e,t),e}(Fs)}function Us(t,e){for(var i=[],n=t.length,r=0;r<n;r++){var o=t[r];i.push(o.getUpdatedPathProxy(!0))}var a=new _s(e);return a.createPathProxy(),a.buildPath=function(t){if(Ns(t)){t.appendPath(i);var e=t.getContext();e&&t.rebuildPath(e,1)}},a}function Gs(t,e){e=e||{};var i=new _s;return t.shape&&i.setShape(t.shape),i.setStyle(t.style),e.bakeTransform?Cs(i.path,t.getComputedTransform()):e.toLocal?i.setLocalTransform(t.getComputedTransform()):i.copyTransform(t),i.buildPath=t.buildPath,i.applyTransform=i.applyTransform,i.z=t.z,i.z2=t.z2,i.zlevel=t.zlevel,i}var qs=Object.freeze({__proto__:null,createFromString:Ws,extendFromString:Vs,mergePath:Us,clonePath:Gs}),Zs=M({x:0,y:0},ua),Xs={style:M({x:!0,y:!0,width:!0,height:!0,sx:!0,sy:!0,sWidth:!0,sHeight:!0},ca.style)};function Ys(t){return!!(t&&"string"!=typeof t&&t.width&&t.height)}var $s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return It(e,t),e.prototype.createStyle=function(t){return Tt(Zs,t)},e.prototype._getSize=function(t){var e=this.style,i=e[t];if(null!=i)return i;var n=Ys(e.image)?e.image:this.__image;if(!n)return 0;var r="width"===t?"height":"width",o=e[r];return null==o?n[t]:n[t]/n[r]*o},e.prototype.getWidth=function(){return this._getSize("width")},e.prototype.getHeight=function(){return this._getSize("height")},e.prototype.getAnimationStyleProps=function(){return Xs},e.prototype.getBoundingRect=function(){var t=this.style;return this._rect||(this._rect=new ni(t.x||0,t.y||0,this.getWidth(),this.getHeight())),this._rect},e}(da);$s.prototype.type="image";var Ks=function(){function t(){this.cx=0,this.cy=0,this.r=0}return t}(),Qs=function(t){function e(e){return t.call(this,e)||this}return It(e,t),e.prototype.getDefaultShape=function(){return new Ks},e.prototype.buildPath=function(t,e){t.moveTo(e.cx+e.r,e.cy),t.arc(e.cx,e.cy,e.r,0,2*Math.PI)},e}(_s);function Js(t,e){var i,n,r,o,a,s=e.x,l=e.y,h=e.width,u=e.height,c=e.r;h<0&&(s+=h,h=-h),u<0&&(l+=u,u=-u),"number"==typeof c?i=n=r=o=c:c instanceof Array?1===c.length?i=n=r=o=c[0]:2===c.length?(i=r=c[0],n=o=c[1]):3===c.length?(i=c[0],n=o=c[1],r=c[2]):(i=c[0],n=c[1],r=c[2],o=c[3]):i=n=r=o=0,i+n>h&&(i*=h/(a=i+n),n*=h/a),r+o>h&&(r*=h/(a=r+o),o*=h/a),n+r>u&&(n*=u/(a=n+r),r*=u/a),i+o>u&&(i*=u/(a=i+o),o*=u/a),t.moveTo(s+i,l),t.lineTo(s+h-n,l),0!==n&&t.arc(s+h-n,l+n,n,-Math.PI/2,0),t.lineTo(s+h,l+u-r),0!==r&&t.arc(s+h-r,l+u-r,r,0,Math.PI/2),t.lineTo(s+o,l+u),0!==o&&t.arc(s+o,l+u-o,o,Math.PI/2,Math.PI),t.lineTo(s,l+i),0!==i&&t.arc(s+i,l+i,i,Math.PI,1.5*Math.PI)}Qs.prototype.type="circle";var tl=Math.round;function el(t,e,i){if(e){var n=e.x1,r=e.x2,o=e.y1,a=e.y2;t.x1=n,t.x2=r,t.y1=o,t.y2=a;var s=i&&i.lineWidth;return s?(tl(2*n)===tl(2*r)&&(t.x1=t.x2=nl(n,s,!0)),tl(2*o)===tl(2*a)&&(t.y1=t.y2=nl(o,s,!0)),t):t}}function il(t,e,i){if(e){var n=e.x,r=e.y,o=e.width,a=e.height;t.x=n,t.y=r,t.width=o,t.height=a;var s=i&&i.lineWidth;return s?(t.x=nl(n,s,!0),t.y=nl(r,s,!0),t.width=Math.max(nl(n+o,s,!1)-t.x,0===o?0:1),t.height=Math.max(nl(r+a,s,!1)-t.y,0===a?0:1),t):t}}function nl(t,e,i){if(!e)return t;var n=tl(2*t);return(n+tl(e))%2==0?n/2:(n+(i?1:-1))/2}var rl=function(){function t(){this.x=0,this.y=0,this.width=0,this.height=0}return t}(),ol={},al=function(t){function e(e){return t.call(this,e)||this}return It(e,t),e.prototype.getDefaultShape=function(){return new rl},e.prototype.buildPath=function(t,e){var i,n,r,o;if(this.subPixelOptimize){var a=il(ol,e,this.style);i=a.x,n=a.y,r=a.width,o=a.height,a.r=e.r,e=a}else i=e.x,n=e.y,r=e.width,o=e.height;e.r?Js(t,e):t.rect(i,n,r,o)},e.prototype.isZeroArea=function(){return!this.shape.width||!this.shape.height},e}(_s);al.prototype.type="rect";var sl=function(){function t(){this.cx=0,this.cy=0,this.rx=0,this.ry=0}return t}(),ll=function(t){function e(e){return t.call(this,e)||this}return It(e,t),e.prototype.getDefaultShape=function(){return new sl},e.prototype.buildPath=function(t,e){var i=.5522848,n=e.cx,r=e.cy,o=e.rx,a=e.ry,s=o*i,l=a*i;t.moveTo(n-o,r),t.bezierCurveTo(n-o,r-l,n-s,r-a,n,r-a),t.bezierCurveTo(n+s,r-a,n+o,r-l,n+o,r),t.bezierCurveTo(n+o,r+l,n+s,r+a,n,r+a),t.bezierCurveTo(n-s,r+a,n-o,r+l,n-o,r),t.closePath()},e}(_s);ll.prototype.type="ellipse";var hl={},ul=function(){function t(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.percent=1}return t}(),cl=function(t){function e(e){return t.call(this,e)||this}return It(e,t),e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new ul},e.prototype.buildPath=function(t,e){var i,n,r,o;if(this.subPixelOptimize){var a=el(hl,e,this.style);i=a.x1,n=a.y1,r=a.x2,o=a.y2}else i=e.x1,n=e.y1,r=e.x2,o=e.y2;var s=e.percent;0!==s&&(t.moveTo(i,n),s<1&&(r=i*(1-s)+r*s,o=n*(1-s)+o*s),t.lineTo(r,o))},e.prototype.pointAt=function(t){var e=this.shape;return[e.x1*(1-t)+e.x2*t,e.y1*(1-t)+e.y2*t]},e}(_s);function pl(t,e,i,n){var r,o,a,s,l=[],h=[],u=[],c=[];if(n){a=[1/0,1/0],s=[-1/0,-1/0];for(var p=0,f=t.length;p<f;p++)ee(a,a,t[p]),ie(s,s,t[p]);ee(a,a,n[0]),ie(s,s,n[1])}for(p=0,f=t.length;p<f;p++){var d=t[p];if(i)r=t[p?p-1:f-1],o=t[(p+1)%f];else{if(0===p||p===f-1){l.push(At(t[p]));continue}r=t[p-1],o=t[p+1]}Bt(h,o,r),qt(h,h,e);var v=Xt(d,r),g=Xt(d,o),y=v+g;0!==y&&(v/=y,g/=y),qt(u,h,-v),qt(c,h,g);var m=zt([],d,u),w=zt([],d,c);n&&(ie(m,m,a),ee(m,m,s),ie(w,w,a),ee(w,w,s)),l.push(m),l.push(w)}return i&&l.push(l.shift()),l}function fl(t,e,i){var n=e.smooth,r=e.points;if(r&&r.length>=2){if(n){var o=pl(r,n,i,e.smoothConstraint);t.moveTo(r[0][0],r[0][1]);for(var a=r.length,s=0;s<(i?a:a-1);s++){var l=o[2*s],h=o[2*s+1],u=r[(s+1)%a];t.bezierCurveTo(l[0],l[1],h[0],h[1],u[0],u[1])}}else{t.moveTo(r[0][0],r[0][1]),s=1;for(var c=r.length;s<c;s++)t.lineTo(r[s][0],r[s][1])}i&&t.closePath()}}cl.prototype.type="line";var dl=function(){function t(){this.points=null,this.smooth=0,this.smoothConstraint=null}return t}(),vl=function(t){function e(e){return t.call(this,e)||this}return It(e,t),e.prototype.getDefaultShape=function(){return new dl},e.prototype.buildPath=function(t,e){fl(t,e,!0)},e}(_s);vl.prototype.type="polygon";var gl=function(){function t(){this.points=null,this.percent=1,this.smooth=0,this.smoothConstraint=null}return t}(),yl=function(t){function e(e){return t.call(this,e)||this}return It(e,t),e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new gl},e.prototype.buildPath=function(t,e){fl(t,e,!1)},e}(_s);yl.prototype.type="polyline";var ml=function(){function t(t){this.colorStops=t||[]}return t.prototype.addColorStop=function(t,e){this.colorStops.push({offset:t,color:e})},t}(),wl=function(t){function e(e,i,n,r,o,a){var s=t.call(this,o)||this;return s.x=null==e?0:e,s.y=null==i?0:i,s.x2=null==n?1:n,s.y2=null==r?0:r,s.type="linear",s.global=a||!1,s}return It(e,t),e}(ml),xl=function(t){function e(e,i,n,r,o){var a=t.call(this,r)||this;return a.x=null==e?.5:e,a.y=null==i?.5:i,a.r=null==n?.5:n,a.type="radial",a.global=o||!1,a}return It(e,t),e}(ml),bl=new vn(50);function _l(t){if("string"==typeof t){var e=bl.get(t);return e&&e.image}return t}function Tl(t,e,i,n,r){if(t){if("string"==typeof t){if(e&&e.__zrImageSrc===t||!i)return e;var o=bl.get(t),a={hostEl:i,cb:n,cbPayload:r};return o?!Pl(e=o.image)&&o.pending.push(a):((e=f.loadImage(t,Sl,Sl)).__zrImageSrc=t,bl.put(t,e.__cachedImgObj={image:e,pending:[a]})),e}return t}return e}function Sl(){var t=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var e=0;e<t.pending.length;e++){var i=t.pending[e],n=i.cb;n&&n(this,i.cbPayload),i.hostEl.dirty()}t.pending.length=0}function Pl(t){return t&&t.width&&t.height}var El=/\{([a-zA-Z0-9_]+)\|([^}]*)\}/g;function Cl(t,e,i,n,r,o){if(!i)return t.text="",void(t.isTruncated=!1);var a=(e+"").split("\n");o=Ol(i,n,r,o);for(var s=!1,l={},h=0,u=a.length;h<u;h++)Rl(l,a[h],o),a[h]=l.textLine,s=s||l.isTruncated;t.text=a.join("\n"),t.isTruncated=s}function Ol(t,e,i,n){var r=D({},n=n||{});i=lt(i,"..."),r.maxIterations=lt(n.maxIterations,2);var o=r.minChar=lt(n.minChar,0),a=r.fontMeasureInfo=To(e),s=a.asciiCharWidth;r.placeholder=lt(n.placeholder,"");for(var l=t=Math.max(0,t-1),h=0;h<o&&l>=s;h++)l-=s;var u=Oo(a,i);return u>l&&(i="",u=0),l=t-u,r.ellipsis=i,r.ellipsisWidth=u,r.contentWidth=l,r.containerWidth=t,r}function Rl(t,e,i){var n=i.containerWidth,r=i.contentWidth,o=i.fontMeasureInfo;if(!n)return t.textLine="",void(t.isTruncated=!1);var a=Oo(o,e);if(a<=n)return t.textLine=e,void(t.isTruncated=!1);for(var s=0;;s++){if(a<=r||s>=i.maxIterations){e+=i.ellipsis;break}var l=0===s?kl(e,r,o):a>0?Math.floor(e.length*r/a):0;a=Oo(o,e=e.substr(0,l))}""===e&&(e=i.placeholder),t.textLine=e,t.isTruncated=!0}function kl(t,e,i){for(var n=0,r=0,o=t.length;r<o&&n<e;r++)n+=Co(i,t.charCodeAt(r));return r}function Il(t,e,i,n){var r=Ul(t),o=e.overflow,a=e.padding,s=a?a[1]+a[3]:0,l=a?a[0]+a[2]:0,h=e.font,u="truncate"===o,c=Io(h),p=lt(e.lineHeight,c),f="truncate"===e.lineOverflow,d=!1,v=e.width;null==v&&null!=i&&(v=i-s);var g,y=e.height;null==y&&null!=n&&(y=n-l);var m=(g=null==v||"break"!==o&&"breakAll"!==o?r?r.split("\n"):[]:r?Nl(r,e.font,v,"breakAll"===o,0).lines:[]).length*p;if(null==y&&(y=m),m>y&&f){var w=Math.floor(y/p);d=d||g.length>w,m=(g=g.slice(0,w)).length*p}if(r&&u&&null!=v)for(var x=Ol(v,h,e.ellipsis,{minChar:e.truncateMinChar,placeholder:e.placeholder}),b={},_=0;_<g.length;_++)Rl(b,g[_],x),g[_]=b.textLine,d=d||b.isTruncated;var T=y,S=0,P=To(h);for(_=0;_<g.length;_++)S=Math.max(Oo(P,g[_]),S);null==v&&(v=S);var E=v;return{lines:g,height:y,outerWidth:E+=s,outerHeight:T+=l,lineHeight:p,calculatedLineHeight:c,contentWidth:S,contentHeight:m,width:v,isTruncated:d}}var Dl=function(){function t(){}return t}(),Ml=function(){function t(t){this.tokens=[],t&&(this.tokens=t)}return t}(),Al=function(){function t(){this.width=0,this.height=0,this.contentWidth=0,this.contentHeight=0,this.outerWidth=0,this.outerHeight=0,this.lines=[],this.isTruncated=!1}return t}();function Ll(t,e,i,n,r){var o=new Al,a=Ul(t);if(!a)return o;var s=e.padding,l=s?s[1]+s[3]:0,h=s?s[0]+s[2]:0,u=e.width;null==u&&null!=i&&(u=i-l);var c=e.height;null==c&&null!=n&&(c=n-h);for(var p,f=e.overflow,d="break"!==f&&"breakAll"!==f||null==u?null:{width:u,accumWidth:0,breakAll:"breakAll"===f},v=El.lastIndex=0;null!=(p=El.exec(a));){var g=p.index;g>v&&zl(o,a.substring(v,g),e,d),zl(o,p[2],e,d,p[1]),v=El.lastIndex}v<a.length&&zl(o,a.substring(v,a.length),e,d);var y=[],m=0,w=0,x="truncate"===f,b="truncate"===e.lineOverflow,_={};function T(t,e,i){t.width=e,t.lineHeight=i,m+=i,w=Math.max(w,e)}t:for(var S=0;S<o.lines.length;S++){for(var P=o.lines[S],E=0,C=0,O=0;O<P.tokens.length;O++){var R=(N=P.tokens[O]).styleName&&e.rich[N.styleName]||{},k=N.textPadding=R.padding,I=k?k[1]+k[3]:0,D=N.font=R.font||e.font;N.contentHeight=Io(D);var M=lt(R.height,N.contentHeight);if(N.innerHeight=M,k&&(M+=k[0]+k[2]),N.height=M,N.lineHeight=ht(R.lineHeight,e.lineHeight,M),N.align=R&&R.align||r,N.verticalAlign=R&&R.verticalAlign||"middle",b&&null!=c&&m+N.lineHeight>c){var A=o.lines.length;O>0?(P.tokens=P.tokens.slice(0,O),T(P,C,E),o.lines=o.lines.slice(0,S+1)):o.lines=o.lines.slice(0,S),o.isTruncated=o.isTruncated||o.lines.length<A;break t}var L=R.width,z=null==L||"auto"===L;if("string"==typeof L&&"%"===L.charAt(L.length-1))N.percentWidth=L,y.push(N),N.contentWidth=Oo(To(D),N.text);else{if(z){var j=R.backgroundColor,B=j&&j.image;B&&Pl(B=_l(B))&&(N.width=Math.max(N.width,B.width*M/B.height))}var F=x&&null!=u?u-C:null;null!=F&&F<N.width?!z||F<I?(N.text="",N.width=N.contentWidth=0):(Cl(_,N.text,F-I,D,e.ellipsis,{minChar:e.truncateMinChar}),N.text=_.text,o.isTruncated=o.isTruncated||_.isTruncated,N.width=N.contentWidth=Oo(To(D),N.text)):N.contentWidth=Oo(To(D),N.text)}N.width+=I,C+=N.width,R&&(E=Math.max(E,N.lineHeight))}T(P,C,E)}for(o.outerWidth=o.width=lt(u,w),o.outerHeight=o.height=lt(c,m),o.contentHeight=m,o.contentWidth=w,o.outerWidth+=l,o.outerHeight+=h,S=0;S<y.length;S++){var N,H=(N=y[S]).percentWidth;N.width=parseInt(H,10)/100*o.width}return o}function zl(t,e,i,n,r){var o,a,s=""===e,l=r&&i.rich[r]||{},h=t.lines,u=l.font||i.font,c=!1;if(n){var p=l.padding,f=p?p[1]+p[3]:0;if(null!=l.width&&"auto"!==l.width){var d=Do(l.width,n.width)+f;h.length>0&&d+n.accumWidth>n.width&&(o=e.split("\n"),c=!0),n.accumWidth=d}else{var v=Nl(e,u,n.width,n.breakAll,n.accumWidth);n.accumWidth=v.accumWidth+f,a=v.linesWidths,o=v.lines}}o||(o=e.split("\n"));for(var g=To(u),y=0;y<o.length;y++){var m=o[y],w=new Dl;if(w.styleName=r,w.text=m,w.isLineHolder=!m&&!s,"number"==typeof l.width?w.width=l.width:w.width=a?a[y]:Oo(g,m),y||c)h.push(new Ml([w]));else{var x=(h[h.length-1]||(h[0]=new Ml)).tokens,b=x.length;1===b&&x[0].isLineHolder?x[0]=w:(m||!b||s)&&x.push(w)}}}function jl(t){var e=t.charCodeAt(0);return e>=32&&e<=591||e>=880&&e<=4351||e>=4608&&e<=5119||e>=7680&&e<=8303}var Bl=H(",&?/;] ".split(""),function(t,e){return t[e]=!0,t},{});function Fl(t){return!jl(t)||!!Bl[t]}function Nl(t,e,i,n,r){for(var o=[],a=[],s="",l="",h=0,u=0,c=To(e),p=0;p<t.length;p++){var f=t.charAt(p);if("\n"!==f){var d=Co(c,f.charCodeAt(0)),v=!n&&!Fl(f);(o.length?u+d>i:r+u+d>i)?u?(s||l)&&(v?(s||(s=l,l="",u=h=0),o.push(s),a.push(u-h),l+=f,s="",u=h+=d):(l&&(s+=l,l="",h=0),o.push(s),a.push(u),s=f,u=d)):v?(o.push(l),a.push(h),l=f,h=d):(o.push(f),a.push(d)):(u+=d,v?(l+=f,h+=d):(l&&(s+=l,l="",h=0),s+=f))}else l&&(s+=l,u+=h),o.push(s),a.push(u),s="",l="",h=0,u=0}return l&&(s+=l),s&&(o.push(s),a.push(u)),1===o.length&&(u+=r),{accumWidth:u,lines:o,linesWidths:a}}function Hl(t,e,i,n,r,o){if(t.baseX=i,t.baseY=n,t.outerWidth=t.outerHeight=null,e){var a=2*e.width,s=2*e.height;ni.set(Wl,Ro(i,a,r),ko(n,s,o),a,s),ni.intersect(e,Wl,null,Vl);var l=Vl.outIntersectRect;t.outerWidth=l.width,t.outerHeight=l.height,t.baseX=Ro(l.x,l.width,r,!0),t.baseY=ko(l.y,l.height,o,!0)}}var Wl=new ni(0,0,0,0),Vl={outIntersectRect:{},clamp:!0};function Ul(t){return null!=t?t+="":t=""}function Gl(t){var e=Ul(t.text),i=t.font;return ql(t,Oo(To(i),e),Io(i),null)}function ql(t,e,i,n){var r=new ni(Ro(t.x||0,e,t.textAlign),ko(t.y||0,i,t.textBaseline),e,i),o=null!=n?n:Zl(t)?t.lineWidth:0;return o>0&&(r.x-=o/2,r.y-=o/2,r.width+=o,r.height+=o),r}function Zl(t){var e=t.stroke;return null!=e&&"none"!==e&&t.lineWidth>0}var Xl,Yl=M({strokeFirst:!0,font:a,x:0,y:0,textAlign:"left",textBaseline:"top",miterLimit:2},ws),$l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return It(e,t),e.prototype.hasStroke=function(){return Zl(this.style)},e.prototype.hasFill=function(){var t=this.style.fill;return null!=t&&"none"!==t},e.prototype.createStyle=function(t){return Tt(Yl,t)},e.prototype.setBoundingRect=function(t){this._rect=t},e.prototype.getBoundingRect=function(){return this._rect||(this._rect=Gl(this.style)),this._rect},e.initDefaultProps=void(e.prototype.dirtyRectTolerance=10),e}(da);function Kl(t){$(t)&&(t=(new DOMParser).parseFromString(t,"text/xml"));var e=t;for(9===e.nodeType&&(e=e.firstChild);"svg"!==e.nodeName.toLowerCase()||1!==e.nodeType;)e=e.nextSibling;return e}$l.prototype.type="tspan";var Ql={fill:"fill",stroke:"stroke","stroke-width":"lineWidth",opacity:"opacity","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-miterlimit":"miterLimit","font-family":"fontFamily","font-size":"fontSize","font-style":"fontStyle","font-weight":"fontWeight","text-anchor":"textAlign",visibility:"visibility",display:"display"},Jl=U(Ql),th={"alignment-baseline":"textBaseline","stop-color":"stopColor"},eh=U(th),ih=function(){function t(){this._defs={},this._root=null}return t.prototype.parse=function(t,e){e=e||{};var i=Kl(t);if(!i)throw new Error("Illegal svg");this._defsUsePending=[];var n=new Xo;this._root=n;var r=[],o=i.getAttribute("viewBox")||"",a=parseFloat(i.getAttribute("width")||e.width),s=parseFloat(i.getAttribute("height")||e.height);isNaN(a)&&(a=null),isNaN(s)&&(s=null),lh(i,n,null,!0,!1);for(var l,h,u=i.firstChild;u;)this._parseNode(u,n,r,null,!1,!1),u=u.nextSibling;if(ph(this._defs,this._defsUsePending),this._defsUsePending=[],o){var c=dh(o);c.length>=4&&(l={x:parseFloat(c[0]||0),y:parseFloat(c[1]||0),width:parseFloat(c[2]),height:parseFloat(c[3])})}if(l&&null!=a&&null!=s&&(h=bh(l,{x:0,y:0,width:a,height:s}),!e.ignoreViewBox)){var p=n;(n=new Xo).add(p),p.scaleX=p.scaleY=h.scale,p.x=h.x,p.y=h.y}return e.ignoreRootClip||null==a||null==s||n.setClipPath(new al({shape:{x:0,y:0,width:a,height:s}})),{root:n,width:a,height:s,viewBoxRect:l,viewBoxTransform:h,named:r}},t.prototype._parseNode=function(t,e,i,n,r,o){var a,s=t.nodeName.toLowerCase(),l=n;if("defs"===s&&(r=!0),"text"===s&&(o=!0),"defs"===s||"switch"===s)a=e;else{if(!r){var h=Xl[s];if(h&&Pt(Xl,s)){a=h.call(this,t,e);var u=t.getAttribute("name");if(u){var c={name:u,namedFrom:null,svgNodeTagLower:s,el:a};i.push(c),"g"===s&&(l=c)}else n&&i.push({name:n.name,namedFrom:n,svgNodeTagLower:s,el:a});e.add(a)}}var p=nh[s];if(p&&Pt(nh,s)){var f=p.call(this,t),d=t.getAttribute("id");d&&(this._defs[d]=f)}}if(a&&a.isGroup)for(var v=t.firstChild;v;)1===v.nodeType?this._parseNode(v,a,i,l,r,o):3===v.nodeType&&o&&this._parseText(v,a),v=v.nextSibling},t.prototype._parseText=function(t,e){var i=new $l({style:{text:t.textContent},silent:!0,x:this._textX||0,y:this._textY||0});ah(e,i),lh(t,i,this._defsUsePending,!1,!1),hh(i,e);var n=i.style,r=n.fontSize;r&&r<9&&(n.fontSize=9,i.scaleX*=r/9,i.scaleY*=r/9);var o=(n.fontSize||n.fontFamily)&&[n.fontStyle,n.fontWeight,(n.fontSize||12)+"px",n.fontFamily||"sans-serif"].join(" ");n.font=o;var a=i.getBoundingRect();return this._textX+=a.width,e.add(i),i},t.internalField=void(Xl={g:function(t,e){var i=new Xo;return ah(e,i),lh(t,i,this._defsUsePending,!1,!1),i},rect:function(t,e){var i=new al;return ah(e,i),lh(t,i,this._defsUsePending,!1,!1),i.setShape({x:parseFloat(t.getAttribute("x")||"0"),y:parseFloat(t.getAttribute("y")||"0"),width:parseFloat(t.getAttribute("width")||"0"),height:parseFloat(t.getAttribute("height")||"0")}),i.silent=!0,i},circle:function(t,e){var i=new Qs;return ah(e,i),lh(t,i,this._defsUsePending,!1,!1),i.setShape({cx:parseFloat(t.getAttribute("cx")||"0"),cy:parseFloat(t.getAttribute("cy")||"0"),r:parseFloat(t.getAttribute("r")||"0")}),i.silent=!0,i},line:function(t,e){var i=new cl;return ah(e,i),lh(t,i,this._defsUsePending,!1,!1),i.setShape({x1:parseFloat(t.getAttribute("x1")||"0"),y1:parseFloat(t.getAttribute("y1")||"0"),x2:parseFloat(t.getAttribute("x2")||"0"),y2:parseFloat(t.getAttribute("y2")||"0")}),i.silent=!0,i},ellipse:function(t,e){var i=new ll;return ah(e,i),lh(t,i,this._defsUsePending,!1,!1),i.setShape({cx:parseFloat(t.getAttribute("cx")||"0"),cy:parseFloat(t.getAttribute("cy")||"0"),rx:parseFloat(t.getAttribute("rx")||"0"),ry:parseFloat(t.getAttribute("ry")||"0")}),i.silent=!0,i},polygon:function(t,e){var i,n=t.getAttribute("points");n&&(i=sh(n));var r=new vl({shape:{points:i||[]},silent:!0});return ah(e,r),lh(t,r,this._defsUsePending,!1,!1),r},polyline:function(t,e){var i,n=t.getAttribute("points");n&&(i=sh(n));var r=new yl({shape:{points:i||[]},silent:!0});return ah(e,r),lh(t,r,this._defsUsePending,!1,!1),r},image:function(t,e){var i=new $s;return ah(e,i),lh(t,i,this._defsUsePending,!1,!1),i.setStyle({image:t.getAttribute("xlink:href")||t.getAttribute("href"),x:+t.getAttribute("x"),y:+t.getAttribute("y"),width:+t.getAttribute("width"),height:+t.getAttribute("height")}),i.silent=!0,i},text:function(t,e){var i=t.getAttribute("x")||"0",n=t.getAttribute("y")||"0",r=t.getAttribute("dx")||"0",o=t.getAttribute("dy")||"0";this._textX=parseFloat(i)+parseFloat(r),this._textY=parseFloat(n)+parseFloat(o);var a=new Xo;return ah(e,a),lh(t,a,this._defsUsePending,!1,!0),a},tspan:function(t,e){var i=t.getAttribute("x"),n=t.getAttribute("y");null!=i&&(this._textX=parseFloat(i)),null!=n&&(this._textY=parseFloat(n));var r=t.getAttribute("dx")||"0",o=t.getAttribute("dy")||"0",a=new Xo;return ah(e,a),lh(t,a,this._defsUsePending,!1,!0),this._textX+=parseFloat(r),this._textY+=parseFloat(o),a},path:function(t,e){var i=Ws(t.getAttribute("d")||"");return ah(e,i),lh(t,i,this._defsUsePending,!1,!1),i.silent=!0,i}}),t}(),nh={lineargradient:function(t){var e=parseInt(t.getAttribute("x1")||"0",10),i=parseInt(t.getAttribute("y1")||"0",10),n=parseInt(t.getAttribute("x2")||"10",10),r=parseInt(t.getAttribute("y2")||"0",10),o=new wl(e,i,n,r);return rh(t,o),oh(t,o),o},radialgradient:function(t){var e=parseInt(t.getAttribute("cx")||"0",10),i=parseInt(t.getAttribute("cy")||"0",10),n=parseInt(t.getAttribute("r")||"0",10),r=new xl(e,i,n);return rh(t,r),oh(t,r),r}};function rh(t,e){"userSpaceOnUse"===t.getAttribute("gradientUnits")&&(e.global=!0)}function oh(t,e){for(var i=t.firstChild;i;){if(1===i.nodeType&&"stop"===i.nodeName.toLocaleLowerCase()){var n=i.getAttribute("offset"),r=void 0;r=n&&n.indexOf("%")>0?parseInt(n,10)/100:n?parseFloat(n):0;var o={};wh(i,o,o);var a=o.stopColor||i.getAttribute("stop-color")||"#000000",s=o.stopOpacity||i.getAttribute("stop-opacity");if(s){var l=Rn(a);l&&l[3]&&(l[3]*=bn(s),a=Nn(l,"rgba"))}e.colorStops.push({offset:r,color:a})}i=i.nextSibling}}function ah(t,e){t&&t.__inheritedStyle&&(e.__inheritedStyle||(e.__inheritedStyle={}),M(e.__inheritedStyle,t.__inheritedStyle))}function sh(t){for(var e=dh(t),i=[],n=0;n<e.length;n+=2){var r=parseFloat(e[n]),o=parseFloat(e[n+1]);i.push([r,o])}return i}function lh(t,e,i,n,r){var o=e,a=o.__inheritedStyle=o.__inheritedStyle||{},s={};1===t.nodeType&&(yh(t,e),wh(t,a,s),n||xh(t,a,s)),o.style=o.style||{},null!=a.fill&&(o.style.fill=ch(o,"fill",a.fill,i)),null!=a.stroke&&(o.style.stroke=ch(o,"stroke",a.stroke,i)),F(["lineWidth","opacity","fillOpacity","strokeOpacity","miterLimit","fontSize"],function(t){null!=a[t]&&(o.style[t]=parseFloat(a[t]))}),F(["lineDashOffset","lineCap","lineJoin","fontWeight","fontFamily","fontStyle","textAlign"],function(t){null!=a[t]&&(o.style[t]=a[t])}),r&&(o.__selfStyle=s),a.lineDash&&(o.style.lineDash=N(dh(a.lineDash),function(t){return parseFloat(t)})),"hidden"!==a.visibility&&"collapse"!==a.visibility||(o.invisible=!0),"none"===a.display&&(o.ignore=!0)}function hh(t,e){var i=e.__selfStyle;if(i){var n=i.textBaseline,r=n;n&&"auto"!==n?"baseline"===n?r="alphabetic":"before-edge"===n||"text-before-edge"===n?r="top":"after-edge"===n||"text-after-edge"===n?r="bottom":"central"!==n&&"mathematical"!==n||(r="middle"):r="alphabetic",t.style.textBaseline=r}var o=e.__inheritedStyle;if(o){var a=o.textAlign,s=a;a&&("middle"===a&&(s="center"),t.style.textAlign=s)}}var uh=/^url\(\s*#(.*?)\)/;function ch(t,e,i,n){var r=i&&i.match(uh);if(!r)return"none"===i&&(i=null),i;var o=ft(r[1]);n.push([t,e,o])}function ph(t,e){for(var i=0;i<e.length;i++){var n=e[i];n[0].style[n[1]]=t[n[2]]}}var fh=/-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g;function dh(t){return t.match(fh)||[]}var vh=/(translate|scale|rotate|skewX|skewY|matrix)\(([\-\s0-9\.eE,]*)\)/g,gh=Math.PI/180;function yh(t,e){var i=t.getAttribute("transform");if(i){i=i.replace(/,/g," ");var n=[],r=null;i.replace(vh,function(t,e,i){return n.push(e,i),""});for(var o=n.length-1;o>0;o-=2){var a=n[o],s=n[o-1],l=dh(a);switch(r=r||Me(),s){case"translate":je(r,r,[parseFloat(l[0]),parseFloat(l[1]||"0")]);break;case"scale":Fe(r,r,[parseFloat(l[0]),parseFloat(l[1]||l[0])]);break;case"rotate":Be(r,r,-parseFloat(l[0])*gh,[parseFloat(l[1]||"0"),parseFloat(l[2]||"0")]);break;case"skewX":ze(r,[1,0,Math.tan(parseFloat(l[0])*gh),1,0,0],r);break;case"skewY":ze(r,[1,Math.tan(parseFloat(l[0])*gh),0,1,0,0],r);break;case"matrix":r[0]=parseFloat(l[0]),r[1]=parseFloat(l[1]),r[2]=parseFloat(l[2]),r[3]=parseFloat(l[3]),r[4]=parseFloat(l[4]),r[5]=parseFloat(l[5])}}e.setLocalTransform(r)}}var mh=/([^\s:;]+)\s*:\s*([^:;]+)/g;function wh(t,e,i){var n,r=t.getAttribute("style");if(r)for(mh.lastIndex=0;null!=(n=mh.exec(r));){var o=n[1],a=Pt(Ql,o)?Ql[o]:null;a&&(e[a]=n[2]);var s=Pt(th,o)?th[o]:null;s&&(i[s]=n[2])}}function xh(t,e,i){for(var n=0;n<Jl.length;n++){var r=Jl[n];null!=(o=t.getAttribute(r))&&(e[Ql[r]]=o)}for(n=0;n<eh.length;n++){var o;r=eh[n],null!=(o=t.getAttribute(r))&&(i[th[r]]=o)}}function bh(t,e){var i=e.width/t.width,n=e.height/t.height,r=Math.min(i,n);return{scale:r,x:-(t.x+t.width/2)*r+(e.x+e.width/2),y:-(t.y+t.height/2)*r+(e.y+e.height/2)}}function _h(t,e){return(new ih).parse(t,e)}var Th=Math.PI,Sh=2*Th,Ph=Math.sin,Eh=Math.cos,Ch=Math.acos,Oh=Math.atan2,Rh=Math.abs,kh=Math.sqrt,Ih=Math.max,Dh=Math.min,Mh=1e-4;function Ah(t,e,i,n,r,o,a,s){var l=i-t,h=n-e,u=a-r,c=s-o,p=c*l-u*h;if(!(p*p<Mh))return[t+(p=(u*(e-o)-c*(t-r))/p)*l,e+p*h]}function Lh(t,e,i,n,r,o,a){var s=t-i,l=e-n,h=(a?o:-o)/kh(s*s+l*l),u=h*l,c=-h*s,p=t+u,f=e+c,d=i+u,v=n+c,g=(p+d)/2,y=(f+v)/2,m=d-p,w=v-f,x=m*m+w*w,b=r-o,_=p*v-d*f,T=(w<0?-1:1)*kh(Ih(0,b*b*x-_*_)),S=(_*w-m*T)/x,P=(-_*m-w*T)/x,E=(_*w+m*T)/x,C=(-_*m+w*T)/x,O=S-g,R=P-y,k=E-g,I=C-y;return O*O+R*R>k*k+I*I&&(S=E,P=C),{cx:S,cy:P,x0:-u,y0:-c,x1:S*(r/b-1),y1:P*(r/b-1)}}function zh(t){var e;if(X(t)){var i=t.length;if(!i)return t;e=1===i?[t[0],t[0],0,0]:2===i?[t[0],t[0],t[1],t[1]]:3===i?t.concat(t[2]):t}else e=[t,t,t,t];return e}function jh(t,e){var i,n=Ih(e.r,0),r=Ih(e.r0||0,0),o=n>0;if(o||r>0){if(o||(n=r,r=0),r>n){var a=n;n=r,r=a}var s=e.startAngle,l=e.endAngle;if(!isNaN(s)&&!isNaN(l)){var h=e.cx,u=e.cy,c=!!e.clockwise,p=Rh(l-s),f=p>Sh&&p%Sh;if(f>Mh&&(p=f),n>Mh)if(p>Sh-Mh)t.moveTo(h+n*Eh(s),u+n*Ph(s)),t.arc(h,u,n,s,l,!c),r>Mh&&(t.moveTo(h+r*Eh(l),u+r*Ph(l)),t.arc(h,u,r,l,s,c));else{var d=void 0,v=void 0,g=void 0,y=void 0,m=void 0,w=void 0,x=void 0,b=void 0,_=void 0,T=void 0,S=void 0,P=void 0,E=void 0,C=void 0,O=void 0,R=void 0,k=n*Eh(s),I=n*Ph(s),D=r*Eh(l),M=r*Ph(l),A=p>Mh;if(A){var L=e.cornerRadius;L&&(d=(i=zh(L))[0],v=i[1],g=i[2],y=i[3]);var z=Rh(n-r)/2;if(m=Dh(z,g),w=Dh(z,y),x=Dh(z,d),b=Dh(z,v),S=_=Ih(m,w),P=T=Ih(x,b),(_>Mh||T>Mh)&&(E=n*Eh(l),C=n*Ph(l),O=r*Eh(s),R=r*Ph(s),p<Th)){var j=Ah(k,I,O,R,E,C,D,M);if(j){var B=k-j[0],F=I-j[1],N=E-j[0],H=C-j[1],W=1/Ph(Ch((B*N+F*H)/(kh(B*B+F*F)*kh(N*N+H*H)))/2),V=kh(j[0]*j[0]+j[1]*j[1]);S=Dh(_,(n-V)/(W+1)),P=Dh(T,(r-V)/(W-1))}}}if(A)if(S>Mh){var U=Dh(g,S),G=Dh(y,S),q=Lh(O,R,k,I,n,U,c),Z=Lh(E,C,D,M,n,G,c);t.moveTo(h+q.cx+q.x0,u+q.cy+q.y0),S<_&&U===G?t.arc(h+q.cx,u+q.cy,S,Oh(q.y0,q.x0),Oh(Z.y0,Z.x0),!c):(U>0&&t.arc(h+q.cx,u+q.cy,U,Oh(q.y0,q.x0),Oh(q.y1,q.x1),!c),t.arc(h,u,n,Oh(q.cy+q.y1,q.cx+q.x1),Oh(Z.cy+Z.y1,Z.cx+Z.x1),!c),G>0&&t.arc(h+Z.cx,u+Z.cy,G,Oh(Z.y1,Z.x1),Oh(Z.y0,Z.x0),!c))}else t.moveTo(h+k,u+I),t.arc(h,u,n,s,l,!c);else t.moveTo(h+k,u+I);r>Mh&&A?P>Mh?(U=Dh(d,P),q=Lh(D,M,E,C,r,-(G=Dh(v,P)),c),Z=Lh(k,I,O,R,r,-U,c),t.lineTo(h+q.cx+q.x0,u+q.cy+q.y0),P<T&&U===G?t.arc(h+q.cx,u+q.cy,P,Oh(q.y0,q.x0),Oh(Z.y0,Z.x0),!c):(G>0&&t.arc(h+q.cx,u+q.cy,G,Oh(q.y0,q.x0),Oh(q.y1,q.x1),!c),t.arc(h,u,r,Oh(q.cy+q.y1,q.cx+q.x1),Oh(Z.cy+Z.y1,Z.cx+Z.x1),c),U>0&&t.arc(h+Z.cx,u+Z.cy,U,Oh(Z.y1,Z.x1),Oh(Z.y0,Z.x0),!c))):(t.lineTo(h+D,u+M),t.arc(h,u,r,l,s,c)):t.lineTo(h+D,u+M)}else t.moveTo(h,u);t.closePath()}}}var Bh=function(){function t(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=2*Math.PI,this.clockwise=!0,this.cornerRadius=0}return t}(),Fh=function(t){function e(e){return t.call(this,e)||this}return It(e,t),e.prototype.getDefaultShape=function(){return new Bh},e.prototype.buildPath=function(t,e){jh(t,e)},e.prototype.isZeroArea=function(){return this.shape.startAngle===this.shape.endAngle||this.shape.r===this.shape.r0},e}(_s);Fh.prototype.type="sector";var Nh=Ka.CMD;function Hh(t,e){return Math.abs(t-e)<1e-5}function Wh(t){var e,i,n,r,o,a=t.data,s=t.len(),l=[],h=0,u=0,c=0,p=0;function f(t,i){e&&e.length>2&&l.push(e),e=[t,i]}function d(t,i,n,r){Hh(t,n)&&Hh(i,r)||e.push(t,i,n,r,n,r)}function v(t,i,n,r,o,a){var s=Math.abs(i-t),l=4*Math.tan(s/4)/3,h=i<t?-1:1,u=Math.cos(t),c=Math.sin(t),p=Math.cos(i),f=Math.sin(i),d=u*o+n,v=c*a+r,g=p*o+n,y=f*a+r,m=o*l*h,w=a*l*h;e.push(d-m*c,v+w*u,g+m*f,y-w*p,g,y)}for(var g=0;g<s;){var y=a[g++],m=1===g;switch(m&&(c=h=a[g],p=u=a[g+1],y!==Nh.L&&y!==Nh.C&&y!==Nh.Q||(e=[c,p])),y){case Nh.M:h=c=a[g++],u=p=a[g++],f(c,p);break;case Nh.L:d(h,u,i=a[g++],n=a[g++]),h=i,u=n;break;case Nh.C:e.push(a[g++],a[g++],a[g++],a[g++],h=a[g++],u=a[g++]);break;case Nh.Q:i=a[g++],n=a[g++],r=a[g++],o=a[g++],e.push(h+2/3*(i-h),u+2/3*(n-u),r+2/3*(i-r),o+2/3*(n-o),r,o),h=r,u=o;break;case Nh.A:var w=a[g++],x=a[g++],b=a[g++],_=a[g++],T=a[g++],S=a[g++]+T;g+=1;var P=!a[g++];i=Math.cos(T)*b+w,n=Math.sin(T)*_+x,m?f(c=i,p=n):d(h,u,i,n),h=Math.cos(S)*b+w,u=Math.sin(S)*_+x;for(var E=(P?-1:1)*Math.PI/2,C=T;P?C>S:C<S;C+=E)v(C,P?Math.max(C+E,S):Math.min(C+E,S),w,x,b,_);break;case Nh.R:c=h=a[g++],p=u=a[g++],i=c+a[g++],n=p+a[g++],f(i,p),d(i,p,i,n),d(i,n,c,n),d(c,n,c,p),d(c,p,i,p);break;case Nh.Z:e&&d(h,u,c,p),h=c,u=p}}return e&&e.length>2&&l.push(e),l}function Vh(t,e,i,n,r,o,a,s,l,h){if(Hh(t,i)&&Hh(e,n)&&Hh(r,a)&&Hh(o,s))l.push(a,s);else{var u=2/h,c=u*u,p=a-t,f=s-e,d=Math.sqrt(p*p+f*f);p/=d,f/=d;var v=i-t,g=n-e,y=r-a,m=o-s,w=v*v+g*g,x=y*y+m*m;if(w<c&&x<c)l.push(a,s);else{var b=p*v+f*g,_=-p*y-f*m;if(w-b*b<c&&b>=0&&x-_*_<c&&_>=0)l.push(a,s);else{var T=[],S=[];Ji(t,i,r,a,.5,T),Ji(e,n,o,s,.5,S),Vh(T[0],S[0],T[1],S[1],T[2],S[2],T[3],S[3],l,h),Vh(T[4],S[4],T[5],S[5],T[6],S[6],T[7],S[7],l,h)}}}}function Uh(t,e){var i=Wh(t),n=[];e=e||1;for(var r=0;r<i.length;r++){var o=i[r],a=[],s=o[0],l=o[1];a.push(s,l);for(var h=2;h<o.length;){var u=o[h++],c=o[h++],p=o[h++],f=o[h++],d=o[h++],v=o[h++];Vh(s,l,u,c,p,f,d,v,a,e),s=d,l=v}n.push(a)}return n}function Gh(t,e,i){var n=t[e],r=t[1-e],o=Math.abs(n/r),a=Math.ceil(Math.sqrt(o*i)),s=Math.floor(i/a);0===s&&(s=1,a=i);for(var l=[],h=0;h<a;h++)l.push(s);var u=i-a*s;if(u>0)for(h=0;h<u;h++)l[h%a]+=1;return l}function qh(t,e,i){for(var n=t.r0,r=t.r,o=t.startAngle,a=t.endAngle,s=Math.abs(a-o),l=s*r,h=r-n,u=l>Math.abs(h),c=Gh([l,h],u?0:1,e),p=(u?s:h)/c.length,f=0;f<c.length;f++)for(var d=(u?h:s)/c[f],v=0;v<c[f];v++){var g={};u?(g.startAngle=o+p*f,g.endAngle=o+p*(f+1),g.r0=n+d*v,g.r=n+d*(v+1)):(g.startAngle=o+d*v,g.endAngle=o+d*(v+1),g.r0=n+p*f,g.r=n+p*(f+1)),g.clockwise=t.clockwise,g.cx=t.cx,g.cy=t.cy,i.push(g)}}function Zh(t,e,i){for(var n=t.width,r=t.height,o=n>r,a=Gh([n,r],o?0:1,e),s=o?"width":"height",l=o?"height":"width",h=o?"x":"y",u=o?"y":"x",c=t[s]/a.length,p=0;p<a.length;p++)for(var f=t[l]/a[p],d=0;d<a[p];d++){var v={};v[h]=p*c,v[u]=d*f,v[s]=c,v[l]=f,v.x+=t.x,v.y+=t.y,i.push(v)}}function Xh(t,e,i,n){return t*n-i*e}function Yh(t,e,i,n,r,o,a,s){var l=i-t,h=n-e,u=a-r,c=s-o,p=Xh(u,c,l,h);if(Math.abs(p)<1e-6)return null;var f=Xh(t-r,e-o,u,c)/p;return f<0||f>1?null:new Ve(f*l+t,f*h+e)}function $h(t,e,i){var n=new Ve;Ve.sub(n,i,e),n.normalize();var r=new Ve;return Ve.sub(r,t,e),r.dot(n)}function Kh(t,e){var i=t[t.length-1];i&&i[0]===e[0]&&i[1]===e[1]||t.push(e)}function Qh(t,e,i){for(var n=t.length,r=[],o=0;o<n;o++){var a=t[o],s=t[(o+1)%n],l=Yh(a[0],a[1],s[0],s[1],e.x,e.y,i.x,i.y);l&&r.push({projPt:$h(l,e,i),pt:l,idx:o})}if(r.length<2)return[{points:t},{points:t}];r.sort(function(t,e){return t.projPt-e.projPt});var h=r[0],u=r[r.length-1];if(u.idx<h.idx){var c=h;h=u,u=c}var p=[h.pt.x,h.pt.y],f=[u.pt.x,u.pt.y],d=[p],v=[f];for(o=h.idx+1;o<=u.idx;o++)Kh(d,t[o].slice());for(Kh(d,f),Kh(d,p),o=u.idx+1;o<=h.idx+n;o++)Kh(v,t[o%n].slice());return Kh(v,p),Kh(v,f),[{points:d},{points:v}]}function Jh(t){var e=t.points,i=[],n=[];Ea(e,i,n);var r=new ni(i[0],i[1],n[0]-i[0],n[1]-i[1]),o=r.width,a=r.height,s=r.x,l=r.y,h=new Ve,u=new Ve;return o>a?(h.x=u.x=s+o/2,h.y=l,u.y=l+a):(h.y=u.y=l+a/2,h.x=s,u.x=s+o),Qh(e,h,u)}function tu(t,e,i,n){if(1===i)n.push(e);else{var r=Math.floor(i/2),o=t(e);tu(t,o[0],r,n),tu(t,o[1],i-r,n)}return n}function eu(t,e){for(var i=[],n=0;n<e;n++)i.push(Gs(t));return i}function iu(t,e){e.setStyle(t.style),e.z=t.z,e.z2=t.z2,e.zlevel=t.zlevel}function nu(t){for(var e=[],i=0;i<t.length;)e.push([t[i++],t[i++]]);return e}function ru(t,e){var i,n=[],r=t.shape;switch(t.type){case"rect":Zh(r,e,n),i=al;break;case"sector":qh(r,e,n),i=Fh;break;case"circle":qh({r0:0,r:r.r,startAngle:0,endAngle:2*Math.PI,cx:r.cx,cy:r.cy},e,n),i=Fh;break;default:var o=t.getComputedTransform(),a=o?Math.sqrt(Math.max(o[0]*o[0]+o[1]*o[1],o[2]*o[2]+o[3]*o[3])):1,s=N(Uh(t.getUpdatedPathProxy(),a),function(t){return nu(t)}),l=s.length;if(0===l)tu(Jh,{points:s[0]},e,n);else if(l===e)for(var h=0;h<l;h++)n.push({points:s[h]});else{var u=0,c=N(s,function(t){var e=[],i=[];Ea(t,e,i);var n=(i[1]-e[1])*(i[0]-e[0]);return u+=n,{poly:t,area:n}});c.sort(function(t,e){return e.area-t.area});var p=e;for(h=0;h<l;h++){var f=c[h];if(p<=0)break;var d=h===l-1?p:Math.ceil(f.area/u*e);d<0||(tu(Jh,{points:f.poly},d,n),p-=d)}}i=vl}if(!i)return eu(t,e);var v=[];for(h=0;h<n.length;h++){var g=new i;g.setShape(n[h]),iu(t,g),v.push(g)}return v}function ou(t,e){var i=t.length,n=e.length;if(i===n)return[t,e];for(var r=[],o=[],a=i<n?t:e,s=Math.min(i,n),l=Math.abs(n-i)/6,h=(s-2)/6,u=Math.ceil(l/h)+1,c=[a[0],a[1]],p=l,f=2;f<s;){var d=a[f-2],v=a[f-1],g=a[f++],y=a[f++],m=a[f++],w=a[f++],x=a[f++],b=a[f++];if(p<=0)c.push(g,y,m,w,x,b);else{for(var _=Math.min(p,u-1)+1,T=1;T<=_;T++){var S=T/_;Ji(d,g,m,x,S,r),Ji(v,y,w,b,S,o),d=r[3],v=o[3],c.push(r[1],o[1],r[2],o[2],d,v),g=r[5],y=o[5],m=r[6],w=o[6]}p-=_-1}}return a===t?[c,e]:[t,c]}function au(t,e){for(var i=t.length,n=t[i-2],r=t[i-1],o=[],a=0;a<e.length;)o[a++]=n,o[a++]=r;return o}function su(t,e){for(var i,n,r,o=[],a=[],s=0;s<Math.max(t.length,e.length);s++){var l=t[s],h=e[s],u=void 0,c=void 0;l?h?(n=u=(i=ou(l,h))[0],r=c=i[1]):(c=au(r||l,l),u=l):(u=au(n||h,h),c=h),o.push(u),a.push(c)}return[o,a]}function lu(t){for(var e=0,i=0,n=0,r=t.length,o=0,a=r-2;o<r;a=o,o+=2){var s=t[a],l=t[a+1],h=t[o],u=t[o+1],c=s*u-h*l;e+=c,i+=(s+h)*c,n+=(l+u)*c}return 0===e?[t[0]||0,t[1]||0]:[i/e/3,n/e/3,e]}function hu(t,e,i,n){for(var r=(t.length-2)/6,o=1/0,a=0,s=t.length,l=s-2,h=0;h<r;h++){for(var u=6*h,c=0,p=0;p<s;p+=2){var f=0===p?u:(u+p-2)%l+2,d=t[f]-i[0],v=t[f+1]-i[1],g=e[p]-n[0]-d,y=e[p+1]-n[1]-v;c+=g*g+y*y}c<o&&(o=c,a=h)}return a}function uu(t){for(var e=[],i=t.length,n=0;n<i;n+=2)e[n]=t[i-n-2],e[n+1]=t[i-n-1];return e}function cu(t,e,i,n){for(var r,o=[],a=0;a<t.length;a++){var s=t[a],l=e[a],h=lu(s),u=lu(l);null==r&&(r=h[2]<0!=u[2]<0);var c=[],p=[],f=0,d=1/0,v=[],g=s.length;r&&(s=uu(s));for(var y=6*hu(s,l,h,u),m=g-2,w=0;w<m;w+=2){var x=(y+w)%m+2;c[w+2]=s[x]-h[0],c[w+3]=s[x+1]-h[1]}if(c[0]=s[y]-h[0],c[1]=s[y+1]-h[1],i>0)for(var b=n/i,_=-n/2;_<=n/2;_+=b){var T=Math.sin(_),S=Math.cos(_),P=0;for(w=0;w<s.length;w+=2){var E=c[w],C=c[w+1],O=l[w]-u[0],R=l[w+1]-u[1],k=O*S-R*T,I=O*T+R*S;v[w]=k,v[w+1]=I;var D=k-E,M=I-C;P+=D*D+M*M}if(P<d){d=P,f=_;for(var A=0;A<v.length;A++)p[A]=v[A]}}else for(var L=0;L<g;L+=2)p[L]=l[L]-u[0],p[L+1]=l[L+1]-u[1];o.push({from:c,to:p,fromCp:h,toCp:u,rotation:-f})}return o}function pu(t){return t.__isCombineMorphing}function fu(t){return t.__morphT>=0}var du="__mOriginal_";function vu(t,e,i){var n=du+e,r=t[n]||t[e];t[n]||(t[n]=t[e]);var o=i.replace,a=i.after,s=i.before;t[e]=function(){var t,e=arguments;return s&&s.apply(this,e),t=o?o.apply(this,e):r.apply(this,e),a&&a.apply(this,e),t}}function gu(t,e){var i=du+e;t[i]&&(t[e]=t[i],t[i]=null)}function yu(t,e){for(var i=0;i<t.length;i++)for(var n=t[i],r=0;r<n.length;){var o=n[r],a=n[r+1];n[r++]=e[0]*o+e[2]*a+e[4],n[r++]=e[1]*o+e[3]*a+e[5]}}function mu(t,e){var i=t.getUpdatedPathProxy(),n=e.getUpdatedPathProxy(),r=su(Wh(i),Wh(n)),o=r[0],a=r[1],s=t.getComputedTransform(),l=e.getComputedTransform();function h(){this.transform=null}s&&yu(o,s),l&&yu(a,l),vu(e,"updateTransform",{replace:h}),e.transform=null;var u=cu(o,a,10,Math.PI),c=[];vu(e,"buildPath",{replace:function(t){for(var i=e.__morphT,n=1-i,r=[],o=0;o<u.length;o++){var a=u[o],s=a.from,l=a.to,h=a.rotation*i,p=a.fromCp,f=a.toCp,d=Math.sin(h),v=Math.cos(h);Jt(r,p,f,i);for(var g=0;g<s.length;g+=2){var y=s[g],m=s[g+1],w=y*n+(T=l[g])*i,x=m*n+(S=l[g+1])*i;c[g]=w*v-x*d+r[0],c[g+1]=w*d+x*v+r[1]}var b=c[0],_=c[1];for(t.moveTo(b,_),g=2;g<s.length;){var T=c[g++],S=c[g++],P=c[g++],E=c[g++],C=c[g++],O=c[g++];b===T&&_===S&&P===C&&E===O?t.lineTo(C,O):t.bezierCurveTo(T,S,P,E,C,O),b=C,_=O}}}})}function wu(t,e,i){if(!t||!e)return e;var n=i.done,r=i.during;function o(){gu(e,"buildPath"),gu(e,"updateTransform"),e.__morphT=-1,e.createPathProxy(),e.dirtyShape()}return mu(t,e),e.__morphT=0,e.animateTo({__morphT:1},M({during:function(t){e.dirtyShape(),r&&r(t)},done:function(){o(),n&&n()}},i)),e}function xu(t,e,i,n,r,o){var a=16;t=r===i?0:Math.round(32767*(t-i)/(r-i)),e=o===n?0:Math.round(32767*(e-n)/(o-n));for(var s,l=0,h=(1<<a)/2;h>0;h/=2){var u=0,c=0;(t&h)>0&&(u=1),(e&h)>0&&(c=1),l+=h*h*(3*u^c),0===c&&(1===u&&(t=h-1-t,e=h-1-e),s=t,t=e,e=s)}return l}function bu(t){var e=1/0,i=1/0,n=-1/0,r=-1/0,o=N(t,function(t){var o=t.getBoundingRect(),a=t.getComputedTransform(),s=o.x+o.width/2+(a?a[4]:0),l=o.y+o.height/2+(a?a[5]:0);return e=Math.min(s,e),i=Math.min(l,i),n=Math.max(s,n),r=Math.max(l,r),[s,l]});return N(o,function(o,a){return{cp:o,z:xu(o[0],o[1],e,i,n,r),path:t[a]}}).sort(function(t,e){return t.z-e.z}).map(function(t){return t.path})}function _u(t){return ru(t.path,t.count)}function Tu(){return{fromIndividuals:[],toIndividuals:[],count:0}}function Su(t,e,i){var n=[];function r(t){for(var e=0;e<t.length;e++){var i=t[e];pu(i)?r(i.childrenRef()):i instanceof _s&&n.push(i)}}r(t);var o=n.length;if(!o)return Tu();var a=(i.dividePath||_u)({path:e,count:o});if(a.length!==o)return Tu();n=bu(n),a=bu(a);for(var s=i.done,l=i.during,h=i.individualDelay,u=new xo,c=0;c<o;c++){var p=n[c],f=a[c];f.parent=e,f.copyTransform(u),h||mu(p,f)}function d(t){for(var e=0;e<a.length;e++)a[e].addSelfToZr(t)}function v(){e.__isCombineMorphing=!1,e.__morphT=-1,e.childrenRef=null,gu(e,"addSelfToZr"),gu(e,"removeSelfFromZr")}e.__isCombineMorphing=!0,e.childrenRef=function(){return a},vu(e,"addSelfToZr",{after:function(t){d(t)}}),vu(e,"removeSelfFromZr",{after:function(t){for(var e=0;e<a.length;e++)a[e].removeSelfFromZr(t)}});var g=a.length;if(h){var y=g,m=function(){0===--y&&(v(),s&&s())};for(c=0;c<g;c++){var w=h?M({delay:(i.delay||0)+h(c,g,n[c],a[c]),done:m},i):i;wu(n[c],a[c],w)}}else e.__morphT=0,e.animateTo({__morphT:1},M({during:function(t){for(var i=0;i<g;i++){var n=a[i];n.__morphT=e.__morphT,n.dirtyShape()}l&&l(t)},done:function(){v();for(var e=0;e<t.length;e++)gu(t[e],"updateTransform");s&&s()}},i));return e.__zr&&d(e.__zr),{fromIndividuals:n,toIndividuals:a,count:g}}function Pu(t,e,i){var n=e.length,r=[],o=i.dividePath||_u;function a(t){for(var e=0;e<t.length;e++){var i=t[e];pu(i)?a(i.childrenRef()):i instanceof _s&&r.push(i)}}if(pu(t)){a(t.childrenRef());var s=r.length;if(s<n)for(var l=0,h=s;h<n;h++)r.push(Gs(r[l++%s]));r.length=n}else{r=o({path:t,count:n});var u=t.getComputedTransform();for(h=0;h<r.length;h++)r[h].setLocalTransform(u);if(r.length!==n)return Tu()}r=bu(r),e=bu(e);var c=i.individualDelay;for(h=0;h<n;h++){var p=c?M({delay:(i.delay||0)+c(h,n,r[h],e[h])},i):i;wu(r[h],e[h],p)}return{fromIndividuals:r,toIndividuals:e,count:e.length}}var Eu=Object.freeze({__proto__:null,alignBezierCurves:su,centroid:lu,isCombineMorphing:pu,isMorphing:fu,morphPath:wu,combineMorph:Su,separateMorph:Pu,defaultDividePath:ru}),Cu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="compound",e}return It(e,t),e.prototype._updatePathDirty=function(){for(var t=this.shape.paths,e=this.shapeChanged(),i=0;i<t.length;i++)e=e||t[i].shapeChanged();e&&this.dirtyShape()},e.prototype.beforeBrush=function(){this._updatePathDirty();for(var t=this.shape.paths||[],e=this.getGlobalScale(),i=0;i<t.length;i++)t[i].path||t[i].createPathProxy(),t[i].path.setScale(e[0],e[1],t[i].segmentIgnoreThreshold)},e.prototype.buildPath=function(t,e){for(var i=e.paths||[],n=0;n<i.length;n++)i[n].buildPath(t,i[n].shape,!0)},e.prototype.afterBrush=function(){for(var t=this.shape.paths||[],e=0;e<t.length;e++)t[e].pathUpdated()},e.prototype.getBoundingRect=function(){return this._updatePathDirty.call(this),_s.prototype.getBoundingRect.call(this)},e}(_s),Ou=[],Ru=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.notClear=!0,e.incremental=!0,e._displayables=[],e._temporaryDisplayables=[],e._cursor=0,e}return It(e,t),e.prototype.traverse=function(t,e){t.call(e,this)},e.prototype.useStyle=function(){this.style={}},e.prototype.getCursor=function(){return this._cursor},e.prototype.innerAfterBrush=function(){this._cursor=this._displayables.length},e.prototype.clearDisplaybles=function(){this._displayables=[],this._temporaryDisplayables=[],this._cursor=0,this.markRedraw(),this.notClear=!1},e.prototype.clearTemporalDisplayables=function(){this._temporaryDisplayables=[]},e.prototype.addDisplayable=function(t,e){e?this._temporaryDisplayables.push(t):this._displayables.push(t),this.markRedraw()},e.prototype.addDisplayables=function(t,e){e=e||!1;for(var i=0;i<t.length;i++)this.addDisplayable(t[i],e)},e.prototype.getDisplayables=function(){return this._displayables},e.prototype.getTemporalDisplayables=function(){return this._temporaryDisplayables},e.prototype.eachPendingDisplayable=function(t){for(var e=this._cursor;e<this._displayables.length;e++)t&&t(this._displayables[e]);for(e=0;e<this._temporaryDisplayables.length;e++)t&&t(this._temporaryDisplayables[e])},e.prototype.update=function(){this.updateTransform();for(var t=this._cursor;t<this._displayables.length;t++)(e=this._displayables[t]).parent=this,e.update(),e.parent=null;for(t=0;t<this._temporaryDisplayables.length;t++){var e;(e=this._temporaryDisplayables[t]).parent=this,e.update(),e.parent=null}},e.prototype.getBoundingRect=function(){if(!this._rect){for(var t=new ni(1/0,1/0,-1/0,-1/0),e=0;e<this._displayables.length;e++){var i=this._displayables[e],n=i.getBoundingRect().clone();i.needLocalTransform()&&n.applyTransform(i.getLocalTransform(Ou)),t.union(n)}this._rect=t}return this._rect},e.prototype.contain=function(t,e){var i=this.transformCoordToLocal(t,e);if(this.getBoundingRect().contain(i[0],i[1]))for(var n=0;n<this._displayables.length;n++)if(this._displayables[n].contain(t,e))return!0;return!1},e}(da),ku={fill:"#000"},Iu=2,Du={},Mu={style:M({fill:!0,stroke:!0,fillOpacity:!0,strokeOpacity:!0,lineWidth:!0,fontSize:!0,lineHeight:!0,width:!0,height:!0,textShadowColor:!0,textShadowBlur:!0,textShadowOffsetX:!0,textShadowOffsetY:!0,backgroundColor:!0,padding:!0,borderColor:!0,borderWidth:!0,borderRadius:!0},ca.style)},Au=function(t){function e(e){var i=t.call(this)||this;return i.type="text",i._children=[],i._defaultStyle=ku,i.attr(e),i}return It(e,t),e.prototype.childrenRef=function(){return this._children},e.prototype.update=function(){t.prototype.update.call(this),this.styleChanged()&&this._updateSubTexts();for(var e=0;e<this._children.length;e++){var i=this._children[e];i.zlevel=this.zlevel,i.z=this.z,i.z2=this.z2,i.culling=this.culling,i.cursor=this.cursor,i.invisible=this.invisible}},e.prototype.updateTransform=function(){var e=this.innerTransformable;e?(e.updateTransform(),e.transform&&(this.transform=e.transform)):t.prototype.updateTransform.call(this)},e.prototype.getLocalTransform=function(e){var i=this.innerTransformable;return i?i.getLocalTransform(e):t.prototype.getLocalTransform.call(this,e)},e.prototype.getComputedTransform=function(){return this.__hostTarget&&(this.__hostTarget.getComputedTransform(),this.__hostTarget.updateInnerText(!0)),t.prototype.getComputedTransform.call(this)},e.prototype._updateSubTexts=function(){this._childCursor=0,Hu(this.style),this.style.rich?this._updateRichTexts():this._updatePlainTexts(),this._children.length=this._childCursor,this.styleUpdated()},e.prototype.addSelfToZr=function(e){t.prototype.addSelfToZr.call(this,e);for(var i=0;i<this._children.length;i++)this._children[i].__zr=e},e.prototype.removeSelfFromZr=function(e){t.prototype.removeSelfFromZr.call(this,e);for(var i=0;i<this._children.length;i++)this._children[i].__zr=null},e.prototype.getBoundingRect=function(){if(this.styleChanged()&&this._updateSubTexts(),!this._rect){for(var t=new ni(0,0,0,0),e=this._children,i=[],n=null,r=0;r<e.length;r++){var o=e[r],a=o.getBoundingRect(),s=o.getLocalTransform(i);s?(t.copy(a),t.applyTransform(s),(n=n||t.clone()).union(t)):(n=n||a.clone()).union(a)}this._rect=n||t}return this._rect},e.prototype.setDefaultTextStyle=function(t){this._defaultStyle=t||ku},e.prototype.setTextContent=function(t){throw new Error("Can't attach text on another text")},e.prototype._mergeStyle=function(t,e){if(!e)return t;var i=e.rich,n=t.rich||i&&{};return D(t,e),i&&n?(this._mergeRich(n,i),t.rich=n):n&&(t.rich=n),t},e.prototype._mergeRich=function(t,e){for(var i=U(e),n=0;n<i.length;n++){var r=i[n];t[r]=t[r]||{},D(t[r],e[r])}},e.prototype.getAnimationStyleProps=function(){return Mu},e.prototype._getOrCreateChild=function(t){var e=this._children[this._childCursor];return e&&e instanceof t||(e=new t),this._children[this._childCursor++]=e,e.__zr=this.__zr,e.parent=this,e},e.prototype._updatePlainTexts=function(){var t=this.style,e=t.font||a,i=t.padding,n=this._defaultStyle,r=t.x||0,o=t.y||0,s=t.align||n.align||"left",l=t.verticalAlign||n.verticalAlign||"top";Hl(Du,n.overflowRect,r,o,s,l),r=Du.baseX,o=Du.baseY;var h=Il(qu(t),t,Du.outerWidth,Du.outerHeight),u=Zu(t),c=!!t.backgroundColor,p=h.outerHeight,f=h.outerWidth,d=h.lines,v=h.lineHeight;this.isTruncated=!!h.isTruncated;var g=r,y=ko(o,h.contentHeight,l);if(u||i){var m=Ro(r,f,s),w=ko(o,p,l);u&&this._renderBackground(t,t,m,w,f,p)}y+=v/2,i&&(g=Gu(r,s,i),"top"===l?y+=i[0]:"bottom"===l&&(y-=i[2]));for(var x=0,b=!1,_=!1,T=(Uu("fill"in t?t.fill:(_=!0,n.fill))),S=(Vu("stroke"in t?t.stroke:c||n.autoStroke&&!_?null:(x=Iu,b=!0,n.stroke))),P=t.textShadowBlur>0,E=0;E<d.length;E++){var C=this._getOrCreateChild($l),O=C.createStyle();C.useStyle(O),O.text=d[E],O.x=g,O.y=y,s&&(O.textAlign=s),O.textBaseline="middle",O.opacity=t.opacity,O.strokeFirst=!0,P&&(O.shadowBlur=t.textShadowBlur||0,O.shadowColor=t.textShadowColor||"transparent",O.shadowOffsetX=t.textShadowOffsetX||0,O.shadowOffsetY=t.textShadowOffsetY||0),O.stroke=S,O.fill=T,S&&(O.lineWidth=t.lineWidth||x,O.lineDash=t.lineDash,O.lineDashOffset=t.lineDashOffset||0),O.font=e,Fu(O,t),y+=v,C.setBoundingRect(ql(O,h.contentWidth,h.calculatedLineHeight,b?0:null))}},e.prototype._updateRichTexts=function(){var t=this.style,e=this._defaultStyle,i=t.align||e.align,n=t.verticalAlign||e.verticalAlign,r=t.x||0,o=t.y||0;Hl(Du,e.overflowRect,r,o,i,n),r=Du.baseX,o=Du.baseY;var a=Ll(qu(t),t,Du.outerWidth,Du.outerHeight,i),s=a.width,l=a.outerWidth,h=a.outerHeight,u=t.padding;this.isTruncated=!!a.isTruncated;var c=Ro(r,l,i),p=ko(o,h,n),f=c,d=p;u&&(f+=u[3],d+=u[0]);var v=f+s;Zu(t)&&this._renderBackground(t,t,c,p,l,h);for(var g=!!t.backgroundColor,y=0;y<a.lines.length;y++){for(var m=a.lines[y],w=m.tokens,x=w.length,b=m.lineHeight,_=m.width,T=0,S=f,P=v,E=x-1,C=void 0;T<x&&(!(C=w[T]).align||"left"===C.align);)this._placeToken(C,t,b,d,S,"left",g),_-=C.width,S+=C.width,T++;for(;E>=0&&"right"===(C=w[E]).align;)this._placeToken(C,t,b,d,P,"right",g),_-=C.width,P-=C.width,E--;for(S+=(s-(S-f)-(v-P)-_)/2;T<=E;)C=w[T],this._placeToken(C,t,b,d,S+C.width/2,"center",g),S+=C.width,T++;d+=b}},e.prototype._placeToken=function(t,e,i,n,r,o,s){var l=e.rich[t.styleName]||{};l.text=t.text;var h=t.verticalAlign,u=n+i/2;"top"===h?u=n+t.height/2:"bottom"===h&&(u=n+i-t.height/2),!t.isLineHolder&&Zu(l)&&this._renderBackground(l,e,"right"===o?r-t.width:"center"===o?r-t.width/2:r,u-t.height/2,t.width,t.height);var c=!!l.backgroundColor,p=t.textPadding;p&&(r=Gu(r,o,p),u-=t.height/2-p[0]-t.innerHeight/2);var f=this._getOrCreateChild($l),d=f.createStyle();f.useStyle(d);var v=this._defaultStyle,g=!1,y=0,m=!1,w=Uu("fill"in l?l.fill:"fill"in e?e.fill:(g=!0,v.fill)),x=Vu("stroke"in l?l.stroke:"stroke"in e?e.stroke:c||s||v.autoStroke&&!g?null:(y=Iu,m=!0,v.stroke)),b=l.textShadowBlur>0||e.textShadowBlur>0;d.text=t.text,d.x=r,d.y=u,b&&(d.shadowBlur=l.textShadowBlur||e.textShadowBlur||0,d.shadowColor=l.textShadowColor||e.textShadowColor||"transparent",d.shadowOffsetX=l.textShadowOffsetX||e.textShadowOffsetX||0,d.shadowOffsetY=l.textShadowOffsetY||e.textShadowOffsetY||0),d.textAlign=o,d.textBaseline="middle",d.font=t.font||a,d.opacity=ht(l.opacity,e.opacity,1),Fu(d,l),x&&(d.lineWidth=ht(l.lineWidth,e.lineWidth,y),d.lineDash=lt(l.lineDash,e.lineDash),d.lineDashOffset=e.lineDashOffset||0,d.stroke=x),w&&(d.fill=w),f.setBoundingRect(ql(d,t.contentWidth,t.contentHeight,m?0:null))},e.prototype._renderBackground=function(t,e,i,n,r,o){var a,s,l,h=t.backgroundColor,u=t.borderWidth,c=t.borderColor,p=h&&h.image,f=h&&!p,d=t.borderRadius,v=this;if(f||t.lineHeight||u&&c){(a=this._getOrCreateChild(al)).useStyle(a.createStyle()),a.style.fill=null;var g=a.shape;g.x=i,g.y=n,g.width=r,g.height=o,g.r=d,a.dirtyShape()}if(f)(l=a.style).fill=h||null,l.fillOpacity=lt(t.fillOpacity,1);else if(p){(s=this._getOrCreateChild($s)).onload=function(){v.dirtyStyle()};var y=s.style;y.image=h.image,y.x=i,y.y=n,y.width=r,y.height=o}u&&c&&((l=a.style).lineWidth=u,l.stroke=c,l.strokeOpacity=lt(t.strokeOpacity,1),l.lineDash=t.borderDash,l.lineDashOffset=t.borderDashOffset||0,a.strokeContainThreshold=0,a.hasFill()&&a.hasStroke()&&(l.strokeFirst=!0,l.lineWidth*=2));var m=(a||s).style;m.shadowBlur=t.shadowBlur||0,m.shadowColor=t.shadowColor||"transparent",m.shadowOffsetX=t.shadowOffsetX||0,m.shadowOffsetY=t.shadowOffsetY||0,m.opacity=ht(t.opacity,e.opacity,1)},e.makeFont=function(t){var e="";return Nu(t)&&(e=[t.fontStyle,t.fontWeight,Bu(t.fontSize),t.fontFamily||"sans-serif"].join(" ")),e&&ft(e)||t.textFont||t.font},e}(da),Lu={left:!0,right:1,center:1},zu={top:1,bottom:1,middle:1},ju=["fontStyle","fontWeight","fontSize","fontFamily"];function Bu(t){return"string"!=typeof t||-1===t.indexOf("px")&&-1===t.indexOf("rem")&&-1===t.indexOf("em")?isNaN(+t)?r+"px":t+"px":t}function Fu(t,e){for(var i=0;i<ju.length;i++){var n=ju[i],r=e[n];null!=r&&(t[n]=r)}}function Nu(t){return null!=t.fontSize||t.fontFamily||t.fontWeight}function Hu(t){return Wu(t),F(t.rich,Wu),t}function Wu(t){if(t){t.font=Au.makeFont(t);var e=t.align;"middle"===e&&(e="center"),t.align=null==e||Lu[e]?e:"left";var i=t.verticalAlign;"center"===i&&(i="middle"),t.verticalAlign=null==i||zu[i]?i:"top",t.padding&&(t.padding=ct(t.padding))}}function Vu(t,e){return null==t||e<=0||"transparent"===t||"none"===t?null:t.image||t.colorStops?"#000":t}function Uu(t){return null==t||"none"===t?null:t.image||t.colorStops?"#000":t}function Gu(t,e,i){return"right"===e?t-i[1]:"center"===e?t+i[3]/2-i[1]/2:t+i[3]}function qu(t){var e=t.text;return null!=e&&(e+=""),e}function Zu(t){return!!(t.backgroundColor||t.lineHeight||t.borderWidth&&t.borderColor)}var Xu=function(){function t(){this.cx=0,this.cy=0,this.r=0,this.startAngle=0,this.endAngle=2*Math.PI,this.clockwise=!0}return t}(),Yu=function(t){function e(e){return t.call(this,e)||this}return It(e,t),e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new Xu},e.prototype.buildPath=function(t,e){var i=e.cx,n=e.cy,r=Math.max(e.r,0),o=e.startAngle,a=e.endAngle,s=e.clockwise,l=Math.cos(o),h=Math.sin(o);t.moveTo(l*r+i,h*r+n),t.arc(i,n,r,o,a,!s)},e}(_s);Yu.prototype.type="arc";var $u=[],Ku=function(){function t(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.cpx1=0,this.cpy1=0,this.percent=1}return t}();function Qu(t,e,i){var n=t.cpx2,r=t.cpy2;return null!=n||null!=r?[(i?$i:Yi)(t.x1,t.cpx1,t.cpx2,t.x2,e),(i?$i:Yi)(t.y1,t.cpy1,t.cpy2,t.y2,e)]:[(i?rn:nn)(t.x1,t.cpx1,t.x2,e),(i?rn:nn)(t.y1,t.cpy1,t.y2,e)]}var Ju=function(t){function e(e){return t.call(this,e)||this}return It(e,t),e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new Ku},e.prototype.buildPath=function(t,e){var i=e.x1,n=e.y1,r=e.x2,o=e.y2,a=e.cpx1,s=e.cpy1,l=e.cpx2,h=e.cpy2,u=e.percent;0!==u&&(t.moveTo(i,n),null==l||null==h?(u<1&&(sn(i,a,r,u,$u),a=$u[1],r=$u[2],sn(n,s,o,u,$u),s=$u[1],o=$u[2]),t.quadraticCurveTo(a,s,r,o)):(u<1&&(Ji(i,a,l,r,u,$u),a=$u[1],l=$u[2],r=$u[3],Ji(n,s,h,o,u,$u),s=$u[1],h=$u[2],o=$u[3]),t.bezierCurveTo(a,s,l,h,r,o)))},e.prototype.pointAt=function(t){return Qu(this.shape,t,!1)},e.prototype.tangentAt=function(t){var e=Qu(this.shape,t,!0);return Zt(e,e)},e}(_s);Ju.prototype.type="bezier-curve";var tc=function(){function t(){this.cx=0,this.cy=0,this.width=0,this.height=0}return t}(),ec=function(t){function e(e){return t.call(this,e)||this}return It(e,t),e.prototype.getDefaultShape=function(){return new tc},e.prototype.buildPath=function(t,e){var i=e.cx,n=e.cy,r=e.width,o=e.height;t.moveTo(i,n+r),t.bezierCurveTo(i+r,n+r,i+3*r/2,n-r/3,i,n-o),t.bezierCurveTo(i-3*r/2,n-r/3,i-r,n+r,i,n+r),t.closePath()},e}(_s);ec.prototype.type="droplet";var ic=function(){function t(){this.cx=0,this.cy=0,this.width=0,this.height=0}return t}(),nc=function(t){function e(e){return t.call(this,e)||this}return It(e,t),e.prototype.getDefaultShape=function(){return new ic},e.prototype.buildPath=function(t,e){var i=e.cx,n=e.cy,r=e.width,o=e.height;t.moveTo(i,n),t.bezierCurveTo(i+r/2,n-2*o/3,i+2*r,n+o/3,i,n+o),t.bezierCurveTo(i-2*r,n+o/3,i-r/2,n-2*o/3,i,n)},e}(_s);nc.prototype.type="heart";var rc=Math.PI,oc=Math.sin,ac=Math.cos,sc=function(){function t(){this.x=0,this.y=0,this.r=0,this.n=0}return t}(),lc=function(t){function e(e){return t.call(this,e)||this}return It(e,t),e.prototype.getDefaultShape=function(){return new sc},e.prototype.buildPath=function(t,e){var i=e.n;if(i&&!(i<2)){var n=e.x,r=e.y,o=e.r,a=2*rc/i,s=-rc/2;t.moveTo(n+o*ac(s),r+o*oc(s));for(var l=0,h=i-1;l<h;l++)s+=a,t.lineTo(n+o*ac(s),r+o*oc(s));t.closePath()}},e}(_s);lc.prototype.type="isogon";var hc=function(){function t(){this.cx=0,this.cy=0,this.r=0,this.r0=0}return t}(),uc=function(t){function e(e){return t.call(this,e)||this}return It(e,t),e.prototype.getDefaultShape=function(){return new hc},e.prototype.buildPath=function(t,e){var i=e.cx,n=e.cy,r=2*Math.PI;t.moveTo(i+e.r,n),t.arc(i,n,e.r,0,r,!1),t.moveTo(i+e.r0,n),t.arc(i,n,e.r0,0,r,!0)},e}(_s);uc.prototype.type="ring";var cc=Math.sin,pc=Math.cos,fc=Math.PI/180,dc=function(){function t(){this.cx=0,this.cy=0,this.r=[],this.k=0,this.n=1}return t}(),vc=function(t){function e(e){return t.call(this,e)||this}return It(e,t),e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new dc},e.prototype.buildPath=function(t,e){var i,n,r,o=e.r,a=e.k,s=e.n,l=e.cx,h=e.cy;t.moveTo(l,h);for(var u=0,c=o.length;u<c;u++){r=o[u];for(var p=0;p<=360*s;p++)i=r*cc(a/s*p%360*fc)*pc(p*fc)+l,n=r*cc(a/s*p%360*fc)*cc(p*fc)+h,t.lineTo(i,n)}},e}(_s);vc.prototype.type="rose";var gc=Math.PI,yc=Math.cos,mc=Math.sin,wc=function(){function t(){this.cx=0,this.cy=0,this.n=3,this.r=0}return t}(),xc=function(t){function e(e){return t.call(this,e)||this}return It(e,t),e.prototype.getDefaultShape=function(){return new wc},e.prototype.buildPath=function(t,e){var i=e.n;if(i&&!(i<2)){var n=e.cx,r=e.cy,o=e.r,a=e.r0;null==a&&(a=i>4?o*yc(2*gc/i)/yc(gc/i):o/3);var s=gc/i,l=-gc/2,h=n+o*yc(l),u=r+o*mc(l);l+=s,t.moveTo(h,u);for(var c=0,p=2*i-1,f=void 0;c<p;c++)f=c%2==0?a:o,t.lineTo(n+f*yc(l),r+f*mc(l)),l+=s;t.closePath()}},e}(_s);xc.prototype.type="star";var bc=Math.cos,_c=Math.sin,Tc=function(){function t(){this.cx=0,this.cy=0,this.r=0,this.r0=0,this.d=0,this.location="out"}return t}(),Sc=function(t){function e(e){return t.call(this,e)||this}return It(e,t),e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new Tc},e.prototype.buildPath=function(t,e){var i,n,r,o,a=e.r,s=e.r0,l=e.d,h=e.cx,u=e.cy,c="out"===e.location?1:-1;if(!(e.location&&a<=s)){var p,f=0,d=1;i=(a+c*s)*bc(0)-c*l*bc(0)+h,n=(a+c*s)*_c(0)-l*_c(0)+u,t.moveTo(i,n);do{f++}while(s*f%(a+c*s)!==0);do{p=Math.PI/180*d,r=(a+c*s)*bc(p)-c*l*bc((a/s+c)*p)+h,o=(a+c*s)*_c(p)-l*_c((a/s+c)*p)+u,t.lineTo(r,o),d++}while(d<=s*f/(a+c*s)*360)}},e}(_s);Sc.prototype.type="trochoid";var Pc=function(){function t(t,e){this.image=t,this.repeat=e,this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1}return t}(),Ec=Math.min,Cc=Math.max,Oc=Math.abs,Rc=[0,0],kc=[0,0],Ic=si(),Dc=Ic.minTv,Mc=Ic.maxTv,Ac=function(){function t(t,e){this._corners=[],this._axes=[],this._origin=[0,0];for(var i=0;i<4;i++)this._corners[i]=new Ve;for(i=0;i<2;i++)this._axes[i]=new Ve;t&&this.fromBoundingRect(t,e)}return t.prototype.fromBoundingRect=function(t,e){var i=this._corners,n=this._axes,r=t.x,o=t.y,a=r+t.width,s=o+t.height;if(i[0].set(r,o),i[1].set(a,o),i[2].set(a,s),i[3].set(r,s),e)for(var l=0;l<4;l++)i[l].transform(e);for(Ve.sub(n[0],i[1],i[0]),Ve.sub(n[1],i[3],i[0]),n[0].normalize(),n[1].normalize(),l=0;l<2;l++)this._origin[l]=n[l].dot(i[0])},t.prototype.intersect=function(t,e,i){var n=!0,r=!e;return e&&Ve.set(e,0,0),Ic.reset(i,!r),!this._intersectCheckOneSide(this,t,r,1)&&(n=!1,r)||!this._intersectCheckOneSide(t,this,r,-1)&&(n=!1,r)||r||Ic.negativeSize||Ve.copy(e,n?Ic.useDir?Ic.dirMinTv:Dc:Mc),n},t.prototype._intersectCheckOneSide=function(t,e,i,n){for(var r=!0,o=0;o<2;o++){var a=t._axes[o];if(t._getProjMinMaxOnAxis(o,t._corners,Rc),t._getProjMinMaxOnAxis(o,e._corners,kc),Ic.negativeSize||Rc[1]<kc[0]||Rc[0]>kc[1]){if(r=!1,Ic.negativeSize||i)return r;var s=Oc(kc[0]-Rc[1]),l=Oc(Rc[0]-kc[1]);Ec(s,l)>Mc.len()&&(s<l?Ve.scale(Mc,a,-s*n):Ve.scale(Mc,a,l*n))}else i||(s=Oc(kc[0]-Rc[1]),l=Oc(Rc[0]-kc[1]),(Ic.useDir||Ec(s,l)<Dc.len())&&((s<l||!Ic.bidirectional)&&(Ve.scale(Dc,a,s*n),Ic.useDir&&Ic.calcDirMTV()),(s>=l||!Ic.bidirectional)&&(Ve.scale(Dc,a,-l*n),Ic.useDir&&Ic.calcDirMTV())))}return r},t.prototype._getProjMinMaxOnAxis=function(t,e,i){for(var n=this._axes[t],r=this._origin,o=e[0].dot(n)+r[t],a=o,s=o,l=1;l<e.length;l++){var h=e[l].dot(n)+r[t];a=Ec(h,a),s=Cc(h,s)}i[0]=a+Ic.touchThreshold,i[1]=s-Ic.touchThreshold,Ic.negativeSize=i[1]<i[0]},t}(),Lc=function(){function t(t){var e=this.dom=document.createElement("div");for(var i in e.className="ec-debug-dirty-rect",t=D({},t),D(t,{backgroundColor:"rgba(0, 0, 255, 0.2)",border:"1px solid #00f"}),e.style.cssText="\nposition: absolute;\nopacity: 0;\ntransition: opacity 0.5s linear;\npointer-events: none;\n",t)t.hasOwnProperty(i)&&(e.style[i]=t[i])}return t.prototype.update=function(t){var e=this.dom.style;e.width=t.width+"px",e.height=t.height+"px",e.left=t.x+"px",e.top=t.y+"px"},t.prototype.hide=function(){this.dom.style.opacity="0"},t.prototype.show=function(t){var e=this;clearTimeout(this._hideTimeout),this.dom.style.opacity="1",this._hideTimeout=setTimeout(function(){e.hide()},t||1e3)},t}();function zc(t,e){e=e||{};var i=t.painter;if(!i.getLayers)throw new Error("Debug dirty rect can only been used on canvas renderer.");if(i.isSingleCanvas())throw new Error("Debug dirty rect can only been used on zrender inited with container.");var n=document.createElement("div");n.style.cssText="\nposition:absolute;\nleft:0;\ntop:0;\nright:0;\nbottom:0;\npointer-events:none;\n",n.className="ec-debug-dirty-rect-container";var r=[],o=t.dom;o.appendChild(n),"static"===getComputedStyle(o).position&&(o.style.position="relative"),t.on("rendered",function(){if(i.getLayers){var t=0;i.eachBuiltinLayer(function(i){if(i.debugGetPaintRects)for(var o=i.debugGetPaintRects(),a=0;a<o.length;a++)o[a].width&&o[a].height&&(r[t]||(r[t]=new Lc(e.style),n.appendChild(r[t].dom)),r[t].show(e.autoHideDelay),r[t].update(o[a]),t++)});for(var o=t;o<r.length;o++)r[o].hide()}})}function jc(t){return isFinite(t)}function Bc(t,e,i){var n=null==e.x?0:e.x,r=null==e.x2?1:e.x2,o=null==e.y?0:e.y,a=null==e.y2?0:e.y2;return e.global||(n=n*i.width+i.x,r=r*i.width+i.x,o=o*i.height+i.y,a=a*i.height+i.y),n=jc(n)?n:0,r=jc(r)?r:1,o=jc(o)?o:0,a=jc(a)?a:0,t.createLinearGradient(n,o,r,a)}function Fc(t,e,i){var n=i.width,r=i.height,o=Math.min(n,r),a=null==e.x?.5:e.x,s=null==e.y?.5:e.y,l=null==e.r?.5:e.r;return e.global||(a=a*n+i.x,s=s*r+i.y,l*=o),a=jc(a)?a:.5,s=jc(s)?s:.5,l=l>=0&&jc(l)?l:.5,t.createRadialGradient(a,s,0,a,s,l)}function Nc(t,e,i){for(var n="radial"===e.type?Fc(t,e,i):Bc(t,e,i),r=e.colorStops,o=0;o<r.length;o++)n.addColorStop(r[o].offset,r[o].color);return n}function Hc(t,e){if(t===e||!t&&!e)return!1;if(!t||!e||t.length!==e.length)return!0;for(var i=0;i<t.length;i++)if(t[i]!==e[i])return!0;return!1}function Wc(t){return parseInt(t,10)}function Vc(t,e,i){var n=["width","height"][e],r=["clientWidth","clientHeight"][e],o=["paddingLeft","paddingTop"][e],a=["paddingRight","paddingBottom"][e];if(null!=i[n]&&"auto"!==i[n])return parseFloat(i[n]);var s=document.defaultView.getComputedStyle(t);return(t[r]||Wc(s[n])||Wc(t.style[n]))-(Wc(s[o])||0)-(Wc(s[a])||0)|0}function Uc(t,e){return t&&"solid"!==t&&e>0?"dashed"===t?[4*e,2*e]:"dotted"===t?[e]:Q(t)?[t]:X(t)?t:null:null}function Gc(t){var e=t.style,i=e.lineDash&&e.lineWidth>0&&Uc(e.lineDash,e.lineWidth),n=e.lineDashOffset;if(i){var r=e.strokeNoScale&&t.getLineScale?t.getLineScale():1;r&&1!==r&&(i=N(i,function(t){return t/r}),n/=r)}return[i,n]}var qc=new Ka(!0);function Zc(t){var e=t.stroke;return!(null==e||"none"===e||!(t.lineWidth>0))}function Xc(t){return"string"==typeof t&&"none"!==t}function Yc(t){var e=t.fill;return null!=e&&"none"!==e}function $c(t,e){if(null!=e.fillOpacity&&1!==e.fillOpacity){var i=t.globalAlpha;t.globalAlpha=e.fillOpacity*e.opacity,t.fill(),t.globalAlpha=i}else t.fill()}function Kc(t,e){if(null!=e.strokeOpacity&&1!==e.strokeOpacity){var i=t.globalAlpha;t.globalAlpha=e.strokeOpacity*e.opacity,t.stroke(),t.globalAlpha=i}else t.stroke()}function Qc(t,e,i){var n=Tl(e.image,e.__image,i);if(Pl(n)){var r=t.createPattern(n,e.repeat||"repeat");if("function"==typeof DOMMatrix&&r&&r.setTransform){var o=new DOMMatrix;o.translateSelf(e.x||0,e.y||0),o.rotateSelf(0,0,(e.rotation||0)*Ct),o.scaleSelf(e.scaleX||1,e.scaleY||1),r.setTransform(o)}return r}}function Jc(t,e,i,n){var r,o=Zc(i),a=Yc(i),s=i.strokePercent,l=s<1,h=!e.path;e.silent&&!l||!h||e.createPathProxy();var u=e.path||qc,c=e.__dirty;if(!n){var p=i.fill,f=i.stroke,d=a&&!!p.colorStops,v=o&&!!f.colorStops,g=a&&!!p.image,y=o&&!!f.image,m=void 0,w=void 0,x=void 0,b=void 0,_=void 0;(d||v)&&(_=e.getBoundingRect()),d&&(m=c?Nc(t,p,_):e.__canvasFillGradient,e.__canvasFillGradient=m),v&&(w=c?Nc(t,f,_):e.__canvasStrokeGradient,e.__canvasStrokeGradient=w),g&&(x=c||!e.__canvasFillPattern?Qc(t,p,e):e.__canvasFillPattern,e.__canvasFillPattern=x),y&&(b=c||!e.__canvasStrokePattern?Qc(t,f,e):e.__canvasStrokePattern,e.__canvasStrokePattern=b),d?t.fillStyle=m:g&&(x?t.fillStyle=x:a=!1),v?t.strokeStyle=w:y&&(b?t.strokeStyle=b:o=!1)}var T,S,P=e.getGlobalScale();u.setScale(P[0],P[1],e.segmentIgnoreThreshold),t.setLineDash&&i.lineDash&&(T=(r=Gc(e))[0],S=r[1]);var E=!0;(h||c&Ii)&&(u.setDPR(t.dpr),l?u.setContext(null):(u.setContext(t),E=!1),u.reset(),e.buildPath(u,e.shape,n),u.toStatic(),e.pathUpdated()),E&&u.rebuildPath(t,l?s:1),T&&(t.setLineDash(T),t.lineDashOffset=S),n||(i.strokeFirst?(o&&Kc(t,i),a&&$c(t,i)):(a&&$c(t,i),o&&Kc(t,i))),T&&t.setLineDash([])}function tp(t,e,i){var n=e.__image=Tl(i.image,e.__image,e,e.onload);if(n&&Pl(n)){var r=i.x||0,o=i.y||0,a=e.getWidth(),s=e.getHeight(),l=n.width/n.height;if(null==a&&null!=s?a=s*l:null==s&&null!=a?s=a/l:null==a&&null==s&&(a=n.width,s=n.height),i.sWidth&&i.sHeight){var h=i.sx||0,u=i.sy||0;t.drawImage(n,h,u,i.sWidth,i.sHeight,r,o,a,s)}else if(i.sx&&i.sy){var c=a-(h=i.sx),p=s-(u=i.sy);t.drawImage(n,h,u,c,p,r,o,a,s)}else t.drawImage(n,r,o,a,s)}}function ep(t,e,i){var n,r=i.text;if(null!=r&&(r+=""),r){t.font=i.font||a,t.textAlign=i.textAlign,t.textBaseline=i.textBaseline;var o=void 0,s=void 0;t.setLineDash&&i.lineDash&&(o=(n=Gc(e))[0],s=n[1]),o&&(t.setLineDash(o),t.lineDashOffset=s),i.strokeFirst?(Zc(i)&&t.strokeText(r,i.x,i.y),Yc(i)&&t.fillText(r,i.x,i.y)):(Yc(i)&&t.fillText(r,i.x,i.y),Zc(i)&&t.strokeText(r,i.x,i.y)),o&&t.setLineDash([])}}var ip=["shadowBlur","shadowOffsetX","shadowOffsetY"],np=[["lineCap","butt"],["lineJoin","miter"],["miterLimit",10]];function rp(t,e,i,n,r){var o=!1;if(!n&&e===(i=i||{}))return!1;if(n||e.opacity!==i.opacity){vp(t,r),o=!0;var a=Math.max(Math.min(e.opacity,1),0);t.globalAlpha=isNaN(a)?ua.opacity:a}(n||e.blend!==i.blend)&&(o||(vp(t,r),o=!0),t.globalCompositeOperation=e.blend||ua.blend);for(var s=0;s<ip.length;s++){var l=ip[s];(n||e[l]!==i[l])&&(o||(vp(t,r),o=!0),t[l]=t.dpr*(e[l]||0))}return(n||e.shadowColor!==i.shadowColor)&&(o||(vp(t,r),o=!0),t.shadowColor=e.shadowColor||ua.shadowColor),o}function op(t,e,i,n,r){var o=gp(e,r.inHover),a=n?null:i&&gp(i,r.inHover)||{};if(o===a)return!1;var s=rp(t,o,a,n,r);if((n||o.fill!==a.fill)&&(s||(vp(t,r),s=!0),Xc(o.fill)&&(t.fillStyle=o.fill)),(n||o.stroke!==a.stroke)&&(s||(vp(t,r),s=!0),Xc(o.stroke)&&(t.strokeStyle=o.stroke)),(n||o.opacity!==a.opacity)&&(s||(vp(t,r),s=!0),t.globalAlpha=null==o.opacity?1:o.opacity),e.hasStroke()){var l=o.lineWidth/(o.strokeNoScale&&e.getLineScale?e.getLineScale():1);t.lineWidth!==l&&(s||(vp(t,r),s=!0),t.lineWidth=l)}for(var h=0;h<np.length;h++){var u=np[h],c=u[0];(n||o[c]!==a[c])&&(s||(vp(t,r),s=!0),t[c]=o[c]||u[1])}return s}function ap(t,e,i,n,r){return rp(t,gp(e,r.inHover),i&&gp(i,r.inHover),n,r)}function sp(t,e){var i=e.transform,n=t.dpr||1;i?t.setTransform(n*i[0],n*i[1],n*i[2],n*i[3],n*i[4],n*i[5]):t.setTransform(n,0,0,n,0,0)}function lp(t,e,i){for(var n=!1,r=0;r<t.length;r++){var o=t[r];n=n||o.isZeroArea(),sp(e,o),e.beginPath(),o.buildPath(e,o.shape),e.clip()}i.allClipped=n}function hp(t,e){return t&&e?t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||t[4]!==e[4]||t[5]!==e[5]:!(!t&&!e)}var up=1,cp=2,pp=3,fp=4;function dp(t){var e=Yc(t),i=Zc(t);return!(t.lineDash||!(+e^+i)||e&&"string"!=typeof t.fill||i&&"string"!=typeof t.stroke||t.strokePercent<1||t.strokeOpacity<1||t.fillOpacity<1)}function vp(t,e){e.batchFill&&t.fill(),e.batchStroke&&t.stroke(),e.batchFill="",e.batchStroke=""}function gp(t,e){return e&&t.__hoverStyle||t.style}function yp(t,e){mp(t,e,{inHover:!1,viewWidth:0,viewHeight:0},!0)}function mp(t,e,i,n){var r=e.transform;if(!e.shouldBePainted(i.viewWidth,i.viewHeight,!1,!1))return e.__dirty&=~Ri,void(e.__isRendered=!1);var o=e.__clipPaths,a=i.prevElClipPaths,s=!1,l=!1;if(a&&!Hc(o,a)||(a&&a.length&&(vp(t,i),t.restore(),l=s=!0,i.prevElClipPaths=null,i.allClipped=!1,i.prevEl=null),o&&o.length&&(vp(t,i),t.save(),lp(o,t,i),s=!0),i.prevElClipPaths=o),i.allClipped)e.__isRendered=!1;else{e.beforeBrush&&e.beforeBrush(),e.innerBeforeBrush();var h=i.prevEl;h||(l=s=!0);var u=e instanceof _s&&e.autoBatch&&dp(e.style);s||hp(r,h.transform)?(vp(t,i),sp(t,e)):u||vp(t,i);var c=gp(e,i.inHover);e instanceof _s?(i.lastDrawType!==up&&(l=!0,i.lastDrawType=up),op(t,e,h,l,i),u&&(i.batchFill||i.batchStroke)||t.beginPath(),Jc(t,e,c,u),u&&(i.batchFill=c.fill||"",i.batchStroke=c.stroke||"")):e instanceof $l?(i.lastDrawType!==pp&&(l=!0,i.lastDrawType=pp),op(t,e,h,l,i),ep(t,e,c)):e instanceof $s?(i.lastDrawType!==cp&&(l=!0,i.lastDrawType=cp),ap(t,e,h,l,i),tp(t,e,c)):e.getTemporalDisplayables&&(i.lastDrawType!==fp&&(l=!0,i.lastDrawType=fp),wp(t,e,i)),u&&n&&vp(t,i),e.innerAfterBrush(),e.afterBrush&&e.afterBrush(),i.prevEl=e,e.__dirty=0,e.__isRendered=!0}}function wp(t,e,i){var n=e.getDisplayables(),r=e.getTemporalDisplayables();t.save();var o,a,s={prevElClipPaths:null,prevEl:null,allClipped:!1,viewWidth:i.viewWidth,viewHeight:i.viewHeight,inHover:i.inHover};for(o=e.getCursor(),a=n.length;o<a;o++)(u=n[o]).beforeBrush&&u.beforeBrush(),u.innerBeforeBrush(),mp(t,u,s,o===a-1),u.innerAfterBrush(),u.afterBrush&&u.afterBrush(),s.prevEl=u;for(var l=0,h=r.length;l<h;l++){var u;(u=r[l]).beforeBrush&&u.beforeBrush(),u.innerBeforeBrush(),mp(t,u,s,l===h-1),u.innerAfterBrush(),u.afterBrush&&u.afterBrush(),s.prevEl=u}e.clearTemporalDisplayables(),e.notClear=!0,t.restore()}function xp(t,e,i){var n=f.createCanvas(),r=e.getWidth(),o=e.getHeight(),a=n.style;return a&&(a.position="absolute",a.left="0",a.top="0",a.width=r+"px",a.height=o+"px",n.setAttribute("data-zr-dom-id",t)),n.width=r*i,n.height=o*i,n}var bp=function(t){function e(e,i,n){var r,o=t.call(this)||this;o.motionBlur=!1,o.lastFrameAlpha=.7,o.dpr=1,o.virtual=!1,o.config={},o.incremental=!1,o.zlevel=0,o.maxRepaintRectCount=5,o.__dirty=!0,o.__firstTimePaint=!0,o.__used=!1,o.__drawIndex=0,o.__startIndex=0,o.__endIndex=0,o.__prevStartIndex=null,o.__prevEndIndex=null,n=n||ao,"string"==typeof e?r=xp(e,i,n):J(e)&&(e=(r=e).id),o.id=e,o.dom=r;var a=r.style;return a&&(St(r),r.onselectstart=function(){return!1},a.padding="0",a.margin="0",a.borderWidth="0"),o.painter=i,o.dpr=n,o}return It(e,t),e.prototype.getElementCount=function(){return this.__endIndex-this.__startIndex},e.prototype.afterBrush=function(){this.__prevStartIndex=this.__startIndex,this.__prevEndIndex=this.__endIndex},e.prototype.initContext=function(){this.ctx=this.dom.getContext("2d"),this.ctx.dpr=this.dpr},e.prototype.setUnpainted=function(){this.__firstTimePaint=!0},e.prototype.createBackBuffer=function(){var t=this.dpr;this.domBack=xp("back-"+this.id,this.painter,t),this.ctxBack=this.domBack.getContext("2d"),1!==t&&this.ctxBack.scale(t,t)},e.prototype.createRepaintRects=function(t,e,i,n){if(this.__firstTimePaint)return this.__firstTimePaint=!1,null;var r,o=[],a=this.maxRepaintRectCount,s=!1,l=new ni(0,0,0,0);function h(t){if(t.isFinite()&&!t.isZero())if(0===o.length)(e=new ni(0,0,0,0)).copy(t),o.push(e);else{for(var e,i=!1,n=1/0,r=0,h=0;h<o.length;++h){var u=o[h];if(u.intersect(t)){var c=new ni(0,0,0,0);c.copy(u),c.union(t),o[h]=c,i=!0;break}if(s){l.copy(t),l.union(u);var p=t.width*t.height,f=u.width*u.height,d=l.width*l.height-p-f;d<n&&(n=d,r=h)}}s&&(o[r].union(t),i=!0),i||((e=new ni(0,0,0,0)).copy(t),o.push(e)),s||(s=o.length>=a)}}for(var u=this.__startIndex;u<this.__endIndex;++u)if(f=t[u]){var c=f.shouldBePainted(i,n,!0,!0);(d=f.__isRendered&&(f.__dirty&Ri||!c)?f.getPrevPaintRect():null)&&h(d);var p=c&&(f.__dirty&Ri||!f.__isRendered)?f.getPaintRect():null;p&&h(p)}for(u=this.__prevStartIndex;u<this.__prevEndIndex;++u){var f,d;c=(f=e[u])&&f.shouldBePainted(i,n,!0,!0),!f||c&&f.__zr||!f.__isRendered||(d=f.getPrevPaintRect())&&h(d)}do{for(r=!1,u=0;u<o.length;)if(o[u].isZero())o.splice(u,1);else{for(var v=u+1;v<o.length;)o[u].intersect(o[v])?(r=!0,o[u].union(o[v]),o.splice(v,1)):v++;u++}}while(r);return this._paintRects=o,o},e.prototype.debugGetPaintRects=function(){return(this._paintRects||[]).slice()},e.prototype.resize=function(t,e){var i=this.dpr,n=this.dom,r=n.style,o=this.domBack;r&&(r.width=t+"px",r.height=e+"px"),n.width=t*i,n.height=e*i,o&&(o.width=t*i,o.height=e*i,1!==i&&this.ctxBack.scale(i,i))},e.prototype.clear=function(t,e,i){var n=this.dom,r=this.ctx,o=n.width,a=n.height;e=e||this.clearColor;var s=this.motionBlur&&!t,l=this.lastFrameAlpha,h=this.dpr,u=this;s&&(this.domBack||this.createBackBuffer(),this.ctxBack.globalCompositeOperation="copy",this.ctxBack.drawImage(n,0,0,o/h,a/h));var c=this.domBack;function p(t,i,n,o){if(r.clearRect(t,i,n,o),e&&"transparent"!==e){var a=void 0;nt(e)?(a=(e.global||e.__width===n&&e.__height===o)&&e.__canvasGradient||Nc(r,e,{x:0,y:0,width:n,height:o}),e.__canvasGradient=a,e.__width=n,e.__height=o):rt(e)&&(e.scaleX=e.scaleX||h,e.scaleY=e.scaleY||h,a=Qc(r,e,{dirty:function(){u.setUnpainted(),u.painter.refresh()}})),r.save(),r.fillStyle=a||e,r.fillRect(t,i,n,o),r.restore()}s&&(r.save(),r.globalAlpha=l,r.drawImage(c,t,i,n,o),r.restore())}!i||s?p(0,0,o,a):i.length&&F(i,function(t){p(t.x*h,t.y*h,t.width*h,t.height*h)})},e}(ae),_p=1e5,Tp=314159,Sp=.01,Pp=.001;function Ep(t){return!!t&&(!!t.__builtin__||"function"==typeof t.resize&&"function"==typeof t.refresh)}function Cp(t,e){var i=document.createElement("div");return i.style.cssText=["position:relative","width:"+t+"px","height:"+e+"px","padding:0","margin:0","border-width:0"].join(";")+";",i}var Op=function(){function t(t,e,i,n){this.type="canvas",this._zlevelList=[],this._prevDisplayList=[],this._layers={},this._layerConfig={},this._needsManuallyCompositing=!1,this.type="canvas";var r=!t.nodeName||"CANVAS"===t.nodeName.toUpperCase();this._opts=i=D({},i||{}),this.dpr=i.devicePixelRatio||ao,this._singleCanvas=r,this.root=t,t.style&&(St(t),t.innerHTML=""),this.storage=e;var o=this._zlevelList;this._prevDisplayList=[];var a=this._layers;if(r){var s=t,l=s.width,h=s.height;null!=i.width&&(l=i.width),null!=i.height&&(h=i.height),this.dpr=i.devicePixelRatio||1,s.width=l*this.dpr,s.height=h*this.dpr,this._width=l,this._height=h;var u=new bp(s,this,this.dpr);u.__builtin__=!0,u.initContext(),a[Tp]=u,u.zlevel=Tp,o.push(Tp),this._domRoot=t}else{this._width=Vc(t,0,i),this._height=Vc(t,1,i);var c=this._domRoot=Cp(this._width,this._height);t.appendChild(c)}}return t.prototype.getType=function(){return"canvas"},t.prototype.isSingleCanvas=function(){return this._singleCanvas},t.prototype.getViewportRoot=function(){return this._domRoot},t.prototype.getViewportRootOffset=function(){var t=this.getViewportRoot();if(t)return{offsetLeft:t.offsetLeft||0,offsetTop:t.offsetTop||0}},t.prototype.refresh=function(t){var e=this.storage.getDisplayList(!0),i=this._prevDisplayList,n=this._zlevelList;this._redrawId=Math.random(),this._paintList(e,i,t,this._redrawId);for(var r=0;r<n.length;r++){var o=n[r],a=this._layers[o];if(!a.__builtin__&&a.refresh){var s=0===r?this._backgroundColor:null;a.refresh(s)}}return this._opts.useDirtyRect&&(this._prevDisplayList=e.slice()),this},t.prototype.refreshHover=function(){this._paintHoverList(this.storage.getDisplayList(!1))},t.prototype._paintHoverList=function(t){var e=t.length,i=this._hoverlayer;if(i&&i.clear(),e){for(var n,r={inHover:!0,viewWidth:this._width,viewHeight:this._height},o=0;o<e;o++){var a=t[o];a.__inHover&&(i||(i=this._hoverlayer=this.getLayer(_p)),n||(n=i.ctx).save(),mp(n,a,r,o===e-1))}n&&n.restore()}},t.prototype.getHoverLayer=function(){return this.getLayer(_p)},t.prototype.paintOne=function(t,e){yp(t,e)},t.prototype._paintList=function(t,e,i,n){if(this._redrawId===n){i=i||!1,this._updateLayerStatus(t);var r=this._doPaintList(t,e,i),o=r.finished,a=r.needsRefreshHover;if(this._needsManuallyCompositing&&this._compositeManually(),a&&this._paintHoverList(t),o)this.eachLayer(function(t){t.afterBrush&&t.afterBrush()});else{var s=this;zi(function(){s._paintList(t,e,i,n)})}}},t.prototype._compositeManually=function(){var t=this.getLayer(Tp).ctx,e=this._domRoot.width,i=this._domRoot.height;t.clearRect(0,0,e,i),this.eachBuiltinLayer(function(n){n.virtual&&t.drawImage(n.dom,0,0,e,i)})},t.prototype._doPaintList=function(t,e,n){for(var r=this,o=[],a=this._opts.useDirtyRect,s=0;s<this._zlevelList.length;s++){var l=this._zlevelList[s],h=this._layers[l];h.__builtin__&&h!==this._hoverlayer&&(h.__dirty||n)&&o.push(h)}for(var u=!0,c=!1,p=function(i){var s,l=o[i],h=l.ctx,p=a&&l.createRepaintRects(t,e,f._width,f._height),d=n?l.__startIndex:l.__drawIndex,v=!n&&l.incremental&&Date.now,g=v&&Date.now(),y=l.zlevel===f._zlevelList[0]?f._backgroundColor:null;if(l.__startIndex===l.__endIndex)l.clear(!1,y,p);else if(d===l.__startIndex){var m=t[d];m.incremental&&m.notClear&&!n||l.clear(!1,y,p)}-1===d&&(d=l.__startIndex);var w=function(e){var i={inHover:!1,allClipped:!1,prevEl:null,viewWidth:r._width,viewHeight:r._height};for(s=d;s<l.__endIndex;s++){var n=t[s];if(n.__inHover&&(c=!0),r._doPaintEl(n,l,a,e,i,s===l.__endIndex-1),v&&Date.now()-g>15)break}i.prevElClipPaths&&h.restore()};if(p)if(0===p.length)s=l.__endIndex;else for(var x=f.dpr,b=0;b<p.length;++b){var _=p[b];h.save(),h.beginPath(),h.rect(_.x*x,_.y*x,_.width*x,_.height*x),h.clip(),w(_),h.restore()}else h.save(),w(),h.restore();l.__drawIndex=s,l.__drawIndex<l.__endIndex&&(u=!1)},f=this,d=0;d<o.length;d++)p(d);return i.wxa&&F(this._layers,function(t){t&&t.ctx&&t.ctx.draw&&t.ctx.draw()}),{finished:u,needsRefreshHover:c}},t.prototype._doPaintEl=function(t,e,i,n,r,o){var a=e.ctx;if(i){var s=t.getPaintRect();(!n||s&&s.intersect(n))&&(mp(a,t,r,o),t.setPrevPaintRect(s))}else mp(a,t,r,o)},t.prototype.getLayer=function(t,e){this._singleCanvas&&!this._needsManuallyCompositing&&(t=Tp);var i=this._layers[t];return i||((i=new bp("zr_"+t,this,this.dpr)).zlevel=t,i.__builtin__=!0,this._layerConfig[t]?k(i,this._layerConfig[t],!0):this._layerConfig[t-Sp]&&k(i,this._layerConfig[t-Sp],!0),e&&(i.virtual=e),this.insertLayer(t,i),i.initContext()),i},t.prototype.insertLayer=function(t,e){var i=this._layers,n=this._zlevelList,r=n.length,o=this._domRoot,a=null,s=-1;if(i[t])O("ZLevel "+t+" has been used already");else if(Ep(e)){if(r>0&&t>n[0]){for(s=0;s<r-1&&!(n[s]<t&&n[s+1]>t);s++);a=i[n[s]]}if(n.splice(s+1,0,t),i[t]=e,!e.virtual)if(a){var l=a.dom;l.nextSibling?o.insertBefore(e.dom,l.nextSibling):o.appendChild(e.dom)}else o.firstChild?o.insertBefore(e.dom,o.firstChild):o.appendChild(e.dom);e.painter||(e.painter=this)}else O("Layer of zlevel "+t+" is not valid")},t.prototype.eachLayer=function(t,e){for(var i=this._zlevelList,n=0;n<i.length;n++){var r=i[n];t.call(e,this._layers[r],r)}},t.prototype.eachBuiltinLayer=function(t,e){for(var i=this._zlevelList,n=0;n<i.length;n++){var r=i[n],o=this._layers[r];o.__builtin__&&t.call(e,o,r)}},t.prototype.eachOtherLayer=function(t,e){for(var i=this._zlevelList,n=0;n<i.length;n++){var r=i[n],o=this._layers[r];o.__builtin__||t.call(e,o,r)}},t.prototype.getLayers=function(){return this._layers},t.prototype._updateLayerStatus=function(t){function e(t){o&&(o.__endIndex!==t&&(o.__dirty=!0),o.__endIndex=t)}if(this.eachBuiltinLayer(function(t,e){t.__dirty=t.__used=!1}),this._singleCanvas)for(var i=1;i<t.length;i++)if((s=t[i]).zlevel!==t[i-1].zlevel||s.incremental){this._needsManuallyCompositing=!0;break}var n,r,o=null,a=0;for(r=0;r<t.length;r++){var s,l=(s=t[r]).zlevel,h=void 0;n!==l&&(n=l,a=0),s.incremental?((h=this.getLayer(l+Pp,this._needsManuallyCompositing)).incremental=!0,a=1):h=this.getLayer(l+(a>0?Sp:0),this._needsManuallyCompositing),h.__builtin__||O("ZLevel "+l+" has been used by unkown layer "+h.id),h!==o&&(h.__used=!0,h.__startIndex!==r&&(h.__dirty=!0),h.__startIndex=r,h.incremental?h.__drawIndex=-1:h.__drawIndex=r,e(r),o=h),s.__dirty&Ri&&!s.__inHover&&(h.__dirty=!0,h.incremental&&h.__drawIndex<0&&(h.__drawIndex=r))}e(r),this.eachBuiltinLayer(function(t,e){!t.__used&&t.getElementCount()>0&&(t.__dirty=!0,t.__startIndex=t.__endIndex=t.__drawIndex=0),t.__dirty&&t.__drawIndex<0&&(t.__drawIndex=t.__startIndex)})},t.prototype.clear=function(){return this.eachBuiltinLayer(this._clearLayer),this},t.prototype._clearLayer=function(t){t.clear()},t.prototype.setBackgroundColor=function(t){this._backgroundColor=t,F(this._layers,function(t){t.setUnpainted()})},t.prototype.configLayer=function(t,e){if(e){var i=this._layerConfig;i[t]?k(i[t],e,!0):i[t]=e;for(var n=0;n<this._zlevelList.length;n++){var r=this._zlevelList[n];r!==t&&r!==t+Sp||k(this._layers[r],i[t],!0)}}},t.prototype.delLayer=function(t){var e=this._layers,i=this._zlevelList,n=e[t];n&&(n.dom.parentNode.removeChild(n.dom),delete e[t],i.splice(L(i,t),1))},t.prototype.resize=function(t,e){if(this._domRoot.style){var i=this._domRoot;i.style.display="none";var n=this._opts,r=this.root;if(null!=t&&(n.width=t),null!=e&&(n.height=e),t=Vc(r,0,n),e=Vc(r,1,n),i.style.display="",this._width!==t||e!==this._height){for(var o in i.style.width=t+"px",i.style.height=e+"px",this._layers)this._layers.hasOwnProperty(o)&&this._layers[o].resize(t,e);this.refresh(!0)}this._width=t,this._height=e}else{if(null==t||null==e)return;this._width=t,this._height=e,this.getLayer(Tp).resize(t,e)}return this},t.prototype.clearLayer=function(t){var e=this._layers[t];e&&e.clear()},t.prototype.dispose=function(){this.root.innerHTML="",this.root=this.storage=this._domRoot=this._layers=null},t.prototype.getRenderedCanvas=function(t){if(t=t||{},this._singleCanvas&&!this._compositeManually)return this._layers[Tp].dom;var e=new bp("image",this,t.pixelRatio||this.dpr);e.initContext(),e.clear(!1,t.backgroundColor||this._backgroundColor);var i=e.ctx;if(t.pixelRatio<=this.dpr){this.refresh();var n=e.dom.width,r=e.dom.height;this.eachLayer(function(t){t.__builtin__?i.drawImage(t.dom,0,0,n,r):t.renderToCanvas&&(i.save(),t.renderToCanvas(i),i.restore())})}else for(var o={inHover:!1,viewWidth:this._width,viewHeight:this._height},a=this.storage.getDisplayList(!0),s=0,l=a.length;s<l;s++){var h=a[s];mp(i,h,o,s===l-1)}return e.dom},t.prototype.getWidth=function(){return this._width},t.prototype.getHeight=function(){return this._height},t}(),Rp=Math.sin,kp=Math.cos,Ip=Math.PI,Dp=2*Math.PI,Mp=180/Ip,Ap=function(){function t(){}return t.prototype.reset=function(t){this._start=!0,this._d=[],this._str="",this._p=Math.pow(10,t||4)},t.prototype.moveTo=function(t,e){this._add("M",t,e)},t.prototype.lineTo=function(t,e){this._add("L",t,e)},t.prototype.bezierCurveTo=function(t,e,i,n,r,o){this._add("C",t,e,i,n,r,o)},t.prototype.quadraticCurveTo=function(t,e,i,n){this._add("Q",t,e,i,n)},t.prototype.arc=function(t,e,i,n,r,o){this.ellipse(t,e,i,i,0,n,r,o)},t.prototype.ellipse=function(t,e,i,n,r,o,a,s){var l=a-o,h=!s,u=Math.abs(l),c=Yn(u-Dp)||(h?l>=Dp:-l>=Dp),p=l>0?l%Dp:l%Dp+Dp,f=!1;f=!!c||!Yn(u)&&p>=Ip==!!h;var d=t+i*kp(o),v=e+n*Rp(o);this._start&&this._add("M",d,v);var g=Math.round(r*Mp);if(c){var y=1/this._p,m=(h?1:-1)*(Dp-y);this._add("A",i,n,g,1,+h,t+i*kp(o+m),e+n*Rp(o+m)),y>.01&&this._add("A",i,n,g,0,+h,d,v)}else{var w=t+i*kp(a),x=e+n*Rp(a);this._add("A",i,n,g,+f,+h,w,x)}},t.prototype.rect=function(t,e,i,n){this._add("M",t,e),this._add("l",i,0),this._add("l",0,n),this._add("l",-i,0),this._add("Z")},t.prototype.closePath=function(){this._d.length>0&&this._add("Z")},t.prototype._add=function(t,e,i,n,r,o,a,s,l){for(var h=[],u=this._p,c=1;c<arguments.length;c++){var p=arguments[c];if(isNaN(p))return void(this._invalid=!0);h.push(Math.round(p*u)/u)}this._d.push(t+h.join(" ")),this._start="Z"===t},t.prototype.generateStr=function(){this._str=this._invalid?"":this._d.join(""),this._d=[]},t.prototype.getStr=function(){return this._str},t}(),Lp="none",zp=Math.round;function jp(t){var e=t.fill;return null!=e&&e!==Lp}function Bp(t){var e=t.stroke;return null!=e&&e!==Lp}var Fp=["lineCap","miterLimit","lineJoin"],Np=N(Fp,function(t){return"stroke-"+t.toLowerCase()});function Hp(t,e,i,n){var r=null==e.opacity?1:e.opacity;if(i instanceof $s)t("opacity",r);else{if(jp(e)){var o=Zn(e.fill);t("fill",o.color);var a=null!=e.fillOpacity?e.fillOpacity*o.opacity*r:o.opacity*r;(n||a<1)&&t("fill-opacity",a)}else t("fill",Lp);if(Bp(e)){var s=Zn(e.stroke);t("stroke",s.color);var l=e.strokeNoScale?i.getLineScale():1,h=l?(e.lineWidth||0)/l:0,u=null!=e.strokeOpacity?e.strokeOpacity*s.opacity*r:s.opacity*r,c=e.strokeFirst;if((n||1!==h)&&t("stroke-width",h),(n||c)&&t("paint-order",c?"stroke":"fill"),(n||u<1)&&t("stroke-opacity",u),e.lineDash){var p=Gc(i),f=p[0],d=p[1];f&&(d=zp(d||0),t("stroke-dasharray",f.join(",")),(d||n)&&t("stroke-dashoffset",d))}else n&&t("stroke-dasharray",Lp);for(var v=0;v<Fp.length;v++){var g=Fp[v];if(n||e[g]!==ws[g]){var y=e[g]||ws[g];y&&t(Np[v],y)}}}else n&&t("stroke",Lp)}}var Wp="http://www.w3.org/2000/svg",Vp="http://www.w3.org/1999/xlink",Up="http://www.w3.org/2000/xmlns/",Gp="http://www.w3.org/XML/1998/namespace",qp="ecmeta_";function Zp(t){return document.createElementNS(Wp,t)}function Xp(t,e,i,n,r){return{tag:t,attrs:i||{},children:n,text:r,key:e}}function Yp(t,e){var i=[];if(e)for(var n in e){var r=e[n],o=n;!1!==r&&(!0!==r&&null!=r&&(o+='="'+r+'"'),i.push(o))}return"<"+t+" "+i.join(" ")+">"}function $p(t){return"</"+t+">"}function Kp(t,e){var i=(e=e||{}).newline?"\n":"";function n(t){var e=t.children,r=t.tag,o=t.attrs,a=t.text;return Yp(r,o)+("style"!==r?ye(a):a||"")+(e?""+i+N(e,function(t){return n(t)}).join(i)+i:"")+$p(r)}return n(t)}function Qp(t,e,i){var n=(i=i||{}).newline?"\n":"",r=" {"+n,o=n+"}",a=N(U(t),function(e){return e+r+N(U(t[e]),function(i){return i+":"+t[e][i]+";"}).join(n)+o}).join(n),s=N(U(e),function(t){return"@keyframes "+t+r+N(U(e[t]),function(i){return i+r+N(U(e[t][i]),function(n){var r=e[t][i][n];return"d"===n&&(r='path("'+r+'")'),n+":"+r+";"}).join(n)+o}).join(n)+o}).join(n);return a||s?["<![CDATA[",a,s,"]]>"].join(n):""}function Jp(t){return{zrId:t,shadowCache:{},patternCache:{},gradientCache:{},clipPathCache:{},defs:{},cssNodes:{},cssAnims:{},cssStyleCache:{},cssAnimIdx:0,shadowIdx:0,gradientIdx:0,patternIdx:0,clipPathIdx:0}}function tf(t,e,i,n){return Xp("svg","root",{width:t,height:e,xmlns:Wp,"xmlns:xlink":Vp,version:"1.1",baseProfile:"full",viewBox:!!n&&"0 0 "+t+" "+e},i)}var ef=0;function nf(){return ef++}var rf={cubicIn:"0.32,0,0.67,0",cubicOut:"0.33,1,0.68,1",cubicInOut:"0.65,0,0.35,1",quadraticIn:"0.11,0,0.5,0",quadraticOut:"0.5,1,0.89,1",quadraticInOut:"0.45,0,0.55,1",quarticIn:"0.5,0,0.75,0",quarticOut:"0.25,1,0.5,1",quarticInOut:"0.76,0,0.24,1",quinticIn:"0.64,0,0.78,0",quinticOut:"0.22,1,0.36,1",quinticInOut:"0.83,0,0.17,1",sinusoidalIn:"0.12,0,0.39,0",sinusoidalOut:"0.61,1,0.88,1",sinusoidalInOut:"0.37,0,0.63,1",exponentialIn:"0.7,0,0.84,0",exponentialOut:"0.16,1,0.3,1",exponentialInOut:"0.87,0,0.13,1",circularIn:"0.55,0,1,0.45",circularOut:"0,0.55,0.45,1",circularInOut:"0.85,0,0.15,1"},of="transform-origin";function af(t,e,i){var n=D({},t.shape);D(n,e),t.buildPath(i,n);var r=new Ap;return r.reset(ur(t)),i.rebuildPath(r,1),r.generateStr(),r.getStr()}function sf(t,e){var i=e.originX,n=e.originY;(i||n)&&(t[of]=i+"px "+n+"px")}var lf={fill:"fill",opacity:"opacity",lineWidth:"stroke-width",lineDashOffset:"stroke-dashoffset"};function hf(t,e){var i=e.zrId+"-ani-"+e.cssAnimIdx++;return e.cssAnims[i]=t,i}function uf(t,e,i){var n,r,o=t.shape.paths,a={};if(F(o,function(t){var e=Jp(i.zrId);e.animation=!0,pf(t,{},e,!0);var o=e.cssAnims,s=e.cssNodes,l=U(o),h=l.length;if(h){var u=o[r=l[h-1]];for(var c in u){var p=u[c];a[c]=a[c]||{d:""},a[c].d+=p.d||""}for(var f in s){var d=s[f].animation;d.indexOf(r)>=0&&(n=d)}}}),n){e.d=!1;var s=hf(a,i);return n.replace(r,s)}}function cf(t){return $(t)?rf[t]?"cubic-bezier("+rf[t]+")":cn(t)?t:"":""}function pf(t,e,i,n){var r=t.animators,o=r.length,a=[];if(t instanceof Cu){if(g=uf(t,e,i))a.push(g);else if(!o)return}else if(!o)return;for(var s={},l=0;l<o;l++){var h=r[l],u=[h.getMaxTime()/1e3+"s"],c=cf(h.getClip().easing),p=h.getDelay();c?u.push(c):u.push("linear"),p&&u.push(p/1e3+"s"),h.getLoop()&&u.push("infinite");var f=u.join(" ");s[f]=s[f]||[f,[]],s[f][1].push(h)}function d(r){var o,a=r[1],s=a.length,l={},h={},u={},c="animation-timing-function";function p(t,e,i){for(var n=t.getTracks(),r=t.getMaxTime(),o=0;o<n.length;o++){var a=n[o];if(a.needsAnimate()){var s=a.keyframes,l=a.propName;if(i&&(l=i(l)),l)for(var h=0;h<s.length;h++){var u=s[h],p=Math.round(u.time/r*100)+"%",f=cf(u.easing),d=u.rawValue;($(d)||Q(d))&&(e[p]=e[p]||{},e[p][l]=u.rawValue,f&&(e[p][c]=f))}}}}for(var f=0;f<s;f++)(T=(_=a[f]).targetName)?"shape"===T&&p(_,h):!n&&p(_,l);for(var d in l){var v={};_o(v,t),D(v,l[d]);var g=cr(v),y=l[d][c];u[d]=g?{transform:g}:{},sf(u[d],v),y&&(u[d][c]=y)}var m=!0;for(var d in h){u[d]=u[d]||{};var w=!o;y=h[d][c],w&&(o=new Ka);var x=o.len();o.reset(),u[d].d=af(t,h[d],o);var b=o.len();if(!w&&x!==b){m=!1;break}y&&(u[d][c]=y)}if(!m)for(var d in u)delete u[d].d;if(!n)for(f=0;f<s;f++){var _,T;"style"===(T=(_=a[f]).targetName)&&p(_,u,function(t){return lf[t]})}var S,P=U(u),E=!0;for(f=1;f<P.length;f++){var C=P[f-1],O=P[f];if(u[C][of]!==u[O][of]){E=!1;break}S=u[C][of]}if(E&&S){for(var d in u)u[d][of]&&delete u[d][of];e[of]=S}if(W(P,function(t){return U(u[t]).length>0}).length)return hf(u,i)+" "+r[0]+" both"}for(var v in s){var g;(g=d(s[v]))&&a.push(g)}if(a.length){var y=i.zrId+"-cls-"+nf();i.cssNodes["."+y]={animation:a.join(",")},e.class=y}}function ff(t,e,i){if(!t.ignore)if(t.isSilent())df(h={"pointer-events":"none"},e,i,!0);else{var n=t.states.emphasis&&t.states.emphasis.style?t.states.emphasis.style:{},r=n.fill;if(!r){var o=t.style&&t.style.fill,a=t.states.select&&t.states.select.style&&t.states.select.style.fill,s=t.currentStates.indexOf("select")>=0&&a||o;s&&(r=Un(s))}var l=n.lineWidth;l&&(l/=!n.strokeNoScale&&t.transform?t.transform[0]:1);var h={cursor:"pointer"};r&&(h.fill=r),n.stroke&&(h.stroke=n.stroke),l&&(h["stroke-width"]=l),df(h,e,i,!0)}}function df(t,e,i,n){var r=JSON.stringify(t),o=i.cssStyleCache[r];o||(o=i.zrId+"-cls-"+nf(),i.cssStyleCache[r]=o,i.cssNodes["."+o+(n?":hover":"")]=t),e.class=e.class?e.class+" "+o:o}var vf=Math.round;function gf(t){return t&&$(t.src)}function yf(t){return t&&Y(t.toDataURL)}function mf(t,e,i,n){Hp(function(r,o){var a="fill"===r||"stroke"===r;a&&lr(o)?Mf(e,t,r,n):a&&or(o)?Af(i,t,r,n):t[r]=o,a&&n.ssr&&"none"===o&&(t["pointer-events"]="visible")},e,i,!1),Df(i,t,n)}function wf(t,e){var i=aa(e);i&&(i.each(function(e,i){null!=e&&(t[(qp+i).toLowerCase()]=e+"")}),e.isSilent()&&(t[qp+"silent"]="true"))}function xf(t){return Yn(t[0]-1)&&Yn(t[1])&&Yn(t[2])&&Yn(t[3]-1)}function bf(t){return Yn(t[4])&&Yn(t[5])}function _f(t,e,i){if(e&&(!bf(e)||!xf(e))){var n=i?10:1e4;t.transform=xf(e)?"translate("+vf(e[4]*n)/n+" "+vf(e[5]*n)/n+")":Qn(e)}}function Tf(t,e,i){for(var n=t.points,r=[],o=0;o<n.length;o++)r.push(vf(n[o][0]*i)/i),r.push(vf(n[o][1]*i)/i);e.points=r.join(" ")}function Sf(t){return!t.smooth}function Pf(t){var e=N(t,function(t){return"string"==typeof t?[t,t]:t});return function(t,i,n){for(var r=0;r<e.length;r++){var o=e[r],a=t[o[0]];null!=a&&(i[o[1]]=vf(a*n)/n)}}}var Ef={circle:[Pf(["cx","cy","r"])],polyline:[Tf,Sf],polygon:[Tf,Sf]};function Cf(t){for(var e=t.animators,i=0;i<e.length;i++)if("shape"===e[i].targetName)return!0;return!1}function Of(t,e){var i=t.style,n=t.shape,r=Ef[t.type],o={},a=e.animation,s="path",l=t.style.strokePercent,h=e.compress&&ur(t)||4;if(!r||e.willUpdate||r[1]&&!r[1](n)||a&&Cf(t)||l<1){var u=!t.path||t.shapeChanged();t.path||t.createPathProxy();var c=t.path;u&&(c.beginPath(),t.buildPath(c,t.shape),t.pathUpdated());var p=c.getVersion(),f=t,d=f.__svgPathBuilder;f.__svgPathVersion===p&&d&&l===f.__svgPathStrokePercent||(d||(d=f.__svgPathBuilder=new Ap),d.reset(h),c.rebuildPath(d,l),d.generateStr(),f.__svgPathVersion=p,f.__svgPathStrokePercent=l),o.d=d.getStr()}else{s=t.type;var v=Math.pow(10,h);r[0](n,o,v)}return _f(o,t.transform),mf(o,i,t,e),wf(o,t),e.animation&&pf(t,o,e),e.emphasis&&ff(t,o,e),Xp(s,t.id+"",o)}function Rf(t,e){var i=t.style,n=i.image;if(n&&!$(n)&&(gf(n)?n=n.src:yf(n)&&(n=n.toDataURL())),n){var r=i.x||0,o=i.y||0,a={href:n,width:i.width,height:i.height};return r&&(a.x=r),o&&(a.y=o),_f(a,t.transform),mf(a,i,t,e),wf(a,t),e.animation&&pf(t,a,e),Xp("image",t.id+"",a)}}function kf(t,e){var i=t.style,n=i.text;if(null!=n&&(n+=""),n&&!isNaN(i.x)&&!isNaN(i.y)){var r=i.font||a,s=i.x||0,l=tr(i.y||0,Io(r),i.textBaseline),h={"dominant-baseline":"central","text-anchor":Jn[i.textAlign]||i.textAlign};if(Nu(i)){var u="",c=i.fontStyle,p=Bu(i.fontSize);if(!parseFloat(p))return;var f=i.fontFamily||o,d=i.fontWeight;u+="font-size:"+p+";font-family:"+f+";",c&&"normal"!==c&&(u+="font-style:"+c+";"),d&&"normal"!==d&&(u+="font-weight:"+d+";"),h.style=u}else h.style="font: "+r;return n.match(/\s/)&&(h["xml:space"]="preserve"),s&&(h.x=s),l&&(h.y=l),_f(h,t.transform),mf(h,i,t,e),wf(h,t),e.animation&&pf(t,h,e),Xp("text",t.id+"",h,void 0,n)}}function If(t,e){return t instanceof _s?Of(t,e):t instanceof $s?Rf(t,e):t instanceof $l?kf(t,e):void 0}function Df(t,e,i){var n=t.style;if(er(n)){var r=ir(t),o=i.shadowCache,a=o[r];if(!a){var s=t.getGlobalScale(),l=s[0],h=s[1];if(!l||!h)return;var u=n.shadowOffsetX||0,c=n.shadowOffsetY||0,p=n.shadowBlur,f=Zn(n.shadowColor),d=f.opacity,v=f.color,g=p/2/l+" "+p/2/h;a=i.zrId+"-s"+i.shadowIdx++,i.defs[a]=Xp("filter",a,{id:a,x:"-100%",y:"-100%",width:"300%",height:"300%"},[Xp("feDropShadow","",{dx:u/l,dy:c/h,stdDeviation:g,"flood-color":v,"flood-opacity":d})]),o[r]=a}e.filter=hr(a)}}function Mf(t,e,i,n){var r,o=t[i],a={gradientUnits:o.global?"userSpaceOnUse":"objectBoundingBox"};if(ar(o))r="linearGradient",a.x1=o.x,a.y1=o.y,a.x2=o.x2,a.y2=o.y2;else{if(!sr(o))return void O("Illegal gradient type.");r="radialGradient",a.cx=lt(o.x,.5),a.cy=lt(o.y,.5),a.r=lt(o.r,.5)}for(var s=o.colorStops,l=[],h=0,u=s.length;h<u;++h){var c=100*Kn(s[h].offset)+"%",p=Zn(s[h].color),f=p.color,d=p.opacity,v={offset:c};v["stop-color"]=f,d<1&&(v["stop-opacity"]=d),l.push(Xp("stop",h+"",v))}var g=Kp(Xp(r,"",a,l)),y=n.gradientCache,m=y[g];m||(m=n.zrId+"-g"+n.gradientIdx++,y[g]=m,a.id=m,n.defs[m]=Xp(r,m,a,l)),e[i]=hr(m)}function Af(t,e,i,n){var r,o=t.style[i],a=t.getBoundingRect(),s={},l=o.repeat,h="no-repeat"===l,u="repeat-x"===l,c="repeat-y"===l;if(nr(o)){var p=o.imageWidth,f=o.imageHeight,d=void 0,v=o.image;if($(v)?d=v:gf(v)?d=v.src:yf(v)&&(d=v.toDataURL()),"undefined"==typeof Image){var g="Image width/height must been given explictly in svg-ssr renderer.";pt(p,g),pt(f,g)}else if(null==p||null==f){var y=function(t,e){if(t){var i=t.elm,n=p||e.width,r=f||e.height;"pattern"===t.tag&&(u?(r=1,n/=a.width):c&&(n=1,r/=a.height)),t.attrs.width=n,t.attrs.height=r,i&&(i.setAttribute("width",n),i.setAttribute("height",r))}},m=Tl(d,null,t,function(t){h||y(_,t),y(r,t)});m&&m.width&&m.height&&(p=p||m.width,f=f||m.height)}r=Xp("image","img",{href:d,width:p,height:f}),s.width=p,s.height=f}else o.svgElement&&(r=R(o.svgElement),s.width=o.svgWidth,s.height=o.svgHeight);if(r){var w,x;h?w=x=1:u?(x=1,w=s.width/a.width):c?(w=1,x=s.height/a.height):s.patternUnits="userSpaceOnUse",null==w||isNaN(w)||(s.width=w),null==x||isNaN(x)||(s.height=x);var b=cr(o);b&&(s.patternTransform=b);var _=Xp("pattern","",s,[r]),T=Kp(_),S=n.patternCache,P=S[T];P||(P=n.zrId+"-p"+n.patternIdx++,S[T]=P,s.id=P,_=n.defs[P]=Xp("pattern",P,s,[r])),e[i]=hr(P)}}function Lf(t,e,i){var n=i.clipPathCache,r=i.defs,o=n[t.id];if(!o){var a={id:o=i.zrId+"-c"+i.clipPathIdx++};n[t.id]=o,r[o]=Xp("clipPath",o,a,[Of(t,i)])}e["clip-path"]=hr(o)}function zf(t){return document.createTextNode(t)}function jf(t,e,i){t.insertBefore(e,i)}function Bf(t,e){t.removeChild(e)}function Ff(t,e){t.appendChild(e)}function Nf(t){return t.parentNode}function Hf(t){return t.nextSibling}function Wf(t,e){t.textContent=e}var Vf=58,Uf=120,Gf=Xp("","");function qf(t){return void 0===t}function Zf(t){return void 0!==t}function Xf(t,e,i){for(var n={},r=e;r<=i;++r){var o=t[r].key;void 0!==o&&(n[o],n[o]=r)}return n}function Yf(t,e){var i=t.key===e.key;return t.tag===e.tag&&i}function $f(t){var e,i=t.children,n=t.tag;if(Zf(n)){var r=t.elm=Zp(n);if(Jf(Gf,t),X(i))for(e=0;e<i.length;++e){var o=i[e];null!=o&&Ff(r,$f(o))}else Zf(t.text)&&!J(t.text)&&Ff(r,zf(t.text))}else t.elm=zf(t.text);return t.elm}function Kf(t,e,i,n,r){for(;n<=r;++n){var o=i[n];null!=o&&jf(t,$f(o),e)}}function Qf(t,e,i,n){for(;i<=n;++i){var r=e[i];null!=r&&(Zf(r.tag)?Bf(Nf(r.elm),r.elm):Bf(t,r.elm))}}function Jf(t,e){var i,n=e.elm,r=t&&t.attrs||{},o=e.attrs||{};if(r!==o){for(i in o){var a=o[i];r[i]!==a&&(!0===a?n.setAttribute(i,""):!1===a?n.removeAttribute(i):"style"===i?n.style.cssText=a:i.charCodeAt(0)!==Uf?n.setAttribute(i,a):"xmlns:xlink"===i||"xmlns"===i?n.setAttributeNS(Up,i,a):i.charCodeAt(3)===Vf?n.setAttributeNS(Gp,i,a):i.charCodeAt(5)===Vf?n.setAttributeNS(Vp,i,a):n.setAttribute(i,a))}for(i in r)i in o||n.removeAttribute(i)}}function td(t,e,i){for(var n,r,o,a=0,s=0,l=e.length-1,h=e[0],u=e[l],c=i.length-1,p=i[0],f=i[c];a<=l&&s<=c;)null==h?h=e[++a]:null==u?u=e[--l]:null==p?p=i[++s]:null==f?f=i[--c]:Yf(h,p)?(ed(h,p),h=e[++a],p=i[++s]):Yf(u,f)?(ed(u,f),u=e[--l],f=i[--c]):Yf(h,f)?(ed(h,f),jf(t,h.elm,Hf(u.elm)),h=e[++a],f=i[--c]):Yf(u,p)?(ed(u,p),jf(t,u.elm,h.elm),u=e[--l],p=i[++s]):(qf(n)&&(n=Xf(e,a,l)),qf(r=n[p.key])||(o=e[r]).tag!==p.tag?jf(t,$f(p),h.elm):(ed(o,p),e[r]=void 0,jf(t,o.elm,h.elm)),p=i[++s]);(a<=l||s<=c)&&(a>l?Kf(t,null==i[c+1]?null:i[c+1].elm,i,s,c):Qf(t,e,a,l))}function ed(t,e){var i=e.elm=t.elm,n=t.children,r=e.children;t!==e&&(Jf(t,e),qf(e.text)?Zf(n)&&Zf(r)?n!==r&&td(i,n,r):Zf(r)?(Zf(t.text)&&Wf(i,""),Kf(i,null,r,0,r.length-1)):Zf(n)?Qf(i,n,0,n.length-1):Zf(t.text)&&Wf(i,""):t.text!==e.text&&(Zf(n)&&Qf(i,n,0,n.length-1),Wf(i,e.text)))}function id(t,e){if(Yf(t,e))ed(t,e);else{var i=t.elm,n=Nf(i);$f(e),null!==n&&(jf(n,e.elm,Hf(i)),Qf(n,[t],0,0))}return e}var nd=0,rd=function(){function t(t,e,i){if(this.type="svg",this.refreshHover=od("refreshHover"),this.configLayer=od("configLayer"),this.storage=e,this._opts=i=D({},i),this.root=t,this._id="zr"+nd++,this._oldVNode=tf(i.width,i.height),t&&!i.ssr){var n=this._viewport=document.createElement("div");n.style.cssText="position:relative;overflow:hidden";var r=this._svgDom=this._oldVNode.elm=Zp("svg");Jf(null,this._oldVNode),n.appendChild(r),t.appendChild(n)}this.resize(i.width,i.height)}return t.prototype.getType=function(){return this.type},t.prototype.getViewportRoot=function(){return this._viewport},t.prototype.getViewportRootOffset=function(){var t=this.getViewportRoot();if(t)return{offsetLeft:t.offsetLeft||0,offsetTop:t.offsetTop||0}},t.prototype.getSvgDom=function(){return this._svgDom},t.prototype.refresh=function(){if(this.root){var t=this.renderToVNode({willUpdate:!0});t.attrs.style="position:absolute;left:0;top:0;user-select:none",id(this._oldVNode,t),this._oldVNode=t}},t.prototype.renderOneToVNode=function(t){return If(t,Jp(this._id))},t.prototype.renderToVNode=function(t){t=t||{};var e=this.storage.getDisplayList(!0),i=this._width,n=this._height,r=Jp(this._id);r.animation=t.animation,r.willUpdate=t.willUpdate,r.compress=t.compress,r.emphasis=t.emphasis,r.ssr=this._opts.ssr;var o=[],a=this._bgVNode=ad(i,n,this._backgroundColor,r);a&&o.push(a);var s=t.compress?null:this._mainVNode=Xp("g","main",{},[]);this._paintList(e,r,s?s.children:o),s&&o.push(s);var l=N(U(r.defs),function(t){return r.defs[t]});if(l.length&&o.push(Xp("defs","defs",{},l)),t.animation){var h=Qp(r.cssNodes,r.cssAnims,{newline:!0});if(h){var u=Xp("style","stl",{},[],h);o.push(u)}}return tf(i,n,o,t.useViewBox)},t.prototype.renderToString=function(t){return t=t||{},Kp(this.renderToVNode({animation:lt(t.cssAnimation,!0),emphasis:lt(t.cssEmphasis,!0),willUpdate:!1,compress:!0,useViewBox:lt(t.useViewBox,!0)}),{newline:!0})},t.prototype.setBackgroundColor=function(t){this._backgroundColor=t},t.prototype.getSvgRoot=function(){return this._mainVNode&&this._mainVNode.elm},t.prototype._paintList=function(t,e,i){for(var n,r,o=t.length,a=[],s=0,l=0,h=0;h<o;h++){var u=t[h];if(!u.invisible){var c=u.__clipPaths,p=c&&c.length||0,f=r&&r.length||0,d=void 0;for(d=Math.max(p-1,f-1);d>=0&&(!c||!r||c[d]!==r[d]);d--);for(var v=f-1;v>d;v--)n=a[--s-1];for(var g=d+1;g<p;g++){var y={};Lf(c[g],y,e);var m=Xp("g","clip-g-"+l++,y,[]);(n?n.children:i).push(m),a[s++]=m,n=m}r=c;var w=If(u,e);w&&(n?n.children:i).push(w)}}},t.prototype.resize=function(t,e){var i=this._opts,n=this.root,r=this._viewport;if(null!=t&&(i.width=t),null!=e&&(i.height=e),n&&r&&(r.style.display="none",t=Vc(n,0,i),e=Vc(n,1,i),r.style.display=""),this._width!==t||this._height!==e){if(this._width=t,this._height=e,r){var o=r.style;o.width=t+"px",o.height=e+"px"}if(or(this._backgroundColor))this.refresh();else{var a=this._svgDom;a&&(a.setAttribute("width",t),a.setAttribute("height",e));var s=this._bgVNode&&this._bgVNode.elm;s&&(s.setAttribute("width",t),s.setAttribute("height",e))}}},t.prototype.getWidth=function(){return this._width},t.prototype.getHeight=function(){return this._height},t.prototype.dispose=function(){this.root&&(this.root.innerHTML=""),this._svgDom=this._viewport=this.storage=this._oldVNode=this._bgVNode=this._mainVNode=null},t.prototype.clear=function(){this._svgDom&&(this._svgDom.innerHTML=null),this._oldVNode=null},t.prototype.toDataURL=function(t){var e=this.renderToString(),i="data:image/svg+xml;";return t?(e=pr(e))&&i+"base64,"+e:i+"charset=UTF-8,"+encodeURIComponent(e)},t}();function od(t){return function(){O('In SVG mode painter not support method "'+t+'"')}}function ad(t,e,i,n){var r;if(i&&"none"!==i)if(r=Xp("rect","bg",{width:t,height:e,x:"0",y:"0"}),lr(i))Mf({fill:i},r.attrs,"fill",n);else if(or(i))Af({style:{fill:i},dirty:Et,getBoundingRect:function(){return{width:t,height:e}}},r.attrs,"fill",n);else{var o=Zn(i),a=o.color,s=o.opacity;r.attrs.fill=a,s<1&&(r.attrs["fill-opacity"]=s)}return r}oa("canvas",Op),oa("svg",rd),t.Arc=Yu,t.ArcShape=Xu,t.BezierCurve=Ju,t.BezierCurveShape=Ku,t.BoundingRect=ni,t.Circle=Qs,t.CircleShape=Ks,t.CompoundPath=Cu,t.Displayable=da,t.Droplet=ec,t.DropletShape=tc,t.Element=No,t.Ellipse=ll,t.EllipseShape=sl,t.Group=Xo,t.Heart=nc,t.HeartShape=ic,t.Image=$s,t.IncrementalDisplayable=Ru,t.Isogon=lc,t.IsogonShape=sc,t.Line=cl,t.LineShape=ul,t.LinearGradient=wl,t.OrientedBoundingRect=Ac,t.Path=_s,t.Pattern=Pc,t.Point=Ve,t.Polygon=vl,t.PolygonShape=dl,t.Polyline=yl,t.PolylineShape=gl,t.RadialGradient=xl,t.Rect=al,t.RectShape=rl,t.Ring=uc,t.RingShape=hc,t.Rose=vc,t.RoseShape=dc,t.Sector=Fh,t.SectorShape=Bh,t.Star=xc,t.StarShape=wc,t.TSpan=$l,t.Text=Au,t.Trochoid=Sc,t.TrochoidShape=Tc,t.color=Gn,t.dispose=ia,t.disposeAll=na,t.getElementSSRData=aa,t.getInstance=ra,t.init=ea,t.matrix=We,t.morph=Eu,t.parseSVG=_h,t.path=qs,t.registerPainter=oa,t.registerSSRDataGetter=sa,t.setPlatformAPI=d,t.showDebugDirtyRect=zc,t.util=Rt,t.vector=ne,t.version=la,Object.defineProperty(t,"__esModule",{value:!0})}(e)},3392:function(t,e,i){var n=i(9504),r=0,o=Math.random(),a=n(1..toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+a(++r+o,36)}},3418:function(t,e,i){var n=i(6518),r=i(7916);n({target:"Array",stat:!0,forced:!i(4428)(function(t){Array.from(t)})},{from:r})},3470:function(t){t.exports=Object.is||function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}},3500:function(t,e,i){var n=i(4576),r=i(7400),o=i(9296),a=i(235),s=i(6699),l=function(t){if(t&&t.forEach!==a)try{s(t,"forEach",a)}catch(e){t.forEach=a}};for(var h in r)r[h]&&l(n[h]&&n[h].prototype);l(o)},3506:function(t,e,i){var n=i(3925),r=String,o=TypeError;t.exports=function(t){if(n(t))return t;throw new o("Can't set "+r(t)+" as a prototype")}},3517:function(t,e,i){var n=i(9504),r=i(9039),o=i(4901),a=i(6955),s=i(7751),l=i(3706),h=function(){},u=s("Reflect","construct"),c=/^\s*(?:class|function)\b/,p=n(c.exec),f=!c.test(h),d=function(t){if(!o(t))return!1;try{return u(h,[],t),!0}catch(e){return!1}},v=function(t){if(!o(t))return!1;switch(a(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return f||!!p(c,l(t))}catch(e){return!0}};v.sham=!0,t.exports=!u||r(function(){var t;return d(d.call)||!d(Object)||!d(function(){t=!0})||t})?v:d},3607:function(t,e,i){var n=i(2839).match(/AppleWebKit\/(\d+)\./);t.exports=!!n&&+n[1]},3635:function(t,e,i){var n=i(9039),r=i(4576).RegExp;t.exports=n(function(){var t=r(".","s");return!(t.dotAll&&t.test("\n")&&"s"===t.flags)})},3640:function(t,e,i){var n=i(8551),r=i(4270),o=TypeError;t.exports=function(t){if(n(this),"string"===t||"default"===t)t="string";else if("number"!==t)throw new o("Incorrect hint");return r(this,t)}},3706:function(t,e,i){var n=i(9504),r=i(4901),o=i(7629),a=n(Function.toString);r(o.inspectSource)||(o.inspectSource=function(t){return a(t)}),t.exports=o.inspectSource},3709:function(t,e,i){var n=i(2839).match(/firefox\/(\d+)/i);t.exports=!!n&&+n[1]},3717:function(t,e){e.f=Object.getOwnPropertySymbols},3724:function(t,e,i){var n=i(9039);t.exports=!n(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})},3763:function(t,e,i){var n=i(2839);t.exports=/MSIE|Trident/.test(n)},3771:function(t,e,i){var n=i(6518),r=i(4373),o=i(6469);n({target:"Array",proto:!0},{fill:r}),o("fill")},3792:function(t,e,i){var n=i(5397),r=i(6469),o=i(6269),a=i(1181),s=i(4913).f,l=i(1088),h=i(2529),u=i(6395),c=i(3724),p="Array Iterator",f=a.set,d=a.getterFor(p);t.exports=l(Array,"Array",function(t,e){f(this,{type:p,target:n(t),index:0,kind:e})},function(){var t=d(this),e=t.target,i=t.index++;if(!e||i>=e.length)return t.target=null,h(void 0,!0);switch(t.kind){case"keys":return h(i,!1);case"values":return h(e[i],!1)}return h([i,e[i]],!1)},"values");var v=o.Arguments=o.Array;if(r("keys"),r("values"),r("entries"),!u&&c&&"values"!==v.name)try{s(v,"name",{value:"values"})}catch(g){}},3802:function(t,e,i){var n=i(9504),r=i(7750),o=i(655),a=i(7452),s=n("".replace),l=RegExp("^["+a+"]+"),h=RegExp("(^|[^"+a+"])["+a+"]+$"),u=function(t){return function(e){var i=o(r(e));return 1&t&&(i=s(i,l,"")),2&t&&(i=s(i,h,"$1")),i}};t.exports={start:u(1),end:u(2),trim:u(3)}},3851:function(t,e,i){var n=i(6518),r=i(9039),o=i(5397),a=i(7347).f,s=i(3724);n({target:"Object",stat:!0,forced:!s||r(function(){a(1)}),sham:!s},{getOwnPropertyDescriptor:function(t,e){return a(o(t),e)}})},3925:function(t,e,i){var n=i(34);t.exports=function(t){return n(t)||null===t}},3994:function(t,e,i){var n=i(7657).IteratorPrototype,r=i(2360),o=i(6980),a=i(687),s=i(6269),l=function(){return this};t.exports=function(t,e,i,h){var u=e+" Iterator";return t.prototype=r(n,{next:o(+!h,i)}),a(t,u,!1,!0),s[u]=l,t}},4055:function(t,e,i){var n=i(4576),r=i(34),o=n.document,a=r(o)&&r(o.createElement);t.exports=function(t){return a?o.createElement(t):{}}},4117:function(t){t.exports=function(t){return null==t}},4209:function(t,e,i){var n=i(8227),r=i(6269),o=n("iterator"),a=Array.prototype;t.exports=function(t){return void 0!==t&&(r.Array===t||a[o]===t)}},4215:function(t,e,i){var n=i(4576),r=i(2839),o=i(2195),a=function(t){return r.slice(0,t.length)===t};t.exports=a("Bun/")?"BUN":a("Cloudflare-Workers")?"CLOUDFLARE":a("Deno/")?"DENO":a("Node.js/")?"NODE":n.Bun&&"string"==typeof Bun.version?"BUN":n.Deno&&"object"==typeof Deno.version?"DENO":"process"===o(n.process)?"NODE":n.window&&n.document?"BROWSER":"REST"},4270:function(t,e,i){var n=i(9565),r=i(4901),o=i(34),a=TypeError;t.exports=function(t,e){var i,s;if("string"===e&&r(i=t.toString)&&!o(s=n(i,t)))return s;if(r(i=t.valueOf)&&!o(s=n(i,t)))return s;if("string"!==e&&r(i=t.toString)&&!o(s=n(i,t)))return s;throw new a("Can't convert object to primitive value")}},4373:function(t,e,i){var n=i(8981),r=i(5610),o=i(6198);t.exports=function(t){for(var e=n(this),i=o(e),a=arguments.length,s=r(a>1?arguments[1]:void 0,i),l=a>2?arguments[2]:void 0,h=void 0===l?i:r(l,i);h>s;)e[s++]=t;return e}},4376:function(t,e,i){var n=i(2195);t.exports=Array.isArray||function(t){return"Array"===n(t)}},4423:function(t,e,i){var n=i(6518),r=i(9617).includes,o=i(9039),a=i(6469);n({target:"Array",proto:!0,forced:o(function(){return!Array(1).includes()})},{includes:function(t){return r(this,t,arguments.length>1?arguments[1]:void 0)}}),a("includes")},4428:function(t,e,i){var n=i(8227)("iterator"),r=!1;try{var o=0,a={next:function(){return{done:!!o++}},return:function(){r=!0}};a[n]=function(){return this},Array.from(a,function(){throw 2})}catch(s){}t.exports=function(t,e){try{if(!e&&!r)return!1}catch(s){return!1}var i=!1;try{var o={};o[n]=function(){return{next:function(){return{done:i=!0}}}},t(o)}catch(s){}return i}},4488:function(t,e,i){var n=i(7680),r=Math.floor,o=function(t,e){var i=t.length;if(i<8)for(var a,s,l=1;l<i;){for(s=l,a=t[l];s&&e(t[s-1],a)>0;)t[s]=t[--s];s!==l++&&(t[s]=a)}else for(var h=r(i/2),u=o(n(t,0,h),e),c=o(n(t,h),e),p=u.length,f=c.length,d=0,v=0;d<p||v<f;)t[d+v]=d<p&&v<f?e(u[d],c[v])<=0?u[d++]:c[v++]:d<p?u[d++]:c[v++];return t};t.exports=o},4490:function(t,e,i){var n=i(6518),r=i(9504),o=i(4376),a=r([].reverse),s=[1,2];n({target:"Array",proto:!0,forced:String(s)===String(s.reverse())},{reverse:function(){return o(this)&&(this.length=this.length),a(this)}})},4495:function(t,e,i){var n=i(9519),r=i(9039),o=i(4576).String;t.exports=!!Object.getOwnPropertySymbols&&!r(function(){var t=Symbol("symbol detection");return!o(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&n&&n<41})},4527:function(t,e,i){var n=i(3724),r=i(4376),o=TypeError,a=Object.getOwnPropertyDescriptor,s=n&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(t){return t instanceof TypeError}}();t.exports=s?function(t,e){if(r(t)&&!a(t,"length").writable)throw new o("Cannot set read only .length");return t.length=e}:function(t,e){return t.length=e}},4554:function(t,e,i){var n=i(6518),r=i(8981),o=i(5610),a=i(1291),s=i(6198),l=i(4527),h=i(6837),u=i(1469),c=i(4659),p=i(4606),f=i(597)("splice"),d=Math.max,v=Math.min;n({target:"Array",proto:!0,forced:!f},{splice:function(t,e){var i,n,f,g,y,m,w=r(this),x=s(w),b=o(t,x),_=arguments.length;for(0===_?i=n=0:1===_?(i=0,n=x-b):(i=_-2,n=v(d(a(e),0),x-b)),h(x+i-n),f=u(w,n),g=0;g<n;g++)(y=b+g)in w&&c(f,g,w[y]);if(f.length=n,i<n){for(g=b;g<x-n;g++)m=g+i,(y=g+n)in w?w[m]=w[y]:p(w,m);for(g=x;g>x-n+i;g--)p(w,g-1)}else if(i>n)for(g=x-n;g>b;g--)m=g+i-1,(y=g+n-1)in w?w[m]=w[y]:p(w,m);for(g=0;g<i;g++)w[g+b]=arguments[g+2];return l(w,x-n+i),f}})},4576:function(t,e,i){var n=function(t){return t&&t.Math===Math&&t};t.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof i.g&&i.g)||n("object"==typeof this&&this)||function(){return this}()||Function("return this")()},4598:function(t,e,i){var n=i(9039);t.exports=function(t,e){var i=[][t];return!!i&&n(function(){i.call(null,e||function(){return 1},1)})}},4606:function(t,e,i){var n=i(6823),r=TypeError;t.exports=function(t,e){if(!delete t[e])throw new r("Cannot delete property "+n(e)+" of "+n(t))}},4659:function(t,e,i){var n=i(3724),r=i(4913),o=i(6980);t.exports=function(t,e,i){n?r.f(t,e,o(0,i)):t[e]=i}},4782:function(t,e,i){var n=i(6518),r=i(4376),o=i(3517),a=i(34),s=i(5610),l=i(6198),h=i(5397),u=i(4659),c=i(8227),p=i(597),f=i(7680),d=p("slice"),v=c("species"),g=Array,y=Math.max;n({target:"Array",proto:!0,forced:!d},{slice:function(t,e){var i,n,c,p=h(this),d=l(p),m=s(t,d),w=s(void 0===e?d:e,d);if(r(p)&&(i=p.constructor,(o(i)&&(i===g||r(i.prototype))||a(i)&&null===(i=i[v]))&&(i=void 0),i===g||void 0===i))return f(p,m,w);for(n=new(void 0===i?g:i)(y(w-m,0)),c=0;m<w;m++,c++)m in p&&u(n,c,p[m]);return n.length=c,n}})},4901:function(t){var e="object"==typeof document&&document.all;t.exports=void 0===e&&void 0!==e?function(t){return"function"==typeof t||t===e}:function(t){return"function"==typeof t}},4913:function(t,e,i){var n=i(3724),r=i(5917),o=i(8686),a=i(8551),s=i(6969),l=TypeError,h=Object.defineProperty,u=Object.getOwnPropertyDescriptor,c="enumerable",p="configurable",f="writable";e.f=n?o?function(t,e,i){if(a(t),e=s(e),a(i),"function"==typeof t&&"prototype"===e&&"value"in i&&f in i&&!i[f]){var n=u(t,e);n&&n[f]&&(t[e]=i.value,i={configurable:p in i?i[p]:n[p],enumerable:c in i?i[c]:n[c],writable:!1})}return h(t,e,i)}:h:function(t,e,i){if(a(t),e=s(e),a(i),r)try{return h(t,e,i)}catch(n){}if("get"in i||"set"in i)throw new l("Accessors not supported");return"value"in i&&(t[e]=i.value),t}},5031:function(t,e,i){var n=i(7751),r=i(9504),o=i(8480),a=i(3717),s=i(8551),l=r([].concat);t.exports=n("Reflect","ownKeys")||function(t){var e=o.f(s(t)),i=a.f;return i?l(e,i(t)):e}},5056:function(t,e,i){t.exports=function(t){var e=i.nc;e&&t.setAttribute("nonce",e)}},5072:function(t){var e=[];function i(t){for(var i=-1,n=0;n<e.length;n++)if(e[n].identifier===t){i=n;break}return i}function n(t,n){for(var o={},a=[],s=0;s<t.length;s++){var l=t[s],h=n.base?l[0]+n.base:l[0],u=o[h]||0,c="".concat(h," ").concat(u);o[h]=u+1;var p=i(c),f={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==p)e[p].references++,e[p].updater(f);else{var d=r(f,n);n.byIndex=s,e.splice(s,0,{identifier:c,updater:d,references:1})}a.push(c)}return a}function r(t,e){var i=e.domAPI(e);i.update(t);return function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;i.update(t=e)}else i.remove()}}t.exports=function(t,r){var o=n(t=t||[],r=r||{});return function(t){t=t||[];for(var a=0;a<o.length;a++){var s=i(o[a]);e[s].references--}for(var l=n(t,r),h=0;h<o.length;h++){var u=i(o[h]);0===e[u].references&&(e[u].updater(),e.splice(u,1))}o=l}}},5397:function(t,e,i){var n=i(7055),r=i(7750);t.exports=function(t){return n(r(t))}},5440:function(t,e,i){var n=i(8745),r=i(9565),o=i(9504),a=i(9228),s=i(9039),l=i(8551),h=i(4901),u=i(4117),c=i(1291),p=i(8014),f=i(655),d=i(7750),v=i(7829),g=i(5966),y=i(2478),m=i(6682),w=i(8227)("replace"),x=Math.max,b=Math.min,_=o([].concat),T=o([].push),S=o("".indexOf),P=o("".slice),E=function(t){return void 0===t?t:String(t)},C="$0"==="a".replace(/./,"$0"),O=!!/./[w]&&""===/./[w]("a","$0");a("replace",function(t,e,i){var o=O?"$":"$0";return[function(t,i){var n=d(this),o=u(t)?void 0:g(t,w);return o?r(o,t,n,i):r(e,f(n),t,i)},function(t,r){var a=l(this),s=f(t);if("string"==typeof r&&-1===S(r,o)&&-1===S(r,"$<")){var u=i(e,a,s,r);if(u.done)return u.value}var d=h(r);d||(r=f(r));var g,w=a.global;w&&(g=a.unicode,a.lastIndex=0);for(var C,O=[];null!==(C=m(a,s))&&(T(O,C),w);){""===f(C[0])&&(a.lastIndex=v(s,p(a.lastIndex),g))}for(var R="",k=0,I=0;I<O.length;I++){for(var D,M=f((C=O[I])[0]),A=x(b(c(C.index),s.length),0),L=[],z=1;z<C.length;z++)T(L,E(C[z]));var j=C.groups;if(d){var B=_([M],L,A,s);void 0!==j&&T(B,j),D=f(n(r,void 0,B))}else D=y(M,s,A,L,j,r);A>=k&&(R+=P(s,k,A)+D,k=A+M.length)}return R+P(s,k)}]},!!s(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")})||!C||O)},5548:function(t,e,i){var n=i(3517),r=i(6823),o=TypeError;t.exports=function(t){if(n(t))return t;throw new o(r(t)+" is not a constructor")}},5610:function(t,e,i){var n=i(1291),r=Math.max,o=Math.min;t.exports=function(t,e){var i=n(t);return i<0?r(i+e,0):o(i,e)}},5700:function(t,e,i){var n=i(511),r=i(8242);n("toPrimitive"),r()},5745:function(t,e,i){var n=i(7629);t.exports=function(t,e){return n[t]||(n[t]=e||{})}},5749:function(t,e,i){var n=i(788),r=TypeError;t.exports=function(t){if(n(t))throw new r("The method doesn't accept regular expressions");return t}},5917:function(t,e,i){var n=i(3724),r=i(9039),o=i(4055);t.exports=!n&&!r(function(){return 7!==Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a})},5966:function(t,e,i){var n=i(9306),r=i(4117);t.exports=function(t,e){var i=t[e];return r(i)?void 0:n(i)}},6034:function(t,e,i){var n=i(6518),r=i(2357).values;n({target:"Object",stat:!0},{values:function(t){return r(t)}})},6080:function(t,e,i){var n=i(7476),r=i(9306),o=i(616),a=n(n.bind);t.exports=function(t,e){return r(t),void 0===e?t:o?a(t,e):function(){return t.apply(e,arguments)}}},6099:function(t,e,i){var n=i(2140),r=i(6840),o=i(3179);n||r(Object.prototype,"toString",o,{unsafe:!0})},6119:function(t,e,i){var n=i(5745),r=i(3392),o=n("keys");t.exports=function(t){return o[t]||(o[t]=r(t))}},6193:function(t,e,i){var n=i(4215);t.exports="NODE"===n},6198:function(t,e,i){var n=i(8014);t.exports=function(t){return n(t.length)}},6269:function(t){t.exports={}},6314:function(t){t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var i="",n=void 0!==e[5];return e[4]&&(i+="@supports (".concat(e[4],") {")),e[2]&&(i+="@media ".concat(e[2]," {")),n&&(i+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),i+=t(e),n&&(i+="}"),e[2]&&(i+="}"),e[4]&&(i+="}"),i}).join("")},e.i=function(t,i,n,r,o){"string"==typeof t&&(t=[[null,t,void 0]]);var a={};if(n)for(var s=0;s<this.length;s++){var l=this[s][0];null!=l&&(a[l]=!0)}for(var h=0;h<t.length;h++){var u=[].concat(t[h]);n&&a[u[0]]||(void 0!==o&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=o),i&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=i):u[2]=i),r&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=r):u[4]="".concat(r)),e.push(u))}},e}},6319:function(t,e,i){var n=i(8551),r=i(9539);t.exports=function(t,e,i,o){try{return o?e(n(i)[0],i[1]):e(i)}catch(a){r(t,"throw",a)}}},6395:function(t){t.exports=!1},6469:function(t,e,i){var n=i(8227),r=i(2360),o=i(4913).f,a=n("unscopables"),s=Array.prototype;void 0===s[a]&&o(s,a,{configurable:!0,value:r(null)}),t.exports=function(t){s[a][t]=!0}},6518:function(t,e,i){var n=i(4576),r=i(7347).f,o=i(6699),a=i(6840),s=i(9433),l=i(7740),h=i(2796);t.exports=function(t,e){var i,u,c,p,f,d=t.target,v=t.global,g=t.stat;if(i=v?n:g?n[d]||s(d,{}):n[d]&&n[d].prototype)for(u in e){if(p=e[u],c=t.dontCallGetSet?(f=r(i,u))&&f.value:i[u],!h(v?u:d+(g?".":"#")+u,t.forced)&&void 0!==c){if(typeof p==typeof c)continue;l(p,c)}(t.sham||c&&c.sham)&&o(p,"sham",!0),a(i,u,p,t)}}},6682:function(t,e,i){var n=i(9565),r=i(8551),o=i(4901),a=i(2195),s=i(7323),l=TypeError;t.exports=function(t,e){var i=t.exec;if(o(i)){var h=n(i,t,e);return null!==h&&r(h),h}if("RegExp"===a(t))return n(s,t,e);throw new l("RegExp#exec called on incompatible receiver")}},6699:function(t,e,i){var n=i(3724),r=i(4913),o=i(6980);t.exports=n?function(t,e,i){return r.f(t,e,o(1,i))}:function(t,e,i){return t[e]=i,t}},6706:function(t,e,i){var n=i(9504),r=i(9306);t.exports=function(t,e,i){try{return n(r(Object.getOwnPropertyDescriptor(t,e)[i]))}catch(o){}}},6761:function(t,e,i){var n=i(6518),r=i(4576),o=i(9565),a=i(9504),s=i(6395),l=i(3724),h=i(4495),u=i(9039),c=i(9297),p=i(1625),f=i(8551),d=i(5397),v=i(6969),g=i(655),y=i(6980),m=i(2360),w=i(1072),x=i(8480),b=i(298),_=i(3717),T=i(7347),S=i(4913),P=i(6801),E=i(8773),C=i(6840),O=i(2106),R=i(5745),k=i(6119),I=i(421),D=i(3392),M=i(8227),A=i(1951),L=i(511),z=i(8242),j=i(687),B=i(1181),F=i(9213).forEach,N=k("hidden"),H="Symbol",W="prototype",V=B.set,U=B.getterFor(H),G=Object[W],q=r.Symbol,Z=q&&q[W],X=r.RangeError,Y=r.TypeError,$=r.QObject,K=T.f,Q=S.f,J=b.f,tt=E.f,et=a([].push),it=R("symbols"),nt=R("op-symbols"),rt=R("wks"),ot=!$||!$[W]||!$[W].findChild,at=function(t,e,i){var n=K(G,e);n&&delete G[e],Q(t,e,i),n&&t!==G&&Q(G,e,n)},st=l&&u(function(){return 7!==m(Q({},"a",{get:function(){return Q(this,"a",{value:7}).a}})).a})?at:Q,lt=function(t,e){var i=it[t]=m(Z);return V(i,{type:H,tag:t,description:e}),l||(i.description=e),i},ht=function(t,e,i){t===G&&ht(nt,e,i),f(t);var n=v(e);return f(i),c(it,n)?(i.enumerable?(c(t,N)&&t[N][n]&&(t[N][n]=!1),i=m(i,{enumerable:y(0,!1)})):(c(t,N)||Q(t,N,y(1,m(null))),t[N][n]=!0),st(t,n,i)):Q(t,n,i)},ut=function(t,e){f(t);var i=d(e),n=w(i).concat(dt(i));return F(n,function(e){l&&!o(ct,i,e)||ht(t,e,i[e])}),t},ct=function(t){var e=v(t),i=o(tt,this,e);return!(this===G&&c(it,e)&&!c(nt,e))&&(!(i||!c(this,e)||!c(it,e)||c(this,N)&&this[N][e])||i)},pt=function(t,e){var i=d(t),n=v(e);if(i!==G||!c(it,n)||c(nt,n)){var r=K(i,n);return!r||!c(it,n)||c(i,N)&&i[N][n]||(r.enumerable=!0),r}},ft=function(t){var e=J(d(t)),i=[];return F(e,function(t){c(it,t)||c(I,t)||et(i,t)}),i},dt=function(t){var e=t===G,i=J(e?nt:d(t)),n=[];return F(i,function(t){!c(it,t)||e&&!c(G,t)||et(n,it[t])}),n};h||(q=function(){if(p(Z,this))throw new Y("Symbol is not a constructor");var t=arguments.length&&void 0!==arguments[0]?g(arguments[0]):void 0,e=D(t),i=function(t){var n=void 0===this?r:this;n===G&&o(i,nt,t),c(n,N)&&c(n[N],e)&&(n[N][e]=!1);var a=y(1,t);try{st(n,e,a)}catch(s){if(!(s instanceof X))throw s;at(n,e,a)}};return l&&ot&&st(G,e,{configurable:!0,set:i}),lt(e,t)},C(Z=q[W],"toString",function(){return U(this).tag}),C(q,"withoutSetter",function(t){return lt(D(t),t)}),E.f=ct,S.f=ht,P.f=ut,T.f=pt,x.f=b.f=ft,_.f=dt,A.f=function(t){return lt(M(t),t)},l&&(O(Z,"description",{configurable:!0,get:function(){return U(this).description}}),s||C(G,"propertyIsEnumerable",ct,{unsafe:!0}))),n({global:!0,constructor:!0,wrap:!0,forced:!h,sham:!h},{Symbol:q}),F(w(rt),function(t){L(t)}),n({target:H,stat:!0,forced:!h},{useSetter:function(){ot=!0},useSimple:function(){ot=!1}}),n({target:"Object",stat:!0,forced:!h,sham:!l},{create:function(t,e){return void 0===e?m(t):ut(m(t),e)},defineProperty:ht,defineProperties:ut,getOwnPropertyDescriptor:pt}),n({target:"Object",stat:!0,forced:!h},{getOwnPropertyNames:ft}),z(),j(q,H),I[N]=!0},6801:function(t,e,i){var n=i(3724),r=i(8686),o=i(4913),a=i(8551),s=i(5397),l=i(1072);e.f=n&&!r?Object.defineProperties:function(t,e){a(t);for(var i,n=s(e),r=l(e),h=r.length,u=0;h>u;)o.f(t,i=r[u++],n[i]);return t}},6823:function(t){var e=String;t.exports=function(t){try{return e(t)}catch(i){return"Object"}}},6837:function(t){var e=TypeError;t.exports=function(t){if(t>9007199254740991)throw e("Maximum allowed index exceeded");return t}},6840:function(t,e,i){var n=i(4901),r=i(4913),o=i(283),a=i(9433);t.exports=function(t,e,i,s){s||(s={});var l=s.enumerable,h=void 0!==s.name?s.name:e;if(n(i)&&o(i,h,s),s.global)l?t[e]=i:a(e,i);else{try{s.unsafe?t[e]&&(l=!0):delete t[e]}catch(u){}l?t[e]=i:r.f(t,e,{value:i,enumerable:!1,configurable:!s.nonConfigurable,writable:!s.nonWritable})}return t}},6910:function(t,e,i){var n=i(6518),r=i(9504),o=i(9306),a=i(8981),s=i(6198),l=i(4606),h=i(655),u=i(9039),c=i(4488),p=i(4598),f=i(3709),d=i(3763),v=i(9519),g=i(3607),y=[],m=r(y.sort),w=r(y.push),x=u(function(){y.sort(void 0)}),b=u(function(){y.sort(null)}),_=p("sort"),T=!u(function(){if(v)return v<70;if(!(f&&f>3)){if(d)return!0;if(g)return g<603;var t,e,i,n,r="";for(t=65;t<76;t++){switch(e=String.fromCharCode(t),t){case 66:case 69:case 70:case 72:i=3;break;case 68:case 71:i=4;break;default:i=2}for(n=0;n<47;n++)y.push({k:e+n,v:i})}for(y.sort(function(t,e){return e.v-t.v}),n=0;n<y.length;n++)e=y[n].k.charAt(0),r.charAt(r.length-1)!==e&&(r+=e);return"DGBEFHACIJK"!==r}});n({target:"Array",proto:!0,forced:x||!b||!_||!T},{sort:function(t){void 0!==t&&o(t);var e=a(this);if(T)return void 0===t?m(e):m(e,t);var i,n,r=[],u=s(e);for(n=0;n<u;n++)n in e&&w(r,e[n]);for(c(r,function(t){return function(e,i){return void 0===i?-1:void 0===e?1:void 0!==t?+t(e,i)||0:h(e)>h(i)?1:-1}}(t)),i=s(r),n=0;n<i;)e[n]=r[n++];for(;n<u;)l(e,n++);return e}})},6933:function(t,e,i){var n=i(9504),r=i(4376),o=i(4901),a=i(2195),s=i(655),l=n([].push);t.exports=function(t){if(o(t))return t;if(r(t)){for(var e=t.length,i=[],n=0;n<e;n++){var h=t[n];"string"==typeof h?l(i,h):"number"!=typeof h&&"Number"!==a(h)&&"String"!==a(h)||l(i,s(h))}var u=i.length,c=!0;return function(t,e){if(c)return c=!1,e;if(r(this))return e;for(var n=0;n<u;n++)if(i[n]===t)return e}}}},6955:function(t,e,i){var n=i(2140),r=i(4901),o=i(2195),a=i(8227)("toStringTag"),s=Object,l="Arguments"===o(function(){return arguments}());t.exports=n?o:function(t){var e,i,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(i=function(t,e){try{return t[e]}catch(i){}}(e=s(t),a))?i:l?o(e):"Object"===(n=o(e))&&r(e.callee)?"Arguments":n}},6969:function(t,e,i){var n=i(2777),r=i(757);t.exports=function(t){var e=n(t,"string");return r(e)?e:e+""}},6980:function(t){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},7040:function(t,e,i){var n=i(4495);t.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},7055:function(t,e,i){var n=i(9504),r=i(9039),o=i(2195),a=Object,s=n("".split);t.exports=r(function(){return!a("z").propertyIsEnumerable(0)})?function(t){return"String"===o(t)?s(t,""):a(t)}:a},7323:function(t,e,i){var n,r,o=i(9565),a=i(9504),s=i(655),l=i(7979),h=i(8429),u=i(5745),c=i(2360),p=i(1181).get,f=i(3635),d=i(8814),v=u("native-string-replace",String.prototype.replace),g=RegExp.prototype.exec,y=g,m=a("".charAt),w=a("".indexOf),x=a("".replace),b=a("".slice),_=(r=/b*/g,o(g,n=/a/,"a"),o(g,r,"a"),0!==n.lastIndex||0!==r.lastIndex),T=h.BROKEN_CARET,S=void 0!==/()??/.exec("")[1];(_||S||T||f||d)&&(y=function(t){var e,i,n,r,a,h,u,f=this,d=p(f),P=s(t),E=d.raw;if(E)return E.lastIndex=f.lastIndex,e=o(y,E,P),f.lastIndex=E.lastIndex,e;var C=d.groups,O=T&&f.sticky,R=o(l,f),k=f.source,I=0,D=P;if(O&&(R=x(R,"y",""),-1===w(R,"g")&&(R+="g"),D=b(P,f.lastIndex),f.lastIndex>0&&(!f.multiline||f.multiline&&"\n"!==m(P,f.lastIndex-1))&&(k="(?: "+k+")",D=" "+D,I++),i=new RegExp("^(?:"+k+")",R)),S&&(i=new RegExp("^"+k+"$(?!\\s)",R)),_&&(n=f.lastIndex),r=o(g,O?i:f,D),O?r?(r.input=b(r.input,I),r[0]=b(r[0],I),r.index=f.lastIndex,f.lastIndex+=r[0].length):f.lastIndex=0:_&&r&&(f.lastIndex=f.global?r.index+r[0].length:n),S&&r&&r.length>1&&o(v,r[0],i,function(){for(a=1;a<arguments.length-2;a++)void 0===arguments[a]&&(r[a]=void 0)}),r&&C)for(r.groups=h=c(null),a=0;a<C.length;a++)h[(u=C[a])[0]]=r[u[1]];return r}),t.exports=y},7347:function(t,e,i){var n=i(3724),r=i(9565),o=i(8773),a=i(6980),s=i(5397),l=i(6969),h=i(9297),u=i(5917),c=Object.getOwnPropertyDescriptor;e.f=n?c:function(t,e){if(t=s(t),e=l(e),u)try{return c(t,e)}catch(i){}if(h(t,e))return a(!r(o.f,t,e),t[e])}},7400:function(t){t.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},7433:function(t,e,i){var n=i(4376),r=i(3517),o=i(34),a=i(8227)("species"),s=Array;t.exports=function(t){var e;return n(t)&&(e=t.constructor,(r(e)&&(e===s||n(e.prototype))||o(e)&&null===(e=e[a]))&&(e=void 0)),void 0===e?s:e}},7452:function(t){t.exports="\t\n\v\f\r                 \u2028\u2029\ufeff"},7476:function(t,e,i){var n=i(2195),r=i(9504);t.exports=function(t){if("Function"===n(t))return r(t)}},7495:function(t,e,i){var n=i(6518),r=i(7323);n({target:"RegExp",proto:!0,forced:/./.exec!==r},{exec:r})},7629:function(t,e,i){var n=i(6395),r=i(4576),o=i(9433),a="__core-js_shared__",s=t.exports=r[a]||o(a,{});(s.versions||(s.versions=[])).push({version:"3.38.1",mode:n?"pure":"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.38.1/LICENSE",source:"https://github.com/zloirock/core-js"})},7657:function(t,e,i){var n,r,o,a=i(9039),s=i(4901),l=i(34),h=i(2360),u=i(2787),c=i(6840),p=i(8227),f=i(6395),d=p("iterator"),v=!1;[].keys&&("next"in(o=[].keys())?(r=u(u(o)))!==Object.prototype&&(n=r):v=!0),!l(n)||a(function(){var t={};return n[d].call(t)!==t})?n={}:f&&(n=h(n)),s(n[d])||c(n,d,function(){return this}),t.exports={IteratorPrototype:n,BUGGY_SAFARI_ITERATORS:v}},7659:function(t){var e={};t.exports=function(t,i){var n=function(t){if(void 0===e[t]){var i=document.querySelector(t);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(n){i=null}e[t]=i}return e[t]}(t);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");n.appendChild(i)}},7680:function(t,e,i){var n=i(9504);t.exports=n([].slice)},7740:function(t,e,i){var n=i(9297),r=i(5031),o=i(7347),a=i(4913);t.exports=function(t,e,i){for(var s=r(e),l=a.f,h=o.f,u=0;u<s.length;u++){var c=s[u];n(t,c)||i&&n(i,c)||l(t,c,h(e,c))}}},7750:function(t,e,i){var n=i(4117),r=TypeError;t.exports=function(t){if(n(t))throw new r("Can't call method on "+t);return t}},7751:function(t,e,i){var n=i(4576),r=i(4901);t.exports=function(t,e){return arguments.length<2?(i=n[t],r(i)?i:void 0):n[t]&&n[t][e];var i}},7764:function(t,e,i){var n=i(8183).charAt,r=i(655),o=i(1181),a=i(1088),s=i(2529),l="String Iterator",h=o.set,u=o.getterFor(l);a(String,"String",function(t){h(this,{type:l,string:r(t),index:0})},function(){var t,e=u(this),i=e.string,r=e.index;return r>=i.length?s(void 0,!0):(t=n(i,r),e.index+=t.length,s(t,!1))})},7812:function(t,e,i){var n=i(6518),r=i(9297),o=i(757),a=i(6823),s=i(5745),l=i(1296),h=s("symbol-to-string-registry");n({target:"Symbol",stat:!0,forced:!l},{keyFor:function(t){if(!o(t))throw new TypeError(a(t)+" is not a symbol");if(r(h,t))return h[t]}})},7825:function(t){t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(i){!function(t,e,i){var n="";i.supports&&(n+="@supports (".concat(i.supports,") {")),i.media&&(n+="@media ".concat(i.media," {"));var r=void 0!==i.layer;r&&(n+="@layer".concat(i.layer.length>0?" ".concat(i.layer):""," {")),n+=i.css,r&&(n+="}"),i.media&&(n+="}"),i.supports&&(n+="}");var o=i.sourceMap;o&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),e.styleTagTransform(n,t,e.options)}(e,t,i)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},7829:function(t,e,i){var n=i(8183).charAt;t.exports=function(t,e,i){return e+(i?n(t,e).length:1)}},7916:function(t,e,i){var n=i(6080),r=i(9565),o=i(8981),a=i(6319),s=i(4209),l=i(3517),h=i(6198),u=i(4659),c=i(81),p=i(851),f=Array;t.exports=function(t){var e=o(t),i=l(this),d=arguments.length,v=d>1?arguments[1]:void 0,g=void 0!==v;g&&(v=n(v,d>2?arguments[2]:void 0));var y,m,w,x,b,_,T=p(e),S=0;if(!T||this===f&&s(T))for(y=h(e),m=i?new this(y):f(y);y>S;S++)_=g?v(e[S],S):e[S],u(m,S,_);else for(m=i?new this:[],b=(x=c(e,T)).next;!(w=r(b,x)).done;S++)_=g?a(x,v,[w.value,S],!0):w.value,u(m,S,_);return m.length=S,m}},7979:function(t,e,i){var n=i(8551);t.exports=function(){var t=n(this),e="";return t.hasIndices&&(e+="d"),t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.unicodeSets&&(e+="v"),t.sticky&&(e+="y"),e}},8014:function(t,e,i){var n=i(1291),r=Math.min;t.exports=function(t){var e=n(t);return e>0?r(e,9007199254740991):0}},8183:function(t,e,i){var n=i(9504),r=i(1291),o=i(655),a=i(7750),s=n("".charAt),l=n("".charCodeAt),h=n("".slice),u=function(t){return function(e,i){var n,u,c=o(a(e)),p=r(i),f=c.length;return p<0||p>=f?t?"":void 0:(n=l(c,p))<55296||n>56319||p+1===f||(u=l(c,p+1))<56320||u>57343?t?s(c,p):n:t?h(c,p,p+2):u-56320+(n-55296<<10)+65536}};t.exports={codeAt:u(!1),charAt:u(!0)}},8227:function(t,e,i){var n=i(4576),r=i(5745),o=i(9297),a=i(3392),s=i(4495),l=i(7040),h=n.Symbol,u=r("wks"),c=l?h.for||h:h&&h.withoutSetter||a;t.exports=function(t){return o(u,t)||(u[t]=s&&o(h,t)?h[t]:c("Symbol."+t)),u[t]}},8242:function(t,e,i){var n=i(9565),r=i(7751),o=i(8227),a=i(6840);t.exports=function(){var t=r("Symbol"),e=t&&t.prototype,i=e&&e.valueOf,s=o("toPrimitive");e&&!e[s]&&a(e,s,function(t){return n(i,this)},{arity:1})}},8429:function(t,e,i){var n=i(9039),r=i(4576).RegExp,o=n(function(){var t=r("a","y");return t.lastIndex=2,null!==t.exec("abcd")}),a=o||n(function(){return!r("a","y").sticky}),s=o||n(function(){var t=r("^r","gy");return t.lastIndex=2,null!==t.exec("str")});t.exports={BROKEN_CARET:s,MISSED_STICKY:a,UNSUPPORTED_Y:o}},8480:function(t,e,i){var n=i(1828),r=i(8727).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return n(t,r)}},8551:function(t,e,i){var n=i(34),r=String,o=TypeError;t.exports=function(t){if(n(t))return t;throw new o(r(t)+" is not an object")}},8598:function(t,e,i){var n=i(6518),r=i(9504),o=i(7055),a=i(5397),s=i(4598),l=r([].join);n({target:"Array",proto:!0,forced:o!==Object||!s("join",",")},{join:function(t){return l(a(this),void 0===t?",":t)}})},8622:function(t,e,i){var n=i(4576),r=i(4901),o=n.WeakMap;t.exports=r(o)&&/native code/.test(String(o))},8686:function(t,e,i){var n=i(3724),r=i(9039);t.exports=n&&r(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})},8706:function(t,e,i){var n=i(6518),r=i(9039),o=i(4376),a=i(34),s=i(8981),l=i(6198),h=i(6837),u=i(4659),c=i(1469),p=i(597),f=i(8227),d=i(9519),v=f("isConcatSpreadable"),g=d>=51||!r(function(){var t=[];return t[v]=!1,t.concat()[0]!==t}),y=function(t){if(!a(t))return!1;var e=t[v];return void 0!==e?!!e:o(t)};n({target:"Array",proto:!0,arity:1,forced:!g||!p("concat")},{concat:function(t){var e,i,n,r,o,a=s(this),p=c(a,0),f=0;for(e=-1,n=arguments.length;e<n;e++)if(y(o=-1===e?a:arguments[e]))for(r=l(o),h(f+r),i=0;i<r;i++,f++)i in o&&u(p,f,o[i]);else h(f+1),u(p,f++,o);return p.length=f,p}})},8727:function(t){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},8745:function(t,e,i){var n=i(616),r=Function.prototype,o=r.apply,a=r.call;t.exports="object"==typeof Reflect&&Reflect.apply||(n?a.bind(o):function(){return a.apply(o,arguments)})},8773:function(t,e){var i={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,r=n&&!i.call({1:2},1);e.f=r?function(t){var e=n(this,t);return!!e&&e.enumerable}:i},8781:function(t,e,i){var n=i(350).PROPER,r=i(6840),o=i(8551),a=i(655),s=i(9039),l=i(1034),h="toString",u=RegExp.prototype,c=u[h],p=s(function(){return"/a/b"!==c.call({source:"a",flags:"b"})}),f=n&&c.name!==h;(p||f)&&r(u,h,function(){var t=o(this);return"/"+a(t.source)+"/"+a(l(t))},{unsafe:!0})},8814:function(t,e,i){var n=i(9039),r=i(4576).RegExp;t.exports=n(function(){var t=r("(?<a>b)","g");return"b"!==t.exec("b").groups.a||"bc"!=="b".replace(t,"$<a>c")})},8980:function(t,e,i){var n=i(6518),r=i(9213).findIndex,o=i(6469),a="findIndex",s=!0;a in[]&&Array(1)[a](function(){s=!1}),n({target:"Array",proto:!0,forced:s},{findIndex:function(t){return r(this,t,arguments.length>1?arguments[1]:void 0)}}),o(a)},8981:function(t,e,i){var n=i(7750),r=Object;t.exports=function(t){return r(n(t))}},9039:function(t){t.exports=function(t){try{return!!t()}catch(e){return!0}}},9167:function(t,e,i){var n=i(4576);t.exports=n},9213:function(t,e,i){var n=i(6080),r=i(9504),o=i(7055),a=i(8981),s=i(6198),l=i(1469),h=r([].push),u=function(t){var e=1===t,i=2===t,r=3===t,u=4===t,c=6===t,p=7===t,f=5===t||c;return function(d,v,g,y){for(var m,w,x=a(d),b=o(x),_=s(b),T=n(v,g),S=0,P=y||l,E=e?P(d,_):i||p?P(d,0):void 0;_>S;S++)if((f||S in b)&&(w=T(m=b[S],S,x),t))if(e)E[S]=w;else if(w)switch(t){case 3:return!0;case 5:return m;case 6:return S;case 2:h(E,m)}else switch(t){case 4:return!1;case 7:h(E,m)}return c?-1:r||u?u:E}};t.exports={forEach:u(0),map:u(1),filter:u(2),some:u(3),every:u(4),find:u(5),findIndex:u(6),filterReject:u(7)}},9228:function(t,e,i){i(7495);var n=i(9565),r=i(6840),o=i(7323),a=i(9039),s=i(8227),l=i(6699),h=s("species"),u=RegExp.prototype;t.exports=function(t,e,i,c){var p=s(t),f=!a(function(){var e={};return e[p]=function(){return 7},7!==""[t](e)}),d=f&&!a(function(){var e=!1,i=/a/;return"split"===t&&((i={}).constructor={},i.constructor[h]=function(){return i},i.flags="",i[p]=/./[p]),i.exec=function(){return e=!0,null},i[p](""),!e});if(!f||!d||i){var v=/./[p],g=e(p,""[t],function(t,e,i,r,a){var s=e.exec;return s===o||s===u.exec?f&&!a?{done:!0,value:n(v,e,i,r)}:{done:!0,value:n(t,i,e,r)}:{done:!1}});r(String.prototype,t,g[0]),r(u,p,g[1])}c&&l(u[p],"sham",!0)}},9296:function(t,e,i){var n=i(4055)("span").classList,r=n&&n.constructor&&n.constructor.prototype;t.exports=r===Object.prototype?void 0:r},9297:function(t,e,i){var n=i(9504),r=i(8981),o=n({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,e){return o(r(t),e)}},9306:function(t,e,i){var n=i(4901),r=i(6823),o=TypeError;t.exports=function(t){if(n(t))return t;throw new o(r(t)+" is not a function")}},9432:function(t,e,i){var n=i(6518),r=i(8981),o=i(1072);n({target:"Object",stat:!0,forced:i(9039)(function(){o(1)})},{keys:function(t){return o(r(t))}})},9433:function(t,e,i){var n=i(4576),r=Object.defineProperty;t.exports=function(t,e){try{r(n,t,{value:e,configurable:!0,writable:!0})}catch(i){n[t]=e}return e}},9463:function(t,e,i){var n=i(6518),r=i(3724),o=i(4576),a=i(9504),s=i(9297),l=i(4901),h=i(1625),u=i(655),c=i(2106),p=i(7740),f=o.Symbol,d=f&&f.prototype;if(r&&l(f)&&(!("description"in d)||void 0!==f().description)){var v={},g=function(){var t=arguments.length<1||void 0===arguments[0]?void 0:u(arguments[0]),e=h(d,this)?new f(t):void 0===t?f():f(t);return""===t&&(v[e]=!0),e};p(g,f),g.prototype=d,d.constructor=g;var y="Symbol(description detection)"===String(f("description detection")),m=a(d.valueOf),w=a(d.toString),x=/^Symbol\((.*)\)[^)]+$/,b=a("".replace),_=a("".slice);c(d,"description",{configurable:!0,get:function(){var t=m(this);if(s(v,t))return"";var e=w(t),i=y?_(e,7,-1):b(e,x,"$1");return""===i?void 0:i}}),n({global:!0,constructor:!0,forced:!0},{Symbol:g})}},9504:function(t,e,i){var n=i(616),r=Function.prototype,o=r.call,a=n&&r.bind.bind(o,o);t.exports=n?a:function(t){return function(){return o.apply(t,arguments)}}},9519:function(t,e,i){var n,r,o=i(4576),a=i(2839),s=o.process,l=o.Deno,h=s&&s.versions||l&&l.version,u=h&&h.v8;u&&(r=(n=u.split("."))[0]>0&&n[0]<4?1:+(n[0]+n[1])),!r&&a&&(!(n=a.match(/Edge\/(\d+)/))||n[1]>=74)&&(n=a.match(/Chrome\/(\d+)/))&&(r=+n[1]),t.exports=r},9539:function(t,e,i){var n=i(9565),r=i(8551),o=i(5966);t.exports=function(t,e,i){var a,s;r(t);try{if(!(a=o(t,"return"))){if("throw"===e)throw i;return i}a=n(a,t)}catch(l){s=!0,a=l}if("throw"===e)throw i;if(s)throw a;return r(a),i}},9565:function(t,e,i){var n=i(616),r=Function.prototype.call;t.exports=n?r.bind(r):function(){return r.apply(r,arguments)}},9572:function(t,e,i){var n=i(9297),r=i(6840),o=i(3640),a=i(8227)("toPrimitive"),s=Date.prototype;n(s,a)||r(s,a,o)},9617:function(t,e,i){var n=i(5397),r=i(5610),o=i(6198),a=function(t){return function(e,i,a){var s=n(e),l=o(s);if(0===l)return!t&&-1;var h,u=r(a,l);if(t&&i!=i){for(;l>u;)if((h=s[u++])!=h)return!0}else for(;l>u;u++)if((t||u in s)&&s[u]===i)return t||u||0;return!t&&-1}};t.exports={includes:a(!0),indexOf:a(!1)}},9773:function(t,e,i){var n=i(6518),r=i(4495),o=i(9039),a=i(3717),s=i(8981);n({target:"Object",stat:!0,forced:!r||o(function(){a.f(1)})},{getOwnPropertySymbols:function(t){var e=a.f;return e?e(s(t)):[]}})},9868:function(t,e,i){var n=i(6518),r=i(9504),o=i(1291),a=i(1240),s=i(2333),l=i(9039),h=RangeError,u=String,c=Math.floor,p=r(s),f=r("".slice),d=r(1..toFixed),v=function(t,e,i){return 0===e?i:e%2==1?v(t,e-1,i*t):v(t*t,e/2,i)},g=function(t,e,i){for(var n=-1,r=i;++n<6;)r+=e*t[n],t[n]=r%1e7,r=c(r/1e7)},y=function(t,e){for(var i=6,n=0;--i>=0;)n+=t[i],t[i]=c(n/e),n=n%e*1e7},m=function(t){for(var e=6,i="";--e>=0;)if(""!==i||0===e||0!==t[e]){var n=u(t[e]);i=""===i?n:i+p("0",7-n.length)+n}return i};n({target:"Number",proto:!0,forced:l(function(){return"0.000"!==d(8e-5,3)||"1"!==d(.9,0)||"1.25"!==d(1.255,2)||"1000000000000000128"!==d(0xde0b6b3a7640080,0)})||!l(function(){d({})})},{toFixed:function(t){var e,i,n,r,s=a(this),l=o(t),c=[0,0,0,0,0,0],d="",w="0";if(l<0||l>20)throw new h("Incorrect fraction digits");if(s!=s)return"NaN";if(s<=-1e21||s>=1e21)return u(s);if(s<0&&(d="-",s=-s),s>1e-21)if(i=(e=function(t){for(var e=0,i=t;i>=4096;)e+=12,i/=4096;for(;i>=2;)e+=1,i/=2;return e}(s*v(2,69,1))-69)<0?s*v(2,-e,1):s/v(2,e,1),i*=4503599627370496,(e=52-e)>0){for(g(c,0,i),n=l;n>=7;)g(c,1e7,0),n-=7;for(g(c,v(10,n,1),0),n=e-1;n>=23;)y(c,1<<23),n-=23;y(c,1<<n),g(c,1,1),y(c,2),w=m(c)}else g(c,0,i),g(c,1<<-e,0),w=m(c)+p("0",l);return w=l>0?d+((r=w.length)<=l?"0."+p("0",l-r)+w:f(w,0,r-l)+"."+f(w,r-l)):d+w}})},9908:function(t,e,i){i(6518)({target:"Object",stat:!0},{is:i(3470)})}},e={};function i(n){var r=e[n];if(void 0!==r)return r.exports;var o=e[n]={id:n,exports:{}};return t[n].call(o.exports,o,o.exports,i),o.exports}i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,{a:e}),e},i.d=function(t,e){for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.nc=void 0;var n={};!function(){i.r(n),i.d(n,{Area:function(){return nr},Board:function(){return mr},Cache:function(){return G},Graduation:function(){return Er},Grid:function(){return Ar},KfbView:function(){return co},Navigator:function(){return vn},OpenSeadragon:function(){return Q()},Rotation:function(){return Gi},Shape:function(){return qn},Tailoring:function(){return Cn},baseNumber:function(){return x},cacheGammaTable:function(){return D},calculatePolygonArea:function(){return P},getAngle:function(){return T},getDistance:function(){return S},getPoint:function(){return b},getRandomId:function(){return E},getRectPoint:function(){return l},getRectPointV2:function(){return h},getRectPoints:function(){return _},getUnitNumber:function(){return C},hslToRgb:function(){return R},isNegNumber:function(){return w},isPointInEllipse:function(){return f},isPointInLine:function(){return g},isPointInMatrix:function(){return p},isPointInPolygon:function(){return v},pointInOtherPoint:function(){return d},pointsToRegion:function(){return y},regionToPoint:function(){return m},rgbToHsl:function(){return O},toGamma:function(){return I}});var t={};i.r(t),i.d(t,{EVENT_ADD_POLYGON_POINT:function(){return mi},EVENT_AREA_MOVE_END:function(){return hi},EVENT_AREA_MOVE_START:function(){return si},EVENT_AREA_MOVING:function(){return li},EVENT_CACHE_BACK:function(){return fi},EVENT_CACHE_FORWARD:function(){return di},EVENT_CANCEL_SELECT_LABEL:function(){return ci},EVENT_DB_CLICK_LABEL:function(){return pi},EVENT_DELETE_LABEL:function(){return gi},EVENT_DELETE_POLYGON_POINT:function(){return yi},EVENT_END_PAINTING:function(){return ni},EVENT_GRADUATION_CHANGE:function(){return xi},EVENT_HIDDEN_LABEL:function(){return vi},EVENT_INIT_COMPLETE:function(){return bi},EVENT_IN_PAINTING:function(){return ii},EVENT_NAVIGATOR_VESTIGE:function(){return wi},EVENT_SELECT_LABEL:function(){return ui},EVENT_START_PAINTING:function(){return ei},EVENT_STOP_PAINTING:function(){return ri},EVENT_TAILORING_REGION:function(){return oi},EVENT_TAILORING_SCREENSHOT:function(){return ai},EVENT_UPDATE_ZRENDER:function(){return _i}});var e={};i.r(e),i.d(e,{Arrow:function(){return zt},Bilateral:function(){return Ut},Brush:function(){return Ot},Dot:function(){return ti},Ellipse:function(){return de},Flag:function(){return qe},Font:function(){return ke},Image:function(){return ji},Line:function(){return Qt},Polygon:function(){return ae},Rectangle:function(){return _e},Star:function(){return Be}});var r={};i.r(r),i.d(r,{Area:function(){return nr},Board:function(){return mr},Cache:function(){return G},Graduation:function(){return Er},Grid:function(){return Ar},Navigator:function(){return vn},Rotation:function(){return Gi},Shape:function(){return qn},Tailoring:function(){return Cn}});var o={};i.r(o),i.d(o,{COMPONENT_AREA:function(){return Gr},COMPONENT_BOARD:function(){return qr},COMPONENT_CACHE:function(){return Kr},COMPONENT_FRID:function(){return Qr},COMPONENT_GRADUATION:function(){return Zr},COMPONENT_NAVIGATOR:function(){return $r},COMPONENT_ROTATION:function(){return Xr},COMPONENT_SHAPE:function(){return Ur},COMPONENT_TAILORING:function(){return Yr}});i(2675),i(9463),i(2259),i(3418),i(3792),i(4490),i(4782),i(6910),i(2010),i(9868),i(9908),i(6099),i(7495),i(8781),i(7764),i(2953);function a(t){return function(t){if(Array.isArray(t))return s(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return s(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?s(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function l(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=(t.x+e.x)/2,r=(t.y+e.y)/2,o=Math.PI/180*i;return[{x:(t.x-n)*Math.cos(o)-(t.y-r)*Math.sin(o)+n,y:(t.x-n)*Math.sin(o)+(t.y-r)*Math.cos(o)+r},{x:-(t.y-r)*Math.sin(o)+n,y:(t.y-r)*Math.cos(o)+r},{x:(e.x-n)*Math.cos(o)-(t.y-r)*Math.sin(o)+n,y:(e.x-n)*Math.sin(o)+(t.y-r)*Math.cos(o)+r},{x:(t.x-n)*Math.cos(o)-(r-r)*Math.sin(o)+n,y:(t.x-n)*Math.sin(o)+r},{x:n,y:r},{x:(e.x-n)*Math.cos(o)+n,y:(e.x-n)*Math.sin(o)+r},{x:(t.x-n)*Math.cos(o)-(e.y-r)*Math.sin(o)+n,y:(t.x-n)*Math.sin(o)+(e.y-r)*Math.cos(o)+r},{x:-(e.y-r)*Math.sin(o)+n,y:(e.y-r)*Math.cos(o)+r},{x:(e.x-n)*Math.cos(o)-(e.y-r)*Math.sin(o)+n,y:(e.x-n)*Math.sin(o)+(e.y-r)*Math.cos(o)+r}]}function h(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(2===t.length)return l(t[0],t[1],e);var i=(t[0].x+t[3].x)/2,n=(t[0].y+t[3].y)/2;return[t[0],{x:(t[1].x+t[0].x)/2,y:(t[1].y+t[0].y)/2},t[1],{x:(t[2].x+t[0].x)/2,y:(t[2].y+t[0].y)/2},{x:i,y:n},{x:(t[1].x+t[3].x)/2,y:(t[1].y+t[3].y)/2},t[2],{x:(t[2].x+t[3].x)/2,y:(t[2].y+t[3].y)/2},t[3]]}function u(t,e){return t.x*e.y-e.x*t.y}function c(t,e,i){return(e.x-t.x)*(i.y-t.y)-(i.x-t.x)*(e.y-t.y)}function p(t,e,i,n,r){return c(t,e,r)*c(i,n,r)<=0&&c(e,n,r)*c(t,i,r)<=0}function f(t,e,i,n){return(t.x-e.x)*(t.x-e.x)/(i*i)+(t.y-e.y)*(t.y-e.y)/(n*n)<1}function d(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;return p({x:t.x-i,y:t.y-i},{x:t.x+i,y:t.y-i},{x:t.x-i,y:t.y+i},{x:t.x+i,y:t.y+i},e)}function v(t,e){for(var i=t.x,n=t.y,r=0,o=0,a=e.length,s=a-1;o<a;s=o,o++){var l=e[s].x,h=e[s].y,c=e[o].x,p=e[o].y,f=Math.min(h,p),d=Math.max(h,p),v=Math.min(l,c),g=Math.max(l,c);if(n>d);else if(n<f);else if(i>g);else if(i<v)f===n&&n<d?r++:f<n&&n===d||f===n&&n===d||r++;else{var y={x:c-l,y:p-h},m={x:c-l-1e5,y:p-h};u({x:l-i,y:h-n},y)*u(m,y)>0||(f===n&&n<d?r++:f<n&&n===d||f===n&&n===d||r++)}}return r%2==1}function g(t,e){var i=e[0],n=e[1];if(i.y<t.y&&n.y>=t.y||i.y>=t.y&&n.y<t.y){var r=i.x+(t.y-i.y)*(n.x-i.x)/(n.y-i.y);if(Math.abs(r-t.x)<8)return!0}return!1}function y(t){if(!Array.isArray(t)||0===t.length)return{x:0,y:0,width:0,height:0};if(2===t.length)return{x:t[0].x,y:t[0].y,width:t[1].x-t[0].x,height:t[1].y-t[0].y};if(4===t.length)return{x:t[0].x,y:t[0].y,width:S(t[1],t[0])*(t[0].x<t[1].x?1:-1),height:S(t[2],t[0])*(t[0].y<t[2].y?1:-1)};var e=a(t).sort(function(t,e){return t.x-e.x}),i=a(t).sort(function(t,e){return t.y-e.y}),n={x:e[0].x,y:i[0].y},r=e.reverse()[0].x,o=i.reverse()[0].y;return{x:n.x,y:n.y,width:r-n.x,height:o-n.y}}function m(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?{startPoint:{x:t.width<0?t.x+t.width:t.x,y:t.height<0?t.y+t.height:t.y},endPoint:{x:t.width>0?t.x+t.width:t.x,y:t.height>0?t.y+t.height:t.y}}:{startPoint:{x:t.x,y:t.y},endPoint:{x:t.x+t.width,y:t.y+t.height}}}function w(t){if("number"!=typeof t)throw new Error("".concat(t," is not a number"));return 0===t?Object.is(t,-0):t<0}function x(t){if("number"!=typeof t)throw new Error("".concat(t," is not a number"));return 0===t?0:t<0?-1:1}function b(t,e,i){return i=i/180*Math.PI,{x:(e.x-t.x)*Math.cos(i)-(e.y-t.y)*Math.sin(i)+t.x,y:(e.x-t.x)*Math.sin(i)+(e.y-t.y)*Math.cos(i)+t.y}}function _(t){return[t[0],{x:t[1].x,y:t[0].y},{x:t[0].x,y:t[1].y},t[1]]}function T(t,e,i){var n={x:e.x-t.x,y:e.y-t.y},r={x:i.x-t.x,y:i.y-t.y},o=Math.atan2(r.y,r.x)-Math.atan2(n.y,n.x);return o>Math.PI?o-2*Math.PI:o<-Math.PI?o+2*Math.PI:o}function S(t,e){var i=Math.pow(e.x-t.x,2),n=Math.pow(e.y-t.y,2);return Math.sqrt(i+n)}function P(t,e){var i=t.length;if(i<3)return 0;for(var n=0,r=0;r<i;r++){var o=t[r],a=t[(r+1)%i],s=o.x*e,l=o.y*e,h=a.x*e;n+=s*(a.y*e)-h*l}return Math.abs(n/2)}var E=function(){return(4294967296*(1+Math.random())|0).toString(16).substring(1)};function C(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(n)return(t/Math.pow(i,n)).toFixed(2)/1+e[n];for(var r=t;r>=i;)r/=i,n++;return e[n]||(n=e.length-1),(t/Math.pow(i,n)).toFixed(2)/1+e[n]}var O=function(t,e,i){var n=(t/=255)>(e/=255)?t:e,r=n>(i/=255)?n:i,o=t>e?e:t,a=o>i?i:o,s=r-a,l=r+a,h=(r+a)/2,u=0,c=0;return 0===s?{l:h,s:u,h:c}:(t===r&&(c=(e-i)/6/s),e===r&&(c=1/3+(i-t)/6/s),i===r&&(c=2/3+(t-e)/6/s),c<0&&(c+=1),c>1&&(c-=1),{l:h,s:u=h<.5?s/l:s/(2-l),h:c})},R=function(t,e,i){if(0===e)return{r:255*(i>1?1:i),g:255*(i>1?1:i),b:255*(i>1?1:i)};e>1&&(e=1);var n=0,r=2*i-(n=i<.5?i*(1+e):i+e-i*e),o=255*k(r,n,t+1/3),a=255*k(r,n,t),s=255*k(r,n,t-1/3);return{r:o>255?255:o,g:a>255?255:a,b:s>255?255:s}};function k(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),6*i<1?t+6*(e-t)*i:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}for(var I=function(t,e){return t>255&&(t=255),t<0&&(t=0),t/=255,255*Math.pow(t,1/e)},D={},M=0;M<256;M++)for(var A=.01;A<=2;A=(A+.01).toFixed(3)/1)D["".concat(A)]?D["".concat(A)].push(I(M,A)):D["".concat(A)]=[I(M,A)];i(5700),i(4554),i(9572),i(2892),i(8598),i(2062);var L=function(t){return(t=t.toString())[1]?t:"0"+t},z=function(t){if(t)return function(t){var e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/",n=Object.prototype.toString;if(t)return"[object String]"===(e=t,n).call(e)&&(t=new Date(t)),"number"==typeof t&&(t=new Date(t)),[t.getFullYear(),t.getMonth()+1,t.getDate()].map(L).join(i)}(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-")+" "+function(t){var e,i=Object.prototype.toString;if(t)return"[object String]"===(e=t,i).call(e)&&(t=new Date(t)),[t.getHours(),t.getMinutes(),t.getSeconds()].map(L).join(":")}(t)};function j(t){return j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},j(t)}function B(t){return function(t){if(Array.isArray(t))return F(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return F(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?F(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function F(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function N(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,H(n.key),n)}}function H(t){var e=function(t,e){if("object"!=j(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=j(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==j(e)?e:e+""}var W,V,U,G=(W=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.cacheList=[],this.currentIndex=-1},V=[{key:"init",value:function(t,e){this.cacheList=B(t),this.currentIndex=e}},{key:"add",value:function(t,e){this.currentIndex===this.cacheList.length-1||(this.cacheList=this.cacheList.slice(0,this.currentIndex+1)),this.cacheList.push({type:t,options:e,time:z(new Date)}),this.currentIndex=this.cacheList.length-1}},{key:"getCache",value:function(t){return this.cacheList[t]}},{key:"removeIndex",value:function(t){this.cacheList.splice(t,1)}},{key:"removeAll",value:function(){this.cacheList=[],this.currentIndex=-1}}],V&&N(W.prototype,V),U&&N(W,U),Object.defineProperty(W,"prototype",{writable:!1}),W);i(3771),i(113),i(875),i(287),i(825),i(3500),i(8706),i(2008),i(4423),i(2712),i(3851),i(1278),i(9432),i(1699);function q(t){return q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},q(t)}function Z(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,X(n.key),n)}}function X(t){var e=function(t,e){if("object"!=q(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=q(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==q(e)?e:e+""}var Y={lineWidth:2,radius:5,fillStyle:"rgba(255, 255, 255, 1)",strokeStyle:"#01d0b0"},$=function(t,e,i){return e&&Z(t.prototype,e),i&&Z(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Y;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.getConfig(e)},[{key:"getConfig",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Y;for(var e in Y)Object.prototype.hasOwnProperty.call(Y,e)&&(t[e]=t[e]||Y[e]);return t}},{key:"setCanvas",value:function(t){this.canvas=t}},{key:"draw",value:function(t,e){var i=this.canvas.getContext("2d"),n=t.x,r=t.y;e=this.getConfig(e),i.beginPath(),i.lineWidth=e.lineWidth,i.arc(n,r,e.radius,0,2*Math.PI,!1),i.fillStyle=e.fillStyle,i.fill(),i.strokeStyle=e.strokeStyle,i.stroke()}}]),K=i(2861),Q=i.n(K),J="Line",tt="Arrow",et="Bilateral",it="Rectangle",nt="Ellipse",rt="Polygon",ot="Font",at="Star",st="Flag",lt="Dot",ht="Image",ut=[ot,at,st,lt],ct=[it,nt],pt=[J,tt,et],ft=[rt,ot,at,st,lt],dt=([].concat(ct,[rt]),[].concat(pt,[ot,st,ht])),vt=[J,tt,et,it,nt,rt,ot,at,st,lt,ht],gt={en:{length:"Length",width:"Width",perimeter:"Perimeter",area:"Area",long_axis:"Long Axis",short_axis:"Short Axis",complete_screenshot:"Double-click within the area to complete screenshot",cancel_screenshot:"Double-click outside or press ESC to cancel screenshot",area_size:"Area size is ",drag_resize:"drag resize"},"zh-cn":{length:"长",width:"宽",perimeter:"周长",area:"面积",long_axis:"长轴",short_axis:"短轴",complete_screenshot:"双击区域内表示完成截图",cancel_screenshot:"双击区域外或按ESC表示取消截图",area_size:"区域大小为:",drag_resize:"拖动调整"}},yt=["mitt"];function mt(t){return mt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mt(t)}function wt(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function xt(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?wt(Object(i),!0).forEach(function(e){bt(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):wt(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function bt(t,e,i){return(e=Tt(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function _t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Tt(n.key),n)}}function Tt(t){var e=function(t,e){if("object"!=mt(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=mt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==mt(e)?e:e+""}var St=function(t,e,i){return e&&_t(t.prototype,e),i&&_t(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e,i,n,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);var o=r||{},a=o.mitt,s=function(t,e){if(null==t)return{};var i,n,r=function(t,e){if(null==t)return{};var i={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.includes(n))continue;i[n]=t[n]}return i}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)i=o[n],e.includes(i)||{}.propertyIsEnumerable.call(t,i)&&(r[i]=t[i])}return r}(o,yt);this.mitt=a,this.viewer=e,this.cache=n,this.viewport=e.viewport,this.canvas=i,this.options=s||{},this.thumb=new $,this.thumb.setCanvas(i)},[{key:"init",value:function(){}},{key:"getCenterPoint",value:function(t){var e=this.viewport.imageToViewportRectangle(t.x,t.y,t.width,t.height);return l({x:e.x,y:e.y},{x:e.x+e.width,y:e.y+e.height})[4]}},{key:"moveToLabel",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.viewport.panTo(new K.Point(t.x,t.y),e)}},{key:"isContainerLabel",value:function(t,e){var i=this;return!!e.find(function(e){return i.isContainerInRegion(t,e)})}},{key:"isContainerInRegion",value:function(t,e){var i=e.region,n=e.tool,r=e.points,o=e.isClose;if(n===rt&&o)return v(t,r);var a={x:i.x,y:i.y},s={x:i.x+i.width,y:i.y},l={x:i.x,y:i.y+i.height},h={x:i.x+i.width,y:i.y+i.height},u={x:i.x+i.width/2,y:i.y+i.height/2};return n===nt?f(t,u,Math.abs(i.width/2),Math.abs(i.height/2|0)):n===it&&p(a,s,l,h,t)}},{key:"imageToViewerElementRectangle",value:function(t){var e=t.x,i=t.y,n=t.width,r=t.height,o=this.viewport.imageToViewportRectangle(e,i,n,r);return this.viewport.viewportToViewerElementRectangle(o)}},{key:"imageToViewerElementCoordinates",value:function(t,e){return this.viewport.imageToViewerElementCoordinates(new K.Point(t,e))}},{key:"viewerElementToImageRectangle",value:function(t){var e=t.x,i=t.y,n=t.width,r=t.height,o=this.viewport.viewerElementToViewportRectangle(new K.Rect(e,i,n,r,0));return this.viewport.viewportToImageRectangle(o.x,o.y,o.width,o.height)}},{key:"viewerElementToImageCoordinates",value:function(t,e){return this.viewport.viewerElementToImageCoordinates(new K.Point(t,e))}},{key:"imageToViewerElementPoints",value:function(t){var e=this;return(t||[]).map(function(t){var i=e.imageToViewerElementCoordinates(t.x,t.y);return{canMove:t.canMove,x:i.x,y:i.y}})}},{key:"viewerElementToImagePoints",value:function(t){var e=this;return(t||[]).map(function(t){var i=e.viewerElementToImageCoordinates(t.x,t.y);return{canMove:t.canMove,x:i.x,y:i.y}})}},{key:"getImageZoom",value:function(t){return this.viewport.viewportToImageZoom(this.viewport.getZoom(t))}},{key:"translate",value:function(t){var e;return gt[(null!==(e=this.options.lang)&&void 0!==e?e:"zh-cn").toLocaleLowerCase()][t]}},{key:"getMeasureContent",value:function(t){var e={left:0,top:0,angle:0,texts:[]};if(t.points.length<=1)return e;var i=this.getImageZoom(!0)/t.scale,n=y(t.points),r={x:n.x,y:n.y},o={x:n.x+n.width,y:n.y+n.height},a={x:r.x<o.x?r.x:o.x,y:r.y<o.y?r.y:o.y},s={x:r.x>o.x?r.x:o.x,y:r.y>o.y?r.y:o.y};switch(t.tool){case tt:case et:case J:var h={x:r.x<o.x?r.x:o.x,y:r.x<o.x?r.y:o.y},u={x:r.x>o.x?r.x:o.x,y:r.x>o.x?r.y:o.y},c=Math.abs(u.x-h.x),p=Math.abs(u.y-h.y),f=this.imageToViewerElementCoordinates(u.x,u.y);e={left:f.x+10*i,top:f.y,angle:0,texts:["".concat(this.translate("length"),":").concat(this.getUnitNumber(Math.sqrt(c*c+p*p)*this.options.imageCapRes))]};break;case nt:var d=Math.abs(s.x-a.x)/2,v=Math.abs(s.y-a.y)/2,g=(d>v?d:v)*this.options.imageCapRes,m=(d>v?v:d)*this.options.imageCapRes,w=l(a,s)[2],x=this.imageToViewerElementCoordinates(w.x,w.y);e={left:x.x+10*i,top:x.y,angle:0,texts:["".concat(this.translate("long_axis"),":").concat(this.getUnitNumber(g)),"".concat(this.translate("short_axis"),":").concat(this.getUnitNumber(m)),"".concat(this.translate("perimeter"),":").concat(this.getUnitNumber(4*(g-m)+2*Math.PI*m)),"".concat(this.translate("area"),":").concat(this.getUnitNumber(Math.PI*g*m/this.options.binary),"²")]};break;case it:var b=Math.abs(s.x-a.x)*this.options.imageCapRes,_=Math.abs(s.y-a.y)*this.options.imageCapRes,T=2*(b+_),S=b*_/this.options.binary,E=l(a,s)[2],C=this.imageToViewerElementCoordinates(E.x,E.y);e={left:C.x+10*i,top:C.y,angle:0,texts:["".concat(this.translate("length"),":").concat(this.getUnitNumber(b)),"".concat(this.translate("width"),":").concat(this.getUnitNumber(_)),"".concat(this.translate("perimeter"),":").concat(this.getUnitNumber(T)),"".concat(this.translate("area"),":").concat(this.getUnitNumber(S),"²")]};break;case rt:var O=t.points,R=l(a,s)[2],k=this.imageToViewerElementCoordinates(R.x,R.y),I=0;O.reduce(function(t,e){return I+=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),e}),e={left:k.x,top:k.y,angle:0,texts:["".concat(this.translate("perimeter"),":").concat(this.getUnitNumber((I*this.options.imageCapRes).toFixed(2))),"".concat(this.translate("area"),":").concat(this.getUnitNumber(P(O,this.options.imageCapRes)/this.options.binary),"²")]};break;default:e={left:0,right:0,angle:0,texts:[]}}var D=t.select&&this.options.measure.selectHandler||this.options.measure.handler;return xt(xt({},e),{},{texts:D?D(e.texts,t):e.texts})}},{key:"getUnitNumber",value:function(t,e){return C(t,this.options.units,this.options.binary,e)}},{key:"isInCanvas",value:function(t,e){var i=t.x,n=t.y,r=t.x+t.width,o=t.y+t.height;return!(i>e.x+e.width||n>e.y+e.height||r<e.x||o<e.y)}},{key:"getFontWidth",value:function(t,e){var i=this.canvas.getContext("2d");i.beginPath(),i.font="".concat(e,"px Arial");var n=t.split("\n").sort(function(t,e){return t.length>e.length?-1:1})[0];return i.measureText(n).width}},{key:"change",value:function(){}},{key:"updated",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.options=xt(xt({},this.options),t),this.change()}},{key:"clearCanvas",value:function(){var t=this.canvas.getContext("2d");t.beginPath(),t.clearRect(0,0,this.canvas.width,this.canvas.height)}},{key:"resetCanvasSize",value:function(t){var e=this,i=t.width,n=t.height;this.canvas.width=i,this.canvas.height=n,setTimeout(function(){e.change()},100)}},{key:"destroy",value:function(){this.mitt.$off()}}]);function Pt(t){return Pt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pt(t)}function Et(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ct(n.key),n)}}function Ct(t){var e=function(t,e){if("object"!=Pt(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Pt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Pt(e)?e:e+""}var Ot=function(t,e,i){return e&&Et(t.prototype,e),i&&Et(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.thumb=new $,this.options={}},[{key:"setContent",value:function(t,e){this.canvas=t,this.thumb.setCanvas(t),this.options=e}},{key:"startDraw",value:function(){this.canvas.getContext("2d").beginPath()}},{key:"endDraw",value:function(){var t=this.canvas.getContext("2d");t.stroke(),this.options.fillStyle&&t.fill()}},{key:"drawThumb",value:function(t,e){this.thumb.draw(t,e)}},{key:"drawPoints",value:function(t,e){var i=this;t.forEach(function(t){i.drawThumb(t,e)})}},{key:"draw",value:function(t){}},{key:"drawMeasureInfo",value:function(t,e){var i=e.left,n=e.top,r=e.texts,o=e.angle;if(r.length){var a=this.canvas.getContext("2d");a.save(),a.beginPath(),a.translate(i,n),a.rotate(o);var s=[];a.font="".concat(this.options.measure.fontSize,"px Arial"),r.forEach(function(t){s.push(a.measureText(t).width)});var l=Math.max.apply(Math,s);a.fillStyle=this.options.measure.backgroundColor;var h=20*r.length+16+4*(r.length-1);a.rect(0,0,l+22,h),a.fill(),a.beginPath(),a.fillStyle=this.options.measure.color,r.forEach(function(t,e){a.fillText(t,11,22+24*e)}),a.fill(),a.restore()}}},{key:"clearCanvas",value:function(){this.canvas&&this.canvas.getContext&&this.canvas.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height)}}]);function Rt(t){return Rt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rt(t)}function kt(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,It(n.key),n)}}function It(t){var e=function(t,e){if("object"!=Rt(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Rt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Rt(e)?e:e+""}function Dt(t,e,i){return e=At(e),function(t,e){if(e&&("object"==Rt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Mt()?Reflect.construct(e,i||[],At(t).constructor):e.apply(t,i))}function Mt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Mt=function(){return!!t})()}function At(t){return At=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},At(t)}function Lt(t,e){return Lt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Lt(t,e)}var zt=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Dt(this,e)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Lt(t,e)}(e,t),function(t,e,i){return e&&kt(t.prototype,e),i&&kt(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"draw",value:function(t){var e=t[0],i=t[t.length-1],n=this.canvas.getContext("2d");n.lineWidth=this.options.lineWidth,n.strokeStyle=this.options.strokeStyle,n.moveTo(e.x,e.y),n.lineTo(i.x,i.y),n.drawArrow(e,i)}}])}(Ot);function jt(t){return jt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jt(t)}function Bt(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ft(n.key),n)}}function Ft(t){var e=function(t,e){if("object"!=jt(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=jt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==jt(e)?e:e+""}function Nt(t,e,i){return e=Wt(e),function(t,e){if(e&&("object"==jt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ht()?Reflect.construct(e,i||[],Wt(t).constructor):e.apply(t,i))}function Ht(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ht=function(){return!!t})()}function Wt(t){return Wt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Wt(t)}function Vt(t,e){return Vt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Vt(t,e)}var Ut=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Nt(this,e)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Vt(t,e)}(e,t),function(t,e,i){return e&&Bt(t.prototype,e),i&&Bt(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"draw",value:function(t){var e=t[0],i=t[t.length-1],n=this.canvas.getContext("2d");n.lineWidth=this.options.lineWidth,n.strokeStyle=this.options.strokeStyle,n.moveTo(e.x,e.y),n.lineTo(i.x,i.y),n.drawArrow(e,i),n.drawArrow(i,e)}}])}(Ot);function Gt(t){return Gt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gt(t)}function qt(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Zt(n.key),n)}}function Zt(t){var e=function(t,e){if("object"!=Gt(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Gt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Gt(e)?e:e+""}function Xt(t,e,i){return e=$t(e),function(t,e){if(e&&("object"==Gt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Yt()?Reflect.construct(e,i||[],$t(t).constructor):e.apply(t,i))}function Yt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Yt=function(){return!!t})()}function $t(t){return $t=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},$t(t)}function Kt(t,e){return Kt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Kt(t,e)}var Qt=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Xt(this,e)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Kt(t,e)}(e,t),function(t,e,i){return e&&qt(t.prototype,e),i&&qt(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"draw",value:function(t){var e=t[0],i=t[t.length-1],n=this.canvas.getContext("2d");n.lineWidth=this.options.lineWidth,n.strokeStyle=this.options.strokeStyle,n.moveTo(e.x,e.y),n.lineTo(i.x,i.y);var r=Math.atan2(i.y-e.y,i.x-e.x),o=5*Math.sin(r),a=5*Math.cos(r);n.moveTo(e.x+o,e.y-a),n.lineTo(e.x-o,e.y+a),n.moveTo(i.x+o,i.y-a),n.lineTo(i.x-o,i.y+a)}}])}(Ot);function Jt(t){return Jt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jt(t)}function te(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ee(n.key),n)}}function ee(t){var e=function(t,e){if("object"!=Jt(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Jt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Jt(e)?e:e+""}function ie(t,e,i){return e=re(e),function(t,e){if(e&&("object"==Jt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ne()?Reflect.construct(e,i||[],re(t).constructor):e.apply(t,i))}function ne(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ne=function(){return!!t})()}function re(t){return re=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},re(t)}function oe(t,e){return oe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},oe(t,e)}var ae=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),ie(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&oe(t,e)}(e,t),function(t,e,i){return e&&te(t.prototype,e),i&&te(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"draw",value:function(t){var e=this.canvas.getContext("2d");e.lineWidth=this.options.lineWidth,e.strokeStyle=this.options.strokeStyle,e.moveTo(t[0].x,t[0].y),t.forEach(function(t,i){0!==i&&e.lineTo(t.x,t.y)}),this.options.isClose&&(e.lineTo(t[0].x,t[0].y),this.options.fillStyle&&(e.fillStyle=this.options.fillStyle))}}])}(Ot);function se(t){return se="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},se(t)}function le(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,he(n.key),n)}}function he(t){var e=function(t,e){if("object"!=se(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=se(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==se(e)?e:e+""}function ue(t,e,i){return e=pe(e),function(t,e){if(e&&("object"==se(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ce()?Reflect.construct(e,i||[],pe(t).constructor):e.apply(t,i))}function ce(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ce=function(){return!!t})()}function pe(t){return pe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},pe(t)}function fe(t,e){return fe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},fe(t,e)}var de=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),ue(this,e)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&fe(t,e)}(e,t),function(t,e,i){return e&&le(t.prototype,e),i&&le(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"draw",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=t[0],n=t[t.length-1],r=this.canvas.getContext("2d");r.lineWidth=this.options.lineWidth,r.strokeStyle=this.options.strokeStyle,this.options.fillStyle&&(r.fillStyle=this.options.fillStyle),2===t.length&&(t=_(t)),r.save();var o={x:(i.x+n.x)/2,y:(i.y+n.y)/2},a=S(t[1],t[0]),s=S(t[2],t[0]);r.translate(o.x,o.y),e<0&&(e+=360);var l=e%360;r.rotate(l*Math.PI/180),r.drawOval(0,0,a/2,s/2),r.restore()}}])}(Ot);function ve(t){return ve="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ve(t)}function ge(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ye(n.key),n)}}function ye(t){var e=function(t,e){if("object"!=ve(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=ve(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ve(e)?e:e+""}function me(t,e,i){return e=xe(e),function(t,e){if(e&&("object"==ve(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,we()?Reflect.construct(e,i||[],xe(t).constructor):e.apply(t,i))}function we(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(we=function(){return!!t})()}function xe(t){return xe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},xe(t)}function be(t,e){return be=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},be(t,e)}var _e=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),me(this,e)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&be(t,e)}(e,t),function(t,e,i){return e&&ge(t.prototype,e),i&&ge(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"draw",value:function(t){2===t.length&&(t=_(t));var e=this.canvas.getContext("2d");e.lineWidth=this.options.lineWidth,e.strokeStyle=this.options.strokeStyle,this.options.fillStyle&&(e.fillStyle=this.options.fillStyle),e.save(),e.moveTo(t[0].x,t[0].y),e.lineTo(t[1].x,t[1].y),e.lineTo(t[3].x,t[3].y),e.lineTo(t[2].x,t[2].y),e.lineTo(t[0].x,t[0].y),e.restore()}}])}(Ot);function Te(t){return Te="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Te(t)}function Se(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Pe(n.key),n)}}function Pe(t){var e=function(t,e){if("object"!=Te(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Te(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Te(e)?e:e+""}function Ee(t,e,i){return e=Oe(e),function(t,e){if(e&&("object"==Te(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ce()?Reflect.construct(e,i||[],Oe(t).constructor):e.apply(t,i))}function Ce(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ce=function(){return!!t})()}function Oe(t){return Oe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Oe(t)}function Re(t,e){return Re=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Re(t,e)}var ke=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Ee(this,e)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Re(t,e)}(e,t),function(t,e,i){return e&&Se(t.prototype,e),i&&Se(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"draw",value:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=t[0],o=this.options.text||"编辑文字",a=this.canvas.getContext("2d");a.fillStyle=this.options.strokeStyle,a.save();var s=n%360;a.translate(r.x,r.y),a.rotate(s*Math.PI/180),a.scale(i,i),a.font="".concat(this.options.fontSize,"px Arial"),o.split("\n").forEach(function(t,i){a.fillText(t,0,0+i*e.options.fontSize)}),a.restore()}}])}(Ot);function Ie(t){return Ie="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ie(t)}function De(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Me(n.key),n)}}function Me(t){var e=function(t,e){if("object"!=Ie(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Ie(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ie(e)?e:e+""}function Ae(t,e,i){return e=ze(e),function(t,e){if(e&&("object"==Ie(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Le()?Reflect.construct(e,i||[],ze(t).constructor):e.apply(t,i))}function Le(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Le=function(){return!!t})()}function ze(t){return ze=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ze(t)}function je(t,e){return je=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},je(t,e)}var Be=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Ae(this,e)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&je(t,e)}(e,t),function(t,e,i){return e&&De(t.prototype,e),i&&De(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"draw",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=this.options.lineWidth,n=t[0];i*=e;var r=.2*Math.PI,o=.3*Math.PI,a=Math.sin(r)*i*2,s=i/2/Math.cos(r),l={x:n.x,y:n.y-i},h={x:n.x+s*Math.sin(r),y:n.y-i+s*Math.cos(r)},u={x:n.x+a*Math.sin(o),y:n.y-i+a*Math.cos(o)},c={x:n.x+s*Math.sin(2*r),y:n.y+s*Math.cos(2*r)},p={x:n.x+i*Math.sin(r),y:n.y+i*Math.cos(r)},f={x:n.x,y:n.y+s},d={x:n.x-i*Math.sin(r),y:n.y+i*Math.cos(r)},v={x:n.x-s*Math.sin(2*r),y:n.y+s*Math.cos(2*r)},g={x:n.x-a*Math.sin(o),y:n.y-i+a*Math.cos(o)},y={x:n.x-s*Math.sin(r),y:n.y-i+s*Math.cos(r)},m=this.canvas.getContext("2d");m.lineWidth=2,m.moveTo(l.x,l.y),m.lineTo(h.x,h.y),m.lineTo(u.x,u.y),m.lineTo(c.x,c.y),m.lineTo(p.x,p.y),m.lineTo(f.x,f.y),m.lineTo(d.x,d.y),m.lineTo(v.x,v.y),m.lineTo(g.x,g.y),m.lineTo(y.x,y.y),m.lineTo(l.x,l.y),m.strokeStyle=this.options.strokeStyle,this.options.fillStyle&&(m.fillStyle=this.options.fillStyle)}}])}(Ot);function Fe(t){return Fe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fe(t)}function Ne(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,He(n.key),n)}}function He(t){var e=function(t,e){if("object"!=Fe(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Fe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Fe(e)?e:e+""}function We(t,e,i){return e=Ue(e),function(t,e){if(e&&("object"==Fe(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ve()?Reflect.construct(e,i||[],Ue(t).constructor):e.apply(t,i))}function Ve(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ve=function(){return!!t})()}function Ue(t){return Ue=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ue(t)}function Ge(t,e){return Ge=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ge(t,e)}var qe=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),We(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ge(t,e)}(e,t),function(t,e,i){return e&&Ne(t.prototype,e),i&&Ne(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"draw",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=this.options.lineWidth;i*=e;var n=t[0],r=this.canvas.getContext("2d");r.lineWidth=2,r.strokeStyle=this.options.strokeStyle,r.moveTo(n.x,n.y),r.lineTo(n.x,n.y-i);var o=i/5,a={x:n.x+o,y:n.y-i},s={x:n.x+2*o,y:n.y-i-o},l={x:n.x+4*o,y:n.y-i+o},h={x:n.x+i,y:n.y-i};r.bezierCurve([a,s,l,h]),r.moveTo(h.x,h.y),r.lineTo(h.x,h.y+i/2);var u={x:n.x+o,y:n.y-i/2},c={x:n.x+2*o,y:n.y-i/2-o},p={x:n.x+4*o,y:n.y-i/2+o},f={x:n.x+i,y:n.y-i/2};r.bezierCurve([u,c,p,f]),r.moveTo(a.x,a.y),r.lineTo(u.x,u.y)}}])}(Ot);function Ze(t){return Ze="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ze(t)}function Xe(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ye(n.key),n)}}function Ye(t){var e=function(t,e){if("object"!=Ze(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Ze(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ze(e)?e:e+""}function $e(t,e,i){return e=Qe(e),function(t,e){if(e&&("object"==Ze(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ke()?Reflect.construct(e,i||[],Qe(t).constructor):e.apply(t,i))}function Ke(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ke=function(){return!!t})()}function Qe(t){return Qe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Qe(t)}function Je(t,e){return Je=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Je(t,e)}var ti=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),$e(this,e)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Je(t,e)}(e,t),function(t,e,i){return e&&Xe(t.prototype,e),i&&Xe(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"draw",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=this.options.lineWidth;i*=e;var n=t[0],r=this.canvas.getContext("2d"),o=n.x,a=n.y;r.lineWidth=2,r.moveTo(o+i,a),r.arc(o,a,i,0,2*Math.PI,!1),this.options.fillStyle&&(r.fillStyle=this.options.fillStyle),r.strokeStyle=this.options.strokeStyle}}])}(Ot),ei=(i(8980),i(6034),"start-painting"),ii="in-painting",ni="end-painting",ri="stop-painting",oi="tailoring-region",ai="tailoring-screenshot",si="area-move-start",li="area-moving",hi="area-move-end",ui="select-label",ci="cancel-select-label",pi="db-click-label",fi="cache-back",di="cache-forward",vi="hidden-label",gi="delete-label",yi="delete-polygon-point",mi="add-polygon-point",wi="navigator-vestige",xi="graduation-change",bi="init-complete",_i="update-zrender";function Ti(t){return Ti="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ti(t)}function Si(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Pi(n.key),n)}}function Pi(t){var e=function(t,e){if("object"!=Ti(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Ti(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ti(e)?e:e+""}var Ei,Ci={all:Ei=Ei||new Map,on:function(t,e){var i=Ei.get(t);i?i.push(e):Ei.set(t,[e])},off:function(t,e){var i=Ei.get(t);i&&(e?i.splice(i.indexOf(e)>>>0,1):Ei.set(t,[]))},emit:function(t,e){var i=Ei.get(t);i&&i.slice().map(function(t){t(e)}),(i=Ei.get("*"))&&i.slice().map(function(i){i(t,e)})}},Oi=function(t,e,i){return e&&Si(t.prototype,e),i&&Si(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.eventList=[],this.key=E()},[{key:"$emit",value:function(e,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:document;if(Object.values(t).includes(e))Ci.emit("".concat(this.key,"_").concat(e),i);else{var r=new CustomEvent(e,{bubbles:!0,detail:i});n.dispatchEvent(r)}}},{key:"$on",value:function(e,i){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:document;Object.values(t).includes(e)?Ci.on("".concat(this.key,"_").concat(e),i):(r.addEventListener(e,i,n),this.eventList.push({target:r,eventName:e,callback:i,options:n}))}},{key:"$once",value:function(t,e){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:document,r=function(o){e(o),n.removeEventListener(t,r,i)};n.addEventListener(t,r,i)}},{key:"$off",value:function(e,i,n){var r=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:document;Object.values(t).includes(e)?Ci.off("".concat(this.key,"_").concat(e),i):this.eventList.filter(function(t){return!(t.target!==o&&o&&o!==document||t.eventName!==e&&e||t.options!==n&&null!=n||t.callback!==i&&i)}).forEach(function(t){t.target.removeEventListener(t.eventName,t.callback,t.options);var e=r.eventList.findIndex(function(e){return e===t});~e&&r.eventList.splice(e,1)})}},{key:"destroy",value:function(){this.$off(),Ci.all.clear()}}]);function Ri(t){return Ri="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ri(t)}function ki(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ii(n.key),n)}}function Ii(t){var e=function(t,e){if("object"!=Ri(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Ri(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ri(e)?e:e+""}function Di(t,e,i){return e=Ai(e),function(t,e){if(e&&("object"==Ri(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Mi()?Reflect.construct(e,i||[],Ai(t).constructor):e.apply(t,i))}function Mi(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Mi=function(){return!!t})()}function Ai(t){return Ai=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ai(t)}function Li(t,e){return Li=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Li(t,e)}var zi=new Oi,ji=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Di(this,e)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Li(t,e)}(e,t),function(t,e,i){return e&&ki(t.prototype,e),i&&ki(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"draw",value:function(t){var e=this,i=y(t);if(this.options.imgLoadSuccess)this.drawImage(this.options.img,i);else if(this.options.img){var n=this.options.img;zi.$once("load",function(){e.drawImage(n,i)},!0,n)}}},{key:"drawImage",value:function(t,e){this.canvas.getContext("2d").drawImage(t,e.x,e.y,e.width,e.height)}}])}(Ot);function Bi(t){return Bi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Bi(t)}function Fi(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ni(n.key),n)}}function Ni(t){var e=function(t,e){if("object"!=Bi(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Bi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Bi(e)?e:e+""}function Hi(t,e,i){return e=Vi(e),function(t,e){if(e&&("object"==Bi(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Wi()?Reflect.construct(e,i||[],Vi(t).constructor):e.apply(t,i))}function Wi(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Wi=function(){return!!t})()}function Vi(t){return Vi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Vi(t)}function Ui(t,e){return Ui=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ui(t,e)}var Gi=function(t){function e(t){var i,n=t.viewer,r=t.canvas,o=t.cache,a=t.options;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(i=Hi(this,e,[n,r,o,a])).isInRotation=!1,i.pointList=[],i.img=new Image(33,18),i.img.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACEAAAASCAYAAADVCrdsAAAAAXNSR0IArs4c6QAAAzFJREFUSA2tVc9Lk3Ecbo4tE7FgOBNtIFhd5kWZsQm7JEkLvNRIAju4gyfREPwLJHBs1WFnSfAPGB0EDyoKqcw86UGw6GJ62SiIzM3Yp+f58P2ONadm9sDD99fz+TzP++593zmuXAAicgvy52AQ9IMe8Cr4DdwDP4CL4DuHw3GI8f8B5g/ANPgL/Bt8h+gN2HTpFGhyA6S54ujoqDgzMyODg4PS09Mjzc3N4na7xev1SigUkvHxcdne3rZyjgwT/ecgKA6An0HJZrPFiYkJ8Xg8gobnsre3V+bm5lhqMYWJ89QwOGwCX4EJ8DaFGO+DeVBWV1eltbW1ZOz3+yWRSKjJzs6OHBwcqGZ2dlaGhoaktra2pB0eHpZCoVBkH2AedJn+dzCnH32baLgEWtA4CWa5kUqlxOVyadPu7m5ZWVnh9pnI5XLFyclJ/Zl4PcFgkEFtkBSKX4J6gabREkPoxvT0NPesWNLptOAJ1wBjY2NyfHxsz75C9xp8CN4Fb4JBMAa+BxWZTEZ8Pp/Wd3Z2Sj6ft/U8Lxo/zvMMcchZXV2d8Go3NjaEt7mhoUEbxONxHhNswsU13tLTgPN74C6oz1JbW5v2GRkZ4Zb2pw/9DH4wRI4L+9DV1NRIY2OjFg4MDBidDs9OM67ch/o6OM+qzc3N0nPS398v7A+9+vEcyDLEF85aWlr0kALLZDIpRYDnAHWPKw2rraF7YvRaH41GSz1tbz7sBnsM8ZGL9vb2E0IWdHV1ydramtHrTxKpZmz3IHwEanDWsd4al4/0M9hliC0uOjo6qopZWF9fL+vr66ZGEtaw2ggRXz3Vs67cuHxOP4MthshwEQgEThQ4nU6JxWKyv79vf5ICpOFq5naP5yB1Wsd69ikPwDn9DDIMscxFOBz+QxiJRCo/wQwbsmZnjdSBenEYtQ/7lQehn8EyQ+hT3NfXpyK+0wsLC1bA8RP4FHScZVx5Rr2pY72CfdmfYehnMM8Q+gc1Ojoq/PQC9tbz1X0BuisNLrJmvemjnwLMi/Shn0GaIeJ2ZcafZu/GRczO06In/5Hpxf7lmGIIL7gIMulb0Hdew8ucs7/xoR99vb8Be6xf/B8l0bwAAAAASUVORK5CYII=",i}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ui(t,e)}(e,t),function(t,e,i){return e&&Fi(t.prototype,e),i&&Fi(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"init",value:function(t){var e=t.width,i=t.height;this.isInRotation=!0,this.imgWidth=e,this.imgHeight=i,this.rect=new _e,this.rect.setContent(this.canvas,{lineWidth:1,strokeStyle:"#989898"}),this.change()}},{key:"drawRect",value:function(t,e){var i=this.viewport.imageToViewportRectangle(0,0,this.imgWidth,this.imgHeight);this.rect.startDraw(),this.rect.draw([t,e],this.viewport.getRotation(),this.viewport.viewportToViewerElementRectangle(i)),this.rect.endDraw(),this.drawThumbPoint()}},{key:"drawRotation",value:function(){var t=this.imageToViewerElementCoordinates(this.imgWidth/2,-this.imgHeight/15),e=this.imageToViewerElementCoordinates(this.imgWidth/2,this.imgHeight/15),i=this.viewport.getRotation(),n=this.canvas.getContext("2d");n.save(),n.beginPath(),n.translate(e.x,e.y),n.rotate(i/180*Math.PI),n.font="14px Arial";var r=i+"°",o=n.measureText(r).width;n.fillStyle="rgba(0, 0, 0, 0.5)",n.rect(-o/2-10,0,o+20,24),n.fill(),n.beginPath(),n.fillStyle="#FDFDFD",n.fillText(r,-o/2,18),n.restore(),n.save(),n.beginPath(),n.translate(t.x,t.y),n.rotate(i/180*Math.PI),n.drawImage(this.img,-16.5,0,33,18),n.restore()}},{key:"drawPoint",value:function(t,e){this.thumb.draw(t,e)}},{key:"drawThumbPoint",value:function(){var t=this;this.pointList.forEach(function(e,i){t.drawPoint({x:e.x,y:e.y},{radius:5})})}},{key:"onCanvasPress",value:function(t){var e=t.x,i=t.y,n=this.imageToViewerElementCoordinates(this.imgWidth/2,-this.imgHeight/15),r=!!l({x:n.x-16.5,y:n.y},{x:n.x+16.5,y:n.y-18}).find(function(t){return d(t,{x:e,y:i})});this.rotatePoint=r?{x:e,y:i}:void 0}},{key:"onCanvasRelease",value:function(t){t.x,t.y;this.rotatePoint=void 0,this.lastPoint=void 0}},{key:"onCanvasDrag",value:function(t){var e=t.x,i=t.y;if(this.rotatePoint){this.lastPoint||(this.lastPoint={x:e,y:i});var n=T(this.pointList[4],this.lastPoint,{x:e,y:i});if(!isNaN(n/Math.PI*180)){var r=(n/Math.PI*180).toFixed(1)/1;this.viewport.setRotation((this.viewport.getRotation()+r).toFixed(1)/1),this.lastPoint={x:e,y:i}}}}},{key:"onCanvasKey",value:function(t){"Escape"===t.originalEvent.key&&(this.viewport.setRotation(0),this.stopRotation())}},{key:"stopRotation",value:function(){this.clearCanvas(),this.rotatePoint=void 0,this.lastPoint=void 0,this.pointList=[],this.isInRotation=!1}},{key:"change",value:function(){var t=this;this.isInRotation&&(this.clearCanvas(),this.pointList=l({x:0,y:0},{x:this.imgWidth,y:this.imgHeight}).map(function(e){var i=e.x,n=e.y;return t.imageToViewerElementCoordinates(i,n)}),this.drawRect(this.pointList[0],this.pointList[8]),this.drawRotation())}}])}(St),qi=i(5072),Zi=i.n(qi),Xi=i(7825),Yi=i.n(Xi),$i=i(7659),Ki=i.n($i),Qi=i(5056),Ji=i.n(Qi),tn=i(540),en=i.n(tn),nn=i(1113),rn=i.n(nn),on=i(1988),an={};an.styleTagTransform=rn(),an.setAttributes=Ji(),an.insert=Ki().bind(null,"head"),an.domAPI=Yi(),an.insertStyleElement=en();Zi()(on.A,an),on.A&&on.A.locals&&on.A.locals;var sn=["mitt"];function ln(t){return ln="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ln(t)}function hn(t){return function(t){if(Array.isArray(t))return un(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return un(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?un(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function un(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function cn(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function pn(t,e,i){return(e=dn(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function fn(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,dn(n.key),n)}}function dn(t){var e=function(t,e){if("object"!=ln(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=ln(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ln(e)?e:e+""}var vn=function(t,e,i){return e&&fn(t.prototype,e),i&&fn(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e){var i=e.mitt,n=function(t,e){if(null==t)return{};var i,n,r=function(t,e){if(null==t)return{};var i={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.includes(n))continue;i[n]=t[n]}return i}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)i=o[n],e.includes(i)||{}.propertyIsEnumerable.call(t,i)&&(r[i]=t[i])}return r}(e,sn);!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.mitt=i,this.options=n,this.viewport=n.viewer.viewport,this.viewer=n.viewer,this.el=n.el,this.height=n.height||150,this.width=n.width||150,this.containerHeight=n.containerHeight||window.innerHeight,this.containerWidth=n.containerWidth||window.innerWidth,this.element=n.element,this.canvas=document.createElement("canvas"),this.pointList=n.pointList||[],this.loadStatus=!1,this.init(),this.vestige=this.options.vestige?function(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?cn(Object(i),!0).forEach(function(e){pn(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):cn(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}({show:!0,delay:1e3,colors:["rgba(255, 255, 0, .5)","rgba(0, 255, 255, .5)","rgba(255, 0, 255, .5)"],zooms:[5,10,20]},this.options.vestige):{show:!0,delay:1e3,colors:["rgba(255, 255, 0, .5)","rgba(0, 255, 255, .5)","rgba(255, 0, 255, .5)"],zooms:[5,10,20]}},[{key:"init",value:function(){var t=this;this.element.innerHTML='<main class="navigator-main">\n <div class="v-line"></div>\n <div class="h-line"></div>\n <div class="view-rect"></div>\n <canvas class="navigator-color-rect"></canvas>\n</main>';var e=this.element.getElementsByClassName("navigator-main")[0];this.rect=this.element.getElementsByClassName("view-rect")[0],this.updateNavigatorImg(this.options.thumbnail),e.appendChild(this.canvas),this.handleMouseDrag(e),this.viewer.addHandler("pan",function(e){t.navigatorChange(t.viewport.getZoom(!0),e.center)}),this.viewer.addHandler("zoom",function(e){t.navigatorChange(e.zoom,e.refPoint)})}},{key:"rectChange",value:function(){var t=this.element.getElementsByClassName("navigator-main")[0],e=this.rect,i=t.getElementsByClassName("v-line")[0],n=t.getElementsByClassName("h-line")[0];i.style.left=Math.round(e.getBoundingClientRect().width/2+e.offsetLeft)+"px",n.style.top=Math.round(e.getBoundingClientRect().height/2+e.offsetTop)+"px",i.style.backgroundColor="red",n.style.backgroundColor="red"}},{key:"rectDraw",value:function(t){var e=this.rect,i={left:e.offsetLeft,top:e.offsetTop,width:e.clientWidth,height:e.clientHeight,scale:hn(this.vestige.zooms).reverse()[t],color:hn(this.vestige.colors).reverse()[t]};this.pointList.push(i),this.drawPointList(this.pointList),this.mitt.$emit(wi,this.pointList)}},{key:"drawPointList",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.pointList;this.pointList=e;var i=this.element.getElementsByClassName("navigator-color-rect")[0].getContext("2d");this.pointList.sort(function(t,e){return t.scale>e.scale?1:-1}).forEach(function(e){t.drawRect(i,e)})}},{key:"drawRect",value:function(t,e){t.beginPath(),t.fillStyle=e.color,t.clearRect(e.left,e.top,e.width+1,e.height+1),t.fillRect(e.left,e.top,e.width+1,e.height+1)}},{key:"navigatorChange",value:function(t,e){this.loadStatus&&(e||(e=this.viewport.getCenter(!0)),this.setViewRect(e))}},{key:"panTo",value:function(t,e){var i=t.x,n=t.y,r=this.viewport.getHomeBounds(),o=this.viewport.viewportToImageRectangle(r),a=2*o.y+o.height,s=2*o.x+o.width,l={x:i/this.canvas.width*s,y:n/this.canvas.height*a};this.viewport.panTo(this.viewport.imageToViewportCoordinates(new K.Point(l.x,l.y)),!1)}},{key:"handleMouseDrag",value:function(t){var e,i,n=this,r=function(r){var o=r.x,a=r.y;i||(i={x:o,y:a}),e||(e={x:o,y:a});var s=o-e.x,l=a-e.y;n.panTo({x:i.x+s,y:i.y+l},t)},o=function(){e="",i={x:n.centerPoint.x,y:n.centerPoint.y},n.mitt.$off("mousemove",r),n.mitt.$off("mouseup",o)},a=function(){e="",i={x:n.centerPoint.x,y:n.centerPoint.y},n.mitt.$off("touchmove",s),n.mitt.$off("touchend",a)},s=function(r){var o=r.touches[0].clientX,a=r.touches[0].clientY;i||(i={x:o,y:a}),e||(e={x:o,y:a});var s=o-e.x,l=a-e.y;n.panTo({x:i.x+s,y:i.y+l},t)};this.mitt.$on("mousedown",function(e){n.mitt.$on("selectstart",function(){return 1}),n.mitt.$on("dragstart",function(){return 1}),n.panTo({x:e.x-t.getBoundingClientRect().left,y:e.y-t.getBoundingClientRect().top},t),i={x:n.centerPoint.x,y:n.centerPoint.y},n.mitt.$on("mousemove",r),n.mitt.$on("mouseup",o)},!0,t),this.mitt.$on("touchstart",function(e){var r=e.touches[0].clientX,o=e.touches[0].clientY;n.panTo({x:r-t.getBoundingClientRect().left,y:o-t.getBoundingClientRect().top},t),i={x:n.centerPoint.x,y:n.centerPoint.y},n.mitt.$on("touchmove",s),n.mitt.$on("touchend",a)},!0,t)}},{key:"setViewRect",value:function(t){var e=this;if(!this.rect)throw new Error("找不到对应的导航器遮罩元素");t||(t=this.viewport.getCenter(!0));var i=this.viewport.getHomeBounds(),n=this.viewport.viewportToImageRectangle(i),r=2*n.y+n.height,o=2*n.x+n.width,a=1,s=this.canvas.height,l=this.canvas.width;a=r<=o?s/r:l/o;var h=this.viewport.getHomeZoom(),u=this.viewport.getZoom(),c=r*h/u,p=o*h/u;this.rect.style.cssText="height:".concat(c*a,"px;\n width: ").concat(p*a,"px;");var f=this.viewport.viewportToImageCoordinates(t);this.centerPoint={x:f.x*l/o,y:f.y*s/r};var d=this.centerPoint.y-c*a/2,v=this.centerPoint.x-p*a/2;if(this.rect.style.left=v+"px",this.rect.style.top=d+"px",this.rect.style.border="1px solid red",this.rectChange(),!1!==this.vestige.show){this.clearTimeId&&window.clearTimeout(this.clearTimeId);var g=this.viewport.viewportToImageZoom(u),y=hn(this.vestige.zooms).reverse().findIndex(function(t){return g>=t/(e.options.scale||40)});-1!==y&&(this.clearTimeId=window.setTimeout(function(){e.rectDraw(y)},this.vestige.delay||1e3))}}},{key:"updateNavigatorImg",value:function(t){var e=this;this.options.thumbnail=t;var i=this.canvas.getContext("2d"),n=new Image;n.onload=function(){var t=n.width,r=n.height;if(t>=r){var o=r/(t/e.width);e.canvas.width=e.width,e.canvas.height=o,i.clearRect(0,0,e.canvas.width,e.canvas.height),i.drawImage(n,0,0,e.canvas.width,o)}if(r>t){var a=t/(r/e.height);e.canvas.height=e.height,e.canvas.width=a,i.clearRect(0,0,e.canvas.width,e.canvas.height),i.drawImage(n,0,0,a,e.canvas.height)}e.setViewRect();var s=e.element.getElementsByClassName("navigator-color-rect")[0];s.width=e.canvas.width,s.height=e.canvas.height,e.loadStatus=!0},n.src=this.options.thumbnail}}]);function gn(t){return gn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gn(t)}function yn(t){return function(t){if(Array.isArray(t))return mn(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return mn(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?mn(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function mn(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function wn(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function xn(t,e,i){return(e=_n(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function bn(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,_n(n.key),n)}}function _n(t){var e=function(t,e){if("object"!=gn(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=gn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==gn(e)?e:e+""}function Tn(t,e,i){return e=Pn(e),function(t,e){if(e&&("object"==gn(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Sn()?Reflect.construct(e,i||[],Pn(t).constructor):e.apply(t,i))}function Sn(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Sn=function(){return!!t})()}function Pn(t){return Pn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Pn(t)}function En(t,e){return En=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},En(t,e)}var Cn=function(t){function e(t){var i,n=t.kv,r=t.viewer,o=t.canvas,a=t.cache,s=t.options;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(i=Tn(this,e,[r,o,a,s])).kv=n,i.isInTailoring=!1,i.tailoringPoints=[],i.movePointIndex=-1,i.color="#FFF",i.contents=[],i.options=function(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?wn(Object(i),!0).forEach(function(e){xn(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):wn(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}({suffix:"jpeg",quality:.92,resolution:1200,shape:!0},i.options),i}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&En(t,e)}(e,t),function(t,e,i){return e&&bn(t.prototype,e),i&&bn(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"init",value:function(t){var e=t.width,i=t.height,n=t.left,r=t.top,o=t.color,a=t.now,s=void 0!==a&&a,h=t.contents,u=void 0===h?[]:h;this.isInTailoring=!0,this.movePointIndex=-1;var c=l({x:n,y:r},{x:n+e,y:r+i});this.tailoringPoints=[c[0],c[2],c[6],c[8]],s?(this.emitScreenShot(),this.stopTailoring()):(this.color=o||"#FFF",this.contents=null!=u&&u.length?u:[],this.change())}},{key:"emitTailoringRegion",value:function(){this.mitt.$emit(oi,this.viewerElementToImageRectangle({x:this.tailoringPoints[0].x,y:this.tailoringPoints[0].y,width:this.tailoringPoints[3].x-this.tailoringPoints[0].x,height:this.tailoringPoints[3].y-this.tailoringPoints[0].y}))}},{key:"drawRect",value:function(){var t=this.canvas.getContext("2d");t.beginPath(),t.strokeStyle=this.color,t.lineWidth=1,t.rect(this.tailoringPoints[0].x,this.tailoringPoints[0].y,this.tailoringPoints[3].x-this.tailoringPoints[0].x,this.tailoringPoints[3].y-this.tailoringPoints[0].y),t.stroke()}},{key:"drawTailoring",value:function(){var t,e,i,n,r,o=Math.min.apply(Math,yn(this.tailoringPoints.map(function(t){return t.x}))),a=Math.min.apply(Math,yn(this.tailoringPoints.map(function(t){return t.y}))),s=Math.max.apply(Math,yn(this.tailoringPoints.map(function(t){return t.x}))),l=Math.max.apply(Math,yn(this.tailoringPoints.map(function(t){return t.y}))),h={x:o,y:a},u={x:s,y:a},c={x:o,y:l},p={x:s,y:l},f=s-o>30?30:s-o,d=l-a>30?30:l-a,v=this.canvas.getContext("2d");v.beginPath(),v.strokeStyle=this.color,v.lineWidth=4,v.moveTo(h.x,h.y),v.lineTo(h.x+f,h.y),v.moveTo(h.x,h.y),v.lineTo(h.x,h.y+d),v.moveTo(u.x,u.y),v.lineTo(u.x-f,u.y),v.moveTo(u.x,u.y),v.lineTo(u.x,u.y+d),v.moveTo(c.x,c.y),v.lineTo(c.x+f,c.y),v.moveTo(c.x,c.y),v.lineTo(c.x,c.y-d),v.moveTo(p.x,p.y),v.lineTo(p.x-f,p.y),v.moveTo(p.x,p.y),v.lineTo(p.x,p.y-d),v.stroke(),v.beginPath(),v.fillStyle=this.color,v.font="18px Arial";var g=(u.x-h.x).toFixed(2)/1,y=(p.y-u.y).toFixed(2)/1;v.fillText(null!==(t=this.contents)&&void 0!==t&&t[2]?this.contents[2](g,y):"".concat(this.translate("area_size")).concat(g,"*").concat(y,",").concat(this.translate("drag_resize")),h.x,h.y-50),v.fillText(null!==(e=null===(i=this.contents)||void 0===i?void 0:i[0])&&void 0!==e?e:"".concat(this.translate("complete_screenshot")),h.x,h.y-30),v.fillText(null!==(n=null===(r=this.contents)||void 0===r?void 0:r[1])&&void 0!==n?n:"".concat(this.translate("cancel_screenshot")),h.x,h.y-10),v.stroke(),v.beginPath(),v.fillStyle="#000000";var m=4,w=100;u.x+w+m>this.canvas.width&&(w=-100,m=-4),v.rect(u.x+m,u.y,w,40),v.fill(),v.save(),v.beginPath(),v.translate(u.x+m+w/2,u.y-5),v.fillStyle="#ffffff",v.drawConfirm(),v.restore(),v.save(),v.beginPath(),w<0?v.translate(u.x+w+m,u.y-5):v.translate(u.x+m,u.y-5),v.fillStyle="#ffffff",v.drawCancel(),v.restore()}},{key:"onCanvasPress",value:function(t){var e=t.x,i=t.y;this.movePointIndex=this.tailoringPoints.findIndex(function(t){return d(t,{x:e,y:i},30)});var n=this.tailoringPoints[1],r=new K.Rect(n.x+14,n.y,30,40),o=new K.Rect(n.x+64,n.y,30,40);n.x+100+4>this.canvas.width&&(r=new K.Rect(n.x-94,n.y,30,40),o=new K.Rect(n.x-44,n.y,30,40));var a=new K.Point(e,i);r.containsPoint(a)&&this.stopTailoring(),o.containsPoint(a)&&(this.emitScreenShot(),this.stopTailoring())}},{key:"onCanvasRelease",value:function(t){t.x,t.y;this.movePointIndex=-1,this.lastPoint=void 0}},{key:"onCanvasDrag",value:function(t){var e=this,i=t.x,n=t.y;if(-1!==this.movePointIndex){this.lastPoint||(this.lastPoint={x:i,y:n});var r=i-this.lastPoint.x,o=n-this.lastPoint.y;switch(this.movePointIndex){case 0:this.tailoringPoints[0]={x:this.tailoringPoints[0].x+r,y:this.tailoringPoints[0].y+o},this.tailoringPoints[1]={x:this.tailoringPoints[1].x,y:this.tailoringPoints[1].y+o},this.tailoringPoints[2]={x:this.tailoringPoints[2].x+r,y:this.tailoringPoints[2].y};break;case 1:this.tailoringPoints[0]={x:this.tailoringPoints[0].x,y:this.tailoringPoints[0].y+o},this.tailoringPoints[1]={x:this.tailoringPoints[1].x+r,y:this.tailoringPoints[1].y+o},this.tailoringPoints[3]={x:this.tailoringPoints[3].x+r,y:this.tailoringPoints[3].y};break;case 2:this.tailoringPoints[0]={x:this.tailoringPoints[0].x+r,y:this.tailoringPoints[0].y},this.tailoringPoints[2]={x:this.tailoringPoints[2].x+r,y:this.tailoringPoints[2].y+o},this.tailoringPoints[3]={x:this.tailoringPoints[3].x,y:this.tailoringPoints[3].y+o};break;case 3:this.tailoringPoints[1]={x:this.tailoringPoints[1].x+r,y:this.tailoringPoints[1].y},this.tailoringPoints[2]={x:this.tailoringPoints[2].x,y:this.tailoringPoints[2].y+o},this.tailoringPoints[3]={x:this.tailoringPoints[3].x+r,y:this.tailoringPoints[3].y+o}}this.tailoringPoints.forEach(function(t){t.x<0&&(t.x=0),t.y<0&&(t.y=0),t.x>e.canvas.width&&(t.x=e.canvas.width),t.y>e.canvas.height&&(t.y=e.canvas.height)}),this.clearCanvas(),this.drawRect(),this.drawTailoring(),this.lastPoint={x:i,y:n},this.emitTailoringRegion()}}},{key:"onCanvasKey",value:function(t){"Escape"===t.originalEvent.key&&this.stopTailoring()}},{key:"onCanvasDblClick",value:function(t){this.tailoringPoints.length>0&&this.isPointInMatrix(t)&&this.emitScreenShot(),this.stopTailoring()}},{key:"emitScreenShot",value:function(){this.emitTailoringRegion(),this.mitt.$emit(ai,{base64:this.getScreenCanvasImage(),region:this.viewerElementToImageRectangle({x:this.tailoringPoints[0].x,y:this.tailoringPoints[0].y,width:this.tailoringPoints[3].x-this.tailoringPoints[0].x,height:this.tailoringPoints[3].y-this.tailoringPoints[0].y})})}},{key:"isPointInMatrix",value:function(t){var e=Math.min.apply(Math,yn(this.tailoringPoints.map(function(t){return t.x}))),i=Math.min.apply(Math,yn(this.tailoringPoints.map(function(t){return t.y}))),n=Math.max.apply(Math,yn(this.tailoringPoints.map(function(t){return t.x}))),r=Math.max.apply(Math,yn(this.tailoringPoints.map(function(t){return t.y})));return p({x:e,y:i},{x:n,y:i},{x:e,y:r},{x:n,y:r},t)}},{key:"getScreenCanvasImage",value:function(){var t=this.viewer.drawer.canvas,e=Math.min.apply(Math,yn(this.tailoringPoints.map(function(t){return t.x}))),i=Math.min.apply(Math,yn(this.tailoringPoints.map(function(t){return t.y}))),n=Math.max.apply(Math,yn(this.tailoringPoints.map(function(t){return t.x}))),r=Math.max.apply(Math,yn(this.tailoringPoints.map(function(t){return t.y}))),o=t.getContext("2d"),a=t.getBoundingClientRect(),s=a.width,l=a.height,h=[t.width,t.height],u=h[0]/s,c=h[1]/l,p=Math.abs(n-e)*u,f=Math.abs(r-i)*c;if(p.toFixed(5)/1!=0&&f.toFixed(5)/1!=0)try{for(var d,v=o.getImageData(e*u,i*c,p,f),g=0;g<v.data.length;g+=4)0===v.data[g+3]&&(v.data[g]=255,v.data[g+1]=255,v.data[g+2]=255,v.data[g+3]=255);var y=document.createElement("canvas");y.width=p,y.height=f;var m=y.getContext("2d");m.fillstyle="#fff",m.fillRect(0,0,y.width,y.height),m.putImageData(v,0,0,0,0,p,f);var w=null===(d=this.kv.shape)||void 0===d?void 0:d.canvas;if(w&&this.options.shape&&m.drawImage(w,e*u,i*c,p,f,0,0,p,f),y.width>this.options.resolution){var x=document.createElement("canvas");x.width=this.options.resolution,x.height=this.options.resolution/y.width*y.height;var b=x.getContext("2d");return b.fillstyle="#fff",b.fillRect(0,0,x.width,x.height),b.drawImage(y,0,0,y.width,y.height,0,0,x.width,x.height),x.toDataURL("image/".concat(this.options.suffix||"jpeg"),this.options.quality)}return y.toDataURL("image/".concat(this.options.suffix||"jpeg"),this.options.quality)}catch(W){}}},{key:"stopTailoring",value:function(){this.clearCanvas(),this.tailoringPoints=[],this.isInTailoring=!1,this.movePointIndex=-1,this.lastPoint=void 0}},{key:"change",value:function(){this.isInTailoring&&(this.clearCanvas(),this.emitTailoringRegion(),this.drawRect(),this.drawTailoring())}}])}(St);function On(t){return On="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},On(t)}function Rn(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,kn(n.key),n)}}function kn(t){var e=function(t,e){if("object"!=On(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=On(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==On(e)?e:e+""}function In(t,e,i){return e=Mn(e),function(t,e){if(e&&("object"==On(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Dn()?Reflect.construct(e,i||[],Mn(t).constructor):e.apply(t,i))}function Dn(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Dn=function(){return!!t})()}function Mn(t){return Mn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Mn(t)}function An(t,e){return An=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},An(t,e)}var Ln=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),In(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&An(t,e)}(e,t),function(t,e,i){return e&&Rn(t.prototype,e),i&&Rn(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"draw",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=this.canvas.getContext("2d"),r=t.tool,o=t.points;n.beginPath(),n.save(),2===o.length&&(o=_(o));var a=y(o),s={x:a.x+a.width/2,y:a.y+a.height/2};n.translate(s.x,s.y),i<0&&(i+=360);var l=i%360;n.rotate(l*Math.PI/180),r===rt?n.drawPolygon(o.map(function(t){return{x:t.x-s.x,y:t.y-s.y}}),!0,!1):r===it?(n.moveTo(o[0].x-s.x,o[0].y-s.y),n.lineTo(o[0].x+a.width-s.x,o[0].y-s.y),n.lineTo(o[0].x+a.width-s.x,o[0].y+a.height-s.y),n.lineTo(o[0].x-s.x,o[0].y+a.height-s.y),n.lineTo(o[0].x-s.x,o[0].y-s.y)):r===nt&&n.drawOval(0,0,Math.abs(a.width/2),Math.abs(a.height/2),!1),n.closePath(),n.restore(),e.forEach(function(t){var e=t.tool,i=t.points;2===i.length&&(i=_(i)),n.save();var r=y(i),o={x:r.x+r.width/2,y:r.y+r.height/2};n.translate(o.x,o.y),n.rotate(l*Math.PI/180),e===rt?n.drawPolygon(i.map(function(t){return{x:t.x-o.x,y:t.y-o.y}}),!0,!0):e===it?(n.moveTo(i[0].x-o.x,i[0].y-o.y),n.lineTo(i[0].x-o.x,i[0].y+r.height-o.y),n.lineTo(i[0].x+r.width-o.x,i[0].y+r.height-o.y),n.lineTo(i[0].x+r.width-o.x,i[0].y-o.y),n.lineTo(i[0].x-o.x,i[0].y-o.y)):e===nt&&n.drawOval(0,0,Math.abs(r.width/2),Math.abs(r.height/2),!0),n.closePath(),n.restore()}),this.options.fillStyle&&(n.fillStyle=this.options.fillStyle,n.fill())}}])}(Ot);function zn(t){return zn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zn(t)}function jn(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function Bn(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?jn(Object(i),!0).forEach(function(e){Fn(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):jn(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function Fn(t,e,i){return(e=Hn(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Nn(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Hn(n.key),n)}}function Hn(t){var e=function(t,e){if("object"!=zn(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=zn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==zn(e)?e:e+""}function Wn(t,e,i){return e=Un(e),function(t,e){if(e&&("object"==zn(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Vn()?Reflect.construct(e,i||[],Un(t).constructor):e.apply(t,i))}function Vn(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Vn=function(){return!!t})()}function Un(t){return Un=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Un(t)}function Gn(t,e){return Gn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Gn(t,e)}var qn=function(t){function i(t){var n,r=t.viewer,o=t.canvas,a=t.cache,s=t.options;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),(n=Wn(this,i,[r,o,a,s])).labelList=[],vt.forEach(function(t){n[t]=new e[t]}),n.combination=new Ln,n.delaytimer=[],n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Gn(t,e)}(i,t),function(t,e,i){return e&&Nn(t.prototype,e),i&&Nn(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}(i,[{key:"onCanvasKey",value:function(t){}},{key:"setLabelList",value:function(t){this.labelList=t,this.change()}},{key:"change",value:function(){var t=this;this.clearCanvas();var e=this.viewport.viewportToImageRectangle(this.viewport.getBoundsNoRotate()),i={},n={},r=[],o=[],a=this.labelList.filter(function(a){var s,l,h,u,c;if(!1===a.show)return!1;if(!t[a.tool])return!1;if(!t.isInCanvas(a.region,e))return!1;if((ct.includes(a.tool)||a.isClose&&a.tool===rt)&&a.fillStyle)r.push(Bn(Bn({},a),{},{child:[],self:a}));else if(a.tool===ht)return o.push(a),!1;var p="".concat(null!==(s=a.strokeStyle)&&void 0!==s?s:"","_").concat(null!==(l=a.lineWidth)&&void 0!==l?l:"","_").concat(null!==(h=a.fillStyle)&&void 0!==h?h:""),f="".concat(null!==(u=a.strokeStyle)&&void 0!==u?u:"","_").concat(null!==(c=a.lineWidth)&&void 0!==c?c:"");return ut.includes(a.tool)?i[p]?i[p].push(a):i[p]=[a]:n[f]?n[f].push(a):n[f]=[a],!dt.includes(a.tool)});r.length>0&&a.forEach(function(e){var i=r.find(function(i){return i.self!==e&&e.points.every(function(e){return t.isContainerInRegion(e,i)})});i&&i.child.push(e)}),this.delaytimer&&(clearTimeout(this.delaytimer),this.delaytimer=void 0),this.deepDrawLabel(i,n,r,o,1,e)}},{key:"deepDrawLabel",value:function(t,e,i,n,r,o){var a=this,s=0,l=this.canvas.getContext("2d"),h={};Object.keys(t).forEach(function(e){var i=t[e];l.beginPath(),i.forEach(function(t){s>=2e3?h[e]?h[e].push(t):h[e]=[t]:a.drawLabel(t),s++});var n=null==i?void 0:i[0];null!=n&&n.fillStyle&&(l.fillStyle=n.fillStyle,l.fill()),l.strokeStyle=n.strokeStyle,l.stroke()});var u={};Object.keys(e).forEach(function(t){var i=e[t];l.beginPath(),i.forEach(function(e){s>=2e3?u[t]?u[t].push(e):u[t]=[e]:a.drawLabel(e),s++});var n=null==i?void 0:i[0];l.lineWidth=n.lineWidth,l.strokeStyle=n.strokeStyle,l.stroke()}),0===Object.keys(h).length&&0===Object.keys(u).length?(this.delaytimer=void 0,n.forEach(function(t){a.drawLabel(t)}),i.forEach(function(t){a.combination.setContent(a.canvas,t),a.combination.draw({points:a.imageToViewerElementPoints(t.points),tool:t.tool},t.child.map(function(t){var e=t.points,i=t.tool;return{points:a.imageToViewerElementPoints(e),tool:i}}),a.getAngle(t.angle))})):this.delaytimer=setTimeout(function(){a.deepDrawLabel(h,u,i,n,r+1,o)},100)}},{key:"getAngle",value:function(t){var e=this.viewport.getRotation()%360;return t?t>e?e-t+360:e-t:e}},{key:"drawLabel",value:function(t){t.viewerElementPoints=this.imageToViewerElementPoints(t.points);var e=t.viewerElementPoints;if(this[t.tool].setContent(this.canvas,t),ct.includes(t.tool))this[t.tool].draw(e,this.getAngle(t.angle));else{var i=this.getImageZoom(!0)/t.scale;this[t.tool].draw(e,i,this.getAngle(t.angle))}}}])}(St);function Zn(t){return Zn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zn(t)}function Xn(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function Yn(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Xn(Object(i),!0).forEach(function(e){$n(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Xn(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function $n(t,e,i){return(e=Qn(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Kn(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Qn(n.key),n)}}function Qn(t){var e=function(t,e){if("object"!=Zn(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Zn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Zn(e)?e:e+""}function Jn(t,e,i){return e=er(e),function(t,e){if(e&&("object"==Zn(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,tr()?Reflect.construct(e,i||[],er(t).constructor):e.apply(t,i))}function tr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(tr=function(){return!!t})()}function er(t){return er=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},er(t)}function ir(t,e){return ir=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ir(t,e)}var nr=function(t){function i(t){var n,r=t.viewer,o=t.canvas,a=t.cache,s=t.options;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),(n=Jn(this,i,[r,o,a,s])).labelList=[],n.movePoint=void 0,n.currentPressPoint=void 0,n.lastPoint=void 0,n.draging=!1,n.isHover=!1,vt.forEach(function(t){n[t]=new e[t]}),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ir(t,e)}(i,t),function(t,e,i){return e&&Kn(t.prototype,e),i&&Kn(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}(i,[{key:"drawPoint",value:function(t,e){this.thumb.draw(t,{radius:e?this.options.thumb.activeRadius:this.options.thumb.radius,strokeStyle:e?this.options.thumb.activeColor:this.options.thumb.color,fillStyle:e?this.options.thumb.activeBgColor:this.options.thumb.bgColor})}},{key:"drawLines",value:function(t,e){var i=this,n=this.canvas.getContext("2d");t.forEach(function(r,o){n.beginPath(),n.strokeStyle=s||"#01d0b0",n.lineWidth=2;var a=o===e,s=a?i.options.thumb.activeColor:i.options.thumb.color,l=2*(a?i.options.thumb.activeRadius:i.options.thumb.radius);if(0===o||2===o){var h=t[1],u=2===o?t[5]:t[3],c=h.x>r.x?-1:1,p=u.y>r.y?-1:1;n.moveTo(r.x+5*c,r.y+5*p),n.lineTo(r.x+(5-l)*c,r.y+5*p),n.moveTo(r.x+5*c,r.y+5*p),n.lineTo(r.x+5*c,r.y+(5-l)*p)}else if(1===o||7===o){var f=t[4].y>r.y?-1:1;n.moveTo(r.x,r.y+5*f),n.lineTo(r.x-l/2,r.y+5*f),n.moveTo(r.x,r.y+5*f),n.lineTo(r.x+l/2,r.y+5*f)}else if(3===o||5===o){var d=t[4].x>r.x?-1:1;n.moveTo(r.x+5*d,r.y),n.lineTo(r.x+5*d,r.y-l/2),n.moveTo(r.x+5*d,r.y),n.lineTo(r.x+5*d,r.y+l/2)}else if(4===o&&a)i.drawPoint(r,a);else if(6===o||8===o){var v=8===o?t[5]:t[3],g=t[7],y=v.y>r.y?-1:1,m=g.x>r.x?-1:1;n.moveTo(r.x+5*m,r.y+5*y),n.lineTo(r.x+5*m,r.y+(5-l)*y),n.moveTo(r.x+5*m,r.y+5*y),n.lineTo(r.x+(5-l)*m,r.y+5*y)}n.stroke()})}},{key:"setLabelList",value:function(t){this.labelList=t,this.change()}},{key:"onCanvasPress",value:function(t){var e=this,i=t.x,n=t.y;this.movePoint=void 0,this.currentPressPoint=void 0,this.lastPoint=void 0,this.draging=!1;var r,o=[],a=void 0,s=this.viewport.viewportToImageRectangle(this.viewport.getBoundsNoRotate());this.labelList.forEach(function(t){if(t.tool!==ht&&(t.select&&(a=t),t.select=!1,!e.movePoint)){if(!e.isInCanvas(t.region,s))return!1;var r=-1,u=[],c=e.getImageZoom(!0)/t.scale,f=e.imageToViewerElementPoints(t.points),y={x:f[0].x,y:f[0].y},m={x:f[f.length-1].x,y:f[f.length-1].y};if(ct.includes(t.tool))r=(u=h(f)).findIndex(function(t){return d(t,{x:i,y:n})});else if(t.tool===rt)r=(u=e.setPointsMove(t,f)).findIndex(function(t){return t.canMove&&d(t,{x:i,y:n})});else if(pt.includes(t.tool)){var w=t.lineWidth||2;u=[y,m],r=d(y,{x:i,y:n},10+w)?1:d(m,{x:i,y:n},10+w)?7:d({x:(m.x+y.x)/2,y:(m.y+y.y)/2},{x:i,y:n},10+w)?4:-1}else if(t.tool===ot){var x=e.getFontWidth(t.text,t.fontSize);u=l({x:m.x,y:m.y-t.fontSize*c},{x:m.x+x*c,y:m.y});var _=b(m,{x:i,y:n},-t.angle);r=u.findIndex(function(t,e){return d(t,_)&&4===e})}else if(t.tool===at){var T=t.lineWidth*c;r=(u=l({x:m.x-T,y:m.y-T},{x:m.x+T,y:m.y+T})).findIndex(function(t){return d(t,{x:i,y:n})})}if(t.tool===lt){var S=t.lineWidth*c;r=(u=l({x:m.x-S,y:m.y-S},{x:m.x+S,y:m.y+S})).findIndex(function(t,e){return d(t,{x:i,y:n})&&4===e})}else if(t.tool===st){var P=t.lineWidth*c;r=(u=l({x:m.x,y:m.y-P},{x:m.x+P,y:m.y})).findIndex(function(t){return d(t,{x:i,y:n})})}~r?(e.movePoint={position:r,label:t},e.currentPressPoint={x:i,y:n}):t.tool===rt?v({x:i,y:n},u)&&o.push(t):pt.includes(t.tool)?g({x:i,y:n},u)&&o.push(t):p(u[0],u[2],u[6],u[8],{x:i,y:n})&&o.push(t)}}),this.movePoint?(this.movePoint.label.select=!0,this.mitt.$emit(ui,this.movePoint.label),this.mitt.$emit(si,this.movePoint.label),this.draging=!0):o.length>0&&(o.sort(function(t,e){return t.tool===lt?-1:t.tool===ot?e.tool===lt?1:-1:t.tool===at?e.tool===lt||e.tool===ot?1:-1:t.tool===st?e.tool===lt||e.tool===ot||e.tool===at?1:-1:Math.abs(t.region.width)-Math.abs(e.region.width)}),(r=o[0]).select=!0),r?this.mitt.$emit(ui,r):!this.movePoint&&a&&this.mitt.$emit(ci,a),this.change()}},{key:"onCanvasDblClick",value:function(t){var e=this,i=t.x,n=t.y;setTimeout(function(){var t=e.labelList.find(function(t){return t.select});if((null==t?void 0:t.tool)===rt){for(var r=e.imageToViewerElementPoints(t.points),o=-1,a=0,s=r.length,l=s-1;a<s;l=a,a++){var h=r[a],u=r[l];if(g({x:i,y:n},[h,u])){o=a;break}}if(o>-1){var c=e.viewerElementToImageCoordinates(i,n);t.points.splice(o,0,Yn(Yn({},c),{},{canMove:!0})),e.mitt.$emit(mi,t),e.change()}else e.mitt.$emit(pi,t)}else e.mitt.$emit(pi,t)})}},{key:"onCanvasMove",value:function(t){var e=t.x,i=t.y,n=this.labelList.find(function(t){var e=t.tool,i=t.select;return e===it&&i});if(n&&!this.movePoint){var r=this.imageToViewerElementPoints(n.points);if(this.isContainerInRegion({x:e,y:i},{isClose:!0,points:r,tool:it,region:y(r)})){var o={x:(r[r.length-1].x+r[0].x)/2,y:(r[r.length-1].y+r[0].y)/2};d(o,{x:e,y:i})?(this.isHover=!0,this.drawPoint(o,!!this.movePoint)):this.isHover&&(this.isHover=!1,this.change())}}}},{key:"onCanvasRelease",value:function(t){var e=t.x,i=t.y;if(this.movePoint&&!1!==this.options.drag){var n=S(this.currentPressPoint,{x:e,y:i});if(Math.abs(n)>1){var r=this.movePoint.label;this.mitt.$emit(hi,r)}}this.movePoint=void 0,this.currentPressPoint=void 0,this.lastPoint=void 0,this.draging=!1,this.change()}},{key:"onCanvasDrag",value:function(t,e){var i=this,n=t.x,r=t.y;if(!1!==this.options.drag){this.lastPoint||(this.lastPoint={x:n,y:r});var o=this.movePoint.label,a=this.movePoint.position,s=!1!==o.move,l=!1!==o.resize;if((s||l)&&(4!==a||s)&&(4===a||l)){e.preventDefaultAction=!0;var u=this.getImageZoom(!0)/o.scale,c=o.tool,p=this.imageToViewerElementPoints(o.points),f=p[0],d=p[p.length-1],v=n-this.lastPoint.x,g=r-this.lastPoint.y;if(pt.includes(c))4===a&&(p[0]={x:f.x+v,y:f.y+g},p[1]={x:d.x+v,y:d.y+g}),1===a&&(p[0]={x:f.x+v,y:f.y+g}),7===a&&(p[1]={x:d.x+v,y:d.y+g});else if(ct.includes(c)){var m=h(p);switch(a){case 0:p[0]={x:m[0].x+v,y:m[0].y+g},p[1]={x:m[2].x,y:m[2].y+g},p[2]={x:m[6].x+v,y:m[6].y};break;case 1:p[0]={x:m[0].x,y:m[0].y+g},p[1]={x:m[2].x,y:m[2].y+g};break;case 2:p[0]={x:m[0].x,y:m[0].y+g},p[1]={x:m[2].x+v,y:m[2].y+g},p[3]={x:m[8].x+v,y:m[8].y};break;case 3:p[0]={x:m[0].x+v,y:m[0].y},p[2]={x:m[6].x+v,y:m[6].y};break;case 4:p[0]={x:m[0].x+v,y:m[0].y+g},p[1]={x:m[2].x+v,y:m[2].y+g},p[2]={x:m[6].x+v,y:m[6].y+g},p[3]={x:m[8].x+v,y:m[8].y+g};break;case 5:p[1]={x:m[2].x+v,y:m[2].y},p[3]={x:m[8].x+v,y:m[8].y};break;case 6:p[0]={x:m[0].x+v,y:m[0].y},p[2]={x:m[6].x+v,y:m[6].y+g},p[3]={x:m[8].x,y:m[8].y+g};break;case 7:p[2]={x:m[6].x,y:m[6].y+g},p[3]={x:m[8].x,y:m[8].y+g};break;case 8:p[1]={x:m[2].x+v,y:m[2].y},p[2]={x:m[6].x,y:m[6].y+g},p[3]={x:m[8].x+v,y:m[8].y+g}}}else if(c===rt){for(var w=p.map(function(t,e){return Yn(Yn({},t),{},{index:e})}).filter(function(t){return t.canMove}),x=void 0,_=void 0,P=0;P<w.length-1;P++){if(0===a){x=w[w.length-1].index,_=w[1].index;break}if(a===w[w.length-1].index){x=w[w.length-2].index,_=w[0].index;break}if(a===w[P].index){x=w[P-1].index,_=w[P+1].index;break}}if(!x&&0!==x||!_&&0!==_)return;var E=p[x],C=p[_],O=p[a],R=T(C,O,{x:n,y:r}),k=T(E,O,{x:n,y:r}),I=S({x:n,y:r},C)/S(O,C),D=S({x:n,y:r},E)/S(O,E);o.points=p.map(function(t,e){if(0===a&&e>=a&&e<=_||a===w[w.length-1].index&&e>=a&&e>=_||0!==a&&a!==w[w.length-1].index&&e>=a&&e<=_){if(I===1/0)return Yn(Yn({},t),i.viewerElementToImageCoordinates(C.x,C.y));var n=b(C,t,180*R/Math.PI);return Yn(Yn({},t),i.viewerElementToImageCoordinates((n.x-C.x)*I+C.x,(n.y-C.y)*I+C.y))}if(0===a&&e>=x||a===w[w.length-1].index&&e<=a&&e>=x||0!==a&&a!==w[w.length-1].index&&e>=x&&e<=a){if(D===1/0)return Yn(Yn({},t),i.viewerElementToImageCoordinates(E.x,E.y));var r=b(E,t,180*k/Math.PI);return Yn(Yn({},t),i.viewerElementToImageCoordinates((r.x-E.x)*D+E.x,(r.y-E.y)*D+E.y))}return Yn(Yn({},t),i.viewerElementToImageCoordinates(t.x,t.y))})}else c===ot||c===lt?4===a&&(p[0]={x:d.x+v,y:d.y+g},p[1]={x:d.x+v,y:d.y+g}):c===at?4===a?(p[0]={x:d.x+v,y:d.y+g},p[1]={x:d.x+v,y:d.y+g}):0===a||2===a?o.lineWidth-=g/u:6!==a&&8!==a||(o.lineWidth+=g/u):c===st&&(4===a?(p[0]={x:d.x+v,y:d.y+g},p[1]={x:d.x+v,y:d.y+g}):0===a||2===a?o.lineWidth-=g/u:6!==a&&8!==a||(o.lineWidth+=g/u,p[1]={x:d.x,y:d.y+g},p[0]={x:d.x,y:d.y+g}));c!==rt&&(o.points=this.viewerElementToImagePoints(p)),o.region=y(o.points),this.mitt.$emit(li,o),this.lastPoint={x:n,y:r}}}}},{key:"drawThumbPoints",value:function(t,e){var i,n=this;if(!1!==this.options.thumb.show){var r=null===(i=this.movePoint)||void 0===i?void 0:i.position;pt.includes(e)?(this.drawPoint(t[0],1===r),this.drawPoint({x:(t[0].x+t[1].x)/2,y:(t[0].y+t[1].y)/2},4===r),this.drawPoint(t[1],7===r)):e===it?this.drawLines(h(t),r):ct.includes(e)?h(t).forEach(function(t,e){n.drawPoint(t,r===e)}):e===rt?t.forEach(function(t,e){t.canMove&&n.drawPoint(t,r===e)}):e===ot||e===lt?this.drawPoint(t[0],4===r):e!==at&&e!==st||l(t[0],t[1]).forEach(function(t,e){0!==e&&2!==e&&4!==e&&6!==e&&8!==e||n.drawPoint(t,r===e)})}}},{key:"change",value:function(){this.clearCanvas(),this.showLabelMeasure();var t=this.labelList.find(function(t){return t.select});if(t&&!1!==t.show){var e=this.imageToViewerElementPoints(t.points),i=e[0],n=this.getImageZoom(!0)/t.scale;if(ft.includes(t.tool))if(t.tool===ot){var r=this.getFontWidth(t.text,t.fontSize),o=b(i,{x:i.x+r/2*n,y:i.y-t.fontSize/2*n+4},t.angle);this.drawThumbPoints([o],t.tool)}else if(t.tool===at){var a=t.lineWidth*n;this.drawThumbPoints([{x:i.x-a,y:i.y-a},{x:i.x+a,y:i.y+a}],t.tool)}else if(t.tool===lt)this.drawThumbPoints([{x:i.x,y:i.y}],t.tool);else if(t.tool===st){var s=t.lineWidth*n;this.drawThumbPoints([{x:i.x,y:i.y-s},{x:i.x+s,y:i.y}],t.tool)}else t.tool===rt&&(this.draging?this.drawThumbPoints(e,t.tool):this.drawThumbPoints(this.setPointsMove(t,e),t.tool));else this.drawThumbPoints(this.imageToViewerElementPoints(t.points),t.tool);this[t.tool].setContent(this.canvas,Yn({},t))}}},{key:"showLabelMeasure",value:function(){var t=this,e=this.viewport.viewportToImageRectangle(this.viewport.getBoundsNoRotate()),i=this.getImageZoom(!0)*this.options.scale;this.labelList.forEach(function(n){!1!==n.show&&t.isInCanvas(n.region,e)&&(t.labelDrawingFunc(n),!1!==n.measure&&(n.select||i>=t.options.measure.scale&&t.options.measure.defaultShow)&&t[n.tool].drawMeasureInfo.call(t,n,t.getMeasureContent(n)))})}},{key:"labelDrawingFunc",value:function(t){var e,i;(this.options.labelDrawing||null!==(e=this.options.label)&&void 0!==e&&e.drawing)&&((null===(i=this.options.label)||void 0===i?void 0:i.drawing)||this.options.labelDrawing)(this.canvas,t,this.imageToViewerElementRectangle(t.region))}},{key:"setPointsMove",value:function(t,e){var i,n=e[0],r=(null===(i=this.options.label)||void 0===i?void 0:i.polygonWidth)||30;return e.forEach(function(i,o){i.canMove=!1,t.points[o].canMove=!1,0!==o&&(d(n,i,r)||d(e[0],i,r))&&o!==e.length-1||(n=i,i.canMove=!0,t.points[o].canMove=!0)}),e}}])}(St);function rr(t){return rr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},rr(t)}function or(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ar(n.key),n)}}function ar(t){var e=function(t,e){if("object"!=rr(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=rr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==rr(e)?e:e+""}var sr=function(t,e,i){return e&&or(t.prototype,e),i&&or(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(){var e,i,n,r,o,a,s=this,l=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),l||(l={}),this.id=l.id,this.parent_id=l.parent_id,this.lineWidth=l.lineWidth?l.lineWidth:l.tool===at?15:l.tool===st?30:l.tool===lt?10:2,this.strokeStyle=l.strokeStyle||"#027AFF",this.fillStyle=l.fillStyle,this.description=l.description,this.fontSize=l.fontSize||14,this.text=l.text,this.angle=null!==(e=l.angle)&&void 0!==e?e:0,this.measure=l.measure,this.points=l.points,this.tool=l.tool,this.src=l.src,this.scale=l.scale,this.region=l.region,this.move=l.move,this.resize=l.resize,this.isROI=null!==(i=l.isROI)&&void 0!==i&&i,this.isClose=null===(n=l.isClose)||void 0===n||n,this.select=null!==(r=l.select)&&void 0!==r&&r,this.show=null===(o=l.show)||void 0===o||o,this.__other__=l.__other__||{},this.__data__=null!==(a=l.__data__)&&void 0!==a?a:l,this.src&&(this.img=new Image,this.img.src=this.src,this.imgLoadSuccess=!1,this.img.onload=function(){s.imgLoadSuccess=!0})});function lr(t){return lr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},lr(t)}function hr(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function ur(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?hr(Object(i),!0).forEach(function(e){cr(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):hr(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function cr(t,e,i){return(e=fr(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function pr(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,fr(n.key),n)}}function fr(t){var e=function(t,e){if("object"!=lr(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=lr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==lr(e)?e:e+""}function dr(t,e,i){return e=gr(e),function(t,e){if(e&&("object"==lr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,vr()?Reflect.construct(e,i||[],gr(t).constructor):e.apply(t,i))}function vr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(vr=function(){return!!t})()}function gr(t){return gr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},gr(t)}function yr(t,e){return yr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},yr(t,e)}var mr=function(t){function i(t){var n,r=t.viewer,o=t.canvas,a=t.cache,s=t.options;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),n=dr(this,i,[r,o,a,s]),vt.forEach(function(t){n[t]=new e[t]}),n.ROIList=[],n.points=[],n.tool=void 0,n.isInDraw=!1,n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&yr(t,e)}(i,t),function(t,e,i){return e&&pr(t.prototype,e),i&&pr(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}(i,[{key:"startDraw",value:function(t){if(!t.tool)throw new Error("options.tool must not bu null");if("curve"===t.tool)throw new Error("Curve is obsolete. Please use polygon instead");if(!vt.includes(t.tool))throw new Error("".concat(t.tool," is not a effective drawing tool"));this.viewer.canvas.focus(),this.points=[],this.tool=t.tool,this[this.tool].setContent(this.canvas,ur(ur({strokeStyle:"#027AFF",fillStyle:"",description:"",text:"",measure:!0,clear:!0,isClose:!0,enableDbClickClose:!0},t),{},{lineWidth:t.lineWidth?t.lineWidth:this.tool===at?15:this.tool===st?30:this.tool===lt?10:2,tool:void 0})),this.isInDraw=!0}},{key:"updateOptions",value:function(t){if(!t.tool)throw new Error("options.tool must not bu null");if("curve"===t.tool)throw new Error("Curve is obsolete. Please use polygon instead");if(!vt.includes(t.tool))throw new Error("".concat(t.tool," is not a effective drawing tool"));this.viewer.canvas.focus(),this.tool=t.tool,this[this.tool].setContent(this.canvas,ur(ur({strokeStyle:"#027AFF",fillStyle:"",description:"",text:"",measure:!0,clear:!0,isClose:!0,enableDbClickClose:!0},t),{},{lineWidth:t.lineWidth?t.lineWidth:this.tool===at?15:this.tool===st?30:this.tool===lt?10:2,tool:void 0}))}},{key:"setLabelList",value:function(t){this.ROIList=t.filter(function(t){return t.isROI})}},{key:"onCanvasPress",value:function(t){var e=t.x,i=t.y,n=this.viewerElementToImageCoordinates(e,i);if(!this.isInROI(n))return this.points=[],void this.clearCanvas();var r=this.tool;r===rt?this.points.push(n):ct.includes(r)?this.points=[n,n,n,n]:this.points=[n],this.clearCanvas(),this[r].startDraw();var o=this.imageToViewerElementPoints(this.points);this[r].draw(o),this[r].endDraw(),this[r].drawPoints(o,{radius:this.options.thumb.radius,strokeStyle:this.options.thumb.color,fillStyle:this.options.thumb.bgColor}),this.mitt.$emit(ei,this.getPaintOptions())}},{key:"onCanvasDrag",value:function(t){var e=t.position,i=e.x,n=e.y,r=this.viewerElementToImageCoordinates(i,n);t.preventDefaultAction=!0;var o=this.tool;if(ct.includes(o)){var a=this.imageToViewerElementCoordinates(this.points[0].x,this.points[0].y);this.points=this.viewerElementToImagePoints(_([a,{x:i,y:n}]))}else ft.includes(o)?o===rt?(this.points.push(r),this.setEnablePoints(!1)):ut.includes(o)&&(this.points=[r,r]):this.points=[this.points[0]||r,r];this.clearCanvas(),this[o].startDraw();var s=this.imageToViewerElementPoints(this.points);this[o].draw(s),this[o].endDraw(),this[o].drawPoints(s,{radius:this.options.thumb.radius,strokeStyle:this.options.thumb.color,fillStyle:this.options.thumb.bgColor}),this.mitt.$emit(ii,this.getPaintOptions())}},{key:"onCanvasRelease",value:function(t){var e=t.x,i=t.y,n=this.viewerElementToImageCoordinates(e,i);if(!this.isInROI(n)||0===this.points.length)return this.points=[],void this.clearCanvas();var r=this.tool;if(ft.includes(r)){if(ut.includes(r))this.points=[n,n];else if(r===rt){var o=this.imageToViewerElementCoordinates(this.points[0].x,this.points[0].y),a=this[this.tool].options.enableDbClickClose,s=this[this.tool].options.isClose;if(a){if(!s||!d(o,{x:e,y:i}))return;if(this.setEnablePoints(),this.points.length<5)return}else if(this.setEnablePoints(),this.points.length<5)return this.points=[],void this.clearCanvas()}}else{var l=S(this.imageToViewerElementCoordinates(this.points[0].x,this.points[0].y),{x:e,y:i});if(Math.abs(l)<10)return this.points=[],void this.clearCanvas()}this.mitt.$emit(ni,this.getPaintOptions()),this[this.tool].options.once?this.endDraw():this[this.tool].options.clear&&(this.points=[],this.clearCanvas())}},{key:"onCanvasDblClick",value:function(t){var e=t.x,i=t.y,n=this.viewerElementToImageCoordinates(e,i);return this.isInROI(n)&&0!==this.points.length?this.tool===rt&&(this.setEnablePoints(),this.points.length<5)?(this.points=[],void this.clearCanvas()):(this.mitt.$emit(ni,this.getPaintOptions()),void(this[this.tool].options.once?(this.mitt.$emit(ri,this.getPaintOptions()),this.endDraw()):this[this.tool].options.clear&&(this.points=[],this.clearCanvas()))):(this.points=[],void this.clearCanvas())}},{key:"onCanvasMove",value:function(t){var e=t.target,i=t.x,n=t.y,r=e.getBoundingClientRect(),o=r.left,a=r.top,s=this.viewerElementToImageCoordinates(i-o,n-a);if(!this.isInROI(s))return this.points=[],void this.clearCanvas();var l=this.tool;if(l===rt&&this.points.length>0){this.points.length>1&&this.points.pop(),this.points.push(s),this.clearCanvas(),this[l].startDraw();var h=this.imageToViewerElementPoints(this.points);this[l].draw(h),this[l].endDraw(),this[l].drawPoints(h,{radius:this.options.thumb.radius,strokeStyle:this.options.thumb.color,fillStyle:this.options.thumb.bgColor}),this.mitt.$emit(ii,this.getPaintOptions())}}},{key:"onCanvasKey",value:function(t){var e=t.originalEvent;"Escape"===e.key&&this.isInDraw&&(this.mitt.$emit(ri,this.getPaintOptions()),this.endDraw()),"Delete"!==e.key&&"Backspace"!==e.key||this.tool===rt&&this.points.length>1&&(this.points.splice(this.points.length-2,1),this.change())}},{key:"setEnablePoints",value:function(){var t,e=this,i=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n=this.imageToViewerElementPoints(this.points),r=n[0],o=(null===(t=this.options.label)||void 0===t?void 0:t.polygonWidth)||30;if(this.points=this.points.filter(function(t,i){var a=n[i];if(0===i)return!0;if(i===e.points.length-1)return!0;if(d(r,a,o)){var s=n[i+1];return!!s&&(180*Math.abs(T(a,r,s))/Math.PI<90&&(r=a,!0))}return r=a,!0}),i&&this.points.length>1){var a=this.points[this.points.length-1],s=this.points[this.points.length-2];d(this.imageToViewerElementCoordinates(a.x,a.y),this.imageToViewerElementCoordinates(s.x,s.y))&&this.points.splice(this.points.length-2,1)}}},{key:"getPaintOptions",value:function(){var t=new sr(ur(ur({},this[this.tool].options),{},{points:this.points,scale:this.getImageZoom(!0),region:y(this.points),tool:this.tool,angle:this.viewport.getRotation()%360}));return t.measure&&this[this.tool].drawMeasureInfo.call(this,t,this.getMeasureContent(ur(ur({},t),{},{select:!0}))),t}},{key:"isInROI",value:function(t){return this.options.ROI?this[this.tool].options.isROI||this.isContainerLabel(t,this.ROIList):!(this.ROIList.length>0)||(this[this.tool].options.isROI||this.isContainerLabel(t,this.ROIList))}},{key:"clearCanvas",value:function(){var t,e;null==this||null===(t=this[this.tool])||void 0===t||null===(e=t.clearCanvas)||void 0===e||e.call(t)}},{key:"endDraw",value:function(){this.clearCanvas(),this.points=[],this.tool=void 0,this.isInDraw=!1}},{key:"change",value:function(){if(this.isInDraw&&0!==this.points.length){var t=this.imageToViewerElementPoints(this.points);this.clearCanvas(),this[this.tool].startDraw(),this[this.tool].draw(t),this[this.tool].endDraw(),this[this.tool].drawPoints(t,{radius:this.options.thumb.radius,strokeStyle:this.options.thumb.color,fillStyle:this.options.thumb.bgColor}),this.mitt.$emit(ii,this.getPaintOptions())}}}])}(St);i(5440);function wr(t){return wr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},wr(t)}function xr(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,br(n.key),n)}}function br(t){var e=function(t,e){if("object"!=wr(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=wr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==wr(e)?e:e+""}function _r(t,e,i){return e=Sr(e),function(t,e){if(e&&("object"==wr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Tr()?Reflect.construct(e,i||[],Sr(t).constructor):e.apply(t,i))}function Tr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Tr=function(){return!!t})()}function Sr(t){return Sr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Sr(t)}function Pr(t,e){return Pr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Pr(t,e)}var Er=function(t){function e(t){var i,n=t.viewer,r=t.canvas,o=t.cache,a=t.options;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(i=_r(this,e,[n,r,o,a])).microns=a.microns||[5e3,2e3,1500,1250,1e3,800,500,400,250,200,150,125,100,80,60,40,20,10,8,5,4,2,1],i}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Pr(t,e)}(e,t),function(t,e,i){return e&&xr(t.prototype,e),i&&xr(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"change",value:function(){var t=this.microns,e=this.viewerElementToImageCoordinates(0,0),i=this.viewerElementToImageCoordinates(50,0).distanceTo(e)*this.options.imageCapRes,n=this.microns.findIndex(function(t){return t<=i});~n?this.setScaleLine(t[n],t[n]/this.options.imageCapRes):this.setScaleLine(t[t.length-1],t[t.length-1]/this.options.imageCapRes)}},{key:"setScaleLine",value:function(t,e){var i=this.imageToViewerElementCoordinates(0,0),n=this.imageToViewerElementCoordinates(e,0).distanceTo(i);this.options.custom?this.mitt.$emit(xi,{width:n,txt:t}):this.paintGraduation({width:n,txt:t})}},{key:"paintGraduation",value:function(t){var e=this,i=t.width,n=t.txt,r=this.canvas.getContext("2d"),o=this.canvas.width,a=this.canvas.height;if(r.beginPath(),r.clearRect(0,0,o,a),this.options.show){var s=this.options,l=s.left,h=s.top,u=s.right,c=s.bottom,p=10,f=a-10;l?p=l:u&&(p=o-u-i),h?f=h:c&&(f=a-c),r.beginPath(),r.strokeStyle="#000000",r.lineWidth=3,r.fillStyle="#000000",r.font="bold 14px Arial";var d=this.options.tick||{height:8,number:5},v=this.getUnitIndex(n*d.number,this.options.units,this.options.binary),g=C(n*d.number,this.options.units,this.options.binary,v),y=r.measureText(g).width;r.fillText(g,p+i*d.number-y/2,f+20),new Array(d.number).fill(1).forEach(function(t,o){r.moveTo(p+i*o,f-d.height),r.lineTo(p+i*o,f),r.lineTo(p+i*(o+1),f),r.lineTo(p+i*(o+1),f-d.height);var a=C(n*o,e.options.units,e.options.binary,v).replace(e.options.units[v],""),s=r.measureText(a).width;r.fillText(a,p+i*o-s/2,f+20)}),r.stroke()}}},{key:"getUnitIndex",value:function(t,e,i){for(var n=t,r=0;n>=i;)n/=i,r++;return e[r]||(r=e.length-1),r}}])}(St);function Cr(t){return Cr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Cr(t)}function Or(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Rr(n.key),n)}}function Rr(t){var e=function(t,e){if("object"!=Cr(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Cr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Cr(e)?e:e+""}function kr(t,e,i){return e=Dr(e),function(t,e){if(e&&("object"==Cr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ir()?Reflect.construct(e,i||[],Dr(t).constructor):e.apply(t,i))}function Ir(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ir=function(){return!!t})()}function Dr(t){return Dr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Dr(t)}function Mr(t,e){return Mr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Mr(t,e)}var Ar=function(t){function e(t){var i,n=t.viewer,r=t.canvas,o=t.cache,a=t.options;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(i=kr(this,e,[n,r,o,a])).options.scale||(i.options.scale=20),i}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Mr(t,e)}(e,t),function(t,e,i){return e&&Or(t.prototype,e),i&&Or(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"change",value:function(){var t=this.viewerElementToImageCoordinates(0,0),e=this.viewerElementToImageCoordinates(this.canvas.width,0),i=this.viewerElementToImageCoordinates(0,this.canvas.height),n=this.getImageZoom(!0)*this.options.scale,r=this.options.pxConversion?this.options.imageCapRes:1,o=Math.pow(this.options.binary,this.options.unitsIndex||0),a=40===this.options.scale?this.options.pxConversion?1600/this.options.imageCapRes:3200:this.options.pxConversion?800/this.options.imageCapRes:1600,s=0;if(n>=1){for(;n/2>=1;)s++,n/=2;s&&(a/=Math.pow(2,s))}else if(n<1){for(;2*n<=1;)s++,n*=2;s&&(a*=Math.pow(2,s))}var l=e.distanceTo(t),h=i.distanceTo(t),u=Math.floor(t.x/a),c=Math.floor((e.x+l)/a),p=Math.floor(t.y/a),f=Math.floor((i.y+h)/a),d=this.canvas.getContext("2d");if(d.clearRect(0,0,this.canvas.width,this.canvas.height),this.options.show){d.beginPath(),d.lineWidth=1;for(var v=u;v<=c+1;v++){var g=this.imageToViewerElementCoordinates(v*a,0);d.moveTo(g.x,0),d.lineTo(g.x,this.canvas.height)}for(var y=p;y<=f+1;y++){var m=this.imageToViewerElementCoordinates(0,y*a);d.moveTo(0,m.y),d.lineTo(this.canvas.width,m.y)}d.stroke()}if(this.options.ruler){var w=this.imageToViewerElementCoordinates(a,0).minus(this.imageToViewerElementCoordinates(0,0)).x;d.beginPath(),d.font="14px Arial",d.fillStyle="#fff",d.fillRect(0,0,20,this.canvas.height),d.fillRect(0,0,this.canvas.width,20),d.beginPath(),d.fillStyle="rgba(0, 0, 0, .3)",d.strokeStyle="rgba(0, 0, 0, .8)",d.moveTo(20,20),d.lineTo(20,this.canvas.height),d.moveTo(20,20),d.lineTo(this.canvas.width,20);for(var x=u;x<=c+1;x++){var b=this.imageToViewerElementCoordinates(x*a,0);d.moveTo(b.x,0),d.lineTo(b.x,20);for(var _=1;_<5;_++)d.moveTo(b.x+w/5*_,16),d.lineTo(b.x+w/5*_,20),x!==u&&d.fillText((x*a*r/o).toFixed(2)/1,b.x+5,13)}for(var T=p;T<=f+1;T++){var S=this.imageToViewerElementCoordinates(0,T*a);d.moveTo(0,S.y),d.lineTo(20,S.y);for(var P=1;P<5;P++)d.moveTo(16,S.y+w/5*P),d.lineTo(20,S.y+w/5*P),T!==p&&(d.save(),d.translate(3,S.y+5),d.rotate(Math.PI/2),d.fillText((T*a*r/o).toFixed(0),0,0),d.restore())}d.stroke(),d.beginPath(),d.fillStyle="#fff",d.fillRect(0,0,20,20)}}}])}(St),Lr=i(3237);function zr(t){return zr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zr(t)}function jr(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Br(n.key),n)}}function Br(t){var e=function(t,e){if("object"!=zr(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=zr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==zr(e)?e:e+""}function Fr(t){return function(t){if(Array.isArray(t))return Nr(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Nr(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Nr(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Nr(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}CanvasRenderingContext2D.prototype.clearArc=function(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2*Math.PI;this.beginPath(),this.save(),this.arc(t,e,i,n,r),this.clip(),this.clearRect(t-i,e-i,2*i,2*i),this.restore(),this.closePath()},CanvasRenderingContext2D.prototype.drawArrow=function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:30,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10,r=180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI,o=(r+i)*Math.PI/180,a=(r-i)*Math.PI/180,s=n*Math.cos(o),l=n*Math.sin(o),h=n*Math.cos(a),u=n*Math.sin(a),c=t.x-s,p=e.y-l;this.moveTo(c,p),this.moveTo(t.x,t.y),this.lineTo(e.x,e.y),c=e.x+s,p=e.y+l,this.moveTo(c,p),this.lineTo(e.x,e.y),c=e.x+h,p=e.y+u,this.lineTo(c,p)},CanvasRenderingContext2D.prototype.drawOval=function(t,e,i,n){var r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.save();var o=i>n?i:n,a=i/o,s=n/o;this.scale(a,s),this.moveTo((t+i)/a,e/s),this.arc(t/a,e/s,o,0,2*Math.PI,r),this.closePath(),this.restore()},CanvasRenderingContext2D.prototype.drawPolygon=function(t){for(var e=this,i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=Fr(t),o=0,a=0;a<t.length-1;a++)o+=-.5*(t[a+1].y+t[a].y)*(t[a+1].x-t[a].x);o>0?n&&r.reverse():n||r.reverse(),this.moveTo(r[0].x,r[0].y),r.forEach(function(t){e.lineTo(t.x,t.y)}),i&&this.lineTo(r[0].x,r[0].y)};var Hr=function(t,e,i){return e&&jr(t.prototype,e),i&&jr(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.points=e},[{key:"calculationPoint",value:function(t){var e=this,i=this.points.length-1,n={x:0,y:0};return this.points.forEach(function(r,o){o?(n.x+=e.factorial(i)/e.factorial(o)/e.factorial(i-o)*r.x*Math.pow(1-t,i-o)*Math.pow(t,o),n.y+=e.factorial(i)/e.factorial(o)/e.factorial(i-o)*r.y*Math.pow(1-t,i-o)*Math.pow(t,o)):(n.x+=r.x*Math.pow(1-t,i-o)*Math.pow(t,o),n.y+=r.y*Math.pow(1-t,i-o)*Math.pow(t,o))}),n}},{key:"factorial",value:function(t){return t<=1?1:t*this.factorial(t-1)}}]);CanvasRenderingContext2D.prototype.bezierCurve=function(){if(1===arguments.length){var t=arguments.length<=0?void 0:arguments[0];if(!Array.isArray(t))throw new SyntaxError("parameter error");if(1===t.length||0===t.length)throw new SyntaxError("Parameter length greater than 1");if(2===t.length&&(this.moveTo(t[0].x,t[0].y),this.lineTo(t[1].x,t[1].y),this.stroke()),3===t.length){var e=t[0];this.moveTo(e.x,e.y),this.quadraticCurveTo(t[1].x,t[1].y,t[2].x,t[2].y),this.stroke()}else if(4===t.length){var i=t[0];this.moveTo(i.x,i.y),this.bezierCurveTo(t[1].x,t[1].y,t[2].x,t[2].y,t[3].x,t[3].y),this.stroke()}else for(var n=new Hr(t),r=Fr(new Array(101)).map(function(t,e){return n.calculationPoint(e/100)}),o=1;o<101;o++)this.moveTo(r[o-1].x,r[o-1].y),this.lineTo(r[o].x,r[o].y),this.stroke()}else if(4===arguments.length)this.quadraticCurveTo(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2],arguments.length<=3?void 0:arguments[3]);else{if(6!==arguments.length)throw new SyntaxError("parameter error");this.bezierCurveTo(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2],arguments.length<=3?void 0:arguments[3],arguments.length<=4?void 0:arguments[4],arguments.length<=5?void 0:arguments[5])}},CanvasRenderingContext2D.prototype.drawConfirm=function(){this.save(),this.miterLimit=4,this.scale(.046875,.046875),this.save(),this.beginPath(),this.moveTo(836.266667,311.466667),this.lineTo(806.4,281.59999999999997),this.bezierCurveTo(797.866667,273.06666699999994,785.0666669999999,273.06666699999994,776.533333,281.59999999999997),this.lineTo(435.2,622.933333),this.bezierCurveTo(430.933333,627.1999999999999,430.933333,627.1999999999999,426.66666699999996,622.933333),this.lineTo(264.53333399999997,460.79999999999995),this.bezierCurveTo(256.00000099999994,452.2666669999999,243.20000099999996,452.2666669999999,234.66666699999996,460.79999999999995),this.lineTo(204.79999999999995,490.66666699999996),this.bezierCurveTo(196.26666699999996,499.2,196.26666699999996,511.99999999999994,204.79999999999995,520.533334),this.lineTo(422.4,738.133334),this.bezierCurveTo(426.66666699999996,742.400001,435.2,742.400001,439.466667,738.133334),this.lineTo(836.266667,341.333333),this.bezierCurveTo(844.8,332.8,844.8,320,836.266667,311.466667),this.closePath(),this.fill(),this.stroke(),this.restore(),this.restore()},CanvasRenderingContext2D.prototype.drawCancel=function(){this.save(),this.miterLimit=4,this.scale(.046875,.046875),this.save(),this.beginPath(),this.moveTo(768,307.552),this.lineTo(716.448,256),this.lineTo(512,460.448),this.lineTo(307.552,256),this.lineTo(256,307.552),this.lineTo(460.448,512),this.lineTo(256,716.448),this.lineTo(307.552,768),this.lineTo(512,563.552),this.lineTo(716.448,768),this.lineTo(768,716.448),this.lineTo(563.552,512),this.lineTo(768,307.552),this.closePath(),this.fill(),this.stroke(),this.restore(),this.restore()};var Wr=function(t){var e=Object.prototype.toString;return t instanceof Element?"element":{"[object Boolean]":"boolean","[object Number]":"number","[object String]":"string","[object Function]":"function","[object Array]":"array","[object Date]":"date","[object RegExp]":"regExp","[object Undefined]":"undefined","[object Null]":"null","[object Object]":"object"}[e.call(t)]},Vr=function(t){var e="array"===Wr(t)?[]:{};for(var i in t)t.hasOwnProperty(i)&&(t[i]&&"object"===Wr(t[i])||t[i]&&"array"===Wr(t[i])?e[i]=Vr(t[i]):t[i]&&"date"===Wr(t[i])?e[i]=new Date(t[i].valueOf()):e[i]=t[i]);return e};var Ur="shape",Gr="area",qr="board",Zr="graduation",Xr="rotation",Yr="tailoring",$r="navigator",Kr="cache",Qr="grid";function Jr(t){return Jr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jr(t)}function to(t){return function(t){if(Array.isArray(t))return eo(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return eo(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?eo(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function eo(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function io(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function no(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?io(Object(i),!0).forEach(function(e){ro(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):io(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function ro(t,e,i){return(e=ao(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function oo(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ao(n.key),n)}}function ao(t){var e=function(t,e){if("object"!=Jr(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Jr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Jr(e)?e:e+""}function so(t,e,i){return e=ho(e),function(t,e){if(e&&("object"==Jr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,lo()?Reflect.construct(e,i||[],ho(t).constructor):e.apply(t,i))}function lo(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(lo=function(){return!!t})()}function ho(t){return ho=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ho(t)}function uo(t,e){return uo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},uo(t,e)}var co=function(t){function e(t){var i,n;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),i=so(this,e),!t.el)throw new Error("el must not be null");if(!t.openSeadragonOptions)throw new Error("no openSeadragon options");if("string"===Wr(t.el)&&(i.$el=(n=t.el,document.querySelector(n))),"element"===Wr(t.el)&&(i.$el=t.el),!i.$el)throw new Error("el is not a valid selector string or element object");i.$el.style.position="relative";var a,s,l=i.$el.getBoundingClientRect(),h=l.height,u=l.width;return i.$options=no(no({},t),{},{width:u,height:h}),i.mitt={$on:i.$on,$emit:i.$emit,$off:i.$off,$once:i.$once,key:i.key,eventList:i.eventList},function(t){var e=no(no(no({},{showNavigationControl:!1,navigatorSizeRatio:.25,wrapHorizontal:!1,minScrollDeltaTime:10,zoomPerClick:1,gestureSettingsMouse:{clickToZoom:!1}}),t.$options.openSeadragonOptions),{},{element:t.$el});t.viewer=Q()(e),t.viewer.addHandler("tile-drawing",function(e){if("function"===Wr(t.$options.tileDrawing))t.$options.tileDrawing(e);else{var i=e.context,n=e.rendered,r=e.sourceWidth,o=e.sourceHeight,a=e.position,s=e.size;i.drawImage(n.canvas,0,0,r,o,a.x,a.y,s.x,s.y)}})}(i),function(t){var e=t.$options;Object.values(o).forEach(function(i){var n=i[0].toLocaleUpperCase()+i.substring(1);i===$r?function(t){var e=t.$options;if(e.navigator=e.navigator||{disabled:!1},!0!==e.navigator.disabled){e.navigator.style||(e.navigator.style="bottom: 0;left: 0;");var i=document.createElement("div");i.setAttribute("class","openseadragon-navigator"),i.style.cssText+=e.navigator.style,t.viewer.container.appendChild(i),t.navigator=new vn(no({viewer:t.viewer,containerHeight:e.height,containerWidth:e.width,element:i,scale:e.scale,mitt:t.mitt},e.navigator))}}(t):i===Kr?t.cache=new r[n]:(e[i]=e[i]||{disabled:!1},!0!==e[i].disabled&&(t[i]=new r[n](function(t,e){var i,n,r=t.$options,o=r.pxConversion||{imageCapRes:1,units:[]};return{kv:t,viewer:t.viewer,cache:t.cache,canvas:po(t),options:no(no(no({mitt:t.mitt,scale:r.scale,lang:r.lang,labelDrawing:r.labelDrawing,label:r.label||{},measure:no({backgroundColor:"rgba(0,0,0,.5)",color:"#FFF",fontSize:14,scale:10,defaultShow:!1},r.measure||{})},r[e]),o),{},{units:null!==(i=o.units)&&void 0!==i?i:[null!==(n=o.unit)&&void 0!==n?n:""],thumb:r.thumb?no({radius:5,activeRadius:7,activeBgColor:"#01d0b0"},r.thumb):{radius:5,activeRadius:7,activeBgColor:"#01d0b0"}})}}(t,i))))})}(i),function(t){t.viewer.addHandler("animation",function(){var e;t.change(),null!==(e=t.tailoring)&&void 0!==e&&e.isInTailoring&&t.tailoring.emitTailoringRegion()}),t.viewer.addHandler("canvas-press",function(e){var i,n,r,o;null!==(i=t.board)&&void 0!==i&&i.isInDraw?t.board.onCanvasPress(e.position):null!==(n=t.rotation)&&void 0!==n&&n.isInRotation?t.rotation.onCanvasPress(e.position):null!==(r=t.tailoring)&&void 0!==r&&r.isInTailoring?t.tailoring.onCanvasPress(e.position):null!==(o=t.area)&&void 0!==o&&o.onCanvasPress&&t.area.onCanvasPress(e.position)}),t.viewer.addHandler("canvas-drag",function(e){var i,n,r,o;if(null!==(i=t.board)&&void 0!==i&&i.isInDraw)t.board.onCanvasDrag(e);else if(null!==(n=t.rotation)&&void 0!==n&&n.rotatePoint)e.preventDefaultAction=!0,t.rotation.onCanvasDrag(e.position),t.change();else if((null===(r=t.tailoring)||void 0===r?void 0:r.movePointIndex)>-1)e.preventDefaultAction=!0,t.tailoring.onCanvasDrag(e.position);else if(null!==(o=t.area)&&void 0!==o&&o.movePoint){var a,s;t.area.onCanvasDrag(e.position,e),t.area.change(),null==t||null===(a=t.shape)||void 0===a||null===(s=a.change)||void 0===s||s.call(a)}}),t.viewer.addHandler("canvas-release",function(e){var i,n,r,o;null!==(i=t.board)&&void 0!==i&&i.isInDraw?t.board.onCanvasRelease(e.position):null!==(n=t.rotation)&&void 0!==n&&n.isInRotation?t.rotation.onCanvasRelease(e.position):null!==(r=t.tailoring)&&void 0!==r&&r.isInTailoring?t.tailoring.onCanvasRelease(e.position):null!==(o=t.area)&&void 0!==o&&o.onCanvasRelease&&t.area.onCanvasRelease(e.position)}),t.viewer.addHandler("canvas-key",function(e){var i,n,r,o,a,s,l=e.originalEvent;if(e.preventDefaultAction=t.$options.handleKey?t.$options.handleKey(l.key):(o=l.key,["Escape","Delete","Backspace","z","y"].includes(o)),function(t,e){if("z"===t.key&&t.ctrlKey){if(0===e.cache.currentIndex)return;e.cache.currentIndex--,e.$emit(fi,e.cache.currentIndex)}if("y"===t.key&&t.ctrlKey){if(e.cache.currentIndex===e.cache.cacheList.length-1)return;e.cache.currentIndex++,e.$emit(di,e.cache.currentIndex)}}(l,t),null!==(i=t.board)&&void 0!==i&&i.isInDraw)null===(a=t.board)||void 0===a||null===(s=a.onCanvasKey)||void 0===s||s.call(a,e);else if(null!==(n=t.rotation)&&void 0!==n&&n.isInRotation){var h,u;null===(h=t.rotation)||void 0===h||null===(u=h.onCanvasKey)||void 0===u||u.call(h,e)}else if(null!==(r=t.tailoring)&&void 0!==r&&r.isInTailoring){var c,p;null===(c=t.tailoring)||void 0===c||null===(p=c.onCanvasKey)||void 0===p||p.call(c,e)}else{var f,d,v,g;!function(t,e){var i=e.labelList.findIndex(function(t){return t.select}),n=e.labelList[i];if("h"===t.key){if(!n)return;n.show=!1,e.$emit(vi,n)}else if("Delete"===t.key||"Backspace"===t.key){var r,o,a;if(!n)return;if((null===(r=e.area)||void 0===r||null===(o=r.movePoint)||void 0===o||null===(a=o.label)||void 0===a?void 0:a.tool)===rt){var s=e.area.movePoint;s.label.points.splice(s.position,1),0===s.label.points.length?(e.$emit(gi,n),e.labelList.splice(i,1)):e.$emit(yi,s.label),e.area.movePoint=void 0}else e.$emit(gi,n),e.labelList.splice(i,1)}else"Escape"===t.key&&(n&&e.$emit(ci,n),e.labelList.forEach(function(t){t.select=!1,t.show=!0}))}(l,t),null===(f=t.area)||void 0===f||null===(d=f.change)||void 0===d||d.call(f,e),null===(v=t.shape)||void 0===v||null===(g=v.change)||void 0===g||g.call(v,e)}}),t.viewer.addHandler("canvas-double-click",function(e){var i,n;if(null!==(i=t.board)&&void 0!==i&&i.isInDraw)t.board.onCanvasDblClick(e.position);else if(null!==(n=t.tailoring)&&void 0!==n&&n.isInTailoring){var r,o;null===(r=t.tailoring)||void 0===r||null===(o=r.onCanvasDblClick)||void 0===o||o.call(r,e.position)}else{var a,s;null===(a=t.area)||void 0===a||null===(s=a.onCanvasDblClick)||void 0===s||s.call(a,e.position)}}),t.viewer.addHandler("resize",function(e){var i=e.newContainerSize,n=i.x,r=i.y;t.resizeViewContainer({width:n,height:r})}),t.$on("mousemove",function(e){var i;null!==(i=t.board)&&void 0!==i&&i.isInDraw&&t.board.onCanvasMove(e)},!0,t.$el);var e,i=!1;t.viewer.addHandler("canvas-contextmenu",function(e){var i;null!==(i=t.board)&&void 0!==i&&i.isInDraw&&(e.preventDefault=!0)}),t.viewer.addHandler("canvas-nonprimary-press",function(t){2===t.button&&(i=!0),e=t.position.clone()}),t.viewer.addHandler("canvas-nonprimary-release",function(t){2===t.button&&(i=!1)}),new(Q().MouseTracker)({element:t.viewer.canvas,moveHandler:function(n){var r,o;if(i&&null!==(r=t.board)&&void 0!==r&&r.isInDraw){if(2!==n.buttons)return void(i=!1);var a=n.position.minus(e);e=n.position.clone(),t.viewer.viewport.panBy(t.viewer.viewport.deltaPointsFromPixels(a.negate()))}else null!==(o=t.area)&&void 0!==o&&o.onCanvasMove&&t.area.onCanvasMove(n.position)}})}(i),i.initLabelList(t.labelList||[]),i.resizeViewContainer(i.$options),t.showZrender&&(a=i,(s=document.createElement("div")).setAttribute("id","openseadragon-zrender"),s.style.cssText+="position:absolute;bottom: 0;left:0;width:100%;height:100%;z-index:0",a.viewer.canvas.appendChild(s),a.zViewer=Lr.init(s,{renderer:"canvas"}),a.zApi=Lr,a.openSeadragon=Q(),a.viewer.addHandler("open",function(){a.$emit(bi)}),a.viewer.addHandler("update-viewport",function(){a.$emit(_i)})),i}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&uo(t,e)}(e,t),function(t,e,i){return e&&oo(t.prototype,e),i&&oo(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"initLabelList",value:function(t){var e,i,n,r,o,a;this.labelList=t.map(function(t){return new sr(no(no({},t),{},{region:t.region||y(t.points),__data__:Vr(t)}))}),null===(e=this.board)||void 0===e||null===(i=e.setLabelList)||void 0===i||i.call(e,this.labelList),null===(n=this.shape)||void 0===n||null===(r=n.setLabelList)||void 0===r||r.call(n,this.labelList),null===(o=this.area)||void 0===o||null===(a=o.setLabelList)||void 0===a||a.call(o,this.labelList)}},{key:"appendLabelList",value:function(t){var e,i,n,r,o,a;this.labelList=[].concat(to(this.labelList),to(t.map(function(t){return new sr(no(no({},t),{},{region:t.region||y(t.points),__data__:Vr(t)}))}))),null===(e=this.board)||void 0===e||null===(i=e.setLabelList)||void 0===i||i.call(e,this.labelList),null===(n=this.shape)||void 0===n||null===(r=n.setLabelList)||void 0===r||r.call(n,this.labelList),null===(o=this.area)||void 0===o||null===(a=o.setLabelList)||void 0===a||a.call(o,this.labelList)}},{key:"resizeViewContainer",value:function(t){var e=this,i=t.width,n=t.height;this.$options.width=i,this.$options.height=n,Object.values(o).forEach(function(t){var r;null!==(r=e[t])&&void 0!==r&&r.resetCanvasSize&&e[t].resetCanvasSize({width:i,height:n})})}},{key:"change",value:function(){var t=this;Object.values(o).forEach(function(e){var i;null!==(i=t[e])&&void 0!==i&&i.change&&t[e].change()})}},{key:"destroy",value:function(){var t,e,i=this;this.$off(),null===(t=this.viewer)||void 0===t||null===(e=t.destroy)||void 0===e||e.call(t),this.viewer=void 0,this.$el=void 0,Object.values(o).forEach(function(t){var e,n;null===(e=i[t])||void 0===e||null===(n=e.destroy)||void 0===n||n.call(e),i[t]=void 0})}}])}(Oi);function po(t){var e=t.$options,i=document.createElement("canvas");return i.style.cssText="position: absolute; top: 0;\n left: 0; width: 100%; height: 100%;",i.width=e.width,i.height=e.height,t.viewer.canvas.appendChild(i),i}co.marks={},vt.forEach(function(t){co.marks[t.toLocaleUpperCase()]=t}),co.events=no({},t)}(),module.exports=n}();