text: var PAPAYA_BUILD_NUM="1430",papayaLoadableImages=[];
  (function(b,a){function c(b){var a=b.length,c=n.type(b);return n.isWindow(b)?!1:1===b.nodeType&&a?!0:"array"===c||"function"!==c&&(0===a||"number"===typeof a&&0<a&&a-1 in b)}function d(b){var a=Sa[b]={};n.each(b.match(Z)||[],function(b,c){a[c]=!0});return a}function e(b,c,e,d){if(n.acceptData(b)){var f=n.expando,h="string"===typeof c,k=b.nodeType,r=k?n.cache:b,g=k?b[f]:b[f]&&f;if(g&&r[g]&&(d||r[g].data)||!h||e!==a){g||(k?b[f]=g=la.pop()||n.guid++:g=f);r[g]||(r[g]={},k||(r[g].toJSON=n.noop));if("object"===
  typeof c||"function"===typeof c)d?r[g]=n.extend(r[g],c):r[g].data=n.extend(r[g].data,c);b=r[g];d||(b.data||(b.data={}),b=b.data);e!==a&&(b[n.camelCase(c)]=e);h?(e=b[c],null==e&&(e=b[n.camelCase(c)])):e=b;return e}}}function f(b,a,c){if(n.acceptData(b)){var e,d,f,h=b.nodeType,k=h?n.cache:b,r=h?b[n.expando]:n.expando;if(k[r]){if(a&&(f=c?k[r]:k[r].data)){n.isArray(a)?a=a.concat(n.map(a,n.camelCase)):a in f?a=[a]:(a=n.camelCase(a),a=a in f?[a]:a.split(" "));e=0;for(d=a.length;e<d;e++)delete f[a[e]];if(!(c?
  g:n.isEmptyObject)(f))return}if(!c&&(delete k[r].data,!g(k[r])))return;h?n.cleanData([b],!0):n.support.deleteExpando||k!=k.window?delete k[r]:k[r]=null}}}function h(b,c,e){if(e===a&&1===b.nodeType)if(e="data-"+c.replace(rb,"-$1").toLowerCase(),e=b.getAttribute(e),"string"===typeof e){try{e="true"===e?!0:"false"===e?!1:"null"===e?null:+e+""===e?+e:sb.test(e)?n.parseJSON(e):e}catch(d){}n.data(b,c,e)}else e=a;return e}function g(b){for(var a in b)if(("data"!==a||!n.isEmptyObject(b[a]))&&"toJSON"!==a)return!1;
  return!0}function m(){return!0}function l(){return!1}function q(b,a){do b=b[a];while(b&&1!==b.nodeType);return b}function u(b,a,c){a=a||0;if(n.isFunction(a))return n.grep(b,function(b,e){return!!a.call(b,e,b)===c});if(a.nodeType)return n.grep(b,function(b){return b===a===c});if("string"===typeof a){var e=n.grep(b,function(b){return 1===b.nodeType});if(tb.test(a))return n.filter(a,e,!c);a=n.filter(a,e)}return n.grep(b,function(b){return 0<=n.inArray(b,a)===c})}function w(b){var a=Ta.split("|");b=b.createDocumentFragment();
  if(b.createElement)for(;a.length;)b.createElement(a.pop());return b}function C(b,a){return b.getElementsByTagName(a)[0]||b.appendChild(b.ownerDocument.createElement(a))}function B(b){var a=b.getAttributeNode("type");b.type=(a&&a.specified)+"/"+b.type;return b}function A(b){var a=ub.exec(b.type);a?b.type=a[1]:b.removeAttribute("type");return b}function E(b,a){for(var c,e=0;null!=(c=b[e]);e++)n._data(c,"globalEval",!a||n._data(a[e],"globalEval"))}function D(b,a){if(1===a.nodeType&&n.hasData(b)){var c,
  e,d;e=n._data(b);var f=n._data(a,e),h=e.events;if(h)for(c in delete f.handle,f.events={},h)for(e=0,d=h[c].length;e<d;e++)n.event.add(a,c,h[c][e]);f.data&&(f.data=n.extend({},f.data))}}function z(b,c){var e,d,f=0,h=typeof b.getElementsByTagName!==V?b.getElementsByTagName(c||"*"):typeof b.querySelectorAll!==V?b.querySelectorAll(c||"*"):a;if(!h)for(h=[],e=b.childNodes||b;null!=(d=e[f]);f++)!c||n.nodeName(d,c)?h.push(d):n.merge(h,z(d,c));return c===a||c&&n.nodeName(b,c)?n.merge([b],h):h}function M(b){Ea.test(b.type)&&
  (b.defaultChecked=b.checked)}function r(b,a){if(a in b)return a;for(var c=a.charAt(0).toUpperCase()+a.slice(1),e=a,d=Ua.length;d--;)if(a=Ua[d]+c,a in b)return a;return e}function K(b,a){b=a||b;return"none"===n.css(b,"display")||!n.contains(b.ownerDocument,b)}function N(b,a){for(var c,e,d,f=[],h=0,k=b.length;h<k;h++)e=b[h],e.style&&(f[h]=n._data(e,"olddisplay"),c=e.style.display,a?(f[h]||"none"!==c||(e.style.display=""),""===e.style.display&&K(e)&&(f[h]=n._data(e,"olddisplay",t(e.nodeName)))):f[h]||
  (d=K(e),(c&&"none"!==c||!d)&&n._data(e,"olddisplay",d?c:n.css(e,"display"))));for(h=0;h<k;h++)e=b[h],!e.style||a&&"none"!==e.style.display&&""!==e.style.display||(e.style.display=a?f[h]||"":"none");return b}function G(b,a,c){return(b=vb.exec(a))?Math.max(0,b[1]-(c||0))+(b[2]||"px"):a}function x(b,a,c,e,d){a=c===(e?"border":"content")?4:"width"===a?1:0;for(var f=0;4>a;a+=2)"margin"===c&&(f+=n.css(b,c+Y[a],!0,d)),e?("content"===c&&(f-=n.css(b,"padding"+Y[a],!0,d)),"margin"!==c&&(f-=n.css(b,"border"+
  Y[a]+"Width",!0,d))):(f+=n.css(b,"padding"+Y[a],!0,d),"padding"!==c&&(f+=n.css(b,"border"+Y[a]+"Width",!0,d)));return f}function F(b,a,c){var e=!0,d="width"===a?b.offsetWidth:b.offsetHeight,f=aa(b),h=n.support.boxSizing&&"border-box"===n.css(b,"boxSizing",!1,f);if(0>=d||null==d){d=fa(b,a,f);if(0>d||null==d)d=b.style[a];if(za.test(d))return d;e=h&&(n.support.boxSizingReliable||d===b.style[a]);d=parseFloat(d)||0}return d+x(b,a,c||(h?"border":"content"),e,f)+"px"}function t(b){var a=R,c=Va[b];c||(c=
  k(b,a),"none"!==c&&c||(ta=(ta||n("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(a.documentElement),a=(ta[0].contentWindow||ta[0].contentDocument).document,a.write("<!doctype html><html><body>"),a.close(),c=k(b,a),ta.detach()),Va[b]=c);return c}function k(b,a){var c=n(a.createElement(b)).appendTo(a.body),e=n.css(c[0],"display");c.remove();return e}function p(b,a,c,e){var d;if(n.isArray(a))n.each(a,function(a,d){c||wb.test(b)?e(b,d):p(b+"["+("object"===
  typeof d?a:"")+"]",d,c,e)});else if(c||"object"!==n.type(a))e(b,a);else for(d in a)p(b+"["+d+"]",a[d],c,e)}function J(b){return function(a,c){"string"!==typeof a&&(c=a,a="*");var e,d=0,f=a.toLowerCase().match(Z)||[];if(n.isFunction(c))for(;e=f[d++];)"+"===e[0]?(e=e.slice(1)||"*",(b[e]=b[e]||[]).unshift(c)):(b[e]=b[e]||[]).push(c)}}function I(b,a,c,e){function d(k){var r;f[k]=!0;n.each(b[k]||[],function(b,k){var ua=k(a,c,e);if("string"===typeof ua&&!h&&!f[ua])return a.dataTypes.unshift(ua),d(ua),!1;
  if(h)return!(r=ua)});return r}var f={},h=b===Fa;return d(a.dataTypes[0])||!f["*"]&&d("*")}function v(b,c){var e,d,f=n.ajaxSettings.flatOptions||{};for(d in c)c[d]!==a&&((f[d]?b:e||(e={}))[d]=c[d]);e&&n.extend(!0,b,e);return b}function y(){try{return new b.XMLHttpRequest}catch(a){}}function O(){setTimeout(function(){ma=a});return ma=n.now()}function H(b,a){n.each(a,function(a,c){for(var e=(va[a]||[]).concat(va["*"]),d=0,f=e.length;d<f&&!e[d].call(b,a,c);d++);})}function S(b,a,c){var e,d=0,f=Aa.length,
  h=n.Deferred().always(function(){delete k.elem}),k=function(){if(e)return!1;for(var a=ma||O(),a=Math.max(0,r.startTime+r.duration-a),c=1-(a/r.duration||0),d=0,f=r.tweens.length;d<f;d++)r.tweens[d].run(c);h.notifyWith(b,[r,c,a]);if(1>c&&f)return a;h.resolveWith(b,[r]);return!1},r=h.promise({elem:b,props:n.extend({},a),opts:n.extend(!0,{specialEasing:{}},c),originalProperties:a,originalOptions:c,startTime:ma||O(),duration:c.duration,tweens:[],createTween:function(a,c){var e=n.Tween(b,r.opts,a,c,r.opts.specialEasing[a]||
  r.opts.easing);r.tweens.push(e);return e},stop:function(a){var c=0,d=a?r.tweens.length:0;if(e)return this;for(e=!0;c<d;c++)r.tweens[c].run(1);a?h.resolveWith(b,[r,a]):h.rejectWith(b,[r,a]);return this}});c=r.props;for(T(c,r.opts.specialEasing);d<f;d++)if(a=Aa[d].call(r,b,c,r.opts))return a;H(r,c);n.isFunction(r.opts.start)&&r.opts.start.call(b,r);n.fx.timer(n.extend(k,{elem:b,anim:r,queue:r.opts.queue}));return r.progress(r.opts.progress).done(r.opts.done,r.opts.complete).fail(r.opts.fail).always(r.opts.always)}
  function T(b,a){var c,e,d,f,h;for(d in b)if(e=n.camelCase(d),f=a[e],c=b[d],n.isArray(c)&&(f=c[1],c=b[d]=c[0]),d!==e&&(b[e]=c,delete b[d]),(h=n.cssHooks[e])&&"expand"in h)for(d in c=h.expand(c),delete b[e],c)d in b||(b[d]=c[d],a[d]=f);else a[e]=f}function P(b,a,c,e,d){return new P.prototype.init(b,a,c,e,d)}function Q(b,a){var c,e={height:b},d=0;for(a=a?1:0;4>d;d+=2-a)c=Y[d],e["margin"+c]=e["padding"+c]=b;a&&(e.opacity=e.width=b);return e}function U(b){return n.isWindow(b)?b:9===b.nodeType?b.defaultView||
  b.parentWindow:!1}var ga,L,V=typeof a,R=b.document,Ba=b.location,W=b.jQuery,ha=b.$,ba={},la=[],ia=la.concat,ra=la.push,ca=la.slice,sa=la.indexOf,wa=ba.toString,xa=ba.hasOwnProperty,Ga="1.9.1".trim,n=function(b,a){return new n.fn.init(b,a,L)},Ca=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,Z=/\S+/g,xb=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,yb=/^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,Wa=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,zb=/^[\],:{}\s]*$/,Ab=/(?:^|:|,)(?:\s*\[)+/g,Bb=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,Cb=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,
  Db=/^-ms-/,Eb=/-([\da-z])/gi,Fb=function(b,a){return a.toUpperCase()},da=function(b){if(R.addEventListener||"load"===b.type||"complete"===R.readyState)Xa(),n.ready()},Xa=function(){R.addEventListener?(R.removeEventListener("DOMContentLoaded",da,!1),b.removeEventListener("load",da,!1)):(R.detachEvent("onreadystatechange",da),b.detachEvent("onload",da))};n.fn=n.prototype={jquery:"1.9.1",constructor:n,init:function(b,c,e){var d;if(!b)return this;if("string"===typeof b){d="<"===b.charAt(0)&&">"===b.charAt(b.length-
  1)&&3<=b.length?[null,b,null]:yb.exec(b);if(!d||!d[1]&&c)return!c||c.jquery?(c||e).find(b):this.constructor(c).find(b);if(d[1]){if(c=c instanceof n?c[0]:c,n.merge(this,n.parseHTML(d[1],c&&c.nodeType?c.ownerDocument||c:R,!0)),Wa.test(d[1])&&n.isPlainObject(c))for(d in c)if(n.isFunction(this[d]))this[d](c[d]);else this.attr(d,c[d])}else{if((c=R.getElementById(d[2]))&&c.parentNode){if(c.id!==d[2])return e.find(b);this.length=1;this[0]=c}this.context=R;this.selector=b}return this}if(b.nodeType)return this.context=
  this[0]=b,this.length=1,this;if(n.isFunction(b))return e.ready(b);b.selector!==a&&(this.selector=b.selector,this.context=b.context);return n.makeArray(b,this)},selector:"",length:0,size:function(){return this.length},toArray:function(){return ca.call(this)},get:function(b){return null==b?this.toArray():0>b?this[this.length+b]:this[b]},pushStack:function(b){b=n.merge(this.constructor(),b);b.prevObject=this;b.context=this.context;return b},each:function(b,a){return n.each(this,b,a)},ready:function(b){n.ready.promise().done(b);
  return this},slice:function(){return this.pushStack(ca.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(b){var a=this.length;b=+b+(0>b?a:0);return this.pushStack(0<=b&&b<a?[this[b]]:[])},map:function(b){return this.pushStack(n.map(this,function(a,c){return b.call(a,c,a)}))},end:function(){return this.prevObject||this.constructor(null)},push:ra,sort:[].sort,splice:[].splice};n.fn.init.prototype=n.fn;n.extend=n.fn.extend=function(){var b,c,
  e,d,f,h=arguments[0]||{},r=1,k=arguments.length,g=!1;"boolean"===typeof h&&(g=h,h=arguments[1]||{},r=2);"object"===typeof h||n.isFunction(h)||(h={});k===r&&(h=this,--r);for(;r<k;r++)if(null!=(f=arguments[r]))for(d in f)b=h[d],e=f[d],h!==e&&(g&&e&&(n.isPlainObject(e)||(c=n.isArray(e)))?(c?(c=!1,b=b&&n.isArray(b)?b:[]):b=b&&n.isPlainObject(b)?b:{},h[d]=n.extend(g,b,e)):e!==a&&(h[d]=e));return h};n.extend({noConflict:function(a){b.$===n&&(b.$=ha);a&&b.jQuery===n&&(b.jQuery=W);return n},isReady:!1,readyWait:1,
  holdReady:function(b){b?n.readyWait++:n.ready(!0)},ready:function(b){if(!0===b?!--n.readyWait:!n.isReady){if(!R.body)return setTimeout(n.ready);n.isReady=!0;!0!==b&&0<--n.readyWait||(ga.resolveWith(R,[n]),n.fn.trigger&&n(R).trigger("ready").off("ready"))}},isFunction:function(b){return"function"===n.type(b)},isArray:Array.isArray||function(b){return"array"===n.type(b)},isWindow:function(b){return null!=b&&b==b.window},isNumeric:function(b){return!isNaN(parseFloat(b))&&isFinite(b)},type:function(b){return null==
  b?String(b):"object"===typeof b||"function"===typeof b?ba[wa.call(b)]||"object":typeof b},isPlainObject:function(b){if(!b||"object"!==n.type(b)||b.nodeType||n.isWindow(b))return!1;try{if(b.constructor&&!xa.call(b,"constructor")&&!xa.call(b.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}for(var e in b);return e===a||xa.call(b,e)},isEmptyObject:function(b){for(var a in b)return!1;return!0},error:function(b){throw Error(b);},parseHTML:function(b,a,c){if(!b||"string"!==typeof b)return null;
  "boolean"===typeof a&&(c=a,a=!1);a=a||R;var e=Wa.exec(b);c=!c&&[];if(e)return[a.createElement(e[1])];e=n.buildFragment([b],a,c);c&&n(c).remove();return n.merge([],e.childNodes)},parseJSON:function(a){if(b.JSON&&b.JSON.parse)return b.JSON.parse(a);if(null===a)return a;if("string"===typeof a&&(a=n.trim(a))&&zb.test(a.replace(Bb,"@").replace(Cb,"]").replace(Ab,"")))return(new Function("return "+a))();n.error("Invalid JSON: "+a)},parseXML:function(c){var e,d;if(!c||"string"!==typeof c)return null;try{b.DOMParser?
  (d=new DOMParser,e=d.parseFromString(c,"text/xml")):(e=new ActiveXObject("Microsoft.XMLDOM"),e.async="false",e.loadXML(c))}catch(f){e=a}e&&e.documentElement&&!e.getElementsByTagName("parsererror").length||n.error("Invalid XML: "+c);return e},noop:function(){},globalEval:function(a){a&&n.trim(a)&&(b.execScript||function(a){b.eval.call(b,a)})(a)},camelCase:function(b){return b.replace(Db,"ms-").replace(Eb,Fb)},nodeName:function(b,a){return b.nodeName&&b.nodeName.toLowerCase()===a.toLowerCase()},each:function(b,
  a,e){var d,f=0,h=b.length;d=c(b);if(e)if(d)for(;f<h&&(d=a.apply(b[f],e),!1!==d);f++);else for(f in b){if(d=a.apply(b[f],e),!1===d)break}else if(d)for(;f<h&&(d=a.call(b[f],f,b[f]),!1!==d);f++);else for(f in b)if(d=a.call(b[f],f,b[f]),!1===d)break;return b},trim:Ga&&!Ga.call("\ufeff\u00a0")?function(b){return null==b?"":Ga.call(b)}:function(b){return null==b?"":(b+"").replace(xb,"")},makeArray:function(b,a){var e=a||[];null!=b&&(c(Object(b))?n.merge(e,"string"===typeof b?[b]:b):ra.call(e,b));return e},
  inArray:function(b,a,c){var e;if(a){if(sa)return sa.call(a,b,c);e=a.length;for(c=c?0>c?Math.max(0,e+c):c:0;c<e;c++)if(c in a&&a[c]===b)return c}return-1},merge:function(b,c){var e=c.length,d=b.length,f=0;if("number"===typeof e)for(;f<e;f++)b[d++]=c[f];else for(;c[f]!==a;)b[d++]=c[f++];b.length=d;return b},grep:function(b,a,c){var e,d=[],f=0,h=b.length;for(c=!!c;f<h;f++)e=!!a(b[f],f),c!==e&&d.push(b[f]);return d},map:function(b,a,e){var d,f=0,h=b.length,r=[];if(c(b))for(;f<h;f++)d=a(b[f],f,e),null!=
  d&&(r[r.length]=d);else for(f in b)d=a(b[f],f,e),null!=d&&(r[r.length]=d);return ia.apply([],r)},guid:1,proxy:function(b,c){var e,d;"string"===typeof c&&(d=b[c],c=b,b=d);if(!n.isFunction(b))return a;e=ca.call(arguments,2);d=function(){return b.apply(c||this,e.concat(ca.call(arguments)))};d.guid=b.guid=b.guid||n.guid++;return d},access:function(b,c,e,d,f,h,r){var k=0,g=b.length,m=null==e;if("object"===n.type(e))for(k in f=!0,e)n.access(b,c,k,e[k],!0,h,r);else if(d!==a&&(f=!0,n.isFunction(d)||(r=!0),
  m&&(r?(c.call(b,d),c=null):(m=c,c=function(b,a,c){return m.call(n(b),c)})),c))for(;k<g;k++)c(b[k],e,r?d:d.call(b[k],k,c(b[k],e)));return f?b:m?c.call(b):g?c(b[0],e):h},now:function(){return(new Date).getTime()}});n.ready.promise=function(a){if(!ga)if(ga=n.Deferred(),"complete"===R.readyState)setTimeout(n.ready);else if(R.addEventListener)R.addEventListener("DOMContentLoaded",da,!1),b.addEventListener("load",da,!1);else{R.attachEvent("onreadystatechange",da);b.attachEvent("onload",da);var c=!1;try{c=
  null==b.frameElement&&R.documentElement}catch(e){}c&&c.doScroll&&function qb(){if(!n.isReady){try{c.doScroll("left")}catch(b){return setTimeout(qb,50)}Xa();n.ready()}}()}return ga.promise(a)};n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(b,a){ba["[object "+a+"]"]=a.toLowerCase()});L=n(R);var Sa={};n.Callbacks=function(b){b="string"===typeof b?Sa[b]||d(b):n.extend({},b);var c,e,f,h,r,k,g=[],m=!b.once&&[],y=function(a){e=b.memory&&a;f=!0;r=k||0;k=0;h=g.length;
  for(c=!0;g&&r<h;r++)if(!1===g[r].apply(a[0],a[1])&&b.stopOnFalse){e=!1;break}c=!1;g&&(m?m.length&&y(m.shift()):e?g=[]:t.disable())},t={add:function(){if(g){var a=g.length;(function Gb(a){n.each(a,function(a,c){var e=n.type(c);"function"===e?b.unique&&t.has(c)||g.push(c):c&&c.length&&"string"!==e&&Gb(c)})})(arguments);c?h=g.length:e&&(k=a,y(e))}return this},remove:function(){g&&n.each(arguments,function(b,a){for(var e;-1<(e=n.inArray(a,g,e));)g.splice(e,1),c&&(e<=h&&h--,e<=r&&r--)});return this},has:function(b){return b?
  -1<n.inArray(b,g):!(!g||!g.length)},empty:function(){g=[];return this},disable:function(){g=m=e=a;return this},disabled:function(){return!g},lock:function(){m=a;e||t.disable();return this},locked:function(){return!m},fireWith:function(b,a){a=a||[];a=[b,a.slice?a.slice():a];!g||f&&!m||(c?m.push(a):y(a));return this},fire:function(){t.fireWith(this,arguments);return this},fired:function(){return!!f}};return t};n.extend({Deferred:function(b){var a=[["resolve","done",n.Callbacks("once memory"),"resolved"],
  ["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",e={state:function(){return c},always:function(){d.done(arguments).fail(arguments);return this},then:function(){var b=arguments;return n.Deferred(function(c){n.each(a,function(a,f){var h=f[0],r=n.isFunction(b[a])&&b[a];d[f[1]](function(){var b=r&&r.apply(this,arguments);if(b&&n.isFunction(b.promise))b.promise().done(c.resolve).fail(c.reject).progress(c.notify);else c[h+"With"](this===e?
  c.promise():this,r?[b]:arguments)})});b=null}).promise()},promise:function(b){return null!=b?n.extend(b,e):e}},d={};e.pipe=e.then;n.each(a,function(b,f){var h=f[2],r=f[3];e[f[1]]=h.add;r&&h.add(function(){c=r},a[b^1][2].disable,a[2][2].lock);d[f[0]]=function(){d[f[0]+"With"](this===d?e:this,arguments);return this};d[f[0]+"With"]=h.fireWith});e.promise(d);b&&b.call(d,d);return d},when:function(b){var a=0,c=ca.call(arguments),e=c.length,d=1!==e||b&&n.isFunction(b.promise)?e:0,f=1===d?b:n.Deferred(),
  h=function(b,a,c){return function(e){a[b]=this;c[b]=1<arguments.length?ca.call(arguments):e;c===r?f.notifyWith(a,c):--d||f.resolveWith(a,c)}},r,k,g;if(1<e)for(r=Array(e),k=Array(e),g=Array(e);a<e;a++)c[a]&&n.isFunction(c[a].promise)?c[a].promise().done(h(a,g,c)).fail(f.reject).progress(h(a,k,r)):--d;d||f.resolveWith(g,c);return f.promise()}});n.support=function(){var a,c,e,d,f,h,r,k=R.createElement("div");k.setAttribute("className","t");k.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
  c=k.getElementsByTagName("*");e=k.getElementsByTagName("a")[0];if(!c||!e||!c.length)return{};d=R.createElement("select");f=d.appendChild(R.createElement("option"));c=k.getElementsByTagName("input")[0];e.style.cssText="top:1px;float:left;opacity:.5";a={getSetAttribute:"t"!==k.className,leadingWhitespace:3===k.firstChild.nodeType,tbody:!k.getElementsByTagName("tbody").length,htmlSerialize:!!k.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:"/a"===e.getAttribute("href"),
  opacity:/^0.5/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:!!c.value,optSelected:f.selected,enctype:!!R.createElement("form").enctype,html5Clone:"<:nav></:nav>"!==R.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"===R.compatMode,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1};c.checked=!0;a.noCloneChecked=c.cloneNode(!0).checked;d.disabled=!0;a.optDisabled=!f.disabled;try{delete k.test}catch(g){a.deleteExpando=
  !1}c=R.createElement("input");c.setAttribute("value","");a.input=""===c.getAttribute("value");c.value="t";c.setAttribute("type","radio");a.radioValue="t"===c.value;c.setAttribute("checked","t");c.setAttribute("name","t");e=R.createDocumentFragment();e.appendChild(c);a.appendChecked=c.checked;a.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked;k.attachEvent&&(k.attachEvent("onclick",function(){a.noCloneEvent=!1}),k.cloneNode(!0).click());for(r in{submit:!0,change:!0,focusin:!0})k.setAttribute(e=
  "on"+r,"t"),a[r+"Bubbles"]=e in b||!1===k.attributes[e].expando;k.style.backgroundClip="content-box";k.cloneNode(!0).style.backgroundClip="";a.clearCloneStyle="content-box"===k.style.backgroundClip;n(function(){var c,e,d=R.getElementsByTagName("body")[0];d&&(c=R.createElement("div"),c.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",d.appendChild(c).appendChild(k),k.innerHTML="<table><tr><td></td><td>t</td></tr></table>",e=k.getElementsByTagName("td"),
  e[0].style.cssText="padding:0;margin:0;border:0;display:none",h=0===e[0].offsetHeight,e[0].style.display="",e[1].style.display="none",a.reliableHiddenOffsets=h&&0===e[0].offsetHeight,k.innerHTML="",k.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",a.boxSizing=4===k.offsetWidth,a.doesNotIncludeMarginInBodyOffset=1!==d.offsetTop,b.getComputedStyle&&(a.pixelPosition="1%"!==
  (b.getComputedStyle(k,null)||{}).top,a.boxSizingReliable="4px"===(b.getComputedStyle(k,null)||{width:"4px"}).width,e=k.appendChild(R.createElement("div")),e.style.cssText=k.style.cssText="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",e.style.marginRight=e.style.width="0",k.style.width="1px",a.reliableMarginRight=!parseFloat((b.getComputedStyle(e,null)||{}).marginRight)),typeof k.style.zoom!==V&&(k.innerHTML="",k.style.cssText=
  "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;width:1px;padding:1px;display:inline;zoom:1",a.inlineBlockNeedsLayout=3===k.offsetWidth,k.style.display="block",k.innerHTML="<div></div>",k.firstChild.style.width="5px",a.shrinkWrapBlocks=3!==k.offsetWidth,a.inlineBlockNeedsLayout&&(d.style.zoom=1)),d.removeChild(c),k=null)});c=d=e=f=e=c=null;return a}();var sb=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,rb=/([A-Z])/g;n.extend({cache:{},
  expando:"jQuery"+("1.9.1"+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(b){b=b.nodeType?n.cache[b[n.expando]]:b[n.expando];return!!b&&!g(b)},data:function(b,a,c){return e(b,a,c)},removeData:function(b,a){return f(b,a)},_data:function(b,a,c){return e(b,a,c,!0)},_removeData:function(b,a){return f(b,a,!0)},acceptData:function(b){if(b.nodeType&&1!==b.nodeType&&9!==b.nodeType)return!1;var a=b.nodeName&&n.noData[b.nodeName.toLowerCase()];
  return!a||!0!==a&&b.getAttribute("classid")===a}});n.fn.extend({data:function(b,c){var e,d,f=this[0],k=0,r=null;if(b===a){if(this.length&&(r=n.data(f),1===f.nodeType&&!n._data(f,"parsedAttrs"))){for(e=f.attributes;k<e.length;k++)d=e[k].name,d.indexOf("data-")||(d=n.camelCase(d.slice(5)),h(f,d,r[d]));n._data(f,"parsedAttrs",!0)}return r}return"object"===typeof b?this.each(function(){n.data(this,b)}):n.access(this,function(c){if(c===a)return f?h(f,b,n.data(f,b)):null;this.each(function(){n.data(this,
  b,c)})},null,c,1<arguments.length,null,!0)},removeData:function(b){return this.each(function(){n.removeData(this,b)})}});n.extend({queue:function(b,a,c){var e;if(b)return a=(a||"fx")+"queue",e=n._data(b,a),c&&(!e||n.isArray(c)?e=n._data(b,a,n.makeArray(c)):e.push(c)),e||[]},dequeue:function(b,a){a=a||"fx";var c=n.queue(b,a),e=c.length,d=c.shift(),f=n._queueHooks(b,a),h=function(){n.dequeue(b,a)};"inprogress"===d&&(d=c.shift(),e--);if(f.cur=d)"fx"===a&&c.unshift("inprogress"),delete f.stop,d.call(b,
  h,f);!e&&f&&f.empty.fire()},_queueHooks:function(b,a){var c=a+"queueHooks";return n._data(b,c)||n._data(b,c,{empty:n.Callbacks("once memory").add(function(){n._removeData(b,a+"queue");n._removeData(b,c)})})}});n.fn.extend({queue:function(b,c){var e=2;"string"!==typeof b&&(c=b,b="fx",e--);return arguments.length<e?n.queue(this[0],b):c===a?this:this.each(function(){var a=n.queue(this,b,c);n._queueHooks(this,b);"fx"===b&&"inprogress"!==a[0]&&n.dequeue(this,b)})},dequeue:function(b){return this.each(function(){n.dequeue(this,
  b)})},delay:function(b,a){b=n.fx?n.fx.speeds[b]||b:b;return this.queue(a||"fx",function(a,c){var e=setTimeout(a,b);c.stop=function(){clearTimeout(e)}})},clearQueue:function(b){return this.queue(b||"fx",[])},promise:function(b,c){var e,d=1,f=n.Deferred(),h=this,k=this.length,r=function(){--d||f.resolveWith(h,[h])};"string"!==typeof b&&(c=b,b=a);for(b=b||"fx";k--;)(e=n._data(h[k],b+"queueHooks"))&&e.empty&&(d++,e.empty.add(r));r();return f.promise(c)}});var na,Ya,Ha=/[\t\r\n]/g,Hb=/\r/g,Ib=/^(?:input|select|textarea|button|object)$/i,
  Jb=/^(?:a|area)$/i,Za=/^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,Ia=/^(?:checked|selected)$/i,ja=n.support.getSetAttribute,Ja=n.support.input;n.fn.extend({attr:function(b,a){return n.access(this,n.attr,b,a,1<arguments.length)},removeAttr:function(b){return this.each(function(){n.removeAttr(this,b)})},prop:function(b,a){return n.access(this,n.prop,b,a,1<arguments.length)},removeProp:function(b){b=n.propFix[b]||b;return this.each(function(){try{this[b]=
  a,delete this[b]}catch(c){}})},addClass:function(b){var a,c,e,d,f,h=0,k=this.length;a="string"===typeof b&&b;if(n.isFunction(b))return this.each(function(a){n(this).addClass(b.call(this,a,this.className))});if(a)for(a=(b||"").match(Z)||[];h<k;h++)if(c=this[h],e=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(Ha," "):" ")){for(f=0;d=a[f++];)0>e.indexOf(" "+d+" ")&&(e+=d+" ");c.className=n.trim(e)}return this},removeClass:function(b){var a,c,e,d,f,h=0,k=this.length;a=0===arguments.length||
  "string"===typeof b&&b;if(n.isFunction(b))return this.each(function(a){n(this).removeClass(b.call(this,a,this.className))});if(a)for(a=(b||"").match(Z)||[];h<k;h++)if(c=this[h],e=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(Ha," "):"")){for(f=0;d=a[f++];)for(;0<=e.indexOf(" "+d+" ");)e=e.replace(" "+d+" "," ");c.className=b?n.trim(e):""}return this},toggleClass:function(b,a){var c=typeof b,e="boolean"===typeof a;return n.isFunction(b)?this.each(function(c){n(this).toggleClass(b.call(this,
  c,this.className,a),a)}):this.each(function(){if("string"===c)for(var d,f=0,h=n(this),k=a,r=b.match(Z)||[];d=r[f++];)k=e?k:!h.hasClass(d),h[k?"addClass":"removeClass"](d);else if(c===V||"boolean"===c)this.className&&n._data(this,"__className__",this.className),this.className=this.className||!1===b?"":n._data(this,"__className__")||""})},hasClass:function(b){b=" "+b+" ";for(var a=0,c=this.length;a<c;a++)if(1===this[a].nodeType&&0<=(" "+this[a].className+" ").replace(Ha," ").indexOf(b))return!0;return!1},
  val:function(b){var c,e,d,f=this[0];if(arguments.length)return d=n.isFunction(b),this.each(function(c){var f=n(this);1===this.nodeType&&(c=d?b.call(this,c,f.val()):b,null==c?c="":"number"===typeof c?c+="":n.isArray(c)&&(c=n.map(c,function(b){return null==b?"":b+""})),e=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],e&&"set"in e&&e.set(this,c,"value")!==a||(this.value=c))});if(f){if((e=n.valHooks[f.type]||n.valHooks[f.nodeName.toLowerCase()])&&"get"in e&&(c=e.get(f,"value"))!==a)return c;
  c=f.value;return"string"===typeof c?c.replace(Hb,""):null==c?"":c}}});n.extend({valHooks:{option:{get:function(b){var a=b.attributes.value;return!a||a.specified?b.value:b.text}},select:{get:function(b){for(var a,c=b.options,e=b.selectedIndex,d=(b="select-one"===b.type||0>e)?null:[],f=b?e+1:c.length,h=0>e?f:b?e:0;h<f;h++)if(a=c[h],!(!a.selected&&h!==e||(n.support.optDisabled?a.disabled:null!==a.getAttribute("disabled"))||a.parentNode.disabled&&n.nodeName(a.parentNode,"optgroup"))){a=n(a).val();if(b)return a;
  d.push(a)}return d},set:function(b,a){var c=n.makeArray(a);n(b).find("option").each(function(){this.selected=0<=n.inArray(n(this).val(),c)});c.length||(b.selectedIndex=-1);return c}}},attr:function(b,c,e){var d,f,h;f=b.nodeType;if(b&&3!==f&&8!==f&&2!==f){if(typeof b.getAttribute===V)return n.prop(b,c,e);if(f=1!==f||!n.isXMLDoc(b))c=c.toLowerCase(),d=n.attrHooks[c]||(Za.test(c)?Ya:na);if(e!==a)if(null===e)n.removeAttr(b,c);else{if(d&&f&&"set"in d&&(h=d.set(b,e,c))!==a)return h;b.setAttribute(c,e+"");
  return e}else{if(d&&f&&"get"in d&&null!==(h=d.get(b,c)))return h;typeof b.getAttribute!==V&&(h=b.getAttribute(c));return null==h?a:h}}},removeAttr:function(b,a){var c,e,d=0,f=a&&a.match(Z);if(f&&1===b.nodeType)for(;c=f[d++];)e=n.propFix[c]||c,Za.test(c)?!ja&&Ia.test(c)?b[n.camelCase("default-"+c)]=b[e]=!1:b[e]=!1:n.attr(b,c,""),b.removeAttribute(ja?c:e)},attrHooks:{type:{set:function(b,a){if(!n.support.radioValue&&"radio"===a&&n.nodeName(b,"input")){var c=b.value;b.setAttribute("type",a);c&&(b.value=
  c);return a}}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(b,c,e){var d,f,h;h=b.nodeType;if(b&&3!==h&&8!==h&&2!==h){if(h=1!==h||!n.isXMLDoc(b))c=n.propFix[c]||c,f=n.propHooks[c];return e!==a?f&&"set"in f&&(d=f.set(b,e,c))!==a?d:b[c]=e:f&&"get"in f&&null!==(d=
  f.get(b,c))?d:b[c]}},propHooks:{tabIndex:{get:function(b){var c=b.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):Ib.test(b.nodeName)||Jb.test(b.nodeName)&&b.href?0:a}}}});Ya={get:function(b,c){var e=n.prop(b,c),d="boolean"===typeof e&&b.getAttribute(c);return(e="boolean"===typeof e?Ja&&ja?null!=d:Ia.test(c)?b[n.camelCase("default-"+c)]:!!d:b.getAttributeNode(c))&&!1!==e.value?c.toLowerCase():a},set:function(b,a,c){!1===a?n.removeAttr(b,c):Ja&&ja||!Ia.test(c)?b.setAttribute(!ja&&
  n.propFix[c]||c,c):b[n.camelCase("default-"+c)]=b[c]=!0;return c}};Ja&&ja||(n.attrHooks.value={get:function(b,c){var e=b.getAttributeNode(c);return n.nodeName(b,"input")?b.defaultValue:e&&e.specified?e.value:a},set:function(b,a,c){if(n.nodeName(b,"input"))b.defaultValue=a;else return na&&na.set(b,a,c)}});ja||(na=n.valHooks.button={get:function(b,c){var e=b.getAttributeNode(c);return e&&("id"===c||"name"===c||"coords"===c?""!==e.value:e.specified)?e.value:a},set:function(b,c,e){var d=b.getAttributeNode(e);
  d||b.setAttributeNode(d=b.ownerDocument.createAttribute(e));d.value=c+="";return"value"===e||c===b.getAttribute(e)?c:a}},n.attrHooks.contenteditable={get:na.get,set:function(b,a,c){na.set(b,""===a?!1:a,c)}},n.each(["width","height"],function(b,a){n.attrHooks[a]=n.extend(n.attrHooks[a],{set:function(b,c){if(""===c)return b.setAttribute(a,"auto"),c}})}));n.support.hrefNormalized||(n.each(["href","src","width","height"],function(b,c){n.attrHooks[c]=n.extend(n.attrHooks[c],{get:function(b){b=b.getAttribute(c,
  2);return null==b?a:b}})}),n.each(["href","src"],function(b,a){n.propHooks[a]={get:function(b){return b.getAttribute(a,4)}}}));n.support.style||(n.attrHooks.style={get:function(b){return b.style.cssText||a},set:function(b,a){return b.style.cssText=a+""}});n.support.optSelected||(n.propHooks.selected=n.extend(n.propHooks.selected,{get:function(b){if(b=b.parentNode)b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex;return null}}));n.support.enctype||(n.propFix.enctype="encoding");n.support.checkOn||
  n.each(["radio","checkbox"],function(){n.valHooks[this]={get:function(b){return null===b.getAttribute("value")?"on":b.value}}});n.each(["radio","checkbox"],function(){n.valHooks[this]=n.extend(n.valHooks[this],{set:function(b,a){if(n.isArray(a))return b.checked=0<=n.inArray(n(b).val(),a)}})});var Ka=/^(?:input|select|textarea)$/i,Kb=/^key/,Lb=/^(?:mouse|contextmenu)|click/,$a=/^(?:focusinfocus|focusoutblur)$/,ab=/^([^.]*)(?:\.(.+)|)$/;n.event={global:{},add:function(b,c,e,d,f){var h,k,r,g,m,y,t,p,
  l;if(r=n._data(b)){e.handler&&(g=e,e=g.handler,f=g.selector);e.guid||(e.guid=n.guid++);(k=r.events)||(k=r.events={});(m=r.handle)||(m=r.handle=function(b){return typeof n===V||b&&n.event.triggered===b.type?a:n.event.dispatch.apply(m.elem,arguments)},m.elem=b);c=(c||"").match(Z)||[""];for(r=c.length;r--;)h=ab.exec(c[r])||[],p=y=h[1],l=(h[2]||"").split(".").sort(),h=n.event.special[p]||{},p=(f?h.delegateType:h.bindType)||p,h=n.event.special[p]||{},y=n.extend({type:p,origType:y,data:d,handler:e,guid:e.guid,
  selector:f,needsContext:f&&n.expr.match.needsContext.test(f),namespace:l.join(".")},g),(t=k[p])||(t=k[p]=[],t.delegateCount=0,h.setup&&!1!==h.setup.call(b,d,l,m)||(b.addEventListener?b.addEventListener(p,m,!1):b.attachEvent&&b.attachEvent("on"+p,m))),h.add&&(h.add.call(b,y),y.handler.guid||(y.handler.guid=e.guid)),f?t.splice(t.delegateCount++,0,y):t.push(y),n.event.global[p]=!0;b=null}},remove:function(b,a,c,e,d){var f,h,k,r,g,m,y,t,p,l,z,P=n.hasData(b)&&n._data(b);if(P&&(m=P.events)){a=(a||"").match(Z)||
  [""];for(g=a.length;g--;)if(k=ab.exec(a[g])||[],p=z=k[1],l=(k[2]||"").split(".").sort(),p){y=n.event.special[p]||{};p=(e?y.delegateType:y.bindType)||p;t=m[p]||[];k=k[2]&&new RegExp("(^|\\.)"+l.join("\\.(?:.*\\.|)")+"(\\.|$)");for(r=f=t.length;f--;)h=t[f],!d&&z!==h.origType||c&&c.guid!==h.guid||k&&!k.test(h.namespace)||e&&e!==h.selector&&("**"!==e||!h.selector)||(t.splice(f,1),h.selector&&t.delegateCount--,y.remove&&y.remove.call(b,h));r&&!t.length&&(y.teardown&&!1!==y.teardown.call(b,l,P.handle)||
  n.removeEvent(b,p,P.handle),delete m[p])}else for(p in m)n.event.remove(b,p+a[g],c,e,!0);n.isEmptyObject(m)&&(delete P.handle,n._removeData(b,"events"))}},trigger:function(c,e,d,f){var h,k,r,g,m,y,t=[d||R],p=xa.call(c,"type")?c.type:c;m=xa.call(c,"namespace")?c.namespace.split("."):[];r=h=d=d||R;if(3!==d.nodeType&&8!==d.nodeType&&!$a.test(p+n.event.triggered)&&(0<=p.indexOf(".")&&(m=p.split("."),p=m.shift(),m.sort()),k=0>p.indexOf(":")&&"on"+p,c=c[n.expando]?c:new n.Event(p,"object"===typeof c&&c),
  c.isTrigger=!0,c.namespace=m.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,c.result=a,c.target||(c.target=d),e=null==e?[c]:n.makeArray(e,[c]),m=n.event.special[p]||{},f||!m.trigger||!1!==m.trigger.apply(d,e))){if(!f&&!m.noBubble&&!n.isWindow(d)){g=m.delegateType||p;$a.test(g+p)||(r=r.parentNode);for(;r;r=r.parentNode)t.push(r),h=r;h===(d.ownerDocument||R)&&t.push(h.defaultView||h.parentWindow||b)}for(y=0;(r=t[y++])&&!c.isPropagationStopped();)c.type=
  1<y?g:m.bindType||p,(h=(n._data(r,"events")||{})[c.type]&&n._data(r,"handle"))&&h.apply(r,e),(h=k&&r[k])&&n.acceptData(r)&&h.apply&&!1===h.apply(r,e)&&c.preventDefault();c.type=p;if(!(f||c.isDefaultPrevented()||m._default&&!1!==m._default.apply(d.ownerDocument,e)||"click"===p&&n.nodeName(d,"a"))&&n.acceptData(d)&&k&&d[p]&&!n.isWindow(d)){(h=d[k])&&(d[k]=null);n.event.triggered=p;try{d[p]()}catch(l){}n.event.triggered=a;h&&(d[k]=h)}return c.result}},dispatch:function(b){b=n.event.fix(b);var c,e,d,
  f,h=[],k=ca.call(arguments);c=(n._data(this,"events")||{})[b.type]||[];var r=n.event.special[b.type]||{};k[0]=b;b.delegateTarget=this;if(!r.preDispatch||!1!==r.preDispatch.call(this,b)){h=n.event.handlers.call(this,b,c);for(c=0;(d=h[c++])&&!b.isPropagationStopped();)for(b.currentTarget=d.elem,f=0;(e=d.handlers[f++])&&!b.isImmediatePropagationStopped();)if(!b.namespace_re||b.namespace_re.test(e.namespace))b.handleObj=e,b.data=e.data,e=((n.event.special[e.origType]||{}).handle||e.handler).apply(d.elem,
  k),e!==a&&!1===(b.result=e)&&(b.preventDefault(),b.stopPropagation());r.postDispatch&&r.postDispatch.call(this,b);return b.result}},handlers:function(b,c){var e,d,f,h,k=[],r=c.delegateCount,g=b.target;if(r&&g.nodeType&&(!b.button||"click"!==b.type))for(;g!=this;g=g.parentNode||this)if(1===g.nodeType&&(!0!==g.disabled||"click"!==b.type)){f=[];for(h=0;h<r;h++)d=c[h],e=d.selector+" ",f[e]===a&&(f[e]=d.needsContext?0<=n(e,this).index(g):n.find(e,this,null,[g]).length),f[e]&&f.push(d);f.length&&k.push({elem:g,
  handlers:f})}r<c.length&&k.push({elem:this,handlers:c.slice(r)});return k},fix:function(b){if(b[n.expando])return b;var a,c,e;a=b.type;var d=b,f=this.fixHooks[a];f||(this.fixHooks[a]=f=Lb.test(a)?this.mouseHooks:Kb.test(a)?this.keyHooks:{});e=f.props?this.props.concat(f.props):this.props;b=new n.Event(d);for(a=e.length;a--;)c=e[a],b[c]=d[c];b.target||(b.target=d.srcElement||R);3===b.target.nodeType&&(b.target=b.target.parentNode);b.metaKey=!!b.metaKey;return f.filter?f.filter(b,d):b},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
  fixHooks:{},keyHooks:{props:["char","charCode","key","keyCode"],filter:function(b,a){null==b.which&&(b.which=null!=a.charCode?a.charCode:a.keyCode);return b}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(b,c){var e,d,f=c.button,h=c.fromElement;null==b.pageX&&null!=c.clientX&&(e=b.target.ownerDocument||R,d=e.documentElement,e=e.body,b.pageX=c.clientX+(d&&d.scrollLeft||e&&e.scrollLeft||0)-(d&&d.clientLeft||
  e&&e.clientLeft||0),b.pageY=c.clientY+(d&&d.scrollTop||e&&e.scrollTop||0)-(d&&d.clientTop||e&&e.clientTop||0));!b.relatedTarget&&h&&(b.relatedTarget=h===b.target?c.toElement:h);b.which||f===a||(b.which=f&1?1:f&2?3:f&4?2:0);return b}},special:{load:{noBubble:!0},click:{trigger:function(){if(n.nodeName(this,"input")&&"checkbox"===this.type&&this.click)return this.click(),!1}},focus:{trigger:function(){if(this!==R.activeElement&&this.focus)try{return this.focus(),!1}catch(b){}},delegateType:"focusin"},
  blur:{trigger:function(){if(this===R.activeElement&&this.blur)return this.blur(),!1},delegateType:"focusout"},beforeunload:{postDispatch:function(b){b.result!==a&&(b.originalEvent.returnValue=b.result)}}},simulate:function(b,a,c,e){b=n.extend(new n.Event,c,{type:b,isSimulated:!0,originalEvent:{}});e?n.event.trigger(b,null,a):n.event.dispatch.call(a,b);b.isDefaultPrevented()&&c.preventDefault()}};n.removeEvent=R.removeEventListener?function(b,a,c){b.removeEventListener&&b.removeEventListener(a,c,!1)}:
  function(b,a,c){a="on"+a;b.detachEvent&&(typeof b[a]===V&&(b[a]=null),b.detachEvent(a,c))};n.Event=function(b,a){if(!(this instanceof n.Event))return new n.Event(b,a);b&&b.type?(this.originalEvent=b,this.type=b.type,this.isDefaultPrevented=b.defaultPrevented||!1===b.returnValue||b.getPreventDefault&&b.getPreventDefault()?m:l):this.type=b;a&&n.extend(this,a);this.timeStamp=b&&b.timeStamp||n.now();this[n.expando]=!0};n.Event.prototype={isDefaultPrevented:l,isPropagationStopped:l,isImmediatePropagationStopped:l,
  preventDefault:function(){var b=this.originalEvent;this.isDefaultPrevented=m;b&&(b.preventDefault?b.preventDefault():b.returnValue=!1)},stopPropagation:function(){var b=this.originalEvent;this.isPropagationStopped=m;b&&(b.stopPropagation&&b.stopPropagation(),b.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=m;this.stopPropagation()}};n.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(b,a){n.event.special[b]={delegateType:a,bindType:a,handle:function(b){var c,
  e=b.relatedTarget,d=b.handleObj;if(!e||e!==this&&!n.contains(this,e))b.type=d.origType,c=d.handler.apply(this,arguments),b.type=a;return c}}});n.support.submitBubbles||(n.event.special.submit={setup:function(){if(n.nodeName(this,"form"))return!1;n.event.add(this,"click._submit keypress._submit",function(b){b=b.target;(b=n.nodeName(b,"input")||n.nodeName(b,"button")?b.form:a)&&!n._data(b,"submitBubbles")&&(n.event.add(b,"submit._submit",function(b){b._submit_bubble=!0}),n._data(b,"submitBubbles",!0))})},
  postDispatch:function(b){b._submit_bubble&&(delete b._submit_bubble,this.parentNode&&!b.isTrigger&&n.event.simulate("submit",this.parentNode,b,!0))},teardown:function(){if(n.nodeName(this,"form"))return!1;n.event.remove(this,"._submit")}});n.support.changeBubbles||(n.event.special.change={setup:function(){if(Ka.test(this.nodeName)){if("checkbox"===this.type||"radio"===this.type)n.event.add(this,"propertychange._change",function(b){"checked"===b.originalEvent.propertyName&&(this._just_changed=!0)}),
  n.event.add(this,"click._change",function(b){this._just_changed&&!b.isTrigger&&(this._just_changed=!1);n.event.simulate("change",this,b,!0)});return!1}n.event.add(this,"beforeactivate._change",function(b){b=b.target;Ka.test(b.nodeName)&&!n._data(b,"changeBubbles")&&(n.event.add(b,"change._change",function(b){!this.parentNode||b.isSimulated||b.isTrigger||n.event.simulate("change",this.parentNode,b,!0)}),n._data(b,"changeBubbles",!0))})},handle:function(b){var a=b.target;if(this!==a||b.isSimulated||
  b.isTrigger||"radio"!==a.type&&"checkbox"!==a.type)return b.handleObj.handler.apply(this,arguments)},teardown:function(){n.event.remove(this,"._change");return!Ka.test(this.nodeName)}});n.support.focusinBubbles||n.each({focus:"focusin",blur:"focusout"},function(b,a){var c=0,e=function(b){n.event.simulate(a,b.target,n.event.fix(b),!0)};n.event.special[a]={setup:function(){0===c++&&R.addEventListener(b,e,!0)},teardown:function(){0===--c&&R.removeEventListener(b,e,!0)}}});n.fn.extend({on:function(b,
  c,e,d,f){var h,k;if("object"===typeof b){"string"!==typeof c&&(e=e||c,c=a);for(h in b)this.on(h,c,e,b[h],f);return this}null==e&&null==d?(d=c,e=c=a):null==d&&("string"===typeof c?(d=e,e=a):(d=e,e=c,c=a));if(!1===d)d=l;else if(!d)return this;1===f&&(k=d,d=function(b){n().off(b);return k.apply(this,arguments)},d.guid=k.guid||(k.guid=n.guid++));return this.each(function(){n.event.add(this,b,d,e,c)})},one:function(b,a,c,e){return this.on(b,a,c,e,1)},off:function(b,c,e){var d;if(b&&b.preventDefault&&b.handleObj)return d=
  b.handleObj,n(b.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"===typeof b){for(d in b)this.off(d,c,b[d]);return this}if(!1===c||"function"===typeof c)e=c,c=a;!1===e&&(e=l);return this.each(function(){n.event.remove(this,b,e,c)})},bind:function(b,a,c){return this.on(b,null,a,c)},unbind:function(b,a){return this.off(b,null,a)},delegate:function(b,a,c,e){return this.on(a,b,c,e)},undelegate:function(b,a,c){return 1===arguments.length?this.off(b,
  "**"):this.off(a,b||"**",c)},trigger:function(b,a){return this.each(function(){n.event.trigger(b,a,this)})},triggerHandler:function(b,a){var c=this[0];if(c)return n.event.trigger(b,a,c,!0)}});(function(b,a){function c(b){return fa.test(b+"")}function e(){var b,a=[];return b=function(c,e){a.push(c+=" ")>w.cacheLength&&delete b[a.shift()];return b[c]=e}}function d(b){b[D]=!0;return b}function f(b){var a=x.createElement("div");try{return b(a)}catch(c){return!1}finally{}}function h(b,a,c,e){var d,f,k,
  r,g;(a?a.ownerDocument||a:S)!==x&&F(a);a=a||x;c=c||[];if(!b||"string"!==typeof b)return c;if(1!==(r=a.nodeType)&&9!==r)return[];if(!M&&!e){if(d=ja.exec(b))if(k=d[1])if(9===r)if((f=a.getElementById(k))&&f.parentNode){if(f.id===k)return c.push(f),c}else return c;else{if(a.ownerDocument&&(f=a.ownerDocument.getElementById(k))&&Q(a,f)&&f.id===k)return c.push(f),c}else{if(d[2])return ia.apply(c,ba.call(a.getElementsByTagName(b),0)),c;if((k=d[3])&&W.getByClassName&&a.getElementsByClassName)return ia.apply(c,
  ba.call(a.getElementsByClassName(k),0)),c}if(W.qsa&&!E.test(b)){d=!0;f=D;k=a;g=9===r&&b;if(1===r&&"object"!==a.nodeName.toLowerCase()){r=y(b);(d=a.getAttribute("id"))?f=d.replace(na,"\\$&"):a.setAttribute("id",f);f="[id='"+f+"'] ";for(k=r.length;k--;)r[k]=f+t(r[k]);k=aa.test(b)&&a.parentNode||a;g=r.join(",")}if(g)try{return ia.apply(c,ba.call(k.querySelectorAll(g),0)),c}catch(m){}finally{d||a.removeAttribute("id")}}}var p;a:{b=b.replace(sa,"$1");f=y(b);if(!e&&1===f.length){d=f[0]=f[0].slice(0);if(2<
  d.length&&"ID"===(p=d[0]).type&&9===a.nodeType&&!M&&w.relative[d[1].type]){a=w.find.ID(p.matches[0].replace(oa,pa),a)[0];if(!a){p=c;break a}b=b.slice(d.shift().value.length)}for(r=Y.needsContext.test(b)?0:d.length;r--;){p=d[r];if(w.relative[k=p.type])break;if(k=w.find[k])if(e=k(p.matches[0].replace(oa,pa),aa.test(d[0].type)&&a.parentNode||a)){d.splice(r,1);b=e.length&&t(d);if(!b){ia.apply(c,ba.call(e,0));p=c;break a}break}}}J(b,f)(e,a,M,c,aa.test(b));p=c}return p}function k(b,a){var c=a&&b,e=c&&(~a.sourceIndex||
  -2147483648)-(~b.sourceIndex||-2147483648);if(e)return e;if(c)for(;c=c.nextSibling;)if(c===a)return-1;return b?1:-1}function r(b){return function(a){return"input"===a.nodeName.toLowerCase()&&a.type===b}}function g(b){return function(a){var c=a.nodeName.toLowerCase();return("input"===c||"button"===c)&&a.type===b}}function m(b){return d(function(a){a=+a;return d(function(c,e){for(var d,f=b([],c.length,a),h=f.length;h--;)c[d=f[h]]&&(c[d]=!(e[d]=c[d]))})})}function y(b,a){var c,e,d,f,k,r,g;if(k=ga[b+
  " "])return a?0:k.slice(0);k=b;r=[];for(g=w.preFilter;k;){if(!c||(e=X.exec(k)))e&&(k=k.slice(e[0].length)||k),r.push(d=[]);c=!1;if(e=Z.exec(k))c=e.shift(),d.push({value:c,type:e[0].replace(sa," ")}),k=k.slice(c.length);for(f in w.filter)!(e=Y[f].exec(k))||g[f]&&!(e=g[f](e))||(c=e.shift(),d.push({value:c,type:f,matches:e}),k=k.slice(c.length));if(!c)break}return a?k.length:k?h.error(b):ga(b,r).slice(0)}function t(b){for(var a=0,c=b.length,e="";a<c;a++)e+=b[a].value;return e}function p(b,a,c){var e=
  a.dir,d=c&&"parentNode"===e,f=N++;return a.first?function(a,c,f){for(;a=a[e];)if(1===a.nodeType||d)return b(a,c,f)}:function(a,c,h){var k,r,g,m=U+" "+f;if(h)for(;a=a[e];){if((1===a.nodeType||d)&&b(a,c,h))return!0}else for(;a=a[e];)if(1===a.nodeType||d)if(g=a[D]||(a[D]={}),(r=g[e])&&r[0]===m){if(!0===(k=r[1])||k===u)return!0===k}else if(r=g[e]=[m],r[1]=b(a,c,h)||u,!0===r[1])return!0}}function l(b){return 1<b.length?function(a,c,e){for(var d=b.length;d--;)if(!b[d](a,c,e))return!1;return!0}:b[0]}function z(b,
  a,c,e,d){for(var f,h=[],k=0,r=b.length,g=null!=a;k<r;k++)if(f=b[k])if(!c||c(f,e,d))h.push(f),g&&a.push(k);return h}function P(b,a,c,e,f,k){e&&!e[D]&&(e=P(e));f&&!f[D]&&(f=P(f,k));return d(function(d,k,r,g){var m,y,t=[],p=[],l=k.length,n;if(!(n=d)){n=a||"*";for(var P=r.nodeType?[r]:r,v=[],I=0,O=P.length;I<O;I++)h(n,P[I],v);n=v}n=!b||!d&&a?n:z(n,t,b,r,g);P=c?f||(d?b:l||e)?[]:k:n;c&&c(n,P,r,g);if(e)for(m=z(P,p),e(m,[],r,g),r=m.length;r--;)if(y=m[r])P[p[r]]=!(n[p[r]]=y);if(d){if(f||b){if(f){m=[];for(r=
  P.length;r--;)(y=P[r])&&m.push(n[r]=y);f(null,P=[],m,g)}for(r=P.length;r--;)(y=P[r])&&-1<(m=f?ra.call(d,y):t[r])&&(d[m]=!(k[m]=y))}}else P=z(P===k?P.splice(l,P.length):P),f?f(null,k,P,g):ia.apply(k,P)})}function v(b){var a,c,e,d=b.length,f=w.relative[b[0].type];c=f||w.relative[" "];for(var h=f?1:0,k=p(function(b){return b===a},c,!0),r=p(function(b){return-1<ra.call(a,b)},c,!0),g=[function(b,c,e){return!f&&(e||c!==A)||((a=c).nodeType?k(b,c,e):r(b,c,e))}];h<d;h++)if(c=w.relative[b[h].type])g=[p(l(g),
  c)];else{c=w.filter[b[h].type].apply(null,b[h].matches);if(c[D]){for(e=++h;e<d&&!w.relative[b[e].type];e++);return P(1<h&&l(g),1<h&&t(b.slice(0,h-1)).replace(sa,"$1"),c,h<e&&v(b.slice(h,e)),e<d&&v(b=b.slice(e)),e<d&&t(b))}g.push(c)}return l(g)}function I(b,a){var c=0,e=0<a.length,f=0<b.length,k=function(d,k,r,g,m){var y,t,p=[],l=0,n="0",P=d&&[],v=null!=m,I=A,O=d||f&&w.find.TAG("*",m&&k.parentNode||k),q=U+=null==I?1:Math.random()||.1;v&&(A=k!==x&&k,u=c);for(;null!=(m=O[n]);n++){if(f&&m){for(y=0;t=
  b[y++];)if(t(m,k,r)){g.push(m);break}v&&(U=q,u=++c)}e&&((m=!t&&m)&&l--,d&&P.push(m))}l+=n;if(e&&n!==l){for(y=0;t=a[y++];)t(P,p,k,r);if(d){if(0<l)for(;n--;)P[n]||p[n]||(p[n]=la.call(g));p=z(p)}ia.apply(g,p);v&&!d&&0<p.length&&1<l+a.length&&h.uniqueSort(g)}v&&(U=q,A=I);return P};return e?d(k):k}function O(){}var q,u,w,H,C,J,B,A,F,x,R,M,E,K,G,Q,L,D="sizzle"+-new Date,S=b.document,W={},U=0,N=0,T=e(),ga=e(),Ba=e(),V=typeof a,ha=[],la=ha.pop,ia=ha.push,ba=ha.slice,ra=ha.indexOf||function(b){for(var a=0,
  c=this.length;a<c;a++)if(this[a]===b)return a;return-1},ha="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+".replace("w","w#"),ca="\\[[\\x20\\t\\r\\n\\f]*((?:\\\\.|[\\w-]|[^\\x00-\\xa0])+)[\\x20\\t\\r\\n\\f]*(?:([*^$|!~]?=)[\\x20\\t\\r\\n\\f]*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+ha+")|)|)[\\x20\\t\\r\\n\\f]*\\]",wa=":((?:\\\\.|[\\w-]|[^\\x00-\\xa0])+)(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+ca.replace(3,8)+")*)|.*)\\)|)",sa=/^[\x20\t\r\n\f]+|((?:^|[^\\])(?:\\.)*)[\x20\t\r\n\f]+$/g,X=/^[\x20\t\r\n\f]*,[\x20\t\r\n\f]*/,
  Z=/^[\x20\t\r\n\f]*([\x20\t\r\n\f>+~])[\x20\t\r\n\f]*/,da=new RegExp(wa),ea=new RegExp("^"+ha+"$"),Y={ID:/^#((?:\\.|[\w-]|[^\x00-\xa0])+)/,CLASS:/^\.((?:\\.|[\w-]|[^\x00-\xa0])+)/,NAME:/^\[name=['"]?((?:\\.|[\w-]|[^\x00-\xa0])+)['"]?\]/,TAG:new RegExp("^("+"(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+".replace("w","w*")+")"),ATTR:new RegExp("^"+ca),PSEUDO:new RegExp("^"+wa),CHILD:/^:(only|first|last|nth|nth-last)-(child|of-type)(?:\([\x20\t\r\n\f]*(even|odd|(([+-]|)(\d*)n|)[\x20\t\r\n\f]*(?:([+-]|)[\x20\t\r\n\f]*(\d+)|))[\x20\t\r\n\f]*\)|)/i,
  needsContext:/^[\x20\t\r\n\f]*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\([\x20\t\r\n\f]*((?:-\d)?\d*)[\x20\t\r\n\f]*\)|)(?=[^-]|$)/i},aa=/[\x20\t\r\n\f]*[+~]/,fa=/^[^{]+\{\s*\[native code/,ja=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ka=/^(?:input|select|textarea|button)$/i,ma=/^h\d$/i,na=/'|\\/g,qa=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,oa=/\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,pa=function(b,a){var c="0x"+a-65536;return c!==c?a:0>c?String.fromCharCode(c+65536):String.fromCharCode(c>>10|55296,
  c&1023|56320)};try{ba.call(S.documentElement.childNodes,0)[0].nodeType}catch(ta){ba=function(b){for(var a,c=[];a=this[b++];)c.push(a);return c}}C=h.isXML=function(b){return(b=b&&(b.ownerDocument||b).documentElement)?"HTML"!==b.nodeName:!1};F=h.setDocument=function(b){var e=b?b.ownerDocument||b:S;if(e===x||9!==e.nodeType||!e.documentElement)return x;x=e;R=e.documentElement;M=C(e);W.tagNameNoComments=f(function(b){b.appendChild(e.createComment(""));return!b.getElementsByTagName("*").length});W.attributes=
  f(function(b){b.innerHTML="<select></select>";b=typeof b.lastChild.getAttribute("multiple");return"boolean"!==b&&"string"!==b});W.getByClassName=f(function(b){b.innerHTML="<div class='hidden e'></div><div class='hidden'></div>";if(!b.getElementsByClassName||!b.getElementsByClassName("e").length)return!1;b.lastChild.className="e";return 2===b.getElementsByClassName("e").length});W.getByName=f(function(b){b.id=D+0;b.innerHTML="<a name='"+D+"'></a><div name='"+D+"'></div>";R.insertBefore(b,R.firstChild);
  var a=e.getElementsByName&&e.getElementsByName(D).length===2+e.getElementsByName(D+0).length;W.getIdNotName=!e.getElementById(D);R.removeChild(b);return a});w.attrHandle=f(function(b){b.innerHTML="<a href='#'></a>";return b.firstChild&&typeof b.firstChild.getAttribute!==V&&"#"===b.firstChild.getAttribute("href")})?{}:{href:function(b){return b.getAttribute("href",2)},type:function(b){return b.getAttribute("type")}};W.getIdNotName?(w.find.ID=function(b,a){if(typeof a.getElementById!==V&&!M){var c=
  a.getElementById(b);return c&&c.parentNode?[c]:[]}},w.filter.ID=function(b){var a=b.replace(oa,pa);return function(b){return b.getAttribute("id")===a}}):(w.find.ID=function(b,c){if(typeof c.getElementById!==V&&!M){var e=c.getElementById(b);return e?e.id===b||typeof e.getAttributeNode!==V&&e.getAttributeNode("id").value===b?[e]:a:[]}},w.filter.ID=function(b){var a=b.replace(oa,pa);return function(b){return(b=typeof b.getAttributeNode!==V&&b.getAttributeNode("id"))&&b.value===a}});w.find.TAG=W.tagNameNoComments?
  function(b,a){if(typeof a.getElementsByTagName!==V)return a.getElementsByTagName(b)}:function(b,a){var c,e=[],d=0,f=a.getElementsByTagName(b);if("*"===b){for(;c=f[d++];)1===c.nodeType&&e.push(c);return e}return f};w.find.NAME=W.getByName&&function(b,a){if(typeof a.getElementsByName!==V)return a.getElementsByName(name)};w.find.CLASS=W.getByClassName&&function(b,a){if(typeof a.getElementsByClassName!==V&&!M)return a.getElementsByClassName(b)};K=[];E=[":focus"];if(W.qsa=c(e.querySelectorAll))f(function(b){b.innerHTML=
  "<select><option selected=''></option></select>";b.querySelectorAll("[selected]").length||E.push("\\[[\\x20\\t\\r\\n\\f]*(?:checked|disabled|ismap|multiple|readonly|selected|value)");b.querySelectorAll(":checked").length||E.push(":checked")}),f(function(b){b.innerHTML="<input type='hidden' i=''/>";b.querySelectorAll("[i^='']").length&&E.push("[*^$]=[\\x20\\t\\r\\n\\f]*(?:\"\"|'')");b.querySelectorAll(":enabled").length||E.push(":enabled",":disabled");b.querySelectorAll("*,:x");E.push(",.*:")});(W.matchesSelector=
  c(G=R.matchesSelector||R.mozMatchesSelector||R.webkitMatchesSelector||R.oMatchesSelector||R.msMatchesSelector))&&f(function(b){W.disconnectedMatch=G.call(b,"div");G.call(b,"[s!='']:x");K.push("!=",wa)});E=new RegExp(E.join("|"));K=new RegExp(K.join("|"));Q=c(R.contains)||R.compareDocumentPosition?function(b,a){var c=9===b.nodeType?b.documentElement:b,e=a&&a.parentNode;return b===e||!!(e&&1===e.nodeType&&(c.contains?c.contains(e):b.compareDocumentPosition&&b.compareDocumentPosition(e)&16))}:function(b,
  a){if(a)for(;a=a.parentNode;)if(a===b)return!0;return!1};L=R.compareDocumentPosition?function(b,a){var c;return b===a?(B=!0,0):(c=a.compareDocumentPosition&&b.compareDocumentPosition&&b.compareDocumentPosition(a))?c&1||b.parentNode&&11===b.parentNode.nodeType?b===e||Q(S,b)?-1:a===e||Q(S,a)?1:0:c&4?-1:1:b.compareDocumentPosition?-1:1}:function(b,a){var c,d=0;c=b.parentNode;var f=a.parentNode,h=[b],r=[a];if(b===a)return B=!0,0;if(!c||!f)return b===e?-1:a===e?1:c?-1:f?1:0;if(c===f)return k(b,a);for(c=
  b;c=c.parentNode;)h.unshift(c);for(c=a;c=c.parentNode;)r.unshift(c);for(;h[d]===r[d];)d++;return d?k(h[d],r[d]):h[d]===S?-1:r[d]===S?1:0};B=!1;[0,0].sort(L);W.detectDuplicates=B;return x};h.matches=function(b,a){return h(b,null,null,a)};h.matchesSelector=function(b,a){(b.ownerDocument||b)!==x&&F(b);a=a.replace(qa,"='$1']");if(!(!W.matchesSelector||M||K&&K.test(a)||E.test(a)))try{var c=G.call(b,a);if(c||W.disconnectedMatch||b.document&&11!==b.document.nodeType)return c}catch(e){}return 0<h(a,x,null,
  [b]).length};h.contains=function(b,a){(b.ownerDocument||b)!==x&&F(b);return Q(b,a)};h.attr=function(b,a){var c;(b.ownerDocument||b)!==x&&F(b);M||(a=a.toLowerCase());return(c=w.attrHandle[a])?c(b):M||W.attributes?b.getAttribute(a):((c=b.getAttributeNode(a))||b.getAttribute(a))&&!0===b[a]?a:c&&c.specified?c.value:null};h.error=function(b){throw Error("Syntax error, unrecognized expression: "+b);};h.uniqueSort=function(b){var a,c=[],e=1,d=0;B=!W.detectDuplicates;b.sort(L);if(B){for(;a=b[e];e++)a===b[e-
  1]&&(d=c.push(e));for(;d--;)b.splice(c[d],1)}return b};H=h.getText=function(b){var a,c="",e=0;a=b.nodeType;if(!a)for(;a=b[e];e++)c+=H(a);else if(1===a||9===a||11===a){if("string"===typeof b.textContent)return b.textContent;for(b=b.firstChild;b;b=b.nextSibling)c+=H(b)}else if(3===a||4===a)return b.nodeValue;return c};w=h.selectors={cacheLength:50,createPseudo:d,match:Y,find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},
  preFilter:{ATTR:function(b){b[1]=b[1].replace(oa,pa);b[3]=(b[4]||b[5]||"").replace(oa,pa);"~="===b[2]&&(b[3]=" "+b[3]+" ");return b.slice(0,4)},CHILD:function(b){b[1]=b[1].toLowerCase();"nth"===b[1].slice(0,3)?(b[3]||h.error(b[0]),b[4]=+(b[4]?b[5]+(b[6]||1):2*("even"===b[3]||"odd"===b[3])),b[5]=+(b[7]+b[8]||"odd"===b[3])):b[3]&&h.error(b[0]);return b},PSEUDO:function(b){var a,c=!b[5]&&b[2];if(Y.CHILD.test(b[0]))return null;b[4]?b[2]=b[4]:c&&da.test(c)&&(a=y(c,!0))&&(a=c.indexOf(")",c.length-a)-c.length)&&
  (b[0]=b[0].slice(0,a),b[2]=c.slice(0,a));return b.slice(0,3)}},filter:{TAG:function(b){if("*"===b)return function(){return!0};b=b.replace(oa,pa).toLowerCase();return function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(b){var a=T[b+" "];return a||(a=new RegExp("(^|[\\x20\\t\\r\\n\\f])"+b+"([\\x20\\t\\r\\n\\f]|$)"))&&T(b,function(b){return a.test(b.className||typeof b.getAttribute!==V&&b.getAttribute("class")||"")})},ATTR:function(b,a,c){return function(e){e=h.attr(e,b);if(null==
  e)return"!="===a;if(!a)return!0;e+="";return"="===a?e===c:"!="===a?e!==c:"^="===a?c&&0===e.indexOf(c):"*="===a?c&&-1<e.indexOf(c):"$="===a?c&&e.slice(-c.length)===c:"~="===a?-1<(" "+e+" ").indexOf(c):"|="===a?e===c||e.slice(0,c.length+1)===c+"-":!1}},CHILD:function(b,a,c,e,d){var f="nth"!==b.slice(0,3),h="last"!==b.slice(-4),k="of-type"===a;return 1===e&&0===d?function(b){return!!b.parentNode}:function(a,c,r){var g,m,y,t,p;c=f!==h?"nextSibling":"previousSibling";var l=a.parentNode,n=k&&a.nodeName.toLowerCase();
  r=!r&&!k;if(l){if(f){for(;c;){for(m=a;m=m[c];)if(k?m.nodeName.toLowerCase()===n:1===m.nodeType)return!1;p=c="only"===b&&!p&&"nextSibling"}return!0}p=[h?l.firstChild:l.lastChild];if(h&&r)for(r=l[D]||(l[D]={}),g=r[b]||[],t=g[0]===U&&g[1],y=g[0]===U&&g[2],m=t&&l.childNodes[t];m=++t&&m&&m[c]||(y=t=0)||p.pop();){if(1===m.nodeType&&++y&&m===a){r[b]=[U,t,y];break}}else if(r&&(g=(a[D]||(a[D]={}))[b])&&g[0]===U)y=g[1];else for(;(m=++t&&m&&m[c]||(y=t=0)||p.pop())&&((k?m.nodeName.toLowerCase()!==n:1!==m.nodeType)||
  !++y||(r&&((m[D]||(m[D]={}))[b]=[U,y]),m!==a)););y-=d;return y===e||0===y%e&&0<=y/e}}},PSEUDO:function(b,a){var c,e=w.pseudos[b]||w.setFilters[b.toLowerCase()]||h.error("unsupported pseudo: "+b);return e[D]?e(a):1<e.length?(c=[b,b,"",a],w.setFilters.hasOwnProperty(b.toLowerCase())?d(function(b,c){for(var d,f=e(b,a),h=f.length;h--;)d=ra.call(b,f[h]),b[d]=!(c[d]=f[h])}):function(b){return e(b,0,c)}):e}},pseudos:{not:d(function(b){var a=[],c=[],e=J(b.replace(sa,"$1"));return e[D]?d(function(b,a,c,d){d=
  e(b,null,d,[]);for(var f=b.length;f--;)if(c=d[f])b[f]=!(a[f]=c)}):function(b,d,f){a[0]=b;e(a,null,f,c);return!c.pop()}}),has:d(function(b){return function(a){return 0<h(b,a).length}}),contains:d(function(b){return function(a){return-1<(a.textContent||a.innerText||H(a)).indexOf(b)}}),lang:d(function(b){ea.test(b||"")||h.error("unsupported lang: "+b);b=b.replace(oa,pa).toLowerCase();return function(a){var c;do if(c=M?a.getAttribute("xml:lang")||a.getAttribute("lang"):a.lang)return c=c.toLowerCase(),
  c===b||0===c.indexOf(b+"-");while((a=a.parentNode)&&1===a.nodeType);return!1}}),target:function(a){var c=b.location&&b.location.hash;return c&&c.slice(1)===a.id},root:function(b){return b===R},focus:function(b){return b===x.activeElement&&(!x.hasFocus||x.hasFocus())&&!!(b.type||b.href||~b.tabIndex)},enabled:function(b){return!1===b.disabled},disabled:function(b){return!0===b.disabled},checked:function(b){var a=b.nodeName.toLowerCase();return"input"===a&&!!b.checked||"option"===a&&!!b.selected},selected:function(b){b.parentNode&&
  b.parentNode.selectedIndex;return!0===b.selected},empty:function(b){for(b=b.firstChild;b;b=b.nextSibling)if("@"<b.nodeName||3===b.nodeType||4===b.nodeType)return!1;return!0},parent:function(b){return!w.pseudos.empty(b)},header:function(b){return ma.test(b.nodeName)},input:function(b){return ka.test(b.nodeName)},button:function(b){var a=b.nodeName.toLowerCase();return"input"===a&&"button"===b.type||"button"===a},text:function(b){var a;return"input"===b.nodeName.toLowerCase()&&"text"===b.type&&(null==
  (a=b.getAttribute("type"))||a.toLowerCase()===b.type)},first:m(function(){return[0]}),last:m(function(b,a){return[a-1]}),eq:m(function(b,a,c){return[0>c?c+a:c]}),even:m(function(b,a){for(var c=0;c<a;c+=2)b.push(c);return b}),odd:m(function(b,a){for(var c=1;c<a;c+=2)b.push(c);return b}),lt:m(function(b,a,c){for(a=0>c?c+a:c;0<=--a;)b.push(a);return b}),gt:m(function(b,a,c){for(c=0>c?c+a:c;++c<a;)b.push(c);return b})}};for(q in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})w.pseudos[q]=r(q);for(q in{submit:!0,
  reset:!0})w.pseudos[q]=g(q);J=h.compile=function(b,a){var c,e=[],d=[],f=Ba[b+" "];if(!f){a||(a=y(b));for(c=a.length;c--;)f=v(a[c]),f[D]?e.push(f):d.push(f);f=Ba(b,I(d,e))}return f};w.pseudos.nth=w.pseudos.eq;w.filters=O.prototype=w.pseudos;w.setFilters=new O;F();h.attr=n.attr;n.find=h;n.expr=h.selectors;n.expr[":"]=n.expr.pseudos;n.unique=h.uniqueSort;n.text=h.getText;n.isXMLDoc=h.isXML;n.contains=h.contains})(b);var Mb=/Until$/,Nb=/^(?:parents|prev(?:Until|All))/,tb=/^.[^:#\[\.,]*$/,bb=n.expr.match.needsContext,
  Ob={children:!0,contents:!0,next:!0,prev:!0};n.fn.extend({find:function(b){var a,c,e,d=this.length;if("string"!==typeof b)return e=this,this.pushStack(n(b).filter(function(){for(a=0;a<d;a++)if(n.contains(e[a],this))return!0}));c=[];for(a=0;a<d;a++)n.find(b,this[a],c);c=this.pushStack(1<d?n.unique(c):c);c.selector=(this.selector?this.selector+" ":"")+b;return c},has:function(b){var a,c=n(b,this),e=c.length;return this.filter(function(){for(a=0;a<e;a++)if(n.contains(this,c[a]))return!0})},not:function(b){return this.pushStack(u(this,
  b,!1))},filter:function(b){return this.pushStack(u(this,b,!0))},is:function(b){return!!b&&("string"===typeof b?bb.test(b)?0<=n(b,this.context).index(this[0]):0<n.filter(b,this).length:0<this.filter(b).length)},closest:function(b,a){for(var c,e=0,d=this.length,f=[],h=bb.test(b)||"string"!==typeof b?n(b,a||this.context):0;e<d;e++)for(c=this[e];c&&c.ownerDocument&&c!==a&&11!==c.nodeType;){if(h?-1<h.index(c):n.find.matchesSelector(c,b)){f.push(c);break}c=c.parentNode}return this.pushStack(1<f.length?
  n.unique(f):f)},index:function(b){return b?"string"===typeof b?n.inArray(this[0],n(b)):n.inArray(b.jquery?b[0]:b,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(b,a){var c="string"===typeof b?n(b,a):n.makeArray(b&&b.nodeType?[b]:b),c=n.merge(this.get(),c);return this.pushStack(n.unique(c))},addBack:function(b){return this.add(null==b?this.prevObject:this.prevObject.filter(b))}});n.fn.andSelf=n.fn.addBack;n.each({parent:function(b){return(b=b.parentNode)&&11!==b.nodeType?
  b:null},parents:function(b){return n.dir(b,"parentNode")},parentsUntil:function(b,a,c){return n.dir(b,"parentNode",c)},next:function(b){return q(b,"nextSibling")},prev:function(b){return q(b,"previousSibling")},nextAll:function(b){return n.dir(b,"nextSibling")},prevAll:function(b){return n.dir(b,"previousSibling")},nextUntil:function(b,a,c){return n.dir(b,"nextSibling",c)},prevUntil:function(b,a,c){return n.dir(b,"previousSibling",c)},siblings:function(b){return n.sibling((b.parentNode||{}).firstChild,
  b)},children:function(b){return n.sibling(b.firstChild)},contents:function(b){return n.nodeName(b,"iframe")?b.contentDocument||b.contentWindow.document:n.merge([],b.childNodes)}},function(b,a){n.fn[b]=function(c,e){var d=n.map(this,a,c);Mb.test(b)||(e=c);e&&"string"===typeof e&&(d=n.filter(e,d));d=1<this.length&&!Ob[b]?n.unique(d):d;1<this.length&&Nb.test(b)&&(d=d.reverse());return this.pushStack(d)}});n.extend({filter:function(b,a,c){c&&(b=":not("+b+")");return 1===a.length?n.find.matchesSelector(a[0],
  b)?[a[0]]:[]:n.find.matches(b,a)},dir:function(b,c,e){var d=[];for(b=b[c];b&&9!==b.nodeType&&(e===a||1!==b.nodeType||!n(b).is(e));)1===b.nodeType&&d.push(b),b=b[c];return d},sibling:function(b,a){for(var c=[];b;b=b.nextSibling)1===b.nodeType&&b!==a&&c.push(b);return c}});var Ta="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",Pb=/ jQuery\d+="(?:null|\d+)"/g,cb=new RegExp("<(?:"+Ta+")[\\s/>]",
  "i"),La=/^\s+/,db=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,eb=/<([\w:]+)/,fb=/<tbody/i,Qb=/<|&#?\w+;/,Rb=/<(?:script|style|link)/i,Ea=/^(?:checkbox|radio)$/i,Sb=/checked\s*(?:[^=]|=\s*.checked.)/i,gb=/^$|\/(?:java|ecma)script/i,ub=/^true\/(.*)/,Tb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,X={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],
  tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:n.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},Ma=w(R).appendChild(R.createElement("div"));X.optgroup=X.option;X.tbody=X.tfoot=X.colgroup=X.caption=X.thead;X.th=X.td;n.fn.extend({text:function(b){return n.access(this,function(b){return b===a?n.text(this):this.empty().append((this[0]&&this[0].ownerDocument||R).createTextNode(b))},
  null,b,arguments.length)},wrapAll:function(b){if(n.isFunction(b))return this.each(function(a){n(this).wrapAll(b.call(this,a))});if(this[0]){var a=n(b,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&a.insertBefore(this[0]);a.map(function(){for(var b=this;b.firstChild&&1===b.firstChild.nodeType;)b=b.firstChild;return b}).append(this)}return this},wrapInner:function(b){return n.isFunction(b)?this.each(function(a){n(this).wrapInner(b.call(this,a))}):this.each(function(){var a=n(this),c=a.contents();
  c.length?c.wrapAll(b):a.append(b)})},wrap:function(b){var a=n.isFunction(b);return this.each(function(c){n(this).wrapAll(a?b.call(this,c):b)})},unwrap:function(){return this.parent().each(function(){n.nodeName(this,"body")||n(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(b){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||this.appendChild(b)})},prepend:function(){return this.domManip(arguments,!0,function(b){1!==this.nodeType&&11!==
  this.nodeType&&9!==this.nodeType||this.insertBefore(b,this.firstChild)})},before:function(){return this.domManip(arguments,!1,function(b){this.parentNode&&this.parentNode.insertBefore(b,this)})},after:function(){return this.domManip(arguments,!1,function(b){this.parentNode&&this.parentNode.insertBefore(b,this.nextSibling)})},remove:function(b,a){for(var c,e=0;null!=(c=this[e]);e++)if(!b||0<n.filter(b,[c]).length)a||1!==c.nodeType||n.cleanData(z(c)),c.parentNode&&(a&&n.contains(c.ownerDocument,c)&&
  E(z(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var b,a=0;null!=(b=this[a]);a++){for(1===b.nodeType&&n.cleanData(z(b,!1));b.firstChild;)b.removeChild(b.firstChild);b.options&&n.nodeName(b,"select")&&(b.options.length=0)}return this},clone:function(b,a){b=null==b?!1:b;a=null==a?b:a;return this.map(function(){return n.clone(this,b,a)})},html:function(b){return n.access(this,function(b){var c=this[0]||{},e=0,d=this.length;if(b===a)return 1===c.nodeType?c.innerHTML.replace(Pb,
  ""):a;if(!("string"!==typeof b||Rb.test(b)||!n.support.htmlSerialize&&cb.test(b)||!n.support.leadingWhitespace&&La.test(b)||X[(eb.exec(b)||["",""])[1].toLowerCase()])){b=b.replace(db,"<$1></$2>");try{for(;e<d;e++)c=this[e]||{},1===c.nodeType&&(n.cleanData(z(c,!1)),c.innerHTML=b);c=0}catch(f){}}c&&this.empty().append(b)},null,b,arguments.length)},replaceWith:function(b){n.isFunction(b)||"string"===typeof b||(b=n(b).not(this).detach());return this.domManip([b],!0,function(b){var a=this.nextSibling,
  c=this.parentNode;c&&(n(this).remove(),c.insertBefore(b,a))})},detach:function(b){return this.remove(b,!0)},domManip:function(b,c,e){b=ia.apply([],b);var d,f,h,k,r=0,g=this.length,m=this,y=g-1,t=b[0],p=n.isFunction(t);if(p||!(1>=g||"string"!==typeof t||n.support.checkClone)&&Sb.test(t))return this.each(function(d){var f=m.eq(d);p&&(b[0]=t.call(this,d,c?f.html():a));f.domManip(b,c,e)});if(g&&(k=n.buildFragment(b,this[0].ownerDocument,!1,this),d=k.firstChild,1===k.childNodes.length&&(k=d),d)){c=c&&
  n.nodeName(d,"tr");h=n.map(z(k,"script"),B);for(f=h.length;r<g;r++)d=k,r!==y&&(d=n.clone(d,!0,!0),f&&n.merge(h,z(d,"script"))),e.call(c&&n.nodeName(this[r],"table")?C(this[r],"tbody"):this[r],d,r);if(f)for(k=h[h.length-1].ownerDocument,n.map(h,A),r=0;r<f;r++)d=h[r],gb.test(d.type||"")&&!n._data(d,"globalEval")&&n.contains(k,d)&&(d.src?n.ajax({url:d.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):n.globalEval((d.text||d.textContent||d.innerHTML||"").replace(Tb,"")));k=d=null}return this}});
  n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(b,a){n.fn[b]=function(b){for(var c=0,e=[],d=n(b),f=d.length-1;c<=f;c++)b=c===f?this:this.clone(!0),n(d[c])[a](b),ra.apply(e,b.get());return this.pushStack(e)}});n.extend({clone:function(b,a,c){var e,d,f,h,k,r=n.contains(b.ownerDocument,b);n.support.html5Clone||n.isXMLDoc(b)||!cb.test("<"+b.nodeName+">")?f=b.cloneNode(!0):(Ma.innerHTML=b.outerHTML,Ma.removeChild(f=Ma.firstChild));
  if(!(n.support.noCloneEvent&&n.support.noCloneChecked||1!==b.nodeType&&11!==b.nodeType||n.isXMLDoc(b)))for(e=z(f),k=z(b),h=0;null!=(d=k[h]);++h)if(e[h]){var g=e[h],m=void 0,y=void 0,t=void 0;if(1===g.nodeType){m=g.nodeName.toLowerCase();if(!n.support.noCloneEvent&&g[n.expando]){t=n._data(g);for(y in t.events)n.removeEvent(g,y,t.handle);g.removeAttribute(n.expando)}if("script"===m&&g.text!==d.text)B(g).text=d.text,A(g);else if("object"===m)g.parentNode&&(g.outerHTML=d.outerHTML),n.support.html5Clone&&
  d.innerHTML&&!n.trim(g.innerHTML)&&(g.innerHTML=d.innerHTML);else if("input"===m&&Ea.test(d.type))g.defaultChecked=g.checked=d.checked,g.value!==d.value&&(g.value=d.value);else if("option"===m)g.defaultSelected=g.selected=d.defaultSelected;else if("input"===m||"textarea"===m)g.defaultValue=d.defaultValue}}if(a)if(c)for(k=k||z(b),e=e||z(f),h=0;null!=(d=k[h]);h++)D(d,e[h]);else D(b,f);e=z(f,"script");0<e.length&&E(e,!r&&z(b,"script"));return f},buildFragment:function(b,a,c,e){for(var d,f,h,k,r,g,m=
  b.length,y=w(a),t=[],p=0;p<m;p++)if((f=b[p])||0===f)if("object"===n.type(f))n.merge(t,f.nodeType?[f]:f);else if(Qb.test(f)){h=h||y.appendChild(a.createElement("div"));k=(eb.exec(f)||["",""])[1].toLowerCase();g=X[k]||X._default;h.innerHTML=g[1]+f.replace(db,"<$1></$2>")+g[2];for(d=g[0];d--;)h=h.lastChild;!n.support.leadingWhitespace&&La.test(f)&&t.push(a.createTextNode(La.exec(f)[0]));if(!n.support.tbody)for(d=(f="table"!==k||fb.test(f)?"<table>"!==g[1]||fb.test(f)?0:h:h.firstChild)&&f.childNodes.length;d--;)n.nodeName(r=
  f.childNodes[d],"tbody")&&!r.childNodes.length&&f.removeChild(r);n.merge(t,h.childNodes);for(h.textContent="";h.firstChild;)h.removeChild(h.firstChild);h=y.lastChild}else t.push(a.createTextNode(f));h&&y.removeChild(h);n.support.appendChecked||n.grep(z(t,"input"),M);for(p=0;f=t[p++];)if(!e||-1===n.inArray(f,e))if(b=n.contains(f.ownerDocument,f),h=z(y.appendChild(f),"script"),b&&E(h),c)for(d=0;f=h[d++];)gb.test(f.type||"")&&c.push(f);return y},cleanData:function(b,a){for(var c,e,d,f,h=0,k=n.expando,
  r=n.cache,g=n.support.deleteExpando,m=n.event.special;null!=(c=b[h]);h++)if(a||n.acceptData(c))if(f=(d=c[k])&&r[d]){if(f.events)for(e in f.events)m[e]?n.event.remove(c,e):n.removeEvent(c,e,f.handle);r[d]&&(delete r[d],g?delete c[k]:typeof c.removeAttribute!==V?c.removeAttribute(k):c[k]=null,la.push(d))}}});var ta,aa,fa,Na=/alpha\([^)]*\)/i,Ub=/opacity\s*=\s*([^)]*)/,Vb=/^(top|right|bottom|left)$/,Wb=/^(none|table(?!-c[ea]).+)/,hb=/^margin/,vb=new RegExp("^("+Ca+")(.*)$","i"),za=new RegExp("^("+Ca+
  ")(?!px)[a-z%]+$","i"),Xb=new RegExp("^([+-])=("+Ca+")","i"),Va={BODY:"block"},Yb={position:"absolute",visibility:"hidden",display:"block"},ib={letterSpacing:0,fontWeight:400},Y=["Top","Right","Bottom","Left"],Ua=["Webkit","O","Moz","ms"];n.fn.extend({css:function(b,c){return n.access(this,function(b,c,e){var d,f={},h=0;if(n.isArray(c)){d=aa(b);for(e=c.length;h<e;h++)f[c[h]]=n.css(b,c[h],!1,d);return f}return e!==a?n.style(b,c,e):n.css(b,c)},b,c,1<arguments.length)},show:function(){return N(this,
  !0)},hide:function(){return N(this)},toggle:function(b){var a="boolean"===typeof b;return this.each(function(){(a?b:K(this))?n(this).show():n(this).hide()})}});n.extend({cssHooks:{opacity:{get:function(b,a){if(a){var c=fa(b,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":n.support.cssFloat?"cssFloat":"styleFloat"},style:function(b,c,e,d){if(b&&3!==b.nodeType&&8!==b.nodeType&&
  b.style){var f,h,k,g=n.camelCase(c),m=b.style;c=n.cssProps[g]||(n.cssProps[g]=r(m,g));k=n.cssHooks[c]||n.cssHooks[g];if(e!==a){if(h=typeof e,"string"===h&&(f=Xb.exec(e))&&(e=(f[1]+1)*f[2]+parseFloat(n.css(b,c)),h="number"),!(null==e||"number"===h&&isNaN(e)||("number"!==h||n.cssNumber[g]||(e+="px"),n.support.clearCloneStyle||""!==e||0!==c.indexOf("background")||(m[c]="inherit"),k&&"set"in k&&(e=k.set(b,e,d))===a)))try{m[c]=e}catch(y){}}else return k&&"get"in k&&(f=k.get(b,!1,d))!==a?f:m[c]}},css:function(b,
  c,e,d){var f,h;h=n.camelCase(c);c=n.cssProps[h]||(n.cssProps[h]=r(b.style,h));(h=n.cssHooks[c]||n.cssHooks[h])&&"get"in h&&(f=h.get(b,!0,e));f===a&&(f=fa(b,c,d));"normal"===f&&c in ib&&(f=ib[c]);return""===e||e?(b=parseFloat(f),!0===e||n.isNumeric(b)?b||0:f):f},swap:function(b,a,c,e){var d,f={};for(d in a)f[d]=b.style[d],b.style[d]=a[d];c=c.apply(b,e||[]);for(d in a)b.style[d]=f[d];return c}});b.getComputedStyle?(aa=function(a){return b.getComputedStyle(a,null)},fa=function(b,c,e){var d,f=(e=e||aa(b))?
  e.getPropertyValue(c)||e[c]:a,h=b.style;e&&(""!==f||n.contains(b.ownerDocument,b)||(f=n.style(b,c)),za.test(f)&&hb.test(c)&&(b=h.width,c=h.minWidth,d=h.maxWidth,h.minWidth=h.maxWidth=h.width=f,f=e.width,h.width=b,h.minWidth=c,h.maxWidth=d));return f}):R.documentElement.currentStyle&&(aa=function(b){return b.currentStyle},fa=function(b,c,e){var d,f,h=(e=e||aa(b))?e[c]:a,k=b.style;null==h&&k&&k[c]&&(h=k[c]);if(za.test(h)&&!Vb.test(c)){e=k.left;if(f=(d=b.runtimeStyle)&&d.left)d.left=b.currentStyle.left;
  k.left="fontSize"===c?"1em":h;h=k.pixelLeft+"px";k.left=e;f&&(d.left=f)}return""===h?"auto":h});n.each(["height","width"],function(b,a){n.cssHooks[a]={get:function(b,c,e){if(c)return 0===b.offsetWidth&&Wb.test(n.css(b,"display"))?n.swap(b,Yb,function(){return F(b,a,e)}):F(b,a,e)},set:function(b,c,e){var d=e&&aa(b);return G(b,c,e?x(b,a,e,n.support.boxSizing&&"border-box"===n.css(b,"boxSizing",!1,d),d):0)}}});n.support.opacity||(n.cssHooks.opacity={get:function(b,a){return Ub.test((a&&b.currentStyle?
  b.currentStyle.filter:b.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":a?"1":""},set:function(b,a){var c=b.style,e=b.currentStyle,d=n.isNumeric(a)?"alpha(opacity="+100*a+")":"",f=e&&e.filter||c.filter||"";c.zoom=1;if((1<=a||""===a)&&""===n.trim(f.replace(Na,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===a||e&&!e.filter))return;c.filter=Na.test(f)?f.replace(Na,d):f+" "+d}});n(function(){n.support.reliableMarginRight||(n.cssHooks.marginRight={get:function(b,a){if(a)return n.swap(b,{display:"inline-block"},
  fa,[b,"marginRight"])}});!n.support.pixelPosition&&n.fn.position&&n.each(["top","left"],function(b,a){n.cssHooks[a]={get:function(b,c){if(c)return c=fa(b,a),za.test(c)?n(b).position()[a]+"px":c}}})});n.expr&&n.expr.filters&&(n.expr.filters.hidden=function(b){return 0>=b.offsetWidth&&0>=b.offsetHeight||!n.support.reliableHiddenOffsets&&"none"===(b.style&&b.style.display||n.css(b,"display"))},n.expr.filters.visible=function(b){return!n.expr.filters.hidden(b)});n.each({margin:"",padding:"",border:"Width"},
  function(b,a){n.cssHooks[b+a]={expand:function(c){var e=0,d={};for(c="string"===typeof c?c.split(" "):[c];4>e;e++)d[b+Y[e]+a]=c[e]||c[e-2]||c[0];return d}};hb.test(b)||(n.cssHooks[b+a].set=G)});var Zb=/%20/g,wb=/\[\]$/,jb=/\r?\n/g,$b=/^(?:submit|button|image|reset|file)$/i,ac=/^(?:input|select|textarea|keygen)/i;n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var b=n.prop(this,"elements");return b?n.makeArray(b):this}).filter(function(){var b=
  this.type;return this.name&&!n(this).is(":disabled")&&ac.test(this.nodeName)&&!$b.test(b)&&(this.checked||!Ea.test(b))}).map(function(b,a){var c=n(this).val();return null==c?null:n.isArray(c)?n.map(c,function(b){return{name:a.name,value:b.replace(jb,"\r\n")}}):{name:a.name,value:c.replace(jb,"\r\n")}}).get()}});n.param=function(b,c){var e,d=[],f=function(b,a){a=n.isFunction(a)?a():null==a?"":a;d[d.length]=encodeURIComponent(b)+"="+encodeURIComponent(a)};c===a&&(c=n.ajaxSettings&&n.ajaxSettings.traditional);
  if(n.isArray(b)||b.jquery&&!n.isPlainObject(b))n.each(b,function(){f(this.name,this.value)});else for(e in b)p(e,b[e],c,f);return d.join("&").replace(Zb,"+")};n.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(b,a){n.fn[a]=function(b,c){return 0<arguments.length?this.on(a,null,b,c):this.trigger(a)}});n.fn.hover=function(b,
  a){return this.mouseenter(b).mouseleave(a||b)};var ka,ea,Oa=n.now(),Pa=/\?/,bc=/#.*$/,kb=/([?&])_=[^&]*/,cc=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,dc=/^(?:GET|HEAD)$/,ec=/^\/\//,lb=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,mb=n.fn.load,nb={},Fa={},ob="*/".concat("*");try{ea=Ba.href}catch(jc){ea=R.createElement("a"),ea.href="",ea=ea.href}ka=lb.exec(ea.toLowerCase())||[];n.fn.load=function(b,c,e){if("string"!==typeof b&&mb)return mb.apply(this,arguments);var d,f,h,k=this,r=b.indexOf(" ");0<=r&&(d=b.slice(r,
  b.length),b=b.slice(0,r));n.isFunction(c)?(e=c,c=a):c&&"object"===typeof c&&(h="POST");0<k.length&&n.ajax({url:b,type:h,dataType:"html",data:c}).done(function(b){f=arguments;k.html(d?n("<div>").append(n.parseHTML(b)).find(d):b)}).complete(e&&function(b,a){k.each(e,f||[b.responseText,a,b])});return this};n.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(b,a){n.fn[a]=function(b){return this.on(a,b)}});n.each(["get","post"],function(b,c){n[c]=function(b,e,d,
  f){n.isFunction(e)&&(f=f||d,d=e,e=a);return n.ajax({url:b,type:c,dataType:f,data:e,success:d})}});n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:ea,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(ka[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":ob,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,
  json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":b.String,"text html":!0,"text json":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(b,a){return a?v(v(b,n.ajaxSettings),a):v(n.ajaxSettings,b)},ajaxPrefilter:J(nb),ajaxTransport:J(Fa),ajax:function(b,c){function e(b,c,d,f){var y,I,O,w,u=c;if(2!==q){q=2;r&&clearTimeout(r);m=a;k=f||"";H.readyState=0<b?4:0;if(d){w=t;f=H;var C,J,B,A,F=w.contents,x=w.dataTypes,R=w.responseFields;
  for(A in R)A in d&&(f[R[A]]=d[A]);for(;"*"===x[0];)x.shift(),J===a&&(J=w.mimeType||f.getResponseHeader("Content-Type"));if(J)for(A in F)if(F[A]&&F[A].test(J)){x.unshift(A);break}if(x[0]in d)B=x[0];else{for(A in d){if(!x[0]||w.converters[A+" "+x[0]]){B=A;break}C||(C=A)}B=B||C}B?(B!==x[0]&&x.unshift(B),w=d[B]):w=void 0}if(200<=b&&300>b||304===b)if(t.ifModified&&((d=H.getResponseHeader("Last-Modified"))&&(n.lastModified[h]=d),(d=H.getResponseHeader("etag"))&&(n.etag[h]=d)),204===b)y=!0,u="nocontent";
  else if(304===b)y=!0,u="notmodified";else{a:{I=t;O=w;var M,E,u={};C=0;J=I.dataTypes.slice();B=J[0];I.dataFilter&&(O=I.dataFilter(O,I.dataType));if(J[1])for(E in I.converters)u[E.toLowerCase()]=I.converters[E];for(;d=J[++C];)if("*"!==d){if("*"!==B&&B!==d){E=u[B+" "+d]||u["* "+d];if(!E)for(M in u)if(y=M.split(" "),y[1]===d&&(E=u[B+" "+y[0]]||u["* "+y[0]])){!0===E?E=u[M]:!0!==u[M]&&(d=y[0],J.splice(C--,0,d));break}if(!0!==E)if(E&&I["throws"])O=E(O);else try{O=E(O)}catch(K){y={state:"parsererror",error:E?
  K:"No conversion from "+B+" to "+d};break a}}B=d}y={state:"success",data:O}}u=y.state;I=y.data;O=y.error;y=!O}else if(O=u,b||!u)u="error",0>b&&(b=0);H.status=b;H.statusText=(c||u)+"";y?P.resolveWith(p,[I,u,H]):P.rejectWith(p,[H,u,O]);H.statusCode(v);v=a;g&&l.trigger(y?"ajaxSuccess":"ajaxError",[H,t,y?I:O]);z.fireWith(p,[H,u]);g&&(l.trigger("ajaxComplete",[H,t]),--n.active||n.event.trigger("ajaxStop"))}}"object"===typeof b&&(c=b,b=a);c=c||{};var d,f,h,k,r,g,m,y,t=n.ajaxSetup({},c),p=t.context||t,l=
  t.context&&(p.nodeType||p.jquery)?n(p):n.event,P=n.Deferred(),z=n.Callbacks("once memory"),v=t.statusCode||{},O={},w={},q=0,u="canceled",H={readyState:0,getResponseHeader:function(b){var a;if(2===q){if(!y)for(y={};a=cc.exec(k);)y[a[1].toLowerCase()]=a[2];a=y[b.toLowerCase()]}return null==a?null:a},getAllResponseHeaders:function(){return 2===q?k:null},setRequestHeader:function(b,a){var c=b.toLowerCase();q||(b=w[c]=w[c]||b,O[b]=a);return this},overrideMimeType:function(b){q||(t.mimeType=b);return this},
  statusCode:function(b){var a;if(b)if(2>q)for(a in b)v[a]=[v[a],b[a]];else H.always(b[H.status]);return this},abort:function(b){b=b||u;m&&m.abort(b);e(0,b);return this}};P.promise(H).complete=z.add;H.success=H.done;H.error=H.fail;t.url=((b||t.url||ea)+"").replace(bc,"").replace(ec,ka[1]+"//");t.type=c.method||c.type||t.method||t.type;t.dataTypes=n.trim(t.dataType||"*").toLowerCase().match(Z)||[""];null==t.crossDomain&&(d=lb.exec(t.url.toLowerCase()),t.crossDomain=!(!d||d[1]===ka[1]&&d[2]===ka[2]&&
  (d[3]||("http:"===d[1]?80:443))==(ka[3]||("http:"===ka[1]?80:443))));t.data&&t.processData&&"string"!==typeof t.data&&(t.data=n.param(t.data,t.traditional));I(nb,t,c,H);if(2===q)return H;(g=t.global)&&0===n.active++&&n.event.trigger("ajaxStart");t.type=t.type.toUpperCase();t.hasContent=!dc.test(t.type);h=t.url;t.hasContent||(t.data&&(h=t.url+=(Pa.test(h)?"&":"?")+t.data,delete t.data),!1===t.cache&&(t.url=kb.test(h)?h.replace(kb,"$1_="+Oa++):h+(Pa.test(h)?"&":"?")+"_="+Oa++));t.ifModified&&(n.lastModified[h]&&
  H.setRequestHeader("If-Modified-Since",n.lastModified[h]),n.etag[h]&&H.setRequestHeader("If-None-Match",n.etag[h]));(t.data&&t.hasContent&&!1!==t.contentType||c.contentType)&&H.setRequestHeader("Content-Type",t.contentType);H.setRequestHeader("Accept",t.dataTypes[0]&&t.accepts[t.dataTypes[0]]?t.accepts[t.dataTypes[0]]+("*"!==t.dataTypes[0]?", "+ob+"; q=0.01":""):t.accepts["*"]);for(f in t.headers)H.setRequestHeader(f,t.headers[f]);if(t.beforeSend&&(!1===t.beforeSend.call(p,H,t)||2===q))return H.abort();
  u="abort";for(f in{success:1,error:1,complete:1})H[f](t[f]);if(m=I(Fa,t,c,H)){H.readyState=1;g&&l.trigger("ajaxSend",[H,t]);t.async&&0<t.timeout&&(r=setTimeout(function(){H.abort("timeout")},t.timeout));try{q=1,m.send(O,e)}catch(C){if(2>q)e(-1,C);else throw C;}}else e(-1,"No Transport");return H},getScript:function(b,c){return n.get(b,a,c,"script")},getJSON:function(b,a,c){return n.get(b,a,c,"json")}});n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},
  contents:{script:/(?:java|ecma)script/},converters:{"text script":function(b){n.globalEval(b);return b}}});n.ajaxPrefilter("script",function(b){b.cache===a&&(b.cache=!1);b.crossDomain&&(b.type="GET",b.global=!1)});n.ajaxTransport("script",function(b){if(b.crossDomain){var c,e=R.head||n("head")[0]||R.documentElement;return{send:function(a,d){c=R.createElement("script");c.async=!0;b.scriptCharset&&(c.charset=b.scriptCharset);c.src=b.url;c.onload=c.onreadystatechange=function(b,a){if(a||!c.readyState||
  /loaded|complete/.test(c.readyState))c.onload=c.onreadystatechange=null,c.parentNode&&c.parentNode.removeChild(c),c=null,a||d(200,"success")};e.insertBefore(c,e.firstChild)},abort:function(){if(c)c.onload(a,!0)}}}});var pb=[],Qa=/(=)\?(?=&|$)|\?\?/;n.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var b=pb.pop()||n.expando+"_"+Oa++;this[b]=!0;return b}});n.ajaxPrefilter("json jsonp",function(c,e,d){var f,h,k,r=!1!==c.jsonp&&(Qa.test(c.url)?"url":"string"===typeof c.data&&!(c.contentType||"").indexOf("application/x-www-form-urlencoded")&&
  Qa.test(c.data)&&"data");if(r||"jsonp"===c.dataTypes[0])return f=c.jsonpCallback=n.isFunction(c.jsonpCallback)?c.jsonpCallback():c.jsonpCallback,r?c[r]=c[r].replace(Qa,"$1"+f):!1!==c.jsonp&&(c.url+=(Pa.test(c.url)?"&":"?")+c.jsonp+"="+f),c.converters["script json"]=function(){k||n.error(f+" was not called");return k[0]},c.dataTypes[0]="json",h=b[f],b[f]=function(){k=arguments},d.always(function(){b[f]=h;c[f]&&(c.jsonpCallback=e.jsonpCallback,pb.push(f));k&&n.isFunction(h)&&h(k[0]);k=h=a}),"script"});
  var qa,ya,fc=0,Ra=b.ActiveXObject&&function(){for(var b in qa)qa[b](a,!0)};n.ajaxSettings.xhr=b.ActiveXObject?function(){var a;if(!(a=!this.isLocal&&y()))a:{try{a=new b.ActiveXObject("Microsoft.XMLHTTP");break a}catch(c){}a=void 0}return a}:y;ya=n.ajaxSettings.xhr();n.support.cors=!!ya&&"withCredentials"in ya;(ya=n.support.ajax=!!ya)&&n.ajaxTransport(function(c){if(!c.crossDomain||n.support.cors){var e;return{send:function(d,f){var h,k,r=c.xhr();c.username?r.open(c.type,c.url,c.async,c.username,c.password):
  r.open(c.type,c.url,c.async);if(c.xhrFields)for(k in c.xhrFields)r[k]=c.xhrFields[k];c.mimeType&&r.overrideMimeType&&r.overrideMimeType(c.mimeType);c.crossDomain||d["X-Requested-With"]||(d["X-Requested-With"]="XMLHttpRequest");try{for(k in d)r.setRequestHeader(k,d[k])}catch(g){}r.send(c.hasContent&&c.data||null);e=function(b,d){var k,g,m,t;try{if(e&&(d||4===r.readyState))if(e=a,h&&(r.onreadystatechange=n.noop,Ra&&delete qa[h]),d)4!==r.readyState&&r.abort();else{t={};k=r.status;g=r.getAllResponseHeaders();
  "string"===typeof r.responseText&&(t.text=r.responseText);try{m=r.statusText}catch(y){m=""}k||!c.isLocal||c.crossDomain?1223===k&&(k=204):k=t.text?200:404}}catch(p){d||f(-1,p)}t&&f(k,m,t,g)};c.async?4===r.readyState?setTimeout(e):(h=++fc,Ra&&(qa||(qa={},n(b).unload(Ra)),qa[h]=e),r.onreadystatechange=e):e()},abort:function(){e&&e(a,!0)}}}});var ma,Da,gc=/^(?:toggle|show|hide)$/,hc=new RegExp("^(?:([+-])=|)("+Ca+")([a-z%]*)$","i"),ic=/queueHooks$/,Aa=[function(b,a,c){var e,d,f,h,k,r,g=this,m=b.style,
  y={},p=[],l=b.nodeType&&K(b);c.queue||(k=n._queueHooks(b,"fx"),null==k.unqueued&&(k.unqueued=0,r=k.empty.fire,k.empty.fire=function(){k.unqueued||r()}),k.unqueued++,g.always(function(){g.always(function(){k.unqueued--;n.queue(b,"fx").length||k.empty.fire()})}));1===b.nodeType&&("height"in a||"width"in a)&&(c.overflow=[m.overflow,m.overflowX,m.overflowY],"inline"===n.css(b,"display")&&"none"===n.css(b,"float")&&(n.support.inlineBlockNeedsLayout&&"inline"!==t(b.nodeName)?m.zoom=1:m.display="inline-block"));
  c.overflow&&(m.overflow="hidden",n.support.shrinkWrapBlocks||g.always(function(){m.overflow=c.overflow[0];m.overflowX=c.overflow[1];m.overflowY=c.overflow[2]}));for(d in a)f=a[d],gc.exec(f)&&(delete a[d],e=e||"toggle"===f,f!==(l?"hide":"show")&&p.push(d));if(a=p.length)for(f=n._data(b,"fxshow")||n._data(b,"fxshow",{}),("hidden"in f)&&(l=f.hidden),e&&(f.hidden=!l),l?n(b).show():g.done(function(){n(b).hide()}),g.done(function(){var a;n._removeData(b,"fxshow");for(a in y)n.style(b,a,y[a])}),d=0;d<a;d++)e=
  p[d],h=g.createTween(e,l?f[e]:0),y[e]=f[e]||n.style(b,e),e in f||(f[e]=h.start,l&&(h.end=h.start,h.start="width"===e||"height"===e?1:0))}],va={"*":[function(b,a){var c,e,d=this.createTween(b,a),f=hc.exec(a),h=d.cur(),k=+h||0,r=1,g=20;if(f){c=+f[2];e=f[3]||(n.cssNumber[b]?"":"px");if("px"!==e&&k){k=n.css(d.elem,b,!0)||c||1;do r=r||".5",k/=r,n.style(d.elem,b,k+e);while(r!==(r=d.cur()/h)&&1!==r&&--g)}d.unit=e;d.start=k;d.end=f[1]?k+(f[1]+1)*c:c}return d}]};n.Animation=n.extend(S,{tweener:function(b,
  a){n.isFunction(b)?(a=b,b=["*"]):b=b.split(" ");for(var c,e=0,d=b.length;e<d;e++)c=b[e],va[c]=va[c]||[],va[c].unshift(a)},prefilter:function(b,a){a?Aa.unshift(b):Aa.push(b)}});n.Tween=P;P.prototype={constructor:P,init:function(b,a,c,e,d,f){this.elem=b;this.prop=c;this.easing=d||"swing";this.options=a;this.start=this.now=this.cur();this.end=e;this.unit=f||(n.cssNumber[c]?"":"px")},cur:function(){var b=P.propHooks[this.prop];return b&&b.get?b.get(this):P.propHooks._default.get(this)},run:function(b){var a,
  c=P.propHooks[this.prop];this.pos=this.options.duration?a=n.easing[this.easing](b,this.options.duration*b,0,1,this.options.duration):a=b;this.now=(this.end-this.start)*a+this.start;this.options.step&&this.options.step.call(this.elem,this.now,this);c&&c.set?c.set(this):P.propHooks._default.set(this);return this}};P.prototype.init.prototype=P.prototype;P.propHooks={_default:{get:function(b){return null==b.elem[b.prop]||b.elem.style&&null!=b.elem.style[b.prop]?(b=n.css(b.elem,b.prop,""))&&"auto"!==b?
  b:0:b.elem[b.prop]},set:function(b){if(n.fx.step[b.prop])n.fx.step[b.prop](b);else b.elem.style&&(null!=b.elem.style[n.cssProps[b.prop]]||n.cssHooks[b.prop])?n.style(b.elem,b.prop,b.now+b.unit):b.elem[b.prop]=b.now}}};P.propHooks.scrollTop=P.propHooks.scrollLeft={set:function(b){b.elem.nodeType&&b.elem.parentNode&&(b.elem[b.prop]=b.now)}};n.each(["toggle","show","hide"],function(b,a){var c=n.fn[a];n.fn[a]=function(b,e,d){return null==b||"boolean"===typeof b?c.apply(this,arguments):this.animate(Q(a,
  !0),b,e,d)}});n.fn.extend({fadeTo:function(b,a,c,e){return this.filter(K).css("opacity",0).show().end().animate({opacity:a},b,c,e)},animate:function(b,a,c,e){var d=n.isEmptyObject(b),f=n.speed(a,c,e),h=function(){var a=S(this,n.extend({},b),f);h.finish=function(){a.stop(!0)};(d||n._data(this,"finish"))&&a.stop(!0)};h.finish=h;return d||!1===f.queue?this.each(h):this.queue(f.queue,h)},stop:function(b,c,e){var d=function(b){var a=b.stop;delete b.stop;a(e)};"string"!==typeof b&&(e=c,c=b,b=a);c&&!1!==
  b&&this.queue(b||"fx",[]);return this.each(function(){var a=!0,c=null!=b&&b+"queueHooks",f=n.timers,h=n._data(this);if(c)h[c]&&h[c].stop&&d(h[c]);else for(c in h)h[c]&&h[c].stop&&ic.test(c)&&d(h[c]);for(c=f.length;c--;)f[c].elem!==this||null!=b&&f[c].queue!==b||(f[c].anim.stop(e),a=!1,f.splice(c,1));!a&&e||n.dequeue(this,b)})},finish:function(b){!1!==b&&(b=b||"fx");return this.each(function(){var a,c=n._data(this),e=c[b+"queue"];a=c[b+"queueHooks"];var d=n.timers,f=e?e.length:0;c.finish=!0;n.queue(this,
  b,[]);a&&a.cur&&a.cur.finish&&a.cur.finish.call(this);for(a=d.length;a--;)d[a].elem===this&&d[a].queue===b&&(d[a].anim.stop(!0),d.splice(a,1));for(a=0;a<f;a++)e[a]&&e[a].finish&&e[a].finish.call(this);delete c.finish})}});n.each({slideDown:Q("show"),slideUp:Q("hide"),slideToggle:Q("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(b,a){n.fn[b]=function(b,c,e){return this.animate(a,b,c,e)}});n.speed=function(b,a,c){var e=b&&"object"===typeof b?n.extend({},
  b):{complete:c||!c&&a||n.isFunction(b)&&b,duration:b,easing:c&&a||a&&!n.isFunction(a)&&a};e.duration=n.fx.off?0:"number"===typeof e.duration?e.duration:e.duration in n.fx.speeds?n.fx.speeds[e.duration]:n.fx.speeds._default;if(null==e.queue||!0===e.queue)e.queue="fx";e.old=e.complete;e.complete=function(){n.isFunction(e.old)&&e.old.call(this);e.queue&&n.dequeue(this,e.queue)};return e};n.easing={linear:function(b){return b},swing:function(b){return.5-Math.cos(b*Math.PI)/2}};n.timers=[];n.fx=P.prototype.init;
  n.fx.tick=function(){var b,c=n.timers,e=0;for(ma=n.now();e<c.length;e++)b=c[e],b()||c[e]!==b||c.splice(e--,1);c.length||n.fx.stop();ma=a};n.fx.timer=function(b){b()&&n.timers.push(b)&&n.fx.start()};n.fx.interval=13;n.fx.start=function(){Da||(Da=setInterval(n.fx.tick,n.fx.interval))};n.fx.stop=function(){clearInterval(Da);Da=null};n.fx.speeds={slow:600,fast:200,_default:400};n.fx.step={};n.expr&&n.expr.filters&&(n.expr.filters.animated=function(b){return n.grep(n.timers,function(a){return b===a.elem}).length});
  n.fn.offset=function(b){if(arguments.length)return b===a?this:this.each(function(a){n.offset.setOffset(this,b,a)});var c,e,d={top:0,left:0},f=(e=this[0])&&e.ownerDocument;if(f){c=f.documentElement;if(!n.contains(c,e))return d;typeof e.getBoundingClientRect!==V&&(d=e.getBoundingClientRect());e=U(f);return{top:d.top+(e.pageYOffset||c.scrollTop)-(c.clientTop||0),left:d.left+(e.pageXOffset||c.scrollLeft)-(c.clientLeft||0)}}};n.offset={setOffset:function(b,a,c){var e=n.css(b,"position");"static"===e&&
  (b.style.position="relative");var d=n(b),f=d.offset(),h=n.css(b,"top"),k=n.css(b,"left"),r={},g={};("absolute"===e||"fixed"===e)&&-1<n.inArray("auto",[h,k])?(g=d.position(),e=g.top,k=g.left):(e=parseFloat(h)||0,k=parseFloat(k)||0);n.isFunction(a)&&(a=a.call(b,c,f));null!=a.top&&(r.top=a.top-f.top+e);null!=a.left&&(r.left=a.left-f.left+k);"using"in a?a.using.call(b,r):d.css(r)}};n.fn.extend({position:function(){if(this[0]){var b,a,c={top:0,left:0},e=this[0];"fixed"===n.css(e,"position")?a=e.getBoundingClientRect():
  (b=this.offsetParent(),a=this.offset(),n.nodeName(b[0],"html")||(c=b.offset()),c.top+=n.css(b[0],"borderTopWidth",!0),c.left+=n.css(b[0],"borderLeftWidth",!0));return{top:a.top-c.top-n.css(e,"marginTop",!0),left:a.left-c.left-n.css(e,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var b=this.offsetParent||R.documentElement;b&&!n.nodeName(b,"html")&&"static"===n.css(b,"position");)b=b.offsetParent;return b||R.documentElement})}});n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},
  function(b,c){var e=/Y/.test(c);n.fn[b]=function(d){return n.access(this,function(b,d,f){var h=U(b);if(f===a)return h?c in h?h[c]:h.document.documentElement[d]:b[d];h?h.scrollTo(e?n(h).scrollLeft():f,e?f:n(h).scrollTop()):b[d]=f},b,d,arguments.length,null)}});n.each({Height:"height",Width:"width"},function(b,c){n.each({padding:"inner"+b,content:c,"":"outer"+b},function(e,d){n.fn[d]=function(d,f){var h=arguments.length&&(e||"boolean"!==typeof d),k=e||(!0===d||!0===f?"margin":"border");return n.access(this,
  function(c,e,d){return n.isWindow(c)?c.document.documentElement["client"+b]:9===c.nodeType?(e=c.documentElement,Math.max(c.body["scroll"+b],e["scroll"+b],c.body["offset"+b],e["offset"+b],e["client"+b])):d===a?n.css(c,e,k):n.style(c,e,d,k)},c,h?d:a,h,null)}})});b.jQuery=b.$=n;"function"===typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return n})})(window);
  var Base64Binary={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",decodeArrayBuffer:function(b){var a=this._keyStr.indexOf(b.charAt(b.length-1)),c=this._keyStr.indexOf(b.charAt(b.length-2)),d=b.length/4*3;64==a&&d--;64==c&&d--;a=new ArrayBuffer(d);this.decode(b,a,d);return a},decode:function(b,a,c){var d,e,f,h,g,m=0,l=0;a=a?new Uint8Array(a):new Uint8Array(c);b=b.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(m=0;m<c;m+=3)d=this._keyStr.indexOf(b.charAt(l++)),e=this._keyStr.indexOf(b.charAt(l++)),
  h=this._keyStr.indexOf(b.charAt(l++)),g=this._keyStr.indexOf(b.charAt(l++)),d=d<<2|e>>4,e=(e&15)<<4|h>>2,f=(h&3)<<6|g,a[m]=d,64!=h&&(a[m+1]=e),64!=g&&(a[m+2]=f);return a}};
  !function(b,a){"undefined"!=typeof module&&module.exports?module.exports.browser=a():"function"==typeof define?define(a):this[b]=a()}("bowser",function(){function b(b,a,c){return(b=b.match(a))&&b.length>c&&b[c]||0}function a(a){var d=/(msie|trident)/i.test(a),h=/chrome|crios/i.test(a),g=/phantom/i.test(a),m=/iphone/i.test(a),l=/ipad/i.test(a),q=/ipod/i.test(a),u=/touchpad/i.test(a),w=/silk/i.test(a),C=/safari/i.test(a)&&!h&&!g&&!w,B=/android/i.test(a),A=/opera/i.test(a)||/opr/i.test(a),E=/firefox/i.test(a),
  D=/gecko\//i.test(a),z=/seamonkey\//i.test(a),M=/webos/i.test(a),r=/windows phone/i.test(a),K=/blackberry/i.test(a),N=/version\/(\d+(\.\d+)?)/i,G=/firefox[ \/](\d+(\.\d+)?)/i,x={};q&&(m=!1);if(r)x={name:"Windows Phone",windowsphone:!0,msie:!0,mobile:!0,version:b(a,/iemobile\/(\d+(\.\d+)?)/i,1)};else if(A)c=b(a,N,1)||b(a,/opr\/(\d+(\.\d+)?)/i,1)||b(a,/opera[ \/](\d+(\.\d+)?)/i,1),x={name:"Opera",opera:!0,version:c},B&&(x.android=!0,x.mobile=!0),h&&(x.webkit=!0);else if(d)x={name:"Internet Explorer",
  msie:!0,version:b(a,/(msie |rv:)(\d+(\.\d+)?)/i,2)};else if(h){x={name:"Chrome",webkit:!0,chrome:!0,version:b(a,/(?:chrome|crios)\/(\d+(\.\d+)?)/i,1)};B&&(x.android=!0);if(l||q||m)x[m?"iphone":l?"ipad":"ipod"]=!0,x.ios=!0;if(x.android||x.ios)x.mobile=!0}else g?x={name:"PhantomJS",webkit:!0,phantom:!0,version:b(a,/phantomjs\/(\d+(\.\d+)?)/i,1)}:u?x={name:"TouchPad",webkit:!0,touchpad:!0,version:b(a,/touchpad\/(\d+(\.\d+)?)/i,1)}:w?x={name:"Amazon Silk",webkit:!0,android:!0,mobile:!0,version:b(a,/silk\/(\d+(\.\d+)?)/i,
  1)}:m||l||q?(x={name:m?"iPhone":l?"iPad":"iPod",webkit:!0,mobile:!0,ios:!0},x[m?"iphone":l?"ipad":"ipod"]=!0,N.test(a)&&(x.version=b(a,N,1))):K?(x={name:"BlackBerry",blackberry:!0,mobile:!0},(c=b(a,N,1))?(x.version=c,x.webkit=!0):x.version=b(a,/blackberry[\d]+\/(\d+(\.\d+)?)/i,1)):M?x={name:"WebOS",mobile:!0,webkit:!0,webos:!0,version:b(a,N,1)||b(a,/wosbrowser\/(\d+(\.\d+)?)/i,1)}:D?(x={name:"Gecko",gecko:!0,mozilla:!0,version:b(a,G,1)},z?(x.name="SeaMonkey",x.seamonkey=!0,x.version=b(a,/seamonkey\/(\d+(\.\d+)?)/i,
  1)):E&&(x.name="Firefox",x.firefox=!0),B?(x.android=!0,x.mobile=!0):!B&&E&&/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(a)&&(x.firefoxos=!0,x.mobile=!0)):B?x={name:"Android",webkit:!0,android:!0,mobile:!0,version:b(a,N,1)}:C&&(x={name:"Safari",webkit:!0,safari:!0,version:b(a,N,1)});if(B){if(a=b(a,/android[ \/](\d+(\.\d+)*)/i,1))x.osversion=a}else if(m||l||q){if(a=b(a,/os (\d+([_\s]\d+)*) like mac os x/i,1))x.osversion=a.replace(/[_\s]/g,".")}else r&&(a=b(a,/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,
  1))&&(x.osversion=a);x.msie&&9<=x.version||x.chrome&&20<=x.version||x.firefox&&10<=x.version||x.safari&&5<=x.version||x.opera&&10<=x.version||x.ios&&x.osversion&&6<=x.osversion.split(".")[0]?x.a=!0:x.msie&&9>x.version||x.chrome&&20>x.version||x.firefox&&10>x.version||x.safari&&5>x.version||x.opera&&10>x.version||x.ios&&x.osversion&&6>x.osversion.split(".")[0]?x.c=!0:x.x=!0;return x}var c,d=a("undefined"!==typeof navigator?navigator.userAgent:"");d._detect=a;return d});"use strict";
  var numeric={inv:function(b){var a=numeric.dim(b),c=Math.abs,d=a[0],a=a[1],e=b.clone(),f,h,g=numeric.identity(d),m,l,q,u,w;for(u=0;u<a;++u){h=b=-1;for(q=u;q!==d;++q)w=c(e[q][u]),w>h&&(b=q,h=w);h=e[b];e[b]=e[u];e[u]=h;l=g[b];g[b]=g[u];g[u]=l;b=h[u];for(w=u;w!==a;++w)h[w]/=b;for(w=a-1;-1!==w;--w)l[w]/=b;for(q=d-1;-1!==q;--q)if(q!==u){f=e[q];m=g[q];b=f[u];for(w=u+1;w!==a;++w)f[w]-=h[w]*b;for(w=a-1;0<w;--w)m[w]-=l[w]*b,--w,m[w]-=l[w]*b;0===w&&(m[0]-=l[0]*b)}}return g},dim:function(b){var a,c;return"object"===
  typeof b?(a=b[0],"object"===typeof a?(c=a[0],"object"===typeof c?numeric._dim(b):[b.length,a.length]):[b.length]):[]},_dim:function(b){for(var a=[];"object"===typeof b;)a.push(b.length),b=b[0];return a},identity:function(b){return numeric.diag(numeric.rep([b],1))},rep:function(b,a,c){"undefined"===typeof c&&(c=0);var d=b[c],e=Array(d);if(c===b.length-1){for(d-=2;0<=d;d-=2)e[d+1]=a,e[d]=a;-1===d&&(e[0]=a);return e}for(--d;0<=d;d--)e[d]=numeric.rep(b,a,c+1);return e},diag:function(b){var a,c,d,e=b.length,
  f=Array(e),h;for(a=e-1;0<=a;a--){h=Array(e);c=a+2;for(d=e-1;d>=c;d-=2)h[d]=0,h[d-1]=0;d>a&&(h[d]=0);h[a]=b[a];for(d=a-1;1<=d;d-=2)h[d]=0,h[d-1]=0;0===d&&(h[0]=0);f[a]=h}return f}};
  !function(b){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=b();else if("function"==typeof define&&define.amd)define([],b);else{var a;"undefined"!=typeof window?a=window:"undefined"!=typeof global?a=global:"undefined"!=typeof self&&(a=self);a.pako=b()}}(function(){return function a(c,d,e){function f(g,l){if(!d[g]){if(!c[g]){var q="function"==typeof require&&require;if(!l&&q)return q(g,!0);if(h)return h(g,!0);throw Error("Cannot find module '"+g+"'");}q=d[g]={exports:{}};c[g][0].call(q.exports,
  function(a){var e=c[g][1][a];return f(e?e:a)},q,q.exports,a,c,d,e)}return d[g].exports}for(var h="function"==typeof require&&require,g=0;g<e.length;g++)f(e[g]);return f}({1:[function(a,c,d){function e(a,c,e,d){c=new w(c);c.onFinish=d;c.push(a,!0,e)}var f=a("./zlib/inflate.js"),h=a("./utils/common"),g=a("./utils/strings"),m=a("./zlib/constants"),l=a("./zlib/messages"),q=a("./zlib/zstream"),u=a("./zlib/gzheader"),w=function(a){var c=this.options=h.assign({chunkSize:16384,windowBits:0,to:""},a||{});
  c.raw&&0<=c.windowBits&&16>c.windowBits&&(c.windowBits=-c.windowBits,0===c.windowBits&&(c.windowBits=-15));!(0<=c.windowBits&&16>c.windowBits)||a&&a.windowBits||(c.windowBits+=32);15<c.windowBits&&48>c.windowBits&&0===(c.windowBits&15)&&(c.windowBits|=15);this.err=0;this.msg="";this.ended=!1;this.chunks=[];this.strm=new q;this.strm.avail_out=0;a=f.inflateInit2(this.strm,c.windowBits);if(a!==m.Z_OK)throw Error(l[a]);this.header=new u;f.inflateGetHeader(this.strm,this.header)};w.prototype.push=function(a,
  c,e){var d=this.strm;c=this.options.chunkSize;if(this.ended)return!1;d.input="string"===typeof a?g.binstring2buf(a):a;d.next_in=0;d.avail_in=d.input.length;a=(new DataView(a.buffer)).getUint32(a.byteLength-4,!0);this.progressMeter=e;this.progressIterations=a/c;this.progressIndex=0;this.progressNextGoal=.25;this.progressMeter&&this.progressMeter.drawProgress(.1,"Unpacking");setTimeout(this.pushProcess.bind(this),0)};w.prototype.pushProcess=function(){var a=this.strm,c=this.options.chunkSize,e,d,g;
  do{0===a.avail_out&&(a.output=new h.Buf8(c),a.next_out=0,a.avail_out=c);e=f.inflate(a,m.Z_NO_FLUSH);if(e!==m.Z_STREAM_END&&e!==m.Z_OK)return this.onEnd(e),this.ended=!0,!1;if(a.next_out&&(0===a.avail_out||e===m.Z_STREAM_END||0===a.avail_in&&d===m.Z_FINISH))this.onData(h.shrinkBuf(a.output,a.next_out));this.progressIndex+=1;g=this.progressIndex/this.progressIterations;this.progressMeter&&this.progressMeter.drawProgress(g,"Unpacking")}while(g<this.progressNextGoal&&(0<a.avail_in||0===a.avail_out)&&
  e!==m.Z_STREAM_END);(0<a.avail_in||0===a.avail_out)&&e!==m.Z_STREAM_END?(this.progressNextGoal+=.1,setTimeout(this.pushProcess.bind(this),0)):(e===m.Z_STREAM_END&&(d=m.Z_FINISH),d===m.Z_FINISH&&(e=f.inflateEnd(this.strm),this.onEnd(e),this.ended=!0),this.onFinish(this.result))};w.prototype.onData=function(a){this.chunks.push(a)};w.prototype.onEnd=function(a){a===m.Z_OK&&(this.result="string"===this.options.to?this.chunks.join(""):h.flattenChunks(this.chunks));this.chunks=[];this.err=a;this.msg=this.strm.msg};
  d.Inflate=w;d.inflate=e;d.inflateRaw=function(a,c){c=c||{};c.raw=!0;return e(a,c)};d.ungzip=e},{"./utils/common":2,"./utils/strings":3,"./zlib/constants":5,"./zlib/gzheader":7,"./zlib/inflate.js":9,"./zlib/messages":11,"./zlib/zstream":12}],2:[function(a,c,d){a="undefined"!==typeof Uint8Array&&"undefined"!==typeof Uint16Array&&"undefined"!==typeof Int32Array;d.assign=function(a){for(var c=Array.prototype.slice.call(arguments,1);c.length;){var e=c.shift();if(e){if("object"!==typeof e)throw new TypeError(e+
  "must be non-object");for(var d in e)e.hasOwnProperty(d)&&(a[d]=e[d])}}return a};d.shrinkBuf=function(a,c){if(a.length===c)return a;if(a.subarray)return a.subarray(0,c);a.length=c;return a};var e={arraySet:function(a,c,e,d,f){if(c.subarray&&a.subarray)a.set(c.subarray(e,e+d),f);else for(var u=0;u<d;u++)a[f+u]=c[e+u]},flattenChunks:function(a){var c,e,d,f,u;c=d=0;for(e=a.length;c<e;c++)d+=a[c].length;u=new Uint8Array(d);c=d=0;for(e=a.length;c<e;c++)f=a[c],u.set(f,d),d+=f.length;return u}},f={arraySet:function(a,
  c,e,d,f){for(var u=0;u<d;u++)a[f+u]=c[e+u]},flattenChunks:function(a){return[].concat.apply([],a)}};d.setTyped=function(a){a?(d.Buf8=Uint8Array,d.Buf16=Uint16Array,d.Buf32=Int32Array,d.assign(d,e)):(d.Buf8=Array,d.Buf16=Array,d.Buf32=Array,d.assign(d,f))};d.setTyped(a)},{}],3:[function(a,c,d){function e(a,c){if(65537>c&&(a.subarray&&g||!a.subarray&&h))return String.fromCharCode.apply(null,f.shrinkBuf(a,c));for(var e="",d=0;d<c;d++)e+=String.fromCharCode(a[d]);return e}var f=a("./common"),h=!0,g=!0;
  try{String.fromCharCode.apply(null,[0])}catch(m){h=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(l){g=!1}var q=new f.Buf8(256);for(a=0;256>a;a++)q[a]=252<=a?6:248<=a?5:240<=a?4:224<=a?3:192<=a?2:1;q[254]=q[254]=1;d.string2buf=function(a){var c,e,d,h,g,m=a.length,l=0;for(h=0;h<m;h++)e=a.charCodeAt(h),55296===(e&64512)&&h+1<m&&(d=a.charCodeAt(h+1),56320===(d&64512)&&(e=65536+(e-55296<<10)+(d-56320),h++)),l+=128>e?1:2048>e?2:65536>e?3:4;c=new f.Buf8(l);for(h=g=0;g<l;h++)e=a.charCodeAt(h),
  55296===(e&64512)&&h+1<m&&(d=a.charCodeAt(h+1),56320===(d&64512)&&(e=65536+(e-55296<<10)+(d-56320),h++)),128>e?c[g++]=e:(2048>e?c[g++]=192|e>>>6:(65536>e?c[g++]=224|e>>>12:(c[g++]=240|e>>>18,c[g++]=128|e>>>12&63),c[g++]=128|e>>>6&63),c[g++]=128|e&63);return c};d.buf2binstring=function(a){return e(a,a.length)};d.binstring2buf=function(a){for(var c=new f.Buf8(a.length),e=0,d=c.length;e<d;e++)c[e]=a.charCodeAt(e);return c};d.buf2string=function(a,c){var d,f,h,g,m=c||a.length,l=Array(2*m);for(d=f=0;d<
  m;)if(h=a[d++],128>h)l[f++]=h;else if(g=q[h],4<g)l[f++]=65533,d+=g-1;else{for(h&=2===g?31:3===g?15:7;1<g&&d<m;)h=h<<6|a[d++]&63,g--;1<g?l[f++]=65533:65536>h?l[f++]=h:(h-=65536,l[f++]=55296|h>>10&1023,l[f++]=56320|h&1023)}return e(l,f)};d.utf8border=function(a,c){var e;c=c||a.length;c>a.length&&(c=a.length);for(e=c-1;0<=e&&128===(a[e]&192);)e--;return 0>e||0===e?c:e+q[a[e]]>c?e:c}},{"./common":2}],4:[function(a,c,d){c.exports=function(a,c,d,g){var m=a&65535|0;a=a>>>16&65535|0;for(var l=0;0!==d;){l=
  2E3<d?2E3:d;d-=l;do m=m+c[g++]|0,a=a+m|0;while(--l);m%=65521;a%=65521}return m|a<<16|0}},{}],5:[function(a,c,d){c.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},
  {}],6:[function(a,c,d){var e=function(){for(var a,c=[],e=0;256>e;e++){a=e;for(var d=0;8>d;d++)a=a&1?3988292384^a>>>1:a>>>1;c[e]=a}return c}();c.exports=function(a,c,d,m){d=m+d;for(a^=-1;m<d;m++)a=a>>>8^e[(a^c[m])&255];return a^-1}},{}],7:[function(a,c,d){c.exports=function(){this.os=this.xflags=this.time=this.text=0;this.extra=null;this.extra_len=0;this.comment=this.name="";this.hcrc=0;this.done=!1}},{}],8:[function(a,c,d){c.exports=function(a,c){var d,g,m,l,q,u,w,C,B,A,E,D,z,M,r,K,N,G,x,F,t,k,p,
  J;d=a.state;g=a.next_in;p=a.input;m=g+(a.avail_in-5);l=a.next_out;J=a.output;q=l-(c-a.avail_out);u=l+(a.avail_out-257);w=d.dmax;C=d.wsize;B=d.whave;A=d.wnext;E=d.window;D=d.hold;z=d.bits;M=d.lencode;r=d.distcode;K=(1<<d.lenbits)-1;N=(1<<d.distbits)-1;a:do b:for(15>z&&(D+=p[g++]<<z,z+=8,D+=p[g++]<<z,z+=8),G=M[D&K];;){x=G>>>24;D>>>=x;z-=x;x=G>>>16&255;if(0===x)J[l++]=G&65535;else if(x&16){F=G&65535;if(x&=15)z<x&&(D+=p[g++]<<z,z+=8),F+=D&(1<<x)-1,D>>>=x,z-=x;15>z&&(D+=p[g++]<<z,z+=8,D+=p[g++]<<z,z+=
  8);G=r[D&N];c:for(;;){x=G>>>24;D>>>=x;z-=x;x=G>>>16&255;if(x&16){G&=65535;x&=15;z<x&&(D+=p[g++]<<z,z+=8,z<x&&(D+=p[g++]<<z,z+=8));G+=D&(1<<x)-1;if(G>w){a.msg="invalid distance too far back";d.mode=30;break a}D>>>=x;z-=x;x=l-q;if(G>x){x=G-x;if(x>B&&d.sane){a.msg="invalid distance too far back";d.mode=30;break a}t=0;k=E;if(0===A){if(t+=C-x,x<F){F-=x;do J[l++]=E[t++];while(--x);t=l-G;k=J}}else if(A<x){if(t+=C+A-x,x-=A,x<F){F-=x;do J[l++]=E[t++];while(--x);t=0;if(A<F){x=A;F-=x;do J[l++]=E[t++];while(--x);
  t=l-G;k=J}}}else if(t+=A-x,x<F){F-=x;do J[l++]=E[t++];while(--x);t=l-G;k=J}for(;2<F;)J[l++]=k[t++],J[l++]=k[t++],J[l++]=k[t++],F-=3;F&&(J[l++]=k[t++],1<F&&(J[l++]=k[t++]))}else{t=l-G;do J[l++]=J[t++],J[l++]=J[t++],J[l++]=J[t++],F-=3;while(2<F);F&&(J[l++]=J[t++],1<F&&(J[l++]=J[t++]))}}else if(0===(x&64)){G=r[(G&65535)+(D&(1<<x)-1)];continue c}else{a.msg="invalid distance code";d.mode=30;break a}break}}else if(0===(x&64)){G=M[(G&65535)+(D&(1<<x)-1)];continue b}else{x&32?d.mode=12:(a.msg="invalid literal/length code",
  d.mode=30);break a}break}while(g<m&&l<u);F=z>>3;g-=F;z-=F<<3;a.next_in=g;a.next_out=l;a.avail_in=g<m?5+(m-g):5-(g-m);a.avail_out=l<u?257+(u-l):257-(l-u);d.hold=D&(1<<z)-1;d.bits=z}},{}],9:[function(a,c,d){function e(a){return(a>>>24&255)+(a>>>8&65280)+((a&65280)<<8)+((a&255)<<24)}function f(){this.mode=0;this.last=!1;this.wrap=0;this.havedict=!1;this.total=this.check=this.dmax=this.flags=0;this.head=null;this.wnext=this.whave=this.wsize=this.wbits=0;this.window=null;this.extra=this.offset=this.length=
  this.bits=this.hold=0;this.distcode=this.lencode=null;this.have=this.ndist=this.nlen=this.ncode=this.distbits=this.lenbits=0;this.next=null;this.lens=new q.Buf16(320);this.work=new q.Buf16(288);this.distdyn=this.lendyn=null;this.was=this.back=this.sane=0}function h(a){var c;if(!a||!a.state)return-2;c=a.state;a.total_in=a.total_out=c.total=0;a.msg="";c.wrap&&(a.adler=c.wrap&1);c.mode=1;c.last=0;c.havedict=0;c.dmax=32768;c.head=null;c.hold=0;c.bits=0;c.lencode=c.lendyn=new q.Buf32(852);c.distcode=c.distdyn=
  new q.Buf32(592);c.sane=1;c.back=-1;return 0}function g(a){var c;if(!a||!a.state)return-2;c=a.state;c.wsize=0;c.whave=0;c.wnext=0;return h(a)}function m(a,c){var e,d;if(!a||!a.state)return-2;d=a.state;0>c?(e=0,c=-c):(e=(c>>4)+1,48>c&&(c&=15));if(c&&(8>c||15<c))return-2;null!==d.window&&d.wbits!==c&&(d.window=null);d.wrap=e;d.wbits=c;return g(a)}function l(a,c){var e;if(!a)return-2;e=new f;a.state=e;e.window=null;e=m(a,c);0!==e&&(a.state=null);return e}var q=a("../utils/common"),u=a("./adler32"),w=
  a("./crc32"),C=a("./inffast"),B=a("./inftrees"),A=!0,E,D;d.inflateReset=g;d.inflateReset2=m;d.inflateResetKeep=h;d.inflateInit=function(a){return l(a,15)};d.inflateInit2=l;d.inflate=function(a,c){var d,f,h,g,m,l,t,k,p,J,I,v,y,O,H=0,S,T,P,Q=new q.Buf8(4),U=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!a||!a.state||!a.output||!a.input&&0!==a.avail_in)return-2;d=a.state;12===d.mode&&(d.mode=13);m=a.next_out;h=a.output;t=a.avail_out;g=a.next_in;f=a.input;l=a.avail_in;k=d.hold;p=d.bits;J=l;I=t;
  P=0;a:for(;;)switch(d.mode){case 1:if(0===d.wrap){d.mode=13;break}for(;16>p;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}if(d.wrap&2&&35615===k){d.check=0;Q[0]=k&255;Q[1]=k>>>8&255;d.check=w(d.check,Q,2,0);p=k=0;d.mode=2;break}d.flags=0;d.head&&(d.head.done=!1);if(!(d.wrap&1)||(((k&255)<<8)+(k>>8))%31){a.msg="incorrect header check";d.mode=30;break}if(8!==(k&15)){a.msg="unknown compression method";d.mode=30;break}k>>>=4;p-=4;y=(k&15)+8;if(0===d.wbits)d.wbits=y;else if(y>d.wbits){a.msg="invalid window size";
  d.mode=30;break}d.dmax=1<<y;a.adler=d.check=1;d.mode=k&512?10:12;p=k=0;break;case 2:for(;16>p;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}d.flags=k;if(8!==(d.flags&255)){a.msg="unknown compression method";d.mode=30;break}if(d.flags&57344){a.msg="unknown header flags set";d.mode=30;break}d.head&&(d.head.text=k>>8&1);d.flags&512&&(Q[0]=k&255,Q[1]=k>>>8&255,d.check=w(d.check,Q,2,0));p=k=0;d.mode=3;case 3:for(;32>p;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}d.head&&(d.head.time=k);d.flags&512&&(Q[0]=k&255,
  Q[1]=k>>>8&255,Q[2]=k>>>16&255,Q[3]=k>>>24&255,d.check=w(d.check,Q,4,0));p=k=0;d.mode=4;case 4:for(;16>p;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}d.head&&(d.head.xflags=k&255,d.head.os=k>>8);d.flags&512&&(Q[0]=k&255,Q[1]=k>>>8&255,d.check=w(d.check,Q,2,0));p=k=0;d.mode=5;case 5:if(d.flags&1024){for(;16>p;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}d.length=k;d.head&&(d.head.extra_len=k);d.flags&512&&(Q[0]=k&255,Q[1]=k>>>8&255,d.check=w(d.check,Q,2,0));p=k=0}else d.head&&(d.head.extra=null);d.mode=6;
  case 6:if(d.flags&1024&&(v=d.length,v>l&&(v=l),v&&(d.head&&(y=d.head.extra_len-d.length,d.head.extra||(d.head.extra=Array(d.head.extra_len)),q.arraySet(d.head.extra,f,g,v,y)),d.flags&512&&(d.check=w(d.check,f,v,g)),l-=v,g+=v,d.length-=v),d.length))break a;d.length=0;d.mode=7;case 7:if(d.flags&2048){if(0===l)break a;v=0;do y=f[g+v++],d.head&&y&&65536>d.length&&(d.head.name+=String.fromCharCode(y));while(y&&v<l);d.flags&512&&(d.check=w(d.check,f,v,g));l-=v;g+=v;if(y)break a}else d.head&&(d.head.name=
  null);d.length=0;d.mode=8;case 8:if(d.flags&4096){if(0===l)break a;v=0;do y=f[g+v++],d.head&&y&&65536>d.length&&(d.head.comment+=String.fromCharCode(y));while(y&&v<l);d.flags&512&&(d.check=w(d.check,f,v,g));l-=v;g+=v;if(y)break a}else d.head&&(d.head.comment=null);d.mode=9;case 9:if(d.flags&512){for(;16>p;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}if(k!==(d.check&65535)){a.msg="header crc mismatch";d.mode=30;break}p=k=0}d.head&&(d.head.hcrc=d.flags>>9&1,d.head.done=!0);a.adler=d.check=0;d.mode=12;break;
  case 10:for(;32>p;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}a.adler=d.check=e(k);p=k=0;d.mode=11;case 11:if(0===d.havedict)return a.next_out=m,a.avail_out=t,a.next_in=g,a.avail_in=l,d.hold=k,d.bits=p,2;a.adler=d.check=1;d.mode=12;case 12:if(5===c||6===c)break a;case 13:if(d.last){k>>>=p&7;p-=p&7;d.mode=27;break}for(;3>p;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}d.last=k&1;k>>>=1;--p;switch(k&3){case 0:d.mode=14;break;case 1:v=d;if(A){y=void 0;E=new q.Buf32(512);D=new q.Buf32(32);for(y=0;144>y;)v.lens[y++]=
  8;for(;256>y;)v.lens[y++]=9;for(;280>y;)v.lens[y++]=7;for(;288>y;)v.lens[y++]=8;B(1,v.lens,0,288,E,0,v.work,{bits:9});for(y=0;32>y;)v.lens[y++]=5;B(2,v.lens,0,32,D,0,v.work,{bits:5});A=!1}v.lencode=E;v.lenbits=9;v.distcode=D;v.distbits=5;d.mode=20;if(6===c){k>>>=2;p-=2;break a}break;case 2:d.mode=17;break;case 3:a.msg="invalid block type",d.mode=30}k>>>=2;p-=2;break;case 14:k>>>=p&7;for(p-=p&7;32>p;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}if((k&65535)!==(k>>>16^65535)){a.msg="invalid stored block lengths";
  d.mode=30;break}d.length=k&65535;p=k=0;d.mode=15;if(6===c)break a;case 15:d.mode=16;case 16:if(v=d.length){v>l&&(v=l);v>t&&(v=t);if(0===v)break a;q.arraySet(h,f,g,v,m);l-=v;g+=v;t-=v;m+=v;d.length-=v;break}d.mode=12;break;case 17:for(;14>p;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}d.nlen=(k&31)+257;k>>>=5;p-=5;d.ndist=(k&31)+1;k>>>=5;p-=5;d.ncode=(k&15)+4;k>>>=4;p-=4;if(286<d.nlen||30<d.ndist){a.msg="too many length or distance symbols";d.mode=30;break}d.have=0;d.mode=18;case 18:for(;d.have<d.ncode;){for(;3>
  p;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}d.lens[U[d.have++]]=k&7;k>>>=3;p-=3}for(;19>d.have;)d.lens[U[d.have++]]=0;d.lencode=d.lendyn;d.lenbits=7;v={bits:d.lenbits};P=B(0,d.lens,0,19,d.lencode,0,d.work,v);d.lenbits=v.bits;if(P){a.msg="invalid code lengths set";d.mode=30;break}d.have=0;d.mode=19;case 19:for(;d.have<d.nlen+d.ndist;){for(;;){H=d.lencode[k&(1<<d.lenbits)-1];v=H>>>24;H&=65535;if(v<=p)break;if(0===l)break a;l--;k+=f[g++]<<p;p+=8}if(16>H)k>>>=v,p-=v,d.lens[d.have++]=H;else{if(16===H){for(y=
  v+2;p<y;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}k>>>=v;p-=v;if(0===d.have){a.msg="invalid bit length repeat";d.mode=30;break}y=d.lens[d.have-1];v=3+(k&3);k>>>=2;p-=2}else if(17===H){for(y=v+3;p<y;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}k>>>=v;p-=v;y=0;v=3+(k&7);k>>>=3;p-=3}else{for(y=v+7;p<y;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}k>>>=v;p-=v;y=0;v=11+(k&127);k>>>=7;p-=7}if(d.have+v>d.nlen+d.ndist){a.msg="invalid bit length repeat";d.mode=30;break}for(;v--;)d.lens[d.have++]=y}}if(30===d.mode)break;
  if(0===d.lens[256]){a.msg="invalid code -- missing end-of-block";d.mode=30;break}d.lenbits=9;v={bits:d.lenbits};P=B(1,d.lens,0,d.nlen,d.lencode,0,d.work,v);d.lenbits=v.bits;if(P){a.msg="invalid literal/lengths set";d.mode=30;break}d.distbits=6;d.distcode=d.distdyn;v={bits:d.distbits};P=B(2,d.lens,d.nlen,d.ndist,d.distcode,0,d.work,v);d.distbits=v.bits;if(P){a.msg="invalid distances set";d.mode=30;break}d.mode=20;if(6===c)break a;case 20:d.mode=21;case 21:if(6<=l&&258<=t){a.next_out=m;a.avail_out=
  t;a.next_in=g;a.avail_in=l;d.hold=k;d.bits=p;C(a,I);m=a.next_out;h=a.output;t=a.avail_out;g=a.next_in;f=a.input;l=a.avail_in;k=d.hold;p=d.bits;12===d.mode&&(d.back=-1);break}for(d.back=0;;){H=d.lencode[k&(1<<d.lenbits)-1];v=H>>>24;y=H>>>16&255;H&=65535;if(v<=p)break;if(0===l)break a;l--;k+=f[g++]<<p;p+=8}if(y&&0===(y&240)){O=v;S=y;for(T=H;;){H=d.lencode[T+((k&(1<<O+S)-1)>>O)];v=H>>>24;y=H>>>16&255;H&=65535;if(O+v<=p)break;if(0===l)break a;l--;k+=f[g++]<<p;p+=8}k>>>=O;p-=O;d.back+=O}k>>>=v;p-=v;d.back+=
  v;d.length=H;if(0===y){d.mode=26;break}if(y&32){d.back=-1;d.mode=12;break}if(y&64){a.msg="invalid literal/length code";d.mode=30;break}d.extra=y&15;d.mode=22;case 22:if(d.extra){for(y=d.extra;p<y;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}d.length+=k&(1<<d.extra)-1;k>>>=d.extra;p-=d.extra;d.back+=d.extra}d.was=d.length;d.mode=23;case 23:for(;;){H=d.distcode[k&(1<<d.distbits)-1];v=H>>>24;y=H>>>16&255;H&=65535;if(v<=p)break;if(0===l)break a;l--;k+=f[g++]<<p;p+=8}if(0===(y&240)){O=v;S=y;for(T=H;;){H=d.distcode[T+
  ((k&(1<<O+S)-1)>>O)];v=H>>>24;y=H>>>16&255;H&=65535;if(O+v<=p)break;if(0===l)break a;l--;k+=f[g++]<<p;p+=8}k>>>=O;p-=O;d.back+=O}k>>>=v;p-=v;d.back+=v;if(y&64){a.msg="invalid distance code";d.mode=30;break}d.offset=H;d.extra=y&15;d.mode=24;case 24:if(d.extra){for(y=d.extra;p<y;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}d.offset+=k&(1<<d.extra)-1;k>>>=d.extra;p-=d.extra;d.back+=d.extra}if(d.offset>d.dmax){a.msg="invalid distance too far back";d.mode=30;break}d.mode=25;case 25:if(0===t)break a;v=I-t;
  if(d.offset>v){v=d.offset-v;if(v>d.whave&&d.sane){a.msg="invalid distance too far back";d.mode=30;break}v>d.wnext?(v-=d.wnext,y=d.wsize-v):y=d.wnext-v;v>d.length&&(v=d.length);O=d.window}else O=h,y=m-d.offset,v=d.length;v>t&&(v=t);t-=v;d.length-=v;do h[m++]=O[y++];while(--v);0===d.length&&(d.mode=21);break;case 26:if(0===t)break a;h[m++]=d.length;t--;d.mode=21;break;case 27:if(d.wrap){for(;32>p;){if(0===l)break a;l--;k|=f[g++]<<p;p+=8}I-=t;a.total_out+=I;d.total+=I;I&&(a.adler=d.check=d.flags?w(d.check,
  h,I,m-I):u(d.check,h,I,m-I));I=t;if((d.flags?k:e(k))!==d.check){a.msg="incorrect data check";d.mode=30;break}p=k=0}d.mode=28;case 28:if(d.wrap&&d.flags){for(;32>p;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}if(k!==(d.total&4294967295)){a.msg="incorrect length check";d.mode=30;break}p=k=0}d.mode=29;case 29:P=1;break a;case 30:P=-3;break a;case 31:return-4;default:return-2}a.next_out=m;a.avail_out=t;a.next_in=g;a.avail_in=l;d.hold=k;d.bits=p;if(d.wsize||I!==a.avail_out&&30>d.mode&&(27>d.mode||4!==c))f=
  a.output,g=a.next_out,m=I-a.avail_out,t=a.state,null===t.window&&(t.wsize=1<<t.wbits,t.wnext=0,t.whave=0,t.window=new q.Buf8(t.wsize)),m>=t.wsize?(q.arraySet(t.window,f,g-t.wsize,t.wsize,0),t.wnext=0,t.whave=t.wsize):(l=t.wsize-t.wnext,l>m&&(l=m),q.arraySet(t.window,f,g-m,l,t.wnext),(m-=l)?(q.arraySet(t.window,f,g-m,m,0),t.wnext=m,t.whave=t.wsize):(t.wnext+=l,t.wnext===t.wsize&&(t.wnext=0),t.whave<t.wsize&&(t.whave+=l)));J-=a.avail_in;I-=a.avail_out;a.total_in+=J;a.total_out+=I;d.total+=I;d.wrap&&
  I&&(a.adler=d.check=d.flags?w(d.check,h,I,a.next_out-I):u(d.check,h,I,a.next_out-I));a.data_type=d.bits+(d.last?64:0)+(12===d.mode?128:0)+(20===d.mode||15===d.mode?256:0);(0===J&&0===I||4===c)&&0===P&&(P=-5);return P};d.inflateEnd=function(a){if(!a||!a.state)return-2;var c=a.state;c.window&&(c.window=null);a.state=null;return 0};d.inflateGetHeader=function(a,c){var e;if(!a||!a.state)return-2;e=a.state;if(0===(e.wrap&2))return-2;e.head=c;c.done=!1;return 0};d.inflateInfo="pako inflate (from Nodeca project)"},
  {"../utils/common":2,"./adler32":4,"./crc32":6,"./inffast":8,"./inftrees":10}],10:[function(a,c,d){var e=a("../utils/common"),f=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],h=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],g=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],m=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,
  25,26,26,27,27,28,28,29,29,64,64];c.exports=function(a,c,d,w,C,B,A,E){for(var D=E.bits,z=0,M=0,r=0,K=0,N=0,G=0,x=0,F=0,t=0,k=0,p,J,I=null,v=0,y,O=new e.Buf16(16),G=new e.Buf16(16),H=null,S=0,T,P,Q,z=0;15>=z;z++)O[z]=0;for(M=0;M<w;M++)O[c[d+M]]++;N=D;for(K=15;1<=K&&0===O[K];K--);N>K&&(N=K);if(0===K)return C[B++]=20971520,C[B++]=20971520,E.bits=1,0;for(r=1;r<K&&0===O[r];r++);N<r&&(N=r);for(z=F=1;15>=z;z++)if(F<<=1,F-=O[z],0>F)return-1;if(0<F&&(0===a||1!==K))return-1;G[1]=0;for(z=1;15>z;z++)G[z+1]=G[z]+
  O[z];for(M=0;M<w;M++)0!==c[d+M]&&(A[G[c[d+M]]++]=M);switch(a){case 0:I=H=A;y=19;break;case 1:I=f;v-=257;H=h;S-=257;y=256;break;default:I=g,H=m,y=-1}M=k=0;z=r;D=B;G=N;x=0;J=-1;t=1<<N;w=t-1;if(1===a&&852<t||2===a&&592<t)return 1;for(var U=0;;){U++;T=z-x;A[M]<y?(P=0,Q=A[M]):A[M]>y?(P=H[S+A[M]],Q=I[v+A[M]]):(P=96,Q=0);F=1<<z-x;r=p=1<<G;do p-=F,C[D+(k>>x)+p]=T<<24|P<<16|Q|0;while(0!==p);for(F=1<<z-1;k&F;)F>>=1;0!==F?(k&=F-1,k+=F):k=0;M++;if(0===--O[z]){if(z===K)break;z=c[d+A[M]]}if(z>N&&(k&w)!==J){0===
  x&&(x=N);D+=r;G=z-x;for(F=1<<G;G+x<K;){F-=O[G+x];if(0>=F)break;G++;F<<=1}t+=1<<G;if(1===a&&852<t||2===a&&592<t)return 1;J=k&w;C[J]=N<<24|G<<16|D-B|0}}0!==k&&(C[D+k]=z-x<<24|4194304);E.bits=N;return 0}},{"../utils/common":2}],11:[function(a,c,d){c.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],12:[function(a,c,d){c.exports=function(){this.input=null;this.total_in=
  this.avail_in=this.next_in=0;this.output=null;this.total_out=this.avail_out=this.next_out=0;this.msg="";this.state=null;this.data_type=2;this.adler=0}},{}]},{},[1])(1)});
  (function(b){"object"===typeof exports&&"undefined"!==typeof module?module.exports=b():"function"===typeof define&&define.amd?define([],b):("undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:this).nifti=b()})(function(){return function a(c,d,e){function f(g,l){if(!d[g]){if(!c[g]){var q="function"==typeof require&&require;if(!l&&q)return q(g,!0);if(h)return h(g,!0);q=Error("Cannot find module '"+g+"'");throw q.code="MODULE_NOT_FOUND",q;}q=d[g]={exports:{}};
  c[g][0].call(q.exports,function(a){var e=c[g][1][a];return f(e?e:a)},q,q.exports,a,c,d,e)}return d[g].exports}for(var h="function"==typeof require&&require,g=0;g<e.length;g++)f(e[g]);return f}({1:[function(a,c,d){d=a("./lib/utils/common").assign;var e=a("./lib/deflate"),f=a("./lib/inflate");a=a("./lib/zlib/constants");var h={};d(h,e,f,a);c.exports=h},{"./lib/deflate":2,"./lib/inflate":3,"./lib/utils/common":4,"./lib/zlib/constants":7}],2:[function(a,c,d){function e(a,c){var e=new u(c);e.push(a,!0);
  if(e.err)throw e.msg;return e.result}var f=a("./zlib/deflate.js"),h=a("./utils/common"),g=a("./utils/strings"),m=a("./zlib/messages"),l=a("./zlib/zstream"),q=Object.prototype.toString,u=function(a){a=this.options=h.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},a||{});a.raw&&0<a.windowBits?a.windowBits=-a.windowBits:a.gzip&&0<a.windowBits&&16>a.windowBits&&(a.windowBits+=16);this.err=0;this.msg="";this.ended=!1;this.chunks=[];this.strm=new l;this.strm.avail_out=
  0;var c=f.deflateInit2(this.strm,a.level,a.method,a.windowBits,a.memLevel,a.strategy);if(0!==c)throw Error(m[c]);a.header&&f.deflateSetHeader(this.strm,a.header)};u.prototype.push=function(a,c){var e=this.strm,d=this.options.chunkSize,m,l;if(this.ended)return!1;l=c===~~c?c:!0===c?4:0;"string"===typeof a?e.input=g.string2buf(a):"[object ArrayBuffer]"===q.call(a)?e.input=new Uint8Array(a):e.input=a;e.next_in=0;e.avail_in=e.input.length;do{0===e.avail_out&&(e.output=new h.Buf8(d),e.next_out=0,e.avail_out=
  d);m=f.deflate(e,l);if(1!==m&&0!==m)return this.onEnd(m),this.ended=!0,!1;if(0===e.avail_out||0===e.avail_in&&(4===l||2===l))if("string"===this.options.to)this.onData(g.buf2binstring(h.shrinkBuf(e.output,e.next_out)));else this.onData(h.shrinkBuf(e.output,e.next_out))}while((0<e.avail_in||0===e.avail_out)&&1!==m);if(4===l)return m=f.deflateEnd(this.strm),this.onEnd(m),this.ended=!0,0===m;2===l&&(this.onEnd(0),e.avail_out=0);return!0};u.prototype.onData=function(a){this.chunks.push(a)};u.prototype.onEnd=
  function(a){0===a&&(this.result="string"===this.options.to?this.chunks.join(""):h.flattenChunks(this.chunks));this.chunks=[];this.err=a;this.msg=this.strm.msg};d.Deflate=u;d.deflate=e;d.deflateRaw=function(a,c){c=c||{};c.raw=!0;return e(a,c)};d.gzip=function(a,c){c=c||{};c.gzip=!0;return e(a,c)}},{"./utils/common":4,"./utils/strings":5,"./zlib/deflate.js":9,"./zlib/messages":14,"./zlib/zstream":16}],3:[function(a,c,d){function e(a,c){var e=new C(c);e.push(a,!0);if(e.err)throw e.msg;return e.result}
  var f=a("./zlib/inflate.js"),h=a("./utils/common"),g=a("./utils/strings"),m=a("./zlib/constants"),l=a("./zlib/messages"),q=a("./zlib/zstream"),u=a("./zlib/gzheader"),w=Object.prototype.toString,C=function(a){var c=this.options=h.assign({chunkSize:16384,windowBits:0,to:""},a||{});c.raw&&0<=c.windowBits&&16>c.windowBits&&(c.windowBits=-c.windowBits,0===c.windowBits&&(c.windowBits=-15));!(0<=c.windowBits&&16>c.windowBits)||a&&a.windowBits||(c.windowBits+=32);15<c.windowBits&&48>c.windowBits&&0===(c.windowBits&
  15)&&(c.windowBits|=15);this.err=0;this.msg="";this.ended=!1;this.chunks=[];this.strm=new q;this.strm.avail_out=0;a=f.inflateInit2(this.strm,c.windowBits);if(a!==m.Z_OK)throw Error(l[a]);this.header=new u;f.inflateGetHeader(this.strm,this.header)};C.prototype.push=function(a,c){var e=this.strm,d=this.options.chunkSize,l,q,r,u,C,G=!1;if(this.ended)return!1;q=c===~~c?c:!0===c?m.Z_FINISH:m.Z_NO_FLUSH;"string"===typeof a?e.input=g.binstring2buf(a):"[object ArrayBuffer]"===w.call(a)?e.input=new Uint8Array(a):
  e.input=a;e.next_in=0;e.avail_in=e.input.length;do{0===e.avail_out&&(e.output=new h.Buf8(d),e.next_out=0,e.avail_out=d);l=f.inflate(e,m.Z_NO_FLUSH);l===m.Z_BUF_ERROR&&!0===G&&(l=m.Z_OK,G=!1);if(l!==m.Z_STREAM_END&&l!==m.Z_OK)return this.onEnd(l),this.ended=!0,!1;if(e.next_out&&(0===e.avail_out||l===m.Z_STREAM_END||0===e.avail_in&&(q===m.Z_FINISH||q===m.Z_SYNC_FLUSH)))if("string"===this.options.to)r=g.utf8border(e.output,e.next_out),u=e.next_out-r,C=g.buf2string(e.output,r),e.next_out=u,e.avail_out=
  d-u,u&&h.arraySet(e.output,e.output,r,u,0),this.onData(C);else this.onData(h.shrinkBuf(e.output,e.next_out));0===e.avail_in&&0===e.avail_out&&(G=!0)}while((0<e.avail_in||0===e.avail_out)&&l!==m.Z_STREAM_END);l===m.Z_STREAM_END&&(q=m.Z_FINISH);if(q===m.Z_FINISH)return l=f.inflateEnd(this.strm),this.onEnd(l),this.ended=!0,l===m.Z_OK;q===m.Z_SYNC_FLUSH&&(this.onEnd(m.Z_OK),e.avail_out=0);return!0};C.prototype.onData=function(a){this.chunks.push(a)};C.prototype.onEnd=function(a){a===m.Z_OK&&(this.result=
  "string"===this.options.to?this.chunks.join(""):h.flattenChunks(this.chunks));this.chunks=[];this.err=a;this.msg=this.strm.msg};d.Inflate=C;d.inflate=e;d.inflateRaw=function(a,c){c=c||{};c.raw=!0;return e(a,c)};d.ungzip=e},{"./utils/common":4,"./utils/strings":5,"./zlib/constants":7,"./zlib/gzheader":10,"./zlib/inflate.js":12,"./zlib/messages":14,"./zlib/zstream":16}],4:[function(a,c,d){a="undefined"!==typeof Uint8Array&&"undefined"!==typeof Uint16Array&&"undefined"!==typeof Int32Array;d.assign=function(a){for(var c=
  Array.prototype.slice.call(arguments,1);c.length;){var e=c.shift();if(e){if("object"!==typeof e)throw new TypeError(e+"must be non-object");for(var d in e)e.hasOwnProperty(d)&&(a[d]=e[d])}}return a};d.shrinkBuf=function(a,c){if(a.length===c)return a;if(a.subarray)return a.subarray(0,c);a.length=c;return a};var e={arraySet:function(a,c,e,d,f){if(c.subarray&&a.subarray)a.set(c.subarray(e,e+d),f);else for(var u=0;u<d;u++)a[f+u]=c[e+u]},flattenChunks:function(a){var c,e,d,f,u;c=d=0;for(e=a.length;c<e;c++)d+=
  a[c].length;u=new Uint8Array(d);c=d=0;for(e=a.length;c<e;c++)f=a[c],u.set(f,d),d+=f.length;return u}},f={arraySet:function(a,c,e,d,f){for(var u=0;u<d;u++)a[f+u]=c[e+u]},flattenChunks:function(a){return[].concat.apply([],a)}};d.setTyped=function(a){a?(d.Buf8=Uint8Array,d.Buf16=Uint16Array,d.Buf32=Int32Array,d.assign(d,e)):(d.Buf8=Array,d.Buf16=Array,d.Buf32=Array,d.assign(d,f))};d.setTyped(a)},{}],5:[function(a,c,d){function e(a,c){if(65537>c&&(a.subarray&&g||!a.subarray&&h))return String.fromCharCode.apply(null,
  f.shrinkBuf(a,c));for(var e="",d=0;d<c;d++)e+=String.fromCharCode(a[d]);return e}var f=a("./common"),h=!0,g=!0;try{String.fromCharCode.apply(null,[0])}catch(m){h=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(l){g=!1}var q=new f.Buf8(256);for(a=0;256>a;a++)q[a]=252<=a?6:248<=a?5:240<=a?4:224<=a?3:192<=a?2:1;q[254]=q[254]=1;d.string2buf=function(a){var c,e,d,h,g,m=a.length,l=0;for(h=0;h<m;h++)e=a.charCodeAt(h),55296===(e&64512)&&h+1<m&&(d=a.charCodeAt(h+1),56320===(d&64512)&&(e=65536+
  (e-55296<<10)+(d-56320),h++)),l+=128>e?1:2048>e?2:65536>e?3:4;c=new f.Buf8(l);for(h=g=0;g<l;h++)e=a.charCodeAt(h),55296===(e&64512)&&h+1<m&&(d=a.charCodeAt(h+1),56320===(d&64512)&&(e=65536+(e-55296<<10)+(d-56320),h++)),128>e?c[g++]=e:(2048>e?c[g++]=192|e>>>6:(65536>e?c[g++]=224|e>>>12:(c[g++]=240|e>>>18,c[g++]=128|e>>>12&63),c[g++]=128|e>>>6&63),c[g++]=128|e&63);return c};d.buf2binstring=function(a){return e(a,a.length)};d.binstring2buf=function(a){for(var c=new f.Buf8(a.length),e=0,d=c.length;e<
  d;e++)c[e]=a.charCodeAt(e);return c};d.buf2string=function(a,c){var d,f,h,g,m=c||a.length,l=Array(2*m);for(d=f=0;d<m;)if(h=a[d++],128>h)l[f++]=h;else if(g=q[h],4<g)l[f++]=65533,d+=g-1;else{for(h&=2===g?31:3===g?15:7;1<g&&d<m;)h=h<<6|a[d++]&63,g--;1<g?l[f++]=65533:65536>h?l[f++]=h:(h-=65536,l[f++]=55296|h>>10&1023,l[f++]=56320|h&1023)}return e(l,f)};d.utf8border=function(a,c){var e;c=c||a.length;c>a.length&&(c=a.length);for(e=c-1;0<=e&&128===(a[e]&192);)e--;return 0>e||0===e?c:e+q[a[e]]>c?e:c}},{"./common":4}],
  6:[function(a,c,d){c.exports=function(a,c,d,g){var m=a&65535|0;a=a>>>16&65535|0;for(var l=0;0!==d;){l=2E3<d?2E3:d;d-=l;do m=m+c[g++]|0,a=a+m|0;while(--l);m%=65521;a%=65521}return m|a<<16|0}},{}],7:[function(a,c,d){c.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,
  Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],8:[function(a,c,d){var e=function(){for(var a,c=[],e=0;256>e;e++){a=e;for(var d=0;8>d;d++)a=a&1?3988292384^a>>>1:a>>>1;c[e]=a}return c}();c.exports=function(a,c,d,m){d=m+d;for(a^=-1;m<d;m++)a=a>>>8^e[(a^c[m])&255];return a^-1}},{}],9:[function(a,c,d){function e(a,c){a.msg=x[c];return c}function f(a){for(var c=a.length;0<=--c;)a[c]=0}function h(a){var c=a.state,e=c.pending;e>a.avail_out&&(e=a.avail_out);
  0!==e&&(r.arraySet(a.output,c.pending_buf,c.pending_out,e,a.next_out),a.next_out+=e,c.pending_out+=e,a.total_out+=e,a.avail_out-=e,c.pending-=e,0===c.pending&&(c.pending_out=0))}function g(a,c){K._tr_flush_block(a,0<=a.block_start?a.block_start:-1,a.strstart-a.block_start,c);a.block_start=a.strstart;h(a.strm)}function m(a,c){a.pending_buf[a.pending++]=c}function l(a,c){a.pending_buf[a.pending++]=c>>>8&255;a.pending_buf[a.pending++]=c&255}function q(a,c){var e=a.max_chain_length,d=a.strstart,f,h=a.prev_length,
  g=a.nice_match,r=a.strstart>a.w_size-262?a.strstart-(a.w_size-262):0,m=a.window,l=a.w_mask,q=a.prev,P=a.strstart+258,z=m[d+h-1],u=m[d+h];a.prev_length>=a.good_match&&(e>>=2);g>a.lookahead&&(g=a.lookahead);do if(f=c,m[f+h]===u&&m[f+h-1]===z&&m[f]===m[d]&&m[++f]===m[d+1]){d+=2;for(f++;m[++d]===m[++f]&&m[++d]===m[++f]&&m[++d]===m[++f]&&m[++d]===m[++f]&&m[++d]===m[++f]&&m[++d]===m[++f]&&m[++d]===m[++f]&&m[++d]===m[++f]&&d<P;);f=258-(P-d);d=P-258;if(f>h){a.match_start=c;h=f;if(f>=g)break;z=m[d+h-1];u=
  m[d+h]}}while((c=q[c&l])>r&&0!==--e);return h<=a.lookahead?h:a.lookahead}function u(a){var c=a.w_size,e,d,f,h;do{h=a.window_size-a.lookahead-a.strstart;if(a.strstart>=c+(c-262)){r.arraySet(a.window,a.window,c,c,0);a.match_start-=c;a.strstart-=c;a.block_start-=c;e=d=a.hash_size;do f=a.head[--e],a.head[e]=f>=c?f-c:0;while(--d);e=d=c;do f=a.prev[--e],a.prev[e]=f>=c?f-c:0;while(--d);h+=c}if(0===a.strm.avail_in)break;e=a.strm;d=a.window;f=a.strstart+a.lookahead;var g=e.avail_in;g>h&&(g=h);0===g?d=0:(e.avail_in-=
  g,r.arraySet(d,e.input,e.next_in,g,f),1===e.state.wrap?e.adler=N(e.adler,d,g,f):2===e.state.wrap&&(e.adler=G(e.adler,d,g,f)),e.next_in+=g,e.total_in+=g,d=g);a.lookahead+=d;if(3<=a.lookahead+a.insert)for(h=a.strstart-a.insert,a.ins_h=a.window[h],a.ins_h=(a.ins_h<<a.hash_shift^a.window[h+1])&a.hash_mask;a.insert&&!(a.ins_h=(a.ins_h<<a.hash_shift^a.window[h+3-1])&a.hash_mask,a.prev[h&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=h,h++,a.insert--,3>a.lookahead+a.insert););}while(262>a.lookahead&&0!==a.strm.avail_in)}
  function w(a,c){for(var e;;){if(262>a.lookahead){u(a);if(262>a.lookahead&&0===c)return 1;if(0===a.lookahead)break}e=0;3<=a.lookahead&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+3-1])&a.hash_mask,e=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart);0!==e&&a.strstart-e<=a.w_size-262&&(a.match_length=q(a,e));if(3<=a.match_length)if(e=K._tr_tally(a,a.strstart-a.match_start,a.match_length-3),a.lookahead-=a.match_length,a.match_length<=a.max_lazy_match&&3<=a.lookahead){a.match_length--;
  do a.strstart++,a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+3-1])&a.hash_mask,a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart;while(0!==--a.match_length);a.strstart++}else a.strstart+=a.match_length,a.match_length=0,a.ins_h=a.window[a.strstart],a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+1])&a.hash_mask;else e=K._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++;if(e&&(g(a,!1),0===a.strm.avail_out))return 1}a.insert=2>a.strstart?a.strstart:2;return 4===
  c?(g(a,!0),0===a.strm.avail_out?3:4):a.last_lit&&(g(a,!1),0===a.strm.avail_out)?1:2}function C(a,c){for(var e,d;;){if(262>a.lookahead){u(a);if(262>a.lookahead&&0===c)return 1;if(0===a.lookahead)break}e=0;3<=a.lookahead&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+3-1])&a.hash_mask,e=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart);a.prev_length=a.match_length;a.prev_match=a.match_start;a.match_length=2;0!==e&&a.prev_length<a.max_lazy_match&&a.strstart-e<=a.w_size-262&&
  (a.match_length=q(a,e),5>=a.match_length&&(1===a.strategy||3===a.match_length&&4096<a.strstart-a.match_start)&&(a.match_length=2));if(3<=a.prev_length&&a.match_length<=a.prev_length){d=a.strstart+a.lookahead-3;e=K._tr_tally(a,a.strstart-1-a.prev_match,a.prev_length-3);a.lookahead-=a.prev_length-1;a.prev_length-=2;do++a.strstart<=d&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+3-1])&a.hash_mask,a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart);while(0!==--a.prev_length);
  a.match_available=0;a.match_length=2;a.strstart++;if(e&&(g(a,!1),0===a.strm.avail_out))return 1}else if(a.match_available){if((e=K._tr_tally(a,0,a.window[a.strstart-1]))&&g(a,!1),a.strstart++,a.lookahead--,0===a.strm.avail_out)return 1}else a.match_available=1,a.strstart++,a.lookahead--}a.match_available&&(K._tr_tally(a,0,a.window[a.strstart-1]),a.match_available=0);a.insert=2>a.strstart?a.strstart:2;return 4===c?(g(a,!0),0===a.strm.avail_out?3:4):a.last_lit&&(g(a,!1),0===a.strm.avail_out)?1:2}function B(a,
  c){for(var e,d,f,h=a.window;;){if(258>=a.lookahead){u(a);if(258>=a.lookahead&&0===c)return 1;if(0===a.lookahead)break}a.match_length=0;if(3<=a.lookahead&&0<a.strstart&&(d=a.strstart-1,e=h[d],e===h[++d]&&e===h[++d]&&e===h[++d])){for(f=a.strstart+258;e===h[++d]&&e===h[++d]&&e===h[++d]&&e===h[++d]&&e===h[++d]&&e===h[++d]&&e===h[++d]&&e===h[++d]&&d<f;);a.match_length=258-(f-d);a.match_length>a.lookahead&&(a.match_length=a.lookahead)}3<=a.match_length?(e=K._tr_tally(a,1,a.match_length-3),a.lookahead-=
  a.match_length,a.strstart+=a.match_length,a.match_length=0):(e=K._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++);if(e&&(g(a,!1),0===a.strm.avail_out))return 1}a.insert=0;return 4===c?(g(a,!0),0===a.strm.avail_out?3:4):a.last_lit&&(g(a,!1),0===a.strm.avail_out)?1:2}function A(a,c){for(var e;;){if(0===a.lookahead&&(u(a),0===a.lookahead)){if(0===c)return 1;break}a.match_length=0;e=K._tr_tally(a,0,a.window[a.strstart]);a.lookahead--;a.strstart++;if(e&&(g(a,!1),0===a.strm.avail_out))return 1}a.insert=
  0;return 4===c?(g(a,!0),0===a.strm.avail_out?3:4):a.last_lit&&(g(a,!1),0===a.strm.avail_out)?1:2}function E(){this.strm=null;this.status=0;this.pending_buf=null;this.wrap=this.pending=this.pending_out=this.pending_buf_size=0;this.gzhead=null;this.gzindex=0;this.method=8;this.last_flush=-1;this.w_mask=this.w_bits=this.w_size=0;this.window=null;this.window_size=0;this.head=this.prev=null;this.nice_match=this.good_match=this.strategy=this.level=this.max_lazy_match=this.max_chain_length=this.prev_length=
  this.lookahead=this.match_start=this.strstart=this.match_available=this.prev_match=this.match_length=this.block_start=this.hash_shift=this.hash_mask=this.hash_bits=this.hash_size=this.ins_h=0;this.dyn_ltree=new r.Buf16(1146);this.dyn_dtree=new r.Buf16(122);this.bl_tree=new r.Buf16(78);f(this.dyn_ltree);f(this.dyn_dtree);f(this.bl_tree);this.bl_desc=this.d_desc=this.l_desc=null;this.bl_count=new r.Buf16(16);this.heap=new r.Buf16(573);f(this.heap);this.heap_max=this.heap_len=0;this.depth=new r.Buf16(573);
  f(this.depth);this.bi_valid=this.bi_buf=this.insert=this.matches=this.static_len=this.opt_len=this.d_buf=this.last_lit=this.lit_bufsize=this.l_buf=0}function D(a){var c;if(!a||!a.state)return e(a,-2);a.total_in=a.total_out=0;a.data_type=2;c=a.state;c.pending=0;c.pending_out=0;0>c.wrap&&(c.wrap=-c.wrap);c.status=c.wrap?42:113;a.adler=2===c.wrap?0:1;c.last_flush=0;K._tr_init(c);return 0}function z(a){var c=D(a);0===c&&(a=a.state,a.window_size=2*a.w_size,f(a.head),a.max_lazy_match=F[a.level].max_lazy,
  a.good_match=F[a.level].good_length,a.nice_match=F[a.level].nice_length,a.max_chain_length=F[a.level].max_chain,a.strstart=0,a.block_start=0,a.lookahead=0,a.insert=0,a.match_length=a.prev_length=2,a.match_available=0,a.ins_h=0);return c}function M(a,c,d,f,h,g){if(!a)return-2;var m=1;-1===c&&(c=6);0>f?(m=0,f=-f):15<f&&(m=2,f-=16);if(1>h||9<h||8!==d||8>f||15<f||0>c||9<c||0>g||4<g)return e(a,-2);8===f&&(f=9);var l=new E;a.state=l;l.strm=a;l.wrap=m;l.gzhead=null;l.w_bits=f;l.w_size=1<<l.w_bits;l.w_mask=
  l.w_size-1;l.hash_bits=h+7;l.hash_size=1<<l.hash_bits;l.hash_mask=l.hash_size-1;l.hash_shift=~~((l.hash_bits+3-1)/3);l.window=new r.Buf8(2*l.w_size);l.head=new r.Buf16(l.hash_size);l.prev=new r.Buf16(l.w_size);l.lit_bufsize=1<<h+6;l.pending_buf_size=4*l.lit_bufsize;l.pending_buf=new r.Buf8(l.pending_buf_size);l.d_buf=l.lit_bufsize>>1;l.l_buf=3*l.lit_bufsize;l.level=c;l.strategy=g;l.method=d;return z(a)}var r=a("../utils/common"),K=a("./trees"),N=a("./adler32"),G=a("./crc32"),x=a("./messages");a=function(a,
  c,e,d,f){this.good_length=a;this.max_lazy=c;this.nice_length=e;this.max_chain=d;this.func=f};var F;F=[new a(0,0,0,0,function(a,c){var e=65535;for(e>a.pending_buf_size-5&&(e=a.pending_buf_size-5);;){if(1>=a.lookahead){u(a);if(0===a.lookahead&&0===c)return 1;if(0===a.lookahead)break}a.strstart+=a.lookahead;a.lookahead=0;var d=a.block_start+e;if(0===a.strstart||a.strstart>=d)if(a.lookahead=a.strstart-d,a.strstart=d,g(a,!1),0===a.strm.avail_out)return 1;if(a.strstart-a.block_start>=a.w_size-262&&(g(a,
  !1),0===a.strm.avail_out))return 1}a.insert=0;if(4===c)return g(a,!0),0===a.strm.avail_out?3:4;a.strstart>a.block_start&&g(a,!1);return 1}),new a(4,4,8,4,w),new a(4,5,16,8,w),new a(4,6,32,32,w),new a(4,4,16,16,C),new a(8,16,32,32,C),new a(8,16,128,128,C),new a(8,32,128,256,C),new a(32,128,258,1024,C),new a(32,258,258,4096,C)];d.deflateInit=function(a,c){return M(a,c,8,15,8,0)};d.deflateInit2=M;d.deflateReset=z;d.deflateResetKeep=D;d.deflateSetHeader=function(a,c){if(!a||!a.state||2!==a.state.wrap)return-2;
  a.state.gzhead=c;return 0};d.deflate=function(a,c){var d,g,r,v;if(!a||!a.state||5<c||0>c)return a?e(a,-2):-2;g=a.state;if(!a.output||!a.input&&0!==a.avail_in||666===g.status&&4!==c)return e(a,0===a.avail_out?-5:-2);g.strm=a;d=g.last_flush;g.last_flush=c;42===g.status&&(2===g.wrap?(a.adler=0,m(g,31),m(g,139),m(g,8),g.gzhead?(m(g,(g.gzhead.text?1:0)+(g.gzhead.hcrc?2:0)+(g.gzhead.extra?4:0)+(g.gzhead.name?8:0)+(g.gzhead.comment?16:0)),m(g,g.gzhead.time&255),m(g,g.gzhead.time>>8&255),m(g,g.gzhead.time>>
  16&255),m(g,g.gzhead.time>>24&255),m(g,9===g.level?2:2<=g.strategy||2>g.level?4:0),m(g,g.gzhead.os&255),g.gzhead.extra&&g.gzhead.extra.length&&(m(g,g.gzhead.extra.length&255),m(g,g.gzhead.extra.length>>8&255)),g.gzhead.hcrc&&(a.adler=G(a.adler,g.pending_buf,g.pending,0)),g.gzindex=0,g.status=69):(m(g,0),m(g,0),m(g,0),m(g,0),m(g,0),m(g,9===g.level?2:2<=g.strategy||2>g.level?4:0),m(g,3),g.status=113)):(r=8+(g.w_bits-8<<4)<<8,v=-1,v=2<=g.strategy||2>g.level?0:6>g.level?1:6===g.level?2:3,r|=v<<6,0!==
  g.strstart&&(r|=32),g.status=113,l(g,r+(31-r%31)),0!==g.strstart&&(l(g,a.adler>>>16),l(g,a.adler&65535)),a.adler=1));if(69===g.status)if(g.gzhead.extra){for(r=g.pending;g.gzindex<(g.gzhead.extra.length&65535)&&(g.pending!==g.pending_buf_size||(g.gzhead.hcrc&&g.pending>r&&(a.adler=G(a.adler,g.pending_buf,g.pending-r,r)),h(a),r=g.pending,g.pending!==g.pending_buf_size));)m(g,g.gzhead.extra[g.gzindex]&255),g.gzindex++;g.gzhead.hcrc&&g.pending>r&&(a.adler=G(a.adler,g.pending_buf,g.pending-r,r));g.gzindex===
  g.gzhead.extra.length&&(g.gzindex=0,g.status=73)}else g.status=73;if(73===g.status)if(g.gzhead.name){r=g.pending;do{if(g.pending===g.pending_buf_size&&(g.gzhead.hcrc&&g.pending>r&&(a.adler=G(a.adler,g.pending_buf,g.pending-r,r)),h(a),r=g.pending,g.pending===g.pending_buf_size)){v=1;break}v=g.gzindex<g.gzhead.name.length?g.gzhead.name.charCodeAt(g.gzindex++)&255:0;m(g,v)}while(0!==v);g.gzhead.hcrc&&g.pending>r&&(a.adler=G(a.adler,g.pending_buf,g.pending-r,r));0===v&&(g.gzindex=0,g.status=91)}else g.status=
  91;if(91===g.status)if(g.gzhead.comment){r=g.pending;do{if(g.pending===g.pending_buf_size&&(g.gzhead.hcrc&&g.pending>r&&(a.adler=G(a.adler,g.pending_buf,g.pending-r,r)),h(a),r=g.pending,g.pending===g.pending_buf_size)){v=1;break}v=g.gzindex<g.gzhead.comment.length?g.gzhead.comment.charCodeAt(g.gzindex++)&255:0;m(g,v)}while(0!==v);g.gzhead.hcrc&&g.pending>r&&(a.adler=G(a.adler,g.pending_buf,g.pending-r,r));0===v&&(g.status=103)}else g.status=103;103===g.status&&(g.gzhead.hcrc?(g.pending+2>g.pending_buf_size&&
  h(a),g.pending+2<=g.pending_buf_size&&(m(g,a.adler&255),m(g,a.adler>>8&255),a.adler=0,g.status=113)):g.status=113);if(0!==g.pending){if(h(a),0===a.avail_out)return g.last_flush=-1,0}else if(0===a.avail_in&&(c<<1)-(4<c?9:0)<=(d<<1)-(4<d?9:0)&&4!==c)return e(a,-5);if(666===g.status&&0!==a.avail_in)return e(a,-5);if(0!==a.avail_in||0!==g.lookahead||0!==c&&666!==g.status){d=2===g.strategy?A(g,c):3===g.strategy?B(g,c):F[g.level].func(g,c);if(3===d||4===d)g.status=666;if(1===d||3===d)return 0===a.avail_out&&
  (g.last_flush=-1),0;if(2===d&&(1===c?K._tr_align(g):5!==c&&(K._tr_stored_block(g,0,0,!1),3===c&&(f(g.head),0===g.lookahead&&(g.strstart=0,g.block_start=0,g.insert=0))),h(a),0===a.avail_out))return g.last_flush=-1,0}if(4!==c)return 0;if(0>=g.wrap)return 1;2===g.wrap?(m(g,a.adler&255),m(g,a.adler>>8&255),m(g,a.adler>>16&255),m(g,a.adler>>24&255),m(g,a.total_in&255),m(g,a.total_in>>8&255),m(g,a.total_in>>16&255),m(g,a.total_in>>24&255)):(l(g,a.adler>>>16),l(g,a.adler&65535));h(a);0<g.wrap&&(g.wrap=-g.wrap);
  return 0!==g.pending?0:1};d.deflateEnd=function(a){var c;if(!a||!a.state)return-2;c=a.state.status;if(42!==c&&69!==c&&73!==c&&91!==c&&103!==c&&113!==c&&666!==c)return e(a,-2);a.state=null;return 113===c?e(a,-3):0};d.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":4,"./adler32":6,"./crc32":8,"./messages":14,"./trees":15}],10:[function(a,c,d){c.exports=function(){this.os=this.xflags=this.time=this.text=0;this.extra=null;this.extra_len=0;this.comment=this.name="";this.hcrc=0;this.done=
  !1}},{}],11:[function(a,c,d){c.exports=function(a,c){var d,g,m,l,q,u,w,C,B,A,E,D,z,M,r,K,N,G,x,F,t,k,p,J;d=a.state;g=a.next_in;p=a.input;m=g+(a.avail_in-5);l=a.next_out;J=a.output;q=l-(c-a.avail_out);u=l+(a.avail_out-257);w=d.dmax;C=d.wsize;B=d.whave;A=d.wnext;E=d.window;D=d.hold;z=d.bits;M=d.lencode;r=d.distcode;K=(1<<d.lenbits)-1;N=(1<<d.distbits)-1;a:do b:for(15>z&&(D+=p[g++]<<z,z+=8,D+=p[g++]<<z,z+=8),G=M[D&K];;){x=G>>>24;D>>>=x;z-=x;x=G>>>16&255;if(0===x)J[l++]=G&65535;else if(x&16){F=G&65535;
  if(x&=15)z<x&&(D+=p[g++]<<z,z+=8),F+=D&(1<<x)-1,D>>>=x,z-=x;15>z&&(D+=p[g++]<<z,z+=8,D+=p[g++]<<z,z+=8);G=r[D&N];c:for(;;){x=G>>>24;D>>>=x;z-=x;x=G>>>16&255;if(x&16){G&=65535;x&=15;z<x&&(D+=p[g++]<<z,z+=8,z<x&&(D+=p[g++]<<z,z+=8));G+=D&(1<<x)-1;if(G>w){a.msg="invalid distance too far back";d.mode=30;break a}D>>>=x;z-=x;x=l-q;if(G>x){x=G-x;if(x>B&&d.sane){a.msg="invalid distance too far back";d.mode=30;break a}t=0;k=E;if(0===A){if(t+=C-x,x<F){F-=x;do J[l++]=E[t++];while(--x);t=l-G;k=J}}else if(A<x){if(t+=
  C+A-x,x-=A,x<F){F-=x;do J[l++]=E[t++];while(--x);t=0;if(A<F){x=A;F-=x;do J[l++]=E[t++];while(--x);t=l-G;k=J}}}else if(t+=A-x,x<F){F-=x;do J[l++]=E[t++];while(--x);t=l-G;k=J}for(;2<F;)J[l++]=k[t++],J[l++]=k[t++],J[l++]=k[t++],F-=3;F&&(J[l++]=k[t++],1<F&&(J[l++]=k[t++]))}else{t=l-G;do J[l++]=J[t++],J[l++]=J[t++],J[l++]=J[t++],F-=3;while(2<F);F&&(J[l++]=J[t++],1<F&&(J[l++]=J[t++]))}}else if(0===(x&64)){G=r[(G&65535)+(D&(1<<x)-1)];continue c}else{a.msg="invalid distance code";d.mode=30;break a}break}}else if(0===
  (x&64)){G=M[(G&65535)+(D&(1<<x)-1)];continue b}else{x&32?d.mode=12:(a.msg="invalid literal/length code",d.mode=30);break a}break}while(g<m&&l<u);F=z>>3;g-=F;z-=F<<3;a.next_in=g;a.next_out=l;a.avail_in=g<m?5+(m-g):5-(g-m);a.avail_out=l<u?257+(u-l):257-(l-u);d.hold=D&(1<<z)-1;d.bits=z}},{}],12:[function(a,c,d){function e(a){return(a>>>24&255)+(a>>>8&65280)+((a&65280)<<8)+((a&255)<<24)}function f(){this.mode=0;this.last=!1;this.wrap=0;this.havedict=!1;this.total=this.check=this.dmax=this.flags=0;this.head=
  null;this.wnext=this.whave=this.wsize=this.wbits=0;this.window=null;this.extra=this.offset=this.length=this.bits=this.hold=0;this.distcode=this.lencode=null;this.have=this.ndist=this.nlen=this.ncode=this.distbits=this.lenbits=0;this.next=null;this.lens=new q.Buf16(320);this.work=new q.Buf16(288);this.distdyn=this.lendyn=null;this.was=this.back=this.sane=0}function h(a){var c;if(!a||!a.state)return-2;c=a.state;a.total_in=a.total_out=c.total=0;a.msg="";c.wrap&&(a.adler=c.wrap&1);c.mode=1;c.last=0;c.havedict=
  0;c.dmax=32768;c.head=null;c.hold=0;c.bits=0;c.lencode=c.lendyn=new q.Buf32(852);c.distcode=c.distdyn=new q.Buf32(592);c.sane=1;c.back=-1;return 0}function g(a){var c;if(!a||!a.state)return-2;c=a.state;c.wsize=0;c.whave=0;c.wnext=0;return h(a)}function m(a,c){var e,d;if(!a||!a.state)return-2;d=a.state;0>c?(e=0,c=-c):(e=(c>>4)+1,48>c&&(c&=15));if(c&&(8>c||15<c))return-2;null!==d.window&&d.wbits!==c&&(d.window=null);d.wrap=e;d.wbits=c;return g(a)}function l(a,c){var e;if(!a)return-2;e=new f;a.state=
  e;e.window=null;e=m(a,c);0!==e&&(a.state=null);return e}var q=a("../utils/common"),u=a("./adler32"),w=a("./crc32"),C=a("./inffast"),B=a("./inftrees"),A=!0,E,D;d.inflateReset=g;d.inflateReset2=m;d.inflateResetKeep=h;d.inflateInit=function(a){return l(a,15)};d.inflateInit2=l;d.inflate=function(a,c){var d,f,h,g,m,l,t,k,p,J,I,v,y,O,H=0,S,T,P,Q=new q.Buf8(4),U=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!a||!a.state||!a.output||!a.input&&0!==a.avail_in)return-2;d=a.state;12===d.mode&&(d.mode=13);
  m=a.next_out;h=a.output;t=a.avail_out;g=a.next_in;f=a.input;l=a.avail_in;k=d.hold;p=d.bits;J=l;I=t;P=0;a:for(;;)switch(d.mode){case 1:if(0===d.wrap){d.mode=13;break}for(;16>p;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}if(d.wrap&2&&35615===k){d.check=0;Q[0]=k&255;Q[1]=k>>>8&255;d.check=w(d.check,Q,2,0);p=k=0;d.mode=2;break}d.flags=0;d.head&&(d.head.done=!1);if(!(d.wrap&1)||(((k&255)<<8)+(k>>8))%31){a.msg="incorrect header check";d.mode=30;break}if(8!==(k&15)){a.msg="unknown compression method";d.mode=
  30;break}k>>>=4;p-=4;y=(k&15)+8;if(0===d.wbits)d.wbits=y;else if(y>d.wbits){a.msg="invalid window size";d.mode=30;break}d.dmax=1<<y;a.adler=d.check=1;d.mode=k&512?10:12;p=k=0;break;case 2:for(;16>p;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}d.flags=k;if(8!==(d.flags&255)){a.msg="unknown compression method";d.mode=30;break}if(d.flags&57344){a.msg="unknown header flags set";d.mode=30;break}d.head&&(d.head.text=k>>8&1);d.flags&512&&(Q[0]=k&255,Q[1]=k>>>8&255,d.check=w(d.check,Q,2,0));p=k=0;d.mode=3;case 3:for(;32>
  p;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}d.head&&(d.head.time=k);d.flags&512&&(Q[0]=k&255,Q[1]=k>>>8&255,Q[2]=k>>>16&255,Q[3]=k>>>24&255,d.check=w(d.check,Q,4,0));p=k=0;d.mode=4;case 4:for(;16>p;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}d.head&&(d.head.xflags=k&255,d.head.os=k>>8);d.flags&512&&(Q[0]=k&255,Q[1]=k>>>8&255,d.check=w(d.check,Q,2,0));p=k=0;d.mode=5;case 5:if(d.flags&1024){for(;16>p;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}d.length=k;d.head&&(d.head.extra_len=k);d.flags&512&&(Q[0]=k&255,
  Q[1]=k>>>8&255,d.check=w(d.check,Q,2,0));p=k=0}else d.head&&(d.head.extra=null);d.mode=6;case 6:if(d.flags&1024&&(v=d.length,v>l&&(v=l),v&&(d.head&&(y=d.head.extra_len-d.length,d.head.extra||(d.head.extra=Array(d.head.extra_len)),q.arraySet(d.head.extra,f,g,v,y)),d.flags&512&&(d.check=w(d.check,f,v,g)),l-=v,g+=v,d.length-=v),d.length))break a;d.length=0;d.mode=7;case 7:if(d.flags&2048){if(0===l)break a;v=0;do y=f[g+v++],d.head&&y&&65536>d.length&&(d.head.name+=String.fromCharCode(y));while(y&&v<l);
  d.flags&512&&(d.check=w(d.check,f,v,g));l-=v;g+=v;if(y)break a}else d.head&&(d.head.name=null);d.length=0;d.mode=8;case 8:if(d.flags&4096){if(0===l)break a;v=0;do y=f[g+v++],d.head&&y&&65536>d.length&&(d.head.comment+=String.fromCharCode(y));while(y&&v<l);d.flags&512&&(d.check=w(d.check,f,v,g));l-=v;g+=v;if(y)break a}else d.head&&(d.head.comment=null);d.mode=9;case 9:if(d.flags&512){for(;16>p;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}if(k!==(d.check&65535)){a.msg="header crc mismatch";d.mode=30;break}p=
  k=0}d.head&&(d.head.hcrc=d.flags>>9&1,d.head.done=!0);a.adler=d.check=0;d.mode=12;break;case 10:for(;32>p;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}a.adler=d.check=e(k);p=k=0;d.mode=11;case 11:if(0===d.havedict)return a.next_out=m,a.avail_out=t,a.next_in=g,a.avail_in=l,d.hold=k,d.bits=p,2;a.adler=d.check=1;d.mode=12;case 12:if(5===c||6===c)break a;case 13:if(d.last){k>>>=p&7;p-=p&7;d.mode=27;break}for(;3>p;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}d.last=k&1;k>>>=1;--p;switch(k&3){case 0:d.mode=14;
  break;case 1:v=d;if(A){y=void 0;E=new q.Buf32(512);D=new q.Buf32(32);for(y=0;144>y;)v.lens[y++]=8;for(;256>y;)v.lens[y++]=9;for(;280>y;)v.lens[y++]=7;for(;288>y;)v.lens[y++]=8;B(1,v.lens,0,288,E,0,v.work,{bits:9});for(y=0;32>y;)v.lens[y++]=5;B(2,v.lens,0,32,D,0,v.work,{bits:5});A=!1}v.lencode=E;v.lenbits=9;v.distcode=D;v.distbits=5;d.mode=20;if(6===c){k>>>=2;p-=2;break a}break;case 2:d.mode=17;break;case 3:a.msg="invalid block type",d.mode=30}k>>>=2;p-=2;break;case 14:k>>>=p&7;for(p-=p&7;32>p;){if(0===
  l)break a;l--;k+=f[g++]<<p;p+=8}if((k&65535)!==(k>>>16^65535)){a.msg="invalid stored block lengths";d.mode=30;break}d.length=k&65535;p=k=0;d.mode=15;if(6===c)break a;case 15:d.mode=16;case 16:if(v=d.length){v>l&&(v=l);v>t&&(v=t);if(0===v)break a;q.arraySet(h,f,g,v,m);l-=v;g+=v;t-=v;m+=v;d.length-=v;break}d.mode=12;break;case 17:for(;14>p;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}d.nlen=(k&31)+257;k>>>=5;p-=5;d.ndist=(k&31)+1;k>>>=5;p-=5;d.ncode=(k&15)+4;k>>>=4;p-=4;if(286<d.nlen||30<d.ndist){a.msg=
  "too many length or distance symbols";d.mode=30;break}d.have=0;d.mode=18;case 18:for(;d.have<d.ncode;){for(;3>p;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}d.lens[U[d.have++]]=k&7;k>>>=3;p-=3}for(;19>d.have;)d.lens[U[d.have++]]=0;d.lencode=d.lendyn;d.lenbits=7;v={bits:d.lenbits};P=B(0,d.lens,0,19,d.lencode,0,d.work,v);d.lenbits=v.bits;if(P){a.msg="invalid code lengths set";d.mode=30;break}d.have=0;d.mode=19;case 19:for(;d.have<d.nlen+d.ndist;){for(;;){H=d.lencode[k&(1<<d.lenbits)-1];v=H>>>24;H&=65535;
  if(v<=p)break;if(0===l)break a;l--;k+=f[g++]<<p;p+=8}if(16>H)k>>>=v,p-=v,d.lens[d.have++]=H;else{if(16===H){for(y=v+2;p<y;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}k>>>=v;p-=v;if(0===d.have){a.msg="invalid bit length repeat";d.mode=30;break}y=d.lens[d.have-1];v=3+(k&3);k>>>=2;p-=2}else if(17===H){for(y=v+3;p<y;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}k>>>=v;p-=v;y=0;v=3+(k&7);k>>>=3;p-=3}else{for(y=v+7;p<y;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}k>>>=v;p-=v;y=0;v=11+(k&127);k>>>=7;p-=7}if(d.have+
  v>d.nlen+d.ndist){a.msg="invalid bit length repeat";d.mode=30;break}for(;v--;)d.lens[d.have++]=y}}if(30===d.mode)break;if(0===d.lens[256]){a.msg="invalid code -- missing end-of-block";d.mode=30;break}d.lenbits=9;v={bits:d.lenbits};P=B(1,d.lens,0,d.nlen,d.lencode,0,d.work,v);d.lenbits=v.bits;if(P){a.msg="invalid literal/lengths set";d.mode=30;break}d.distbits=6;d.distcode=d.distdyn;v={bits:d.distbits};P=B(2,d.lens,d.nlen,d.ndist,d.distcode,0,d.work,v);d.distbits=v.bits;if(P){a.msg="invalid distances set";
  d.mode=30;break}d.mode=20;if(6===c)break a;case 20:d.mode=21;case 21:if(6<=l&&258<=t){a.next_out=m;a.avail_out=t;a.next_in=g;a.avail_in=l;d.hold=k;d.bits=p;C(a,I);m=a.next_out;h=a.output;t=a.avail_out;g=a.next_in;f=a.input;l=a.avail_in;k=d.hold;p=d.bits;12===d.mode&&(d.back=-1);break}for(d.back=0;;){H=d.lencode[k&(1<<d.lenbits)-1];v=H>>>24;y=H>>>16&255;H&=65535;if(v<=p)break;if(0===l)break a;l--;k+=f[g++]<<p;p+=8}if(y&&0===(y&240)){O=v;S=y;for(T=H;;){H=d.lencode[T+((k&(1<<O+S)-1)>>O)];v=H>>>24;y=
  H>>>16&255;H&=65535;if(O+v<=p)break;if(0===l)break a;l--;k+=f[g++]<<p;p+=8}k>>>=O;p-=O;d.back+=O}k>>>=v;p-=v;d.back+=v;d.length=H;if(0===y){d.mode=26;break}if(y&32){d.back=-1;d.mode=12;break}if(y&64){a.msg="invalid literal/length code";d.mode=30;break}d.extra=y&15;d.mode=22;case 22:if(d.extra){for(y=d.extra;p<y;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}d.length+=k&(1<<d.extra)-1;k>>>=d.extra;p-=d.extra;d.back+=d.extra}d.was=d.length;d.mode=23;case 23:for(;;){H=d.distcode[k&(1<<d.distbits)-1];v=H>>>
  24;y=H>>>16&255;H&=65535;if(v<=p)break;if(0===l)break a;l--;k+=f[g++]<<p;p+=8}if(0===(y&240)){O=v;S=y;for(T=H;;){H=d.distcode[T+((k&(1<<O+S)-1)>>O)];v=H>>>24;y=H>>>16&255;H&=65535;if(O+v<=p)break;if(0===l)break a;l--;k+=f[g++]<<p;p+=8}k>>>=O;p-=O;d.back+=O}k>>>=v;p-=v;d.back+=v;if(y&64){a.msg="invalid distance code";d.mode=30;break}d.offset=H;d.extra=y&15;d.mode=24;case 24:if(d.extra){for(y=d.extra;p<y;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}d.offset+=k&(1<<d.extra)-1;k>>>=d.extra;p-=d.extra;d.back+=
  d.extra}if(d.offset>d.dmax){a.msg="invalid distance too far back";d.mode=30;break}d.mode=25;case 25:if(0===t)break a;v=I-t;if(d.offset>v){v=d.offset-v;if(v>d.whave&&d.sane){a.msg="invalid distance too far back";d.mode=30;break}v>d.wnext?(v-=d.wnext,y=d.wsize-v):y=d.wnext-v;v>d.length&&(v=d.length);O=d.window}else O=h,y=m-d.offset,v=d.length;v>t&&(v=t);t-=v;d.length-=v;do h[m++]=O[y++];while(--v);0===d.length&&(d.mode=21);break;case 26:if(0===t)break a;h[m++]=d.length;t--;d.mode=21;break;case 27:if(d.wrap){for(;32>
  p;){if(0===l)break a;l--;k|=f[g++]<<p;p+=8}I-=t;a.total_out+=I;d.total+=I;I&&(a.adler=d.check=d.flags?w(d.check,h,I,m-I):u(d.check,h,I,m-I));I=t;if((d.flags?k:e(k))!==d.check){a.msg="incorrect data check";d.mode=30;break}p=k=0}d.mode=28;case 28:if(d.wrap&&d.flags){for(;32>p;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}if(k!==(d.total&4294967295)){a.msg="incorrect length check";d.mode=30;break}p=k=0}d.mode=29;case 29:P=1;break a;case 30:P=-3;break a;case 31:return-4;default:return-2}a.next_out=m;a.avail_out=
  t;a.next_in=g;a.avail_in=l;d.hold=k;d.bits=p;if(d.wsize||I!==a.avail_out&&30>d.mode&&(27>d.mode||4!==c))f=a.output,g=a.next_out,m=I-a.avail_out,t=a.state,null===t.window&&(t.wsize=1<<t.wbits,t.wnext=0,t.whave=0,t.window=new q.Buf8(t.wsize)),m>=t.wsize?(q.arraySet(t.window,f,g-t.wsize,t.wsize,0),t.wnext=0,t.whave=t.wsize):(l=t.wsize-t.wnext,l>m&&(l=m),q.arraySet(t.window,f,g-m,l,t.wnext),(m-=l)?(q.arraySet(t.window,f,g-m,m,0),t.wnext=m,t.whave=t.wsize):(t.wnext+=l,t.wnext===t.wsize&&(t.wnext=0),t.whave<
  t.wsize&&(t.whave+=l)));J-=a.avail_in;I-=a.avail_out;a.total_in+=J;a.total_out+=I;d.total+=I;d.wrap&&I&&(a.adler=d.check=d.flags?w(d.check,h,I,a.next_out-I):u(d.check,h,I,a.next_out-I));a.data_type=d.bits+(d.last?64:0)+(12===d.mode?128:0)+(20===d.mode||15===d.mode?256:0);(0===J&&0===I||4===c)&&0===P&&(P=-5);return P};d.inflateEnd=function(a){if(!a||!a.state)return-2;var c=a.state;c.window&&(c.window=null);a.state=null;return 0};d.inflateGetHeader=function(a,c){var d;if(!a||!a.state)return-2;d=a.state;
  if(0===(d.wrap&2))return-2;d.head=c;c.done=!1;return 0};d.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":4,"./adler32":6,"./crc32":8,"./inffast":11,"./inftrees":13}],13:[function(a,c,d){var e=a("../utils/common"),f=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],h=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],g=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,
  3073,4097,6145,8193,12289,16385,24577,0,0],m=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];c.exports=function(a,c,d,w,C,B,A,E){for(var D=E.bits,z=0,M=0,r=0,K=0,N=0,G=0,x=0,F=0,t=0,k=0,p,J,I=null,v=0,y,O=new e.Buf16(16),G=new e.Buf16(16),H=null,S=0,T,P,Q,z=0;15>=z;z++)O[z]=0;for(M=0;M<w;M++)O[c[d+M]]++;N=D;for(K=15;1<=K&&0===O[K];K--);N>K&&(N=K);if(0===K)return C[B++]=20971520,C[B++]=20971520,E.bits=1,0;for(r=1;r<K&&0===O[r];r++);N<r&&(N=r);for(z=
  F=1;15>=z;z++)if(F<<=1,F-=O[z],0>F)return-1;if(0<F&&(0===a||1!==K))return-1;G[1]=0;for(z=1;15>z;z++)G[z+1]=G[z]+O[z];for(M=0;M<w;M++)0!==c[d+M]&&(A[G[c[d+M]]++]=M);0===a?(I=H=A,y=19):1===a?(I=f,v-=257,H=h,S-=257,y=256):(I=g,H=m,y=-1);M=k=0;z=r;D=B;G=N;x=0;J=-1;t=1<<N;w=t-1;if(1===a&&852<t||2===a&&592<t)return 1;for(var U=0;;){U++;T=z-x;A[M]<y?(P=0,Q=A[M]):A[M]>y?(P=H[S+A[M]],Q=I[v+A[M]]):(P=96,Q=0);F=1<<z-x;r=p=1<<G;do p-=F,C[D+(k>>x)+p]=T<<24|P<<16|Q|0;while(0!==p);for(F=1<<z-1;k&F;)F>>=1;0!==F?
  (k&=F-1,k+=F):k=0;M++;if(0===--O[z]){if(z===K)break;z=c[d+A[M]]}if(z>N&&(k&w)!==J){0===x&&(x=N);D+=r;G=z-x;for(F=1<<G;G+x<K;){F-=O[G+x];if(0>=F)break;G++;F<<=1}t+=1<<G;if(1===a&&852<t||2===a&&592<t)return 1;J=k&w;C[J]=N<<24|G<<16|D-B|0}}0!==k&&(C[D+k]=z-x<<24|4194304);E.bits=N;return 0}},{"../utils/common":4}],14:[function(a,c,d){c.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},
  {}],15:[function(a,c,d){function e(a){for(var c=a.length;0<=--c;)a[c]=0}function f(a,c){a.pending_buf[a.pending++]=c&255;a.pending_buf[a.pending++]=c>>>8&255}function h(a,c,d){a.bi_valid>16-d?(a.bi_buf|=c<<a.bi_valid&65535,f(a,a.bi_buf),a.bi_buf=c>>16-a.bi_valid,a.bi_valid+=d-16):(a.bi_buf|=c<<a.bi_valid&65535,a.bi_valid+=d)}function g(a,c,d){h(a,d[2*c],d[2*c+1])}function m(a,c){var d=0;do d|=a&1,a>>>=1,d<<=1;while(0<--c);return d>>>1}function l(a,c,d){var e=Array(16),f=0,h;for(h=1;15>=h;h++)e[h]=
  f=f+d[h-1]<<1;for(d=0;d<=c;d++)f=a[2*d+1],0!==f&&(a[2*d]=m(e[f]++,f))}function q(a){var c;for(c=0;286>c;c++)a.dyn_ltree[2*c]=0;for(c=0;30>c;c++)a.dyn_dtree[2*c]=0;for(c=0;19>c;c++)a.bl_tree[2*c]=0;a.dyn_ltree[512]=1;a.opt_len=a.static_len=0;a.last_lit=a.matches=0}function u(a){8<a.bi_valid?f(a,a.bi_buf):0<a.bi_valid&&(a.pending_buf[a.pending++]=a.bi_buf);a.bi_buf=0;a.bi_valid=0}function w(a,c,d,e){var f=2*c,h=2*d;return a[f]<a[h]||a[f]===a[h]&&e[c]<=e[d]}function C(a,c,d){for(var e=a.heap[d],f=d<<
  1;f<=a.heap_len;){f<a.heap_len&&w(c,a.heap[f+1],a.heap[f],a.depth)&&f++;if(w(c,e,a.heap[f],a.depth))break;a.heap[d]=a.heap[f];d=f;f<<=1}a.heap[d]=e}function B(a,c,d){var e,f,m=0,l,y;if(0!==a.last_lit){do e=a.pending_buf[a.d_buf+2*m]<<8|a.pending_buf[a.d_buf+2*m+1],f=a.pending_buf[a.l_buf+m],m++,0===e?g(a,f,c):(l=p[f],g(a,l+256+1,c),y=K[l],0!==y&&(f-=J[l],h(a,f,y)),e--,l=256>e?k[e]:k[256+(e>>>7)],g(a,l,d),y=N[l],0!==y&&(e-=I[l],h(a,e,y)));while(m<a.last_lit)}g(a,256,c)}function A(a,c){var d=c.dyn_tree,
  e=c.stat_desc.static_tree,f=c.stat_desc.has_stree,h=c.stat_desc.elems,g,k=-1,m;a.heap_len=0;a.heap_max=573;for(g=0;g<h;g++)0!==d[2*g]?(a.heap[++a.heap_len]=k=g,a.depth[g]=0):d[2*g+1]=0;for(;2>a.heap_len;)m=a.heap[++a.heap_len]=2>k?++k:0,d[2*m]=1,a.depth[m]=0,a.opt_len--,f&&(a.static_len-=e[2*m+1]);c.max_code=k;for(g=a.heap_len>>1;1<=g;g--)C(a,d,g);m=h;do g=a.heap[1],a.heap[1]=a.heap[a.heap_len--],C(a,d,1),e=a.heap[1],a.heap[--a.heap_max]=g,a.heap[--a.heap_max]=e,d[2*m]=d[2*g]+d[2*e],a.depth[m]=(a.depth[g]>=
  a.depth[e]?a.depth[g]:a.depth[e])+1,d[2*g+1]=d[2*e+1]=m,a.heap[1]=m++,C(a,d,1);while(2<=a.heap_len);a.heap[--a.heap_max]=a.heap[1];g=c.dyn_tree;m=c.max_code;for(var y=c.stat_desc.static_tree,r=c.stat_desc.has_stree,p=c.stat_desc.extra_bits,v=c.stat_desc.extra_base,O=c.stat_desc.max_length,I,q,H=0,h=0;15>=h;h++)a.bl_count[h]=0;g[2*a.heap[a.heap_max]+1]=0;for(e=a.heap_max+1;573>e;e++)f=a.heap[e],h=g[2*g[2*f+1]+1]+1,h>O&&(h=O,H++),g[2*f+1]=h,f>m||(a.bl_count[h]++,I=0,f>=v&&(I=p[f-v]),q=g[2*f],a.opt_len+=
  q*(h+I),r&&(a.static_len+=q*(y[2*f+1]+I)));if(0!==H){do{for(h=O-1;0===a.bl_count[h];)h--;a.bl_count[h]--;a.bl_count[h+1]+=2;a.bl_count[O]--;H-=2}while(0<H);for(h=O;0!==h;h--)for(f=a.bl_count[h];0!==f;)y=a.heap[--e],y>m||(g[2*y+1]!==h&&(a.opt_len+=(h-g[2*y+1])*g[2*y],g[2*y+1]=h),f--)}l(d,k,a.bl_count)}function E(a,c,d){var e,f=-1,h,g=c[1],k=0,m=7,l=4;0===g&&(m=138,l=3);c[2*(d+1)+1]=65535;for(e=0;e<=d;e++)h=g,g=c[2*(e+1)+1],++k<m&&h===g||(k<l?a.bl_tree[2*h]+=k:0!==h?(h!==f&&a.bl_tree[2*h]++,a.bl_tree[32]++):
  10>=k?a.bl_tree[34]++:a.bl_tree[36]++,k=0,f=h,0===g?(m=138,l=3):h===g?(m=6,l=3):(m=7,l=4))}function D(a,c,d){var e,f=-1,k,m=c[1],l=0,y=7,r=4;0===m&&(y=138,r=3);for(e=0;e<=d;e++)if(k=m,m=c[2*(e+1)+1],!(++l<y&&k===m)){if(l<r){do g(a,k,a.bl_tree);while(0!==--l)}else 0!==k?(k!==f&&(g(a,k,a.bl_tree),l--),g(a,16,a.bl_tree),h(a,l-3,2)):10>=l?(g(a,17,a.bl_tree),h(a,l-3,3)):(g(a,18,a.bl_tree),h(a,l-11,7));l=0;f=k;0===m?(y=138,r=3):k===m?(y=6,r=3):(y=7,r=4)}}function z(a){var c=4093624447,d;for(d=0;31>=d;d++,
  c>>>=1)if(c&1&&0!==a.dyn_ltree[2*d])return 0;if(0!==a.dyn_ltree[18]||0!==a.dyn_ltree[20]||0!==a.dyn_ltree[26])return 1;for(d=32;256>d;d++)if(0!==a.dyn_ltree[2*d])return 1;return 0}function M(a,c,d,e){h(a,0+(e?1:0),3);u(a);f(a,d);f(a,~d);r.arraySet(a.pending_buf,a.window,c,d,a.pending);a.pending+=d}var r=a("../utils/common"),K=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],N=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],G=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],
  x=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],F=Array(576);e(F);var t=Array(60);e(t);var k=Array(512);e(k);var p=Array(256);e(p);var J=Array(29);e(J);var I=Array(30);e(I);var v=function(a,c,d,e,f){this.static_tree=a;this.extra_bits=c;this.extra_base=d;this.elems=e;this.max_length=f;this.has_stree=a&&a.length},y,O,H,S=function(a,c){this.dyn_tree=a;this.max_code=0;this.stat_desc=c},T=!1;d._tr_init=function(a){if(!T){var c,d,e,f=Array(16);for(e=d=0;28>e;e++)for(J[e]=d,c=0;c<1<<K[e];c++)p[d++]=e;
  p[d-1]=e;for(e=d=0;16>e;e++)for(I[e]=d,c=0;c<1<<N[e];c++)k[d++]=e;for(d>>=7;30>e;e++)for(I[e]=d<<7,c=0;c<1<<N[e]-7;c++)k[256+d++]=e;for(c=0;15>=c;c++)f[c]=0;for(c=0;143>=c;)F[2*c+1]=8,c++,f[8]++;for(;255>=c;)F[2*c+1]=9,c++,f[9]++;for(;279>=c;)F[2*c+1]=7,c++,f[7]++;for(;287>=c;)F[2*c+1]=8,c++,f[8]++;l(F,287,f);for(c=0;30>c;c++)t[2*c+1]=5,t[2*c]=m(c,5);y=new v(F,K,257,286,15);O=new v(t,N,0,30,15);H=new v([],G,0,19,7);T=!0}a.l_desc=new S(a.dyn_ltree,y);a.d_desc=new S(a.dyn_dtree,O);a.bl_desc=new S(a.bl_tree,
  H);a.bi_buf=0;a.bi_valid=0;q(a)};d._tr_stored_block=M;d._tr_flush_block=function(a,c,d,e){var f,g,k=0;if(0<a.level){2===a.strm.data_type&&(a.strm.data_type=z(a));A(a,a.l_desc);A(a,a.d_desc);E(a,a.dyn_ltree,a.l_desc.max_code);E(a,a.dyn_dtree,a.d_desc.max_code);A(a,a.bl_desc);for(k=18;3<=k&&0===a.bl_tree[2*x[k]+1];k--);a.opt_len+=3*(k+1)+14;f=a.opt_len+3+7>>>3;g=a.static_len+3+7>>>3;g<=f&&(f=g)}else f=g=d+5;if(d+4<=f&&-1!==c)M(a,c,d,e);else if(4===a.strategy||g===f)h(a,2+(e?1:0),3),B(a,F,t);else{h(a,
  4+(e?1:0),3);c=a.l_desc.max_code+1;d=a.d_desc.max_code+1;k+=1;h(a,c-257,5);h(a,d-1,5);h(a,k-4,4);for(f=0;f<k;f++)h(a,a.bl_tree[2*x[f]+1],3);D(a,a.dyn_ltree,c-1);D(a,a.dyn_dtree,d-1);B(a,a.dyn_ltree,a.dyn_dtree)}q(a);e&&u(a)};d._tr_tally=function(a,c,d){a.pending_buf[a.d_buf+2*a.last_lit]=c>>>8&255;a.pending_buf[a.d_buf+2*a.last_lit+1]=c&255;a.pending_buf[a.l_buf+a.last_lit]=d&255;a.last_lit++;0===c?a.dyn_ltree[2*d]++:(a.matches++,c--,a.dyn_ltree[2*(p[d]+256+1)]++,a.dyn_dtree[2*(256>c?k[c]:k[256+(c>>>
  7)])]++);return a.last_lit===a.lit_bufsize-1};d._tr_align=function(a){h(a,2,3);g(a,256,F);16===a.bi_valid?(f(a,a.bi_buf),a.bi_buf=0,a.bi_valid=0):8<=a.bi_valid&&(a.pending_buf[a.pending++]=a.bi_buf&255,a.bi_buf>>=8,a.bi_valid-=8)}},{"../utils/common":4}],16:[function(a,c,d){c.exports=function(){this.input=null;this.total_in=this.avail_in=this.next_in=0;this.output=null;this.total_out=this.avail_out=this.next_out=0;this.msg="";this.state=null;this.data_type=2;this.adler=0}},{}],17:[function(a,c,d){var e=
  e||{};e.NIFTI1=e.NIFTI1||("undefined"!==typeof a?a("./nifti1.js"):null);e.NIFTI2=e.NIFTI2||("undefined"!==typeof a?a("./nifti2.js"):null);e.Utils=e.Utils||("undefined"!==typeof a?a("./utilities.js"):null);var f=f||("undefined"!==typeof a?a("pako"):null);e.isNIFTI1=function(a){var c,d;if(a.byteLength<e.NIFTI1.STANDARD_HEADER_SIZE)return!1;(c=new DataView(a))&&(d=c.getUint8(e.NIFTI1.MAGIC_NUMBER_LOCATION));a=c.getUint8(e.NIFTI1.MAGIC_NUMBER_LOCATION+1);c=c.getUint8(e.NIFTI1.MAGIC_NUMBER_LOCATION+2);
  return!(d!==e.NIFTI1.MAGIC_NUMBER[0]||a!==e.NIFTI1.MAGIC_NUMBER[1]||c!==e.NIFTI1.MAGIC_NUMBER[2])};e.isNIFTI2=function(a){var c,d;if(a.byteLength<e.NIFTI1.STANDARD_HEADER_SIZE)return!1;c=new DataView(a);a=c.getUint8(e.NIFTI2.MAGIC_NUMBER_LOCATION);d=c.getUint8(e.NIFTI2.MAGIC_NUMBER_LOCATION+1);c=c.getUint8(e.NIFTI2.MAGIC_NUMBER_LOCATION+2);return!(a!==e.NIFTI2.MAGIC_NUMBER[0]||d!==e.NIFTI2.MAGIC_NUMBER[1]||c!==e.NIFTI2.MAGIC_NUMBER[2])};e.isNIFTI=function(a){return e.isNIFTI1(a)||e.isNIFTI2(a)};e.isCompressed=
  function(a){var c;return a&&(c=new DataView(a),a=c.getUint8(0),c=c.getUint8(1),a===e.Utils.GUNZIP_MAGIC_COOKIE1||c===e.Utils.GUNZIP_MAGIC_COOKIE2)?!0:!1};e.decompress=function(a){return f.inflate(a).buffer};e.readHeader=function(a){var c=null;e.isCompressed(a)&&(a=e.decompress(a));e.isNIFTI1(a)?c=new e.NIFTI1:e.isNIFTI2(a)&&(c=new e.NIFTI2);c?c.readHeader(a):console.error("That file does not appear to be NIFTI!");return c};e.hasExtension=function(a){return 0!=a.extensionFlag[0]};e.readImage=function(a,
  c){var d=a.vox_offset,e=1,f=1;a.dims[4]&&(e=a.dims[4]);a.dims[5]&&(f=a.dims[5]);return c.slice(d,d+a.numBitsPerVoxel/8*a.dims[2]*a.dims[3]*e*f*a.dims[1])};e.readExtension=function(a,c){var d=a.getExtensionLocation();return c.slice(d,d+a.extensionSize)};e.readExtensionData=function(a,c){var d=a.getExtensionLocation();return c.slice(d+8,d+a.extensionSize-8)};"undefined"!==typeof c&&c.exports&&(c.exports=e)},{"./nifti1.js":18,"./nifti2.js":19,"./utilities.js":20,pako:1}],18:[function(a,c,d){var e=e||
  {};e.Utils=e.Utils||("undefined"!==typeof a?a("./utilities.js"):null);e.NIFTI1=e.NIFTI1||function(){this.littleEndian=!1;this.dim_info=0;this.dims=[];this.slice_code=this.slice_end=this.slice_start=this.numBitsPerVoxel=this.datatypeCode=this.intent_code=this.intent_p3=this.intent_p2=this.intent_p1=0;this.pixDims=[];this.vox_offset=0;this.scl_slope=1;this.toffset=this.slice_duration=this.cal_min=this.cal_max=this.xyzt_units=this.scl_inter=0;this.intent_name=this.aux_file=this.description="";this.qoffset_z=
  this.qoffset_y=this.qoffset_x=this.quatern_d=this.quatern_c=this.quatern_b=this.sform_code=this.qform_code=0;this.affine=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];this.magic=0;this.isHDR=!1;this.extensionFlag=[0,0,0,0];this.extensionCode=this.extensionSize=0};e.NIFTI1.TYPE_NONE=0;e.NIFTI1.TYPE_BINARY=1;e.NIFTI1.TYPE_UINT8=2;e.NIFTI1.TYPE_INT16=4;e.NIFTI1.TYPE_INT32=8;e.NIFTI1.TYPE_FLOAT32=16;e.NIFTI1.TYPE_COMPLEX64=32;e.NIFTI1.TYPE_FLOAT64=64;e.NIFTI1.TYPE_RGB24=128;e.NIFTI1.TYPE_INT8=256;e.NIFTI1.TYPE_UINT16=
  512;e.NIFTI1.TYPE_UINT32=768;e.NIFTI1.TYPE_INT64=1024;e.NIFTI1.TYPE_UINT64=1280;e.NIFTI1.TYPE_FLOAT128=1536;e.NIFTI1.TYPE_COMPLEX128=1792;e.NIFTI1.TYPE_COMPLEX256=2048;e.NIFTI1.XFORM_UNKNOWN=0;e.NIFTI1.XFORM_SCANNER_ANAT=1;e.NIFTI1.XFORM_ALIGNED_ANAT=2;e.NIFTI1.XFORM_TALAIRACH=3;e.NIFTI1.XFORM_MNI_152=4;e.NIFTI1.SPATIAL_UNITS_MASK=7;e.NIFTI1.TEMPORAL_UNITS_MASK=56;e.NIFTI1.UNITS_UNKNOWN=0;e.NIFTI1.UNITS_METER=1;e.NIFTI1.UNITS_MM=2;e.NIFTI1.UNITS_MICRON=3;e.NIFTI1.UNITS_SEC=8;e.NIFTI1.UNITS_MSEC=16;
  e.NIFTI1.UNITS_USEC=24;e.NIFTI1.UNITS_HZ=32;e.NIFTI1.UNITS_PPM=40;e.NIFTI1.UNITS_RADS=48;e.NIFTI1.MAGIC_COOKIE=348;e.NIFTI1.STANDARD_HEADER_SIZE=348;e.NIFTI1.MAGIC_NUMBER_LOCATION=344;e.NIFTI1.MAGIC_NUMBER=[110,43,49];e.NIFTI1.MAGIC_NUMBER2=[110,105,49];e.NIFTI1.EXTENSION_HEADER_SIZE=8;e.NIFTI1.prototype.readHeader=function(a){a=new DataView(a);var c=e.Utils.getIntAt(a,0,this.littleEndian),d,m;c!==e.NIFTI1.MAGIC_COOKIE&&(this.littleEndian=!0,c=e.Utils.getIntAt(a,0,this.littleEndian));if(c!==e.NIFTI1.MAGIC_COOKIE)throw Error("This does not appear to be a NIFTI file!");
  this.dim_info=e.Utils.getByteAt(a,39);for(d=0;8>d;d+=1)c=40+2*d,this.dims[d]=e.Utils.getShortAt(a,c,this.littleEndian);this.intent_p1=e.Utils.getFloatAt(a,56,this.littleEndian);this.intent_p2=e.Utils.getFloatAt(a,60,this.littleEndian);this.intent_p3=e.Utils.getFloatAt(a,64,this.littleEndian);this.intent_code=e.Utils.getShortAt(a,68,this.littleEndian);this.datatypeCode=e.Utils.getShortAt(a,70,this.littleEndian);this.numBitsPerVoxel=e.Utils.getShortAt(a,72,this.littleEndian);this.slice_start=e.Utils.getShortAt(a,
  74,this.littleEndian);for(d=0;8>d;d+=1)c=76+4*d,this.pixDims[d]=e.Utils.getFloatAt(a,c,this.littleEndian);this.vox_offset=e.Utils.getFloatAt(a,108,this.littleEndian);this.scl_slope=e.Utils.getFloatAt(a,112,this.littleEndian);this.scl_inter=e.Utils.getFloatAt(a,116,this.littleEndian);this.slice_end=e.Utils.getShortAt(a,120,this.littleEndian);this.slice_code=e.Utils.getByteAt(a,122);this.xyzt_units=e.Utils.getByteAt(a,123);this.cal_max=e.Utils.getFloatAt(a,124,this.littleEndian);this.cal_min=e.Utils.getFloatAt(a,
  128,this.littleEndian);this.slice_duration=e.Utils.getFloatAt(a,132,this.littleEndian);this.toffset=e.Utils.getFloatAt(a,136,this.littleEndian);this.description=e.Utils.getStringAt(a,148,228);this.aux_file=e.Utils.getStringAt(a,228,252);this.qform_code=e.Utils.getShortAt(a,252,this.littleEndian);this.sform_code=e.Utils.getShortAt(a,254,this.littleEndian);this.quatern_b=e.Utils.getFloatAt(a,256,this.littleEndian);this.quatern_c=e.Utils.getFloatAt(a,260,this.littleEndian);this.quatern_d=e.Utils.getFloatAt(a,
  264,this.littleEndian);this.qoffset_x=e.Utils.getFloatAt(a,268,this.littleEndian);this.qoffset_y=e.Utils.getFloatAt(a,272,this.littleEndian);this.qoffset_z=e.Utils.getFloatAt(a,276,this.littleEndian);for(d=0;3>d;d+=1)for(m=0;4>m;m+=1)c=280+4*(4*d+m),this.affine[d][m]=e.Utils.getFloatAt(a,c,this.littleEndian);this.affine[3][0]=0;this.affine[3][1]=0;this.affine[3][2]=0;this.affine[3][3]=1;this.intent_name=e.Utils.getStringAt(a,328,344);this.magic=e.Utils.getStringAt(a,344,348);this.isHDR=this.magic===
  e.NIFTI1.MAGIC_NUMBER2;a.byteLength>e.NIFTI1.MAGIC_COOKIE&&(this.extensionFlag[0]=e.Utils.getByteAt(a,348),this.extensionFlag[1]=e.Utils.getByteAt(a,349),this.extensionFlag[2]=e.Utils.getByteAt(a,350),this.extensionFlag[3]=e.Utils.getByteAt(a,351),this.extensionFlag[0]&&(this.extensionSize=this.getExtensionSize(a),this.extensionCode=this.getExtensionCode(a)))};e.NIFTI1.prototype.toFormattedString=function(){var a=e.Utils.formatNumber,c;c=""+("Dim Info = "+this.dim_info+"\n");c+="Image Dimensions (1-8): "+
  this.dims[0]+", "+this.dims[1]+", "+this.dims[2]+", "+this.dims[3]+", "+this.dims[4]+", "+this.dims[5]+", "+this.dims[6]+", "+this.dims[7]+"\n";c+="Intent Parameters (1-3): "+this.intent_p1+", "+this.intent_p2+", "+this.intent_p3+"\n";c+="Intent Code = "+this.intent_code+"\n";c+="Datatype = "+this.datatypeCode+" ("+this.getDatatypeCodeString(this.datatypeCode)+")\n";c+="Bits Per Voxel = "+this.numBitsPerVoxel+"\n";c+="Slice Start = "+this.slice_start+"\n";c+="Voxel Dimensions (1-8): "+a(this.pixDims[0])+
  ", "+a(this.pixDims[1])+", "+a(this.pixDims[2])+", "+a(this.pixDims[3])+", "+a(this.pixDims[4])+", "+a(this.pixDims[5])+", "+a(this.pixDims[6])+", "+a(this.pixDims[7])+"\n";c+="Image Offset = "+this.vox_offset+"\n";c+="Data Scale:  Slope = "+a(this.scl_slope)+"  Intercept = "+a(this.scl_inter)+"\n";c+="Slice End = "+this.slice_end+"\n";c+="Slice Code = "+this.slice_code+"\n";c+="Units Code = "+this.xyzt_units+" ("+this.getUnitsCodeString(e.NIFTI1.SPATIAL_UNITS_MASK&this.xyzt_units)+", "+this.getUnitsCodeString(e.NIFTI1.TEMPORAL_UNITS_MASK&
  this.xyzt_units)+")\n";c+="Display Range:  Max = "+a(this.cal_max)+"  Min = "+a(this.cal_min)+"\n";c+="Slice Duration = "+this.slice_duration+"\n";c+="Time Axis Shift = "+this.toffset+"\n";c+='Description: "'+this.description+'"\n';c+='Auxiliary File: "'+this.aux_file+'"\n';c+="Q-Form Code = "+this.qform_code+" ("+this.getTransformCodeString(this.qform_code)+")\n";c+="S-Form Code = "+this.sform_code+" ("+this.getTransformCodeString(this.sform_code)+")\n";c+="Quaternion Parameters:  b = "+a(this.quatern_b)+
  "  c = "+a(this.quatern_c)+"  d = "+a(this.quatern_d)+"\n";c+="Quaternion Offsets:  x = "+this.qoffset_x+"  y = "+this.qoffset_y+"  z = "+this.qoffset_z+"\n";c+="S-Form Parameters X: "+a(this.affine[0][0])+", "+a(this.affine[0][1])+", "+a(this.affine[0][2])+", "+a(this.affine[0][3])+"\n";c+="S-Form Parameters Y: "+a(this.affine[1][0])+", "+a(this.affine[1][1])+", "+a(this.affine[1][2])+", "+a(this.affine[1][3])+"\n";c+="S-Form Parameters Z: "+a(this.affine[2][0])+", "+a(this.affine[2][1])+", "+a(this.affine[2][2])+
  ", "+a(this.affine[2][3])+"\n";c+='Intent Name: "'+this.intent_name+'"\n';this.extensionFlag[0]&&(c+="Extension: Size = "+this.extensionSize+"  Code = "+this.extensionCode+"\n");return c};e.NIFTI1.prototype.getDatatypeCodeString=function(a){return a===e.NIFTI1.TYPE_UINT8?"1-Byte Unsigned Integer":a===e.NIFTI1.TYPE_INT16?"2-Byte Signed Integer":a===e.NIFTI1.TYPE_INT32?"4-Byte Signed Integer":a===e.NIFTI1.TYPE_FLOAT32?"4-Byte Float":a===e.NIFTI1.TYPE_FLOAT64?"8-Byte Float":a===e.NIFTI1.TYPE_RGB24?"RGB":
  a===e.NIFTI1.TYPE_INT8?"1-Byte Signed Integer":a===e.NIFTI1.TYPE_UINT16?"2-Byte Unsigned Integer":a===e.NIFTI1.TYPE_UINT32?"4-Byte Unsigned Integer":a===e.NIFTI1.TYPE_INT64?"8-Byte Signed Integer":a===e.NIFTI1.TYPE_UINT64?"8-Byte Unsigned Integer":"Unknown"};e.NIFTI1.prototype.getTransformCodeString=function(a){return a===e.NIFTI1.XFORM_SCANNER_ANAT?"Scanner":a===e.NIFTI1.XFORM_ALIGNED_ANAT?"Aligned":a===e.NIFTI1.XFORM_TALAIRACH?"Talairach":a===e.NIFTI1.XFORM_MNI_152?"MNI":"Unknown"};e.NIFTI1.prototype.getUnitsCodeString=
  function(a){return a===e.NIFTI1.UNITS_METER?"Meters":a===e.NIFTI1.UNITS_MM?"Millimeters":a===e.NIFTI1.UNITS_MICRON?"Microns":a===e.NIFTI1.UNITS_SEC?"Seconds":a===e.NIFTI1.UNITS_MSEC?"Milliseconds":a===e.NIFTI1.UNITS_USEC?"Microseconds":a===e.NIFTI1.UNITS_HZ?"Hz":a===e.NIFTI1.UNITS_PPM?"PPM":a===e.NIFTI1.UNITS_RADS?"Rads":"Unknown"};e.NIFTI1.prototype.getQformMat=function(){return this.convertNiftiQFormToNiftiSForm(this.quatern_b,this.quatern_c,this.quatern_d,this.qoffset_x,this.qoffset_y,this.qoffset_z,
  this.pixDims[1],this.pixDims[2],this.pixDims[3],this.pixDims[0])};e.NIFTI1.prototype.convertNiftiQFormToNiftiSForm=function(a,c,d,e,l,q,u,w,C,B){var A=[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]],E=d;A[3][0]=A[3][1]=A[3][2]=0;A[3][3]=1;d=1-(a*a+c*c+E*E);1E-7>d?(d=1/Math.sqrt(a*a+c*c+E*E),a*=d,c*=d,E*=d,d=0):d=Math.sqrt(d);u=0<u?u:1;w=0<w?w:1;C=0<C?C:1;0>B&&(C=-C);A[0][0]=(d*d+a*a-c*c-E*E)*u;A[0][1]=2*(a*c-d*E)*w;A[0][2]=2*(a*E+d*c)*C;A[1][0]=2*(a*c+d*E)*u;A[1][1]=(d*d+c*c-a*a-E*E)*w;A[1][2]=2*(c*E-d*
  a)*C;A[2][0]=2*(a*E-d*c)*u;A[2][1]=2*(c*E+d*a)*w;A[2][2]=(d*d+E*E-c*c-a*a)*C;A[0][3]=e;A[1][3]=l;A[2][3]=q;return A};e.NIFTI1.prototype.convertNiftiSFormToNEMA=function(a){var c,d,e,l,q,u,w,C,B,A,E,D,z,M,r,K;r=[[0,0,0],[0,0,0],[0,0,0]];K=[[0,0,0],[0,0,0],[0,0,0]];c=a[0][0];d=a[0][1];e=a[0][2];l=a[1][0];q=a[1][1];u=a[1][2];w=a[2][0];C=a[2][1];B=a[2][2];a=Math.sqrt(c*c+l*l+w*w);if(0===a)return null;c/=a;l/=a;w/=a;a=Math.sqrt(d*d+q*q+C*C);if(0===a)return null;d/=a;q/=a;C/=a;a=c*d+l*q+w*C;if(1E-4<Math.abs(a)){d-=
  a*c;q-=a*l;C-=a*w;a=Math.sqrt(d*d+q*q+C*C);if(0===a)return null;d/=a;q/=a;C/=a}a=Math.sqrt(e*e+u*u+B*B);0===a?(e=l*C-w*q,u=w*d-C*c,B=c*q-l*d):(e/=a,u/=a,B/=a);a=c*e+l*u+w*B;if(1E-4<Math.abs(a)){e-=a*c;u-=a*l;B-=a*w;a=Math.sqrt(e*e+u*u+B*B);if(0===a)return null;e/=a;u/=a;B/=a}a=d*e+q*u+C*B;if(1E-4<Math.abs(a)){e-=a*d;u-=a*q;B-=a*C;a=Math.sqrt(e*e+u*u+B*B);if(0===a)return null;e/=a;u/=a;B/=a}r[0][0]=c;r[0][1]=d;r[0][2]=e;r[1][0]=l;r[1][1]=q;r[1][2]=u;r[2][0]=w;r[2][1]=C;r[2][2]=B;w=this.nifti_mat33_determ(r);
  if(0===w)return null;M=-666;c=l=q=u=1;d=2;e=3;for(C=1;3>=C;C+=1)for(B=1;3>=B;B+=1)if(C!==B)for(A=1;3>=A;A+=1)if(C!==A&&B!==A)for(K[0][0]=K[0][1]=K[0][2]=K[1][0]=K[1][1]=K[1][2]=K[2][0]=K[2][1]=K[2][2]=0,E=-1;1>=E;E+=2)for(D=-1;1>=D;D+=2)for(z=-1;1>=z;z+=2)K[0][C-1]=E,K[1][B-1]=D,K[2][A-1]=z,a=this.nifti_mat33_determ(K),0<a*w&&(a=this.nifti_mat33_mul(K,r),a=a[0][0]+a[1][1]+a[2][2],a>M&&(M=a,c=C,d=B,e=A,l=E,q=D,u=z));r=K=a=w=C=B=0;switch(c*l){case 1:r="X";w="+";break;case -1:r="X";w="-";break;case 2:r=
  "Y";w="+";break;case -2:r="Y";w="-";break;case 3:r="Z";w="+";break;case -3:r="Z",w="-"}switch(d*q){case 1:K="X";C="+";break;case -1:K="X";C="-";break;case 2:K="Y";C="+";break;case -2:K="Y";C="-";break;case 3:K="Z";C="+";break;case -3:K="Z",C="-"}switch(e*u){case 1:a="X";B="+";break;case -1:a="X";B="-";break;case 2:a="Y";B="+";break;case -2:a="Y";B="-";break;case 3:a="Z";B="+";break;case -3:a="Z",B="-"}return r+K+a+w+C+B};e.NIFTI1.prototype.nifti_mat33_mul=function(a,c){var d=[[0,0,0],[0,0,0],[0,0,
  0]],e,l;for(e=0;3>e;e+=1)for(l=0;3>l;l+=1)d[e][l]=a[e][0]*c[0][l]+a[e][1]*c[1][l]+a[e][2]*c[2][l];return d};e.NIFTI1.prototype.nifti_mat33_determ=function(a){var c,d,e,l,q,u,w,C;c=a[0][0];d=a[0][1];e=a[0][2];l=a[1][0];q=a[1][1];u=a[1][2];w=a[2][0];C=a[2][1];a=a[2][2];return c*q*a-c*C*u-l*d*a+l*C*e+w*d*u-w*q*e};e.NIFTI1.prototype.getExtensionLocation=function(){return e.NIFTI1.MAGIC_COOKIE+4};e.NIFTI1.prototype.getExtensionSize=function(a){return e.Utils.getIntAt(a,this.getExtensionLocation(),this.littleEndian)};
  e.NIFTI1.prototype.getExtensionCode=function(a){return e.Utils.getIntAt(a,this.getExtensionLocation()+4,this.littleEndian)};"undefined"!==typeof c&&c.exports&&(c.exports=e.NIFTI1)},{"./utilities.js":20}],19:[function(a,c,d){var e=e||{};e.Utils=e.Utils||("undefined"!==typeof a?a("./utilities.js"):null);e.NIFTI1=e.NIFTI1||("undefined"!==typeof a?a("./nifti1.js"):null);e.NIFTI2=e.NIFTI2||function(){this.littleEndian=!1;this.dim_info=0;this.dims=[];this.slice_code=this.slice_end=this.slice_start=this.numBitsPerVoxel=
  this.datatypeCode=this.intent_code=this.intent_p3=this.intent_p2=this.intent_p1=0;this.pixDims=[];this.vox_offset=0;this.scl_slope=1;this.toffset=this.slice_duration=this.cal_min=this.cal_max=this.xyzt_units=this.scl_inter=0;this.intent_name=this.aux_file=this.description="";this.qoffset_z=this.qoffset_y=this.qoffset_x=this.quatern_d=this.quatern_c=this.quatern_b=this.sform_code=this.qform_code=0;this.affine=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];this.magic=0;this.extensionFlag=[0,0,0,0]};e.NIFTI2.MAGIC_COOKIE=
  540;e.NIFTI2.MAGIC_NUMBER_LOCATION=4;e.NIFTI2.MAGIC_NUMBER=[110,43,50,0,13,10,26,10];e.NIFTI2.prototype.readHeader=function(a){a=new DataView(a);var c=e.Utils.getIntAt(a,0,this.littleEndian),d,m;c!==e.NIFTI2.MAGIC_COOKIE&&(this.littleEndian=!0,c=e.Utils.getIntAt(a,0,this.littleEndian));if(c!==e.NIFTI2.MAGIC_COOKIE)throw Error("This does not appear to be a NIFTI file!");this.datatypeCode=e.Utils.getShortAt(a,12,this.littleEndian);this.numBitsPerVoxel=e.Utils.getShortAt(a,14,this.littleEndian);for(d=
  0;8>d;d+=1)c=16+8*d,this.dims[d]=e.Utils.getLongAt(a,c,this.littleEndian);this.intent_p1=e.Utils.getDoubleAt(a,80,this.littleEndian);this.intent_p2=e.Utils.getDoubleAt(a,88,this.littleEndian);this.intent_p3=e.Utils.getDoubleAt(a,96,this.littleEndian);for(d=0;8>d;d+=1)c=104+8*d,this.pixDims[d]=e.Utils.getDoubleAt(a,c,this.littleEndian);this.vox_offset=e.Utils.getLongAt(a,168,this.littleEndian);this.scl_slope=e.Utils.getDoubleAt(a,176,this.littleEndian);this.scl_inter=e.Utils.getDoubleAt(a,184,this.littleEndian);
  this.cal_max=e.Utils.getDoubleAt(a,192,this.littleEndian);this.cal_min=e.Utils.getDoubleAt(a,200,this.littleEndian);this.slice_duration=e.Utils.getDoubleAt(a,208,this.littleEndian);this.toffset=e.Utils.getDoubleAt(a,216,this.littleEndian);this.slice_start=e.Utils.getLongAt(a,224,this.littleEndian);this.slice_end=e.Utils.getLongAt(a,232,this.littleEndian);this.description=e.Utils.getStringAt(a,240,320);this.aux_file=e.Utils.getStringAt(a,320,344);this.qform_code=e.Utils.getIntAt(a,344,this.littleEndian);
  this.sform_code=e.Utils.getIntAt(a,348,this.littleEndian);this.quatern_b=e.Utils.getDoubleAt(a,352,this.littleEndian);this.quatern_c=e.Utils.getDoubleAt(a,360,this.littleEndian);this.quatern_d=e.Utils.getDoubleAt(a,368,this.littleEndian);this.qoffset_x=e.Utils.getDoubleAt(a,376,this.littleEndian);this.qoffset_y=e.Utils.getDoubleAt(a,384,this.littleEndian);this.qoffset_z=e.Utils.getDoubleAt(a,392,this.littleEndian);for(d=0;3>d;d+=1)for(m=0;4>m;m+=1)c=400+8*(4*d+m),this.affine[d][m]=e.Utils.getDoubleAt(a,
  c,this.littleEndian);this.affine[3][0]=0;this.affine[3][1]=0;this.affine[3][2]=0;this.affine[3][3]=1;this.slice_code=e.Utils.getIntAt(a,496,this.littleEndian);this.xyzt_units=e.Utils.getIntAt(a,500,this.littleEndian);this.intent_code=e.Utils.getIntAt(a,504,this.littleEndian);this.intent_name=e.Utils.getStringAt(a,508,524);this.dim_info=e.Utils.getByteAt(a,524);a.byteLength>e.NIFTI2.MAGIC_COOKIE&&(this.extensionFlag[0]=e.Utils.getByteAt(a,540),this.extensionFlag[1]=e.Utils.getByteAt(a,541),this.extensionFlag[2]=
  e.Utils.getByteAt(a,542),this.extensionFlag[3]=e.Utils.getByteAt(a,543),this.extensionFlag[0]&&(this.extensionSize=this.getExtensionSize(a),this.extensionCode=this.getExtensionCode(a)))};e.NIFTI2.prototype.toFormattedString=function(){var a=e.Utils.formatNumber,c;c=""+("Datatype = "+ +this.datatypeCode+" ("+this.getDatatypeCodeString(this.datatypeCode)+")\n");c+="Bits Per Voxel =  = "+this.numBitsPerVoxel+"\n";c+="Image Dimensions (1-8): "+this.dims[0]+", "+this.dims[1]+", "+this.dims[2]+", "+this.dims[3]+
  ", "+this.dims[4]+", "+this.dims[5]+", "+this.dims[6]+", "+this.dims[7]+"\n";c+="Intent Parameters (1-3): "+this.intent_p1+", "+this.intent_p2+", "+this.intent_p3+"\n";c+="Voxel Dimensions (1-8): "+a(this.pixDims[0])+", "+a(this.pixDims[1])+", "+a(this.pixDims[2])+", "+a(this.pixDims[3])+", "+a(this.pixDims[4])+", "+a(this.pixDims[5])+", "+a(this.pixDims[6])+", "+a(this.pixDims[7])+"\n";c+="Image Offset = "+this.vox_offset+"\n";c+="Data Scale:  Slope = "+a(this.scl_slope)+"  Intercept = "+a(this.scl_inter)+
  "\n";c+="Display Range:  Max = "+a(this.cal_max)+"  Min = "+a(this.cal_min)+"\n";c+="Slice Duration = "+this.slice_duration+"\n";c+="Time Axis Shift = "+this.toffset+"\n";c+="Slice Start = "+this.slice_start+"\n";c+="Slice End = "+this.slice_end+"\n";c+='Description: "'+this.description+'"\n';c+='Auxiliary File: "'+this.aux_file+'"\n';c+="Q-Form Code = "+this.qform_code+" ("+this.getTransformCodeString(this.qform_code)+")\n";c+="S-Form Code = "+this.sform_code+" ("+this.getTransformCodeString(this.sform_code)+
  ")\n";c+="Quaternion Parameters:  b = "+a(this.quatern_b)+"  c = "+a(this.quatern_c)+"  d = "+a(this.quatern_d)+"\n";c+="Quaternion Offsets:  x = "+this.qoffset_x+"  y = "+this.qoffset_y+"  z = "+this.qoffset_z+"\n";c+="S-Form Parameters X: "+a(this.affine[0][0])+", "+a(this.affine[0][1])+", "+a(this.affine[0][2])+", "+a(this.affine[0][3])+"\n";c+="S-Form Parameters Y: "+a(this.affine[1][0])+", "+a(this.affine[1][1])+", "+a(this.affine[1][2])+", "+a(this.affine[1][3])+"\n";c+="S-Form Parameters Z: "+
  a(this.affine[2][0])+", "+a(this.affine[2][1])+", "+a(this.affine[2][2])+", "+a(this.affine[2][3])+"\n";c+="Slice Code = "+this.slice_code+"\n";c+="Units Code = "+this.xyzt_units+" ("+this.getUnitsCodeString(e.NIFTI1.SPATIAL_UNITS_MASK&this.xyzt_units)+", "+this.getUnitsCodeString(e.NIFTI1.TEMPORAL_UNITS_MASK&this.xyzt_units)+")\n";c+="Intent Code = "+this.intent_code+"\n";c+='Intent Name: "'+this.intent_name+'"\n';return c+="Dim Info = "+this.dim_info+"\n"};e.NIFTI2.prototype.getExtensionLocation=
  function(){return e.NIFTI2.MAGIC_COOKIE+4};e.NIFTI2.prototype.getExtensionSize=e.NIFTI1.prototype.getExtensionSize;e.NIFTI2.prototype.getExtensionCode=e.NIFTI1.prototype.getExtensionCode;e.NIFTI2.prototype.getDatatypeCodeString=e.NIFTI1.prototype.getDatatypeCodeString;e.NIFTI2.prototype.getTransformCodeString=e.NIFTI1.prototype.getTransformCodeString;e.NIFTI2.prototype.getUnitsCodeString=e.NIFTI1.prototype.getUnitsCodeString;e.NIFTI2.prototype.getQformMat=e.NIFTI1.prototype.getQformMat;e.NIFTI2.prototype.convertNiftiQFormToNiftiSForm=
  e.NIFTI1.prototype.convertNiftiQFormToNiftiSForm;e.NIFTI2.prototype.convertNiftiSFormToNEMA=e.NIFTI1.prototype.convertNiftiSFormToNEMA;e.NIFTI2.prototype.nifti_mat33_mul=e.NIFTI1.prototype.nifti_mat33_mul;e.NIFTI2.prototype.nifti_mat33_determ=e.NIFTI1.prototype.nifti_mat33_determ;"undefined"!==typeof c&&c.exports&&(c.exports=e.NIFTI2)},{"./nifti1.js":18,"./utilities.js":20}],20:[function(a,c,d){var e=e||{};e.Utils=e.Utils||{};e.Utils.crcTable=null;e.Utils.GUNZIP_MAGIC_COOKIE1=31;e.Utils.GUNZIP_MAGIC_COOKIE2=
  139;e.Utils.getStringAt=function(a,c,d){for(var e="",l;c<d;c+=1)l=a.getUint8(c),0!==l&&(e+=String.fromCharCode(l));return e};e.Utils.getByteAt=function(a,c){return a.getInt8(c)};e.Utils.getShortAt=function(a,c,d){return a.getInt16(c,d)};e.Utils.getIntAt=function(a,c,d){return a.getInt32(c,d)};e.Utils.getFloatAt=function(a,c,d){return a.getFloat32(c,d)};e.Utils.getDoubleAt=function(a,c,d){return a.getFloat64(c,d)};e.Utils.getLongAt=function(a,c,d){var m,l=[],q=0;for(m=0;8>m;m+=1)l[m]=e.Utils.getByteAt(a,
  c+m,d);for(m=l.length-1;0<=m;m--)q=256*q+l[m];return q};e.Utils.toArrayBuffer=function(a){var c,d,e;c=new ArrayBuffer(a.length);d=new Uint8Array(c);for(e=0;e<a.length;e+=1)d[e]=a[e];return c};e.Utils.isString=function(a){return"string"===typeof a||a instanceof String};e.Utils.formatNumber=function(a,c){var d=0,d=e.Utils.isString(a)?Number(a):a,d=c?d.toPrecision(5):d.toPrecision(7);return parseFloat(d)};e.Utils.makeCRCTable=function(){for(var a,c=[],d=0;256>d;d++){a=d;for(var e=0;8>e;e++)a=a&1?3988292384^
  a>>>1:a>>>1;c[d]=a}return c};e.Utils.crc32=function(a){for(var c=e.Utils.crcTable||(e.Utils.crcTable=e.Utils.makeCRCTable()),d=-1,m=0;m<a.byteLength;m++)d=d>>>8^c[(d^a.getUint8(m))&255];return(d^-1)>>>0};"undefined"!==typeof c&&c.exports&&(c.exports=e.Utils)},{}]},{},[17])(17)});
  (function(b){"object"===typeof exports&&"undefined"!==typeof module?module.exports=b():"function"===typeof define&&define.amd?define([],b):("undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:this).gifti=b()})(function(){return function a(c,d,e){function f(g,l){if(!d[g]){if(!c[g]){var q="function"==typeof require&&require;if(!l&&q)return q(g,!0);if(h)return h(g,!0);q=Error("Cannot find module '"+g+"'");throw q.code="MODULE_NOT_FOUND",q;}q=d[g]={exports:{}};
  c[g][0].call(q.exports,function(a){var d=c[g][1][a];return f(d?d:a)},q,q.exports,a,c,d,e)}return d[g].exports}for(var h="function"==typeof require&&require,g=0;g<e.length;g++)f(e[g]);return f}({1:[function(a,c,d){a={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",decodeArrayBuffer:function(a){var c=this._keyStr.indexOf(a.charAt(a.length-1)),d=this._keyStr.indexOf(a.charAt(a.length-2)),g=a.length/4*3;64==c&&g--;64==d&&g--;c=new ArrayBuffer(g);this.decode(a,c,g);return c},
  decode:function(a,c,d){var g,m,l,q,u,w=0,C=0;c=c?new Uint8Array(c):new Uint8Array(d);a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(w=0;w<d;w+=3)g=this._keyStr.indexOf(a.charAt(C++)),m=this._keyStr.indexOf(a.charAt(C++)),q=this._keyStr.indexOf(a.charAt(C++)),u=this._keyStr.indexOf(a.charAt(C++)),g=g<<2|m>>4,m=(m&15)<<4|q>>2,l=(q&3)<<6|u,c[w]=g,64!=q&&(c[w+1]=m),64!=u&&(c[w+2]=l);return c}};"undefined"!==typeof c&&c.exports&&(c.exports=a)},{}],2:[function(a,c,d){},{}],3:[function(a,c,d){(function(c){function f(){try{var a=
  new Uint8Array(1);a.foo=function(){return 42};return 42===a.foo()&&"function"===typeof a.subarray&&0===a.subarray(1,1).byteLength}catch(c){return!1}}function h(a){if(!(this instanceof h))return 1<arguments.length?new h(a,arguments[1]):new h(a);h.TYPED_ARRAY_SUPPORT||(this.length=0,this.parent=void 0);if("number"===typeof a){var c;c=l(this,0>a?0:q(a)|0);if(!h.TYPED_ARRAY_SUPPORT)for(var d=0;d<a;d++)c[d]=0;return c}if("string"===typeof a){c=this;d=1<arguments.length?arguments[1]:"utf8";if("string"!==
  typeof d||""===d)d="utf8";var e=w(a,d)|0;c=l(c,e);c.write(a,d);return c}return g(this,a)}function g(a,c){if(h.isBuffer(c)){var d=a,e=q(c.length)|0,d=l(d,e);c.copy(d,0,0,e);return d}if(p(c)){for(var d=a,e=q(c.length)|0,d=l(d,e),f=0;f<e;f+=1)d[f]=c[f]&255;return d}if(null==c)throw new TypeError("must start with number, buffer, array or string");if("undefined"!==typeof ArrayBuffer){if(c.buffer instanceof ArrayBuffer)return m(a,c);if(c instanceof ArrayBuffer)return d=a,c.byteLength,h.TYPED_ARRAY_SUPPORT?
  (d=new Uint8Array(c),d.__proto__=h.prototype):d=m(d,new Uint8Array(c)),d}if(c.length){d=a;e=q(c.length)|0;d=l(d,e);for(f=0;f<e;f+=1)d[f]=c[f]&255;return d}d=a;f=0;"Buffer"===c.type&&p(c.data)&&(e=c.data,f=q(e.length)|0);for(var d=l(d,f),k=0;k<f;k+=1)d[k]=e[k]&255;return d}function m(a,c){var d=q(c.length)|0;a=l(a,d);for(var e=0;e<d;e+=1)a[e]=c[e]&255;return a}function l(a,c){h.TYPED_ARRAY_SUPPORT?(a=new Uint8Array(c),a.__proto__=h.prototype):a.length=c;0!==c&&c<=h.poolSize>>>1&&(a.parent=J);return a}
  function q(a){if(a>=(h.TYPED_ARRAY_SUPPORT?2147483647:1073741823))throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+(h.TYPED_ARRAY_SUPPORT?2147483647:1073741823).toString(16)+" bytes");return a|0}function u(a,c){if(!(this instanceof u))return new u(a,c);var d=new h(a,c);delete d.parent;return d}function w(a,c){"string"!==typeof a&&(a=""+a);var d=a.length;if(0===d)return 0;for(var e=!1;;)switch(c){case "ascii":case "binary":case "raw":case "raws":return d;case "utf8":case "utf-8":return G(a).length;
  case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return 2*d;case "hex":return d>>>1;case "base64":return t.toByteArray(N(a)).length;default:if(e)return G(a).length;c=(""+c).toLowerCase();e=!0}}function C(a,c,d){var e=!1;c|=0;d=void 0===d||Infinity===d?this.length:d|0;a||(a="utf8");0>c&&(c=0);d>this.length&&(d=this.length);if(d<=c)return"";for(;;)switch(a){case "hex":a=c;c=this.length;if(!a||0>a)a=0;if(!d||0>d||d>c)d=c;for(c="";a<d;a++)e=this[a],e=16>e?"0"+e.toString(16):e.toString(16),c+=e;
  return c;case "utf8":case "utf-8":return B(this,c,d);case "ascii":a=c;c="";for(d=Math.min(this.length,d);a<d;a++)c+=String.fromCharCode(this[a]&127);return c;case "binary":a=c;c="";for(d=Math.min(this.length,d);a<d;a++)c+=String.fromCharCode(this[a]);return c;case "base64":return a=c,d=0===a&&d===this.length?t.fromByteArray(this):t.fromByteArray(this.slice(a,d)),d;case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":d=this.slice(c,d);a="";for(c=0;c<d.length;c+=2)a+=String.fromCharCode(d[c]+256*
  d[c+1]);return a;default:if(e)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase();e=!0}}function B(a,c,d){d=Math.min(a.length,d);for(var e=[];c<d;){var f=a[c],h=null,k=239<f?4:223<f?3:191<f?2:1;if(c+k<=d){var g,l,m;switch(k){case 1:128>f&&(h=f);break;case 2:g=a[c+1];128===(g&192)&&(f=(f&31)<<6|g&63,127<f&&(h=f));break;case 3:g=a[c+1];l=a[c+2];128===(g&192)&&128===(l&192)&&(f=(f&15)<<12|(g&63)<<6|l&63,2047<f&&(55296>f||57343<f)&&(h=f));break;case 4:g=a[c+1],l=a[c+2],m=a[c+3],128===(g&
  192)&&128===(l&192)&&128===(m&192)&&(f=(f&15)<<18|(g&63)<<12|(l&63)<<6|m&63,65535<f&&1114112>f&&(h=f))}}null===h?(h=65533,k=1):65535<h&&(h-=65536,e.push(h>>>10&1023|55296),h=56320|h&1023);e.push(h);c+=k}a=e.length;if(a<=I)e=String.fromCharCode.apply(String,e);else{d="";for(c=0;c<a;)d+=String.fromCharCode.apply(String,e.slice(c,c+=I));e=d}return e}function A(a,c,d){if(0!==a%1||0>a)throw new RangeError("offset is not uint");if(a+c>d)throw new RangeError("Trying to access beyond buffer length");}function E(a,
  c,d,e,f,k){if(!h.isBuffer(a))throw new TypeError("buffer must be a Buffer instance");if(c>f||c<k)throw new RangeError("value is out of bounds");if(d+e>a.length)throw new RangeError("index out of range");}function D(a,c,d,e){0>c&&(c=65535+c+1);for(var f=0,h=Math.min(a.length-d,2);f<h;f++)a[d+f]=(c&255<<8*(e?f:1-f))>>>8*(e?f:1-f)}function z(a,c,d,e){0>c&&(c=4294967295+c+1);for(var f=0,h=Math.min(a.length-d,4);f<h;f++)a[d+f]=c>>>8*(e?f:3-f)&255}function M(a,c,d,e,f,h){if(d+e>a.length)throw new RangeError("index out of range");
  if(0>d)throw new RangeError("index out of range");}function r(a,c,d,e,f){f||M(a,c,d,4,3.4028234663852886E38,-3.4028234663852886E38);k.write(a,c,d,e,23,4);return d+4}function K(a,c,d,e,f){f||M(a,c,d,8,1.7976931348623157E308,-1.7976931348623157E308);k.write(a,c,d,e,52,8);return d+8}function N(a){a=a.trim?a.trim():a.replace(/^\s+|\s+$/g,"");a=a.replace(v,"");if(2>a.length)return"";for(;0!==a.length%4;)a+="=";return a}function G(a,c){c=c||Infinity;for(var d,e=a.length,f=null,h=[],k=0;k<e;k++){d=a.charCodeAt(k);
  if(55295<d&&57344>d){if(!f){if(56319<d){-1<(c-=3)&&h.push(239,191,189);continue}else if(k+1===e){-1<(c-=3)&&h.push(239,191,189);continue}f=d;continue}if(56320>d){-1<(c-=3)&&h.push(239,191,189);f=d;continue}d=(f-55296<<10|d-56320)+65536}else f&&-1<(c-=3)&&h.push(239,191,189);f=null;if(128>d){if(0>--c)break;h.push(d)}else if(2048>d){if(0>(c-=2))break;h.push(d>>6|192,d&63|128)}else if(65536>d){if(0>(c-=3))break;h.push(d>>12|224,d>>6&63|128,d&63|128)}else if(1114112>d){if(0>(c-=4))break;h.push(d>>18|
  240,d>>12&63|128,d>>6&63|128,d&63|128)}else throw Error("Invalid code point");}return h}function x(a){for(var c=[],d=0;d<a.length;d++)c.push(a.charCodeAt(d)&255);return c}function F(a,c,d,e){for(var f=0;f<e&&!(f+d>=c.length||f>=a.length);f++)c[f+d]=a[f];return f}var t=a("base64-js"),k=a("ieee754"),p=a("isarray");d.Buffer=h;d.SlowBuffer=u;d.INSPECT_MAX_BYTES=50;h.poolSize=8192;var J={};h.TYPED_ARRAY_SUPPORT=void 0!==c.TYPED_ARRAY_SUPPORT?c.TYPED_ARRAY_SUPPORT:f();h._augment=function(a){a.__proto__=
  h.prototype;return a};h.TYPED_ARRAY_SUPPORT?(h.prototype.__proto__=Uint8Array.prototype,h.__proto__=Uint8Array,"undefined"!==typeof Symbol&&Symbol.species&&h[Symbol.species]===h&&Object.defineProperty(h,Symbol.species,{value:null,configurable:!0})):(h.prototype.length=void 0,h.prototype.parent=void 0);h.isBuffer=function(a){return!(null==a||!a._isBuffer)};h.compare=function(a,c){if(!h.isBuffer(a)||!h.isBuffer(c))throw new TypeError("Arguments must be Buffers");if(a===c)return 0;for(var d=a.length,
  e=c.length,f=0,k=Math.min(d,e);f<k&&a[f]===c[f];)++f;f!==k&&(d=a[f],e=c[f]);return d<e?-1:e<d?1:0};h.isEncoding=function(a){switch(String(a).toLowerCase()){case "hex":case "utf8":case "utf-8":case "ascii":case "binary":case "base64":case "raw":case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return!0;default:return!1}};h.concat=function(a,c){if(!p(a))throw new TypeError("list argument must be an Array of Buffers.");if(0===a.length)return new h(0);var d;if(void 0===c)for(d=c=0;d<a.length;d++)c+=
  a[d].length;var e=new h(c),f=0;for(d=0;d<a.length;d++){var k=a[d];k.copy(e,f);f+=k.length}return e};h.byteLength=w;h.prototype._isBuffer=!0;h.prototype.toString=function(){var a=this.length|0;return 0===a?"":0===arguments.length?B(this,0,a):C.apply(this,arguments)};h.prototype.equals=function(a){if(!h.isBuffer(a))throw new TypeError("Argument must be a Buffer");return this===a?!0:0===h.compare(this,a)};h.prototype.inspect=function(){var a="",c=d.INSPECT_MAX_BYTES;0<this.length&&(a=this.toString("hex",
  0,c).match(/.{2}/g).join(" "),this.length>c&&(a+=" ... "));return"<Buffer "+a+">"};h.prototype.compare=function(a){if(!h.isBuffer(a))throw new TypeError("Argument must be a Buffer");return this===a?0:h.compare(this,a)};h.prototype.indexOf=function(a,c){function d(a,c,e){for(var f=-1,h=0;e+h<a.length;h++)if(a[e+h]===c[-1===f?0:h-f]){if(-1===f&&(f=h),h-f+1===c.length)return e+f}else f=-1;return-1}2147483647<c?c=2147483647:-2147483648>c&&(c=-2147483648);c>>=0;if(0===this.length||c>=this.length)return-1;
  0>c&&(c=Math.max(this.length+c,0));if("string"===typeof a)return 0===a.length?-1:String.prototype.indexOf.call(this,a,c);if(h.isBuffer(a))return d(this,a,c);if("number"===typeof a)return h.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,a,c):d(this,[a],c);throw new TypeError("val must be string, number or Buffer");};h.prototype.write=function(a,c,d,e){if(void 0===c)e="utf8",d=this.length,c=0;else if(void 0===d&&"string"===typeof c)e=c,d=this.length,
  c=0;else if(isFinite(c))c|=0,isFinite(d)?(d|=0,void 0===e&&(e="utf8")):(e=d,d=void 0);else{var f=e;e=c;c=d|0;d=f}f=this.length-c;if(void 0===d||d>f)d=f;if(0<a.length&&(0>d||0>c)||c>this.length)throw new RangeError("attempt to write outside buffer bounds");e||(e="utf8");for(f=!1;;)switch(e){case "hex":c=Number(c)||0;e=this.length-c;d?(d=Number(d),d>e&&(d=e)):d=e;e=a.length;if(0!==e%2)throw Error("Invalid hex string");d>e/2&&(d=e/2);for(e=0;e<d;e++){f=parseInt(a.substr(2*e,2),16);if(isNaN(f))throw Error("Invalid hex string");
  this[c+e]=f}return e;case "utf8":case "utf-8":return F(G(a,this.length-c),this,c,d);case "ascii":return F(x(a),this,c,d);case "binary":return F(x(a),this,c,d);case "base64":return F(t.toByteArray(N(a)),this,c,d);case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":e=this.length-c;for(var h=void 0,h=f=void 0,k=[],g=0;g<a.length&&!(0>(e-=2));g++)h=a.charCodeAt(g),f=h>>8,h%=256,k.push(h),k.push(f);return F(k,this,c,d);default:if(f)throw new TypeError("Unknown encoding: "+e);e=(""+e).toLowerCase();
  f=!0}};h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var I=4096;h.prototype.slice=function(a,c){var d=this.length;a=~~a;c=void 0===c?d:~~c;0>a?(a+=d,0>a&&(a=0)):a>d&&(a=d);0>c?(c+=d,0>c&&(c=0)):c>d&&(c=d);c<a&&(c=a);if(h.TYPED_ARRAY_SUPPORT)d=this.subarray(a,c),d.__proto__=h.prototype;else for(var e=c-a,d=new h(e,void 0),f=0;f<e;f++)d[f]=this[f+a];d.length&&(d.parent=this.parent||this);return d};h.prototype.readUIntLE=function(a,c,d){a|=0;
  c|=0;d||A(a,c,this.length);d=this[a];for(var e=1,f=0;++f<c&&(e*=256);)d+=this[a+f]*e;return d};h.prototype.readUIntBE=function(a,c,d){a|=0;c|=0;d||A(a,c,this.length);d=this[a+--c];for(var e=1;0<c&&(e*=256);)d+=this[a+--c]*e;return d};h.prototype.readUInt8=function(a,c){c||A(a,1,this.length);return this[a]};h.prototype.readUInt16LE=function(a,c){c||A(a,2,this.length);return this[a]|this[a+1]<<8};h.prototype.readUInt16BE=function(a,c){c||A(a,2,this.length);return this[a]<<8|this[a+1]};h.prototype.readUInt32LE=
  function(a,c){c||A(a,4,this.length);return(this[a]|this[a+1]<<8|this[a+2]<<16)+16777216*this[a+3]};h.prototype.readUInt32BE=function(a,c){c||A(a,4,this.length);return 16777216*this[a]+(this[a+1]<<16|this[a+2]<<8|this[a+3])};h.prototype.readIntLE=function(a,c,d){a|=0;c|=0;d||A(a,c,this.length);d=this[a];for(var e=1,f=0;++f<c&&(e*=256);)d+=this[a+f]*e;d>=128*e&&(d-=Math.pow(2,8*c));return d};h.prototype.readIntBE=function(a,c,d){a|=0;c|=0;d||A(a,c,this.length);d=c;for(var e=1,f=this[a+--d];0<d&&(e*=
  256);)f+=this[a+--d]*e;f>=128*e&&(f-=Math.pow(2,8*c));return f};h.prototype.readInt8=function(a,c){c||A(a,1,this.length);return this[a]&128?-1*(255-this[a]+1):this[a]};h.prototype.readInt16LE=function(a,c){c||A(a,2,this.length);var d=this[a]|this[a+1]<<8;return d&32768?d|4294901760:d};h.prototype.readInt16BE=function(a,c){c||A(a,2,this.length);var d=this[a+1]|this[a]<<8;return d&32768?d|4294901760:d};h.prototype.readInt32LE=function(a,c){c||A(a,4,this.length);return this[a]|this[a+1]<<8|this[a+2]<<
  16|this[a+3]<<24};h.prototype.readInt32BE=function(a,c){c||A(a,4,this.length);return this[a]<<24|this[a+1]<<16|this[a+2]<<8|this[a+3]};h.prototype.readFloatLE=function(a,c){c||A(a,4,this.length);return k.read(this,a,!0,23,4)};h.prototype.readFloatBE=function(a,c){c||A(a,4,this.length);return k.read(this,a,!1,23,4)};h.prototype.readDoubleLE=function(a,c){c||A(a,8,this.length);return k.read(this,a,!0,52,8)};h.prototype.readDoubleBE=function(a,c){c||A(a,8,this.length);return k.read(this,a,!1,52,8)};
  h.prototype.writeUIntLE=function(a,c,d,e){a=+a;c|=0;d|=0;e||E(this,a,c,d,Math.pow(2,8*d),0);e=1;var f=0;for(this[c]=a&255;++f<d&&(e*=256);)this[c+f]=a/e&255;return c+d};h.prototype.writeUIntBE=function(a,c,d,e){a=+a;c|=0;d|=0;e||E(this,a,c,d,Math.pow(2,8*d),0);e=d-1;var f=1;for(this[c+e]=a&255;0<=--e&&(f*=256);)this[c+e]=a/f&255;return c+d};h.prototype.writeUInt8=function(a,c,d){a=+a;c|=0;d||E(this,a,c,1,255,0);h.TYPED_ARRAY_SUPPORT||(a=Math.floor(a));this[c]=a&255;return c+1};h.prototype.writeUInt16LE=
  function(a,c,d){a=+a;c|=0;d||E(this,a,c,2,65535,0);h.TYPED_ARRAY_SUPPORT?(this[c]=a&255,this[c+1]=a>>>8):D(this,a,c,!0);return c+2};h.prototype.writeUInt16BE=function(a,c,d){a=+a;c|=0;d||E(this,a,c,2,65535,0);h.TYPED_ARRAY_SUPPORT?(this[c]=a>>>8,this[c+1]=a&255):D(this,a,c,!1);return c+2};h.prototype.writeUInt32LE=function(a,c,d){a=+a;c|=0;d||E(this,a,c,4,4294967295,0);h.TYPED_ARRAY_SUPPORT?(this[c+3]=a>>>24,this[c+2]=a>>>16,this[c+1]=a>>>8,this[c]=a&255):z(this,a,c,!0);return c+4};h.prototype.writeUInt32BE=
  function(a,c,d){a=+a;c|=0;d||E(this,a,c,4,4294967295,0);h.TYPED_ARRAY_SUPPORT?(this[c]=a>>>24,this[c+1]=a>>>16,this[c+2]=a>>>8,this[c+3]=a&255):z(this,a,c,!1);return c+4};h.prototype.writeIntLE=function(a,c,d,e){a=+a;c|=0;e||(e=Math.pow(2,8*d-1),E(this,a,c,d,e-1,-e));e=0;var f=1,h=0>a?1:0;for(this[c]=a&255;++e<d&&(f*=256);)this[c+e]=(a/f>>0)-h&255;return c+d};h.prototype.writeIntBE=function(a,c,d,e){a=+a;c|=0;e||(e=Math.pow(2,8*d-1),E(this,a,c,d,e-1,-e));e=d-1;var f=1,h=0>a?1:0;for(this[c+e]=a&255;0<=
  --e&&(f*=256);)this[c+e]=(a/f>>0)-h&255;return c+d};h.prototype.writeInt8=function(a,c,d){a=+a;c|=0;d||E(this,a,c,1,127,-128);h.TYPED_ARRAY_SUPPORT||(a=Math.floor(a));0>a&&(a=255+a+1);this[c]=a&255;return c+1};h.prototype.writeInt16LE=function(a,c,d){a=+a;c|=0;d||E(this,a,c,2,32767,-32768);h.TYPED_ARRAY_SUPPORT?(this[c]=a&255,this[c+1]=a>>>8):D(this,a,c,!0);return c+2};h.prototype.writeInt16BE=function(a,c,d){a=+a;c|=0;d||E(this,a,c,2,32767,-32768);h.TYPED_ARRAY_SUPPORT?(this[c]=a>>>8,this[c+1]=a&
  255):D(this,a,c,!1);return c+2};h.prototype.writeInt32LE=function(a,c,d){a=+a;c|=0;d||E(this,a,c,4,2147483647,-2147483648);h.TYPED_ARRAY_SUPPORT?(this[c]=a&255,this[c+1]=a>>>8,this[c+2]=a>>>16,this[c+3]=a>>>24):z(this,a,c,!0);return c+4};h.prototype.writeInt32BE=function(a,c,d){a=+a;c|=0;d||E(this,a,c,4,2147483647,-2147483648);0>a&&(a=4294967295+a+1);h.TYPED_ARRAY_SUPPORT?(this[c]=a>>>24,this[c+1]=a>>>16,this[c+2]=a>>>8,this[c+3]=a&255):z(this,a,c,!1);return c+4};h.prototype.writeFloatLE=function(a,
  c,d){return r(this,a,c,!0,d)};h.prototype.writeFloatBE=function(a,c,d){return r(this,a,c,!1,d)};h.prototype.writeDoubleLE=function(a,c,d){return K(this,a,c,!0,d)};h.prototype.writeDoubleBE=function(a,c,d){return K(this,a,c,!1,d)};h.prototype.copy=function(a,c,d,e){d||(d=0);e||0===e||(e=this.length);c>=a.length&&(c=a.length);c||(c=0);0<e&&e<d&&(e=d);if(e===d||0===a.length||0===this.length)return 0;if(0>c)throw new RangeError("targetStart out of bounds");if(0>d||d>=this.length)throw new RangeError("sourceStart out of bounds");
  if(0>e)throw new RangeError("sourceEnd out of bounds");e>this.length&&(e=this.length);a.length-c<e-d&&(e=a.length-c+d);var f=e-d;if(this===a&&d<c&&c<e)for(e=f-1;0<=e;e--)a[e+c]=this[e+d];else if(1E3>f||!h.TYPED_ARRAY_SUPPORT)for(e=0;e<f;e++)a[e+c]=this[e+d];else Uint8Array.prototype.set.call(a,this.subarray(d,d+f),c);return f};h.prototype.fill=function(a,c,d){a||(a=0);c||(c=0);d||(d=this.length);if(d<c)throw new RangeError("end < start");if(d!==c&&0!==this.length){if(0>c||c>=this.length)throw new RangeError("start out of bounds");
  if(0>d||d>this.length)throw new RangeError("end out of bounds");if("number"===typeof a)for(;c<d;c++)this[c]=a;else{a=G(a.toString());for(var e=a.length;c<d;c++)this[c]=a[c%e]}return this}};var v=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!==typeof global?global:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{})},{"base64-js":4,ieee754:5,isarray:6}],4:[function(a,c,d){(function(a){function c(a){a=l[a.charCodeAt(0)];return void 0!==a?a:-1}function d(a,c,e){for(var f=[],h=c;h<e;h+=
  3)c=(a[h]<<16)+(a[h+1]<<8)+a[h+2],f.push(m[c>>18&63]+m[c>>12&63]+m[c>>6&63]+m[c&63]);return f.join("")}var g,m=[];for(g=0;64>g;g++)m[g]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[g];var l=[];for(g=0;64>g;++g)l["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(g)]=g;l[45]=62;l[95]=63;var q="undefined"!==typeof Uint8Array?Uint8Array:Array;a.toByteArray=function(a){function d(a){m[z++]=a}var e,h,g,l,m;if(0<a.length%4)throw Error("Invalid string. Length must be a multiple of 4");
  e=a.length;l="="===a.charAt(e-2)?2:"="===a.charAt(e-1)?1:0;m=new q(3*a.length/4-l);h=0<l?a.length-4:a.length;var z=0;for(e=0;e<h;e+=4)g=c(a.charAt(e))<<18|c(a.charAt(e+1))<<12|c(a.charAt(e+2))<<6|c(a.charAt(e+3)),d((g&16711680)>>16),d((g&65280)>>8),d(g&255);2===l?(g=c(a.charAt(e))<<2|c(a.charAt(e+1))>>4,d(g&255)):1===l&&(g=c(a.charAt(e))<<10|c(a.charAt(e+1))<<4|c(a.charAt(e+2))>>2,d(g>>8&255),d(g&255));return m};a.fromByteArray=function(a){var c,e=a.length%3,f="",g=[],l;c=0;for(l=a.length-e;c<l;c+=
  16383)g.push(d(a,c,c+16383>l?l:c+16383));switch(e){case 1:a=a[a.length-1];f+=m[a>>2];f+=m[a<<4&63];f+="==";break;case 2:a=(a[a.length-2]<<8)+a[a.length-1],f+=m[a>>10],f+=m[a>>4&63],f+=m[a<<2&63],f+="="}g.push(f);return g.join("")}})("undefined"===typeof d?this.base64js={}:d)},{}],5:[function(a,c,d){d.read=function(a,c,d,g,m){var l;l=8*m-g-1;var q=(1<<l)-1,u=q>>1,w=-7;m=d?m-1:0;var C=d?-1:1,B=a[c+m];m+=C;d=B&(1<<-w)-1;B>>=-w;for(w+=l;0<w;d=256*d+a[c+m],m+=C,w-=8);l=d&(1<<-w)-1;d>>=-w;for(w+=g;0<w;l=
  256*l+a[c+m],m+=C,w-=8);if(0===d)d=1-u;else{if(d===q)return l?NaN:Infinity*(B?-1:1);l+=Math.pow(2,g);d-=u}return(B?-1:1)*l*Math.pow(2,d-g)};d.write=function(a,c,d,g,m,l){var q,u=8*l-m-1,w=(1<<u)-1,C=w>>1,B=23===m?Math.pow(2,-24)-Math.pow(2,-77):0;l=g?0:l-1;var A=g?1:-1,E=0>c||0===c&&0>1/c?1:0;c=Math.abs(c);isNaN(c)||Infinity===c?(c=isNaN(c)?1:0,g=w):(g=Math.floor(Math.log(c)/Math.LN2),1>c*(q=Math.pow(2,-g))&&(g--,q*=2),c=1<=g+C?c+B/q:c+B*Math.pow(2,1-C),2<=c*q&&(g++,q/=2),g+C>=w?(c=0,g=w):1<=g+C?
  (c=(c*q-1)*Math.pow(2,m),g+=C):(c=c*Math.pow(2,C-1)*Math.pow(2,m),g=0));for(;8<=m;a[d+l]=c&255,l+=A,c/=256,m-=8);g=g<<m|c;for(u+=m;0<u;a[d+l]=g&255,l+=A,g/=256,u-=8);a[d+l-A]|=128*E}},{}],6:[function(a,c,d){var e={}.toString;c.exports=Array.isArray||function(a){return"[object Array]"==e.call(a)}},{}],7:[function(a,c,d){function e(){this._events=this._events||{};this._maxListeners=this._maxListeners||void 0}function f(a){return"function"===typeof a}function h(a){return"object"===typeof a&&null!==a}
  c.exports=e;e.EventEmitter=e;e.prototype._events=void 0;e.prototype._maxListeners=void 0;e.defaultMaxListeners=10;e.prototype.setMaxListeners=function(a){if("number"!==typeof a||0>a||isNaN(a))throw TypeError("n must be a positive number");this._maxListeners=a;return this};e.prototype.emit=function(a){var c,d,e,u;this._events||(this._events={});if("error"===a&&(!this._events.error||h(this._events.error)&&!this._events.error.length)){c=arguments[1];if(c instanceof Error)throw c;throw TypeError('Uncaught, unspecified "error" event.');
  }d=this._events[a];if(void 0===d)return!1;if(f(d))switch(arguments.length){case 1:d.call(this);break;case 2:d.call(this,arguments[1]);break;case 3:d.call(this,arguments[1],arguments[2]);break;default:c=Array.prototype.slice.call(arguments,1),d.apply(this,c)}else if(h(d))for(c=Array.prototype.slice.call(arguments,1),u=d.slice(),d=u.length,e=0;e<d;e++)u[e].apply(this,c);return!0};e.prototype.addListener=function(a,c){var d;if(!f(c))throw TypeError("listener must be a function");this._events||(this._events=
  {});this._events.newListener&&this.emit("newListener",a,f(c.listener)?c.listener:c);this._events[a]?h(this._events[a])?this._events[a].push(c):this._events[a]=[this._events[a],c]:this._events[a]=c;h(this._events[a])&&!this._events[a].warned&&(d=void 0!==this._maxListeners?this._maxListeners:e.defaultMaxListeners)&&0<d&&this._events[a].length>d&&(this._events[a].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",
  this._events[a].length),"function"===typeof console.trace&&console.trace());return this};e.prototype.on=e.prototype.addListener;e.prototype.once=function(a,c){function d(){this.removeListener(a,d);e||(e=!0,c.apply(this,arguments))}if(!f(c))throw TypeError("listener must be a function");var e=!1;d.listener=c;this.on(a,d);return this};e.prototype.removeListener=function(a,c){var d,e,u;if(!f(c))throw TypeError("listener must be a function");if(!this._events||!this._events[a])return this;d=this._events[a];
  u=d.length;e=-1;if(d===c||f(d.listener)&&d.listener===c)delete this._events[a],this._events.removeListener&&this.emit("removeListener",a,c);else if(h(d)){for(;0<u--;)if(d[u]===c||d[u].listener&&d[u].listener===c){e=u;break}if(0>e)return this;1===d.length?(d.length=0,delete this._events[a]):d.splice(e,1);this._events.removeListener&&this.emit("removeListener",a,c)}return this};e.prototype.removeAllListeners=function(a){var c;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?
  this._events={}:this._events[a]&&delete this._events[a],this;if(0===arguments.length){for(c in this._events)"removeListener"!==c&&this.removeAllListeners(c);this.removeAllListeners("removeListener");this._events={};return this}c=this._events[a];if(f(c))this.removeListener(a,c);else if(c)for(;c.length;)this.removeListener(a,c[c.length-1]);delete this._events[a];return this};e.prototype.listeners=function(a){return this._events&&this._events[a]?f(this._events[a])?[this._events[a]]:this._events[a].slice():
  []};e.prototype.listenerCount=function(a){if(this._events){a=this._events[a];if(f(a))return 1;if(a)return a.length}return 0};e.listenerCount=function(a,c){return a.listenerCount(c)}},{}],8:[function(a,c,d){c.exports="function"===typeof Object.create?function(a,c){a.super_=c;a.prototype=Object.create(c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})}:function(a,c){a.super_=c;var d=function(){};d.prototype=c.prototype;a.prototype=new d;a.prototype.constructor=a}},{}],9:[function(a,
  c,d){c.exports=function(a){return!(null==a||!(a._isBuffer||a.constructor&&"function"===typeof a.constructor.isBuffer&&a.constructor.isBuffer(a)))}},{}],10:[function(a,c,d){c.exports=Array.isArray||function(a){return"[object Array]"==Object.prototype.toString.call(a)}},{}],11:[function(a,c,d){function e(){l=!1;q.length?m=q.concat(m):u=-1;m.length&&f()}function f(){if(!l){var a=setTimeout(e);l=!0;for(var c=m.length;c;){q=m;for(m=[];++u<c;)q&&q[u].run();u=-1;c=m.length}q=null;l=!1;clearTimeout(a)}}function h(a,
  c){this.fun=a;this.array=c}function g(){}a=c.exports={};var m=[],l=!1,q,u=-1;a.nextTick=function(a){var c=Array(arguments.length-1);if(1<arguments.length)for(var d=1;d<arguments.length;d++)c[d-1]=arguments[d];m.push(new h(a,c));1!==m.length||l||setTimeout(f,0)};h.prototype.run=function(){this.fun.apply(null,this.array)};a.title="browser";a.browser=!0;a.env={};a.argv=[];a.version="";a.versions={};a.on=g;a.addListener=g;a.once=g;a.off=g;a.removeListener=g;a.removeAllListeners=g;a.emit=g;a.binding=function(a){throw Error("process.binding is not supported");
  };a.cwd=function(){return"/"};a.chdir=function(a){throw Error("process.chdir is not supported");};a.umask=function(){return 0}},{}],12:[function(a,c,d){c.exports=a("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":13}],13:[function(a,c,d){function e(a){if(!(this instanceof e))return new e(a);m.call(this,a);l.call(this,a);a&&!1===a.readable&&(this.readable=!1);a&&!1===a.writable&&(this.writable=!1);this.allowHalfOpen=!0;a&&!1===a.allowHalfOpen&&(this.allowHalfOpen=!1);this.once("end",f)}function f(){this.allowHalfOpen||
  this._writableState.ended||g(h,this)}function h(a){a.end()}d=Object.keys||function(a){var c=[],d;for(d in a)c.push(d);return c};c.exports=e;var g=a("process-nextick-args");c=a("core-util-is");c.inherits=a("inherits");var m=a("./_stream_readable"),l=a("./_stream_writable");c.inherits(e,m);a=d(l.prototype);for(c=0;c<a.length;c++)d=a[c],e.prototype[d]||(e.prototype[d]=l.prototype[d])},{"./_stream_readable":15,"./_stream_writable":17,"core-util-is":18,inherits:8,"process-nextick-args":19}],14:[function(a,
  c,d){function e(a){if(!(this instanceof e))return new e(a);f.call(this,a)}c.exports=e;var f=a("./_stream_transform");c=a("core-util-is");c.inherits=a("inherits");c.inherits(e,f);e.prototype._transform=function(a,c,d){d(null,a)}},{"./_stream_transform":16,"core-util-is":18,inherits:8}],15:[function(a,c,d){(function(d){function f(c,d){J=J||a("./_stream_duplex");c=c||{};this.objectMode=!!c.objectMode;d instanceof J&&(this.objectMode=this.objectMode||!!c.readableObjectMode);var e=c.highWaterMark,f=this.objectMode?
  16:16384;this.highWaterMark=e||0===e?e:f;this.highWaterMark=~~this.highWaterMark;this.buffer=[];this.length=0;this.pipes=null;this.pipesCount=0;this.flowing=null;this.reading=this.endEmitted=this.ended=!1;this.sync=!0;this.readableListening=this.emittedReadable=this.needReadable=!1;this.defaultEncoding=c.defaultEncoding||"utf8";this.ranOut=!1;this.awaitDrain=0;this.readingMore=!1;this.encoding=this.decoder=null;c.encoding&&(p||(p=a("string_decoder/").StringDecoder),this.decoder=new p(c.encoding),
  this.encoding=c.encoding)}function h(c){J=J||a("./_stream_duplex");if(!(this instanceof h))return new h(c);this._readableState=new f(c,this);this.readable=!0;c&&"function"===typeof c.read&&(this._read=c.read);G.call(this)}function g(a,c,d,e,f){var h;h=d;var k=null;N.isBuffer(h)||"string"===typeof h||null===h||void 0===h||c.objectMode||(k=new TypeError("Invalid non-string/buffer chunk"));(h=k)?a.emit("error",h):null===d?(c.reading=!1,c.ended||(c.decoder&&(d=c.decoder.end())&&d.length&&(c.buffer.push(d),
  c.length+=c.objectMode?1:d.length),c.ended=!0,l(a))):c.objectMode||d&&0<d.length?c.ended&&!f?(d=Error("stream.push() after EOF"),a.emit("error",d)):c.endEmitted&&f?(d=Error("stream.unshift() after end event"),a.emit("error",d)):(!c.decoder||f||e||(d=c.decoder.write(d)),f||(c.reading=!1),c.flowing&&0===c.length&&!c.sync?(a.emit("data",d),a.read(0)):(c.length+=c.objectMode?1:d.length,f?c.buffer.unshift(d):c.buffer.push(d),c.needReadable&&l(a)),c.readingMore||(c.readingMore=!0,r(u,a,c))):f||(c.reading=
  !1);return!c.ended&&(c.needReadable||c.length<c.highWaterMark||0===c.length)}function m(a,c){if(0===c.length&&c.ended)return 0;if(c.objectMode)return 0===a?0:1;if(null===a||isNaN(a))return c.flowing&&c.buffer.length?c.buffer[0].length:c.length;if(0>=a)return 0;if(a>c.highWaterMark){var d=a;8388608<=d?d=8388608:(d--,d|=d>>>1,d|=d>>>2,d|=d>>>4,d|=d>>>8,d|=d>>>16,d++);c.highWaterMark=d}if(a>c.length){if(c.ended)return c.length;c.needReadable=!0;return 0}return a}function l(a){var c=a._readableState;
  c.needReadable=!1;c.emittedReadable||(k("emitReadable",c.flowing),c.emittedReadable=!0,c.sync?r(q,a):q(a))}function q(a){k("emit readable");a.emit("readable");A(a)}function u(a,c){for(var d=c.length;!c.reading&&!c.flowing&&!c.ended&&c.length<c.highWaterMark&&(k("maybeReadMore read 0"),a.read(0),d!==c.length);)d=c.length;c.readingMore=!1}function w(a){return function(){var c=a._readableState;k("pipeOnDrain",c.awaitDrain);c.awaitDrain&&c.awaitDrain--;0===c.awaitDrain&&a.listeners("data").length&&(c.flowing=
  !0,A(a))}}function C(a){k("readable nexttick read 0");a.read(0)}function B(a,c){c.reading||(k("resume read 0"),a.read(0));c.resumeScheduled=!1;a.emit("resume");A(a);c.flowing&&!c.reading&&a.read(0)}function A(a){var c=a._readableState;k("flow",c.flowing);if(c.flowing){do var d=a.read();while(null!==d&&c.flowing)}}function E(a,c){var d=c.buffer,e=c.length,f=!!c.decoder,h=!!c.objectMode;if(0===d.length)return null;if(0===e)e=null;else if(h)e=d.shift();else if(!a||a>=e)e=f?d.join(""):1===d.length?d[0]:
  N.concat(d,e),d.length=0;else if(a<d[0].length)h=d[0],e=h.slice(0,a),d[0]=h.slice(a);else if(a===d[0].length)e=d.shift();else for(var e=f?"":new N(a),k=0,g=0,l=d.length;g<l&&k<a;g++){var h=d[0],m=Math.min(a-k,h.length);f?e+=h.slice(0,m):h.copy(e,k,0,m);m<h.length?d[0]=h.slice(m):d.shift();k+=m}return e}function D(a){var c=a._readableState;if(0<c.length)throw Error("endReadable called on non-empty stream");c.endEmitted||(c.ended=!0,r(z,c,a))}function z(a,c){a.endEmitted||0!==a.length||(a.endEmitted=
  !0,c.readable=!1,c.emit("end"))}function M(a,c){for(var d=0,e=a.length;d<e;d++)c(a[d],d)}c.exports=h;var r=a("process-nextick-args"),K=a("isarray"),N=a("buffer").Buffer;h.ReadableState=f;a("events");var G;try{G=a("stream")}catch(x){}finally{G||(G=a("events").EventEmitter)}var N=a("buffer").Buffer,F=a("core-util-is");F.inherits=a("inherits");var t=a("util"),k;k=t&&t.debuglog?t.debuglog("stream"):function(){};var p;F.inherits(h,G);var J;h.prototype.push=function(a,c){var d=this._readableState;d.objectMode||
  "string"!==typeof a||(c=c||d.defaultEncoding,c!==d.encoding&&(a=new N(a,c),c=""));return g(this,d,a,c,!1)};h.prototype.unshift=function(a){return g(this,this._readableState,a,"",!0)};h.prototype.isPaused=function(){return!1===this._readableState.flowing};h.prototype.setEncoding=function(c){p||(p=a("string_decoder/").StringDecoder);this._readableState.decoder=new p(c);this._readableState.encoding=c;return this};h.prototype.read=function(a){k("read",a);var c=this._readableState,d=a;if("number"!==typeof a||
  0<a)c.emittedReadable=!1;if(0===a&&c.needReadable&&(c.length>=c.highWaterMark||c.ended))return k("read: emitReadable",c.length,c.ended),0===c.length&&c.ended?D(this):l(this),null;a=m(a,c);if(0===a&&c.ended)return 0===c.length&&D(this),null;var e=c.needReadable;k("need readable",e);if(0===c.length||c.length-a<c.highWaterMark)e=!0,k("length less than watermark",e);if(c.ended||c.reading)e=!1,k("reading or ended",e);e&&(k("do read"),c.reading=!0,c.sync=!0,0===c.length&&(c.needReadable=!0),this._read(c.highWaterMark),
  c.sync=!1);e&&!c.reading&&(a=m(d,c));e=0<a?E(a,c):null;null===e&&(c.needReadable=!0,a=0);c.length-=a;0!==c.length||c.ended||(c.needReadable=!0);d!==a&&c.ended&&0===c.length&&D(this);null!==e&&this.emit("data",e);return e};h.prototype._read=function(a){this.emit("error",Error("not implemented"))};h.prototype.pipe=function(a,c){function f(a){k("onunpipe");a===t&&g()}function h(){k("onend");a.end()}function g(){k("cleanup");a.removeListener("close",p);a.removeListener("finish",q);a.removeListener("drain",
  R);a.removeListener("error",m);a.removeListener("unpipe",f);t.removeListener("end",h);t.removeListener("end",g);t.removeListener("data",l);A=!0;!z.awaitDrain||a._writableState&&!a._writableState.needDrain||R()}function l(c){k("ondata");!1===a.write(c)&&(1!==z.pipesCount||z.pipes[0]!==a||1!==t.listenerCount("data")||A||(k("false write response, pause",t._readableState.awaitDrain),t._readableState.awaitDrain++),t.pause())}function m(c){k("onerror",c);u();a.removeListener("error",m);0===a.listeners("error").length&&
  a.emit("error",c)}function p(){a.removeListener("finish",q);u()}function q(){k("onfinish");a.removeListener("close",p);u()}function u(){k("unpipe");t.unpipe(a)}var t=this,z=this._readableState;switch(z.pipesCount){case 0:z.pipes=a;break;case 1:z.pipes=[z.pipes,a];break;default:z.pipes.push(a)}z.pipesCount+=1;k("pipe count=%d opts=%j",z.pipesCount,c);var x=c&&!1===c.end||a===d.stdout||a===d.stderr?g:h;if(z.endEmitted)r(x);else t.once("end",x);a.on("unpipe",f);var R=w(t);a.on("drain",R);var A=!1;t.on("data",
  l);if(a._events&&a._events.error)K(a._events.error)?a._events.error.unshift(m):a._events.error=[m,a._events.error];else a.on("error",m);a.once("close",p);a.once("finish",q);a.emit("pipe",t);z.flowing||(k("pipe resume"),t.resume());return a};h.prototype.unpipe=function(a){var c=this._readableState;if(0===c.pipesCount)return this;if(1===c.pipesCount){if(a&&a!==c.pipes)return this;a||(a=c.pipes);c.pipes=null;c.pipesCount=0;c.flowing=!1;a&&a.emit("unpipe",this);return this}if(!a){a=c.pipes;var d=c.pipesCount;
  c.pipes=null;c.pipesCount=0;c.flowing=!1;for(var e=0;e<d;e++)a[e].emit("unpipe",this);return this}a:{for(var e=c.pipes,d=0,f=e.length;d<f;d++)if(e[d]===a){e=d;break a}e=-1}if(-1===e)return this;c.pipes.splice(e,1);--c.pipesCount;1===c.pipesCount&&(c.pipes=c.pipes[0]);a.emit("unpipe",this);return this};h.prototype.on=function(a,c){var d=G.prototype.on.call(this,a,c);"data"===a&&!1!==this._readableState.flowing&&this.resume();if("readable"===a&&this.readable){var e=this._readableState;e.readableListening||
  (e.readableListening=!0,e.emittedReadable=!1,e.needReadable=!0,e.reading?e.length&&l(this,e):r(C,this))}return d};h.prototype.addListener=h.prototype.on;h.prototype.resume=function(){var a=this._readableState;a.flowing||(k("resume"),a.flowing=!0,a.resumeScheduled||(a.resumeScheduled=!0,r(B,this,a)));return this};h.prototype.pause=function(){k("call pause flowing=%j",this._readableState.flowing);!1!==this._readableState.flowing&&(k("pause"),this._readableState.flowing=!1,this.emit("pause"));return this};
  h.prototype.wrap=function(a){var c=this._readableState,d=!1,e=this;a.on("end",function(){k("wrapped end");if(c.decoder&&!c.ended){var a=c.decoder.end();a&&a.length&&e.push(a)}e.push(null)});a.on("data",function(f){k("wrapped data");c.decoder&&(f=c.decoder.write(f));c.objectMode&&(null===f||void 0===f)||!(c.objectMode||f&&f.length)||e.push(f)||(d=!0,a.pause())});for(var f in a)void 0===this[f]&&"function"===typeof a[f]&&(this[f]=function(c){return function(){return a[c].apply(a,arguments)}}(f));M(["error",
  "close","destroy","pause","resume"],function(c){a.on(c,e.emit.bind(e,c))});e._read=function(c){k("wrapped _read",c);d&&(d=!1,a.resume())};return e};h._fromList=E}).call(this,a("_process"))},{"./_stream_duplex":13,_process:11,buffer:3,"core-util-is":18,events:7,inherits:8,isarray:10,"process-nextick-args":19,"string_decoder/":26,util:2}],16:[function(a,c,d){function e(a){this.afterTransform=function(c,d){var e;e=a._transformState;e.transforming=!1;var f=e.writecb;f?(e.writechunk=null,e.writecb=null,
  null!==d&&void 0!==d&&a.push(d),f&&f(c),e=a._readableState,e.reading=!1,(e.needReadable||e.length<e.highWaterMark)&&a._read(e.highWaterMark),e=void 0):e=a.emit("error",Error("no writecb in Transform class"));return e};this.transforming=this.needTransform=!1;this.writechunk=this.writecb=null}function f(a){if(!(this instanceof f))return new f(a);g.call(this,a);this._transformState=new e(this);var c=this;this._readableState.needReadable=!0;this._readableState.sync=!1;a&&("function"===typeof a.transform&&
  (this._transform=a.transform),"function"===typeof a.flush&&(this._flush=a.flush));this.once("prefinish",function(){"function"===typeof this._flush?this._flush(function(a){h(c,a)}):h(c)})}function h(a,c){if(c)return a.emit("error",c);var d=a._transformState;if(a._writableState.length)throw Error("calling transform done when ws.length != 0");if(d.transforming)throw Error("calling transform done when still transforming");return a.push(null)}c.exports=f;var g=a("./_stream_duplex");c=a("core-util-is");
  c.inherits=a("inherits");c.inherits(f,g);f.prototype.push=function(a,c){this._transformState.needTransform=!1;return g.prototype.push.call(this,a,c)};f.prototype._transform=function(a,c,d){throw Error("not implemented");};f.prototype._write=function(a,c,d){var e=this._transformState;e.writecb=d;e.writechunk=a;e.writeencoding=c;e.transforming||(a=this._readableState,(e.needTransform||a.needReadable||a.length<a.highWaterMark)&&this._read(a.highWaterMark))};f.prototype._read=function(a){a=this._transformState;
  null!==a.writechunk&&a.writecb&&!a.transforming?(a.transforming=!0,this._transform(a.writechunk,a.writeencoding,a.afterTransform)):a.needTransform=!0}},{"./_stream_duplex":13,"core-util-is":18,inherits:8}],17:[function(a,c,d){function e(){}function f(a,c,d){this.chunk=a;this.encoding=c;this.callback=d;this.next=null}function h(c,d){z=z||a("./_stream_duplex");c=c||{};this.objectMode=!!c.objectMode;d instanceof z&&(this.objectMode=this.objectMode||!!c.writableObjectMode);var e=c.highWaterMark,f=this.objectMode?
  16:16384;this.highWaterMark=e||0===e?e:f;this.highWaterMark=~~this.highWaterMark;this.finished=this.ended=this.ending=this.needDrain=!1;this.decodeStrings=!1!==c.decodeStrings;this.defaultEncoding=c.defaultEncoding||"utf8";this.length=0;this.writing=!1;this.corked=0;this.sync=!0;this.bufferProcessing=!1;this.onwrite=function(a){var c=d._writableState,e=c.sync,f=c.writecb;c.writing=!1;c.writecb=null;c.length-=c.writelen;c.writelen=0;a?(--c.pendingcb,e?C(f,a):f(a),d._writableState.errorEmitted=!0,d.emit("error",
  a)):((a=u(c))||c.corked||c.bufferProcessing||!c.bufferedRequest||q(d,c),e?C(l,d,c,a,f):l(d,c,a,f))};this.writecb=null;this.writelen=0;this.lastBufferedRequest=this.bufferedRequest=null;this.pendingcb=0;this.errorEmitted=this.prefinished=!1}function g(c){z=z||a("./_stream_duplex");if(!(this instanceof g||this instanceof z))return new g(c);this._writableState=new h(c,this);this.writable=!0;c&&("function"===typeof c.write&&(this._write=c.write),"function"===typeof c.writev&&(this._writev=c.writev));
  E.call(this)}function m(a,c,d,e,f,h,g){c.writelen=e;c.writecb=g;c.writing=!0;c.sync=!0;d?a._writev(f,c.onwrite):a._write(f,h,c.onwrite);c.sync=!1}function l(a,c,d,e){!d&&0===c.length&&c.needDrain&&(c.needDrain=!1,a.emit("drain"));c.pendingcb--;e();w(a,c)}function q(a,c){c.bufferProcessing=!0;var d=c.bufferedRequest;if(a._writev&&d&&d.next){for(var e=[],f=[];d;)f.push(d.callback),e.push(d),d=d.next;c.pendingcb++;c.lastBufferedRequest=null;m(a,c,!0,c.length,e,"",function(a){for(var d=0;d<f.length;d++)c.pendingcb--,
  f[d](a)})}else{for(;d&&(e=d.chunk,m(a,c,!1,c.objectMode?1:e.length,e,d.encoding,d.callback),d=d.next,!c.writing););null===d&&(c.lastBufferedRequest=null)}c.bufferedRequest=d;c.bufferProcessing=!1}function u(a){return a.ending&&0===a.length&&null===a.bufferedRequest&&!a.finished&&!a.writing}function w(a,c){var d=u(c);d&&(0===c.pendingcb?(c.prefinished||(c.prefinished=!0,a.emit("prefinish")),c.finished=!0,a.emit("finish")):c.prefinished||(c.prefinished=!0,a.emit("prefinish")));return d}c.exports=g;
  var C=a("process-nextick-args"),B=a("buffer").Buffer;g.WritableState=h;c=a("core-util-is");c.inherits=a("inherits");var A={deprecate:a("util-deprecate")},E;try{E=a("stream")}catch(D){}finally{E||(E=a("events").EventEmitter)}B=a("buffer").Buffer;c.inherits(g,E);var z;h.prototype.getBuffer=function(){for(var a=this.bufferedRequest,c=[];a;)c.push(a),a=a.next;return c};(function(){try{Object.defineProperty(h.prototype,"buffer",{get:A.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(a){}})();
  g.prototype.pipe=function(){this.emit("error",Error("Cannot pipe. Not readable."))};g.prototype.write=function(a,c,d){var h=this._writableState,g=!1;"function"===typeof c&&(d=c,c=null);B.isBuffer(a)?c="buffer":c||(c=h.defaultEncoding);"function"!==typeof d&&(d=e);if(h.ended)h=d,a=Error("write after end"),this.emit("error",a),C(h,a);else{var l=d,q=!0;B.isBuffer(a)||"string"===typeof a||null===a||void 0===a||h.objectMode||(q=new TypeError("Invalid non-string/buffer chunk"),this.emit("error",q),C(l,
  q),q=!1);q&&(h.pendingcb++,g=c,h.objectMode||!1===h.decodeStrings||"string"!==typeof a||(a=new B(a,g)),B.isBuffer(a)&&(g="buffer"),l=h.objectMode?1:a.length,h.length+=l,c=h.length<h.highWaterMark,c||(h.needDrain=!0),h.writing||h.corked?(l=h.lastBufferedRequest,h.lastBufferedRequest=new f(a,g,d),l?l.next=h.lastBufferedRequest:h.bufferedRequest=h.lastBufferedRequest):m(this,h,!1,l,a,g,d),g=c)}return g};g.prototype.cork=function(){this._writableState.corked++};g.prototype.uncork=function(){var a=this._writableState;
  a.corked&&(a.corked--,a.writing||a.corked||a.finished||a.bufferProcessing||!a.bufferedRequest||q(this,a))};g.prototype.setDefaultEncoding=function(a){"string"===typeof a&&(a=a.toLowerCase());if(!(-1<"hex utf8 utf-8 ascii binary base64 ucs2 ucs-2 utf16le utf-16le raw".split(" ").indexOf((a+"").toLowerCase())))throw new TypeError("Unknown encoding: "+a);this._writableState.defaultEncoding=a};g.prototype._write=function(a,c,d){d(Error("not implemented"))};g.prototype._writev=null;g.prototype.end=function(a,
  c,d){var e=this._writableState;"function"===typeof a?(d=a,c=a=null):"function"===typeof c&&(d=c,c=null);null!==a&&void 0!==a&&this.write(a,c);e.corked&&(e.corked=1,this.uncork());if(!e.ending&&!e.finished){a=d;e.ending=!0;w(this,e);if(a)if(e.finished)C(a);else this.once("finish",a);e.ended=!0}}},{"./_stream_duplex":13,buffer:3,"core-util-is":18,events:7,inherits:8,"process-nextick-args":19,"util-deprecate":20}],18:[function(a,c,d){(function(a){d.isArray=function(a){return Array.isArray?Array.isArray(a):
  "[object Array]"===Object.prototype.toString.call(a)};d.isBoolean=function(a){return"boolean"===typeof a};d.isNull=function(a){return null===a};d.isNullOrUndefined=function(a){return null==a};d.isNumber=function(a){return"number"===typeof a};d.isString=function(a){return"string"===typeof a};d.isSymbol=function(a){return"symbol"===typeof a};d.isUndefined=function(a){return void 0===a};d.isRegExp=function(a){return"[object RegExp]"===Object.prototype.toString.call(a)};d.isObject=function(a){return"object"===
  typeof a&&null!==a};d.isDate=function(a){return"[object Date]"===Object.prototype.toString.call(a)};d.isError=function(a){return"[object Error]"===Object.prototype.toString.call(a)||a instanceof Error};d.isFunction=function(a){return"function"===typeof a};d.isPrimitive=function(a){return null===a||"boolean"===typeof a||"number"===typeof a||"string"===typeof a||"symbol"===typeof a||"undefined"===typeof a};d.isBuffer=a.isBuffer}).call(this,{isBuffer:a("../../../../insert-module-globals/node_modules/is-buffer/index.js")})},
  {"../../../../insert-module-globals/node_modules/is-buffer/index.js":9}],19:[function(a,c,d){(function(a){function d(c){for(var f=Array(arguments.length-1),m=0;m<f.length;)f[m++]=arguments[m];a.nextTick(function(){c.apply(null,f)})}!a.version||0===a.version.indexOf("v0.")||0===a.version.indexOf("v1.")&&0!==a.version.indexOf("v1.8.")?c.exports=d:c.exports=a.nextTick}).call(this,a("_process"))},{_process:11}],20:[function(a,c,d){(function(a){function d(c){try{if(!a.localStorage)return!1}catch(f){return!1}c=
  a.localStorage[c];return null==c?!1:"true"===String(c).toLowerCase()}c.exports=function(a,c){if(d("noDeprecation"))return a;var e=!1;return function(){if(!e){if(d("throwDeprecation"))throw Error(c);d("traceDeprecation")?console.trace(c):console.warn(c);e=!0}return a.apply(this,arguments)}}}).call(this,"undefined"!==typeof global?global:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{})},{}],21:[function(a,c,d){c.exports=a("./lib/_stream_passthrough.js")},{"./lib/_stream_passthrough.js":14}],
  22:[function(a,c,d){var e;a:{try{e=a("stream");break a}catch(f){}e=void 0}d=c.exports=a("./lib/_stream_readable.js");d.Stream=e||d;d.Readable=d;d.Writable=a("./lib/_stream_writable.js");d.Duplex=a("./lib/_stream_duplex.js");d.Transform=a("./lib/_stream_transform.js");d.PassThrough=a("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":13,"./lib/_stream_passthrough.js":14,"./lib/_stream_readable.js":15,"./lib/_stream_transform.js":16,"./lib/_stream_writable.js":17}],23:[function(a,c,d){c.exports=
  a("./lib/_stream_transform.js")},{"./lib/_stream_transform.js":16}],24:[function(a,c,d){c.exports=a("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":17}],25:[function(a,c,d){function e(){f.call(this)}c.exports=e;var f=a("events").EventEmitter;a("inherits")(e,f);e.Readable=a("readable-stream/readable.js");e.Writable=a("readable-stream/writable.js");e.Duplex=a("readable-stream/duplex.js");e.Transform=a("readable-stream/transform.js");e.PassThrough=a("readable-stream/passthrough.js");e.Stream=
  e;e.prototype.pipe=function(a,c){function d(c){a.writable&&!1===a.write(c)&&B.pause&&B.pause()}function e(){B.readable&&B.resume&&B.resume()}function q(){A||(A=!0,a.end())}function u(){A||(A=!0,"function"===typeof a.destroy&&a.destroy())}function w(a){C();if(0===f.listenerCount(this,"error"))throw a;}function C(){B.removeListener("data",d);a.removeListener("drain",e);B.removeListener("end",q);B.removeListener("close",u);B.removeListener("error",w);a.removeListener("error",w);B.removeListener("end",
  C);B.removeListener("close",C);a.removeListener("close",C)}var B=this;B.on("data",d);a.on("drain",e);a._isStdio||c&&!1===c.end||(B.on("end",q),B.on("close",u));var A=!1;B.on("error",w);a.on("error",w);B.on("end",C);B.on("close",C);a.on("close",C);a.emit("pipe",B);return a}},{events:7,inherits:8,"readable-stream/duplex.js":12,"readable-stream/passthrough.js":21,"readable-stream/readable.js":22,"readable-stream/transform.js":23,"readable-stream/writable.js":24}],26:[function(a,c,d){function e(a){return a.toString(this.encoding)}
  function f(a){this.charLength=(this.charReceived=a.length%2)?2:0}function h(a){this.charLength=(this.charReceived=a.length%3)?3:0}var g=a("buffer").Buffer,m=g.isEncoding||function(a){switch(a&&a.toLowerCase()){case "hex":case "utf8":case "utf-8":case "ascii":case "binary":case "base64":case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":case "raw":return!0;default:return!1}};a=d.StringDecoder=function(a){this.encoding=(a||"utf8").toLowerCase().replace(/[-_]/,"");if(a&&!m(a))throw Error("Unknown encoding: "+
  a);switch(this.encoding){case "utf8":this.surrogateSize=3;break;case "ucs2":case "utf16le":this.surrogateSize=2;this.detectIncompleteChar=f;break;case "base64":this.surrogateSize=3;this.detectIncompleteChar=h;break;default:this.write=e;return}this.charBuffer=new g(6);this.charLength=this.charReceived=0};a.prototype.write=function(a){for(var c="";this.charLength;){c=a.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:a.length;a.copy(this.charBuffer,this.charReceived,0,c);
  this.charReceived+=c;if(this.charReceived<this.charLength)return"";a=a.slice(c,a.length);var c=this.charBuffer.slice(0,this.charLength).toString(this.encoding),d=c.charCodeAt(c.length-1);if(55296<=d&&56319>=d)this.charLength+=this.surrogateSize,c="";else{this.charReceived=this.charLength=0;if(0===a.length)return c;break}}this.detectIncompleteChar(a);var e=a.length;this.charLength&&(a.copy(this.charBuffer,0,a.length-this.charReceived,e),e-=this.charReceived);c+=a.toString(this.encoding,0,e);e=c.length-
  1;d=c.charCodeAt(e);return 55296<=d&&56319>=d?(d=this.surrogateSize,this.charLength+=d,this.charReceived+=d,this.charBuffer.copy(this.charBuffer,d,0,d),a.copy(this.charBuffer,0,0,d),c.substring(0,e)):c};a.prototype.detectIncompleteChar=function(a){for(var c=3<=a.length?3:a.length;0<c;c--){var d=a[a.length-c];if(1==c&&6==d>>5){this.charLength=2;break}if(2>=c&&14==d>>4){this.charLength=3;break}if(3>=c&&30==d>>3){this.charLength=4;break}}this.charReceived=c};a.prototype.end=function(a){var c="";a&&a.length&&
  (c=this.write(a));this.charReceived&&(a=this.encoding,c+=this.charBuffer.slice(0,this.charReceived).toString(a));return c}},{buffer:3}],27:[function(a,c,d){d=a("./lib/utils/common").assign;var e=a("./lib/deflate"),f=a("./lib/inflate");a=a("./lib/zlib/constants");var h={};d(h,e,f,a);c.exports=h},{"./lib/deflate":28,"./lib/inflate":29,"./lib/utils/common":30,"./lib/zlib/constants":33}],28:[function(a,c,d){function e(a){if(!(this instanceof e))return new e(a);a=this.options=g.assign({level:-1,method:8,
  chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},a||{});a.raw&&0<a.windowBits?a.windowBits=-a.windowBits:a.gzip&&0<a.windowBits&&16>a.windowBits&&(a.windowBits+=16);this.err=0;this.msg="";this.ended=!1;this.chunks=[];this.strm=new q;this.strm.avail_out=0;var c=h.deflateInit2(this.strm,a.level,a.method,a.windowBits,a.memLevel,a.strategy);if(0!==c)throw Error(l[c]);a.header&&h.deflateSetHeader(this.strm,a.header)}function f(a,c){var d=new e(c);d.push(a,!0);if(d.err)throw d.msg;return d.result}
  var h=a("./zlib/deflate"),g=a("./utils/common"),m=a("./utils/strings"),l=a("./zlib/messages"),q=a("./zlib/zstream"),u=Object.prototype.toString;e.prototype.push=function(a,c){var d=this.strm,e=this.options.chunkSize,f,l;if(this.ended)return!1;l=c===~~c?c:!0===c?4:0;"string"===typeof a?d.input=m.string2buf(a):"[object ArrayBuffer]"===u.call(a)?d.input=new Uint8Array(a):d.input=a;d.next_in=0;d.avail_in=d.input.length;do{0===d.avail_out&&(d.output=new g.Buf8(e),d.next_out=0,d.avail_out=e);f=h.deflate(d,
  l);if(1!==f&&0!==f)return this.onEnd(f),this.ended=!0,!1;if(0===d.avail_out||0===d.avail_in&&(4===l||2===l))if("string"===this.options.to)this.onData(m.buf2binstring(g.shrinkBuf(d.output,d.next_out)));else this.onData(g.shrinkBuf(d.output,d.next_out))}while((0<d.avail_in||0===d.avail_out)&&1!==f);if(4===l)return f=h.deflateEnd(this.strm),this.onEnd(f),this.ended=!0,0===f;2===l&&(this.onEnd(0),d.avail_out=0);return!0};e.prototype.onData=function(a){this.chunks.push(a)};e.prototype.onEnd=function(a){0===
  a&&(this.result="string"===this.options.to?this.chunks.join(""):g.flattenChunks(this.chunks));this.chunks=[];this.err=a;this.msg=this.strm.msg};d.Deflate=e;d.deflate=f;d.deflateRaw=function(a,c){c=c||{};c.raw=!0;return f(a,c)};d.gzip=function(a,c){c=c||{};c.gzip=!0;return f(a,c)}},{"./utils/common":30,"./utils/strings":31,"./zlib/deflate":35,"./zlib/messages":40,"./zlib/zstream":42}],29:[function(a,c,d){function e(a){if(!(this instanceof e))return new e(a);var c=this.options=g.assign({chunkSize:16384,
  windowBits:0,to:""},a||{});c.raw&&0<=c.windowBits&&16>c.windowBits&&(c.windowBits=-c.windowBits,0===c.windowBits&&(c.windowBits=-15));!(0<=c.windowBits&&16>c.windowBits)||a&&a.windowBits||(c.windowBits+=32);15<c.windowBits&&48>c.windowBits&&0===(c.windowBits&15)&&(c.windowBits|=15);this.err=0;this.msg="";this.ended=!1;this.chunks=[];this.strm=new u;this.strm.avail_out=0;a=h.inflateInit2(this.strm,c.windowBits);if(a!==l.Z_OK)throw Error(q[a]);this.header=new w;h.inflateGetHeader(this.strm,this.header)}
  function f(a,c){var d=new e(c);d.push(a,!0);if(d.err)throw d.msg;return d.result}var h=a("./zlib/inflate"),g=a("./utils/common"),m=a("./utils/strings"),l=a("./zlib/constants"),q=a("./zlib/messages"),u=a("./zlib/zstream"),w=a("./zlib/gzheader"),C=Object.prototype.toString;e.prototype.push=function(a,c){var d=this.strm,e=this.options.chunkSize,f,q,r,u,w,G=!1;if(this.ended)return!1;q=c===~~c?c:!0===c?l.Z_FINISH:l.Z_NO_FLUSH;"string"===typeof a?d.input=m.binstring2buf(a):"[object ArrayBuffer]"===C.call(a)?
  d.input=new Uint8Array(a):d.input=a;d.next_in=0;d.avail_in=d.input.length;do{0===d.avail_out&&(d.output=new g.Buf8(e),d.next_out=0,d.avail_out=e);f=h.inflate(d,l.Z_NO_FLUSH);f===l.Z_BUF_ERROR&&!0===G&&(f=l.Z_OK,G=!1);if(f!==l.Z_STREAM_END&&f!==l.Z_OK)return this.onEnd(f),this.ended=!0,!1;if(d.next_out&&(0===d.avail_out||f===l.Z_STREAM_END||0===d.avail_in&&(q===l.Z_FINISH||q===l.Z_SYNC_FLUSH)))if("string"===this.options.to)r=m.utf8border(d.output,d.next_out),u=d.next_out-r,w=m.buf2string(d.output,
  r),d.next_out=u,d.avail_out=e-u,u&&g.arraySet(d.output,d.output,r,u,0),this.onData(w);else this.onData(g.shrinkBuf(d.output,d.next_out));0===d.avail_in&&0===d.avail_out&&(G=!0)}while((0<d.avail_in||0===d.avail_out)&&f!==l.Z_STREAM_END);f===l.Z_STREAM_END&&(q=l.Z_FINISH);if(q===l.Z_FINISH)return f=h.inflateEnd(this.strm),this.onEnd(f),this.ended=!0,f===l.Z_OK;q===l.Z_SYNC_FLUSH&&(this.onEnd(l.Z_OK),d.avail_out=0);return!0};e.prototype.onData=function(a){this.chunks.push(a)};e.prototype.onEnd=function(a){a===
  l.Z_OK&&(this.result="string"===this.options.to?this.chunks.join(""):g.flattenChunks(this.chunks));this.chunks=[];this.err=a;this.msg=this.strm.msg};d.Inflate=e;d.inflate=f;d.inflateRaw=function(a,c){c=c||{};c.raw=!0;return f(a,c)};d.ungzip=f},{"./utils/common":30,"./utils/strings":31,"./zlib/constants":33,"./zlib/gzheader":36,"./zlib/inflate":38,"./zlib/messages":40,"./zlib/zstream":42}],30:[function(a,c,d){a="undefined"!==typeof Uint8Array&&"undefined"!==typeof Uint16Array&&"undefined"!==typeof Int32Array;
  d.assign=function(a){for(var c=Array.prototype.slice.call(arguments,1);c.length;){var d=c.shift();if(d){if("object"!==typeof d)throw new TypeError(d+"must be non-object");for(var e in d)d.hasOwnProperty(e)&&(a[e]=d[e])}}return a};d.shrinkBuf=function(a,c){if(a.length===c)return a;if(a.subarray)return a.subarray(0,c);a.length=c;return a};var e={arraySet:function(a,c,d,e,f){if(c.subarray&&a.subarray)a.set(c.subarray(d,d+e),f);else for(var u=0;u<e;u++)a[f+u]=c[d+u]},flattenChunks:function(a){var c,d,
  e,f,u;c=e=0;for(d=a.length;c<d;c++)e+=a[c].length;u=new Uint8Array(e);c=e=0;for(d=a.length;c<d;c++)f=a[c],u.set(f,e),e+=f.length;return u}},f={arraySet:function(a,c,d,e,f){for(var u=0;u<e;u++)a[f+u]=c[d+u]},flattenChunks:function(a){return[].concat.apply([],a)}};d.setTyped=function(a){a?(d.Buf8=Uint8Array,d.Buf16=Uint16Array,d.Buf32=Int32Array,d.assign(d,e)):(d.Buf8=Array,d.Buf16=Array,d.Buf32=Array,d.assign(d,f))};d.setTyped(a)},{}],31:[function(a,c,d){function e(a,c){if(65537>c&&(a.subarray&&g||
  !a.subarray&&h))return String.fromCharCode.apply(null,f.shrinkBuf(a,c));for(var d="",e=0;e<c;e++)d+=String.fromCharCode(a[e]);return d}var f=a("./common"),h=!0,g=!0;try{String.fromCharCode.apply(null,[0])}catch(m){h=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(l){g=!1}var q=new f.Buf8(256);for(a=0;256>a;a++)q[a]=252<=a?6:248<=a?5:240<=a?4:224<=a?3:192<=a?2:1;q[254]=q[254]=1;d.string2buf=function(a){var c,d,e,h,g,l=a.length,m=0;for(h=0;h<l;h++)d=a.charCodeAt(h),55296===(d&64512)&&
  h+1<l&&(e=a.charCodeAt(h+1),56320===(e&64512)&&(d=65536+(d-55296<<10)+(e-56320),h++)),m+=128>d?1:2048>d?2:65536>d?3:4;c=new f.Buf8(m);for(h=g=0;g<m;h++)d=a.charCodeAt(h),55296===(d&64512)&&h+1<l&&(e=a.charCodeAt(h+1),56320===(e&64512)&&(d=65536+(d-55296<<10)+(e-56320),h++)),128>d?c[g++]=d:(2048>d?c[g++]=192|d>>>6:(65536>d?c[g++]=224|d>>>12:(c[g++]=240|d>>>18,c[g++]=128|d>>>12&63),c[g++]=128|d>>>6&63),c[g++]=128|d&63);return c};d.buf2binstring=function(a){return e(a,a.length)};d.binstring2buf=function(a){for(var c=
  new f.Buf8(a.length),d=0,e=c.length;d<e;d++)c[d]=a.charCodeAt(d);return c};d.buf2string=function(a,c){var d,f,h,g,l=c||a.length,m=Array(2*l);for(d=f=0;d<l;)if(h=a[d++],128>h)m[f++]=h;else if(g=q[h],4<g)m[f++]=65533,d+=g-1;else{for(h&=2===g?31:3===g?15:7;1<g&&d<l;)h=h<<6|a[d++]&63,g--;1<g?m[f++]=65533:65536>h?m[f++]=h:(h-=65536,m[f++]=55296|h>>10&1023,m[f++]=56320|h&1023)}return e(m,f)};d.utf8border=function(a,c){var d;c=c||a.length;c>a.length&&(c=a.length);for(d=c-1;0<=d&&128===(a[d]&192);)d--;return 0>
  d||0===d?c:d+q[a[d]]>c?d:c}},{"./common":30}],32:[function(a,c,d){c.exports=function(a,c,d,g){var m=a&65535|0;a=a>>>16&65535|0;for(var l=0;0!==d;){l=2E3<d?2E3:d;d-=l;do m=m+c[g++]|0,a=a+m|0;while(--l);m%=65521;a%=65521}return m|a<<16|0}},{}],33:[function(a,c,d){c.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,
  Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],34:[function(a,c,d){var e=function(){for(var a,c=[],d=0;256>d;d++){a=d;for(var e=0;8>e;e++)a=a&1?3988292384^a>>>1:a>>>1;c[d]=a}return c}();c.exports=function(a,c,d,m){d=m+d;for(a^=-1;m<d;m++)a=a>>>8^e[(a^c[m])&255];return a^-1}},{}],35:[function(a,c,d){function e(a,c){a.msg=F[c];return c}function f(a){for(var c=a.length;0<=--c;)a[c]=0}function h(a){var c=
  a.state,d=c.pending;d>a.avail_out&&(d=a.avail_out);0!==d&&(K.arraySet(a.output,c.pending_buf,c.pending_out,d,a.next_out),a.next_out+=d,c.pending_out+=d,a.total_out+=d,a.avail_out-=d,c.pending-=d,0===c.pending&&(c.pending_out=0))}function g(a,c){N._tr_flush_block(a,0<=a.block_start?a.block_start:-1,a.strstart-a.block_start,c);a.block_start=a.strstart;h(a.strm)}function m(a,c){a.pending_buf[a.pending++]=c}function l(a,c){a.pending_buf[a.pending++]=c>>>8&255;a.pending_buf[a.pending++]=c&255}function q(a,
  c){var d=a.max_chain_length,e=a.strstart,f,h=a.prev_length,g=a.nice_match,l=a.strstart>a.w_size-262?a.strstart-(a.w_size-262):0,m=a.window,r=a.w_mask,q=a.prev,t=a.strstart+258,z=m[e+h-1],u=m[e+h];a.prev_length>=a.good_match&&(d>>=2);g>a.lookahead&&(g=a.lookahead);do if(f=c,m[f+h]===u&&m[f+h-1]===z&&m[f]===m[e]&&m[++f]===m[e+1]){e+=2;for(f++;m[++e]===m[++f]&&m[++e]===m[++f]&&m[++e]===m[++f]&&m[++e]===m[++f]&&m[++e]===m[++f]&&m[++e]===m[++f]&&m[++e]===m[++f]&&m[++e]===m[++f]&&e<t;);f=258-(t-e);e=t-
  258;if(f>h){a.match_start=c;h=f;if(f>=g)break;z=m[e+h-1];u=m[e+h]}}while((c=q[c&r])>l&&0!==--d);return h<=a.lookahead?h:a.lookahead}function u(a){var c=a.w_size,d,e,f,h;do{h=a.window_size-a.lookahead-a.strstart;if(a.strstart>=c+(c-262)){K.arraySet(a.window,a.window,c,c,0);a.match_start-=c;a.strstart-=c;a.block_start-=c;d=e=a.hash_size;do f=a.head[--d],a.head[d]=f>=c?f-c:0;while(--e);d=e=c;do f=a.prev[--d],a.prev[d]=f>=c?f-c:0;while(--e);h+=c}if(0===a.strm.avail_in)break;d=a.strm;e=a.window;f=a.strstart+
  a.lookahead;var g=d.avail_in;g>h&&(g=h);0===g?e=0:(d.avail_in-=g,K.arraySet(e,d.input,d.next_in,g,f),1===d.state.wrap?d.adler=G(d.adler,e,g,f):2===d.state.wrap&&(d.adler=x(d.adler,e,g,f)),d.next_in+=g,d.total_in+=g,e=g);a.lookahead+=e;if(3<=a.lookahead+a.insert)for(h=a.strstart-a.insert,a.ins_h=a.window[h],a.ins_h=(a.ins_h<<a.hash_shift^a.window[h+1])&a.hash_mask;a.insert&&!(a.ins_h=(a.ins_h<<a.hash_shift^a.window[h+3-1])&a.hash_mask,a.prev[h&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=h,h++,a.insert--,
  3>a.lookahead+a.insert););}while(262>a.lookahead&&0!==a.strm.avail_in)}function w(a,c){for(var d;;){if(262>a.lookahead){u(a);if(262>a.lookahead&&0===c)return 1;if(0===a.lookahead)break}d=0;3<=a.lookahead&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+3-1])&a.hash_mask,d=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart);0!==d&&a.strstart-d<=a.w_size-262&&(a.match_length=q(a,d));if(3<=a.match_length)if(d=N._tr_tally(a,a.strstart-a.match_start,a.match_length-3),a.lookahead-=
  a.match_length,a.match_length<=a.max_lazy_match&&3<=a.lookahead){a.match_length--;do a.strstart++,a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+3-1])&a.hash_mask,a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart;while(0!==--a.match_length);a.strstart++}else a.strstart+=a.match_length,a.match_length=0,a.ins_h=a.window[a.strstart],a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+1])&a.hash_mask;else d=N._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++;if(d&&
  (g(a,!1),0===a.strm.avail_out))return 1}a.insert=2>a.strstart?a.strstart:2;return 4===c?(g(a,!0),0===a.strm.avail_out?3:4):a.last_lit&&(g(a,!1),0===a.strm.avail_out)?1:2}function C(a,c){for(var d,e;;){if(262>a.lookahead){u(a);if(262>a.lookahead&&0===c)return 1;if(0===a.lookahead)break}d=0;3<=a.lookahead&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+3-1])&a.hash_mask,d=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart);a.prev_length=a.match_length;a.prev_match=a.match_start;
  a.match_length=2;0!==d&&a.prev_length<a.max_lazy_match&&a.strstart-d<=a.w_size-262&&(a.match_length=q(a,d),5>=a.match_length&&(1===a.strategy||3===a.match_length&&4096<a.strstart-a.match_start)&&(a.match_length=2));if(3<=a.prev_length&&a.match_length<=a.prev_length){e=a.strstart+a.lookahead-3;d=N._tr_tally(a,a.strstart-1-a.prev_match,a.prev_length-3);a.lookahead-=a.prev_length-1;a.prev_length-=2;do++a.strstart<=e&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+3-1])&a.hash_mask,a.prev[a.strstart&
  a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart);while(0!==--a.prev_length);a.match_available=0;a.match_length=2;a.strstart++;if(d&&(g(a,!1),0===a.strm.avail_out))return 1}else if(a.match_available){if((d=N._tr_tally(a,0,a.window[a.strstart-1]))&&g(a,!1),a.strstart++,a.lookahead--,0===a.strm.avail_out)return 1}else a.match_available=1,a.strstart++,a.lookahead--}a.match_available&&(N._tr_tally(a,0,a.window[a.strstart-1]),a.match_available=0);a.insert=2>a.strstart?a.strstart:2;return 4===c?(g(a,
  !0),0===a.strm.avail_out?3:4):a.last_lit&&(g(a,!1),0===a.strm.avail_out)?1:2}function B(a,c){for(var d,e,f,h=a.window;;){if(258>=a.lookahead){u(a);if(258>=a.lookahead&&0===c)return 1;if(0===a.lookahead)break}a.match_length=0;if(3<=a.lookahead&&0<a.strstart&&(e=a.strstart-1,d=h[e],d===h[++e]&&d===h[++e]&&d===h[++e])){for(f=a.strstart+258;d===h[++e]&&d===h[++e]&&d===h[++e]&&d===h[++e]&&d===h[++e]&&d===h[++e]&&d===h[++e]&&d===h[++e]&&e<f;);a.match_length=258-(f-e);a.match_length>a.lookahead&&(a.match_length=
  a.lookahead)}3<=a.match_length?(d=N._tr_tally(a,1,a.match_length-3),a.lookahead-=a.match_length,a.strstart+=a.match_length,a.match_length=0):(d=N._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++);if(d&&(g(a,!1),0===a.strm.avail_out))return 1}a.insert=0;return 4===c?(g(a,!0),0===a.strm.avail_out?3:4):a.last_lit&&(g(a,!1),0===a.strm.avail_out)?1:2}function A(a,c){for(var d;;){if(0===a.lookahead&&(u(a),0===a.lookahead)){if(0===c)return 1;break}a.match_length=0;d=N._tr_tally(a,0,a.window[a.strstart]);
  a.lookahead--;a.strstart++;if(d&&(g(a,!1),0===a.strm.avail_out))return 1}a.insert=0;return 4===c?(g(a,!0),0===a.strm.avail_out?3:4):a.last_lit&&(g(a,!1),0===a.strm.avail_out)?1:2}function E(a,c,d,e,f){this.good_length=a;this.max_lazy=c;this.nice_length=d;this.max_chain=e;this.func=f}function D(){this.strm=null;this.status=0;this.pending_buf=null;this.wrap=this.pending=this.pending_out=this.pending_buf_size=0;this.gzhead=null;this.gzindex=0;this.method=8;this.last_flush=-1;this.w_mask=this.w_bits=
  this.w_size=0;this.window=null;this.window_size=0;this.head=this.prev=null;this.nice_match=this.good_match=this.strategy=this.level=this.max_lazy_match=this.max_chain_length=this.prev_length=this.lookahead=this.match_start=this.strstart=this.match_available=this.prev_match=this.match_length=this.block_start=this.hash_shift=this.hash_mask=this.hash_bits=this.hash_size=this.ins_h=0;this.dyn_ltree=new K.Buf16(1146);this.dyn_dtree=new K.Buf16(122);this.bl_tree=new K.Buf16(78);f(this.dyn_ltree);f(this.dyn_dtree);
  f(this.bl_tree);this.bl_desc=this.d_desc=this.l_desc=null;this.bl_count=new K.Buf16(16);this.heap=new K.Buf16(573);f(this.heap);this.heap_max=this.heap_len=0;this.depth=new K.Buf16(573);f(this.depth);this.bi_valid=this.bi_buf=this.insert=this.matches=this.static_len=this.opt_len=this.d_buf=this.last_lit=this.lit_bufsize=this.l_buf=0}function z(a){var c;if(!a||!a.state)return e(a,-2);a.total_in=a.total_out=0;a.data_type=2;c=a.state;c.pending=0;c.pending_out=0;0>c.wrap&&(c.wrap=-c.wrap);c.status=c.wrap?
  42:113;a.adler=2===c.wrap?0:1;c.last_flush=0;N._tr_init(c);return 0}function M(a){var c=z(a);0===c&&(a=a.state,a.window_size=2*a.w_size,f(a.head),a.max_lazy_match=t[a.level].max_lazy,a.good_match=t[a.level].good_length,a.nice_match=t[a.level].nice_length,a.max_chain_length=t[a.level].max_chain,a.strstart=0,a.block_start=0,a.lookahead=0,a.insert=0,a.match_length=a.prev_length=2,a.match_available=0,a.ins_h=0);return c}function r(a,c,d,f,h,g){if(!a)return-2;var l=1;-1===c&&(c=6);0>f?(l=0,f=-f):15<f&&
  (l=2,f-=16);if(1>h||9<h||8!==d||8>f||15<f||0>c||9<c||0>g||4<g)return e(a,-2);8===f&&(f=9);var m=new D;a.state=m;m.strm=a;m.wrap=l;m.gzhead=null;m.w_bits=f;m.w_size=1<<m.w_bits;m.w_mask=m.w_size-1;m.hash_bits=h+7;m.hash_size=1<<m.hash_bits;m.hash_mask=m.hash_size-1;m.hash_shift=~~((m.hash_bits+3-1)/3);m.window=new K.Buf8(2*m.w_size);m.head=new K.Buf16(m.hash_size);m.prev=new K.Buf16(m.w_size);m.lit_bufsize=1<<h+6;m.pending_buf_size=4*m.lit_bufsize;m.pending_buf=new K.Buf8(m.pending_buf_size);m.d_buf=
  m.lit_bufsize>>1;m.l_buf=3*m.lit_bufsize;m.level=c;m.strategy=g;m.method=d;return M(a)}var K=a("../utils/common"),N=a("./trees"),G=a("./adler32"),x=a("./crc32"),F=a("./messages"),t;t=[new E(0,0,0,0,function(a,c){var d=65535;for(d>a.pending_buf_size-5&&(d=a.pending_buf_size-5);;){if(1>=a.lookahead){u(a);if(0===a.lookahead&&0===c)return 1;if(0===a.lookahead)break}a.strstart+=a.lookahead;a.lookahead=0;var e=a.block_start+d;if(0===a.strstart||a.strstart>=e)if(a.lookahead=a.strstart-e,a.strstart=e,g(a,
  !1),0===a.strm.avail_out)return 1;if(a.strstart-a.block_start>=a.w_size-262&&(g(a,!1),0===a.strm.avail_out))return 1}a.insert=0;if(4===c)return g(a,!0),0===a.strm.avail_out?3:4;a.strstart>a.block_start&&g(a,!1);return 1}),new E(4,4,8,4,w),new E(4,5,16,8,w),new E(4,6,32,32,w),new E(4,4,16,16,C),new E(8,16,32,32,C),new E(8,16,128,128,C),new E(8,32,128,256,C),new E(32,128,258,1024,C),new E(32,258,258,4096,C)];d.deflateInit=function(a,c){return r(a,c,8,15,8,0)};d.deflateInit2=r;d.deflateReset=M;d.deflateResetKeep=
  z;d.deflateSetHeader=function(a,c){if(!a||!a.state||2!==a.state.wrap)return-2;a.state.gzhead=c;return 0};d.deflate=function(a,c){var d,g,r,q;if(!a||!a.state||5<c||0>c)return a?e(a,-2):-2;g=a.state;if(!a.output||!a.input&&0!==a.avail_in||666===g.status&&4!==c)return e(a,0===a.avail_out?-5:-2);g.strm=a;d=g.last_flush;g.last_flush=c;42===g.status&&(2===g.wrap?(a.adler=0,m(g,31),m(g,139),m(g,8),g.gzhead?(m(g,(g.gzhead.text?1:0)+(g.gzhead.hcrc?2:0)+(g.gzhead.extra?4:0)+(g.gzhead.name?8:0)+(g.gzhead.comment?
  16:0)),m(g,g.gzhead.time&255),m(g,g.gzhead.time>>8&255),m(g,g.gzhead.time>>16&255),m(g,g.gzhead.time>>24&255),m(g,9===g.level?2:2<=g.strategy||2>g.level?4:0),m(g,g.gzhead.os&255),g.gzhead.extra&&g.gzhead.extra.length&&(m(g,g.gzhead.extra.length&255),m(g,g.gzhead.extra.length>>8&255)),g.gzhead.hcrc&&(a.adler=x(a.adler,g.pending_buf,g.pending,0)),g.gzindex=0,g.status=69):(m(g,0),m(g,0),m(g,0),m(g,0),m(g,0),m(g,9===g.level?2:2<=g.strategy||2>g.level?4:0),m(g,3),g.status=113)):(r=8+(g.w_bits-8<<4)<<8,
  q=-1,q=2<=g.strategy||2>g.level?0:6>g.level?1:6===g.level?2:3,r|=q<<6,0!==g.strstart&&(r|=32),g.status=113,l(g,r+(31-r%31)),0!==g.strstart&&(l(g,a.adler>>>16),l(g,a.adler&65535)),a.adler=1));if(69===g.status)if(g.gzhead.extra){for(r=g.pending;g.gzindex<(g.gzhead.extra.length&65535)&&(g.pending!==g.pending_buf_size||(g.gzhead.hcrc&&g.pending>r&&(a.adler=x(a.adler,g.pending_buf,g.pending-r,r)),h(a),r=g.pending,g.pending!==g.pending_buf_size));)m(g,g.gzhead.extra[g.gzindex]&255),g.gzindex++;g.gzhead.hcrc&&
  g.pending>r&&(a.adler=x(a.adler,g.pending_buf,g.pending-r,r));g.gzindex===g.gzhead.extra.length&&(g.gzindex=0,g.status=73)}else g.status=73;if(73===g.status)if(g.gzhead.name){r=g.pending;do{if(g.pending===g.pending_buf_size&&(g.gzhead.hcrc&&g.pending>r&&(a.adler=x(a.adler,g.pending_buf,g.pending-r,r)),h(a),r=g.pending,g.pending===g.pending_buf_size)){q=1;break}q=g.gzindex<g.gzhead.name.length?g.gzhead.name.charCodeAt(g.gzindex++)&255:0;m(g,q)}while(0!==q);g.gzhead.hcrc&&g.pending>r&&(a.adler=x(a.adler,
  g.pending_buf,g.pending-r,r));0===q&&(g.gzindex=0,g.status=91)}else g.status=91;if(91===g.status)if(g.gzhead.comment){r=g.pending;do{if(g.pending===g.pending_buf_size&&(g.gzhead.hcrc&&g.pending>r&&(a.adler=x(a.adler,g.pending_buf,g.pending-r,r)),h(a),r=g.pending,g.pending===g.pending_buf_size)){q=1;break}q=g.gzindex<g.gzhead.comment.length?g.gzhead.comment.charCodeAt(g.gzindex++)&255:0;m(g,q)}while(0!==q);g.gzhead.hcrc&&g.pending>r&&(a.adler=x(a.adler,g.pending_buf,g.pending-r,r));0===q&&(g.status=
  103)}else g.status=103;103===g.status&&(g.gzhead.hcrc?(g.pending+2>g.pending_buf_size&&h(a),g.pending+2<=g.pending_buf_size&&(m(g,a.adler&255),m(g,a.adler>>8&255),a.adler=0,g.status=113)):g.status=113);if(0!==g.pending){if(h(a),0===a.avail_out)return g.last_flush=-1,0}else if(0===a.avail_in&&(c<<1)-(4<c?9:0)<=(d<<1)-(4<d?9:0)&&4!==c)return e(a,-5);if(666===g.status&&0!==a.avail_in)return e(a,-5);if(0!==a.avail_in||0!==g.lookahead||0!==c&&666!==g.status){d=2===g.strategy?A(g,c):3===g.strategy?B(g,
  c):t[g.level].func(g,c);if(3===d||4===d)g.status=666;if(1===d||3===d)return 0===a.avail_out&&(g.last_flush=-1),0;if(2===d&&(1===c?N._tr_align(g):5!==c&&(N._tr_stored_block(g,0,0,!1),3===c&&(f(g.head),0===g.lookahead&&(g.strstart=0,g.block_start=0,g.insert=0))),h(a),0===a.avail_out))return g.last_flush=-1,0}if(4!==c)return 0;if(0>=g.wrap)return 1;2===g.wrap?(m(g,a.adler&255),m(g,a.adler>>8&255),m(g,a.adler>>16&255),m(g,a.adler>>24&255),m(g,a.total_in&255),m(g,a.total_in>>8&255),m(g,a.total_in>>16&
  255),m(g,a.total_in>>24&255)):(l(g,a.adler>>>16),l(g,a.adler&65535));h(a);0<g.wrap&&(g.wrap=-g.wrap);return 0!==g.pending?0:1};d.deflateEnd=function(a){var c;if(!a||!a.state)return-2;c=a.state.status;if(42!==c&&69!==c&&73!==c&&91!==c&&103!==c&&113!==c&&666!==c)return e(a,-2);a.state=null;return 113===c?e(a,-3):0};d.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":30,"./adler32":32,"./crc32":34,"./messages":40,"./trees":41}],36:[function(a,c,d){c.exports=function(){this.os=this.xflags=
  this.time=this.text=0;this.extra=null;this.extra_len=0;this.comment=this.name="";this.hcrc=0;this.done=!1}},{}],37:[function(a,c,d){c.exports=function(a,c){var d,g,m,l,q,u,w,C,B,A,E,D,z,M,r,K,N,G,x,F,t,k,p,J;d=a.state;g=a.next_in;p=a.input;m=g+(a.avail_in-5);l=a.next_out;J=a.output;q=l-(c-a.avail_out);u=l+(a.avail_out-257);w=d.dmax;C=d.wsize;B=d.whave;A=d.wnext;E=d.window;D=d.hold;z=d.bits;M=d.lencode;r=d.distcode;K=(1<<d.lenbits)-1;N=(1<<d.distbits)-1;a:do b:for(15>z&&(D+=p[g++]<<z,z+=8,D+=p[g++]<<
  z,z+=8),G=M[D&K];;){x=G>>>24;D>>>=x;z-=x;x=G>>>16&255;if(0===x)J[l++]=G&65535;else if(x&16){F=G&65535;if(x&=15)z<x&&(D+=p[g++]<<z,z+=8),F+=D&(1<<x)-1,D>>>=x,z-=x;15>z&&(D+=p[g++]<<z,z+=8,D+=p[g++]<<z,z+=8);G=r[D&N];c:for(;;){x=G>>>24;D>>>=x;z-=x;x=G>>>16&255;if(x&16){G&=65535;x&=15;z<x&&(D+=p[g++]<<z,z+=8,z<x&&(D+=p[g++]<<z,z+=8));G+=D&(1<<x)-1;if(G>w){a.msg="invalid distance too far back";d.mode=30;break a}D>>>=x;z-=x;x=l-q;if(G>x){x=G-x;if(x>B&&d.sane){a.msg="invalid distance too far back";d.mode=
  30;break a}t=0;k=E;if(0===A){if(t+=C-x,x<F){F-=x;do J[l++]=E[t++];while(--x);t=l-G;k=J}}else if(A<x){if(t+=C+A-x,x-=A,x<F){F-=x;do J[l++]=E[t++];while(--x);t=0;if(A<F){x=A;F-=x;do J[l++]=E[t++];while(--x);t=l-G;k=J}}}else if(t+=A-x,x<F){F-=x;do J[l++]=E[t++];while(--x);t=l-G;k=J}for(;2<F;)J[l++]=k[t++],J[l++]=k[t++],J[l++]=k[t++],F-=3;F&&(J[l++]=k[t++],1<F&&(J[l++]=k[t++]))}else{t=l-G;do J[l++]=J[t++],J[l++]=J[t++],J[l++]=J[t++],F-=3;while(2<F);F&&(J[l++]=J[t++],1<F&&(J[l++]=J[t++]))}}else if(0===
  (x&64)){G=r[(G&65535)+(D&(1<<x)-1)];continue c}else{a.msg="invalid distance code";d.mode=30;break a}break}}else if(0===(x&64)){G=M[(G&65535)+(D&(1<<x)-1)];continue b}else{x&32?d.mode=12:(a.msg="invalid literal/length code",d.mode=30);break a}break}while(g<m&&l<u);F=z>>3;g-=F;z-=F<<3;a.next_in=g;a.next_out=l;a.avail_in=g<m?5+(m-g):5-(g-m);a.avail_out=l<u?257+(u-l):257-(l-u);d.hold=D&(1<<z)-1;d.bits=z}},{}],38:[function(a,c,d){function e(a){return(a>>>24&255)+(a>>>8&65280)+((a&65280)<<8)+((a&255)<<
  24)}function f(){this.mode=0;this.last=!1;this.wrap=0;this.havedict=!1;this.total=this.check=this.dmax=this.flags=0;this.head=null;this.wnext=this.whave=this.wsize=this.wbits=0;this.window=null;this.extra=this.offset=this.length=this.bits=this.hold=0;this.distcode=this.lencode=null;this.have=this.ndist=this.nlen=this.ncode=this.distbits=this.lenbits=0;this.next=null;this.lens=new q.Buf16(320);this.work=new q.Buf16(288);this.distdyn=this.lendyn=null;this.was=this.back=this.sane=0}function h(a){var c;
  if(!a||!a.state)return-2;c=a.state;a.total_in=a.total_out=c.total=0;a.msg="";c.wrap&&(a.adler=c.wrap&1);c.mode=1;c.last=0;c.havedict=0;c.dmax=32768;c.head=null;c.hold=0;c.bits=0;c.lencode=c.lendyn=new q.Buf32(852);c.distcode=c.distdyn=new q.Buf32(592);c.sane=1;c.back=-1;return 0}function g(a){var c;if(!a||!a.state)return-2;c=a.state;c.wsize=0;c.whave=0;c.wnext=0;return h(a)}function m(a,c){var d,e;if(!a||!a.state)return-2;e=a.state;0>c?(d=0,c=-c):(d=(c>>4)+1,48>c&&(c&=15));if(c&&(8>c||15<c))return-2;
  null!==e.window&&e.wbits!==c&&(e.window=null);e.wrap=d;e.wbits=c;return g(a)}function l(a,c){var d;if(!a)return-2;d=new f;a.state=d;d.window=null;d=m(a,c);0!==d&&(a.state=null);return d}var q=a("../utils/common"),u=a("./adler32"),w=a("./crc32"),C=a("./inffast"),B=a("./inftrees"),A=!0,E,D;d.inflateReset=g;d.inflateReset2=m;d.inflateResetKeep=h;d.inflateInit=function(a){return l(a,15)};d.inflateInit2=l;d.inflate=function(a,c){var d,f,h,g,m,l,t,k,p,J,I,v,y,O,H=0,S,T,P,Q=new q.Buf8(4),U=[16,17,18,0,8,
  7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!a||!a.state||!a.output||!a.input&&0!==a.avail_in)return-2;d=a.state;12===d.mode&&(d.mode=13);m=a.next_out;h=a.output;t=a.avail_out;g=a.next_in;f=a.input;l=a.avail_in;k=d.hold;p=d.bits;J=l;I=t;P=0;a:for(;;)switch(d.mode){case 1:if(0===d.wrap){d.mode=13;break}for(;16>p;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}if(d.wrap&2&&35615===k){d.check=0;Q[0]=k&255;Q[1]=k>>>8&255;d.check=w(d.check,Q,2,0);p=k=0;d.mode=2;break}d.flags=0;d.head&&(d.head.done=!1);if(!(d.wrap&
  1)||(((k&255)<<8)+(k>>8))%31){a.msg="incorrect header check";d.mode=30;break}if(8!==(k&15)){a.msg="unknown compression method";d.mode=30;break}k>>>=4;p-=4;y=(k&15)+8;if(0===d.wbits)d.wbits=y;else if(y>d.wbits){a.msg="invalid window size";d.mode=30;break}d.dmax=1<<y;a.adler=d.check=1;d.mode=k&512?10:12;p=k=0;break;case 2:for(;16>p;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}d.flags=k;if(8!==(d.flags&255)){a.msg="unknown compression method";d.mode=30;break}if(d.flags&57344){a.msg="unknown header flags set";
  d.mode=30;break}d.head&&(d.head.text=k>>8&1);d.flags&512&&(Q[0]=k&255,Q[1]=k>>>8&255,d.check=w(d.check,Q,2,0));p=k=0;d.mode=3;case 3:for(;32>p;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}d.head&&(d.head.time=k);d.flags&512&&(Q[0]=k&255,Q[1]=k>>>8&255,Q[2]=k>>>16&255,Q[3]=k>>>24&255,d.check=w(d.check,Q,4,0));p=k=0;d.mode=4;case 4:for(;16>p;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}d.head&&(d.head.xflags=k&255,d.head.os=k>>8);d.flags&512&&(Q[0]=k&255,Q[1]=k>>>8&255,d.check=w(d.check,Q,2,0));p=k=0;d.mode=
  5;case 5:if(d.flags&1024){for(;16>p;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}d.length=k;d.head&&(d.head.extra_len=k);d.flags&512&&(Q[0]=k&255,Q[1]=k>>>8&255,d.check=w(d.check,Q,2,0));p=k=0}else d.head&&(d.head.extra=null);d.mode=6;case 6:if(d.flags&1024&&(v=d.length,v>l&&(v=l),v&&(d.head&&(y=d.head.extra_len-d.length,d.head.extra||(d.head.extra=Array(d.head.extra_len)),q.arraySet(d.head.extra,f,g,v,y)),d.flags&512&&(d.check=w(d.check,f,v,g)),l-=v,g+=v,d.length-=v),d.length))break a;d.length=0;d.mode=
  7;case 7:if(d.flags&2048){if(0===l)break a;v=0;do y=f[g+v++],d.head&&y&&65536>d.length&&(d.head.name+=String.fromCharCode(y));while(y&&v<l);d.flags&512&&(d.check=w(d.check,f,v,g));l-=v;g+=v;if(y)break a}else d.head&&(d.head.name=null);d.length=0;d.mode=8;case 8:if(d.flags&4096){if(0===l)break a;v=0;do y=f[g+v++],d.head&&y&&65536>d.length&&(d.head.comment+=String.fromCharCode(y));while(y&&v<l);d.flags&512&&(d.check=w(d.check,f,v,g));l-=v;g+=v;if(y)break a}else d.head&&(d.head.comment=null);d.mode=
  9;case 9:if(d.flags&512){for(;16>p;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}if(k!==(d.check&65535)){a.msg="header crc mismatch";d.mode=30;break}p=k=0}d.head&&(d.head.hcrc=d.flags>>9&1,d.head.done=!0);a.adler=d.check=0;d.mode=12;break;case 10:for(;32>p;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}a.adler=d.check=e(k);p=k=0;d.mode=11;case 11:if(0===d.havedict)return a.next_out=m,a.avail_out=t,a.next_in=g,a.avail_in=l,d.hold=k,d.bits=p,2;a.adler=d.check=1;d.mode=12;case 12:if(5===c||6===c)break a;case 13:if(d.last){k>>>=
  p&7;p-=p&7;d.mode=27;break}for(;3>p;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}d.last=k&1;k>>>=1;--p;switch(k&3){case 0:d.mode=14;break;case 1:v=d;if(A){y=void 0;E=new q.Buf32(512);D=new q.Buf32(32);for(y=0;144>y;)v.lens[y++]=8;for(;256>y;)v.lens[y++]=9;for(;280>y;)v.lens[y++]=7;for(;288>y;)v.lens[y++]=8;B(1,v.lens,0,288,E,0,v.work,{bits:9});for(y=0;32>y;)v.lens[y++]=5;B(2,v.lens,0,32,D,0,v.work,{bits:5});A=!1}v.lencode=E;v.lenbits=9;v.distcode=D;v.distbits=5;d.mode=20;if(6===c){k>>>=2;p-=2;break a}break;
  case 2:d.mode=17;break;case 3:a.msg="invalid block type",d.mode=30}k>>>=2;p-=2;break;case 14:k>>>=p&7;for(p-=p&7;32>p;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}if((k&65535)!==(k>>>16^65535)){a.msg="invalid stored block lengths";d.mode=30;break}d.length=k&65535;p=k=0;d.mode=15;if(6===c)break a;case 15:d.mode=16;case 16:if(v=d.length){v>l&&(v=l);v>t&&(v=t);if(0===v)break a;q.arraySet(h,f,g,v,m);l-=v;g+=v;t-=v;m+=v;d.length-=v;break}d.mode=12;break;case 17:for(;14>p;){if(0===l)break a;l--;k+=f[g++]<<
  p;p+=8}d.nlen=(k&31)+257;k>>>=5;p-=5;d.ndist=(k&31)+1;k>>>=5;p-=5;d.ncode=(k&15)+4;k>>>=4;p-=4;if(286<d.nlen||30<d.ndist){a.msg="too many length or distance symbols";d.mode=30;break}d.have=0;d.mode=18;case 18:for(;d.have<d.ncode;){for(;3>p;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}d.lens[U[d.have++]]=k&7;k>>>=3;p-=3}for(;19>d.have;)d.lens[U[d.have++]]=0;d.lencode=d.lendyn;d.lenbits=7;v={bits:d.lenbits};P=B(0,d.lens,0,19,d.lencode,0,d.work,v);d.lenbits=v.bits;if(P){a.msg="invalid code lengths set";
  d.mode=30;break}d.have=0;d.mode=19;case 19:for(;d.have<d.nlen+d.ndist;){for(;;){H=d.lencode[k&(1<<d.lenbits)-1];v=H>>>24;H&=65535;if(v<=p)break;if(0===l)break a;l--;k+=f[g++]<<p;p+=8}if(16>H)k>>>=v,p-=v,d.lens[d.have++]=H;else{if(16===H){for(y=v+2;p<y;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}k>>>=v;p-=v;if(0===d.have){a.msg="invalid bit length repeat";d.mode=30;break}y=d.lens[d.have-1];v=3+(k&3);k>>>=2;p-=2}else if(17===H){for(y=v+3;p<y;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}k>>>=v;p-=v;y=0;v=3+
  (k&7);k>>>=3;p-=3}else{for(y=v+7;p<y;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}k>>>=v;p-=v;y=0;v=11+(k&127);k>>>=7;p-=7}if(d.have+v>d.nlen+d.ndist){a.msg="invalid bit length repeat";d.mode=30;break}for(;v--;)d.lens[d.have++]=y}}if(30===d.mode)break;if(0===d.lens[256]){a.msg="invalid code -- missing end-of-block";d.mode=30;break}d.lenbits=9;v={bits:d.lenbits};P=B(1,d.lens,0,d.nlen,d.lencode,0,d.work,v);d.lenbits=v.bits;if(P){a.msg="invalid literal/lengths set";d.mode=30;break}d.distbits=6;d.distcode=
  d.distdyn;v={bits:d.distbits};P=B(2,d.lens,d.nlen,d.ndist,d.distcode,0,d.work,v);d.distbits=v.bits;if(P){a.msg="invalid distances set";d.mode=30;break}d.mode=20;if(6===c)break a;case 20:d.mode=21;case 21:if(6<=l&&258<=t){a.next_out=m;a.avail_out=t;a.next_in=g;a.avail_in=l;d.hold=k;d.bits=p;C(a,I);m=a.next_out;h=a.output;t=a.avail_out;g=a.next_in;f=a.input;l=a.avail_in;k=d.hold;p=d.bits;12===d.mode&&(d.back=-1);break}for(d.back=0;;){H=d.lencode[k&(1<<d.lenbits)-1];v=H>>>24;y=H>>>16&255;H&=65535;if(v<=
  p)break;if(0===l)break a;l--;k+=f[g++]<<p;p+=8}if(y&&0===(y&240)){O=v;S=y;for(T=H;;){H=d.lencode[T+((k&(1<<O+S)-1)>>O)];v=H>>>24;y=H>>>16&255;H&=65535;if(O+v<=p)break;if(0===l)break a;l--;k+=f[g++]<<p;p+=8}k>>>=O;p-=O;d.back+=O}k>>>=v;p-=v;d.back+=v;d.length=H;if(0===y){d.mode=26;break}if(y&32){d.back=-1;d.mode=12;break}if(y&64){a.msg="invalid literal/length code";d.mode=30;break}d.extra=y&15;d.mode=22;case 22:if(d.extra){for(y=d.extra;p<y;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}d.length+=k&(1<<
  d.extra)-1;k>>>=d.extra;p-=d.extra;d.back+=d.extra}d.was=d.length;d.mode=23;case 23:for(;;){H=d.distcode[k&(1<<d.distbits)-1];v=H>>>24;y=H>>>16&255;H&=65535;if(v<=p)break;if(0===l)break a;l--;k+=f[g++]<<p;p+=8}if(0===(y&240)){O=v;S=y;for(T=H;;){H=d.distcode[T+((k&(1<<O+S)-1)>>O)];v=H>>>24;y=H>>>16&255;H&=65535;if(O+v<=p)break;if(0===l)break a;l--;k+=f[g++]<<p;p+=8}k>>>=O;p-=O;d.back+=O}k>>>=v;p-=v;d.back+=v;if(y&64){a.msg="invalid distance code";d.mode=30;break}d.offset=H;d.extra=y&15;d.mode=24;case 24:if(d.extra){for(y=
  d.extra;p<y;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}d.offset+=k&(1<<d.extra)-1;k>>>=d.extra;p-=d.extra;d.back+=d.extra}if(d.offset>d.dmax){a.msg="invalid distance too far back";d.mode=30;break}d.mode=25;case 25:if(0===t)break a;v=I-t;if(d.offset>v){v=d.offset-v;if(v>d.whave&&d.sane){a.msg="invalid distance too far back";d.mode=30;break}v>d.wnext?(v-=d.wnext,y=d.wsize-v):y=d.wnext-v;v>d.length&&(v=d.length);O=d.window}else O=h,y=m-d.offset,v=d.length;v>t&&(v=t);t-=v;d.length-=v;do h[m++]=O[y++];while(--v);
  0===d.length&&(d.mode=21);break;case 26:if(0===t)break a;h[m++]=d.length;t--;d.mode=21;break;case 27:if(d.wrap){for(;32>p;){if(0===l)break a;l--;k|=f[g++]<<p;p+=8}I-=t;a.total_out+=I;d.total+=I;I&&(a.adler=d.check=d.flags?w(d.check,h,I,m-I):u(d.check,h,I,m-I));I=t;if((d.flags?k:e(k))!==d.check){a.msg="incorrect data check";d.mode=30;break}p=k=0}d.mode=28;case 28:if(d.wrap&&d.flags){for(;32>p;){if(0===l)break a;l--;k+=f[g++]<<p;p+=8}if(k!==(d.total&4294967295)){a.msg="incorrect length check";d.mode=
  30;break}p=k=0}d.mode=29;case 29:P=1;break a;case 30:P=-3;break a;case 31:return-4;default:return-2}a.next_out=m;a.avail_out=t;a.next_in=g;a.avail_in=l;d.hold=k;d.bits=p;if(d.wsize||I!==a.avail_out&&30>d.mode&&(27>d.mode||4!==c))f=a.output,g=a.next_out,m=I-a.avail_out,t=a.state,null===t.window&&(t.wsize=1<<t.wbits,t.wnext=0,t.whave=0,t.window=new q.Buf8(t.wsize)),m>=t.wsize?(q.arraySet(t.window,f,g-t.wsize,t.wsize,0),t.wnext=0,t.whave=t.wsize):(l=t.wsize-t.wnext,l>m&&(l=m),q.arraySet(t.window,f,g-
  m,l,t.wnext),(m-=l)?(q.arraySet(t.window,f,g-m,m,0),t.wnext=m,t.whave=t.wsize):(t.wnext+=l,t.wnext===t.wsize&&(t.wnext=0),t.whave<t.wsize&&(t.whave+=l)));J-=a.avail_in;I-=a.avail_out;a.total_in+=J;a.total_out+=I;d.total+=I;d.wrap&&I&&(a.adler=d.check=d.flags?w(d.check,h,I,a.next_out-I):u(d.check,h,I,a.next_out-I));a.data_type=d.bits+(d.last?64:0)+(12===d.mode?128:0)+(20===d.mode||15===d.mode?256:0);(0===J&&0===I||4===c)&&0===P&&(P=-5);return P};d.inflateEnd=function(a){if(!a||!a.state)return-2;var c=
  a.state;c.window&&(c.window=null);a.state=null;return 0};d.inflateGetHeader=function(a,c){var d;if(!a||!a.state)return-2;d=a.state;if(0===(d.wrap&2))return-2;d.head=c;c.done=!1;return 0};d.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":30,"./adler32":32,"./crc32":34,"./inffast":37,"./inftrees":39}],39:[function(a,c,d){var e=a("../utils/common"),f=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],h=[16,16,16,16,16,16,16,16,17,17,17,17,
  18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],g=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],m=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];c.exports=function(a,c,d,w,C,B,A,E){for(var D=E.bits,z=0,M=0,r=0,K=0,N=0,G=0,x=0,F=0,t=0,k=0,p,J,I=null,v=0,y,O=new e.Buf16(16),G=new e.Buf16(16),H=null,S=0,T,P,Q,z=0;15>=z;z++)O[z]=0;for(M=0;M<w;M++)O[c[d+M]]++;N=D;for(K=15;1<=
  K&&0===O[K];K--);N>K&&(N=K);if(0===K)return C[B++]=20971520,C[B++]=20971520,E.bits=1,0;for(r=1;r<K&&0===O[r];r++);N<r&&(N=r);for(z=F=1;15>=z;z++)if(F<<=1,F-=O[z],0>F)return-1;if(0<F&&(0===a||1!==K))return-1;G[1]=0;for(z=1;15>z;z++)G[z+1]=G[z]+O[z];for(M=0;M<w;M++)0!==c[d+M]&&(A[G[c[d+M]]++]=M);0===a?(I=H=A,y=19):1===a?(I=f,v-=257,H=h,S-=257,y=256):(I=g,H=m,y=-1);M=k=0;z=r;D=B;G=N;x=0;J=-1;t=1<<N;w=t-1;if(1===a&&852<t||2===a&&592<t)return 1;for(var U=0;;){U++;T=z-x;A[M]<y?(P=0,Q=A[M]):A[M]>y?(P=H[S+
  A[M]],Q=I[v+A[M]]):(P=96,Q=0);F=1<<z-x;r=p=1<<G;do p-=F,C[D+(k>>x)+p]=T<<24|P<<16|Q|0;while(0!==p);for(F=1<<z-1;k&F;)F>>=1;0!==F?(k&=F-1,k+=F):k=0;M++;if(0===--O[z]){if(z===K)break;z=c[d+A[M]]}if(z>N&&(k&w)!==J){0===x&&(x=N);D+=r;G=z-x;for(F=1<<G;G+x<K;){F-=O[G+x];if(0>=F)break;G++;F<<=1}t+=1<<G;if(1===a&&852<t||2===a&&592<t)return 1;J=k&w;C[J]=N<<24|G<<16|D-B|0}}0!==k&&(C[D+k]=z-x<<24|4194304);E.bits=N;return 0}},{"../utils/common":30}],40:[function(a,c,d){c.exports={2:"need dictionary",1:"stream end",
  0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],41:[function(a,c,d){function e(a){for(var c=a.length;0<=--c;)a[c]=0}function f(a,c,d,e,f){this.static_tree=a;this.extra_bits=c;this.extra_base=d;this.elems=e;this.max_length=f;this.has_stree=a&&a.length}function h(a,c){this.dyn_tree=a;this.max_code=0;this.stat_desc=c}function g(a,c){a.pending_buf[a.pending++]=c&255;a.pending_buf[a.pending++]=c>>>8&255}function m(a,
  c,d){a.bi_valid>16-d?(a.bi_buf|=c<<a.bi_valid&65535,g(a,a.bi_buf),a.bi_buf=c>>16-a.bi_valid,a.bi_valid+=d-16):(a.bi_buf|=c<<a.bi_valid&65535,a.bi_valid+=d)}function l(a,c,d){m(a,d[2*c],d[2*c+1])}function q(a,c){var d=0;do d|=a&1,a>>>=1,d<<=1;while(0<--c);return d>>>1}function u(a,c,d){var e=Array(16),f=0,g;for(g=1;15>=g;g++)e[g]=f=f+d[g-1]<<1;for(d=0;d<=c;d++)f=a[2*d+1],0!==f&&(a[2*d]=q(e[f]++,f))}function w(a){var c;for(c=0;286>c;c++)a.dyn_ltree[2*c]=0;for(c=0;30>c;c++)a.dyn_dtree[2*c]=0;for(c=0;19>
  c;c++)a.bl_tree[2*c]=0;a.dyn_ltree[512]=1;a.opt_len=a.static_len=0;a.last_lit=a.matches=0}function C(a){8<a.bi_valid?g(a,a.bi_buf):0<a.bi_valid&&(a.pending_buf[a.pending++]=a.bi_buf);a.bi_buf=0;a.bi_valid=0}function B(a,c,d,e){var f=2*c,g=2*d;return a[f]<a[g]||a[f]===a[g]&&e[c]<=e[d]}function A(a,c,d){for(var e=a.heap[d],f=d<<1;f<=a.heap_len;){f<a.heap_len&&B(c,a.heap[f+1],a.heap[f],a.depth)&&f++;if(B(c,e,a.heap[f],a.depth))break;a.heap[d]=a.heap[f];d=f;f<<=1}a.heap[d]=e}function E(a,c,d){var e,f,
  g=0,h,k;if(0!==a.last_lit){do e=a.pending_buf[a.d_buf+2*g]<<8|a.pending_buf[a.d_buf+2*g+1],f=a.pending_buf[a.l_buf+g],g++,0===e?l(a,f,c):(h=I[f],l(a,h+256+1,c),k=G[h],0!==k&&(f-=v[h],m(a,f,k)),e--,h=256>e?J[e]:J[256+(e>>>7)],l(a,h,d),k=x[h],0!==k&&(e-=y[h],m(a,e,k)));while(g<a.last_lit)}l(a,256,c)}function D(a,c){var d=c.dyn_tree,e=c.stat_desc.static_tree,f=c.stat_desc.has_stree,g=c.stat_desc.elems,h,l=-1,k;a.heap_len=0;a.heap_max=573;for(h=0;h<g;h++)0!==d[2*h]?(a.heap[++a.heap_len]=l=h,a.depth[h]=
  0):d[2*h+1]=0;for(;2>a.heap_len;)k=a.heap[++a.heap_len]=2>l?++l:0,d[2*k]=1,a.depth[k]=0,a.opt_len--,f&&(a.static_len-=e[2*k+1]);c.max_code=l;for(h=a.heap_len>>1;1<=h;h--)A(a,d,h);k=g;do h=a.heap[1],a.heap[1]=a.heap[a.heap_len--],A(a,d,1),e=a.heap[1],a.heap[--a.heap_max]=h,a.heap[--a.heap_max]=e,d[2*k]=d[2*h]+d[2*e],a.depth[k]=(a.depth[h]>=a.depth[e]?a.depth[h]:a.depth[e])+1,d[2*h+1]=d[2*e+1]=k,a.heap[1]=k++,A(a,d,1);while(2<=a.heap_len);a.heap[--a.heap_max]=a.heap[1];h=c.dyn_tree;k=c.max_code;for(var m=
  c.stat_desc.static_tree,p=c.stat_desc.has_stree,q=c.stat_desc.extra_bits,r=c.stat_desc.extra_base,t=c.stat_desc.max_length,v,w,x=0,g=0;15>=g;g++)a.bl_count[g]=0;h[2*a.heap[a.heap_max]+1]=0;for(e=a.heap_max+1;573>e;e++)f=a.heap[e],g=h[2*h[2*f+1]+1]+1,g>t&&(g=t,x++),h[2*f+1]=g,f>k||(a.bl_count[g]++,v=0,f>=r&&(v=q[f-r]),w=h[2*f],a.opt_len+=w*(g+v),p&&(a.static_len+=w*(m[2*f+1]+v)));if(0!==x){do{for(g=t-1;0===a.bl_count[g];)g--;a.bl_count[g]--;a.bl_count[g+1]+=2;a.bl_count[t]--;x-=2}while(0<x);for(g=
  t;0!==g;g--)for(f=a.bl_count[g];0!==f;)m=a.heap[--e],m>k||(h[2*m+1]!==g&&(a.opt_len+=(g-h[2*m+1])*h[2*m],h[2*m+1]=g),f--)}u(d,l,a.bl_count)}function z(a,c,d){var e,f=-1,g,h=c[1],k=0,l=7,m=4;0===h&&(l=138,m=3);c[2*(d+1)+1]=65535;for(e=0;e<=d;e++)g=h,h=c[2*(e+1)+1],++k<l&&g===h||(k<m?a.bl_tree[2*g]+=k:0!==g?(g!==f&&a.bl_tree[2*g]++,a.bl_tree[32]++):10>=k?a.bl_tree[34]++:a.bl_tree[36]++,k=0,f=g,0===h?(l=138,m=3):g===h?(l=6,m=3):(l=7,m=4))}function M(a,c,d){var e,f=-1,g,h=c[1],k=0,p=7,q=4;0===h&&(p=138,
  q=3);for(e=0;e<=d;e++)if(g=h,h=c[2*(e+1)+1],!(++k<p&&g===h)){if(k<q){do l(a,g,a.bl_tree);while(0!==--k)}else 0!==g?(g!==f&&(l(a,g,a.bl_tree),k--),l(a,16,a.bl_tree),m(a,k-3,2)):10>=k?(l(a,17,a.bl_tree),m(a,k-3,3)):(l(a,18,a.bl_tree),m(a,k-11,7));k=0;f=g;0===h?(p=138,q=3):g===h?(p=6,q=3):(p=7,q=4)}}function r(a){var c=4093624447,d;for(d=0;31>=d;d++,c>>>=1)if(c&1&&0!==a.dyn_ltree[2*d])return 0;if(0!==a.dyn_ltree[18]||0!==a.dyn_ltree[20]||0!==a.dyn_ltree[26])return 1;for(d=32;256>d;d++)if(0!==a.dyn_ltree[2*
  d])return 1;return 0}function K(a,c,d,e){m(a,0+(e?1:0),3);C(a);g(a,d);g(a,~d);N.arraySet(a.pending_buf,a.window,c,d,a.pending);a.pending+=d}var N=a("../utils/common"),G=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],x=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],F=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],t=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],k=Array(576);e(k);var p=Array(60);e(p);var J=Array(512);e(J);var I=Array(256);e(I);var v=Array(29);e(v);var y=
  Array(30);e(y);var O,H,S,T=!1;d._tr_init=function(a){if(!T){var c,d,e,g=Array(16);for(e=d=0;28>e;e++)for(v[e]=d,c=0;c<1<<G[e];c++)I[d++]=e;I[d-1]=e;for(e=d=0;16>e;e++)for(y[e]=d,c=0;c<1<<x[e];c++)J[d++]=e;for(d>>=7;30>e;e++)for(y[e]=d<<7,c=0;c<1<<x[e]-7;c++)J[256+d++]=e;for(c=0;15>=c;c++)g[c]=0;for(c=0;143>=c;)k[2*c+1]=8,c++,g[8]++;for(;255>=c;)k[2*c+1]=9,c++,g[9]++;for(;279>=c;)k[2*c+1]=7,c++,g[7]++;for(;287>=c;)k[2*c+1]=8,c++,g[8]++;u(k,287,g);for(c=0;30>c;c++)p[2*c+1]=5,p[2*c]=q(c,5);O=new f(k,
  G,257,286,15);H=new f(p,x,0,30,15);S=new f([],F,0,19,7);T=!0}a.l_desc=new h(a.dyn_ltree,O);a.d_desc=new h(a.dyn_dtree,H);a.bl_desc=new h(a.bl_tree,S);a.bi_buf=0;a.bi_valid=0;w(a)};d._tr_stored_block=K;d._tr_flush_block=function(a,c,d,e){var f,g,h=0;if(0<a.level){2===a.strm.data_type&&(a.strm.data_type=r(a));D(a,a.l_desc);D(a,a.d_desc);z(a,a.dyn_ltree,a.l_desc.max_code);z(a,a.dyn_dtree,a.d_desc.max_code);D(a,a.bl_desc);for(h=18;3<=h&&0===a.bl_tree[2*t[h]+1];h--);a.opt_len+=3*(h+1)+14;f=a.opt_len+3+
  7>>>3;g=a.static_len+3+7>>>3;g<=f&&(f=g)}else f=g=d+5;if(d+4<=f&&-1!==c)K(a,c,d,e);else if(4===a.strategy||g===f)m(a,2+(e?1:0),3),E(a,k,p);else{m(a,4+(e?1:0),3);c=a.l_desc.max_code+1;d=a.d_desc.max_code+1;h+=1;m(a,c-257,5);m(a,d-1,5);m(a,h-4,4);for(f=0;f<h;f++)m(a,a.bl_tree[2*t[f]+1],3);M(a,a.dyn_ltree,c-1);M(a,a.dyn_dtree,d-1);E(a,a.dyn_ltree,a.dyn_dtree)}w(a);e&&C(a)};d._tr_tally=function(a,c,d){a.pending_buf[a.d_buf+2*a.last_lit]=c>>>8&255;a.pending_buf[a.d_buf+2*a.last_lit+1]=c&255;a.pending_buf[a.l_buf+
  a.last_lit]=d&255;a.last_lit++;0===c?a.dyn_ltree[2*d]++:(a.matches++,c--,a.dyn_ltree[2*(I[d]+256+1)]++,a.dyn_dtree[2*(256>c?J[c]:J[256+(c>>>7)])]++);return a.last_lit===a.lit_bufsize-1};d._tr_align=function(a){m(a,2,3);l(a,256,k);16===a.bi_valid?(g(a,a.bi_buf),a.bi_buf=0,a.bi_valid=0):8<=a.bi_valid&&(a.pending_buf[a.pending++]=a.bi_buf&255,a.bi_buf>>=8,a.bi_valid-=8)}},{"../utils/common":30}],42:[function(a,c,d){c.exports=function(){this.input=null;this.total_in=this.avail_in=this.next_in=0;this.output=
  null;this.total_out=this.avail_out=this.next_out=0;this.msg="";this.state=null;this.data_type=2;this.adler=0}},{}],43:[function(a,c,d){(function(c){(function(d){function h(a,c){if(!(this instanceof h))return new h(a,c);for(var e=0,g=G.length;e<g;e++)this[G[e]]="";this.q=this.c="";this.bufferCheckPosition=d.MAX_BUFFER_LENGTH;this.opt=c||{};this.opt.lowercase=this.opt.lowercase||this.opt.lowercasetags;this.looseCase=this.opt.lowercase?"toLowerCase":"toUpperCase";this.tags=[];this.closed=this.closedRoot=
  this.sawRoot=!1;this.tag=this.error=null;this.strict=!!a;this.noscript=!(!a&&!this.opt.noscript);this.state=L.BEGIN;this.ENTITIES=(this.strictEntities=this.opt.strictEntities)?Object.create(d.XML_ENTITIES):Object.create(d.ENTITIES);this.attribList=[];this.opt.xmlns&&(this.ns=Object.create(T));if(this.trackPosition=!1!==this.opt.position)this.position=this.line=this.column=0;this.onready&&this.onready(void 0)}function g(a,c){if(!(this instanceof g))return new g(a,c);x.apply(this);this._parser=new h(a,
  c);this.readable=this.writable=!0;var d=this;this._parser.onend=function(){d.emit("end")};this._parser.onerror=function(a){d.emit("error",a);d._parser.error=null};this._decoder=null;t.forEach(function(a){Object.defineProperty(d,"on"+a,{get:function(){return d._parser["on"+a]},set:function(c){if(!c)return d.removeAllListeners(a),d._parser["on"+a]=c;d.on(a,c)},enumerable:!0,configurable:!1})})}function m(a){return a.split("").reduce(function(a,c){a[c]=!0;return a},{})}function l(a,c){return"[object RegExp]"===
  Object.prototype.toString.call(a)?!!c.match(a):a[c]}function q(a,c,d){a.textNode&&u(a);a[c]&&a[c](d)}function u(a){a.textNode=w(a.opt,a.textNode);a.textNode&&a.ontext&&a.ontext(a.textNode);a.textNode=""}function w(a,c){a.trim&&(c=c.trim());a.normalize&&(c=c.replace(/\s+/g," "));return c}function C(a,c){u(a);a.trackPosition&&(c+="\nLine: "+a.line+"\nColumn: "+a.column+"\nChar: "+a.c);c=Error(c);a.error=c;a.onerror&&a.onerror(c);return a}function B(a){a.sawRoot&&!a.closedRoot&&A(a,"Unclosed root tag");
  a.state!==L.BEGIN&&a.state!==L.BEGIN_WHITESPACE&&a.state!==L.TEXT&&C(a,"Unexpected end");u(a);a.c="";a.closed=!0;a.onend&&a.onend(void 0);h.call(a,a.strict,a.opt);return a}function A(a,c){if("object"!==typeof a||!(a instanceof h))throw Error("bad call to strictFail");a.strict&&C(a,c)}function E(a,c){var d=0>a.indexOf(":")?["",a]:a.split(":"),e=d[0],d=d[1];c&&"xmlns"===a&&(e="xmlns",d="");return{prefix:e,local:d}}function D(a){a.strict||(a.attribName=a.attribName[a.looseCase]());if(-1===a.attribList.indexOf(a.attribName)&&
  !a.tag.attributes.hasOwnProperty(a.attribName))if(a.opt.xmlns){var c=E(a.attribName,!0),d=c.local;if("xmlns"===c.prefix)if("xml"===d&&a.attribValue!==H)A(a,"xml: prefix must be bound to "+H+"\nActual: "+a.attribValue);else if("xmlns"===d&&a.attribValue!==S)A(a,"xmlns: prefix must be bound to "+S+"\nActual: "+a.attribValue);else{var c=a.tag,e=a.tags[a.tags.length-1]||a;c.ns===e.ns&&(c.ns=Object.create(e.ns));c.ns[d]=a.attribValue}a.attribList.push([a.attribName,a.attribValue])}else a.tag.attributes[a.attribName]=
  a.attribValue,q(a,"onattribute",{name:a.attribName,value:a.attribValue});a.attribName=a.attribValue=""}function z(a,c){if(a.opt.xmlns){var d=a.tag,e=E(a.tagName);d.prefix=e.prefix;d.local=e.local;d.uri=d.ns[e.prefix]||"";d.prefix&&!d.uri&&(A(a,"Unbound namespace prefix: "+JSON.stringify(a.tagName)),d.uri=e.prefix);e=a.tags[a.tags.length-1]||a;d.ns&&e.ns!==d.ns&&Object.keys(d.ns).forEach(function(c){q(a,"onopennamespace",{prefix:c,uri:d.ns[c]})});for(var e=0,f=a.attribList.length;e<f;e++){var g=a.attribList[e],
  h=g[0],k=g[1],l=E(h,!0),g=l.prefix,m=""===g?"":d.ns[g]||"",k={name:h,value:k,prefix:g,local:l.local,uri:m};g&&"xmlns"!==g&&!m&&(A(a,"Unbound namespace prefix: "+JSON.stringify(g)),k.uri=g);a.tag.attributes[h]=k;q(a,"onattribute",k)}a.attribList.length=0}a.tag.isSelfClosing=!!c;a.sawRoot=!0;a.tags.push(a.tag);q(a,"onopentag",a.tag);c||(a.noscript||"script"!==a.tagName.toLowerCase()?a.state=L.TEXT:a.state=L.SCRIPT,a.tag=null,a.tagName="");a.attribName=a.attribValue="";a.attribList.length=0}function M(a){if(a.tagName){if(a.script){if("script"!==
  a.tagName){a.script+="</"+a.tagName+">";a.tagName="";a.state=L.SCRIPT;return}q(a,"onscript",a.script);a.script=""}var c=a.tags.length,d=a.tagName;a.strict||(d=d[a.looseCase]());for(var e=d;c--;)if(a.tags[c].name!==e)A(a,"Unexpected close tag");else break;if(0>c)A(a,"Unmatched closing tag: "+a.tagName),a.textNode+="</"+a.tagName+">";else{a.tagName=d;for(d=a.tags.length;d-- >c;){var f=a.tag=a.tags.pop();a.tagName=a.tag.name;q(a,"onclosetag",a.tagName);for(var g in f.ns);e=a.tags[a.tags.length-1]||a;
  a.opt.xmlns&&f.ns!==e.ns&&Object.keys(f.ns).forEach(function(c){q(a,"onclosenamespace",{prefix:c,uri:f.ns[c]})})}0===c&&(a.closedRoot=!0);a.tagName=a.attribValue=a.attribName="";a.attribList.length=0}}else A(a,"Weird empty close tag."),a.textNode+="</>";a.state=L.TEXT}function r(a){var c=a.entity,d=c.toLowerCase(),e,f="";if(a.ENTITIES[c])return a.ENTITIES[c];if(a.ENTITIES[d])return a.ENTITIES[d];c=d;"#"===c.charAt(0)&&("x"===c.charAt(1)?(c=c.slice(2),e=parseInt(c,16),f=e.toString(16)):(c=c.slice(1),
  e=parseInt(c,10),f=e.toString(10)));c=c.replace(/^0+/,"");return f.toLowerCase()!==c?(A(a,"Invalid character entity"),"&"+a.entity+";"):String.fromCodePoint(e)}function K(a,c){"<"===c?(a.state=L.OPEN_WAKA,a.startTagPosition=a.position):l(k,c)||(A(a,"Non-whitespace before first tag."),a.textNode=c,a.state=L.TEXT)}function N(a,c){var d="";c<a.length&&(d=a.charAt(c));return d}d.parser=function(a,c){return new h(a,c)};d.SAXParser=h;d.SAXStream=g;d.createStream=function(a,c){return new g(a,c)};d.MAX_BUFFER_LENGTH=
  65536;var G="comment sgmlDecl textNode tagName doctype procInstName procInstBody entity attribName attribValue cdata script".split(" ");d.EVENTS="text processinginstruction sgmldeclaration doctype comment attribute opentag closetag opencdata cdata closecdata error end ready script opennamespace closenamespace".split(" ");Object.create||(Object.create=function(a){function c(){}c.prototype=a;return new c});Object.keys||(Object.keys=function(a){var c=[],d;for(d in a)a.hasOwnProperty(d)&&c.push(d);return c});
  h.prototype={end:function(){B(this)},write:function(a){if(this.error)throw this.error;if(this.closed)return C(this,"Cannot write after close. Assign an onready handler.");if(null===a)return B(this);for(var c=0,e="";;){this.c=e=N(a,c++);if(!e)break;this.trackPosition&&(this.position++,"\n"===e?(this.line++,this.column=0):this.column++);switch(this.state){case L.BEGIN:this.state=L.BEGIN_WHITESPACE;if("\ufeff"===e)continue;K(this,e);continue;case L.BEGIN_WHITESPACE:K(this,e);continue;case L.TEXT:if(this.sawRoot&&
  !this.closedRoot){for(var g=c-1;e&&"<"!==e&&"&"!==e;)(e=N(a,c++))&&this.trackPosition&&(this.position++,"\n"===e?(this.line++,this.column=0):this.column++);this.textNode+=a.substring(g,c-1)}"<"!==e||this.sawRoot&&this.closedRoot&&!this.strict?(l(k,e)||this.sawRoot&&!this.closedRoot||A(this,"Text data outside of root node."),"&"===e?this.state=L.TEXT_ENTITY:this.textNode+=e):(this.state=L.OPEN_WAKA,this.startTagPosition=this.position);continue;case L.SCRIPT:"<"===e?this.state=L.SCRIPT_ENDING:this.script+=
  e;continue;case L.SCRIPT_ENDING:"/"===e?this.state=L.CLOSE_TAG:(this.script+="<"+e,this.state=L.SCRIPT);continue;case L.OPEN_WAKA:"!"===e?(this.state=L.SGML_DECL,this.sgmlDecl=""):l(k,e)||(l(P,e)?(this.state=L.OPEN_TAG,this.tagName=e):"/"===e?(this.state=L.CLOSE_TAG,this.tagName=""):"?"===e?(this.state=L.PROC_INST,this.procInstName=this.procInstBody=""):(A(this,"Unencoded <"),this.startTagPosition+1<this.position&&(e=Array(this.position-this.startTagPosition).join(" ")+e),this.textNode+="<"+e,this.state=
  L.TEXT));continue;case L.SGML_DECL:(this.sgmlDecl+e).toUpperCase()===y?(q(this,"onopencdata"),this.state=L.CDATA,this.cdata=this.sgmlDecl=""):"--"===this.sgmlDecl+e?(this.state=L.COMMENT,this.sgmlDecl=this.comment=""):(this.sgmlDecl+e).toUpperCase()===O?(this.state=L.DOCTYPE,(this.doctype||this.sawRoot)&&A(this,"Inappropriately located doctype declaration"),this.sgmlDecl=this.doctype=""):">"===e?(q(this,"onsgmldeclaration",this.sgmlDecl),this.sgmlDecl="",this.state=L.TEXT):(l(I,e)&&(this.state=L.SGML_DECL_QUOTED),
  this.sgmlDecl+=e);continue;case L.SGML_DECL_QUOTED:e===this.q&&(this.state=L.SGML_DECL,this.q="");this.sgmlDecl+=e;continue;case L.DOCTYPE:">"===e?(this.state=L.TEXT,q(this,"ondoctype",this.doctype),this.doctype=!0):(this.doctype+=e,"["===e?this.state=L.DOCTYPE_DTD:l(I,e)&&(this.state=L.DOCTYPE_QUOTED,this.q=e));continue;case L.DOCTYPE_QUOTED:this.doctype+=e;e===this.q&&(this.q="",this.state=L.DOCTYPE);continue;case L.DOCTYPE_DTD:this.doctype+=e;"]"===e?this.state=L.DOCTYPE:l(I,e)&&(this.state=L.DOCTYPE_DTD_QUOTED,
  this.q=e);continue;case L.DOCTYPE_DTD_QUOTED:this.doctype+=e;e===this.q&&(this.state=L.DOCTYPE_DTD,this.q="");continue;case L.COMMENT:"-"===e?this.state=L.COMMENT_ENDING:this.comment+=e;continue;case L.COMMENT_ENDING:"-"===e?(this.state=L.COMMENT_ENDED,(this.comment=w(this.opt,this.comment))&&q(this,"oncomment",this.comment),this.comment=""):(this.comment+="-"+e,this.state=L.COMMENT);continue;case L.COMMENT_ENDED:">"!==e?(A(this,"Malformed comment"),this.comment+="--"+e,this.state=L.COMMENT):this.state=
  L.TEXT;continue;case L.CDATA:"]"===e?this.state=L.CDATA_ENDING:this.cdata+=e;continue;case L.CDATA_ENDING:"]"===e?this.state=L.CDATA_ENDING_2:(this.cdata+="]"+e,this.state=L.CDATA);continue;case L.CDATA_ENDING_2:">"===e?(this.cdata&&q(this,"oncdata",this.cdata),q(this,"onclosecdata"),this.cdata="",this.state=L.TEXT):"]"===e?this.cdata+="]":(this.cdata+="]]"+e,this.state=L.CDATA);continue;case L.PROC_INST:"?"===e?this.state=L.PROC_INST_ENDING:l(k,e)?this.state=L.PROC_INST_BODY:this.procInstName+=e;
  continue;case L.PROC_INST_BODY:if(!this.procInstBody&&l(k,e))continue;else"?"===e?this.state=L.PROC_INST_ENDING:this.procInstBody+=e;continue;case L.PROC_INST_ENDING:">"===e?(q(this,"onprocessinginstruction",{name:this.procInstName,body:this.procInstBody}),this.procInstName=this.procInstBody="",this.state=L.TEXT):(this.procInstBody+="?"+e,this.state=L.PROC_INST_BODY);continue;case L.OPEN_TAG:if(l(Q,e))this.tagName+=e;else{this.strict||(this.tagName=this.tagName[this.looseCase]());var g=this.tags[this.tags.length-
  1]||this,h=this.tag={name:this.tagName,attributes:{}};this.opt.xmlns&&(h.ns=g.ns);this.attribList.length=0;">"===e?z(this):"/"===e?this.state=L.OPEN_TAG_SLASH:(l(k,e)||A(this,"Invalid character in tag name"),this.state=L.ATTRIB)}continue;case L.OPEN_TAG_SLASH:">"===e?(z(this,!0),M(this)):(A(this,"Forward-slash in opening tag not followed by >"),this.state=L.ATTRIB);continue;case L.ATTRIB:if(l(k,e))continue;else">"===e?z(this):"/"===e?this.state=L.OPEN_TAG_SLASH:l(P,e)?(this.attribName=e,this.attribValue=
  "",this.state=L.ATTRIB_NAME):A(this,"Invalid attribute name");continue;case L.ATTRIB_NAME:"="===e?this.state=L.ATTRIB_VALUE:">"===e?(A(this,"Attribute without value"),this.attribValue=this.attribName,D(this),z(this)):l(k,e)?this.state=L.ATTRIB_NAME_SAW_WHITE:l(Q,e)?this.attribName+=e:A(this,"Invalid attribute name");continue;case L.ATTRIB_NAME_SAW_WHITE:if("="===e)this.state=L.ATTRIB_VALUE;else if(l(k,e))continue;else A(this,"Attribute without value"),this.attribValue=this.tag.attributes[this.attribName]=
  "",q(this,"onattribute",{name:this.attribName,value:""}),this.attribName="",">"===e?z(this):l(P,e)?(this.attribName=e,this.state=L.ATTRIB_NAME):(A(this,"Invalid attribute name"),this.state=L.ATTRIB);continue;case L.ATTRIB_VALUE:if(l(k,e))continue;else l(I,e)?(this.q=e,this.state=L.ATTRIB_VALUE_QUOTED):(A(this,"Unquoted attribute value"),this.state=L.ATTRIB_VALUE_UNQUOTED,this.attribValue=e);continue;case L.ATTRIB_VALUE_QUOTED:if(e!==this.q){"&"===e?this.state=L.ATTRIB_VALUE_ENTITY_Q:this.attribValue+=
  e;continue}D(this);this.q="";this.state=L.ATTRIB_VALUE_CLOSED;continue;case L.ATTRIB_VALUE_CLOSED:l(k,e)?this.state=L.ATTRIB:">"===e?z(this):"/"===e?this.state=L.OPEN_TAG_SLASH:l(P,e)?(A(this,"No whitespace between attributes"),this.attribName=e,this.attribValue="",this.state=L.ATTRIB_NAME):A(this,"Invalid attribute name");continue;case L.ATTRIB_VALUE_UNQUOTED:if(!l(v,e)){"&"===e?this.state=L.ATTRIB_VALUE_ENTITY_U:this.attribValue+=e;continue}D(this);">"===e?z(this):this.state=L.ATTRIB;continue;case L.CLOSE_TAG:if(this.tagName)">"===
  e?M(this):l(Q,e)?this.tagName+=e:this.script?(this.script+="</"+this.tagName,this.tagName="",this.state=L.SCRIPT):(l(k,e)||A(this,"Invalid tagname in closing tag"),this.state=L.CLOSE_TAG_SAW_WHITE);else if(l(k,e))continue;else l(P,e)?this.tagName=e:this.script?(this.script+="</"+e,this.state=L.SCRIPT):A(this,"Invalid tagname in closing tag.");continue;case L.CLOSE_TAG_SAW_WHITE:if(l(k,e))continue;">"===e?M(this):A(this,"Invalid characters in closing tag");continue;case L.TEXT_ENTITY:case L.ATTRIB_VALUE_ENTITY_Q:case L.ATTRIB_VALUE_ENTITY_U:var m,
  p;switch(this.state){case L.TEXT_ENTITY:m=L.TEXT;p="textNode";break;case L.ATTRIB_VALUE_ENTITY_Q:m=L.ATTRIB_VALUE_QUOTED;p="attribValue";break;case L.ATTRIB_VALUE_ENTITY_U:m=L.ATTRIB_VALUE_UNQUOTED,p="attribValue"}";"===e?(this[p]+=r(this),this.entity="",this.state=m):l(this.entity.length?ga:U,e)?this.entity+=e:(A(this,"Invalid character in entity name"),this[p]+="&"+this.entity+e,this.entity="",this.state=m);continue;default:throw Error(this,"Unknown state: "+this.state);}}if(this.position>=this.bufferCheckPosition){a=
  Math.max(d.MAX_BUFFER_LENGTH,10);e=c=0;for(m=G.length;e<m;e++){p=this[G[e]].length;if(p>a)switch(G[e]){case "textNode":u(this);break;case "cdata":q(this,"oncdata",this.cdata);this.cdata="";break;case "script":q(this,"onscript",this.script);this.script="";break;default:C(this,"Max buffer length exceeded: "+G[e])}c=Math.max(c,p)}this.bufferCheckPosition=d.MAX_BUFFER_LENGTH-c+this.position}return this},resume:function(){this.error=null;return this},close:function(){return this.write(null)},flush:function(){u(this);
  ""!==this.cdata&&(q(this,"oncdata",this.cdata),this.cdata="");""!==this.script&&(q(this,"onscript",this.script),this.script="")}};var x;try{x=a("stream").Stream}catch(F){x=function(){}}var t=d.EVENTS.filter(function(a){return"error"!==a&&"end"!==a});g.prototype=Object.create(x.prototype,{constructor:{value:g}});g.prototype.write=function(d){"function"===typeof c&&"function"===typeof c.isBuffer&&c.isBuffer(d)&&(this._decoder||(this._decoder=new (a("string_decoder").StringDecoder)("utf8")),d=this._decoder.write(d));
  this._parser.write(d.toString());this.emit("data",d);return!0};g.prototype.end=function(a){a&&a.length&&this.write(a);this._parser.end();return!0};g.prototype.on=function(a,c){var d=this;d._parser["on"+a]||-1===t.indexOf(a)||(d._parser["on"+a]=function(){var c=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);c.splice(0,0,a);d.emit.apply(d,c)});return x.prototype.on.call(d,a,c)};var k="\r\n\t ",p="0124356789",J="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",I="'\"",v=k+">",y=
  "[CDATA[",O="DOCTYPE",H="http://www.w3.org/XML/1998/namespace",S="http://www.w3.org/2000/xmlns/",T={xml:H,xmlns:S},k=m(k),p=m(p),J=m(J),P=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,Q=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040\.\d-]/,U=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,
  ga=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040\.\d-]/,I=m(I),v=m(v),L=0;d.STATE={BEGIN:L++,BEGIN_WHITESPACE:L++,TEXT:L++,TEXT_ENTITY:L++,OPEN_WAKA:L++,SGML_DECL:L++,SGML_DECL_QUOTED:L++,DOCTYPE:L++,DOCTYPE_QUOTED:L++,DOCTYPE_DTD:L++,DOCTYPE_DTD_QUOTED:L++,COMMENT_STARTING:L++,COMMENT:L++,COMMENT_ENDING:L++,COMMENT_ENDED:L++,CDATA:L++,CDATA_ENDING:L++,CDATA_ENDING_2:L++,
  PROC_INST:L++,PROC_INST_BODY:L++,PROC_INST_ENDING:L++,OPEN_TAG:L++,OPEN_TAG_SLASH:L++,ATTRIB:L++,ATTRIB_NAME:L++,ATTRIB_NAME_SAW_WHITE:L++,ATTRIB_VALUE:L++,ATTRIB_VALUE_QUOTED:L++,ATTRIB_VALUE_CLOSED:L++,ATTRIB_VALUE_UNQUOTED:L++,ATTRIB_VALUE_ENTITY_Q:L++,ATTRIB_VALUE_ENTITY_U:L++,CLOSE_TAG:L++,CLOSE_TAG_SAW_WHITE:L++,SCRIPT:L++,SCRIPT_ENDING:L++};d.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"};d.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,
  Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,
  ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,
  Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,
  zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,
  ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,"int":8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830};Object.keys(d.ENTITIES).forEach(function(a){var c=d.ENTITIES[a],c="number"===
  typeof c?String.fromCharCode(c):c;d.ENTITIES[a]=c});for(var V in d.STATE)d.STATE[d.STATE[V]]=V;L=d.STATE;String.fromCodePoint||function(){var a=String.fromCharCode,c=Math.floor,d=function(){var d=[],e,f,g=-1,h=arguments.length;if(!h)return"";for(var k="";++g<h;){f=Number(arguments[g]);if(!isFinite(f)||0>f||1114111<f||c(f)!==f)throw RangeError("Invalid code point: "+f);65535>=f?d.push(f):(f-=65536,e=(f>>10)+55296,f=f%1024+56320,d.push(e,f));if(g+1===h||16384<d.length)k+=a.apply(null,d),d.length=0}return k};
  Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:d,configurable:!0,writable:!0}):String.fromCodePoint=d}()})("undefined"===typeof d?this.sax={}:d)}).call(this,a("buffer").Buffer)},{buffer:3,stream:25,string_decoder:26}],44:[function(a,c,d){var e=e||{};e.Transform=e.Transform||("undefined"!==typeof a?a("./transform.js"):null);var f=f||("undefined"!==typeof a?a("../lib/base64-binary.js"):null),h=h||("undefined"!==typeof a?a("pako"):null);e.NIFTI_INTENT_GENMATRIX="NIFTI_INTENT_GENMATRIX";
  e.NIFTI_INTENT_LABEL="NIFTI_INTENT_LABEL";e.NIFTI_INTENT_NODE_INDEX="NIFTI_INTENT_NODE_INDEX";e.NIFTI_INTENT_POINTSET="NIFTI_INTENT_POINTSET";e.NIFTI_INTENT_RGB_VECTOR="NIFTI_INTENT_RGB_VECTOR";e.NIFTI_INTENT_RGBA_VECTOR="NIFTI_INTENT_RGBA_VECTOR";e.NIFTI_INTENT_SHAPE="NIFTI_INTENT_SHAPE";e.NIFTI_INTENT_TIME_SERIES="NIFTI_INTENT_TIME_SERIES";e.NIFTI_INTENT_TRIANGLE="NIFTI_INTENT_TRIANGLE";e.NIFTI_INTENT_NONE="NIFTI_INTENT_NONE";e.NIFTI_INTENT_VECTOR="NIFTI_INTENT_VECTOR";e.ATT_ARRAYINDEXINGORDER=
  "ArrayIndexingOrder";e.ATT_DATATYPE="DataType";e.ATT_DIMENSIONALITY="Dimensionality";e.ATT_DIMN="Dim";e.ATT_ENCODING="Encoding";e.ATT_ENDIAN="Endian";e.ATT_EXTERNALFILENAME="ExternalFileName";e.ATT_EXTERNALFILEOFFSET="ExternalFileOffset";e.ATT_INTENT="Intent";e.ENCODING_ASCII="ASCII";e.ENCODING_BASE64BINARY="Base64Binary";e.ENCODING_GZIPBASE64BINARY="GZipBase64Binary";e.ENCODING_EXTERNALFILEBINARY="ExternalFileBinary";e.TYPE_NIFTI_TYPE_UINT8="NIFTI_TYPE_UINT8";e.TYPE_NIFTI_TYPE_INT32="NIFTI_TYPE_INT32";
  e.TYPE_NIFTI_TYPE_FLOAT32="NIFTI_TYPE_FLOAT32";e.DataArray=e.DataArray||function(){this.attributes=null;this.metadata={};this.transforms=[];this.data=null;this.dataConverted=!1};e.DataArray.prototype.isPointSet=function(){return this.attributes[e.ATT_INTENT]===e.NIFTI_INTENT_POINTSET};e.DataArray.prototype.isTriangles=function(){return this.attributes[e.ATT_INTENT]===e.NIFTI_INTENT_TRIANGLE};e.DataArray.prototype.isNormals=function(){return this.attributes[e.ATT_INTENT]===e.NIFTI_INTENT_VECTOR};e.DataArray.prototype.isColors=
  function(){return this.attributes[e.ATT_INTENT]===e.NIFTI_INTENT_RGB_VECTOR||this.attributes[e.ATT_INTENT]===e.NIFTI_INTENT_RGBA_VECTOR};e.DataArray.prototype.getDimensions=function(){return parseInt(this.attributes[e.ATT_DIMENSIONALITY])};e.DataArray.prototype.getNumElements=function(a){void 0===a&&(a=0);return parseInt(this.attributes[e.ATT_DIMN+a])};e.DataArray.prototype.isScalar=function(){return 1==this.getDimensions()};e.DataArray.prototype.isTriple=function(){return 2==this.getDimensions()&&
  3==this.getNumElements(1)};e.DataArray.prototype.isQuad=function(){return 2==this.getDimensions()&&4==this.getNumElements(1)};e.DataArray.prototype.isAscii=function(){return e.ENCODING_ASCII===this.attributes[e.ATT_ENCODING]};e.DataArray.prototype.isBase64Binary=function(){return e.ENCODING_BASE64BINARY===this.attributes[e.ATT_ENCODING]};e.DataArray.prototype.isGzipBase64Binary=function(){return e.ENCODING_GZIPBASE64BINARY===this.attributes[e.ATT_ENCODING]};e.DataArray.prototype.isBase64Encoded=function(){return this.isBase64Binary()||
  this.isGzipBase64Binary()};e.DataArray.prototype.isFloat32=function(){return e.TYPE_NIFTI_TYPE_FLOAT32===this.attributes[e.ATT_DATATYPE]};e.DataArray.prototype.isInt32=function(){return e.TYPE_NIFTI_TYPE_INT32===this.attributes[e.ATT_DATATYPE]};e.DataArray.prototype.isUnsignedInt8=function(){return e.TYPE_NIFTI_TYPE_UINT8===this.attributes[e.ATT_DATATYPE]};e.DataArray.prototype.getData=function(){this.dataConverted||(this.dataConverted=!0,this.isAscii()?this.isUnsignedInt8()?e.DataArray.readUnsignedInt8ASCII(this):
  this.isInt32()?e.DataArray.readSignedInt32ASCII(this):e.DataArray.readFloat32ASCII(this):this.isBase64Binary()?this.isUnsignedInt8()?e.DataArray.readUnsignedInt8Base64(this):this.isInt32()?e.DataArray.readSignedInt32Base64(this):e.DataArray.readFloat32Base64(this):this.isGzipBase64Binary()&&(this.isUnsignedInt8()?e.DataArray.readUnsignedInt8GZIPBase64(this):this.isInt32()?e.DataArray.readSignedInt32GZIPBase64(this):e.DataArray.readFloat32GZIPBase64(this)));return this.data};e.DataArray.prototype.getDataAsync=
  function(a,c){this.dataConverted||(this.dataConverted=!0,this.isAscii()?(this.isUnsignedInt8()?e.DataArray.readUnsignedInt8ASCII(this):this.isInt32()?e.DataArray.readSignedInt32ASCII(this):e.DataArray.readFloat32ASCII(this),c()):this.isBase64Binary()?(this.isUnsignedInt8()?e.DataArray.readUnsignedInt8Base64(this):this.isInt32()?e.DataArray.readSignedInt32Base64(this):e.DataArray.readFloat32Base64(this),c()):this.isGzipBase64Binary()&&(this.isUnsignedInt8()?e.DataArray.readUnsignedInt8GZIPBase64Async(this,
  a,c):this.isInt32()?e.DataArray.readSignedInt32GZIPBase64Async(this,a,c):e.DataArray.readFloat32GZIPBase64Async(this,a,c)))};e.DataArray.readFloat32ASCII=function(a){a.data=new Float32Array(a.data.match(/[+-]?\d+(\.\d+)?/g).map(function(a){return parseFloat(a)}))};e.DataArray.readSignedInt32ASCII=function(a){a.data=new Int32Array(a.data.match(/[+-]?\d+(\.\d+)?/g).map(function(a){return parseInt(a)}))};e.DataArray.readUnsignedInt8ASCII=function(a){a.data=new Uint8Array(a.data.match(/[+-]?\d+(\.\d+)?/g).map(function(a){return parseInt(a)}))};
  e.DataArray.readUnsignedInt8Base64=function(a){var c=f.decodeArrayBuffer(a.data);a.data=new Uint8Array(c,0,c.byteLength)};e.DataArray.readSignedInt32Base64=function(a){var c=f.decodeArrayBuffer(a.data);a.data=new Int32Array(c,0,c.byteLength/4)};e.DataArray.readFloat32Base64=function(a){var c=f.decodeArrayBuffer(a.data);a.data=new Float32Array(c,0,c.byteLength/4)};e.DataArray.readUnsignedInt8GZIPBase64=function(a){var c=f.decodeArrayBuffer(a.data),c=h.inflate(c).buffer;a.data=new Uint8Array(c,0,c.byteLength)};
  e.DataArray.readUnsignedInt8GZIPBase64Async=function(a,c,d){var q=f.decodeArrayBuffer(a.data),u=new h.Inflate,w=function(){a.data=new Uint8Array(u.result.buffer,0,u.result.buffer.byteLength);d(a.data)};setTimeout(function(){e.DataArray.readNext(u,q,0,c,w)},0)};e.DataArray.readSignedInt32GZIPBase64=function(a){var c=f.decodeArrayBuffer(a.data),c=h.inflate(c).buffer;a.data=new Int32Array(c,0,c.byteLength/4)};e.DataArray.readSignedInt32GZIPBase64Async=function(a,c,d){var q=f.decodeArrayBuffer(a.data),
  u=new h.Inflate,w=function(){a.data=new Int32Array(u.result.buffer,0,u.result.buffer.byteLength/4);d(a.data)};setTimeout(function(){e.DataArray.readNext(u,q,0,c,w)},0)};e.DataArray.readFloat32GZIPBase64=function(a){var c=f.decodeArrayBuffer(a.data),c=h.inflate(c).buffer;a.data=new Float32Array(c,0,c.byteLength/4)};e.DataArray.readFloat32GZIPBase64Async=function(a,c,d){var q=f.decodeArrayBuffer(a.data),u=new h.Inflate,w=function(){a.data=new Float32Array(u.result.buffer,0,u.result.buffer.byteLength/
  4);d(a.data)};setTimeout(function(){e.DataArray.readNext(u,q,0,c,w)},0)};e.DataArray.readNext=function(a,c,d,f,h){var w=d+32768,C=w>=c.byteLength;a.push(c.slice(d,d+32768),C);C?h():(f(w/c.byteLength),setTimeout(function(){e.DataArray.readNext(a,c,w,f,h)},0))};"undefined"!==typeof c&&c.exports&&(c.exports=e.DataArray)},{"../lib/base64-binary.js":1,"./transform.js":46,pako:27}],45:[function(a,c,d){var e=e||{};e.Utils=e.Utils||("undefined"!==typeof a?a("./utilities.js"):null);e.DataArray=e.DataArray||
  ("undefined"!==typeof a?a("./dataArray.js"):null);e.Transform=e.Transform||("undefined"!==typeof a?a("./transform.js"):null);var f=f||("undefined"!==typeof a?a("sax"):null);e.TAG_TRANSFORM="CoordinateSystemTransformMatrix";e.TAG_DATA="Data";e.TAG_DATAARRAY="DataArray";e.TAG_DATASPACE="DataSpace";e.TAG_GIFTI="GIFTI";e.TAG_LABEL="Label";e.TAG_LABELTABLE="LabelTable";e.TAG_MATRIXDATA="MatrixData";e.TAG_METADATA="MetaData";e.TAG_MD="MD";e.TAG_NAME="Name";e.TAG_TRANSFORMEDSPACE="TransformedSpace";e.TAG_VALUE=
  "Value";e.GIFTI=e.GIFTI||function(){this.attributes=null;this.metadata={};this.dataArrays=[]};e.GIFTI.prototype.getPointsDataArray=function(){var a;for(a=0;a<this.dataArrays.length;a+=1)if(this.dataArrays[a].isPointSet())return this.dataArrays[a];return null};e.GIFTI.prototype.getTrianglesDataArray=function(){var a;for(a=0;a<this.dataArrays.length;a+=1)if(this.dataArrays[a].isTriangles())return this.dataArrays[a];return null};e.GIFTI.prototype.getNormalsDataArray=function(){var a;for(a=0;a<this.dataArrays.length;a+=
  1)if(this.dataArrays[a].isNormals())return this.dataArrays[a];return null};e.GIFTI.prototype.getColorsDataArray=function(){var a;for(a=0;a<this.dataArrays.length;a+=1)if(this.dataArrays[a].isColors())return this.dataArrays[a];return null};e.GIFTI.prototype.getNumPoints=function(){var a;for(a=0;a<this.dataArrays.length;a+=1)if(this.dataArrays[a].isPointSet())return this.dataArrays[a].getNumElements();return 0};e.GIFTI.prototype.getNumTriangles=function(){var a;for(a=0;a<this.dataArrays.length;a+=1)if(this.dataArrays[a].isTriangles())return this.dataArrays[a].getNumElements();
  return 0};e.isThisFormat=function(a){return-1!==a.indexOf(".gii")};e.parse=function(a){var c=f.parser(!0),d=null,l=null,q=null,u=null,w=null,C=null,B="",A=!1,E=!1,D=!1,z=!1,M=!1,r=!1;c.onopentag=function(a){a.name===e.TAG_GIFTI?(q=d=new e.GIFTI,d.attributes=a.attributes):a.name!==e.TAG_METADATA&&a.name!==e.TAG_MD&&(a.name===e.TAG_NAME?A=!0:a.name===e.TAG_VALUE?E=!0:a.name===e.TAG_DATAARRAY?(q=l=new e.DataArray,d.dataArrays.push(l),l.attributes=a.attributes):a.name===e.TAG_TRANSFORM?(C=new e.Transform,
  l.transforms.push(C)):a.name===e.TAG_DATASPACE?D=!0:a.name===e.TAG_TRANSFORMEDSPACE?z=!0:a.name===e.TAG_MATRIXDATA?M=!0:a.name===e.TAG_DATA&&(r=!0))};c.ontext=c.oncdata=function(a){A?B+=a:E?B+=a:D?B+=a:z?B+=a:M?B+=a:r&&(B+=a)};c.onclosetag=function(a){a!==e.TAG_GIFTI&&a!==e.TAG_METADATA&&(a===e.TAG_MD?q&&(q.metadata[u]=w):a===e.TAG_NAME?(A=!1,u=B,B=""):a===e.TAG_VALUE?(E=!1,w=B,B=""):a!==e.TAG_DATAARRAY&&a!==e.TAG_TRANSFORM&&(a===e.TAG_DATASPACE?(D=!1,C.dataSpace=B,B=""):a===e.TAG_TRANSFORMEDSPACE?
  (z=!1,C.transformedSpace=B,B=""):a===e.TAG_MATRIXDATA?(M=!1,C.matrixData=B,B=""):a===e.TAG_DATA&&(r=!1,l.data=B,B="")))};c.onerror=function(a){console.log(a)};c.write(a).close();return d};"undefined"!==typeof c&&c.exports&&(c.exports=e)},{"./dataArray.js":44,"./transform.js":46,"./utilities.js":47,sax:43}],46:[function(a,c,d){var e=e||{};e.Transform=e.Transform||function(){this.matrixData=this.transformedSpace=this.dataSpace=null};"undefined"!==typeof c&&c.exports&&(c.exports=e.Transform)},{}],47:[function(a,
  c,d){var e=e||{};e.Utils=e.Utils||{};e.Utils.crcTable=null;e.Utils.makeCRCTable=function(){for(var a,c=[],d=0;256>d;d++){a=d;for(var e=0;8>e;e++)a=a&1?3988292384^a>>>1:a>>>1;c[d]=a}return c};e.Utils.crc32=function(a){for(var c=e.Utils.crcTable||(e.Utils.crcTable=e.Utils.makeCRCTable()),d=-1,m=0;m<a.byteLength;m++)d=d>>>8^c[(d^a.getUint8(m))&255];return(d^-1)>>>0};"undefined"!==typeof c&&c.exports&&(c.exports=e.Utils)},{}]},{},[45])(45)});
  glMatrixArrayType="undefined"!=typeof Float32Array?Float32Array:"undefined"!=typeof WebGLFloatArray?WebGLFloatArray:Array;
  var vec3={create:function(b){var a=new glMatrixArrayType(3);b&&(a[0]=b[0],a[1]=b[1],a[2]=b[2]);return a},set:function(b,a){a[0]=b[0];a[1]=b[1];a[2]=b[2];return a},add:function(b,a,c){if(!c||b==c)return b[0]+=a[0],b[1]+=a[1],b[2]+=a[2],b;c[0]=b[0]+a[0];c[1]=b[1]+a[1];c[2]=b[2]+a[2];return c},subtract:function(b,a,c){if(!c||b==c)return b[0]-=a[0],b[1]-=a[1],b[2]-=a[2],b;c[0]=b[0]-a[0];c[1]=b[1]-a[1];c[2]=b[2]-a[2];return c},negate:function(b,a){a||(a=b);a[0]=-b[0];a[1]=-b[1];a[2]=-b[2];return a},scale:function(b,
  a,c){if(!c||b==c)return b[0]*=a,b[1]*=a,b[2]*=a,b;c[0]=b[0]*a;c[1]=b[1]*a;c[2]=b[2]*a;return c},normalize:function(b,a){a||(a=b);var c=b[0],d=b[1],e=b[2],f=Math.sqrt(c*c+d*d+e*e);if(f){if(1==f)return a[0]=c,a[1]=d,a[2]=e,a}else return a[0]=0,a[1]=0,a[2]=0,a;f=1/f;a[0]=c*f;a[1]=d*f;a[2]=e*f;return a},cross:function(b,a,c){c||(c=b);var d=b[0],e=b[1];b=b[2];var f=a[0],h=a[1];a=a[2];c[0]=e*a-b*h;c[1]=b*f-d*a;c[2]=d*h-e*f;return c},length:function(b){var a=b[0],c=b[1];b=b[2];return Math.sqrt(a*a+c*c+b*
  b)},dot:function(b,a){return b[0]*a[0]+b[1]*a[1]+b[2]*a[2]},direction:function(b,a,c){c||(c=b);var d=b[0]-a[0],e=b[1]-a[1];b=b[2]-a[2];a=Math.sqrt(d*d+e*e+b*b);if(!a)return c[0]=0,c[1]=0,c[2]=0,c;a=1/a;c[0]=d*a;c[1]=e*a;c[2]=b*a;return c},lerp:function(b,a,c,d){d||(d=b);d[0]=b[0]+c*(a[0]-b[0]);d[1]=b[1]+c*(a[1]-b[1]);d[2]=b[2]+c*(a[2]-b[2]);return d},str:function(b){return"["+b[0]+", "+b[1]+", "+b[2]+"]"}},mat3={create:function(b){var a=new glMatrixArrayType(9);b&&(a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=
  b[3],a[4]=b[4],a[5]=b[5],a[6]=b[6],a[7]=b[7],a[8]=b[8],a[9]=b[9]);return a},set:function(b,a){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];return a},identity:function(b){b[0]=1;b[1]=0;b[2]=0;b[3]=0;b[4]=1;b[5]=0;b[6]=0;b[7]=0;b[8]=1;return b},transpose:function(b,a){if(!a||b==a){var c=b[1],d=b[2],e=b[5];b[1]=b[3];b[2]=b[6];b[3]=c;b[5]=b[7];b[6]=d;b[7]=e;return b}a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return a},
  toMat4:function(b,a){a||(a=mat4.create());a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=0;a[4]=b[3];a[5]=b[4];a[6]=b[5];a[7]=0;a[8]=b[6];a[9]=b[7];a[10]=b[8];a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a},str:function(b){return"["+b[0]+", "+b[1]+", "+b[2]+", "+b[3]+", "+b[4]+", "+b[5]+", "+b[6]+", "+b[7]+", "+b[8]+"]"}},mat4={create:function(b){var a=new glMatrixArrayType(16);b&&(a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a[4]=b[4],a[5]=b[5],a[6]=b[6],a[7]=b[7],a[8]=b[8],a[9]=b[9],a[10]=b[10],a[11]=b[11],a[12]=
  b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]);return a},set:function(b,a){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a},identity:function(b){b[0]=1;b[1]=0;b[2]=0;b[3]=0;b[4]=0;b[5]=1;b[6]=0;b[7]=0;b[8]=0;b[9]=0;b[10]=1;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return b},transpose:function(b,a){if(!a||b==a){var c=b[1],d=b[2],e=b[3],f=b[6],h=b[7],g=b[11];b[1]=b[4];b[2]=
  b[8];b[3]=b[12];b[4]=c;b[6]=b[9];b[7]=b[13];b[8]=d;b[9]=f;b[11]=b[14];b[12]=e;b[13]=h;b[14]=g;return b}a[0]=b[0];a[1]=b[4];a[2]=b[8];a[3]=b[12];a[4]=b[1];a[5]=b[5];a[6]=b[9];a[7]=b[13];a[8]=b[2];a[9]=b[6];a[10]=b[10];a[11]=b[14];a[12]=b[3];a[13]=b[7];a[14]=b[11];a[15]=b[15];return a},determinant:function(b){var a=b[0],c=b[1],d=b[2],e=b[3],f=b[4],h=b[5],g=b[6],m=b[7],l=b[8],q=b[9],u=b[10],w=b[11],C=b[12],B=b[13],A=b[14];b=b[15];return C*q*g*e-l*B*g*e-C*h*u*e+f*B*u*e+l*h*A*e-f*q*A*e-C*q*d*m+l*B*d*m+
  C*c*u*m-a*B*u*m-l*c*A*m+a*q*A*m+C*h*d*w-f*B*d*w-C*c*g*w+a*B*g*w+f*c*A*w-a*h*A*w-l*h*d*b+f*q*d*b+l*c*g*b-a*q*g*b-f*c*u*b+a*h*u*b},inverse:function(b,a){a||(a=b);var c=b[0],d=b[1],e=b[2],f=b[3],h=b[4],g=b[5],m=b[6],l=b[7],q=b[8],u=b[9],w=b[10],C=b[11],B=b[12],A=b[13],E=b[14],D=b[15],z=c*g-d*h,M=c*m-e*h,r=c*l-f*h,K=d*m-e*g,N=d*l-f*g,G=e*l-f*m,x=q*A-u*B,F=q*E-w*B,t=q*D-C*B,k=u*E-w*A,p=u*D-C*A,J=w*D-C*E,I=1/(z*J-M*p+r*k+K*t-N*F+G*x);a[0]=(g*J-m*p+l*k)*I;a[1]=(-d*J+e*p-f*k)*I;a[2]=(A*G-E*N+D*K)*I;a[3]=
  (-u*G+w*N-C*K)*I;a[4]=(-h*J+m*t-l*F)*I;a[5]=(c*J-e*t+f*F)*I;a[6]=(-B*G+E*r-D*M)*I;a[7]=(q*G-w*r+C*M)*I;a[8]=(h*p-g*t+l*x)*I;a[9]=(-c*p+d*t-f*x)*I;a[10]=(B*N-A*r+D*z)*I;a[11]=(-q*N+u*r-C*z)*I;a[12]=(-h*k+g*F-m*x)*I;a[13]=(c*k-d*F+e*x)*I;a[14]=(-B*K+A*M-E*z)*I;a[15]=(q*K-u*M+w*z)*I;return a},toRotationMat:function(b,a){a||(a=mat4.create());a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a},
  toMat3:function(b,a){a||(a=mat3.create());a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[4];a[4]=b[5];a[5]=b[6];a[6]=b[8];a[7]=b[9];a[8]=b[10];return a},toInverseMat3:function(b,a){var c=b[0],d=b[1],e=b[2],f=b[4],h=b[5],g=b[6],m=b[8],l=b[9],q=b[10],u=q*h-g*l,w=-q*f+g*m,C=l*f-h*m,B=c*u+d*w+e*C;if(!B)return null;B=1/B;a||(a=mat3.create());a[0]=u*B;a[1]=(-q*d+e*l)*B;a[2]=(g*d-e*h)*B;a[3]=w*B;a[4]=(q*c-e*m)*B;a[5]=(-g*c+e*f)*B;a[6]=C*B;a[7]=(-l*c+d*m)*B;a[8]=(h*c-d*f)*B;return a},multiply:function(b,a,c){c||(c=
  b);var d=b[0],e=b[1],f=b[2],h=b[3],g=b[4],m=b[5],l=b[6],q=b[7],u=b[8],w=b[9],C=b[10],B=b[11],A=b[12],E=b[13],D=b[14];b=b[15];var z=a[0],M=a[1],r=a[2],K=a[3],N=a[4],G=a[5],x=a[6],F=a[7],t=a[8],k=a[9],p=a[10],J=a[11],I=a[12],v=a[13],y=a[14];a=a[15];c[0]=z*d+M*g+r*u+K*A;c[1]=z*e+M*m+r*w+K*E;c[2]=z*f+M*l+r*C+K*D;c[3]=z*h+M*q+r*B+K*b;c[4]=N*d+G*g+x*u+F*A;c[5]=N*e+G*m+x*w+F*E;c[6]=N*f+G*l+x*C+F*D;c[7]=N*h+G*q+x*B+F*b;c[8]=t*d+k*g+p*u+J*A;c[9]=t*e+k*m+p*w+J*E;c[10]=t*f+k*l+p*C+J*D;c[11]=t*h+k*q+p*B+J*b;
  c[12]=I*d+v*g+y*u+a*A;c[13]=I*e+v*m+y*w+a*E;c[14]=I*f+v*l+y*C+a*D;c[15]=I*h+v*q+y*B+a*b;return c},multiplyVec3:function(b,a,c){c||(c=a);var d=a[0],e=a[1];a=a[2];c[0]=b[0]*d+b[4]*e+b[8]*a+b[12];c[1]=b[1]*d+b[5]*e+b[9]*a+b[13];c[2]=b[2]*d+b[6]*e+b[10]*a+b[14];return c},multiplyVec4:function(b,a,c){c||(c=a);var d=a[0],e=a[1],f=a[2];a=a[3];c[0]=b[0]*d+b[4]*e+b[8]*f+b[12]*a;c[1]=b[1]*d+b[5]*e+b[9]*f+b[13]*a;c[2]=b[2]*d+b[6]*e+b[10]*f+b[14]*a;c[3]=b[3]*d+b[7]*e+b[11]*f+b[15]*a;return c},translate:function(b,
  a,c){var d=a[0],e=a[1];a=a[2];if(!c||b==c)return b[12]=b[0]*d+b[4]*e+b[8]*a+b[12],b[13]=b[1]*d+b[5]*e+b[9]*a+b[13],b[14]=b[2]*d+b[6]*e+b[10]*a+b[14],b[15]=b[3]*d+b[7]*e+b[11]*a+b[15],b;var f=b[0],h=b[1],g=b[2],m=b[3],l=b[4],q=b[5],u=b[6],w=b[7],C=b[8],B=b[9],A=b[10],E=b[11];c[0]=f;c[1]=h;c[2]=g;c[3]=m;c[4]=l;c[5]=q;c[6]=u;c[7]=w;c[8]=C;c[9]=B;c[10]=A;c[11]=E;c[12]=f*d+l*e+C*a+b[12];c[13]=h*d+q*e+B*a+b[13];c[14]=g*d+u*e+A*a+b[14];c[15]=m*d+w*e+E*a+b[15];return c},scale:function(b,a,c){var d=a[0],e=
  a[1];a=a[2];if(!c||b==c)return b[0]*=d,b[1]*=d,b[2]*=d,b[3]*=d,b[4]*=e,b[5]*=e,b[6]*=e,b[7]*=e,b[8]*=a,b[9]*=a,b[10]*=a,b[11]*=a,b;c[0]=b[0]*d;c[1]=b[1]*d;c[2]=b[2]*d;c[3]=b[3]*d;c[4]=b[4]*e;c[5]=b[5]*e;c[6]=b[6]*e;c[7]=b[7]*e;c[8]=b[8]*a;c[9]=b[9]*a;c[10]=b[10]*a;c[11]=b[11]*a;c[12]=b[12];c[13]=b[13];c[14]=b[14];c[15]=b[15];return c},rotate:function(b,a,c,d){var e=c[0],f=c[1];c=c[2];var h=Math.sqrt(e*e+f*f+c*c);if(!h)return null;1!=h&&(h=1/h,e*=h,f*=h,c*=h);var g=Math.sin(a),m=Math.cos(a),l=1-m;
  a=b[0];var h=b[1],q=b[2],u=b[3],w=b[4],C=b[5],B=b[6],A=b[7],E=b[8],D=b[9],z=b[10],M=b[11],r=e*e*l+m,K=f*e*l+c*g,N=c*e*l-f*g,G=e*f*l-c*g,x=f*f*l+m,F=c*f*l+e*g,t=e*c*l+f*g,e=f*c*l-e*g,f=c*c*l+m;d?b!=d&&(d[12]=b[12],d[13]=b[13],d[14]=b[14],d[15]=b[15]):d=b;d[0]=a*r+w*K+E*N;d[1]=h*r+C*K+D*N;d[2]=q*r+B*K+z*N;d[3]=u*r+A*K+M*N;d[4]=a*G+w*x+E*F;d[5]=h*G+C*x+D*F;d[6]=q*G+B*x+z*F;d[7]=u*G+A*x+M*F;d[8]=a*t+w*e+E*f;d[9]=h*t+C*e+D*f;d[10]=q*t+B*e+z*f;d[11]=u*t+A*e+M*f;return d},rotateX:function(b,a,c){var d=Math.sin(a);
  a=Math.cos(a);var e=b[4],f=b[5],h=b[6],g=b[7],m=b[8],l=b[9],q=b[10],u=b[11];c?b!=c&&(c[0]=b[0],c[1]=b[1],c[2]=b[2],c[3]=b[3],c[12]=b[12],c[13]=b[13],c[14]=b[14],c[15]=b[15]):c=b;c[4]=e*a+m*d;c[5]=f*a+l*d;c[6]=h*a+q*d;c[7]=g*a+u*d;c[8]=e*-d+m*a;c[9]=f*-d+l*a;c[10]=h*-d+q*a;c[11]=g*-d+u*a;return c},rotateY:function(b,a,c){var d=Math.sin(a);a=Math.cos(a);var e=b[0],f=b[1],h=b[2],g=b[3],m=b[8],l=b[9],q=b[10],u=b[11];c?b!=c&&(c[4]=b[4],c[5]=b[5],c[6]=b[6],c[7]=b[7],c[12]=b[12],c[13]=b[13],c[14]=b[14],
  c[15]=b[15]):c=b;c[0]=e*a+m*-d;c[1]=f*a+l*-d;c[2]=h*a+q*-d;c[3]=g*a+u*-d;c[8]=e*d+m*a;c[9]=f*d+l*a;c[10]=h*d+q*a;c[11]=g*d+u*a;return c},rotateZ:function(b,a,c){var d=Math.sin(a);a=Math.cos(a);var e=b[0],f=b[1],h=b[2],g=b[3],m=b[4],l=b[5],q=b[6],u=b[7];c?b!=c&&(c[8]=b[8],c[9]=b[9],c[10]=b[10],c[11]=b[11],c[12]=b[12],c[13]=b[13],c[14]=b[14],c[15]=b[15]):c=b;c[0]=e*a+m*d;c[1]=f*a+l*d;c[2]=h*a+q*d;c[3]=g*a+u*d;c[4]=e*-d+m*a;c[5]=f*-d+l*a;c[6]=h*-d+q*a;c[7]=g*-d+u*a;return c},frustum:function(b,a,c,d,
  e,f,h){h||(h=mat4.create());var g=a-b,m=d-c,l=f-e;h[0]=2*e/g;h[1]=0;h[2]=0;h[3]=0;h[4]=0;h[5]=2*e/m;h[6]=0;h[7]=0;h[8]=(a+b)/g;h[9]=(d+c)/m;h[10]=-(f+e)/l;h[11]=-1;h[12]=0;h[13]=0;h[14]=-(f*e*2)/l;h[15]=0;return h},perspective:function(b,a,c,d,e){b=c*Math.tan(b*Math.PI/360);a*=b;return mat4.frustum(-a,a,-b,b,c,d,e)},ortho:function(b,a,c,d,e,f,h){h||(h=mat4.create());var g=a-b,m=d-c,l=f-e;h[0]=2/g;h[1]=0;h[2]=0;h[3]=0;h[4]=0;h[5]=2/m;h[6]=0;h[7]=0;h[8]=0;h[9]=0;h[10]=-2/l;h[11]=0;h[12]=-(b+a)/g;h[13]=
  -(d+c)/m;h[14]=-(f+e)/l;h[15]=1;return h},lookAt:function(b,a,c,d){d||(d=mat4.create());var e=b[0],f=b[1];b=b[2];var h=c[0],g=c[1],m=c[2];c=a[1];var l=a[2];if(e==a[0]&&f==c&&b==l)return mat4.identity(d);var q,u,w,C;c=e-a[0];l=f-a[1];a=b-a[2];C=1/Math.sqrt(c*c+l*l+a*a);c*=C;l*=C;a*=C;q=g*a-m*l;m=m*c-h*a;h=h*l-g*c;(C=Math.sqrt(q*q+m*m+h*h))?(C=1/C,q*=C,m*=C,h*=C):h=m=q=0;g=l*h-a*m;u=a*q-c*h;w=c*m-l*q;(C=Math.sqrt(g*g+u*u+w*w))?(C=1/C,g*=C,u*=C,w*=C):w=u=g=0;d[0]=q;d[1]=g;d[2]=c;d[3]=0;d[4]=m;d[5]=u;
  d[6]=l;d[7]=0;d[8]=h;d[9]=w;d[10]=a;d[11]=0;d[12]=-(q*e+m*f+h*b);d[13]=-(g*e+u*f+w*b);d[14]=-(c*e+l*f+a*b);d[15]=1;return d},str:function(b){return"["+b[0]+", "+b[1]+", "+b[2]+", "+b[3]+", "+b[4]+", "+b[5]+", "+b[6]+", "+b[7]+", "+b[8]+", "+b[9]+", "+b[10]+", "+b[11]+", "+b[12]+", "+b[13]+", "+b[14]+", "+b[15]+"]"}};
  quat4={create:function(b){var a=new glMatrixArrayType(4);b&&(a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3]);return a},set:function(b,a){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];return a},calculateW:function(b,a){var c=b[0],d=b[1],e=b[2];if(!a||b==a)return b[3]=-Math.sqrt(Math.abs(1-c*c-d*d-e*e)),b;a[0]=c;a[1]=d;a[2]=e;a[3]=-Math.sqrt(Math.abs(1-c*c-d*d-e*e));return a},inverse:function(b,a){if(!a||b==a)return b[0]*=1,b[1]*=1,b[2]*=1,b;a[0]=-b[0];a[1]=-b[1];a[2]=-b[2];a[3]=b[3];return a},length:function(b){var a=
  b[0],c=b[1],d=b[2];b=b[3];return Math.sqrt(a*a+c*c+d*d+b*b)},normalize:function(b,a){a||(a=b);var c=b[0],d=b[1],e=b[2],f=b[3],h=Math.sqrt(c*c+d*d+e*e+f*f);if(0==h)return a[0]=0,a[1]=0,a[2]=0,a[3]=0,a;h=1/h;a[0]=c*h;a[1]=d*h;a[2]=e*h;a[3]=f*h;return a},multiply:function(b,a,c){c||(c=b);var d=b[0],e=b[1],f=b[2];b=b[3];var h=a[0],g=a[1],m=a[2];a=a[3];c[0]=d*a+b*h+e*m-f*g;c[1]=e*a+b*g+f*h-d*m;c[2]=f*a+b*m+d*g-e*h;c[3]=b*a-d*h-e*g-f*m;return c},multiplyVec3:function(b,a,c){c||(c=a);var d=a[0],e=a[1],f=
  a[2];a=b[0];var h=b[1],g=b[2];b=b[3];var m=b*d+h*f-g*e,l=b*e+g*d-a*f,q=b*f+a*e-h*d,d=-a*d-h*e-g*f;c[0]=m*b+d*-a+l*-g-q*-h;c[1]=l*b+d*-h+q*-a-m*-g;c[2]=q*b+d*-g+m*-h-l*-a;return c},toMat3:function(b,a){a||(a=mat3.create());var c=b[0],d=b[1],e=b[2],f=b[3],h=c+c,g=d+d,m=e+e,l=c*h,q=c*g,c=c*m,u=d*g,d=d*m,e=e*m,h=f*h,g=f*g,f=f*m;a[0]=1-(u+e);a[1]=q-f;a[2]=c+g;a[3]=q+f;a[4]=1-(l+e);a[5]=d-h;a[6]=c-g;a[7]=d+h;a[8]=1-(l+u);return a},toMat4:function(b,a){a||(a=mat4.create());var c=b[0],d=b[1],e=b[2],f=b[3],
  h=c+c,g=d+d,m=e+e,l=c*h,q=c*g,c=c*m,u=d*g,d=d*m,e=e*m,h=f*h,g=f*g,f=f*m;a[0]=1-(u+e);a[1]=q-f;a[2]=c+g;a[3]=0;a[4]=q+f;a[5]=1-(l+e);a[6]=d-h;a[7]=0;a[8]=c-g;a[9]=d+h;a[10]=1-(l+u);a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a},slerp:function(b,a,c,d){d||(d=b);var e=c;0>b[0]*a[0]+b[1]*a[1]+b[2]*a[2]+b[3]*a[3]&&(e=-1*c);d[0]=1-c*b[0]+e*a[0];d[1]=1-c*b[1]+e*a[1];d[2]=1-c*b[2]+e*a[2];d[3]=1-c*b[3]+e*a[3];return d},str:function(b){return"["+b[0]+", "+b[1]+", "+b[2]+", "+b[3]+"]"}};var GLU={};
  (function(b){b.unProject=function(a,c,d,e,f,h,g){a=[a,c,d,1];c=[];b.multMatrices(e,f,c);if(!b.invertMatrix(c,c))return!1;a[0]=(a[0]-h[0])/h[2];a[1]=(a[1]-h[1])/h[3];a[0]=2*a[0]-1;a[1]=2*a[1]-1;a[2]=2*a[2]-1;e=[];b.multMatrixVec(c,a,e);if(0===e[3])return!1;e[0]/=e[3];e[1]/=e[3];e[2]/=e[3];g[0]=e[0];g[1]=e[1];g[2]=e[2];return!0};b.multMatrixVec=function(a,b,d){for(var e=0;4>e;e+=1)d[e]=b[0]*a[0+e]+b[1]*a[4+e]+b[2]*a[8+e]+b[3]*a[12+e]};b.multMatrices=function(a,b,d){for(var e=0;4>e;e+=1)for(var f=0;4>
  f;f+=1)d[4*e+f]=a[4*e+0]*b[0+f]+a[4*e+1]*b[4+f]+a[4*e+2]*b[8+f]+a[4*e+3]*b[12+f]};b.invertMatrix=function(a,b){var d=[];d[0]=a[5]*a[10]*a[15]-a[5]*a[11]*a[14]-a[9]*a[6]*a[15]+a[9]*a[7]*a[14]+a[13]*a[6]*a[11]-a[13]*a[7]*a[10];d[4]=-a[4]*a[10]*a[15]+a[4]*a[11]*a[14]+a[8]*a[6]*a[15]-a[8]*a[7]*a[14]-a[12]*a[6]*a[11]+a[12]*a[7]*a[10];d[8]=a[4]*a[9]*a[15]-a[4]*a[11]*a[13]-a[8]*a[5]*a[15]+a[8]*a[7]*a[13]+a[12]*a[5]*a[11]-a[12]*a[7]*a[9];d[12]=-a[4]*a[9]*a[14]+a[4]*a[10]*a[13]+a[8]*a[5]*a[14]-a[8]*a[6]*a[13]-
  a[12]*a[5]*a[10]+a[12]*a[6]*a[9];d[1]=-a[1]*a[10]*a[15]+a[1]*a[11]*a[14]+a[9]*a[2]*a[15]-a[9]*a[3]*a[14]-a[13]*a[2]*a[11]+a[13]*a[3]*a[10];d[5]=a[0]*a[10]*a[15]-a[0]*a[11]*a[14]-a[8]*a[2]*a[15]+a[8]*a[3]*a[14]+a[12]*a[2]*a[11]-a[12]*a[3]*a[10];d[9]=-a[0]*a[9]*a[15]+a[0]*a[11]*a[13]+a[8]*a[1]*a[15]-a[8]*a[3]*a[13]-a[12]*a[1]*a[11]+a[12]*a[3]*a[9];d[13]=a[0]*a[9]*a[14]-a[0]*a[10]*a[13]-a[8]*a[1]*a[14]+a[8]*a[2]*a[13]+a[12]*a[1]*a[10]-a[12]*a[2]*a[9];d[2]=a[1]*a[6]*a[15]-a[1]*a[7]*a[14]-a[5]*a[2]*a[15]+
  a[5]*a[3]*a[14]+a[13]*a[2]*a[7]-a[13]*a[3]*a[6];d[6]=-a[0]*a[6]*a[15]+a[0]*a[7]*a[14]+a[4]*a[2]*a[15]-a[4]*a[3]*a[14]-a[12]*a[2]*a[7]+a[12]*a[3]*a[6];d[10]=a[0]*a[5]*a[15]-a[0]*a[7]*a[13]-a[4]*a[1]*a[15]+a[4]*a[3]*a[13]+a[12]*a[1]*a[7]-a[12]*a[3]*a[5];d[14]=-a[0]*a[5]*a[14]+a[0]*a[6]*a[13]+a[4]*a[1]*a[14]-a[4]*a[2]*a[13]-a[12]*a[1]*a[6]+a[12]*a[2]*a[5];d[3]=-a[1]*a[6]*a[11]+a[1]*a[7]*a[10]+a[5]*a[2]*a[11]-a[5]*a[3]*a[10]-a[9]*a[2]*a[7]+a[9]*a[3]*a[6];d[7]=a[0]*a[6]*a[11]-a[0]*a[7]*a[10]-a[4]*a[2]*
  a[11]+a[4]*a[3]*a[10]+a[8]*a[2]*a[7]-a[8]*a[3]*a[6];d[11]=-a[0]*a[5]*a[11]+a[0]*a[7]*a[9]+a[4]*a[1]*a[11]-a[4]*a[3]*a[9]-a[8]*a[1]*a[7]+a[8]*a[3]*a[5];d[15]=a[0]*a[5]*a[10]-a[0]*a[6]*a[9]-a[4]*a[1]*a[10]+a[4]*a[2]*a[9]+a[8]*a[1]*a[6]-a[8]*a[2]*a[5];var e=a[0]*d[0]+a[1]*d[4]+a[2]*d[8]+a[3]*d[12];if(0===e)return!1;for(var e=1/e,f=0;16>f;f+=1)b[f]=d[f]*e;return!0}})(GLU);
  var PAPAYA_BROWSER_MIN_FIREFOX=7,PAPAYA_BROWSER_MIN_CHROME=7,PAPAYA_BROWSER_MIN_SAFARI=6,PAPAYA_BROWSER_MIN_IE=10,PAPAYA_BROWSER_MIN_OPERA=12,PAPAYA_SURFACE_BROWSER_MIN_FIREFOX=7,PAPAYA_SURFACE_BROWSER_MIN_CHROME=8,PAPAYA_SURFACE_BROWSER_MIN_SAFARI=6,PAPAYA_SURFACE_BROWSER_MIN_IE=11,PAPAYA_SURFACE_BROWSER_MIN_OPERA=12,PAPAYA_CONTAINER_CLASS_NAME="papaya",PAPAYA_CONTAINER_COLLAPSABLE="papaya-collapsable",PAPAYA_CONTAINER_COLLAPSABLE_EXEMPT="papaya-collapsable-exempt",PAPAYA_CONTAINER_FULLSCREEN="papaya-fullscreen",
  PAPAYA_VIEWER_CSS="papaya-viewer",PAPAYA_TOOLBAR_CSS="papaya-toolbar",PAPAYA_TITLEBAR_CSS="papaya-titlebar",PAPAYA_SLIDER_CSS="papaya-slider-slice",PAPAYA_KIOSK_CONTROLS_CSS="papaya-kiosk-controls",PAPAYA_DISPLAY_CSS="papaya-display",PAPAYA_DIALOG_CSS="papaya-dialog",PAPAYA_DIALOG_CONTENT_CSS="papaya-dialog-content",PAPAYA_DIALOG_CONTENT_NOWRAP_CSS="papaya-dialog-content-nowrap",PAPAYA_DIALOG_CONTENT_LABEL_CSS="papaya-dialog-content-label",PAPAYA_DIALOG_CONTENT_CONTROL_CSS="papaya-dialog-content-control",
  PAPAYA_DIALOG_TITLE_CSS="papaya-dialog-title",PAPAYA_DIALOG_BUTTON_CSS="papaya-dialog-button",PAPAYA_DIALOG_BACKGROUND="papaya-dialog-background",PAPAYA_DIALOG_STOPSCROLL="papaya-dialog-stopscroll",PAPAYA_DIALOG_CONTENT_HELP="papaya-dialog-content-help",PAPAYA_MENU_CSS="papaya-menu",PAPAYA_MENU_LABEL_CSS="papaya-menu-label",PAPAYA_MENU_TITLEBAR_CSS="papaya-menu-titlebar",PAPAYA_MENU_ICON_CSS="papaya-menu-icon",PAPAYA_MENU_HOVERING_CSS="papaya-menu-hovering",PAPAYA_MENU_SPACER_CSS="papaya-menu-spacer",
  PAPAYA_MENU_UNSELECTABLE="papaya-menu-unselectable",PAPAYA_MENU_FILECHOOSER="papaya-menu-filechooser",PAPAYA_MENU_BUTTON_CSS="papaya-menu-button",PAPAYA_MENU_BUTTON_HOVERING_CSS="papaya-menu-button-hovering",PAPAYA_MENU_COLORTABLE_CSS="papaya-menu-colortable",PAPAYA_MENU_INPUT_FIELD="papaya-menu-input",PAPAYA_MENU_SLIDER="papaya-menu-slider",PAPAYA_CONTROL_INCREMENT_BUTTON_CSS="papaya-control-increment",PAPAYA_CONTROL_GOTO_CENTER_BUTTON_CSS="papaya-control-goto-center",PAPAYA_CONTROL_GOTO_ORIGIN_BUTTON_CSS=
  "papaya-control-goto-origin",PAPAYA_CONTROL_SWAP_BUTTON_CSS="papaya-control-swap",PAPAYA_CONTROL_DIRECTION_SLIDER="papaya-direction-slider",PAPAYA_CONTROL_MAIN_SLIDER="papaya-main-slider",PAPAYA_CONTROL_MAIN_INCREMENT_BUTTON_CSS="papaya-main-increment",PAPAYA_CONTROL_MAIN_DECREMENT_BUTTON_CSS="papaya-main-decrement",PAPAYA_CONTROL_MAIN_SWAP_BUTTON_CSS="papaya-main-swap",PAPAYA_CONTROL_MAIN_GOTO_CENTER_BUTTON_CSS="papaya-main-goto-center",PAPAYA_CONTROL_MAIN_GOTO_ORIGIN_BUTTON_CSS="papaya-main-goto-origin",
  PAPAYA_CONTROL_BAR_LABELS_CSS="papaya-controlbar-label",PAPAYA_UTILS_CHECKFORJS_CSS="checkForJS",PAPAYA_UTILS_UNSUPPORTED_CSS="papaya-utils-unsupported",PAPAYA_UTILS_UNSUPPORTED_MESSAGE_CSS="papaya-utils-unsupported-message",PAPAYA_DEFAULT_VIEWER_ID="papayaViewer",PAPAYA_DEFAULT_DISPLAY_ID="papayaDisplay",PAPAYA_DEFAULT_TOOLBAR_ID="papayaToolbar",PAPAYA_DEFAULT_CONTAINER_ID="papayaContainer",PAPAYA_DEFAULT_SLIDER_ID="papayaSliceSlider",PAPAYA_SPACING=3,PAPAYA_PADDING=8,PAPAYA_CONTAINER_PADDING=20,
  PAPAYA_CONTAINER_PADDING_TOP=PAPAYA_CONTAINER_PADDING,PAPAYA_MANGO_INSTALLED="mangoinstalled",PAPAYA_CUSTOM_PROTOCOL="mango",GUNZIP_MAGIC_COOKIE1=31,GUNZIP_MAGIC_COOKIE2=139;"use strict";var papaya=papaya||{};papaya.utilities=papaya.utilities||{};papaya.utilities.ArrayUtils=papaya.utilities.ArrayUtils||{};
  papaya.utilities.ArrayUtils.createArray=function(b){var a=Array(b||0),c;if(1<arguments.length){var d=Array.prototype.slice.call(arguments,1);for(c=0;c<b;c+=1)a[c]=papaya.utilities.ArrayUtils.createArray.apply(this,d)}return a};papaya.utilities.ArrayUtils.contains=function(b,a){for(var c=b.length;c--;)if(b[c]===a)return!0;return!1};Array.prototype.clone=function(){var b,a;b=this.slice(0);for(a=0;a<this.length;a+=1)this[a].clone&&(b[a]=this[a].clone());return b};"use strict";papaya=papaya||{};
  papaya.utilities=papaya.utilities||{};papaya.utilities.MathUtils=papaya.utilities.MathUtils||{};papaya.utilities.MathUtils.EPSILON=1E-8;papaya.utilities.MathUtils.signum=function(b){return b?0>b?-1:1:0};papaya.utilities.MathUtils.lineDistance=function(b,a,c,d){b=c-b;a=d-a;return Math.sqrt(b*b+a*a)};papaya.utilities.MathUtils.lineDistance3d=function(b,a,c,d,e,f){b=d-b;a=e-a;c=f-c;return Math.sqrt(b*b+a*a+c*c)};
  papaya.utilities.MathUtils.essentiallyEqual=function(b,a){return b===a||Math.abs(b-a)<=(Math.abs(b)>Math.abs(a)?Math.abs(a):Math.abs(b))*papaya.utilities.MathUtils.EPSILON};papaya.utilities.MathUtils.getPowerOfTwo=function(b,a){for(a=a||1;a<b;)a*=2;return a};function papayaRoundFast(b){return.5+b|0}function papayaFloorFast(b){return b|0}"use strict";papaya=papaya||{};papaya.utilities=papaya.utilities||{};papaya.utilities.ObjectUtils=papaya.utilities.ObjectUtils||{};
  papaya.utilities.ObjectUtils.bind=function(b,a,c,d){if(2===arguments.length)return function(){return a.apply(b,arguments)};var e=Array.prototype.slice;return function(){var f=c||arguments;!0===d?(f=e.call(arguments,0),f=f.concat(c)):"number"===typeof d&&(f=e.call(arguments,0),Ext.Array.insert(f,d,c));return a.apply(b||window,f)}};papaya.utilities.ObjectUtils.isString=function(b){return"string"===typeof b||b instanceof String};
  papaya.utilities.ObjectUtils.dereference=function(b){return papaya.utilities.ObjectUtils.dereferenceIn(window,b)};papaya.utilities.ObjectUtils.dereferenceIn=function(b,a){var c,d;if(!papaya.utilities.ObjectUtils.isString(a))return null;if(d=a.replace(/(^[' "]+|[" ']+$)/g,"").match(/(^[\w\$]+(\.[\w\$]+)*)/))for(d=d[1].split("."),c=b[d.shift()];c&&d.length;)c=c[d.shift()];return c||null};"use strict";papaya=papaya||{};papaya.utilities=papaya.utilities||{};
  papaya.utilities.PlatformUtils=papaya.utilities.PlatformUtils||{};var console=console||{};console.log=console.log||function(){};console.warn=console.warn||function(){};console.error=console.error||function(){};console.info=console.info||function(){};papaya.utilities.PlatformUtils.os=null;papaya.utilities.PlatformUtils.browser=bowser.name;papaya.utilities.PlatformUtils.browserVersion=bowser.version;papaya.utilities.PlatformUtils.ios=bowser.ios;papaya.utilities.PlatformUtils.mobile=bowser.mobile;
  papaya.utilities.PlatformUtils.lastScrollEventTimestamp=0;papaya.utilities.PlatformUtils.smallScreen=window.matchMedia&&window.matchMedia("only screen and (max-width: 760px)").matches;papaya.utilities.PlatformUtils.detectOs=function(){return-1!==navigator.appVersion.indexOf("Win")?"Windows":-1!==navigator.appVersion.indexOf("Mac")?"MacOS":-1!==navigator.appVersion.indexOf("X11")||-1!==navigator.appVersion.indexOf("Linux")?"Linux":"Unknown"};papaya.utilities.PlatformUtils.os=papaya.utilities.PlatformUtils.detectOs();
  papaya.utilities.PlatformUtils.checkForBrowserCompatibility=function(){if("Firefox"===papaya.utilities.PlatformUtils.browser){if(papaya.utilities.PlatformUtils.browserVersion<PAPAYA_BROWSER_MIN_FIREFOX)return"Papaya requires Firefox version "+PAPAYA_BROWSER_MIN_FIREFOX+" or higher."}else if("Chrome"===papaya.utilities.PlatformUtils.browser){if(papaya.utilities.PlatformUtils.browserVersion<PAPAYA_BROWSER_MIN_CHROME)return"Papaya requires Chrome version "+PAPAYA_BROWSER_MIN_CHROME+" or higher."}else if("Internet Explorer"===
  papaya.utilities.PlatformUtils.browser){if(papaya.utilities.PlatformUtils.browserVersion<PAPAYA_BROWSER_MIN_IE)return"Papaya requires Internet Explorer version "+PAPAYA_BROWSER_MIN_IE+" or higher."}else if("Safari"===papaya.utilities.PlatformUtils.browser){if(papaya.utilities.PlatformUtils.browserVersion<PAPAYA_BROWSER_MIN_SAFARI)return"Papaya requires Safari version "+PAPAYA_BROWSER_MIN_SAFARI+" or higher."}else if("Opera"===papaya.utilities.PlatformUtils.browser&&papaya.utilities.PlatformUtils.browserVersion<
  PAPAYA_BROWSER_MIN_OPERA)return"Papaya requires Opera version "+PAPAYA_BROWSER_MIN_OPERA+" or higher.";return null};papaya.utilities.PlatformUtils.isWebGLSupported=function(){var b,a,c;try{if(b=document.createElement("canvas"),a=b.getContext("webgl")||b.getContext("experimental-webgl"),c=a.getExtension("OES_element_index_uint"),!c)return!1}catch(d){return console.log("There was a problem detecting WebGL! "+d),!1}return!0};
  papaya.utilities.PlatformUtils.getMousePositionX=function(b){var a;b.originalEvent&&(b=b.originalEvent);if(b.targetTouches){if(1===b.targetTouches.length&&(a=b.targetTouches[0]))return a.pageX}else if(b.changedTouches&&1===b.changedTouches.length&&(a=b.changedTouches[0]))return a.pageX;return b.pageX};
  papaya.utilities.PlatformUtils.getMousePositionY=function(b){var a;if(b.targetTouches){if(1===b.targetTouches.length&&(a=b.targetTouches[0]))return a.pageY}else if(b.changedTouches&&1===b.changedTouches.length&&(a=b.changedTouches[0]))return a.pageY;return b.pageY};
  papaya.utilities.PlatformUtils.getScrollSign=function(b,a){var c,d;c=a?75:"Firefox"===papaya.utilities.PlatformUtils.browser?10:"Chrome"===papaya.utilities.PlatformUtils.browser?50:"Internet Explorer"===papaya.utilities.PlatformUtils.browser?0:"Safari"===papaya.utilities.PlatformUtils.browser?50:10;d=Date.now();return d-papaya.utilities.PlatformUtils.lastScrollEventTimestamp>c?(papaya.utilities.PlatformUtils.lastScrollEventTimestamp=d,d=papaya.utilities.PlatformUtils.normalizeWheel(b).spinY,c=0<-1*
  papaya.utilities.PlatformUtils.normalizeWheel(b).spinY?1:-1,c*=Math.ceil(Math.abs(d/10))):0};papaya.utilities.PlatformUtils.makeSlice=function(b,a,c){return"undefined"===typeof File?function(){}:File.prototype.slice?b.slice(a,a+c):File.prototype.mozSlice?b.mozSlice(a,c):File.prototype.webkitSlice?b.webkitSlice(a,c):null};papaya.utilities.PlatformUtils.isPlatformLittleEndian=function(){var b=new ArrayBuffer(2);(new DataView(b)).setInt16(0,256,!0);return 256===(new Int16Array(b))[0]};
  papaya.utilities.PlatformUtils.isInputRangeSupported=function(){var b=document.createElement("input");b.setAttribute("type","range");return"range"===b.type};
  papaya.utilities.PlatformUtils.launchCustomProtocol=function(b,a,c){var d,e,f=!1;if("Internet Explorer"===papaya.utilities.PlatformUtils.browser)e=window.open("","","width=0,height=0"),e.document.write("<iframe src='"+a+"'></iframe>"),setTimeout(function(){try{e.location.href,f=!0}catch(a){console.log(a)}f?e.setTimeout("window.close()",100):e.close();c(f)},100);else if("Firefox"===papaya.utilities.PlatformUtils.browser){try{d=$("<iframe />"),d.css({display:"none"}),d.appendTo("body"),d[0].contentWindow.location.href=
  a,f=!0}catch(h){f=!1}d.remove();c(f)}else"Chrome"===papaya.utilities.PlatformUtils.browser?(b.viewerHtml.css({outline:0}),b.viewerHtml.attr("tabindex","1"),b.viewerHtml.focus(),b.viewerHtml.blur(function(){f=!0;c(!0)}),location.href=a,setTimeout(function(){b.viewerHtml.off("blur");b.viewerHtml.removeAttr("tabindex");f||c(!1)},2E3)):((d=papaya.utilities.UrlUtils.readCookie(papaya.viewer.Preferences.COOKIE_PREFIX+PAPAYA_MANGO_INSTALLED))||papaya.mangoinstalled?f=!0:confirm("This feature requires that "+
  (papaya.utilities.PlatformUtils.ios?"iMango":"Mango")+" is installed.  Continue?")&&(papaya.utilities.UrlUtils.createCookie(papaya.viewer.Preferences.COOKIE_PREFIX+PAPAYA_MANGO_INSTALLED,!0,papaya.viewer.Preferences.COOKIE_EXPIRY_DAYS),f=!0),f&&(location.href=a),c(f))};
  papaya.utilities.PlatformUtils.getSupportedScrollEvent=function(){return"Firefox"===papaya.utilities.PlatformUtils.browser?"DOMMouseScroll":"onwheel"in document.createElement("div")?"wheel":void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll"};var PIXEL_STEP=10,LINE_HEIGHT=40,PAGE_HEIGHT=800;
  papaya.utilities.PlatformUtils.normalizeWheel=function(b){var a=0,c=0,d=0,e=0;"detail"in b&&(c=b.detail);"wheelDelta"in b&&(c=-b.wheelDelta/120);"wheelDeltaY"in b&&(c=-b.wheelDeltaY/120);"wheelDeltaX"in b&&(a=-b.wheelDeltaX/120);"axis"in b&&b.axis===b.HORIZONTAL_AXIS&&(a=c,c=0);d=a*PIXEL_STEP;e=c*PIXEL_STEP;"deltaY"in b&&(e=b.deltaY);"deltaX"in b&&(d=b.deltaX);(d||e)&&b.deltaMode&&(1==b.deltaMode?(d*=LINE_HEIGHT,e*=LINE_HEIGHT):(d*=PAGE_HEIGHT,e*=PAGE_HEIGHT));d&&!a&&(a=1>d?-1:1);e&&!c&&(c=1>e?-1:
  1);return{spinX:a,spinY:c,pixelX:d,pixelY:e}};"use strict";papaya=papaya||{};papaya.utilities=papaya.utilities||{};papaya.utilities.StringUtils=papaya.utilities.StringUtils||{};papaya.utilities.StringUtils.isStringBlank=function(b){return b&&"string"==(typeof b).toLowerCase()?0===b.trim().length:!0};papaya.utilities.StringUtils.formatNumber=function(b,a){var c=0,c=papaya.utilities.ObjectUtils.isString(b)?Number(b):b,c=a?c.toPrecision(5):c.toPrecision(7);return parseFloat(c)};
  papaya.utilities.StringUtils.getSizeString=function(b){var a=null;return a=1048576<b?papaya.utilities.StringUtils.formatNumber(b/1048576,!0)+" Mb":1024<b?papaya.utilities.StringUtils.formatNumber(b/1024,!0)+" Kb":b+" Bytes"};papaya.utilities.StringUtils.wordwrap=function(b,a,c,d){c=c||"\n";a=a||75;return b?b.match(new RegExp(".{1,"+a+"}(\\s|$)"+(d?"|.{"+a+"}|.+$":"|\\S+?(\\s|$)"),"g")).join(c):b};
  papaya.utilities.StringUtils.truncateMiddleString=function(b,a){if(b.length<=a)return b;var c=a-3,d=Math.ceil(c/2),c=Math.floor(c/2);return b.substr(0,d)+"..."+b.substr(b.length-c)};papaya.utilities.StringUtils.pad=function(b,a){return("000000000"+b).substr(-a)};"function"!==typeof String.prototype.startsWith&&(String.prototype.startsWith=function(b){return 0===this.indexOf(b)});
  "function"!==typeof String.prototype.endsWith&&(String.prototype.endsWith=function(b){return-1!==this.indexOf(b,this.length-b.length)});"function"!==typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")});"use strict";papaya=papaya||{};papaya.utilities=papaya.utilities||{};papaya.utilities.UrlUtils=papaya.utilities.UrlUtils||{};
  papaya.utilities.UrlUtils.createCookie=function(b,a,c){var d;c?(d=new Date,d.setTime(d.getTime()+864E5*c),c="; expires="+d.toGMTString()):c="";document.cookie=b+"="+a+c+"; path=/"};papaya.utilities.UrlUtils.readCookie=function(b){var a,c,d;b+="=";a=document.cookie.split(";");for(c=0;c<a.length;c+=1){for(d=a[c];" "===d.charAt(0);)d=d.substring(1,d.length);if(0===d.indexOf(b))return d.substring(b.length,d.length)}return null};
  papaya.utilities.UrlUtils.eraseCookie=function(b){papaya.utilities.UrlUtils.createCookie(b,"",-1)};papaya.utilities.UrlUtils.getQueryParams=function(b){var a,c,d=/[?&]?([^=]+)=([^&]*)/g;if(-1!==document.location.href.indexOf("?"))for(c=document.location.href.substring(document.location.href.indexOf("?")+1),c=c.split("+").join(" "),a=d.exec(c);a;)b[decodeURIComponent(a[1])]=decodeURIComponent(a[2]),a=d.exec(c)};
  papaya.utilities.UrlUtils.getAbsoluteUrl=function(b,a){var c,d;c=window.location.href;c=c.substring(0,c.lastIndexOf("/"));d=document.createElement("a");d.href=c+"/"+a;c=d.host;d=d.pathname;"/"!==d.charAt(0)&&(d="/"+d);return b+"://"+c+d};"use strict";papaya=papaya||{};papaya.core=papaya.core||{};papaya.core.Coordinate=papaya.core.Coordinate||function(b,a,c){this.x=b;this.y=a;this.z=c};
  papaya.core.Coordinate.prototype.setCoordinate=function(b,a,c,d){d?(this.x=Math.round(b),this.y=Math.round(a),this.z=Math.round(c)):(this.x=b,this.y=a,this.z=c)};papaya.core.Coordinate.prototype.toString=function(){return"("+this.x+","+this.y+","+this.z+")"};papaya.core.Coordinate.prototype.isAllZeros=function(){return 0===this.x&&0===this.y&&0===this.z};"use strict";papaya=papaya||{};papaya.core=papaya.core||{};papaya.core.Point=papaya.core.Point||function(b,a){this.x=b;this.y=a};"use strict";
  papaya=papaya||{};papaya.volume=papaya.volume||{};papaya.volume.Header=papaya.volume.Header||function(b){this.origin=this.error=this.imageRange=this.orientation=this.imageType=this.imageDescription=this.voxelDimensions=this.imageDimensions=this.fileFormat=null;this.pad=b;this.orientationCertainty=papaya.volume.Header.ORIENTATION_CERTAINTY_UNKNOWN;this.onFinishedFileFormatRead=null};papaya.volume.Header.HEADER_TYPE_UNKNOWN=0;papaya.volume.Header.HEADER_TYPE_NIFTI=1;
  papaya.volume.Header.HEADER_TYPE_DICOM=2;papaya.volume.Header.ERROR_UNRECOGNIZED_FORMAT="This format is not recognized!";papaya.volume.Header.INVALID_IMAGE_DIMENSIONS="Image dimensions are not valid!";papaya.volume.Header.INVALID_VOXEL_DIMENSIONS="Voxel dimensions are not valid!";papaya.volume.Header.INVALID_DATATYPE="Datatype is not valid or not supported!";papaya.volume.Header.INVALID_IMAGE_RANGE="Image range is not valid!";papaya.volume.Header.ORIENTATION_CERTAINTY_UNKNOWN=0;
  papaya.volume.Header.ORIENTATION_CERTAINTY_LOW=1;papaya.volume.Header.ORIENTATION_CERTAINTY_HIGH=2;papaya.volume.Header.prototype.findHeaderType=function(b,a){return papaya.volume.nifti.HeaderNIFTI.isThisFormat(b,a)?papaya.volume.Header.HEADER_TYPE_NIFTI:papaya.Container.DICOM_SUPPORT&&papaya.volume.dicom.HeaderDICOM.isThisFormat(b,a)?papaya.volume.Header.HEADER_TYPE_DICOM:papaya.volume.Header.HEADER_TYPE_UNKNOWN};
  papaya.volume.Header.prototype.readHeaderData=function(b,a,c,d,e){b=this.findHeaderType(b,a);this.onFinishedFileFormatRead=e;b===papaya.volume.Header.HEADER_TYPE_NIFTI?(this.fileFormat=new papaya.volume.nifti.HeaderNIFTI,this.fileFormat.readHeaderData(a,c,d,papaya.utilities.ObjectUtils.bind(this,this.onFinishedHeaderRead))):b===papaya.volume.Header.HEADER_TYPE_DICOM?(this.fileFormat=new papaya.volume.dicom.HeaderDICOM,this.fileFormat.readHeaderData(a,c,d,papaya.utilities.ObjectUtils.bind(this,this.onFinishedHeaderRead))):
  (this.error=Error(papaya.volume.Header.ERROR_UNRECOGNIZED_FORMAT),this.onFinishedFileFormatRead())};
  papaya.volume.Header.prototype.onFinishedHeaderRead=function(){this.fileFormat.hasError()?this.error=this.fileFormat.error:(this.imageType=this.fileFormat.getImageType(),this.imageType.isValid()||(this.error=Error(papaya.volume.Header.INVALID_DATATYPE)),this.imageDimensions=this.fileFormat.getImageDimensions(),this.imageDimensions.isValid()||(this.error=Error(papaya.volume.Header.INVALID_IMAGE_DIMENSIONS)),this.voxelDimensions=this.fileFormat.getVoxelDimensions(),this.voxelDimensions.isValid()||(this.error=
  Error(papaya.volume.Header.INVALID_VOXEL_DIMENSIONS)),this.pad&&this.imageDimensions.padIsometric(this.voxelDimensions),this.orientation=this.fileFormat.getOrientation(),this.orientation.isValid()?this.orientationCertainty=this.fileFormat.getOrientationCertainty():(this.orientation=new papaya.volume.Orientation(papaya.volume.Orientation.DEFAULT),this.orientationCertainty=papaya.volume.Header.ORIENTATION_CERTAINTY_UNKNOWN),this.orientation.createInfo(this.imageDimensions,this.voxelDimensions),this.origin=
  this.orientation.convertCoordinate(this.fileFormat.getOrigin(),new papaya.core.Coordinate(0,0,0)),this.imageRange=this.fileFormat.getImageRange(),this.imageRange.isValid()||(this.error=Error(papaya.volume.Header.INVALID_IMAGE_RANGE)),this.imageDescription=this.fileFormat.getImageDescription());this.onFinishedFileFormatRead()};papaya.volume.Header.prototype.getName=function(){return this.fileFormat.getName()};
  papaya.volume.Header.prototype.readImageData=function(b,a){this.fileFormat.readImageData(b,a)};papaya.volume.Header.prototype.hasError=function(){return null!==this.error};papaya.volume.Header.prototype.getBestTransform=function(){return this.fileFormat.getBestTransform()};papaya.volume.Header.prototype.getBestTransformOrigin=function(){return this.fileFormat.getBestTransformOrigin()};papaya.volume.Header.prototype.toString=function(){return this.fileFormat.toString()};"use strict";
  papaya=papaya||{};papaya.volume=papaya.volume||{};papaya.volume.ImageData=papaya.volume.ImageData||function(b){this.data=null;this.pad=b};
  papaya.volume.ImageData.prototype.readFileData=function(b,a,c){var d,e;this.pad&&(a=this.padIsometric(b,a));if(b.imageType.datatype===papaya.volume.ImageType.DATATYPE_RGB)if(d=a.byteLength/3,e=2*d,b=b.imageType.rgbBySample,a=new DataView(a,0),this.data=new Uint32Array(d),b){for(b=0;b<d;b+=1)this.data[b]|=a.getUint8(b)<<16;for(b=0;b<d;b+=1)this.data[b]|=a.getUint8(b+d)<<8;for(b=0;b<d;b+=1)this.data[b]|=a.getUint8(b+e)}else for(b=0;b<d;b+=1)this.data[b]=a.getUint8(3*b)<<16|a.getUint8(3*b+1)<<8|a.getUint8(3*
  b+2);else if(b.imageType.datatype===papaya.volume.ImageType.DATATYPE_INTEGER_SIGNED&&1===b.imageType.numBytes)this.data=new Int8Array(a,0,a.byteLength);else if(b.imageType.datatype===papaya.volume.ImageType.DATATYPE_INTEGER_UNSIGNED&&1===b.imageType.numBytes)this.data=new Uint8Array(a,0,a.byteLength);else if(b.imageType.datatype===papaya.volume.ImageType.DATATYPE_INTEGER_SIGNED&&2===b.imageType.numBytes)this.data=new Int16Array(a,0,a.byteLength/2);else if(b.imageType.datatype===papaya.volume.ImageType.DATATYPE_INTEGER_UNSIGNED&&
  2===b.imageType.numBytes)this.data=new Uint16Array(a,0,a.byteLength/2);else if(b.imageType.datatype===papaya.volume.ImageType.DATATYPE_INTEGER_SIGNED&&4===b.imageType.numBytes)this.data=new Int32Array(a,0,a.byteLength/4);else if(b.imageType.datatype===papaya.volume.ImageType.DATATYPE_INTEGER_UNSIGNED&&4===b.imageType.numBytes)this.data=new Uint32Array(a,0,a.byteLength/4);else if(b.imageType.datatype===papaya.volume.ImageType.DATATYPE_FLOAT&&4===b.imageType.numBytes)if(b.imageType.swapped)for(d=a.byteLength/
  Float32Array.BYTES_PER_ELEMENT,a=new DataView(a,0),this.data=new Float32Array(d),b=0;b<d;b+=1)this.data[b]=a.getFloat32(b*Float32Array.BYTES_PER_ELEMENT);else this.data=new Float32Array(a,0,a.byteLength/4);else if(b.imageType.datatype===papaya.volume.ImageType.DATATYPE_FLOAT&&8===b.imageType.numBytes)if(b.imageType.swapped)for(d=a.byteLength/Float64Array.BYTES_PER_ELEMENT,a=new DataView(a,0),this.data=new Float64Array(d),b=0;b<d;b+=1)this.data[b]=a.getFloat64(b*Float64Array.BYTES_PER_ELEMENT);else this.data=
  new Float64Array(a,0,a.byteLength/8);c()};
  papaya.volume.ImageData.prototype.padIsometric=function(b,a){for(var c=b.imageDimensions,d=b.voxelDimensions,e=b.imageType.numBytes,f=new Uint8Array(a,0,a.byteLength),h=c.colsOrig,g=c.rowsOrig,c=c.slicesOrig,m=h*d.colSize,l=g*d.rowSize,q=c*d.sliceSize,u=Math.max(Math.max(m,l),q),m=parseInt((u-m)/d.colSize/2,10),l=parseInt((u-l)/d.rowSize/2,10),u=parseInt((u-q)/d.sliceSize/2,10),w=h+2*m,C=g+2*l,h=h*e,m=m*e,l=l*w*e,B=u*w*C*e,q=d=0,e=new ArrayBuffer(w*C*(c+2*u)*e),u=new Uint8Array(e,0,e.byteLength),
  d=d+B,w=0;w<c;w+=1){d+=l;for(C=0;C<g;C+=1){d+=m;for(B=0;B<h;B+=1,q++,d++)u[d]=f[q];d+=m}d+=l}return e};"use strict";papaya=papaya||{};papaya.volume=papaya.volume||{};papaya.volume.ImageDescription=papaya.volume.ImageDescription||function(b){this.notes="(none)";papaya.utilities.StringUtils.isStringBlank(b)||(this.notes=b)};"use strict";papaya=papaya||{};papaya.volume=papaya.volume||{};
  papaya.volume.ImageDimensions=papaya.volume.ImageDimensions||function(b,a,c,d){this.cols=b;this.rows=a;this.slices=c;this.colsOrig=b;this.rowsOrig=a;this.slicesOrig=c;this.zDim=this.yDim=this.xDim=-1;this.timepoints=d||1;this.dataOffsets=[];this.dataLengths=[]};
  papaya.volume.ImageDimensions.prototype.padIsometric=function(b){var a=this.cols,c=this.rows,d=this.slices,e=a*b.colSize,f=c*b.rowSize,h=d*b.sliceSize,g=Math.max(Math.max(e,f),h),e=parseInt((g-e)/b.colSize/2,10),f=parseInt((g-f)/b.rowSize/2,10);b=parseInt((g-h)/b.sliceSize/2,10);this.cols=a+2*e;this.rows=c+2*f;this.slices=d+2*b};papaya.volume.ImageDimensions.prototype.getNumVoxelsSeries=function(){return this.cols*this.rows*this.slices*this.timepoints};
  papaya.volume.ImageDimensions.prototype.getNumVoxelsSlice=function(){return this.rows*this.cols};papaya.volume.ImageDimensions.prototype.getNumVoxelsVolume=function(){return this.rows*this.cols*this.slices};papaya.volume.ImageDimensions.prototype.isValid=function(){return 0<this.cols&&0<this.rows&&0<this.slices&&0<this.timepoints&&0<=this.dataOffsets[0]&&0<=this.dataLengths[0]};var moduleType=typeof module;"undefined"!==moduleType&&module.exports&&(module.exports.ImageDimensions=papaya.volume.ImageDimensions);
  "use strict";papaya=papaya||{};papaya.volume=papaya.volume||{};papaya.volume.ImageRange=papaya.volume.ImageRange||function(b,a){this.displayMin=b;this.displayMax=a;this.imageMax=this.imageMin=0;this.dataScaleSlopes=[];this.dataScaleIntercepts=[];this.globalDataScaleSlope=1;this.globalDataScaleIntercept=0;this.usesGlobalDataScale=!1};papaya.volume.ImageRange.DEFAULT_SCALE=1;papaya.volume.ImageRange.DEFAULT_INTERCEPT=0;papaya.volume.ImageRange.prototype.isValid=function(){return!0};
  papaya.volume.ImageRange.prototype.setGlobalDataScale=function(b,a){this.globalDataScaleSlope=b;this.globalDataScaleIntercept=a;this.usesGlobalDataScale=!0;this.dataScaleSlopes=[];this.dataScaleIntercepts=[]};
  papaya.volume.ImageRange.prototype.validateDataScale=function(){var b,a,c=!1;if(1!==this.globalDataScaleSlope||0!==this.globalDataScaleIntercept)this.dataScaleSlopes=[],this.dataScaleIntercepts=[],this.usesGlobalDataScale=!0;else if(0<this.dataScaleSlopes.length&&0<this.dataScaleIntercepts.length){a=this.dataScaleSlopes[0];for(b=1;b<this.dataScaleSlopes.length;b+=1)if(a!==this.dataScaleSlopes[b]){c=!0;break}a=this.dataScaleIntercepts[0];for(b=1;b<this.dataScaleIntercepts.length;b+=1)if(a!==this.dataScaleIntercepts[b]){c=
  !0;break}c?this.usesGlobalDataScale=!1:this.setGlobalDataScale(this.dataScaleSlopes[0],this.dataScaleIntercepts[0])}else this.setGlobalDataScale(1,0)};"use strict";papaya=papaya||{};papaya.volume=papaya.volume||{};papaya.volume.ImageType=papaya.volume.ImageType||function(b,a,c,d){this.datatype=b;this.numBytes=a;this.littleEndian=c;this.swapped=!1;this.compressed=d;this.rgbBySample=!1};papaya.volume.ImageType.DATATYPE_UNKNOWN=0;papaya.volume.ImageType.DATATYPE_INTEGER_SIGNED=1;
  papaya.volume.ImageType.DATATYPE_INTEGER_UNSIGNED=2;papaya.volume.ImageType.DATATYPE_FLOAT=3;papaya.volume.ImageType.DATATYPE_RGB=4;papaya.volume.ImageType.MAX_SUPPORTED_BYTES_FLOAT=8;papaya.volume.ImageType.MAX_SUPPORTED_BYTES_INTEGER=4;
  papaya.volume.ImageType.prototype.isValid=function(){return this.datatype<=papaya.volume.ImageType.DATATYPE_RGB&&this.datatype>papaya.volume.ImageType.DATATYPE_UNKNOWN&&0<this.numBytes&&(this.datatype===papaya.volume.ImageType.DATATYPE_FLOAT&&this.numBytes<=papaya.volume.ImageType.MAX_SUPPORTED_BYTES_FLOAT||this.datatype!==papaya.volume.ImageType.DATATYPE_FLOAT&&this.numBytes<=papaya.volume.ImageType.MAX_SUPPORTED_BYTES_INTEGER)};
  papaya.volume.ImageType.prototype.getTypeDescription=function(){return this.datatype===papaya.volume.ImageType.DATATYPE_INTEGER_SIGNED?"Signed Integer":this.datatype===papaya.volume.ImageType.DATATYPE_INTEGER_UNSIGNED?"Unsigned Integer":this.datatype===papaya.volume.ImageType.DATATYPE_FLOAT?"Float":this.datatype===papaya.volume.ImageType.DATATYPE_RGB?"RGB":"Unknown"};
  papaya.volume.ImageType.prototype.getOrderDescription=function(){return 1<this.numBytes?this.littleEndian?"Little Endian":"Big Endian":null};"use strict";papaya=papaya||{};papaya.volume=papaya.volume||{};papaya.volume.nifti=papaya.volume.nifti||{};papaya.volume.nifti.HeaderNIFTI=papaya.volume.nifti.HeaderNIFTI||function(){this.nifti=null;this.compressed=this.isNIFTI2=!1;this.imageData=null};papaya.volume.nifti.HeaderNIFTI.ORIENTATION_DEFAULT="XYZ-++";
  papaya.volume.nifti.HeaderNIFTI.SPATIAL_UNITS_MASK=7;papaya.volume.nifti.HeaderNIFTI.TEMPORAL_UNITS_MASK=56;papaya.volume.nifti.HeaderNIFTI.isThisFormat=function(b,a){return-1!==b.indexOf(".nii")?!0:nifti.isNIFTI(a[0])};papaya.volume.nifti.HeaderNIFTI.prototype.readHeaderData=function(b,a,c,d){this.nifti=nifti.readHeader(b[0]);this.isNIFTI2=nifti.isNIFTI2(b[0]);this.imageData=nifti.readImage(this.nifti,b[0]);d()};
  papaya.volume.nifti.HeaderNIFTI.prototype.readImageData=function(b,a){a(this.imageData);this.imageData=null};papaya.volume.nifti.HeaderNIFTI.prototype.getImageDimensions=function(){var b=new papaya.volume.ImageDimensions(this.nifti.dims[1],this.nifti.dims[2],this.nifti.dims[3],this.nifti.dims[4]);b.dataOffsets[0]=this.nifti.vox_offset;b.dataLengths[0]=b.getNumVoxelsSeries()*(this.nifti.numBitsPerVoxel/8);return b};papaya.volume.nifti.HeaderNIFTI.prototype.getName=function(){return null};
  papaya.volume.nifti.HeaderNIFTI.prototype.getVoxelDimensions=function(){var b;b=new papaya.volume.VoxelDimensions(this.nifti.pixDims[1],this.nifti.pixDims[2],this.nifti.pixDims[3],this.nifti.pixDims[4]);b.spatialUnit=this.nifti.xyzt_units&papaya.volume.nifti.HeaderNIFTI.SPATIAL_UNITS_MASK;b.temporalUnit=this.nifti.xyzt_units&papaya.volume.nifti.HeaderNIFTI.TEMPORAL_UNITS_MASK;b.flip=-1===this.nifti.pixDims[0];return b};
  papaya.volume.nifti.HeaderNIFTI.prototype.getImageType=function(){var b=papaya.volume.ImageType.DATATYPE_UNKNOWN;this.nifti.datatypeCode===nifti.NIFTI1.TYPE_UINT8||this.nifti.datatypeCode===nifti.NIFTI1.TYPE_UINT16||this.nifti.datatypeCode===nifti.NIFTI1.TYPE_UINT32||this.nifti.datatypeCode===nifti.NIFTI1.TYPE_UINT64?b=papaya.volume.ImageType.DATATYPE_INTEGER_UNSIGNED:this.nifti.datatypeCode===nifti.NIFTI1.TYPE_INT8||this.nifti.datatypeCode===nifti.NIFTI1.TYPE_INT16||this.nifti.datatypeCode===nifti.NIFTI1.TYPE_INT32||
  this.nifti.datatypeCode===nifti.NIFTI1.TYPE_INT64?b=papaya.volume.ImageType.DATATYPE_INTEGER_SIGNED:this.nifti.datatypeCode===nifti.NIFTI1.TYPE_FLOAT32||this.nifti.datatypeCode===nifti.NIFTI1.TYPE_FLOAT64?b=papaya.volume.ImageType.DATATYPE_FLOAT:this.nifti.datatypeCode===nifti.NIFTI1.TYPE_RGB24&&(b=papaya.volume.ImageType.DATATYPE_RGB);return new papaya.volume.ImageType(b,this.nifti.numBitsPerVoxel/8,this.nifti.littleEndian,this.compressed)};
  papaya.volume.nifti.HeaderNIFTI.prototype.getOrientation=function(){var b=null;0<this.nifti.qform_code&&!this.qFormHasRotations()&&(b=this.getOrientationQform());this.nifti.sform_code>this.nifti.qform_code&&!this.sFormHasRotations()&&(b=this.getOrientationSform());null===b&&(b=papaya.volume.nifti.HeaderNIFTI.ORIENTATION_DEFAULT);return new papaya.volume.Orientation(b)};
  papaya.volume.nifti.HeaderNIFTI.prototype.getOrientationQform=function(){var b=papaya.volume.nifti.HeaderNIFTI.ORIENTATION_DEFAULT,b=this.nifti.convertNiftiQFormToNiftiSForm(this.nifti.quatern_b,this.nifti.quatern_c,this.nifti.quatern_d,this.nifti.qoffset_x,this.nifti.qoffset_y,this.nifti.qoffset_z,this.nifti.pixDims[1],this.nifti.pixDims[2],this.nifti.pixDims[3],this.nifti.pixDims[0]);0<this.nifti.qform_code?(b=this.nifti.convertNiftiSFormToNEMA(b),papaya.volume.Orientation.isValidOrientationString(b)||
  (b=papaya.volume.nifti.HeaderNIFTI.ORIENTATION_DEFAULT)):b=papaya.volume.nifti.HeaderNIFTI.ORIENTATION_DEFAULT;return b};papaya.volume.nifti.HeaderNIFTI.prototype.getOrientationSform=function(){var b=this.nifti.convertNiftiSFormToNEMA(this.nifti.affine);papaya.volume.Orientation.isValidOrientationString(b)||(b=papaya.volume.nifti.HeaderNIFTI.ORIENTATION_DEFAULT);return b};papaya.volume.nifti.HeaderNIFTI.prototype.getQformMatCopy=function(){return this.nifti.getQformMat().clone()};
  papaya.volume.nifti.HeaderNIFTI.prototype.getSformMatCopy=function(){return this.nifti.affine.clone()};
  papaya.volume.nifti.HeaderNIFTI.prototype.getOrigin=function(b,a){var c=new papaya.core.Coordinate(0,0,0),d,e,f,h,g,m,l;0<this.nifti.qform_code&&!a?this.qFormHasRotations()?(d=this.nifti.getQformMat(),d=numeric.inv(d),c.setCoordinate(d[0][3],d[1][3],d[2][3])):(d=this.nifti.convertNiftiQFormToNiftiSForm(this.nifti.quatern_b,this.nifti.quatern_c,this.nifti.quatern_d,this.nifti.qoffset_x,this.nifti.qoffset_y,this.nifti.qoffset_z,this.nifti.pixDims[1],this.nifti.pixDims[2],this.nifti.pixDims[3],this.nifti.pixDims[0]),
  d=this.nifti.convertNiftiSFormToNEMA(d),papaya.volume.Orientation.isValidOrientationString(d)||(d=papaya.volume.nifti.HeaderNIFTI.ORIENTATION_DEFAULT),f=d.substring(0,3).toUpperCase(),e=d.substring(3),d=f.indexOf("X"),h=f.indexOf("Y"),f=f.indexOf("Z"),g="+"===e.charAt(d),m="+"===e.charAt(h),l="+"===e.charAt(f),e=Array(3),e[0]=this.nifti.qoffset_x/this.nifti.pixDims[d+1]*(g?-1:1),e[1]=this.nifti.qoffset_y/this.nifti.pixDims[h+1]*(m?-1:1),e[2]=this.nifti.qoffset_z/this.nifti.pixDims[f+1]*(l?-1:1),c.setCoordinate(e[0],
  e[1],e[2],!0)):0<this.nifti.sform_code&&!b&&(this.sFormHasRotations()?(d=numeric.inv(this.nifti.affine),c.setCoordinate(d[0][3],d[1][3],d[2][3])):(d=this.nifti.convertNiftiSFormToNEMA(this.nifti.affine),papaya.volume.Orientation.isValidOrientationString(d)||(d=papaya.volume.nifti.HeaderNIFTI.ORIENTATION_DEFAULT),f=d.substring(0,3).toUpperCase(),e=d.substring(3),d=f.indexOf("X"),h=f.indexOf("Y"),f=f.indexOf("Z"),g="+"===e.charAt(d),m="+"===e.charAt(h),l="+"===e.charAt(f),e=Array(3),e[0]=this.nifti.affine[0][3]/
  this.nifti.pixDims[d+1]*(g?-1:1),e[1]=this.nifti.affine[1][3]/this.nifti.pixDims[h+1]*(m?-1:1),e[2]=this.nifti.affine[2][3]/this.nifti.pixDims[f+1]*(l?-1:1),c.setCoordinate(e[0],e[1],e[2],!0)));c.isAllZeros()&&c.setCoordinate(this.nifti.dims[1]/2,this.nifti.dims[2]/2,this.nifti.dims[3]/2);return c};papaya.volume.nifti.HeaderNIFTI.prototype.qFormHasRotations=function(){return papaya.volume.Transform.hasRotations(this.getQformMatCopy())};papaya.volume.nifti.HeaderNIFTI.prototype.sFormHasRotations=function(){return papaya.volume.Transform.hasRotations(this.getSformMatCopy())};
  papaya.volume.nifti.HeaderNIFTI.prototype.getImageRange=function(){var b=new papaya.volume.ImageRange(this.nifti.cal_min,this.nifti.cal_max),a=this.nifti.scl_slope,c=this.getImageDimensions();0===a&&(a=1);b.setGlobalDataScale(a,this.nifti.scl_inter,c.slices*c.timepoints);b.validateDataScale();return b};papaya.volume.nifti.HeaderNIFTI.prototype.hasError=function(){return!1};papaya.volume.nifti.HeaderNIFTI.prototype.getImageDescription=function(){return new papaya.volume.ImageDescription(this.nifti.description)};
  papaya.volume.nifti.HeaderNIFTI.prototype.getOrientationCertainty=function(){var b,a;b=papaya.volume.Header.ORIENTATION_CERTAINTY_UNKNOWN;if(0<this.nifti.qform_code||0<this.nifti.sform_code)b=papaya.volume.Header.ORIENTATION_CERTAINTY_LOW,a=this.getOrigin(),null===a||a.isAllZeros()||(b=papaya.volume.Header.ORIENTATION_CERTAINTY_HIGH);return b};
  papaya.volume.nifti.HeaderNIFTI.prototype.getBestTransform=function(){return 0<this.nifti.qform_code&&this.nifti.qform_code>this.nifti.sform_code&&this.qFormHasRotations()?this.getQformMatCopy():0<this.nifti.sform_code&&this.nifti.sform_code>=this.nifti.qform_code&&this.sFormHasRotations()?this.getSformMatCopy():null};
  papaya.volume.nifti.HeaderNIFTI.prototype.getBestTransformOrigin=function(){return 0<this.nifti.qform_code&&this.nifti.qform_code>this.nifti.sform_code&&this.qFormHasRotations()?this.getOrigin(!0,!1):0<this.nifti.sform_code&&this.nifti.sform_code>=this.nifti.qform_code&&this.sFormHasRotations()?this.getOrigin(!1,!0):null};
  papaya.volume.nifti.HeaderNIFTI.prototype.toString=function(){var b=papaya.utilities.StringUtils.formatNumber,a="";this.isNIFTI2?(a+="<span style='color:#B5CBD3'>Datatype</span><span style='color:gray'> = </span>"+this.nifti.datatypeCode+" ("+this.nifti.getDatatypeCodeString(this.nifti.datatypeCode)+")<br />",a+="<span style='color:#B5CBD3'>Bits Per Voxel</span><span style='color:gray'> = </span>"+this.nifti.numBitsPerVoxel+"<br />",a+="<span style='color:#B5CBD3'>Image Dimensions</span> (1-8): "+
  this.nifti.dims[0]+", "+this.nifti.dims[1]+", "+this.nifti.dims[2]+", "+this.nifti.dims[3]+", "+this.nifti.dims[4]+", "+this.nifti.dims[5]+", "+this.nifti.dims[6]+", "+this.nifti.dims[7]+"<br />",a+="<span style='color:#B5CBD3'>Intent Parameters</span> (1-3): "+this.nifti.intent_p1+", "+this.nifti.intent_p2+", "+this.nifti.intent_p3+"<br />",a+="<span style='color:#B5CBD3'>Voxel Dimensions</span> (1-8): "+b(this.nifti.pixDims[0])+", "+b(this.nifti.pixDims[1])+", "+b(this.nifti.pixDims[2])+", "+b(this.nifti.pixDims[3])+
  ", "+b(this.nifti.pixDims[4])+", "+b(this.nifti.pixDims[5])+", "+b(this.nifti.pixDims[6])+", "+b(this.nifti.pixDims[7])+"<br />",a+="<span style='color:#B5CBD3'>Image Offset</span><span style='color:gray'> = </span>"+this.nifti.vox_offset+"<br />",a+="<span style='color:#B5CBD3'>Data Scale:  Slope</span><span style='color:gray'> = </span>"+this.nifti.scl_slope+"  <span style='color:#B5CBD3'>Intercept</span><span style='color:gray'> = </span>"+this.nifti.scl_inter+"<br />",a+="<span style='color:#B5CBD3'>Display Range:  Max</span><span style='color:gray'> = </span>"+
  this.nifti.cal_max+"  <span style='color:#B5CBD3'>Min</span><span style='color:gray'> = </span>"+this.nifti.cal_min+"<br />",a+="<span style='color:#B5CBD3'>Slice Duration</span><span style='color:gray'> = </span>"+this.nifti.slice_duration+"<br />",a+="<span style='color:#B5CBD3'>Time Axis Shift</span><span style='color:gray'> = </span>"+this.nifti.toffset+"<br />",a+="<span style='color:#B5CBD3'>Slice Start</span><span style='color:gray'> = </span>"+this.nifti.slice_start+"<br />",a+="<span style='color:#B5CBD3'>Slice End</span><span style='color:gray'> = </span>"+
  this.nifti.slice_end+"<br />",a+="<span style='color:#B5CBD3'>Description</span>: \""+this.nifti.description+'"<br />',a+="<span style='color:#B5CBD3'>Auxiliary File</span>: \""+this.nifti.aux_file+'"<br />',a+="<span style='color:#B5CBD3'>Q-Form Code</span><span style='color:gray'> = </span>"+this.nifti.qform_code+" ("+this.nifti.getTransformCodeString(this.nifti.qform_code)+")<br />",a+="<span style='color:#B5CBD3'>S-Form Code</span><span style='color:gray'> = </span>"+this.nifti.sform_code+" ("+
  this.nifti.getTransformCodeString(this.nifti.sform_code)+")<br />",a+="<span style='color:#B5CBD3'>Quaternion Parameters</span>:  <span style='color:#B5CBD3'>b</span> <span style='color:gray'>=</span> "+b(this.nifti.quatern_b)+"  <span style='color:#B5CBD3'>c</span> <span style='color:gray'>=</span> "+b(this.nifti.quatern_c)+"  <span style='color:#B5CBD3'>d</span> <span style='color:gray'>=</span> "+b(this.nifti.quatern_d)+"<br />",a+="<span style='color:#B5CBD3'>Quaternion Offsets</span>:  <span style='color:#B5CBD3'>x</span> <span style='color:gray'>=</span> "+
  this.nifti.qoffset_x+"  <span style='color:#B5CBD3'>y</span> <span style='color:gray'>=</span> "+this.nifti.qoffset_y+"  <span style='color:#B5CBD3'>z</span> <span style='color:gray'>=</span> "+this.nifti.qoffset_z+"<br />",a+="<span style='color:#B5CBD3'>S-Form Parameters X</span>: "+b(this.nifti.affine[0][0])+", "+b(this.nifti.affine[0][1])+", "+b(this.nifti.affine[0][2])+", "+b(this.nifti.affine[0][3])+"<br />",a+="<span style='color:#B5CBD3'>S-Form Parameters Y</span>: "+b(this.nifti.affine[1][0])+
  ", "+b(this.nifti.affine[1][1])+", "+b(this.nifti.affine[1][2])+", "+b(this.nifti.affine[1][3])+"<br />",a+="<span style='color:#B5CBD3'>S-Form Parameters Z</span>: "+b(this.nifti.affine[2][0])+", "+b(this.nifti.affine[2][1])+", "+b(this.nifti.affine[2][2])+", "+b(this.nifti.affine[2][3])+"<br />",a+="<span style='color:#B5CBD3'>Slice Code</span><span style='color:gray'> = </span>"+this.nifti.slice_code+"<br />",a+="<span style='color:#B5CBD3'>Units Code</span><span style='color:gray'> = </span>"+
  this.nifti.xyzt_units+" ("+this.nifti.getUnitsCodeString(nifti.NIFTI1.SPATIAL_UNITS_MASK&this.nifti.xyzt_units)+", "+this.nifti.getUnitsCodeString(nifti.NIFTI1.TEMPORAL_UNITS_MASK&this.nifti.xyzt_units)+")<br />",a+="<span style='color:#B5CBD3'>Intent Code </span><span style='color:gray'> = </span>"+this.nifti.intent_code+"<br />",a+="<span style='color:#B5CBD3'>Intent Name</span>: \""+this.nifti.intent_name+'"<br />',a+="<span style='color:#B5CBD3'>Dim Info </span><span style='color:gray'> = </span>"+
  this.nifti.dim_info+"<br />"):(a+="<span style='color:#B5CBD3'>Dim Info</span><span style='color:gray'> = </span>"+this.nifti.dim_info+"<br />",a+="<span style='color:#B5CBD3'>Image Dimensions</span> (1-8): "+this.nifti.dims[0]+", "+this.nifti.dims[1]+", "+this.nifti.dims[2]+", "+this.nifti.dims[3]+", "+this.nifti.dims[4]+", "+this.nifti.dims[5]+", "+this.nifti.dims[6]+", "+this.nifti.dims[7]+"<br />",a+="<span style='color:#B5CBD3'>Intent Parameters</span> (1-3): "+this.nifti.intent_p1+", "+this.nifti.intent_p2+
  ", "+this.nifti.intent_p3+"<br />",a+="<span style='color:#B5CBD3'>Intent Code</span><span style='color:gray'> = </span>"+this.nifti.intent_code+"<br />",a+="<span style='color:#B5CBD3'>Datatype</span><span style='color:gray'> = </span>"+this.nifti.datatypeCode+" ("+this.nifti.getDatatypeCodeString(this.nifti.datatypeCode)+")<br />",a+="<span style='color:#B5CBD3'>Bits Per Voxel</span><span style='color:gray'> = </span>"+this.nifti.numBitsPerVoxel+"<br />",a+="<span style='color:#B5CBD3'>Slice Start</span><span style='color:gray'> = </span>"+
  this.nifti.slice_start+"<br />",a+="<span style='color:#B5CBD3'>Voxel Dimensions</span> (1-8): "+b(this.nifti.pixDims[0])+", "+b(this.nifti.pixDims[1])+", "+b(this.nifti.pixDims[2])+", "+b(this.nifti.pixDims[3])+", "+b(this.nifti.pixDims[4])+", "+b(this.nifti.pixDims[5])+", "+b(this.nifti.pixDims[6])+", "+b(this.nifti.pixDims[7])+"<br />",a+="<span style='color:#B5CBD3'>Image Offset</span><span style='color:gray'> = </span>"+this.nifti.vox_offset+"<br />",a+="<span style='color:#B5CBD3'>Data Scale</span>:  <span style='color:#B5CBD3'>Slope</span> = "+
  this.nifti.scl_slope+"  <span style='color:#B5CBD3'>Intercept</span> = "+this.nifti.scl_inter+"<br />",a+="<span style='color:#B5CBD3'>Slice End</span><span style='color:gray'> = </span>"+this.nifti.slice_end+"<br />",a+="<span style='color:#B5CBD3'>Slice Code</span><span style='color:gray'> = </span>"+this.nifti.slice_code+"<br />",a+="<span style='color:#B5CBD3'>Units Code</span><span style='color:gray'> = </span>"+this.nifti.xyzt_units+" ("+this.nifti.getUnitsCodeString(nifti.NIFTI1.SPATIAL_UNITS_MASK&
  this.nifti.xyzt_units)+", "+this.nifti.getUnitsCodeString(nifti.NIFTI1.TEMPORAL_UNITS_MASK&this.nifti.xyzt_units)+")<br />",a+="<span style='color:#B5CBD3'>Display Range</span>:  <span style='color:#B5CBD3'>Max</span><span style='color:gray'> = </span>"+this.nifti.cal_max+"  <span style='color:#B5CBD3'>Min</span><span style='color:gray'> = </span>"+this.nifti.cal_min+"<br />",a+="<span style='color:#B5CBD3'>Slice Duration</span><span style='color:gray'> = </span>"+this.nifti.slice_duration+"<br />",
  a+="<span style='color:#B5CBD3'>Time Axis Shift</span><span style='color:gray'> = </span>"+this.nifti.toffset+"<br />",a+="<span style='color:#B5CBD3'>Description</span>: \""+this.nifti.description+'"<br />',a+="<span style='color:#B5CBD3'>Auxiliary File</span>: \""+this.nifti.aux_file+'"<br />',a+="<span style='color:#B5CBD3'>Q-Form Code</span><span style='color:gray'> = </span>"+this.nifti.qform_code+" ("+this.nifti.getTransformCodeString(this.nifti.qform_code)+")<br />",a+="<span style='color:#B5CBD3'>S-Form Code</span><span style='color:gray'> = </span>"+
  this.nifti.sform_code+" ("+this.nifti.getTransformCodeString(this.nifti.sform_code)+")<br />",a+="<span style='color:#B5CBD3'>Quaternion Parameters</span>:  <span style='color:#B5CBD3'>b</span><span style='color:gray'> = </span>"+b(this.nifti.quatern_b)+"  <span style='color:#B5CBD3'>c</span><span style='color:gray'> = </span>"+b(this.nifti.quatern_c)+"  <span style='color:#B5CBD3'>d</span><span style='color:gray'> = </span>"+b(this.nifti.quatern_d)+"<br />",a+="<span style='color:#B5CBD3'>Quaternion Offsets</span>:  <span style='color:#B5CBD3'>x</span><span style='color:gray'> = </span>"+
  this.nifti.qoffset_x+"  <span style='color:#B5CBD3'>y</span><span style='color:gray'> = </span>"+this.nifti.qoffset_y+"  <span style='color:#B5CBD3'>z</span><span style='color:gray'> = </span>"+this.nifti.qoffset_z+"<br />",a+="<span style='color:#B5CBD3'>S-Form Parameters X</span>: "+b(this.nifti.affine[0][0])+", "+b(this.nifti.affine[0][1])+", "+b(this.nifti.affine[0][2])+", "+b(this.nifti.affine[0][3])+"<br />",a+="<span style='color:#B5CBD3'>S-Form Parameters Y</span>: "+b(this.nifti.affine[1][0])+
  ", "+b(this.nifti.affine[1][1])+", "+b(this.nifti.affine[1][2])+", "+b(this.nifti.affine[1][3])+"<br />",a+="<span style='color:#B5CBD3'>S-Form Parameters Z</span>: "+b(this.nifti.affine[2][0])+", "+b(this.nifti.affine[2][1])+", "+b(this.nifti.affine[2][2])+", "+b(this.nifti.affine[2][3])+"<br />",a+="<span style='color:#B5CBD3'>Intent Name</span>: \""+this.nifti.intent_name+'"<br />');return a};"use strict";papaya=papaya||{};papaya.volume=papaya.volume||{};
  papaya.volume.dicom=papaya.volume.dicom||{};papaya.volume.dicom.HeaderDICOM=papaya.volume.dicom.HeaderDICOM||function(){this.series=null;this.seriesMap=[];this.dialogHandler=this.onFinishedHeaderRead=this.error=null};papaya.volume.dicom.HeaderDICOM.ORIENTATION_DEFAULT="XYZ+--";papaya.volume.dicom.HeaderDICOM.SUPPORTED_TRANSFER_SYNTAXES="1.2.840.10008.1.2 1.2.840.10008.1.2.1 1.2.840.10008.1.2.2 1.2.840.10008.1.2.1.99 1.2.840.10008.1.2.4.50 1.2.840.10008.1.2.4.51 1.2.840.10008.1.2.4.57 1.2.840.10008.1.2.4.70 1.2.840.10008.1.2.4.90 1.2.840.10008.1.2.4.91 1.2.840.10008.1.2.5".split(" ");
  papaya.volume.dicom.HeaderDICOM.isThisFormat=function(b,a){var c,d,e,f,h=0;if(-1!==b.indexOf(".dcm"))return!0;c=new DataView(a[0]);d=daikon.Parser.MAGIC_COOKIE_OFFSET;e=daikon.Parser.MAGIC_COOKIE.length;for(f=0;f<e;f+=1)c.getUint8(d+f)===daikon.Parser.MAGIC_COOKIE[f]&&(h+=1);if(4===h)return!0;d=new daikon.Parser;c=d.testForValidTag(c);return null!==c&&8>=c.group&&!d.hasError()};
  papaya.volume.dicom.HeaderDICOM.prototype.setSeries=function(b,a){var c;for(c=0;c<Object.keys(this.seriesMap).length;c+=1)if(-1!==Object.keys(this.seriesMap)[c].indexOf(a)){this.series=this.seriesMap[Object.keys(this.seriesMap)[c]];break}};papaya.volume.dicom.HeaderDICOM.prototype.getDataScaleSlope=function(b,a){return b?a.getDataScaleElscint()||1:a.getDataScaleSlope()||1};papaya.volume.dicom.HeaderDICOM.prototype.getDataScaleIntercept=function(b,a){return b?0:a.getDataScaleIntercept()||0};
  papaya.volume.dicom.HeaderDICOM.prototype.finishedHeaderRead=function(){var b,a;if(this.error)this.onFinishedHeaderRead();else if(1<Object.keys(this.seriesMap).length){this.series=this.seriesMap[Object.keys(this.seriesMap)[0]];b=[];for(a=0;a<Object.keys(this.seriesMap).length;a+=1)b.push(this.seriesMap[Object.keys(this.seriesMap)[a]]);b={items:[{label:"Select:",field:"series",options:b}]};this.dialogHandler.showDialog("Select DICOM Series",b,this,papaya.utilities.ObjectUtils.bind(this,this.setSeries),
  papaya.utilities.ObjectUtils.bind(this,this.finishedSeriesSelection))}else this.series=this.seriesMap[Object.keys(this.seriesMap)[0]],0<this.series.images.length?(this.series.buildSeries(),this.isTransferSyntaxSupported()||(this.error=Error("This transfer syntax is currently not supported!"))):this.error=Error("No images found!"),this.onFinishedHeaderRead()};
  papaya.volume.dicom.HeaderDICOM.prototype.isTransferSyntaxSupported=function(){var b=this.series.images[0].getTransferSyntax();return papaya.utilities.StringUtils.isStringBlank(b)||papaya.utilities.ArrayUtils.contains(papaya.volume.dicom.HeaderDICOM.SUPPORTED_TRANSFER_SYNTAXES,b)};
  papaya.volume.dicom.HeaderDICOM.prototype.finishedSeriesSelection=function(){0<this.series.images.length?(this.series.buildSeries(),this.isTransferSyntaxSupported()||(this.error=Error("This transfer syntax is currently not supported!"))):this.error=Error("No images found!");this.seriesMap=null;this.onFinishedHeaderRead()};
  papaya.volume.dicom.HeaderDICOM.prototype.readHeaderData=function(b,a,c,d){this.onFinishedHeaderRead=d;this.dialogHandler=c;this.readNextHeaderData(b,0,a,papaya.utilities.ObjectUtils.bind(this,this.finishedHeaderRead))};
  papaya.volume.dicom.HeaderDICOM.prototype.readNextHeaderData=function(b,a,c,d){var e,f;a>=b.length?(c.drawProgress(1,"Reading DICOM Headers"),d()):(e=daikon.Series.parseImage(new DataView(b[a])),null===e?this.error=daikon.Series.parserError:e.hasPixelData()?(f=this.findSeries(e.getSeriesId()),f||(f=new daikon.Series,this.seriesMap[e.getSeriesId()]=f),f.addImage(e)):this.error=Error("No pixel data found!"),this.error?d():(c.drawProgress(a/b.length,"Reading DICOM Headers"),setTimeout(function(){this.readNextHeaderData(b,
  a+1,c,d)}.bind(this),0)))};papaya.volume.dicom.HeaderDICOM.prototype.getName=function(){var b=this.series.getName();return b?b:null};papaya.volume.dicom.HeaderDICOM.prototype.findSeries=function(b){return 0===Object.keys(this.seriesMap).length?null:this.seriesMap[b]};papaya.volume.dicom.HeaderDICOM.prototype.readImageData=function(b,a){this.series.concatenateImageData(b,a)};
  papaya.volume.dicom.HeaderDICOM.prototype.getImageDimensions=function(){var b,a,c;this.series.isMosaic?(b=this.series.images[0].getMosaicCols()*this.series.images[0].getMosaicRows(),b=new papaya.volume.ImageDimensions(parseInt(this.series.images[0].getCols()/this.series.images[0].getMosaicCols()),parseInt(this.series.images[0].getRows()/this.series.images[0].getMosaicRows()),b,this.series.images.length)):b=this.series.isMultiFrameVolume?new papaya.volume.ImageDimensions(this.series.images[0].getCols(),
  this.series.images[0].getRows(),this.series.numberOfFrames,1):this.series.isMultiFrameTimeseries?new papaya.volume.ImageDimensions(this.series.images[0].getCols(),this.series.images[0].getRows(),this.series.numberOfFramesInFile,this.series.numberOfFrames):this.series.isImplicitTimeseries?new papaya.volume.ImageDimensions(this.series.images[0].getCols(),this.series.images[0].getRows(),parseInt(this.series.images.length/this.series.numberOfFrames),this.series.numberOfFrames):new papaya.volume.ImageDimensions(this.series.images[0].getCols(),
  this.series.images[0].getRows(),this.series.images.length,1);c=parseInt(b.getNumVoxelsSeries()*parseInt(this.series.images[0].getBitsAllocated()/8)/this.series.images.length);for(a=0;a<this.series.images.length;a+=1)b.dataOffsets[a]=this.series.images[a].getPixelData().offsetValue,b.dataLengths[a]=c;return b};
  papaya.volume.dicom.HeaderDICOM.prototype.getVoxelDimensions=function(){var b,a;b=this.series.images[0].getPixelSpacing()||[0,0];a=Math.max(this.series.images[0].getSliceGap(),this.series.images[0].getSliceThickness());this.series.isMosaic||this.series.isMultiFrame||1===this.series.images.length||(a=Math.abs(this.series.images[0].getSliceLocation()-this.series.images[1].getSliceLocation()),0===a&&(a=Math.max(this.series.images[0].getSliceGap(),this.series.images[0].getSliceThickness())));b=new papaya.volume.VoxelDimensions(b[1],
  b[0],a,this.series.images[0].getTR()/1E3);b.isValid()||(0===b.rowSize&&(b.rowSize=1),0===b.colSize&&(b.colSize=1),0===b.sliceSize&&(b.sliceSize=1));b.spatialUnit=papaya.volume.VoxelDimensions.UNITS_MM;b.temporalUnit=papaya.volume.VoxelDimensions.UNITS_SEC;return b};
  papaya.volume.dicom.HeaderDICOM.prototype.getImageType=function(){var b;b=this.series.images[0].getDataType();b=new papaya.volume.ImageType(b===daikon.Image.BYTE_TYPE_INTEGER?papaya.volume.ImageType.DATATYPE_INTEGER_SIGNED:b===daikon.Image.BYTE_TYPE_INTEGER_UNSIGNED?papaya.volume.ImageType.DATATYPE_INTEGER_UNSIGNED:b===daikon.Image.BYTE_TYPE_FLOAT?papaya.volume.ImageType.DATATYPE_FLOAT:b===daikon.Image.BYTE_TYPE_RGB?papaya.volume.ImageType.DATATYPE_RGB:papaya.volume.ImageType.DATATYPE_UNKNOWN,parseInt(this.series.images[0].getBitsAllocated()/
  8),this.series.images[0].littleEndian,!1);b.rgbBySample=1===this.series.images[0].getPlanarConfig();return b};
  papaya.volume.dicom.HeaderDICOM.prototype.getImageRange=function(){var b,a,c,d,e,f,h,g,m,l=[],q=[];g=[];m=[];for(e=a=b=0;e<this.series.images.length;e+=1)c=this.series.images[e],d=c.getImageMax()*this.getDataScaleSlope(this.series.isElscint,c)+(c.getDataScaleIntercept()||0),c=c.getImageMin()*this.getDataScaleSlope(this.series.isElscint,c)+(c.getDataScaleIntercept()||0),0===e?(b=d,a=c):(d>b&&(b=d),c<a&&(a=c));f=d=0;if(this.series.isElscint)for(e=0;e<this.series.images.length;e+=1)c=this.series.images[e],
  h=c.getWindowWidth()*c.getDataScaleElscint(),c=c.getWindowCenter()*c.getDataScaleElscint(),0===e?(d=h,f=c):f<c&&(d=h,f=c);else for(e=0;e<this.series.images.length;e+=1)c=this.series.images[e],h=c.getWindowWidth(),c=c.getWindowCenter(),0===e?(d=h,f=c):f<c&&(d=h,f=c);b=new papaya.volume.ImageRange(a,b);b.displayMin=f-d/2;b.displayMax=f+d/2;e=this.getImageDimensions();if(this.series.isMosaic){g=e.slices;m=g*this.series.images.length;for(e=0;e<m;e+=1)c=this.series.images[parseInt(e/g)],l[e]=this.getDataScaleSlope(this.series.isElscint,
  c),q[e]=this.getDataScaleIntercept(this.series.isElscint,c);b.dataScaleSlopes=l;b.dataScaleIntercepts=q}else if(this.series.isMultiFrame){e=e.slices*e.timepoints;l=[];q=[];m=parseInt(e/this.series.images.length);for(e=0;e<this.series.images.length;e+=1)for(g=0;g<m;g+=1)c=this.series.images[e],l[e*m+g]=this.getDataScaleSlope(this.series.isElscint,c),q[e*m+g]=this.getDataScaleIntercept(this.series.isElscint,c);b.dataScaleSlopes=l;b.dataScaleIntercepts=q}else if(this.series.isImplicitTimeseries)if(e=
  e.slices*e.timepoints,this.series.images.length!==e)b.setGlobalDataScale(this.getDataScaleSlope(this.series.isElscint,this.series.images[0]),this.getDataScaleIntercept(this.series.isElscint,this.series.images[0]),this.series.numberOfFrames);else{for(e=0;e<this.series.images.length;e+=1)c=this.series.images[e],g[e]=this.getDataScaleSlope(this.series.isElscint,c),m[e]=this.getDataScaleIntercept(this.series.isElscint,c);b.dataScaleSlopes=g;b.dataScaleIntercepts=m}else{for(e=0;e<this.series.images.length;e+=
  1)c=this.series.images[e],g[e]=this.getDataScaleSlope(this.series.isElscint,c),m[e]=this.getDataScaleIntercept(this.series.isElscint,c);b.dataScaleSlopes=g;b.dataScaleIntercepts=m}b.validateDataScale();return b};papaya.volume.dicom.HeaderDICOM.prototype.getOrientation=function(){var b=this.series.images[0].getOrientation();null===b&&(b=papaya.volume.dicom.HeaderDICOM.ORIENTATION_DEFAULT);b=b.substring(0,5)+(this.series.sliceSense?"+":"-");return new papaya.volume.Orientation(b)};
  papaya.volume.dicom.HeaderDICOM.prototype.getOrientationCertainty=function(){return null===this.series.images[0].getOrientation()?papaya.volume.Header.ORIENTATION_CERTAINTY_UNKNOWN:this.series.isMosaic||this.series.isMultiFrameVolume?papaya.volume.Header.ORIENTATION_CERTAINTY_LOW:papaya.volume.Header.ORIENTATION_CERTAINTY_HIGH};
  papaya.volume.dicom.HeaderDICOM.prototype.getOrigin=function(){var b=this.getBestTransform();return b?(b=numeric.inv(b),new papaya.core.Coordinate(b[0][3],b[1][3],b[2][3])):new papaya.core.Coordinate(0,0,0)};papaya.volume.dicom.HeaderDICOM.prototype.hasError=function(){return null!==this.error};
  papaya.volume.dicom.HeaderDICOM.prototype.getImageDescription=function(){var b,a,c,d,e,f="";b=this.series.images[0].getPatientName();a=this.series.images[0].getPatientID();c=this.series.images[0].getStudyTime();d=this.series.images[0].getStudyDate();e=this.series.images[0].getImageDescription();b&&(f+=" "+b);a&&(f+=" "+a);c&&(f+=" "+c);d&&(f+=" "+d);e&&(f+=" "+e);return new papaya.volume.ImageDescription(f.trim())};
  papaya.volume.dicom.HeaderDICOM.prototype.getBestTransform=function(){var b=this.series.images[0].getImageDirections(),a=null;if(b)var a=this.getVoxelDimensions(),c=this.series.images[0].getImagePosition(),d=[b[0],b[1],b[2]],b=[b[3],b[4],b[5]],e=[d[1]*b[2]-d[2]*b[1],d[2]*b[0]-d[0]*b[2],d[0]*b[1]-d[1]*b[0]],a=[[d[0]*a.colSize*-1,b[0]*a.rowSize,e[0]*a.sliceSize,-1*c[0]],[d[1]*a.colSize,b[1]*a.rowSize*-1,e[1]*a.sliceSize,-1*c[1]],[d[2]*a.colSize,b[2]*a.rowSize,e[2]*a.sliceSize,c[2]],[0,0,0,1]];return a};
  papaya.volume.dicom.HeaderDICOM.prototype.getBestTransformOrigin=function(){return this.getOrigin()};papaya.volume.dicom.HeaderDICOM.prototype.toString=function(){return this.series.images[0].toString()};"use strict";papaya=papaya||{};papaya.volume=papaya.volume||{};papaya.volume.Orientation=papaya.volume.Orientation||function(b){this.orientation=b;this.orientMat=null;this.zIncrement=this.yIncrement=this.xIncrement=-1};papaya.volume.Orientation.DEFAULT="XYZ+--";
  papaya.volume.Orientation.isValidOrientationString=function(b){var a,c=!0;if(null===b||6!==b.length)c=!1;a=b.toUpperCase().indexOf("X");if(-1===a||2<a||b.toUpperCase().lastIndexOf("X")!==a)c=!1;a=b.toUpperCase().indexOf("Y");if(-1===a||2<a||b.toUpperCase().lastIndexOf("Y")!==a)c=!1;a=b.toUpperCase().indexOf("Z");if(-1===a||2<a||b.toUpperCase().lastIndexOf("Z")!==a)c=!1;"+"!==b.charAt(3)&&"-"!==b.charAt(3)&&(c=!1);"+"!==b.charAt(4)&&"-"!==b.charAt(4)&&(c=!1);"+"!==b.charAt(5)&&"-"!==b.charAt(5)&&(c=
  !1);return c};papaya.volume.Orientation.prototype.convertIndexToOffsetNative=function(b,a,c){return b*this.xIncrement+a*this.yIncrement+c*this.zIncrement};
  papaya.volume.Orientation.prototype.convertIndexToOffset=function(b,a,c){var d,e;d=papayaFloorFast(b*this.orientMat[0][0]+a*this.orientMat[0][1]+c*this.orientMat[0][2]+this.orientMat[0][3]);e=papayaFloorFast(b*this.orientMat[1][0]+a*this.orientMat[1][1]+c*this.orientMat[1][2]+this.orientMat[1][3]);b=papayaFloorFast(b*this.orientMat[2][0]+a*this.orientMat[2][1]+c*this.orientMat[2][2]+this.orientMat[2][3]);return d*this.xIncrement+e*this.yIncrement+b*this.zIncrement};
  papaya.volume.Orientation.prototype.convertCoordinate=function(b,a){a.x=papayaRoundFast(b.x*this.orientMat[0][0]+b.y*this.orientMat[0][1]+b.z*this.orientMat[0][2]+this.orientMat[0][3]);a.y=papayaRoundFast(b.x*this.orientMat[1][0]+b.y*this.orientMat[1][1]+b.z*this.orientMat[1][2]+this.orientMat[1][3]);a.z=papayaRoundFast(b.x*this.orientMat[2][0]+b.y*this.orientMat[2][1]+b.z*this.orientMat[2][2]+this.orientMat[2][3]);return a};
  papaya.volume.Orientation.prototype.createInfo=function(b,a){var c,d,e,f,h,g,m,l,q,u,w,C,B,A,E,D;u=b.cols;w=b.rows;C=b.slices;B=b.getNumVoxelsSlice();A=a.colSize;E=a.rowSize;D=a.sliceSize;m="+"===this.orientation.charAt(3);l="+"===this.orientation.charAt(4);q="+"===this.orientation.charAt(5);-1!==this.orientation.toUpperCase().indexOf("XYZ")?(b.xDim=u,b.yDim=w,b.zDim=C,a.xSize=A,a.ySize=E,a.zSize=D,this.xIncrement=1,this.yIncrement=u,this.zIncrement=B,m?(c=1,f=0):(c=-1,f=u-1),l?(d=-1,h=w-1):(d=1,
  h=0),q?(e=-1,g=C-1):(e=1,g=0)):-1!==this.orientation.toUpperCase().indexOf("XZY")?(b.xDim=u,b.yDim=C,b.zDim=w,a.xSize=A,a.ySize=D,a.zSize=E,this.xIncrement=1,this.yIncrement=B,this.zIncrement=u,m?(c=1,f=0):(c=-1,f=u-1),l?(e=-1,g=w-1):(e=1,g=0),q?(d=-1,h=C-1):(d=1,h=0)):-1!==this.orientation.toUpperCase().indexOf("YXZ")?(b.xDim=w,b.yDim=u,b.zDim=C,a.xSize=E,a.ySize=A,a.zSize=D,this.xIncrement=u,this.yIncrement=1,this.zIncrement=B,m?(d=-1,h=u-1):(d=1,h=0),l?(c=1,f=0):(c=-1,f=w-1),q?(e=-1,g=C-1):(e=
  1,g=0)):-1!==this.orientation.toUpperCase().indexOf("YZX")?(b.xDim=C,b.yDim=u,b.zDim=w,a.xSize=D,a.ySize=A,a.zSize=E,this.xIncrement=B,this.yIncrement=1,this.zIncrement=u,m?(d=-1,h=u-1):(d=1,h=0),l?(e=-1,g=w-1):(e=1,g=0),q?(c=1,f=0):(c=-1,f=C-1)):-1!==this.orientation.toUpperCase().indexOf("ZXY")?(b.xDim=w,b.yDim=C,b.zDim=u,a.xSize=E,a.ySize=D,a.zSize=A,this.xIncrement=u,this.yIncrement=B,this.zIncrement=1,m?(e=-1,g=u-1):(e=1,g=0),l?(c=1,f=0):(c=-1,f=w-1),q?(d=-1,h=C-1):(d=1,h=0)):-1!==this.orientation.toUpperCase().indexOf("ZYX")&&
  (b.xDim=C,b.yDim=w,b.zDim=u,a.xSize=D,a.ySize=E,a.zSize=A,this.xIncrement=B,this.yIncrement=u,this.zIncrement=1,m?(e=-1,g=u-1):(e=1,g=0),l?(d=-1,h=w-1):(d=1,h=0),q?(c=1,f=0):(c=-1,f=C-1));this.orientMat=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];this.orientMat[0][0]=c;this.orientMat[0][1]=0;this.orientMat[0][2]=0;this.orientMat[0][3]=f;this.orientMat[1][0]=0;this.orientMat[1][1]=d;this.orientMat[1][2]=0;this.orientMat[1][3]=h;this.orientMat[2][0]=0;this.orientMat[2][1]=0;this.orientMat[2][2]=e;this.orientMat[2][3]=
  g;this.orientMat[3][0]=0;this.orientMat[3][1]=0;this.orientMat[3][2]=0;this.orientMat[3][3]=1};papaya.volume.Orientation.prototype.isValid=function(){return papaya.volume.Orientation.isValidOrientationString(this.orientation)};papaya.volume.Orientation.prototype.getOrientationDescription=function(){var b=this.orientation;return"Cols ("+b.charAt(0)+b.charAt(3)+"), Rows ("+b.charAt(1)+b.charAt(4)+"), Slices ("+b.charAt(2)+b.charAt(5)+")"};"use strict";papaya=papaya||{};
  papaya.volume=papaya.volume||{};
  papaya.volume.Transform=papaya.volume.Transform||function(b,a){this.voxelValue=new papaya.volume.VoxelValue(a.imageData,a.header.imageType,a.header.imageDimensions,a.header.imageRange,a.header.orientation);this.voxelDimensions=a.header.voxelDimensions;this.imageDimensions=a.header.imageDimensions;this.volume=a;this.mat=papaya.volume.Transform.IDENTITY.clone();this.indexMat=papaya.volume.Transform.IDENTITY.clone();this.sizeMat=papaya.volume.Transform.IDENTITY.clone();this.sizeMatInverse=papaya.volume.Transform.IDENTITY.clone();
  this.mmMat=papaya.volume.Transform.IDENTITY.clone();this.worldMat=papaya.volume.Transform.IDENTITY.clone();this.worldMatNifti=null;this.originMat=papaya.volume.Transform.IDENTITY.clone();this.tempMat=papaya.volume.Transform.IDENTITY.clone();this.tempMat2=papaya.volume.Transform.IDENTITY.clone();this.orientMat=papaya.volume.Transform.IDENTITY.clone();this.centerMat=papaya.volume.Transform.IDENTITY.clone();this.centerMatInverse=papaya.volume.Transform.IDENTITY.clone();this.rotMatX=papaya.volume.Transform.IDENTITY.clone();
  this.rotMatY=papaya.volume.Transform.IDENTITY.clone();this.rotMatZ=papaya.volume.Transform.IDENTITY.clone();this.rotMat=papaya.volume.Transform.IDENTITY.clone();this.updateTransforms(b)};papaya.volume.Transform.IDENTITY=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];papaya.volume.Transform.EPSILON=1E-5;
  papaya.volume.Transform.printTransform=function(b){console.log(b[0][0]+" "+b[0][1]+" "+b[0][2]+" "+b[0][3]);console.log(b[1][0]+" "+b[1][1]+" "+b[1][2]+" "+b[1][3]);console.log(b[2][0]+" "+b[2][1]+" "+b[2][2]+" "+b[2][3]);console.log(b[3][0]+" "+b[3][1]+" "+b[3][2]+" "+b[3][3])};
  papaya.volume.Transform.decompose=function(b){var a,c,d,e,f,h,g,m,l,q,u,w,C,B,A,E,D,z,M,r;r=[];a=papaya.volume.Transform.validateNum(b[0][3]);c=papaya.volume.Transform.validateNum(b[1][3]);d=papaya.volume.Transform.validateNum(b[2][3]);e=papaya.volume.Transform.validateNum(Math.atan(b[2][1]/b[2][2]));f=0===e?papaya.volume.Transform.validateNum(Math.atan(-1*Math.cos(e)*(b[2][0]/b[2][2]))):papaya.volume.Transform.validateNum(Math.atan(-1*Math.sin(e)*(b[2][0]/b[2][1])));0===f&&(f=papaya.volume.Transform.EPSILON);
  m=papaya.volume.Transform.validateScale(b[2][2]/(Math.cos(f)*Math.cos(e)));g=Math.cos(e);l=Math.sin(e)*Math.sin(f)+Math.sin(e)*(Math.cos(f)/Math.tan(f));q=b[1][0]*(Math.sin(e)/Math.tan(f))+b[1][1];h=-1*Math.sin(e);u=Math.cos(e)*Math.sin(f)+Math.cos(e)*(Math.cos(f)/Math.tan(f));w=b[1][0]*(Math.cos(e)/Math.tan(f))+b[1][2];h=papaya.volume.Transform.validateNum(Math.atan((g*w-q*h)/(q*u-l*w)));g=papaya.volume.Transform.validateScale(q/(Math.cos(h)*g+Math.sin(h)*l));l=papaya.volume.Transform.validateNum((g*
  Math.sin(h)*Math.cos(f)-b[1][0])/(m*Math.sin(f)));q=Math.cos(f)*Math.cos(h);u=g*Math.cos(f)*Math.sin(h);w=-1*m*Math.sin(f);C=Math.sin(e)*Math.sin(f)*Math.cos(h)-Math.cos(e)*Math.sin(h);B=Math.sin(e)*Math.sin(f)*Math.sin(h)+Math.cos(e)*Math.cos(h);A=m*Math.sin(e)*Math.cos(f);E=Math.cos(e)*Math.sin(f)*Math.cos(h)+Math.sin(e)*Math.sin(h);D=Math.cos(e)*Math.sin(f)*Math.sin(h)-Math.sin(e)*Math.cos(h);z=m*Math.cos(e)*Math.cos(f);B=u*C-q*B;A=w*C-q*A;C=C*b[0][0]-q*b[0][1];D=u*E-q*D;z=w*E-q*z;M=E*b[0][0]-
  q*b[0][2];E=papaya.volume.Transform.validateNum((D*C-M*B)/(A*D-B*z));B=papaya.volume.Transform.validateNum((C*z-A*M)/(B*z-A*D));b=papaya.volume.Transform.validateScale((b[0][0]-B*u-E*w)/q);f===papaya.volume.Transform.EPSILON&&(f=0);e*=180/Math.PI;f*=180/Math.PI;h*=180/Math.PI;r[0]=papaya.volume.Transform.validateZero(a);r[1]=papaya.volume.Transform.validateZero(c);r[2]=papaya.volume.Transform.validateZero(d);r[3]=papaya.volume.Transform.validateZero(e);r[4]=papaya.volume.Transform.validateZero(f);
  r[5]=papaya.volume.Transform.validateZero(h);r[6]=b;r[7]=g;r[8]=m;r[9]=papaya.volume.Transform.validateZero(l);r[10]=papaya.volume.Transform.validateZero(E);r[11]=papaya.volume.Transform.validateZero(B);return r};papaya.volume.Transform.hasRotations=function(b){var a,c;return null!==b?(a=papaya.volume.Transform.decompose(b),b=Math.abs(1-Math.abs(a[3])/90)%1,c=Math.abs(1-Math.abs(a[4])/90)%1,a=Math.abs(1-Math.abs(a[5])/90)%1,.01<b||.01<c||.01<a):!1};
  papaya.volume.Transform.validateNum=function(b){return b===Number.POSITIVE_INFINITY||b===Number.NEGATIVE_INFINITY||isNaN(b)||0===b?0:b};papaya.volume.Transform.validateScale=function(b){return b===Number.POSITIVE_INFINITY||b===Number.NEGATIVE_INFINITY||isNaN(b)?1:b};papaya.volume.Transform.validateZero=function(b){return Math.abs(b)<papaya.volume.Transform.EPSILON?0:b};
  papaya.volume.Transform.prototype.updateSizeMat=function(){this.sizeMat[0][0]=this.voxelDimensions.xSize;this.sizeMat[1][1]=this.voxelDimensions.ySize;this.sizeMat[2][2]=this.voxelDimensions.zSize;this.sizeMat[3][3]=1;this.sizeMatInverse[0][0]=1/this.voxelDimensions.xSize;this.sizeMatInverse[1][1]=1/this.voxelDimensions.ySize;this.sizeMatInverse[2][2]=1/this.voxelDimensions.zSize;this.sizeMatInverse[3][3]=1};papaya.volume.Transform.prototype.updateOrientMat=function(){this.orientMat=this.volume.header.orientation.orientMat};
  papaya.volume.Transform.prototype.updateIndexTransform=function(){var b,a;for(b=0;4>b;b+=1)for(a=0;4>a;a+=1)this.indexMat[b][a]=this.orientMat[b][0]*this.mat[0][a]+this.orientMat[b][1]*this.mat[1][a]+this.orientMat[b][2]*this.mat[2][a]+this.orientMat[b][3]*this.mat[3][a]};
  papaya.volume.Transform.prototype.updateMmTransform=function(){var b,a;for(b=0;4>b;b+=1)for(a=0;4>a;a+=1)this.mmMat[b][a]=this.indexMat[b][0]*this.sizeMatInverse[0][a]+this.indexMat[b][1]*this.sizeMatInverse[1][a]+this.indexMat[b][2]*this.sizeMatInverse[2][a]+this.indexMat[b][3]*this.sizeMatInverse[3][a]};
  papaya.volume.Transform.prototype.updateOriginMat=function(){this.originMat[0][0]=1;this.originMat[1][1]=-1;this.originMat[2][2]=-1;this.originMat[3][3]=1;this.originMat[0][3]=this.volume.header.origin.x;this.originMat[1][3]=this.volume.header.origin.y;this.originMat[2][3]=this.volume.header.origin.z};
  papaya.volume.Transform.prototype.updateImageMat=function(b,a,c,d,e,f){this.updateCenterMat(b,a,c);a=d*Math.PI/180;b=Math.cos(a);a=Math.sin(a);this.rotMatX[1][1]=b;this.rotMatX[1][2]=a;this.rotMatX[2][1]=-1*a;this.rotMatX[2][2]=b;a=e*Math.PI/180;b=Math.cos(a);a=Math.sin(a);this.rotMatY[0][0]=b;this.rotMatY[0][2]=-1*a;this.rotMatY[2][0]=a;this.rotMatY[2][2]=b;a=f*Math.PI/180;b=Math.cos(a);a=Math.sin(a);this.rotMatZ[0][0]=b;this.rotMatZ[0][1]=a;this.rotMatZ[1][0]=-1*a;this.rotMatZ[1][1]=b;for(e=0;4>
  e;e+=1)for(f=0;4>f;f+=1)this.tempMat[e][f]=this.rotMatX[e][0]*this.rotMatY[0][f]+this.rotMatX[e][1]*this.rotMatY[1][f]+this.rotMatX[e][2]*this.rotMatY[2][f]+this.rotMatX[e][3]*this.rotMatY[3][f];for(e=0;4>e;e+=1)for(f=0;4>f;f+=1)this.rotMat[e][f]=this.tempMat[e][0]*this.rotMatZ[0][f]+this.tempMat[e][1]*this.rotMatZ[1][f]+this.tempMat[e][2]*this.rotMatZ[2][f]+this.tempMat[e][3]*this.rotMatZ[3][f];for(e=0;4>e;e+=1)for(f=0;4>f;f+=1)this.tempMat[e][f]=this.sizeMatInverse[e][0]*this.centerMatInverse[0][f]+
  this.sizeMatInverse[e][1]*this.centerMatInverse[1][f]+this.sizeMatInverse[e][2]*this.centerMatInverse[2][f]+this.sizeMatInverse[e][3]*this.centerMatInverse[3][f];for(e=0;4>e;e+=1)for(f=0;4>f;f+=1)this.tempMat2[e][f]=this.tempMat[e][0]*this.rotMat[0][f]+this.tempMat[e][1]*this.rotMat[1][f]+this.tempMat[e][2]*this.rotMat[2][f]+this.tempMat[e][3]*this.rotMat[3][f];for(e=0;4>e;e+=1)for(f=0;4>f;f+=1)this.tempMat[e][f]=this.tempMat2[e][0]*this.centerMat[0][f]+this.tempMat2[e][1]*this.centerMat[1][f]+this.tempMat2[e][2]*
  this.centerMat[2][f]+this.tempMat2[e][3]*this.centerMat[3][f];for(e=0;4>e;e+=1)for(f=0;4>f;f+=1)this.tempMat2[e][f]=this.tempMat[e][0]*this.sizeMat[0][f]+this.tempMat[e][1]*this.sizeMat[1][f]+this.tempMat[e][2]*this.sizeMat[2][f]+this.tempMat[e][3]*this.sizeMat[3][f];this.volume.transform.updateTransforms(this.tempMat2)};
  papaya.volume.Transform.prototype.updateCenterMat=function(b,a,c){this.centerMat[0][0]=1;this.centerMat[1][1]=1;this.centerMat[2][2]=1;this.centerMat[3][3]=1;this.centerMat[0][3]=-1*b;this.centerMat[1][3]=-1*a;this.centerMat[2][3]=-1*c;this.centerMatInverse[0][0]=1;this.centerMatInverse[1][1]=1;this.centerMatInverse[2][2]=1;this.centerMatInverse[3][3]=1;this.centerMatInverse[0][3]=b;this.centerMatInverse[1][3]=a;this.centerMatInverse[2][3]=c};
  papaya.volume.Transform.prototype.updateWorldMat=function(){var b,a,c,d;if(this.worldMatNifti){c=[[-1,0,0,this.imageDimensions.xDim-1],[0,1,0,0],[0,0,1,0],[0,0,0,1]];d=papaya.volume.Transform.IDENTITY.clone();d[0][0]=-1;d[1][1]=-1;d[2][2]=-1;d[3][3]=1;d[0][3]=this.volume.header.origin.x;d[1][3]=this.volume.header.origin.y;d[2][3]=this.volume.header.origin.z;for(b=0;4>b;b+=1)for(a=0;4>a;a+=1)this.tempMat[b][a]=this.sizeMat[b][0]*d[0][a]+this.sizeMat[b][1]*d[1][a]+this.sizeMat[b][2]*d[2][a]+this.sizeMat[b][3]*
  d[3][a];for(b=0;4>b;b+=1)for(a=0;4>a;a+=1)this.tempMat2[b][a]=this.tempMat[b][0]*c[0][a]+this.tempMat[b][1]*c[1][a]+this.tempMat[b][2]*c[2][a]+this.tempMat[b][3]*c[3][a];for(b=0;4>b;b+=1)for(a=0;4>a;a+=1)this.tempMat[b][a]=this.tempMat2[b][0]*this.mat[0][a]+this.tempMat2[b][1]*this.mat[1][a]+this.tempMat2[b][2]*this.mat[2][a]+this.tempMat2[b][3]*this.mat[3][a];for(b=0;4>b;b+=1)for(a=0;4>a;a+=1)this.tempMat2[b][a]=this.tempMat[b][0]*c[0][a]+this.tempMat[b][1]*c[1][a]+this.tempMat[b][2]*c[2][a]+this.tempMat[b][3]*
  c[3][a];for(b=0;4>b;b+=1)for(a=0;4>a;a+=1)this.tempMat[b][a]=this.tempMat2[b][0]*d[0][a]+this.tempMat2[b][1]*d[1][a]+this.tempMat2[b][2]*d[2][a]+this.tempMat2[b][3]*d[3][a];for(b=0;4>b;b+=1)for(a=0;4>a;a+=1)this.tempMat2[b][a]=this.tempMat[b][0]*this.sizeMatInverse[0][a]+this.tempMat[b][1]*this.sizeMatInverse[1][a]+this.tempMat[b][2]*this.sizeMatInverse[2][a]+this.tempMat[b][3]*this.sizeMatInverse[3][a];for(b=0;4>b;b+=1)for(a=0;4>a;a+=1)this.worldMat[b][a]=this.worldMatNifti[b][0]*this.tempMat2[0][a]+
  this.worldMatNifti[b][1]*this.tempMat2[1][a]+this.worldMatNifti[b][2]*this.tempMat2[2][a]+this.worldMatNifti[b][3]*this.tempMat2[3][a]}else{for(b=0;4>b;b+=1)for(a=0;4>a;a+=1)this.tempMat[b][a]=this.indexMat[b][0]*this.originMat[0][a]+this.indexMat[b][1]*this.originMat[1][a]+this.indexMat[b][2]*this.originMat[2][a]+this.indexMat[b][3]*this.originMat[3][a];for(b=0;4>b;b+=1)for(a=0;4>a;a+=1)this.worldMat[b][a]=this.tempMat[b][0]*this.sizeMatInverse[0][a]+this.tempMat[b][1]*this.sizeMatInverse[1][a]+
  this.tempMat[b][2]*this.sizeMatInverse[2][a]+this.tempMat[b][3]*this.sizeMatInverse[3][a]}};papaya.volume.Transform.prototype.updateMat=function(b){var a,c;for(c=0;4>c;c+=1)for(a=0;4>a;a+=1)this.mat[c][a]=b[c][a]};papaya.volume.Transform.prototype.updateTransforms=function(b){this.updateMat(b);this.updateSizeMat();this.updateOrientMat();this.updateOriginMat();this.updateIndexTransform();this.updateMmTransform();this.updateWorldMat()};
  papaya.volume.Transform.prototype.getVoxelAtIndexNative=function(b,a,c,d,e){return this.voxelValue.getVoxelAtIndexNative(b,a,c,d,e)};papaya.volume.Transform.prototype.getVoxelAtIndex=function(b,a,c,d,e){return this.voxelValue.getVoxelAtIndex(b,a,c,d,e)};
  papaya.volume.Transform.prototype.getVoxelAtCoordinate=function(b,a,c,d,e){return this.voxelValue.getVoxelAtIndexNative(b*this.worldMat[0][0]+a*this.worldMat[0][1]+c*this.worldMat[0][2]+this.worldMat[0][3],b*this.worldMat[1][0]+a*this.worldMat[1][1]+c*this.worldMat[1][2]+this.worldMat[1][3],b*this.worldMat[2][0]+a*this.worldMat[2][1]+c*this.worldMat[2][2]+this.worldMat[2][3],d,e)};
  papaya.volume.Transform.prototype.getVoxelAtMM=function(b,a,c,d,e){return this.voxelValue.getVoxelAtIndexNative(b*this.mmMat[0][0]+a*this.mmMat[0][1]+c*this.mmMat[0][2]+this.mmMat[0][3],b*this.mmMat[1][0]+a*this.mmMat[1][1]+c*this.mmMat[1][2]+this.mmMat[1][3],b*this.mmMat[2][0]+a*this.mmMat[2][1]+c*this.mmMat[2][2]+this.mmMat[2][3],d,e)};"use strict";papaya=papaya||{};papaya.volume=papaya.volume||{};
  papaya.volume.Volume=papaya.volume.Volume||function(b,a,c){this.progressMeter=b;this.dialogHandler=a;this.files=[];this.rawData=[];this.fileLength=0;this.fileName=this.urls=null;this.compressed=!1;this.transform=null;this.numTimepoints=0;this.transform=this.error=this.onFinishedRead=null;this.isLoaded=!1;this.numTimepoints=1;this.loaded=!1;this.params=c;this.header=new papaya.volume.Header(void 0!==this.params&&this.params.padAllImages);this.imageData=new papaya.volume.ImageData(void 0!==this.params&&
  this.params.padAllImages)};papaya.volume.Volume.PROGRESS_LABEL_LOADING="Loading";papaya.volume.Volume.prototype.fileIsCompressed=function(b,a){var c,d;return b&&-1!==b.indexOf(".gz")||a&&(c=new DataView(a),d=c.getUint8(0),c=c.getUint8(1),d===GUNZIP_MAGIC_COOKIE1||c===GUNZIP_MAGIC_COOKIE2)?!0:!1};
  papaya.volume.Volume.prototype.readFiles=function(b,a){this.files=b;this.fileName=b[0].name;this.onFinishedRead=a;this.compressed=this.fileIsCompressed(this.fileName);this.fileLength=this.files[0].size;this.readNextFile(this,0)};
  papaya.volume.Volume.prototype.readNextFile=function(b,a){var c;if(a<this.files.length){c=papaya.utilities.PlatformUtils.makeSlice(this.files[a],0,this.files[a].size);try{var d=new FileReader;d.onloadend=papaya.utilities.ObjectUtils.bind(b,function(c){c.target.readyState===FileReader.DONE&&(b.rawData[a]=c.target.result,setTimeout(function(){b.readNextFile(b,a+1)},0))});d.onerror=papaya.utilities.ObjectUtils.bind(b,function(a){b.error=Error("There was a problem reading that file:\n\n"+a.getMessage());
  b.finishedLoad()});d.readAsArrayBuffer(c)}catch(e){b.error=Error("There was a problem reading that file:\n\n"+e.message),b.finishedLoad()}}else setTimeout(function(){b.decompress(b)},0)};
  papaya.volume.Volume.prototype.readURLs=function(b,a){var c=this;this.urls=b;this.fileName=b[0].substr(b[0].lastIndexOf("/")+1,b[0].length);this.onFinishedRead=a;this.compressed=this.fileIsCompressed(this.fileName);-1!==this.fileName.indexOf("?")&&(this.fileName=this.fileName.substr(0,this.fileName.indexOf("?")));this.rawData=[];this.loadedFileCount=0;this.readEachURL(this).done(function(){setTimeout(function(){c.decompress(c)},0)}).fail(function(a,b,c){b=b.message||"";"undefined"!==typeof c&&(b=
  "Response status = "+c.status);a.error=Error("There was a problem reading that file ("+a.fileName+"):\n\n"+b);a.finishedLoad()})};
  papaya.volume.Volume.prototype.loadURL=function(b,a){var c,d,e,f;c=jQuery.Deferred();"string"===typeof(new XMLHttpRequest).responseType?(d=new XMLHttpRequest,d.open("GET",b,!0),d.responseType="arraybuffer",d.onreadystatechange=function(){4===d.readyState&&(200===d.status?(a.fileLength=a.rawData.byteLength,c.resolve(d.response)):c.reject(a,!1,d))},d.onprogress=function(a){a.lengthComputable&&c.notify(a.loaded,a.total)},d.send(null)):(a.error=Error("There was a problem reading that file ("+a.fileName+
  "):\n\nResponse type is not supported."),a.finishedLoad());return c.promise().done(function(b){a.loadedFileCount++;a.rawData.push(b)}).fail(function(a,b,c){console.error(a,b,c)}).progress(function(b,c){e=parseInt(100*a.loadedFileCount/a.urls.length,10);f=papaya.volume.Volume.PROGRESS_LABEL_LOADING+" image "+(a.loadedFileCount+1)+" of "+a.urls.length+" ("+e+"%)";a.progressMeter.drawProgress(b/c,f)})};
  papaya.volume.Volume.prototype.readEachURL=function(b,a){for(var c=[],d=0;d<b.urls.length;d++){var e=b.loadURL(b.urls[d],b);c.push(e)}return $.when.apply($,c)};papaya.volume.Volume.prototype.readBinaryData=function(b,a){var c=null;try{this.fileName=b[0],this.onFinishedRead=a,c=this,this.fileLength=0,c.readNextBinaryData(c,0,b)}catch(d){c&&(c.error=Error("There was a problem reading that file:\n\n"+d.message),c.finishedLoad())}};
  papaya.volume.Volume.prototype.readNextBinaryData=function(b,a,c){if(a<c.length)try{b.rawData[a]=papaya.utilities.ObjectUtils.dereference(c[a]),b.compressed=this.fileIsCompressed(this.fileName,b.rawData[a]),setTimeout(function(){b.readNextBinaryData(b,a+1,c)},0)}catch(d){b&&(b.error=Error("There was a problem reading that file:\n\n"+d.message),b.finishedLoad())}else b.decompress(b)};
  papaya.volume.Volume.prototype.readEncodedData=function(b,a){var c=null;try{this.fileName=b[0],this.onFinishedRead=a,c=this,this.fileLength=0,c.readNextEncodedData(c,0,b)}catch(d){c&&(c.error=Error("There was a problem reading that file:\n\n"+d.message),c.finishedLoad())}};
  papaya.volume.Volume.prototype.readNextEncodedData=function(b,a,c){if(a<c.length)try{b.rawData[a]=Base64Binary.decodeArrayBuffer(papaya.utilities.ObjectUtils.dereference(c[a])),b.compressed=this.fileIsCompressed(this.fileName,b.rawData[a]),setTimeout(function(){b.readNextEncodedData(b,a+1,c)},0)}catch(d){b&&(b.error=Error("There was a problem reading that file:\n\n"+d.message),b.finishedLoad())}else b.decompress(b)};
  papaya.volume.Volume.prototype.getVoxelAtIndexNative=function(b,a,c,d,e){return this.transform.getVoxelAtIndexNative(b,a,c,0,e)};papaya.volume.Volume.prototype.getVoxelAtIndex=function(b,a,c,d,e){return this.transform.getVoxelAtIndex(b,a,c,d,e)};papaya.volume.Volume.prototype.getVoxelAtCoordinate=function(b,a,c,d,e){return this.transform.getVoxelAtCoordinate(b,a,c,d,e)};papaya.volume.Volume.prototype.getVoxelAtMM=function(b,a,c,d,e){return this.transform.getVoxelAtMM(b,a,c,d,e)};
  papaya.volume.Volume.prototype.hasError=function(){return null!==this.error};papaya.volume.Volume.prototype.getXDim=function(){return this.header.imageDimensions.xDim};papaya.volume.Volume.prototype.getYDim=function(){return this.header.imageDimensions.yDim};papaya.volume.Volume.prototype.getZDim=function(){return this.header.imageDimensions.zDim};papaya.volume.Volume.prototype.getXSize=function(){return this.header.voxelDimensions.xSize};papaya.volume.Volume.prototype.getYSize=function(){return this.header.voxelDimensions.ySize};
  papaya.volume.Volume.prototype.getZSize=function(){return this.header.voxelDimensions.zSize};papaya.volume.Volume.prototype.decompress=function(b){b.compressed=b.compressed||b.fileIsCompressed(b.fileName,b.rawData[0]);if(b.compressed)try{pako.inflate(new Uint8Array(b.rawData[0]),null,this.progressMeter,function(a){b.finishedDecompress(b,a.buffer)})}catch(a){console.log(a)}else setTimeout(function(){b.finishedReadData(b)},0)};
  papaya.volume.Volume.prototype.finishedDecompress=function(b,a){b.rawData[0]=a;setTimeout(function(){b.finishedReadData(b)},0)};papaya.volume.Volume.prototype.finishedReadData=function(b){b.header.readHeaderData(b.fileName,b.rawData,this.progressMeter,this.dialogHandler,papaya.utilities.ObjectUtils.bind(this,this.finishedReadHeaderData))};
  papaya.volume.Volume.prototype.finishedReadHeaderData=function(){this.rawData=null;this.header.hasError()?(this.error=this.header.error,console.error(this.error.stack),this.onFinishedRead(this)):(this.header.imageType.swapped=this.header.imageType.littleEndian!==papaya.utilities.PlatformUtils.isPlatformLittleEndian(),this.header.getName()&&(this.fileName=this.header.getName()),this.header.readImageData(this.progressMeter,papaya.utilities.ObjectUtils.bind(this,this.finishedReadImageData)))};
  papaya.volume.Volume.prototype.finishedReadImageData=function(b){this.imageData.readFileData(this.header,b,papaya.utilities.ObjectUtils.bind(this,this.finishedLoad))};
  papaya.volume.Volume.prototype.finishedLoad=function(){this.loaded||(this.loaded=!0,this.onFinishedRead&&(this.hasError()?console.log(this.error):(this.transform=new papaya.volume.Transform(papaya.volume.Transform.IDENTITY.clone(),this),this.numTimepoints=this.header.imageDimensions.timepoints||1,this.applyBestTransform()),this.isLoaded=!0,this.rawData=null,this.onFinishedRead(this)))};
  papaya.volume.Volume.prototype.setOrigin=function(b){b=this.header.orientation.convertCoordinate(b,new papaya.core.Coordinate(0,0,0));this.header.origin.setCoordinate(b.x,b.y,b.z)};papaya.volume.Volume.prototype.getOrigin=function(){return this.header.orientation.convertCoordinate(this.header.origin,new papaya.core.Coordinate(0,0,0))};
  papaya.volume.Volume.prototype.applyBestTransform=function(){var b=this.header.getBestTransform();null!==b&&(this.transform.worldMatNifti=numeric.inv(b),this.setOrigin(this.header.getBestTransformOrigin()),this.transform.updateWorldMat())};
  papaya.volume.Volume.prototype.isWorldSpaceOnly=function(){var b,a=!1;return this.header.fileFormat instanceof papaya.volume.nifti.HeaderNIFTI?(b=this.header.fileFormat,0<b.nifti.qform_code&&(a|=!b.qFormHasRotations()),0<b.nifti.sform_code&&(a|=!b.sFormHasRotations()),!a):!1};"use strict";papaya=papaya||{};papaya.volume=papaya.volume||{};
  papaya.volume.VoxelDimensions=papaya.volume.VoxelDimensions||function(b,a,c,d){this.colSize=Math.abs(b);this.rowSize=Math.abs(a);this.sliceSize=Math.abs(c);this.zSize=this.ySize=this.xSize=0;this.flip=!1;this.timeSize=d;this.temporalUnit=this.spatialUnit=papaya.volume.VoxelDimensions.UNITS_UNKNOWN};papaya.volume.VoxelDimensions.UNITS_UNKNOWN=0;papaya.volume.VoxelDimensions.UNITS_METER=1;papaya.volume.VoxelDimensions.UNITS_MM=2;papaya.volume.VoxelDimensions.UNITS_MICRON=3;
  papaya.volume.VoxelDimensions.UNITS_SEC=8;papaya.volume.VoxelDimensions.UNITS_MSEC=16;papaya.volume.VoxelDimensions.UNITS_USEC=24;papaya.volume.VoxelDimensions.UNITS_HZ=32;papaya.volume.VoxelDimensions.UNITS_PPM=40;papaya.volume.VoxelDimensions.UNITS_RADS=48;papaya.volume.VoxelDimensions.UNIT_STRINGS=[];papaya.volume.VoxelDimensions.UNIT_STRINGS[papaya.volume.VoxelDimensions.UNITS_UNKNOWN]="Unknown Unit";papaya.volume.VoxelDimensions.UNIT_STRINGS[papaya.volume.VoxelDimensions.UNITS_METER]="Meters";
  papaya.volume.VoxelDimensions.UNIT_STRINGS[papaya.volume.VoxelDimensions.UNITS_MM]="Millimeters";papaya.volume.VoxelDimensions.UNIT_STRINGS[papaya.volume.VoxelDimensions.UNITS_MICRON]="Microns";papaya.volume.VoxelDimensions.UNIT_STRINGS[papaya.volume.VoxelDimensions.UNITS_SEC]="Seconds";papaya.volume.VoxelDimensions.UNIT_STRINGS[papaya.volume.VoxelDimensions.UNITS_MSEC]="Milliseconds";papaya.volume.VoxelDimensions.UNIT_STRINGS[papaya.volume.VoxelDimensions.UNITS_USEC]="Microseconds";
  papaya.volume.VoxelDimensions.UNIT_STRINGS[papaya.volume.VoxelDimensions.UNITS_HZ]="Hertz";papaya.volume.VoxelDimensions.UNIT_STRINGS[papaya.volume.VoxelDimensions.UNITS_PPM]="Parts-per-million";papaya.volume.VoxelDimensions.UNIT_STRINGS[papaya.volume.VoxelDimensions.UNITS_RADS]="Radians-per-second";papaya.volume.VoxelDimensions.prototype.isValid=function(){return 0<this.colSize&&0<this.rowSize&&0<this.sliceSize&&0<=this.timeSize};papaya.volume.VoxelDimensions.prototype.getSpatialUnitString=function(){return papaya.volume.VoxelDimensions.UNIT_STRINGS[this.spatialUnit]};
  papaya.volume.VoxelDimensions.prototype.getTemporalUnitString=function(){return papaya.volume.VoxelDimensions.UNIT_STRINGS[this.temporalUnit]};papaya.volume.VoxelDimensions.prototype.getTemporalUnitMultiplier=function(){return this.temporalUnit===papaya.volume.VoxelDimensions.UNITS_MSEC?.001:this.temporalUnit===papaya.volume.VoxelDimensions.UNITS_USEC?1E-6:1};"use strict";papaya=papaya||{};papaya.volume=papaya.volume||{};
  papaya.volume.VoxelValue=papaya.volume.VoxelValue||function(b,a,c,d,e){this.imageData=b;this.imageType=a;this.imageRange=d;this.orientation=e;this.swap16=2===this.imageType.numBytes&&this.imageType.swapped&&this.imageType.datatype!==papaya.volume.ImageType.DATATYPE_FLOAT;this.swap32=4===this.imageType.numBytes&&this.imageType.swapped&&this.imageType.datatype!==papaya.volume.ImageType.DATATYPE_FLOAT;this.xIncrement=e.xIncrement;this.yIncrement=e.yIncrement;this.zIncrement=e.zIncrement;this.xDim=c.xDim;
  this.yDim=c.yDim;this.zDim=c.zDim;this.sliceSize=c.getNumVoxelsSlice();this.volSize=c.getNumVoxelsVolume();this.dataScaleSlopes=d.dataScaleSlopes;this.dataScaleIntercepts=d.dataScaleIntercepts;this.globalDataScaleSlope=d.globalDataScaleSlope;this.globalDataScaleIntercept=d.globalDataScaleIntercept;this.usesGlobalDataScale=d.usesGlobalDataScale;this.interpFirstPass=[[0,0],[0,0]];this.interpSecondPass=[0,0];this.forceABS=!1};
  papaya.volume.VoxelValue.prototype.getVoxelAtIndexNative=function(b,a,c,d,e){return e?(b=papayaRoundFast(b),a=papayaRoundFast(a),c=papayaRoundFast(c),this.getVoxelAtOffset(this.orientation.convertIndexToOffsetNative(b,a,c),d,b,a,c)):this.getVoxelAtIndexLinear(b,a,c,d)};
  papaya.volume.VoxelValue.prototype.getVoxelAtIndex=function(b,a,c,d,e){return e?(b=papayaRoundFast(b),a=papayaRoundFast(a),c=papayaRoundFast(c),this.getVoxelAtOffset(this.orientation.convertIndexToOffset(b,a,c),d,b,a,c)):this.getVoxelAtIndexLinear(b,a,c,d)};
  papaya.volume.VoxelValue.prototype.getVoxelAtOffset=function(b,a,c,d,e){b+=this.volSize*a;if(0>c||c>=this.xDim||0>d||d>=this.yDim||0>e||e>=this.zDim)return 0;this.usesGlobalDataScale?c=this.checkSwap(this.imageData.data[b])*this.globalDataScaleSlope+this.globalDataScaleIntercept:(c=parseInt(b/this.sliceSize),c=this.checkSwap(this.imageData.data[b])*this.dataScaleSlopes[c]+this.dataScaleIntercepts[c]);return this.forceABS?Math.abs(c):c};
  papaya.volume.VoxelValue.prototype.getVoxelAtIndexLinear=function(b,a,c,d){var e,f,h,g,m,l,q,u,w;m=Math.floor(b);l=Math.floor(a);q=Math.floor(c);e=b-m;f=a-l;h=c-q;g=0!==e;u=0!==f;w=0!==h;if(g&&u&&w){for(a=0;2>a;a+=1)for(c=0;2>c;c+=1)g=this.orientation.convertIndexToOffsetNative(m+a,l+c,q),b=this.getVoxelAtOffset(g,d,m+a,l+c,q)*(1-h),g=this.orientation.convertIndexToOffsetNative(m+a,l+c,q+1),g=this.getVoxelAtOffset(g,d,m+a,l+c,q+1)*h,this.interpFirstPass[a][c]=b+g;this.interpSecondPass[0]=this.interpFirstPass[0][0]*
  (1-f)+this.interpFirstPass[0][1]*f;this.interpSecondPass[1]=this.interpFirstPass[1][0]*(1-f)+this.interpFirstPass[1][1]*f;d=this.interpSecondPass[0]*(1-e)+this.interpSecondPass[1]*e}else if(g&&u&&!w){for(a=0;2>a;a+=1)g=this.orientation.convertIndexToOffsetNative(m+a,l,q),b=this.getVoxelAtOffset(g,d,m+a,l,q)*(1-f),g=this.orientation.convertIndexToOffsetNative(m+a,l+1,q),g=this.getVoxelAtOffset(g,d,m+a,l+1,q)*f,this.interpSecondPass[a]=b+g;d=this.interpSecondPass[0]*(1-e)+this.interpSecondPass[1]*e}else if(g&&
  !u&&w){for(a=0;2>a;a+=1)g=this.orientation.convertIndexToOffsetNative(m+a,l,q),b=this.getVoxelAtOffset(g,d,m+a,l,q)*(1-h),g=this.orientation.convertIndexToOffsetNative(m+a,l,q+1),g=this.getVoxelAtOffset(g,d,m+a,l,q+1)*h,this.interpSecondPass[a]=b+g;d=this.interpSecondPass[0]*(1-e)+this.interpSecondPass[1]*e}else if(!g&&u&&w){for(c=0;2>c;c+=1)g=this.orientation.convertIndexToOffsetNative(m,l+c,q),b=this.getVoxelAtOffset(g,d,m,l+c,q)*(1-h),g=this.orientation.convertIndexToOffsetNative(m,l+c,q+1),g=
  this.getVoxelAtOffset(g,d,m,l+c,q+1)*h,this.interpSecondPass[c]=b+g;d=this.interpSecondPass[0]*(1-f)+this.interpSecondPass[1]*f}else g||u||!w?g||!u||w?!g||u||w?d=this.getVoxelAtOffset(this.orientation.convertIndexToOffsetNative(b,a,c),d,b,a,c):(g=this.orientation.convertIndexToOffsetNative(m,l,q),b=this.getVoxelAtOffset(g,d,m,l,q)*(1-e),g=this.orientation.convertIndexToOffsetNative(m+1,l,q),g=this.getVoxelAtOffset(g,d,m+1,l,q)*e,d=b+g):(g=this.orientation.convertIndexToOffsetNative(m,l,q),b=this.getVoxelAtOffset(g,
  d,m,l,q)*(1-f),g=this.orientation.convertIndexToOffsetNative(m,l+1,q),g=this.getVoxelAtOffset(g,d,m,l+1,q)*f,d=b+g):(g=this.orientation.convertIndexToOffsetNative(m,l,q),b=this.getVoxelAtOffset(g,d,m,l,q)*(1-h),g=this.orientation.convertIndexToOffsetNative(m,l,q+1),g=this.getVoxelAtOffset(g,d,m,l,q+1)*h,d=b+g);return d};papaya.volume.VoxelValue.prototype.checkSwap=function(b){return this.swap16?((b&255)<<8|b>>8&255)<<16>>16:this.swap32?(b&255)<<24|(b&65280)<<8|b>>8&65280|b>>24&255:b};"use strict";
  papaya=papaya||{};papaya.surface=papaya.surface||{};
  papaya.surface.Surface=papaya.surface.Surface||function(b,a){this.progressMeter=b;this.colorsData=this.normalsData=this.triangleData=this.pointData=this.onFinishedRead=this.rawData=this.filename=this.error=null;this.numTriangles=this.numPoints=0;this.solidColor=this.colorsBuffer=this.normalsBuffer=this.trianglesBuffer=this.pointsBuffer=null;this.surfaceType=papaya.surface.Surface.SURFACE_TYPE_UNKNOWN;this.fileFormat=null;this.params=a;this.volume=this.nextSurface=null;this.alpha=1};
  papaya.surface.Surface.SURFACE_TYPE_UNKNOWN=0;papaya.surface.Surface.SURFACE_TYPE_GIFTI=1;papaya.surface.Surface.SURFACE_TYPE_MANGO=2;papaya.surface.Surface.SURFACE_TYPE_VTK=3;papaya.surface.Surface.findSurfaceType=function(b){return gifti.isThisFormat(b)?papaya.surface.Surface.SURFACE_TYPE_GIFTI:papaya.surface.SurfaceMango.isThisFormat(b)?papaya.surface.Surface.SURFACE_TYPE_MANGO:papaya.surface.SurfaceVTK.isThisFormat(b)?papaya.surface.Surface.SURFACE_TYPE_VTK:papaya.surface.Surface.SURFACE_TYPE_UNKNOWN};
  papaya.surface.Surface.prototype.makeFileFormat=function(b){this.surfaceType=papaya.surface.Surface.findSurfaceType(b);this.surfaceType===papaya.surface.Surface.SURFACE_TYPE_GIFTI?this.fileFormat=new papaya.surface.SurfaceGIFTI:this.surfaceType===papaya.surface.Surface.SURFACE_TYPE_MANGO?this.fileFormat=new papaya.surface.SurfaceMango:this.surfaceType===papaya.surface.Surface.SURFACE_TYPE_VTK&&(this.fileFormat=new papaya.surface.SurfaceVTK)};
  papaya.surface.Surface.prototype.readURL=function(b,a,c){var d,e=this;this.filename=b.substr(b.lastIndexOf("/")+1,b.length);this.onFinishedRead=c;this.volume=a;this.processParams(this.filename);this.makeFileFormat(this.filename);if(this.surfaceType===papaya.surface.Surface.SURFACE_TYPE_UNKNOWN)this.error=Error("This surface format is not supported!"),this.finishedLoading();else try{"string"===typeof(new XMLHttpRequest).responseType?(d=new XMLHttpRequest,d.open("GET",b,!0),this.fileFormat.isSurfaceDataBinary()&&
  (d.responseType="arraybuffer"),d.onreadystatechange=function(){4===d.readyState&&(200===d.status?e.rawData=d.response:e.error=Error("There was a problem reading that file ("+e.filename+"):\n\nResponse status = "+d.status),e.finishedLoading())},d.onprogress=function(a){a.lengthComputable&&e.progressMeter.drawProgress(a.loaded/a.total,papaya.volume.Volume.PROGRESS_LABEL_LOADING)},d.send(null)):(e.error=Error("There was a problem reading that file ("+e.filename+"):\n\nResponse type is not supported."),
  e.finishedLoading())}catch(f){null!==e&&(e.error=Error("There was a problem reading that file ("+e.filename+"):\n\n"+f.message),e.finishedLoading())}};
  papaya.surface.Surface.prototype.readFile=function(b,a,c){var d=papaya.utilities.PlatformUtils.makeSlice(b,0,b.size),e=this;this.filename=b.name;this.onFinishedRead=c;this.volume=a;this.processParams(this.filename);this.makeFileFormat(this.filename);if(this.surfaceType===papaya.surface.Surface.SURFACE_TYPE_UNKNOWN)this.error=Error("This surface format is not supported!"),this.finishedLoading();else try{var f=new FileReader;f.onloadend=function(a){a.target.readyState===FileReader.DONE&&(e.rawData=
  a.target.result,e.finishedLoading())};f.onerror=function(a){e.error=Error("There was a problem reading that file:\n\n"+a.getMessage());e.finishedLoading()};this.fileFormat.isSurfaceDataBinary()?f.readAsArrayBuffer(d):f.readAsText(d)}catch(h){e.error=Error("There was a problem reading that file:\n\n"+h.message),e.finishedLoading()}};
  papaya.surface.Surface.prototype.readEncodedData=function(b,a,c){this.filename=b+".surf.gii";this.onFinishedRead=c;this.volume=a;this.processParams(b);this.makeFileFormat(this.filename);if(this.surfaceType===papaya.surface.Surface.SURFACE_TYPE_UNKNOWN)this.error=Error("This surface format is not supported!");else try{this.fileFormat.isSurfaceDataBinary()?this.rawData=Base64Binary.decodeArrayBuffer(papaya.utilities.ObjectUtils.dereference(b)):this.rawData=atob(papaya.utilities.ObjectUtils.dereference(b))}catch(d){this.error=
  Error("There was a problem reading that file:\n\n"+d.message)}this.finishedLoading()};papaya.surface.Surface.prototype.processParams=function(b){if(b=this.params[b])void 0!==b.color&&(this.solidColor=b.color),void 0!==b.alpha&&(this.alpha=b.alpha)};papaya.surface.Surface.prototype.finishedLoading=function(){this.readData()};
  papaya.surface.Surface.prototype.readData=function(){if(this.error)console.log(this.error),this.onFinishedRead(this);else{var b=this.progressMeter,a=function(a){b.drawProgress(a,"Loading surface...")};try{this.fileFormat.readData(this.rawData,a,papaya.utilities.ObjectUtils.bind(this,this.finishedReading),this.volume)}catch(c){this.error=c,this.onFinishedRead(this)}}};
  papaya.surface.Surface.prototype.finishedReading=function(){var b=this.fileFormat.getNumSurfaces(),a=this,c;if(this.fileFormat.error)this.error=this.fileFormat.error;else for(c=0;c<b;c+=1)0<c&&(a.nextSurface=new papaya.surface.Surface,a=a.nextSurface),a.numPoints=this.fileFormat.getNumPoints(c),a.numTriangles=this.fileFormat.getNumTriangles(c),a.pointData=this.fileFormat.getPointData(c),a.normalsData=this.fileFormat.getNormalsData(c),a.triangleData=this.fileFormat.getTriangleData(c),a.colorsData=
  this.fileFormat.getColorsData(c),null===a.normalsData&&this.generateNormals(),this.fileFormat.getSolidColor(c)&&(a.solidColor=this.fileFormat.getSolidColor(c));this.progressMeter.drawProgress(1,"Loading surface...");this.onFinishedRead(this)};
  papaya.surface.Surface.prototype.generateNormals=function(){var b=[],a=[],c=[],d=[],e=[],f,h=this.pointData.length,g,m,l,q,u,w,C,B,A,E;this.normalsData=new Float32Array(h);g=3*this.numTriangles;for(f=0;f<g;f+=3)B=3*this.triangleData[f],A=3*this.triangleData[f+1],E=3*this.triangleData[f+2],b.x=this.pointData[B],b.y=this.pointData[B+1],b.z=this.pointData[B+2],a.x=this.pointData[A],a.y=this.pointData[A+1],a.z=this.pointData[A+2],c.x=this.pointData[E],c.y=this.pointData[E+1],c.z=this.pointData[E+2],m=
  a.x-b.x,l=a.y-b.y,q=a.z-b.z,u=c.x-b.x,w=c.y-b.y,C=c.z-b.z,d[0]=w*q-C*l,d[1]=C*m-u*q,d[2]=u*l-w*m,this.normalsData[B]+=d[0],this.normalsData[B+1]+=d[1],this.normalsData[B+2]+=d[2],this.normalsData[A]+=d[0],this.normalsData[A+1]+=d[1],this.normalsData[A+2]+=d[2],this.normalsData[E]+=d[0],this.normalsData[E+1]+=d[1],this.normalsData[E+2]+=d[2];for(f=0;f<h;f+=3)d[0]=-1*this.normalsData[f],d[1]=-1*this.normalsData[f+1],d[2]=-1*this.normalsData[f+2],vec3.normalize(d,e),this.normalsData[f]=e[0],this.normalsData[f+
  1]=e[1],this.normalsData[f+2]=e[2]};"use strict";papaya=papaya||{};papaya.surface=papaya.surface||{};papaya.surface.SurfaceGIFTI=papaya.surface.SurfaceGIFTI||function(){this.onFinishedRead=this.colorsData=this.normalsData=this.triangleData=this.pointData=this.error=this.gii=null};papaya.surface.SurfaceGIFTI.prototype.isSurfaceDataBinary=function(){return!1};
  papaya.surface.SurfaceGIFTI.prototype.readData=function(b,a,c){var d=this;a(0);this.onFinishedRead=c;this.gii=gifti.parse(b);setTimeout(function(){d.readDataPoints(d,a)},0)};papaya.surface.SurfaceGIFTI.prototype.readDataPoints=function(b,a){a(.2);null!=b.gii.getPointsDataArray()?b.pointData=b.gii.getPointsDataArray().getData():b.error=Error("Surface is missing point information!");setTimeout(function(){b.readDataNormals(b,a)},0)};
  papaya.surface.SurfaceGIFTI.prototype.readDataNormals=function(b,a){a(.4);null!=b.gii.getNormalsDataArray()&&(b.normalsData=b.gii.getNormalsDataArray().getData());setTimeout(function(){b.readDataTriangles(b,a)},0)};papaya.surface.SurfaceGIFTI.prototype.readDataTriangles=function(b,a){a(.6);null!=b.gii.getTrianglesDataArray()?b.triangleData=b.gii.getTrianglesDataArray().getData():b.error=Error("Surface is missing triangle information!");setTimeout(function(){b.readDataColors(b,a)},0)};
  papaya.surface.SurfaceGIFTI.prototype.readDataColors=function(b,a){a(.8);null!=b.gii.getColorsDataArray()&&(b.colorsData=b.gii.getColorsDataArray().getData());setTimeout(function(){b.onFinishedRead()},0)};papaya.surface.SurfaceGIFTI.prototype.getNumSurfaces=function(){return 1};papaya.surface.SurfaceGIFTI.prototype.getNumPoints=function(){return this.gii.getNumPoints()};papaya.surface.SurfaceGIFTI.prototype.getNumTriangles=function(){return this.gii.getNumTriangles()};
  papaya.surface.SurfaceGIFTI.prototype.getPointData=function(){return this.pointData};papaya.surface.SurfaceGIFTI.prototype.getNormalsData=function(){return this.normalsData};papaya.surface.SurfaceGIFTI.prototype.getTriangleData=function(){return this.triangleData};papaya.surface.SurfaceGIFTI.prototype.getColorsData=function(){return this.colorsData};papaya.surface.SurfaceGIFTI.prototype.getSolidColor=function(){return this.solidColor};"use strict";papaya=papaya||{};
  papaya.surface=papaya.surface||{};papaya.surface.SurfaceMango=papaya.surface.SurfaceMango||function(){this.onFinishedRead=this.error=null;this.origin=[];this.imageDims=[];this.voxelDims=[];this.center=[];this.diffs=[];this.dv=null;this.numSurfaces=this.dataLength=this.surfaceIndex=this.index=0;this.littleEndian=!1;this.surfaces=[];this.v15=this.v14=!1};
  papaya.surface.SurfaceMangoData=papaya.surface.SurfaceMangoData||function(){this.colorsData=this.normalsData=this.triangleData=this.pointData=null;this.solidColor=[]};papaya.surface.SurfaceMango.MAGIC_NUMBER_LITTLE_1_5="mangol15".split("");papaya.surface.SurfaceMango.MAGIC_NUMBER_BIG_1_5="mangob15".split("");papaya.surface.SurfaceMango.MAGIC_NUMBER_LITTLE_1_4="mangol14".split("");papaya.surface.SurfaceMango.MAGIC_NUMBER_BIG_1_4="mangob14".split("");
  papaya.surface.SurfaceMango.SURFACE_OVERLAY_MAGIC_NUMBER=[0,0,0,0,"s","c","a","l"];papaya.surface.SurfaceMango.NAME_SIZE=64;papaya.surface.SurfaceMango.isThisFormat=function(b){return b.endsWith(".surf")};papaya.surface.SurfaceMango.prototype.isSurfaceDataBinary=function(){return!0};
  papaya.surface.SurfaceMango.prototype.isLittleEndian15=function(b){b=new Uint8Array(b);var a;for(a=0;a<papaya.surface.SurfaceMango.MAGIC_NUMBER_LITTLE_1_5.length;a+=1)if(b[a]!==papaya.surface.SurfaceMango.MAGIC_NUMBER_LITTLE_1_5[a].charCodeAt(0))return!1;return!0};
  papaya.surface.SurfaceMango.prototype.isLittleEndian14=function(b){b=new Uint8Array(b);var a;for(a=0;a<papaya.surface.SurfaceMango.MAGIC_NUMBER_LITTLE_1_4.length;a+=1)if(b[a]!==papaya.surface.SurfaceMango.MAGIC_NUMBER_LITTLE_1_4[a].charCodeAt(0))return!1;return!0};
  papaya.surface.SurfaceMango.prototype.isVersion15=function(b){b=new Uint8Array(b);var a,c=!0;for(a=0;a<papaya.surface.SurfaceMango.MAGIC_NUMBER_LITTLE_1_5.length;a+=1)if(b[a]!==papaya.surface.SurfaceMango.MAGIC_NUMBER_LITTLE_1_5[a].charCodeAt(0)){c=!1;break}if(!c)for(c=!0,a=0;a<papaya.surface.SurfaceMango.MAGIC_NUMBER_BIG_1_5.length;a+=1)if(b[a]!==papaya.surface.SurfaceMango.MAGIC_NUMBER_BIG_1_5[a].charCodeAt(0)){c=!1;break}return c};
  papaya.surface.SurfaceMango.prototype.isVersion14=function(b){b=new Uint8Array(b);var a,c=!0;for(a=0;a<papaya.surface.SurfaceMango.MAGIC_NUMBER_LITTLE_1_4.length;a+=1)if(b[a]!==papaya.surface.SurfaceMango.MAGIC_NUMBER_LITTLE_1_4[a].charCodeAt(0)){c=!1;break}if(!c)for(c=!0,a=0;a<papaya.surface.SurfaceMango.MAGIC_NUMBER_BIG_1_4.length;a+=1)if(b[a]!==papaya.surface.SurfaceMango.MAGIC_NUMBER_BIG_1_4[a].charCodeAt(0)){c=!1;break}return c};
  papaya.surface.SurfaceMango.prototype.isLittleEndian=function(b){return this.isLittleEndian15(b)||this.isLittleEndian14(b)};papaya.surface.SurfaceMango.prototype.hasOverlay=function(){var b,a;for(b=0;b<papaya.surface.SurfaceMango.SURFACE_OVERLAY_MAGIC_NUMBER.length;b+=1)if((a=papaya.surface.SurfaceMango.SURFACE_OVERLAY_MAGIC_NUMBER[b])&&(a=papaya.surface.SurfaceMango.SURFACE_OVERLAY_MAGIC_NUMBER[b].charCodeAt(0)),this.dv.getUint8(this.index+b)!==a)return!1;return!0};
  papaya.surface.SurfaceMango.prototype.getString=function(b){var a,c=[];for(a=0;a<b;a+=1)c[a]=this.dv.getUint8(this.index+a);return String.fromCharCode.apply(null,c)};
  papaya.surface.SurfaceMango.prototype.readData=function(b,a,c){a(.2);this.littleEndian=this.isLittleEndian(b);this.dataLength=b.byteLength;this.v14=this.isVersion14(b);this.v15=this.isVersion15(b);this.index=papaya.surface.SurfaceMango.MAGIC_NUMBER_LITTLE_1_5.length;this.dv=new DataView(b);if(!this.v14&&!this.v15)throw Error("Only Mango surface format version 1.4 and 1.5 are supported!");this.onFinishedRead=c;b=this.dv.getUint32(this.index,this.littleEndian);this.index+=4;this.numSurfaces=this.dv.getUint32(this.index,
  this.littleEndian);this.index+=4;this.index+=128;this.imageDims[0]=this.dv.getUint32(this.index,this.littleEndian);this.index+=4;this.imageDims[1]=this.dv.getUint32(this.index,this.littleEndian);this.index+=4;this.imageDims[2]=this.dv.getUint32(this.index,this.littleEndian);this.index+=4;this.voxelDims[0]=this.dv.getFloat32(this.index,this.littleEndian);this.index+=4;this.voxelDims[1]=this.dv.getFloat32(this.index,this.littleEndian);this.index+=4;this.voxelDims[2]=this.dv.getFloat32(this.index,this.littleEndian);
  this.index+=4;this.origin[0]=this.dv.getFloat32(this.index,this.littleEndian)*this.voxelDims[0];this.index+=4;this.origin[1]=this.dv.getFloat32(this.index,this.littleEndian)*this.voxelDims[1];this.index+=4;this.origin[2]=this.dv.getFloat32(this.index,this.littleEndian)*this.voxelDims[2];this.index+=4;this.center[0]=this.imageDims[0]*this.voxelDims[0]/2;this.center[1]=this.imageDims[1]*this.voxelDims[1]/2;this.center[2]=this.imageDims[2]*this.voxelDims[2]/2;this.v14?(this.diffs[0]=this.center[0]-this.origin[0],
  this.diffs[1]=this.center[1]-this.origin[1],this.diffs[2]=this.origin[2]-this.center[2]):(this.diffs[0]=this.center[0]-this.origin[0],this.diffs[1]=this.center[1]-this.origin[1],this.diffs[2]=this.center[2]-this.origin[2]);this.index+=4;this.index+=b;this.readNextSurface(this,a)};
  papaya.surface.SurfaceMango.prototype.readNextSurface=function(b,a){var c=new papaya.surface.SurfaceMangoData;b.index+=papaya.surface.SurfaceMango.NAME_SIZE;b.surfaces[b.surfaceIndex]=c;b.surfaces[b.surfaceIndex].solidColor[0]=b.dv.getFloat32(b.index,b.littleEndian);b.index+=4;b.surfaces[b.surfaceIndex].solidColor[1]=b.dv.getFloat32(b.index,b.littleEndian);b.index+=4;b.surfaces[b.surfaceIndex].solidColor[2]=b.dv.getFloat32(b.index,b.littleEndian);b.index+=4;setTimeout(function(){b.readDataPoints(b,
  a)},0)};
  papaya.surface.SurfaceMango.prototype.readDataPoints=function(b,a){var c,d;a(.4);b.index+=4;c=b.dv.getInt32(b.index,b.littleEndian);b.index+=4;b.surfaces[b.surfaceIndex].pointData=new Float32Array(c);if(b.v14)for(d=0;d<c;d+=1,b.index+=4)b.surfaces[b.surfaceIndex].pointData[d]=(2!==d%3?-1:1)*(b.dv.getFloat32(b.index,b.littleEndian)+b.diffs[d%3]);else for(d=0;d<c;d+=1,b.index+=4)b.surfaces[b.surfaceIndex].pointData[d]=(0!==d%3?-1:1)*(b.dv.getFloat32(b.index,b.littleEndian)+b.diffs[d%3]);setTimeout(function(){b.readDataNormals(b,a)},
  0)};
  papaya.surface.SurfaceMango.prototype.readDataNormals=function(b,a){var c,d;a(.6);b.index+=4;c=b.dv.getInt32(b.index,b.littleEndian);b.index+=4;b.surfaces[b.surfaceIndex].normalsData=new Float32Array(c);if(b.v14)for(d=0;d<c;d+=1,b.index+=4)b.surfaces[b.surfaceIndex].normalsData[d]=(2!==d%3?-1:1)*b.dv.getFloat32(b.index,b.littleEndian);else for(d=0;d<c;d+=1,b.index+=4)b.surfaces[b.surfaceIndex].normalsData[d]=(0!==d%3?-1:1)*b.dv.getFloat32(b.index,b.littleEndian);setTimeout(function(){b.readDataTriangles(b,a)},
  0)};papaya.surface.SurfaceMango.prototype.readDataTriangles=function(b,a){var c,d;a(.8);b.index+=4;c=b.dv.getInt32(b.index,b.littleEndian);b.index+=4;b.surfaces[b.surfaceIndex].triangleData=new Uint32Array(c);for(d=0;d<c;d+=1,b.index+=4)b.surfaces[b.surfaceIndex].triangleData[d]=b.dv.getUint32(b.index,b.littleEndian);setTimeout(function(){b.readDataColors(b,a)},0)};
  papaya.surface.SurfaceMango.prototype.readDataColors=function(b,a){for(var c,d,e,f,h,g,m,l;b.index<b.dataLength;)if(b.hasOverlay()){b.index+=papaya.surface.SurfaceMango.SURFACE_OVERLAY_MAGIC_NUMBER.length;b.index+=papaya.surface.SurfaceMango.NAME_SIZE;m=b.getString(papaya.surface.SurfaceMango.NAME_SIZE);b.index+=papaya.surface.SurfaceMango.NAME_SIZE;m=m.replace(/\0/g,"");b.index+=4;c=b.dv.getFloat32(this.index,this.littleEndian);b.index+=4;d=b.dv.getFloat32(this.index,this.littleEndian);b.index+=
  4;e=255/(d-c);b.index+=4;b.index+=4;f=b.dv.getUint32(this.index,this.littleEndian);b.index+=4;h=new Float32Array(f);for(l=0;l<f;l+=1,b.index+=4)h[l]=b.dv.getFloat32(b.index,b.littleEndian);m=papaya.viewer.ColorTable.findLUT(m)!==papaya.viewer.ColorTable.TABLE_GRAYSCALE?new papaya.viewer.ColorTable(m,!1):new papaya.viewer.ColorTable("Spectrum",!1);m.updateLUT(0,255);f=b.surfaces[b.surfaceIndex].pointData.length/3;null===b.surfaces[b.surfaceIndex].colorsData&&(b.surfaces[b.surfaceIndex].colorsData=
  new Float32Array(4*f));for(l=0;l<f;l+=1)g=h[l],g<=c?0===b.surfaces[b.surfaceIndex].colorsData[4*l+3]&&(b.surfaces[b.surfaceIndex].colorsData[4*l]=b.surfaces[b.surfaceIndex].solidColor[0],b.surfaces[b.surfaceIndex].colorsData[4*l+1]=b.surfaces[b.surfaceIndex].solidColor[1],b.surfaces[b.surfaceIndex].colorsData[4*l+2]=b.surfaces[b.surfaceIndex].solidColor[2],b.surfaces[b.surfaceIndex].colorsData[4*l+3]=1):(g>d?(b.surfaces[b.surfaceIndex].colorsData[4*l]=m.lookupRed(255)/255,b.surfaces[b.surfaceIndex].colorsData[4*
  l+1]=m.lookupGreen(255)/255,b.surfaces[b.surfaceIndex].colorsData[4*l+2]=m.lookupBlue(255)/255):(g=Math.floor((g-c)*e+.5),b.surfaces[b.surfaceIndex].colorsData[4*l]=m.lookupRed(g)/255,b.surfaces[b.surfaceIndex].colorsData[4*l+1]=m.lookupGreen(g)/255,b.surfaces[b.surfaceIndex].colorsData[4*l+2]=m.lookupBlue(g)/255),b.surfaces[b.surfaceIndex].colorsData[4*l+3]=1)}else break;b.surfaceIndex++;b.surfaceIndex===b.numSurfaces?setTimeout(function(){b.onFinishedRead()},0):setTimeout(function(){b.readNextSurface(b,
  a)},0)};papaya.surface.SurfaceMango.prototype.getNumSurfaces=function(){return this.numSurfaces};papaya.surface.SurfaceMango.prototype.getNumPoints=function(b){return this.surfaces[b].pointData.length/3};papaya.surface.SurfaceMango.prototype.getNumTriangles=function(b){return this.surfaces[b].triangleData.length/3};papaya.surface.SurfaceMango.prototype.getSolidColor=function(b){return this.surfaces[b].solidColor};papaya.surface.SurfaceMango.prototype.getPointData=function(b){return this.surfaces[b].pointData};
  papaya.surface.SurfaceMango.prototype.getNormalsData=function(b){return this.surfaces[b].normalsData};papaya.surface.SurfaceMango.prototype.getTriangleData=function(b){return this.surfaces[b].triangleData};papaya.surface.SurfaceMango.prototype.getColorsData=function(b){return this.surfaces[b].colorsData};"use strict";papaya=papaya||{};papaya.surface=papaya.surface||{};
  papaya.surface.SurfaceVTK=papaya.surface.SurfaceVTK||function(){this.dv=this.onFinishedRead=this.error=null;this.index=0;this.littleEndian=!0;this.numPoints=0;this.description=this.vtkVersion=this.colorsData=this.normalsData=this.triangleData=this.pointData=null;this.ascii=!1;this.volume=null;this.headerRead=this.done=!1};papaya.surface.SurfaceVTK.MAGIC_NUMBER="# vtk DataFile Version";papaya.surface.SurfaceVTK.MAGIC_NUMBER_ASCII="ASCII";papaya.surface.SurfaceVTK.MAGIC_NUMBER_DATASET="DATASET";
  papaya.surface.SurfaceVTK.MAGIC_NUMBER_POLYDATA="POLYDATA";papaya.surface.SurfaceVTK.MAGIC_NUMBER_POINTS="POINTS";papaya.surface.SurfaceVTK.MAGIC_NUMBER_POLYGONS="POLYGONS";papaya.surface.SurfaceVTK.MAGIC_NUMBER_NORMALS="NORMALS";papaya.surface.SurfaceVTK.isThisFormat=function(b){return b.endsWith(".vtk")};papaya.surface.SurfaceVTK.prototype.isSurfaceDataBinary=function(){return!0};papaya.surface.SurfaceVTK.prototype.hasOverlay=function(){return!1};
  papaya.surface.SurfaceVTK.prototype.getNextLine=function(b){var a,c,d=[];b||(b=256);for(a=0;a<b;a+=1){if(this.index>=this.dv.byteLength){this.done=!0;break}c=this.dv.getUint8(this.index++);if(32>c){(!this.headerRead||this.ascii)&&this.index<this.dv.byteLength&&32>this.dv.getUint8(this.index)&&this.index++;break}d[a]=c}return String.fromCharCode.apply(null,d)};
  papaya.surface.SurfaceVTK.prototype.readData=function(b,a,c,d){var e=this,f;a(.2);this.onFinishedRead=c;this.dv=new DataView(b);this.volume=d;this.vtkVersion=this.getNextLine().substring(papaya.surface.SurfaceVTK.MAGIC_NUMBER.length).trim();this.description=this.getNextLine().trim();this.ascii=this.getNextLine()==papaya.surface.SurfaceVTK.MAGIC_NUMBER_ASCII;this.datasetType=this.getNextLine().substring(papaya.surface.SurfaceVTK.MAGIC_NUMBER_DATASET.length).trim();this.headerRead=!0;this.datasetType!=
  papaya.surface.SurfaceVTK.MAGIC_NUMBER_POLYDATA&&(this.error=Error("VTK: Only POLYDATA format is currently supported!"),this.onFinishedRead());f=this.getNextLine().split(" ");f[0]==papaya.surface.SurfaceVTK.MAGIC_NUMBER_POINTS&&setTimeout(function(){e.readDataPoints(e,f[1],a)},0)};
  papaya.surface.SurfaceVTK.prototype.readNextData=function(b,a){var c,d=.2;b.pointData&&(d+=.2);b.normalsData&&(d+=.2);b.triangleData&&(d+=.2);a(d);if(b.done||b.pointData&&b.normalsData&&b.triangleData)b.onFinishedRead();else(c=this.getNextLine().split(" "))&&c[0]==papaya.surface.SurfaceVTK.MAGIC_NUMBER_POINTS?setTimeout(function(){b.readDataPoints(b,c[1],a)},0):c&&c[0]==papaya.surface.SurfaceVTK.MAGIC_NUMBER_POLYGONS?setTimeout(function(){b.readDataTriangles(b,c[1],a)},0):c&&c[0]==papaya.surface.SurfaceVTK.MAGIC_NUMBER_NORMALS?
  setTimeout(function(){b.readDataNormals(b,a)},0):setTimeout(function(){b.readNextData(b,a)},0)};
  papaya.surface.SurfaceVTK.prototype.readDataPoints=function(b,a,c){var d,e=0,f=[],h,g=0,m=3*a;b.numPoints=a;b.pointData=new Float32Array(m);var l=b.volume.header.orientation.orientation;d=b.volume.header.voxelDimensions;h=b.volume.header.origin;a=("-"===l.charAt(3)?1:-1)*(d.flip?-1:1);var q="-"!==l.charAt(4)?1:-1,u="-"!==l.charAt(5)?1:-1,w=l.indexOf("X"),C=l.indexOf("Y"),l=l.indexOf("Z"),B=a*h.x*d.xSize,A=q*h.y*d.ySize,E=u*h.z*d.zSize;if(b.ascii)for(;g<m;)for(h=b.getNextLine().trim().split(" "),d=
  0;d<h.length;d+=1)f[e]=parseFloat(h[d]),2===e&&(b.pointData[g++]=f[w]*a-B,b.pointData[g++]=f[C]*q-A,b.pointData[g++]=f[l]*u-E),e++,e%=3;else for(d=0;d<m;d+=1,b.index+=4)f[e]=b.dv.getFloat32(b.index,!1),2===e&&(b.pointData[g++]=f[w]*a-B,b.pointData[g++]=f[C]*q-A,b.pointData[g++]=f[l]*u-E),e++,e%=3;b.readNextData(b,c)};
  papaya.surface.SurfaceVTK.prototype.readDataNormals=function(b,a){var c,d,e=0,f=3*b.numPoints;b.normalsData=new Float32Array(f);if(b.ascii)for(;e<f;)for(d=b.getNextLine().trim().split(" "),c=0;c<d.length;c+=1)b.normalsData[e++]=parseFloat(d[c]);else for(c=0;c<f;c+=1,b.index+=4)b.normalsData[c]=b.dv.getFloat32(b.index,!1);b.readNextData(b,a)};
  papaya.surface.SurfaceVTK.prototype.readDataTriangles=function(b,a,c){var d,e=0,f=3*a;b.triangleData=new Uint32Array(f);if(b.ascii)for(;e<f;)for(a=b.getNextLine().trim().split(" "),d=1;d<a.length;d+=1)b.triangleData[e++]=parseInt(a[d],10);else for(d=0;d<a;d+=1,b.index+=16)b.triangleData[3*d]=b.dv.getUint32(b.index+4,!1),b.triangleData[3*d+1]=b.dv.getUint32(b.index+8,!1),b.triangleData[3*d+2]=b.dv.getUint32(b.index+12,!1);b.readNextData(b,c)};papaya.surface.SurfaceVTK.prototype.getColorsData=function(){return null};
  papaya.surface.SurfaceVTK.prototype.getNumSurfaces=function(){return 1};papaya.surface.SurfaceVTK.prototype.getNumPoints=function(){return this.pointData.length/3};papaya.surface.SurfaceVTK.prototype.getNumTriangles=function(){return this.triangleData.length/3};papaya.surface.SurfaceVTK.prototype.getSolidColor=function(){return this.solidColor};papaya.surface.SurfaceVTK.prototype.getPointData=function(){return this.pointData};papaya.surface.SurfaceVTK.prototype.getNormalsData=function(){return this.normalsData};
  papaya.surface.SurfaceVTK.prototype.getTriangleData=function(){return this.triangleData};"use strict";papaya=papaya||{};papaya.ui=papaya.ui||{};papaya.ui.Dialog=papaya.ui.Dialog||function(b,a,c,d,e,f,h,g){this.container=b;this.viewer=b.viewer;this.title=a;this.modifier="";papaya.utilities.StringUtils.isStringBlank(h)||(this.modifier=h);this.id=this.title.replace(/ /g,"_");this.content=c;this.dataSource=d;this.callback=e;this.callbackOk=f;this.doWrap=g;this.scrollBehavior2=this.scrollBehavior1=null};
  papaya.ui.Dialog.showModalDialog=function(b,a,c){var d,e,f;b=document.documentElement;var h=window.pageYOffset||b.scrollTop;d=$(window).outerWidth();b=$(window).outerHeight();e=$(c).outerWidth();f=$(c).outerHeight();d=d/2-e/2+"px";b=h+b/2-f/2+"px";$(c).css({position:"absolute",zIndex:100,left:d,top:b});a.removeScroll();$(c).hide().fadeIn(200)};
  papaya.ui.Dialog.prototype.showDialog=function(){var b,a,c,d,e;d="#"+this.id;b=$(d);b.remove();e=$("body");c="<div id='"+this.id+"' class='"+PAPAYA_DIALOG_CSS+"'><span class='"+PAPAYA_DIALOG_TITLE_CSS+"'>"+this.title+"</span>";if(this.content){c+="<div class='"+PAPAYA_DIALOG_CONTENT_CSS+"'><table>";for(b=0;b<this.content.items.length;b+=1)if(this.content.items[b].spacer)c+="<tr><td class='"+PAPAYA_DIALOG_CONTENT_LABEL_CSS+"'>&nbsp;</td><td class='"+PAPAYA_DIALOG_CONTENT_CONTROL_CSS+"'>&nbsp;</td></tr>";
  else if(this.content.items[b].readonly)c+="<tr><td class='"+PAPAYA_DIALOG_CONTENT_LABEL_CSS+"'>"+this.content.items[b].label+"</td><td class='"+PAPAYA_DIALOG_CONTENT_CONTROL_CSS+"' id='"+this.content.items[b].field+"'></td></tr>";else{a=this.content.items[b].disabled&&!0===papaya.utilities.ObjectUtils.bind(this.container,papaya.utilities.ObjectUtils.dereferenceIn(this,this.content.items[b].disabled))()?"disabled='disabled'":"";c+="<tr><td class='"+PAPAYA_DIALOG_CONTENT_LABEL_CSS+"'>"+this.content.items[b].label+
  "</td><td class='"+PAPAYA_DIALOG_CONTENT_CONTROL_CSS+"'><select "+a+" id='"+this.content.items[b].field+"'>";for(a=0;a<this.content.items[b].options.length;a+=1)c+="<option value='"+this.content.items[b].options[a]+"'>"+papaya.utilities.StringUtils.truncateMiddleString(this.content.items[b].options[a].toString(),40)+"</option>";c+="</select></td></tr>";this.content.items[b].help&&(c+="<tr><td colspan='2' class='"+PAPAYA_DIALOG_CONTENT_HELP+"'>"+this.content.items[b].help+"</td></tr>")}c+="</table></div>"}c+=
  "<div class='"+PAPAYA_DIALOG_BUTTON_CSS+"'><button type='button' id='"+this.id+"-Ok'>Ok</button></div></div>";e.append('<div class="'+PAPAYA_DIALOG_BACKGROUND+'"></div>');e.append(c);for(b=0;b<this.content.items.length;b+=1)this.content.items[b].readonly?(c=this.dataSource[this.content.items[b].field](this.modifier),null!==c?$("#"+this.content.items[b].field).html(c):$("#"+this.content.items[b].field).parent().remove()):this.content.items[b].spacer||(c=$("#"+this.content.items[b].field),c.val(this.dataSource[this.content.items[b].field]),
  c.change(papaya.utilities.ObjectUtils.bind(this,this.doAction,[this.content.items[b].field])));this.doWrap||$("."+PAPAYA_DIALOG_CONTENT_CSS).addClass(PAPAYA_DIALOG_CONTENT_NOWRAP_CSS);$("#"+this.id+"-Ok").click(papaya.utilities.ObjectUtils.bind(this,this.doOk));b=$(d);e.addClass(PAPAYA_DIALOG_STOPSCROLL);papaya.ui.Dialog.showModalDialog(this,this.viewer,b[0])};
  papaya.ui.Dialog.prototype.doOk=function(){var b,a;b=$("."+PAPAYA_DIALOG_CSS);a=$("."+PAPAYA_DIALOG_BACKGROUND);b.hide(100);a.hide(100);b.remove();a.remove();window.onmousewheel=this.scrollBehavior1;document.onmousewheel=this.scrollBehavior2;this.callbackOk&&this.callbackOk();$("body").removeClass(PAPAYA_DIALOG_STOPSCROLL);this.container.viewer.addScroll()};papaya.ui.Dialog.prototype.doAction=function(b){this.callback(b,$("#"+b).val())};"use strict";papaya=papaya||{};papaya.ui=papaya.ui||{};
  papaya.ui.Menu=papaya.ui.Menu||function(b,a,c,d,e){this.viewer=b;this.method=a.method;this.isTitleBar=a.titleBar;this.label=a.label;this.icons=a.icons;this.callback=c;this.dataSource=d;this.items=[];this.rangeItem=null;this.menuOnHover=a.menuOnHover;this.contextMenu=!1;void 0===e||null===e?(this.imageIndex=-1,this.modifier=this.viewer.container.containerIndex):(this.imageIndex=e,this.modifier=e+this.viewer.container.containerIndex);this.buttonId=this.label.replace(/ /g,"_").replace("...","_")+(this.modifier||
  "");this.menuId=(this.label+"Menu").replace(/ /g,"_").replace("...","_")+(this.modifier||"");this.isRight=null!==a.icons;this.isImageButton=a.imageButton;this.isSurfaceButton=a.surfaceButton;this.htmlParent=this.viewer.container.showControlBar&&this.viewer.container.kioskMode&&this.viewer.container.showImageButtons?this.viewer.container.sliderControlHtml:this.viewer.container.toolbarHtml};
  papaya.ui.Menu.doShowMenu=function(b,a,c,d){var e,f,h,g,m=$(a).parent().offset();$(b.canvas).offset();$(b.container.display.canvas).outerHeight();e=$(a).offset();f=$(a).outerWidth();h=$(c).outerWidth();g=$(c).outerHeight();e=e.left-m.left+(d?-1*h+f:0)+"px";b=b.container.showControlBar&&b.container.kioskMode&&b.container.showImageButtons?-1*PAPAYA_SPACING-g+"px":$(a).outerHeight()+(d?0:PAPAYA_SPACING)+"px";$(c).css({position:"absolute",zIndex:100,left:e,top:b});$(c).hide().fadeIn(200)};
  papaya.ui.Menu.getColorComponents=function(b){return b?b.match(/\d+/g):[0,0,0,255]};papaya.ui.Menu.getNiceForegroundColor=function(b){b=papaya.ui.Menu.getColorComponents(b);127<(parseInt(b[0])+parseInt(b[1])+parseInt(b[2]))/3?b[0]=b[1]=b[2]=0:b[0]=b[1]=b[2]=255;return"rgb("+b[0]+", "+b[1]+", "+b[2]+")"};
  papaya.ui.Menu.prototype.buildMenuButton=function(){var b,a,c;c="#"+this.buttonId;b=$(c);b.remove();b=null;this.icons?(b="<span id='"+this.buttonId+"' class='"+PAPAYA_MENU_UNSELECTABLE+" "+PAPAYA_MENU_ICON_CSS+" "+(this.isImageButton?PAPAYA_MENU_BUTTON_CSS:"")+"'"+(this.isRight?" style='float:right'":"")+"><img class='"+PAPAYA_MENU_UNSELECTABLE+"' style='width:"+papaya.viewer.ColorTable.ICON_SIZE+"px; height:"+papaya.viewer.ColorTable.ICON_SIZE+"px; vertical-align:bottom; ",b=!this.isSurfaceButton&&
  this.dataSource.isSelected(parseInt(this.imageIndex,10))?b+"border:2px solid #FF5A3D;background-color:#eeeeee;padding:1px;":b+"border:2px outset lightgray;background-color:#eeeeee;padding:1px;",b=this.method?b+("' src='"+this.icons[papaya.utilities.ObjectUtils.bind(this.viewer,papaya.utilities.ObjectUtils.dereferenceIn(this.viewer,this.method))()?1:0]+"' /></span>"):b+("' src='"+this.icons[0]+"' /></span>")):b=this.isTitleBar?"<div class='"+PAPAYA_MENU_UNSELECTABLE+" "+PAPAYA_MENU_TITLEBAR_CSS+" "+
  PAPAYA_TITLEBAR_CSS+"' style='z-index:-1;position:absolute;top:0px;width:"+this.htmlParent.width()+"px;text-align:center;color:"+papaya.ui.Menu.getNiceForegroundColor(this.viewer.bgColor)+"'>"+this.label+"</div>":"<span id='"+this.buttonId+"' class='"+PAPAYA_MENU_UNSELECTABLE+" "+PAPAYA_MENU_LABEL_CSS+"'>"+this.label+"</span>";this.htmlParent.append(b);this.isTitleBar||(b=$(c),c="#"+this.buttonId+" > img",c=$(c),a=this,this.menuOnHover&&(c.mouseenter(function(){a.showHoverMenuTimeout=setTimeout(papaya.utilities.ObjectUtils.bind(a,
  a.showMenu),500)}),c.mouseleave(function(){clearTimeout(a.showHoverMenuTimeout);a.showHoverMenuTimeout=null})),b.click(papaya.utilities.ObjectUtils.bind(this,this.doClick)),this.icons?(c.hover(function(){1<a.icons.length?$(this).css({"border-color":"gray"}):$(this).css({"border-color":"#FF5A3D"})},papaya.utilities.ObjectUtils.bind(a,function(){a.dataSource.isSelected(parseInt(a.imageIndex,10))&&a.dataSource.isSelectable()?$("#"+a.buttonId+" > img").css({border:"2px solid #FF5A3D"}):$("#"+a.buttonId+
  " > img").css({border:"2px outset lightgray"})})),c.mousedown(function(){$(this).css({border:"2px inset lightgray"})}),c.mouseup(function(){$(this).css({border:"2px outset lightgray"})})):this.isTitleBar||b.hover(function(){$(this).toggleClass(PAPAYA_MENU_BUTTON_HOVERING_CSS)}));return this.buttonId};papaya.ui.Menu.prototype.setMenuButton=function(b){this.buttonId=b};
  papaya.ui.Menu.prototype.buildMenu=function(){var b;this.htmlParent.append("<ul id='"+this.menuId+"' class='"+PAPAYA_MENU_CSS+"'></ul>");this.viewer.container.contextManager&&papaya.utilities.PlatformUtils.smallScreen&&($("#"+this.menuId)[0].style.width=this.viewer.viewerDim-10+"px");for(b=0;b<this.items.length;b+=1)this.items[b].hide||this.items[b].buildHTML(this.menuId)};papaya.ui.Menu.prototype.addMenuItem=function(b){b instanceof papaya.ui.MenuItemRange&&(this.rangeItem=b);this.items.push(b)};
  papaya.ui.Menu.prototype.showContextMenu=function(){var b,a,c,d=0,e;0<this.items.length&&(c="#"+this.menuId,a=$(c),b=a.is(":visible"),a.remove(),b||(this.htmlParent=this.viewer.container.viewerHtml,this.buildMenu(),a=$(c),a.hide(),b=a.outerHeight(),c=$(this.viewer.canvas).offset(),e=$(this.viewer.container.display.canvas).outerHeight(),this.viewer.contextMenuMousePositionY+b>c.top+e+$(this.viewer.canvas).outerHeight()+PAPAYA_SPACING&&(d=this.viewer.contextMenuMousePositionY+b-(c.top+e+$(this.viewer.canvas).outerHeight()+
  PAPAYA_SPACING)-1),this.viewer.container.contextManager&&papaya.utilities.PlatformUtils.smallScreen?a.css({position:"absolute",zIndex:100,left:this.viewer.canvasRect.left,top:this.viewer.canvasRect.top-d}):a.css({position:"absolute",zIndex:100,left:this.viewer.contextMenuMousePositionX+this.viewer.canvasRect.left,top:this.viewer.contextMenuMousePositionY+this.viewer.canvasRect.top-d}),a.hide().fadeIn(200)))};
  papaya.ui.Menu.prototype.showMenu=function(){var b,a,c;this.viewer.container.toolbar.closeAllMenus();this.contextMenu?this.showContextMenu():0<this.items.length&&(c="#"+this.menuId,a=$(c),b=a.is(":visible"),a.remove(),b||(b=$("#"+this.buttonId),this.buildMenu(),a=$(c),a.hide(),papaya.ui.Menu.doShowMenu(this.viewer,b[0],a[0],this.isRight)))};
  papaya.ui.Menu.prototype.doClick=function(){var b;b=$("#"+this.menuId).is(":visible");this.callback(this.buttonId);this.icons&&(this.method?$("#"+this.buttonId+" > img").attr("src",this.icons[papaya.utilities.ObjectUtils.bind(this.viewer,papaya.utilities.ObjectUtils.dereferenceIn(this.viewer,this.method))()?1:0]):$("#"+this.buttonId+" > img").attr("src",this.icons[0]));this.menuOnHover||b||this.showMenu()};
  papaya.ui.Menu.prototype.updateRangeItem=function(b,a){this.rangeItem&&($("#"+this.rangeItem.minId).val(b),$("#"+this.rangeItem.maxId).val(a))};"use strict";papaya=papaya||{};papaya.ui=papaya.ui||{};
  papaya.ui.MenuItem=papaya.ui.MenuItem||function(b,a,c,d,e,f,h){this.viewer=b;this.modifier="";papaya.utilities.StringUtils.isStringBlank(h)||(this.modifier="-"+h);this.dataSource=e;this.method=f;this.label=this.dataSource&&this.method?this.dataSource[this.method]():a;this.action=c+this.modifier;this.id=this.action.replace(/ /g,"_")+this.viewer.container.containerIndex;this.callback=d;this.menu=null;this.isContext=!1};
  papaya.ui.MenuItem.prototype.buildHTML=function(b){var a;a=this.dataSource&&this.method?this.dataSource[this.method]():this.label;a="<li id='"+this.id+"'><span class='"+PAPAYA_MENU_UNSELECTABLE+"'>"+a+"</span>"+(this.menu?"<span style='float:right'>&nbsp;&#x25B6;</span>":"")+"</li>";$("#"+b).append(a);b=$("#"+this.id);this.viewer.container.contextManager&&papaya.utilities.PlatformUtils.smallScreen&&(b[0].style.width=this.viewer.viewerDim-10+"px",b[0].style.fontSize="18px");b.click(papaya.utilities.ObjectUtils.bind(this,
  function(a){this.doAction(this.isContext&&a.shiftKey)}));b.hover(function(){$(this).toggleClass(PAPAYA_MENU_HOVERING_CSS)})};papaya.ui.MenuItem.prototype.doAction=function(b){b||this.menu||(this.viewer.showingContextMenu=!1);this.callback(this.action,null,b)};"use strict";papaya=papaya||{};papaya.ui=papaya.ui||{};
  papaya.ui.MenuItemCheckBox=papaya.ui.MenuItemCheckBox||function(b,a,c,d,e,f,h){this.viewer=b;this.label=a;this.modifier="";void 0!==h&&null!==h&&(this.modifier="-"+h);this.action=c+this.modifier;this.method=f;this.id=this.action.replace(/ /g,"_").replace(/\(/g,"").replace(/\)/g,"")+this.viewer.container.containerIndex;this.callback=d;this.dataSource=e};
  papaya.ui.MenuItemCheckBox.prototype.buildHTML=function(b){var a,c;a=this.dataSource[this.method](this.label);c="";a&&(c="checked='checked'");a="<li id='"+this.id+"'><input type='checkbox' class='"+PAPAYA_MENU_COLORTABLE_CSS+"' name='"+PAPAYA_MENU_COLORTABLE_CSS+"' id='"+this.id+"' value='"+this.id+"' "+c+"><span class='"+PAPAYA_MENU_UNSELECTABLE+"'>&nbsp;"+this.label+"</span></li>";$("#"+b).append(a);b=$("#"+this.id);b.click(papaya.utilities.ObjectUtils.bind(this,this.doAction));b.hover(function(){$(this).toggleClass(PAPAYA_MENU_HOVERING_CSS)})};
  papaya.ui.MenuItemCheckBox.prototype.doAction=function(){$("."+PAPAYA_MENU_COLORTABLE_CSS).removeAttr("checked");$("#"+this.id+" > input")[0].checked=!0;this.callback(this.action,null,!0)};"use strict";papaya=papaya||{};papaya.ui=papaya.ui||{};
  papaya.ui.MenuItemRadioButton=papaya.ui.MenuItemRadioButton||function(b,a,c,d,e,f,h){this.viewer=b;this.label=a;this.modifier="";void 0!==h&&null!==h&&(this.modifier="-"+h);this.methodParam=this.action=c+this.modifier;this.method=f;this.id=this.action.replace(/ /g,"_").replace(/\(/g,"").replace(/\)/g,"")+this.viewer.container.containerIndex;this.callback=d;this.dataSource=e};
  papaya.ui.MenuItemRadioButton.prototype.buildHTML=function(b){var a,c;a=this.dataSource[this.method](this.label);c="";a&&(c="checked='checked'");a="<li id='"+this.id+"'><input type='radio' class='"+PAPAYA_MENU_COLORTABLE_CSS+"' name='"+PAPAYA_MENU_COLORTABLE_CSS+"' id='"+this.id+"' value='"+this.id+"' "+c+"><span class='"+PAPAYA_MENU_UNSELECTABLE+"'>&nbsp;"+this.label+"</span></li>";$("#"+b).append(a);b=$("#"+this.id);b.click(papaya.utilities.ObjectUtils.bind(this,this.doAction));b.hover(function(){$(this).toggleClass(PAPAYA_MENU_HOVERING_CSS)})};
  papaya.ui.MenuItemRadioButton.prototype.doAction=function(){$("."+PAPAYA_MENU_COLORTABLE_CSS).removeAttr("checked");$("#"+this.id+" > input")[0].checked=!0;this.callback(this.action,null,!0)};"use strict";papaya=papaya||{};papaya.ui=papaya.ui||{};
  papaya.ui.MenuItemFileChooser=papaya.ui.MenuItemFileChooser||function(b,a,c,d,e,f){this.viewer=b;this.label=a;this.modifier="";void 0!==f&&null!==f&&(this.modifier="-"+f);this.action=c+this.modifier;this.id=this.action.replace(/ /g,"_")+this.viewer.container.containerIndex;this.fileChooserId="fileChooser"+this.label.replace(/ /g,"_").replace(/\./g,"")+this.viewer.container.containerIndex+(e?"folder":"");this.callback=d;this.folder=e};
  papaya.ui.MenuItemFileChooser.prototype.buildHTML=function(b){var a,c;a=this;c="<li id='"+this.id+"'><span class='"+PAPAYA_MENU_UNSELECTABLE+"'><label class='"+PAPAYA_MENU_FILECHOOSER+"' for='"+this.fileChooserId+"'>"+this.label;c=this.folder?c+("</label><input type='file' id='"+this.fileChooserId+"' multiple='multiple' webkitdirectory directory name='files' /></span></li>"):c+("</label><input type='file' id='"+this.fileChooserId+"' multiple='multiple' name='files' /></span></li>");$("#"+b).append(c);
  $("#"+this.fileChooserId)[0].onchange=papaya.utilities.ObjectUtils.bind(a,function(){a.callback(a.action,document.getElementById(a.fileChooserId).files)});$("#"+this.id).hover(function(){$(this).toggleClass(PAPAYA_MENU_HOVERING_CSS)})};"use strict";papaya=papaya||{};papaya.ui=papaya.ui||{};
  papaya.ui.MenuItemRange=papaya.ui.MenuItemRange||function(b,a,c,d,e,f,h){"ChangeRangeNeg"===c&&(this.negatives=!0,h=b.getScreenVolumeIndex(b.screenVolumes[parseInt(h)].negativeScreenVol).toString());this.viewer=b;this.label=a;this.index=h;this.modifier="";void 0!==h&&(this.modifier="-"+h);this.action=c+this.modifier;this.minId=this.action.replace(/ /g,"_")+"Min"+this.viewer.container.containerIndex;this.maxId=this.action.replace(/ /g,"_")+"Max"+this.viewer.container.containerIndex;this.callback=d;
  this.dataSource=e;this.method=f;this.id=a+this.modifier+this.viewer.container.containerIndex;this.grabOffset=0;this.screenVol=this.viewer.screenVolumes[this.index]};papaya.ui.MenuItemRange.getRelativeMousePositionFromParentX=function(b,a){var c=b.parent().offset();return papaya.utilities.PlatformUtils.getMousePositionX(a)-c.left};papaya.ui.MenuItemRange.getRelativeMousePositionX=function(b,a){var c=b.offset();return papaya.utilities.PlatformUtils.getMousePositionX(a)-c.left};
  papaya.ui.MenuItemRange.prototype.buildHTML=function(b){var a,c,d,e,f,h,g,m,l,q;f=this.id+"SliderMin";g=this.id+"SliderMax";l=this.id+"Slider";a=this.dataSource[this.method]();c=this;a="<li id='"+this.id+"'><span class='"+PAPAYA_MENU_UNSELECTABLE+"' style=''><input class='"+PAPAYA_MENU_INPUT_FIELD+"' type='text' size='4' id='"+this.minId+"' value='"+a[0]+"' /><div style='display:inline-block;position:relative;width:"+(papaya.viewer.ColorTable.COLOR_BAR_WIDTH+papaya.viewer.ColorTable.ARROW_ICON_WIDTH)+
  "px;top:-12px;'><img id='"+f+"' class='"+PAPAYA_MENU_UNSELECTABLE+"' style='position:absolute;top:5px;left:"+c.screenVol.colorTable.minLUT/papaya.viewer.ColorTable.LUT_MAX*(papaya.viewer.ColorTable.COLOR_BAR_WIDTH-1)+"px;z-index:99' src='"+papaya.viewer.ColorTable.ARROW_ICON+"' /><img id='"+g+"' class='"+PAPAYA_MENU_UNSELECTABLE+"' style='position:absolute;top:5px;left:"+c.screenVol.colorTable.maxLUT/papaya.viewer.ColorTable.LUT_MAX*(papaya.viewer.ColorTable.COLOR_BAR_WIDTH-1)+"px;z-index:99' src='"+
  papaya.viewer.ColorTable.ARROW_ICON+"' /><img id='"+l+"' class='"+PAPAYA_MENU_UNSELECTABLE+"' style='position:absolute;top:0;left:"+parseInt(papaya.viewer.ColorTable.ARROW_ICON_WIDTH/2,10)+"px;' src='"+this.viewer.screenVolumes[parseInt(this.index,10)].colorBar+"' /></div><input class='"+PAPAYA_MENU_INPUT_FIELD+"' type='text' size='4' id='"+this.maxId+"' value='"+a[1]+"' /></span></li>";$("#"+b).append(a);d=$("#"+this.minId);e=$("#"+this.maxId);h=$("#"+f);m=$("#"+g);q=$("#"+l);papaya.utilities.PlatformUtils.ios&&
  (d[0].style.width="35px",d[0].style.marginRight="4px",e[0].style.width="35px",e[0].style.marginRight="4px");h.bind(papaya.utilities.PlatformUtils.ios?"touchstart":"mousedown",function(a){c.grabOffset=papaya.ui.MenuItemRange.getRelativeMousePositionX(h,a);$(window).bind(papaya.utilities.PlatformUtils.ios?"touchmove":"mousemove",function(a){var b;b=c.screenVol.colorTable.maxLUT/papaya.viewer.ColorTable.LUT_MAX*(papaya.viewer.ColorTable.COLOR_BAR_WIDTH-1);a=papaya.ui.MenuItemRange.getRelativeMousePositionFromParentX(h,
  a)-c.grabOffset;0>a?a=0:a>=papaya.viewer.ColorTable.COLOR_BAR_WIDTH?a=papaya.viewer.ColorTable.COLOR_BAR_WIDTH-1:a>b&&(a=b);c.screenVol.updateMinLUT(Math.round(a/(papaya.viewer.ColorTable.COLOR_BAR_WIDTH-1)*papaya.viewer.ColorTable.LUT_MAX));h.css({left:a+"px"});c.viewer.drawViewer(!1,!0);d.val(c.dataSource[c.method]()[0]);c.screenVol.updateColorBar();q.attr("src",c.screenVol.colorBar)});return!1});m.bind(papaya.utilities.PlatformUtils.ios?"touchstart":"mousedown",function(a){c.grabOffset=papaya.ui.MenuItemRange.getRelativeMousePositionX(m,
  a);$(window).bind(papaya.utilities.PlatformUtils.ios?"touchmove":"mousemove",function(a){var b;b=c.screenVol.colorTable.minLUT/papaya.viewer.ColorTable.LUT_MAX*(papaya.viewer.ColorTable.COLOR_BAR_WIDTH-1);a=papaya.ui.MenuItemRange.getRelativeMousePositionFromParentX(m,a)-c.grabOffset;0>a?a=0:a>=papaya.viewer.ColorTable.COLOR_BAR_WIDTH?a=papaya.viewer.ColorTable.COLOR_BAR_WIDTH-1:a<b&&(a=b);c.screenVol.updateMaxLUT(Math.round(a/(papaya.viewer.ColorTable.COLOR_BAR_WIDTH-1)*papaya.viewer.ColorTable.LUT_MAX));
  m.css({left:a+"px"});c.viewer.drawViewer(!1,!0);e.val(c.dataSource[c.method]()[1]);c.screenVol.updateColorBar();q.attr("src",c.screenVol.colorBar)});return!1});$(window).bind(papaya.utilities.PlatformUtils.ios?"touchend":"mouseup",function(){$(window).unbind(papaya.utilities.PlatformUtils.ios?"touchmove":"mousemove")});$("#"+this.id).hover(function(){$(this).toggleClass(PAPAYA_MENU_HOVERING_CSS)});d.change(papaya.utilities.ObjectUtils.bind(this,function(){c.rangeChanged(!0)}));e.change(papaya.utilities.ObjectUtils.bind(this,
  function(){c.rangeChanged(!1)}));d.keyup(papaya.utilities.ObjectUtils.bind(this,function(a){13===a.keyCode&&(c.rangeChanged(!1),c.viewer.container.toolbar.closeAllMenus())}));e.keyup(papaya.utilities.ObjectUtils.bind(this,function(a){13===a.keyCode&&(c.rangeChanged(!1),c.viewer.container.toolbar.closeAllMenus())}));papaya.utilities.PlatformUtils.ios||setTimeout(function(){d.focus();d.select()},10)};
  papaya.ui.MenuItemRange.prototype.rangeChanged=function(b){this.updateDataSource(b);this.viewer.drawViewer(!0);this.resetSlider()};papaya.ui.MenuItemRange.prototype.updateDataSource=function(b){var a,c,d,e;e=$("#"+this.minId);d=$("#"+this.maxId);c=parseFloat(e.val());isNaN(c)&&(c=this.dataSource.screenMin);a=parseFloat(d.val());isNaN(a)&&(a=this.dataSource.screenMax);e.val(c);d.val(a);this.negatives?this.dataSource.setScreenRangeNegatives(c,a):this.dataSource.setScreenRange(c,a);b&&(d.focus(),d.select())};
  papaya.ui.MenuItemRange.prototype.resetSlider=function(){var b,a,c;b=this.id+"SliderMin";a=this.id+"SliderMax";c=this.id+"Slider";b=$("#"+b);a=$("#"+a);c=$("#"+c);b.css({left:0});a.css({left:papaya.viewer.ColorTable.COLOR_BAR_WIDTH-1+"px"});this.screenVol.resetDynamicRange();c.attr("src",this.screenVol.colorBar)};"use strict";papaya=papaya||{};papaya.ui=papaya.ui||{};
  papaya.ui.MenuItemSlider=papaya.ui.MenuItemSlider||function(b,a,c,d,e,f,h){"alphaneg"===c&&(c="alpha",h=b.getScreenVolumeIndex(b.screenVolumes[parseInt(h)].negativeScreenVol).toString());this.viewer=b;this.label=a;this.index=h;this.modifier="";papaya.utilities.StringUtils.isStringBlank(h)||(this.modifier="-"+h);this.dataSource=e;this.method=f;this.action=c;this.event=-1!=this.action.toLowerCase().indexOf("alpha")||this.viewer.screenVolumes[0].isHighResSlice?"change":"input change";this.id=this.action.replace(/ /g,
  "_")+this.viewer.container.containerIndex+"_"+this.index;this.callback=d;this.screenVol=e};
  papaya.ui.MenuItemSlider.prototype.buildHTML=function(b){var a,c,d,e,f;f=this.event;c=this.id+"Slider";a="<li id='"+this.id+"'><span style='padding-right:5px;' class='"+PAPAYA_MENU_UNSELECTABLE+"'>"+this.label+":</span><input min='0' max='100' value='"+parseInt(100*(1-this.screenVol[this.action]),10)+"' id='"+c+"' class='"+PAPAYA_MENU_SLIDER+"' type='range' /></li>";$("#"+b).append(a);$("#"+this.id).hover(function(){$(this).toggleClass(PAPAYA_MENU_HOVERING_CSS)});d=$("#"+c);e=this;$("#"+this.id+"Slider").on(f,
  function(){e.screenVol[e.action]=1-d.val()/100;e.doAction();e.viewer.drawViewer(!0,!1)})};papaya.ui.MenuItemSlider.prototype.doAction=function(){this.callback(this.action,null,!0)};"use strict";papaya=papaya||{};papaya.ui=papaya.ui||{};papaya.ui.MenuItemSpacer=papaya.ui.MenuItemSpacer||function(){};papaya.ui.MenuItemSpacer.prototype.buildHTML=function(b){var a;a="<div class='"+PAPAYA_MENU_SPACER_CSS+" "+PAPAYA_MENU_UNSELECTABLE+"'></div>";$("#"+b).append(a)};"use strict";papaya=papaya||{};
  papaya.ui=papaya.ui||{};papayaLoadableImages=papayaLoadableImages||[];papaya.ui.Toolbar=papaya.ui.Toolbar||function(b){this.container=b;this.viewer=b.viewer;this.spaceMenu=this.surfaceMenus=this.imageMenus=null};papaya.ui.Toolbar.SIZE=22;papaya.ui.Toolbar.ICON_IMAGESPACE="data:image/gif;base64,R0lGODlhFAAUAPcAMf//////GP///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////2f/ZNbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1qWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpVpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAACoALAAAAAAUABQAAAipAFUIHEiwoMB/A1coXLiwisOHVf4hVLFCosWLGC9SzMgR48Z/VEJSUVjFj0mTESdWBCmS5EmU/6oIXCly5IqSLx/OlFjT5Us/DneybIkzp8yPDElChCjwj8Q/UKOqmkqVatOnUaGqmsaVq1UVTv+lGjv2z9SuXlVdFUs2ldmtaKeubev2bFy1YCXSfYt2mty8/6CS5XtXRcasVRMftJj1beK/hicanKwiIAA7";
  papaya.ui.Toolbar.ICON_WORLDSPACE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAYAAACpF6WWAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAplJREFUeNqM1H1ozVEcx/Hr3p+7O08jQzbzMErznEItK0+Fv0Ye/tki20ia//wn+YMSaXkoEiKkkCVKZhOipsnDstnFagzlrmGMNfeO6/Nd71unu2s59bq7O517ft/z/X7Pz+dLPUbLJrkqX+SbdEubfJZK2cC6PiOQYm61HJcpkintEpcmCcpryZV5spaHhvvbdJ9slsPyU67wgPlEli0X5aiMkMeyXSbKnVRRVxDRRtkm5czbZrv5vkgu8z1P9stWfleRHGkhT3xCLu1YzZIjpfKWnA6VEn43mwcWEaWlo1Ve2YZj5Jms53iP5BjFsFz9lg/yDj0U7JbslFpZQyBP2a83khoiLiWPA/h/OVGOk+GwnJ5y1iyRS5Im1VLm18cKOc+CYrlGjnxUuZPIOlAn0yWdNXdlrMyRE7LM00eBjBT7niFVTvHsKJ8k6sw1yC4ZIl0EUMOcRT/X44v14xEZSBWfk+d8NpzKujgPGiYrOXI+XTGeGtjpewtjm16Qh3JT3sgvickfNo4yF6V4PVyE2wQUZvP7FmmIa/iDIpwkHRPkrC2iEIlhEZ2mtarIsz3sOoX0PPrP7nAWPRYjj51E85JiJEYO0VsfR5hL5wZal3T7aZl10kLiEyNEHtOSbt4g/gaduRjzC+S9RwtZ332XBxQpzGZ+p72SR5BumUYHLaaDSiySUXKPig6Wj+SmjX5s4BQB0pFBQVo4dhenspfKC1kaYLKVa9pOAW5Q2Ww2qeU92kHbzZRDvK2sBSfLDLtNUp/82rOj7nDm9tJi7lhoeWNzG7Pkqxz8R5p8ByhcGVd0CzkOOWv28KBJvNGa+V2/Y5U08vQm8mgvmTNyjpxHSFUj6/9rZPKerGSTuCPCi7qIdX3GXwEGAPFYt+/OgAXDAAAAAElFTkSuQmCC";
  papaya.ui.Toolbar.ICON_EXPAND="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAE00lEQVR42u2djW3UQBCFJx3QAemAdJBQAVABTgekAqCC0EGOCoAKWDqADkIHKQGPfKdEh3Nr7493Z977pJWQwtk7+77ETs6zdyYEmrPWEyBtoQDgUABwKAA4FAAcCgAOBQCHAoBDAcChAOBQAHAoADgUABwKAE6uALfjuGg094dx7Mbxo9H5D7wZxzCOF43O/3scN6kvzhXg5ziuGhV+4K20k0DD/964/jCO16kv9iCABvCu0bm/ySRgS4KAC7Abx3Wjc9/J9OO/JUGABXjYn/9Po/O/kimAVtd/EQMC6E1Krevkbhx/Kx17KSpBrcuAHjd2kx2kcwGUYRxfy60LBO9lEjxGEAMCKINQgqUsDV8JYkQAZRBKEGNN+EqQzgTQa/6p69YglOA5YuHPrW2QzgT4NI77SCGDUIJjYuEP4ziXaX2fEqRDAT4vLIgSTCxdq49iSIA1hSGzZo3MCbC2QDTWro1JAVIKRSBlTcwKkFqwV1LXwrQAOYV7ImcNzAuQuwDWya3dhQAlFsIiJWp2I0CpBbFCqVpdCVByYXqmZI3uBCi9QL1RujaXAigeJahRk1sBFE8S1KrFtQCKBwlq1uBeAMWyBLXnDiGAYlGCLeYMI4BiSYKt5golgGJBgi3nCCeA0rMEW88NUgClRwlazKk7AeaaI3WCpQVQepKg1VzmBMhqjs0V4Lg9unavXg8StJzDS5keDX/ai5jVHl9ih5DDBgka/hep36jZMoAeBNRexA8ySaBzydobweoWMS2C6CH84lgVQNkyEJfhK5YFULYIxm34inUBlFhA55K+h8DcTddTBjEcvuJBAOWUBIOkh3Qp0+/ZpY/bDV4EUJ6T4GocvxKP+ZwAgzgIX/EkgKIS6K+ihx/ZQTL+Srbn+K+dgzgJX/EmgKLX7fP9v1O/84+53B8zSPs9iYriUQCyAgoADgUAhwKAQwHAoQDgUABwKAA4FAAcCgAOBQCHAoBDAcChAOB4FEDfDr6Sacfykm8Hy/6YfDu4Y46fCgpS9oEQ7X3QZ/L5QEiH8JGwBLwIcOqh0CtJF6DWw6bd4EGAUyHpj2z9iJWcx8LvT3x9EOMSWBeAjSGZWBaArWEFsCoAm0MLwfZwO+c+0FV7+NwGETk3XTF6CKDlHOY+rLrpBhHcImbbuXS3RQw3idp2Tt1tEsVt4rhNHDeK3HCOUAJYCH/rucIIYCn8LecMIYDF8Leau3sBLIe/RQ2uBfAQfu1a3ArgKfyaNbkUwGP4tWpzJ4Dn8GvU6EoAhPBL1+pGAKTwS9bsQgDE8EvVbl4A5PBLrIFpARj+I6lrYVYAhv8/KWtiUgCG/zxr18acAAw/zpo1MiUAw1/O0rUyI8D9woLII0skOBcDAuhHrFxECmH488QkmFvbIJ0JcIpBGH6MmATHBDEiwCAMfylrJAhiQIBBGP5alkoQpHMB9Lr1PX6oJPS4tXsRY+geAkOlY2vX1UXk/wTpXICa1P6w6hhzvXpbo+eHFUDZjeO60bnvpN53/1KCgAuQ1RyZyVxz7NYEARcgqz06k+P2+BYEaSjArcRvUmqh1/+dtAv/wGGDjFb3AXqTfZP6YqtbxJBCUABwKAA4FAAcCgAOBQCHAoBDAcChAOBQAHAoADgUABwKAA4FAIcCgPMPvdAfn3qMP2kAAAAASUVORK5CYII=";
  papaya.ui.Toolbar.ICON_COLLAPSE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAEJGlDQ1BJQ0MgUHJvZmlsZQAAOBGFVd9v21QUPolvUqQWPyBYR4eKxa9VU1u5GxqtxgZJk6XtShal6dgqJOQ6N4mpGwfb6baqT3uBNwb8AUDZAw9IPCENBmJ72fbAtElThyqqSUh76MQPISbtBVXhu3ZiJ1PEXPX6yznfOec7517bRD1fabWaGVWIlquunc8klZOnFpSeTYrSs9RLA9Sr6U4tkcvNEi7BFffO6+EdigjL7ZHu/k72I796i9zRiSJPwG4VHX0Z+AxRzNRrtksUvwf7+Gm3BtzzHPDTNgQCqwKXfZwSeNHHJz1OIT8JjtAq6xWtCLwGPLzYZi+3YV8DGMiT4VVuG7oiZpGzrZJhcs/hL49xtzH/Dy6bdfTsXYNY+5yluWO4D4neK/ZUvok/17X0HPBLsF+vuUlhfwX4j/rSfAJ4H1H0qZJ9dN7nR19frRTeBt4Fe9FwpwtN+2p1MXscGLHR9SXrmMgjONd1ZxKzpBeA71b4tNhj6JGoyFNp4GHgwUp9qplfmnFW5oTdy7NamcwCI49kv6fN5IAHgD+0rbyoBc3SOjczohbyS1drbq6pQdqumllRC/0ymTtej8gpbbuVwpQfyw66dqEZyxZKxtHpJn+tZnpnEdrYBbueF9qQn93S7HQGGHnYP7w6L+YGHNtd1FJitqPAR+hERCNOFi1i1alKO6RQnjKUxL1GNjwlMsiEhcPLYTEiT9ISbN15OY/jx4SMshe9LaJRpTvHr3C/ybFYP1PZAfwfYrPsMBtnE6SwN9ib7AhLwTrBDgUKcm06FSrTfSj187xPdVQWOk5Q8vxAfSiIUc7Z7xr6zY/+hpqwSyv0I0/QMTRb7RMgBxNodTfSPqdraz/sDjzKBrv4zu2+a2t0/HHzjd2Lbcc2sG7GtsL42K+xLfxtUgI7YHqKlqHK8HbCCXgjHT1cAdMlDetv4FnQ2lLasaOl6vmB0CMmwT/IPszSueHQqv6i/qluqF+oF9TfO2qEGTumJH0qfSv9KH0nfS/9TIp0Wboi/SRdlb6RLgU5u++9nyXYe69fYRPdil1o1WufNSdTTsp75BfllPy8/LI8G7AUuV8ek6fkvfDsCfbNDP0dvRh0CrNqTbV7LfEEGDQPJQadBtfGVMWEq3QWWdufk6ZSNsjG2PQjp3ZcnOWWing6noonSInvi0/Ex+IzAreevPhe+CawpgP1/pMTMDo64G0sTCXIM+KdOnFWRfQKdJvQzV1+Bt8OokmrdtY2yhVX2a+qrykJfMq4Ml3VR4cVzTQVz+UoNne4vcKLoyS+gyKO6EHe+75Fdt0Mbe5bRIf/wjvrVmhbqBN97RD1vxrahvBOfOYzoosH9bq94uejSOQGkVM6sN/7HelL4t10t9F4gPdVzydEOx83Gv+uNxo7XyL/FtFl8z9ZAHF4bBsrEwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAeJJREFUOBG1lU1KA0EQhTP5c5MggkvFvQfQjS4iIcled3qBrDyCHsFsvEBcegBBkEBA0VuIW0UFBX8w4/c6VUMbAhoYG16qquvVm05Nd0+SpmlBI0mSogzxV5iY8Yf6EiWUp6NQasJFWfPL7lucQIzzvoDAn6xxrsRDEXYVrE0S44dM86kJC1GtNKxeDy+ULFDiAbQsrpqtMFeXb3GNuDLBaVmtL6zkZH+qCPegGQm1iftR3CduR3HTanxBY62I4OIiPoGOcoxdMIh4A81ZroMvblgINmiEnBcY0f++Cl6B2rMBzp0n3+aUE8cXEGqdVyaRDSY/FGDP2D4N3B64Bs/Ah/wdsA4acG+U8Fr5GuHtIaItpb1cAW2gv18FEt0HC8CHfM0pVxXXavSSpRG0fMUK1NA5sAeWwSfQ6i7AEPhwf4mJAyDBO3AJVBO0dNLw8x+hFfnLsj0kSlt0+kbYOuExiFuhng7JH2LFld0Ej2AeeCu6cF5cy3vs/XiDeAIWwS3Q298G8ZDoFuiBI7ACdKjegcZYSz2eBgjap1dAxafOkW9zyoUj7LnY/hCFmNsByYQRzf9IR6L5XUKI/uXarHn/4Gvn/H5tQvqfi14rcXHzs6vPYh3RmT9N2ZHWxkYgt4/pN/LAOfka/AG9AAAAAElFTkSuQmCC";
  papaya.ui.Toolbar.FILE_MENU_DATA={label:"File",icons:null,items:[{label:"Add Image...",action:"OpenImage",type:"file",hide:papaya.utilities.PlatformUtils.ios},{label:"Add Surface...",action:"OpenSurface",type:"file",hide:papaya.utilities.PlatformUtils.ios},{label:"Add DICOM Folder...",action:"OpenFolder",type:"folder",hide:"Chrome"!==papaya.utilities.PlatformUtils.browser||"undefined"===typeof daikon},{label:"Add DTI Vector Series...",action:"OpenDTI",type:"file"},{type:"spacer"},{label:"Close All",
  action:"CloseAllImages"}]};papaya.ui.Toolbar.RGB_FILE_MENU_DATA={label:"File",icons:null,items:[{label:"Close All",action:"CloseAllImages"}]};
  papaya.ui.Toolbar.MENU_DATA={menus:[papaya.ui.Toolbar.FILE_MENU_DATA,{label:"View",icons:null,items:[{label:"Orientation",action:"ShowOrientation",type:"checkbox",method:"isShowingOrientation"},{label:"Crosshairs",action:"ShowCrosshairs",type:"checkbox",method:"isShowingCrosshairs"},{label:"Ruler",action:"ShowRuler",type:"checkbox",method:"isShowingRuler"},{type:"spacer",required:"hasSurface"},{label:"Surface Planes",action:"ShowSurfacePlanes",type:"checkbox",method:"isShowingSurfacePlanes",required:"hasSurface"}]},
  {label:"Settings",icons:null,items:[{label:"Viewer Preferences",action:"Preferences"},{label:"Surface Preferences",action:"SurfacePreferences",required:"hasSurface"}]},{label:"Help",icons:null,items:[{label:"Show Keyboard Reference",action:"KeyboardRef"},{label:"Show Mouse Reference",action:"MouseRef"},{label:"Show License",action:"License"}]},{label:"TITLE",icons:null,titleBar:"true"},{label:"EXPAND",icons:[papaya.ui.Toolbar.ICON_EXPAND,papaya.ui.Toolbar.ICON_COLLAPSE],items:[],method:"isCollapsable",
  required:"isExpandable"},{label:"SPACE",icons:[papaya.ui.Toolbar.ICON_IMAGESPACE,papaya.ui.Toolbar.ICON_WORLDSPACE],items:[],method:"isWorldMode",menuOnHover:!0}]};papaya.ui.Toolbar.MENU_DATA_KIOSK={menus:[{label:"EXPAND",icons:[papaya.ui.Toolbar.ICON_EXPAND,papaya.ui.Toolbar.ICON_COLLAPSE],items:[],method:"isCollapsable",required:"isExpandable"}]};
  papaya.ui.Toolbar.OVERLAY_IMAGE_MENU_DATA={items:[{label:"Show Header",action:"ShowHeader"},{label:"Show Image Info",action:"ImageInfo"},{type:"spacer",required:"isParametricCombined"},{label:"DisplayRange",action:"ChangeRange",type:"displayrange",method:"getRange"},{label:"Load Negatives",action:"LoadNegatives",required:"canCurrentOverlayLoadNegatives"},{label:"Transparency",action:"alpha",type:"range",method:"getAlpha"},{label:"Color Table",action:"ColorTable",items:[],required:"isNonParametricCombined"},
  {type:"spacer",required:"isParametricCombined"},{label:"DisplayRange",action:"ChangeRangeNeg",type:"displayrange",method:"getRangeNegative",required:"isParametricCombined"},{label:"Transparency",action:"alphaneg",type:"range",method:"getAlpha",required:"isParametricCombined"},{type:"spacer",required:"isParametricCombined"},{label:"Hide Overlay",action:"ToggleOverlay",method:"getHiddenLabel"},{label:"Close Overlay",action:"CloseOverlay",required:"isDesktopMode"},{label:"Open in Mango",action:"OpenInMango",
  required:"canOpenInMango"}]};
  papaya.ui.Toolbar.BASE_IMAGE_MENU_DATA={items:[{label:"Show Header",action:"ShowHeader"},{label:"Show Image Info",action:"ImageInfo"},{label:"DisplayRange",action:"ChangeRange",type:"displayrange",method:"getRange"},papaya.ui.Toolbar.OVERLAY_IMAGE_MENU_DATA.items[6],{label:"Rotation",action:"Rotation",items:[{label:"About X Axis",action:"rotationX",type:"range",method:"getRotationX"},{label:"About Y Axis",action:"rotationY",type:"range",method:"getRotationY"},{label:"About Z Axis",action:"rotationZ",
  type:"range",method:"getRotationZ"},{label:"Reset Transform",action:"ResetTransform"},{label:"Rotate About Center",action:"Rotate About Center",type:"radiobutton",method:"isRotatingAbout"},{label:"Rotate About Origin",action:"Rotate About Origin",type:"radiobutton",method:"isRotatingAbout"},{label:"Rotate About Crosshairs",action:"Rotate About Crosshairs",type:"radiobutton",method:"isRotatingAbout"}]},{label:"Open in Mango",action:"OpenInMango",required:"canOpenInMango"}]};
  papaya.ui.Toolbar.RGB_IMAGE_MENU_DATA={items:[{label:"Show Header",action:"ShowHeader"},{label:"Show Image Info",action:"ImageInfo"},{label:"Open in Mango",action:"OpenInMango",required:"canOpenInMango"}]};papaya.ui.Toolbar.SURFACE_MENU_DATA={items:[{label:"Show Surface Info",action:"SurfaceInfo"},{label:"Transparency",action:"alpha",type:"range",method:"getAlpha"}]};
  papaya.ui.Toolbar.DTI_IMAGE_MENU_DATA={items:[{label:"Show Header",action:"ShowHeader"},{label:"Show Image Info",action:"ImageInfo"},{label:"Display Colors",action:"DTI-RGB",type:"checkbox",method:"isDTIRGB"},{label:"Display Lines",action:"DTI-Lines",type:"checkbox",method:"isDTILines"},{label:"Display Lines &amp; Colors",action:"DTI-LinesColors",type:"checkbox",method:"isDTILinesAndRGB"},{label:"Transparency",action:"alpha",type:"range",method:"getAlpha",required:"canCurrentOverlayLoadMod"},{label:"Modulate with...",
  action:"DTI-Mod",type:"file",hide:papaya.utilities.PlatformUtils.ios,required:"canCurrentOverlayLoadMod"},{label:"Modulation",action:"dtiAlphaFactor",type:"range",method:"getDtiAlphaFactor",required:"canCurrentOverlayModulate"},{label:"Open in Mango",action:"OpenInMango",required:"canOpenInMango"}]};
  papaya.ui.Toolbar.PREFERENCES_DATA={items:[{label:"Coordinate display of:",field:"atlasLocks",options:["Mouse","Crosshairs"]},{label:"Scroll wheel behavior:",field:"scrollBehavior",options:["Zoom","Increment Slice"],disabled:"container.disableScrollWheel"},{spacer:"true"},{label:"Smooth display:",field:"smoothDisplay",options:["Yes","No"]},{label:"Radiological display:",field:"radiological",options:["Yes","No"]}]};
  papaya.ui.Toolbar.PREFERENCES_SURFACE_DATA={items:[{label:"Background color:",field:"surfaceBackgroundColor",options:["Black","Dark Gray","Gray","Light Gray","White"]}]};
  papaya.ui.Toolbar.IMAGE_INFO_DATA={items:[{label:"Filename:",field:"getFilename",readonly:"true"},{spacer:"true"},{label:"Image Dims:",field:"getImageDimensionsDescription",readonly:"true"},{label:"Voxel Dims:",field:"getVoxelDimensionsDescription",readonly:"true"},{spacer:"true"},{label:"Byte Type:",field:"getByteTypeDescription",readonly:"true"},{label:"Byte Order:",field:"getByteOrderDescription",readonly:"true"},{spacer:"true"},{label:"Orientation:",field:"getOrientationDescription",readonly:"true"},
  {spacer:"true"},{label:"Notes:",field:"getImageDescription",readonly:"true"}]};
  papaya.ui.Toolbar.SERIES_INFO_DATA={items:[{label:"Filename:",field:"getFilename",readonly:"true"},{label:"File Length:",field:"getFileLength",readonly:"true"},{spacer:"true"},{label:"Image Dims:",field:"getImageDimensionsDescription",readonly:"true"},{label:"Voxel Dims:",field:"getVoxelDimensionsDescription",readonly:"true"},{label:"Series Points:",field:"getSeriesDimensionsDescription",readonly:"true"},{label:"Series Point Size:",field:"getSeriesSizeDescription",readonly:"true"},{spacer:"true"},
  {label:"Byte Type:",field:"getByteTypeDescription",readonly:"true"},{label:"Byte Order:",field:"getByteOrderDescription",readonly:"true"},{label:"Compressed:",field:"getCompressedDescription",readonly:"true"},{spacer:"true"},{label:"Orientation:",field:"getOrientationDescription",readonly:"true"},{label:"Notes:",field:"getImageDescription",readonly:"true"}]};
  papaya.ui.Toolbar.SURFACE_INFO_DATA={items:[{label:"Filename:",field:"getSurfaceFilename",readonly:"true"},{spacer:"true"},{label:"Points:",field:"getSurfaceNumPoints",readonly:"true"},{label:"Triangles:",field:"getSurfaceNumTriangles",readonly:"true"}]};papaya.ui.Toolbar.HEADER_DATA={items:[{label:"",field:"getHeaderDescription",readonly:"true"}]};papaya.ui.Toolbar.LICENSE_DATA={items:[{label:"",field:"getLicense",readonly:"true"}]};
  papaya.ui.Toolbar.KEYBOARD_REF_DATA={items:[{label:"",field:"getKeyboardReference",readonly:"true"}]};papaya.ui.Toolbar.MOUSE_REF_DATA={items:[{label:"",field:"getMouseReference",readonly:"true"}]};papaya.ui.Toolbar.applyContextState=function(b){var a;b.contextMenu=!0;if(b.items)for(a=0;a<b.items.length;a+=1)b.items[a].menu?papaya.ui.Toolbar.applyContextState(b.items[a].menu):b.items[a].isContext=!0};
  papaya.ui.Toolbar.prototype.buildToolbar=function(){var b;this.spaceMenu=this.surfaceMenus=this.imageMenus=null;this.container.toolbarHtml.find("."+PAPAYA_MENU_ICON_CSS).remove();this.container.toolbarHtml.find("."+PAPAYA_MENU_LABEL_CSS).remove();this.container.toolbarHtml.find("."+PAPAYA_TITLEBAR_CSS).remove();if(this.container.kioskMode)for(b=0;b<papaya.ui.Toolbar.MENU_DATA_KIOSK.menus.length;b+=1)this.buildMenu(papaya.ui.Toolbar.MENU_DATA_KIOSK.menus[b],null,this.viewer,null);else{0<this.container.viewer.screenVolumes.length&&
  this.container.viewer.screenVolumes[0].rgb?papaya.ui.Toolbar.MENU_DATA.menus[0]=papaya.ui.Toolbar.RGB_FILE_MENU_DATA:(papaya.ui.Toolbar.MENU_DATA.menus[0]=this.container.noNewFiles?papaya.ui.Toolbar.RGB_FILE_MENU_DATA:papaya.ui.Toolbar.FILE_MENU_DATA,this.buildOpenMenuItems(papaya.ui.Toolbar.MENU_DATA));for(b=0;b<papaya.ui.Toolbar.MENU_DATA.menus.length;b+=1)this.buildMenu(papaya.ui.Toolbar.MENU_DATA.menus[b],null,this.viewer,null);this.buildAtlasMenu()}this.buildColorMenuItems();this.container.titlebarHtml=
  this.container.containerHtml.find("."+PAPAYA_TITLEBAR_CSS);600>this.container.getViewerDimensions()[0]?this.container.titlebarHtml.css({visibility:"hidden"}):this.container.titlebarHtml.css({visibility:"visible"})};
  papaya.ui.Toolbar.prototype.buildAtlasMenu=function(){if(papaya.data&&papaya.data.Atlas){var b=this.spaceMenu.items;b[0]={label:papaya.data.Atlas.labels.atlas.header.name,action:"AtlasChanged-"+papaya.data.Atlas.labels.atlas.header.name,type:"radiobutton",method:"isUsingAtlas"};papaya.data.Atlas.labels.atlas.header.transformedname&&(b[1]={label:papaya.data.Atlas.labels.atlas.header.transformedname,action:"AtlasChanged-"+papaya.data.Atlas.labels.atlas.header.transformedname,type:"radiobutton",method:"isUsingAtlas"})}};
  papaya.ui.Toolbar.prototype.buildColorMenuItems=function(){var b,a,c,d;if(b=this.container.params.luts)for(a=0;a<b.length;a+=1)papaya.viewer.ColorTable.addCustomLUT(b[a]);c=papaya.viewer.ColorTable.TABLE_ALL;b=papaya.ui.Toolbar.OVERLAY_IMAGE_MENU_DATA.items;for(a=0;a<b.length;a+=1)if("Color Table"===b[a].label){b=b[a].items;break}for(a=0;a<c.length;a+=1)d={label:c[a].name,action:"ColorTable-"+c[a].name,type:"radiobutton",method:"isUsingColorTable"},b[a]=d};
  papaya.ui.Toolbar.prototype.buildOpenMenuItems=function(b){var a,c;for(a=0;a<b.menus.length;a+=1)if("File"===b.menus[a].label){c=b.menus[a].items;break}if(c)for(a=0;a<papayaLoadableImages.length;a+=1)papayaLoadableImages[a].hide||(papayaLoadableImages[a].surface?(b="Add Surface "+papayaLoadableImages[a].nicename,this.menuContains(c,b)||c.splice(2,0,{label:b,action:"OpenSurface-"+papayaLoadableImages[a].name})):(b="Add "+papayaLoadableImages[a].nicename,this.menuContains(c,b)||c.splice(2,0,{label:b,
  action:"Open-"+papayaLoadableImages[a].name})))};papaya.ui.Toolbar.prototype.menuContains=function(b,a){var c;if(b)for(c=0;c<b.length;c+=1)if(b[c].label===a)return!0;return!1};
  papaya.ui.Toolbar.prototype.buildMenu=function(b,a,c,d,e){var f=null;void 0===e&&(e=!1);b.required&&!0!==papaya.utilities.ObjectUtils.bind(this.container,papaya.utilities.ObjectUtils.dereferenceIn(this.container,b.required))()||(f=new papaya.ui.Menu(this.viewer,b,papaya.utilities.ObjectUtils.bind(this,this.doAction),this.viewer,d),"SPACE"===b.label&&(this.spaceMenu=b),e||(a?f.setMenuButton(a):a=f.buildMenuButton()),(b=b.items)&&this.buildMenuItems(f,b,a,c,d));return f};
  papaya.ui.Toolbar.prototype.buildMenuItems=function(b,a,c,d,e){var f,h,g;void 0===e&&(e="");for(f=0;f<a.length;f+=1)a[f].required&&!0!==papaya.utilities.ObjectUtils.bind(this.container,papaya.utilities.ObjectUtils.dereferenceIn(this.container,a[f].required))(parseInt(e))?h=null:"spacer"===a[f].type?h=new papaya.ui.MenuItemSpacer:"radiobutton"===a[f].type?h=new papaya.ui.MenuItemRadioButton(this.viewer,a[f].label,a[f].action,papaya.utilities.ObjectUtils.bind(this,this.doAction),d,a[f].method,e):"checkbox"===
  a[f].type?h=new papaya.ui.MenuItemCheckBox(this.viewer,a[f].label,a[f].action,papaya.utilities.ObjectUtils.bind(this,this.doAction),d,a[f].method,e):"file"===a[f].type?a[f].hide||a[f].required&&!0!==papaya.utilities.ObjectUtils.bind(this.container,papaya.utilities.ObjectUtils.dereferenceIn(this.container,a[f].required))(parseInt(e))||(h=new papaya.ui.MenuItemFileChooser(this.viewer,a[f].label,a[f].action,papaya.utilities.ObjectUtils.bind(this,this.doAction),!1,e)):"folder"===a[f].type?h=a[f].hide||
  a[f].required&&!0!==papaya.utilities.ObjectUtils.bind(this.container,papaya.utilities.ObjectUtils.dereferenceIn(this.container,a[f].required))(parseInt(e))?null:new papaya.ui.MenuItemFileChooser(this.viewer,a[f].label,a[f].action,papaya.utilities.ObjectUtils.bind(this,this.doAction),!0,e):"displayrange"===a[f].type?h=this.viewer.screenVolumes[e].supportsDynamicColorTable()?new papaya.ui.MenuItemRange(this.viewer,a[f].label,a[f].action,papaya.utilities.ObjectUtils.bind(this,this.doAction),d,a[f].method,
  e):null:"range"===a[f].type?papaya.utilities.PlatformUtils.isInputRangeSupported()&&(h=new papaya.ui.MenuItemSlider(this.viewer,a[f].label,a[f].action,papaya.utilities.ObjectUtils.bind(this,this.doAction),d,a[f].method,e)):h=new papaya.ui.MenuItem(this.viewer,a[f].label,a[f].action,papaya.utilities.ObjectUtils.bind(this,this.doAction),d,a[f].method,e),h&&(b.addMenuItem(h),a[f].items&&(g=this.buildMenu(a[f],c,d,e),h.menu=g,h.callback=papaya.utilities.ObjectUtils.bind(g,g.showMenu)))};
  papaya.ui.Toolbar.prototype.updateImageButtons=function(){this.container.toolbarHtml.find("."+PAPAYA_MENU_BUTTON_CSS).remove();this.doUpdateImageButtons();this.updateSurfaceButtons()};
  papaya.ui.Toolbar.prototype.doUpdateImageButtons=function(){var b,a,c;this.imageMenus=[];if(this.container.showImageButtons)for(a=this.viewer.screenVolumes.length-1;0<=a;--a)c=this.viewer.screenVolumes[a],b=c.icon,b=[{label:"ImageButton",icons:[b],items:null,imageButton:!0}],b[0].items=0===a?c.rgb?papaya.ui.Toolbar.RGB_IMAGE_MENU_DATA.items:c.dti?papaya.ui.Toolbar.DTI_IMAGE_MENU_DATA.items:papaya.ui.Toolbar.BASE_IMAGE_MENU_DATA.items:c.dti?papaya.ui.Toolbar.DTI_IMAGE_MENU_DATA.items:papaya.ui.Toolbar.OVERLAY_IMAGE_MENU_DATA.items,
  this.container.combineParametric&&c.parametric||this.imageMenus.push(this.buildMenu(b[0],null,c,a.toString()))};
  papaya.ui.Toolbar.prototype.updateSurfaceButtons=function(){var b,a;this.surfaceMenus=[];if(this.container.showImageButtons)for(a=this.viewer.surfaces.length-1;0<=a;--a)b=this.viewer.surfaces[a].solidColor,null===b&&(b=[.5,.5,.5]),b=papaya.viewer.ScreenVolume.makeSolidIcon(b[0],b[1],b[2]),b=[{label:"SurfaceButton",icons:[b],items:papaya.ui.Toolbar.SURFACE_MENU_DATA.items,imageButton:!0,surfaceButton:!0}],this.surfaceMenus.push(this.buildMenu(b[0],null,this.viewer.surfaces[a],a.toString()))};
  papaya.ui.Toolbar.prototype.closeAllMenus=function(b){var a;a=this.container.toolbarHtml.find("."+PAPAYA_MENU_CSS);a.hide(100);a.remove();this.container.showControlBar&&(a=this.container.sliderControlHtml.find("."+PAPAYA_MENU_CSS),a.hide(100),a.remove());a=this.container.toolbarHtml.find("."+PAPAYA_DIALOG_CSS);a.hide(100);a.remove();a=this.container.toolbarHtml.find("."+PAPAYA_DIALOG_BACKGROUND);a.hide(100);a.remove();!b&&(b=this.container.viewerHtml.find("."+PAPAYA_MENU_CSS))&&(b.hide(100),b.remove())};
  papaya.ui.Toolbar.prototype.isShowingMenus=function(){var b,a;b=this.container.toolbarHtml.find("."+PAPAYA_MENU_CSS).is(":visible");a=this.container.toolbarHtml.find("."+PAPAYA_DIALOG_CSS).is(":visible");return b||a};
  papaya.ui.Toolbar.prototype.doAction=function(b,a,c){var d,e;c||this.closeAllMenus();if(b)if(b.startsWith("ImageButton"))b=parseInt(b.substr(b.length-2,1),10),this.viewer.setCurrentScreenVol(b),this.updateImageButtons();else if(b.startsWith("OpenSurface-"))a=b.substring(b.indexOf("-")+1),this.viewer.loadSurface(a);else if(b.startsWith("Open-"))a=b.substring(b.indexOf("-")+1),this.viewer.loadImage(a);else if("OpenImage"===b)this.container.display.drawProgress(.1,"Loading"),this.viewer.loadImage(a);
  else if("OpenDTI"===b)this.container.display.drawProgress(.1,"Loading"),this.viewer.loadingDTI=!0,this.viewer.loadImage(a);else if("OpenSurface"===b)this.container.display.drawProgress(.1,"Loading"),this.viewer.loadSurface(a);else if("OpenFolder"===b){b=[];for(c=0;c<a.length;c+=1){e=!1;for(d=0;d<papaya.Container.ignorePatterns.length;d+=1)papaya.Container.ignorePatterns[d].test(a[c].name)&&(e=!0);e?console.log("Ignoring file "+a[c].name):b.push(a[c])}this.container.display.drawProgress(.1,"Loading");
  this.viewer.loadImage(b)}else b.startsWith("ColorTable")?(a=b.substring(b.indexOf("-")+1,b.lastIndexOf("-")),b=b.substring(b.lastIndexOf("-")+1),this.viewer.screenVolumes[b].changeColorTable(this.viewer,a),this.updateImageButtons()):b.startsWith("CloseAllImages")?papaya.Container.resetViewer(this.container.containerIndex,{}):"Preferences"===b?(a=new papaya.ui.Dialog(this.container,"Viewer Preferences",papaya.ui.Toolbar.PREFERENCES_DATA,this.container.preferences,papaya.utilities.ObjectUtils.bind(this.container.preferences,
  this.container.preferences.updatePreference),papaya.utilities.ObjectUtils.bind(this,function(){this.viewer.updateScreenSliceTransforms();this.viewer.drawViewer(!1,!0)})),a.showDialog()):"SurfacePreferences"===b?(a=new papaya.ui.Dialog(this.container,"Surface Preferences",papaya.ui.Toolbar.PREFERENCES_SURFACE_DATA,this.container.preferences,papaya.utilities.ObjectUtils.bind(this.container.preferences,this.container.preferences.updatePreference),papaya.utilities.ObjectUtils.bind(this,function(){this.viewer.updateScreenSliceTransforms();
  this.viewer.surfaceView.updatePreferences();this.viewer.drawViewer(!1,!0)})),a.showDialog()):"License"===b?(a=new papaya.ui.Dialog(this.container,"License",papaya.ui.Toolbar.LICENSE_DATA,papaya.Container,null,null,null,!0),a.showDialog()):"KeyboardRef"===b?(a=new papaya.ui.Dialog(this.container,"Keyboard Reference",papaya.ui.Toolbar.KEYBOARD_REF_DATA,papaya.Container,null,null,null,!0),a.showDialog()):"MouseRef"===b?(a=new papaya.ui.Dialog(this.container,"Mouse Reference",papaya.ui.Toolbar.MOUSE_REF_DATA,
  papaya.Container,null,null,null,!0),a.showDialog()):b.startsWith("ImageInfo")?(b=b.substring(b.lastIndexOf("-")+1),a=1<this.viewer.screenVolumes[b].volume.numTimepoints?new papaya.ui.Dialog(this.container,"Image Info",papaya.ui.Toolbar.SERIES_INFO_DATA,this.viewer,null,null,b.toString()):new papaya.ui.Dialog(this.container,"Image Info",papaya.ui.Toolbar.IMAGE_INFO_DATA,this.viewer,null,null,b.toString()),a.showDialog()):b.startsWith("SurfaceInfo")?(b=b.substring(b.lastIndexOf("-")+1),a=new papaya.ui.Dialog(this.container,
  "Surface Info",papaya.ui.Toolbar.SURFACE_INFO_DATA,this.viewer,null,null,b.toString()),a.showDialog()):b.startsWith("ShowHeader")?(b=b.substring(b.lastIndexOf("-")+1),a=new papaya.ui.Dialog(this.container,"Header",papaya.ui.Toolbar.HEADER_DATA,this.viewer,null,null,b.toString()),a.showDialog()):b.startsWith("SPACE")?(this.viewer.toggleWorldSpace(),this.viewer.drawViewer(!0)):b.startsWith("AtlasChanged")?(a=b.substring(b.lastIndexOf("-")+1),this.viewer.atlas.currentAtlas=a,this.viewer.drawViewer(!0)):
  b.startsWith("ShowRuler")?("Yes"===this.container.preferences.showRuler?this.container.preferences.updatePreference("showRuler","No"):this.container.preferences.updatePreference("showRuler","Yes"),this.viewer.drawViewer(),this.closeAllMenus()):b.startsWith("ShowOrientation")?("Yes"===this.container.preferences.showOrientation?this.container.preferences.updatePreference("showOrientation","No"):this.container.preferences.updatePreference("showOrientation","Yes"),this.viewer.drawViewer(),this.closeAllMenus()):
  b.startsWith("ShowCrosshairs")?("Yes"===this.container.preferences.showCrosshairs?this.container.preferences.updatePreference("showCrosshairs","No"):this.container.preferences.updatePreference("showCrosshairs","Yes"),this.viewer.drawViewer(),this.closeAllMenus()):b.startsWith("EXPAND")?this.container.collapsable?this.container.collapseViewer():this.container.expandViewer():b.startsWith("OpenInMango")?(b=parseInt(b.substring(b.lastIndexOf("-")+1),10),0===b?this.container.viewer.volume.urls[0]&&papaya.utilities.PlatformUtils.launchCustomProtocol(this.container,
  papaya.utilities.UrlUtils.getAbsoluteUrl(PAPAYA_CUSTOM_PROTOCOL,this.container.viewer.volume.urls[0]),this.customProtocolResult):this.container.viewer.screenVolumes[b].volume.urls[0]&&papaya.utilities.PlatformUtils.launchCustomProtocol(this.container,papaya.utilities.UrlUtils.getAbsoluteUrl(PAPAYA_CUSTOM_PROTOCOL,this.container.viewer.screenVolumes[b].volume.urls[0])+"?"+encodeURIComponent("baseimage="+this.container.viewer.volume.fileName+"&params=o"),this.customProtocolResult)):b.startsWith("CloseOverlay")?
  (b=parseInt(b.substring(b.lastIndexOf("-")+1),10),this.container.viewer.removeOverlay(b)):b.startsWith("ToggleOverlay")?(b=parseInt(b.substring(b.lastIndexOf("-")+1),10),this.container.viewer.toggleOverlay(b)):b.startsWith("Context-")?this.container.contextManager.actionPerformed(b.substring(8)):b.startsWith("DTI-RGB")?(b=b.substring(b.lastIndexOf("-")+1),this.viewer.screenVolumes[b].dtiLines=!1,this.viewer.screenVolumes[b].dtiColors=!0,this.viewer.screenVolumes[b].initDTI(),this.viewer.drawViewer(!0,
  !1)):b.startsWith("DTI-LinesColors")?(b=b.substring(b.lastIndexOf("-")+1),this.viewer.screenVolumes[b].dtiLines=!0,this.viewer.screenVolumes[b].dtiColors=!0,this.viewer.screenVolumes[b].initDTI(),this.viewer.drawViewer(!0,!1)):b.startsWith("DTI-Lines")?(b=b.substring(b.lastIndexOf("-")+1),this.viewer.screenVolumes[b].dtiLines=!0,this.viewer.screenVolumes[b].dtiColors=!1,this.viewer.screenVolumes[b].initDTI(),this.viewer.drawViewer(!0,!1)):b.startsWith("DTI-Mod")?(b=b.substring(b.lastIndexOf("-")+
  1),this.container.display.drawProgress(.1,"Loading"),this.viewer.loadingDTIModRef=this.viewer.screenVolumes[b],this.viewer.loadImage(a)):b.startsWith("LoadNegatives")?(b=b.substring(b.lastIndexOf("-")+1),this.viewer.addParametric(b)):b.startsWith("ShowSurfacePlanes")?(this.viewer.surfaceView.showSurfacePlanes=!this.viewer.surfaceView.showSurfacePlanes,this.viewer.surfaceView.updateActivePlanes(),"Yes"===this.container.preferences.showSurfacePlanes?this.container.preferences.updatePreference("showSurfacePlanes",
  "No"):this.container.preferences.updatePreference("showSurfacePlanes","Yes"),this.viewer.drawViewer(!1,!0),this.closeAllMenus()):b.startsWith("ShowSurfaceCrosshairs")?(this.viewer.surfaceView.showSurfaceCrosshairs=!this.viewer.surfaceView.showSurfaceCrosshairs,this.viewer.surfaceView.updateActivePlanes(),"Yes"===this.container.preferences.showSurfaceCrosshairs?this.container.preferences.updatePreference("showSurfaceCrosshairs","No"):this.container.preferences.updatePreference("showSurfaceCrosshairs",
  "Yes"),this.viewer.drawViewer(!1,!0),this.closeAllMenus()):b.startsWith("rotation")?this.viewer.screenVolumes[0].updateTransform():b.startsWith("Rotate About")?(this.viewer.screenVolumes[0].rotationAbout=b.substring(0,b.indexOf("-")),this.viewer.screenVolumes[0].updateTransform(),this.viewer.drawViewer(!0,!1)):b.startsWith("ResetTransform")&&(this.viewer.screenVolumes[0].resetTransform(),this.viewer.screenVolumes[0].updateTransform(),this.viewer.drawViewer(!0,!1))};
  papaya.ui.Toolbar.prototype.customProtocolResult=function(b){!1===b&&("Chrome"===papaya.utilities.PlatformUtils.browser||"Internet Explorer"===papaya.utilities.PlatformUtils.browser?alert("Mango does not appear to be installed.  You can download Mango at:\n\nhttp://ric.uthscsa.edu/mango"):papaya.utilities.PlatformUtils.ios?confirm("iMango does not appear to be installed.  Would you like to download it now?")&&window.open("http://itunes.apple.com/us/app/imango/id423626092"):confirm("Mango does not appear to be installed.  Would you like to download it now?")&&
  window.open("http://ric.uthscsa.edu/mango/mango.html"))};papaya.ui.Toolbar.prototype.updateTitleBar=function(b){var a=this.container.titlebarHtml[0];a&&(a.innerHTML=b);this.container.titlebarHtml.css({top:0})};papaya.ui.Toolbar.prototype.showImageMenu=function(b){this.viewer.screenVolumes[b].resetDynamicRange();this.imageMenus[b].showMenu()};papaya.ui.Toolbar.prototype.updateImageMenuRange=function(b,a,c){this.imageMenus[b].updateRangeItem(a,c)};"use strict";papaya=papaya||{};
  papaya.viewer=papaya.viewer||{};
  papaya.viewer.Atlas=papaya.viewer.Atlas||function(b,a,c){this.container=a;this.callback=c;this.transformedname=this.name=null;this.labels=[];this.atlasLabelData=b.labels;this.volume=new papaya.volume.Volume(a.display,a.viewer);this.currentAtlas=this.transform=this.returnLabels=this.displayColumns=null;this.maxLabels=0;this.probabilistic=!1;b=a.findLoadableImage(b.labels.atlas.header.images.summaryimagefile);a.params.atlasURL?this.volume.readURLs([a.params.atlasURL],papaya.utilities.ObjectUtils.bind(this,
  this.readFinished)):null!==b&&void 0!==b.encode?this.volume.readEncodedData([b.encode],papaya.utilities.ObjectUtils.bind(this,this.readFinished)):null!==b&&void 0!==b.url&&this.volume.readURLs([b.url],papaya.utilities.ObjectUtils.bind(this,this.readFinished))};papaya.viewer.Atlas.MAX_LABELS=4;papaya.viewer.Atlas.PROBABILISTIC=["probabalistic","probabilistic","statistic"];papaya.viewer.Atlas.LABEL_SPLIT_REGEX=/\.|:|,|\//;
  papaya.viewer.Atlas.prototype.getLabelAtCoordinate=function(b,a,c){var d,e;this.transform&&this.currentAtlas===this.transformedname?(d=b*this.transform[0][0]+a*this.transform[0][1]+c*this.transform[0][2]+this.transform[0][3],e=b*this.transform[1][0]+a*this.transform[1][1]+c*this.transform[1][2]+this.transform[1][3],b=b*this.transform[2][0]+a*this.transform[2][1]+c*this.transform[2][2]+this.transform[2][3]):(d=b,e=a,b=c);d=this.volume.getVoxelAtCoordinate(d,e,b,0,!0);this.probabilistic&&--d;return this.formatLabels(this.labels[d],
  this.returnLabels)};
  papaya.viewer.Atlas.prototype.readFinished=function(){this.parseTransform();this.parseLabels();this.parseDisplayColumns();this.maxLabels=this.findMaxLabelParts();this.probabilistic=this.atlasLabelData.atlas.header.type&&(this.atlasLabelData.atlas.header.type.toLowerCase()===papaya.viewer.Atlas.PROBABILISTIC[0]||this.atlasLabelData.atlas.header.type.toLowerCase()===papaya.viewer.Atlas.PROBABILISTIC[1]||this.atlasLabelData.atlas.header.type.toLowerCase()===papaya.viewer.Atlas.PROBABILISTIC[2]);this.returnLabels=
  [];this.returnLabels.length=this.maxLabels;this.atlasLabelData.atlas.header.transformedname&&(this.transformedname=this.atlasLabelData.atlas.header.transformedname);this.currentAtlas=this.name=this.atlasLabelData.atlas.header.name;var b=this.container.params.atlas;b&&b===this.transformedname&&(this.currentAtlas=this.transformedname);this.callback()};
  papaya.viewer.Atlas.prototype.parseDisplayColumns=function(){var b,a,c;if(this.atlasLabelData.atlas.header.display)for(this.displayColumns=[],b=0,a=this.atlasLabelData.atlas.header.display.split(papaya.viewer.Atlas.LABEL_SPLIT_REGEX),c=0;c<a.length;c+=1)"*"===a[c]&&(this.displayColumns[b]=c,b+=1)};
  papaya.viewer.Atlas.prototype.parseTransform=function(){var b,a,c;if(this.atlasLabelData.atlas.header.transform&&(b=this.atlasLabelData.atlas.header.transform.split(" "),this.transform=papaya.volume.Transform.IDENTITY.clone(),16===b.length))for(a=0;4>a;a+=1)for(c=0;4>c;c+=1)this.transform[a][c]=parseFloat(b[4*a+c])};
  papaya.viewer.Atlas.prototype.parseLabels=function(){var b,a,c;for(b=0;b<this.atlasLabelData.atlas.data.label.length;b+=1)c=this.atlasLabelData.atlas.data.label[b],a=c.index?parseInt(c.index,10):b,this.labels[a]=c.content?c.content:c};
  papaya.viewer.Atlas.prototype.formatLabels=function(b,a){var c,d,e;if(b)if(d=b.split(papaya.viewer.Atlas.LABEL_SPLIT_REGEX),this.displayColumns)for(c=0;c<d.length;c+=1)c<this.displayColumns.length&&(a[c]=d[this.displayColumns[c]]);else for(e=d.length,c=0,e>papaya.viewer.Atlas.MAX_LABELS&&(c=e-papaya.viewer.Atlas.MAX_LABELS);c<d.length;c+=1)a[c]=d[c].trim();else for(c=0;c<a.length;c+=1)a[c]="";return a};
  papaya.viewer.Atlas.prototype.findMaxLabelParts=function(){var b,a;if(this.displayColumns)return this.displayColumns.length;a=[];for(b=0;b<this.labels.length;b+=1)this.formatLabels(this.labels[b],a);return a.length};"use strict";papaya=papaya||{};papaya.viewer=papaya.viewer||{};
  papaya.viewer.ColorTable=papaya.viewer.ColorTable||function(b,a,c){var d=null,d=void 0!==c?c:papaya.viewer.ColorTable.findLUT(b);this.lutData=d.data;this.minLUT=this.maxLUT=0;this.knotThresholds=[];this.knotRangeRatios=[];this.LUTarrayG=Array(256);this.LUTarrayR=Array(256);this.LUTarrayB=Array(256);this.isBaseImage=a;this.knotMin=this.lutData[0];this.knotMax=this.lutData[this.lutData.length-1];this.useGradation="undefined"===typeof d.gradation||d.gradation;this.updateLUT(papaya.viewer.ColorTable.LUT_MIN,
  papaya.viewer.ColorTable.LUT_MAX)};papaya.viewer.ColorTable.TABLE_GRAYSCALE={name:"Grayscale",data:[[0,0,0,0],[1,1,1,1]],gradation:!0};papaya.viewer.ColorTable.TABLE_SPECTRUM={name:"Spectrum",data:[[0,0,0,0],[.1,0,0,1],[.33,0,1,1],[.5,0,1,0],[.66,1,1,0],[.9,1,0,0],[1,1,1,1]],gradation:!0};papaya.viewer.ColorTable.TABLE_RED2YELLOW={name:"Overlay (Positives)",data:[[0,1,0,0],[1,1,1,0]],gradation:!0};papaya.viewer.ColorTable.TABLE_BLUE2GREEN={name:"Overlay (Negatives)",data:[[0,0,0,1],[1,0,1,0]],gradation:!0};
  papaya.viewer.ColorTable.TABLE_HOTANDCOLD={name:"Hot-and-Cold",data:[[0,0,0,1],[.15,0,1,1],[.3,0,1,0],[.45,0,0,0],[.5,0,0,0],[.55,0,0,0],[.7,1,1,0],[.85,1,0,0],[1,1,1,1]],gradation:!0};papaya.viewer.ColorTable.TABLE_GOLD={name:"Gold",data:[[0,0,0,0],[.13,.19,.03,0],[.25,.39,.12,0],[.38,.59,.26,0],[.5,.8,.46,.08],[.63,.99,.71,.21],[.75,.99,.88,.34],[.88,.99,.99,.48],[1,.9,.95,.61]],gradation:!0};
  papaya.viewer.ColorTable.TABLE_RED2WHITE={name:"Red Overlay",data:[[0,.75,0,0],[.5,1,.5,0],[.95,1,1,0],[1,1,1,1]],gradation:!0};papaya.viewer.ColorTable.TABLE_GREEN2WHITE={name:"Green Overlay",data:[[0,0,.75,0],[.5,.5,1,0],[.95,1,1,0],[1,1,1,1]],gradation:!0};papaya.viewer.ColorTable.TABLE_BLUE2WHITE={name:"Blue Overlay",data:[[0,0,0,1],[.5,0,.5,1],[.95,0,1,1],[1,1,1,1]],gradation:!0};papaya.viewer.ColorTable.TABLE_DTI_SPECTRUM={name:"Spectrum",data:[[0,1,0,0],[.5,0,1,0],[1,0,0,1]],gradation:!0};
  papaya.viewer.ColorTable.TABLE_FIRE={name:"Fire",data:[[0,0,0,0],[.06,0,0,.36],[.16,.29,0,.75],[.22,.48,0,.89],[.31,.68,0,.6],[.37,.76,0,.36],[.5,.94,.31,0],[.56,1,.45,0],[.81,1,.91,0],[.88,1,1,.38],[1,1,1,1]],gradation:!0};papaya.viewer.ColorTable.ARROW_ICON="data:image/gif;base64,R0lGODlhCwARAPfGMf//////zP//mf//Zv//M///AP/M///MzP/Mmf/MZv/MM//MAP+Z//+ZzP+Zmf+ZZv+ZM/+ZAP9m//9mzP9mmf9mZv9mM/9mAP8z//8zzP8zmf8zZv8zM/8zAP8A//8AzP8Amf8AZv8AM/8AAMz//8z/zMz/mcz/Zsz/M8z/AMzM/8zMzMzMmczMZszMM8zMAMyZ/8yZzMyZmcyZZsyZM8yZAMxm/8xmzMxmmcxmZsxmM8xmAMwz/8wzzMwzmcwzZswzM8wzAMwA/8wAzMwAmcwAZswAM8wAAJn//5n/zJn/mZn/Zpn/M5n/AJnM/5nMzJnMmZnMZpnMM5nMAJmZ/5mZzJmZmZmZZpmZM5mZAJlm/5lmzJlmmZlmZplmM5lmAJkz/5kzzJkzmZkzZpkzM5kzAJkA/5kAzJkAmZkAZpkAM5kAAGb//2b/zGb/mWb/Zmb/M2b/AGbM/2bMzGbMmWbMZmbMM2bMAGaZ/2aZzGaZmWaZZmaZM2aZAGZm/2ZmzGZmmWZmZmZmM2ZmAGYz/2YzzGYzmWYzZmYzM2YzAGYA/2YAzGYAmWYAZmYAM2YAADP//zP/zDP/mTP/ZjP/MzP/ADPM/zPMzDPMmTPMZjPMMzPMADOZ/zOZzDOZmTOZZjOZMzOZADNm/zNmzDNmmTNmZjNmMzNmADMz/zMzzDMzmTMzZjMzMzMzADMA/zMAzDMAmTMAZjMAMzMAAAD//wD/zAD/mQD/ZgD/MwD/AADM/wDMzADMmQDMZgDMMwDMAACZ/wCZzACZmQCZZgCZMwCZAABm/wBmzABmmQBmZgBmMwBmAAAz/wAzzAAzmQAzZgAzMwAzAAAA/wAAzAAAmQAAZgAAM+4AAN0AALsAAKoAAIgAAHcAAFUAAEQAACIAABEAAADuAADdAAC7AACqAACIAAB3AABVAABEAAAiAAARAAAA7gAA3QAAuwAAqgAAiAAAdwAAVQAARAAAIgAAEe7u7t3d3bu7u6qqqoiIiHd3d1VVVURERCIiIhEREQAAACH5BAEAAMYALAAAAAALABEAAAg/AI0JFGhvoEGC+vodRKgv4UF7DSMqZBixoUKIFSv2w5jRIseOGztK/JgxpMiEJDWmHHkSZUuTIvvt60ezps2AADs=";
  papaya.viewer.ColorTable.ARROW_ICON_WIDTH=11;papaya.viewer.ColorTable.DEFAULT_COLOR_TABLE=papaya.viewer.ColorTable.TABLE_GRAYSCALE;papaya.viewer.ColorTable.PARAMETRIC_COLOR_TABLES=[papaya.viewer.ColorTable.TABLE_RED2YELLOW,papaya.viewer.ColorTable.TABLE_BLUE2GREEN];papaya.viewer.ColorTable.OVERLAY_COLOR_TABLES=[papaya.viewer.ColorTable.TABLE_RED2WHITE,papaya.viewer.ColorTable.TABLE_GREEN2WHITE,papaya.viewer.ColorTable.TABLE_BLUE2WHITE];
  papaya.viewer.ColorTable.TABLE_ALL=[papaya.viewer.ColorTable.TABLE_GRAYSCALE,papaya.viewer.ColorTable.TABLE_SPECTRUM,papaya.viewer.ColorTable.TABLE_FIRE,papaya.viewer.ColorTable.TABLE_HOTANDCOLD,papaya.viewer.ColorTable.TABLE_GOLD,papaya.viewer.ColorTable.TABLE_RED2YELLOW,papaya.viewer.ColorTable.TABLE_BLUE2GREEN,papaya.viewer.ColorTable.TABLE_RED2WHITE,papaya.viewer.ColorTable.TABLE_GREEN2WHITE,papaya.viewer.ColorTable.TABLE_BLUE2WHITE];papaya.viewer.ColorTable.LUT_MIN=0;
  papaya.viewer.ColorTable.LUT_MAX=255;papaya.viewer.ColorTable.ICON_SIZE=18;papaya.viewer.ColorTable.COLOR_BAR_WIDTH=100;papaya.viewer.ColorTable.COLOR_BAR_HEIGHT=15;papaya.viewer.ColorTable.findLUT=function(b){var a;for(a=0;a<papaya.viewer.ColorTable.TABLE_ALL.length;a+=1)if(papaya.viewer.ColorTable.TABLE_ALL[a].name==b)return papaya.viewer.ColorTable.TABLE_ALL[a];return papaya.viewer.ColorTable.TABLE_GRAYSCALE};
  papaya.viewer.ColorTable.addCustomLUT=function(b){papaya.viewer.ColorTable.findLUT(b.name).data===papaya.viewer.ColorTable.TABLE_GRAYSCALE.data&&papaya.viewer.ColorTable.TABLE_ALL.push(b)};papaya.viewer.ColorTable.prototype.updateMinLUT=function(b){this.updateLUT(b,this.maxLUT)};papaya.viewer.ColorTable.prototype.updateMaxLUT=function(b){this.updateLUT(this.minLUT,b)};
  papaya.viewer.ColorTable.prototype.updateLUT=function(b,a){var c,d,e;this.maxLUT=a;this.minLUT=b;c=this.maxLUT-this.minLUT;for(d=0;d<this.lutData.length;d+=1)this.knotThresholds[d]=this.lutData[d][0]*c+this.minLUT;for(d=0;d<this.lutData.length-1;d+=1)this.knotRangeRatios[d]=papaya.viewer.ColorTable.LUT_MAX/(this.knotThresholds[d+1]-this.knotThresholds[d]);for(d=0;256>d;d+=1)if(d<=this.minLUT)this.LUTarrayR[d]=this.knotMin[1]*papaya.viewer.ColorTable.LUT_MAX,this.LUTarrayG[d]=this.knotMin[2]*papaya.viewer.ColorTable.LUT_MAX,
  this.LUTarrayB[d]=this.knotMin[3]*papaya.viewer.ColorTable.LUT_MAX;else if(d>this.maxLUT)this.LUTarrayR[d]=this.knotMax[1]*papaya.viewer.ColorTable.LUT_MAX,this.LUTarrayG[d]=this.knotMax[2]*papaya.viewer.ColorTable.LUT_MAX,this.LUTarrayB[d]=this.knotMax[3]*papaya.viewer.ColorTable.LUT_MAX;else for(c=0;c<this.lutData.length-1;c+=1)d>this.knotThresholds[c]&&d<=this.knotThresholds[c+1]&&(this.useGradation?(e=((d-this.knotThresholds[c])*this.knotRangeRatios[c]+.5)/papaya.viewer.ColorTable.LUT_MAX,this.LUTarrayR[d]=
  ((1-e)*this.lutData[c][1]+e*this.lutData[c+1][1])*papaya.viewer.ColorTable.LUT_MAX,this.LUTarrayG[d]=((1-e)*this.lutData[c][2]+e*this.lutData[c+1][2])*papaya.viewer.ColorTable.LUT_MAX,this.LUTarrayB[d]=((1-e)*this.lutData[c][3]+e*this.lutData[c+1][3])*papaya.viewer.ColorTable.LUT_MAX):(this.LUTarrayR[d]=this.lutData[c][1]*papaya.viewer.ColorTable.LUT_MAX,this.LUTarrayG[d]=this.lutData[c][2]*papaya.viewer.ColorTable.LUT_MAX,this.LUTarrayB[d]=this.lutData[c][3]*papaya.viewer.ColorTable.LUT_MAX))};
  papaya.viewer.ColorTable.prototype.lookupRed=function(b){return 0<=b&&256>b?this.LUTarrayR[b]&255:0};papaya.viewer.ColorTable.prototype.lookupGreen=function(b){return 0<=b&&256>b?this.LUTarrayG[b]&255:0};papaya.viewer.ColorTable.prototype.lookupBlue=function(b){return 0<=b&&256>b?this.LUTarrayB[b]&255:0};"use strict";papaya=papaya||{};papaya.viewer=papaya.viewer||{};
  papaya.viewer.Display=papaya.viewer.Display||function(b,a){this.container=b;this.viewer=b.viewer;this.canvas=document.createElement("canvas");this.canvas.width=a;this.canvas.height=papaya.viewer.Display.SIZE;this.context=this.canvas.getContext("2d");this.canvas.style.padding=0;this.canvas.style.margin=0;this.canvas.style.border="none";this.canvas.style.cursor="default";this.tempCoord=new papaya.core.Coordinate(0,0,0);this.drawingError=!1;this.progressStartTime=this.progress=0;this.progressTimeout=
  null;this.drawingProgress=!1;this.errorMessage="";this.drawUninitializedDisplay()};papaya.viewer.Display.SIZE=50;papaya.viewer.Display.MINI_LABELS_THRESH=700;papaya.viewer.Display.PADDING=8;papaya.viewer.Display.FONT_COLOR_WHITE="white";papaya.viewer.Display.FONT_COLOR_ORANGE="rgb(182, 59, 0)";papaya.viewer.Display.FONT_SIZE_COORDINATE_LABEL=12;papaya.viewer.Display.FONT_COLOR_COORDINATE_LABEL=papaya.viewer.Display.FONT_COLOR_WHITE;papaya.viewer.Display.FONT_TYPE_COORDINATE_LABEL="sans-serif";
  papaya.viewer.Display.FONT_SIZE_COORDINATE_VALUE=18;papaya.viewer.Display.FONT_COLOR_COORDINATE_VALUE=papaya.viewer.Display.FONT_COLOR_ORANGE;papaya.viewer.Display.FONT_TYPE_COORDINATE_VALUE="sans-serif";papaya.viewer.Display.PRECISION_COORDINATE_VALUE=5;papaya.viewer.Display.PRECISION_COORDINATE_MAX=12;papaya.viewer.Display.FONT_SIZE_IMAGE_VALUE=20;papaya.viewer.Display.FONT_COLOR_IMAGE_VALUE=papaya.viewer.Display.FONT_COLOR_WHITE;papaya.viewer.Display.FONT_TYPE_IMAGE_VALUE="sans-serif";
  papaya.viewer.Display.PRECISION_IMAGE_VALUE=9;papaya.viewer.Display.PRECISION_IMAGE_MAX=14;papaya.viewer.Display.FONT_SIZE_ATLAS_MINI=14;papaya.viewer.Display.FONT_SIZE_ATLAS=20;papaya.viewer.Display.FONT_TYPE_ATLAS="sans-serif";papaya.viewer.Display.FONT_SIZE_MESSAGE_VALUE=20;papaya.viewer.Display.FONT_TYPE_MESSAGE_VALUE="sans-serif";papaya.viewer.Display.FONT_COLOR_MESSAGE="rgb(200, 75, 25)";papaya.viewer.Display.PROGRESS_LABEL_SUFFIX=["...","",".",".."];
  papaya.viewer.Display.PROGRESS_LABEL_DEFAULT="Loading";papaya.viewer.Display.prototype.drawUninitializedDisplay=function(){this.context.fillStyle="#000000";this.context.fillRect(0,0,this.canvas.width,this.canvas.height)};papaya.viewer.Display.prototype.canDraw=function(){return!(this.drawingError||this.drawingProgress)};
  papaya.viewer.Display.prototype.drawEmptyDisplay=function(){this.canDraw()?(this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.context.fillStyle="#000000",this.context.fillRect(0,0,this.canvas.width,this.canvas.height)):this.drawError&&this.drawError(this.errorMessage)};
  papaya.viewer.Display.prototype.drawDisplay=function(b,a,c){var d,e,f,h,g,m,l,q,u;if(this.canDraw()){if(h=this.viewer.canvas.width/600,q=this.viewer.canvas.width/2,g=q/5,f=this.canvas.height,u=300>q,"Mouse"!==this.container.preferences.atlasLocks&&(b=this.viewer.currentCoord.x,a=this.viewer.currentCoord.y,c=this.viewer.currentCoord.z),this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.context.fillStyle="#000000",this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.context.fillStyle=
  papaya.viewer.Display.FONT_COLOR_COORDINATE_LABEL,this.context.font=papaya.viewer.Display.FONT_SIZE_COORDINATE_LABEL+"px "+papaya.viewer.Display.FONT_TYPE_COORDINATE_LABEL,d=papaya.viewer.Display.FONT_SIZE_COORDINATE_LABEL+.75*papaya.viewer.Display.PADDING,this.context.fillText("x",1.5*papaya.viewer.Display.PADDING,d),this.context.fillText("y",1.5*papaya.viewer.Display.PADDING+g,d),this.context.fillText("z",1.5*papaya.viewer.Display.PADDING+2*g,d),d+=papaya.viewer.Display.FONT_SIZE_COORDINATE_VALUE+
  papaya.viewer.Display.PADDING/2,this.context.fillStyle=papaya.viewer.Display.FONT_COLOR_COORDINATE_VALUE,this.context.font=papaya.viewer.Display.FONT_SIZE_COORDINATE_VALUE-(u?2:0)+"px "+papaya.viewer.Display.FONT_TYPE_COORDINATE_VALUE,this.viewer.worldSpace?(e=this.viewer.screenVolumes[0].volume.header.origin,m=this.viewer.screenVolumes[0].volume.header.voxelDimensions,l=Math.min(papaya.viewer.Display.PRECISION_COORDINATE_MAX,Math.round(papaya.viewer.Display.PRECISION_COORDINATE_VALUE*h)),this.context.fillText(parseFloat(((b-
  e.x)*m.xSize).toString().substr(0,l)),1.5*papaya.viewer.Display.PADDING,d),this.context.fillText(parseFloat(((e.y-a)*m.ySize).toString().substr(0,l)),1.5*papaya.viewer.Display.PADDING+g,d),this.context.fillText(parseFloat(((e.z-c)*m.zSize).toString().substr(0,l)),1.5*papaya.viewer.Display.PADDING+2*g,d)):(this.context.fillText(Math.round(b).toString(),1.5*papaya.viewer.Display.PADDING,d),this.context.fillText(Math.round(a).toString(),1.5*papaya.viewer.Display.PADDING+g,d),this.context.fillText(Math.round(c).toString(),
  1.5*papaya.viewer.Display.PADDING+2*g,d)),this.viewer.currentScreenVolume.rgb||this.viewer.currentScreenVolume.dti||(e=this.viewer.getCurrentValueAt(b,a,c),this.canvas.currentval=e.toString(),d=f/2+papaya.viewer.Display.FONT_SIZE_IMAGE_VALUE/2-papaya.viewer.Display.PADDING/2,this.context.fillStyle=papaya.viewer.Display.FONT_COLOR_IMAGE_VALUE,this.context.font=papaya.viewer.Display.FONT_SIZE_IMAGE_VALUE-(u?2:0)+"px "+papaya.viewer.Display.FONT_TYPE_IMAGE_VALUE,l=Math.min(papaya.viewer.Display.PRECISION_IMAGE_MAX,
  Math.round(papaya.viewer.Display.PRECISION_IMAGE_VALUE*h)),this.context.fillText(parseFloat(e.toString().substr(0,l)),2*papaya.viewer.Display.PADDING+3*g,d)),this.viewer.atlas&&this.viewer.atlas.volume.isLoaded)if(this.viewer.getWorldCoordinateAtIndex(b,a,c,this.tempCoord),c=this.viewer.atlas.getLabelAtCoordinate(this.tempCoord.x,this.tempCoord.y,this.tempCoord.z),b=c.length,l=Math.ceil(this.viewer.atlas.maxLabels/2),300>q&&2<=b)for(a=.75*q,h=b-1;0<=h;--h)this.context.fillStyle=h===b-2?papaya.viewer.Display.FONT_COLOR_ORANGE:
  papaya.viewer.Display.FONT_COLOR_WHITE,this.context.font=papaya.viewer.Display.FONT_SIZE_ATLAS_MINI+"px "+papaya.viewer.Display.FONT_TYPE_ATLAS,g=this.context.measureText(c[h]),g.width>a-2*papaya.viewer.Display.PADDING&&(c[h]=c[h].substr(0,Math.round(c[h].length/3))+" ... "+c[h].substr(c[h].length-3,3)),h===b-2?this.context.fillText(c[h],q+.25*q,1.5*papaya.viewer.Display.PADDING+papaya.viewer.Display.FONT_SIZE_ATLAS_MINI/2):h===b-1&&this.context.fillText(c[h],q+.25*q,papaya.viewer.Display.PADDING+
  f/2+papaya.viewer.Display.FONT_SIZE_ATLAS_MINI/2);else if(600>q&&2<b)for(a=q/2,h=b-1;0<=h;--h)this.context.fillStyle=h<l?papaya.viewer.Display.FONT_COLOR_ORANGE:papaya.viewer.Display.FONT_COLOR_WHITE,this.context.font=papaya.viewer.Display.FONT_SIZE_ATLAS_MINI+"px "+papaya.viewer.Display.FONT_TYPE_ATLAS,g=this.context.measureText(c[h]),g.width>a-6*papaya.viewer.Display.PADDING&&(c[h]=c[h].substr(0,Math.round(c[h].length/3))+" ... "+c[h].substr(c[h].length-3,3)),0===h?this.context.fillText(c[h],q+
  5*papaya.viewer.Display.PADDING,1.5*papaya.viewer.Display.PADDING+papaya.viewer.Display.FONT_SIZE_ATLAS_MINI/2):1===h?this.context.fillText(c[h],q+5*papaya.viewer.Display.PADDING,papaya.viewer.Display.PADDING+f/2+papaya.viewer.Display.FONT_SIZE_ATLAS_MINI/2):2===h?this.context.fillText(c[h],1.5*q+5*papaya.viewer.Display.PADDING,1.5*papaya.viewer.Display.PADDING+papaya.viewer.Display.FONT_SIZE_ATLAS_MINI/2):3===h&&this.context.fillText(c[h],1.5*q+5*papaya.viewer.Display.PADDING,papaya.viewer.Display.PADDING+
  f/2+papaya.viewer.Display.FONT_SIZE_ATLAS_MINI/2);else if(800>q&&3<b)for(a=q/3,h=0;4>h;h+=1)2>h?(this.context.fillStyle=h<l?papaya.viewer.Display.FONT_COLOR_ORANGE:papaya.viewer.Display.FONT_COLOR_WHITE,this.context.font=papaya.viewer.Display.FONT_SIZE_ATLAS_MINI+"px "+papaya.viewer.Display.FONT_TYPE_ATLAS,g=this.context.measureText(c[h]),g.width>a-6*papaya.viewer.Display.PADDING&&(c[h]=c[h].substr(0,Math.round(c[h].length/3))+" ... "+c[h].substr(c[h].length-3,3)),0===h?this.context.fillText(c[h],
  q+5*papaya.viewer.Display.PADDING,1.5*papaya.viewer.Display.PADDING+papaya.viewer.Display.FONT_SIZE_ATLAS_MINI/2):1===h?this.context.fillText(c[h],q+5*papaya.viewer.Display.PADDING,papaya.viewer.Display.PADDING+f/2+papaya.viewer.Display.FONT_SIZE_ATLAS_MINI/2):2===h?this.context.fillText(c[h],1.5*q+5*papaya.viewer.Display.PADDING,1.5*papaya.viewer.Display.PADDING+papaya.viewer.Display.FONT_SIZE_ATLAS_MINI/2):3===h&&this.context.fillText(c[h],1.5*q+5*papaya.viewer.Display.PADDING,papaya.viewer.Display.PADDING+
  f/2+papaya.viewer.Display.FONT_SIZE_ATLAS_MINI/2)):(d=f/2+papaya.viewer.Display.FONT_SIZE_ATLAS/2-papaya.viewer.Display.PADDING/2,this.context.fillStyle=h<l?papaya.viewer.Display.FONT_COLOR_ORANGE:papaya.viewer.Display.FONT_COLOR_WHITE,this.context.font=papaya.viewer.Display.FONT_SIZE_ATLAS+"px "+papaya.viewer.Display.FONT_TYPE_ATLAS,g=this.context.measureText(c[h]),g.width>a-2*papaya.viewer.Display.PADDING&&(c[h]=c[h].substr(0,Math.round(c[h].length/3))+" ... "+c[h].substr(c[h].length-3,3)),2===
  h?this.context.fillText(c[h],q+papaya.viewer.Display.PADDING+a,d):3===h&&this.context.fillText(c[h],q+papaya.viewer.Display.PADDING+2*a,d));else for(a=q/b,d=f/2+papaya.viewer.Display.FONT_SIZE_ATLAS/2-papaya.viewer.Display.PADDING/2,h=0;h<b;h+=1)this.context.fillStyle=h<l?papaya.viewer.Display.FONT_COLOR_ORANGE:papaya.viewer.Display.FONT_COLOR_WHITE,this.context.font=papaya.viewer.Display.FONT_SIZE_ATLAS-(u?4:0)+"px "+papaya.viewer.Display.FONT_TYPE_ATLAS,g=this.context.measureText(c[h]),g.width>
  a-2*papaya.viewer.Display.PADDING-.05*q*Math.max(0,3-b)&&(c[h]=c[h].substr(0,Math.round(c[h].length/3))+" ... "+c[h].substr(c[h].length-3,3)),this.context.fillText(c[h],q+papaya.viewer.Display.PADDING+.05*q*Math.max(0,3-b)+h*a,d)}else this.drawError&&this.drawError(this.errorMessage)};
  papaya.viewer.Display.prototype.drawError=function(b){var a;this.errorMessage=b;this.drawingError=!0;a=this;window.setTimeout(papaya.utilities.ObjectUtils.bind(a,function(){a.drawingError=!1}),3E3);this.context.clearRect(0,0,this.canvas.width,this.canvas.height);this.context.fillStyle="#000000";this.context.fillRect(0,0,this.canvas.width,this.canvas.height);this.context.fillStyle="red";this.context.font=papaya.viewer.Display.FONT_SIZE_MESSAGE_VALUE+"px "+papaya.viewer.Display.FONT_TYPE_MESSAGE_VALUE;
  this.context.fillText(b,papaya.viewer.Display.PADDING,papaya.viewer.Display.FONT_SIZE_COORDINATE_LABEL+papaya.viewer.Display.PADDING+1.5*papaya.viewer.Display.PADDING)};
  papaya.viewer.Display.prototype.drawProgress=function(b,a){var c,d,e,f;c=Math.round(1E3*b);c>this.progress&&(this.progress=c,c=void 0!==a?a:papaya.viewer.Display.PROGRESS_LABEL_DEFAULT,e=0===this.progressStartTime?this.progressStartTime=(new Date).getTime():(new Date).getTime(),e=parseInt((e-this.progressStartTime)/500,10)%4,990<=this.progress?(this.progressTimeout&&(window.clearTimeout(this.progressTimeout),this.progressTimeout=null),this.drawingProgress=!1,this.progressStartTime=this.progress=0,
  this.drawEmptyDisplay()):(this.progressTimeout&&window.clearTimeout(this.progressTimeout),d=this,this.progressTimeout=window.setTimeout(papaya.utilities.ObjectUtils.bind(d,function(){d.drawingProgress=!1}),3E3),this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.context.fillStyle="#fff",this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.context.fillStyle="#000",this.context.fillRect(0,0,this.canvas.width*b,this.canvas.height),this.context.font=papaya.viewer.Display.FONT_SIZE_MESSAGE_VALUE+
  "px "+papaya.viewer.Display.FONT_TYPE_MESSAGE_VALUE,this.context.fillStyle=papaya.viewer.Display.FONT_COLOR_MESSAGE,f=papaya.viewer.Display.FONT_SIZE_COORDINATE_LABEL+papaya.viewer.Display.PADDING+1.5*papaya.viewer.Display.PADDING,this.context.fillText(c+papaya.viewer.Display.PROGRESS_LABEL_SUFFIX[e],2*papaya.viewer.Display.PADDING,f)))};"use strict";papaya=papaya||{};papaya.volume=papaya.volume||{};
  papaya.viewer.Preferences=papaya.viewer.Preferences||function(){this.viewer=null;this.showCrosshairs=papaya.viewer.Preferences.DEFAULT_SHOW_CROSSHAIRS;this.atlasLocks=papaya.viewer.Preferences.DEFAULT_ATLAS_LOCKS;this.showOrientation=papaya.viewer.Preferences.DEFAULT_SHOW_ORIENTATION;this.scrollBehavior=papaya.viewer.Preferences.DEFAULT_SCROLL;this.smoothDisplay=papaya.viewer.Preferences.DEFAULT_SMOOTH_DISPLAY;this.radiological=papaya.viewer.Preferences.DEFAULT_RADIOLOGICAL;this.showRuler=papaya.viewer.Preferences.DEFAULT_SHOW_RULER;
  this.surfaceBackgroundColor=papaya.viewer.Preferences.DEFAULT_SURFACE_BACKGROUND_COLOR;this.showSurfacePlanes=papaya.viewer.Preferences.DEFAULT_SHOW_SURFACE_PLANES;this.showSurfaceCrosshairs=papaya.viewer.Preferences.DEFAULT_SHOW_SURFACE_CROSSHAIRS};papaya.viewer.Preferences.ALL_PREFS="showCrosshairs atlasLocks showOrientation scrollBehavior smoothDisplay radiological showRuler surfaceBackgroundColor showSurfacePlanes".split(" ");papaya.viewer.Preferences.COOKIE_PREFIX="papaya-";
  papaya.viewer.Preferences.COOKIE_EXPIRY_DAYS=365;papaya.viewer.Preferences.DEFAULT_SHOW_CROSSHAIRS="Yes";papaya.viewer.Preferences.DEFAULT_ATLAS_LOCKS="Mouse";papaya.viewer.Preferences.DEFAULT_SHOW_ORIENTATION="No";papaya.viewer.Preferences.DEFAULT_SCROLL="Increment Slice";papaya.viewer.Preferences.DEFAULT_SMOOTH_DISPLAY="Yes";papaya.viewer.Preferences.DEFAULT_RADIOLOGICAL="No";papaya.viewer.Preferences.DEFAULT_SHOW_RULER="No";papaya.viewer.Preferences.DEFAULT_SURFACE_BACKGROUND_COLOR="Gray";
  papaya.viewer.Preferences.DEFAULT_SHOW_SURFACE_PLANES="Yes";papaya.viewer.Preferences.prototype.updatePreference=function(b,a){this[b]=a;this.viewer.drawViewer(!0);papaya.utilities.UrlUtils.createCookie(papaya.viewer.Preferences.COOKIE_PREFIX+b,a,papaya.viewer.Preferences.COOKIE_EXPIRY_DAYS)};
  papaya.viewer.Preferences.prototype.readPreferences=function(){var b,a;for(b=0;b<papaya.viewer.Preferences.ALL_PREFS.length;b+=1)(a=papaya.utilities.UrlUtils.readCookie(papaya.viewer.Preferences.COOKIE_PREFIX+papaya.viewer.Preferences.ALL_PREFS[b]))&&(this[papaya.viewer.Preferences.ALL_PREFS[b]]=a)};"use strict";papaya=papaya||{};papaya.viewer=papaya.viewer||{};
  papaya.viewer.ScreenSlice=papaya.viewer.ScreenSlice||function(b,a,c,d,e,f,h,g){this.screenVolumes=h;this.sliceDirection=a;this.currentSlice=-1;this.xDim=c;this.yDim=d;this.xSize=e;this.ySize=f;this.canvasMain=document.createElement("canvas");this.canvasMain.width=this.xDim;this.canvasMain.height=this.yDim;this.contextMain=this.canvasMain.getContext("2d");this.imageDataDraw=this.contextMain.createImageData(this.xDim,this.yDim);this.screenDim=this.screenOffsetY=this.screenOffsetX=0;this.screenTransform=
  [[1,0,0],[0,1,0],[0,0,1]];this.zoomTransform=[[1,0,0],[0,1,0],[0,0,1]];this.finalTransform=[[1,0,0],[0,1,0],[0,0,1]];this.radiologicalTransform=[[-1,0,this.xDim],[0,1,0],[0,0,1]];this.tempTransform=[[1,0,0],[0,1,0],[0,0,1]];this.tempTransform2=[[1,0,0],[0,1,0],[0,0,1]];this.screenTransform2=[[1,0,0],[0,1,0],[0,0,1]];this.finalTransform2=[[1,0,0],[0,1,0],[0,0,1]];this.imageData=[];this.imageData2=[];this.manager=g;this.rulerPoints=[new papaya.core.Point(parseInt(.25*c),parseInt(.25*d)),new papaya.core.Point(parseInt(.75*
  c),parseInt(.75*d))];this.tempPoint=new papaya.core.Point;this.contextDTILines=this.canvasDTILines=null};papaya.viewer.ScreenSlice.DIRECTION_UNKNOWN=0;papaya.viewer.ScreenSlice.DIRECTION_AXIAL=1;papaya.viewer.ScreenSlice.DIRECTION_CORONAL=2;papaya.viewer.ScreenSlice.DIRECTION_SAGITTAL=3;papaya.viewer.ScreenSlice.DIRECTION_TEMPORAL=4;papaya.viewer.ScreenSlice.DIRECTION_SURFACE=5;papaya.viewer.ScreenSlice.SCREEN_PIXEL_MAX=255;papaya.viewer.ScreenSlice.SCREEN_PIXEL_MIN=0;
  papaya.viewer.ScreenSlice.GRAB_RADIUS=5;papaya.viewer.ScreenSlice.DTI_COLORS=["#ff0000","#00ff00","#0000ff"];
  papaya.viewer.ScreenSlice.prototype.updateSlice=function(b,a){var c,d,e,f,h,g,m,l,q,u,w,C,B,A,E,D,z,M,r,K,N,G,x,F=!1,t,k=0,p,J=!1,I=this.manager.isWorldMode();b=Math.round(b);t=this.manager.isRadiologicalMode()&&this.isRadiologicalSensitive()?-1:1;if(a||this.currentSlice!==b){this.currentSlice=b;c=this.screenVolumes[0].volume.header.origin;d=this.screenVolumes[0].volume.header.voxelDimensions;this.contextMain.clearRect(0,0,this.canvasMain.width,this.canvasMain.height);this.contextDTILines&&this.contextDTILines.clearRect(0,
  0,this.screenDim,this.screenDim);this.imageData.length<this.screenVolumes.length&&(this.imageData=papaya.utilities.ArrayUtils.createArray(this.screenVolumes.length,this.xDim*this.yDim),this.imageData2=papaya.utilities.ArrayUtils.createArray(this.screenVolumes.length,1));for(e=0;e<this.screenVolumes.length;e+=1)if(!this.screenVolumes[e].hidden){u=this.screenVolumes[e].currentTimepoint;w=this.screenVolumes[e].rgb;C=this.screenVolumes[e].dti;B=this.screenVolumes[e].dtiLines;J|=!B;M=this.screenVolumes[e].dtiColors;
  x=this.screenVolumes[e].dtiAlphaFactor;p=0===e||this.screenVolumes[e].interpolation;p&="Yes"===this.manager.container.preferences.smoothDisplay;B&&(this.updateDTILinesImage(),this.contextDTILines.lineWidth=1,M||(this.contextDTILines.strokeStyle=papaya.viewer.ScreenSlice.DTI_COLORS[k],k+=1,k%=3,this.contextDTILines.beginPath()));for(f=0;f<this.yDim;f+=1)for(h=0;h<this.xDim;h+=1)(g=0,m=255,q=this.screenVolumes[e].alpha,w)?(this.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_AXIAL?g=this.screenVolumes[e].volume.getVoxelAtIndex(h,
  f,b,u,!0):this.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_CORONAL?g=this.screenVolumes[e].volume.getVoxelAtIndex(h,b,f,u,!0):this.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_SAGITTAL&&(g=this.screenVolumes[e].volume.getVoxelAtIndex(b,h,f,u,!0)),l=4*(f*this.xDim+h),this.imageData[e][l]=g,this.imageDataDraw.data[l]=g>>16&255,this.imageDataDraw.data[l+1]=g>>8&255,this.imageDataDraw.data[l+2]=g&255,this.imageDataDraw.data[l+3]=m):C?(I?(this.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_AXIAL?
  (r=(h-c.x)*d.xSize,K=(c.y-f)*d.ySize,N=(c.z-b)*d.zSize):this.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_CORONAL?(r=(h-c.x)*d.xSize,K=(c.y-b)*d.ySize,N=(c.z-f)*d.zSize):this.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_SAGITTAL&&(r=(b-c.x)*d.xSize,K=(c.y-h)*d.ySize,N=(c.z-f)*d.zSize),D=this.screenVolumes[e].volume.getVoxelAtCoordinate(r,K,N,0,!p),A=this.screenVolumes[e].volume.getVoxelAtCoordinate(r,K,N,1,!p),E=this.screenVolumes[e].volume.getVoxelAtCoordinate(r,K,N,2,!p),this.screenVolumes[e].dtiVolumeMod&&
  (q=Math.min(1,this.screenVolumes[e].dtiVolumeMod.getVoxelAtCoordinate(r,K,N,0,!p)))):(this.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_AXIAL?(r=h*d.xSize,K=f*d.ySize,N=b*d.zSize):this.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_CORONAL?(r=h*d.xSize,K=b*d.ySize,N=f*d.zSize):this.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_SAGITTAL&&(r=b*d.xSize,K=h*d.ySize,N=f*d.zSize),D=this.screenVolumes[e].volume.getVoxelAtMM(r,K,N,0,!p),A=this.screenVolumes[e].volume.getVoxelAtMM(r,K,
  N,1,!p),E=this.screenVolumes[e].volume.getVoxelAtMM(r,K,N,2,!p),this.screenVolumes[e].dtiVolumeMod&&(q=Math.min(1,this.screenVolumes[e].dtiVolumeMod.getVoxelAtMM(r,K,N,0,!p)))),l=4*(f*this.xDim+h),B?0!==D||0!==A||0!==E?(this.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_AXIAL?(z=Math.atan2(t*A,D),G=Math.acos(Math.abs(E)/Math.sqrt(D*D+A*A+E*E))):this.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_CORONAL?(z=Math.atan2(t*E,D),G=Math.acos(Math.abs(A)/Math.sqrt(D*D+A*A+E*E))):this.sliceDirection===
  papaya.viewer.ScreenSlice.DIRECTION_SAGITTAL&&(z=Math.atan2(E,A),G=Math.acos(Math.abs(D)/Math.sqrt(D*D+A*A+E*E))),G=1-G/1.5708,D=papayaRoundFast(Math.abs(255*D)),A=papayaRoundFast(Math.abs(255*A)),E=papayaRoundFast(Math.abs(255*E)),g=papayaRoundFast(255*q),g=(g&255)<<24|(D&255)<<16|(A&255)<<8|E&255,M&&(this.contextDTILines.beginPath(),m=g&16777215,this.contextDTILines.strokeStyle="#"+papaya.utilities.StringUtils.pad(m.toString(16),6)),this.imageData[e][l]=z,this.imageData2[e][l]=g,q=Math.sin(z),g=
  Math.cos(z),l=this.finalTransform2[0][2]+(h+.5)*this.finalTransform2[0][0],m=this.finalTransform2[1][2]+(f+.5)*this.finalTransform2[1][1],A=this.finalTransform2[0][2]+(h+.5*G)*this.finalTransform2[0][0],E=this.finalTransform2[1][2]+(f+.5)*this.finalTransform2[1][1],D=g*(A-l)-q*(E-m)+l,A=q*(A-l)+g*(E-m)+m,this.contextDTILines.moveTo(D,A),A=this.finalTransform2[0][2]+(h+1-.5*G)*this.finalTransform2[0][0],E=this.finalTransform2[1][2]+(f+.5)*this.finalTransform2[1][1],D=g*(A-l)-q*(E-m)+l,l=q*(A-l)+g*
  (E-m)+m,this.contextDTILines.lineTo(D,l),M&&this.contextDTILines.stroke()):this.imageData[e][l]=Number.NaN:(q=0!==D||0!==A||0!==E?1-(1-q)*x:0,D=papayaRoundFast(Math.abs(255*D)),A=papayaRoundFast(Math.abs(255*A)),E=papayaRoundFast(Math.abs(255*E)),g=papayaRoundFast(255*q),this.imageData[e][l]=(g&255)<<24|(D&255)<<16|(A&255)<<8|E&255,F?(this.imageDataDraw.data[l]=this.imageDataDraw.data[l]*(1-q)+(D&255)*q,this.imageDataDraw.data[l+1]=this.imageDataDraw.data[l+1]*(1-q)+(A&255)*q,this.imageDataDraw.data[l+
  2]=this.imageDataDraw.data[l+2]*(1-q)+(E&255)*q,this.imageDataDraw.data[l+3]=m):(this.imageDataDraw.data[l]=D&255,this.imageDataDraw.data[l+1]=A&255,this.imageDataDraw.data[l+2]=E&255,this.imageDataDraw.data[l+3]=g&255))):(I?this.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_AXIAL?g=this.screenVolumes[e].volume.getVoxelAtCoordinate((h-c.x)*d.xSize,(c.y-f)*d.ySize,(c.z-b)*d.zSize,u,!p):this.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_CORONAL?g=this.screenVolumes[e].volume.getVoxelAtCoordinate((h-
  c.x)*d.xSize,(c.y-b)*d.ySize,(c.z-f)*d.zSize,u,!p):this.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_SAGITTAL&&(g=this.screenVolumes[e].volume.getVoxelAtCoordinate((b-c.x)*d.xSize,(c.y-h)*d.ySize,(c.z-f)*d.zSize,u,!p)):this.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_AXIAL?g=this.screenVolumes[e].volume.getVoxelAtMM(h*d.xSize,f*d.ySize,b*d.zSize,u,!p):this.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_CORONAL?g=this.screenVolumes[e].volume.getVoxelAtMM(h*d.xSize,b*d.ySize,
  f*d.zSize,u,!p):this.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_SAGITTAL&&(g=this.screenVolumes[e].volume.getVoxelAtMM(b*d.xSize,h*d.ySize,f*d.zSize,u,!p)),l=4*(f*this.xDim+h),D=g,this.imageData[e][l]=g,!this.screenVolumes[e].negative&&g<=this.screenVolumes[e].screenMin||this.screenVolumes[e].negative&&g>=this.screenVolumes[e].screenMin||isNaN(g)?(g=papaya.viewer.ScreenSlice.SCREEN_PIXEL_MIN,m=this.screenVolumes[e].isOverlay()?0:255):g=!this.screenVolumes[e].negative&&g>=this.screenVolumes[e].screenMax||
  this.screenVolumes[e].negative&&g<=this.screenVolumes[e].screenMax?papaya.viewer.ScreenSlice.SCREEN_PIXEL_MAX:papayaRoundFast((g-this.screenVolumes[e].screenMin)*this.screenVolumes[e].screenRatio),F)?0<m&&(this.imageDataDraw.data[l]=this.imageDataDraw.data[l]*(1-q)+this.screenVolumes[e].colorTable.lookupRed(g,D)*q,this.imageDataDraw.data[l+1]=this.imageDataDraw.data[l+1]*(1-q)+this.screenVolumes[e].colorTable.lookupGreen(g,D)*q,this.imageDataDraw.data[l+2]=this.imageDataDraw.data[l+2]*(1-q)+this.screenVolumes[e].colorTable.lookupBlue(g,
  D)*q,this.imageDataDraw.data[l+3]=m):(this.imageDataDraw.data[l]=this.screenVolumes[e].colorTable.lookupRed(g,D)*q,this.imageDataDraw.data[l+1]=this.screenVolumes[e].colorTable.lookupGreen(g,D)*q,this.imageDataDraw.data[l+2]=this.screenVolumes[e].colorTable.lookupBlue(g,D)*q,this.imageDataDraw.data[l+3]=m);M||this.contextDTILines.stroke();B||(F=!0)}J&&this.contextMain.putImageData(this.imageDataDraw,0,0)}};
  papaya.viewer.ScreenSlice.prototype.repaint=function(b,a,c){var d,e,f,h;a=0;var g,m,l,q,u,w,C,B,A,E;c=0;var D=!1;this.currentSlice=b=Math.round(b);this.contextMain.clearRect(0,0,this.canvasMain.width,this.canvasMain.height);this.contextDTILines&&this.contextDTILines.clearRect(0,0,this.screenDim,this.screenDim);if(this.imageData.length===this.screenVolumes.length){for(b=0;b<this.screenVolumes.length;b+=1)if(!this.screenVolumes[b].hidden){m=this.screenVolumes[b].rgb;l=this.screenVolumes[b].dti;q=this.screenVolumes[b].dtiLines;
  E=this.screenVolumes[b].dtiColors;q&&(this.contextDTILines.lineWidth=1,E||(this.contextDTILines.strokeStyle=papaya.viewer.ScreenSlice.DTI_COLORS[c],c+=1,c%=3,this.contextDTILines.beginPath()));for(d=0;d<this.yDim;d+=1)for(e=0;e<this.xDim;e+=1)(f=this.imageData[b][a],h=255,g=this.screenVolumes[b].alpha,a=4*(d*this.xDim+e),m)?(this.imageDataDraw.data[a]=f>>16&255,this.imageDataDraw.data[a+1]=f>>8&255,this.imageDataDraw.data[a+2]=f&255,this.imageDataDraw.data[a+3]=h):l?q?(h=this.imageData[b][a],isNaN(h)||
  (f=this.imageData2[b][a],A=f>>16&255,B=f>>8&255,w=f&255,g=f&16777215,this.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_AXIAL?u=Math.acos(Math.abs(w)/Math.sqrt(A*A+B*B+w*w)):this.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_CORONAL?u=Math.acos(Math.abs(B)/Math.sqrt(A*A+B*B+w*w)):this.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_SAGITTAL&&(u=Math.acos(Math.abs(A)/Math.sqrt(A*A+B*B+w*w))),u=1-u/1.5708,E&&(this.contextDTILines.beginPath(),this.contextDTILines.strokeStyle="#"+papaya.utilities.StringUtils.pad(g.toString(16),
  6)),f=Math.sin(h),A=Math.cos(h),g=this.finalTransform2[0][2]+(e+.5)*this.finalTransform2[0][0],h=this.finalTransform2[1][2]+(d+.5)*this.finalTransform2[1][1],w=this.finalTransform2[0][2]+(e+.5*u)*this.finalTransform2[0][0],C=this.finalTransform2[1][2]+(d+.5)*this.finalTransform2[1][1],B=A*(w-g)-f*(C-h)+g,w=f*(w-g)+A*(C-h)+h,this.contextDTILines.moveTo(B,w),w=this.finalTransform2[0][2]+(e+1-.5*u)*this.finalTransform2[0][0],C=this.finalTransform2[1][2]+(d+.5)*this.finalTransform2[1][1],B=A*(w-g)-f*
  (C-h)+g,f=f*(w-g)+A*(C-h)+h,this.contextDTILines.lineTo(B,f),E&&this.contextDTILines.stroke())):(f=this.imageData[b][a],g=f&16777215,g=0!==g?(f>>24&255)/255:0,D?(this.imageDataDraw.data[a]=this.imageDataDraw.data[a]*(1-g)+(f>>16&255)*g,this.imageDataDraw.data[a+1]=this.imageDataDraw.data[a+1]*(1-g)+(f>>8&255)*g,this.imageDataDraw.data[a+2]=this.imageDataDraw.data[a+2]*(1-g)+(f&255)*g,this.imageDataDraw.data[a+3]=h):(this.imageDataDraw.data[a]=f>>16&255,this.imageDataDraw.data[a+1]=f>>8&255,this.imageDataDraw.data[a+
  2]=f&255,this.imageDataDraw.data[a+3]=f>>24&255)):(A=f=this.imageData[b][a],!this.screenVolumes[b].negative&&f<=this.screenVolumes[b].screenMin||this.screenVolumes[b].negative&&f>=this.screenVolumes[b].screenMin||isNaN(f)?(f=papaya.viewer.ScreenSlice.SCREEN_PIXEL_MIN,h=this.screenVolumes[b].isOverlay()?0:255):f=!this.screenVolumes[b].negative&&f>=this.screenVolumes[b].screenMax||this.screenVolumes[b].negative&&f<=this.screenVolumes[b].screenMax?papaya.viewer.ScreenSlice.SCREEN_PIXEL_MAX:papayaRoundFast((f-
  this.screenVolumes[b].screenMin)*this.screenVolumes[b].screenRatio),D)?0<h&&(this.imageDataDraw.data[a]=this.imageDataDraw.data[a]*(1-g)+this.screenVolumes[b].colorTable.lookupRed(f,A)*g,this.imageDataDraw.data[a+1]=this.imageDataDraw.data[a+1]*(1-g)+this.screenVolumes[b].colorTable.lookupGreen(f,A)*g,this.imageDataDraw.data[a+2]=this.imageDataDraw.data[a+2]*(1-g)+this.screenVolumes[b].colorTable.lookupBlue(f,A)*g,this.imageDataDraw.data[a+3]=h):(this.imageDataDraw.data[a]=this.screenVolumes[b].colorTable.lookupRed(f,
  A)*g,this.imageDataDraw.data[a+1]=this.screenVolumes[b].colorTable.lookupGreen(f,A)*g,this.imageDataDraw.data[a+2]=this.screenVolumes[b].colorTable.lookupBlue(f,A)*g,this.imageDataDraw.data[a+3]=h);E||this.contextDTILines.stroke();q||(D=!0)}this.contextMain.putImageData(this.imageDataDraw,0,0)}else this.updateSlice(b,!0)};papaya.viewer.ScreenSlice.prototype.getRealWidth=function(){return this.xDim*this.xSize};papaya.viewer.ScreenSlice.prototype.getRealHeight=function(){return this.yDim*this.ySize};
  papaya.viewer.ScreenSlice.prototype.getXYratio=function(){return this.xSize/this.ySize};papaya.viewer.ScreenSlice.prototype.getYXratio=function(){return this.ySize/this.xSize};papaya.viewer.ScreenSlice.prototype.getXSize=function(){return this.xSize};papaya.viewer.ScreenSlice.prototype.getYSize=function(){return this.ySize};papaya.viewer.ScreenSlice.prototype.getXDim=function(){return this.xDim};papaya.viewer.ScreenSlice.prototype.getYDim=function(){return this.yDim};
  papaya.viewer.ScreenSlice.prototype.updateZoomTransform=function(b,a,c,d,e,f){var h;a=(a+.5)*(b-1)*-1;c=(c+.5)*(b-1)*-1;d=a+d*(b-1);h=-1*(b-1)*this.xDim;0<d?d=0:d<h&&(d=h);e=c+e*(b-1);h=-1*(b-1)*this.yDim;0<e?e=0:e<h&&(e=h);1<b&&(this.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_AXIAL?(f.panAmountX=Math.round((d-a)/(b-1)),f.panAmountY=Math.round((e-c)/(b-1))):this.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_CORONAL?(f.panAmountX=Math.round((d-a)/(b-1)),f.panAmountZ=Math.round((e-
  c)/(b-1))):this.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_SAGITTAL&&(f.panAmountY=Math.round((d-a)/(b-1)),f.panAmountZ=Math.round((e-c)/(b-1))));this.zoomTransform[0][0]=b;this.zoomTransform[0][1]=0;this.zoomTransform[0][2]=d;this.zoomTransform[1][0]=0;this.zoomTransform[1][1]=b;this.zoomTransform[1][2]=e;this.updateFinalTransform()};
  papaya.viewer.ScreenSlice.prototype.updateFinalTransform=function(){var b,a;if(this.manager.isRadiologicalMode()&&this.isRadiologicalSensitive()){for(b=0;3>b;b+=1)for(a=0;3>a;a+=1)this.tempTransform[b][a]=this.screenTransform[b][a];for(b=0;3>b;b+=1)for(a=0;3>a;a+=1)this.tempTransform2[b][a]=this.tempTransform[b][0]*this.radiologicalTransform[0][a]+this.tempTransform[b][1]*this.radiologicalTransform[1][a]+this.tempTransform[b][2]*this.radiologicalTransform[2][a];for(b=0;3>b;b+=1)for(a=0;3>a;a+=1)this.finalTransform[b][a]=
  this.tempTransform2[b][0]*this.zoomTransform[0][a]+this.tempTransform2[b][1]*this.zoomTransform[1][a]+this.tempTransform2[b][2]*this.zoomTransform[2][a];for(b=0;3>b;b+=1)for(a=0;3>a;a+=1)this.tempTransform[b][a]=this.screenTransform2[b][a];for(b=0;3>b;b+=1)for(a=0;3>a;a+=1)this.tempTransform2[b][a]=this.tempTransform[b][0]*this.radiologicalTransform[0][a]+this.tempTransform[b][1]*this.radiologicalTransform[1][a]+this.tempTransform[b][2]*this.radiologicalTransform[2][a];for(b=0;3>b;b+=1)for(a=0;3>
  a;a+=1)this.finalTransform2[b][a]=this.tempTransform2[b][0]*this.zoomTransform[0][a]+this.tempTransform2[b][1]*this.zoomTransform[1][a]+this.tempTransform2[b][2]*this.zoomTransform[2][a]}else{for(b=0;3>b;b+=1)for(a=0;3>a;a+=1)this.finalTransform[b][a]=this.screenTransform[b][0]*this.zoomTransform[0][a]+this.screenTransform[b][1]*this.zoomTransform[1][a]+this.screenTransform[b][2]*this.zoomTransform[2][a];for(b=0;3>b;b+=1)for(a=0;3>a;a+=1)this.finalTransform2[b][a]=this.screenTransform2[b][0]*this.zoomTransform[0][a]+
  this.screenTransform2[b][1]*this.zoomTransform[1][a]+this.screenTransform2[b][2]*this.zoomTransform[2][a]}};papaya.viewer.ScreenSlice.prototype.isRadiologicalSensitive=function(){return this.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_AXIAL||this.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_CORONAL};
  papaya.viewer.ScreenSlice.prototype.findProximalRulerHandle=function(b,a){this.tempPoint.x=b;this.tempPoint.y=a;return papaya.utilities.MathUtils.lineDistance(this.tempPoint.x,this.tempPoint.y,this.rulerPoints[0].x,this.rulerPoints[0].y)<papaya.viewer.ScreenSlice.GRAB_RADIUS?this.rulerPoints[0]:papaya.utilities.MathUtils.lineDistance(this.tempPoint.x,this.tempPoint.y,this.rulerPoints[1].x,this.rulerPoints[1].y)<papaya.viewer.ScreenSlice.GRAB_RADIUS?this.rulerPoints[1]:null};
  papaya.viewer.ScreenSlice.prototype.updateDTILinesImage=function(){if(null===this.canvasDTILines||this.canvasDTILines.width!==this.screenDim)this.canvasDTILines=document.createElement("canvas"),this.canvasDTILines.width=this.screenDim,this.canvasDTILines.height=this.screenDim,this.contextDTILines=this.canvasDTILines.getContext("2d")};papaya.viewer.ScreenSlice.prototype.clearDTILinesImage=function(){this.contextDTILines=this.canvasDTILines=null};"use strict";papaya=papaya||{};
  papaya.viewer=papaya.viewer||{};
  papaya.viewer.ScreenVolume=papaya.viewer.ScreenVolume||function(b,a,c,d,e,f){this.volume=b;this.lutName=c;this.colorTable=new papaya.viewer.ColorTable(this.lutName,d);this.screenMin=this.volume.header.imageRange.displayMin;this.screenMax=this.volume.header.imageRange.displayMax;this.imageMin=this.volume.header.imageRange.imageMin;this.imageMax=this.volume.header.imageRange.imageMax;this.alpha=1;this.currentTimepoint=0;this.parametric=void 0!==e&&e;this.negativeScreenVol=null;this.dtiLines=this.dti=
  !1;this.dtiColors=!0;this.dtiVolumeMod=null;this.dtiAlphaFactor=1;this.rgb=this.volume.header.imageType.datatype===papaya.volume.ImageType.DATATYPE_RGB;this.hasCheckedImageRange=!1;this.interpolation=!0;this.error=null;this.hidden=!1;this.rotationZ=this.rotationY=this.rotationX=.5;this.rotationAbout="Rotate About Center";this.isHighResSlice=262144<this.volume.header.imageDimensions.getNumVoxelsSlice();this.currentCoord=f;(b=a[this.volume.fileName])?(void 0!==b.interpolation&&(this.interpolation=b.interpolation),
  void 0!==b.dti&&((this.dti=b.dti)&&3!==this.volume.numTimepoints&&(this.error=Error("DTI vector series must have 3 series points!")),this.dti&&(this.dtiLines=b.dtiLines,this.dtiColors=b.dtiColors,this.dtiLines||this.dtiColors||(this.dtiColors=!0),this.initDTI())),void 0!==b.min&&void 0!==b.max?e?(this.screenMin=-1*Math.abs(b.min),this.screenMax=-1*Math.abs(b.max)):(this.screenMin=b.min,this.screenMax=b.max):this.findDisplayRange(e,b),e?void 0!==b.negative_lut&&(this.lutName=b.negative_lut,this.colorTable=
  new papaya.viewer.ColorTable(this.lutName,d)):void 0!==b.lut&&("string"===typeof b.lut||b.lut instanceof String?(this.lutName=b.lut,this.colorTable=new papaya.viewer.ColorTable(this.lutName,d)):(this.lutName="Object",this.colorTable=b.lut)),void 0===b.alpha||d||(this.alpha=b.alpha),d&&(void 0!==b.rotation&&b.rotation.length&&3===b.rotation.length&&(this.rotationX=(Math.min(Math.max(b.rotation[0],-90),90)+90)/180,this.rotationY=(Math.min(Math.max(b.rotation[1],-90),90)+90)/180,this.rotationZ=(Math.min(Math.max(b.rotation[2],
  -90),90)+90)/180),b.rotationPoint&&("origin"===b.rotationPoint.toLowerCase()?this.rotationAbout="Rotate About Origin":"crosshairs"===b.rotationPoint.toLowerCase()?this.rotationAbout="Rotate About Crosshairs":this.rotationAbout="Rotate About Center"),this.updateTransform())):this.findDisplayRange(e,{});this.negative=!1;this.updateScreenRange();this.canvasIcon=document.createElement("canvas");this.canvasIcon.width=papaya.viewer.ColorTable.ICON_SIZE;this.canvasIcon.height=papaya.viewer.ColorTable.ICON_SIZE;
  this.contextIcon=this.canvasIcon.getContext("2d");this.imageDataIcon=this.contextIcon.createImageData(papaya.viewer.ColorTable.ICON_SIZE,papaya.viewer.ColorTable.ICON_SIZE);this.icon=null;this.canvasBar=document.createElement("canvas");this.canvasBar.width=papaya.viewer.ColorTable.COLOR_BAR_WIDTH;this.canvasBar.height=papaya.viewer.ColorTable.COLOR_BAR_HEIGHT;this.contextBar=this.canvasBar.getContext("2d");this.imageDataBar=this.contextBar.createImageData(papaya.viewer.ColorTable.COLOR_BAR_WIDTH,
  papaya.viewer.ColorTable.COLOR_BAR_HEIGHT);this.colorBar=null;this.updateIcon();this.updateColorBar()};papaya.viewer.ScreenVolume.makeSolidIcon=function(b,a,c){var d=document.createElement("canvas");d.width=papaya.viewer.ColorTable.ICON_SIZE;d.height=papaya.viewer.ColorTable.ICON_SIZE;var e=d.getContext("2d");e.fillStyle="rgb("+parseInt(255*b,10)+","+parseInt(255*a,10)+","+parseInt(255*c,10)+")";e.fillRect(0,0,papaya.viewer.ColorTable.ICON_SIZE,papaya.viewer.ColorTable.ICON_SIZE);return d.toDataURL()};
  papaya.viewer.ScreenVolume.prototype.setScreenRange=function(b,a){this.screenMin=b;this.screenMax=a;this.updateScreenRange()};papaya.viewer.ScreenVolume.prototype.setScreenRangeNegatives=function(b,a){this.negativeScreenVol.setScreenRange(b,a)};papaya.viewer.ScreenVolume.prototype.updateScreenRange=function(){this.screenRatio=papaya.viewer.ScreenSlice.SCREEN_PIXEL_MAX/(this.screenMax-this.screenMin);this.negative=this.screenMax<this.screenMin};papaya.viewer.ScreenVolume.prototype.isOverlay=function(){return!this.colorTable.isBaseImage};
  papaya.viewer.ScreenVolume.prototype.findImageRange=function(){var b,a,c,d,e,f,h,g,m;if(this.volume.header.imageRange.imageMin===this.volume.header.imageRange.imageMax&&!this.hasCheckedImageRange){this.hasCheckedImageRange=!0;b=Number.MAX_VALUE;a=Number.MIN_VALUE;c=this.volume.header.imageDimensions.xDim;d=this.volume.header.imageDimensions.yDim;e=this.volume.header.imageDimensions.zDim;for(f=0;f<e;f+=1)for(h=0;h<d;h+=1)for(g=0;g<c;g+=1)m=this.volume.getVoxelAtIndexNative(g,h,f,0,!0),m>a&&(a=m),m<
  b&&(b=m);this.volume.header.imageRange.imageMin=this.imageMin=b;this.volume.header.imageRange.imageMax=this.imageMax=a}};
  papaya.viewer.ScreenVolume.prototype.findDisplayRange=function(b,a){var c,d,e,f;c=this.volume.header.imageRange.imageMin!==this.volume.header.imageRange.imageMax;d=this.screenMin;e=this.screenMax;b&&Math.abs(d)>Math.abs(e)&&(f=e,e=d,d=f);if(b||void 0===a.minPercent&&void 0===a.maxPercent)if(this.isOverlay()){if(d===e||0>d&&0<e||0<d&&0>e||b&&(0<d||0<e)||a.symmetric)this.findImageRange(),b?a.symmetric||0===this.imageMin?(d=-1*(this.imageMax-.75*this.imageMax),e=-1*(this.imageMax-.25*this.imageMax)):
  (d=this.imageMin-.75*this.imageMin,e=this.imageMin-.25*this.imageMin):(d=this.imageMax-.75*this.imageMax,e=this.imageMax-.25*this.imageMax);1>d&&-1<d&&1>e&&-1<e||(d=Math.round(d),e=Math.round(e))}else 1>d&&-1<d&&1>e&&-1<e||(d=Math.round(d),e=Math.round(e)),0===d&&0===e&&(this.findImageRange(),d=this.imageMin,e=this.imageMax),e<=d&&(this.findImageRange(),d=this.imageMin,e=this.imageMax),c&&d<this.imageMin&&(this.findImageRange(),d=this.imageMin),c&&e>this.imageMax&&(this.findImageRange(),e=this.imageMax);
  else this.findImageRange(),d=void 0!==a.minPercent?this.imageMax*a.minPercent:this.imageMin,e=void 0!==a.maxPercent?this.imageMax*a.maxPercent:this.imageMax;this.screenMin=d;this.screenMax=e};papaya.viewer.ScreenVolume.prototype.isUsingColorTable=function(b){return this.lutName===b};papaya.viewer.ScreenVolume.prototype.isRotatingAbout=function(b){return this.rotationAbout===b};
  papaya.viewer.ScreenVolume.prototype.changeColorTable=function(b,a){this.colorTable=new papaya.viewer.ColorTable(a,!this.isOverlay());this.lutName=a;this.updateIcon();this.updateColorBar();b.drawViewer(!0)};papaya.viewer.ScreenVolume.prototype.getRange=function(){var b=Array(2);b[0]=this.colorTable.minLUT/(255/(this.screenMax-this.screenMin))+this.screenMin;b[1]=this.colorTable.maxLUT/(255/(this.screenMax-this.screenMin))+this.screenMin;return b};
  papaya.viewer.ScreenVolume.prototype.getRangeNegative=function(){return this.negativeScreenVol.getRange()};papaya.viewer.ScreenVolume.prototype.getAlphaNegative=function(){return this.negativeScreenVol.alpha};papaya.viewer.ScreenVolume.prototype.incrementTimepoint=function(){var b=this.volume.numTimepoints;this.currentTimepoint+=1;this.currentTimepoint>=b&&(this.currentTimepoint=b-1)};
  papaya.viewer.ScreenVolume.prototype.decrementTimepoint=function(){--this.currentTimepoint;0>this.currentTimepoint&&(this.currentTimepoint=0)};papaya.viewer.ScreenVolume.prototype.setTimepoint=function(b){this.currentTimepoint=0>b?0:b>=this.volume.numTimepoints?this.volume.numTimepoints-1:b};papaya.viewer.ScreenVolume.prototype.updateMinLUT=function(b){this.colorTable.updateMinLUT(b)};papaya.viewer.ScreenVolume.prototype.updateMaxLUT=function(b){this.colorTable.updateMaxLUT(b)};
  papaya.viewer.ScreenVolume.prototype.updateLUT=function(b,a){this.colorTable.updateLUT(b,a)};papaya.viewer.ScreenVolume.prototype.supportsDynamicColorTable=function(){return void 0!==this.colorTable.updateMinLUT&&void 0!==this.colorTable.updateMaxLUT&&void 0!==this.colorTable.updateLUT};papaya.viewer.ScreenVolume.prototype.resetDynamicRange=function(){this.colorTable.minLUT=0;this.colorTable.maxLUT=papaya.viewer.ColorTable.LUT_MAX;this.updateLUT(this.colorTable.minLUT,this.colorTable.maxLUT);this.updateColorBar()};
  papaya.viewer.ScreenVolume.prototype.getCurrentTime=function(){return this.currentTimepoint*this.volume.header.voxelDimensions.timeSize*this.volume.header.voxelDimensions.getTemporalUnitMultiplier()};papaya.viewer.ScreenVolume.prototype.setCurrentTime=function(b){var a=this.volume.header.voxelDimensions.timeSize*this.volume.header.voxelDimensions.getTemporalUnitMultiplier();0===a?this.setTimepoint(0):this.setTimepoint(parseInt(Math.round(b/a),10))};
  papaya.viewer.ScreenVolume.prototype.hasError=function(){return null!==this.error};papaya.viewer.ScreenVolume.prototype.initDTI=function(){this.volume.numTimepoints=1;this.volume.header.imageDimensions.timepoints=1;this.colorTable=new papaya.viewer.ColorTable(this.lutName,!1,papaya.viewer.ColorTable.TABLE_DTI_SPECTRUM);this.volume.transform.voxelValue.forceABS=!this.dtiLines;this.updateIcon()};papaya.viewer.ScreenVolume.prototype.isDTILines=function(){return this.dtiLines&&!this.dtiColors};
  papaya.viewer.ScreenVolume.prototype.isDTIRGB=function(){return!this.dtiLines&&this.dtiColors};papaya.viewer.ScreenVolume.prototype.isDTILinesAndRGB=function(){return this.dtiLines&&this.dtiColors};papaya.viewer.ScreenVolume.prototype.getHiddenLabel=function(){return this.hidden?"Show Overlay":"Hide Overlay"};
  papaya.viewer.ScreenVolume.prototype.updateIcon=function(){var b,a,c,d,e;if(this.imageDataIcon){b=papaya.viewer.ColorTable.LUT_MAX/papaya.viewer.ColorTable.ICON_SIZE;for(a=0;a<papaya.viewer.ColorTable.ICON_SIZE;a+=1)for(c=0;c<papaya.viewer.ColorTable.ICON_SIZE;c+=1)d=4*(a*papaya.viewer.ColorTable.ICON_SIZE+c),e=Math.round(c*b),this.imageDataIcon.data[d]=this.colorTable.lookupRed(e),this.imageDataIcon.data[d+1]=this.colorTable.lookupGreen(e),this.imageDataIcon.data[d+2]=this.colorTable.lookupBlue(e),
  this.imageDataIcon.data[d+3]=255;this.contextIcon.putImageData(this.imageDataIcon,0,0);this.icon=this.canvasIcon.toDataURL()}};
  papaya.viewer.ScreenVolume.prototype.updateColorBar=function(){var b,a,c,d,e;if(this.imageDataBar){b=papaya.viewer.ColorTable.LUT_MAX/papaya.viewer.ColorTable.COLOR_BAR_WIDTH;for(a=0;a<papaya.viewer.ColorTable.COLOR_BAR_HEIGHT;a+=1)for(c=0;c<papaya.viewer.ColorTable.COLOR_BAR_WIDTH;c+=1)d=4*(a*papaya.viewer.ColorTable.COLOR_BAR_WIDTH+c),e=Math.round(c*b),this.imageDataBar.data[d]=this.colorTable.lookupRed(e),this.imageDataBar.data[d+1]=this.colorTable.lookupGreen(e),this.imageDataBar.data[d+2]=this.colorTable.lookupBlue(e),
  this.imageDataBar.data[d+3]=255;this.contextBar.putImageData(this.imageDataBar,0,0);this.colorBar=this.canvasBar.toDataURL()}};
  papaya.viewer.ScreenVolume.prototype.updateTransform=function(){var b=180*(this.rotationX-.5),a=180*(this.rotationY-.5),c=180*(this.rotationZ-.5),d,e,f;"Rotate About Origin"===this.rotationAbout?(d=this.volume.header.origin.x*this.volume.header.voxelDimensions.xSize,e=this.volume.header.origin.y*this.volume.header.voxelDimensions.ySize,f=this.volume.header.origin.z*this.volume.header.voxelDimensions.zSize):"Rotate About Crosshairs"===this.rotationAbout?(d=this.currentCoord.x*this.volume.header.voxelDimensions.xSize,
  e=this.currentCoord.y*this.volume.header.voxelDimensions.ySize,f=this.currentCoord.z*this.volume.header.voxelDimensions.zSize):(d=this.volume.header.imageDimensions.xDim/2*this.volume.header.voxelDimensions.xSize,e=this.volume.header.imageDimensions.yDim/2*this.volume.header.voxelDimensions.ySize,f=this.volume.header.imageDimensions.zDim/2*this.volume.header.voxelDimensions.zSize);this.volume.transform.updateImageMat(d,e,f,b,a,c)};
  papaya.viewer.ScreenVolume.prototype.resetTransform=function(){this.rotationZ=this.rotationY=this.rotationX=.5};"use strict";papaya=papaya||{};papaya.viewer=papaya.viewer||{};var PAPAYA_BUILD_NUM=PAPAYA_BUILD_NUM||"0";
  papaya.viewer.Viewer=papaya.viewer.Viewer||function(b,a,c,d){this.container=b;this.canvas=document.createElement("canvas");this.canvas.width=a;this.canvas.height=c;this.context=this.canvas.getContext("2d");this.canvas.style.padding=0;this.canvas.style.margin=0;this.canvas.style.border="none";this.atlas=null;this.pageLoaded=this.initialized=!1;this.loadingVolume=null;this.volume=new papaya.volume.Volume(this.container.display,this);this.screenVolumes=[];this.surfaces=[];this.lowerImageTop=this.lowerImageBot=
  this.lowerImageBot2=this.mainImage=this.selectedSlice=this.surfaceView=this.sagittalSlice=this.coronalSlice=this.axialSlice=this.currentScreenVolume=null;this.viewerDim=0;this.worldSpace=!1;this.currentCoord=new papaya.core.Coordinate(0,0,0);this.cursorPosition=new papaya.core.Coordinate(0,0,0);this.draggingSliceDir=this.longestDimSize=this.longestDim=0;this.isLongTouch=this.didLongTouch=this.isPanning=this.isContextMode=this.isZoomMode=this.isWindowControl=this.isDragging=!1;this.zoomFactorPrevious=
  this.zoomFactor=papaya.viewer.Viewer.ZOOM_FACTOR_MIN;this.panAmountZ=this.panAmountY=this.panAmountX=this.panLocZ=this.panLocY=this.panLocX=this.zoomLocZ=this.zoomLocY=this.zoomLocX=0;this.keyPressIgnored=!1;this.previousMousePosition=new papaya.core.Point;this.isShiftKeyDown=this.isAltKeyDown=this.isControlKeyDown=!1;this.toggleMainCrosshairs=!0;this.bgColor=null;this.loadingDTI=this.controlsHidden=this.hasSeries=!1;this.loadingDTIModRef=null;this.tempCoor=new papaya.core.Coordinate;this.listenerContextMenu=
  function(a){a.preventDefault();return!1};this.listenerMouseMove=papaya.utilities.ObjectUtils.bind(this,this.mouseMoveEvent);this.listenerMouseDown=papaya.utilities.ObjectUtils.bind(this,this.mouseDownEvent);this.listenerMouseOut=papaya.utilities.ObjectUtils.bind(this,this.mouseOutEvent);this.listenerMouseLeave=papaya.utilities.ObjectUtils.bind(this,this.mouseLeaveEvent);this.listenerMouseUp=papaya.utilities.ObjectUtils.bind(this,this.mouseUpEvent);this.listenerMouseDoubleClick=papaya.utilities.ObjectUtils.bind(this,
  this.mouseDoubleClickEvent);this.listenerKeyDown=papaya.utilities.ObjectUtils.bind(this,this.keyDownEvent);this.listenerKeyUp=papaya.utilities.ObjectUtils.bind(this,this.keyUpEvent);this.listenerTouchMove=papaya.utilities.ObjectUtils.bind(this,this.touchMoveEvent);this.listenerTouchStart=papaya.utilities.ObjectUtils.bind(this,this.touchStartEvent);this.listenerTouchEnd=papaya.utilities.ObjectUtils.bind(this,this.touchEndEvent);this.initialCoordinate=null;this.listenerScroll=papaya.utilities.ObjectUtils.bind(this,
  this.scrolled);this.updateTimerEvent=this.updateTimer=this.longTouchTimer=null;this.drawEmptyViewer();this.processParams(d)};papaya.viewer.Viewer.GAP=PAPAYA_SPACING;papaya.viewer.Viewer.BACKGROUND_COLOR="rgba(0, 0, 0, 255)";papaya.viewer.Viewer.CROSSHAIRS_COLOR="rgba(28, 134, 238, 255)";papaya.viewer.Viewer.KEYCODE_ROTATE_VIEWS=32;papaya.viewer.Viewer.KEYCODE_CENTER=67;papaya.viewer.Viewer.KEYCODE_ORIGIN=79;papaya.viewer.Viewer.KEYCODE_ARROW_UP=38;papaya.viewer.Viewer.KEYCODE_ARROW_DOWN=40;
  papaya.viewer.Viewer.KEYCODE_ARROW_RIGHT=39;papaya.viewer.Viewer.KEYCODE_ARROW_LEFT=37;papaya.viewer.Viewer.KEYCODE_PAGE_UP=33;papaya.viewer.Viewer.KEYCODE_PAGE_DOWN=34;papaya.viewer.Viewer.KEYCODE_SINGLE_QUOTE=222;papaya.viewer.Viewer.KEYCODE_FORWARD_SLASH=191;papaya.viewer.Viewer.KEYCODE_INCREMENT_MAIN=71;papaya.viewer.Viewer.KEYCODE_DECREMENT_MAIN=86;papaya.viewer.Viewer.KEYCODE_TOGGLE_CROSSHAIRS=65;papaya.viewer.Viewer.KEYCODE_SERIES_BACK=188;papaya.viewer.Viewer.KEYCODE_SERIES_FORWARD=190;
  papaya.viewer.Viewer.KEYCODE_RULER=82;papaya.viewer.Viewer.MAX_OVERLAYS=8;papaya.viewer.Viewer.ORIENTATION_MARKER_SUPERIOR="S";papaya.viewer.Viewer.ORIENTATION_MARKER_INFERIOR="I";papaya.viewer.Viewer.ORIENTATION_MARKER_ANTERIOR="A";papaya.viewer.Viewer.ORIENTATION_MARKER_POSTERIOR="P";papaya.viewer.Viewer.ORIENTATION_MARKER_LEFT="L";papaya.viewer.Viewer.ORIENTATION_MARKER_RIGHT="R";papaya.viewer.Viewer.ORIENTATION_MARKER_SIZE=16;papaya.viewer.Viewer.ORIENTATION_CERTAINTY_UNKNOWN_COLOR="red";
  papaya.viewer.Viewer.ORIENTATION_CERTAINTY_LOW_COLOR="yellow";papaya.viewer.Viewer.ORIENTATION_CERTAINTY_HIGH_COLOR="white";papaya.viewer.Viewer.UPDATE_TIMER_INTERVAL=250;papaya.viewer.Viewer.ZOOM_FACTOR_MAX=10;papaya.viewer.Viewer.ZOOM_FACTOR_MIN=1;papaya.viewer.Viewer.MOUSE_SCROLL_THRESHLD=.25;papaya.viewer.Viewer.TITLE_MAX_LENGTH=30;papaya.viewer.Viewer.validDimBounds=function(b,a){return b<a?b:a-1};papaya.viewer.Viewer.getKeyCode=function(b){return b.keyCode||b.charCode};
  papaya.viewer.Viewer.isControlKey=function(b){b=papaya.viewer.Viewer.getKeyCode(b);return"MacOS"!==papaya.utilities.PlatformUtils.os||91!==b&&93!==b&&224!==b?"MacOS"!==papaya.utilities.PlatformUtils.os&&17===b:!0};papaya.viewer.Viewer.isAltKey=function(b){return 18===papaya.viewer.Viewer.getKeyCode(b)};papaya.viewer.Viewer.isShiftKey=function(b){b=!!b.shiftKey;!b&&window.event&&(b=!!window.event.shiftKey);return b};
  papaya.viewer.Viewer.getOffsetRect=function(b){b=b.getBoundingClientRect();var a=document.body,c=document.documentElement,d=b.left+(window.pageXOffset||c.scrollLeft)-(c.clientLeft||a.clientLeft||0);return{top:Math.round(b.top+(window.pageYOffset||c.scrollTop)-(c.clientTop||a.clientTop||0)),left:Math.round(d)}};
  papaya.viewer.Viewer.drawRoundRect=function(b,a,c,d,e,f,h,g){"undefined"===typeof g&&(g=!0);"undefined"===typeof f&&(f=5);b.beginPath();b.moveTo(a+f,c);b.lineTo(a+d-f,c);b.quadraticCurveTo(a+d,c,a+d,c+f);b.lineTo(a+d,c+e-f);b.quadraticCurveTo(a+d,c+e,a+d-f,c+e);b.lineTo(a+f,c+e);b.quadraticCurveTo(a,c+e,a,c+e-f);b.lineTo(a,c+f);b.quadraticCurveTo(a,c,a+f,c);b.closePath();g&&b.stroke();h&&b.fill()};
  papaya.viewer.Viewer.prototype.loadImage=function(b,a,c,d){0===this.screenVolumes.length?this.loadBaseImage(b,a,c,d):this.loadOverlay(b,a,c,d)};papaya.viewer.Viewer.prototype.showDialog=function(b,a,c,d,e){var f,h=-1;for(f=0;f<papayaContainers.length;f+=1)if(papayaContainers[f]===this.container){h=f;break}(new papaya.ui.Dialog(this.container,b,a,c,d,e,h)).showDialog()};
  papaya.viewer.Viewer.prototype.loadBaseImage=function(b,a,c,d){var e=[],f=this.container.findLoadableImages(b);this.volume=new papaya.volume.Volume(this.container.display,this,this.container.params);if(d){if(f)for(b=0;b<f.length;b+=1)e.push(f[b].encode);this.volume.readBinaryData(e,papaya.utilities.ObjectUtils.bind(this,this.initializeViewer))}else if(c){if(f)for(b=0;b<f.length;b+=1)e.push(f[b].encode);this.volume.readEncodedData(e,papaya.utilities.ObjectUtils.bind(this,this.initializeViewer))}else if(null!==
  f&&void 0!==f[0].encode){for(b=0;b<f.length;b+=1)e.push(f[b].encode);this.volume.readEncodedData(e,papaya.utilities.ObjectUtils.bind(this,this.initializeViewer))}else if(a)this.volume.readURLs(b,papaya.utilities.ObjectUtils.bind(this,this.initializeViewer));else if(null!==f&&void 0!==f[0].url){if(f)for(b=0;b<f.length;b+=1)e.push(f[b].url);this.volume.readURLs(e,papaya.utilities.ObjectUtils.bind(this,this.initializeViewer))}else this.volume.readFiles(b,papaya.utilities.ObjectUtils.bind(this,this.initializeViewer))};
  papaya.viewer.Viewer.prototype.loadOverlay=function(b,a,c,d){var e,f=this.container.findLoadableImage(b);this.loadingVolume=new papaya.volume.Volume(this.container.display,this,this.container.params);this.screenVolumes.length>papaya.viewer.Viewer.MAX_OVERLAYS?(this.loadingVolume.error=Error("Maximum number of overlays ("+papaya.viewer.Viewer.MAX_OVERLAYS+") has been reached!"),this.initializeOverlay()):d?this.loadingVolume.readBinaryData(e,papaya.utilities.ObjectUtils.bind(this,this.initializeOverlay)):
  c?(e=f.encode,e instanceof Array||(e=[],e[0]=f.encode),this.loadingVolume.readEncodedData(e,papaya.utilities.ObjectUtils.bind(this,this.initializeOverlay))):null!==f&&void 0!==f.encode?(e=f.encode,e instanceof Array||(e=[],e[0]=f.encode),this.loadingVolume.readEncodedData(e,papaya.utilities.ObjectUtils.bind(this,this.initializeOverlay))):a?this.loadingVolume.readURLs(b,papaya.utilities.ObjectUtils.bind(this,this.initializeOverlay)):null!==f&&void 0!==f.url?this.loadingVolume.readURLs([f.url],papaya.utilities.ObjectUtils.bind(this,
  this.initializeOverlay)):this.loadingVolume.readFiles(b,papaya.utilities.ObjectUtils.bind(this,this.initializeOverlay))};
  papaya.viewer.Viewer.prototype.loadSurface=function(b,a,c){var d=this.container.findLoadableImage(b,!0);if(0==this.screenVolumes.length)this.container.display.drawError("Load an image before loading a surface!");else{var e=new papaya.surface.Surface(this.container.display,this.container.params);c?e.readEncodedData(b[0],this.volume,papaya.utilities.ObjectUtils.bind(this,this.initializeSurface)):null!==d&&void 0!==d.encode?e.readEncodedData(d.encode,this.volume,papaya.utilities.ObjectUtils.bind(this,
  this.initializeSurface)):a?e.readURL(b,this.volume,papaya.utilities.ObjectUtils.bind(this,this.initializeSurface)):null!==d&&void 0!==d.url?e.readURL(d.url,this.volume,papaya.utilities.ObjectUtils.bind(this,this.initializeSurface)):e.readFile(b[0],this.volume,papaya.utilities.ObjectUtils.bind(this,this.initializeSurface))}};
  papaya.viewer.Viewer.prototype.initializeSurface=function(b){var a=b;if(b.error)b.error&&this.container.display.drawError(b.error);else{for(;null!==a;)this.surfaces.push(a),a=a.nextSurface;if(null===this.surfaceView)this.lowerImageBot2=this.surfaceView=new papaya.viewer.ScreenSurface(this.volume,this.surfaces,this,this.container.params),this.container.resizeViewerComponents(!0);else for(a=b;null!==a;)this.surfaceView.initBuffers(this.surfaceView.context,a),a=a.nextSurface;this.container.params.mainView&&
  "surface"===this.container.params.mainView.toLowerCase()&&(this.mainImage=this.surfaceView,this.lowerImageTop=this.axialSlice,this.lowerImageBot=this.sagittalSlice,this.lowerImageBot2=this.coronalSlice,this.viewsChanged());this.container.toolbar.buildToolbar();this.container.toolbar.updateImageButtons();this.container.hasMoreToLoad()?this.container.loadNext():this.finishedLoading()}};papaya.viewer.Viewer.prototype.atlasLoaded=function(){this.finishedLoading()};
  papaya.viewer.Viewer.prototype.initializeViewer=function(){var b,a;a=this;if(this.volume.hasError())b=this.volume.error.message,this.resetViewer(),this.container.clearParams(),this.container.display.drawError(b);else if(this.screenVolumes[0]=new papaya.viewer.ScreenVolume(this.volume,this.container.params,papaya.viewer.ColorTable.DEFAULT_COLOR_TABLE.name,!0,!1,this.currentCoord),this.loadingDTI&&(this.loadingDTI=!1,this.screenVolumes[0].dti=!0,this.screenVolumes[0].dti&&3!==this.screenVolumes[0].volume.numTimepoints&&
  (this.screenVolumes[0].error=Error("DTI vector series must have 3 series points!")),this.screenVolumes[0].dti&&this.screenVolumes[0].initDTI()),this.screenVolumes[0].hasError())b=this.screenVolumes[0].error.message,this.resetViewer(),this.container.clearParams(),this.container.display.drawError(b);else{this.setCurrentScreenVol(0);this.axialSlice=new papaya.viewer.ScreenSlice(this.volume,papaya.viewer.ScreenSlice.DIRECTION_AXIAL,this.volume.getXDim(),this.volume.getYDim(),this.volume.getXSize(),this.volume.getYSize(),
  this.screenVolumes,this);this.coronalSlice=new papaya.viewer.ScreenSlice(this.volume,papaya.viewer.ScreenSlice.DIRECTION_CORONAL,this.volume.getXDim(),this.volume.getZDim(),this.volume.getXSize(),this.volume.getZSize(),this.screenVolumes,this);this.sagittalSlice=new papaya.viewer.ScreenSlice(this.volume,papaya.viewer.ScreenSlice.DIRECTION_SAGITTAL,this.volume.getYDim(),this.volume.getZDim(),this.volume.getYSize(),this.volume.getZSize(),this.screenVolumes,this);void 0===this.container.params.mainView||
  "axial"===this.container.params.mainView.toLowerCase()?(this.mainImage=this.axialSlice,this.lowerImageTop=this.sagittalSlice,this.lowerImageBot=this.coronalSlice):"coronal"===this.container.params.mainView.toLowerCase()?(this.mainImage=this.coronalSlice,this.lowerImageTop=this.axialSlice,this.lowerImageBot=this.sagittalSlice):"sagittal"===this.container.params.mainView.toLowerCase()?(this.mainImage=this.sagittalSlice,this.lowerImageTop=this.coronalSlice,this.lowerImageBot=this.axialSlice):(this.mainImage=
  this.axialSlice,this.lowerImageTop=this.sagittalSlice,this.lowerImageBot=this.coronalSlice);this.canvas.addEventListener("mousemove",this.listenerMouseMove,!1);this.canvas.addEventListener("mousedown",this.listenerMouseDown,!1);this.canvas.addEventListener("mouseout",this.listenerMouseOut,!1);this.canvas.addEventListener("mouseleave",this.listenerMouseLeave,!1);this.canvas.addEventListener("mouseup",this.listenerMouseUp,!1);document.addEventListener("keydown",this.listenerKeyDown,!0);document.addEventListener("keyup",
  this.listenerKeyUp,!0);this.canvas.addEventListener("touchmove",this.listenerTouchMove,!1);this.canvas.addEventListener("touchstart",this.listenerTouchStart,!1);this.canvas.addEventListener("touchend",this.listenerTouchEnd,!1);this.canvas.addEventListener("dblclick",this.listenerMouseDoubleClick,!1);document.addEventListener("contextmenu",this.listenerContextMenu,!1);this.container.showControlBar?($(this.container.sliderControlHtml.find("."+PAPAYA_CONTROL_MAIN_SLIDER).find("button")).eq(0).click(function(){a.mainImage.sliceDirection===
  papaya.viewer.ScreenSlice.DIRECTION_AXIAL?a.incrementAxial(!1):a.mainImage.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_CORONAL?a.incrementCoronal(!1):a.mainImage.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_SAGITTAL&&a.incrementSagittal(!0)}),$(this.container.sliderControlHtml.find("."+PAPAYA_CONTROL_MAIN_SLIDER).find("button")).eq(1).click(function(){a.mainImage.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_AXIAL?a.incrementAxial(!0):a.mainImage.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_CORONAL?
  a.incrementCoronal(!0):a.mainImage.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_SAGITTAL&&a.incrementSagittal(!1)}),$(this.container.sliderControlHtml.find("."+PAPAYA_CONTROL_DIRECTION_SLIDER).eq(0).find("button").eq(0)).click(function(){a.incrementAxial(!1)}),$(this.container.sliderControlHtml.find("."+PAPAYA_CONTROL_DIRECTION_SLIDER).eq(0).find("button").eq(1)).click(function(){a.incrementAxial(!0)}),$(this.container.sliderControlHtml.find("."+PAPAYA_CONTROL_DIRECTION_SLIDER).eq(1).find("button").eq(0)).click(function(){a.incrementCoronal(!1)}),
  $(this.container.sliderControlHtml.find("."+PAPAYA_CONTROL_DIRECTION_SLIDER).eq(1).find("button").eq(1)).click(function(){a.incrementCoronal(!0)}),$(this.container.sliderControlHtml.find("."+PAPAYA_CONTROL_DIRECTION_SLIDER).eq(2).find("button").eq(0)).click(function(){a.incrementSagittal(!0)}),$(this.container.sliderControlHtml.find("."+PAPAYA_CONTROL_DIRECTION_SLIDER).eq(2).find("button").eq(1)).click(function(){a.incrementSagittal(!1)}),$(this.container.sliderControlHtml.find("."+PAPAYA_CONTROL_DIRECTION_SLIDER).eq(3).find("button").eq(0)).click(function(){a.decrementSeriesPoint()}),
  $(this.container.sliderControlHtml.find("."+PAPAYA_CONTROL_DIRECTION_SLIDER).eq(3).find("button").eq(1)).click(function(){a.incrementSeriesPoint()}),$(this.container.sliderControlHtml.find("."+PAPAYA_CONTROL_SWAP_BUTTON_CSS)).click(function(){a.rotateViews()}),$(this.container.sliderControlHtml.find("."+PAPAYA_CONTROL_GOTO_CENTER_BUTTON_CSS)).click(function(){var b=new papaya.core.Coordinate(Math.floor(a.volume.header.imageDimensions.xDim/2),Math.floor(a.volume.header.imageDimensions.yDim/2),Math.floor(a.volume.header.imageDimensions.zDim/
  2));a.gotoCoordinate(b)}),$(this.container.sliderControlHtml.find("."+PAPAYA_CONTROL_GOTO_ORIGIN_BUTTON_CSS)).click(function(){a.gotoCoordinate(a.volume.header.origin)}),$("."+PAPAYA_CONTROL_INCREMENT_BUTTON_CSS).prop("disabled",!1),$("."+PAPAYA_CONTROL_SWAP_BUTTON_CSS).prop("disabled",!1),$("."+PAPAYA_CONTROL_GOTO_CENTER_BUTTON_CSS).prop("disabled",!1),$("."+PAPAYA_CONTROL_GOTO_ORIGIN_BUTTON_CSS).prop("disabled",!1)):this.container.showControls&&($("#"+PAPAYA_CONTROL_MAIN_INCREMENT_BUTTON_CSS+this.container.containerIndex).css({display:"inline"}),
  $("#"+PAPAYA_CONTROL_MAIN_DECREMENT_BUTTON_CSS+this.container.containerIndex).css({display:"inline"}),$("#"+PAPAYA_CONTROL_MAIN_SWAP_BUTTON_CSS+this.container.containerIndex).css({display:"inline"}),$(this.container.containerHtml.find("#"+PAPAYA_CONTROL_MAIN_SWAP_BUTTON_CSS+this.container.containerIndex)).click(function(){a.rotateViews()}),$(this.container.containerHtml.find("#"+PAPAYA_CONTROL_MAIN_INCREMENT_BUTTON_CSS+this.container.containerIndex)).click(function(){a.mainImage.sliceDirection===
  papaya.viewer.ScreenSlice.DIRECTION_AXIAL?a.incrementAxial(!1):a.mainImage.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_CORONAL?a.incrementCoronal(!1):a.mainImage.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_SAGITTAL&&a.incrementSagittal(!0)}),$(this.container.containerHtml.find("#"+PAPAYA_CONTROL_MAIN_DECREMENT_BUTTON_CSS+this.container.containerIndex)).click(function(){a.mainImage.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_AXIAL?a.incrementAxial(!0):a.mainImage.sliceDirection===
  papaya.viewer.ScreenSlice.DIRECTION_CORONAL?a.incrementCoronal(!0):a.mainImage.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_SAGITTAL&&a.incrementSagittal(!1)}),$(this.container.containerHtml.find("#"+PAPAYA_CONTROL_MAIN_GOTO_CENTER_BUTTON_CSS+this.container.containerIndex)).click(function(){var b=new papaya.core.Coordinate(Math.floor(a.volume.header.imageDimensions.xDim/2),Math.floor(a.volume.header.imageDimensions.yDim/2),Math.floor(a.volume.header.imageDimensions.zDim/2));a.gotoCoordinate(b)}),
  $(this.container.containerHtml.find("#"+PAPAYA_CONTROL_MAIN_GOTO_ORIGIN_BUTTON_CSS+this.container.containerIndex)).click(function(){a.gotoCoordinate(a.volume.header.origin)}));this.hasSeries=1<this.volume.header.imageDimensions.timepoints;this.container.allowScroll&&this.addScroll();this.setLongestDim(this.volume);this.calculateScreenSliceTransforms(this);this.currentCoord.setCoordinate(papayaFloorFast(this.volume.getXDim()/2),papayaFloorFast(this.volume.getYDim()/2),papayaFloorFast(this.volume.getZDim()/
  2));this.updateOffsetRect();this.bgColor=$("body").css("background-color");if("rgba(0, 0, 0, 0)"===this.bgColor||"transparent"===this.bgColor)this.bgColor="rgba(255, 255, 255, 255)";this.context.fillStyle=this.bgColor;this.context.fillRect(0,0,this.canvas.offsetWidth,this.canvas.offsetHeight);this.volume.isWorldSpaceOnly()&&(this.worldSpace=!0);this.initialized=!0;this.container.resizeViewerComponents(!0);this.drawViewer();this.container.toolbar.buildToolbar();this.container.toolbar.updateImageButtons();
  this.updateWindowTitle();this.container.loadingImageIndex=1;this.container.hasMoreToLoad()?this.container.loadNext():this.finishedLoading()}};papaya.viewer.Viewer.prototype.finishedLoading=function(){this.pageLoaded||(this.goToInitialCoordinate(),this.updateSliceSliderControl(),this.pageLoaded=!0);this.container.loadingComplete&&(this.container.loadingComplete(),this.container.loadingComplete=null);this.container.toolbar.buildToolbar();this.container.toolbar.updateImageButtons();this.updateWindowTitle()};
  papaya.viewer.Viewer.prototype.addScroll=function(){window.addEventListener(papaya.utilities.PlatformUtils.getSupportedScrollEvent(),this.listenerScroll,!1)};papaya.viewer.Viewer.prototype.removeScroll=function(){window.removeEventListener(papaya.utilities.PlatformUtils.getSupportedScrollEvent(),this.listenerScroll,!1)};papaya.viewer.Viewer.prototype.updateOffsetRect=function(){this.canvasRect=papaya.viewer.Viewer.getOffsetRect(this.canvas)};
  papaya.viewer.Viewer.prototype.initializeOverlay=function(){var b,a,c;if(this.loadingVolume.hasError())this.container.display.drawError(this.loadingVolume.error.message),this.container.clearParams(),this.loadingVolume=null;else{a=(b=this.container.params[this.loadingVolume.fileName])&&b.parametric;c=b&&b.dtiMod;if(this.loadingDTIModRef)this.loadingDTIModRef.dtiVolumeMod=this.loadingVolume,this.loadingDTIModRef=null;else if(c){if(a=this.getScreenVolumeByName(b.dtiRef))a.dtiVolumeMod=this.loadingVolume,
  a.dtiAlphaFactor=void 0!==b.dtiModAlphaFactor?b.dtiModAlphaFactor:1}else{b=new papaya.viewer.ScreenVolume(this.loadingVolume,this.container.params,a?papaya.viewer.ColorTable.PARAMETRIC_COLOR_TABLES[0].name:this.getNextColorTable(),!1,!1,this.currentCoord);this.loadingDTI&&(this.loadingDTI=!1,b.dti=!0,b.dti&&3!==b.volume.numTimepoints&&(b.error=Error("DTI vector series must have 3 series points!")),b.dti&&b.initDTI());if(b.hasError()){this.container.display.drawError(b.error.message);this.container.clearParams();
  this.loadingVolume=null;return}this.screenVolumes[this.screenVolumes.length]=b;this.setCurrentScreenVol(this.screenVolumes.length-1);a&&(this.screenVolumes[this.screenVolumes.length-1].findImageRange(),0>this.screenVolumes[this.screenVolumes.length-1].volume.header.imageRange.imageMin&&(this.screenVolumes[this.screenVolumes.length]=a=new papaya.viewer.ScreenVolume(this.loadingVolume,this.container.params,papaya.viewer.ColorTable.PARAMETRIC_COLOR_TABLES[1].name,!1,!0,this.currentCoord),b.negativeScreenVol=
  a,this.setCurrentScreenVol(this.screenVolumes.length-1)))}this.container.toolbar.buildToolbar();this.container.toolbar.updateImageButtons();this.drawViewer(!0);this.hasSeries=!1;for(b=0;b<this.screenVolumes.length;b+=1)if(1<this.screenVolumes[b].volume.header.imageDimensions.timepoints){this.hasSeries=!0;break}this.container.resizeViewerComponents();this.updateWindowTitle();this.loadingVolume=null;this.container.hasMoreToLoad()?this.container.loadNext():this.finishedLoading()}};
  papaya.viewer.Viewer.prototype.closeOverlayByRef=function(b){this.closeOverlay(this.getScreenVolumeIndex(b))};
  papaya.viewer.Viewer.prototype.closeOverlay=function(b){var a;for(a=0;a<this.screenVolumes.length;a+=1)this.screenVolumes[a].negativeScreenVol===this.screenVolumes[b]&&(this.screenVolumes[a].negativeScreenVol=null);this.screenVolumes.splice(b,1);this.setCurrentScreenVol(this.screenVolumes.length-1);this.drawViewer(!0);this.container.toolbar.buildToolbar();this.container.toolbar.updateImageButtons();this.updateWindowTitle();this.hasSeries=!1;for(a=0;a<this.screenVolumes.length;a+=1)if(1<this.screenVolumes[a].volume.header.imageDimensions.timepoints){this.hasSeries=
  !0;break}this.container.resizeViewerComponents()};papaya.viewer.Viewer.prototype.hasDefinedAtlas=function(){var b;return"undefined"!==typeof papaya.data&&(b=typeof papaya.data.Atlas,"undefined"!==b)?!0:!1};papaya.viewer.Viewer.prototype.loadAtlas=function(){null===this.atlas&&(this.atlas=new papaya.viewer.Atlas(papaya.data.Atlas,this.container,papaya.utilities.ObjectUtils.bind(this,this.atlasLoaded)))};
  papaya.viewer.Viewer.prototype.isInsideMainSlice=function(b,a){this.updateOffsetRect();b-=this.canvasRect.left;a-=this.canvasRect.top;return this.mainImage===this.axialSlice?this.insideScreenSlice(this.axialSlice,b,a,this.volume.getXDim(),this.volume.getYDim()):this.mainImage===this.coronalSlice?this.insideScreenSlice(this.coronalSlice,b,a,this.volume.getXDim(),this.volume.getZDim()):this.mainImage===this.sagittalSlice?this.insideScreenSlice(this.sagittalSlice,b,a,this.volume.getYDim(),this.volume.getZDim()):
  !1};
  papaya.viewer.Viewer.prototype.updatePosition=function(b,a,c,d){var e,f;b.updateOffsetRect();e=a;f=c;a-=this.canvasRect.left;c-=this.canvasRect.top;if(this.insideScreenSlice(b.axialSlice,a,c,b.volume.getXDim(),b.volume.getYDim())){if(!this.isDragging||this.draggingSliceDir===papaya.viewer.ScreenSlice.DIRECTION_AXIAL)if(a=this.convertScreenToImageCoordinateX(a,b.axialSlice),c=this.convertScreenToImageCoordinateY(c,b.axialSlice),a!==b.currentCoord.x||c!==b.currentCoord.y)b.currentCoord.x=a,b.currentCoord.y=c,
  this.draggingSliceDir=papaya.viewer.ScreenSlice.DIRECTION_AXIAL}else if(this.insideScreenSlice(b.coronalSlice,a,c,b.volume.getXDim(),b.volume.getZDim())){if(!this.isDragging||this.draggingSliceDir===papaya.viewer.ScreenSlice.DIRECTION_CORONAL)if(a=this.convertScreenToImageCoordinateX(a,b.coronalSlice),c=this.convertScreenToImageCoordinateY(c,b.coronalSlice),a!==b.currentCoord.x||c!==b.currentCoord.y)b.currentCoord.x=a,b.currentCoord.z=c,this.draggingSliceDir=papaya.viewer.ScreenSlice.DIRECTION_CORONAL}else if(this.insideScreenSlice(b.sagittalSlice,
  a,c,b.volume.getYDim(),b.volume.getZDim())){if(!this.isDragging||this.draggingSliceDir===papaya.viewer.ScreenSlice.DIRECTION_SAGITTAL)if(a=this.convertScreenToImageCoordinateX(a,b.sagittalSlice),c=this.convertScreenToImageCoordinateY(c,b.sagittalSlice),a!==b.currentCoord.x||c!==b.currentCoord.y)b.currentCoord.y=a,b.currentCoord.z=c,this.draggingSliceDir=papaya.viewer.ScreenSlice.DIRECTION_SAGITTAL}else b.surfaceView&&this.insideScreenSlice(b.surfaceView,a,c,b.surfaceView.screenDim,b.surfaceView.screenDim)&&
  b.surfaceView.updateDynamic(e,f,this.selectedSlice===this.mainImage?1:3);this.container.coordinateChanged(this);b.drawViewer(!1,d)};papaya.viewer.Viewer.prototype.convertScreenToImageCoordinateX=function(b,a){return papaya.viewer.Viewer.validDimBounds(papayaFloorFast((b-a.finalTransform[0][2])/a.finalTransform[0][0]),a.xDim)};
  papaya.viewer.Viewer.prototype.convertScreenToImageCoordinateY=function(b,a){return papaya.viewer.Viewer.validDimBounds(papayaFloorFast((b-a.finalTransform[1][2])/a.finalTransform[1][1]),a.yDim)};
  papaya.viewer.Viewer.prototype.convertScreenToImageCoordinate=function(b,a,c){var d,e,f;void 0===c&&(c=this.mainImage);c.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_AXIAL?(d=this.convertScreenToImageCoordinateX(b,c),e=this.convertScreenToImageCoordinateY(a,c),f=this.axialSlice.currentSlice):c.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_CORONAL?(d=this.convertScreenToImageCoordinateX(b,c),f=this.convertScreenToImageCoordinateY(a,c),e=this.coronalSlice.currentSlice):c.sliceDirection===
  papaya.viewer.ScreenSlice.DIRECTION_SAGITTAL&&(e=this.convertScreenToImageCoordinateX(b,c),f=this.convertScreenToImageCoordinateY(a,c),d=this.sagittalSlice.currentSlice);return new papaya.core.Coordinate(d,e,f)};papaya.viewer.Viewer.prototype.convertCurrentCoordinateToScreen=function(b){return this.convertCoordinateToScreen(this.currentCoord,b)};
  papaya.viewer.Viewer.prototype.intersectsMainSlice=function(b){var a=this.mainImage.sliceDirection;return a===papaya.viewer.ScreenSlice.DIRECTION_AXIAL?b.z===this.mainImage.currentSlice:a===papaya.viewer.ScreenSlice.DIRECTION_CORONAL?b.y===this.mainImage.currentSlice:a===papaya.viewer.ScreenSlice.DIRECTION_SAGITTAL?b.x===this.mainImage.currentSlice:!1};
  papaya.viewer.Viewer.prototype.convertCoordinateToScreen=function(b,a){var c,d,e;void 0===a&&(a=this.mainImage);e=a.sliceDirection;e===papaya.viewer.ScreenSlice.DIRECTION_AXIAL?(c=papayaFloorFast(a.finalTransform[0][2]+(b.x+.5)*a.finalTransform[0][0]),d=papayaFloorFast(a.finalTransform[1][2]+(b.y+.5)*a.finalTransform[1][1])):e===papaya.viewer.ScreenSlice.DIRECTION_CORONAL?(c=papayaFloorFast(a.finalTransform[0][2]+(b.x+.5)*a.finalTransform[0][0]),d=papayaFloorFast(a.finalTransform[1][2]+(b.z+.5)*a.finalTransform[1][1])):
  e===papaya.viewer.ScreenSlice.DIRECTION_SAGITTAL&&(c=papayaFloorFast(a.finalTransform[0][2]+(b.y+.5)*a.finalTransform[0][0]),d=papayaFloorFast(a.finalTransform[1][2]+(b.z+.5)*a.finalTransform[1][1]));return new papaya.core.Point(c,d)};
  papaya.viewer.Viewer.prototype.updateCursorPosition=function(b,a,c){var d,e,f,h=null,g;this.container.display&&(a-=this.canvasRect.left,c-=this.canvasRect.top,this.insideScreenSlice(b.axialSlice,a,c,b.volume.getXDim(),b.volume.getYDim())?(d=this.convertScreenToImageCoordinateX(a,b.axialSlice),e=this.convertScreenToImageCoordinateY(c,b.axialSlice),f=b.axialSlice.currentSlice,g=!0):this.insideScreenSlice(b.coronalSlice,a,c,b.volume.getXDim(),b.volume.getZDim())?(d=this.convertScreenToImageCoordinateX(a,
  b.coronalSlice),f=this.convertScreenToImageCoordinateY(c,b.coronalSlice),e=b.coronalSlice.currentSlice,g=!0):this.insideScreenSlice(b.sagittalSlice,a,c,b.volume.getYDim(),b.volume.getZDim())?(e=this.convertScreenToImageCoordinateX(a,b.sagittalSlice),f=this.convertScreenToImageCoordinateY(c,b.sagittalSlice),d=b.sagittalSlice.currentSlice,g=!0):this.insideScreenSlice(b.surfaceView,a,c)&&(a-=b.surfaceView.screenOffsetX,c-=b.surfaceView.screenOffsetY,h=this.surfaceView.pick(a,c))&&(this.getIndexCoordinateAtWorld(h.coordinate[0],
  h.coordinate[1],h.coordinate[2],this.tempCoor),d=this.tempCoor.x,e=this.tempCoor.y,f=this.tempCoor.z,g=!0),g?(this.cursorPosition.x=d,this.cursorPosition.y=e,this.cursorPosition.z=f,this.container.display.drawDisplay(d,e,f)):this.container.display.drawEmptyDisplay())};
  papaya.viewer.Viewer.prototype.insideScreenSlice=function(b,a,c,d,e){var f,h;if(!b)return!1;b===this.surfaceView?(f=b.screenOffsetX,d=b.screenOffsetX+b.screenDim,h=b.screenOffsetY,b=b.screenOffsetY+b.screenDim):(f=papayaRoundFast(b.screenTransform[0][2]),d=papayaRoundFast(b.screenTransform[0][2]+d*b.screenTransform[0][0]),h=papayaRoundFast(b.screenTransform[1][2]),b=papayaRoundFast(b.screenTransform[1][2]+e*b.screenTransform[1][1]));return a>=f&&a<d&&c>=h&&c<b};
  papaya.viewer.Viewer.prototype.drawEmptyViewer=function(){var b,a,c;this.context.fillStyle="#000000";this.context.fillRect(0,0,this.canvas.width,this.canvas.height);this.context.fillStyle="#AAAAAA";this.container.readyForDnD()&&(this.context.font="18px sans-serif",b=this.canvas.height-22,a="Drop here or click the File menu",c=this.context.measureText(a),c=c.width,this.context.fillText(a,this.canvas.width/2-c/2,b));900<this.canvas.width&&(this.context.font="14px sans-serif",b=this.canvas.height-20,
  a="Supported formats: NIFTI"+(papaya.Container.DICOM_SUPPORT?", DICOM":""),this.context.fillText(a,20,b),this.context.font="14px sans-serif",b=this.canvas.height-20,a="Papaya (Build "+PAPAYA_BUILD_NUM+")",c=this.context.measureText(a),c=c.width,this.context.fillText(a,this.canvas.width-c-20,b))};
  papaya.viewer.Viewer.prototype.drawViewer=function(b,a){var c="Yes"===this.container.preferences.radiological,d="Yes"===this.container.preferences.showOrientation;this.initialized?(this.context.save(),a?(this.axialSlice.repaint(this.currentCoord.z,b,this.worldSpace),this.coronalSlice.repaint(this.currentCoord.y,b,this.worldSpace),this.sagittalSlice.repaint(this.currentCoord.x,b,this.worldSpace)):((b||this.draggingSliceDir!==papaya.viewer.ScreenSlice.DIRECTION_AXIAL)&&this.axialSlice.updateSlice(this.currentCoord.z,
  b,this.worldSpace),(b||this.draggingSliceDir!==papaya.viewer.ScreenSlice.DIRECTION_CORONAL)&&this.coronalSlice.updateSlice(this.currentCoord.y,b,this.worldSpace),(b||this.draggingSliceDir!==papaya.viewer.ScreenSlice.DIRECTION_SAGITTAL)&&this.sagittalSlice.updateSlice(this.currentCoord.x,b,this.worldSpace)),!this.hasSurface()||papaya.utilities.PlatformUtils.smallScreen&&!b&&this.selectedSlice!==this.surfaceView||this.surfaceView.draw(),"No"===this.container.preferences.smoothDisplay?(this.context.imageSmoothingEnabled=
  !1,this.context.mozImageSmoothingEnabled=!1,this.context.msImageSmoothingEnabled=!1):(this.context.imageSmoothingEnabled=!0,this.context.mozImageSmoothingEnabled=!0,this.context.msImageSmoothingEnabled=!0),this.drawScreenSlice(this.mainImage),this.container.orthogonal&&(this.drawScreenSlice(this.lowerImageTop),this.drawScreenSlice(this.lowerImageBot),this.hasSurface()&&this.drawScreenSlice(this.lowerImageBot2)),(d||c)&&this.drawOrientation(),"Yes"===this.container.preferences.showCrosshairs&&this.drawCrosshairs(),
  "Yes"===this.container.preferences.showRuler&&this.drawRuler(),this.container.display&&this.container.display.drawDisplay(this.currentCoord.x,this.currentCoord.y,this.currentCoord.z),this.container.contextManager&&this.container.contextManager.drawToViewer&&this.container.contextManager.drawToViewer(this.context)):this.drawEmptyViewer()};papaya.viewer.Viewer.prototype.hasSurface=function(){return this.container.hasSurface()&&this.surfaceView&&this.surfaceView.initialized};
  papaya.viewer.Viewer.prototype.drawScreenSlice=function(b){var a,c;b===this.surfaceView?(this.context.fillStyle=this.surfaceView.getBackgroundColor(),this.context.fillRect(b.screenOffsetX,b.screenOffsetY,b.screenDim,b.screenDim),this.context.drawImage(b.canvas,b.screenOffsetX,b.screenOffsetY),"Yes"===this.container.preferences.showRuler&&this.surfaceView===this.mainImage&&(this.context.font=papaya.viewer.Viewer.ORIENTATION_MARKER_SIZE+"px sans-serif",a=this.context.measureText("Ruler Length: ").width,
  c=this.context.measureText("Ruler Length: 000.00").width,c/=2,this.context.fillStyle="#ffb3db",this.context.fillText("Ruler Length:  ",b.screenDim/2-c/2,papaya.viewer.Viewer.ORIENTATION_MARKER_SIZE+5),this.context.fillStyle="#FFFFFF",this.context.fillText(this.surfaceView.getRulerLength().toFixed(2),b.screenDim/2+a-c/2,papaya.viewer.Viewer.ORIENTATION_MARKER_SIZE+5))):(this.context.fillStyle=papaya.viewer.Viewer.BACKGROUND_COLOR,this.context.setTransform(1,0,0,1,0,0),this.context.fillRect(b.screenOffsetX,
  b.screenOffsetY,b.screenDim,b.screenDim),this.context.save(),this.context.beginPath(),this.context.rect(b.screenOffsetX,b.screenOffsetY,b.screenDim,b.screenDim),this.context.clip(),this.context.setTransform(b.finalTransform[0][0],0,0,b.finalTransform[1][1],b.finalTransform[0][2],b.finalTransform[1][2]),this.context.drawImage(b.canvasMain,0,0),this.context.restore(),b.canvasDTILines&&this.context.drawImage(b.canvasDTILines,b.screenOffsetX,b.screenOffsetY))};
  papaya.viewer.Viewer.prototype.drawOrientation=function(){var b,a,c,d,e,f,h,g,m,l,q,u="Yes"===this.container.preferences.showOrientation;if(this.mainImage!==this.surfaceView){this.context.setTransform(1,0,0,1,0,0);this.context.fillStyle=this.getOrientationCertaintyColor();this.context.font=papaya.viewer.Viewer.ORIENTATION_MARKER_SIZE+"px sans-serif";b=this.context.measureText("X");b=b.width;a="Yes"===this.container.preferences.radiological;this.mainImage===this.axialSlice?(c=papaya.viewer.Viewer.ORIENTATION_MARKER_ANTERIOR,
  d=papaya.viewer.Viewer.ORIENTATION_MARKER_POSTERIOR,a?(e=papaya.viewer.Viewer.ORIENTATION_MARKER_RIGHT,f=papaya.viewer.Viewer.ORIENTATION_MARKER_LEFT):(e=papaya.viewer.Viewer.ORIENTATION_MARKER_LEFT,f=papaya.viewer.Viewer.ORIENTATION_MARKER_RIGHT)):this.mainImage===this.coronalSlice?(c=papaya.viewer.Viewer.ORIENTATION_MARKER_SUPERIOR,d=papaya.viewer.Viewer.ORIENTATION_MARKER_INFERIOR,a?(e=papaya.viewer.Viewer.ORIENTATION_MARKER_RIGHT,f=papaya.viewer.Viewer.ORIENTATION_MARKER_LEFT):(e=papaya.viewer.Viewer.ORIENTATION_MARKER_LEFT,
  f=papaya.viewer.Viewer.ORIENTATION_MARKER_RIGHT)):this.mainImage===this.sagittalSlice&&(c=papaya.viewer.Viewer.ORIENTATION_MARKER_SUPERIOR,d=papaya.viewer.Viewer.ORIENTATION_MARKER_INFERIOR,e=papaya.viewer.Viewer.ORIENTATION_MARKER_ANTERIOR,f=papaya.viewer.Viewer.ORIENTATION_MARKER_POSTERIOR);a=this.mainImage.screenOffsetX;h=this.mainImage.screenOffsetX+this.mainImage.screenDim;g=Math.round(h/2);m=this.mainImage.screenOffsetY;l=this.mainImage.screenOffsetY+this.mainImage.screenDim;q=Math.round(l/
  2);if(u||this.mainImage.isRadiologicalSensitive())this.context.fillText(e,a+papaya.viewer.Viewer.ORIENTATION_MARKER_SIZE,q+.5*papaya.viewer.Viewer.ORIENTATION_MARKER_SIZE),this.context.fillText(f,h-1.5*papaya.viewer.Viewer.ORIENTATION_MARKER_SIZE,q+.5*papaya.viewer.Viewer.ORIENTATION_MARKER_SIZE);u&&(this.context.fillText(c,g-b/2,m+1.5*papaya.viewer.Viewer.ORIENTATION_MARKER_SIZE),this.context.fillText(d,g-b/2,l-papaya.viewer.Viewer.ORIENTATION_MARKER_SIZE))}};
  papaya.viewer.Viewer.prototype.drawRuler=function(){var b,a,c,d,e,f;this.mainImage!==this.surfaceView&&(this.mainImage===this.axialSlice?(b=this.axialSlice.finalTransform[0][2]+(this.axialSlice.rulerPoints[0].x+.5)*this.axialSlice.finalTransform[0][0],a=this.axialSlice.finalTransform[1][2]+(this.axialSlice.rulerPoints[0].y+.5)*this.axialSlice.finalTransform[1][1],c=this.axialSlice.finalTransform[0][2]+(this.axialSlice.rulerPoints[1].x+.5)*this.axialSlice.finalTransform[0][0],d=this.axialSlice.finalTransform[1][2]+
  (this.axialSlice.rulerPoints[1].y+.5)*this.axialSlice.finalTransform[1][1]):this.mainImage===this.coronalSlice?(b=this.coronalSlice.finalTransform[0][2]+(this.coronalSlice.rulerPoints[0].x+.5)*this.coronalSlice.finalTransform[0][0],a=this.coronalSlice.finalTransform[1][2]+(this.coronalSlice.rulerPoints[0].y+.5)*this.coronalSlice.finalTransform[1][1],c=this.coronalSlice.finalTransform[0][2]+(this.coronalSlice.rulerPoints[1].x+.5)*this.coronalSlice.finalTransform[0][0],d=this.coronalSlice.finalTransform[1][2]+
  (this.coronalSlice.rulerPoints[1].y+.5)*this.coronalSlice.finalTransform[1][1]):this.mainImage===this.sagittalSlice&&(b=this.sagittalSlice.finalTransform[0][2]+(this.sagittalSlice.rulerPoints[0].x+.5)*this.sagittalSlice.finalTransform[0][0],a=this.sagittalSlice.finalTransform[1][2]+(this.sagittalSlice.rulerPoints[0].y+.5)*this.sagittalSlice.finalTransform[1][1],c=this.sagittalSlice.finalTransform[0][2]+(this.sagittalSlice.rulerPoints[1].x+.5)*this.sagittalSlice.finalTransform[0][0],d=this.sagittalSlice.finalTransform[1][2]+
  (this.sagittalSlice.rulerPoints[1].y+.5)*this.sagittalSlice.finalTransform[1][1]),this.context.setTransform(1,0,0,1,0,0),this.context.strokeStyle="#FF1493",this.context.fillStyle="#FF1493",this.context.lineWidth=2,this.context.save(),this.context.beginPath(),this.context.moveTo(b,a),this.context.lineTo(c,d),this.context.stroke(),this.context.closePath(),this.context.beginPath(),this.context.arc(b,a,3,0,2*Math.PI,!1),this.context.arc(c,d,3,0,2*Math.PI,!1),this.context.fill(),this.context.closePath(),
  e=papaya.utilities.StringUtils.formatNumber(papaya.utilities.MathUtils.lineDistance(this.mainImage.rulerPoints[0].x*this.mainImage.xSize,this.mainImage.rulerPoints[0].y*this.mainImage.ySize,this.mainImage.rulerPoints[1].x*this.mainImage.xSize,this.mainImage.rulerPoints[1].y*this.mainImage.ySize),!1),f=this.context.measureText(e),f=f.width,b=parseInt((b+c)/2)-f/2,a=parseInt((a+d)/2)+7,this.context.fillStyle="#FFFFFF",papaya.viewer.Viewer.drawRoundRect(this.context,b-2,a-14-2+1,f+4,18,5,!0,!1),this.context.font=
  papaya.viewer.Viewer.ORIENTATION_MARKER_SIZE+"px sans-serif",this.context.strokeStyle="#FF1493",this.context.fillStyle="#FF1493",this.context.fillText(e,b,a))};
  papaya.viewer.Viewer.prototype.drawCrosshairs=function(){var b,a,c;this.context.setTransform(1,0,0,1,0,0);this.context.strokeStyle=papaya.viewer.Viewer.CROSSHAIRS_COLOR;this.context.lineWidth=1;if(this.mainImage!==this.axialSlice||this.toggleMainCrosshairs)this.context.save(),this.context.beginPath(),this.context.rect(this.axialSlice.screenOffsetX,this.axialSlice.screenOffsetY,this.axialSlice.screenDim,this.axialSlice.screenDim),this.context.closePath(),this.context.clip(),this.context.beginPath(),
  b=this.axialSlice.finalTransform[0][2]+(this.currentCoord.x+.5)*this.axialSlice.finalTransform[0][0],a=this.axialSlice.finalTransform[1][2],c=this.axialSlice.finalTransform[1][2]+this.axialSlice.yDim*this.axialSlice.finalTransform[1][1],this.context.moveTo(b,a),this.context.lineTo(b,c),b=this.axialSlice.finalTransform[1][2]+(this.currentCoord.y+.5)*this.axialSlice.finalTransform[1][1],a=this.axialSlice.finalTransform[0][2],c=this.axialSlice.finalTransform[0][2]+this.axialSlice.xDim*this.axialSlice.finalTransform[0][0],
  this.context.moveTo(a,b),this.context.lineTo(c,b),this.context.closePath(),this.context.stroke(),this.context.restore();if(this.mainImage!==this.coronalSlice||this.toggleMainCrosshairs)this.context.save(),this.context.beginPath(),this.context.rect(this.coronalSlice.screenOffsetX,this.coronalSlice.screenOffsetY,this.coronalSlice.screenDim,this.coronalSlice.screenDim),this.context.closePath(),this.context.clip(),this.context.beginPath(),b=this.coronalSlice.finalTransform[0][2]+(this.currentCoord.x+
  .5)*this.coronalSlice.finalTransform[0][0],a=this.coronalSlice.finalTransform[1][2],c=this.coronalSlice.finalTransform[1][2]+this.coronalSlice.yDim*this.coronalSlice.finalTransform[1][1],this.context.moveTo(b,a),this.context.lineTo(b,c),b=this.coronalSlice.finalTransform[1][2]+(this.currentCoord.z+.5)*this.coronalSlice.finalTransform[1][1],a=this.coronalSlice.finalTransform[0][2],c=this.coronalSlice.finalTransform[0][2]+this.coronalSlice.xDim*this.coronalSlice.finalTransform[0][0],this.context.moveTo(a,
  b),this.context.lineTo(c,b),this.context.closePath(),this.context.stroke(),this.context.restore();if(this.mainImage!==this.sagittalSlice||this.toggleMainCrosshairs)this.context.save(),this.context.beginPath(),this.context.rect(this.sagittalSlice.screenOffsetX,this.sagittalSlice.screenOffsetY,this.sagittalSlice.screenDim,this.sagittalSlice.screenDim),this.context.closePath(),this.context.clip(),this.context.beginPath(),b=this.sagittalSlice.finalTransform[0][2]+(this.currentCoord.y+.5)*this.sagittalSlice.finalTransform[0][0],
  a=this.sagittalSlice.finalTransform[1][2],c=this.sagittalSlice.finalTransform[1][2]+this.sagittalSlice.yDim*this.sagittalSlice.finalTransform[1][1],this.context.moveTo(b,a),this.context.lineTo(b,c),b=this.sagittalSlice.finalTransform[1][2]+(this.currentCoord.z+.5)*this.sagittalSlice.finalTransform[1][1],a=this.sagittalSlice.finalTransform[0][2],c=this.sagittalSlice.finalTransform[0][2]+this.sagittalSlice.xDim*this.sagittalSlice.finalTransform[0][0],this.context.moveTo(a,b),this.context.lineTo(c,b),
  this.context.closePath(),this.context.stroke(),this.context.restore()};
  papaya.viewer.Viewer.prototype.calculateScreenSliceTransforms=function(){this.container.orthogonalTall?this.container.hasSurface()?(this.viewerDim=this.canvas.height/1.333,this.getTransformParameters(this.mainImage,this.viewerDim,!1,3),this.mainImage.screenTransform[0][2]+=this.mainImage.screenOffsetX=0,this.mainImage.screenTransform[1][2]+=this.mainImage.screenOffsetY=0,this.getTransformParameters(this.lowerImageTop,this.viewerDim,!0,3),this.lowerImageTop.screenTransform[0][2]+=this.lowerImageTop.screenOffsetX=
  0,this.lowerImageTop.screenTransform[1][2]+=this.lowerImageTop.screenOffsetY=this.viewerDim+papaya.viewer.Viewer.GAP,this.getTransformParameters(this.lowerImageBot,this.viewerDim,!0,3),this.lowerImageBot.screenTransform[0][2]+=this.lowerImageBot.screenOffsetX=(this.viewerDim-papaya.viewer.Viewer.GAP)/3+papaya.viewer.Viewer.GAP,this.lowerImageBot.screenTransform[1][2]+=this.lowerImageBot.screenOffsetY=this.viewerDim+papaya.viewer.Viewer.GAP,this.getTransformParameters(this.lowerImageBot2,this.viewerDim,
  !0,3),this.lowerImageBot2.screenTransform[0][2]+=this.lowerImageBot2.screenOffsetX=2*((this.viewerDim-papaya.viewer.Viewer.GAP)/3+papaya.viewer.Viewer.GAP),this.lowerImageBot2.screenTransform[1][2]+=this.lowerImageBot2.screenOffsetY=this.viewerDim+papaya.viewer.Viewer.GAP):(this.viewerDim=this.canvas.height/1.5,this.getTransformParameters(this.mainImage,this.viewerDim,!1,2),this.mainImage.screenTransform[0][2]+=this.mainImage.screenOffsetX=0,this.mainImage.screenTransform[1][2]+=this.mainImage.screenOffsetY=
  0,this.getTransformParameters(this.lowerImageBot,this.viewerDim,!0,2),this.lowerImageBot.screenTransform[0][2]+=this.lowerImageBot.screenOffsetX=0,this.lowerImageBot.screenTransform[1][2]+=this.lowerImageBot.screenOffsetY=this.viewerDim+papaya.viewer.Viewer.GAP,this.getTransformParameters(this.lowerImageTop,this.viewerDim,!0,2),this.lowerImageTop.screenTransform[0][2]+=this.lowerImageTop.screenOffsetX=(this.viewerDim-papaya.viewer.Viewer.GAP)/2+papaya.viewer.Viewer.GAP,this.lowerImageTop.screenTransform[1][2]+=
  this.lowerImageTop.screenOffsetY=this.viewerDim+papaya.viewer.Viewer.GAP):(this.viewerDim=this.canvas.height,this.container.hasSurface()?(this.getTransformParameters(this.mainImage,this.viewerDim,!1,3),this.mainImage.screenTransform[0][2]+=this.mainImage.screenOffsetX=0,this.mainImage.screenTransform[1][2]+=this.mainImage.screenOffsetY=0,this.getTransformParameters(this.lowerImageTop,this.viewerDim,!0,3),this.lowerImageTop.screenTransform[0][2]+=this.lowerImageTop.screenOffsetX=this.viewerDim+papaya.viewer.Viewer.GAP,
  this.lowerImageTop.screenTransform[1][2]+=this.lowerImageTop.screenOffsetY=0,this.getTransformParameters(this.lowerImageBot,this.viewerDim,!0,3),this.lowerImageBot.screenTransform[0][2]+=this.lowerImageBot.screenOffsetX=this.viewerDim+papaya.viewer.Viewer.GAP,this.lowerImageBot.screenTransform[1][2]+=this.lowerImageBot.screenOffsetY=(this.viewerDim-papaya.viewer.Viewer.GAP)/3+papaya.viewer.Viewer.GAP,this.getTransformParameters(this.lowerImageBot2,this.viewerDim,!0,3),this.lowerImageBot2.screenTransform[0][2]+=
  this.lowerImageBot2.screenOffsetX=this.viewerDim+papaya.viewer.Viewer.GAP,this.lowerImageBot2.screenTransform[1][2]+=this.lowerImageBot2.screenOffsetY=(this.viewerDim-papaya.viewer.Viewer.GAP)/3*2+2*papaya.viewer.Viewer.GAP):(this.getTransformParameters(this.mainImage,this.viewerDim,!1,2),this.mainImage.screenTransform[0][2]+=this.mainImage.screenOffsetX=0,this.mainImage.screenTransform[1][2]+=this.mainImage.screenOffsetY=0,this.getTransformParameters(this.lowerImageBot,this.viewerDim,!0,2),this.lowerImageBot.screenTransform[0][2]+=
  this.lowerImageBot.screenOffsetX=this.viewerDim+papaya.viewer.Viewer.GAP,this.lowerImageBot.screenTransform[1][2]+=this.lowerImageBot.screenOffsetY=(this.viewerDim-papaya.viewer.Viewer.GAP)/2+papaya.viewer.Viewer.GAP,this.getTransformParameters(this.lowerImageTop,this.viewerDim,!0,2),this.lowerImageTop.screenTransform[0][2]+=this.lowerImageTop.screenOffsetX=this.viewerDim+papaya.viewer.Viewer.GAP,this.lowerImageTop.screenTransform[1][2]+=this.lowerImageTop.screenOffsetY=0));this.updateScreenSliceTransforms()};
  papaya.viewer.Viewer.prototype.updateScreenSliceTransforms=function(){this.axialSlice.updateFinalTransform();this.coronalSlice.updateFinalTransform();this.sagittalSlice.updateFinalTransform()};
  papaya.viewer.Viewer.prototype.getTransformParameters=function(b,a,c,d){var e,f,h,g;e=c?d:1;b===this.surfaceView?this.surfaceView.resize(this.viewerDim/e):(b.getRealWidth()>b.getRealHeight()?(f=(c?a-papaya.viewer.Viewer.GAP:a)/this.longestDim/e*(b.getXSize()/this.longestDimSize),h=(c?a-papaya.viewer.Viewer.GAP:a)/this.longestDim*b.getYXratio()/e*(b.getXSize()/this.longestDimSize)):(f=(c?a-papaya.viewer.Viewer.GAP:a)/this.longestDim*b.getXYratio()/e*(b.getYSize()/this.longestDimSize),h=(c?a-papaya.viewer.Viewer.GAP:
  a)/this.longestDim/e*(b.getYSize()/this.longestDimSize)),g=((c?a-papaya.viewer.Viewer.GAP:a)/e-b.getXDim()*f)/2,e=((c?a-papaya.viewer.Viewer.GAP:a)/e-b.getYDim()*h)/2,b.screenDim=c?(a-papaya.viewer.Viewer.GAP)/d:a,b.screenTransform[0][0]=f,b.screenTransform[1][1]=h,b.screenTransform[0][2]=g,b.screenTransform[1][2]=e,b.screenTransform2[0][0]=f,b.screenTransform2[1][1]=h,b.screenTransform2[0][2]=g,b.screenTransform2[1][2]=e)};
  papaya.viewer.Viewer.prototype.setLongestDim=function(b){this.longestDim=b.getXDim();this.longestDimSize=b.getXSize();b.getYDim()*b.getYSize()>this.longestDim*this.longestDimSize&&(this.longestDim=b.getYDim(),this.longestDimSize=b.getYSize());b.getZDim()*b.getZSize()>this.longestDim*this.longestDimSize&&(this.longestDim=b.getZDim(),this.longestDimSize=b.getZSize())};
  papaya.viewer.Viewer.prototype.keyDownEvent=function(b){var a;this.keyPressIgnored=!1;this.container.toolbar.isShowingMenus()||(1<papayaContainers.length||papayaContainers[0].nestedViewer)&&papaya.Container.papayaLastHoveredViewer!==this||(a=papaya.viewer.Viewer.getKeyCode(b),papaya.viewer.Viewer.isControlKey(b)?this.isControlKeyDown=!0:papaya.viewer.Viewer.isAltKey(b)?this.isAltKeyDown=!0:papaya.viewer.Viewer.isShiftKey(b)?this.isShiftKeyDown=!0:a===papaya.viewer.Viewer.KEYCODE_ROTATE_VIEWS?this.rotateViews():
  a===papaya.viewer.Viewer.KEYCODE_CENTER?(a=new papaya.core.Coordinate(Math.floor(this.volume.header.imageDimensions.xDim/2),Math.floor(this.volume.header.imageDimensions.yDim/2),Math.floor(this.volume.header.imageDimensions.zDim/2)),this.gotoCoordinate(a)):a===papaya.viewer.Viewer.KEYCODE_ORIGIN?this.gotoCoordinate(this.volume.header.origin):a===papaya.viewer.Viewer.KEYCODE_ARROW_UP?this.incrementCoronal(!1):a===papaya.viewer.Viewer.KEYCODE_ARROW_DOWN?this.incrementCoronal(!0):a===papaya.viewer.Viewer.KEYCODE_ARROW_LEFT?
  this.incrementSagittal(!0):a===papaya.viewer.Viewer.KEYCODE_ARROW_RIGHT?this.incrementSagittal(!1):a===papaya.viewer.Viewer.KEYCODE_PAGE_DOWN||a===papaya.viewer.Viewer.KEYCODE_FORWARD_SLASH?this.incrementAxial(!0):a===papaya.viewer.Viewer.KEYCODE_PAGE_UP||a===papaya.viewer.Viewer.KEYCODE_SINGLE_QUOTE?this.incrementAxial(!1):a===papaya.viewer.Viewer.KEYCODE_INCREMENT_MAIN?this.mainImage.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_AXIAL?this.incrementAxial(!1):this.mainImage.sliceDirection===
  papaya.viewer.ScreenSlice.DIRECTION_CORONAL?this.incrementCoronal(!1):this.mainImage.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_SAGITTAL&&this.incrementSagittal(!0):a===papaya.viewer.Viewer.KEYCODE_DECREMENT_MAIN?this.mainImage.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_AXIAL?this.incrementAxial(!0):this.mainImage.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_CORONAL?this.incrementCoronal(!0):this.mainImage.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_SAGITTAL&&
  this.incrementSagittal(!1):a===papaya.viewer.Viewer.KEYCODE_TOGGLE_CROSSHAIRS?"Yes"===this.container.preferences.showCrosshairs&&(this.toggleMainCrosshairs=!this.toggleMainCrosshairs,this.drawViewer(!0)):a===papaya.viewer.Viewer.KEYCODE_SERIES_FORWARD?this.incrementSeriesPoint():a===papaya.viewer.Viewer.KEYCODE_SERIES_BACK?this.decrementSeriesPoint():a===papaya.viewer.Viewer.KEYCODE_RULER?(this.container.preferences.showRuler="Yes"===this.container.preferences.showRuler?"No":"Yes",this.drawViewer(!0,
  !0)):this.keyPressIgnored=!0,this.keyPressIgnored||(b.handled=!0,b.preventDefault()))};papaya.viewer.Viewer.prototype.keyUpEvent=function(b){1<papayaContainers.length&&papaya.Container.papayaLastHoveredViewer!==this||(this.isShiftKeyDown=this.isAltKeyDown=this.isControlKeyDown=!1,this.keyPressIgnored||(b.handled=!0,b.preventDefault()),this.hasSurface()&&papaya.utilities.PlatformUtils.smallScreen&&this.drawViewer(!0,!1))};
  papaya.viewer.Viewer.prototype.rotateViews=function(){var b;this.container.contextManager&&this.container.contextManager.clearContext&&this.container.contextManager.clearContext();this.hasSurface()?(b=this.lowerImageBot2,this.lowerImageBot2=this.lowerImageBot):b=this.lowerImageBot;this.lowerImageBot=this.lowerImageTop;this.lowerImageTop=this.mainImage;this.mainImage=b;this.viewsChanged()};
  papaya.viewer.Viewer.prototype.viewsChanged=function(){this.calculateScreenSliceTransforms();this.hasSurface()&&this.lowerImageBot2.clearDTILinesImage();this.lowerImageBot.clearDTILinesImage();this.lowerImageTop.clearDTILinesImage();this.mainImage.clearDTILinesImage();this.controlsHidden||(this.mainImage!==this.surfaceView?this.fadeInControls():($("#"+PAPAYA_CONTROL_MAIN_INCREMENT_BUTTON_CSS+this.container.containerIndex).fadeOut(),$("#"+PAPAYA_CONTROL_MAIN_DECREMENT_BUTTON_CSS+this.container.containerIndex).fadeOut()),
  $("#"+PAPAYA_DEFAULT_SLIDER_ID+this.container.containerIndex+"main").find("button").prop("disabled",this.mainImage===this.surfaceView));this.drawViewer(!0);this.updateSliceSliderControl()};papaya.viewer.Viewer.prototype.timepointChanged=function(){this.drawViewer(!0);this.updateSliceSliderControl();this.updateWindowTitle()};
  papaya.viewer.Viewer.prototype.resetUpdateTimer=function(b){var a=this;null!==this.updateTimer&&(window.clearTimeout(this.updateTimer),this.updateTimerEvent=this.updateTimer=null);null!==b&&(this.updateTimerEvent=b,this.updateTimer=window.setTimeout(papaya.utilities.ObjectUtils.bind(a,function(){a.updatePosition(this,papaya.utilities.PlatformUtils.getMousePositionX(a.updateTimerEvent),papaya.utilities.PlatformUtils.getMousePositionY(a.updateTimerEvent))}),papaya.viewer.Viewer.UPDATE_TIMER_INTERVAL))};
  papaya.viewer.Viewer.prototype.mouseDownEvent=function(b){var a=!0,c;papaya.Container.allowPropagation||b.stopPropagation();b.preventDefault();if(this.showingContextMenu)this.container.toolbar.closeAllMenus(),b.handled=!0;else if("IMG"===b.target.nodeName||"CANVAS"===b.target.nodeName)!0!==b.handled&&(this.container.toolbar.closeAllMenus(),this.previousMousePosition.x=papaya.utilities.PlatformUtils.getMousePositionX(b),this.previousMousePosition.y=papaya.utilities.PlatformUtils.getMousePositionY(b),
  this.findClickedSlice(this,this.previousMousePosition.x,this.previousMousePosition.y),(2===b.button||this.isControlKeyDown||this.isLongTouch)&&this.container.contextManager&&this.selectedSlice===this.mainImage&&this.mainImage===this.surfaceView?(this.contextMenuMousePositionX=this.previousMousePosition.x-this.canvasRect.left,this.contextMenuMousePositionY=this.previousMousePosition.y-this.canvasRect.top,this.container.contextManager.prefersColorPicking&&this.container.contextManager.prefersColorPicking()&&
  (c=this.surfaceView.pickColor(this.contextMenuMousePositionX,this.contextMenuMousePositionY),c=this.container.contextManager.getContextAtColor(c[0],c[1],c[2])),c&&(this.isContextMode=!0,c=this.container.toolbar.buildMenu(c,null,null,null,!0),papaya.ui.Toolbar.applyContextState(c),a=!1,c.showMenu(),this.showingContextMenu=!0),this.isContextMode=!0):(2===b.button||this.isControlKeyDown||this.isLongTouch)&&this.container.contextManager&&this.selectedSlice===this.mainImage?(this.isLongTouch?(c=this.convertCurrentCoordinateToScreen(this.mainImage),
  this.contextMenuMousePositionX=c.x,this.contextMenuMousePositionY=c.y,c=this.container.contextManager.getContextAtImagePosition(this.currentCoord.x,this.currentCoord.y,this.currentCoord.z)):(this.contextMenuMousePositionX=this.previousMousePosition.x-this.canvasRect.left,this.contextMenuMousePositionY=this.previousMousePosition.y-this.canvasRect.top,c=this.container.contextManager.getContextAtImagePosition(this.cursorPosition.x,this.cursorPosition.y,this.cursorPosition.z)),c&&(this.isContextMode=
  !0,c=this.container.toolbar.buildMenu(c,null,null,null,!0),papaya.ui.Toolbar.applyContextState(c),a=!1,c.showMenu(),this.showingContextMenu=!0)):2!==b.button&&!this.isControlKeyDown||this.currentScreenVolume.rgb?this.isAltKeyDown&&this.selectedSlice?(this.isZoomMode=!0,this.selectedSlice===this.surfaceView?(this.isPanning=this.isShiftKeyDown,this.surfaceView.setStartDynamic(this.previousMousePosition.x,this.previousMousePosition.y)):this.isZooming()&&this.isShiftKeyDown?(this.isPanning=!0,this.setStartPanLocation(this.convertScreenToImageCoordinateX(this.previousMousePosition.x,
  this.selectedSlice),this.convertScreenToImageCoordinateY(this.previousMousePosition.y,this.selectedSlice),this.selectedSlice.sliceDirection)):this.setZoomLocation()):this.selectedSlice&&this.selectedSlice!==this.surfaceView?(this.grabbedHandle=this.selectedSlice.findProximalRulerHandle(this.convertScreenToImageCoordinateX(this.previousMousePosition.x-this.canvasRect.left,this.selectedSlice),this.convertScreenToImageCoordinateY(this.previousMousePosition.y-this.canvasRect.top,this.selectedSlice)),
  null===this.grabbedHandle&&(this.updatePosition(this,papaya.utilities.PlatformUtils.getMousePositionX(b),papaya.utilities.PlatformUtils.getMousePositionY(b),!1),this.resetUpdateTimer(b))):this.selectedSlice&&this.selectedSlice===this.surfaceView&&(this.surfaceView.findProximalRulerHandle(this.previousMousePosition.x-this.canvasRect.left,this.previousMousePosition.y-this.canvasRect.top)||(this.isPanning=this.isShiftKeyDown,this.surfaceView.setStartDynamic(this.previousMousePosition.x,this.previousMousePosition.y)),
  this.container.display.drawEmptyDisplay()):(this.isWindowControl=!0,this.container.showImageButtons&&(this.container.showControlBar||!this.container.kioskMode)&&this.screenVolumes[this.getCurrentScreenVolIndex()].supportsDynamicColorTable()&&this.container.toolbar.showImageMenu(this.getCurrentScreenVolIndex())),this.isDragging=a,b.handled=!0),this.controlsHidden||(this.controlsHiddenPrimed=!0)};
  papaya.viewer.Viewer.prototype.mouseUpEvent=function(b){papaya.Container.allowPropagation||b.stopPropagation();b.preventDefault();this.showingContextMenu?(this.showingContextMenu=!1,b.handled=!0):("IMG"!==b.target.nodeName&&"CANVAS"!==b.target.nodeName||!0===b.handled||(this.isWindowControl||this.isZoomMode||this.isContextMode||null!==this.grabbedHandle||this.surfaceView&&-1!==this.surfaceView.grabbedRulerPoint||this.updatePosition(this,papaya.utilities.PlatformUtils.getMousePositionX(b),papaya.utilities.PlatformUtils.getMousePositionY(b)),
  this.selectedSlice===this.surfaceView&&this.updateCursorPosition(this,papaya.utilities.PlatformUtils.getMousePositionX(b),papaya.utilities.PlatformUtils.getMousePositionY(b)),this.zoomFactorPrevious=this.zoomFactor,this.isPanning=this.isZoomMode=this.isWindowControl=this.isDragging=!1,this.selectedSlice=null,this.controlsHiddenPrimed=!1,b.handled=!0),this.grabbedHandle=null,this.isContextMode=!1,this.updateWindowTitle(),this.updateSliceSliderControl(),this.container.toolbar.closeAllMenus(!0),this.hasSurface()&&
  (-1===this.surfaceView.grabbedRulerPoint?this.surfaceView.updateCurrent():this.surfaceView.grabbedRulerPoint=-1,papaya.utilities.PlatformUtils.smallScreen&&this.drawViewer(!0,!1)),this.controlsHidden&&(this.controlsHidden=!1,this.fadeInControls()))};
  papaya.viewer.Viewer.prototype.fadeOutControls=function(){$("#"+PAPAYA_CONTROL_MAIN_INCREMENT_BUTTON_CSS+this.container.containerIndex).fadeOut();$("#"+PAPAYA_CONTROL_MAIN_DECREMENT_BUTTON_CSS+this.container.containerIndex).fadeOut();$("#"+PAPAYA_CONTROL_MAIN_SWAP_BUTTON_CSS+this.container.containerIndex).fadeOut();$("#"+PAPAYA_CONTROL_MAIN_GOTO_CENTER_BUTTON_CSS+this.container.containerIndex).fadeOut();$("#"+PAPAYA_CONTROL_MAIN_GOTO_ORIGIN_BUTTON_CSS+this.container.containerIndex).fadeOut()};
  papaya.viewer.Viewer.prototype.fadeInControls=function(){600>this.container.getViewerDimensions()[0]?(this.mainImage!==this.surfaceView&&($("#"+PAPAYA_CONTROL_MAIN_INCREMENT_BUTTON_CSS+this.container.containerIndex).fadeIn(),$("#"+PAPAYA_CONTROL_MAIN_DECREMENT_BUTTON_CSS+this.container.containerIndex).fadeIn()),$("#"+PAPAYA_CONTROL_MAIN_SWAP_BUTTON_CSS+this.container.containerIndex).fadeIn()):(this.mainImage!==this.surfaceView&&($("#"+PAPAYA_CONTROL_MAIN_INCREMENT_BUTTON_CSS+this.container.containerIndex).fadeIn(),
  $("#"+PAPAYA_CONTROL_MAIN_DECREMENT_BUTTON_CSS+this.container.containerIndex).fadeIn()),$("#"+PAPAYA_CONTROL_MAIN_SWAP_BUTTON_CSS+this.container.containerIndex).fadeIn(),$("#"+PAPAYA_CONTROL_MAIN_GOTO_CENTER_BUTTON_CSS+this.container.containerIndex).fadeIn(),$("#"+PAPAYA_CONTROL_MAIN_GOTO_ORIGIN_BUTTON_CSS+this.container.containerIndex).fadeIn())};
  papaya.viewer.Viewer.prototype.findClickedSlice=function(b,a,c){a-=this.canvasRect.left;c-=this.canvasRect.top;this.insideScreenSlice(b.axialSlice,a,c,b.volume.getXDim(),b.volume.getYDim())?this.selectedSlice=this.axialSlice:this.insideScreenSlice(b.coronalSlice,a,c,b.volume.getXDim(),b.volume.getZDim())?this.selectedSlice=this.coronalSlice:this.insideScreenSlice(b.sagittalSlice,a,c,b.volume.getYDim(),b.volume.getZDim())?this.selectedSlice=this.sagittalSlice:this.insideScreenSlice(b.surfaceView,a,
  c,b.volume.getYDim(),b.volume.getZDim())?this.selectedSlice=this.surfaceView:this.selectedSlice=null};
  papaya.viewer.Viewer.prototype.mouseMoveEvent=function(b){b.preventDefault();if(this.showingContextMenu)b.handled=!0;else{var a,c;papaya.Container.papayaLastHoveredViewer=this;a=papaya.utilities.PlatformUtils.getMousePositionX(b);c=papaya.utilities.PlatformUtils.getMousePositionY(b);this.isDragging?this.grabbedHandle?this.isInsideMainSlice(a,c)&&(this.grabbedHandle.x=this.convertScreenToImageCoordinateX(a-this.canvasRect.left,this.selectedSlice),this.grabbedHandle.y=this.convertScreenToImageCoordinateY(c-
  this.canvasRect.top,this.selectedSlice),this.drawViewer(!0,!0)):this.isWindowControl?(this.windowLevelChanged(this.previousMousePosition.x-a,this.previousMousePosition.y-c),this.previousMousePosition.x=a,this.previousMousePosition.y=c):this.isPanning?this.selectedSlice===this.surfaceView?(this.surfaceView.updateTranslateDynamic(papaya.utilities.PlatformUtils.getMousePositionX(b),papaya.utilities.PlatformUtils.getMousePositionY(b),this.selectedSlice===this.mainImage?1:3),this.drawViewer(!1,!0)):this.setCurrentPanLocation(this.convertScreenToImageCoordinateX(a,
  this.selectedSlice),this.convertScreenToImageCoordinateY(c,this.selectedSlice),this.selectedSlice.sliceDirection):this.isZoomMode?(this.selectedSlice===this.surfaceView?(b=.5*(this.previousMousePosition.y-c)*this.surfaceView.scaleFactor,this.surfaceView.zoom+=b,this.previousMousePosition.x=a,this.previousMousePosition.y=c):(b=.05*(this.previousMousePosition.y-c),this.setZoomFactor(this.zoomFactorPrevious-b),this.axialSlice.updateZoomTransform(this.zoomFactor,this.zoomLocX,this.zoomLocY,this.panAmountX,
  this.panAmountY,this),this.coronalSlice.updateZoomTransform(this.zoomFactor,this.zoomLocX,this.zoomLocZ,this.panAmountX,this.panAmountZ,this),this.sagittalSlice.updateZoomTransform(this.zoomFactor,this.zoomLocY,this.zoomLocZ,this.panAmountY,this.panAmountZ,this)),this.drawViewer(!0)):(this.resetUpdateTimer(null),null!==this.selectedSlice&&(this.selectedSlice===this.surfaceView?-1!==this.surfaceView.grabbedRulerPoint?(this.surfaceView.pickRuler(a-this.canvasRect.left,c-this.canvasRect.top),this.drawViewer(!1,
  !0)):(this.surfaceView.updateDynamic(papaya.utilities.PlatformUtils.getMousePositionX(b),papaya.utilities.PlatformUtils.getMousePositionY(b),this.selectedSlice===this.mainImage?1:3),this.drawViewer(!1,!0),this.container.display.drawEmptyDisplay()):this.updatePosition(this,papaya.utilities.PlatformUtils.getMousePositionX(b),papaya.utilities.PlatformUtils.getMousePositionY(b)))):(this.updateCursorPosition(this,papaya.utilities.PlatformUtils.getMousePositionX(b),papaya.utilities.PlatformUtils.getMousePositionY(b)),
  this.isZoomMode=!1);this.controlsHidden&&!this.isDragging&&(this.controlsHidden=!1,this.fadeInControls());this.controlsTimer&&(clearTimeout(this.controlsTimer),this.controlsTimer=null);this.controlsTimer=setTimeout(papaya.utilities.ObjectUtils.bind(this,function(){this.controlsHidden=!0;this.fadeOutControls()}),8E3);this.controlsHiddenPrimed&&(this.controlsHiddenPrimed=!1,this.controlsHidden=!0,this.fadeOutControls())}};
  papaya.viewer.Viewer.prototype.mouseDoubleClickEvent=function(){this.isAltKeyDown&&(this.zoomFactorPrevious=1,this.setZoomFactor(1))};papaya.viewer.Viewer.prototype.mouseOutEvent=function(b){papaya.Container.papayaLastHoveredViewer=null;this.isDragging?this.mouseUpEvent(b):(this.container.display&&this.container.display.drawEmptyDisplay(),this.grabbedHandle=null)};papaya.viewer.Viewer.prototype.mouseLeaveEvent=function(){};
  papaya.viewer.Viewer.prototype.touchMoveEvent=function(b){this.didLongTouch||(this.longTouchTimer&&(clearTimeout(this.longTouchTimer),this.longTouchTimer=null),this.isDragging||(this.mouseDownEvent(b),this.isDragging=!0),this.mouseMoveEvent(b))};papaya.viewer.Viewer.prototype.touchStartEvent=function(b){papaya.Container.allowPropagation||b.stopPropagation();b.preventDefault();this.longTouchTimer=setTimeout(papaya.utilities.ObjectUtils.bind(this,function(){this.doLongTouch(b)}),500)};
  papaya.viewer.Viewer.prototype.touchEndEvent=function(b){this.didLongTouch||(this.longTouchTimer&&(clearTimeout(this.longTouchTimer),this.longTouchTimer=null),this.isDragging||this.mouseDownEvent(b),this.mouseUpEvent(b));this.isLongTouch=this.didLongTouch=!1};
  papaya.viewer.Viewer.prototype.doLongTouch=function(b){this.longTouchTimer=null;this.isLongTouch=this.didLongTouch=!0;this.updateCursorPosition(this,papaya.utilities.PlatformUtils.getMousePositionX(b),papaya.utilities.PlatformUtils.getMousePositionY(b));this.mouseDownEvent(b);this.mouseUpEvent(b)};
  papaya.viewer.Viewer.prototype.windowLevelChanged=function(b,a){var c,d;c=.025*(this.currentScreenVolume.screenMax-this.currentScreenVolume.screenMin);Math.abs(b)>Math.abs(a)?(d=this.currentScreenVolume.screenMin+c*papaya.utilities.MathUtils.signum(b),c=this.currentScreenVolume.screenMax+-1*c*papaya.utilities.MathUtils.signum(b),c<=d&&(c=d=this.currentScreenVolume.screenMin)):(d=this.currentScreenVolume.screenMin+c*papaya.utilities.MathUtils.signum(a),c=this.currentScreenVolume.screenMax+c*papaya.utilities.MathUtils.signum(a));
  this.currentScreenVolume.setScreenRange(d,c);this.container.showImageButtons&&this.container.toolbar.updateImageMenuRange(this.getCurrentScreenVolIndex(),parseFloat(d.toPrecision(7)),parseFloat(c.toPrecision(7)));this.drawViewer(!0)};
  papaya.viewer.Viewer.prototype.gotoCoordinate=function(b,a){if(this.initialized){var c=this.volume.header.imageDimensions.xDim,d=this.volume.header.imageDimensions.yDim,e=this.volume.header.imageDimensions.zDim;this.currentCoord.x=0>b.x?0:b.x>=c?c-1:b.x;this.currentCoord.y=0>b.y?0:b.y>=d?d-1:b.y;this.currentCoord.z=0>b.z?0:b.z>=e?e-1:b.z;this.drawViewer(!0);this.updateSliceSliderControl();a||(this.container.coordinateChanged(this),this.drawViewer(!1))}};
  papaya.viewer.Viewer.prototype.gotoWorldCoordinate=function(b,a){var c=new papaya.core.Coordinate;this.gotoCoordinate(this.getIndexCoordinateAtWorld(b.x,b.y,b.z,c),a)};
  papaya.viewer.Viewer.prototype.resizeViewer=function(b){var a=PAPAYA_PADDING/2,c;this.canvas.width=b[0];this.canvas.height=b[1];this.initialized&&(this.calculateScreenSliceTransforms(),this.canvasRect=this.canvas.getBoundingClientRect(),this.drawViewer(!0),this.container.showControls&&(b=$(this.canvas).offset(),c=$("#"+PAPAYA_CONTROL_MAIN_INCREMENT_BUTTON_CSS+this.container.containerIndex),c.css({top:b.top+a,left:b.left+this.mainImage.screenDim-c.outerWidth()-a,position:"absolute"}),c=$("#"+PAPAYA_CONTROL_MAIN_DECREMENT_BUTTON_CSS+
  this.container.containerIndex),c.css({top:b.top+c.outerHeight()+PAPAYA_PADDING,left:b.left+this.mainImage.screenDim-c.outerWidth()-a,position:"absolute"}),c=$("#"+PAPAYA_CONTROL_MAIN_SWAP_BUTTON_CSS+this.container.containerIndex),c.css({top:b.top+this.mainImage.screenDim-c.outerHeight()-a,left:b.left+this.mainImage.screenDim-c.outerWidth()-a,position:"absolute"}),c=$("#"+PAPAYA_CONTROL_MAIN_GOTO_CENTER_BUTTON_CSS+this.container.containerIndex),c.css({top:b.top+this.mainImage.screenDim-c.outerHeight()-
  a,left:b.left+a,position:"absolute"}),c=$("#"+PAPAYA_CONTROL_MAIN_GOTO_ORIGIN_BUTTON_CSS+this.container.containerIndex),c.css({top:b.top+this.mainImage.screenDim-c.outerHeight()-a,left:b.left+a+c.outerWidth()+PAPAYA_PADDING,position:"absolute"})))};
  papaya.viewer.Viewer.prototype.getWorldCoordinateAtIndex=function(b,a,c,d){d.setCoordinate((b-this.volume.header.origin.x)*this.volume.header.voxelDimensions.xSize,(this.volume.header.origin.y-a)*this.volume.header.voxelDimensions.ySize,(this.volume.header.origin.z-c)*this.volume.header.voxelDimensions.zSize);return d};
  papaya.viewer.Viewer.prototype.getIndexCoordinateAtWorld=function(b,a,c,d){d.setCoordinate(b/this.volume.header.voxelDimensions.xSize+this.volume.header.origin.x,-1*(a/this.volume.header.voxelDimensions.ySize-this.volume.header.origin.y),-1*(c/this.volume.header.voxelDimensions.zSize-this.volume.header.origin.z),!0);return d};
  papaya.viewer.Viewer.prototype.getNextColorTable=function(){var b,a=0;for(b=1;b<this.screenVolumes.length;b+=1)this.screenVolumes[b].dti||(a+=1);return papaya.viewer.ColorTable.OVERLAY_COLOR_TABLES[a%papaya.viewer.ColorTable.OVERLAY_COLOR_TABLES.length].name};
  papaya.viewer.Viewer.prototype.getCurrentValueAt=function(b,a,c){var d=!this.currentScreenVolume.interpolation,d=d&"Yes"===this.container.preferences.smoothDisplay;return this.worldSpace?(d|=this.currentScreenVolume.volume===this.volume&&this.volume.isWorldSpaceOnly(),this.currentScreenVolume.volume.getVoxelAtCoordinate((b-this.volume.header.origin.x)*this.volume.header.voxelDimensions.xSize,(this.volume.header.origin.y-a)*this.volume.header.voxelDimensions.ySize,(this.volume.header.origin.z-c)*this.volume.header.voxelDimensions.zSize,
  this.currentScreenVolume.currentTimepoint,!d)):this.currentScreenVolume.volume.getVoxelAtMM(b*this.volume.header.voxelDimensions.xSize,a*this.volume.header.voxelDimensions.ySize,c*this.volume.header.voxelDimensions.zSize,this.currentScreenVolume.currentTimepoint,!d)};
  papaya.viewer.Viewer.prototype.resetViewer=function(){this.container.showControlBar?($("."+PAPAYA_CONTROL_INCREMENT_BUTTON_CSS).prop("disabled",!0),$("."+PAPAYA_CONTROL_SWAP_BUTTON_CSS).prop("disabled",!0),$("."+PAPAYA_CONTROL_GOTO_CENTER_BUTTON_CSS).prop("disabled",!0),$("."+PAPAYA_CONTROL_GOTO_ORIGIN_BUTTON_CSS).prop("disabled",!0)):this.container.showControls&&($("#"+PAPAYA_CONTROL_MAIN_INCREMENT_BUTTON_CSS+this.container.containerIndex).css({display:"none"}),$("#"+PAPAYA_CONTROL_MAIN_DECREMENT_BUTTON_CSS+
  this.container.containerIndex).css({display:"none"}),$("#"+PAPAYA_CONTROL_MAIN_SWAP_BUTTON_CSS+this.container.containerIndex).css({display:"none"}),$("#"+PAPAYA_CONTROL_MAIN_GOTO_CENTER_BUTTON_CSS+this.container.containerIndex).css({display:"none"}),$("#"+PAPAYA_CONTROL_MAIN_GOTO_ORIGIN_BUTTON_CSS+this.container.containerIndex).css({display:"none"}));this.initialized=!1;this.loadingVolume=null;this.volume=new papaya.volume.Volume(this.container.display,this);this.screenVolumes=[];this.surfaces=[];
  this.lowerImageTop=this.lowerImageBot=this.lowerImageBot2=this.mainImage=this.sagittalSlice=this.coronalSlice=this.axialSlice=this.currentScreenVolume=this.surfaceView=null;this.viewerDim=0;this.currentCoord=new papaya.core.Coordinate(0,0,0);this.draggingSliceDir=this.longestDimSize=this.longestDim=0;this.hasSeries=this.isWindowControl=this.isDragging=!1;this.previousMousePosition=new papaya.core.Point;this.canvas.removeEventListener("mousemove",this.listenerMouseMove,!1);this.canvas.removeEventListener("mousedown",
  this.listenerMouseDown,!1);this.canvas.removeEventListener("mouseout",this.listenerMouseOut,!1);this.canvas.removeEventListener("mouseleave",this.listenerMouseLeave,!1);this.canvas.removeEventListener("mouseup",this.listenerMouseUp,!1);document.removeEventListener("keydown",this.listenerKeyDown,!0);document.removeEventListener("keyup",this.listenerKeyUp,!0);document.removeEventListener("contextmenu",this.listenerContextMenu,!1);this.canvas.removeEventListener("touchmove",this.listenerTouchMove,!1);
  this.canvas.removeEventListener("touchstart",this.listenerTouchStart,!1);this.canvas.removeEventListener("touchend",this.listenerTouchEnd,!1);this.canvas.removeEventListener("dblclick",this.listenerMouseDoubleClick,!1);this.removeScroll();this.updateTimerEvent=this.updateTimer=null;this.drawEmptyViewer();this.container.display&&this.container.display.drawEmptyDisplay();this.updateSliceSliderControl();this.container.toolbar.buildToolbar()};
  papaya.viewer.Viewer.prototype.getHeaderDescription=function(b){return this.screenVolumes[b||0].volume.header.toString()};papaya.viewer.Viewer.prototype.getImageDimensionsDescription=function(b){var a;a=this.screenVolumes[b].volume.header.orientation.orientation;b=this.screenVolumes[b].volume.header.imageDimensions;return"("+a.charAt(0)+", "+a.charAt(1)+", "+a.charAt(2)+") "+b.cols+" x "+b.rows+" x "+b.slices};
  papaya.viewer.Viewer.prototype.getVoxelDimensionsDescription=function(b){var a;a=this.screenVolumes[b].volume.header.orientation.orientation;b=this.screenVolumes[b].volume.header.voxelDimensions;return"("+a.charAt(0)+", "+a.charAt(1)+", "+a.charAt(2)+") "+papaya.utilities.StringUtils.formatNumber(b.colSize,!0)+" x "+papaya.utilities.StringUtils.formatNumber(b.rowSize,!0)+" x "+papaya.utilities.StringUtils.formatNumber(b.sliceSize,!0)+" "+b.getSpatialUnitString()};
  papaya.viewer.Viewer.prototype.getSeriesDimensionsDescription=function(b){return this.screenVolumes[b].volume.header.imageDimensions.timepoints.toString()};papaya.viewer.Viewer.prototype.getSeriesSizeDescription=function(b){b=this.screenVolumes[b].volume.header.voxelDimensions;return b.timeSize.toString()+" "+b.getTemporalUnitString()};papaya.viewer.Viewer.prototype.getFilename=function(b){return papaya.utilities.StringUtils.wordwrap(this.screenVolumes[b].volume.fileName,25,"<br />",!0)};
  papaya.viewer.Viewer.prototype.getSurfaceFilename=function(b){return papaya.utilities.StringUtils.wordwrap(this.surfaces[b].filename,25,"<br />",!0)};papaya.viewer.Viewer.prototype.getSurfaceNumPoints=function(b){return this.surfaces[b].numPoints};papaya.viewer.Viewer.prototype.getSurfaceNumTriangles=function(b){return this.surfaces[b].numTriangles};
  papaya.viewer.Viewer.prototype.getNiceFilename=function(b){b=this.screenVolumes[b].volume.fileName.replace(".nii","").replace(".gz","");b.length>papaya.viewer.Viewer.TITLE_MAX_LENGTH&&(b=b.substr(0,papaya.viewer.Viewer.TITLE_MAX_LENGTH-3)+"...");return b};papaya.viewer.Viewer.prototype.getFileLength=function(b){return papaya.utilities.StringUtils.getSizeString(this.screenVolumes[b].volume.fileLength)};
  papaya.viewer.Viewer.prototype.getByteTypeDescription=function(b){return this.screenVolumes[b].volume.header.imageType.numBytes+"-Byte "+this.screenVolumes[b].volume.header.imageType.getTypeDescription()};papaya.viewer.Viewer.prototype.getByteOrderDescription=function(b){return this.screenVolumes[b].volume.header.imageType.getOrderDescription()};papaya.viewer.Viewer.prototype.getCompressedDescription=function(b){return this.screenVolumes[b].volume.header.imageType.compressed?"Yes":"No"};
  papaya.viewer.Viewer.prototype.getOrientationDescription=function(b){return this.screenVolumes[b].volume.header.orientation.getOrientationDescription()};papaya.viewer.Viewer.prototype.getImageDescription=function(b){return papaya.utilities.StringUtils.wordwrap(this.screenVolumes[b].volume.header.imageDescription.notes,35,"<br />",!0)};papaya.viewer.Viewer.prototype.setCurrentScreenVol=function(b){this.currentScreenVolume=this.screenVolumes[b];this.updateWindowTitle()};
  papaya.viewer.Viewer.prototype.updateWindowTitle=function(){var b;this.initialized&&(b=this.getNiceFilename(this.getCurrentScreenVolIndex()),1<this.currentScreenVolume.volume.numTimepoints&&(b=b+" ("+(this.currentScreenVolume.currentTimepoint+1)+" of "+this.currentScreenVolume.volume.numTimepoints+")"),this.isZooming()&&(b=b+" "+this.getZoomString()),this.container.toolbar.updateTitleBar(b))};
  papaya.viewer.Viewer.prototype.getCurrentScreenVolIndex=function(){var b;for(b=0;b<this.screenVolumes.length;b+=1)if(this.screenVolumes[b]===this.currentScreenVolume)return b;return-1};papaya.viewer.Viewer.prototype.toggleWorldSpace=function(){this.worldSpace=!this.worldSpace;this.container.syncOverlaySeries&&this.reconcileOverlaySeriesPoint(this.currentScreenVolume)};papaya.viewer.Viewer.prototype.isSelected=function(b){return this.isSelectable()&&b===this.getCurrentScreenVolIndex()};
  papaya.viewer.Viewer.prototype.isSelectable=function(){return 1<this.screenVolumes.length};
  papaya.viewer.Viewer.prototype.processParams=function(b){b.worldSpace&&(this.worldSpace=!0);b.coordinate&&(this.initialCoordinate=b.coordinate);this.container.isDesktopMode()||(void 0!==b.showOrientation&&(this.container.preferences.showOrientation=b.showOrientation?"Yes":"No"),void 0!==b.smoothDisplay&&(this.container.preferences.smoothDisplay=b.smoothDisplay?"Yes":"No"),void 0!==b.radiological&&(this.container.preferences.radiological=b.radiological?"Yes":"No"),void 0!==b.showRuler&&(this.container.preferences.showRuler=
  b.showRuler?"Yes":"No"),void 0!==b.showSurfacePlanes&&(this.container.preferences.showSurfacePlanes=b.showSurfacePlanes?"Yes":"No"),void 0!==b.showSurfaceCrosshairs&&(this.container.preferences.showSurfaceCrosshairs=b.showSurfaceCrosshairs?"Yes":"No"))};papaya.viewer.Viewer.prototype.hasLoadedDTI=function(){return 1===this.screenVolumes.length&&this.screenVolumes[0].dti&&null===this.screenVolumes[0].dtiVolumeMod};
  papaya.viewer.Viewer.prototype.goToInitialCoordinate=function(){var b=new papaya.core.Coordinate;0<this.screenVolumes.length&&(null===this.initialCoordinate?b.setCoordinate(papayaFloorFast(this.volume.header.imageDimensions.xDim/2),papayaFloorFast(this.volume.header.imageDimensions.yDim/2),papayaFloorFast(this.volume.header.imageDimensions.zDim/2),!0):(this.worldSpace?this.getIndexCoordinateAtWorld(this.initialCoordinate[0],this.initialCoordinate[1],this.initialCoordinate[2],b):b.setCoordinate(this.initialCoordinate[0],
  this.initialCoordinate[1],this.initialCoordinate[2],!0),this.initialCoordinate=null),this.gotoCoordinate(b),this.container.display&&this.container.display.drawDisplay(this.currentCoord.x,this.currentCoord.y,this.currentCoord.z))};
  papaya.viewer.Viewer.prototype.getOrientationCertaintyColor=function(){var b=this.screenVolumes[0].volume.header.orientationCertainty;return b===papaya.volume.Header.ORIENTATION_CERTAINTY_LOW?papaya.viewer.Viewer.ORIENTATION_CERTAINTY_LOW_COLOR:b===papaya.volume.Header.ORIENTATION_CERTAINTY_HIGH?papaya.viewer.Viewer.ORIENTATION_CERTAINTY_HIGH_COLOR:papaya.viewer.Viewer.ORIENTATION_CERTAINTY_UNKNOWN_COLOR};papaya.viewer.Viewer.prototype.isUsingAtlas=function(b){return b===this.atlas.currentAtlas};
  papaya.viewer.Viewer.prototype.scrolled=function(b){var a;b=b||window.event;b.target==this.canvas&&(b.preventDefault&&b.preventDefault(),b.returnValue=!1,a="Increment Slice"===this.container.preferences.scrollBehavior,b=papaya.utilities.PlatformUtils.getScrollSign(b,!a),a?0>b?(this.mainImage.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_AXIAL?this.incrementAxial(!1,Math.abs(b)):this.mainImage.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_CORONAL?this.incrementCoronal(!1,Math.abs(b)):
  this.mainImage.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_SAGITTAL&&this.incrementSagittal(!1,Math.abs(b)),this.gotoCoordinate(this.currentCoord)):0<b&&(this.mainImage.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_AXIAL?this.incrementAxial(!0,Math.abs(b)):this.mainImage.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_CORONAL?this.incrementCoronal(!0,Math.abs(b)):this.mainImage.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_SAGITTAL&&this.incrementSagittal(!0,Math.abs(b)),
  this.gotoCoordinate(this.currentCoord)):0!==b&&(this.isZoomMode=!0,this.mainImage===this.surfaceView?(this.surfaceView.zoom+=-5*b*this.surfaceView.scaleFactor,this.drawViewer(!1,!0)):(this.mainImage.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_AXIAL?this.setZoomLocation(this.currentCoord.x,this.currentCoord.y,this.mainImage.sliceDirection):this.mainImage.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_CORONAL?this.setZoomLocation(this.currentCoord.x,this.currentCoord.z,this.mainImage.sliceDirection):
  this.mainImage.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_SAGITTAL&&this.setZoomLocation(this.currentCoord.y,this.currentCoord.z,this.mainImage.sliceDirection),this.setZoomFactor(this.zoomFactorPrevious+.1*b*this.zoomFactorPrevious)),this.zoomFactorPrevious=this.zoomFactor))};
  papaya.viewer.Viewer.prototype.incrementAxial=function(b,a){var c=this.volume.header.imageDimensions.zDim;void 0===a&&(a=1);b?(this.currentCoord.z+=a,this.currentCoord.z>=c&&(this.currentCoord.z=c-1)):(this.currentCoord.z-=a,0>this.currentCoord.z&&(this.currentCoord.z=0));this.gotoCoordinate(this.currentCoord)};
  papaya.viewer.Viewer.prototype.incrementCoronal=function(b,a){var c=this.volume.header.imageDimensions.yDim;void 0===a&&(a=1);b?(this.currentCoord.y+=a,this.currentCoord.y>=c&&(this.currentCoord.y=c-1)):(this.currentCoord.y-=a,0>this.currentCoord.y&&(this.currentCoord.y=0));this.gotoCoordinate(this.currentCoord)};
  papaya.viewer.Viewer.prototype.incrementSagittal=function(b,a){var c=this.volume.header.imageDimensions.xDim;void 0===a&&(a=1);b?(this.currentCoord.x-=a,0>this.currentCoord.x&&(this.currentCoord.x=0)):(this.currentCoord.x+=a,this.currentCoord.x>=c&&(this.currentCoord.x=c-1));this.gotoCoordinate(this.currentCoord)};
  papaya.viewer.Viewer.prototype.setZoomFactor=function(b){b>papaya.viewer.Viewer.ZOOM_FACTOR_MAX?b=papaya.viewer.Viewer.ZOOM_FACTOR_MAX:b<papaya.viewer.Viewer.ZOOM_FACTOR_MIN&&(b=papaya.viewer.Viewer.ZOOM_FACTOR_MIN);this.zoomFactor=b;1===this.zoomFactor&&(this.panAmountX=this.panAmountY=this.panAmountZ=0);this.axialSlice.updateZoomTransform(this.zoomFactor,this.zoomLocX,this.zoomLocY,this.panAmountX,this.panAmountY,this);this.coronalSlice.updateZoomTransform(this.zoomFactor,this.zoomLocX,this.zoomLocZ,
  this.panAmountX,this.panAmountZ,this);this.sagittalSlice.updateZoomTransform(this.zoomFactor,this.zoomLocY,this.zoomLocZ,this.panAmountY,this.panAmountZ,this);this.drawViewer(!1,!0);this.updateWindowTitle()};papaya.viewer.Viewer.prototype.getZoomString=function(){return parseInt(100*this.zoomFactor,10)+"%"};papaya.viewer.Viewer.prototype.isZooming=function(){return 1<this.zoomFactor};
  papaya.viewer.Viewer.prototype.setZoomLocation=function(){1===this.zoomFactor&&(this.zoomLocX=this.currentCoord.x,this.zoomLocY=this.currentCoord.y,this.zoomLocZ=this.currentCoord.z,this.axialSlice.updateZoomTransform(this.zoomFactor,this.zoomLocX,this.zoomLocY,this.panAmountX,this.panAmountY,this),this.coronalSlice.updateZoomTransform(this.zoomFactor,this.zoomLocX,this.zoomLocZ,this.panAmountX,this.panAmountZ,this),this.sagittalSlice.updateZoomTransform(this.zoomFactor,this.zoomLocY,this.zoomLocZ,
  this.panAmountY,this.panAmountZ,this),this.drawViewer(!1,!0))};
  papaya.viewer.Viewer.prototype.setStartPanLocation=function(b,a,c){1<this.zoomFactor&&(c===papaya.viewer.ScreenSlice.DIRECTION_AXIAL?(this.panLocX=b,this.panLocY=a,this.panLocZ=this.axialSlice.currentSlice):c===papaya.viewer.ScreenSlice.DIRECTION_CORONAL?(this.panLocX=b,this.panLocY=this.coronalSlice.currentSlice,this.panLocZ=a):c===papaya.viewer.ScreenSlice.DIRECTION_SAGITTAL&&(this.panLocX=this.sagittalSlice.currentSlice,this.panLocY=b,this.panLocZ=a))};
  papaya.viewer.Viewer.prototype.setCurrentPanLocation=function(b,a,c){1<this.zoomFactor&&(c===papaya.viewer.ScreenSlice.DIRECTION_AXIAL?(this.panAmountX+=b-this.panLocX,this.panAmountY+=a-this.panLocY,this.panAmountZ=0):c===papaya.viewer.ScreenSlice.DIRECTION_CORONAL?(this.panAmountX+=b-this.panLocX,this.panAmountY=0,this.panAmountZ+=a-this.panLocZ):c===papaya.viewer.ScreenSlice.DIRECTION_SAGITTAL&&(this.panAmountX=0,this.panAmountY+=b-this.panLocY,this.panAmountZ+=a-this.panLocZ),this.axialSlice.updateZoomTransform(this.zoomFactor,
  this.zoomLocX,this.zoomLocY,this.panAmountX,this.panAmountY,this),this.coronalSlice.updateZoomTransform(this.zoomFactor,this.zoomLocX,this.zoomLocZ,this.panAmountX,this.panAmountZ,this),this.sagittalSlice.updateZoomTransform(this.zoomFactor,this.zoomLocY,this.zoomLocZ,this.panAmountY,this.panAmountZ,this),this.drawViewer(!1,!0))};papaya.viewer.Viewer.prototype.isWorldMode=function(){return this.worldSpace};papaya.viewer.Viewer.prototype.isRadiologicalMode=function(){return"Yes"===this.container.preferences.radiological};
  papaya.viewer.Viewer.prototype.isCollapsable=function(){return this.container.collapsable};
  papaya.viewer.Viewer.prototype.mainSliderControlChanged=function(){this.mainImage.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_AXIAL?this.currentCoord.z=parseInt(this.mainSliderControl.val(),10):this.mainImage.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_CORONAL?this.currentCoord.y=parseInt(this.mainSliderControl.val(),10):this.mainImage.sliceDirection===papaya.viewer.ScreenSlice.DIRECTION_SAGITTAL&&(this.currentCoord.x=parseInt(this.mainSliderControl.val(),10));this.gotoCoordinate(this.currentCoord)};
  papaya.viewer.Viewer.prototype.axialSliderControlChanged=function(){this.currentCoord.z=parseInt(this.axialSliderControl.val(),10);this.gotoCoordinate(this.currentCoord)};papaya.viewer.Viewer.prototype.coronalSliderControlChanged=function(){this.currentCoord.y=parseInt(this.coronalSliderControl.val(),10);this.gotoCoordinate(this.currentCoord)};papaya.viewer.Viewer.prototype.sagittalSliderControlChanged=function(){this.currentCoord.x=parseInt(this.sagittalSliderControl.val(),10);this.gotoCoordinate(this.currentCoord)};
  papaya.viewer.Viewer.prototype.seriesSliderControlChanged=function(){this.currentScreenVolume.setTimepoint(parseInt(this.seriesSliderControl.val(),10));this.currentScreenVolume.isOverlay()&&this.container.syncOverlaySeries&&this.reconcileOverlaySeriesPoint(this.currentScreenVolume);this.timepointChanged()};
  papaya.viewer.Viewer.prototype.updateSliceSliderControl=function(){this.mainSliderControl&&this.doUpdateSliceSliderControl(this.mainSliderControl,this.mainImage.sliceDirection);this.axialSliderControl&&this.doUpdateSliceSliderControl(this.axialSliderControl,papaya.viewer.ScreenSlice.DIRECTION_AXIAL);this.coronalSliderControl&&this.doUpdateSliceSliderControl(this.coronalSliderControl,papaya.viewer.ScreenSlice.DIRECTION_CORONAL);this.sagittalSliderControl&&this.doUpdateSliceSliderControl(this.sagittalSliderControl,
  papaya.viewer.ScreenSlice.DIRECTION_SAGITTAL);this.seriesSliderControl&&this.doUpdateSliceSliderControl(this.seriesSliderControl,papaya.viewer.ScreenSlice.DIRECTION_TEMPORAL)};
  papaya.viewer.Viewer.prototype.doUpdateSliceSliderControl=function(b,a){this.initialized?(b.prop("disabled",!1),b.prop("min","0"),b.prop("step","1"),a===papaya.viewer.ScreenSlice.DIRECTION_AXIAL?(b.prop("max",(this.volume.header.imageDimensions.zDim-1).toString()),b.val(this.currentCoord.z)):a===papaya.viewer.ScreenSlice.DIRECTION_CORONAL?(b.prop("max",(this.volume.header.imageDimensions.yDim-1).toString()),b.val(this.currentCoord.y)):a===papaya.viewer.ScreenSlice.DIRECTION_SAGITTAL?(b.prop("max",
  (this.volume.header.imageDimensions.xDim-1).toString()),b.val(this.currentCoord.x)):a===papaya.viewer.ScreenSlice.DIRECTION_TEMPORAL&&(b.prop("max",(this.currentScreenVolume.volume.header.imageDimensions.timepoints-1).toString()),b.val(this.currentScreenVolume.currentTimepoint))):(b.prop("disabled",!0),b.prop("min","0"),b.prop("step","1"),b.prop("max","1"),b.val(0))};
  papaya.viewer.Viewer.prototype.incrementSeriesPoint=function(){this.currentScreenVolume.incrementTimepoint();this.currentScreenVolume.isOverlay()&&this.container.syncOverlaySeries&&this.reconcileOverlaySeriesPoint(this.currentScreenVolume);this.timepointChanged()};
  papaya.viewer.Viewer.prototype.decrementSeriesPoint=function(){this.currentScreenVolume.decrementTimepoint();this.currentScreenVolume.isOverlay()&&this.container.syncOverlaySeries&&this.reconcileOverlaySeriesPoint(this.currentScreenVolume);this.timepointChanged()};
  papaya.viewer.Viewer.prototype.reconcileOverlaySeriesPoint=function(b){var a,c;if(this.worldSpace)for(c=b.getCurrentTime(),a=1;a<this.screenVolumes.length;a+=1)this.screenVolumes[a]!==b&&this.screenVolumes[a].setCurrentTime(c);else for(c=b.currentTimepoint,a=1;a<this.screenVolumes.length;a+=1)this.screenVolumes[a]!==b&&this.screenVolumes[a].setTimepoint(c)};papaya.viewer.Viewer.prototype.hasParametricPair=function(b){return b?null!==this.screenVolumes[b].negativeScreenVol:!1};
  papaya.viewer.Viewer.prototype.getScreenVolumeIndex=function(b){var a;if(b)for(a=0;a<this.screenVolumes.length;a+=1)if(b===this.screenVolumes[a])return a;return-1};papaya.viewer.Viewer.prototype.getScreenVolumeByName=function(b){var a;for(a=0;a<this.screenVolumes.length;a+=1)if(b==this.screenVolumes[a].volume.fileName)return this.screenVolumes[a];return null};papaya.viewer.Viewer.prototype.isShowingRuler=function(){return"Yes"===this.container.preferences.showRuler};
  papaya.viewer.Viewer.prototype.isShowingOrientation=function(){return"Yes"===this.container.preferences.showOrientation};papaya.viewer.Viewer.prototype.isShowingCrosshairs=function(){return"Yes"===this.container.preferences.showCrosshairs};papaya.viewer.Viewer.prototype.isShowingSurfacePlanes=function(){return this.surfaceView&&this.surfaceView.showSurfacePlanes};papaya.viewer.Viewer.prototype.isShowingSurfaceCrosshairs=function(){return this.surfaceView&&this.surfaceView.showSurfaceCrosshairs};
  papaya.viewer.Viewer.prototype.restart=function(b,a,c,d){this.resetViewer();this.container.toolbar.updateImageButtons();this.loadImage(b,a,c,d)};papaya.viewer.Viewer.prototype.removeOverlay=function(b){var a;b=this.container.viewer.screenVolumes[b];a=b.negativeScreenVol;this.closeOverlayByRef(b);this.container.combineParametric&&this.closeOverlayByRef(a);this.drawViewer(!0,!1)};
  papaya.viewer.Viewer.prototype.toggleOverlay=function(b){var a;b=this.container.viewer.screenVolumes[b];b.hidden=!b.hidden;a=b.negativeScreenVol;this.container.combineParametric&&a&&(a.hidden=!a.hidden);this.drawViewer(!0,!1);return b.hidden};
  papaya.viewer.Viewer.prototype.addParametric=function(b){b=this.container.viewer.screenVolumes[b];var a;null===b.negativeScreenVol&&(this.screenVolumes[this.screenVolumes.length]=a=new papaya.viewer.ScreenVolume(b.volume,{},papaya.viewer.ColorTable.PARAMETRIC_COLOR_TABLES[1].name,!1,!0,this.currentCoord),b.negativeScreenVol=a,this.setCurrentScreenVol(this.screenVolumes.length-1),this.drawViewer(!0,!1),this.container.toolbar.buildToolbar(),this.container.toolbar.updateImageButtons())};"use strict";
  papaya=papaya||{};papaya.viewer=papaya.viewer||{};
  var shaderVert="precision mediump float;\nattribute vec3 aVertexPosition;\nattribute vec3 aVertexNormal;\nattribute vec4 aVertexColor;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nuniform mat3 uNMatrix;\nuniform vec3 uAmbientColor;\nuniform vec3 uPointLightingLocation;\nuniform vec3 uPointLightingColor;\nuniform bool uActivePlane;\nuniform bool uActivePlaneEdge;\nuniform bool uCrosshairs;\nuniform bool uColors;\nuniform bool uColorPicking;\nuniform bool uTrianglePicking;\nuniform bool uColorSolid;\nuniform vec4 uSolidColor;\nuniform bool uOrientationText;\nuniform bool uRuler;\nuniform float uAlpha;\nvarying vec3 vLightWeighting;\nvarying lowp vec4 vColor;\nvarying vec2 vTextureCoord;\nvoid main(void) {\n    vec4 mvPosition = uMVMatrix * vec4(aVertexPosition, 1.0);\n    gl_Position = uPMatrix * mvPosition;\n    if (!uActivePlane && !uActivePlaneEdge && !uCrosshairs && !uOrientationText && !uRuler) {\n       vec3 lightDirection = normalize(uPointLightingLocation - mvPosition.xyz);\n       vec3 transformedNormal = uNMatrix * aVertexNormal;\n       float directionalLightWeighting = max(dot(transformedNormal, lightDirection), 0.0);\n       vLightWeighting = uAmbientColor + uPointLightingColor * directionalLightWeighting;\n       if (uColors) {\n           vColor = aVertexColor;\n       }\n   }\n   if (uColorSolid) {\n       vColor = uSolidColor;\n   }\n   if (uOrientationText) {\n       vTextureCoord = aTextureCoord;\n   }\n}",shaderFrag=
  "precision mediump float;\nuniform bool uActivePlane;\nuniform bool uActivePlaneEdge;\nuniform bool uCrosshairs;\nuniform bool uColors;\nuniform bool uColorPicking;\nuniform bool uTrianglePicking;\nuniform bool uColorSolid;\nuniform vec4 uSolidColor;\nuniform bool uOrientationText;\nuniform bool uRuler;\nuniform sampler2D uSampler;\nuniform float uAlpha;\nvarying vec3 vLightWeighting;\nvarying lowp vec4 vColor;\nvarying vec2 vTextureCoord;\nvec4 packFloatToVec4i(const float value) {\n   const vec4 bitSh = vec4(256.0*256.0*256.0, 256.0*256.0, 256.0, 1.0);\n   const vec4 bitMsk = vec4(0.0, 1.0/256.0, 1.0/256.0, 1.0/256.0);\n   vec4 res = fract(value * bitSh);\n   res -= res.xxyz * bitMsk;\n   return res;\n}\nvoid main(void) {\n    vec4 fragmentColor = vec4(1.0, 1.0, 1.0, 1.0);\n    if (uColors) {\n       fragmentColor = vColor;\n    } else if (uColorSolid) {\n       fragmentColor = vColor;\n    }\n    if (uActivePlane) {\n       gl_FragColor = vec4(0.10980392156863, 0.52549019607843, 0.93333333333333, 0.5);\n    } else if (uActivePlaneEdge) {\n       gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);\n    } else if (uRuler) {\n       gl_FragColor = vec4(1.0, 0.078, 0.576, 1.0);\n    } else if (uOrientationText) {\n        vec4 textureColor = texture2D(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));\n        if (textureColor.a > 0.0) {\n           gl_FragColor = vec4(textureColor.rgb, textureColor.a);\n        } else {\n           gl_FragColor = vec4(textureColor.rgb, 0);\n        }\n    } else if (uCrosshairs) {\n       gl_FragColor = vec4(0.10980392156863, 0.52549019607843, 0.93333333333333, 1.0);\n    } else if (uColorPicking) {\n       gl_FragColor = vec4(fragmentColor.r, fragmentColor.g, fragmentColor.b, 1);\n    } else if (uTrianglePicking) {\n       gl_FragColor = packFloatToVec4i(gl_FragCoord.z);\n    } else {\n       gl_FragColor = vec4(fragmentColor.rgb * vLightWeighting, uAlpha);\n    }\n}";
  papaya.viewer.ScreenSurface=papaya.viewer.ScreenSurface||function(b,a,c,d){this.shaderProgram=null;this.mvMatrix=mat4.create();this.pMatrix=mat4.create();this.pMatrix1=mat4.create();this.centerMat=mat4.create();this.centerMatInv=mat4.create();this.tempMat=mat4.create();this.tempMat2=mat4.create();this.pickingBuffer=null;this.initialized=!1;this.screenDim=this.screenOffsetY=this.screenOffsetX=0;this.screenTransform=[[1,0,0],[0,1,0],[0,0,1]];this.volume=b;this.surfaces=a;this.viewer=c;this.currentCoord=
  c.currentCoord;this.zoom=0;this.sliceDirection=papaya.viewer.ScreenSlice.DIRECTION_SURFACE;this.dynamicStartY=this.dynamicStartX=-1;this.activePlaneVertsAxial=new Float32Array(12);this.activePlaneVertsCoronal=new Float32Array(12);this.activePlaneVertsSagittal=new Float32Array(12);this.activePlaneVertsAxialEdges=new Float32Array(24);this.activePlaneVertsCoronalEdges=new Float32Array(24);this.activePlaneVertsSagittalEdges=new Float32Array(24);this.orientationVerts=new Float32Array(24);this.crosshairLineVertsX=
  new Float32Array(6);this.crosshairLineVertsY=new Float32Array(6);this.crosshairLineVertsZ=new Float32Array(6);this.mouseRotDragX=this.clearTransform([]);this.mouseRotDragY=this.clearTransform([]);this.mouseRotDrag=this.clearTransform([]);this.mouseTransDrag=this.clearTransform([]);this.mouseRotCurrent=this.clearTransform([]);this.mouseTransCurrent=this.clearTransform([]);this.mouseRotTemp=this.clearTransform([]);this.mouseTransTemp=this.clearTransform([]);this.crosshairLineZBuffer=this.crosshairLineZBuffer=
  this.crosshairLineYBuffer=this.crosshairLineXBuffer=this.orientationBuffer=this.activePlaneSagittalEdgesBuffer=this.activePlaneCoronalEdgesBuffer=this.activePlaneAxialEdgesBuffer=this.activePlaneSagittalBuffer=this.activePlaneCoronalBuffer=this.activePlaneAxialBuffer=null;this.xSize=this.volume.header.voxelDimensions.xSize;this.xDim=this.volume.header.imageDimensions.xDim;this.xHalf=this.xDim*this.xSize/2;this.ySize=this.volume.header.voxelDimensions.ySize;this.yDim=this.volume.header.imageDimensions.yDim;
  this.yHalf=this.yDim*this.ySize/2;this.zSize=this.volume.header.voxelDimensions.zSize;this.zDim=this.volume.header.imageDimensions.zDim;this.zHalf=this.zDim*this.zSize/2;this.showSurfacePlanes="Yes"===c.container.preferences.showSurfacePlanes;this.backgroundColor=papaya.viewer.ScreenSurface.DEFAULT_BACKGROUND;this.pickLocY=this.pickLocX=0;this.needsPickColor=!1;this.pickedColor=null;this.needsPick=!1;this.pickedCoordinate=null;this.scaleFactor=1;this.rulerPoints=this.orientationContext=this.orientationCanvas=
  this.orientationTextureCoordBuffer=this.orientationTextureCoords=this.orientationTexture=null;this.grabbedRulerPoint=-1;this.processParams(d)};papaya.viewer.ScreenSurface.DEFAULT_ORIENTATION=[-.015552218963737041,.09408106275544359,-.9954430697501158,0,-.9696501263313991,.24152923619118966,.03797658948646743,0,.24400145970103732,.965822108594413,.0874693978960848,0,0,0,0,1];papaya.viewer.ScreenSurface.MOUSE_SENSITIVITY=.3;papaya.viewer.ScreenSurface.DEFAULT_BACKGROUND=[.5,.5,.5];
  papaya.viewer.ScreenSurface.TEXT_SIZE=50;papaya.viewer.ScreenSurface.ORIENTATION_SIZE=10;papaya.viewer.ScreenSurface.RULER_COLOR=[1,.078,.576];papaya.viewer.ScreenSurface.RULER_NUM_LINES=25;papaya.viewer.ScreenSurface.RULER_RADIUS=1;papaya.viewer.ScreenSurface.EXT_INT=null;papaya.viewer.ScreenSurface.makeShader=function(b,a,c){c=b.createShader(c);b.shaderSource(c,a);b.compileShader(c);return b.getShaderParameter(c,b.COMPILE_STATUS)?c:(console.log(b.getShaderInfoLog(c)),null)};
  papaya.viewer.ScreenSurface.initShaders=function(b){var a=papaya.viewer.ScreenSurface.makeShader(b,shaderVert,b.VERTEX_SHADER),c=papaya.viewer.ScreenSurface.makeShader(b,shaderFrag,b.FRAGMENT_SHADER),d=b.createProgram();b.attachShader(d,c);b.attachShader(d,a);b.linkProgram(d);b.getProgramParameter(d,b.LINK_STATUS)||console.log("Could not initialise shaders");b.useProgram(d);d.vertexPositionAttribute=b.getAttribLocation(d,"aVertexPosition");b.enableVertexAttribArray(d.vertexPositionAttribute);d.vertexNormalAttribute=
  b.getAttribLocation(d,"aVertexNormal");b.enableVertexAttribArray(d.vertexNormalAttribute);d.vertexColorAttribute=b.getAttribLocation(d,"aVertexColor");d.textureCoordAttribute=b.getAttribLocation(d,"aTextureCoord");d.pMatrixUniform=b.getUniformLocation(d,"uPMatrix");d.mvMatrixUniform=b.getUniformLocation(d,"uMVMatrix");d.nMatrixUniform=b.getUniformLocation(d,"uNMatrix");d.ambientColorUniform=b.getUniformLocation(d,"uAmbientColor");d.pointLightingLocationUniform=b.getUniformLocation(d,"uPointLightingLocation");
  d.pointLightingColorUniform=b.getUniformLocation(d,"uPointLightingColor");d.activePlane=b.getUniformLocation(d,"uActivePlane");d.activePlaneEdge=b.getUniformLocation(d,"uActivePlaneEdge");d.colorPicking=b.getUniformLocation(d,"uColorPicking");d.trianglePicking=b.getUniformLocation(d,"uTrianglePicking");d.crosshairs=b.getUniformLocation(d,"uCrosshairs");d.hasColors=b.getUniformLocation(d,"uColors");d.hasSolidColor=b.getUniformLocation(d,"uColorSolid");d.solidColor=b.getUniformLocation(d,"uSolidColor");
  d.orientationText=b.getUniformLocation(d,"uOrientationText");d.samplerUniform=b.getUniformLocation(d,"uSampler");d.ruler=b.getUniformLocation(d,"uRuler");d.alphaVal=b.getUniformLocation(d,"uAlpha");return d};
  papaya.viewer.ScreenSurface.prototype.initialize=function(){var b;this.initialized=!0;this.canvas=document.createElement("canvas");this.canvas.width=this.screenDim;this.canvas.height=this.screenDim;this.context=this.canvas.getContext("webgl")||this.canvas.getContext("experimental-webgl");this.context.viewportWidth=this.canvas.width;this.context.viewportHeight=this.canvas.height;this.zoom=this.volume.header.imageDimensions.yDim*this.volume.header.voxelDimensions.ySize*1.5;this.initPerspective();this.shaderProgram=
  papaya.viewer.ScreenSurface.initShaders(this.context);for(b=0;b<this.surfaces.length;b+=1)this.initBuffers(this.context,this.surfaces[b]);this.calculateScaleFactor();this.initActivePlaneBuffers(this.context);this.initRulerBuffers(this.context);mat4.multiply(this.centerMat,papaya.viewer.ScreenSurface.DEFAULT_ORIENTATION,this.tempMat);mat4.multiply(this.tempMat,this.centerMatInv,this.mouseRotCurrent);papaya.viewer.ScreenSurface.EXT_INT=this.context.getExtension("OES_element_index_uint");papaya.viewer.ScreenSurface.EXT_INT||
  console.log("This browser does not support OES_element_index_uint extension!");this.updateBackgroundColor()};papaya.viewer.ScreenSurface.prototype.calculateScaleFactor=function(){var b=this.ySize*this.yDim,a=this.zSize*this.zDim,c=this.xSize*this.xDim;b>c&&(c=b);a>c&&(c=a);this.scaleFactor=c/256};
  papaya.viewer.ScreenSurface.prototype.resize=function(b){this.initialized||this.initialize();this.screenDim=b;this.canvas.width=this.screenDim;this.canvas.height=this.screenDim;this.context.viewportWidth=this.canvas.width;this.context.viewportHeight=this.canvas.height};
  papaya.viewer.ScreenSurface.prototype.applyMatrixUniforms=function(b){b.uniformMatrix4fv(this.shaderProgram.pMatrixUniform,!1,this.pMatrix);b.uniformMatrix4fv(this.shaderProgram.mvMatrixUniform,!1,this.mvMatrix);var a=mat3.create();mat4.toInverseMat3(this.mvMatrix,a);mat3.transpose(a);b.uniformMatrix3fv(this.shaderProgram.nMatrixUniform,!1,a)};papaya.viewer.ScreenSurface.prototype.draw=function(){0<this.surfaces.length&&(this.initialized||this.initialize(),this.drawScene(this.context))};
  papaya.viewer.ScreenSurface.prototype.initBuffers=function(b,a){a.pointsBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,a.pointsBuffer);b.bufferData(b.ARRAY_BUFFER,a.pointData,b.STATIC_DRAW);a.pointsBuffer.itemSize=3;a.pointsBuffer.numItems=a.numPoints;a.normalsBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,a.normalsBuffer);b.bufferData(b.ARRAY_BUFFER,a.normalsData,b.STATIC_DRAW);a.normalsBuffer.itemSize=3;a.normalsBuffer.numItems=a.numPoints;a.colorsData&&(a.colorsBuffer=b.createBuffer(),
  b.bindBuffer(b.ARRAY_BUFFER,a.colorsBuffer),b.bufferData(b.ARRAY_BUFFER,a.colorsData,b.STATIC_DRAW),a.colorsBuffer.itemSize=4,a.colorsBuffer.numItems=a.numPoints);a.trianglesBuffer=b.createBuffer();b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,a.trianglesBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,a.triangleData,b.STATIC_DRAW);a.trianglesBuffer.itemSize=1;a.trianglesBuffer.numItems=3*a.numTriangles};
  papaya.viewer.ScreenSurface.prototype.initOrientationBuffers=function(b){this.makeOrientedTextSquare();this.orientationBuffer=b.createBuffer();this.orientationBuffer.itemSize=3;this.orientationBuffer.numItems=4;this.orientationTextureCoordBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,this.orientationTextureCoordBuffer);this.orientationTextureCoords=[0,1,0,0,1,1,1,0];b.bufferData(b.ARRAY_BUFFER,new Float32Array(this.orientationTextureCoords),b.STATIC_DRAW);this.orientationTextureCoordBuffer.itemSize=
  2;this.orientationTextureCoordBuffer.numItems=4};
  papaya.viewer.ScreenSurface.prototype.initActivePlaneBuffers=function(b){this.updateActivePlanes();this.activePlaneAxialBuffer=b.createBuffer();this.activePlaneAxialBuffer.itemSize=3;this.activePlaneAxialBuffer.numItems=4;this.activePlaneCoronalBuffer=b.createBuffer();this.activePlaneCoronalBuffer.itemSize=3;this.activePlaneCoronalBuffer.numItems=4;this.activePlaneSagittalBuffer=b.createBuffer();this.activePlaneSagittalBuffer.itemSize=3;this.activePlaneSagittalBuffer.numItems=4;this.activePlaneAxialEdgesBuffer=
  b.createBuffer();this.activePlaneAxialEdgesBuffer.itemSize=3;this.activePlaneAxialEdgesBuffer.numItems=8;this.activePlaneCoronalEdgesBuffer=b.createBuffer();this.activePlaneCoronalEdgesBuffer.itemSize=3;this.activePlaneCoronalEdgesBuffer.numItems=8;this.activePlaneSagittalEdgesBuffer=b.createBuffer();this.activePlaneSagittalEdgesBuffer.itemSize=3;this.activePlaneSagittalEdgesBuffer.numItems=8;this.crosshairLineXBuffer=b.createBuffer();this.crosshairLineXBuffer.itemSize=3;this.crosshairLineXBuffer.numItems=
  2;this.crosshairLineYBuffer=b.createBuffer();this.crosshairLineYBuffer.itemSize=3;this.crosshairLineYBuffer.numItems=2;this.crosshairLineZBuffer=b.createBuffer();this.crosshairLineZBuffer.itemSize=3;this.crosshairLineZBuffer.numItems=2};
  papaya.viewer.ScreenSurface.prototype.initRulerBuffers=function(b){this.rulerPointData=this.makeSphere(papaya.viewer.ScreenSurface.RULER_NUM_LINES,papaya.viewer.ScreenSurface.RULER_NUM_LINES,papaya.viewer.ScreenSurface.RULER_RADIUS*this.scaleFactor);this.sphereVertexPositionBuffer=b.createBuffer();this.sphereVertexPositionBuffer.itemSize=3;this.sphereVertexPositionBuffer.numItems=this.rulerPointData.vertices.length/3;this.sphereNormalsPositionBuffer=b.createBuffer();this.sphereNormalsPositionBuffer.itemSize=
  3;this.sphereNormalsPositionBuffer.numItems=this.rulerPointData.normals.length/3;this.sphereVertexIndexBuffer=b.createBuffer();this.sphereVertexIndexBuffer.itemSize=1;this.sphereVertexIndexBuffer.numItems=this.rulerPointData.indices.length;this.rulerLineBuffer=b.createBuffer();this.rulerLineBuffer.itemSize=3;this.rulerLineBuffer.numItems=2};
  papaya.viewer.ScreenSurface.prototype.initPerspective=function(){mat4.perspective(45,1,10,1E5,this.pMatrix1);this.eye=new vec3.create;this.eye[0]=0;this.eye[1]=0;this.center=new vec3.create;this.centerWorld=new papaya.core.Coordinate;this.viewer.getWorldCoordinateAtIndex(parseInt(this.xDim/2,10),parseInt(this.yDim/2,10),parseInt(this.zDim/2,10),this.centerWorld);this.center[0]=this.centerWorld.x;this.center[1]=this.centerWorld.y;this.center[2]=this.centerWorld.z;mat4.identity(this.centerMat);mat4.translate(this.centerMat,
  [this.center[0],this.center[1],this.center[2]]);mat4.identity(this.centerMatInv);mat4.translate(this.centerMatInv,[-this.center[0],-this.center[1],-this.center[2]]);this.up=new vec3.create;this.up[0]=0;this.up[1]=1;this.up[2]=0};papaya.viewer.ScreenSurface.prototype.updatePerspective=function(){var b;this.eye[2]=this.zoom;b=mat4.lookAt(this.eye,this.center,this.up);mat4.multiply(this.pMatrix1,b,this.pMatrix)};
  papaya.viewer.ScreenSurface.prototype.unpackFloatFromVec4i=function(b){var a=[1/16777216,1/65536,1/256,1];return b[0]*a[0]+b[1]*a[1]+b[2]*a[2]+b[3]*a[3]};papaya.viewer.ScreenSurface.prototype.hasTranslucentSurfaces=function(){var b;for(b=0;b<this.surfaces.length;b+=1)if(1>this.surfaces[b].alpha)return!0;return!1};
  papaya.viewer.ScreenSurface.prototype.drawScene=function(b){var a,c,d;c=this.hasTranslucentSurfaces();b.clearColor(this.backgroundColor[0],this.backgroundColor[1],this.backgroundColor[2],1);b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT);b.viewport(0,0,b.viewportWidth,b.viewportHeight);mat4.identity(this.mvMatrix);mat4.multiply(this.mouseRotDrag,this.mouseRotCurrent,this.mouseRotTemp);mat4.multiply(this.mouseTransDrag,this.mouseTransCurrent,this.mouseTransTemp);mat4.multiply(this.mouseTransTemp,this.mouseRotTemp,
  this.tempMat);mat4.set(this.tempMat,this.mvMatrix);this.updatePerspective();this.applyMatrixUniforms(b);b.uniform3f(this.shaderProgram.ambientColorUniform,.2,.2,.2);b.uniform3f(this.shaderProgram.pointLightingLocationUniform,0,0,300*this.scaleFactor);b.uniform3f(this.shaderProgram.pointLightingColorUniform,.8,.8,.8);b.uniform1i(this.shaderProgram.orientationText,0);b.uniform1i(this.shaderProgram.activePlane,0);b.uniform1i(this.shaderProgram.activePlaneEdge,0);b.uniform1i(this.shaderProgram.crosshairs,
  0);b.uniform1i(this.shaderProgram.hasColors,0);b.uniform1i(this.shaderProgram.colorPicking,0);b.uniform1i(this.shaderProgram.trianglePicking,0);if(this.needsPick){if(b.uniform1i(this.shaderProgram.trianglePicking,1),null===this.pickingBuffer||this.pickingBuffer.length!==b.viewportWidth*b.viewportHeight*4)this.pickingBuffer=new Uint8Array(b.viewportWidth*b.viewportHeight*4)}else this.needsPickColor&&(b.uniform1i(this.shaderProgram.colorPicking,1),null===this.pickingBuffer||this.pickingBuffer.length!==
  b.viewportWidth*b.viewportHeight*4)&&(this.pickingBuffer=new Uint8Array(b.viewportWidth*b.viewportHeight*4));b.enable(b.DEPTH_TEST);for(a=0;a<this.surfaces.length;a+=1)this.renderSurface(b,a,1>this.surfaces[a].alpha,!0,!1);b.uniform1i(this.shaderProgram.hasSolidColor,0);b.uniform1i(this.shaderProgram.hasColors,0);if(this.needsPick)this.needsPick=!1,this.pickedCoordinate=this.findPickedCoordinate(b,this.pickLocX,this.pickLocY),b.uniform1i(this.shaderProgram.trianglePicking,0);else if(this.needsPickColor)this.needsPickColor=
  !1,this.pickedColor=this.findPickedColor(b),b.uniform1i(this.shaderProgram.colorPicking,0);else{this.showSurfacePlanes&&(this.needsUpdateActivePlanes&&(this.needsUpdateActivePlanes=!1,this.bindActivePlanes(b)),b.depthMask(!1),b.uniform1i(this.shaderProgram.activePlane,1),b.enable(b.BLEND),b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA),b.bindBuffer(b.ARRAY_BUFFER,this.activePlaneAxialBuffer),b.vertexAttribPointer(this.shaderProgram.vertexPositionAttribute,this.activePlaneAxialBuffer.itemSize,b.FLOAT,
  !1,0,0),b.drawArrays(b.TRIANGLE_STRIP,0,4),b.bindBuffer(b.ARRAY_BUFFER,this.activePlaneCoronalBuffer),b.vertexAttribPointer(this.shaderProgram.vertexPositionAttribute,this.activePlaneCoronalBuffer.itemSize,b.FLOAT,!1,0,0),b.drawArrays(b.TRIANGLE_STRIP,0,4),b.bindBuffer(b.ARRAY_BUFFER,this.activePlaneSagittalBuffer),b.vertexAttribPointer(this.shaderProgram.vertexPositionAttribute,this.activePlaneSagittalBuffer.itemSize,b.FLOAT,!1,0,0),b.drawArrays(b.TRIANGLE_STRIP,0,4),b.depthMask(!0),b.disable(b.BLEND),
  b.uniform1i(this.shaderProgram.activePlane,0),b.uniform1i(this.shaderProgram.activePlaneEdge,1),b.lineWidth(this.isMainView()?3:2),b.bindBuffer(b.ARRAY_BUFFER,this.activePlaneAxialEdgesBuffer),b.vertexAttribPointer(this.shaderProgram.vertexPositionAttribute,this.activePlaneAxialEdgesBuffer.itemSize,b.FLOAT,!1,0,0),b.drawArrays(b.LINES,0,8),b.bindBuffer(b.ARRAY_BUFFER,this.activePlaneCoronalEdgesBuffer),b.vertexAttribPointer(this.shaderProgram.vertexPositionAttribute,this.activePlaneCoronalEdgesBuffer.itemSize,
  b.FLOAT,!1,0,0),b.drawArrays(b.LINES,0,8),b.bindBuffer(b.ARRAY_BUFFER,this.activePlaneSagittalEdgesBuffer),b.vertexAttribPointer(this.shaderProgram.vertexPositionAttribute,this.activePlaneSagittalEdgesBuffer.itemSize,b.FLOAT,!1,0,0),b.drawArrays(b.LINES,0,8),b.uniform1i(this.shaderProgram.activePlaneEdge,0));this.viewer.isShowingCrosshairs()&&(this.viewer.mainImage!==this||this.viewer.toggleMainCrosshairs)&&(this.needsUpdateActivePlanes&&(this.needsUpdateActivePlanes=!1,this.bindActivePlanes(b)),
  b.uniform1i(this.shaderProgram.crosshairs,1),b.lineWidth(this.isMainView()?3:2),b.bindBuffer(b.ARRAY_BUFFER,this.crosshairLineXBuffer),b.vertexAttribPointer(this.shaderProgram.vertexPositionAttribute,this.crosshairLineXBuffer.itemSize,b.FLOAT,!1,0,0),b.drawArrays(b.LINES,0,2),b.bindBuffer(b.ARRAY_BUFFER,this.crosshairLineYBuffer),b.vertexAttribPointer(this.shaderProgram.vertexPositionAttribute,this.crosshairLineYBuffer.itemSize,b.FLOAT,!1,0,0),b.drawArrays(b.LINES,0,2),b.bindBuffer(b.ARRAY_BUFFER,
  this.crosshairLineZBuffer),b.vertexAttribPointer(this.shaderProgram.vertexPositionAttribute,this.crosshairLineZBuffer.itemSize,b.FLOAT,!1,0,0),b.drawArrays(b.LINES,0,2),b.uniform1i(this.shaderProgram.crosshairs,0));b.enable(b.DEPTH_TEST);for(a=0;a<this.surfaces.length;a+=1)c&&this.renderSurface(b,a,1>this.surfaces[a].alpha,!1,!0);this.viewer.mainImage===this.viewer.surfaceView&&"Yes"===this.viewer.container.preferences.showOrientation&&(a=this.currentCoord.x+(this.xDim/2-this.volume.header.origin.x),
  c=this.yDim-this.currentCoord.y-(this.yDim/2-this.volume.header.origin.y),d=this.zDim-this.currentCoord.z-(this.zDim/2-this.volume.header.origin.z),this.drawOrientedText(b,"S",papaya.viewer.ScreenSurface.TEXT_SIZE,[a*this.xSize-this.xHalf,c*this.ySize-this.yHalf,this.zHalf+papaya.viewer.ScreenSurface.ORIENTATION_SIZE*this.scaleFactor-(this.zDim/2-this.volume.header.origin.z)*this.zSize]),this.drawOrientedText(b,"I",papaya.viewer.ScreenSurface.TEXT_SIZE,[a*this.xSize-this.xHalf,c*this.ySize-this.yHalf,
  -this.zHalf-papaya.viewer.ScreenSurface.ORIENTATION_SIZE*this.scaleFactor-(this.zDim/2-this.volume.header.origin.z)*this.zSize]),this.drawOrientedText(b,"P",papaya.viewer.ScreenSurface.TEXT_SIZE,[a*this.xSize-this.xHalf,-this.yHalf-papaya.viewer.ScreenSurface.ORIENTATION_SIZE*this.scaleFactor-(this.yDim/2-this.volume.header.origin.y)*this.ySize,d*this.zSize-this.zHalf]),this.drawOrientedText(b,"A",papaya.viewer.ScreenSurface.TEXT_SIZE,[a*this.xSize-this.xHalf,this.yHalf+papaya.viewer.ScreenSurface.ORIENTATION_SIZE*
  this.scaleFactor-(this.yDim/2-this.volume.header.origin.y)*this.ySize,d*this.zSize-this.zHalf]),this.drawOrientedText(b,"L",papaya.viewer.ScreenSurface.TEXT_SIZE,[-this.xHalf-papaya.viewer.ScreenSurface.ORIENTATION_SIZE*this.scaleFactor+(this.xDim/2-this.volume.header.origin.x)*this.xSize,c*this.ySize-this.yHalf,d*this.zSize-this.zHalf]),this.drawOrientedText(b,"R",papaya.viewer.ScreenSurface.TEXT_SIZE,[this.xHalf+papaya.viewer.ScreenSurface.ORIENTATION_SIZE*this.scaleFactor+(this.xDim/2-this.volume.header.origin.x)*
  this.xSize,c*this.ySize-this.yHalf,d*this.zSize-this.zHalf]));"Yes"===this.viewer.container.preferences.showRuler?this.isMainView()&&this.drawRuler(b):this.rulerPoints=null}b.disable(b.DEPTH_TEST)};
  papaya.viewer.ScreenSurface.prototype.renderSurface=function(b,a,c,d,e){b.uniform1f(this.shaderProgram.alphaVal,this.surfaces[a].alpha);c?d?(b.enable(b.BLEND),b.enable(b.CULL_FACE),b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA),b.frontFace(b.CCW),b.cullFace(b.FRONT),b.uniform3f(this.shaderProgram.ambientColorUniform,0,0,0),b.uniform3f(this.shaderProgram.pointLightingLocationUniform,0,0,-300*this.scaleFactor)):e&&(b.enable(b.BLEND),b.enable(b.CULL_FACE),b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA),
  b.frontFace(b.CCW),b.cullFace(b.BACK),b.uniform3f(this.shaderProgram.ambientColorUniform,.2,.2,.2),b.uniform3f(this.shaderProgram.pointLightingLocationUniform,0,0,300*this.scaleFactor)):(b.uniform3f(this.shaderProgram.ambientColorUniform,.2,.2,.2),b.uniform3f(this.shaderProgram.pointLightingLocationUniform,0,0,300*this.scaleFactor));b.uniform1i(this.shaderProgram.hasSolidColor,0);b.uniform1i(this.shaderProgram.hasColors,0);this.surfaces[a].solidColor&&(b.uniform1i(this.shaderProgram.hasSolidColor,
  1),b.uniform4f(this.shaderProgram.solidColor,this.surfaces[a].solidColor[0],this.surfaces[a].solidColor[1],this.surfaces[a].solidColor[2],1));b.bindBuffer(b.ARRAY_BUFFER,this.surfaces[a].pointsBuffer);b.vertexAttribPointer(this.shaderProgram.vertexPositionAttribute,this.surfaces[a].pointsBuffer.itemSize,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,this.surfaces[a].normalsBuffer);b.vertexAttribPointer(this.shaderProgram.vertexNormalAttribute,this.surfaces[a].normalsBuffer.itemSize,b.FLOAT,!1,0,0);this.surfaces[a].colorsData?
  (b.uniform1i(this.shaderProgram.hasColors,1),b.bindBuffer(b.ARRAY_BUFFER,this.surfaces[a].colorsBuffer),b.enableVertexAttribArray(this.shaderProgram.vertexColorAttribute),b.vertexAttribPointer(this.shaderProgram.vertexColorAttribute,this.surfaces[a].colorsBuffer.itemSize,b.FLOAT,!1,0,0)):b.disableVertexAttribArray(this.shaderProgram.vertexColorAttribute);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,this.surfaces[a].trianglesBuffer);b.drawElements(b.TRIANGLES,this.surfaces[a].trianglesBuffer.numItems,b.UNSIGNED_INT,
  0);c&&(d||e)&&(b.disable(b.BLEND),b.disable(b.CULL_FACE))};
  papaya.viewer.ScreenSurface.prototype.drawRuler=function(b){var a=!0;null===this.rulerPoints&&(this.rulerPoints=new Float32Array(6),a=this.findInitialRulerPoints(b),this.drawScene(b));a&&(b.uniform1i(this.shaderProgram.ruler,1),this.drawRulerPoint(b,this.rulerPoints[0],this.rulerPoints[1],this.rulerPoints[2]),this.drawRulerPoint(b,this.rulerPoints[3],this.rulerPoints[4],this.rulerPoints[5]),b.bindBuffer(b.ARRAY_BUFFER,this.rulerLineBuffer),b.bufferData(b.ARRAY_BUFFER,this.rulerPoints,b.DYNAMIC_DRAW),
  b.bindBuffer(b.ARRAY_BUFFER,this.rulerLineBuffer),b.vertexAttribPointer(this.shaderProgram.vertexPositionAttribute,this.rulerLineBuffer.itemSize,b.FLOAT,!1,0,0),b.drawArrays(b.LINES,0,2),b.uniform1i(this.shaderProgram.ruler,0))};
  papaya.viewer.ScreenSurface.prototype.drawRulerPoint=function(b,a,c,d){this.sphereVertexPositionBuffer.numItems=this.rulerPointData.vertices.length/3;b.bindBuffer(b.ARRAY_BUFFER,this.sphereVertexPositionBuffer);b.bufferData(b.ARRAY_BUFFER,new Float32Array(this.rulerPointData.vertices),b.STATIC_DRAW);this.sphereNormalsPositionBuffer.numItems=this.rulerPointData.normals.length/3;b.bindBuffer(b.ARRAY_BUFFER,this.sphereNormalsPositionBuffer);b.bufferData(b.ARRAY_BUFFER,new Float32Array(this.rulerPointData.normals),
  b.STATIC_DRAW);this.sphereVertexIndexBuffer.numItems=this.rulerPointData.indices.length;b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,this.sphereVertexIndexBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,new Uint16Array(this.rulerPointData.indices),b.STATIC_DRAW);b.uniform1i(this.shaderProgram.hasSolidColor,1);b.uniform4f(this.shaderProgram.solidColor,papaya.viewer.ScreenSurface.RULER_COLOR[0],papaya.viewer.ScreenSurface.RULER_COLOR[1],papaya.viewer.ScreenSurface.RULER_COLOR[2],1);b.bindBuffer(b.ARRAY_BUFFER,this.sphereVertexPositionBuffer);
  b.vertexAttribPointer(this.shaderProgram.vertexPositionAttribute,this.sphereVertexPositionBuffer.itemSize,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,this.sphereNormalsPositionBuffer);b.vertexAttribPointer(this.shaderProgram.vertexNormalAttribute,this.sphereNormalsPositionBuffer.itemSize,b.FLOAT,!1,0,0);mat4.set(this.mvMatrix,this.tempMat);mat4.translate(this.mvMatrix,[a,c,d]);this.applyMatrixUniforms(b);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,this.sphereVertexIndexBuffer);b.drawElements(b.TRIANGLES,
  this.sphereVertexIndexBuffer.numItems,b.UNSIGNED_SHORT,0);mat4.set(this.tempMat,this.mvMatrix);this.applyMatrixUniforms(b)};
  papaya.viewer.ScreenSurface.prototype.drawOrientedText=function(b,a,c,d){null===this.orientationCanvas&&this.initOrientationBuffers(this.context);this.updateOrientedTextSquare(c,a);null===this.orientationTexture&&(this.orientationTexture=b.createTexture());this.bindOrientation(b);b.enableVertexAttribArray(this.shaderProgram.textureCoordAttribute);b.uniform1i(this.shaderProgram.orientationText,1);b.enable(b.BLEND);b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);this.orientationContext.imageSmoothingEnabled=
  !0;this.orientationContext.mozImageSmoothingEnabled=!0;this.orientationContext.msImageSmoothingEnabled=!0;this.orientationContext.textAlign="center";this.orientationContext.textBaseline="middle";this.orientationContext.font=c+"px sans-serif";this.orientationContext.clearRect(0,0,this.orientationCanvas.width,this.orientationCanvas.height);this.orientationContext.fillStyle="#FFFFFF";this.orientationContext.fillText(a,this.orientationCanvas.width/2,this.orientationCanvas.height/2);mat4.set(this.mvMatrix,
  this.tempMat);mat4.multiplyVec3(this.mvMatrix,d);mat4.identity(this.mvMatrix);b.bindBuffer(b.ARRAY_BUFFER,this.orientationBuffer);b.vertexAttribPointer(this.shaderProgram.vertexPositionAttribute,this.orientationBuffer.itemSize,b.FLOAT,!1,0,0);b.pixelStorei(b.UNPACK_FLIP_Y_WEBGL,1);b.bindTexture(b.TEXTURE_2D,this.orientationTexture);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,
  b.UNSIGNED_BYTE,this.orientationCanvas);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_NEAREST);b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null);b.bindBuffer(b.ARRAY_BUFFER,this.orientationTextureCoordBuffer);b.vertexAttribPointer(this.shaderProgram.textureCoordAttribute,this.orientationTextureCoordBuffer.itemSize,b.FLOAT,!1,0,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,this.orientationTexture);
  b.uniform1i(this.shaderProgram.samplerUniform,0);mat4.translate(this.mvMatrix,d);this.applyMatrixUniforms(b);b.drawArrays(b.TRIANGLE_STRIP,0,4);mat4.set(this.tempMat,this.mvMatrix);this.applyMatrixUniforms(b);b.disable(b.BLEND);b.uniform1i(this.shaderProgram.orientationText,0);b.disableVertexAttribArray(this.shaderProgram.textureCoordAttribute)};
  papaya.viewer.ScreenSurface.prototype.bindOrientation=function(b){b.bindBuffer(b.ARRAY_BUFFER,this.orientationBuffer);b.bufferData(b.ARRAY_BUFFER,this.orientationVerts,b.DYNAMIC_DRAW)};
  papaya.viewer.ScreenSurface.prototype.bindActivePlanes=function(b){b.bindBuffer(b.ARRAY_BUFFER,this.activePlaneAxialBuffer);b.bufferData(b.ARRAY_BUFFER,this.activePlaneVertsAxial,b.DYNAMIC_DRAW);b.bindBuffer(b.ARRAY_BUFFER,this.activePlaneCoronalBuffer);b.bufferData(b.ARRAY_BUFFER,this.activePlaneVertsCoronal,b.DYNAMIC_DRAW);b.bindBuffer(b.ARRAY_BUFFER,this.activePlaneSagittalBuffer);b.bufferData(b.ARRAY_BUFFER,this.activePlaneVertsSagittal,b.DYNAMIC_DRAW);b.bindBuffer(b.ARRAY_BUFFER,this.activePlaneAxialEdgesBuffer);
  b.bufferData(b.ARRAY_BUFFER,this.activePlaneVertsAxialEdges,b.DYNAMIC_DRAW);b.bindBuffer(b.ARRAY_BUFFER,this.activePlaneCoronalEdgesBuffer);b.bufferData(b.ARRAY_BUFFER,this.activePlaneVertsCoronalEdges,b.DYNAMIC_DRAW);b.bindBuffer(b.ARRAY_BUFFER,this.activePlaneSagittalEdgesBuffer);b.bufferData(b.ARRAY_BUFFER,this.activePlaneVertsSagittalEdges,b.DYNAMIC_DRAW);b.bindBuffer(b.ARRAY_BUFFER,this.crosshairLineXBuffer);b.bufferData(b.ARRAY_BUFFER,this.crosshairLineVertsX,b.DYNAMIC_DRAW);b.bindBuffer(b.ARRAY_BUFFER,
  this.crosshairLineYBuffer);b.bufferData(b.ARRAY_BUFFER,this.crosshairLineVertsY,b.DYNAMIC_DRAW);b.bindBuffer(b.ARRAY_BUFFER,this.crosshairLineZBuffer);b.bufferData(b.ARRAY_BUFFER,this.crosshairLineVertsZ,b.DYNAMIC_DRAW)};papaya.viewer.ScreenSurface.prototype.clearDTILinesImage=function(){};
  papaya.viewer.ScreenSurface.prototype.findProximalRulerHandle=function(b,a){this.pick(b,a,!0);this.grabbedRulerPoint=-1;this.pickedCoordinate&&this.rulerPoints&&(papaya.utilities.MathUtils.lineDistance3d(this.rulerPoints[0],this.rulerPoints[1],this.rulerPoints[2],this.pickedCoordinate.coordinate[0],this.pickedCoordinate.coordinate[1],this.pickedCoordinate.coordinate[2])<papaya.viewer.ScreenSlice.GRAB_RADIUS*this.scaleFactor?this.grabbedRulerPoint=0:papaya.utilities.MathUtils.lineDistance3d(this.rulerPoints[3],
  this.rulerPoints[4],this.rulerPoints[5],this.pickedCoordinate.coordinate[0],this.pickedCoordinate.coordinate[1],this.pickedCoordinate.coordinate[2])<papaya.viewer.ScreenSlice.GRAB_RADIUS*this.scaleFactor&&(this.grabbedRulerPoint=1));return-1!==this.grabbedRulerPoint};papaya.viewer.ScreenSurface.prototype.setStartDynamic=function(b,a){this.dynamicStartX=b;this.dynamicStartY=a};
  papaya.viewer.ScreenSurface.prototype.updateDynamic=function(b,a,c){a=(a-this.dynamicStartY)*papaya.viewer.ScreenSurface.MOUSE_SENSITIVITY*c;b=(b-this.dynamicStartX)*papaya.viewer.ScreenSurface.MOUSE_SENSITIVITY*c*Math.PI/180;mat4.identity(this.mouseRotDragX);mat4.rotateY(this.mouseRotDragX,b);b=a*Math.PI/180;mat4.identity(this.mouseRotDragY);mat4.rotateX(this.mouseRotDragY,b);mat4.multiply(this.centerMat,this.mouseRotDragY,this.tempMat);mat4.multiply(this.tempMat,this.mouseRotDragX,this.tempMat2);
  mat4.multiply(this.tempMat2,this.centerMatInv,this.mouseRotDrag)};papaya.viewer.ScreenSurface.prototype.updateTranslateDynamic=function(b,a,c){b=(b-this.dynamicStartX)*papaya.viewer.ScreenSurface.MOUSE_SENSITIVITY*c;a=(a-this.dynamicStartY)*papaya.viewer.ScreenSurface.MOUSE_SENSITIVITY*c*-1;mat4.identity(this.mouseTransDrag);mat4.translate(this.mouseTransDrag,[b,a,0])};
  papaya.viewer.ScreenSurface.prototype.updateCurrent=function(){var b=mat4.multiply(this.mouseRotDrag,this.mouseRotCurrent);mat4.set(b,this.mouseRotCurrent);b=mat4.multiply(this.mouseTransDrag,this.mouseTransCurrent);mat4.set(b,this.mouseTransCurrent);mat4.identity(this.mouseTransDrag);mat4.identity(this.mouseRotDragX);mat4.identity(this.mouseRotDragY);mat4.identity(this.mouseRotDrag)};papaya.viewer.ScreenSurface.prototype.clearTransform=function(b){mat4.identity(b);return b};
  papaya.viewer.ScreenSurface.prototype.makeOrientedTextSquare=function(){var b=papaya.viewer.ScreenSurface.ORIENTATION_SIZE*this.scaleFactor;this.orientationVerts[0]=-b;this.orientationVerts[1]=b;this.orientationVerts[2]=0;this.orientationVerts[3]=-b;this.orientationVerts[4]=-b;this.orientationVerts[5]=0;this.orientationVerts[6]=b;this.orientationVerts[7]=b;this.orientationVerts[8]=0;this.orientationVerts[9]=b;this.orientationVerts[10]=-b;this.orientationVerts[11]=0;this.orientationCanvas=document.createElement("canvas");
  this.orientationContext=this.orientationCanvas.getContext("2d");this.orientationContext.imageSmoothingEnabled=!0;this.orientationContext.mozImageSmoothingEnabled=!0;this.orientationContext.msImageSmoothingEnabled=!0;this.orientationContext.fillStyle="#FFFFFF";this.orientationContext.textAlign="center";this.orientationContext.textBaseline="middle"};
  papaya.viewer.ScreenSurface.prototype.updateOrientedTextSquare=function(b,a){var c;this.orientationContext.imageSmoothingEnabled=!0;this.orientationContext.mozImageSmoothingEnabled=!0;this.orientationContext.msImageSmoothingEnabled=!0;this.orientationContext.fillStyle="#FFFFFF";this.orientationContext.textAlign="center";this.orientationContext.textBaseline="middle";this.orientationContext.font=b+"px sans-serif";c=this.orientationContext.measureText(a).width;c=Math.max(c,b);this.orientationCanvas.width=
  papaya.utilities.MathUtils.getPowerOfTwo(c);this.orientationCanvas.height=papaya.utilities.MathUtils.getPowerOfTwo(c)};
  papaya.viewer.ScreenSurface.prototype.updateActivePlanes=function(){var b,a,c;if(this.showSurfacePlanes||this.viewer.isShowingCrosshairs())b=this.currentCoord.x+(this.xDim/2-this.volume.header.origin.x),a=this.yDim-this.currentCoord.y-(this.yDim/2-this.volume.header.origin.y),c=this.zDim-this.currentCoord.z-(this.zDim/2-this.volume.header.origin.z),this.activePlaneVertsAxial[0]=-this.xHalf+this.centerWorld.x,this.activePlaneVertsAxial[1]=this.yHalf+this.centerWorld.y,this.activePlaneVertsAxial[2]=
  c*this.zSize-this.zHalf,this.activePlaneVertsAxial[3]=-this.xHalf+this.centerWorld.x,this.activePlaneVertsAxial[4]=-this.yHalf+this.centerWorld.y,this.activePlaneVertsAxial[5]=c*this.zSize-this.zHalf,this.activePlaneVertsAxial[6]=this.xHalf+this.centerWorld.x,this.activePlaneVertsAxial[7]=this.yHalf+this.centerWorld.y,this.activePlaneVertsAxial[8]=c*this.zSize-this.zHalf,this.activePlaneVertsAxial[9]=this.xHalf+this.centerWorld.x,this.activePlaneVertsAxial[10]=-this.yHalf+this.centerWorld.y,this.activePlaneVertsAxial[11]=
  c*this.zSize-this.zHalf,this.activePlaneVertsAxialEdges[0]=-this.xHalf+this.centerWorld.x,this.activePlaneVertsAxialEdges[1]=this.yHalf+this.centerWorld.y,this.activePlaneVertsAxialEdges[2]=c*this.zSize-this.zHalf,this.activePlaneVertsAxialEdges[3]=-this.xHalf+this.centerWorld.x,this.activePlaneVertsAxialEdges[4]=-this.yHalf+this.centerWorld.y,this.activePlaneVertsAxialEdges[5]=c*this.zSize-this.zHalf,this.activePlaneVertsAxialEdges[6]=-this.xHalf+this.centerWorld.x,this.activePlaneVertsAxialEdges[7]=
  -this.yHalf+this.centerWorld.y,this.activePlaneVertsAxialEdges[8]=c*this.zSize-this.zHalf,this.activePlaneVertsAxialEdges[9]=this.xHalf+this.centerWorld.x,this.activePlaneVertsAxialEdges[10]=-this.yHalf+this.centerWorld.y,this.activePlaneVertsAxialEdges[11]=c*this.zSize-this.zHalf,this.activePlaneVertsAxialEdges[12]=this.xHalf+this.centerWorld.x,this.activePlaneVertsAxialEdges[13]=-this.yHalf+this.centerWorld.y,this.activePlaneVertsAxialEdges[14]=c*this.zSize-this.zHalf,this.activePlaneVertsAxialEdges[15]=
  this.xHalf+this.centerWorld.x,this.activePlaneVertsAxialEdges[16]=this.yHalf+this.centerWorld.y,this.activePlaneVertsAxialEdges[17]=c*this.zSize-this.zHalf,this.activePlaneVertsAxialEdges[18]=this.xHalf+this.centerWorld.x,this.activePlaneVertsAxialEdges[19]=this.yHalf+this.centerWorld.y,this.activePlaneVertsAxialEdges[20]=c*this.zSize-this.zHalf,this.activePlaneVertsAxialEdges[21]=-this.xHalf+this.centerWorld.x,this.activePlaneVertsAxialEdges[22]=this.yHalf+this.centerWorld.y,this.activePlaneVertsAxialEdges[23]=
  c*this.zSize-this.zHalf,this.activePlaneVertsCoronal[0]=-this.xHalf+this.centerWorld.x,this.activePlaneVertsCoronal[1]=a*this.ySize-this.yHalf,this.activePlaneVertsCoronal[2]=this.zHalf+this.centerWorld.z,this.activePlaneVertsCoronal[3]=-this.xHalf+this.centerWorld.x,this.activePlaneVertsCoronal[4]=a*this.ySize-this.yHalf,this.activePlaneVertsCoronal[5]=-this.zHalf+this.centerWorld.z,this.activePlaneVertsCoronal[6]=this.xHalf+this.centerWorld.x,this.activePlaneVertsCoronal[7]=a*this.ySize-this.yHalf,
  this.activePlaneVertsCoronal[8]=this.zHalf+this.centerWorld.z,this.activePlaneVertsCoronal[9]=this.xHalf+this.centerWorld.x,this.activePlaneVertsCoronal[10]=a*this.ySize-this.yHalf,this.activePlaneVertsCoronal[11]=-this.zHalf+this.centerWorld.z,this.activePlaneVertsCoronalEdges[0]=-this.xHalf+this.centerWorld.x,this.activePlaneVertsCoronalEdges[1]=a*this.ySize-this.yHalf,this.activePlaneVertsCoronalEdges[2]=this.zHalf+this.centerWorld.z,this.activePlaneVertsCoronalEdges[3]=-this.xHalf+this.centerWorld.x,
  this.activePlaneVertsCoronalEdges[4]=a*this.ySize-this.yHalf,this.activePlaneVertsCoronalEdges[5]=-this.zHalf+this.centerWorld.z,this.activePlaneVertsCoronalEdges[6]=-this.xHalf+this.centerWorld.x,this.activePlaneVertsCoronalEdges[7]=a*this.ySize-this.yHalf,this.activePlaneVertsCoronalEdges[8]=-this.zHalf+this.centerWorld.z,this.activePlaneVertsCoronalEdges[9]=this.xHalf+this.centerWorld.x,this.activePlaneVertsCoronalEdges[10]=a*this.ySize-this.yHalf,this.activePlaneVertsCoronalEdges[11]=-this.zHalf+
  this.centerWorld.z,this.activePlaneVertsCoronalEdges[12]=this.xHalf+this.centerWorld.x,this.activePlaneVertsCoronalEdges[13]=a*this.ySize-this.yHalf,this.activePlaneVertsCoronalEdges[14]=-this.zHalf+this.centerWorld.z,this.activePlaneVertsCoronalEdges[15]=this.xHalf+this.centerWorld.x,this.activePlaneVertsCoronalEdges[16]=a*this.ySize-this.yHalf,this.activePlaneVertsCoronalEdges[17]=this.zHalf+this.centerWorld.z,this.activePlaneVertsCoronalEdges[18]=this.xHalf+this.centerWorld.x,this.activePlaneVertsCoronalEdges[19]=
  a*this.ySize-this.yHalf,this.activePlaneVertsCoronalEdges[20]=this.zHalf+this.centerWorld.z,this.activePlaneVertsCoronalEdges[21]=-this.xHalf+this.centerWorld.x,this.activePlaneVertsCoronalEdges[22]=a*this.ySize-this.yHalf,this.activePlaneVertsCoronalEdges[23]=this.zHalf+this.centerWorld.z,this.activePlaneVertsSagittal[0]=b*this.xSize-this.xHalf,this.activePlaneVertsSagittal[1]=-this.yHalf+this.centerWorld.y,this.activePlaneVertsSagittal[2]=this.zHalf+this.centerWorld.z,this.activePlaneVertsSagittal[3]=
  b*this.xSize-this.xHalf,this.activePlaneVertsSagittal[4]=-this.yHalf+this.centerWorld.y,this.activePlaneVertsSagittal[5]=-this.zHalf+this.centerWorld.z,this.activePlaneVertsSagittal[6]=b*this.xSize-this.xHalf,this.activePlaneVertsSagittal[7]=this.yHalf+this.centerWorld.y,this.activePlaneVertsSagittal[8]=this.zHalf+this.centerWorld.z,this.activePlaneVertsSagittal[9]=b*this.xSize-this.xHalf,this.activePlaneVertsSagittal[10]=this.yHalf+this.centerWorld.y,this.activePlaneVertsSagittal[11]=-this.zHalf+
  this.centerWorld.z,this.activePlaneVertsSagittalEdges[0]=b*this.xSize-this.xHalf,this.activePlaneVertsSagittalEdges[1]=-this.yHalf+this.centerWorld.y,this.activePlaneVertsSagittalEdges[2]=this.zHalf+this.centerWorld.z,this.activePlaneVertsSagittalEdges[3]=b*this.xSize-this.xHalf,this.activePlaneVertsSagittalEdges[4]=-this.yHalf+this.centerWorld.y,this.activePlaneVertsSagittalEdges[5]=-this.zHalf+this.centerWorld.z,this.activePlaneVertsSagittalEdges[6]=b*this.xSize-this.xHalf,this.activePlaneVertsSagittalEdges[7]=
  -this.yHalf+this.centerWorld.y,this.activePlaneVertsSagittalEdges[8]=-this.zHalf+this.centerWorld.z,this.activePlaneVertsSagittalEdges[9]=b*this.xSize-this.xHalf,this.activePlaneVertsSagittalEdges[10]=this.yHalf+this.centerWorld.y,this.activePlaneVertsSagittalEdges[11]=-this.zHalf+this.centerWorld.z,this.activePlaneVertsSagittalEdges[12]=b*this.xSize-this.xHalf,this.activePlaneVertsSagittalEdges[13]=this.yHalf+this.centerWorld.y,this.activePlaneVertsSagittalEdges[14]=-this.zHalf+this.centerWorld.z,
  this.activePlaneVertsSagittalEdges[15]=b*this.xSize-this.xHalf,this.activePlaneVertsSagittalEdges[16]=this.yHalf+this.centerWorld.y,this.activePlaneVertsSagittalEdges[17]=this.zHalf+this.centerWorld.z,this.activePlaneVertsSagittalEdges[18]=b*this.xSize-this.xHalf,this.activePlaneVertsSagittalEdges[19]=this.yHalf+this.centerWorld.y,this.activePlaneVertsSagittalEdges[20]=this.zHalf+this.centerWorld.z,this.activePlaneVertsSagittalEdges[21]=b*this.xSize-this.xHalf,this.activePlaneVertsSagittalEdges[22]=
  -this.yHalf+this.centerWorld.y,this.activePlaneVertsSagittalEdges[23]=this.zHalf+this.centerWorld.z,this.crosshairLineVertsZ[0]=b*this.xSize-this.xHalf,this.crosshairLineVertsZ[1]=a*this.ySize-this.yHalf,this.crosshairLineVertsZ[2]=-this.zHalf+this.centerWorld.z,this.crosshairLineVertsZ[3]=b*this.xSize-this.xHalf,this.crosshairLineVertsZ[4]=a*this.ySize-this.yHalf,this.crosshairLineVertsZ[5]=this.zHalf+this.centerWorld.z,this.crosshairLineVertsY[0]=b*this.xSize-this.xHalf,this.crosshairLineVertsY[1]=
  -this.yHalf+this.centerWorld.y,this.crosshairLineVertsY[2]=c*this.zSize-this.zHalf,this.crosshairLineVertsY[3]=b*this.xSize-this.xHalf,this.crosshairLineVertsY[4]=this.yHalf+this.centerWorld.y,this.crosshairLineVertsY[5]=c*this.zSize-this.zHalf,this.crosshairLineVertsX[0]=-this.xHalf+this.centerWorld.x,this.crosshairLineVertsX[1]=a*this.ySize-this.yHalf,this.crosshairLineVertsX[2]=c*this.zSize-this.zHalf,this.crosshairLineVertsX[3]=this.xHalf+this.centerWorld.x,this.crosshairLineVertsX[4]=a*this.ySize-
  this.yHalf,this.crosshairLineVertsX[5]=c*this.zSize-this.zHalf,this.needsUpdateActivePlanes=!0};papaya.viewer.ScreenSurface.prototype.pick=function(b,a,c){this.needsPick=!0;this.pickLocX=b;this.pickLocY=a;this.draw();if(c)return this.pickedCoordinate;this.draw();return this.pickedCoordinate};
  papaya.viewer.ScreenSurface.prototype.pickRuler=function(b,a){this.needsPick=!0;this.pickLocX=b;this.pickLocY=a;this.draw();this.pickedCoordinate&&(this.rulerPoints[3*this.grabbedRulerPoint]=this.pickedCoordinate.coordinate[0],this.rulerPoints[3*this.grabbedRulerPoint+1]=this.pickedCoordinate.coordinate[1],this.rulerPoints[3*this.grabbedRulerPoint+2]=this.pickedCoordinate.coordinate[2],this.draw());return this.pickedCoordinate};
  papaya.viewer.ScreenSurface.prototype.pickColor=function(b,a){this.needsPickColor=!0;this.pickLocX=b;this.pickLocY=a;this.draw();this.draw();return this.pickedColor};
  papaya.viewer.ScreenSurface.prototype.findPickedCoordinate=function(b,a,c){c=b.viewportHeight-1-c;var d,e=[];b.readPixels(a,c,1,1,b.RGBA,b.UNSIGNED_BYTE,this.pickingBuffer);d=this.unpackFloatFromVec4i(this.pickingBuffer)/255;return 1<=d?null:GLU.unProject(a,c,d,this.mvMatrix,this.pMatrix,[0,0,b.viewportWidth,b.viewportHeight],e)?{coordinate:e,depth:d}:null};
  papaya.viewer.ScreenSurface.prototype.findInitialRulerPoints=function(b){var a=b.viewportWidth,c=b.viewportHeight,d;b=[];var e=[],f,h;for(h=1;5>h;h+=1)d=parseInt(.1*a*h,10),f=parseInt(.1*c*h,10),(d=this.pick(d,f,!0))&&b.push(d),d=parseInt(a-.1*a*h,10),f=parseInt(.1*c*h,10),(d=this.pick(d,f,!0))&&b.push(d),d=parseInt(a-.1*a*h,10),f=parseInt(c-.1*c*h,10),(d=this.pick(d,f,!0))&&b.push(d),d=parseInt(.1*a*h,10),f=parseInt(c-.1*c*h,10),(d=this.pick(d,f,!0))&&b.push(d);if(2>b)return!1;for(h=a=0;h<b.length;h+=
  1)b[h].depth<b[a].depth&&(a=h);e.push(b[a].coordinate);b.splice(a,1);for(h=a=0;h<b.length;h+=1)b[h].depth<b[a].depth&&(a=h);e.push(b[a].coordinate);this.rulerPoints[0]=e[0][0];this.rulerPoints[1]=e[0][1];this.rulerPoints[2]=e[0][2];this.rulerPoints[3]=e[1][0];this.rulerPoints[4]=e[1][1];this.rulerPoints[5]=e[1][2];return!0};
  papaya.viewer.ScreenSurface.prototype.findPickedColor=function(b){b.readPixels(0,0,b.viewportWidth,b.viewportHeight,b.RGBA,b.UNSIGNED_BYTE,this.pickingBuffer);b=(b.viewportHeight-1-this.pickLocY)*b.viewportWidth*4+4*this.pickLocX;return[this.pickingBuffer[b],this.pickingBuffer[b+1],this.pickingBuffer[b+2]]};
  papaya.viewer.ScreenSurface.prototype.getBackgroundColor=function(){return"rgba("+parseInt(255*this.backgroundColor[0]+.5)+","+parseInt(255*this.backgroundColor[1]+.5)+","+parseInt(255*this.backgroundColor[2]+.5)+",255)"};papaya.viewer.ScreenSurface.prototype.updatePreferences=function(){this.updateBackgroundColor()};
  papaya.viewer.ScreenSurface.prototype.updateBackgroundColor=function(){var b=this.viewer.container.preferences.surfaceBackgroundColor;this.backgroundColor="Black"===b?[0,0,0]:"Dark Gray"===b?[.25,.25,.25]:"Gray"===b?[.5,.5,.5]:"Light Gray"===b?[.75,.75,.75]:"White"===b?[1,1,1]:papaya.viewer.ScreenSurface.DEFAULT_BACKGROUND};papaya.viewer.ScreenSurface.prototype.isMainView=function(){return this.viewer.mainImage===this.viewer.surfaceView};
  papaya.viewer.ScreenSurface.prototype.processParams=function(b){this.viewer.container.isDesktopMode()||void 0===b.surfaceBackground||(this.viewer.container.preferences.surfaceBackgroundColor=b.surfaceBackground)};
  papaya.viewer.ScreenSurface.prototype.makeSphere=function(b,a,c){var d,e,f=[],h=[];for(d=0;d<=b;d++){e=d*Math.PI/b;var g=Math.sin(e),m=Math.cos(e);for(e=0;e<=a;e++){var l=2*e*Math.PI/a,q=Math.sin(l),l=Math.cos(l)*g,u=m,q=q*g;h.push(l);h.push(u);h.push(q);f.push(c*l);f.push(c*u);f.push(c*q)}}c=[];for(d=0;d<b;d++)for(e=0;e<a;e++)g=d*(a+1)+e,m=g+a+1,c.push(g),c.push(m),c.push(g+1),c.push(m),c.push(m+1),c.push(g+1);return{vertices:f,normals:h,indices:c}};
  papaya.viewer.ScreenSurface.prototype.getRulerLength=function(){return papaya.utilities.MathUtils.lineDistance3d(this.rulerPoints[0],this.rulerPoints[1],this.rulerPoints[2],this.rulerPoints[3],this.rulerPoints[4],this.rulerPoints[5])};"use strict";var papaya=papaya||{},papayaContainers=[],papayaLoadableImages=papayaLoadableImages||[],papayaDroppedFiles=[];
  papaya.Container=papaya.Container||function(b){this.containerHtml=b;this.preferences=this.toolbar=this.display=this.viewer=this.sliderControlHtml=this.titlebarHtml=this.displayHtml=this.viewerHtml=this.toolbarHtml=this.containerIndex=null;this.params=[];this.loadingSurfaceIndex=this.loadingImageIndex=0;this.collapsable=this.nestedViewer=!1;this.orthogonal=!0;this.noNewFiles=this.kioskMode=this.orthogonalDynamic=this.orthogonalTall=!1;this.showControls=!0;this.showControlBar=!1;this.fullScreenPadding=
  this.showImageButtons=!0;this.combineParametric=!1;this.dropTimeout=null;this.showRuler=!1;this.syncOverlaySeries=!0;this.surfaceParams={};this.contextManager=null;this.allowScroll=!0;this.loadingComplete=null;this.resetComponents()};papaya.Container.LICENSE_TEXT="<p>THIS PRODUCT IS NOT FOR CLINICAL USE.<br /><br />This software is available for use, as is, free of charge.  The software and data derived from this software may not be used for clinical purposes.<br /><br />The authors of this software make no representations or warranties about the suitability of the software, either express or implied, including but not limited to the implied warranties of merchantability, fitness for a particular purpose, non-infringement, or conformance to a specification or standard. The authors of this software shall not be liable for any damages suffered by licensee as a result of using or modifying this software or its derivatives.<br /><br />By using this software, you agree to be bounded by the terms of this license.  If you do not agree to the terms of this license, do not use this software.</p>";
  papaya.Container.KEYBOARD_REF_TEXT="<span style='color:#B5CBD3'>[Spacebar]</span> Cycle the main slice view in a clockwise rotation.<br /><br /><span style='color:#B5CBD3'>[Page Up]</span> or <span style='color:#B5CBD3'>[']</span> Increment the axial slice.<br /><br /><span style='color:#B5CBD3'>[Page Down]</span> or <span style='color:#B5CBD3'>[/]</span> Decrement the axial slice.<br /><br /><span style='color:#B5CBD3'>[Arrow Up]</span> and <span style='color:#B5CBD3'>[Arrow Down]</span> Increment/decrement the coronal slice.<br /><br /><span style='color:#B5CBD3'>[Arrow Right]</span> and <span style='color:#B5CBD3'>[Arrow Left]</span> Increment/decrement the sagittal slice.<br /><br /><span style='color:#B5CBD3'>[g]</span> and <span style='color:#B5CBD3'>[v]</span> Increment/decrement main slice.<br /><br /><span style='color:#B5CBD3'>[<]</span> or <span style='color:#B5CBD3'>[,]</span> Decrement the series point.<br /><br /><span style='color:#B5CBD3'>[>]</span> or <span style='color:#B5CBD3'>[.]</span> Increment the series point.<br /><br /><span style='color:#B5CBD3'>[o]</span> Navigate viewer to the image origin.<br /><br /><span style='color:#B5CBD3'>[c]</span> Navigate viewer to the center of the image.<br /><br /><span style='color:#B5CBD3'>[a]</span> Toggle main crosshairs on/off.";
  papaya.Container.MOUSE_REF_TEXT="<span style='color:#B5CBD3'>(Left-click and drag)</span> Change current coordinate.<br /><br /><span style='color:#B5CBD3'>[Alt](Left-click and drag)</span> Zoom in and out.<br /><br /><span style='color:#B5CBD3'>[Alt](Double left-click)</span> Reset zoom.<br /><br /><span style='color:#B5CBD3'>[Alt][Shift](Left-click and drag)</span> Pan zoomed image.<br /><br /><span style='color:#B5CBD3'>(Right-click and drag)</span> Window level controls.<br /><br /><span style='color:#B5CBD3'>(Scroll wheel)</span> See Preferences.<br /><br />";
  papaya.Container.DICOM_SUPPORT=!0;papaya.Container.syncViewers=!1;papaya.Container.syncViewersWorld=!1;papaya.Container.allowPropagation=!1;papaya.Container.papayaLastHoveredViewer=null;papaya.Container.ignorePatterns=[/^[.]/];papaya.Container.restartViewer=function(b,a,c,d,e){papayaContainers[b].viewer.restart(a,c,d,e)};
  papaya.Container.resetViewer=function(b,a){a||(a=papayaContainers[b].params,a.loadedImages&&(a.images=a.loadedImages),a.loadedEncodedImages&&(a.encodedImages=a.loadedEncodedImages),a.loadedBinaryImages&&(a.binaryImages=a.loadedBinaryImages),a.loadedSurfaces&&(a.surfaces=a.loadedSurfaces),a.loadedEncodedSurfaces&&(a.encodedSurfaces=a.loadedEncodedSurfaces),a.loadedFiles&&(a.files=a.loadedFiles));papayaContainers[b].viewer.resetViewer();papayaContainers[b].toolbar.updateImageButtons();papayaContainers[b].reset();
  papayaContainers[b].params=a;papayaContainers[b].readGlobalParams();papayaContainers[b].rebuildContainer(a,b);papayaContainers[b].viewer.processParams(a)};papaya.Container.removeImage=function(b,a){1>a&&console.log("Cannot remove the base image.  Try papaya.Container.resetViewer() instead.");papayaContainers[b].viewer.removeOverlay(a)};papaya.Container.hideImage=function(b,a){papayaContainers[b].viewer.screenVolumes[a].hidden=!0;papayaContainers[b].viewer.drawViewer(!0,!1)};
  papaya.Container.showImage=function(b,a){papayaContainers[b].viewer.screenVolumes[a].hidden=!1;papayaContainers[b].viewer.drawViewer(!0,!1)};
  papaya.Container.addImage=function(b,a,c){c&&(papayaContainers[b].params=$.extend({},papayaContainers[b].params,c));a instanceof Array?c=a:(c=[],c[0]=a);papayaContainers[b].params.images?papayaContainers[b].viewer.loadImage(c,!0,!1,!1):papayaContainers[b].params.binaryImages?papayaContainers[b].viewer.loadImage(c,!1,!1,!0):papayaContainers[b].params.encodedImages&&papayaContainers[b].viewer.loadImage(c,!1,!0,!1)};
  papaya.Container.findParameters=function(b){var a,c=null;a=b.data("params");a||(b=b.find("."+PAPAYA_VIEWER_CSS))&&(a=b.data("params"));a&&("object"===typeof a?c=a:window[a]&&(c=window[a]));c&&papaya.utilities.UrlUtils.getQueryParams(c);return c};
  papaya.Container.fillContainerHTML=function(b,a,c,d){var e;a?(c=b.find("#"+PAPAYA_DEFAULT_TOOLBAR_ID),e=b.find("#"+PAPAYA_DEFAULT_VIEWER_ID),a=b.find("#"+PAPAYA_DEFAULT_DISPLAY_ID),c?c.addClass(PAPAYA_TOOLBAR_CSS):b.prepend("<div class='"+PAPAYA_TOOLBAR_CSS+"' id='"+PAPAYA_DEFAULT_TOOLBAR_ID+"'></div>"),e?e.addClass(PAPAYA_VIEWER_CSS):$("<div class='"+PAPAYA_VIEWER_CSS+"' id='"+PAPAYA_DEFAULT_VIEWER_ID+"'></div>").insertAfter($("#"+PAPAYA_DEFAULT_TOOLBAR_ID)),a?a.addClass(PAPAYA_DISPLAY_CSS):$("<div class='"+
  PAPAYA_DISPLAY_CSS+"' id='"+PAPAYA_DEFAULT_DISPLAY_ID+"'></div>").insertAfter($("#"+PAPAYA_DEFAULT_VIEWER_ID)),console.log("This method of adding a Papaya container is deprecated.  Try simply <div class='papaya' data-params='params'></div> instead...")):(a=void 0!==d?d:papayaContainers.length,b.attr("id",PAPAYA_DEFAULT_CONTAINER_ID+a),c&&void 0!==c.kioskMode&&c.kioskMode||b.append("<div id='"+(PAPAYA_DEFAULT_TOOLBAR_ID+a)+"' class='"+PAPAYA_TOOLBAR_CSS+"'></div>"),b.append("<div id='"+(PAPAYA_DEFAULT_VIEWER_ID+
  a)+"' class='"+PAPAYA_VIEWER_CSS+"'></div>"),b.append("<div id='"+(PAPAYA_DEFAULT_DISPLAY_ID+a)+"' class='"+PAPAYA_DISPLAY_CSS+"'></div>"),c&&c.showControlBar&&(void 0===c.showControls||c.showControls)?(b.append("<div id='"+PAPAYA_KIOSK_CONTROLS_CSS+a+"' class='"+PAPAYA_KIOSK_CONTROLS_CSS+"'><div id='"+(PAPAYA_DEFAULT_SLIDER_ID+a)+"main' class='"+PAPAYA_SLIDER_CSS+" "+PAPAYA_CONTROL_MAIN_SLIDER+"'><span class='"+PAPAYA_CONTROL_BAR_LABELS_CSS+"'>Slice: </span> <button type='button' class='"+PAPAYA_CONTROL_INCREMENT_BUTTON_CSS+
  "'>+</button> <button type='button' class='"+PAPAYA_CONTROL_INCREMENT_BUTTON_CSS+"'>-</button> </div><div id='"+(PAPAYA_DEFAULT_SLIDER_ID+a)+"axial' class='"+PAPAYA_SLIDER_CSS+" "+PAPAYA_CONTROL_DIRECTION_SLIDER+"'><span class='"+PAPAYA_CONTROL_BAR_LABELS_CSS+"'>Axial: </span> <button type='button' class='"+PAPAYA_CONTROL_INCREMENT_BUTTON_CSS+"'>+</button> <button type='button' class='"+PAPAYA_CONTROL_INCREMENT_BUTTON_CSS+"'>-</button> </div><div id='"+(PAPAYA_DEFAULT_SLIDER_ID+a)+"coronal' class='"+
  PAPAYA_SLIDER_CSS+" "+PAPAYA_CONTROL_DIRECTION_SLIDER+"'><span class='"+PAPAYA_CONTROL_BAR_LABELS_CSS+"'>Coronal: </span> <button type='button' class='"+PAPAYA_CONTROL_INCREMENT_BUTTON_CSS+"'>+</button> <button type='button' class='"+PAPAYA_CONTROL_INCREMENT_BUTTON_CSS+"'>-</button> </div><div id='"+(PAPAYA_DEFAULT_SLIDER_ID+a)+"sagittal' class='"+PAPAYA_SLIDER_CSS+" "+PAPAYA_CONTROL_DIRECTION_SLIDER+"'><span class='"+PAPAYA_CONTROL_BAR_LABELS_CSS+"'>Sagittal: </span> <button type='button' class='"+
  PAPAYA_CONTROL_INCREMENT_BUTTON_CSS+"'>+</button> <button type='button' class='"+PAPAYA_CONTROL_INCREMENT_BUTTON_CSS+"'>-</button> </div><div id='"+(PAPAYA_DEFAULT_SLIDER_ID+a)+"series' class='"+PAPAYA_SLIDER_CSS+" "+PAPAYA_CONTROL_DIRECTION_SLIDER+"'><span class='"+PAPAYA_CONTROL_BAR_LABELS_CSS+"'>Series: </span> <button type='button' class='"+PAPAYA_CONTROL_INCREMENT_BUTTON_CSS+"'>&lt;</button> <button type='button' class='"+PAPAYA_CONTROL_INCREMENT_BUTTON_CSS+"'>&gt;</button> </div>&nbsp;&nbsp;&nbsp;<button type='button' "+
  (c.kioskMode&&(void 0===c.showImageButtons||c.showImageButtons)?"":"style='float:right;margin-left:5px;' ")+"class='"+PAPAYA_CONTROL_SWAP_BUTTON_CSS+"'>Swap View</button> <button type='button' "+(c.kioskMode&&(void 0===c.showImageButtons||c.showImageButtons)?"":"style='float:right;margin-left:5px;' ")+"class='"+PAPAYA_CONTROL_GOTO_CENTER_BUTTON_CSS+"'>Go To Center</button> <button type='button' "+(c.kioskMode&&(void 0===c.showImageButtons||c.showImageButtons)?"":"style='float:right;margin-left:5px;' ")+
  "class='"+PAPAYA_CONTROL_GOTO_ORIGIN_BUTTON_CSS+"'>Go To Origin</button> </div>"),$("."+PAPAYA_CONTROL_INCREMENT_BUTTON_CSS).prop("disabled",!0),$("."+PAPAYA_CONTROL_SWAP_BUTTON_CSS).prop("disabled",!0),$("."+PAPAYA_CONTROL_GOTO_CENTER_BUTTON_CSS).prop("disabled",!0),$("."+PAPAYA_CONTROL_GOTO_ORIGIN_BUTTON_CSS).prop("disabled",!0)):c&&(void 0===c.showControls||c.showControls)&&(b.append("<button type='button' id='"+(PAPAYA_CONTROL_MAIN_INCREMENT_BUTTON_CSS+a)+"' class='"+PAPAYA_CONTROL_MAIN_INCREMENT_BUTTON_CSS+
  "'>+</button> "),b.append("<button type='button' id='"+(PAPAYA_CONTROL_MAIN_DECREMENT_BUTTON_CSS+a)+"' class='"+PAPAYA_CONTROL_MAIN_DECREMENT_BUTTON_CSS+"'>-</button> "),b.append("<button type='button' id='"+(PAPAYA_CONTROL_MAIN_SWAP_BUTTON_CSS+a)+"' class='"+PAPAYA_CONTROL_MAIN_SWAP_BUTTON_CSS+"'>Swap View</button> "),b.append("<button type='button' id='"+(PAPAYA_CONTROL_MAIN_GOTO_CENTER_BUTTON_CSS+a)+"' class='"+PAPAYA_CONTROL_MAIN_GOTO_CENTER_BUTTON_CSS+"'>Go To Center</button> "),b.append("<button type='button' id='"+
  (PAPAYA_CONTROL_MAIN_GOTO_ORIGIN_BUTTON_CSS+a)+"' class='"+PAPAYA_CONTROL_MAIN_GOTO_ORIGIN_BUTTON_CSS+"'>Go To Origin</button> "),$("#"+PAPAYA_CONTROL_MAIN_INCREMENT_BUTTON_CSS+a).css({display:"none"}),$("#"+PAPAYA_CONTROL_MAIN_DECREMENT_BUTTON_CSS+a).css({display:"none"}),$("#"+PAPAYA_CONTROL_MAIN_SWAP_BUTTON_CSS+a).css({display:"none"}),$("#"+PAPAYA_CONTROL_MAIN_GOTO_CENTER_BUTTON_CSS+a).css({display:"none"}),$("#"+PAPAYA_CONTROL_MAIN_GOTO_ORIGIN_BUTTON_CSS+a).css({display:"none"})));return e};
  papaya.Container.buildContainer=function(b,a,c){var d,e,f;e=null;d=papaya.utilities.PlatformUtils.checkForBrowserCompatibility();e=b.find("."+PAPAYA_VIEWER_CSS);null!==d?(papaya.Container.removeCheckForJSClasses(b,e),b.addClass(PAPAYA_UTILS_UNSUPPORTED_CSS),e.addClass(PAPAYA_UTILS_UNSUPPORTED_MESSAGE_CSS),e.html(d)):(d=void 0!==c?c:papayaContainers.length,c=new papaya.Container(b),c.containerIndex=d,c.preferences=new papaya.viewer.Preferences,papaya.Container.removeCheckForJSClasses(b,e),a&&(c.params=
  $.extend(c.params,a)),c.nestedViewer="BODY"!==b.parent()[0].tagName.toUpperCase(),c.readGlobalParams(),c.isDesktopMode()&&c.preferences.readPreferences(),c.buildViewer(c.params),c.buildDisplay(),c.showControlBar&&c.buildSliderControl(),c.buildToolbar(),c.setUpDnD(),(f=e.data("load-url"))?(e=f,e instanceof Array||(e=[],e[0]=f),c.viewer.loadImage(e,!0,!1,!1)):c.params.images?(e=c.params.images[0],e instanceof Array||(e=[],e[0]=c.params.images[0]),c.viewer.loadImage(e,!0,!1,!1)):c.params.encodedImages?
  (e=c.params.encodedImages[0],e instanceof Array||(e=[],e[0]=c.params.encodedImages[0]),c.viewer.loadImage(e,!1,!0,!1)):c.params.binaryImages?(e=c.params.binaryImages[0],c.viewer.loadImage(e,!1,!1,!0)):c.params.files?(e=c.params.files[0],e instanceof Array||(e=[],e[0]=c.params.files[0]),c.viewer.loadImage(e,!1,!1,!1)):c.viewer.finishedLoading(),c.resizeViewerComponents(!1),c.nestedViewer||(b.parent().height("100%"),b.parent().width("100%")),papayaContainers[d]=c,papaya.Container.showLicense(c,a))};
  papaya.Container.prototype.rebuildContainer=function(b,a){this.containerHtml.empty();papaya.Container.fillContainerHTML(this.containerHtml,!1,b,a);papaya.Container.buildContainer(this.containerHtml,b,a);1!==papayaContainers.length||papayaContainers[0].nestedViewer||($("html").addClass(PAPAYA_CONTAINER_FULLSCREEN),$("body").addClass(PAPAYA_CONTAINER_FULLSCREEN),papaya.Container.setToFullPage())};
  papaya.Container.buildAllContainers=function(){var b,a;b=$("#"+PAPAYA_DEFAULT_CONTAINER_ID);0<b.length?(papaya.Container.fillContainerHTML(b,!0),a=papaya.Container.findParameters(b),papaya.Container.buildContainer(b,a)):$("."+PAPAYA_CONTAINER_CLASS_NAME).each(function(){a=papaya.Container.findParameters($(this));null===a&&(a=[]);!0===a.fullScreen&&(a.fullScreenPadding=!1,a.kioskMode=!0,a.showControlBar=!1,$("body").css({"background-color":"black"}));papaya.Container.fillContainerHTML($(this),!1,a);
  papaya.Container.buildContainer($(this),a)});1!==papayaContainers.length||papayaContainers[0].nestedViewer||($("html").addClass(PAPAYA_CONTAINER_FULLSCREEN),$("body").addClass(PAPAYA_CONTAINER_FULLSCREEN),papaya.Container.setToFullPage(),papayaContainers[0].resizeViewerComponents(!0))};papaya.Container.startPapaya=function(){setTimeout(function(){window.scrollTo(0,0)},0);papaya.Container.DICOM_SUPPORT="undefined"!==typeof daikon;papaya.Container.buildAllContainers()};
  papaya.Container.resizePapaya=function(b,a){var c;papaya.Container.updateOrthogonalState();if(1!==papayaContainers.length||papayaContainers[0].nestedViewer)for(c=0;c<papayaContainers.length;c+=1)papayaContainers[c].resizeViewerComponents(!0);else papaya.utilities.PlatformUtils.smallScreen&&!a||papayaContainers[0].resizeViewerComponents(!0);setTimeout(function(){window.scrollTo(0,0)},0)};
  papaya.Container.addViewer=function(b,a,c){var d;d=$("#"+b);b=$('<div class="papaya"></div>');d.html(b);d[0].onclick="";d.off("click");papaya.Container.fillContainerHTML(b,!1,a);papaya.Container.buildContainer(b,a);c&&c()};papaya.Container.removeCheckForJSClasses=function(b,a){a.removeClass(PAPAYA_CONTAINER_CLASS_NAME);a.removeClass(PAPAYA_UTILS_CHECKFORJS_CSS);b.removeClass(PAPAYA_CONTAINER_CLASS_NAME);b.removeClass(PAPAYA_UTILS_CHECKFORJS_CSS)};
  papaya.Container.setToFullPage=function(){document.body.style.marginTop=0;document.body.style.marginBottom=0;document.body.style.marginLeft="auto";document.body.style.marginRight="auto";document.body.style.padding=0;document.body.style.overflow="hidden";document.body.style.width="100%";document.body.style.height="100%"};papaya.Container.getLicense=function(){return papaya.Container.LICENSE_TEXT};papaya.Container.getKeyboardReference=function(){return papaya.Container.KEYBOARD_REF_TEXT};
  papaya.Container.getMouseReference=function(){return papaya.Container.MOUSE_REF_TEXT};papaya.Container.setLicenseRead=function(){papaya.utilities.UrlUtils.createCookie(papaya.viewer.Preferences.COOKIE_PREFIX+"eula","Yes",papaya.viewer.Preferences.COOKIE_EXPIRY_DAYS)};papaya.Container.isLicenseRead=function(){var b=papaya.utilities.UrlUtils.readCookie(papaya.viewer.Preferences.COOKIE_PREFIX+"eula");return b&&"Yes"===b};
  papaya.Container.showLicense=function(b,a){a&&void 0!==a.showEULA&&a.showEULA&&!papaya.Container.isLicenseRead()&&(new papaya.ui.Dialog(b,"License",papaya.ui.Toolbar.LICENSE_DATA,papaya.Container,null,papaya.Container.setLicenseRead,null,!0)).showDialog()};
  papaya.Container.updateOrthogonalState=function(){var b;for(b=0;b<papayaContainers.length;b+=1)papayaContainers[b].orthogonal&&(papaya.utilities.PlatformUtils.mobile||papayaContainers[b].orthogonalDynamic)&&($(window).height()>$(window).width()?papayaContainers[b].orthogonalTall=!0:papayaContainers[b].orthogonalTall=!1)};
  papaya.Container.reorientPapaya=function(){var b;for(b=0;b<papayaContainers.length;b+=1)papayaContainers[b].toolbar.closeAllMenus();papaya.Container.updateOrthogonalState();papaya.Container.resizePapaya(null,!0)};papaya.Container.prototype.resetComponents=function(){this.containerHtml.css({height:"auto"});this.containerHtml.css({width:"auto"});this.containerHtml.css({margin:"auto"});$("head").append("<style>div#papayaViewer:before{ content:'' }</style>")};
  papaya.Container.prototype.hasSurface=function(){return this.viewer&&0<this.viewer.surfaces.length};
  papaya.Container.prototype.getViewerDimensions=function(){var b,a,c,d;b=this.containerHtml.parent().width()-(this.fullScreenPadding?2*PAPAYA_PADDING:0);c=this.orthogonal?this.hasSurface()?1.333:1.5:1;this.orthogonalTall||!this.orthogonal?(b=(this.collapsable?window.innerHeight:this.containerHtml.parent().height())-(papaya.viewer.Display.SIZE+(this.kioskMode?0:papaya.ui.Toolbar.SIZE+PAPAYA_SPACING)+PAPAYA_SPACING+(this.fullScreenPadding&&!this.nestedViewer?2*PAPAYA_CONTAINER_PADDING_TOP:0))-(this.showControlBar?
  2*papaya.ui.Toolbar.SIZE:0),a=papayaRoundFast(b/c)):(a=b,b=papayaRoundFast(a/c));if(!this.nestedViewer||this.collapsable)this.orthogonalTall?(d=window.innerWidth-(this.fullScreenPadding?2*PAPAYA_PADDING:0),a>d&&(a=d,b=papayaRoundFast(a*c))):(d=window.innerHeight-(papaya.viewer.Display.SIZE+(this.kioskMode?0:papaya.ui.Toolbar.SIZE+PAPAYA_SPACING)+PAPAYA_SPACING+(this.fullScreenPadding?2*PAPAYA_CONTAINER_PADDING_TOP:0))-(this.showControlBar?2*papaya.ui.Toolbar.SIZE:0),b>d&&(b=d,a=papayaRoundFast(b*
  c)));return[a,b]};papaya.Container.prototype.getViewerPadding=function(){var b,a;b=this.containerHtml.parent().width()-(this.fullScreenPadding?2*PAPAYA_PADDING:0);a=this.getViewerDimensions();return(b-a[0])/2};
  papaya.Container.prototype.readGlobalParams=function(){this.kioskMode=!0===this.params.kioskMode||papaya.utilities.PlatformUtils.smallScreen;this.combineParametric=!0===this.params.combineParametric;this.params.loadingComplete&&(this.loadingComplete=this.params.loadingComplete);void 0!==this.params.showControls&&(this.showControls=this.params.showControls);void 0!==this.params.noNewFiles&&(this.noNewFiles=this.params.noNewFiles);void 0!==this.params.showImageButtons&&(this.showImageButtons=this.params.showImageButtons);
  papaya.utilities.PlatformUtils.smallScreen&&(this.showImageButtons=!1);void 0!==this.params.fullScreenPadding&&(this.fullScreenPadding=this.params.fullScreenPadding);void 0!==this.params.orthogonal&&(this.orthogonal=this.params.orthogonal);this.surfaceParams.showSurfacePlanes=!0===this.params.showSurfacePlanes;this.surfaceParams.showSurfaceCrosshairs=!0===this.params.showSurfaceCrosshairs;this.surfaceParams.surfaceBackground=this.params.surfaceBackground;this.orthogonalTall=this.orthogonal&&!0===
  this.params.orthogonalTall;this.orthogonalDynamic=this.orthogonal&&!0===this.params.orthogonalDynamic;void 0!==this.params.allowScroll&&(this.allowScroll=this.params.allowScroll);(papaya.utilities.PlatformUtils.mobile||this.orthogonalDynamic)&&this.orthogonal&&($(window).height()>$(window).width()?this.orthogonalTall=!0:this.orthogonalTall=!1);void 0!==this.params.syncOverlaySeries&&(this.syncOverlaySeries=this.params.syncOverlaySeries);void 0!==this.params.showControlBar&&(this.showControlBar=this.showControls&&
  this.params.showControlBar);void 0!==this.params.contextManager&&(this.contextManager=this.params.contextManager);!0===this.params.fullScreen&&(this.fullScreenPadding=this.params.fullScreenPadding=!1,this.kioskMode=this.params.kioskMode=!0,this.showControlBar=this.params.showControlBar=!1,$("body").css("background-color:'black'"))};
  papaya.Container.prototype.reset=function(){this.loadingSurfaceIndex=this.loadingImageIndex=0;this.collapsable=this.nestedViewer=!1;this.orthogonal=!0;this.noNewFiles=this.kioskMode=this.orthogonalDynamic=this.orthogonalTall=!1;this.showControls=!0;this.showControlBar=!1;this.fullScreenPadding=!0;this.showRuler=this.combineParametric=!1};
  papaya.Container.prototype.resizeViewerComponents=function(b){var a,c,d=0;this.toolbar.closeAllMenus();a=this.getViewerDimensions();c=this.getViewerPadding();this.toolbarHtml.css({width:a[0]+"px"});this.toolbarHtml.css({height:papaya.ui.Toolbar.SIZE+"px"});this.toolbarHtml.css({paddingLeft:c+"px"});this.toolbarHtml.css({paddingBottom:PAPAYA_SPACING+"px"});this.viewerHtml.css({width:a[0]+"px"});this.viewerHtml.css({height:a[1]+"px"});this.viewerHtml.css({paddingLeft:c+"px"});b&&this.viewer.resizeViewer(a);
  this.displayHtml.css({height:papaya.viewer.Display.SIZE+"px"});this.displayHtml.css({paddingLeft:c+"px"});this.displayHtml.css({paddingTop:PAPAYA_SPACING+"px"});this.display.canvas.width=a[0];this.showControls&&this.showControlBar?(this.sliderControlHtml.css({width:a[0]+"px"}),this.sliderControlHtml.css({height:papaya.viewer.Display.SIZE+"px"}),d=this.kioskMode?d+0:d+-50,d=this.viewer.hasSeries?d+200:d+0,a[0]<775+d?($("."+PAPAYA_CONTROL_GOTO_CENTER_BUTTON_CSS).css({display:"none"}),$("."+PAPAYA_CONTROL_GOTO_ORIGIN_BUTTON_CSS).css({display:"none"})):
  ($("."+PAPAYA_CONTROL_GOTO_CENTER_BUTTON_CSS).css({display:"inline"}),$("."+PAPAYA_CONTROL_GOTO_ORIGIN_BUTTON_CSS).css({display:"inline"})),a[0]<600+d?($("."+PAPAYA_CONTROL_DIRECTION_SLIDER).css({display:"none"}),$("."+PAPAYA_CONTROL_MAIN_SLIDER).css({display:"inline"})):($("."+PAPAYA_CONTROL_DIRECTION_SLIDER).css({display:"inline"}),$("."+PAPAYA_CONTROL_MAIN_SLIDER).css({display:"none"})),this.viewer.hasSeries&&a[0]<450+d&&$("."+PAPAYA_CONTROL_MAIN_SLIDER).css({display:"none"}),200>a[0]?$("."+PAPAYA_CONTROL_SWAP_BUTTON_CSS).css({display:"none"}):
  $("."+PAPAYA_CONTROL_SWAP_BUTTON_CSS).css({display:"inline"}),this.viewer.hasSeries?$("."+PAPAYA_CONTROL_DIRECTION_SLIDER).eq(3).css({display:"inline"}):$("."+PAPAYA_CONTROL_DIRECTION_SLIDER).eq(3).css({display:"none"})):this.showControls&&this.viewer.initialized&&(600>a[0]?($("#"+PAPAYA_CONTROL_MAIN_GOTO_CENTER_BUTTON_CSS+this.containerIndex).css({display:"none"}),$("#"+PAPAYA_CONTROL_MAIN_GOTO_ORIGIN_BUTTON_CSS+this.containerIndex).css({display:"none"})):this.viewer.controlsHidden||($("#"+PAPAYA_CONTROL_MAIN_GOTO_CENTER_BUTTON_CSS+
  this.containerIndex).css({display:"inline"}),$("#"+PAPAYA_CONTROL_MAIN_GOTO_ORIGIN_BUTTON_CSS+this.containerIndex).css({display:"inline"})));this.isDesktopMode()&&(600>a[0]?this.titlebarHtml.css({visibility:"hidden"}):this.titlebarHtml.css({visibility:"visible"}));this.nestedViewer&&!this.collapsable||!this.fullScreenPadding?this.containerHtml.css({paddingTop:"0"}):this.containerHtml.css({paddingTop:PAPAYA_CONTAINER_PADDING_TOP+"px"});this.fullScreenPadding&&(this.containerHtml.css({paddingLeft:PAPAYA_PADDING+
  "px"}),this.containerHtml.css({paddingRight:PAPAYA_PADDING+"px"}));this.viewer.initialized?this.viewer.drawViewer(!1,!0):(this.viewer.drawEmptyViewer(),this.display.drawEmptyDisplay());this.titlebarHtml.css({width:a[0]+"px",top:0})};papaya.Container.prototype.updateViewerSize=function(){this.toolbar.closeAllMenus();this.viewer.resizeViewer(this.getViewerDimensions());this.viewer.updateOffsetRect()};
  papaya.Container.prototype.buildViewer=function(b){var a;this.viewerHtml=this.containerHtml.find("."+PAPAYA_VIEWER_CSS);papaya.Container.removeCheckForJSClasses(this.containerHtml,this.viewerHtml);this.viewerHtml.html("");a=this.getViewerDimensions();this.viewer=new papaya.viewer.Viewer(this,a[0],a[1],b);this.viewerHtml.append($(this.viewer.canvas));this.preferences.viewer=this.viewer};
  papaya.Container.prototype.buildDisplay=function(){var b;this.displayHtml=this.containerHtml.find("."+PAPAYA_DISPLAY_CSS);b=this.getViewerDimensions();this.display=new papaya.viewer.Display(this,b[0]);this.displayHtml.append($(this.display.canvas))};papaya.Container.prototype.buildSliderControl=function(){this.sliderControlHtml=this.containerHtml.find("."+PAPAYA_KIOSK_CONTROLS_CSS)};
  papaya.Container.prototype.buildToolbar=function(){this.toolbarHtml=this.containerHtml.find("."+PAPAYA_TOOLBAR_CSS);this.toolbar=new papaya.ui.Toolbar(this);this.toolbar.buildToolbar();this.toolbar.updateImageButtons()};papaya.Container.prototype.readFile=function(b,a){b.file(function(a,b){a&&"."!==b.name.charAt(0)&&a(b)}.bind(this,a))};papaya.Container.prototype.readDir=function(b){this.readDirNextEntries(b.createReader())};
  papaya.Container.prototype.readDirNextEntries=function(b){var a=this;b.readEntries(function(c){var d=c.length,e,f;if(0<d){for(e=0;e<d;e+=1)f=c[e],f.isFile&&a.readFile(f,papaya.utilities.ObjectUtils.bind(a,a.addDroppedFile));a.readDirNextEntries(b)}})};
  papaya.Container.prototype.setUpDnD=function(){var b=this;this.containerHtml[0].ondragover=function(){b.viewer.draggingOver=!0;b.viewer.initialized||b.viewer.drawEmptyViewer();return!1};this.containerHtml[0].ondragleave=function(){b.viewer.draggingOver=!1;b.viewer.initialized||b.viewer.drawEmptyViewer();return!1};this.containerHtml[0].ondragend=function(){b.viewer.draggingOver=!1;b.viewer.initialized||b.viewer.drawEmptyViewer();return!1};this.containerHtml[0].ondrop=function(a){a.preventDefault();
  var c=a.dataTransfer;b.display.drawProgress(.1,"Loading");if(c)if(c.items&&0<c.items.length){a=c.items;var c=a.length,d,e;for(d=0;d<c;d+=1)e=a[d],e.getAsEntry?e=e.getAsEntry():e.webkitGetAsEntry&&(e=e.webkitGetAsEntry()),e.isFile?b.readFile(e,papaya.utilities.ObjectUtils.bind(b,b.addDroppedFile)):e.isDirectory&&b.readDir(e)}else c.files&&0<c.files.length&&b.viewer.loadImage(a.dataTransfer.files);return!1}};
  papaya.Container.prototype.addDroppedFile=function(b){clearTimeout(this.dropTimeout);papayaDroppedFiles.push(b);this.dropTimeout=setTimeout(papaya.utilities.ObjectUtils.bind(this,this.droppedFilesFinishedLoading),100)};
  papaya.Container.prototype.droppedFilesFinishedLoading=function(){papaya.surface.Surface.findSurfaceType(papayaDroppedFiles[0].name)!==papaya.surface.Surface.SURFACE_TYPE_UNKNOWN?this.viewer.loadSurface(papayaDroppedFiles):this.viewer.loadImage(papayaDroppedFiles);papayaDroppedFiles=[]};papaya.Container.prototype.clearParams=function(){this.params=[]};
  papaya.Container.prototype.loadNext=function(){this.hasImageToLoad()?this.loadNextImage():this.hasSurfaceToLoad()?this.loadNextSurface():this.hasAtlasToLoad()&&this.viewer.loadAtlas()};papaya.Container.prototype.hasMoreToLoad=function(){return this.hasImageToLoad()||this.hasSurfaceToLoad()||this.hasAtlasToLoad()};
  papaya.Container.prototype.hasImageToLoad=function(){return this.params.images?this.loadingImageIndex<this.params.images.length:this.params.binaryImages?this.loadingImageIndex<this.params.binaryImages.length:this.params.encodedImages?this.loadingImageIndex<this.params.encodedImages.length:this.params.files?this.loadingImageIndex<this.params.files.length:!1};papaya.Container.prototype.hasAtlasToLoad=function(){return this.viewer.hasDefinedAtlas()};
  papaya.Container.prototype.hasSurfaceToLoad=function(){return papaya.utilities.PlatformUtils.isWebGLSupported()?this.params.surfaces?this.loadingSurfaceIndex<this.params.surfaces.length:this.params.encodedSurfaces?this.loadingSurfaceIndex<this.params.encodedSurfaces.length:!1:(console.log("Warning: This browser version is not able to load surfaces."),!1)};
  papaya.Container.prototype.loadNextSurface=function(){var b=!1,a;this.params.surfaces?this.loadingSurfaceIndex<this.params.surfaces.length?(b=!0,a=this.params.surfaces[this.loadingSurfaceIndex],this.loadingSurfaceIndex+=1,this.viewer.loadSurface(a,!0,!1)):(this.params.loadedSurfaces=this.params.surfaces,this.params.surfaces=[]):this.params.encodedSurfaces&&(this.loadingSurfaceIndex<this.params.encodedSurfaces.length?(b=!0,a=this.params.encodedSurfaces[this.loadingSurfaceIndex],a instanceof Array||
  (a=[],a[0]=this.params.encodedSurfaces[this.loadingSurfaceIndex]),this.viewer.loadSurface(a,!1,!0),this.loadingSurfaceIndex+=1):(this.params.loadedEncodedSurfaces=this.params.encodedSurfaces,this.params.encodedSurfaces=[]));return b};
  papaya.Container.prototype.loadNextImage=function(){var b=!1,a;this.params.images?this.loadingImageIndex<this.params.images.length?(b=!0,a=this.params.images[this.loadingImageIndex],a instanceof Array||(a=[],a[0]=this.params.images[this.loadingImageIndex]),this.viewer.loadImage(a,!0,!1,!1),this.loadingImageIndex+=1):(this.params.loadedImages=this.params.images,this.params.images=[]):this.params.binaryImages?this.loadingImageIndex<this.params.binaryImages.length?(b=!0,a=this.params.binaryImages[this.loadingImageIndex],
  a instanceof Array||(a=[],a[0]=this.params.binaryImages[this.loadingImageIndex]),this.viewer.loadImage(a,!1,!1,!0),this.loadingImageIndex+=1):(this.params.loadedEncodedImages=this.params.binaryImages,this.params.binaryImages=[]):this.params.encodedImages?this.loadingImageIndex<this.params.encodedImages.length?(b=!0,a=this.params.encodedImages[this.loadingImageIndex],a instanceof Array||(a=[],a[0]=this.params.encodedImages[this.loadingImageIndex]),this.viewer.loadImage(a,!1,!0,!1),this.loadingImageIndex+=
  1):(this.params.loadedEncodedImages=this.params.encodedImages,this.params.encodedImages=[]):this.params.files&&(this.loadingImageIndex<this.params.files.length?(b=!0,a=this.params.files[this.loadingImageIndex],a instanceof Array||(a=[],a[0]=this.params.files[this.loadingImageIndex]),this.viewer.loadImage(a,!1,!1,!1),this.loadingImageIndex+=1):(this.params.loadedFiles=this.params.files,this.params.files=[]));return b};
  papaya.Container.prototype.readyForDnD=function(){return!this.kioskMode&&(void 0===this.params.images||this.loadingImageIndex>=this.params.images.length)&&(void 0===this.params.binaryImages||this.loadingImageIndex>=this.params.binaryImages.length)&&(void 0===this.params.encodedImages||this.loadingImageIndex>=this.params.encodedImages.length)&&(void 0===this.params.encodedSurfaces||this.loadingSurfaceIndex>=this.params.encodedSurfaces.length)};
  papaya.Container.prototype.findLoadableImage=function(b,a){var c;for(c=0;c<papayaLoadableImages.length;c+=1)if(a){if(papayaLoadableImages[c].surface&&papayaLoadableImages[c].name==b)return papayaLoadableImages[c]}else if(papayaLoadableImages[c].name==b)return papayaLoadableImages[c];return void 0!==window[b]?{encode:b}:null};
  papaya.Container.prototype.findLoadableImages=function(b,a){var c,d,e=[];Array.isArray(b)||(b=[b]);if(b)for(c=0;c<b.length;c++)(d=this.findLoadableImage(b[c],a))&&e.push(d);return 0<e.length?e:null};
  papaya.Container.prototype.expandViewer=function(){var b=this;this.nestedViewer&&(this.nestedViewer=!1,this.collapsable=!0,this.tempScrollTop=$(window).scrollTop(),$(":hidden").addClass(PAPAYA_CONTAINER_COLLAPSABLE_EXEMPT),$(document.body).children().hide(),this.containerHtml.show(),this.originalStyle={},this.originalStyle.width=document.body.style.width,this.originalStyle.height=document.body.style.height,this.originalStyle.marginTop=document.body.style.marginTop,this.originalStyle.marginRight=document.body.style.marginRight,
  this.originalStyle.marginBottom=document.body.style.marginBottom,this.originalStyle.marginLeft=document.body.style.marginLeft,this.originalStyle.paddingTop=document.body.style.paddingTop,this.originalStyle.paddingRight=document.body.style.paddingRight,this.originalStyle.paddingBottom=document.body.style.paddingBottom,this.originalStyle.paddingLeft=document.body.style.paddingLeft,this.originalStyle.overflow=document.body.style.overflow,papaya.Container.setToFullPage(),this.containerHtml.after('<div style="display:none" class="'+
  PAPAYA_CONTAINER_COLLAPSABLE+'"></div>'),$(document.body).prepend(this.containerHtml),this.resizeViewerComponents(!0),this.viewer.updateOffsetRect(),this.updateViewerSize(),setTimeout(function(){window.scrollTo(0,0);b.viewer.addScroll()},0))};
  papaya.Container.prototype.collapseViewer=function(){var b,a;a=this;if(this.collapsable){this.nestedViewer=!0;this.collapsable=!1;document.body.style.width=this.originalStyle.width;document.body.style.height=this.originalStyle.height;document.body.style.marginTop=this.originalStyle.marginTop;document.body.style.marginRight=this.originalStyle.marginRight;document.body.style.marginBottom=this.originalStyle.marginBottom;document.body.style.marginLeft=this.originalStyle.marginLeft;document.body.style.paddingTop=
  this.originalStyle.paddingTop;document.body.style.paddingRight=this.originalStyle.paddingRight;document.body.style.paddingBottom=this.originalStyle.paddingBottom;document.body.style.paddingLeft=this.originalStyle.paddingLeft;document.body.style.overflow=this.originalStyle.overflow;$("."+PAPAYA_CONTAINER_COLLAPSABLE).replaceWith(this.containerHtml);$(document.body).children(":not(."+PAPAYA_CONTAINER_COLLAPSABLE_EXEMPT+")").show();$("."+PAPAYA_CONTAINER_COLLAPSABLE_EXEMPT).removeClass(PAPAYA_CONTAINER_COLLAPSABLE_EXEMPT);
  this.resizeViewerComponents(!0);for(b=0;b<papayaContainers.length;b+=1)papayaContainers[b].updateViewerSize(),papayaContainers[b].viewer.drawViewer(!0);setTimeout(function(){$(window).scrollTop(a.tempScrollTop);a.viewer.removeScroll()},0)}};papaya.Container.prototype.isNestedViewer=function(){return this.nestedViewer||this.collapsable};papaya.Container.prototype.isDesktopMode=function(){return!this.kioskMode};papaya.Container.prototype.hasLoadedDTI=function(){return this.viewer.hasLoadedDTI()};
  papaya.Container.prototype.disableScrollWheel=function(){return this.isNestedViewer()||papaya.utilities.PlatformUtils.ios};papaya.Container.prototype.canOpenInMango=function(){return this.params.canOpenInMango};papaya.Container.prototype.isExpandable=function(){return this.params.expandable&&this.isNestedViewer()};papaya.Container.prototype.isParametricCombined=function(b){return this.combineParametric&&this.viewer.hasParametricPair(b)};papaya.Container.prototype.isNonParametricCombined=function(b){return!this.isParametricCombined(b)};
  papaya.Container.prototype.coordinateChanged=function(b){var a,c,d=b.currentCoord;if(papaya.Container.syncViewersWorld)for(a=0;a<papayaContainers.length;a+=1)papayaContainers[a].viewer!==b&&(c=new papaya.core.Coordinate,papayaContainers[a].viewer.gotoWorldCoordinate(b.getWorldCoordinateAtIndex(d.x,d.y,d.z,c),!0));else if(papaya.Container.syncViewers)for(a=0;a<papayaContainers.length;a+=1)papayaContainers[a].viewer!==b&&papayaContainers[a].viewer.gotoCoordinate(d,!0);b.surfaceView&&b.surfaceView.updateActivePlanes();
  this.contextManager&&this.contextManager.clearContext&&this.contextManager.clearContext()};papaya.Container.prototype.canCurrentOverlayLoadNegatives=function(){var b=this.viewer.currentScreenVolume;return!b.negative&&null===b.negativeScreenVol};papaya.Container.prototype.canCurrentOverlayLoadMod=function(){var b=this.viewer.currentScreenVolume;return b.dti&&null===b.dtiVolumeMod};
  papaya.Container.prototype.canCurrentOverlayModulate=function(){var b=this.viewer.currentScreenVolume;return b.dti&&null!==b.dtiVolumeMod};window.addEventListener("resize",papaya.Container.resizePapaya,!1);window.addEventListener("orientationchange",papaya.Container.reorientPapaya,!1);window.addEventListener("load",papaya.Container.startPapaya,!1);window.addEventListener("message",function(b){b.data===PAPAYA_MANGO_INSTALLED&&(papaya.mangoinstalled=!0)},!1);
  