/*

 Copyright 2016 Google Inc.
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 MIT
*/
var $jscomp={scope:{}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(n,h,c){if(c.get||c.set)throw new TypeError("ES3 does not support getters and setters.");n!=Array.prototype&&n!=Object.prototype&&(n[h]=c.value)};$jscomp.getGlobal=function(n){return"undefined"!=typeof window&&window===n?n:"undefined"!=typeof global&&null!=global?global:n};$jscomp.global=$jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX="jscomp_symbol_";
$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.symbolCounter_=0;$jscomp.Symbol=function(n){return $jscomp.SYMBOL_PREFIX+(n||"")+$jscomp.symbolCounter_++};
$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var n=$jscomp.global.Symbol.iterator;n||(n=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[n]&&$jscomp.defineProperty(Array.prototype,n,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}};$jscomp.arrayIterator=function(n){var h=0;return $jscomp.iteratorPrototype(function(){return h<n.length?{done:!1,value:n[h++]}:{done:!0}})};
$jscomp.iteratorPrototype=function(n){$jscomp.initSymbolIterator();n={next:n};n[$jscomp.global.Symbol.iterator]=function(){return this};return n};$jscomp.makeIterator=function(n){$jscomp.initSymbolIterator();$jscomp.initSymbol();$jscomp.initSymbolIterator();var h=n[Symbol.iterator];return h?h.call(n):$jscomp.arrayIterator(n)};$jscomp.arrayFromIterator=function(n){for(var h,c=[];!(h=n.next()).done;)c.push(h.value);return c};$jscomp.arrayFromIterable=function(n){return n instanceof Array?n:$jscomp.arrayFromIterator($jscomp.makeIterator(n))};
$jscomp.polyfill=function(n,h,c,m){if(h){c=$jscomp.global;n=n.split(".");for(m=0;m<n.length-1;m++){var e=n[m];e in c||(c[e]={});c=c[e]}n=n[n.length-1];m=c[n];h=h(m);h!=m&&null!=h&&$jscomp.defineProperty(c,n,{configurable:!0,writable:!0,value:h})}};$jscomp.polyfill("Number.isNaN",function(n){return n?n:function(h){return"number"===typeof h&&isNaN(h)}},"es6-impl","es3");
$jscomp.polyfill("Number.isFinite",function(n){return n?n:function(h){return"number"!==typeof h?!1:!isNaN(h)&&Infinity!==h&&-Infinity!==h}},"es6-impl","es3");$jscomp.array=$jscomp.array||{};$jscomp.iteratorFromArray=function(n,h){$jscomp.initSymbolIterator();n instanceof String&&(n+="");var c=0,m={next:function(){if(c<n.length){var e=c++;return{value:h(e,n[e]),done:!1}}m.next=function(){return{done:!0,value:void 0}};return m.next()}};m[Symbol.iterator]=function(){return m};return m};
$jscomp.polyfill("Array.prototype.keys",function(n){return n?n:function(){return $jscomp.iteratorFromArray(this,function(h){return h})}},"es6-impl","es3");$jscomp.polyfill("Number.isInteger",function(n){return n?n:function(h){return Number.isFinite(h)?h===Math.floor(h):!1}},"es6-impl","es3");
$jscomp.polyfill("Array.from",function(n){return n?n:function(h,c,m){$jscomp.initSymbolIterator();c=null!=c?c:function(a){return a};var e=[],a=h[Symbol.iterator];if("function"==typeof a)for(h=a.call(h);!(a=h.next()).done;)e.push(c.call(m,a.value));else for(var a=h.length,b=0;b<a;b++)e.push(c.call(m,h[b]));return e}},"es6-impl","es3");$jscomp.owns=function(n,h){return Object.prototype.hasOwnProperty.call(n,h)};
$jscomp.polyfill("WeakMap",function(n){function h(a){$jscomp.owns(a,m)||$jscomp.defineProperty(a,m,{value:{}})}function c(a){var b=Object[a];b&&(Object[a]=function(a){h(a);return b(a)})}if(function(){if(!n||!Object.seal)return!1;try{var a=Object.seal({}),d=Object.seal({}),c=new n([[a,2],[d,3]]);if(2!=c.get(a)||3!=c.get(d))return!1;c.delete(a);c.set(d,4);return!c.has(a)&&4==c.get(d)}catch(g){return!1}}())return n;var m="$jscomp_hidden_"+Math.random().toString().substring(2);c("freeze");c("preventExtensions");
c("seal");var e=0,a=function(a){this.id_=(e+=Math.random()+1).toString();if(a){$jscomp.initSymbol();$jscomp.initSymbolIterator();a=$jscomp.makeIterator(a);for(var b;!(b=a.next()).done;)b=b.value,this.set(b[0],b[1])}};a.prototype.set=function(a,d){h(a);if(!$jscomp.owns(a,m))throw Error("WeakMap key fail: "+a);a[m][this.id_]=d;return this};a.prototype.get=function(a){return $jscomp.owns(a,m)?a[m][this.id_]:void 0};a.prototype.has=function(a){return $jscomp.owns(a,m)&&$jscomp.owns(a[m],this.id_)};a.prototype.delete=
function(a){return $jscomp.owns(a,m)&&$jscomp.owns(a[m],this.id_)?delete a[m][this.id_]:!1};return a},"es6-impl","es3");$jscomp.ASSUME_NO_NATIVE_MAP=!1;
$jscomp.polyfill("Map",function(n){if(!$jscomp.ASSUME_NO_NATIVE_MAP&&function(){if(!n||!n.prototype.entries||"function"!=typeof Object.seal)return!1;try{var a=Object.seal({x:4}),b=new n($jscomp.makeIterator([[a,"s"]]));if("s"!=b.get(a)||1!=b.size||b.get({x:4})||b.set({x:4},"t")!=b||2!=b.size)return!1;var c=b.entries(),e=c.next();if(e.done||e.value[0]!=a||"s"!=e.value[1])return!1;e=c.next();return e.done||4!=e.value[0].x||"t"!=e.value[1]||!c.next().done?!1:!0}catch(u){return!1}}())return n;$jscomp.initSymbol();
$jscomp.initSymbolIterator();var h=new WeakMap,c=function(b){this.data_={};this.head_=a();this.size=0;if(b){b=$jscomp.makeIterator(b);for(var d;!(d=b.next()).done;)d=d.value,this.set(d[0],d[1])}};c.prototype.set=function(a,b){var d=m(this,a);d.list||(d.list=this.data_[d.id]=[]);d.entry?d.entry.value=b:(d.entry={next:this.head_,previous:this.head_.previous,head:this.head_,key:a,value:b},d.list.push(d.entry),this.head_.previous.next=d.entry,this.head_.previous=d.entry,this.size++);return this};c.prototype.delete=
function(a){a=m(this,a);return a.entry&&a.list?(a.list.splice(a.index,1),a.list.length||delete this.data_[a.id],a.entry.previous.next=a.entry.next,a.entry.next.previous=a.entry.previous,a.entry.head=null,this.size--,!0):!1};c.prototype.clear=function(){this.data_={};this.head_=this.head_.previous=a();this.size=0};c.prototype.has=function(a){return!!m(this,a).entry};c.prototype.get=function(a){return(a=m(this,a).entry)&&a.value};c.prototype.entries=function(){return e(this,function(a){return[a.key,
a.value]})};c.prototype.keys=function(){return e(this,function(a){return a.key})};c.prototype.values=function(){return e(this,function(a){return a.value})};c.prototype.forEach=function(a,b){for(var d=this.entries(),c;!(c=d.next()).done;)c=c.value,a.call(b,c[1],c[0],this)};c.prototype[Symbol.iterator]=c.prototype.entries;var m=function(a,c){var d;d=c&&typeof c;"object"==d||"function"==d?h.has(c)?d=h.get(c):(d=""+ ++b,h.set(c,d)):d="p_"+c;var e=a.data_[d];if(e&&$jscomp.owns(a.data_,d))for(a=0;a<e.length;a++){var f=
e[a];if(c!==c&&f.key!==f.key||c===f.key)return{id:d,list:e,index:a,entry:f}}return{id:d,list:e,index:-1,entry:void 0}},e=function(a,b){var d=a.head_;return $jscomp.iteratorPrototype(function(){if(d){for(;d.head!=a.head_;)d=d.previous;for(;d.next!=d.head;)return d=d.next,{done:!1,value:b(d)};d=null}return{done:!0,value:void 0}})},a=function(){var a={};return a.previous=a.next=a.head=a},b=0;return c},"es6-impl","es3");
$jscomp.checkStringArgs=function(n,h,c){if(null==n)throw new TypeError("The 'this' value for String.prototype."+c+" must not be null or undefined");if(h instanceof RegExp)throw new TypeError("First argument to String.prototype."+c+" must not be a regular expression");return n+""};
$jscomp.polyfill("String.prototype.startsWith",function(n){return n?n:function(h,c){var m=$jscomp.checkStringArgs(this,h,"startsWith");h+="";var e=m.length,a=h.length;c=Math.max(0,Math.min(c|0,m.length));for(var b=0;b<a&&c<e;)if(m[c++]!=h[b++])return!1;return b>=a}},"es6-impl","es3");$jscomp.ASSUME_NO_NATIVE_SET=!1;
$jscomp.polyfill("Set",function(n){if(!$jscomp.ASSUME_NO_NATIVE_SET&&function(){if(!n||!n.prototype.entries||"function"!=typeof Object.seal)return!1;try{var c=Object.seal({x:4}),h=new n($jscomp.makeIterator([c]));if(!h.has(c)||1!=h.size||h.add(c)!=h||1!=h.size||h.add({x:4})!=h||2!=h.size)return!1;var e=h.entries(),a=e.next();if(a.done||a.value[0]!=c||a.value[1]!=c)return!1;a=e.next();return a.done||a.value[0]==c||4!=a.value[0].x||a.value[1]!=a.value[0]?!1:e.next().done}catch(b){return!1}}())return n;
$jscomp.initSymbol();$jscomp.initSymbolIterator();var h=function(c){this.map_=new Map;if(c){c=$jscomp.makeIterator(c);for(var h;!(h=c.next()).done;)this.add(h.value)}this.size=this.map_.size};h.prototype.add=function(c){this.map_.set(c,c);this.size=this.map_.size;return this};h.prototype.delete=function(c){c=this.map_.delete(c);this.size=this.map_.size;return c};h.prototype.clear=function(){this.map_.clear();this.size=0};h.prototype.has=function(c){return this.map_.has(c)};h.prototype.entries=function(){return this.map_.entries()};
h.prototype.values=function(){return this.map_.values()};h.prototype.keys=h.prototype.values;h.prototype[Symbol.iterator]=h.prototype.values;h.prototype.forEach=function(c,h){var e=this;this.map_.forEach(function(a){return c.call(h,a,a,e)})};return h},"es6-impl","es3");$jscomp.polyfill("Math.log2",function(n){return n?n:function(h){return Math.log(h)/Math.LN2}},"es6-impl","es3");
$jscomp.polyfill("Object.assign",function(n){return n?n:function(h,c){for(var m=1;m<arguments.length;m++){var e=arguments[m];if(e)for(var a in e)$jscomp.owns(e,a)&&(h[a]=e[a])}return h}},"es6-impl","es3");$jscomp.EXPOSE_ASYNC_EXECUTOR=!0;$jscomp.FORCE_POLYFILL_PROMISE=!1;
$jscomp.polyfill("Promise",function(n){function h(){this.batch_=null}if(n&&!$jscomp.FORCE_POLYFILL_PROMISE)return n;h.prototype.asyncExecute=function(a){null==this.batch_&&(this.batch_=[],this.asyncExecuteBatch_());this.batch_.push(a);return this};h.prototype.asyncExecuteBatch_=function(){var a=this;this.asyncExecuteFunction(function(){a.executeBatch_()})};var c=$jscomp.global.setTimeout;h.prototype.asyncExecuteFunction=function(a){c(a,0)};h.prototype.executeBatch_=function(){for(;this.batch_&&this.batch_.length;){var a=
this.batch_;this.batch_=[];for(var b=0;b<a.length;++b){var d=a[b];delete a[b];try{d()}catch(f){this.asyncThrow_(f)}}}this.batch_=null};h.prototype.asyncThrow_=function(a){this.asyncExecuteFunction(function(){throw a;})};var m=function(a){this.state_=0;this.result_=void 0;this.onSettledCallbacks_=[];var b=this.createResolveAndReject_();try{a(b.resolve,b.reject)}catch(d){b.reject(d)}};m.prototype.createResolveAndReject_=function(){function a(a){return function(c){d||(d=!0,a.call(b,c))}}var b=this,d=
!1;return{resolve:a(this.resolveTo_),reject:a(this.reject_)}};m.prototype.resolveTo_=function(a){if(a===this)this.reject_(new TypeError("A Promise cannot resolve to itself"));else if(a instanceof m)this.settleSameAsPromise_(a);else{var b;a:switch(typeof a){case "object":b=null!=a;break a;case "function":b=!0;break a;default:b=!1}b?this.resolveToNonPromiseObj_(a):this.fulfill_(a)}};m.prototype.resolveToNonPromiseObj_=function(a){var b=void 0;try{b=a.then}catch(d){this.reject_(d);return}"function"==
typeof b?this.settleSameAsThenable_(b,a):this.fulfill_(a)};m.prototype.reject_=function(a){this.settle_(2,a)};m.prototype.fulfill_=function(a){this.settle_(1,a)};m.prototype.settle_=function(a,b){if(0!=this.state_)throw Error("Cannot settle("+a+", "+b|"): Promise already settled in state"+this.state_);this.state_=a;this.result_=b;this.executeOnSettledCallbacks_()};m.prototype.executeOnSettledCallbacks_=function(){if(null!=this.onSettledCallbacks_){for(var a=this.onSettledCallbacks_,b=0;b<a.length;++b)a[b].call(),
a[b]=null;this.onSettledCallbacks_=null}};var e=new h;m.prototype.settleSameAsPromise_=function(a){var b=this.createResolveAndReject_();a.callWhenSettled_(b.resolve,b.reject)};m.prototype.settleSameAsThenable_=function(a,b){var d=this.createResolveAndReject_();try{a.call(b,d.resolve,d.reject)}catch(f){d.reject(f)}};m.prototype.then=function(a,b){function d(a,b){return"function"==typeof a?function(b){try{c(a(b))}catch(k){e(k)}}:b}var c,e,l=new m(function(a,b){c=a;e=b});this.callWhenSettled_(d(a,c),
d(b,e));return l};m.prototype.catch=function(a){return this.then(void 0,a)};m.prototype.callWhenSettled_=function(a,b){function d(){switch(c.state_){case 1:a(c.result_);break;case 2:b(c.result_);break;default:throw Error("Unexpected state: "+c.state_);}}var c=this;null==this.onSettledCallbacks_?e.asyncExecute(d):this.onSettledCallbacks_.push(function(){e.asyncExecute(d)})};m.resolve=function(a){return a instanceof m?a:new m(function(b,d){b(a)})};m.reject=function(a){return new m(function(b,d){d(a)})};
m.race=function(a){return new m(function(b,d){for(var c=$jscomp.makeIterator(a),e=c.next();!e.done;e=c.next())m.resolve(e.value).callWhenSettled_(b,d)})};m.all=function(a){var b=$jscomp.makeIterator(a),d=b.next();return d.done?m.resolve([]):new m(function(a,c){function e(b){return function(d){f[b]=d;g--;0==g&&a(f)}}var f=[],g=0;do f.push(void 0),g++,m.resolve(d.value).callWhenSettled_(e(f.length-1),c),d=b.next();while(!d.done)})};$jscomp.EXPOSE_ASYNC_EXECUTOR&&(m.$jscomp$new$AsyncExecutor=function(){return new h});
return m},"es6-impl","es3");
$jscomp.polyfill("WeakSet",function(n){if(function(){if(!n||!Object.seal)return!1;try{var c=Object.seal({}),h=Object.seal({}),e=new n([c]);if(!e.has(c)||e.has(h))return!1;e.delete(c);e.add(h);return!e.has(c)&&e.has(h)}catch(a){return!1}}())return n;var h=function(c){this.map_=new WeakMap;if(c){$jscomp.initSymbol();$jscomp.initSymbolIterator();c=$jscomp.makeIterator(c);for(var h;!(h=c.next()).done;)this.add(h.value)}};h.prototype.add=function(c){this.map_.set(c,!0);return this};h.prototype.has=function(c){return this.map_.has(c)};
h.prototype.delete=function(c){return this.map_.delete(c)};return h},"es6-impl","es3");$jscomp.findInternal=function(n,h,c){n instanceof String&&(n=String(n));for(var m=n.length,e=0;e<m;e++){var a=n[e];if(h.call(c,a,e,n))return{i:e,v:a}}return{i:-1,v:void 0}};$jscomp.polyfill("Array.prototype.find",function(n){return n?n:function(h,c){return $jscomp.findInternal(this,h,c).v}},"es6-impl","es3");
$jscomp.polyfill("Array.prototype.values",function(n){return n?n:function(){return $jscomp.iteratorFromArray(this,function(h,c){return c})}},"es6","es3");$jscomp.polyfill("String.prototype.repeat",function(n){return n?n:function(h){var c=$jscomp.checkStringArgs(this,null,"repeat");if(0>h||1342177279<h)throw new RangeError("Invalid count value");h|=0;for(var m="";h;)if(h&1&&(m+=c),h>>>=1)c+=c;return m}},"es6-impl","es3");
$jscomp.polyfill("Array.prototype.entries",function(n){return n?n:function(){return $jscomp.iteratorFromArray(this,function(h,c){return[h,c]})}},"es6-impl","es3");$jscomp.polyfill("Array.prototype.findIndex",function(n){return n?n:function(h,c){return $jscomp.findInternal(this,h,c).i}},"es6-impl","es3");$jscomp.polyfill("Math.sign",function(n){return n?n:function(h){h=Number(h);return 0===h||isNaN(h)?h:0<h?1:-1}},"es6-impl","es3");
$jscomp.polyfill("Array.prototype.fill",function(n){return n?n:function(h,c,m){var e=this.length||0;0>c&&(c=Math.max(0,e+c));if(null==m||m>e)m=e;m=Number(m);0>m&&(m=Math.max(0,e+m));for(c=Number(c||0);c<m;c++)this[c]=h;return this}},"es6-impl","es3");
$jscomp.polyfill("Array.prototype.copyWithin",function(n){return n?n:function(h,c,m){var e=this.length;h=Number(h);c=Number(c);m=Number(null!=m?m:e);if(h<c)for(m=Math.min(m,e);c<m;)c in this?this[h++]=this[c++]:(delete this[h++],c++);else for(m=Math.min(m,e+c-h),h+=m-c;m>c;)--m in this?this[--h]=this[m]:delete this[h];return this}},"es6-impl","es3");
(function(n){function h(m){if(c[m])return c[m].exports;var e=c[m]={i:m,l:!1,exports:{}};n[m].call(e.exports,e,e.exports,h);e.l=!0;return e.exports}var c={};h.m=n;h.c=c;h.i=function(c){return c};h.d=function(c,e,a){h.o(c,e)||Object.defineProperty(c,e,{configurable:!1,enumerable:!0,get:a})};h.n=function(c){var e=c&&c.__esModule?function(){return c["default"]}:function(){return c};h.d(e,"a",e);return e};h.o=function(c,e){return Object.prototype.hasOwnProperty.call(c,e)};h.p="";return h(h.s=195)})([function(n,
h,c){function m(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}c.d(h,"a",function(){return b});c.d(h,"b",function(){return d});var a=function(){function a(a,
b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),b=function(){function b(){e(this,b);this.refCount=1}a(b,[{key:"addRef",value:function(){++this.refCount;return this}},{key:"dispose",value:function(){0===--this.refCount&&this.refCountReachedZero()}},{key:"refCountReachedZero",value:function(){this.disposed();var a=this.disposers;if(null!=
a){for(var b=a.length;0<b;--b){var d=a[b-1];"object"===typeof d?d.dispose():d.call(this)}this.disposers=void 0}this.wasDisposed=!0}},{key:"disposed",value:function(){}},{key:"registerDisposer",value:function(a){var b=this.disposers;null==b?this.disposers=[a]:b.push(a);return a}},{key:"unregisterDisposer",value:function(a){var b=this.disposers;if(null!=b){var d=b.indexOf(a);-1!==d&&b.splice(d,1)}return a}},{key:"registerEventListener",value:function(a,b,d,c){a.addEventListener(b,d,c);this.registerDisposer(function(){return a.removeEventListener(b,
d,c)})}},{key:"registerCancellable",value:function(a){this.registerDisposer(function(){a.cancel()});return a}}]);return b}(),d=function(a){function b(a){e(this,b);var d;d=(b.__proto__||Object.getPrototypeOf(b)).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");d=!d||"object"!==typeof d&&"function"!==typeof d?this:d;d.value=a;return d}m(b,a);return b}(b)},function(n,h,c){function m(a,d){var b=Math.abs(a[d]),c=Math.abs(a[d+1]),e=Math.abs(a[d+2]),
u=Math.max(b,c,e);1E-4>b/u&&(a[d]=0);1E-4>c/u&&(a[d+1]=0);1E-4>e/u&&(a[d+2]=0)}var e=c(78);c.n(e);c.o(e,"mat3")&&c.d(h,"m",function(){return e.mat3});c.o(e,"mat4")&&c.d(h,"b",function(){return e.mat4});c.o(e,"quat")&&c.d(h,"l",function(){return e.quat});c.o(e,"vec3")&&c.d(h,"a",function(){return e.vec3});c.o(e,"vec4")&&c.d(h,"n",function(){return e.vec4});c.d(h,"p",function(){return a});h.j=function(a){return a[0]*a[1]*a[2]};h.o=function(a){return a[0]+","+a[1]+","+a[2]};h.c=function(a){m(a,0);m(a,
4);m(a,8)};h.e=function(a,d,c){var b=d[0],e=d[1];d=d[2];a[0]=c[0]*b+c[4]*e+c[8]*d;a[1]=c[1]*b+c[5]*e+c[9]*d;a[2]=c[2]*b+c[6]*e+c[10]*d;return a};h.h=function(a,d){var b=d[0],c=d[1],e=d[2],u=d[4],p=d[5],r=d[6],k=d[8],v=d[9];d=d[10];a[0]=Math.sqrt(b*b+c*c+e*e);a[1]=Math.sqrt(u*u+p*p+r*r);a[2]=Math.sqrt(k*k+v*v+d*d);return a};h.r=function(a,d,c,g,l){a[0]=g[0];a[1]=g[1];a[2]=g[2]*l;return e.mat4.fromRotationTranslationScale(a,c,d,a)};n=e.mat4.create();h.g=n;h.k=["x","y","z"];var a=function d(a,c){if(!(this instanceof
d))throw new TypeError("Cannot call a class as a function");this.lower=a;this.upper=c};n=[e.vec3.fromValues(1,0,0),e.vec3.fromValues(0,1,0),e.vec3.fromValues(0,0,1)];h.f=n;n=e.vec3.fromValues(0,0,0);h.d=n;n=e.vec3.fromValues(1,1,1);h.q=n;n=e.vec3.fromValues(Infinity,Infinity,Infinity);h.i=n;e.quat.create()},function(n,h,c){function m(a){var b=typeof a;if("number"===b||"string"===b)if(b=parseFloat(""+a),!Number.isNaN(b))return b;throw Error("Expected floating-point number, but received: "+JSON.stringify(a)+
".");}function e(a){a=m(a);if(Number.isFinite(a))return a;throw Error("Expected finite floating-point number, but received: "+a+".");}function a(a){a=e(a);if(0<a)return a;throw Error("Expected positive finite floating-point number, but received: "+a+".");}function b(a){if("object"===typeof a){if(null===a)return"null";if(Array.isArray(a)){var d="[",c=a.length,e=0;if(e<c)for(d+=b(a[e]);++e<c;)d+=",",d+=b(a[e]);return d+"]"}var d="{",c=Object.keys(a).sort(),e=0,f=c.length;if(e<f)for(var g=c[e],d=d+JSON.stringify(g),
d=d+":"+b(a[g]);++e<f;)d+=",",g=c[e],d+=JSON.stringify(g),d+=":",d+=b(a[g]);return d+"}"}return JSON.stringify(a)}function d(a){return a.replace(/['"]/g,function(a){return'"'===a?"'":'"'})}function f(a){if("object"===typeof a){if(null===a)return"null";var b=a.toJSON;if("function"===typeof b)return f(b.call(a));if(Array.isArray(a)){var b="[",c=a.length,e=0;if(e<c)for(b+=f(a[e]);++e<c;)b+="_",b+=f(a[e]);return b+"]"}for(var b="{",e=Object.keys(a),c=!0,e=$jscomp.makeIterator(e),g=e.next();!g.done;g=
e.next()){var g=g.value,k=a[g];void 0!==k&&(k=f(k))&&(c?c=!1:b+="_",b+=d(JSON.stringify(d(g))),b+=":",b+=k)}return b+"}"}return"string"===typeof a?d(JSON.stringify(d(a))):JSON.stringify(a)}function g(a,b,d){var c=/[&_,]/g,e,f,g;'"'===d?(e="'",f=y,g=B):(e='"',f=C,g=x);for(var k="";0<a.length;){var l=a.match(g),p;if(null===l)p=a,l=a="";else{p=a.substr(0,l.index);a=a.substr(l.index+l[0].length);var t=l[1];if(void 0!==t){var u=t,r=e,l=d,t=f;if(2<=u.length&&u.charAt(0)===r&&u.charAt(u.length-1)===r){u=
u.substr(1,u.length-2);for(r=l;0<u.length;){var A=u.match(t);if(null===A){r+=u;break}r+=A[1];r+="\\";r+=l;u=u.substr(A.index+A[0].length)}l=r+l}else l=u}else l=l[2]}k+=p.replace(c,b);k+=l}return k}function l(a){return JSON.parse(g(a,",",'"'))}function u(a,b,d){var c=a.length;if(!Array.isArray(b)||b.length!==c)throw Error("Expected length "+c+" array, but received: "+JSON.stringify(b)+".");for(var e=0;e<c;++e)a[e]=d(b[e],e);return a}function p(a){if("object"!==typeof a||null==a||Array.isArray(a))throw Error("Expected JSON object, but received: "+
JSON.stringify(a)+".");return a}function r(a){var b=parseInt(a,10);if(!Number.isInteger(b))throw Error("Expected integer, but received: "+JSON.stringify(a)+".");return b}function k(a){a=r(a);if(0>=a)throw Error("Expected positive integer, but received: "+a+".");return a}function v(a){if("string"!==typeof a)throw Error("Expected string, but received: "+JSON.stringify(a)+".");return a}var t=c(1);h.v=m;h.j=e;h.s=a;h.z=function(a,b,d){d=void 0===d?m:d;p(b);var c=Object.keys(b);c.sort();if(3!==c.length||
"x"!==c[0]||"y"!==c[1]||"z"!==c[2])throw Error("Expected object to have keys ['x', 'y', 'z'], but received: "+JSON.stringify(b)+".");a[0]=d(b.x);a[1]=d(b.y);a[2]=d(b.z);return a};h.g=function(a,b){var d=a.length;if(!Array.isArray(b)||b.length!==d)throw Error("Incompatible sizes");for(var c=0;c<d;++c)if(!Number.isFinite(parseFloat(b[c])))throw Error("Non-finite value.");for(c=0;c<d;++c)a[c]=parseFloat(b[c]);return a};h.t=function(a,b){var d=a.length;if(!Array.isArray(b)||b.length!==d)throw Error("Incompatible sizes.");
for(var c=0;c<d;++c){var e=parseInt(b[c],void 0);if(!Number.isInteger(e))throw Error("Non-integer value.");}for(c=0;c<d;++c)a[c]=parseInt(b[c],void 0);return a};h.f=b;h.b=f;h.c=l;h.k=function(a,b){if(!Array.isArray(a))throw Error("Expected array, but received: "+JSON.stringify(a)+".");return a.map(b)};h.i=u;h.a=p;h.u=r;h.q=k;h.y=function(a,b){var d=b.get(a);if(void 0===d)throw Error("Expected one of "+JSON.stringify(Array.from(b.keys()))+", but received: "+JSON.stringify(a)+".");return d};h.h=v;h.e=
function(a){if(void 0!==a)return v(a)};h.w=function(a){if(void 0!==a)return r(a)};h.d=function(a,b,d){a=a.hasOwnProperty(b)?a[b]:void 0;try{return d(a)}catch(G){throw Error("Error parsing "+JSON.stringify(b)+" property: "+G.message);}};h.r=function(a,b){p(a);for(var d=new Map,c=$jscomp.makeIterator(Object.keys(a)),e=c.next();!e.done;e=c.next()){e=e.value;try{d.set(e,b(a[e]))}catch(L){throw Error("Error parsing value associated with key "+JSON.stringify(e)+": "+L.message);}}return d};h.l=function(a){if("number"!==
typeof a||!Number.isFinite(a)||0>a||1<a)throw Error("Expected floating point number in [0,1], but received: "+JSON.stringify(a)+".");return a};h.x=function(a){if(""===a)return{};if(a.startsWith("{"))return l(a);var b={};a=a.split(/[&;]/);a=$jscomp.makeIterator(a);for(var d=a.next();!d.done;d=a.next()){var d=d.value,c=d.match(/^([^=&;]+)=([^&;]*)$/);if(null===c)throw Error("Invalid query string part: "+JSON.stringify(d)+".");b[c[1]]=decodeURIComponent(c[2])}return b};h.p=function(a,b){if("string"===
typeof a&&null!==a.match(/^[a-zA-Z]/)&&(a=a.toUpperCase(),b.hasOwnProperty(a)))return b[a];throw Error("Invalid enum value: "+JSON.stringify(a)+".");};h.m=function(a){return u(t.a.create(),a,e)};h.o=function(b){return u(t.a.create(),b,a)};h.n=function(a){return u(t.a.create(),a,k)};n=/('(?:[^'\\]|(?:\\.))*')/;h=/("(?:[^'\\]|(?:\\.))*")/;var B=new RegExp(n.source+"|"+h.source),x=new RegExp(h.source+"|"+n.source),y=/^((?:[^"'\\]|(?:\\.))*)"/,C=/^((?:[^"'\\]|(?:\\.))*)'/},function(n,h,c){function m(a,
b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}c.d(h,"b",function(){return b});c.d(h,"a",function(){return d});var a=function(){function a(a,b){for(var d=
0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),b=function(){function b(){e(this,b);this.handlers=new Set;this.count=0;var a=this;this.dispatch=function(){var b=this,d=arguments;++a.count;a.handlers.forEach(function(a){a.apply(b,d)})}}a(b,[{key:"add",value:function(a){var b=this;this.handlers.add(a);return function(){return b.remove(a)}}},{key:"remove",
value:function(a){return this.handlers.delete(a)}},{key:"dispose",value:function(){this.handlers=void 0}}]);return b}(),d=function(a){function b(){e(this,b);var a=(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?this:a}m(b,a);return b}(b)},function(n,h,c){function m(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
}function e(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function a(a,b,d){for(var c=0;3>c;++c)a[c]=Number.POSITIVE_INFINITY,b[c]=Number.NEGATIVE_INFINITY;d=$jscomp.makeIterator(d);for(c=d.next();!c.done;c=d.next())for(var e=c.value.spec,c=e.lowerChunkBound,
e=e.upperChunkBound,f=0;3>f;++f)a[f]=Math.min(a[f],c[f]),b[f]=Math.max(b[f],e[f])}function b(a,b,d,c){for(var e=y.FULLY_INSIDE,f=0;3>f;++f){var g;g=a[f];var k=b[f],l=d[f],t=c[f];g=g>=t||k<=l?y.FULLY_OUTSIDE:g>=l&&k<=t?y.FULLY_INSIDE:y.PARTIALLY_INSIDE;switch(g){case y.FULLY_OUTSIDE:return g;case y.PARTIALLY_INSIDE:e=g}}return e}function d(a,b){var d=b.length,c=0;if(1<d)for(var e=0,f=0;f<d;++f){var g=b[f].spec.chunkLayout,k;k=g.size;for(var g=g.globalToLocalSpatialVector(x,a),l=0,t=0,p=1,u=0;3>u;++u)var r=
k[u],p=p*r,r=r*g[u],l=Math.min(l,r),t=Math.max(t,r);k=p/(t-l);k>e&&(e=k,c=f)}return b[c]}function f(a){var b=a.voxelSize,d=void 0===a.lowerVoxelBound?t.d:a.lowerVoxelBound,e=a.upperVoxelBound,f=void 0===a.maxVoxelsPerChunkLog2?18:a.maxVoxelsPerChunkLog2;a=void 0===a.transform?t.g:a.transform;a=c.i(t.h)(t.a.create(),a);b=t.a.multiply(a,a,b);a=t.a.fromValues(1,1,1);var g;if(void 0===e)g=t.i;else{g=t.a.create();for(var k=0;3>k;++k)g[k]=Math.pow(2,Math.floor(Math.log2(e[k]-d[k])))}for(d=0;d<f;++d){for(var e=
Infinity,k=-1,l=0;3>l;++l)if(!(a[l]>=g[l])){var p=a[l]*b[l];p<e&&(e=p,k=l)}e=k;if(-1===e)break;a[e]*=2}return a}function g(a){var b=a.flatDimension,d=a.voxelSize,c=a.maxVoxelsPerChunkLog2,e=a.transform;t.a.subtract(x,void 0===a.upperVoxelBound?t.i:a.upperVoxelBound,void 0===a.lowerVoxelBound?t.d:a.lowerVoxelBound);x[b]=1;return f({voxelSize:d,upperVoxelBound:x,maxVoxelsPerChunkLog2:c,transform:e})}function l(a,b){b=b.transform;return void 0===b?void 0===a?t.g:a:void 0===a?b:t.b.multiply(t.b.create(),
b,a)}function u(a){if(void 0!==a.chunkDataSizes)return a.chunkDataSizes;var b=void 0===a.chunkLayoutPreference?F.ISOTROPIC:a.chunkLayoutPreference;switch(b){case F.ISOTROPIC:return[f(a)];case F.FLAT:for(var b=[],d=0;3>d;++d)b[d]=g({flatDimension:d,voxelSize:a.voxelSize,lowerVoxelBound:a.lowerVoxelBound,upperVoxelBound:a.upperVoxelBound,maxVoxelsPerChunkLog2:a.maxVoxelsPerChunkLog2,transform:a.transform});b.push(f(a));return b}throw Error("Invalid chunk layout preference: "+b+".");}var p=c(120),r=
c(68),k=c(133),v=c(29),t=c(1);n=c(7);c.d(h,"b",function(){return v.b});c.d(h,"c",function(){return A});c.d(h,"a",function(){return D});h.i=f;h.h=g;c.d(h,"f",function(){return G});var B=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),x=t.a.create(),y;(function(a){a[a.FULLY_OUTSIDE=0]="FULLY_OUTSIDE";a[a.FULLY_INSIDE=
1]="FULLY_INSIDE";a[a.PARTIALLY_INSIDE=2]="PARTIALLY_INSIDE"})(y||(y={}));var C=[t.a.create(),t.a.create(),t.a.create(),t.a.create()],A=function(f){function g(){m(this,g);var a;a=(g.__proto__||Object.getPrototypeOf(g)).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");a=!a||"object"!==typeof a&&"function"!==typeof a?this:a;a.width=-1;a.height=-1;a.hasViewportToData=!1;a.hasValidViewport=!1;a.viewportToData=t.b.create();a.viewportAxes=[t.a.create(),
t.a.create(),t.a.create()];a.previousViewportAxes=[t.a.create(),t.a.create()];a.centerDataPosition=t.a.create();a.viewportPlaneDistanceToOrigin=0;a.visibleChunkLayouts=new Map;a.visibleLayers=new Map;a.visibleSourcesStale=!0;a.pixelSize=0;t.b.identity(a.viewportToData);return a}e(g,f);B(g,[{key:"onViewportChanged",value:function(){}},{key:"maybeSetHasValidViewport",value:function(){!this.hasValidViewport&&-1!==this.width&&-1!==this.height&&this.hasViewportToData&&(this.hasValidViewport=!0,this.onHasValidViewport());
if(this.hasValidViewport)this.onViewportChanged()}},{key:"onHasValidViewport",value:function(){}},{key:"setViewportSize",value:function(a,b){return a!==this.width||b!==this.height?(this.width=a,this.height=b,this.maybeSetHasValidViewport(),!0):!1}},{key:"setViewportToDataMatrix",value:function(a){if(this.hasViewportToData&&t.b.equals(this.viewportToData,a))return!1;this.hasViewportToData=!0;var b=this.viewportToData;t.b.copy(b,a);c.i(t.c)(b);t.a.transformMat4(this.centerDataPosition,t.d,a);a=0;for(var d=
this.viewportAxes,e=this.previousViewportAxes,f=0;3>f;++f){var g=d[f];c.i(t.e)(g,t.f[f],b);0===f&&(a=t.a.length(g));t.a.normalize(g,g)}this.viewportAxes=d;this.previousViewportAxes=e;if(!c.i(k.a)(a,this.pixelSize)||.95>t.a.dot(d[0],e[0])||.95>t.a.dot(d[1],e[1]))t.a.copy(e[0],d[0]),t.a.copy(e[1],d[1]),this.visibleSourcesStale=!0,this.pixelSize=a;this.viewportPlaneDistanceToOrigin=t.a.dot(this.centerDataPosition,this.viewportAxes[2]);this.onViewportToDataMatrixChanged();this.maybeSetHasValidViewport();
return!0}},{key:"onViewportToDataMatrixChanged",value:function(){}},{key:"updateVisibleSources",value:function(){if(this.visibleSourcesStale){this.visibleSourcesStale=!1;var a=1.1*this.pixelSize,b=this.visibleChunkLayouts,c=this.viewportAxes[2],e=this.visibleLayers;b.clear();for(var f={},e=$jscomp.makeIterator(e),g=e.next();!g.done;f={smallestVoxelSize:f.smallestVoxelSize,visibleSources:f.visibleSources},g=e.next()){var g=$jscomp.makeIterator(g.value),k=g.next().value;f.visibleSources=g.next().value;
f.visibleSources.length=0;var g=k.sources,l=g.length,k=void 0;f.smallestVoxelSize=g[0][0].spec.voxelSize;for(var t=function(b){return function(d){for(var c=0;3>c;++c){var e=d[c];if(e>a&&e>b.smallestVoxelSize[c])return!0}return!1}}(f),p=function(a){return function(d,c){a.visibleSources[a.visibleSources.length++]=d;var e=d.spec.chunkLayout,f=b.get(e);void 0===f&&(f=new Map,b.set(e,f));f.set(d,c)}}(f),k=l-1;;){l=d(c,g[k]);p(l,k);if(0===k||!t(l.spec.voxelSize))break;--k}f.visibleSources.reverse()}}}},
{key:"computeVisibleChunks",value:function(d,e){var f=this;this.updateVisibleSources();for(var g=this.width,k=this.height,l=this.viewportToData,p=0;3>p;++p)C[0][p]=-t.f[0][p]*g/2-t.f[1][p]*k/2,C[1][p]=-t.f[0][p]*g/2+t.f[1][p]*k/2,C[2][p]=t.f[0][p]*g/2-t.f[1][p]*k/2,C[3][p]=t.f[0][p]*g/2+t.f[1][p]*k/2;for(g=0;4>g;++g)t.a.transformMat4(C[g],C[g],l);var u=t.a.create(),z=t.a.create(),v=t.a.create(),J=t.a.create(),B=t.a.create(),L=t.a.create(),A=[],G=[];this.visibleChunkLayouts.forEach(function(g,k){function l(){for(var a=
0,b=0,d=0;3>d;++d)var c=L[d],e=u[d],f=z[d]-e,g=B[d]*f,a=a+c*(e+g),b=b+c*(e+f-g);return a<F?!1:b<=F}function p(a){function d(){E=c.i(r.a)(A,0,B,function(a){var d=a.spec;switch(b(u,z,d.lowerChunkBound,d.upperChunkBound)){case y.PARTIALLY_INSIDE:return!0;case y.FULLY_INSIDE:G.push(a);default:return!1}})}if(0!==G.length||0!==E){for(var f=1,g=0;3>g;++g)f*=Math.max(0,z[g]-u[g]);if(0!==f&&l())if(1===f)e(k,D,u,G);else{for(var t;;)if(f=u[a],g=z[a],t=g-f,1===t)a=(a+1)%3;else break;t=f+Math.floor(.5*t);var v=
(a+1)%3,J=G.length;z[a]=t;var B=E;d();p(v);G.length=J;E=B;z[a]=g;u[a]=t;d();p(v);u[a]=f;G.length=J;E=B}}}var D=d(k);a(v,J,g.keys());t.a.set(u,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY);t.a.set(z,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);k.globalToLocalSpatialVector(L,f.viewportAxes[2]);for(var h=0;3>h;++h)B[h]=0<L[h]?1:0;for(var F=t.a.dot(k.globalToLocalGrid(x,f.centerDataPosition),L),h=0;4>h;++h)for(var m=k.globalToLocalGrid(x,C[h]),
I=0;3>I;++I)u[I]=Math.min(u[I],Math.floor(m[I])),z[I]=Math.max(z[I],Math.floor(m[I])+1);t.a.max(u,u,v);t.a.min(z,z,J);G.length=0;A.length=0;g=$jscomp.makeIterator(g.keys());for(h=g.next();!h.done;h=g.next())switch(h=h.value,m=h.spec,b(u,z,m.lowerChunkBound,m.upperChunkBound)){case y.FULLY_INSIDE:G.push(h);break;case y.PARTIALLY_INSIDE:A.push(h)}var E=A.length;p(0)})}}]);return g}(n.b),D;(function(a){a[a.UNKNOWN=0]="UNKNOWN";a[a.IMAGE=1]="IMAGE";a[a.SEGMENTATION=2]="SEGMENTATION"})(D||(D={}));h.g=
18;var F;(function(a){a[a.ISOTROPIC=0]="ISOTROPIC";a[a.FLAT=1]="FLAT"})(F||(F={}));var G=function(){function a(b){m(this,a);var d=b.dataType,e=void 0===b.lowerVoxelBound?t.d:b.lowerVoxelBound,f=b.upperVoxelBound,g=b.chunkDataSize,k=b.voxelSize,l=b.transform,u=void 0===b.baseVoxelOffset?t.d:b.baseVoxelOffset,r=b.numChannels,z=void 0===b.lowerClipBound?t.a.multiply(t.a.create(),k,e):b.lowerClipBound,B=void 0===b.upperClipBound?t.a.multiply(t.a.create(),k,f):b.upperClipBound;this.dataType=b.dataType;
this.numChannels=r;this.voxelSize=k;this.chunkDataSize=g;this.chunkLayout=p.a.get(t.a.multiply(t.a.create(),b.chunkDataSize,k),l);this.chunkBytes=c.i(t.j)(b.chunkDataSize)*v.a[d]*r;this.lowerClipBound=z;this.upperClipBound=B;this.lowerVoxelBound=e;this.upperVoxelBound=f;this.baseVoxelOffset=u;d=this.lowerChunkBound=t.a.create();k=this.upperChunkBound=t.a.create();for(l=0;3>l;++l)d[l]=Math.floor(e[l]/g[l]),k[l]=Math.floor((f[l]-1)/g[l]+1);this.compressedSegmentationBlockSize=b.compressedSegmentationBlockSize}
B(a,[{key:"toObject",value:function(){return{transform:this.chunkLayout.transform,numChannels:this.numChannels,chunkDataSize:this.chunkDataSize,voxelSize:this.voxelSize,dataType:this.dataType,lowerVoxelBound:this.lowerVoxelBound,upperVoxelBound:this.upperVoxelBound,lowerClipBound:this.lowerClipBound,upperClipBound:this.upperClipBound,baseVoxelOffset:this.baseVoxelOffset,compressedSegmentationBlockSize:this.compressedSegmentationBlockSize}}}],[{key:"make",value:function(b){return new a(Object.assign({},
b,{transform:l(b.transform,b.volumeSourceOptions)}))}},{key:"fromObject",value:function(b){return new a(b)}},{key:"withDefaultCompression",value:function(b){var d=b.compressedSegmentationBlockSize,c=b.dataType,e=b.voxelSize,g=b.transform,k=b.lowerVoxelBound,p=b.upperVoxelBound,g=l(g,b.volumeSourceOptions);void 0!==d||b.volumeType!==D.SEGMENTATION||c!==v.b.UINT32&&c!==v.b.UINT64||(d=f({voxelSize:e,transform:g,lowerVoxelBound:k,upperVoxelBound:p,maxVoxelsPerChunkLog2:9}));return new a(Object.assign({},
b,{compressedSegmentationBlockSize:d,transform:g}))}},{key:"getDefaults",value:function(b){var d=Object.assign({},b,{transform:l(b.transform,b.volumeSourceOptions)});return(void 0===b.chunkDataSizes?u(d):b.chunkDataSizes).map(function(d){return a.withDefaultCompression(Object.assign({},b,{chunkDataSize:d}))})}}]);return a}();h.d="SliceView";h.e="sliceview/RenderLayer"},function(n,h,c){function m(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function e(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function a(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function b(a,b){for(var d=$jscomp.makeIterator(F),c=d.next();!c.done;c=d.next())if(c=c.value,c=c(a,b),null!=c)return c;throw Error("No chunk format handler found.");
}var d=c(16);n=c(25);var f=c(4),g=c(39),l=c(0),u=c(1),p=c(2),r=c(23),k=c(3),v=c(44),t=c(18),B=c(46),x=c(7);c.d(h,"a",function(){return D});h.c=function(a){F.push(a)};h.e=function(b){var d=function(d){function f(a,b,d){m(this,f);a=e(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,a,b));a.parameters=d;return a}a(f,d);y(f,[{key:"initializeCounterpart",value:function(a,b){b.parameters=this.parameters;C(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"initializeCounterpart",this).call(this,
a,b)}},{key:"toString",value:function(){return b.stringify(this.parameters)}}],[{key:"get",value:function(a,b,d){var e=this;return a.getChunkSource(this,c.i(p.f)({parameters:d,spec:b.toObject()}),function(){return new e(a,b,d)})}}]);return f}(L);d.prototype.RPC_TYPE_ID=b.RPC_ID;return d};c.d(h,"d",function(){return J});c.d(h,"b",function(){return I});var y=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);
Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),C=function U(a,b,d){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,b);if(void 0===c){if(a=Object.getPrototypeOf(a),null!==a)return U(a,b,d)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(d)}};h=this&&this.__decorate||function(a,b,d,c){var e=arguments.length,f=3>e?b:null===c?c=Object.getOwnPropertyDescriptor(b,d):c,g;if("object"===typeof Reflect&&
"function"===typeof Reflect.decorate)f=Reflect.decorate(a,b,d,c);else for(var k=a.length-1;0<=k;k--)if(g=a[k])f=(3>e?g(f):3<e?g(b,d,f):g(b,d))||f;return 3<e&&f&&Object.defineProperty(b,d,f),f};var A=u.b.create(),D=function(b){function d(a,b,f){m(this,d);var g=e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));g.chunkManager=a;g.layerManager=b;g.navigationState=f;g.gl=g.chunkManager.gl;g.dataToViewport=u.b.create();g.viewportToDevice=u.b.create();g.dataToDevice=u.b.create();g.visibleChunks=
new Map;g.viewChanged=new k.a;g.renderingStale=!0;g.visibleChunksStale=!0;g.visibleLayersStale=!1;g.visibleLayerList=[];g.newVisibleLayers=new Set;g.offscreenFramebuffer=g.registerDisposer(new v.a(g.gl,{colorBuffers:c.i(v.b)(g.gl,1),depthBuffer:new v.e(g.gl)}));u.b.identity(g.dataToViewport);g.initializeCounterpart(g.chunkManager.rpc,{chunkManager:a.rpcId});g.updateVisibleLayers();g.registerDisposer(f.changed.add(function(){g.updateViewportFromNavigationState()}));g.updateViewportFromNavigationState();
g.registerDisposer(b.layersChanged.add(function(){!g.visibleLayersStale&&g.hasValidViewport&&(g.visibleLayersStale=!0,setTimeout(g.updateVisibleLayers.bind(g),0))}));g.viewChanged.add(function(){g.renderingStale=!0});g.registerDisposer(a.chunkQueueManager.visibleChunksChanged.add(g.viewChanged.dispatch));g.updateViewportFromNavigationState();return g}a(d,b);y(d,[{key:"updateViewportFromNavigationState",value:function(){var a=this.navigationState;a.valid&&(a.toMat4(A),this.setViewportToDataMatrix(A))}},
{key:"updateVisibleLayers",value:function(){if(!this.hasValidViewport)return!1;this.visibleLayersStale=!1;var a=this.visibleLayers,b=this.rpc,d={id:this.rpcId},c=this.newVisibleLayers,e=!1,f=this.visibleLayerList;f.length=0;for(var k=$jscomp.makeIterator(this.layerManager.readyRenderLayers()),l=k.next();!l.done;l=k.next())l=l.value,l instanceof g.a&&(c.add(l),f.push(l),a.has(l)||(a.set(l.addRef(),[]),l.redrawNeeded.add(this.viewChanged.dispatch),d.layerId=l.rpcId,b.invoke("SliceView.addVisibleLayer",
d),e=!0));f=$jscomp.makeIterator(a.keys());for(l=f.next();!l.done;l=f.next())k=l.value,c.has(k)||(a.delete(k),k.redrawNeeded.remove(this.viewChanged.dispatch),d.layerId=k.rpcId,b.invoke("SliceView.removeVisibleLayer",d),k.dispose(),e=!0);c.clear();e&&(this.visibleSourcesStale=!0);this.viewChanged.dispatch();return e}},{key:"onViewportChanged",value:function(){var a=this.width,b=this.height,d=this.viewportToDevice,c=this.dataToViewport,e=this.dataToDevice;u.b.ortho(d,-a/2,a/2,b/2,-b/2,-10,10);u.b.multiply(e,
d,c);this.visibleChunksStale=!0;this.viewChanged.dispatch()}},{key:"setViewportSize",value:function(a,b){return C(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"setViewportSize",this).call(this,a,b)?(this.rpc.invoke("SliceView.updateView",{id:this.rpcId,width:a,height:b}),!0):!1}},{key:"onViewportToDataMatrixChanged",value:function(){var a=this.viewportToData,b=this.dataToViewport;u.b.invert(b,a);c.i(u.c)(b);this.rpc.invoke("SliceView.updateView",{id:this.rpcId,viewportToData:a})}},{key:"onHasValidViewport",
value:function(){this.updateVisibleLayers()}},{key:"updateRendering",value:function(){if(this.renderingStale&&this.hasValidViewport&&0!==this.width&&0!==this.height){this.renderingStale=!1;this.maybeUpdateVisibleChunks();var a=this.gl,b=this.offscreenFramebuffer;b.bind(this.width,this.height);a.disable(a.SCISSOR_TEST);a.clearStencil(0);a.clearColor(0,0,0,0);a.colorMask(!0,!0,!0,!0);a.clear(a.COLOR_BUFFER_BIT);a.enable(a.STENCIL_TEST);a.disable(a.DEPTH_TEST);a.stencilOpSeparate(a.FRONT_AND_BACK,a.KEEP,
a.KEEP,a.REPLACE);for(var d=0,c=$jscomp.makeIterator(this.visibleLayerList),e=c.next();!e.done;e=c.next())e=e.value,a.clear(a.STENCIL_BUFFER_BIT),a.stencilFuncSeparate(a.FRONT_AND_BACK,a.GREATER,1,1),1===d&&(a.enable(a.BLEND),a.blendFunc(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA)),e.draw(this),++d;a.disable(a.BLEND);a.disable(a.STENCIL_TEST);b.unbind()}}},{key:"maybeUpdateVisibleChunks",value:function(){if(!this.visibleChunksStale&&!this.visibleSourcesStale)return!1;this.visibleChunksStale=!1;this.updateVisibleChunks();
return!0}},{key:"updateVisibleChunks",value:function(){var a=this.visibleChunks;this.computeVisibleChunks(function(b){var d=a.get(b);void 0===d?(d=[],a.set(b,d)):d.length=0;return d},function(a,b,d){a=c.i(u.o)(d);b[b.length]=a})}},{key:"disposed",value:function(){for(var a=$jscomp.makeIterator(this.visibleLayers.keys()),b=a.next();!b.done;b=a.next())b.value.dispose();this.visibleLayers.clear();this.visibleLayerList.length=0}}]);return d}(f.c),D=h([c.i(x.c)(f.d)],D),F=[],G=u.a.create(),z=u.a.create(),
L=function(d){function f(a,d){m(this,f);var c=e(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,a));c.spec=d;c.chunkFormatHandler=c.registerDisposer(b(a.chunkQueueManager.gl,d));return c}a(f,d);y(f,[{key:"initializeCounterpart",value:function(a,b){b.spec=this.spec.toObject();C(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"initializeCounterpart",this).call(this,a,b)}},{key:"getValueAt",value:function(a){var b=this.spec,d=b.chunkLayout,e=d.size;d.globalToLocalSpatial(z,a);for(a=
0;3>a;++a)G[a]=Math.floor(z[a]/e[a]);a=c.i(u.o)(G);a=this.chunks.get(a);if(!a)return null;for(var d=b.voxelSize,f=0;3>f;++f)G[f]=Math.floor((z[f]-G[f]*e[f])/d[f]);e=a.chunkDataSize;for(d=0;3>d;++d)if(G[d]>=e[d])return;b=b.numChannels;if(1===b)return a.getChannelValueAt(G,0);e=Array(b);for(d=0;d<b;++d)e[d]=a.getChannelValueAt(G,d);return e}},{key:"getChunk",value:function(a){return this.chunkFormatHandler.getChunk(this,a)}},{key:"chunkFormat",get:function(){return this.chunkFormatHandler.chunkFormat}}]);
return f}(n.c),J=function(b){function c(a,b){m(this,c);var f=e(this,(c.__proto__||Object.getPrototypeOf(c)).call(this,a));f.chunkGridPosition=b.chunkGridPosition;f.chunkDataSize=b.chunkDataSize||a.spec.chunkDataSize;f.state=d.b.SYSTEM_MEMORY;return f}a(c,b);y(c,[{key:"chunkFormat",get:function(){return this.source.chunkFormat}}]);return c}(n.d),I=function(b){function d(a,b){m(this,d);var f=e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));f.gl=a;f.copyVertexPositionsBuffer=c.i(B.a)(f.gl);
f.textureCoordinateAdjustment=new Float32Array(4);var g=new t.a(a);g.addVarying("vec2","vTexCoord");g.addUniform("sampler2D","uSampler");g.addInitializer(function(b){a.uniform1i(b.uniform("uSampler"),0)});g.addUniform("vec4","uColorFactor");g.addUniform("vec4","uBackgroundColor");g.addUniform("mat4","uProjectionMatrix");g.addUniform("vec4","uTextureCoordinateAdjustment");g.require(b);g.setFragmentMain("\nvec4 sampledColor = texture2D(uSampler, vTexCoord);\nif (sampledColor.a == 0.0) {\n  sampledColor = uBackgroundColor;\n}\nemit(sampledColor * uColorFactor, vec4(0,0,0,0));\n");
g.addAttribute("vec4","aVertexPosition");g.setVertexMain("\nvTexCoord = uTextureCoordinateAdjustment.xy + 0.5 * (aVertexPosition.xy + 1.0) * uTextureCoordinateAdjustment.zw;\ngl_Position = uProjectionMatrix * aVertexPosition;\n");f.shader=f.registerDisposer(g.build());return f}a(d,b);y(d,[{key:"draw",value:function(a,b,d,c,e,f,g,k){var l=this.gl,p=this.shader,t=this.textureCoordinateAdjustment;t[0]=e;t[1]=f;t[2]=g-e;t[3]=k-f;p.bind();l.activeTexture(l.TEXTURE0);l.bindTexture(l.TEXTURE_2D,a);l.uniformMatrix4fv(p.uniform("uProjectionMatrix"),
!1,b);l.uniform4fv(p.uniform("uColorFactor"),d);l.uniform4fv(p.uniform("uBackgroundColor"),c);l.uniform4fv(p.uniform("uTextureCoordinateAdjustment"),t);a=p.attribute("aVertexPosition");this.copyVertexPositionsBuffer.bindToVertexAttrib(a,2);l.drawArrays(l.TRIANGLE_FAN,0,4);l.disableVertexAttribArray(a);l.bindTexture(l.TEXTURE_2D,null)}}],[{key:"get",value:function(a,b){return a.memoize.get("sliceview/SliceViewRenderHelper:"+c.i(r.a)(b),function(){return new d(a,b)})}}]);return d}(l.a)},function(n,
h,c){var m=c(29),e=c(135);c.d(h,"a",function(){return a});h.b=function(a){return(a[3]+1/256*a[2]+1/65536*a[1]+1/16777216*a[0])/256};c.d(h,"q",function(){return b});c.d(h,"d",function(){return g});c.d(h,"p",function(){return l});c.d(h,"o",function(){return u});h.m=function(a,b){for(var d=0;4>d;++d)a[d]=(b>>8*d&255)/255;return a};h.c=function(a,b){b=void 0===b?1:b;switch(a){case m.b.FLOAT32:if(1===b)return"float";if(1<b&&4>b)return"vec"+b;break;case m.b.UINT8:if(1===b)return"uint8_t";if(1<b&&4>b)return"uint8x"+
b+"_t";break;case m.b.UINT16:if(1===b)return"uint16_t";if(2===b)return"uint16x2_t";break;case m.b.UINT32:if(1===b)return"uint32_t";break;case m.b.UINT64:if(1===b)return"uint64_t"}throw Error("No shader type for "+m.b[a]+"["+b+"].");};var a="\nvec4 packFloat01ToFixedPoint(const float value) {\n  const vec4 shift = vec4(256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0);\n  const vec4 mask = vec4(0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0);\n  vec4 result = fract(value * shift);\n  result -= result.xxyz * mask;\n  return result * 256.0 / 255.0;\n}\n",
b="\nvec3 hueToRgb(float hue) {\n  float hue6 = hue * 6.0;\n  float r = abs(hue6 - 3.0) - 1.0;\n  float g = 2.0 - abs(hue6 - 2.0);\n  float b = 2.0 - abs(hue6 - 4.0);\n  return clamp(vec3(r, g, b), 0.0, 1.0);\n}\nvec3 hsvToRgb(vec3 c) {\n  vec3 hueRgb = hueToRgb(c.x);\n  return c.z * ((hueRgb - 1.0) * c.y + 1.0);\n}\n";n=["float","vec2","vec3","vec4"].map(function(a){return"\n"+a+" unnormalizeUint8("+a+" value) {\n  return floor(value * 255.0 + 0.5);\n}\n"}).join("");h.f=n;var d=[n,"\nfloat uintleToFloat(float v) {\n  return unnormalizeUint8(v);\n}\nfloat uintleToFloat(vec2 v) {\n  v = unnormalizeUint8(v);\n  return v.x + v.y * 256.0;\n}\nfloat uintleToFloat(vec3 v) {\n  v = unnormalizeUint8(v);\n  return v.x + v.y * 256.0 + v.z * 256.0 * 256.0;\n}\n"];
h.g=d;var f=[n,"\nfloat uintbeToFloat(float v) {\n  return unnormalizeUint8(v);\n}\nfloat uintbeToFloat(vec2 v) {\n  v = unnormalizeUint8(v);\n  return v.y + v.x * 256.0;\n}\nfloat uintbeToFloat(vec3 v) {\n  v = unnormalizeUint8(v);\n  return v.z + v.y * 256.0 + v.x * 256.0 * 256.0;\n}\n"];(function(){var a=e.a===e.b.BIG?"be":"le";return[e.a===e.b.BIG?f:d,"\nfloat uintToFloat(float v) {\n  return uint"+a+"ToFloat(v);\n}\nfloat uintToFloat(vec2 v) {\n  return uint"+a+"ToFloat(v);\n}\nfloat uintToFloat(vec3 v) {\n  return uint"+
a+"ToFloat(v);\n}\n"]})();h.e="\nstruct uint64_t {\n  vec4 low, high;\n};\nuint64_t toUint64(uint64_t x) { return x; }\n";h.h=[n,"\nstruct uint64_t {\n  vec4 low, high;\n};\nuint64_t toUint64(uint64_t x) { return x; }\n","\nstruct uint8_t {\n  float value;\n};\nstruct uint8x2_t {\n  vec2 value;\n};\nstruct uint8x3_t {\n  vec3 value;\n};\nstruct uint8x4_t {\n  vec4 value;\n};\nfloat toRaw(uint8_t x) { return unnormalizeUint8(x.value); }\nfloat toNormalized(uint8_t x) { return x.value; }\nvec2 toRaw(uint8x2_t x) { return unnormalizeUint8(x.value); }\nvec2 toNormalized(uint8x2_t x) { return x.value; }\nvec3 toRaw(uint8x3_t x) { return unnormalizeUint8(x.value); }\nvec3 toNormalized(uint8x3_t x) { return x.value; }\nvec4 toRaw(uint8x4_t x) { return unnormalizeUint8(x.value); }\nvec4 toNormalized(uint8x4_t x) { return x.value; }\nuint64_t toUint64(uint8_t x) {\n  uint64_t result;\n  result.low = vec4(x.value, 0.0, 0.0, 0.0);\n  result.high = vec4(0.0, 0.0, 0.0, 0.0);\n  return result;\n}\n"];
h.k="\nfloat toRaw(float x) { return x; }\nfloat toNormalized(float x) { return x; }\nvec2 toRaw(vec2 x) { return x; }\nvec2 toNormalized(vec2 x) { return x; }\nvec3 toRaw(vec3 x) { return x; }\nvec3 toNormalized(vec3 x) { return x; }\nvec4 toRaw(vec4 x) { return x; }\nvec4 toNormalized(vec4 x) { return x; }\n";h.i=["\nstruct uint64_t {\n  vec4 low, high;\n};\nuint64_t toUint64(uint64_t x) { return x; }\n",d,"\nstruct uint16_t {\n  vec2 value;\n};\nstruct uint16x2_t {\n  vec4 value;\n};\nfloat toRaw(uint16_t x) { return uintleToFloat(x.value); }\nfloat toNormalized(uint16_t x) { return toRaw(x) / 65535.0; }\nvec2 toRaw(uint16x2_t x) { return vec2(uintleToFloat(x.value.xy), uintleToFloat(x.value.zw)); }\nvec2 toNormalized(uint16x2_t x) { return toRaw(x) / 65535.0; }\nuint64_t toUint64(uint16_t x) {\n  uint64_t result;\n  result.low = vec4(x.value, 0.0, 0.0);\n  result.high = vec4(0.0, 0.0, 0.0, 0.0);\n  return result;\n}\n"];
n=["\nstruct uint64_t {\n  vec4 low, high;\n};\nuint64_t toUint64(uint64_t x) { return x; }\n","\nstruct uint32_t {\n  vec4 value;\n};\nuint64_t toUint64(uint32_t x) {\n  uint64_t result;\n  result.low = x.value;\n  result.high = vec4(0.0, 0.0, 0.0, 0.0);\n  return result;\n}\n"];h.j=n;var g=["\nvec3 getSubscriptsFromNormalized(vec3 normalizedPosition, vec3 size) {\n  return floor(min(normalizedPosition * size, size - 1.0));\n}\n","\nfloat getFortranOrderIndex(vec3 subscripts, vec3 size) {\n  return subscripts.x + size.x * (subscripts.y + size.y * subscripts.z);\n}\n",
"\nfloat getFortranOrderIndexFromNormalized(vec3 normalizedPosition, vec3 size) {\n  return getFortranOrderIndex(getSubscriptsFromNormalized(normalizedPosition, size), size);\n}\n"],l="\nfloat imod(float x, float y) {\n  return x - y * floor(x / y);\n}\n",u="\nfloat exactDot(vec4 a, vec4 b) {\n  return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\n}\nfloat exactDot(vec3 a, vec3 b) {\n  return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n}\n";h.l=[n,"\nuint32_t add(uint32_t a, uint32_t b) {\n  uint32_t result;\n  float partial = 0.0;\n\n  partial += a.value.x * 255.0 + b.value.x * 255.0;\n  {\n    float byte0 = mod(partial, 256.0);\n    result.value.x = byte0 / 255.0;\n    partial = (partial - byte0) / 256.0;\n  }\n\n  partial += a.value.y * 255.0 + b.value.y * 255.0;\n  {\n    float byte1 = mod(partial, 256.0);\n    result.value.y = byte1 / 255.0;\n    partial = (partial - byte1) / 256.0;\n  }\n\n  partial += a.value.z * 255.0 + b.value.z * 255.0;\n  {\n    float byte2 = mod(partial, 256.0);\n    result.value.z = byte2 / 255.0;\n    partial = (partial - byte2) / 256.0;\n  }\n\n  partial += a.value.w * 255.0 + b.value.w * 255.0;\n  {\n    float byte3 = mod(partial, 256.0);\n    result.value.w = byte3 / 255.0;\n    partial = (partial - byte3) / 256.0;\n  }\n  return result;\n}\n"];
h.n=[n,"\nfloat divmod(uint32_t dividend, float divisor, out uint32_t quotient) {\n\n  float partial = dividend.value.w * 255.0;\n  float remainder;\n\n  remainder = mod(partial, divisor);\n  quotient.value.w = (partial - remainder) / divisor / 255.0;\n  partial = remainder * 256.0 + dividend.value.z * 255.0;\n\n  remainder = mod(partial, divisor);\n  quotient.value.z = (partial - remainder) / divisor / 255.0;\n  partial = remainder * 256.0 + dividend.value.y * 255.0;\n\n  remainder = mod(partial, divisor);\n  quotient.value.y = (partial - remainder) / divisor / 255.0;\n  partial = remainder * 256.0 + dividend.value.x * 255.0;\n\n  remainder = mod(partial, divisor);\n  quotient.value.x = (partial - remainder) / divisor / 255.0;\n\n  return remainder;\n}\n"]},
function(n,h,c){function m(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function e(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function a(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,
configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function b(a,b){l.set(a,b)}var d=c(13);n=c(0);h.d=b;c.d(h,"a",function(){return p});c.d(h,"b",function(){return r});c.d(h,"e",function(){return k});h.c=function(a){return function(b){b.prototype.RPC_TYPE_ID=a}};h.f=function(a){return function(b){v.set(a,b);b.prototype.RPC_TYPE_ID=a}};var f=function B(a,b,d){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,b);if(void 0===c){if(a=Object.getPrototypeOf(a),
null!==a)return B(a,b,d)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(d)}},g=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),l=new Map,u=function(b){function d(a,b){m(this,d);var c=e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b));c.name=a;c.message=b;return c}a(d,
b);return d}(Error);b("rpc.promise.cancel",function(a){this.get(a.id).cancellationToken.cancel()});b("rpc.promise.response",function(a){var b=a.id,c=this.get(b),e=c.resolve,c=c.reject;this.delete(b);a.hasOwnProperty("value")?e(a.value):a.errorName===d.b.name?c(d.b):c(new u(a.errorName,a.error))});var p=function(){function a(b){var d=this;m(this,a);this.target=b;this.objects=new Map;this.nextId=0;b.onmessage=function(a){a=a.data;l.get(a.functionName).call(d,a)}}g(a,[{key:"set",value:function(a,b){this.objects.set(a,
b)}},{key:"delete",value:function(a){this.objects.delete(a)}},{key:"get",value:function(a){return this.objects.get(a)}},{key:"getRef",value:function(a){var b=this.get(a.id);b.referencedGeneration=a.gen;b.addRef();return b}},{key:"invoke",value:function(a,b,d){b.functionName=a;this.target.postMessage(b,d)}},{key:"promiseInvoke",value:function(a,b,e,f){e=void 0===e?d.c:e;var g=this;return c.i(d.d)(e,function(d,c,e){var k=b.id=g.newId();g.set(k,{resolve:d,reject:c});g.invoke(a,b,f);e.add(function(){g.invoke("rpc.promise.cancel",
{id:k})})})}},{key:"newId",value:function(){return this.nextId++}},{key:"numObjects",get:function(){return this.objects.size}}]);return a}(),r=function(b){function d(){m(this,d);var a=e(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments));a.rpc=null;a.rpcId=null;return a}a(d,b);g(d,[{key:"initializeSharedObject",value:function(a,b){b=void 0===b?a.newId():b;this.rpc=a;this.rpcId=b;this.isOwner=!1;a.set(b,this)}},{key:"initializeCounterpart",value:function(a,b){b=void 0===b?{}:b;this.initializeSharedObject(a);
this.referencedGeneration=this.unreferencedGeneration=0;this.isOwner=!0;b.id=this.rpcId;b.type=this.RPC_TYPE_ID;a.invoke("SharedObject.new",b)}},{key:"dispose",value:function(){f(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"dispose",this).call(this)}},{key:"addCounterpartRef",value:function(){return{id:this.rpcId,gen:++this.referencedGeneration}}},{key:"refCountReachedZero",value:function(){!0===this.isOwner?this.referencedGeneration===this.unreferencedGeneration&&this.ownerDispose():
!1===this.isOwner?this.rpc.invoke("SharedObject.refCountReachedZero",{id:this.rpcId,gen:this.referencedGeneration}):f(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"refCountReachedZero",this).call(this)}},{key:"ownerDispose",value:function(){var a=this.rpc,b=this.rpcId;f(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"refCountReachedZero",this).call(this);a.delete(b);a.invoke("SharedObject.dispose",{id:b})}},{key:"counterpartRefCountReachedZero",value:function(a){this.unreferencedGeneration=
a;0===this.refCount&&a===this.referencedGeneration&&this.ownerDispose()}}]);return d}(n.a),k=function(b){function d(a,b){b=void 0===b?{}:b;m(this,d);var c=e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));b=void 0===b?{}:b;null!=a&&c.initializeSharedObject(a,b.id);return c}a(d,b);return d}(r);b("SharedObject.dispose",function(a){a=this.get(a.id);if(0!==a.refCount)throw Error("Attempted to dispose object with non-zero reference count.");a.disposed();this.delete(a.rpcId);a.rpcId=null;a.rpc=
null});b("SharedObject.refCountReachedZero",function(a){this.get(a.id).counterpartRefCountReachedZero(a.gen)});var v=new Map;b("SharedObject.new",function(a){--(new (v.get(a.type))(this,a)).refCount})},function(n,h,c){function m(a,b){void 0===b&&(b=-1===a.indexOf("/")?":":"/");a=a.lastIndexOf(b);return-1===a?0:a+1}function e(a){a=a.match(f);if(null===a||void 0===a[1])throw Error('Data source URL must have the form "<protocol>://<path>".');var b=a[1],c=d.get(b);if(void 0===c)throw Error("Unsupported data source: "+
JSON.stringify(b)+".");return[c,a[2],b]}var a=c(13),b=c(28);h.g=function(a,b){d.set(a,b)};h.a=function(b,d,c,f){c=void 0===c?{}:c;f=void 0===f?a.c:f;d=$jscomp.makeIterator(e(d));var g=d.next().value,k=d.next().value;return new Promise(function(a){a(g.getVolume(b,k,c,f))})};h.e=function(b,d,c){c=void 0===c?a.c:c;d=$jscomp.makeIterator(e(d));var f=d.next().value,g=d.next().value;return new Promise(function(a){a(f.getMeshSource(b,g,c))})};h.f=function(b,d,c){c=void 0===c?a.c:c;d=$jscomp.makeIterator(e(d));
var f=d.next().value,g=d.next().value;return new Promise(function(a){a(f.getSkeletonSource(b,g,c))})};h.b=function(e,l,u){u=void 0===u?a.c:u;var g=e.match(f),r=g[1];if(void 0===r){l=[];u=$jscomp.makeIterator(d);for(g=u.next();!g.done;g=u.next()){var k=$jscomp.makeIterator(g.value),g=k.next().value,k=k.next().value,g=g+"://";g.startsWith(e)&&l.push({value:g,description:k.description})}return Promise.resolve({offset:0,completions:l})}e=d.get(r);return void 0!==e&&(e=e.volumeCompleter,void 0!==e)?e(g[2],
l,u).then(function(a){return c.i(b.a)(r.length+3,a)}):Promise.reject(null)};h.d=function(a){a=$jscomp.makeIterator(e(a));var b=a.next().value;a=a.next().value;b=b.suggestLayerName;if(void 0!==b)return b(a);b=m(a,void 0);return a.substring(b)};h.c=function(a){var b=$jscomp.makeIterator(e(a));a=b.next().value;var d=b.next().value,b=b.next().value;return(a.findSourceGroup||m)(d)+b.length+3};var d=new Map,f=/^(?:([a-zA-Z-+_]+):\/\/)?(.*)$/},function(n,h,c){function m(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
}function e(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function a(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}n=c(20);var b=c.n(n);
n=c(191);var d=c.n(n);n=c(0);var f=c(1),g=c(3),l=c(142),u=c(11),p=c(43);c.d(h,"f",function(){return v});c.d(h,"g",function(){return t});c.d(h,"i",function(){return B});c.d(h,"h",function(){return x});c.d(h,"d",function(){return y});c.d(h,"b",function(){return C});c.d(h,"a",function(){return A});c.d(h,"c",function(){return D});h.e=function(a,b,d){var c=new Map;return d.registerDisposer(new F(a,b,function(a){c.set(a,a.redrawNeeded.add(function(){return d.scheduleRedraw()}));d.scheduleRedraw()},function(a){c.get(a)();
d.scheduleRedraw()}))};var r=function z(a,b,d){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,b);if(void 0===c){if(a=Object.getPrototypeOf(a),null!==a)return z(a,b,d)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(d)}},k=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,
c);return b}}(),v=function(b){function d(){m(this,d);var a=e(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments));a.ready=!1;a.layerChanged=new g.a;a.redrawNeeded=new g.a;a.readyStateChanged=new g.a;a.voxelSize=null;a.boundingBox=null;return a}a(d,b);k(d,[{key:"setReady",value:function(a){this.ready=a;this.readyStateChanged.dispatch();this.layerChanged.dispatch()}},{key:"handleAction",value:function(a){}},{key:"getValueAt",value:function(a){}},{key:"transformPickedValue",value:function(a,
b){return a}},{key:"updateMouseState",value:function(a,b,d){}}]);return d}(n.a),t=function(b){function d(){m(this,d);var a=e(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments));a.visibilityCount=a.registerDisposer(new p.a);return a}a(d,b);return d}(v),B=function(b){function d(){m(this,d);return e(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments))}a(d,b);k(d,[{key:"onShow",value:function(){}},{key:"onHide",value:function(){}}]);return d}(n.a),x=function(b){function d(a){a=
void 0===a?[]:a;m(this,d);var b=e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));b.layersChanged=new g.a;b.readyStateChanged=new g.a;b.specificationChanged=new g.a;b.renderLayers=[];a.forEach(b.addRenderLayer.bind(b));return b}a(d,b);k(d,[{key:"addRenderLayer",value:function(a){this.renderLayers.push(a);var b=this.layersChanged,d=this.readyStateChanged;this.registerDisposer(a);this.registerDisposer(a.layerChanged.add(b.dispatch));this.registerDisposer(a.readyStateChanged.add(d.dispatch));
d.dispatch();b.dispatch()}},{key:"getValueAt",value:function(a,b){var d,c=this.renderLayers,e=b.pickedRenderLayer;if(null!==e&&-1!==c.indexOf(e))return d=e.transformPickedValue(b.pickedValue,b.pickedOffset),this.transformPickedValue(d);b=$jscomp.makeIterator(c);for(c=b.next();!c.done&&(c=c.value,!c.ready||(d=c.getValueAt(a),void 0===d));c=b.next());return this.transformPickedValue(d)}},{key:"transformPickedValue",value:function(a){return a}},{key:"toJSON",value:function(){return null}},{key:"makeDropdown",
value:function(a){}},{key:"handleAction",value:function(a){}}]);return d}(n.a),y=function(b){function d(a,b,c){b=void 0===b?null:b;c=void 0===c?!0:c;m(this,d);var f=e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));f.name=a;f.visible=c;f.readyStateChanged=new g.a;f.layerChanged=new g.a;f.specificationChanged=new g.a;f.wasDisposed=!1;f.layer_=null;f.layer=b;return f}a(d,b);k(d,[{key:"handleLayerChanged",value:function(){this.visible&&this.layerChanged.dispatch()}},{key:"setVisible",value:function(a){a!==
this.visible&&(this.visible=a,this.layerChanged.dispatch())}},{key:"disposed",value:function(){this.wasDisposed=!0;this.layer=null;r(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"disposed",this).call(this)}},{key:"layer",get:function(){return this.layer_},set:function(a){var b=this,d=this.layer_;null!=d&&(this.unregisterUserLayer(),d.dispose());this.layer_=a;if(null!=a){var c=[a.layersChanged.add(function(){return b.handleLayerChanged()}),a.readyStateChanged.add(this.readyStateChanged.dispatch),
a.specificationChanged.add(this.specificationChanged.dispatch)];this.unregisterUserLayer=function(){c.forEach(function(a){return a()})};this.readyStateChanged.dispatch();this.handleLayerChanged()}}}]);return d}(n.a),C=function(d){function c(){m(this,c);var a=e(this,(c.__proto__||Object.getPrototypeOf(c)).apply(this,arguments));a.managedLayers=[];a.layersChanged=new g.a;a.readyStateChanged=new g.a;a.specificationChanged=new g.a;a.boundPositions=new WeakSet;return a}a(c,d);k(c,[{key:"updateSignalBindings",
value:function(a,b){b(a.layerChanged,this.layersChanged.dispatch);b(a.readyStateChanged,this.readyStateChanged.dispatch);b(a.specificationChanged,this.specificationChanged.dispatch)}},{key:"addManagedLayer",value:function(a){this.updateSignalBindings(a,l.a);this.managedLayers.push(a);this.layersChanged.dispatch();this.readyStateChanged.dispatch();return a}},{key:"addUserLayer",value:function(a,b,d){a=new y(a,b,d);return this.addManagedLayer(a)}},{key:"readyRenderLayers",value:function(){function a(a,
t){for(;;)switch(b){case 0:k=$jscomp.makeIterator(l.managedLayers),g=k.next();case 1:if(g.done){b=3;break}f=g.value;if(f.visible&&f.layer){b=4;break}b=2;break;case 4:e=$jscomp.makeIterator(f.layer.renderLayers),c=e.next();case 5:if(c.done){b=7;break}d=c.value;if(d.ready){b=8;break}b=6;break;case 8:return b=9,{value:d,done:!1};case 9:if(void 0===t){b=10;break}b=-1;throw t;case 10:case 6:c=e.next();b=5;break;case 7:case 2:g=k.next();b=1;break;case 3:b=-1;default:return{value:void 0,done:!0}}}var b=
0,d,c,e,f,g,k,l=this,t={next:function(b){return a(b,void 0)},throw:function(b){return a(void 0,b)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();t[Symbol.iterator]=function(){return this};return t}},{key:"unbindManagedLayer",value:function(a){this.updateSignalBindings(a,l.b);a.dispose()}},{key:"clear",value:function(){for(var a=$jscomp.makeIterator(this.managedLayers),b=a.next();!b.done;b=a.next())this.unbindManagedLayer(b.value);this.managedLayers.length=0;
this.layersChanged.dispatch()}},{key:"removeManagedLayer",value:function(a){var b=this.managedLayers.indexOf(a);if(-1===b)throw Error("Internal error: invalid managed layer.");this.unbindManagedLayer(a);this.managedLayers.splice(b,1);this.layersChanged.dispatch()}},{key:"reorderManagedLayer",value:function(a,b){var d=this.managedLayers.length;a===b||0>a||a>=d||0>b||b>=d||(a=$jscomp.makeIterator(this.managedLayers.splice(a,1)).next().value,this.managedLayers.splice(b,0,a),this.layersChanged.dispatch())}},
{key:"disposed",value:function(){this.clear();r(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"disposed",this).call(this)}},{key:"getLayerByName",value:function(a){return this.managedLayers.find(function(b){return b.name===a})}},{key:"initializePosition",value:function(a){var d=this,c=this.boundPositions;c.has(a)||(c.add(a),c=b()(function(){d.updatePositionFromLayers(a)}),this.readyStateChanged.add(c),a.changed.add(c),this.updatePositionFromLayers(a))}},{key:"updatePositionFromLayers",
value:function(a){if(!a.valid)for(var b=$jscomp.makeIterator(this.managedLayers),d=b.next();!d.done;d=b.next())if(d=d.value.layer,null!=d)for(var d=$jscomp.makeIterator(d.renderLayers),c=d.next();!c.done;c=d.next())if(c=c.value,c.ready&&(a.voxelSize.valid||null==c.voxelSize||(f.a.copy(a.voxelSize.size,c.voxelSize),a.voxelSize.setValid()),!a.spatialCoordinatesValid&&!a.voxelCoordinatesValid&&null!=c.boundingBox)){var c=c.boundingBox,e=a.spatialCoordinates;f.a.add(e,c.lower,c.upper);f.a.scale(e,e,.5);
a.spatialCoordinatesValid=!0;a.changed.dispatch()}}},{key:"invokeAction",value:function(a){for(var b=$jscomp.makeIterator(this.managedLayers),d=b.next();!d.done;d=b.next())if(d=d.value,null!==d.layer&&d.visible){d=d.layer;d.handleAction(a);for(var d=$jscomp.makeIterator(d.renderLayers),c=d.next();!c.done;c=d.next())c=c.value,c.ready&&c.handleAction(a)}}},{key:"renderLayers",get:function(){var a=this;$jscomp.initSymbol();$jscomp.initSymbolIterator();var b={};return b[Symbol.iterator]=function(){function b(b,
t){for(;;)switch(d){case 0:l=$jscomp.makeIterator(a.managedLayers),k=l.next();case 1:if(k.done){d=3;break}g=k.value;if(null!==g.layer){d=4;break}d=2;break;case 4:f=$jscomp.makeIterator(g.layer.renderLayers),e=f.next();case 5:if(e.done){d=7;break}c=e.value;d=8;return{value:c,done:!1};case 8:if(void 0===t){d=9;break}d=-1;throw t;case 9:case 6:e=f.next();d=5;break;case 7:case 2:k=l.next();d=1;break;case 3:d=-1;default:return{value:void 0,done:!0}}}var d=0,c,e,f,g,k,l,t={next:function(a){return b(a,void 0)},
throw:function(a){return b(void 0,a)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();t[Symbol.iterator]=function(){return this};return t},b}},{key:"visibleRenderLayers",get:function(){var a=this;$jscomp.initSymbol();$jscomp.initSymbolIterator();var b={};return b[Symbol.iterator]=function(){function b(b,t){for(;;)switch(d){case 0:l=$jscomp.makeIterator(a.managedLayers),k=l.next();case 1:if(k.done){d=3;break}g=k.value;if(null!==g.layer&&g.visible){d=4;break}d=
2;break;case 4:f=$jscomp.makeIterator(g.layer.renderLayers),e=f.next();case 5:if(e.done){d=7;break}c=e.value;d=8;return{value:c,done:!1};case 8:if(void 0===t){d=9;break}d=-1;throw t;case 9:case 6:e=f.next();d=5;break;case 7:case 2:k=l.next();d=1;break;case 3:d=-1;default:return{value:void 0,done:!0}}}var d=0,c,e,f,g,k,l,t={next:function(a){return b(a,void 0)},throw:function(a){return b(void 0,a)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();t[Symbol.iterator]=
function(){return this};return t},b}}]);return c}(n.a),A=function(){function a(){var b=this;m(this,a);this.changed=new g.a;this.position=f.a.create();this.active=!1;this.pickedRenderLayer=null;this.pickedValue=new u.a(0,0);this.pickedOffset=0;this.updater=void 0;this.stale=!1;this.triggerUpdate=d()(function(){b.update()},50,{leading:!0,trailing:!0})}k(a,[{key:"updateUnconditionally",value:function(){this.triggerUpdate.cancel();this.update();return this.active}},{key:"updateIfStale",value:function(){this.stale&&
this.update()}},{key:"update",value:function(){var a=this.updater;this.stale=!1;a?this.setActive(a(this)):this.setActive(!1)}},{key:"setActive",value:function(a){this.stale=!1;if(this.active!==a||!0===a)this.active=a,this.changed.dispatch()}}]);return a}(),D=function(b){function d(a,b){m(this,d);var c=e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));c.layerManager=a;c.mouseState=b;c.values=new Map;c.changed=new g.a;c.needsUpdate=!0;c.registerDisposer(b.changed.add(function(){c.handleChange()}));
c.registerDisposer(a.layersChanged.add(function(){c.handleLayerChange()}));return c}a(d,b);k(d,[{key:"handleLayerChange",value:function(){this.mouseState.active&&this.handleChange()}},{key:"handleChange",value:function(){this.needsUpdate=!0;this.changed.dispatch()}},{key:"update",value:function(){if(this.needsUpdate){this.needsUpdate=!1;var a=this.values,b=this.mouseState;a.clear();if(b.active)for(var d=b.position,c=$jscomp.makeIterator(this.layerManager.managedLayers),e=c.next();!e.done;e=c.next()){var e=
e.value,f=e.layer;e.visible&&f&&a.set(f,f.getValueAt(d,b))}}}},{key:"get",value:function(a){this.update();return this.values.get(a)}}]);return d}(n.a),F=function(b){function c(a,b,f,g){m(this,c);var k=e(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));k.layerManager=a;k.renderLayerType=b;k.layerAdded=f;k.layerRemoved=g;k.visibleLayers=new Set;k.newVisibleLayers=new Set;k.throttledUpdateVisibleLayers=d()(function(){k.updateVisibleLayers()},0);k.registerDisposer(a.layersChanged.add(function(){k.handleLayersChanged()}));
k.updateVisibleLayers();return k}a(c,b);k(c,[{key:"handleLayersChanged",value:function(){this.throttledUpdateVisibleLayers()}},{key:"disposed",value:function(){var a=this;this.throttledUpdateVisibleLayers.cancel();this.visibleLayers.forEach(function(b){a.onLayerRemoved(b)});this.visibleLayers.clear();r(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"disposed",this).call(this)}},{key:"onLayerRemoved",value:function(a){var b=this.layerRemoved;b(a);a.visibilityCount.dec();a.dispose()}},{key:"updateVisibleLayers",
value:function(){for(var a=this.visibleLayers,b=this.newVisibleLayers,d=this.renderLayerType,c=this.layerAdded,e=$jscomp.makeIterator(this.layerManager.readyRenderLayers()),f=e.next();!f.done;f=e.next())f=f.value,f instanceof d&&(b.add(f),a.has(f)||(a.add(f.addRef()),f.visibilityCount.inc(),c(f)));d=$jscomp.makeIterator(a);for(f=d.next();!f.done;f=d.next())c=f.value,b.has(c)||(a.delete(c),this.onLayerRemoved(c));b.clear()}},{key:"getVisibleLayers",value:function(){this.throttledUpdateVisibleLayers.flush();
return this.visibleLayers}}]);return c}(n.a)},function(n,h,c){h.a=function(c){for(;;){var e=c.firstElementChild;if(!e)break;c.removeChild(e)}};h.b=function(c){var e=c.parentElement;return e?(e.removeChild(c),!0):!1}},function(n,h,c){c.d(h,"a",function(){return g});var m=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);
return b}}(),e=new Uint32Array(2),a=[];for(n=2;36>=n;++n){h=Math.floor(32/Math.log2(n));c=Math.pow(n,h);var b=Math.floor(h/2),d=Math.pow(n,b),b=Math.pow(n,h-b),f="^[0-"+String.fromCharCode(48+Math.min(9,n-1));10<n&&(f+="a-"+String.fromCharCode(97+n-11),f+="A-"+String.fromCharCode(65+n-11));f+="]{1,"+Math.ceil(64/Math.log2(n))+"}$";a[n]={lowDigits:h,lowBase:c,lowBase1:d,lowBase2:b,pattern:new RegExp(f)}}var g=function(){function b(a,d){a=void 0===a?0:a;d=void 0===d?0:d;if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");
this.low=a;this.high=d}m(b,[{key:"clone",value:function(){return new b(this.low,this.high)}},{key:"assign",value:function(a){this.low=a.low;this.high=a.high}},{key:"toString",value:function(b){b=void 0===b?10:b;var d=this.low,c=this.high;if(0===c)return d.toString(b);var c=4294967296*c,e=a[b],f=e.lowBase,e=e.lowDigits,g=c%f,c=Math.floor(c/f),d=d+g,c=c+Math.floor(d/f),d=(d%f).toString(b);return c.toString(b)+"0".repeat(e-d.length)+d}},{key:"tryParseString",value:function(b,d){d=void 0===d?10:d;var c=
a[d],e=c.lowDigits,f=c.lowBase,g=c.lowBase1,l=c.lowBase2;if(!c.pattern.test(b))return!1;if(b.length<=e)return this.low=parseInt(b,d),this.high=0,!0;e=b.length-e;c=parseInt(b.substr(e),d);b=parseInt(b.substr(0,e),d);f=Math.floor(b*f/4294967296);g=c+b%4294967296*g%4294967296*l%4294967296;4294967296<g&&(++f,g-=4294967296);if(g>>>0!==g||f>>>0!==f)return!1;this.low=g;this.high=f;return!0}},{key:"parseString",value:function(a,b){if(!this.tryParseString(a,void 0===b?10:b))throw Error("Failed to parse string as uint64 value: "+
JSON.stringify(a)+".");return this}},{key:"valid",value:function(){var a=this.low,b=this.high;return a>>>0===a&&b>>>0===b}},{key:"toJSON",value:function(){return this.toString()}}],[{key:"less",value:function(a,b){return a.high<b.high||a.high===b.high&&a.low<b.low}},{key:"compare",value:function(a,b){return a.high-b.high||a.low-b.low}},{key:"equal",value:function(a,b){return a.low===b.low&&a.high===b.high}},{key:"min",value:function(a,d){return b.less(a,d)?a:d}},{key:"random",value:function(){crypto.getRandomValues(e);
return new b(e[0],e[1])}},{key:"parseString",value:function(a,d){d=void 0===d?10:d;return(new b).parseString(a,d)}}]);return b}();g.ZERO=new g(0,0)},function(n,h,c){function m(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function e(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function a(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function b(a,b,e){e=void 0===e?{}:e;return g.a.forPromise(new Promise(function(f){f(c.i(d.a)(a,b,e))}),{initialMessage:"Retrieving metadata for volume "+b+".",delay:!0,errorPrefix:"Error retrieving metadata for volume "+b+": "})}var d=c(8);n=c(9);var f=c(4),g=c(33),l=c(0),u=c(2),p=c(3);h.d=b;c.d(h,"b",function(){return k});
c.d(h,"a",function(){return v});h.c=function(a,b){t.set(a,b)};h.e=function(a,b){B.set(a,b)};var r=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),k=function(b){function d(a,b,c){m(this,d);a=e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,a));a.initialSpecification=b;a.manager=c;return a}a(d,b);r(d,
[{key:"toJSON",value:function(){var a=this.layer;if(!a)return this.initialSpecification;a=a.toJSON();this.visible||(a.visible=!1);return a}}]);return d}(n.d),v=function(d){function g(a,b,d,c,f){m(this,g);var k=e(this,(g.__proto__||Object.getPrototypeOf(g)).call(this));k.layerManager=a;k.chunkManager=b;k.worker=d;k.layerSelectedValues=c;k.voxelSize=f;k.changed=new p.a;k.voxelCoordinatesSet=new p.b;k.registerDisposer(a.layersChanged.add(k.changed.dispatch));k.registerDisposer(a.specificationChanged.add(k.changed.dispatch));
return k}a(g,d);r(g,[{key:"reset",value:function(){this.layerManager.clear()}},{key:"restoreState",value:function(a){c.i(u.a)(a);this.layerManager.clear();for(var b=$jscomp.makeIterator(Object.keys(a)),d=b.next();!d.done;d=b.next())d=d.value,this.layerManager.addManagedLayer(this.getLayer(d,a[d]))}},{key:"getLayer",value:function(a,d){var e=this,g=new k(a,d,this);"string"===typeof d&&(d={source:d});c.i(u.a)(d);a=c.i(u.d)(d,"type",u.e);g.visible=c.i(u.d)(d,"visible",function(a){if(void 0===a||!0===
a)return!0;if(!1===a)return!1;throw Error("Expected boolean, but received: "+JSON.stringify(a)+".");});var l=g.sourceUrl=c.i(u.d)(d,"source",u.e);if(void 0===a){if(void 0===l)throw Error("Either layer 'type' or 'source' URL must be specified.");b(this.chunkManager,l).then(function(a){if(-1!==e.layerManager.managedLayers.indexOf(g)){var b=B.get(a.volumeType);if(void 0!==b)g.layer=new b(e,d);else throw Error("Unsupported volume type: "+f.a[a.volumeType]+".");}})}else if(l=t.get(a),void 0!==l)g.layer=
new l(this,d);else throw Error("Unsupported layer type: "+JSON.stringify(a)+".");return g}},{key:"toJSON",value:function(){for(var a={},b=0,d=$jscomp.makeIterator(this.layerManager.managedLayers),c=d.next();!c.done;c=d.next())c=c.value,a[c.name]=c.toJSON(),++b;if(0!==b)return a}},{key:"setVoxelCoordinates",value:function(a){this.voxelCoordinatesSet.dispatch(a)}}]);return g}(l.a),t=new Map,B=new Map},function(n,h,c){function m(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
}c.d(h,"a",function(){return d});h.d=function(a,c){return new Promise(function(e,f){if(a===b)c(e,f,b);else{var g=new d,l=a.add(function(){g.cancel()});c(function(a){l();e(a)},function(a){l();f(a)},g)}})};var e=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}();n=new (function(){function a(){m(this,a);this.name=
"CancellationError";this.message="CANCELED"}e(a,[{key:"toString",value:function(){return"CANCELED"}}]);return a}());h.b=n;var a=function(){},b={isCanceled:!1,add:function(){return a},remove:a};h.c=b;var d=function(){function b(){m(this,b)}e(b,[{key:"cancel",value:function(){var a=this.handlers;if(null!==a&&(this.handlers=null,void 0!==a))for(var a=$jscomp.makeIterator(a),b=a.next();!b.done;b=a.next())b=b.value,b()}},{key:"add",value:function(b){var d=this,c=this.handlers;if(null===c)return b(),a;
void 0===c&&(c=this.handlers=new Set);c.add(b);return function(){d.remove(b)}}},{key:"remove",value:function(a){var b=this.handlers;null!=b&&b.delete(a)}},{key:"isCanceled",get:function(){return null===this.handlers}}]);return b}()},function(n,h){var c={EPSILON:1E-6};c.ARRAY_TYPE="undefined"!==typeof Float32Array?Float32Array:Array;c.RANDOM=Math.random;c.ENABLE_SIMD=!1;c.SIMD_AVAILABLE=c.ARRAY_TYPE===Float32Array&&"SIMD"in this;c.USE_SIMD=c.ENABLE_SIMD&&c.SIMD_AVAILABLE;c.setMatrixArrayType=function(e){c.ARRAY_TYPE=
e};var m=Math.PI/180;c.toRadian=function(c){return c*m};c.equals=function(e,a){return Math.abs(e-a)<=c.EPSILON*Math.max(1,Math.abs(e),Math.abs(a))};n.exports=c},function(n,h,c){function m(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function e(a,
b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}var a=c(3);c.d(h,"a",function(){return d});c.d(h,"b",function(){return f});var b=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),d=function(){function d(b){e(this,d);this.value_=b;this.changed=new a.a}b(d,[{key:"value",get:function(){return this.value_},
set:function(a){a!==this.value_&&(this.value_=a,this.changed.dispatch())}}]);return d}(),f=function(a){function d(a,b,c){c=void 0===c?a:c;e(this,d);a=(d.__proto__||Object.getPrototypeOf(d)).call(this,a);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");a=!a||"object"!==typeof a&&"function"!==typeof a?this:a;a.validator=b;a.defaultValue=c;return a}m(d,a);b(d,[{key:"toJSON",value:function(){if(this.value_!==this.defaultValue)return this.value_}},{key:"reset",
value:function(){this.value=this.defaultValue}},{key:"restoreState",value:function(a){if(void 0!==a){var b=this.validator;try{this.value=b(a);return}catch(r){}}this.value=this.defaultValue}}]);return d}(d)},function(n,h,c){c.d(h,"b",function(){return e});c.d(h,"a",function(){return b});var m=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,
d);c&&a(b,c);return b}}(),e;(function(a){a[a.GPU_MEMORY=0]="GPU_MEMORY";a[a.SYSTEM_MEMORY=1]="SYSTEM_MEMORY";a[a.SYSTEM_MEMORY_WORKER=2]="SYSTEM_MEMORY_WORKER";a[a.DOWNLOADING=3]="DOWNLOADING";a[a.QUEUED=4]="QUEUED";a[a.NEW=5]="NEW";a[a.FAILED=6]="FAILED";a[a.EXPIRED=7]="EXPIRED"})(e||(e={}));var a;(function(a){a[a.FIRST_TIER=0]="FIRST_TIER";a[a.FIRST_ORDERED_TIER=0]="FIRST_ORDERED_TIER";a[a.VISIBLE=0]="VISIBLE";a[a.PREFETCH=1]="PREFETCH";a[a.LAST_ORDERED_TIER=1]="LAST_ORDERED_TIER";a[a.RECENT=2]=
"RECENT";a[a.LAST_TIER=2]="LAST_TIER"})(a||(a={}));var b=function(){function a(b,d){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");this.itemCapacity=this.availableItems=b;this.sizeCapacity=this.availableSize=d}m(a,[{key:"adjust",value:function(a,b){this.availableItems+=a;this.availableSize+=b}},{key:"toString",value:function(){return this.availableItems+"/"+this.itemCapacity+" items, "+this.availableSize+"/"+this.sizeCapacity+" size"}},{key:"toObject",value:function(){return{itemCapacity:this.itemCapacity,
sizeCapacity:this.sizeCapacity}}}],[{key:"fromObject",value:function(b){return new a(b.itemCapacity,b.sizeCapacity)}}]);return a}();b.INFINITE=new b(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY);h.c="ChunkQueueManager";h.d="ChunkManager"},function(n,h,c){var m=c(24);c.d(h,"a",function(){return a});var e=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,
c,e){c&&a(b.prototype,c);e&&a(b,e);return b}}(),a=function(){function a(b,c){c=void 0===c?m.c:c;if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");this.gl=b;this.bufferType=c;this.gl=b;this.buffer=b.createBuffer()}e(a,[{key:"bind",value:function(){this.gl.bindBuffer(this.bufferType,this.buffer)}},{key:"bindToVertexAttrib",value:function(a,b,c,e,u,p){c=void 0===c?m.e:c;e=void 0===e?!1:e;u=void 0===u?0:u;p=void 0===p?0:p;this.bind();this.gl.enableVertexAttribArray(a);this.gl.vertexAttribPointer(a,
b,c,e,u,p)}},{key:"setData",value:function(a,b){b=void 0===b?m.d:b;var d=this.gl;this.bind();d.bufferData(this.bufferType,a,b)}},{key:"dispose",value:function(){this.gl.deleteBuffer(this.buffer);this.gl=this.buffer=void 0}}],[{key:"fromData",value:function(b,c,e,l){b=new a(b,e);b.setData(c,l);return b}}]);return a}()},function(n,h,c){function m(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function e(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function a(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function b(a,b,d){var c=a.createShader(d);a.shaderSource(c,b);a.compileShader(c);if(!a.getShaderParameter(c,a.COMPILE_STATUS)){a=
a.getShaderInfoLog(c)||"";var e;e=a.replace("\x00","");c=[];e=$jscomp.makeIterator(e.split("\n"));for(var f=e.next();!f.done;f=e.next()){var f=f.value,g=f.match(/^ERROR:\s*(\d+):(\d+)\s*(.+)$/);null!==g?c.push({message:g[3].trim(),file:parseInt(g[1],10),line:parseInt(g[2],10)}):(g=f.match(/^ERROR:\s*(.+)$/),null!==g?c.push({message:g[1]}):(f=f.trim())&&c.push({message:f}))}throw new l(d,b,a,c);}return c}n=c(0);var d=c(24);c.d(h,"a",function(){return k});var f=function(){function a(a,b){for(var d=
0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),g;(function(a){a[a.VERTEX=d.a]="VERTEX";a[a.FRAGMENT=d.b]="FRAGMENT"})(g||(g={}));var l=function(b){function d(a,b,c,f){m(this,d);var k="Error compiling "+g[a].toLowerCase()+" shader: "+c,l=e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,k));l.name="ShaderCompilationError";l.log=c;l.message=
k;l.shaderType=a;l.source=b;l.errorMessages=f;return l}a(d,b);return d}(Error),u=function(b){function d(a,b,c){m(this,d);var f="Error linking shader: "+c,g=e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,f));g.name="ShaderLinkError";g.log=c;g.message=f;g.vertexSource=a;g.fragmentSource=b;return g}a(d,b);return d}(Error),p=function(d){function c(a,d,f,g,k){m(this,c);var l=e(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));l.gl=a;l.vertexSource=d;l.fragmentSource=f;l.attributes=new Map;
l.uniforms=new Map;var t=l.vertexShader=b(a,d,a.VERTEX_SHADER),p=l.fragmentShader=b(a,f,a.FRAGMENT_SHADER),r=a.createProgram();a.attachShader(r,t);a.attachShader(r,p);a.linkProgram(r);if(!a.getProgramParameter(r,a.LINK_STATUS))throw a=a.getProgramInfoLog(r)||"",new u(d,f,a);l.program=r;f=l.uniforms;d=l.attributes;if(g)for(g=$jscomp.makeIterator(g),t=g.next();!t.done;t=g.next())t=t.value,f.set(t,a.getUniformLocation(r,t));if(k)for(k=$jscomp.makeIterator(k),t=k.next();!t.done;t=k.next())g=t.value,d.set(g,
a.getAttribLocation(r,g));return l}a(c,d);f(c,[{key:"uniform",value:function(a){return this.uniforms.get(a)}},{key:"attribute",value:function(a){return this.attributes.get(a)}},{key:"textureUnit",value:function(a){return this.textureUnits.get(a)}},{key:"bind",value:function(){this.gl.useProgram(this.program)}},{key:"disposed",value:function(){var a=this.gl;a.deleteShader(this.vertexShader);this.vertexShader=void 0;a.deleteShader(this.fragmentShader);this.fragmentShader=void 0;a.deleteProgram(this.program);
this.uniforms=this.attributes=this.gl=this.program=void 0}}]);return c}(n.a),r=function(){function a(){m(this,a);this.code="";this.parts=new Set}f(a,[{key:"add",value:function(a){if(!this.parts.has(a))switch(this.parts.add(a),typeof a){case "string":this.code+=a;break;case "function":this.add(a());break;default:if(Array.isArray(a)){a=$jscomp.makeIterator(a);for(var b=a.next();!b.done;b=a.next())this.add(b.value)}else throw Error("Invalid code type");}}},{key:"toString",value:function(){return this.code}}]);
return a}(),k=function(){function a(b){m(this,a);this.gl=b;this.nextTextureUnit=this.nextSymbolID=0;this.varyingsCode=this.attributesCode=this.uniformsCode="";this.fragmentExtensionsSet=new Set;this.fragmentExtensions="";this.vertexCode=new r;this.vertexMain="";this.fragmentCode=new r;this.fragmentMain="";this.required=new Set;this.uniforms=[];this.attributes=[];this.initializers=[];this.textureUnits=new Map}f(a,[{key:"allocateTextureUnit",value:function(a,b){b=void 0===b?1:b;if(this.textureUnits.has(a))throw Error("Duplicate texture unit symbol: "+
a);var d=this.nextTextureUnit;this.nextTextureUnit+=b;this.textureUnits.set(a,d);return d}},{key:"addTextureSampler2D",value:function(a,b,d){var c=this.allocateTextureUnit(b,d);this.addUniform("highp sampler2D",a,d);this.addInitializer(function(b){if(d){for(var e=new Int32Array(d),f=0;f<d;++f)e[f]=f+c;b.gl.uniform1iv(b.uniform(a),e)}else b.gl.uniform1i(b.uniform(a),c)});return c}},{key:"symbol",value:function(a){return a+this.nextSymbolID++}},{key:"addAttribute",value:function(a,b){this.attributes.push(b);
this.attributesCode+="attribute "+a+" "+b+";\n";return b}},{key:"addVarying",value:function(a,b){this.varyingsCode+="varying "+a+" "+b+";\n"}},{key:"addUniform",value:function(a,b,d){this.uniforms.push(b);this.uniformsCode=null!=d?this.uniformsCode+("uniform "+a+" "+b+"["+d+"];\n"):this.uniformsCode+("uniform "+a+" "+b+";\n");return b}},{key:"addFragmentExtension",value:function(a){this.fragmentExtensionsSet.has(a)||(this.fragmentExtensionsSet.add(a),this.fragmentExtensions+="#extension "+a+" : require\n")}},
{key:"addVertexCode",value:function(a){this.vertexCode.add(a)}},{key:"addFragmentCode",value:function(a){this.fragmentCode.add(a)}},{key:"setVertexMain",value:function(a){this.vertexMain=a}},{key:"addVertexMain",value:function(a){this.vertexMain=(this.vertexMain||"")+a}},{key:"setFragmentMain",value:function(a){this.fragmentMain="void main() {\n"+a+"\n}\n"}},{key:"setFragmentMainFunction",value:function(a){this.fragmentMain=a}},{key:"addInitializer",value:function(a){this.initializers.push(a)}},{key:"require",
value:function(a){this.required.has(a)||(this.required.add(a),a(this))}},{key:"build",value:function(){var a=new p(this.gl,"\nprecision highp float;\n"+this.uniformsCode+"\n"+this.attributesCode+"\n"+this.varyingsCode+"\n"+this.vertexCode+"\nvoid main() {\n"+this.vertexMain+"\n}\n","\n"+this.fragmentExtensions+"\nprecision highp float;\n"+this.uniformsCode+"\n"+this.varyingsCode+"\n"+this.fragmentCode+"\n"+this.fragmentMain+"\n",this.uniforms,this.attributes);a.textureUnits=this.textureUnits;var b=
this.initializers;if(0<b.length){a.bind();for(var b=$jscomp.makeIterator(b),d=b.next();!d.done;d=b.next())d=d.value,d(a)}return a}}]);return a}()},function(n,h){},function(n,h,c){var m=c(49),e=c(190),a=c(192),b=Math.max,d=Math.min;n.exports=function(c,g,l){function f(a){var b=t,d=h;t=h=void 0;D=a;return y=c.apply(d,b)}function p(a){var b=a-A;a-=D;return void 0===A||b>=g||0>b||G&&a>=x}function r(){var a=e();if(p(a))return k(a);var b=setTimeout,c;c=a-D;a=g-(a-A);c=G?d(a,x-c):a;C=b(r,c)}function k(a){C=
void 0;if(z&&t)return f(a);t=h=void 0;return y}function v(){var a=e(),b=p(a);t=arguments;h=this;A=a;if(b){if(void 0===C)return D=a=A,C=setTimeout(r,g),F?f(a):y;if(G)return C=setTimeout(r,g),f(A)}void 0===C&&(C=setTimeout(r,g));return y}var t,h,x,y,C,A,D=0,F=!1,G=!1,z=!0;if("function"!=typeof c)throw new TypeError("Expected a function");g=a(g)||0;m(l)&&(F=!!l.leading,x=(G="maxWait"in l)?b(a(l.maxWait)||0,g):x,z="trailing"in l?!!l.trailing:z);v.cancel=function(){void 0!==C&&clearTimeout(C);D=0;t=A=
h=C=void 0};v.flush=function(){return void 0===C?y:k(e())};return v}},function(n,h,c){function m(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}n=c(0);var e=c(41);c.d(h,"a",function(){return d});c.d(h,"b",function(){return g});var a=function(){function a(a,
b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),b=function u(a,b,d){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,b);if(void 0===c){if(a=Object.getPrototypeOf(a),null!==a)return u(a,b,d)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(d)}};c(163);var d=0,f=new e.a;f.bind("escape",
"close");var g=function(c){function g(a){a=void 0===a?f:a;if(!(this instanceof g))throw new TypeError("Cannot call a class as a function");var b;b=(g.__proto__||Object.getPrototypeOf(g)).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");b=!b||"object"!==typeof b&&"function"!==typeof b?this:b;b.keySequenceMap=a;++d;var c=b.container=document.createElement("div");c.className="overlay";var t=b.content=document.createElement("div");t.className="overlay-content";
c.appendChild(t);document.body.appendChild(c);b.keyboardShortcutHandler=b.registerDisposer(new e.b(a,b.commandReceived.bind(b)));return b}m(g,c);a(g,[{key:"commandReceived",value:function(a){"close"===a&&this.dispose();return!1}},{key:"disposed",value:function(){--d;document.body.removeChild(this.container);b(g.prototype.__proto__||Object.getPrototypeOf(g.prototype),"disposed",this).call(this)}}]);return g}(n.a)},function(n,h,c){function m(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var e=c(138),a=c(13);c.d(h,"d",function(){return g});h.b=function(a,b,g){g=void 0===g?"GET":g;var l=new XMLHttpRequest;if(Array.isArray(a)){var k=a.length,k=1===k?0:Math.abs(c.i(e.a)(b))%k;a=a[k]+b}else a+=b;l[f]=g;l[d]=a;l.open(g,a);return l};h.a=function(b,d,c){c=void 0===c?a.c:c;b.responseType=d;return new Promise(function(a,
d){var e=function(){b.abort()};c.add(e);b.onloadend=function(){var f=this.status;c.remove(e);200<=f&&300>f?a(this.response):d(g.fromXhr(b))};b.send()})};h.c=function(a){var b=a.match(/^([^:\/]+):\/\/([^\/]+)(\/.*)?$/);if(null===b)throw Error("Invalid URL: "+JSON.stringify(a));return"gs"===b[1]?[["https://storage.googleapis.com/"+b[2]],b[3]]:[[a],""]};var b=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);
Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}();$jscomp.initSymbol();var d=Symbol("url");$jscomp.initSymbol();var f=Symbol("method"),g=function(a){function c(a,b,d,e){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");var f=a+" "+JSON.stringify(b)+" resulted in HTTP error "+d;e&&(f+=": "+e);var f=f+".",g;g=(c.__proto__||Object.getPrototypeOf(c)).call(this,f);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
g=!g||"object"!==typeof g&&"function"!==typeof g?this:g;g.name="HttpError";g.message=f;g.method=a;g.url=b;g.code=d;g.statusMessage=e;return g}m(c,a);b(c,null,[{key:"fromXhr",value:function(a){return new c(a[f],a[d],a.status,a.statusText)}}]);return c}(Error)},function(n,h,c){h.a=function(a){if(a instanceof Object){var b=a[m];void 0===b&&(b=a[m]=e++);return"o"+b}return""+JSON.stringify(a)};$jscomp.initSymbol();var m=Symbol("objectId"),e=0},function(n,h,c){h.c=34962;h.d=35044;h.k=3317;h.j=5121;h.e=
5126;h.h=6407;h.i=6408;h.f=6409;h.g=6410;h.b=35632;h.a=35633},function(n,h,c){function m(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function e(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?
Object.setPrototypeOf(a,b):a.__proto__=b)}function a(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}var b=c(16),d=c(70),f=c(3);n=c(7);c.d(h,"d",function(){return u});c.d(h,"a",function(){return p});c.d(h,"b",function(){return r});c.d(h,"c",function(){return k});var g=function t(a,b,d){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,b);if(void 0===c){if(a=Object.getPrototypeOf(a),null!==a)return t(a,b,d)}else{if("value"in c)return c.value;
b=c.get;return void 0===b?void 0:b.call(d)}},l=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}();h=this&&this.__decorate||function(a,b,d,c){var e=arguments.length,f=3>e?b:null===c?c=Object.getOwnPropertyDescriptor(b,d):c,g;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)f=Reflect.decorate(a,
b,d,c);else for(var k=a.length-1;0<=k;k--)if(g=a[k])f=(3>e?g(f):3<e?g(b,d,f):g(b,d))||f;return 3<e&&f&&Object.defineProperty(b,d,f),f};var u=function(){function d(c){a(this,d);this.source=c;this.state=b.b.SYSTEM_MEMORY}l(d,[{key:"copyToGPU",value:function(a){this.state=b.b.GPU_MEMORY}},{key:"freeGPUMemory",value:function(a){this.state=b.b.SYSTEM_MEMORY}},{key:"gl",get:function(){return this.source.gl}}]);return d}(),p=function(d){function c(b,d,e){a(this,c);var g=m(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));
g.gl=d;g.visibleChunksChanged=new f.a;g.pendingChunkUpdates=null;g.pendingChunkUpdatesTail=null;g.chunkUpdateDeadline=null;g.chunkUpdateDelay=30;g.initializeCounterpart(b,{gpuMemoryCapacity:e.gpuMemory.toObject(),systemMemoryCapacity:e.systemMemory.toObject(),downloadCapacity:e.download.toObject()});return g}e(c,d);l(c,[{key:"scheduleChunkUpdate",value:function(){var a=this.chunkUpdateDeadline,a=null===a||Date.now()<a?0:this.chunkUpdateDelay;setTimeout(this.processPendingChunkUpdates.bind(this),a)}},
{key:"processPendingChunkUpdates",value:function(){var a=this.chunkUpdateDeadline;if(null!==a&&Date.now()>a)setTimeout(this.processPendingChunkUpdates.bind(this),this.chunkUpdateDelay);else{var a=this.pendingChunkUpdates,d=this.rpc.get(a.source),c=a.state;if(c===b.b.EXPIRED)d.deleteChunk(a.id);else{var e,f=a.id;a["new"]?(e=d.getChunk(a),d.addChunk(f,e)):e=d.chunks.get(f);if(c!==e.state)switch(c){case b.b.GPU_MEMORY:e.copyToGPU(this.gl);this.visibleChunksChanged.dispatch();break;case b.b.SYSTEM_MEMORY:e.freeGPUMemory(this.gl);
break;default:throw Error("INTERNAL ERROR: Invalid chunk state: "+b.b[c]);}}null!=(this.pendingChunkUpdates=a.nextUpdate)?this.scheduleChunkUpdate():this.pendingChunkUpdatesTail=null}}}]);return c}(n.b),p=h([c.i(n.c)(b.c)],p);c.i(n.d)("Chunk.update",function(a){var b=this.get(a.source).chunkManager.chunkQueueManager,d=b.pendingChunkUpdatesTail;null==d?(b.pendingChunkUpdates=a,b.pendingChunkUpdatesTail=a,b.scheduleChunkUpdate()):(d.nextUpdate=a,b.pendingChunkUpdatesTail=a)});var r=function(b){function c(b){a(this,
c);var e=m(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));e.chunkQueueManager=b;e.chunkSourceCache=new Map;e.memoize=new d.a;e.registerDisposer(b.addRef());e.initializeCounterpart(b.rpc,{chunkQueueManager:b.rpcId});return e}e(c,b);l(c,[{key:"getChunkSource",value:function(a,b,c){var e=this.chunkSourceCache,f=e.get(a);void 0===f&&(f=new d.b,e.set(a,f));return f.get(b,function(){var a=c();a.initializeCounterpart(a.chunkManager.rpc,{});return a})}},{key:"gl",get:function(){return this.chunkQueueManager.gl}}]);
return c}(n.b),r=h([c.i(n.c)(b.d)],r),k=function(b){function d(b){a(this,d);var c=m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));c.chunkManager=b;c.chunks=new Map;c.registerDisposer(b.addRef());return c}e(d,b);l(d,[{key:"initializeCounterpart",value:function(a,b){b.chunkManager=this.chunkManager.rpcId;g(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"initializeCounterpart",this).call(this,a,b)}},{key:"deleteChunk",value:function(a){this.chunks.delete(a)}},{key:"addChunk",value:function(a,
b){this.chunks.set(a,b)}},{key:"getChunk",value:function(a){throw Error("Not implemented.");}},{key:"gl",get:function(){return this.chunkManager.chunkQueueManager.gl}}]);return d}(n.b)},function(n,h,c){function m(a,d){if("function"!==typeof d&&null!==d)throw new TypeError("Super expression must either be null or a function, not "+typeof d);a.prototype=Object.create(d&&d.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});d&&(Object.setPrototypeOf?Object.setPrototypeOf(a,d):
a.__proto__=d)}n=c(9);c.d(h,"a",function(){return a});var e=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,c,e){c&&a(b.prototype,c);e&&a(b,e);return b}}(),a=function(a){function b(){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");var a=(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!a||"object"!==typeof a&&"function"!==typeof a?this:a}m(b,a);e(b,[{key:"draw",value:function(a){}},{key:"isTransparent",get:function(){return!1}}]);return b}(n.g)},function(n,h,c){function m(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function e(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=
Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function a(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}n=c(0);var b=c(3);c.d(h,"a",function(){return g});c.d(h,"b",function(){return l});c.d(h,"c",function(){return u});var d=function r(a,b,d){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,b);if(void 0===c){if(a=Object.getPrototypeOf(a),
null!==a)return r(a,b,d)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(d)}},f=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),g=function(){function d(c,e){a(this,d);this.value_=c;this.defaultValue=e;this.changed=new b.a}f(d,[{key:"toggle",value:function(){this.value=!this.value}},
{key:"toJSON",value:function(){if(this.value_!==this.defaultValue)return this.value_}},{key:"restoreState",value:function(a){this.value=!0===a||!1===a?a:this.defaultValue}},{key:"reset",value:function(){this.value=this.defaultValue}},{key:"value",get:function(){return this.value_},set:function(a){a!==this.value_&&(this.value_=a,this.changed.dispatch())}}]);return d}(),l=function(b){function c(b){a(this,c);var d=m(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));d.model=b;d.element=document.createElement("input");
var e=d.element;e.type="checkbox";d.registerDisposer(b.changed.add(function(){d.updateCheckbox()}));d.updateCheckbox();d.registerEventListener(e,"change",function(a){b.value=this.checked});return d}e(c,b);f(c,[{key:"updateCheckbox",value:function(){this.element.checked=this.model.value}},{key:"disposed",value:function(){var a=this.element,b=a.parentElement;b&&b.removeChild(a);d(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"disposed",this).call(this)}}]);return c}(n.a),u=function(b){function d(b,
c){a(this,d);var e=m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));e.model=b;e.element=c;e.updateVisibility();e.registerDisposer(b.changed.add(function(){e.updateVisibility()}));return e}e(d,b);f(d,[{key:"updateVisibility",value:function(){this.element.style.display=this.model.value?"":"none"}}]);return d}(n.a)},function(n,h,c){h.a=function(c,e){e.offset+=c;return e};h.c=function(c,e){var a=[];e=$jscomp.makeIterator(e);for(var b=e.next();!b.done;b=e.next())b=b.value,b.startsWith(c)&&a.push({value:b});
return a};h.b=function(c,e,a,b){var d=[];e=$jscomp.makeIterator(e);for(var f=e.next();!f.done;f=e.next()){var f=f.value,g=a(f);g.startsWith(c)&&d.push({value:g,description:b(f)})}return d}},function(n,h,c){c.d(h,"b",function(){return m});var m;(function(c){c[c.UINT8=0]="UINT8";c[c.UINT16=1]="UINT16";c[c.UINT32=2]="UINT32";c[c.UINT64=3]="UINT64";c[c.FLOAT32=4]="FLOAT32"})(m||(m={}));n=[];h.a=n;n[m.UINT8]=1;n[m.UINT16]=2;n[m.UINT32]=4;n[m.UINT64]=8;n[m.FLOAT32]=4},function(n,h,c){var m=c(15),e=c(2);
h.a=function(){return new m.a(void 0)};h.b=function(a){return new m.b(a,e.h)}},function(n,h,c){function m(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function e(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});
b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function a(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}var b=c(16);n=c(25);var d=c(111),f=c(26),g=c(32),l=c(1),u=c(2),p=c(23),r=c(17),k=c(18),v=c(6),t=c(7);c.d(h,"a",function(){return C});h.b=function(b){var d=function(d){function f(b,d){a(this,f);b=m(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,b));b.parameters=d;return b}e(f,d);x(f,[{key:"initializeCounterpart",value:function(a,
b){b.parameters=this.parameters;B(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"initializeCounterpart",this).call(this,a,b)}},{key:"toString",value:function(){return b.stringify(this.parameters)}}],[{key:"get",value:function(a,b){var d=this;return a.getChunkSource(this,c.i(u.f)(b),function(){return new d(a,b)})}}]);return f}(D);d.prototype.RPC_TYPE_ID=b.RPC_ID;return d};var B=function z(a,b,d){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,b);if(void 0===c){if(a=
Object.getPrototypeOf(a),null!==a)return z(a,b,d)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(d)}},x=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}();h=this&&this.__decorate||function(a,b,d,c){var e=arguments.length,f=3>e?b:null===c?c=Object.getOwnPropertyDescriptor(b,d):c,g;
if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)f=Reflect.decorate(a,b,d,c);else for(var k=a.length-1;0<=k;k--)if(g=a[k])f=(3>e?g(f):3<e?g(b,d,f):g(b,d))||f;return 3<e&&f&&Object.defineProperty(b,d,f),f};var y=function(){function b(){a(this,b);this.tempLightVec=new Float32Array(4);this.tempPickID=new Float32Array(4)}x(b,[{key:"defineShader",value:function(a){a.addAttribute("highp vec3","aVertexPosition");a.addAttribute("highp vec3","aVertexNormal");a.addVarying("highp vec4","vColor");
a.addUniform("highp vec4","uLightDirection");a.addUniform("highp vec4","uColor");a.addUniform("highp mat4","uModelMatrix");a.addUniform("highp mat4","uProjection");a.addUniform("highp vec4","uPickID");a.setVertexMain("\ngl_Position = uProjection * (uModelMatrix * vec4(aVertexPosition, 1.0));\nvec3 normal = (uModelMatrix * vec4(aVertexNormal, 0.0)).xyz;\nfloat lightingFactor = abs(dot(normal, uLightDirection.xyz)) + uLightDirection.w;\nvColor = vec4(lightingFactor * uColor.rgb, uColor.a);\n");a.setFragmentMain("emit(vColor, uPickID);")}},
{key:"beginLayer",value:function(a,b,d){var c=d.dataToDevice,e=d.lightDirection,f=d.ambientLighting;d=d.directionalLighting;a.uniformMatrix4fv(b.uniform("uProjection"),!1,c);c=this.tempLightVec;l.a.scale(c,e,d);c[3]=f;a.uniform4fv(b.uniform("uLightDirection"),c)}},{key:"setColor",value:function(a,b,d){a.uniform4fv(b.uniform("uColor"),d)}},{key:"setPickID",value:function(a,b,d){a.uniform4fv(b.uniform("uPickID"),c.i(v.m)(this.tempPickID,d))}},{key:"beginObject",value:function(a,b,d){a.uniformMatrix4fv(b.uniform("uModelMatrix"),
!1,d)}},{key:"getShader",value:function(a,b){var d=this;return a.memoize.get("mesh/MeshShaderManager:"+c.i(p.a)(b),function(){var c=new k.a(a);c.require(b);d.defineShader(c);return c.build()})}},{key:"drawFragment",value:function(a,b,d){d.vertexBuffer.bindToVertexAttrib(b.attribute("aVertexPosition"),3);d.normalBuffer.bindToVertexAttrib(b.attribute("aVertexNormal"),3);d.indexBuffer.bind();a.drawElements(a.TRIANGLES,d.numIndices,a.UNSIGNED_INT,0)}},{key:"endLayer",value:function(a,b){a.disableVertexAttribArray(b.attribute("aVertexPosition"));
a.disableVertexAttribArray(b.attribute("aVertexNormal"))}}]);return b}(),C=function(f){function k(b,e,f){a(this,k);var l=m(this,(k.__proto__||Object.getPrototypeOf(k)).call(this));l.chunkManager=b;l.source=e;l.displayState=f;l.meshShaderManager=new y;l.shaders=new Map;c.i(g.c)(f,l);b=l.sharedObject=l.registerDisposer(new g.d(b,f));b.RPC_TYPE_ID=d.a;b.initializeCounterpartWithChunkManager({source:e.addCounterpartRef()});l.setReady(!0);l.visibilityCount.addDependency(b.visibilityCount);return l}e(k,
f);x(k,[{key:"getShader",value:function(a){var b=this.shaders,d=b.get(a);void 0===d&&(d=this.registerDisposer(this.meshShaderManager.getShader(this.gl,a)),b.set(a,d));return d}},{key:"draw",value:function(a){var d=this;if(a.emitColor||!a.alreadyEmittedPickID){var e=this.gl,f=this.displayState,k=this.meshShaderManager,l=Math.min(1,f.objectAlpha.value);if(!(0>=l)){var p=this.getShader(a.emitter);p.bind();k.beginLayer(e,p,a);var t=this.source.fragmentSource.objectChunks,r=a.pickIDs,u=this.displayState.objectToDataTransform.transform;
c.i(g.e)(f,t,function(t,z,h){a.emitColor&&k.setColor(e,p,c.i(g.f)(f,t,l));a.emitPickID&&k.setPickID(e,p,r.registerUint64(d,z));k.beginObject(e,p,u);t=$jscomp.makeIterator(h);for(z=t.next();!z.done;z=t.next())z=z.value,z.state===b.b.GPU_MEMORY&&k.drawFragment(e,p,z)});k.endLayer(e,p)}}}},{key:"isTransparent",get:function(){return 1>this.displayState.objectAlpha.value}},{key:"gl",get:function(){return this.chunkManager.chunkQueueManager.gl}}]);return k}(f.a),A=function(b){function d(b,c){a(this,d);
b=m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b));b.objectKey=c.objectKey;b.vertexPositions=c.vertexPositions;var e=b.indices=c.indices;b.numIndices=e.length;b.vertexNormals=c.vertexNormals;return b}e(d,b);x(d,[{key:"copyToGPU",value:function(a){B(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"copyToGPU",this).call(this,a);this.vertexBuffer=r.a.fromData(a,this.vertexPositions,a.ARRAY_BUFFER,a.STATIC_DRAW);this.indexBuffer=r.a.fromData(a,this.indices,a.ELEMENT_ARRAY_BUFFER,
a.STATIC_DRAW);this.normalBuffer=r.a.fromData(a,this.vertexNormals,a.ARRAY_BUFFER,a.STATIC_DRAW)}},{key:"freeGPUMemory",value:function(a){B(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"freeGPUMemory",this).call(this,a);this.vertexBuffer.dispose();this.indexBuffer.dispose();this.normalBuffer.dispose()}}]);return d}(n.d),D=function(b){function d(){a(this,d);var b=m(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments));b.fragmentSource=new F(b.chunkManager,b);return b}e(d,
b);x(d,[{key:"initializeCounterpart",value:function(a,b){this.fragmentSource.initializeCounterpart(this.chunkManager.rpc,{});b.fragmentSource=this.fragmentSource.addCounterpartRef();B(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"initializeCounterpart",this).call(this,a,b)}}]);return d}(n.c),F=function(b){function d(b,c){a(this,d);b=m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b));b.meshSource=c;b.objectChunks=new Map;return b}e(d,b);x(d,[{key:"addChunk",value:function(a,
b){B(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"addChunk",this).call(this,a,b);a=this.objectChunks;var c=b.objectKey,e=a.get(c);void 0===e&&(e=new Set,a.set(c,e));e.add(b)}},{key:"deleteChunk",value:function(a){var b=this.chunks.get(a);B(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"deleteChunk",this).call(this,a);a=this.objectChunks;var c=b.objectKey,e=a.get(c);e.delete(b);0===e.size&&a.delete(c)}},{key:"getChunk",value:function(a){return new A(this,a)}}]);return d}(n.c),
F=h([c.i(t.c)(d.b)],F)},function(n,h,c){function m(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function e(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,
b):a.__proto__=b)}function a(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function b(a,b){var d=b.redrawNeeded.dispatch;b.registerDisposer(a.segmentColorHash.changed.add(d));b.registerDisposer(a.visibleSegments.changed.add(d));b.registerDisposer(a.segmentEquivalences.changed.add(d));b.registerDisposer(a.segmentSelectionState.changed.add(d))}var d=c(114),f=c(65);n=c(0);var g=c(1),l=c(11),u=c(43),p=c(7),r=c(3);c.d(h,"b",function(){return t});c.d(h,"a",function(){return B});
h.g=b;h.c=function(a,d){b(a,d);d.registerDisposer(a.objectAlpha.changed.add(d.redrawNeeded.dispatch));d.registerDisposer(a.objectToDataTransform.changed.add(d.redrawNeeded.dispatch))};h.f=function(a,b,d){d=void 0===d?1:d;var c=x;c[3]=d;a.segmentColorHash.compute(c,b);if(a.segmentSelectionState.isSelected(b))for(a=0;3>a;++a)c[a]=.5*c[a]+.5;c[0]*=d;c[1]*=d;c[2]*=d;return c};h.e=function(a,b,e){c.i(d.a)(a,function(a,f){var g=c.i(d.b)(a),g=b.get(g);void 0!==g&&e(f,a,g)})};c.d(h,"d",function(){return y});
var k=function A(a,b,d){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,b);if(void 0===c){if(a=Object.getPrototypeOf(a),null!==a)return A(a,b,d)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(d)}},v=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),t=function(){function b(d,
c){a(this,b);this.key=d;this.value=c}v(b,[{key:"toString",value:function(){return this.key+"\u2192"+this.value}}]);return b}(),B=function(b){function d(){a(this,d);var b=m(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments));b.selectedSegment=new l.a;b.hasSelectedSegment=!1;b.changed=new r.a;return b}e(d,b);v(d,[{key:"set",value:function(a){if(null==a)this.hasSelectedSegment&&(this.hasSelectedSegment=!1,this.changed.dispatch());else{var b=this.selectedSegment;this.hasSelectedSegment&&
a.low===b.low&&a.high===b.high||(b.low=a.low,b.high=a.high,this.hasSelectedSegment=!0,this.changed.dispatch())}}},{key:"isSelected",value:function(a){return this.hasSelectedSegment&&l.a.equal(a,this.selectedSegment)}},{key:"bindTo",value:function(a,b){var d=this,c=new l.a;this.registerDisposer(a.changed.add(function(){var e=a.get(b);"number"===typeof e?(c.low=e,c.high=0,e=c):e instanceof t&&(e=e.value);d.set(e)}))}}]);return d}(n.a),x=g.n.create(),y=function(b){function d(b,c){a(this,d);var e=m(this,
(d.__proto__||Object.getPrototypeOf(d)).call(this));e.chunkManager=b;e.displayState=c;e.visibilityCount=new u.a;return e}e(d,b);v(d,[{key:"initializeCounterpartWithChunkManager",value:function(a){var b=this.displayState;a.chunkManager=this.chunkManager.rpcId;a.visibleSegments=b.visibleSegments.rpcId;a.segmentEquivalences=b.segmentEquivalences.rpcId;k(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"initializeCounterpart",this).call(this,this.chunkManager.rpc,a);c.i(f.a)(this)}}]);return d}(p.b)},
function(n,h,c){c.d(h,"a",function(){return a});var m=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,c,e){c&&a(b.prototype,c);e&&a(b,e);return b}}();c(169);var e=null,a=function(){function a(b){b=void 0===b?!1:b;if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");null===e&&(e=document.createElement("ul"),e.id="statusContainer",
document.body.appendChild(e));var d=document.createElement("li");this.element=d;!0===b&&(b=200);!1!==b?(this.setVisible(!1),this.timer=setTimeout(this.setVisible.bind(this,!0),b)):this.timer=null;e.appendChild(d)}m(a,[{key:"dispose",value:function(){e.removeChild(this.element);this.element=void 0;null!==this.timer&&clearTimeout(this.timer)}},{key:"setText",value:function(a,b){this.element.textContent=a;b&&this.setVisible(!0)}},{key:"setHTML",value:function(a,b){this.element.innerHTML=a;b&&this.setVisible(!0)}},
{key:"setVisible",value:function(a){this.timer=null;this.element.style.display=a?"block":"none"}}],[{key:"forPromise",value:function(b,c){var d=new a(c.delay);d.setText(c.initialMessage);var e=d.dispose.bind(d);b.then(e,function(a){d.element.textContent=(void 0===c.errorPrefix?"":c.errorPrefix)+(a instanceof Error?a.message:""+a)+"  ";a=document.createElement("button");a.textContent="Dismiss";a.addEventListener("click",function(){d.dispose()});d.element.appendChild(a);d.setVisible(!0)});return b}}]);
return a}()},function(n,h,c){var m=c(1),e=c(2),a=c(3);c.d(h,"a",function(){return d});var b=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),d=function(){function d(b){b=void 0===b?m.b.create():b;if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");this.transform=b;this.changed=
new a.a}b(d,[{key:"reset",value:function(){m.b.copy(this.transform,m.g);this.changed.dispatch()}},{key:"toJSON",value:function(){if(!m.b.equals(m.g,this.transform)){var a=this.transform;return[[a[0],a[4],a[8],a[12]],[a[1],a[5],a[9],a[13]],[a[2],a[6],a[10],a[14]],[a[3],a[7],a[11],a[15]]]}}},{key:"restoreState",value:function(a){if(null==a)this.reset();else if(Array.isArray(a))if(4===a.length)try{for(var b=0;4>b;++b)c.i(e.g)(this.transform.subarray(4*b,4*(b+1)),a[b]);m.b.transpose(this.transform,this.transform)}catch(r){this.reset()}else if(16===
a.length)try{c.i(e.g)(this.transform,a),m.b.transpose(this.transform,this.transform)}catch(r){this.reset()}else this.reset();else if("object"===typeof a){var b=m.l.create(),d=m.a.create(),f=m.a.fromValues(1,1,1);try{c.i(e.g)(b,a.rotation),m.l.normalize(b,b)}catch(r){m.l.identity(b)}try{c.i(e.g)(d,a.translation)}catch(r){m.a.copy(d,m.d)}try{c.i(e.g)(f,a.scale)}catch(r){m.a.copy(f,m.q)}m.b.fromRotationTranslationScale(this.transform,b,d,f);this.changed.dispatch()}else this.reset()}},{key:"clone",value:function(){return new d(m.b.clone(this.transform))}}]);
return d}()},function(n,h,c){c.d(h,"b",function(){return e});var m=function(){function a(a,d){for(var b=0;b<d.length;b++){var c=d[b];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}();h.a=4093;var e=function(){function a(b,d,c,e){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");this.a0=b;this.a1=d;this.b=c;this.c=e}m(a,[{key:"computeDotProduct",
value:function(a,d){var b=this.a0,c=this.a1;return b[0]*(a&255)+b[1]*(a>>8&255)+b[2]*(a>>16&255)+b[3]*(a>>24&255)+(c[0]*(d&255)+c[1]*(d>>8&255)+c[2]*(d>>16&255)+c[3]*(d>>24&255))}},{key:"compute",value:function(a,d){var b=this.b,c=this.c;a=this.computeDotProduct(a,d);return(a+a*a%4093*c+b)%4093}},{key:"toString",value:function(){return"new HashFunction(Float32Array.of("+this.a0+"), Float32Array.of("+this.a1+"), "+this.b+", "+this.c+")"}}],[{key:"generate",value:function(){function b(){return Math.floor(4093*
Math.random())}return new a(Float32Array.of(b(),b(),b(),b()),Float32Array.of(b(),b(),b(),b()),b(),b())}}]);return a}()},function(n,h,c){function m(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function e(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,
enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function a(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}var b=c(35),d=c(11);c.d(h,"c",function(){return k});c.d(h,"a",function(){return y});var f=function A(a,b,d){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,b);if(void 0===c){if(a=Object.getPrototypeOf(a),null!==a)return A(a,b,d)}else{if("value"in c)return c.value;b=c.get;
return void 0===b?void 0:b.call(d)}},g=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}();h.b=3;var l=0,u=0,p=0,r=0;n=function(){function c(b){b=void 0===b?c.generateHashFunctions(3):b;a(this,c);this.loadFactor=.9;this.size=0;this.growFactor=1.2;this.maxHeight=8192;this.emptyHigh=this.emptyLow=4294967295;this.maxAttempts=
this.maxRehashAttempts=5;this.maxWidth=4096/this.entryStride;this.generation=0;this.mungedEmptyKey=-1;this.hashFunctions=b;this.allocate(4,1)}g(c,[{key:"updateHashFunctions",value:function(a){this.hashFunctions=c.generateHashFunctions(a);this.mungedEmptyKey=-1}},{key:"tableWithMungedEmptyKey",value:function(a){for(var b=this.hashFunctions.length,d=Array(b),c=0;c<b;++c)d[c]=this.getHash(c,this.emptyLow,this.emptyHigh);c=this.mungedEmptyKey;if(-1===c)a:for(;;){for(var c=16777216*Math.random()>>>0,e=
0;e<b;++e)for(var f=this.getHash(e,c,c),g=0;g<b;++g)if(d[g]===f)continue a;this.mungedEmptyKey=c;break}for(var e=this.table,f=this.emptyLow,g=this.emptyHigh,k=0;k<b;++k){var l=d[k];e[l]===f&&e[l+1]===g&&(e[l]=c,e[l+1]=c)}try{a(e)}finally{for(a=0;a<b;++a)k=d[a],e[k]===c&&e[k+1]===c&&(e[k]=f,e[k+1]=g)}}},{key:"getHash",value:function(a,b,d){a=this.hashFunctions[a];var c=this.width,e=this.height,c=a[0].compute(b,d)%c;b=a[1].compute(b,d)%e;return this.entryStride*(b*this.width+c)}},{key:"keys",value:function(a){function b(b,
z){for(;;)switch(c){case 0:a=void 0===a?new d.a:a,h=v,u=h.emptyLow,r=h.emptyHigh,p=h.entryStride,t=v,l=t.table,k=0,g=l.length;case 1:if(!(k<g)){c=3;break}f=l[k];e=l[k+1];if(f===u&&e===r){c=4;break}a.low=f;a.high=e;c=5;return{value:a,done:!1};case 5:if(void 0===z){c=6;break}c=-1;throw z;case 6:case 4:case 2:k+=p;c=1;break;case 3:c=-1;default:return{value:void 0,done:!0}}}var c=0,e,f,g,k,l,t,p,r,u,h,v=this,m={next:function(a){return b(a,void 0)},throw:function(a){return b(void 0,a)},return:function(a){throw Error("Not yet implemented");
}};$jscomp.initSymbolIterator();m[Symbol.iterator]=function(){return this};return m}},{key:"indexOfPair",value:function(a,b){var d=this.table,c=this.emptyHigh;if(a===this.emptyLow&&b===c)return-1;for(var c=0,e=this.hashFunctions.length;c<e;++c){var f=this.getHash(c,a,b);if(d[f]===a&&d[f+1]===b)return f}return-1}},{key:"indexOf",value:function(a){return this.indexOfPair(a.low,a.high)}},{key:"chooseAnotherEmptyKey",value:function(){for(var a=this.emptyLow,b=this.emptyHigh,d=this.table,c=this.entryStride,
e,f;e=4294967296*Math.random()>>>0,f=4294967296*Math.random()>>>0,e===a&&f===b||this.hasPair(e,f););this.emptyLow=e;this.emptyHigh=f;for(var g=0,k=d.length;g<k;g+=c)d[g]===a&&d[g+1]===b&&(d[g]=e,d[g+1]=f)}},{key:"has",value:function(a){return-1!==this.indexOf(a)}},{key:"hasPair",value:function(a,b){return-1!==this.indexOfPair(a,b)}},{key:"delete",value:function(a){a=this.indexOf(a);if(-1!==a){var b=this.table;b[a]=this.emptyLow;b[a+1]=this.emptyHigh;++this.generation;this.size--;return!0}return!1}},
{key:"clearTable",value:function(){for(var a=this.table,b=this.entryStride,d=this.emptyLow,c=this.emptyHigh,e=a.length,f=0;f<e;f+=b)a[f]=d,a[f+1]=c}},{key:"clear",value:function(){if(0===this.size)return!1;this.size=0;++this.generation;this.clearTable();return!0}},{key:"swapPending",value:function(a,b){var d=l,c=u;this.storePending(a,b);a[b]=d;a[b+1]=c}},{key:"storePending",value:function(a,b){l=a[b];u=a[b+1]}},{key:"backupPending",value:function(){p=l;r=u}},{key:"restorePending",value:function(){l=
p;u=r}},{key:"tryToInsert",value:function(){for(var a=0,b=this.emptyLow,d=this.emptyHigh,c=this.maxAttempts,e=this.table,f=this.hashFunctions.length,g=Math.floor(Math.random()*f);;){var k=this.getHash(g,l,u);this.swapPending(e,k);if(l===b&&u===d)return!0;if(++a===c)break;g=(g+Math.floor(Math.random()*(f-1))+1)%f}return!1}},{key:"allocate",value:function(a,b){var d=a*b;this.width=a;this.height=b;this.table=new Uint32Array(d*this.entryStride);this.maxAttempts=d;this.clearTable();this.capacity=d*this.loadFactor;
this.mungedEmptyKey=-1}},{key:"rehash",value:function(a,b,d){this.allocate(b,d);this.updateHashFunctions(this.hashFunctions.length);b=this.emptyLow;d=this.emptyHigh;for(var c=this.entryStride,e=0,f=a.length;e<f;e+=c){var g=a[e+1];if(a[e]!==b||g!==d)if(this.storePending(a,e),!this.tryToInsert())return!1}return!0}},{key:"grow",value:function(a){for(var b=this.table,d=this.width,c=this.height,e=this.maxWidth,f=this.maxHeight;;){var g=d*c,d=Math.min(e,Math.ceil(a/this.height));d*c<a&&(c=Math.min(f,Math.ceil(a/
d)));var k=d*c;if(k<a&&k===g)throw Error("Maximum table size exceeded");for(g=0;g<this.maxRehashAttempts;++g)if(this.rehash(b,d,c))return;a=Math.ceil(this.growFactor*a)}}},{key:"insertInternal",value:function(){++this.generation;l===this.emptyLow&&u===this.emptyHigh&&this.chooseAnotherEmptyKey();++this.size>this.capacity&&(this.backupPending(),this.grow(Math.ceil(this.growFactor*this.width*this.height)),this.restorePending());for(;!this.tryToInsert();)this.backupPending(),this.grow(this.width*this.height),
this.restorePending()}}],[{key:"generateHashFunctions",value:function(a){a=void 0===a?3:a;for(var d=[],c=0;c<a;++c){var e=[b.b.generate(),b.b.generate()];d.push(e)}return d}}]);return c}();var k=function(b){function d(){a(this,d);return m(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments))}e(d,b);$jscomp.initSymbol();$jscomp.initSymbolIterator();g(d,[{key:"add",value:function(a){var b=a.low;a=a.high;if(this.hasPair(b,a))return!1;l=b;u=a;this.insertInternal();return!0}},{key:Symbol.iterator,
value:function(){return this.keys()}}]);return d}(n);k.prototype.entryStride=2;var v=0,t=0,B=0,x=0,y=function(b){function c(){a(this,c);return m(this,(c.__proto__||Object.getPrototypeOf(c)).apply(this,arguments))}e(c,b);$jscomp.initSymbol();$jscomp.initSymbolIterator();g(c,[{key:"set",value:function(a,b){var d=a.low;a=a.high;if(this.hasPair(d,a))return!1;l=d;u=a;v=b.low;t=b.high;this.insertInternal();return!0}},{key:"get",value:function(a,b){a=this.indexOf(a);if(-1===a)return!1;var d=this.table;b.low=
d[a+2];b.high=d[a+3];return!0}},{key:"swapPending",value:function(a,b){var d=v,e=t;f(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"swapPending",this).call(this,a,b);a[b+2]=d;a[b+3]=e}},{key:"storePending",value:function(a,b){f(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"storePending",this).call(this,a,b);v=a[b+2];t=a[b+3]}},{key:"backupPending",value:function(){f(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"backupPending",this).call(this);B=v;x=t}},{key:"restorePending",
value:function(){f(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"restorePending",this).call(this);v=B;t=x}},{key:Symbol.iterator,value:function(){return this.entries()}},{key:"entries",value:function(a){function b(b,z){for(;;)switch(c){case 0:a=void 0===a?[new d.a,new d.a]:a,A=B,m=A.emptyLow,v=A.emptyHigh,h=A.entryStride,u=B,r=u.table,p=$jscomp.makeIterator(a),t=p.next().value,l=p.next().value,k=0,g=r.length;case 1:if(!(k<g)){c=3;break}f=r[k];e=r[k+1];if(f===m&&e===v){c=4;break}t.low=
f;t.high=e;l.low=r[k+2];l.high=r[k+3];c=5;return{value:a,done:!1};case 5:if(void 0===z){c=6;break}c=-1;throw z;case 6:case 4:case 2:k+=h;c=1;break;case 3:c=-1;default:return{value:void 0,done:!0}}}var c=0,e,f,g,k,l,t,p,r,u,h,v,m,A,B=this,y={next:function(a){return b(a,void 0)},throw:function(a){return b(void 0,a)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();y[Symbol.iterator]=function(){return this};return y}}]);return c}(n);y.prototype.entryStride=4},function(n,
h,c){function m(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function e(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function a(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});
b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function b(a){switch(a){case r.b.FLOAT32:return C.e;default:throw Error("Data type not supported by WebGL: ${DataType[dataType]}");}}var d=c(16);n=c(25);var f=c(26),g=c(32),l=c(118),u=c(38),p=c(15),r=c(29),k=c(0),v=c(1),t=c(2),B=c(23),x=c(3),y=c(17),C=c(24),A=c(18),D=c(6);h.a=function(a){return new p.b(void 0===a?"void main() {\n  emitDefault();\n}\n":a,t.h)};c.d(h,"b",function(){return E});c.d(h,"c",function(){return U});c.d(h,"d",
function(){return V});h.f=function(b){var d=function(d){function f(){m(this,f);return e(this,(f.__proto__||Object.getPrototypeOf(f)).apply(this,arguments))}a(f,d);G(f,[{key:"toString",value:function(){return b.stringify(this.parameters)}}],[{key:"get",value:function(a,b){var d=this;return a.getChunkSource(this,c.i(t.f)(b),function(){return new d(a,b)})}}]);return f}(ca);d.prototype.RPC_TYPE_ID=b.RPC_ID;return d};var F=function H(a,b,d){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,
b);if(void 0===c){if(a=Object.getPrototypeOf(a),null!==a)return H(a,b,d)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(d)}},G=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),z=c(50),L=v.b.create(),J=new Float32Array(4);h.e="//NEUROGLANCER_SKELETON_LAYER_FRAGMENT_MAIN_START";var I=
function(b){function d(a){m(this,d);var b=e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));b.vertexAttributes=a;b.shaders=new Map;b.shaderGeneration=-1;b.vertexAttributesKey=c.i(t.f)(b.vertexAttributes);return b}a(d,b);G(d,[{key:"defineShader",value:function(a,b){a.addUniform("highp vec4","uColor");a.addUniform("highp mat4","uProjection");a.addUniform("highp vec4","uPickID");var d="\ngl_Position = uProjection * vec4(aVertex0, 1.0);\n";a.addFragmentCode("\nvec4 segmentColor() {\n  return uColor;\n}\nvoid emitRGB(vec3 color) {\n  emit(vec4(color * uColor.a, uColor.a), uPickID);\n}\nvoid emitDefault() {\n  emit(uColor, uPickID);\n}\n");
a.addFragmentCode(z);this.vertexAttributes.forEach(function(b,c){a.addAttribute("highp "+b.glslDataType,"aVertex"+c);0!==c&&(a.addVarying("highp "+b.glslDataType,"vVertex"+c),d+="vVertex"+c+" = aVertex"+c+";\n",a.addFragmentCode("#define "+b.name+" vVertex"+c+"\n"))});a.setVertexMain(d);a.setFragmentMainFunction("//NEUROGLANCER_SKELETON_LAYER_FRAGMENT_MAIN_START\n"+b)}},{key:"beginLayer",value:function(a,b,d,c){d=v.b.multiply(L,d.dataToDevice,c);a.uniformMatrix4fv(b.uniform("uProjection"),!1,d)}},
{key:"getShader",value:function(a,b,d){var e=this;return this.registerDisposer(a.memoize.get("skeleton/SkeletonShaderManager:"+c.i(B.a)(b)+":"+this.vertexAttributesKey+":"+d,function(){var c=new A.a(a);c.require(b);e.defineShader(c,d);return c.build()}))}},{key:"setColor",value:function(a,b,d){a.uniform4fv(b.uniform("uColor"),d)}},{key:"setPickID",value:function(a,b,d){a.uniform4fv(b.uniform("uPickID"),c.i(D.m)(J,d))}},{key:"drawSkeleton",value:function(a,b,d){for(var c=this.vertexAttributes,e=c.length,
f=d.vertexAttributeOffsets,g=0;g<e;++g){var k=c[g];d.vertexBuffer.bindToVertexAttrib(b.attribute("aVertex"+g),k.numComponents,k.webglDataType,!1,0,f[g])}d.indexBuffer.bind();a.drawElements(a.LINES,d.numIndices,a.UNSIGNED_INT,0)}},{key:"endLayer",value:function(a,b){for(var d=this.vertexAttributes.length,c=0;c<d;++c)a.disableVertexAttribArray(b.attribute("aVertex"+c))}}]);return d}(k.a),E=function(f){function k(a,d,f,t){m(this,k);var p=e(this,(k.__proto__||Object.getPrototypeOf(k)).call(this));p.chunkManager=
a;p.source=d;p.voxelSizeObject=f;p.displayState=t;p.tempMat=v.b.create();p.redrawNeeded=new x.a;p.fallbackFragmentMain="void main() {\n  emitDefault();\n}\n";c.i(g.c)(t,p);p.displayState.shaderError.value=void 0;p.registerDisposer(t.fragmentMain.changed.add(function(){p.displayState.shaderError.value=void 0;p.redrawNeeded.dispatch()}));a=p.sharedObject=p.registerDisposer(new g.d(a,t));a.RPC_TYPE_ID=l.a;a.initializeCounterpartWithChunkManager({source:d.addCounterpartRef()});a=p.vertexAttributes=[R];
d=$jscomp.makeIterator(d.vertexAttributes);for(f=d.next();!f.done;f=d.next())t=$jscomp.makeIterator(f.value),f=t.next().value,t=t.next().value,a.push({name:f,dataType:t.dataType,numComponents:t.numComponents,webglDataType:b(t.dataType),glslDataType:1<t.numComponents?"vec"+t.numComponents:"float"});return p}a(k,f);G(k,[{key:"getShader",value:function(a,b,d){var c=this.displayState.fragmentMain,e=c.changed.count,f=b.shaders;b.shaderGeneration!==e&&(f.clear(),b.shaderGeneration=e);e=f.get(d);if(void 0===
e){e=null;try{e=b.getShader(a,d,c.value),this.fallbackFragmentMain=c.value,this.displayState.shaderError.value=null}catch(Aa){this.displayState.shaderError.value=Aa;try{e=b.getShader(a,d,this.fallbackFragmentMain)}catch(Ta){}}f.set(d,e)}return e}},{key:"draw",value:function(a,b,e,f){void 0===f&&(f=a.emitColor?1:5);var k=this.gl,l=this.source,p=this.displayState,t=Math.min(1,p.objectAlpha.value);if(!(0>=t)){var r=this.getShader(k,e,a.emitter);if(null!==r){r.bind();var u=this.tempMat;v.b.identity(u);
l.skeletonVertexCoordinatesInVoxels&&v.b.scale(u,u,this.voxelSizeObject.size);v.b.multiply(u,this.displayState.objectToDataTransform.transform,u);e.beginLayer(k,r,a,u);var l=l.chunks,h=a.pickIDs;k.lineWidth(f);c.i(g.e)(p,l,function(f,l,u){u.state===d.b.GPU_MEMORY&&(a.emitColor&&e.setColor(k,r,c.i(g.f)(p,f,t)),a.emitPickID&&e.setPickID(k,r,h.registerUint64(b,l)),e.drawSkeleton(k,r,u))});e.endLayer(k,r)}}}},{key:"visibilityCount",get:function(){return this.sharedObject.visibilityCount}},{key:"gl",get:function(){return this.chunkManager.chunkQueueManager.gl}}]);
return k}(k.a),U=function(b){function d(a){m(this,d);var b=e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));b.base=a;b.renderHelper=b.registerDisposer(new I(b.base.vertexAttributes));b.registerDisposer(a);b.registerDisposer(a.redrawNeeded.add(function(){b.redrawNeeded.dispatch()}));b.setReady(!0);b.visibilityCount.addDependency(a.visibilityCount);return b}a(d,b);G(d,[{key:"draw",value:function(a){this.base.draw(a,this,this.renderHelper)}},{key:"gl",get:function(){return this.base.gl}},{key:"isTransparent",
get:function(){return 1>this.base.displayState.objectAlpha.value}}]);return d}(f.a),V=function(b){function d(a){m(this,d);var b=e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));b.base=a;b.renderHelper=b.registerDisposer(new I(b.base.vertexAttributes));b.registerDisposer(a);b.registerDisposer(a.redrawNeeded.add(function(){b.redrawNeeded.dispatch()}));b.setReady(!0);b.visibilityCount.addDependency(a.visibilityCount);return b}a(d,b);G(d,[{key:"draw",value:function(a){this.base.draw(a,this,
this.renderHelper,10)}},{key:"gl",get:function(){return this.base.gl}}]);return d}(u.b),R={dataType:r.b.FLOAT32,numComponents:3,name:"",webglDataType:C.e,glslDataType:"vec3"},P=function(b){function d(a,b){m(this,d);a=e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,a));a.vertexAttributes=b.vertexAttributes;var c=a.indices=b.indices;a.vertexAttributeOffsets=b.vertexAttributeOffsets;a.numIndices=c.length;return a}a(d,b);G(d,[{key:"copyToGPU",value:function(a){F(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),
"copyToGPU",this).call(this,a);this.vertexBuffer=y.a.fromData(a,this.vertexAttributes,a.ARRAY_BUFFER,a.STATIC_DRAW);this.indexBuffer=y.a.fromData(a,this.indices,a.ELEMENT_ARRAY_BUFFER,a.STATIC_DRAW)}},{key:"freeGPUMemory",value:function(a){F(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"freeGPUMemory",this).call(this,a);this.vertexBuffer.dispose();this.indexBuffer.dispose()}}]);return d}(n.d),T=new Map,ca=function(b){function d(a,b){m(this,d);a=e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,
a));a.parameters=b;return a}a(d,b);G(d,[{key:"initializeCounterpart",value:function(a,b){b.parameters=this.parameters;F(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"initializeCounterpart",this).call(this,a,b)}}]);return d}(function(b){function d(){m(this,d);return e(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments))}a(d,b);G(d,[{key:"getChunk",value:function(a){return new P(this,a)}},{key:"skeletonVertexCoordinatesInVoxels",get:function(){return!0}},{key:"vertexAttributes",
get:function(){return T}}]);return d}(n.c))},function(n,h,c){function m(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function e(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function a(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,
{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function b(a){a.addFragmentCode("\nvoid emit(vec4 color, vec4 pickId) {\n  gl_FragColor = color;\n}\n")}function d(a){a.addFragmentCode("\nvoid emit(vec4 color, vec4 pickId) {\n  gl_FragColor = pickId;\n}\n")}var f=c(52),g=c(9),l=c(61);n=c(62);var u=c(5),p=c(27),r=c(1),k=c(71),v=c(44),t=c(150);c.d(h,"b",function(){return y});c.d(h,"a",function(){return C});var B=function(){function a(a,
b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),x;(function(a){a[a.COLOR=0]="COLOR";a[a.PICK=1]="PICK";a[a.NUM_TEXTURES=2]="NUM_TEXTURES"})(x||(x={}));var y=function(b){function d(){m(this,d);return e(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments))}a(d,b);B(d,[{key:"draw",value:function(a){}}]);return d}(g.g),
C=function(h){function A(a,d,k,h){m(this,A);var z=e(this,(A.__proto__||Object.getPrototypeOf(A)).call(this,a,d,h));z.sliceView=k;z.axesLineHelper=z.registerDisposer(f.a.get(z.gl));z.sliceViewRenderHelper=z.registerDisposer(u.b.get(z.gl,b));z.colorFactor=r.n.fromValues(1,1,1,1);z.backgroundColor=r.n.fromValues(.5,.5,.5,1);z.pickIDs=new l.a;z.visibleLayerTracker=c.i(g.e)(z.viewer.layerManager,y,z);z.offscreenFramebuffer=z.registerDisposer(new v.a(z.gl,{colorBuffers:c.i(v.b)(z.gl,x.NUM_TEXTURES)}));
z.offscreenCopyHelper=z.registerDisposer(v.d.get(z.gl));z.scaleBarWidget=z.registerDisposer(new t.a);z.registerDisposer(k);z.registerDisposer(k.viewChanged.add(function(){a.scheduleRedraw()}));z.registerDisposer(h.showAxisLines.changed.add(function(){z.scheduleRedraw()}));d=z.scaleBarWidget.element;z.registerDisposer(new p.c(h.showScaleBar,d));z.element.appendChild(d);return z}a(A,h);B(A,[{key:"draw",value:function(){var a=this.sliceView;if(a.hasValidViewport){a.updateRendering();var c=this.gl,e=
a.width,f=a.height,g=a.dataToDevice;this.offscreenFramebuffer.bind(e,f);c.disable(c.SCISSOR_TEST);this.gl.clearColor(0,0,0,0);c.clear(c.COLOR_BUFFER_BIT);var k=r.b.create();this.sliceViewRenderHelper.draw(a.offscreenFramebuffer.colorBuffers[0].texture,r.g,this.colorFactor,this.backgroundColor,0,0,1,1);var l=this.visibleLayerTracker.getVisibleLayers(),p=this.pickIDs;p.clear();this.offscreenFramebuffer.bindSingle(x.COLOR);p={dataToDevice:a.dataToDevice,pickIDs:p,emitter:b,emitColor:!0,emitPickID:!1,
viewportWidth:e,viewportHeight:f};c.enable(c.BLEND);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);for(var t=$jscomp.makeIterator(l),u=t.next();!u.done;u=t.next())u.value.draw(p);c.disable(c.BLEND);this.offscreenFramebuffer.bindSingle(x.PICK);p.emitColor=!1;p.emitPickID=!0;p.emitter=d;c=$jscomp.makeIterator(l);for(u=c.next();!u.done;u=c.next())u.value.draw(p);if(this.viewer.showAxisLines.value){r.b.copy(k,g);for(g=0;3>g;++g)k[12+g]=0;for(g=0;4>g;++g)k[2+4*g]=0;f=Math.min(e,f)/4*1.5;g=a.pixelSize;
for(c=0;12>c;++c)k[c]=k[c]*f*g;this.offscreenFramebuffer.bindSingle(x.COLOR);this.axesLineHelper.draw(k)}this.offscreenFramebuffer.unbind();this.setGLViewport();this.offscreenCopyHelper.draw(this.offscreenFramebuffer.colorBuffers[x.COLOR].texture);k=this.scaleBarWidget;f=k.dimensions;f.targetLengthInPixels=Math.min(e/4,100);f.nanometersPerPixel=a.pixelSize;k.update()}}},{key:"onResize",value:function(){this.sliceView.setViewportSize(this.element.clientWidth,this.element.clientHeight)}},{key:"updateMouseState",
value:function(a){a.pickedRenderLayer=null;var b=this.sliceView;if(!b.hasValidViewport)return!1;var d=b.width,c=b.height,e=this.offscreenFramebuffer;if(!e.hasSize(d,c))return!1;var f=a.position,g=this.mouseX,k=this.mouseY;r.a.set(f,g-d/2,k-c/2,0);r.a.transformMat4(f,f,b.viewportToData);this.pickIDs.setMouseState(a,e.readPixelAsUint32(x.PICK,g,c-k));return!0}},{key:"startDragViewport",value:function(a){var b=this,d=this.viewer.mouseState;if(d.updateUnconditionally()){var e=r.a.clone(d.position);c.i(k.a)(a,
function(a,d,c){var f=b.viewer.navigationState.position;a.shiftKey?(f=b.sliceView.viewportAxes,b.viewer.navigationState.pose.rotateAbsolute(f[1],d/4*Math.PI/180,e),b.viewer.navigationState.pose.rotateAbsolute(f[0],c/4*Math.PI/180,e)):(a=f.spatialCoordinates,r.a.set(a,d,c,0),r.a.transformMat4(a,a,b.sliceView.viewportToData),f.changed.dispatch())})}}},{key:"zoomByMouse",value:function(a){var b=this.navigationState;if(b.valid){var d=this.sliceView,c=d.height,e=this.mouseX,f=this.mouseY,e=e-d.width/2,
f=f-c/2,c=this.navigationState.zoomFactor.value;b.zoomBy(a);a=b.zoomFactor.value;var g=b.position.spatialCoordinates;r.a.scaleAndAdd(g,g,d.viewportAxes[0],e*(c-a));r.a.scaleAndAdd(g,g,d.viewportAxes[1],f*(c-a));b.position.changed.dispatch()}}},{key:"navigationState",get:function(){return this.sliceView.navigationState}}]);return A}(n.a)},function(n,h,c){function m(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function e(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function a(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function b(a){for(var b=0,d=0;3>d;++d)0>a[d]&&(b+=1<<d);return b}var d=c(16);n=c(9);var f=c(4),g=c(0),l=c(1),u=c(17),p=c(30),r=c(18),
k=c(6),v=c(7);c.d(h,"a",function(){return F});var t=function z(a,b,d){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,b);if(void 0===c){if(a=Object.getPrototypeOf(a),null!==a)return z(a,b,d)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(d)}},B=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&
a(b.prototype,d);c&&a(b,c);return b}}(),x=function(b){function d(a){m(this,d);var b=e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));b.outputVertexIndices=b.registerDisposer(u.a.fromData(a,new Float32Array([0,1,2,3,4,5]),a.ARRAY_BUFFER,a.STATIC_DRAW));b.vertexBasePositions=[0,0,0,1,0,0,0,1,0,1,1,0,0,0,1,1,0,1,0,1,1,1,1,1];a=[0,1,2,4,5,3,6,7];for(var c=[0,1,2,5,3,4,6,7],f=[0,1,1,4,4,7,4,7,1,5,0,1,1,4,4,7,0,2,2,5,5,7,5,7,2,6,0,2,2,5,5,7,0,3,3,6,6,7,6,7,3,4,0,3,3,6,6,7],g=[0,1,2,3,4,5,6,7,
1,4,5,0,3,7,2,6,2,6,0,5,7,3,1,4,3,0,6,4,1,2,7,5,4,3,7,1,0,6,5,2,5,2,1,7,6,0,4,3,6,7,3,2,5,4,0,1,7,5,4,6,2,1,3,0],k=[],l=0;8>l;++l)for(var p=0;p<f.length;++p)k.push(a[g[8*c[l]+f[p]]]);b.vertexIndices=new Int32Array(k);return b}a(d,b);B(d,null,[{key:"get",value:function(a){return a.memoize.get("SliceViewShaderBuffers",function(){return new d(a)})}}]);return d}(g.a),y=l.a.create(),C=l.a.create(),A=l.b.create(),D=function(d){function f(a){m(this,f);var b=e(this,(f.__proto__||Object.getPrototypeOf(f)).call(this));
b.data=b.registerDisposer(x.get(a));return b}a(f,d);B(f,null,[{key:"get",value:function(a){return a.memoize.get("sliceview.VolumeSliceVertexComputationManager",function(){return new f(a)})}}]);B(f,[{key:"defineShader",value:function(a){var b=this.data;a.addAttribute("highp float","aVertexIndexFloat");a.addUniform("highp vec3","uTranslation");a.addUniform("highp mat4","uProjectionMatrix");a.addUniform("highp vec3","uPlaneNormal");a.addUniform("highp float","uPlaneDistance");a.addUniform("highp ivec2",
"uVertexIndex",24);a.addUniform("highp vec3","uVertexBasePosition",8);a.addInitializer(function(a){a.gl.uniform3fv(a.uniform("uVertexBasePosition"),new Float32Array(b.vertexBasePositions))});a.addUniform("highp vec3","uChunkDataSize");a.addUniform("highp vec3","uVoxelSize");a.addUniform("highp vec3","uLowerClipBound");a.addUniform("highp vec3","uUpperClipBound");a.addVarying("highp vec3","vChunkPosition");a.setVertexMain("\nvec3 chunkSize = uChunkDataSize * uVoxelSize;\nint vertexIndex = int(aVertexIndexFloat);\nfor (int e = 0; e < 4; ++e) {\n  highp ivec2 vidx = uVertexIndex[vertexIndex*4 + e];\n  highp vec3 v1 = max(uLowerClipBound, min(uUpperClipBound, chunkSize * uVertexBasePosition[vidx.x] + uTranslation));\n  highp vec3 v2 = max(uLowerClipBound, min(uUpperClipBound, chunkSize * uVertexBasePosition[vidx.y] + uTranslation));\n  highp vec3 vDir = v2 - v1;\n  highp float denom = dot(vDir, uPlaneNormal);\n  if (abs(denom) > 0.001) {\n    highp float lambda = (uPlaneDistance - dot(v1, uPlaneNormal)) / denom;\n    if ((lambda >= -0.001) && (lambda <= (1.0 + 0.001))) {\n      lambda = clamp(lambda, 0.0, 1.0);\n      highp vec3 position = v1 + lambda * vDir;\n      gl_Position = uProjectionMatrix * vec4(position, 1.0);\n      vChunkPosition = (position - uTranslation) / uVoxelSize;\n      break;\n    }\n  }\n}\n");
a.addFragmentCode("\nvec3 getPositionWithinChunk () {\n  return floor(min(vChunkPosition, uChunkDataSize - 1.0));\n}\n")}},{key:"computeVerticesDebug",value:function(a,d,e,f,g,k){a=l.a.multiply(l.a.create(),a,d);d=b(f);d=this.data.vertexIndices.subarray(48*d,48*(d+1));for(var p=[0,0],t=[l.a.create(),l.a.create()],r=l.a.create(),u=l.a.create(),h=l.a.create(),v=l.a.create(),z=l.a.create(),m=new Float32Array(this.data.vertexBasePositions),B=function(a){return m.subarray(3*a,3*a+3)},A=0;6>A;++A)for(var y=
0;4>y;++y){for(var x=0;2>x;++x)p[x]=d[2*(4*A+y)+x],l.a.multiply(t[x],a,B(p[x]));l.a.add(r,t[0],g);l.a.subtract(u,t[1],t[0]);x=l.a.dot(u,f);if(.001<Math.abs(x)){var F=(e-l.a.dot(r,f))/x;if(-.001<=F&&1.001>=F){F=Math.max(0,Math.min(1,F));l.a.scaleAndAdd(h,r,u,F);l.a.transformMat4(v,h,k);l.a.scale(z,B(p[0]),1-F);l.a.scaleAndAdd(z,z,B(p[1]),F);console.log("vertex "+A+", e = "+y+", at "+v+", vChunkPosition = "+z+", edge dir = "+u+", denom = "+x);break}else console.log("vertex "+A+", e = "+y+", skipped, deom = "+
x+", vDir = "+c.i(l.o)(u)+", uPlaneNormal = "+c.i(l.o)(f)+", lambda="+F)}else console.log("vertex "+A+", e = "+y+", skipped, deom = "+x+", vDir = "+c.i(l.o)(u)+", uPlaneNormal = "+c.i(l.o)(f))}}},{key:"beginSlice",value:function(a,b){a=b.attribute("aVertexIndexFloat");this.data.outputVertexIndices.bindToVertexAttrib(a,1)}},{key:"endSlice",value:function(a,b){b=b.attribute("aVertexIndexFloat");a.disableVertexAttribArray(b)}},{key:"beginSource",value:function(a,d,c,e,f){var g=f.chunkLayout,k=g.globalToLocalSpatialVector(y,
c.viewportAxes[2]);c=l.a.dot(g.globalToLocalSpatial(C,c.centerDataPosition),k);a.uniform3fv(d.uniform("uPlaneNormal"),k);a.uniform1f(d.uniform("uPlaneDistance"),c);k=b(k);a.uniform2iv(d.uniform("uVertexIndex"),this.data.vertexIndices.subarray(48*k,48*(k+1)));a.uniformMatrix4fv(d.uniform("uProjectionMatrix"),!1,l.b.multiply(A,e,g.transform));a.uniform3fv(d.uniform("uVoxelSize"),f.voxelSize);a.uniform3fv(d.uniform("uLowerClipBound"),f.lowerClipBound);a.uniform3fv(d.uniform("uUpperClipBound"),f.upperClipBound)}},
{key:"setupChunkDataSize",value:function(a,b,d){a.uniform3fv(b.uniform("uChunkDataSize"),d)}},{key:"drawChunk",value:function(a,b,d){a.uniform3fv(b.uniform("uTranslation"),d);a.drawArrays(a.TRIANGLE_FAN,0,6)}}]);return f}(g.a),F=function(b){function g(a,b){b=void 0===b?{}:b;var d=void 0===b.shaderError?c.i(p.a)():b.shaderError,k=void 0===b.volumeSourceOptions?{}:b.volumeSourceOptions;m(this,g);b=e(this,(g.__proto__||Object.getPrototypeOf(g)).call(this));b.sources=null;b.shader=void 0;b.shaderUpdated=
!0;b.rpcId=null;b.shaderError=d;d.value=void 0;b.chunkManager=a.chunkManager;b.vertexComputationManager=D.get(b.gl);d=b.sources=a.getSources(k);a=[];d=$jscomp.makeIterator(d);for(k=d.next();!k.done;k=d.next()){var t=k.value,k=[];a.push(k);for(var t=$jscomp.makeIterator(t),r=t.next();!r.done;r=t.next())k.push(r.value.rpcId)}d=b.registerDisposer(new v.b);d.RPC_TYPE_ID=f.e;d.initializeCounterpart(b.chunkManager.rpc,{sources:a});b.rpcId=d.rpcId;a=b.sources[0][0].spec;d=a.chunkLayout;k=b.voxelSize=d.localSpatialVectorToGlobal(l.a.create(),
a.voxelSize);for(t=0;3>t;++t)k[t]=Math.abs(k[t]);k=b.boundingBox=new l.p(l.a.fromValues(Infinity,Infinity,Infinity),l.a.fromValues(-Infinity,-Infinity,-Infinity));t=l.a.create();for(r=0;8>r;++r){for(var u=0;3>u;++u)y[u]=r&1<<u?a.upperClipBound[u]:a.lowerClipBound[u];d.localSpatialToGlobal(t,y);l.a.min(k.lower,k.lower,t);l.a.max(k.upper,k.upper,t)}b.setReady(!0);return b}a(g,b);B(g,[{key:"initializeShader",value:function(){if(this.shaderUpdated){this.shaderUpdated=!1;try{var a=this.getShader();this.disposeShader();
this.shader=a;this.shaderError.value=null}catch(I){this.shaderError.value=I}}}},{key:"disposeShader",value:function(){this.shader&&(this.shader.dispose(),this.shader=void 0)}},{key:"disposed",value:function(){t(g.prototype.__proto__||Object.getPrototypeOf(g.prototype),"disposed",this).call(this);this.disposeShader()}},{key:"getValueAt",value:function(a){for(var b=$jscomp.makeIterator(this.sources),d=b.next();!d.done;d=b.next())for(var d=$jscomp.makeIterator(d.value),c=d.next();!c.done;c=d.next())if(c=
c.value.getValueAt(a),null!=c)return c;return null}},{key:"getShaderKey",value:function(){return""}},{key:"getShader",value:function(){var a=this,b=this.getShaderKey()+"/"+this.chunkFormat.shaderKey;return this.gl.memoize.get(b,function(){return a.buildShader()})}},{key:"buildShader",value:function(){var a=new r.a(this.gl);this.defineShader(a);return a.build()}},{key:"defineShader",value:function(a){this.vertexComputationManager.defineShader(a);a.addFragmentCode("\nvoid emit(vec4 color) {\n  gl_FragData[0] = color;\n}\n");
this.chunkFormat.defineShader(a);a.addFragmentCode("\n"+c.i(k.c)(this.dataType)+" getDataValue() { return getDataValue(0); }\n")}},{key:"beginSlice",value:function(a){a=this.gl;var b=this.shader;b.bind();this.vertexComputationManager.beginSlice(a,b);return b}},{key:"endSlice",value:function(a){this.vertexComputationManager.endSlice(this.gl,a)}},{key:"draw",value:function(a){var b=a.visibleLayers.get(this);if(0!==b.length&&(this.initializeShader(),void 0!==this.shader)){var c=this.gl,e=l.a.create(),
f=this.beginSlice(a),g=this.vertexComputationManager,k=this.chunkFormat;k.beginDrawing(c,f);for(var t={},b=$jscomp.makeIterator(b),p=b.next();!p.done;t={chunkDataSize:t.chunkDataSize},p=b.next()){var r=p.value,u=r.spec.chunkLayout,p=r.chunks,h=u.size;t.chunkDataSize=void 0;var v=a.visibleChunks.get(u);if(v){g.beginSource(c,f,a,a.dataToDevice,r.spec);r=r.chunkFormat;r.beginSource(c,f);for(var u=function(a){return function(b){a.chunkDataSize=b;g.setupChunkDataSize(c,f,a.chunkDataSize)}}(t),v=$jscomp.makeIterator(v),
z=v.next();!z.done;z=v.next())if((z=p.get(z.value))&&z.state===d.b.GPU_MEMORY){var m=z.chunkDataSize;m!==t.chunkDataSize&&u(m);l.a.multiply(e,h,z.chunkGridPosition);r.bindChunk(c,f,z);g.drawChunk(c,f,e)}}}k.endDrawing(c,f);this.endSlice(f)}}},{key:"gl",get:function(){return this.chunkManager.chunkQueueManager.gl}},{key:"chunkFormat",get:function(){return this.sources[0][0].chunkFormat}},{key:"dataType",get:function(){return this.sources[0][0].spec.dataType}}]);return g}(n.f)},function(n,h,c){var m=
c(15),e=c(2);h.a=function(a){return new m.b(void 0===a?.5:a,e.l)}},function(n,h,c){function m(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function e(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function a(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&
b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function b(a,b){var d="";b&1&&(d+="control+");b&2&&(d+="alt+");b&4&&(d+="meta+");b&8&&(d+="shift+");return d+a}function d(a){a=a.toLowerCase().replace(" ","");for(var d=a.split("+"),c,e=0,d=$jscomp.makeIterator(d),f=d.next();!f.done;f=d.next())switch(f=f.value,f){case "control":e|=1;break;case "alt":e|=2;break;case "meta":e|=4;break;case "shift":e|=8;break;
default:c=void 0===c?f:null}if(null==c)throw Error("Invalid stroke "+JSON.stringify(a));return b(c,e)}function f(a,b){function d(d,v){for(;;)switch(c){case 0:b=void 0===b?[]:b,h=$jscomp.makeIterator(a),u=h.next();case 1:if(u.done){c=3;break}r=u.value;p=$jscomp.makeIterator(r);t=p.next().value;l=p.next().value;k=[].concat($jscomp.arrayFromIterable(b),[t]);if("string"!==typeof l){c=4;break}c=6;return{value:[k,l],done:!1};case 6:if(void 0===v){c=7;break}c=-1;throw v;case 7:c=5;break;case 4:g=$jscomp.makeIterator(f(l,
k));case 8:if((e=g.next(d)).done){c=9;break}c=10;return{value:e.value,done:!1};case 10:if(void 0===v){c=11;break}c=-1;throw v;case 11:c=8;break;case 9:case 5:case 2:u=h.next();c=1;break;case 3:c=-1;default:return{value:void 0,done:!0}}}var c=0,e,g,k,l,t,p,r,u,h,v={next:function(a){return d(a,void 0)},throw:function(a){return d(void 0,a)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();v[Symbol.iterator]=function(){return this};return v}function g(a,b,d){void 0===
x&&(x=new v(window,new B,function(){return!1}));y.push([x.keySequenceMap,x.handler,C]);x.setKeySequenceMap(a);x.handler=b;C=d}function l(){var a=$jscomp.makeIterator(y.pop()),b=a.next().value,d=a.next().value,a=a.next().value;x.setKeySequenceMap(b);x.handler=d;C=a}n=c(0);c.d(h,"c",function(){return v});c.d(h,"a",function(){return B});c.d(h,"b",function(){return A});var u=function F(a,b,d){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,b);if(void 0===c){if(a=Object.getPrototypeOf(a),
null!==a)return F(a,b,d)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(d)}},p=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),r=new Set("f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 escape pause".split(" ")),k=new Set("color date datetime datetime-local email month number password search tel text time url week".split(" ")),
v=function(d){function c(a,b,d){m(this,c);var f=e(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));f.target=a;f.keySequenceMap=b;f.handler=d;f.modifierShortcutsAreGlobal=!0;f.allShortcutsAreGlobal=!1;f.allowSpaceKeyOnButtons=!1;f.reset();f.registerEventListener(a,"keydown",f.handleKeyDown.bind(f),!0);return f}a(c,d);p(c,[{key:"reset",value:function(){this.currentNode=this.keySequenceMap.root;this.lastStrokeTime=Number.NEGATIVE_INFINITY}},{key:"setKeySequenceMap",value:function(a){this.keySequenceMap=
a;this.reset()}},{key:"shouldIgnoreEvent",value:function(a,b){var d=b.target,c=d.tagName;if(d===this.target)return!1;var e="TEXTAREA"===c||"INPUT"===c||"BUTTON"===c||"SELECT"===c,f=!e&&(d.isContentEditable||d.ownerDocument&&"on"===d.ownerDocument.designMode);return!e&&!f||this.allShortcutsAreGlobal||r.has(a)?!1:f||this.modifierShortcutsAreGlobal&&(b.altKey||b.ctrlKey||b.metaKey)?!0:"INPUT"===c&&k.has(d.type)?"enter"!==a:"INPUT"===c||"BUTTON"===c?this.allowSpaceKeyOnButtons?!1:"space"===a:!0}},{key:"handleKeyDown",
value:function(a){var d=a.code.toLowerCase();if(!this.shouldIgnoreEvent(d,a)){var d=b(d,(a.ctrlKey?1:0)|(a.altKey?2:0)|(a.metaKey?4:0)|(a.shiftKey?8:0)),c=this.keySequenceMap.root,e=this.currentNode,f=e.get(d),g=Date.now();e!==c&&(void 0===f||g>this.lastStrokeTime+1500)&&(this.currentNode=c,f=e.get(d));void 0!==f&&("string"===typeof f?(this.reset(),this.handler(f)&&a.preventDefault()):(this.currentNode=f,this.lastStrokeTime=g,a.preventDefault()))}}}]);return c}(n.a),t;(function(a){a[a.CONTROL=1]=
"CONTROL";a[a.ALT=2]="ALT";a[a.META=4]="META";a[a.SHIFT=8]="SHIFT"})(t||(t={}));var B=function(){function a(b){m(this,a);this.root=new Map;void 0!==b&&this.bindMultiple(b)}p(a,[{key:"bind",value:function(a,b){"string"===typeof a&&(a=a.replace(/[ +]*\+[ +]*/g,"+").replace(/[ ]+/g," ").toLowerCase().split(" "));a=a.map(d);if(0===a.length)throw Error("Key sequence must not be empty");for(var c=this.root,e=a.length-1,f=0;f<e;++f){var g=a[f],k=c.get(g);void 0===k&&(k=new Map,c.set(g,k));if("string"===
typeof k)throw Error("Error binding key sequence "+JSON.stringify(a.join(" "))+": prefix "+JSON.stringify(a.slice(0,f+1).join(" "))+" is already bound to action "+JSON.stringify(k));c=k}e=a[e];f=c.get(e);if(void 0!==f)throw Error("Key sequence "+JSON.stringify(a.join(" "))+" is already bound to action "+JSON.stringify(f));c.set(e,b)}},{key:"bindMultiple",value:function(a){for(var b=$jscomp.makeIterator(Object.keys(a)),d=b.next();!d.done;d=b.next())d=d.value,this.bind(d,a[d])}},{key:"entries",value:function(){return f(this.root)}}]);
return a}(),x,y=[],C,A=function(b){function d(a,b){m(this,d);var c=e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));c.keySequenceMap=a;c.handler=b;g(a,b,c);return c}a(d,b);p(d,[{key:"disposed",value:function(){var a=this;if(C===this)l();else{var b=y.findIndex(function(b){return b[2]===a});y.splice(b,1)}u(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"disposed",this).call(this)}}]);return d}(n.a)},function(n,h,c){function m(a){var b=f.get(a),c=a.changed.count;if(void 0!==b&&b.generation===
c)return b;var e;if(a instanceof d){e=a.baseJSON();for(var g=$jscomp.makeIterator(a.children),k=g.next();!k.done;k=g.next()){var h=$jscomp.makeIterator(k.value),k=h.next().value,h=h.next().value;e[k]=m(h).value}}else e=a.toJSON();void 0===b?(b={generation:c,value:e},f.set(a,b)):(b.generation=c,b.value=e);return b}var e=c(3),a=c(2);c.d(h,"b",function(){return d});h.a=m;var b=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&
(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),d=function(){function d(){if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");this.children=new Map;this.changed=new e.a}b(d,[{key:"add",value:function(a,b){var d=this;if(this.children.has(a))throw Error("Key "+JSON.stringify(a)+" already registered.");this.children.set(a,b);b.changed.add(this.changed.dispatch);this.changed.dispatch();return function(){d.remove(a)}}},
{key:"remove",value:function(a){var b=this.children;if(b.has(a))throw Error("Key "+JSON.stringify(a)+" not registered.");b=b.get(a);this.children.delete(a);b.changed.remove(this.changed.dispatch);this.changed.dispatch()}},{key:"dispose",value:function(){for(var a=this.changed,b=$jscomp.makeIterator(this.children.values()),d=b.next();!d.done;d=b.next())d.value.changed.remove(a.dispatch);this.children=void 0}},{key:"toJSON",value:function(){for(var a=this.baseJSON(),b=$jscomp.makeIterator(this.children),
d=b.next();!d.done;d=b.next()){var c=$jscomp.makeIterator(d.value),d=c.next().value,c=c.next().value;a[d]=c.toJSON()}return a}},{key:"baseJSON",value:function(){return{}}},{key:"reset",value:function(){for(var a=$jscomp.makeIterator(this.children.values()),b=a.next();!b.done;b=a.next())b.value.reset()}},{key:"restoreState",value:function(b){c.i(a.a)(b);for(var d=$jscomp.makeIterator(this.children),e=d.next();!e.done;e=d.next()){var f=$jscomp.makeIterator(e.value),e=f.next().value,f=f.next().value;
try{b.hasOwnProperty(e)&&f.restoreState(b[e])}catch(k){throw Error("Error restoring property "+JSON.stringify(e)+": "+k.message);}}}}]);return d}(),f=new WeakMap},function(n,h,c){function m(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}n=c(0);
var e=c(3);c.d(h,"a",function(){return b});var a=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),b=function(b){function d(){if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");var a;a=(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
a=!a||"object"!==typeof a&&"function"!==typeof a?this:a;a.count=0;a.dependencies=new Map;a.signChanged=new e.b;return a}m(d,b);a(d,[{key:"inc",value:function(){1===++this.count&&this.signChanged.dispatch(1)}},{key:"dec",value:function(){0===--this.count&&this.signChanged.dispatch(0)}},{key:"addDependency",value:function(a){var b=this.dependencies,d=b.get(a);void 0!==d?d.refCount+=1:(b.set(a,{refCount:1,unregister:this.signChanged.add(function(b){return b?a.inc():a.dec()})}),0<this.count&&a.inc())}},
{key:"removeDependency",value:function(a){var b=this.dependencies,d=b.get(a);if(void 0===d)throw Error("Attempted to remove non-existing dependency.");0===--d.refCount&&(b.delete(a),d.unregister(),this.count&&a.dec())}},{key:"disposed",value:function(){for(var a=this.count,b=$jscomp.makeIterator(this.dependencies),d=b.next();!d.done;d=b.next()){var d=$jscomp.makeIterator(d.value),c=d.next().value;d.next().value.unregister();a&&c.dec()}this.dependencies.clear()}},{key:"value",get:function(){return this.count}}]);
return d}(n.a)},function(n,h,c){function m(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function e(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function a(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,
writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}n=c(0);var b=c(1),d=c(23),f=c(46),g=c(47),l=c(73);c.d(h,"c",function(){return k});h.b=function(a,b,d,c){d=void 0===d?a.RGBA:d;c=void 0===c?a.UNSIGNED_BYTE:c;for(var e=[],f=0;f<b;++f)e[f]=new B(a,d,c);return e};c.d(h,"a",function(){return y});c.d(h,"d",function(){return C});var u=function D(a,b,d){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,b);if(void 0===c){if(a=Object.getPrototypeOf(a),
null!==a)return D(a,b,d)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(d)}},p=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),r=function(b){function d(){m(this,d);var a=e(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments));a.width=Number.NaN;a.height=Number.NaN;
return a}a(d,b);p(d,[{key:"hasSize",value:function(a,b){return this.width===a&&this.height===b}},{key:"resize",value:function(a,b){this.hasSize(a,b)||(this.width=a,this.height=b,this.performResize())}}]);return d}(n.a),k=function(b){function d(a,b){b=void 0===b?!1:b;m(this,d);var c=e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,a,b?a.DEPTH_STENCIL:a.DEPTH_COMPONENT16));c.gl=a;c.includeStencilBuffer=b;return c}a(d,b);p(d,[{key:"attachToFramebuffer",value:function(){var a=this.gl;u(d.prototype.__proto__||
Object.getPrototypeOf(d.prototype),"attachToFramebuffer",this).call(this,this.includeStencilBuffer?a.DEPTH_STENCIL_ATTACHMENT:a.DEPTH_ATTACHMENT)}}]);return d}(function(b){function d(a,b){m(this,d);var c=e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));c.gl=a;c.internalformat=b;c.renderbuffer=null;c.renderbuffer=a.createRenderbuffer();return c}a(d,b);p(d,[{key:"performResize",value:function(){var a=this.gl;a.bindRenderbuffer(a.RENDERBUFFER,this.renderbuffer);a.renderbufferStorage(a.RENDERBUFFER,
this.internalformat,this.width,this.height);a.bindRenderbuffer(a.RENDERBUFFER,null)}},{key:"disposed",value:function(){this.gl.deleteRenderbuffer(this.renderbuffer)}},{key:"attachToFramebuffer",value:function(a){var b=this.gl;b.framebufferRenderbuffer(b.FRAMEBUFFER,a,b.RENDERBUFFER,this.renderbuffer)}}]);return d}(r)),v=function(b){function d(a){m(this,d);return e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,a,!0))}a(d,b);return d}(k);h.e=v;var t=function(b){function d(a){m(this,d);var b=
e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));b.gl=a;b.framebuffer=b.gl.createFramebuffer();return b}a(d,b);p(d,[{key:"disposed",value:function(){this.gl.deleteFramebuffer(this.framebuffer)}},{key:"bind",value:function(){var a=this.gl;a.bindFramebuffer(a.FRAMEBUFFER,this.framebuffer)}},{key:"unbind",value:function(){var a=this.gl;a.bindFramebuffer(a.FRAMEBUFFER,null)}}]);return d}(n.a),B=function(b){function d(a,b,c){m(this,d);var f=e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));
f.gl=a;f.format=b;f.dataType=c;f.texture=a.createTexture();return f}a(d,b);p(d,[{key:"performResize",value:function(){c.i(g.a)(this.gl,this.texture,this.width,this.height,this.format,this.dataType)}},{key:"disposed",value:function(){this.gl.deleteTexture(this.texture)}},{key:"attachToFramebuffer",value:function(a){var b=this.gl;b.framebufferTexture2D(b.FRAMEBUFFER,a,b.TEXTURE_2D,this.texture,0)}}]);return d}(r),x=new Uint8Array(4),y=function(b){function d(a,b){m(this,d);var c=e(this,(d.__proto__||
Object.getPrototypeOf(d)).call(this));c.gl=a;c.width=Number.NaN;c.height=Number.NaN;c.fullAttachmentList=[];c.attachmentVerified=!1;c.singleAttachmentList=[c.gl.COLOR_ATTACHMENT0];var f=void 0===b.framebuffer?new t(a):b.framebuffer,g=b.colorBuffers;b=b.depthBuffer;c.framebuffer=c.registerDisposer(f);c.colorBuffers=g;c.depthBuffer=b;void 0!==b&&c.registerDisposer(b);var k=c.fullAttachmentList;g.forEach(function(b,d){c.registerDisposer(b);k[d]=a.COLOR_ATTACHMENT0+d});return c}a(d,b);p(d,[{key:"hasSize",
value:function(a,b){return this.width===a&&this.height===b}},{key:"bind",value:function(a,b){this.width=a;this.height=b;this.framebuffer.bind();var d=this.gl,c=this.depthBuffer;void 0!==c&&(c.resize(a,b),c.attachToFramebuffer());this.colorBuffers.forEach(function(c,e){c.resize(a,b);c.attachToFramebuffer(d.COLOR_ATTACHMENT0+e)});d.WEBGL_draw_buffers.drawBuffersWEBGL(this.fullAttachmentList);this.verifyAttachment();d.viewport(0,0,a,b)}},{key:"bindSingle",value:function(a){var b=this.gl;this.framebuffer.bind();
0!==a&&b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0+a,b.TEXTURE_2D,null,0);b.bindTexture(b.TEXTURE_2D,null);this.colorBuffers[a].attachToFramebuffer(b.COLOR_ATTACHMENT0);b.WEBGL_draw_buffers.drawBuffersWEBGL(this.singleAttachmentList)}},{key:"unbind",value:function(){this.framebuffer.unbind()}},{key:"readPixel",value:function(a,b,d){var c=this.gl;try{this.bindSingle(a),c.readPixels(b,d,1,1,c.RGBA,c.UNSIGNED_BYTE,x)}finally{this.framebuffer.unbind()}return x}},{key:"readPixelAsUint32",
value:function(a,b,d){a=this.readPixel(a,b,d);return a[0]+(a[1]<<8)+(a[2]<<16)+(a[3]<<24)}},{key:"verifyAttachment",value:function(){if(!this.attachmentVerified){var a=this.gl;if(a.checkFramebufferStatus(a.FRAMEBUFFER)!==a.FRAMEBUFFER_COMPLETE)throw Error("Framebuffer configuration not supported");this.attachmentVerified=!0}}}]);return d}(n.a),C=function(g){function k(a,b){m(this,k);var d=e(this,(k.__proto__||Object.getPrototypeOf(k)).call(this));d.gl=a;d.shader=b;d.copyVertexPositionsBuffer=c.i(f.a)(d.gl);
d.copyTexCoordsBuffer=c.i(f.a)(d.gl,0,0,1,1);d.registerDisposer(b);return d}a(k,g);p(k,[{key:"draw",value:function(a){for(var d=[],c=0;c<arguments.length;++c)d[c-0]=arguments[c];var c=this.gl,e=this.shader;e.bind();for(var f=d.length,g=0;g<f;++g)c.activeTexture(c.TEXTURE0+g),c.bindTexture(c.TEXTURE_2D,d[g]);c.uniformMatrix4fv(e.uniform("uProjectionMatrix"),!1,b.g);d=e.attribute("aVertexPosition");this.copyVertexPositionsBuffer.bindToVertexAttrib(d,2);e=e.attribute("aTexCoord");this.copyTexCoordsBuffer.bindToVertexAttrib(e,
2);c.drawArrays(c.TRIANGLE_FAN,0,4);c.disableVertexAttribArray(d);c.disableVertexAttribArray(e);for(d=0;d<f;++d)c.activeTexture(c.TEXTURE0+d),c.bindTexture(c.TEXTURE_2D,null)}}],[{key:"get",value:function(a,b,e){b=void 0===b?l.a:b;e=void 0===e?1:e;return a.memoize.get("OffscreenCopyHelper:"+e+":"+c.i(d.a)(b),function(){return new k(a,c.i(l.b)(a,b,e))})}}]);return k}(n.a)},function(n,h,c){function m(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}var e=c(68),a=c(29),
b=c(24),d=c(6),f=c(47);c.d(h,"c",function(){return l});h.b=function(d,c,e){e=void 0===e?1:e;switch(c){case a.b.UINT8:if(1>e||4<e)break;d.texelsPerElement=1;d.textureFormat=u[e];d.texelType=b.j;d.arrayElementsPerTexel=e;d.arrayConstructor=Uint8Array;return d;case a.b.UINT16:if(1>e||2<e)break;d.texelsPerElement=1;d.textureFormat=u[2*e];d.texelType=b.j;d.arrayElementsPerTexel=2*e;d.arrayConstructor=Uint8Array;return d;case a.b.UINT64:if(1!==e)break;d.texelsPerElement=2;d.textureFormat=b.i;d.texelType=
b.j;d.arrayElementsPerTexel=4;d.arrayConstructor=Uint8Array;return d;case a.b.UINT32:if(1!==e)break;d.texelsPerElement=1;d.textureFormat=b.i;d.texelType=b.j;d.arrayElementsPerTexel=4;d.arrayConstructor=Uint8Array;return d;case a.b.FLOAT32:if(!(1>e||4<e))return d.texelsPerElement=1,d.textureFormat=u[e],d.texelType=b.e,d.arrayElementsPerTexel=e,d.arrayConstructor=Float32Array,d}throw Error("No supported texture format for "+a.b[c]+"["+e+"].");};h.f=function(a,b,d,c,e,f){b=b.maxTextureSize;var g=c*e*
f;if(!(d*c<=b&&e*f<=b))if(d*c*e<=b&&f<=b)c*=e;else if(c=Math.ceil(g/b),c*d>b)throw Error("Chunk data size exceeds maximum texture size: "+d+" * "+g);d=Math.ceil(g/c);a.dataWidth=c;a.textureHeight=d;a.textureAccessCoefficients=Float32Array.of(1/c,1/(c*d))};h.a=function(a,b,d,c){var e=b.maxTextureSize;b=Math.ceil(c/e);if(b*d>e)throw Error("Number of elements exceeds maximum texture size: "+d+" * "+c);d=Math.ceil(c/b);a.dataWidth=b;a.textureHeight=d;a.textureAccessCoefficients=Float32Array.of(1/b,1/
(b*d))};h.e=function(a,d,g,l){var k=g.arrayConstructor,p=g.textureFormat,t=g.texelsPerElement,r=d.dataWidth;d=d.textureHeight;var u=r*d*g.arrayElementsPerTexel*t;l.constructor!==k&&(l=new k(l.buffer,l.byteOffset,l.byteLength/k.BYTES_PER_ELEMENT));l=c.i(e.b)(l,u);a.pixelStorei(b.k,1);c.i(f.b)(a);a.texImage2D(a.TEXTURE_2D,0,p,r*t,d,0,p,g.texelType,l)};c.d(h,"d",function(){return r});var g=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=
!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),l=function v(){m(this,v)},u=[-1,b.f,b.g,b.h,b.i],p=["","r","ra","rgb","rgba"],r=function(){function b(a){m(this,b);this.key=a;this.uniformName="uTextureAccessCoefficients_"+this.key;this.readTextureValue="readTextureValue_"+this.key}g(b,[{key:"defineShader",value:function(a){a.addUniform("highp vec2",this.uniformName)}},{key:"getReadTextureValueCode",value:function(a){for(var b=
this.uniformName,d="\nvoid "+this.readTextureValue+"(highp sampler2D sampler, float index",c=0;c<a;++c)d+=", out vec4 output"+c;d+=") {\n  index += "+.5/a+";\n  vec2 texCoords = vec2(fract(index * "+b+".x),\n                        index * "+b+".y);\n";for(c=0;c<a;++c)d+="\n  output"+c+" = texture2D(sampler, vec2(texCoords.x + "+b+".x * "+(c/a).toFixed(8)+", texCoords.y));\n";return d+"\n}\n"}},{key:"getAccessor",value:function(b,e,f,g){g=void 0===g?1:g;var l=c.i(d.c)(f,g),r=[];r.push(this.getReadTextureValueCode(f===
a.b.UINT64?2:1));b="\n"+l+" "+b+"(float index) {\n";switch(f){case a.b.UINT8:r.push(d.h);b+="\n  "+l+" result;\n  vec4 temp;\n  "+this.readTextureValue+"("+e+", index, temp);\n  result.value = temp."+p[g]+";\n  return result;\n";break;case a.b.UINT16:r.push(d.i);b+="\n  "+l+" result;\n  vec4 temp;\n  "+this.readTextureValue+"("+e+", index, temp);\n  result.value = temp."+p[2*g]+";\n  return result;\n";break;case a.b.UINT32:r.push(d.j);b+="\n  "+l+" result;\n  "+this.readTextureValue+"("+e+", index, result.value);\n  return result;\n";
break;case a.b.UINT64:r.push(d.e);b+="\n  "+l+" result;\n  "+this.readTextureValue+"("+e+", index, result.low, result.high);\n  return result;\n";break;case a.b.FLOAT32:r.push(d.k),b+="\n  vec4 temp;\n  "+this.readTextureValue+"("+e+", index, temp);\n  return temp."+p[g]+";\n"}r.push(b+"\n}\n");return r}},{key:"setupTextureLayout",value:function(a,b,d){a.uniform2fv(b.uniform(this.uniformName),d.textureAccessCoefficients)}}]);return b}()},function(n,h,c){var m=c(0),e=c(17),a=c(24);h.a=function(b,d,
c,g,l){d=void 0===d?-1:d;c=void 0===c?-1:c;g=void 0===g?1:g;l=void 0===l?1:l;return b.memoize.get("SquareCornersBuffer:"+d+","+c+","+g+","+l,function(){return new m.b(e.a.fromData(b,new Float32Array([d,c,d,l,g,l,g,c]),a.c,a.d))}).value}},function(n,h,c){function m(c){c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE)}
h.b=m;h.a=function(c,a,b,d,f,g){f=void 0===f?c.RGBA:f;g=void 0===g?c.UNSIGNED_BYTE:g;c.activeTexture(c.TEXTURE0+c.tempTextureUnit);c.bindTexture(c.TEXTURE_2D,a);m(c);c.texImage2D(c.TEXTURE_2D,0,f,b,d,0,f,g,null);c.bindTexture(c.TEXTURE_2D,null)}},function(n,h,c){function m(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function e(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}n=c(153);c.n(n);n=c(76);var a=c.n(n);n=c(20);var b=c.n(n);n=c(0);var d=c(10);c.d(h,"a",function(){return l});var f=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&
a(b.prototype,d);c&&a(b,c);return b}}(),g=function p(a,b,d){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,b);if(void 0===c){if(a=Object.getPrototypeOf(a),null!==a)return p(a,b,d)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(d)}};c(176);c(155);c(154);c(183)(a.a);var l=function(l){function r(d){if(!(this instanceof r))throw new TypeError("Cannot call a class as a function");var c=m(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));c.state=
d;c.changingValue=!1;c.debouncedValueUpdater=b()(function(){c.changingValue=!0;try{c.state.fragmentMain.value=c.textEditor.getValue()}finally{c.changingValue=!1}},500);c.textEditor=a()(function(a){},{value:c.state.fragmentMain.value,mode:"glsl",gutters:["CodeMirror-lint-markers"]});c.textEditor.on("change",function(){c.setValidState(void 0);c.debouncedValueUpdater()});c.registerDisposer(c.state.fragmentMain.changed.add(function(){c.changingValue||c.textEditor.setValue(c.state.fragmentMain.value)}));
c.element.classList.add("neuroglancer-shader-code-widget");c.registerDisposer(c.state.shaderError.changed.add(function(){c.updateErrorState()}));c.updateErrorState();return c}e(r,l);f(r,[{key:"updateErrorState",value:function(){var b=this,d=this.state.shaderError.value;void 0===d?this.setValidState(void 0):null!==d?(this.textEditor.setOption("lint",{getAnnotations:function(){if("ShaderCompilationError"===d.name){var c=d.source.split("\n").indexOf(b.state.fragmentMainStartLine)+2;return d.errorMessages.map(function(b){return{message:b.message,
severity:"error",from:a.a.Pos(void 0===b.line?0:b.line-c)}})}return"ShaderLinkError"===d.name?[{message:d.log,severity:"error",from:a.a.Pos(0)}]:[{message:d.message,severity:"error",from:a.a.Pos(0)}]}}),this.setValidState(!1)):(this.textEditor.setOption("lint",void 0),this.setValidState(!0))}},{key:"setValidState",value:function(a){var b=this.element;b.classList.remove("invalid-input");b.classList.remove("valid-input");!0===a?b.classList.add("valid-input"):!1===a&&b.classList.add("invalid-input")}},
{key:"disposed",value:function(){this.debouncedValueUpdater.flush();this.debouncedValueUpdater=void 0;c.i(d.b)(this.element);this.textEditor=void 0;g(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),"disposed",this).call(this)}},{key:"element",get:function(){return this.textEditor.getWrapperElement()}}]);return r}(n.a)},function(n,h){n.exports=function(c){var h=typeof c;return null!=c&&("object"==h||"function"==h)}},function(n,h){n.exports="\n\nvec3 colormapJet(float x) {\n  vec3 result;\n  result.r = x < 0.89 ? ((x - 0.35) / 0.31) : (1.0 - (x - 0.89) / 0.11 * 0.5);\n  result.g = x < 0.64 ? ((x - 0.125) * 4.0) : (1.0 - (x - 0.64) / 0.27);\n  result.b = x < 0.34 ? (0.5 + x * 0.5 / 0.11) : (1.0 - (x - 0.34) / 0.31);\n  return clamp(result, 0.0, 1.0);\n}\n"},
function(n,h,c){function m(a){c.i(y.a)(a);var b=c.i(y.d)(a,"neariso_voxelres",function(a){return c.i(y.r)(a,y.o)}),d=c.i(y.d)(a,"neariso_imagesize",function(a){return c.i(y.r)(a,y.n)}),e=c.i(y.d)(a,"neariso_offset",function(a){return c.i(y.r)(a,y.m)});return c.i(y.d)(a,"resolutions",function(a){return c.i(y.k)(a,y.u)}).map(function(a){var c=""+a,f=b.get(c),g=d.get(c),k=e.get(c);if(void 0===f||void 0===g||void 0===k)throw Error("Missing neariso_voxelres/neariso_imagesize/neariso_offset for resolution "+
a+".");return{key:c,voxelSize:f,imageSize:g,voxelOffset:k}})}function e(a){a=A.get(a);void 0===a&&(a=k.a.UNKNOWN);return a}function a(a){c.i(y.a)(a);var b=c.i(y.d)(a,"channel_type",y.h);return{channelType:b,description:c.i(y.d)(a,"description",y.h),volumeType:e(b),dataType:c.i(y.d)(a,"datatype",function(a){return c.i(y.p)(a,k.b)})}}function b(b){c.i(y.a)(b);return{channels:c.i(y.d)(b,"channels",function(b){return c.i(y.r)(b,a)}),scales:c.i(y.d)(b,"dataset",m)}}function d(a,d,e,f){return a.memoize.getUncounted({type:"ndstore:getTokenInfo",
hostnames:d,token:e},function(){return c.i(x.a)(c.i(x.b)(d,f+"/"+e+"/info/"),"json").then(b)})}function f(a,b,e,f){var g=e.match(z);if(null===g)throw Error("Invalid volume path "+JSON.stringify(e));var k=g[1],l=g[2],r=c.i(y.x)(g[3]||"");return a.memoize.getUncounted({type:"ndstore:MultiscaleVolumeChunkSource",hostnames:b,path:e},function(){return d(a,b,k,f).then(function(d){return new G(a,b,k,d,l,f,r)})})}function g(a,b){var d=b.match(L);if(null===d)throw Error("Invalid ndstore volume path: "+JSON.stringify(b));
return f(a,[d[1]],d[2],r.c)}function l(a,b,d){return a.memoize.getUncounted({type:"dvid:getPublicTokens",hostnames:b},function(){return c.i(x.a)(c.i(x.b)(b,d+"/public_tokens/"),"json").then(function(a){return c.i(y.k)(a,y.h)})})}function u(a,b,e,f){var g=e.match(/^(?:([^\/]+)(?:\/([^\/]*))?)?$/);if(null===g)return Promise.reject(null);if(void 0===g[2]){var r=g[1]||"";return l(a,b,f).then(function(a){return{offset:0,completions:c.i(t.b)(r,a,function(a){return a+"/"},function(){})}})}return d(a,b,g[1],
f).then(function(a){a=c.i(t.b)(g[2],a.channels,function(a){return a[0]},function(a){return a[1].channelType+" ("+k.b[a[1].dataType]+")"});return{offset:g[1].length+1,completions:a}})}function p(a,b){var d=a.match(L);return null===d?Promise.reject(null):u(b,[d[1]],d[2],r.c).then(function(a){return c.i(t.a)(d[1].length+1,a)})}Object.defineProperty(h,"__esModule",{value:!0});n=c(8);var r=c(55),k=c(4),v=c(5),t=c(28),B=c(1),x=c(22),y=c(2);c.d(h,"MultiscaleVolumeChunkSource",function(){return G});h.getTokenInfo=
d;h.getShardedVolume=f;h.getVolume=g;h.getPublicTokens=l;h.tokenAndChannelCompleter=u;h.volumeCompleter=p;var C=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),A=new Map;A.set("image",k.a.IMAGE);A.set("annotation",k.a.SEGMENTATION);var D=new Set(["npz","raw","jpeg"]),F=c.i(v.e)(r.b),G=function(){function a(b,
d,e,f,g,l,p){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");this.chunkManager=b;this.baseUrls=d;this.key=e;this.tokenInfo=f;this.parameters=p;this.urlPrefix=r.c;this.neariso=!0;if(void 0===g){g=Array.from(f.channels.keys());if(1!==g.length)throw Error("Dataset contains multiple channels: "+JSON.stringify(g));g=g[0]}b=f.channels.get(g);if(void 0===b)throw Error("Specified channel "+JSON.stringify(g)+" is not one of the supported channels "+JSON.stringify(Array.from(f.channels.keys())));
this.channel=g;this.channelInfo=b;this.scales=f.scales;void 0!==l&&(this.urlPrefix=l);"false"===c.i(y.e)(p.neariso)&&(this.neariso=!1);f=c.i(y.e)(p.encoding);if(void 0===f)f=this.volumeType===k.a.IMAGE?"jpeg":"npz";else if(!D.has(f))throw Error("Invalid encoding: "+JSON.stringify(f)+".");this.encoding=f}C(a,[{key:"getSources",value:function(a){var b=this;return this.scales.map(function(d){for(var c=d.voxelOffset,e=d.voxelSize,f=B.a.create(),g=0;3>g;++g)f[g]=Math.ceil(c[g]);return k.f.getDefaults({numChannels:b.numChannels,
volumeType:b.volumeType,dataType:b.dataType,voxelSize:e,transform:B.b.fromTranslation(B.b.create(),B.a.multiply(B.a.create(),c,e)),baseVoxelOffset:f,upperVoxelBound:d.imageSize,volumeSourceOptions:a}).map(function(a){return F.get(b.chunkManager,a,{baseUrls:b.baseUrls,urlPrefix:b.urlPrefix,key:b.key,channel:b.channel,resolution:d.key,encoding:b.encoding,neariso:b.neariso})})})}},{key:"getMeshSource",value:function(){return null}},{key:"dataType",get:function(){return this.channelInfo.dataType}},{key:"numChannels",
get:function(){return 1}},{key:"volumeType",get:function(){return this.channelInfo.volumeType}}]);return a}(),z=/^([^\/?]+)(?:\/([^\/?]+))?(?:\?(.*))?$/,L=/^((?:http|https):\/\/[^\/?]+)\/(.*)$/;c.i(n.g)("ndstore",{description:"NDstore",volumeCompleter:p,getVolume:g})},function(n,h,c){function m(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,
writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}n=c(0);var e=c(17),a=c(73);c.d(h,"a",function(){return d});var b=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),d=function(d){function f(b){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");
var d;d=(f.__proto__||Object.getPrototypeOf(f)).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");d=!d||"object"!==typeof d&&"function"!==typeof d?this:d;d.gl=b;d.vertexBuffer=d.registerDisposer(e.a.fromData(b,new Float32Array([0,0,0,1,1,0,0,1,0,0,0,1,0,1,0,1,0,0,0,1,0,0,1,1]),b.ARRAY_BUFFER,b.STATIC_DRAW));d.colorBuffer=d.registerDisposer(e.a.fromData(b,new Float32Array([1,0,0,.5,1,0,0,.5,0,1,0,.5,0,1,0,.5,0,0,1,.5,0,0,1,.5]),b.ARRAY_BUFFER,
b.STATIC_DRAW));d.trivialColorShader=d.registerDisposer(c.i(a.c)(b));return d}m(f,d);b(f,[{key:"draw",value:function(a,b){b=void 0===b?!0:b;var d=this.trivialColorShader,c=this.gl;d.bind();c.uniformMatrix4fv(d.uniform("uProjectionMatrix"),!1,a);a=d.attribute("aVertexPosition");this.vertexBuffer.bindToVertexAttrib(a,4);d=d.attribute("aColor");this.colorBuffer.bindToVertexAttrib(d,4);b&&(c.colorMask(!1,!1,!1,!0),c.clearColor(0,0,0,0),c.clear(c.COLOR_BUFFER_BIT),c.colorMask(!0,!0,!0,!0),c.enable(c.BLEND),
c.blendFunc(c.ONE_MINUS_DST_ALPHA,c.DST_ALPHA));c.lineWidth(1);c.drawArrays(c.LINES,0,6);b&&c.disable(c.BLEND);c.disableVertexAttribArray(a);c.disableVertexAttribArray(d)}}],[{key:"get",value:function(a){return a.memoize.get("SliceViewPanel:AxesLineHelper",function(){return new f(a)})}}]);return f}(n.a)},function(n,h,c){var m=c(54),e=c(22),a=c(13);h.e=function(a){return f[a]};h.a=function(f,l,u){u=void 0===u?a.c:u;var g=void 0;return new Promise(function(r,k){function p(a){null===g?--b:(g=c.i(e.b)(d[f],
l.path,l.method),g.responseType=l.responseType,g.setRequestHeader("Authorization",a.tokenType+" "+a.accessToken),g.onloadend=function(){if(null===g)--b;else{var d=this.status;200<=d&&300>d?(--b,u.remove(t),r(this.response)):401===d?c.i(m.a)(a).then(p):504===d?c.i(m.a)().then(p):(--b,u.remove(t),k(e.d.fromXhr(this)))}},g.send(l.payload))}var t=function(){var b=g;g=null;null!=b&&b.abort();k(a.b)};u.add(t);c.i(m.a)().then(p)})};var b=0;h.c=0;n=[];h.b=n;var d=[],f=[];h.d=f;f[0]="prod";n[0]="Brain Maps";
d[0]=["https://brainmaps.googleapis.com"]},function(n,h,c){c.d(h,"b",function(){return m});h.a=function(b){if(null!==e&&(null===a||null==b||b.generationId!==a.generationId))return e;a=null;e=m.getNewTokenPromise(b);e.then(function(b){a=b});return e};var m=new function d(){if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");},e=null,a=null},function(n,h,c){c.d(h,"b",function(){return e});var m=function(){function a(a,d){for(var b=0;b<d.length;b++){var c=d[b];c.enumerable=
c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}();h.a="/ocp/ca";h.c="/nd/sd";var e=function(){function a(){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");}m(a,null,[{key:"stringify",value:function(a){return"ndstore:volume:"+a.baseUrls[0]+"/"+a.key+"/"+a.channel+"/"+a.resolution+"/"+a.encoding}}]);return a}();e.RPC_ID="ndstore/VolumeChunkSource"},function(n,
h,c){function m(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function e(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function a(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});
b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}n=c(0);var b=c(3),d=c(146);c.d(h,"b",function(){return l});c.d(h,"a",function(){return u});var f=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),g=function r(a,b,d){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,
b);if(void 0===c){if(a=Object.getPrototypeOf(a),null!==a)return r(a,b,d)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(d)}},l=function(b){function d(a,b){m(this,d);var c=e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));c.context=a;c.element=b;c.gl=a.gl;c.registerEventListener(b,"mouseenter",function(a){c.context.setActivePanel(c)});a.addPanel(c);return c}a(d,b);f(d,[{key:"scheduleRedraw",value:function(){this.context.scheduleRedraw()}},{key:"setGLViewport",value:function(){var a=
this.element,b=a.offsetLeft+a.clientLeft,d=a.clientWidth,c=a.clientHeight,e=a.offsetTop+a.clientTop+c,a=this.gl;a.enable(a.SCISSOR_TEST);e=this.context.canvas.height-e;a.viewport(b,e,d,c);a.scissor(b,e,d,c)}},{key:"onKeyCommand",value:function(a){return!1}},{key:"disposed",value:function(){this.context.removePanel(this);g(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"disposed",this).call(this)}}]);return d}(n.a),u=function(g){function k(a){m(this,k);var f=e(this,(k.__proto__||Object.getPrototypeOf(k)).call(this));
f.container=a;f.canvas=document.createElement("canvas");f.updateStarted=new b.a;f.updateFinished=new b.a;f.panels=new Set;f.activePanel=null;f.updatePending=null;f.needsRedraw=!1;var g=f.canvas;g.className="gl-canvas";a.appendChild(g);f.gl=c.i(d.a)(g);f.registerEventListener(window,"resize",f.onResize.bind(f));return f}a(k,g);f(k,[{key:"disposed",value:function(){null!=this.updatePending&&(cancelAnimationFrame(this.updatePending),this.updatePending=null)}},{key:"addPanel",value:function(a){this.panels.add(a);
null==this.activePanel&&this.setActivePanel(a)}},{key:"setActivePanel",value:function(a){var b=this.activePanel;null!=b&&b.element.attributes.removeNamedItem("isActivePanel");null!=a&&a.element.setAttribute("isActivePanel","true");this.activePanel=a}},{key:"removePanel",value:function(a){this.panels.delete(a);a===this.activePanel&&this.setActivePanel(null);a.dispose()}},{key:"onResize",value:function(){this.scheduleRedraw();for(var a=$jscomp.makeIterator(this.panels),b=a.next();!b.done;b=a.next())b.value.onResize()}},
{key:"scheduleUpdate",value:function(){null===this.updatePending&&(this.updatePending=requestAnimationFrame(this.update.bind(this)))}},{key:"scheduleRedraw",value:function(){this.needsRedraw||(this.needsRedraw=!0,this.scheduleUpdate())}},{key:"update",value:function(){this.updatePending=null;this.updateStarted.dispatch();if(this.needsRedraw){this.needsRedraw=!1;var a=this.gl,b=this.canvas;b.width=b.offsetWidth;b.height=b.offsetHeight;this.gl.clearColor(0,0,0,0);a.clear(a.COLOR_BUFFER_BIT|a.DEPTH_BUFFER_BIT);
for(var b=$jscomp.makeIterator(this.panels),d=b.next();!d.done;d=b.next()){var d=d.value,c=d.element;0!==c.clientWidth&&0!==c.clientHeight&&(d.setGLViewport(),d.draw())}a.disable(a.SCISSOR_TEST);this.gl.clearColor(1,1,1,1);this.gl.colorMask(!1,!1,!1,!0);a.clear(a.COLOR_BUFFER_BIT);this.gl.colorMask(!0,!0,!0,!0)}this.updateFinished.dispatch()}}]);return k}(n.a)},function(n,h,c){function m(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function e(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function a(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var b=c(35),d=c(36);n=c(0);var f=c(6),g=c(47);c.d(h,"b",function(){return r});c.d(h,"a",function(){return k});c.d(h,"c",function(){return v});
var l=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),u=function B(a,b,d){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,b);if(void 0===c){if(a=Object.getPrototypeOf(a),null!==a)return B(a,b,d)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(d)}},p=[f.f,
f.e,f.o,f.p,"\nfloat computeHash(uint64_t x, vec4 a0, vec4 a1, float b, float c, float modulus, float scalar) {\n  x.low = unnormalizeUint8(x.low);\n  x.high = unnormalizeUint8(x.high);\n  float dotResult = imod(exactDot(a0, x.low) + exactDot(a1, x.high), modulus);\n  float dotResult2 = imod(dotResult * dotResult, modulus);\n  float y = imod(dotResult2 * c, modulus);\n  float modResult = imod(dotResult + y + b, modulus);\n  return fract(modResult * scalar);\n}\n"];h.d=p;var r=function(d){function f(a,
b){m(this,f);var d=e(this,(f.__proto__||Object.getPrototypeOf(f)).call(this));d.gl=a;d.hashTable=b;d.hashFunctions=null;d.generation=-1;d.texture=null;b=b.hashFunctions.length;d.a=new Float32Array(16*b);d.b=new Float32Array(4*b+5);d.texture=a.createTexture();return d}a(f,d);l(f,[{key:"computeCoefficients",value:function(){var a=this.hashTable,d=a.hashFunctions;if(this.hashFunctions!==d){this.hashFunctions=d;for(var c=this.a,e=this.b,f=d.length,g=a.width,k=[1/g,1/a.height],l=0;2>l;++l)e[4*f+l]=b.a,
e[4*f+3+l]=k[l];e[4*f+2]=1/(a.entryStride*g);for(g=0;g<f;++g)for(k=d[g],l=0;2>l;++l){var p=k[l],r=4*g+2*l,u=4*(4*g+2*l);e[r]=p.b+(0===l?.5/a.entryStride:.5);e[r+1]=p.c;for(r=0;4>r;++r)c[u+r]=p.a0[r],c[u+4+r]=p.a1[r]}}}},{key:"copyToGPU",value:function(){this.computeCoefficients();var a=this.hashTable,b=a.generation;if(this.generation!==b){this.generation=b;var d=a.width,e=a.height,f=this.gl,b=this.texture;f.activeTexture(f.TEXTURE0+f.tempTextureUnit);f.bindTexture(f.TEXTURE_2D,b);f.pixelStorei(f.UNPACK_ALIGNMENT,
1);c.i(g.b)(f);var k=f.RGBA;a.tableWithMungedEmptyKey(function(b){f.texImage2D(f.TEXTURE_2D,0,k,d*a.entryStride,e,0,k,f.UNSIGNED_BYTE,new Uint8Array(b.buffer))});f.bindTexture(f.TEXTURE_2D,null)}}},{key:"disposed",value:function(){this.gl.deleteTexture(this.texture);this.texture=null;this.hashTable=this.gl=void 0;this.hashFunctions=null;u(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"disposed",this).call(this)}}],[{key:"get",value:function(a,b){var d=this;return a.memoize.get(b,function(){return new d(a,
b)})}}]);return f}(n.a),k=function(){function a(b,c){c=void 0===c?d.b:c;m(this,a);this.prefix=b;this.numAlternatives=c;$jscomp.initSymbol();this.textureUnitSymbol=Symbol.for("gpuhashtable:"+this.prefix);this.aName=this.prefix+"_a";this.bName=this.prefix+"_b";this.samplerName=this.prefix+"_sampler"}l(a,[{key:"defineShader",value:function(a){var b=this.aName,d=this.bName,c=this.samplerName,e=this.numAlternatives;a.addUniform("highp vec4",b,4*e);a.addUniform("highp float",d,4*e+5);a.addTextureSampler2D(c,
this.textureUnitSymbol);a.addFragmentCode(p);for(var f="",g=0;g<e;++g){for(var k=0;2>k;++k)var l=4*g+2*k,r=4*g+2*k,f=f+("\nfloat "+this.prefix+"_computeHash_"+g+"_"+k+"(uint64_t x) {\n  float primeModulus = "+d+"["+(4*e+k)+"];\n  float scalar = "+d+"["+(4*e+3+k)+"];\n  return computeHash(x, "+b+"["+r+"], "+b+"["+(r+1)+"], "+d+"["+l+"], "+d+"["+(l+1)+"], primeModulus, scalar);\n}\n");f+="\nvec2 "+this.prefix+"_computeHash_"+g+"(uint64_t x) {\n  vec2 v;\n  v[0] = "+this.prefix+"_computeHash_"+g+"_0(x);\n  v[1] = "+
this.prefix+"_computeHash_"+g+"_1(x);\n  return v;\n}\n"}f+="\nbool "+this.hasFunctionName+"(uint64_t x) {\n  float highOffset = "+d+"["+(4*e+2)+"];\n";for(b=0;b<e;++b)f+="\n  {\n    vec2 v = "+this.prefix+"_computeHash_"+b+"(x);\n    vec4 lowResult = texture2D("+c+", v);\n    vec4 highResult = texture2D("+c+", vec2(v.x + highOffset, v.y));\n    if (lowResult == x.low && highResult == x.high) {\n      return true;\n    }\n  }\n";a.addFragmentCode(f+"\n  return false;\n}\n")}},{key:"enable",value:function(a,
b,d){d.copyToGPU();var c=b.textureUnit(this.textureUnitSymbol);a.activeTexture(a.TEXTURE0+c);a.bindTexture(a.TEXTURE_2D,d.texture);a.uniform4fv(b.uniform(this.aName),d.a);a.uniform1fv(b.uniform(this.bName),d.b)}},{key:"disable",value:function(a,b){b=b.textureUnit(this.textureUnitSymbol);a.activeTexture(a.TEXTURE0+b);a.bindTexture(a.TEXTURE_2D,null)}},{key:"hasFunctionName",get:function(){return this.prefix+"_has"}}]);return a}(),v=function(b){function d(){m(this,d);return e(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,
arguments))}a(d,b);l(d,[{key:"defineShader",value:function(a){u(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"defineShader",this).call(this,a);for(var b=this.samplerName,c=this.numAlternatives,e="\nbool "+this.getFunctionName+"(uint64_t x, out uint64_t value) {\n  float highOffset = "+this.bName+"["+(4*c+2)+"];\n",f=0;f<c;++f)e+="\n  {\n    vec2 v = "+this.prefix+"_computeHash_"+f+"(x);\n    vec4 lowResult = texture2D("+b+", v);\n    vec4 highResult = texture2D("+b+", vec2(v.x + highOffset, v.y));\n    if (lowResult == x.low && highResult == x.high) {\n      value.low = texture2D("+
b+", vec2(v.x + 2.0 * highOffset, v.y));\n      value.high = texture2D("+b+", vec2(v.x + 3.0 * highOffset, v.y));\n      return true;\n    }\n  }\n";a.addFragmentCode(e+"\n  return false;\n}\n")}},{key:"getFunctionName",get:function(){return this.prefix+"_get"}}]);return d}(k)},function(n,h,c){function m(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function e(a,b){if("function"!==typeof b&&
null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var a=c(8),b=c(12);n=c(21);var d=c(4),f=c(13),g=c(74),l=c(147),u=c(148);c.d(h,"a",function(){return r});var p=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in
c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}();c(160);var r=function(k){function r(d,e){if(!(this instanceof r))throw new TypeError("Cannot call a class as a function");var f=m(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));f.manager=d;f.existingLayer=e;f.statusElement=document.createElement("div");f.submitElement=document.createElement("button");f.namePromptElement=document.createElement("label");f.nameInputElement=
document.createElement("input");f.volumeCancellationSource=void 0;f.sourceValid=!1;f.nameValid=!0;var k=f.content;k.classList.add("add-layer-overlay");var p=document.createElement("form");p.className="source-form";f.registerEventListener(p,"submit",function(a){a.preventDefault();f.validateSource(!0)});var h=document.createElement("label");h.textContent="Source:";d=f.sourceInput=f.registerDisposer(new l.b({completer:function(b,d){return c.i(a.b)(b,f.manager.chunkManager,d).then(function(a){return{completions:a.completions,
makeElement:l.a,offset:a.offset,showSingleResult:!0}})},delay:0}));d.element.classList.add("add-layer-source");d.inputElement.addEventListener("blur",function(){f.validateSource(!1)});f.submitElement.disabled=!0;d.inputChanged.add(function(){var a=f.volumeCancellationSource;void 0!==a&&(a.cancel(),f.volumeCancellationSource=void 0);f.sourceValid=!1;f.submitElement.disabled=!0;f.statusElement.textContent=""});p.appendChild(h);p.appendChild(d.element);c.i(g.a)(h,d.inputElement);h=c.i(u.a)();p.appendChild(h);
k.appendChild(p);var t=f.statusElement,v=f.namePromptElement,B=f.nameInputElement,p=f.submitElement;t.className="dialog-status";h=document.createElement("form");h.className="name-form";v.textContent="Name:";B.className="add-layer-name";B.autocomplete="off";B.spellcheck=!1;B.type="text";f.registerEventListener(B,"input",function(){f.validateName()});p.type="submit";c.i(g.a)(v,B);h.appendChild(v);h.appendChild(B);h.appendChild(p);k.appendChild(h);k.appendChild(t);void 0!==e?(void 0!==e.sourceUrl?(d.value=
e.sourceUrl,f.validateSource()):f.sourceValid=!0,d.disabled=!0,B.value=e.name,f.validateName(),p.textContent="Save",B.focus()):(e=f.manager.layerManager.managedLayers,0<e.length&&(e=e[e.length-1],e instanceof b.b&&(e=e.sourceUrl,void 0!==e&&(k=c.i(a.c)(e),d.value=e.substring(0,k),d.inputElement.setSelectionRange(0,k)))),d.inputElement.focus(),p.textContent="Add Layer");f.registerEventListener(h,"submit",function(a){a.preventDefault();f.submit()});return f}e(r,k);p(r,[{key:"isNameValid",value:function(){var a=
this.nameInputElement.value;if(""===a)return!1;a=this.manager.layerManager.getLayerByName(a);return void 0===a||a===this.existingLayer}},{key:"submit",value:function(){this.sourceValid&&this.isNameValid()&&(this.existingLayer?(this.existingLayer.name=this.nameInputElement.value,this.manager.layerManager.layersChanged.dispatch()):this.manager.layerManager.addManagedLayer(this.manager.getLayer(this.nameInputElement.value,this.sourceInput.value)),this.dispose())}},{key:"validateName",value:function(){var a=
this.nameInputElement;(this.nameValid=this.isNameValid())?(a.classList.add("valid-input"),a.classList.remove("invalid-input")):(a.classList.remove("valid-input"),a.classList.add("invalid-input"));this.validityChanged()}},{key:"validityChanged",value:function(){this.submitElement.disabled=!(this.nameValid&&this.sourceValid)}},{key:"validateSource",value:function(b){b=void 0===b?!1:b;var e=this,g=this.sourceInput.value;if(""!==g){try{var k=c.i(a.d)(g),l=this.nameInputElement;if(""===this.nameInputElement.value){for(var p=
k,r=0;void 0!==this.manager.layerManager.getLayerByName(p);)p=k+ ++r;l.value=p;l.setSelectionRange(0,p.length);this.validateName()}b&&l.focus()}catch(G){this.setError(G.message);return}this.setInfo("Validating volume source...");var h=this.volumeCancellationSource=new f.a;c.i(a.a)(this.manager.chunkManager,g,h).then(function(a){h.isCanceled||(e.volumeCancellationSource=void 0,e.sourceValid=!0,e.setInfo(d.a[a.volumeType].toLowerCase()+": "+(a.numChannels+"-channel "+d.b[a.dataType].toLowerCase())),
e.validityChanged())}).catch(function(a){h.isCanceled||(e.volumeCancellationSource=void 0,e.setError(a.message))})}}},{key:"setInfo",value:function(a){this.statusElement.className="dialog-status dialog-status-info";this.statusElement.textContent=a}},{key:"setError",value:function(a){this.statusElement.className="dialog-status dialog-status-error";this.statusElement.textContent=a}}]);return r}(n.b)},function(n,h,c){h.b=function(c,e){return function(a){a.style.flex=c;e(a)}};h.a=function(c,e){return function(a){a.style.display=
"flex";a.style.flexDirection=c;for(var b=$jscomp.makeIterator(e),d=b.next();!d.done;d=b.next()){var d=d.value,f=a.ownerDocument.createElement("div");a.appendChild(f);d(f)}}}},function(n,h,c){function m(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function e(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function a(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}n=c(0);var b=c(1),d=c(2),f=c(3);c.d(h,"c",function(){return k});c.d(h,"b",function(){return v});c.d(h,"a",function(){return B});var g=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,
d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),l=function(k){function l(a){m(this,l);var d=e(this,(l.__proto__||Object.getPrototypeOf(l)).call(this));d.changed=new f.a;var c=!0;null==a&&(a=b.a.create(),c=!1);d.size=a;d.valid=c;return d}a(l,k);g(l,[{key:"reset",value:function(){this.valid=!1;this.changed.dispatch()}},{key:"setValid",value:function(){this.valid||(this.valid=!0,this.changed.dispatch())}},{key:"toJSON",value:function(){if(this.valid)return Array.prototype.slice.call(this.size)}},{key:"restoreState",
value:function(a){try{c.i(d.g)(this.size,a),this.valid=!0,this.changed.dispatch()}catch(A){this.valid=!1,this.changed.dispatch()}}},{key:"toString",value:function(){return this.valid?this.size.toString():null}},{key:"voxelFromSpatial",value:function(a,d){return b.a.divide(a,d,this.size)}},{key:"spatialFromVoxel",value:function(a,d){return b.a.multiply(a,d,this.size)}}]);return l}(n.a),u=b.a.create(),p=b.l.create(),r=function(k){function p(a,d){m(this,p);var c=e(this,(p.__proto__||Object.getPrototypeOf(p)).call(this));
c.voxelCoordinates=null;c.changed=new f.a;null==a&&(a=new l);c.voxelSize=a;var g=!0;null==d&&(d=b.a.create(),g=!1);c.spatialCoordinates=d;c.spatialCoordinatesValid=g;c.registerDisposer(a);c.registerDisposer(a.changed.add(function(){c.handleVoxelSizeChanged()}));return c}a(p,k);g(p,[{key:"reset",value:function(){this.spatialCoordinatesValid=!1;this.voxelCoordinates=null;this.voxelSize.reset();this.changed.dispatch()}},{key:"getVoxelCoordinates",value:function(a){var d=this.voxelCoordinates;if(d)b.a.copy(a,
d);else if(this.valid)this.voxelSize.voxelFromSpatial(a,this.spatialCoordinates);else return!1;return!0}},{key:"setVoxelCoordinates",value:function(a){var d=this.voxelSize;d.valid?(d.spatialFromVoxel(this.spatialCoordinates,a),this.markSpatialCoordinatesChanged()):(d=this.voxelCoordinates)?b.a.copy(d,a):this.voxelCoordinates=b.a.clone(a);this.changed.dispatch()}},{key:"markSpatialCoordinatesChanged",value:function(){this.spatialCoordinatesValid=!0;this.voxelCoordinates=null;this.changed.dispatch()}},
{key:"handleVoxelSizeChanged",value:function(){null==this.voxelCoordinates||this.spatialCoordinatesValid||(this.voxelSize.spatialFromVoxel(this.spatialCoordinates,this.voxelCoordinates),this.spatialCoordinatesValid=!0);this.voxelCoordinates=null;this.changed.dispatch()}},{key:"toJSON",value:function(){var a=!0,b=this.voxelSize.toJSON(),d={};void 0!==b&&(a=!1,d.voxelSize=b);this.voxelCoordinatesValid?(this.getVoxelCoordinates(u),d.voxelCoordinates=Array.prototype.slice.call(u),a=!1):this.spatialCoordinatesValid&&
(d.spatialCoordinates=Array.prototype.slice.call(this.spatialCoordinates),a=!1);if(!a)return d}},{key:"restoreState",value:function(a){var e=this;c.i(d.a)(a);c.i(d.d)(a,"voxelSize",function(a){void 0!==a&&e.voxelSize.restoreState(a)});this.spatialCoordinatesValid=!1;c.i(d.d)(a,"voxelCoordinates",function(a){void 0!==a&&e.setVoxelCoordinates(c.i(d.g)(b.a.create(),a))});c.i(d.d)(a,"spatialCoordinates",function(a){void 0!==a&&(c.i(d.g)(e.spatialCoordinates,a),e.markSpatialCoordinatesChanged())})}},{key:"snapToVoxel",
value:function(){if(this.valid){for(var a=this.spatialCoordinates,b=this.voxelSize.size,d=0;3>d;++d){var c=b[d];a[d]=Math.round(a[d]/c)*c}this.changed.dispatch()}else if(a=this.voxelCoordinates,null!=a){for(b=0;3>b;++b)a[b]=Math.round(a[b]);this.changed.dispatch()}}},{key:"valid",get:function(){return this.spatialCoordinatesValid&&this.voxelSize.valid}},{key:"voxelCoordinatesValid",get:function(){return this.valid||null!=this.voxelCoordinates}}]);return p}(n.a),k=function(k){function l(a){m(this,
l);var d=e(this,(l.__proto__||Object.getPrototypeOf(l)).call(this));d.changed=new f.a;null==a&&(a=b.l.create());d.orientation=a;return d}a(l,k);g(l,[{key:"toJSON",value:function(){var a=this.orientation;if(0!==a[0]||0!==a[1]||0!==a[2]||1!==a[3])return Array.prototype.slice.call(this.orientation)}},{key:"restoreState",value:function(a){try{c.i(d.g)(this.orientation,a),b.l.normalize(this.orientation,this.orientation)}catch(A){b.l.identity(this.orientation)}this.changed.dispatch()}},{key:"reset",value:function(){b.l.identity(this.orientation);
this.changed.dispatch()}},{key:"snap",value:function(){var a=b.m.create();b.m.fromQuat(a,this.orientation);for(var d=[!1,!1,!1],c=0;3>c;++c){for(var e=0,f=0,g=0;3>g;++g){var k=a[3*c+g];a[3*c+g]=0;!d[g]&&Math.abs(k)>Math.abs(e)&&(e=k,f=g)}a[3*c+f]=Math.sign(e);d[f]=!0}b.l.fromMat3(this.orientation,a);this.changed.dispatch()}}],[{key:"makeRelative",value:function(a,d){var c=new l(b.l.multiply(b.l.create(),a.orientation,d)),e=!1;c.registerDisposer(a.changed.add(function(){e||(f=!0,b.l.multiply(c.orientation,
a.orientation,d),c.changed.dispatch(),f=!1)}));var f=!1,g=b.l.invert(b.l.create(),d);c.registerDisposer(c.changed.add(function(){f||(e=!0,b.l.multiply(a.orientation,c.orientation,g),a.changed.dispatch(),e=!1)}));return c}}]);return l}(n.a),v=function(l){function h(a,b){m(this,h);var d=e(this,(h.__proto__||Object.getPrototypeOf(h)).call(this));d.changed=new f.a;null==a&&(a=new r);d.position=a;null==b&&(b=new k);d.orientation=b;d.registerDisposer(d.position);d.registerDisposer(d.orientation);d.registerDisposer(d.position.changed.add(d.changed.dispatch));
d.registerDisposer(d.orientation.changed.add(d.changed.dispatch));return d}a(h,l);g(h,[{key:"reset",value:function(){this.position.reset();this.orientation.reset()}},{key:"toMat4",value:function(a){b.b.fromRotationTranslation(a,this.orientation.orientation,this.position.spatialCoordinates)}},{key:"toJSON",value:function(){var a=this.position.toJSON(),b=this.orientation.toJSON();if(void 0!==a||void 0!==b)return{position:a,orientation:b}}},{key:"restoreState",value:function(a){var b=this;c.i(d.a)(a);
c.i(d.d)(a,"position",function(a){void 0!==a&&b.position.restoreState(a)});c.i(d.d)(a,"orientation",function(a){void 0!==a&&b.orientation.restoreState(a)})}},{key:"snap",value:function(){this.orientation.snap();this.position.snapToVoxel();this.changed.dispatch()}},{key:"translateAbsolute",value:function(a){b.a.add(this.position.spatialCoordinates,this.position.spatialCoordinates,a);this.position.changed.dispatch()}},{key:"translateRelative",value:function(a){this.valid&&(b.a.transformQuat(u,a,this.orientation.orientation),
b.a.add(this.position.spatialCoordinates,this.position.spatialCoordinates,u),this.position.changed.dispatch())}},{key:"translateVoxelsRelative",value:function(a){if(this.valid){var d=b.a.create();b.a.transformQuat(d,a,this.orientation.orientation);b.a.multiply(d,d,this.position.voxelSize.size);b.a.add(this.position.spatialCoordinates,this.position.spatialCoordinates,d);this.position.changed.dispatch()}}},{key:"rotateRelative",value:function(a,d){var c=b.l.create();b.l.setAxisAngle(c,a,d);a=this.orientation.orientation;
b.l.multiply(a,a,c);this.orientation.changed.dispatch()}},{key:"rotateAbsolute",value:function(a,d,c){var e=b.l.create();b.l.setAxisAngle(e,a,d);a=this.orientation.orientation;if(void 0!==c){d=this.position.spatialCoordinates;var f=b.a.subtract(u,c,d),g=b.l.invert(p,a);b.a.transformQuat(f,f,g);b.l.multiply(a,e,a);b.a.transformQuat(d,f,a);b.a.subtract(d,c,d);this.position.changed.dispatch()}else b.l.multiply(a,e,a);this.orientation.changed.dispatch()}},{key:"valid",get:function(){return this.position.valid}}]);
return h}(n.a),t=function(){function a(b,d){b=void 0===b?Number.NaN:b;d=void 0===d?b:d;m(this,a);this.value_=b;this.defaultValue=d;this.changed=new f.a}g(a,[{key:"toJSON",value:function(){var a=this.value_,b=this.defaultValue;if(!(Number.isNaN(a)&&Number.isNaN(b)||a===b))return a}},{key:"restoreState",value:function(a){"number"===typeof a&&Number.isFinite(a)&&0<a?this.value=a:this.value=this.defaultValue}},{key:"reset",value:function(){this.value=this.defaultValue}},{key:"zoomBy",value:function(a){var b=
this.value_;Number.isNaN(b)||(this.value=b*a)}},{key:"value",get:function(){return this.value_},set:function(a){a!==this.value_&&(this.value_=a,this.changed.dispatch())}}]);return a}(),B=function(k){function l(a,b){a=void 0===a?new v:a;b=void 0===b?Number.NaN:b;m(this,l);var d=e(this,(l.__proto__||Object.getPrototypeOf(l)).call(this));d.pose=a;d.changed=new f.a;d.zoomFactor="number"===typeof b?new t(b):b;d.registerDisposer(a);d.registerDisposer(d.pose.changed.add(function(){d.changed.dispatch()}));
d.registerDisposer(d.zoomFactor.changed.add(function(){d.changed.dispatch()}));d.registerDisposer(d.voxelSize.changed.add(function(){d.handleVoxelSizeChanged()}));d.handleVoxelSizeChanged();return d}a(l,k);g(l,[{key:"reset",value:function(){this.pose.reset();this.zoomFactor.reset()}},{key:"setZoomFactorFromVoxelSize",value:function(){this.voxelSize.valid&&(this.zoomFactor.value=Math.min.apply(null,this.voxelSize.size))}},{key:"handleVoxelSizeChanged",value:function(){Number.isNaN(this.zoomFactor.value)&&
this.setZoomFactorFromVoxelSize()}},{key:"toMat4",value:function(a){this.pose.toMat4(a);var d=this.zoomFactor.value;b.b.scale(a,a,b.a.fromValues(d,d,d))}},{key:"toJSON",value:function(){var a=this.pose.toJSON(),b=this.zoomFactor.toJSON();if(void 0!==a||void 0!==b)return{pose:a,zoomFactor:b}}},{key:"restoreState",value:function(a){var b=this;try{c.i(d.a)(a),c.i(d.d)(a,"pose",function(a){void 0!==a&&b.pose.restoreState(a)}),c.i(d.d)(a,"zoomFactor",function(a){void 0!==a&&b.zoomFactor.restoreState(a)}),
this.handleVoxelSizeChanged(),this.changed.dispatch()}catch(D){this.reset()}}},{key:"zoomBy",value:function(a){this.zoomFactor.zoomBy(a)}},{key:"voxelSize",get:function(){return this.pose.position.voxelSize}},{key:"position",get:function(){return this.pose.position}},{key:"valid",get:function(){return this.pose.valid}}]);return l}(n.a)},function(n,h,c){c.d(h,"a",function(){return e});var m=function(){function a(a,d){for(var b=0;b<d.length;b++){var c=d[b];c.enumerable=c.enumerable||!1;c.configurable=
!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),e=function(){function a(){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");this.renderLayers=[null];this.values=[0,0,0];this.nextPickID=1}m(a,[{key:"clear",value:function(){this.renderLayers.length=1;this.values.length=3;this.nextPickID=1}},{key:"registerUint64",value:function(a,d,c){return this.register(a,void 0===c?1:c,d.low,d.high)}},
{key:"register",value:function(a,d,c,e){var b=this.renderLayers,f=this.values,g=this.nextPickID;this.nextPickID+=void 0===d?1:d;d=b.length;b[d]=a;a=3*d;f[a]=g;f[a+1]=void 0===c?0:c;f[a+2]=void 0===e?0:e;return g}},{key:"setMouseState",value:function(a,d){for(var b=this.renderLayers,c=this.values,e=0,h=b.length-1;e<h;){var p=Math.ceil(e+(h-e)/2);c[3*p]>d?h=p-1:e=p}b=a.pickedRenderLayer=b[e];e*=3;d=a.pickedOffset=d-c[e];h=a.pickedValue;h.low=c[e+1];h.high=c[e+2];null!==b&&b.updateMouseState(a,h,d)}}]);
return a}()},function(n,h,c){function m(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function e(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=
b)}n=c(56);var a=c(1),b=c(143);c.d(h,"a",function(){return v});var d=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),f=function B(a,b,d){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,b);if(void 0===c){if(a=Object.getPrototypeOf(a),null!==a)return B(a,b,d)}else{if("value"in c)return c.value;
b=c.get;return void 0===b?void 0:b.call(d)}};c(166);var g=new Map;for(h={axis:0};3>h.axis;h={axis:h.axis},++h.axis)for(var l=a.k[h.axis],u={},p=$jscomp.makeIterator([-1,1]),r=p.next();!r.done;u={sign:u.sign,tempOffset:u.tempOffset},r=p.next())u.sign=r.value,r=0>u.sign?"-":"+",g.set("rotate-relative-"+l+r,function(b,d){return function(){this.navigationState.pose.rotateRelative(a.f[b.axis],.1*d.sign)}}(h,u)),u.tempOffset=a.a.create(),g.set(""+l+r,function(a,b){return function(){var d=this.navigationState,
c=a.tempOffset;c[0]=0;c[1]=0;c[2]=0;c[b.axis]=a.sign;d.pose.translateVoxelsRelative(c)}}(u,h));g.set("snap",function(){this.navigationState.pose.snap()});g.set("zoom-in",function(){this.navigationState.zoomBy(.5)});g.set("zoom-out",function(){this.navigationState.zoomBy(2)});var k=a.a.create(),v=function(l){function p(a,b,d){if(!(this instanceof p))throw new TypeError("Cannot call a class as a function");var c=m(this,(p.__proto__||Object.getPrototypeOf(p)).call(this,a,b));c.viewer=d;c.mouseX=0;c.mouseY=
0;c.mouseStateUpdater=c.updateMouseState.bind(c);b.classList.add("rendered-data-panel");c.registerEventListener(b,"mousemove",c.onMousemove.bind(c));c.registerEventListener(b,"mouseleave",c.onMouseout.bind(c));c.registerEventListener(b,"mousedown",c.onMousedown.bind(c),!1);c.registerEventListener(b,"wheel",c.onMousewheel.bind(c),!1);c.registerEventListener(b,"dblclick",function(){c.viewer.layerManager.invokeAction("select")});return c}e(p,l);d(p,[{key:"onMouseout",value:function(a){a=this.viewer.mouseState;
a.updater=void 0;a.setActive(!1)}},{key:"onKeyCommand",value:function(a){return(a=g.get(a))?(a.call(this),!0):!1}},{key:"onMousemove",value:function(a){var b=this.element;a.target===b&&(this.mouseX=a.offsetX-b.clientLeft,this.mouseY=a.offsetY-b.clientTop,a=this.viewer.mouseState,a.updater=this.mouseStateUpdater,a.triggerUpdate())}},{key:"disposed",value:function(){var a=this.viewer.mouseState;a.updater===this.mouseStateUpdater&&(a.updater=void 0,a.setActive(!1));f(p.prototype.__proto__||Object.getPrototypeOf(p.prototype),
"disposed",this).call(this)}},{key:"onMousewheel",value:function(a){if(a.ctrlKey)this.onMousemove(a),this.zoomByMouse(c.i(b.a)(a));else{var d=this.navigationState,e=0!==a.deltaY?a.deltaY:a.deltaX;k[0]=0;k[1]=0;k[2]=(0<e?-1:1)*(a.shiftKey?10:1);d.pose.translateVoxelsRelative(k)}a.preventDefault()}},{key:"onMousedown",value:function(b){if(b.target===this.element)if(this.onMousemove(b),0===b.button)b.ctrlKey?this.viewer.mouseState.updateUnconditionally()&&this.viewer.layerManager.invokeAction("annotate"):
this.startDragViewport(b);else if(2===b.button&&(b=this.viewer.mouseState,b.updateUnconditionally())){var d=this.navigationState.pose.position;a.a.copy(d.spatialCoordinates,b.position);d.changed.dispatch()}}}]);return p}(n.b)},function(n,h,c){function m(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function e(a){return a-Math.floor(a)}var a=c(35),b=c(57),d=c(132),f=c(3),g=c(6);c.d(h,"b",function(){return u});c.d(h,"a",function(){return k});var l=function(){function a(a,
b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),u=function(){function d(a){m(this,d);this.prefix=a;this.aName=this.prefix+"_a";this.bName=this.prefix+"_b"}l(d,[{key:"defineShader",value:function(d){var c=this.aName,e=this.bName;d.addUniform("highp vec4",c,4);d.addUniform("highp float",e,4);d.addFragmentCode(g.e);d.addFragmentCode(b.d);
d.addFragmentCode(g.q);for(var f="\nvec3 "+this.prefix+"(uint64_t x) {\n  vec2 v;\n  float primeModulus = float("+a.a+");\n",k=0;2>k;++k)var l=2*k,p=2*k,f=f+("\n  v["+k+"] = computeHash(x, "+c+"["+p+"], "+c+"["+(p+1)+"], "+e+"["+l+"], "+e+"["+(l+1)+"], primeModulus, 1.0 / 256.0);\n");d.addFragmentCode(f+"\n  vec3 hsv = vec3(v.x, 0.5 + v.y * 0.5, 1.0);\n  return hsvToRgb(hsv);\n}\n")}},{key:"enable",value:function(a,b,d){a.uniform4fv(b.uniform(this.aName),d.a_);a.uniform1fv(b.uniform(this.bName),d.b_)}}]);
return d}(),p=new Float32Array(2),r=new Float32Array(3),k=function(){function b(a){m(this,b);this.a_=new Float32Array(16);this.b_=new Float32Array(4);this.changed=new f.a;null==a?(this.hashFunctions=Array(2),this.randomize_()):this.hashFunctions=a;this.computeGPUCoefficients_()}l(b,[{key:"compute",value:function(a,b){var f=b.low;b=b.high;for(var g=this.hashFunctions,k=0;2>k;++k)p[k]=e(g[k].compute(f,b)/256);c.i(d.a)(a,p[0],.5+.5*p[1],1);return a}},{key:"computeCssColor",value:function(a){this.compute(r,
a);return"rgb("+100*r[0]+"%,"+100*r[1]+"%,"+100*r[2]+"%)"}},{key:"debugCompute",value:function(b,d){var c=d.low;d=d.high;for(var f=this.b_,g=a.a,k=0;2>k;++k){for(var l=2*k,p=2*k,r=new Float32Array(2),h=0;4>h;++h)r[0]+=this.a_[4*p+h]*(c>>8*h&255),r[1]+=this.a_[4*(p+1)+h]*(d>>8*h&255);var p=(r[0]+r[1])%g,h=p*p%g,u=h*f[l+1]%g,t=(f[l]+p+u)%g;console.log("b = "+f[l]+", sums="+r[0]+" "+r[1]+", dotResult="+p+", prod = "+p*p+" dotResult2="+h+", y="+u+", modResult="+t);b[k]=e(1/256*t)}return b}},{key:"randomize_",
value:function(){for(var b=0;2>b;++b)this.hashFunctions[b]=a.b.generate()}},{key:"randomize",value:function(){this.randomize_();this.computeGPUCoefficients_();this.changed.dispatch()}},{key:"toString",value:function(){return"new SegmentColorHash(["+this.hashFunctions+"])"}},{key:"computeGPUCoefficients_",value:function(){for(var a=this.hashFunctions,b=this.a_,d=this.b_,c=0;2>c;++c){var e=a[c],f=2*c,g=8*c;d[f]=1*e.b;d[f+1]=1*e.c;for(f=0;4>f;++f)b[g+f]=1*e.a0[f],b[g+4+f]=1*e.a1[f]}}}],[{key:"getDefault",
value:function(){return new b([new a.b(Float32Array.of(609,2364,3749,2289),Float32Array.of(2840,1186,3660,1833),1718,1109),new a.b(Float32Array.of(3466,3835,3345,2040),Float32Array.of(3382,901,18,3444),1534,1432)])}}]);return b}()},function(n,h,c){function m(a,d){if("function"!==typeof d&&null!==d)throw new TypeError("Super expression must either be null or a function, not "+typeof d);a.prototype=Object.create(d&&d.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});d&&(Object.setPrototypeOf?
Object.setPrototypeOf(a,d):a.__proto__=d)}var e=c(43);n=c(7);c.d(h,"a",function(){return a});var a=function(a){function b(a){a=void 0===a?new e.a:a;if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");var d;d=(b.__proto__||Object.getPrototypeOf(b)).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");d=!d||"object"!==typeof d&&"function"!==typeof d?this:d;d.visibilityCount=a;return d}m(b,a);return b}(n.b);h.b="shared_visibility_count.onVisibilityChange"},
function(n,h,c){var m=c(64);h.a=function(c){var a=function(){null!=c.rpc&&c.rpc.invoke(m.b,{id:c.rpcId,visible:0<c.visibilityCount.value})};0<c.visibilityCount.value&&a();c.visibilityCount.signChanged.add(a)}},function(n,h,c){h.a=function(c,e,a,b,d,f){for(var g=0,l=0,h=1,p=1,r=0;3>r;++r)var k=d[r],m=b[r],t=k%m,g=g+Math.floor(k/m)*h,h=h*Math.ceil(a[r]/m),l=l+t*p,p=p*m;b=e+2*g;a=c[b];b=c[b+1];d=a&16777215;a=a>>24&255;0<a&&(d+=f*(c[(e+b&16777215)+Math.floor(l*a/32)]>>l*a%32&(1<<a)-1));return d}},function(n,
h,c){function m(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function e(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function a(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});
b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}n=c(5);var b=c(0);c.d(h,"a",function(){return u});c.d(h,"b",function(){return p});var d=function k(a,b,d){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,b);if(void 0===c){if(a=Object.getPrototypeOf(a),null!==a)return k(a,b,d)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(d)}},f=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=
!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}();$jscomp.initSymbol();var g=Symbol("SingleTextureVolumeChunk.textureUnit");$jscomp.initSymbol();var l=Symbol("SingleTextureVolumeChunk.textureLayout"),u=function(b){function d(a){m(this,d);var b=e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));b.shaderKey=a;return b}a(d,b);f(d,[{key:"defineShader",value:function(a){a.addTextureSampler2D("uVolumeChunkSampler",
g)}},{key:"beginDrawing",value:function(a,b){var d=b.textureUnit(g);a.activeTexture(a.TEXTURE0+d);b[l]=null}},{key:"endDrawing",value:function(a,b){a.bindTexture(a.TEXTURE_2D,null);b[l]=null}},{key:"bindChunk",value:function(a,b,d){var c=d.textureLayout;b[l]!==c&&(b[l]=c,this.setupTextureLayout(a,b,c));a.bindTexture(a.TEXTURE_2D,d.texture)}},{key:"beginSource",value:function(a,b){}}]);return d}(b.a),p=function(b){function c(a,b){m(this,c);a=e(this,(c.__proto__||Object.getPrototypeOf(c)).call(this,
a,b));a.texture=null;a.data=b.data;return a}a(c,b);f(c,[{key:"copyToGPU",value:function(a){d(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"copyToGPU",this).call(this,a);var b=this.texture=a.createTexture();a.bindTexture(a.TEXTURE_2D,b);this.setTextureData(a);a.bindTexture(a.TEXTURE_2D,null)}},{key:"freeGPUMemory",value:function(a){d(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"freeGPUMemory",this).call(this,a);a.deleteTexture(this.texture);this.texture=null;this.textureLayout.dispose();
this.textureLayout=null}}]);return c}(n.d)},function(n,h,c){h.a=function(c,e,a,b){for(;e<a;){var d=c[e];b(d)?++e:(--a,c[e]=c[a],c[a]=d)}return a};h.b=function(c,e){if(c.length===e)return c;e=new c.constructor(e);e.set(c);return e}},function(n,h,c){h.a=function(c,e,a){var b=void 0===a?{}:a,d=void 0===b.horizontal?!1:b.horizontal,f=void 0===b.vertical?!0:b.vertical,g=void 0===b.topMargin?6:b.topMargin,l=void 0===b.bottomMargin?6:b.bottomMargin,h=void 0===b.leftMargin?6:b.leftMargin,p=void 0===b.rightMargin?
6:b.rightMargin;a=void 0===b.maxHeight?!0:b.maxHeight;b=void 0===b.maxWidth?!0:b.maxWidth;e=e.getBoundingClientRect();if(d){var d=e.right,r=c.ownerDocument.documentElement.clientHeight-e.left;d>r?(c.style.left="",c.style.right="0",b&&(c.style.maxWidth=d-h+"px")):(c.style.right="",c.style.left="0",b&&(c.style.maxWidth=r-p+"px"))}f&&(f=e.top-g,l=c.ownerDocument.documentElement.clientHeight-e.bottom-l,f>3*l?(c.style.top="",c.style.bottom="100%",a&&(c.style.maxHeight=f+"px")):(c.style.top="100%",c.style.bottom=
"",a&&(c.style.maxHeight=l+"px")))}},function(n,h,c){function m(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}var a=c(0),b=c(2);c.d(h,"b",function(){return g});
c.d(h,"a",function(){return l});var d=function p(a,b,d){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,b);if(void 0===c){if(a=Object.getPrototypeOf(a),null!==a)return p(a,b,d)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(d)}},f=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,
d);c&&a(b,c);return b}}(),g=function(){function a(){e(this,a);this.map=new Map}f(a,[{key:"get",value:function(a,b){var d=this.map,c=d.get(a);void 0===c?(c=b(),c.registerDisposer(function(){d.delete(a)}),d.set(a,c)):c.addRef();return c}}]);return a}(),l=function(g){function l(){e(this,l);var a=(l.__proto__||Object.getPrototypeOf(l)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?
this:a}m(l,g);f(l,[{key:"get",value:function(a,e){"string"!==typeof a&&(a=c.i(b.f)(a));return d(l.prototype.__proto__||Object.getPrototypeOf(l.prototype),"get",this).call(this,a,e)}},{key:"getUncounted",value:function(b,d){return this.get(b,function(){return new a.b(d())}).value}}]);return l}(g)},function(n,h,c){h.a=function(c,e){var a=c.view.document,b=c.screenX,d=c.screenY,f=function(a){var c=b-a.screenX,f=d-a.screenY;b=a.screenX;d=a.screenY;e(a,c,f)},g=c.button,l=function(b){b.button===g&&(a.removeEventListener("mousemove",
f,!0),a.removeEventListener("mouseup",l,!1))};a.addEventListener("mousemove",f,!0);a.addEventListener("mouseup",l,!1)}},function(n,h,c){function m(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function e(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?
Object.setPrototypeOf(a,b):a.__proto__=b)}n=c(0);var a=c(17),b=c(24),d=c(6);h.c=function(a,b,d){d=void 0===d?!1:d;b=b.attribute("aIndexRaw");0<=b&&(d&&a.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(b,0),a.disableVertexAttribArray(b))};h.a=function(a){return a.memoize.get("IndexBuffer",function(){return new g(a)})};h.b=function(a){a.addAttribute("highp vec3","aIndexRaw");a.addVertexCode(d.j);a.addVertexCode("\nuint32_t getPrimitiveIndex() {\n  uint32_t result;\n  result.value = vec4(aIndexRaw, 0.0);\n  return result;\n}\n")};
c.d(h,"d",function(){return l});h.e=function(d,c){return a.a.fromData(d,new Uint8Array(c.buffer,c.byteOffset,c.byteLength),b.c,b.d)};var f=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),g=function(d){function c(b){m(this,c);var d;d=(c.__proto__||Object.getPrototypeOf(c)).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
d=!d||"object"!==typeof d&&"function"!==typeof d?this:d;d.gl=b;d.buffer=d.registerDisposer(new a.a(b));return d}e(c,d);f(c,[{key:"resize",value:function(a){var b,d;if(256>a){d=b=new Uint8Array(a);for(var c=0;c<a;++c)d[c]=c;d=1}else if(65536>a){d=b=new Uint8Array(2*a);for(var c=0,e=2*a,f=0;f<e;f+=2)d[f]=c,d[f+1]=c>>8,++c;d=2}else if(16777216>a){d=b=new Uint8Array(3*a);c=3*a;for(f=e=0;f<c;f+=3)d[f]=e,d[f+1]=e>>8,d[f+2]=e>>16,++e;d=3}else throw Error("Length of index buffer must not exceed 2^24.");this.buffer.setData(b);
this.numComponents=d;this.length=a}},{key:"ensure",value:function(a){(void 0===this.length||this.length<a)&&this.resize(a);return this}},{key:"bindToVertexAttrib",value:function(a){this.buffer.bindToVertexAttrib(a,this.numComponents,b.j,!0)}},{key:"bind",value:function(a,b){b=void 0===b?0:b;a=a.attribute("aIndexRaw");0<=a&&(this.bindToVertexAttrib(a),0!==b&&this.gl.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(a,b))}}]);return c}(n.a),l=function(){function a(b){m(this,a);this.name=b;this.attributeName=
"a"+this.name;this.getterName="get"+this.name}f(a,[{key:"defineShader",value:function(a){a.addAttribute("highp vec4",this.attributeName);a.addVertexCode("\nfloat "+this.getterName+" () {\n  vec4 temp = "+this.attributeName+";\n  return temp.x + temp.y * 256.0 + temp.z * 65536.0;\n}\n")}},{key:"bind",value:function(a,d){a.bindToVertexAttrib(d.attribute(this.attributeName),4,b.j,!1)}},{key:"disable",value:function(a){a.gl.disableVertexAttribArray(a.attribute(this.attributeName))}}]);return a}()},function(n,
h,c){function m(a){a.setFragmentMain("gl_FragColor = getValue0();")}var e=c(23),a=c(18);h.a=m;h.b=function(b,d,f){d=void 0===d?m:d;f=void 0===f?1:f;return b.memoize.get("elementWiseTextureShader:"+f+":"+c.i(e.a)(d),function(){var c=new a.a(b);c.addVarying("vec2","vTexCoord");c.addUniform("sampler2D","uSampler",f);c.addInitializer(function(a){for(var d=[],c=0;c<f;++c)d[c]=c;b.uniform1iv(a.uniform("uSampler"),d)});for(var e=0;e<f;++e)c.addFragmentCode("\nvec4 getValue"+e+"() {\n  return texture2D(uSampler["+
e+"], vTexCoord);\n}\n");c.addUniform("mat4","uProjectionMatrix");c.require(d);c.addAttribute("vec4","aVertexPosition");c.addAttribute("vec2","aTexCoord");c.setVertexMain("vTexCoord = aTexCoord; gl_Position = uProjectionMatrix * aVertexPosition;");return c.build()})};h.c=function(b){return b.memoize.get("trivialColorShader",function(){var d=new a.a(b);d.addVarying("vec4","vColor");d.setFragmentMain("gl_FragColor = vColor;");d.addAttribute("vec4","aVertexPosition");d.addAttribute("vec4","aColor");
d.addUniform("mat4","uProjectionMatrix");d.setVertexMain("vColor = aColor; gl_Position = uProjectionMatrix * aVertexPosition;");return d.build()})}},function(n,h,c){h.a=function(c,a){""===a.id&&(a.id="unique-id-for-association-"+m++);c.setAttribute("for",a.id)};var m=0},function(n,h,c){function m(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function e(a,b){if("function"!==typeof b&&null!==
b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}n=c(0);var a=c(10);c.d(h,"a",function(){return f});var b=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}
return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),d=function l(a,b,d){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,b);if(void 0===c){if(a=Object.getPrototypeOf(a),null!==a)return l(a,b,d)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(d)}};c(173);var f=function(f){function l(a,b){var d=void 0===b?{}:b;b=void 0===d.min?0:d.min;var c=void 0===d.max?1:d.max,d=void 0===d.step?.01:d.step;if(!(this instanceof l))throw new TypeError("Cannot call a class as a function");
var e=m(this,(l.__proto__||Object.getPrototypeOf(l)).call(this));e.value=a;e.element=document.createElement("label");e.promptElement=document.createElement("span");e.inputElement=document.createElement("input");var f=e.element,h=e.promptElement,p=e.inputElement;f.className="range-slider";h.className="range-prompt";p.type="range";p.min=""+b;p.max=""+c;p.step=""+d;p.valueAsNumber=e.value.value;f.appendChild(h);f.appendChild(p);var r=function(){e.value.value=e.inputElement.valueAsNumber};e.registerEventListener(p,
"change",r);e.registerEventListener(p,"input",r);e.registerEventListener(p,"wheel",function(a){a=a.deltaY;0<a?(e.inputElement.stepUp(),r()):0>a&&(e.inputElement.stepDown(),r())});a.changed.add(function(){e.inputElement.valueAsNumber=e.value.value});return e}e(l,f);b(l,[{key:"disposed",value:function(){c.i(a.b)(this.element);d(l.prototype.__proto__||Object.getPrototypeOf(l.prototype),"disposed",this).call(this)}}]);return l}(n.a)},function(n,h,c){(function(c,e){n.exports=e()})(this,function(){function c(a){return new RegExp("(^|\\s)"+
a+"(?:$|\\s)\\s*")}function e(a){for(var b=a.childNodes.length;0<b;--b)a.removeChild(a.firstChild);return a}function a(a,b){return e(a).appendChild(b)}function b(a,b,d,c){a=document.createElement(a);d&&(a.className=d);c&&(a.style.cssText=c);if("string"==typeof b)a.appendChild(document.createTextNode(b));else if(b)for(d=0;d<b.length;++d)a.appendChild(b[d]);return a}function d(a,b){3==b.nodeType&&(b=b.parentNode);if(a.contains)return a.contains(b);do if(11==b.nodeType&&(b=b.host),b==a)return!0;while(b=
b.parentNode)}function f(){var a;try{a=document.activeElement}catch(w){a=document.body||null}for(;a&&a.root&&a.root.activeElement;)a=a.root.activeElement;return a}function g(a,b){var d=a.className;c(b).test(d)||(a.className+=(d?" ":"")+b)}function l(a,b){a=a.split(" ");for(var d=0;d<a.length;d++)a[d]&&!c(a[d]).test(b)&&(b+=" "+a[d]);return b}function h(a){var b=Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b)}}function p(a,b,d){b||(b={});for(var c in a)!a.hasOwnProperty(c)||
!1===d&&b.hasOwnProperty(c)||(b[c]=a[c]);return b}function r(a,b,d,c,e){null==b&&(b=a.search(/[^\s\u00a0]/),-1==b&&(b=a.length));c=c||0;for(e=e||0;;){var q=a.indexOf("\t",c);if(0>q||q>=b)return e+(b-c);e+=q-c;e+=d-e%d;c=q+1}}function k(a,b){for(var d=0;d<a.length;++d)if(a[d]==b)return d;return-1}function v(a,b,d){for(var c=0,q=0;;){var e=a.indexOf("\t",c);-1==e&&(e=a.length);var w=e-c;if(e==a.length||q+w>=b)return c+Math.min(w,b-q);q+=e-c;q+=d-q%d;c=e+1;if(q>=b)return c}}function t(a){for(;xc.length<=
a;)xc.push(n(xc)+" ");return xc[a]}function n(a){return a[a.length-1]}function x(a,b){for(var d=[],c=0;c<a.length;c++)d[c]=b(a[c],c);return d}function y(a,b,d){for(var c=0,q=d(b);c<a.length&&d(a[c])<=q;)c++;a.splice(c,0,b)}function C(){}function A(a,b){Object.create?a=Object.create(a):(C.prototype=a,a=new C);b&&p(b,a);return a}function D(a){return/\w/.test(a)||"\u0080"<a&&(a.toUpperCase()!=a.toLowerCase()||Hf.test(a))}function F(a,b){return b?-1<b.source.indexOf("\\w")&&D(a)?!0:b.test(a):D(a)}function G(a){for(var b in a)if(a.hasOwnProperty(b)&&
a[b])return!1;return!0}function z(a){return 768<=a.charCodeAt(0)&&If.test(a)}function L(a,b,d){for(;(0>d?0<b:b<a.length)&&z(a.charAt(b));)b+=d;return b}function J(a,b,d){for(;;){if(1>=Math.abs(b-d))return a(b)?b:d;var c=Math.floor((b+d)/2);a(c)?d=c:b=c}}function I(a,d,c){this.input=c;this.scrollbarFiller=b("div",null,"CodeMirror-scrollbar-filler");this.scrollbarFiller.setAttribute("cm-not-content","true");this.gutterFiller=b("div",null,"CodeMirror-gutter-filler");this.gutterFiller.setAttribute("cm-not-content",
"true");this.lineDiv=b("div",null,"CodeMirror-code");this.selectionDiv=b("div",null,null,"position: relative; z-index: 1");this.cursorDiv=b("div",null,"CodeMirror-cursors");this.measure=b("div",null,"CodeMirror-measure");this.lineMeasure=b("div",null,"CodeMirror-measure");this.lineSpace=b("div",[this.measure,this.lineMeasure,this.selectionDiv,this.cursorDiv,this.lineDiv],null,"position: relative; outline: none");this.mover=b("div",[b("div",[this.lineSpace],"CodeMirror-lines")],null,"position: relative");
this.sizer=b("div",[this.mover],"CodeMirror-sizer");this.sizerWidth=null;this.heightForcer=b("div",null,null,"position: absolute; height: 30px; width: 1px;");this.gutters=b("div",null,"CodeMirror-gutters");this.lineGutter=null;this.scroller=b("div",[this.sizer,this.heightForcer,this.gutters],"CodeMirror-scroll");this.scroller.setAttribute("tabIndex","-1");this.wrapper=b("div",[this.scrollbarFiller,this.gutterFiller,this.scroller],"CodeMirror");W&&8>aa&&(this.gutters.style.zIndex=-1,this.scroller.style.paddingRight=
0);la||Za&&Tb||(this.scroller.draggable=!0);a&&(a.appendChild?a.appendChild(this.wrapper):a(this.wrapper));this.reportedViewFrom=this.reportedViewTo=this.viewFrom=this.viewTo=d.first;this.view=[];this.externalMeasured=this.renderedView=null;this.lastWrapHeight=this.lastWrapWidth=this.viewOffset=0;this.updateLineNumbers=null;this.nativeBarWidth=this.barHeight=this.barWidth=0;this.scrollbarsClipped=!1;this.lineNumWidth=this.lineNumInnerWidth=this.lineNumChars=null;this.alignWidgets=!1;this.maxLine=
this.cachedCharWidth=this.cachedTextHeight=this.cachedPaddingH=null;this.maxLineLength=0;this.maxLineChanged=!1;this.wheelDX=this.wheelDY=this.wheelStartX=this.wheelStartY=null;this.shift=!1;this.activeTouch=this.selForContextMenu=null;c.init(this)}function E(a,b){b-=a.first;if(0>b||b>=a.size)throw Error("There is no line "+(b+a.first)+" in the document.");for(;!a.lines;)for(var d=0;;++d){var c=a.children[d],q=c.chunkSize();if(b<q){a=c;break}b-=q}return a.lines[b]}function U(a,b,d){var c=[],q=b.line;
a.iter(b.line,d.line+1,function(a){a=a.text;q==d.line&&(a=a.slice(0,d.ch));q==b.line&&(a=a.slice(b.ch));c.push(a);++q});return c}function V(a,b,d){var c=[];a.iter(b,d,function(a){c.push(a.text)});return c}function R(a,b){if(b-=a.height)for(;a;a=a.parent)a.height+=b}function P(a){if(null==a.parent)return null;var b=a.parent;a=k(b.lines,a);for(var d=b.parent;d;b=d,d=d.parent)for(var c=0;d.children[c]!=b;++c)a+=d.children[c].chunkSize();return a+b.first}function T(a,b){var d=a.first;a:do{for(var c=0;c<
a.children.length;++c){var q=a.children[c],e=q.height;if(b<e){a=q;continue a}b-=e;d+=q.chunkSize()}return d}while(!a.lines);for(c=0;c<a.lines.length;++c){q=a.lines[c].height;if(b<q)break;b-=q}return d+c}function ca(a,b){return b>=a.first&&b<a.first+a.size}function ga(a,b){return String(a.lineNumberFormatter(b+a.firstLineNumber))}function H(a,b,d){void 0===d&&(d=null);if(!(this instanceof H))return new H(a,b,d);this.line=a;this.ch=b;this.sticky=d}function O(a,b){return a.line-b.line||a.ch-b.ch}function da(a,
b){return a.sticky==b.sticky&&0==O(a,b)}function pa(a){return H(a.line,a.ch)}function za(a,b){return 0>O(a,b)?b:a}function ka(a,b){return 0>O(a,b)?a:b}function Q(a,b){if(b.line<a.first)return H(a.first,0);var d=a.first+a.size-1;if(b.line>d)return H(d,E(a,d).text.length);a=E(a,b.line).text.length;d=b.ch;b=null==d||d>a?H(b.line,a):0>d?H(b.line,0):b;return b}function wa(a,b){for(var d=[],c=0;c<b.length;c++)d[c]=Q(a,b[c]);return d}function Aa(a,b,d){this.marker=a;this.from=b;this.to=d}function Ta(a,b){if(a)for(var d=
0;d<a.length;++d){var c=a[d];if(c.marker==b)return c}}function Sb(a,b){if(b.full)return null;var d=ca(a,b.from.line)&&E(a,b.from.line).markedSpans,c=ca(a,b.to.line)&&E(a,b.to.line).markedSpans;if(!d&&!c)return null;a=b.from.ch;var q=b.to.ch,e=0==O(b.from,b.to),w;if(d)for(var f=0;f<d.length;++f){var g=d[f],k=g.marker;if(null==g.from||(k.inclusiveLeft?g.from<=a:g.from<a)||!(g.from!=a||"bookmark"!=k.type||e&&g.marker.insertLeft)){var l=null==g.to||(k.inclusiveRight?g.to>=a:g.to>a);(w||(w=[])).push(new Aa(k,
g.from,l?null:g.to))}}var d=w,h;if(c)for(w=0;w<c.length;++w)if(f=c[w],g=f.marker,null==f.to||(g.inclusiveRight?f.to>=q:f.to>q)||f.from==q&&"bookmark"==g.type&&(!e||f.marker.insertLeft))k=null==f.from||(g.inclusiveLeft?f.from<=q:f.from<q),(h||(h=[])).push(new Aa(g,k?null:f.from-q,null==f.to?null:f.to-q));c=1==b.text.length;q=n(b.text).length+(c?a:0);if(d)for(e=0;e<d.length;++e)if(w=d[e],null==w.to)(f=Ta(h,w.marker),f)?c&&(w.to=null==f.to?null:f.to+q):w.to=a;if(h)for(a=0;a<h.length;++a)e=h[a],null!=
e.to&&(e.to+=q),null==e.from?Ta(d,e.marker)||(e.from=q,c&&(d||(d=[])).push(e)):(e.from+=q,c&&(d||(d=[])).push(e));d&&(d=Ga(d));h&&h!=d&&(h=Ga(h));a=[d];if(!c){b=b.text.length-2;var p;if(0<b&&d)for(c=0;c<d.length;++c)null==d[c].to&&(p||(p=[])).push(new Aa(d[c].marker,null,null));for(d=0;d<b;++d)a.push(p);a.push(h)}return a}function Ga(a){for(var b=0;b<a.length;++b){var d=a[b];null!=d.from&&d.from==d.to&&!1!==d.marker.clearWhenEmpty&&a.splice(b--,1)}return a.length?a:null}function Ba(a,b,d){var c=null;
a.iter(b.line,d.line+1,function(a){if(a.markedSpans)for(var b=0;b<a.markedSpans.length;++b){var d=a.markedSpans[b].marker;!d.readOnly||c&&-1!=k(c,d)||(c||(c=[])).push(d)}});if(!c)return null;a=[{from:b,to:d}];for(b=0;b<c.length;++b){d=c[b];for(var q=d.find(0),e=0;e<a.length;++e){var w=a[e];if(!(0>O(w.to,q.from)||0<O(w.from,q.to))){var f=[e,1],g=O(w.from,q.from),M=O(w.to,q.to);(0>g||!d.inclusiveLeft&&!g)&&f.push({from:w.from,to:q.from});(0<M||!d.inclusiveRight&&!M)&&f.push({from:q.to,to:w.to});a.splice.apply(a,
f);e+=f.length-3}}}return a}function Y(a){var b=a.markedSpans;if(b){for(var d=0;d<b.length;++d)b[d].marker.detachLine(a);a.markedSpans=null}}function Qb(a,b){if(b){for(var d=0;d<b.length;++d)b[d].marker.attachLine(a);a.markedSpans=b}}function gb(a,b){var d=a.lines.length-b.lines.length;if(0!=d)return d;var d=a.find(),c=b.find(),q=O(d.from,c.from)||(a.inclusiveLeft?-1:0)-(b.inclusiveLeft?-1:0);return q?-q:(d=O(d.to,c.to)||(a.inclusiveRight?1:0)-(b.inclusiveRight?1:0))?d:b.id-a.id}function Ja(a,b){a=
$a&&a.markedSpans;var d;if(a)for(var c,q=0;q<a.length;++q)c=a[q],c.marker.collapsed&&null==(b?c.from:c.to)&&(!d||0>gb(d,c.marker))&&(d=c.marker);return d}function rb(a,b,d,c,e){a=E(a,b);if(a=$a&&a.markedSpans)for(b=0;b<a.length;++b){var q=a[b];if(q.marker.collapsed){var w=q.marker.find(0),f=O(w.from,d)||(q.marker.inclusiveLeft?-1:0)-(e.inclusiveLeft?-1:0),K=O(w.to,c)||(q.marker.inclusiveRight?1:0)-(e.inclusiveRight?1:0);if(!(0<=f&&0>=K||0>=f&&0<=K)&&(0>=f&&(q.marker.inclusiveRight&&e.inclusiveLeft?
0<=O(w.to,d):0<O(w.to,d))||0<=f&&(q.marker.inclusiveRight&&e.inclusiveLeft?0>=O(w.from,c):0>O(w.from,c))))return!0}}}function Fa(a){for(var b;b=Ja(a,!0);)a=b.find(-1,!0).line;return a}function Pa(a,b){a=E(a,b);var d=Fa(a);return a==d?b:P(d)}function sb(a,b){if(b>a.lastLine())return b;var d=E(a,b);if(!xa(a,d))return b;for(;a=Ja(d,!1);)d=a.find(1,!0).line;return P(d)+1}function xa(a,b){var d=$a&&b.markedSpans;if(d)for(var c,q=0;q<d.length;++q)if(c=d[q],c.marker.collapsed&&(null==c.from||!c.marker.widgetNode&&
0==c.from&&c.marker.inclusiveLeft&&Rb(a,b,c)))return!0}function Rb(a,b,d){if(null==d.to)return b=d.marker.find(1,!0),Rb(a,b.line,Ta(b.line.markedSpans,d.marker));if(d.marker.inclusiveRight&&d.to==b.text.length)return!0;for(var c,q=0;q<b.markedSpans.length;++q)if(c=b.markedSpans[q],c.marker.collapsed&&!c.marker.widgetNode&&c.from==d.to&&(null==c.to||c.to!=d.from)&&(c.marker.inclusiveLeft||d.marker.inclusiveRight)&&Rb(a,b,c))return!0}function ya(a){a=Fa(a);for(var b=0,d=a.parent,c=0;c<d.lines.length;++c){var q=
d.lines[c];if(q==a)break;else b+=q.height}for(a=d.parent;a;d=a,a=d.parent)for(c=0;c<a.children.length&&(q=a.children[c],q!=d);++c)b+=q.height;return b}function Ha(a){if(0==a.height)return 0;for(var b=a.text.length,d,c=a;d=Ja(c,!0);)d=d.find(0,!0),c=d.from.line,b+=d.from.ch-d.to.ch;for(c=a;d=Ja(c,!1);)a=d.find(0,!0),b-=c.text.length-a.from.ch,c=a.to.line,b+=c.text.length-a.to.ch;return b}function Ub(a){var b=a.display;a=a.doc;b.maxLine=E(a,a.first);b.maxLineLength=Ha(b.maxLine);b.maxLineChanged=!0;
a.iter(function(a){var d=Ha(a);d>b.maxLineLength&&(b.maxLineLength=d,b.maxLine=a)})}function yc(a,b,d,c){if(!a)return c(b,d,"ltr");for(var q=!1,e=0;e<a.length;++e){var w=a[e];if(w.from<d&&w.to>b||b==d&&w.to==b)c(Math.max(w.from,b),Math.min(w.to,d),1==w.level?"rtl":"ltr"),q=!0}q||c(b,d,"ltr")}function zc(a,b,d){var c;Vb=null;for(var q=0;q<a.length;++q){var e=a[q];if(e.from<b&&e.to>b)return q;e.to==b&&(e.from!=e.to&&"before"==d?c=q:Vb=q);e.from==b&&(e.from!=e.to&&"before"!=d?c=q:Vb=q)}return null!=
c?c:Vb}function ab(a){var b=a.order;null==b&&(b=a.order=Jf(a.text));return b}function Ac(a,b,d){b=L(a.text,b+d,d);return 0>b||b>a.text.length?null:b}function $c(a,b,d){a=Ac(a,b.ch,d);return null==a?null:new H(b.line,a,0>d?"after":"before")}function ad(a,b,d,c,e){if(a&&(a=ab(d))){a=0>e?n(a):a[0];var q=0>e==(1==a.level)?"after":"before",w;if(0<a.level){var f=tb(b,d);w=0>e?d.text.length-1:0;var g=Ua(b,f,w).top;w=J(function(a){return Ua(b,f,a).top==g},0>e==(1==a.level)?a.from:a.to-1,w);"before"==q&&(w=
Ac(d,w,1,!0))}else w=0>e?a.to:a.from;return new H(c,w,q)}return new H(c,0>e?d.text.length:0,0>e?"before":"after")}function Rd(a,b,d,c){var q=ab(b);if(!q)return $c(b,d,c);d.ch>=b.text.length?(d.ch=b.text.length,d.sticky="before"):0>=d.ch&&(d.ch=0,d.sticky="after");var e=zc(q,d.ch,d.sticky),w=q[e];if(0==w.level%2&&(0<c?w.to>d.ch:w.from<d.ch))return $c(b,d,c);var f=function(a,d){return Ac(b,a instanceof H?a.ch:a,d)},g,K=function(d){if(!a.options.lineWrapping)return{begin:0,end:b.text.length};var c=g=
g||tb(a,b);d=hb(a,b,Ua(a,c,d),"line").top;return Sd(a,b,c,d)},M=K("before"==d.sticky?f(d,-1):d.ch);if(1==w.level%2){var k=f(d,-c);if(null!=k&&(0<c?k>=w.from&&k>=M.begin:k<=w.to&&k<=M.end))return new H(d.line,k,0>c?"before":"after")}w=function(a,b,c){for(var e=function(a,b){return b?new H(d.line,f(a,1),"before"):new H(d.line,a,"after")};0<=a&&a<q.length;a+=b){var w=q[a],g=0<b==(1!=w.level),K=g?c.begin:f(c.end,-1);if(w.from<=K&&K<w.to)return e(K,g);K=g?w.from:f(w.to,-1);if(c.begin<=K&&K<c.end)return e(K,
g)}};if(e=w(e+c,c,M))return e;M=0<c?M.end:f(M.begin,-1);return null==M||0<c&&M==b.text.length||!(e=w(0<c?0:q.length-1,c,K(M)))?null:e}function Ka(a,b,d){if(a.removeEventListener)a.removeEventListener(b,d,!1);else if(a.detachEvent)a.detachEvent("on"+b,d);else{var c=(a=a._handlers)&&a[b];c&&(d=k(c,d),-1<d&&(a[b]=c.slice(0,d).concat(c.slice(d+1))))}}function ea(a,b){var d=a._handlers&&a._handlers[b]||Bc;if(d.length)for(var c=Array.prototype.slice.call(arguments,2),q=0;q<d.length;++q)d[q].apply(null,
c)}function ha(a,b,d){"string"==typeof b&&(b={type:b,preventDefault:function(){this.defaultPrevented=!0}});ea(a,d||b.type,a,b);return bd(b)||b.codemirrorIgnore}function Td(a){var b=a._handlers&&a._handlers.cursorActivity;if(b){a=a.curOp.cursorActivityHandlers||(a.curOp.cursorActivityHandlers=[]);for(var d=0;d<b.length;++d)-1==k(a,b[d])&&a.push(b[d])}}function Ia(a,b){return 0<(a._handlers&&a._handlers[b]||Bc).length}function ub(a){a.prototype.on=function(a,b){S(this,a,b)};a.prototype.off=function(a,
b){Ka(this,a,b)}}function qa(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function Ud(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0}function bd(a){return null!=a.defaultPrevented?a.defaultPrevented:0==a.returnValue}function Wb(a){qa(a);Ud(a)}function Vd(a){var b=a.which;null==b&&(a.button&1?b=1:a.button&2?b=3:a.button&4&&(b=2));La&&a.ctrlKey&&1==b&&(b=3);return b}function Kf(d){if(null==cd){var c=b("span","\u200b");a(d,b("span",[c,document.createTextNode("x")]));0!=d.firstChild.offsetHeight&&
(cd=1>=c.offsetWidth&&2<c.offsetHeight&&!(W&&8>aa))}d=cd?b("span","\u200b"):b("span","\u00a0",null,"display: inline-block; width: 1px; margin-right: -1px");d.setAttribute("cm-text","");return d}function Lf(a,b){2<arguments.length&&(b.dependencies=Array.prototype.slice.call(arguments,2));dd[a]=b}function Cc(a){if("string"==typeof a&&vb.hasOwnProperty(a))a=vb[a];else if(a&&"string"==typeof a.name&&vb.hasOwnProperty(a.name)){var b=vb[a.name];"string"==typeof b&&(b={name:b});a=A(b,a);a.name=b.name}else{if("string"==
typeof a&&/^[\w\-]+\/[\w\-]+\+xml$/.test(a))return Cc("application/xml");if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+json$/.test(a))return Cc("application/json")}return"string"==typeof a?{name:a}:a||{name:"null"}}function ed(a,b){b=Cc(b);var d=dd[b.name];if(!d)return ed(a,"text/plain");a=d(a,b);if(wb.hasOwnProperty(b.name)){var d=wb[b.name],c;for(c in d)d.hasOwnProperty(c)&&(a.hasOwnProperty(c)&&(a["_"+c]=a[c]),a[c]=d[c])}a.name=b.name;b.helperType&&(a.helperType=b.helperType);if(b.modeProps)for(var q in b.modeProps)a[q]=
b.modeProps[q];return a}function Mf(a,b){a=wb.hasOwnProperty(a)?wb[a]:wb[a]={};p(b,a)}function Va(a,b){if(!0===b)return b;if(a.copyState)return a.copyState(b);a={};for(var d in b){var c=b[d];c instanceof Array&&(c=c.concat([]));a[d]=c}return a}function fd(a,b){for(var d;a.innerMode;){d=a.innerMode(b);if(!d||d.mode==a)break;b=d.state;a=d.mode}return d||{mode:a,state:b}}function Wd(a,b,d){return a.startState?a.startState(b,d):!0}function Xd(a,b,d,c){var q=[a.state.modeGen],e={};Yd(a,b.text,a.doc.mode,
d,function(a,b){return q.push(a,b)},e,c);d=function(d){var c=a.state.overlays[d],w=1,f=0;Yd(a,b.text,c.mode,!0,function(a,b){for(var d=w;f<a;){var e=q[w];e>a&&q.splice(w,1,a,q[w+1],e);w+=2;f=Math.min(a,e)}if(b)if(c.opaque)q.splice(d,w-d,a,"overlay "+b),w=d+2;else for(;d<w;d+=2)a=q[d+1],q[d+1]=(a?a+" ":"")+"overlay "+b},e)};for(c=0;c<a.state.overlays.length;++c)d(c);return{styles:q,classes:e.bgClass||e.textClass?e:null}}function Zd(a,b,d){if(!b.styles||b.styles[0]!=a.state.modeGen){var c=Xb(a,P(b)),
q=Xd(a,b,b.text.length>a.options.maxHighlightLength?Va(a.doc.mode,c):c);b.stateAfter=c;b.styles=q.styles;q.classes?b.styleClasses=q.classes:b.styleClasses&&(b.styleClasses=null);d===a.doc.frontier&&a.doc.frontier++}return b.styles}function Xb(a,b,d){var c=a.doc,q=a.display;if(!c.mode.startState)return!0;var e=Nf(a,b,d),w=e>c.first&&E(c,e-1).stateAfter,w=w?Va(c.mode,w):Wd(c.mode);c.iter(e,b,function(d){gd(a,d.text,w);d.stateAfter=e==b-1||0==e%5||e>=q.viewFrom&&e<q.viewTo?Va(c.mode,w):null;++e});d&&
(c.frontier=e);return w}function gd(a,b,d,c){var q=a.doc.mode;a=new ia(b,a.options.tabSize);a.start=a.pos=c||0;for(""==b&&$d(q,d);!a.eol();)hd(q,a,d),a.start=a.pos}function $d(a,b){if(a.blankLine)return a.blankLine(b);if(a.innerMode&&(a=fd(a,b),a.mode.blankLine))return a.mode.blankLine(a.state)}function hd(a,b,d,c){for(var q=0;10>q;q++){c&&(c[0]=fd(a,d).mode);var e=a.token(b,d);if(b.pos>b.start)return e}throw Error("Mode "+a.name+" failed to advance stream.");}function ae(a,b,d,c){var q=function(a){return{start:k.start,
end:k.pos,string:k.current(),type:f||null,state:a?Va(e.mode,K):K}},e=a.doc,w=e.mode,f;b=Q(e,b);var g=E(e,b.line),K=Xb(a,b.line,d),k=new ia(g.text,a.options.tabSize),M;for(c&&(M=[]);(c||k.pos<b.ch)&&!k.eol();)k.start=k.pos,f=hd(w,k,K),c&&M.push(q(!0));return c?M:q()}function be(a,b){if(a)for(;;){var d=a.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!d)break;a=a.slice(0,d.index)+a.slice(d.index+d[0].length);var c=d[1]?"bgClass":"textClass";null==b[c]?b[c]=d[2]:(new RegExp("(?:^|s)"+d[2]+"(?:$|s)")).test(b[c])||
(b[c]+=" "+d[2])}return a}function Yd(a,b,d,c,e,f,g){var q=d.flattenSpans;null==q&&(q=a.options.flattenSpans);var w=0,K=null,k=new ia(b,a.options.tabSize),M,l=a.options.addModeClass&&[null];for(""==b&&be($d(d,c),f);!k.eol();){k.pos>a.options.maxHighlightLength?(q=!1,g&&gd(a,b,c,k.pos),k.pos=b.length,M=null):M=be(hd(d,k,c,l),f);if(l){var N=l[0].name;N&&(M="m-"+(M?N+" "+M:N))}if(!q||K!=M){for(;w<k.start;)w=Math.min(k.start,w+5E3),e(w,K);K=M}k.start=k.pos}for(;w<k.pos;)a=Math.min(k.pos,w+5E3),e(a,K),
w=a}function Nf(a,b,d){for(var c,q,e=a.doc,f=d?-1:b-(a.doc.mode.innerMode?1E3:100);b>f;--b){if(b<=e.first)return e.first;var w=E(e,b-1);if(w.stateAfter&&(!d||b<=e.frontier))return b;w=r(w.text,null,a.options.tabSize);if(null==q||c>w)q=b-1,c=w}return q}function ce(a,b){if(!a||/^\s*$/.test(a))return null;b=b.addModeClass?Of:Pf;return b[a]||(b[a]=a.replace(/\S+/g,"cm-$&"))}function de(d,c){var q=b("span",null,null,la?"padding-right: .1px":null),f={pre:b("pre",[q],"CodeMirror-line"),content:q,col:0,pos:0,
cm:d,trailingSpace:!1,splitSpaces:(W||la)&&d.getOption("lineWrapping")};q.setAttribute("role","presentation");f.pre.setAttribute("role","presentation");c.measure={};for(q=0;q<=(c.rest?c.rest.length:0);q++){var w=q?c.rest[q-1]:c.line,g=void 0;f.pos=0;f.addToken=Qf;var k;k=d.display.measure;if(null!=id)k=id;else{var h=a(k,document.createTextNode("A\u062eA")),p=xb(h,0,1).getBoundingClientRect(),h=xb(h,1,2).getBoundingClientRect();e(k);k=p&&p.left!=p.right?id=3>h.right-p.right:!1}k&&(g=ab(w))&&(f.addToken=
Rf(f.addToken,g));f.map=[];var r=c!=d.display.externalMeasured&&P(w);a:{var u=h=p=k=void 0,t=void 0,m=void 0,v=void 0,g=f,r=Zd(d,w,r),z=w.markedSpans,n=w.text,A=0;if(z)for(var B=n.length,G=0,y=1,F="",x=0;;){if(x==G){t=u=h=p=m="";k=null;for(var x=Infinity,L=[],D=void 0,J=0;J<z.length;++J){var C=z[J],E=C.marker;"bookmark"==E.type&&C.from==G&&E.widgetNode?L.push(E):C.from<=G&&(null==C.to||C.to>G||E.collapsed&&C.to==G&&C.from==G)?(null!=C.to&&C.to!=G&&x>C.to&&(x=C.to,u=""),E.className&&(t+=" "+E.className),
E.css&&(m=(m?m+";":"")+E.css),E.startStyle&&C.from==G&&(h+=" "+E.startStyle),E.endStyle&&C.to==x&&(D||(D=[])).push(E.endStyle,C.to),E.title&&!p&&(p=E.title),E.collapsed&&(!k||0>gb(k.marker,E))&&(k=C)):C.from>G&&x>C.from&&(x=C.from)}if(D)for(J=0;J<D.length;J+=2)D[J+1]==x&&(u+=" "+D[J]);if(!k||k.from==G)for(D=0;D<L.length;++D)ee(g,0,L[D]);if(k&&(k.from||0)==G){ee(g,(null==k.to?B+1:k.to)-G,k.marker,null==k.from);if(null==k.to)break a;k.to==G&&(k=!1)}}if(G>=B)break;for(L=Math.min(B,x);;){if(F){D=G+F.length;
k||(J=D>L?F.slice(0,L-G):F,g.addToken(g,J,v?v+t:t,h,G+J.length==x?u:"",p,m));if(D>=L){F=F.slice(L-G);G=L;break}G=D;h=""}F=n.slice(A,A=r[y++]);v=ce(r[y++],g.cm.options)}}else for(k=1;k<r.length;k+=2)g.addToken(g,n.slice(A,A=r[k]),ce(r[k+1],g.cm.options))}w.styleClasses&&(w.styleClasses.bgClass&&(f.bgClass=l(w.styleClasses.bgClass,f.bgClass||"")),w.styleClasses.textClass&&(f.textClass=l(w.styleClasses.textClass,f.textClass||"")));0==f.map.length&&f.map.push(0,0,f.content.appendChild(Kf(d.display.measure)));
0==q?(c.measure.map=f.map,c.measure.cache={}):((c.measure.maps||(c.measure.maps=[])).push(f.map),(c.measure.caches||(c.measure.caches=[])).push({}))}la&&(q=f.content.lastChild,/\bcm-tab\b/.test(q.className)||q.querySelector&&q.querySelector(".cm-tab"))&&(f.content.className="cm-tab-wrap-hack");ea(d,"renderLine",d,c.line,f.pre);f.pre.className&&(f.textClass=l(f.pre.className,f.textClass||""));return f}function Sf(a){var d=b("span","\u2022","cm-invalidchar");d.title="\\u"+a.charCodeAt(0).toString(16);
d.setAttribute("aria-label",d.title);return d}function Qf(a,d,c,e,f,g,k){if(d){var q;if(a.splitSpaces)if(q=a.trailingSpace,1<d.length&&!/  /.test(d))q=d;else{for(var w="",K=0;K<d.length;K++){var M=d.charAt(K);" "!=M||!q||K!=d.length-1&&32!=d.charCodeAt(K+1)||(M="\u00a0");w+=M;q=" "==M}q=w}else q=d;w=q;K=a.cm.state.specialChars;M=!1;if(K.test(d)){q=document.createDocumentFragment();for(var l=0;;){K.lastIndex=l;var N=K.exec(d),h=N?N.index-l:d.length-l;if(h){var p=document.createTextNode(w.slice(l,l+
h));W&&9>aa?q.appendChild(b("span",[p])):q.appendChild(p);a.map.push(a.pos,a.pos+h,p);a.col+=h;a.pos+=h}if(!N)break;l+=h+1;"\t"==N[0]?(N=a.cm.options.tabSize,N-=a.col%N,h=q.appendChild(b("span",t(N),"cm-tab")),h.setAttribute("role","presentation"),h.setAttribute("cm-text","\t"),a.col+=N):("\r"==N[0]||"\n"==N[0]?(h=q.appendChild(b("span","\r"==N[0]?"\u240d":"\u2424","cm-invalidchar")),h.setAttribute("cm-text",N[0])):(h=a.cm.options.specialCharPlaceholder(N[0]),h.setAttribute("cm-text",N[0]),W&&9>aa?
q.appendChild(b("span",[h])):q.appendChild(h)),a.col+=1);a.map.push(a.pos,a.pos+1,h);a.pos++}}else a.col+=d.length,q=document.createTextNode(w),a.map.push(a.pos,a.pos+d.length,q),W&&9>aa&&(M=!0),a.pos+=d.length;a.trailingSpace=32==w.charCodeAt(d.length-1);if(c||e||f||M||k)return d=c||"",e&&(d+=e),f&&(d+=f),e=b("span",[q],d,k),g&&(e.title=g),a.content.appendChild(e);a.content.appendChild(q)}}function Rf(a,b){return function(d,c,q,e,f,w,g){q=q?q+" cm-force-border":"cm-force-border";for(var K=d.pos,
k=K+c.length;;){for(var M=void 0,l=0;l<b.length&&!(M=b[l],M.to>K&&M.from<=K);l++);if(M.to>=k)return a(d,c,q,e,f,w,g);a(d,c.slice(0,M.to-K),q,e,null,w,g);e=null;c=c.slice(M.to-K);K=M.to}}}function ee(a,b,d,c){var q=!c&&d.widgetNode;q&&a.map.push(a.pos,a.pos+b,q);!c&&a.cm.display.input.needsContentAttribute&&(q||(q=a.content.appendChild(document.createElement("span"))),q.setAttribute("cm-marker",d.id));q&&(a.cm.display.input.setUneditable(q),a.content.appendChild(q));a.pos+=b;a.trailingSpace=!1}function fe(a,
b,d){for(var c=this.line=b,q;c=Ja(c,!1);)c=c.find(1,!0).line,(q||(q=[])).push(c);this.size=(this.rest=q)?P(n(this.rest))-d+1:1;this.node=this.text=null;this.hidden=xa(a,b)}function Dc(a,b,d){var c=[],q;for(q=b;q<d;)b=new fe(a.doc,E(a.doc,q),q),q+=b.size,c.push(b);return c}function Tf(a,b){if(a=a.ownsGroup)try{var d=a.delayedCallbacks,c=0;do{for(;c<d.length;c++)d[c].call(null);for(var q=0;q<a.ops.length;q++){var e=a.ops[q];if(e.cursorActivityHandlers)for(;e.cursorActivityCalled<e.cursorActivityHandlers.length;)e.cursorActivityHandlers[e.cursorActivityCalled++].call(null,
e.cm)}}while(c<d.length)}finally{yb=null,b(a)}}function ma(a,b){var d=a._handlers&&a._handlers[b]||Bc;if(d.length){var c=Array.prototype.slice.call(arguments,2),q;yb?q=yb.delayedCallbacks:Yb?q=Yb:(q=Yb=[],setTimeout(Uf,0));for(var e=function(a){q.push(function(){return d[a].apply(null,c)})},f=0;f<d.length;++f)e(f)}}function Uf(){var a=Yb;Yb=null;for(var b=0;b<a.length;++b)a[b]()}function ge(a,b,d,c){for(var q=0;q<b.changes.length;q++){var e=b.changes[q];if("text"==e){var e=b,f=e.text.className,w=
he(a,e);e.text==e.node&&(e.node=w.pre);e.text.parentNode.replaceChild(w.pre,e.text);e.text=w.pre;w.bgClass!=e.bgClass||w.textClass!=e.textClass?(e.bgClass=w.bgClass,e.textClass=w.textClass,jd(e)):f&&(e.text.className=f)}else if("gutter"==e)ie(a,b,d,c);else if("class"==e)jd(b);else if("widget"==e){e=a;f=b;w=c;f.alignable&&(f.alignable=null);for(var g=f.node.firstChild,K;g;g=K)K=g.nextSibling,"CodeMirror-linewidget"==g.className&&f.node.removeChild(g);je(e,f,w)}}b.changes=null}function Zb(a){a.node==
a.text&&(a.node=b("div",null,null,"position: relative"),a.text.parentNode&&a.text.parentNode.replaceChild(a.node,a.text),a.node.appendChild(a.text),W&&8>aa&&(a.node.style.zIndex=2));return a.node}function he(a,b){var d=a.display.externalMeasured;return d&&d.line==b.line?(a.display.externalMeasured=null,b.measure=d.measure,d.built):de(a,b)}function jd(a){var d=a.bgClass?a.bgClass+" "+(a.line.bgClass||""):a.line.bgClass;d&&(d+=" CodeMirror-linebackground");if(a.background)d?a.background.className=d:
(a.background.parentNode.removeChild(a.background),a.background=null);else if(d){var c=Zb(a);a.background=c.insertBefore(b("div",null,d),c.firstChild)}a.line.wrapClass?Zb(a).className=a.line.wrapClass:a.node!=a.text&&(a.node.className="");a.text.className=(a.textClass?a.textClass+" "+(a.line.textClass||""):a.line.textClass)||""}function ie(a,d,c,e){d.gutter&&(d.node.removeChild(d.gutter),d.gutter=null);d.gutterBackground&&(d.node.removeChild(d.gutterBackground),d.gutterBackground=null);if(d.line.gutterClass){var q=
Zb(d);d.gutterBackground=b("div",null,"CodeMirror-gutter-background "+d.line.gutterClass,"left: "+(a.options.fixedGutter?e.fixedPos:-e.gutterTotalWidth)+"px; width: "+e.gutterTotalWidth+"px");q.insertBefore(d.gutterBackground,d.text)}q=d.line.gutterMarkers;if(a.options.lineNumbers||q){var f=Zb(d),w=d.gutter=b("div",null,"CodeMirror-gutter-wrapper","left: "+(a.options.fixedGutter?e.fixedPos:-e.gutterTotalWidth)+"px");a.display.input.setUneditable(w);f.insertBefore(w,d.text);d.line.gutterClass&&(w.className+=
" "+d.line.gutterClass);!a.options.lineNumbers||q&&q["CodeMirror-linenumbers"]||(d.lineNumber=w.appendChild(b("div",ga(a.options,c),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+e.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+a.display.lineNumInnerWidth+"px")));if(q)for(d=0;d<a.options.gutters.length;++d)c=a.options.gutters[d],(f=q.hasOwnProperty(c)&&q[c])&&w.appendChild(b("div",[f],"CodeMirror-gutter-elt","left: "+e.gutterLeft[c]+"px; width: "+e.gutterWidth[c]+"px"))}}function Vf(a,
b,d,c){var q=he(a,b);b.text=b.node=q.pre;q.bgClass&&(b.bgClass=q.bgClass);q.textClass&&(b.textClass=q.textClass);jd(b);ie(a,b,d,c);je(a,b,c);return b.node}function je(a,b,d){ke(a,b.line,b,d,!0);if(b.rest)for(var c=0;c<b.rest.length;c++)ke(a,b.rest[c],b,d,!1)}function ke(a,d,c,e,f){if(d.widgets){var q=Zb(c),w=0;for(d=d.widgets;w<d.length;++w){var g=d[w],K=b("div",[g.node],"CodeMirror-linewidget");g.handleMouseEvents||K.setAttribute("cm-ignore-events","true");var k=g,l=K,M=e;if(k.noHScroll){(c.alignable||
(c.alignable=[])).push(l);var h=M.wrapperWidth;l.style.left=M.fixedPos+"px";k.coverGutter||(h-=M.gutterTotalWidth,l.style.paddingLeft=M.gutterTotalWidth+"px");l.style.width=h+"px"}k.coverGutter&&(l.style.zIndex=5,l.style.position="relative",k.noHScroll||(l.style.marginLeft=-M.gutterTotalWidth+"px"));a.display.input.setUneditable(K);f&&g.above?q.insertBefore(K,c.gutter||c.text):q.appendChild(K);ma(g,"redraw")}}}function $b(c){if(null!=c.height)return c.height;var q=c.doc.cm;if(!q)return 0;if(!d(document.body,
c.node)){var e="position: relative;";c.coverGutter&&(e+="margin-left: -"+q.display.gutters.offsetWidth+"px;");c.noHScroll&&(e+="width: "+q.display.wrapper.clientWidth+"px;");a(q.display.measure,b("div",[c.node],null,e))}return c.height=c.node.parentNode.offsetHeight}function Wa(a,b){for(b=b.target||b.srcElement;b!=a.wrapper;b=b.parentNode)if(!b||1==b.nodeType&&"true"==b.getAttribute("cm-ignore-events")||b.parentNode==a.sizer&&b!=a.mover)return!0}function kd(a){return a.mover.offsetHeight-a.lineSpace.offsetHeight}
function le(d){if(d.cachedPaddingH)return d.cachedPaddingH;var c=a(d.measure,b("pre","x")),c=window.getComputedStyle?window.getComputedStyle(c):c.currentStyle,c={left:parseInt(c.paddingLeft),right:parseInt(c.paddingRight)};isNaN(c.left)||isNaN(c.right)||(d.cachedPaddingH=c);return c}function Qa(a){return 30-a.display.nativeBarWidth}function ib(a){return a.display.scroller.clientWidth-Qa(a)-a.display.barWidth}function ld(a){return a.display.scroller.clientHeight-Qa(a)-a.display.barHeight}function me(a,
b,d){if(a.line==b)return{map:a.measure.map,cache:a.measure.cache};for(var c=0;c<a.rest.length;c++)if(a.rest[c]==b)return{map:a.measure.maps[c],cache:a.measure.caches[c]};for(b=0;b<a.rest.length;b++)if(P(a.rest[b])>d)return{map:a.measure.maps[b],cache:a.measure.caches[b],before:!0}}function md(a,b){if(b>=a.display.viewFrom&&b<a.display.viewTo)return a.display.view[jb(a,b)];if((a=a.display.externalMeasured)&&b>=a.lineN&&b<a.lineN+a.size)return a}function tb(b,d){var c=P(d),q=md(b,c);q&&!q.text?q=null:
q&&q.changes&&(ge(b,q,c,nd(b)),b.curOp.forceUpdate=!0);if(!q){var e;e=Fa(d);q=P(e);e=b.display.externalMeasured=new fe(b.doc,e,q);e.lineN=q;q=e.built=de(b,e);e.text=q.pre;a(b.display.lineMeasure,q.pre);q=e}b=me(q,d,c);return{line:d,view:q,rect:null,map:b.map,cache:b.cache,before:b.before,hasHeights:!1}}function Ua(d,c,e,f,g){c.before&&(e=-1);var q=e+(f||"");if(c.cache.hasOwnProperty(q))d=c.cache[q];else{c.rect||(c.rect=c.view.text.getBoundingClientRect());if(!c.hasHeights){var w=c.view,K=c.rect,k=
d.options.lineWrapping,l=k&&ib(d);if(!w.measure.heights||k&&w.measure.width!=l){var M=w.measure.heights=[];if(k)for(w.measure.width=l,w=w.text.firstChild.getClientRects(),k=0;k<w.length-1;k++){var l=w[k],h=w[k+1];2<Math.abs(l.bottom-h.bottom)&&M.push((l.bottom+h.top)/2-K.top)}M.push(K.bottom-K.top)}c.hasHeights=!0}M=f;w=ne(c.map,e,M);f=w.node;K=w.start;k=w.end;e=w.collapse;var N;if(3==f.nodeType){for(var p=0;4>p;p++){for(;K&&z(c.line.text.charAt(w.coverStart+K));)--K;for(;w.coverStart+k<w.coverEnd&&
z(c.line.text.charAt(w.coverStart+k));)++k;if(W&&9>aa&&0==K&&k==w.coverEnd-w.coverStart)N=f.parentNode.getBoundingClientRect();else{N=xb(f,K,k).getClientRects();k=oe;if("left"==M)for(l=0;l<N.length&&(k=N[l]).left==k.right;l++);else for(l=N.length-1;0<=l&&(k=N[l]).left==k.right;l--);N=k}if(N.left||N.right||0==K)break;k=K;--K;e="right"}W&&11>aa&&((p=!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI)||(null!=od?p=od:(M=a(d.display.measure,b("span","x")),p=M.getBoundingClientRect(),
M=xb(M,0,1).getBoundingClientRect(),p=od=1<Math.abs(p.left-M.left)),p=!p),p||(p=screen.logicalXDPI/screen.deviceXDPI,M=screen.logicalYDPI/screen.deviceYDPI,N={left:N.left*p,right:N.right*p,top:N.top*M,bottom:N.bottom*M}))}else 0<K&&(e=M="right"),N=d.options.lineWrapping&&1<(p=f.getClientRects()).length?p["right"==M?p.length-1:0]:f.getBoundingClientRect();!(W&&9>aa)||K||N&&(N.left||N.right)||(N=(N=f.parentNode.getClientRects()[0])?{left:N.left,right:N.left+ac(d.display),top:N.top,bottom:N.bottom}:
oe);f=N.top-c.rect.top;K=N.bottom-c.rect.top;p=(f+K)/2;M=c.view.measure.heights;for(w=0;w<M.length-1&&!(p<M[w]);w++);e={left:("right"==e?N.right:N.left)-c.rect.left,right:("left"==e?N.left:N.right)-c.rect.left,top:w?M[w-1]:0,bottom:M[w]};N.left||N.right||(e.bogus=!0);d.options.singleCursorHeightPerLine||(e.rtop=f,e.rbottom=K);d=e;d.bogus||(c.cache[q]=d)}return{left:d.left,right:d.right,top:g?d.rtop:d.top,bottom:g?d.rbottom:d.bottom}}function ne(a,b,d){for(var c,q,e,f,w,g,k=0;k<a.length;k+=3){w=a[k];
g=a[k+1];if(b<w)q=0,e=1,f="left";else if(b<g)q=b-w,e=q+1;else if(k==a.length-3||b==g&&a[k+3]>b)e=g-w,q=e-1,b>=g&&(f="right");if(null!=q){c=a[k+2];w==g&&d==(c.insertLeft?"left":"right")&&(f=d);if("left"==d&&0==q)for(;k&&a[k-2]==a[k-3]&&a[k-1].insertLeft;)c=a[(k-=3)+2],f="left";if("right"==d&&q==g-w)for(;k<a.length-3&&a[k+3]==a[k+4]&&!a[k+5].insertLeft;)c=a[(k+=3)+2],f="right";break}}return{node:c,start:q,end:e,collapse:f,coverStart:w,coverEnd:g}}function pe(a){if(a.measure&&(a.measure.cache={},a.measure.heights=
null,a.rest))for(var b=0;b<a.rest.length;b++)a.measure.caches[b]={}}function qe(a){a.display.externalMeasure=null;e(a.display.lineMeasure);for(var b=0;b<a.display.view.length;b++)pe(a.display.view[b])}function bc(a){qe(a);a.display.cachedCharWidth=a.display.cachedTextHeight=a.display.cachedPaddingH=null;a.options.lineWrapping||(a.display.maxLineChanged=!0);a.display.lineNumChars=null}function hb(a,b,d,c,e){if(!e&&b.widgets)for(e=0;e<b.widgets.length;++e)if(b.widgets[e].above){var q=$b(b.widgets[e]);
d.top+=q;d.bottom+=q}if("line"==c)return d;c||(c="local");b=ya(b);b="local"==c?b+a.display.lineSpace.offsetTop:b-a.display.viewOffset;if("page"==c||"window"==c)a=a.display.lineSpace.getBoundingClientRect(),b+=a.top+("window"==c?0:window.pageYOffset||(document.documentElement||document.body).scrollTop),c=a.left+("window"==c?0:window.pageXOffset||(document.documentElement||document.body).scrollLeft),d.left+=c,d.right+=c;d.top+=b;d.bottom+=b;return d}function re(a,b,d){if("div"==d)return b;var c=b.left;
b=b.top;"page"==d?(c-=window.pageXOffset||(document.documentElement||document.body).scrollLeft,b-=window.pageYOffset||(document.documentElement||document.body).scrollTop):"local"!=d&&d||(d=a.display.sizer.getBoundingClientRect(),c+=d.left,b+=d.top);a=a.display.lineSpace.getBoundingClientRect();return{left:c-a.left,top:b-a.top}}function Ec(a,b,d,c,e){c||(c=E(a.doc,b.line));var q=c;b=b.ch;c=Ua(a,tb(a,c),b,e);return hb(a,q,c,d)}function Ma(a,b,d,c,e,f){function q(b,q){b=Ua(a,e,b,q?"right":"left",f);
q?b.left=b.right:b.right=b.left;return hb(a,c,b,d)}function w(a,b,d){return q(d?a-1:a,0!=g[b].level%2!=d)}c=c||E(a.doc,b.line);e||(e=tb(a,c));var g=ab(c),k=b.ch;b=b.sticky;k>=c.text.length?(k=c.text.length,b="before"):0>=k&&(k=0,b="after");if(!g)return q("before"==b?k-1:k,"before"==b);var K=zc(g,k,b),l=Vb,K=w(k,K,"before"==b);null!=l&&(K.other=w(k,l,"before"!=b));return K}function se(a,b){var d=0;b=Q(a.doc,b);a.options.lineWrapping||(d=ac(a.display)*b.ch);b=E(a.doc,b.line);a=ya(b)+a.display.lineSpace.offsetTop;
return{left:d,right:d,top:a,bottom:a+b.height}}function pd(a,b,d){var c=a.doc;d+=a.display.viewOffset;if(0>d)return a=H(c.first,0,null),a.xRel=-1,a.outside=!0,a;var q=T(c,d),e=c.first+c.size-1;if(q>e)return a=E(c,e).text.length,a=H(c.first+c.size-1,a,null),a.xRel=1,a.outside=!0,a;0>b&&(b=0);for(e=E(c,q);;)if(c=Wf(a,e,q,b,d),e=(q=Ja(e,!1))&&q.find(0,!0),q&&(c.ch>e.from.ch||c.ch==e.from.ch&&0<c.xRel))q=P(e=e.to.line);else return c}function Sd(a,b,d,c){var q=b.text.length,e=J(function(q){return hb(a,
b,Ua(a,d,q-1),"line").bottom<=c},q,0),q=J(function(q){return hb(a,b,Ua(a,d,q),"line").top>c},e,q);return{begin:e,end:q}}function Wf(a,b,d,c,e){e-=ya(b);var q=0,f=b.text.length,w=tb(a,b);if(ab(b)){if(a.options.lineWrapping){var g;g=Sd(a,b,w,e);q=g.begin;f=g.end;g}d=new H(d,q);var k=Ma(a,d,"line",b,w).left;g=k<c?1:-1;var K=k-c,l;do{k=K;l=d;d=Rd(a,b,d,g);if(null==d||d.ch<q||f<=("before"==d.sticky?d.ch-1:d.ch)){d=l;break}K=Ma(a,d,"line",b,w).left-c}while(0>g!=0>K&&Math.abs(K)<=Math.abs(k));if(Math.abs(K)>
Math.abs(k)){if(0>K==0>k)throw Error("Broke out of infinite loop in coordsCharInner");d=l}}else q=J(function(d){var q=hb(a,b,Ua(a,w,d),"line");return q.top>e?(f=Math.min(d,f),!0):q.bottom<=e?!1:q.left>c?!0:q.right<c?!1:c-q.left<q.right-c},q,f),q=L(b.text,q,1),d=new H(d,q,q==f?"before":"after");q=Ma(a,d,"line",b,w);if(e<q.top||q.bottom<e)d.outside=!0;d.xRel=c<q.left?-1:c>q.right?1:0;return d}function kb(d){if(null!=d.cachedTextHeight)return d.cachedTextHeight;if(null==lb){lb=b("pre");for(var c=0;49>
c;++c)lb.appendChild(document.createTextNode("x")),lb.appendChild(b("br"));lb.appendChild(document.createTextNode("x"))}a(d.measure,lb);c=lb.offsetHeight/50;3<c&&(d.cachedTextHeight=c);e(d.measure);return c||1}function ac(d){if(null!=d.cachedCharWidth)return d.cachedCharWidth;var c=b("span","xxxxxxxxxx"),q=b("pre",[c]);a(d.measure,q);c=c.getBoundingClientRect();c=(c.right-c.left)/10;2<c&&(d.cachedCharWidth=c);return c||10}function nd(a){for(var b=a.display,d={},c={},q=b.gutters.clientLeft,e=b.gutters.firstChild,
f=0;e;e=e.nextSibling,++f)d[a.options.gutters[f]]=e.offsetLeft+e.clientLeft+q,c[a.options.gutters[f]]=e.clientWidth;return{fixedPos:qd(b),gutterTotalWidth:b.gutters.offsetWidth,gutterLeft:d,gutterWidth:c,wrapperWidth:b.wrapper.clientWidth}}function qd(a){return a.scroller.getBoundingClientRect().left-a.sizer.getBoundingClientRect().left}function te(a){var b=kb(a.display),d=a.options.lineWrapping,c=d&&Math.max(5,a.display.scroller.clientWidth/ac(a.display)-3);return function(q){if(xa(a.doc,q))return 0;
var e=0;if(q.widgets)for(var f=0;f<q.widgets.length;f++)q.widgets[f].height&&(e+=q.widgets[f].height);return d?e+(Math.ceil(q.text.length/c)||1)*b:e+b}}function rd(a){var b=a.doc,d=te(a);b.iter(function(a){var b=d(a);b!=a.height&&R(a,b)})}function mb(a,b,d,c){var q=a.display;if(!d&&"true"==(b.target||b.srcElement).getAttribute("cm-not-content"))return null;var e,f;d=q.lineSpace.getBoundingClientRect();try{e=b.clientX-d.left,f=b.clientY-d.top}catch(Qd){return null}b=pd(a,e,f);var w;c&&1==b.xRel&&(w=
E(a.doc,b.line).text).length==b.ch&&(c=r(w,w.length,a.options.tabSize)-w.length,b=H(b.line,Math.max(0,Math.round((e-le(a.display).left)/ac(a.display))-c)));return b}function jb(a,b){if(b>=a.display.viewTo)return null;b-=a.display.viewFrom;if(0>b)return null;a=a.display.view;for(var d=0;d<a.length;d++)if(b-=a[d].size,0>b)return d}function cc(a){a.display.input.showSelection(a.display.input.prepareSelection())}function ue(a,b){for(var d=a.doc,c={},q=c.cursors=document.createDocumentFragment(),e=c.selection=
document.createDocumentFragment(),f=0;f<d.sel.ranges.length;f++)if(!1!==b||f!=d.sel.primIndex){var w=d.sel.ranges[f];if(!(w.from().line>=a.display.viewTo||w.to().line<a.display.viewFrom)){var g=w.empty();(g||a.options.showCursorWhenSelecting)&&ve(a,w.head,q);g||Xf(a,w,e)}}return c}function ve(a,d,c){d=Ma(a,d,"div",null,null,!a.options.singleCursorHeightPerLine);var e=c.appendChild(b("div","\u00a0","CodeMirror-cursor"));e.style.left=d.left+"px";e.style.top=d.top+"px";e.style.height=Math.max(0,d.bottom-
d.top)*a.options.cursorHeight+"px";d.other&&(a=c.appendChild(b("div","\u00a0","CodeMirror-cursor CodeMirror-secondarycursor")),a.style.display="",a.style.left=d.other.left+"px",a.style.top=d.other.top+"px",a.style.height=.85*(d.other.bottom-d.other.top)+"px")}function Xf(a,d,c){function e(a,d,c,e){0>d&&(d=0);d=Math.round(d);e=Math.round(e);g.appendChild(b("div",null,"CodeMirror-selected","position: absolute; left: "+a+"px;\n                             top: "+d+"px; width: "+(null==c?h-a:c)+"px;\n                             height: "+
(e-d)+"px"))}function q(b,d,c){var q=E(w,b),f=q.text.length,g,k;yc(ab(q),d||0,null==c?f:c,function(w,K,M){var p=Ec(a,H(b,w),"div",q,"left"),N,r;w==K?(N=p,M=r=p.left):(N=Ec(a,H(b,K-1),"div",q,"right"),"rtl"==M&&(M=p,p=N,N=M),M=p.left,r=N.right);null==d&&0==w&&(M=l);3<N.top-p.top&&(e(M,p.top,null,p.bottom),M=l,p.bottom<N.top&&e(M,p.bottom,null,N.top));null==c&&K==f&&(r=h);if(!g||p.top<g.top||p.top==g.top&&p.left<g.left)g=p;if(!k||N.bottom>k.bottom||N.bottom==k.bottom&&N.right>k.right)k=N;M<l+1&&(M=
l);e(M,N.top,r-M,N.bottom)});return{start:g,end:k}}var f=a.display,w=a.doc,g=document.createDocumentFragment(),k=le(a.display),l=k.left,h=Math.max(f.sizerWidth,ib(a)-f.sizer.offsetLeft)-k.right,f=d.from();d=d.to();if(f.line==d.line)q(f.line,f.ch,d.ch);else{var M=E(w,f.line),k=E(w,d.line),k=Fa(M)==Fa(k),f=q(f.line,f.ch,k?M.text.length+1:null).end;d=q(d.line,k?0:null,d.ch).start;k&&(f.top<d.top-2?(e(f.right,f.top,null,f.bottom),e(l,d.top,d.left,d.bottom)):e(f.right,f.top,d.left-f.right,f.bottom));f.bottom<
d.top&&e(l,f.bottom,null,d.top)}c.appendChild(g)}function sd(a){if(a.state.focused){var b=a.display;clearInterval(b.blinker);var d=!0;b.cursorDiv.style.visibility="";0<a.options.cursorBlinkRate?b.blinker=setInterval(function(){return b.cursorDiv.style.visibility=(d=!d)?"":"hidden"},a.options.cursorBlinkRate):0>a.options.cursorBlinkRate&&(b.cursorDiv.style.visibility="hidden")}}function we(a){a.state.focused||(a.display.input.focus(),td(a))}function Yf(a){a.state.delayingBlurEvent=!0;setTimeout(function(){a.state.delayingBlurEvent&&
(a.state.delayingBlurEvent=!1,dc(a))},100)}function td(a,b){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1);"nocursor"!=a.options.readOnly&&(a.state.focused||(ea(a,"focus",a,b),a.state.focused=!0,g(a.display.wrapper,"CodeMirror-focused"),a.curOp||a.display.selForContextMenu==a.doc.sel||(a.display.input.reset(),la&&setTimeout(function(){return a.display.input.reset(!0)},20)),a.display.input.receivedFocus()),sd(a))}function dc(a,b){a.state.delayingBlurEvent||(a.state.focused&&(ea(a,"blur",
a,b),a.state.focused=!1,zb(a.display.wrapper,"CodeMirror-focused")),clearInterval(a.display.blinker),setTimeout(function(){a.state.focused||(a.display.shift=!1)},150))}function ud(a){var b=a.display,d=b.view;if(b.alignWidgets||b.gutters.firstChild&&a.options.fixedGutter){for(var c=qd(b)-b.scroller.scrollLeft+a.doc.scrollLeft,e=b.gutters.offsetWidth,q=c+"px",f=0;f<d.length;f++)if(!d[f].hidden){a.options.fixedGutter&&(d[f].gutter&&(d[f].gutter.style.left=q),d[f].gutterBackground&&(d[f].gutterBackground.style.left=
q));var g=d[f].alignable;if(g)for(var k=0;k<g.length;k++)g[k].style.left=q}a.options.fixedGutter&&(b.gutters.style.left=c+e+"px")}}function xe(a){if(!a.options.lineNumbers)return!1;var d=a.doc,d=ga(a.options,d.first+d.size-1),c=a.display;if(d.length!=c.lineNumChars){var e=c.measure.appendChild(b("div",[b("div",d)],"CodeMirror-linenumber CodeMirror-gutter-elt")),q=e.firstChild.offsetWidth,e=e.offsetWidth-q;c.lineGutter.style.width="";c.lineNumInnerWidth=Math.max(q,c.lineGutter.offsetWidth-e)+1;c.lineNumWidth=
c.lineNumInnerWidth+e;c.lineNumChars=c.lineNumInnerWidth?d.length:-1;c.lineGutter.style.width=c.lineNumWidth+"px";vd(a);return!0}return!1}function Fc(a){a=a.display;for(var b=a.lineDiv.offsetTop,d=0;d<a.view.length;d++){var c=a.view[d],e;if(!c.hidden){if(W&&8>aa){var q=c.node.offsetTop+c.node.offsetHeight;e=q-b;b=q}else e=c.node.getBoundingClientRect(),e=e.bottom-e.top;q=c.line.height-e;2>e&&(e=kb(a));if(.001<q||-.001>q)if(R(c.line,e),ye(c.line),c.rest)for(e=0;e<c.rest.length;e++)ye(c.rest[e])}}}
function ye(a){if(a.widgets)for(var b=0;b<a.widgets.length;++b)a.widgets[b].height=a.widgets[b].node.parentNode.offsetHeight}function wd(a,b,d){var c=d&&null!=d.top?Math.max(0,d.top):a.scroller.scrollTop,c=Math.floor(c-a.lineSpace.offsetTop),e=d&&null!=d.bottom?d.bottom:c+a.wrapper.clientHeight,c=T(b,c),e=T(b,e);if(d&&d.ensure){var q=d.ensure.from.line;d=d.ensure.to.line;q<c?(c=q,e=T(b,ya(E(b,q))+a.wrapper.clientHeight)):Math.min(d,b.lastLine())>=e&&(c=T(b,ya(E(b,d))-a.wrapper.clientHeight),e=d)}return{from:c,
to:Math.max(e,c+1)}}function ec(a,b){2>Math.abs(a.doc.scrollTop-b)||(a.doc.scrollTop=b,Za||xd(a,{top:b}),a.display.scroller.scrollTop!=b&&(a.display.scroller.scrollTop=b),a.display.scrollbars.setScrollTop(b),Za&&xd(a),fc(a,100))}function Ab(a,b,d){(d?b==a.doc.scrollLeft:2>Math.abs(a.doc.scrollLeft-b))||(b=Math.min(b,a.display.scroller.scrollWidth-a.display.scroller.clientWidth),a.doc.scrollLeft=b,ud(a),a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft=b),a.display.scrollbars.setScrollLeft(b))}
function ze(a){var b=a.wheelDeltaX,d=a.wheelDeltaY;null==b&&a.detail&&a.axis==a.HORIZONTAL_AXIS&&(b=a.detail);null==d&&a.detail&&a.axis==a.VERTICAL_AXIS?d=a.detail:null==d&&(d=a.wheelDelta);return{x:b,y:d}}function Zf(a){a=ze(a);a.x*=Ca;a.y*=Ca;return a}function Ae(a,b){var d=ze(b),c=d.x,d=d.y,e=a.display,q=e.scroller,f=q.scrollWidth>q.clientWidth,g=q.scrollHeight>q.clientHeight;if(c&&f||d&&g){if(d&&La&&la){var f=b.target,w=e.view;a:for(;f!=q;f=f.parentNode)for(var k=0;k<w.length;k++)if(w[k].node==
f){a.display.currentWheelTarget=f;break a}}!c||Za||Na||null==Ca?(d&&null!=Ca&&(b=d*Ca,g=a.doc.scrollTop,f=g+e.wrapper.clientHeight,0>b?g=Math.max(0,g+b-50):f=Math.min(a.doc.height,f+b+50),xd(a,{top:g,bottom:f})),20>Gc&&(null==e.wheelStartX?(e.wheelStartX=q.scrollLeft,e.wheelStartY=q.scrollTop,e.wheelDX=c,e.wheelDY=d,setTimeout(function(){if(null!=e.wheelStartX){var a=q.scrollLeft-e.wheelStartX,b=q.scrollTop-e.wheelStartY,a=b&&e.wheelDY&&b/e.wheelDY||a&&e.wheelDX&&a/e.wheelDX;e.wheelStartX=e.wheelStartY=
null;a&&(Ca=(Ca*Gc+a)/(Gc+1),++Gc)}},200)):(e.wheelDX+=c,e.wheelDY+=d))):(d&&g&&ec(a,Math.max(0,Math.min(q.scrollTop+d*Ca,q.scrollHeight-q.clientHeight))),Ab(a,Math.max(0,Math.min(q.scrollLeft+c*Ca,q.scrollWidth-q.clientWidth))),(!d||d&&g)&&qa(b),e.wheelStartX=null)}}function gc(a){var b=a.display,d=b.gutters.offsetWidth,c=Math.round(a.doc.height+kd(a.display));return{clientHeight:b.scroller.clientHeight,viewHeight:b.wrapper.clientHeight,scrollWidth:b.scroller.scrollWidth,clientWidth:b.scroller.clientWidth,
viewWidth:b.wrapper.clientWidth,barLeft:a.options.fixedGutter?d:0,docHeight:c,scrollHeight:c+Qa(a)+b.barHeight,nativeBarWidth:b.nativeBarWidth,gutterWidth:d}}function Bb(a,b){b||(b=gc(a));var d=a.display.barWidth,c=a.display.barHeight;Be(a,b);for(b=0;4>b&&d!=a.display.barWidth||c!=a.display.barHeight;b++)d!=a.display.barWidth&&a.options.lineWrapping&&Fc(a),Be(a,gc(a)),d=a.display.barWidth,c=a.display.barHeight}function Be(a,b){var d=a.display,c=d.scrollbars.update(b);d.sizer.style.paddingRight=(d.barWidth=
c.right)+"px";d.sizer.style.paddingBottom=(d.barHeight=c.bottom)+"px";d.heightForcer.style.borderBottom=c.bottom+"px solid transparent";c.right&&c.bottom?(d.scrollbarFiller.style.display="block",d.scrollbarFiller.style.height=c.bottom+"px",d.scrollbarFiller.style.width=c.right+"px"):d.scrollbarFiller.style.display="";c.bottom&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(d.gutterFiller.style.display="block",d.gutterFiller.style.height=c.bottom+"px",d.gutterFiller.style.width=b.gutterWidth+
"px"):d.gutterFiller.style.display=""}function Ce(a){a.display.scrollbars&&(a.display.scrollbars.clear(),a.display.scrollbars.addClass&&zb(a.display.wrapper,a.display.scrollbars.addClass));a.display.scrollbars=new De[a.options.scrollbarStyle](function(b){a.display.wrapper.insertBefore(b,a.display.scrollbarFiller);S(b,"mousedown",function(){a.state.focused&&setTimeout(function(){return a.display.input.focus()},0)});b.setAttribute("cm-not-content","true")},function(b,d){"horizontal"==d?Ab(a,b):ec(a,
b)},a);a.display.scrollbars.addClass&&g(a.display.wrapper,a.display.scrollbars.addClass)}function Hc(a,b,d,c,e){var q=a.display,f=kb(a.display);0>d&&(d=0);var g=a.curOp&&null!=a.curOp.scrollTop?a.curOp.scrollTop:q.scroller.scrollTop,w=ld(a),k={};e-d>w&&(e=d+w);var l=a.doc.height+kd(q),K=d<f,f=e>l-f;d<g?k.scrollTop=K?0:d:e>g+w&&(d=Math.min(d,(f?l:e)-w),d!=g&&(k.scrollTop=d));g=a.curOp&&null!=a.curOp.scrollLeft?a.curOp.scrollLeft:q.scroller.scrollLeft;a=ib(a)-(a.options.fixedGutter?q.gutters.offsetWidth:
0);(q=c-b>a)&&(c=b+a);10>b?k.scrollLeft=0:b<g?k.scrollLeft=Math.max(0,b-(q?0:10)):c>a+g-3&&(k.scrollLeft=c+(q?0:10)-a);return k}function Ic(a,b,d){null==b&&null==d||Jc(a);null!=b&&(a.curOp.scrollLeft=(null==a.curOp.scrollLeft?a.doc.scrollLeft:a.curOp.scrollLeft)+b);null!=d&&(a.curOp.scrollTop=(null==a.curOp.scrollTop?a.doc.scrollTop:a.curOp.scrollTop)+d)}function Cb(a){Jc(a);var b=a.getCursor(),d=b,c=b;a.options.lineWrapping||(d=b.ch?H(b.line,b.ch-1):b,c=H(b.line,b.ch+1));a.curOp.scrollToPos={from:d,
to:c,margin:a.options.cursorScrollMargin,isCursor:!0}}function Jc(a){var b=a.curOp.scrollToPos;if(b){a.curOp.scrollToPos=null;var d=se(a,b.from),c=se(a,b.to),b=Hc(a,Math.min(d.left,c.left),Math.min(d.top,c.top)-b.margin,Math.max(d.right,c.right),Math.max(d.bottom,c.bottom)+b.margin);a.scrollTo(b.scrollLeft,b.scrollTop)}}function Db(a){a.curOp={cm:a,viewChanged:!1,startHeight:a.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,
updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++$f};a=a.curOp;yb?yb.ops.push(a):a.ownsGroup=yb={ops:[a],delayedCallbacks:[]}}function Eb(a){Tf(a.curOp,function(a){for(var d=0;d<a.ops.length;d++)a.ops[d].cm.curOp=null;a=a.ops;for(d=0;d<a.length;d++){var c=a[d],e=c.cm,q=e.display,g=e.display;!g.scrollbarsClipped&&g.scroller.offsetWidth&&(g.nativeBarWidth=g.scroller.offsetWidth-g.scroller.clientWidth,g.heightForcer.style.height=Qa(e)+"px",g.sizer.style.marginBottom=-g.nativeBarWidth+
"px",g.sizer.style.borderRightWidth=Qa(e)+"px",g.scrollbarsClipped=!0);c.updateMaxLine&&Ub(e);c.mustUpdate=c.viewChanged||c.forceUpdate||null!=c.scrollTop||c.scrollToPos&&(c.scrollToPos.from.line<q.viewFrom||c.scrollToPos.to.line>=q.viewTo)||q.maxLineChanged&&e.options.lineWrapping;c.update=c.mustUpdate&&new Kc(e,c.mustUpdate&&{top:c.scrollTop,ensure:c.scrollToPos},c.forceUpdate)}for(d=0;d<a.length;d++)c=a[d],c.updatedDisplay=c.mustUpdate&&yd(c.cm,c.update);for(d=0;d<a.length;d++)if(c=a[d],e=c.cm,
q=e.display,c.updatedDisplay&&Fc(e),c.barMeasure=gc(e),q.maxLineChanged&&!e.options.lineWrapping&&(g=q.maxLine.text.length,g=Ua(e,tb(e,q.maxLine),g,void 0),c.adjustWidthTo=g.left+3,e.display.sizerWidth=c.adjustWidthTo,c.barMeasure.scrollWidth=Math.max(q.scroller.clientWidth,q.sizer.offsetLeft+c.adjustWidthTo+Qa(e)+e.display.barWidth),c.maxScrollLeft=Math.max(0,q.sizer.offsetLeft+c.adjustWidthTo-ib(e))),c.updatedDisplay||c.selectionChanged)c.preparedSelection=q.input.prepareSelection(c.focus);for(d=
0;d<a.length;d++)c=a[d],e=c.cm,null!=c.adjustWidthTo&&(e.display.sizer.style.minWidth=c.adjustWidthTo+"px",c.maxScrollLeft<e.doc.scrollLeft&&Ab(e,Math.min(e.display.scroller.scrollLeft,c.maxScrollLeft),!0),e.display.maxLineChanged=!1),q=c.focus&&c.focus==f()&&(!document.hasFocus||document.hasFocus()),c.preparedSelection&&e.display.input.showSelection(c.preparedSelection,q),(c.updatedDisplay||c.startHeight!=e.doc.height)&&Bb(e,c.barMeasure),c.updatedDisplay&&zd(e,c.barMeasure),c.selectionChanged&&
sd(e),e.state.focused&&c.updateInput&&e.display.input.reset(c.typing),q&&we(c.cm);for(d=0;d<a.length;d++){var w=void 0,k,c=a[d],e=c.cm,q=e.display,g=e.doc;c.updatedDisplay&&Ee(e,c.update);null==q.wheelStartX||null==c.scrollTop&&null==c.scrollLeft&&!c.scrollToPos||(q.wheelStartX=q.wheelStartY=null);null==c.scrollTop||q.scroller.scrollTop==c.scrollTop&&!c.forceScroll||(g.scrollTop=Math.max(0,Math.min(q.scroller.scrollHeight-q.scroller.clientHeight,c.scrollTop)),q.scrollbars.setScrollTop(g.scrollTop),
q.scroller.scrollTop=g.scrollTop);null==c.scrollLeft||q.scroller.scrollLeft==c.scrollLeft&&!c.forceScroll||(g.scrollLeft=Math.max(0,Math.min(q.scroller.scrollWidth-q.scroller.clientWidth,c.scrollLeft)),q.scrollbars.setScrollLeft(g.scrollLeft),q.scroller.scrollLeft=g.scrollLeft,ud(e));if(c.scrollToPos){k=Q(g,c.scrollToPos.from);var l=Q(g,c.scrollToPos.to),h=c.scrollToPos.margin;null==h&&(h=0);for(var p=0;5>p;p++){var r=!1,w=Ma(e,k),u=l&&l!=k?Ma(e,l):w,u=Hc(e,Math.min(w.left,u.left),Math.min(w.top,
u.top)-h,Math.max(w.left,u.left),Math.max(w.bottom,u.bottom)+h),t=e.doc.scrollTop,m=e.doc.scrollLeft;null!=u.scrollTop&&(ec(e,u.scrollTop),1<Math.abs(e.doc.scrollTop-t)&&(r=!0));null!=u.scrollLeft&&(Ab(e,u.scrollLeft),1<Math.abs(e.doc.scrollLeft-m)&&(r=!0));if(!r)break}k=w;c.scrollToPos.isCursor&&e.state.focused&&(ha(e,"scrollCursorIntoView")||(l=e.display,h=l.sizer.getBoundingClientRect(),w=null,0>k.top+h.top?w=!0:k.bottom+h.top>(window.innerHeight||document.documentElement.clientHeight)&&(w=!1),
null==w||ag||(k=b("div","\u200b",null,"position: absolute;\n                         top: "+(k.top-l.viewOffset-e.display.lineSpace.offsetTop)+"px;\n                         height: "+(k.bottom-k.top+Qa(e)+l.barHeight)+"px;\n                         left: "+k.left+"px; width: 2px;"),e.display.lineSpace.appendChild(k),k.scrollIntoView(w),e.display.lineSpace.removeChild(k))))}k=c.maybeHiddenMarkers;w=c.maybeUnhiddenMarkers;if(k)for(l=0;l<k.length;++l)k[l].lines.length||ea(k[l],"hide");if(w)for(k=0;k<
w.length;++k)w[k].lines.length&&ea(w[k],"unhide");q.wrapper.offsetHeight&&(g.scrollTop=e.display.scroller.scrollTop);c.changeObjs&&ea(e,"changes",e,c.changeObjs);c.update&&c.update.finish()}})}function Da(a,b){if(a.curOp)return b();Db(a);try{return b()}finally{Eb(a)}}function ja(a,b){return function(){if(a.curOp)return b.apply(a,arguments);Db(a);try{return b.apply(a,arguments)}finally{Eb(a)}}}function sa(a){return function(){if(this.curOp)return a.apply(this,arguments);Db(this);try{return a.apply(this,
arguments)}finally{Eb(this)}}}function na(a){return function(){var b=this.cm;if(!b||b.curOp)return a.apply(this,arguments);Db(b);try{return a.apply(this,arguments)}finally{Eb(b)}}}function ra(a,b,d,c){null==b&&(b=a.doc.first);null==d&&(d=a.doc.first+a.doc.size);c||(c=0);var e=a.display;c&&d<e.viewTo&&(null==e.updateLineNumbers||e.updateLineNumbers>b)&&(e.updateLineNumbers=b);a.curOp.viewChanged=!0;if(b>=e.viewTo)$a&&Pa(a.doc,b)<e.viewTo&&bb(a);else if(d<=e.viewFrom)$a&&sb(a.doc,d+c)>e.viewFrom?bb(a):
(e.viewFrom+=c,e.viewTo+=c);else if(b<=e.viewFrom&&d>=e.viewTo)bb(a);else if(b<=e.viewFrom){var q=Lc(a,d,d+c,1);q?(e.view=e.view.slice(q.index),e.viewFrom=q.lineN,e.viewTo+=c):bb(a)}else if(d>=e.viewTo)(q=Lc(a,b,b,-1))?(e.view=e.view.slice(0,q.index),e.viewTo=q.lineN):bb(a);else{var q=Lc(a,b,b,-1),f=Lc(a,d,d+c,1);q&&f?(e.view=e.view.slice(0,q.index).concat(Dc(a,q.lineN,f.lineN)).concat(e.view.slice(f.index)),e.viewTo+=c):bb(a)}if(a=e.externalMeasured)d<a.lineN?a.lineN+=c:b<a.lineN+a.size&&(e.externalMeasured=
null)}function cb(a,b,d){a.curOp.viewChanged=!0;var c=a.display,e=a.display.externalMeasured;e&&b>=e.lineN&&b<e.lineN+e.size&&(c.externalMeasured=null);b<c.viewFrom||b>=c.viewTo||(a=c.view[jb(a,b)],null!=a.node&&(a=a.changes||(a.changes=[]),-1==k(a,d)&&a.push(d)))}function bb(a){a.display.viewFrom=a.display.viewTo=a.doc.first;a.display.view=[];a.display.viewOffset=0}function Lc(a,b,d,c){var e=jb(a,b),q=a.display.view;if(!$a||d==a.doc.first+a.doc.size)return{index:e,lineN:d};for(var f=a.display.viewFrom,
g=0;g<e;g++)f+=q[g].size;if(f!=b){if(0<c){if(e==q.length-1)return null;b=f+q[e].size-b;e++}else b=f-b;d+=b}for(;Pa(a.doc,d)!=d;){if(e==(0>c?0:q.length-1))return null;d+=c*q[e-(0>c?1:0)].size;e+=c}return{index:e,lineN:d}}function Fe(a){a=a.display.view;for(var b=0,d=0;d<a.length;d++){var c=a[d];c.hidden||c.node&&!c.changes||++b}return b}function fc(a,b){a.doc.mode.startState&&a.doc.frontier<a.display.viewTo&&a.state.highlight.set(b,h(bg,a))}function bg(a){var b=a.doc;b.frontier<b.first&&(b.frontier=
b.first);if(!(b.frontier>=a.display.viewTo)){var d=+new Date+a.options.workTime,c=Va(b.mode,Xb(a,b.frontier)),e=[];b.iter(b.frontier,Math.min(b.first+b.size,a.display.viewTo+500),function(q){if(b.frontier>=a.display.viewFrom){var f=q.styles,g=q.text.length>a.options.maxHighlightLength,k=Xd(a,q,g?Va(b.mode,c):c,!0);q.styles=k.styles;var w=q.styleClasses;(k=k.classes)?q.styleClasses=k:w&&(q.styleClasses=null);w=!f||f.length!=q.styles.length||w!=k&&(!w||!k||w.bgClass!=k.bgClass||w.textClass!=k.textClass);
for(k=0;!w&&k<f.length;++k)w=f[k]!=q.styles[k];w&&e.push(b.frontier);q.stateAfter=g?c:Va(b.mode,c)}else q.text.length<=a.options.maxHighlightLength&&gd(a,q.text,c),q.stateAfter=0==b.frontier%5?Va(b.mode,c):null;++b.frontier;if(+new Date>d)return fc(a,a.options.workDelay),!0});e.length&&Da(a,function(){for(var b=0;b<e.length;b++)cb(a,e[b],"text")})}}function yd(a,b){var d=a.display,c=a.doc;if(b.editorIsHidden)return bb(a),!1;if(!b.force&&b.visible.from>=d.viewFrom&&b.visible.to<=d.viewTo&&(null==d.updateLineNumbers||
d.updateLineNumbers>=d.viewTo)&&d.renderedView==d.view&&0==Fe(a))return!1;xe(a)&&(bb(a),b.dims=nd(a));var q=c.first+c.size,g=Math.max(b.visible.from-a.options.viewportMargin,c.first),k=Math.min(q,b.visible.to+a.options.viewportMargin);d.viewFrom<g&&20>g-d.viewFrom&&(g=Math.max(c.first,d.viewFrom));d.viewTo>k&&20>d.viewTo-k&&(k=Math.min(q,d.viewTo));$a&&(g=Pa(a.doc,g),k=sb(a.doc,k));c=g!=d.viewFrom||k!=d.viewTo||d.lastWrapHeight!=b.wrapperHeight||d.lastWrapWidth!=b.wrapperWidth;q=a.display;0==q.view.length||
g>=q.viewTo||k<=q.viewFrom?(q.view=Dc(a,g,k),q.viewFrom=g):(q.viewFrom>g?q.view=Dc(a,g,q.viewFrom).concat(q.view):q.viewFrom<g&&(q.view=q.view.slice(jb(a,g))),q.viewFrom=g,q.viewTo<k?q.view=q.view.concat(Dc(a,q.viewTo,k)):q.viewTo>k&&(q.view=q.view.slice(0,jb(a,k))));q.viewTo=k;d.viewOffset=ya(E(a.doc,d.viewFrom));a.display.mover.style.top=d.viewOffset+"px";k=Fe(a);if(!c&&0==k&&!b.force&&d.renderedView==d.view&&(null==d.updateLineNumbers||d.updateLineNumbers>=d.viewTo))return!1;g=f();4<k&&(d.lineDiv.style.display=
"none");cg(a,d.updateLineNumbers,b.dims);4<k&&(d.lineDiv.style.display="");d.renderedView=d.view;g&&f()!=g&&g.offsetHeight&&g.focus();e(d.cursorDiv);e(d.selectionDiv);d.gutters.style.height=d.sizer.style.minHeight=0;c&&(d.lastWrapHeight=b.wrapperHeight,d.lastWrapWidth=b.wrapperWidth,fc(a,400));d.updateLineNumbers=null;return!0}function Ee(a,b){for(var d=b.viewport,c=!0;;c=!1){if(!c||!a.options.lineWrapping||b.oldDisplayWidth==ib(a))if(d&&null!=d.top&&(d={top:Math.min(a.doc.height+kd(a.display)-ld(a),
d.top)}),b.visible=wd(a.display,a.doc,d),b.visible.from>=a.display.viewFrom&&b.visible.to<=a.display.viewTo)break;if(!yd(a,b))break;Fc(a);c=gc(a);cc(a);Bb(a,c);zd(a,c)}b.signal(a,"update",a);if(a.display.viewFrom!=a.display.reportedViewFrom||a.display.viewTo!=a.display.reportedViewTo)b.signal(a,"viewportChange",a,a.display.viewFrom,a.display.viewTo),a.display.reportedViewFrom=a.display.viewFrom,a.display.reportedViewTo=a.display.viewTo}function xd(a,b){b=new Kc(a,b);if(yd(a,b)){Fc(a);Ee(a,b);var d=
gc(a);cc(a);Bb(a,d);zd(a,d);b.finish()}}function cg(a,b,d){function c(b){var d=b.nextSibling;la&&La&&a.display.currentWheelTarget==b?b.style.display="none":b.parentNode.removeChild(b);return d}for(var q=a.display,f=a.options.lineNumbers,g=q.lineDiv,w=g.firstChild,l=q.view,q=q.viewFrom,h=0;h<l.length;h++){var p=l[h];if(!p.hidden)if(p.node&&p.node.parentNode==g){for(;w!=p.node;)w=c(w);w=f&&null!=b&&b<=q&&p.lineNumber;p.changes&&(-1<k(p.changes,"gutter")&&(w=!1),ge(a,p,q,d));w&&(e(p.lineNumber),p.lineNumber.appendChild(document.createTextNode(ga(a.options,
q))));w=p.node.nextSibling}else{var r=Vf(a,p,q,d);g.insertBefore(r,w)}q+=p.size}for(;w;)w=c(w)}function vd(a){a.display.sizer.style.marginLeft=a.display.gutters.offsetWidth+"px"}function zd(a,b){a.display.sizer.style.minHeight=b.docHeight+"px";a.display.heightForcer.style.top=b.docHeight+"px";a.display.gutters.style.height=b.docHeight+a.display.barHeight+Qa(a)+"px"}function Ge(a){var d=a.display.gutters,c=a.options.gutters;e(d);for(var q=0;q<c.length;++q){var f=c[q],g=d.appendChild(b("div",null,"CodeMirror-gutter "+
f));"CodeMirror-linenumbers"==f&&(a.display.lineGutter=g,g.style.width=(a.display.lineNumWidth||1)+"px")}d.style.display=q?"":"none";vd(a)}function Ad(a){var b=k(a.gutters,"CodeMirror-linenumbers");-1==b&&a.lineNumbers?a.gutters=a.gutters.concat(["CodeMirror-linenumbers"]):-1<b&&!a.lineNumbers&&(a.gutters=a.gutters.slice(0),a.gutters.splice(b,1))}function Oa(a,b){b=a[b];a.sort(function(a,b){return O(a.from(),b.from())});b=k(a,b);for(var d=1;d<a.length;d++){var c=a[d],e=a[d-1];if(0<=O(e.to(),c.from())){var q=
ka(e.from(),c.from()),f=za(e.to(),c.to()),c=e.empty()?c.from()==c.head:e.from()==e.head;d<=b&&--b;a.splice(--d,2,new X(c?f:q,c?q:f))}}return new Ea(a,b)}function Xa(a,b){return new Ea([new X(a,b||a)],0)}function db(a){return a.text?H(a.from.line+a.text.length-1,n(a.text).length+(1==a.text.length?a.from.ch:0)):a.to}function He(a,b){if(0>O(a,b.from))return a;if(0>=O(a,b.to))return db(b);var d=a.line+b.text.length-(b.to.line-b.from.line)-1,c=a.ch;a.line==b.to.line&&(c+=db(b).ch-b.to.ch);return H(d,c)}
function Bd(a,b){for(var d=[],c=0;c<a.sel.ranges.length;c++){var e=a.sel.ranges[c];d.push(new X(He(e.anchor,b),He(e.head,b)))}return Oa(d,a.sel.primIndex)}function Ie(a,b,d){return a.line==b.line?H(d.line,a.ch-b.ch+d.ch):H(d.line+(a.line-b.line),a.ch)}function Cd(a){a.doc.mode=ed(a.options,a.doc.modeOption);hc(a)}function hc(a){a.doc.iter(function(a){a.stateAfter&&(a.stateAfter=null);a.styles&&(a.styles=null)});a.doc.frontier=a.doc.first;fc(a,100);a.state.modeGen++;a.curOp&&ra(a)}function Je(a,b){return 0==
b.from.ch&&0==b.to.ch&&""==n(b.text)&&(!a.cm||a.cm.options.wholeLineUpdateBefore)}function Dd(a,b,d,c){function e(a,d,e){a.text=d;a.stateAfter&&(a.stateAfter=null);a.styles&&(a.styles=null);null!=a.order&&(a.order=null);Y(a);Qb(a,e);d=c?c(a):1;d!=a.height&&R(a,d);ma(a,"change",a,b)}function q(a,b){for(var e=[];a<b;++a)e.push(new Fb(k[a],d?d[a]:null,c));return e}var f=b.from,g=b.to,k=b.text,w=E(a,f.line),l=E(a,g.line),h=n(k),p=d?d[k.length-1]:null,K=g.line-f.line;b.full?(a.insert(0,q(0,k.length)),
a.remove(k.length,a.size-k.length)):Je(a,b)?(g=q(0,k.length-1),e(l,l.text,p),K&&a.remove(f.line,K),g.length&&a.insert(f.line,g)):w==l?1==k.length?e(w,w.text.slice(0,f.ch)+h+w.text.slice(g.ch),p):(K=q(1,k.length-1),K.push(new Fb(h+w.text.slice(g.ch),p,c)),e(w,w.text.slice(0,f.ch)+k[0],d?d[0]:null),a.insert(f.line+1,K)):1==k.length?(e(w,w.text.slice(0,f.ch)+k[0]+l.text.slice(g.ch),d?d[0]:null),a.remove(f.line+1,K)):(e(w,w.text.slice(0,f.ch)+k[0],d?d[0]:null),e(l,h+l.text.slice(g.ch),p),p=q(1,k.length-
1),1<K&&a.remove(f.line+1,K-1),a.insert(f.line+1,p));ma(a,"change",a,b)}function nb(a,b,d){function c(a,e,q){if(a.linked)for(var f=0;f<a.linked.length;++f){var g=a.linked[f];if(g.doc!=e){var k=q&&g.sharedHist;if(!d||k)b(g.doc,k),c(g.doc,a,k)}}}c(a,null,!0)}function Ke(a,b){if(b.cm)throw Error("This document is already in use.");a.doc=b;b.cm=a;rd(a);Cd(a);a.options.lineWrapping||Ub(a);a.options.mode=b.modeOption;ra(a)}function Mc(a){this.done=[];this.undone=[];this.undoDepth=Infinity;this.lastModTime=
this.lastSelTime=0;this.lastOrigin=this.lastSelOrigin=this.lastOp=this.lastSelOp=null;this.generation=this.maxGeneration=a||1}function Ed(a,b){var d={from:pa(b.from),to:db(b),text:U(a,b.from,b.to)};Le(a,d,b.from.line,b.to.line+1);nb(a,function(a){return Le(a,d,b.from.line,b.to.line+1)},!0);return d}function Me(a){for(;a.length;)if(n(a).ranges)a.pop();else break}function Ne(a,b,d,c){var e=a.history;e.undone.length=0;var q=+new Date,f,g,k;if(k=e.lastOp==c||e.lastOrigin==b.origin&&b.origin&&("+"==b.origin.charAt(0)&&
a.cm&&e.lastModTime>q-a.cm.options.historyEventDelay||"*"==b.origin.charAt(0)))e.lastOp==c?(Me(e.done),f=n(e.done)):e.done.length&&!n(e.done).ranges?f=n(e.done):1<e.done.length&&!e.done[e.done.length-2].ranges?(e.done.pop(),f=n(e.done)):f=void 0,k=f;if(k)g=n(f.changes),0==O(b.from,b.to)&&0==O(b.from,g.to)?g.to=db(b):f.changes.push(Ed(a,b));else for((f=n(e.done))&&f.ranges||Nc(a.sel,e.done),f={changes:[Ed(a,b)],generation:e.generation},e.done.push(f);e.done.length>e.undoDepth;)e.done.shift(),e.done[0].ranges||
e.done.shift();e.done.push(d);e.generation=++e.maxGeneration;e.lastModTime=e.lastSelTime=q;e.lastOp=e.lastSelOp=c;e.lastOrigin=e.lastSelOrigin=b.origin;g||ea(a,"historyAdded")}function Nc(a,b){var d=n(b);d&&d.ranges&&d.equals(a)||b.push(a)}function Le(a,b,d,c){var e=b["spans_"+a.id],f=0;a.iter(Math.max(a.first,d),Math.min(a.first+a.size,c),function(d){d.markedSpans&&((e||(e=b["spans_"+a.id]={}))[f]=d.markedSpans);++f})}function dg(a){if(!a)return null;for(var b,d=0;d<a.length;++d)a[d].marker.explicitlyCleared?
b||(b=a.slice(0,d)):b&&b.push(a[d]);return b?b.length?b:null:a}function Oe(a,b){var d;if(d=b["spans_"+a.id]){for(var c=[],e=0;e<b.text.length;++e)c.push(dg(d[e]));d=c}else d=null;a=Sb(a,b);if(!d)return a;if(!a)return d;for(b=0;b<d.length;++b)if(c=d[b],e=a[b],c&&e){var f=0;a:for(;f<e.length;++f){for(var q=e[f],g=0;g<c.length;++g)if(c[g].marker==q.marker)continue a;c.push(q)}}else e&&(d[b]=e);return d}function Gb(a,b,d){for(var c=[],e=0;e<a.length;++e){var f=a[e];if(f.ranges)c.push(d?Ea.prototype.deepCopy.call(f):
f);else{var f=f.changes,q=[];c.push({changes:q});for(var g=0;g<f.length;++g){var w=f[g],l;q.push({from:w.from,to:w.to,text:w.text});if(b)for(var h in w)(l=h.match(/^spans_(\d+)$/))&&-1<k(b,Number(l[1]))&&(n(q)[h]=w[h],delete w[h])}}}return c}function ic(a,b,d,c){return a.cm&&a.cm.display.shift||a.extend?(a=b.anchor,c&&(b=0>O(d,a),b!=0>O(c,a)?(a=d,d=c):b!=0>O(d,c)&&(d=c)),new X(a,d)):new X(c||d,d)}function Oc(a,b,d,c){oa(a,new Ea([ic(a,a.sel.primary(),b,d)],0),c)}function Pe(a,b,d){for(var c=[],e=
0;e<a.sel.ranges.length;e++)c[e]=ic(a,a.sel.ranges[e],b[e],null);b=Oa(c,a.sel.primIndex);oa(a,b,d)}function Fd(a,b,d,c){var e=a.sel.ranges.slice(0);e[b]=d;oa(a,Oa(e,a.sel.primIndex),c)}function eg(a,b,d){d={ranges:b.ranges,update:function(b){this.ranges=[];for(var d=0;d<b.length;d++)this.ranges[d]=new X(Q(a,b[d].anchor),Q(a,b[d].head))},origin:d&&d.origin};ea(a,"beforeSelectionChange",a,d);a.cm&&ea(a.cm,"beforeSelectionChange",a.cm,d);return d.ranges!=b.ranges?Oa(d.ranges,d.ranges.length-1):b}function Qe(a,
b,d){var c=a.history.done,e=n(c);e&&e.ranges?(c[c.length-1]=b,Pc(a,b,d)):oa(a,b,d)}function oa(a,b,d){Pc(a,b,d);b=a.sel;var c=a.cm?a.cm.curOp.id:NaN,e=a.history,f=d&&d.origin,q;if(!(q=c==e.lastSelOp)&&(q=f&&e.lastSelOrigin==f)&&!(q=e.lastModTime==e.lastSelTime&&e.lastOrigin==f)){q=n(e.done);var g=f.charAt(0);q="*"==g||"+"==g&&q.ranges.length==b.ranges.length&&q.somethingSelected()==b.somethingSelected()&&new Date-a.history.lastSelTime<=(a.cm?a.cm.options.historyEventDelay:500)}q?e.done[e.done.length-
1]=b:Nc(b,e.done);e.lastSelTime=+new Date;e.lastSelOrigin=f;e.lastSelOp=c;d&&!1!==d.clearRedo&&Me(e.undone)}function Pc(a,b,d){if(Ia(a,"beforeSelectionChange")||a.cm&&Ia(a.cm,"beforeSelectionChange"))b=eg(a,b,d);var c=d&&d.bias||(0>O(b.primary().head,a.sel.primary().head)?-1:1);Re(a,Se(a,b,c,!0));d&&!1===d.scroll||!a.cm||Cb(a.cm)}function Re(a,b){b.equals(a.sel)||(a.sel=b,a.cm&&(a.cm.curOp.updateInput=a.cm.curOp.selectionChanged=!0,Td(a.cm)),ma(a,"cursorActivity",a))}function Te(a){Re(a,Se(a,a.sel,
null,!1),Ra)}function Se(a,b,d,c){for(var e,f=0;f<b.ranges.length;f++){var q=b.ranges[f],g=b.ranges.length==a.sel.ranges.length&&a.sel.ranges[f],k=Gd(a,q.anchor,g&&g.anchor,d,c),g=Gd(a,q.head,g&&g.head,d,c);if(e||k!=q.anchor||g!=q.head)e||(e=b.ranges.slice(0,f)),e[f]=new X(k,g)}return e?Oa(e,b.primIndex):b}function Hb(a,b,d,c,e){var f=E(a,b.line);if(f.markedSpans)for(var q=0;q<f.markedSpans.length;++q){var g=f.markedSpans[q],k=g.marker;if((null==g.from||(k.inclusiveLeft?g.from<=b.ch:g.from<b.ch))&&
(null==g.to||(k.inclusiveRight?g.to>=b.ch:g.to>b.ch))){if(e&&(ea(k,"beforeCursorEnter"),k.explicitlyCleared))if(f.markedSpans){--q;continue}else break;if(k.atomic){if(d){q=k.find(0>c?1:-1);g=void 0;if(0>c?k.inclusiveRight:k.inclusiveLeft)q=Ue(a,q,-c,q&&q.line==b.line?f:null);if(q&&q.line==b.line&&(g=O(q,d))&&(0>c?0>g:0<g))return Hb(a,q,b,c,e)}d=k.find(0>c?-1:1);if(0>c?k.inclusiveLeft:k.inclusiveRight)d=Ue(a,d,c,d.line==b.line?f:null);return d?Hb(a,d,b,c,e):null}}}return b}function Gd(a,b,d,c,e){c=
c||1;b=Hb(a,b,d,c,e)||!e&&Hb(a,b,d,c,!0)||Hb(a,b,d,-c,e)||!e&&Hb(a,b,d,-c,!0);return b?b:(a.cantEdit=!0,H(a.first,0))}function Ue(a,b,d,c){return 0>d&&0==b.ch?b.line>a.first?Q(a,H(b.line-1)):null:0<d&&b.ch==(c||E(a,b.line)).text.length?b.line<a.first+a.size-1?H(b.line+1,0):null:new H(b.line,b.ch+d)}function Ve(a){a.setSelection(H(a.firstLine(),0),H(a.lastLine()),Ra)}function We(a,b,d){var c={canceled:!1,from:b.from,to:b.to,text:b.text,origin:b.origin,cancel:function(){return c.canceled=!0}};d&&(c.update=
function(b,d,e,f){b&&(c.from=Q(a,b));d&&(c.to=Q(a,d));e&&(c.text=e);void 0!==f&&(c.origin=f)});ea(a,"beforeChange",a,c);a.cm&&ea(a.cm,"beforeChange",a.cm,c);return c.canceled?null:{from:c.from,to:c.to,text:c.text,origin:c.origin}}function Ib(a,b,d){if(a.cm){if(!a.cm.curOp)return ja(a.cm,Ib)(a,b,d);if(a.cm.state.suppressEdits)return}if(Ia(a,"beforeChange")||a.cm&&Ia(a.cm,"beforeChange"))if(b=We(a,b,!0),!b)return;if(d=Xe&&!d&&Ba(a,b.from,b.to))for(var c=d.length-1;0<=c;--c)Ye(a,{from:d[c].from,to:d[c].to,
text:c?[""]:b.text});else Ye(a,b)}function Ye(a,b){if(1!=b.text.length||""!=b.text[0]||0!=O(b.from,b.to)){var d=Bd(a,b);Ne(a,b,d,a.cm?a.cm.curOp.id:NaN);jc(a,b,d,Sb(a,b));var c=[];nb(a,function(a,d){d||-1!=k(c,a.history)||(Ze(a.history,b),c.push(a.history));jc(a,b,null,Sb(a,b))})}}function Qc(a,b,d){if(!a.cm||!a.cm.state.suppressEdits||d){for(var c=a.history,e,f=a.sel,q="undo"==b?c.done:c.undone,g="undo"==b?c.undone:c.done,l=0;l<q.length&&(e=q[l],d?!e.ranges||e.equals(a.sel):e.ranges);l++);if(l!=
q.length){for(c.lastOrigin=c.lastSelOrigin=null;;)if(e=q.pop(),e.ranges){Nc(e,g);if(d&&!e.equals(a.sel)){oa(a,e,{clearRedo:!1});return}f=e}else break;var w=[];Nc(f,g);g.push({changes:w,generation:c.generation});c.generation=e.generation||++c.maxGeneration;var h=Ia(a,"beforeChange")||a.cm&&Ia(a.cm,"beforeChange");d=function(d){var c=e.changes[d];c.origin=b;if(h&&!We(a,c,!1))return q.length=0,{};w.push(Ed(a,c));var f=d?Bd(a,c):n(q);jc(a,c,f,Oe(a,c));!d&&a.cm&&a.cm.scrollIntoView({from:c.from,to:db(c)});
var g=[];nb(a,function(a,b){b||-1!=k(g,a.history)||(Ze(a.history,c),g.push(a.history));jc(a,c,null,Oe(a,c))})};for(c=e.changes.length-1;0<=c;--c)if(f=d(c))return f.v}}}function $e(a,b){if(0!=b&&(a.first+=b,a.sel=new Ea(x(a.sel.ranges,function(a){return new X(H(a.anchor.line+b,a.anchor.ch),H(a.head.line+b,a.head.ch))}),a.sel.primIndex),a.cm)){ra(a.cm,a.first,a.first-b,b);for(var d=a.cm.display,c=d.viewFrom;c<d.viewTo;c++)cb(a.cm,c,"gutter")}}function jc(a,b,d,c){if(a.cm&&!a.cm.curOp)return ja(a.cm,
jc)(a,b,d,c);if(b.to.line<a.first)$e(a,b.text.length-1-(b.to.line-b.from.line));else if(!(b.from.line>a.lastLine())){if(b.from.line<a.first){var e=b.text.length-1-(a.first-b.from.line);$e(a,e);b={from:H(a.first,0),to:H(b.to.line+e,b.to.ch),text:[n(b.text)],origin:b.origin}}e=a.lastLine();b.to.line>e&&(b={from:b.from,to:H(e,E(a,e).text.length),text:[b.text[0]],origin:b.origin});b.removed=U(a,b.from,b.to);d||(d=Bd(a,b));a.cm?fg(a.cm,b,c):Dd(a,b,c);Pc(a,d,Ra)}}function fg(a,b,d){var c=a.doc,e=a.display,
f=b.from,q=b.to,g=!1,k=f.line;a.options.lineWrapping||(k=P(Fa(E(c,f.line))),c.iter(k,q.line+1,function(a){if(a==e.maxLine)return g=!0}));-1<c.sel.contains(b.from,b.to)&&Td(a);Dd(c,b,d,te(a));a.options.lineWrapping||(c.iter(k,f.line+b.text.length,function(a){var b=Ha(a);b>e.maxLineLength&&(e.maxLine=a,e.maxLineLength=b,e.maxLineChanged=!0,g=!1)}),g&&(a.curOp.updateMaxLine=!0));c.frontier=Math.min(c.frontier,f.line);fc(a,400);d=b.text.length-(q.line-f.line)-1;b.full?ra(a):f.line!=q.line||1!=b.text.length||
Je(a.doc,b)?ra(a,f.line,q.line+1,d):cb(a,f.line,"text");d=Ia(a,"changes");if((c=Ia(a,"change"))||d)b={from:f,to:q,text:b.text,removed:b.removed,origin:b.origin},c&&ma(a,"change",a,b),d&&(a.curOp.changeObjs||(a.curOp.changeObjs=[])).push(b);a.display.selForContextMenu=null}function Jb(a,b,d,c,e){c||(c=d);if(0>O(c,d)){var f=c;c=d;d=f}"string"==typeof b&&(b=a.splitLines(b));Ib(a,{from:d,to:c,text:b,origin:e})}function af(a,b,d,c){d<a.line?a.line+=c:b<a.line&&(a.line=b,a.ch=0)}function bf(a,b,d,c){for(var e=
0;e<a.length;++e){var f=a[e],q=!0;if(f.ranges)for(f.copied||(f=a[e]=f.deepCopy(),f.copied=!0),q=0;q<f.ranges.length;q++)af(f.ranges[q].anchor,b,d,c),af(f.ranges[q].head,b,d,c);else{for(var g=0;g<f.changes.length;++g){var k=f.changes[g];if(d<k.from.line)k.from=H(k.from.line+c,k.from.ch),k.to=H(k.to.line+c,k.to.ch);else if(b<=k.to.line){q=!1;break}}q||(a.splice(0,e+1),e=0)}}}function Ze(a,b){var d=b.from.line,c=b.to.line;b=b.text.length-(c-d)-1;bf(a.done,d,c,b);bf(a.undone,d,c,b)}function kc(a,b,d,
c){var e=b,f=b;"number"==typeof b?f=E(a,Math.max(a.first,Math.min(b,a.first+a.size-1))):e=P(b);if(null==e)return null;c(f,e)&&a.cm&&cb(a.cm,e,d);return f}function gg(a,b,d,c){var e=new lc(a,d,c),f=a.cm;f&&e.noHScroll&&(f.display.alignWidgets=!0);kc(a,b,"widget",function(b){var d=b.widgets||(b.widgets=[]);null==e.insertAt?d.push(e):d.splice(Math.min(d.length-1,Math.max(0,e.insertAt)),0,e);e.line=b;f&&!xa(a,b)&&(d=ya(b)<a.scrollTop,R(b,b.height+$b(e)),d&&Ic(f,null,e.height),f.curOp.forceUpdate=!0);
return!0});ma(f,"lineWidgetAdded",f,e,"number"==typeof b?b:P(b));return e}function Kb(a,d,c,e,f){if(e&&e.shared)return hg(a,d,c,e,f);if(a.cm&&!a.cm.curOp)return ja(a.cm,Kb)(a,d,c,e,f);var q=new eb(a,f);f=O(d,c);e&&p(e,q,!1);if(0<f||0==f&&!1!==q.clearWhenEmpty)return q;q.replacedWith&&(q.collapsed=!0,q.widgetNode=b("span",[q.replacedWith],"CodeMirror-widget"),q.widgetNode.setAttribute("role","presentation"),e.handleMouseEvents||q.widgetNode.setAttribute("cm-ignore-events","true"),e.insertLeft&&(q.widgetNode.insertLeft=
!0));if(q.collapsed){if(rb(a,d.line,d,c,q)||d.line!=c.line&&rb(a,c.line,d,c,q))throw Error("Inserting collapsed marker partially overlapping an existing one");$a=!0}q.addToHistory&&Ne(a,{from:d,to:c,origin:"markText"},a.sel,NaN);var g=d.line,k=a.cm,l;a.iter(g,c.line+1,function(a){k&&q.collapsed&&!k.options.lineWrapping&&Fa(a)==k.display.maxLine&&(l=!0);q.collapsed&&g!=d.line&&R(a,0);var b=new Aa(q,g==d.line?d.ch:null,g==c.line?c.ch:null);a.markedSpans=a.markedSpans?a.markedSpans.concat([b]):[b];b.marker.attachLine(a);
++g});q.collapsed&&a.iter(d.line,c.line+1,function(b){xa(a,b)&&R(b,0)});q.clearOnEnter&&S(q,"beforeCursorEnter",function(){return q.clear()});q.readOnly&&(Xe=!0,(a.history.done.length||a.history.undone.length)&&a.clearHistory());q.collapsed&&(q.id=++cf,q.atomic=!0);if(k){l&&(k.curOp.updateMaxLine=!0);if(q.collapsed)ra(k,d.line,c.line+1);else if(q.className||q.title||q.startStyle||q.endStyle||q.css)for(e=d.line;e<=c.line;e++)cb(k,e,"text");q.atomic&&Te(k.doc);ma(k,"markerAdded",k,q)}return q}function hg(a,
b,d,c,e){c=p(c);c.shared=!1;var f=[Kb(a,b,d,c,e)],q=f[0],g=c.widgetNode;nb(a,function(a){g&&(c.widgetNode=g.cloneNode(!0));f.push(Kb(a,Q(a,b),Q(a,d),c,e));for(var k=0;k<a.linked.length;++k)if(a.linked[k].isParent)return;q=n(f)});return new mc(f,q)}function df(a){return a.findMarks(H(a.first,0),a.clipPos(H(a.lastLine())),function(a){return a.parent})}function ig(a){for(var b=function(b){b=a[b];var d=[b.primary.doc];nb(b.primary.doc,function(a){return d.push(a)});for(var c=0;c<b.markers.length;c++){var e=
b.markers[c];-1==k(d,e.doc)&&(e.parent=null,b.markers.splice(c--,1))}},d=0;d<a.length;d++)b(d)}function jg(a){var b=this;ef(b);if(!ha(b,a)&&!Wa(b.display,a)){qa(a);W&&(ff=+new Date);var d=mb(b,a,!0),c=a.dataTransfer.files;if(d&&!b.isReadOnly())if(c&&c.length&&window.FileReader&&window.File)for(var e=c.length,f=Array(e),q=0,g=function(a,c){if(!b.options.allowDropFileTypes||-1!=k(b.options.allowDropFileTypes,a.type)){var g=new FileReader;g.onload=ja(b,function(){var a=g.result;/[\x00-\x08\x0e-\x1f]{2}/.test(a)&&
(a="");f[c]=a;++q==e&&(d=Q(b.doc,d),a={from:d,to:d,text:b.doc.splitLines(f.join(b.doc.lineSeparator())),origin:"paste"},Ib(b.doc,a),Qe(b.doc,Xa(d,db(a))))});g.readAsText(a)}},l=0;l<e;++l)g(c[l],l);else if(b.state.draggingText&&-1<b.doc.sel.contains(d))b.state.draggingText(a),setTimeout(function(){return b.display.input.focus()},20);else try{if(g=a.dataTransfer.getData("Text")){b.state.draggingText&&!b.state.draggingText.copy&&(l=b.listSelections());Pc(b.doc,Xa(d,d));if(l)for(c=0;c<l.length;++c)Jb(b.doc,
"",l[c].anchor,l[c].head,"drag");b.replaceSelection(g,"around","paste");b.display.input.focus()}}catch(Lg){}}}function ef(a){a.display.dragCursor&&(a.display.lineSpace.removeChild(a.display.dragCursor),a.display.dragCursor=null)}function gf(a){if(document.body.getElementsByClassName)for(var b=document.body.getElementsByClassName("CodeMirror"),d=0;d<b.length;d++){var c=b[d].CodeMirror;c&&a(c)}}function kg(){var a;S(window,"resize",function(){null==a&&(a=setTimeout(function(){a=null;gf(lg)},100))});
S(window,"blur",function(){return gf(dc)})}function lg(a){var b=a.display;if(b.lastWrapHeight!=b.wrapper.clientHeight||b.lastWrapWidth!=b.wrapper.clientWidth)b.cachedCharWidth=b.cachedTextHeight=b.cachedPaddingH=null,b.scrollbarsClipped=!1,a.setSize()}function mg(a){var b=a.split(/-(?!$)/);a=b[b.length-1];for(var d,c,e,f,q=0;q<b.length-1;q++){var g=b[q];if(/^(cmd|meta|m)$/i.test(g))f=!0;else if(/^a(lt)?$/i.test(g))d=!0;else if(/^(c|ctrl|control)$/i.test(g))c=!0;else if(/^s(hift)?$/i.test(g))e=!0;
else throw Error("Unrecognized modifier name: "+g);}d&&(a="Alt-"+a);c&&(a="Ctrl-"+a);f&&(a="Cmd-"+a);e&&(a="Shift-"+a);return a}function ng(a){var b={},d;for(d in a)if(a.hasOwnProperty(d)){var c=a[d];if(!/^(name|fallthrough|(de|at)tach)$/.test(d)){if("..."!=c)for(var e=x(d.split(" "),mg),f=0;f<e.length;f++){var q,g;f==e.length-1?(g=e.join(" "),q=c):(g=e.slice(0,f+1).join(" "),q="...");var k=b[g];if(!k)b[g]=q;else if(k!=q)throw Error("Inconsistent bindings for "+g);}delete a[d]}}for(var l in b)a[l]=
b[l];return a}function Lb(a,b,d,c){b=Rc(b);var e=b.call?b.call(a,c):b[a];if(!1===e)return"nothing";if("..."===e)return"multi";if(null!=e&&d(e))return"handled";if(b.fallthrough){if("[object Array]"!=Object.prototype.toString.call(b.fallthrough))return Lb(a,b.fallthrough,d,c);for(e=0;e<b.fallthrough.length;e++){var f=Lb(a,b.fallthrough[e],d,c);if(f)return f}}}function hf(a){a="string"==typeof a?a:fb[a.keyCode];return"Ctrl"==a||"Alt"==a||"Shift"==a||"Mod"==a}function jf(a,b){if(Na&&34==a.keyCode&&a["char"])return!1;
var d=fb[a.keyCode],c=d;if(null==c||a.altGraphKey)return!1;a.altKey&&"Alt"!=d&&(c="Alt-"+c);(kf?a.metaKey:a.ctrlKey)&&"Ctrl"!=d&&(c="Ctrl-"+c);(kf?a.ctrlKey:a.metaKey)&&"Cmd"!=d&&(c="Cmd-"+c);!b&&a.shiftKey&&"Shift"!=d&&(c="Shift-"+c);return c}function Rc(a){return"string"==typeof a?nc[a]:a}function Mb(a,b){for(var d=a.doc.sel.ranges,c=[],e=0;e<d.length;e++){for(var f=b(d[e]);c.length&&0>=O(f.from,n(c).to);){var q=c.pop();if(0>O(q.from,f.from)){f.from=q.from;break}}c.push(f)}Da(a,function(){for(var b=
c.length-1;0<=b;b--)Jb(a.doc,"",c[b].from,c[b].to,"+delete");Cb(a)})}function lf(a,b){var d=E(a.doc,b),c=Fa(d);c!=d&&(b=P(c));return ad(!0,a,c,b,1)}function mf(a,b){var d=lf(a,b.line);a=E(a.doc,d.line);var c=ab(a);return c&&0!=c[0].level?d:(a=Math.max(0,a.text.search(/\S/)),H(d.line,b.line==d.line&&b.ch<=a&&b.ch?0:a,d.sticky))}function Sc(a,b,d){if("string"==typeof b&&(b=Tc[b],!b))return!1;a.display.input.ensurePolled();var c=a.display.shift,e=!1;try{a.isReadOnly()&&(a.state.suppressEdits=!0),d&&
(a.display.shift=!1),e=b(a)!=Hd}finally{a.display.shift=c,a.state.suppressEdits=!1}return e}function og(a,b,d){for(var c=0;c<a.state.keyMaps.length;c++){var e=Lb(b,a.state.keyMaps[c],d,a);if(e)return e}return a.options.extraKeys&&Lb(b,a.options.extraKeys,d,a)||Lb(b,a.options.keyMap,d,a)}function Uc(a,b,d,c){var e=a.state.keySeq;if(e){if(hf(b))return"handled";pg.set(50,function(){a.state.keySeq==e&&(a.state.keySeq=null,a.display.input.reset())});b=e+" "+b}c=og(a,b,c);"multi"==c&&(a.state.keySeq=b);
"handled"==c&&ma(a,"keyHandled",a,b,d);if("handled"==c||"multi"==c)qa(d),sd(a);return e&&!c&&/\'$/.test(b)?(qa(d),!0):!!c}function nf(a,b){var d=jf(b,!0);return d?b.shiftKey&&!a.state.keySeq?Uc(a,"Shift-"+d,b,function(b){return Sc(a,b,!0)})||Uc(a,d,b,function(b){if("string"==typeof b?/^go[A-Z]/.test(b):b.motion)return Sc(a,b)}):Uc(a,d,b,function(b){return Sc(a,b)}):!1}function qg(a,b,d){return Uc(a,"'"+d+"'",b,function(b){return Sc(a,b,!0)})}function of(a){this.curOp.focus=f();if(!ha(this,a)){W&&
11>aa&&27==a.keyCode&&(a.returnValue=!1);var b=a.keyCode;this.display.shift=16==b||a.shiftKey;var d=nf(this,a);Na&&(Id=d?b:null,!d&&88==b&&!pf&&(La?a.metaKey:a.ctrlKey)&&this.replaceSelection("",null,"cut"));18!=b||/\bCodeMirror-crosshair\b/.test(this.display.lineDiv.className)||rg(this)}}function rg(a){function b(a){18!=a.keyCode&&a.altKey||(zb(d,"CodeMirror-crosshair"),Ka(document,"keyup",b),Ka(document,"mouseover",b))}var d=a.display.lineDiv;g(d,"CodeMirror-crosshair");S(document,"keyup",b);S(document,
"mouseover",b)}function qf(a){16==a.keyCode&&(this.doc.sel.shift=!1);ha(this,a)}function rf(a){if(!(Wa(this.display,a)||ha(this,a)||a.ctrlKey&&!a.altKey||La&&a.metaKey)){var b=a.keyCode,d=a.charCode;if(Na&&b==Id)Id=null,qa(a);else if(!Na||a.which&&!(10>a.which)||!nf(this,a))if(b=String.fromCharCode(null==d?b:d),"\b"!=b&&!qg(this,a,b))this.display.input.onKeyPress(a)}}function sg(a){var b=this.display;if(!(ha(this,a)||b.activeTouch&&b.input.supportsTouch()))if(b.input.ensurePolled(),b.shift=a.shiftKey,
Wa(b,a))la||(b.scroller.draggable=!1,setTimeout(function(){return b.scroller.draggable=!0},100));else if(!Jd(this,a,"gutterClick",!0)){var d=mb(this,a);window.focus();switch(Vd(a)){case 1:this.state.selectingText?this.state.selectingText(a):d?tg(this,a,d):(a.target||a.srcElement)==b.scroller&&qa(a);break;case 2:la&&(this.state.lastMiddleDown=+new Date);d&&Oc(this.doc,d);setTimeout(function(){return b.input.focus()},20);qa(a);break;case 3:Kd?sf(this,a):Yf(this)}}}function tg(a,b,d){W?setTimeout(h(we,
a),0):a.curOp.focus=f();var c=+new Date,e;Vc&&Vc.time>c-400&&0==O(Vc.pos,d)?e="triple":Wc&&Wc.time>c-400&&0==O(Wc.pos,d)?(e="double",Vc={time:c,pos:d}):(e="single",Wc={time:c,pos:d});var c=a.doc.sel,g=La?b.metaKey:b.ctrlKey,q;a.options.dragDrop&&ug&&!a.isReadOnly()&&"single"==e&&-1<(q=c.contains(d))&&(0>O((q=c.ranges[q]).from(),d)||0<d.xRel)&&(0<O(q.to(),d)||0>d.xRel)?vg(a,b,d,g):wg(a,b,d,e,g)}function vg(a,b,d,c){var e=a.display,f=+new Date,g=ja(a,function(q){la&&(e.scroller.draggable=!1);a.state.draggingText=
!1;Ka(document,"mouseup",g);Ka(e.scroller,"drop",g);10>Math.abs(b.clientX-q.clientX)+Math.abs(b.clientY-q.clientY)&&(qa(q),!c&&+new Date-200<f&&Oc(a.doc,d),la||W&&9==aa?setTimeout(function(){document.body.focus();e.input.focus()},20):e.input.focus())});la&&(e.scroller.draggable=!0);a.state.draggingText=g;g.copy=La?b.altKey:b.ctrlKey;e.scroller.dragDrop&&e.scroller.dragDrop();S(document,"mouseup",g);S(e.scroller,"drop",g)}function wg(a,b,d,c,e){function g(b){if(0!=O(K,b))if(K=b,"rect"==c){for(var e=
[],f=a.options.tabSize,g=r(E(h,d.line).text,d.ch,f),q=r(E(h,b.line).text,b.ch,f),k=Math.min(g,q),g=Math.max(g,q),q=Math.min(d.line,b.line),l=Math.min(a.lastLine(),Math.max(d.line,b.line));q<=l;q++){var t=E(h,q).text,m=v(t,k,f);k==g?e.push(new X(H(q,m),H(q,m))):t.length>m&&e.push(new X(H(q,m),H(q,v(t,g,f))))}e.length||e.push(new X(d,d));oa(h,Oa(u.ranges.slice(0,w).concat(e),w),{origin:"*mouse",scroll:!1});a.scrollIntoView(b)}else k=p,e=k.anchor,f=b,"single"!=c&&(b="double"==c?a.findWordAt(b):new X(H(b.line,
0),Q(h,H(b.line+1,0))),0<O(b.anchor,e)?(f=b.head,e=ka(k.from(),b.anchor)):(f=b.anchor,e=za(k.to(),b.head))),b=u.ranges.slice(0),b[w]=new X(Q(h,e),f),oa(h,Oa(b,w),Ld)}function q(b){var d=++n,e=mb(a,b,!0,"rect"==c);if(e)if(0!=O(e,K)){a.curOp.focus=f();g(e);var k=wd(l,h);(e.line>=k.to||e.line<k.from)&&setTimeout(ja(a,function(){n==d&&q(b)}),150)}else{var p=b.clientY<z.top?-20:b.clientY>z.bottom?20:0;p&&setTimeout(ja(a,function(){n==d&&(l.scroller.scrollTop+=p,q(b))}),50)}}function k(b){a.state.selectingText=
!1;n=Infinity;qa(b);l.input.focus();Ka(document,"mousemove",A);Ka(document,"mouseup",N);h.history.lastSelOrigin=null}var l=a.display,h=a.doc;qa(b);var p,w,u=h.sel,t=u.ranges;e&&!b.shiftKey?(w=h.sel.contains(d),p=-1<w?t[w]:new X(d,d)):(p=h.sel.primary(),w=h.sel.primIndex);if(xg?b.shiftKey&&b.metaKey:b.altKey)c="rect",e||(p=new X(d,d)),d=mb(a,b,!0,!0),w=-1;else if("double"==c){var m=a.findWordAt(d);p=a.display.shift||h.extend?ic(h,p,m.anchor,m.head):m}else"triple"==c?(m=new X(H(d.line,0),Q(h,H(d.line+
1,0))),p=a.display.shift||h.extend?ic(h,p,m.anchor,m.head):m):p=ic(h,p,d);e?-1==w?(w=t.length,oa(h,Oa(t.concat([p]),w),{scroll:!1,origin:"*mouse"})):1<t.length&&t[w].empty()&&"single"==c&&!b.shiftKey?(oa(h,Oa(t.slice(0,w).concat(t.slice(w+1)),0),{scroll:!1,origin:"*mouse"}),u=h.sel):Fd(h,w,p,Ld):(w=0,oa(h,new Ea([p],0),Ld),u=h.sel);var K=d,z=l.wrapper.getBoundingClientRect(),n=0,A=ja(a,function(a){Vd(a)?q(a):k(a)}),N=ja(a,k);a.state.selectingText=N;S(document,"mousemove",A);S(document,"mouseup",N)}
function Jd(a,b,d,c){var e,f;try{e=b.clientX,f=b.clientY}catch(Qd){return!1}if(e>=Math.floor(a.display.gutters.getBoundingClientRect().right))return!1;c&&qa(b);c=a.display;var g=c.lineDiv.getBoundingClientRect();if(f>g.bottom||!Ia(a,d))return bd(b);f-=g.top-c.viewOffset;for(g=0;g<a.options.gutters.length;++g){var q=c.gutters.childNodes[g];if(q&&q.getBoundingClientRect().right>=e)return e=T(a.doc,f),ea(a,d,a,e,a.options.gutters[g],b),bd(b)}}function sf(a,b){var d;(d=Wa(a.display,b))||(d=Ia(a,"gutterContextMenu")?
Jd(a,b,"gutterContextMenu",!1):!1);if(!d&&!ha(a,b,"contextmenu"))a.display.input.onContextMenu(b)}function tf(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g," cm-s-");bc(a)}function oc(a){Ge(a);ra(a);ud(a)}function yg(a,b,d){!b!=!(d&&d!=Nb)&&(d=a.display.dragFunctions,b=b?S:Ka,b(a.display.scroller,"dragstart",d.start),b(a.display.scroller,"dragenter",d.enter),b(a.display.scroller,"dragover",d.over),b(a.display.scroller,"dragleave",
d.leave),b(a.display.scroller,"drop",d.drop))}function zg(a){a.options.lineWrapping?(g(a.display.wrapper,"CodeMirror-wrap"),a.display.sizer.style.minWidth="",a.display.sizerWidth=null):(zb(a.display.wrapper,"CodeMirror-wrap"),Ub(a));rd(a);ra(a);bc(a);setTimeout(function(){return Bb(a)},100)}function ba(a,b){var d=this;if(!(this instanceof ba))return new ba(a,b);this.options=b=b?p(b):{};p(uf,b,!1);Ad(b);var c=b.value;"string"==typeof c&&(c=new ta(c,b.mode,null,b.lineSeparator));this.doc=c;var e=new ba.inputStyles[b.inputStyle](this);
a=this.display=new I(a,c,e);a.wrapper.CodeMirror=this;Ge(this);tf(this);b.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");Ce(this);this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new ob,keySeq:null,specialChars:null};b.autofocus&&!Tb&&a.input.focus();W&&11>aa&&setTimeout(function(){return d.display.input.reset(!0)},20);Ag(this);vf||(kg(),vf=!0);Db(this);
this.curOp.forceUpdate=!0;Ke(this,c);b.autofocus&&!Tb||this.hasFocus()?setTimeout(h(td,this),20):dc(this);for(var f in Xc)if(Xc.hasOwnProperty(f))Xc[f](d,b[f],Nb);xe(this);b.finishInit&&b.finishInit(this);for(c=0;c<Md.length;++c)Md[c](d);Eb(this);la&&b.lineWrapping&&"optimizelegibility"==getComputedStyle(a.lineDiv).textRendering&&(a.lineDiv.style.textRendering="auto")}function Ag(d){function c(){f.activeTouch&&(g=setTimeout(function(){return f.activeTouch=null},1E3),q=f.activeTouch,q.end=+new Date)}
function e(a,b){if(null==b.left)return!0;var d=b.left-a.left;a=b.top-a.top;return 400<d*d+a*a}var f=d.display;S(f.scroller,"mousedown",ja(d,sg));W&&11>aa?S(f.scroller,"dblclick",ja(d,function(a){if(!ha(d,a)){var b=mb(d,a);!b||Jd(d,a,"gutterClick",!0)||Wa(d.display,a)||(qa(a),a=d.findWordAt(b),Oc(d.doc,a.anchor,a.head))}})):S(f.scroller,"dblclick",function(a){return ha(d,a)||qa(a)});Kd||S(f.scroller,"contextmenu",function(a){return sf(d,a)});var g,q={end:0};S(f.scroller,"touchstart",function(a){var b;
if(b=!ha(d,a))1!=a.touches.length?b=!1:(b=a.touches[0],b=1>=b.radiusX&&1>=b.radiusY),b=!b;b&&(f.input.ensurePolled(),clearTimeout(g),b=+new Date,f.activeTouch={start:b,moved:!1,prev:300>=b-q.end?q:null},1==a.touches.length&&(f.activeTouch.left=a.touches[0].pageX,f.activeTouch.top=a.touches[0].pageY))});S(f.scroller,"touchmove",function(){f.activeTouch&&(f.activeTouch.moved=!0)});S(f.scroller,"touchend",function(a){var b=f.activeTouch;if(b&&!Wa(f,a)&&null!=b.left&&!b.moved&&300>new Date-b.start){var g=
d.coordsChar(f.activeTouch,"page"),b=!b.prev||e(b,b.prev)?new X(g,g):!b.prev.prev||e(b,b.prev.prev)?d.findWordAt(g):new X(H(g.line,0),Q(d.doc,H(g.line+1,0)));d.setSelection(b.anchor,b.head);d.focus();qa(a)}c()});S(f.scroller,"touchcancel",c);S(f.scroller,"scroll",function(){f.scroller.clientHeight&&(ec(d,f.scroller.scrollTop),Ab(d,f.scroller.scrollLeft,!0),ea(d,"scroll",d))});S(f.scroller,"mousewheel",function(a){return Ae(d,a)});S(f.scroller,"DOMMouseScroll",function(a){return Ae(d,a)});S(f.wrapper,
"scroll",function(){return f.wrapper.scrollTop=f.wrapper.scrollLeft=0});f.dragFunctions={enter:function(a){ha(d,a)||Wb(a)},over:function(c){if(!ha(d,c)){var e=mb(d,c);if(e){var f=document.createDocumentFragment();ve(d,e,f);d.display.dragCursor||(d.display.dragCursor=b("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),d.display.lineSpace.insertBefore(d.display.dragCursor,d.display.cursorDiv));a(d.display.dragCursor,f)}Wb(c)}},start:function(a){if(W&&(!d.state.draggingText||100>+new Date-ff))Wb(a);
else if(!ha(d,a)&&!Wa(d.display,a)&&(a.dataTransfer.setData("Text",d.getSelection()),a.dataTransfer.effectAllowed="copyMove",a.dataTransfer.setDragImage&&!wf)){var c=b("img",null,null,"position: fixed; left: 0; top: 0;");c.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";Na&&(c.width=c.height=1,d.display.wrapper.appendChild(c),c._top=c.offsetTop);a.dataTransfer.setDragImage(c,0,0);Na&&c.parentNode.removeChild(c)}},drop:ja(d,jg),leave:function(a){ha(d,a)||ef(d)}};var k=
f.input.getField();S(k,"keyup",function(a){return qf.call(d,a)});S(k,"keydown",ja(d,of));S(k,"keypress",ja(d,rf));S(k,"focus",function(a){return td(d,a)});S(k,"blur",function(a){return dc(d,a)})}function pc(a,b,d,c){var e=a.doc,f;null==d&&(d="add");"smart"==d&&(e.mode.indent?f=Xb(a,b):d="prev");var g=a.options.tabSize,q=E(e,b),k=r(q.text,null,g);q.stateAfter&&(q.stateAfter=null);var l=q.text.match(/^\s*/)[0],h;if(!c&&!/\S/.test(q.text))h=0,d="not";else if("smart"==d&&(h=e.mode.indent(f,q.text.slice(l.length),
q.text),h==Hd||150<h)){if(!c)return;d="prev"}"prev"==d?h=b>e.first?r(E(e,b-1).text,null,g):0:"add"==d?h=k+a.options.indentUnit:"subtract"==d?h=k-a.options.indentUnit:"number"==typeof d&&(h=k+d);h=Math.max(0,h);d="";c=0;if(a.options.indentWithTabs)for(a=Math.floor(h/g);a;--a)c+=g,d+="\t";c<h&&(d+=t(h-c));if(d!=l)return Jb(e,d,H(b,0),H(b,l.length),"+input"),q.stateAfter=null,!0;for(g=0;g<e.sel.ranges.length;g++)if(q=e.sel.ranges[g],q.head.line==b&&q.head.ch<l.length){b=H(b,l.length);Fd(e,g,new X(b,
b));break}}function Nd(a,b,d,c,e){var f=a.doc;a.display.shift=!1;c||(c=f.sel);var g=a.state.pasteIncoming||"paste"==e,q=Od(b),k=null;if(g&&1<c.ranges.length)if(ua&&ua.text.join("\n")==b){if(0==c.ranges.length%ua.text.length)for(var k=[],l=0;l<ua.text.length;l++)k.push(f.splitLines(ua.text[l]))}else q.length==c.ranges.length&&(k=x(q,function(a){return[a]}));for(var h,l=c.ranges.length-1;0<=l;l--){h=c.ranges[l];var p=h.from(),r=h.to();h.empty()&&(d&&0<d?p=H(p.line,p.ch-d):a.state.overwrite&&!g?r=H(r.line,
Math.min(E(f,r.line).text.length,r.ch+n(q).length)):ua&&ua.lineWise&&ua.text.join("\n")==b&&(p=r=H(p.line,0)));h=a.curOp.updateInput;p={from:p,to:r,text:k?k[l%k.length]:q,origin:e||(g?"paste":a.state.cutIncoming?"cut":"+input")};Ib(a.doc,p);ma(a,"inputRead",a,p)}b&&!g&&xf(a,b);Cb(a);a.curOp.updateInput=h;a.curOp.typing=!0;a.state.pasteIncoming=a.state.cutIncoming=!1}function yf(a,b){var d=a.clipboardData&&a.clipboardData.getData("Text");if(d)return a.preventDefault(),b.isReadOnly()||b.options.disableInput||
Da(b,function(){return Nd(b,d,0,null,"paste")}),!0}function xf(a,b){if(a.options.electricChars&&a.options.smartIndent)for(var d=a.doc.sel,c=d.ranges.length-1;0<=c;c--){var e=d.ranges[c];if(!(100<e.head.ch||c&&d.ranges[c-1].head.line==e.head.line)){var f=a.getModeAt(e.head),g=!1;if(f.electricChars)for(var q=0;q<f.electricChars.length;q++){if(-1<b.indexOf(f.electricChars.charAt(q))){g=pc(a,e.head.line,"smart");break}}else f.electricInput&&f.electricInput.test(E(a.doc,e.head.line).text.slice(0,e.head.ch))&&
(g=pc(a,e.head.line,"smart"));g&&ma(a,"electricInput",a,e.head.line)}}}function zf(a){for(var b=[],d=[],c=0;c<a.doc.sel.ranges.length;c++){var e=a.doc.sel.ranges[c].head.line,e={anchor:H(e,0),head:H(e+1,0)};d.push(e);b.push(a.getRange(e.anchor,e.head))}return{text:b,ranges:d}}function Af(a,b){a.setAttribute("autocorrect","off");a.setAttribute("autocapitalize","off");a.setAttribute("spellcheck",!!b)}function Bf(){var a=b("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),
d=b("div",[a],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");la?a.style.width="1000px":a.setAttribute("wrap","off");qc&&(a.style.border="1px solid black");Af(a);return d}function Pd(a,b,d,c,e){function f(c){var f;f=e?Rd(a.cm,k,b,d):$c(k,b,d);if(null==f){if(c=!c)c=b.line+d,c<a.first||c>=a.first+a.size?c=!1:(b=new H(c,b.ch,b.sticky),c=k=E(a,c));if(c)b=ad(e,a.cm,k,b.line,d);else return!1}else b=f;return!0}var g=b,q=d,k=E(a,b.line);if("char"==c)f();else if("column"==c)f(!0);else if("word"==
c||"group"==c){var l=null;c="group"==c;for(var h=a.cm&&a.cm.getHelper(b,"wordChars"),p=!0;!(0>d)||f(!p);p=!1){var r=k.text.charAt(b.ch)||"\n",r=F(r,h)?"w":c&&"\n"==r?"n":!c||/\s/.test(r)?null:"p";!c||p||r||(r="s");if(l&&l!=r){0>d&&(d=1,f(),b.sticky="after");break}r&&(l=r);if(0<d&&!f(!p))break}}q=Gd(a,b,g,q,!0);da(g,q)&&(q.hitSide=!0);return q}function Cf(a,b,d,c){var e=a.doc,f=b.left,g;"page"==c?(g=Math.max(Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight)-
.5*kb(a.display),3),g=(0<d?b.bottom:b.top)+d*g):"line"==c&&(g=0<d?b.bottom+3:b.top-3);for(;;){b=pd(a,f,g);if(!b.outside)break;if(0>d?0>=g:g>=e.height){b.hitSide=!0;break}g+=5*d}return b}function Df(a,b){var d=md(a,b.line);if(!d||d.hidden)return null;a=E(a.doc,b.line);d=me(d,a,b.line);a=ab(a);var c="left";a&&(c=zc(a,b.ch)%2?"right":"left");b=ne(d.map,b.ch,c);b.offset="right"==b.collapse?b.end:b.start;return b}function Ob(a,b){b&&(a.bad=!0);return a}function Bg(a,b,d,c,e){function f(a){return function(b){return b.id==
a}}function g(b){if(1==b.nodeType){var d=b.getAttribute("cm-text");if(null!=d)k=""==d?k+b.textContent.replace(/\u200b/g,""):k+d;else{var d=b.getAttribute("cm-marker"),h;if(d)b=a.findMarks(H(c,0),H(e+1,0),f(+d)),b.length&&(h=b[0].find())&&(k+=U(a.doc,h.from,h.to).join(l));else if("false"!=b.getAttribute("contenteditable")){for(h=0;h<b.childNodes.length;h++)g(b.childNodes[h]);/^(pre|div|p)$/i.test(b.nodeName)&&(q=!0)}}}else 3==b.nodeType&&(b=b.nodeValue)&&(q&&(k+=l,q=!1),k+=b)}for(var k="",q=!1,l=a.doc.lineSeparator();;){g(b);
if(b==d)break;b=b.nextSibling}return k}function Yc(a,b,d){var c;if(b==a.display.lineDiv){c=a.display.lineDiv.childNodes[d];if(!c)return Ob(a.clipPos(H(a.display.viewTo-1)),!0);b=null;d=0}else for(c=b;;c=c.parentNode){if(!c||c==a.display.lineDiv)return null;if(c.parentNode&&c.parentNode==a.display.lineDiv)break}for(var e=0;e<a.display.view.length;e++){var f=a.display.view[e];if(f.node==c)return Cg(f,b,d)}}function Cg(a,b,c){function e(b,d,c){for(var e=-1;e<(h?h.length:0);e++)for(var f=0>e?l.map:h[e],
g=0;g<f.length;g+=3){var k=f[g+2];if(k==b||k==d){d=P(0>e?a.line:a.rest[e]);e=f[g]+c;if(0>c||k!=b)e=f[g+(c?1:0)];return H(d,e)}}}var f=a.text.firstChild,g=!1;if(!b||!d(f,b))return Ob(H(P(a.line),0),!0);if(b==f&&(g=!0,b=f.childNodes[c],c=0,!b))return c=a.rest?n(a.rest):a.line,Ob(H(P(c),c.text.length),g);var k=3==b.nodeType?b:null,q=b;k||1!=b.childNodes.length||3!=b.firstChild.nodeType||(k=b.firstChild,c&&(c=k.nodeValue.length));for(;q.parentNode!=f;)q=q.parentNode;var l=a.measure,h=l.maps;if(b=e(k,
q,c))return Ob(b,g);f=q.nextSibling;for(k=k?k.nodeValue.length-c:0;f;f=f.nextSibling){if(b=e(f,f.firstChild,0))return Ob(H(b.line,b.ch-k),g);k+=f.textContent.length}for(q=q.previousSibling;q;q=q.previousSibling){if(b=e(q,q.firstChild,-1))return Ob(H(b.line,b.ch+c),g);c+=q.textContent.length}}var va=navigator.userAgent,Ef=navigator.platform,Za=/gecko\/\d/i.test(va),Ff=/MSIE \d/.test(va),Gf=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(va),rc=/Edge\/(\d+)/.exec(va),W=Ff||Gf||rc,aa=W&&(Ff?document.documentMode||
6:+(rc||Gf)[1]),la=!rc&&/WebKit\//.test(va),Dg=la&&/Qt\/\d+\.\d+/.test(va),Eg=!rc&&/Chrome\//.test(va),Na=/Opera\//.test(va),wf=/Apple Computer/.test(navigator.vendor),Fg=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(va),ag=/PhantomJS/.test(va),qc=!rc&&/AppleWebKit/.test(va)&&/Mobile\/\w+/.test(va),Tb=qc||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(va),La=qc||/Mac/.test(Ef),xg=/\bCrOS\b/.test(va),Gg=/win/i.test(Ef),pb=Na&&va.match(/Version\/(\d*\.\d*)/);pb&&(pb=Number(pb[1]));pb&&15<=pb&&
(Na=!1,la=!0);var kf=La&&(Dg||Na&&(null==pb||12.11>pb)),Kd=Za||W&&9<=aa,zb=function(a,b){var d=a.className;if(b=c(b).exec(d)){var e=d.slice(b.index+b[0].length);a.className=d.slice(0,b.index)+(e?b[1]+e:"")}},xb;xb=document.createRange?function(a,b,d,c){var e=document.createRange();e.setEnd(c||a,d);e.setStart(a,b);return e}:function(a,b,d){var c=document.body.createTextRange();try{c.moveToElementText(a.parentNode)}catch(N){return c}c.collapse(!0);c.moveEnd("character",d);c.moveStart("character",b);
return c};var Pb=function(a){a.select()};qc?Pb=function(a){a.selectionStart=0;a.selectionEnd=a.value.length}:W&&(Pb=function(a){try{a.select()}catch(w){}});var ob=function(){this.id=null};ob.prototype.set=function(a,b){clearTimeout(this.id);this.id=setTimeout(b,a)};var Hd={toString:function(){return"CodeMirror.Pass"}},Ra={scroll:!1},Ld={origin:"*mouse"},sc={origin:"+move"},xc=[""],Hf=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,If=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/,
Xe=!1,$a=!1,Vb=null,Jf=function(){function a(a){return 247>=a?"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN".charAt(a):1424<=a&&1524>=a?"R":1536<=a&&1785>=a?"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111".charAt(a-
1536):1774<=a&&2220>=a?"r":8192<=a&&8203>=a?"w":8204==a?"b":"L"}function b(a,b,d){this.level=a;this.from=b;this.to=d}var d=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,c=/[stwN]/,e=/[LRr]/,f=/[Lb1n]/,g=/[1n]/;return function(k){if(!d.test(k))return!1;for(var q=k.length,l=[],h=0;h<q;++h)l.push(a(k.charCodeAt(h)));for(var h=0,p="L";h<q;++h){var r=l[h];"m"==r?l[h]=p:p=r}h=0;for(p="L";h<q;++h)r=l[h],"1"==r&&"r"==p?l[h]="n":e.test(r)&&(p=r,"r"==r&&(l[h]="R"));h=1;for(p=l[0];h<q-1;++h)r=l[h],"+"==r&&"1"==
p&&"1"==l[h+1]?l[h]="1":","!=r||p!=l[h+1]||"1"!=p&&"n"!=p||(l[h]=p),p=r;for(h=0;h<q;++h)if(p=l[h],","==p)l[h]="N";else if("%"==p){for(p=h+1;p<q&&"%"==l[p];++p);for(r=h&&"!"==l[h-1]||p<q&&"1"==l[p]?"1":"N";h<p;++h)l[h]=r;h=p-1}h=0;for(p="L";h<q;++h)r=l[h],"L"==p&&"1"==r?l[h]="L":e.test(r)&&(p=r);for(p=0;p<q;++p)if(c.test(l[p])){for(h=p+1;h<q&&c.test(l[h]);++h);r="L"==(h<q?l[h]:"L");for(r="L"==(p?l[p-1]:"L")||r?"L":"R";p<h;++p)l[p]=r;p=h-1}for(var h=[],u,p=0;p<q;)if(f.test(l[p])){r=p;for(++p;p<q&&f.test(l[p]);++p);
h.push(new b(0,r,p))}else{var t=p,r=h.length;for(++p;p<q&&"L"!=l[p];++p);for(var w=t;w<p;)if(g.test(l[w])){t<w&&h.splice(r,0,new b(1,t,w));t=w;for(++w;w<p&&g.test(l[w]);++w);h.splice(r,0,new b(2,t,w));t=w}else++w;t<p&&h.splice(r,0,new b(1,t,p))}1==h[0].level&&(u=k.match(/^\s+/))&&(h[0].from=u[0].length,h.unshift(new b(0,0,u[0].length)));1==n(h).level&&(u=k.match(/\s+$/))&&(n(h).to-=u[0].length,h.push(new b(0,q-u[0].length,q)));return h}}(),Bc=[],S=function(a,b,d){a.addEventListener?a.addEventListener(b,
d,!1):a.attachEvent?a.attachEvent("on"+b,d):(a=a._handlers||(a._handlers={}),a[b]=(a[b]||Bc).concat(d))},ug=function(){if(W&&9>aa)return!1;var a=b("div");return"draggable"in a||"dragDrop"in a}(),cd,id,Od=3!="\n\nb".split(/\n/).length?function(a){for(var b=0,d=[],c=a.length;b<=c;){var e=a.indexOf("\n",b);-1==e&&(e=a.length);var f=a.slice(b,"\r"==a.charAt(e-1)?e-1:e),g=f.indexOf("\r");-1!=g?(d.push(f.slice(0,g)),b+=g+1):(d.push(f),b=e+1)}return d}:function(a){return a.split(/\r\n?|\n/)},Hg=window.getSelection?
function(a){try{return a.selectionStart!=a.selectionEnd}catch(w){return!1}}:function(a){var b;try{b=a.ownerDocument.selection.createRange()}catch(M){}return b&&b.parentElement()==a?0!=b.compareEndPoints("StartToEnd",b):!1},pf=function(){var a=b("div");if("oncopy"in a)return!0;a.setAttribute("oncopy","return;");return"function"==typeof a.oncopy}(),od=null,dd={},vb={},wb={},ia=function(a,b){this.pos=this.start=0;this.string=a;this.tabSize=b||8;this.lineStart=this.lastColumnPos=this.lastColumnValue=
0};ia.prototype.eol=function(){return this.pos>=this.string.length};ia.prototype.sol=function(){return this.pos==this.lineStart};ia.prototype.peek=function(){return this.string.charAt(this.pos)||void 0};ia.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)};ia.prototype.eat=function(a){var b=this.string.charAt(this.pos);if("string"==typeof a?b==a:b&&(a.test?a.test(b):a(b)))return++this.pos,b};ia.prototype.eatWhile=function(a){for(var b=this.pos;this.eat(a););
return this.pos>b};ia.prototype.eatSpace=function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a};ia.prototype.skipToEnd=function(){this.pos=this.string.length};ia.prototype.skipTo=function(a){a=this.string.indexOf(a,this.pos);if(-1<a)return this.pos=a,!0};ia.prototype.backUp=function(a){this.pos-=a};ia.prototype.column=function(){this.lastColumnPos<this.start&&(this.lastColumnValue=r(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),
this.lastColumnPos=this.start);return this.lastColumnValue-(this.lineStart?r(this.string,this.lineStart,this.tabSize):0)};ia.prototype.indentation=function(){return r(this.string,null,this.tabSize)-(this.lineStart?r(this.string,this.lineStart,this.tabSize):0)};ia.prototype.match=function(a,b,d){if("string"==typeof a){var c=function(a){return d?a.toLowerCase():a},e=this.string.substr(this.pos,a.length);if(c(e)==c(a))return!1!==b&&(this.pos+=a.length),!0}else{if((a=this.string.slice(this.pos).match(a))&&
0<a.index)return null;a&&!1!==b&&(this.pos+=a[0].length);return a}};ia.prototype.current=function(){return this.string.slice(this.start,this.pos)};ia.prototype.hideFirstChars=function(a,b){this.lineStart+=a;try{return b()}finally{this.lineStart-=a}};var Fb=function(a,b,d){this.text=a;Qb(this,b);this.height=d?d(this):1};Fb.prototype.lineNo=function(){return P(this)};ub(Fb);var Pf={},Of={},yb=null,Yb=null,oe={left:0,right:0,top:0,bottom:0},lb,Gc=0,Ca=null;W?Ca=-.53:Za?Ca=15:Eg?Ca=-.7:wf&&(Ca=-1/3);
var qb=function(a,d,c){this.cm=c;var e=this.vert=b("div",[b("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),f=this.horiz=b("div",[b("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");a(e);a(f);S(e,"scroll",function(){e.clientHeight&&d(e.scrollTop,"vertical")});S(f,"scroll",function(){f.clientWidth&&d(f.scrollLeft,"horizontal")});this.checkedZeroWidth=!1;W&&8>aa&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};qb.prototype.update=function(a){var b=
a.scrollWidth>a.clientWidth+1,d=a.scrollHeight>a.clientHeight+1,c=a.nativeBarWidth;d?(this.vert.style.display="block",this.vert.style.bottom=b?c+"px":"0",this.vert.firstChild.style.height=Math.max(0,a.scrollHeight-a.clientHeight+(a.viewHeight-(b?c:0)))+"px"):(this.vert.style.display="",this.vert.firstChild.style.height="0");b?(this.horiz.style.display="block",this.horiz.style.right=d?c+"px":"0",this.horiz.style.left=a.barLeft+"px",this.horiz.firstChild.style.width=Math.max(0,a.scrollWidth-a.clientWidth+
(a.viewWidth-a.barLeft-(d?c:0)))+"px"):(this.horiz.style.display="",this.horiz.firstChild.style.width="0");!this.checkedZeroWidth&&0<a.clientHeight&&(0==c&&this.zeroWidthHack(),this.checkedZeroWidth=!0);return{right:d?c:0,bottom:b?c:0}};qb.prototype.setScrollLeft=function(a){this.horiz.scrollLeft!=a&&(this.horiz.scrollLeft=a);this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz)};qb.prototype.setScrollTop=function(a){this.vert.scrollTop!=a&&(this.vert.scrollTop=a);this.disableVert&&
this.enableZeroWidthBar(this.vert,this.disableVert)};qb.prototype.zeroWidthHack=function(){this.horiz.style.height=this.vert.style.width=La&&!Fg?"12px":"18px";this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none";this.disableHoriz=new ob;this.disableVert=new ob};qb.prototype.enableZeroWidthBar=function(a,b){function d(){var c=a.getBoundingClientRect();document.elementFromPoint(c.left+1,c.bottom-1)!=a?a.style.pointerEvents="none":b.set(1E3,d)}a.style.pointerEvents="auto";b.set(1E3,d)};
qb.prototype.clear=function(){var a=this.horiz.parentNode;a.removeChild(this.horiz);a.removeChild(this.vert)};var tc=function(){};tc.prototype.update=function(){return{bottom:0,right:0}};tc.prototype.setScrollLeft=function(){};tc.prototype.setScrollTop=function(){};tc.prototype.clear=function(){};var De={"native":qb,"null":tc},$f=0,Kc=function(a,b,d){var c=a.display;this.viewport=b;this.visible=wd(c,a.doc,b);this.editorIsHidden=!c.wrapper.offsetWidth;this.wrapperHeight=c.wrapper.clientHeight;this.wrapperWidth=
c.wrapper.clientWidth;this.oldDisplayWidth=ib(a);this.force=d;this.dims=nd(a);this.events=[]};Kc.prototype.signal=function(a,b){Ia(a,b)&&this.events.push(arguments)};Kc.prototype.finish=function(){for(var a=0;a<this.events.length;a++)ea.apply(null,this.events[a])};var Ea=function(a,b){this.ranges=a;this.primIndex=b};Ea.prototype.primary=function(){return this.ranges[this.primIndex]};Ea.prototype.equals=function(a){if(a==this)return!0;if(a.primIndex!=this.primIndex||a.ranges.length!=this.ranges.length)return!1;
for(var b=0;b<this.ranges.length;b++){var d=this.ranges[b],c=a.ranges[b];if(!da(d.anchor,c.anchor)||!da(d.head,c.head))return!1}return!0};Ea.prototype.deepCopy=function(){for(var a=[],b=0;b<this.ranges.length;b++)a[b]=new X(pa(this.ranges[b].anchor),pa(this.ranges[b].head));return new Ea(a,this.primIndex)};Ea.prototype.somethingSelected=function(){for(var a=0;a<this.ranges.length;a++)if(!this.ranges[a].empty())return!0;return!1};Ea.prototype.contains=function(a,b){b||(b=a);for(var d=0;d<this.ranges.length;d++){var c=
this.ranges[d];if(0<=O(b,c.from())&&0>=O(a,c.to()))return d}return-1};var X=function(a,b){this.anchor=a;this.head=b};X.prototype.from=function(){return ka(this.anchor,this.head)};X.prototype.to=function(){return za(this.anchor,this.head)};X.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};var Ya=function(a){this.lines=a;this.parent=null;for(var b=0,d=0;d<a.length;++d)a[d].parent=this,b+=a[d].height;this.height=b};Ya.prototype.chunkSize=function(){return this.lines.length};
Ya.prototype.removeInner=function(a,b){for(var d=a,c=a+b;d<c;++d){var e=this.lines[d];this.height-=e.height;var f=e;f.parent=null;Y(f);ma(e,"delete")}this.lines.splice(a,b)};Ya.prototype.collapse=function(a){a.push.apply(a,this.lines)};Ya.prototype.insertInner=function(a,b,d){this.height+=d;this.lines=this.lines.slice(0,a).concat(b).concat(this.lines.slice(a));for(a=0;a<b.length;++a)b[a].parent=this};Ya.prototype.iterN=function(a,b,d){for(b=a+b;a<b;++a)if(d(this.lines[a]))return!0};var Sa=function(a){this.children=
a;for(var b=0,d=0,c=0;c<a.length;++c){var e=a[c],b=b+e.chunkSize(),d=d+e.height;e.parent=this}this.size=b;this.height=d;this.parent=null};Sa.prototype.chunkSize=function(){return this.size};Sa.prototype.removeInner=function(a,b){this.size-=b;for(var d=0;d<this.children.length;++d){var c=this.children[d],e=c.chunkSize();if(a<e){var f=Math.min(b,e-a),g=c.height;c.removeInner(a,f);this.height-=g-c.height;e==f&&(this.children.splice(d--,1),c.parent=null);if(0==(b-=f))break;a=0}else a-=e}25>this.size-
b&&(1<this.children.length||!(this.children[0]instanceof Ya))&&(a=[],this.collapse(a),this.children=[new Ya(a)],this.children[0].parent=this)};Sa.prototype.collapse=function(a){for(var b=0;b<this.children.length;++b)this.children[b].collapse(a)};Sa.prototype.insertInner=function(a,b,d){this.size+=b.length;this.height+=d;for(var c=0;c<this.children.length;++c){var e=this.children[c],f=e.chunkSize();if(a<=f){e.insertInner(a,b,d);if(e.lines&&50<e.lines.length){for(b=a=e.lines.length%25+25;b<e.lines.length;)d=
new Ya(e.lines.slice(b,b+=25)),e.height-=d.height,this.children.splice(++c,0,d),d.parent=this;e.lines=e.lines.slice(0,a);this.maybeSpill()}break}a-=f}};Sa.prototype.maybeSpill=function(){if(!(10>=this.children.length)){var a=this;do{var b=a.children.splice(a.children.length-5,5),b=new Sa(b);if(a.parent){a.size-=b.size;a.height-=b.height;var d=k(a.parent.children,a);a.parent.children.splice(d+1,0,b)}else d=new Sa(a.children),d.parent=a,a.children=[d,b],a=d;b.parent=a.parent}while(10<a.children.length);
a.parent.maybeSpill()}};Sa.prototype.iterN=function(a,b,d){for(var c=0;c<this.children.length;++c){var e=this.children[c],f=e.chunkSize();if(a<f){f=Math.min(b,f-a);if(e.iterN(a,f,d))return!0;if(0==(b-=f))break;a=0}else a-=f}};var lc=function(a,b,d){if(d)for(var c in d)d.hasOwnProperty(c)&&(this[c]=d[c]);this.doc=a;this.node=b};lc.prototype.clear=function(){var a=this.doc.cm,b=this.line.widgets,d=this.line,c=P(d);if(null!=c&&b){for(var e=0;e<b.length;++e)b[e]==this&&b.splice(e--,1);b.length||(d.widgets=
null);var f=$b(this);R(d,Math.max(0,d.height-f));a&&(Da(a,function(){var b=-f;ya(d)<(a.curOp&&a.curOp.scrollTop||a.doc.scrollTop)&&Ic(a,null,b);cb(a,c,"widget")}),ma(a,"lineWidgetCleared",a,this,c))}};lc.prototype.changed=function(){var a=this,b=this.height,d=this.doc.cm,c=this.line;this.height=null;var e=$b(this)-b;e&&(R(c,c.height+e),d&&Da(d,function(){d.curOp.forceUpdate=!0;ya(c)<(d.curOp&&d.curOp.scrollTop||d.doc.scrollTop)&&Ic(d,null,e);ma(d,"lineWidgetChanged",d,a,P(c))}))};ub(lc);var cf=0,
eb=function(a,b){this.lines=[];this.type=b;this.doc=a;this.id=++cf};eb.prototype.clear=function(){if(!this.explicitlyCleared){var a=this.doc.cm,b=a&&!a.curOp;b&&Db(a);if(Ia(this,"clear")){var d=this.find();d&&ma(this,"clear",d.from,d.to)}for(var c=d=null,e=0;e<this.lines.length;++e){var f=this.lines[e],g=Ta(f.markedSpans,this);a&&!this.collapsed?cb(a,P(f),"text"):a&&(null!=g.to&&(c=P(f)),null!=g.from&&(d=P(f)));for(var k=f,l=void 0,h=f.markedSpans,p=g,r=0;r<h.length;++r)h[r]!=p&&(l||(l=[])).push(h[r]);
k.markedSpans=l;null==g.from&&this.collapsed&&!xa(this.doc,f)&&a&&R(f,kb(a.display))}if(a&&this.collapsed&&!a.options.lineWrapping)for(e=0;e<this.lines.length;++e)f=Fa(this.lines[e]),g=Ha(f),g>a.display.maxLineLength&&(a.display.maxLine=f,a.display.maxLineLength=g,a.display.maxLineChanged=!0);null!=d&&a&&this.collapsed&&ra(a,d,c+1);this.lines.length=0;this.explicitlyCleared=!0;this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,a&&Te(a.doc));a&&ma(a,"markerCleared",a,this,d,c);b&&Eb(a);this.parent&&
this.parent.clear()}};eb.prototype.find=function(a,b){null==a&&"bookmark"==this.type&&(a=1);for(var d,c,e=0;e<this.lines.length;++e){var f=this.lines[e],g=Ta(f.markedSpans,this);if(null!=g.from&&(d=H(b?f:P(f),g.from),-1==a))return d;if(null!=g.to&&(c=H(b?f:P(f),g.to),1==a))return c}return d&&{from:d,to:c}};eb.prototype.changed=function(){var a=this,b=this.find(-1,!0),d=this,c=this.doc.cm;b&&c&&Da(c,function(){var e=b.line,f=P(b.line);if(f=md(c,f))pe(f),c.curOp.selectionChanged=c.curOp.forceUpdate=
!0;c.curOp.updateMaxLine=!0;xa(d.doc,e)||null==d.height||(f=d.height,d.height=null,(f=$b(d)-f)&&R(e,e.height+f));ma(c,"markerChanged",c,a)})};eb.prototype.attachLine=function(a){if(!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;b.maybeHiddenMarkers&&-1!=k(b.maybeHiddenMarkers,this)||(b.maybeUnhiddenMarkers||(b.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(a)};eb.prototype.detachLine=function(a){this.lines.splice(k(this.lines,a),1);!this.lines.length&&this.doc.cm&&(a=this.doc.cm.curOp,
(a.maybeHiddenMarkers||(a.maybeHiddenMarkers=[])).push(this))};ub(eb);var mc=function(a,b){this.markers=a;this.primary=b;for(b=0;b<a.length;++b)a[b].parent=this};mc.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var a=0;a<this.markers.length;++a)this.markers[a].clear();ma(this,"clear")}};mc.prototype.find=function(a,b){return this.primary.find(a,b)};ub(mc);var Ig=0,ta=function(a,b,d,c){if(!(this instanceof ta))return new ta(a,b,d,c);null==d&&(d=0);Sa.call(this,
[new Ya([new Fb("",null)])]);this.first=d;this.scrollTop=this.scrollLeft=0;this.cantEdit=!1;this.cleanGeneration=1;this.frontier=d;d=H(d,0);this.sel=Xa(d);this.history=new Mc(null);this.id=++Ig;this.modeOption=b;this.lineSep=c;this.extend=!1;"string"==typeof a&&(a=this.splitLines(a));Dd(this,{from:d,to:d,text:a});oa(this,Xa(d),Ra)};ta.prototype=A(Sa.prototype,{constructor:ta,iter:function(a,b,d){d?this.iterN(a-this.first,b-a,d):this.iterN(this.first,this.first+this.size,a)},insert:function(a,b){for(var d=
0,c=0;c<b.length;++c)d+=b[c].height;this.insertInner(a-this.first,b,d)},remove:function(a,b){this.removeInner(a-this.first,b)},getValue:function(a){var b=V(this,this.first,this.first+this.size);return!1===a?b:b.join(a||this.lineSeparator())},setValue:na(function(a){var b=H(this.first,0),d=this.first+this.size-1;Ib(this,{from:b,to:H(d,E(this,d).text.length),text:this.splitLines(a),origin:"setValue",full:!0},!0);oa(this,Xa(b))}),replaceRange:function(a,b,d,c){b=Q(this,b);d=d?Q(this,d):b;Jb(this,a,b,
d,c)},getRange:function(a,b,d){a=U(this,Q(this,a),Q(this,b));return!1===d?a:a.join(d||this.lineSeparator())},getLine:function(a){return(a=this.getLineHandle(a))&&a.text},getLineHandle:function(a){if(ca(this,a))return E(this,a)},getLineNumber:function(a){return P(a)},getLineHandleVisualStart:function(a){"number"==typeof a&&(a=E(this,a));return Fa(a)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(a){return Q(this,
a)},getCursor:function(a){var b=this.sel.primary();return null==a||"head"==a?b.head:"anchor"==a?b.anchor:"end"==a||"to"==a||!1===a?b.to():b.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:na(function(a,b,d){a=Q(this,"number"==typeof a?H(a,b||0):a);oa(this,Xa(a,null),d)}),setSelection:na(function(a,b,d){var c=Q(this,a);a=Q(this,b||a);oa(this,Xa(c,a),d)}),extendSelection:na(function(a,b,d){Oc(this,Q(this,a),b&&Q(this,
b),d)}),extendSelections:na(function(a,b){Pe(this,wa(this,a),b)}),extendSelectionsBy:na(function(a,b){a=x(this.sel.ranges,a);Pe(this,wa(this,a),b)}),setSelections:na(function(a,b,d){if(a.length){for(var c=[],e=0;e<a.length;e++)c[e]=new X(Q(this,a[e].anchor),Q(this,a[e].head));null==b&&(b=Math.min(a.length-1,this.sel.primIndex));oa(this,Oa(c,b),d)}}),addSelection:na(function(a,b,d){var c=this.sel.ranges.slice(0);c.push(new X(Q(this,a),Q(this,b||a)));oa(this,Oa(c,c.length-1),d)}),getSelection:function(a){for(var b=
this.sel.ranges,d,c=0;c<b.length;c++){var e=U(this,b[c].from(),b[c].to());d=d?d.concat(e):e}return!1===a?d:d.join(a||this.lineSeparator())},getSelections:function(a){for(var b=[],d=this.sel.ranges,c=0;c<d.length;c++){var e=U(this,d[c].from(),d[c].to());!1!==a&&(e=e.join(a||this.lineSeparator()));b[c]=e}return b},replaceSelection:function(a,b,d){for(var c=[],e=0;e<this.sel.ranges.length;e++)c[e]=a;this.replaceSelections(c,b,d||"+input")},replaceSelections:na(function(a,b,d){for(var c=[],e=this.sel,
f=0;f<e.ranges.length;f++){var g=e.ranges[f];c[f]={from:g.from(),to:g.to(),text:this.splitLines(a[f]),origin:d}}if(a=b&&"end"!=b){a=[];e=d=H(this.first,0);for(f=0;f<c.length;f++){var k=c[f],g=Ie(k.from,d,e),l=Ie(db(k),d,e);d=k.to;e=l;"around"==b?(k=this.sel.ranges[f],k=0>O(k.head,k.anchor),a[f]=new X(k?l:g,k?g:l)):a[f]=new X(g,g)}a=new Ea(a,this.sel.primIndex)}b=a;for(a=c.length-1;0<=a;a--)Ib(this,c[a]);b?Qe(this,b):this.cm&&Cb(this.cm)}),undo:na(function(){Qc(this,"undo")}),redo:na(function(){Qc(this,
"redo")}),undoSelection:na(function(){Qc(this,"undo",!0)}),redoSelection:na(function(){Qc(this,"redo",!0)}),setExtending:function(a){this.extend=a},getExtending:function(){return this.extend},historySize:function(){for(var a=this.history,b=0,d=0,c=0;c<a.done.length;c++)a.done[c].ranges||++b;for(c=0;c<a.undone.length;c++)a.undone[c].ranges||++d;return{undo:b,redo:d}},clearHistory:function(){this.history=new Mc(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},
changeGeneration:function(a){a&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null);return this.history.generation},isClean:function(a){return this.history.generation==(a||this.cleanGeneration)},getHistory:function(){return{done:Gb(this.history.done),undone:Gb(this.history.undone)}},setHistory:function(a){var b=this.history=new Mc(this.history.maxGeneration);b.done=Gb(a.done.slice(0),null,!0);b.undone=Gb(a.undone.slice(0),null,!0)},setGutterMarker:na(function(a,b,d){return kc(this,
a,"gutter",function(a){var c=a.gutterMarkers||(a.gutterMarkers={});c[b]=d;!d&&G(c)&&(a.gutterMarkers=null);return!0})}),clearGutter:na(function(a){var b=this;this.iter(function(d){d.gutterMarkers&&d.gutterMarkers[a]&&kc(b,d,"gutter",function(){d.gutterMarkers[a]=null;G(d.gutterMarkers)&&(d.gutterMarkers=null);return!0})})}),lineInfo:function(a){var b;if("number"==typeof a){if(!ca(this,a))return null;b=a;a=E(this,a);if(!a)return null}else if(b=P(a),null==b)return null;return{line:b,handle:a,text:a.text,
gutterMarkers:a.gutterMarkers,textClass:a.textClass,bgClass:a.bgClass,wrapClass:a.wrapClass,widgets:a.widgets}},addLineClass:na(function(a,b,d){return kc(this,a,"gutter"==b?"gutter":"class",function(a){var e="text"==b?"textClass":"background"==b?"bgClass":"gutter"==b?"gutterClass":"wrapClass";if(a[e]){if(c(d).test(a[e]))return!1;a[e]+=" "+d}else a[e]=d;return!0})}),removeLineClass:na(function(a,b,d){return kc(this,a,"gutter"==b?"gutter":"class",function(a){var e="text"==b?"textClass":"background"==
b?"bgClass":"gutter"==b?"gutterClass":"wrapClass",f=a[e];if(f)if(null==d)a[e]=null;else{var g=f.match(c(d));if(!g)return!1;var k=g.index+g[0].length;a[e]=f.slice(0,g.index)+(g.index&&k!=f.length?" ":"")+f.slice(k)||null}else return!1;return!0})}),addLineWidget:na(function(a,b,d){return gg(this,a,b,d)}),removeLineWidget:function(a){a.clear()},markText:function(a,b,d){return Kb(this,Q(this,a),Q(this,b),d,d&&d.type||"range")},setBookmark:function(a,b){b={replacedWith:b&&(null==b.nodeType?b.widget:b),
insertLeft:b&&b.insertLeft,clearWhenEmpty:!1,shared:b&&b.shared,handleMouseEvents:b&&b.handleMouseEvents};a=Q(this,a);return Kb(this,a,a,b,"bookmark")},findMarksAt:function(a){a=Q(this,a);var b=[],d=E(this,a.line).markedSpans;if(d)for(var c=0;c<d.length;++c){var e=d[c];(null==e.from||e.from<=a.ch)&&(null==e.to||e.to>=a.ch)&&b.push(e.marker.parent||e.marker)}return b},findMarks:function(a,b,d){a=Q(this,a);b=Q(this,b);var c=[],e=a.line;this.iter(a.line,b.line+1,function(f){if(f=f.markedSpans)for(var g=
0;g<f.length;g++){var k=f[g];null!=k.to&&e==a.line&&a.ch>=k.to||null==k.from&&e!=a.line||null!=k.from&&e==b.line&&k.from>=b.ch||d&&!d(k.marker)||c.push(k.marker.parent||k.marker)}++e});return c},getAllMarks:function(){var a=[];this.iter(function(b){if(b=b.markedSpans)for(var d=0;d<b.length;++d)null!=b[d].from&&a.push(b[d].marker)});return a},posFromIndex:function(a){var b,d=this.first,c=this.lineSeparator().length;this.iter(function(e){e=e.text.length+c;if(e>a)return b=a,!0;a-=e;++d});return Q(this,
H(d,b))},indexFromPos:function(a){a=Q(this,a);var b=a.ch;if(a.line<this.first||0>a.ch)return 0;var d=this.lineSeparator().length;this.iter(this.first,a.line,function(a){b+=a.text.length+d});return b},copy:function(a){var b=new ta(V(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep);b.scrollTop=this.scrollTop;b.scrollLeft=this.scrollLeft;b.sel=this.sel;b.extend=!1;a&&(b.history.undoDepth=this.history.undoDepth,b.setHistory(this.getHistory()));return b},linkedDoc:function(a){a||
(a={});var b=this.first,d=this.first+this.size;null!=a.from&&a.from>b&&(b=a.from);null!=a.to&&a.to<d&&(d=a.to);b=new ta(V(this,b,d),a.mode||this.modeOption,b,this.lineSep);a.sharedHist&&(b.history=this.history);(this.linked||(this.linked=[])).push({doc:b,sharedHist:a.sharedHist});b.linked=[{doc:this,isParent:!0,sharedHist:a.sharedHist}];a=df(this);for(d=0;d<a.length;d++){var c=a[d],e=c.find(),f=b.clipPos(e.from),e=b.clipPos(e.to);O(f,e)&&(f=Kb(b,f,e,c.primary,c.primary.type),c.markers.push(f),f.parent=
c)}return b},unlinkDoc:function(a){a instanceof ba&&(a=a.doc);if(this.linked)for(var b=0;b<this.linked.length;++b)if(this.linked[b].doc==a){this.linked.splice(b,1);a.unlinkDoc(this);ig(df(this));break}if(a.history==this.history){var d=[a.id];nb(a,function(a){return d.push(a.id)},!0);a.history=new Mc(null);a.history.done=Gb(this.history.done,d);a.history.undone=Gb(this.history.undone,d)}},iterLinkedDocs:function(a){nb(this,a)},getMode:function(){return this.mode},getEditor:function(){return this.cm},
splitLines:function(a){return this.lineSep?a.split(this.lineSep):Od(a)},lineSeparator:function(){return this.lineSep||"\n"}});ta.prototype.eachLine=ta.prototype.iter;for(var ff=0,vf=!1,fb={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",
111:"/",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},uc=0;10>uc;uc++)fb[uc+48]=fb[uc+96]=String(uc);for(var Zc=65;90>=Zc;Zc++)fb[Zc]=String.fromCharCode(Zc);for(var vc=1;12>=vc;vc++)fb[vc+111]=fb[vc+63235]="F"+vc;var nc={basic:{Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",
End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},pcDefault:{"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft",
"Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},emacsy:{"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown",
"Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},macDefault:{"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft",
"Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",
fallthrough:["basic","emacsy"]}};nc["default"]=La?nc.macDefault:nc.pcDefault;var Tc={selectAll:Ve,singleSelection:function(a){return a.setSelection(a.getCursor("anchor"),a.getCursor("head"),Ra)},killLine:function(a){return Mb(a,function(b){if(b.empty()){var d=E(a.doc,b.head.line).text.length;return b.head.ch==d&&b.head.line<a.lastLine()?{from:b.head,to:H(b.head.line+1,0)}:{from:b.head,to:H(b.head.line,d)}}return{from:b.from(),to:b.to()}})},deleteLine:function(a){return Mb(a,function(b){return{from:H(b.from().line,
0),to:Q(a.doc,H(b.to().line+1,0))}})},delLineLeft:function(a){return Mb(a,function(a){return{from:H(a.from().line,0),to:a.from()}})},delWrappedLineLeft:function(a){return Mb(a,function(b){var d=a.charCoords(b.head,"div").top+5;return{from:a.coordsChar({left:0,top:d},"div"),to:b.from()}})},delWrappedLineRight:function(a){return Mb(a,function(b){var d=a.charCoords(b.head,"div").top+5,d=a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:d},"div");return{from:b.from(),to:d}})},undo:function(a){return a.undo()},
redo:function(a){return a.redo()},undoSelection:function(a){return a.undoSelection()},redoSelection:function(a){return a.redoSelection()},goDocStart:function(a){return a.extendSelection(H(a.firstLine(),0))},goDocEnd:function(a){return a.extendSelection(H(a.lastLine()))},goLineStart:function(a){return a.extendSelectionsBy(function(b){return lf(a,b.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(a){return a.extendSelectionsBy(function(b){return mf(a,b.head)},{origin:"+move",bias:1})},
goLineEnd:function(a){return a.extendSelectionsBy(function(b){b=b.head.line;var d=E(a.doc,b),c;c=d;for(var e;e=Ja(c,!1);)c=e.find(1,!0).line;c!=d&&(b=P(c));return ad(!0,a,d,b,-1)},{origin:"+move",bias:-1})},goLineRight:function(a){return a.extendSelectionsBy(function(b){b=a.charCoords(b.head,"div").top+5;return a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:b},"div")},sc)},goLineLeft:function(a){return a.extendSelectionsBy(function(b){b=a.charCoords(b.head,"div").top+5;return a.coordsChar({left:0,
top:b},"div")},sc)},goLineLeftSmart:function(a){return a.extendSelectionsBy(function(b){var d=a.charCoords(b.head,"div").top+5,d=a.coordsChar({left:0,top:d},"div");return d.ch<a.getLine(d.line).search(/\S/)?mf(a,b.head):d},sc)},goLineUp:function(a){return a.moveV(-1,"line")},goLineDown:function(a){return a.moveV(1,"line")},goPageUp:function(a){return a.moveV(-1,"page")},goPageDown:function(a){return a.moveV(1,"page")},goCharLeft:function(a){return a.moveH(-1,"char")},goCharRight:function(a){return a.moveH(1,
"char")},goColumnLeft:function(a){return a.moveH(-1,"column")},goColumnRight:function(a){return a.moveH(1,"column")},goWordLeft:function(a){return a.moveH(-1,"word")},goGroupRight:function(a){return a.moveH(1,"group")},goGroupLeft:function(a){return a.moveH(-1,"group")},goWordRight:function(a){return a.moveH(1,"word")},delCharBefore:function(a){return a.deleteH(-1,"char")},delCharAfter:function(a){return a.deleteH(1,"char")},delWordBefore:function(a){return a.deleteH(-1,"word")},delWordAfter:function(a){return a.deleteH(1,
"word")},delGroupBefore:function(a){return a.deleteH(-1,"group")},delGroupAfter:function(a){return a.deleteH(1,"group")},indentAuto:function(a){return a.indentSelection("smart")},indentMore:function(a){return a.indentSelection("add")},indentLess:function(a){return a.indentSelection("subtract")},insertTab:function(a){return a.replaceSelection("\t")},insertSoftTab:function(a){for(var b=[],d=a.listSelections(),c=a.options.tabSize,e=0;e<d.length;e++){var f=d[e].from(),f=r(a.getLine(f.line),f.ch,c);b.push(t(c-
f%c))}a.replaceSelections(b)},defaultTab:function(a){a.somethingSelected()?a.indentSelection("add"):a.execCommand("insertTab")},transposeChars:function(a){return Da(a,function(){for(var b=a.listSelections(),d=[],c=0;c<b.length;c++)if(b[c].empty()){var e=b[c].head,f=E(a.doc,e.line).text;if(f)if(e.ch==f.length&&(e=new H(e.line,e.ch-1)),0<e.ch)e=new H(e.line,e.ch+1),a.replaceRange(f.charAt(e.ch-1)+f.charAt(e.ch-2),H(e.line,e.ch-2),e,"+transpose");else if(e.line>a.doc.first){var g=E(a.doc,e.line-1).text;
g&&(e=new H(e.line,1),a.replaceRange(f.charAt(0)+a.doc.lineSeparator()+g.charAt(g.length-1),H(e.line-1,g.length-1),e,"+transpose"))}d.push(new X(e,e))}a.setSelections(d)})},newlineAndIndent:function(a){return Da(a,function(){for(var b=a.listSelections(),d=b.length-1;0<=d;d--)a.replaceRange(a.doc.lineSeparator(),b[d].anchor,b[d].head,"+input");b=a.listSelections();for(d=0;d<b.length;d++)a.indentLine(b[d].from().line,null,!0);Cb(a)})},openLine:function(a){return a.replaceSelection("\n","start")},toggleOverwrite:function(a){return a.toggleOverwrite()}},
pg=new ob,Id=null,Wc,Vc,Nb={toString:function(){return"CodeMirror.Init"}},uf={},Xc={};ba.defaults=uf;ba.optionHandlers=Xc;var Md=[];ba.defineInitHook=function(a){return Md.push(a)};var ua=null,Z=function(a){this.cm=a;this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null;this.polling=new ob;this.composing=null;this.gracePeriod=!1;this.readDOMTimeout=null};Z.prototype.init=function(a){function b(a){if(!ha(e,a)){if(e.somethingSelected())ua={lineWise:!1,text:e.getSelections()},
"cut"==a.type&&e.replaceSelection("",null,"cut");else if(e.options.lineWiseCopyCut){var b=zf(e);ua={lineWise:!0,text:b.text};"cut"==a.type&&e.operation(function(){e.setSelections(b.ranges,0,Ra);e.replaceSelection("",null,"cut")})}else return;if(a.clipboardData){a.clipboardData.clearData();var d=ua.text.join("\n");a.clipboardData.setData("Text",d);if(a.clipboardData.getData("Text")==d){a.preventDefault();return}}var g=Bf();a=g.firstChild;e.display.lineSpace.insertBefore(g,e.display.lineSpace.firstChild);
a.value=ua.text.join("\n");var k=document.activeElement;Pb(a);setTimeout(function(){e.display.lineSpace.removeChild(g);k.focus();k==f&&c.showPrimarySelection()},50)}}var d=this,c=this,e=c.cm,f=c.div=a.lineDiv;Af(f,e.options.spellcheck);S(f,"paste",function(a){ha(e,a)||yf(a,e)||11>=aa&&setTimeout(ja(e,function(){c.pollContent()||ra(e)}),20)});S(f,"compositionstart",function(a){d.composing={data:a.data,done:!1}});S(f,"compositionupdate",function(a){d.composing||(d.composing={data:a.data,done:!1})});
S(f,"compositionend",function(a){d.composing&&(a.data!=d.composing.data&&d.readFromDOMSoon(),d.composing.done=!0)});S(f,"touchstart",function(){return c.forceCompositionEnd()});S(f,"input",function(){d.composing||d.readFromDOMSoon()});S(f,"copy",b);S(f,"cut",b)};Z.prototype.prepareSelection=function(){var a=ue(this.cm,!1);a.focus=this.cm.state.focused;return a};Z.prototype.showSelection=function(a,b){a&&this.cm.display.view.length&&((a.focus||b)&&this.showPrimarySelection(),this.showMultipleSelections(a))};
Z.prototype.showPrimarySelection=function(){var a=window.getSelection(),b=this.cm.doc.sel.primary(),d=Yc(this.cm,a.anchorNode,a.anchorOffset),c=Yc(this.cm,a.focusNode,a.focusOffset);if(!d||d.bad||!c||c.bad||0!=O(ka(d,c),b.from())||0!=O(za(d,c),b.to()))if(d=Df(this.cm,b.from()),c=Df(this.cm,b.to()),d||c){var e=this.cm.display.view,b=a.rangeCount&&a.getRangeAt(0);d?c||(c=e[e.length-1].measure,c=c.maps?c.maps[c.maps.length-1]:c.map,c={node:c[c.length-1],offset:c[c.length-2]-c[c.length-3]}):d={node:e[0].measure.map[2],
offset:0};var f;try{f=xb(d.node,d.offset,c.offset,c.node)}catch(Kg){}f&&(!Za&&this.cm.state.focused?(a.collapse(d.node,d.offset),f.collapsed||(a.removeAllRanges(),a.addRange(f))):(a.removeAllRanges(),a.addRange(f)),b&&null==a.anchorNode?a.addRange(b):Za&&this.startGracePeriod());this.rememberSelection()}};Z.prototype.startGracePeriod=function(){var a=this;clearTimeout(this.gracePeriod);this.gracePeriod=setTimeout(function(){a.gracePeriod=!1;a.selectionChanged()&&a.cm.operation(function(){return a.cm.curOp.selectionChanged=
!0})},20)};Z.prototype.showMultipleSelections=function(b){a(this.cm.display.cursorDiv,b.cursors);a(this.cm.display.selectionDiv,b.selection)};Z.prototype.rememberSelection=function(){var a=window.getSelection();this.lastAnchorNode=a.anchorNode;this.lastAnchorOffset=a.anchorOffset;this.lastFocusNode=a.focusNode;this.lastFocusOffset=a.focusOffset};Z.prototype.selectionInEditor=function(){var a=window.getSelection();if(!a.rangeCount)return!1;a=a.getRangeAt(0).commonAncestorContainer;return d(this.div,
a)};Z.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()||this.showSelection(this.prepareSelection(),!0),this.div.focus())};Z.prototype.blur=function(){this.div.blur()};Z.prototype.getField=function(){return this.div};Z.prototype.supportsTouch=function(){return!0};Z.prototype.receivedFocus=function(){function a(){b.cm.state.focused&&(b.pollSelection(),b.polling.set(b.cm.options.pollInterval,a))}var b=this;this.selectionInEditor()?this.pollSelection():Da(this.cm,
function(){return b.cm.curOp.selectionChanged=!0});this.polling.set(this.cm.options.pollInterval,a)};Z.prototype.selectionChanged=function(){var a=window.getSelection();return a.anchorNode!=this.lastAnchorNode||a.anchorOffset!=this.lastAnchorOffset||a.focusNode!=this.lastFocusNode||a.focusOffset!=this.lastFocusOffset};Z.prototype.pollSelection=function(){if(!this.composing&&null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var a=window.getSelection(),b=this.cm;this.rememberSelection();
var d=Yc(b,a.anchorNode,a.anchorOffset),c=Yc(b,a.focusNode,a.focusOffset);d&&c&&Da(b,function(){oa(b.doc,Xa(d,c),Ra);if(d.bad||c.bad)b.curOp.selectionChanged=!0})}};Z.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var a=this.cm,b=a.display,d=a.doc.sel.primary(),c=d.from(),d=d.to();0==c.ch&&c.line>a.firstLine()&&(c=H(c.line-1,E(a.doc,c.line-1).length));d.ch==E(a.doc,d.line).text.length&&d.line<a.lastLine()&&(d=H(d.line+1,0));
if(c.line<b.viewFrom||d.line>b.viewTo-1)return!1;var e;c.line==b.viewFrom||0==(e=jb(a,c.line))?(c=P(b.view[0].line),e=b.view[0].node):(c=P(b.view[e].line),e=b.view[e-1].node.nextSibling);var f=jb(a,d.line);f==b.view.length-1?(d=b.viewTo-1,b=b.lineDiv.lastChild):(d=P(b.view[f+1].line)-1,b=b.view[f+1].node.previousSibling);if(!e)return!1;b=a.doc.splitLines(Bg(a,e,b,c,d));for(e=U(a.doc,H(c,0),H(d,E(a.doc,d).text.length));1<b.length&&1<e.length;)if(n(b)==n(e))b.pop(),e.pop(),d--;else if(b[0]==e[0])b.shift(),
e.shift(),c++;else break;for(var g=0,f=0,k=b[0],l=e[0],h=Math.min(k.length,l.length);g<h&&k.charCodeAt(g)==l.charCodeAt(g);)++g;k=n(b);l=n(e);for(h=Math.min(k.length-(1==b.length?g:0),l.length-(1==e.length?g:0));f<h&&k.charCodeAt(k.length-f-1)==l.charCodeAt(l.length-f-1);)++f;b[b.length-1]=k.slice(0,k.length-f).replace(/^\u200b+/,"");b[0]=b[0].slice(g).replace(/\u200b+$/,"");c=H(c,g);d=H(d,e.length?n(e).length-f:0);if(1<b.length||b[0]||O(c,d))return Jb(a.doc,b,c,d,"+input"),!0};Z.prototype.ensurePolled=
function(){this.forceCompositionEnd()};Z.prototype.reset=function(){this.forceCompositionEnd()};Z.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.pollContent()||ra(this.cm),this.div.blur(),this.div.focus())};Z.prototype.readFromDOMSoon=function(){var a=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){a.readDOMTimeout=null;if(a.composing)if(a.composing.done)a.composing=null;else return;!a.cm.isReadOnly()&&
a.pollContent()||Da(a.cm,function(){return ra(a.cm)})},80))};Z.prototype.setUneditable=function(a){a.contentEditable="false"};Z.prototype.onKeyPress=function(a){0!=a.charCode&&(a.preventDefault(),this.cm.isReadOnly()||ja(this.cm,Nd)(this.cm,String.fromCharCode(null==a.charCode?a.keyCode:a.charCode),0))};Z.prototype.readOnlyChanged=function(a){this.div.contentEditable=String("nocursor"!=a)};Z.prototype.onContextMenu=function(){};Z.prototype.resetPosition=function(){};Z.prototype.needsContentAttribute=
!0;var fa=function(a){this.cm=a;this.prevInput="";this.pollingFast=!1;this.polling=new ob;this.hasSelection=this.inaccurateSelection=!1;this.composing=null};fa.prototype.init=function(a){function b(a){if(!ha(e,a)){if(e.somethingSelected())ua={lineWise:!1,text:e.getSelections()},c.inaccurateSelection&&(c.prevInput="",c.inaccurateSelection=!1,g.value=ua.text.join("\n"),Pb(g));else if(e.options.lineWiseCopyCut){var b=zf(e);ua={lineWise:!0,text:b.text};"cut"==a.type?e.setSelections(b.ranges,null,Ra):
(c.prevInput="",g.value=b.text.join("\n"),Pb(g))}else return;"cut"==a.type&&(e.state.cutIncoming=!0)}}var d=this,c=this,e=this.cm,f=this.wrapper=Bf(),g=this.textarea=f.firstChild;a.wrapper.insertBefore(f,a.wrapper.firstChild);qc&&(g.style.width="0px");S(g,"input",function(){W&&9<=aa&&d.hasSelection&&(d.hasSelection=null);c.poll()});S(g,"paste",function(a){ha(e,a)||yf(a,e)||(e.state.pasteIncoming=!0,c.fastPoll())});S(g,"cut",b);S(g,"copy",b);S(a.scroller,"paste",function(b){Wa(a,b)||ha(e,b)||(e.state.pasteIncoming=
!0,c.focus())});S(a.lineSpace,"selectstart",function(b){Wa(a,b)||qa(b)});S(g,"compositionstart",function(){var a=e.getCursor("from");c.composing&&c.composing.range.clear();c.composing={start:a,range:e.markText(a,e.getCursor("to"),{className:"CodeMirror-composing"})}});S(g,"compositionend",function(){c.composing&&(c.poll(),c.composing.range.clear(),c.composing=null)})};fa.prototype.prepareSelection=function(){var a=this.cm,b=a.display,d=a.doc,c=ue(a);if(a.options.moveInputWithCursor){var a=Ma(a,d.sel.primary().head,
"div"),d=b.wrapper.getBoundingClientRect(),e=b.lineDiv.getBoundingClientRect();c.teTop=Math.max(0,Math.min(b.wrapper.clientHeight-10,a.top+e.top-d.top));c.teLeft=Math.max(0,Math.min(b.wrapper.clientWidth-10,a.left+e.left-d.left))}return c};fa.prototype.showSelection=function(b){var d=this.cm.display;a(d.cursorDiv,b.cursors);a(d.selectionDiv,b.selection);null!=b.teTop&&(this.wrapper.style.top=b.teTop+"px",this.wrapper.style.left=b.teLeft+"px")};fa.prototype.reset=function(a){if(!this.contextMenuPending){var b,
d,c=this.cm,e=c.doc;c.somethingSelected()?(this.prevInput="",b=e.sel.primary(),d=(b=pf&&(100<b.to().line-b.from().line||1E3<(d=c.getSelection()).length))?"-":d||c.getSelection(),this.textarea.value=d,c.state.focused&&Pb(this.textarea),W&&9<=aa&&(this.hasSelection=d)):a||(this.prevInput=this.textarea.value="",W&&9<=aa&&(this.hasSelection=null));this.inaccurateSelection=b}};fa.prototype.getField=function(){return this.textarea};fa.prototype.supportsTouch=function(){return!1};fa.prototype.focus=function(){if("nocursor"!=
this.cm.options.readOnly&&(!Tb||f()!=this.textarea))try{this.textarea.focus()}catch(q){}};fa.prototype.blur=function(){this.textarea.blur()};fa.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0};fa.prototype.receivedFocus=function(){this.slowPoll()};fa.prototype.slowPoll=function(){var a=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){a.poll();a.cm.state.focused&&a.slowPoll()})};fa.prototype.fastPoll=function(){function a(){d.poll()||
b?(d.pollingFast=!1,d.slowPoll()):(b=!0,d.polling.set(60,a))}var b=!1,d=this;d.pollingFast=!0;d.polling.set(20,a)};fa.prototype.poll=function(){var a=this,b=this.cm,d=this.textarea,c=this.prevInput;if(this.contextMenuPending||!b.state.focused||Hg(d)&&!c&&!this.composing||b.isReadOnly()||b.options.disableInput||b.state.keySeq)return!1;var e=d.value;if(e==c&&!b.somethingSelected())return!1;if(W&&9<=aa&&this.hasSelection===e||La&&/[\uf700-\uf7ff]/.test(e))return b.display.input.reset(),!1;if(b.doc.sel==
b.display.selForContextMenu){var f=e.charCodeAt(0);8203!=f||c||(c="\u200b");if(8666==f)return this.reset(),this.cm.execCommand("undo")}for(var g=0,f=Math.min(c.length,e.length);g<f&&c.charCodeAt(g)==e.charCodeAt(g);)++g;Da(b,function(){Nd(b,e.slice(g),c.length-g,null,a.composing?"*compose":null);1E3<e.length||-1<e.indexOf("\n")?d.value=a.prevInput="":a.prevInput=e;a.composing&&(a.composing.range.clear(),a.composing.range=b.markText(a.composing.start,b.getCursor("to"),{className:"CodeMirror-composing"}))});
return!0};fa.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)};fa.prototype.onKeyPress=function(){W&&9<=aa&&(this.hasSelection=null);this.fastPoll()};fa.prototype.onContextMenu=function(a){function b(){if(null!=g.selectionStart){var a=e.somethingSelected(),b="\u200b"+(a?g.value:"");g.value="\u21da";g.value=b;c.prevInput=a?"":"\u200b";g.selectionStart=1;g.selectionEnd=b.length;f.selForContextMenu=e.doc.sel}}function d(){c.contextMenuPending=!1;c.wrapper.style.cssText=
p;g.style.cssText=h;W&&9>aa&&f.scrollbars.setScrollTop(f.scroller.scrollTop=l);if(null!=g.selectionStart){(!W||W&&9>aa)&&b();var a=0,d=function(){f.selForContextMenu==e.doc.sel&&0==g.selectionStart&&0<g.selectionEnd&&"\u200b"==c.prevInput?ja(e,Ve)(e):10>a++?f.detectingSelectAll=setTimeout(d,500):(f.selForContextMenu=null,f.input.reset())};f.detectingSelectAll=setTimeout(d,200)}}var c=this,e=c.cm,f=e.display,g=c.textarea,k=mb(e,a),l=f.scroller.scrollTop;if(k&&!Na){e.options.resetSelectionOnContextMenu&&
-1==e.doc.sel.contains(k)&&ja(e,oa)(e.doc,Xa(k),Ra);var h=g.style.cssText,p=c.wrapper.style.cssText;c.wrapper.style.cssText="position: absolute";k=c.wrapper.getBoundingClientRect();g.style.cssText="position: absolute; width: 30px; height: 30px;\n      top: "+(a.clientY-k.top-5)+"px; left: "+(a.clientX-k.left-5)+"px;\n      z-index: 1000; background: "+(W?"rgba(255, 255, 255, .05)":"transparent")+";\n      outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";
var r;la&&(r=window.scrollY);f.input.focus();la&&window.scrollTo(null,r);f.input.reset();e.somethingSelected()||(g.value=c.prevInput=" ");c.contextMenuPending=!0;f.selForContextMenu=e.doc.sel;clearTimeout(f.detectingSelectAll);W&&9<=aa&&b();if(Kd){Wb(a);var u=function(){Ka(window,"mouseup",u);setTimeout(d,20)};S(window,"mouseup",u)}else setTimeout(d,50)}};fa.prototype.readOnlyChanged=function(a){a||this.reset()};fa.prototype.setUneditable=function(){};fa.prototype.needsContentAttribute=!1;(function(a){function b(b,
c,e,f){a.defaults[b]=c;e&&(d[b]=f?function(a,b,d){d!=Nb&&e(a,b,d)}:e)}var d=a.optionHandlers;a.defineOption=b;a.Init=Nb;b("value","",function(a,b){return a.setValue(b)},!0);b("mode",null,function(a,b){a.doc.modeOption=b;Cd(a)},!0);b("indentUnit",2,Cd,!0);b("indentWithTabs",!1);b("smartIndent",!0);b("tabSize",4,function(a){hc(a);bc(a);ra(a)},!0);b("lineSeparator",null,function(a,b){if(a.doc.lineSep=b){var d=[],c=a.doc.first;a.doc.iter(function(a){for(var e=0;;){var f=a.text.indexOf(b,e);if(-1==f)break;
e=f+b.length;d.push(H(c,f))}c++});for(var e=d.length-1;0<=e;e--)Jb(a.doc,b,d[e],H(d[e].line,d[e].ch+b.length))}});b("specialChars",/[\u0000-\u001f\u007f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(a,b,d){a.state.specialChars=new RegExp(b.source+(b.test("\t")?"":"|\t"),"g");d!=Nb&&a.refresh()});b("specialCharPlaceholder",Sf,function(a){return a.refresh()},!0);b("electricChars",!0);b("inputStyle",Tb?"contenteditable":"textarea",function(){throw Error("inputStyle can not (yet) be changed in a running editor");
},!0);b("spellcheck",!1,function(a,b){return a.getInputField().spellcheck=b},!0);b("rtlMoveVisually",!Gg);b("wholeLineUpdateBefore",!0);b("theme","default",function(a){tf(a);oc(a)},!0);b("keyMap","default",function(a,b,d){b=Rc(b);(d=d!=Nb&&Rc(d))&&d.detach&&d.detach(a,b);b.attach&&b.attach(a,d||null)});b("extraKeys",null);b("lineWrapping",!1,zg,!0);b("gutters",[],function(a){Ad(a.options);oc(a)},!0);b("fixedGutter",!0,function(a,b){a.display.gutters.style.left=b?qd(a.display)+"px":"0";a.refresh()},
!0);b("coverGutterNextToScrollbar",!1,function(a){return Bb(a)},!0);b("scrollbarStyle","native",function(a){Ce(a);Bb(a);a.display.scrollbars.setScrollTop(a.doc.scrollTop);a.display.scrollbars.setScrollLeft(a.doc.scrollLeft)},!0);b("lineNumbers",!1,function(a){Ad(a.options);oc(a)},!0);b("firstLineNumber",1,oc,!0);b("lineNumberFormatter",function(a){return a},oc,!0);b("showCursorWhenSelecting",!1,cc,!0);b("resetSelectionOnContextMenu",!0);b("lineWiseCopyCut",!0);b("readOnly",!1,function(a,b){"nocursor"==
b?(dc(a),a.display.input.blur(),a.display.disabled=!0):a.display.disabled=!1;a.display.input.readOnlyChanged(b)});b("disableInput",!1,function(a,b){b||a.display.input.reset()},!0);b("dragDrop",!0,yg);b("allowDropFileTypes",null);b("cursorBlinkRate",530);b("cursorScrollMargin",0);b("cursorHeight",1,cc,!0);b("singleCursorHeightPerLine",!0,cc,!0);b("workTime",100);b("workDelay",100);b("flattenSpans",!0,hc,!0);b("addModeClass",!1,hc,!0);b("pollInterval",100);b("undoDepth",200,function(a,b){return a.doc.history.undoDepth=
b});b("historyEventDelay",1250);b("viewportMargin",10,function(a){return a.refresh()},!0);b("maxHighlightLength",1E4,hc,!0);b("moveInputWithCursor",!0,function(a,b){b||a.display.input.resetPosition()});b("tabindex",null,function(a,b){return a.display.input.getField().tabIndex=b||""});b("autofocus",null)})(ba);(function(a){var b=a.optionHandlers,d=a.helpers={};a.prototype={constructor:a,focus:function(){window.focus();this.display.input.focus()},setOption:function(a,d){var c=this.options,e=c[a];if(c[a]!=
d||"mode"==a)c[a]=d,b.hasOwnProperty(a)&&ja(this,b[a])(this,d,e),ea(this,"optionChange",this,a)},getOption:function(a){return this.options[a]},getDoc:function(){return this.doc},addKeyMap:function(a,b){this.state.keyMaps[b?"push":"unshift"](Rc(a))},removeKeyMap:function(a){for(var b=this.state.keyMaps,d=0;d<b.length;++d)if(b[d]==a||b[d].name==a)return b.splice(d,1),!0},addOverlay:sa(function(b,d){var c=b.token?b:a.getMode(this.options,b);if(c.startState)throw Error("Overlays may not be stateful.");
y(this.state.overlays,{mode:c,modeSpec:b,opaque:d&&d.opaque,priority:d&&d.priority||0},function(a){return a.priority});this.state.modeGen++;ra(this)}),removeOverlay:sa(function(a){for(var b=this.state.overlays,d=0;d<b.length;++d){var c=b[d].modeSpec;if(c==a||"string"==typeof a&&c.name==a){b.splice(d,1);this.state.modeGen++;ra(this);break}}}),indentLine:sa(function(a,b,d){"string"!=typeof b&&"number"!=typeof b&&(b=null==b?this.options.smartIndent?"smart":"prev":b?"add":"subtract");ca(this.doc,a)&&
pc(this,a,b,d)}),indentSelection:sa(function(a){for(var b=this.doc.sel.ranges,d=-1,c=0;c<b.length;c++){var e=b[c];if(e.empty())e.head.line>d&&(pc(this,e.head.line,a,!0),d=e.head.line,c==this.doc.sel.primIndex&&Cb(this));else{for(var f=e.from(),e=e.to(),g=Math.max(d,f.line),d=Math.min(this.lastLine(),e.line-(e.ch?0:1))+1,e=g;e<d;++e)pc(this,e,a);e=this.doc.sel.ranges;0==f.ch&&b.length==e.length&&0<e[c].from().ch&&Fd(this.doc,c,new X(f,e[c].to()),Ra)}}}),getTokenAt:function(a,b){return ae(this,a,b)},
getLineTokens:function(a,b){return ae(this,H(a),b,!0)},getTokenTypeAt:function(a){a=Q(this.doc,a);var b=Zd(this,E(this.doc,a.line)),d=0,c=(b.length-1)/2;a=a.ch;if(0==a)b=b[2];else for(;;){var e=d+c>>1;if((e?b[2*e-1]:0)>=a)c=e;else if(b[2*e+1]<a)d=e+1;else{b=b[2*e+2];break}}d=b?b.indexOf("overlay "):-1;return 0>d?b:0==d?null:b.slice(0,d-1)},getModeAt:function(b){var d=this.doc.mode;return d.innerMode?a.innerMode(d,this.getTokenAt(b).state).mode:d},getHelper:function(a,b){return this.getHelpers(a,b)[0]},
getHelpers:function(a,b){var c=[];if(!d.hasOwnProperty(b))return c;var e=d[b];a=this.getModeAt(a);if("string"==typeof a[b])e[a[b]]&&c.push(e[a[b]]);else if(a[b])for(var f=0;f<a[b].length;f++){var g=e[a[b][f]];g&&c.push(g)}else a.helperType&&e[a.helperType]?c.push(e[a.helperType]):e[a.name]&&c.push(e[a.name]);for(b=0;b<e._global.length;b++)f=e._global[b],f.pred(a,this)&&-1==k(c,f.val)&&c.push(f.val);return c},getStateAfter:function(a,b){var d=this.doc;a=Math.max(d.first,Math.min(null==a?d.first+d.size-
1:a,d.first+d.size-1));return Xb(this,a+1,b)},cursorCoords:function(a,b){var d=this.doc.sel.primary();a=null==a?d.head:"object"==typeof a?Q(this.doc,a):a?d.from():d.to();return Ma(this,a,b||"page")},charCoords:function(a,b){return Ec(this,Q(this.doc,a),b||"page")},coordsChar:function(a,b){a=re(this,a,b||"page");return pd(this,a.left,a.top)},lineAtHeight:function(a,b){a=re(this,{top:a,left:0},b||"page").top;return T(this.doc,a+this.display.viewOffset)},heightAtLine:function(a,b,d){var c=!1;if("number"==
typeof a){var e=this.doc.first+this.doc.size-1;a<this.doc.first?a=this.doc.first:a>e&&(a=e,c=!0);a=E(this.doc,a)}return hb(this,a,{top:0,left:0},b||"page",d||c).top+(c?this.doc.height-ya(a):0)},defaultTextHeight:function(){return kb(this.display)},defaultCharWidth:function(){return ac(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(a,b,d,c,e){var f=this.display;a=Ma(this,Q(this.doc,a));var g=a.bottom,k=a.left;b.style.position="absolute";
b.setAttribute("cm-ignore-events","true");this.display.input.setUneditable(b);f.sizer.appendChild(b);if("over"==c)g=a.top;else if("above"==c||"near"==c){var l=Math.max(f.wrapper.clientHeight,this.doc.height),h=Math.max(f.sizer.clientWidth,f.lineSpace.clientWidth);("above"==c||a.bottom+b.offsetHeight>l)&&a.top>b.offsetHeight?g=a.top-b.offsetHeight:a.bottom+b.offsetHeight<=l&&(g=a.bottom);k+b.offsetWidth>h&&(k=h-b.offsetWidth)}b.style.top=g+"px";b.style.left=b.style.right="";"right"==e?(k=f.sizer.clientWidth-
b.offsetWidth,b.style.right="0px"):("left"==e?k=0:"middle"==e&&(k=(f.sizer.clientWidth-b.offsetWidth)/2),b.style.left=k+"px");d&&(a=Hc(this,k,g,k+b.offsetWidth,g+b.offsetHeight),null!=a.scrollTop&&ec(this,a.scrollTop),null!=a.scrollLeft&&Ab(this,a.scrollLeft))},triggerOnKeyDown:sa(of),triggerOnKeyPress:sa(rf),triggerOnKeyUp:qf,execCommand:function(a){if(Tc.hasOwnProperty(a))return Tc[a].call(null,this)},triggerElectric:sa(function(a){xf(this,a)}),findPosH:function(a,b,d,c){var e=1;0>b&&(e=-1,b=-b);
a=Q(this.doc,a);for(var f=0;f<b&&(a=Pd(this.doc,a,e,d,c),!a.hitSide);++f);return a},moveH:sa(function(a,b){var d=this;this.extendSelectionsBy(function(c){return d.display.shift||d.doc.extend||c.empty()?Pd(d.doc,c.head,a,b,d.options.rtlMoveVisually):0>a?c.from():c.to()},sc)}),deleteH:sa(function(a,b){var d=this.doc;this.doc.sel.somethingSelected()?d.replaceSelection("",null,"+delete"):Mb(this,function(c){var e=Pd(d,c.head,a,b,!1);return 0>a?{from:e,to:c.head}:{from:c.head,to:e}})}),findPosV:function(a,
b,d,c){var e=1;0>b&&(e=-1,b=-b);var f=Q(this.doc,a);for(a=0;a<b&&(f=Ma(this,f,"div"),null==c?c=f.left:f.left=c,f=Cf(this,f,e,d),!f.hitSide);++a);return f},moveV:sa(function(a,b){var d=this,c=this.doc,e=[],f=!this.display.shift&&!c.extend&&c.sel.somethingSelected();c.extendSelectionsBy(function(g){if(f)return 0>a?g.from():g.to();var k=Ma(d,g.head,"div");null!=g.goalColumn&&(k.left=g.goalColumn);e.push(k.left);var l=Cf(d,k,a,b);"page"==b&&g==c.sel.primary()&&Ic(d,null,Ec(d,l,"div").top-k.top);return l},
sc);if(e.length)for(var g=0;g<c.sel.ranges.length;g++)c.sel.ranges[g].goalColumn=e[g]}),findWordAt:function(a){var b=E(this.doc,a.line).text,d=a.ch,c=a.ch;if(b){var e=this.getHelper(a,"wordChars");"before"!=a.sticky&&c!=b.length||!d?++c:--d;for(var f=b.charAt(d),f=F(f,e)?function(a){return F(a,e)}:/\s/.test(f)?function(a){return/\s/.test(a)}:function(a){return!/\s/.test(a)&&!F(a)};0<d&&f(b.charAt(d-1));)--d;for(;c<b.length&&f(b.charAt(c));)++c}return new X(H(a.line,d),H(a.line,c))},toggleOverwrite:function(a){if(null==
a||a!=this.state.overwrite)(this.state.overwrite=!this.state.overwrite)?g(this.display.cursorDiv,"CodeMirror-overwrite"):zb(this.display.cursorDiv,"CodeMirror-overwrite"),ea(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==f()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:sa(function(a,b){null==a&&null==b||Jc(this);null!=a&&(this.curOp.scrollLeft=a);null!=b&&(this.curOp.scrollTop=b)}),getScrollInfo:function(){var a=
this.display.scroller;return{left:a.scrollLeft,top:a.scrollTop,height:a.scrollHeight-Qa(this)-this.display.barHeight,width:a.scrollWidth-Qa(this)-this.display.barWidth,clientHeight:ld(this),clientWidth:ib(this)}},scrollIntoView:sa(function(a,b){null==a?(a={from:this.doc.sel.primary().head,to:null},null==b&&(b=this.options.cursorScrollMargin)):"number"==typeof a?a={from:H(a,0),to:null}:null==a.from&&(a={from:a,to:null});a.to||(a.to=a.from);a.margin=b||0;null!=a.from.line?(Jc(this),this.curOp.scrollToPos=
a):(a=Hc(this,Math.min(a.from.left,a.to.left),Math.min(a.from.top,a.to.top)-a.margin,Math.max(a.from.right,a.to.right),Math.max(a.from.bottom,a.to.bottom)+a.margin),this.scrollTo(a.scrollLeft,a.scrollTop))}),setSize:sa(function(a,b){var d=this,c=function(a){return"number"==typeof a||/^\d+$/.test(String(a))?a+"px":a};null!=a&&(this.display.wrapper.style.width=c(a));null!=b&&(this.display.wrapper.style.height=c(b));this.options.lineWrapping&&qe(this);var e=this.display.viewFrom;this.doc.iter(e,this.display.viewTo,
function(a){if(a.widgets)for(var b=0;b<a.widgets.length;b++)if(a.widgets[b].noHScroll){cb(d,e,"widget");break}++e});this.curOp.forceUpdate=!0;ea(this,"refresh",this)}),operation:function(a){return Da(this,a)},refresh:sa(function(){var a=this.display.cachedTextHeight;ra(this);this.curOp.forceUpdate=!0;bc(this);this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop);vd(this);(null==a||.5<Math.abs(a-kb(this.display)))&&rd(this);ea(this,"refresh",this)}),swapDoc:sa(function(a){var b=this.doc;b.cm=null;
Ke(this,a);bc(this);this.display.input.reset();this.scrollTo(a.scrollLeft,a.scrollTop);this.curOp.forceScroll=!0;ma(this,"swapDoc",this,b);return b}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}};ub(a);a.registerHelper=function(b,c,e){d.hasOwnProperty(b)||(d[b]=a[b]={_global:[]});d[b][c]=e};a.registerGlobalHelper=
function(b,c,e,f){a.registerHelper(b,c,f);d[b]._global.push({pred:e,val:f})}})(ba);var Jg="iter insert remove copy getEditor constructor".split(" "),wc;for(wc in ta.prototype)ta.prototype.hasOwnProperty(wc)&&0>k(Jg,wc)&&(ba.prototype[wc]=function(a){return function(){return a.apply(this.doc,arguments)}}(ta.prototype[wc]));ub(ta);ba.inputStyles={textarea:fa,contenteditable:Z};ba.defineMode=function(a){ba.defaults.mode||"null"==a||(ba.defaults.mode=a);Lf.apply(this,arguments)};ba.defineMIME=function(a,
b){vb[a]=b};ba.defineMode("null",function(){return{token:function(a){return a.skipToEnd()}}});ba.defineMIME("text/plain","null");ba.defineExtension=function(a,b){ba.prototype[a]=b};ba.defineDocExtension=function(a,b){ta.prototype[a]=b};ba.fromTextArea=function(a,b){function d(){a.value=l.getValue()}b=b?p(b):{};b.value=a.value;!b.tabindex&&a.tabIndex&&(b.tabindex=a.tabIndex);!b.placeholder&&a.placeholder&&(b.placeholder=a.placeholder);if(null==b.autofocus){var c=f();b.autofocus=c==a||null!=a.getAttribute("autofocus")&&
c==document.body}var e;if(a.form&&(S(a.form,"submit",d),!b.leaveSubmitMethodAlone)){var g=a.form;e=g.submit;try{var k=g.submit=function(){d();g.submit=e;g.submit();g.submit=k}}catch(Qd){}}b.finishInit=function(b){b.save=d;b.getTextArea=function(){return a};b.toTextArea=function(){b.toTextArea=isNaN;d();a.parentNode.removeChild(b.getWrapperElement());a.style.display="";a.form&&(Ka(a.form,"submit",d),"function"==typeof a.form.submit&&(a.form.submit=e))}};a.style.display="none";var l=ba(function(b){return a.parentNode.insertBefore(b,
a.nextSibling)},b);return l};(function(a){a.off=Ka;a.on=S;a.wheelEventPixels=Zf;a.Doc=ta;a.splitLines=Od;a.countColumn=r;a.findColumn=v;a.isWordChar=D;a.Pass=Hd;a.signal=ea;a.Line=Fb;a.changeEnd=db;a.scrollbarModel=De;a.Pos=H;a.cmpPos=O;a.modes=dd;a.mimeModes=vb;a.resolveMode=Cc;a.getMode=ed;a.modeExtensions=wb;a.extendMode=Mf;a.copyState=Va;a.startState=Wd;a.innerMode=fd;a.commands=Tc;a.keyMap=nc;a.keyName=jf;a.isModifierKey=hf;a.lookupKey=Lb;a.normalizeKeyMap=ng;a.StringStream=ia;a.SharedTextMarker=
mc;a.TextMarker=eb;a.LineWidget=lc;a.e_preventDefault=qa;a.e_stopPropagation=Ud;a.e_stop=Wb;a.addClass=g;a.contains=d;a.rmClass=zb;a.keyNames=fb})(ba);ba.version="5.24.2";return ba})},function(n,h){},function(n,h,c){h.glMatrix=c(14);h.mat2=c(178);h.mat2d=c(179);h.mat3=c(79);h.mat4=c(180);h.quat=c(181);h.vec2=c(182);h.vec3=c(80);h.vec4=c(81)},function(n,h,c){var m=c(14);h={create:function(){var c=new m.ARRAY_TYPE(9);c[0]=1;c[1]=0;c[2]=0;c[3]=0;c[4]=1;c[5]=0;c[6]=0;c[7]=0;c[8]=1;return c},fromMat4:function(c,
a){c[0]=a[0];c[1]=a[1];c[2]=a[2];c[3]=a[4];c[4]=a[5];c[5]=a[6];c[6]=a[8];c[7]=a[9];c[8]=a[10];return c},clone:function(c){var a=new m.ARRAY_TYPE(9);a[0]=c[0];a[1]=c[1];a[2]=c[2];a[3]=c[3];a[4]=c[4];a[5]=c[5];a[6]=c[6];a[7]=c[7];a[8]=c[8];return a},copy:function(c,a){c[0]=a[0];c[1]=a[1];c[2]=a[2];c[3]=a[3];c[4]=a[4];c[5]=a[5];c[6]=a[6];c[7]=a[7];c[8]=a[8];return c},fromValues:function(c,a,b,d,f,g,l,h,p){var e=new m.ARRAY_TYPE(9);e[0]=c;e[1]=a;e[2]=b;e[3]=d;e[4]=f;e[5]=g;e[6]=l;e[7]=h;e[8]=p;return e},
set:function(c,a,b,d,f,g,l,h,p,r){c[0]=a;c[1]=b;c[2]=d;c[3]=f;c[4]=g;c[5]=l;c[6]=h;c[7]=p;c[8]=r;return c},identity:function(c){c[0]=1;c[1]=0;c[2]=0;c[3]=0;c[4]=1;c[5]=0;c[6]=0;c[7]=0;c[8]=1;return c},transpose:function(c,a){if(c===a){var b=a[1],d=a[2],e=a[5];c[1]=a[3];c[2]=a[6];c[3]=b;c[5]=a[7];c[6]=d;c[7]=e}else c[0]=a[0],c[1]=a[3],c[2]=a[6],c[3]=a[1],c[4]=a[4],c[5]=a[7],c[6]=a[2],c[7]=a[5],c[8]=a[8];return c},invert:function(c,a){var b=a[0],d=a[1],e=a[2],g=a[3],l=a[4],h=a[5],p=a[6],r=a[7];a=a[8];
var k=a*l-h*r,m=-a*g+h*p,t=r*g-l*p,n=b*k+d*m+e*t;if(!n)return null;n=1/n;c[0]=k*n;c[1]=(-a*d+e*r)*n;c[2]=(h*d-e*l)*n;c[3]=m*n;c[4]=(a*b-e*p)*n;c[5]=(-h*b+e*g)*n;c[6]=t*n;c[7]=(-r*b+d*p)*n;c[8]=(l*b-d*g)*n;return c},adjoint:function(c,a){var b=a[0],d=a[1],e=a[2],g=a[3],l=a[4],h=a[5],p=a[6],r=a[7];a=a[8];c[0]=l*a-h*r;c[1]=e*r-d*a;c[2]=d*h-e*l;c[3]=h*p-g*a;c[4]=b*a-e*p;c[5]=e*g-b*h;c[6]=g*r-l*p;c[7]=d*p-b*r;c[8]=b*l-d*g;return c},determinant:function(c){var a=c[3],b=c[4],d=c[5],e=c[6],g=c[7],l=c[8];
return c[0]*(l*b-d*g)+c[1]*(-l*a+d*e)+c[2]*(g*a-b*e)},multiply:function(c,a,b){var d=a[0],e=a[1],g=a[2],l=a[3],h=a[4],p=a[5],r=a[6],k=a[7];a=a[8];var m=b[0],t=b[1],n=b[2],x=b[3],y=b[4],C=b[5],A=b[6],D=b[7];b=b[8];c[0]=m*d+t*l+n*r;c[1]=m*e+t*h+n*k;c[2]=m*g+t*p+n*a;c[3]=x*d+y*l+C*r;c[4]=x*e+y*h+C*k;c[5]=x*g+y*p+C*a;c[6]=A*d+D*l+b*r;c[7]=A*e+D*h+b*k;c[8]=A*g+D*p+b*a;return c}};h.mul=h.multiply;h.translate=function(c,a,b){var d=a[0],e=a[1],g=a[2],l=a[3],h=a[4],p=a[5],r=a[6],k=a[7];a=a[8];var m=b[0];b=
b[1];c[0]=d;c[1]=e;c[2]=g;c[3]=l;c[4]=h;c[5]=p;c[6]=m*d+b*l+r;c[7]=m*e+b*h+k;c[8]=m*g+b*p+a;return c};h.rotate=function(c,a,b){var d=a[0],e=a[1],g=a[2],l=a[3],h=a[4],p=a[5],r=a[6],k=a[7];a=a[8];var m=Math.sin(b);b=Math.cos(b);c[0]=b*d+m*l;c[1]=b*e+m*h;c[2]=b*g+m*p;c[3]=b*l-m*d;c[4]=b*h-m*e;c[5]=b*p-m*g;c[6]=r;c[7]=k;c[8]=a;return c};h.scale=function(c,a,b){var d=b[0];b=b[1];c[0]=d*a[0];c[1]=d*a[1];c[2]=d*a[2];c[3]=b*a[3];c[4]=b*a[4];c[5]=b*a[5];c[6]=a[6];c[7]=a[7];c[8]=a[8];return c};h.fromTranslation=
function(c,a){c[0]=1;c[1]=0;c[2]=0;c[3]=0;c[4]=1;c[5]=0;c[6]=a[0];c[7]=a[1];c[8]=1;return c};h.fromRotation=function(c,a){var b=Math.sin(a);a=Math.cos(a);c[0]=a;c[1]=b;c[2]=0;c[3]=-b;c[4]=a;c[5]=0;c[6]=0;c[7]=0;c[8]=1;return c};h.fromScaling=function(c,a){c[0]=a[0];c[1]=0;c[2]=0;c[3]=0;c[4]=a[1];c[5]=0;c[6]=0;c[7]=0;c[8]=1;return c};h.fromMat2d=function(c,a){c[0]=a[0];c[1]=a[1];c[2]=0;c[3]=a[2];c[4]=a[3];c[5]=0;c[6]=a[4];c[7]=a[5];c[8]=1;return c};h.fromQuat=function(c,a){var b=a[0],d=a[1],e=a[2];
a=a[3];var g=b+b,l=d+d,h=e+e,b=b*g,p=d*g,d=d*l,r=e*g,k=e*l,e=e*h,g=a*g,l=a*l;a*=h;c[0]=1-d-e;c[3]=p-a;c[6]=r+l;c[1]=p+a;c[4]=1-b-e;c[7]=k-g;c[2]=r-l;c[5]=k+g;c[8]=1-b-d;return c};h.normalFromMat4=function(c,a){var b=a[0],d=a[1],e=a[2],g=a[3],l=a[4],h=a[5],p=a[6],r=a[7],k=a[8],m=a[9],t=a[10],n=a[11],x=a[12],y=a[13],C=a[14];a=a[15];var A=b*h-d*l,D=b*p-e*l,F=b*r-g*l,G=d*p-e*h,z=d*r-g*h,L=e*r-g*p,J=k*y-m*x,I=k*C-t*x,k=k*a-n*x,E=m*C-t*y,m=m*a-n*y,t=t*a-n*C,n=A*t-D*m+F*E+G*k-z*I+L*J;if(!n)return null;n=
1/n;c[0]=(h*t-p*m+r*E)*n;c[1]=(p*k-l*t-r*I)*n;c[2]=(l*m-h*k+r*J)*n;c[3]=(e*m-d*t-g*E)*n;c[4]=(b*t-e*k+g*I)*n;c[5]=(d*k-b*m-g*J)*n;c[6]=(y*L-C*z+a*G)*n;c[7]=(C*F-x*L-a*D)*n;c[8]=(x*z-y*F+a*A)*n;return c};h.str=function(c){return"mat3("+c[0]+", "+c[1]+", "+c[2]+", "+c[3]+", "+c[4]+", "+c[5]+", "+c[6]+", "+c[7]+", "+c[8]+")"};h.frob=function(c){return Math.sqrt(Math.pow(c[0],2)+Math.pow(c[1],2)+Math.pow(c[2],2)+Math.pow(c[3],2)+Math.pow(c[4],2)+Math.pow(c[5],2)+Math.pow(c[6],2)+Math.pow(c[7],2)+Math.pow(c[8],
2))};h.add=function(c,a,b){c[0]=a[0]+b[0];c[1]=a[1]+b[1];c[2]=a[2]+b[2];c[3]=a[3]+b[3];c[4]=a[4]+b[4];c[5]=a[5]+b[5];c[6]=a[6]+b[6];c[7]=a[7]+b[7];c[8]=a[8]+b[8];return c};h.subtract=function(c,a,b){c[0]=a[0]-b[0];c[1]=a[1]-b[1];c[2]=a[2]-b[2];c[3]=a[3]-b[3];c[4]=a[4]-b[4];c[5]=a[5]-b[5];c[6]=a[6]-b[6];c[7]=a[7]-b[7];c[8]=a[8]-b[8];return c};h.sub=h.subtract;h.multiplyScalar=function(c,a,b){c[0]=a[0]*b;c[1]=a[1]*b;c[2]=a[2]*b;c[3]=a[3]*b;c[4]=a[4]*b;c[5]=a[5]*b;c[6]=a[6]*b;c[7]=a[7]*b;c[8]=a[8]*b;
return c};h.multiplyScalarAndAdd=function(c,a,b,d){c[0]=a[0]+b[0]*d;c[1]=a[1]+b[1]*d;c[2]=a[2]+b[2]*d;c[3]=a[3]+b[3]*d;c[4]=a[4]+b[4]*d;c[5]=a[5]+b[5]*d;c[6]=a[6]+b[6]*d;c[7]=a[7]+b[7]*d;c[8]=a[8]+b[8]*d;return c};h.exactEquals=function(c,a){return c[0]===a[0]&&c[1]===a[1]&&c[2]===a[2]&&c[3]===a[3]&&c[4]===a[4]&&c[5]===a[5]&&c[6]===a[6]&&c[7]===a[7]&&c[8]===a[8]};h.equals=function(c,a){var b=c[0],d=c[1],e=c[2],g=c[3],l=c[4],h=c[5],p=c[6],r=c[7],k=c[8],n=a[0],t=a[1],B=a[2],x=a[3],y=a[4],C=a[5];c=c[6];
var A=a[7];a=a[8];return Math.abs(b-n)<=m.EPSILON*Math.max(1,Math.abs(b),Math.abs(n))&&Math.abs(d-t)<=m.EPSILON*Math.max(1,Math.abs(d),Math.abs(t))&&Math.abs(e-B)<=m.EPSILON*Math.max(1,Math.abs(e),Math.abs(B))&&Math.abs(g-x)<=m.EPSILON*Math.max(1,Math.abs(g),Math.abs(x))&&Math.abs(l-y)<=m.EPSILON*Math.max(1,Math.abs(l),Math.abs(y))&&Math.abs(h-C)<=m.EPSILON*Math.max(1,Math.abs(h),Math.abs(C))&&Math.abs(p-c)<=m.EPSILON*Math.max(1,Math.abs(p),Math.abs(c))&&Math.abs(r-A)<=m.EPSILON*Math.max(1,Math.abs(r),
Math.abs(A))&&Math.abs(k-a)<=m.EPSILON*Math.max(1,Math.abs(k),Math.abs(a))};n.exports=h},function(n,h,c){var m=c(14),e={create:function(){var a=new m.ARRAY_TYPE(3);a[0]=0;a[1]=0;a[2]=0;return a},clone:function(a){var b=new m.ARRAY_TYPE(3);b[0]=a[0];b[1]=a[1];b[2]=a[2];return b},fromValues:function(a,b,d){var c=new m.ARRAY_TYPE(3);c[0]=a;c[1]=b;c[2]=d;return c},copy:function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];return a},set:function(a,b,d,c){a[0]=b;a[1]=d;a[2]=c;return a},add:function(a,b,d){a[0]=b[0]+
d[0];a[1]=b[1]+d[1];a[2]=b[2]+d[2];return a},subtract:function(a,b,d){a[0]=b[0]-d[0];a[1]=b[1]-d[1];a[2]=b[2]-d[2];return a}};e.sub=e.subtract;e.multiply=function(a,b,d){a[0]=b[0]*d[0];a[1]=b[1]*d[1];a[2]=b[2]*d[2];return a};e.mul=e.multiply;e.divide=function(a,b,d){a[0]=b[0]/d[0];a[1]=b[1]/d[1];a[2]=b[2]/d[2];return a};e.div=e.divide;e.ceil=function(a,b){a[0]=Math.ceil(b[0]);a[1]=Math.ceil(b[1]);a[2]=Math.ceil(b[2]);return a};e.floor=function(a,b){a[0]=Math.floor(b[0]);a[1]=Math.floor(b[1]);a[2]=
Math.floor(b[2]);return a};e.min=function(a,b,d){a[0]=Math.min(b[0],d[0]);a[1]=Math.min(b[1],d[1]);a[2]=Math.min(b[2],d[2]);return a};e.max=function(a,b,d){a[0]=Math.max(b[0],d[0]);a[1]=Math.max(b[1],d[1]);a[2]=Math.max(b[2],d[2]);return a};e.round=function(a,b){a[0]=Math.round(b[0]);a[1]=Math.round(b[1]);a[2]=Math.round(b[2]);return a};e.scale=function(a,b,d){a[0]=b[0]*d;a[1]=b[1]*d;a[2]=b[2]*d;return a};e.scaleAndAdd=function(a,b,d,c){a[0]=b[0]+d[0]*c;a[1]=b[1]+d[1]*c;a[2]=b[2]+d[2]*c;return a};
e.distance=function(a,b){var d=b[0]-a[0],c=b[1]-a[1];a=b[2]-a[2];return Math.sqrt(d*d+c*c+a*a)};e.dist=e.distance;e.squaredDistance=function(a,b){var d=b[0]-a[0],c=b[1]-a[1];a=b[2]-a[2];return d*d+c*c+a*a};e.sqrDist=e.squaredDistance;e.length=function(a){var b=a[0],d=a[1];a=a[2];return Math.sqrt(b*b+d*d+a*a)};e.len=e.length;e.squaredLength=function(a){var b=a[0],d=a[1];a=a[2];return b*b+d*d+a*a};e.sqrLen=e.squaredLength;e.negate=function(a,b){a[0]=-b[0];a[1]=-b[1];a[2]=-b[2];return a};e.inverse=function(a,
b){a[0]=1/b[0];a[1]=1/b[1];a[2]=1/b[2];return a};e.normalize=function(a,b){var d=b[0],c=b[1],e=b[2],d=d*d+c*c+e*e;0<d&&(d=1/Math.sqrt(d),a[0]=b[0]*d,a[1]=b[1]*d,a[2]=b[2]*d);return a};e.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]};e.cross=function(a,b,d){var c=b[0],e=b[1];b=b[2];var l=d[0],h=d[1];d=d[2];a[0]=e*d-b*h;a[1]=b*l-c*d;a[2]=c*h-e*l;return a};e.lerp=function(a,b,d,c){var e=b[0],f=b[1];b=b[2];a[0]=e+c*(d[0]-e);a[1]=f+c*(d[1]-f);a[2]=b+c*(d[2]-b);return a};e.hermite=function(a,b,
d,c,e,l){var f=l*l,g=f*(2*l-3)+1,h=f*(l-2)+l,k=f*(l-1);l=f*(3-2*l);a[0]=b[0]*g+d[0]*h+c[0]*k+e[0]*l;a[1]=b[1]*g+d[1]*h+c[1]*k+e[1]*l;a[2]=b[2]*g+d[2]*h+c[2]*k+e[2]*l;return a};e.bezier=function(a,b,d,c,e,l){var f=1-l,g=f*f,h=l*l,k=g*f,g=3*l*g,f=3*h*f;l*=h;a[0]=b[0]*k+d[0]*g+c[0]*f+e[0]*l;a[1]=b[1]*k+d[1]*g+c[1]*f+e[1]*l;a[2]=b[2]*k+d[2]*g+c[2]*f+e[2]*l;return a};e.random=function(a,b){b=b||1;var d=2*m.RANDOM()*Math.PI,c=2*m.RANDOM()-1,e=Math.sqrt(1-c*c)*b;a[0]=Math.cos(d)*e;a[1]=Math.sin(d)*e;a[2]=
c*b;return a};e.transformMat4=function(a,b,d){var c=b[0],e=b[1];b=b[2];var l=d[3]*c+d[7]*e+d[11]*b+d[15],l=l||1;a[0]=(d[0]*c+d[4]*e+d[8]*b+d[12])/l;a[1]=(d[1]*c+d[5]*e+d[9]*b+d[13])/l;a[2]=(d[2]*c+d[6]*e+d[10]*b+d[14])/l;return a};e.transformMat3=function(a,b,d){var c=b[0],e=b[1];b=b[2];a[0]=c*d[0]+e*d[3]+b*d[6];a[1]=c*d[1]+e*d[4]+b*d[7];a[2]=c*d[2]+e*d[5]+b*d[8];return a};e.transformQuat=function(a,b,d){var c=b[0],e=b[1],l=b[2];b=d[0];var h=d[1],p=d[2];d=d[3];var r=d*c+h*l-p*e,k=d*e+p*c-b*l,m=d*
l+b*e-h*c,c=-b*c-h*e-p*l;a[0]=r*d+c*-b+k*-p-m*-h;a[1]=k*d+c*-h+m*-b-r*-p;a[2]=m*d+c*-p+r*-h-k*-b;return a};e.rotateX=function(a,b,d,c){var e=[],f=[];e[0]=b[0]-d[0];e[1]=b[1]-d[1];e[2]=b[2]-d[2];f[0]=e[0];f[1]=e[1]*Math.cos(c)-e[2]*Math.sin(c);f[2]=e[1]*Math.sin(c)+e[2]*Math.cos(c);a[0]=f[0]+d[0];a[1]=f[1]+d[1];a[2]=f[2]+d[2];return a};e.rotateY=function(a,b,d,c){var e=[],f=[];e[0]=b[0]-d[0];e[1]=b[1]-d[1];e[2]=b[2]-d[2];f[0]=e[2]*Math.sin(c)+e[0]*Math.cos(c);f[1]=e[1];f[2]=e[2]*Math.cos(c)-e[0]*Math.sin(c);
a[0]=f[0]+d[0];a[1]=f[1]+d[1];a[2]=f[2]+d[2];return a};e.rotateZ=function(a,b,d,c){var e=[],f=[];e[0]=b[0]-d[0];e[1]=b[1]-d[1];e[2]=b[2]-d[2];f[0]=e[0]*Math.cos(c)-e[1]*Math.sin(c);f[1]=e[0]*Math.sin(c)+e[1]*Math.cos(c);f[2]=e[2];a[0]=f[0]+d[0];a[1]=f[1]+d[1];a[2]=f[2]+d[2];return a};e.forEach=function(){var a=e.create();return function(b,d,c,e,l,h){d||(d=3);c||(c=0);for(e=e?Math.min(e*d+c,b.length):b.length;c<e;c+=d)a[0]=b[c],a[1]=b[c+1],a[2]=b[c+2],l(a,a,h),b[c]=a[0],b[c+1]=a[1],b[c+2]=a[2];return b}}();
e.angle=function(a,b){a=e.fromValues(a[0],a[1],a[2]);b=e.fromValues(b[0],b[1],b[2]);e.normalize(a,a);e.normalize(b,b);b=e.dot(a,b);return 1<b?0:Math.acos(b)};e.str=function(a){return"vec3("+a[0]+", "+a[1]+", "+a[2]+")"};e.exactEquals=function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]};e.equals=function(a,b){var d=a[0],c=a[1];a=a[2];var e=b[0],l=b[1];b=b[2];return Math.abs(d-e)<=m.EPSILON*Math.max(1,Math.abs(d),Math.abs(e))&&Math.abs(c-l)<=m.EPSILON*Math.max(1,Math.abs(c),Math.abs(l))&&Math.abs(a-
b)<=m.EPSILON*Math.max(1,Math.abs(a),Math.abs(b))};n.exports=e},function(n,h,c){var m=c(14),e={create:function(){var a=new m.ARRAY_TYPE(4);a[0]=0;a[1]=0;a[2]=0;a[3]=0;return a},clone:function(a){var b=new m.ARRAY_TYPE(4);b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];return b},fromValues:function(a,b,d,c){var e=new m.ARRAY_TYPE(4);e[0]=a;e[1]=b;e[2]=d;e[3]=c;return e},copy:function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];return a},set:function(a,b,d,c,e){a[0]=b;a[1]=d;a[2]=c;a[3]=e;return a},add:function(a,
b,d){a[0]=b[0]+d[0];a[1]=b[1]+d[1];a[2]=b[2]+d[2];a[3]=b[3]+d[3];return a},subtract:function(a,b,d){a[0]=b[0]-d[0];a[1]=b[1]-d[1];a[2]=b[2]-d[2];a[3]=b[3]-d[3];return a}};e.sub=e.subtract;e.multiply=function(a,b,d){a[0]=b[0]*d[0];a[1]=b[1]*d[1];a[2]=b[2]*d[2];a[3]=b[3]*d[3];return a};e.mul=e.multiply;e.divide=function(a,b,d){a[0]=b[0]/d[0];a[1]=b[1]/d[1];a[2]=b[2]/d[2];a[3]=b[3]/d[3];return a};e.div=e.divide;e.ceil=function(a,b){a[0]=Math.ceil(b[0]);a[1]=Math.ceil(b[1]);a[2]=Math.ceil(b[2]);a[3]=
Math.ceil(b[3]);return a};e.floor=function(a,b){a[0]=Math.floor(b[0]);a[1]=Math.floor(b[1]);a[2]=Math.floor(b[2]);a[3]=Math.floor(b[3]);return a};e.min=function(a,b,d){a[0]=Math.min(b[0],d[0]);a[1]=Math.min(b[1],d[1]);a[2]=Math.min(b[2],d[2]);a[3]=Math.min(b[3],d[3]);return a};e.max=function(a,b,d){a[0]=Math.max(b[0],d[0]);a[1]=Math.max(b[1],d[1]);a[2]=Math.max(b[2],d[2]);a[3]=Math.max(b[3],d[3]);return a};e.round=function(a,b){a[0]=Math.round(b[0]);a[1]=Math.round(b[1]);a[2]=Math.round(b[2]);a[3]=
Math.round(b[3]);return a};e.scale=function(a,b,d){a[0]=b[0]*d;a[1]=b[1]*d;a[2]=b[2]*d;a[3]=b[3]*d;return a};e.scaleAndAdd=function(a,b,d,c){a[0]=b[0]+d[0]*c;a[1]=b[1]+d[1]*c;a[2]=b[2]+d[2]*c;a[3]=b[3]+d[3]*c;return a};e.distance=function(a,b){var c=b[0]-a[0],e=b[1]-a[1],g=b[2]-a[2];a=b[3]-a[3];return Math.sqrt(c*c+e*e+g*g+a*a)};e.dist=e.distance;e.squaredDistance=function(a,b){var c=b[0]-a[0],e=b[1]-a[1],g=b[2]-a[2];a=b[3]-a[3];return c*c+e*e+g*g+a*a};e.sqrDist=e.squaredDistance;e.length=function(a){var b=
a[0],c=a[1],e=a[2];a=a[3];return Math.sqrt(b*b+c*c+e*e+a*a)};e.len=e.length;e.squaredLength=function(a){var b=a[0],c=a[1],e=a[2];a=a[3];return b*b+c*c+e*e+a*a};e.sqrLen=e.squaredLength;e.negate=function(a,b){a[0]=-b[0];a[1]=-b[1];a[2]=-b[2];a[3]=-b[3];return a};e.inverse=function(a,b){a[0]=1/b[0];a[1]=1/b[1];a[2]=1/b[2];a[3]=1/b[3];return a};e.normalize=function(a,b){var c=b[0],e=b[1],g=b[2];b=b[3];var l=c*c+e*e+g*g+b*b;0<l&&(l=1/Math.sqrt(l),a[0]=c*l,a[1]=e*l,a[2]=g*l,a[3]=b*l);return a};e.dot=function(a,
b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]};e.lerp=function(a,b,c,e){var d=b[0],f=b[1],h=b[2];b=b[3];a[0]=d+e*(c[0]-d);a[1]=f+e*(c[1]-f);a[2]=h+e*(c[2]-h);a[3]=b+e*(c[3]-b);return a};e.random=function(a,b){b=b||1;a[0]=m.RANDOM();a[1]=m.RANDOM();a[2]=m.RANDOM();a[3]=m.RANDOM();e.normalize(a,a);e.scale(a,a,b);return a};e.transformMat4=function(a,b,c){var d=b[0],e=b[1],l=b[2];b=b[3];a[0]=c[0]*d+c[4]*e+c[8]*l+c[12]*b;a[1]=c[1]*d+c[5]*e+c[9]*l+c[13]*b;a[2]=c[2]*d+c[6]*e+c[10]*l+c[14]*b;a[3]=c[3]*
d+c[7]*e+c[11]*l+c[15]*b;return a};e.transformQuat=function(a,b,c){var d=b[0],e=b[1],l=b[2],h=c[0],p=c[1],r=c[2];c=c[3];var k=c*d+p*l-r*e,m=c*e+r*d-h*l,t=c*l+h*e-p*d,d=-h*d-p*e-r*l;a[0]=k*c+d*-h+m*-r-t*-p;a[1]=m*c+d*-p+t*-h-k*-r;a[2]=t*c+d*-r+k*-p-m*-h;a[3]=b[3];return a};e.forEach=function(){var a=e.create();return function(b,c,e,g,l,h){c||(c=4);e||(e=0);for(g=g?Math.min(g*c+e,b.length):b.length;e<g;e+=c)a[0]=b[e],a[1]=b[e+1],a[2]=b[e+2],a[3]=b[e+3],l(a,a,h),b[e]=a[0],b[e+1]=a[1],b[e+2]=a[2],b[e+
3]=a[3];return b}}();e.str=function(a){return"vec4("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"};e.exactEquals=function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]};e.equals=function(a,b){var c=a[0],e=a[1],g=a[2];a=a[3];var l=b[0],h=b[1],p=b[2];b=b[3];return Math.abs(c-l)<=m.EPSILON*Math.max(1,Math.abs(c),Math.abs(l))&&Math.abs(e-h)<=m.EPSILON*Math.max(1,Math.abs(e),Math.abs(h))&&Math.abs(g-p)<=m.EPSILON*Math.max(1,Math.abs(g),Math.abs(p))&&Math.abs(a-b)<=m.EPSILON*Math.max(1,Math.abs(a),
Math.abs(b))};n.exports=e},function(n,h,c){h=c(83).Symbol;n.exports=h},function(n,h,c){h=c(185);c="object"==typeof self&&self&&self.Object===Object&&self;h=h||c||Function("return this")();n.exports=h},function(n,h,c){Object.defineProperty(h,"__esModule",{value:!0});var m=c(128);window.addEventListener("DOMContentLoaded",function(){c.i(m.a)()})},function(n,h,c){function m(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function e(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function a(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(h,"__esModule",{value:!0});var b=c(98),d=c(99);n=c(9);var f=c(12),g=c(15),l=c(1),u=c(149);c.d(h,"AnnotationPointListUserLayer",
function(){return k});var p=function B(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return B(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},r=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,
d);return b}}();c(156);var k=function(c){function f(a,c){m(this,f);var k=e(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,[]));k.manager=a;k.selectedIndex=new g.a(null);k.layer=new b.a(k.manager.chunkManager,new d.a,k.manager.voxelSize,k.selectedIndex);k.layer.pointList.restoreState(c.points);k.registerDisposer(k.layer.pointList.changed.add(function(){k.specificationChanged.dispatch()}));k.addRenderLayer(new b.b(k.layer));k.addRenderLayer(new b.c(k.layer));var l=a.layerSelectedValues;k.registerDisposer(l.changed.add(function(){var a=
l.get(k);k.selectedIndex.value="number"===typeof a?a:null}));return k}a(f,c);r(f,[{key:"toJSON",value:function(){var a={type:"pointAnnotation"};a.points=this.layer.pointList.toJSON();return a}},{key:"handleAction",value:function(a){switch(a){case "annotate":a=this.manager.layerSelectedValues.get(this),void 0!==a?this.layer.pointList.delete(a):this.manager.layerSelectedValues.mouseState.active&&this.layer.pointList.append(this.manager.voxelSize.voxelFromSpatial(l.a.create(),this.manager.layerSelectedValues.mouseState.position))}}},
{key:"makeDropdown",value:function(a){return new v(a,this)}}]);return f}(n.h),v=function(b){function c(a,b){m(this,c);var d=e(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));d.element=a;d.layer=b;d.pointListWidget=d.registerDisposer(new u.a(d.layer.layer.pointList,d.layer.selectedIndex));a.classList.add("neuroglancer-annotation-point-list-dropdown");a.appendChild(d.pointListWidget.element);d.registerDisposer(d.pointListWidget.pointSelected.add(function(a){d.layer.manager.setVoxelCoordinates(d.layer.layer.pointList.get(a))}));
return d}a(c,b);r(c,[{key:"onShow",value:function(){p(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"onShow",this).call(this);this.pointListWidget.visible=!0}},{key:"onHide",value:function(){p(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"onHide",this).call(this);this.pointListWidget.visible=!1}}]);return c}(n.i);c.i(f.c)("pointAnnotation",k)},function(n,h,c){function m(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function a(a,b){return V.get(a,b)}function b(a,b){return ga.get(a,b)}function d(a){var b=a.match(/^([^:]+:[^:]+:[^:]+)(?::([^:]+))?$/);if(null===b)throw Error("Invalid Brainmaps volume key: "+JSON.stringify(a)+".");var c;
void 0!==b[2]&&(c={changeStackId:b[2]});return{volumeId:b[1],changeSpec:c}}function f(a,b){var c=b.match(H);if(null===c)throw Error("Invalid Brainmaps mesh URL: "+b);b=d(c[1]);return{instance:a,volumeId:b.volumeId,changeSpec:b.changeSpec,meshName:c[2]}}function g(b,c,d){return a(c,f(b,d))}function l(a,c,d){return b(c,f(a,d))}function u(a,b,e,f){e=d(e);var g=e.volumeId,k=e.changeSpec;return b.memoize.getUncounted({type:"brainmaps:getVolume",instance:a,volumeId:g,changeSpec:k,options:f},function(){return Promise.all([c.i(y.a)(a,
{method:"GET",path:"/v1beta2/volumes/"+g,responseType:"json"}),c.i(y.a)(a,{method:"GET",path:"/v1beta2/objects/"+g+"/meshes",responseType:"json"})]).then(function(c){var d=$jscomp.makeIterator(c);c=d.next().value;d=d.next().value;return new ca(b,a,g,k,c,d,f)})})}function p(a){try{return c.i(I.a)(a),{id:c.i(I.d)(a,"id",I.h),label:c.i(I.d)(a,"label",I.h),description:c.i(I.d)(a,"description",I.e)}}catch(pa){throw Error("Failed to parse project: "+pa.message);}}function r(a){try{return c.i(I.a)(a),c.i(I.d)(a,
"project",function(a){return void 0===a?[]:c.i(I.k)(a,p)})}catch(pa){throw Error("Error parsing project list: "+pa.message);}}function k(a,b){return a.memoize.getUncounted({instance:b,type:"brainmaps:getVolumeList"},function(){var a=Promise.all([c.i(y.a)(b,{method:"GET",path:"/v1beta2/projects",responseType:"json"}),c.i(y.a)(b,{method:"GET",path:"/v1beta2/volumes",responseType:"json"})]).then(function(a){var b=$jscomp.makeIterator(a);a=b.next().value;b=b.next().value;return new O(a,b)}),d="Google "+
y.b[b]+" volume list";z.a.forPromise(a,{delay:!0,initialMessage:"Retrieving "+d+".",errorPrefix:"Error retrieving "+d+": "});return a})}function v(a){return c.i(I.d)(a,"changeStackId",function(a){return void 0===a?void 0:c.i(I.k)(a,I.h)})}function t(a,b,d){return a.memoize.getUncounted({instance:b,type:"brainmaps:getChangeStackList",volumeId:d},function(){var a=c.i(y.a)(b,{method:"GET",path:"/v1beta2/changes/"+d+"/change_stacks",responseType:"json"}).then(function(a){return v(a)}),e="change stacks for "+
d;z.a.forPromise(a,{delay:!0,initialMessage:"Retrieving "+e+".",errorPrefix:"Error retrieving "+e+": "});return a})}function B(a,b,d){return k(d,a).then(function(e){var f=b.match(/^([^:]+:[^:]+:[^:]+):(.*)$/);if(null!==f){var g=f[1],k=f[2];return t(d,a,g).then(function(a){return void 0===a?null:{offset:g.length+1,completions:c.i(L.c)(k,a)}})}var l=b.lastIndexOf(":")+1,f=b.substring(0,l),l=b.substring(l),h=e.hierarchicalVolumeIds.get(f);return void 0===h?null:f?{offset:f.length,completions:c.i(L.c)(l,
h)}:{offset:0,completions:c.i(L.b)(l,h,function(a){return a},function(a){return(a=e.projects.get(a.substring(0,a.length-1)))&&a.label})}})}function x(a){var b="brainmaps";a!==y.c&&(b+="-"+y.d[a].toLowerCase());c.i(A.g)(b,{description:"Google "+y.b[a]+" API",getVolume:u.bind(void 0,a),getMeshSource:g.bind(void 0,a),getSkeletonSource:l.bind(void 0,a),volumeCompleter:B.bind(void 0,a)})}Object.defineProperty(h,"__esModule",{value:!0});c(100);var y=c(53),C=c(101),A=c(8);n=c(31);var D=c(37),F=c(4),G=c(5),
z=c(33),L=c(28),J=c(1),I=c(2);c.d(h,"getMeshSource",function(){return a});c.d(h,"VolumeInfo",function(){return P});c.d(h,"MeshInfo",function(){return T});c.d(h,"MultiscaleVolumeChunkSource",function(){return ca});c.d(h,"SkeletonSource",function(){return ga});h.getSkeletonSource=b;h.parseVolumeKey=d;h.getMeshSourceByUrl=g;h.getSkeletonSourceByUrl=l;h.getVolume=u;c.d(h,"VolumeList",function(){return O});h.getVolumeList=k;h.parseChangeStackList=v;h.getChangeStackList=t;h.volumeCompleter=B;h.registerBrainmapsDataSource=
x;var E=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),U=c.i(G.e)(C.a),V=c.i(n.b)(C.b);h=c.i(D.f)(C.c);var R=new Map;R.set("UINT8",F.b.UINT8);R.set("FLOAT",F.b.FLOAT32);R.set("UINT64",F.b.UINT64);var P=function pa(a){e(this,pa);try{c.i(I.a)(a),this.numChannels=c.i(I.q)(a.channelCount),this.dataType=c.i(I.y)(a.channelType,
R),this.voxelSize=c.i(I.z)(J.a.create(),a.pixelSize,I.s),this.upperVoxelBound=c.i(I.z)(J.a.create(),a.volumeSize,I.q)}catch(ka){throw Error("Failed to parse BrainMaps volume geometry: "+ka.message);}},T=function za(a){e(this,za);c.i(I.a)(a);this.name=c.i(I.d)(a,"name",I.h);this.type=c.i(I.d)(a,"type",I.h)},ca=function(){function b(a,d,f,g,k,l,h){e(this,b);this.chunkManager=a;this.instance=d;this.volumeId=f;this.changeSpec=g;try{c.i(I.a)(k);var p=this.scales=c.i(I.d)(k,"geometry",function(a){return c.i(I.k)(a,
function(a){return new P(a)})});if(0===p.length)throw Error("Expected at least one scale.");var r=p[0],u=this.numChannels=r.numChannels,m=this.dataType=r.dataType;a=1;for(var t=p.length;a<t;++a){var n=p[a];if(n.dataType!==m)throw Error("Scale "+a+" has data type "+F.b[n.dataType]+" but scale 0 has data type "+F.b[m]+".");if(n.numChannels!==u)throw Error("Scale "+a+" has "+n.numChannels+" channel(s) but scale 0 has "+u+" channels.");}var z;if(1===u)switch(m){case F.b.UINT64:z=F.a.SEGMENTATION}void 0===
z&&(z=void 0!==h.volumeType?h.volumeType:F.a.IMAGE);this.volumeType=z}catch(Pa){throw Error("Failed to parse BrainMaps multiscale volume specification: "+Pa.message);}try{c.i(I.a)(l),this.meshes=c.i(I.d)(l,"meshes",function(a){return void 0===a?[]:c.i(I.k)(a,function(a){return new T(a)})})}catch(Pa){throw Error("Failed to parse BrainMaps meshes specification: "+Pa.message);}}E(b,[{key:"getSources",value:function(a){var b=this,c=C.d.RAW;this.dataType===F.b.UINT64?c=C.d.COMPRESSED_SEGMENTATION:this.volumeType===
F.a.IMAGE&&this.dataType===F.b.UINT8&&1===this.numChannels&&(c=C.d.JPEG);return this.scales.map(function(d,e){return F.f.getDefaults({voxelSize:d.voxelSize,dataType:d.dataType,numChannels:d.numChannels,upperVoxelBound:d.upperVoxelBound,volumeType:b.volumeType,volumeSourceOptions:a}).map(function(a){return U.get(b.chunkManager,a,{instance:b.instance,volumeId:b.volumeId,changeSpec:b.changeSpec,scaleIndex:e,encoding:c})})})}},{key:"getMeshSource",value:function(){var b=this.meshes.find(function(a){return"TRIANGLES"===
a.type});return void 0===b?null:a(this.chunkManager,{instance:this.instance,volumeId:this.volumeId,meshName:b.name,changeSpec:this.changeSpec})}}]);return b}(),ga=function(a){function b(){e(this,b);var a=(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?this:a}m(b,a);E(b,[{key:"skeletonVertexCoordinatesInVoxels",get:function(){return!1}}]);
return b}(h),H=/^([^\/]+)\/(.*)$/,O=function ka(a,b){e(this,ka);this.projects=new Map;this.hierarchicalVolumeIds=new Map;var d=this.projects;a=$jscomp.makeIterator(r(a));for(var f=a.next();!f.done;f=a.next())f=f.value,d.set(f.id,f);try{c.i(I.a)(b);var g=this.volumeIds=c.i(I.d)(b,"volumeId",function(a){return void 0===a?[]:c.i(I.k)(a,I.h)});g.sort();for(var k=new Map,l=$jscomp.makeIterator(g),h=l.next();!h.done;h=l.next()){var p=h.value;for(b=0;;){var u=p.indexOf(":",b);-1===u?u=void 0:++u;var m=p.substring(0,
b),t=k.get(m);void 0===t&&(t=new Set,k.set(m,t));t.add(p.substring(b,u));if(void 0===u)break;b=u}}for(var n=this.hierarchicalVolumeIds,z=$jscomp.makeIterator(k),v=z.next();!v.done;v=z.next()){var A=$jscomp.makeIterator(v.value),G=A.next().value,F=A.next().value;n.set(G,Array.from(F))}}catch(Ha){throw Error("Failed to parse Brain Maps volume list reply: "+Ha.message);}};x(y.c)},function(n,h){},function(n,h,c){function m(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function e(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function a(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function b(a,b,d){c.i(A.a)(a);var e=
c.i(A.d)(a,"Base",function(a){return new G(a)});switch(e.typeName){case "uint8blk":case "grayscale8":return new J(a,b,e,v.a.IMAGE,d);case "imagetile":return new V(a,b,e);case "labels64":case "labelblk":return new J(a,b,e,v.a.SEGMENTATION,d);default:throw Error("DVID data type "+JSON.stringify(e.typeName)+" is not supported.");}}function d(a){try{for(var b=c.i(A.r)(a,function(a){return new R(a)}),d=new Map,e=$jscomp.makeIterator(b),f=e.next();!f.done;f=e.next()){var g=$jscomp.makeIterator(f.value),
k=g.next().value,l=g.next().value;d.set(k,l);for(var h=$jscomp.makeIterator(l.vnodes),p=h.next();!p.done;p=h.next()){var r=p.value;if(r!==k){var u=new R(l);d.set(r,u)}}}for(var m=$jscomp.makeIterator(d),t=m.next();!t.done;t=m.next()){var n=$jscomp.makeIterator(t.value),z=n.next().value;n.next().value.uuid=z}return d}catch(gb){throw Error("Failed to parse DVID repositories info: "+gb.message);}}function f(a,b){return a.memoize.getUncounted({type:"dvid:getServerInfo",baseUrls:b},function(){var a=c.i(C.a)(c.i(C.b)(b,
"/api/repos/info","GET"),"json").then(function(a){return new P(a)}),d="repository info for DVID server "+b[0];B.a.forPromise(a,{initialMessage:"Retrieving "+d+".",delay:!0,errorPrefix:"Error retrieving "+d+": "});return a})}function g(a,b,c,d){return f(a,b).then(function(e){var f=e.getNode(c);if(void 0===f)throw Error("Invalid node: "+JSON.stringify(c)+".");var g=f.dataInstances.get(d);if(!(g instanceof J||g instanceof V))throw Error("Invalid data instance "+d+".");return a.memoize.getUncounted({type:"dvid:MultiscaleVolumeChunkSource",
baseUrls:b,nodeKey:f.uuid,dataInstanceKey:d},function(){return new T(a,b,f.uuid,d,g)})})}function l(a,b){var c=b.match(ca);if(null===c)throw Error("Invalid DVID URL: "+JSON.stringify(b)+".");return g(a,[c[1]],c[2],c[3])}function u(a,b){return{offset:0,completions:c.i(x.b)(b,a.dataInstances.values(),function(a){return a.name},function(a){return""+a.base.typeName})}}function p(a,b){var d=b.match(/^(?:([^\/]+)(?:\/([^\/]*))?)?$/);if(null===d)throw Error("Invalid DVID URL syntax.");if(void 0===d[2])return{offset:0,
completions:c.i(x.b)(b,a.repositories.values(),function(a){return a.uuid+"/"},function(a){return a.alias+": "+a.description})};b=d[1];a=a.getNode(b);return c.i(x.a)(b.length+1,u(a,d[2]))}function r(a,b){a=a.match(/^((?:http|https):\/\/[^\/]+)\/(.*)$/);if(null===a)return Promise.reject(null);var d=a[1],e=a[2];return f(b,[d]).then(function(a){return c.i(x.a)(d.length+1,p(a,e))})}Object.defineProperty(h,"__esModule",{value:!0});var k=c(102);n=c(8);var v=c(4),t=c(5),B=c(33),x=c(28),y=c(1),C=c(22),A=c(2);
c.d(h,"DataInstanceBaseInfo",function(){return G});c.d(h,"DataInstanceInfo",function(){return z});c.d(h,"VolumeDataInstanceInfo",function(){return J});c.d(h,"TileLevelInfo",function(){return I});c.d(h,"TileDataInstanceInfo",function(){return V});h.parseDataInstance=b;c.d(h,"RepositoryInfo",function(){return R});h.parseRepositoriesInfo=d;c.d(h,"ServerInfo",function(){return P});h.getServerInfo=f;c.d(h,"MultiscaleVolumeChunkSource",function(){return T});h.getShardedVolume=g;h.getVolume=l;h.completeInstanceName=
u;h.completeNodeAndInstance=p;h.volumeCompleter=r;var D=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),F=new Map;F.set("uint8",v.b.UINT8);F.set("uint32",v.b.UINT32);F.set("uint64",v.b.UINT64);var G=function(){function b(d){a(this,b);this.obj=d;c.i(A.a)(d);c.i(A.d)(d,"TypeName",A.h)}D(b,[{key:"typeName",get:function(){return this.obj.TypeName}}]);
return b}(),z=function H(b,c,d){a(this,H);this.obj=b;this.name=c;this.base=d},L=c.i(t.e)(k.a),J=function(b){function d(b,e,f,g,k){a(this,d);f=m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,e,f));f.volumeType=g;b=c.i(A.d)(b,"Extended",A.a);g=c.i(A.d)(b,"Values",function(a){return c.i(A.k)(a,A.a)});if(1>g.length)throw Error("Expected Extended.Values property to have length >= 1, but received: ${JSON.stringify(extendedValues)}.");f.numLevels=1;for(k=new Set(k);k.has(e+"_"+f.numLevels.toString());)f.numLevels+=
1;f.dataType=c.i(A.d)(g[0],"DataType",function(a){return c.i(A.y)(a,F)});f.lowerVoxelBound=c.i(A.d)(b,"MinPoint",function(a){return c.i(A.t)(y.a.create(),a)});f.upperVoxelBound=c.i(A.d)(b,"MaxPoint",function(a){return c.i(A.t)(y.a.create(),a)});f.voxelSize=c.i(A.d)(b,"VoxelSize",function(a){return c.i(A.i)(y.a.create(),a,A.s)});f.numChannels=1;return f}e(d,b);D(d,[{key:"getSources",value:function(a,b,c){for(var d=[],e={},f=0;f<this.numLevels;e={volParameters:e.volParameters},++f){for(var g=y.a.scale(y.a.create(),
this.voxelSize,Math.pow(2,f)),k=y.a.create(),l=y.a.create(),h=0;3>h;++h)k[h]=Math.floor(this.voxelSize[h]/g[h]*this.lowerVoxelBound[h]),l[h]=Math.ceil(this.voxelSize[h]/g[h]*this.upperVoxelBound[h]);h=b.dataInstanceKey;0<f&&(h+="_"+f.toString());e.volParameters={baseUrls:b.baseUrls,nodeKey:b.nodeKey,dataInstanceKey:h};g=v.f.getDefaults({voxelSize:g,dataType:this.dataType,numChannels:this.numChannels,transform:y.b.fromTranslation(y.b.create(),y.a.multiply(y.a.create(),k,g)),baseVoxelOffset:k,upperVoxelBound:y.a.subtract(y.a.create(),
l,k),volumeType:this.volumeType,volumeSourceOptions:c}).map(function(b){return function(c){return L.get(a,c,b.volParameters)}}(e));d.push(g)}return d}}]);return d}(z),I=function O(b){a(this,O);c.i(A.a)(b);this.resolution=c.i(A.d)(b,"Resolution",function(a){return c.i(A.i)(y.a.create(),a,A.s)});this.tileSize=c.i(A.d)(b,"TileSize",function(a){return c.i(A.i)(y.a.create(),a,A.q)})},E=[[0,1],[0,2],[1,2]],U=c.i(t.e)(k.b),V=function(b){function d(b,e,f){a(this,d);e=m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,
b,e,f));b=c.i(A.d)(b,"Extended",A.a);e.levels=c.i(A.d)(b,"Levels",function(a){return c.i(A.r)(a,function(a){return new I(a)})});f=e.levels.get("0");if(void 0===f)throw Error("Level 0 is not defined.");e.voxelSize=f.resolution;var g=c.i(A.d)(b,"MinTileCoord",function(a){return c.i(A.i)(y.a.create(),a,A.u)}),l=c.i(A.d)(b,"MaxTileCoord",function(a){return c.i(A.i)(y.a.create(),a,A.u)});e.lowerVoxelBound=y.a.multiply(y.a.create(),f.tileSize,g);e.upperVoxelBound=y.a.multiply(y.a.create(),f.tileSize,l);
b=c.i(A.d)(b,"Encoding",function(a){return a});switch(b){case 2:e.encoding=k.c.JPEG;break;default:throw Error("Unsupported tile encoding: "+JSON.stringify(b)+".");}return e}e(d,b);D(d,[{key:"dataType",get:function(){return v.b.UINT8}},{key:"volumeType",get:function(){return v.a.IMAGE}},{key:"numChannels",get:function(){return 1}}]);D(d,[{key:"getSources",value:function(a,b,c){for(var d=this,e=[],f=this.numChannels,g=this.dataType,k=this.encoding,l={},h=$jscomp.makeIterator(this.levels),p=h.next();!p.done;l=
{levelInfo:l.levelInfo,level:l.level},p=h.next())p=$jscomp.makeIterator(p.value),l.level=p.next().value,l.levelInfo=p.next().value,p=E.map(function(e){return function(l){for(var h=y.a.clone(d.voxelSize),p=y.a.fromValues(1,1,1),r=0;2>r;++r)h[l[r]]=e.levelInfo.resolution[l[r]],p[l[r]]=e.levelInfo.tileSize[l[r]];for(var r=y.a.create(),u=y.a.create(),m=0;3>m;++m)r[m]=Math.floor(d.voxelSize[m]/h[m]*d.lowerVoxelBound[m]),u[m]=Math.ceil(d.voxelSize[m]/h[m]*d.upperVoxelBound[m]);h=v.f.make({voxelSize:h,chunkDataSize:p,
numChannels:f,dataType:g,lowerVoxelBound:r,upperVoxelBound:u,volumeSourceOptions:c});return U.get(a,h,{baseUrls:b.baseUrls,nodeKey:b.nodeKey,dataInstanceKey:b.dataInstanceKey,encoding:k,level:e.level,dims:l[0]+"_"+l[1]})}}(l)),e.push(p);return e}}]);return d}(z),R=function da(d){a(this,da);this.errors=[];this.dataInstances=new Map;this.vnodes=new Set;if(d instanceof da)this.alias=d.alias,this.description=d.description,this.errors=d.errors,this.dataInstances=d.dataInstances;else{c.i(A.a)(d);this.alias=
c.i(A.d)(d,"Alias",A.h);this.description=c.i(A.d)(d,"Description",A.h);for(var e=c.i(A.d)(d,"DataInstances",A.a),f=Object.keys(e),g=$jscomp.makeIterator(f),k=g.next();!k.done;k=g.next()){k=k.value;try{this.dataInstances.set(k,b(e[k],k,f))}catch(Aa){k="Failed to parse data instance "+JSON.stringify(k)+": "+Aa.message,console.log(k),this.errors.push(k)}}d=c.i(A.d)(d,"DAG",A.a);d=c.i(A.d)(d,"Nodes",A.a);d=$jscomp.makeIterator(Object.keys(d));for(k=d.next();!k.done;k=d.next())this.vnodes.add(k.value)}},
P=function(){function b(c){a(this,b);this.repositories=d(c)}D(b,[{key:"getNode",value:function(a){for(var b=[],c=$jscomp.makeIterator(this.repositories.keys()),d=c.next();!d.done;d=c.next())d=d.value,d.startsWith(a)&&b.push(d);if(1!==b.length)throw Error("Node key "+JSON.stringify(a)+" matches "+JSON.stringify(b)+" nodes.");return this.repositories.get(b[0])}}]);return b}(),T=function(){function b(c,d,e,f,g){a(this,b);this.chunkManager=c;this.baseUrls=d;this.nodeKey=e;this.dataInstanceKey=f;this.info=
g}D(b,[{key:"getSources",value:function(a){return this.info.getSources(this.chunkManager,{baseUrls:this.baseUrls,nodeKey:this.nodeKey,dataInstanceKey:this.dataInstanceKey},a)}},{key:"getMeshSource",value:function(){return null}},{key:"dataType",get:function(){return this.info.dataType}},{key:"numChannels",get:function(){return this.info.numChannels}},{key:"volumeType",get:function(){return this.info.volumeType}}]);return b}(),ca=/^((?:http|https):\/\/[^\/]+)\/([^\/]+)\/([^\/]+)$/;c.i(n.g)("dvid",
{description:"DVID",volumeCompleter:r,getVolume:l})},function(n,h,c){function m(b,c,d){return b.rpc.promiseInvoke(a.b,{chunkManager:b.addCounterpartRef(),url:c},d)}function e(a,b){return a.memoize.getUncounted({type:"nifti/getVolume",url:b},function(){return m(a,b,f.c).then(function(c){return new u(a,b,c)})})}Object.defineProperty(h,"__esModule",{value:!0});n=c(8);var a=c(103),b=c(4),d=c(5),f=c(13),g=c(1);c.d(h,"MultiscaleVolumeChunkSource",function(){return u});h.getVolume=e;var l=function(){function a(a,
b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),u=function(){function a(b,c,d){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");this.chunkManager=b;this.url=c;this.info=d}l(a,[{key:"getSources",value:function(a){var d=this.info;a=b.f.withDefaultCompression({volumeType:d.volumeType,chunkDataSize:d.volumeSize,
dataType:d.dataType,voxelSize:d.voxelSize,numChannels:d.numChannels,upperVoxelBound:d.volumeSize,transform:c.i(g.r)(g.b.create(),d.qoffset,d.quatern,g.q,d.qfac),volumeSourceOptions:a});return[[p.get(this.chunkManager,a,{url:this.url})]]}},{key:"getMeshSource",value:function(){return null}},{key:"numChannels",get:function(){return this.info.numChannels}},{key:"dataType",get:function(){return this.info.dataType}},{key:"volumeType",get:function(){return this.info.volumeType}}]);return a}(),p=c.i(d.e)(a.a);
c.i(n.g)("nifti",{description:"Single NIfTI file",getVolume:e})},function(n,h,c){function m(e,g){return c.i(a.getShardedVolume)(e,d,g,b.a)}function e(e,g){return c.i(a.tokenAndChannelCompleter)(g,d,e,b.a)}Object.defineProperty(h,"__esModule",{value:!0});n=c(8);var a=c(51),b=c(55);h.getVolume=m;h.volumeCompleter=e;var d=["http://openconnecto.me","http://www.openconnecto.me"];c.i(n.g)("openconnectome",{description:"NDstore server hosted at openconnecto.me",getVolume:m,volumeCompleter:e})},function(n,
h,c){function m(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function e(a,b){return B.get(a,b)}function a(a,b){var d=$jscomp.makeIterator(c.i(r.c)(b));b=d.next().value;d=d.next().value;return e(a,{baseUrls:b,path:d,lod:0})}function b(a,b,d){return a.memoize.getUncounted({type:"precomputed:MultiscaleVolumeChunkSource",baseUrls:b,path:d},function(){return c.i(r.a)(c.i(r.b)(b,d+"/info"),"json").then(function(c){return new y(a,b,d,c)})})}function d(a,d){var e=$jscomp.makeIterator(c.i(r.c)(d));
d=e.next().value;e=e.next().value;return b(a,d,e)}Object.defineProperty(h,"__esModule",{value:!0});n=c(8);var f=c(104),g=c(31),l=c(4),u=c(5),p=c(1),r=c(22),k=c(2);c.d(h,"MultiscaleVolumeChunkSource",function(){return y});h.getShardedMeshSource=e;h.getMeshSource=a;h.getShardedVolume=b;h.getVolume=d;var v=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,d,
c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),t=c.i(u.e)(f.a),B=c.i(g.b)(f.b),x=function A(a){m(this,A);c.i(k.a)(a);this.resolution=c.i(k.d)(a,"resolution",function(a){return c.i(k.i)(p.a.create(),a,k.s)});this.voxelOffset=c.i(k.d)(a,"voxel_offset",function(a){return c.i(k.t)(p.a.create(),a)});this.size=c.i(k.d)(a,"size",function(a){return c.i(k.i)(p.a.create(),a,k.q)});this.chunkSizes=c.i(k.d)(a,"chunk_sizes",function(a){return c.i(k.k)(a,function(a){return c.i(k.i)(p.a.create(),a,k.q)})});if(0===
this.chunkSizes.length)throw Error("No chunk sizes specified.");(this.encoding=c.i(k.d)(a,"encoding",function(a){return c.i(k.p)(a,f.c)}))===f.c.COMPRESSED_SEGMENTATION&&(this.compressedSegmentationBlockSize=c.i(k.d)(a,"compressed_segmentation_block_size",function(a){return c.i(k.i)(p.a.create(),a,k.q)}));this.key=c.i(k.d)(a,"key",k.h)},y=function(){function a(b,d,e,f){m(this,a);this.chunkManager=b;this.baseUrls=d;this.path=e;this.obj=f;c.i(k.a)(f);this.dataType=c.i(k.d)(f,"data_type",function(a){return c.i(k.p)(a,
l.b)});this.numChannels=c.i(k.d)(f,"num_channels",k.q);this.volumeType=c.i(k.d)(f,"type",function(a){return c.i(k.p)(a,l.a)});this.mesh=c.i(k.d)(f,"mesh",k.e);this.scales=c.i(k.d)(f,"scales",function(a){return c.i(k.k)(a,function(a){return new x(a)})})}v(a,[{key:"getMeshSource",value:function(){var a=this.mesh;return void 0===a?null:e(this.chunkManager,{baseUrls:this.baseUrls,path:this.path+"/"+a,lod:0})}},{key:"getSources",value:function(a){var b=this;return this.scales.map(function(d){return l.f.getDefaults({voxelSize:d.resolution,
dataType:b.dataType,numChannels:b.numChannels,transform:p.b.fromTranslation(p.b.create(),p.a.multiply(p.a.create(),d.resolution,d.voxelOffset)),upperVoxelBound:d.size,volumeType:b.volumeType,chunkDataSizes:d.chunkSizes,baseVoxelOffset:d.voxelOffset,compressedSegmentationBlockSize:d.compressedSegmentationBlockSize,volumeSourceOptions:a}).map(function(a){return t.get(b.chunkManager,a,{baseUrls:b.baseUrls,path:b.path+"/"+d.key,encoding:d.encoding})})})}}]);return a}();c.i(n.g)("precomputed",{description:"Precomputed file-backed data source",
getVolume:d,getMeshSource:a})},function(n,h,c){function m(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function a(a){c.i(x.a)(a);return{key:c.i(x.d)(a,
"key",x.h),offset:c.i(x.d)(a,"offset",x.m),sizeInVoxels:c.i(x.d)(a,"sizeInVoxels",x.n),voxelSize:c.i(x.d)(a,"voxelSize",x.o),chunkDataSize:c.i(x.d)(a,"chunkDataSize",function(a){return void 0===a?void 0:c.i(x.n)(a)})}}function b(a){c.i(x.a)(a);return{dataType:c.i(x.d)(a,"dataType",function(a){return c.i(x.p)(a,k.b)}),numComponents:c.i(x.d)(a,"numComponents",x.q)}}function d(a){return c.i(x.r)(JSON.parse(a),b)}function f(a,b){var c=b.match(/^((?:http|https):\/\/[^\/?]+)\/([^\/?]+)\?(.*)$/);if(null===
c)throw Error("Invalid python volume path: "+JSON.stringify(b));return F.get(a,{baseUrls:[c[1]],key:c[2],vertexAttributes:d(c[3])})}function g(a,b,d){return a.memoize.getUncounted({type:"python:MultiscaleVolumeChunkSource",baseUrls:b,key:d},function(){return c.i(B.a)(c.i(B.b)(b,"/neuroglancer/info/"+d),"json").then(function(c){return new D(a,b,d,c)})})}function l(a,b){var d=b.match(G);if(null===d)throw Error("Invalid python volume path: "+JSON.stringify(b));return g(a,[d[1]],d[2])}Object.defineProperty(h,
"__esModule",{value:!0});n=c(8);var u=c(105),p=c(31),r=c(37),k=c(4),v=c(5),t=c(1),B=c(22),x=c(2);c.d(h,"MultiscaleVolumeChunkSource",function(){return D});c.d(h,"SkeletonSource",function(){return F});h.getSkeletonSource=f;h.getShardedVolume=g;h.getVolume=l;var y=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),
C=c.i(v.e)(u.a),A=c.i(p.b)(u.b);h=c.i(r.f)(u.c);var D=function(){function b(d,f,g,l){e(this,b);this.chunkManager=d;this.baseUrls=f;this.key=g;this.response=l;c.i(x.a)(l);this.dataType=c.i(x.d)(l,"dataType",function(a){return c.i(x.p)(a,k.b)});this.volumeType=c.i(x.d)(l,"volumeType",function(a){return c.i(x.p)(a,k.a)});this.numChannels=c.i(x.d)(l,"numChannels",x.q);this.encoding=c.i(x.d)(l,"encoding",function(a){return c.i(x.p)(a,u.d)});var h=c.i(x.d)(l,"maxVoxelsPerChunkLog2",function(a){return void 0===
a?k.g:c.i(x.q)(a)});d=c.i(x.d)(l,"threeDimensionalScales",function(b){return void 0===b?void 0:c.i(x.k)(b,a)});l=c.i(x.d)(l,"twoDimensionalScales",function(b){return void 0===b?void 0:c.i(x.k)(b,function(b){return c.i(x.i)(Array(3),b,a)})});if(void 0===l===(void 0===d))throw Error('Exactly one of "threeDimensionalScales" and "twoDimensionalScales" must be specified.');if(void 0!==l){if(0===l.length)throw Error("At least one scale must be specified.");this.scales=l.map(function(a){return a.map(function(a,
b){var d=a.voxelSize,e=a.sizeInVoxels;b=2-b;b=void 0===a.chunkDataSize?c.i(k.h)({voxelSize:d,upperVoxelBound:e,flatDimension:b,maxVoxelsPerChunkLog2:h}):a.chunkDataSize;return{key:a.key,offset:a.offset,sizeInVoxels:e,voxelSize:d,chunkDataSize:b}})});if(!t.a.equals(this.scales[0][0].voxelSize,this.scales[0][1].voxelSize)||!t.a.equals(this.scales[0][0].voxelSize,this.scales[0][2].voxelSize))throw Error("Lowest scale must have uniform voxel size.");}if(void 0!==d){if(0===d.length)throw Error("At least one scale must be specified.");
this.scales=d.map(function(a){var b=a.voxelSize,d=a.sizeInVoxels,e=void 0===a.chunkDataSize?c.i(k.i)({voxelSize:b,upperVoxelBound:d,maxVoxelsPerChunkLog2:h}):a.chunkDataSize;return[{key:a.key,offset:a.offset,sizeInVoxels:d,voxelSize:b,chunkDataSize:e}]})}}y(b,[{key:"getSources",value:function(a){var b=this,d=this.numChannels,c=this.dataType,e=this.volumeType,f=this.encoding,g=this.scales[0][0],l=t.a.multiply(t.a.create(),g.voxelSize,g.sizeInVoxels);return this.scales.map(function(g){return g.map(function(g){var h=
k.f.withDefaultCompression({voxelSize:g.voxelSize,dataType:c,volumeType:e,numChannels:d,transform:t.b.fromTranslation(t.b.create(),g.offset),upperVoxelBound:g.sizeInVoxels,upperClipBound:l,chunkDataSize:g.chunkDataSize,volumeSourceOptions:a});return C.get(b.chunkManager,h,{baseUrls:b.baseUrls,key:g.key,encoding:f})})})}},{key:"getMeshSource",value:function(){return A.get(this.chunkManager,{baseUrls:this.baseUrls,key:this.key})}}]);return b}(),F=function(a){function b(){e(this,b);var a=(b.__proto__||
Object.getPrototypeOf(b)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?this:a}m(b,a);y(b,[{key:"skeletonVertexCoordinatesInVoxels",get:function(){return!1}},{key:"vertexAttributes",get:function(){return this.parameters.vertexAttributes}}]);return b}(h),G=/^((?:http|https):\/\/[^\/?]+)\/([^\/?]+)$/;c.i(n.g)("python",{description:"Python-served volume",getVolume:l,getSkeletonSource:f})},
function(n,h,c){function m(k){var l=c.i(D.k)(k,D.a);if(1>l.length)throw Error("No stacks found for owner object.");k=new Map;for(var h=c.i(D.d)(l[0],"stackId",a),l=$jscomp.makeIterator(l),p=l.next();!p.done;p=l.next()){var r=p.value,p=c.i(D.d)(r,"stackId",e);c.i(D.a)(r);var u=c.i(D.d)(r,"state",D.h);if(L.has(u))var u=c.i(D.d)(r,"stats",d),m=c.i(D.d)(r,"stats",b),t=c.i(D.d)(r,"currentVersion",f),r=c.i(D.d)(r,"stackId",g),r={lowerVoxelBound:u,upperVoxelBound:m,voxelResolution:t,project:r};else r=void 0;
void 0!==r&&(u=r.project,m=k.get(u),void 0===m&&(m=new Map,k.set(u,{stacks:m}),m=k.get(u)),m.stacks.set(p,r))}return{owner:h,projects:k}}function e(a){c.i(D.a)(a);return c.i(D.d)(a,"stack",D.h)}function a(a){c.i(D.a)(a);return c.i(D.d)(a,"owner",D.h)}function b(a){c.i(D.a)(a);var b=c.i(D.d)(a,"stackBounds",D.a);a=C.a.create();a[0]=c.i(D.d)(b,"maxX",D.u);a[1]=c.i(D.d)(b,"maxY",D.u);a[2]=c.i(D.d)(b,"maxZ",D.u);for(b=0;3>b;b++)a[b]+=1;return a}function d(a){c.i(D.a)(a);a=c.i(D.d)(a,"stackBounds",D.a);
var b=C.a.create();b[0]=c.i(D.d)(a,"minX",D.u);b[1]=c.i(D.d)(a,"minY",D.u);b[2]=c.i(D.d)(a,"minZ",D.u);return b}function f(a){c.i(D.a)(a);var b=C.a.create();try{b[0]=c.i(D.d)(a,"stackResolutionX",D.v),b[1]=c.i(D.d)(a,"stackResolutionY",D.v),b[2]=c.i(D.d)(a,"stackResolutionZ",D.v)}catch(R){b[0]=1,b[1]=1,b[2]=1}return b}function g(a){c.i(D.a)(a);return c.i(D.d)(a,"project",D.h)}function l(a,b){for(var d=0,c=0;2>c;c++)d<a.upperVoxelBound[c]&&(d=a.upperVoxelBound[c]);for(a=0;d>b;)d/=2,a++;return a}function u(a,
b,d){return a.memoize.getUncounted({type:"render:getOwnerInfo",hostnames:b,owner:d},function(){return c.i(A.a)(c.i(A.b)(b,"/render-ws/v1/owner/"+d+"/stacks"),"json").then(m)})}function p(a,b,d){var e=d.match(I);if(null===e)throw Error("Invalid volume path "+JSON.stringify(d));var f=e[1],g=e[2],k=e[3],l=c.i(D.x)(e[4]||"");return a.memoize.getUncounted({type:"render:MultiscaleVolumeChunkSource",hostnames:b,path:d},function(){return u(a,b,f).then(function(d){return new J(a,b,d,k,g,l)})})}function r(a,
b){var d=b.match(E);if(null===d)throw Error("Invalid render volume path: "+JSON.stringify(b));b=d[1].split(",");return p(a,b,d[2])}function k(a,b,d){var e=d.match(/^(?:([^\/]+)(?:\/([^\/]*))?(?:\/([^\/]*))?)?$/);return null===e||void 0===e[2]?Promise.reject(null):void 0===e[3]?u(a,b,e[1]).then(function(a){a=c.i(y.b)(e[2],a.projects,function(a){return a[0]+"/"},function(){});return{offset:e[1].length+1,completions:a}}):u(a,b,e[1]).then(function(a){a=a.projects.get(e[2]);if(void 0===a)return Promise.reject(null);
a=c.i(y.b)(e[3],a.stacks,function(a){return a[0]},function(a){return""+a[1].project});return{offset:e[1].length+e[2].length+2,completions:a}})}function v(a,b){var d=a.match(E);if(null===d)return Promise.reject(null);a=d[1].split(",");return k(b,a,d[2]).then(function(a){return c.i(y.a)(d[1].length+1,a)})}Object.defineProperty(h,"__esModule",{value:!0});n=c(8);var t=c(106),B=c(4),x=c(5),y=c(28),C=c(1),A=c(22),D=c(2);c.d(h,"MultiscaleVolumeChunkSource",function(){return J});h.computeStackHierarchy=l;
h.getOwnerInfo=u;h.getShardedVolume=p;h.getVolume=r;h.stackAndProjectCompleter=k;h.volumeCompleter=v;var F=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),G=new Set(["jpg"]),z=c.i(x.e)(t.a),L=new Set(["COMPLETE"]),J=function(){function a(b,d,e,f,g,k){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");
this.chunkManager=b;this.baseUrls=d;this.ownerInfo=e;this.project=g;this.parameters=k;b=e.projects.get(g);if(void 0===b)throw Error("Specificed project "+JSON.stringify(g)+" does not exist for specified owner "+JSON.stringify(e.owner));if(void 0===f){f=Array.from(b.stacks.keys());if(1!==f.length)throw Error("Dataset contains multiple stacks: "+JSON.stringify(f));f=f[0]}e=b.stacks.get(f);if(void 0===e)throw Error("Specified stack "+JSON.stringify(f)+" is not one of the supported stacks: "+JSON.stringify(Array.from(b.stacks.keys())));
this.stack=f;this.stackInfo=e;f=c.i(D.e)(k.encoding);if(void 0===f)f="jpg";else if(!G.has(f))throw Error("Invalid encoding: "+JSON.stringify(f)+".");this.encoding=f;this.numLevels=c.i(D.w)(k.numlevels);this.dims=C.a.create();k=c.i(D.w)(k.tilesize);void 0===k&&(k=1024);this.dims[0]=k;this.dims[1]=k;this.dims[2]=1}F(a,[{key:"getSources",value:function(a){var b=[],d=this.numLevels;void 0===d&&(d=l(this.stackInfo,this.dims[0]));for(var c=0;c<d;c++){for(var e=C.a.clone(this.stackInfo.voxelResolution),
f=C.a.fromValues(1,1,1),g=0;2>g;++g)e[g]*=Math.pow(2,c),f[g]=this.dims[g];for(var g=C.a.create(),k=C.a.create(),h=0;3>h;h++)g[h]=Math.floor(this.stackInfo.voxelResolution[h]/e[h]*this.stackInfo.lowerVoxelBound[h]),k[h]=Math.ceil(this.stackInfo.voxelResolution[h]/e[h]*this.stackInfo.upperVoxelBound[h]);e=B.f.make({voxelSize:e,chunkDataSize:f,numChannels:this.numChannels,dataType:this.dataType,lowerVoxelBound:g,upperVoxelBound:k,volumeSourceOptions:a});e=z.get(this.chunkManager,e,{baseUrls:this.baseUrls,
owner:this.ownerInfo.owner,project:this.stackInfo.project,stack:this.stack,encoding:this.encoding,level:c,dims:this.dims[0]+"_"+this.dims[1]});b.push([e])}return b}},{key:"getMeshSource",value:function(){return null}},{key:"dataType",get:function(){return B.b.UINT8}},{key:"numChannels",get:function(){return 3}},{key:"volumeType",get:function(){return B.a.IMAGE}}]);return a}(),I=/^([^\/?]+)(?:\/([^\/?]+))?(?:\/([^\/?]+))?(?:\?(.*))?$/,E=/^((?:(?:(?:http|https):\/\/[^,\/]+)[^\/?])+)\/(.*)$/;c.i(n.g)("render",
{description:"Render",volumeCompleter:v,getVolume:r})},function(n,h){},function(n,h,c){function m(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function e(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function a(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&
b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function b(a){return new t.a({shaderError:a.shaderError,fragmentMain:a.fragmentMain,fragmentMainStartLine:u.c})}Object.defineProperty(h,"__esModule",{value:!0});var d=c(34);n=c(9);var f=c(12),g=c(21),l=c(4),u=c(124),p=c(40),r=c(1),k=c(30),v=c(75),t=c(48);c.d(h,"ImageUserLayer",function(){return x});var B=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=
b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}();c(159);c(77);c(162);var x=function(b){function g(a,b){m(this,g);var l=e(this,(g.__proto__||Object.getPrototypeOf(g)).call(this));l.opacity=c.i(p.a)(.5);l.fragmentMain=c.i(u.a)();l.shaderError=c.i(k.a)();l.transform=new d.a;var h=b.source;if("string"!==typeof h)throw Error("Invalid image layer specification");l.opacity.restoreState(b.opacity);
l.fragmentMain.restoreState(b.shader);l.transform.restoreState(b.transform);l.registerDisposer(l.fragmentMain.changed.add(function(){l.specificationChanged.dispatch()}));l.volumePath=h;c.i(f.d)(a.chunkManager,h).then(function(a){l.wasDisposed||(a=l.renderLayer=new u.b(a,{opacity:l.opacity,fragmentMain:l.fragmentMain,shaderError:l.shaderError,volumeSourceOptions:{transform:r.b.clone(l.transform.transform)}}),l.addRenderLayer(a),l.shaderError.changed.dispatch())});return l}a(g,b);B(g,[{key:"toJSON",
value:function(){var a={type:"image"};a.source=this.volumePath;a.opacity=this.opacity.toJSON();a.shader=this.fragmentMain.toJSON();a.transform=this.transform.toJSON();return a}},{key:"makeDropdown",value:function(a){return new y(a,this)}}]);return g}(n.h),y=function(d){function c(a,d){m(this,c);var f=e(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));f.element=a;f.layer=d;f.opacityWidget=f.registerDisposer(new v.a(f.layer.opacity));f.codeWidget=f.registerDisposer(b(f.layer));a.classList.add("image-dropdown");
var g=f.opacityWidget;d=document.createElement("div");d.className="image-dropdown-top-row";g.promptElement.textContent="Opacity";g=document.createElement("div");g.style.flex="1";var k=document.createElement("a"),l=document.createElement("button");l.type="button";l.textContent="?";l.className="help-link";k.appendChild(l);k.title="Documentation on image layer rendering";k.target="_blank";k.href="https://github.com/google/neuroglancer/blob/master/src/neuroglancer/sliceview/image_layer_rendering.md";
l=document.createElement("button");l.innerHTML="&square;";l.className="maximize-button";l.title="Show larger editor view";f.registerEventListener(l,"click",function(){new C(f.layer)});d.appendChild(f.opacityWidget.element);d.appendChild(g);d.appendChild(l);d.appendChild(k);a.appendChild(d);a.appendChild(f.codeWidget.element);f.codeWidget.textEditor.refresh();return f}a(c,d);B(c,[{key:"onShow",value:function(){this.codeWidget.textEditor.refresh()}}]);return c}(n.i),C=function(d){function c(a){m(this,
c);var d=e(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));d.layer=a;d.codeWidget=d.registerDisposer(b(d.layer));d.content.classList.add("image-layer-shader-overlay");d.content.appendChild(d.codeWidget.element);d.codeWidget.textEditor.refresh();return d}a(c,d);return c}(g.b);c.i(f.c)("image",x);c.i(f.e)(l.a.IMAGE,x)},function(n,h,c){function m(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function e(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function a(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function b(a){return new L.a({fragmentMain:a.displayState.fragmentMain,shaderError:a.displayState.shaderError,fragmentMainStartLine:v.e})}
Object.defineProperty(h,"__esModule",{value:!0});var d=c(34),f=c(8);n=c(9);var g=c(12),l=c(31),u=c(21),p=c(63),r=c(32),k=c(115),v=c(37),t=c(4),B=c(125),x=c(40),y=c(27),C=c(130),A=c(2),D=c(11),F=c(30),G=c(75),z=c(151),L=c(48),J=c(152);c.d(h,"SegmentationUserLayer",function(){return E});var I=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,
d);c&&a(b,c);return b}}();c(19);c(167);var E=function(b){function h(a,b){m(this,h);var l=e(this,(h.__proto__||Object.getPrototypeOf(h)).call(this,[]));l.manager=a;l.displayState={segmentColorHash:p.a.getDefault(),segmentSelectionState:new r.a,selectedAlpha:c.i(x.a)(.5),notSelectedAlpha:c.i(x.a)(0),objectAlpha:c.i(x.a)(1),hideSegmentZero:new y.a(!0,!0),visibleSegments:C.a.makeWithCounterpart(l.manager.worker),segmentEquivalences:k.a.makeWithCounterpart(l.manager.worker),volumeSourceOptions:{},objectToDataTransform:new d.a,
fragmentMain:c.i(v.a)(),shaderError:c.i(F.a)()};l.displayState.visibleSegments.changed.add(function(){l.specificationChanged.dispatch()});l.displayState.segmentEquivalences.changed.add(function(){l.specificationChanged.dispatch()});l.displayState.segmentSelectionState.bindTo(a.layerSelectedValues,l);l.displayState.selectedAlpha.changed.add(function(){l.specificationChanged.dispatch()});l.displayState.notSelectedAlpha.changed.add(function(){l.specificationChanged.dispatch()});l.displayState.objectAlpha.changed.add(function(){l.specificationChanged.dispatch()});
l.displayState.hideSegmentZero.changed.add(function(){l.specificationChanged.dispatch()});l.displayState.fragmentMain.changed.add(function(){l.specificationChanged.dispatch()});l.displayState.selectedAlpha.restoreState(b.selectedAlpha);l.displayState.notSelectedAlpha.restoreState(b.notSelectedAlpha);l.displayState.objectAlpha.restoreState(b.objectAlpha);l.displayState.hideSegmentZero.restoreState(b.hideSegmentZero);l.displayState.objectToDataTransform.restoreState(b.transform);l.displayState.volumeSourceOptions.transform=
l.displayState.objectToDataTransform.transform;l.displayState.fragmentMain.restoreState(b.skeletonShader);var u=l.volumePath=c.i(A.e)(b.source),n=l.meshPath=null===b.mesh?null:c.i(A.e)(b.mesh),z=l.skeletonsPath=c.i(A.e)(b.skeletons);void 0!==u&&c.i(g.d)(a.chunkManager,u,{volumeType:t.a.SEGMENTATION}).then(function(a){l.wasDisposed||(l.addRenderLayer(new B.a(a,l.displayState)),void 0===n&&(a=a.getMeshSource(),null!=a&&l.addMesh(a)))});null!=n&&c.i(f.e)(a.chunkManager,n).then(function(a){l.wasDisposed||
l.addMesh(a)});void 0!==z&&c.i(f.f)(a.chunkManager,z).then(function(b){l.wasDisposed||(b=new v.b(a.chunkManager,b,a.voxelSize,l.displayState),l.addRenderLayer(new v.c(b.addRef())),l.addRenderLayer(new v.d(b)))});c.i(A.d)(b,"equivalences",function(a){l.displayState.segmentEquivalences.restoreState(a)});c.i(A.d)(b,"segments",function(a){if(void 0!==a){var b=l.displayState,d=b.visibleSegments,e=b.segmentEquivalences;c.i(A.k)(a,function(a){a=D.a.parseString(String(a),10);d.add(e.get(a))})}});return l}
a(h,b);I(h,[{key:"addMesh",value:function(a){this.meshLayer=new l.a(this.manager.chunkManager,a,this.displayState);this.addRenderLayer(this.meshLayer)}},{key:"toJSON",value:function(){var a={type:"segmentation"};a.source=this.volumePath;a.mesh=this.meshPath;a.skeletons=this.skeletonsPath;a.selectedAlpha=this.displayState.selectedAlpha.toJSON();a.notSelectedAlpha=this.displayState.notSelectedAlpha.toJSON();a.objectAlpha=this.displayState.objectAlpha.toJSON();a.hideSegmentZero=this.displayState.hideSegmentZero.toJSON();
var b=this.displayState.visibleSegments;0<b.size&&(a.segments=b.toJSON());b=this.displayState.segmentEquivalences;0<b.size&&(a.equivalences=b.toJSON());a.transform=this.displayState.objectToDataTransform.toJSON();a.skeletonShader=this.displayState.fragmentMain.toJSON();return a}},{key:"transformPickedValue",value:function(a){if(null==a)return a;var b=this.displayState.segmentEquivalences;if(0===b.size)return a;"number"===typeof a&&(a=new D.a(a,0));b=b.get(a);return D.a.equal(b,a)?a:new r.b(a,b)}},
{key:"makeDropdown",value:function(a){return new U(a,this)}},{key:"handleAction",value:function(a){switch(a){case "recolor":this.displayState.segmentColorHash.randomize();break;case "clear-segments":this.displayState.visibleSegments.clear();break;case "select":if(a=this.displayState.segmentSelectionState,a.hasSelectedSegment){a=a.selectedSegment;var b=this.displayState.visibleSegments;b.has(a)?b.delete(a):b.add(a)}}}}]);return h}(n.h),U=function(d){function c(a,d){m(this,c);var f=e(this,(c.__proto__||
Object.getPrototypeOf(c)).call(this));f.element=a;f.layer=d;f.visibleSegmentWidget=f.registerDisposer(new z.a(f.layer.displayState));f.addSegmentWidget=f.registerDisposer(new J.a);f.selectedAlphaWidget=f.registerDisposer(new G.a(f.layer.displayState.selectedAlpha));f.notSelectedAlphaWidget=f.registerDisposer(new G.a(f.layer.displayState.notSelectedAlpha));f.objectAlphaWidget=f.registerDisposer(new G.a(f.layer.displayState.objectAlpha));a.classList.add("segmentation-dropdown");var g=f.notSelectedAlphaWidget,
k=f.objectAlphaWidget;f.selectedAlphaWidget.promptElement.textContent="Opacity (on)";g.promptElement.textContent="Opacity (off)";k.promptElement.textContent="Opacity (3d)";a.appendChild(f.selectedAlphaWidget.element);a.appendChild(f.notSelectedAlphaWidget.element);a.appendChild(f.objectAlphaWidget.element);d=f.registerDisposer(new y.b(d.displayState.hideSegmentZero));d.element.className="neuroglancer-segmentation-dropdown-hide-segment-zero noselect";g=document.createElement("label");g.className="neuroglancer-segmentation-dropdown-hide-segment-zero noselect";
g.appendChild(document.createTextNode("Hide segment ID 0"));g.appendChild(d.element);a.appendChild(g);f.addSegmentWidget.element.classList.add("add-segment");f.addSegmentWidget.element.title="Add segment ID";a.appendChild(f.registerDisposer(f.addSegmentWidget).element);f.registerDisposer(f.addSegmentWidget.valueEntered.add(function(a){f.layer.displayState.visibleSegments.add(a)}));a.appendChild(f.registerDisposer(f.visibleSegmentWidget).element);if(void 0!==f.layer.skeletonsPath){d=document.createElement("div");
d.className="neuroglancer-segmentation-dropdown-skeleton-shader-header";g=document.createElement("div");g.style.flex="1";g.textContent="Skeleton shader:";var k=document.createElement("a"),l=document.createElement("button");l.type="button";l.textContent="?";l.className="help-link";k.appendChild(l);k.title="Documentation on skeleton rendering";k.target="_blank";k.href="https://github.com/google/neuroglancer/blob/master/src/neuroglancer/sliceview/image_layer_rendering.md";l=document.createElement("button");
l.innerHTML="&square;";l.className="maximize-button";l.title="Show larger editor view";f.registerEventListener(l,"click",function(){new V(f.layer)});d.appendChild(g);d.appendChild(l);d.appendChild(k);a.appendChild(d);d=f.codeWidget=f.registerDisposer(b(f.layer));a.appendChild(d.element);d.textEditor.refresh()}return f}a(c,d);I(c,[{key:"onShow",value:function(){void 0!==this.codeWidget&&this.codeWidget.textEditor.refresh()}}]);return c}(n.i),V=function(d){function c(a){m(this,c);var d=e(this,(c.__proto__||
Object.getPrototypeOf(c)).call(this));d.layer=a;d.codeWidget=d.registerDisposer(b(d.layer));d.content.classList.add("neuroglancer-segmentation-layer-skeleton-shader-overlay");d.content.appendChild(d.codeWidget.element);d.codeWidget.textEditor.refresh();return d}a(c,d);return c}(u.b);c.i(g.c)("segmentation",E);c.i(g.e)(t.a.SEGMENTATION,E)},function(n,h,c){function m(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function e(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function a(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function b(a){return a.split(/[^a-zA-Z0-9]+/).filter(function(a){return a}).join("_")}function d(a){var d=new Set,c=[];a=$jscomp.makeIterator(a);
for(var e=a.next();!e.done;e=a.next()){for(var e=b(e.value),f="",g=0;d.has(e+f);)f=""+ ++g;c.push(e+f)}return c}function f(a){return new B.a({fragmentMain:a.displayState.fragmentMain,shaderError:a.displayState.shaderError,fragmentMainStartLine:r.d})}function g(a){return new C(a.displayState.attributeNames,function(){return a.meshSource&&a.meshSource.info.vertexAttributes})}Object.defineProperty(h,"__esModule",{value:!0});n=c(20);var l=c.n(n);n=c(9);var u=c(12),p=c(21),r=c(117),k=c(0),v=c(10),t=c(2),
B=c(48);c.d(h,"SingleMeshUserLayer",function(){return y});var x=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}();c(168);var y=function(b){function f(a,b){m(this,f);var g=e(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,[]));g.manager=a;g.displayState=new r.a;g.parameters={meshSourceUrl:c.i(t.d)(b,"source",
t.h),attributeSourceUrls:c.i(t.d)(b,"vertexAttributeSources",function(a){return void 0!==a?c.i(t.k)(a,t.h):[]})};g.displayState.objectToDataTransform.restoreState(b.transform);g.displayState.fragmentMain.restoreState(b.shader);g.userSpecifiedAttributeNames=c.i(t.d)(b,"vertexAttributeNames",function(a){if(void 0!==a)return c.i(t.k)(a,function(a){if(a=c.i(t.e)(a))return a})});c.i(r.b)(a.chunkManager,g.parameters).then(function(a){if(!g.wasDisposed){g.meshSource=a;var b=g.defaultAttributeNames=d(a.info.vertexAttributes.map(function(a){return a.name})),
c=g.userSpecifiedAttributeNames;void 0!==c&&c.length===b.length?(b=c,g.userSpecifiedAttributeNames=void 0):b=Array.from(b);g.displayState.attributeNames.value=b;g.addRenderLayer(new r.c(a,g.displayState))}});g.registerDisposer(g.displayState.fragmentMain.changed.add(function(){g.specificationChanged.dispatch()}));g.registerDisposer(g.displayState.attributeNames.changed.add(function(){g.specificationChanged.dispatch()}));return g}a(f,b);x(f,[{key:"toJSON",value:function(){var a={type:"mesh"},b=this.parameters.attributeSourceUrls;
a.source=this.parameters.meshSourceUrl;b&&(a.vertexAttributeSources=b);a.shader=this.displayState.fragmentMain.toJSON();a.transform=this.displayState.objectToDataTransform.toJSON();if(void 0===this.meshSource)b=this.userSpecifiedAttributeNames;else{for(var b=this.defaultAttributeNames,d=this.displayState.attributeNames.value,c=!0,e=d.length,f=0;f<e;++f)if(d[f]!==b[f]){c=!1;break}b=c?void 0:Array.from(d)}a.vertexAttributeNames=b;return a}},{key:"makeDropdown",value:function(a){return new A(a,this)}}]);
return f}(n.h),C=function(b){function d(a,b){m(this,d);var c=e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));c.attributeNames=a;c.getAttributeInfo=b;c.element=document.createElement("div");c.debouncedValueUpdater=l()(function(){c.updateAttributeNames()},500);c.element.className="neuroglancer-single-mesh-attribute-widget";c.updateInputElements();c.registerDisposer(a.changed.add(function(){c.updateInputElements()}));return c}a(d,b);x(d,[{key:"updateInputElements",value:function(){var a=this.attributeNames,
b=this.attributeNameElements;if(void 0===b){var d=this.getAttributeInfo();if(void 0===d)return;for(var b=this.attributeNameElements=[],e=void 0,f=a.value.length,g=this.element,k=0;k<f;++k){var l=d[k],h=l.source;if(h!==e&&void 0!==h){var e=h,p=document.createElement("div");p.className="neuroglancer-single-mesh-source-header";p.textContent=h;g.appendChild(p)}h=document.createElement("div");h.className="neuroglancer-single-mesh-attribute";p=document.createElement("input");p.title=l.name;this.registerEventListener(p,
"input",this.debouncedValueUpdater);p.type="text";h.textContent=c.i(r.e)(l);h.appendChild(p);if(void 0!==l.min&&void 0!==l.max){var u=document.createElement("span");u.className="neuroglancer-single-mesh-attribute-range";u.textContent="["+l.min.toPrecision(6)+", "+l.max.toPrecision(6)+"]";h.appendChild(u)}b[k]=p;g.appendChild(h)}}a.value.forEach(function(a,d){b[d].value=a||""})}},{key:"disposed",value:function(){c.i(v.b)(this.element)}},{key:"updateAttributeNames",value:function(){var a=this.attributeNames.value,
b=this.attributeNameElements,d=!1;a.forEach(function(c,e){var f=b[e].value;f||(f=void 0);f!==c&&(d=!0,a[e]=f)});d&&this.attributeNames.changed.dispatch()}}]);return d}(k.a),A=function(b){function d(a,b){m(this,d);var c=e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));c.element=a;c.layer=b;c.attributeWidget=c.registerDisposer(g(c.layer));c.codeWidget=c.registerDisposer(f(c.layer));a.classList.add("neuroglancer-single-mesh-dropdown");b=document.createElement("div");b.className="neuroglancer-single-mesh-dropdown-top-row";
var k=document.createElement("div");k.style.flex="1";var l=document.createElement("a"),h=document.createElement("button");h.type="button";h.textContent="?";h.className="help-link";l.appendChild(h);l.title="Documentation on single mesh layer rendering";l.target="_blank";l.href="https://github.com/google/neuroglancer/blob/master/src/neuroglancer/sliceview/image_layer_rendering.md";h=document.createElement("button");h.innerHTML="&square;";h.className="maximize-button";h.title="Show larger editor view";
c.registerEventListener(h,"click",function(){new D(c.layer)});b.appendChild(k);b.appendChild(h);b.appendChild(l);a.appendChild(b);a.appendChild(c.attributeWidget.element);a.appendChild(c.codeWidget.element);c.codeWidget.textEditor.refresh();return c}a(d,b);x(d,[{key:"onShow",value:function(){this.codeWidget.textEditor.refresh()}}]);return d}(n.i),D=function(b){function d(a){m(this,d);var b=e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));b.layer=a;b.attributeWidget=b.registerDisposer(g(b.layer));
b.codeWidget=b.registerDisposer(f(b.layer));b.content.classList.add("neuroglancer-single-mesh-layer-shader-overlay");b.content.appendChild(b.attributeWidget.element);b.content.appendChild(b.codeWidget.element);b.codeWidget.textEditor.refresh();return b}a(d,b);return d}(p.b);c.i(u.c)("mesh",y)},function(n,h,c){function m(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function e(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function a(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}n=c(26);var b=c(38),d=c(0),f=c(1),g=c(3),l=c(17),u=c(72),p=c(18),r=c(6),k=c(46);c.d(h,"a",function(){return y});c.d(h,"b",function(){return A});
c.d(h,"c",function(){return F});var v=function z(a,b,d){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,b);if(void 0===c){if(a=Object.getPrototypeOf(a),null!==a)return z(a,b,d)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(d)}},t=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,
d);c&&a(b,c);return b}}(),B=f.b.create(),x=new Float32Array(4),y=function(b){function d(a,b,c,f){m(this,d);var k=e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));k.chunkManager=a;k.pointList=b;k.voxelSizeObject=c;k.selectedIndex=f;k.generation=-1;k.redrawNeeded=new g.a;k.color=Float32Array.of(1,1,0,1);k.selectedColor=Float32Array.of(0,1,0,1);k.buffer=new l.a(a.gl);k.registerDisposer(b.changed.add(function(){k.selectedIndex.value=null;k.redrawNeeded.dispatch()}));k.registerDisposer(f.changed.add(function(){k.redrawNeeded.dispatch()}));
return k}a(d,b);t(d,[{key:"updateBuffer",value:function(){var a=this.pointList,b=a.generation;this.generation!==b&&(this.generation=b,this.buffer.setData(a.points.view))}},{key:"updateMouseState",value:function(a,b){f.a.multiply(a.position,this.pointList.get(b),this.voxelSizeObject.size)}},{key:"gl",get:function(){return this.chunkManager.gl}}]);return d}(d.a);h=function(b){function d(a){m(this,d);var b=e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));b.gl=a;b.shaders=new Map;b.squareCornersBuffer=
c.i(k.a)(b.gl);b.countingBuffer=b.registerDisposer(c.i(u.a)(b.gl));return b}a(d,b);t(d,[{key:"defineShader",value:function(a){a.addAttribute("highp vec3","aVertexPosition");a.addAttribute("highp vec2","aCornerOffset");a.addUniform("highp vec2","uPointRadii");a.addUniform("highp vec4","uColor");a.addUniform("highp vec4","uColorSelected");a.addUniform("highp vec4","uSelectedIndex");a.addVarying("highp vec4","vColor");a.addUniform("highp mat4","uProjection");a.addUniform("highp vec4","uPickID");a.addVarying("highp vec4",
"vPickID");a.addVarying("highp vec2","vPointCoord");a.require(u.b);a.addVertexCode(r.l);a.setVertexMain("\ngl_Position = uProjection * vec4(aVertexPosition, 1.0);\ngl_Position.xy += aCornerOffset * uPointRadii * gl_Position.w;\nvPointCoord = aCornerOffset;\n\nuint32_t primitiveIndex = getPrimitiveIndex();\n\nuint32_t pickID; pickID.value = uPickID;\nvPickID = add(pickID, primitiveIndex).value;\n\nif (uSelectedIndex == primitiveIndex.value) {\n  vColor = uColorSelected;\n} else {\n  vColor = uColor;\n}\n");
a.setFragmentMain("\nif (dot(vPointCoord, vPointCoord) > 1.0) {\n  discard;\n}\nemit(getColor(), vPickID);\n")}},{key:"getShader",value:function(a){var b=this.shaders,d=b.get(a);void 0===d&&(d=new p.a(this.gl),d.require(a),this.defineShader(d),d=this.registerDisposer(d.build()),b.set(a,d));return d}},{key:"draw",value:function(a,b,d){var e=this.getShader(d.emitter),g=this.gl;e.bind();b.updateBuffer();var k=b.pointList.length,l=e.attribute("aVertexPosition"),h=e.attribute("aCornerOffset");b.buffer.bindToVertexAttrib(l,
3);g.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(l,1);this.squareCornersBuffer.bindToVertexAttrib(h,2);this.countingBuffer.ensure(k).bind(e,1);f.b.identity(B);f.b.scale(B,B,b.voxelSizeObject.size);f.b.multiply(B,d.dataToDevice,B);g.uniformMatrix4fv(e.uniform("uProjection"),!1,B);g.uniform2f(e.uniform("uPointRadii"),8/d.viewportWidth,8/d.viewportHeight);d.emitPickID&&(a=d.pickIDs.register(a,k),g.uniform4fv(e.uniform("uPickID"),c.i(r.m)(x,a)));d.emitColor&&(g.uniform4fv(e.uniform("uColor"),b.color),
g.uniform4fv(e.uniform("uColorSelected"),b.selectedColor),b=b.selectedIndex.value,null===b&&(b=4294967295),g.uniform4fv(e.uniform("uSelectedIndex"),c.i(r.m)(x,b)));g.ANGLE_instanced_arrays.drawArraysInstancedANGLE(g.TRIANGLE_FAN,0,4,k);g.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(l,0);c.i(u.c)(g,e,!0);g.disableVertexAttribArray(l)}}]);return d}(d.a);var C=function(b){function d(){m(this,d);return e(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments))}a(d,b);t(d,[{key:"defineShader",
value:function(a){v(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"defineShader",this).call(this,a);a.addFragmentCode("\nvec4 getColor () { return vColor; }\n")}}]);return d}(h),A=function(b){function d(a){m(this,d);var b=e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));b.base=a;b.renderHelper=b.registerDisposer(new C(b.gl));b.registerDisposer(a);b.registerDisposer(a.redrawNeeded.add(function(){b.redrawNeeded.dispatch()}));b.setReady(!0);return b}a(d,b);t(d,[{key:"draw",value:function(a){this.renderHelper.draw(this,
this.base,a)}},{key:"updateMouseState",value:function(a,b,d){this.base.updateMouseState(a,d)}},{key:"transformPickedValue",value:function(a,b){return b}},{key:"gl",get:function(){return this.base.chunkManager.gl}}]);return d}(n.a),D=function(b){function d(){m(this,d);return e(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments))}a(d,b);t(d,[{key:"defineShader",value:function(a){v(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"defineShader",this).call(this,a);a.addFragmentCode("\nvec4 getColor() {\n  float scalar = 1.0 - 2.0 * abs(0.5 - gl_FragCoord.z);\n  return vec4(vColor.xyz, scalar * vColor.a);\n}\n")}}]);
return d}(h),F=function(b){function d(a){m(this,d);var b=e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));b.base=a;b.renderHelper=b.registerDisposer(new D(b.gl));b.registerDisposer(a);b.registerDisposer(a.redrawNeeded.add(function(){b.redrawNeeded.dispatch()}));b.setReady(!0);return b}a(d,b);t(d,[{key:"draw",value:function(a){this.renderHelper.draw(this,this.base,a)}},{key:"updateMouseState",value:function(a,b,d){this.base.updateMouseState(a,d)}},{key:"transformPickedValue",value:function(a,
b){return b}},{key:"gl",get:function(){return this.base.chunkManager.gl}}]);return d}(b.b)},function(n,h,c){var m=c(136),e=c(2),a=c(3);c.d(h,"a",function(){return d});var b=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),d=function(){function d(){if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");
this.points=new m.a;this.changed=new a.a;this.generation=0}b(d,[{key:"delete",value:function(a){this.points.eraseRange(3*a,3*a+3);++this.generation;this.changed.dispatch()}},{key:"get",value:function(a){return this.points.data.subarray(3*a,3*a+3)}},{key:"append",value:function(a){this.points.appendArray(a.subarray(0,3));++this.generation;this.changed.dispatch()}},{key:"reset",value:function(){this.points.clear();++this.generation;this.changed.dispatch()}},{key:"restoreState",value:function(a){try{if(Array.isArray(a)){var b=
a.length,d=this.points;d.resize(3*b);for(var f=d.data,d=0;d<b;++d){var g=3*d;c.i(e.i)(f.subarray(g,g+3),a[d],e.j)}++this.generation;this.changed.dispatch()}}catch(k){this.reset()}}},{key:"toJSON",value:function(){for(var a=this.length,b=this.points.data,d=Array(a),c=0;c<a;++c){var e=3*c;d[c]=[b[e],b[e+1],b[e+2]]}return d}},{key:"length",get:function(){return this.points.length/3}}]);return d}()},function(n,h,c){var m=c(54),e=c(33),a=c(13),b=c(137);n=c(7);var d=0;m.b.getNewTokenPromise=function(){var f=
new e.a(!0),g;return new Promise(function(e){function l(a,b){b=void 0===b?"Request authorization.":b;f.setText((void 0===a?"Brain Maps authorization required.":a)+"  ");a=document.createElement("button");a.textContent=b;f.element.appendChild(a);a.addEventListener("click",function(){h(!1)});f.setVisible(!0)}function h(h){void 0!==g&&g.cancel();g=new a.a;l("Waiting for Brain Maps authorization...","Retry");c.i(b.a)({clientId:"639403125587-4k5hgdfumtrvur8v48e3pr7oo91d765k.apps.googleusercontent.com",
scopes:["https://www.googleapis.com/auth/brainmaps"],immediate:h,authUser:0},g).then(function(a){g=void 0;a.generationId=d++;f.dispose();e(a)},function(a){g=void 0;h?l():l("Brain Maps authorization failed: "+a+".","Retry")})}h(!0)})};c.i(n.d)("brainmaps.requestToken",function(a){var b=this;c.i(m.a)(a.invalidToken).then(function(a){b.invoke("brainmaps.receiveToken",{authResult:a})})})},function(n,h,c){function m(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}var a=c(53);c.d(h,"d",function(){return d});c.d(h,"a",function(){return g});c.d(h,"b",function(){return l});c.d(h,"c",function(){return u});var b=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=
c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),d;(function(a){a[a.RAW=0]="RAW";a[a.JPEG=1]="JPEG";a[a.COMPRESSED_SEGMENTATION=2]="COMPRESSED_SEGMENTATION"})(d||(d={}));var f=function(){function a(){e(this,a)}b(a,null,[{key:"stringify",value:function(a){return void 0===a?"":a.changeStackId+"/"+a.timeStamp+"/"+a.skipEquivalences}}]);return a}(),g=function(){function g(){e(this,g)}b(g,
null,[{key:"stringify",value:function(b){return"brainmaps-"+c.i(a.e)(b.instance)+":volume/"+b.volumeId+"/"+(b.scaleIndex+"/"+d[b.encoding]+"/")+(""+f.stringify(b.changeSpec))}}]);return g}();g.RPC_ID="brainmaps/VolumeChunkSource";var l=function(){function d(){e(this,d)}b(d,null,[{key:"stringify",value:function(b){return"brainmaps:"+c.i(a.e)(b.instance)+":mesh/"+(b.volumeId+"/"+b.meshName+"/")+(""+f.stringify(b.changeSpec))}}]);return d}();l.RPC_ID="brainmaps/MeshSource";var u=function(a){function b(){e(this,
b);var a=(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?this:a}m(b,a);return b}(l);u.RPC_ID="brainmaps/SkeletonSource"},function(n,h,c){function m(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function e(a,b){if("function"!==typeof b&&
null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function a(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}c.d(h,"a",function(){return d});c.d(h,"c",function(){return f});c.d(h,"b",function(){return g});var b=function(){function a(a,b){for(var d=
0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}();n=function u(){a(this,u)};var d=function(d){function c(){a(this,c);return m(this,(c.__proto__||Object.getPrototypeOf(c)).apply(this,arguments))}e(c,d);b(c,null,[{key:"stringify",value:function(a){return"dvid:volume:"+a.baseUrls[0]+"/"+a.nodeKey+"/"+a.dataInstanceKey}}]);return c}(n);d.RPC_ID="dvid/VolumeChunkSource";
var f;(function(a){a[a.JPEG=0]="JPEG"})(f||(f={}));var g=function(d){function c(){a(this,c);return m(this,(c.__proto__||Object.getPrototypeOf(c)).apply(this,arguments))}e(c,d);b(c,null,[{key:"stringify",value:function(a){return"dvid:volume:"+a.baseUrls[0]+"/"+a.nodeKey+"/"+a.dataInstanceKey+"/"+a.dims+"/"+a.level+"/"+f[a.encoding]}}]);return c}(n);g.RPC_ID="dvid/TileChunkSource"},function(n,h,c){c.d(h,"a",function(){return a});var m=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];
c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,c,e){c&&a(b.prototype,c);e&&a(b,e);return b}}();h.b="nifti/getNiftiVolumeInfo";var e;(function(a){a[a.NONE=0]="NONE";a[a.BINARY=1]="BINARY";a[a.UINT8=2]="UINT8";a[a.INT16=4]="INT16";a[a.INT32=8]="INT32";a[a.FLOAT32=16]="FLOAT32";a[a.COMPLEX64=32]="COMPLEX64";a[a.FLOAT64=64]="FLOAT64";a[a.RGB24=128]="RGB24";a[a.INT8=256]="INT8";a[a.UINT16=512]="UINT16";a[a.UINT32=768]="UINT32";
a[a.INT64=1024]="INT64";a[a.UINT64=1280]="UINT64";a[a.FLOAT128=1536]="FLOAT128";a[a.COMPLEX128=1792]="COMPLEX128";a[a.COMPLEX256=2048]="COMPLEX256"})(e||(e={}));var a=function(){function a(){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");}m(a,null,[{key:"stringify",value:function(a){return"nifti:"+a.url}}]);return a}();a.RPC_ID="nifti/VolumeChunkSource"},function(n,h,c){function m(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
}c.d(h,"c",function(){return a});c.d(h,"a",function(){return b});c.d(h,"b",function(){return d});var e=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),a;(function(a){a[a.RAW=0]="RAW";a[a.JPEG=1]="JPEG";a[a.COMPRESSED_SEGMENTATION=2]="COMPRESSED_SEGMENTATION"})(a||(a={}));var b=function(){function a(){m(this,
a)}e(a,null,[{key:"stringify",value:function(a){return"precomputed:volume:"+a.baseUrls[0]+"/"+a.path}}]);return a}();b.RPC_ID="precomputed/VolumeChunkSource";var d=function(){function a(){m(this,a)}e(a,null,[{key:"stringify",value:function(a){return"precomputed:mesh:"+a.baseUrls[0]+"/"+a.path+"/"+a.lod}}]);return a}();d.RPC_ID="precomputed/MeshSource"},function(n,h,c){function m(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}c.d(h,"d",function(){return a});c.d(h,
"a",function(){return b});c.d(h,"b",function(){return d});c.d(h,"c",function(){return f});var e=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),a;(function(a){a[a.JPEG=0]="JPEG";a[a.NPZ=1]="NPZ";a[a.RAW=2]="RAW"})(a||(a={}));var b=function(){function b(){m(this,b)}e(b,null,[{key:"stringify",value:function(b){return"python:volume:"+
b.baseUrls[0]+"/"+b.key+"/"+a[b.encoding]}}]);return b}();b.RPC_ID="python/VolumeChunkSource";var d=function(){function a(){m(this,a)}e(a,null,[{key:"stringify",value:function(a){return"python:mesh:"+a.baseUrls[0]+"/"+a.key}}]);return a}();d.RPC_ID="python/MeshSource";var f=function(){function a(){m(this,a)}e(a,null,[{key:"stringify",value:function(a){return"python:skeleton:"+a.baseUrls[0]+"/"+a.key}}]);return a}();f.RPC_ID="python/SkeletonSource"},function(n,h,c){function m(a,b){if("function"!==
typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}c.d(h,"a",function(){return b});var a=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||
!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),b=function(b){function d(){e(this,d);var a=(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?this:a}m(d,b);a(d,null,[{key:"stringify",value:function(a){return"render:tile:"+a.baseUrls[0]+"/"+
a.owner+"/"+a.project+"/"+a.stack+"/"+a.level+"/"+a.encoding}}]);return d}(function f(){e(this,f)});b.RPC_ID="render/TileChunkSource"},function(n,h,c){h.a=function(c){c.bind("arrowleft","x-");c.bind("arrowright","x+");c.bind("arrowup","y-");c.bind("arrowdown","y+");c.bind("comma","z-");c.bind("period","z+");c.bind("keyz","snap");c.bind("control+equal","zoom-in");c.bind("control+shift+equal","zoom-in");c.bind("control+minus","zoom-out");c.bind("keyr","rotate-relative-z-");c.bind("keye","rotate-relative-z+");
c.bind("shift+arrowdown","rotate-relative-x-");c.bind("shift+arrowup","rotate-relative-x+");c.bind("shift+arrowleft","rotate-relative-y-");c.bind("shift+arrowright","rotate-relative-y+");c.bind("keyl","recolor");c.bind("keyx","clear-segments");c.bind("keys","toggle-show-slices");c.bind("keyb","toggle-scale-bar");c.bind("keya","toggle-axis-lines");for(var e=1;9>=e;++e)c.bind("digit"+e,"toggle-layer-"+e);c.bind("keyn","add-layer");c.bind("keyh","help");c.bind("space","toggle-layout")}},function(n,h,
c){c(119);var m=c(56),e=c(144);h.a=function(){var a=new m.a(document.getElementById("container"));return new e.a(a)};c(157)},function(n,h,c){function m(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function e(a){return a.startsWith("key")?a.substring(3):
a.startsWith("digit")||a.startsWith("arrow")?a.substring(5):a}function a(a){return a.split("+").map(e).join("+")}n=c(21);c.d(h,"a",function(){return b});c(158);var b=function(b){function d(b){if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");var c;c=(d.__proto__||Object.getPrototypeOf(d)).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");c=!c||"object"!==typeof c&&"function"!==typeof c?this:c;var e=c.content;e.classList.add("describe-key-bindings");
var f=document.createElement("div"),g=document.createElement("div");g.className="dl";b=$jscomp.makeIterator(b.entries());for(var k=b.next();!k.done;k=b.next()){var h=$jscomp.makeIterator(k.value),k=h.next().value,h=h.next().value,m=document.createElement("div"),n=document.createElement("div");n.className="definition-outer-container";m.className="definition-container";var x=document.createElement("div");x.className="dt";x.textContent=k.map(a).join(" ");k=document.createElement("div");k.className="dd";
k.textContent=h;m.appendChild(x);m.appendChild(k);g.appendChild(n);n.appendChild(m)}f.appendChild(g);e.appendChild(f);return c}m(d,b);return d}(n.b)},function(n,h,c){function m(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function e(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function a(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var b=c(58),d=c(12);n=c(0);var f=c(10),g=c(69),l=c(193),u=c.n(l);c.d(h,"a",function(){return v});var p=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,
d);c&&a(b,c);return b}}(),r=function B(a,b,d){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,b);if(void 0===c){if(a=Object.getPrototypeOf(a),null!==a)return B(a,b,d)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(d)}};c(19);c(161);var k=function(k){function l(a,c){m(this,l);var f=e(this,(l.__proto__||Object.getPrototypeOf(l)).call(this));f.layer=a;f.panel=c;var g=f.element=document.createElement("span");g.className="layer-item-parent noselect";
c=f.widgetElement=document.createElement("span");c.className="layer-item noselect";g.appendChild(c);var k=f.labelElement=document.createElement("span");k.className="layer-item-label";var h=f.layerNumberElement=document.createElement("span");h.className="layer-item-number";var p=f.valueElement=document.createElement("span");p.className="layer-item-value";var r=document.createElement("span");r.title="Delete layer";r.className="layer-item-close";f.registerEventListener(r,"click",function(a){f.panel.layerManager.removeManagedLayer(f.layer)});
c.appendChild(h);c.appendChild(k);c.appendChild(p);c.appendChild(r);f.registerEventListener(c,"click",function(b){a.setVisible(!a.visible)});var u=f.dropdownElement=document.createElement("div"),k=function(a){f.registerEventListener(g,a,function(a){0===a.button&&f.panel.setDragging(!0)});f.registerEventListener(u,a,function(a){a.stopPropagation()})};k("mousedown");k("pointerdown");f.registerEventListener(g,"mouseup",function(a){0===a.button&&f.panel.setDragging(!1)});f.registerEventListener(c,"dblclick",
function(c){a instanceof d.b&&new b.a(f.panel.manager,a)});f.setupDropdownElement();f.handleLayerChanged();f.registerDisposer(a.layerChanged.add(function(){f.handleLayerChanged()}));g.appendChild(u);f.registerEventListener(g,"mouseenter",function(){f.hovering=!0;f.updateDropdownState()});f.registerEventListener(g,"mouseleave",function(a){f.hovering=!1;f.updateDropdownState()});return f}a(l,k);p(l,[{key:"updateDropdownState",value:function(){var a=this.dropdownElement.style;if(this.hovering&&!this.panel.dragging&&
0<this.dropdownElement.childElementCount){if("flex"!==a.display&&(a.display="flex",this.dropdown))this.dropdown.onShow();c.i(g.a)(this.dropdownElement,this.widgetElement)}else if("none"!==a.display&&(this.dropdownElement.style.display="none",this.dropdown))this.dropdown.onHide()}},{key:"setupDropdownElement",value:function(){this.dropdownElement.className="layer-dropdown"}},{key:"update",value:function(){var a=this.layer;this.labelElement.textContent=a.name;this.widgetElement.setAttribute("layer-visible",
a.visible.toString())}},{key:"handleLayerChanged",value:function(){var a=this.layer.layer;a!==this.userLayer&&(this.dropdown&&(this.dropdown.dispose(),c.i(f.a)(this.dropdownElement),this.setupDropdownElement()),this.dropdown=(this.userLayer=a)?a.makeDropdown(this.dropdownElement):void 0)}},{key:"disposed",value:function(){this.dropdown&&this.dropdown.dispose();this.element.parentElement.removeChild(this.element);r(l.prototype.__proto__||Object.getPrototypeOf(l.prototype),"disposed",this).call(this)}}]);
return l}(n.a),v=function(d){function c(a,b){m(this,c);var d=e(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));d.element=a;d.manager=b;d.layerWidgets=new Map;d.layerUpdateNeeded=!0;d.valueUpdateNeeded=!1;d.dragging=!1;a.className="layer-panel";d.registerDisposer(b.layerSelectedValues.changed.add(function(){d.handleLayerValuesChanged()}));d.registerDisposer(b.layerManager.layersChanged.add(function(){d.handleLayersChanged()}));b=d.addButton=document.createElement("button");b.className="layer-add-button";
b.title="Add layer";d.registerEventListener(b,"click",function(){d.addLayerMenu()});a.appendChild(b);d.update();var f=new u.a(d.element,{draggable:".layer-item-parent",onStart:function(a){d.setDragging(!0);d.element.classList.add("sorting-in-progress")},onEnd:function(a){d.setDragging(!1);d.element.classList.remove("sorting-in-progress");d.layerManager.reorderManagedLayer(a.oldIndex,a.newIndex)},onMove:function(a){return a.related!==d.addButton}});d.registerDisposer(function(){f.destroy()});return d}
a(c,d);p(c,[{key:"setDragging",value:function(a){this.dragging=a;a=$jscomp.makeIterator(this.layerWidgets.values());for(var b=a.next();!b.done;b=a.next())b.value.updateDropdownState()}},{key:"disposed",value:function(){this.layerWidgets.forEach(function(a){return a.dispose()});this.layerWidgets=void 0;r(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"disposed",this).call(this)}},{key:"handleLayersChanged",value:function(){this.layerUpdateNeeded=!0;this.handleLayerValuesChanged()}},{key:"handleLayerValuesChanged",
value:function(){this.valueUpdateNeeded||(this.valueUpdateNeeded=!0,requestAnimationFrame(this.update.bind(this)))}},{key:"update",value:function(){this.valueUpdateNeeded=!1;this.updateLayers();for(var a=this.manager.layerSelectedValues,b=$jscomp.makeIterator(this.layerWidgets),d=b.next();!d.done;d=b.next()){var d=$jscomp.makeIterator(d.value),c=d.next().value,d=d.next().value,e=c.layer,c="";null!==e&&(e=a.get(e),void 0!==e&&(c=""+e));d.valueElement.textContent=c}}},{key:"updateLayers",value:function(){var a=
this;if(this.layerUpdateNeeded){this.layerUpdateNeeded=!1;var b=this.element,d=new Set,c=b.firstElementChild;this.manager.layerManager.managedLayers.forEach(function(e,f){d.add(e);var g=a.layerWidgets.get(e);void 0===g&&(g=new k(e,a),a.layerWidgets.set(e,g));g.layerNumberElement.textContent=""+(1+f);g.update();g.element!==c&&b.insertBefore(g.element,a.addButton)});for(var e=$jscomp.makeIterator(this.layerWidgets),f=e.next();!f.done;f=e.next()){var g=$jscomp.makeIterator(f.value),f=g.next().value,
g=g.next().value;d.has(f)||(this.layerWidgets.delete(f),g.dispose())}}}},{key:"addLayerMenu",value:function(){new b.a(this.manager)}},{key:"layerManager",get:function(){return this.manager.layerManager}}]);return c}(n.a)},function(n,h,c){h.a="mesh/MeshLayer";h.b="mesh/FragmentSource"},function(n,h,c){function m(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function e(a,b){if("function"!==typeof b&&
null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function a(a){a.addFragmentExtension("GL_EXT_draw_buffers");a.addFragmentCode(A)}function b(a){a.addFragmentExtension("GL_EXT_draw_buffers");a.addFragmentCode(D)}function d(a){a.setFragmentMain("\nvec4 v0 = getValue0();\nvec4 v1 = getValue1();\nvec4 accum = vec4(v0.rgb, v1.r);\nfloat revealage = v0.a;\n\ngl_FragColor = vec4(accum.rgb / accum.a, revealage);\n")}
var f=c(52),g=c(9),l=c(61),u=c(26);n=c(62);var p=c(5),r=c(27),k=c(1),v=c(71),t=c(44),B=c(6);c.d(h,"a",function(){return z});var x=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),y=function J(a,b,d){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,b);if(void 0===c){if(a=Object.getPrototypeOf(a),
null!==a)return J(a,b,d)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(d)}};c(19);c(164);var C;(function(a){a[a.COLOR=0]="COLOR";a[a.Z=1]="Z";a[a.PICK=2]="PICK";a[a.NUM_TEXTURES=3]="NUM_TEXTURES"})(C||(C={}));var A=[B.a,"\nvoid emit(vec4 color, vec4 pickId) {\n  gl_FragData["+C.COLOR+"] = color;\n  gl_FragData["+C.Z+"] = packFloat01ToFixedPoint(1.0 - gl_FragCoord.z);\n  gl_FragData["+C.PICK+"] = pickId;\n}\n"],D=["\nfloat computeOITWeight(float alpha) {\n  float a = min(1.0, alpha) * 8.0 + 0.01;\n  float b = -gl_FragCoord.z * 0.95 + 1.0;\n  return a * a * a * b * b * b;\n}\n",
"\nvoid emit(vec4 color, vec4 pickId) {\n  float weight = computeOITWeight(color.a);\n  vec4 accum = color * weight;\n  gl_FragData[0] = vec4(accum.rgb, color.a);\n  gl_FragData[1] = vec4(accum.a, 0.0, 0.0, 0.0);\n}\n"],F=k.a.create(),G=k.b.create(),z=function(h){function n(b,e,h){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");var v=m(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,b,e,h));v.visibleLayerTracker=c.i(g.e)(v.viewer.layerManager,u.a,v);v.sliceViews=
new Set;v.projectionMat=k.b.create();v.inverseProjectionMat=k.b.create();v.modelViewMat=k.b.create();v.width=0;v.height=0;v.pickIDs=new l.a;v.axesLineHelper=v.registerDisposer(f.a.get(v.gl));v.sliceViewRenderHelper=v.registerDisposer(p.b.get(v.gl,a));v.offscreenFramebuffer=v.registerDisposer(new t.a(v.gl,{colorBuffers:c.i(t.b)(v.gl,C.NUM_TEXTURES),depthBuffer:new t.c(v.gl)}));v.offscreenCopyHelper=v.registerDisposer(t.d.get(v.gl));v.transparencyCopyHelper=v.registerDisposer(t.d.get(v.gl,d,2));v.registerDisposer(v.navigationState.changed.add(function(){v.viewportChanged()}));
h.showSliceViewsCheckbox&&(b=v.registerDisposer(new r.b(h.showSliceViews)),b.element.className="perspective-panel-show-slice-views noselect",e=document.createElement("label"),e.className="perspective-panel-show-slice-views noselect",e.appendChild(document.createTextNode("Slices")),e.appendChild(b.element),v.element.appendChild(e));v.registerDisposer(h.showSliceViews.changed.add(function(){v.scheduleRedraw()}));v.registerDisposer(h.showAxisLines.changed.add(function(){v.scheduleRedraw()}));return v}
e(n,h);x(n,[{key:"updateProjectionMatrix",value:function(){var a=this.projectionMat;k.b.perspective(a,Math.PI/4,this.width/this.height,10,5E3);var b=this.modelViewMat;this.navigationState.toMat4(b);k.a.set(F,1,-1,-1);k.b.scale(b,b,F);var d=k.a.set(F,0,0,100);k.b.translate(b,b,d);k.b.invert(G,b);k.b.multiply(a,a,G);k.b.invert(this.inverseProjectionMat,a)}},{key:"viewportChanged",value:function(){this.context.scheduleRedraw()}},{key:"onResize",value:function(){this.width=this.element.clientWidth;this.height=
this.element.clientHeight;this.viewportChanged()}},{key:"disposed",value:function(){for(var a=$jscomp.makeIterator(this.sliceViews),b=a.next();!b.done;b=a.next())b.value.dispose();this.sliceViews.clear();y(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"disposed",this).call(this)}},{key:"updateMouseState",value:function(a){a.pickedRenderLayer=null;if(!this.navigationState.valid)return!1;var b=a.position,d=this.offscreenFramebuffer,e=this.width,f=this.height;if(!d.hasSize(e,f))return!1;
var g=this.mouseX,l=f-this.mouseY,h=d.readPixel(C.Z,g,l),h=1-c.i(B.b)(h);if(1===h)return!1;b[0]=2*g/e-1;b[1]=2*l/f-1;b[2]=2*h-1;k.a.transformMat4(b,b,this.inverseProjectionMat);this.pickIDs.setMouseState(a,d.readPixelAsUint32(C.PICK,g,l));return!0}},{key:"startDragViewport",value:function(a){var b=this;c.i(v.a)(a,function(a,d,c){if(a.shiftKey){a=b.width;var e=b.height,f=b.viewer.navigationState.position,g=f.spatialCoordinates;k.a.transformMat4(F,g,b.projectionMat);F[0]=2*d/a;F[1]=-2*c/e;k.a.transformMat4(g,
F,b.inverseProjectionMat);f.changed.dispatch()}else b.navigationState.pose.rotateRelative(k.f[1],-d/4*Math.PI/180),b.navigationState.pose.rotateRelative(k.f[0],c/4*Math.PI/180),b.viewer.navigationState.changed.dispatch()})}},{key:"draw",value:function(){var d=this.width,e=this.height;if(this.navigationState.valid&&0!==d&&0!==e){for(var f=$jscomp.makeIterator(this.sliceViews),g=f.next();!g.done;g=f.next())g.value.updateRendering();f=this.gl;this.offscreenFramebuffer.bind(d,e);f.disable(f.SCISSOR_TEST);
this.gl.clearColor(0,0,0,0);f.clear(f.COLOR_BUFFER_BIT|f.DEPTH_BUFFER_BIT);f.enable(f.DEPTH_TEST);g=this.projectionMat;this.updateProjectionMatrix();var l=k.a.create();c.i(k.e)(l,k.f[2],this.modelViewMat);k.a.normalize(l,l);var h=this.pickIDs;h.clear();for(var g={dataToDevice:g,lightDirection:l,ambientLighting:.2,directionalLighting:.8,pickIDs:h,emitter:a,emitColor:!0,emitPickID:!0,alreadyEmittedPickID:!1,viewportWidth:d,viewportHeight:e},l=this.visibleLayerTracker.getVisibleLayers(),p=!1,r=$jscomp.makeIterator(l),
h=r.next();!h.done;h=r.next())h=h.value,h.isTransparent?p=!0:h.draw(g);this.viewer.showSliceViews.value&&this.drawSliceViews(g);this.viewer.showAxisLines.value&&this.drawAxisLines();if(p){f.depthMask(!1);f.enable(f.BLEND);p=this.transparentConfiguration;p.bind(d,e);this.gl.clearColor(0,0,0,1);f.clear(f.COLOR_BUFFER_BIT);g.emitter=b;f.blendFuncSeparate(f.ONE,f.ONE,f.ZERO,f.ONE_MINUS_SRC_ALPHA);g.emitPickID=!1;r=$jscomp.makeIterator(l);for(h=r.next();!h.done;h=r.next())h=h.value,h.isTransparent&&h.draw(g);
f.disable(f.DEPTH_TEST);this.offscreenFramebuffer.bindSingle(C.COLOR);f.blendFunc(f.ONE_MINUS_SRC_ALPHA,f.SRC_ALPHA);this.transparencyCopyHelper.draw(p.colorBuffers[0].texture,p.colorBuffers[1].texture);f.depthMask(!0);f.disable(f.BLEND);f.enable(f.DEPTH_TEST);this.offscreenFramebuffer.bind(d,e)}f.WEBGL_draw_buffers.drawBuffersWEBGL([f.NONE,f.WEBGL_draw_buffers.COLOR_ATTACHMENT1_WEBGL,f.WEBGL_draw_buffers.COLOR_ATTACHMENT2_WEBGL]);g.emitter=a;g.emitPickID=!0;g.emitColor=!1;d=$jscomp.makeIterator(l);
for(h=d.next();!h.done;h=d.next())e=h.value,g.alreadyEmittedPickID=!e.isTransparent,e.draw(g);f.disable(f.DEPTH_TEST);this.offscreenFramebuffer.unbind();this.setGLViewport();this.offscreenCopyHelper.draw(this.offscreenFramebuffer.colorBuffers[C.COLOR].texture)}}},{key:"drawSliceViews",value:function(a){var b=this.sliceViewRenderHelper,d=a.lightDirection,c=a.ambientLighting,e=a.directionalLighting;a=a.dataToDevice;for(var f=$jscomp.makeIterator(this.sliceViews),g=f.next();!g.done;g=f.next()){var g=
g.value,h=Math.abs(k.a.dot(d,g.viewportAxes[2])),h=c+h*e,l=G;k.b.identity(l);l[0]=g.width/2;l[5]=-g.height/2;k.b.multiply(l,g.viewportToData,l);k.b.multiply(l,a,l);b.draw(g.offscreenFramebuffer.colorBuffers[0].texture,l,k.n.fromValues(h,h,h,1),k.n.fromValues(.5,.5,.5,1),0,0,1,1)}}},{key:"drawAxisLines",value:function(){var a=this.gl;k.b.identity(G);G[0]=1600;G[5]=1600;G[10]=1600;var b=this.navigationState.position.spatialCoordinates;G[12]=b[0];G[13]=b[1];G[14]=b[2];G[15]=1;k.b.multiply(G,this.projectionMat,
G);a.WEBGL_draw_buffers.drawBuffersWEBGL([a.WEBGL_draw_buffers.COLOR_ATTACHMENT0_WEBGL]);this.axesLineHelper.draw(G,!1)}},{key:"zoomByMouse",value:function(a){this.navigationState.zoomBy(a)}},{key:"navigationState",get:function(){return this.viewer.navigationState}},{key:"transparentConfiguration",get:function(){var a=this.transparentConfiguration_;void 0===a&&(a=this.transparentConfiguration_=this.registerDisposer(new t.a(this.gl,{colorBuffers:c.i(t.b)(this.gl,2,this.gl.RGBA,this.gl.FLOAT)})));return a}}]);
return n}(n.a)},function(n,h,c){function m(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function e(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=
b)}n=c(0);var a=c(1);c.d(h,"a",function(){return f});var b=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),d=function l(a,b,d){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,b);if(void 0===c){if(a=Object.getPrototypeOf(a),null!==a)return l(a,b,d)}else{if("value"in c)return c.value;
b=c.get;return void 0===b?void 0:b.call(d)}};c(165);var f=function(c){function f(b,d){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var c=m(this,(f.__proto__||Object.getPrototypeOf(f)).call(this));c.element=b;c.viewer=d;c.positionElements=[];c.needsUpdate=null;c.tempPosition=a.a.create();b.setAttribute("class","position-status-panel");for(var e=c.positionElements,h={},l=0;3>l;h={nextInputIsChange:h.nextInputIsChange,input:h.input},++l){var p=b.ownerDocument.createElement("label");
p.className="position-status-coord";h.input=b.ownerDocument.createElement("input");h.input.type="number";h.input.className="position-status-coord";p.textContent=a.k[l];p.appendChild(h.input);b.appendChild(p);e.push(h.input);h.nextInputIsChange=!1;c.registerEventListener(h.input,"change",function(a){c.handleCoordinateChange()});c.registerEventListener(h.input,"input",function(a){return function(b){a.nextInputIsChange&&(c.handleCoordinateChange(),a.nextInputIsChange=!1);return!0}}(h));c.registerEventListener(h.input,
"wheel",function(a){return function(b){a.nextInputIsChange=!0;a.input.focus();return!0}}(h));c.registerEventListener(h.input,"keydown",function(a){return function(b){a.nextInputIsChange=!1;return!0}}(h));c.registerEventListener(h.input,"mousedown",function(a){return function(b){return a.nextInputIsChange=!0}}(h));c.registerEventListener(h.input,"click",function(a){return!0});c.registerEventListener(h.input,"blur",function(a){return function(b){a.nextInputIsChange=!1;return!0}}(h))}e=c.mouseElement=
document.createElement("span");e.className="position-status-mouse";b.appendChild(e);b=d.mouseState;c.registerDisposer(d.navigationState.pose.changed.add(function(){c.handleChange()}));c.registerDisposer(b.changed.add(function(){c.handleChange()}));c.handleChange();return c}e(f,c);b(f,[{key:"handleChange",value:function(){null==this.needsUpdate&&(this.needsUpdate=requestAnimationFrame(this.update.bind(this)))}},{key:"handleCoordinateChange",value:function(){var a=this.positionElements,b=this.viewer.navigationState.pose.position,
d=this.tempPosition;if(b.voxelCoordinatesValid){b.getVoxelCoordinates(d);for(var c=0;3>c;++c){var e=parseFloat(a[c].value);Number.isNaN(e)||(d[c]=e)}b.setVoxelCoordinates(d)}}},{key:"update",value:function(){this.needsUpdate=null;var a=this.viewer,b=a.mouseState,d=this.tempPosition,a=a.navigationState.pose.position;if(a.getVoxelCoordinates(d))for(var c=this.positionElements,e=0;3>e;++e)c[e].value=""+Math.floor(d[e]);a=a.voxelSize;c="";b.active&&(a.voxelFromSpatial(d,b.position),c="x "+Math.round(d[0])+
"  y "+Math.round(d[1])+"  z "+Math.round(d[2]));this.mouseElement.textContent=c}},{key:"disposed",value:function(){for(var a=$jscomp.makeIterator(this.positionElements),b=a.next();!b.done;b=a.next())this.element.removeChild(b.value);this.element=this.positionElements=void 0;d(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"disposed",this).call(this)}}]);return f}(n.a)},function(n,h,c){h.b=function(c){return c.low+","+c.high};h.a=function(c,e){var a=c.segmentEquivalences;c=$jscomp.makeIterator(c.visibleSegments);
for(var b=c.next();!b.done;b=c.next())if(b=b.value,a.disjointSets.isMinElement(b))for(var d=$jscomp.makeIterator(a.setElements(b)),f=d.next();!f.done;f=d.next())e(f.value,b)}},function(n,h,c){function m(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=
b)}var e=c(134),a=c(2),b=c(3),d=c(11);n=c(7);c.d(h,"a",function(){return l});var f=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),g=function k(a,b,d){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,b);if(void 0===c){if(a=Object.getPrototypeOf(a),null!==a)return k(a,b,d)}else{if("value"in
c)return c.value;b=c.get;return void 0===b?void 0:b.call(d)}};h=this&&this.__decorate||function(a,b,d,c){var e=arguments.length,f=3>e?b:null===c?c=Object.getOwnPropertyDescriptor(b,d):c,g;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)f=Reflect.decorate(a,b,d,c);else for(var k=a.length-1;0<=k;k--)if(g=a[k])f=(3>e?g(f):3<e?g(b,d,f):g(b,d))||f;return 3<e&&f&&Object.defineProperty(b,d,f),f};var l=function(k){function h(){if(!(this instanceof h))throw new TypeError("Cannot call a class as a function");
var a;a=(h.__proto__||Object.getPrototypeOf(h)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");a=!a||"object"!==typeof a&&"function"!==typeof a?this:a;a.disjointSets=new e.a;a.changed=new b.a;return a}m(h,k);f(h,[{key:"disposed",value:function(){this.changed=this.disjointSets=void 0;g(h.prototype.__proto__||Object.getPrototypeOf(h.prototype),"disposed",this).call(this)}},{key:"link",value:function(a,b){if(this.disjointSets.link(a,
b)){var d=this.rpc;d&&d.invoke("DisjointUint64Sets.add",{id:this.rpcId,al:a.low,ah:a.high,bl:b.low,bh:b.high});this.changed.dispatch()}}},{key:"get",value:function(a){return this.disjointSets.get(a)}},{key:"clear",value:function(){if(this.disjointSets.clear()){var a=this.rpc;a&&a.invoke("DisjointUint64Sets.clear",{id:this.rpcId});this.changed.dispatch()}}},{key:"setElements",value:function(a){return this.disjointSets.setElements(a)}},{key:"toJSON",value:function(){return this.disjointSets.toJSON()}},
{key:"restoreState",value:function(b){var e=this;this.clear();if(void 0!==b){var f=[new d.a,new d.a];c.i(a.k)(b,function(b){c.i(a.k)(b,function(a,b){f[b%2].parseString(String(a),10);0!==b&&e.link(f[0],f[1])})})}}},{key:"size",get:function(){return this.disjointSets.size}}],[{key:"makeWithCounterpart",value:function(a){var b=new this;b.initializeCounterpart(a);return b}}]);return h}(n.e),l=h([c.i(n.f)("DisjointUint64Sets")],l),u=new d.a,p=new d.a;c.i(n.d)("DisjointUint64Sets.add",function(a){var b=
this.get(a.id);u.low=a.al;u.high=a.ah;p.low=a.bl;p.high=a.bh;b.disjointSets.link(u,p)&&b.changed.dispatch()});c.i(n.d)("DisjointUint64Sets.clear",function(a){a=this.get(a.id);a.disjointSets.clear()&&a.changed.dispatch()})},function(n,h,c){c.d(h,"a",function(){return e});var m=function(){function a(a,d){for(var b=0;b<d.length;b++){var c=d[b];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,c,e){c&&a(b.prototype,c);e&&a(b,
e);return b}}();h.c="single_mesh/SingleMeshLayer";h.b="single_mesh/SingleMeshSource";h.e="single_mesh/getSingleMeshInfo";h.d="";var e=function(){function a(){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");}m(a,null,[{key:"stringify",value:function(a){return"single_mesh:"+JSON.stringify(a)}}]);return a}();e.RPC_ID="single_mesh/SingleMeshSource"},function(n,h,c){function m(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function e(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function a(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function b(){return new t.b([],function(a){return c.i(y.k)(a,
y.e)})}function d(a){return c.i(z.c)(a.dataType,a.numComponents)}function f(a){return a.map(function(a){return c.i(F.b)(new F.c,a.dataType,a.numComponents)})}function g(a,b){return a.memoize.getUncounted({type:"single_mesh:getMeshInfo",parameters:b},function(){return a.rpc.promiseInvoke(v.e,{chunkManager:a.addCounterpartRef(),parameters:b})})}var l=c(16);n=c(25);var u=c(34),p=c(26),r=c(64),k=c(65),v=c(116),t=c(15),B=c(29),x=c(1),y=c(2),C=c(23),A=c(30),D=c(72),F=c(45),G=c(18),z=c(6),L=c(7);c.d(h,"a",
function(){return V});h.e=d;c.d(h,"c",function(){return O});h.b=function(a,b){return g(a,b).then(function(d){return a.getChunkSource(H,c.i(y.f)([b,d]),function(){return new H(a,b,d)})})};var J=function pa(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return pa(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},I=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=
b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),E=this&&this.__decorate||function(a,b,c,d){var e=arguments.length,f=3>e?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d,g;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)f=Reflect.decorate(a,b,c,d);else for(var k=a.length-1;0<=k;k--)if(g=a[k])f=(3>e?g(f):3<e?g(b,c,f):g(b,c))||f;return 3<e&&f&&Object.defineProperty(b,
c,f),f};h.d="//NEUROGLANCER_SINGLE_MESH_LAYER_FRAGMENT_MAIN_START";var U=c(50),V=function za(){a(this,za);this.shaderError=c.i(A.a)();var d=void 0;this.fragmentMain=new t.b(void 0===d?"void main() {\n  emitGray();\n}\n":d,y.h);this.attributeNames=b();this.objectToDataTransform=new u.a};$jscomp.initSymbol();var R=Symbol("SingleMeshShaderManager.vertexAttributeTextureUnit"),P=c.i(F.b)(new F.c,B.b.FLOAT32,3),T=function(){function b(d,c,e){a(this,b);this.attributeNames=d;this.attributeInfo=c;this.fragmentMain=
e;this.tempLightVec=new Float32Array(4);this.tempPickID=new Float32Array(4);this.textureAccessHelper=new F.d("vertexData");this.indexBufferHelper=new D.d("VertexIndex")}I(b,[{key:"defineAttributeAccess",value:function(a,b){var c=this.textureAccessHelper;c.defineShader(a);a.addVertexCode(c.getAccessor("readVertexPosition","uVertexAttributeSampler[0]",B.b.FLOAT32,3));a.addVertexCode(c.getAccessor("readVertexNormal","uVertexAttributeSampler[1]",B.b.FLOAT32,3));var e=2,f="\nvec3 vertexPosition = readVertexPosition("+
b+");\nvec3 vertexNormal = readVertexNormal("+b+");\n",g=this.attributeNames;this.attributeInfo.forEach(function(k,h){if(void 0!==g[h]){var l=d(k);a.addVarying("highp "+l,"vCustom"+h);a.addFragmentCode("\n#define "+g[h]+" vCustom"+h+"\n");a.addVertexCode(c.getAccessor("readAttribute"+h,"uVertexAttributeSampler["+e+"]",k.dataType,k.numComponents));f+="vCustom"+h+" = readAttribute"+h+"("+b+");\n";e+=1}});a.addTextureSampler2D("uVertexAttributeSampler",R,e);a.addVertexMain(f)}},{key:"defineShader",value:function(a){a.require(D.b);
this.indexBufferHelper.defineShader(a);a.addVarying("highp float","vLightingFactor");a.addUniform("highp vec4","uLightDirection");a.addUniform("highp vec4","uColor");a.addUniform("highp mat4","uModelMatrix");a.addUniform("highp mat4","uProjection");a.addUniform("highp vec4","uPickID");a.addVarying("highp vec4","vPickID");a.addVertexCode(z.l);a.addVertexCode(z.n);a.addVertexMain("\nfloat vertexIndex = getVertexIndex();\nuint32_t triangleIndex;\ndivmod(getPrimitiveIndex(), 3.0, triangleIndex);\nuint32_t pickID; pickID.value = uPickID;\nvPickID = add(pickID, triangleIndex).value;\n");
a.addFragmentCode("\nvoid emitPremultipliedRGBA(vec4 color) {\n  emit(vec4(color.rgb * vLightingFactor, color.a), vPickID);\n}\nvoid emitRGBA(vec4 color) {\n  color = clamp(color, 0.0, 1.0);\n  color.xyz *= color.a;\n  emitPremultipliedRGBA(color);\n}\nvoid emitRGB(vec3 color) {\n  emitRGBA(vec4(color, 1.0));\n}\nvoid emitGray() {\n  emitRGB(vec3(1.0, 1.0, 1.0));\n}\n");a.addFragmentCode(U);this.defineAttributeAccess(a,"vertexIndex");a.addVertexMain("\ngl_Position = uProjection * (uModelMatrix * vec4(vertexPosition, 1.0));\nvec3 normal = normalize((uModelMatrix * vec4(vertexNormal, 0.0)).xyz);\nvLightingFactor = abs(dot(normal, uLightDirection.xyz)) + uLightDirection.w;\n");
a.setFragmentMainFunction("//NEUROGLANCER_SINGLE_MESH_LAYER_FRAGMENT_MAIN_START\n"+this.fragmentMain)}},{key:"beginLayer",value:function(a,b,c){var d=c.dataToDevice,e=c.lightDirection,f=c.ambientLighting;c=c.directionalLighting;a.uniformMatrix4fv(b.uniform("uProjection"),!1,d);d=this.tempLightVec;x.a.scale(d,e,c);d[3]=f;a.uniform4fv(b.uniform("uLightDirection"),d)}},{key:"setPickID",value:function(a,b,d){a.uniform4fv(b.uniform("uPickID"),c.i(z.m)(this.tempPickID,d))}},{key:"beginObject",value:function(a,
b,c){a.uniformMatrix4fv(b.uniform("uModelMatrix"),!1,c)}},{key:"getShader",value:function(a,b){var d=this,e={attributeNames:this.attributeNames,attributeInfo:this.attributeInfo,fragmentMain:this.fragmentMain};return a.memoize.get("single_mesh/SingleMeshShaderManager:"+c.i(C.a)(b)+":"+c.i(y.f)(e),function(){var c=new G.a(a);c.require(b);d.defineShader(c);return c.build()})}},{key:"bindVertexData",value:function(a,b,c){this.textureAccessHelper.setupTextureLayout(a,b,c);var d=b.textureUnit(R)+a.TEXTURE0,
e=function(b){a.activeTexture(d++);a.bindTexture(a.TEXTURE_2D,b)};e(c.vertexTexture);e(c.normalTexture);var f=this.attributeNames;c.vertexAttributeTextures.forEach(function(a,b){void 0!==f[b]&&e(a)})}},{key:"disableVertexData",value:function(a,b){for(var c=2,d=this.attributeInfo.length,e=this.attributeNames,f=0;f<d;++f)void 0!==e[f]&&++c;b=b.textureUnit(R)+a.TEXTURE0;for(d=0;d<c;++d)a.activeTexture(b++),a.bindTexture(a.TEXTURE_2D,null)}},{key:"drawFragment",value:function(a,b,c,d){d.ensure(c.numIndices).bind(b);
this.bindVertexData(a,b,c.vertexData);this.indexBufferHelper.bind(c.indexBuffer,b);a.drawArrays(a.TRIANGLES,0,c.numIndices)}},{key:"endLayer",value:function(a,b){c.i(D.c)(a,b);this.indexBufferHelper.disable(b);this.disableVertexData(a,b)}}]);return b}(),ca=function(){function b(){a(this,b)}I(b,[{key:"copyToGPU",value:function(a,b){var d=this,e=this.vertexPositions.length/3;c.i(F.a)(this,a,1,e);var f=function(b,e){var f=a.createTexture();a.bindTexture(a.TEXTURE_2D,f);c.i(F.e)(a,d,e,b);return f};this.vertexTexture=
f(this.vertexPositions,P);this.normalTexture=f(this.vertexNormals,P);this.vertexAttributeTextures=this.vertexAttributes.map(function(a,c){return f(a,b[c])});a.bindTexture(a.TEXTURE_2D,null)}},{key:"freeGPUMemory",value:function(a){a.deleteTexture(this.vertexTexture);a.deleteTexture(this.normalTexture);for(var b=this.vertexAttributeTextures,c=$jscomp.makeIterator(b),d=c.next();!d.done;d=c.next())a.deleteTexture(d.value);b.length=0}}]);return b}(),ga=function(b){function d(b,c){a(this,d);b=m(this,(d.__proto__||
Object.getPrototypeOf(d)).call(this,b));var e=b.vertexData=new ca;e.vertexPositions=c.vertexPositions;e.vertexNormals=c.vertexNormals;e.vertexAttributes=c.vertexAttributes;c=b.indices=c.indices;b.numIndices=c.length;return b}e(d,b);I(d,[{key:"copyToGPU",value:function(a){J(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"copyToGPU",this).call(this,a);this.vertexData.copyToGPU(a,this.source.attributeTextureFormats);this.indexBuffer=c.i(D.e)(a,this.indices)}},{key:"freeGPUMemory",value:function(a){J(d.prototype.__proto__||
Object.getPrototypeOf(d.prototype),"freeGPUMemory",this).call(this,a);this.vertexData.freeGPUMemory(a);this.indexBuffer.dispose()}}]);return d}(n.d),H=function(b){function c(b,d,e){a(this,c);b=m(this,(c.__proto__||Object.getPrototypeOf(c)).call(this,b));b.parameters=d;b.info=e;b.attributeTextureFormats=f(b.info.vertexAttributes);if(void 0===e)throw Error("Should not be undefined");return b}e(c,b);I(c,[{key:"initializeCounterpart",value:function(a,b){b.parameters=this.parameters;b.info=this.info;J(c.prototype.__proto__||
Object.getPrototypeOf(c.prototype),"initializeCounterpart",this).call(this,a,b)}},{key:"getChunk",value:function(a){return new ga(this,a)}},{key:"toString",value:function(){return v.a.stringify(this.parameters)}}]);return c}(n.c),H=E([c.i(L.c)(v.b)],H),O=function(b){function d(b,e){a(this,d);var f=m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));f.source=b;f.displayState=e;f.shaders=new Map;f.fallbackFragmentMain="void main() {\n  emitGray();\n}\n";f.countingBuffer=f.registerDisposer(c.i(D.a)(f.gl));
f.displayState.shaderError.value=void 0;var g=function(){f.shaderManager=void 0;f.displayState.shaderError.value=void 0;f.disposeShaders();f.redrawNeeded.dispatch()};f.registerDisposer(e.fragmentMain.changed.add(g));f.registerDisposer(e.attributeNames.changed.add(g));f.registerDisposer(e.objectToDataTransform.changed.add(function(){f.redrawNeeded.dispatch()}));f.displayState.shaderError.value=void 0;e=f.sharedObject=f.registerDisposer(new r.a(f.visibilityCount));e.RPC_TYPE_ID=v.c;e.initializeCounterpart(b.chunkManager.rpc,
{chunkManager:b.chunkManager.rpcId,source:b.addCounterpartRef()});c.i(k.a)(e);f.setReady(!0);return f}e(d,b);I(d,[{key:"disposeShaders",value:function(){for(var a=this.shaders,b=$jscomp.makeIterator(a.values()),c=b.next();!c.done;c=b.next())c=c.value,null!==c&&c.dispose();a.clear()}},{key:"disposed",value:function(){this.disposeShaders();J(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"disposed",this).call(this)}},{key:"makeShaderManager",value:function(a){a=void 0===a?this.displayState.fragmentMain.value:
a;return new T(this.displayState.attributeNames.value,this.source.info.vertexAttributes,a)}},{key:"getShader",value:function(a){var b=this.shaders,c=b.get(a);if(void 0===c){var c=null,d=this.shaderManager;void 0===d&&(d=this.shaderManager=this.makeShaderManager());var e=this.displayState.fragmentMain.value;try{c=d.getShader(this.gl,a),this.fallbackFragmentMain=e,this.displayState.shaderError.value=null}catch(Ga){if(this.displayState.shaderError.value=Ga,d=this.fallbackFragmentMain,d!==e){d=this.shaderManager=
this.makeShaderManager(d);try{c=d.getShader(this.gl,a)}catch(Ba){}}}b.set(a,c)}return c}},{key:"draw",value:function(a){if(a.emitColor||!a.alreadyEmittedPickID){var b=this.source.chunks.get(v.d);if(void 0!==b&&b.state===l.b.GPU_MEMORY){var c=this.getShader(a.emitter);if(null!==c){var d=this.gl,e=this.shaderManager;c.bind();e.beginLayer(d,c,a);var f=a.pickIDs;e.beginObject(d,c,this.displayState.objectToDataTransform.transform);a.emitPickID&&e.setPickID(d,c,f.register(this,b.numIndices/3));e.drawFragment(d,
c,b,this.countingBuffer);e.endLayer(d,c)}}}}},{key:"drawPicking",value:function(a){this.draw(a)}},{key:"transformPickedValue",value:function(a,b){a=this.source.chunks.get(v.d);if(void 0!==a){b*=3;var c=a.indices;if(!(b>=c.length)){var d=c[b],e=[],f=this.displayState.attributeNames.value;a.vertexData.vertexAttributes.forEach(function(a,b){b=f[b];void 0!==b&&e.push(b+"="+a[d].toPrecision(6))});return e.join(", ")}}}},{key:"isTransparent",get:function(){return null!==this.displayState.fragmentMain.value.match(/emitRGBA|emitPremultipliedRGBA/)}},
{key:"gl",get:function(){return this.source.gl}}]);return d}(p.a)},function(n,h,c){h.a="skeleton/SkeletonLayer"},function(n,h,c){c(126);c(121)},function(n,h,c){var m=c(1);c.d(h,"a",function(){return a});var e=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,e){c&&a(b.prototype,c);e&&a(b,e);return b}}(),a=function(){function a(b,c){c=void 0===c?m.g:c;if(!(this instanceof
a))throw new TypeError("Cannot call a class as a function");this.size=m.a.clone(b);this.transform=m.b.clone(c);this.invTransform=m.b.invert(m.b.create(),c)}e(a,[{key:"toObject",value:function(a){a.size=this.size;a.transform=this.transform}},{key:"localSpatialToGlobal",value:function(a,b){return m.a.transformMat4(a,b,this.transform)}},{key:"globalToLocalSpatial",value:function(a,b){return m.a.transformMat4(a,b,this.invTransform)}},{key:"globalToLocalGrid",value:function(a,b){this.globalToLocalSpatial(a,
b);m.a.divide(a,a,this.size);return a}},{key:"localSpatialVectorToGlobal",value:function(a,b){return c.i(m.e)(a,b,this.transform)}},{key:"globalToLocalSpatialVector",value:function(a,b){return c.i(m.e)(a,b,this.invTransform)}},{key:"assignLocalSpatialToGlobalMat4",value:function(a){return m.b.copy(a,this.transform)}}],[{key:"get",value:function(b,c){c=void 0===c?m.g:c;var d=a.cache,e=JSON.stringify([Array.from(b),Array.from(c)]),f=d.get(e);void 0===f&&(f=new a(b,c),d.set(e,f));return f}},{key:"fromObject",
value:function(b){return a.get(b.size,b.transform)}}]);return a}();a.cache=new Map},function(n,h,c){function m(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function e(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function a(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=
Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var b=c(4),d=c(122),f=c(123);n=c(5);h=c(67);var g=c(0),l=c(1),u=c(11),p=c(45),r=c(6),k=function D(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return D(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},v=function(){function a(a,
b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),t=function(b){function d(a,b,f,g){m(this,d);var k=e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));k.chunkDataSize=b;k.subchunkSize=f;c.i(p.a)(k,a,1,g);a=k.subchunkGridSize=l.a.create();for(g=0;3>g;++g)a[g]=Math.ceil(b[g]/f[g]);return k}a(d,b);v(d,null,[{key:"get",value:function(a,
b,e,f){return a.memoize.get("sliceview.CompressedSegmentationTextureLayout:"+c.i(l.o)(b)+","+c.i(l.o)(e)+","+f,function(){return new d(a,b,e,f)})}}]);return d}(g.a),B=c.i(p.b)(new p.c,b.b.UINT32),x=function(d){function f(a,b,c,d){m(this,f);d=e(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,d));d.dataType=a;d.subchunkSize=b;d.numChannels=c;d.textureAccessHelper=new p.d("chunkData");return d}a(f,d);v(f,[{key:"defineShader",value:function(a){k(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),
"defineShader",this).call(this,a);var d=this.textureAccessHelper;d.defineShader(a);var e=function(a){return"compressedSegmentationChunkFormat_"+a};a.addUniform("highp vec3","uSubchunkGridSize");a.addUniform("highp vec3","uSubchunkSize");a.addFragmentCode(r.d);var g=this.dataType,h=c.i(r.c)(g);g===b.b.UINT64&&a.addFragmentCode(r.e);a.addFragmentCode(d.getAccessor(e("readTextureValue"),"uVolumeChunkSampler",b.b.UINT32));a.addFragmentCode(r.f);a.addFragmentCode(r.g);d="\nfloat "+e("getChannelOffset")+
"(int channelIndex) {\n  if (channelIndex == 0) {\n    return "+this.numChannels+".0;\n  }\n  vec4 v = "+e("readTextureValue")+"(float(channelIndex)).value;\n  return uintleToFloat(v.xyz);\n}\n"+h+" getDataValue (int channelIndex) {\n  vec3 chunkPosition = getPositionWithinChunk();\n\n  // TODO: maybe premultiply this and store as uniform.\n  vec3 subchunkGridPosition = floor(chunkPosition / uSubchunkSize);\n  float subchunkGridOffset = getFortranOrderIndex(subchunkGridPosition, uSubchunkGridSize);\n\n  float channelOffset = "+
e("getChannelOffset")+"(channelIndex);\n\n  // TODO: Maybe just combine this offset into subchunkGridStrides.\n  float subchunkHeaderOffset = subchunkGridOffset * 2.0 + channelOffset;\n\n  vec4 subchunkHeader0 = "+e("readTextureValue")+"(subchunkHeaderOffset).value;\n  vec4 subchunkHeader1 = "+e("readTextureValue")+"(subchunkHeaderOffset + 1.0).value;\n\n  float outputValueOffset = uintleToFloat(subchunkHeader0.xyz) + channelOffset;\n  float encodingBits = unnormalizeUint8(subchunkHeader0[3]);\n  if (encodingBits > 0.0) {\n    vec3 subchunkPosition = floor(min(chunkPosition - subchunkGridPosition * uSubchunkSize, uSubchunkSize - 1.0));\n    float subchunkOffset = getFortranOrderIndex(subchunkPosition, uSubchunkSize);\n    highp float encodedValueBaseOffset = uintleToFloat(subchunkHeader1.xyz) + channelOffset;\n    highp float encodedValueOffset = floor(encodedValueBaseOffset + subchunkOffset * encodingBits / 32.0);\n    vec4 encodedValue = "+
e("readTextureValue")+"(encodedValueOffset).value;\n    float wordOffset = mod(subchunkOffset * encodingBits, 32.0);\n    // If the value is in the first byte, then 0 <= wordOffset < 8.\n    // We need to mod by 2**encodedBits\n    float wordShifter = pow(2.0, -wordOffset);\n    float encodedValueMod = pow(2.0, encodingBits);\n    float encodedValueShifted;\n    if (wordOffset < 16.0) {\n      encodedValueShifted = dot(unnormalizeUint8(encodedValue.xy), vec2(1.0, 256.0));\n    } else {\n      encodedValueShifted = dot(unnormalizeUint8(encodedValue.zw), vec2(256.0 * 256.0, 256.0 * 256.0 * 256.0));\n    }\n    encodedValueShifted = floor(encodedValueShifted * wordShifter);\n    float decodedValue = mod(encodedValueShifted, encodedValueMod);\n    outputValueOffset += decodedValue * "+
(this.dataType===b.b.UINT64?"2.0":"1.0")+";\n  }\n  "+h+" result;\n";d=g===b.b.UINT64?d+("\n  result.low = "+e("readTextureValue")+"(outputValueOffset).value;\n  result.high = "+e("readTextureValue")+"(outputValueOffset+1.0).value;\n"):d+("\n  result.value = "+e("readTextureValue")+"(outputValueOffset).value;\n");a.addFragmentCode(d+"\n  return result;\n}\n")}},{key:"setupTextureLayout",value:function(a,b,c){a.uniform3fv(b.uniform("uSubchunkGridSize"),c.subchunkGridSize);this.textureAccessHelper.setupTextureLayout(a,
b,c)}},{key:"setTextureData",value:function(a,b,d){c.i(p.e)(a,b,B,d)}},{key:"getTextureLayout",value:function(a,b,c){return t.get(a,b,this.subchunkSize,c)}},{key:"beginSource",value:function(a,b){k(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"beginSource",this).call(this,a,b);a.uniform3fv(b.uniform("uSubchunkSize"),this.subchunkSize)}}],[{key:"get",value:function(a,b,d,e){var g="sliceview.CompressedSegmentationChunkFormat:"+b+":"+e,k=g+":"+c.i(l.o)(d);return a.memoize.get(k,function(){return new f(b,
d,e,g)})}}]);return f}(h.a),y=function(g){function k(){m(this,k);return e(this,(k.__proto__||Object.getPrototypeOf(k)).apply(this,arguments))}a(k,g);v(k,[{key:"setTextureData",value:function(a){var b=this.data,c=this.chunkFormat,d=this.textureLayout=c.getTextureLayout(a,this.chunkDataSize,b.length);c.setTextureData(a,d,b)}},{key:"getChannelValueAt",value:function(a,e){var g=this.chunkDataSize,k=this.chunkFormat,h=this.data;e=h[e];if(k.dataType===b.b.UINT64){var l=new u.a;c.i(f.a)(l,h,e,g,k.subchunkSize,
a);return l}return c.i(d.a)(h,e,g,k.subchunkSize,a)}}]);return k}(h.b),C=function(c){function d(a,c){m(this,d);var f=e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this)),g=c.dataType;if(g!==b.b.UINT64&&g!==b.b.UINT32)throw Error("Unsupported compressed segmentation data type: "+b.b[g]);f.chunkFormat=f.registerDisposer(x.get(a,c.dataType,c.compressedSegmentationBlockSize,c.numChannels));return f}a(d,c);v(d,[{key:"getChunk",value:function(a,b){return new y(a,b)}}]);return d}(g.a);c.i(n.c)(function(a,
b){return null!=b.compressedSegmentationBlockSize?new C(a,b):null})},function(n,h,c){var m=c(66);h.a=function(e,a,b,d,f){a=c.i(m.a)(e,a,b,d,f,1)+a;return e[a]}},function(n,h,c){var m=c(66);h.a=function(e,a,b,d,f,g){b=c.i(m.a)(a,b,d,f,g,2)+b;e.low=a[b];e.high=a[b+1];return e}},function(n,h,c){function m(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function e(a,b){if("function"!==typeof b&&null!==
b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function a(a){a=void 0===a?"void main() {\n  emitGrayscale(toNormalized(getDataValue()));\n}\n":a;return c.i(d.b)(a)}n=c(39);var b=c(40),d=c(30);h.a=a;c.d(h,"b",function(){return u});var f=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=
b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),g=function r(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return r(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};h.c="//NEUROGLANCER_IMAGE_RENDERLAYER_FRAGMENT_MAIN_START";var l=c(50),u=
function(h){function k(e,f){var g=void 0===f?{}:f;f=void 0===g.opacity?c.i(b.a)(.5):g.opacity;var h=void 0===g.fragmentMain?a():g.fragmentMain,l=void 0===g.shaderError?c.i(d.a)():g.shaderError,g=void 0===g.volumeSourceOptions?{}:g.volumeSourceOptions;if(!(this instanceof k))throw new TypeError("Cannot call a class as a function");var r=m(this,(k.__proto__||Object.getPrototypeOf(k)).call(this,e,{shaderError:l,volumeSourceOptions:g}));r.fragmentMain=h;r.opacity=f;r.registerDisposer(f.changed.add(function(){r.redrawNeeded.dispatch()}));
r.registerDisposer(h.changed.add(function(){r.shaderUpdated=!0;r.redrawNeeded.dispatch()}));return r}e(k,h);f(k,[{key:"getShaderKey",value:function(){return"sliceview.ImageRenderLayer:"+JSON.stringify(this.fragmentMain.value)}},{key:"defineShader",value:function(a){g(k.prototype.__proto__||Object.getPrototypeOf(k.prototype),"defineShader",this).call(this,a);a.addUniform("highp float","uOpacity");a.addFragmentCode("\nvoid emitRGBA(vec4 rgba) {\n  emit(vec4(rgba.rgb, rgba.a * uOpacity));\n}\nvoid emitRGB(vec3 rgb) {\n  emit(vec4(rgb, uOpacity));\n}\nvoid emitGrayscale(float value) {\n  emit(vec4(value, value, value, uOpacity));\n}\nvoid emitTransparent() {\n  emit(vec4(0.0, 0.0, 0.0, 0.0));\n}\n");
a.addFragmentCode(l);a.setFragmentMainFunction("//NEUROGLANCER_IMAGE_RENDERLAYER_FRAGMENT_MAIN_START\n"+this.fragmentMain.value)}},{key:"beginSlice",value:function(a){a=g(k.prototype.__proto__||Object.getPrototypeOf(k.prototype),"beginSlice",this).call(this,a);this.gl.uniform1f(a.uniform("uOpacity"),this.opacity.value);return a}}]);return k}(n.a)},function(n,h,c){function m(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&
"function"!==typeof b?a:b}function e(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function a(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}var b=c(36),d=c(57),f=c(63),g=c(32);n=c(39);var l=c(6);c.d(h,"a",
function(){return v});var u=function B(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return B(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},p=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,
d);return b}}(),r=new Float32Array(8),k=function(){function c(d){a(this,c);this.disjointSets=d;this.generation=Number.NaN;this.hashMap=new b.a}p(c,[{key:"update",value:function(){var a=this.disjointSets,b=a.generation;if(this.generation!==b){this.generation=b;b=this.hashMap;b.clear();for(var a=$jscomp.makeIterator(a.mappings()),c=a.next();!c.done;c=a.next()){var d=$jscomp.makeIterator(c.value),c=d.next().value,d=d.next().value;b.set(c,d)}}}}]);return c}(),v=function(b){function h(b,e){a(this,h);var l=
m(this,(h.__proto__||Object.getPrototypeOf(h)).call(this,b,{volumeSourceOptions:e.volumeSourceOptions}));l.displayState=e;l.segmentColorShaderManager=new f.b("segmentColorHash");l.hashTableManager=new d.a("visibleSegments");l.gpuHashTable=d.b.get(l.gl,l.displayState.visibleSegments.hashTable);l.equivalencesShaderManager=new d.c("equivalences");l.equivalencesHashMap=new k(l.displayState.segmentEquivalences.disjointSets);l.gpuEquivalencesHashTable=d.b.get(l.gl,l.equivalencesHashMap.hashMap);c.i(g.g)(e,
l);l.registerDisposer(e.selectedAlpha.changed.add(function(){l.redrawNeeded.dispatch()}));l.registerDisposer(e.hideSegmentZero.changed.add(function(){l.redrawNeeded.dispatch();l.shaderUpdated=!0}));l.hasEquivalences=0!==l.displayState.segmentEquivalences.size;e.segmentEquivalences.changed.add(function(){var a=0!==l.displayState.segmentEquivalences.size;a!==l.hasEquivalences&&(l.hasEquivalences=a,l.shaderUpdated=!0)});l.registerDisposer(e.notSelectedAlpha.changed.add(function(){l.redrawNeeded.dispatch()}));
return l}e(h,b);p(h,[{key:"getShaderKey",value:function(){return"sliceview.SegmentationRenderLayer/"+this.hasEquivalences+"/"+this.displayState.hideSegmentZero.value}},{key:"defineShader",value:function(a){u(h.prototype.__proto__||Object.getPrototypeOf(h.prototype),"defineShader",this).call(this,a);this.hashTableManager.defineShader(a);a.addFragmentCode("\nuint64_t getUint64DataValue() {\n  return toUint64(getDataValue());\n}\n");this.hasEquivalences?(this.equivalencesShaderManager.defineShader(a),
a.addFragmentCode("\nuint64_t getMappedObjectId() {\n  uint64_t value = getUint64DataValue();\n  uint64_t mappedValue;\n  if ("+this.equivalencesShaderManager.getFunctionName+"(value, mappedValue)) {\n    return mappedValue;\n  }\n  return value;\n}\n")):a.addFragmentCode("\nuint64_t getMappedObjectId() {\n  return getUint64DataValue();\n}\n");this.segmentColorShaderManager.defineShader(a);a.addUniform("highp vec4","uSelectedSegment",2);a.addUniform("highp float","uShowAllSegments");a.addUniform("highp float",
"uSelectedAlpha");a.addUniform("highp float","uNotSelectedAlpha");a.addFragmentCode(l.f);var b="\n  uint64_t value = getMappedObjectId();\n  \n  float alpha = uSelectedAlpha;\n  float saturation = 1.0;\n";this.displayState.hideSegmentZero.value&&(b+="\n  if (value.low == vec4(0,0,0,0) && value.high == vec4(0,0,0,0)) {\n    emit(vec4(vec4(0, 0, 0, 0)));\n    return;\n  }\n");b+="\n  bool has = uShowAllSegments > 0.0 ? true : "+this.hashTableManager.hasFunctionName+"(value);\n  if (uSelectedSegment[0] == unnormalizeUint8(value.low) &&\n      uSelectedSegment[1] == unnormalizeUint8(value.high)) {\n    saturation = has ? 0.5 : 0.75;\n  } else if (!has) {\n    alpha = uNotSelectedAlpha;\n  }\n  vec3 rgb = segmentColorHash(value);\n  emit(vec4(mix(vec3(1.0,1.0,1.0), rgb, saturation), alpha));\n";
a.setFragmentMain(b)}},{key:"beginSlice",value:function(a){a=u(h.prototype.__proto__||Object.getPrototypeOf(h.prototype),"beginSlice",this).call(this,a);var b=this.gl,c=this.displayState,d=this.displayState,e=d.segmentSelectionState,d=d.visibleSegments;if(e.hasSelectedSegment)for(var f=e.selectedSegment,e=f.low,f=f.high,g=0;4>g;++g)r[g]=e>>8*g&255,r[4+g]=f>>8*g&255;else r.fill(0);b.uniform1f(a.uniform("uSelectedAlpha"),this.displayState.selectedAlpha.value);b.uniform1f(a.uniform("uNotSelectedAlpha"),
this.displayState.notSelectedAlpha.value);b.uniform4fv(a.uniform("uSelectedSegment"),r);b.uniform1f(a.uniform("uShowAllSegments"),d.hashTable.size?0:1);this.hashTableManager.enable(b,a,this.gpuHashTable);this.hasEquivalences&&(this.equivalencesHashMap.update(),this.equivalencesShaderManager.enable(b,a,this.gpuEquivalencesHashTable));this.segmentColorShaderManager.enable(b,a,c.segmentColorHash);return a}},{key:"endSlice",value:function(a){this.hashTableManager.disable(this.gl,a);u(h.prototype.__proto__||
Object.getPrototypeOf(h.prototype),"endSlice",this).call(this,a)}}]);return h}(n.a)},function(n,h,c){function m(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function e(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function a(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);
a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var b=c(4);n=c(5);h=c(67);var d=c(0),f=c(1),g=c(11),l=c(45),u=c(6),p=function y(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return y(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},r=function(){function a(a,
b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),k=function(b){function d(a,b,f,g){m(this,d);var k=e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));k.chunkDataSize=b;k.channelStride=b[0]*b[1]*b[2];c.i(l.f)(k,a,f,b[0],b[1],b[2]*g);return k}a(d,b);r(d,null,[{key:"get",value:function(a,b,e,g){return a.memoize.get("sliceview.UncompressedTextureLayout:"+
c.i(f.o)(b)+","+e+","+g,function(){return new d(a,b,e,g)})}}]);return d}(d.a),v=function(b){function d(a,b,f,g){m(this,d);a=e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,g));a.dataType=b;a.numChannels=f;c.i(l.b)(a,b);a.textureAccessHelper=new l.d("chunkData");return a}a(d,b);r(d,[{key:"defineShader",value:function(a){p(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"defineShader",this).call(this,a);var b=this.textureAccessHelper;b.defineShader(a);a.addFragmentCode(b.getAccessor("readVolumeData",
"uVolumeChunkSampler",this.dataType));1<this.numChannels?(a.addUniform("highp float","uChannelStride"),a.addFragmentCode("\nfloat getChannelOffset(int channelIndex) {\n  return float(channelIndex) * uChannelStride;\n}\n")):a.addFragmentCode("float getChannelOffset(int channelIndex) { return 0.0; }");a.addFragmentCode("\nfloat getIndexIntoChunk (int channelIndex) {\n  vec3 chunkDataPosition = getPositionWithinChunk();\n  return chunkDataPosition.x + uChunkDataSize.x * (chunkDataPosition.y + uChunkDataSize.y * chunkDataPosition.z) + getChannelOffset(channelIndex);\n}\n");
b=c.i(u.c)(this.dataType);a.addFragmentCode("\n"+b+" getDataValue (int channelIndex) {\n  return readVolumeData(getIndexIntoChunk(channelIndex));\n}\n")}},{key:"setupTextureLayout",value:function(a,b,d){1<this.numChannels&&a.uniform1f(b.uniform("uChannelStride"),d.channelStride);this.textureAccessHelper.setupTextureLayout(a,b,d)}},{key:"getTextureLayout",value:function(a,b){return k.get(a,b,this.texelsPerElement,this.numChannels)}},{key:"setTextureData",value:function(a,b,d){c.i(l.e)(a,b,this,d)}}],
[{key:"get",value:function(a,b,c){var e="sliceview.UncompressedChunkFormat:"+b+":"+c;return a.memoize.get(e,function(){return new d(a,b,c,e)})}}]);return d}(h.a),t=function(d){function c(){m(this,c);return e(this,(c.__proto__||Object.getPrototypeOf(c)).apply(this,arguments))}a(c,d);r(c,[{key:"setTextureData",value:function(a){var b=this.source,d=b.chunkFormatHandler,c=d.chunkFormat,e;this.textureLayout=this.chunkDataSize===b.spec.chunkDataSize?e=d.textureLayout.addRef():e=c.getTextureLayout(a,this.chunkDataSize);
this.chunkFormat.setTextureData(a,e,this.data)}},{key:"getChannelValueAt",value:function(a,d){var c=this.chunkDataSize;d=a[0]+c[0]*(a[1]+c[1]*(a[2]+c[2]*d));c=this.chunkFormat.dataType;a=this.data;switch(c){case b.b.UINT8:case b.b.FLOAT32:case b.b.UINT16:case b.b.UINT32:return a[d];case b.b.UINT64:return d*=2,new g.a(a[d],a[d+1])}throw Error("Invalid data type: "+c);}}]);return c}(h.b),B=function(b){function d(a,b){m(this,d);var c=e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));c.chunkFormat=
c.registerDisposer(v.get(a,b.dataType,b.numChannels));c.textureLayout=c.registerDisposer(c.chunkFormat.getTextureLayout(a,b.chunkDataSize));return c}a(d,b);r(d,[{key:"getChunk",value:function(a,b){return new t(a,b)}}]);return d}(d.a);c.i(n.c)(function(a,b){return null==b.compressedSegmentationBlockSize?new B(a,b):null})},function(n,h,c){var m=c(131),e=c(1),a=c(42);h.a=function(b){document.addEventListener("copy",function(d){if(!c.i(m.a)(d)){var e=c.i(a.a)(b.state).value;d.clipboardData.setData("text/plain",
JSON.stringify(e,void 0,"  "));d.preventDefault()}})};h.b=function(a){document.addEventListener("paste",function(b){if(!c.i(m.a)(b)){var d;d=b.clipboardData.getData("text/plain").match(/^[\[\]{}()\s,]*(\d+(?:\.\d+)?)[,\s]+(\d+(?:\.\d+)?)[,\s]+(\d+(?:\.\d+)?)[\[\]{}()\s,]*$/);d=null!==d?e.a.fromValues(parseFloat(d[1]),parseFloat(d[2]),parseFloat(d[3])):void 0;void 0!==d&&a.navigationState.position.setVoxelCoordinates(d);b.preventDefault()}})}},function(n,h,c){var m=c(107),e=c(108),a=c(127),b=c(129);
h.a=function(){var d=window.viewer=c.i(e.a)();c.i(m.a)(d.keyMap);(new b.a(d.state)).updateFromUrlHash();c.i(a.a)(d);c.i(a.b)(d);return d}},function(n,h,c){function m(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function e(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,
{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}n=c(0);var a=c(2),b=c(42),d=c(15),f=c(20),g=c.n(f);c.d(h,"a",function(){return u});var l=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),u=function(f){function h(a,b){b=void 0===
b?200:b;if(!(this instanceof h))throw new TypeError("Cannot call a class as a function");var c=m(this,(h.__proto__||Object.getPrototypeOf(h)).call(this));c.root=a;c.parseError=new d.a(void 0);c.registerEventListener(window,"hashchange",function(){return c.updateFromUrlHash()});var e=g()(function(){return c.setUrlHash()},b);c.registerDisposer(a.changed.add(e));c.registerDisposer(function(){return e.cancel()});return c}e(h,f);l(h,[{key:"setUrlHash",value:function(){var d=c.i(b.a)(this.root);d.generation!==
this.prevStateGeneration&&(this.prevStateGeneration=d.generation,d=c.i(a.b)(d.value),d!==this.prevStateString&&(this.prevStateString=d,"{}"===d?history.replaceState(null,"","#"):history.replaceState(null,"","#!"+d)))}},{key:"updateFromUrlHash",value:function(){try{var b=location.href.replace(/^[^#]+/,"");if(""===b||"#"===b||"#!"===b)b="#!{}";if(b.startsWith("#!+")){var b=b.slice(3),b=decodeURI(b),d=c.i(a.c)(b);c.i(a.a)(d);this.root.restoreState(d);this.prevStateString=void 0}else if(b.startsWith("#!")){b=
b.slice(2);b=decodeURI(b);if(b===this.prevStateString)return;this.prevStateString=b;this.root.reset();var e=c.i(a.c)(b);c.i(a.a)(e);this.root.restoreState(e)}else throw Error('URL hash is expected to be of the form "#!{...}" or "#!+{...}".');this.parseError.value=void 0}catch(B){this.parseError.value=B}}}]);return h}(n.a)},function(n,h,c){function m(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&
b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var e=c(36);n=c(7);var a=c(3);c.d(h,"a",function(){return f});var b=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),d=function u(a,b,d){null===a&&(a=Function.prototype);
var c=Object.getOwnPropertyDescriptor(a,b);if(void 0===c){if(a=Object.getPrototypeOf(a),null!==a)return u(a,b,d)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(d)}};h=this&&this.__decorate||function(a,b,d,c){var e=arguments.length,f=3>e?b:null===c?c=Object.getOwnPropertyDescriptor(b,d):c,g;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)f=Reflect.decorate(a,b,d,c);else for(var k=a.length-1;0<=k;k--)if(g=a[k])f=(3>e?g(f):3<e?g(b,d,f):g(b,d))||f;return 3<
e&&f&&Object.defineProperty(b,d,f),f};var f=g=function(c){function f(){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var b;b=(f.__proto__||Object.getPrototypeOf(f)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");b=!b||"object"!==typeof b&&"function"!==typeof b?this:b;b.hashTable=new e.c;b.changed=new a.b;return b}m(f,c);$jscomp.initSymbol();$jscomp.initSymbolIterator();b(f,[{key:"disposed",value:function(){d(f.prototype.__proto__||
Object.getPrototypeOf(f.prototype),"disposed",this).call(this);this.changed=this.hashTable=void 0}},{key:"add_",value:function(a){return this.hashTable.add(a)}},{key:"add",value:function(a){if(this.add_(a)){var b=this.rpc;b&&b.invoke("Uint64Set.add",{id:this.rpcId,value:a});this.changed.dispatch(a,!0)}}},{key:"has",value:function(a){return this.hashTable.has(a)}},{key:Symbol.iterator,value:function(){return this.hashTable.keys()}},{key:"delete_",value:function(a){return this.hashTable.delete(a)}},
{key:"delete",value:function(a){if(this.delete_(a)){var b=this.rpc;b&&b.invoke("Uint64Set.delete",{id:this.rpcId,value:a});this.changed.dispatch(a,!1)}}},{key:"clear",value:function(){if(this.hashTable.clear()){var a=this.rpc;a&&a.invoke("Uint64Set.clear",{id:this.rpcId});this.changed.dispatch(null,!1)}}},{key:"toJSON",value:function(){for(var a=[],b=$jscomp.makeIterator(this),d=b.next();!d.done;d=b.next())a.push(d.value.toString());return a}},{key:"size",get:function(){return this.hashTable.size}}],
[{key:"makeWithCounterpart",value:function(a){var b=new g;b.initializeCounterpart(a);return b}}]);return f}(n.e),f=g=h([c.i(n.f)("Uint64Set")],f);c.i(n.d)("Uint64Set.add",function(a){var b=this.get(a.id);b.add_(a.value)&&b.changed.dispatch()});c.i(n.d)("Uint64Set.delete",function(a){var b=this.get(a.id);b.delete_(a.value)&&b.changed.dispatch()});c.i(n.d)("Uint64Set.clear",function(a){a=this.get(a.id);a.hashTable.clear()&&a.changed.dispatch()});var g},function(n,h,c){h.a=function(c){if(!window.getSelection().isCollapsed)return!0;
c=c.target.tagName;return"TEXTAREA"===c||"INPUT"===c?!0:!1}},function(n,h,c){h.a=function(c,e,a,b){e*=6;var d=Math.floor(e),f=e-d;e=b*(1-a);var g=b*(1-a*f);a=b*(1-a*(1-f));switch(d%6){case 0:c[0]=b;c[1]=a;c[2]=e;break;case 1:c[0]=g;c[1]=b;c[2]=e;break;case 2:c[0]=e;c[1]=b;c[2]=a;break;case 3:c[0]=e;c[1]=g;c[2]=b;break;case 4:c[0]=a;c[1]=e;c[2]=b;break;case 5:c[0]=b,c[1]=e,c[2]=g}return c}},function(n,h,c){h.a=function(c,e){return c===e?!0:1E-6>Math.abs(c-e)/Math.min(Math.abs(c),Math.abs(e))}},function(n,
h,c){function m(a){for(var b=a,c=a[f];c!==a;)a=c,c=a[f];for(a=b[f];c!==a;)b[f]=c,b=a,a=b[f];return c}function e(a){function b(b,f){for(;;)switch(c){case 0:e=!0,d=a;case 1:if(!e&&d===a){c=3;break}c=4;return{value:d,done:!1};case 4:if(void 0===f){c=5;break}c=-1;throw f;case 5:d=d[g];case 2:e=!1;c=1;break;case 3:c=-1;default:return{value:void 0,done:!0}}}var c=0,d,e,f={next:function(a){return b(a,void 0)},throw:function(a){return b(void 0,a)},return:function(a){throw Error("Not yet implemented");}};
$jscomp.initSymbolIterator();f[Symbol.iterator]=function(){return this};return f}var a=c(11);c.d(h,"a",function(){return p});var b=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}();$jscomp.initSymbol();var d=Symbol("disjoint_sets:rank");$jscomp.initSymbol();var f=Symbol("disjoint_sets:parent");$jscomp.initSymbol();
var g=Symbol("disjoint_sets:next");$jscomp.initSymbol();var l=Symbol("disjoint_sets:prev");$jscomp.initSymbol();var u=Symbol("disjoint_sets:min"),p=function(){function c(){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");this.map=new Map;this.generation=0}$jscomp.initSymbol();$jscomp.initSymbolIterator();b(c,[{key:"get",value:function(a){var b=this.map.get(a.toString());return void 0===b?a:m(b)[u]}},{key:"isMinElement",value:function(b){var c=this.get(b);return c===
b||a.a.equal(c,b)}},{key:"makeSet",value:function(a){var b=a.toString(),c=this.map,e=c.get(b);return void 0===e?(a=e=a.clone(),a[f]=a,a[d]=0,a[g]=a[l]=a,e[u]=e,c.set(b,e),e):m(e)}},{key:"link",value:function(b,c){b=this.makeSet(b);c=this.makeSet(c);if(b===c)return!1;this.generation++;var e;e=b;var k=c,h=e[d],p=k[d];h>p?k[f]=e:(e[f]=k,h===p&&(k[d]=p+1),e=k);var k=b,h=c,p=k[l],r=h[l];h[l]=p;p[g]=h;k[l]=r;r[g]=k;b=b[u];c=c[u];e[u]=a.a.less(b,c)?b:c;return!0}},{key:"setElements",value:function(a){function b(b,
l){for(;;)switch(c){case 0:k=a.toString();g=h.map.get(k);if(void 0!==g){c=1;break}c=3;return{value:a,done:!1};case 3:if(void 0===l){c=4;break}c=-1;throw l;case 4:c=2;break;case 1:f=$jscomp.makeIterator(e(g));case 5:if((d=f.next(b)).done){c=6;break}c=7;return{value:d.value,done:!1};case 7:if(void 0===l){c=8;break}c=-1;throw l;case 8:c=5;break;case 6:case 2:c=-1;default:return{value:void 0,done:!0}}}var c=0,d,f,g,k,h=this,l={next:function(a){return b(a,void 0)},throw:function(a){return b(void 0,a)},
return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();l[Symbol.iterator]=function(){return this};return l}},{key:"clear",value:function(){var a=this.map;if(0===a.size)return!1;++this.generation;a.clear();return!0}},{key:"mappings",value:function(a){function b(b,k){for(;;)switch(c){case 0:a=void 0===a?Array(2):a,f=$jscomp.makeIterator(g.map.values()),e=f.next();case 1:if(e.done){c=3;break}d=e.value;a[0]=d;a[1]=m(d)[u];c=4;return{value:a,done:!1};case 4:if(void 0===k){c=
5;break}c=-1;throw k;case 5:case 2:e=f.next();c=1;break;case 3:c=-1;default:return{value:void 0,done:!0}}}var c=0,d,e,f,g=this,k={next:function(a){return b(a,void 0)},throw:function(a){return b(void 0,a)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();k[Symbol.iterator]=function(){return this};return k}},{key:Symbol.iterator,value:function(){return this.mappings()}},{key:"toJSON",value:function(){for(var b=[],c=$jscomp.makeIterator(this.map.values()),d=c.next();!d.done;d=
c.next()){var g=d.value;if(g[f]===g){for(var d=[],g=$jscomp.makeIterator(e(g)),h=g.next();!h.done;h=g.next())d.push(h.value);d.sort(a.a.compare);b.push(d)}}b.sort(function(b,c){return a.a.compare(b[0],c[0])});return b.map(function(a){return a.map(function(a){return a.toString()})})}},{key:"size",get:function(){return this.map.size}}]);return c}()},function(n,h,c){c.d(h,"b",function(){return m});var m;(function(c){c[c.LITTLE=0]="LITTLE";c[c.BIG=1]="BIG"})(m||(m={}));n=function(){var c=Uint16Array.of(4386);
return 17===(new Uint8Array(c.buffer))[0]?m.BIG:m.LITTLE}();h.a=n},function(n,h,c){c.d(h,"a",function(){return e});var m=function(){function a(a,c){for(var b=0;b<c.length;b++){var d=c[b];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,e){c&&a(b.prototype,c);e&&a(b,e);return b}}(),e=function(){function a(b){b=void 0===b?16:b;if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");this.length=
0;this.data=new Float32Array(b)}m(a,[{key:"resize",value:function(a){var b=this.data;if(a>b.length){var c=new Float32Array(Math.max(a,2*b.length));c.set(b.subarray(0,this.length));this.data=c}this.length=a}},{key:"shrinkToFit",value:function(){this.data=new Float32Array(this.view)}},{key:"clear",value:function(){this.length=0}},{key:"appendArray",value:function(a){var b=this.length;this.resize(b+a.length);this.data.set(a,b)}},{key:"eraseRange",value:function(a,c){this.data.copyWithin(a,c,this.length);
this.length-=c-a}},{key:"view",get:function(){var a=this.data;return new Float32Array(a.buffer,a.byteOffset,this.length)}}]);return a}()},function(n,h,c){function m(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function e(a,b){var c=document.createElement("iframe");c.style.display="none";c.id=a;c.name=a;c.src="https://accounts.google.com/o/oauth2/postmessageRelay?parent="+encodeURIComponent(location.origin)+"#rpctoken="+b;document.body.appendChild(c)}var a=c(13),
b=c(10),d=c(2),f=c(140),g=c(3);h.a=function(d,e){e=void 0===e?a.c:e;var g=c.i(f.a)();void 0===r&&(r=new p);var k=r,h=k.makeAuthRequestUrl({state:g,clientId:d.clientId,scopes:d.scopes,approvalPrompt:d.approvalPrompt,loginHint:d.loginHint,immediate:d.immediate,authUser:d.authUser}),l=k.addPendingRequest(g),g=new Promise(function(a,b){l.finished.add(function(c,d){void 0!==c?a(c):b(d)})});l.finished.add(e.add(function(){l.finished.dispatch(void 0,a.b)}));if(d.immediate)k.relayReadyPromise.then(function(){if(!e.isCanceled){var a=
document.createElement("iframe");a.src=h;a.style.display="none";document.body.appendChild(a);l.finished.add(function(){c.i(b.b)(a)})}});else if(!e.isCanceled){var m=open(h);l.finished.add(function(){m.close()})}return g};var l=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),u=function v(){m(this,v);this.finished=
new g.b},p=function(){function a(){var b=this;m(this,a);this.proxyName="postmessageRelay"+c.i(f.a)();this.rpcToken=""+c.i(f.a)();this.relayReadyService="oauth2relayReady:"+this.rpcToken;this.oauth2CallbackService="oauth2callback:"+this.rpcToken;this.pendingRequests=new Map;e(this.proxyName,this.rpcToken);this.relayReadyPromise=new Promise(function(a){addEventListener("message",function(e){if("https://accounts.google.com"===e.origin)try{var f=c.i(d.a)(JSON.parse(e.data)),g=c.i(d.h)(f.s);g===b.relayReadyService&&
a();if(g===b.oauth2CallbackService){var h=c.i(d.k)(f.a,function(a){return a}),l=c.i(d.h)(h[0]),p=location.origin;if(!l.startsWith(p+"#")&&!l.startsWith(p+"?"))throw Error("oauth2callback: URL "+JSON.stringify(l)+" does not match current origin "+p+".");for(var r=l.substring(p.length+1).split("&"),m=new Map,u=$jscomp.makeIterator(r),n=u.next();!n.done;n=u.next()){var t=n.value.match("^([a-z_]+)=(.*)$");if(null===t)throw Error("oauth2callback: URL part "+JSON.stringify(t)+" does not match expected pattern.");
m.set(t[1],t[2])}var v=m.get("state");if(void 0===v)throw Error("oauth2callback: State argument is missing.");var x=b.pendingRequests.get(v);if(void 0!==x){var B=m.get("error");if(void 0!==B){var R=m.get("error_subtype"),f=B;void 0!==R&&(f+=": "+R);x.finished.dispatch(void 0,Error("Error obtaining Google OAuth2 token: "+f))}else{var P=m.get("access_token"),T=m.get("token_type"),ca=m.get("expires_in"),ga=m.get("scope");if(void 0===P||void 0===T||void 0===ca||void 0===ga)throw Error("oauth2callback: URL lacks expected parameters.");
x.finished.dispatch({accessToken:P,tokenType:T,expiresIn:ca,scope:ga})}}}}catch(H){throw Error("Invalid message received from https://accounts.google.com: "+JSON.stringify(e.data)+": "+H.message+".");}})})}l(a,[{key:"addPendingRequest",value:function(a){var b=this,c=new u;this.pendingRequests.set(a,c);c.finished.add(function(){b.pendingRequests.delete(a)});return c}},{key:"makeAuthRequestUrl",value:function(a){var b="https://accounts.google.com/o/oauth2/auth?client_id="+encodeURIComponent(a.clientId),
b=b+"&redirect_uri=postmessage&response_type=token"+("&origin="+encodeURIComponent(void 0===a.origin?location.origin:a.origin)),b=b+("&proxy="+this.proxyName),b=b+"&include_granted_scopes=true"+("&scope="+encodeURIComponent(a.scopes.join(" ")));a.state&&(b+="&state="+a.state);a.approvalPrompt&&(b+="&approval_prompt="+encodeURIComponent(a.approvalPrompt));a.loginHint&&(b+="&login_hint="+encodeURIComponent(a.loginHint));a.immediate&&(b+="&immediate=true");void 0!==a.authUser&&(b+="&authuser="+a.authUser);
return b}}]);return a}(),r},function(n,h,c){h.a=function(c){for(var e=0,a=c.length,b=0;b<a;++b)e=31*e+c.charCodeAt(b)|0;return e}},function(n,h,c){h.a=function(c){$jscomp.initSymbol();$jscomp.initSymbolIterator();c=c[Symbol.iterator]();var e=c.next(),a=e.value;if(e.done)return"";for(e=a.length;0<e;){var b=c.next(),d=b.value;if(b.done)break;for(b=0;b<e&&a.charCodeAt(b)===d.charCodeAt(b);++b);e=b}return a.substring(0,e)}},function(n,h,c){h.a=function(c){c=Math.ceil((void 0===c?128:c)/32);var e=new Uint32Array(c);
crypto.getRandomValues(e);for(var a="",b=0;b<c;++b)a+=("00000000"+e[b].toString(16)).slice(-8);return a}},function(n,h,c){h.a=function(c){var e=c.parentElement,a=c.offsetLeft-e.clientLeft,b=c.offsetTop-e.clientTop,d=e.scrollLeft,f=e.scrollTop,b=Math.max(0,b+c.offsetHeight-(f+e.clientHeight))||Math.min(0,b-f);e.scrollLeft+=Math.max(0,a+c.offsetWidth-(d+e.clientWidth))||Math.min(0,a-d);e.scrollTop+=b}},function(n,h,c){h.b=function(c,e){c.remove(e)};h.a=function(c,e){c.add(e)}},function(n,h,c){h.a=function(c){var e=
0;switch(c.deltaMode){case 0:e=.005;break;case 1:e=.1;break;case 2:e=2}return Math.exp(c.deltaY*e)}},function(n,h,c){function m(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function e(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,
configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function a(a){var b=G.a.find(function(b){return b[0]===a});if(void 0===b)throw Error("Invalid layout name: "+JSON.stringify(a)+".");return b}function b(b){return a(b)[0]}n=c(20);var d=c.n(n),f=c(16),g=c(25),l=c(109),u=c(9),p=c(58),r=c(110),k=c(12),v=c(59),t=c(60),B=c(21),x=c(113),y=c(27),C=c(15);n=c(0);var A=c(41),D=c(3),F=c(42),G=c(145),z=c(7);c.d(h,"a",function(){return J});var L=function(){function a(a,b){for(var c=
0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}();c(170);c(77);c(19);var J=function(c){function h(a){if(!(this instanceof h))throw new TypeError("Cannot call a class as a function");var c=m(this,(h.__proto__||Object.getPrototypeOf(h)).call(this));c.display=a;c.navigationState=c.registerDisposer(new t.a);c.perspectiveNavigationState=new t.a(new t.b(c.navigationState.position),
1);c.mouseState=new u.a;c.layerManager=c.registerDisposer(new u.b);c.showAxisLines=new y.a(!0,!0);c.showScaleBar=new y.a(!0,!0);c.showPerspectiveSliceViews=new y.a(!0,!0);c.layerSelectedValues=c.registerDisposer(new u.c(c.layerManager,c.mouseState));c.worker=new z.a(new Worker("chunk_worker.bundle.js"));c.resetInitiated=new D.a;c.chunkQueueManager=new g.a(c.worker,c.display.gl,{gpuMemory:new f.a(1E6,1E9),systemMemory:new f.a(1E7,2E9),download:new f.a(32,Number.POSITIVE_INFINITY)});c.chunkManager=
new g.b(c.chunkQueueManager);c.keyMap=new A.a;c.keyCommands=new Map;c.layerSpecification=new k.a(c.layerManager,c.chunkManager,c.worker,c.layerSelectedValues,c.navigationState.voxelSize);c.layoutName=new C.b(G.a[0][0],b);c.state=new F.b;c.registerDisposer(a.updateStarted.add(function(){c.onUpdateDisplay()}));c.registerDisposer(a.updateFinished.add(function(){c.onUpdateDisplayFinished()}));c.registerEventListener(document,"contextmenu",function(a){a.preventDefault();return!1});var e=c.state;e.add("layers",
c.layerSpecification);e.add("navigation",c.navigationState);e.add("showAxisLines",c.showAxisLines);e.add("showScaleBar",c.showScaleBar);e.add("perspectiveOrientation",c.perspectiveNavigationState.pose.orientation);e.add("perspectiveZoom",c.perspectiveNavigationState.zoomFactor);e.add("showSlices",c.showPerspectiveSliceViews);e.add("layout",c.layoutName);c.registerDisposer(c.navigationState.changed.add(function(){c.handleNavigationStateChanged()}));c.layerManager.initializePosition(c.navigationState.position);
c.registerDisposer(c.layerSpecification.voxelCoordinatesSet.add(function(a){c.navigationState.position.setVoxelCoordinates(a)}));e=c.registerCancellable(d()(function(){0===c.layerManager.managedLayers.length&&(c.navigationState.reset(),c.perspectiveNavigationState.pose.orientation.reset(),c.perspectiveNavigationState.zoomFactor.reset(),c.resetInitiated.dispatch(),B.a||new p.a(c.layerSpecification))}));c.layerManager.layersChanged.add(e);e();c.registerDisposer(c.chunkQueueManager.visibleChunksChanged.add(function(){c.layerSelectedValues.handleLayerChange()}));
c.chunkQueueManager.visibleChunksChanged.add(function(){a.scheduleRedraw()});c.makeUI();c.registerDisposer(new A.b(c.keyMap,c.onKeyCommand.bind(c)));c.layoutName.changed.add(function(){if(void 0!==c.dataDisplayLayout){var a=c.dataDisplayLayout.rootElement;c.dataDisplayLayout.dispose();c.createDataDisplayLayout(a)}});e=c.keyCommands;e.set("toggle-layout",function(){this.toggleLayout()});e.set("snap",function(){this.navigationState.pose.snap()});e.set("add-layer",function(){this.layerPanel.addLayerMenu();
return!0});e.set("help",c.showHelpDialog);for(var l={i:1};9>=l.i;l={i:l.i},++l.i)e.set("toggle-layer-"+l.i,function(a){return function(){var b=a.i-1,c=this.layerManager.managedLayers;b<c.length&&(b=c[b],b.setVisible(!b.visible))}}(l));for(var l={},r=$jscomp.makeIterator(["recolor","clear-segments"]),n=r.next();!n.done;l={command:l.command},n=r.next())l.command=n.value,e.set(l.command,function(a){return function(){this.layerManager.invokeAction(a.command)}}(l));e.set("toggle-axis-lines",function(){this.showAxisLines.toggle()});
e.set("toggle-scale-bar",function(){this.showScaleBar.toggle()});c.keyCommands.set("toggle-show-slices",function(){this.showPerspectiveSliceViews.toggle()});return c}e(h,c);L(h,[{key:"makeUI",value:function(){var a=this,b=this.display,c=document.createElement("div");c.setAttribute("class","gllayoutcontainer noselect");b.container.appendChild(c);v.a("column",[v.a("row",[v.b(1,function(b){return new x.a(b,a)}),function(b){var c=document.createElement("button");c.className="help-button";c.textContent=
"?";c.title="Help";b.appendChild(c);a.registerEventListener(c,"click",function(){a.showHelpDialog()})}]),function(b){a.layerPanel=new r.a(b,a.layerSpecification)},v.b(1,function(b){a.createDataDisplayLayout(b)})])(c);this.display.onResize()}},{key:"createDataDisplayLayout",value:function(b){this.dataDisplayLayout=(0,a(this.layoutName.value)[1])(b,this)}},{key:"toggleLayout",value:function(){var b=a(this.layoutName.value),b=G.a.indexOf(b);this.layoutName.value=G.a[(b+1)%G.a.length][0]}},{key:"showHelpDialog",
value:function(){new l.a(this.keyMap)}},{key:"onUpdateDisplay",value:function(){this.chunkQueueManager.chunkUpdateDeadline=null}},{key:"onUpdateDisplayFinished",value:function(){this.mouseState.updateIfStale()}},{key:"onKeyCommand",value:function(a){var b=this.keyCommands.get(a);return b&&b.call(this)?!0:(b=this.display.activePanel)?b.onKeyCommand(a):!1}},{key:"handleNavigationStateChanged",value:function(){var a=this.chunkQueueManager;null===a.chunkUpdateDeadline&&(a.chunkUpdateDeadline=Date.now()+
10);this.mouseState.stale=!0}},{key:"gl",get:function(){return this.display.gl}}]);return h}(n.a)},function(n,h,c){function m(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function e(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function a(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function b(a,b){b=void 0===b?a.navigationState:new g.a(new g.b(a.navigationState.pose.position,g.c.makeRelative(a.navigationState.pose.orientation,b)),a.navigationState.zoomFactor);return new u.a(a.chunkManager,a.layerManager,b)}function d(a){var c=[];c.push(b(a,void 0));c.push(b(a,v.l.rotateX(v.l.create(),v.l.create(),
Math.PI/2)));c.push(b(a,v.l.rotateY(v.l.create(),v.l.create(),Math.PI/2)));return c}var f=c(59),g=c(60),l=c(112),u=c(5),p=c(38),r=c(27);n=c(0);var k=c(10),v=c(1),t=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),B=function F(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);
if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return F(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},x=function(b){function g(a,b){m(this,g);var c=e(this,(g.__proto__||Object.getPrototypeOf(g)).call(this));c.rootElement=a;c.viewer=b;var k=d(b),h=b.display,u={mouseState:b.mouseState,layerManager:b.layerManager,navigationState:b.perspectiveNavigationState,showSliceViews:b.showPerspectiveSliceViews,showSliceViewsCheckbox:!0,showAxisLines:b.showAxisLines},
n={mouseState:b.mouseState,layerManager:b.layerManager,navigationState:b.navigationState,showAxisLines:b.showAxisLines,showScaleBar:b.showScaleBar},t={mouseState:b.mouseState,layerManager:b.layerManager,navigationState:b.navigationState,showAxisLines:b.showAxisLines,showScaleBar:new r.a(!1,!1)};b=[f.b(1,f.a("column",[f.b(1,f.a("row",[f.b(1,function(a){a.className="gllayoutcell noselect";c.registerDisposer(new p.a(h,a,k[0],n))}),f.b(1,function(a){a.className="gllayoutcell noselect";c.registerDisposer(new p.a(h,
a,k[1],t))})])),f.b(1,f.a("row",[f.b(1,function(a){a.className="gllayoutcell noselect";a=c.registerDisposer(new l.a(h,a,u));for(var b=$jscomp.makeIterator(k),d=b.next();!d.done;d=b.next())a.sliceViews.add(d.value.addRef())}),f.b(1,function(a){a.className="gllayoutcell noselect";c.registerDisposer(new p.a(h,a,k[2],t))})]))]))];f.a("row",b)(a);h.onResize();return c}a(g,b);t(g,[{key:"disposed",value:function(){c.i(k.a)(this.rootElement);B(g.prototype.__proto__||Object.getPrototypeOf(g.prototype),"disposed",
this).call(this)}}]);return g}(n.a),y=function(d){function g(a,c,d){m(this,g);var k=e(this,(g.__proto__||Object.getPrototypeOf(g)).call(this));k.rootElement=a;k.viewer=c;k.direction=d;var h=b(c),r=c.display,u={mouseState:c.mouseState,layerManager:c.layerManager,navigationState:c.perspectiveNavigationState,showSliceViews:c.showPerspectiveSliceViews,showSliceViewsCheckbox:!0,showAxisLines:c.showAxisLines},n={mouseState:c.mouseState,layerManager:c.layerManager,navigationState:c.navigationState,showAxisLines:c.showAxisLines,
showScaleBar:c.showScaleBar};f.b(1,f.a(d,[f.b(1,function(a){a.className="gllayoutcell noselect";k.registerDisposer(new p.a(r,a,h,n))}),f.b(1,function(a){a.className="gllayoutcell noselect";k.registerDisposer(new l.a(r,a,u)).sliceViews.add(h.addRef())})]))(a);r.onResize();return k}a(g,d);t(g,[{key:"disposed",value:function(){c.i(k.a)(this.rootElement);B(g.prototype.__proto__||Object.getPrototypeOf(g.prototype),"disposed",this).call(this)}}]);return g}(n.a),C=function(d){function g(a,c){m(this,g);var d=
e(this,(g.__proto__||Object.getPrototypeOf(g)).call(this));d.rootElement=a;d.viewer=c;var k=b(c),h={mouseState:c.mouseState,layerManager:c.layerManager,navigationState:c.navigationState,showAxisLines:c.showAxisLines,showScaleBar:c.showScaleBar};f.a("row",[f.b(1,function(a){d.registerDisposer(new p.a(c.display,a,k,h))})])(a);c.display.onResize();return d}a(g,d);t(g,[{key:"disposed",value:function(){c.i(k.a)(this.rootElement);B(g.prototype.__proto__||Object.getPrototypeOf(g.prototype),"disposed",this).call(this)}}]);
return g}(n.a),A=function(b){function d(a,b){m(this,d);var c=e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));c.rootElement=a;c.viewer=b;var g={mouseState:b.mouseState,layerManager:b.layerManager,navigationState:b.perspectiveNavigationState,showSliceViews:new r.a(!1,!1),showAxisLines:b.showAxisLines};f.a("row",[f.b(1,function(a){c.registerDisposer(new l.a(b.display,a,g))})])(a);b.display.onResize();return c}a(d,b);t(d,[{key:"disposed",value:function(){c.i(k.a)(this.rootElement);B(d.prototype.__proto__||
Object.getPrototypeOf(d.prototype),"disposed",this).call(this)}}]);return d}(n.a);h.a=[["4panel",function(a,b){return new x(a,b)}],["xy-3d",function(a,b){return new y(a,b,"row")}],["xy",function(a,b){return new C(a,b)}],["3d",function(a,b){return new A(a,b)}]]},function(n,h,c){var m=c(70);h.a=function(c){var a={antialias:!1,stencil:!0};c=c.getContext("webgl",a)||c.getContext("experimental-webgl",a);c.memoize=new m.b;c.maxTextureSize=c.getParameter(c.MAX_TEXTURE_SIZE);c.maxTextureImageUnits=c.getParameter(c.MAX_TEXTURE_IMAGE_UNITS);
c.tempTextureUnit=c.maxTextureImageUnits-1;c.WEBGL_draw_buffers=c.getExtension("WEBGL_draw_buffers");if(!c.WEBGL_draw_buffers)throw Error("WEBGL_draw_buffers extension not available");c.ANGLE_instanced_arrays=c.getExtension("ANGLE_instanced_arrays");if(!c.ANGLE_instanced_arrays)throw Error("ANGLE_instanced_ararys extension not available");for(var a=$jscomp.makeIterator(["OES_texture_float","OES_element_index_uint"]),b=a.next();!b.done;b=a.next())if(b=b.value,!c.getExtension(b))throw Error(b+" extension not available");
return c}},function(n,h,c){function m(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function e(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=
b)}function a(a){var b=document.createElement("div");b.textContent=a.value;return b}n=c(20);var b=c.n(n),d=c(13);n=c(0);var f=c(10),g=c(69),l=c(41),u=c(139),p=c(141),r=c(3),k=c(74);h.a=function(a){var b=document.createElement("div");b.className="autocomplete-completion-with-description";b.textContent=a.value;var c=document.createElement("div");c.className="autocomplete-completion-description";c.textContent=a.description||"";b.appendChild(c);return b};c.d(h,"b",function(){return C});var v=function(){function a(a,
b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),t=function D(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return D(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};c(171);$jscomp.initSymbol();var B=Symbol("autocompleteIndex"),
x=new l.a({arrowdown:"cycle-next-active-completion",arrowup:"cycle-prev-active-completion",tab:"choose-active-completion-or-prefix",enter:"choose-active-completion",escape:"cancel"}),y=new Map([["cycle-next-active-completion",function(){this.cycleActiveCompletion(1);return!0}],["cycle-prev-active-completion",function(){this.cycleActiveCompletion(-1);return!0}],["choose-active-completion-or-prefix",function(){return this.selectActiveCompletion(!0)}],["choose-active-completion",function(){return this.selectActiveCompletion(!1)}],
["cancel",function(){return this.cancel()}]]),C=function(h){function n(a){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");var e=m(this,(n.__proto__||Object.getPrototypeOf(n)).call(this));e.inputChanged=new r.b;e.prevInputValue="";e.completionsVisible=!1;e.activeCompletionPromise=null;e.activeCompletionCancellationToken=void 0;e.hasFocus=!1;e.completionResult=null;e.dropdownContentsStale=!0;e.updateHintScrollPositionTimer=null;e.completionElements=null;e.hasResultForDropdown=
!1;e.commonPrefix="";e.activeIndex=-1;e.dropdownStyleStale=!0;e.completer=a.completer;a=void 0===a.delay?200:a.delay;var f=e.scheduleUpdateCompletions=b()(function(){var a=e.activeCompletionCancellationToken=new d.a,b=e.activeCompletionPromise=e.completer(e.value,a);null!==b&&b.then(function(a){e.activeCompletionPromise===b&&(e.setCompletions(a),e.activeCompletionPromise=null)})},a);e.registerDisposer(function(){f.cancel()});a=e.element=document.createElement("div");a.className="autocomplete";var g=
document.createElement("div");g.className="autocomplete-dropdown-wrapper";var h=e.dropdownElement=document.createElement("div");h.className="autocomplete-dropdown";var p=e.promptElement=document.createElement("label");p.className="autocomplete-prompt";var u=e.inputWrapperElement=document.createElement("div");u.className="autocomplete-input-wrapper";a.appendChild(p);var t=e.inputElement=document.createElement("input");t.type="text";t.autocomplete="off";t.spellcheck=!1;t.className="autocomplete-input";
c.i(k.a)(p,t);p=e.hintElement=document.createElement("input");p.type="text";p.spellcheck=!1;p.className="autocomplete-hint";p.disabled=!0;u.appendChild(p);u.appendChild(t);g.appendChild(u);g.appendChild(h);a.appendChild(g);e.registerInputHandler();e.handleInputChanged("");e.registerEventListener(e.inputElement,"focus",function(){e.hasFocus||(e.hasFocus=!0,e.dropdownStyleStale=!0,e.updateDropdown())});e.registerEventListener(e.inputElement,"blur",function(){e.hasFocus&&(e.hasFocus=!1,e.updateDropdown())});
e.registerEventListener(a.ownerDocument.defaultView,"resize",function(){e.dropdownStyleStale=!0});e.registerEventListener(a.ownerDocument.defaultView,"scroll",function(){e.dropdownStyleStale=!0});e.registerEventListener(e.dropdownElement,"mousedown",e.handleDropdownMousedown.bind(e));e.registerEventListener(e.inputElement,"keydown",function(){e.hintScrollPositionMayBeStale()});e.registerEventListener(e.inputElement,"mousemove",function(a){0!==a.buttons&&e.hintScrollPositionMayBeStale()});(e.keyboardHandler=
e.registerDisposer(new l.c(t,x,e.handleKeyCommand.bind(e)))).allShortcutsAreGlobal=!0;return e}e(n,h);v(n,[{key:"hintScrollPositionMayBeStale",value:function(){""!==this.hintElement.value&&this.scheduleUpdateHintScrollPosition()}},{key:"handleDropdownMousedown",value:function(a){this.inputElement.focus();for(var b=this.dropdownElement,c=a.target;c instanceof HTMLElement;c=c.parentElement){var d=c[B];if(void 0!==d){this.selectCompletion(d);break}if(c===b)break}a.preventDefault()}},{key:"cycleActiveCompletion",
value:function(a){if(null!==this.completionResult){var b=this.activeIndex,c=this.completionResult.completions.length;this.setActiveIndex(-1===b?0<a?0:c-1:(b+a+c)%c)}}},{key:"handleKeyCommand",value:function(a){return y.get(a).call(this)}},{key:"registerInputHandler",value:function(){for(var a=this,b=function(b){b=a.inputElement.value;b!==a.prevInputValue&&(a.prevInputValue=b,a.handleInputChanged(b))},c=$jscomp.makeIterator(["input"]),d=c.next();!d.done;d=c.next())this.registerEventListener(this.inputElement,
d.value,b,!1)}},{key:"shouldShowDropdown",value:function(){return null!==this.completionResult&&this.hasFocus?this.hasResultForDropdown:!1}},{key:"updateDropdownStyle",value:function(){var a=this.dropdownElement,b=this.inputElement;c.i(g.a)(a,b,{horizontal:!1});this.dropdownStyleStale=!1}},{key:"updateDropdown",value:function(){if(this.shouldShowDropdown()){var b=this.dropdownElement,d=this.activeIndex;if(this.dropdownContentsStale){var e=this.completionResult,f=void 0===e.makeElement?a:e.makeElement;
this.completionElements=e.completions.map(function(a,c){a=f.call(e,a);a[B]=c;a.classList.add("autocomplete-completion");d===c&&a.classList.add("autocomplete-completion-active");b.appendChild(a);return a});this.dropdownContentsStale=!1}this.dropdownStyleStale&&this.updateDropdownStyle();this.completionsVisible||(b.style.display="block",this.completionsVisible=!0);if(-1!==d){var g=this.completionElements[d];c.i(p.a)(g)}}else this.completionsVisible&&(this.dropdownElement.style.display="none",this.completionsVisible=
!1)}},{key:"setCompletions",value:function(a){this.clearCompletions();var b=a.completions;0!==b.length&&(this.completionResult=a,1===b.length?(b=b[0],a.showSingleResult?this.hasResultForDropdown=!0:b.value.startsWith(this.prevInputValue)?this.hasResultForDropdown=!1:this.hasResultForDropdown=!0,a.selectSingleResult?this.setActiveIndex(0):this.setHintValue(this.getCompletedValueByIndex(0))):(this.hasResultForDropdown=!0,b=c.i(u.a)(function(){function b(b,g){for(;;)switch(c){case 0:f=$jscomp.makeIterator(a.completions),
e=f.next();case 1:if(e.done){c=3;break}d=e.value;c=4;return{value:d.value,done:!1};case 4:if(void 0===g){c=5;break}c=-1;throw g;case 5:case 2:e=f.next();c=1;break;case 3:c=-1;default:return{value:void 0,done:!0}}}var c=0,d,e,f,g={next:function(a){return b(a,void 0)},throw:function(a){return b(void 0,a)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();g[Symbol.iterator]=function(){return this};return g}()),b=this.getCompletedValue(b),b.startsWith(this.prevInputValue)&&
(this.commonPrefix=b,this.setHintValue(b))),this.updateDropdown())}},{key:"scheduleUpdateHintScrollPosition",value:function(){var a=this;null===this.updateHintScrollPositionTimer&&(this.updateHintScrollPositionTimer=setTimeout(function(){a.updateHintScrollPosition()},0))}},{key:"setHintValue",value:function(a){var b=this.prevInputValue;a!==b&&a.startsWith(b)||(a="");this.hintElement.value=a;this.scheduleUpdateHintScrollPosition()}},{key:"setActiveIndex",value:function(a){if(!this.dropdownContentsStale){var b=
this.activeIndex;-1!==b&&this.completionElements[b].classList.remove("autocomplete-completion-active");-1!==a&&(b=this.completionElements[a],b.classList.add("autocomplete-completion-active"),c.i(p.a)(b))}-1!==a&&this.setHintValue(this.getCompletedValueByIndex(a));this.activeIndex=a}},{key:"getCompletedValueByIndex",value:function(a){return this.getCompletedValue(this.completionResult.completions[a].value)}},{key:"getCompletedValue",value:function(a){return this.prevInputValue.substring(0,this.completionResult.offset)+
a}},{key:"selectActiveCompletion",value:function(a){var b=this.activeIndex;if(-1===b){if(!a)return!1;a=this.completionResult;if(null!==a&&1===a.completions.length)b=0;else return a=this.commonPrefix,a.length>this.value.length?(this.value=a,!0):!1}a=this.getCompletedValueByIndex(b);if(this.value===a)return!1;this.value=a;return!0}},{key:"selectCompletion",value:function(a){this.value=this.getCompletedValueByIndex(a)}},{key:"cancel",value:function(){return!1}},{key:"updateHintScrollPosition",value:function(){this.updateHintScrollPositionTimer=
null;this.hintElement.scrollLeft=this.inputElement.scrollLeft}},{key:"cancelActiveCompletion",value:function(){var a=this.activeCompletionCancellationToken;void 0!==a&&a.cancel();this.activeCompletionCancellationToken=void 0;this.activeCompletionPromise=null}},{key:"handleInputChanged",value:function(a){this.cancelActiveCompletion();this.hintElement.value="";this.clearCompletions();this.inputChanged.dispatch(a);this.scheduleUpdateCompletions()}},{key:"clearCompletions",value:function(){null!==this.completionResult&&
(this.activeIndex=-1,this.completionElements=this.completionResult=null,this.dropdownStyleStale=this.dropdownContentsStale=!0,this.commonPrefix="",c.i(f.a)(this.dropdownElement),this.updateDropdown())}},{key:"disposed",value:function(){c.i(f.b)(this.element);this.cancelActiveCompletion();null!==this.updateHintScrollPositionTimer&&(clearTimeout(this.updateHintScrollPositionTimer),this.updateHintScrollPositionTimer=null);t(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"disposed",this).call(this)}},
{key:"disabled",get:function(){return this.inputElement.disabled},set:function(a){this.inputElement.disabled=a}},{key:"value",get:function(){return this.prevInputValue},set:function(a){a!==this.prevInputValue&&(this.prevInputValue=this.inputElement.value=a,this.handleInputChanged(a))}}]);return n}(n.a)},function(n,h,c){h.a=function(){var c=document.createElement("button");c.type="submit";c.className="hidden-submit-button";c.style.margin="0";c.style.border="0";c.style.padding="0";c.style.width="0";
c.style.height="0";c.style.overflow="hidden";c.tabIndex=-1;return c}},function(n,h,c){function m(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function e(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&
(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}n=c(0);var a=c(10),b=c(3);c.d(h,"a",function(){return g});var d=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),f=function u(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),
null!==a)return u(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};c(19);c(172);var g=function(g){function h(a,c){if(!(this instanceof h))throw new TypeError("Cannot call a class as a function");var d=m(this,(h.__proto__||Object.getPrototypeOf(h)).call(this));d.pointList=a;d.selectionIndex=c;d.element=document.createElement("div");d.clearButton=document.createElement("button");d.itemContainer=document.createElement("div");d.generation=-1;d.pointSelected=new b.b;
d.visible_=!1;c=d.element;var e=d.clearButton,f=d.itemContainer;c.className="neuroglancer-point-list-widget";e.className="neuroglancer-clear-button";e.textContent="Delete all points";d.registerEventListener(e,"click",function(){d.pointList.reset()});f.className="neuroglancer-item-container neuroglancer-select-text";c.appendChild(e);c.appendChild(f);d.registerDisposer(a.changed.add(function(){d.maybeUpdate()}));return d}e(h,g);d(h,[{key:"maybeUpdate",value:function(){var b=this;if(this.visible_){var d=
this.pointList;if(this.generation!==d.generation){this.generation=d.generation;var e=this.itemContainer;c.i(a.a)(e);for(var f=d.length,d=d.points.data,g={i:0};g.i<f;g={i:g.i},++g.i){var h=document.createElement("div");h.className="neuroglancer-point-list-item";var p=3*g.i;h.textContent=Math.round(d[p])+" "+Math.round(d[p+1])+" "+Math.round(d[p+2]);h.addEventListener("click",function(a){return function(){b.pointSelected.dispatch(a.i)}}(g));h.addEventListener("mouseenter",function(a){return function(){b.selectionIndex.value=
a.i}}(g));h.addEventListener("mouseleave",function(){b.selectionIndex.value=null});e.appendChild(h)}}}}},{key:"disposed",value:function(){c.i(a.b)(this.element);this.clearButton=this.itemContainer=this.element=void 0;f(h.prototype.__proto__||Object.getPrototypeOf(h.prototype),"disposed",this).call(this)}},{key:"visible",get:function(){return this.visible_},set:function(a){this.visible_!==a&&(this.visible_=a,!0===a&&this.maybeUpdate())}}]);return h}(n.a)},function(n,h,c){function m(a,b){if("function"!==
typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}n=c(0);var a=c(10);c.d(h,"a",function(){return l});var b=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];
d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}();c(174);var d=[1.5,2,3,5,7.5,10],f=[{unit:"km",lengthInNanometers:1E12},{unit:"m",lengthInNanometers:1E9},{unit:"mm",lengthInNanometers:1E6},{unit:"\u00b5m",lengthInNanometers:1E3},{unit:"nm",lengthInNanometers:1},{unit:"pm",lengthInNanometers:.001}],g=function(){function a(){e(this,a);this.allowedSignificands=d;this.prevTargetLengthInPixels=
this.prevNanometersPerPixel=0}b(a,[{key:"update",value:function(){var a=this.nanometersPerPixel,b=this.targetLengthInPixels;if(this.prevNanometersPerPixel===a&&this.prevTargetLengthInPixels===b)return!1;this.prevNanometersPerPixel=a;this.prevTargetLengthInPixels=b;for(var c=b*a,b=Math.pow(10,Math.floor(Math.log(c)/Math.LN10)),c=c/b,d=1,e=$jscomp.makeIterator(this.allowedSignificands),g=e.next();!g.done;g=e.next())if(g=g.value,Math.abs(g-c)<Math.abs(d-c))d=g;else break;b*=d;c=f.length;d=f[c-1];for(e=
0;e<c;++e)if(g=f[e],b>=g.lengthInNanometers){d=g;break}this.lengthInPixels=Math.round(b/a);this.physicalUnit=d.unit;this.physicalLength=b/d.lengthInNanometers;return!0}}]);return a}(),l=function(d){function f(a){a=void 0===a?new g:a;e(this,f);var b;b=(f.__proto__||Object.getPrototypeOf(f)).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");b=!b||"object"!==typeof b&&"function"!==typeof b?this:b;b.dimensions=a;b.element=document.createElement("div");
b.textNode=document.createTextNode("");b.barElement=document.createElement("div");a=b.element;var c=b.textNode,d=b.barElement;a.className="scale-bar-container";a.appendChild(c);a.appendChild(d);d.className="scale-bar";return b}m(f,d);b(f,[{key:"update",value:function(){var a=this.dimensions;a.update()&&(this.textNode.textContent=a.physicalLength+" "+a.physicalUnit,this.barElement.style.width=a.lengthInPixels+"px")}},{key:"disposed",value:function(){c.i(a.b)(this.element)}}]);return f}(n.a)},function(n,
h,c){function m(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function e(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}n=c(0);var a=c(11);
c.d(h,"a",function(){return g});var b=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),d=function u(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return u(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===
b?void 0:b.call(c)}};c(19);c(175);var f=new a.a,g=function(a){function c(a){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");var b=m(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));b.displayState=a;b.element=document.createElement("div");b.clearButton=document.createElement("button");b.itemContainer=document.createElement("span");b.items=new Map;var d=b.element,e=b.clearButton,f=b.itemContainer;d.className="segment-set-widget noselect";e.className="clear-button";
e.title="Remove all segment IDs";b.registerEventListener(e,"click",function(){b.visibleSegments.clear()});f.className="item-container";d.appendChild(f);f.appendChild(e);b.registerDisposer(a.visibleSegments.changed.add(function(a,c){b.handleSetChanged(a,c)}));b.registerDisposer(a.segmentColorHash.changed.add(function(){b.handleColorChanged()}));a=$jscomp.makeIterator(a.visibleSegments);for(d=a.next();!d.done;d=a.next())b.addElement(d.value.toString());b.updateClearButtonVisibility();return b}e(c,a);
b(c,[{key:"updateClearButtonVisibility",value:function(){this.clearButton.style.display=0<this.displayState.visibleSegments.size?"":"none"}},{key:"handleSetChanged",value:function(a,b){this.updateClearButtonVisibility();var c=this.items;if(null===a){a=this.itemContainer;for(b=this.clearButton;;){var d=a.lastElementChild;if(d===b)break;a.removeChild(d)}c.clear()}else b?this.addElement(a.toString()):(a=a.toString(),b=c.get(a),b.parentElement.removeChild(b),c.delete(a))}},{key:"addElement",value:function(a){var b=
document.createElement("button");b.className="segment-button";b.textContent=a;b.title="Remove segment ID "+a;var c=this;b.addEventListener("click",function(){f.tryParseString(this.textContent);c.visibleSegments.delete(f)});b.addEventListener("mouseenter",function(){f.tryParseString(this.textContent);c.segmentSelectionState.set(f)});b.addEventListener("mouseleave",function(){f.tryParseString(this.textContent);c.segmentSelectionState.set(null)});this.setItemColor(b);this.itemContainer.appendChild(b);
this.items.set(a,b)}},{key:"setItemColor",value:function(a){f.tryParseString(a.textContent);a.style.backgroundColor=this.segmentColorHash.computeCssColor(f)}},{key:"handleColorChanged",value:function(){var a=this;this.items.forEach(function(b){a.setItemColor(b)})}},{key:"disposed",value:function(){var a=this.element,b=a.parentElement;b&&b.removeChild(a);d(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"disposed",this).call(this)}},{key:"visibleSegments",get:function(){return this.displayState.visibleSegments}},
{key:"segmentColorHash",get:function(){return this.displayState.segmentColorHash}},{key:"segmentSelectionState",get:function(){return this.displayState.segmentSelectionState}}]);return c}(n.a)},function(n,h,c){function m(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function e(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}n=c(0);var a=c(10),b=c(3),d=c(11);c.d(h,"a",function(){return l});var f=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),
g=function p(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return p(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};c(19);c(177);var l=function(h){function l(){if(!(this instanceof l))throw new TypeError("Cannot call a class as a function");var a=m(this,(l.__proto__||Object.getPrototypeOf(l)).call(this));a.element=document.createElement("form");a.label=document.createElement("label");
a.input=document.createElement("input");a.value=new d.a;a.valueEntered=new b.b;var c=a.element,e=a.label,f=a.input;c.className="uint64-entry noselect";c.appendChild(e);e.appendChild(f);a.registerEventListener(c,"submit",function(b){b.preventDefault();a.validateInput()&&(a.input.value="",a.input.classList.remove("valid-input","invalid-input"),a.valueEntered.dispatch(a.value))});a.registerEventListener(c,"input",function(){""===a.input.value?a.input.classList.remove("valid-input","invalid-input"):a.validateInput()?
a.input.classList.remove("invalid-input"):a.input.classList.add("invalid-input")});return a}e(l,h);f(l,[{key:"validateInput",value:function(){return this.value.tryParseString(this.input.value)}},{key:"disposed",value:function(){c.i(a.b)(this.element);g(l.prototype.__proto__||Object.getPrototypeOf(l.prototype),"disposed",this).call(this)}}]);return l}(n.a)},function(n,h,c){(function(c){function e(a,b){function d(a){if(!e.parentNode)return c.off(document,"mousemove",d);e.style.top=Math.max(0,a.clientY-
e.offsetHeight-5)+"px";e.style.left=a.clientX+5+"px"}var e=document.createElement("div");e.className="CodeMirror-lint-tooltip";e.appendChild(b.cloneNode(!0));document.body.appendChild(e);c.on(document,"mousemove",d);d(a);null!=e.style.opacity&&(e.style.opacity=1);return e}function a(a){a.parentNode&&(null==a.style.opacity&&a.parentNode&&a.parentNode.removeChild(a),a.style.opacity=0,setTimeout(function(){a.parentNode&&a.parentNode.removeChild(a)},600))}function b(b,d,f){function g(){c.off(f,"mouseout",
g);h&&(a(h),h=null)}var h=e(b,d),l=setInterval(function(){if(h)for(var a=f;;a=a.parentNode){a&&11==a.nodeType&&(a=a.host);if(a==document.body)return;if(!a){g();break}}if(!h)return clearInterval(l)},400);c.on(f,"mouseout",g)}function d(a,c,d){this.marked=[];this.options=c;this.timeout=null;this.hasGutter=d;this.onMouseOver=function(c){var d=c.target||c.srcElement;if(/\bCodeMirror-lint-mark-/.test(d.className)){for(var d=d.getBoundingClientRect(),e=a.findMarksAt(a.coordsChar({left:(d.left+d.right)/
2,top:(d.top+d.bottom)/2},"client")),d=[],f=0;f<e.length;++f){var g=e[f].__annotation;g&&d.push(g)}if(d.length){e=c.target||c.srcElement;f=document.createDocumentFragment();for(g=0;g<d.length;g++)f.appendChild(h(d[g]));b(c,f,e)}}};this.waitingFor=0}function f(a){var b=a.state.lint;b.hasGutter&&a.clearGutter("CodeMirror-lint-markers");for(a=0;a<b.marked.length;++a)b.marked[a].clear();b.marked.length=0}function g(a,d,e,f){var g=document.createElement("div"),h=g;g.className="CodeMirror-lint-marker-"+
d;e&&(h=g.appendChild(document.createElement("div")),h.className="CodeMirror-lint-marker-multiple");if(0!=f)c.on(h,"mouseover",function(c){b(c,a,h)});return g}function h(a){var b=a.severity;b||(b="error");var c=document.createElement("div");c.className="CodeMirror-lint-message-"+b;c.appendChild(document.createTextNode(a.message));return c}function m(a,b,d){function e(){g=-1;a.off("change",e)}var f=a.state.lint,g=++f.waitingFor;a.on("change",e);b(a.getValue(),function(b,d){a.off("change",e);f.waitingFor==
g&&(d&&b instanceof c&&(b=d),n(a,b))},d,a)}function p(a){var b=a.state.lint.options,d=b.options||b,e=b.getAnnotations||a.getHelper(c.Pos(0,0),"lint");e&&(b.async||e.async?m(a,e,d):n(a,e(a.getValue(),d,a)))}function n(a,b){f(a);for(var c=a.state.lint,d=c.options,e=[],l=0;l<b.length;++l){var k=b[l],p=k.from.line;(e[p]||(e[p]=[])).push(k)}for(l=0;l<e.length;++l)if(k=e[l]){for(var p=null,m=c.hasGutter&&document.createDocumentFragment(),n=0;n<k.length;++n){var r=k[n],u=r.severity;u||(u="error");"error"!=
p&&(p=u);d.formatAnnotation&&(r=d.formatAnnotation(r));c.hasGutter&&m.appendChild(h(r));r.to&&c.marked.push(a.markText(r.from,r.to,{className:"CodeMirror-lint-mark-"+u,__annotation:r}))}c.hasGutter&&a.setGutterMarker(l,"CodeMirror-lint-markers",g(m,p,1<k.length,c.options.tooltips))}if(d.onUpdateLinting)d.onUpdateLinting(b,e,a)}function k(a){var b=a.state.lint;b&&(clearTimeout(b.timeout),b.timeout=setTimeout(function(){p(a)},b.options.delay||500))}c.defineOption("lint",!1,function(a,b,e){e&&e!=c.Init&&
(f(a),!1!==a.state.lint.options.lintOnChange&&a.off("change",k),c.off(a.getWrapperElement(),"mouseover",a.state.lint.onMouseOver),clearTimeout(a.state.lint.timeout),delete a.state.lint);if(b){var g=a.getOption("gutters");e=!1;for(var h=0;h<g.length;++h)"CodeMirror-lint-markers"==g[h]&&(e=!0);g=a.state;b instanceof Function?b={getAnnotations:b}:b&&!0!==b||(b={});e=g.lint=new d(a,b,e);if(!1!==e.options.lintOnChange)a.on("change",k);if(0!=e.options.tooltips&&"gutter"!=e.options.tooltips)c.on(a.getWrapperElement(),
"mouseover",e.onMouseOver);p(a)}});c.defineExtension("performLint",function(){this.state.lint&&p(this)})})(c(76))},function(n,h){},function(n,h){},function(n,h){},function(n,h){},function(n,h){},function(n,h){},function(n,h){},function(n,h){},function(n,h){},function(n,h){},function(n,h){},function(n,h){},function(n,h){},function(n,h){},function(n,h){},function(n,h){},function(n,h){},function(n,h){},function(n,h){},function(n,h){},function(n,h){},function(n,h){},function(n,h){},function(n,h){},function(n,
h,c){var m=c(14);h={create:function(){var c=new m.ARRAY_TYPE(4);c[0]=1;c[1]=0;c[2]=0;c[3]=1;return c},clone:function(c){var a=new m.ARRAY_TYPE(4);a[0]=c[0];a[1]=c[1];a[2]=c[2];a[3]=c[3];return a},copy:function(c,a){c[0]=a[0];c[1]=a[1];c[2]=a[2];c[3]=a[3];return c},identity:function(c){c[0]=1;c[1]=0;c[2]=0;c[3]=1;return c},fromValues:function(c,a,b,d){var e=new m.ARRAY_TYPE(4);e[0]=c;e[1]=a;e[2]=b;e[3]=d;return e},set:function(c,a,b,d,f){c[0]=a;c[1]=b;c[2]=d;c[3]=f;return c},transpose:function(c,a){if(c===
a){var b=a[1];c[1]=a[2];c[2]=b}else c[0]=a[0],c[1]=a[2],c[2]=a[1],c[3]=a[3];return c},invert:function(c,a){var b=a[0],d=a[1],e=a[2];a=a[3];var g=b*a-e*d;if(!g)return null;g=1/g;c[0]=a*g;c[1]=-d*g;c[2]=-e*g;c[3]=b*g;return c},adjoint:function(c,a){var b=a[0];c[0]=a[3];c[1]=-a[1];c[2]=-a[2];c[3]=b;return c},determinant:function(c){return c[0]*c[3]-c[2]*c[1]},multiply:function(c,a,b){var d=a[0],e=a[1],g=a[2];a=a[3];var h=b[0],m=b[1],p=b[2];b=b[3];c[0]=d*h+g*m;c[1]=e*h+a*m;c[2]=d*p+g*b;c[3]=e*p+a*b;return c}};
h.mul=h.multiply;h.rotate=function(c,a,b){var d=a[0],e=a[1],g=a[2];a=a[3];var h=Math.sin(b);b=Math.cos(b);c[0]=d*b+g*h;c[1]=e*b+a*h;c[2]=d*-h+g*b;c[3]=e*-h+a*b;return c};h.scale=function(c,a,b){var d=a[1],e=a[2],g=a[3],h=b[0];b=b[1];c[0]=a[0]*h;c[1]=d*h;c[2]=e*b;c[3]=g*b;return c};h.fromRotation=function(c,a){var b=Math.sin(a);a=Math.cos(a);c[0]=a;c[1]=b;c[2]=-b;c[3]=a;return c};h.fromScaling=function(c,a){c[0]=a[0];c[1]=0;c[2]=0;c[3]=a[1];return c};h.str=function(c){return"mat2("+c[0]+", "+c[1]+
", "+c[2]+", "+c[3]+")"};h.frob=function(c){return Math.sqrt(Math.pow(c[0],2)+Math.pow(c[1],2)+Math.pow(c[2],2)+Math.pow(c[3],2))};h.LDU=function(c,a,b,d){c[2]=d[2]/d[0];b[0]=d[0];b[1]=d[1];b[3]=d[3]-c[2]*b[1];return[c,a,b]};h.add=function(c,a,b){c[0]=a[0]+b[0];c[1]=a[1]+b[1];c[2]=a[2]+b[2];c[3]=a[3]+b[3];return c};h.subtract=function(c,a,b){c[0]=a[0]-b[0];c[1]=a[1]-b[1];c[2]=a[2]-b[2];c[3]=a[3]-b[3];return c};h.sub=h.subtract;h.exactEquals=function(c,a){return c[0]===a[0]&&c[1]===a[1]&&c[2]===a[2]&&
c[3]===a[3]};h.equals=function(c,a){var b=c[0],d=c[1],e=c[2];c=c[3];var g=a[0],h=a[1],n=a[2];a=a[3];return Math.abs(b-g)<=m.EPSILON*Math.max(1,Math.abs(b),Math.abs(g))&&Math.abs(d-h)<=m.EPSILON*Math.max(1,Math.abs(d),Math.abs(h))&&Math.abs(e-n)<=m.EPSILON*Math.max(1,Math.abs(e),Math.abs(n))&&Math.abs(c-a)<=m.EPSILON*Math.max(1,Math.abs(c),Math.abs(a))};h.multiplyScalar=function(c,a,b){c[0]=a[0]*b;c[1]=a[1]*b;c[2]=a[2]*b;c[3]=a[3]*b;return c};h.multiplyScalarAndAdd=function(c,a,b,d){c[0]=a[0]+b[0]*
d;c[1]=a[1]+b[1]*d;c[2]=a[2]+b[2]*d;c[3]=a[3]+b[3]*d;return c};n.exports=h},function(n,h,c){var m=c(14);h={create:function(){var c=new m.ARRAY_TYPE(6);c[0]=1;c[1]=0;c[2]=0;c[3]=1;c[4]=0;c[5]=0;return c},clone:function(c){var a=new m.ARRAY_TYPE(6);a[0]=c[0];a[1]=c[1];a[2]=c[2];a[3]=c[3];a[4]=c[4];a[5]=c[5];return a},copy:function(c,a){c[0]=a[0];c[1]=a[1];c[2]=a[2];c[3]=a[3];c[4]=a[4];c[5]=a[5];return c},identity:function(c){c[0]=1;c[1]=0;c[2]=0;c[3]=1;c[4]=0;c[5]=0;return c},fromValues:function(c,
a,b,d,f,g){var e=new m.ARRAY_TYPE(6);e[0]=c;e[1]=a;e[2]=b;e[3]=d;e[4]=f;e[5]=g;return e},set:function(c,a,b,d,f,g,h){c[0]=a;c[1]=b;c[2]=d;c[3]=f;c[4]=g;c[5]=h;return c},invert:function(c,a){var b=a[0],d=a[1],e=a[2],g=a[3],h=a[4];a=a[5];var m=b*g-d*e;if(!m)return null;m=1/m;c[0]=g*m;c[1]=-d*m;c[2]=-e*m;c[3]=b*m;c[4]=(e*a-g*h)*m;c[5]=(d*h-b*a)*m;return c},determinant:function(c){return c[0]*c[3]-c[1]*c[2]},multiply:function(c,a,b){var d=a[0],e=a[1],g=a[2],h=a[3],m=a[4];a=a[5];var p=b[0],n=b[1],k=b[2],
v=b[3],t=b[4];b=b[5];c[0]=d*p+g*n;c[1]=e*p+h*n;c[2]=d*k+g*v;c[3]=e*k+h*v;c[4]=d*t+g*b+m;c[5]=e*t+h*b+a;return c}};h.mul=h.multiply;h.rotate=function(c,a,b){var d=a[0],e=a[1],g=a[2],h=a[3],m=a[4];a=a[5];var p=Math.sin(b);b=Math.cos(b);c[0]=d*b+g*p;c[1]=e*b+h*p;c[2]=d*-p+g*b;c[3]=e*-p+h*b;c[4]=m;c[5]=a;return c};h.scale=function(c,a,b){var d=a[1],e=a[2],g=a[3],h=a[4],m=a[5],p=b[0];b=b[1];c[0]=a[0]*p;c[1]=d*p;c[2]=e*b;c[3]=g*b;c[4]=h;c[5]=m;return c};h.translate=function(c,a,b){var d=a[0],e=a[1],g=a[2],
h=a[3],m=a[4];a=a[5];var p=b[0];b=b[1];c[0]=d;c[1]=e;c[2]=g;c[3]=h;c[4]=d*p+g*b+m;c[5]=e*p+h*b+a;return c};h.fromRotation=function(c,a){var b=Math.sin(a);a=Math.cos(a);c[0]=a;c[1]=b;c[2]=-b;c[3]=a;c[4]=0;c[5]=0;return c};h.fromScaling=function(c,a){c[0]=a[0];c[1]=0;c[2]=0;c[3]=a[1];c[4]=0;c[5]=0;return c};h.fromTranslation=function(c,a){c[0]=1;c[1]=0;c[2]=0;c[3]=1;c[4]=a[0];c[5]=a[1];return c};h.str=function(c){return"mat2d("+c[0]+", "+c[1]+", "+c[2]+", "+c[3]+", "+c[4]+", "+c[5]+")"};h.frob=function(c){return Math.sqrt(Math.pow(c[0],
2)+Math.pow(c[1],2)+Math.pow(c[2],2)+Math.pow(c[3],2)+Math.pow(c[4],2)+Math.pow(c[5],2)+1)};h.add=function(c,a,b){c[0]=a[0]+b[0];c[1]=a[1]+b[1];c[2]=a[2]+b[2];c[3]=a[3]+b[3];c[4]=a[4]+b[4];c[5]=a[5]+b[5];return c};h.subtract=function(c,a,b){c[0]=a[0]-b[0];c[1]=a[1]-b[1];c[2]=a[2]-b[2];c[3]=a[3]-b[3];c[4]=a[4]-b[4];c[5]=a[5]-b[5];return c};h.sub=h.subtract;h.multiplyScalar=function(c,a,b){c[0]=a[0]*b;c[1]=a[1]*b;c[2]=a[2]*b;c[3]=a[3]*b;c[4]=a[4]*b;c[5]=a[5]*b;return c};h.multiplyScalarAndAdd=function(c,
a,b,d){c[0]=a[0]+b[0]*d;c[1]=a[1]+b[1]*d;c[2]=a[2]+b[2]*d;c[3]=a[3]+b[3]*d;c[4]=a[4]+b[4]*d;c[5]=a[5]+b[5]*d;return c};h.exactEquals=function(c,a){return c[0]===a[0]&&c[1]===a[1]&&c[2]===a[2]&&c[3]===a[3]&&c[4]===a[4]&&c[5]===a[5]};h.equals=function(c,a){var b=c[0],d=c[1],e=c[2],g=c[3],h=c[4];c=c[5];var n=a[0],p=a[1],r=a[2],k=a[3],v=a[4];a=a[5];return Math.abs(b-n)<=m.EPSILON*Math.max(1,Math.abs(b),Math.abs(n))&&Math.abs(d-p)<=m.EPSILON*Math.max(1,Math.abs(d),Math.abs(p))&&Math.abs(e-r)<=m.EPSILON*
Math.max(1,Math.abs(e),Math.abs(r))&&Math.abs(g-k)<=m.EPSILON*Math.max(1,Math.abs(g),Math.abs(k))&&Math.abs(h-v)<=m.EPSILON*Math.max(1,Math.abs(h),Math.abs(v))&&Math.abs(c-a)<=m.EPSILON*Math.max(1,Math.abs(c),Math.abs(a))};n.exports=h},function(n,h,c){var m=c(14),e={scalar:{},SIMD:{},create:function(){var a=new m.ARRAY_TYPE(16);a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=1;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=1;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a},clone:function(a){var b=new m.ARRAY_TYPE(16);
b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];b[9]=a[9];b[10]=a[10];b[11]=a[11];b[12]=a[12];b[13]=a[13];b[14]=a[14];b[15]=a[15];return b},copy:function(a,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},fromValues:function(a,b,c,e,g,h,n,p,r,k,v,t,B,x,y,C){var d=new m.ARRAY_TYPE(16);d[0]=a;d[1]=b;d[2]=c;d[3]=e;d[4]=g;d[5]=
h;d[6]=n;d[7]=p;d[8]=r;d[9]=k;d[10]=v;d[11]=t;d[12]=B;d[13]=x;d[14]=y;d[15]=C;return d},set:function(a,b,c,e,g,h,m,p,n,k,v,t,B,x,y,C,A){a[0]=b;a[1]=c;a[2]=e;a[3]=g;a[4]=h;a[5]=m;a[6]=p;a[7]=n;a[8]=k;a[9]=v;a[10]=t;a[11]=B;a[12]=x;a[13]=y;a[14]=C;a[15]=A;return a},identity:function(a){a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=1;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=1;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a}};e.scalar.transpose=function(a,b){if(a===b){var c=b[1],e=b[2],g=b[3],h=b[6],m=b[7],p=b[11];
a[1]=b[4];a[2]=b[8];a[3]=b[12];a[4]=c;a[6]=b[9];a[7]=b[13];a[8]=e;a[9]=h;a[11]=b[14];a[12]=g;a[13]=m;a[14]=p}else 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};e.SIMD.transpose=function(a,b){var c,e,g,h,m,p;c=SIMD.Float32x4.load(b,0);e=SIMD.Float32x4.load(b,4);g=SIMD.Float32x4.load(b,8);b=SIMD.Float32x4.load(b,12);h=SIMD.Float32x4.shuffle(c,e,0,1,4,5);m=SIMD.Float32x4.shuffle(g,
b,0,1,4,5);p=SIMD.Float32x4.shuffle(h,m,0,2,4,6);h=SIMD.Float32x4.shuffle(h,m,1,3,5,7);SIMD.Float32x4.store(a,0,p);SIMD.Float32x4.store(a,4,h);h=SIMD.Float32x4.shuffle(c,e,2,3,6,7);m=SIMD.Float32x4.shuffle(g,b,2,3,6,7);c=SIMD.Float32x4.shuffle(h,m,0,2,4,6);e=SIMD.Float32x4.shuffle(h,m,1,3,5,7);SIMD.Float32x4.store(a,8,c);SIMD.Float32x4.store(a,12,e);return a};e.transpose=m.USE_SIMD?e.SIMD.transpose:e.scalar.transpose;e.scalar.invert=function(a,b){var c=b[0],e=b[1],g=b[2],h=b[3],m=b[4],p=b[5],n=b[6],
k=b[7],v=b[8],t=b[9],B=b[10],x=b[11],y=b[12],C=b[13],A=b[14];b=b[15];var D=c*p-e*m,F=c*n-g*m,G=c*k-h*m,z=e*n-g*p,L=e*k-h*p,J=g*k-h*n,I=v*C-t*y,E=v*A-B*y,U=v*b-x*y,V=t*A-B*C,R=t*b-x*C,P=B*b-x*A,T=D*P-F*R+G*V+z*U-L*E+J*I;if(!T)return null;T=1/T;a[0]=(p*P-n*R+k*V)*T;a[1]=(g*R-e*P-h*V)*T;a[2]=(C*J-A*L+b*z)*T;a[3]=(B*L-t*J-x*z)*T;a[4]=(n*U-m*P-k*E)*T;a[5]=(c*P-g*U+h*E)*T;a[6]=(A*G-y*J-b*F)*T;a[7]=(v*J-B*G+x*F)*T;a[8]=(m*R-p*U+k*I)*T;a[9]=(e*U-c*R-h*I)*T;a[10]=(y*L-C*G+b*D)*T;a[11]=(t*G-v*L-x*D)*T;a[12]=
(p*E-m*V-n*I)*T;a[13]=(c*V-e*E+g*I)*T;a[14]=(C*F-y*z-A*D)*T;a[15]=(v*z-t*F+B*D)*T;return a};e.SIMD.invert=function(a,b){var c,e,g,h,m,p,n,k;m=SIMD.Float32x4.load(b,0);p=SIMD.Float32x4.load(b,4);n=SIMD.Float32x4.load(b,8);k=SIMD.Float32x4.load(b,12);b=SIMD.Float32x4.shuffle(m,p,0,1,4,5);e=SIMD.Float32x4.shuffle(n,k,0,1,4,5);c=SIMD.Float32x4.shuffle(b,e,0,2,4,6);e=SIMD.Float32x4.shuffle(e,b,1,3,5,7);b=SIMD.Float32x4.shuffle(m,p,2,3,6,7);h=SIMD.Float32x4.shuffle(n,k,2,3,6,7);g=SIMD.Float32x4.shuffle(b,
h,0,2,4,6);h=SIMD.Float32x4.shuffle(h,b,1,3,5,7);b=SIMD.Float32x4.mul(g,h);b=SIMD.Float32x4.swizzle(b,1,0,3,2);m=SIMD.Float32x4.mul(e,b);p=SIMD.Float32x4.mul(c,b);b=SIMD.Float32x4.swizzle(b,2,3,0,1);m=SIMD.Float32x4.sub(SIMD.Float32x4.mul(e,b),m);p=SIMD.Float32x4.sub(SIMD.Float32x4.mul(c,b),p);p=SIMD.Float32x4.swizzle(p,2,3,0,1);b=SIMD.Float32x4.mul(e,g);b=SIMD.Float32x4.swizzle(b,1,0,3,2);m=SIMD.Float32x4.add(SIMD.Float32x4.mul(h,b),m);k=SIMD.Float32x4.mul(c,b);b=SIMD.Float32x4.swizzle(b,2,3,0,1);
m=SIMD.Float32x4.sub(m,SIMD.Float32x4.mul(h,b));k=SIMD.Float32x4.sub(SIMD.Float32x4.mul(c,b),k);k=SIMD.Float32x4.swizzle(k,2,3,0,1);b=SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(e,2,3,0,1),h);b=SIMD.Float32x4.swizzle(b,1,0,3,2);g=SIMD.Float32x4.swizzle(g,2,3,0,1);m=SIMD.Float32x4.add(SIMD.Float32x4.mul(g,b),m);n=SIMD.Float32x4.mul(c,b);b=SIMD.Float32x4.swizzle(b,2,3,0,1);m=SIMD.Float32x4.sub(m,SIMD.Float32x4.mul(g,b));n=SIMD.Float32x4.sub(SIMD.Float32x4.mul(c,b),n);n=SIMD.Float32x4.swizzle(n,2,3,0,
1);b=SIMD.Float32x4.mul(c,e);b=SIMD.Float32x4.swizzle(b,1,0,3,2);n=SIMD.Float32x4.add(SIMD.Float32x4.mul(h,b),n);k=SIMD.Float32x4.sub(SIMD.Float32x4.mul(g,b),k);b=SIMD.Float32x4.swizzle(b,2,3,0,1);n=SIMD.Float32x4.sub(SIMD.Float32x4.mul(h,b),n);k=SIMD.Float32x4.sub(k,SIMD.Float32x4.mul(g,b));b=SIMD.Float32x4.mul(c,h);b=SIMD.Float32x4.swizzle(b,1,0,3,2);p=SIMD.Float32x4.sub(p,SIMD.Float32x4.mul(g,b));n=SIMD.Float32x4.add(SIMD.Float32x4.mul(e,b),n);b=SIMD.Float32x4.swizzle(b,2,3,0,1);p=SIMD.Float32x4.add(SIMD.Float32x4.mul(g,
b),p);n=SIMD.Float32x4.sub(n,SIMD.Float32x4.mul(e,b));b=SIMD.Float32x4.mul(c,g);b=SIMD.Float32x4.swizzle(b,1,0,3,2);p=SIMD.Float32x4.add(SIMD.Float32x4.mul(h,b),p);k=SIMD.Float32x4.sub(k,SIMD.Float32x4.mul(e,b));b=SIMD.Float32x4.swizzle(b,2,3,0,1);p=SIMD.Float32x4.sub(p,SIMD.Float32x4.mul(h,b));k=SIMD.Float32x4.add(SIMD.Float32x4.mul(e,b),k);c=SIMD.Float32x4.mul(c,m);c=SIMD.Float32x4.add(SIMD.Float32x4.swizzle(c,2,3,0,1),c);c=SIMD.Float32x4.add(SIMD.Float32x4.swizzle(c,1,0,3,2),c);b=SIMD.Float32x4.reciprocalApproximation(c);
c=SIMD.Float32x4.sub(SIMD.Float32x4.add(b,b),SIMD.Float32x4.mul(c,SIMD.Float32x4.mul(b,b)));c=SIMD.Float32x4.swizzle(c,0,0,0,0);if(!c)return null;SIMD.Float32x4.store(a,0,SIMD.Float32x4.mul(c,m));SIMD.Float32x4.store(a,4,SIMD.Float32x4.mul(c,p));SIMD.Float32x4.store(a,8,SIMD.Float32x4.mul(c,n));SIMD.Float32x4.store(a,12,SIMD.Float32x4.mul(c,k));return a};e.invert=m.USE_SIMD?e.SIMD.invert:e.scalar.invert;e.scalar.adjoint=function(a,b){var c=b[0],e=b[1],g=b[2],h=b[3],m=b[4],p=b[5],n=b[6],k=b[7],v=b[8],
t=b[9],B=b[10],x=b[11],y=b[12],C=b[13],A=b[14];b=b[15];a[0]=p*(B*b-x*A)-t*(n*b-k*A)+C*(n*x-k*B);a[1]=-(e*(B*b-x*A)-t*(g*b-h*A)+C*(g*x-h*B));a[2]=e*(n*b-k*A)-p*(g*b-h*A)+C*(g*k-h*n);a[3]=-(e*(n*x-k*B)-p*(g*x-h*B)+t*(g*k-h*n));a[4]=-(m*(B*b-x*A)-v*(n*b-k*A)+y*(n*x-k*B));a[5]=c*(B*b-x*A)-v*(g*b-h*A)+y*(g*x-h*B);a[6]=-(c*(n*b-k*A)-m*(g*b-h*A)+y*(g*k-h*n));a[7]=c*(n*x-k*B)-m*(g*x-h*B)+v*(g*k-h*n);a[8]=m*(t*b-x*C)-v*(p*b-k*C)+y*(p*x-k*t);a[9]=-(c*(t*b-x*C)-v*(e*b-h*C)+y*(e*x-h*t));a[10]=c*(p*b-k*C)-m*(e*
b-h*C)+y*(e*k-h*p);a[11]=-(c*(p*x-k*t)-m*(e*x-h*t)+v*(e*k-h*p));a[12]=-(m*(t*A-B*C)-v*(p*A-n*C)+y*(p*B-n*t));a[13]=c*(t*A-B*C)-v*(e*A-g*C)+y*(e*B-g*t);a[14]=-(c*(p*A-n*C)-m*(e*A-g*C)+y*(e*n-g*p));a[15]=c*(p*B-n*t)-m*(e*B-g*t)+v*(e*n-g*p);return a};e.SIMD.adjoint=function(a,b){var c,e,g,h,m,p,n,k;c=SIMD.Float32x4.load(b,0);e=SIMD.Float32x4.load(b,4);g=SIMD.Float32x4.load(b,8);h=SIMD.Float32x4.load(b,12);p=SIMD.Float32x4.shuffle(c,e,0,1,4,5);m=SIMD.Float32x4.shuffle(g,h,0,1,4,5);b=SIMD.Float32x4.shuffle(p,
m,0,2,4,6);m=SIMD.Float32x4.shuffle(m,p,1,3,5,7);p=SIMD.Float32x4.shuffle(c,e,2,3,6,7);e=SIMD.Float32x4.shuffle(g,h,2,3,6,7);c=SIMD.Float32x4.shuffle(p,e,0,2,4,6);e=SIMD.Float32x4.shuffle(e,p,1,3,5,7);p=SIMD.Float32x4.mul(c,e);p=SIMD.Float32x4.swizzle(p,1,0,3,2);g=SIMD.Float32x4.mul(m,p);h=SIMD.Float32x4.mul(b,p);p=SIMD.Float32x4.swizzle(p,2,3,0,1);g=SIMD.Float32x4.sub(SIMD.Float32x4.mul(m,p),g);h=SIMD.Float32x4.sub(SIMD.Float32x4.mul(b,p),h);h=SIMD.Float32x4.swizzle(h,2,3,0,1);p=SIMD.Float32x4.mul(m,
c);p=SIMD.Float32x4.swizzle(p,1,0,3,2);g=SIMD.Float32x4.add(SIMD.Float32x4.mul(e,p),g);k=SIMD.Float32x4.mul(b,p);p=SIMD.Float32x4.swizzle(p,2,3,0,1);g=SIMD.Float32x4.sub(g,SIMD.Float32x4.mul(e,p));k=SIMD.Float32x4.sub(SIMD.Float32x4.mul(b,p),k);k=SIMD.Float32x4.swizzle(k,2,3,0,1);p=SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(m,2,3,0,1),e);p=SIMD.Float32x4.swizzle(p,1,0,3,2);c=SIMD.Float32x4.swizzle(c,2,3,0,1);g=SIMD.Float32x4.add(SIMD.Float32x4.mul(c,p),g);n=SIMD.Float32x4.mul(b,p);p=SIMD.Float32x4.swizzle(p,
2,3,0,1);g=SIMD.Float32x4.sub(g,SIMD.Float32x4.mul(c,p));n=SIMD.Float32x4.sub(SIMD.Float32x4.mul(b,p),n);n=SIMD.Float32x4.swizzle(n,2,3,0,1);p=SIMD.Float32x4.mul(b,m);p=SIMD.Float32x4.swizzle(p,1,0,3,2);n=SIMD.Float32x4.add(SIMD.Float32x4.mul(e,p),n);k=SIMD.Float32x4.sub(SIMD.Float32x4.mul(c,p),k);p=SIMD.Float32x4.swizzle(p,2,3,0,1);n=SIMD.Float32x4.sub(SIMD.Float32x4.mul(e,p),n);k=SIMD.Float32x4.sub(k,SIMD.Float32x4.mul(c,p));p=SIMD.Float32x4.mul(b,e);p=SIMD.Float32x4.swizzle(p,1,0,3,2);h=SIMD.Float32x4.sub(h,
SIMD.Float32x4.mul(c,p));n=SIMD.Float32x4.add(SIMD.Float32x4.mul(m,p),n);p=SIMD.Float32x4.swizzle(p,2,3,0,1);h=SIMD.Float32x4.add(SIMD.Float32x4.mul(c,p),h);n=SIMD.Float32x4.sub(n,SIMD.Float32x4.mul(m,p));p=SIMD.Float32x4.mul(b,c);p=SIMD.Float32x4.swizzle(p,1,0,3,2);h=SIMD.Float32x4.add(SIMD.Float32x4.mul(e,p),h);k=SIMD.Float32x4.sub(k,SIMD.Float32x4.mul(m,p));p=SIMD.Float32x4.swizzle(p,2,3,0,1);h=SIMD.Float32x4.sub(h,SIMD.Float32x4.mul(e,p));k=SIMD.Float32x4.add(SIMD.Float32x4.mul(m,p),k);SIMD.Float32x4.store(a,
0,g);SIMD.Float32x4.store(a,4,h);SIMD.Float32x4.store(a,8,n);SIMD.Float32x4.store(a,12,k);return a};e.adjoint=m.USE_SIMD?e.SIMD.adjoint:e.scalar.adjoint;e.determinant=function(a){var b=a[0],c=a[1],e=a[2],g=a[3],h=a[4],m=a[5],p=a[6],n=a[7],k=a[8],v=a[9],t=a[10],B=a[11],x=a[12],y=a[13],C=a[14];a=a[15];return(b*m-c*h)*(t*a-B*C)-(b*p-e*h)*(v*a-B*y)+(b*n-g*h)*(v*C-t*y)+(c*p-e*m)*(k*a-B*x)-(c*n-g*m)*(k*C-t*x)+(e*n-g*p)*(k*y-v*x)};e.SIMD.multiply=function(a,b,c){var d=SIMD.Float32x4.load(b,0),e=SIMD.Float32x4.load(b,
4),h=SIMD.Float32x4.load(b,8);b=SIMD.Float32x4.load(b,12);var m=SIMD.Float32x4.load(c,0),m=SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(m,0,0,0,0),d),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(m,1,1,1,1),e),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(m,2,2,2,2),h),SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(m,3,3,3,3),b))));SIMD.Float32x4.store(a,0,m);m=SIMD.Float32x4.load(c,4);m=SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(m,0,0,0,
0),d),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(m,1,1,1,1),e),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(m,2,2,2,2),h),SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(m,3,3,3,3),b))));SIMD.Float32x4.store(a,4,m);m=SIMD.Float32x4.load(c,8);m=SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(m,0,0,0,0),d),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(m,1,1,1,1),e),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(m,2,2,2,2),h),SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(m,
3,3,3,3),b))));SIMD.Float32x4.store(a,8,m);c=SIMD.Float32x4.load(c,12);d=SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(c,0,0,0,0),d),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(c,1,1,1,1),e),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(c,2,2,2,2),h),SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(c,3,3,3,3),b))));SIMD.Float32x4.store(a,12,d);return a};e.scalar.multiply=function(a,b,c){var d=b[0],e=b[1],h=b[2],m=b[3],p=b[4],n=b[5],k=b[6],v=b[7],t=b[8],B=b[9],
x=b[10],y=b[11],C=b[12],A=b[13],D=b[14];b=b[15];var F=c[0],G=c[1],z=c[2],L=c[3];a[0]=F*d+G*p+z*t+L*C;a[1]=F*e+G*n+z*B+L*A;a[2]=F*h+G*k+z*x+L*D;a[3]=F*m+G*v+z*y+L*b;F=c[4];G=c[5];z=c[6];L=c[7];a[4]=F*d+G*p+z*t+L*C;a[5]=F*e+G*n+z*B+L*A;a[6]=F*h+G*k+z*x+L*D;a[7]=F*m+G*v+z*y+L*b;F=c[8];G=c[9];z=c[10];L=c[11];a[8]=F*d+G*p+z*t+L*C;a[9]=F*e+G*n+z*B+L*A;a[10]=F*h+G*k+z*x+L*D;a[11]=F*m+G*v+z*y+L*b;F=c[12];G=c[13];z=c[14];L=c[15];a[12]=F*d+G*p+z*t+L*C;a[13]=F*e+G*n+z*B+L*A;a[14]=F*h+G*k+z*x+L*D;a[15]=F*m+G*
v+z*y+L*b;return a};e.multiply=m.USE_SIMD?e.SIMD.multiply:e.scalar.multiply;e.mul=e.multiply;e.scalar.translate=function(a,b,c){var d=c[0],e=c[1];c=c[2];var h,m,p,n,k,v,t,B,x,y,C,A;b===a?(a[12]=b[0]*d+b[4]*e+b[8]*c+b[12],a[13]=b[1]*d+b[5]*e+b[9]*c+b[13],a[14]=b[2]*d+b[6]*e+b[10]*c+b[14],a[15]=b[3]*d+b[7]*e+b[11]*c+b[15]):(h=b[0],m=b[1],p=b[2],n=b[3],k=b[4],v=b[5],t=b[6],B=b[7],x=b[8],y=b[9],C=b[10],A=b[11],a[0]=h,a[1]=m,a[2]=p,a[3]=n,a[4]=k,a[5]=v,a[6]=t,a[7]=B,a[8]=x,a[9]=y,a[10]=C,a[11]=A,a[12]=
h*d+k*e+x*c+b[12],a[13]=m*d+v*e+y*c+b[13],a[14]=p*d+t*e+C*c+b[14],a[15]=n*d+B*e+A*c+b[15]);return a};e.SIMD.translate=function(a,b,c){var d=SIMD.Float32x4.load(b,0),e=SIMD.Float32x4.load(b,4),h=SIMD.Float32x4.load(b,8),m=SIMD.Float32x4.load(b,12);c=SIMD.Float32x4(c[0],c[1],c[2],0);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]);d=SIMD.Float32x4.mul(d,SIMD.Float32x4.swizzle(c,0,0,0,0));e=SIMD.Float32x4.mul(e,SIMD.Float32x4.swizzle(c,
1,1,1,1));h=SIMD.Float32x4.mul(h,SIMD.Float32x4.swizzle(c,2,2,2,2));b=SIMD.Float32x4.add(d,SIMD.Float32x4.add(e,SIMD.Float32x4.add(h,m)));SIMD.Float32x4.store(a,12,b);return a};e.translate=m.USE_SIMD?e.SIMD.translate:e.scalar.translate;e.scalar.scale=function(a,b,c){var d=c[0],e=c[1];c=c[2];a[0]=b[0]*d;a[1]=b[1]*d;a[2]=b[2]*d;a[3]=b[3]*d;a[4]=b[4]*e;a[5]=b[5]*e;a[6]=b[6]*e;a[7]=b[7]*e;a[8]=b[8]*c;a[9]=b[9]*c;a[10]=b[10]*c;a[11]=b[11]*c;a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a};e.SIMD.scale=
function(a,b,c){var d;c=SIMD.Float32x4(c[0],c[1],c[2],0);d=SIMD.Float32x4.load(b,0);SIMD.Float32x4.store(a,0,SIMD.Float32x4.mul(d,SIMD.Float32x4.swizzle(c,0,0,0,0)));d=SIMD.Float32x4.load(b,4);SIMD.Float32x4.store(a,4,SIMD.Float32x4.mul(d,SIMD.Float32x4.swizzle(c,1,1,1,1)));d=SIMD.Float32x4.load(b,8);SIMD.Float32x4.store(a,8,SIMD.Float32x4.mul(d,SIMD.Float32x4.swizzle(c,2,2,2,2)));a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a};e.scale=m.USE_SIMD?e.SIMD.scale:e.scalar.scale;e.rotate=function(a,
b,c,e){var d=e[0],f=e[1];e=e[2];var h=Math.sqrt(d*d+f*f+e*e),p,n,k,v,t,B,x,y,C,A,D,F,G,z,L,J,I,E,U,V;if(Math.abs(h)<m.EPSILON)return null;h=1/h;d*=h;f*=h;e*=h;p=Math.sin(c);n=Math.cos(c);k=1-n;c=b[0];h=b[1];v=b[2];t=b[3];B=b[4];x=b[5];y=b[6];C=b[7];A=b[8];D=b[9];F=b[10];G=b[11];z=d*d*k+n;L=f*d*k+e*p;J=e*d*k-f*p;I=d*f*k-e*p;E=f*f*k+n;U=e*f*k+d*p;V=d*e*k+f*p;d=f*e*k-d*p;f=e*e*k+n;a[0]=c*z+B*L+A*J;a[1]=h*z+x*L+D*J;a[2]=v*z+y*L+F*J;a[3]=t*z+C*L+G*J;a[4]=c*I+B*E+A*U;a[5]=h*I+x*E+D*U;a[6]=v*I+y*E+F*U;a[7]=
t*I+C*E+G*U;a[8]=c*V+B*d+A*f;a[9]=h*V+x*d+D*f;a[10]=v*V+y*d+F*f;a[11]=t*V+C*d+G*f;b!==a&&(a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]);return a};e.scalar.rotateX=function(a,b,c){var d=Math.sin(c);c=Math.cos(c);var e=b[4],h=b[5],m=b[6],p=b[7],n=b[8],k=b[9],v=b[10],t=b[11];b!==a&&(a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]);a[4]=e*c+n*d;a[5]=h*c+k*d;a[6]=m*c+v*d;a[7]=p*c+t*d;a[8]=n*c-e*d;a[9]=k*c-h*d;a[10]=v*c-m*d;a[11]=t*c-p*d;return a};e.SIMD.rotateX=
function(a,b,c){var d=SIMD.Float32x4.splat(Math.sin(c));c=SIMD.Float32x4.splat(Math.cos(c));b!==a&&(a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]);var e=SIMD.Float32x4.load(b,4);b=SIMD.Float32x4.load(b,8);SIMD.Float32x4.store(a,4,SIMD.Float32x4.add(SIMD.Float32x4.mul(e,c),SIMD.Float32x4.mul(b,d)));SIMD.Float32x4.store(a,8,SIMD.Float32x4.sub(SIMD.Float32x4.mul(b,c),SIMD.Float32x4.mul(e,d)));return a};e.rotateX=m.USE_SIMD?e.SIMD.rotateX:e.scalar.rotateX;e.scalar.rotateY=
function(a,b,c){var d=Math.sin(c);c=Math.cos(c);var e=b[0],h=b[1],m=b[2],p=b[3],n=b[8],k=b[9],v=b[10],t=b[11];b!==a&&(a[4]=b[4],a[5]=b[5],a[6]=b[6],a[7]=b[7],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]);a[0]=e*c-n*d;a[1]=h*c-k*d;a[2]=m*c-v*d;a[3]=p*c-t*d;a[8]=e*d+n*c;a[9]=h*d+k*c;a[10]=m*d+v*c;a[11]=p*d+t*c;return a};e.SIMD.rotateY=function(a,b,c){var d=SIMD.Float32x4.splat(Math.sin(c));c=SIMD.Float32x4.splat(Math.cos(c));b!==a&&(a[4]=b[4],a[5]=b[5],a[6]=b[6],a[7]=b[7],a[12]=b[12],a[13]=b[13],
a[14]=b[14],a[15]=b[15]);var e=SIMD.Float32x4.load(b,0);b=SIMD.Float32x4.load(b,8);SIMD.Float32x4.store(a,0,SIMD.Float32x4.sub(SIMD.Float32x4.mul(e,c),SIMD.Float32x4.mul(b,d)));SIMD.Float32x4.store(a,8,SIMD.Float32x4.add(SIMD.Float32x4.mul(e,d),SIMD.Float32x4.mul(b,c)));return a};e.rotateY=m.USE_SIMD?e.SIMD.rotateY:e.scalar.rotateY;e.scalar.rotateZ=function(a,b,c){var d=Math.sin(c);c=Math.cos(c);var e=b[0],h=b[1],m=b[2],p=b[3],n=b[4],k=b[5],v=b[6],t=b[7];b!==a&&(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]);a[0]=e*c+n*d;a[1]=h*c+k*d;a[2]=m*c+v*d;a[3]=p*c+t*d;a[4]=n*c-e*d;a[5]=k*c-h*d;a[6]=v*c-m*d;a[7]=t*c-p*d;return a};e.SIMD.rotateZ=function(a,b,c){var d=SIMD.Float32x4.splat(Math.sin(c));c=SIMD.Float32x4.splat(Math.cos(c));b!==a&&(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]);var e=SIMD.Float32x4.load(b,0);b=SIMD.Float32x4.load(b,4);SIMD.Float32x4.store(a,0,SIMD.Float32x4.add(SIMD.Float32x4.mul(e,c),
SIMD.Float32x4.mul(b,d)));SIMD.Float32x4.store(a,4,SIMD.Float32x4.sub(SIMD.Float32x4.mul(b,c),SIMD.Float32x4.mul(e,d)));return a};e.rotateZ=m.USE_SIMD?e.SIMD.rotateZ:e.scalar.rotateZ;e.fromTranslation=function(a,b){a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=1;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=1;a[11]=0;a[12]=b[0];a[13]=b[1];a[14]=b[2];a[15]=1;return a};e.fromScaling=function(a,b){a[0]=b[0];a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=b[1];a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=b[2];a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=
1;return a};e.fromRotation=function(a,b,c){var d=c[0],e=c[1];c=c[2];var h=Math.sqrt(d*d+e*e+c*c),n;if(Math.abs(h)<m.EPSILON)return null;h=1/h;d*=h;e*=h;c*=h;h=Math.sin(b);b=Math.cos(b);n=1-b;a[0]=d*d*n+b;a[1]=e*d*n+c*h;a[2]=c*d*n-e*h;a[3]=0;a[4]=d*e*n-c*h;a[5]=e*e*n+b;a[6]=c*e*n+d*h;a[7]=0;a[8]=d*c*n+e*h;a[9]=e*c*n-d*h;a[10]=c*c*n+b;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};e.fromXRotation=function(a,b){var c=Math.sin(b);b=Math.cos(b);a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=b;a[6]=c;a[7]=
0;a[8]=0;a[9]=-c;a[10]=b;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};e.fromYRotation=function(a,b){var c=Math.sin(b);b=Math.cos(b);a[0]=b;a[1]=0;a[2]=-c;a[3]=0;a[4]=0;a[5]=1;a[6]=0;a[7]=0;a[8]=c;a[9]=0;a[10]=b;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};e.fromZRotation=function(a,b){var c=Math.sin(b);b=Math.cos(b);a[0]=b;a[1]=c;a[2]=0;a[3]=0;a[4]=-c;a[5]=b;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=1;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};e.fromRotationTranslation=function(a,b,c){var d=
b[0],e=b[1],h=b[2],m=b[3],p=d+d,n=e+e,k=h+h;b=d*p;var v=d*n,d=d*k,t=e*n,e=e*k,h=h*k,p=m*p,n=m*n,m=m*k;a[0]=1-(t+h);a[1]=v+m;a[2]=d-n;a[3]=0;a[4]=v-m;a[5]=1-(b+h);a[6]=e+p;a[7]=0;a[8]=d+n;a[9]=e-p;a[10]=1-(b+t);a[11]=0;a[12]=c[0];a[13]=c[1];a[14]=c[2];a[15]=1;return a};e.getTranslation=function(a,b){a[0]=b[12];a[1]=b[13];a[2]=b[14];return a};e.getRotation=function(a,b){var c=b[0]+b[5]+b[10];0<c?(c=2*Math.sqrt(c+1),a[3]=.25*c,a[0]=(b[6]-b[9])/c,a[1]=(b[8]-b[2])/c,a[2]=(b[1]-b[4])/c):b[0]>b[5]&b[0]>
b[10]?(c=2*Math.sqrt(1+b[0]-b[5]-b[10]),a[3]=(b[6]-b[9])/c,a[0]=.25*c,a[1]=(b[1]+b[4])/c,a[2]=(b[8]+b[2])/c):b[5]>b[10]?(c=2*Math.sqrt(1+b[5]-b[0]-b[10]),a[3]=(b[8]-b[2])/c,a[0]=(b[1]+b[4])/c,a[1]=.25*c,a[2]=(b[6]+b[9])/c):(c=2*Math.sqrt(1+b[10]-b[0]-b[5]),a[3]=(b[1]-b[4])/c,a[0]=(b[8]+b[2])/c,a[1]=(b[6]+b[9])/c,a[2]=.25*c);return a};e.fromRotationTranslationScale=function(a,b,c,e){var d=b[0],f=b[1],h=b[2],p=b[3],m=d+d,k=f+f,n=h+h;b=d*m;var t=d*k,d=d*n,B=f*k,f=f*n,h=h*n,m=p*m,k=p*k,p=p*n,n=e[0],x=
e[1];e=e[2];a[0]=(1-(B+h))*n;a[1]=(t+p)*n;a[2]=(d-k)*n;a[3]=0;a[4]=(t-p)*x;a[5]=(1-(b+h))*x;a[6]=(f+m)*x;a[7]=0;a[8]=(d+k)*e;a[9]=(f-m)*e;a[10]=(1-(b+B))*e;a[11]=0;a[12]=c[0];a[13]=c[1];a[14]=c[2];a[15]=1;return a};e.fromRotationTranslationScaleOrigin=function(a,b,c,e,g){var d=b[0],f=b[1],h=b[2],m=b[3],k=d+d,n=f+f,t=h+h;b=d*k;var B=d*n,d=d*t,x=f*n,f=f*t,h=h*t,k=m*k,n=m*n,m=m*t,t=e[0],y=e[1];e=e[2];var C=g[0],A=g[1];g=g[2];a[0]=(1-(x+h))*t;a[1]=(B+m)*t;a[2]=(d-n)*t;a[3]=0;a[4]=(B-m)*y;a[5]=(1-(b+h))*
y;a[6]=(f+k)*y;a[7]=0;a[8]=(d+n)*e;a[9]=(f-k)*e;a[10]=(1-(b+x))*e;a[11]=0;a[12]=c[0]+C-(a[0]*C+a[4]*A+a[8]*g);a[13]=c[1]+A-(a[1]*C+a[5]*A+a[9]*g);a[14]=c[2]+g-(a[2]*C+a[6]*A+a[10]*g);a[15]=1;return a};e.fromQuat=function(a,b){var c=b[0],e=b[1],g=b[2];b=b[3];var h=c+c,m=e+e,p=g+g,c=c*h,n=e*h,e=e*m,k=g*h,v=g*m,g=g*p,h=b*h,m=b*m;b*=p;a[0]=1-e-g;a[1]=n+b;a[2]=k-m;a[3]=0;a[4]=n-b;a[5]=1-c-g;a[6]=v+h;a[7]=0;a[8]=k+m;a[9]=v-h;a[10]=1-c-e;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};e.frustum=function(a,
b,c,e,g,h,m){var d=1/(c-b),f=1/(g-e),k=1/(h-m);a[0]=2*h*d;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=2*h*f;a[6]=0;a[7]=0;a[8]=(c+b)*d;a[9]=(g+e)*f;a[10]=(m+h)*k;a[11]=-1;a[12]=0;a[13]=0;a[14]=m*h*2*k;a[15]=0;return a};e.perspective=function(a,b,c,e,g){b=1/Math.tan(b/2);var d=1/(e-g);a[0]=b/c;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=b;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=(g+e)*d;a[11]=-1;a[12]=0;a[13]=0;a[14]=2*g*e*d;a[15]=0;return a};e.perspectiveFromFieldOfView=function(a,b,c,e){var d=Math.tan(b.upDegrees*Math.PI/180),
f=Math.tan(b.downDegrees*Math.PI/180),h=Math.tan(b.leftDegrees*Math.PI/180);b=Math.tan(b.rightDegrees*Math.PI/180);var p=2/(h+b),m=2/(d+f);a[0]=p;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=m;a[6]=0;a[7]=0;a[8]=-((h-b)*p*.5);a[9]=(d-f)*m*.5;a[10]=e/(c-e);a[11]=-1;a[12]=0;a[13]=0;a[14]=e*c/(c-e);a[15]=0;return a};e.ortho=function(a,b,c,e,g,h,m){var d=1/(b-c),f=1/(e-g),k=1/(h-m);a[0]=-2*d;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=-2*f;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=2*k;a[11]=0;a[12]=(b+c)*d;a[13]=(g+e)*f;a[14]=(m+h)*
k;a[15]=1;return a};e.lookAt=function(a,b,c,f){var d,h,n,p,r,k,v,t,B=b[0],x=b[1];b=b[2];n=f[0];p=f[1];h=f[2];v=c[0];f=c[1];d=c[2];if(Math.abs(B-v)<m.EPSILON&&Math.abs(x-f)<m.EPSILON&&Math.abs(b-d)<m.EPSILON)return e.identity(a);c=B-v;f=x-f;v=b-d;t=1/Math.sqrt(c*c+f*f+v*v);c*=t;f*=t;v*=t;d=p*v-h*f;h=h*c-n*v;n=n*f-p*c;(t=Math.sqrt(d*d+h*h+n*n))?(t=1/t,d*=t,h*=t,n*=t):n=h=d=0;p=f*n-v*h;r=v*d-c*n;k=c*h-f*d;(t=Math.sqrt(p*p+r*r+k*k))?(t=1/t,p*=t,r*=t,k*=t):k=r=p=0;a[0]=d;a[1]=p;a[2]=c;a[3]=0;a[4]=h;a[5]=
r;a[6]=f;a[7]=0;a[8]=n;a[9]=k;a[10]=v;a[11]=0;a[12]=-(d*B+h*x+n*b);a[13]=-(p*B+r*x+k*b);a[14]=-(c*B+f*x+v*b);a[15]=1;return a};e.str=function(a){return"mat4("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+", "+a[6]+", "+a[7]+", "+a[8]+", "+a[9]+", "+a[10]+", "+a[11]+", "+a[12]+", "+a[13]+", "+a[14]+", "+a[15]+")"};e.frob=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3],2)+Math.pow(a[4],2)+Math.pow(a[5],2)+Math.pow(a[6],2)+Math.pow(a[7],2)+Math.pow(a[8],
2)+Math.pow(a[9],2)+Math.pow(a[10],2)+Math.pow(a[11],2)+Math.pow(a[12],2)+Math.pow(a[13],2)+Math.pow(a[14],2)+Math.pow(a[15],2))};e.add=function(a,b,c){a[0]=b[0]+c[0];a[1]=b[1]+c[1];a[2]=b[2]+c[2];a[3]=b[3]+c[3];a[4]=b[4]+c[4];a[5]=b[5]+c[5];a[6]=b[6]+c[6];a[7]=b[7]+c[7];a[8]=b[8]+c[8];a[9]=b[9]+c[9];a[10]=b[10]+c[10];a[11]=b[11]+c[11];a[12]=b[12]+c[12];a[13]=b[13]+c[13];a[14]=b[14]+c[14];a[15]=b[15]+c[15];return a};e.subtract=function(a,b,c){a[0]=b[0]-c[0];a[1]=b[1]-c[1];a[2]=b[2]-c[2];a[3]=b[3]-
c[3];a[4]=b[4]-c[4];a[5]=b[5]-c[5];a[6]=b[6]-c[6];a[7]=b[7]-c[7];a[8]=b[8]-c[8];a[9]=b[9]-c[9];a[10]=b[10]-c[10];a[11]=b[11]-c[11];a[12]=b[12]-c[12];a[13]=b[13]-c[13];a[14]=b[14]-c[14];a[15]=b[15]-c[15];return a};e.sub=e.subtract;e.multiplyScalar=function(a,b,c){a[0]=b[0]*c;a[1]=b[1]*c;a[2]=b[2]*c;a[3]=b[3]*c;a[4]=b[4]*c;a[5]=b[5]*c;a[6]=b[6]*c;a[7]=b[7]*c;a[8]=b[8]*c;a[9]=b[9]*c;a[10]=b[10]*c;a[11]=b[11]*c;a[12]=b[12]*c;a[13]=b[13]*c;a[14]=b[14]*c;a[15]=b[15]*c;return a};e.multiplyScalarAndAdd=function(a,
b,c,e){a[0]=b[0]+c[0]*e;a[1]=b[1]+c[1]*e;a[2]=b[2]+c[2]*e;a[3]=b[3]+c[3]*e;a[4]=b[4]+c[4]*e;a[5]=b[5]+c[5]*e;a[6]=b[6]+c[6]*e;a[7]=b[7]+c[7]*e;a[8]=b[8]+c[8]*e;a[9]=b[9]+c[9]*e;a[10]=b[10]+c[10]*e;a[11]=b[11]+c[11]*e;a[12]=b[12]+c[12]*e;a[13]=b[13]+c[13]*e;a[14]=b[14]+c[14]*e;a[15]=b[15]+c[15]*e;return a};e.exactEquals=function(a,b){return 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]};e.equals=function(a,b){var c=a[0],e=a[1],g=a[2],h=a[3],n=a[4],p=a[5],r=a[6],k=a[7],v=a[8],t=a[9],B=a[10],x=a[11],y=a[12],C=a[13],A=a[14];a=a[15];var D=b[0],F=b[1],G=b[2],z=b[3],L=b[4],J=b[5],I=b[6],E=b[7],U=b[8],V=b[9],R=b[10],P=b[11],T=b[12],ca=b[13],ga=b[14];b=b[15];return Math.abs(c-D)<=m.EPSILON*Math.max(1,Math.abs(c),Math.abs(D))&&Math.abs(e-F)<=m.EPSILON*Math.max(1,Math.abs(e),Math.abs(F))&&Math.abs(g-G)<=m.EPSILON*Math.max(1,Math.abs(g),
Math.abs(G))&&Math.abs(h-z)<=m.EPSILON*Math.max(1,Math.abs(h),Math.abs(z))&&Math.abs(n-L)<=m.EPSILON*Math.max(1,Math.abs(n),Math.abs(L))&&Math.abs(p-J)<=m.EPSILON*Math.max(1,Math.abs(p),Math.abs(J))&&Math.abs(r-I)<=m.EPSILON*Math.max(1,Math.abs(r),Math.abs(I))&&Math.abs(k-E)<=m.EPSILON*Math.max(1,Math.abs(k),Math.abs(E))&&Math.abs(v-U)<=m.EPSILON*Math.max(1,Math.abs(v),Math.abs(U))&&Math.abs(t-V)<=m.EPSILON*Math.max(1,Math.abs(t),Math.abs(V))&&Math.abs(B-R)<=m.EPSILON*Math.max(1,Math.abs(B),Math.abs(R))&&
Math.abs(x-P)<=m.EPSILON*Math.max(1,Math.abs(x),Math.abs(P))&&Math.abs(y-T)<=m.EPSILON*Math.max(1,Math.abs(y),Math.abs(T))&&Math.abs(C-ca)<=m.EPSILON*Math.max(1,Math.abs(C),Math.abs(ca))&&Math.abs(A-ga)<=m.EPSILON*Math.max(1,Math.abs(A),Math.abs(ga))&&Math.abs(a-b)<=m.EPSILON*Math.max(1,Math.abs(a),Math.abs(b))};n.exports=e},function(n,h,c){var m=c(14),e=c(79),a=c(80);h=c(81);var b={create:function(){var a=new m.ARRAY_TYPE(4);a[0]=0;a[1]=0;a[2]=0;a[3]=1;return a}};b.rotationTo=function(){var c=a.create(),
e=a.fromValues(1,0,0),g=a.fromValues(0,1,0);return function(d,f,h){var l=a.dot(f,h);if(-.999999>l)return a.cross(c,e,f),1E-6>a.length(c)&&a.cross(c,g,f),a.normalize(c,c),b.setAxisAngle(d,c,Math.PI),d;if(.999999<l)return d[0]=0,d[1]=0,d[2]=0,d[3]=1,d;a.cross(c,f,h);d[0]=c[0];d[1]=c[1];d[2]=c[2];d[3]=1+l;return b.normalize(d,d)}}();b.setAxes=function(){var a=e.create();return function(c,d,e,h){a[0]=e[0];a[3]=e[1];a[6]=e[2];a[1]=h[0];a[4]=h[1];a[7]=h[2];a[2]=-d[0];a[5]=-d[1];a[8]=-d[2];return b.normalize(c,
b.fromMat3(c,a))}}();b.clone=h.clone;b.fromValues=h.fromValues;b.copy=h.copy;b.set=h.set;b.identity=function(a){a[0]=0;a[1]=0;a[2]=0;a[3]=1;return a};b.setAxisAngle=function(a,b,c){c*=.5;var d=Math.sin(c);a[0]=d*b[0];a[1]=d*b[1];a[2]=d*b[2];a[3]=Math.cos(c);return a};b.getAxisAngle=function(a,b){var c=2*Math.acos(b[3]),d=Math.sin(c/2);0!=d?(a[0]=b[0]/d,a[1]=b[1]/d,a[2]=b[2]/d):(a[0]=1,a[1]=0,a[2]=0);return c};b.add=h.add;b.multiply=function(a,b,c){var d=b[0],e=b[1],f=b[2];b=b[3];var g=c[0],h=c[1],
m=c[2];c=c[3];a[0]=d*c+b*g+e*m-f*h;a[1]=e*c+b*h+f*g-d*m;a[2]=f*c+b*m+d*h-e*g;a[3]=b*c-d*g-e*h-f*m;return a};b.mul=b.multiply;b.scale=h.scale;b.rotateX=function(a,b,c){c*=.5;var d=b[0],e=b[1],f=b[2];b=b[3];var g=Math.sin(c);c=Math.cos(c);a[0]=d*c+b*g;a[1]=e*c+f*g;a[2]=f*c-e*g;a[3]=b*c-d*g;return a};b.rotateY=function(a,b,c){c*=.5;var d=b[0],e=b[1],f=b[2];b=b[3];var g=Math.sin(c);c=Math.cos(c);a[0]=d*c-f*g;a[1]=e*c+b*g;a[2]=f*c+d*g;a[3]=b*c-e*g;return a};b.rotateZ=function(a,b,c){c*=.5;var d=b[0],e=
b[1],f=b[2];b=b[3];var g=Math.sin(c);c=Math.cos(c);a[0]=d*c+e*g;a[1]=e*c-d*g;a[2]=f*c+b*g;a[3]=b*c-f*g;return a};b.calculateW=function(a,b){var c=b[0],d=b[1];b=b[2];a[0]=c;a[1]=d;a[2]=b;a[3]=Math.sqrt(Math.abs(1-c*c-d*d-b*b));return a};b.dot=h.dot;b.lerp=h.lerp;b.slerp=function(a,b,c,e){var d=b[0],f=b[1],g=b[2];b=b[3];var h=c[0],l=c[1],m=c[2];c=c[3];var n,x,y;x=d*h+f*l+g*m+b*c;0>x&&(x=-x,h=-h,l=-l,m=-m,c=-c);1E-6<1-x?(n=Math.acos(x),y=Math.sin(n),x=Math.sin((1-e)*n)/y,e=Math.sin(e*n)/y):x=1-e;a[0]=
x*d+e*h;a[1]=x*f+e*l;a[2]=x*g+e*m;a[3]=x*b+e*c;return a};b.sqlerp=function(){var a=b.create(),c=b.create();return function(d,e,f,h,m,k){b.slerp(a,e,m,k);b.slerp(c,f,h,k);b.slerp(d,a,c,2*k*(1-k));return d}}();b.invert=function(a,b){var c=b[0],d=b[1],e=b[2];b=b[3];var f=c*c+d*d+e*e+b*b,f=f?1/f:0;a[0]=-c*f;a[1]=-d*f;a[2]=-e*f;a[3]=b*f;return a};b.conjugate=function(a,b){a[0]=-b[0];a[1]=-b[1];a[2]=-b[2];a[3]=b[3];return a};b.length=h.length;b.len=b.length;b.squaredLength=h.squaredLength;b.sqrLen=b.squaredLength;
b.normalize=h.normalize;b.fromMat3=function(a,b){var c=b[0]+b[4]+b[8];if(0<c)c=Math.sqrt(c+1),a[3]=.5*c,c=.5/c,a[0]=(b[5]-b[7])*c,a[1]=(b[6]-b[2])*c,a[2]=(b[1]-b[3])*c;else{var d=0;b[4]>b[0]&&(d=1);b[8]>b[3*d+d]&&(d=2);var e=(d+1)%3,f=(d+2)%3,c=Math.sqrt(b[3*d+d]-b[3*e+e]-b[3*f+f]+1);a[d]=.5*c;c=.5/c;a[3]=(b[3*e+f]-b[3*f+e])*c;a[e]=(b[3*e+d]+b[3*d+e])*c;a[f]=(b[3*f+d]+b[3*d+f])*c}return a};b.str=function(a){return"quat("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"};b.exactEquals=h.exactEquals;b.equals=
h.equals;n.exports=b},function(n,h,c){var m=c(14),e={create:function(){var a=new m.ARRAY_TYPE(2);a[0]=0;a[1]=0;return a},clone:function(a){var b=new m.ARRAY_TYPE(2);b[0]=a[0];b[1]=a[1];return b},fromValues:function(a,b){var c=new m.ARRAY_TYPE(2);c[0]=a;c[1]=b;return c},copy:function(a,b){a[0]=b[0];a[1]=b[1];return a},set:function(a,b,c){a[0]=b;a[1]=c;return a},add:function(a,b,c){a[0]=b[0]+c[0];a[1]=b[1]+c[1];return a},subtract:function(a,b,c){a[0]=b[0]-c[0];a[1]=b[1]-c[1];return a}};e.sub=e.subtract;
e.multiply=function(a,b,c){a[0]=b[0]*c[0];a[1]=b[1]*c[1];return a};e.mul=e.multiply;e.divide=function(a,b,c){a[0]=b[0]/c[0];a[1]=b[1]/c[1];return a};e.div=e.divide;e.ceil=function(a,b){a[0]=Math.ceil(b[0]);a[1]=Math.ceil(b[1]);return a};e.floor=function(a,b){a[0]=Math.floor(b[0]);a[1]=Math.floor(b[1]);return a};e.min=function(a,b,c){a[0]=Math.min(b[0],c[0]);a[1]=Math.min(b[1],c[1]);return a};e.max=function(a,b,c){a[0]=Math.max(b[0],c[0]);a[1]=Math.max(b[1],c[1]);return a};e.round=function(a,b){a[0]=
Math.round(b[0]);a[1]=Math.round(b[1]);return a};e.scale=function(a,b,c){a[0]=b[0]*c;a[1]=b[1]*c;return a};e.scaleAndAdd=function(a,b,c,e){a[0]=b[0]+c[0]*e;a[1]=b[1]+c[1]*e;return a};e.distance=function(a,b){var c=b[0]-a[0];a=b[1]-a[1];return Math.sqrt(c*c+a*a)};e.dist=e.distance;e.squaredDistance=function(a,b){var c=b[0]-a[0];a=b[1]-a[1];return c*c+a*a};e.sqrDist=e.squaredDistance;e.length=function(a){var b=a[0];a=a[1];return Math.sqrt(b*b+a*a)};e.len=e.length;e.squaredLength=function(a){var b=a[0];
a=a[1];return b*b+a*a};e.sqrLen=e.squaredLength;e.negate=function(a,b){a[0]=-b[0];a[1]=-b[1];return a};e.inverse=function(a,b){a[0]=1/b[0];a[1]=1/b[1];return a};e.normalize=function(a,b){var c=b[0],e=b[1],c=c*c+e*e;0<c&&(c=1/Math.sqrt(c),a[0]=b[0]*c,a[1]=b[1]*c);return a};e.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]};e.cross=function(a,b,c){b=b[0]*c[1]-b[1]*c[0];a[0]=a[1]=0;a[2]=b;return a};e.lerp=function(a,b,c,e){var d=b[0];b=b[1];a[0]=d+e*(c[0]-d);a[1]=b+e*(c[1]-b);return a};e.random=function(a,
b){b=b||1;var c=2*m.RANDOM()*Math.PI;a[0]=Math.cos(c)*b;a[1]=Math.sin(c)*b;return a};e.transformMat2=function(a,b,c){var d=b[0];b=b[1];a[0]=c[0]*d+c[2]*b;a[1]=c[1]*d+c[3]*b;return a};e.transformMat2d=function(a,b,c){var d=b[0];b=b[1];a[0]=c[0]*d+c[2]*b+c[4];a[1]=c[1]*d+c[3]*b+c[5];return a};e.transformMat3=function(a,b,c){var d=b[0];b=b[1];a[0]=c[0]*d+c[3]*b+c[6];a[1]=c[1]*d+c[4]*b+c[7];return a};e.transformMat4=function(a,b,c){var d=b[0];b=b[1];a[0]=c[0]*d+c[4]*b+c[12];a[1]=c[1]*d+c[5]*b+c[13];return a};
e.forEach=function(){var a=e.create();return function(b,c,e,g,h,m){c||(c=2);e||(e=0);for(g=g?Math.min(g*c+e,b.length):b.length;e<g;e+=c)a[0]=b[e],a[1]=b[e+1],h(a,a,m),b[e]=a[0],b[e+1]=a[1];return b}}();e.str=function(a){return"vec2("+a[0]+", "+a[1]+")"};e.exactEquals=function(a,b){return a[0]===b[0]&&a[1]===b[1]};e.equals=function(a,b){var c=a[0];a=a[1];var e=b[0];b=b[1];return Math.abs(c-e)<=m.EPSILON*Math.max(1,Math.abs(c),Math.abs(e))&&Math.abs(a-b)<=m.EPSILON*Math.max(1,Math.abs(a),Math.abs(b))};
n.exports=e},function(n,h){n.exports=function(c){function h(a){var b={};a=a.split(" ");for(var c=0;c<a.length;++c)b[a[c]]=!0;return b}c.defineMode("glsl",function(b,c){function d(a,b){var c=a.next();if(y[c]){var d=y[c](a,b);if(!1!==d)return d}if('"'==c||"'"==c)return b.tokenize=g(c),b.tokenize(a,b);if(/[\[\]{}\(\),;\:\.]/.test(c))return D=c,"bracket";if(/\d/.test(c))return a.eatWhile(/[\w\.]/),"number";if("/"==c){if(a.eat("*"))return b.tokenize=l,l(a,b);if(a.eat("/"))return a.skipToEnd(),"comment"}if("#"==
c)return a.eatWhile(/[\S]+/),a.eatWhile(/[\s]+/),a.eatWhile(/[\S]+/),a.eatWhile(/[\s]+/),"comment";if(A.test(c))return a.eatWhile(A),"operator";a.eatWhile(/[\w\$_]/);a=a.current();return v.propertyIsEnumerable(a)?(B.propertyIsEnumerable(a)&&(D="newstatement"),"keyword"):t.propertyIsEnumerable(a)?"builtin":x.propertyIsEnumerable(a)?"atom":"word"}function g(a){return function(b,c){for(var e=!1,f,g=!1;null!=(f=b.next());){if(f==a&&!e){g=!0;break}e=!e&&"\\"==f}if(g||!e&&!C)c.tokenize=d;return"string"}}
function l(a,b){for(var c=!1,e;e=a.next();){if("/"==e&&c){b.tokenize=d;break}c="*"==e}return"comment"}function m(a,b,c,d,e){this.indented=a;this.column=b;this.type=c;this.align=d;this.prev=e}function p(a,b,c){return a.context=new m(a.indented,b,c,null,a.context)}function n(a){var b=a.context.type;if(")"==b||"]"==b||"}"==b)a.indented=a.context.indented;return a.context=a.context.prev}var k=b.indentUnit,v=c.keywords||h(e),t=c.builtins||h(a),B=c.blockKeywords||h("case do else for if switch while struct"),
x=c.atoms||h("null"),y=c.hooks||{},C=c.multiLineStrings,A=/[+\-*&%=<>!?|\/]/,D;return{startState:function(a){return{tokenize:null,context:new m((a||0)-k,0,"top",!1),indented:0,startOfLine:!0}},token:function(a,b){var c=b.context;a.sol()&&(null==c.align&&(c.align=!1),b.indented=a.indentation(),b.startOfLine=!0);if(a.eatSpace())return null;D=null;var e=(b.tokenize||d)(a,b);if("comment"==e||"meta"==e)return e;null==c.align&&(c.align=!0);if(";"!=D&&":"!=D||"statement"!=c.type)if("{"==D)p(b,a.column(),
"}");else if("["==D)p(b,a.column(),"]");else if("("==D)p(b,a.column(),")");else if("}"==D){for(;"statement"==c.type;)c=n(b);for("}"==c.type&&(c=n(b));"statement"==c.type;)c=n(b)}else D==c.type?n(b):("}"==c.type||"top"==c.type||"statement"==c.type&&"newstatement"==D)&&p(b,a.column(),"statement");else n(b);b.startOfLine=!1;return e},indent:function(a,b){if(a.tokenize!=d&&null!=a.tokenize)return 0;b=b&&b.charAt(0);a=a.context;var c=b==a.type;return"statement"==a.type?a.indented+("{"==b?0:k):a.align?
a.column+(c?0:1):a.indented+(c?0:k)},electricChars:"{}"}});var e="attribute const uniform varying break continue do for while if else in out inout float int void bool true false lowp mediump highp precision invariant discard return mat2 mat3 mat4 vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 sampler2D samplerCube struct gl_FragCoord gl_FragColor",a="radians degrees sin cos tan asin acos atan pow exp log exp2 log2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not dFdx dFdy fwidth texture2D texture2DProj texture2DLod texture2DProjLod textureCube textureCubeLod require export";
c.defineMIME("text/x-glsl",{name:"glsl",keywords:h(e),builtins:h(a),blockKeywords:h("case do else for if switch while struct"),atoms:h("null"),hooks:{"#":function(a,c){if(!c.startOfLine)return!1;a.skipToEnd();return"meta"}}})}},function(n,h,c){h=c(82);var m=c(186),e=c(187),a=h?h.toStringTag:void 0;n.exports=function(b){return null==b?void 0===b?"[object Undefined]":"[object Null]":a&&a in Object(b)?m(b):e(b)}},function(n,h,c){(function(c){n.exports="object"==typeof c&&c&&c.Object===Object&&c}).call(h,
c(194))},function(n,h,c){h=c(82);c=Object.prototype;var m=c.hasOwnProperty,e=c.toString,a=h?h.toStringTag:void 0;n.exports=function(b){var c=m.call(b,a),f=b[a];try{b[a]=void 0;var g=!0}catch(u){}var h=e.call(b);g&&(c?b[a]=f:delete b[a]);return h}},function(n,h){var c=Object.prototype.toString;n.exports=function(h){return c.call(h)}},function(n,h){n.exports=function(c){return null!=c&&"object"==typeof c}},function(n,h,c){var m=c(184),e=c(188);n.exports=function(a){return"symbol"==typeof a||e(a)&&"[object Symbol]"==
m(a)}},function(n,h,c){var m=c(83);n.exports=function(){return m.Date.now()}},function(n,h,c){var m=c(20),e=c(49);n.exports=function(a,b,c){var d=!0,g=!0;if("function"!=typeof a)throw new TypeError("Expected a function");e(c)&&(d="leading"in c?!!c.leading:d,g="trailing"in c?!!c.trailing:g);return m(a,b,{leading:d,maxWait:b,trailing:g})}},function(n,h,c){var m=c(49),e=c(189),a=0/0,b=/^\s+|\s+$/g,d=/^[-+]0x[0-9a-f]+$/i,f=/^0b[01]+$/i,g=/^0o[0-7]+$/i,l=parseInt;n.exports=function(c){if("number"==typeof c)return c;
if(e(c))return a;m(c)&&(c="function"==typeof c.valueOf?c.valueOf():c,c=m(c)?c+"":c);if("string"!=typeof c)return 0===c?c:+c;c=c.replace(b,"");var h=f.test(c);return h||g.test(c)?l(c.slice(2),h?2:8):d.test(c)?a:+c}},function(n,h,c){var m,e;(function(a){!(m=a,e="function"===typeof m?m.call(h,c,h,n):m,void 0!==e&&(n.exports=e))})(function(){function a(a,b){if(!a||!a.nodeType||1!==a.nodeType)throw"Sortable: `el` must be HTMLElement, and not "+{}.toString.call(a);this.el=a;this.options=b=D({},b);a[Ga]=
this;var c={group:Math.random(),sort:!0,disabled:!1,store:null,handle:null,scroll:!0,scrollSensitivity:30,scrollSpeed:10,draggable:/[uo]l/i.test(a.nodeName)?"li":">*",ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,setData:function(a,b){a.setData("Text",b.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,
fallbackOffset:{x:0,y:0}},d;for(d in c)d in b||(b[d]=c[d]);yc(b);for(var e in this)"_"===e.charAt(0)&&"function"===typeof this[e]&&(this[e]=this[e].bind(this));this.nativeDraggable=b.forceFallback?!1:Fa;g(a,"mousedown",this._onTapStart);g(a,"touchstart",this._onTapStart);g(a,"pointerdown",this._onTapStart);this.nativeDraggable&&(g(a,"dragover",this),g(a,"dragenter",this));Ha.push(this._onDragOver);b.store&&this.sort(b.store.get(this))}function b(a,b){"clone"!==a.lastPullMode&&(b=!0);I&&I.state!==
b&&(p(I,"display",b?"none":""),!b&&I.state&&(a.options.group.revertClone?(E.insertBefore(I,U),a._animate(z,I)):E.insertBefore(I,z)),I.state=b)}function c(a,b,c){if(a){c=c||Y;do if(">*"===b&&a.parentNode===c||C(a,b))return a;while(a=e(a))}return null}function e(a){var b=a.host;return b&&b.nodeType?b:a.parentNode}function g(a,b,c){a.addEventListener(b,c,rb)}function h(a,b,c){a.removeEventListener(b,c,rb)}function m(a,b,c){if(a)if(a.classList)a.classList[c?"add":"remove"](b);else{var d=(" "+a.className+
" ").replace(Ta," ").replace(" "+b+" "," ");a.className=(d+(c?" "+b:"")).replace(Ta," ")}}function p(a,b,c){var d=a&&a.style;if(d){if(void 0===c)return Y.defaultView&&Y.defaultView.getComputedStyle?c=Y.defaultView.getComputedStyle(a,""):a.currentStyle&&(c=a.currentStyle),void 0===b?c:c[b];b in d||(b="-webkit-"+b);d[b]=c+("string"===typeof c?"":"px")}}function n(a,b,c){if(a){a=a.getElementsByTagName(b);b=0;var d=a.length;if(c)for(;b<d;b++)c(a[b],b);return a}return[]}function k(a,b,c,d,e,f,g){a=a||
b[Ga];var h=Y.createEvent("Event"),k=a.options,l="on"+c.charAt(0).toUpperCase()+c.substr(1);h.initEvent(c,!0,!0);h.to=b;h.from=e||b;h.item=d||b;h.clone=I;h.oldIndex=f;h.newIndex=g;b.dispatchEvent(h);k[l]&&k[l].call(a,h)}function v(a,b,c,d,e,f,g){var h,k=a[Ga],l=k.options.onMove,m;h=Y.createEvent("Event");h.initEvent("move",!0,!0);h.to=b;h.from=a;h.dragged=c;h.draggedRect=d;h.related=e||b;h.relatedRect=f||b.getBoundingClientRect();a.dispatchEvent(h);l&&(m=l.call(k,h,g));return m}function t(a){a.draggable=
!1}function B(){sb=!1}function x(a){a=a.tagName+a.className+a.src+a.href+a.textContent;for(var b=a.length,c=0;b--;)c+=a.charCodeAt(b);return c.toString(36)}function y(a,b){var c=0;if(!a||!a.parentNode)return-1;for(;a&&(a=a.previousElementSibling);)"TEMPLATE"===a.nodeName.toUpperCase()||">*"!==b&&!C(a,b)||c++;return c}function C(a,b){if(a){b=b.split(".");var c=b.shift().toUpperCase(),d=new RegExp("\\s("+b.join("|")+")(?=\\s)","g");return(""===c||a.nodeName.toUpperCase()==c)&&(!b.length||((" "+a.className+
" ").match(d)||[]).length==b.length)}return!1}function A(a,b){var c,d;return function(){void 0===c&&(c=arguments,d=this,setTimeout(function(){1===c.length?a.call(d,c[0]):a.apply(d,c);c=void 0},b))}}function D(a,b){if(a&&b)for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}function F(a){return gb?gb(a).clone(!0)[0]:Ja&&Ja.dom?Ja.dom(a).cloneNode(!0):a.cloneNode(!0)}function G(a){a=a.getElementsByTagName("input");for(var b=a.length;b--;){var c=a[b];c.checked&&ya.push(c)}}if("undefined"==typeof window||
!window.document)return function(){throw Error("Sortable.js requires a window with a document");};var z,L,J,I,E,U,V,R,P,T,ca,ga,H,O,da,pa,za,ka={},Q,wa,Aa,Ta=/\s+/g,Sb=/left|right|inline/,Ga="Sortable"+(new Date).getTime(),Ba=window,Y=Ba.document,Qb=Ba.parseInt,gb=Ba.jQuery||Ba.Zepto,Ja=Ba.Polymer,rb=!1,Fa=!!("draggable"in Y.createElement("div")),Pa=function(a){if(navigator.userAgent.match(/Trident.*rv[ :]?11\./))return!1;a=Y.createElement("x");a.style.cssText="pointer-events:auto";return"auto"===
a.style.pointerEvents}(),sb=!1,xa=Math.abs,Rb=Math.min,ya=[],Ha=[],Ub=A(function(a,b,c){if(c&&b.scroll){var d=c[Ga],e,f=b.scrollSensitivity,g=b.scrollSpeed,h=a.clientX,k=a.clientY,l=window.innerWidth,m=window.innerHeight,p,n,r,t;if(P!==c&&(R=b.scroll,P=c,T=b.scrollFn,!0===R)){R=c;do if(R.offsetWidth<R.scrollWidth||R.offsetHeight<R.scrollHeight)break;while(R=R.parentNode)}R&&(e=R,b=R.getBoundingClientRect(),p=(xa(b.right-h)<=f)-(xa(b.left-h)<=f),n=(xa(b.bottom-k)<=f)-(xa(b.top-k)<=f));p||n||(p=(l-
h<=f)-(h<=f),n=(m-k<=f)-(k<=f),(p||n)&&(e=Ba));if(ka.vx!==p||ka.vy!==n||ka.el!==e)ka.el=e,ka.vx=p,ka.vy=n,clearInterval(ka.pid),e&&(ka.pid=setInterval(function(){t=n?n*g:0;r=p?p*g:0;if("function"===typeof T)return T.call(d,r,t,a);e===Ba?Ba.scrollTo(Ba.pageXOffset+r,Ba.pageYOffset+t):(e.scrollTop+=t,e.scrollLeft+=r)},24))}},30),yc=function(a){function b(a,b){if(void 0===a||!0===a)a=c.name;return"function"===typeof a?a:function(c,d){c=d.options.group.name;return b?a:a&&(a.join?-1<a.indexOf(c):c==a)}}
var c={},d=a.group;d&&"object"==typeof d||(d={name:d});c.name=d.name;c.checkPull=b(d.pull,!0);c.checkPut=b(d.put);c.revertClone=d.revertClone;a.group=c};a.prototype={constructor:a,_onTapStart:function(a){var b=this,d=this.el,e=this.options,f=e.preventOnFilter,g=a.type,h=a.touches&&a.touches[0],l=(h||a).target,m=a.target.shadowRoot&&a.path[0]||l,p=e.filter,n;G(d);if(!(z||"mousedown"===g&&0!==a.button||e.disabled)&&(l=c(l,e.draggable,d))&&V!==l){n=y(l,e.draggable);if("function"===typeof p){if(p.call(this,
a,l,this)){k(b,m,"filter",l,d,n);f&&a.preventDefault();return}}else if(p&&(p=p.split(",").some(function(a){if(a=c(m,a.trim(),d))return k(b,a,"filter",l,d,n),!0}))){f&&a.preventDefault();return}e.handle&&!c(m,e.handle,d)||this._prepareDragStart(a,h,l,n)}},_prepareDragStart:function(a,b,c,d){var e=this,f=e.el,h=e.options,l=f.ownerDocument;c&&!z&&c.parentNode===f&&(Q=a,E=f,z=c,L=z.parentNode,U=z.nextSibling,V=c,pa=h.group,O=d,this._lastX=(b||a).clientX,this._lastY=(b||a).clientY,z.style["will-change"]=
"transform",c=function(){e._disableDelayedDrag();z.draggable=e.nativeDraggable;m(z,h.chosenClass,!0);e._triggerDragStart(a,b);k(e,E,"choose",z,E,O)},h.ignore.split(",").forEach(function(a){n(z,a.trim(),t)}),g(l,"mouseup",e._onDrop),g(l,"touchend",e._onDrop),g(l,"touchcancel",e._onDrop),g(l,"pointercancel",e._onDrop),g(l,"selectstart",e),h.delay?(g(l,"mouseup",e._disableDelayedDrag),g(l,"touchend",e._disableDelayedDrag),g(l,"touchcancel",e._disableDelayedDrag),g(l,"mousemove",e._disableDelayedDrag),
g(l,"touchmove",e._disableDelayedDrag),g(l,"pointermove",e._disableDelayedDrag),e._dragStartTimer=setTimeout(c,h.delay)):c())},_disableDelayedDrag:function(){var a=this.el.ownerDocument;clearTimeout(this._dragStartTimer);h(a,"mouseup",this._disableDelayedDrag);h(a,"touchend",this._disableDelayedDrag);h(a,"touchcancel",this._disableDelayedDrag);h(a,"mousemove",this._disableDelayedDrag);h(a,"touchmove",this._disableDelayedDrag);h(a,"pointermove",this._disableDelayedDrag)},_triggerDragStart:function(a,
b){(b=b||("touch"==a.pointerType?a:null))?(Q={target:z,clientX:b.clientX,clientY:b.clientY},this._onDragStart(Q,"touch")):this.nativeDraggable?(g(z,"dragend",this),g(E,"dragstart",this._onDragStart)):this._onDragStart(Q,!0);try{Y.selection?setTimeout(function(){Y.selection.empty()}):window.getSelection().removeAllRanges()}catch(Ac){}},_dragStarted:function(){if(E&&z){var b=this.options;m(z,b.ghostClass,!0);m(z,b.dragClass,!1);a.active=this;k(this,E,"start",z,E,O)}else this._nulling()},_emulateDragOver:function(){if(wa&&
(this._lastX!==wa.clientX||this._lastY!==wa.clientY)){this._lastX=wa.clientX;this._lastY=wa.clientY;Pa||p(J,"display","none");var a=Y.elementFromPoint(wa.clientX,wa.clientY),b=a,c=Ha.length;if(b){do{if(b[Ga]){for(;c--;)Ha[c]({clientX:wa.clientX,clientY:wa.clientY,target:a,rootEl:b});break}a=b}while(b=b.parentNode)}Pa||p(J,"display","")}},_onTouchMove:function(b){if(Q){var c=this.options,d=c.fallbackTolerance,e=c.fallbackOffset,c=b.touches?b.touches[0]:b,f=c.clientX-Q.clientX+e.x,e=c.clientY-Q.clientY+
e.y,f=b.touches?"translate3d("+f+"px,"+e+"px,0)":"translate("+f+"px,"+e+"px)";if(!a.active){if(d&&Rb(xa(c.clientX-this._lastX),xa(c.clientY-this._lastY))<d)return;this._dragStarted()}this._appendGhost();Aa=!0;wa=c;p(J,"webkitTransform",f);p(J,"mozTransform",f);p(J,"msTransform",f);p(J,"transform",f);b.preventDefault()}},_appendGhost:function(){if(!J){var a=z.getBoundingClientRect(),b=p(z),c=this.options;J=z.cloneNode(!0);m(J,c.ghostClass,!1);m(J,c.fallbackClass,!0);m(J,c.dragClass,!0);p(J,"top",a.top-
Qb(b.marginTop,10));p(J,"left",a.left-Qb(b.marginLeft,10));p(J,"width",a.width);p(J,"height",a.height);p(J,"opacity","0.8");p(J,"position","fixed");p(J,"zIndex","100000");p(J,"pointerEvents","none");c.fallbackOnBody&&Y.body.appendChild(J)||E.appendChild(J);b=J.getBoundingClientRect();p(J,"width",2*a.width-b.width);p(J,"height",2*a.height-b.height)}},_onDragStart:function(a,b){var c=a.dataTransfer,d=this.options;this._offUpEvents();pa.checkPull(this,this,z,a)&&(I=F(z),I.draggable=!1,I.style["will-change"]=
"",p(I,"display","none"),m(I,this.options.chosenClass,!1),E.insertBefore(I,z),k(this,E,"clone",z));m(z,d.dragClass,!0);b?("touch"===b?(g(Y,"touchmove",this._onTouchMove),g(Y,"touchend",this._onDrop),g(Y,"touchcancel",this._onDrop),g(Y,"pointermove",this._onTouchMove),g(Y,"pointerup",this._onDrop)):(g(Y,"mousemove",this._onTouchMove),g(Y,"mouseup",this._onDrop)),this._loopId=setInterval(this._emulateDragOver,50)):(c&&(c.effectAllowed="move",d.setData&&d.setData.call(this,c,z)),g(Y,"drop",this),setTimeout(this._dragStarted,
0))},_onDragOver:function(d){var e=this.el,f,g,h,k;g=this.options;f=g.group;var l=a.active,m=pa===f,n=!1,r=g.sort;void 0!==d.preventDefault&&(d.preventDefault(),!g.dragoverBubble&&d.stopPropagation());if(!z.animated&&(Aa=!0,l&&!g.disabled&&(m?r||(k=!E.contains(z)):za===this||(l.lastPullMode=pa.checkPull(this,l,z,d))&&f.checkPut(this,l,z,d))&&(void 0===d.rootEl||d.rootEl===this.el)&&(Ub(d,g,this.el),!sb)))if(f=c(d.target,g.draggable,e),g=z.getBoundingClientRect(),za!==this&&(za=this,n=!0),k)b(l,!0),
L=E,I||U?E.insertBefore(z,I||U):r||E.appendChild(z);else if(!(k=0===e.children.length||e.children[0]===J)&&(k=e===d.target)&&(f=e.lastElementChild,k=f.getBoundingClientRect(),k=f=(5<d.clientY-(k.top+k.height)||5<d.clientX-(k.right+k.width))&&f),k){if(f){if(f.animated)return;h=f.getBoundingClientRect()}b(l,m);!1!==v(E,e,z,g,f,h,d)&&(z.contains(e)||(e.appendChild(z),L=e),this._animate(g,z),f&&this._animate(h,f))}else if(f&&!f.animated&&f!==z&&void 0!==f.parentNode[Ga]){ca!==f&&(ca=f,ga=p(f),H=p(f.parentNode));
h=f.getBoundingClientRect();var t=h.right-h.left;k=h.bottom-h.top;var u=Sb.test(ga.cssFloat+ga.display)||"flex"==H.display&&0===H["flex-direction"].indexOf("row"),r=f.offsetWidth>z.offsetWidth,x=f.offsetHeight>z.offsetHeight,t=.5<(u?(d.clientX-h.left)/t:(d.clientY-h.top)/k),y=f.nextElementSibling,A=v(E,e,z,g,f,h,d),C=!1;!1!==A&&(sb=!0,setTimeout(B,30),b(l,m),1===A||-1===A?C=1===A:u?(l=z.offsetTop,m=f.offsetTop,C=l===m?f.previousElementSibling===z&&!r||t&&r:f.previousElementSibling===z||z.previousElementSibling===
f?.5<(d.clientY-h.top)/k:m>l):n||(C=y!==z&&!x||t&&x),z.contains(e)||(C&&!y?e.appendChild(z):f.parentNode.insertBefore(z,C?y:f)),L=z.parentNode,this._animate(g,z),this._animate(h,f))}},_animate:function(a,b){var c=this.options.animation;if(c){var d=b.getBoundingClientRect();1===a.nodeType&&(a=a.getBoundingClientRect());p(b,"transition","none");p(b,"transform","translate3d("+(a.left-d.left)+"px,"+(a.top-d.top)+"px,0)");b.offsetWidth;p(b,"transition","all "+c+"ms");p(b,"transform","translate3d(0,0,0)");
clearTimeout(b.animated);b.animated=setTimeout(function(){p(b,"transition","");p(b,"transform","");b.animated=!1},c)}},_offUpEvents:function(){var a=this.el.ownerDocument;h(Y,"touchmove",this._onTouchMove);h(Y,"pointermove",this._onTouchMove);h(a,"mouseup",this._onDrop);h(a,"touchend",this._onDrop);h(a,"pointerup",this._onDrop);h(a,"touchcancel",this._onDrop);h(a,"selectstart",this)},_onDrop:function(b){var c=this.el,d=this.options;clearInterval(this._loopId);clearInterval(ka.pid);clearTimeout(this._dragStartTimer);
h(Y,"mousemove",this._onTouchMove);this.nativeDraggable&&(h(Y,"drop",this),h(c,"dragstart",this._onDragStart));this._offUpEvents();if(b&&(Aa&&(b.preventDefault(),!d.dropBubble&&b.stopPropagation()),J&&J.parentNode.removeChild(J),(E===L||"clone"!==a.active.lastPullMode)&&I&&I.parentNode.removeChild(I),z&&(this.nativeDraggable&&h(z,"dragend",this),t(z),z.style["will-change"]="",m(z,this.options.ghostClass,!1),m(z,this.options.chosenClass,!1),E!==L?(da=y(z,d.draggable),0<=da&&(k(null,L,"add",z,E,O,da),
k(this,E,"remove",z,E,O,da),k(null,L,"sort",z,E,O,da),k(this,E,"sort",z,E,O,da))):z.nextSibling!==U&&(da=y(z,d.draggable),0<=da&&(k(this,E,"update",z,E,O,da),k(this,E,"sort",z,E,O,da))),a.active))){if(null==da||-1===da)da=O;k(this,E,"end",z,E,O,da);this.save()}this._nulling()},_nulling:function(){E=z=L=J=U=I=V=R=P=Q=wa=Aa=da=ca=ga=za=pa=a.active=null;ya.forEach(function(a){a.checked=!0});ya.length=0},handleEvent:function(a){switch(a.type){case "drop":case "dragend":this._onDrop(a);break;case "dragover":case "dragenter":z&&
(this._onDragOver(a),a.dataTransfer&&(a.dataTransfer.dropEffect="move"),a.preventDefault());break;case "selectstart":a.preventDefault()}},toArray:function(){for(var a=[],b,d=this.el.children,e=0,f=d.length,g=this.options;e<f;e++)b=d[e],c(b,g.draggable,this.el)&&a.push(b.getAttribute(g.dataIdAttr)||x(b));return a},sort:function(a){var b={},d=this.el;this.toArray().forEach(function(a,e){e=d.children[e];c(e,this.options.draggable,d)&&(b[a]=e)},this);a.forEach(function(a){b[a]&&(d.removeChild(b[a]),d.appendChild(b[a]))})},
save:function(){var a=this.options.store;a&&a.set(this)},closest:function(a,b){return c(a,b||this.options.draggable,this.el)},option:function(a,b){var c=this.options;if(void 0===b)return c[a];c[a]=b;"group"===a&&yc(c)},destroy:function(){var a=this.el;a[Ga]=null;h(a,"mousedown",this._onTapStart);h(a,"touchstart",this._onTapStart);h(a,"pointerdown",this._onTapStart);this.nativeDraggable&&(h(a,"dragover",this),h(a,"dragenter",this));Array.prototype.forEach.call(a.querySelectorAll("[draggable]"),function(a){a.removeAttribute("draggable")});
Ha.splice(Ha.indexOf(this._onDragOver),1);this._onDrop();this.el=a=null}};g(Y,"touchmove",function(b){a.active&&b.preventDefault()});try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:function(){rb={capture:!1,passive:!1}}}))}catch(zc){}a.utils={on:g,off:h,css:p,find:n,is:function(a,b){return!!c(a,b,a)},extend:D,throttle:A,closest:c,toggleClass:m,clone:F,index:y};a.create=function(b,c){return new a(b,c)};a.version="1.5.1";return a})},function(n,h){h=function(){return this}();
try{h=h||Function("return this")()||(0,eval)("this")}catch(c){"object"===typeof window&&(h=window)}n.exports=h},function(n,h,c){c(86);c(51);c(88);c(93);c(90);c(91);c(92);c(89);c(94);c(87);c(95);c(96);c(97);c(85);n.exports=c(84)}]);
