/*

 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.

 Copyright 2017 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.

 Copyright 2018 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.
 JSON v3.3.2 | http://bestiejs.github.io/json3 | Copyright 2012-2014, Kit Cambridge | http://kit.mit-license.org */
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(m,f,d){m!=Array.prototype&&m!=Object.prototype&&(m[f]=d.value)};$jscomp.getGlobal=function(m){return"undefined"!=typeof window&&window===m?m:"undefined"!=typeof global&&null!=global?global:m};$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(m){return $jscomp.SYMBOL_PREFIX+(m||"")+$jscomp.symbolCounter_++};
$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var m=$jscomp.global.Symbol.iterator;m||(m=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[m]&&$jscomp.defineProperty(Array.prototype,m,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}};$jscomp.arrayIterator=function(m){var f=0;return $jscomp.iteratorPrototype(function(){return f<m.length?{done:!1,value:m[f++]}:{done:!0}})};
$jscomp.iteratorPrototype=function(m){$jscomp.initSymbolIterator();m={next:m};m[$jscomp.global.Symbol.iterator]=function(){return this};return m};$jscomp.makeIterator=function(m){$jscomp.initSymbolIterator();$jscomp.initSymbol();$jscomp.initSymbolIterator();var f=m[Symbol.iterator];return f?f.call(m):$jscomp.arrayIterator(m)};$jscomp.arrayFromIterator=function(m){for(var f,d=[];!(f=m.next()).done;)d.push(f.value);return d};$jscomp.arrayFromIterable=function(m){return m instanceof Array?m:$jscomp.arrayFromIterator($jscomp.makeIterator(m))};
$jscomp.polyfill=function(m,f,d,u){if(f){d=$jscomp.global;m=m.split(".");for(u=0;u<m.length-1;u++){var p=m[u];p in d||(d[p]={});d=d[p]}m=m[m.length-1];u=d[m];f=f(u);f!=u&&null!=f&&$jscomp.defineProperty(d,m,{configurable:!0,writable:!0,value:f})}};$jscomp.polyfill("Number.isNaN",function(m){return m?m:function(f){return"number"===typeof f&&isNaN(f)}},"es6","es3");
$jscomp.polyfill("Number.isFinite",function(m){return m?m:function(f){return"number"!==typeof f?!1:!isNaN(f)&&Infinity!==f&&-Infinity!==f}},"es6","es3");$jscomp.iteratorFromArray=function(m,f){$jscomp.initSymbolIterator();m instanceof String&&(m+="");var d=0,u={next:function(){if(d<m.length){var p=d++;return{value:f(p,m[p]),done:!1}}u.next=function(){return{done:!0,value:void 0}};return u.next()}};u[Symbol.iterator]=function(){return u};return u};
$jscomp.polyfill("Array.prototype.keys",function(m){return m?m:function(){return $jscomp.iteratorFromArray(this,function(f){return f})}},"es6","es3");$jscomp.polyfill("Number.isInteger",function(m){return m?m:function(f){return Number.isFinite(f)?f===Math.floor(f):!1}},"es6","es3");
$jscomp.polyfill("Array.from",function(m){return m?m:function(f,d,u){$jscomp.initSymbolIterator();d=null!=d?d:function(a){return a};var p=[],q=f[Symbol.iterator];if("function"==typeof q)for(f=q.call(f);!(q=f.next()).done;)p.push(d.call(u,q.value));else{q=f.length;for(var a=0;a<q;a++)p.push(d.call(u,f[a]))}return p}},"es6","es3");$jscomp.owns=function(m,f){return Object.prototype.hasOwnProperty.call(m,f)};
$jscomp.polyfill("WeakMap",function(m){function f(a){$jscomp.owns(a,u)||$jscomp.defineProperty(a,u,{value:{}})}function d(a){var c=Object[a];c&&(Object[a]=function(a){f(a);return c(a)})}if(function(){if(!m||!Object.seal)return!1;try{var a=Object.seal({}),c=Object.seal({}),d=new m([[a,2],[c,3]]);if(2!=d.get(a)||3!=d.get(c))return!1;d.delete(a);d.set(c,4);return!d.has(a)&&4==d.get(c)}catch(v){return!1}}())return m;var u="$jscomp_hidden_"+Math.random().toString().substring(2);d("freeze");d("preventExtensions");
d("seal");var p=0,q=function(a){this.id_=(p+=Math.random()+1).toString();if(a){$jscomp.initSymbol();$jscomp.initSymbolIterator();a=$jscomp.makeIterator(a);for(var c;!(c=a.next()).done;)c=c.value,this.set(c[0],c[1])}};q.prototype.set=function(a,c){f(a);if(!$jscomp.owns(a,u))throw Error("WeakMap key fail: "+a);a[u][this.id_]=c;return this};q.prototype.get=function(a){return $jscomp.owns(a,u)?a[u][this.id_]:void 0};q.prototype.has=function(a){return $jscomp.owns(a,u)&&$jscomp.owns(a[u],this.id_)};q.prototype.delete=
function(a){return $jscomp.owns(a,u)&&$jscomp.owns(a[u],this.id_)?delete a[u][this.id_]:!1};return q},"es6","es3");$jscomp.MapEntry=function(){};
$jscomp.polyfill("Map",function(m){if(!$jscomp.ASSUME_NO_NATIVE_MAP&&function(){if(!m||!m.prototype.entries||"function"!=typeof Object.seal)return!1;try{var a=Object.seal({x:4}),d=new m($jscomp.makeIterator([[a,"s"]]));if("s"!=d.get(a)||1!=d.size||d.get({x:4})||d.set({x:4},"t")!=d||2!=d.size)return!1;var v=d.entries(),t=v.next();if(t.done||t.value[0]!=a||"s"!=t.value[1])return!1;t=v.next();return t.done||4!=t.value[0].x||"t"!=t.value[1]||!v.next().done?!1:!0}catch(l){return!1}}())return m;$jscomp.initSymbol();
$jscomp.initSymbolIterator();var f=new WeakMap,d=function(a){this.data_={};this.head_=q();this.size=0;if(a){a=$jscomp.makeIterator(a);for(var c;!(c=a.next()).done;)c=c.value,this.set(c[0],c[1])}};d.prototype.set=function(a,d){var c=u(this,a);c.list||(c.list=this.data_[c.id]=[]);c.entry?c.entry.value=d:(c.entry={next:this.head_,previous:this.head_.previous,head:this.head_,key:a,value:d},c.list.push(c.entry),this.head_.previous.next=c.entry,this.head_.previous=c.entry,this.size++);return this};d.prototype.delete=
function(a){a=u(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};d.prototype.clear=function(){this.data_={};this.head_=this.head_.previous=q();this.size=0};d.prototype.has=function(a){return!!u(this,a).entry};d.prototype.get=function(a){return(a=u(this,a).entry)&&a.value};d.prototype.entries=function(){return p(this,function(a){return[a.key,
a.value]})};d.prototype.keys=function(){return p(this,function(a){return a.key})};d.prototype.values=function(){return p(this,function(a){return a.value})};d.prototype.forEach=function(a,d){for(var c=this.entries(),t;!(t=c.next()).done;)t=t.value,a.call(d,t[1],t[0],this)};d.prototype[Symbol.iterator]=d.prototype.entries;var u=function(c,d){var n=d&&typeof d;"object"==n||"function"==n?f.has(d)?n=f.get(d):(n=""+ ++a,f.set(d,n)):n="p_"+d;var t=c.data_[n];if(t&&$jscomp.owns(c.data_,n))for(c=0;c<t.length;c++){var l=
t[c];if(d!==d&&l.key!==l.key||d===l.key)return{id:n,list:t,index:c,entry:l}}return{id:n,list:t,index:-1,entry:void 0}},p=function(a,d){var c=a.head_;return $jscomp.iteratorPrototype(function(){if(c){for(;c.head!=a.head_;)c=c.previous;for(;c.next!=c.head;)return c=c.next,{done:!1,value:d(c)};c=null}return{done:!0,value:void 0}})},q=function(){var a={};return a.previous=a.next=a.head=a},a=0;return d},"es6","es3");
$jscomp.checkStringArgs=function(m,f,d){if(null==m)throw new TypeError("The 'this' value for String.prototype."+d+" must not be null or undefined");if(f instanceof RegExp)throw new TypeError("First argument to String.prototype."+d+" must not be a regular expression");return m+""};
$jscomp.polyfill("String.prototype.startsWith",function(m){return m?m:function(f,d){var u=$jscomp.checkStringArgs(this,f,"startsWith");f+="";var p=u.length,q=f.length;d=Math.max(0,Math.min(d|0,u.length));for(var a=0;a<q&&d<p;)if(u[d++]!=f[a++])return!1;return a>=q}},"es6","es3");
$jscomp.polyfill("Set",function(m){if(!$jscomp.ASSUME_NO_NATIVE_SET&&function(){if(!m||!m.prototype.entries||"function"!=typeof Object.seal)return!1;try{var d=Object.seal({x:4}),f=new m($jscomp.makeIterator([d]));if(!f.has(d)||1!=f.size||f.add(d)!=f||1!=f.size||f.add({x:4})!=f||2!=f.size)return!1;var p=f.entries(),q=p.next();if(q.done||q.value[0]!=d||q.value[1]!=d)return!1;q=p.next();return q.done||q.value[0]==d||4!=q.value[0].x||q.value[1]!=q.value[0]?!1:p.next().done}catch(a){return!1}}())return m;
$jscomp.initSymbol();$jscomp.initSymbolIterator();var f=function(d){this.map_=new Map;if(d){d=$jscomp.makeIterator(d);for(var f;!(f=d.next()).done;)this.add(f.value)}this.size=this.map_.size};f.prototype.add=function(d){this.map_.set(d,d);this.size=this.map_.size;return this};f.prototype.delete=function(d){d=this.map_.delete(d);this.size=this.map_.size;return d};f.prototype.clear=function(){this.map_.clear();this.size=0};f.prototype.has=function(d){return this.map_.has(d)};f.prototype.entries=function(){return this.map_.entries()};
f.prototype.values=function(){return this.map_.values()};f.prototype.keys=f.prototype.values;f.prototype[Symbol.iterator]=f.prototype.values;f.prototype.forEach=function(d,f){var p=this;this.map_.forEach(function(q){return d.call(f,q,q,p)})};return f},"es6","es3");$jscomp.polyfill("Array.prototype.values",function(m){return m?m:function(){return $jscomp.iteratorFromArray(this,function(f,d){return d})}},"es6","es3");
$jscomp.polyfill("Math.log2",function(m){return m?m:function(f){return Math.log(f)/Math.LN2}},"es6","es3");$jscomp.polyfill("String.prototype.repeat",function(m){return m?m:function(f){var d=$jscomp.checkStringArgs(this,null,"repeat");if(0>f||1342177279<f)throw new RangeError("Invalid count value");f|=0;for(var u="";f;)if(f&1&&(u+=d),f>>>=1)d+=d;return u}},"es6","es3");
$jscomp.polyfill("WeakSet",function(m){if(function(){if(!m||!Object.seal)return!1;try{var d=Object.seal({}),f=Object.seal({}),p=new m([d]);if(!p.has(d)||p.has(f))return!1;p.delete(d);p.add(f);return!p.has(d)&&p.has(f)}catch(q){return!1}}())return m;var f=function(d){this.map_=new WeakMap;if(d){$jscomp.initSymbol();$jscomp.initSymbolIterator();d=$jscomp.makeIterator(d);for(var f;!(f=d.next()).done;)this.add(f.value)}};f.prototype.add=function(d){this.map_.set(d,!0);return this};f.prototype.has=function(d){return this.map_.has(d)};
f.prototype.delete=function(d){return this.map_.delete(d)};return f},"es6","es3");$jscomp.findInternal=function(m,f,d){m instanceof String&&(m=String(m));for(var u=m.length,p=0;p<u;p++){var q=m[p];if(f.call(d,q,p,m))return{i:p,v:q}}return{i:-1,v:void 0}};$jscomp.polyfill("Array.prototype.find",function(m){return m?m:function(f,d){return $jscomp.findInternal(this,f,d).v}},"es6","es3");
$jscomp.polyfill("Object.assign",function(m){return m?m:function(f,d){for(var u=1;u<arguments.length;u++){var p=arguments[u];if(p)for(var q in p)$jscomp.owns(p,q)&&(f[q]=p[q])}return f}},"es6","es3");$jscomp.FORCE_POLYFILL_PROMISE=!1;
$jscomp.polyfill("Promise",function(m){function f(){this.batch_=null}function d(a){return a instanceof p?a:new p(function(c,d){c(a)})}if(m&&!$jscomp.FORCE_POLYFILL_PROMISE)return m;f.prototype.asyncExecute=function(a){null==this.batch_&&(this.batch_=[],this.asyncExecuteBatch_());this.batch_.push(a);return this};f.prototype.asyncExecuteBatch_=function(){var a=this;this.asyncExecuteFunction(function(){a.executeBatch_()})};var u=$jscomp.global.setTimeout;f.prototype.asyncExecuteFunction=function(a){u(a,
0)};f.prototype.executeBatch_=function(){for(;this.batch_&&this.batch_.length;){var a=this.batch_;this.batch_=[];for(var c=0;c<a.length;++c){var d=a[c];delete a[c];try{d()}catch(v){this.asyncThrow_(v)}}}this.batch_=null};f.prototype.asyncThrow_=function(a){this.asyncExecuteFunction(function(){throw a;})};var p=function(a){this.state_=0;this.result_=void 0;this.onSettledCallbacks_=[];var c=this.createResolveAndReject_();try{a(c.resolve,c.reject)}catch(n){c.reject(n)}};p.prototype.createResolveAndReject_=
function(){function a(a){return function(t){d||(d=!0,a.call(c,t))}}var c=this,d=!1;return{resolve:a(this.resolveTo_),reject:a(this.reject_)}};p.prototype.resolveTo_=function(a){if(a===this)this.reject_(new TypeError("A Promise cannot resolve to itself"));else if(a instanceof p)this.settleSameAsPromise_(a);else{a:switch(typeof a){case "object":var c=null!=a;break a;case "function":c=!0;break a;default:c=!1}c?this.resolveToNonPromiseObj_(a):this.fulfill_(a)}};p.prototype.resolveToNonPromiseObj_=function(a){var c=
void 0;try{c=a.then}catch(n){this.reject_(n);return}"function"==typeof c?this.settleSameAsThenable_(c,a):this.fulfill_(a)};p.prototype.reject_=function(a){this.settle_(2,a)};p.prototype.fulfill_=function(a){this.settle_(1,a)};p.prototype.settle_=function(a,c){if(0!=this.state_)throw Error("Cannot settle("+a+", "+c|"): Promise already settled in state"+this.state_);this.state_=a;this.result_=c;this.executeOnSettledCallbacks_()};p.prototype.executeOnSettledCallbacks_=function(){if(null!=this.onSettledCallbacks_){for(var a=
this.onSettledCallbacks_,c=0;c<a.length;++c)a[c].call(),a[c]=null;this.onSettledCallbacks_=null}};var q=new f;p.prototype.settleSameAsPromise_=function(a){var c=this.createResolveAndReject_();a.callWhenSettled_(c.resolve,c.reject)};p.prototype.settleSameAsThenable_=function(a,c){var d=this.createResolveAndReject_();try{a.call(c,d.resolve,d.reject)}catch(v){d.reject(v)}};p.prototype.then=function(a,c){function d(a,g){return"function"==typeof a?function(e){try{v(a(e))}catch(b){t(b)}}:g}var v,t,l=new p(function(a,
g){v=a;t=g});this.callWhenSettled_(d(a,v),d(c,t));return l};p.prototype.catch=function(a){return this.then(void 0,a)};p.prototype.callWhenSettled_=function(a,c){function d(){switch(v.state_){case 1:a(v.result_);break;case 2:c(v.result_);break;default:throw Error("Unexpected state: "+v.state_);}}var v=this;null==this.onSettledCallbacks_?q.asyncExecute(d):this.onSettledCallbacks_.push(function(){q.asyncExecute(d)})};p.resolve=d;p.reject=function(a){return new p(function(c,d){d(a)})};p.race=function(a){return new p(function(c,
n){for(var v=$jscomp.makeIterator(a),t=v.next();!t.done;t=v.next())d(t.value).callWhenSettled_(c,n)})};p.all=function(a){var c=$jscomp.makeIterator(a),n=c.next();return n.done?d([]):new p(function(a,t){function l(e){return function(b){k[e]=b;g--;0==g&&a(k)}}var k=[],g=0;do k.push(void 0),g++,d(n.value).callWhenSettled_(l(k.length-1),t),n=c.next();while(!n.done)})};return p},"es6","es3");
$jscomp.polyfill("Math.sign",function(m){return m?m:function(f){f=Number(f);return 0===f||isNaN(f)?f:0<f?1:-1}},"es6","es3");$jscomp.polyfill("Array.prototype.findIndex",function(m){return m?m:function(f,d){return $jscomp.findInternal(this,f,d).i}},"es6","es3");$jscomp.polyfill("Array.prototype.entries",function(m){return m?m:function(){return $jscomp.iteratorFromArray(this,function(f,d){return[f,d]})}},"es6","es3");
$jscomp.polyfill("Array.prototype.fill",function(m){return m?m:function(f,d,u){var p=this.length||0;0>d&&(d=Math.max(0,p+d));if(null==u||u>p)u=p;u=Number(u);0>u&&(u=Math.max(0,p+u));for(d=Number(d||0);d<u;d++)this[d]=f;return this}},"es6","es3");
(function(m){function f(u){if(d[u])return d[u].exports;var p=d[u]={i:u,l:!1,exports:{}};m[u].call(p.exports,p,p.exports,f);p.l=!0;return p.exports}var d={};f.m=m;f.c=d;f.d=function(d,p,q){f.o(d,p)||Object.defineProperty(d,p,{configurable:!1,enumerable:!0,get:q})};f.n=function(d){var p=d&&d.__esModule?function(){return d["default"]}:function(){return d};f.d(p,"a",p);return p};f.o=function(d,f){return Object.prototype.hasOwnProperty.call(d,f)};f.p="";return f(f.s=176)})([function(m,f,d){function u(a,
c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}function p(a,c){if(!(a instanceof c))throw new TypeError("Cannot call a class as a function");}function q(a,c,d,k){a.addEventListener(c,d,k);return function(){return a.removeEventListener(c,d,k)}}d.d(f,
"c",function(){return q});d.d(f,"a",function(){return c});d.d(f,"b",function(){return n});var a=function(){function a(a,c){for(var k=0;k<c.length;k++){var g=c[k];g.enumerable=g.enumerable||!1;g.configurable=!0;"value"in g&&(g.writable=!0);Object.defineProperty(a,g.key,g)}}return function(c,d,k){d&&a(c.prototype,d);k&&a(c,k);return c}}(),c=function(){function c(){p(this,c);this.refCount=1}a(c,[{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 c=a.length;0<c;--c){var k=a[c-1];"object"===typeof k?k.dispose():k.call(this)}this.disposers=void 0}this.wasDisposed=!0}},{key:"disposed",value:function(){}},{key:"registerDisposer",value:function(a){var c=this.disposers;null==c?this.disposers=[a]:c.push(a);return a}},{key:"unregisterDisposer",value:function(a){var c=this.disposers;if(null!=c){var k=c.indexOf(a);-1!==k&&
c.splice(k,1)}return a}},{key:"registerEventListener",value:function(a,c,k,g){this.registerDisposer(q(a,c,k,g))}},{key:"registerCancellable",value:function(a){this.registerDisposer(function(){a.cancel()});return a}}]);return c}(),n=function(a){function c(a){p(this,c);var k=(c.__proto__||Object.getPrototypeOf(c)).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");k=!k||"object"!==typeof k&&"function"!==typeof k?this:k;k.value=a;return k}u(c,a);
return c}(c)},function(m,f,d){function u(a,c){var d=Math.abs(a[c]),v=Math.abs(a[c+1]),t=Math.abs(a[c+2]),l=Math.max(d,v,t);1E-4>d/l&&(a[c]=0);1E-4>v/l&&(a[c+1]=0);1E-4>t/l&&(a[c+2]=0)}d.d(f,"b",function(){return q});f.l=function(a){return a[0]*a[1]*a[2]};f.t=function(a){return a[0]+","+a[1]+","+a[2]};f.o=function(a){u(a,0);u(a,4);u(a,8)};f.p=function(a,c,d){var n=c[0],t=c[1];c=c[2];a[0]=d[0]*n+d[4]*t+d[8]*c;a[1]=d[1]*n+d[5]*t+d[9]*c;a[2]=d[2]*n+d[6]*t+d[10]*c;return a};f.c=function(a,c){var d=c[0],
v=c[1],t=c[2],l=c[4],k=c[5],g=c[6],e=c[8],b=c[9];c=c[10];a[0]=Math.sqrt(d*d+v*v+t*t);a[1]=Math.sqrt(l*l+k*k+g*g);a[2]=Math.sqrt(e*e+b*b+c*c);return a};f.q=function(a,c,d,v,t){a[0]=v[0];a[1]=v[1];a[2]=v[2]*t;return p.b.fromRotationTranslationScale(a,d,c,a)};f.m=function(a,c,d,v){for(var t=p.e.squaredDistance(c,d),l=0,k=0;3>k;++k){var g=c[k];l-=(g-v[k])*(d[k]-g)}v=l/Math.max(t,1E-6);v=Math.max(0,Math.min(1,v));for(t=0;3>t;++t)l=c[t],a[t]=l+v*(d[t]-l);return a};f.j=function(a,c){var d=c[1],v=c[2],t=
c[4],l=c[5],k=c[6],g=c[8],e=c[9],b=c[10];a[0]=c[0];a[1]=d;a[2]=v;a[3]=t;a[4]=l;a[5]=k;a[6]=g;a[7]=e;a[8]=b;return a};var p=d(103);m=d(14);d.d(f,"i",function(){return p.a});d.d(f,"k",function(){return p.b});d.d(f,"n",function(){return p.c});d.d(f,"r",function(){return p.d});d.d(f,"s",function(){return p.e});d.d(f,"u",function(){return p.f});d=p.b.create();f.d=d;f.a=["x","y","z"];var q=function c(d,v){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");this.lower=d;this.upper=
v};d=[p.e.fromValues(1,0,0),p.e.fromValues(0,1,0),p.e.fromValues(0,0,1)];f.e=d;d=p.e.fromValues(0,0,0);f.h=d;d=p.e.fromValues(1,1,1);f.g=d;d=p.e.fromValues(Infinity,Infinity,Infinity);f.f=d;p.c.create();new m.a(1227133513,306783378);new m.a(3272356035,818089008);new m.a(251719695,4027515120);new m.a(4278190335,16711680);new m.a(65535,16711680);new m.a(2097151,0)},function(m,f,d){function u(b){var a=typeof b;if("number"===a||"string"===a)if(a=parseFloat(""+b),!Number.isNaN(a))return a;throw Error("Expected floating-point number, but received: "+
JSON.stringify(b)+".");}function p(b){b=u(b);if(Number.isFinite(b))return b;throw Error("Expected finite floating-point number, but received: "+b+".");}function q(b){b=p(b);if(0<b)return b;throw Error("Expected positive finite floating-point number, but received: "+b+".");}function a(b){if("object"===typeof b){if(null===b)return"null";if(Array.isArray(b)){var e="[",h=b.length,g=0;if(g<h)for(e+=a(b[g]);++g<h;)e+=",",e+=a(b[g]);return e+"]"}e="{";h=Object.keys(b).sort();g=0;var c=h.length;if(g<c){var d=
h[g];e+=JSON.stringify(d);for(e=e+":"+a(b[d]);++g<c;)e+=",",d=h[g],e+=JSON.stringify(d),e+=":",e+=a(b[d])}return e+"}"}return JSON.stringify(b)}function c(e,a,g){var c=/[&_,]/g;if('"'===g){var d="'";var k=r;var l=b}else d='"',k=A,l=h;for(var t="";0<e.length;){var y=e.match(l);if(null===y){var n=e;y=e=""}else{n=e.substr(0,y.index);e=e.substr(y.index+y[0].length);var v=y[1];if(void 0!==v){var z=v;y=d;v=g;var f=k;if(2<=z.length&&z.charAt(0)===y&&z.charAt(z.length-1)===y){z=z.substr(1,z.length-2);for(var p=
v;0<z.length;){var q=z.match(f);if(null===q){p+=z;break}p+=q[1];q[2]===v?(p+="\\",p+=v):p+=y;z=z.substr(q.index+q[0].length)}y=p+v}else y=z}else y=y[2]}t+=n.replace(c,a);t+=y}return t}function n(b){return JSON.parse(c(b,",",'"'))}function v(b,e,a){var h=b.length;if(!Array.isArray(e)||e.length!==h)throw Error("Expected length "+h+" array, but received: "+JSON.stringify(e)+".");for(var g=0;g<h;++g)b[g]=a(e[g],g);return b}function t(b){if("object"!==typeof b||null==b||Array.isArray(b))throw Error("Expected JSON object, but received: "+
JSON.stringify(b)+".");return b}function l(b){var e=parseInt(b,10);if(!Number.isInteger(e))throw Error("Expected integer, but received: "+JSON.stringify(b)+".");return e}function k(b){b=l(b);if(0>=b)throw Error("Expected positive integer, but received: "+b+".");return b}function g(b){if("string"!==typeof b)throw Error("Expected string, but received: "+JSON.stringify(b)+".");return b}f.p=u;f.n=p;f.o=q;f.f=function(b,e,a){a=void 0===a?u:a;t(e);b[0]=b[1]=b[2]=0;for(var h=$jscomp.makeIterator(Object.keys(e)),
g=h.next();!g.done;g=h.next())switch(g=g.value,g){case "x":b[0]=a(e[g]);break;case "y":b[1]=a(e[g]);break;case "z":b[2]=a(e[g]);break;default:throw Error("Expected object to have keys ['x', 'y', 'z'], but received: "+JSON.stringify(e)+".");}return b};f.b=function(b,e){var a=b.length;if(!Array.isArray(e)||e.length!==a)throw Error("Incompatible sizes");for(var h=0;h<a;++h)if(!Number.isFinite(parseFloat(e[h])))throw Error("Non-finite value.");for(h=0;h<a;++h)b[h]=parseFloat(e[h]);return b};f.d=function(b,
e){var a=b.length;if(!Array.isArray(e)||e.length!==a)throw Error("Incompatible sizes.");for(var h=0;h<a;++h){var g=parseInt(e[h],void 0);if(!Number.isInteger(g))throw Error("Non-integer value.");}for(h=0;h<a;++h)b[h]=parseInt(e[h],void 0);return b};f.g=a;f.h=n;f.a=function(b,e){if(!Array.isArray(b))throw Error("Expected array, but received: "+JSON.stringify(b)+".");return b.map(e)};f.c=v;f.t=t;f.r=l;f.z=k;f.s=function(b,e){var a=e.get(b);if(void 0===a)throw Error("Expected one of "+JSON.stringify(Array.from(e.keys()))+
", "+("but received: "+JSON.stringify(b)+"."));return a};f.A=g;f.y=function(b){if(void 0!==b)return g(b)};f.x=function(b){if(void 0!==b)return l(b)};f.w=function(b){if(void 0!==b){if("boolean"===typeof b)return b;if("true"===b)return!0;if("false"===b)return!1;throw Error("Expected string or boolean but received: "+JSON.stringify(b));}};f.v=function(b,e,a){b=b.hasOwnProperty(e)?b[e]:void 0;try{return a(b)}catch(x){throw Error("Error parsing "+JSON.stringify(e)+" property: "+x.message);}};f.u=function(b,
e){t(b);for(var a=new Map,h=$jscomp.makeIterator(Object.keys(b)),g=h.next();!g.done;g=h.next()){g=g.value;try{a.set(g,e(b[g]))}catch(G){throw Error("Error parsing value associated with key "+JSON.stringify(g)+": "+G.message);}}return a};f.q=function(b){if("number"!==typeof b||!Number.isFinite(b)||0>b||1<b)throw Error("Expected floating point number in [0,1], but received: "+JSON.stringify(b)+".");return b};f.e=function(b){if(""===b)return{};if(b.startsWith("{"))return n(b);var e={};b=b.split(/[&;]/);
b=$jscomp.makeIterator(b);for(var a=b.next();!a.done;a=b.next()){a=a.value;var h=a.match(/^([^=&;]+)=([^&;]*)$/);if(null===h)throw Error("Invalid query string part: "+JSON.stringify(a)+".");e[h[1]]=decodeURIComponent(h[2])}return e};f.m=function(b,e){if("string"===typeof b&&null!==b.match(/^[a-zA-Z]/)&&(b=b.toUpperCase(),e.hasOwnProperty(b)))return e[b];throw Error("Invalid enum value: "+JSON.stringify(b)+".");};f.k=function(b){return v(e.s.create(),b,p)};f.j=function(b){return v(e.s.create(),b,q)};
f.i=function(b){return v(e.s.create(),b,k)};f.B=function(b){if(!Array.isArray(b))throw Error("Expected array, received: "+JSON.stringify(b)+".");for(var e=$jscomp.makeIterator(b),a=e.next();!a.done;a=e.next())if(a=a.value,"string"!==typeof a)throw Error("Expected string, received: "+JSON.stringify(a)+".");return b};f.l=function(b){if("boolean"!==typeof b)throw Error("Expected boolean, received: "+JSON.stringify(b));return b};var e=d(1);m=/('(?:[^'\\]|(?:\\.))*')/;f=/("(?:[^'\\]|(?:\\.))*")/;var b=
new RegExp(m.source+"|"+f.source),h=new RegExp(f.source+"|"+m.source),r=/^((?:[^"'\\]|(?:\\[^']))*)("|\\')/,A=/^((?:[^"'\\]|(?:\\.))*)'/},function(m,f,d){function u(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}function p(a,c){if(!(a instanceof
c))throw new TypeError("Cannot call a class as a function");}d.d(f,"b",function(){return a});d.d(f,"a",function(){return c});var q=function(){function a(a,c){for(var d=0;d<c.length;d++){var k=c[d];k.enumerable=k.enumerable||!1;k.configurable=!0;"value"in k&&(k.writable=!0);Object.defineProperty(a,k.key,k)}}return function(c,d,l){d&&a(c.prototype,d);l&&a(c,l);return c}}(),a=function(){function a(){p(this,a);this.handlers=new Set;this.count=0;var c=this;this.dispatch=function(){var a=this,d=arguments;
++c.count;c.handlers.forEach(function(c){c.apply(a,d)})}}q(a,[{key:"add",value:function(a){var c=this;this.handlers.add(a);return function(){return c.remove(a)}}},{key:"remove",value:function(a){return this.handlers.delete(a)}},{key:"dispose",value:function(){this.handlers=void 0}}]);return a}(),c=function(a){function c(){p(this,c);var a=(c.__proto__||Object.getPrototypeOf(c)).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}u(c,a);return c}(a)},function(m,f){m.exports="function"===typeof Object.create?function(d,f){d.super_=f;d.prototype=Object.create(f.prototype,{constructor:{value:d,enumerable:!1,writable:!0,configurable:!0}})}:function(d,f){d.super_=f;var p=function(){};p.prototype=f.prototype;d.prototype=new p;d.prototype.constructor=d}},function(m,f,d){var u=d(76),p=d(185),q=d(187),a=Math.max,c=Math.min;m.exports=function(d,f,t){function l(b){var a=h,e=r;h=r=void 0;
E=b;return A=d.apply(e,a)}function k(b){var a=b-v;b-=E;return void 0===v||a>=f||0>a||D&&b>=J}function g(){var b=p();if(k(b))return e(b);var a=setTimeout;var h=b-E;b=f-(b-v);h=D?c(b,J-h):b;n=a(g,h)}function e(b){n=void 0;if(G&&h)return l(b);h=r=void 0;return A}function b(){var b=p(),a=k(b);h=arguments;r=this;v=b;if(a){if(void 0===n)return E=b=v,n=setTimeout(g,f),x?l(b):A;if(D)return n=setTimeout(g,f),l(v)}void 0===n&&(n=setTimeout(g,f));return A}var h,r,A,n,v,E=0,x=!1,D=!1,G=!0;if("function"!=typeof d)throw new TypeError("Expected a function");
f=q(f)||0;if(u(t)){x=!!t.leading;var J=(D="maxWait"in t)?a(q(t.maxWait)||0,f):J;G="trailing"in t?!!t.trailing:G}b.cancel=function(){void 0!==n&&clearTimeout(n);E=0;h=v=r=n=void 0};b.flush=function(){return void 0===n?A:e(p())};return b}},function(m,f,d){function u(b,a){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?b:a}function p(b,a){if("function"!==typeof a&&null!==a)throw new TypeError("Super expression must either be null or a function, not "+
typeof a);b.prototype=Object.create(a&&a.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}});a&&(Object.setPrototypeOf?Object.setPrototypeOf(b,a):b.__proto__=a)}function q(b,a){if(!(b instanceof a))throw new TypeError("Cannot call a class as a function");}d.d(f,"f",function(){return l});d.d(f,"c",function(){return k});f.g=function(b,a){for(var e=[],h=1;h<arguments.length;++h)e[h-1]=arguments[h];return new g(b,e)};d.d(f,"a",function(){return e});d.d(f,"d",function(){return b});
d.d(f,"b",function(){return h});d.d(f,"e",function(){return r});f.h=function(b,e){function h(){g=b.value;d=new c.a;e(d,g)}var g,d,k=a()(function(){b.value!==g&&(d.dispose(),h())},0),r=b.changed.add(k);h();return function(){k.cancel();r();d.dispose()}};m=d(5);var a=d.n(m),c=d(0),n=d(3),v=function y(b,a,e){null===b&&(b=Function.prototype);var h=Object.getOwnPropertyDescriptor(b,a);if(void 0===h){if(b=Object.getPrototypeOf(b),null!==b)return y(b,a,e)}else{if("value"in h)return h.value;a=h.get;return void 0===
a?void 0:a.call(e)}},t=function(){function b(b,a){for(var e=0;e<a.length;e++){var h=a[e];h.enumerable=h.enumerable||!1;h.configurable=!0;"value"in h&&(h.writable=!0);Object.defineProperty(b,h.key,h)}}return function(a,e,h){e&&b(a.prototype,e);h&&b(a,h);return a}}(),l=function(){function b(a){q(this,b);this.value_=a;this.changed=new n.a}t(b,[{key:"value",get:function(){return this.value_},set:function(b){b!==this.value_&&(this.value_=b,this.changed.dispatch())}}]);return b}(),k=function(b){function a(b,
e,h){h=void 0===h?b:h;q(this,a);b=u(this,(a.__proto__||Object.getPrototypeOf(a)).call(this,b));b.validator=e;b.defaultValue=h;return b}p(a,b);t(a,[{key:"toJSON",value:function(){if(this.value_!==this.defaultValue)return this.value_}},{key:"reset",value:function(){this.value=this.defaultValue}},{key:"restoreState",value:function(b){if(void 0!==b){var a=this.validator;try{this.value=a(b);return}catch(D){}}this.value=this.defaultValue}}]);return a}(l),g=function(b){function a(b,e){q(this,a);var h=u(this,
(a.__proto__||Object.getPrototypeOf(a)).call(this));h.changed=new n.a;h.f=b;h.ws=e;b=$jscomp.makeIterator(e);for(e=b.next();!e.done;e=b.next())h.registerDisposer(e.value.changed.add(h.changed.dispatch));return h}p(a,b);t(a,[{key:"value",get:function(){return this.f.apply(this,[].concat($jscomp.arrayFromIterable(this.ws.map(function(b){return b.value}))))}}]);return a}(c.a),e=function(b){function a(b,e){for(var h=[],g=1;g<arguments.length;++g)h[g-1]=arguments[g];q(this,a);g=u(this,(a.__proto__||Object.getPrototypeOf(a)).call(this));
g.f=b;g.changed=new n.a;h=$jscomp.makeIterator(h);for(var c=h.next();!c.done;c=h.next())g.registerDisposer(c.value.add(g.changed.dispatch));return g}p(a,b);t(a,[{key:"value",get:function(){return this.f()}}]);return a}(c.a),b=function(b){function a(){q(this,a);var b=u(this,(a.__proto__||Object.getPrototypeOf(a)).apply(this,arguments));b.changed=new n.a;return b}p(a,b);t(a,[{key:"reset",value:function(){this.value=void 0}},{key:"disposed",value:function(){void 0!==this.value_&&this.value_.dispose();
this.value_=void 0;v(a.prototype.__proto__||Object.getPrototypeOf(a.prototype),"disposed",this).call(this)}},{key:"value",get:function(){return this.value_},set:function(b){var a=this,e=this.value_;this.value_=b;void 0!==e&&(e.dispose(),this.valueHandler=void 0);if(void 0!==b){var h=this.valueHandler=function(){a.value_===b&&(a.value_=void 0,a.changed.dispatch())};b.registerDisposer(h)}b!==e&&this.changed.dispatch()}}]);return a}(c.a),h=function(b){function a(b,e){q(this,a);var h=u(this,(a.__proto__||
Object.getPrototypeOf(a)).call(this));h.validator=b;h.jsonConverter=e;return h}p(a,b);t(a,[{key:"toJSON",value:function(){var b=this.value;return b&&this.jsonConverter(b)}},{key:"restoreState",value:function(b){this.value=this.validator(b)}}]);return a}(b),r=function(){function b(a){q(this,b);this.changed=new n.a;this.values=void 0===a?new Set:new Set(a)}$jscomp.initSymbol();$jscomp.initSymbolIterator();t(b,[{key:"add",value:function(b){var a=this.values;a.has(b)||(a.add(b),this.changed.dispatch());
return this}},{key:"delete",value:function(b){return this.values.delete(b)?(this.changed.dispatch(),!0):!1}},{key:"has",value:function(b){return this.values.has(b)}},{key:Symbol.iterator,value:function(){$jscomp.initSymbol();$jscomp.initSymbolIterator();return this.values[Symbol.iterator]()}},{key:"clear",value:function(){var b=this.values;0<b.size&&(b.clear(),this.changed.dispatch())}},{key:"size",get:function(){return this.values.size}}]);return b}()},function(m,f){f=function(){return this}();try{f=
f||Function("return this")()||(0,eval)("this")}catch(d){"object"===typeof window&&(f=window)}m.exports=f},function(m,f){function d(){throw Error("setTimeout has not been defined");}function u(){throw Error("clearTimeout has not been defined");}function p(b){if(t===setTimeout)return setTimeout(b,0);if((t===d||!t)&&setTimeout)return t=setTimeout,setTimeout(b,0);try{return t(b,0)}catch(r){try{return t.call(null,b,0)}catch(A){return t.call(this,b,0)}}}function q(b){if(l===clearTimeout)return clearTimeout(b);
if((l===u||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(b);try{return l(b)}catch(r){try{return l.call(null,b)}catch(A){return l.call(this,b)}}}function a(){g&&e&&(g=!1,e.length?k=e.concat(k):b=-1,k.length&&c())}function c(){if(!g){var h=p(a);g=!0;for(var c=k.length;c;){e=k;for(k=[];++b<c;)e&&e[b].run();b=-1;c=k.length}e=null;g=!1;q(h)}}function n(b,a){this.fun=b;this.array=a}function v(){}m=m.exports={};try{var t="function"===typeof setTimeout?setTimeout:d}catch(h){t=d}try{var l="function"===
typeof clearTimeout?clearTimeout:u}catch(h){l=u}var k=[],g=!1,e,b=-1;m.nextTick=function(b){var a=Array(arguments.length-1);if(1<arguments.length)for(var e=1;e<arguments.length;e++)a[e-1]=arguments[e];k.push(new n(b,a));1!==k.length||g||p(c)};n.prototype.run=function(){this.fun.apply(null,this.array)};m.title="browser";m.browser=!0;m.env={};m.argv=[];m.version="";m.versions={};m.on=v;m.addListener=v;m.once=v;m.off=v;m.removeListener=v;m.removeAllListeners=v;m.emit=v;m.prependListener=v;m.prependOnceListener=
v;m.listeners=function(b){return[]};m.binding=function(b){throw Error("process.binding is not supported");};m.cwd=function(){return"/"};m.chdir=function(b){throw Error("process.chdir is not supported");};m.umask=function(){return 0}},function(m,f,d){(function(u){function p(){try{var a=f.storage.debug}catch(n){}!a&&"undefined"!==typeof u&&"env"in u&&(a=u.env.DEBUG);return a}f=m.exports=d(317);f.log=function(){return"object"===typeof console&&console.log&&Function.prototype.apply.call(console.log,console,
arguments)};f.formatArgs=function(a){var c=this.useColors;a[0]=(c?"%c":"")+this.namespace+(c?" %c":" ")+a[0]+(c?"%c ":" ")+"+"+f.humanize(this.diff);if(c){c="color: "+this.color;a.splice(1,0,c,"color: inherit");var d=0,t=0;a[0].replace(/%[a-zA-Z%]/g,function(a){"%%"!==a&&(d++,"%c"===a&&(t=d))});a.splice(t,0,c)}};f.save=function(a){try{null==a?f.storage.removeItem("debug"):f.storage.debug=a}catch(n){}};f.load=p;f.useColors=function(){return"undefined"!==typeof window&&window.process&&"renderer"===
window.process.type?!0:"undefined"!==typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!==typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!==typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&31<=parseInt(RegExp.$1,10)||"undefined"!==typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)};
var q=f;if("undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage)var a=chrome.storage.local;else a:{try{a=window.localStorage;break a}catch(c){}a=void 0}q.storage=a;f.colors="lightseagreen forestgreen goldenrod dodgerblue darkorchid crimson".split(" ");f.formatters.j=function(a){try{return JSON.stringify(a)}catch(n){return"[UnexpectedJSONParseError]: "+n.message}};f.enable(p())}).call(f,d(8))},function(m,f,d){f.a=function(d){for(;;){var f=d.firstElementChild;if(!f)break;d.removeChild(f)}};
f.b=function(d){var f=d.parentElement;return f?(f.removeChild(d),!0):!1}},function(m,f,d){f.d=16384;f.C=4;f.D=6;f.J=0;f.o=1;f.u=770;f.p=771;f.a=34962;f.f=34963;f.v=35044;f.b=3042;f.e=2929;f.t=3089;f.q=32823;f.E=3317;f.G=5121;f.H=5123;f.g=5126;f.r=6407;f.s=6408;f.l=6409;f.m=6410;f.h=35632;f.I=35633;f.j=513;f.i=515;f.n=9728;f.k=9729;f.y=10240;f.z=10241;f.A=10242;f.B=10243;f.x=3553;f.w=33984;f.c=33071;f.F=37440},function(m,f,d){function u(b,a){if(!(b instanceof a))throw new TypeError("Cannot call a class as a function");
}function p(b,a){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?b:a}function q(b,a){if("function"!==typeof a&&null!==a)throw new TypeError("Super expression must either be null or a function, not "+typeof a);b.prototype=Object.create(a&&a.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}});a&&(Object.setPrototypeOf?Object.setPrototypeOf(b,a):b.__proto__=a)}function a(b,a){l.set(b,
a)}f.e=a;f.d=function(b,e){a(b,function(b){var a=this,h=b.id,g=new c.b;b=e.call(this,b,g);this.set(h,{promise:b,cancellationToken:g});b.then(function(b){var e=b.value;b=b.transfers;a.delete(h);a.invoke("rpc.promise.response",{id:h,value:e},b)},function(b){a.delete(h);a.invoke("rpc.promise.response",{id:h,error:b.message,errorName:b.name})})})};d.d(f,"a",function(){return e});d.d(f,"b",function(){return b});d.d(f,"c",function(){return h});f.g=function(b){return function(a){a.prototype.RPC_TYPE_ID=
b}};f.f=function(b){return function(a){if(void 0!==b)a.prototype.RPC_TYPE_ID=b;else if(b=a.prototype.RPC_TYPE_ID,void 0===b)throw Error("RPC_TYPE_ID should have already been defined");r.set(b,a)}};var c=d(34);m=d(0);var n=function y(b,a,e){null===b&&(b=Function.prototype);var h=Object.getOwnPropertyDescriptor(b,a);if(void 0===h){if(b=Object.getPrototypeOf(b),null!==b)return y(b,a,e)}else{if("value"in h)return h.value;a=h.get;return void 0===a?void 0:a.call(e)}},v=function(){function b(b,a){for(var e=
0;e<a.length;e++){var h=a[e];h.enumerable=h.enumerable||!1;h.configurable=!0;"value"in h&&(h.writable=!0);Object.defineProperty(b,h.key,h)}}return function(a,e,h){e&&b(a.prototype,e);h&&b(a,h);return a}}(),t=!("undefined"!==typeof Window&&self instanceof Window),l=new Map,k=function(b){function a(b,e){u(this,a);var h=p(this,(a.__proto__||Object.getPrototypeOf(a)).call(this,e));h.name=b;h.message=e;return h}q(a,b);return a}(Error);a("rpc.promise.cancel",function(b){this.get(b.id).cancellationToken.cancel()});
a("rpc.promise.response",function(b){var a=b.id,e=this.get(a),h=e.resolve;e=e.reject;this.delete(a);b.hasOwnProperty("value")?h(b.value):b.errorName===c.a.name?e(c.a):e(new k(b.errorName,b.error))});var g=t?-1:0,e=function(){function b(a){var e=this;u(this,b);this.target=a;this.objects=new Map;this.nextId=g;a.onmessage=function(b){b=b.data;l.get(b.functionName).call(e,b)}}v(b,[{key:"set",value:function(b,a){this.objects.set(b,a)}},{key:"delete",value:function(b){this.objects.delete(b)}},{key:"get",
value:function(b){return this.objects.get(b)}},{key:"getRef",value:function(b){var a=this.get(b.id);a.referencedGeneration=b.gen;a.addRef();return a}},{key:"invoke",value:function(b,a,e){a.functionName=b;this.target.postMessage(a,e)}},{key:"promiseInvoke",value:function(b,a,e,h){var g=this;e=void 0===e?c.e:e;return Object(c.d)(e,function(e,c,d){var k=a.id=g.newId();g.set(k,{resolve:e,reject:c});g.invoke(b,a,h);d.add(function(){g.invoke("rpc.promise.cancel",{id:k})})})}},{key:"newId",value:function(){return t?
this.nextId--:this.nextId++}},{key:"numObjects",get:function(){return this.objects.size}}]);return b}(),b=function(b){function a(){u(this,a);var b=p(this,(a.__proto__||Object.getPrototypeOf(a)).apply(this,arguments));b.rpc=null;b.rpcId=null;return b}q(a,b);v(a,[{key:"initializeSharedObject",value:function(b,a){a=void 0===a?b.newId():a;this.rpc=b;this.rpcId=a;this.isOwner=!1;b.set(a,this)}},{key:"initializeCounterpart",value:function(b,a){a=void 0===a?{}:a;this.initializeSharedObject(b);this.referencedGeneration=
this.unreferencedGeneration=0;this.isOwner=!0;a.id=this.rpcId;a.type=this.RPC_TYPE_ID;b.invoke("SharedObject.new",a)}},{key:"dispose",value:function(){n(a.prototype.__proto__||Object.getPrototypeOf(a.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}):n(a.prototype.__proto__||Object.getPrototypeOf(a.prototype),"refCountReachedZero",this).call(this)}},{key:"ownerDispose",value:function(){var b=this.rpc,e=this.rpcId;n(a.prototype.__proto__||Object.getPrototypeOf(a.prototype),"refCountReachedZero",this).call(this);b.delete(e);b.invoke("SharedObject.dispose",{id:e})}},{key:"counterpartRefCountReachedZero",value:function(b){this.unreferencedGeneration=b;0===this.refCount&&b===this.referencedGeneration&&
this.ownerDispose()}}]);return a}(m.a),h=function(b){function a(b,e){e=void 0===e?{}:e;u(this,a);var h=p(this,(a.__proto__||Object.getPrototypeOf(a)).call(this));e=void 0===e?{}:e;null!=b&&h.initializeSharedObject(b,e.id);return h}q(a,b);return a}(b);a("SharedObject.dispose",function(b){b=this.get(b.id);if(0!==b.refCount)throw Error("Attempted to dispose object with non-zero reference count.");b.disposed();this.delete(b.rpcId);b.rpcId=null;b.rpc=null});a("SharedObject.refCountReachedZero",function(b){this.get(b.id).counterpartRefCountReachedZero(b.gen)});
var r=new Map;a("SharedObject.new",function(b){--(new (r.get(b.type))(this,b)).refCount})},function(m,f,d){function u(){p.call(this)}f=d(4);var p=d(161);f(u,p);u.prototype.removeAllListeners=function(d){d?delete this._listeners[d]:this._listeners={}};u.prototype.once=function(d,a){function c(){n.removeListener(d,c);f||(f=!0,a.apply(this,arguments))}var n=this,f=!1;this.on(d,c)};u.prototype.emit=function(){var d=this._listeners[arguments[0]];if(d){for(var a=arguments.length,c=Array(a-1),n=1;n<a;n++)c[n-
1]=arguments[n];for(a=0;a<d.length;a++)d[a].apply(this,c)}};u.prototype.on=u.prototype.addListener=p.prototype.addEventListener;u.prototype.removeListener=p.prototype.removeEventListener;m.exports.EventEmitter=u},function(m,f,d){d.d(f,"a",function(){return v});var u=function(){function a(a,c){for(var g=0;g<c.length;g++){var e=c[g];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(c,d,g){d&&a(c.prototype,d);g&&a(c,g);return c}}(),
p=new Uint32Array(2),q=[];for(m=2;36>=m;++m){f=Math.floor(32/Math.log2(m));d=Math.pow(m,f);var a=Math.floor(f/2),c=Math.pow(m,a);a=Math.pow(m,f-a);var n="^[0-"+String.fromCharCode(48+Math.min(9,m-1));10<m&&(n+="a-"+String.fromCharCode(97+m-11),n+="A-"+String.fromCharCode(65+m-11));n+="]{1,"+Math.ceil(64/Math.log2(m))+"}$";q[m]={lowDigits:f,lowBase:d,lowBase1:c,lowBase2:a,pattern:new RegExp(n)}}var v=function(){function a(c,d){c=void 0===c?0:c;d=void 0===d?0:d;if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");
this.low=c;this.high=d}u(a,[{key:"clone",value:function(){return new a(this.low,this.high)}},{key:"assign",value:function(a){this.low=a.low;this.high=a.high}},{key:"toString",value:function(a){a=void 0===a?10:a;var c=this.low,g=this.high;if(0===g)return c.toString(a);g*=4294967296;var e=q[a],b=e.lowBase;e=e.lowDigits;var h=g%b;g=Math.floor(g/b);c+=h;g+=Math.floor(c/b);c=(c%b).toString(a);return g.toString(a)+"0".repeat(e-c.length)+c}},{key:"tryParseString",value:function(a,c){c=void 0===c?10:c;var g=
q[c],e=g.lowDigits,b=g.lowBase,h=g.lowBase1,d=g.lowBase2;if(!g.pattern.test(a))return!1;if(a.length<=e)return this.low=parseInt(a,c),this.high=0,!0;e=a.length-e;g=parseInt(a.substr(e),c);a=parseInt(a.substr(0,e),c);b=Math.floor(a*b/4294967296);h=g+a%4294967296*h%4294967296*d%4294967296;4294967296<h&&(++b,h-=4294967296);if(h>>>0!==h||b>>>0!==b)return!1;this.low=h;this.high=b;return!0}},{key:"parseString",value:function(a,c){if(!this.tryParseString(a,void 0===c?10:c))throw Error("Failed to parse string as uint64 value: "+
JSON.stringify(a)+".");return this}},{key:"valid",value:function(){var a=this.low,c=this.high;return a>>>0===a&&c>>>0===c}},{key:"toJSON",value:function(){return this.toString()}},{key:"lshift",value:function(c){c&=63;if(0==c)return this.clone();var d=this.low,g=this.high;return 32>c?new a(d<<c,g<<c|d>>>32-c):new a(0,d<<c-32)}},{key:"rshift",value:function(c){c&=63;if(0==c)return this.clone();var d=this.low,g=this.high;return 32>c?new a(d>>>c|g<<32-c,g>>c):new a(g>>c-32,0<=g?0:-1)}},{key:"or",value:function(c){return new a(this.low|
c.low,this.high|c.high)}},{key:"xor",value:function(c){return new a(this.low^c.low,this.high^c.high)}},{key:"and",value:function(c){return new a(this.low&c.low,this.high&c.high)}}],[{key:"less",value:function(a,c){return a.high<c.high||a.high===c.high&&a.low<c.low}},{key:"compare",value:function(a,c){return a.high-c.high||a.low-c.low}},{key:"equal",value:function(a,c){return a.low===c.low&&a.high===c.high}},{key:"min",value:function(c,d){return a.less(c,d)?c:d}},{key:"random",value:function(){crypto.getRandomValues(p);
return new a(p[0],p[1])}},{key:"parseString",value:function(c,d){d=void 0===d?10:d;return(new a).parseString(c,d)}}]);return a}();v.ZERO=new v(0,0)},function(m,f,d){function u(b,a){if(!(b instanceof a))throw new TypeError("Cannot call a class as a function");}function p(b,a){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?b:a}function q(b,a){if("function"!==typeof a&&null!==a)throw new TypeError("Super expression must either be null or a function, not "+
typeof a);b.prototype=Object.create(a&&a.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}});a&&(Object.setPrototypeOf?Object.setPrototypeOf(b,a):b.__proto__=a)}d.d(f,"g",function(){return y});f.k=function(){return new n.e([y.DATA,y.ANNOTATION,y.DEFAULT_ANNOTATION])};d.d(f,"f",function(){return z});d.d(f,"j",function(){return E});d.d(f,"i",function(){return x});d.d(f,"d",function(){return D});d.d(f,"a",function(){return G});d.d(f,"e",function(){return J});d.d(f,"c",function(){return C});
f.l=function(b,a,e,h,g){return h.registerDisposer(new B(b,a,e,function(b){var a=b.redrawNeeded.add(function(){return h.scheduleRedraw()}),e=g&&g(b);h.scheduleRedraw();return function(){void 0!==e&&e();a();h.scheduleRedraw()}},h.visibility))};d.d(f,"h",function(){return F});d.d(f,"b",function(){return P});m=d(5);var a=d.n(m);m=d(110);var c=d.n(m),n=d(6),v=d(111);m=d(0);var t=d(1),l=d(2),k=d(3),g=d(193),e=d(14),b=d(24),h=d(35),r=function N(b,a,e){null===b&&(b=Function.prototype);var h=Object.getOwnPropertyDescriptor(b,
a);if(void 0===h){if(b=Object.getPrototypeOf(b),null!==b)return N(b,a,e)}else{if("value"in h)return h.value;a=h.get;return void 0===a?void 0:a.call(e)}},A=function(){function b(b,a){for(var e=0;e<a.length;e++){var h=a[e];h.enumerable=h.enumerable||!1;h.configurable=!0;"value"in h&&(h.writable=!0);Object.defineProperty(b,h.key,h)}}return function(a,e,h){e&&b(a.prototype,e);h&&b(a,h);return a}}(),y;(function(b){b[b.DATA=0]="DATA";b[b.ANNOTATION=1]="ANNOTATION";b[b.DEFAULT_ANNOTATION=2]="DEFAULT_ANNOTATION"})(y||
(y={}));var z=function(b){function a(){u(this,a);var b=p(this,(a.__proto__||Object.getPrototypeOf(a)).apply(this,arguments));b.ready=!1;b.role=y.DATA;b.layerChanged=new k.a;b.redrawNeeded=new k.a;b.readyStateChanged=new k.a;b.voxelSize=null;b.boundingBox=null;return b}q(a,b);A(a,[{key:"setReady",value:function(b){this.ready=b;this.readyStateChanged.dispatch();this.layerChanged.dispatch()}},{key:"handleAction",value:function(b){}},{key:"getValueAt",value:function(b){}},{key:"transformPickedValue",
value:function(b,a){return b}},{key:"updateMouseState",value:function(b,a,e,h){}}]);return a}(m.a),E=function(a){function e(){u(this,e);var a=p(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments));a.visibility=new b.a;return a}q(e,a);return e}(z),x=function(b){function a(b,e){u(this,a);var g=p(this,(a.__proto__||Object.getPrototypeOf(a)).call(this));g.manager=b;g.layersChanged=new k.a;g.readyStateChanged=new k.a;g.specificationChanged=new k.a;g.renderLayers=[];g.isReady=!1;g.tabs=g.registerDisposer(new h.c);
g.tool=g.registerDisposer(new n.b(function(b){return Object(v.c)(g,b)},function(b){return b.toJSON()}));e;g.tabs.changed.add(g.specificationChanged.dispatch);g.tool.changed.add(g.specificationChanged.dispatch);return g}q(a,b);A(a,[{key:"restoreState",value:function(b){this.tool.restoreState(b.tool);this.tabs.restoreState(b.tab)}},{key:"addRenderLayer",value:function(b){this.renderLayers.push(b);var a=this.layersChanged,e=this.readyStateChanged;b.layerChanged.add(a.dispatch);b.readyStateChanged.add(e.dispatch);
e.dispatch();a.dispatch()}},{key:"removeRenderLayer",value:function(b){var a=this.renderLayers,e=this.layersChanged,h=this.readyStateChanged,g=a.indexOf(b);if(-1===g)throw Error("Attempted to remove invalid RenderLayer");a.splice(g,1);b.layerChanged.remove(e.dispatch);b.readyStateChanged.remove(h.dispatch);b.dispose();h.dispatch();e.dispatch()}},{key:"disposed",value:function(){for(var b=this.layersChanged,e=this.readyStateChanged,h=$jscomp.makeIterator(this.renderLayers),g=h.next();!g.done;g=h.next())g=
g.value,g.layerChanged.remove(b.dispatch),g.readyStateChanged.remove(e.dispatch),g.dispose();r(a.prototype.__proto__||Object.getPrototypeOf(a.prototype),"disposed",this).call(this)}},{key:"getValueAt",value:function(b,a){var e=this.renderLayers,h=a.pickedRenderLayer;if(null!==h&&-1!==e.indexOf(h)){var g=h.transformPickedValue(a.pickedValue,a.pickedOffset);return this.transformPickedValue(g)}a=$jscomp.makeIterator(e);for(e=a.next();!e.done&&(e=e.value,!e.ready||(g=e.getValueAt(b),void 0===g));e=a.next());
return this.transformPickedValue(g)}},{key:"transformPickedValue",value:function(b){return b}},{key:"toJSON",value:function(){var b={};return b.tab=this.tabs.toJSON(),b.tool=this.tool.toJSON(),b}},{key:"handleAction",value:function(b){}}]);return a}(m.a),D=function(b){function a(b,e,h){e=void 0===e?null:e;h=void 0===h?!0:h;u(this,a);var g=p(this,(a.__proto__||Object.getPrototypeOf(a)).call(this));g.visible=h;g.readyStateChanged=new k.a;g.layerChanged=new k.a;g.specificationChanged=new k.a;g.wasDisposed=
!1;g.layer_=null;g.name_=b;g.layer=e;return g}q(a,b);A(a,[{key:"isReady",value:function(){var b=this.layer;return null!==b&&b.isReady}},{key:"handleLayerChanged",value:function(){this.visible&&this.layerChanged.dispatch()}},{key:"setVisible",value:function(b){b!==this.visible&&(this.visible=b,this.layerChanged.dispatch())}},{key:"disposed",value:function(){this.wasDisposed=!0;this.layer=null;r(a.prototype.__proto__||Object.getPrototypeOf(a.prototype),"disposed",this).call(this)}},{key:"layer",get:function(){return this.layer_},
set:function(b){var a=this,e=this.layer_;null!=e&&(this.unregisterUserLayer(),e.dispose());this.layer_=b;if(null!=b){var h=[b.layersChanged.add(function(){return a.handleLayerChanged()}),b.readyStateChanged.add(this.readyStateChanged.dispatch),b.specificationChanged.add(this.specificationChanged.dispatch)];this.unregisterUserLayer=function(){h.forEach(function(b){return b()})};this.readyStateChanged.dispatch();this.handleLayerChanged()}}},{key:"name",get:function(){return this.name_},set:function(b){b!==
this.name_&&(this.name_=b,this.layerChanged.dispatch())}}]);return a}(m.a),G=function(b){function e(){u(this,e);var b=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));b.managedLayers=[];b.layerSet=new Set;b.layersChanged=new k.a;b.readyStateChanged=new k.a;b.specificationChanged=new k.a;b.boundPositions=new WeakSet;b.numDirectUsers=0;b.renderLayerToManagedLayerMapGeneration=-1;b.renderLayerToManagedLayerMap_=new Map;b.scheduleRemoveLayersWithSingleRef=b.registerCancellable(a()(function(){return b.removeLayersWithSingleRef()},
0));b.layersChanged.add(b.scheduleRemoveLayersWithSingleRef);return b}q(e,b);A(e,[{key:"filter",value:function(b){var a=this,e=!1;this.managedLayers=this.managedLayers.filter(function(h){return b(h)?!0:(a.unbindManagedLayer(h),a.layerSet.delete(h),e=!0,!1)});e&&this.layersChanged.dispatch()}},{key:"removeLayersWithSingleRef",value:function(){0<this.numDirectUsers||this.filter(function(b){return 1!==b.refCount})}},{key:"updateSignalBindings",value:function(b,a){a(b.layerChanged,this.layersChanged.dispatch);
a(b.readyStateChanged,this.readyStateChanged.dispatch);a(b.specificationChanged,this.specificationChanged.dispatch)}},{key:"useDirectly",value:function(){var b=this;1===++this.numDirectUsers&&this.layersChanged.remove(this.scheduleRemoveLayersWithSingleRef);return function(){0===--b.numDirectUsers&&(b.layersChanged.add(b.scheduleRemoveLayersWithSingleRef),b.scheduleRemoveLayersWithSingleRef())}}},{key:"addManagedLayer",value:function(b,a){this.updateSignalBindings(b,g.a);this.layerSet.add(b);void 0===
a&&(a=this.managedLayers.length);this.managedLayers.splice(a,0,b);this.layersChanged.dispatch();this.readyStateChanged.dispatch();return b}},{key:"addUserLayer",value:function(b,a,e){b=new D(b,a,e);return this.addManagedLayer(b)}},{key:"readyRenderLayers",value:function(){function b(b,l){for(;;)switch(a){case 0:k=$jscomp.makeIterator(r.managedLayers),d=k.next();case 1:if(d.done){a=3;break}c=d.value;if(c.visible&&c.layer){a=4;break}a=2;break;case 4:g=$jscomp.makeIterator(c.layer.renderLayers),h=g.next();
case 5:if(h.done){a=7;break}e=h.value;if(e.ready){a=8;break}a=6;break;case 8:return a=9,{value:e,done:!1};case 9:if(void 0===l){a=10;break}a=-1;throw l;case 10:case 6:h=g.next();a=5;break;case 7:case 2:d=k.next();a=1;break;case 3:a=-1;default:return{value:void 0,done:!0}}}var a=0,e,h,g,c,d,k,r=this,l={next:function(a){return b(a,void 0)},throw:function(a){return b(void 0,a)},return:function(b){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();l[Symbol.iterator]=function(){return this};
return l}},{key:"unbindManagedLayer",value:function(b){this.updateSignalBindings(b,g.b);b.dispose()}},{key:"clear",value:function(){for(var b=$jscomp.makeIterator(this.managedLayers),a=b.next();!a.done;a=b.next())this.unbindManagedLayer(a.value);this.managedLayers.length=0;this.layerSet.clear();this.layersChanged.dispatch()}},{key:"remove",value:function(b){var a=this.managedLayers[b];this.unbindManagedLayer(a);this.managedLayers.splice(b,1);this.layerSet.delete(a);this.layersChanged.dispatch()}},
{key:"removeManagedLayer",value:function(b){b=this.managedLayers.indexOf(b);if(-1===b)throw Error("Internal error: invalid managed layer.");this.remove(b)}},{key:"reorderManagedLayer",value:function(b,a){var e=this.managedLayers.length;b===a||0>b||b>=e||0>a||a>=e||(b=$jscomp.makeIterator(this.managedLayers.splice(b,1)).next().value,this.managedLayers.splice(a,0,b),this.layersChanged.dispatch())}},{key:"disposed",value:function(){this.clear();r(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),
"disposed",this).call(this)}},{key:"getLayerByName",value:function(b){return this.managedLayers.find(function(a){return a.name===b})}},{key:"getUniqueLayerName",value:function(b){for(var a=b,e=0;void 0!==this.getLayerByName(a);)a=b+ ++e;return a}},{key:"has",value:function(b){return this.layerSet.has(b)}},{key:"initializePosition",value:function(b){var e=this,h=this.boundPositions;h.has(b)||(h.add(b),h=a()(function(){e.updatePositionFromLayers(b)}),this.readyStateChanged.add(h),b.changed.add(h),this.updatePositionFromLayers(b))}},
{key:"updatePositionFromLayers",value:function(b){if(!b.valid)for(var a=$jscomp.makeIterator(this.managedLayers),e=a.next();!e.done;e=a.next())if(e=e.value.layer,null!=e){e=$jscomp.makeIterator(e.renderLayers);for(var h=e.next();!h.done;h=e.next())if(h=h.value,h.ready&&(b.voxelSize.valid||null==h.voxelSize||(t.s.copy(b.voxelSize.size,h.voxelSize),b.voxelSize.setValid()),!b.spatialCoordinatesValid&&!b.voxelCoordinatesValid&&null!=h.boundingBox)){h=h.boundingBox;var g=b.spatialCoordinates;t.s.add(g,
h.lower,h.upper);t.s.scale(g,g,.5);b.spatialCoordinatesValid=!0;b.changed.dispatch()}}}},{key:"invokeAction",value:function(b){for(var a=$jscomp.makeIterator(this.managedLayers),e=a.next();!e.done;e=a.next())if(e=e.value,null!==e.layer&&e.visible){e=e.layer;e.handleAction(b);e=$jscomp.makeIterator(e.renderLayers);for(var h=e.next();!h.done;h=e.next())h=h.value,h.ready&&h.handleAction(b)}}},{key:"renderLayerToManagedLayerMap",get:function(){var b=this.layersChanged.count,a=this.renderLayerToManagedLayerMap_;
if(this.renderLayerToManagedLayerMapGeneration!==b){this.renderLayerToManagedLayerMapGeneration=b;a.clear();b=$jscomp.makeIterator(this.managedLayers);for(var e=b.next();!e.done;e=b.next()){e=e.value;var h=e.layer;if(null!==h){h=$jscomp.makeIterator(h.renderLayers);for(var g=h.next();!g.done;g=h.next())a.set(g.value,e)}}}return a}},{key:"renderLayers",get:function(){var b=this;$jscomp.initSymbol();$jscomp.initSymbolIterator();var a={};return a[Symbol.iterator]=function(){function a(a,l){for(;;)switch(e){case 0:r=
$jscomp.makeIterator(b.managedLayers),k=r.next();case 1:if(k.done){e=3;break}d=k.value;if(null!==d.layer){e=4;break}e=2;break;case 4:c=$jscomp.makeIterator(d.layer.renderLayers),g=c.next();case 5:if(g.done){e=7;break}h=g.value;e=8;return{value:h,done:!1};case 8:if(void 0===l){e=9;break}e=-1;throw l;case 9:case 6:g=c.next();e=5;break;case 7:case 2:k=r.next();e=1;break;case 3:e=-1;default:return{value:void 0,done:!0}}}var e=0,h,g,c,d,k,r,l={next:function(b){return a(b,void 0)},throw:function(b){return a(void 0,
b)},return:function(b){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();l[Symbol.iterator]=function(){return this};return l},a}},{key:"visibleRenderLayers",get:function(){var b=this;$jscomp.initSymbol();$jscomp.initSymbolIterator();var a={};return a[Symbol.iterator]=function(){function a(a,l){for(;;)switch(e){case 0:r=$jscomp.makeIterator(b.managedLayers),k=r.next();case 1:if(k.done){e=3;break}d=k.value;if(null!==d.layer&&d.visible){e=4;break}e=2;break;case 4:c=$jscomp.makeIterator(d.layer.renderLayers),
g=c.next();case 5:if(g.done){e=7;break}h=g.value;e=8;return{value:h,done:!1};case 8:if(void 0===l){e=9;break}e=-1;throw l;case 9:case 6:g=c.next();e=5;break;case 7:case 2:k=r.next();e=1;break;case 3:e=-1;default:return{value:void 0,done:!0}}}var e=0,h,g,c,d,k,r,l={next:function(b){return a(b,void 0)},throw:function(b){return a(void 0,b)},return:function(b){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();l[Symbol.iterator]=function(){return this};return l},a}}]);return e}(m.a),J=
function(){function b(){var a=this;u(this,b);this.changed=new k.a;this.position=t.s.create();this.active=!1;this.pickedRenderLayer=null;this.pickedValue=new e.a(0,0);this.pickedOffset=0;this.updater=this.pickedAnnotationId=this.pickedAnnotationLayer=void 0;this.stale=!1;this.triggerUpdate=c()(function(){a.update()},50,{leading:!0,trailing:!0})}A(b,[{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 b=this.updater;this.stale=!1;b?this.setActive(b(this)):this.setActive(!1)}},{key:"setActive",value:function(b){this.stale=!1;if(this.active!==b||!0===b)this.active=b,this.changed.dispatch()}}]);return b}(),C=function(b){function a(b,e){u(this,a);var h=p(this,(a.__proto__||Object.getPrototypeOf(a)).call(this));h.layerManager=b;h.mouseState=e;h.values=new Map;h.changed=new k.a;h.needsUpdate=!0;h.registerDisposer(e.changed.add(function(){h.handleChange()}));
h.registerDisposer(b.layersChanged.add(function(){h.handleLayerChange()}));return h}q(a,b);A(a,[{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 b=this.values,a=this.mouseState;b.clear();if(a.active)for(var e=a.position,h=$jscomp.makeIterator(this.layerManager.managedLayers),g=h.next();!g.done;g=h.next()){g=
g.value;var c=g.layer;g.visible&&c&&b.set(c,c.getValueAt(e,a))}}}},{key:"get",value:function(b){this.update();return this.values.get(b)}},{key:"toJSON",value:function(){this.update();for(var b={},a=this.values,h=$jscomp.makeIterator(this.layerManager.managedLayers),g=h.next();!g.done;g=h.next()){g=g.value;var c=g.layer;c&&(c=a.get(c),void 0!==c&&(c instanceof e.a&&(c={t:"u64",v:c}),b[g.name]=c))}return b}}]);return a}(m.a),B=function(b){function e(b,h,g,c,d){u(this,e);var k=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));
k.layerManager=b;k.renderLayerType=h;k.roles=g;k.layerAdded=c;k.visibility=d;k.visibleLayers=new Map;k.newVisibleLayers=new Set;k.debouncedUpdateVisibleLayers=k.registerCancellable(a()(function(){return k.updateVisibleLayers()},0));k.registerDisposer(b.layersChanged.add(k.debouncedUpdateVisibleLayers));k.registerDisposer(g.changed.add(k.debouncedUpdateVisibleLayers));k.updateVisibleLayers();return k}q(e,b);A(e,[{key:"disposed",value:function(){this.visibleLayers.forEach(function(b){return b()});this.visibleLayers.clear();
r(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"disposed",this).call(this)}},{key:"updateVisibleLayers",value:function(){for(var b=this.visibleLayers,a=this.newVisibleLayers,e=this.renderLayerType,h=this.layerAdded,g=this.roles,c={},d=$jscomp.makeIterator(this.layerManager.readyRenderLayers()),k=d.next();!k.done;c={disposer:c.disposer,visibilityDisposer:c.visibilityDisposer,typedLayer:c.typedLayer},k=d.next())k=k.value,k instanceof e&&g.has(k.role)&&(c.typedLayer=k,a.add(c.typedLayer),
b.has(c.typedLayer)||(c.visibilityDisposer=c.typedLayer.visibility.add(this.visibility),c.disposer=h(c.typedLayer),b.set(c.typedLayer.addRef(),function(b){return function(){b.disposer();b.visibilityDisposer();b.typedLayer.dispose()}}(c))));e=$jscomp.makeIterator(b);for(h=e.next();!h.done;h=e.next())g=$jscomp.makeIterator(h.value),h=g.next().value,g=g.next().value,a.has(h)||(b.delete(h),g());a.clear()}},{key:"getVisibleLayers",value:function(){this.debouncedUpdateVisibleLayers.flush();return[].concat($jscomp.arrayFromIterable(this.visibleLayers.keys()))}}]);
return e}(m.a),F=function(b){function a(b){u(this,a);var e=p(this,(a.__proto__||Object.getPrototypeOf(a)).call(this));e.layerManager=b;e.changed=new k.a;e.visible_=!1;e.registerDisposer(b);return e}q(a,b);A(a,[{key:"toJSON",value:function(){if(void 0!==this.layer)return{layer:this.layer.name,visible:!0===this.visible?!0:void 0}}},{key:"restoreState",value:function(b){if(void 0===b)this.reset();else{Object(l.t)(b);var a=Object(l.v)(b,"layer",l.y);this.layer=void 0!==a?this.layerManager.getLayerByName(a):
void 0;this.visible=Object(l.v)(b,"visible",l.w)?!0:!1}}},{key:"reset",value:function(){this.layer=void 0}},{key:"layer",get:function(){return this.layer_},set:function(b){var a=this;if(b!==this.layer_){void 0!==this.layer_&&(this.existingLayerDisposer(),this.existingLayerDisposer=void 0);this.layer_=b;if(void 0!==b){var e=function(){a.layer_=void 0;a.visible=!1;a.existingLayerDisposer=void 0;a.changed.dispatch()};b.registerDisposer(e);var h=b.specificationChanged.add(function(){a.changed.dispatch()});
this.existingLayerDisposer=function(){var a=b.layer;null!==a&&(a=a.tool.value,void 0!==a&&a.deactivate());b.unregisterDisposer(e);h()}}else this.visible_=!1;this.changed.dispatch()}}},{key:"visible",get:function(){return this.visible_},set:function(b){void 0===this.layer_&&(b=!1);this.visible_!==b&&(this.visible_=b,this.changed.dispatch())}}]);return a}(m.a),P=function(b){function e(b,h){u(this,e);var g=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));g.layerManager=b;g.filter=h;g.changed=
new k.a;g.validate=a()(function(){var b=g.layerName_;void 0!==b&&(b=g.layerManager.getLayerByName(b),void 0!==b&&g.filter(b)?g.layer_=b:(g.layer_=void 0,g.layerName_=void 0),g.changed.dispatch())},0);g.registerDisposer(b);g.registerDisposer(b.specificationChanged.add(function(){var b=g.layer_;void 0!==b&&(g.layerManager.layerSet.has(b)&&g.filter(b)?(b=b.name,b!==g.layerName_&&(g.layerName_=b,g.changed.dispatch())):(g.layer_=void 0,g.layerName_=void 0,g.changed.dispatch()))}));return g}q(e,b);A(e,
[{key:"restoreState",value:function(b){this.layerName=Object(l.y)(b)}},{key:"toJSON",value:function(){var b=this.layer_;return void 0!==b?b.name:this.layerName_}},{key:"reset",value:function(){this.layer_=this.layerName_=void 0;this.changed.dispatch()}},{key:"layer",get:function(){return this.layer_},set:function(b){this.layer_!==b&&(void 0!==b&&this.layerManager.layerSet.has(b)&&this.filter(b)?(this.layer_=b,this.layerName_=b.name):this.layerName_=this.layer_=void 0,this.changed.dispatch())}},{key:"layerName",
get:function(){return this.layerName_},set:function(b){b!==this.layerName_&&(this.layer_=void 0,this.layerName_=b,this.changed.dispatch(),this.validate())}}]);return e}(m.a)},function(m,f,d){d.d(f,"a",function(){return n});f.b=function(c,d,l,k){for(var g=[],e=3;e<arguments.length;++e)g[e-3]=arguments[e];return c.memoize.get(Object(p.g)({id:"getMemoizedBuffer",getter:Object(q.a)(l),args:g}),function(){var b=new u.b(n.fromData(c,l.apply(null,[].concat($jscomp.arrayFromIterable(g))),d,a.v));b.registerDisposer(b.value);
return b})};var u=d(0),p=d(2),q=d(25),a=d(11),c=function(){function a(a,c){for(var d=0;d<c.length;d++){var g=c[d];g.enumerable=g.enumerable||!1;g.configurable=!0;"value"in g&&(g.writable=!0);Object.defineProperty(a,g.key,g)}}return function(c,d,k){d&&a(c.prototype,d);k&&a(c,k);return c}}(),n=function(){function d(c,l){l=void 0===l?a.a:l;if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");this.gl=c;this.bufferType=l;this.gl=c;this.buffer=c.createBuffer()}c(d,[{key:"bind",
value:function(){this.gl.bindBuffer(this.bufferType,this.buffer)}},{key:"bindToVertexAttrib",value:function(c,d,k,g,e,b){k=void 0===k?a.g:k;g=void 0===g?!1:g;e=void 0===e?0:e;b=void 0===b?0:b;this.bind();this.gl.enableVertexAttribArray(c);this.gl.vertexAttribPointer(c,d,k,g,e,b)}},{key:"setData",value:function(c,d){d=void 0===d?a.v:d;var k=this.gl;this.bind();k.bufferData(this.bufferType,c,d)}},{key:"dispose",value:function(){this.gl.deleteBuffer(this.buffer);this.gl=this.buffer=void 0}}],[{key:"fromData",
value:function(a,c,k,g){a=new d(a,k);a.setData(c,g);return a}}]);return d}()},function(m,f,d){d.d(f,"k",function(){return q});f.s=function(a){return(a[3]+1/256*a[2]+1/65536*a[1]+1/16777216*a[0])/256};d.d(f,"h",function(){return a});d.d(f,"g",function(){return v});d.d(f,"i",function(){return t});d.d(f,"e",function(){return l});f.r=function(a,g){for(var e=0;4>e;++e)a[e]=(g>>8*e&255)/255;return a};f.a=function(a,g){g=void 0===g?1:g;switch(a){case u.b.FLOAT32:if(1===g)return"float";if(1<g&&4>g)return"vec"+
g;break;case u.b.UINT8:if(1===g)return"uint8_t";if(1<g&&4>g)return"uint8x"+g+"_t";break;case u.b.UINT16:if(1===g)return"uint16_t";if(2===g)return"uint16x2_t";break;case u.b.UINT32:if(1===g)return"uint32_t";break;case u.b.UINT64:if(1===g)return"uint64_t"}throw Error("No shader type for "+u.b[a]+"["+g+"].");};var u=d(44),p=d(195),q="\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",
a="\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";m=["float","vec2","vec3","vec4"].map(function(a){return"\n"+a+" unnormalizeUint8("+a+" value) {\n  return floor(value * 255.0 + 0.5);\n}\n"}).join("");f.q=m;var c=[m,"\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"];
f.p=c;var n=[m,"\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=p.a===p.b.BIG?"be":"le";return[p.a===p.b.BIG?n:c,"\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"]})();f.n="\nstruct uint64_t {\n  vec4 low, high;\n};\nuint64_t toUint64(uint64_t x) { return x; }\n";f.o=[m,"\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"];
f.f="\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";f.l=["\nstruct uint64_t {\n  vec4 low, high;\n};\nuint64_t toUint64(uint64_t x) { return x; }\n",c,"\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"];
m=["\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"];f.m=m;var v=["\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"],t="\nfloat imod(float x, float y) {\n  return x - y * floor(x / y);\n}\n",l="\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";f.d=[m,"\nbool equal(uint32_t a, uint32_t b) {\n  return all(lessThan(abs(a.value - b.value), vec4(1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0)));\n}\n"];
f.b=[m,"\nuint32_t add(uint32_t a, float b) {\n  uint32_t result;\n  float partial = 0.0;\n\n  partial += a.value.x * 255.0 + b;\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;\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;\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;\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\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"];
f.j=[m,"\nuint32_t multiply(uint32_t a, float b) {\n  uint32_t result;\n  float partial = 0.0;\n  partial += a.value.x * 255.0 * b;\n  {\n    float byte0 = mod(floor(partial + 0.5), 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;\n  {\n    float byte1 = mod(floor(partial + 0.5), 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;\n  {\n    float byte2 = mod(floor(partial + 0.5), 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;\n  {\n    float byte3 = mod(floor(partial + 0.5), 256.0);\n    result.value.w = byte3 / 255.0;\n    partial = (partial - byte3) / 256.0;\n  }\n  return result;\n}\n"];
f.c=[m,"\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(m,f,d){function u(b,a){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?b:a}function p(b,a){if("function"!==typeof a&&null!==a)throw new TypeError("Super expression must either be null or a function, not "+typeof a);b.prototype=Object.create(a&&a.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}});a&&(Object.setPrototypeOf?Object.setPrototypeOf(b,a):b.__proto__=a)}function q(b,
a){if(!(b instanceof a))throw new TypeError("Cannot call a class as a function");}function a(b){if("number"!==typeof b||0>b)throw Error("Expected non-negative number as limit, but received: "+JSON.stringify(b));return b}d.d(f,"b",function(){return A});d.d(f,"a",function(){return y});d.d(f,"d",function(){return z});d.d(f,"c",function(){return E});d.d(f,"e",function(){return x});f.f=function(a,g){a=function(a){function e(b){for(var a=[],h=0;h<arguments.length;++h)a[h-0]=arguments[h];q(this,e);var g;
h=u(this,(g=e.__proto__||Object.getPrototypeOf(e)).call.apply(g,[].concat([this],$jscomp.arrayFromIterable(a))));h.parameters=a[1].parameters;return h}p(e,a);h(e,[{key:"initializeCounterpart",value:function(a,h){h.parameters=this.parameters;b(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"initializeCounterpart",this).call(this,a,h)}}],[{key:"encodeOptions",value:function(a){var h=b(e.__proto__||Object.getPrototypeOf(e),"encodeOptions",this).call(this,a);h.parameters=a.parameters;return h}}]);
return e}(a);return a=r([Object(e.g)(g.RPC_ID)],a)};var c=d(36),n=d(63),v=d(6),t=d(2),l=d(64),k=d(25),g=d(3),e=d(12),b=function G(b,a,e){null===b&&(b=Function.prototype);var h=Object.getOwnPropertyDescriptor(b,a);if(void 0===h){if(b=Object.getPrototypeOf(b),null!==b)return G(b,a,e)}else{if("value"in h)return h.value;a=h.get;return void 0===a?void 0:a.call(e)}},h=function(){function b(b,a){for(var e=0;e<a.length;e++){var h=a[e];h.enumerable=h.enumerable||!1;h.configurable=!0;"value"in h&&(h.writable=
!0);Object.defineProperty(b,h.key,h)}}return function(a,e,h){e&&b(a.prototype,e);h&&b(a,h);return a}}(),r=this&&this.__decorate||function(b,a,e,h){var g=arguments.length,c=3>g?a:null===h?h=Object.getOwnPropertyDescriptor(a,e):h,d;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)c=Reflect.decorate(b,a,e,h);else for(var k=b.length-1;0<=k;k--)if(d=b[k])c=(3>g?d(c):3<g?d(a,e,c):d(a,e))||c;return 3<g&&c&&Object.defineProperty(a,e,c),c},A=function(){function b(a){q(this,b);this.source=
a;this.state=c.d.SYSTEM_MEMORY}h(b,[{key:"copyToGPU",value:function(b){this.state=c.d.GPU_MEMORY}},{key:"freeGPUMemory",value:function(b){this.state=c.d.SYSTEM_MEMORY}},{key:"gl",get:function(){return this.source.gl}}]);return b}(),y=function J(b){var e=void 0===b?{}:b;b=void 0===e.defaultItemLimit?Number.POSITIVE_INFINITY:e.defaultItemLimit;e=void 0===e.defaultSizeLimit?Number.POSITIVE_INFINITY:e.defaultSizeLimit;q(this,J);this.sizeLimit=new v.c(e,a);this.itemLimit=new v.c(b,a)},z=function(b){function a(b,
e,h){q(this,a);var c=u(this,(a.__proto__||Object.getPrototypeOf(a)).call(this));c.gl=e;c.capacities=h;c.visibleChunksChanged=new g.a;c.pendingChunkUpdates=null;c.pendingChunkUpdatesTail=null;c.chunkUpdateDeadline=null;c.chunkUpdateDelay=30;e=function(a){return{itemLimit:c.registerDisposer(n.a.makeFromExisting(b,a.itemLimit)).rpcId,sizeLimit:c.registerDisposer(n.a.makeFromExisting(b,a.sizeLimit)).rpcId}};c.initializeCounterpart(b,{gpuMemoryCapacity:e(h.gpuMemory),systemMemoryCapacity:e(h.systemMemory),
downloadCapacity:e(h.download)});return c}p(a,b);h(a,[{key:"scheduleChunkUpdate",value:function(){var b=this.chunkUpdateDeadline;b=null===b||Date.now()<b?0:this.chunkUpdateDelay;setTimeout(this.processPendingChunkUpdates.bind(this),b)}},{key:"processPendingChunkUpdates",value:function(){var b=this.chunkUpdateDeadline;null===b&&(b=Date.now()+30);for(var a=!1;;){if(Date.now()>b){setTimeout(this.processPendingChunkUpdates.bind(this),this.chunkUpdateDelay);break}var e=this.pendingChunkUpdates;this.applyChunkUpdate(e)&&
(a=!0);e=this.pendingChunkUpdates=e.nextUpdate;--window.numPendingChunkUpdates;if(null==e){this.pendingChunkUpdatesTail=null;break}}a&&this.visibleChunksChanged.dispatch()}},{key:"applyChunkUpdate",value:function(b){var a=!1,e=this.rpc.get(b.source);if(void 0===b.id){a=$jscomp.makeIterator(e.chunks.keys());for(var h=a.next();!h.done;h=a.next())e.deleteChunk(h.value);a=!0}else if(h=b.state,h===c.d.EXPIRED)e.deleteChunk(b.id);else{var g=b.id;b["new"]?(b=e.getChunk(b),e.addChunk(g,b)):b=e.chunks.get(g);
if(h!==b.state)switch(h){case c.d.GPU_MEMORY:b.copyToGPU(this.gl);a=!0;break;case c.d.SYSTEM_MEMORY:b.freeGPUMemory(this.gl);break;default:throw Error("INTERNAL ERROR: Invalid chunk state: "+c.d[h]);}}return a}}]);return a}(e.b);z=r([Object(e.g)(c.b)],z);window.numPendingChunkUpdates=0;Object(e.e)("Chunk.update",function(b){var a=this.get(b.source),e=a.chunkManager.chunkQueueManager;a.immediateChunkUpdates?e.applyChunkUpdate(b)&&e.visibleChunksChanged.dispatch():(a=e.pendingChunkUpdatesTail,++window.numPendingChunkUpdates,
null==a?(e.pendingChunkUpdates=b,e.pendingChunkUpdatesTail=b,e.scheduleChunkUpdate()):(a.nextUpdate=b,e.pendingChunkUpdatesTail=b))});var E=function(b){function a(b){q(this,a);var e=u(this,(a.__proto__||Object.getPrototypeOf(a)).call(this));e.chunkQueueManager=b;e.memoize=new l.b;e.registerDisposer(b.addRef());e.initializeCounterpart(b.rpc,{chunkQueueManager:b.rpcId});return e}p(a,b);h(a,[{key:"getChunkSource",value:function(b,a){var e=this,h=b.encodeOptions(a);h.constructorId=Object(k.a)(b);h=Object(t.g)(h);
return this.memoize.get(h,function(){var h=new b(e,a);h.initializeCounterpart(e.rpc,{});return h})}},{key:"gl",get:function(){return this.chunkQueueManager.gl}}]);return a}(e.b);E=r([Object(e.g)(c.a)],E);var x=function(a){function e(b,a){q(this,e);a=u(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));a.chunkManager=b;a.chunks=new Map;a.immediateChunkUpdates=!1;return a}p(e,a);h(e,[{key:"initializeCounterpart",value:function(a,h){h.chunkManager=this.chunkManager.rpcId;b(e.prototype.__proto__||
Object.getPrototypeOf(e.prototype),"initializeCounterpart",this).call(this,a,h)}},{key:"deleteChunk",value:function(b){var a=this.chunks.get(b);a.state===c.d.GPU_MEMORY&&a.freeGPUMemory(this.gl);this.chunks.delete(b)}},{key:"addChunk",value:function(b,a){this.chunks.set(b,a)}},{key:"getChunk",value:function(b){throw Error("Not implemented.");}},{key:"invalidateCache",value:function(){this.rpc.invoke(c.c,{id:this.rpcId})}},{key:"gl",get:function(){return this.chunkManager.chunkQueueManager.gl}}],[{key:"encodeOptions",
value:function(b){return{}}}]);return e}(e.b)},function(m,f,d){function u(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}d.d(f,"c",function(){return v});d.d(f,"b",function(){return t});var p=d(31),q=d(44),a=d(1);d.d(f,"a",function(){return q.b});
var c=function(){function a(a,g){for(var e=0;e<g.length;e++){var b=g[e];b.enumerable=b.enumerable||!1;b.configurable=!0;"value"in b&&(b.writable=!0);Object.defineProperty(a,b.key,b)}}return function(c,g,e){g&&a(c.prototype,g);e&&a(c,e);return c}}(),n=function k(a,e,b){null===a&&(a=Function.prototype);var h=Object.getOwnPropertyDescriptor(a,e);if(void 0===h){if(a=Object.getPrototypeOf(a),null!==a)return k(a,e,b)}else{if("value"in h)return h.value;e=h.get;return void 0===e?void 0:e.call(b)}},v;(function(a){a[a.UNKNOWN=
0]="UNKNOWN";a[a.IMAGE=1]="IMAGE";a[a.SEGMENTATION=2]="SEGMENTATION"})(v||(v={}));var t=function(d){function g(e){if(!(this instanceof g))throw new TypeError("Cannot call a class as a function");for(var b=void 0===e.lowerVoxelBound?a.h:e.lowerVoxelBound,h=e.upperVoxelBound,c=e.chunkDataSize,d=e.voxelSize,k=e.transform,n=void 0===e.baseVoxelOffset?a.h:e.baseVoxelOffset,t=void 0===e.lowerClipBound?a.s.multiply(a.s.create(),d,b):e.lowerClipBound,f=void 0===e.upperClipBound?a.s.multiply(a.s.create(),
d,h):e.upperClipBound,v=a.s.multiply(a.s.create(),c,d),G=a.s.create(),J=a.s.create(),C=0;3>C;++C)G[C]=Math.floor(b[C]/c[C]),J[C]=Math.floor((h[C]-1)/c[C]+1);d=(g.__proto__||Object.getPrototypeOf(g)).call(this,{voxelSize:d,transform:k,lowerChunkBound:G,upperChunkBound:J,chunkSize:v});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.baseVoxelOffset=n;d.lowerClipBound=t;d.upperClipBound=f;d.lowerVoxelBound=
b;d.upperVoxelBound=h;d.chunkDataSize=c;b=d.dataType=e.dataType;h=d.numChannels=e.numChannels;d.chunkBytes=Object(a.l)(c)*q.a[b]*h;d.compressedSegmentationBlockSize=e.compressedSegmentationBlockSize;return d}u(g,d);c(g,[{key:"toObject",value:function(){return Object.assign({},n(g.prototype.__proto__||Object.getPrototypeOf(g.prototype),"toObject",this).call(this),{numChannels:this.numChannels,chunkDataSize:this.chunkDataSize,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(a){return new g(Object.assign({},a,{transform:Object(p.m)(a.transform,a.volumeSourceOptions)}))}},{key:"fromObject",value:function(a){return new g(a)}},{key:"withDefaultCompression",value:function(a){var b=a.compressedSegmentationBlockSize,e=a.dataType,c=a.voxelSize,d=a.transform,k=a.lowerVoxelBound,
n=a.upperVoxelBound;d=Object(p.m)(d,a.volumeSourceOptions);void 0!==b||a.volumeType!==v.SEGMENTATION||e!==q.b.UINT32&&e!==q.b.UINT64||(b=Object(p.n)({voxelSize:c,transform:d,lowerVoxelBound:k,upperVoxelBound:n,maxVoxelsPerChunkLog2:9}));return new g(Object.assign({},a,{compressedSegmentationBlockSize:b,transform:d}))}},{key:"getDefaults",value:function(a){var b=Object.assign({},a,{transform:Object(p.m)(a.transform,a.volumeSourceOptions)});return(void 0===a.chunkDataSizes?Object(p.l)(b):a.chunkDataSizes).map(function(b){return g.withDefaultCompression(Object.assign({},
a,{chunkDataSize:b}))})}}]);return g}(p.k)},function(m,f,d){function u(a,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);a.prototype=Object.create(e&&e.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});e&&(Object.setPrototypeOf?Object.setPrototypeOf(a,e):a.__proto__=e)}function p(a,e){var b="";e&1&&(b+="control+");e&2&&(b+="alt+");e&4&&(b+="meta+");e&8&&(b+="shift+");return b+a}function q(a){return"string"===
typeof a?{action:a}:a}function a(a){function e(e,d){for(;;)switch(b){case 0:c=a.indexOf(":");a:{e=void 0;var k=a.substring(c+1).split("+"),r=0;k=$jscomp.makeIterator(k);for(var l=k.next();!l.done;l=k.next())switch(l=l.value,l){case "control":r|=1;break;case "alt":r|=2;break;case "meta":r|=4;break;case "shift":r|=8;break;default:if(void 0===e)e=l;else{g=void 0;break a}}g=void 0===e?void 0:p(e,r)}if(void 0!==g){b=1;break}b=-1;throw Error("Invalid event identifier: "+JSON.stringify(a));case 1:if(-1===
c){b=2;break}h=a.substring(0,c);if("at"===h||"bubble"===h){b=4;break}b=-1;throw Error("Invalid event phase: "+JSON.stringify(h));case 4:return b=5,{value:h+":"+g,done:!1};case 5:if(void 0===d){b=6;break}b=-1;throw d;case 6:b=3;break;case 2:return b=7,{value:"at:"+g,done:!1};case 7:if(void 0===d){b=8;break}b=-1;throw d;case 8:return b=9,{value:"bubble:"+g,done:!1};case 9:if(void 0===d){b=10;break}b=-1;throw d;case 10:case 3:b=-1;default:return{value:void 0,done:!0}}}var b=0,h,g,c,d={next:function(b){return e(b,
void 0)},throw:function(b){return e(void 0,b)},return:function(b){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();d[Symbol.iterator]=function(){return this};return d}d.d(f,"a",function(){return l});f.b=function(a,e,b){a=k[e.eventPhase]+":"+p(a,(e.ctrlKey?1:0)|(e.altKey?2:0)|(e.metaKey?4:0)|(e.shiftKey?8:0));b=b.get(a);void 0!==b&&(!1!==b.stopPropagation&&e.stopPropagation(),a=new CustomEvent("action:"+b.action,{bubbles:!0,detail:e,cancelable:!0}),a=!e.target.dispatchEvent(a),(!1!==
b.preventDefault||a)&&e.preventDefault())};f.c=function(a,e,b,h){return Object(c.c)(a,"action:"+e,b,h)};var c=d(0);m=d(207);var n=function(){function a(a,b){for(var e=0;e<b.length;e++){var g=b[e];g.enumerable=g.enumerable||!1;g.configurable=!0;"value"in g&&(g.writable=!0);Object.defineProperty(a,g.key,g)}}return function(e,b,h){b&&a(e.prototype,b);h&&a(e,h);return e}}(),v=function e(b,a,c){null===b&&(b=Function.prototype);var h=Object.getOwnPropertyDescriptor(b,a);if(void 0===h){if(b=Object.getPrototypeOf(b),
null!==b)return e(b,a,c)}else{if("value"in h)return h.value;a=h.get;return void 0===a?void 0:a.call(c)}},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 l=function(e){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}u(b,e);n(b,[{key:"setFromObject",value:function(b){for(var a=$jscomp.makeIterator(Object.keys(b)),e=a.next();!e.done;e=a.next())e=e.value,this.set(e,q(b[e]))}},{key:"set",value:function(e,c){c=q(c);e=$jscomp.makeIterator(a(e));for(var h=e.next();!h.done;h=e.next())h=h.value,v(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"set",this).call(this,h,c)}},{key:"delete",value:function(e){e=$jscomp.makeIterator(a(e));for(var h=e.next();!h.done;h=e.next())h=
h.value,v(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"delete",this).call(this,h)}}],[{key:"fromObject",value:function(a,e){e=void 0===e?{}:e;var h=new b;h.label=e.label;if(void 0!==e.parents){e=$jscomp.makeIterator(e.parents);for(var c=e.next();!c.done;c=e.next()){var d=$jscomp.makeIterator(c.value);c=d.next().value;d=d.next().value;h.addParent(c,d)}}e=$jscomp.makeIterator(Object.keys(a));for(c=e.next();!c.done;c=e.next())c=c.value,h.set(c,q(a[c]));return h}}]);return b}(m.a),k=[];
k[Event.AT_TARGET]="at";k[Event.CAPTURING_PHASE]="capture";k[Event.BUBBLING_PHASE]="bubble"},function(m,f,d){function u(b,a){if(!(b instanceof a))throw new TypeError("Cannot call a class as a function");}function p(b,a){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?b:a}function q(b,a){if("function"!==typeof a&&null!==a)throw new TypeError("Super expression must either be null or a function, not "+typeof a);
b.prototype=Object.create(a&&a.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}});a&&(Object.setPrototypeOf?Object.setPrototypeOf(b,a):b.__proto__=a)}function a(b,a,e,h){h=void 0===h?{}:h;return v.a.forPromise(new Promise(function(c){c(b.getVolume(a,e,h))}),{initialMessage:"Retrieving metadata for volume "+e+".",delay:!0,errorPrefix:"Error retrieving metadata for volume "+e+": "})}f.d=a;d.d(f,"b",function(){return g});d.d(f,"c",function(){return e});d.d(f,"a",function(){return b});
f.e=function(b,a){h.set(b,a)};f.f=function(b,a){r.set(b,a)};var c=d(15),n=d(19),v=d(26);m=d(0);var t=d(2),l=d(3),k=function(){function b(b,a){for(var e=0;e<a.length;e++){var h=a[e];h.enumerable=h.enumerable||!1;h.configurable=!0;"value"in h&&(h.writable=!0);Object.defineProperty(b,h.key,h)}}return function(a,e,h){e&&b(a.prototype,e);h&&b(a,h);return a}}(),g=function(b){function a(b,e,h){u(this,a);b=p(this,(a.__proto__||Object.getPrototypeOf(a)).call(this,b));b.initialSpecification=e;b.manager=h;return b}
q(a,b);k(a,[{key:"toJSON",value:function(){var b=this.layer;if(!b)return this.initialSpecification;b=b.toJSON();this.visible||(b.visible=!1);return b}}]);return a}(c.d),e=function(b){function e(b,a,h,c,g){u(this,e);var d=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));d.dataSourceProvider=b;d.layerManager=a;d.chunkManager=h;d.layerSelectedValues=c;d.voxelSize=g;d.changed=new l.a;d.voxelCoordinatesSet=new l.b;d.spatialCoordinatesSet=new l.b;d.registerDisposer(a.layersChanged.add(d.changed.dispatch));
d.registerDisposer(a.specificationChanged.add(d.changed.dispatch));return d}q(e,b);k(e,[{key:"reset",value:function(){this.layerManager.clear()}},{key:"restoreState",value:function(b){Object(t.t)(b);this.layerManager.clear();for(var a=$jscomp.makeIterator(Object.keys(b)),e=a.next();!e.done;e=a.next())e=e.value,this.layerManager.addManagedLayer(this.getLayer(e,b[e]))}},{key:"initializeLayerFromSpec",value:function(b,e){var c=this;b.initialSpecification=e;"string"===typeof e&&(e={source:e});Object(t.t)(e);
var g=Object(t.v)(e,"type",t.y);b.visible=Object(t.v)(e,"visible",function(b){if(void 0===b||!0===b)return!0;if(!1===b)return!1;throw Error("Expected boolean, but received: "+JSON.stringify(b)+".");});var d=function(a,e){a=new a(c,e);a.restoreState(e);b.layer=a},k=b.sourceUrl=Object(t.v)(e,"source",t.y);if(void 0===g){if(void 0===k)throw Error("Either layer 'type' or 'source' URL must be specified.");a(this.dataSourceProvider,this.chunkManager,k).then(function(a){if(-1!==c.layerManager.managedLayers.indexOf(b)){var h=
r.get(a.volumeType);if(void 0!==h)d(h,e);else throw Error("Unsupported volume type: "+n.c[a.volumeType]+".");}})}else if(k=h.get(g),void 0!==k)d(k,e);else throw Error("Unsupported layer type: "+JSON.stringify(g)+".");}},{key:"getLayer",value:function(b,a){b=new g(b,a,this);this.initializeLayerFromSpec(b,a);return b}},{key:"add",value:function(b,a){-1===this.layerManager.managedLayers.indexOf(b)&&(b.name=this.layerManager.getUniqueLayerName(b.name));this.layerManager.addManagedLayer(b,a)}},{key:"toJSON",
value:function(){for(var b={},a=0,e=$jscomp.makeIterator(this.layerManager.managedLayers),h=e.next();!h.done;h=e.next()){h=h.value;var c=h.toJSON();null!=c&&(b[h.name]=c,++a)}if(0!==a)return b}},{key:"setVoxelCoordinates",value:function(b){this.voxelCoordinatesSet.dispatch(b)}},{key:"setSpatialCoordinates",value:function(b){this.spatialCoordinatesSet.dispatch(b)}},{key:"worker",get:function(){return this.chunkManager.rpc}},{key:"rpc",get:function(){return this.chunkManager.rpc}},{key:"rootLayers",
get:function(){return this.layerManager}}]);return e}(m.a),b=function(b){function a(b){u(this,a);var e=p(this,(a.__proto__||Object.getPrototypeOf(a)).call(this));e.master=b;e.changed=new l.a;e.layerManager=new c.a;e.registerDisposer(b);b=e.layerManager;e.registerDisposer(b.layersChanged.add(e.changed.dispatch));e.registerDisposer(b.specificationChanged.add(e.changed.dispatch));return e}q(a,b);k(a,[{key:"reset",value:function(){this.layerManager.clear()}},{key:"restoreState",value:function(b){var a=
this.master.layerManager,e=[];b=$jscomp.makeIterator(new Set(Object(t.a)(b,t.A)));for(var h=b.next();!h.done;h=b.next()){h=h.value;var c=a.getLayerByName(h);if(void 0===c)throw Error("Undefined layer referenced in subset specification: "+JSON.stringify(h));e.push(c)}this.layerManager.clear();a=$jscomp.makeIterator(e);for(e=a.next();!e.done;e=a.next())this.layerManager.addManagedLayer(e.value.addRef())}},{key:"toJSON",value:function(){return this.layerManager.managedLayers.map(function(b){return b.name})}},
{key:"initializeLayerFromSpec",value:function(b,a){this.master.initializeLayerFromSpec(b,a)}},{key:"getLayer",value:function(b,a){return this.master.getLayer(b,a)}},{key:"add",value:function(b,a){-1===this.master.layerManager.managedLayers.indexOf(b)&&(b.name=this.master.layerManager.getUniqueLayerName(b.name),this.master.layerManager.addManagedLayer(b.addRef()));this.layerManager.addManagedLayer(b,a)}},{key:"setVoxelCoordinates",value:function(b){this.master.setVoxelCoordinates(b)}},{key:"setSpatialCoordinates",
value:function(b){this.master.setSpatialCoordinates(b)}},{key:"voxelCoordinatesSet",get:function(){return this.master.voxelCoordinatesSet}},{key:"spatialCoordinatesSet",get:function(){return this.master.spatialCoordinatesSet}},{key:"worker",get:function(){return this.master.rpc}},{key:"rpc",get:function(){return this.master.rpc}},{key:"dataSourceProvider",get:function(){return this.master.dataSourceProvider}},{key:"chunkManager",get:function(){return this.master.chunkManager}},{key:"voxelSize",get:function(){return this.master.voxelSize}},
{key:"layerSelectedValues",get:function(){return this.master.layerSelectedValues}},{key:"rootLayers",get:function(){return this.master.rootLayers}}]);return a}(m.a),h=new Map,r=new Map},function(m,f,d){(function(f){var p=d(160),q=function(){};"production"!==f.env.NODE_ENV&&(q=d(9)("sockjs-client:utils:url"));m.exports={getOrigin:function(a){if(!a)return null;a=new p(a);if("file:"===a.protocol)return null;var c=a.port;c||(c="https:"===a.protocol?"443":"80");return a.protocol+"//"+a.hostname+":"+c},
isOriginEqual:function(a,c){var d=this.getOrigin(a)===this.getOrigin(c);q("same",a,c,d);return d},isSchemeEqual:function(a,c){return a.split(":")[0]===c.split(":")[0]},addPath:function(a,c){a=a.split("?");return a[0]+c+(a[1]?"?"+a[1]:"")},addQuery:function(a,c){return a+(-1===a.indexOf("?")?"?"+c:"&"+c)}}}).call(f,d(8))},function(m,f,d){function u(b,a){if(!(b instanceof a))throw new TypeError("Cannot call a class as a function");}function p(b,a){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!a||"object"!==typeof a&&"function"!==typeof a?b:a}function q(b,a){if("function"!==typeof a&&null!==a)throw new TypeError("Super expression must either be null or a function, not "+typeof a);b.prototype=Object.create(a&&a.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}});a&&(Object.setPrototypeOf?Object.setPrototypeOf(b,a):b.__proto__=a)}function a(b){return E.get(b)}function c(b){var e=a(b.type).toJSON(b);e.type=y[b.type].toLowerCase();e.id=b.id;e.description=b.description||
void 0;b=b.segments;void 0!==b&&0<b.length&&(e.segments=b.map(function(b){return b.toString()}));return e}function n(b,e){e=void 0===e?!1:e;Object(g.t)(b);var c=Object(g.v)(b,"type",function(b){return Object(g.m)(b,y)});e={id:Object(g.v)(b,"id",e?g.y:g.A)||v(),description:Object(g.v)(b,"description",g.y),segments:Object(g.v)(b,"segments",function(b){return void 0===b?void 0:Object(g.a)(b,function(b){return h.a.parseString(b)})}),type:c};a(c).restoreState(e,b);return e}function v(){return Object(e.a)(160)}
function t(b,a){return b.id<a.id?-1:b.id===a.id?0:1}function l(b){for(var e=0,h=[],c=0,g=0,d=$jscomp.makeIterator(z),k=d.next();!k.done;k=d.next()){k=k.value;h[k]=e;for(var r=b[k],l=0,n=$jscomp.makeIterator(r),A=n.next();!A.done;A=n.next())A=A.value.segments,void 0!==A&&(l+=A.length);g+=r.length;c+=l;r.sort(t);r=r.length;k=a(k);e+=k.serializedBytes*r}var f=new Uint32Array(g+1),v=new Uint32Array(2*c);c=[];e=new ArrayBuffer(e);var y=0,p=0;g={};d=$jscomp.makeIterator(z);for(k=d.next();!k.done;g={serializer:g.serializer},
k=d.next())k=k.value,r=b[k],c[k]=r.map(function(b){return b.id}),l=r.length,n=a(k),g.serializer=n.serializer(e,h[k],l),r.forEach(function(b){return function(a,e){b.serializer(a,e);f[p++]=y;a=a.segments;if(void 0!==a)for(a=$jscomp.makeIterator(a),e=a.next();!e.done;e=a.next())e=e.value,v[2*y]=e.low,v[2*y+1]=e.high,++y}}(g));return{data:new Uint8Array(e),typeToIds:c,typeToOffset:h,segmentListIndex:f,segmentList:v}}d.d(f,"a",function(){return A});d.d(f,"c",function(){return y});f.g=a;d.d(f,"b",function(){return x});
d.d(f,"d",function(){return D});f.h=v;f.i=function(b,a){return{type:y.AXIS_ALIGNED_BOUNDING_BOX,id:"data-bounds",description:"Data Bounds",pointA:b,pointB:a}};f.f=function(b){if(null==b)return b;var a=b.segments;void 0!==a&&(b.segments=a.map(function(b){return new h.a(b.low,b.high)}));return b};m=d(0);var k=d(1),g=d(2),e=d(107),b=d(3),h=d(14),r=function(){function b(b,a){for(var e=0;e<a.length;e++){var h=a[e];h.enumerable=h.enumerable||!1;h.configurable=!0;"value"in h&&(h.writable=!0);Object.defineProperty(b,
h.key,h)}}return function(a,e,h){e&&b(a.prototype,e);h&&b(a,h);return a}}(),A=function(a){function e(a){u(this,e);var h=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));h.id=a;h.changed=new b.a;return h}q(e,a);return e}(m.a),y;(function(b){b[b.POINT=0]="POINT";b[b.LINE=1]="LINE";b[b.AXIS_ALIGNED_BOUNDING_BOX=2]="AXIS_ALIGNED_BOUNDING_BOX";b[b.ELLIPSOID=3]="ELLIPSOID"})(y||(y={}));var z=[y.POINT,y.LINE,y.AXIS_ALIGNED_BOUNDING_BOX,y.ELLIPSOID];f.e=z;var E=new Map;E.set(y.LINE,{icon:"\ua579",
description:"Line",toJSON:function(b){return{pointA:Array.from(b.pointA),pointB:Array.from(b.pointB)}},restoreState:function(b,a){b.pointA=Object(g.v)(a,"pointA",g.k);b.pointB=Object(g.v)(a,"pointB",g.k)},serializedBytes:24,serializer:function(b,a,e){var h=new Float32Array(b,a,6*e);return function(b,a){var e=b.pointA;b=b.pointB;a*=6;h[a]=e[0];h[a+1]=e[1];h[a+2]=e[2];h[a+3]=b[0];h[a+4]=b[1];h[a+5]=b[2]}}});E.set(y.POINT,{icon:"\u26ac",description:"Point",toJSON:function(b){return{point:Array.from(b.point)}},
restoreState:function(b,a){b.point=Object(g.v)(a,"point",g.k)},serializedBytes:12,serializer:function(b,a,e){var h=new Float32Array(b,a,3*e);return function(b,a){b=b.point;a*=3;h[a]=b[0];h[a+1]=b[1];h[a+2]=b[2]}}});E.set(y.AXIS_ALIGNED_BOUNDING_BOX,{icon:"\u2751",description:"Bounding Box",toJSON:function(b){return{pointA:Array.from(b.pointA),pointB:Array.from(b.pointB)}},restoreState:function(b,a){b.pointA=Object(g.v)(a,"pointA",g.k);b.pointB=Object(g.v)(a,"pointB",g.k)},serializedBytes:24,serializer:function(b,
a,e){var h=new Float32Array(b,a,6*e);return function(b,a){var e=b.pointA;b=b.pointB;a*=6;h[a]=Math.min(e[0],b[0]);h[a+1]=Math.min(e[1],b[1]);h[a+2]=Math.min(e[2],b[2]);h[a+3]=Math.max(e[0],b[0]);h[a+4]=Math.max(e[1],b[1]);h[a+5]=Math.max(e[2],b[2])}}});E.set(y.ELLIPSOID,{icon:"\u25ce",description:"Ellipsoid",toJSON:function(b){return{center:Array.from(b.center),radii:Array.from(b.radii)}},restoreState:function(b,a){b.center=Object(g.v)(a,"center",g.k);b.radii=Object(g.v)(a,"radii",g.j)},serializedBytes:24,
serializer:function(b,a,e){var h=new Float32Array(b,a,6*e);return function(b,a){var e=b.radii;a*=6;h.set(b.center,a);h.set(e,a+3)}}});var x=function(a){function e(a){a=void 0===a?k.k.create():a;u(this,e);var h=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));h.objectToLocal=a;h.annotationMap=new Map;h.changed=new b.a;h.readonly=!1;h.pending=new Set;h.references=new Map;return h}q(e,a);$jscomp.initSymbol();$jscomp.initSymbolIterator();r(e,[{key:"add",value:function(b,a){a=void 0===a?!0:a;
if(!b.id)b.id=v();else if(this.annotationMap.has(b.id))throw Error("Annotation id already exists: "+JSON.stringify(b.id)+".");this.annotationMap.set(b.id,b);this.changed.dispatch();a||this.pending.add(b.id);return this.getReference(b.id)}},{key:"commit",value:function(b){this.pending.delete(b.id)}},{key:"update",value:function(b,a){if(null===b.value)throw Error("Annotation already deleted.");b.value=a;this.annotationMap.set(a.id,a);b.changed.dispatch();this.changed.dispatch()}},{key:Symbol.iterator,
value:function(){return this.annotationMap.values()}},{key:"get",value:function(b){return this.annotationMap.get(b)}},{key:"delete",value:function(b){null!==b.value&&(b.value=null,this.annotationMap.delete(b.id),this.pending.delete(b.id),b.changed.dispatch(),this.changed.dispatch())}},{key:"getReference",value:function(b){var a=this,e=this.references.get(b);if(void 0!==e)return e.addRef();e=new A(b);e.value=this.annotationMap.get(b)||null;this.references.set(b,e);e.registerDisposer(function(){a.references.delete(b)});
return e}},{key:"toJSON",value:function(){for(var b=[],a=this.pending,e=$jscomp.makeIterator(this),h=e.next();!h.done;h=e.next())h=h.value,a.has(h.id)||b.push(c(h));return b}},{key:"clear",value:function(){this.annotationMap.clear();this.pending.clear();this.changed.dispatch()}},{key:"restoreState",value:function(b){var a=this.annotationMap;a.clear();this.pending.clear();void 0!==b&&Object(g.a)(b,function(b){b=n(b);a.set(b.id,b)});b=$jscomp.makeIterator(this.references.values());for(var e=b.next();!e.done;e=
b.next()){e=e.value;var h=a.get(e.id);e.value=h||null;e.changed.dispatch()}this.changed.dispatch()}},{key:"reset",value:function(){this.clear()}}]);return e}(m.a),D=function(b){function a(){u(this,a);return p(this,(a.__proto__||Object.getPrototypeOf(a)).apply(this,arguments))}q(a,b);return a}(x);(function(){function b(){u(this,b);this.annotations=[[],[],[],[]]}r(b,[{key:"add",value:function(b){this.annotations[b.type].push(b)}},{key:"serialize",value:function(){return l(this.annotations)}}]);return b})()},
function(m,f,d){function u(a,c){if(!(a instanceof c))throw new TypeError("Cannot call a class as a function");}function p(a,c){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!c||"object"!==typeof c&&"function"!==typeof c?a:c}function q(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,
configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}d.d(f,"b",function(){return v});d.d(f,"a",function(){return t});f.c=function(d){return function(d){function g(){u(this,g);var a=p(this,(g.__proto__||Object.getPrototypeOf(g)).apply(this,arguments));a.visibility=new t;return a}q(g,d);n(g,[{key:"initializeCounterpart",value:function(e,b){b=void 0===b?{}:b;b.visibility=this.registerDisposer(a.a.makeFromExisting(e,this.visibility)).rpcId;c(g.prototype.__proto__||Object.getPrototypeOf(g.prototype),
"initializeCounterpart",this).call(this,e,b)}}]);return g}(d)};var a=d(63);m=d(6);var c=function k(a,e,b){null===a&&(a=Function.prototype);var h=Object.getOwnPropertyDescriptor(a,e);if(void 0===h){if(a=Object.getPrototypeOf(a),null!==a)return k(a,e,b)}else{if("value"in h)return h.value;e=h.get;return void 0===e?void 0:e.call(b)}},n=function(){function a(a,e){for(var b=0;b<e.length;b++){var h=e[b];h.enumerable=h.enumerable||!1;h.configurable=!0;"value"in h&&(h.writable=!0);Object.defineProperty(a,
h.key,h)}}return function(c,e,b){e&&a(c.prototype,e);b&&a(c,b);return c}}(),v=function(a){function c(a){a=void 0===a?Number.NEGATIVE_INFINITY:a;u(this,c);return p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this,a))}q(c,a);n(c,[{key:"visible",get:function(){return this.value===Number.POSITIVE_INFINITY}},{key:"ignored",get:function(){return this.value===Number.NEGATIVE_INFINITY}}]);return c}(m.f);v.VISIBLE=Number.POSITIVE_INFINITY;v.IGNORED=Number.NEGATIVE_INFINITY;var t=function(a){function c(){u(this,
c);var a=p(this,(c.__proto__||Object.getPrototypeOf(c)).apply(this,arguments));a.contributors=new Map;return a}q(c,a);n(c,[{key:"add",value:function(a){var b=this,e=this.contributors,c=a.changed.add(function(){b.update()}),g=function(){e.delete(g);c();b.update()};e.set(g,a);this.update();return g}},{key:"update",value:function(){for(var a=Number.NEGATIVE_INFINITY,b=$jscomp.makeIterator(this.contributors.values()),h=b.next();!h.done;h=b.next())a=Math.max(a,h.value.value);this.value=a}}]);return c}(v)},
function(m,f,d){f.a=function(d){if(d instanceof Object){var a=d[u];void 0===a&&(a=d[u]=p++);return"o"+a}return""+JSON.stringify(d)};$jscomp.initSymbol();var u=Symbol("objectId"),p=0},function(m,f,d){d.d(f,"a",function(){return q});var u=function(){function a(a,d){for(var c=0;c<d.length;c++){var n=d[c];n.enumerable=n.enumerable||!1;n.configurable=!0;"value"in n&&(n.writable=!0);Object.defineProperty(a,n.key,n)}}return function(c,d,f){d&&a(c.prototype,d);f&&a(c,f);return c}}();d(196);var p=null,q=function(){function a(c){c=
void 0===c?!1:c;if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");null===p&&(p=document.createElement("ul"),p.id="statusContainer",document.body.appendChild(p));var d=document.createElement("li");this.element=d;!0===c&&(c=200);!1!==c?(this.setVisible(!1),this.timer=setTimeout(this.setVisible.bind(this,!0),c)):this.timer=null;p.appendChild(d)}u(a,[{key:"dispose",value:function(){p.removeChild(this.element);this.element=void 0;null!==this.timer&&clearTimeout(this.timer)}},
{key:"setText",value:function(a,d){this.element.textContent=a;d&&this.setVisible(!0)}},{key:"setHTML",value:function(a,d){this.element.innerHTML=a;d&&this.setVisible(!0)}},{key:"setVisible",value:function(a){null!==this.timer&&(clearTimeout(this.timer),this.timer=null);this.element.style.display=a?"block":"none"}},{key:"setErrorMessage",value:function(a){var c=this;this.element.textContent=a+" ";a=document.createElement("button");a.textContent="Dismiss";a.addEventListener("click",function(){c.dispose()});
this.element.appendChild(a)}}],[{key:"forPromise",value:function(c,d){var n=new a(d.delay);n.setText(d.initialMessage);var t=n.dispose.bind(n);c.then(t,function(a){n.setErrorMessage((void 0===d.errorPrefix?"":d.errorPrefix)+(a instanceof Error?a.message:""+a));n.setVisible(!0)});return c}},{key:"showMessage",value:function(c){var d=new a;d.element.textContent=c;d.setVisible(!0);return d}},{key:"showTemporaryMessage",value:function(a,d){d=void 0===d?2E3:d;var c=this.showMessage(a);setTimeout(function(){return c.dispose()},
d);return c}}]);return a}()},function(m,f,d){function u(b,a){if(!(b instanceof a))throw new TypeError("Cannot call a class as a function");}function p(b,a){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?b:a}function q(b,a){if("function"!==typeof a&&null!==a)throw new TypeError("Super expression must either be null or a function, not "+typeof a);b.prototype=Object.create(a&&a.prototype,{constructor:{value:b,
enumerable:!1,writable:!0,configurable:!0}});a&&(Object.setPrototypeOf?Object.setPrototypeOf(b,a):b.__proto__=a)}function a(b,a,e){var h=b.createShader(e);b.shaderSource(h,a);b.compileShader(h);if(!b.getShaderParameter(h,b.COMPILE_STATUS)){b=b.getShaderInfoLog(h)||"";var c=b.replace("\x00","");h=[];c=$jscomp.makeIterator(c.split("\n"));for(var g=c.next();!g.done;g=c.next()){g=g.value;var d=g.match(/^ERROR:\s*(\d+):(\d+)\s*(.+)$/);null!==d?h.push({message:d[3].trim(),file:parseInt(d[1],10),line:parseInt(d[2],
10)}):(d=g.match(/^ERROR:\s*(.+)$/),null!==d?h.push({message:d[1]}):(g=g.trim())&&h.push({message:g}))}throw new t(e,a,b,h);}return h}d.d(f,"a",function(){return e});f.b=function(b,a,c){var h=new Map;return function(g){var d=h.get(g);void 0===d&&(d=new e(a),d.require(g),c(d),d=b.registerDisposer(d.build()),h.set(g,d));return d}};m=d(0);var c=d(11),n=function(){function b(b,a){for(var e=0;e<a.length;e++){var h=a[e];h.enumerable=h.enumerable||!1;h.configurable=!0;"value"in h&&(h.writable=!0);Object.defineProperty(b,
h.key,h)}}return function(a,e,c){e&&b(a.prototype,e);c&&b(a,c);return a}}(),v;(function(b){b[b.VERTEX=c.I]="VERTEX";b[b.FRAGMENT=c.h]="FRAGMENT"})(v||(v={}));var t=function(b){function a(b,e,h,c){u(this,a);var g="Error compiling "+v[b].toLowerCase()+" shader: "+h,d=p(this,(a.__proto__||Object.getPrototypeOf(a)).call(this,g));d.name="ShaderCompilationError";d.log=h;d.message=g;d.shaderType=b;d.source=e;d.errorMessages=c;return d}q(a,b);return a}(Error),l=function(b){function a(b,e,h){u(this,a);var c=
"Error linking shader: "+h,g=p(this,(a.__proto__||Object.getPrototypeOf(a)).call(this,c));g.name="ShaderLinkError";g.log=h;g.message=c;g.vertexSource=b;g.fragmentSource=e;return g}q(a,b);return a}(Error),k=function(b){function e(b,h,c,g,d){u(this,e);var k=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));k.gl=b;k.vertexSource=h;k.fragmentSource=c;k.attributes=new Map;k.uniforms=new Map;var r=k.vertexShader=a(b,h,b.VERTEX_SHADER),n=k.fragmentShader=a(b,c,b.FRAGMENT_SHADER),t=b.createProgram();
b.attachShader(t,r);b.attachShader(t,n);b.linkProgram(t);if(!b.getProgramParameter(t,b.LINK_STATUS))throw b=b.getProgramInfoLog(t)||"",new l(h,c,b);k.program=t;c=k.uniforms;h=k.attributes;if(g)for(g=$jscomp.makeIterator(g),r=g.next();!r.done;r=g.next())r=r.value,c.set(r,b.getUniformLocation(t,r));if(d)for(d=$jscomp.makeIterator(d),r=d.next();!r.done;r=d.next())g=r.value,h.set(g,b.getAttribLocation(t,g));return k}q(e,b);n(e,[{key:"uniform",value:function(b){return this.uniforms.get(b)}},{key:"attribute",
value:function(b){return this.attributes.get(b)}},{key:"textureUnit",value:function(b){return this.textureUnits.get(b)}},{key:"bind",value:function(){this.gl.useProgram(this.program)}},{key:"disposed",value:function(){var b=this.gl;b.deleteShader(this.vertexShader);this.vertexShader=void 0;b.deleteShader(this.fragmentShader);this.fragmentShader=void 0;b.deleteProgram(this.program);this.uniforms=this.attributes=this.gl=this.program=void 0}}]);return e}(m.a),g=function(){function b(){u(this,b);this.code=
"";this.parts=new Set}n(b,[{key:"add",value:function(b){if(!this.parts.has(b))switch(this.parts.add(b),typeof b){case "string":this.code+=b;break;case "function":this.add(b());break;default:if(Array.isArray(b)){b=$jscomp.makeIterator(b);for(var a=b.next();!a.done;a=b.next())this.add(a.value)}else throw Error("Invalid code type");}}},{key:"toString",value:function(){return this.code}}]);return b}(),e=function(){function b(a){u(this,b);this.gl=a;this.nextTextureUnit=this.nextSymbolID=0;this.varyingsCode=
this.attributesCode=this.uniformsCode="";this.fragmentExtensionsSet=new Set;this.fragmentExtensions="";this.vertexCode=new g;this.vertexMain="";this.fragmentCode=new g;this.fragmentMain="";this.required=new Set;this.uniforms=[];this.attributes=[];this.initializers=[];this.textureUnits=new Map}n(b,[{key:"allocateTextureUnit",value:function(b,a){a=void 0===a?1:a;if(this.textureUnits.has(b))throw Error("Duplicate texture unit symbol: "+b);var e=this.nextTextureUnit;this.nextTextureUnit+=a;this.textureUnits.set(b,
e);return e}},{key:"addTextureSampler2D",value:function(b,a,e){var h=this.allocateTextureUnit(a,e);this.addUniform("highp sampler2D",b,e);this.addInitializer(function(a){if(e){for(var c=new Int32Array(e),g=0;g<e;++g)c[g]=g+h;a.gl.uniform1iv(a.uniform(b),c)}else a.gl.uniform1i(a.uniform(b),h)});return h}},{key:"symbol",value:function(b){return b+this.nextSymbolID++}},{key:"addAttribute",value:function(b,a){this.attributes.push(a);this.attributesCode+="attribute "+b+" "+a+";\n";return a}},{key:"addVarying",
value:function(b,a){this.varyingsCode+="varying "+b+" "+a+";\n"}},{key:"addUniform",value:function(b,a,e){this.uniforms.push(a);this.uniformsCode=null!=e?this.uniformsCode+("uniform "+b+" "+a+"["+e+"];\n"):this.uniformsCode+("uniform "+b+" "+a+";\n");return a}},{key:"addFragmentExtension",value:function(b){this.fragmentExtensionsSet.has(b)||(this.fragmentExtensionsSet.add(b),this.fragmentExtensions+="#extension "+b+" : require\n")}},{key:"addVertexCode",value:function(b){this.vertexCode.add(b)}},
{key:"addFragmentCode",value:function(b){this.fragmentCode.add(b)}},{key:"setVertexMain",value:function(b){this.vertexMain=b}},{key:"addVertexMain",value:function(b){this.vertexMain=(this.vertexMain||"")+b}},{key:"setFragmentMain",value:function(b){this.fragmentMain="void main() {\n"+b+"\n}\n"}},{key:"setFragmentMainFunction",value:function(b){this.fragmentMain=b}},{key:"addInitializer",value:function(b){this.initializers.push(b)}},{key:"require",value:function(b){this.required.has(b)||(this.required.add(b),
b(this))}},{key:"build",value:function(){var b=new k(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);b.textureUnits=this.textureUnits;var a=this.initializers;if(0<a.length){b.bind();a=$jscomp.makeIterator(a);
for(var e=a.next();!e.done;e=a.next())e=e.value,e(b)}return b}}]);return b}()},function(m,f,d){function u(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(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 q(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){for(var e=$jscomp.makeIterator(l),c=e.next();!c.done;c=e.next())if(c=c.value,c=c(a,b),null!=c)return c;throw Error("No chunk format handler found.");}f.c=function(a){l.push(a)};d.d(f,"b",function(){return k});d.d(f,"a",function(){return g});m=d(46);var c=d(1),n=function(){function a(b,a){for(var e=0;e<a.length;e++){var h=
a[e];h.enumerable=h.enumerable||!1;h.configurable=!0;"value"in h&&(h.writable=!0);Object.defineProperty(b,h.key,h)}}return function(b,e,c){e&&a(b.prototype,e);c&&a(b,c);return b}}(),v=c.s.create(),t=c.s.create(),l=[],k=function(e){function b(e,c){u(this,b);c=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,e,c));c.chunkFormatHandler=c.registerDisposer(a(e.chunkQueueManager.gl,c.spec));return c}q(b,e);n(b,[{key:"getValueAt",value:function(b,a){a=void 0===a?this.spec.chunkLayout:a;var e=this.spec,
h=a.size;a.globalToLocalSpatial(t,b);for(b=0;3>b;++b)v[b]=Math.floor(t[b]/h[b]);b=Object(c.t)(v);b=this.chunks.get(b);if(!b)return null;a=e.voxelSize;for(var g=0;3>g;++g)v[g]=Math.floor((t[g]-v[g]*h[g])/a[g]);h=b.chunkDataSize;for(a=0;3>a;++a)if(v[a]>=h[a])return;e=e.numChannels;if(1===e)return b.getChannelValueAt(v,0);h=Array(e);for(a=0;a<e;++a)h[a]=b.getChannelValueAt(v,a);return h}},{key:"getChunk",value:function(b){return this.chunkFormatHandler.getChunk(this,b)}},{key:"chunkFormat",get:function(){return this.chunkFormatHandler.chunkFormat}}]);
return b}(m.c),g=function(a){function b(a,e){u(this,b);var h=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,e));h.chunkDataSize=e.chunkDataSize||a.spec.chunkDataSize;return h}q(b,a);n(b,[{key:"chunkFormat",get:function(){return this.source.chunkFormat}}]);return b}(m.b)},function(m,f,d){function u(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(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 q(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(e){var b=g.get(e),h=e.changed.count;if(void 0!==b&&b.generation===h)return b;if(e instanceof l){var c=e.baseJSON();for(var d=
$jscomp.makeIterator(e.children),k=d.next();!k.done;k=d.next()){var n=$jscomp.makeIterator(k.value);k=n.next().value;n=n.next().value;c[k]=a(n).value}}else c=e.toJSON();void 0===b?(b={generation:h,value:c},g.set(e,b)):(b.generation=h,b.value=c);return b}d.d(f,"a",function(){return l});d.d(f,"b",function(){return k});f.c=a;m=d(0);var c=d(2),n=d(3),v=function(){function a(b,a){for(var e=0;e<a.length;e++){var h=a[e];h.enumerable=h.enumerable||!1;h.configurable=!0;"value"in h&&(h.writable=!0);Object.defineProperty(b,
h.key,h)}}return function(b,e,c){e&&a(b.prototype,e);c&&a(b,c);return b}}(),t=function b(a,c,g){null===a&&(a=Function.prototype);var h=Object.getOwnPropertyDescriptor(a,c);if(void 0===h){if(a=Object.getPrototypeOf(a),null!==a)return b(a,c,g)}else{if("value"in h)return h.value;c=h.get;return void 0===c?void 0:c.call(g)}},l=function(b){function a(){u(this,a);var b=p(this,(a.__proto__||Object.getPrototypeOf(a)).apply(this,arguments));b.children=new Map;b.changed=new n.a;return b}q(a,b);v(a,[{key:"add",
value:function(b,a){var h=this;if(this.children.has(b))throw Error("Key "+JSON.stringify(b)+" already registered.");this.children.set(b,a);a.changed.add(this.changed.dispatch);this.changed.dispatch();return function(){h.remove(b)}}},{key:"remove",value:function(b){var a=this.children;if(a.has(b))throw Error("Key "+JSON.stringify(b)+" not registered.");a=a.get(b);this.children.delete(b);a.changed.remove(this.changed.dispatch);this.changed.dispatch()}},{key:"disposed",value:function(){for(var b=this.changed,
h=$jscomp.makeIterator(this.children.values()),c=h.next();!c.done;c=h.next())c.value.changed.remove(b.dispatch);this.children=void 0;t(a.prototype.__proto__||Object.getPrototypeOf(a.prototype),"disposed",this).call(this)}},{key:"toJSON",value:function(){for(var b=this.baseJSON(),a=$jscomp.makeIterator(this.children),h=a.next();!h.done;h=a.next()){var c=$jscomp.makeIterator(h.value);h=c.next().value;c=c.next().value;b[h]=c.toJSON()}return b}},{key:"baseJSON",value:function(){return{}}},{key:"reset",
value:function(){for(var b=$jscomp.makeIterator(this.children.values()),a=b.next();!a.done;a=b.next())a.value.reset()}},{key:"restoreState",value:function(b){Object(c.t)(b);for(var a=$jscomp.makeIterator(this.children),h=a.next();!h.done;h=a.next()){var g=$jscomp.makeIterator(h.value);h=g.next().value;g=g.next().value;try{if(b.hasOwnProperty(h)){var d=b[h];void 0!==d&&g.restoreState(d)}}catch(x){throw Error("Error restoring property "+JSON.stringify(h)+": "+x.message);}}}}]);return a}(m.a),k=function(b){function a(){u(this,
a);var b=p(this,(a.__proto__||Object.getPrototypeOf(a)).apply(this,arguments));b.lastState={};return b}q(a,b);v(a,[{key:"restoreState",value:function(b){Object(c.t)(b);this.lastState=b;t(a.prototype.__proto__||Object.getPrototypeOf(a.prototype),"restoreState",this).call(this,b)}},{key:"reset",value:function(){this.lastState={};t(a.prototype.__proto__||Object.getPrototypeOf(a.prototype),"reset",this).call(this)}},{key:"baseJSON",value:function(){for(var b=Object.assign(t(a.prototype.__proto__||Object.getPrototypeOf(a.prototype),
"baseJSON",this).call(this),this.lastState),h=$jscomp.makeIterator(this.children.keys()),c=h.next();!c.done;c=h.next())delete b[c.value];return b}},{key:"toJSON",value:function(){var b=t(a.prototype.__proto__||Object.getPrototypeOf(a.prototype),"toJSON",this).call(this);return this.lastState=b}},{key:"add",value:function(b,h){var c=t(a.prototype.__proto__||Object.getPrototypeOf(a.prototype),"add",this).call(this,b,h);b=this.lastState[b];void 0!==b&&(h.reset(),h.restoreState(b));return c}}]);return a}(l),
g=new WeakMap},function(m,f,d){d.d(f,"a",function(){return u});f.b=1E-6;var u="undefined"!==typeof Float32Array?Float32Array:Array;f.c=Math.random},function(m,f,d){function u(b,a){if(!(b instanceof a))throw new TypeError("Cannot call a class as a function");}function p(b,a){if("function"!==typeof a&&null!==a)throw new TypeError("Super expression must either be null or a function, not "+typeof a);b.prototype=Object.create(a&&a.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}});
a&&(Object.setPrototypeOf?Object.setPrototypeOf(b,a):b.__proto__=a)}function q(b,a,e){for(var h=0;3>h;++h)b[h]=Number.POSITIVE_INFINITY,a[h]=Number.NEGATIVE_INFINITY;e=$jscomp.makeIterator(e);for(h=e.next();!h.done;h=e.next()){var c=h.value.spec;h=c.lowerChunkBound;c=c.upperChunkBound;for(var g=0;3>g;++g)b[g]=Math.min(b[g],h[g]),a[g]=Math.max(a[g],c[g])}}function a(b,a,e,h){for(var c=y.FULLY_INSIDE,g=0;3>g;++g){var d=b[g];var k=a[g],r=e[g],l=h[g];d=d>=l||k<=r?y.FULLY_OUTSIDE:d>=r&&k<=l?y.FULLY_INSIDE:
y.PARTIALLY_INSIDE;switch(d){case y.FULLY_OUTSIDE:return d;case y.PARTIALLY_INSIDE:c=d}}return c}function c(b){var a=b.transform,e=b.transformedSources,c=a.changed.count;c!==b.transformedSourcesGeneration&&(b.transformedSourcesGeneration=c,e=h.k.equals(a.transform,h.d)?b.sources.map(function(b){return b.map(function(b){return{source:b,chunkLayout:b.spec.chunkLayout}})}):b.sources.map(function(b){return b.map(function(b){var e=b.spec.chunkLayout;return{chunkLayout:k.a.get(e.size,l(e.transform,a)),
source:b}})}),b.transformedSources=e);return e}function n(b,a){var e=a.length,h=0;if(1<e)for(var c=0,g=0;g<e;++g){var d=a[g].chunkLayout;var k=d.size;d=d.globalToLocalSpatialVector(A,b);for(var r=0,l=0,n=1,t=0;3>t;++t){var f=k[t];n*=f;f*=d[t];r=Math.min(r,f);l=Math.max(l,f)}k=n/(l-r);k>c&&(c=k,h=g)}return a[h]}function v(b){var a=b.voxelSize,e=void 0===b.lowerVoxelBound?h.h:b.lowerVoxelBound,c=b.upperVoxelBound,g=void 0===b.maxVoxelsPerChunkLog2?18:b.maxVoxelsPerChunkLog2;b=void 0===b.transform?h.d:
b.transform;b=Object(h.c)(h.s.create(),b);a=h.s.multiply(b,b,a);b=h.s.fromValues(1,1,1);if(void 0===c)var d=h.f;else{d=h.s.create();for(var k=0;3>k;++k)d[k]=Math.pow(2,Math.floor(Math.log2(c[k]-e[k])))}for(e=0;e<g;++e){c=Infinity;k=-1;for(var r=0;3>r;++r)if(!(b[r]>=d[r])){var l=b[r]*a[r];l<c&&(c=l,k=r)}c=k;if(-1===c)break;b[c]*=2}return b}function t(b){var a=b.flatDimension,e=b.voxelSize,c=b.maxVoxelsPerChunkLog2,g=b.transform;h.s.subtract(A,void 0===b.upperVoxelBound?h.f:b.upperVoxelBound,void 0===
b.lowerVoxelBound?h.h:b.lowerVoxelBound);A[a]=1;return v({voxelSize:e,upperVoxelBound:A,maxVoxelsPerChunkLog2:c,transform:g})}function l(b,a){a=a.transform;return void 0===a?void 0===b?h.d:b:void 0===b?a:h.k.multiply(h.k.create(),a,b)}f.o=c;d.d(f,"j",function(){return E});f.n=v;f.p=t;d.d(f,"a",function(){return x});f.m=l;f.l=function(b){if(void 0!==b.chunkDataSizes)return b.chunkDataSizes;var a=void 0===b.chunkLayoutPreference?x.ISOTROPIC:b.chunkLayoutPreference;switch(a){case x.ISOTROPIC:return[v(b)];
case x.FLAT:a=[];for(var e=0;3>e;++e)a[e]=t({flatDimension:e,voxelSize:b.voxelSize,lowerVoxelBound:b.lowerVoxelBound,upperVoxelBound:b.upperVoxelBound,maxVoxelsPerChunkLog2:b.maxVoxelsPerChunkLog2,transform:b.transform});a.push(v(b));return a}throw Error("Invalid chunk layout preference: "+a+".");};d.d(f,"k",function(){return D});var k=d(182),g=d(39),e=d(183),b=d(44),h=d(1);m=d(12);d.d(f,"c",function(){return b.b});var r=function(){function b(b,a){for(var e=0;e<a.length;e++){var h=a[e];h.enumerable=
h.enumerable||!1;h.configurable=!0;"value"in h&&(h.writable=!0);Object.defineProperty(b,h.key,h)}}return function(a,e,h){e&&b(a.prototype,e);h&&b(a,h);return a}}(),A=h.s.create(),y;(function(b){b[b.FULLY_OUTSIDE=0]="FULLY_OUTSIDE";b[b.FULLY_INSIDE=1]="FULLY_INSIDE";b[b.PARTIALLY_INSIDE=2]="PARTIALLY_INSIDE"})(y||(y={}));var z=[h.s.create(),h.s.create(),h.s.create(),h.s.create()],E=function(b){function d(){u(this,d);var b=(d.__proto__||Object.getPrototypeOf(d)).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.width=-1;b.height=-1;b.hasViewportToData=!1;b.hasValidViewport=!1;b.viewportToData=h.k.create();b.viewportAxes=[h.s.create(),h.s.create(),h.s.create()];b.previousViewportAxes=[h.s.create(),h.s.create()];b.centerDataPosition=h.s.create();b.viewportPlaneDistanceToOrigin=0;b.visibleChunkLayouts=new Map;b.visibleLayers=new Map;b.visibleSourcesStale=!0;b.pixelSize=0;h.k.identity(b.viewportToData);return b}p(d,b);r(d,[{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(b,a){return b!==this.width||a!==this.height?(this.width=b,this.height=a,this.maybeSetHasValidViewport(),!0):!1}},{key:"setViewportToDataMatrix",value:function(b){if(this.hasViewportToData&&
h.k.equals(this.viewportToData,b))return!1;this.hasViewportToData=!0;var a=this.viewportToData;h.k.copy(a,b);Object(h.o)(a);h.s.transformMat4(this.centerDataPosition,h.h,b);b=0;for(var c=this.viewportAxes,g=this.previousViewportAxes,d=0;3>d;++d){var k=c[d];Object(h.p)(k,h.e[d],a);0===d&&(b=h.s.length(k));h.s.normalize(k,k)}this.viewportAxes=c;this.previousViewportAxes=g;if(!Object(e.a)(b,this.pixelSize)||.95>h.s.dot(c[0],g[0])||.95>h.s.dot(c[1],g[1]))h.s.copy(g[0],c[0]),h.s.copy(g[1],c[1]),this.visibleSourcesStale=
!0,this.pixelSize=b;this.viewportPlaneDistanceToOrigin=h.s.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 b=1.1*this.pixelSize,a=this.visibleChunkLayouts,e=this.viewportAxes[2],h=this.visibleLayers;a.clear();var g={};h=$jscomp.makeIterator(h);for(var d=h.next();!d.done;g=
{smallestVoxelSize:g.smallestVoxelSize,visibleSources:g.visibleSources},d=h.next()){d=$jscomp.makeIterator(d.value);var k=d.next().value;g.visibleSources=d.next().value;g.visibleSources.length=0;d=c(k);var r=d.length;k=void 0;g.smallestVoxelSize=d[0][0].source.spec.voxelSize;var l=function(a){return function(e){for(var h=0;3>h;++h){var c=e[h];if(c>b&&c>a.smallestVoxelSize[h])return!0}return!1}}(g),t=function(b){return function(e,h){var c=e.source,g=e.chunkLayout;b.visibleSources[b.visibleSources.length++]=
e;e=a.get(g);void 0===e&&(e=new Map,a.set(g,e));e.set(c,h)}}(g);for(k=r-1;;){r=n(e,d[k]);t(r,k);if(0===k||!l(r.source.spec.voxelSize))break;--k}g.visibleSources.reverse()}}}},{key:"computeVisibleChunks",value:function(b,e){var c=this;this.updateVisibleSources();for(var d=this.width,k=this.height,r=this.viewportToData,l=0;3>l;++l)z[0][l]=-h.e[0][l]*d/2-h.e[1][l]*k/2,z[1][l]=-h.e[0][l]*d/2+h.e[1][l]*k/2,z[2][l]=h.e[0][l]*d/2-h.e[1][l]*k/2,z[3][l]=h.e[0][l]*d/2+h.e[1][l]*k/2;for(d=0;4>d;++d)h.s.transformMat4(z[d],
z[d],r);var n=h.s.create(),t=h.s.create(),f=h.s.create(),v=h.s.create(),C=h.s.create(),p=h.s.create(),J=[],u=[];this.visibleChunkLayouts.forEach(function(d,k){function r(){for(var b=0,a=0,e=0;3>e;++e){var h=p[e],c=n[e],g=t[e]-c,d=C[e]*g;b+=h*(c+d);a+=h*(c+g-d)}return b<G?!1:a<=G}function l(b){function h(){m=Object(g.c)(J,0,C,function(b){var e=b.spec;switch(a(n,t,e.lowerChunkBound,e.upperChunkBound)){case y.PARTIALLY_INSIDE:return!0;case y.FULLY_INSIDE:u.push(b);default:return!1}})}if(0!==u.length||
0!==m){for(var c=1,d=0;3>d;++d)c*=Math.max(0,t[d]-n[d]);if(0!==c&&r())if(1===c)e(k,x,n,u);else{for(var f;;)if(c=n[b],d=t[b],f=d-c,1===f)b=(b+1)%3;else break;f=c+Math.floor(.5*f);var v=(b+1)%3,A=u.length;t[b]=f;var C=m;h();l(v);u.length=A;m=C;t[b]=d;n[b]=f;h();l(v);n[b]=c;u.length=A;m=C}}}var x=b(k);q(f,v,d.keys());h.s.set(n,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY);h.s.set(t,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);k.globalToLocalSpatialVector(p,
c.viewportAxes[2]);for(var B=0;3>B;++B)C[B]=0<p[B]?1:0;var G=h.s.dot(k.globalToLocalGrid(A,c.centerDataPosition),p);for(B=0;4>B;++B)for(var F=k.globalToLocalGrid(A,z[B]),D=0;3>D;++D)n[D]=Math.min(n[D],Math.floor(F[D])),t[D]=Math.max(t[D],Math.floor(F[D])+1);h.s.max(n,n,f);h.s.min(t,t,v);u.length=0;J.length=0;d=$jscomp.makeIterator(d.keys());for(B=d.next();!B.done;B=d.next())switch(B=B.value,F=B.spec,a(n,t,F.lowerChunkBound,F.upperChunkBound)){case y.FULLY_INSIDE:u.push(B);break;case y.PARTIALLY_INSIDE:J.push(B)}var m=
J.length;l(0)})}}]);return d}(m.b);f.b=18;var x;(function(b){b[b.ISOTROPIC=0]="ISOTROPIC";b[b.FLAT=1]="FLAT"})(x||(x={}));var D=function(){function b(a){u(this,b);var e=a.chunkSize,c=a.transform,g=void 0===a.lowerChunkBound?h.h:a.lowerChunkBound,d=a.upperChunkBound;this.voxelSize=a.voxelSize;this.chunkLayout=k.a.get(e,c);this.lowerChunkBound=g;this.upperChunkBound=d}r(b,[{key:"toObject",value:function(){return{transform:this.chunkLayout.transform,chunkSize:this.chunkLayout.size,voxelSize:this.voxelSize,
lowerChunkBound:this.lowerChunkBound,upperChunkBound:this.upperChunkBound}}}]);return b}();f.h="SliceView";f.f="sliceview/RenderLayer";f.d="SliceView.addVisibleLayer";f.e="SliceView.removeVisibleLayer";f.i="SliceView.updateView";f.g="SliceView.updateTransform"},function(m,f,d){f.b=function(d,a){p.set(d,a)};f.a=function(d){for(var a=new u.b,c=$jscomp.makeIterator(p),n=c.next();!n.done;n=c.next()){var f=$jscomp.makeIterator(n.value);n=f.next().value;f=f.next().value;a.register(n,f(d))}return a};var u=
d(37),p=new Map},function(m,f,d){(function(u,p){var q;(function(){function a(b,e){function h(b){var a;if(h[b]!==q)return h[b];if("bug-string-char-index"==b)var d=!1;else if("json"==b)d=h("json-stringify")&&h("json-parse");else{var r;if("json-stringify"==b){d=e.stringify;var l="function"==typeof d&&u;if(l){(r=function(){return 1}).toJSON=r;try{l="0"===d(0)&&"0"===d(new c)&&'""'==d(new g)&&d(v)===q&&d(q)===q&&d()===q&&"1"===d(r)&&"[1]"==d([r])&&"[null]"==d([q])&&"null"==d(null)&&"[null,null,null]"==
d([q,v,null])&&'{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}'==d({a:[r,!0,!1,null,"\x00\b\n\f\r\t"]})&&"1"===d(null,r)&&"[\n 1,\n 2\n]"==d([1,2],null,1)&&'"-271821-04-20T00:00:00.000Z"'==d(new k(-864E13))&&'"+275760-09-13T00:00:00.000Z"'==d(new k(864E13))&&'"-000001-01-01T00:00:00.000Z"'==d(new k(-621987552E5))&&'"1969-12-31T23:59:59.999Z"'==d(new k(-1))}catch(Za){l=!1}}d=l}if("json-parse"==b){d=e.parse;if("function"==typeof d)try{if(0===d("0")&&!d(!1)&&(r=d('{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}'),
a=5==r.a.length&&1===r.a[0])){try{a=!d('"\t"')}catch(Za){}if(a)try{a=1!==d("01")}catch(Za){}if(a)try{a=1!==d("1.")}catch(Za){}}}catch(Za){a=!1}d=a}}return h[b]=!!d}b||(b=t.Object());e||(e=t.Object());var c=b.Number||t.Number,g=b.String||t.String,d=b.Object||t.Object,k=b.Date||t.Date,r=b.SyntaxError||t.SyntaxError,l=b.TypeError||t.TypeError,f=b.Math||t.Math;b=b.JSON||t.JSON;"object"==typeof b&&b&&(e.stringify=b.stringify,e.parse=b.parse);d=d.prototype;var v=d.toString,p,q,u=new k(-0xc782b5b800cec);
try{u=-109252==u.getUTCFullYear()&&0===u.getUTCMonth()&&1===u.getUTCDate()&&10==u.getUTCHours()&&37==u.getUTCMinutes()&&6==u.getUTCSeconds()&&708==u.getUTCMilliseconds()}catch(fb){}if(!h("json")){var m=h("bug-string-char-index");if(!u){var N=f.floor;var R=[0,31,59,90,120,151,181,212,243,273,304,334];var O=function(b,a){return R[a]+365*(b-1970)+N((b-1969+(a=+(1<a)))/4)-N((b-1901+a)/100)+N((b-1601+a)/400)}}(p=d.hasOwnProperty)||(p=function(b){var a={};if((a.__proto__=null,a.__proto__={toString:1},a).toString!=
v)p=function(b){var a=this.__proto__;b=b in(this.__proto__=null,this);this.__proto__=a;return b};else{var e=a.constructor;p=function(b){var a=(this.constructor||e).prototype;return b in this&&!(b in a&&this[b]===a[b])}}a=null;return p.call(this,b)});var Q=function(b,a){var e=0,h,c;(h=function(){this.valueOf=0}).prototype.valueOf=0;var d=new h;for(c in d)p.call(d,c)&&e++;h=d=null;e?Q=2==e?function(b,a){var e={},h="[object Function]"==v.call(b),c;for(c in b)h&&"prototype"==c||p.call(e,c)||!(e[c]=1)||
!p.call(b,c)||a(c)}:function(b,a){var e="[object Function]"==v.call(b),h,c;for(h in b)e&&"prototype"==h||!p.call(b,h)||(c="constructor"===h)||a(h);(c||p.call(b,h="constructor"))&&a(h)}:(d="valueOf toString toLocaleString propertyIsEnumerable isPrototypeOf hasOwnProperty constructor".split(" "),Q=function(b,a){var e="[object Function]"==v.call(b),h,c=!e&&"function"!=typeof b.constructor&&n[typeof b.hasOwnProperty]&&b.hasOwnProperty||p;for(h in b)e&&"prototype"==h||!c.call(b,h)||a(h);for(e=d.length;h=
d[--e];c.call(b,h)&&a(h));});return Q(b,a)};if(!h("json-stringify")){var U={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"},W=function(b,a){return("000000"+(a||0)).slice(-b)},aa=function(b){for(var a='"',e=0,h=b.length,c=!m||10<h,d=c&&(m?b.split(""):b);e<h;e++){var g=b.charCodeAt(e);switch(g){case 8:case 9:case 10:case 12:case 13:case 34:case 92:a+=U[g];break;default:a=32>g?a+("\\u00"+W(2,g.toString(16))):a+(c?d[e]:b.charAt(e))}}return a+'"'},I=function(b,a,e,h,c,d,g){var k;try{var r=
a[b]}catch(Nc){}if("object"==typeof r&&r){var n=v.call(r);if("[object Date]"!=n||p.call(r,"toJSON"))"function"==typeof r.toJSON&&("[object Number]"!=n&&"[object String]"!=n&&"[object Array]"!=n||p.call(r,"toJSON"))&&(r=r.toJSON(b));else if(r>-1/0&&r<1/0){if(O){var t=N(r/864E5);for(n=N(t/365.2425)+1970-1;O(n+1,0)<=t;n++);for(k=N((t-O(n,0))/30.42);O(n,k+1)<=t;k++);t=1+t-O(n,k);var f=(r%864E5+864E5)%864E5;var A=N(f/36E5)%24;var y=N(f/6E4)%60;var C=N(f/1E3)%60;f%=1E3}else n=r.getUTCFullYear(),k=r.getUTCMonth(),
t=r.getUTCDate(),A=r.getUTCHours(),y=r.getUTCMinutes(),C=r.getUTCSeconds(),f=r.getUTCMilliseconds();r=(0>=n||1E4<=n?(0>n?"-":"+")+W(6,0>n?-n:n):W(4,n))+"-"+W(2,k+1)+"-"+W(2,t)+"T"+W(2,A)+":"+W(2,y)+":"+W(2,C)+"."+W(3,f)+"Z"}else r=null}e&&(r=e.call(a,b,r));if(null===r)return"null";n=v.call(r);if("[object Boolean]"==n)return""+r;if("[object Number]"==n)return r>-1/0&&r<1/0?""+r:"null";if("[object String]"==n)return aa(""+r);if("object"==typeof r){for(b=g.length;b--;)if(g[b]===r)throw l();g.push(r);
var z=[];a=d;d+=c;if("[object Array]"==n){k=0;for(b=r.length;k<b;k++)n=I(k,r,e,h,c,d,g),z.push(n===q?"null":n);b=z.length?c?"[\n"+d+z.join(",\n"+d)+"\n"+a+"]":"["+z.join(",")+"]":"[]"}else Q(h||r,function(b){var a=I(b,r,e,h,c,d,g);a!==q&&z.push(aa(b)+":"+(c?" ":"")+a)}),b=z.length?c?"{\n"+d+z.join(",\n"+d)+"\n"+a+"}":"{"+z.join(",")+"}":"{}";g.pop();return b}};e.stringify=function(b,a,e){var h;if(n[typeof a]&&a)if("[object Function]"==(h=v.call(a)))var c=a;else if("[object Array]"==h){var d={};for(var g=
0,k=a.length,r;g<k;r=a[g++],(h=v.call(r),"[object String]"==h||"[object Number]"==h)&&(d[r]=1));}if(e)if("[object Number]"==(h=v.call(e))){if(0<(e-=e%1)){var l="";for(10<e&&(e=10);l.length<e;l+=" ");}}else"[object String]"==h&&(l=10>=e.length?e:e.slice(0,10));return I("",(r={},r[""]=b,r),c,d,l,"",[])}}if(!h("json-parse")){var T=g.fromCharCode,da={92:"\\",34:'"',47:"/",98:"\b",116:"\t",110:"\n",102:"\f",114:"\r"},L,ia,X=function(){L=ia=null;throw r();},S=function(){for(var b=ia,a=b.length,e,h,c,d,
g;L<a;)switch(g=b.charCodeAt(L),g){case 9:case 10:case 13:case 32:L++;break;case 123:case 125:case 91:case 93:case 58:case 44:return e=m?b.charAt(L):b[L],L++,e;case 34:e="@";for(L++;L<a;)if(g=b.charCodeAt(L),32>g)X();else if(92==g)switch(g=b.charCodeAt(++L),g){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:e+=da[g];L++;break;case 117:h=++L;for(c=L+4;L<c;L++)g=b.charCodeAt(L),48<=g&&57>=g||97<=g&&102>=g||65<=g&&70>=g||X();e+=T("0x"+b.slice(h,L));break;default:X()}else{if(34==g)break;
g=b.charCodeAt(L);for(h=L;32<=g&&92!=g&&34!=g;)g=b.charCodeAt(++L);e+=b.slice(h,L)}if(34==b.charCodeAt(L))return L++,e;X();default:h=L;45==g&&(d=!0,g=b.charCodeAt(++L));if(48<=g&&57>=g){for(48==g&&(g=b.charCodeAt(L+1),48<=g&&57>=g)&&X();L<a&&(g=b.charCodeAt(L),48<=g&&57>=g);L++);if(46==b.charCodeAt(L)){for(c=++L;c<a&&(g=b.charCodeAt(c),48<=g&&57>=g);c++);c==L&&X();L=c}g=b.charCodeAt(L);if(101==g||69==g){g=b.charCodeAt(++L);43!=g&&45!=g||L++;for(c=L;c<a&&(g=b.charCodeAt(c),48<=g&&57>=g);c++);c==L&&
X();L=c}return+b.slice(h,L)}d&&X();if("true"==b.slice(L,L+4))return L+=4,!0;if("false"==b.slice(L,L+5))return L+=5,!1;if("null"==b.slice(L,L+4))return L+=4,null;X()}return"$"},Y=function(b){var a,e;"$"==b&&X();if("string"==typeof b){if("@"==(m?b.charAt(0):b[0]))return b.slice(1);if("["==b){for(a=[];;e||(e=!0)){b=S();if("]"==b)break;e&&(","==b?(b=S(),"]"==b&&X()):X());","==b&&X();a.push(Y(b))}return a}if("{"==b){for(a={};;e||(e=!0)){b=S();if("}"==b)break;e&&(","==b?(b=S(),"}"==b&&X()):X());","!=b&&
"string"==typeof b&&"@"==(m?b.charAt(0):b[0])&&":"==S()||X();a[b.slice(1)]=Y(S())}return a}X()}return b},Ca=function(b,a,e){e=na(b,a,e);e===q?delete b[a]:b[a]=e},na=function(b,a,e){var h=b[a],c;if("object"==typeof h&&h)if("[object Array]"==v.call(h))for(c=h.length;c--;)Ca(h,c,e);else Q(h,function(b){Ca(h,b,e)});return e.call(b,a,h)};e.parse=function(b,a){var e;L=0;ia=""+b;b=Y(S());"$"!=S()&&X();L=ia=null;return a&&"[object Function]"==v.call(a)?na((e={},e[""]=b,e),"",a):b}}}e.runInContext=a;return e}
var c=d(325),n={"function":!0,object:!0},v=n[typeof f]&&f&&!f.nodeType&&f,t=n[typeof window]&&window||this,l=v&&n[typeof u]&&u&&!u.nodeType&&"object"==typeof p&&p;!l||l.global!==l&&l.window!==l&&l.self!==l||(t=l);if(v&&!c)a(t,v);else{var k=t.JSON,g=t.JSON3,e=!1;var b=a(t,t.JSON3={noConflict:function(){e||(e=!0,t.JSON=k,t.JSON3=g,k=g=null);return b}});t.JSON={parse:b.parse,stringify:b.stringify}}c&&!(q=b,void 0!==q&&(u.exports=q))}).call(this)}).call(f,d(324)(m),d(7))},function(m,f,d){function u(a,
c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}function p(a,c){if(!(a instanceof c))throw new TypeError("Cannot call a class as a function");}d.d(f,"b",function(){return n});d.d(f,"c",function(){return v});f.d=function(a,d){return new Promise(function(k,
g){if(a===c)d(k,g,c);else{var e=new n,b=a.add(function(){e.cancel()});d(function(a){b();k(a)},function(a){b();g(a)},e)}})};var q=function(){function a(a,c){for(var g=0;g<c.length;g++){var e=c[g];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(c,d,g){d&&a(c.prototype,d);g&&a(c,g);return c}}();m=new (function(){function a(){p(this,a);this.name="CancellationError";this.message="CANCELED"}q(a,[{key:"toString",value:function(){return"CANCELED"}}]);
return a}());f.a=m;var a=function(){},c={isCanceled:!1,add:function(){return a},remove:a};f.e=c;var n=function(){function c(){p(this,c)}q(c,[{key:"cancel",value:function(){var a=this.handlers;if(null!==a&&(this.handlers=null,void 0!==a)){a=$jscomp.makeIterator(a);for(var c=a.next();!c.done;c=a.next())c=c.value,c()}}},{key:"add",value:function(c){var d=this,g=this.handlers;if(null===g)return c(),a;void 0===g&&(g=this.handlers=new Set);g.add(c);return function(){d.remove(c)}}},{key:"remove",value:function(a){var c=
this.handlers;null!=c&&c.delete(a)}},{key:"isCanceled",get:function(){return null===this.handlers}}]);return c}(),v=function(a){function d(){p(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");a=!a||"object"!==typeof a&&"function"!==typeof a?this:a;a.consumers=new Set;return a}u(d,a);q(d,[{key:"addConsumer",value:function(a){var g=this;a=void 0===a?c:a;var e=this.consumers;e.has(a)||
a.isCanceled||(e.add(a),a.add(function(){e.delete(a);0===e.size&&g.cancel()}))}}]);return d}(n)},function(m,f,d){function u(b,a){if(!(b instanceof a))throw new TypeError("Cannot call a class as a function");}function p(b,a){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?b:a}function q(b,a){if("function"!==typeof a&&null!==a)throw new TypeError("Super expression must either be null or a function, not "+
typeof a);b.prototype=Object.create(a&&a.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}});a&&(Object.setPrototypeOf?Object.setPrototypeOf(b,a):b.__proto__=a)}d.d(f,"b",function(){return l});d.d(f,"a",function(){return k});d.d(f,"c",function(){return g});d.d(f,"d",function(){return e});m=d(194);d.n(m);m=d(0);var a=d(10),c=d(3),n=d(24),v=function(){function b(b,a){for(var e=0;e<a.length;e++){var c=a[e];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=
!0);Object.defineProperty(b,c.key,c)}}return function(a,e,c){e&&b(a.prototype,e);c&&b(a,c);return a}}(),t=function h(a,e,c){null===a&&(a=Function.prototype);var g=Object.getOwnPropertyDescriptor(a,e);if(void 0===g){if(a=Object.getPrototypeOf(a),null!==a)return h(a,e,c)}else{if("value"in g)return g.value;e=g.get;return void 0===e?void 0:e.call(c)}},l=function(e){function c(a){a=void 0===a?new n.b:a;u(this,c);var e=p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));e.visibility=a;e.element=
document.createElement("div");e.element.classList.add("neuroglancer-tab-content");return e}q(c,e);v(c,[{key:"disposed",value:function(){Object(a.b)(this.element);t(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"disposed",this).call(this)}},{key:"visible",get:function(){return this.visibility.visible}}]);return c}(m.a);d=function(a){function e(){u(this,e);var a=p(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments));a.changed=new c.a;a.options=new Map;a.optionsChanged=new c.a;
a.selectedValue=void 0;a.defaultValue=void 0;a.ready_=!0;return a}q(e,a);v(e,[{key:"add",value:function(a,e){var c=this.options;if(c.has(a))throw Error("Option already defined: "+JSON.stringify(a)+".");c.set(a,e);this.optionsChanged.dispatch();void 0===this.defaultValue&&(this.default=a)}},{key:"toJSON",value:function(){var a=this.value;if(a!==this.defaultValue)return a}},{key:"reset",value:function(){this.value=void 0}},{key:"restoreState",value:function(a){"string"!==typeof a&&(a=void 0);this.value=
a}},{key:"value",get:function(){var a=this.selectedValue;return void 0!==a?a:this.defaultValue},set:function(a){void 0!==a&&this.ready_&&!this.options.has(a)&&(a=void 0);this.selectedValue!==a&&(this.selectedValue=a,this.changed.dispatch())}},{key:"default",set:function(a){this.defaultValue!==a&&(this.defaultValue=a,this.changed.dispatch())},get:function(){return this.defaultValue}},{key:"validValue",get:function(){var a=this.selectedValue;return void 0!==a&&this.options.has(a)?a:this.defaultValue}},
{key:"ready",get:function(){return this.ready_},set:function(a){if(a!==this.ready_){if(this.ready_=a)this.value=this.value;this.changed.dispatch()}}}]);return e}(m.a);var k=function(e){function h(a,e){e=void 0===e?new n.b:e;u(this,h);var g=p(this,(h.__proto__||Object.getPrototypeOf(h)).call(this));g.getter=a;g.visibility=e;g.element=document.createElement("div");g.tabs=new Map;g.tabVisibilityChanged=new c.b;g.element.className="neuroglancer-stack-view";g.registerDisposer(e.changed.add(function(){return g.updateSelectedTab()}));
g.updateSelectedTab();return g}q(h,e);v(h,[{key:"invalidate",value:function(a){var e=this.tabs,c=e.get(a);void 0!==c&&(c.dispose(),e.delete(a),a===this.displayedTab&&(this.displayedTab=void 0,this.updateSelectedTab()))}},{key:"hideTab",value:function(a){var e=this.tabs.get(a);void 0!==e&&(e.visibility.value=n.b.IGNORED,e.element.style.display="none");this.tabVisibilityChanged.dispatch(a,!1)}},{key:"showTab",value:function(a){var e=this.tabs,c=e.get(a);void 0===c&&(c=this.getter(a),this.element.appendChild(c.element),
e.set(a,c));c.element.style.display=null;c.visibility.value=n.b.VISIBLE;this.tabVisibilityChanged.dispatch(a,!0)}},{key:"updateSelectedTab",value:function(){var a=this.displayedTab,e=this.visible?this.selectedTabValue:void 0;e!==a&&(void 0!==a&&this.hideTab(a),this.displayedTab=e,void 0!==e&&this.showTab(e))}},{key:"invalidateAll",value:function(){for(var a=this.tabs,e=$jscomp.makeIterator(a.values()),c=e.next();!c.done;c=e.next())c.value.dispose();a.clear();this.updateSelectedTab()}},{key:"disposed",
value:function(){this.selectedTabValue=void 0;this.invalidateAll();Object(a.b)(this.element);t(h.prototype.__proto__||Object.getPrototypeOf(h.prototype),"disposed",this).call(this)}},{key:"visible",get:function(){return this.visibility.visible}},{key:"selected",get:function(){return this.selectedTabValue},set:function(a){this.selectedTabValue=a;this.updateSelectedTab()}}]);return h}(m.a),g=function(a){function e(){u(this,e);return p(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}
q(e,a);return e}(d),e=function(e){function c(a,e){e=void 0===e?new n.b:e;u(this,c);var h=p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));h.state=a;h.visibility=e;h.element=document.createElement("div");h.tabBar=document.createElement("div");h.tabLabels=new Map;h.tabsGeneration=-1;a=h.element;var g=h.tabBar;a.className="neuroglancer-tab-view";g.className="neuroglancer-tab-view-bar";a.appendChild(g);h.registerDisposer(e.changed.add(function(){h.updateTabs()}));e=h.stack=h.registerDisposer(new k(function(a){return h.state.options.get(a).getter()},
h.visibility));a.appendChild(e.element);h.registerDisposer(h.state.changed.add(function(){return h.updateSelectedTab()}));h.registerDisposer(h.state.optionsChanged.add(function(){return h.updateTabs()}));h.stack.tabVisibilityChanged.add(function(a,e){a=h.tabLabels.get(a);e?a.classList.add("neuroglancer-selected-tab-label"):a.classList.remove("neuroglancer-selected-tab-label")});h.updateTabs();return h}q(c,e);v(c,[{key:"updateTabs",value:function(){this.tabsGeneration!==this.state.optionsChanged.count&&
(this.destroyTabs(),this.visible&&this.makeTabs(),this.updateSelectedTab())}},{key:"updateSelectedTab",value:function(){this.stack.selected=this.state.value}},{key:"destroyTabs",value:function(){-1!==this.tabsGeneration&&(this.stack.selected=void 0,this.tabLabels.clear(),Object(a.a)(this.tabBar),this.tabsGeneration=-1,this.stack.invalidateAll())}},{key:"makeTabs",value:function(){var a=this,e=this.tabBar,c=this.tabLabels,h=Array.from(this.state.options);h.sort(function(a,e){a=$jscomp.makeIterator(a);
a.next();a=a.next().value;a=void 0===a.order?0:a.order;e=$jscomp.makeIterator(e);e.next();e=e.next().value;return a-(void 0===e.order?0:e.order)});var g={};h=$jscomp.makeIterator(h);for(var d=h.next();!d.done;g={id:g.id},d=h.next()){d=$jscomp.makeIterator(d.value);g.id=d.next().value;d=d.next().value.label;var k=document.createElement("div");k.classList.add("neuroglancer-tab-label");k.textContent=d;k.addEventListener("click",function(e){return function(){a.state.value=e.id}}(g));c.set(g.id,k);e.appendChild(k)}this.tabsGeneration=
this.state.optionsChanged.count}},{key:"disposed",value:function(){Object(a.a)(this.tabBar);this.tabLabels.clear();Object(a.b)(this.element);t(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"disposed",this).call(this)}},{key:"visible",get:function(){return this.visibility.visible}}]);return c}(m.a)},function(m,f,d){d.d(f,"d",function(){return u});var u;(function(d){d[d.GPU_MEMORY=0]="GPU_MEMORY";d[d.SYSTEM_MEMORY=1]="SYSTEM_MEMORY";d[d.SYSTEM_MEMORY_WORKER=2]="SYSTEM_MEMORY_WORKER";d[d.DOWNLOADING=
3]="DOWNLOADING";d[d.QUEUED=4]="QUEUED";d[d.NEW=5]="NEW";d[d.FAILED=6]="FAILED";d[d.EXPIRED=7]="EXPIRED"})(u||(u={}));var p;(function(d){d[d.FIRST_TIER=0]="FIRST_TIER";d[d.FIRST_ORDERED_TIER=0]="FIRST_ORDERED_TIER";d[d.VISIBLE=0]="VISIBLE";d[d.PREFETCH=1]="PREFETCH";d[d.LAST_ORDERED_TIER=1]="LAST_ORDERED_TIER";d[d.RECENT=2]="RECENT";d[d.LAST_TIER=2]="LAST_TIER"})(p||(p={}));f.b="ChunkQueueManager";f.a="ChunkManager";f.c="ChunkSource.invalidate"},function(m,f,d){function u(a,e){if(!(a instanceof e))throw new TypeError("Cannot call a class as a function");
}function p(a,e){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==typeof e&&"function"!==typeof e?a:e}function q(a,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);a.prototype=Object.create(e&&e.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});e&&(Object.setPrototypeOf?Object.setPrototypeOf(a,e):a.__proto__=e)}function a(a,e){void 0===
e&&(e=-1===a.indexOf("/")?":":"/");a=a.lastIndexOf(e);return-1===a?0:a+1}d.d(f,"a",function(){return t});d.d(f,"b",function(){return k});var c=d(34),n=d(56);m=d(0);var v=function(){function a(a,b){for(var e=0;e<b.length;e++){var c=b[e];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(e,b,c){b&&a(e.prototype,b);c&&a(e,c);return e}}(),t=function(a){function e(){u(this,e);return p(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,
arguments))}q(e,a);return e}(m.a),l=/^(?:([a-zA-Z-+_]+):\/\/)?(.*)$/,k=function(d){function e(){u(this,e);var b=p(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments));b.dataSources=new Map;return b}q(e,d);v(e,[{key:"register",value:function(b,a){this.dataSources.set(b,this.registerDisposer(a))}},{key:"getDataSource",value:function(b){b=b.match(l);if(null===b||void 0===b[1])throw Error('Data source URL must have the form "<protocol>://<path>".');var a=b[1],e=this.dataSources.get(a);
if(void 0===e)throw Error("Unsupported data source: "+JSON.stringify(a)+".");return[e,b[2],a]}},{key:"getVolume",value:function(b,a,e,d){e=void 0===e?{}:e;d=void 0===d?c.e:d;a=$jscomp.makeIterator(this.getDataSource(a));var h=a.next().value,g=a.next().value;return new Promise(function(a){a(h.getVolume(b,g,e,d))})}},{key:"getAnnotationSource",value:function(b,a,e){e=void 0===e?c.e:e;a=$jscomp.makeIterator(this.getDataSource(a));var h=a.next().value,d=a.next().value;return new Promise(function(a){a(h.getAnnotationSource(b,
d,e))})}},{key:"getVectorGraphicsSource",value:function(b,a,e,d){e=void 0===e?{}:e;d=void 0===d?c.e:d;a=$jscomp.makeIterator(this.getDataSource(a));var h=a.next().value,g=a.next().value;return new Promise(function(a){a(h.getVectorGraphicsSource(b,g,e,d))})}},{key:"getMeshSource",value:function(b,a,e){e=void 0===e?c.e:e;a=$jscomp.makeIterator(this.getDataSource(a));var h=a.next().value,d=a.next().value;return new Promise(function(a){a(h.getMeshSource(b,d,e))})}},{key:"getSkeletonSource",value:function(b,
a,e){e=void 0===e?c.e:e;a=$jscomp.makeIterator(this.getDataSource(a));var h=a.next().value,d=a.next().value;return new Promise(function(a){a(h.getSkeletonSource(b,d,e))})}},{key:"volumeCompleter",value:function(b,a,e){e=void 0===e?c.e:e;var h=b.match(l),d=h[1];if(void 0===d){a=[];e=$jscomp.makeIterator(this.dataSources);for(h=e.next();!h.done;h=e.next()){var g=$jscomp.makeIterator(h.value);h=g.next().value;g=g.next().value;h+="://";h.startsWith(b)&&a.push({value:h,description:g.description})}return Promise.resolve({offset:0,
completions:a})}b=this.dataSources.get(d);return void 0!==b&&void 0!==b.volumeCompleter?b.volumeCompleter(h[2],a,e).then(function(b){return Object(n.a)(d.length+3,b)}):Promise.reject(null)}},{key:"suggestLayerName",value:function(b){b=$jscomp.makeIterator(this.getDataSource(b));var e=b.next().value;b=b.next().value;e=e.suggestLayerName;if(void 0!==e)return e(b);e=a(b,void 0);return b.substring(e)}},{key:"findSourceGroup",value:function(b){var e=$jscomp.makeIterator(this.getDataSource(b));b=e.next().value;
var c=e.next().value;e=e.next().value;return(b.findSourceGroup||a)(c)+e.length+3}}]);return e}(m.a)},function(m,f,d){(function(f){var p=d(50),q={},a=!1,c=f.chrome&&f.chrome.app&&f.chrome.app.runtime;m.exports={attachEvent:function(a,c){"undefined"!==typeof f.addEventListener?f.addEventListener(a,c,!1):f.document&&f.attachEvent&&(f.document.attachEvent("on"+a,c),f.attachEvent("on"+a,c))},detachEvent:function(a,c){"undefined"!==typeof f.addEventListener?f.removeEventListener(a,c,!1):f.document&&f.detachEvent&&
(f.document.detachEvent("on"+a,c),f.detachEvent("on"+a,c))},unloadAdd:function(d){if(c)return null;var n=p.string(8);q[n]=d;a&&setTimeout(this.triggerUnloadCallbacks,0);return n},unloadDel:function(a){a in q&&delete q[a]},triggerUnloadCallbacks:function(){for(var a in q)q[a](),delete q[a]}};c||m.exports.attachEvent("unload",function(){a||(a=!0,m.exports.triggerUnloadCallbacks())})}).call(f,d(7))},function(m,f,d){f.c=function(d,f,q,a){for(;f<q;){var c=d[f];a(c)?++f:(--q,d[f]=d[q],d[q]=c)}return q};
f.b=function(d,f){if(d.length===f)return d;f=new d.constructor(f);f.set(d);return f};f.d=function(d,f,q,a){for(var c=d.length/f,n=new d.constructor(d.length*q*a),v=d.length*a,t=f*a,l=0;l<c;++l)for(var k=0;k<f;++k)for(var g=d[l*f+k],e=l*t+k,b=0;b<q;++b)for(var h=0;h<a;++h)n[b*v+h*f+e]=g;return n};f.a=function(d,f,q,a,c){a=void 0===a?0:a;for(c=void 0===c?d.length:c;a<c;){var n=a+c-1>>1,v=q(f,d[n]);if(0<v)a=n+1;else if(0>v)c=n;else return n}return~a}},function(m,f,d){function u(a,e){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!e||"object"!==typeof e&&"function"!==typeof e?a:e}function p(a,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);a.prototype=Object.create(e&&e.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});e&&(Object.setPrototypeOf?Object.setPrototypeOf(a,e):a.__proto__=e)}function q(a,e){if(!(a instanceof e))throw new TypeError("Cannot call a class as a function");}d.d(f,"b",function(){return t});d.d(f,
"c",function(){return l});d.d(f,"a",function(){return k});m=d(5);var a=d.n(m);m=d(0);var c=d(3),n=function e(a,c,d){null===a&&(a=Function.prototype);var b=Object.getOwnPropertyDescriptor(a,c);if(void 0===b){if(a=Object.getPrototypeOf(a),null!==a)return e(a,c,d)}else{if("value"in b)return b.value;c=b.get;return void 0===c?void 0:c.call(d)}},v=function(){function a(a,e){for(var b=0;b<e.length;b++){var c=e[b];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,
c.key,c)}}return function(b,e,c){e&&a(b.prototype,e);c&&a(b,c);return b}}(),t=function(){function a(b,e){e=void 0===e?b:e;q(this,a);this.value_=b;this.defaultValue=e;this.changed=new c.a}v(a,[{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 a}(),l=function(a){function b(a){q(this,b);var e=u(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));e.model=a;e.element=document.createElement("input");var c=e.element;c.type="checkbox";e.registerDisposer(a.changed.add(function(){e.updateCheckbox()}));e.updateCheckbox();e.registerEventListener(c,"change",function(b){a.value=this.checked});c.addEventListener("mousedown",function(a){a.preventDefault()});return e}
p(b,a);v(b,[{key:"updateCheckbox",value:function(){this.element.checked=this.model.value}},{key:"disposed",value:function(){var a=this.element,e=a.parentElement;e&&e.removeChild(a);n(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}}]);return b}(m.a),k=function(e){function b(e,c){q(this,b);var d=u(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));d.model=e;d.element=c;d.initialDisplay=d.element.style.display;d.updateVisibility();d.registerDisposer(e.changed.add(d.registerCancellable(a()(function(){return d.updateVisibility()},
0))));return d}p(b,e);v(b,[{key:"updateVisibility",value:function(){this.element.style.display=this.model.value?this.initialDisplay:"none"}}]);return b}(m.a)},function(m,f){},function(m,f,d){function u(a,c){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!c||"object"!==typeof c&&"function"!==typeof c?a:c}function p(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=
Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}d.d(f,"b",function(){return v});d.d(f,"a",function(){return l});var q=d(68);m=d(0);var a=d(55),c=function(){function a(a,e){for(var b=0;b<e.length;b++){var c=e[b];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(c,e,b){e&&a(c.prototype,e);b&&a(c,b);return c}}(),
n=function g(a,b,c){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,b);if(void 0===e){if(a=Object.getPrototypeOf(a),null!==a)return g(a,b,c)}else{if("value"in e)return e.value;b=e.get;return void 0===b?void 0:b.call(c)}};d(232);var v=0,t=a.a.fromObject({escape:{action:"close"}}),l=function(d){function e(){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var b=u(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));b.keyMap=new a.a;b.keyMap.addParent(t,
Number.NEGATIVE_INFINITY);++v;var c=b.container=document.createElement("div");c.className="overlay";var d=b.content=document.createElement("div");b.registerDisposer(new q.a(d));d.className="overlay-content";c.appendChild(d);document.body.appendChild(c);b.registerDisposer(new a.b(b.container,b.keyMap));b.registerEventListener(c,"action:close",function(){b.dispose()});d.focus();return b}p(e,d);c(e,[{key:"disposed",value:function(){--v;document.body.removeChild(this.container);n(e.prototype.__proto__||
Object.getPrototypeOf(e.prototype),"disposed",this).call(this)}}]);return e}(m.a)},function(m,f,d){(function(d,f){m.exports=f()})(this,function(){function d(a){return new RegExp("(^|\\s)"+a+"(?:$|\\s)\\s*")}function f(a){for(var b=a.childNodes.length;0<b;--b)a.removeChild(a.firstChild);return a}function q(a,b){return f(a).appendChild(b)}function a(a,b,e,c){a=document.createElement(a);e&&(a.className=e);c&&(a.style.cssText=c);if("string"==typeof b)a.appendChild(document.createTextNode(b));else if(b)for(e=
0;e<b.length;++e)a.appendChild(b[e]);return a}function c(b,e,c,d){b=a(b,e,c,d);b.setAttribute("role","presentation");return b}function n(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 v(){try{var a=document.activeElement}catch(K){a=document.body||null}for(;a&&a.shadowRoot&&a.shadowRoot.activeElement;)a=a.shadowRoot.activeElement;return a}function t(a,b){var e=a.className;d(b).test(e)||(a.className+=
(e?" ":"")+b)}function l(a,b){a=a.split(" ");for(var e=0;e<a.length;e++)a[e]&&!d(a[e]).test(b)&&(b+=" "+a[e]);return b}function k(a){var b=Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b)}}function g(a,b,e){b||(b={});for(var w in a)!a.hasOwnProperty(w)||!1===e&&b.hasOwnProperty(w)||(b[w]=a[w]);return b}function e(a,b,e,c,d){null==b&&(b=a.search(/[^\s\u00a0]/),-1==b&&(b=a.length));c=c||0;for(d=d||0;;){var w=a.indexOf("\t",c);if(0>w||w>=b)return d+(b-c);d+=w-c;d+=e-d%
e;c=w+1}}function b(a,b){for(var e=0;e<a.length;++e)if(a[e]==b)return e;return-1}function h(a,b,e){for(var w=0,c=0;;){var d=a.indexOf("\t",w);-1==d&&(d=a.length);var h=d-w;if(d==a.length||c+h>=b)return w+Math.min(h,b-c);c+=d-w;c+=e-c%e;w=d+1;if(c>=b)return w}}function r(a){for(;Oc.length<=a;)Oc.push(A(Oc)+" ");return Oc[a]}function A(a){return a[a.length-1]}function y(a,b){for(var e=[],w=0;w<a.length;w++)e[w]=b(a[w],w);return e}function z(a,b,e){for(var w=0,c=e(b);w<a.length&&e(a[w])<=c;)w++;a.splice(w,
0,b)}function m(){}function x(a,b){Object.create?a=Object.create(a):(m.prototype=a,a=new m);b&&g(b,a);return a}function D(a){return/\w/.test(a)||"\u0080"<a&&(a.toUpperCase()!=a.toLowerCase()||bg.test(a))}function G(a,b){return b?-1<b.source.indexOf("\\w")&&D(a)?!0:b.test(a):D(a)}function J(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return!1;return!0}function C(a){return 768<=a.charCodeAt(0)&&cg.test(a)}function B(a,b,e){for(;(0>e?0<b:b<a.length)&&C(a.charAt(b));)b+=e;return b}function F(a,b,e){for(var w=
b>e?-1:1;;){if(b==e)return b;var c=(b+e)/2;c=0>w?Math.ceil(c):Math.floor(c);if(c==b)return a(c)?b:e;a(c)?e=c:b=c+w}}function P(b,e,d){this.input=d;this.scrollbarFiller=a("div",null,"CodeMirror-scrollbar-filler");this.scrollbarFiller.setAttribute("cm-not-content","true");this.gutterFiller=a("div",null,"CodeMirror-gutter-filler");this.gutterFiller.setAttribute("cm-not-content","true");this.lineDiv=c("div",null,"CodeMirror-code");this.selectionDiv=a("div",null,null,"position: relative; z-index: 1");
this.cursorDiv=a("div",null,"CodeMirror-cursors");this.measure=a("div",null,"CodeMirror-measure");this.lineMeasure=a("div",null,"CodeMirror-measure");this.lineSpace=c("div",[this.measure,this.lineMeasure,this.selectionDiv,this.cursorDiv,this.lineDiv],null,"position: relative; outline: none");var w=c("div",[this.lineSpace],"CodeMirror-lines");this.mover=a("div",[w],null,"position: relative");this.sizer=a("div",[this.mover],"CodeMirror-sizer");this.sizerWidth=null;this.heightForcer=a("div",null,null,
"position: absolute; height: 30px; width: 1px;");this.gutters=a("div",null,"CodeMirror-gutters");this.lineGutter=null;this.scroller=a("div",[this.sizer,this.heightForcer,this.gutters],"CodeMirror-scroll");this.scroller.setAttribute("tabIndex","-1");this.wrapper=a("div",[this.scrollbarFiller,this.gutterFiller,this.scroller],"CodeMirror");Z&&8>ea&&(this.gutters.style.zIndex=-1,this.scroller.style.paddingRight=0);ta||gb&&Yb||(this.scroller.draggable=!0);b&&(b.appendChild?b.appendChild(this.wrapper):
b(this.wrapper));this.reportedViewFrom=this.reportedViewTo=this.viewFrom=this.viewTo=e.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;d.init(this)}function H(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 e=0;;++e){var w=a.children[e],c=w.chunkSize();if(b<c){a=w;break}b-=c}return a.lines[b]}function N(a,b,e){var w=[],c=b.line;a.iter(b.line,e.line+1,function(a){a=a.text;c==e.line&&(a=a.slice(0,e.ch));c==b.line&&(a=a.slice(b.ch));w.push(a);
++c});return w}function R(a,b,e){var w=[];a.iter(b,e,function(a){w.push(a.text)});return w}function O(a,b){if(b-=a.height)for(;a;a=a.parent)a.height+=b}function Q(a){if(null==a.parent)return null;var e=a.parent;a=b(e.lines,a);for(var w=e.parent;w;e=w,w=w.parent)for(var c=0;w.children[c]!=e;++c)a+=w.children[c].chunkSize();return a+e.first}function U(a,b){var e=a.first;a:do{for(var w=0;w<a.children.length;++w){var c=a.children[w],d=c.height;if(b<d){a=c;continue a}b-=d;e+=c.chunkSize()}return e}while(!a.lines);
for(w=0;w<a.lines.length;++w){c=a.lines[w].height;if(b<c)break;b-=c}return e+w}function W(a,b){return b>=a.first&&b<a.first+a.size}function aa(a,b){return String(a.lineNumberFormatter(b+a.firstLineNumber))}function I(a,b,e){void 0===e&&(e=null);if(!(this instanceof I))return new I(a,b,e);this.line=a;this.ch=b;this.sticky=e}function T(a,b){return a.line-b.line||a.ch-b.ch}function da(a,b){return a.sticky==b.sticky&&0==T(a,b)}function L(a){return I(a.line,a.ch)}function ia(a,b){return 0>T(a,b)?b:a}function X(a,
b){return 0>T(a,b)?a:b}function S(a,b){if(b.line<a.first)return I(a.first,0);var e=a.first+a.size-1;if(b.line>e)return I(e,H(a,e).text.length);a=H(a,b.line).text.length;e=b.ch;b=null==e||e>a?I(b.line,a):0>e?I(b.line,0):b;return b}function Y(a,b){for(var e=[],c=0;c<b.length;c++)e[c]=S(a,b[c]);return e}function Ca(a,b,e){this.marker=a;this.from=b;this.to=e}function na(a,b){if(a)for(var e=0;e<a.length;++e){var c=a[e];if(c.marker==b)return c}}function fb(a,b){if(b.full)return null;var e=W(a,b.from.line)&&
H(a,b.from.line).markedSpans,c=W(a,b.to.line)&&H(a,b.to.line).markedSpans;if(!e&&!c)return null;a=b.from.ch;var w=b.to.ch,d=0==T(b.from,b.to),h;if(e)for(var g=0;g<e.length;++g){var k=e[g],K=k.marker;if(null==k.from||(K.inclusiveLeft?k.from<=a:k.from<a)||!(k.from!=a||"bookmark"!=K.type||d&&k.marker.insertLeft)){var r=null==k.to||(K.inclusiveRight?k.to>=a:k.to>a);(h||(h=[])).push(new Ca(K,k.from,r?null:k.to))}}e=h;var l;if(c)for(h=0;h<c.length;++h)if(g=c[h],k=g.marker,null==g.to||(k.inclusiveRight?
g.to>=w:g.to>w)||g.from==w&&"bookmark"==k.type&&(!d||g.marker.insertLeft))K=null==g.from||(k.inclusiveLeft?g.from<=w:g.from<w),(l||(l=[])).push(new Ca(k,K?null:g.from-w,null==g.to?null:g.to-w));c=1==b.text.length;w=A(b.text).length+(c?a:0);if(e)for(d=0;d<e.length;++d)if(h=e[d],null==h.to)(g=na(l,h.marker),g)?c&&(h.to=null==g.to?null:g.to+w):h.to=a;if(l)for(a=0;a<l.length;++a)d=l[a],null!=d.to&&(d.to+=w),null==d.from?na(e,d.marker)||(d.from=w,c&&(e||(e=[])).push(d)):(d.from+=w,c&&(e||(e=[])).push(d));
e&&(e=La(e));l&&l!=e&&(l=La(l));a=[e];if(!c){b=b.text.length-2;var n;if(0<b&&e)for(c=0;c<e.length;++c)null==e[c].to&&(n||(n=[])).push(new Ca(e[c].marker,null,null));for(e=0;e<b;++e)a.push(n);a.push(l)}return a}function La(a){for(var b=0;b<a.length;++b){var e=a[b];null!=e.from&&e.from==e.to&&!1!==e.marker.clearWhenEmpty&&a.splice(b--,1)}return a.length?a:null}function qd(a,e,c){var w=null;a.iter(e.line,c.line+1,function(a){if(a.markedSpans)for(var e=0;e<a.markedSpans.length;++e){var c=a.markedSpans[e].marker;
!c.readOnly||w&&-1!=b(w,c)||(w||(w=[])).push(c)}});if(!w)return null;a=[{from:e,to:c}];for(e=0;e<w.length;++e){c=w[e];for(var d=c.find(0),h=0;h<a.length;++h){var g=a[h];if(!(0>T(g.to,d.from)||0<T(g.from,d.to))){var k=[h,1],K=T(g.from,d.from),r=T(g.to,d.to);(0>K||!c.inclusiveLeft&&!K)&&k.push({from:g.from,to:d.from});(0<r||!c.inclusiveRight&&!r)&&k.push({from:d.to,to:g.to});a.splice.apply(a,k);h+=k.length-3}}}return a}function Fb(a){var b=a.markedSpans;if(b){for(var e=0;e<b.length;++e)b[e].marker.detachLine(a);
a.markedSpans=null}}function Ba(a,b){if(b){for(var e=0;e<b.length;++e)b[e].marker.attachLine(a);a.markedSpans=b}}function Za(a,b){var e=a.lines.length-b.lines.length;if(0!=e)return e;e=a.find();var c=b.find(),w=T(e.from,c.from)||(a.inclusiveLeft?-1:0)-(b.inclusiveLeft?-1:0);return w?-w:(e=T(e.to,c.to)||(a.inclusiveRight?1:0)-(b.inclusiveRight?1:0))?e:b.id-a.id}function xa(a,b){a=hb&&a.markedSpans;if(a)for(var e,c=0;c<a.length;++c)if(e=a[c],e.marker.collapsed&&null==(b?e.from:e.to)&&(!w||0>Za(w,e.marker)))var w=
e.marker;return w}function Gb(a,b,e,c,d){a=H(a,b);if(a=hb&&a.markedSpans)for(b=0;b<a.length;++b){var w=a[b];if(w.marker.collapsed){var h=w.marker.find(0),g=T(h.from,e)||(w.marker.inclusiveLeft?-1:0)-(d.inclusiveLeft?-1:0),k=T(h.to,c)||(w.marker.inclusiveRight?1:0)-(d.inclusiveRight?1:0);if(!(0<=g&&0>=k||0>=g&&0<=k)&&(0>=g&&(w.marker.inclusiveRight&&d.inclusiveLeft?0<=T(h.to,e):0<T(h.to,e))||0<=g&&(w.marker.inclusiveRight&&d.inclusiveLeft?0>=T(h.from,c):0>T(h.from,c))))return!0}}}function Ha(a){for(var b;b=
xa(a,!0);)a=b.find(-1,!0).line;return a}function Xb(a,b){a=H(a,b);var e=Ha(a);return a==e?b:Q(e)}function Mc(a,b){if(b>a.lastLine())return b;var e=H(a,b);if(!$a(a,e))return b;for(;a=xa(e,!1);)e=a.find(1,!0).line;return Q(e)+1}function $a(a,b){var e=hb&&b.markedSpans;if(e)for(var c,w=0;w<e.length;++w)if(c=e[w],c.marker.collapsed&&(null==c.from||!c.marker.widgetNode&&0==c.from&&c.marker.inclusiveLeft&&eb(a,b,c)))return!0}function eb(a,b,e){if(null==e.to)return b=e.marker.find(1,!0),eb(a,b.line,na(b.line.markedSpans,
e.marker));if(e.marker.inclusiveRight&&e.to==b.text.length)return!0;for(var c,w=0;w<b.markedSpans.length;++w)if(c=b.markedSpans[w],c.marker.collapsed&&!c.marker.widgetNode&&c.from==e.to&&(null==c.to||c.to!=e.from)&&(c.marker.inclusiveLeft||e.marker.inclusiveRight)&&eb(a,b,c))return!0}function Ia(a){a=Ha(a);for(var b=0,e=a.parent,c=0;c<e.lines.length;++c){var w=e.lines[c];if(w==a)break;else b+=w.height}for(a=e.parent;a;e=a,a=e.parent)for(c=0;c<a.children.length&&(w=a.children[c],w!=e);++c)b+=w.height;
return b}function ya(a){if(0==a.height)return 0;for(var b=a.text.length,e,c=a;e=xa(c,!0);)e=e.find(0,!0),c=e.from.line,b+=e.from.ch-e.to.ch;for(c=a;e=xa(c,!1);)a=e.find(0,!0),b-=c.text.length-a.from.ch,c=a.to.line,b+=c.text.length-a.to.ch;return b}function ab(a){var b=a.display;a=a.doc;b.maxLine=H(a,a.first);b.maxLineLength=ya(b.maxLine);b.maxLineChanged=!0;a.iter(function(a){var e=ya(a);e>b.maxLineLength&&(b.maxLineLength=e,b.maxLine=a)})}function Nc(a,b,e,c){if(!a)return c(b,e,"ltr",0);for(var w=
!1,d=0;d<a.length;++d){var h=a[d];if(h.from<e&&h.to>b||b==e&&h.to==b)c(Math.max(h.from,b),Math.min(h.to,e),1==h.level?"rtl":"ltr",d),w=!0}w||c(b,e,"ltr")}function Ua(a,b,e){var c;Zb=null;for(var w=0;w<a.length;++w){var d=a[w];if(d.from<b&&d.to>b)return w;d.to==b&&(d.from!=d.to&&"before"==e?c=w:Zb=w);d.from==b&&(d.from!=d.to&&"before"!=e?c=w:Zb=w)}return null!=c?c:Zb}function Da(a,b){var e=a.order;null==e&&(e=a.order=dg(a.text,b));return e}function ja(a,e,c){if(a.removeEventListener)a.removeEventListener(e,
c,!1);else if(a.detachEvent)a.detachEvent("on"+e,c);else{var w=(a=a._handlers)&&a[e];w&&(c=b(w,c),-1<c&&(a[e]=w.slice(0,c).concat(w.slice(c+1))))}}function fa(a,b){var e=a._handlers&&a._handlers[b]||Pc;if(e.length)for(var c=Array.prototype.slice.call(arguments,2),w=0;w<e.length;++w)e[w].apply(null,c)}function ka(a,b,e){"string"==typeof b&&(b={type:b,preventDefault:function(){this.defaultPrevented=!0}});fa(a,e||b.type,a,b);return pb(b)||b.codemirrorIgnore}function $b(a){var e=a._handlers&&a._handlers.cursorActivity;
if(e){a=a.curOp.cursorActivityHandlers||(a.curOp.cursorActivityHandlers=[]);for(var c=0;c<e.length;++c)-1==b(a,e[c])&&a.push(e[c])}}function Ea(a,b){return 0<(a._handlers&&a._handlers[b]||Pc).length}function Ma(a){a.prototype.on=function(a,b){V(this,a,b)};a.prototype.off=function(a,b){ja(this,a,b)}}function oa(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function Qc(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0}function pb(a){return null!=a.defaultPrevented?a.defaultPrevented:
0==a.returnValue}function qb(a){oa(a);Qc(a)}function ac(a){var b=a.which;null==b&&(a.button&1?b=1:a.button&2?b=3:a.button&4&&(b=2));Na&&a.ctrlKey&&1==b&&(b=3);return b}function ib(b){if(null==rd){var e=a("span","\u200b");q(b,a("span",[e,document.createTextNode("x")]));0!=b.firstChild.offsetHeight&&(rd=1>=e.offsetWidth&&2<e.offsetHeight&&!(Z&&8>ea))}b=rd?a("span","\u200b"):a("span","\u00a0",null,"display: inline-block; width: 1px; margin-right: -1px");b.setAttribute("cm-text","");return b}function Rc(a,
b){2<arguments.length&&(b.dependencies=Array.prototype.slice.call(arguments,2));sd[a]=b}function bb(a){if("string"==typeof a&&Hb.hasOwnProperty(a))a=Hb[a];else if(a&&"string"==typeof a.name&&Hb.hasOwnProperty(a.name)){var b=Hb[a.name];"string"==typeof b&&(b={name:b});a=x(b,a);a.name=b.name}else{if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+xml$/.test(a))return bb("application/xml");if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+json$/.test(a))return bb("application/json")}return"string"==typeof a?{name:a}:
a||{name:"null"}}function Oa(a,b){b=bb(b);var e=sd[b.name];if(!e)return Oa(a,"text/plain");a=e(a,b);if(Ib.hasOwnProperty(b.name)){e=Ib[b.name];for(var c in e)e.hasOwnProperty(c)&&(a.hasOwnProperty(c)&&(a["_"+c]=a[c]),a[c]=e[c])}a.name=b.name;b.helperType&&(a.helperType=b.helperType);if(b.modeProps)for(var d in b.modeProps)a[d]=b.modeProps[d];return a}function ua(a,b){a=Ib.hasOwnProperty(a)?Ib[a]:Ib[a]={};g(b,a)}function Pa(a,b){if(!0===b)return b;if(a.copyState)return a.copyState(b);a={};for(var e in b){var c=
b[e];c instanceof Array&&(c=c.concat([]));a[e]=c}return a}function Jb(a,b){for(var e;a.innerMode;){e=a.innerMode(b);if(!e||e.mode==a)break;b=e.state;a=e.mode}return e||{mode:a,state:b}}function bc(a,b,e){return a.startState?a.startState(b,e):!0}function Sc(a,b,e,c){var d=[a.state.modeGen],w={};ie(a,b.text,a.doc.mode,e,function(a,b){return d.push(a,b)},w,c);var h=e.state;c=function(c){e.baseTokens=d;var g=a.state.overlays[c],k=1,K=0;e.state=!0;ie(a,b.text,g.mode,e,function(a,b){for(var e=k;K<a;){var c=
d[k];c>a&&d.splice(k,1,a,d[k+1],c);k+=2;K=Math.min(a,c)}if(b)if(g.opaque)d.splice(e,k-e,a,"overlay "+b),k=e+2;else for(;e<k;e+=2)a=d[e+1],d[e+1]=(a?a+" ":"")+"overlay "+b},w);e.state=h;e.baseTokens=null;e.baseTokenPos=1};for(var g=0;g<a.state.overlays.length;++g)c(g);return{styles:d,classes:w.bgClass||w.textClass?w:null}}function jb(a,b,e){if(!b.styles||b.styles[0]!=a.state.modeGen){var c=Va(a,Q(b)),d=b.text.length>a.options.maxHighlightLength&&Pa(a.doc.mode,c.state),w=Sc(a,b,c);d&&(c.state=d);b.stateAfter=
c.save(!d);b.styles=w.styles;w.classes?b.styleClasses=w.classes:b.styleClasses&&(b.styleClasses=null);e===a.doc.highlightFrontier&&(a.doc.modeFrontier=Math.max(a.doc.modeFrontier,++a.doc.highlightFrontier))}return b.styles}function Va(a,b,e){var c=a.doc,d=a.display;if(!c.mode.startState)return new Wa(c,!0,b);var w=eg(a,b,e),h=w>c.first&&H(c,w-1).stateAfter,g=h?Wa.fromSaved(c,h,w):new Wa(c,bc(c.mode),w);c.iter(w,b,function(e){cc(a,e.text,g);var c=g.line;e.stateAfter=c==b-1||0==c%5||c>=d.viewFrom&&
c<d.viewTo?g.save():null;g.nextLine()});e&&(c.modeFrontier=g.line);return g}function cc(a,b,e,c){var d=a.doc.mode;a=new la(b,a.options.tabSize,e);a.start=a.pos=c||0;for(""==b&&M(d,e.state);!a.eol();)dc(d,a,e.state),a.start=a.pos}function M(a,b){if(a.blankLine)return a.blankLine(b);if(a.innerMode&&(a=Jb(a,b),a.mode.blankLine))return a.mode.blankLine(a.state)}function dc(a,b,e,c){for(var d=0;10>d;d++){c&&(c[0]=Jb(a,e).mode);var h=a.token(b,e);if(b.pos>b.start)return h}throw Error("Mode "+a.name+" failed to advance stream.");
}function je(a,b,e,c){var d=a.doc,h=d.mode;b=S(d,b);var w=H(d,b.line);e=Va(a,b.line,e);a=new la(w.text,a.options.tabSize,e);var g;for(c&&(g=[]);(c||a.pos<b.ch)&&!a.eol();){a.start=a.pos;var k=dc(h,a,e.state);c&&g.push(new ke(a,k,Pa(d.mode,e.state)))}return c?g:new ke(a,k,e.state)}function le(a,b){if(a)for(;;){var e=a.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!e)break;a=a.slice(0,e.index)+a.slice(e.index+e[0].length);var c=e[1]?"bgClass":"textClass";null==b[c]?b[c]=e[2]:(new RegExp("(?:^|s)"+e[2]+
"(?:$|s)")).test(b[c])||(b[c]+=" "+e[2])}return a}function ie(a,b,e,c,d,h,g){var w=e.flattenSpans;null==w&&(w=a.options.flattenSpans);var k=0,r=null,K=new la(b,a.options.tabSize,c),l=a.options.addModeClass&&[null];for(""==b&&le(M(e,c.state),h);!K.eol();){if(K.pos>a.options.maxHighlightLength){w=!1;g&&cc(a,b,c,K.pos);K.pos=b.length;var n=null}else n=le(dc(e,K,c.state,l),h);if(l){var f=l[0].name;f&&(n="m-"+(n?f+" "+n:f))}if(!w||r!=n){for(;k<K.start;)k=Math.min(K.start,k+5E3),d(k,r);r=n}K.start=K.pos}for(;k<
K.pos;)a=Math.min(K.pos,k+5E3),d(a,r),k=a}function eg(a,b,c){for(var d,h,w=a.doc,g=c?-1:b-(a.doc.mode.innerMode?1E3:100);b>g;--b){if(b<=w.first)return w.first;var k=H(w,b-1),r=k.stateAfter;if(r&&(!c||b+(r instanceof Tc?r.lookAhead:0)<=w.modeFrontier))return b;k=e(k.text,null,a.options.tabSize);if(null==h||d>k)h=b-1,d=k}return h}function fg(a,b){a.modeFrontier=Math.min(a.modeFrontier,b);if(!(a.highlightFrontier<b-10)){for(var e=a.first,c=b-1;c>e;c--){var d=H(a,c).stateAfter;if(d&&(!(d instanceof Tc)||
c+d.lookAhead<b)){e=c+1;break}}a.highlightFrontier=Math.min(a.highlightFrontier,e)}}function me(a,b){if(!a||/^\s*$/.test(a))return null;b=b.addModeClass?gg:hg;return b[a]||(b[a]=a.replace(/\S+/g,"cm-$&"))}function ne(a,b){var e=c("span",null,null,ta?"padding-right: .1px":null);e={pre:c("pre",[e],"CodeMirror-line"),content:e,col:0,pos:0,cm:a,trailingSpace:!1,splitSpaces:(Z||ta)&&a.getOption("lineWrapping")};b.measure={};for(var d=0;d<=(b.rest?b.rest.length:0);d++){var h=d?b.rest[d-1]:b.line,w=void 0;
e.pos=0;e.addToken=ig;var g=a.display.measure;if(null!=td)g=td;else{var k=q(g,document.createTextNode("A\u062eA")),r=ec(k,0,1).getBoundingClientRect();k=ec(k,1,2).getBoundingClientRect();f(g);g=r&&r.left!=r.right?td=3>k.right-r.right:!1}g&&(w=Da(h,a.doc.direction))&&(e.addToken=jg(e.addToken,w));e.map=[];var K=b!=a.display.externalMeasured&&Q(h);a:{var n=k=r=g=void 0,t=void 0,v=void 0,A=void 0;w=e;K=jb(a,h,K);var C=h.markedSpans,p=h.text,y=0;if(C)for(var J=p.length,z=0,u=1,B="",x=0;;){if(x==z){t=
n=k=r=v="";g=null;x=Infinity;for(var G=[],F=void 0,D=0;D<C.length;++D){var m=C[D],E=m.marker;"bookmark"==E.type&&m.from==z&&E.widgetNode?G.push(E):m.from<=z&&(null==m.to||m.to>z||E.collapsed&&m.to==z&&m.from==z)?(null!=m.to&&m.to!=z&&x>m.to&&(x=m.to,n=""),E.className&&(t+=" "+E.className),E.css&&(v=(v?v+";":"")+E.css),E.startStyle&&m.from==z&&(k+=" "+E.startStyle),E.endStyle&&m.to==x&&(F||(F=[])).push(E.endStyle,m.to),E.title&&!r&&(r=E.title),E.collapsed&&(!g||0>Za(g.marker,E))&&(g=m)):m.from>z&&
x>m.from&&(x=m.from)}if(F)for(D=0;D<F.length;D+=2)F[D+1]==x&&(n+=" "+F[D]);if(!g||g.from==z)for(F=0;F<G.length;++F)oe(w,0,G[F]);if(g&&(g.from||0)==z){oe(w,(null==g.to?J+1:g.to)-z,g.marker,null==g.from);if(null==g.to)break a;g.to==z&&(g=!1)}}if(z>=J)break;for(G=Math.min(J,x);;){if(B){F=z+B.length;g||(D=F>G?B.slice(0,G-z):B,w.addToken(w,D,A?A+t:t,k,z+D.length==x?n:"",r,v));if(F>=G){B=B.slice(G-z);z=G;break}z=F;k=""}B=p.slice(y,y=K[u++]);A=me(K[u++],w.cm.options)}}else for(g=1;g<K.length;g+=2)w.addToken(w,
p.slice(y,y=K[g]),me(K[g+1],w.cm.options))}h.styleClasses&&(h.styleClasses.bgClass&&(e.bgClass=l(h.styleClasses.bgClass,e.bgClass||"")),h.styleClasses.textClass&&(e.textClass=l(h.styleClasses.textClass,e.textClass||"")));0==e.map.length&&e.map.push(0,0,e.content.appendChild(ib(a.display.measure)));0==d?(b.measure.map=e.map,b.measure.cache={}):((b.measure.maps||(b.measure.maps=[])).push(e.map),(b.measure.caches||(b.measure.caches=[])).push({}))}ta&&(d=e.content.lastChild,/\bcm-tab\b/.test(d.className)||
d.querySelector&&d.querySelector(".cm-tab"))&&(e.content.className="cm-tab-wrap-hack");fa(a,"renderLine",a,b.line,e.pre);e.pre.className&&(e.textClass=l(e.pre.className,e.textClass||""));return e}function kg(b){var e=a("span","\u2022","cm-invalidchar");e.title="\\u"+b.charCodeAt(0).toString(16);e.setAttribute("aria-label",e.title);return e}function ig(b,e,c,d,h,g,k){if(e){if(b.splitSpaces){var w=b.trailingSpace;if(1<e.length&&!/  /.test(e))w=e;else{for(var K="",l=0;l<e.length;l++){var n=e.charAt(l);
" "!=n||!w||l!=e.length-1&&32!=e.charCodeAt(l+1)||(n="\u00a0");K+=n;w=" "==n}w=K}}else w=e;K=w;l=b.cm.state.specialChars;n=!1;if(l.test(e)){w=document.createDocumentFragment();for(var f=0;;){l.lastIndex=f;var t=l.exec(e),v=t?t.index-f:e.length-f;if(v){var A=document.createTextNode(K.slice(f,f+v));Z&&9>ea?w.appendChild(a("span",[A])):w.appendChild(A);b.map.push(b.pos,b.pos+v,A);b.col+=v;b.pos+=v}if(!t)break;f+=v+1;"\t"==t[0]?(t=b.cm.options.tabSize,t-=b.col%t,v=w.appendChild(a("span",r(t),"cm-tab")),
v.setAttribute("role","presentation"),v.setAttribute("cm-text","\t"),b.col+=t):("\r"==t[0]||"\n"==t[0]?(v=w.appendChild(a("span","\r"==t[0]?"\u240d":"\u2424","cm-invalidchar")),v.setAttribute("cm-text",t[0])):(v=b.cm.options.specialCharPlaceholder(t[0]),v.setAttribute("cm-text",t[0]),Z&&9>ea?w.appendChild(a("span",[v])):w.appendChild(v)),b.col+=1);b.map.push(b.pos,b.pos+1,v);b.pos++}}else b.col+=e.length,w=document.createTextNode(K),b.map.push(b.pos,b.pos+e.length,w),Z&&9>ea&&(n=!0),b.pos+=e.length;
b.trailingSpace=32==K.charCodeAt(e.length-1);if(c||d||h||n||k)return e=c||"",d&&(e+=d),h&&(e+=h),d=a("span",[w],e,k),g&&(d.title=g),b.content.appendChild(d);b.content.appendChild(w)}}function jg(a,b){return function(e,c,d,h,g,w,k){d=d?d+" cm-force-border":"cm-force-border";for(var r=e.pos,K=r+c.length;;){for(var l=void 0,n=0;n<b.length&&!(l=b[n],l.to>r&&l.from<=r);n++);if(l.to>=K)return a(e,c,d,h,g,w,k);a(e,c.slice(0,l.to-r),d,h,null,w,k);h=null;c=c.slice(l.to-r);r=l.to}}}function oe(a,b,e,c){var d=
!c&&e.widgetNode;d&&a.map.push(a.pos,a.pos+b,d);!c&&a.cm.display.input.needsContentAttribute&&(d||(d=a.content.appendChild(document.createElement("span"))),d.setAttribute("cm-marker",e.id));d&&(a.cm.display.input.setUneditable(d),a.content.appendChild(d));a.pos+=b;a.trailingSpace=!1}function pe(a,b,e){for(var c=this.line=b,d;c=xa(c,!1);)c=c.find(1,!0).line,(d||(d=[])).push(c);this.size=(this.rest=d)?Q(A(this.rest))-e+1:1;this.node=this.text=null;this.hidden=$a(a,b)}function Uc(a,b,e){var c=[],d;for(d=
b;d<e;)b=new pe(a.doc,H(a.doc,d),d),d+=b.size,c.push(b);return c}function lg(a,b){if(a=a.ownsGroup)try{var e=a.delayedCallbacks,c=0;do{for(;c<e.length;c++)e[c].call(null);for(var d=0;d<a.ops.length;d++){var h=a.ops[d];if(h.cursorActivityHandlers)for(;h.cursorActivityCalled<h.cursorActivityHandlers.length;)h.cursorActivityHandlers[h.cursorActivityCalled++].call(null,h.cm)}}while(c<e.length)}finally{Kb=null,b(a)}}function ra(a,b){var e=a._handlers&&a._handlers[b]||Pc;if(e.length){var c=Array.prototype.slice.call(arguments,
2);if(Kb)var d=Kb.delayedCallbacks;else fc?d=fc:(d=fc=[],setTimeout(mg,0));for(var h=function(a){d.push(function(){return e[a].apply(null,c)})},g=0;g<e.length;++g)h(g)}}function mg(){var a=fc;fc=null;for(var b=0;b<a.length;++b)a[b]()}function qe(a,b,e,c){for(var d=0;d<b.changes.length;d++){var h=b.changes[d];if("text"==h){h=a;var g=b,w=g.text.className,k=re(h,g);g.text==g.node&&(g.node=k.pre);g.text.parentNode.replaceChild(k.pre,g.text);g.text=k.pre;k.bgClass!=g.bgClass||k.textClass!=g.textClass?
(g.bgClass=k.bgClass,g.textClass=k.textClass,ud(h,g)):w&&(g.text.className=w)}else if("gutter"==h)se(a,b,e,c);else if("class"==h)ud(a,b);else if("widget"==h){h=a;g=b;w=c;g.alignable&&(g.alignable=null);k=g.node.firstChild;for(var r;k;k=r)r=k.nextSibling,"CodeMirror-linewidget"==k.className&&g.node.removeChild(k);te(h,g,w)}}b.changes=null}function gc(b){b.node==b.text&&(b.node=a("div",null,null,"position: relative"),b.text.parentNode&&b.text.parentNode.replaceChild(b.node,b.text),b.node.appendChild(b.text),
Z&&8>ea&&(b.node.style.zIndex=2));return b.node}function re(a,b){var e=a.display.externalMeasured;return e&&e.line==b.line?(a.display.externalMeasured=null,b.measure=e.measure,e.built):ne(a,b)}function ud(b,e){var c=e.bgClass?e.bgClass+" "+(e.line.bgClass||""):e.line.bgClass;c&&(c+=" CodeMirror-linebackground");if(e.background)c?e.background.className=c:(e.background.parentNode.removeChild(e.background),e.background=null);else if(c){var d=gc(e);e.background=d.insertBefore(a("div",null,c),d.firstChild);
b.display.input.setUneditable(e.background)}e.line.wrapClass?gc(e).className=e.line.wrapClass:e.node!=e.text&&(e.node.className="");e.text.className=(e.textClass?e.textClass+" "+(e.line.textClass||""):e.line.textClass)||""}function se(b,e,c,d){e.gutter&&(e.node.removeChild(e.gutter),e.gutter=null);e.gutterBackground&&(e.node.removeChild(e.gutterBackground),e.gutterBackground=null);if(e.line.gutterClass){var h=gc(e);e.gutterBackground=a("div",null,"CodeMirror-gutter-background "+e.line.gutterClass,
"left: "+(b.options.fixedGutter?d.fixedPos:-d.gutterTotalWidth)+"px; width: "+d.gutterTotalWidth+"px");b.display.input.setUneditable(e.gutterBackground);h.insertBefore(e.gutterBackground,e.text)}h=e.line.gutterMarkers;if(b.options.lineNumbers||h){var g=gc(e),w=e.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(b.options.fixedGutter?d.fixedPos:-d.gutterTotalWidth)+"px");b.display.input.setUneditable(w);g.insertBefore(w,e.text);e.line.gutterClass&&(w.className+=" "+e.line.gutterClass);!b.options.lineNumbers||
h&&h["CodeMirror-linenumbers"]||(e.lineNumber=w.appendChild(a("div",aa(b.options,c),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+d.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+b.display.lineNumInnerWidth+"px")));if(h)for(e=0;e<b.options.gutters.length;++e)c=b.options.gutters[e],(g=h.hasOwnProperty(c)&&h[c])&&w.appendChild(a("div",[g],"CodeMirror-gutter-elt","left: "+d.gutterLeft[c]+"px; width: "+d.gutterWidth[c]+"px"))}}function ng(a,b,e,c){var d=re(a,b);b.text=b.node=d.pre;d.bgClass&&
(b.bgClass=d.bgClass);d.textClass&&(b.textClass=d.textClass);ud(a,b);se(a,b,e,c);te(a,b,c);return b.node}function te(a,b,e){ue(a,b.line,b,e,!0);if(b.rest)for(var c=0;c<b.rest.length;c++)ue(a,b.rest[c],b,e,!1)}function ue(b,e,c,d,h){if(e.widgets){var g=gc(c),w=0;for(e=e.widgets;w<e.length;++w){var k=e[w],r=a("div",[k.node],"CodeMirror-linewidget");k.handleMouseEvents||r.setAttribute("cm-ignore-events","true");var l=k,K=r,n=d;if(l.noHScroll){(c.alignable||(c.alignable=[])).push(K);var t=n.wrapperWidth;
K.style.left=n.fixedPos+"px";l.coverGutter||(t-=n.gutterTotalWidth,K.style.paddingLeft=n.gutterTotalWidth+"px");K.style.width=t+"px"}l.coverGutter&&(K.style.zIndex=5,K.style.position="relative",l.noHScroll||(K.style.marginLeft=-n.gutterTotalWidth+"px"));b.display.input.setUneditable(r);h&&k.above?g.insertBefore(r,c.gutter||c.text):g.appendChild(r);ra(k,"redraw")}}}function hc(b){if(null!=b.height)return b.height;var e=b.doc.cm;if(!e)return 0;if(!n(document.body,b.node)){var c="position: relative;";
b.coverGutter&&(c+="margin-left: -"+e.display.gutters.offsetWidth+"px;");b.noHScroll&&(c+="width: "+e.display.wrapper.clientWidth+"px;");q(e.display.measure,a("div",[b.node],null,c))}return b.height=b.node.parentNode.offsetHeight}function cb(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 vd(a){return a.mover.offsetHeight-a.lineSpace.offsetHeight}function ve(b){if(b.cachedPaddingH)return b.cachedPaddingH;
var e=q(b.measure,a("pre","x"));e=window.getComputedStyle?window.getComputedStyle(e):e.currentStyle;e={left:parseInt(e.paddingLeft),right:parseInt(e.paddingRight)};isNaN(e.left)||isNaN(e.right)||(b.cachedPaddingH=e);return e}function Xa(a){return 30-a.display.nativeBarWidth}function rb(a){return a.display.scroller.clientWidth-Xa(a)-a.display.barWidth}function wd(a){return a.display.scroller.clientHeight-Xa(a)-a.display.barHeight}function we(a,b,e){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(Q(a.rest[b])>e)return{map:a.measure.maps[b],cache:a.measure.caches[b],before:!0}}function xd(a,b){if(b>=a.display.viewFrom&&b<a.display.viewTo)return a.display.view[sb(a,b)];if((a=a.display.externalMeasured)&&b>=a.lineN&&b<a.lineN+a.size)return a}function tb(a,b){var e=Q(b),c=xd(a,e);c&&!c.text?c=null:c&&c.changes&&(qe(a,c,e,yd(a)),a.curOp.forceUpdate=!0);if(!c){var d=
Ha(b);c=Q(d);d=a.display.externalMeasured=new pe(a.doc,d,c);d.lineN=c;c=d.built=ne(a,d);d.text=c.pre;q(a.display.lineMeasure,c.pre);c=d}a=we(c,b,e);return{line:b,view:c,rect:null,map:a.map,cache:a.cache,before:a.before,hasHeights:!1}}function Qa(b,e,c,d,h){e.before&&(c=-1);var g=c+(d||"");if(e.cache.hasOwnProperty(g))b=e.cache[g];else{e.rect||(e.rect=e.view.text.getBoundingClientRect());if(!e.hasHeights){var w=e.view,k=e.rect,r=b.options.lineWrapping,l=r&&rb(b);if(!w.measure.heights||r&&w.measure.width!=
l){var n=w.measure.heights=[];if(r)for(w.measure.width=l,w=w.text.firstChild.getClientRects(),r=0;r<w.length-1;r++){l=w[r];var t=w[r+1];2<Math.abs(l.bottom-t.bottom)&&n.push((l.bottom+t.top)/2-k.top)}n.push(k.bottom-k.top)}e.hasHeights=!0}n=d;w=xe(e.map,c,n);d=w.node;k=w.start;r=w.end;c=w.collapse;if(3==d.nodeType){for(var f=0;4>f;f++){for(;k&&C(e.line.text.charAt(w.coverStart+k));)--k;for(;w.coverStart+r<w.coverEnd&&C(e.line.text.charAt(w.coverStart+r));)++r;if(Z&&9>ea&&0==k&&r==w.coverEnd-w.coverStart)var K=
d.parentNode.getBoundingClientRect();else{K=ec(d,k,r).getClientRects();r=ye;if("left"==n)for(l=0;l<K.length&&(r=K[l]).left==r.right;l++);else for(l=K.length-1;0<=l&&(r=K[l]).left==r.right;l--);K=r}if(K.left||K.right||0==k)break;r=k;--k;c="right"}Z&&11>ea&&((f=!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI)||(null!=zd?f=zd:(n=q(b.display.measure,a("span","x")),f=n.getBoundingClientRect(),n=ec(n,0,1).getBoundingClientRect(),f=zd=1<Math.abs(f.left-n.left)),f=!f),f||(f=
screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI,K={left:K.left*f,right:K.right*f,top:K.top*n,bottom:K.bottom*n}))}else 0<k&&(c=n="right"),K=b.options.lineWrapping&&1<(f=d.getClientRects()).length?f["right"==n?f.length-1:0]:d.getBoundingClientRect();!(Z&&9>ea)||k||K&&(K.left||K.right)||(K=(K=d.parentNode.getClientRects()[0])?{left:K.left,right:K.left+ic(b.display),top:K.top,bottom:K.bottom}:ye);d=K.top-e.rect.top;k=K.bottom-e.rect.top;f=(d+k)/2;n=e.view.measure.heights;
for(w=0;w<n.length-1&&!(f<n[w]);w++);c={left:("right"==c?K.right:K.left)-e.rect.left,right:("left"==c?K.left:K.right)-e.rect.left,top:w?n[w-1]:0,bottom:n[w]};K.left||K.right||(c.bogus=!0);b.options.singleCursorHeightPerLine||(c.rtop=d,c.rbottom=k);b=c;b.bogus||(e.cache[g]=b)}return{left:b.left,right:b.right,top:h?b.rtop:b.top,bottom:h?b.rbottom:b.bottom}}function xe(a,b,e){for(var c,d,h,g,w,k,r=0;r<a.length;r+=3){w=a[r];k=a[r+1];if(b<w)d=0,h=1,g="left";else if(b<k)d=b-w,h=d+1;else if(r==a.length-
3||b==k&&a[r+3]>b)h=k-w,d=h-1,b>=k&&(g="right");if(null!=d){c=a[r+2];w==k&&e==(c.insertLeft?"left":"right")&&(g=e);if("left"==e&&0==d)for(;r&&a[r-2]==a[r-3]&&a[r-1].insertLeft;)c=a[(r-=3)+2],g="left";if("right"==e&&d==k-w)for(;r<a.length-3&&a[r+3]==a[r+4]&&!a[r+5].insertLeft;)c=a[(r+=3)+2],g="right";break}}return{node:c,start:d,end:h,collapse:g,coverStart:w,coverEnd:k}}function ze(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 Ae(a){a.display.externalMeasure=null;f(a.display.lineMeasure);for(var b=0;b<a.display.view.length;b++)ze(a.display.view[b])}function jc(a){Ae(a);a.display.cachedCharWidth=a.display.cachedTextHeight=a.display.cachedPaddingH=null;a.options.lineWrapping||(a.display.maxLineChanged=!0);a.display.lineNumChars=null}function Be(){return Vc&&Wc?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}
function Ce(){return Vc&&Wc?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function Ad(a){var b=0;if(a.widgets)for(var e=0;e<a.widgets.length;++e)a.widgets[e].above&&(b+=hc(a.widgets[e]));return b}function Xc(a,b,e,c,d){d||(d=Ad(b),e.top+=d,e.bottom+=d);if("line"==c)return e;c||(c="local");b=Ia(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:Ce()),c=a.left+("window"==c?0:Be()),e.left+=c,e.right+=c;e.top+=b;e.bottom+=b;return e}function De(a,b,e){if("div"==e)return b;var c=b.left;b=b.top;"page"==e?(c-=Be(),b-=Ce()):"local"!=e&&e||(e=a.display.sizer.getBoundingClientRect(),c+=e.left,b+=e.top);a=a.display.lineSpace.getBoundingClientRect();return{left:c-a.left,top:b-a.top}}function Bd(a,b,e,c,d){c||(c=H(a.doc,b.line));var h=c;b=b.ch;c=Qa(a,tb(a,c),b,d);return Xc(a,
h,c,e)}function Ra(a,b,e,c,d,h){function g(b,g){b=Qa(a,d,b,g?"right":"left",h);g?b.left=b.right:b.right=b.left;return Xc(a,c,b,e)}function w(a,b,e){return g(e?a-1:a,1==k[b].level!=e)}c=c||H(a.doc,b.line);d||(d=tb(a,c));var k=Da(c,a.doc.direction),r=b.ch;b=b.sticky;r>=c.text.length?(r=c.text.length,b="before"):0>=r&&(r=0,b="after");if(!k)return g("before"==b?r-1:r,"before"==b);var l=Ua(k,r,b),n=Zb;l=w(r,l,"before"==b);null!=n&&(l.other=w(r,n,"before"!=b));return l}function Ee(a,b){var e=0;b=S(a.doc,
b);a.options.lineWrapping||(e=ic(a.display)*b.ch);b=H(a.doc,b.line);a=Ia(b)+a.display.lineSpace.offsetTop;return{left:e,right:e,top:a,bottom:a+b.height}}function Cd(a,b,e,c,d){a=I(a,b,e);a.xRel=d;c&&(a.outside=!0);return a}function Dd(a,b,e){var c=a.doc;e+=a.display.viewOffset;if(0>e)return Cd(c.first,0,null,!0,-1);var d=U(c,e),h=c.first+c.size-1;if(d>h)return Cd(c.first+c.size-1,H(c,h).text.length,null,!0,1);0>b&&(b=0);for(c=H(c,d);;)if(d=og(a,c,d,b,e),h=(c=xa(c,!1))&&c.find(0,!0),c&&(d.ch>h.from.ch||
d.ch==h.from.ch&&0<d.xRel))d=Q(c=h.to.line);else return d}function Fe(a,b,e,c){c-=Ad(b);b=b.text.length;var d=F(function(b){return Qa(a,e,b-1).bottom<=c},b,0);b=F(function(b){return Qa(a,e,b).top>c},d,b);return{begin:d,end:b}}function Ge(a,b,e,c){e||(e=tb(a,b));c=Xc(a,b,Qa(a,e,c),"line").top;return Fe(a,b,e,c)}function Ed(a,b,e,c){return a.bottom<=e?!1:a.top>e?!0:(c?a.left:a.right)>b}function og(a,b,e,c,d){d-=Ia(b);var h=tb(a,b),g=Ad(b),w=0,k=b.text.length,r=!0,l=Da(b,a.doc.direction);l&&(l=(a.options.lineWrapping?
pg:qg)(a,b,e,h,l,c,d),w=(r=1!=l.level)?l.from:l.to-1,k=r?l.to:l.from-1);var n=null,f=null;l=F(function(b){var e=Qa(a,h,b);e.top+=g;e.bottom+=g;if(!Ed(e,c,d,!1))return!1;e.top<=d&&e.left<=c&&(n=b,f=e);return!0},w,k);var t=!1;f?(w=c-f.left<f.right-c,r=w==r,l=n+(r?0:1),r=r?"after":"before",w=w?f.left:f.right):(r||l!=k&&l!=w||l++,r=0==l?"after":l==b.text.length?"before":Qa(a,h,l-(r?1:0)).bottom+g<=d==r?"after":"before",t=Ra(a,I(e,l,r),"line",b,h),w=t.left,t=d<t.top||d>=t.bottom);l=B(b.text,l,1);return Cd(e,
l,r,t,c-w)}function qg(a,b,e,c,d,h,g){var w=F(function(w){w=d[w];var k=1!=w.level;return Ed(Ra(a,I(e,k?w.to:w.from,k?"before":"after"),"line",b,c),h,g,!0)},0,d.length-1),k=d[w];if(0<w){var r=1!=k.level;r=Ra(a,I(e,r?k.from:k.to,r?"after":"before"),"line",b,c);Ed(r,h,g,!0)&&r.top>g&&(k=d[w-1])}return k}function pg(a,b,e,c,d,h,g){g=Fe(a,b,c,g);e=g.begin;g=g.end;/\s/.test(b.text.charAt(g-1))&&g--;for(var w=b=null,k=0;k<d.length;k++){var r=d[k];if(!(r.from>=g||r.to<=e)){var l=Qa(a,c,1!=r.level?Math.min(g,
r.to)-1:Math.max(e,r.from)).right;l=l<h?h-l+1E9:l-h;if(!b||w>l)b=r,w=l}}b||(b=d[d.length-1]);b.from<e&&(b={from:e,to:b.to,level:b.level});b.to>g&&(b={from:b.from,to:g,level:b.level});return b}function ub(b){if(null!=b.cachedTextHeight)return b.cachedTextHeight;if(null==vb){vb=a("pre");for(var e=0;49>e;++e)vb.appendChild(document.createTextNode("x")),vb.appendChild(a("br"));vb.appendChild(document.createTextNode("x"))}q(b.measure,vb);e=vb.offsetHeight/50;3<e&&(b.cachedTextHeight=e);f(b.measure);return e||
1}function ic(b){if(null!=b.cachedCharWidth)return b.cachedCharWidth;var e=a("span","xxxxxxxxxx"),c=a("pre",[e]);q(b.measure,c);e=e.getBoundingClientRect();e=(e.right-e.left)/10;2<e&&(b.cachedCharWidth=e);return e||10}function yd(a){for(var b=a.display,e={},c={},d=b.gutters.clientLeft,h=b.gutters.firstChild,g=0;h;h=h.nextSibling,++g)e[a.options.gutters[g]]=h.offsetLeft+h.clientLeft+d,c[a.options.gutters[g]]=h.clientWidth;return{fixedPos:Fd(b),gutterTotalWidth:b.gutters.offsetWidth,gutterLeft:e,gutterWidth:c,
wrapperWidth:b.wrapper.clientWidth}}function Fd(a){return a.scroller.getBoundingClientRect().left-a.sizer.getBoundingClientRect().left}function He(a){var b=ub(a.display),e=a.options.lineWrapping,c=e&&Math.max(5,a.display.scroller.clientWidth/ic(a.display)-3);return function(d){if($a(a.doc,d))return 0;var h=0;if(d.widgets)for(var g=0;g<d.widgets.length;g++)d.widgets[g].height&&(h+=d.widgets[g].height);return e?h+(Math.ceil(d.text.length/c)||1)*b:h+b}}function Gd(a){var b=a.doc,e=He(a);b.iter(function(a){var b=
e(a);b!=a.height&&O(a,b)})}function wb(a,b,c,d){var h=a.display;if(!c&&"true"==(b.target||b.srcElement).getAttribute("cm-not-content"))return null;c=h.lineSpace.getBoundingClientRect();try{var g=b.clientX-c.left;var w=b.clientY-c.top}catch(he){return null}b=Dd(a,g,w);var k;d&&1==b.xRel&&(k=H(a.doc,b.line).text).length==b.ch&&(d=e(k,k.length,a.options.tabSize)-k.length,b=I(b.line,Math.max(0,Math.round((g-ve(a.display).left)/ic(a.display))-d)));return b}function sb(a,b){if(b>=a.display.viewTo)return null;
b-=a.display.viewFrom;if(0>b)return null;a=a.display.view;for(var e=0;e<a.length;e++)if(b-=a[e].size,0>b)return e}function kc(a){a.display.input.showSelection(a.display.input.prepareSelection())}function Ie(a,b){void 0===b&&(b=!0);for(var e=a.doc,c={},d=c.cursors=document.createDocumentFragment(),h=c.selection=document.createDocumentFragment(),g=0;g<e.sel.ranges.length;g++)if(b||g!=e.sel.primIndex){var w=e.sel.ranges[g];if(!(w.from().line>=a.display.viewTo||w.to().line<a.display.viewFrom)){var k=
w.empty();(k||a.options.showCursorWhenSelecting)&&Je(a,w.head,d);k||rg(a,w,h)}}return c}function Je(b,e,c){e=Ra(b,e,"div",null,null,!b.options.singleCursorHeightPerLine);var d=c.appendChild(a("div","\u00a0","CodeMirror-cursor"));d.style.left=e.left+"px";d.style.top=e.top+"px";d.style.height=Math.max(0,e.bottom-e.top)*b.options.cursorHeight+"px";e.other&&(b=c.appendChild(a("div","\u00a0","CodeMirror-cursor CodeMirror-secondarycursor")),b.style.display="",b.style.left=e.other.left+"px",b.style.top=
e.other.top+"px",b.style.height=.85*(e.other.bottom-e.other.top)+"px")}function Yc(a,b){return a.top-b.top||a.left-b.left}function rg(b,e,c){function d(b,e,c,d){0>e&&(e=0);e=Math.round(e);d=Math.round(d);k.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+b+"px;\n                             top: "+e+"px; width: "+(null==c?n-b:c)+"px;\n                             height: "+(d-e)+"px"))}function h(a,e,c){function h(e,c){return Bd(b,I(a,e),"div",k,c)}function g(a,e,c){a=Ge(b,
k,null,a);e="ltr"==e==("after"==c)?"left":"right";c="after"==c?a.begin:a.end-(/\s/.test(k.text.charAt(a.end-1))?2:1);return h(c,e)[e]}var k=H(w,a),r=k.text.length,t,v,K=Da(k,w.direction);Nc(K,e||0,null==c?r:c,function(a,b,w,k){var A="ltr"==w,C=h(a,A?"left":"right"),p=h(b-1,A?"right":"left"),y=null==e&&0==a,q=null==c&&b==r,J=0==k;k=!K||k==K.length-1;3>=p.top-C.top?(b=(f?y:q)&&J?l:(A?C:p).left,d(b,C.top,((f?q:y)&&k?n:(A?p:C).right)-b,C.bottom)):(A?(A=f&&y&&J?l:C.left,y=f?n:g(a,w,"before"),a=f?l:g(b,
w,"after"),q=f&&q&&k?n:p.right):(A=f?g(a,w,"before"):l,y=!f&&y&&J?n:C.right,a=!f&&q&&k?l:p.left,q=f?g(b,w,"after"):n),d(A,C.top,y-A,C.bottom),C.bottom<p.top&&d(l,C.bottom,null,p.top),d(a,p.top,q-a,p.bottom));if(!t||0>Yc(C,t))t=C;0>Yc(p,t)&&(t=p);if(!v||0>Yc(C,v))v=C;0>Yc(p,v)&&(v=p)});return{start:t,end:v}}var g=b.display,w=b.doc,k=document.createDocumentFragment(),r=ve(b.display),l=r.left,n=Math.max(g.sizerWidth,rb(b)-g.sizer.offsetLeft)-r.right,f="ltr"==w.direction;g=e.from();e=e.to();if(g.line==
e.line)h(g.line,g.ch,e.ch);else{var t=H(w,g.line);r=H(w,e.line);r=Ha(t)==Ha(r);g=h(g.line,g.ch,r?t.text.length+1:null).end;e=h(e.line,r?0:null,e.ch).start;r&&(g.top<e.top-2?(d(g.right,g.top,null,g.bottom),d(l,e.top,e.left,e.bottom)):d(g.right,g.top,e.left-g.right,g.bottom));g.bottom<e.top&&d(l,g.bottom,null,e.top)}c.appendChild(k)}function Hd(a){if(a.state.focused){var b=a.display;clearInterval(b.blinker);var e=!0;b.cursorDiv.style.visibility="";0<a.options.cursorBlinkRate?b.blinker=setInterval(function(){return b.cursorDiv.style.visibility=
(e=!e)?"":"hidden"},a.options.cursorBlinkRate):0>a.options.cursorBlinkRate&&(b.cursorDiv.style.visibility="hidden")}}function Ke(a){a.state.focused||(a.display.input.focus(),Id(a))}function Le(a){a.state.delayingBlurEvent=!0;setTimeout(function(){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1,lc(a))},100)}function Id(a,b){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1);"nocursor"!=a.options.readOnly&&(a.state.focused||(fa(a,"focus",a,b),a.state.focused=!0,t(a.display.wrapper,"CodeMirror-focused"),
a.curOp||a.display.selForContextMenu==a.doc.sel||(a.display.input.reset(),ta&&setTimeout(function(){return a.display.input.reset(!0)},20)),a.display.input.receivedFocus()),Hd(a))}function lc(a,b){a.state.delayingBlurEvent||(a.state.focused&&(fa(a,"blur",a,b),a.state.focused=!1,xb(a.display.wrapper,"CodeMirror-focused")),clearInterval(a.display.blinker),setTimeout(function(){a.state.focused||(a.display.shift=!1)},150))}function Zc(a){a=a.display;for(var b=a.lineDiv.offsetTop,e=0;e<a.view.length;e++){var c=
a.view[e];if(!c.hidden){if(Z&&8>ea){var d=c.node.offsetTop+c.node.offsetHeight;var h=d-b;b=d}else h=c.node.getBoundingClientRect(),h=h.bottom-h.top;d=c.line.height-h;2>h&&(h=ub(a));if(.005<d||-.005>d)if(O(c.line,h),Me(c.line),c.rest)for(h=0;h<c.rest.length;h++)Me(c.rest[h])}}}function Me(a){if(a.widgets)for(var b=0;b<a.widgets.length;++b)a.widgets[b].height=a.widgets[b].node.parentNode.offsetHeight}function Jd(a,b,e){var c=e&&null!=e.top?Math.max(0,e.top):a.scroller.scrollTop;c=Math.floor(c-a.lineSpace.offsetTop);
var d=e&&null!=e.bottom?e.bottom:c+a.wrapper.clientHeight;c=U(b,c);d=U(b,d);if(e&&e.ensure){var h=e.ensure.from.line;e=e.ensure.to.line;h<c?(c=h,d=U(b,Ia(H(b,h))+a.wrapper.clientHeight)):Math.min(e,b.lastLine())>=d&&(c=U(b,Ia(H(b,e))-a.wrapper.clientHeight),d=e)}return{from:c,to:Math.max(d,c+1)}}function Ne(a){var b=a.display,e=b.view;if(b.alignWidgets||b.gutters.firstChild&&a.options.fixedGutter){for(var c=Fd(b)-b.scroller.scrollLeft+a.doc.scrollLeft,d=b.gutters.offsetWidth,h=c+"px",g=0;g<e.length;g++)if(!e[g].hidden){a.options.fixedGutter&&
(e[g].gutter&&(e[g].gutter.style.left=h),e[g].gutterBackground&&(e[g].gutterBackground.style.left=h));var k=e[g].alignable;if(k)for(var w=0;w<k.length;w++)k[w].style.left=h}a.options.fixedGutter&&(b.gutters.style.left=c+d+"px")}}function Oe(b){if(!b.options.lineNumbers)return!1;var e=b.doc;e=aa(b.options,e.first+e.size-1);var c=b.display;if(e.length!=c.lineNumChars){var d=c.measure.appendChild(a("div",[a("div",e)],"CodeMirror-linenumber CodeMirror-gutter-elt")),h=d.firstChild.offsetWidth;d=d.offsetWidth-
h;c.lineGutter.style.width="";c.lineNumInnerWidth=Math.max(h,c.lineGutter.offsetWidth-d)+1;c.lineNumWidth=c.lineNumInnerWidth+d;c.lineNumChars=c.lineNumInnerWidth?e.length:-1;c.lineGutter.style.width=c.lineNumWidth+"px";Kd(b);return!0}return!1}function Ld(a,b){var e=a.display,c=ub(a.display);0>b.top&&(b.top=0);var d=a.curOp&&null!=a.curOp.scrollTop?a.curOp.scrollTop:e.scroller.scrollTop,h=wd(a),g={};b.bottom-b.top>h&&(b.bottom=b.top+h);var k=a.doc.height+vd(e),w=b.top<c;c=b.bottom>k-c;b.top<d?g.scrollTop=
w?0:b.top:b.bottom>d+h&&(h=Math.min(b.top,(c?k:b.bottom)-h),h!=d&&(g.scrollTop=h));d=a.curOp&&null!=a.curOp.scrollLeft?a.curOp.scrollLeft:e.scroller.scrollLeft;a=rb(a)-(a.options.fixedGutter?e.gutters.offsetWidth:0);if(e=b.right-b.left>a)b.right=b.left+a;10>b.left?g.scrollLeft=0:b.left<d?g.scrollLeft=Math.max(0,b.left-(e?0:10)):b.right>a+d-3&&(g.scrollLeft=b.right+(e?0:10)-a);return g}function $c(a,b){null!=b&&(ad(a),a.curOp.scrollTop=(null==a.curOp.scrollTop?a.doc.scrollTop:a.curOp.scrollTop)+b)}
function Lb(a){ad(a);var b=a.getCursor();a.curOp.scrollToPos={from:b,to:b,margin:a.options.cursorScrollMargin}}function mc(a,b,e){null==b&&null==e||ad(a);null!=b&&(a.curOp.scrollLeft=b);null!=e&&(a.curOp.scrollTop=e)}function ad(a){var b=a.curOp.scrollToPos;if(b){a.curOp.scrollToPos=null;var e=Ee(a,b.from),c=Ee(a,b.to);Pe(a,e,c,b.margin)}}function Pe(a,b,e,c){b=Ld(a,{left:Math.min(b.left,e.left),top:Math.min(b.top,e.top)-c,right:Math.max(b.right,e.right),bottom:Math.max(b.bottom,e.bottom)+c});mc(a,
b.scrollLeft,b.scrollTop)}function nc(a,b){2>Math.abs(a.doc.scrollTop-b)||(gb||Md(a,{top:b}),Qe(a,b,!0),gb&&Md(a),oc(a,100))}function Qe(a,b,e){b=Math.min(a.display.scroller.scrollHeight-a.display.scroller.clientHeight,b);if(a.display.scroller.scrollTop!=b||e)a.doc.scrollTop=b,a.display.scrollbars.setScrollTop(b),a.display.scroller.scrollTop!=b&&(a.display.scroller.scrollTop=b)}function yb(a,b,e,c){b=Math.min(b,a.display.scroller.scrollWidth-a.display.scroller.clientWidth);(e?b==a.doc.scrollLeft:
2>Math.abs(a.doc.scrollLeft-b))&&!c||(a.doc.scrollLeft=b,Ne(a),a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft=b),a.display.scrollbars.setScrollLeft(b))}function pc(a){var b=a.display,e=b.gutters.offsetWidth,c=Math.round(a.doc.height+vd(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?e:0,docHeight:c,scrollHeight:c+
Xa(a)+b.barHeight,nativeBarWidth:b.nativeBarWidth,gutterWidth:e}}function Mb(a,b){b||(b=pc(a));var e=a.display.barWidth,c=a.display.barHeight;Re(a,b);for(b=0;4>b&&e!=a.display.barWidth||c!=a.display.barHeight;b++)e!=a.display.barWidth&&a.options.lineWrapping&&Zc(a),Re(a,pc(a)),e=a.display.barWidth,c=a.display.barHeight}function Re(a,b){var e=a.display,c=e.scrollbars.update(b);e.sizer.style.paddingRight=(e.barWidth=c.right)+"px";e.sizer.style.paddingBottom=(e.barHeight=c.bottom)+"px";e.heightForcer.style.borderBottom=
c.bottom+"px solid transparent";c.right&&c.bottom?(e.scrollbarFiller.style.display="block",e.scrollbarFiller.style.height=c.bottom+"px",e.scrollbarFiller.style.width=c.right+"px"):e.scrollbarFiller.style.display="";c.bottom&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(e.gutterFiller.style.display="block",e.gutterFiller.style.height=c.bottom+"px",e.gutterFiller.style.width=b.gutterWidth+"px"):e.gutterFiller.style.display=""}function Se(a){a.display.scrollbars&&(a.display.scrollbars.clear(),
a.display.scrollbars.addClass&&xb(a.display.wrapper,a.display.scrollbars.addClass));a.display.scrollbars=new Te[a.options.scrollbarStyle](function(b){a.display.wrapper.insertBefore(b,a.display.scrollbarFiller);V(b,"mousedown",function(){a.state.focused&&setTimeout(function(){return a.display.input.focus()},0)});b.setAttribute("cm-not-content","true")},function(b,e){"horizontal"==e?yb(a,b):nc(a,b)},a);a.display.scrollbars.addClass&&t(a.display.wrapper,a.display.scrollbars.addClass)}function zb(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:++sg};a=a.curOp;Kb?Kb.ops.push(a):a.ownsGroup=Kb={ops:[a],delayedCallbacks:[]}}function Ab(b){lg(b.curOp,function(b){for(var e=0;e<b.ops.length;e++)b.ops[e].cm.curOp=null;b=b.ops;for(e=0;e<b.length;e++){var c=b[e],d=c.cm,h=d.display,g=d.display;!g.scrollbarsClipped&&
g.scroller.offsetWidth&&(g.nativeBarWidth=g.scroller.offsetWidth-g.scroller.clientWidth,g.heightForcer.style.height=Xa(d)+"px",g.sizer.style.marginBottom=-g.nativeBarWidth+"px",g.sizer.style.borderRightWidth=Xa(d)+"px",g.scrollbarsClipped=!0);c.updateMaxLine&&ab(d);c.mustUpdate=c.viewChanged||c.forceUpdate||null!=c.scrollTop||c.scrollToPos&&(c.scrollToPos.from.line<h.viewFrom||c.scrollToPos.to.line>=h.viewTo)||h.maxLineChanged&&d.options.lineWrapping;c.update=c.mustUpdate&&new bd(d,c.mustUpdate&&
{top:c.scrollTop,ensure:c.scrollToPos},c.forceUpdate)}for(e=0;e<b.length;e++)c=b[e],c.updatedDisplay=c.mustUpdate&&Nd(c.cm,c.update);for(e=0;e<b.length;e++)if(c=b[e],d=c.cm,h=d.display,c.updatedDisplay&&Zc(d),c.barMeasure=pc(d),h.maxLineChanged&&!d.options.lineWrapping&&(g=h.maxLine.text.length,g=Qa(d,tb(d,h.maxLine),g,void 0),c.adjustWidthTo=g.left+3,d.display.sizerWidth=c.adjustWidthTo,c.barMeasure.scrollWidth=Math.max(h.scroller.clientWidth,h.sizer.offsetLeft+c.adjustWidthTo+Xa(d)+d.display.barWidth),
c.maxScrollLeft=Math.max(0,h.sizer.offsetLeft+c.adjustWidthTo-rb(d))),c.updatedDisplay||c.selectionChanged)c.preparedSelection=h.input.prepareSelection();for(e=0;e<b.length;e++)c=b[e],d=c.cm,null!=c.adjustWidthTo&&(d.display.sizer.style.minWidth=c.adjustWidthTo+"px",c.maxScrollLeft<d.doc.scrollLeft&&yb(d,Math.min(d.display.scroller.scrollLeft,c.maxScrollLeft),!0),d.display.maxLineChanged=!1),h=c.focus&&c.focus==v(),c.preparedSelection&&d.display.input.showSelection(c.preparedSelection,h),(c.updatedDisplay||
c.startHeight!=d.doc.height)&&Mb(d,c.barMeasure),c.updatedDisplay&&Od(d,c.barMeasure),c.selectionChanged&&Hd(d),d.state.focused&&c.updateInput&&d.display.input.reset(c.typing),h&&Ke(c.cm);for(e=0;e<b.length;e++){var k=void 0;c=b[e];d=c.cm;h=d.display;g=d.doc;c.updatedDisplay&&Ue(d,c.update);null==h.wheelStartX||null==c.scrollTop&&null==c.scrollLeft&&!c.scrollToPos||(h.wheelStartX=h.wheelStartY=null);null!=c.scrollTop&&Qe(d,c.scrollTop,c.forceScroll);null!=c.scrollLeft&&yb(d,c.scrollLeft,!0,!0);if(c.scrollToPos){var w=
S(g,c.scrollToPos.from),r=S(g,c.scrollToPos.to),l=c.scrollToPos.margin;null==l&&(l=0);d.options.lineWrapping||w!=r||(w=w.ch?I(w.line,"before"==w.sticky?w.ch-1:w.ch,"after"):w,r="before"==w.sticky?I(w.line,w.ch+1,"before"):w);for(var n=0;5>n;n++){var f=!1;k=Ra(d,w);var t=r&&r!=w?Ra(d,r):k;k={left:Math.min(k.left,t.left),top:Math.min(k.top,t.top)-l,right:Math.max(k.left,t.left),bottom:Math.max(k.bottom,t.bottom)+l};t=Ld(d,k);var A=d.doc.scrollTop,K=d.doc.scrollLeft;null!=t.scrollTop&&(nc(d,t.scrollTop),
1<Math.abs(d.doc.scrollTop-A)&&(f=!0));null!=t.scrollLeft&&(yb(d,t.scrollLeft),1<Math.abs(d.doc.scrollLeft-K)&&(f=!0));if(!f)break}r=k;ka(d,"scrollCursorIntoView")||(l=d.display,n=l.sizer.getBoundingClientRect(),w=null,0>r.top+n.top?w=!0:r.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(w=!1),null==w||tg||(r=a("div","\u200b",null,"position: absolute;\n                         top: "+(r.top-l.viewOffset-d.display.lineSpace.offsetTop)+"px;\n                         height: "+
(r.bottom-r.top+Xa(d)+l.barHeight)+"px;\n                         left: "+r.left+"px; width: "+Math.max(2,r.right-r.left)+"px;"),d.display.lineSpace.appendChild(r),r.scrollIntoView(w),d.display.lineSpace.removeChild(r)))}r=c.maybeHiddenMarkers;w=c.maybeUnhiddenMarkers;if(r)for(l=0;l<r.length;++l)r[l].lines.length||fa(r[l],"hide");if(w)for(r=0;r<w.length;++r)w[r].lines.length&&fa(w[r],"unhide");h.wrapper.offsetHeight&&(g.scrollTop=d.display.scroller.scrollTop);c.changeObjs&&fa(d,"changes",d,c.changeObjs);
c.update&&c.update.finish()}})}function Fa(a,b){if(a.curOp)return b();zb(a);try{return b()}finally{Ab(a)}}function pa(a,b){return function(){if(a.curOp)return b.apply(a,arguments);zb(a);try{return b.apply(a,arguments)}finally{Ab(a)}}}function va(a){return function(){if(this.curOp)return a.apply(this,arguments);zb(this);try{return a.apply(this,arguments)}finally{Ab(this)}}}function qa(a){return function(){var b=this.cm;if(!b||b.curOp)return a.apply(this,arguments);zb(b);try{return a.apply(this,arguments)}finally{Ab(b)}}}
function za(a,b,e,c){null==b&&(b=a.doc.first);null==e&&(e=a.doc.first+a.doc.size);c||(c=0);var d=a.display;c&&e<d.viewTo&&(null==d.updateLineNumbers||d.updateLineNumbers>b)&&(d.updateLineNumbers=b);a.curOp.viewChanged=!0;if(b>=d.viewTo)hb&&Xb(a.doc,b)<d.viewTo&&kb(a);else if(e<=d.viewFrom)hb&&Mc(a.doc,e+c)>d.viewFrom?kb(a):(d.viewFrom+=c,d.viewTo+=c);else if(b<=d.viewFrom&&e>=d.viewTo)kb(a);else if(b<=d.viewFrom){var h=cd(a,e,e+c,1);h?(d.view=d.view.slice(h.index),d.viewFrom=h.lineN,d.viewTo+=c):
kb(a)}else if(e>=d.viewTo)(h=cd(a,b,b,-1))?(d.view=d.view.slice(0,h.index),d.viewTo=h.lineN):kb(a);else{h=cd(a,b,b,-1);var g=cd(a,e,e+c,1);h&&g?(d.view=d.view.slice(0,h.index).concat(Uc(a,h.lineN,g.lineN)).concat(d.view.slice(g.index)),d.viewTo+=c):kb(a)}if(a=d.externalMeasured)e<a.lineN?a.lineN+=c:b<a.lineN+a.size&&(d.externalMeasured=null)}function lb(a,e,c){a.curOp.viewChanged=!0;var d=a.display,h=a.display.externalMeasured;h&&e>=h.lineN&&e<h.lineN+h.size&&(d.externalMeasured=null);e<d.viewFrom||
e>=d.viewTo||(a=d.view[sb(a,e)],null!=a.node&&(a=a.changes||(a.changes=[]),-1==b(a,c)&&a.push(c)))}function kb(a){a.display.viewFrom=a.display.viewTo=a.doc.first;a.display.view=[];a.display.viewOffset=0}function cd(a,b,e,c){var d=sb(a,b),h=a.display.view;if(!hb||e==a.doc.first+a.doc.size)return{index:d,lineN:e};for(var g=a.display.viewFrom,k=0;k<d;k++)g+=h[k].size;if(g!=b){if(0<c){if(d==h.length-1)return null;b=g+h[d].size-b;d++}else b=g-b;e+=b}for(;Xb(a.doc,e)!=e;){if(d==(0>c?0:h.length-1))return null;
e+=c*h[d-(0>c?1:0)].size;d+=c}return{index:d,lineN:e}}function Ve(a){a=a.display.view;for(var b=0,e=0;e<a.length;e++){var c=a[e];c.hidden||c.node&&!c.changes||++b}return b}function oc(a,b){a.doc.highlightFrontier<a.display.viewTo&&a.state.highlight.set(b,k(ug,a))}function ug(a){var b=a.doc;if(!(b.highlightFrontier>=a.display.viewTo)){var e=+new Date+a.options.workTime,c=Va(a,b.highlightFrontier),d=[];b.iter(c.line,Math.min(b.first+b.size,a.display.viewTo+500),function(h){if(c.line>=a.display.viewFrom){var g=
h.styles,k=h.text.length>a.options.maxHighlightLength?Pa(b.mode,c.state):null,w=Sc(a,h,c,!0);k&&(c.state=k);h.styles=w.styles;k=h.styleClasses;(w=w.classes)?h.styleClasses=w:k&&(h.styleClasses=null);w=!g||g.length!=h.styles.length||k!=w&&(!k||!w||k.bgClass!=w.bgClass||k.textClass!=w.textClass);for(k=0;!w&&k<g.length;++k)w=g[k]!=h.styles[k];w&&d.push(c.line);h.stateAfter=c.save()}else h.text.length<=a.options.maxHighlightLength&&cc(a,h.text,c),h.stateAfter=0==c.line%5?c.save():null;c.nextLine();if(+new Date>
e)return oc(a,a.options.workDelay),!0});b.highlightFrontier=c.line;b.modeFrontier=Math.max(b.modeFrontier,c.line);d.length&&Fa(a,function(){for(var b=0;b<d.length;b++)lb(a,d[b],"text")})}}function Nd(a,b){var e=a.display,c=a.doc;if(b.editorIsHidden)return kb(a),!1;if(!b.force&&b.visible.from>=e.viewFrom&&b.visible.to<=e.viewTo&&(null==e.updateLineNumbers||e.updateLineNumbers>=e.viewTo)&&e.renderedView==e.view&&0==Ve(a))return!1;Oe(a)&&(kb(a),b.dims=yd(a));var d=c.first+c.size,h=Math.max(b.visible.from-
a.options.viewportMargin,c.first),g=Math.min(d,b.visible.to+a.options.viewportMargin);e.viewFrom<h&&20>h-e.viewFrom&&(h=Math.max(c.first,e.viewFrom));e.viewTo>g&&20>e.viewTo-g&&(g=Math.min(d,e.viewTo));hb&&(h=Xb(a.doc,h),g=Mc(a.doc,g));c=h!=e.viewFrom||g!=e.viewTo||e.lastWrapHeight!=b.wrapperHeight||e.lastWrapWidth!=b.wrapperWidth;d=a.display;0==d.view.length||h>=d.viewTo||g<=d.viewFrom?(d.view=Uc(a,h,g),d.viewFrom=h):(d.viewFrom>h?d.view=Uc(a,h,d.viewFrom).concat(d.view):d.viewFrom<h&&(d.view=d.view.slice(sb(a,
h))),d.viewFrom=h,d.viewTo<g?d.view=d.view.concat(Uc(a,d.viewTo,g)):d.viewTo>g&&(d.view=d.view.slice(0,sb(a,g))));d.viewTo=g;e.viewOffset=Ia(H(a.doc,e.viewFrom));a.display.mover.style.top=e.viewOffset+"px";g=Ve(a);if(!c&&0==g&&!b.force&&e.renderedView==e.view&&(null==e.updateLineNumbers||e.updateLineNumbers>=e.viewTo))return!1;a.hasFocus()?h=null:(h=v())&&n(a.display.lineDiv,h)?(h={activeElt:h},window.getSelection&&(d=window.getSelection(),d.anchorNode&&d.extend&&n(a.display.lineDiv,d.anchorNode)&&
(h.anchorNode=d.anchorNode,h.anchorOffset=d.anchorOffset,h.focusNode=d.focusNode,h.focusOffset=d.focusOffset))):h=null;4<g&&(e.lineDiv.style.display="none");vg(a,e.updateLineNumbers,b.dims);4<g&&(e.lineDiv.style.display="");e.renderedView=e.view;(g=h)&&g.activeElt&&g.activeElt!=v()&&(g.activeElt.focus(),g.anchorNode&&n(document.body,g.anchorNode)&&n(document.body,g.focusNode)&&(h=window.getSelection(),d=document.createRange(),d.setEnd(g.anchorNode,g.anchorOffset),d.collapse(!1),h.removeAllRanges(),
h.addRange(d),h.extend(g.focusNode,g.focusOffset)));f(e.cursorDiv);f(e.selectionDiv);e.gutters.style.height=e.sizer.style.minHeight=0;c&&(e.lastWrapHeight=b.wrapperHeight,e.lastWrapWidth=b.wrapperWidth,oc(a,400));e.updateLineNumbers=null;return!0}function Ue(a,b){for(var e=b.viewport,c=!0;;c=!1){if(!c||!a.options.lineWrapping||b.oldDisplayWidth==rb(a))if(e&&null!=e.top&&(e={top:Math.min(a.doc.height+vd(a.display)-wd(a),e.top)}),b.visible=Jd(a.display,a.doc,e),b.visible.from>=a.display.viewFrom&&b.visible.to<=
a.display.viewTo)break;if(!Nd(a,b))break;Zc(a);c=pc(a);kc(a);Mb(a,c);Od(a,c);b.force=!1}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 Md(a,b){b=new bd(a,b);if(Nd(a,b)){Zc(a);Ue(a,b);var e=pc(a);kc(a);Mb(a,e);Od(a,e);b.finish()}}function vg(a,e,c){function d(b){var e=
b.nextSibling;ta&&Na&&a.display.currentWheelTarget==b?b.style.display="none":b.parentNode.removeChild(b);return e}var h=a.display,g=a.options.lineNumbers,k=h.lineDiv,w=k.firstChild,r=h.view;h=h.viewFrom;for(var l=0;l<r.length;l++){var n=r[l];if(!n.hidden)if(n.node&&n.node.parentNode==k){for(;w!=n.node;)w=d(w);w=g&&null!=e&&e<=h&&n.lineNumber;n.changes&&(-1<b(n.changes,"gutter")&&(w=!1),qe(a,n,h,c));w&&(f(n.lineNumber),n.lineNumber.appendChild(document.createTextNode(aa(a.options,h))));w=n.node.nextSibling}else{var t=
ng(a,n,h,c);k.insertBefore(t,w)}h+=n.size}for(;w;)w=d(w)}function Kd(a){a.display.sizer.style.marginLeft=a.display.gutters.offsetWidth+"px"}function Od(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+Xa(a)+"px"}function We(b){var e=b.display.gutters,c=b.options.gutters;f(e);for(var d=0;d<c.length;++d){var h=c[d],g=e.appendChild(a("div",null,"CodeMirror-gutter "+h));"CodeMirror-linenumbers"==
h&&(b.display.lineGutter=g,g.style.width=(b.display.lineNumWidth||1)+"px")}e.style.display=d?"":"none";Kd(b)}function Pd(a){var e=b(a.gutters,"CodeMirror-linenumbers");-1==e&&a.lineNumbers?a.gutters=a.gutters.concat(["CodeMirror-linenumbers"]):-1<e&&!a.lineNumbers&&(a.gutters=a.gutters.slice(0),a.gutters.splice(e,1))}function Xe(a){var b=a.wheelDeltaX,e=a.wheelDeltaY;null==b&&a.detail&&a.axis==a.HORIZONTAL_AXIS&&(b=a.detail);null==e&&a.detail&&a.axis==a.VERTICAL_AXIS?e=a.detail:null==e&&(e=a.wheelDelta);
return{x:b,y:e}}function wg(a){a=Xe(a);a.x*=Ja;a.y*=Ja;return a}function Ye(a,b){var e=Xe(b),c=e.x;e=e.y;var d=a.display,h=d.scroller,g=h.scrollWidth>h.clientWidth,k=h.scrollHeight>h.clientHeight;if(c&&g||e&&k){if(e&&Na&&ta){g=b.target;var w=d.view;a:for(;g!=h;g=g.parentNode)for(var r=0;r<w.length;r++)if(w[r].node==g){a.display.currentWheelTarget=g;break a}}!c||gb||Sa||null==Ja?(e&&null!=Ja&&(b=e*Ja,k=a.doc.scrollTop,g=k+d.wrapper.clientHeight,0>b?k=Math.max(0,k+b-50):g=Math.min(a.doc.height,g+b+
50),Md(a,{top:k,bottom:g})),20>dd&&(null==d.wheelStartX?(d.wheelStartX=h.scrollLeft,d.wheelStartY=h.scrollTop,d.wheelDX=c,d.wheelDY=e,setTimeout(function(){if(null!=d.wheelStartX){var a=h.scrollLeft-d.wheelStartX,b=h.scrollTop-d.wheelStartY;a=b&&d.wheelDY&&b/d.wheelDY||a&&d.wheelDX&&a/d.wheelDX;d.wheelStartX=d.wheelStartY=null;a&&(Ja=(Ja*dd+a)/(dd+1),++dd)}},200)):(d.wheelDX+=c,d.wheelDY+=e))):(e&&k&&nc(a,Math.max(0,h.scrollTop+e*Ja)),yb(a,Math.max(0,h.scrollLeft+c*Ja)),(!e||e&&k)&&oa(b),d.wheelStartX=
null)}}function Ta(a,e){e=a[e];a.sort(function(a,b){return T(a.from(),b.from())});e=b(a,e);for(var c=1;c<a.length;c++){var d=a[c],h=a[c-1];if(0<=T(h.to(),d.from())){var g=X(h.from(),d.from()),k=ia(h.to(),d.to());d=h.empty()?d.from()==d.head:h.from()==h.head;c<=e&&--e;a.splice(--c,2,new ba(d?k:g,d?g:k))}}return new Ka(a,e)}function db(a,b){return new Ka([new ba(a,b||a)],0)}function mb(a){return a.text?I(a.from.line+a.text.length-1,A(a.text).length+(1==a.text.length?a.from.ch:0)):a.to}function Ze(a,
b){if(0>T(a,b.from))return a;if(0>=T(a,b.to))return mb(b);var e=a.line+b.text.length-(b.to.line-b.from.line)-1,c=a.ch;a.line==b.to.line&&(c+=mb(b).ch-b.to.ch);return I(e,c)}function Qd(a,b){for(var e=[],c=0;c<a.sel.ranges.length;c++){var d=a.sel.ranges[c];e.push(new ba(Ze(d.anchor,b),Ze(d.head,b)))}return Ta(e,a.sel.primIndex)}function $e(a,b,e){return a.line==b.line?I(e.line,a.ch-b.ch+e.ch):I(e.line+(a.line-b.line),a.ch)}function Rd(a){a.doc.mode=Oa(a.options,a.doc.modeOption);qc(a)}function qc(a){a.doc.iter(function(a){a.stateAfter&&
(a.stateAfter=null);a.styles&&(a.styles=null)});a.doc.modeFrontier=a.doc.highlightFrontier=a.doc.first;oc(a,100);a.state.modeGen++;a.curOp&&za(a)}function af(a,b){return 0==b.from.ch&&0==b.to.ch&&""==A(b.text)&&(!a.cm||a.cm.options.wholeLineUpdateBefore)}function Sd(a,b,e,c){function d(a,e,d){a.text=e;a.stateAfter&&(a.stateAfter=null);a.styles&&(a.styles=null);null!=a.order&&(a.order=null);Fb(a);Ba(a,d);e=c?c(a):1;e!=a.height&&O(a,e);ra(a,"change",a,b)}function h(a,b){for(var d=[];a<b;++a)d.push(new Nb(r[a],
e?e[a]:null,c));return d}var g=b.from,k=b.to,r=b.text,w=H(a,g.line),l=H(a,k.line),n=A(r),f=e?e[r.length-1]:null,t=k.line-g.line;b.full?(a.insert(0,h(0,r.length)),a.remove(r.length,a.size-r.length)):af(a,b)?(k=h(0,r.length-1),d(l,l.text,f),t&&a.remove(g.line,t),k.length&&a.insert(g.line,k)):w==l?1==r.length?d(w,w.text.slice(0,g.ch)+n+w.text.slice(k.ch),f):(t=h(1,r.length-1),t.push(new Nb(n+w.text.slice(k.ch),f,c)),d(w,w.text.slice(0,g.ch)+r[0],e?e[0]:null),a.insert(g.line+1,t)):1==r.length?(d(w,w.text.slice(0,
g.ch)+r[0]+l.text.slice(k.ch),e?e[0]:null),a.remove(g.line+1,t)):(d(w,w.text.slice(0,g.ch)+r[0],e?e[0]:null),d(l,n+l.text.slice(k.ch),f),f=h(1,r.length-1),1<t&&a.remove(g.line+1,t-1),a.insert(g.line+1,f));ra(a,"change",a,b)}function Bb(a,b,e){function c(a,d,h){if(a.linked)for(var g=0;g<a.linked.length;++g){var k=a.linked[g];if(k.doc!=d){var r=h&&k.sharedHist;if(!e||r)b(k.doc,r),c(k.doc,a,r)}}}c(a,null,!0)}function bf(a,b){if(b.cm)throw Error("This document is already in use.");a.doc=b;b.cm=a;Gd(a);
Rd(a);cf(a);a.options.lineWrapping||ab(a);a.options.mode=b.modeOption;za(a)}function cf(a){("rtl"==a.doc.direction?t:xb)(a.display.lineDiv,"CodeMirror-rtl")}function xg(a){Fa(a,function(){cf(a);za(a)})}function ed(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 Td(a,b){var e={from:L(b.from),to:mb(b),text:N(a,b.from,b.to)};df(a,e,b.from.line,
b.to.line+1);Bb(a,function(a){return df(a,e,b.from.line,b.to.line+1)},!0);return e}function ef(a){for(;a.length;)if(A(a).ranges)a.pop();else break}function ff(a,b,e,c){var d=a.history;d.undone.length=0;var h=+new Date,g;if(g=d.lastOp==c||d.lastOrigin==b.origin&&b.origin&&("+"==b.origin.charAt(0)&&a.cm&&d.lastModTime>h-a.cm.options.historyEventDelay||"*"==b.origin.charAt(0))){if(d.lastOp==c){ef(d.done);var k=A(d.done)}else d.done.length&&!A(d.done).ranges?k=A(d.done):1<d.done.length&&!d.done[d.done.length-
2].ranges?(d.done.pop(),k=A(d.done)):k=void 0;g=k}if(g){var r=A(k.changes);0==T(b.from,b.to)&&0==T(b.from,r.to)?r.to=mb(b):k.changes.push(Td(a,b))}else for((k=A(d.done))&&k.ranges||fd(a.sel,d.done),k={changes:[Td(a,b)],generation:d.generation},d.done.push(k);d.done.length>d.undoDepth;)d.done.shift(),d.done[0].ranges||d.done.shift();d.done.push(e);d.generation=++d.maxGeneration;d.lastModTime=d.lastSelTime=h;d.lastOp=d.lastSelOp=c;d.lastOrigin=d.lastSelOrigin=b.origin;r||fa(a,"historyAdded")}function fd(a,
b){var e=A(b);e&&e.ranges&&e.equals(a)||b.push(a)}function df(a,b,e,c){var d=b["spans_"+a.id],h=0;a.iter(Math.max(a.first,e),Math.min(a.first+a.size,c),function(e){e.markedSpans&&((d||(d=b["spans_"+a.id]={}))[h]=e.markedSpans);++h})}function yg(a){if(!a)return null;for(var b,e=0;e<a.length;++e)a[e].marker.explicitlyCleared?b||(b=a.slice(0,e)):b&&b.push(a[e]);return b?b.length?b:null:a}function gf(a,b){var e;if(e=b["spans_"+a.id]){for(var c=[],d=0;d<b.text.length;++d)c.push(yg(e[d]));e=c}else e=null;
a=fb(a,b);if(!e)return a;if(!a)return e;for(b=0;b<e.length;++b)if(c=e[b],d=a[b],c&&d){var h=0;a:for(;h<d.length;++h){for(var g=d[h],k=0;k<c.length;++k)if(c[k].marker==g.marker)continue a;c.push(g)}}else d&&(e[b]=d);return e}function Ob(a,e,c){for(var d=[],h=0;h<a.length;++h){var g=a[h];if(g.ranges)d.push(c?Ka.prototype.deepCopy.call(g):g);else{g=g.changes;var k=[];d.push({changes:k});for(var r=0;r<g.length;++r){var w=g[r],l;k.push({from:w.from,to:w.to,text:w.text});if(e)for(var n in w)(l=n.match(/^spans_(\d+)$/))&&
-1<b(e,Number(l[1]))&&(A(k)[n]=w[n],delete w[n])}}}return d}function Ud(a,b,e,c){return c?(a=a.anchor,e&&(c=0>T(b,a),c!=0>T(e,a)?(a=b,b=e):c!=0>T(b,e)&&(b=e)),new ba(a,b)):new ba(e||b,b)}function gd(a,b,e,c,d){null==d&&(d=a.cm&&(a.cm.display.shift||a.extend));sa(a,new Ka([Ud(a.sel.primary(),b,e,d)],0),c)}function hf(a,b,e){for(var c=[],d=a.cm&&(a.cm.display.shift||a.extend),h=0;h<a.sel.ranges.length;h++)c[h]=Ud(a.sel.ranges[h],b[h],null,d);b=Ta(c,a.sel.primIndex);sa(a,b,e)}function Vd(a,b,e,c){var d=
a.sel.ranges.slice(0);d[b]=e;sa(a,Ta(d,a.sel.primIndex),c)}function zg(a,b,e){e={ranges:b.ranges,update:function(b){this.ranges=[];for(var e=0;e<b.length;e++)this.ranges[e]=new ba(S(a,b[e].anchor),S(a,b[e].head))},origin:e&&e.origin};fa(a,"beforeSelectionChange",a,e);a.cm&&fa(a.cm,"beforeSelectionChange",a.cm,e);return e.ranges!=b.ranges?Ta(e.ranges,e.ranges.length-1):b}function jf(a,b,e){var c=a.history.done,d=A(c);d&&d.ranges?(c[c.length-1]=b,hd(a,b,e)):sa(a,b,e)}function sa(a,b,e){hd(a,b,e);b=
a.sel;var c=a.cm?a.cm.curOp.id:NaN,d=a.history,h=e&&e.origin,g;if(!(g=c==d.lastSelOp)&&(g=h&&d.lastSelOrigin==h)&&!(g=d.lastModTime==d.lastSelTime&&d.lastOrigin==h)){g=A(d.done);var k=h.charAt(0);g="*"==k||"+"==k&&g.ranges.length==b.ranges.length&&g.somethingSelected()==b.somethingSelected()&&new Date-a.history.lastSelTime<=(a.cm?a.cm.options.historyEventDelay:500)}g?d.done[d.done.length-1]=b:fd(b,d.done);d.lastSelTime=+new Date;d.lastSelOrigin=h;d.lastSelOp=c;e&&!1!==e.clearRedo&&ef(d.undone)}function hd(a,
b,e){if(Ea(a,"beforeSelectionChange")||a.cm&&Ea(a.cm,"beforeSelectionChange"))b=zg(a,b,e);var c=e&&e.bias||(0>T(b.primary().head,a.sel.primary().head)?-1:1);kf(a,lf(a,b,c,!0));e&&!1===e.scroll||!a.cm||Lb(a.cm)}function kf(a,b){b.equals(a.sel)||(a.sel=b,a.cm&&(a.cm.curOp.updateInput=a.cm.curOp.selectionChanged=!0,$b(a.cm)),ra(a,"cursorActivity",a))}function mf(a){kf(a,lf(a,a.sel,null,!1))}function lf(a,b,e,c){for(var d,h=0;h<b.ranges.length;h++){var g=b.ranges[h],k=b.ranges.length==a.sel.ranges.length&&
a.sel.ranges[h],r=Wd(a,g.anchor,k&&k.anchor,e,c);k=Wd(a,g.head,k&&k.head,e,c);if(d||r!=g.anchor||k!=g.head)d||(d=b.ranges.slice(0,h)),d[h]=new ba(r,k)}return d?Ta(d,b.primIndex):b}function Pb(a,b,e,c,d){var h=H(a,b.line);if(h.markedSpans)for(var g=0;g<h.markedSpans.length;++g){var k=h.markedSpans[g],r=k.marker;if((null==k.from||(r.inclusiveLeft?k.from<=b.ch:k.from<b.ch))&&(null==k.to||(r.inclusiveRight?k.to>=b.ch:k.to>b.ch))){if(d&&(fa(r,"beforeCursorEnter"),r.explicitlyCleared))if(h.markedSpans){--g;
continue}else break;if(r.atomic){if(e){g=r.find(0>c?1:-1);k=void 0;if(0>c?r.inclusiveRight:r.inclusiveLeft)g=nf(a,g,-c,g&&g.line==b.line?h:null);if(g&&g.line==b.line&&(k=T(g,e))&&(0>c?0>k:0<k))return Pb(a,g,b,c,d)}e=r.find(0>c?-1:1);if(0>c?r.inclusiveLeft:r.inclusiveRight)e=nf(a,e,c,e.line==b.line?h:null);return e?Pb(a,e,b,c,d):null}}}return b}function Wd(a,b,e,c,d){c=c||1;b=Pb(a,b,e,c,d)||!d&&Pb(a,b,e,c,!0)||Pb(a,b,e,-c,d)||!d&&Pb(a,b,e,-c,!0);return b?b:(a.cantEdit=!0,I(a.first,0))}function nf(a,
b,e,c){return 0>e&&0==b.ch?b.line>a.first?S(a,I(b.line-1)):null:0<e&&b.ch==(c||H(a,b.line)).text.length?b.line<a.first+a.size-1?I(b.line+1,0):null:new I(b.line,b.ch+e)}function of(a){a.setSelection(I(a.firstLine(),0),I(a.lastLine()),Ya)}function pf(a,b,e){var c={canceled:!1,from:b.from,to:b.to,text:b.text,origin:b.origin,cancel:function(){return c.canceled=!0}};e&&(c.update=function(b,e,d,h){b&&(c.from=S(a,b));e&&(c.to=S(a,e));d&&(c.text=d);void 0!==h&&(c.origin=h)});fa(a,"beforeChange",a,c);a.cm&&
fa(a.cm,"beforeChange",a.cm,c);return c.canceled?null:{from:c.from,to:c.to,text:c.text,origin:c.origin}}function Qb(a,b,e){if(a.cm){if(!a.cm.curOp)return pa(a.cm,Qb)(a,b,e);if(a.cm.state.suppressEdits)return}if(Ea(a,"beforeChange")||a.cm&&Ea(a.cm,"beforeChange"))if(b=pf(a,b,!0),!b)return;if(e=qf&&!e&&qd(a,b.from,b.to))for(var c=e.length-1;0<=c;--c)rf(a,{from:e[c].from,to:e[c].to,text:c?[""]:b.text,origin:b.origin});else rf(a,b)}function rf(a,e){if(1!=e.text.length||""!=e.text[0]||0!=T(e.from,e.to)){var c=
Qd(a,e);ff(a,e,c,a.cm?a.cm.curOp.id:NaN);rc(a,e,c,fb(a,e));var d=[];Bb(a,function(a,c){c||-1!=b(d,a.history)||(sf(a.history,e),d.push(a.history));rc(a,e,null,fb(a,e))})}}function id(a,e,c){if(!a.cm||!a.cm.state.suppressEdits||c){for(var d=a.history,h,g=a.sel,k="undo"==e?d.done:d.undone,r="undo"==e?d.undone:d.done,l=0;l<k.length&&(h=k[l],c?!h.ranges||h.equals(a.sel):h.ranges);l++);if(l!=k.length){for(d.lastOrigin=d.lastSelOrigin=null;;)if(h=k.pop(),h.ranges){fd(h,r);if(c&&!h.equals(a.sel)){sa(a,h,
{clearRedo:!1});return}g=h}else break;var n=[];fd(g,r);r.push({changes:n,generation:d.generation});d.generation=h.generation||++d.maxGeneration;var w=Ea(a,"beforeChange")||a.cm&&Ea(a.cm,"beforeChange");c=function(c){var d=h.changes[c];d.origin=e;if(w&&!pf(a,d,!1))return k.length=0,{};n.push(Td(a,d));var g=c?Qd(a,d):A(k);rc(a,d,g,gf(a,d));!c&&a.cm&&a.cm.scrollIntoView({from:d.from,to:mb(d)});var r=[];Bb(a,function(a,e){e||-1!=b(r,a.history)||(sf(a.history,d),r.push(a.history));rc(a,d,null,gf(a,d))})};
for(d=h.changes.length-1;0<=d;--d)if(g=c(d))return g.v}}}function tf(a,b){if(0!=b&&(a.first+=b,a.sel=new Ka(y(a.sel.ranges,function(a){return new ba(I(a.anchor.line+b,a.anchor.ch),I(a.head.line+b,a.head.ch))}),a.sel.primIndex),a.cm)){za(a.cm,a.first,a.first-b,b);for(var e=a.cm.display,c=e.viewFrom;c<e.viewTo;c++)lb(a.cm,c,"gutter")}}function rc(a,b,e,c){if(a.cm&&!a.cm.curOp)return pa(a.cm,rc)(a,b,e,c);if(b.to.line<a.first)tf(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 d=b.text.length-1-(a.first-b.from.line);tf(a,d);b={from:I(a.first,0),to:I(b.to.line+d,b.to.ch),text:[A(b.text)],origin:b.origin}}d=a.lastLine();b.to.line>d&&(b={from:b.from,to:I(d,H(a,d).text.length),text:[b.text[0]],origin:b.origin});b.removed=N(a,b.from,b.to);e||(e=Qd(a,b));a.cm?Ag(a.cm,b,c):Sd(a,b,c);hd(a,e,Ya)}}function Ag(a,b,e){var c=a.doc,d=a.display,h=b.from,g=b.to,k=!1,r=h.line;a.options.lineWrapping||(r=Q(Ha(H(c,h.line))),c.iter(r,g.line+1,function(a){if(a==d.maxLine)return k=
!0}));-1<c.sel.contains(b.from,b.to)&&$b(a);Sd(c,b,e,He(a));a.options.lineWrapping||(c.iter(r,h.line+b.text.length,function(a){var b=ya(a);b>d.maxLineLength&&(d.maxLine=a,d.maxLineLength=b,d.maxLineChanged=!0,k=!1)}),k&&(a.curOp.updateMaxLine=!0));fg(c,h.line);oc(a,400);e=b.text.length-(g.line-h.line)-1;b.full?za(a):h.line!=g.line||1!=b.text.length||af(a.doc,b)?za(a,h.line,g.line+1,e):lb(a,h.line,"text");e=Ea(a,"changes");if((c=Ea(a,"change"))||e)b={from:h,to:g,text:b.text,removed:b.removed,origin:b.origin},
c&&ra(a,"change",a,b),e&&(a.curOp.changeObjs||(a.curOp.changeObjs=[])).push(b);a.display.selForContextMenu=null}function Rb(a,b,e,c,d){c||(c=e);if(0>T(c,e)){var h=[c,e];e=h[0];c=h[1];h}"string"==typeof b&&(b=a.splitLines(b));Qb(a,{from:e,to:c,text:b,origin:d})}function uf(a,b,e,c){e<a.line?a.line+=c:b<a.line&&(a.line=b,a.ch=0)}function vf(a,b,e,c){for(var d=0;d<a.length;++d){var h=a[d],g=!0;if(h.ranges)for(h.copied||(h=a[d]=h.deepCopy(),h.copied=!0),g=0;g<h.ranges.length;g++)uf(h.ranges[g].anchor,
b,e,c),uf(h.ranges[g].head,b,e,c);else{for(var k=0;k<h.changes.length;++k){var r=h.changes[k];if(e<r.from.line)r.from=I(r.from.line+c,r.from.ch),r.to=I(r.to.line+c,r.to.ch);else if(b<=r.to.line){g=!1;break}}g||(a.splice(0,d+1),d=0)}}}function sf(a,b){var e=b.from.line,c=b.to.line;b=b.text.length-(c-e)-1;vf(a.done,e,c,b);vf(a.undone,e,c,b)}function sc(a,b,e,c){var d=b,h=b;"number"==typeof b?h=H(a,Math.max(a.first,Math.min(b,a.first+a.size-1))):d=Q(b);if(null==d)return null;c(h,d)&&a.cm&&lb(a.cm,d,
e);return h}function tc(a){this.lines=a;this.parent=null;for(var b=0,e=0;e<a.length;++e)a[e].parent=this,b+=a[e].height;this.height=b}function uc(a){this.children=a;for(var b=0,e=0,c=0;c<a.length;++c){var d=a[c];b+=d.chunkSize();e+=d.height;d.parent=this}this.size=b;this.height=e;this.parent=null}function Bg(a,b,e,c){var d=new vc(a,e,c),h=a.cm;h&&d.noHScroll&&(h.display.alignWidgets=!0);sc(a,b,"widget",function(b){var e=b.widgets||(b.widgets=[]);null==d.insertAt?e.push(d):e.splice(Math.min(e.length-
1,Math.max(0,d.insertAt)),0,d);d.line=b;h&&!$a(a,b)&&(e=Ia(b)<a.scrollTop,O(b,b.height+hc(d)),e&&$c(h,d.height),h.curOp.forceUpdate=!0);return!0});ra(h,"lineWidgetAdded",h,d,"number"==typeof b?b:Q(b));return d}function Sb(a,b,e,d,h){if(d&&d.shared)return Cg(a,b,e,d,h);if(a.cm&&!a.cm.curOp)return pa(a.cm,Sb)(a,b,e,d,h);var k=new nb(a,h);h=T(b,e);d&&g(d,k,!1);if(0<h||0==h&&!1!==k.clearWhenEmpty)return k;k.replacedWith&&(k.collapsed=!0,k.widgetNode=c("span",[k.replacedWith],"CodeMirror-widget"),d.handleMouseEvents||
k.widgetNode.setAttribute("cm-ignore-events","true"),d.insertLeft&&(k.widgetNode.insertLeft=!0));if(k.collapsed){if(Gb(a,b.line,b,e,k)||b.line!=e.line&&Gb(a,e.line,b,e,k))throw Error("Inserting collapsed marker partially overlapping an existing one");hb=!0}k.addToHistory&&ff(a,{from:b,to:e,origin:"markText"},a.sel,NaN);var r=b.line,l=a.cm,n;a.iter(r,e.line+1,function(a){l&&k.collapsed&&!l.options.lineWrapping&&Ha(a)==l.display.maxLine&&(n=!0);k.collapsed&&r!=b.line&&O(a,0);var c=new Ca(k,r==b.line?
b.ch:null,r==e.line?e.ch:null);a.markedSpans=a.markedSpans?a.markedSpans.concat([c]):[c];c.marker.attachLine(a);++r});k.collapsed&&a.iter(b.line,e.line+1,function(b){$a(a,b)&&O(b,0)});k.clearOnEnter&&V(k,"beforeCursorEnter",function(){return k.clear()});k.readOnly&&(qf=!0,(a.history.done.length||a.history.undone.length)&&a.clearHistory());k.collapsed&&(k.id=++wf,k.atomic=!0);if(l){n&&(l.curOp.updateMaxLine=!0);if(k.collapsed)za(l,b.line,e.line+1);else if(k.className||k.title||k.startStyle||k.endStyle||
k.css)for(d=b.line;d<=e.line;d++)lb(l,d,"text");k.atomic&&mf(l.doc);ra(l,"markerAdded",l,k)}return k}function Cg(a,b,e,c,d){c=g(c);c.shared=!1;var h=[Sb(a,b,e,c,d)],k=h[0],r=c.widgetNode;Bb(a,function(a){r&&(c.widgetNode=r.cloneNode(!0));h.push(Sb(a,S(a,b),S(a,e),c,d));for(var g=0;g<a.linked.length;++g)if(a.linked[g].isParent)return;k=A(h)});return new wc(h,k)}function xf(a){return a.findMarks(I(a.first,0),a.clipPos(I(a.lastLine())),function(a){return a.parent})}function Dg(a){for(var e=function(e){e=
a[e];var c=[e.primary.doc];Bb(e.primary.doc,function(a){return c.push(a)});for(var d=0;d<e.markers.length;d++){var h=e.markers[d];-1==b(c,h.doc)&&(h.parent=null,e.markers.splice(d--,1))}},c=0;c<a.length;c++)e(c)}function Eg(a){var e=this;yf(e);if(!ka(e,a)&&!cb(e.display,a)){oa(a);Z&&(zf=+new Date);var c=wb(e,a,!0),d=a.dataTransfer.files;if(c&&!e.isReadOnly())if(d&&d.length&&window.FileReader&&window.File)for(var h=d.length,g=Array(h),k=0,r=function(a,d){if(!e.options.allowDropFileTypes||-1!=b(e.options.allowDropFileTypes,
a.type)){var r=new FileReader;r.onload=pa(e,function(){var a=r.result;/[\x00-\x08\x0e-\x1f]{2}/.test(a)&&(a="");g[d]=a;++k==h&&(c=S(e.doc,c),a={from:c,to:c,text:e.doc.splitLines(g.join(e.doc.lineSeparator())),origin:"paste"},Qb(e.doc,a),jf(e.doc,db(c,mb(a))))});r.readAsText(a)}},l=0;l<h;++l)r(d[l],l);else if(e.state.draggingText&&-1<e.doc.sel.contains(c))e.state.draggingText(a),setTimeout(function(){return e.display.input.focus()},20);else try{if(r=a.dataTransfer.getData("Text")){e.state.draggingText&&
!e.state.draggingText.copy&&(l=e.listSelections());hd(e.doc,db(c,c));if(l)for(d=0;d<l.length;++d)Rb(e.doc,"",l[d].anchor,l[d].head,"drag");e.replaceSelection(r,"around","paste");e.display.input.focus()}}catch(lh){}}}function yf(a){a.display.dragCursor&&(a.display.lineSpace.removeChild(a.display.dragCursor),a.display.dragCursor=null)}function Af(a){if(document.getElementsByClassName)for(var b=document.getElementsByClassName("CodeMirror"),e=0;e<b.length;e++){var c=b[e].CodeMirror;c&&a(c)}}function Fg(){var a;
V(window,"resize",function(){null==a&&(a=setTimeout(function(){a=null;Af(Gg)},100))});V(window,"blur",function(){return Af(lc)})}function Gg(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 Hg(a){var b=a.split(/-(?!$)/);a=b[b.length-1];for(var e,c,d,h,g=0;g<b.length-1;g++){var k=b[g];if(/^(cmd|meta|m)$/i.test(k))h=!0;else if(/^a(lt)?$/i.test(k))e=
!0;else if(/^(c|ctrl|control)$/i.test(k))c=!0;else if(/^s(hift)?$/i.test(k))d=!0;else throw Error("Unrecognized modifier name: "+k);}e&&(a="Alt-"+a);c&&(a="Ctrl-"+a);h&&(a="Cmd-"+a);d&&(a="Shift-"+a);return a}function Ig(a){var b={},e;for(e in a)if(a.hasOwnProperty(e)){var c=a[e];if(!/^(name|fallthrough|(de|at)tach)$/.test(e)){if("..."!=c)for(var d=y(e.split(" "),Hg),h=0;h<d.length;h++){if(h==d.length-1){var g=d.join(" ");var k=c}else g=d.slice(0,h+1).join(" "),k="...";var r=b[g];if(!r)b[g]=k;else if(r!=
k)throw Error("Inconsistent bindings for "+g);}delete a[e]}}for(var l in b)a[l]=b[l];return a}function Tb(a,b,e,c){b=jd(b);var d=b.call?b.call(a,c):b[a];if(!1===d)return"nothing";if("..."===d)return"multi";if(null!=d&&e(d))return"handled";if(b.fallthrough){if("[object Array]"!=Object.prototype.toString.call(b.fallthrough))return Tb(a,b.fallthrough,e,c);for(d=0;d<b.fallthrough.length;d++){var h=Tb(a,b.fallthrough[d],e,c);if(h)return h}}}function Bf(a){a="string"==typeof a?a:ob[a.keyCode];return"Ctrl"==
a||"Alt"==a||"Shift"==a||"Mod"==a}function Cf(a,b,e){var c=a;b.altKey&&"Alt"!=c&&(a="Alt-"+a);(Df?b.metaKey:b.ctrlKey)&&"Ctrl"!=c&&(a="Ctrl-"+a);(Df?b.ctrlKey:b.metaKey)&&"Cmd"!=c&&(a="Cmd-"+a);!e&&b.shiftKey&&"Shift"!=c&&(a="Shift-"+a);return a}function Ef(a,b){if(Sa&&34==a.keyCode&&a["char"])return!1;var e=ob[a.keyCode];return null==e||a.altGraphKey?!1:Cf(e,a,b)}function jd(a){return"string"==typeof a?xc[a]:a}function Ub(a,b){for(var e=a.doc.sel.ranges,c=[],d=0;d<e.length;d++){for(var h=b(e[d]);c.length&&
0>=T(h.from,A(c).to);){var g=c.pop();if(0>T(g.from,h.from)){h.from=g.from;break}}c.push(h)}Fa(a,function(){for(var b=c.length-1;0<=b;b--)Rb(a.doc,"",c[b].from,c[b].to,"+delete");Lb(a)})}function Xd(a,b,e){b=B(a.text,b+e,e);return 0>b||b>a.text.length?null:b}function Yd(a,b,e){a=Xd(a,b.ch,e);return null==a?null:new I(b.line,a,0>e?"after":"before")}function Zd(a,b,e,c,d){if(a&&(a=Da(e,b.doc.direction))){a=0>d?A(a):a[0];var h=0>d==(1==a.level)?"after":"before";if(0<a.level||"rtl"==b.doc.direction){var g=
tb(b,e);var k=0>d?e.text.length-1:0;var r=Qa(b,g,k).top;k=F(function(a){return Qa(b,g,a).top==r},0>d==(1==a.level)?a.from:a.to-1,k);"before"==h&&(k=Xd(e,k,1))}else k=0>d?a.to:a.from;return new I(c,k,h)}return new I(c,0>d?e.text.length:0,0>d?"before":"after")}function Jg(a,b,e,c){var d=Da(b,a.doc.direction);if(!d)return Yd(b,e,c);e.ch>=b.text.length?(e.ch=b.text.length,e.sticky="before"):0>=e.ch&&(e.ch=0,e.sticky="after");var h=Ua(d,e.ch,e.sticky),g=d[h];if("ltr"==a.doc.direction&&0==g.level%2&&(0<
c?g.to>e.ch:g.from<e.ch))return Yd(b,e,c);var k=function(a,e){return Xd(b,a instanceof I?a.ch:a,e)},r,l=function(e){if(!a.options.lineWrapping)return{begin:0,end:b.text.length};r=r||tb(a,b);return Ge(a,b,r,e)},n=l("before"==e.sticky?k(e,-1):e.ch);if("rtl"==a.doc.direction||1==g.level){var t=1==g.level==0>c,f=k(e,t?1:-1);if(null!=f&&(t?f<=g.to&&f<=n.end:f>=g.from&&f>=n.begin))return new I(e.line,f,t?"before":"after")}g=function(a,b,c){for(var h=function(a,b){return b?new I(e.line,k(a,1),"before"):
new I(e.line,a,"after")};0<=a&&a<d.length;a+=b){var g=d[a],r=0<b==(1!=g.level),l=r?c.begin:k(c.end,-1);if(g.from<=l&&l<g.to)return h(l,r);l=r?g.from:k(g.to,-1);if(c.begin<=l&&l<c.end)return h(l,r)}};if(h=g(h+c,c,n))return h;n=0<c?n.end:k(n.begin,-1);return null==n||0<c&&n==b.text.length||!(h=g(0<c?0:d.length-1,c,l(n)))?null:h}function Ff(a,b){var e=H(a.doc,b),c=Ha(e);c!=e&&(b=Q(c));return Zd(!0,a,c,b,1)}function Gf(a,b){var e=Ff(a,b.line),c=H(a.doc,e.line);a=Da(c,a.doc.direction);return a&&0!=a[0].level?
e:(c=Math.max(0,c.text.search(/\S/)),I(e.line,b.line==e.line&&b.ch<=c&&b.ch?0:c,e.sticky))}function kd(a,b,e){if("string"==typeof b&&(b=yc[b],!b))return!1;a.display.input.ensurePolled();var c=a.display.shift,d=!1;try{a.isReadOnly()&&(a.state.suppressEdits=!0),e&&(a.display.shift=!1),d=b(a)!=ld}finally{a.display.shift=c,a.state.suppressEdits=!1}return d}function Kg(a,b,e){for(var c=0;c<a.state.keyMaps.length;c++){var d=Tb(b,a.state.keyMaps[c],e,a);if(d)return d}return a.options.extraKeys&&Tb(b,a.options.extraKeys,
e,a)||Tb(b,a.options.keyMap,e,a)}function zc(a,b,e,c){var d=a.state.keySeq;if(d){if(Bf(b))return"handled";Lg.set(50,function(){a.state.keySeq==d&&(a.state.keySeq=null,a.display.input.reset())});b=d+" "+b}c=Kg(a,b,c);"multi"==c&&(a.state.keySeq=b);"handled"==c&&ra(a,"keyHandled",a,b,e);if("handled"==c||"multi"==c)oa(e),Hd(a);return d&&!c&&/\'$/.test(b)?(oa(e),!0):!!c}function Hf(a,b){var e=Ef(b,!0);return e?b.shiftKey&&!a.state.keySeq?zc(a,"Shift-"+e,b,function(b){return kd(a,b,!0)})||zc(a,e,b,function(b){if("string"==
typeof b?/^go[A-Z]/.test(b):b.motion)return kd(a,b)}):zc(a,e,b,function(b){return kd(a,b)}):!1}function Mg(a,b,e){return zc(a,"'"+e+"'",b,function(b){return kd(a,b,!0)})}function If(a){this.curOp.focus=v();if(!ka(this,a)){Z&&11>ea&&27==a.keyCode&&(a.returnValue=!1);var b=a.keyCode;this.display.shift=16==b||a.shiftKey;var e=Hf(this,a);Sa&&($d=e?b:null,!e&&88==b&&!Ng&&(Na?a.metaKey:a.ctrlKey)&&this.replaceSelection("",null,"cut"));18!=b||/\bCodeMirror-crosshair\b/.test(this.display.lineDiv.className)||
Og(this)}}function Og(a){function b(a){18!=a.keyCode&&a.altKey||(xb(e,"CodeMirror-crosshair"),ja(document,"keyup",b),ja(document,"mouseover",b))}var e=a.display.lineDiv;t(e,"CodeMirror-crosshair");V(document,"keyup",b);V(document,"mouseover",b)}function Jf(a){16==a.keyCode&&(this.doc.sel.shift=!1);ka(this,a)}function Kf(a){if(!(cb(this.display,a)||ka(this,a)||a.ctrlKey&&!a.altKey||Na&&a.metaKey)){var b=a.keyCode,e=a.charCode;if(Sa&&b==$d)$d=null,oa(a);else if(!Sa||a.which&&!(10>a.which)||!Hf(this,
a))if(b=String.fromCharCode(null==e?b:e),"\b"!=b&&!Mg(this,a,b))this.display.input.onKeyPress(a)}}function Pg(a,b){var e=+new Date;if(Ac&&Ac.compare(e,a,b))return Bc=Ac=null,"triple";if(Bc&&Bc.compare(e,a,b))return Ac=new ae(e,a,b),Bc=null,"double";Bc=new ae(e,a,b);Ac=null;return"single"}function Lf(a){var b=this.display;if(!(ka(this,a)||b.activeTouch&&b.input.supportsTouch()))if(b.input.ensurePolled(),b.shift=a.shiftKey,cb(b,a))ta||(b.scroller.draggable=!1,setTimeout(function(){return b.scroller.draggable=
!0},100));else if(!md(this,a,"gutterClick",!0)){var e=wb(this,a),c=ac(a),d=e?Pg(e,c):"single";window.focus();1==c&&this.state.selectingText&&this.state.selectingText(a);e&&Qg(this,c,e,d,a)||(1==c?e?Rg(this,e,d,a):(a.target||a.srcElement)==b.scroller&&oa(a):2==c?(e&&gd(this.doc,e),setTimeout(function(){return b.input.focus()},20)):3==c&&(be?Mf(this,a):Le(this)))}}function Qg(a,b,e,c,d){var h="Click";"double"==c?h="Double"+h:"triple"==c&&(h="Triple"+h);return zc(a,Cf((1==b?"Left":2==b?"Middle":"Right")+
h,d),d,function(b){"string"==typeof b&&(b=yc[b]);if(!b)return!1;var c=!1;try{a.isReadOnly()&&(a.state.suppressEdits=!0),c=b(a,e)!=ld}finally{a.state.suppressEdits=!1}return c})}function Rg(a,b,e,c){Z?setTimeout(k(Ke,a),0):a.curOp.focus=v();var d=a.getOption("configureMouse");d=d?d(a,e,c):{};null==d.unit&&(d.unit=(Sg?c.shiftKey&&c.metaKey:c.altKey)?"rectangle":"single"==e?"char":"double"==e?"word":"line");if(null==d.extend||a.doc.extend)d.extend=a.doc.extend||c.shiftKey;null==d.addNew&&(d.addNew=Na?
c.metaKey:c.ctrlKey);null==d.moveOnDrag&&(d.moveOnDrag=!(Na?c.altKey:c.ctrlKey));var h=a.doc.sel,g;a.options.dragDrop&&Tg&&!a.isReadOnly()&&"single"==e&&-1<(g=h.contains(b))&&(0>T((g=h.ranges[g]).from(),b)||0<b.xRel)&&(0<T(g.to(),b)||0>b.xRel)?Ug(a,c,b,d):Vg(a,c,b,d)}function Ug(a,b,e,c){var d=a.display,h=!1,g=pa(a,function(b){ta&&(d.scroller.draggable=!1);a.state.draggingText=!1;ja(document,"mouseup",g);ja(document,"mousemove",k);ja(d.scroller,"dragstart",r);ja(d.scroller,"drop",g);h||(oa(b),c.addNew||
gd(a.doc,e,null,null,c.extend),ta||Z&&9==ea?setTimeout(function(){document.body.focus();d.input.focus()},20):d.input.focus())}),k=function(a){h=h||10<=Math.abs(b.clientX-a.clientX)+Math.abs(b.clientY-a.clientY)},r=function(){return h=!0};ta&&(d.scroller.draggable=!0);a.state.draggingText=g;g.copy=!c.moveOnDrag;d.scroller.dragDrop&&d.scroller.dragDrop();V(document,"mouseup",g);V(document,"mousemove",k);V(d.scroller,"dragstart",r);V(d.scroller,"drop",g);Le(a);setTimeout(function(){return d.input.focus()},
20)}function Nf(a,b,e){if("char"==e)return new ba(b,b);if("word"==e)return a.findWordAt(b);if("line"==e)return new ba(I(b.line,0),S(a.doc,I(b.line+1,0)));a=e(a,b);return new ba(a.from,a.to)}function Vg(a,b,c,d){function g(b){if(0!=T(C,b))if(C=b,"rectangle"==d.unit){var g=[],k=a.options.tabSize,r=e(H(n,c.line).text,c.ch,k),l=e(H(n,b.line).text,b.ch,k),t=Math.min(r,l);r=Math.max(r,l);l=Math.min(c.line,b.line);for(var v=Math.min(a.lastLine(),Math.max(c.line,b.line));l<=v;l++){var p=H(n,l).text,y=h(p,
t,k);t==r?g.push(new ba(I(l,y),I(l,y))):p.length>y&&g.push(new ba(I(l,y),I(l,h(p,r,k))))}g.length||g.push(new ba(c,c));sa(n,Ta(f.ranges.slice(0,w).concat(g),w),{origin:"*mouse",scroll:!1});a.scrollIntoView(b)}else g=A,t=Nf(a,b,d.unit),b=g.anchor,0<T(t.anchor,b)?(k=t.head,b=X(g.from(),t.anchor)):(k=t.anchor,b=ia(g.to(),t.head)),g=f.ranges.slice(0),g[w]=Wg(a,new ba(S(n,b),k)),sa(n,Ta(g,w),ce)}function k(b){var e=++y,c=wb(a,b,!0,"rectangle"==d.unit);if(c)if(0!=T(c,C)){a.curOp.focus=v();g(c);var h=Jd(l,
n);(c.line>=h.to||c.line<h.from)&&setTimeout(pa(a,function(){y==e&&k(b)}),150)}else{var r=b.clientY<p.top?-20:b.clientY>p.bottom?20:0;r&&setTimeout(pa(a,function(){y==e&&(l.scroller.scrollTop+=r,k(b))}),50)}}function r(b){a.state.selectingText=!1;y=Infinity;oa(b);l.input.focus();ja(document,"mousemove",q);ja(document,"mouseup",J);n.history.lastSelOrigin=null}var l=a.display,n=a.doc;oa(b);var f=n.sel,t=f.ranges;if(d.addNew&&!d.extend){var w=n.sel.contains(c);var A=-1<w?t[w]:new ba(c,c)}else A=n.sel.primary(),
w=n.sel.primIndex;"rectangle"==d.unit?(d.addNew||(A=new ba(c,c)),c=wb(a,b,!0,!0),w=-1):(b=Nf(a,c,d.unit),A=d.extend?Ud(A,b.anchor,b.head,d.extend):b);d.addNew?-1==w?(w=t.length,sa(n,Ta(t.concat([A]),w),{scroll:!1,origin:"*mouse"})):1<t.length&&t[w].empty()&&"char"==d.unit&&!d.extend?(sa(n,Ta(t.slice(0,w).concat(t.slice(w+1)),0),{scroll:!1,origin:"*mouse"}),f=n.sel):Vd(n,w,A,ce):(w=0,sa(n,new Ka([A],0),ce),f=n.sel);var C=c,p=l.wrapper.getBoundingClientRect(),y=0,q=pa(a,function(a){ac(a)?k(a):r(a)}),
J=pa(a,r);a.state.selectingText=J;V(document,"mousemove",q);V(document,"mouseup",J)}function Wg(a,b){var e=b.anchor,c=b.head,d=H(a.doc,e.line);if(0==T(e,c)&&e.sticky==c.sticky)return b;d=Da(d);if(!d)return b;var h=Ua(d,e.ch,e.sticky),g=d[h];if(g.from!=e.ch&&g.to!=e.ch)return b;var k=h+(g.from==e.ch==(1!=g.level)?0:1);if(0==k||k==d.length)return b;c.line!=e.line?a=0<(c.line-e.line)*("ltr"==a.doc.direction?1:-1):(a=Ua(d,c.ch,c.sticky),h=a-h||(c.ch-e.ch)*(1==g.level?-1:1),a=a==k-1||a==k?0>h:0<h);d=d[k+
(a?-1:0)];d=(k=a==(1==d.level))?d.from:d.to;k=k?"after":"before";return e.ch==d&&e.sticky==k?b:new ba(new I(e.line,d,k),c)}function md(a,b,e,c){if(b.touches){var d=b.touches[0].clientX;var h=b.touches[0].clientY}else try{d=b.clientX,h=b.clientY}catch(he){return!1}if(d>=Math.floor(a.display.gutters.getBoundingClientRect().right))return!1;c&&oa(b);c=a.display;var g=c.lineDiv.getBoundingClientRect();if(h>g.bottom||!Ea(a,e))return pb(b);h-=g.top-c.viewOffset;for(g=0;g<a.options.gutters.length;++g){var k=
c.gutters.childNodes[g];if(k&&k.getBoundingClientRect().right>=d)return d=U(a.doc,h),fa(a,e,a,d,a.options.gutters[g],b),pb(b)}}function Mf(a,b){var e;(e=cb(a.display,b))||(e=Ea(a,"gutterContextMenu")?md(a,b,"gutterContextMenu",!1):!1);if(!e&&!ka(a,b,"contextmenu"))a.display.input.onContextMenu(b)}function Of(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g," cm-s-");jc(a)}function Cc(a){We(a);za(a);Ne(a)}function Xg(a,b,e){!b!=
!(e&&e!=Vb)&&(e=a.display.dragFunctions,b=b?V:ja,b(a.display.scroller,"dragstart",e.start),b(a.display.scroller,"dragenter",e.enter),b(a.display.scroller,"dragover",e.over),b(a.display.scroller,"dragleave",e.leave),b(a.display.scroller,"drop",e.drop))}function Yg(a){a.options.lineWrapping?(t(a.display.wrapper,"CodeMirror-wrap"),a.display.sizer.style.minWidth="",a.display.sizerWidth=null):(xb(a.display.wrapper,"CodeMirror-wrap"),ab(a));Gd(a);za(a);jc(a);setTimeout(function(){return Mb(a)},100)}function ha(a,
b){var e=this;if(!(this instanceof ha))return new ha(a,b);this.options=b=b?g(b):{};g(Pf,b,!1);Pd(b);var c=b.value;"string"==typeof c&&(c=new Aa(c,b.mode,null,b.lineSeparator,b.direction));this.doc=c;var d=new ha.inputStyles[b.inputStyle](this);a=this.display=new P(a,c,d);a.wrapper.CodeMirror=this;We(this);Of(this);b.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");Se(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 Cb,keySeq:null,specialChars:null};b.autofocus&&!Yb&&a.input.focus();Z&&11>ea&&setTimeout(function(){return e.display.input.reset(!0)},20);Zg(this);Qf||(Fg(),Qf=!0);zb(this);this.curOp.forceUpdate=!0;bf(this,c);b.autofocus&&!Yb||this.hasFocus()?setTimeout(k(Id,this),20):lc(this);for(var h in nd)if(nd.hasOwnProperty(h))nd[h](e,b[h],Vb);Oe(this);b.finishInit&&b.finishInit(this);for(c=0;c<de.length;++c)de[c](e);Ab(this);ta&&
b.lineWrapping&&"optimizelegibility"==getComputedStyle(a.lineDiv).textRendering&&(a.lineDiv.style.textRendering="auto")}function Zg(b){function e(){d.activeTouch&&(h=setTimeout(function(){return d.activeTouch=null},1E3),g=d.activeTouch,g.end=+new Date)}function c(a,b){if(null==b.left)return!0;var e=b.left-a.left;a=b.top-a.top;return 400<e*e+a*a}var d=b.display;V(d.scroller,"mousedown",pa(b,Lf));Z&&11>ea?V(d.scroller,"dblclick",pa(b,function(a){if(!ka(b,a)){var e=wb(b,a);!e||md(b,a,"gutterClick",!0)||
cb(b.display,a)||(oa(a),a=b.findWordAt(e),gd(b.doc,a.anchor,a.head))}})):V(d.scroller,"dblclick",function(a){return ka(b,a)||oa(a)});be||V(d.scroller,"contextmenu",function(a){return Mf(b,a)});var h,g={end:0};V(d.scroller,"touchstart",function(a){var e;if(e=!ka(b,a))1!=a.touches.length?e=!1:(e=a.touches[0],e=1>=e.radiusX&&1>=e.radiusY),e=!e;e&&!md(b,a,"gutterClick",!0)&&(d.input.ensurePolled(),clearTimeout(h),e=+new Date,d.activeTouch={start:e,moved:!1,prev:300>=e-g.end?g:null},1==a.touches.length&&
(d.activeTouch.left=a.touches[0].pageX,d.activeTouch.top=a.touches[0].pageY))});V(d.scroller,"touchmove",function(){d.activeTouch&&(d.activeTouch.moved=!0)});V(d.scroller,"touchend",function(a){var h=d.activeTouch;if(h&&!cb(d,a)&&null!=h.left&&!h.moved&&300>new Date-h.start){var g=b.coordsChar(d.activeTouch,"page");h=!h.prev||c(h,h.prev)?new ba(g,g):!h.prev.prev||c(h,h.prev.prev)?b.findWordAt(g):new ba(I(g.line,0),S(b.doc,I(g.line+1,0)));b.setSelection(h.anchor,h.head);b.focus();oa(a)}e()});V(d.scroller,
"touchcancel",e);V(d.scroller,"scroll",function(){d.scroller.clientHeight&&(nc(b,d.scroller.scrollTop),yb(b,d.scroller.scrollLeft,!0),fa(b,"scroll",b))});V(d.scroller,"mousewheel",function(a){return Ye(b,a)});V(d.scroller,"DOMMouseScroll",function(a){return Ye(b,a)});V(d.wrapper,"scroll",function(){return d.wrapper.scrollTop=d.wrapper.scrollLeft=0});d.dragFunctions={enter:function(a){ka(b,a)||qb(a)},over:function(e){if(!ka(b,e)){var c=wb(b,e);if(c){var d=document.createDocumentFragment();Je(b,c,d);
b.display.dragCursor||(b.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),b.display.lineSpace.insertBefore(b.display.dragCursor,b.display.cursorDiv));q(b.display.dragCursor,d)}qb(e)}},start:function(e){if(Z&&(!b.state.draggingText||100>+new Date-zf))qb(e);else if(!ka(b,e)&&!cb(b.display,e)&&(e.dataTransfer.setData("Text",b.getSelection()),e.dataTransfer.effectAllowed="copyMove",e.dataTransfer.setDragImage&&!Rf)){var c=a("img",null,null,"position: fixed; left: 0; top: 0;");
c.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";Sa&&(c.width=c.height=1,b.display.wrapper.appendChild(c),c._top=c.offsetTop);e.dataTransfer.setDragImage(c,0,0);Sa&&c.parentNode.removeChild(c)}},drop:pa(b,Eg),leave:function(a){ka(b,a)||yf(b)}};var k=d.input.getField();V(k,"keyup",function(a){return Jf.call(b,a)});V(k,"keydown",pa(b,If));V(k,"keypress",pa(b,Kf));V(k,"focus",function(a){return Id(b,a)});V(k,"blur",function(a){return lc(b,a)})}function Dc(a,b,c,d){var h=
a.doc,g;null==c&&(c="add");"smart"==c&&(h.mode.indent?g=Va(a,b).state:c="prev");var k=a.options.tabSize,l=H(h,b),n=e(l.text,null,k);l.stateAfter&&(l.stateAfter=null);var t=l.text.match(/^\s*/)[0];if(!d&&!/\S/.test(l.text)){var f=0;c="not"}else if("smart"==c&&(f=h.mode.indent(g,l.text.slice(t.length),l.text),f==ld||150<f)){if(!d)return;c="prev"}"prev"==c?f=b>h.first?e(H(h,b-1).text,null,k):0:"add"==c?f=n+a.options.indentUnit:"subtract"==c?f=n-a.options.indentUnit:"number"==typeof c&&(f=n+c);f=Math.max(0,
f);c="";d=0;if(a.options.indentWithTabs)for(a=Math.floor(f/k);a;--a)d+=k,c+="\t";d<f&&(c+=r(f-d));if(c!=t)return Rb(h,c,I(b,0),I(b,t.length),"+input"),l.stateAfter=null,!0;for(k=0;k<h.sel.ranges.length;k++)if(l=h.sel.ranges[k],l.head.line==b&&l.head.ch<t.length){b=I(b,t.length);Vd(h,k,new ba(b,b));break}}function ee(a,b,e,c,d){var h=a.doc;a.display.shift=!1;c||(c=h.sel);var g=a.state.pasteIncoming||"paste"==d,k=fe(b),r=null;if(g&&1<c.ranges.length)if(Ga&&Ga.text.join("\n")==b){if(0==c.ranges.length%
Ga.text.length){r=[];for(var l=0;l<Ga.text.length;l++)r.push(h.splitLines(Ga.text[l]))}}else k.length==c.ranges.length&&a.options.pasteLinesPerSelection&&(r=y(k,function(a){return[a]}));for(l=c.ranges.length-1;0<=l;l--){var n=c.ranges[l];var t=n.from(),f=n.to();n.empty()&&(e&&0<e?t=I(t.line,t.ch-e):a.state.overwrite&&!g?f=I(f.line,Math.min(H(h,f.line).text.length,f.ch+A(k).length)):Ga&&Ga.lineWise&&Ga.text.join("\n")==b&&(t=f=I(t.line,0)));n=a.curOp.updateInput;t={from:t,to:f,text:r?r[l%r.length]:
k,origin:d||(g?"paste":a.state.cutIncoming?"cut":"+input")};Qb(a.doc,t);ra(a,"inputRead",a,t)}b&&!g&&Sf(a,b);Lb(a);a.curOp.updateInput=n;a.curOp.typing=!0;a.state.pasteIncoming=a.state.cutIncoming=!1}function Tf(a,b){var e=a.clipboardData&&a.clipboardData.getData("Text");if(e)return a.preventDefault(),b.isReadOnly()||b.options.disableInput||Fa(b,function(){return ee(b,e,0,null,"paste")}),!0}function Sf(a,b){if(a.options.electricChars&&a.options.smartIndent)for(var e=a.doc.sel,c=e.ranges.length-1;0<=
c;c--){var d=e.ranges[c];if(!(100<d.head.ch||c&&e.ranges[c-1].head.line==d.head.line)){var h=a.getModeAt(d.head),g=!1;if(h.electricChars)for(var k=0;k<h.electricChars.length;k++){if(-1<b.indexOf(h.electricChars.charAt(k))){g=Dc(a,d.head.line,"smart");break}}else h.electricInput&&h.electricInput.test(H(a.doc,d.head.line).text.slice(0,d.head.ch))&&(g=Dc(a,d.head.line,"smart"));g&&ra(a,"electricInput",a,d.head.line)}}}function Uf(a){for(var b=[],e=[],c=0;c<a.doc.sel.ranges.length;c++){var d=a.doc.sel.ranges[c].head.line;
d={anchor:I(d,0),head:I(d+1,0)};e.push(d);b.push(a.getRange(d.anchor,d.head))}return{text:b,ranges:e}}function Vf(a,b){a.setAttribute("autocorrect","off");a.setAttribute("autocapitalize","off");a.setAttribute("spellcheck",!!b)}function Wf(){var b=a("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),e=a("div",[b],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");ta?b.style.width="1000px":b.setAttribute("wrap","off");Ec&&
(b.style.border="1px solid black");Vf(b);return e}function ge(a,b,e,c,d){function h(c){var h=d?Jg(a.cm,r,b,e):Yd(r,b,e);if(null==h){if(c=!c)c=b.line+e,c<a.first||c>=a.first+a.size?c=!1:(b=new I(c,b.ch,b.sticky),c=r=H(a,c));if(c)b=Zd(d,a.cm,r,b.line,e);else return!1}else b=h;return!0}var g=b,k=e,r=H(a,b.line);if("char"==c)h();else if("column"==c)h(!0);else if("word"==c||"group"==c){var l=null;c="group"==c;for(var n=a.cm&&a.cm.getHelper(b,"wordChars"),t=!0;!(0>e)||h(!t);t=!1){var f=r.text.charAt(b.ch)||
"\n";f=G(f,n)?"w":c&&"\n"==f?"n":!c||/\s/.test(f)?null:"p";!c||t||f||(f="s");if(l&&l!=f){0>e&&(e=1,h(),b.sticky="after");break}f&&(l=f);if(0<e&&!h(!t))break}}k=Wd(a,b,g,k,!0);da(g,k)&&(k.hitSide=!0);return k}function Xf(a,b,e,c){var d=a.doc,h=b.left;if("page"==c){var g=Math.max(Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight)-.5*ub(a.display),3);g=(0<e?b.bottom:b.top)+e*g}else"line"==c&&(g=0<e?b.bottom+3:b.top-3);for(;;){b=Dd(a,h,g);if(!b.outside)break;
if(0>e?0>=g:g>=d.height){b.hitSide=!0;break}g+=5*e}return b}function Yf(a,b){var e=xd(a,b.line);if(!e||e.hidden)return null;var c=H(a.doc,b.line);e=we(e,c,b.line);a=Da(c,a.doc.direction);c="left";a&&(c=Ua(a,b.ch)%2?"right":"left");b=xe(e.map,b.ch,c);b.offset="right"==b.collapse?b.end:b.start;return b}function $g(a){for(;a;a=a.parentNode)if(/CodeMirror-gutter-wrapper/.test(a.className))return!0;return!1}function Wb(a,b){b&&(a.bad=!0);return a}function ah(a,b,e,c,d){function h(a){return function(b){return b.id==
a}}function g(a){a&&(l&&(r+=n,l=!1),r+=a)}function k(b){if(1==b.nodeType){var e=b.getAttribute("cm-text");if(null!=e)g(e||b.textContent.replace(/\u200b/g,""));else{e=b.getAttribute("cm-marker");var f;if(e)b=a.findMarks(I(c,0),I(d+1,0),h(+e)),b.length&&(f=b[0].find(0))&&g(N(a.doc,f.from,f.to).join(n));else if("false"!=b.getAttribute("contenteditable")){(f=/^(pre|div|p)$/i.test(b.nodeName))&&l&&(r+=n,l=!1);for(e=0;e<b.childNodes.length;e++)k(b.childNodes[e]);f&&(l=!0)}}}else 3==b.nodeType&&g(b.nodeValue)}
for(var r="",l=!1,n=a.doc.lineSeparator();;){k(b);if(b==e)break;b=b.nextSibling}return r}function od(a,b,e){if(b==a.display.lineDiv){var c=a.display.lineDiv.childNodes[e];if(!c)return Wb(a.clipPos(I(a.display.viewTo-1)),!0);b=null;e=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 d=0;d<a.display.view.length;d++){var h=a.display.view[d];if(h.node==c)return bh(h,b,e)}}function bh(a,b,e){function c(b,e,c){for(var d=
-1;d<(l?l.length:0);d++)for(var h=0>d?r.map:l[d],g=0;g<h.length;g+=3){var k=h[g+2];if(k==b||k==e){e=Q(0>d?a.line:a.rest[d]);d=h[g]+c;if(0>c||k!=b)d=h[g+(c?1:0)];return I(e,d)}}}var d=a.text.firstChild,h=!1;if(!b||!n(d,b))return Wb(I(Q(a.line),0),!0);if(b==d&&(h=!0,b=d.childNodes[e],e=0,!b))return e=a.rest?A(a.rest):a.line,Wb(I(Q(e),e.text.length),h);var g=3==b.nodeType?b:null,k=b;g||1!=b.childNodes.length||3!=b.firstChild.nodeType||(g=b.firstChild,e&&(e=g.nodeValue.length));for(;k.parentNode!=d;)k=
k.parentNode;var r=a.measure,l=r.maps;if(b=c(g,k,e))return Wb(b,h);d=k.nextSibling;for(g=g?g.nodeValue.length-e:0;d;d=d.nextSibling){if(b=c(d,d.firstChild,0))return Wb(I(b.line,b.ch-g),h);g+=d.textContent.length}for(k=k.previousSibling;k;k=k.previousSibling){if(b=c(k,k.firstChild,-1))return Wb(I(b.line,b.ch+e),h);e+=k.textContent.length}}var wa=navigator.userAgent,Zf=navigator.platform,gb=/gecko\/\d/i.test(wa),$f=/MSIE \d/.test(wa),ag=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(wa),Fc=/Edge\/(\d+)/.exec(wa),
Z=$f||ag||Fc,ea=Z&&($f?document.documentMode||6:+(Fc||ag)[1]),ta=!Fc&&/WebKit\//.test(wa),ch=ta&&/Qt\/\d+\.\d+/.test(wa),Vc=!Fc&&/Chrome\//.test(wa),Sa=/Opera\//.test(wa),Rf=/Apple Computer/.test(navigator.vendor),dh=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(wa),tg=/PhantomJS/.test(wa),Ec=!Fc&&/AppleWebKit/.test(wa)&&/Mobile\/\w+/.test(wa),Wc=/Android/.test(wa),Yb=Ec||Wc||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(wa),Na=Ec||/Mac/.test(Zf),Sg=/\bCrOS\b/.test(wa),eh=/win/i.test(Zf),Db=Sa&&wa.match(/Version\/(\d*\.\d*)/);
Db&&(Db=Number(Db[1]));Db&&15<=Db&&(Sa=!1,ta=!0);var Df=Na&&(ch||Sa&&(null==Db||12.11>Db)),be=gb||Z&&9<=ea,xb=function(a,b){var e=a.className;if(b=d(b).exec(e)){var c=e.slice(b.index+b[0].length);a.className=e.slice(0,b.index)+(c?b[1]+c:"")}};var ec=document.createRange?function(a,b,e,c){var d=document.createRange();d.setEnd(c||a,e);d.setStart(a,b);return d}:function(a,b,e){var c=document.body.createTextRange();try{c.moveToElementText(a.parentNode)}catch(jh){return c}c.collapse(!0);c.moveEnd("character",
e);c.moveStart("character",b);return c};var Gc=function(a){a.select()};Ec?Gc=function(a){a.selectionStart=0;a.selectionEnd=a.value.length}:Z&&(Gc=function(a){try{a.select()}catch(K){}});var Cb=function(){this.id=null};Cb.prototype.set=function(a,b){clearTimeout(this.id);this.id=setTimeout(b,a)};var ld={toString:function(){return"CodeMirror.Pass"}},Ya={scroll:!1},ce={origin:"*mouse"},Hc={origin:"+move"},Oc=[""],bg=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,
cg=/[\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]/,
qf=!1,hb=!1,Zb=null,dg=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,e){this.level=a;this.from=b;this.to=e}var e=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,c=/[stwN]/,d=/[LRr]/,h=/[Lb1n]/,g=/[1n]/;return function(k,r){var l="ltr"==r?"L":"R";if(0==k.length||"ltr"==r&&!e.test(k))return!1;for(var n=k.length,f=[],t=0;t<n;++t)f.push(a(k.charCodeAt(t)));t=0;for(var v=l;t<n;++t){var C=f[t];"m"==C?f[t]=v:v=C}t=0;for(v=l;t<n;++t)C=f[t],"1"==C&&"r"==v?f[t]="n":d.test(C)&&(v=C,"r"==C&&(f[t]="R"));
t=1;for(v=f[0];t<n-1;++t)C=f[t],"+"==C&&"1"==v&&"1"==f[t+1]?f[t]="1":","!=C||v!=f[t+1]||"1"!=v&&"n"!=v||(f[t]=v),v=C;for(t=0;t<n;++t)if(v=f[t],","==v)f[t]="N";else if("%"==v){for(v=t+1;v<n&&"%"==f[v];++v);for(C=t&&"!"==f[t-1]||v<n&&"1"==f[v]?"1":"N";t<v;++t)f[t]=C;t=v-1}t=0;for(v=l;t<n;++t)C=f[t],"L"==v&&"1"==C?f[t]="L":d.test(C)&&(v=C);for(v=0;v<n;++v)if(c.test(f[v])){for(t=v+1;t<n&&c.test(f[t]);++t);C="L"==(v?f[v-1]:l);for(C=C==("L"==(t<n?f[t]:l))?C?"L":"R":l;v<t;++v)f[v]=C;v=t-1}l=[];var p;for(t=
0;t<n;)if(h.test(f[t])){v=t;for(++t;t<n&&h.test(f[t]);++t);l.push(new b(0,v,t))}else{var y=t;v=l.length;for(++t;t<n&&"L"!=f[t];++t);for(C=y;C<t;)if(g.test(f[C])){y<C&&l.splice(v,0,new b(1,y,C));y=C;for(++C;C<t&&g.test(f[C]);++C);l.splice(v,0,new b(2,y,C));y=C}else++C;y<t&&l.splice(v,0,new b(1,y,t))}"ltr"==r&&(1==l[0].level&&(p=k.match(/^\s+/))&&(l[0].from=p[0].length,l.unshift(new b(0,0,p[0].length))),1==A(l).level&&(p=k.match(/\s+$/))&&(A(l).to-=p[0].length,l.push(new b(0,n-p[0].length,n))));return"rtl"==
r?l.reverse():l}}(),Pc=[],V=function(a,b,e){a.addEventListener?a.addEventListener(b,e,!1):a.attachEvent?a.attachEvent("on"+b,e):(a=a._handlers||(a._handlers={}),a[b]=(a[b]||Pc).concat(e))},Tg=function(){if(Z&&9>ea)return!1;var b=a("div");return"draggable"in b||"dragDrop"in b}(),rd,td,fe=3!="\n\nb".split(/\n/).length?function(a){for(var b=0,e=[],c=a.length;b<=c;){var d=a.indexOf("\n",b);-1==d&&(d=a.length);var h=a.slice(b,"\r"==a.charAt(d-1)?d-1:d),g=h.indexOf("\r");-1!=g?(e.push(h.slice(0,g)),b+=
g+1):(e.push(h),b=d+1)}return e}:function(a){return a.split(/\r\n?|\n/)},fh=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(K){return!1}}:function(a){try{var b=a.ownerDocument.selection.createRange()}catch(ih){}return b&&b.parentElement()==a?0!=b.compareEndPoints("StartToEnd",b):!1},Ng=function(){var b=a("div");if("oncopy"in b)return!0;b.setAttribute("oncopy","return;");return"function"==typeof b.oncopy}(),zd=null,sd={},Hb={},Ib={},la=function(a,b,e){this.pos=this.start=
0;this.string=a;this.tabSize=b||8;this.lineStart=this.lastColumnPos=this.lastColumnValue=0;this.lineOracle=e};la.prototype.eol=function(){return this.pos>=this.string.length};la.prototype.sol=function(){return this.pos==this.lineStart};la.prototype.peek=function(){return this.string.charAt(this.pos)||void 0};la.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)};la.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};la.prototype.eatWhile=function(a){for(var b=this.pos;this.eat(a););return this.pos>b};la.prototype.eatSpace=function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a};la.prototype.skipToEnd=function(){this.pos=this.string.length};la.prototype.skipTo=function(a){a=this.string.indexOf(a,this.pos);if(-1<a)return this.pos=a,!0};la.prototype.backUp=function(a){this.pos-=a};la.prototype.column=function(){this.lastColumnPos<
this.start&&(this.lastColumnValue=e(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start);return this.lastColumnValue-(this.lineStart?e(this.string,this.lineStart,this.tabSize):0)};la.prototype.indentation=function(){return e(this.string,null,this.tabSize)-(this.lineStart?e(this.string,this.lineStart,this.tabSize):0)};la.prototype.match=function(a,b,e){if("string"==typeof a){var c=function(a){return e?a.toLowerCase():a},d=this.string.substr(this.pos,
a.length);if(c(d)==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}};la.prototype.current=function(){return this.string.slice(this.start,this.pos)};la.prototype.hideFirstChars=function(a,b){this.lineStart+=a;try{return b()}finally{this.lineStart-=a}};la.prototype.lookAhead=function(a){var b=this.lineOracle;return b&&b.lookAhead(a)};la.prototype.baseToken=function(){var a=this.lineOracle;
return a&&a.baseToken(this.pos)};var Tc=function(a,b){this.state=a;this.lookAhead=b},Wa=function(a,b,e,c){this.state=b;this.doc=a;this.line=e;this.maxLookAhead=c||0;this.baseTokens=null;this.baseTokenPos=1};Wa.prototype.lookAhead=function(a){var b=this.doc.getLine(this.line+a);null!=b&&a>this.maxLookAhead&&(this.maxLookAhead=a);return b};Wa.prototype.baseToken=function(a){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=a;)this.baseTokenPos+=2;var b=this.baseTokens[this.baseTokenPos+
1];return{type:b&&b.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-a}};Wa.prototype.nextLine=function(){this.line++;0<this.maxLookAhead&&this.maxLookAhead--};Wa.fromSaved=function(a,b,e){return b instanceof Tc?new Wa(a,Pa(a.mode,b.state),e,b.lookAhead):new Wa(a,Pa(a.mode,b),e)};Wa.prototype.save=function(a){a=!1!==a?Pa(this.doc.mode,this.state):this.state;return 0<this.maxLookAhead?new Tc(a,this.maxLookAhead):a};var ke=function(a,b,e){this.start=a.start;this.end=a.pos;this.string=
a.current();this.type=b||null;this.state=e},Nb=function(a,b,e){this.text=a;Ba(this,b);this.height=e?e(this):1};Nb.prototype.lineNo=function(){return Q(this)};Ma(Nb);var hg={},gg={},Kb=null,fc=null,ye={left:0,right:0,top:0,bottom:0},vb,Eb=function(b,e,c){this.cm=c;var d=this.vert=a("div",[a("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),h=this.horiz=a("div",[a("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");b(d);b(h);V(d,"scroll",function(){d.clientHeight&&e(d.scrollTop,
"vertical")});V(h,"scroll",function(){h.clientWidth&&e(h.scrollLeft,"horizontal")});this.checkedZeroWidth=!1;Z&&8>ea&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Eb.prototype.update=function(a){var b=a.scrollWidth>a.clientWidth+1,e=a.scrollHeight>a.clientHeight+1,c=a.nativeBarWidth;e?(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=e?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-(e?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:e?c:0,bottom:b?c:0}};Eb.prototype.setScrollLeft=function(a){this.horiz.scrollLeft!=
a&&(this.horiz.scrollLeft=a);this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")};Eb.prototype.setScrollTop=function(a){this.vert.scrollTop!=a&&(this.vert.scrollTop=a);this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")};Eb.prototype.zeroWidthHack=function(){this.horiz.style.height=this.vert.style.width=Na&&!dh?"12px":"18px";this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none";this.disableHoriz=new Cb;this.disableVert=new Cb};Eb.prototype.enableZeroWidthBar=
function(a,b,e){function c(){var d=a.getBoundingClientRect();("vert"==e?document.elementFromPoint(d.right-1,(d.top+d.bottom)/2):document.elementFromPoint((d.right+d.left)/2,d.bottom-1))!=a?a.style.pointerEvents="none":b.set(1E3,c)}a.style.pointerEvents="auto";b.set(1E3,c)};Eb.prototype.clear=function(){var a=this.horiz.parentNode;a.removeChild(this.horiz);a.removeChild(this.vert)};var Ic=function(){};Ic.prototype.update=function(){return{bottom:0,right:0}};Ic.prototype.setScrollLeft=function(){};
Ic.prototype.setScrollTop=function(){};Ic.prototype.clear=function(){};var Te={"native":Eb,"null":Ic},sg=0,bd=function(a,b,e){var c=a.display;this.viewport=b;this.visible=Jd(c,a.doc,b);this.editorIsHidden=!c.wrapper.offsetWidth;this.wrapperHeight=c.wrapper.clientHeight;this.wrapperWidth=c.wrapper.clientWidth;this.oldDisplayWidth=rb(a);this.force=e;this.dims=yd(a);this.events=[]};bd.prototype.signal=function(a,b){Ea(a,b)&&this.events.push(arguments)};bd.prototype.finish=function(){for(var a=0;a<this.events.length;a++)fa.apply(null,
this.events[a])};var dd=0,Ja=null;Z?Ja=-.53:gb?Ja=15:Vc?Ja=-.7:Rf&&(Ja=-1/3);var Ka=function(a,b){this.ranges=a;this.primIndex=b};Ka.prototype.primary=function(){return this.ranges[this.primIndex]};Ka.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 e=this.ranges[b],c=a.ranges[b];if(!da(e.anchor,c.anchor)||!da(e.head,c.head))return!1}return!0};Ka.prototype.deepCopy=function(){for(var a=
[],b=0;b<this.ranges.length;b++)a[b]=new ba(L(this.ranges[b].anchor),L(this.ranges[b].head));return new Ka(a,this.primIndex)};Ka.prototype.somethingSelected=function(){for(var a=0;a<this.ranges.length;a++)if(!this.ranges[a].empty())return!0;return!1};Ka.prototype.contains=function(a,b){b||(b=a);for(var e=0;e<this.ranges.length;e++){var c=this.ranges[e];if(0<=T(b,c.from())&&0>=T(a,c.to()))return e}return-1};var ba=function(a,b){this.anchor=a;this.head=b};ba.prototype.from=function(){return X(this.anchor,
this.head)};ba.prototype.to=function(){return ia(this.anchor,this.head)};ba.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};tc.prototype={chunkSize:function(){return this.lines.length},removeInner:function(a,b){for(var e=a,c=a+b;e<c;++e){var d=this.lines[e];this.height-=d.height;var h=d;h.parent=null;Fb(h);ra(d,"delete")}this.lines.splice(a,b)},collapse:function(a){a.push.apply(a,this.lines)},insertInner:function(a,b,e){this.height+=e;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},iterN:function(a,b,e){for(b=a+b;a<b;++a)if(e(this.lines[a]))return!0}};uc.prototype={chunkSize:function(){return this.size},removeInner:function(a,b){this.size-=b;for(var e=0;e<this.children.length;++e){var c=this.children[e],d=c.chunkSize();if(a<d){var h=Math.min(b,d-a),g=c.height;c.removeInner(a,h);this.height-=g-c.height;d==h&&(this.children.splice(e--,1),c.parent=null);if(0==(b-=h))break;a=0}else a-=d}25>this.size-
b&&(1<this.children.length||!(this.children[0]instanceof tc))&&(a=[],this.collapse(a),this.children=[new tc(a)],this.children[0].parent=this)},collapse:function(a){for(var b=0;b<this.children.length;++b)this.children[b].collapse(a)},insertInner:function(a,b,e){this.size+=b.length;this.height+=e;for(var c=0;c<this.children.length;++c){var d=this.children[c],h=d.chunkSize();if(a<=h){d.insertInner(a,b,e);if(d.lines&&50<d.lines.length){for(b=a=d.lines.length%25+25;b<d.lines.length;)e=new tc(d.lines.slice(b,
b+=25)),d.height-=e.height,this.children.splice(++c,0,e),e.parent=this;d.lines=d.lines.slice(0,a);this.maybeSpill()}break}a-=h}},maybeSpill:function(){if(!(10>=this.children.length)){var a=this;do{var e=a.children.splice(a.children.length-5,5);e=new uc(e);if(a.parent){a.size-=e.size;a.height-=e.height;var c=b(a.parent.children,a);a.parent.children.splice(c+1,0,e)}else c=new uc(a.children),c.parent=a,a.children=[c,e],a=c;e.parent=a.parent}while(10<a.children.length);a.parent.maybeSpill()}},iterN:function(a,
b,e){for(var c=0;c<this.children.length;++c){var d=this.children[c],h=d.chunkSize();if(a<h){h=Math.min(b,h-a);if(d.iterN(a,h,e))return!0;if(0==(b-=h))break;a=0}else a-=h}}};var vc=function(a,b,e){if(e)for(var c in e)e.hasOwnProperty(c)&&(this[c]=e[c]);this.doc=a;this.node=b};vc.prototype.clear=function(){var a=this.doc.cm,b=this.line.widgets,e=this.line,c=Q(e);if(null!=c&&b){for(var d=0;d<b.length;++d)b[d]==this&&b.splice(d--,1);b.length||(e.widgets=null);var h=hc(this);O(e,Math.max(0,e.height-h));
a&&(Fa(a,function(){var b=-h;Ia(e)<(a.curOp&&a.curOp.scrollTop||a.doc.scrollTop)&&$c(a,b);lb(a,c,"widget")}),ra(a,"lineWidgetCleared",a,this,c))}};vc.prototype.changed=function(){var a=this,b=this.height,e=this.doc.cm,c=this.line;this.height=null;var d=hc(this)-b;d&&(O(c,c.height+d),e&&Fa(e,function(){e.curOp.forceUpdate=!0;Ia(c)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&$c(e,d);ra(e,"lineWidgetChanged",e,a,Q(c))}))};Ma(vc);var wf=0,nb=function(a,b){this.lines=[];this.type=b;this.doc=a;this.id=
++wf};nb.prototype.clear=function(){if(!this.explicitlyCleared){var a=this.doc.cm,b=a&&!a.curOp;b&&zb(a);if(Ea(this,"clear")){var e=this.find();e&&ra(this,"clear",e.from,e.to)}for(var c=e=null,d=0;d<this.lines.length;++d){var h=this.lines[d],g=na(h.markedSpans,this);a&&!this.collapsed?lb(a,Q(h),"text"):a&&(null!=g.to&&(c=Q(h)),null!=g.from&&(e=Q(h)));for(var k=h,r=void 0,l=h.markedSpans,n=g,t=0;t<l.length;++t)l[t]!=n&&(r||(r=[])).push(l[t]);k.markedSpans=r;null==g.from&&this.collapsed&&!$a(this.doc,
h)&&a&&O(h,ub(a.display))}if(a&&this.collapsed&&!a.options.lineWrapping)for(d=0;d<this.lines.length;++d)h=Ha(this.lines[d]),g=ya(h),g>a.display.maxLineLength&&(a.display.maxLine=h,a.display.maxLineLength=g,a.display.maxLineChanged=!0);null!=e&&a&&this.collapsed&&za(a,e,c+1);this.lines.length=0;this.explicitlyCleared=!0;this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,a&&mf(a.doc));a&&ra(a,"markerCleared",a,this,e,c);b&&Ab(a);this.parent&&this.parent.clear()}};nb.prototype.find=function(a,b){null==
a&&"bookmark"==this.type&&(a=1);for(var e,c,d=0;d<this.lines.length;++d){var h=this.lines[d],g=na(h.markedSpans,this);if(null!=g.from&&(e=I(b?h:Q(h),g.from),-1==a))return e;if(null!=g.to&&(c=I(b?h:Q(h),g.to),1==a))return c}return e&&{from:e,to:c}};nb.prototype.changed=function(){var a=this,b=this.find(-1,!0),e=this,c=this.doc.cm;b&&c&&Fa(c,function(){var d=b.line,h=Q(b.line);if(h=xd(c,h))ze(h),c.curOp.selectionChanged=c.curOp.forceUpdate=!0;c.curOp.updateMaxLine=!0;$a(e.doc,d)||null==e.height||(h=
e.height,e.height=null,(h=hc(e)-h)&&O(d,d.height+h));ra(c,"markerChanged",c,a)})};nb.prototype.attachLine=function(a){if(!this.lines.length&&this.doc.cm){var e=this.doc.cm.curOp;e.maybeHiddenMarkers&&-1!=b(e.maybeHiddenMarkers,this)||(e.maybeUnhiddenMarkers||(e.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(a)};nb.prototype.detachLine=function(a){this.lines.splice(b(this.lines,a),1);!this.lines.length&&this.doc.cm&&(a=this.doc.cm.curOp,(a.maybeHiddenMarkers||(a.maybeHiddenMarkers=[])).push(this))};
Ma(nb);var wc=function(a,b){this.markers=a;this.primary=b;for(b=0;b<a.length;++b)a[b].parent=this};wc.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var a=0;a<this.markers.length;++a)this.markers[a].clear();ra(this,"clear")}};wc.prototype.find=function(a,b){return this.primary.find(a,b)};Ma(wc);var gh=0,Aa=function(a,b,e,c,d){if(!(this instanceof Aa))return new Aa(a,b,e,c,d);null==e&&(e=0);uc.call(this,[new tc([new Nb("",null)])]);this.first=e;this.scrollTop=
this.scrollLeft=0;this.cantEdit=!1;this.cleanGeneration=1;this.modeFrontier=this.highlightFrontier=e;e=I(e,0);this.sel=db(e);this.history=new ed(null);this.id=++gh;this.modeOption=b;this.lineSep=c;this.direction="rtl"==d?"rtl":"ltr";this.extend=!1;"string"==typeof a&&(a=this.splitLines(a));Sd(this,{from:e,to:e,text:a});sa(this,db(e),Ya)};Aa.prototype=x(uc.prototype,{constructor:Aa,iter:function(a,b,e){e?this.iterN(a-this.first,b-a,e):this.iterN(this.first,this.first+this.size,a)},insert:function(a,
b){for(var e=0,c=0;c<b.length;++c)e+=b[c].height;this.insertInner(a-this.first,b,e)},remove:function(a,b){this.removeInner(a-this.first,b)},getValue:function(a){var b=R(this,this.first,this.first+this.size);return!1===a?b:b.join(a||this.lineSeparator())},setValue:qa(function(a){var b=I(this.first,0),e=this.first+this.size-1;Qb(this,{from:b,to:I(e,H(this,e).text.length),text:this.splitLines(a),origin:"setValue",full:!0},!0);this.cm&&mc(this.cm,0,0);sa(this,db(b),Ya)}),replaceRange:function(a,b,e,c){b=
S(this,b);e=e?S(this,e):b;Rb(this,a,b,e,c)},getRange:function(a,b,e){a=N(this,S(this,a),S(this,b));return!1===e?a:a.join(e||this.lineSeparator())},getLine:function(a){return(a=this.getLineHandle(a))&&a.text},getLineHandle:function(a){if(W(this,a))return H(this,a)},getLineNumber:function(a){return Q(a)},getLineHandleVisualStart:function(a){"number"==typeof a&&(a=H(this,a));return Ha(a)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+
this.size-1},clipPos:function(a){return S(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:qa(function(a,b,e){a=S(this,"number"==typeof a?I(a,b||0):a);sa(this,db(a,null),e)}),setSelection:qa(function(a,b,e){var c=S(this,a);a=S(this,b||a);sa(this,db(c,a),e)}),extendSelection:qa(function(a,
b,e){gd(this,S(this,a),b&&S(this,b),e)}),extendSelections:qa(function(a,b){hf(this,Y(this,a),b)}),extendSelectionsBy:qa(function(a,b){a=y(this.sel.ranges,a);hf(this,Y(this,a),b)}),setSelections:qa(function(a,b,e){if(a.length){for(var c=[],d=0;d<a.length;d++)c[d]=new ba(S(this,a[d].anchor),S(this,a[d].head));null==b&&(b=Math.min(a.length-1,this.sel.primIndex));sa(this,Ta(c,b),e)}}),addSelection:qa(function(a,b,e){var c=this.sel.ranges.slice(0);c.push(new ba(S(this,a),S(this,b||a)));sa(this,Ta(c,c.length-
1),e)}),getSelection:function(a){for(var b=this.sel.ranges,e,c=0;c<b.length;c++){var d=N(this,b[c].from(),b[c].to());e=e?e.concat(d):d}return!1===a?e:e.join(a||this.lineSeparator())},getSelections:function(a){for(var b=[],e=this.sel.ranges,c=0;c<e.length;c++){var d=N(this,e[c].from(),e[c].to());!1!==a&&(d=d.join(a||this.lineSeparator()));b[c]=d}return b},replaceSelection:function(a,b,e){for(var c=[],d=0;d<this.sel.ranges.length;d++)c[d]=a;this.replaceSelections(c,b,e||"+input")},replaceSelections:qa(function(a,
b,e){for(var c=[],d=this.sel,h=0;h<d.ranges.length;h++){var g=d.ranges[h];c[h]={from:g.from(),to:g.to(),text:this.splitLines(a[h]),origin:e}}if(a=b&&"end"!=b){a=[];d=e=I(this.first,0);for(h=0;h<c.length;h++){var k=c[h];g=$e(k.from,e,d);var r=$e(mb(k),e,d);e=k.to;d=r;"around"==b?(k=this.sel.ranges[h],k=0>T(k.head,k.anchor),a[h]=new ba(k?r:g,k?g:r)):a[h]=new ba(g,g)}a=new Ka(a,this.sel.primIndex)}b=a;for(a=c.length-1;0<=a;a--)Qb(this,c[a]);b?jf(this,b):this.cm&&Lb(this.cm)}),undo:qa(function(){id(this,
"undo")}),redo:qa(function(){id(this,"redo")}),undoSelection:qa(function(){id(this,"undo",!0)}),redoSelection:qa(function(){id(this,"redo",!0)}),setExtending:function(a){this.extend=a},getExtending:function(){return this.extend},historySize:function(){for(var a=this.history,b=0,e=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||++e;return{undo:b,redo:e}},clearHistory:function(){this.history=new ed(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:Ob(this.history.done),undone:Ob(this.history.undone)}},setHistory:function(a){var b=this.history=new ed(this.history.maxGeneration);b.done=Ob(a.done.slice(0),null,!0);b.undone=Ob(a.undone.slice(0),null,!0)},setGutterMarker:qa(function(a,
b,e){return sc(this,a,"gutter",function(a){var c=a.gutterMarkers||(a.gutterMarkers={});c[b]=e;!e&&J(c)&&(a.gutterMarkers=null);return!0})}),clearGutter:qa(function(a){var b=this;this.iter(function(e){e.gutterMarkers&&e.gutterMarkers[a]&&sc(b,e,"gutter",function(){e.gutterMarkers[a]=null;J(e.gutterMarkers)&&(e.gutterMarkers=null);return!0})})}),lineInfo:function(a){if("number"==typeof a){if(!W(this,a))return null;var b=a;a=H(this,a);if(!a)return null}else if(b=Q(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:qa(function(a,b,e){return sc(this,a,"gutter"==b?"gutter":"class",function(a){var c="text"==b?"textClass":"background"==b?"bgClass":"gutter"==b?"gutterClass":"wrapClass";if(a[c]){if(d(e).test(a[c]))return!1;a[c]+=" "+e}else a[c]=e;return!0})}),removeLineClass:qa(function(a,b,e){return sc(this,a,"gutter"==b?"gutter":"class",function(a){var c="text"==b?"textClass":
"background"==b?"bgClass":"gutter"==b?"gutterClass":"wrapClass",h=a[c];if(h)if(null==e)a[c]=null;else{var g=h.match(d(e));if(!g)return!1;var k=g.index+g[0].length;a[c]=h.slice(0,g.index)+(g.index&&k!=h.length?" ":"")+h.slice(k)||null}else return!1;return!0})}),addLineWidget:qa(function(a,b,e){return Bg(this,a,b,e)}),removeLineWidget:function(a){a.clear()},markText:function(a,b,e){return Sb(this,S(this,a),S(this,b),e,e&&e.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=S(this,a);return Sb(this,a,a,b,"bookmark")},findMarksAt:function(a){a=S(this,a);var b=[],e=H(this,a.line).markedSpans;if(e)for(var c=0;c<e.length;++c){var d=e[c];(null==d.from||d.from<=a.ch)&&(null==d.to||d.to>=a.ch)&&b.push(d.marker.parent||d.marker)}return b},findMarks:function(a,b,e){a=S(this,a);b=S(this,b);var c=[],d=a.line;this.iter(a.line,b.line+1,function(h){if(h=h.markedSpans)for(var g=
0;g<h.length;g++){var k=h[g];null!=k.to&&d==a.line&&a.ch>=k.to||null==k.from&&d!=a.line||null!=k.from&&d==b.line&&k.from>=b.ch||e&&!e(k.marker)||c.push(k.marker.parent||k.marker)}++d});return c},getAllMarks:function(){var a=[];this.iter(function(b){if(b=b.markedSpans)for(var e=0;e<b.length;++e)null!=b[e].from&&a.push(b[e].marker)});return a},posFromIndex:function(a){var b,e=this.first,c=this.lineSeparator().length;this.iter(function(d){d=d.text.length+c;if(d>a)return b=a,!0;a-=d;++e});return S(this,
I(e,b))},indexFromPos:function(a){a=S(this,a);var b=a.ch;if(a.line<this.first||0>a.ch)return 0;var e=this.lineSeparator().length;this.iter(this.first,a.line,function(a){b+=a.text.length+e});return b},copy:function(a){var b=new Aa(R(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);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,e=this.first+this.size;null!=a.from&&a.from>b&&(b=a.from);null!=a.to&&a.to<e&&(e=a.to);b=new Aa(R(this,b,e),a.mode||this.modeOption,b,this.lineSep,this.direction);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=xf(this);for(e=0;e<a.length;e++){var c=a[e],d=c.find(),h=b.clipPos(d.from);d=b.clipPos(d.to);T(h,d)&&(h=Sb(b,h,d,c.primary,c.primary.type),c.markers.push(h),
h.parent=c)}return b},unlinkDoc:function(a){a instanceof ha&&(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);Dg(xf(this));break}if(a.history==this.history){var e=[a.id];Bb(a,function(a){return e.push(a.id)},!0);a.history=new ed(null);a.history.done=Ob(this.history.done,e);a.history.undone=Ob(this.history.undone,e)}},iterLinkedDocs:function(a){Bb(this,a)},getMode:function(){return this.mode},getEditor:function(){return this.cm},
splitLines:function(a){return this.lineSep?a.split(this.lineSep):fe(a)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:qa(function(a){"rtl"!=a&&(a="ltr");a!=this.direction&&(this.direction=a,this.iter(function(a){return a.order=null}),this.cm&&xg(this.cm))})});Aa.prototype.eachLine=Aa.prototype.iter;for(var zf=0,Qf=!1,ob={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"},Jc=0;10>Jc;Jc++)ob[Jc+48]=ob[Jc+96]=String(Jc);for(var pd=65;90>=pd;pd++)ob[pd]=String.fromCharCode(pd);
for(var Kc=1;12>=Kc;Kc++)ob[Kc+111]=ob[Kc+63235]="F"+Kc;var xc={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"]}};xc["default"]=Na?xc.macDefault:xc.pcDefault;var yc={selectAll:of,singleSelection:function(a){return a.setSelection(a.getCursor("anchor"),a.getCursor("head"),Ya)},killLine:function(a){return Ub(a,function(b){if(b.empty()){var e=H(a.doc,b.head.line).text.length;return b.head.ch==e&&b.head.line<a.lastLine()?{from:b.head,to:I(b.head.line+
1,0)}:{from:b.head,to:I(b.head.line,e)}}return{from:b.from(),to:b.to()}})},deleteLine:function(a){return Ub(a,function(b){return{from:I(b.from().line,0),to:S(a.doc,I(b.to().line+1,0))}})},delLineLeft:function(a){return Ub(a,function(a){return{from:I(a.from().line,0),to:a.from()}})},delWrappedLineLeft:function(a){return Ub(a,function(b){var e=a.charCoords(b.head,"div").top+5;return{from:a.coordsChar({left:0,top:e},"div"),to:b.from()}})},delWrappedLineRight:function(a){return Ub(a,function(b){var e=
a.charCoords(b.head,"div").top+5;e=a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:e},"div");return{from:b.from(),to:e}})},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(I(a.firstLine(),0))},goDocEnd:function(a){return a.extendSelection(I(a.lastLine()))},goLineStart:function(a){return a.extendSelectionsBy(function(b){return Ff(a,
b.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(a){return a.extendSelectionsBy(function(b){return Gf(a,b.head)},{origin:"+move",bias:1})},goLineEnd:function(a){return a.extendSelectionsBy(function(b){b=b.head.line;var e=H(a.doc,b);var c=e;for(var d;d=xa(c,!1);)c=d.find(1,!0).line;c!=e&&(b=Q(c));return Zd(!0,a,e,b,-1)},{origin:"+move",bias:-1})},goLineRight:function(a){return a.extendSelectionsBy(function(b){b=a.cursorCoords(b.head,"div").top+5;return a.coordsChar({left:a.display.lineDiv.offsetWidth+
100,top:b},"div")},Hc)},goLineLeft:function(a){return a.extendSelectionsBy(function(b){b=a.cursorCoords(b.head,"div").top+5;return a.coordsChar({left:0,top:b},"div")},Hc)},goLineLeftSmart:function(a){return a.extendSelectionsBy(function(b){var e=a.cursorCoords(b.head,"div").top+5;e=a.coordsChar({left:0,top:e},"div");return e.ch<a.getLine(e.line).search(/\S/)?Gf(a,b.head):e},Hc)},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=[],c=a.listSelections(),d=a.options.tabSize,h=0;h<c.length;h++){var g=c[h].from();g=e(a.getLine(g.line),g.ch,d);b.push(r(d-g%d))}a.replaceSelections(b)},defaultTab:function(a){a.somethingSelected()?a.indentSelection("add"):a.execCommand("insertTab")},transposeChars:function(a){return Fa(a,function(){for(var b=a.listSelections(),e=[],c=0;c<b.length;c++)if(b[c].empty()){var d=b[c].head,h=H(a.doc,d.line).text;if(h)if(d.ch==h.length&&(d=new I(d.line,d.ch-1)),0<d.ch)d=
new I(d.line,d.ch+1),a.replaceRange(h.charAt(d.ch-1)+h.charAt(d.ch-2),I(d.line,d.ch-2),d,"+transpose");else if(d.line>a.doc.first){var g=H(a.doc,d.line-1).text;g&&(d=new I(d.line,1),a.replaceRange(h.charAt(0)+a.doc.lineSeparator()+g.charAt(g.length-1),I(d.line-1,g.length-1),d,"+transpose"))}e.push(new ba(d,d))}a.setSelections(e)})},newlineAndIndent:function(a){return Fa(a,function(){for(var b=a.listSelections(),e=b.length-1;0<=e;e--)a.replaceRange(a.doc.lineSeparator(),b[e].anchor,b[e].head,"+input");
b=a.listSelections();for(e=0;e<b.length;e++)a.indentLine(b[e].from().line,null,!0);Lb(a)})},openLine:function(a){return a.replaceSelection("\n","start")},toggleOverwrite:function(a){return a.toggleOverwrite()}},Lg=new Cb,$d=null,ae=function(a,b,e){this.time=a;this.pos=b;this.button=e};ae.prototype.compare=function(a,b,e){return this.time+400>a&&0==T(b,this.pos)&&e==this.button};var Bc,Ac,Vb={toString:function(){return"CodeMirror.Init"}},Pf={},nd={};ha.defaults=Pf;ha.optionHandlers=nd;var de=[];ha.defineInitHook=
function(a){return de.push(a)};var Ga=null,ca=function(a){this.cm=a;this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null;this.polling=new Cb;this.composing=null;this.gracePeriod=!1;this.readDOMTimeout=null};ca.prototype.init=function(a){function b(a){if(!ka(d,a)){if(d.somethingSelected())Ga={lineWise:!1,text:d.getSelections()},"cut"==a.type&&d.replaceSelection("",null,"cut");else if(d.options.lineWiseCopyCut){var b=Uf(d);Ga={lineWise:!0,text:b.text};"cut"==a.type&&
d.operation(function(){d.setSelections(b.ranges,0,Ya);d.replaceSelection("",null,"cut")})}else return;if(a.clipboardData){a.clipboardData.clearData();var e=Ga.text.join("\n");a.clipboardData.setData("Text",e);if(a.clipboardData.getData("Text")==e){a.preventDefault();return}}var g=Wf();a=g.firstChild;d.display.lineSpace.insertBefore(g,d.display.lineSpace.firstChild);a.value=Ga.text.join("\n");var k=document.activeElement;Gc(a);setTimeout(function(){d.display.lineSpace.removeChild(g);k.focus();k==h&&
c.showPrimarySelection()},50)}}var e=this,c=this,d=c.cm,h=c.div=a.lineDiv;Vf(h,d.options.spellcheck);V(h,"paste",function(a){ka(d,a)||Tf(a,d)||11>=ea&&setTimeout(pa(d,function(){return e.updateFromDOM()}),20)});V(h,"compositionstart",function(a){e.composing={data:a.data,done:!1}});V(h,"compositionupdate",function(a){e.composing||(e.composing={data:a.data,done:!1})});V(h,"compositionend",function(a){e.composing&&(a.data!=e.composing.data&&e.readFromDOMSoon(),e.composing.done=!0)});V(h,"touchstart",
function(){return c.forceCompositionEnd()});V(h,"input",function(){e.composing||e.readFromDOMSoon()});V(h,"copy",b);V(h,"cut",b)};ca.prototype.prepareSelection=function(){var a=Ie(this.cm,!1);a.focus=this.cm.state.focused;return a};ca.prototype.showSelection=function(a,b){a&&this.cm.display.view.length&&((a.focus||b)&&this.showPrimarySelection(),this.showMultipleSelections(a))};ca.prototype.showPrimarySelection=function(){var a=window.getSelection(),b=this.cm,e=b.doc.sel.primary(),c=e.from();e=e.to();
if(b.display.viewTo==b.display.viewFrom||c.line>=b.display.viewTo||e.line<b.display.viewFrom)a.removeAllRanges();else{var d=od(b,a.anchorNode,a.anchorOffset),h=od(b,a.focusNode,a.focusOffset);if(!d||d.bad||!h||h.bad||0!=T(X(d,h),c)||0!=T(ia(d,h),e))if(d=b.display.view,c=c.line>=b.display.viewFrom&&Yf(b,c)||{node:d[0].measure.map[2],offset:0},e=e.line<b.display.viewTo&&Yf(b,e),e||(e=d[d.length-1].measure,e=e.maps?e.maps[e.maps.length-1]:e.map,e={node:e[e.length-1],offset:e[e.length-2]-e[e.length-3]}),
c&&e){d=a.rangeCount&&a.getRangeAt(0);try{var g=ec(c.node,c.offset,e.offset,e.node)}catch(kh){}g&&(!gb&&b.state.focused?(a.collapse(c.node,c.offset),g.collapsed||(a.removeAllRanges(),a.addRange(g))):(a.removeAllRanges(),a.addRange(g)),d&&null==a.anchorNode?a.addRange(d):gb&&this.startGracePeriod());this.rememberSelection()}else a.removeAllRanges()}};ca.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)};ca.prototype.showMultipleSelections=function(a){q(this.cm.display.cursorDiv,a.cursors);q(this.cm.display.selectionDiv,a.selection)};ca.prototype.rememberSelection=function(){var a=window.getSelection();this.lastAnchorNode=a.anchorNode;this.lastAnchorOffset=a.anchorOffset;this.lastFocusNode=a.focusNode;this.lastFocusOffset=a.focusOffset};ca.prototype.selectionInEditor=function(){var a=window.getSelection();if(!a.rangeCount)return!1;
a=a.getRangeAt(0).commonAncestorContainer;return n(this.div,a)};ca.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()||this.showSelection(this.prepareSelection(),!0),this.div.focus())};ca.prototype.blur=function(){this.div.blur()};ca.prototype.getField=function(){return this.div};ca.prototype.supportsTouch=function(){return!0};ca.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():Fa(this.cm,function(){return b.cm.curOp.selectionChanged=!0});this.polling.set(this.cm.options.pollInterval,a)};ca.prototype.selectionChanged=function(){var a=window.getSelection();return a.anchorNode!=this.lastAnchorNode||a.anchorOffset!=this.lastAnchorOffset||a.focusNode!=this.lastFocusNode||a.focusOffset!=this.lastFocusOffset};ca.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var a=
window.getSelection(),b=this.cm;if(Wc&&Vc&&this.cm.options.gutters.length&&$g(a.anchorNode))this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();else if(!this.composing){this.rememberSelection();var e=od(b,a.anchorNode,a.anchorOffset),c=od(b,a.focusNode,a.focusOffset);e&&c&&Fa(b,function(){sa(b.doc,db(e,c),Ya);if(e.bad||c.bad)b.curOp.selectionChanged=!0})}}};ca.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),
this.readDOMTimeout=null);var a=this.cm,b=a.display,e=a.doc.sel.primary(),c=e.from(),d=e.to();0==c.ch&&c.line>a.firstLine()&&(c=I(c.line-1,H(a.doc,c.line-1).length));d.ch==H(a.doc,d.line).text.length&&d.line<a.lastLine()&&(d=I(d.line+1,0));if(c.line<b.viewFrom||d.line>b.viewTo-1)return!1;var h;c.line==b.viewFrom||0==(h=sb(a,c.line))?(e=Q(b.view[0].line),h=b.view[0].node):(e=Q(b.view[h].line),h=b.view[h-1].node.nextSibling);var g=sb(a,d.line);g==b.view.length-1?(d=b.viewTo-1,b=b.lineDiv.lastChild):
(d=Q(b.view[g+1].line)-1,b=b.view[g+1].node.previousSibling);if(!h)return!1;b=a.doc.splitLines(ah(a,h,b,e,d));for(h=N(a.doc,I(e,0),I(d,H(a.doc,d).text.length));1<b.length&&1<h.length;)if(A(b)==A(h))b.pop(),h.pop(),d--;else if(b[0]==h[0])b.shift(),h.shift(),e++;else break;var k=0;g=0;for(var r=b[0],l=h[0],n=Math.min(r.length,l.length);k<n&&r.charCodeAt(k)==l.charCodeAt(k);)++k;r=A(b);l=A(h);for(n=Math.min(r.length-(1==b.length?k:0),l.length-(1==h.length?k:0));g<n&&r.charCodeAt(r.length-g-1)==l.charCodeAt(l.length-
g-1);)++g;if(1==b.length&&1==h.length&&e==c.line)for(;k&&k>c.ch&&r.charCodeAt(r.length-g-1)==l.charCodeAt(l.length-g-1);)k--,g++;b[b.length-1]=r.slice(0,r.length-g).replace(/^\u200b+/,"");b[0]=b[0].slice(k).replace(/\u200b+$/,"");c=I(e,k);e=I(d,h.length?A(h).length-g:0);if(1<b.length||b[0]||T(c,e))return Rb(a.doc,b,c,e,"+input"),!0};ca.prototype.ensurePolled=function(){this.forceCompositionEnd()};ca.prototype.reset=function(){this.forceCompositionEnd()};ca.prototype.forceCompositionEnd=function(){this.composing&&
(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())};ca.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.updateFromDOM()},80))};ca.prototype.updateFromDOM=function(){var a=this;!this.cm.isReadOnly()&&this.pollContent()||Fa(this.cm,function(){return za(a.cm)})};ca.prototype.setUneditable=
function(a){a.contentEditable="false"};ca.prototype.onKeyPress=function(a){0!=a.charCode&&(a.preventDefault(),this.cm.isReadOnly()||pa(this.cm,ee)(this.cm,String.fromCharCode(null==a.charCode?a.keyCode:a.charCode),0))};ca.prototype.readOnlyChanged=function(a){this.div.contentEditable=String("nocursor"!=a)};ca.prototype.onContextMenu=function(){};ca.prototype.resetPosition=function(){};ca.prototype.needsContentAttribute=!0;var ma=function(a){this.cm=a;this.prevInput="";this.pollingFast=!1;this.polling=
new Cb;this.hasSelection=!1;this.composing=null};ma.prototype.init=function(a){function b(a){if(!ka(d,a)){if(d.somethingSelected())Ga={lineWise:!1,text:d.getSelections()};else if(d.options.lineWiseCopyCut){var b=Uf(d);Ga={lineWise:!0,text:b.text};"cut"==a.type?d.setSelections(b.ranges,null,Ya):(c.prevInput="",g.value=b.text.join("\n"),Gc(g))}else return;"cut"==a.type&&(d.state.cutIncoming=!0)}}var e=this,c=this,d=this.cm,h=this.wrapper=Wf(),g=this.textarea=h.firstChild;a.wrapper.insertBefore(h,a.wrapper.firstChild);
Ec&&(g.style.width="0px");V(g,"input",function(){Z&&9<=ea&&e.hasSelection&&(e.hasSelection=null);c.poll()});V(g,"paste",function(a){ka(d,a)||Tf(a,d)||(d.state.pasteIncoming=!0,c.fastPoll())});V(g,"cut",b);V(g,"copy",b);V(a.scroller,"paste",function(b){cb(a,b)||ka(d,b)||(d.state.pasteIncoming=!0,c.focus())});V(a.lineSpace,"selectstart",function(b){cb(a,b)||oa(b)});V(g,"compositionstart",function(){var a=d.getCursor("from");c.composing&&c.composing.range.clear();c.composing={start:a,range:d.markText(a,
d.getCursor("to"),{className:"CodeMirror-composing"})}});V(g,"compositionend",function(){c.composing&&(c.poll(),c.composing.range.clear(),c.composing=null)})};ma.prototype.prepareSelection=function(){var a=this.cm,b=a.display,e=a.doc,c=Ie(a);if(a.options.moveInputWithCursor){a=Ra(a,e.sel.primary().head,"div");e=b.wrapper.getBoundingClientRect();var d=b.lineDiv.getBoundingClientRect();c.teTop=Math.max(0,Math.min(b.wrapper.clientHeight-10,a.top+d.top-e.top));c.teLeft=Math.max(0,Math.min(b.wrapper.clientWidth-
10,a.left+d.left-e.left))}return c};ma.prototype.showSelection=function(a){var b=this.cm.display;q(b.cursorDiv,a.cursors);q(b.selectionDiv,a.selection);null!=a.teTop&&(this.wrapper.style.top=a.teTop+"px",this.wrapper.style.left=a.teLeft+"px")};ma.prototype.reset=function(a){if(!this.contextMenuPending&&!this.composing){var b=this.cm;b.somethingSelected()?(this.prevInput="",a=b.getSelection(),this.textarea.value=a,b.state.focused&&Gc(this.textarea),Z&&9<=ea&&(this.hasSelection=a)):a||(this.prevInput=
this.textarea.value="",Z&&9<=ea&&(this.hasSelection=null))}};ma.prototype.getField=function(){return this.textarea};ma.prototype.supportsTouch=function(){return!1};ma.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!Yb||v()!=this.textarea))try{this.textarea.focus()}catch(w){}};ma.prototype.blur=function(){this.textarea.blur()};ma.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0};ma.prototype.receivedFocus=function(){this.slowPoll()};ma.prototype.slowPoll=
function(){var a=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){a.poll();a.cm.state.focused&&a.slowPoll()})};ma.prototype.fastPoll=function(){function a(){e.poll()||b?(e.pollingFast=!1,e.slowPoll()):(b=!0,e.polling.set(60,a))}var b=!1,e=this;e.pollingFast=!0;e.polling.set(20,a)};ma.prototype.poll=function(){var a=this,b=this.cm,e=this.textarea,c=this.prevInput;if(this.contextMenuPending||!b.state.focused||fh(e)&&!c&&!this.composing||b.isReadOnly()||b.options.disableInput||
b.state.keySeq)return!1;var d=e.value;if(d==c&&!b.somethingSelected())return!1;if(Z&&9<=ea&&this.hasSelection===d||Na&&/[\uf700-\uf7ff]/.test(d))return b.display.input.reset(),!1;if(b.doc.sel==b.display.selForContextMenu){var h=d.charCodeAt(0);8203!=h||c||(c="\u200b");if(8666==h)return this.reset(),this.cm.execCommand("undo")}var g=0;for(h=Math.min(c.length,d.length);g<h&&c.charCodeAt(g)==d.charCodeAt(g);)++g;Fa(b,function(){ee(b,d.slice(g),c.length-g,null,a.composing?"*compose":null);1E3<d.length||
-1<d.indexOf("\n")?e.value=a.prevInput="":a.prevInput=d;a.composing&&(a.composing.range.clear(),a.composing.range=b.markText(a.composing.start,b.getCursor("to"),{className:"CodeMirror-composing"}))});return!0};ma.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)};ma.prototype.onKeyPress=function(){Z&&9<=ea&&(this.hasSelection=null);this.fastPoll()};ma.prototype.onContextMenu=function(a){function b(){if(null!=g.selectionStart){var a=d.somethingSelected(),b="\u200b"+
(a?g.value:"");g.value="\u21da";g.value=b;c.prevInput=a?"":"\u200b";g.selectionStart=1;g.selectionEnd=b.length;h.selForContextMenu=d.doc.sel}}function e(){c.contextMenuPending=!1;c.wrapper.style.cssText=n;g.style.cssText=l;Z&&9>ea&&h.scrollbars.setScrollTop(h.scroller.scrollTop=r);if(null!=g.selectionStart){(!Z||Z&&9>ea)&&b();var a=0,e=function(){h.selForContextMenu==d.doc.sel&&0==g.selectionStart&&0<g.selectionEnd&&"\u200b"==c.prevInput?pa(d,of)(d):10>a++?h.detectingSelectAll=setTimeout(e,500):(h.selForContextMenu=
null,h.input.reset())};h.detectingSelectAll=setTimeout(e,200)}}var c=this,d=c.cm,h=d.display,g=c.textarea,k=wb(d,a),r=h.scroller.scrollTop;if(k&&!Sa){d.options.resetSelectionOnContextMenu&&-1==d.doc.sel.contains(k)&&pa(d,sa)(d.doc,db(k),Ya);var l=g.style.cssText,n=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: "+(Z?"rgba(255, 255, 255, .05)":"transparent")+";\n      outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";if(ta)var t=window.scrollY;h.input.focus();ta&&window.scrollTo(null,t);h.input.reset();d.somethingSelected()||(g.value=c.prevInput=" ");c.contextMenuPending=!0;h.selForContextMenu=d.doc.sel;clearTimeout(h.detectingSelectAll);Z&&9<=ea&&b();if(be){qb(a);var f=function(){ja(window,"mouseup",f);setTimeout(e,
20)};V(window,"mouseup",f)}else setTimeout(e,50)}};ma.prototype.readOnlyChanged=function(a){a||this.reset();this.textarea.disabled="nocursor"==a};ma.prototype.setUneditable=function(){};ma.prototype.needsContentAttribute=!1;(function(a){function b(b,c,d,h){a.defaults[b]=c;d&&(e[b]=h?function(a,b,e){e!=Vb&&d(a,b,e)}:d)}var e=a.optionHandlers;a.defineOption=b;a.Init=Vb;b("value","",function(a,b){return a.setValue(b)},!0);b("mode",null,function(a,b){a.doc.modeOption=b;Rd(a)},!0);b("indentUnit",2,Rd,
!0);b("indentWithTabs",!1);b("smartIndent",!0);b("tabSize",4,function(a){qc(a);jc(a);za(a)},!0);b("lineSeparator",null,function(a,b){if(a.doc.lineSep=b){var e=[],c=a.doc.first;a.doc.iter(function(a){for(var d=0;;){var h=a.text.indexOf(b,d);if(-1==h)break;d=h+b.length;e.push(I(c,h))}c++});for(var d=e.length-1;0<=d;d--)Rb(a.doc,b,e[d],I(e[d].line,e[d].ch+b.length))}});b("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(a,b,e){a.state.specialChars=new RegExp(b.source+
(b.test("\t")?"":"|\t"),"g");e!=Vb&&a.refresh()});b("specialCharPlaceholder",kg,function(a){return a.refresh()},!0);b("electricChars",!0);b("inputStyle",Yb?"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",!eh);b("wholeLineUpdateBefore",!0);b("theme","default",function(a){Of(a);Cc(a)},!0);b("keyMap","default",function(a,b,e){b=jd(b);(e=e!=
Vb&&jd(e))&&e.detach&&e.detach(a,b);b.attach&&b.attach(a,e||null)});b("extraKeys",null);b("configureMouse",null);b("lineWrapping",!1,Yg,!0);b("gutters",[],function(a){Pd(a.options);Cc(a)},!0);b("fixedGutter",!0,function(a,b){a.display.gutters.style.left=b?Fd(a.display)+"px":"0";a.refresh()},!0);b("coverGutterNextToScrollbar",!1,function(a){return Mb(a)},!0);b("scrollbarStyle","native",function(a){Se(a);Mb(a);a.display.scrollbars.setScrollTop(a.doc.scrollTop);a.display.scrollbars.setScrollLeft(a.doc.scrollLeft)},
!0);b("lineNumbers",!1,function(a){Pd(a.options);Cc(a)},!0);b("firstLineNumber",1,Cc,!0);b("lineNumberFormatter",function(a){return a},Cc,!0);b("showCursorWhenSelecting",!1,kc,!0);b("resetSelectionOnContextMenu",!0);b("lineWiseCopyCut",!0);b("pasteLinesPerSelection",!0);b("readOnly",!1,function(a,b){"nocursor"==b&&(lc(a),a.display.input.blur());a.display.input.readOnlyChanged(b)});b("disableInput",!1,function(a,b){b||a.display.input.reset()},!0);b("dragDrop",!0,Xg);b("allowDropFileTypes",null);b("cursorBlinkRate",
530);b("cursorScrollMargin",0);b("cursorHeight",1,kc,!0);b("singleCursorHeightPerLine",!0,kc,!0);b("workTime",100);b("workDelay",100);b("flattenSpans",!0,qc,!0);b("addModeClass",!1,qc,!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,qc,!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);b("direction","ltr",function(a,b){return a.doc.setDirection(b)},!0)})(ha);(function(a){var e=a.optionHandlers,c=a.helpers={};a.prototype={constructor:a,focus:function(){window.focus();this.display.input.focus()},setOption:function(a,b){var c=this.options,d=c[a];if(c[a]!=b||"mode"==a)c[a]=b,e.hasOwnProperty(a)&&pa(this,e[a])(this,b,d),fa(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"](jd(a))},removeKeyMap:function(a){for(var b=this.state.keyMaps,e=0;e<b.length;++e)if(b[e]==a||b[e].name==a)return b.splice(e,1),!0},addOverlay:va(function(b,e){var c=b.token?b:a.getMode(this.options,b);if(c.startState)throw Error("Overlays may not be stateful.");z(this.state.overlays,{mode:c,modeSpec:b,opaque:e&&e.opaque,priority:e&&e.priority||0},function(a){return a.priority});this.state.modeGen++;za(this)}),removeOverlay:va(function(a){for(var b=
this.state.overlays,e=0;e<b.length;++e){var c=b[e].modeSpec;if(c==a||"string"==typeof a&&c.name==a){b.splice(e,1);this.state.modeGen++;za(this);break}}}),indentLine:va(function(a,b,e){"string"!=typeof b&&"number"!=typeof b&&(b=null==b?this.options.smartIndent?"smart":"prev":b?"add":"subtract");W(this.doc,a)&&Dc(this,a,b,e)}),indentSelection:va(function(a){for(var b=this.doc.sel.ranges,e=-1,c=0;c<b.length;c++){var d=b[c];if(d.empty())d.head.line>e&&(Dc(this,d.head.line,a,!0),e=d.head.line,c==this.doc.sel.primIndex&&
Lb(this));else{var h=d.from();d=d.to();var g=Math.max(e,h.line);e=Math.min(this.lastLine(),d.line-(d.ch?0:1))+1;for(d=g;d<e;++d)Dc(this,d,a);d=this.doc.sel.ranges;0==h.ch&&b.length==d.length&&0<d[c].from().ch&&Vd(this.doc,c,new ba(h,d[c].to()),Ya)}}}),getTokenAt:function(a,b){return je(this,a,b)},getLineTokens:function(a,b){return je(this,I(a),b,!0)},getTokenTypeAt:function(a){a=S(this.doc,a);var b=jb(this,H(this.doc,a.line)),e=0,c=(b.length-1)/2;a=a.ch;if(0==a)b=b[2];else for(;;){var d=e+c>>1;if((d?
b[2*d-1]:0)>=a)c=d;else if(b[2*d+1]<a)e=d+1;else{b=b[2*d+2];break}}e=b?b.indexOf("overlay "):-1;return 0>e?b:0==e?null:b.slice(0,e-1)},getModeAt:function(b){var e=this.doc.mode;return e.innerMode?a.innerMode(e,this.getTokenAt(b).state).mode:e},getHelper:function(a,b){return this.getHelpers(a,b)[0]},getHelpers:function(a,e){var d=[];if(!c.hasOwnProperty(e))return d;var h=c[e];a=this.getModeAt(a);if("string"==typeof a[e])h[a[e]]&&d.push(h[a[e]]);else if(a[e])for(var g=0;g<a[e].length;g++){var k=h[a[e][g]];
k&&d.push(k)}else a.helperType&&h[a.helperType]?d.push(h[a.helperType]):h[a.name]&&d.push(h[a.name]);for(e=0;e<h._global.length;e++)g=h._global[e],g.pred(a,this)&&-1==b(d,g.val)&&d.push(g.val);return d},getStateAfter:function(a,b){var e=this.doc;a=Math.max(e.first,Math.min(null==a?e.first+e.size-1:a,e.first+e.size-1));return Va(this,a+1,b).state},cursorCoords:function(a,b){var e=this.doc.sel.primary();a=null==a?e.head:"object"==typeof a?S(this.doc,a):a?e.from():e.to();return Ra(this,a,b||"page")},
charCoords:function(a,b){return Bd(this,S(this.doc,a),b||"page")},coordsChar:function(a,b){a=De(this,a,b||"page");return Dd(this,a.left,a.top)},lineAtHeight:function(a,b){a=De(this,{top:a,left:0},b||"page").top;return U(this.doc,a+this.display.viewOffset)},heightAtLine:function(a,b,e){var c=!1;if("number"==typeof a){var d=this.doc.first+this.doc.size-1;a<this.doc.first?a=this.doc.first:a>d&&(a=d,c=!0);a=H(this.doc,a)}return Xc(this,a,{top:0,left:0},b||"page",e||c).top+(c?this.doc.height-Ia(a):0)},
defaultTextHeight:function(){return ub(this.display)},defaultCharWidth:function(){return ic(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(a,b,e,c,d){var h=this.display;a=Ra(this,S(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);h.sizer.appendChild(b);if("over"==c)g=a.top;else if("above"==c||"near"==c){var r=Math.max(h.wrapper.clientHeight,
this.doc.height),l=Math.max(h.sizer.clientWidth,h.lineSpace.clientWidth);("above"==c||a.bottom+b.offsetHeight>r)&&a.top>b.offsetHeight?g=a.top-b.offsetHeight:a.bottom+b.offsetHeight<=r&&(g=a.bottom);k+b.offsetWidth>l&&(k=l-b.offsetWidth)}b.style.top=g+"px";b.style.left=b.style.right="";"right"==d?(k=h.sizer.clientWidth-b.offsetWidth,b.style.right="0px"):("left"==d?k=0:"middle"==d&&(k=(h.sizer.clientWidth-b.offsetWidth)/2),b.style.left=k+"px");e&&(a=Ld(this,{left:k,top:g,right:k+b.offsetWidth,bottom:g+
b.offsetHeight}),null!=a.scrollTop&&nc(this,a.scrollTop),null!=a.scrollLeft&&yb(this,a.scrollLeft))},triggerOnKeyDown:va(If),triggerOnKeyPress:va(Kf),triggerOnKeyUp:Jf,triggerOnMouseDown:va(Lf),execCommand:function(a){if(yc.hasOwnProperty(a))return yc[a].call(null,this)},triggerElectric:va(function(a){Sf(this,a)}),findPosH:function(a,b,e,c){var d=1;0>b&&(d=-1,b=-b);a=S(this.doc,a);for(var h=0;h<b&&(a=ge(this.doc,a,d,e,c),!a.hitSide);++h);return a},moveH:va(function(a,b){var e=this;this.extendSelectionsBy(function(c){return e.display.shift||
e.doc.extend||c.empty()?ge(e.doc,c.head,a,b,e.options.rtlMoveVisually):0>a?c.from():c.to()},Hc)}),deleteH:va(function(a,b){var e=this.doc;this.doc.sel.somethingSelected()?e.replaceSelection("",null,"+delete"):Ub(this,function(c){var d=ge(e,c.head,a,b,!1);return 0>a?{from:d,to:c.head}:{from:c.head,to:d}})}),findPosV:function(a,b,e,c){var d=1;0>b&&(d=-1,b=-b);var h=S(this.doc,a);for(a=0;a<b&&(h=Ra(this,h,"div"),null==c?c=h.left:h.left=c,h=Xf(this,h,d,e),!h.hitSide);++a);return h},moveV:va(function(a,
b){var e=this,c=this.doc,d=[],h=!this.display.shift&&!c.extend&&c.sel.somethingSelected();c.extendSelectionsBy(function(g){if(h)return 0>a?g.from():g.to();var k=Ra(e,g.head,"div");null!=g.goalColumn&&(k.left=g.goalColumn);d.push(k.left);var r=Xf(e,k,a,b);"page"==b&&g==c.sel.primary()&&$c(e,Bd(e,r,"div").top-k.top);return r},Hc);if(d.length)for(var g=0;g<c.sel.ranges.length;g++)c.sel.ranges[g].goalColumn=d[g]}),findWordAt:function(a){var b=H(this.doc,a.line).text,e=a.ch,c=a.ch;if(b){var d=this.getHelper(a,
"wordChars");"before"!=a.sticky&&c!=b.length||!e?++c:--e;var h=b.charAt(e);for(h=G(h,d)?function(a){return G(a,d)}:/\s/.test(h)?function(a){return/\s/.test(a)}:function(a){return!/\s/.test(a)&&!G(a)};0<e&&h(b.charAt(e-1));)--e;for(;c<b.length&&h(b.charAt(c));)++c}return new ba(I(a.line,e),I(a.line,c))},toggleOverwrite:function(a){if(null==a||a!=this.state.overwrite)(this.state.overwrite=!this.state.overwrite)?t(this.display.cursorDiv,"CodeMirror-overwrite"):xb(this.display.cursorDiv,"CodeMirror-overwrite"),
fa(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==v()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:va(function(a,b){mc(this,a,b)}),getScrollInfo:function(){var a=this.display.scroller;return{left:a.scrollLeft,top:a.scrollTop,height:a.scrollHeight-Xa(this)-this.display.barHeight,width:a.scrollWidth-Xa(this)-this.display.barWidth,clientHeight:wd(this),clientWidth:rb(this)}},scrollIntoView:va(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:I(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?(ad(this),this.curOp.scrollToPos=a):Pe(this,a.from,a.to,a.margin)}),setSize:va(function(a,b){var e=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&&Ae(this);var d=this.display.viewFrom;this.doc.iter(d,this.display.viewTo,function(a){if(a.widgets)for(var b=0;b<a.widgets.length;b++)if(a.widgets[b].noHScroll){lb(e,d,"widget");break}++d});this.curOp.forceUpdate=!0;fa(this,"refresh",this)}),operation:function(a){return Fa(this,a)},startOperation:function(){return zb(this)},endOperation:function(){return Ab(this)},refresh:va(function(){var a=this.display.cachedTextHeight;za(this);this.curOp.forceUpdate=!0;jc(this);
mc(this,this.doc.scrollLeft,this.doc.scrollTop);Kd(this);(null==a||.5<Math.abs(a-ub(this.display)))&&Gd(this);fa(this,"refresh",this)}),swapDoc:va(function(a){var b=this.doc;b.cm=null;bf(this,a);jc(this);this.display.input.reset();mc(this,a.scrollLeft,a.scrollTop);this.curOp.forceScroll=!0;ra(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}};Ma(a);a.registerHelper=function(b,e,d){c.hasOwnProperty(b)||(c[b]=a[b]={_global:[]});c[b][e]=d};a.registerGlobalHelper=function(b,e,d,h){a.registerHelper(b,e,h);c[b]._global.push({pred:d,val:h})}})(ha);var hh="iter insert remove copy getEditor constructor".split(" "),Lc;for(Lc in Aa.prototype)Aa.prototype.hasOwnProperty(Lc)&&0>b(hh,Lc)&&(ha.prototype[Lc]=function(a){return function(){return a.apply(this.doc,arguments)}}(Aa.prototype[Lc]));
Ma(Aa);ha.inputStyles={textarea:ma,contenteditable:ca};ha.defineMode=function(a){ha.defaults.mode||"null"==a||(ha.defaults.mode=a);Rc.apply(this,arguments)};ha.defineMIME=function(a,b){Hb[a]=b};ha.defineMode("null",function(){return{token:function(a){return a.skipToEnd()}}});ha.defineMIME("text/plain","null");ha.defineExtension=function(a,b){ha.prototype[a]=b};ha.defineDocExtension=function(a,b){Aa.prototype[a]=b};ha.fromTextArea=function(a,b){function e(){a.value=r.getValue()}b=b?g(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=v();b.autofocus=c==a||null!=a.getAttribute("autofocus")&&c==document.body}if(a.form&&(V(a.form,"submit",e),!b.leaveSubmitMethodAlone)){var d=a.form;var h=d.submit;try{var k=d.submit=function(){e();d.submit=h;d.submit();d.submit=k}}catch(he){}}b.finishInit=function(b){b.save=e;b.getTextArea=function(){return a};b.toTextArea=function(){b.toTextArea=isNaN;
e();a.parentNode.removeChild(b.getWrapperElement());a.style.display="";a.form&&(ja(a.form,"submit",e),"function"==typeof a.form.submit&&(a.form.submit=h))}};a.style.display="none";var r=ha(function(b){return a.parentNode.insertBefore(b,a.nextSibling)},b);return r};(function(a){a.off=ja;a.on=V;a.wheelEventPixels=wg;a.Doc=Aa;a.splitLines=fe;a.countColumn=e;a.findColumn=h;a.isWordChar=D;a.Pass=ld;a.signal=fa;a.Line=Nb;a.changeEnd=mb;a.scrollbarModel=Te;a.Pos=I;a.cmpPos=T;a.modes=sd;a.mimeModes=Hb;a.resolveMode=
bb;a.getMode=Oa;a.modeExtensions=Ib;a.extendMode=ua;a.copyState=Pa;a.startState=bc;a.innerMode=Jb;a.commands=yc;a.keyMap=xc;a.keyName=Ef;a.isModifierKey=Bf;a.lookupKey=Tb;a.normalizeKeyMap=Ig;a.StringStream=la;a.SharedTextMarker=wc;a.TextMarker=nb;a.LineWidget=vc;a.e_preventDefault=oa;a.e_stopPropagation=Qc;a.e_stop=qb;a.addClass=t;a.contains=n;a.rmClass=xb;a.keyNames=ob})(ha);ha.version="5.31.0";return ha})},function(m,f,d){d.d(f,"b",function(){return u});var u;(function(d){d[d.UINT8=0]="UINT8";
d[d.UINT16=1]="UINT16";d[d.UINT32=2]="UINT32";d[d.UINT64=3]="UINT64";d[d.FLOAT32=4]="FLOAT32"})(u||(u={}));m=[];f.a=m;m[u.UINT8]=1;m[u.UINT16]=2;m[u.UINT32]=4;m[u.UINT64]=8;m[u.FLOAT32]=4},function(m,f,d){function u(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,
c):a.__proto__=c)}d.d(f,"a",function(){return n});f.c=function(a,c){v.set(a,c)};f.b=function(a){return v.get(a)};m=d(0);var p=d(112),q=d(17),a=function(){function a(a,c){for(var d=0;d<c.length;d++){var e=c[d];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(c,d,g){d&&a(c.prototype,d);g&&a(c,g);return c}}(),c=new Float32Array(4),n=function(d){function l(a){if(!(this instanceof l))throw new TypeError("Cannot call a class as a function");
var c=(l.__proto__||Object.getPrototypeOf(l)).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;c.gl=a;c.countingBuffer=c.registerDisposer(Object(p.d)(c.gl));return c}u(l,d);a(l,[{key:"setPartIndex",value:function(a,c){for(var e=[],b=1;b<arguments.length;++b)e[b-1]=arguments[b];b="\nvoid setPartIndex("+e.map(function(a,b){return"float partIndex"+b}).join()+") {\n  uint32_t pickID; pickID.value = uPickID;\n  uint32_t pickBaseOffset = getPickBaseOffset();\n"+
e.map(function(a,b){return"uint32_t pickOffset"+b+" = add(pickBaseOffset, partIndex"+b+");"}).join("\n")+"\n";0===e.length&&(b+="\n  uint32_t pickOffset0 = pickBaseOffset;\n");b+="\n  vPickID = add(pickID, pickOffset0).value;\n  uint32_t selectedIndex; selectedIndex.value = uSelectedIndex;\nif (equal(selectedIndex, pickBaseOffset)"+e.map(function(a,b){return" || equal(selectedIndex, pickOffset"+b+")"}).join("")+") {\n    vColor = uColorSelected;\n  } else {\n    vColor = uColor;\n  }\n}\n";a.addVertexCode(q.d);
a.addVertexCode(q.b);a.addVertexCode(b);return"setPartIndex("+e.join()+")"}},{key:"getCrossSectionFadeFactor",value:function(){return this.targetIsSliceView?"(clamp(1.0 - 2.0 * abs(0.5 - gl_FragCoord.z), 0.0, 1.0))":"(1.0)"}},{key:"defineShader",value:function(a){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.require(p.b);1===this.pickIdsPerInstance?a.addVertexCode("\nuint32_t getPickBaseOffset() { return getPrimitiveIndex(); }\n"):(a.addVertexCode(q.j),a.addVertexCode("\nuint32_t getPickBaseOffset() {       \n  return multiply(getPrimitiveIndex(), "+this.pickIdsPerInstance.toFixed(1)+");\n}\n"));a.addFragmentCode("\nvoid emitAnnotation(vec4 color) {\n  emit(color, vPickID);\n}\n")}},{key:"enable",value:function(a,d,e){a.bind();var b=this.gl,h=d.renderContext,g=d.annotationLayer;
this.countingBuffer.ensure(d.count).bind(a,1);b.uniformMatrix4fv(a.uniform("uProjection"),!1,d.projectionMatrix);h.emitPickID&&b.uniform4fv(a.uniform("uPickID"),Object(q.r)(c,d.basePickId));if(h.emitColor){h=g.state.color.value;c[0]=h[0];c[1]=h[1];c[2]=h[2];c[3]=1;b.uniform4fv(a.uniform("uColor"),c);for(h=0;3>h;++h)c[h]=.75+.25*c[h];b.uniform4fv(a.uniform("uColorSelected"),c);b.uniform4fv(a.uniform("uSelectedIndex"),Object(q.r)(c,d.selectedIndex))}e();Object(p.c)(this.gl,a,!0)}}]);return l}(m.a),
v=new Map},function(m,f,d){function u(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(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 q(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)}d.d(f,"a",function(){return E});d.d(f,"c",function(){return x});d.d(f,"b",function(){return D});d.d(f,"d",function(){return G});m=d(5);var a=d.n(m),c=d(36);m=d(18);var n=d(31),v=d(65);f=d(0);var t=d(1),l=d(25),k=d(3),g=d(24),e=d(78),b=d(27),h=d(53);d=d(12);var r=function(){function a(a,b){for(var e=0;e<b.length;e++){var c=b[e];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=
!0);Object.defineProperty(a,c.key,c)}}return function(b,e,c){e&&a(b.prototype,e);c&&a(b,c);return b}}(),A=function C(a,b,e){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,b);if(void 0===c){if(a=Object.getPrototypeOf(a),null!==a)return C(a,b,e)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(e)}},y=this&&this.__decorate||function(a,b,e,c){var d=arguments.length,h=3>d?b:null===c?c=Object.getOwnPropertyDescriptor(b,e):c,g;if("object"===typeof Reflect&&
"function"===typeof Reflect.decorate)h=Reflect.decorate(a,b,e,c);else for(var k=a.length-1;0<=k;k--)if(g=a[k])h=(3>d?g(h):3<d?g(b,e,h):g(b,e))||h;return 3<d&&h&&Object.defineProperty(b,e,h),h},z=t.k.create(),E=function(b){function d(b,c,h){u(this,d);var g=p(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));g.chunkManager=b;g.layerManager=c;g.navigationState=h;g.gl=g.chunkManager.gl;g.dataToViewport=t.k.create();g.viewportToDevice=t.k.create();g.dataToDevice=t.k.create();g.visibleChunks=new Map;
g.viewChanged=new k.a;g.renderingStale=!0;g.visibleChunksStale=!0;g.visibleLayerList=[];g.newVisibleLayers=new Set;g.offscreenFramebuffer=g.registerDisposer(new e.b(g.gl,{colorBuffers:Object(e.e)(g.gl,1),depthBuffer:new e.d(g.gl)}));g.numVisibleChunks=0;g.updateVisibleLayers=g.registerCancellable(a()(function(){g.updateVisibleLayersNow()},0));g.invalidateVisibleSources=function(){g.visibleSourcesStale=!0;g.viewChanged.dispatch()};g.setViewportSizeDebounced=g.registerCancellable(a()(function(a,b){return g.setViewportSize(a,
b)},0));t.k.identity(g.dataToViewport);g.initializeCounterpart(g.chunkManager.rpc,{chunkManager:b.rpcId});g.registerDisposer(h.changed.add(function(){g.updateViewportFromNavigationState()}));g.updateViewportFromNavigationState();g.registerDisposer(c.layersChanged.add(function(){g.hasValidViewport&&g.updateVisibleLayers()}));g.viewChanged.add(function(){g.renderingStale=!0});g.registerDisposer(b.chunkQueueManager.visibleChunksChanged.add(g.viewChanged.dispatch));g.updateViewportFromNavigationState();
g.updateVisibleLayers();return g}q(d,b);r(d,[{key:"isReady",value:function(){this.setViewportSizeDebounced.flush();if(!this.hasValidViewport)return!1;this.maybeUpdateVisibleChunks();for(var a=0,b=$jscomp.makeIterator(this.visibleLayers.values()),e=b.next();!e.done;e=b.next()){e=$jscomp.makeIterator(e.value);for(var d=e.next();!d.done;d=e.next()){var h=d.value;d=h.source;h=this.visibleChunks.get(h.chunkLayout);if(!h)return!1;d=d.chunks;h=$jscomp.makeIterator(h);for(var g=h.next();!g.done;g=h.next())(g=
d.get(g.value))&&g.state===c.d.GPU_MEMORY&&++a}}return a===this.numVisibleChunks}},{key:"updateViewportFromNavigationState",value:function(){var a=this.navigationState;a.valid&&(a.toMat4(z),this.setViewportToDataMatrix(z))}},{key:"bindVisibleRenderLayer",value:function(a){a.redrawNeeded.add(this.viewChanged.dispatch);a.transform.changed.add(this.invalidateVisibleSources)}},{key:"unbindVisibleRenderLayer",value:function(a){a.redrawNeeded.remove(this.viewChanged.dispatch);a.transform.changed.remove(this.invalidateVisibleSources)}},
{key:"updateVisibleLayersNow",value:function(){if(this.wasDisposed||!this.hasValidViewport)return!1;var a=this.visibleLayers,b=this.rpc,e={id:this.rpcId},c=this.newVisibleLayers,d=!1,h=this.visibleLayerList;h.length=0;for(var g=$jscomp.makeIterator(this.layerManager.readyRenderLayers()),k=g.next();!k.done;k=g.next())k=k.value,k instanceof v.a&&(c.add(k),h.push(k),a.has(k)||(a.set(k.addRef(),[]),this.bindVisibleRenderLayer(k),e.layerId=k.rpcId,b.invoke(n.d,e),d=!0));h=$jscomp.makeIterator(a.keys());
for(k=h.next();!k.done;k=h.next())g=k.value,c.has(g)||(a.delete(g),this.unbindVisibleRenderLayer(g),e.layerId=g.rpcId,b.invoke(n.e,e),g.dispose(),d=!0);c.clear();d&&(this.visibleSourcesStale=!0);this.viewChanged.dispatch();return d}},{key:"onViewportChanged",value:function(){var a=this.width,b=this.height,e=this.viewportToDevice,c=this.dataToViewport,d=this.dataToDevice;t.k.ortho(e,-a/2,a/2,b/2,-b/2,-10,10);t.k.multiply(d,e,c);this.visibleChunksStale=!0;this.viewChanged.dispatch()}},{key:"setViewportSize",
value:function(a,b){this.setViewportSizeDebounced.cancel();return A(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"setViewportSize",this).call(this,a,b)?(this.rpc.invoke(n.i,{id:this.rpcId,width:a,height:b}),!0):!1}},{key:"onViewportToDataMatrixChanged",value:function(){var a=this.viewportToData,b=this.dataToViewport;t.k.invert(b,a);Object(t.o)(b);this.rpc.invoke(n.i,{id:this.rpcId,viewportToData:a})}},{key:"onHasValidViewport",value:function(){this.updateVisibleLayers()}},{key:"updateRendering",
value:function(){this.setViewportSizeDebounced.flush();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 e=
0,c=$jscomp.makeIterator(this.visibleLayerList),d=c.next();!d.done;d=c.next())d=d.value,a.clear(a.STENCIL_BUFFER_BIT),a.stencilFuncSeparate(a.FRONT_AND_BACK,a.GREATER,1,1),d.setGLBlendMode(a,e),d.draw(this),++e;a.disable(a.BLEND);a.disable(a.STENCIL_TEST);b.unbind()}}},{key:"maybeUpdateVisibleChunks",value:function(){this.updateVisibleLayers.flush();if(!this.visibleChunksStale&&!this.visibleSourcesStale)return!1;this.visibleChunksStale=!1;this.updateVisibleChunks();return!0}},{key:"updateVisibleChunks",
value:function(){var a=this.visibleChunks,b=0;this.computeVisibleChunks(function(b){var e=a.get(b);void 0===e?(e=[],a.set(b,e)):e.length=0;return e},function(a,e,c,d){a=Object(t.t)(c);e[e.length]=a;b+=d.length});this.numVisibleChunks=b}},{key:"disposed",value:function(){for(var a=$jscomp.makeIterator(this.visibleLayers.keys()),b=a.next();!b.done;b=a.next())b=b.value,this.unbindVisibleRenderLayer(b),b.dispose();this.visibleLayers.clear();this.visibleLayerList.length=0}}]);return d}(Object(g.c)(n.j));
E=y([Object(d.g)(n.h)],E);var x=function(a){function b(a,e){u(this,b);a=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,e));a.spec=e.spec;return a}q(b,a);r(b,[{key:"initializeCounterpart",value:function(a,e){e.spec=this.spec.toObject();A(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"initializeCounterpart",this).call(this,a,e)}}],[{key:"encodeOptions",value:function(a){var e=A(b.__proto__||Object.getPrototypeOf(b),"encodeOptions",this).call(this,a);e.spec=a.spec.toObject();
return e}}]);return b}(m.e),D=function(a){function b(a,e){u(this,b);a=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));a.chunkGridPosition=e.chunkGridPosition;a.state=c.d.SYSTEM_MEMORY;return a}q(b,a);return b}(m.b),G=function(a){function e(a,c){u(this,e);var d=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));d.gl=a;d.copyVertexPositionsBuffer=Object(h.a)(d.gl);d.textureCoordinateAdjustment=new Float32Array(4);var g=new b.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(c);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");
d.shader=d.registerDisposer(g.build());return d}q(e,a);r(e,[{key:"draw",value:function(a,b,e,c,d,h,g,k){var r=this.gl,l=this.shader,n=this.textureCoordinateAdjustment;n[0]=d;n[1]=h;n[2]=g-d;n[3]=k-h;l.bind();r.activeTexture(r.TEXTURE0);r.bindTexture(r.TEXTURE_2D,a);r.uniformMatrix4fv(l.uniform("uProjectionMatrix"),!1,b);r.uniform4fv(l.uniform("uColorFactor"),e);r.uniform4fv(l.uniform("uBackgroundColor"),c);r.uniform4fv(l.uniform("uTextureCoordinateAdjustment"),n);a=l.attribute("aVertexPosition");
this.copyVertexPositionsBuffer.bindToVertexAttrib(a,2);r.drawArrays(r.TRIANGLE_FAN,0,4);r.disableVertexAttribArray(a);r.bindTexture(r.TEXTURE_2D,null)}}],[{key:"get",value:function(a,b){return a.memoize.get("sliceview/SliceViewRenderHelper:"+Object(l.a)(b),function(){return new e(a,b)})}}]);return e}(f.a)},function(m,f,d){function u(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,
{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}d.d(f,"a",function(){return v});f.b=function(a,d){d=void 0===d?"GET":d;var k=new XMLHttpRequest;k[n]=d;k[c]=a;k.open(d,a);return k};f.c=function(a,d,k){k=void 0===k?"GET":k;var g=new XMLHttpRequest;if(Array.isArray(a)){var e=a.length;e=1===e?0:Math.abs(Object(q.a)(d))%e;a=a[e]+d}else a+=d;g[n]=k;g[c]=a;g.open(k,a);return g};f.e=function(a,c,d){d=void 0===d?p.e:d;a.responseType=
c;return new Promise(function(c,e){var b=function(){a.abort()};d.add(b);a.onloadend=function(){var h=this.status;d.remove(b);200<=h&&300>h?c(this.response):e(v.fromXhr(a))};a.send()})};f.d=function(a){var c=a.match(/^([^:\/]+):\/\/([^\/]+)(\/.*)?$/);if(null===c)throw Error("Invalid URL: "+JSON.stringify(a));return"gs"===c[1]?[["https://storage.googleapis.com/"+c[2]],c[3]]:[[a],""]};var p=d(34),q=d(213),a=function(){function a(a,c){for(var d=0;d<c.length;d++){var e=c[d];e.enumerable=e.enumerable||
!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(c,d,g){d&&a(c.prototype,d);g&&a(c,g);return c}}();$jscomp.initSymbol();var c=Symbol("url");$jscomp.initSymbol();var n=Symbol("method"),v=function(d){function l(a,c,e,b){if(!(this instanceof l))throw new TypeError("Cannot call a class as a function");var d=a+" "+JSON.stringify(c)+" resulted in HTTP error "+e;b&&(d+=": "+b);d+=".";var g=(l.__proto__||Object.getPrototypeOf(l)).call(this,d);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=d;g.method=a;g.url=c;g.code=e;g.statusMessage=b;return g}u(l,d);a(l,null,[{key:"fromXhr",value:function(a){return new l(a[n],a[c],a.status,a.statusText)}}]);return l}(Error)},function(m,f,d){function u(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,
configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}function p(){return new q.f(void 0)}f.c=p;f.b=function(c){return new q.c(c,a.A)};d.d(f,"a",function(){return t});var q=d(6);m=d(0);var a=d(2),c=d(27),n=function(){function a(a,c){for(var e=0;e<c.length;e++){var b=c[e];b.enumerable=b.enumerable||!1;b.configurable=!0;"value"in b&&(b.writable=!0);Object.defineProperty(a,b.key,b)}}return function(c,d,e){d&&a(c.prototype,d);e&&a(c,e);return c}}(),v=function k(a,e,b){null===
a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,e);if(void 0===c){if(a=Object.getPrototypeOf(a),null!==a)return k(a,e,b)}else{if("value"in c)return c.value;e=c.get;return void 0===e?void 0:e.call(b)}},t=function(a){function d(a,b,c,g){g=void 0===g?p():g;if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");var e=(d.__proto__||Object.getPrototypeOf(d)).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
e=!e||"object"!==typeof e&&"function"!==typeof e?this:e;e.gl=a;e.defineShader=b;e.getShaderKey=c;e.shaderError=g;e.shaderUpdated=!0;e.shader=void 0;g.value=void 0;return e}u(d,a);n(d,[{key:"invalidateShader",value:function(){this.shaderUpdated=!0}},{key:"get",value:function(){if(!this.shaderUpdated)return this.shader;this.shaderUpdated=!1;try{var a=this.getShader();this.disposeShader();this.shader=a;this.shaderError.value=null}catch(b){this.shaderError.value=b}return this.shader}},{key:"getShader",
value:function(){var a=this,b=this.getShaderKey();return this.gl.memoize.get(b,function(){return a.buildShader()})}},{key:"buildShader",value:function(){var a=new c.a(this.gl);this.defineShader(a);return a.build()}},{key:"disposed",value:function(){v(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"disposed",this).call(this);this.disposeShader()}},{key:"disposeShader",value:function(){this.shader&&(this.shader.dispose(),this.shader=void 0)}}]);return d}(m.a)},function(m,f,d){f.a=function(d){return new u.c(void 0===
d?.5:d,p.q)};var u=d(6),p=d(2)},function(m,f,d){var u=d(314);m.exports={string:function(d){for(var f=u.randomBytes(d),a=[],c=0;c<d;c++)a.push("abcdefghijklmnopqrstuvwxyz012345".substr(f[c]%32,1));return a.join("")},number:function(d){return Math.floor(Math.random()*d)},numberString:function(d){var f=(""+(d-1)).length;return(Array(f+1).join("0")+this.number(d)).slice(-f)}}},function(m,f,d){(function(f){function p(a){return function(d,k,g){v("create ajax sender",d,k);var e={};"string"===typeof k&&(e.headers=
{"Content-type":"text/plain"});d=c.addPath(d,"/xhr_send");var b=new a("POST",d,k,e);b.once("finish",function(a){v("finish",a);b=null;if(200!==a&&204!==a)return g(Error("http status "+a));g()});return function(){v("abort");b.close();b=null;var a=Error("Aborted");a.code=1E3;g(a)}}}function q(a,c,d,g){n.call(this,a,c,p(g),d,g)}var a=d(4),c=d(22),n=d(162),v=function(){};"production"!==f.env.NODE_ENV&&(v=d(9)("sockjs-client:ajax-based"));a(q,n);m.exports=q}).call(f,d(8))},function(m,f,d){d.d(f,"a",function(){return c});
f.b=function(a,c,d){d(a.transform,c.transform);return c.changed.add(function(){d(a.transform,c.transform);a.changed.dispatch()})};var u=d(1),p=d(2),q=d(3),a=function(){function a(a,c){for(var d=0;d<c.length;d++){var k=c[d];k.enumerable=k.enumerable||!1;k.configurable=!0;"value"in k&&(k.writable=!0);Object.defineProperty(a,k.key,k)}}return function(c,d,l){d&&a(c.prototype,d);l&&a(c,l);return c}}(),c=function(){function c(a){a=void 0===a?u.k.create():a;if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");
this.transform=a;this.changed=new q.a}a(c,[{key:"reset",value:function(){u.k.copy(this.transform,u.d);this.changed.dispatch()}},{key:"toJSON",value:function(){if(!u.k.equals(u.d,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 c=0;4>c;++c)Object(p.b)(this.transform.subarray(4*c,4*(c+1)),a[c]);
u.k.transpose(this.transform,this.transform)}catch(g){this.reset()}else if(16===a.length)try{Object(p.b)(this.transform,a),u.k.transpose(this.transform,this.transform)}catch(g){this.reset()}else this.reset();else if("object"===typeof a){c=u.n.create();var d=u.s.create(),k=u.s.fromValues(1,1,1);try{Object(p.b)(c,a.rotation),u.n.normalize(c,c)}catch(g){u.n.identity(c)}try{Object(p.b)(d,a.translation)}catch(g){u.s.copy(d,u.h)}try{Object(p.b)(k,a.scale)}catch(g){u.s.copy(k,u.g)}u.k.fromRotationTranslationScale(this.transform,
c,d,k);this.changed.dispatch()}else this.reset()}},{key:"clone",value:function(){return new c(u.k.clone(this.transform))}}]);return c}()},function(m,f,d){function u(a,d,f,t,l,k){a=void 0===a?-1:a;d=void 0===d?-1:d;f=void 0===f?1:f;t=void 0===t?1:t;l=void 0===l?1:l;k=void 0===k?1:k;return Object(p.d)(new Float32Array([a,d,a,t,f,t,f,d]),2,l,k)}f.a=function(c,d,f,t,l,k,g){return Object(q.b)(c,a.a,u,void 0===d?-1:d,void 0===f?-1:f,void 0===t?1:t,void 0===l?1:l,void 0===k?1:k,void 0===g?1:g).value};var p=
d(39),q=d(16),a=d(11)},function(m,f,d){function u(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}d.d(f,"a",function(){return q});m=d(15);var p=function(){function a(a,d){for(var c=0;c<d.length;c++){var n=d[c];n.enumerable=n.enumerable||!1;n.configurable=
!0;"value"in n&&(n.writable=!0);Object.defineProperty(a,n.key,n)}}return function(c,d,f){d&&a(c.prototype,d);f&&a(c,f);return c}}(),q=function(a){function c(){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");var a=(c.__proto__||Object.getPrototypeOf(c)).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}u(c,a);p(c,[{key:"draw",value:function(a){}},
{key:"isReady",value:function(){return!0}}]);return c}(m.j)},function(m,f,d){function u(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}d.d(f,"b",function(){return n});m=d(0);var p=d(20);d.d(f,"a",function(){return p.a});d.d(f,"c",function(){return p.c});
var q=function(){function a(a,c){for(var d=0;d<c.length;d++){var g=c[d];g.enumerable=g.enumerable||!1;g.configurable=!0;"value"in g&&(g.writable=!0);Object.defineProperty(a,g.key,g)}}return function(c,d,k){d&&a(c.prototype,d);k&&a(c,k);return c}}(),a=new Set("f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 escape pause".split(" ")),c=new Set("color date datetime datetime-local email month number password search tel text time url week".split(" ")),n=function(d){function n(a,c){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");
var d=(n.__proto__||Object.getPrototypeOf(n)).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.target=a;d.eventMap=c;d.modifierShortcutsAreGlobal=!0;d.allShortcutsAreGlobal=!1;d.allowSpaceKeyOnButtons=!1;d.registerEventListener(a,"keydown",d.handleKeyDown.bind(d),!1);return d}u(n,d);q(n,[{key:"shouldIgnoreEvent",value:function(d,k){var g=k.target,e=g.tagName;if(g===this.target)return!1;
var b="TEXTAREA"===e||"INPUT"===e||"BUTTON"===e||"SELECT"===e,h=!b&&(g.isContentEditable||g.ownerDocument&&"on"===g.ownerDocument.designMode);return!b&&!h||this.allShortcutsAreGlobal||a.has(d)?!1:h||this.modifierShortcutsAreGlobal&&(k.altKey||k.ctrlKey||k.metaKey)?!0:"INPUT"===e&&c.has(g.type)?"enter"!==d:"INPUT"===e||"BUTTON"===e?this.allowSpaceKeyOnButtons?!1:"space"===d:!0}},{key:"handleKeyDown",value:function(a){var c=a.code.toLowerCase();this.shouldIgnoreEvent(c,a)||Object(p.b)(c,a,this.eventMap)}}]);
return n}(m.a)},function(m,f,d){f.a=function(d,f){f.offset+=d;return f};f.b=function(d,f){var p=[];f=$jscomp.makeIterator(f);for(var a=f.next();!a.done;a=f.next())a=a.value,a.startsWith(d)&&p.push({value:a});return p};f.c=function(d,f,q,a){var c=[];f=$jscomp.makeIterator(f);for(var n=f.next();!n.done;n=f.next()){n=n.value;var v=q(n);v.startsWith(d)&&c.push({value:v,description:a(n)})}return c}},function(m,f,d){function u(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 p(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 q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}d.d(f,"a",function(){return y});d.d(f,
"b",function(){return x});var a=d(36);m=d(18);var c=d(215);f=d(54);var n=d(67),v=d(70),t=d(1),l=d(25),k=d(16),g=d(27),e=d(17);d=d(12);var b=function J(a,b,e){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,e)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(e)}},h=function(){function a(a,b){for(var e=0;e<b.length;e++){var c=b[e];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in
c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,e,c){e&&a(b.prototype,e);c&&a(b,c);return b}}(),r=this&&this.__decorate||function(a,b,e,c){var d=arguments.length,h=3>d?b:null===c?c=Object.getOwnPropertyDescriptor(b,e):c,g;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)h=Reflect.decorate(a,b,e,c);else for(var k=a.length-1;0<=k;k--)if(g=a[k])h=(3>d?g(h):3<d?g(b,e,h):g(b,e))||h;return 3<d&&h&&Object.defineProperty(b,e,h),h},A=function(){function a(){q(this,
a);this.tempLightVec=new Float32Array(4);this.tempPickID=new Float32Array(4)}h(a,[{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,e){var c=e.dataToDevice,d=e.lightDirection,h=e.ambientLighting;e=e.directionalLighting;a.uniformMatrix4fv(b.uniform("uProjection"),!1,c);c=this.tempLightVec;t.s.scale(c,d,e);c[3]=h;a.uniform4fv(b.uniform("uLightDirection"),c)}},{key:"setColor",value:function(a,b,e){a.uniform4fv(b.uniform("uColor"),e)}},{key:"setPickID",value:function(a,b,c){a.uniform4fv(b.uniform("uPickID"),Object(e.r)(this.tempPickID,c))}},{key:"beginObject",
value:function(a,b,e){a.uniformMatrix4fv(b.uniform("uModelMatrix"),!1,e)}},{key:"getShader",value:function(a,b){var e=this;return a.memoize.get("mesh/MeshShaderManager:"+Object(l.a)(b),function(){var c=new g.a(a);c.require(b);e.defineShader(c);return c.build()})}},{key:"drawFragment",value:function(a,b,e){e.vertexBuffer.bindToVertexAttrib(b.attribute("aVertexPosition"),3);e.normalBuffer.bindToVertexAttrib(b.attribute("aVertexNormal"),3);e.indexBuffer.bind();a.drawElements(a.TRIANGLES,e.numIndices,
a.UNSIGNED_INT,0)}},{key:"endLayer",value:function(a,b){a.disableVertexAttribArray(b.attribute("aVertexPosition"));a.disableVertexAttribArray(b.attribute("aVertexNormal"))}}]);return a}(),y=function(b){function e(a,b,d){q(this,e);var h=u(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));h.chunkManager=a;h.source=b;h.displayState=d;h.meshShaderManager=new A;h.shaders=new Map;Object(v.f)(d,h);a=h.sharedObject=h.registerDisposer(new v.b(a,d));a.RPC_TYPE_ID=c.b;a.initializeCounterpartWithChunkManager({source:b.addCounterpartRef()});
h.setReady(!0);a.visibility.add(h.visibility);return h}p(e,b);h(e,[{key:"getShader",value:function(a){var b=this.shaders,e=b.get(a);void 0===e&&(e=this.registerDisposer(this.meshShaderManager.getShader(this.gl,a)),b.set(a,e));return e}},{key:"draw",value:function(b){var e=this;if(b.emitColor||!b.alreadyEmittedPickID){var c=this.gl,d=this.displayState,h=this.meshShaderManager,g=Math.min(1,d.objectAlpha.value);if(!(0>=g)){var k=this.getShader(b.emitter);k.bind();h.beginLayer(c,k,b);var r=b.pickIDs,
l=this.displayState.objectToDataTransform.transform;Object(v.d)(d,this.source.fragmentSource.objectChunks,function(n,f,t){b.emitColor&&h.setColor(c,k,Object(v.e)(d,n,g));b.emitPickID&&h.setPickID(c,k,r.registerUint64(e,f));h.beginObject(c,k,l);n=$jscomp.makeIterator(t);for(f=n.next();!f.done;f=n.next())f=f.value,f.state===a.d.GPU_MEMORY&&h.drawFragment(c,k,f)});h.endLayer(c,k)}}}},{key:"isReady",value:function(){var b=this.displayState,e=this.source,c=!0,d=e.fragmentSource.chunks;Object(n.a)(b,function(h){h=
Object(n.b)(h,b.clipBounds.value);var g=e.chunks.get(h);if(void 0===g)c=!1;else{g=$jscomp.makeIterator(g.fragmentIds);for(var k=g.next();!k.done;k=g.next())if(k=d.get(h+"/"+k.value),void 0===k||k.state!==a.d.GPU_MEMORY){c=!1;break}}});return c}},{key:"isTransparent",get:function(){return 1>this.displayState.objectAlpha.value}},{key:"gl",get:function(){return this.chunkManager.chunkQueueManager.gl}}]);return e}(f.a),z=function(a){function b(a,e){q(this,b);a=u(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,
a));a.fragmentIds=e.fragmentIds;return a}p(b,a);return b}(m.b),E=function(a){function e(a,b){q(this,e);a=u(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,a));a.objectKey=b.objectKey;a.vertexPositions=b.vertexPositions;var c=a.indices=b.indices;a.numIndices=c.length;a.vertexNormals=b.vertexNormals;return a}p(e,a);h(e,[{key:"copyToGPU",value:function(a){b(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"copyToGPU",this).call(this,a);this.vertexBuffer=k.a.fromData(a,this.vertexPositions,
a.ARRAY_BUFFER,a.STATIC_DRAW);this.indexBuffer=k.a.fromData(a,this.indices,a.ELEMENT_ARRAY_BUFFER,a.STATIC_DRAW);this.normalBuffer=k.a.fromData(a,this.vertexNormals,a.ARRAY_BUFFER,a.STATIC_DRAW)}},{key:"freeGPUMemory",value:function(a){b(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"freeGPUMemory",this).call(this,a);this.vertexBuffer.dispose();this.indexBuffer.dispose();this.normalBuffer.dispose()}}]);return e}(m.b),x=function(a){function e(){q(this,e);var a=u(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,
arguments));a.fragmentSource=a.registerDisposer(new D(a.chunkManager,a));return a}p(e,a);h(e,[{key:"initializeCounterpart",value:function(a,c){this.fragmentSource.initializeCounterpart(this.chunkManager.rpc,{});c.fragmentSource=this.fragmentSource.addCounterpartRef();b(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"initializeCounterpart",this).call(this,a,c)}},{key:"getChunk",value:function(a){return new z(this,a)}}]);return e}(m.e),D=function(a){function e(a,b){q(this,e);a=u(this,(e.__proto__||
Object.getPrototypeOf(e)).call(this,a));a.meshSource=b;a.objectChunks=new Map;return a}p(e,a);h(e,[{key:"addChunk",value:function(a,c){b(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"addChunk",this).call(this,a,c);a=this.objectChunks;var d=c.objectKey,h=a.get(d);void 0===h&&(h=new Set,a.set(d,h));h.add(c)}},{key:"deleteChunk",value:function(a){var c=this.chunks.get(a);b(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"deleteChunk",this).call(this,a);a=this.objectChunks;var d=
c.objectKey,h=a.get(d);h.delete(c);0===h.size&&a.delete(d)}},{key:"getChunk",value:function(a){return new E(this,a)}}]);return e}(m.e);D=r([Object(d.g)(c.a)],D)},function(m,f,d){function u(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(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 q(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,e,c){var d=!1,h;a.registerDisposer(b);var g=l.UNLINKED,k=function(){var d=e.value;if(d!==g)switch(d){case l.UNLINKED:h=void 0;break;case l.LINKED:h=void 0;c.assign(a,b);break;case l.RELATIVE:h=c.difference(a,b)}g=d;a.changed.dispatch()};a.registerDisposer(a.changed.add(function(){if(!d)switch(e.value){case l.LINKED:c.assign(b,
a);break;case l.RELATIVE:c.subtract(b,a,h)}}));a.registerDisposer(b.changed.add(function(){d=!0;switch(e.value){case l.UNLINKED:if(c.isValid(a))break;case l.LINKED:c.assign(a,b);break;case l.RELATIVE:c.add(a,b,h)}d=!1}));a.registerDisposer(e.changed.add(k));k();return a}d.d(f,"d",function(){return l});d.d(f,"h",function(){return g});d.d(f,"b",function(){return r});d.d(f,"f",function(){return A});d.d(f,"a",function(){return y});d.d(f,"g",function(){return z});d.d(f,"c",function(){return x});d.d(f,
"e",function(){return D});m=d(0);var c=d(1),n=d(2),v=d(3);d=d(260);var t=function(){function a(a,b){for(var e=0;e<b.length;e++){var c=b[e];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,e,c){e&&a(b.prototype,e);c&&a(b,c);return b}}(),l;(function(a){a[a.LINKED=0]="LINKED";a[a.RELATIVE=1]="RELATIVE";a[a.UNLINKED=2]="UNLINKED"})(l||(l={}));var k=function(a){function b(a){a=void 0===a?l.LINKED:a;u(this,b);return p(this,
(b.__proto__||Object.getPrototypeOf(b)).call(this,l,a))}q(b,a);return b}(d.a),g=function(a){function b(a){u(this,b);var e=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));e.changed=new v.a;var d=!0;null==a&&(a=c.s.create(),d=!1);e.size=a;e.valid=d;return e}q(b,a);t(b,[{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{Object(n.b)(this.size,a),this.valid=!0,this.changed.dispatch()}catch(B){this.valid=!1,this.changed.dispatch()}}},{key:"toString",value:function(){return this.valid?this.size.toString():null}},{key:"voxelFromSpatial",value:function(a,b){return c.s.divide(a,b,this.size)}},{key:"spatialFromVoxel",value:function(a,b){return c.s.multiply(a,b,this.size)}}]);return b}(m.a),e=c.s.create(),b=c.n.create(),h=function(a){function b(a,e){u(this,b);var d=p(this,(b.__proto__||
Object.getPrototypeOf(b)).call(this));d.voxelCoordinates=null;d.changed=new v.a;null==a&&(a=new g);d.voxelSize=a;var h=!0;null==e&&(e=c.s.create(),h=!1);d.spatialCoordinates=e;d.spatialCoordinatesValid=h;d.registerDisposer(a);d.registerDisposer(a.changed.add(function(){d.handleVoxelSizeChanged()}));return d}q(b,a);t(b,[{key:"reset",value:function(){this.spatialCoordinatesValid=!1;this.voxelCoordinates=null;this.voxelSize.reset();this.changed.dispatch()}},{key:"getVoxelCoordinates",value:function(a){var b=
this.voxelCoordinates;if(b)c.s.copy(a,b);else if(this.valid)this.voxelSize.voxelFromSpatial(a,this.spatialCoordinates);else return!1;return!0}},{key:"setVoxelCoordinates",value:function(a){var b=this.voxelSize;b.valid?(b.spatialFromVoxel(this.spatialCoordinates,a),this.markSpatialCoordinatesChanged()):(b=this.voxelCoordinates)?c.s.copy(b,a):this.voxelCoordinates=c.s.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(),c={};void 0!==b&&(a=!1,c.voxelSize=b);this.voxelCoordinatesValid?(this.getVoxelCoordinates(e),c.voxelCoordinates=Array.prototype.slice.call(e),
a=!1):this.spatialCoordinatesValid&&(c.spatialCoordinates=Array.prototype.slice.call(this.spatialCoordinates),a=!1);if(!a)return c}},{key:"restoreState",value:function(a){var b=this;Object(n.t)(a);Object(n.v)(a,"voxelSize",function(a){void 0!==a&&b.voxelSize.restoreState(a)});this.spatialCoordinatesValid=!1;Object(n.v)(a,"voxelCoordinates",function(a){void 0!==a&&b.setVoxelCoordinates(Object(n.b)(c.s.create(),a))});Object(n.v)(a,"spatialCoordinates",function(a){void 0!==a&&(Object(n.b)(b.spatialCoordinates,
a),b.markSpatialCoordinatesChanged())})}},{key:"snapToVoxel",value:function(){if(this.valid){for(var a=this.spatialCoordinates,b=this.voxelSize.size,e=0;3>e;++e){var c=b[e];a[e]=Math.round(a[e]/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:"assign",value:function(a){this.spatialCoordinatesValid=a.spatialCoordinatesValid;c.s.copy(this.spatialCoordinates,a.spatialCoordinates);this.voxelCoordinates=(a=a.voxelCoordinates)&&
c.s.clone(a);this.changed.dispatch()}},{key:"valid",get:function(){return this.spatialCoordinatesValid&&this.voxelSize.valid}},{key:"voxelCoordinatesValid",get:function(){return this.valid||null!=this.voxelCoordinates}}],[{key:"getOffset",value:function(a,b){if(a.spatialCoordinatesValid&&b.spatialCoordinatesValid)return{spatialOffset:c.s.subtract(c.s.create(),a.spatialCoordinates,b.spatialCoordinates)};if(a.voxelCoordinates&&b.voxelCoordinates){if(a.voxelSize!==b.voxelSize)throw Error("Voxel offsets are only meaningful with identical voxelSize.");
return{voxelOffset:c.s.subtract(c.s.create(),a.voxelCoordinates,b.voxelCoordinates)}}return{}}},{key:"addOffset",value:function(a,b,d,h){h=void 0===h?1:h;var g=d.spatialOffset;d=d.voxelOffset;void 0!==g&&b.spatialCoordinatesValid?(c.s.scaleAndAdd(a.spatialCoordinates,b.spatialCoordinates,g,h),a.markSpatialCoordinatesChanged()):void 0!==d&&b.getVoxelCoordinates(e)&&a.setVoxelCoordinates(c.s.scaleAndAdd(e,e,d,h))}}]);return b}(m.a);d=function(){function a(b,e){e=void 0===e?new k:e;u(this,a);this.peer=
b;this.link=e}t(a,[{key:"toJSON",value:function(){var a=this.link;if(a.value!==l.LINKED)return{link:a.toJSON(),value:this.getValueJson()}}},{key:"getValueJson",value:function(){return this.value.toJSON()}},{key:"reset",value:function(){this.link.value=l.LINKED}},{key:"restoreState",value:function(a){var b=this;void 0===a||0===Object.keys(a).length?this.link.value=l.LINKED:(Object(n.t)(a),this.link.value=l.UNLINKED,Object(n.v)(a,"value",function(a){void 0!==a&&b.value.restoreState(a)}),Object(n.v)(a,
"link",function(a){return b.link.restoreState(a)}))}},{key:"copyToPeer",value:function(){this.link.value!==l.LINKED&&(this.link.value=l.UNLINKED,this.peer.assign(this.value),this.link.value=l.LINKED)}},{key:"changed",get:function(){return this.value.changed}}]);return a}();var r=function(b){function e(){u(this,e);var b=p(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments));b.value=a(new h(b.peer.voxelSize.addRef()),b.peer,b.link,{assign:function(a,b){return a.assign(b)},isValid:function(a){return a.spatialCoordinatesValid||
a.voxelCoordinatesValid},difference:h.getOffset,add:h.addOffset,subtract:function(a,b,e){h.addOffset(a,b,e,-1)}});return b}q(e,b);t(e,[{key:"getValueJson",value:function(){var a=this.value.toJSON()||{};delete a.voxelSize;return a}}]);return e}(d),A=function(a){function b(a){u(this,b);var e=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));e.changed=new v.a;null==a&&(a=c.n.create());e.orientation=a;return e}q(b,a);t(b,[{key:"toJSON",value:function(){var a=this.orientation;c.n.normalize(this.orientation,
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{Object(n.b)(this.orientation,a),c.n.normalize(this.orientation,this.orientation)}catch(B){c.n.identity(this.orientation)}this.changed.dispatch()}},{key:"reset",value:function(){c.n.identity(this.orientation);this.changed.dispatch()}},{key:"snap",value:function(){var a=c.i.create();c.i.fromQuat(a,this.orientation);for(var b=[!1,!1,!1],e=0;3>e;++e){for(var d=
0,h=0,g=0;3>g;++g){var k=a[3*e+g];a[3*e+g]=0;!b[g]&&Math.abs(k)>Math.abs(d)&&(d=k,h=g)}a[3*e+h]=Math.sign(d);b[h]=!0}c.n.fromMat3(this.orientation,a);this.changed.dispatch()}},{key:"assign",value:function(a){c.n.copy(this.orientation,a.orientation);this.changed.dispatch()}}],[{key:"makeRelative",value:function(a,e){var d=new b(c.n.multiply(c.n.create(),a.orientation,e)),h=!1;d.registerDisposer(a.changed.add(function(){h||(g=!0,c.n.multiply(d.orientation,a.orientation,e),d.changed.dispatch(),g=!1)}));
var g=!1,k=c.n.invert(c.n.create(),e);d.registerDisposer(d.changed.add(function(){g||(h=!0,c.n.multiply(a.orientation,d.orientation,k),a.changed.dispatch(),h=!1)}));return d}}]);return b}(m.a),y=function(e){function d(){u(this,d);var e=p(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments));e.value=a(new A,e.peer,e.link,{assign:function(a,b){return a.assign(b)},isValid:function(){return!0},difference:function(a,b){var e=c.n.create();return c.n.multiply(e,c.n.invert(e,b.orientation),
a.orientation)},add:function(a,b,e){c.n.multiply(a.orientation,b.orientation,e);a.changed.dispatch()},subtract:function(a,e,d){c.n.multiply(a.orientation,e.orientation,c.n.invert(b,d));a.changed.dispatch()}});return e}q(d,e);return d}(d),z=function(a){function d(a,b){u(this,d);var e=p(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));e.changed=new v.a;null==a&&(a=new h);e.position=a;null==b&&(b=new A);e.orientation=b;e.registerDisposer(e.position);e.registerDisposer(e.orientation);e.registerDisposer(e.position.changed.add(e.changed.dispatch));
e.registerDisposer(e.orientation.changed.add(e.changed.dispatch));return e}q(d,a);t(d,[{key:"reset",value:function(){this.position.reset();this.orientation.reset()}},{key:"toMat4",value:function(a){c.k.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;Object(n.t)(a);
Object(n.v)(a,"position",function(a){void 0!==a&&b.position.restoreState(a)});Object(n.v)(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){c.s.add(this.position.spatialCoordinates,this.position.spatialCoordinates,a);this.position.changed.dispatch()}},{key:"translateRelative",value:function(a){this.valid&&(c.s.transformQuat(e,
a,this.orientation.orientation),c.s.add(this.position.spatialCoordinates,this.position.spatialCoordinates,e),this.position.changed.dispatch())}},{key:"translateVoxelsRelative",value:function(a){if(this.valid){var b=c.s.create();c.s.transformQuat(b,a,this.orientation.orientation);c.s.multiply(b,b,this.position.voxelSize.size);c.s.add(this.position.spatialCoordinates,this.position.spatialCoordinates,b);this.position.changed.dispatch()}}},{key:"rotateRelative",value:function(a,b){var e=c.n.create();
c.n.setAxisAngle(e,a,b);a=this.orientation.orientation;c.n.multiply(a,a,e);this.orientation.changed.dispatch()}},{key:"rotateAbsolute",value:function(a,d,h){var g=c.n.create();c.n.setAxisAngle(g,a,d);a=this.orientation.orientation;if(void 0!==h){d=this.position.spatialCoordinates;var k=c.s.subtract(e,h,d),r=c.n.invert(b,a);c.s.transformQuat(k,k,r);c.n.multiply(a,g,a);c.s.transformQuat(d,k,a);c.s.subtract(d,h,d);this.position.changed.dispatch()}else c.n.multiply(a,g,a);this.orientation.changed.dispatch()}},
{key:"valid",get:function(){return this.position.valid}}]);return d}(m.a),E=function(a){function b(a,e){a=void 0===a?Number.NaN:a;e=void 0===e?a:e;u(this,b);var c=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.value_=a;c.defaultValue=e;c.changed=new v.a;return c}q(b,a);t(b,[{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:"assign",value:function(a){this.value=a.value}},{key:"value",get:function(){return this.value_},set:function(a){a!==this.value_&&(this.value_=a,this.changed.dispatch())}},{key:"valid",get:function(){return!Number.isNaN(this.value)}}]);return b}(m.a),x=function(b){function e(){u(this,e);var b=p(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,
arguments));b.value=function(){var e=new E;return a(e,b.peer,b.link,{assign:function(a,b){return a.assign(b)},isValid:function(a){return a.valid},difference:function(a,b){return a.value/b.value},add:function(a,b,e){a.value=b.value*e},subtract:function(a,b,e){a.value=b.value/e}})}();return b}q(e,b);return e}(d),D=function(a){function b(a,e){a=void 0===a?new z:a;e=void 0===e?Number.NaN:e;u(this,b);var c=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.pose=a;c.changed=new v.a;c.zoomFactor=
"number"===typeof e?new E(e):e;c.registerDisposer(c.zoomFactor);c.registerDisposer(a);c.registerDisposer(c.pose.changed.add(function(){c.changed.dispatch()}));c.registerDisposer(c.zoomFactor.changed.add(function(){c.changed.dispatch()}));c.registerDisposer(c.voxelSize.changed.add(function(){c.handleVoxelSizeChanged()}));c.handleVoxelSizeChanged();return c}q(b,a);t(b,[{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(){this.zoomFactor.valid||this.setZoomFactorFromVoxelSize()}},{key:"toMat4",value:function(a){this.pose.toMat4(a);var b=this.zoomFactor.value;c.k.scale(a,a,c.s.fromValues(b,b,b))}},{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{Object(n.t)(a),Object(n.v)(a,
"pose",function(a){void 0!==a&&b.pose.restoreState(a)}),Object(n.v)(a,"zoomFactor",function(a){void 0!==a&&b.zoomFactor.restoreState(a)}),this.handleVoxelSizeChanged(),this.changed.dispatch()}catch(F){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 b}(m.a)},function(m,f,d){function u(d,
a,c){p.call(this,d,a,c,{noCredentials:!0})}f=d(4);var p=d(163);f(u,p);u.enabled=p.enabled;m.exports=u},function(m,f,d){(function(d){m.exports={isOpera:function(){return d.navigator&&/opera/i.test(d.navigator.userAgent)},isKonqueror:function(){return d.navigator&&/konqueror/i.test(d.navigator.userAgent)},hasDomain:function(){if(!d.document)return!0;try{return!!d.document.domain}catch(p){return!1}}}}).call(f,d(7))},function(m,f,d){(function(f,p){var q=d(38),a=d(33),c=d(60),n=function(){};"production"!==
f.env.NODE_ENV&&(n=d(9)("sockjs-client:utils:iframe"));m.exports={WPrefix:"_jp",currentWindowId:null,polluteGlobalNamespace:function(){m.exports.WPrefix in p||(p[m.exports.WPrefix]={})},postMessage:function(c,d){p.parent!==p?p.parent.postMessage(a.stringify({windowId:m.exports.currentWindowId,type:c,data:d||""}),"*"):n("Cannot postMessage, no parent window.",c,d)},createIframe:function(a,c){var d=p.document.createElement("iframe"),k=function(){n("unattach");clearTimeout(b);try{d.onload=null}catch(r){}d.onerror=
null},g=function(){n("cleanup");d&&(k(),setTimeout(function(){d&&d.parentNode.removeChild(d);d=null},0),q.unloadDel(h))},e=function(a){n("onerror",a);d&&(g(),c(a))};d.src=a;d.style.display="none";d.style.position="absolute";d.onerror=function(){e("onerror")};d.onload=function(){n("onload");clearTimeout(b);b=setTimeout(function(){e("onload timeout")},2E3)};p.document.body.appendChild(d);var b=setTimeout(function(){e("timeout")},15E3);var h=q.unloadAdd(g);return{post:function(a,b){n("post",a,b);try{setTimeout(function(){d&&
d.contentWindow&&d.contentWindow.postMessage(a,b)},0)}catch(y){}},cleanup:g,loaded:k}},createHtmlfile:function(a,c){var d=["Active"].concat("Object").join("X"),k=new p[d]("htmlfile"),g=function(){clearTimeout(r);h.onerror=null},e=function(){k&&(g(),q.unloadDel(f),h.parentNode.removeChild(h),h=k=null,CollectGarbage())},b=function(a){n("onerror",a);k&&(e(),c(a))};k.open();k.write('<html><script>document.domain="'+p.document.domain+'";\x3c/script></html>');k.close();k.parentWindow[m.exports.WPrefix]=
p[m.exports.WPrefix];d=k.createElement("div");k.body.appendChild(d);var h=k.createElement("iframe");d.appendChild(h);h.src=a;h.onerror=function(){b("onerror")};var r=setTimeout(function(){b("timeout")},15E3);var f=q.unloadAdd(e);return{post:function(a,b){try{setTimeout(function(){h&&h.contentWindow&&h.contentWindow.postMessage(a,b)},0)}catch(E){}},cleanup:e,loaded:g}}};m.exports.iframeEnabled=!1;p.document&&(m.exports.iframeEnabled=("function"===typeof p.postMessage||"object"===typeof p.postMessage)&&
!c.isKonqueror())}).call(f,d(8),d(7))},function(m,f,d){var u=d(184);d.d(f,"b",function(){return u.a});var p=d(77);d.d(f,"c",function(){return p.b});var q=d(197);d.d(f,"a",function(){return q.a});d.d(f,"d",function(){return q.b});d.d(f,"e",function(){return q.c})},function(m,f,d){function u(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,
configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}d.d(f,"a",function(){return c});var p=d(6);m=d(12);var q=function(){function a(a,c){for(var d=0;d<c.length;d++){var g=c[d];g.enumerable=g.enumerable||!1;g.configurable=!0;"value"in g&&(g.writable=!0);Object.defineProperty(a,g.key,g)}}return function(c,d,k){d&&a(c.prototype,d);k&&a(c,k);return c}}(),a=function t(a,c,d){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,c);if(void 0===e){if(a=
Object.getPrototypeOf(a),null!==a)return t(a,c,d)}else{if("value"in e)return e.value;c=e.get;return void 0===c?void 0:c.call(d)}};f=this&&this.__decorate||function(a,c,d,g){var e=arguments.length,b=3>e?c:null===g?g=Object.getOwnPropertyDescriptor(c,d):g,h;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)b=Reflect.decorate(a,c,d,g);else for(var k=a.length-1;0<=k;k--)if(h=a[k])b=(3>e?h(b):3<e?h(c,d,b):h(c,d))||b;return 3<e&&b&&Object.defineProperty(c,d,b),b};var c=n=function(c){function d(a,
c){c=void 0===c?{}:c;if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");var e=(d.__proto__||Object.getPrototypeOf(d)).call(this,a,c);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");e=!e||"object"!==typeof e&&"function"!==typeof e?this:e;e.updatingValue_=!1;void 0!==a&&(e.base=new p.f(c.value),e.setupChangedHandler());return e}u(d,c);q(d,[{key:"initializeCounterpart",value:function(c,g){g=void 0===g?{}:g;g.value=this.value;
a(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"initializeCounterpart",this).call(this,c,g)}},{key:"setupChangedHandler",value:function(){var a=this;this.registerDisposer(this.base.changed.add(function(){if(a.updatingValue_)a.updatingValue_=!1;else{var c=a.rpc;null!==c&&c.invoke("SharedWatchableValue.changed",{id:a.rpcId,value:a.value})}}))}},{key:"value",get:function(){return this.base.value},set:function(a){this.base.value=a}},{key:"changed",get:function(){return this.base.changed}}],
[{key:"makeFromExisting",value:function(a,c){var e=new n;e.base=c;e.setupChangedHandler();e.initializeCounterpart(a);return e}},{key:"make",value:function(a,c){return n.makeFromExisting(a,new p.f(c))}}]);return d}(m.c);c=n=f([Object(m.f)("SharedWatchableValue")],c);Object(m.e)("SharedWatchableValue.changed",function(a){var c=this.get(a.id);c.updatingValue_=!0;c.base.value=a.value;c.updatingValue_=!1});var n},function(m,f,d){function u(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+
typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}function p(a,c){if(!(a instanceof c))throw new TypeError("Cannot call a class as a function");}d.d(f,"a",function(){return v});d.d(f,"b",function(){return t});var q=d(0),a=d(2),c=function k(a,e,b){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,e);if(void 0===c){if(a=Object.getPrototypeOf(a),
null!==a)return k(a,e,b)}else{if("value"in c)return c.value;e=c.get;return void 0===e?void 0:e.call(b)}},n=function(){function a(a,e){for(var b=0;b<e.length;b++){var c=e[b];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(c,e,b){e&&a(c.prototype,e);b&&a(c,b);return c}}(),v=function(){function a(){p(this,a);this.map=new Map}n(a,[{key:"get",value:function(a,e){var b=this.map,c=b.get(a);void 0===c?(c=e(),c.registerDisposer(function(){b.delete(a)}),
b.set(a,c)):c.addRef();return c}}]);return a}(),t=function(d){function g(){p(this,g);var a=(g.__proto__||Object.getPrototypeOf(g)).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}u(g,d);n(g,[{key:"get",value:function(e,b){"string"!==typeof e&&(e=Object(a.g)(e));return c(g.prototype.__proto__||Object.getPrototypeOf(g.prototype),"get",this).call(this,e,b)}},{key:"getUncounted",
value:function(a,b){return this.get(a,function(){return new q.b(b())}).value}}]);return g}(v)},function(m,f,d){function u(a,c){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!c||"object"!==typeof c&&"function"!==typeof c?a:c}function p(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,
configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}d.d(f,"a",function(){return t});var q=d(52);m=d(15);var a=d(31),c=d(1),n=d(12),v=function(){function a(a,c){for(var e=0;e<c.length;e++){var b=c[e];b.enumerable=b.enumerable||!1;b.configurable=!0;"value"in b&&(b.writable=!0);Object.defineProperty(a,b.key,b)}}return function(c,d,e){d&&a(c.prototype,d);e&&a(c,e);return c}}(),t=function(d){function k(d,e,b){b=void 0===b?{}:b;if(!(this instanceof k))throw new TypeError("Cannot call a class as a function");
var h=u(this,(k.__proto__||Object.getPrototypeOf(k)).call(this));h.chunkManager=d;h.sources=e;h.rpcId=null;h.transformedSourcesGeneration=-1;d=b;var g=void 0===d.transform?new q.a:d.transform;h.transform=g;d=Object(a.o)(h)[0][0];b=d.source.spec;d=h.voxelSize=d.chunkLayout.localSpatialVectorToGlobal(c.s.create(),b.voxelSize);for(b=0;3>b;++b)d[b]=Math.abs(d[b]);d=h.registerDisposer(new n.b);var f=h.chunkManager.rpc;d.RPC_TYPE_ID=a.f;e=e.map(function(a){return a.map(function(a){return a.rpcId})});d.initializeCounterpart(f,
{sources:e,transform:g.transform});h.rpcId=d.rpcId;h.registerDisposer(g.changed.add(function(){f.invoke(a.g,{id:h.rpcId,value:g.transform})}));h.setReady(!0);return h}p(k,d);v(k,[{key:"setGLBlendMode",value:function(a,e){0<e&&(a.enable(a.BLEND),a.blendFunc(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA))}},{key:"gl",get:function(){return this.chunkManager.chunkQueueManager.gl}}]);return k}(m.f)},function(m,f,d){function u(d){d.texParameteri(p.x,p.z,p.n);d.texParameteri(p.x,p.y,p.n);d.texParameteri(p.x,p.A,p.c);
d.texParameteri(p.x,p.B,p.c)}f.b=u;f.a=function(d,a,c,n,f,t){f=void 0===f?p.s:f;t=void 0===t?p.G:t;d.activeTexture(p.w+d.tempTextureUnit);d.bindTexture(p.x,a);u(d);d.texImage2D(p.x,0,f,c,n,0,f,t,null);d.bindTexture(p.x,null)};f.c=function(d,a,c){d.activeTexture(p.w+d.tempTextureUnit);d.bindTexture(p.x,a);d.texParameteri(p.x,p.z,p.k);d.texParameteri(p.x,p.y,p.k);d.texParameteri(p.x,p.A,p.c);d.texParameteri(p.x,p.B,p.c);d.pixelStorei(p.F,!0);d.pixelStorei(p.E,4);d.texImage2D(p.x,0,p.s,p.s,p.G,c);d.pixelStorei(p.F,
!1);d.bindTexture(p.x,null)};var p=d(11)},function(m,f,d){f.b=function(d,f){return d.low+","+d.high+(f?"_"+f.center.toString()+"_"+f.size.toString():"")};f.a=function(d,f){var p=d.segmentEquivalences;d=$jscomp.makeIterator(d.visibleSegments);for(var a=d.next();!a.done;a=d.next())if(a=a.value,p.disjointSets.isMinElement(a))for(var c=$jscomp.makeIterator(p.setElements(a)),n=c.next();!n.done;n=c.next())f(n.value,a)}},function(m,f,d){function u(a,e){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!e||"object"!==typeof e&&"function"!==typeof e?a:e}function p(a,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);a.prototype=Object.create(e&&e.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});e&&(Object.setPrototypeOf?Object.setPrototypeOf(a,e):a.__proto__=e)}function q(a,e){if(!(a instanceof e))throw new TypeError("Cannot call a class as a function");}d.d(f,"a",function(){return k});m=
d(5);var a=d.n(m);m=d(0);var c=d(206),n=function(){function a(a,b){for(var e=0;e<b.length;e++){var c=b[e];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(e,b,c){b&&a(e.prototype,b);c&&a(e,c);return e}}(),v=function e(a,c,d){null===a&&(a=Function.prototype);var b=Object.getOwnPropertyDescriptor(a,c);if(void 0===b){if(a=Object.getPrototypeOf(a),null!==a)return e(a,c,d)}else{if("value"in b)return b.value;c=b.get;return void 0===
c?void 0:c.call(d)}},t=new function b(){q(this,b);c.a.initializeHead(this)},l=a()(function(){var a=document.activeElement;if(null===a||a===document.body)a=c.a.front(t),null!==a&&a.element.focus()});window.addEventListener("focus",function(){l()},!0);window.addEventListener("blur",function(){l()},!0);var k=function(b){function d(b){q(this,d);var h=u(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));h.element=b;h.prev0=null;h.next0=null;h.lastFocusedElement=null;h.scheduleUpdateFocus=h.registerCancellable(a()(function(){var a=
document.activeElement,b=h.element;b.contains(a)||((a===h.lastFocusedElement||a.contains(b))&&h.element.focus(),h.lastFocusedElement=null)},0));b.tabIndex=-1;h.registerEventListener(b,"mouseenter",function(){h.lastFocusedElement=document.activeElement;h.scheduleUpdateFocus()});h.registerEventListener(b,"mouseleave",function(){h.scheduleUpdateFocus.cancel()});c.a.insertBefore(t,h);h.registerEventListener(b,"focus",function(){c.a.pop(h);c.a.insertAfter(t,h)});l();return h}p(d,b);n(d,[{key:"disposed",
value:function(){c.a.pop(this);v(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"disposed",this).call(this)}}]);return d}(m.a)},function(m,f,d){function u(a,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);a.prototype=Object.create(e&&e.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});e&&(Object.setPrototypeOf?Object.setPrototypeOf(a,e):a.__proto__=e)}function p(a,e){if(!(a instanceof
e))throw new TypeError("Cannot call a class as a function");}function q(a){for(var e=t.length,b=t[e-1],c=0;c<e;++c){var d=t[c];if(a>=d.lengthInNanometers){b=d;break}}return b}f.b=q;f.c=function(a){for(var e=t.length,b=t[e-1],c=0;c<e;++c){var d=t[c];if(a>=Math.pow(d.lengthInNanometers,3)){b=d;break}}return b};d.d(f,"a",function(){return k});m=d(0);var a=d(66),c=function e(a,c,d){null===a&&(a=Function.prototype);var b=Object.getOwnPropertyDescriptor(a,c);if(void 0===b){if(a=Object.getPrototypeOf(a),
null!==a)return e(a,c,d)}else{if("value"in b)return b.value;c=b.get;return void 0===c?void 0:c.call(d)}},n=function(){function a(a,e){for(var b=0;b<e.length;b++){var c=e[b];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,e,c){e&&a(b.prototype,e);c&&a(b,c);return b}}(),v=[1.5,2,3,5,7.5,10],t=[{unit:"km",lengthInNanometers:1E12},{unit:"m",lengthInNanometers:1E9},{unit:"mm",lengthInNanometers:1E6},{unit:"\u00b5m",lengthInNanometers:1E3},
{unit:"nm",lengthInNanometers:1},{unit:"pm",lengthInNanometers:.001}],l=function(){function a(){p(this,a);this.allowedSignificands=v;this.prevTargetLengthInPixels=this.prevNanometersPerPixel=this.nanometersPerPixel=this.targetLengthInPixels=0}n(a,[{key:"update",value:function(){var a=this.nanometersPerPixel,e=this.targetLengthInPixels;if(this.prevNanometersPerPixel===a&&this.prevTargetLengthInPixels===e)return!1;this.prevNanometersPerPixel=a;this.prevTargetLengthInPixels=e;var c=e*a;e=Math.pow(10,
Math.floor(Math.log(c)/Math.LN10));c/=e;for(var d=1,k=$jscomp.makeIterator(this.allowedSignificands),f=k.next();!f.done;f=k.next())if(f=f.value,Math.abs(f-c)<Math.abs(d-c))d=f;else break;e*=d;c=q(e);this.lengthInPixels=Math.round(e/a);this.physicalUnit=c.unit;this.physicalLength=e/c.lengthInNanometers;return!0}}]);return a}(),k=function(e){function b(a,e){e=void 0===e?new l:e;p(this,b);var c=(b.__proto__||Object.getPrototypeOf(b)).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;c.gl=a;c.dimensions=e;c.texture=null;c.width=0;c.height=0;return c}u(b,e);n(b,[{key:"update",value:function(){var b=this.dimensions,e=this.texture;if(b.update()||null===e){null===e&&(e=this.texture=this.gl.createTexture());var c=this.gl,d=document.createElement("canvas"),k=d.getContext("2d");k.font="bold 15px sans-serif";k.fillStyle="white";var f=b.physicalLength+" "+b.physicalUnit,n=k.measureText(f);n=Math.max(b.lengthInPixels,n.width)+4;d.width=
n;d.height=32;k.font="bold 15px sans-serif";k.textAlign="center";k.fillStyle="rgba(0, 0, 0, 0.3)";k.fillRect(0,0,n,32);k.fillStyle="white";k.fillText(f,n/2,17);k.fillRect(2,22,b.lengthInPixels,8);Object(a.c)(c,e,d);this.width=n;this.height=32}}},{key:"disposed",value:function(){this.gl.deleteTexture(this.texture);this.texture=null;c(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}}]);return b}(m.a)},function(m,f,d){function u(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 p(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 q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function a(a,b){var e=b.redrawNeeded.dispatch;
b.registerDisposer(a.segmentColorHash.changed.add(e));b.registerDisposer(a.visibleSegments.changed.add(e));b.registerDisposer(a.highlightedSegments.changed.add(e));b.registerDisposer(a.segmentEquivalences.changed.add(e));b.registerDisposer(a.segmentSelectionState.changed.add(e))}d.d(f,"c",function(){return e});d.d(f,"a",function(){return b});f.g=a;f.f=function(b,e){a(b,e);e.registerDisposer(b.objectAlpha.changed.add(e.redrawNeeded.dispatch));e.registerDisposer(b.objectToDataTransform.changed.add(e.redrawNeeded.dispatch))};
f.e=function(a,b,e){e=void 0===e?1:e;var c=h;c[3]=e;a.segmentColorHash.compute(c,b);if(a.segmentSelectionState.isSelected(b))for(var d=0;3>d;++d)c[d]=.5*c[d]+.5;d=new Float32Array(3);Object(n.b)(d,c[0],c[1],c[2]);d[1]*=a.saturation.value;var g=new Float32Array(3);Object(n.a)(g,d[0],d[1],d[2]);c[0]=g[0];c[1]=g[1];c[2]=g[2];a.highlightedSegments.has(b)&&(c[0]=.2,c[1]=.2,c[2]=2,c[3]=1);c[0]*=e;c[1]*=e;c[2]*=e;return c};f.d=function(a,b,e){Object(c.a)(a,function(d,h){var g=Object(c.b)(d,a.clipBounds.value);
g=b.get(g);void 0!==g&&e(h,d,g)})};d.d(f,"b",function(){return r});var c=d(67),n=d(123);m=d(0);f=d(1);var v=d(3),t=d(14),l=d(24);d=d(12);var k=function y(a,b,e){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,b);if(void 0===c){if(a=Object.getPrototypeOf(a),null!==a)return y(a,b,e)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(e)}},g=function(){function a(a,b){for(var e=0;e<b.length;e++){var c=b[e];c.enumerable=c.enumerable||!1;c.configurable=!0;
"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,e,c){e&&a(b.prototype,e);c&&a(b,c);return b}}(),e=function(){function a(b,e){q(this,a);this.key=b;this.value=e}g(a,[{key:"toString",value:function(){return this.key+"\u2192"+this.value}}]);return a}(),b=function(a){function b(){q(this,b);var a=u(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));a.selectedSegment=new t.a;a.hasSelectedSegment=!1;a.changed=new v.a;return a}p(b,a);g(b,[{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&&t.a.equal(a,this.selectedSegment)}},{key:"bindTo",value:function(a,b){var c=this,d=new t.a;this.registerDisposer(a.changed.add(function(){var h=a.get(b);"number"===typeof h?(d.low=h,
d.high=0,h=d):h instanceof e&&(h=h.value);c.set(h)}))}}]);return b}(m.a),h=f.u.create(),r=function(a){function b(a,e){q(this,b);var c=u(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.chunkManager=a;c.displayState=e;return c}p(b,a);g(b,[{key:"initializeCounterpartWithChunkManager",value:function(a){var e=this.displayState;a.chunkManager=this.chunkManager.rpcId;a.visibleSegments=e.visibleSegments.rpcId;a.segmentEquivalences=e.segmentEquivalences.rpcId;a.clipBounds=e.clipBounds.rpcId;k(b.prototype.__proto__||
Object.getPrototypeOf(b.prototype),"initializeCounterpart",this).call(this,this.chunkManager.rpc,a)}}]);return b}(Object(l.c)(d.b))},function(m,f,d){function u(a,c){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!c||"object"!==typeof c&&"function"!==typeof c?a:c}function p(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,
enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}d.d(f,"a",function(){return n});m=d(0);var q=d(10),a=function(){function a(a,c){for(var d=0;d<c.length;d++){var g=c[d];g.enumerable=g.enumerable||!1;g.configurable=!0;"value"in g&&(g.writable=!0);Object.defineProperty(a,g.key,g)}}return function(c,d,k){d&&a(c.prototype,d);k&&a(c,k);return c}}(),c=function t(a,c,d){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,
c);if(void 0===e){if(a=Object.getPrototypeOf(a),null!==a)return t(a,c,d)}else{if("value"in e)return e.value;c=e.get;return void 0===c?void 0:c.call(d)}};d(237);var n=function(d){function f(a,c){var e=void 0===c?{}:c;c=void 0===e.min?0:e.min;var b=void 0===e.max?1:e.max;e=void 0===e.step?.01:e.step;if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var d=u(this,(f.__proto__||Object.getPrototypeOf(f)).call(this));d.value=a;d.element=document.createElement("label");d.promptElement=
document.createElement("span");d.inputElement=document.createElement("input");var g=d.element,k=d.promptElement,n=d.inputElement;g.className="range-slider";k.className="range-prompt";n.type="range";n.min=""+c;n.max=""+b;n.step=""+e;n.valueAsNumber=d.value.value;g.appendChild(k);g.appendChild(n);var l=function(){d.value.value=d.inputElement.valueAsNumber};d.registerEventListener(n,"change",l);d.registerEventListener(n,"input",l);d.registerEventListener(n,"wheel",function(a){a=a.deltaY;0<a?(d.inputElement.stepUp(),
l()):0>a&&(d.inputElement.stepDown(),l())});a.changed.add(function(){d.inputElement.valueAsNumber=d.value.value});return d}p(f,d);a(f,[{key:"disposed",value:function(){Object(q.b)(this.element);c(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"disposed",this).call(this)}}]);return f}(m.a)},function(m,f){},function(m,f,d){(function(f){function p(d,f){c(d);a.call(this);var n=this;this.bufferPosition=0;this.xo=new f("POST",d,null);this.xo.on("chunk",this._chunkHandler.bind(this));this.xo.once("finish",
function(a,d){c("finish",a,d);n._chunkHandler(a,d);n.xo=null;a=200===a?"network":"permanent";c("close",a);n.emit("close",null,a);n._cleanup()})}var q=d(4),a=d(13).EventEmitter,c=function(){};"production"!==f.env.NODE_ENV&&(c=d(9)("sockjs-client:receiver:xhr"));q(p,a);p.prototype._chunkHandler=function(a,d){c("_chunkHandler",a);if(200===a&&d)for(;;this.bufferPosition+=a+1){var f=d.slice(this.bufferPosition);a=f.indexOf("\n");if(-1===a)break;if(f=f.slice(0,a))c("message",f),this.emit("message",f)}};
p.prototype._cleanup=function(){c("_cleanup");this.removeAllListeners()};p.prototype.abort=function(){c("abort");this.xo&&(this.xo.close(),c("close"),this.emit("close",null,"user"),this.xo=null);this._cleanup()};m.exports=p}).call(f,d(8))},function(m,f,d){function u(d,a,c,f){p.call(this,d,a,c,f)}f=d(4);var p=d(163);f(u,p);u.enabled=p.enabled&&p.supportsCORS;m.exports=u},function(m,f,d){function u(d,a){if("function"!==typeof a&&null!==a)throw new TypeError("Super expression must either be null or a function, not "+
typeof a);d.prototype=Object.create(a&&a.prototype,{constructor:{value:d,enumerable:!1,writable:!0,configurable:!0}});a&&(Object.setPrototypeOf?Object.setPrototypeOf(d,a):d.__proto__=a)}d.d(f,"k",function(){return p});m=d(31);f.d="annotation.MetadataChunkSource";f.c="annotation.GeometryChunkSource";f.j="annotation.SubsetGeometryChunkSource";f.f="annotation.reference.add";f.g="annotation.reference.delete";f.b="annotation.commit";f.a="annotation.commit";var p=function(d){function a(){if(!(this instanceof
a))throw new TypeError("Cannot call a class as a function");var c=(a.__proto__||Object.getPrototypeOf(a)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!c||"object"!==typeof c&&"function"!==typeof c?this:c}u(a,d);return a}(m.k);f.e="annotation/PerspectiveRenderLayer";f.h="annotation/RenderLayer";f.i="annotation/RenderLayer.updateSegmentation"},function(m,f){m.exports=function(d){var f=typeof d;return null!=d&&("object"==
f||"function"==f)}},function(m,f,d){function u(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 p(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 q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function a(a,b){var c=b.type,d=a.typeToIds[c],h=Object(v.g)(c),g=h.serializedBytes,k=Object(l.b)(c),r=Object(e.a)(d,b.id,function(a,b){return a<b?-1:a===b?0:1}),f=0;if(0>r){r=~r;d.splice(r,0,b.id);var n=new Uint8Array(a.data.length+g);a.numPickIds+=k.pickIdsPerInstance;f=a.typeToOffset[c]+g*r;n.set(a.data.subarray(0,f),0);n.set(a.data.subarray(f),f+g);a.data=n}else f=a.typeToOffset[c]+h.serializedBytes*
r;h.serializer(a.data.buffer,a.typeToOffset[c],d.length)(b,r);b=$jscomp.makeIterator(v.e);for(d=b.next();!d.done;d=b.next())d=d.value,d>c&&(a.typeToOffset[d]+=g);a.bufferValid=!1}function c(a,b,c){var d=a.typeToIds[b],h=Object(l.b)(b),g=h.bytes;c=Object(e.a)(d,c,function(a,b){return a<b?-1:a===b?0:1});if(0>c)return!1;a.numPickIds-=h.pickIdsPerInstance;d.splice(c,1);d=a.typeToOffset[b]+h.bytes*c;h=new Uint8Array(a.data.length-g);h.set(a.data.subarray(0,d),0);h.set(a.data.subarray(d+g),d);a.data=h;
d=$jscomp.makeIterator(v.e);for(h=d.next();!h.done;h=d.next())h=h.value,h>b&&(a.typeToOffset[h]-=g);a.bufferValid=!1;return!0}function n(){for(var a=[],b=[],e=$jscomp.makeIterator(v.e),c=e.next();!c.done;c=e.next())c=c.value,a[c]=[],b[c]=0;return new D(void 0,{data:new Uint8Array(0),numPickIds:0,typeToOffset:b,typeToIds:a})}d.d(f,"b",function(){return F});d.d(f,"a",function(){return P});var v=d(23),t=d(75),l=d(45);m=d(18);f=d(46);var k=d(65),g=d(26),e=d(39),b=d(1),h=d(3),r=d(12),A=d(67),y=function N(a,
b,e){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,b);if(void 0===c){if(a=Object.getPrototypeOf(a),null!==a)return N(a,b,e)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(e)}},z=function(){function a(a,b){for(var e=0;e<b.length;e++){var c=b[e];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,e,c){e&&a(b.prototype,e);c&&a(b,c);return b}}();d=this&&this.__decorate||
function(a,b,e,c){var d=arguments.length,h=3>d?b:null===c?c=Object.getOwnPropertyDescriptor(b,e):c,g;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)h=Reflect.decorate(a,b,e,c);else for(var k=a.length-1;0<=k;k--)if(g=a[k])h=(3>d?g(h):3<d?g(b,e,h):g(b,e))||h;return 3<d&&h&&Object.defineProperty(b,e,h),h};var E=function(){function a(b){q(this,a);this.bufferValid=!1;this.data=b.data;for(var e=this.typeToIds=b.typeToIds,c=0,d=$jscomp.makeIterator(v.e),h=d.next();!h.done;h=d.next())h=
h.value,c+=Object(l.b)(h).pickIdsPerInstance*e[h].length;this.numPickIds=c;this.typeToOffset=b.typeToOffset}z(a,[{key:"freeGPUMemory",value:function(a){a;a=this.buffer;void 0!==a&&(a.dispose(),this.bufferValid=!1,this.buffer=void 0)}}]);return a}(),x=function(a){function b(a,e){q(this,b);a=u(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));a.data=new E(e);return a}p(b,a);z(b,[{key:"freeGPUMemory",value:function(a){y(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"freeGPUMemory",
this).call(this,a);this.data.freeGPUMemory(a)}},{key:"dispose",value:function(){this.data=void 0}}]);return b}(m.b),D=function(a){function b(a,e){q(this,b);a=u(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,e));a.data=new E(e);return a}p(b,a);z(b,[{key:"freeGPUMemory",value:function(a){y(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"freeGPUMemory",this).call(this,a);this.data.freeGPUMemory(a)}},{key:"dispose",value:function(){this.data=void 0}}]);return b}(f.b),G=function(a){function b(a,
e){q(this,b);a=u(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,e));a.immediateChunkUpdates=!0;a.parent=e.parent;a.parameters=e.parameters;a.spec=e.spec;return a}p(b,a);z(b,[{key:"initializeCounterpart",value:function(a,e){e.parameters=this.parameters;e.parent=this.parent.rpcId;y(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"initializeCounterpart",this).call(this,a,e)}},{key:"addChunk",value:function(a,e){y(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"addChunk",
this).call(this,a,e)}},{key:"getChunk",value:function(a){return new D(this,a)}}]);return b}(f.c);G=d([Object(r.g)(t.c)],G);var J=function(a){function b(a,e){q(this,b);a=u(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,{}));a.parent=e;a.immediateChunkUpdates=!0;return a}p(b,a);z(b,[{key:"initializeCounterpart",value:function(a,e){e.parent=this.parent.rpcId;y(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"initializeCounterpart",this).call(this,a,e)}},{key:"addChunk",value:function(a,
e){y(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"addChunk",this).call(this,a,e)}},{key:"getChunk",value:function(a){return new x(this,a)}}]);return b}(m.e);J=d([Object(r.g)(t.j)],J);var C=function(a){function b(a,e){q(this,b);a=u(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));a.annotation=Object(v.f)(e.annotation);return a}p(b,a);return b}(m.b),B=function(a){function b(a,e){q(this,b);a=u(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));a.parent=e;return a}p(b,
a);z(b,[{key:"getChunk",value:function(a){return new C(this,a)}},{key:"addChunk",value:function(a,e){y(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"addChunk",this).call(this,a,e);a=this.parent.references.get(a);void 0!==a&&(a.value=e.annotation,a.changed.dispatch())}},{key:"deleteChunk",value:function(a){a=this.parent.references.get(a);void 0!==a&&(a.value=void 0,a.changed.dispatch())}},{key:"initializeCounterpart",value:function(a,e){e.parent=this.parent.rpcId;y(b.prototype.__proto__||
Object.getPrototypeOf(b.prototype),"initializeCounterpart",this).call(this,a,e)}}]);return b}(m.e);B=d([Object(r.g)(t.d)],B);var F=function(e){function d(a,e){q(this,d);var c=u(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));c.chunkManager=a;c.metadataChunkSource=c.registerDisposer(new B(c.chunkManager,c));c.objectToLocal=b.k.create();c.temporary=n();c.references=new Map;c.localUpdates=new Map;c.numCommitsInProgress=0;c.changed=new h.a;c.readonly=!1;c.sources=e.sourceSpecifications.map(function(b){return b.map(function(b){return c.registerDisposer(new G(a,
{spec:b.spec,parameters:b.parameters,parent:c}))})});c.segmentFilteredSource=c.registerDisposer(new J(a,c));return c}p(d,e);$jscomp.initSymbol();$jscomp.initSymbolIterator();z(d,[{key:"getSources",value:function(a){a=this.sources;a.forEach(function(a){return a.forEach(function(a){return a.addRef()})});return a}},{key:"initializeCounterpart",value:function(a,b){this.metadataChunkSource.initializeCounterpart(a,{});for(var e=$jscomp.makeIterator(this.sources),c=e.next();!c.done;c=e.next()){c=$jscomp.makeIterator(c.value);
for(var h=c.next();!h.done;h=c.next())h.value.initializeCounterpart(a,{})}this.segmentFilteredSource.initializeCounterpart(a,{});b.segmentFilteredSource=this.segmentFilteredSource.addCounterpartRef();b.metadataChunkSource=this.metadataChunkSource.addCounterpartRef();b.sources=this.sources.map(function(a){return a.map(function(a){return a.addCounterpartRef()})});b.chunkManager=this.chunkManager.rpcId;y(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"initializeCounterpart",this).call(this,
a,b)}},{key:"add",value:function(a,b){var e=this;b=void 0===b?!0:b;a.id=Object(v.h)();var c=new v.a(a.id);c.value=a;this.references.set(c.id,c);c.registerDisposer(function(){e.references.delete(c.id)});this.applyLocalUpdate(c,!1,b,a);return c}},{key:"applyLocalUpdate",value:function(b,e,d,h){var g=this.localUpdates,k=b.id,r=this.localUpdates.get(k),f=b.value;if(null==f)throw Error("Cannot create local update from null annotation");void 0===r?(r={type:f.type,reference:b.addRef(),existingAnnotation:e?
f:void 0,pendingCommit:void 0,commitInProgress:void 0},g.set(k,r),this.forEachPossibleChunk(f,function(a){c(a.data,f.type,k)}),null!==h&&a(this.temporary.data,h)):(null===h?c(this.temporary.data,f.type,f.id):a(this.temporary.data,h),b.value=h);if(d)if(void 0!==r.commitInProgress)r.pendingCommit=h;else{if(null===h&&void 0===r.existingAnnotation){g.delete(k);r.reference.dispose();return}this.sendCommitRequest(r,h)}this.notifyChanged(b.id,h||void 0)}},{key:"sendCommitRequest",value:function(a,b){this.updateCommitsInProgress(1);
a.commitInProgress=b;this.rpc.invoke(t.b,{id:this.rpcId,annotationId:a.existingAnnotation&&a.reference.id,newAnnotation:b})}},{key:"delete",value:function(a){this.applyLocalUpdate(a,!0,!0,null)}},{key:"update",value:function(a,b){this.applyLocalUpdate(a,!0,!1,b)}},{key:"notifyChanged",value:function(a,b){var e=this.references.get(a);a=this.metadataChunkSource.chunks.get(a);void 0!==a&&(a.annotation=b||null);void 0!==e&&(e.value=b||null,e.changed.dispatch());this.chunkManager.chunkQueueManager.visibleChunksChanged.dispatch()}},
{key:"commit",value:function(a){this.applyLocalUpdate(a,!0,!0,a.value)}},{key:"getReference",value:function(a){var b=this,e=this.references.get(a);if(void 0!==e)return e.addRef();e=new v.a(a);this.references.set(a,e);this.rpc.invoke(t.f,{id:this.rpcId,annotation:a});e.registerDisposer(function(){b.references.delete(a);b.rpc.invoke(t.g,{id:b.rpcId,annotation:a})});var c=this.metadataChunkSource.chunks.get(a);void 0!==c&&(e.value=c.annotation);return e}},{key:"forEachPossibleChunk",value:function(a,
b){var e=this.sources;if(1!==e.length||1!==e[0].length)throw Error("Not implemented");e=e[0][0];if(1<e.chunks.size)throw Error("Not implemented");a;e=$jscomp.makeIterator(e.chunks.values());for(var c=e.next();!c.done;c=e.next())b(c.value);e=a.segments;if(void 0!==e&&0!==e.length)for(a=this.segmentFilteredSource,e=$jscomp.makeIterator(e),c=e.next();!c.done;c=e.next())c=a.chunks.get(Object(A.b)(c.value)),void 0!==c&&b(c)}},{key:"handleSuccessfulUpdate",value:function(b,e){var d=this.localUpdates.get(b);
if(void 0===d||void 0===d.commitInProgress)throw Error("Received invalid successful update notification");this.updateCommitsInProgress(-1);if(null!==e&&d.reference.id!==e.id){if(null===d.commitInProgress)throw Error("Received invalid successful update notification");d.reference.id=e.id;this.references.delete(b);this.references.set(e.id,d.reference);this.localUpdates.delete(b);this.localUpdates.set(e.id,d);null!==d.reference.value&&(d.reference.value.id=e.id,c(this.temporary.data,d.type,b),a(this.temporary.data,
d.reference.value));d.reference.changed.dispatch()}d.existingAnnotation=e||void 0;d.commitInProgress=void 0;b=d.pendingCommit;d.pendingCommit=void 0;null===e&&(b=void 0);void 0!==b?(null!==b&&(b.id=e.id),this.sendCommitRequest(d,b)):this.revertLocalUpdate(d)}},{key:"disposed",value:function(){var a=this.commitStatus;void 0!==a&&a.dispose()}},{key:"updateCommitsInProgress",value:function(a){this.numCommitsInProgress+=a;0===this.numCommitsInProgress?void 0!==this.commitStatus&&(this.commitStatus.dispose(),
this.commitStatus=void 0):void 0===this.commitStatus&&(this.commitStatus=new g.a(!0)).setText("Commiting annotations")}},{key:"handleFailedUpdate",value:function(a,b){a=this.localUpdates.get(a);if(void 0===a||void 0===a.commitInProgress)throw Error("Received invalid update notification");(new g.a).setErrorMessage("Error commiting annotation update: "+b);this.revertLocalUpdate(a);this.updateCommitsInProgress(-1)}},{key:"revertLocalUpdate",value:function(b){c(this.temporary.data,b.type,b.reference.id);
var e=b.existingAnnotation;void 0!==e&&this.forEachPossibleChunk(e,function(b){a(b.data,e)});b=b.reference;var d=b.id;b.value=e||null;b.changed.dispatch();b.dispose();this.localUpdates.delete(d)}},{key:Symbol.iterator,value:function(){function a(a,e){for(;;)switch(b){case 0:b=-1;default:return{value:void 0,done:!0}}}var b=0,e={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();e[Symbol.iterator]=
function(){return this};return e}}],[{key:"encodeOptions",value:function(a){return{}}}]);return d}(r.b);Object(r.e)(t.a,function(a){var b=this.get(a.id),e=a.annotationId,c=a.error;void 0!==c?b.handleFailedUpdate(e,c):(a=Object(v.f)(a.newAnnotation),b.handleSuccessfulUpdate(e,a))});var P=function(a){function b(a){q(this,b);return u(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a.chunkManager,a.getSources({})))}p(b,a);z(b,[{key:"draw",value:function(){}}]);return b}(k.a)},function(m,f,d){function u(a,
b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(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 q(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)}d.d(f,"a",function(){return g});f.e=function(a,b,e,c){e=void 0===e?a.RGBA:e;c=void 0===c?a.UNSIGNED_BYTE:c;for(var d=[],g=0;g<b;++g)d[g]=new h(a,e,c);return d};d.d(f,"b",function(){return A});d.d(f,"c",function(){return y});m=d(0);var a=d(1),c=d(25),n=d(53),v=d(66),t=d(113),l=function E(a,b,e){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,b);if(void 0===c){if(a=Object.getPrototypeOf(a),null!==a)return E(a,b,e)}else{if("value"in c)return c.value;
b=c.get;return void 0===b?void 0:b.call(e)}},k=function(){function a(a,b){for(var e=0;e<b.length;e++){var c=b[e];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,e,c){e&&a(b.prototype,e);c&&a(b,c);return b}}();d=function(a){function b(){u(this,b);var a=p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));a.width=Number.NaN;a.height=Number.NaN;return a}q(b,a);k(b,[{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 b}(m.a);var g=function(a){function b(a,e){e=void 0===e?!1:e;u(this,b);var c=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,e?a.DEPTH_STENCIL:a.DEPTH_COMPONENT16));c.gl=a;c.includeStencilBuffer=e;return c}q(b,a);k(b,[{key:"attachToFramebuffer",value:function(){var a=this.gl;l(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"attachToFramebuffer",
this).call(this,this.includeStencilBuffer?a.DEPTH_STENCIL_ATTACHMENT:a.DEPTH_ATTACHMENT)}}]);return b}(function(a){function b(a,e){u(this,b);var c=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.gl=a;c.internalformat=e;c.renderbuffer=null;c.renderbuffer=a.createRenderbuffer();return c}q(b,a);k(b,[{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 b}(d)),e=function(a){function b(a){u(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,!0))}q(b,a);return b}(g);f.d=e;var b=function(a){function b(a){u(this,b);var e=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));e.gl=a;e.framebuffer=
e.gl.createFramebuffer();return e}q(b,a);k(b,[{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 b}(m.a),h=function(a){function b(a,e,c){u(this,b);var d=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));d.gl=a;d.format=e;d.dataType=c;d.texture=a.createTexture();return d}q(b,
a);k(b,[{key:"performResize",value:function(){Object(v.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 b}(d),r=new Uint8Array(4),A=function(a){function e(a,c){u(this,e);var d=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));d.gl=a;d.width=Number.NaN;d.height=
Number.NaN;d.fullAttachmentList=[];d.attachmentVerified=!1;d.singleAttachmentList=[d.gl.COLOR_ATTACHMENT0];var h=void 0===c.framebuffer?new b(a):c.framebuffer,g=c.colorBuffers;c=c.depthBuffer;d.framebuffer=d.registerDisposer(h);d.colorBuffers=g;d.depthBuffer=c;void 0!==c&&d.registerDisposer(c);var k=d.fullAttachmentList;g.forEach(function(b,e){d.registerDisposer(b);k[e]=a.COLOR_ATTACHMENT0+e});return d}q(e,a);k(e,[{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 e=this.gl,c=this.depthBuffer;void 0!==c&&(c.resize(a,b),c.attachToFramebuffer());this.colorBuffers.forEach(function(c,d){c.resize(a,b);c.attachToFramebuffer(e.COLOR_ATTACHMENT0+d)});e.WEBGL_draw_buffers.drawBuffersWEBGL(this.fullAttachmentList);this.verifyAttachment();e.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,e){var c=this.gl;try{this.bindSingle(a),c.readPixels(b,e,1,1,c.RGBA,c.UNSIGNED_BYTE,r)}finally{this.framebuffer.unbind()}return r}},{key:"readPixelAsUint32",value:function(a,b,e){a=this.readPixel(a,b,e);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 e}(m.a),y=function(b){function e(a,b){u(this,e);var c=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));c.gl=a;c.shader=b;c.copyVertexPositionsBuffer=Object(n.a)(c.gl);c.copyTexCoordsBuffer=Object(n.a)(c.gl,0,0,1,1);c.registerDisposer(b);
return c}q(e,b);k(e,[{key:"draw",value:function(b){for(var e=[],c=0;c<arguments.length;++c)e[c-0]=arguments[c];c=this.gl;var d=this.shader;d.bind();for(var h=e.length,g=0;g<h;++g)c.activeTexture(c.TEXTURE0+g),c.bindTexture(c.TEXTURE_2D,e[g]);c.uniformMatrix4fv(d.uniform("uProjectionMatrix"),!1,a.d);e=d.attribute("aVertexPosition");this.copyVertexPositionsBuffer.bindToVertexAttrib(e,2);d=d.attribute("aTexCoord");this.copyTexCoordsBuffer.bindToVertexAttrib(d,2);c.drawArrays(c.TRIANGLE_FAN,0,4);c.disableVertexAttribArray(e);
c.disableVertexAttribArray(d);for(e=0;e<h;++e)c.activeTexture(c.TEXTURE0+e),c.bindTexture(c.TEXTURE_2D,null)}}],[{key:"get",value:function(a,b,d){b=void 0===b?t.a:b;d=void 0===d?1:d;return a.memoize.get("OffscreenCopyHelper:"+d+":"+Object(c.a)(b),function(){return new e(a,Object(t.b)(a,b,d))})}}]);return e}(m.a)},function(m,f,d){function u(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,
{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}d.d(f,"a",function(){return c});m=d(0);var p=d(80),q=d(53),a=function(){function a(a,c){for(var d=0;d<c.length;d++){var k=c[d];k.enumerable=k.enumerable||!1;k.configurable=!0;"value"in k&&(k.writable=!0);Object.defineProperty(a,k.key,k)}}return function(c,d,f){d&&a(c.prototype,d);f&&a(c,f);return c}}();f.b=4;var c=function(c){function d(a,c){c=void 0===c?1:c;if(!(this instanceof
d))throw new TypeError("Cannot call a class as a function");var k=(d.__proto__||Object.getPrototypeOf(d)).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");k=!k||"object"!==typeof k&&"function"!==typeof k?this:k;k.circlesPerInstance=c;k.squareCornersBuffer=Object(q.a)(a,-1,-1,1,1,c,1);k.quadHelper=k.registerDisposer(new p.a(a,c));return k}u(d,c);a(d,[{key:"defineShader",value:function(a,c){a.addAttribute("highp vec2","aCircleCornerOffset");a.addUniform("highp vec4",
"uCircleParams");a.addVarying("highp vec2","vCircleCoord");a.addVertexCode("\nvoid emitCircle(vec4 position) {\n  gl_Position = position;\n  gl_Position.xy += aCircleCornerOffset * uCircleParams.xy * gl_Position.w;\n  vCircleCoord = aCircleCornerOffset;\n}\n");c?a.addFragmentCode("\nfloat getCircleAlphaMultiplier() {\n  return 1.0 - 2.0 * abs(0.5 - gl_FragCoord.z);\n}\n"):a.addFragmentCode("\nfloat getCircleAlphaMultiplier() {\n  return 1.0;\n}\n");a.addFragmentCode("\nvec4 getCircleColor(vec4 interiorColor, vec4 borderColor) {\n  float radius = length(vCircleCoord);\n  if (radius > 1.0) {\n    discard;\n  }\n\n  float borderColorFraction = clamp((radius - uCircleParams.z) / uCircleParams.w, 0.0, 1.0);\n  float feather = clamp((1.0 - radius) / uCircleParams.w, 0.0, 1.0);\n  vec4 color = mix(interiorColor, borderColor, borderColorFraction);\n\n  return vec4(color.rgb, color.a * feather * getCircleAlphaMultiplier());\n}\n")}},
{key:"draw",value:function(a,c,d,g){var e=a.gl,b=a.attribute("aCircleCornerOffset");this.squareCornersBuffer.bindToVertexAttrib(b,2);var h=d.interiorRadiusInPixels+d.borderWidthInPixels+d.featherWidthInPixels;e.uniform4f(a.uniform("uCircleParams"),h/c.viewportWidth,h/c.viewportHeight,d.interiorRadiusInPixels/h,d.featherWidthInPixels/h);this.quadHelper.draw(e,g);a.gl.disableVertexAttribArray(b)}}]);return d}(m.a)},function(m,f,d){function u(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+
typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}function p(a){for(var c=new Uint16Array(6*a),d=0;d<a;++d){var k=4*d,g=6*d;c[g]=k;c[g+1]=k+1;c[g+2]=k+2;c[g+3]=k+2;c[g+4]=k+3;c[g+5]=k}return c}d.d(f,"a",function(){return n});m=d(0);var q=d(16),a=d(11),c=function(){function a(a,c){for(var d=0;d<c.length;d++){var g=c[d];g.enumerable=g.enumerable||!1;g.configurable=
!0;"value"in g&&(g.writable=!0);Object.defineProperty(a,g.key,g)}}return function(c,d,k){d&&a(c.prototype,d);k&&a(c,k);return c}}();f.b=4;var n=function(d){function f(c,d){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var g=(f.__proto__||Object.getPrototypeOf(f)).call(this);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.quadsPerInstance=d;1!==d&&(g.quadIndexBuffer=
g.registerDisposer(Object(q.b)(c,a.f,p,d)).value);return g}u(f,d);c(f,[{key:"draw",value:function(c,d){1===this.quadsPerInstance?c.ANGLE_instanced_arrays.drawArraysInstancedANGLE(a.D,0,4,d):(this.quadIndexBuffer.bind(),c.ANGLE_instanced_arrays.drawElementsInstancedANGLE(a.C,6*this.quadsPerInstance,a.H,0,d))}}]);return f}(m.a)},function(m,f,d){function u(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(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 q(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.addFragmentCode("\nvoid emit(vec4 color, vec4 pickId) {\n  gl_FragColor = color;\n}\n")}function c(a){a.addFragmentCode("\nvoid emit(vec4 color, vec4 pickId) {\n  gl_FragColor = pickId;\n}\n")}
d.d(f,"b",function(){return z});d.d(f,"a",function(){return x});var n=d(116),v=d(15),t=d(117);m=d(118);var l=d(46),k=d(20),g=d(1),e=d(121),b=d(11),h=d(78),r=d(69),A=function(){function a(a,b){for(var e=0;e<b.length;e++){var c=b[e];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,e,c){e&&a(b.prototype,e);c&&a(b,c);return b}}(),y;(function(a){a[a.COLOR=0]="COLOR";a[a.PICK=1]="PICK";a[a.NUM_TEXTURES=2]="NUM_TEXTURES"})(y||
(y={}));var z=function(a){function b(){u(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);A(b,[{key:"draw",value:function(a){}},{key:"isReady",value:function(){return!0}}]);return b}(v.j),E=g.u.create(),x=function(d){function f(b,c,d,A){u(this,f);var q=p(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,b,c,A));q.sliceView=d;q.axesLineHelper=q.registerDisposer(n.a.get(q.gl));q.sliceViewRenderHelper=q.registerDisposer(l.d.get(q.gl,a));q.colorFactor=g.u.fromValues(1,
1,1,1);q.pickIDs=new t.a;q.visibleLayerTracker=Object(v.l)(q.viewer.layerManager,z,q.viewer.visibleLayerRoles,q);q.offscreenFramebuffer=q.registerDisposer(new h.b(q.gl,{colorBuffers:Object(h.e)(q.gl,y.NUM_TEXTURES)}));q.offscreenCopyHelper=q.registerDisposer(h.c.get(q.gl));q.scaleBarCopyHelper=q.registerDisposer(h.c.get(q.gl));q.scaleBarTexture=q.registerDisposer(new r.a(q.gl));Object(k.c)(c,"translate-via-mouse-drag",function(a){q.viewer.mouseState.updateUnconditionally()&&Object(e.a)(a.detail,function(a,
b,e){a=q.viewer.navigationState.position;var c=a.spatialCoordinates;g.s.set(c,b,e,0);g.s.transformMat4(c,c,q.sliceView.viewportToData);a.changed.dispatch()})});Object(k.c)(c,"rotate-via-mouse-drag",function(a){var b=q.viewer.mouseState;if(b.updateUnconditionally()){var c=g.s.clone(b.position);Object(e.a)(a.detail,function(a,b,e){a=q.sliceView.viewportAxes;q.viewer.navigationState.pose.rotateAbsolute(a[1],b/4*Math.PI/180,c);q.viewer.navigationState.pose.rotateAbsolute(a[0],e/4*Math.PI/180,c)})}});
q.registerDisposer(d);q.registerDisposer(A.crossSectionBackgroundColor.changed.add(function(){return q.scheduleRedraw()}));q.registerDisposer(d.visibility.add(q.visibility));q.registerDisposer(d.viewChanged.add(function(){q.visible&&b.scheduleRedraw()}));q.registerDisposer(A.showAxisLines.changed.add(function(){q.visible&&q.scheduleRedraw()}));q.registerDisposer(A.showScaleBar.changed.add(function(){q.visible&&q.context.scheduleRedraw()}));return q}q(f,d);A(f,[{key:"isReady",value:function(){if(!this.visible||
!this.sliceView.isReady())return!1;var a=this.visibleLayerTracker.getVisibleLayers();a=$jscomp.makeIterator(a);for(var b=a.next();!b.done;b=a.next())if(!b.value.isReady())return!1;return!0}},{key:"draw",value:function(){var e=this.sliceView;this.onResize();e.updateRendering();if(e.hasValidViewport){var d=this.gl,h=e.width,k=e.height,r=e.dataToDevice;this.offscreenFramebuffer.bind(h,k);d.disable(b.t);this.gl.clearColor(0,0,0,0);d.clear(b.d);var f=g.k.create(),n=this.viewer.crossSectionBackgroundColor.value;
E[0]=n[0];E[1]=n[1];E[2]=n[2];E[3]=1;this.sliceViewRenderHelper.draw(e.offscreenFramebuffer.colorBuffers[0].texture,g.d,this.colorFactor,E,0,0,1,1);n=this.visibleLayerTracker.getVisibleLayers();var l=this.pickIDs;l.clear();this.offscreenFramebuffer.bindSingle(y.COLOR);l={dataToDevice:e.dataToDevice,pickIDs:l,emitter:a,emitColor:!0,emitPickID:!1,viewportWidth:h,viewportHeight:k,sliceView:e};d.enable(b.b);d.blendFunc(b.u,b.p);for(var t=$jscomp.makeIterator(n),v=t.next();!v.done;v=t.next())v.value.draw(l);
d.disable(b.b);this.offscreenFramebuffer.bindSingle(y.PICK);l.emitColor=!1;l.emitPickID=!0;l.emitter=c;n=$jscomp.makeIterator(n);for(v=n.next();!v.done;v=n.next())v.value.draw(l);if(this.viewer.showAxisLines.value||this.viewer.showScaleBar.value){if(this.viewer.showAxisLines.value){g.k.copy(f,r);for(r=0;3>r;++r)f[12+r]=0;for(r=0;4>r;++r)f[2+4*r]=0;k=Math.min(h,k)/4*1.5;r=e.pixelSize;for(n=0;12>n;++n)f[n]=f[n]*k*r}this.offscreenFramebuffer.bindSingle(y.COLOR);this.viewer.showAxisLines.value&&this.axesLineHelper.draw(f);
this.viewer.showScaleBar.value&&(d.enable(b.b),d.blendFunc(b.u,b.p),f=this.scaleBarTexture,k=f.dimensions,k.targetLengthInPixels=Math.min(h/4,100),k.nanometersPerPixel=e.pixelSize,f.update(),d.viewport(10,10,f.width,f.height),this.scaleBarCopyHelper.draw(f.texture),d.disable(b.b))}this.offscreenFramebuffer.unbind();this.setGLViewport();this.offscreenCopyHelper.draw(this.offscreenFramebuffer.colorBuffers[y.COLOR].texture)}}},{key:"onResize",value:function(){this.sliceView.setViewportSizeDebounced(this.element.clientWidth,
this.element.clientHeight)}},{key:"updateMouseState",value:function(a){a.pickedRenderLayer=null;var b=this.sliceView;if(!b.hasValidViewport)return!1;var e=b.width,c=b.height,d=this.offscreenFramebuffer;if(!d.hasSize(e,c))return!1;var h=a.position,k=this.mouseX,r=this.mouseY;g.s.set(h,k-e/2,r-c/2,0);g.s.transformMat4(h,h,b.viewportToData);this.pickIDs.setMouseState(a,d.readPixelAsUint32(y.PICK,k,c-r));return!0}},{key:"zoomByMouse",value:function(a){var b=this.navigationState;if(b.valid){var e=this.sliceView,
c=e.height,d=this.mouseX,h=this.mouseY;d-=e.width/2;h-=c/2;c=this.navigationState.zoomFactor.value;b.zoomBy(a);a=b.zoomFactor.value;var k=b.position.spatialCoordinates;g.s.scaleAndAdd(k,k,e.viewportAxes[0],d*(c-a));g.s.scaleAndAdd(k,k,e.viewportAxes[1],h*(c-a));b.position.changed.dispatch()}}},{key:"navigationState",get:function(){return this.sliceView.navigationState}}]);return f}(m.a)},function(m,f,d){f.a=function(d,f){if(d.active&&void 0!==d.pickedAnnotationId){var p=d.pickedRenderLayer;if(null!==
p){var a=d.pickedAnnotationLayer;if(void 0!==a&&(f=f.renderLayerToManagedLayerMap.get(p),void 0!==f))return{layer:f,annotationLayer:a,id:d.pickedAnnotationId,partIndex:d.pickedOffset}}}};f.b=function(d,f){d.registerDisposer(f.changed.add(function(){d.hoverState.value=f.active&&f.pickedAnnotationLayer===d?{id:f.pickedAnnotationId,partIndex:f.pickedOffset}:void 0}))}},function(m,f,d){function u(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(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 q(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){switch(a){case g.b.FLOAT32:return z.g;default:throw Error("Data type not supported by WebGL: ${DataType[dataType]}");
}}f.f=function(a){return new k.c(void 0===a?"void main() {\n  emitDefault();\n}\n":a,h.A)};d.d(f,"c",function(){return P});d.d(f,"b",function(){return H});d.d(f,"e",function(){return N});d.d(f,"d",function(){return U});var c=d(36);m=d(18);var n=d(54),v=d(70),t=d(216),l=d(81),k=d(6),g=d(44),e=d(0),b=d(1),h=d(2),r=d(25),A=d(3),y=d(16),z=d(11),E=d(27),x=d(17),D=function aa(a,b,e){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,b);if(void 0===c){if(a=Object.getPrototypeOf(a),
null!==a)return aa(a,b,e)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(e)}},G=function(){function a(a,b){for(var e=0;e<b.length;e++){var c=b[e];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,e,c){e&&a(b.prototype,e);c&&a(b,c);return b}}(),J=d(84),C=b.k.create(),B=new Float32Array(4);f.a="//NEUROGLANCER_SKELETON_LAYER_FRAGMENT_MAIN_START";var F=function(a){function e(a){u(this,e);var b=p(this,
(e.__proto__||Object.getPrototypeOf(e)).call(this));b.vertexAttributes=a;b.shaders=new Map;b.shaderGeneration=-1;b.vertexAttributesKey=Object(h.g)(b.vertexAttributes);return b}q(e,a);G(e,[{key:"defineShader",value:function(a,b){a.addUniform("highp vec4","uColor");a.addUniform("highp mat4","uProjection");a.addUniform("highp vec4","uPickID");var e="\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(J);this.vertexAttributes.forEach(function(b,c){a.addAttribute("highp "+b.glslDataType,"aVertex"+c);0!==c&&(a.addVarying("highp "+b.glslDataType,"vVertex"+c),e+="vVertex"+c+" = aVertex"+c+";\n",a.addFragmentCode("#define "+b.name+" vVertex"+c+"\n"))});a.setVertexMain(e);a.setFragmentMainFunction("//NEUROGLANCER_SKELETON_LAYER_FRAGMENT_MAIN_START\n"+b)}},{key:"beginLayer",value:function(a,e,c,d){c=b.k.multiply(C,c.dataToDevice,d);a.uniformMatrix4fv(e.uniform("uProjection"),!1,c)}},
{key:"getShader",value:function(a,b,e){var c=this;return this.registerDisposer(a.memoize.get("skeleton/SkeletonShaderManager:"+Object(r.a)(b)+":"+this.vertexAttributesKey+":"+e,function(){var d=new E.a(a);d.require(b);c.defineShader(d,e);return d.build()}))}},{key:"setColor",value:function(a,b,e){a.uniform4fv(b.uniform("uColor"),e)}},{key:"setPickID",value:function(a,b,e){a.uniform4fv(b.uniform("uPickID"),Object(x.r)(B,e))}},{key:"drawSkeleton",value:function(a,b,e){for(var c=this.vertexAttributes,
d=c.length,h=e.vertexAttributeOffsets,g=0;g<d;++g){var k=c[g];e.vertexBuffer.bindToVertexAttrib(b.attribute("aVertex"+g),k.numComponents,k.webglDataType,!1,0,h[g])}e.indexBuffer.bind();a.drawElements(a.LINES,e.numIndices,a.UNSIGNED_INT,0)}},{key:"endLayer",value:function(a,b){for(var e=this.vertexAttributes.length,c=0;c<e;++c)a.disableVertexAttribArray(b.attribute("aVertex"+c))}}]);return e}(e.a),P=function(e){function d(e,c,h,g){u(this,d);var k=p(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));
k.chunkManager=e;k.source=c;k.voxelSizeObject=h;k.displayState=g;k.tempMat=b.k.create();k.redrawNeeded=new A.a;k.fallbackFragmentMain="void main() {\n  emitDefault();\n}\n";Object(v.f)(g,k);k.displayState.shaderError.value=void 0;k.registerDisposer(g.fragmentMain.changed.add(function(){k.displayState.shaderError.value=void 0;k.redrawNeeded.dispatch()}));e=k.sharedObject=k.registerDisposer(new v.b(e,g));e.RPC_TYPE_ID=t.a;e.initializeCounterpartWithChunkManager({source:c.addCounterpartRef()});e=k.vertexAttributes=
[R];c=$jscomp.makeIterator(c.vertexAttributes);for(h=c.next();!h.done;h=c.next())g=$jscomp.makeIterator(h.value),h=g.next().value,g=g.next().value,e.push({name:h,dataType:g.dataType,numComponents:g.numComponents,webglDataType:a(g.dataType),glslDataType:1<g.numComponents?"vec"+g.numComponents:"float"});return k}q(d,e);G(d,[{key:"getShader",value:function(a,b,e){var c=this.displayState.fragmentMain,d=c.changed.count,h=b.shaders;b.shaderGeneration!==d&&(h.clear(),b.shaderGeneration=d);d=h.get(e);if(void 0===
d){d=null;try{d=b.getShader(a,e,c.value),this.fallbackFragmentMain=c.value,this.displayState.shaderError.value=null}catch(Y){this.displayState.shaderError.value=Y;try{d=b.getShader(a,e,this.fallbackFragmentMain)}catch(Ca){}}h.set(e,d)}return d}},{key:"draw",value:function(a,e,d,h){void 0===h&&(h=a.emitColor?1:5);var g=this.gl,k=this.source,r=this.displayState,f=Math.min(1,r.objectAlpha.value);if(!(0>=f)){var n=this.getShader(g,d,a.emitter);if(null!==n){n.bind();var l=this.tempMat;b.k.identity(l);
k.skeletonVertexCoordinatesInVoxels&&b.k.scale(l,l,this.voxelSizeObject.size);b.k.multiply(l,this.displayState.objectToDataTransform.transform,l);d.beginLayer(g,n,a,l);k=k.chunks;var t=a.pickIDs;g.lineWidth(h);Object(v.d)(r,k,function(b,h,k){k.state===c.d.GPU_MEMORY&&(a.emitColor&&d.setColor(g,n,Object(v.e)(r,b,f)),a.emitPickID&&d.setPickID(g,n,t.registerUint64(e,h)),d.drawSkeleton(g,n,k))});d.endLayer(g,n)}}}},{key:"visibility",get:function(){return this.sharedObject.visibility}},{key:"gl",get:function(){return this.chunkManager.chunkQueueManager.gl}}]);
return d}(e.a),H=function(a){function b(a){u(this,b);var e=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));e.base=a;e.renderHelper=e.registerDisposer(new F(e.base.vertexAttributes));e.registerDisposer(a);e.registerDisposer(a.redrawNeeded.add(function(){e.redrawNeeded.dispatch()}));e.setReady(!0);e.registerDisposer(a.visibility.add(e.visibility));return e}q(b,a);G(b,[{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 b}(n.a),N=function(a){function b(a){u(this,b);var e=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));e.base=a;e.renderHelper=e.registerDisposer(new F(e.base.vertexAttributes));e.registerDisposer(a);e.registerDisposer(a.redrawNeeded.add(function(){e.redrawNeeded.dispatch()}));e.setReady(!0);e.registerDisposer(a.visibility.add(e.visibility));return e}q(b,a);G(b,[{key:"draw",value:function(a){this.base.draw(a,this,
this.renderHelper,10)}},{key:"gl",get:function(){return this.base.gl}}]);return b}(l.b),R={dataType:g.b.FLOAT32,numComponents:3,name:"",webglDataType:z.g,glslDataType:"vec3"},O=function(a){function b(a,e){u(this,b);a=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));a.vertexAttributes=e.vertexAttributes;var c=a.indices=e.indices;a.vertexAttributeOffsets=e.vertexAttributeOffsets;a.numIndices=c.length;return a}q(b,a);G(b,[{key:"copyToGPU",value:function(a){D(b.prototype.__proto__||Object.getPrototypeOf(b.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){D(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"freeGPUMemory",this).call(this,a);this.vertexBuffer.dispose();this.indexBuffer.dispose()}}]);return b}(m.b),Q=new Map,U=function(a){function b(){u(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,
arguments))}q(b,a);G(b,[{key:"getChunk",value:function(a){return new O(this,a)}},{key:"skeletonVertexCoordinatesInVoxels",get:function(){return!0}},{key:"vertexAttributes",get:function(){return Q}}]);return b}(m.e)},function(m,f){m.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(m,f,d){function u(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(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 q(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){Object(x.t)(a);var b=Object(x.v)(a,"neariso_voxelres",function(a){return Object(x.u)(a,x.j)}),e=Object(x.v)(a,"neariso_imagesize",function(a){return Object(x.u)(a,x.i)}),c=Object(x.v)(a,"neariso_offset",function(a){return Object(x.u)(a,x.k)});return Object(x.v)(a,"resolutions",function(a){return Object(x.a)(a,x.r)}).map(function(a){var d=""+a,h=b.get(d),g=e.get(d),k=c.get(d);if(void 0===h||void 0===
g||void 0===k)throw Error("Missing neariso_voxelres/neariso_imagesize/neariso_offset for resolution "+(a+"."));return{key:d,voxelSize:h,imageSize:g,voxelOffset:k}})}function c(a){a=G.get(a);void 0===a&&(a=r.c.UNKNOWN);return a}function n(a){Object(x.t)(a);var b=Object(x.v)(a,"channel_type",x.A);return{channelType:b,description:Object(x.v)(a,"description",x.A),volumeType:c(b),dataType:Object(x.v)(a,"datatype",function(a){return Object(x.m)(a,r.a)})}}function v(b){Object(x.t)(b);return{channels:Object(x.v)(b,
"channels",function(a){return Object(x.u)(a,n)}),scales:Object(x.v)(b,"dataset",a)}}function t(a,b,e,c){return a.memoize.getUncounted({type:"ndstore:getTokenInfo",hostnames:b,token:e},function(){return Object(E.e)(Object(E.c)(b,c+"/"+e+"/info/"),"json").then(v)})}function l(a,b,e,c){var d=e.match(F);if(null===d)throw Error("Invalid volume path "+JSON.stringify(e));var h=d[1],g=d[2],k=Object(x.e)(d[3]||"");return a.memoize.getUncounted({type:"ndstore:MultiscaleVolumeChunkSource",hostnames:b,path:e},
function(){return t(a,b,h,c).then(function(e){return new B(a,b,h,e,g,c,k)})})}function k(a,b){var e=b.match(P);if(null===e)throw Error("Invalid ndstore volume path: "+JSON.stringify(b));return l(a,[e[1]],e[2],h.b)}function g(a,b,e){return a.memoize.getUncounted({type:"dvid:getPublicTokens",hostnames:b},function(){return Object(E.e)(Object(E.c)(b,e+"/public_tokens/"),"json").then(function(a){return Object(x.a)(a,x.A)})})}function e(a,b,e,c){var d=e.match(/^(?:([^\/]+)(?:\/([^\/]*))?)?$/);if(null===
d)return Promise.reject(null);if(void 0===d[2]){var h=d[1]||"";return g(a,b,c).then(function(a){return{offset:0,completions:Object(y.c)(h,a,function(a){return a+"/"},function(){})}})}return t(a,b,d[1],c).then(function(a){a=Object(y.c)(d[2],a.channels,function(a){return a[0]},function(a){return a[1].channelType+" ("+r.a[a[1].dataType]+")"});return{offset:d[1].length+1,completions:a}})}function b(a,b){var c=a.match(P);return null===c?Promise.reject(null):e(b,[c[1]],c[2],h.b).then(function(a){return Object(y.a)(c[1].length+
1,a)})}Object.defineProperty(f,"__esModule",{value:!0});d.d(f,"getVolume",function(){return k});d.d(f,"volumeCompleter",function(){return b});d.d(f,"MultiscaleVolumeChunkSource",function(){return B});f.getTokenInfo=t;f.getShardedVolume=l;f.getPublicTokens=g;f.tokenAndChannelCompleter=e;d.d(f,"NDStoreDataSource",function(){return H});d.d(f,"SingleServerDataSource",function(){return N});m=d(18);f=d(37);var h=d(124),r=d(19),A=d(28),y=d(56),z=d(1),E=d(47),x=d(2),D=function(){function a(a,b){for(var e=
0;e<b.length;e++){var c=b[e];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,e,c){e&&a(b.prototype,e);c&&a(b,c);return b}}(),G=new Map;G.set("image",r.c.IMAGE);G.set("annotation",r.c.SEGMENTATION);var J=new Set(["npz","raw","jpeg"]),C=function(a){function b(){u(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);return b}(Object(m.f)(A.b,h.c)),B=function(){function a(b,e,c,d,g,
k,f){u(this,a);this.chunkManager=b;this.baseUrls=e;this.key=c;this.tokenInfo=d;this.parameters=f;this.urlPrefix=h.b;this.neariso=!0;if(void 0===g){g=Array.from(d.channels.keys());if(1!==g.length)throw Error("Dataset contains multiple channels: "+JSON.stringify(g));g=g[0]}b=d.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(d.channels.keys()))));this.channel=g;this.channelInfo=b;this.scales=d.scales;
void 0!==k&&(this.urlPrefix=k);"false"===Object(x.y)(f.neariso)&&(this.neariso=!1);d=Object(x.y)(f.encoding);if(void 0===d)d=this.volumeType===r.c.IMAGE?"jpeg":"npz";else if(!J.has(d))throw Error("Invalid encoding: "+JSON.stringify(d)+".");this.encoding=d}D(a,[{key:"getSources",value:function(a){var b=this;return this.scales.map(function(e){for(var c=e.voxelOffset,d=e.voxelSize,h=z.s.create(),g=0;3>g;++g)h[g]=Math.ceil(c[g]);return r.b.getDefaults({numChannels:b.numChannels,volumeType:b.volumeType,
dataType:b.dataType,voxelSize:d,transform:z.k.fromTranslation(z.k.create(),z.s.multiply(z.s.create(),c,d)),baseVoxelOffset:h,upperVoxelBound:e.imageSize,volumeSourceOptions:a}).map(function(a){return b.chunkManager.getChunkSource(C,{spec:a,parameters:{baseUrls:b.baseUrls,urlPrefix:b.urlPrefix,key:b.key,channel:b.channel,resolution:e.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}(),F=/^([^\/?]+)(?:\/([^\/?]+))?(?:\?(.*))?$/,P=/^((?:http|https):\/\/[^\/?]+)\/(.*)$/,H=function(a){function e(){u(this,e);return p(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}q(e,a);D(e,[{key:"volumeCompleter",value:function(a,e){return b(a,e)}},{key:"getVolume",value:function(a,b){return k(a,b)}},{key:"description",get:function(){return"NDstore"}}]);
return e}(f.a),N=function(a){function b(a,e,c){c=void 0===c?h.b:c;u(this,b);var d=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));d.description=a;d.hostnames=e;d.urlprefix=c;return d}q(b,a);D(b,[{key:"getVolume",value:function(a,b){return l(a,this.hostnames,b,this.urlprefix)}},{key:"volumeCompleter",value:function(a,b){return e(b,this.hostnames,a,this.urlprefix)}}]);return b}(f.a)},function(m,f,d){function u(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
}function p(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 q(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,e,c){var d=
z.s.transformMat4(z.s.create(),a,b);a=Object(D.c)(e.voxelFromSpatial(W,d));return void 0!==c?(b=document.createElement("span"),b.className="neuroglancer-voxel-coordinates-link",b.textContent=a,b.title="Center view on voxel coordinates "+a+".",b.addEventListener("click",function(){c(d)}),b):document.createTextNode(a)}function c(b,e,c,d,h){switch(e.type){case k.c.AXIS_ALIGNED_BOUNDING_BOX:case k.c.LINE:b.appendChild(a(e.pointA,c,d,h));b.appendChild(document.createTextNode("\u2013"));b.appendChild(a(e.pointB,
c,d,h));break;case k.c.POINT:b.appendChild(a(e.point,c,d,h));break;case k.c.ELLIPSOID:b.appendChild(a(e.center,c,d,h)),e=Object(z.p)(W,e.radii,c),d.voxelFromSpatial(e,e),b.appendChild(document.createTextNode("\u00b1"+Object(D.b)(e)))}}function n(a,b){var e=z.s.create();switch(a.type){case k.c.AXIS_ALIGNED_BOUNDING_BOX:case k.c.LINE:z.s.add(e,a.pointA,a.pointB);z.s.scale(e,e,.5);break;case k.c.POINT:z.s.copy(e,a.point);break;case k.c.ELLIPSOID:z.s.copy(e,a.center)}return z.s.transformMat4(e,e,b)}function v(a){var b;
a=a.segmentationState.value;null!=a&&a.segmentSelectionState.hasSelectedSegment&&(b=[a.segmentSelectionState.selectedSegment.clone()]);return b}function t(a,b){return z.s.transformMat4(z.s.create(),a.position,b.globalToObject)}f.c=c;f.b=function(a){return{color:a.annotationColor,fillOpacity:a.annotationFillOpacity}};f.a=function(a){return function(a){function c(a){for(var d=[],k=0;k<arguments.length;++k)d[k-0]=arguments[k];u(this,c);var f,n=p(this,(f=c.__proto__||Object.getPrototypeOf(c)).call.apply(f,
[].concat([this],$jscomp.arrayFromIterable(d))));n.annotationLayerState=n.registerDisposer(new r.d);n.selectedAnnotation=n.registerDisposer(new U(n.annotationLayerState.addRef()));n.annotationColor=new A.a(z.s.fromValues(1,1,0));n.annotationFillOpacity=Object(h.a)(0);n.selectedAnnotation.changed.add(n.specificationChanged.dispatch);n.annotationColor.changed.add(n.specificationChanged.dispatch);n.tabs.add("annotations",{label:"Annotations",order:10,getter:function(){return new T(n,n.selectedAnnotation.addRef(),
n.manager.voxelSize.addRef(),function(a){return n.manager.setSpatialCoordinates(a)})}});n.annotationLayerState.changed.add(function(){var a=n.annotationLayerState.value;if(void 0!==a){var c=new g.a(n.manager.chunkManager,a.addRef());Object(b.b)(a,n.manager.layerSelectedValues.mouseState);n.addRenderLayer(new g.e(c));n.addRenderLayer(new g.d(c.addRef()));if(c.source instanceof e.b){var d=n.registerDisposer(new e.a(c.source.addRef()));n.registerDisposer(Object(r.h)(a.filterBySegmentation,function(a,
b){b||(n.addRenderLayer(d.addRef()),a.registerDisposer(function(){return n.removeRenderLayer(d)}))}))}}});return n}q(c,a);O(c,[{key:"restoreState",value:function(a){R(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"restoreState",this).call(this,a);this.selectedAnnotation.restoreState(a.selectedAnnotation);this.annotationColor.restoreState(a.annotationColor);this.annotationFillOpacity.restoreState(a.annotationFillOpacity)}},{key:"toJSON",value:function(){var a=R(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),
"toJSON",this).call(this);a.selectedAnnotation=this.selectedAnnotation.toJSON();a.annotationColor=this.annotationColor.toJSON();a.annotationFillOpacity=this.annotationFillOpacity.toJSON();return a}},{key:"initializeAnnotationLayerViewTab",value:function(a){a}}]);return c}(a)};m=d(234);d.n(m);m=d(5);var l=d.n(m),k=d(23),g=d(62),e=d(77),b=d(82),h=d(49),r=d(6);m=d(111);var A=d(136);f=d(0);var y=d(10),z=d(1),E=d(2),x=d(3),D=d(139),G=d(14),J=d(24),C=d(87),B=d(236),F=d(71),P=d(35),H=d(88),N=d(140),R=function Y(a,
b,e){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,b);if(void 0===c){if(a=Object.getPrototypeOf(a),null!==a)return Y(a,b,e)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(e)}},O=function(){function a(a,b){for(var e=0;e<b.length;e++){var c=b[e];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,e,c){e&&a(b.prototype,e);c&&a(b,c);return b}}(),Q=function(a){function b(a,
e){u(this,b);var c=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.reference=a;c.annotationLayer=e;c.element=document.createElement("div");c.addSegmentWidget=c.registerDisposer(new N.a);c.debouncedUpdateView=l()(function(){return c.updateView()},0);c.element.className="neuroglancer-annotation-segment-list";var d=c.addSegmentWidget;d.element.style.display="inline-block";d.element.title="Associate segments";c.element.appendChild(d.element);c.registerDisposer(e.segmentationState.changed.add(c.debouncedUpdateView));
c.registerDisposer(function(){return c.unregisterSegmentationState()});c.registerDisposer(c.addSegmentWidget.valuesEntered.add(function(a){var b=c.reference.value;null!=b&&(a=[].concat($jscomp.arrayFromIterable(b.segments||[]),$jscomp.arrayFromIterable(a)),b=Object.assign({},b,{segments:a}),c.annotationLayer.source.update(c.reference,b),c.annotationLayer.source.commit(c.reference))}));c.registerDisposer(a.changed.add(c.debouncedUpdateView));c.updateView();return c}q(b,a);O(b,[{key:"unregisterSegmentationState",
value:function(){var a=this.segmentationState;null!=a&&(a.visibleSegments.changed.remove(this.debouncedUpdateView),a.segmentColorHash.changed.remove(this.debouncedUpdateView),a.segmentSelectionState.changed.remove(this.debouncedUpdateView),this.segmentationState=void 0)}},{key:"updateView",value:function(){var a=this,b=this.annotationLayer.segmentationState.value;b!==this.segmentationState&&(this.unregisterSegmentationState(),this.segmentationState=b,null!=b&&(b.visibleSegments.changed.add(this.debouncedUpdateView),
b.segmentColorHash.changed.add(this.debouncedUpdateView),b.segmentSelectionState.changed.add(this.debouncedUpdateView)));for(var e=this.element,c=this.addSegmentWidget.element.nextElementSibling;null!==c;){var d=c.nextElementSibling;e.removeChild(c);c=d}e.style.display="none";var h=this.reference.value;if(null!=h&&(c=h.segments,null!==b&&(e.style.display="",void 0!==c&&0!==c.length))){var g=b?b.segmentColorHash:void 0;c.forEach(function(c,d){0!==d&&e.appendChild(document.createTextNode(" "));d=document.createElement("span");
d.title="Double click to toggle segment visibility, control+click to disassociate segment from annotation.";d.className="neuroglancer-annotation-segment-item";d.textContent=c.toString();void 0!==b&&(d.style.backgroundColor=g.computeCssColor(c),d.addEventListener("mouseenter",function(){b.segmentSelectionState.set(c)}),d.addEventListener("mouseleave",function(){b.segmentSelectionState.set(null)}),d.addEventListener("dblclick",function(a){a.ctrlKey||(b.visibleSegments.has(c)?b.visibleSegments.delete(c):
b.visibleSegments.add(c))}));d.addEventListener("click",function(b){b.ctrlKey&&(b=(h.segments||[]).filter(function(a){return!G.a.equal(c,a)}),b=Object.assign({},h,{segments:b?b:void 0}),a.annotationLayer.source.update(a.reference,b),a.annotationLayer.source.commit(a.reference))});e.appendChild(d)})}}}]);return b}(f.a),U=function(a){function b(a){u(this,b);var e=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));e.annotationLayerState=a;e.changed=new x.a;e.referenceChanged=function(){e.validate();
e.changed.dispatch()};e.validate=function(){var a=e.updateAnnotationLayer(),b=e.annotationLayer;if(void 0!==b){var c=e.value_;if(void 0!==c){var d=e.reference_;void 0!==d&&d.id!==c.id?c.id=d.id:void 0===d&&(d=e.reference_=b.source.getReference(c.id),d.changed.add(e.referenceChanged));if(null===d.value){e.unbindReference();e.value=void 0;return}}else e.unbindReference()}a&&e.changed.dispatch()};e.registerDisposer(a);e.registerDisposer(a.changed.add(e.validate));e.updateAnnotationLayer();e.reference_=
void 0;e.value_=void 0;return e}q(b,a);O(b,[{key:"updateAnnotationLayer",value:function(){var a=this.annotationLayerState.value;if(a===this.annotationLayer)return!1;this.unbindLayer();this.annotationLayer=a;void 0!==a&&a.source.changed.add(this.validate);return!0}},{key:"unbindLayer",value:function(){void 0!==this.annotationLayer&&(this.annotationLayer.source.changed.remove(this.validate),this.annotationLayer=void 0)}},{key:"disposed",value:function(){this.unbindLayer();this.unbindReference();R(b.prototype.__proto__||
Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}},{key:"unbindReference",value:function(){var a=this.reference_;void 0!==a&&(a.changed.remove(this.referenceChanged),this.reference_=void 0)}},{key:"toJSON",value:function(){var a=this.value_;if(void 0!==a)return 0===a.partIndex?a.id:a}},{key:"reset",value:function(){this.value=void 0}},{key:"restoreState",value:function(a){void 0===a?this.value=void 0:"string"===typeof a?this.value={id:a,partIndex:0}:(Object(E.t)(a),this.value={id:Object(E.v)(a,
"id",E.A),partIndex:Object(E.v)(a,"partIndex",E.x)})}},{key:"reference",get:function(){return this.reference_}},{key:"value",get:function(){return this.value_},set:function(a){this.value_=a;var b=this.reference_;void 0!==b&&(void 0!==a&&b.id===a.id||this.unbindReference());this.validate();this.changed.dispatch()}},{key:"validValue",get:function(){return this.annotationLayer&&this.value_}}]);return b}(f.a),W=z.s.create(),aa=function(a){function b(a,e,c,d,h){u(this,b);var g=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));
g.layer=a;g.state=e;g.annotationLayer=c;g.voxelSize=d;g.setSpatialCoordinates=h;g.annotationListContainer=document.createElement("ul");g.annotationListElements=new Map;g.updated=!1;g.element.classList.add("neuroglancer-annotation-layer-view");g.annotationListContainer.classList.add("neuroglancer-annotation-list");g.registerDisposer(e);g.registerDisposer(d);g.registerDisposer(c);e=function(){g.updated=!1;g.updateView()};g.registerDisposer(c.source.changed.add(e));g.registerDisposer(g.visibility.changed.add(function(){return g.updateView()}));
g.registerDisposer(c.transform.changed.add(e));g.updateView();e=document.createElement("div");e.className="neuroglancer-annotation-toolbox";a.initializeAnnotationLayerViewTab(g);a=g.registerDisposer(new F.a(g.annotationLayer.fillOpacity));a.promptElement.textContent="Fill opacity";g.element.appendChild(a.element);a=g.registerDisposer(new B.a(g.annotationLayer.color));a.element.title="Change annotation display color";e.appendChild(a.element);c.source.readonly||(c=document.createElement("button"),c.textContent=
Object(k.g)(k.c.POINT).icon,c.title="Annotate point",c.addEventListener("click",function(){g.layer.tool.value=new da(g.layer,{})}),e.appendChild(c),c=document.createElement("button"),c.textContent=Object(k.g)(k.c.AXIS_ALIGNED_BOUNDING_BOX).icon,c.title="Annotate bounding box",c.addEventListener("click",function(){g.layer.tool.value=new L(g.layer,{})}),e.appendChild(c),c=document.createElement("button"),c.textContent=Object(k.g)(k.c.LINE).icon,c.title="Annotate line",c.addEventListener("click",function(){g.layer.tool.value=
new ia(g.layer,{})}),e.appendChild(c),c=document.createElement("button"),c.textContent=Object(k.g)(k.c.ELLIPSOID).icon,c.title="Annotate ellipsoid",c.addEventListener("click",function(){g.layer.tool.value=new X(g.layer,{})}),e.appendChild(c));g.element.appendChild(e);g.element.appendChild(g.annotationListContainer);g.annotationListContainer.addEventListener("mouseleave",function(){g.annotationLayer.hoverState.value=void 0});g.registerDisposer(g.annotationLayer.hoverState.changed.add(function(){return g.updateHoverView()}));
g.registerDisposer(g.state.changed.add(function(){return g.updateSelectionView()}));return g}q(b,a);O(b,[{key:"updateSelectionView",value:function(){var a=this.state.value;if(void 0!==a)var b=a.id;a=this.previousSelectedId;b!==a&&(void 0!==a&&(a=this.annotationListElements.get(a),void 0!==a&&a.classList.remove("neuroglancer-annotation-selected")),void 0!==b&&(a=this.annotationListElements.get(b),void 0!==a&&(a.classList.add("neuroglancer-annotation-selected"),a.scrollIntoView())),this.previousSelectedId=
b)}},{key:"updateHoverView",value:function(){var a=this.annotationLayer.hoverState.value;if(void 0!==a)var b=a.id;a=this.previousHoverId;b!==a&&(void 0!==a&&(a=this.annotationListElements.get(a),void 0!==a&&a.classList.remove("neuroglancer-annotation-hover")),void 0!==b&&(a=this.annotationListElements.get(b),void 0!==a&&a.classList.add("neuroglancer-annotation-hover")),this.previousHoverId=b)}},{key:"updateView",value:function(){var a=this;if(this.visible&&!this.updated){var b=this.annotationLayer,
e=this.annotationListContainer,c=this.annotationListElements,d=b.source;Object(y.a)(e);this.annotationListElements.clear();b=b.objectToGlobal;var h={};d=$jscomp.makeIterator(d);for(var g=d.next();!g.done;h={annotation:h.annotation},g=d.next())h.annotation=g.value,g=this.makeAnnotationListElement(h.annotation,b),e.appendChild(g),c.set(h.annotation.id,g),g.addEventListener("mouseenter",function(b){return function(){a.annotationLayer.hoverState.value={id:b.annotation.id,partIndex:0}}}(h)),g.addEventListener("click",
function(b){return function(){a.state.value={id:b.annotation.id,partIndex:0}}}(h)),g.addEventListener("mouseup",function(b){return function(e){2===e.button&&a.setSpatialCoordinates(n(b.annotation,a.annotationLayer.objectToGlobal))}}(h));this.previousHoverId=this.previousSelectedId=void 0;this.updated=!0;this.updateHoverView();this.updateSelectionView()}}},{key:"makeAnnotationListElement",value:function(a,b){var e=document.createElement("li");e.title="Click to select, right click to recenter view.";
var d=document.createElement("div");d.className="neuroglancer-annotation-icon";d.textContent=Object(k.g)(a.type).icon;e.appendChild(d);d=document.createElement("div");d.className="neuroglancer-annotation-position";c(d,a,b,this.voxelSize,this.setSpatialCoordinates);e.appendChild(d);a.description&&(b=document.createElement("div"),b.className="neuroglancer-annotation-description",b.textContent=a.description,e.appendChild(b));return e}}]);return b}(P.b),I=function(a){function b(a,e,c){u(this,b);var d=
p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));d.state=a;d.voxelSize=e;d.setSpatialCoordinates=c;d.valid=!1;d.mouseEntered=!1;d.element.classList.add("neuroglancer-annotation-details");d.registerDisposer(a);d.registerDisposer(e);d.registerDisposer(d.state.changed.add(function(){d.valid=!1;d.updateView()}));d.registerDisposer(d.visibility.changed.add(function(){return d.updateView()}));d.state.changed.add(function(){d.valid=!1;d.updateView()});d.element.addEventListener("mouseenter",function(){d.mouseEntered=
!0;void 0!==d.hoverState&&(d.hoverState.value=d.state.value)});d.element.addEventListener("mouseleave",function(){d.mouseEntered=!1;void 0!==d.hoverState&&(d.hoverState.value=void 0)});d.updateView();return d}q(b,a);O(b,[{key:"updateView",value:function(){var a=this;if(this.visible){if(this.element.style.display=null,!this.valid){var b=this.element;Object(y.a)(b);this.valid=!0;var e=this.state.reference;if(void 0!==e){var d=this.state.value,h=e.value;if(null!=h){var g=this.state.annotationLayerState.value;
this.hoverState=g.hoverState;this.mouseEntered&&(this.hoverState.value=d);var r=g.objectToGlobal,f=this.voxelSize,n=Object(k.g)(h.type),l=document.createElement("div");l.className="neuroglancer-annotation-details-title";var t=document.createElement("div");t.className="neuroglancer-annotation-details-icon";t.textContent=n.icon;var v=document.createElement("div");v.className="neuroglancer-annotation-details-title-text";v.textContent=""+n.description;l.appendChild(t);l.appendChild(v);g.source.readonly||
(n=Object(H.a)("\ud83d\uddd1","Delete annotation"),n.addEventListener("click",function(){var a=g.source.getReference(d.id);try{g.source.delete(a)}finally{a.dispose()}}),l.appendChild(n));n=Object(C.a)();n.title="Hide annotation details";n.addEventListener("click",function(){a.state.value=void 0});l.appendChild(n);b.appendChild(l);l=document.createElement("div");l.className="neuroglancer-annotation-details-position";c(l,h,r,f,this.setSpatialCoordinates);b.appendChild(l);h.type===k.c.AXIS_ALIGNED_BOUNDING_BOX?
(l=document.createElement("div"),l.className="neuroglancer-annotation-details-volume",l.textContent=Object(D.a)(h.pointA,h.pointB,r),b.appendChild(l),l=Object(z.p)(W,z.s.subtract(W,h.pointA,h.pointB),r),r=document.createElement("div"),r.className="neuroglancer-annotation-details-volume-in-voxels",f=f.voxelFromSpatial(W,l),r.textContent=""+Object(D.b)(f),b.appendChild(r)):h.type===k.c.LINE&&(n=Object(z.p)(W,z.s.subtract(W,h.pointA,h.pointB),r),r=document.createElement("div"),r.className="neuroglancer-annotation-details-length",
l=Object(D.d)(z.s.length(n)),t="",f.valid&&(f=z.s.length(f.voxelFromSpatial(W,n)),t=", "+Math.round(f)+" vx"),r.textContent=l+t,b.appendChild(r));f=this.segmentListWidget;void 0!==f&&f.reference!==e&&(f.dispose(),this.unregisterDisposer(f),f=this.segmentListWidget=void 0);void 0===f&&(this.segmentListWidget=f=this.registerDisposer(new Q(e,g)));b.appendChild(f.element);var A=document.createElement("textarea");A.value=h.description||"";A.rows=3;A.className="neuroglancer-annotation-details-description";
A.placeholder="Description";g.source.readonly?A.readOnly=!0:A.addEventListener("change",function(){var a=A.value;g.source.update(e,Object.assign({},h,{description:a?a:void 0}));g.source.commit(e)});b.appendChild(A)}}}}else this.element.style.display="none",this.hoverState=void 0}}]);return b}(P.b),T=function(a){function b(a,e,c,d){u(this,b);var h=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));h.layer=a;h.state=e;h.voxelSize=c;h.setSpatialCoordinates=d;h.stack=h.registerDisposer(new P.a(function(a){return new aa(h.layer,
h.state.addRef(),a.addRef(),h.voxelSize.addRef(),h.setSpatialCoordinates)},h.visibility));h.detailsTab=h.registerDisposer(new I(h.state,h.voxelSize.addRef(),h.setSpatialCoordinates));h.registerDisposer(e);h.registerDisposer(c);a=h.element;a.classList.add("neuroglancer-annotations-tab");h.stack.element.classList.add("neuroglancer-annotations-stack");a.appendChild(h.stack.element);a.appendChild(h.detailsTab.element);a=function(){h.detailsTab.visibility.value=void 0!==h.state.validValue&&h.visible?J.b.VISIBLE:
J.b.IGNORED};h.registerDisposer(h.state.changed.add(a));h.registerDisposer(h.visibility.changed.add(a));a=function(){h.stack.selected=h.state.annotationLayerState.value};h.registerDisposer(h.state.annotationLayerState.changed.add(a));a();return h}q(b,a);return b}(P.b);d=function(a){function b(a,e){u(this,b);var c=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.layer=a;if(void 0===a.annotationLayerState)throw Error("Invalid layer for annotation tool.");c.annotationDescription=Object(E.v)(e,
"description",E.y);return c}q(b,a);O(b,[{key:"annotationLayer",get:function(){return this.layer.annotationLayerState.value}}]);return b}(m.a);var da=function(a){function b(a,e){u(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,e))}q(b,a);O(b,[{key:"trigger",value:function(a){var b=this.annotationLayer;void 0!==b&&a.active&&(a={id:"",description:"",segments:v(b),point:z.s.transformMat4(z.s.create(),a.position,b.globalToObject),type:k.c.POINT},b=b.source.add(a,!0),this.layer.selectedAnnotation.value=
{id:b.id},b.dispose())}},{key:"toJSON",value:function(){return"annotatePoint"}},{key:"description",get:function(){return"annotate point"}}]);return b}(d);d=function(a){function b(){u(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);O(b,[{key:"trigger",value:function(a){var b=this,e=this.annotationLayer;if(void 0!==e&&a.active){var c=function(){var c=b.inProgressAnnotation,d=c.reference,h=b.getUpdatedAnnotation(d.value,a,e);c.annotationLayer.source.update(d,
h);b.layer.selectedAnnotation.value={id:d.id}};if(void 0===this.inProgressAnnotation){var d=e.source.add(this.getInitialAnnotation(a,e),!1);this.layer.selectedAnnotation.value={id:d.id};var h=a.changed.add(c);this.inProgressAnnotation={annotationLayer:e,reference:d,disposer:function(){h();d.dispose()}}}else c(),this.inProgressAnnotation.annotationLayer.source.commit(this.inProgressAnnotation.reference),this.inProgressAnnotation.disposer(),this.inProgressAnnotation=void 0}}},{key:"disposed",value:function(){this.deactivate();
R(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}},{key:"deactivate",value:function(){void 0!==this.inProgressAnnotation&&(this.inProgressAnnotation.annotationLayer.source.delete(this.inProgressAnnotation.reference),this.inProgressAnnotation.disposer(),this.inProgressAnnotation=void 0)}}]);return b}(d);f=function(a){function b(){u(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);O(b,[{key:"getInitialAnnotation",value:function(a,
b){a=t(a,b);return{id:"",type:this.annotationType,description:"",pointA:a,pointB:a}}},{key:"getUpdatedAnnotation",value:function(a,b,e){b=t(b,e);return Object.assign({},a,{pointB:b})}}]);return b}(d);var L=function(a){function b(){u(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);O(b,[{key:"toJSON",value:function(){return"annotateBoundingBox"}},{key:"description",get:function(){return"annotate bounding box"}}]);return b}(f);L.prototype.annotationType=k.c.AXIS_ALIGNED_BOUNDING_BOX;
var ia=function(a){function b(){u(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);O(b,[{key:"getInitialAnnotation",value:function(a,e){a=R(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"getInitialAnnotation",this).call(this,a,e);a.segments=v(e);return a}},{key:"getUpdatedAnnotation",value:function(a,e,c){a=R(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"getUpdatedAnnotation",this).call(this,a,e,c);var d=a.segments;void 0!==d&&0<
d.length&&(d.length=1);(c=v(c))&&d&&(c=c.filter(function(a){return-1===d.findIndex(function(b){return G.a.equal(a,b)})}));a.segments=[].concat($jscomp.arrayFromIterable(d||[]),$jscomp.arrayFromIterable(c||[]))||void 0;return a}},{key:"toJSON",value:function(){return"annotateLine"}},{key:"description",get:function(){return"annotate line"}}]);return b}(f);ia.prototype.annotationType=k.c.LINE;var X=function(a){function b(){u(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}
q(b,a);O(b,[{key:"getInitialAnnotation",value:function(a,b){a=t(a,b);return{type:k.c.ELLIPSOID,id:"",description:"",segments:v(b),center:a,radii:z.s.fromValues(0,0,0)}}},{key:"getUpdatedAnnotation",value:function(a,b,e){var c=z.s.transformMat4(z.s.create(),a.center,e.objectToGlobal);c=z.s.distance(c,b.position);b=z.i.create();b[0]=b[4]=b[8]=1/(c*c);e=Object(z.j)(z.i.create(),e.objectToGlobal);z.i.multiply(b,b,e);z.i.transpose(e,e);z.i.multiply(b,e,b);return Object.assign({},a,{radii:z.s.fromValues(1/
Math.sqrt(b[0]),1/Math.sqrt(b[4]),1/Math.sqrt(b[8]))})}},{key:"toJSON",value:function(){return"annotateSphere"}},{key:"description",get:function(){return"annotate ellipsoid"}}]);return b}(d);Object(m.b)("annotatePoint",function(a,b){return new da(a,b)});Object(m.b)("annotateBoundingBox",function(a,b){return new L(a,b)});Object(m.b)("annotateLine",function(a,b){return new ia(a,b)});Object(m.b)("annotateSphere",function(a,b){return new X(a,b)})},function(m,f,d){f.a=function(){return Object(u.a)("\u274c")};
var u=d(88)},function(m,f,d){f.a=function(d,f){var p=document.createElement("div"),a=document.createElement("div");a.textContent=d;p.className="neuroglancer-icon-button";p.appendChild(a);void 0!==f&&(p.title=f);return p};m=d(235);d.n(m)},function(m,f,d){function u(a,c){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!c||"object"!==typeof c&&"function"!==typeof c?a:c}function p(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+
typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}f.a=function(d){return function(d){function f(c){for(var d=[],e=0;e<arguments.length;++e)d[e-0]=arguments[e];if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var b,h=u(this,(b=f.__proto__||Object.getPrototypeOf(f)).call.apply(b,[].concat([this],$jscomp.arrayFromIterable(d))));h.transform=
new q.a;h.transform.changed.add(h.specificationChanged.dispatch);h.tabs.add("transform",{label:"Transform",order:100,getter:function(){return new a.a(h.transform)}});h.transform.restoreState(d[1].transform);return h}p(f,d);c(f,[{key:"toJSON",value:function(){var a=n(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"toJSON",this).call(this);a.transform=this.transform.toJSON();return a}}]);return f}(d)};var q=d(52),a=d(239),c=function(){function a(a,c){for(var d=0;d<c.length;d++){var g=c[d];
g.enumerable=g.enumerable||!1;g.configurable=!0;"value"in g&&(g.writable=!0);Object.defineProperty(a,g.key,g)}}return function(c,d,k){d&&a(c.prototype,d);k&&a(c,k);return c}}(),n=function t(a,c,d){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,c);if(void 0===e){if(a=Object.getPrototypeOf(a),null!==a)return t(a,c,d)}else{if("value"in e)return e.value;c=e.get;return void 0===c?void 0:c.call(d)}}},function(m,f,d){function u(a,c){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!c||"object"!==typeof c&&"function"!==typeof c?a:c}function p(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}d.d(f,"a",function(){return t});m=d(241);d.n(m);m=d(242);d.n(m);m=d(141);d.n(m);m=d(142);d.n(m);m=d(43);var q=d.n(m);m=d(5);var a=
d.n(m);m=d(0);var c=d(10),n=function(){function a(a,c){for(var e=0;e<c.length;e++){var b=c[e];b.enumerable=b.enumerable||!1;b.configurable=!0;"value"in b&&(b.writable=!0);Object.defineProperty(a,b.key,b)}}return function(c,d,e){d&&a(c.prototype,d);e&&a(c,e);return c}}(),v=function k(a,e,b){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,e);if(void 0===c){if(a=Object.getPrototypeOf(a),null!==a)return k(a,e,b)}else{if("value"in c)return c.value;e=c.get;return void 0===e?void 0:
e.call(b)}};d(243)(q.a);var t=function(d){function g(e){if(!(this instanceof g))throw new TypeError("Cannot call a class as a function");var b=u(this,(g.__proto__||Object.getPrototypeOf(g)).call(this));b.state=e;b.changingValue=!1;b.debouncedValueUpdater=a()(function(){b.changingValue=!0;try{b.state.fragmentMain.value=b.textEditor.getValue()}finally{b.changingValue=!1}},500);b.textEditor=q()(function(a){},{value:b.state.fragmentMain.value,mode:"glsl",gutters:["CodeMirror-lint-markers"]});b.textEditor.on("change",
function(){b.setValidState(void 0);b.debouncedValueUpdater()});b.registerDisposer(b.state.fragmentMain.changed.add(function(){b.changingValue||b.textEditor.setValue(b.state.fragmentMain.value)}));b.element.classList.add("neuroglancer-shader-code-widget");b.registerDisposer(b.state.shaderError.changed.add(function(){b.updateErrorState()}));b.updateErrorState();return b}p(g,d);n(g,[{key:"updateErrorState",value:function(){var a=this,b=this.state.shaderError.value;void 0===b?this.setValidState(void 0):
null!==b?(this.textEditor.setOption("lint",{getAnnotations:function(){if("ShaderCompilationError"===b.name){var e=b.source.split("\n").indexOf(a.state.fragmentMainStartLine)+2;return b.errorMessages.map(function(a){return{message:a.message,severity:"error",from:q.a.Pos(void 0===a.line?0:a.line-e)}})}return"ShaderLinkError"===b.name?[{message:b.log,severity:"error",from:q.a.Pos(0)}]:[{message:b.message,severity:"error",from:q.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;Object(c.b)(this.element);this.textEditor=void 0;v(g.prototype.__proto__||Object.getPrototypeOf(g.prototype),"disposed",this).call(this)}},{key:"element",get:function(){return this.textEditor.getWrapperElement()}}]);
return g}(m.a)},function(m,f,d){d.d(f,"a",function(){return p});var u=function(){function d(a,c){for(var d=0;d<c.length;d++){var f=c[d];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}return function(a,c,f){c&&d(a.prototype,c);f&&d(a,f);return a}}();f.b=4093;var p=function(){function d(a,c,f,v){if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");this.a0=a;this.a1=c;this.b=f;this.c=v}u(d,[{key:"computeDotProduct",
value:function(a,c){var d=this.a0,f=this.a1;return d[0]*(a&255)+d[1]*(a>>8&255)+d[2]*(a>>16&255)+d[3]*(a>>24&255)+(f[0]*(c&255)+f[1]*(c>>8&255)+f[2]*(c>>16&255)+f[3]*(c>>24&255))}},{key:"compute",value:function(a,c){var d=this.b,f=this.c;a=this.computeDotProduct(a,c);return(a+a*a%4093*f+d)%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 a(){return Math.floor(4093*
Math.random())}return new d(Float32Array.of(a(),a(),a(),a()),Float32Array.of(a(),a(),a(),a()),a(),a())}}]);return d}()},function(m,f,d){function u(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 p(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 q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}d.d(f,"b",function(){return e});d.d(f,"a",function(){return y});var a=d(91),c=d(14),n=function E(a,b,e){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,b);if(void 0===c){if(a=Object.getPrototypeOf(a),null!==a)return E(a,b,e)}else{if("value"in c)return c.value;b=c.get;
return void 0===b?void 0:b.call(e)}},v=function(){function a(a,b){for(var e=0;e<b.length;e++){var c=b[e];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,e,c){e&&a(b.prototype,e);c&&a(b,c);return b}}();f.c=3;var t=0,l=0,k=0,g=0;m=function(){function b(a){a=void 0===a?b.generateHashFunctions(3):a;q(this,b);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=a;this.allocate(4,1)}v(b,[{key:"updateHashFunctions",value:function(a){this.hashFunctions=b.generateHashFunctions(a);this.mungedEmptyKey=-1}},{key:"tableWithMungedEmptyKey",value:function(a){for(var b=this.hashFunctions.length,e=Array(b),c=0;c<b;++c)e[c]=this.getHash(c,this.emptyLow,this.emptyHigh);c=this.mungedEmptyKey;if(-1===c)a:for(;;){c=16777216*Math.random()>>>0;for(var d=
0;d<b;++d)for(var h=this.getHash(d,c,c),g=0;g<b;++g)if(e[g]===h)continue a;this.mungedEmptyKey=c;break}d=this.table;h=this.emptyLow;g=this.emptyHigh;for(var k=0;k<b;++k){var r=e[k];d[r]===h&&d[r+1]===g&&(d[r]=c,d[r+1]=c)}try{a(d)}finally{for(a=0;a<b;++a)k=e[a],d[k]===c&&d[k+1]===c&&(d[k]=h,d[k+1]=g)}}},{key:"getHash",value:function(a,b,e){a=this.hashFunctions[a];var c=this.width,d=this.height;c=a[0].compute(b,e)%c;b=a[1].compute(b,e)%d;return this.entryStride*(b*this.width+c)}},{key:"keys",value:function(a){function b(b,
p){for(;;)switch(e){case 0:a=void 0===a?new c.a:a,v=A,t=v.emptyLow,l=v.emptyHigh,n=v.entryStride,f=A,r=f.table,k=0,g=r.length;case 1:if(!(k<g)){e=3;break}h=r[k];d=r[k+1];if(h===t&&d===l){e=4;break}a.low=h;a.high=d;e=5;return{value:a,done:!1};case 5:if(void 0===p){e=6;break}e=-1;throw p;case 6:case 4:case 2:k+=n;e=1;break;case 3:e=-1;default:return{value:void 0,done:!0}}}var e=0,d,h,g,k,r,f,n,l,t,v,A=this,p={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();p[Symbol.iterator]=function(){return this};return p}},{key:"indexOfPair",value:function(a,b){var e=this.table,c=this.emptyHigh;if(a===this.emptyLow&&b===c)return-1;c=0;for(var d=this.hashFunctions.length;c<d;++c){var h=this.getHash(c,a,b);if(e[h]===a&&e[h+1]===b)return h}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,e=this.table,c=this.entryStride,
d,h;d=4294967296*Math.random()>>>0,h=4294967296*Math.random()>>>0,d===a&&h===b||this.hasPair(d,h););this.emptyLow=d;this.emptyHigh=h;for(var g=0,k=e.length;g<k;g+=c)e[g]===a&&e[g+1]===b&&(e[g]=d,e[g+1]=h)}},{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,e=this.emptyLow,c=this.emptyHigh,d=a.length,h=0;h<d;h+=b)a[h]=e,a[h+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 e=t,c=l;this.storePending(a,b);a[b]=e;a[b+1]=c}},{key:"storePending",value:function(a,b){t=a[b];l=a[b+1]}},{key:"backupPending",value:function(){k=t;g=l}},{key:"restorePending",value:function(){t=
k;l=g}},{key:"tryToInsert",value:function(){for(var a=0,b=this.emptyLow,e=this.emptyHigh,c=this.maxAttempts,d=this.table,h=this.hashFunctions.length,g=Math.floor(Math.random()*h);;){var k=this.getHash(g,t,l);this.swapPending(d,k);if(t===b&&l===e)return!0;if(++a===c)break;g=(g+Math.floor(Math.random()*(h-1))+1)%h}return!1}},{key:"allocate",value:function(a,b){var e=a*b;this.width=a;this.height=b;this.table=new Uint32Array(e*this.entryStride);this.maxAttempts=e;this.clearTable();this.capacity=e*this.loadFactor;
this.mungedEmptyKey=-1}},{key:"rehash",value:function(a,b,e){this.allocate(b,e);this.updateHashFunctions(this.hashFunctions.length);b=this.emptyLow;e=this.emptyHigh;for(var c=this.entryStride,d=0,h=a.length;d<h;d+=c){var g=a[d+1];if(a[d]!==b||g!==e)if(this.storePending(a,d),!this.tryToInsert())return!1}return!0}},{key:"grow",value:function(a){for(var b=this.table,e=this.width,c=this.height,d=this.maxWidth,h=this.maxHeight;;){var g=e*c;e=Math.min(d,Math.ceil(a/this.height));e*c<a&&(c=Math.min(h,Math.ceil(a/
e)));var k=e*c;if(k<a&&k===g)throw Error("Maximum table size exceeded");for(g=0;g<this.maxRehashAttempts;++g)if(this.rehash(b,e,c))return;a=Math.ceil(this.growFactor*a)}}},{key:"insertInternal",value:function(){++this.generation;t===this.emptyLow&&l===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(b){b=void 0===b?3:b;for(var e=[],c=0;c<b;++c){var d=[a.a.generate(),a.a.generate()];e.push(d)}return e}}]);return b}();var e=function(a){function b(){q(this,b);return u(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}p(b,a);$jscomp.initSymbol();$jscomp.initSymbolIterator();v(b,[{key:"add",value:function(a){var b=a.low;a=a.high;if(this.hasPair(b,a))return!1;t=b;l=a;this.insertInternal();return!0}},{key:Symbol.iterator,
value:function(){return this.keys()}}]);return b}(m);e.prototype.entryStride=2;var b=0,h=0,r=0,A=0,y=function(a){function e(){q(this,e);return u(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}p(e,a);$jscomp.initSymbol();$jscomp.initSymbolIterator();v(e,[{key:"set",value:function(a,e){var c=a.low;a=a.high;if(this.hasPair(c,a))return!1;t=c;l=a;b=e.low;h=e.high;this.insertInternal();return!0}},{key:"get",value:function(a,b){a=this.indexOf(a);if(-1===a)return!1;var e=this.table;b.low=
e[a+2];b.high=e[a+3];return!0}},{key:"swapPending",value:function(a,c){var d=b,g=h;n(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"swapPending",this).call(this,a,c);a[c+2]=d;a[c+3]=g}},{key:"storePending",value:function(a,c){n(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"storePending",this).call(this,a,c);b=a[c+2];h=a[c+3]}},{key:"backupPending",value:function(){n(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"backupPending",this).call(this);r=b;A=h}},{key:"restorePending",
value:function(){n(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"restorePending",this).call(this);b=r;h=A}},{key:Symbol.iterator,value:function(){return this.entries()}},{key:"entries",value:function(a){function b(b,u){for(;;)switch(e){case 0:a=void 0===a?[new c.a,new c.a]:a,y=q,p=y.emptyLow,A=y.emptyHigh,v=y.entryStride,t=q,l=t.table,n=$jscomp.makeIterator(a),f=n.next().value,r=n.next().value,k=0,g=l.length;case 1:if(!(k<g)){e=3;break}h=l[k];d=l[k+1];if(h===p&&d===A){e=4;break}f.low=
h;f.high=d;r.low=l[k+2];r.high=l[k+3];e=5;return{value:a,done:!1};case 5:if(void 0===u){e=6;break}e=-1;throw u;case 6:case 4:case 2:k+=v;e=1;break;case 3:e=-1;default:return{value:void 0,done:!0}}}var e=0,d,h,g,k,r,f,n,l,t,v,A,p,y,q=this,u={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();u[Symbol.iterator]=function(){return this};return u}}]);return e}(m);y.prototype.entryStride=4},function(m,
f,d){function u(a,e){if(!(a instanceof e))throw new TypeError("Cannot call a class as a function");}function p(a,e,c){c=Math.ceil(c/e);a.dataWidth=e;a.textureHeight=c;a.textureAccessCoefficients=Float32Array.of(1/e,1/(e*c),e)}d.d(f,"b",function(){return l});f.c=function(b,e,d){d=void 0===d?1:d;switch(e){case a.b.UINT8:if(1>d||4<d)break;b.texelsPerElement=1;b.textureFormat=k[d];b.texelType=c.G;b.arrayElementsPerTexel=d;b.arrayConstructor=Uint8Array;return b;case a.b.UINT16:if(1>d||2<d)break;b.texelsPerElement=
1;b.textureFormat=k[2*d];b.texelType=c.G;b.arrayElementsPerTexel=2*d;b.arrayConstructor=Uint8Array;return b;case a.b.UINT64:if(1!==d)break;b.texelsPerElement=2;b.textureFormat=c.s;b.texelType=c.G;b.arrayElementsPerTexel=4;b.arrayConstructor=Uint8Array;return b;case a.b.UINT32:if(1!==d)break;b.texelsPerElement=1;b.textureFormat=c.s;b.texelType=c.G;b.arrayElementsPerTexel=4;b.arrayConstructor=Uint8Array;return b;case a.b.FLOAT32:if(!(1>d||4<d))return b.texelsPerElement=1,b.textureFormat=k[d],b.texelType=
c.g,b.arrayElementsPerTexel=d,b.arrayConstructor=Float32Array,b}throw Error("No supported texture format for "+a.b[e]+"["+d+"].");};f.e=function(a,e,c,d,g,k){e=e.maxTextureSize;var b=d*g*k;if(!(c*d<=e&&g*k<=e))if(c*d*g<=e&&k<=e)d*=g;else if(d=Math.ceil(b/e),d*c>e)throw Error("Chunk data size exceeds maximum texture size: "+c+" * "+b);p(a,d,b)};f.d=function(a,e,c,d){e=e.maxTextureSize;var b=Math.ceil(d/e);if(b*c>e)throw Error("Number of elements exceeds maximum texture size: "+c+" * "+d);p(a,b,d)};
f.f=function(a,e,d,g){var b=d.arrayConstructor,h=d.textureFormat,k=d.texelsPerElement,r=e.dataWidth;e=e.textureHeight;var f=r*e*d.arrayElementsPerTexel*k;g.constructor!==b&&(g=new b(g.buffer,g.byteOffset,g.byteLength/b.BYTES_PER_ELEMENT));g=Object(q.b)(g,f);a.pixelStorei(c.E,1);Object(v.b)(a);a.texImage2D(a.TEXTURE_2D,0,h,r*k,e,0,h,d.texelType,g)};d.d(f,"a",function(){return e});var q=d(39),a=d(44),c=d(11),n=d(17),v=d(66),t=function(){function a(a,b){for(var e=0;e<b.length;e++){var c=b[e];c.enumerable=
c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,e,c){e&&a(b.prototype,e);c&&a(b,c);return b}}(),l=function h(){u(this,h)},k=[-1,c.l,c.m,c.r,c.s],g=["","r","ra","rgb","rgba"],e=function(){function e(a){u(this,e);this.key=a;this.uniformName="uTextureAccessCoefficients_"+this.key;this.readTextureValue="readTextureValue_"+this.key}t(e,[{key:"defineShader",value:function(a){a.addUniform("highp vec3",this.uniformName)}},{key:"getReadTextureValueCode",
value:function(a){for(var e=this.uniformName,c="\nvoid "+this.readTextureValue+"(highp sampler2D sampler, float index",d=0;d<a;++d)c+=", out vec4 output"+d;c+=") {\n  float offset = "+.5/a+";\n  float xCoord = fract((index + offset) * "+e+".x);\n  vec2 texCoords = vec2(xCoord,\n                        (index - (xCoord - 0.5 - offset * "+e+".x) * "+e+".z) *\n                        "+e+".y);\n";for(d=0;d<a;++d)c+="\n  output"+d+" = texture2D(sampler,\n                        vec2(texCoords.x +\n                             "+
e+".x * "+(d/a).toFixed(8)+",\n                             texCoords.y));\n";return c+"\n}\n"}},{key:"getAccessor",value:function(e,c,d,h){h=void 0===h?1:h;var k=Object(n.a)(d,h),r=[];r.push(this.getReadTextureValueCode(d===a.b.UINT64?2:1));e="\n"+k+" "+e+"(float index) {\n";switch(d){case a.b.UINT8:r.push(n.o);e+="\n  "+k+" result;\n  vec4 temp;\n  "+this.readTextureValue+"("+c+", index, temp);\n  result.value = temp."+g[h]+";\n  return result;\n";break;case a.b.UINT16:r.push(n.l);e+="\n  "+k+" result;\n  vec4 temp;\n  "+
this.readTextureValue+"("+c+", index, temp);\n  result.value = temp."+g[2*h]+";\n  return result;\n";break;case a.b.UINT32:r.push(n.m);e+="\n  "+k+" result;\n  "+this.readTextureValue+"("+c+", index, result.value);\n  return result;\n";break;case a.b.UINT64:r.push(n.n);e+="\n  "+k+" result;\n  "+this.readTextureValue+"("+c+", index, result.low, result.high);\n  return result;\n";break;case a.b.FLOAT32:r.push(n.f),e+="\n  vec4 temp;\n  "+this.readTextureValue+"("+c+", index, temp);\n  return temp."+
g[h]+";\n"}r.push(e+"\n}\n");return r}},{key:"setupTextureLayout",value:function(a,e,c){a.uniform3fv(e.uniform(this.uniformName),c.textureAccessCoefficients)}}]);return e}()},function(m,f,d){function u(a,e){if(!(a instanceof e))throw new TypeError("Cannot call a class as a function");}function p(a,e){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==typeof e&&"function"!==typeof e?a:e}function q(a,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+
typeof e);a.prototype=Object.create(e&&e.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});e&&(Object.setPrototypeOf?Object.setPrototypeOf(a,e):a.__proto__=e)}d.d(f,"c",function(){return v});f.d=function(c){var e,b,d;return function(h,g){if(void 0!==b&&(void 0===e||void 0===h||e.generation!==h.generation))return void 0===e&&d.addConsumer(g),b;e=void 0;d=new a.c;return b=c(h,d).then(function(a){e=a;d=void 0;return a},function(a){d.isCanceled&&(b=d=void 0);throw a;})}};d.d(f,
"a",function(){return l});d.d(f,"b",function(){return k});var a=d(34);m=d(0);var c=d(64),n=function(){function a(a,b){for(var e=0;e<b.length;e++){var c=b[e];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(e,b,c){b&&a(e.prototype,b);c&&a(e,c);return e}}(),v=function(a){function e(){u(this,e);return p(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}q(e,a);return e}(m.a),t=function(){function a(){u(this,
a);this.providers=new Map}n(a,[{key:"register",value:function(a,b){this.providers.set(a,b)}},{key:"getCredentialsProvider",value:function(a,b){var e=this.providers.get(a);if(void 0===e)throw Error("No registered credentials provider: "+JSON.stringify(a));return e(b)}}]);return a}(),l=function(a){function e(a){u(this,e);var b=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));b.base=a;b.memoize=new c.b;return b}q(e,a);n(e,[{key:"getCredentialsProvider",value:function(a,e){var b=this;return this.memoize.get({key:a,
parameters:e},function(){return b.registerDisposer(b.base.getCredentialsProvider(a,e).addRef())})}}]);return e}(m.a),k=function(a){function e(){u(this,e);return p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,new t))}q(e,a);n(e,[{key:"register",value:function(a,e){this.base.register(a,e)}}]);return e}(l)},function(m,f,d){function u(a){return Object(c.a)(a.dataTransfer.types,"neuroglancer-layer\x00")}function p(a){if(void 0!==t&&t.manager.rootLayers===a.rootLayers)return t}function q(a,c,
e){if(a.shiftKey)return"copy";if(a.ctrlKey)return"move";a=void 0===e?!1:e;a=void 0===a?!1:a;e=p(c);c=void 0===e?"copy":a||e.manager!==c?"link":"move";return c}f.e=function(a,d){a.dataTransfer.setData(Object(c.b)("neuroglancer-layer\x00",d.layers.map(function(a){return{name:a.name,visible:a.visible}})),JSON.stringify(d.layers.map(function(a){return a.toJSON()})));void 0!==t&&t.disposer();var e,b=function(){d.manager.unregisterDisposer(b);for(var a=$jscomp.makeIterator(d.layers),c=a.next();!c.done;c=
a.next())c.value.dispose();d.manager.dispose();t===e&&(t=void 0)};t=e={manager:d.manager.addRef(),layers:d.layers.map(function(a){return a.addRef()}),disposer:b}};f.a=function(a){if(void 0!==t){if(a&&"move"===a.dataTransfer.dropEffect){var c=new Set(t.layers);t.manager.layerManager.filter(function(a){return!c.has(a)})}t.disposer()}};f.c=u;f.d=q;f.f=function(a,d,e){return Object(c.e)(a,q(a,d,void 0===e?!1:e))};f.b=function(c,d,e,b,h){var g=p(d),k=!h&&void 0!==g&&g.manager===d;if(!e&&void 0!==g){var f=
new l;f.manager=d;f.numSourceLayers=g.layers.length;f.sourceManager=g.manager;f.moveSupported=k;f.layers=new Map;if(!h&&g.manager===d)if(b)g.layers.forEach(function(a,b){f.layers.set(a,b)});else return;g.layers.forEach(function(a,b){!h&&d.layerManager.has(a)||f.layers.set(a.addRef(),b)});return f}c=u(c);if(void 0!==c)try{var t=Object(n.a)(c.parameters,function(b,e){var c=Object(n.v)(b,"name",n.A);b=Object(n.v)(b,"visible",n.l);c=new a.b(c,null,d);c.visible=b;return[c,e]}),v=new l;v.numSourceLayers=
t.length;v.moveSupported=k;v.manager=d;v.dragType=c.dragType;v.layers=new Map(t);return v}catch(x){}};var a=d(21),c=d(96),n=d(2),v=function(){function a(a,e){for(var b=0;b<e.length;b++){var c=e[b];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(c,e,b){e&&a(c.prototype,e);b&&a(c,b);return c}}(),t,l=function(){function a(){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");}v(a,[{key:"finalize",
value:function(a){var e=this.dragType;if(void 0!==e)try{var b=JSON.parse(a.dataTransfer.getData(e));if(!Array.isArray(b)||this.numSourceLayers!==b.length)throw Error("Invalid layer drop data");for(var c=$jscomp.makeIterator(this.layers),d=c.next();!d.done;d=c.next()){var g=$jscomp.makeIterator(d.value),k=g.next().value,f=g.next().value;this.manager.initializeLayerFromSpec(k,b[f])}}catch(E){return!1}return!0}},{key:"compatibleWithMethod",value:function(a){return this.method===a||!this.moveSupported&&
"move"===a?!0:!1}},{key:"method",get:function(){return void 0!==this.sourceManager?this.manager===this.sourceManager?"move":"link":"copy"}}]);return a}()},function(m,f,d){f.b=function(a,c){c=JSON.stringify(c);c=Object(u.b)((new TextEncoder).encode(c));return a+c};f.a=function(a,c){a=$jscomp.makeIterator(a);for(var d=a.next();!d.done;d=a.next()){d=d.value;a:{var f=c;if(d.startsWith(f))try{var t=d.substring(f.length);var l=(new TextDecoder).decode(Object(u.a)(t));var k=JSON.parse(l);break a}catch(g){k=
void 0;break a}k=void 0}f=k;if(void 0!==f)return{parameters:f,dragType:d}}};f.e=function(a,c){return q=a.dataTransfer.dropEffect=c};f.c=function(){return q};f.d=function(a){a.draggable=!0;return Object(p.c)(a,"dragstart",function(a){a.stopPropagation();a.preventDefault()})};var u=d(138),p=d(0),q},function(m,f,d){function u(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(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 q(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)}d.d(f,"b",function(){return A});d.d(f,"c",function(){return y});d.d(f,"a",function(){return z});var a=d(26),c=d(155),n=d(156);m=
d(0);var v=d(10),t=d(20),l=d(1),k=d(55),g=d(120),e=d(69),b=function(){function a(a,b){for(var e=0;e<b.length;e++){var c=b[e];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,e,c){e&&a(b.prototype,e);c&&a(b,c);return b}}(),h=function x(a,b,e){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,b);if(void 0===c){if(a=Object.getPrototypeOf(a),null!==a)return x(a,b,e)}else{if("value"in c)return c.value;
b=c.get;return void 0===b?void 0:b.call(e)}};d(284);d(72);f.d="neuroglancer-position";var r=t.a.fromObject({tab:{action:"tab-forward",preventDefault:!1},arrowup:{action:"adjust-up"},arrowdown:{action:"adjust-down"},wheel:{action:"adjust-via-wheel"},"shift+tab":{action:"tab-backward",preventDefault:!1},backspace:{action:"delete-backward",preventDefault:!1},escape:{action:"cancel"},mouseup0:{action:"select-all-if-was-not-focused",preventDefault:!1}}),A=function(e){function d(b,e){e=void 0===e?6:e;u(this,
d);var h=p(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));h.position=b;h.maxNumberWidth=e;h.element=document.createElement("div");h.inputContainer=document.createElement("div");h.inputElement=document.createElement("input");h.hintElement=document.createElement("input");h.tempPosition=l.s.create();h.updateHintScrollPosition=h.registerCancellable(Object(c.a)(function(){h.hintElement.scrollLeft=h.inputElement.scrollLeft}));var f=h.element,v=h.inputElement,A=h.hintElement,q=h.inputContainer;
q.className="neuroglancer-position-widget-input-container";v.className="neuroglancer-position-widget-input";A.className="neuroglancer-position-widget-hint";h.inputFieldWidth=3*e+11;e=$jscomp.makeIterator([v,A]);for(var y=e.next();!y.done;y=e.next())y=y.value,y.spellcheck=!1,y.autocomplete="off",y.type="text",y.style.width=h.inputFieldWidth+"ch";A.disabled=!0;e=document.createElement("div");e.textContent="\u29c9";e.className="neuroglancer-copy-button neuroglancer-button";e.title="Copy position to clipboard";
e.addEventListener("click",function(){var b=Object(n.b)(h.getPositionText());a.a.showTemporaryMessage(b?"Position copied to clipboard":"Failed to copy position to clipboard")});e.addEventListener("dragstart",function(a){a.dataTransfer.setData("neuroglancer-position",JSON.stringify(b.toJSON()));a.dataTransfer.setData("text",h.getPositionText());a.stopPropagation()});e.draggable=!0;f.appendChild(e);f.appendChild(q);q.appendChild(v);q.appendChild(A);f.className="neuroglancer-position-widget";h.registerDisposer(b.changed.add(h.registerCancellable(Object(c.a)(function(){return h.updateView()}))));
h.registerDisposer(new k.b(v,r)).allShortcutsAreGlobal=!0;h.registerDisposer(new g.a(v,r));h.registerEventListener(v,"change",function(){return h.updatePosition()});h.registerEventListener(v,"blur",function(){return h.updatePosition()});h.registerEventListener(v,"input",function(){return h.cleanInput()});h.registerEventListener(v,"keydown",h.updateHintScrollPosition);h.registerEventListener(v,"copy",function(a){var b=v.value.substring(v.selectionStart,v.selectionEnd);b=b.trim().replace(/\s+/g," ");
a.clipboardData.setData("text/plain",b);a.stopPropagation();a.preventDefault()});var m=!1;h.registerEventListener(v,"mousedown",function(){m=document.activeElement===v});h.registerDisposer(Object(t.c)(v,"select-all-if-was-not-focused",function(a){m||(v.selectionStart=0,v.selectionEnd=v.value.length,v.selectionDirection="forward",a.preventDefault())}));h.registerDisposer(Object(t.c)(v,"tab-forward",function(a){var b=Math.min(v.selectionStart,v.selectionEnd),e=v.value.substring(b).match(/^([^,\s]*)((?:\s+)|(?:\s*,\s*))?([^,\s]*)/);
null!==e&&void 0!==e[2]&&(v.selectionStart=b+e[1].length+e[2].length,v.selectionEnd=v.selectionStart+e[3].length,v.selectionDirection="forward",a.preventDefault())}));h.registerDisposer(Object(t.c)(v,"tab-backward",function(a){var b=v.value.substring(0,Math.max(v.selectionStart,v.selectionEnd)).match(/([^,\s]*)((?:\s+)|(?:\s*,\s*))?([^,\s]*)$/);null!==b&&void 0!==b[2]&&(v.selectionStart=b.index,v.selectionEnd=v.selectionStart+b[1].length,v.selectionDirection="forward",a.preventDefault())}));h.registerDisposer(Object(t.c)(v,
"delete-backward",function(a){if(v.selectionStart===v.selectionEnd&&v.selectionStart===v.value.length){var b=v.value.match(/^(.*)(?![\s])(?:(?:\s+)|(?:\s*,\s*))$/);null!==b&&(v.value=b[1],h.cleanInput(),a.preventDefault())}}));h.registerDisposer(Object(t.c)(v,"cancel",function(){h.updateView();h.inputElement.blur()}));h.registerDisposer(Object(t.c)(v,"adjust-via-wheel",function(a){a=a.detail;var b=a.deltaY;0!==b&&h.adjustFromCursor(Math.ceil((v.scrollLeft+a.offsetX-v.clientLeft)/(v.scrollWidth/h.inputFieldWidth)),
-Math.sign(b))}));h.registerDisposer(Object(t.c)(v,"adjust-up",function(){h.adjustFromCursor(void 0,1)}));h.registerDisposer(Object(t.c)(v,"adjust-down",function(){h.adjustFromCursor(void 0,-1)}));h.updateView();return h}q(d,e);b(d,[{key:"adjustFromCursor",value:function(a,b){var e=this.inputElement;void 0===a&&(a="forward"===e.selectionDirection?e.selectionEnd:e.selectionStart);void 0!==this.cleanInput()&&(a=e.value.substring(0,a).split(",").length-1,this.updatePosition(),e=this.tempPosition,this.position.getVoxelCoordinates(e)&&
(e[a]+=b,this.position.setVoxelCoordinates(e),this.updateView()))}},{key:"cleanInput",value:function(){var a=this.inputElement.selectionStart,b=/(-?\d+(?:\.(?:\d+)?)?)/.source,e=/((?:\s+(?![\s,]))|(?:\s*,\s*))/.source,c=/([\[\]{}()\s]*)/.source;b=this.inputElement.value.match(new RegExp("^"+c+"(?![\\s])"+b+"?"+("(?:"+e+b+"?(?:"+e+b+"?)?)?")+(c+"$")));if(null!==b){var d="  ",h="x ",g=2,k=b[1].length;e=function(b,e,c){if(void 0!==b){var r=k+b.length;void 0===e&&(e=b,c=" ".repeat(e.length));a>=k&&(g=
a===r?d.length+e.length:d.length+Math.min(e.length,a-k));d+=e;h+=c;k=r}};e(b[2]);e(b[3],",   ","  y ");e(b[4]);e(b[5],",   ","  z ");e(b[6]);this.hintElement.value=h;this.inputElement.value!==d&&(this.inputElement.value=d,this.inputElement.selectionEnd=g,this.inputElement.selectionStart=g);this.updateHintScrollPosition();return void 0!==b[2]&&void 0!==b[4]&&void 0!==b[6]?{position:l.s.set(this.tempPosition,parseFloat(b[2]),parseFloat(b[4]),parseFloat(b[6]))}:{}}this.hintElement.value=""}},{key:"updatePosition",
value:function(){var a=this.cleanInput();void 0!==a&&void 0!==a.position&&this.position.setVoxelCoordinates(a.position)}},{key:"getPositionText",value:function(){var a=this.tempPosition;return this.position.getVoxelCoordinates(a)?Math.floor(a[0])+", "+Math.floor(a[1])+", "+Math.floor(a[2]):"<unspecified position>"}},{key:"updateView",value:function(){var a=this.tempPosition;if(this.position.getVoxelCoordinates(a)){var b=this.inputElement;a="  "+Math.floor(a[0])+",   "+Math.floor(a[1])+",   "+Math.floor(a[2]);
var e=a.indexOf(","),c=a.indexOf(",",e+1)-e-4;e="x "+" ".repeat(e-2)+"  y "+" ".repeat(c)+"  z";c=b.selectionStart;var d=b.selectionEnd,h=b.selectionDirection;b.value=a;b.setSelectionRange(c,d,h);this.hintElement.value=e+" ".repeat(a.length-e.length);this.updateHintScrollPosition()}else this.inputElement.value="",this.hintElement.value=""}},{key:"disposed",value:function(){Object(v.b)(this.element);h(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"disposed",this).call(this)}}]);return d}(m.a),
y=function(a){function d(a,b){u(this,d);var e=p(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));e.element=a;e.voxelSize=b;e.dimensionsContainer=document.createElement("span");e.unitsElement=document.createElement("span");var h=e.dimensionsContainer,g=e.unitsElement;a.className="neuroglancer-voxel-size-widget";a.title="Voxel size";h.className="neuroglancer-voxel-size-dimensions-container";a.appendChild(h);a.appendChild(g);g.className="neuroglancer-voxel-size-units";e.registerDisposer(b.changed.add(e.registerCancellable(Object(c.a)(function(){return e.updateView()}))));
e.updateView();return e}q(d,a);b(d,[{key:"updateView",value:function(){var a=this.dimensionsContainer,b=this.unitsElement;Object(v.a)(a);this.element.style.display=this.voxelSize.valid?null:"none";var c=this.voxelSize.size,d=Object(e.b)(Math.min(c[0],c[1],c[2]));b.textContent=d.unit;for(b=0;3>b;++b){for(var h=c[b]/d.lengthInNanometers,g="",k=0;2>=k&&(g=h.toFixed(k),parseFloat(g)!==h);++k);h=document.createElement("span");h.className="neuroglancer-voxel-size-dimension";h.textContent=g;a.appendChild(h)}}},
{key:"disposed",value:function(){Object(v.b)(this.element);h(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"disposed",this).call(this)}}]);return d}(m.a),z=function(a){function e(a,b,d){u(this,e);var h=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));h.element=a;h.mouseState=b;h.voxelSize=d;h.tempPosition=l.s.create();a.className="neuroglancer-mouse-position-widget";a=h.registerCancellable(Object(c.a)(function(){return h.updateView()}));h.registerDisposer(b.changed.add(a));h.registerDisposer(d.changed.add(a));
return h}q(e,a);b(e,[{key:"updateView",value:function(){var a="",b=this.mouseState,e=this.voxelSize;b.active&&e.valid&&(a=this.tempPosition,e.voxelFromSpatial(a,b.position),a="x "+Math.floor(a[0])+",  y "+Math.floor(a[1])+",  z "+Math.floor(a[2]));this.element.textContent=a}},{key:"disposed",value:function(){Object(v.b)(this.element);h(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"disposed",this).call(this)}}]);return e}(m.a)},function(m,f,d){(function(f,p){function q(c,d,e){l(c,d);var b=
this;a.call(this);setTimeout(function(){b._start(c,d,e)},0)}var a=d(13).EventEmitter,c=d(4),n=d(38),v=d(60),t=d(22),l=function(){};"production"!==f.env.NODE_ENV&&(l=d(9)("sockjs-client:sender:xdr"));c(q,a);q.prototype._start=function(a,c,e){l("_start");var b=this,d=new p.XDomainRequest;c=t.addQuery(c,"t="+ +new Date);d.onerror=function(){l("onerror");b._error()};d.ontimeout=function(){l("ontimeout");b._error()};d.onprogress=function(){l("progress",d.responseText);b.emit("chunk",200,d.responseText)};
d.onload=function(){l("load");b.emit("finish",200,d.responseText);b._cleanup(!1)};this.xdr=d;this.unloadRef=n.unloadAdd(function(){b._cleanup(!0)});try{this.xdr.open(a,c),this.timeout&&(this.xdr.timeout=this.timeout),this.xdr.send(e)}catch(r){this._error()}};q.prototype._error=function(){this.emit("finish",0,"");this._cleanup(!1)};q.prototype._cleanup=function(a){l("cleanup",a);if(this.xdr){this.removeAllListeners();n.unloadDel(this.unloadRef);this.xdr.ontimeout=this.xdr.onerror=this.xdr.onprogress=
this.xdr.onload=null;if(a)try{this.xdr.abort()}catch(g){}this.unloadRef=this.xdr=null}};q.prototype.close=function(){l("close");this._cleanup(!0)};q.enabled=!(!p.XDomainRequest||!v.hasDomain());m.exports=q}).call(f,d(8),d(7))},function(m,f,d){(function(f){var p=d(4),q=d(167),a=d(100);m.exports=function(c){function d(a,d){q.call(this,c.transportName,a,d)}p(d,q);d.enabled=function(d,n){if(!f.document)return!1;d=a.extend({},n);d.sameOrigin=!0;return c.enabled(d)&&q.enabled()};d.transportName="iframe-"+
c.transportName;d.needBody=!0;d.roundTrips=q.roundTrips+c.roundTrips-1;d.facadeTransport=c;return d}}).call(f,d(7))},function(m,f,d){m.exports={isObject:function(d){var f=typeof d;return"function"===f||"object"===f&&!!d},extend:function(d){if(!this.isObject(d))return d;for(var f,q,a=1,c=arguments.length;a<c;a++)for(q in f=arguments[a],f)Object.prototype.hasOwnProperty.call(f,q)&&(d[q]=f[q]);return d}}},function(m,f,d){function u(d){this.type=d}u.prototype.initEvent=function(d,f,a){this.type=d;this.bubbles=
f;this.cancelable=a;this.timeStamp=+new Date;return this};u.prototype.stopPropagation=function(){};u.prototype.preventDefault=function(){};u.CAPTURING_PHASE=1;u.AT_TARGET=2;u.BUBBLING_PHASE=3;m.exports=u},function(m,f,d){function u(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(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 q(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){Object(B.t)(a);try{return{corner:Object(B.v)(a,"corner",function(a){return Object(B.f)(C.s.create(),a,B.n)}),size:Object(B.v)(a,"size",function(a){return Object(B.f)(C.s.create(),a,B.o)}),metadata:Object(B.v)(a,
"metadata",B.y)}}catch(X){throw Error("Failed to parse bounding box: "+X.message);}}function c(a){var b=a.match(/^([^:?]+:[^:?]+:[^:?]+)(?::([^:?]+))?(?:\?(.*))?$/);if(null===b)throw Error("Invalid Brain Maps volume key: "+JSON.stringify(a)+".");var e;void 0!==b[2]&&(e={changeStackId:b[2]});a=Object(B.e)(b[3]||"");return{volumeId:b[1],changeSpec:e,parameters:a}}function n(a){try{return Object(B.t)(a),{id:Object(B.v)(a,"id",B.A),label:Object(B.v)(a,"label",B.A),description:Object(B.v)(a,"description",
B.y)}}catch(X){throw Error("Failed to parse project: "+X.message);}}function v(a){try{return Object(B.t)(a),Object(B.v)(a,"project",function(a){return void 0===a?[]:Object(B.a)(a,n)})}catch(X){throw Error("Error parsing project list: "+X.message);}}function t(a){return Object(B.v)(a,"changeStackId",function(a){return void 0===a?void 0:Object(B.a)(a,B.A)})}function l(a){a=a.scales[0];return[[{parameters:void 0,spec:new g.k({voxelSize:a.voxelSize,chunkSize:C.s.multiply(C.s.create(),a.upperVoxelBound,
a.voxelSize),upperChunkBound:C.s.fromValues(1,1,1)})}]]}Object.defineProperty(f,"__esModule",{value:!0});d.d(f,"BrainmapsSkeletonSource",function(){return R});d.d(f,"VolumeInfo",function(){return Q});d.d(f,"MultiscaleVolumeInfo",function(){return U});d.d(f,"MeshInfo",function(){return W});d.d(f,"MultiscaleVolumeChunkSource",function(){return aa});f.parseVolumeKey=c;d.d(f,"VolumeList",function(){return T});f.parseChangeStackList=t;d.d(f,"BrainmapsAnnotationSource",function(){return da});d.d(f,"BrainmapsDataSource",
function(){return L});var k=d(23),g=d(75);m=d(62);var e=d(18),b=d(210),h=d(37),r=d(122),A=d(214),y=d(57),z=d(83),E=d(31),x=d(19),D=d(28),G=d(26),J=d(56),C=d(1),B=d(2),F=d(25),P=function(){function a(a,b){for(var e=0;e<b.length;e++){var c=b[e];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,e,c){e&&a(b.prototype,e);c&&a(b,c);return b}}(),H=function(a){function b(){u(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,
arguments))}q(b,a);return b}(Object(e.f)(Object(b.a)()(D.b),A.e)),N=function(a){function b(){u(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);return b}(Object(e.f)(Object(b.a)()(y.b),A.b)),R=function(a){function b(){u(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);P(b,[{key:"skeletonVertexCoordinatesInVoxels",get:function(){return!1}}]);return b}(Object(e.f)(Object(b.a)()(z.d),A.c)),O=new Map;O.set("UINT8",x.a.UINT8);
O.set("FLOAT",x.a.FLOAT32);O.set("UINT64",x.a.UINT64);var Q=function X(b){u(this,X);try{Object(B.t)(b),this.numChannels=Object(B.v)(b,"channelCount",B.z),this.dataType=Object(B.v)(b,"channelType",function(a){return Object(B.s)(a,O)}),this.voxelSize=Object(B.v)(b,"pixelSize",function(a){return Object(B.f)(C.s.create(),a,B.o)}),this.upperVoxelBound=Object(B.v)(b,"volumeSize",function(a){return Object(B.f)(C.s.create(),a,B.z)}),this.boundingBoxes=Object(B.v)(b,"boundingBox",function(b){return void 0===
b?[]:Object(B.a)(b,a)})}catch(Y){throw Error("Failed to parse BrainMaps volume geometry: "+Y.message);}},U=function S(a){u(this,S);try{Object(B.t)(a);var b=this.scales=Object(B.v)(a,"geometry",function(a){return Object(B.a)(a,function(a){return new Q(a)})});if(0===b.length)throw Error("Expected at least one scale.");var e=b[0],c=this.numChannels=e.numChannels,d=this.dataType=e.dataType;a=1;for(var h=b.length;a<h;++a){var g=b[a];if(g.dataType!==d)throw Error("Scale "+a+" has data type "+x.a[g.dataType]+
" "+("but scale 0 has data type "+x.a[d]+"."));if(g.numChannels!==c)throw Error("Scale "+a+" has "+g.numChannels+" channel(s) "+("but scale 0 has "+c+" channels."));}}catch(Ba){throw Error("Failed to parse BrainMaps multiscale volume specification: "+Ba.message);}},W=function Y(a){u(this,Y);Object(B.t)(a);this.name=Object(B.v)(a,"name",B.A);this.type=Object(B.v)(a,"type",B.A)},aa=function(){function a(b,e,c,d,h,g,k,r){u(this,a);this.chunkManager=b;this.instance=e;this.credentialsProvider=c;this.volumeId=
d;this.changeSpec=h;this.multiscaleVolumeInfo=g;this.encoding=r.encoding;this.chunkLayoutPreference=r.chunkLayoutPreference;if(1===this.numChannels)switch(this.dataType){case x.a.UINT64:var f=x.c.SEGMENTATION}void 0===f&&(f=void 0!==r.volumeType?r.volumeType:x.c.IMAGE);this.volumeType=f;try{Object(B.t)(k),this.meshes=Object(B.v)(k,"meshes",function(a){return void 0===a?[]:Object(B.a)(a,function(a){return new W(a)})})}catch(Gb){throw Error("Failed to parse BrainMaps meshes specification: "+Gb.message);
}}P(a,[{key:"getSources",value:function(a){var b=this,e=A.d.RAW;this.dataType===x.a.UINT64?e=A.d.COMPRESSED_SEGMENTATION:this.volumeType===x.c.IMAGE&&this.dataType===x.a.UINT8&&1===this.numChannels&&this.encoding!==A.d.RAW&&(e=A.d.JPEG);var c=this.scales[0],d=C.s.multiply(C.s.create(),c.upperVoxelBound,c.voxelSize);return this.scales.map(function(c,h){return x.b.getDefaults({voxelSize:c.voxelSize,dataType:c.dataType,numChannels:c.numChannels,upperVoxelBound:c.upperVoxelBound,upperClipBound:d,volumeType:b.volumeType,
volumeSourceOptions:a,chunkLayoutPreference:b.chunkLayoutPreference}).map(function(a){return b.chunkManager.getChunkSource(H,{credentialsProvider:b.credentialsProvider,spec:a,parameters:{instance:b.instance,volumeId:b.volumeId,changeSpec:b.changeSpec,scaleIndex:h,encoding:e}})})})}},{key:"getMeshSource",value:function(){for(var a=$jscomp.makeIterator(this.meshes),b=a.next();!b.done;b=a.next()){b=b.value;if("TRIANGLES"===b.type)return this.chunkManager.getChunkSource(N,{credentialsProvider:this.credentialsProvider,
parameters:{instance:this.instance,volumeId:this.volumeId,meshName:b.name,changeSpec:this.changeSpec}});if("LINE_SEGMENTS"===b.type)return this.chunkManager.getChunkSource(R,{credentialsProvider:this.credentialsProvider,parameters:{instance:this.instance,volumeId:this.volumeId,meshName:b.name,changeSpec:this.changeSpec}})}return null}},{key:"getStaticAnnotations",value:function(){var a=this.scales[0],b=new k.b(C.k.fromScaling(C.k.create(),a.voxelSize));b.readonly=!0;b.add(Object(k.i)(C.s.create(),
a.upperVoxelBound));a.boundingBoxes.forEach(function(a,e){b.add({type:k.c.AXIS_ALIGNED_BOUNDING_BOX,description:a.metadata,pointA:a.corner,pointB:C.s.add(C.s.create(),a.corner,a.size),id:"boundingBox"+e})});return b}},{key:"scales",get:function(){return this.multiscaleVolumeInfo.scales}},{key:"dataType",get:function(){return this.multiscaleVolumeInfo.dataType}},{key:"numChannels",get:function(){return this.multiscaleVolumeInfo.numChannels}}]);return a}(),I=/^([^\/]+)\/(.*)$/,T=function Ca(a,b){u(this,
Ca);this.projects=new Map;this.hierarchicalVolumeIds=new Map;var e=this.projects;a=$jscomp.makeIterator(v(a));for(var c=a.next();!c.done;c=a.next())c=c.value,e.set(c.id,c);try{Object(B.t)(b);var d=this.volumeIds=Object(B.v)(b,"volumeId",function(a){return void 0===a?[]:Object(B.a)(a,B.A)});d.sort();for(var h=new Map,g=$jscomp.makeIterator(d),k=g.next();!k.done;k=g.next()){var r=k.value;for(b=0;;){var f=r.indexOf(":",b);-1===f?f=void 0:++f;var n=r.substring(0,b),l=h.get(n);void 0===l&&(l=new Set,h.set(n,
l));l.add(r.substring(b,f));if(void 0===f)break;b=f}}for(var t=this.hierarchicalVolumeIds,A=$jscomp.makeIterator(h),p=A.next();!p.done;p=A.next()){var q=$jscomp.makeIterator(p.value),y=q.next().value,m=q.next().value;t.set(y,Array.from(m))}}catch(Ua){throw Error("Failed to parse Brain Maps volume list reply: "+Ua.message);}},da=function(a){function b(a,e){u(this,b);a=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,Object.assign({sourceSpecifications:l(e.multiscaleVolumeInfo)},e)));C.k.fromScaling(a.objectToLocal,
e.multiscaleVolumeInfo.scales[0].voxelSize);return a}q(b,a);return b}(Object(e.f)(Object(b.a)()(m.c),A.a)),L=function(a){function b(a,e){u(this,b);var c=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.instance=a;c.credentialsProvider=e;return c}q(b,a);P(b,[{key:"getMeshSource",value:function(a,b){return a.getChunkSource(N,{credentialsProvider:this.credentialsProvider,parameters:this.getMeshSourceParameters(b)})}},{key:"getMeshSourceParameters",value:function(a){var b=a.match(I);if(null===
b)throw Error("Invalid Brainmaps mesh URL: "+a);a=c(b[1]);return{instance:this.instance,volumeId:a.volumeId,changeSpec:a.changeSpec,meshName:b[2]}}},{key:"getSkeletonSource",value:function(a,b){return a.getChunkSource(R,{credentialsProvider:this.credentialsProvider,parameters:this.getMeshSourceParameters(b)})}},{key:"getMultiscaleInfo",value:function(a,b){var e=this;return a.memoize.getUncounted({type:"brainmaps:getMultiscaleInfo",volumeId:b,instance:this.instance,credentialsProvider:Object(F.a)(this.credentialsProvider)},
function(){return Object(r.b)(e.instance,e.credentialsProvider,{method:"GET",path:"/v1beta2/volumes/"+b,responseType:"json"}).then(function(a){return new U(a)})})}},{key:"getVolume",value:function(a,b,e){var d=this;b=c(b);var h=b.volumeId,g=b.changeSpec,k=b.parameters;Object(B.t)(k);b=Object(B.v)(k,"encoding",function(a){return void 0===a?void 0:Object(B.m)(a,A.d)});k=Object(B.v)(k,"chunkLayout",function(a){return void 0===a?void 0:Object(B.m)(a,E.a)});var f=Object.assign({},e,{encoding:b,chunkLayoutPreference:k});
return a.memoize.getUncounted({type:"brainmaps:getVolume",instance:this.instance,volumeId:h,changeSpec:g,brainmapsOptions:f},function(){return Promise.all([d.getMultiscaleInfo(a,h),Object(r.b)(d.instance,d.credentialsProvider,{method:"GET",path:"/v1beta2/objects/"+h+"/meshes",responseType:"json"})]).then(function(b){var e=$jscomp.makeIterator(b);b=e.next().value;e=e.next().value;return new aa(a,d.instance,d.credentialsProvider,h,g,b,e,f)})})}},{key:"getAnnotationSource",value:function(a,b){var e=
this;b=c(b);var d=b.volumeId;b=b.changeSpec;if(void 0===b)throw Error("A changestack must be specified.");var h={instance:this.instance,volumeId:d,changestack:b.changeStackId};return a.memoize.getUncounted({type:"brainmaps:getAnnotationSource",instance:this.instance,credentialsProvider:Object(F.a)(this.credentialsProvider),parameters:h},function(){return e.getMultiscaleInfo(a,d).then(function(b){return a.getChunkSource(da,{parameters:h,credentialsProvider:e.credentialsProvider,multiscaleVolumeInfo:b})})})}},
{key:"getVolumeList",value:function(a){var b=this;return a.memoize.getUncounted({instance:this.instance,type:"brainmaps:getVolumeList"},function(){var a=Promise.all([Object(r.b)(b.instance,b.credentialsProvider,{method:"GET",path:"/v1beta2/projects",responseType:"json"}),Object(r.b)(b.instance,b.credentialsProvider,{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 T(a,b)}),e=b.instance.description+
" volume list";G.a.forPromise(a,{delay:!0,initialMessage:"Retrieving "+e+".",errorPrefix:"Error retrieving "+e+": "});return a})}},{key:"getChangeStackList",value:function(a,b){var e=this;return a.memoize.getUncounted({instance:this.instance,type:"brainmaps:getChangeStackList",volumeId:b},function(){var a=Object(r.b)(e.instance,e.credentialsProvider,{method:"GET",path:"/v1beta2/changes/"+b+"/change_stacks",responseType:"json"}).then(function(a){return t(a)}),c="change stacks for "+b;G.a.forPromise(a,
{delay:!0,initialMessage:"Retrieving "+c+".",errorPrefix:"Error retrieving "+c+": "});return a})}},{key:"volumeCompleter",value:function(a,b){var e=this;return this.getVolumeList(b).then(function(c){var d=a.match(/^([^:]+:[^:]+:[^:]+):(.*)$/);if(null!==d){var h=d[1],g=d[2];return e.getChangeStackList(b,h).then(function(a){if(void 0===a)throw null;return{offset:h.length+1,completions:Object(J.b)(g,a)}})}var k=a.lastIndexOf(":")+1;d=a.substring(0,k);k=a.substring(k);var r=c.hierarchicalVolumeIds.get(d);
if(void 0===r)throw null;return d?{offset:d.length,completions:Object(J.b)(k,r)}:{offset:0,completions:Object(J.c)(k,r,function(a){return a},function(a){return(a=c.projects.get(a.substring(0,a.length-1)))&&a.label})}})}},{key:"description",get:function(){return this.instance.description}}]);return b}(h.a);f.productionInstance={description:"Google Brain Maps",serverUrls:["https://brainmaps.googleapis.com"]}},function(m,f,d){d(30);d(177);d(178);var u=d(104),p=d(179),q=d(180),a=d(181),c=d(105),n=d(106);
d.d(f,"a",function(){return u});d.d(f,"b",function(){return p});d.d(f,"c",function(){return q});d.d(f,"d",function(){return a});d.d(f,"e",function(){return c});d.d(f,"f",function(){return n})},function(m,f,d){function u(a,c,d){var f=c[0],n=c[1],l=c[2],k=c[3],g=c[4],e=c[5],b=c[6],h=c[7];c=c[8];var r=d[0],A=d[1],p=d[2],q=d[3],u=d[4],m=d[5],D=d[6],G=d[7];d=d[8];a[0]=r*f+A*k+p*b;a[1]=r*n+A*g+p*h;a[2]=r*l+A*e+p*c;a[3]=q*f+u*k+m*b;a[4]=q*n+u*g+m*h;a[5]=q*l+u*e+m*c;a[6]=D*f+G*k+d*b;a[7]=D*n+G*g+d*h;a[8]=
D*l+G*e+d*c;return a}function p(a,c,d){a[0]=c[0]-d[0];a[1]=c[1]-d[1];a[2]=c[2]-d[2];a[3]=c[3]-d[3];a[4]=c[4]-d[4];a[5]=c[5]-d[5];a[6]=c[6]-d[6];a[7]=c[7]-d[7];a[8]=c[8]-d[8];return a}Object.defineProperty(f,"__esModule",{value:!0});f.create=function(){var a=new q.a(9);a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=1;a[5]=0;a[6]=0;a[7]=0;a[8]=1;return a};f.fromMat4=function(a,c){a[0]=c[0];a[1]=c[1];a[2]=c[2];a[3]=c[4];a[4]=c[5];a[5]=c[6];a[6]=c[8];a[7]=c[9];a[8]=c[10];return a};f.clone=function(a){var c=new q.a(9);
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};f.copy=function(a,c){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};f.fromValues=function(a,c,d,f,t,l,k,g,e){var b=new q.a(9);b[0]=a;b[1]=c;b[2]=d;b[3]=f;b[4]=t;b[5]=l;b[6]=k;b[7]=g;b[8]=e;return b};f.set=function(a,c,d,f,t,l,k,g,e,b){a[0]=c;a[1]=d;a[2]=f;a[3]=t;a[4]=l;a[5]=k;a[6]=g;a[7]=e;a[8]=b;return a};f.identity=function(a){a[0]=1;a[1]=0;a[2]=
0;a[3]=0;a[4]=1;a[5]=0;a[6]=0;a[7]=0;a[8]=1;return a};f.transpose=function(a,c){if(a===c){var d=c[1],f=c[2],t=c[5];a[1]=c[3];a[2]=c[6];a[3]=d;a[5]=c[7];a[6]=f;a[7]=t}else a[0]=c[0],a[1]=c[3],a[2]=c[6],a[3]=c[1],a[4]=c[4],a[5]=c[7],a[6]=c[2],a[7]=c[5],a[8]=c[8];return a};f.invert=function(a,c){var d=c[0],f=c[1],t=c[2],l=c[3],k=c[4],g=c[5],e=c[6],b=c[7];c=c[8];var h=c*k-g*b,r=-c*l+g*e,A=b*l-k*e,p=d*h+f*r+t*A;if(!p)return null;p=1/p;a[0]=h*p;a[1]=(-c*f+t*b)*p;a[2]=(g*f-t*k)*p;a[3]=r*p;a[4]=(c*d-t*e)*
p;a[5]=(-g*d+t*l)*p;a[6]=A*p;a[7]=(-b*d+f*e)*p;a[8]=(k*d-f*l)*p;return a};f.adjoint=function(a,c){var d=c[0],f=c[1],t=c[2],l=c[3],k=c[4],g=c[5],e=c[6],b=c[7];c=c[8];a[0]=k*c-g*b;a[1]=t*b-f*c;a[2]=f*g-t*k;a[3]=g*e-l*c;a[4]=d*c-t*e;a[5]=t*l-d*g;a[6]=l*b-k*e;a[7]=f*e-d*b;a[8]=d*k-f*l;return a};f.determinant=function(a){var c=a[3],d=a[4],f=a[5],t=a[6],l=a[7],k=a[8];return a[0]*(k*d-f*l)+a[1]*(-k*c+f*t)+a[2]*(l*c-d*t)};f.multiply=u;f.translate=function(a,c,d){var f=c[0],n=c[1],l=c[2],k=c[3],g=c[4],e=c[5],
b=c[6],h=c[7];c=c[8];var r=d[0];d=d[1];a[0]=f;a[1]=n;a[2]=l;a[3]=k;a[4]=g;a[5]=e;a[6]=r*f+d*k+b;a[7]=r*n+d*g+h;a[8]=r*l+d*e+c;return a};f.rotate=function(a,c,d){var f=c[0],n=c[1],l=c[2],k=c[3],g=c[4],e=c[5],b=c[6],h=c[7];c=c[8];var r=Math.sin(d);d=Math.cos(d);a[0]=d*f+r*k;a[1]=d*n+r*g;a[2]=d*l+r*e;a[3]=d*k-r*f;a[4]=d*g-r*n;a[5]=d*e-r*l;a[6]=b;a[7]=h;a[8]=c;return a};f.scale=function(a,c,d){var f=d[0];d=d[1];a[0]=f*c[0];a[1]=f*c[1];a[2]=f*c[2];a[3]=d*c[3];a[4]=d*c[4];a[5]=d*c[5];a[6]=c[6];a[7]=c[7];
a[8]=c[8];return a};f.fromTranslation=function(a,c){a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=1;a[5]=0;a[6]=c[0];a[7]=c[1];a[8]=1;return a};f.fromRotation=function(a,c){var d=Math.sin(c);c=Math.cos(c);a[0]=c;a[1]=d;a[2]=0;a[3]=-d;a[4]=c;a[5]=0;a[6]=0;a[7]=0;a[8]=1;return a};f.fromScaling=function(a,c){a[0]=c[0];a[1]=0;a[2]=0;a[3]=0;a[4]=c[1];a[5]=0;a[6]=0;a[7]=0;a[8]=1;return a};f.fromMat2d=function(a,c){a[0]=c[0];a[1]=c[1];a[2]=0;a[3]=c[2];a[4]=c[3];a[5]=0;a[6]=c[4];a[7]=c[5];a[8]=1;return a};f.fromQuat=
function(a,c){var d=c[0],f=c[1],t=c[2];c=c[3];var l=d+d,k=f+f,g=t+t;d*=l;var e=f*l;f*=k;var b=t*l,h=t*k;t*=g;l*=c;k*=c;c*=g;a[0]=1-f-t;a[3]=e-c;a[6]=b+k;a[1]=e+c;a[4]=1-d-t;a[7]=h-l;a[2]=b-k;a[5]=h+l;a[8]=1-d-f;return a};f.normalFromMat4=function(a,c){var d=c[0],f=c[1],t=c[2],l=c[3],k=c[4],g=c[5],e=c[6],b=c[7],h=c[8],r=c[9],p=c[10],q=c[11],u=c[12],m=c[13],x=c[14];c=c[15];var D=d*g-f*k,G=d*e-t*k,J=d*b-l*k,C=f*e-t*g,B=f*b-l*g,F=t*b-l*e,P=h*m-r*u,H=h*x-p*u;h=h*c-q*u;var N=r*x-p*m;r=r*c-q*m;p=p*c-q*x;
q=D*p-G*r+J*N+C*h-B*H+F*P;if(!q)return null;q=1/q;a[0]=(g*p-e*r+b*N)*q;a[1]=(e*h-k*p-b*H)*q;a[2]=(k*r-g*h+b*P)*q;a[3]=(t*r-f*p-l*N)*q;a[4]=(d*p-t*h+l*H)*q;a[5]=(f*h-d*r-l*P)*q;a[6]=(m*F-x*B+c*C)*q;a[7]=(x*J-u*F-c*G)*q;a[8]=(u*B-m*J+c*D)*q;return a};f.projection=function(a,c,d){a[0]=2/c;a[1]=0;a[2]=0;a[3]=0;a[4]=-2/d;a[5]=0;a[6]=-1;a[7]=1;a[8]=1;return a};f.str=function(a){return"mat3("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+", "+a[6]+", "+a[7]+", "+a[8]+")"};f.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))};f.add=function(a,c,d){a[0]=c[0]+d[0];a[1]=c[1]+d[1];a[2]=c[2]+d[2];a[3]=c[3]+d[3];a[4]=c[4]+d[4];a[5]=c[5]+d[5];a[6]=c[6]+d[6];a[7]=c[7]+d[7];a[8]=c[8]+d[8];return a};f.subtract=p;f.multiplyScalar=function(a,c,d){a[0]=c[0]*d;a[1]=c[1]*d;a[2]=c[2]*d;a[3]=c[3]*d;a[4]=c[4]*d;a[5]=c[5]*d;a[6]=c[6]*d;a[7]=c[7]*d;a[8]=c[8]*d;return a};f.multiplyScalarAndAdd=function(a,
c,d,f){a[0]=c[0]+d[0]*f;a[1]=c[1]+d[1]*f;a[2]=c[2]+d[2]*f;a[3]=c[3]+d[3]*f;a[4]=c[4]+d[4]*f;a[5]=c[5]+d[5]*f;a[6]=c[6]+d[6]*f;a[7]=c[7]+d[7]*f;a[8]=c[8]+d[8]*f;return a};f.exactEquals=function(a,c){return 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]};f.equals=function(a,c){var d=a[0],f=a[1],t=a[2],l=a[3],k=a[4],g=a[5],e=a[6],b=a[7];a=a[8];var h=c[0],r=c[1],p=c[2],y=c[3],u=c[4],m=c[5],x=c[6],D=c[7];c=c[8];return Math.abs(d-h)<=
q.b*Math.max(1,Math.abs(d),Math.abs(h))&&Math.abs(f-r)<=q.b*Math.max(1,Math.abs(f),Math.abs(r))&&Math.abs(t-p)<=q.b*Math.max(1,Math.abs(t),Math.abs(p))&&Math.abs(l-y)<=q.b*Math.max(1,Math.abs(l),Math.abs(y))&&Math.abs(k-u)<=q.b*Math.max(1,Math.abs(k),Math.abs(u))&&Math.abs(g-m)<=q.b*Math.max(1,Math.abs(g),Math.abs(m))&&Math.abs(e-x)<=q.b*Math.max(1,Math.abs(e),Math.abs(x))&&Math.abs(b-D)<=q.b*Math.max(1,Math.abs(b),Math.abs(D))&&Math.abs(a-c)<=q.b*Math.max(1,Math.abs(a),Math.abs(c))};var q=d(30);
f.mul=u;f.sub=p},function(m,f,d){function u(){var a=new e.a(3);a[0]=0;a[1]=0;a[2]=0;return a}function p(a){var b=a[0],e=a[1];a=a[2];return Math.sqrt(b*b+e*e+a*a)}function q(a,c,d){var b=new e.a(3);b[0]=a;b[1]=c;b[2]=d;return b}function a(a,e,c){a[0]=e[0]-c[0];a[1]=e[1]-c[1];a[2]=e[2]-c[2];return a}function c(a,e,c){a[0]=e[0]*c[0];a[1]=e[1]*c[1];a[2]=e[2]*c[2];return a}function n(a,e,c){a[0]=e[0]/c[0];a[1]=e[1]/c[1];a[2]=e[2]/c[2];return a}function v(a,e){var b=e[0]-a[0],c=e[1]-a[1];a=e[2]-a[2];return Math.sqrt(b*
b+c*c+a*a)}function t(a,e){var b=e[0]-a[0],c=e[1]-a[1];a=e[2]-a[2];return b*b+c*c+a*a}function l(a){var b=a[0],e=a[1];a=a[2];return b*b+e*e+a*a}function k(a,e){var b=e[0],c=e[1],d=e[2];b=b*b+c*c+d*d;0<b&&(b=1/Math.sqrt(b),a[0]=e[0]*b,a[1]=e[1]*b,a[2]=e[2]*b);return a}function g(a,e){return a[0]*e[0]+a[1]*e[1]+a[2]*e[2]}Object.defineProperty(f,"__esModule",{value:!0});f.create=u;f.clone=function(a){var b=new e.a(3);b[0]=a[0];b[1]=a[1];b[2]=a[2];return b};f.length=p;f.fromValues=q;f.copy=function(a,
e){a[0]=e[0];a[1]=e[1];a[2]=e[2];return a};f.set=function(a,e,c,d){a[0]=e;a[1]=c;a[2]=d;return a};f.add=function(a,e,c){a[0]=e[0]+c[0];a[1]=e[1]+c[1];a[2]=e[2]+c[2];return a};f.subtract=a;f.multiply=c;f.divide=n;f.ceil=function(a,e){a[0]=Math.ceil(e[0]);a[1]=Math.ceil(e[1]);a[2]=Math.ceil(e[2]);return a};f.floor=function(a,e){a[0]=Math.floor(e[0]);a[1]=Math.floor(e[1]);a[2]=Math.floor(e[2]);return a};f.min=function(a,e,c){a[0]=Math.min(e[0],c[0]);a[1]=Math.min(e[1],c[1]);a[2]=Math.min(e[2],c[2]);
return a};f.max=function(a,e,c){a[0]=Math.max(e[0],c[0]);a[1]=Math.max(e[1],c[1]);a[2]=Math.max(e[2],c[2]);return a};f.round=function(a,e){a[0]=Math.round(e[0]);a[1]=Math.round(e[1]);a[2]=Math.round(e[2]);return a};f.scale=function(a,e,c){a[0]=e[0]*c;a[1]=e[1]*c;a[2]=e[2]*c;return a};f.scaleAndAdd=function(a,e,c,d){a[0]=e[0]+c[0]*d;a[1]=e[1]+c[1]*d;a[2]=e[2]+c[2]*d;return a};f.distance=v;f.squaredDistance=t;f.squaredLength=l;f.negate=function(a,e){a[0]=-e[0];a[1]=-e[1];a[2]=-e[2];return a};f.inverse=
function(a,e){a[0]=1/e[0];a[1]=1/e[1];a[2]=1/e[2];return a};f.normalize=k;f.dot=g;f.cross=function(a,e,c){var b=e[0],d=e[1];e=e[2];var h=c[0],g=c[1];c=c[2];a[0]=d*c-e*g;a[1]=e*h-b*c;a[2]=b*g-d*h;return a};f.lerp=function(a,e,c,d){var b=e[0],h=e[1];e=e[2];a[0]=b+d*(c[0]-b);a[1]=h+d*(c[1]-h);a[2]=e+d*(c[2]-e);return a};f.hermite=function(a,e,c,d,g,k){var b=k*k,h=b*(2*k-3)+1,f=b*(k-2)+k,r=b*(k-1);k=b*(3-2*k);a[0]=e[0]*h+c[0]*f+d[0]*r+g[0]*k;a[1]=e[1]*h+c[1]*f+d[1]*r+g[1]*k;a[2]=e[2]*h+c[2]*f+d[2]*r+
g[2]*k;return a};f.bezier=function(a,e,c,d,g,k){var b=1-k,h=b*b,f=k*k,r=h*b;h*=3*k;b*=3*f;k*=f;a[0]=e[0]*r+c[0]*h+d[0]*b+g[0]*k;a[1]=e[1]*r+c[1]*h+d[1]*b+g[1]*k;a[2]=e[2]*r+c[2]*h+d[2]*b+g[2]*k;return a};f.random=function(a,c){c=c||1;var b=2*e.c()*Math.PI,d=2*e.c()-1,h=Math.sqrt(1-d*d)*c;a[0]=Math.cos(b)*h;a[1]=Math.sin(b)*h;a[2]=d*c;return a};f.transformMat4=function(a,e,c){var b=e[0],d=e[1];e=e[2];var h=c[3]*b+c[7]*d+c[11]*e+c[15];h=h||1;a[0]=(c[0]*b+c[4]*d+c[8]*e+c[12])/h;a[1]=(c[1]*b+c[5]*d+c[9]*
e+c[13])/h;a[2]=(c[2]*b+c[6]*d+c[10]*e+c[14])/h;return a};f.transformMat3=function(a,e,c){var b=e[0],d=e[1];e=e[2];a[0]=b*c[0]+d*c[3]+e*c[6];a[1]=b*c[1]+d*c[4]+e*c[7];a[2]=b*c[2]+d*c[5]+e*c[8];return a};f.transformQuat=function(a,e,c){var b=e[0],d=e[1],h=e[2];e=c[0];var g=c[1],k=c[2];c=c[3];var f=c*b+g*h-k*d,r=c*d+k*b-e*h,n=c*h+e*d-g*b;b=-e*b-g*d-k*h;a[0]=f*c+b*-e+r*-k-n*-g;a[1]=r*c+b*-g+n*-e-f*-k;a[2]=n*c+b*-k+f*-g-r*-e;return a};f.rotateX=function(a,e,c,d){var b=[],h=[];b[0]=e[0]-c[0];b[1]=e[1]-
c[1];b[2]=e[2]-c[2];h[0]=b[0];h[1]=b[1]*Math.cos(d)-b[2]*Math.sin(d);h[2]=b[1]*Math.sin(d)+b[2]*Math.cos(d);a[0]=h[0]+c[0];a[1]=h[1]+c[1];a[2]=h[2]+c[2];return a};f.rotateY=function(a,e,c,d){var b=[],h=[];b[0]=e[0]-c[0];b[1]=e[1]-c[1];b[2]=e[2]-c[2];h[0]=b[2]*Math.sin(d)+b[0]*Math.cos(d);h[1]=b[1];h[2]=b[2]*Math.cos(d)-b[0]*Math.sin(d);a[0]=h[0]+c[0];a[1]=h[1]+c[1];a[2]=h[2]+c[2];return a};f.rotateZ=function(a,e,c,d){var b=[],h=[];b[0]=e[0]-c[0];b[1]=e[1]-c[1];b[2]=e[2]-c[2];h[0]=b[0]*Math.cos(d)-
b[1]*Math.sin(d);h[1]=b[0]*Math.sin(d)+b[1]*Math.cos(d);h[2]=b[2];a[0]=h[0]+c[0];a[1]=h[1]+c[1];a[2]=h[2]+c[2];return a};f.angle=function(a,e){a=q(a[0],a[1],a[2]);e=q(e[0],e[1],e[2]);k(a,a);k(e,e);e=g(a,e);return 1<e?0:-1>e?Math.PI:Math.acos(e)};f.str=function(a){return"vec3("+a[0]+", "+a[1]+", "+a[2]+")"};f.exactEquals=function(a,e){return a[0]===e[0]&&a[1]===e[1]&&a[2]===e[2]};f.equals=function(a,c){var b=a[0],d=a[1];a=a[2];var h=c[0],g=c[1];c=c[2];return Math.abs(b-h)<=e.b*Math.max(1,Math.abs(b),
Math.abs(h))&&Math.abs(d-g)<=e.b*Math.max(1,Math.abs(d),Math.abs(g))&&Math.abs(a-c)<=e.b*Math.max(1,Math.abs(a),Math.abs(c))};var e=d(30);f.sub=a;f.mul=c;f.div=n;f.dist=v;f.sqrDist=t;f.len=p;f.sqrLen=l;m=function(){var a=u();return function(b,e,c,d,g,k){e||(e=3);c||(c=0);for(d=d?Math.min(d*e+c,b.length):b.length;c<d;c+=e)a[0]=b[c],a[1]=b[c+1],a[2]=b[c+2],g(a,a,k),b[c]=a[0],b[c+1]=a[1],b[c+2]=a[2];return b}}();f.forEach=m},function(m,f,d){function u(){var a=new g.a(4);a[0]=0;a[1]=0;a[2]=0;a[3]=0;return a}
function p(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];return a}function q(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];return a}function a(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];return a}function c(a,b,c){a[0]=b[0]*c;a[1]=b[1]*c;a[2]=b[2]*c;a[3]=b[3]*c;return a}function n(a,b){var e=b[0]-a[0],c=b[1]-a[1],d=b[2]-a[2];a=b[3]-a[3];return Math.sqrt(e*e+c*c+d*d+a*a)}function v(a,b){var e=b[0]-a[0],c=b[1]-a[1],d=b[2]-a[2];a=b[3]-
a[3];return e*e+c*c+d*d+a*a}function t(a){var b=a[0],e=a[1],c=a[2];a=a[3];return Math.sqrt(b*b+e*e+c*c+a*a)}function l(a){var b=a[0],e=a[1],c=a[2];a=a[3];return b*b+e*e+c*c+a*a}function k(a,b){var e=b[0],c=b[1],d=b[2];b=b[3];var g=e*e+c*c+d*d+b*b;0<g&&(g=1/Math.sqrt(g),a[0]=e*g,a[1]=c*g,a[2]=d*g,a[3]=b*g);return a}Object.defineProperty(f,"__esModule",{value:!0});f.create=u;f.clone=function(a){var b=new g.a(4);b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];return b};f.fromValues=function(a,b,c,d){var e=new g.a(4);
e[0]=a;e[1]=b;e[2]=c;e[3]=d;return e};f.copy=function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];return a};f.set=function(a,b,c,d,g){a[0]=b;a[1]=c;a[2]=d;a[3]=g;return a};f.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];return a};f.subtract=p;f.multiply=q;f.divide=a;f.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};f.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};f.min=function(a,b,c){a[0]=Math.min(b[0],c[0]);a[1]=Math.min(b[1],c[1]);a[2]=Math.min(b[2],c[2]);a[3]=Math.min(b[3],c[3]);return a};f.max=function(a,b,c){a[0]=Math.max(b[0],c[0]);a[1]=Math.max(b[1],c[1]);a[2]=Math.max(b[2],c[2]);a[3]=Math.max(b[3],c[3]);return a};f.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};f.scale=c;f.scaleAndAdd=function(a,b,c,d){a[0]=b[0]+c[0]*d;a[1]=b[1]+c[1]*d;a[2]=b[2]+
c[2]*d;a[3]=b[3]+c[3]*d;return a};f.distance=n;f.squaredDistance=v;f.length=t;f.squaredLength=l;f.negate=function(a,b){a[0]=-b[0];a[1]=-b[1];a[2]=-b[2];a[3]=-b[3];return a};f.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};f.normalize=k;f.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]};f.lerp=function(a,b,c,d){var e=b[0],h=b[1],g=b[2];b=b[3];a[0]=e+d*(c[0]-e);a[1]=h+d*(c[1]-h);a[2]=g+d*(c[2]-g);a[3]=b+d*(c[3]-b);return a};f.random=function(a,b){b=
b||1;a[0]=g.c();a[1]=g.c();a[2]=g.c();a[3]=g.c();k(a,a);c(a,a,b);return a};f.transformMat4=function(a,b,c){var e=b[0],d=b[1],h=b[2];b=b[3];a[0]=c[0]*e+c[4]*d+c[8]*h+c[12]*b;a[1]=c[1]*e+c[5]*d+c[9]*h+c[13]*b;a[2]=c[2]*e+c[6]*d+c[10]*h+c[14]*b;a[3]=c[3]*e+c[7]*d+c[11]*h+c[15]*b;return a};f.transformQuat=function(a,b,c){var e=b[0],d=b[1],h=b[2],g=c[0],k=c[1],f=c[2];c=c[3];var n=c*e+k*h-f*d,l=c*d+f*e-g*h,t=c*h+g*d-k*e;e=-g*e-k*d-f*h;a[0]=n*c+e*-g+l*-f-t*-k;a[1]=l*c+e*-k+t*-g-n*-f;a[2]=t*c+e*-f+n*-k-l*
-g;a[3]=b[3];return a};f.str=function(a){return"vec4("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"};f.exactEquals=function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]};f.equals=function(a,b){var e=a[0],c=a[1],d=a[2];a=a[3];var k=b[0],f=b[1],n=b[2];b=b[3];return Math.abs(e-k)<=g.b*Math.max(1,Math.abs(e),Math.abs(k))&&Math.abs(c-f)<=g.b*Math.max(1,Math.abs(c),Math.abs(f))&&Math.abs(d-n)<=g.b*Math.max(1,Math.abs(d),Math.abs(n))&&Math.abs(a-b)<=g.b*Math.max(1,Math.abs(a),Math.abs(b))};var g=
d(30);f.sub=p;f.mul=q;f.div=a;f.dist=n;f.sqrDist=v;f.len=t;f.sqrLen=l;m=function(){var a=u();return function(b,e,c,d,g,k){e||(e=4);c||(c=0);for(d=d?Math.min(d*e+c,b.length):b.length;c<d;c+=e)a[0]=b[c],a[1]=b[c+1],a[2]=b[c+2],a[3]=b[c+3],g(a,a,k),b[c]=a[0],b[c+1]=a[1],b[c+2]=a[2],b[c+3]=a[3];return b}}();f.forEach=m},function(m,f,d){f.a=function(d){d=Math.ceil((void 0===d?128:d)/32);var f=new Uint32Array(d);crypto.getRandomValues(f);for(var q="",a=0;a<d;++a)q+=("00000000"+f[a].toString(16)).slice(-8);
return q}},function(m,f,d){f=d(186);d="object"==typeof self&&self&&self.Object===Object&&self;f=f||d||Function("return this")();m.exports=f},function(m,f,d){f=d(108).Symbol;m.exports=f},function(m,f,d){var u=d(5),p=d(76);m.exports=function(d,a,c){var f=!0,v=!0;if("function"!=typeof d)throw new TypeError("Expected a function");p(c)&&(f="leading"in c?!!c.leading:f,v="trailing"in c?!!c.trailing:v);return u(d,a,{leading:f,maxWait:a,trailing:v})}},function(m,f,d){function u(a,c){if("function"!==typeof c&&
null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}d.d(f,"a",function(){return a});f.c=function(a,d){if(void 0!==d){"string"===typeof d&&(d={type:d});Object(p.t)(d);var f=Object(p.v)(d,"type",p.A);f=c.get(f);if(void 0===f)throw Error("Invalid tool type: "+JSON.stringify(d)+".");
return f(a,d)}};f.b=function(a,d){c.set(a,d)};m=d(0);var p=d(2),q=function(){function a(a,c){for(var d=0;d<c.length;d++){var k=c[d];k.enumerable=k.enumerable||!1;k.configurable=!0;"value"in k&&(k.writable=!0);Object.defineProperty(a,k.key,k)}}return function(c,d,f){d&&a(c.prototype,d);f&&a(c,f);return c}}(),a=function(a){function c(){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");var a=(c.__proto__||Object.getPrototypeOf(c)).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}u(c,a);q(c,[{key:"setActive",value:function(a){}},{key:"deactivate",value:function(){}}]);return c}(m.a),c=new Map},function(m,f,d){function u(a,c){if(!(a instanceof c))throw new TypeError("Cannot call a class as a function");}function p(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,
writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}f.c=function(a,c,d){d=void 0===d?!1:d;c=c.attribute("aIndexRaw");0<=c&&(d&&a.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(c,0),a.disableVertexAttribArray(c))};f.d=function(a){return a.memoize.get("IndexBuffer",function(){return new v(a)})};f.b=function(a){a.addAttribute("highp vec3","aIndexRaw");a.addVertexCode(c.m);a.addVertexCode("\nuint32_t getPrimitiveIndex() {\n  uint32_t result;\n  result.value = vec4(aIndexRaw, 0.0);\n  return result;\n}\n")};
d.d(f,"a",function(){return t});f.e=function(c,d){return q.a.fromData(c,new Uint8Array(d.buffer,d.byteOffset,d.byteLength),a.a,a.v)};m=d(0);var q=d(16),a=d(11),c=d(17),n=function(){function a(a,c){for(var e=0;e<c.length;e++){var b=c[e];b.enumerable=b.enumerable||!1;b.configurable=!0;"value"in b&&(b.writable=!0);Object.defineProperty(a,b.key,b)}}return function(c,d,e){d&&a(c.prototype,d);e&&a(c,e);return c}}(),v=function(c){function d(a){u(this,d);var e=(d.__proto__||Object.getPrototypeOf(d)).call(this);
if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");e=!e||"object"!==typeof e&&"function"!==typeof e?this:e;e.gl=a;e.buffer=e.registerDisposer(new q.a(a));return e}p(d,c);n(d,[{key:"resize",value:function(a){var e;if(256>a){var b=e=new Uint8Array(a);for(var c=0;c<a;++c)b[c]=c;b=1}else if(65536>a){b=e=new Uint8Array(2*a);c=0;for(var d=2*a,g=0;g<d;g+=2)b[g]=c,b[g+1]=c>>8,++c;b=2}else if(16777216>a){b=e=new Uint8Array(3*a);c=3*a;for(g=d=0;g<c;g+=3)b[g]=d,b[g+
1]=d>>8,b[g+2]=d>>16,++d;b=3}else throw Error("Length of index buffer must not exceed 2^24.");this.buffer.setData(e);this.numComponents=b;this.length=a}},{key:"ensure",value:function(a){(void 0===this.length||this.length<a)&&this.resize(a);return this}},{key:"bindToVertexAttrib",value:function(c){this.buffer.bindToVertexAttrib(c,this.numComponents,a.G,!0)}},{key:"bind",value:function(a,e){e=void 0===e?0:e;a=a.attribute("aIndexRaw");0<=a&&(this.bindToVertexAttrib(a),0!==e&&this.gl.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(a,
e))}}]);return d}(m.a),t=function(){function c(a){u(this,c);this.name=a;this.attributeName="a"+this.name;this.getterName="get"+this.name}n(c,[{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(c,d){c.bindToVertexAttrib(d.attribute(this.attributeName),4,a.G,!1)}},{key:"disable",value:function(a){a.gl.disableVertexAttribArray(a.attribute(this.attributeName))}}]);
return c}()},function(m,f,d){function u(a){a.setFragmentMain("gl_FragColor = getValue0();")}f.a=u;f.b=function(a,c,d){c=void 0===c?u:c;d=void 0===d?1:d;return a.memoize.get("elementWiseTextureShader:"+d+":"+Object(p.a)(c),function(){var f=new q.a(a);f.addVarying("vec2","vTexCoord");f.addUniform("sampler2D","uSampler",d);f.addInitializer(function(c){for(var k=[],g=0;g<d;++g)k[g]=g;a.uniform1iv(c.uniform("uSampler"),k)});for(var n=0;n<d;++n)f.addFragmentCode("\nvec4 getValue"+n+"() {\n  return texture2D(uSampler["+
n+"], vTexCoord);\n}\n");f.addUniform("mat4","uProjectionMatrix");f.require(c);f.addAttribute("vec4","aVertexPosition");f.addAttribute("vec2","aTexCoord");f.setVertexMain("vTexCoord = aTexCoord; gl_Position = uProjectionMatrix * aVertexPosition;");return f.build()})};f.c=function(a){return a.memoize.get("trivialColorShader",function(){var c=new q.a(a);c.addVarying("vec4","vColor");c.setFragmentMain("gl_FragColor = vColor;");c.addAttribute("vec4","aVertexPosition");c.addAttribute("vec4","aColor");
c.addUniform("mat4","uProjectionMatrix");c.setVertexMain("vColor = aColor; gl_Position = uProjectionMatrix * aVertexPosition;");return c.build()})};var p=d(25),q=d(27)},function(m,f,d){function u(a,e){if(!(a instanceof e))throw new TypeError("Cannot call a class as a function");}function p(a,e){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==typeof e&&"function"!==typeof e?a:e}function q(a,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+
typeof e);a.prototype=Object.create(e&&e.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});e&&(Object.setPrototypeOf?Object.setPrototypeOf(a,e):a.__proto__=e)}function a(a){for(var b=0,e=0;3>e;++e)0>a[e]&&(b+=1<<e);return b}d.d(f,"a",function(){return e});m=d(0);var c=d(1),n=d(16),v=function(){function a(a,b){for(var e=0;e<b.length;e++){var c=b[e];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,
e,c){e&&a(b.prototype,e);c&&a(b,c);return b}}(),t=c.s.create(),l=c.s.create(),k=new Float32Array([0,0,0,1,0,0,0,1,0,1,1,0,0,0,1,1,0,1,0,1,1,1,1,1]);f.b=k;var g=function(a){function b(a){u(this,b);var e=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));e.outputVertexIndices=e.registerDisposer(n.a.fromData(a,new Float32Array([0,1,2,3,4,5]),a.ARRAY_BUFFER,a.STATIC_DRAW));a=[0,1,2,4,5,3,6,7];for(var c=[0,1,2,5,3,4,6,7],d=[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],h=[],k=0;8>k;++k)for(var f=0;f<d.length;++f)h.push(a[g[8*c[k]+d[f]]]);e.vertexIndices=new Int32Array(h);return e}q(b,a);v(b,null,[{key:"get",value:function(a){return a.memoize.get("SliceViewShaderBuffers",function(){return new b(a)})}}]);return b}(m.a),e=function(b){function e(a){u(this,e);var b=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));
b.data=b.registerDisposer(g.get(a));return b}q(e,b);v(e,null,[{key:"get",value:function(a){return a.memoize.get("BoundingBoxCrossSectionRenderHelper",function(){return new e(a)})}}]);v(e,[{key:"defineShader",value:function(a){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"),k)});a.addVertexCode("\nvec3 getBoundingBoxPlaneIntersectionVertexPosition(vec3 chunkSize, vec3 boxLower, vec3 lowerClipBound, vec3 upperClipBound, int vertexIndex) {\n  for (int e = 0; e < 4; ++e) {\n    highp ivec2 vidx = uVertexIndex[vertexIndex*4 + e];\n    highp vec3 v1 = max(lowerClipBound, min(upperClipBound, chunkSize * uVertexBasePosition[vidx.x] + boxLower));\n    highp vec3 v2 = max(lowerClipBound, min(upperClipBound, chunkSize * uVertexBasePosition[vidx.y] + boxLower));\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        return position;\n      }\n    }\n  }\n  return vec3(0, 0, 0);\n}\n")}},
{key:"computeVertexPositionDebug",value:function(b,e,d,g,h,f,n){var r=a(h);r=this.data.vertexIndices.subarray(48*r,48*(r+1));for(var l=[0,0],t=[c.s.create(),c.s.create()],v=c.s.create(),p=c.s.create(),q=function(a){return k.subarray(3*a,3*a+3)},A=0;4>A;++A){for(var u=0;2>u;++u)l[u]=r[2*(4*n+A)+u],c.s.multiply(t[u],b,q(l[u])),c.s.add(t[u],t[u],f),c.s.min(t[u],t[u],d),c.s.max(t[u],t[u],e);c.s.subtract(v,t[1],t[0]);u=c.s.dot(v,h);if(.001<Math.abs(u)){var m=(g-c.s.dot(t[0],h))/u;if(-.001<=m&&1.001>=m)return m=
Math.max(0,Math.min(1,m)),c.s.scaleAndAdd(p,t[0],v,m),p;console.log("vertex "+n+", e = "+A+", skipped, deom = "+u+", "+("vDir = "+Object(c.t)(v)+", ")+("uPlaneNormal = "+Object(c.t)(h)+", ")+("lambda="+m))}else console.log("vertex "+n+", e = "+A+", skipped, deom = "+u+", "+("vDir = "+Object(c.t)(v)+", uPlaneNormal = "+Object(c.t)(h)))}}},{key:"setPlane",value:function(b,e,c){var d=b.gl;d.uniform3fv(b.uniform("uPlaneNormal"),e);d.uniform1f(b.uniform("uPlaneDistance"),c);e=a(e);d.uniform2iv(b.uniform("uVertexIndex"),
this.data.vertexIndices.subarray(48*e,48*(e+1)))}},{key:"setViewportPlane",value:function(a,b,e,d){b=Object(c.p)(t,b,d);e=c.s.dot(c.s.transformMat4(l,e,d),b);this.setPlane(a,b,e)}}]);return e}(m.a)},function(m,f,d){function u(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,
c):a.__proto__=c)}d.d(f,"a",function(){return c});m=d(0);var p=d(80),q=d(53),a=function(){function a(a,c){for(var d=0;d<c.length;d++){var k=c[d];k.enumerable=k.enumerable||!1;k.configurable=!0;"value"in k&&(k.writable=!0);Object.defineProperty(a,k.key,k)}}return function(c,d,f){d&&a(c.prototype,d);f&&a(c,f);return c}}();f.b=p.b;var c=function(c){function d(a,c){c=void 0===c?1:c;if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");var k=(d.__proto__||Object.getPrototypeOf(d)).call(this);
if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");k=!k||"object"!==typeof k&&"function"!==typeof k?this:k;k.linesPerInstance=c;k.lineOffsetsBuffer=Object(q.a)(a,0,-1,1,1,c,1);k.quadHelper=k.registerDisposer(new p.a(a,c));return k}u(d,c);a(d,[{key:"defineShader",value:function(a){a.addAttribute("highp vec2","aLineOffset");a.addUniform("highp vec3","uLineParams");a.addVarying("highp float","vLineCoord");a.addVertexCode("\nvoid emitLine(mat4 projection, vec3 vertexA, vec3 vertexB) {\n  vec3 vertexPosition = mix(vertexA, vertexB, aLineOffset.x);\n  vec3 otherVertexPosition = mix(vertexB, vertexA, aLineOffset.x);\n\n  vec4 vertexPositionClip = projection * vec4(vertexPosition, 1.0);\n  vec4 otherVertexPositionClip = projection * vec4(otherVertexPosition, 1.0);\n\n  vec3 vertexPositionDevice = vertexPositionClip.xyz / vertexPositionClip.w;\n  vec3 otherVertexPositionDevice = otherVertexPositionClip.xyz / otherVertexPositionClip.w;\n\n  vec2 lineDirection = normalize(otherVertexPositionDevice.xy - vertexPositionDevice.xy);\n  vec2 lineNormal = vec2(lineDirection.y, -lineDirection.x);\n\n  gl_Position = vertexPositionClip;\n  gl_Position.xy += aLineOffset.y * (2.0 * aLineOffset.x - 1.0) * lineNormal * uLineParams.xy * 0.5 * gl_Position.w;\n  vLineCoord = aLineOffset.y;\n}\n");
a.addFragmentCode("\nfloat getLineAlpha() {\n  return clamp((1.0 - abs(vLineCoord)) / uLineParams.z, 0.0, 1.0);\n}\n")}},{key:"draw",value:function(a,c,d,g,e){var b=a.attribute("aLineOffset");this.lineOffsetsBuffer.bindToVertexAttrib(b,2);d+=g;var h=a.gl;h.uniform3f(a.uniform("uLineParams"),2*d/c.viewportWidth,2*d/c.viewportHeight,g/d);this.quadHelper.draw(h,e);h.disableVertexAttribArray(b)}}]);return d}(m.a)},function(m,f,d){function u(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+
typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}d.d(f,"a",function(){return c});m=d(0);var p=d(16),q=d(113),a=function(){function a(a,c){for(var d=0;d<c.length;d++){var k=c[d];k.enumerable=k.enumerable||!1;k.configurable=!0;"value"in k&&(k.writable=!0);Object.defineProperty(a,k.key,k)}}return function(c,d,f){d&&a(c.prototype,d);f&&a(c,f);return c}}(),c=function(c){function d(a){if(!(this instanceof
d))throw new TypeError("Cannot call a class as a function");var 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;c.gl=a;c.vertexBuffer=c.registerDisposer(p.a.fromData(a,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]),a.ARRAY_BUFFER,a.STATIC_DRAW));c.colorBuffer=c.registerDisposer(p.a.fromData(a,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]),a.ARRAY_BUFFER,a.STATIC_DRAW));c.trivialColorShader=c.registerDisposer(Object(q.c)(a));return c}u(d,c);a(d,[{key:"draw",value:function(a,c){c=void 0===c?!0:c;var d=this.trivialColorShader,g=this.gl;d.bind();g.uniformMatrix4fv(d.uniform("uProjectionMatrix"),!1,a);a=d.attribute("aVertexPosition");this.vertexBuffer.bindToVertexAttrib(a,4);d=d.attribute("aColor");this.colorBuffer.bindToVertexAttrib(d,4);c&&(g.colorMask(!1,!1,!1,!0),g.clearColor(0,0,0,0),g.clear(g.COLOR_BUFFER_BIT),
g.colorMask(!0,!0,!0,!0),g.enable(g.BLEND),g.blendFunc(g.ONE_MINUS_DST_ALPHA,g.DST_ALPHA));g.lineWidth(1);g.drawArrays(g.LINES,0,6);c&&g.disable(g.BLEND);g.disableVertexAttribArray(a);g.disableVertexAttribArray(d)}}],[{key:"get",value:function(a){return a.memoize.get("SliceViewPanel:AxesLineHelper",function(){return new d(a)})}}]);return d}(m.a)},function(m,f,d){d.d(f,"a",function(){return p});var u=function(){function d(a,c){for(var d=0;d<c.length;d++){var f=c[d];f.enumerable=f.enumerable||!1;f.configurable=
!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}return function(a,c,f){c&&d(a.prototype,c);f&&d(a,f);return a}}(),p=function(){function d(){if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");this.renderLayers=[null];this.pickData=[null];this.values=[0,0,0];this.nextPickID=1}u(d,[{key:"clear",value:function(){this.renderLayers.length=1;this.pickData.length=1;this.values.length=3;this.nextPickID=1}},{key:"registerUint64",value:function(a,c,d){return this.register(a,
void 0===d?1:d,c.low,c.high)}},{key:"register",value:function(a,c,d,f,t){var n=this.renderLayers,k=this.values,g=this.nextPickID;this.nextPickID+=void 0===c?1:c;c=n.length;n[c]=a;a=3*c;k[a]=g;k[a+1]=void 0===d?0:d;k[a+2]=void 0===f?0:f;this.pickData[c]=void 0===t?null:t;return g}},{key:"setMouseState",value:function(a,c){for(var d=this.renderLayers,f=this.values,t=0,l=d.length-1;t<l;){var k=Math.ceil(t+(l-t)/2);f[3*k]>c?l=k-1:t=k}d=a.pickedRenderLayer=d[t];l=3*t;c=a.pickedOffset=c-f[l];k=a.pickedValue;
k.low=f[l+1];k.high=f[l+2];a.pickedAnnotationId=void 0;a.pickedAnnotationLayer=void 0;null!==d&&d.updateMouseState(a,k,c,this.pickData[t])}}]);return d}()},function(m,f,d){function u(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 p(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)}d.d(f,"a",function(){return b});var q=d(82);m=d(119);var a=d(68),c=d(20),n=d(1),v=d(55),t=d(120),l=d(208),k=function(){function a(a,b){for(var e=0;e<b.length;e++){var c=b[e];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,e,c){e&&a(b.prototype,e);c&&a(b,c);return b}}(),g=function r(a,
b,e){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,e)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(e)}};d(209);d(41);var e=n.s.create(),b=function(b){function d(b,g,k){if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");var f=u(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,g,k.visibility));f.viewer=k;f.mouseX=0;f.mouseY=0;f.mouseStateUpdater=
f.updateMouseState.bind(f);f.inputEventMap=k.inputEventMap;g.classList.add("neuroglancer-rendered-data-panel");g.classList.add("neuroglancer-panel");g.classList.add("neuroglancer-noselect");f.registerDisposer(new a.a(g));f.registerDisposer(new v.b(g,f.inputEventMap));f.registerDisposer(new t.a(g,f.inputEventMap));f.registerEventListener(g,"mousemove",f.onMousemove.bind(f));f.registerEventListener(g,"mouseleave",f.onMouseout.bind(f));Object(c.c)(g,"snap",function(){f.navigationState.pose.snap()});
Object(c.c)(g,"zoom-in",function(){f.navigationState.zoomBy(.5)});Object(c.c)(g,"zoom-out",function(){f.navigationState.zoomBy(2)});Object(c.c)(g,"highlight",function(){f.viewer.layerManager.invokeAction("highlight")});for(b={axis:0};3>b.axis;b={axis:b.axis},++b.axis){k=n.a[b.axis];for(var r={},p=$jscomp.makeIterator([-1,1]),m=p.next();!m.done;r={sign:r.sign,tempOffset:r.tempOffset},m=p.next())r.sign=m.value,m=0>r.sign?"-":"+",Object(c.c)(g,"rotate-relative-"+k+m,function(a,b){return function(){f.navigationState.pose.rotateRelative(n.e[a.axis],
.1*b.sign)}}(b,r)),r.tempOffset=n.s.create(),Object(c.c)(g,""+k+m,function(a,b){return function(){var e=f.navigationState,c=a.tempOffset;c[0]=0;c[1]=0;c[2]=0;c[b.axis]=a.sign;e.pose.translateVoxelsRelative(c)}}(r,b))}Object(c.c)(g,"zoom-via-wheel",function(a){a=a.detail;f.onMousemove(a);f.zoomByMouse(Object(l.a)(a))});b={};k=$jscomp.makeIterator([1,10]);for(r=k.next();!r.done;b={amount:b.amount},r=k.next())b.amount=r.value,Object(c.c)(g,"z+"+b.amount+"-via-wheel",function(a){return function(b){var c=
b.detail;b=f.navigationState;c=0!==c.deltaY?c.deltaY:c.deltaX;e[0]=0;e[1]=0;e[2]=(0<c?-1:1)*a.amount;b.pose.translateVoxelsRelative(e)}}(b));Object(c.c)(g,"move-to-mouse-position",function(){var a=f.viewer.mouseState;if(a.updateUnconditionally()){var b=f.navigationState.pose.position;n.s.copy(b.spatialCoordinates,a.position);b.changed.dispatch()}});Object(c.c)(g,"snap",function(){return f.navigationState.pose.snap()});Object(c.c)(g,"select-annotation",function(){var a=f.viewer;a=Object(q.a)(a.mouseState,
a.layerManager);if(void 0!==a){var b=a.layer.layer;null!==b&&(f.viewer.selectedLayer.layer=a.layer,f.viewer.selectedLayer.visible=!0,b.tabs.value="annotations",b.selectedAnnotation.value={id:a.id,partIndex:a.partIndex})}});return f}p(d,b);k(d,[{key:"onMouseout",value:function(a){a=this.viewer.mouseState;a.updater=void 0;a.setActive(!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,b=this.viewer.mouseState,
b.pageX=a.pageX,b.pageY=a.pageY,b.updater=this.mouseStateUpdater,b.triggerUpdate())}},{key:"disposed",value:function(){var a=this.viewer.mouseState;a.updater===this.mouseStateUpdater&&(a.updater=void 0,a.setActive(!1));g(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"disposed",this).call(this)}}]);return d}(m.b)},function(m,f,d){function u(a,e){if(!(a instanceof e))throw new TypeError("Cannot call a class as a function");}function p(a,e){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!e||"object"!==typeof e&&"function"!==typeof e?a:e}function q(a,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);a.prototype=Object.create(e&&e.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});e&&(Object.setPrototypeOf?Object.setPrototypeOf(a,e):a.__proto__=e)}d.d(f,"b",function(){return l});d.d(f,"a",function(){return k});m=d(5);var a=d.n(m);m=d(0);var c=d(3),n=d(205),v=function(){function a(a,
b){for(var e=0;e<b.length;e++){var c=b[e];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(e,b,c){b&&a(e.prototype,b);c&&a(e,c);return e}}(),t=function e(a,c,d){null===a&&(a=Function.prototype);var b=Object.getOwnPropertyDescriptor(a,c);if(void 0===b){if(a=Object.getPrototypeOf(a),null!==a)return e(a,c,d)}else{if("value"in b)return b.value;c=b.get;return void 0===c?void 0:c.call(d)}},l=function(a){function b(a,e,c){u(this,
b);var d=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));d.context=a;d.element=e;d.visibility=c;d.gl=a.gl;a.addPanel(d);return d}q(b,a);v(b,[{key:"scheduleRedraw",value:function(){this.visible&&this.context.scheduleRedraw()}},{key:"setGLViewport",value:function(){var a=this.element,b=a.getBoundingClientRect(),e=this.context.canvasRect,c=a.clientWidth/b.width*(a.clientLeft+b.left-e.left),d=a.clientWidth,k=a.clientHeight;b=a.clientHeight/b.height*(b.top-e.top+a.clientTop)+k;a=this.gl;a.enable(a.SCISSOR_TEST);
b=this.context.canvas.height-b;a.viewport(c,b,d,k);a.scissor(c,b,d,k)}},{key:"disposed",value:function(){this.context.removePanel(this);t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}},{key:"visible",get:function(){return this.visibility.visible}}]);return b}(m.a),k=function(e){function b(e){u(this,b);var d=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));d.container=e;d.canvas=document.createElement("canvas");d.updateStarted=new c.a;d.updateFinished=
new c.a;d.panels=new Set;d.updatePending=null;d.onResize=d.registerCancellable(a()(function(){d.scheduleRedraw();for(var a=$jscomp.makeIterator(d.panels),b=a.next();!b.done;b=a.next())b.value.onResize()},0));var h=d.canvas;e.style.position="relative";h.style.position="absolute";h.style.top="0px";h.style.left="0px";h.style.width="100%";h.style.height="100%";h.style.zIndex="0";e.appendChild(h);d.gl=Object(n.a)(h);d.registerEventListener(window,"resize",d.onResize.bind(d));return d}q(b,e);v(b,[{key:"isReady",
value:function(){for(var a=$jscomp.makeIterator(this.panels),b=a.next();!b.done;b=a.next())if(b=b.value,b.visible&&!b.isReady())return!1;return!0}},{key:"makeCanvasOverlayElement",value:function(){var a=document.createElement("div");a.style.position="absolute";a.style.top="0px";a.style.left="0px";a.style.width="100%";a.style.height="100%";a.style.zIndex="2";this.container.appendChild(a);return a}},{key:"disposed",value:function(){null!=this.updatePending&&(cancelAnimationFrame(this.updatePending),
this.updatePending=null)}},{key:"addPanel",value:function(a){this.panels.add(a)}},{key:"removePanel",value:function(a){this.panels.delete(a);a.dispose()}},{key:"scheduleRedraw",value:function(){null===this.updatePending&&(this.updatePending=requestAnimationFrame(this.update.bind(this)))}},{key:"draw",value:function(){this.updateStarted.dispatch();var a=this.gl,b=this.canvas;b.width=b.offsetWidth;b.height=b.offsetHeight;this.canvasRect=b.getBoundingClientRect();this.gl.clearColor(0,0,0,0);a.clear(a.COLOR_BUFFER_BIT|
a.DEPTH_BUFFER_BIT);b=$jscomp.makeIterator(this.panels);for(var e=b.next();!e.done;e=b.next()){e=e.value;var c=e.element;e.visible&&0!==c.clientWidth&&0!==c.clientHeight&&0!==c.offsetWidth&&0!==c.offsetHeight&&(e.setGLViewport(),e.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()}},{key:"update",value:function(){this.updatePending=null;this.draw()}}]);return b}(m.a)},
function(m,f,d){function u(a,c){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!c||"object"!==typeof c&&"function"!==typeof c?a:c}function p(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}d.d(f,
"a",function(){return c});m=d(0);var q=d(20),a=function(){function a(a,c){for(var d=0;d<c.length;d++){var k=c[d];k.enumerable=k.enumerable||!1;k.configurable=!0;"value"in k&&(k.writable=!0);Object.defineProperty(a,k.key,k)}}return function(c,d,f){d&&a(c.prototype,d);f&&a(c,f);return c}}(),c=function(c){function d(a,c){if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");var k=u(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));k.target=a;k.eventMap=c;k.registerEventListener(a,
"wheel",function(a){k.dispatch("wheel",a)});k.registerEventListener(a,"click",function(a){k.dispatch("click"+a.button,a)});k.registerEventListener(a,"dblclick",function(a){k.dispatch("dblclick"+a.button,a)});k.registerEventListener(a,"mousedown",function(a){k.dispatch("mousedown"+a.button,a)});k.registerEventListener(a,"mouseup",function(a){k.dispatch("mouseup"+a.button,a)});return k}p(d,c);a(d,[{key:"dispatch",value:function(a,c){Object(q.b)(a,c,this.eventMap)}}]);return d}(m.a)},function(m,f,d){f.a=
function(d,f){var p=d.view.document,a=d.screenX,c=d.screenY,n=function(d){var k=a-d.screenX,g=c-d.screenY;a=d.screenX;c=d.screenY;f(d,k,g)},v=d.button,t=function(a){a.button===v&&(p.removeEventListener("mousemove",n,!0),p.removeEventListener("mouseup",t,!1))};p.addEventListener("mousemove",n,!0);p.addEventListener("mouseup",t,!1)}},function(m,f,d){f.b=function(d,a,c,f){f=void 0===f?u.e:f;var n=void 0;return new Promise(function(t,l){function k(e){null!==n&&(n=Object(p.c)(d.serverUrls,c.path,c.method),
n.responseType=c.responseType,n.setRequestHeader("Authorization",e.credentials.tokenType+" "+e.credentials.accessToken),n.onloadend=function(){if(null!==n){var b=this.status;200<=b&&300>b?(f.remove(g),t(this.response)):401===b?a.get(e,f).then(k):504===b||503===b?a.get(void 0,f).then(k):(f.remove(g),l(p.a.fromXhr(this)))}},n.send(c.payload))}var g=function(){var a=n;n=null;null!=a&&a.abort();l(u.a)};f.add(g);a.get(void 0,f).then(k)})};var u=d(34),p=d(47);f.a="google-brainmaps"},function(m,f,d){f.a=
function(d,f,q,a){f*=6;var c=Math.floor(f),n=f-c;f=a*(1-q);var v=a*(1-q*n);q=a*(1-q*(1-n));switch(c%6){case 0:d[0]=a;d[1]=q;d[2]=f;break;case 1:d[0]=v;d[1]=a;d[2]=f;break;case 2:d[0]=f;d[1]=a;d[2]=q;break;case 3:d[0]=f;d[1]=v;d[2]=a;break;case 4:d[0]=q;d[1]=f;d[2]=a;break;case 5:d[0]=a,d[1]=f,d[2]=v}return d};f.b=function(d,f,q,a){var c=Math.max(Math.max(f,q),a),n=Math.min(Math.min(f,q),a);d[2]=c;n===c?(d[0]=0,d[1]=0):(n=c-n,d[1]=n/c,d[0]=f===c?(q-a)/n:q===c?2+(a-f)/n:4+(f-q)/n,d[0]/=6,0>d[0]&&(d[0]+=
1),1<d[0]&&--d[0]);return d}},function(m,f,d){d.d(f,"c",function(){return u});f.a="/ocp/ca";f.b="/nd/sd";var u=function q(){if(!(this instanceof q))throw new TypeError("Cannot call a class as a function");};u.RPC_ID="ndstore/VolumeChunkSource"},function(m,f,d){function u(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 p(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 q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function a(a,e,c){Object(x.t)(a);var d=Object(x.v)(a,"Base",function(a){return new J(a)});switch(d.typeName){case "uint8blk":case "grayscale8":return new F(a,e,d,b.c.JPEG,c);case "imagetile":return new R(a,e,d);case "labels64":case "labelblk":return new F(a,
e,d,b.c.COMPRESSED_SEGMENTATION,c);default:throw Error("DVID data type "+JSON.stringify(d.typeName)+" is not supported.");}}function c(a){try{for(var b=Object(x.u)(a,function(a){return new O(a)}),e=new Map,c=$jscomp.makeIterator(b),d=c.next();!d.done;d=c.next()){var g=$jscomp.makeIterator(d.value),h=g.next().value,k=g.next().value;e.set(h,k);for(var f=$jscomp.makeIterator(k.vnodes),r=f.next();!r.done;r=f.next()){var n=r.value;if(n!==h){var l=new O(k);e.set(n,l)}}}for(var t=$jscomp.makeIterator(e),
v=t.next();!v.done;v=t.next()){var p=$jscomp.makeIterator(v.value),q=p.next().value;p.next().value.uuid=q}return e}catch(xa){throw Error("Failed to parse DVID repositories info: "+xa.message);}}function n(a,b){return a.memoize.getUncounted({type:"dvid:getServerInfo",baseUrls:b},function(){var a=Object(E.e)(Object(E.c)(b,"/api/repos/info","GET"),"json").then(function(a){return new Q(a)}),e="repository info for DVID server "+b[0];A.a.forPromise(a,{initialMessage:"Retrieving "+e+".",delay:!0,errorPrefix:"Error retrieving "+
e+": "});return a})}function v(a,b,e,c){return a.memoize.getUncounted({type:"dvid:getInstanceDetails",baseUrls:b,nodeKey:e,name:c.name},function(){var a=Object(E.e)(Object(E.c)(b,"/api/node/"+e+"/"+c.name+"/info","GET"),"json"),d="datainstance info for node "+e+" and instance "+c.name+" "+("on DVID server "+b[0]);A.a.forPromise(a,{initialMessage:"Retrieving "+d+".",delay:!0,errorPrefix:"Error retrieving "+d+": "});return a.then(function(a){a=Object(x.v)(a,"Extended",x.t);c.lowerVoxelBound=Object(x.v)(a,
"MinPoint",function(a){return Object(x.d)(z.s.create(),a)});c.upperVoxelBound=Object(x.v)(a,"MaxPoint",function(a){return Object(x.d)(z.s.create(),a)});return c})})}function t(a,b,e,c){return n(a,b).then(function(d){d=d.getNode(e);if(void 0===d)throw Error("Invalid node: "+JSON.stringify(e)+".");d=d.dataInstances.get(c);if(!(d instanceof F||d instanceof R))throw Error("Invalid data instance "+c+".");return v(a,b,e,d)}).then(function(d){return a.memoize.getUncounted({type:"dvid:MultiscaleVolumeChunkSource",
baseUrls:b,nodeKey:e,dataInstanceKey:c},function(){return new U(a,b,e,c,d)})})}function l(a,b){var e=b.match(W);if(null===e)throw Error("Invalid DVID URL: "+JSON.stringify(b)+".");return t(a,[e[1]],e[2],e[3])}function k(a,b){return{offset:0,completions:Object(y.c)(b,a.dataInstances.values(),function(a){return a.name},function(a){return""+a.base.typeName})}}function g(a,b){var e=b.match(/^(?:([^\/]+)(?:\/([^\/]*))?)?$/);if(null===e)throw Error("Invalid DVID URL syntax.");if(void 0===e[2])return{offset:0,
completions:Object(y.c)(b,a.repositories.values(),function(a){return a.uuid+"/"},function(a){return a.alias+": "+a.description})};b=e[1];a=a.getNode(b);return Object(y.a)(b.length+1,k(a,e[2]))}function e(a,b){a=a.match(/^((?:http|https):\/\/[^\/]+)\/(.*)$/);if(null===a)return Promise.reject(null);var e=a[1],c=a[2];return n(b,[e]).then(function(a){return Object(y.a)(e.length+1,g(a,c))})}Object.defineProperty(f,"__esModule",{value:!0});d.d(f,"getVolume",function(){return l});d.d(f,"volumeCompleter",
function(){return e});d.d(f,"DataInstanceBaseInfo",function(){return J});d.d(f,"DataInstanceInfo",function(){return C});d.d(f,"VolumeDataInstanceInfo",function(){return F});d.d(f,"TileLevelInfo",function(){return P});d.d(f,"TileDataInstanceInfo",function(){return R});f.parseDataInstance=a;d.d(f,"RepositoryInfo",function(){return O});f.parseRepositoriesInfo=c;d.d(f,"ServerInfo",function(){return Q});f.getServerInfo=n;f.getDataInstanceDetails=v;d.d(f,"MultiscaleVolumeChunkSource",function(){return U});
f.getShardedVolume=t;f.completeInstanceName=k;f.completeNodeAndInstance=g;d.d(f,"DVIDDataSource",function(){return aa});m=d(18);f=d(37);var b=d(219),h=d(19),r=d(28),A=d(26),y=d(56),z=d(1),E=d(47),x=d(2),D=function(){function a(a,b){for(var e=0;e<b.length;e++){var c=b[e];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,e,c){e&&a(b.prototype,e);c&&a(b,c);return b}}(),G=new Map;G.set("uint8",h.a.UINT8);G.set("uint32",h.a.UINT32);
G.set("uint64",h.a.UINT64);var J=function(){function a(b){q(this,a);this.obj=b;Object(x.t)(b);Object(x.v)(b,"TypeName",x.A)}D(a,[{key:"typeName",get:function(){return this.obj.TypeName}}]);return a}(),C=function T(a,b,e){q(this,T);this.obj=a;this.name=b;this.base=e},B=function(a){function b(){q(this,b);return u(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}p(b,a);return b}(Object(m.f)(r.b,b.d)),F=function(a){function e(a,b,c,d,g){q(this,e);c=u(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,
a,b,c));c.encoding=d;a=Object(x.v)(a,"Extended",x.t);d=Object(x.v)(a,"Values",function(a){return Object(x.a)(a,x.t)});if(1>d.length)throw Error("Expected Extended.Values property to have length >= 1, but received: ${JSON.stringify(extendedValues)}.");c.numLevels=1;for(g=new Set(g);g.has(b+"_"+c.numLevels.toString());)c.numLevels+=1;c.dataType=Object(x.v)(d[0],"DataType",function(a){return Object(x.s)(a,G)});c.voxelSize=Object(x.v)(a,"VoxelSize",function(a){return Object(x.c)(z.s.create(),a,x.o)});
c.numChannels=1;return c}p(e,a);D(e,[{key:"getSources",value:function(a,e,c){for(var d=this.encoding,g=[],k={},f=0;f<this.numLevels;k={volParameters:k.volParameters},++f){for(var r=z.s.scale(z.s.create(),this.voxelSize,Math.pow(2,f)),n=z.s.create(),l=z.s.create(),t=0;3>t;++t)n[t]=Math.floor(this.voxelSize[t]/r[t]*this.lowerVoxelBound[t]),l[t]=Math.ceil(this.voxelSize[t]/r[t]*this.upperVoxelBound[t]);t=e.dataInstanceKey;0<f&&(t+="_"+f.toString());k.volParameters={baseUrls:e.baseUrls,nodeKey:e.nodeKey,
dataInstanceKey:t,encoding:d};r=h.b.getDefaults({voxelSize:r,dataType:this.dataType,numChannels:this.numChannels,transform:z.k.fromTranslation(z.k.create(),z.s.multiply(z.s.create(),n,r)),baseVoxelOffset:n,upperVoxelBound:z.s.subtract(z.s.create(),l,n),volumeType:this.volumeType,volumeSourceOptions:c,compressedSegmentationBlockSize:d===b.c.COMPRESSED_SEGMENTATION?z.s.fromValues(8,8,8):void 0}).map(function(b){return function(e){return a.getChunkSource(B,{spec:e,parameters:b.volParameters})}}(k));
g.push(r)}return g}},{key:"volumeType",get:function(){return this.encoding===b.c.COMPRESSED_SEGMENTATION?h.c.SEGMENTATION:h.c.IMAGE}}]);return e}(C),P=function da(a){q(this,da);Object(x.t)(a);this.resolution=Object(x.v)(a,"Resolution",function(a){return Object(x.c)(z.s.create(),a,x.o)});this.tileSize=Object(x.v)(a,"TileSize",function(a){return Object(x.c)(z.s.create(),a,x.z)})},H=[[0,1],[0,2],[1,2]],N=function(a){function b(){q(this,b);return u(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,
arguments))}p(b,a);return b}(Object(m.f)(r.b,b.a)),R=function(a){function e(a,c,d){q(this,e);c=u(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,a,c,d));a=Object(x.v)(a,"Extended",x.t);c.levels=Object(x.v)(a,"Levels",function(a){return Object(x.u)(a,function(a){return new P(a)})});d=c.levels.get("0");if(void 0===d)throw Error("Level 0 is not defined.");c.voxelSize=d.resolution;var g=Object(x.v)(a,"MinTileCoord",function(a){return Object(x.c)(z.s.create(),a,x.r)}),h=Object(x.v)(a,"MaxTileCoord",
function(a){return Object(x.c)(z.s.create(),a,x.r)});c.lowerVoxelBound=z.s.multiply(z.s.create(),d.tileSize,g);c.upperVoxelBound=z.s.multiply(z.s.create(),d.tileSize,h);a=Object(x.v)(a,"Encoding",function(a){return a});switch(a){case 2:c.encoding=b.b.JPEG;break;default:throw Error("Unsupported tile encoding: "+JSON.stringify(a)+".");}return c}p(e,a);D(e,[{key:"dataType",get:function(){return h.a.UINT8}},{key:"volumeType",get:function(){return h.c.IMAGE}},{key:"numChannels",get:function(){return 1}}]);
D(e,[{key:"getSources",value:function(a,b,e){for(var c=this,d=[],g=this.numChannels,k=this.dataType,f=this.encoding,r={},n=$jscomp.makeIterator(this.levels),l=n.next();!l.done;r={levelInfo:r.levelInfo,level:r.level},l=n.next())l=$jscomp.makeIterator(l.value),r.level=l.next().value,r.levelInfo=l.next().value,l=H.map(function(d){return function(r){for(var n=z.s.clone(c.voxelSize),l=z.s.fromValues(1,1,1),t=0;2>t;++t)n[r[t]]=d.levelInfo.resolution[r[t]],l[r[t]]=d.levelInfo.tileSize[r[t]];t=z.s.create();
for(var v=z.s.create(),p=0;3>p;++p)t[p]=Math.floor(c.voxelSize[p]/n[p]*c.lowerVoxelBound[p]),v[p]=Math.ceil(c.voxelSize[p]/n[p]*c.upperVoxelBound[p]);n=h.b.make({voxelSize:n,chunkDataSize:l,numChannels:g,dataType:k,lowerVoxelBound:t,upperVoxelBound:v,volumeSourceOptions:e});return a.getChunkSource(N,{spec:n,parameters:{baseUrls:b.baseUrls,nodeKey:b.nodeKey,dataInstanceKey:b.dataInstanceKey,encoding:f,level:d.level,dims:r[0]+"_"+r[1]}})}}(r)),d.push(l);return d}}]);return e}(C),O=function L(b){q(this,
L);this.errors=[];this.dataInstances=new Map;this.vnodes=new Set;if(b instanceof L)this.alias=b.alias,this.description=b.description,this.errors=b.errors,this.dataInstances=b.dataInstances;else{Object(x.t)(b);this.alias=Object(x.v)(b,"Alias",x.A);this.description=Object(x.v)(b,"Description",x.A);for(var e=Object(x.v)(b,"DataInstances",x.t),c=Object.keys(e),d=$jscomp.makeIterator(c),g=d.next();!g.done;g=d.next()){g=g.value;try{this.dataInstances.set(g,a(e[g],g,c))}catch(na){g="Failed to parse data instance "+
JSON.stringify(g)+": "+na.message,console.log(g),this.errors.push(g)}}b=Object(x.v)(b,"DAG",x.t);b=Object(x.v)(b,"Nodes",x.t);b=$jscomp.makeIterator(Object.keys(b));for(g=b.next();!g.done;g=b.next())this.vnodes.add(g.value)}},Q=function(){function a(b){q(this,a);this.repositories=c(b)}D(a,[{key:"getNode",value:function(a){for(var b=[],e=$jscomp.makeIterator(this.repositories.keys()),c=e.next();!c.done;c=e.next())c=c.value,c.startsWith(a)&&b.push(c);if(1!==b.length)throw Error("Node key "+JSON.stringify(a)+
" matches "+JSON.stringify(b)+" nodes.");return this.repositories.get(b[0])}}]);return a}(),U=function(){function a(b,e,c,d,g){q(this,a);this.chunkManager=b;this.baseUrls=e;this.nodeKey=c;this.dataInstanceKey=d;this.info=g}D(a,[{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 a}(),W=/^((?:http|https):\/\/[^\/]+)\/([^\/]+)\/([^\/]+)$/,aa=function(a){function b(){q(this,b);return u(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}p(b,a);D(b,[{key:"getVolume",value:function(a,b){return l(a,b)}},{key:"volumeCompleter",value:function(a,b){return e(a,b)}},{key:"description",get:function(){return"DVID"}}]);return b}(f.a)},
function(m,f,d){function u(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(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 q(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=Object(F.a)(a,F.t);if(1>b.length)throw Error("No stacks found for owner object.");a=new Map;var e=Object(F.v)(b[0],"stackId",n);b=$jscomp.makeIterator(b);for(var d=b.next();!d.done;d=b.next()){var g=d.value;d=Object(F.v)(g,"stackId",c);Object(F.t)(g);var h=Object(F.v)(g,"state",F.A);if(O.has(h)){h=Object(F.v)(g,"stats",F.t);var k=h;Object(F.t)(k);k=Object(F.v)(k,"stackBounds",F.t);var f=C.s.create();
f[0]=Object(F.v)(k,"minX",F.p);f[1]=Object(F.v)(k,"minY",F.p);f[2]=Object(F.v)(k,"minZ",F.p);k=f;f=h;Object(F.t)(f);f=Object(F.v)(f,"stackBounds",F.t);var r=C.s.create();r[0]=Object(F.v)(f,"maxX",F.p)+1;r[1]=Object(F.v)(f,"maxY",F.p)+1;r[2]=Object(F.v)(f,"maxZ",F.p)+1;f=r;r=[];h.hasOwnProperty("channelNames")&&(r=v(h));h=Object(F.v)(g,"currentVersion",t);g=Object(F.v)(g,"stackId",l);g={lowerVoxelBound:k,upperVoxelBound:f,voxelResolution:h,project:g,channels:r}}else g=void 0;void 0!==g&&(h=g.project,
k=a.get(h),void 0===k&&(k=new Map,a.set(h,{stacks:k}),k=a.get(h)),k.stacks.set(d,g))}return{owner:e,projects:a}}function c(a){Object(F.t)(a);return Object(F.v)(a,"stack",F.A)}function n(a){Object(F.t)(a);return Object(F.v)(a,"owner",F.A)}function v(a){Object(F.t)(a);return Object(F.v)(a,"channelNames",function(a){return Object(F.a)(a,F.A)})}function t(a){Object(F.t)(a);var b=C.s.create();try{b[0]=Object(F.v)(a,"stackResolutionX",F.p),b[1]=Object(F.v)(a,"stackResolutionY",F.p),b[2]=Object(F.v)(a,"stackResolutionZ",
F.p)}catch(L){b[0]=1,b[1]=1,b[2]=1}return b}function l(a){Object(F.t)(a);return Object(F.v)(a,"project",F.A)}function k(a,b){for(var e=0,c=0;2>c;c++)e<a.upperVoxelBound[c]&&(e=a.upperVoxelBound[c]);if(b>=e)return 1;for(a=0;e>b;)e/=2,a++;return a}function g(b,e,c){return b.memoize.getUncounted({type:"render:getOwnerInfo",hostnames:e,owner:c},function(){return Object(B.e)(Object(B.c)(e,"/render-ws/v1/owner/"+c+"/stacks"),"json").then(a)})}function e(a,b,e){var c=e.match(U);if(null===c)throw Error("Invalid volume path "+
JSON.stringify(e));var d=c[1],h=c[2],k=c[3],f=c[4],r=Object(F.e)(c[5]||"");return a.memoize.getUncounted({type:"render:MultiscaleVolumeChunkSource",hostnames:b,path:e},function(){return g(a,b,d).then(function(e){return new Q(a,b,e,k,h,f,r)})})}function b(a,b){var c=b.match(W);if(null===c)throw Error("Invalid render volume path: "+JSON.stringify(b));b=c[1].split(",");return e(a,b,c[2])}function h(a,b,e){var c=e.match(/^(?:([^\/]+)(?:\/([^\/]*))?(?:\/([^\/]*))?(\/.*?)?)?$/);if(null===c||void 0===c[2])return Promise.reject(null);
if(void 0===c[3]){var d=c[2]||"";return g(a,b,c[1]).then(function(a){a=Object(J.c)(d,a.projects,function(a){return a[0]+"/"},function(){});return{offset:c[1].length+1,completions:a}})}if(void 0===c[4]){var h=c[3]||"";return g(a,b,c[1]).then(function(a){a=a.projects.get(c[2]);if(void 0===a)return Promise.reject(null);a=Object(J.c)(h,a.stacks,function(a){return a[0]+"/"},function(a){return"("+a[1].project+")"});return{offset:c[1].length+c[2].length+2,completions:a}})}var k=c[4].substr(1)||"";return g(a,
b,c[1]).then(function(a){a=a.projects.get(c[2]);if(void 0===a)return Promise.reject(null);a=a.stacks.get(c[3]);if(void 0===a)return Promise.reject(null);a=a.channels;if(0===a.length)return Promise.reject(null);a=Object(J.c)(k,a,function(a){return a},function(){});return{offset:c[1].length+c[2].length+c[3].length+3,completions:a}})}function r(a,b){var e=a.match(W);if(null===e)return Promise.reject(null);a=e[1].split(",");return h(b,a,e[2]).then(function(a){return Object(J.a)(e[1].length+1,a)})}function A(a,
b){var e=b.match(W);if(null===e)throw Error("Invalid render point path: "+JSON.stringify(b));return y(a,[e[1]],e[2])}function y(a,b,e){var c=e.match(U);if(null===c)throw Error("Invalid point path "+JSON.stringify(e));var d=c[1],h=c[2],k=c[3],f=Object(F.e)(c[4]||"");return a.memoize.getUncounted({type:"render:MultiscaleVectorGraphicsChunkSource",hostnames:b,path:e},function(){return g(a,b,d).then(function(e){return new aa(a,b,e,k,h,f)})})}Object.defineProperty(f,"__esModule",{value:!0});d.d(f,"getVolume",
function(){return b});d.d(f,"volumeCompleter",function(){return r});d.d(f,"MultiscaleVolumeChunkSource",function(){return Q});f.computeStackHierarchy=k;f.getOwnerInfo=g;f.getShardedVolume=e;f.stackAndProjectCompleter=h;d.d(f,"MultiscaleVectorGraphicsChunkSource",function(){return aa});f.getPointMatches=A;f.getShardedPointMatches=y;d.d(f,"RenderDataSource",function(){return I});m=d(18);f=d(37);var z=d(221),E=d(127),x=d(128),D=d(19),G=d(28),J=d(56),C=d(1),B=d(47),F=d(2),P=function(){function a(a,b){for(var e=
0;e<b.length;e++){var c=b[e];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,e,c){e&&a(b.prototype,e);c&&a(b,c);return b}}(),H=new Set(["jpg"]),N=function(a){function b(){u(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);return b}(Object(m.f)(G.b,z.b)),R=function(a){function b(){u(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);return b}(Object(m.f)(x.b,
z.a)),O=new Set(["COMPLETE"]),Q=function(){function a(b,e,c,d,g,h,k){u(this,a);this.chunkManager=b;this.baseUrls=e;this.ownerInfo=c;this.project=g;this.parameters=k;b=c.projects.get(g);if(void 0===b)throw Error("Specified project "+JSON.stringify(g)+" does not exist for "+("specified owner "+JSON.stringify(c.owner)));if(void 0===d){d=Array.from(b.stacks.keys());if(1!==d.length)throw Error("Dataset contains multiple stacks: "+JSON.stringify(d));d=d[0]}c=b.stacks.get(d);if(void 0===c)throw Error("Specified stack "+
JSON.stringify(d)+" is not one of the supported stacks: "+JSON.stringify(Array.from(b.stacks.keys())));this.stack=d;this.stackInfo=c;void 0!==h&&0<h.length&&(this.channel=h);this.minIntensity=Object(F.x)(k.minIntensity);this.maxIntensity=Object(F.x)(k.maxIntensity);this.maxTileSpecsToRender=Object(F.x)(k.maxTileSpecsToRender);this.filter=Object(F.w)(k.filter);h=Object(F.y)(k.encoding);if(void 0===h)h="jpg";else if(!H.has(h))throw Error("Invalid encoding: "+JSON.stringify(h)+".");this.encoding=h;this.numLevels=
Object(F.x)(k.numlevels);this.dims=C.s.create();k=Object(F.x)(k.tilesize);void 0===k&&(k=1024);this.dims[0]=k;this.dims[1]=k;this.dims[2]=1}P(a,[{key:"getSources",value:function(a){var b=[],e=this.numLevels;void 0===e&&(e=k(this.stackInfo,this.dims[0]));for(var c=C.s.create(),d=C.s.create(),g=0;3>g;g++)c[g]=this.stackInfo.lowerVoxelBound[g]*this.stackInfo.voxelResolution[g],d[g]=this.stackInfo.upperVoxelBound[g]*this.stackInfo.voxelResolution[g];for(g=0;g<e;g++){for(var h=C.s.clone(this.stackInfo.voxelResolution),
f=C.s.fromValues(1,1,1),r=0;2>r;++r)h[r]*=Math.pow(2,g),f[r]=this.dims[r];r=C.s.create();for(var n=C.s.create(),l=0;3>l;l++)r[l]=Math.floor(this.stackInfo.voxelResolution[l]/h[l]*this.stackInfo.lowerVoxelBound[l]),n[l]=Math.ceil(this.stackInfo.voxelResolution[l]/h[l]*this.stackInfo.upperVoxelBound[l]);h=D.b.make({voxelSize:h,chunkDataSize:f,numChannels:this.numChannels,dataType:this.dataType,lowerClipBound:c,upperClipBound:d,lowerVoxelBound:r,upperVoxelBound:n,volumeSourceOptions:a});h=this.chunkManager.getChunkSource(N,
{spec:h,parameters:{baseUrls:this.baseUrls,owner:this.ownerInfo.owner,project:this.stackInfo.project,stack:this.stack,channel:this.channel,minIntensity:this.minIntensity,maxIntensity:this.maxIntensity,maxTileSpecsToRender:this.maxTileSpecsToRender,filter:this.filter,dims:this.dims[0]+"_"+this.dims[1],level:g,encoding:this.encoding}});b.push([h])}return b}},{key:"getMeshSource",value:function(){return null}},{key:"dataType",get:function(){return D.a.UINT8}},{key:"numChannels",get:function(){return 3}},
{key:"volumeType",get:function(){return D.c.IMAGE}}]);return a}(),U=/^([^\/?]+)(?:\/([^\/?]+))?(?:\/([^\/?]+))(?:\/([^\/?]*))?(?:\?(.*))?$/,W=/^((?:(?:(?:http|https):\/\/[^,\/]+)[^\/?])+)\/(.*)$/,aa=function(){function a(b,e,c,d,g,h){u(this,a);this.chunkManager=b;this.baseUrls=e;this.ownerInfo=c;this.project=g;this.parameters=h;b=c.projects.get(g);if(void 0===b)throw Error("Specified project "+JSON.stringify(g)+" does not exist for "+("specified owner "+JSON.stringify(c.owner)));if(void 0===d){d=
Array.from(b.stacks.keys());if(1!==d.length)throw Error("Dataset contains multiple stacks: "+JSON.stringify(d));d=d[0]}c=b.stacks.get(d);if(void 0===c)throw Error("Specified stack "+JSON.stringify(d)+" is not one of the supported stacks: "+JSON.stringify(Array.from(b.stacks.keys())));this.stack=d;this.stackInfo=c;c=Object(F.y)(h.matchCollection);void 0===c&&(c=d);this.matchCollection=c;d=Object(F.x)(h.zoffset);void 0===d&&(d=1);this.zoffset=d;this.dims=C.s.create();h=Object(F.x)(h.tilesize);void 0===
h&&(h=1024);this.dims[0]=h;this.dims[1]=h;this.dims[2]=1}P(a,[{key:"getSources",value:function(a){var b=this.stackInfo.voxelResolution,e=C.s.subtract(C.s.create(),this.stackInfo.upperVoxelBound,this.stackInfo.lowerVoxelBound);C.s.multiply(e,e,b);e[2]=b[2];a=E.a.make({voxelSize:b,chunkSize:e,lowerChunkBound:C.s.fromValues(0,0,this.stackInfo.lowerVoxelBound[2]),upperChunkBound:C.s.fromValues(1,1,this.stackInfo.upperVoxelBound[2]),vectorGraphicsSourceOptions:a});return[[this.chunkManager.getChunkSource(R,
{spec:a,parameters:{baseUrls:this.baseUrls,owner:this.ownerInfo.owner,project:this.stackInfo.project,stack:this.stack,encoding:"points",matchCollection:this.matchCollection,zoffset:this.zoffset}})]]}}]);return a}(),I=function(a){function e(){u(this,e);return p(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}q(e,a);P(e,[{key:"getVolume",value:function(a,e){return b(a,e)}},{key:"volumeCompleter",value:function(a,b){return r(a,b)}},{key:"getVectorGraphicsSource",value:function(a,
b){return A(a,b)}},{key:"description",get:function(){return"Render"}}]);return e}(f.a)},function(m,f,d){function u(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}d.d(f,"b",function(){return c});d.d(f,"a",function(){return n});var p=d(31),q=function(){function a(a,
c){for(var d=0;d<c.length;d++){var g=c[d];g.enumerable=g.enumerable||!1;g.configurable=!0;"value"in g&&(g.writable=!0);Object.defineProperty(a,g.key,g)}}return function(c,d,k){d&&a(c.prototype,d);k&&a(c,k);return c}}(),a=function t(a,c,d){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,c);if(void 0===e){if(a=Object.getPrototypeOf(a),null!==a)return t(a,c,d)}else{if("value"in e)return e.value;c=e.get;return void 0===c?void 0:c.call(d)}},c;(function(a){a[a.LINE=0]="LINE";a[a.POINT=
1]="POINT"})(c||(c={}));var n=function(c){function d(a){if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");a=(d.__proto__||Object.getPrototypeOf(d)).call(this,a);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}u(d,c);q(d,[{key:"toObject",value:function(){return a(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"toObject",this).call(this)}}],[{key:"make",
value:function(a){return new d(Object.assign({},a,{transform:Object(p.m)(a.transform,a.vectorGraphicsSourceOptions)}))}},{key:"fromObject",value:function(a){return new d(a)}}]);return d}(p.k)},function(m,f,d){function u(a,e){if(!(a instanceof e))throw new TypeError("Cannot call a class as a function");}function p(a,e){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==typeof e&&"function"!==typeof e?a:e}function q(a,e){if("function"!==
typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);a.prototype=Object.create(e&&e.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});e&&(Object.setPrototypeOf?Object.setPrototypeOf(a,e):a.__proto__=e)}d.d(f,"a",function(){return t});d.d(f,"b",function(){return k});m=d(46);f=d(65);var a=d(16),c=d(48),n=function e(a,c,d){null===a&&(a=Function.prototype);var b=Object.getOwnPropertyDescriptor(a,c);if(void 0===b){if(a=Object.getPrototypeOf(a),
null!==a)return e(a,c,d)}else{if("value"in b)return b.value;c=b.get;return void 0===c?void 0:c.call(d)}},v=function(){function a(a,e){for(var b=0;b<e.length;b++){var c=e[b];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,e,c){e&&a(b.prototype,e);c&&a(b,c);return b}}(),t=function(a){function b(a,e){e=void 0===e?{}:e;e=void 0===e.sourceOptions?{}:e.sourceOptions;u(this,b);var d=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,
a.chunkManager,a.getSources(e)));d.shader=void 0;d.rpcId=null;d.shaderGetter=d.registerDisposer(new c.a(d.gl,function(a){return d.defineShader(a)},function(){return d.getShaderKey()}));return d}q(b,a);v(b,[{key:"defineShader",value:function(a){a.addFragmentCode("\nvoid emit(vec4 color) {\n  gl_FragColor = color;\n}\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")}},
{key:"beginSlice",value:function(a){a=this.shaderGetter.get();if(void 0!==a)return a.bind(),a}}]);return b}(f.a),l=function(e){function b(a,e){u(this,b);a=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,e));a.vertexPositions=e.vertexPositions;a.numPoints=Math.floor(a.vertexPositions.length/3);return a}q(b,e);v(b,[{key:"copyToGPU",value:function(e){n(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"copyToGPU",this).call(this,e);this.vertexBuffer=a.a.fromData(e,this.vertexPositions,
e.ARRAY_BUFFER,e.STATIC_DRAW)}},{key:"freeGPUMemory",value:function(a){n(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"freeGPUMemory",this).call(this,a);this.vertexBuffer.dispose()}}]);return b}(m.b),k=function(a){function b(){u(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);v(b,[{key:"getChunk",value:function(a){return new l(this,a)}},{key:"vectorGraphicsCoordinatesInVoxels",get:function(){return!0}}]);return b}(m.c)},function(m,f,d){function u(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)}Object.defineProperty(f,"__esModule",{value:!0});d.d(f,"OpenConnectomeDataSource",function(){return a});var p=d(124),q=["http://openconnecto.me","http://www.openconnecto.me"],a=function(a){function c(){if(!(this instanceof
c))throw new TypeError("Cannot call a class as a function");var a=(c.__proto__||Object.getPrototypeOf(c)).call(this,"NDstore server hosted at openconnecto.me",q,p.a);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}u(c,a);return c}(d(85).SingleServerDataSource)},function(m,f,d){function u(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(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 q(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){return a.getChunkSource(z,{parameters:b})}function c(a,b,e){return a.memoize.getUncounted({type:"precomputed:MultiscaleVolumeChunkSource",
baseUrls:b,path:e},function(){return Object(h.e)(Object(h.c)(b,e+"/info"),"json").then(function(c){return new x(a,b,e,c)})})}function n(b,e){var c=$jscomp.makeIterator(Object(h.d)(e));e=c.next().value;c=c.next().value;return a(b,{baseUrls:e,path:c,lod:0})}function v(a,b){var e=$jscomp.makeIterator(Object(h.d)(b));b=e.next().value;e=e.next().value;return c(a,b,e)}Object.defineProperty(f,"__esModule",{value:!0});d.d(f,"getMeshSource",function(){return n});d.d(f,"getVolume",function(){return v});d.d(f,
"MultiscaleVolumeChunkSource",function(){return x});f.getShardedMeshSource=a;f.getShardedVolume=c;d.d(f,"PrecomputedDataSource",function(){return D});var t=d(23);m=d(18);f=d(37);var l=d(224),k=d(57),g=d(19),e=d(28),b=d(1),h=d(47),r=d(2),A=function(){function a(a,b){for(var e=0;e<b.length;e++){var c=b[e];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,e,c){e&&a(b.prototype,e);c&&a(b,c);return b}}(),y=function(a){function b(){u(this,
b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);return b}(Object(m.f)(e.b,l.c)),z=function(a){function b(){u(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);return b}(Object(m.f)(k.b,l.a)),E=function J(a){u(this,J);Object(r.t)(a);this.resolution=Object(r.v)(a,"resolution",function(a){return Object(r.c)(b.s.create(),a,r.o)});this.voxelOffset=Object(r.v)(a,"voxel_offset",function(a){return Object(r.d)(b.s.create(),a)});
this.size=Object(r.v)(a,"size",function(a){return Object(r.c)(b.s.create(),a,r.z)});this.chunkSizes=Object(r.v)(a,"chunk_sizes",function(a){return Object(r.a)(a,function(a){return Object(r.c)(b.s.create(),a,r.z)})});if(0===this.chunkSizes.length)throw Error("No chunk sizes specified.");(this.encoding=Object(r.v)(a,"encoding",function(a){return Object(r.m)(a,l.b)}))===l.b.COMPRESSED_SEGMENTATION&&(this.compressedSegmentationBlockSize=Object(r.v)(a,"compressed_segmentation_block_size",function(a){return Object(r.c)(b.s.create(),
a,r.z)}));this.key=Object(r.v)(a,"key",r.A)},x=function(){function e(a,b,c,d){u(this,e);this.chunkManager=a;this.baseUrls=b;this.path=c;Object(r.t)(d);this.dataType=Object(r.v)(d,"data_type",function(a){return Object(r.m)(a,g.a)});this.numChannels=Object(r.v)(d,"num_channels",r.z);this.volumeType=Object(r.v)(d,"type",function(a){return Object(r.m)(a,g.c)});this.mesh=Object(r.v)(d,"mesh",r.y);this.scales=Object(r.v)(d,"scales",function(a){return Object(r.a)(a,function(a){return new E(a)})})}A(e,[{key:"getMeshSource",
value:function(){var b=this.mesh;return void 0===b?null:a(this.chunkManager,{baseUrls:this.baseUrls,path:this.path+"/"+b,lod:0})}},{key:"getSources",value:function(a){var e=this;return this.scales.map(function(c){return g.b.getDefaults({voxelSize:c.resolution,dataType:e.dataType,numChannels:e.numChannels,transform:b.k.fromTranslation(b.k.create(),b.s.multiply(b.s.create(),c.resolution,c.voxelOffset)),upperVoxelBound:c.size,volumeType:e.volumeType,chunkDataSizes:c.chunkSizes,baseVoxelOffset:c.voxelOffset,
compressedSegmentationBlockSize:c.compressedSegmentationBlockSize,volumeSourceOptions:a}).map(function(a){return e.chunkManager.getChunkSource(y,{spec:a,parameters:{baseUrls:e.baseUrls,path:e.path+"/"+c.key,encoding:c.encoding}})})})}},{key:"getStaticAnnotations",value:function(){var a=this.scales[0],e=new t.b(b.k.fromScaling(b.k.create(),a.resolution));e.readonly=!0;e.add(Object(t.i)(a.voxelOffset,b.s.add(b.s.create(),a.voxelOffset,a.size)));return e}}]);return e}(),D=function(a){function b(){u(this,
b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);A(b,[{key:"getVolume",value:function(a,b){return v(a,b)}},{key:"getMeshSource",value:function(a,b){return n(a,b)}},{key:"description",get:function(){return"Precomputed file-backed data source"}}]);return b}(f.a)},function(m,f,d){function u(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(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 q(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,e){return a.rpc.promiseInvoke(n.a,{chunkManager:a.addCounterpartRef(),url:b},e)}function c(e,c){return e.memoize.getUncounted({type:"nifti/getVolume",
url:c},function(){return a(e,c,l.e).then(function(a){return new b(e,c,a)})})}Object.defineProperty(f,"__esModule",{value:!0});d.d(f,"getVolume",function(){return c});d.d(f,"MultiscaleVolumeChunkSource",function(){return b});d.d(f,"NiftiDataSource",function(){return h});m=d(18);f=d(37);var n=d(226),v=d(19),t=d(28),l=d(34),k=d(1),g=function(){function a(a,b){for(var e=0;e<b.length;e++){var c=b[e];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,
c)}}return function(b,e,c){e&&a(b.prototype,e);c&&a(b,c);return b}}(),e=function(a){function b(){u(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);return b}(Object(m.f)(t.b,n.b)),b=function(){function a(b,e,c){u(this,a);this.chunkManager=b;this.url=e;this.info=c}g(a,[{key:"getSources",value:function(a){var b=this.info;a=v.b.withDefaultCompression({volumeType:b.volumeType,chunkDataSize:b.volumeSize,dataType:b.dataType,voxelSize:b.voxelSize,numChannels:b.numChannels,
upperVoxelBound:b.volumeSize,transform:Object(k.q)(k.k.create(),b.qoffset,b.quatern,k.g,b.qfac),volumeSourceOptions:a});return[[this.chunkManager.getChunkSource(e,{spec:a,parameters:{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}(),h=function(a){function b(){u(this,b);return p(this,
(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);g(b,[{key:"getVolume",value:function(a,b){return c(a,b)}},{key:"description",get:function(){return"Single NIfTI file"}}]);return b}(f.a)},function(m,f,d){function u(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(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 q(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){return function(a){function b(a){for(var e=[],c=0;c<arguments.length;++c)e[c-0]=arguments[c];u(this,b);var d;c=p(this,(d=b.__proto__||Object.getPrototypeOf(b)).call.apply(d,[].concat([this],$jscomp.arrayFromIterable(e))));
e=e[1];d=c.dataSource=c.registerDisposer(e.dataSource.addRef());c.generation=e.generation;d.registerSource(e.parameters.key,c);return c}q(b,a);y(b,null,[{key:"encodeOptions",value:function(a){var e=z(b.__proto__||Object.getPrototypeOf(b),"encodeOptions",this).call(this,a);e.dataSource=Object(A.a)(a.dataSource);return e}}]);return b}(a)}function c(a){Object(r.t)(a);return{key:Object(r.v)(a,"key",r.A),offset:Object(r.v)(a,"offset",r.k),sizeInVoxels:Object(r.v)(a,"sizeInVoxels",r.i),voxelSize:Object(r.v)(a,
"voxelSize",r.j),chunkDataSize:Object(r.v)(a,"chunkDataSize",function(a){return void 0===a?void 0:Object(r.i)(a)})}}function n(a){Object(r.t)(a);return{dataType:Object(r.v)(a,"dataType",function(a){return Object(r.m)(a,k.c)}),numComponents:Object(r.v)(a,"numComponents",r.z)}}Object.defineProperty(f,"__esModule",{value:!0});d.d(f,"MultiscaleVolumeChunkSource",function(){return D});d.d(f,"PythonSkeletonSource",function(){return G});d.d(f,"PythonDataSource",function(){return J});m=d(18);f=d(37);var v=
d(230),t=d(57),l=d(83),k=d(31),g=d(19),e=d(28),b=d(1),h=d(47),r=d(2),A=d(25),y=function(){function a(a,b){for(var e=0;e<b.length;e++){var c=b[e];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,e,c){e&&a(b.prototype,e);c&&a(b,c);return b}}(),z=function B(a,b,e){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,e)}else{if("value"in
c)return c.value;b=c.get;return void 0===b?void 0:b.call(e)}},E=function(a){function b(){u(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);return b}(a(Object(m.f)(e.b,v.d))),x=function(a){function b(){u(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);return b}(a(Object(m.f)(t.b,v.a))),D=function(){function a(e,d,h,f){u(this,a);this.dataSource=e;this.chunkManager=d;this.key=h;this.response=f;Object(r.t)(f);this.dataType=
Object(r.v)(f,"dataType",function(a){return Object(r.m)(a,k.c)});this.volumeType=Object(r.v)(f,"volumeType",function(a){return Object(r.m)(a,g.c)});this.numChannels=Object(r.v)(f,"numChannels",r.z);this.encoding=Object(r.v)(f,"encoding",function(a){return Object(r.m)(a,v.c)});this.generation=Object(r.v)(f,"generation",function(a){return a});this.skeletonVertexAttributes=Object(r.v)(f,"skeletonVertexAttributes",function(a){return void 0===a?void 0:Object(r.u)(a,n)});var l=Object(r.v)(f,"maxVoxelsPerChunkLog2",
function(a){return void 0===a?k.b:Object(r.z)(a)});e=Object(r.v)(f,"threeDimensionalScales",function(a){return void 0===a?void 0:Object(r.a)(a,c)});f=Object(r.v)(f,"twoDimensionalScales",function(a){return void 0===a?void 0:Object(r.a)(a,function(a){return Object(r.c)(Array(3),a,c)})});if(void 0===f===(void 0===e))throw Error('Exactly one of "threeDimensionalScales" and "twoDimensionalScales" must be specified.');if(void 0!==f){if(0===f.length)throw Error("At least one scale must be specified.");
this.scales=f.map(function(a){return a.map(function(a,b){var e=a.voxelSize,c=a.sizeInVoxels;b=void 0===a.chunkDataSize?Object(k.p)({voxelSize:e,upperVoxelBound:c,flatDimension:2-b,maxVoxelsPerChunkLog2:l}):a.chunkDataSize;return{key:a.key,offset:a.offset,sizeInVoxels:c,voxelSize:e,chunkDataSize:b}})});if(!b.s.equals(this.scales[0][0].voxelSize,this.scales[0][1].voxelSize)||!b.s.equals(this.scales[0][0].voxelSize,this.scales[0][2].voxelSize))throw Error("Lowest scale must have uniform voxel size.");
}if(void 0!==e){if(0===e.length)throw Error("At least one scale must be specified.");this.scales=e.map(function(a){var b=a.voxelSize,e=a.sizeInVoxels,c=void 0===a.chunkDataSize?Object(k.n)({voxelSize:b,upperVoxelBound:e,maxVoxelsPerChunkLog2:l}):a.chunkDataSize;return[{key:a.key,offset:a.offset,sizeInVoxels:e,voxelSize:b,chunkDataSize:c}]})}}y(a,[{key:"getSources",value:function(a){var e=this,c=this.numChannels,d=this.dataType,h=this.volumeType,k=this.encoding,f=this.scales[0][0],r=b.s.multiply(b.s.create(),
f.voxelSize,f.sizeInVoxels);return this.scales.map(function(f){return f.map(function(f){var n=g.b.withDefaultCompression({voxelSize:f.voxelSize,dataType:d,volumeType:h,numChannels:c,transform:b.k.fromTranslation(b.k.create(),f.offset),upperVoxelBound:f.sizeInVoxels,upperClipBound:r,chunkDataSize:f.chunkDataSize,volumeSourceOptions:a});return e.chunkManager.getChunkSource(E,{spec:n,dataSource:e.dataSource,generation:e.generation,parameters:{key:e.key,scaleKey:f.key,encoding:k}})})})}},{key:"getMeshSource",
value:function(){var a=this.skeletonVertexAttributes;return void 0!==a?this.chunkManager.getChunkSource(G,{dataSource:this.dataSource,generation:this.generation,parameters:{key:this.key,vertexAttributes:a}}):this.chunkManager.getChunkSource(x,{dataSource:this.dataSource,generation:this.generation,parameters:{key:this.key}})}}]);return a}(),G=function(a){function b(){u(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);y(b,[{key:"skeletonVertexCoordinatesInVoxels",
get:function(){return!1}},{key:"vertexAttributes",get:function(){return this.parameters.vertexAttributes}}]);return b}(a(Object(m.f)(l.d,v.b))),J=function(a){function b(){u(this,b);var a=p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));a.sources=new Map;a.sourceGenerations=new Map;return a}q(b,a);y(b,[{key:"registerSource",value:function(a,b){var e=this,c=this.sources.get(a);void 0===c&&(c=new Set,this.sources.set(a,c));var d=this.sourceGenerations.get(a);void 0!==d&&(b.generation=
d);c.add(b);b.registerDisposer(function(){c.delete(b);0===c.size&&e.sources.delete(a)})}},{key:"setSourceGeneration",value:function(a,b){var e=this.sourceGenerations;if(e.get(a)!==b&&(e.set(a,b),a=this.sources.get(a),void 0!==a))for(a=$jscomp.makeIterator(a),e=a.next();!e.done;e=a.next())e=e.value,e.generation!==b&&(e.generation=b,e.invalidateCache())}},{key:"deleteSourceGeneration",value:function(a){this.sourceGenerations.delete(a)}},{key:"getVolume",value:function(a,b){var e=this;return a.memoize.getUncounted({type:"python:MultiscaleVolumeChunkSource",
key:b},function(){return Object(h.e)(Object(h.b)("/neuroglancer/info/"+b),"json").then(function(c){return new D(e,a,b,c)})})}},{key:"getSkeletonSource",value:function(a,b){var e=b.match(/^([^\/?]+)\?(.*)$/);if(null===e)throw Error("Invalid python volume path: "+JSON.stringify(b));return a.getChunkSource(G,{dataSource:this,generation:-1,parameters:{key:e[1],vertexAttributes:Object(r.u)(JSON.parse(e[2]),n)}})}},{key:"description",get:function(){return"Python-served volume"}}]);return b}(f.a)},function(m,
f,d){function u(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(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 q(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)}d.d(f,"a",function(){return h});var a=d(36),c=d(31);m=d(114);f=d(65);var n=d(1),v=d(48),t=d(17),l=function(){function a(a,b){for(var e=0;e<b.length;e++){var c=b[e];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,e,c){e&&a(b.prototype,e);c&&a(b,c);return b}}(),k=function A(a,b,e){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,e)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(e)}},g=n.k.create(),e=n.s.create(),b=function(a){function b(){u(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);l(b,[{key:"defineShader",value:function(a){k(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"defineShader",this).call(this,a);a.addAttribute("highp float","aVertexIndexFloat");a.addUniform("highp vec3",
"uTranslation");a.addUniform("highp mat4","uProjectionMatrix");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;\nvec3 position = getBoundingBoxPlaneIntersectionVertexPosition(chunkSize, uTranslation, uLowerClipBound, uUpperClipBound, int(aVertexIndexFloat));\ngl_Position = uProjectionMatrix * vec4(position, 1.0);\nvChunkPosition = (position - uTranslation) / uVoxelSize +\n    0.001 * abs(uPlaneNormal);\n");
a.addFragmentCode("\nvec3 getPositionWithinChunk () {\n  return floor(min(vChunkPosition, uChunkDataSize - 1.0));\n}\n")}},{key:"computeVerticesDebug",value:function(a,b,e,c,d,g,h,k){a=n.s.multiply(n.s.create(),a,b);for(var f=n.s.create(),l=n.s.create(),t=n.s.fromValues(Math.abs(g[0]),Math.abs(g[1]),Math.abs(g[2])),p=0;6>p;++p){var v=this.computeVertexPositionDebug(a,e,c,d,g,h,p);if(void 0===v){console.log("no intersection found");break}n.s.transformMat4(f,v,k);n.s.sub(l,v,h);n.s.divide(l,l,b);n.s.scaleAndAdd(l,
l,t,.001);console.log("vertex "+p+", at "+f+", vChunkPosition = "+l)}}},{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,b,e,c,d,h){this.setViewportPlane(b,e.viewportAxes[2],e.centerDataPosition,h.invTransform);a.uniformMatrix4fv(b.uniform("uProjectionMatrix"),!1,n.k.multiply(g,c,h.transform));
a.uniform3fv(b.uniform("uVoxelSize"),d.voxelSize);a.uniform3fv(b.uniform("uLowerClipBound"),d.lowerClipBound);a.uniform3fv(b.uniform("uUpperClipBound"),d.upperClipBound)}},{key:"setupChunkDataSize",value:function(a,b,e){a.uniform3fv(b.uniform("uChunkDataSize"),e)}},{key:"drawChunk",value:function(a,b,e){a.uniform3fv(b.uniform("uTranslation"),e);a.drawArrays(a.TRIANGLE_FAN,0,6)}}],[{key:"get",value:function(a){return a.memoize.get("volume.VolumeSliceVertexComputationManager",function(){return new b(a)})}}]);
return b}(m.a),h=function(d){function g(a,d){d=void 0===d?{}:d;u(this,g);var h=d,k=void 0===h.sourceOptions?{}:h.sourceOptions;h=h.shaderError;var f=p(this,(g.__proto__||Object.getPrototypeOf(g)).call(this,a.chunkManager,a.getSources(k),d));a=f.gl;f.shaderGetter=f.registerDisposer(new v.a(a,function(a){return f.defineShader(a)},function(){return f.getShaderKey()+"/"+f.chunkFormat.shaderKey},h));f.vertexComputationManager=b.get(a);d=Object(c.o)(f)[0][0];a=d.chunkLayout;d=d.source.spec;k=f.boundingBox=
new n.b(n.s.fromValues(Infinity,Infinity,Infinity),n.s.fromValues(-Infinity,-Infinity,-Infinity));h=n.s.create();for(var l=0;8>l;++l){for(var t=0;3>t;++t)e[t]=l&1<<t?d.upperClipBound[t]:d.lowerClipBound[t];a.localSpatialToGlobal(h,e);n.s.min(k.lower,k.lower,h);n.s.max(k.upper,k.upper,h)}return f}q(g,d);l(g,[{key:"getValueAt",value:function(a){for(var b=$jscomp.makeIterator(Object(c.o)(this)),e=b.next();!e.done;e=b.next()){e=$jscomp.makeIterator(e.value);for(var d=e.next();!d.done;d=e.next())if(d=
d.value,d=d.source.getValueAt(a,d.chunkLayout),null!=d)return d}return null}},{key:"getShaderKey",value:function(){return this.chunkFormat.shaderKey}},{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"+Object(t.a)(this.dataType)+" getDataValue() { return getDataValue(0); }\n")}},{key:"beginSlice",value:function(a){a=this.gl;var b=this.shaderGetter.get();
if(void 0!==b)return b.bind(),this.vertexComputationManager.beginSlice(a,b),b}},{key:"endSlice",value:function(a){this.vertexComputationManager.endSlice(this.gl,a)}},{key:"draw",value:function(b){var e=b.visibleLayers.get(this);if(0!==e.length){var c=this.gl,d=this.beginSlice(b);if(void 0!==d){var g=n.s.create(),h=this.vertexComputationManager,k=this.chunkFormat;k.beginDrawing(c,d);var f={};e=$jscomp.makeIterator(e);for(var l=e.next();!l.done;f={chunkDataSize:f.chunkDataSize},l=e.next()){l=l.value;
var t=l.chunkLayout,p=l.source;l=p.chunks;var v=t.size;f.chunkDataSize=void 0;var q=b.visibleChunks.get(t);if(q){h.beginSource(c,d,b,b.dataToDevice,p.spec,t);t=p.chunkFormat;t.beginSource(c,d);p=function(a){return function(b){a.chunkDataSize=b;h.setupChunkDataSize(c,d,a.chunkDataSize)}}(f);q=$jscomp.makeIterator(q);for(var m=q.next();!m.done;m=q.next())if((m=l.get(m.value))&&m.state===a.d.GPU_MEMORY){var u=m.chunkDataSize;u!==f.chunkDataSize&&p(u);n.s.multiply(g,v,m.chunkGridPosition);t.bindChunk(c,
d,m);h.drawChunk(c,d,g)}}}k.endDrawing(c,d);this.endSlice(d)}}}},{key:"dataType",get:function(){return this.sources[0][0].spec.dataType}},{key:"chunkFormat",get:function(){return this.sources[0][0].chunkFormat}}]);return g}(f.a)},function(m,f,d){function u(c){if(Object(q.m)(c,a))return Object(q.A)(c);throw Error();}d.d(f,"b",function(){return a});f.c=function(a){return new p.c(void 0===a?"default":a,u)};var p=d(6),q=d(2),a;(function(a){a[a.DEFAULT=0]="DEFAULT";a[a.ADDITIVE=1]="ADDITIVE"})(a||(a={}));
m=new Map;f.a=m;m.set(a.DEFAULT,function(a){a.blendFunc(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA)});m.set(a.ADDITIVE,function(a){a.blendFunc(a.SRC_ALPHA,a.ONE)})},function(m,f,d){function u(a,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);a.prototype=Object.create(e&&e.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});e&&(Object.setPrototypeOf?Object.setPrototypeOf(a,e):a.__proto__=e)}function p(d){return function(e){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}u(b,e);l(b,[{key:"restoreState",value:function(e){var d=this;k(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"restoreState",this).call(this,e);e=this.volumePath=Object(t.v)(e,"source",t.y);void 0!==e&&(this.multiscaleSource=
Object(c.d)(this.manager.dataSourceProvider,this.manager.chunkManager,e,this.volumeOptions)).then(function(b){d.wasDisposed||(b=b.getStaticAnnotations&&b.getStaticAnnotations(),void 0!==b&&(d.annotationLayerState.value=new q.b(Object.assign({transform:d.transform,source:b,role:a.g.DEFAULT_ANNOTATION},Object(n.b)(d)))))})}},{key:"toJSON",value:function(){var a=k(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"toJSON",this).call(this);a.source=this.volumePath;return a}}]);return b}(d)}f.a=
function(a){return p(Object(n.a)(Object(v.a)(a)))};var q=d(62),a=d(15),c=d(21),n=d(86),v=d(89),t=d(2),l=function(){function a(a,b){for(var e=0;e<b.length;e++){var c=b[e];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(e,b,c){b&&a(e.prototype,b);c&&a(e,c);return e}}(),k=function e(a,c,d){null===a&&(a=Function.prototype);var b=Object.getOwnPropertyDescriptor(a,c);if(void 0===b){if(a=Object.getPrototypeOf(a),null!==a)return e(a,
c,d)}else{if("value"in b)return b.value;c=b.get;return void 0===c?void 0:c.call(d)}}},function(m,f,d){function u(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}function p(a){if(void 0===a[3]||1===a[3]){for(var d="#",k=0;3>k;++k)d+=Object(c.c)(Math.min(255,
Math.max(0,Math.round(255*a[k]))));return d}d="rgba(";for(k=0;3>k;++k)0!==k&&(d+=", "),d+=Math.min(255,Math.max(0,Math.round(255*a[k])));return d+=", "+Object(q.a)(a[3])+")"}d.d(f,"a",function(){return v});m=d(6);var q=d(137),a=d(1),c=d(138),n=function(){function a(a,c){for(var d=0;d<c.length;d++){var e=c[d];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(c,d,g){d&&a(c.prototype,d);g&&a(c,g);return c}}(),v=function(c){function d(c){if(!(this instanceof
d))throw new TypeError("Cannot call a class as a function");var g=(d.__proto__||Object.getPrototypeOf(d)).call(this,a.s.clone(c));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.defaultValue=c;return g}u(d,c);n(d,[{key:"toString",value:function(){return p(this.value)}},{key:"toJSON",value:function(){if(!a.s.equals(this.value,this.defaultValue))return p(this.value)}},{key:"reset",value:function(){this.value=
a.s.clone(this.defaultValue)}},{key:"restoreState",value:function(c){if(void 0===c)this.reset();else{var d=this.value;try{if("string"!==typeof c)throw Error("Expected string, but received "+JSON.stringify(c)+".");var e=document.createElement("canvas").getContext("2d");e.fillStyle=c;var b=e.fillStyle,h=b.match(/^rgba\(([0-9]+), ([0-9]+), ([0-9]+), (0(?:\.[0-9]+)?)\)$/);if(null!==h)var k=[parseInt(h[1],10),parseInt(h[2],10),parseInt(h[3],10),parseFloat(h[4])];else{var f=b.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/);
if(null!==f)k=[parseInt(f[1],16),parseInt(f[2],16),parseInt(f[3],16),1];else throw Error("Invalid serialized color: "+JSON.stringify(b)+".");}c=k;var n=a.u.fromValues(c[0]/255,c[1]/255,c[2]/255,c[3])}catch(z){throw Error("Failed to parse color specification: "+z.message);}n=n.subarray(0,3);a.s.equals(d,n)||(this.value=n)}}}]);return d}(m.f)},function(m,f,d){f.a=function(d){d=u[0]=d;for(var f=0;9>f;++f){var a=d.toFixed(f);u[0]=parseFloat(a);if(u[0]===d)return a}return d.toString()};var u=new Float32Array(1)},
function(m,f,d){function u(d){return("0"+d.toString(16)).slice(-2)}f.c=u;f.b=function(d){return Array.prototype.map.call(d,u).join("")};f.a=function(d){if(!/^(?:[0-9a-fA-F]{2})*$/.test(d))throw Error("Invalid hex-encoded string");for(var f=d.length/2,a=new Uint8Array(f),c=0;c<f;++c)a[c]=parseInt(d.substr(2*c,2),16);return a}},function(m,f,d){function u(a){var c=Object(q.b)(a);return(a/c.lengthInNanometers).toPrecision(3)+"\u202f"+c.unit}f.c=function(a){return"("+Math.floor(a[0])+", "+Math.floor(a[1])+
", "+Math.floor(a[2])+")"};f.b=function(a){for(var c="",d=0;3>d;++d)0!==d&&(c+=" \u00d7 "),c+=Math.round(Math.abs(a[d]));return c};f.d=u;f.a=function(a,c,d){for(var f="",n=p.s.create(),l=0;3>l;++l){p.s.set(n,0,0,0);n[l]=c[l]-a[l];var k=Object(p.p)(n,n,d);k=p.s.length(k);0!==l&&(f+=" \u00d7 ");f+=u(k)}a=Math.abs(Object(p.l)(p.s.subtract(n,c,a)));d=p.i.determinant(p.i.fromMat4(p.i.create(),d));f+="  [";d*=a;a=Object(q.c)(d);d=(d/Math.pow(a.lengthInNanometers,3)).toPrecision(6)+"\u202f"+a.unit+"\u00b3";
return f+d+"]"};var p=d(1),q=d(69)},function(m,f,d){function u(a,c){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!c||"object"!==typeof c&&"function"!==typeof c?a:c}function p(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,
c):a.__proto__=c)}d.d(f,"a",function(){return t});m=d(0);var q=d(10),a=d(3),c=d(14),n=function(){function a(a,c){for(var e=0;e<c.length;e++){var b=c[e];b.enumerable=b.enumerable||!1;b.configurable=!0;"value"in b&&(b.writable=!0);Object.defineProperty(a,b.key,b)}}return function(c,d,e){d&&a(c.prototype,d);e&&a(c,e);return c}}(),v=function k(a,e,b){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,e);if(void 0===c){if(a=Object.getPrototypeOf(a),null!==a)return k(a,e,b)}else{if("value"in
c)return c.value;e=c.get;return void 0===e?void 0:e.call(b)}};d(41);d(238);var t=function(d){function g(){if(!(this instanceof g))throw new TypeError("Cannot call a class as a function");var e=u(this,(g.__proto__||Object.getPrototypeOf(g)).call(this));e.element=document.createElement("form");e.label=document.createElement("label");e.input=document.createElement("input");e.valuesEntered=new a.b;var b=e.element,c=e.label,d=e.input;b.className="uint64-entry neuroglancer-noselect";b.appendChild(c);c.appendChild(d);
e.registerEventListener(b,"submit",function(a){a.preventDefault();a=e.validateInput();void 0!==a&&(e.input.value="",e.input.classList.remove("valid-input","invalid-input"),e.valuesEntered.dispatch(a))});e.registerEventListener(b,"input",function(){""===e.input.value?e.input.classList.remove("valid-input","invalid-input"):e.validateInput()?e.input.classList.remove("invalid-input"):e.input.classList.add("invalid-input")});return e}p(g,d);n(g,[{key:"validateInput",value:function(){var a=this.input.value;
a=a.replace(/[\s,\(\)\[\]\{\};]+/g," ");a=a.trim();var b=a.split(" ");if(0!==b.length){a=[];b=$jscomp.makeIterator(b);for(var d=b.next();!d.done;d=b.next()){d=d.value;var g=new c.a;if(!g.tryParseString(d))return;a.push(g)}return a}}},{key:"disposed",value:function(){Object(q.b)(this.element);v(g.prototype.__proto__||Object.getPrototypeOf(g.prototype),"disposed",this).call(this)}}]);return g}(m.a)},function(m,f){},function(m,f){},function(m,f){},function(m,f){},function(m,f,d){f.a=function(d){return new u.c(void 0===
d?1:d,p.n)};var u=d(6),p=d(2)},function(m,f,d){f.a=function(a){a=void 0===a?u.s.create():a;return new c(a,a)};var u=d(1),p=d(2),q=d(3),a=function(){function a(a,c){for(var d=0;d<c.length;d++){var k=c[d];k.enumerable=k.enumerable||!1;k.configurable=!0;"value"in k&&(k.writable=!0);Object.defineProperty(a,k.key,k)}}return function(c,d,f){d&&a(c.prototype,d);f&&a(c,f);return c}}(),c=function(){function c(a,d){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");this.value_=
a;this.defaultValue=d;this.changed=new q.a}a(c,[{key:"toJSON",value:function(){if(this.value_!==this.defaultValue)return this.value_.toString()}},{key:"restoreState",value:function(a){try{this.value=Object(p.k)(a.split(","))}catch(t){this.value=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 c}()},function(m,f,d){function u(a,b){if(!(a instanceof
b))throw new TypeError("Cannot call a class as a function");}function p(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 q(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){return new B.a({fragmentMain:a.displayState.fragmentMain,shaderError:a.displayState.shaderError,fragmentMainStartLine:g.a})}Object.defineProperty(f,"__esModule",{value:!0});d.d(f,"SegmentationUserLayer",function(){return R});m=d(15);f=d(21);var c=d(57),n=d(42),v=d(148),t=d(70),l=d(248),k=d(63),g=d(83),e=d(19),b=d(250),h=d(49),r=d(40),A=d(6),y=d(251),z=d(135),E=d(2),x=d(3),D=d(14),G=d(48),J=d(71),C=d(252),B=d(90),F=d(35),P=d(140),H=function(){function a(a,b){for(var e=
0;e<b.length;e++){var c=b[e];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,e,c){e&&a(b.prototype,e);c&&a(b,c);return b}}(),N=function W(a,b,e){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,b);if(void 0===c){if(a=Object.getPrototypeOf(a),null!==a)return W(a,b,e)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(e)}};d(41);d(254);var R=function(a){function d(a,b){u(this,
d);var e=p(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,a,b));e.manager=a;e.displayState={segmentColorHash:v.a.getDefault(),segmentSelectionState:new t.a,selectedAlpha:Object(h.a)(.5),saturation:Object(h.a)(1),notSelectedAlpha:Object(h.a)(0),objectAlpha:Object(h.a)(1),clipBounds:k.a.make(e.manager.worker,void 0),hideSegmentZero:new r.b(!0,!0),visibleSegments:y.a.makeWithCounterpart(e.manager.worker),highlightedSegments:y.a.makeWithCounterpart(e.manager.worker),segmentEquivalences:l.a.makeWithCounterpart(e.manager.worker),
objectToDataTransform:e.transform,fragmentMain:Object(g.f)(),shaderError:Object(G.c)()};e.objectLayerStateChanged=new x.a;e.displayState.visibleSegments.changed.add(function(){return e.specificationChanged.dispatch()});e.displayState.segmentEquivalences.changed.add(function(){return e.specificationChanged.dispatch()});e.displayState.segmentSelectionState.bindTo(a.layerSelectedValues,e);e.displayState.selectedAlpha.changed.add(function(){return e.specificationChanged.dispatch()});e.displayState.notSelectedAlpha.changed.add(function(){return e.specificationChanged.dispatch()});
e.displayState.objectAlpha.changed.add(function(){return e.specificationChanged.dispatch()});e.displayState.hideSegmentZero.changed.add(function(){return e.specificationChanged.dispatch()});e.displayState.fragmentMain.changed.add(function(){return e.specificationChanged.dispatch()});e.tabs.add("rendering",{label:"Rendering",order:-100,getter:function(){return new O(e)}});e.tabs.default="rendering";return e}q(d,a);H(d,[{key:"restoreState",value:function(a){var e=this;N(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),
"restoreState",this).call(this,a);this.displayState.selectedAlpha.restoreState(a.selectedAlpha);this.displayState.saturation.restoreState(a.saturation);this.displayState.notSelectedAlpha.restoreState(a.notSelectedAlpha);this.displayState.objectAlpha.restoreState(a.objectAlpha);this.displayState.hideSegmentZero.restoreState(a.hideSegmentZero);this.displayState.fragmentMain.restoreState(a.skeletonShader);Object(E.v)(a,"equivalences",function(a){e.displayState.segmentEquivalences.restoreState(a)});var h=
function(b,c){Object(E.v)(a,b,function(a){if(void 0!==a){var b=e.displayState.segmentEquivalences;Object(E.a)(a,function(a){a=D.a.parseString(String(a),10);c.add(b.get(a))})}})};h("segments",this.displayState.visibleSegments);h("highlights",this.displayState.highlightedSegments);Object(E.v)(a,"clipBounds",function(a){if(void 0!==a){var b,c;Object(E.v)(a,"center",function(a){return b=Object(E.k)(a)});Object(E.v)(a,"size",function(a){return c=Object(E.k)(a)});b&&c&&(e.displayState.clipBounds.value=
{center:b,size:c})}});this.displayState.highlightedSegments.changed.add(function(){e.specificationChanged.dispatch()});h=this.multiscaleSource;var k=this.meshPath=null===a.mesh?null:Object(E.y)(a.mesh),f=this.skeletonsPath=Object(E.v)(a,"skeletons",E.y),r=0;null!=k&&(++r,this.manager.dataSourceProvider.getMeshSource(this.manager.chunkManager,k).then(function(a){e.wasDisposed||(e.addMesh(a),0===--r&&(e.isReady=!0))}));void 0!==f&&(++r,this.manager.dataSourceProvider.getSkeletonSource(this.manager.chunkManager,
f).then(function(a){e.wasDisposed||(e.addSkeletonSource(a),0===--r&&(e.isReady=!0))}));void 0!==h&&(++r,h.then(function(a){e.wasDisposed||(e.addRenderLayer(new b.a(a,e.displayState)),void 0===k&&void 0===f&&(++r,Promise.resolve(a.getMeshSource()).then(function(a){e.wasDisposed?null!==a&&a.dispose():(0===--r&&(e.isReady=!0),a instanceof c.b?(e.addMesh(a),e.objectLayerStateChanged.dispatch()):a instanceof g.d&&(e.addSkeletonSource(a),e.objectLayerStateChanged.dispatch()))})),0===--r&&(e.isReady=!0))}))}},
{key:"addMesh",value:function(a){this.meshLayer=new c.a(this.manager.chunkManager,a,this.displayState);this.addRenderLayer(this.meshLayer)}},{key:"addSkeletonSource",value:function(a){this.skeletonLayer=a=new g.c(this.manager.chunkManager,a,this.manager.voxelSize,this.displayState);this.addRenderLayer(new g.b(a.addRef()));this.addRenderLayer(new g.e(a))}},{key:"toJSON",value:function(){var a=N(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"toJSON",this).call(this);a.type="segmentation";
a.mesh=this.meshPath;a.skeletons=this.skeletonsPath;a.selectedAlpha=this.displayState.selectedAlpha.toJSON();a.notSelectedAlpha=this.displayState.notSelectedAlpha.toJSON();a.saturation=this.displayState.saturation.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.highlightedSegments;0<b.size&&(a.highlights=b.toJSON());b=this.displayState.segmentEquivalences;
0<b.size&&(a.equivalences=b.toJSON());b=this.displayState.clipBounds;b.value&&(a.clipBounds={center:Array.from(b.value.center),size:Array.from(b.value.size)});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 t.c(a,b)}},{key:"handleAction",value:function(a){switch(a){case "recolor":this.displayState.segmentColorHash.randomize();
break;case "clear-segments":this.displayState.visibleSegments.clear();break;case "select":a=this.displayState.segmentSelectionState;if(a.hasSelectedSegment){a=a.selectedSegment;var b=this.displayState.visibleSegments;b.has(a)?b.delete(a):b.add(a)}break;case "highlight":a=this.displayState.segmentSelectionState,a.hasSelectedSegment&&(a=a.selectedSegment,b=this.displayState.highlightedSegments,b.has(a)?b.delete(a):b.add(a))}}},{key:"volumeOptions",get:function(){return{volumeType:e.c.SEGMENTATION}}}]);
return d}(Object(z.a)(m.i)),O=function(b){function e(b){u(this,e);var c=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));c.layer=b;c.visibleSegmentWidget=c.registerDisposer(new C.a(c.layer.displayState));c.addSegmentWidget=c.registerDisposer(new P.a);c.selectedAlphaWidget=c.registerDisposer(new J.a(c.layer.displayState.selectedAlpha));c.notSelectedAlphaWidget=c.registerDisposer(new J.a(c.layer.displayState.notSelectedAlpha));c.saturationWidget=c.registerDisposer(new J.a(c.layer.displayState.saturation));
c.objectAlphaWidget=c.registerDisposer(new J.a(c.layer.displayState.objectAlpha));var d=c.element;d.classList.add("segmentation-dropdown");var g=c.notSelectedAlphaWidget,h=c.saturationWidget,k=c.objectAlphaWidget;c.selectedAlphaWidget.promptElement.textContent="Opacity (on)";g.promptElement.textContent="Opacity (off)";h.promptElement.textContent="Saturation";k.promptElement.textContent="Opacity (3d)";void 0!==c.layer.volumePath&&(d.appendChild(c.selectedAlphaWidget.element),d.appendChild(c.notSelectedAlphaWidget.element),
d.appendChild(c.saturationWidget.element));c.registerDisposer(new r.a(c.registerDisposer(new A.a(function(){return c.layer.meshPath||c.layer.meshLayer||c.layer.skeletonsPath||c.layer.skeletonLayer?!0:!1},c.layer.objectLayerStateChanged)),c.objectAlphaWidget.element));d.appendChild(c.objectAlphaWidget.element);b=c.registerDisposer(new r.c(b.displayState.hideSegmentZero));b.element.className="neuroglancer-segmentation-dropdown-hide-segment-zero neuroglancer-noselect";g=document.createElement("label");
g.className="neuroglancer-segmentation-dropdown-hide-segment-zero neuroglancer-noselect";g.appendChild(document.createTextNode("Hide segment ID 0"));g.appendChild(b.element);d.appendChild(g);c.addSegmentWidget.element.classList.add("add-segment");c.addSegmentWidget.element.title="Add one or more segment IDs";d.appendChild(c.registerDisposer(c.addSegmentWidget).element);c.registerDisposer(c.addSegmentWidget.valuesEntered.add(function(a){a=$jscomp.makeIterator(a);for(var b=a.next();!b.done;b=a.next())c.layer.displayState.visibleSegments.add(b.value)}));
d.appendChild(c.registerDisposer(c.visibleSegmentWidget).element);b=function(){if(void 0===c.codeWidget&&null!==c.layer.skeletonsPath&&void 0!==c.layer.skeletonLayer){var b=document.createElement("div");b.className="neuroglancer-segmentation-dropdown-skeleton-shader-header";var e=document.createElement("div");e.style.flex="1";e.textContent="Skeleton shader:";var g=document.createElement("a"),h=document.createElement("button");h.type="button";h.textContent="?";h.className="help-link";g.appendChild(h);
g.title="Documentation on skeleton rendering";g.target="_blank";g.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 Q(c.layer)});b.appendChild(e);b.appendChild(h);b.appendChild(g);d.appendChild(b);b=c.codeWidget=c.registerDisposer(a(c.layer));d.appendChild(b.element);b.textEditor.refresh()}};
c.registerDisposer(c.layer.objectLayerStateChanged.add(b));b();c.visibility.changed.add(function(){c.visible&&void 0!==c.codeWidget&&c.codeWidget.textEditor.refresh()});return c}q(e,b);return e}(F.b),Q=function(b){function e(b){u(this,e);var c=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));c.layer=b;c.codeWidget=c.registerDisposer(a(c.layer));c.content.classList.add("neuroglancer-segmentation-layer-skeleton-shader-overlay");c.content.appendChild(c.codeWidget.element);c.codeWidget.textEditor.refresh();
return c}q(e,b);return e}(n.a);Object(f.e)("segmentation",R);Object(f.f)(e.c.SEGMENTATION,R)},function(m,f,d){function u(a,e){if(!(a instanceof e))throw new TypeError("Cannot call a class as a function");}function p(a){return a-Math.floor(a)}d.d(f,"b",function(){return l});d.d(f,"a",function(){return e});var q=d(91),a=d(149),c=d(123),n=d(3),v=d(17),t=function(){function a(a,b){for(var e=0;e<b.length;e++){var c=b[e];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,
c.key,c)}}return function(b,e,c){e&&a(b.prototype,e);c&&a(b,c);return b}}(),l=function(){function b(a){u(this,b);this.prefix=a;this.aName=this.prefix+"_a";this.bName=this.prefix+"_b"}t(b,[{key:"defineShader",value:function(b){var e=this.aName,c=this.bName;b.addUniform("highp vec4",e,4);b.addUniform("highp float",c,4);b.addFragmentCode(v.n);b.addFragmentCode(a.d);b.addFragmentCode(v.h);for(var d="\nvec3 "+this.prefix+"(uint64_t x) {\n  vec2 v;\n  float primeModulus = float("+q.b+");\n",g=0;2>g;++g){var h=
2*g,k=2*g;d+="\n  v["+g+"] = computeHash(x,\n                        "+e+"["+k+"], "+e+"["+(k+1)+"],\n                        "+c+"["+h+"], "+c+"["+(h+1)+"],\n                        primeModulus, 1.0 / 256.0);\n"}b.addFragmentCode(d+"\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,e){a.uniform4fv(b.uniform(this.aName),e.a_);a.uniform1fv(b.uniform(this.bName),e.b_)}}]);return b}(),k=new Float32Array(2),g=new Float32Array(3),e=function(){function a(b){u(this,
a);this.a_=new Float32Array(16);this.b_=new Float32Array(4);this.changed=new n.a;null==b?(this.hashFunctions=Array(2),this.randomize_()):this.hashFunctions=b;this.computeGPUCoefficients_()}t(a,[{key:"compute",value:function(a,b){var e=b.low;b=b.high;for(var d=this.hashFunctions,g=0;2>g;++g)k[g]=p(d[g].compute(e,b)/256);Object(c.a)(a,k[0],.5+.5*k[1],1);return a}},{key:"computeCssColor",value:function(a){this.compute(g,a);return"rgb("+100*g[0]+"%,"+100*g[1]+"%,"+100*g[2]+"%)"}},{key:"debugCompute",
value:function(a,b){var e=b.low;b=b.high;for(var c=this.b_,d=q.b,g=0;2>g;++g){for(var h=2*g,k=2*g,f=new Float32Array(2),r=0;4>r;++r)f[0]+=this.a_[4*k+r]*(e>>8*r&255),f[1]+=this.a_[4*(k+1)+r]*(b>>8*r&255);k=(f[0]+f[1])%d;r=k*k%d;var n=r*c[h+1]%d,l=(c[h]+k+n)%d;console.log("b = "+c[h]+", sums="+f[0]+" "+f[1]+", dotResult="+k+", "+("prod = "+k*k+" dotResult2="+r+", y="+n+", ")+("modResult="+l));a[g]=p(1/256*l)}return a}},{key:"randomize_",value:function(){for(var a=0;2>a;++a)this.hashFunctions[a]=q.a.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_,e=this.b_,c=0;2>c;++c){var d=a[c],g=2*c,k=8*c;e[g]=1*d.b;e[g+1]=1*d.c;for(g=0;4>g;++g)b[k+g]=1*d.a0[g],b[k+4+g]=1*d.a1[g]}}}],[{key:"getDefault",value:function(){return new a([new q.a(Float32Array.of(609,2364,3749,2289),
Float32Array.of(2840,1186,3660,1833),1718,1109),new q.a(Float32Array.of(3466,3835,3345,2040),Float32Array.of(3382,901,18,3444),1534,1432)])}}]);return a}()},function(m,f,d){function u(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(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 q(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)}d.d(f,"a",function(){return g});d.d(f,"c",function(){return e});d.d(f,"b",function(){return b});var a=d(91),c=d(92);m=d(0);var n=d(17),v=d(66),t=function(){function a(a,b){for(var e=0;e<b.length;e++){var c=b[e];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,
c)}}return function(b,e,c){e&&a(b.prototype,e);c&&a(b,c);return b}}(),l=function r(a,b,e){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,e)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(e)}},k=[n.q,n.n,n.e,n.i,"\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"];
f.d=k;var g=function(b){function e(a,b){u(this,e);var c=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));c.gl=a;c.hashTable=b;c.hashFunctions=null;c.generation=-1;c.texture=null;b=b.hashFunctions.length;c.a=new Float32Array(16*b);c.b=new Float32Array(4*b+5);c.texture=a.createTexture();return c}q(e,b);t(e,[{key:"computeCoefficients",value:function(){var b=this.hashTable,e=b.hashFunctions;if(this.hashFunctions!==e){this.hashFunctions=e;for(var c=this.a,d=this.b,g=e.length,k=b.width,f=[1/k,
1/b.height],n=0;2>n;++n)d[4*g+n]=a.b,d[4*g+3+n]=f[n];d[4*g+2]=1/(b.entryStride*k);for(k=0;k<g;++k)for(f=e[k],n=0;2>n;++n){var r=f[n],l=4*k+2*n,t=4*(4*k+2*n);d[l]=r.b+(0===n?.5/b.entryStride:.5);d[l+1]=r.c;for(l=0;4>l;++l)c[t+l]=r.a0[l],c[t+4+l]=r.a1[l]}}}},{key:"copyToGPU",value:function(){this.computeCoefficients();var a=this.hashTable,b=a.generation;if(this.generation!==b){this.generation=b;var e=a.width,c=a.height,d=this.gl;b=this.texture;d.activeTexture(d.TEXTURE0+d.tempTextureUnit);d.bindTexture(d.TEXTURE_2D,
b);d.pixelStorei(d.UNPACK_ALIGNMENT,1);Object(v.b)(d);var g=d.RGBA;a.tableWithMungedEmptyKey(function(b){d.texImage2D(d.TEXTURE_2D,0,g,e*a.entryStride,c,0,g,d.UNSIGNED_BYTE,new Uint8Array(b.buffer))});d.bindTexture(d.TEXTURE_2D,null)}}},{key:"disposed",value:function(){this.gl.deleteTexture(this.texture);this.texture=null;this.hashTable=this.gl=void 0;this.hashFunctions=null;l(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"disposed",this).call(this)}}],[{key:"get",value:function(a,b){var e=
this;return a.memoize.get(b,function(){return new e(a,b)})}}]);return e}(m.a),e=function(){function a(b,e){e=void 0===e?c.c:e;u(this,a);this.prefix=b;this.numAlternatives=e;$jscomp.initSymbol();this.textureUnitSymbol=Symbol.for("gpuhashtable:"+this.prefix);this.aName=this.prefix+"_a";this.bName=this.prefix+"_b";this.samplerName=this.prefix+"_sampler"}t(a,[{key:"defineShader",value:function(a){var b=this.aName,e=this.bName,c=this.samplerName,d=this.numAlternatives;a.addUniform("highp vec4",b,4*d);
a.addUniform("highp float",e,4*d+5);a.addTextureSampler2D(c,this.textureUnitSymbol);a.addFragmentCode(k);for(var g="",f=0;f<d;++f){for(var n=0;2>n;++n){var r=4*f+2*n,l=4*f+2*n;g+="\nfloat "+this.prefix+"_computeHash_"+f+"_"+n+"(uint64_t x) {\n  float primeModulus = "+e+"["+(4*d+n)+"];\n  float scalar = "+e+"["+(4*d+3+n)+"];\n  return computeHash(x,\n                     "+b+"["+l+"], "+b+"["+(l+1)+"],\n                     "+e+"["+r+"], "+e+"["+(r+1)+"],\n                     primeModulus, scalar);\n}\n"}g+=
"\nvec2 "+this.prefix+"_computeHash_"+f+"(uint64_t x) {\n  vec2 v;\n  v[0] = "+this.prefix+"_computeHash_"+f+"_0(x);\n  v[1] = "+this.prefix+"_computeHash_"+f+"_1(x);\n  return v;\n}\n"}g+="\nbool "+this.hasFunctionName+"(uint64_t x) {\n  float highOffset = "+e+"["+(4*d+2)+"];\n";for(b=0;b<d;++b)g+="\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(g+"\n  return false;\n}\n")}},{key:"enable",value:function(a,b,e){e.copyToGPU();var c=b.textureUnit(this.textureUnitSymbol);a.activeTexture(a.TEXTURE0+c);a.bindTexture(a.TEXTURE_2D,e.texture);a.uniform4fv(b.uniform(this.aName),e.a);a.uniform1fv(b.uniform(this.bName),e.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}(),
b=function(a){function b(){u(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);t(b,[{key:"defineShader",value:function(a){l(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"defineShader",this).call(this,a);for(var e=this.samplerName,c=this.numAlternatives,d="\nbool "+this.getFunctionName+"(uint64_t x, out uint64_t value) {\n  float highOffset = "+this.bName+"["+(4*c+2)+"];\n",g=0;g<c;++g)d+="\n  {\n    vec2 v = "+this.prefix+"_computeHash_"+g+"(x);\n    vec4 lowResult = texture2D("+
e+", v);\n    vec4 highResult = texture2D("+e+", vec2(v.x + highOffset, v.y));\n    if (lowResult == x.low && highResult == x.high) {\n      value.low = texture2D("+e+", vec2(v.x + 2.0 * highOffset, v.y));\n      value.high = texture2D("+e+", vec2(v.x + 3.0 * highOffset, v.y));\n      return true;\n    }\n  }\n";a.addFragmentCode(d+"\n  return false;\n}\n")}},{key:"getFunctionName",get:function(){return this.prefix+"_get"}}]);return b}(e)},function(m,f,d){function u(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
}function p(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 q(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){for(var e=
$jscomp.makeIterator(S),c=e.next();!c.done;c=e.next()){c=c.value;var d=b[c];void 0!==d&&(a[c].value=d)}}function c(a){var b=new x.a,e=b.element;e.classList.add("neuroglancer-viewer-context-menu");var c=function(a,c){a=b.registerDisposer(new aa.a(c,{label:a}));a.element.classList.add("neuroglancer-viewer-context-menu-limit-widget");e.appendChild(a.element)};c("GPU memory limit",a.chunkQueueManager.capacities.gpuMemory.sizeLimit);c("System memory limit",a.chunkQueueManager.capacities.systemMemory.sizeLimit);
c("Concurrent chunk requests",a.chunkQueueManager.capacities.download.itemLimit);c=function(a,c){var d=document.createElement("label");d.textContent=a;a=b.registerDisposer(new z.c(c));d.appendChild(a.element);e.appendChild(d)};c("Show axis lines",a.showAxisLines);c("Show scale bar",a.showScaleBar);c("Show cross sections in 3-d",a.showPerspectiveSliceViews);c("Show default annotations",a.showDefaultAnnotations);return b}d.d(f,"a",function(){return na});m=d(5);var n=d.n(m),v=d(18),t=d(267);m=d(151);
var l=d(32),k=d(272),g=d(15),e=d(153),b=d(281),h=d(21),r=d(58),A=d(42),y=d(26),z=d(40),E=d(6),x=d(157),D=d(290),G=d(292),J=d(158),C=d(296),B=d(68),F=d(136);f=d(0);var P=d(10),H=d(20),N=d(1),R=d(55),O=d(3),Q=d(29),U=d(24),W=d(302),aa=d(304),I=d(97),T=d(88),da=d(12),L=function(){function a(a,b){for(var e=0;e<b.length;e++){var c=b[e];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,e,c){e&&a(b.prototype,e);c&&a(b,c);return b}}();
d(305);d(41);d(72);var ia=function(a){function b(a){u(this,b);var e=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));e.gl=a;e.worker=new Worker("chunk_worker.bundle.js");e.chunkQueueManager=e.registerDisposer(new v.d(new da.a(e.worker),e.gl,{gpuMemory:new v.a({defaultItemLimit:1E6,defaultSizeLimit:1E9}),systemMemory:new v.a({defaultItemLimit:1E7,defaultSizeLimit:2E9}),download:new v.a({defaultItemLimit:32,defaultSizeLimit:Number.POSITIVE_INFINITY})}));e.chunkManager=e.registerDisposer(new v.c(e.chunkQueueManager));
e.chunkQueueManager.registerDisposer(function(){return e.worker.terminate()});return e}q(b,a);L(b,[{key:"rpc",get:function(){return this.chunkQueueManager.rpc}}]);return b}(f.a);(function(a){function b(){u(this,b);var a=p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));a.global=new R.a;return a}q(b,a);return b})(m.b);var X=["showHelpButton","showEditStateButton","showLayerPanel","showLocation","showAnnotationToolStatus"],S=[].concat(["showUIControls","showPanelBorders"],$jscomp.arrayFromIterable(X)),
Y=function(a){function b(){u(this,b);var a=p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));a.showUIControls=new z.b(!0);a.showPanelBorders=new z.b(!0);return a}q(b,a);return b}(function La(){u(this,La);this.showHelpButton=new z.b(!0);this.showEditStateButton=new z.b(!0);this.showLayerPanel=new z.b(!0);this.showLocation=new z.b(!0);this.showAnnotationToolStatus=new z.b(!0)}),Ca={showLayerDialog:!0,resetStateWhenEmpty:!0},na=function(d){function f(b,c){c=void 0===c?{}:c;u(this,
f);var d=p(this,(f.__proto__||Object.getPrototypeOf(f)).call(this));d.display=b;d.navigationState=d.registerDisposer(new r.e);d.perspectiveNavigationState=new r.e(new r.g(d.navigationState.position),1);d.mouseState=new g.e;d.layerManager=d.registerDisposer(new g.a);d.selectedLayer=d.registerDisposer(new g.h(d.layerManager.addRef()));d.showAxisLines=new z.b(!0,!0);d.showScaleBar=new z.b(!0,!0);d.showPerspectiveSliceViews=new z.b(!0,!0);d.visibleLayerRoles=Object(g.k)();d.showDefaultAnnotations=new z.b(!0,
!0);d.crossSectionBackgroundColor=new F.a(N.s.fromValues(.5,.5,.5));d.layerSelectedValues=d.registerDisposer(new g.c(d.layerManager,d.mouseState));d.resetInitiated=new O.a;d.state=new Q.a;d.uiControlVisibility={};d.visible=!0;var k=c,v=void 0===k.dataContext?new ia(b.gl):k.dataContext,q=void 0===k.visibility?new U.b(U.b.VISIBLE):k.visibility,m=void 0===k.inputEventBindings?{global:new R.a,sliceView:new R.a,perspectiveView:new R.a}:k.inputEventBindings,y=void 0===k.element?b.makeCanvasOverlayElement():
k.element,x=void 0===k.dataSourceProvider?Object(l.a)({credentialsManager:t.a}):k.dataSourceProvider;k=void 0===k.uiConfiguration?new Y:k.uiConfiguration;d.visibility=q;d.inputEventBindings=m;d.element=y;d.dataSourceProvider=x;d.uiConfiguration=k;d.registerDisposer(function(){return Object(P.b)(d.element)});d.dataContext=d.registerDisposer(v);a(k,c);v=Object.assign({},Ca,c);c=v.resetStateWhenEmpty;v=v.showLayerDialog;q=$jscomp.makeIterator(X);for(m=q.next();!m.done;m=q.next())m=m.value,d.uiControlVisibility[m]=
d.makeUiControlVisibilityState(m);d.registerDisposer(d.uiConfiguration.showPanelBorders.changed.add(function(){d.updateShowBorders();d.display.onResize()}));d.showLayerDialog=v;d.resetStateWhenEmpty=c;d.layerSpecification=new h.c(d.dataSourceProvider,d.layerManager,d.chunkManager,d.layerSelectedValues,d.navigationState.voxelSize);d.registerDisposer(b.updateStarted.add(function(){d.onUpdateDisplay()}));d.registerDisposer(b.updateFinished.add(function(){d.onUpdateDisplayFinished()}));d.showDefaultAnnotations.changed.add(function(){d.showDefaultAnnotations.value?
d.visibleLayerRoles.add(g.g.DEFAULT_ANNOTATION):d.visibleLayerRoles.delete(g.g.DEFAULT_ANNOTATION)});c=d.state;c.add("layers",d.layerSpecification);c.add("navigation",d.navigationState);c.add("showAxisLines",d.showAxisLines);c.add("showScaleBar",d.showScaleBar);c.add("showDefaultAnnotations",d.showDefaultAnnotations);c.add("perspectiveOrientation",d.perspectiveNavigationState.pose.orientation);c.add("perspectiveZoom",d.perspectiveNavigationState.zoomFactor);c.add("showSlices",d.showPerspectiveSliceViews);
c.add("gpuMemoryLimit",d.dataContext.chunkQueueManager.capacities.gpuMemory.sizeLimit);c.add("systemMemoryLimit",d.dataContext.chunkQueueManager.capacities.systemMemory.sizeLimit);c.add("concurrentDownloads",d.dataContext.chunkQueueManager.capacities.download.itemLimit);c.add("selectedLayer",d.selectedLayer);c.add("crossSectionBackgroundColor",d.crossSectionBackgroundColor);d.registerDisposer(d.navigationState.changed.add(function(){d.handleNavigationStateChanged()}));d.layerManager.initializePosition(d.navigationState.position);
d.registerDisposer(d.layerSpecification.voxelCoordinatesSet.add(function(a){d.navigationState.position.setVoxelCoordinates(a)}));d.registerDisposer(d.layerSpecification.spatialCoordinatesSet.add(function(a){var b=d.navigationState.position;N.s.copy(b.spatialCoordinates,a);b.markSpatialCoordinatesChanged()}));v=d.registerCancellable(n()(function(){!d.wasDisposed&&0===d.layerManager.managedLayers.length&&d.resetStateWhenEmpty&&(d.navigationState.reset(),d.perspectiveNavigationState.pose.orientation.reset(),
d.perspectiveNavigationState.zoomFactor.reset(),d.resetInitiated.dispatch(),!A.b&&d.showLayerDialog&&d.visibility.visible&&new e.a(d.layerSpecification))}));d.layerManager.layersChanged.add(v);v();d.registerDisposer(d.dataContext.chunkQueueManager.visibleChunksChanged.add(function(){d.layerSelectedValues.handleLayerChange()}));d.registerDisposer(d.dataContext.chunkQueueManager.visibleChunksChanged.add(function(){d.visible&&b.scheduleRedraw()}));d.makeUI();d.updateShowBorders();c.add("layout",d.layout);
d.registerActionListeners();d.registerEventActionBindings();d.registerDisposer(Object(J.a)(y,d.navigationState.position));d.registerDisposer(new G.a(d.mouseState,d.layerManager,d.navigationState.voxelSize));return d}q(f,d);L(f,[{key:"makeUiControlVisibilityState",value:function(a){return this.registerDisposer(Object(E.g)(function(a,b){return a&&b},this.uiConfiguration.showUIControls,this.uiConfiguration[a]))}},{key:"updateShowBorders",value:function(){var a=this.element;this.uiConfiguration.showPanelBorders.value?
a.classList.add("neuroglancer-show-panel-borders"):a.classList.remove("neuroglancer-show-panel-borders")}},{key:"makeUI",value:function(){var a=this,e=this.element;e.classList.add("neuroglancer-viewer");e.classList.add("neuroglancer-noselect");e.style.display="flex";e.style.flexDirection="column";var d=document.createElement("div");d.title="Right click for settings";d.classList.add("neuroglancer-viewer-top-row");(this.contextMenu=this.registerDisposer(c(this))).registerParent(d);d.style.display="flex";
d.style.flexDirection="row";d.style.alignItems="stretch";var g=this.registerDisposer(new I.c(document.createElement("div"),this.navigationState.voxelSize));this.registerDisposer(new z.a(this.uiControlVisibility.showLocation,g.element));d.appendChild(g.element);g=this.registerDisposer(new I.b(this.navigationState.position));this.registerDisposer(new z.a(this.uiControlVisibility.showLocation,g.element));d.appendChild(g.element);g=this.registerDisposer(new I.a(document.createElement("div"),this.mouseState,
this.navigationState.voxelSize));g.element.style.flex="1";g.element.style.alignSelf="center";this.registerDisposer(new z.a(this.uiControlVisibility.showLocation,g.element));d.appendChild(g.element);g=this.registerDisposer(new W.a(this.selectedLayer));d.appendChild(g.element);this.registerDisposer(new z.a(this.uiControlVisibility.showAnnotationToolStatus,g.element));g=Object(T.a)("{}","Edit JSON state");this.registerEventListener(g,"click",function(){a.editJsonState()});this.registerDisposer(new z.a(this.uiControlVisibility.showEditStateButton,
g));d.appendChild(g);g=Object(T.a)("?","Help");this.registerEventListener(g,"click",function(){a.showHelpDialog()});this.registerDisposer(new z.a(this.uiControlVisibility.showHelpButton,g));d.appendChild(g);this.registerDisposer(new z.a(Object(E.g)(function(a){for(var b=[],e=0;e<arguments.length;++e)b[e-0]=arguments[e];return b.reduce(function(a,b){return a||b},!1)},this.uiControlVisibility.showHelpButton,this.uiControlVisibility.showEditStateButton,this.uiControlVisibility.showLocation,this.uiControlVisibility.showAnnotationToolStatus),
d));e.appendChild(d);d=document.createElement("div");d.style.display="flex";d.style.flex="1";d.style.flexDirection="row";this.layout=this.registerDisposer(new b.a(this,"4panel"));d.appendChild(this.layout.element);d.appendChild(this.registerDisposer(new D.a(this.selectedLayer.addRef())).element);this.registerDisposer(this.selectedLayer.changed.add(function(){return a.display.onResize()}));e.appendChild(d);this.display.onResize();d=function(){var b=a.visibility.visible;b!==a.visible&&(e.style.visibility=
b?"inherit":"hidden",a.visible=b)};d();this.registerDisposer(this.visibility.changed.add(d))}},{key:"registerEventActionBindings",value:function(){var a=this.element;this.registerDisposer(new R.b(a,this.inputEventMap));this.registerDisposer(new B.a(a))}},{key:"bindAction",value:function(a,b){this.registerDisposer(Object(H.c)(this.element,a,b))}},{key:"registerActionListeners",value:function(){for(var a=this,b={},e=$jscomp.makeIterator(["recolor","clear-segments"]),c=e.next();!c.done;b={action:b.action},
c=e.next())b.action=c.value,this.bindAction(b.action,function(b){return function(){a.layerManager.invokeAction(b.action)}}(b));b={};e=$jscomp.makeIterator(["select"]);for(c=e.next();!c.done;b={action$307:b.action$307},c=e.next())b.action$307=c.value,this.bindAction(b.action$307,function(b){return function(){a.mouseState.updateUnconditionally();a.layerManager.invokeAction(b.action$307)}}(b));this.bindAction("help",function(){return a.showHelpDialog()});for(c={i:1};9>=c.i;c={i:c.i},++c.i)this.bindAction("toggle-layer-"+
c.i,function(b){return function(){var e=b.i-1,c=a.layerManager.managedLayers;e<c.length&&(e=c[e],e.setVisible(!e.visible))}}(c)),this.bindAction("select-layer-"+c.i,function(b){return function(){var e=b.i-1,c=a.layerManager.managedLayers;e<c.length&&(a.selectedLayer.layer=c[e],a.selectedLayer.visible=!0)}}(c));this.bindAction("annotate",function(){var b=a.selectedLayer.layer;if(void 0===b)y.a.showTemporaryMessage("The annotate command requires a layer to be selected.");else{var e=b.layer;null===e||
void 0===e.tool.value?y.a.showTemporaryMessage("The selected layer ("+JSON.stringify(b.name)+") does not have an active annotation tool."):e.tool.value.trigger(a.mouseState)}});this.bindAction("toggle-axis-lines",function(){return a.showAxisLines.toggle()});this.bindAction("toggle-scale-bar",function(){return a.showScaleBar.toggle()});this.bindAction("toggle-default-annotations",function(){return a.showDefaultAnnotations.toggle()});this.bindAction("toggle-show-slices",function(){return a.showPerspectiveSliceViews.toggle()})}},
{key:"showHelpDialog",value:function(){var a=this.inputEventBindings;new k.a([["Global",a.global],["Slice View",a.sliceView],["Perspective View",a.perspectiveView]])}},{key:"editJsonState",value:function(){new C.a(this)}},{key:"onUpdateDisplay",value:function(){this.visible&&(this.dataContext.chunkQueueManager.chunkUpdateDeadline=null)}},{key:"onUpdateDisplayFinished",value:function(){this.visible&&this.mouseState.updateIfStale()}},{key:"handleNavigationStateChanged",value:function(){if(this.visible){var a=
this.dataContext.chunkQueueManager;null===a.chunkUpdateDeadline&&(a.chunkUpdateDeadline=Date.now()+10)}this.mouseState.stale=!0}},{key:"chunkManager",get:function(){return this.dataContext.chunkManager}},{key:"chunkQueueManager",get:function(){return this.dataContext.chunkQueueManager}},{key:"inputEventMap",get:function(){return this.inputEventBindings.global}},{key:"gl",get:function(){return this.display.gl}}]);return f}(f.a)},function(m,f,d){function u(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 p(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 q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function a(a,b){b=void 0===b?a.navigationState:
new A.e(new A.g(a.navigationState.pose.position,A.f.makeRelative(a.navigationState.pose.orientation,b)),a.navigationState.zoomFactor);return new z.a(a.chunkManager,a.layerManager,b)}function c(b){return new Map([["xy",a(b,R.get("xy"))],["xz",a(b,R.get("xz"))],["yz",a(b,R.get("yz"))]])}function n(a){return{crossSectionBackgroundColor:a.crossSectionBackgroundColor,mouseState:a.mouseState,layerManager:a.layerManager,showAxisLines:a.showAxisLines,visibleLayerRoles:a.visibleLayerRoles,selectedLayer:a.selectedLayer,
visibility:a.visibility}}function v(a){var b=a.viewer;return Object.assign({},n(b),{navigationState:b.perspectiveNavigationState,inputEventMap:b.inputEventBindings.perspectiveView,orthographicProjection:a.specification.orthographicProjection,showScaleBar:b.showScaleBar,rpc:b.chunkManager.rpc})}function t(a){return Object.assign({},n(a),{navigationState:a.navigationState,inputEventMap:a.inputEventBindings.sliceView})}function l(a,b,e){for(var c={},d=0;2>d;c={relatedLayout:c.relatedLayout},++d)c.relatedLayout=
e[Math.min(e.length-1,d)],a.registerDisposer(Object(J.c)(b.element,0===d?"toggle-layout":"toggle-layout-alternative",function(b){return function(e){a.container.name=b.relatedLayout;e.stopPropagation()}}(c)))}function k(a,b){var e=new z.a(a.chunkManager,a.layerManager,b.navigationState.addRef());a=function(){e.setViewportSizeDebounced(b.width.value,b.height.value)};e.registerDisposer(b.width.changed.add(a));e.registerDisposer(b.height.changed.add(a));a();return e}function g(a,b,e){var c=new Map,d=
new Set;e=$jscomp.makeIterator(e.values());for(var g=e.next();!g.done;g=e.next())if(g=g.value,d.add(g),!c.has(g)){var h=k(a,g);b.sliceViews.set(h,!0);c.set(g,h)}a=$jscomp.makeIterator(c);for(c=a.next();!c.done;c=a.next())e=$jscomp.makeIterator(c.value),c=e.next().value,e=e.next().value,d.has(c)||b.sliceViews.delete(e)}function e(a){var b=aa.get(a);if(void 0===b)throw Error("Invalid layout name: "+JSON.stringify(a)+".");return b}function b(a){e(a);return a}d.d(f,"b",function(){return N});d.d(f,"a",
function(){return ia});m=d(5);var h=d.n(m),r=d(268),A=d(58),y=d(269),z=d(46),E=d(81),x=d(40),D=d(6);m=d(0);var G=d(10),J=d(20),C=d(1),B=d(2),F=d(3);f=d(152);var P=function(){function a(a,b){for(var e=0;e<b.length;e++){var c=b[e];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,e,c){e&&a(b.prototype,e);c&&a(b,c);return b}}(),H=function S(a,b,e){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,b);
if(void 0===c){if(a=Object.getPrototypeOf(a),null!==a)return S(a,b,e)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(e)}};d(72);var N=function Y(){q(this,Y);this.perspectiveView=new J.a;this.sliceView=new J.a},R=new Map([["xy",void 0],["xz",C.n.rotateX(C.n.create(),C.n.create(),Math.PI/2)],["yz",C.n.rotateY(C.n.create(),C.n.create(),Math.PI/2)]]),O=function(a){function b(a,e,d,h){q(this,b);var k=u(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));k.container=a;k.rootElement=
e;k.viewer=d;var f=c(d),n=d.display,p=Object.assign({},v(a),{showSliceViews:d.showPerspectiveSliceViews,showSliceViewsCheckbox:!0}),m=Object.assign({},t(d),{showScaleBar:d.showScaleBar}),A=Object.assign({},t(d),{showScaleBar:new x.b(!1,!1)}),z=function(a,b,e){b=k.registerDisposer(new E.a(n,b,f.get(a),e));l(k,b,[a,a+"-3d"]);return b};a=[r.b(1,r.a("column",[r.b(1,r.a("row",[r.b(1,function(a){z("xy",a,m)}),r.b(1,function(a){z("xz",a,A)})])),r.b(1,r.a("row",[r.b(1,function(a){a=k.registerDisposer(new y.a(n,
a,p));for(var b=$jscomp.makeIterator(f.values()),e=b.next();!e.done;e=b.next())a.sliceViews.set(e.value.addRef(),!1);g(d,a,h);l(k,a,["3d"])}),r.b(1,function(a){z("yz",a,A)})]))]))];r.a("row",a)(e);n.onResize();return k}p(b,a);P(b,[{key:"disposed",value:function(){Object(G.a)(this.rootElement);H(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}}]);return b}(m.a),Q=function(b){function e(b,c,d,h,k,f){q(this,e);var n=u(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));
n.container=b;n.rootElement=c;n.viewer=d;n.direction=h;var p=a(d,R.get(k)),m=d.display,A=Object.assign({},v(b),{showSliceViews:d.showPerspectiveSliceViews,showSliceViewsCheckbox:!0}),z=Object.assign({},t(d),{showScaleBar:d.showScaleBar});r.b(1,r.a(h,[r.b(1,function(a){a=n.registerDisposer(new E.a(m,a,p,z));l(n,a,[k,"4panel"])}),r.b(1,function(a){a=n.registerDisposer(new y.a(m,a,A));a.sliceViews.set(p.addRef(),!1);g(d,a,f);l(n,a,["3d","4panel"])})]))(c);m.onResize();return n}p(e,b);P(e,[{key:"disposed",
value:function(){Object(G.a)(this.rootElement);H(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"disposed",this).call(this)}}]);return e}(m.a),U=function(b){function e(b,c,d,g){q(this,e);var h=u(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));h.container=b;h.rootElement=c;h.viewer=d;var k=a(d,R.get(g)),f=Object.assign({},t(d),{showScaleBar:d.showScaleBar});r.a("row",[r.b(1,function(a){a=h.registerDisposer(new E.a(d.display,a,k,f));l(h,a,["4panel",g+"-3d"])})])(c);d.display.onResize();
return h}p(e,b);P(e,[{key:"disposed",value:function(){Object(G.a)(this.rootElement);H(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"disposed",this).call(this)}}]);return e}(m.a),W=function(a){function b(a,e,c,d){q(this,b);var h=u(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));h.container=a;h.rootElement=e;h.viewer=c;var k=Object.assign({},v(a),{showSliceViews:new x.b(!1,!1)});r.a("row",[r.b(1,function(a){a=h.registerDisposer(new y.a(c.display,a,k));g(c,a,d);l(h,a,["4panel"])})])(e);
c.display.onResize();return h}p(b,a);P(b,[{key:"disposed",value:function(){Object(G.a)(this.rootElement);H(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}}]);return b}(m.a),aa=new Map([["4panel",{factory:function(a,b,e,c){return new O(a,b,e,c)}}],["3d",{factory:function(a,b,e,c){return new W(a,b,e,c)}}]]);d={};C=$jscomp.makeIterator(R.keys());for(var I=C.next();!I.done;d={axes:d.axes},I=C.next())d.axes=I.value,aa.set(d.axes,{factory:function(a){return function(b,
e,c){return new U(b,e,c,a.axes)}}(d)}),aa.set(d.axes+"-3d",{factory:function(a){return function(b,e,c,d){return new Q(b,e,c,"row",a.axes,d)}}(d)});var T=function(a){function b(a){q(this,b);var e=u(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));e.width=new D.c(1E3,B.z);e.height=new D.c(1E3,B.z);e.changed=new F.a;e.position=new A.b(a.position.addRef());e.position.changed.add(e.changed.dispatch);e.orientation=new A.a(a.pose.orientation.addRef());e.orientation.changed.add(e.changed.dispatch);
e.width.changed.add(e.changed.dispatch);e.height.changed.add(e.changed.dispatch);e.zoom=new A.c(a.zoomFactor.addRef());e.zoom.changed.add(e.changed.dispatch);e.navigationState=e.registerDisposer(new A.e(new A.g(e.position.value,e.orientation.value),e.zoom.value));return e}p(b,a);P(b,[{key:"restoreState",value:function(a){var b=this;Object(B.t)(a);Object(B.v)(a,"width",function(a){return void 0!==a&&b.width.restoreState(a)});Object(B.v)(a,"height",function(a){return void 0!==a&&b.height.restoreState(a)});
Object(B.v)(a,"position",function(a){return void 0!==a&&b.position.restoreState(a)});Object(B.v)(a,"orientation",function(a){return void 0!==a&&b.orientation.restoreState(a)});Object(B.v)(a,"zoom",function(a){return void 0!==a&&b.zoom.restoreState(a)})}},{key:"reset",value:function(){this.width.reset();this.height.reset();this.position.reset();this.orientation.reset();this.zoom.reset()}},{key:"toJSON",value:function(){return{width:this.width,height:this.height,position:this.position,orientation:this.orientation,
zoom:this.zoom}}}]);return b}(m.a),da=function(a){function b(a){q(this,b);var e=u(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,function(a){return e.registerDisposer(e.registerDisposer(a).changed.add(e.changed.dispatch))},function(a){a.changed.remove(e.changed.dispatch);a.dispose()}));e.parentNavigationState=a;e.registerDisposer(a);return e}p(b,a);P(b,[{key:"restoreState",value:function(a){Object(B.t)(a);for(var b=$jscomp.makeIterator(Object.keys(a)),e=b.next();!e.done;e=b.next()){e=e.value;
var c=new T(this.parentNavigationState);try{this.set(e,c.addRef()),c.restoreState(a[e])}finally{c.dispose()}}}},{key:"reset",value:function(){this.clear()}},{key:"toJSON",value:function(){for(var a={},b=$jscomp.makeIterator(this),e=b.next();!e.done;e=b.next()){var c=$jscomp.makeIterator(e.value);e=c.next().value;c=c.next().value;a[e]=c}return a}}]);return b}(f.a),L=function(a){function e(a,c){q(this,e);var d=u(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));d.changed=new F.a;d.orthographicProjection=
new x.b(!1);d.type=new D.c(c,b);d.type.changed.add(d.changed.dispatch);d.crossSections=d.registerDisposer(new da(a));d.crossSections.changed.add(d.changed.dispatch);d.orthographicProjection.changed.add(d.changed.dispatch);d.registerDisposer(a);return d}p(e,a);P(e,[{key:"reset",value:function(){this.crossSections.clear();this.orthographicProjection.reset();this.type.reset()}},{key:"restoreState",value:function(a){var b=this;this.crossSections.clear();this.orthographicProjection.reset();"string"===
typeof a?this.type.restoreState(a):(Object(B.t)(a),Object(B.v)(a,"type",function(a){return b.type.restoreState(a)}),Object(B.v)(a,"orthographicProjection",function(a){return b.orthographicProjection.restoreState(a)}),Object(B.v)(a,"crossSections",function(a){return void 0!==a&&b.crossSections.restoreState(a)}))}},{key:"toJSON",value:function(){var a=this.type,b=this.crossSections,e=this.orthographicProjection.toJSON();return 0===b.size&&void 0===e?a.toJSON():{type:a.toJSON(),crossSections:b,orthographicProjection:e}}}]);
return e}(m.a),ia=function(a){function b(a,e){e=void 0===e?"xy":e;q(this,b);var c=u(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.viewer=a;c.element=document.createElement("div");c.specification=c.registerDisposer(new L(c.viewer.navigationState.addRef(),e));c.element.style.flex="1";var d=c.registerCancellable(h()(function(){return c.updateLayout()},0));c.specification.type.changed.add(d);Object(J.c)(c.element,"toggle-orthographic-projection",function(){return c.specification.orthographicProjection.toggle()});
c.registerDisposer(c.viewer.display.updateStarted.add(function(){return d.flush()}));d();return c}p(b,a);P(b,[{key:"toJSON",value:function(){return this.specification.toJSON()}},{key:"restoreState",value:function(a){this.specification.restoreState(a)}},{key:"reset",value:function(){this.specification.reset()}},{key:"disposeLayout",value:function(){var a=this.layout;void 0!==a&&(a.dispose(),this.layout=void 0)}},{key:"updateLayout",value:function(){this.disposeLayout();this.layout=e(this.name).factory(this,
this.element,this.viewer,this.specification.crossSections)}},{key:"disposed",value:function(){this.disposeLayout();H(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}},{key:"name",get:function(){return this.specification.type.value},set:function(a){this.specification.type.value=a}},{key:"changed",get:function(){return this.specification.changed}}]);return b}(m.a)},function(m,f,d){function u(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+
typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}d.d(f,"a",function(){return c});m=d(0);var p=d(3),q=function(){function a(a,c){for(var d=0;d<c.length;d++){var k=c[d];k.enumerable=k.enumerable||!1;k.configurable=!0;"value"in k&&(k.writable=!0);Object.defineProperty(a,k.key,k)}}return function(c,d,f){d&&a(c.prototype,d);f&&a(c,f);return c}}(),a=function v(a,c,d){null===
a&&(a=Function.prototype);var g=Object.getOwnPropertyDescriptor(a,c);if(void 0===g){if(a=Object.getPrototypeOf(a),null!==a)return v(a,c,d)}else{if("value"in g)return g.value;c=g.get;return void 0===c?void 0:c.call(d)}},c=function(c){function d(a,c,g){if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");var e=(d.__proto__||Object.getPrototypeOf(d)).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");e=!e||"object"!==
typeof e&&"function"!==typeof e?this:e;e.register=a;e.unregister=c;e.changed=new p.a;void 0===g?e.map=new Map:(e.map=new Map(g),e.map.forEach(e.register));return e}u(d,c);$jscomp.initSymbol();$jscomp.initSymbolIterator();q(d,[{key:"set",value:function(a,c){var d=this.map,e=d.get(a);void 0!==e&&this.unregister(e,a);d.set(a,c);this.register(c,a);this.changed.dispatch();return this}},{key:"delete",value:function(a){var c=this.map.get(a);return void 0!==c?(this.unregister(c,a),this.changed.dispatch(),
!0):!1}},{key:"has",value:function(a){return this.map.has(a)}},{key:Symbol.iterator,value:function(){$jscomp.initSymbol();$jscomp.initSymbolIterator();return this.map[Symbol.iterator]()}},{key:"clear",value:function(){var a=this.map;0<a.size&&(a.forEach(this.unregister),a.clear(),this.changed.dispatch())}},{key:"values",value:function(){return this.map.values()}},{key:"keys",value:function(){return this.map.keys()}},{key:"disposed",value:function(){this.map.forEach(this.unregister);this.map.clear();
a(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"disposed",this).call(this)}},{key:"size",get:function(){return this.map.size}}]);return d}(m.a)},function(m,f,d){function u(a,e){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==typeof e&&"function"!==typeof e?a:e}function p(a,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);a.prototype=Object.create(e&&
e.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});e&&(Object.setPrototypeOf?Object.setPrototypeOf(a,e):a.__proto__=e)}d.d(f,"a",function(){return k});var q=d(21);m=d(42);var a=d(19),c=d(34),n=d(154),v=d(274),t=d(279),l=function(){function a(a,b){for(var e=0;e<b.length;e++){var c=b[e];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(e,b,c){b&&a(e.prototype,b);c&&a(e,c);return e}}();d(280);var k=
function(d){function e(a,c){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var b=u(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));b.manager=a;b.existingLayer=c;b.statusElement=document.createElement("div");b.submitElement=document.createElement("button");b.namePromptElement=document.createElement("label");b.nameInputElement=document.createElement("input");b.volumeCancellationSource=void 0;b.sourceValid=!1;b.nameValid=!0;var d=b.content;d.classList.add("add-layer-overlay");
var g=document.createElement("form");g.className="source-form";b.registerEventListener(g,"submit",function(a){a.preventDefault();b.validateSource(!0)});var h=document.createElement("label");h.textContent="Source:";a=b.sourceInput=b.registerDisposer(new v.a({completer:function(a,e){return b.manager.dataSourceProvider.volumeCompleter(a,b.manager.chunkManager,e).then(function(a){return{completions:a.completions,makeElement:v.b,offset:a.offset,showSingleResult:!0}})},delay:0}));a.element.classList.add("add-layer-source");
a.inputElement.addEventListener("blur",function(){b.validateSource(!1)});b.submitElement.disabled=!0;a.inputChanged.add(function(){var a=b.volumeCancellationSource;void 0!==a&&(a.cancel(),b.volumeCancellationSource=void 0);b.sourceValid=!1;b.submitElement.disabled=!0;b.statusElement.textContent=""});g.appendChild(h);g.appendChild(a.element);Object(n.a)(h,a.inputElement);h=Object(t.a)();g.appendChild(h);d.appendChild(g);var k=b.statusElement,f=b.namePromptElement,l=b.nameInputElement;g=b.submitElement;
k.className="dialog-status";h=document.createElement("form");h.className="name-form";f.textContent="Name:";l.className="add-layer-name";l.autocomplete="off";l.spellcheck=!1;l.type="text";b.registerEventListener(l,"input",function(){b.validateName()});g.type="submit";Object(n.a)(f,l);h.appendChild(f);h.appendChild(l);h.appendChild(g);d.appendChild(h);d.appendChild(k);void 0!==c?(void 0!==c.sourceUrl?(a.value=c.sourceUrl,b.validateSource()):b.sourceValid=!0,a.disabled=!0,l.value=c.name,b.validateName(),
g.textContent="Save",l.focus()):(c=b.manager.layerManager.managedLayers,0<c.length&&(c=c[c.length-1],c instanceof q.b&&(c=c.sourceUrl,void 0!==c&&(d=b.manager.dataSourceProvider.findSourceGroup(c),a.value=c.substring(0,d),a.inputElement.setSelectionRange(0,d)))),a.inputElement.focus(),g.textContent="Add Layer");b.registerEventListener(h,"submit",function(a){a.preventDefault();b.submit()});return b}p(e,d);l(e,[{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.add(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){var e=this;b=void 0===b?!1:b;var d=this.sourceInput.value;if(""!==d){try{var g=this.manager.dataSourceProvider.suggestLayerName(d),k=this.nameInputElement;if(""===this.nameInputElement.value){var f=this.manager.layerManager.getUniqueLayerName(g);
k.value=f;k.setSelectionRange(0,f.length);this.validateName()}b&&k.focus()}catch(x){this.setError(x.message);return}this.setInfo("Validating volume source...");var n=this.volumeCancellationSource=new c.b;this.manager.dataSourceProvider.getVolume(this.manager.chunkManager,d,void 0,n).then(function(b){n.isCanceled||(e.volumeCancellationSource=void 0,e.sourceValid=!0,e.setInfo(a.c[b.volumeType].toLowerCase()+": "+(b.numChannels+"-channel "+a.a[b.dataType].toLowerCase())),e.validityChanged())}).catch(function(a){n.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 e}(m.a)},function(m,f,d){f.a=function(d,f){""===f.id&&(f.id="unique-id-for-association-"+u++);d.setAttribute("for",f.id)};var u=0},function(m,f,d){f.a=function(d){var f=
-1;return Object.assign(function(){-1===f&&(f=requestAnimationFrame(function(){f=-1;d()}))},{flush:function(){-1!==f&&(f=-1,d())},cancel:function(){-1!==f&&(cancelAnimationFrame(f),f=-1)}})}},function(m,f,d){f.a=function(d){if(!window.getSelection().isCollapsed)return!0;d=d.target.tagName;return"TEXTAREA"===d||"INPUT"===d?!0:!1};f.b=function(d,f){f=void 0===f?"text/plain":f;var a=!1,c=Object(u.c)(document,"copy",function(c){c.clipboardData.setData(f,d);a=!0;c.stopPropagation();c.preventDefault()},
!0);try{document.execCommand("copy")}finally{c()}return a};var u=d(0)},function(m,f,d){function u(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}function p(a,c){var d=document.documentElement.scrollTop+Math.min(document.documentElement.clientHeight-
a.offsetHeight,c.clientY);a.style.left=document.documentElement.scrollLeft+Math.min(document.documentElement.clientWidth-a.offsetWidth,c.clientX)+"px";a.style.top=d+"px";a.style.visibility=null}d.d(f,"a",function(){return v});var q=d(0),a=d(10),c=d(3),n=function(){function a(a,c){for(var d=0;d<c.length;d++){var e=c[d];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(c,d,g){d&&a(c.prototype,d);g&&a(c,g);return c}}();d(286);
var v=function(d){function f(a){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var 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.element=document.createElement("div");d.parentDisposers=new Map;d.disabledValue=!1;d.opened=new c.a;d.closed=new c.a;var e=d.element;e.className="neuroglancer-context-menu";e.style.visibility=
"hidden";e.tabIndex=-1;document.body.appendChild(e);void 0!==a&&d.registerParent(a);return d}u(f,d);n(f,[{key:"registerParent",value:function(a){var c=this,e=this.parentDisposers;e.has(a)||e.set(a,Object(q.c)(a,"contextmenu",function(a){c.show(a);a.stopPropagation();a.preventDefault()}))}},{key:"show",value:function(a){var c=this;if(!this.disabledValue){this.hide();var e=this.element,b=Object(q.c)(document,"mousedown",function(a){a.target instanceof Node&&!e.contains(a.target)&&c.hide()},!0),d=Object(q.c)(document,
"keydown",function(a){"Escape"===a.code&&c.hide()},!0);e.style.display=null;e.style.visibility="hidden";this.opened.dispatch();p(e,a);this.menuDisposer=function(){d();b();e.style.display="none"}}}},{key:"unregisterParent",value:function(a){var c=this.parentDisposers,e=c.get(a);void 0!==e&&(e(),c.delete(a))}},{key:"disposed",value:function(){for(var c=this.parentDisposers,d=$jscomp.makeIterator(c.values()),e=d.next();!e.done;e=d.next())e=e.value,e();c.clear();Object(a.b)(this.element)}},{key:"hide",
value:function(){void 0!==this.menuDisposer&&(this.menuDisposer(),this.menuDisposer=void 0,this.closed.dispatch())}},{key:"disabled",get:function(){return this.disabledValue},set:function(a){this.disabledValue!==a&&(this.disabledValue=a)&&this.hide()}},{key:"open",get:function(){return void 0!==this.menuDisposer}}]);return f}(q.a)},function(m,f,d){f.a=function(d,a){var c=Object(u.c)(d,"drop",function(c){c.preventDefault();if(-1!==c.dataTransfer.types.indexOf(p.d)){var d=JSON.parse(c.dataTransfer.getData(p.d));
a.restoreState(d);c.stopPropagation()}}),f=Object(u.c)(d,"dragover",function(a){-1!==a.dataTransfer.types.indexOf(p.d)&&(a.dataTransfer.dropEffect="link",a.preventDefault(),a.stopPropagation())});return function(){f();c()}};var u=d(0),p=d(97)},function(m,f,d){(function(d){function f(c,f,t,l){function k(a){var b=g(c,f);if(!b||b.to.line-b.from.line<e)return null;for(var d=c.findMarksAt(b.from),h=0;h<d.length;++h)if(d[h].__isFold&&"fold"!==l){if(!a)return null;b.cleared=!0;d[h].clear()}return b}if(t&&
t.call){var g=t;t=null}else g=a(c,t,"rangeFinder");"number"==typeof f&&(f=d.Pos(f,0));var e=a(c,t,"minFoldSize"),b=k(!0);if(a(c,t,"scanUp"))for(;!b&&f.line>c.firstLine();)f=d.Pos(f.line-1,0),b=k(!1);if(b&&!b.cleared&&"unfold"!==l){var h=q(c,t);d.on(h,"mousedown",function(a){n.clear();d.e_preventDefault(a)});var n=c.markText(b.from,b.to,{replacedWith:h,clearOnEnter:a(c,t,"clearOnEnter"),__isFold:!0});n.on("clear",function(a,b){d.signal(c,"unfold",c,a,b)});d.signal(c,"fold",c,b.from,b.to)}}function q(c,
d){c=a(c,d,"widget");"string"==typeof c?(d=document.createTextNode(c),c=document.createElement("span"),c.appendChild(d),c.className="CodeMirror-foldmarker"):c&&(c=c.cloneNode(!0));return c}function a(a,d,f){return d&&void 0!==d[f]?d[f]:(a=a.options.foldOptions)&&void 0!==a[f]?a[f]:c[f]}d.newFoldFunction=function(a,c){return function(d,n){f(d,n,{rangeFinder:a,widget:c})}};d.defineExtension("foldCode",function(a,c,d){f(this,a,c,d)});d.defineExtension("isFolded",function(a){a=this.findMarksAt(a);for(var c=
0;c<a.length;++c)if(a[c].__isFold)return!0});d.commands.toggleFold=function(a){a.foldCode(a.getCursor())};d.commands.fold=function(a){a.foldCode(a.getCursor(),null,"fold")};d.commands.unfold=function(a){a.foldCode(a.getCursor(),null,"unfold")};d.commands.foldAll=function(a){a.operation(function(){for(var c=a.firstLine(),f=a.lastLine();c<=f;c++)a.foldCode(d.Pos(c,0),null,"fold")})};d.commands.unfoldAll=function(a){a.operation(function(){for(var c=a.firstLine(),f=a.lastLine();c<=f;c++)a.foldCode(d.Pos(c,
0),null,"unfold")})};d.registerHelper("fold","combine",function(){var a=Array.prototype.slice.call(arguments,0);return function(c,d){for(var f=0;f<a.length;++f){var k=a[f](c,d);if(k)return k}}});d.registerHelper("fold","auto",function(a,c){for(var d=a.getHelpers(c,"fold"),f=0;f<d.length;f++){var k=d[f](a,c);if(k)return k}});var c={rangeFinder:d.fold.auto,widget:"\u2194",minFoldSize:0,scanUp:!1,clearOnEnter:!0};d.defineOption("foldOptions",null);d.defineExtension("foldOption",function(c,d){return a(this,
c,d)})})(d(43))},function(m,f,d){(function(f){function p(c){c=c||f.location||{};var e={},b=typeof c,d;if("blob:"===c.protocol)e=new a(unescape(c.pathname),{});else if("string"===b)for(d in e=new a(c,{}),k)delete e[d];else if("object"===b){for(d in c)d in k||(e[d]=c[d]);void 0===e.slashes&&(e.slashes=t.test(c.href))}return e}function q(a){a=v.exec(a);return{protocol:a[1]?a[1].toLowerCase():"",slashes:!!a[2],rest:a[3]}}function a(d,e,b){if(!(this instanceof a))return new a(d,e,b);var g=l.slice();var k=
typeof e;var f=0;"object"!==k&&"string"!==k&&(b=e,e=null);b&&"function"!==typeof b&&(b=n.parse);e=p(e);var t=q(d||"");k=!t.protocol&&!t.slashes;this.slashes=t.slashes||k&&e.slashes;this.protocol=t.protocol||e.protocol||"";d=t.rest;for(t.slashes||(g[2]=[/(.*)/,"pathname"]);f<g.length;f++){t=g[f];var v=t[0];var m=t[1];if(v!==v)this[m]=d;else if("string"===typeof v)~(v=d.indexOf(v))&&("number"===typeof t[2]?(this[m]=d.slice(0,v),d=d.slice(v+t[2])):(this[m]=d.slice(v),d=d.slice(0,v)));else if(v=v.exec(d))this[m]=
v[1],d=d.slice(0,v.index);this[m]=this[m]||(k&&t[3]?e[m]||"":"");t[4]&&(this[m]=this[m].toLowerCase())}b&&(this.query=b(this.query));if(k&&e.slashes&&"/"!==this.pathname.charAt(0)&&(""!==this.pathname||""!==e.pathname)){d=this.pathname;e=(e.pathname||"/").split("/").slice(0,-1).concat(d.split("/"));d=e.length;b=e[d-1];g=!1;for(f=0;d--;)"."===e[d]?e.splice(d,1):".."===e[d]?(e.splice(d,1),f++):f&&(0===d&&(g=!0),e.splice(d,1),f--);g&&e.unshift("");"."!==b&&".."!==b||e.push("");this.pathname=e.join("/")}c(this.port,
this.protocol)||(this.host=this.hostname,this.port="");this.username=this.password="";this.auth&&(t=this.auth.split(":"),this.username=t[0]||"",this.password=t[1]||"");this.origin=this.protocol&&this.host&&"file:"!==this.protocol?this.protocol+"//"+this.host:"null";this.href=this.toString()}var c=d(315),n=d(316),v=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,t=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,l=[["#","hash"],["?","query"],["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,
1],[NaN,"hostname",void 0,1,1]],k={hash:1,query:1};a.prototype={set:function(a,e,b){switch(a){case "query":"string"===typeof e&&e.length&&(e=(b||n.parse)(e));this[a]=e;break;case "port":this[a]=e;c(e,this.protocol)?e&&(this.host=this.hostname+":"+e):(this.host=this.hostname,this[a]="");break;case "hostname":this[a]=e;this.port&&(e+=":"+this.port);this.host=e;break;case "host":this[a]=e;/:\d+$/.test(e)?(e=e.split(":"),this.port=e.pop(),this.hostname=e.join(":")):(this.hostname=e,this.port="");break;
case "protocol":this.protocol=e.toLowerCase();this.slashes=!b;break;case "pathname":this.pathname=e.length&&"/"!==e.charAt(0)?"/"+e:e;break;default:this[a]=e}for(a=0;a<l.length;a++)e=l[a],e[4]&&(this[e[1]]=this[e[1]].toLowerCase());this.origin=this.protocol&&this.host&&"file:"!==this.protocol?this.protocol+"//"+this.host:"null";this.href=this.toString();return this},toString:function(a){a&&"function"===typeof a||(a=n.stringify);var e=this.protocol;e&&":"!==e.charAt(e.length-1)&&(e+=":");e+=this.slashes?
"//":"";this.username&&(e+=this.username,this.password&&(e+=":"+this.password),e+="@");e+=this.host+this.pathname;(a="object"===typeof this.query?a(this.query):this.query)&&(e+="?"!==a.charAt(0)?"?"+a:a);this.hash&&(e+=this.hash);return e}};a.extractProtocol=q;a.location=p;a.qs=n;m.exports=a}).call(f,d(7))},function(m,f,d){function u(){this._listeners={}}u.prototype.addEventListener=function(d,f){d in this._listeners||(this._listeners[d]=[]);var a=this._listeners[d];-1===a.indexOf(f)&&(a=a.concat([f]));
this._listeners[d]=a};u.prototype.removeEventListener=function(d,f){var a=this._listeners[d];a&&(f=a.indexOf(f),-1!==f&&(1<a.length?this._listeners[d]=a.slice(0,f).concat(a.slice(f+1)):delete this._listeners[d]))};u.prototype.dispatchEvent=function(){var d=arguments[0],f=d.type;d=1===arguments.length?[d]:Array.apply(null,arguments);this["on"+f]&&this["on"+f].apply(this,d);if(f in this._listeners){f=this._listeners[f];for(var a=0;a<f.length;a++)f[a].apply(this,d)}};m.exports=u},function(m,f,d){(function(f){function p(d,
f,k,g,e){f=a.addPath(d,f);v(f);var b=this;c.call(this,d,k);this.poll=new n(g,f,e);this.poll.on("message",function(a){v("poll message",a);b.emit("message",a)});this.poll.once("close",function(a,e){v("poll close",a,e);b.poll=null;b.emit("close",a,e);b.close()})}var q=d(4),a=d(22),c=d(321),n=d(322),v=function(){};"production"!==f.env.NODE_ENV&&(v=d(9)("sockjs-client:sender-receiver"));q(p,c);p.prototype.close=function(){c.prototype.close.call(this);v("close");this.removeAllListeners();this.poll&&(this.poll.abort(),
this.poll=null)};m.exports=p}).call(f,d(8))},function(m,f,d){(function(f,p){function q(c,e,b,d){l(c,e);var g=this;a.call(this);setTimeout(function(){g._start(c,e,b,d)},0)}var a=d(13).EventEmitter,c=d(4),n=d(38),v=d(22),t=f.XMLHttpRequest,l=function(){};"production"!==p.env.NODE_ENV&&(l=d(9)("sockjs-client:browser:xhr"));c(q,a);q.prototype._start=function(a,e,b,c){var d=this;try{this.xhr=new t}catch(y){}if(this.xhr){e=v.addQuery(e,"t="+ +new Date);this.unloadRef=n.unloadAdd(function(){l("unload cleanup");
d._cleanup(!0)});try{this.xhr.open(a,e,!0),this.timeout&&"timeout"in this.xhr&&(this.xhr.timeout=this.timeout,this.xhr.ontimeout=function(){l("xhr timeout");d.emit("finish",0,"");d._cleanup(!1)})}catch(y){l("exception",y);this.emit("finish",0,"");this._cleanup(!1);return}c&&c.noCredentials||!q.supportsCORS||(l("withCredentials"),this.xhr.withCredentials="true");if(c&&c.headers)for(var g in c.headers)this.xhr.setRequestHeader(g,c.headers[g]);this.xhr.onreadystatechange=function(){if(d.xhr){var a=d.xhr;
l("readyState",a.readyState);switch(a.readyState){case 3:try{var b=a.status;var e=a.responseText}catch(x){}l("status",b);1223===b&&(b=204);200===b&&e&&0<e.length&&(l("chunk"),d.emit("chunk",b,e));break;case 4:b=a.status;l("status",b);1223===b&&(b=204);if(12005===b||12029===b)b=0;l("finish",b,a.responseText);d.emit("finish",b,a.responseText);d._cleanup(!1)}}};try{d.xhr.send(b)}catch(y){d.emit("finish",0,""),d._cleanup(!1)}}else l("no xhr"),this.emit("finish",0,"no xhr support"),this._cleanup()};q.prototype._cleanup=
function(a){l("cleanup");if(this.xhr){this.removeAllListeners();n.unloadDel(this.unloadRef);this.xhr.onreadystatechange=function(){};this.xhr.ontimeout&&(this.xhr.ontimeout=null);if(a)try{this.xhr.abort()}catch(e){}this.unloadRef=this.xhr=null}};q.prototype.close=function(){l("close");this._cleanup(!0)};q.enabled=!!t;var k=["Active"].concat("Object").join("X");!q.enabled&&k in f&&(l("overriding xmlhttprequest"),t=function(){try{return new f[k]("Microsoft.XMLHTTP")}catch(g){return null}},q.enabled=
!!new t);p=!1;try{p="withCredentials"in new t}catch(g){}q.supportsCORS=p;m.exports=q}).call(f,d(7),d(8))},function(m,f,d){function u(c){if(!a.enabled)throw Error("Transport created when disabled");p.call(this,c,"/xhr_streaming",q,a)}f=d(4);var p=d(51),q=d(73),a=d(98);f(u,p);u.enabled=function(c){return c.cookie_needed||c.nullOrigin?!1:a.enabled&&c.sameScheme};u.transportName="xdr-streaming";u.roundTrips=2;m.exports=u},function(m,f,d){function u(c){if(!u.enabled())throw Error("Transport created when disabled");
p.call(this,c,"/eventsource",q,a)}f=d(4);var p=d(51),q=d(323),a=d(74),c=d(166);f(u,p);u.enabled=function(){return!!c};u.transportName="eventsource";u.roundTrips=2;m.exports=u},function(m,f,d){f=d(7);m.exports=f.EventSource},function(m,f,d){(function(f){function p(a,b,d){if(!p.enabled())throw Error("Transport created when disabled");c.call(this);var e=this;this.origin=v.getOrigin(d);this.baseUrl=d;this.transUrl=b;this.transport=a;this.windowId=k.string(8);d=v.addPath(d,"/iframe.html")+"#"+this.windowId;
g(a,b,d);this.iframeObj=t.createIframe(d,function(a){g("err callback");e.emit("close",1006,"Unable to load an iframe ("+a+")");e.close()});this.onmessageCallback=this._message.bind(this);l.attachEvent("message",this.onmessageCallback)}var q=d(4),a=d(33),c=d(13).EventEmitter,n=d(168),v=d(22),t=d(61),l=d(38),k=d(50),g=function(){};"production"!==f.env.NODE_ENV&&(g=d(9)("sockjs-client:transport:iframe"));q(p,c);p.prototype.close=function(){g("close");this.removeAllListeners();if(this.iframeObj){l.detachEvent("message",
this.onmessageCallback);try{this.postMessage("c")}catch(e){}this.iframeObj.cleanup();this.onmessageCallback=this.iframeObj=this.iframeObj=null}};p.prototype._message=function(e){g("message",e.data);if(v.isOriginEqual(e.origin,this.origin)){try{var b=a.parse(e.data)}catch(r){g("bad json",e.data);return}if(b.windowId!==this.windowId)g("mismatched window id",b.windowId,this.windowId);else switch(b.type){case "s":this.iframeObj.loaded();this.postMessage("s",a.stringify([n,this.transport,this.transUrl,
this.baseUrl]));break;case "t":this.emit("message",b.data);break;case "c":try{var c=a.parse(b.data)}catch(r){g("bad json",b.data);break}this.emit("close",c[0],c[1]);this.close()}}else g("not same origin",e.origin,this.origin)};p.prototype.postMessage=function(e,b){g("postMessage",e,b);this.iframeObj.post(a.stringify({windowId:this.windowId,type:e,data:b||""}),this.origin)};p.prototype.send=function(a){g("send",a);this.postMessage("m",a)};p.enabled=function(){return t.iframeEnabled};p.transportName=
"iframe";p.roundTrips=2;m.exports=p}).call(f,d(8))},function(m,f){m.exports="1.1.4"},function(m,f,d){function u(c){if(!p.enabled)throw Error("Transport created when disabled");a.call(this,c,"/htmlfile",p,q)}f=d(4);var p=d(326),q=d(59),a=d(51);f(u,a);u.enabled=function(a){return p.enabled&&a.sameOrigin};u.transportName="htmlfile";u.roundTrips=2;m.exports=u},function(m,f,d){function u(d){if(!c.enabled&&!a.enabled)throw Error("Transport created when disabled");p.call(this,d,"/xhr",q,a)}f=d(4);var p=
d(51),q=d(73),a=d(74),c=d(59);f(u,p);u.enabled=function(d){return d.nullOrigin?!1:c.enabled&&d.sameOrigin?!0:a.enabled};u.transportName="xhr-polling";u.roundTrips=2;m.exports=u},function(m,f,d){f=d(7);m.exports=f.location||{origin:"http://localhost:80",protocol:"http",host:"localhost",port:80,href:"http://localhost/",hash:""}},function(m,f,d){function u(d){var f=this;p.call(this);this.ir=new c(d,a);this.ir.once("finish",function(a,c){f.ir=null;f.emit("message",q.stringify([a,c]))})}f=d(4);var p=d(13).EventEmitter,
q=d(33),a=d(59),c=d(173);f(u,p);u.transportName="iframe-info-receiver";u.prototype.close=function(){this.ir&&(this.ir.close(),this.ir=null);this.removeAllListeners()};m.exports=u},function(m,f,d){(function(f){function p(a,d){q.call(this);var k=this,g=+new Date;this.xo=new d("GET",a);this.xo.once("finish",function(a,b){if(200===a){var e=+new Date-g;if(b)try{var d=c.parse(b)}catch(A){v("bad json",b)}n.isObject(d)||(d={})}k.emit("finish",d,e);k.removeAllListeners()})}var q=d(13).EventEmitter,a=d(4),
c=d(33),n=d(100),v=function(){};"production"!==f.env.NODE_ENV&&(v=d(9)("sockjs-client:info-ajax"));a(p,q);p.prototype.close=function(){this.removeAllListeners();this.xo.close()};m.exports=p}).call(f,d(8))},function(m,f,d){function u(a,c){if(!(a instanceof c))throw new TypeError("Cannot call a class as a function");}function p(a,c){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!c||"object"!==typeof c&&"function"!==typeof c?a:c}function q(a,c){if("function"!==
typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}d.d(f,"a",function(){return t});d.d(f,"b",function(){return l});m=d(28);d=d(0);var a=function g(a,b,c){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,b);if(void 0===e){if(a=Object.getPrototypeOf(a),
null!==a)return g(a,b,c)}else{if("value"in e)return e.value;b=e.get;return void 0===b?void 0:b.call(c)}},c=function(){function a(a,b){for(var e=0;e<b.length;e++){var c=b[e];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(e,b,c){b&&a(e.prototype,b);c&&a(e,c);return e}}();$jscomp.initSymbol();var n=Symbol("SingleTextureVolumeChunk.textureUnit");$jscomp.initSymbol();var v=Symbol("SingleTextureVolumeChunk.textureLayout"),t=
function(a){function e(a){u(this,e);var b=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));b.shaderKey=a;return b}q(e,a);c(e,[{key:"defineShader",value:function(a){a.addTextureSampler2D("uVolumeChunkSampler",n)}},{key:"beginDrawing",value:function(a,e){var b=e.textureUnit(n);a.activeTexture(a.TEXTURE0+b);e[v]=null}},{key:"endDrawing",value:function(a,e){a.bindTexture(a.TEXTURE_2D,null);e[v]=null}},{key:"bindChunk",value:function(a,e,c){var b=c.textureLayout;e[v]!==b&&(e[v]=b,this.setupTextureLayout(a,
e,b));a.bindTexture(a.TEXTURE_2D,c.texture)}},{key:"beginSource",value:function(a,e){}}]);return e}(d.a),l=function(d){function e(a,c){u(this,e);a=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,a,c));a.texture=null;a.data=c.data;return a}q(e,d);c(e,[{key:"copyToGPU",value:function(b){a(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"copyToGPU",this).call(this,b);var c=this.texture=b.createTexture();b.bindTexture(b.TEXTURE_2D,c);this.setTextureData(b);b.bindTexture(b.TEXTURE_2D,
null)}},{key:"freeGPUMemory",value:function(b){a(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"freeGPUMemory",this).call(this,b);b.deleteTexture(this.texture);this.texture=null;this.textureLayout.dispose();this.textureLayout=null}}]);return e}(m.a)},function(m,f,d){f.a=function(d,f,q,a,c,n){for(var p=0,t=0,l=1,k=1,g=0;3>g;++g){var e=c[g],b=a[g],h=e%b;p+=Math.floor(e/b)*l;l*=Math.ceil(q[g]/b);t+=h*k;k*=b}a=f+2*p;q=d[a];a=d[a+1];c=q&16777215;q=q>>24&255;0<q&&(c+=n*(d[(f+a&16777215)+Math.floor(t*
q/32)]>>t*q%32&(1<<q)-1));return c}},function(m,f,d){d(102);d(217);d(85);d(218);d(125);d(220);d(126);d(222);d(129);d(223);d(130);d(225);d(131);d(227);d(228);d(229);d(132);d(231);d(244);d(147);d(255);d(259);m.exports=d(263)},function(m,f,d){d(30)},function(m,f,d){d(30)},function(m,f,d){function u(a,c,d){var f=c[0],n=c[1],l=c[2],k=c[3],g=c[4],e=c[5],b=c[6],h=c[7],r=c[8],p=c[9],q=c[10],m=c[11],u=c[12],x=c[13],D=c[14];c=c[15];var G=d[0],J=d[1],C=d[2],B=d[3];a[0]=G*f+J*g+C*r+B*u;a[1]=G*n+J*e+C*p+B*x;a[2]=
G*l+J*b+C*q+B*D;a[3]=G*k+J*h+C*m+B*c;G=d[4];J=d[5];C=d[6];B=d[7];a[4]=G*f+J*g+C*r+B*u;a[5]=G*n+J*e+C*p+B*x;a[6]=G*l+J*b+C*q+B*D;a[7]=G*k+J*h+C*m+B*c;G=d[8];J=d[9];C=d[10];B=d[11];a[8]=G*f+J*g+C*r+B*u;a[9]=G*n+J*e+C*p+B*x;a[10]=G*l+J*b+C*q+B*D;a[11]=G*k+J*h+C*m+B*c;G=d[12];J=d[13];C=d[14];B=d[15];a[12]=G*f+J*g+C*r+B*u;a[13]=G*n+J*e+C*p+B*x;a[14]=G*l+J*b+C*q+B*D;a[15]=G*k+J*h+C*m+B*c;return a}function p(a,c,d){a[0]=c[0]-d[0];a[1]=c[1]-d[1];a[2]=c[2]-d[2];a[3]=c[3]-d[3];a[4]=c[4]-d[4];a[5]=c[5]-d[5];
a[6]=c[6]-d[6];a[7]=c[7]-d[7];a[8]=c[8]-d[8];a[9]=c[9]-d[9];a[10]=c[10]-d[10];a[11]=c[11]-d[11];a[12]=c[12]-d[12];a[13]=c[13]-d[13];a[14]=c[14]-d[14];a[15]=c[15]-d[15];return a}Object.defineProperty(f,"__esModule",{value:!0});f.create=function(){var a=new q.a(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};f.clone=function(a){var c=new q.a(16);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];c[9]=a[9];c[10]=a[10];c[11]=a[11];c[12]=a[12];c[13]=a[13];c[14]=a[14];c[15]=a[15];return c};f.copy=function(a,c){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];a[9]=c[9];a[10]=c[10];a[11]=c[11];a[12]=c[12];a[13]=c[13];a[14]=c[14];a[15]=c[15];return a};f.fromValues=function(a,c,d,f,t,l,k,g,e,b,h,r,p,m,u,E){var n=new q.a(16);n[0]=a;n[1]=c;n[2]=d;n[3]=f;n[4]=t;n[5]=l;n[6]=k;n[7]=g;n[8]=e;n[9]=b;n[10]=h;n[11]=r;n[12]=p;n[13]=m;n[14]=u;n[15]=E;
return n};f.set=function(a,c,d,f,t,l,k,g,e,b,h,r,p,q,m,u,x){a[0]=c;a[1]=d;a[2]=f;a[3]=t;a[4]=l;a[5]=k;a[6]=g;a[7]=e;a[8]=b;a[9]=h;a[10]=r;a[11]=p;a[12]=q;a[13]=m;a[14]=u;a[15]=x;return a};f.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};f.transpose=function(a,c){if(a===c){var d=c[1],f=c[2],t=c[3],l=c[6],k=c[7],g=c[11];a[1]=c[4];a[2]=c[8];a[3]=c[12];a[4]=d;a[6]=c[9];a[7]=c[13];a[8]=f;a[9]=l;a[11]=
c[14];a[12]=t;a[13]=k;a[14]=g}else a[0]=c[0],a[1]=c[4],a[2]=c[8],a[3]=c[12],a[4]=c[1],a[5]=c[5],a[6]=c[9],a[7]=c[13],a[8]=c[2],a[9]=c[6],a[10]=c[10],a[11]=c[14],a[12]=c[3],a[13]=c[7],a[14]=c[11],a[15]=c[15];return a};f.invert=function(a,c){var d=c[0],f=c[1],t=c[2],l=c[3],k=c[4],g=c[5],e=c[6],b=c[7],h=c[8],r=c[9],p=c[10],q=c[11],m=c[12],u=c[13],x=c[14];c=c[15];var D=d*g-f*k,G=d*e-t*k,J=d*b-l*k,C=f*e-t*g,B=f*b-l*g,F=t*b-l*e,P=h*u-r*m,H=h*x-p*m,N=h*c-q*m,R=r*x-p*u,O=r*c-q*u,Q=p*c-q*x,U=D*Q-G*O+J*R+C*
N-B*H+F*P;if(!U)return null;U=1/U;a[0]=(g*Q-e*O+b*R)*U;a[1]=(t*O-f*Q-l*R)*U;a[2]=(u*F-x*B+c*C)*U;a[3]=(p*B-r*F-q*C)*U;a[4]=(e*N-k*Q-b*H)*U;a[5]=(d*Q-t*N+l*H)*U;a[6]=(x*J-m*F-c*G)*U;a[7]=(h*F-p*J+q*G)*U;a[8]=(k*O-g*N+b*P)*U;a[9]=(f*N-d*O-l*P)*U;a[10]=(m*B-u*J+c*D)*U;a[11]=(r*J-h*B-q*D)*U;a[12]=(g*H-k*R-e*P)*U;a[13]=(d*R-f*H+t*P)*U;a[14]=(u*G-m*C-x*D)*U;a[15]=(h*C-r*G+p*D)*U;return a};f.adjoint=function(a,c){var d=c[0],f=c[1],t=c[2],l=c[3],k=c[4],g=c[5],e=c[6],b=c[7],h=c[8],r=c[9],p=c[10],q=c[11],m=
c[12],u=c[13],x=c[14];c=c[15];a[0]=g*(p*c-q*x)-r*(e*c-b*x)+u*(e*q-b*p);a[1]=-(f*(p*c-q*x)-r*(t*c-l*x)+u*(t*q-l*p));a[2]=f*(e*c-b*x)-g*(t*c-l*x)+u*(t*b-l*e);a[3]=-(f*(e*q-b*p)-g*(t*q-l*p)+r*(t*b-l*e));a[4]=-(k*(p*c-q*x)-h*(e*c-b*x)+m*(e*q-b*p));a[5]=d*(p*c-q*x)-h*(t*c-l*x)+m*(t*q-l*p);a[6]=-(d*(e*c-b*x)-k*(t*c-l*x)+m*(t*b-l*e));a[7]=d*(e*q-b*p)-k*(t*q-l*p)+h*(t*b-l*e);a[8]=k*(r*c-q*u)-h*(g*c-b*u)+m*(g*q-b*r);a[9]=-(d*(r*c-q*u)-h*(f*c-l*u)+m*(f*q-l*r));a[10]=d*(g*c-b*u)-k*(f*c-l*u)+m*(f*b-l*g);a[11]=
-(d*(g*q-b*r)-k*(f*q-l*r)+h*(f*b-l*g));a[12]=-(k*(r*x-p*u)-h*(g*x-e*u)+m*(g*p-e*r));a[13]=d*(r*x-p*u)-h*(f*x-t*u)+m*(f*p-t*r);a[14]=-(d*(g*x-e*u)-k*(f*x-t*u)+m*(f*e-t*g));a[15]=d*(g*p-e*r)-k*(f*p-t*r)+h*(f*e-t*g);return a};f.determinant=function(a){var c=a[0],d=a[1],f=a[2],t=a[3],l=a[4],k=a[5],g=a[6],e=a[7],b=a[8],h=a[9],r=a[10],p=a[11],q=a[12],m=a[13],u=a[14];a=a[15];return(c*k-d*l)*(r*a-p*u)-(c*g-f*l)*(h*a-p*m)+(c*e-t*l)*(h*u-r*m)+(d*g-f*k)*(b*a-p*q)-(d*e-t*k)*(b*u-r*q)+(f*e-t*g)*(b*m-h*q)};f.multiply=
u;f.translate=function(a,c,d){var f=d[0],n=d[1];d=d[2];if(c===a)a[12]=c[0]*f+c[4]*n+c[8]*d+c[12],a[13]=c[1]*f+c[5]*n+c[9]*d+c[13],a[14]=c[2]*f+c[6]*n+c[10]*d+c[14],a[15]=c[3]*f+c[7]*n+c[11]*d+c[15];else{var l=c[0];var k=c[1];var g=c[2];var e=c[3];var b=c[4];var h=c[5];var r=c[6];var p=c[7];var q=c[8];var m=c[9];var u=c[10];var x=c[11];a[0]=l;a[1]=k;a[2]=g;a[3]=e;a[4]=b;a[5]=h;a[6]=r;a[7]=p;a[8]=q;a[9]=m;a[10]=u;a[11]=x;a[12]=l*f+b*n+q*d+c[12];a[13]=k*f+h*n+m*d+c[13];a[14]=g*f+r*n+u*d+c[14];a[15]=
e*f+p*n+x*d+c[15]}return a};f.scale=function(a,c,d){var f=d[0],n=d[1];d=d[2];a[0]=c[0]*f;a[1]=c[1]*f;a[2]=c[2]*f;a[3]=c[3]*f;a[4]=c[4]*n;a[5]=c[5]*n;a[6]=c[6]*n;a[7]=c[7]*n;a[8]=c[8]*d;a[9]=c[9]*d;a[10]=c[10]*d;a[11]=c[11]*d;a[12]=c[12];a[13]=c[13];a[14]=c[14];a[15]=c[15];return a};f.rotate=function(a,c,d,f){var n=f[0],l=f[1];f=f[2];var k=Math.sqrt(n*n+l*l+f*f);if(Math.abs(k)<q.b)return null;k=1/k;n*=k;l*=k;f*=k;var g=Math.sin(d);var e=Math.cos(d);var b=1-e;d=c[0];k=c[1];var h=c[2];var r=c[3];var p=
c[4];var v=c[5];var m=c[6];var u=c[7];var x=c[8];var D=c[9];var G=c[10];var J=c[11];var C=n*n*b+e;var B=l*n*b+f*g;var F=f*n*b-l*g;var P=n*l*b-f*g;var H=l*l*b+e;var N=f*l*b+n*g;var R=n*f*b+l*g;n=l*f*b-n*g;l=f*f*b+e;a[0]=d*C+p*B+x*F;a[1]=k*C+v*B+D*F;a[2]=h*C+m*B+G*F;a[3]=r*C+u*B+J*F;a[4]=d*P+p*H+x*N;a[5]=k*P+v*H+D*N;a[6]=h*P+m*H+G*N;a[7]=r*P+u*H+J*N;a[8]=d*R+p*n+x*l;a[9]=k*R+v*n+D*l;a[10]=h*R+m*n+G*l;a[11]=r*R+u*n+J*l;c!==a&&(a[12]=c[12],a[13]=c[13],a[14]=c[14],a[15]=c[15]);return a};f.rotateX=function(a,
c,d){var f=Math.sin(d);d=Math.cos(d);var n=c[4],l=c[5],k=c[6],g=c[7],e=c[8],b=c[9],h=c[10],r=c[11];c!==a&&(a[0]=c[0],a[1]=c[1],a[2]=c[2],a[3]=c[3],a[12]=c[12],a[13]=c[13],a[14]=c[14],a[15]=c[15]);a[4]=n*d+e*f;a[5]=l*d+b*f;a[6]=k*d+h*f;a[7]=g*d+r*f;a[8]=e*d-n*f;a[9]=b*d-l*f;a[10]=h*d-k*f;a[11]=r*d-g*f;return a};f.rotateY=function(a,c,d){var f=Math.sin(d);d=Math.cos(d);var n=c[0],l=c[1],k=c[2],g=c[3],e=c[8],b=c[9],h=c[10],r=c[11];c!==a&&(a[4]=c[4],a[5]=c[5],a[6]=c[6],a[7]=c[7],a[12]=c[12],a[13]=c[13],
a[14]=c[14],a[15]=c[15]);a[0]=n*d-e*f;a[1]=l*d-b*f;a[2]=k*d-h*f;a[3]=g*d-r*f;a[8]=n*f+e*d;a[9]=l*f+b*d;a[10]=k*f+h*d;a[11]=g*f+r*d;return a};f.rotateZ=function(a,c,d){var f=Math.sin(d);d=Math.cos(d);var n=c[0],l=c[1],k=c[2],g=c[3],e=c[4],b=c[5],h=c[6],r=c[7];c!==a&&(a[8]=c[8],a[9]=c[9],a[10]=c[10],a[11]=c[11],a[12]=c[12],a[13]=c[13],a[14]=c[14],a[15]=c[15]);a[0]=n*d+e*f;a[1]=l*d+b*f;a[2]=k*d+h*f;a[3]=g*d+r*f;a[4]=e*d-n*f;a[5]=b*d-l*f;a[6]=h*d-k*f;a[7]=r*d-g*f;return a};f.fromTranslation=function(a,
c){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]=c[0];a[13]=c[1];a[14]=c[2];a[15]=1;return a};f.fromScaling=function(a,c){a[0]=c[0];a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=c[1];a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=c[2];a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};f.fromRotation=function(a,c,d){var f=d[0],n=d[1];d=d[2];var l=Math.sqrt(f*f+n*n+d*d);if(Math.abs(l)<q.b)return null;l=1/l;f*=l;n*=l;d*=l;l=Math.sin(c);c=Math.cos(c);var k=1-c;a[0]=f*f*k+c;a[1]=n*f*
k+d*l;a[2]=d*f*k-n*l;a[3]=0;a[4]=f*n*k-d*l;a[5]=n*n*k+c;a[6]=d*n*k+f*l;a[7]=0;a[8]=f*d*k+n*l;a[9]=n*d*k-f*l;a[10]=d*d*k+c;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};f.fromXRotation=function(a,c){var d=Math.sin(c);c=Math.cos(c);a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=c;a[6]=d;a[7]=0;a[8]=0;a[9]=-d;a[10]=c;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};f.fromYRotation=function(a,c){var d=Math.sin(c);c=Math.cos(c);a[0]=c;a[1]=0;a[2]=-d;a[3]=0;a[4]=0;a[5]=1;a[6]=0;a[7]=0;a[8]=d;a[9]=0;a[10]=
c;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};f.fromZRotation=function(a,c){var d=Math.sin(c);c=Math.cos(c);a[0]=c;a[1]=d;a[2]=0;a[3]=0;a[4]=-d;a[5]=c;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};f.fromRotationTranslation=function(a,c,d){var f=c[0],n=c[1],l=c[2],k=c[3],g=f+f,e=n+n,b=l+l;c=f*g;var h=f*e;f*=b;var r=n*e;n*=b;l*=b;g*=k;e*=k;k*=b;a[0]=1-(r+l);a[1]=h+k;a[2]=f-e;a[3]=0;a[4]=h-k;a[5]=1-(c+l);a[6]=n+g;a[7]=0;a[8]=f+e;a[9]=n-g;a[10]=1-(c+r);a[11]=
0;a[12]=d[0];a[13]=d[1];a[14]=d[2];a[15]=1;return a};f.getTranslation=function(a,c){a[0]=c[12];a[1]=c[13];a[2]=c[14];return a};f.getScaling=function(a,c){var d=c[0],f=c[1],t=c[2],l=c[4],k=c[5],g=c[6],e=c[8],b=c[9];c=c[10];a[0]=Math.sqrt(d*d+f*f+t*t);a[1]=Math.sqrt(l*l+k*k+g*g);a[2]=Math.sqrt(e*e+b*b+c*c);return a};f.getRotation=function(a,c){var d=c[0]+c[5]+c[10];0<d?(d=2*Math.sqrt(d+1),a[3]=.25*d,a[0]=(c[6]-c[9])/d,a[1]=(c[8]-c[2])/d,a[2]=(c[1]-c[4])/d):c[0]>c[5]&c[0]>c[10]?(d=2*Math.sqrt(1+c[0]-
c[5]-c[10]),a[3]=(c[6]-c[9])/d,a[0]=.25*d,a[1]=(c[1]+c[4])/d,a[2]=(c[8]+c[2])/d):c[5]>c[10]?(d=2*Math.sqrt(1+c[5]-c[0]-c[10]),a[3]=(c[8]-c[2])/d,a[0]=(c[1]+c[4])/d,a[1]=.25*d,a[2]=(c[6]+c[9])/d):(d=2*Math.sqrt(1+c[10]-c[0]-c[5]),a[3]=(c[1]-c[4])/d,a[0]=(c[8]+c[2])/d,a[1]=(c[6]+c[9])/d,a[2]=.25*d);return a};f.fromRotationTranslationScale=function(a,c,d,f){var n=c[0],l=c[1],k=c[2],g=c[3],e=n+n,b=l+l,h=k+k;c=n*e;var r=n*b;n*=h;var p=l*b;l*=h;k*=h;e*=g;b*=g;g*=h;h=f[0];var q=f[1];f=f[2];a[0]=(1-(p+k))*
h;a[1]=(r+g)*h;a[2]=(n-b)*h;a[3]=0;a[4]=(r-g)*q;a[5]=(1-(c+k))*q;a[6]=(l+e)*q;a[7]=0;a[8]=(n+b)*f;a[9]=(l-e)*f;a[10]=(1-(c+p))*f;a[11]=0;a[12]=d[0];a[13]=d[1];a[14]=d[2];a[15]=1;return a};f.fromRotationTranslationScaleOrigin=function(a,c,d,f,t){var l=c[0],k=c[1],g=c[2],e=c[3],b=l+l,h=k+k,r=g+g;c=l*b;var n=l*h;l*=r;var p=k*h;k*=r;g*=r;b*=e;h*=e;e*=r;r=f[0];var q=f[1];f=f[2];var m=t[0],v=t[1];t=t[2];a[0]=(1-(p+g))*r;a[1]=(n+e)*r;a[2]=(l-h)*r;a[3]=0;a[4]=(n-e)*q;a[5]=(1-(c+g))*q;a[6]=(k+b)*q;a[7]=0;
a[8]=(l+h)*f;a[9]=(k-b)*f;a[10]=(1-(c+p))*f;a[11]=0;a[12]=d[0]+m-(a[0]*m+a[4]*v+a[8]*t);a[13]=d[1]+v-(a[1]*m+a[5]*v+a[9]*t);a[14]=d[2]+t-(a[2]*m+a[6]*v+a[10]*t);a[15]=1;return a};f.fromQuat=function(a,c){var d=c[0],f=c[1],t=c[2];c=c[3];var l=d+d,k=f+f,g=t+t;d*=l;var e=f*l;f*=k;var b=t*l,h=t*k;t*=g;l*=c;k*=c;c*=g;a[0]=1-f-t;a[1]=e+c;a[2]=b-k;a[3]=0;a[4]=e-c;a[5]=1-d-t;a[6]=h+l;a[7]=0;a[8]=b+k;a[9]=h-l;a[10]=1-d-f;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};f.frustum=function(a,c,d,f,t,l,k){var g=
1/(d-c),e=1/(t-f),b=1/(l-k);a[0]=2*l*g;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=2*l*e;a[6]=0;a[7]=0;a[8]=(d+c)*g;a[9]=(t+f)*e;a[10]=(k+l)*b;a[11]=-1;a[12]=0;a[13]=0;a[14]=k*l*2*b;a[15]=0;return a};f.perspective=function(a,c,d,f,t){c=1/Math.tan(c/2);var l=1/(f-t);a[0]=c/d;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=c;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=(t+f)*l;a[11]=-1;a[12]=0;a[13]=0;a[14]=2*t*f*l;a[15]=0;return a};f.perspectiveFromFieldOfView=function(a,c,d,f){var n=Math.tan(c.upDegrees*Math.PI/180),l=Math.tan(c.downDegrees*
Math.PI/180),k=Math.tan(c.leftDegrees*Math.PI/180);c=Math.tan(c.rightDegrees*Math.PI/180);var g=2/(k+c),e=2/(n+l);a[0]=g;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=e;a[6]=0;a[7]=0;a[8]=-((k-c)*g*.5);a[9]=(n-l)*e*.5;a[10]=f/(d-f);a[11]=-1;a[12]=0;a[13]=0;a[14]=f*d/(d-f);a[15]=0;return a};f.ortho=function(a,c,d,f,t,l,k){var g=1/(c-d),e=1/(f-t),b=1/(l-k);a[0]=-2*g;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=-2*e;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=2*b;a[11]=0;a[12]=(c+d)*g;a[13]=(t+f)*e;a[14]=(k+l)*b;a[15]=1;return a};f.lookAt=
function(a,c,d,f){var n=c[0],l=c[1];c=c[2];var k=f[0];var g=f[1];var e=f[2];var b=d[0];f=d[1];var h=d[2];if(Math.abs(n-b)<q.b&&Math.abs(l-f)<q.b&&Math.abs(c-h)<q.b)return mat4.identity(a);d=n-b;f=l-f;b=c-h;var r=1/Math.sqrt(d*d+f*f+b*b);d*=r;f*=r;b*=r;h=g*b-e*f;e=e*d-k*b;k=k*f-g*d;(r=Math.sqrt(h*h+e*e+k*k))?(r=1/r,h*=r,e*=r,k*=r):k=e=h=0;g=f*k-b*e;var p=b*h-d*k;var m=d*e-f*h;(r=Math.sqrt(g*g+p*p+m*m))?(r=1/r,g*=r,p*=r,m*=r):m=p=g=0;a[0]=h;a[1]=g;a[2]=d;a[3]=0;a[4]=e;a[5]=p;a[6]=f;a[7]=0;a[8]=k;a[9]=
m;a[10]=b;a[11]=0;a[12]=-(h*n+e*l+k*c);a[13]=-(g*n+p*l+m*c);a[14]=-(d*n+f*l+b*c);a[15]=1;return a};f.targetTo=function(a,c,d,f){var n=c[0],l=c[1];c=c[2];var k=f[0],g=f[1],e=f[2];f=n-d[0];var b=l-d[1];d=c-d[2];var h=f*f+b*b+d*d;0<h&&(h=1/Math.sqrt(h),f*=h,b*=h,d*=h);h=g*d-e*b;e=e*f-k*d;k=k*b-g*f;a[0]=h;a[1]=e;a[2]=k;a[3]=0;a[4]=b*k-d*e;a[5]=d*h-f*k;a[6]=f*e-b*h;a[7]=0;a[8]=f;a[9]=b;a[10]=d;a[11]=0;a[12]=n;a[13]=l;a[14]=c;a[15]=1;return a};f.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]+")"};f.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))};f.add=function(a,c,d){a[0]=c[0]+d[0];a[1]=c[1]+d[1];
a[2]=c[2]+d[2];a[3]=c[3]+d[3];a[4]=c[4]+d[4];a[5]=c[5]+d[5];a[6]=c[6]+d[6];a[7]=c[7]+d[7];a[8]=c[8]+d[8];a[9]=c[9]+d[9];a[10]=c[10]+d[10];a[11]=c[11]+d[11];a[12]=c[12]+d[12];a[13]=c[13]+d[13];a[14]=c[14]+d[14];a[15]=c[15]+d[15];return a};f.subtract=p;f.multiplyScalar=function(a,c,d){a[0]=c[0]*d;a[1]=c[1]*d;a[2]=c[2]*d;a[3]=c[3]*d;a[4]=c[4]*d;a[5]=c[5]*d;a[6]=c[6]*d;a[7]=c[7]*d;a[8]=c[8]*d;a[9]=c[9]*d;a[10]=c[10]*d;a[11]=c[11]*d;a[12]=c[12]*d;a[13]=c[13]*d;a[14]=c[14]*d;a[15]=c[15]*d;return a};f.multiplyScalarAndAdd=
function(a,c,d,f){a[0]=c[0]+d[0]*f;a[1]=c[1]+d[1]*f;a[2]=c[2]+d[2]*f;a[3]=c[3]+d[3]*f;a[4]=c[4]+d[4]*f;a[5]=c[5]+d[5]*f;a[6]=c[6]+d[6]*f;a[7]=c[7]+d[7]*f;a[8]=c[8]+d[8]*f;a[9]=c[9]+d[9]*f;a[10]=c[10]+d[10]*f;a[11]=c[11]+d[11]*f;a[12]=c[12]+d[12]*f;a[13]=c[13]+d[13]*f;a[14]=c[14]+d[14]*f;a[15]=c[15]+d[15]*f;return a};f.exactEquals=function(a,c){return 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]&&a[9]===c[9]&&a[10]===c[10]&&a[11]===
c[11]&&a[12]===c[12]&&a[13]===c[13]&&a[14]===c[14]&&a[15]===c[15]};f.equals=function(a,c){var d=a[0],f=a[1],t=a[2],l=a[3],k=a[4],g=a[5],e=a[6],b=a[7],h=a[8],r=a[9],p=a[10],m=a[11],u=a[12],E=a[13],x=a[14];a=a[15];var D=c[0],G=c[1],J=c[2],C=c[3],B=c[4],F=c[5],P=c[6],H=c[7],N=c[8],R=c[9],O=c[10],Q=c[11],U=c[12],W=c[13],aa=c[14];c=c[15];return Math.abs(d-D)<=q.b*Math.max(1,Math.abs(d),Math.abs(D))&&Math.abs(f-G)<=q.b*Math.max(1,Math.abs(f),Math.abs(G))&&Math.abs(t-J)<=q.b*Math.max(1,Math.abs(t),Math.abs(J))&&
Math.abs(l-C)<=q.b*Math.max(1,Math.abs(l),Math.abs(C))&&Math.abs(k-B)<=q.b*Math.max(1,Math.abs(k),Math.abs(B))&&Math.abs(g-F)<=q.b*Math.max(1,Math.abs(g),Math.abs(F))&&Math.abs(e-P)<=q.b*Math.max(1,Math.abs(e),Math.abs(P))&&Math.abs(b-H)<=q.b*Math.max(1,Math.abs(b),Math.abs(H))&&Math.abs(h-N)<=q.b*Math.max(1,Math.abs(h),Math.abs(N))&&Math.abs(r-R)<=q.b*Math.max(1,Math.abs(r),Math.abs(R))&&Math.abs(p-O)<=q.b*Math.max(1,Math.abs(p),Math.abs(O))&&Math.abs(m-Q)<=q.b*Math.max(1,Math.abs(m),Math.abs(Q))&&
Math.abs(u-U)<=q.b*Math.max(1,Math.abs(u),Math.abs(U))&&Math.abs(E-W)<=q.b*Math.max(1,Math.abs(E),Math.abs(W))&&Math.abs(x-aa)<=q.b*Math.max(1,Math.abs(x),Math.abs(aa))&&Math.abs(a-c)<=q.b*Math.max(1,Math.abs(a),Math.abs(c))};var q=d(30);f.mul=u;f.sub=p},function(m,f,d){function u(){var a=new n.a(4);a[0]=0;a[1]=0;a[2]=0;a[3]=1;return a}function p(a,c,e){e*=.5;var b=Math.sin(e);a[0]=b*c[0];a[1]=b*c[1];a[2]=b*c[2];a[3]=Math.cos(e);return a}function q(a,c,e){var b=c[0],d=c[1],g=c[2];c=c[3];var f=e[0],
k=e[1],l=e[2];e=e[3];a[0]=b*e+c*f+d*l-g*k;a[1]=d*e+c*k+g*f-b*l;a[2]=g*e+c*l+b*k-d*f;a[3]=c*e-b*f-d*k-g*l;return a}function a(a,c,e,b){var d=c[0],g=c[1],f=c[2];c=c[3];var k=e[0],l=e[1],n=e[2];e=e[3];var t=d*k+g*l+f*n+c*e;0>t&&(t=-t,k=-k,l=-l,n=-n,e=-e);if(1E-6<1-t){var p=Math.acos(t);var q=Math.sin(p);t=Math.sin((1-b)*p)/q;b=Math.sin(b*p)/q}else t=1-b;a[0]=t*d+b*k;a[1]=t*g+b*l;a[2]=t*f+b*n;a[3]=t*c+b*e;return a}function c(a,c){var e=c[0]+c[4]+c[8];if(0<e)e=Math.sqrt(e+1),a[3]=.5*e,e=.5/e,a[0]=(c[5]-
c[7])*e,a[1]=(c[6]-c[2])*e,a[2]=(c[1]-c[3])*e;else{var b=0;c[4]>c[0]&&(b=1);c[8]>c[3*b+b]&&(b=2);var d=(b+1)%3,g=(b+2)%3;e=Math.sqrt(c[3*b+b]-c[3*d+d]-c[3*g+g]+1);a[b]=.5*e;e=.5/e;a[3]=(c[3*d+g]-c[3*g+d])*e;a[d]=(c[3*d+b]+c[3*b+d])*e;a[g]=(c[3*g+b]+c[3*b+g])*e}return a}Object.defineProperty(f,"__esModule",{value:!0});f.create=u;f.identity=function(a){a[0]=0;a[1]=0;a[2]=0;a[3]=1;return a};f.setAxisAngle=p;f.getAxisAngle=function(a,c){var e=2*Math.acos(c[3]),b=Math.sin(e/2);0!=b?(a[0]=c[0]/b,a[1]=c[1]/
b,a[2]=c[2]/b):(a[0]=1,a[1]=0,a[2]=0);return e};f.multiply=q;f.rotateX=function(a,c,e){e*=.5;var b=c[0],d=c[1],g=c[2];c=c[3];var f=Math.sin(e);e=Math.cos(e);a[0]=b*e+c*f;a[1]=d*e+g*f;a[2]=g*e-d*f;a[3]=c*e-b*f;return a};f.rotateY=function(a,c,e){e*=.5;var b=c[0],d=c[1],g=c[2];c=c[3];var f=Math.sin(e);e=Math.cos(e);a[0]=b*e-g*f;a[1]=d*e+c*f;a[2]=g*e+b*f;a[3]=c*e-d*f;return a};f.rotateZ=function(a,c,e){e*=.5;var b=c[0],d=c[1],g=c[2];c=c[3];var f=Math.sin(e);e=Math.cos(e);a[0]=b*e+d*f;a[1]=d*e-b*f;a[2]=
g*e+c*f;a[3]=c*e-g*f;return a};f.calculateW=function(a,c){var e=c[0],b=c[1];c=c[2];a[0]=e;a[1]=b;a[2]=c;a[3]=Math.sqrt(Math.abs(1-e*e-b*b-c*c));return a};f.slerp=a;f.invert=function(a,c){var e=c[0],b=c[1],d=c[2];c=c[3];var g=e*e+b*b+d*d+c*c;g=g?1/g:0;a[0]=-e*g;a[1]=-b*g;a[2]=-d*g;a[3]=c*g;return a};f.conjugate=function(a,c){a[0]=-c[0];a[1]=-c[1];a[2]=-c[2];a[3]=c[3];return a};f.fromMat3=c;f.fromEuler=function(a,c,e,b){var d=.5*Math.PI/180;c*=d;e*=d;b*=d;d=Math.sin(c);c=Math.cos(c);var g=Math.sin(e);
e=Math.cos(e);var f=Math.sin(b);b=Math.cos(b);a[0]=d*e*b-c*g*f;a[1]=c*g*b+d*e*f;a[2]=c*e*f-d*g*b;a[3]=c*e*b+d*g*f;return a};f.str=function(a){return"quat("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"};var n=d(30),v=d(104),t=d(105);m=d(106);f.clone=m.clone;f.fromValues=m.fromValues;f.copy=m.copy;f.set=m.set;f.add=m.add;f.mul=q;f.scale=m.scale;f.dot=m.dot;f.lerp=m.lerp;d=m.length;f.length=d;f.len=d;d=m.squaredLength;f.squaredLength=d;f.sqrLen=d;var l=m.normalize;f.normalize=l;f.exactEquals=m.exactEquals;
f.equals=m.equals;m=function(){var a=t.create(),c=t.fromValues(1,0,0),e=t.fromValues(0,1,0);return function(b,d,g){var h=t.dot(d,g);if(-.999999>h)return t.cross(a,c,d),1E-6>t.len(a)&&t.cross(a,e,d),t.normalize(a,a),p(b,a,Math.PI),b;if(.999999<h)return b[0]=0,b[1]=0,b[2]=0,b[3]=1,b;t.cross(a,d,g);b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=1+h;return l(b,b)}}();f.rotationTo=m;m=function(){var c=u(),d=u();return function(e,b,g,f,k,l){a(c,b,k,l);a(d,g,f,l);a(e,c,d,2*l*(1-l));return e}}();f.sqlerp=m;m=function(){var a=
v.create();return function(d,e,b,h){a[0]=b[0];a[3]=b[1];a[6]=b[2];a[1]=h[0];a[4]=h[1];a[7]=h[2];a[2]=-e[0];a[5]=-e[1];a[8]=-e[2];return l(d,c(d,a))}}();f.setAxes=m},function(m,f,d){function u(){var a=new l.a(2);a[0]=0;a[1]=0;return a}function p(a,c,e){a[0]=c[0]-e[0];a[1]=c[1]-e[1];return a}function q(a,c,e){a[0]=c[0]*e[0];a[1]=c[1]*e[1];return a}function a(a,c,e){a[0]=c[0]/e[0];a[1]=c[1]/e[1];return a}function c(a,c){var e=c[0]-a[0];a=c[1]-a[1];return Math.sqrt(e*e+a*a)}function n(a,c){var e=c[0]-
a[0];a=c[1]-a[1];return e*e+a*a}function v(a){var c=a[0];a=a[1];return Math.sqrt(c*c+a*a)}function t(a){var c=a[0];a=a[1];return c*c+a*a}Object.defineProperty(f,"__esModule",{value:!0});f.create=u;f.clone=function(a){var c=new l.a(2);c[0]=a[0];c[1]=a[1];return c};f.fromValues=function(a,c){var e=new l.a(2);e[0]=a;e[1]=c;return e};f.copy=function(a,c){a[0]=c[0];a[1]=c[1];return a};f.set=function(a,c,e){a[0]=c;a[1]=e;return a};f.add=function(a,c,e){a[0]=c[0]+e[0];a[1]=c[1]+e[1];return a};f.subtract=
p;f.multiply=q;f.divide=a;f.ceil=function(a,c){a[0]=Math.ceil(c[0]);a[1]=Math.ceil(c[1]);return a};f.floor=function(a,c){a[0]=Math.floor(c[0]);a[1]=Math.floor(c[1]);return a};f.min=function(a,c,e){a[0]=Math.min(c[0],e[0]);a[1]=Math.min(c[1],e[1]);return a};f.max=function(a,c,e){a[0]=Math.max(c[0],e[0]);a[1]=Math.max(c[1],e[1]);return a};f.round=function(a,c){a[0]=Math.round(c[0]);a[1]=Math.round(c[1]);return a};f.scale=function(a,c,e){a[0]=c[0]*e;a[1]=c[1]*e;return a};f.scaleAndAdd=function(a,c,e,
b){a[0]=c[0]+e[0]*b;a[1]=c[1]+e[1]*b;return a};f.distance=c;f.squaredDistance=n;f.length=v;f.squaredLength=t;f.negate=function(a,c){a[0]=-c[0];a[1]=-c[1];return a};f.inverse=function(a,c){a[0]=1/c[0];a[1]=1/c[1];return a};f.normalize=function(a,c){var e=c[0],b=c[1];e=e*e+b*b;0<e&&(e=1/Math.sqrt(e),a[0]=c[0]*e,a[1]=c[1]*e);return a};f.dot=function(a,c){return a[0]*c[0]+a[1]*c[1]};f.cross=function(a,c,e){c=c[0]*e[1]-c[1]*e[0];a[0]=a[1]=0;a[2]=c;return a};f.lerp=function(a,c,e,b){var d=c[0];c=c[1];a[0]=
d+b*(e[0]-d);a[1]=c+b*(e[1]-c);return a};f.random=function(a,c){c=c||1;var e=2*l.c()*Math.PI;a[0]=Math.cos(e)*c;a[1]=Math.sin(e)*c;return a};f.transformMat2=function(a,c,e){var b=c[0];c=c[1];a[0]=e[0]*b+e[2]*c;a[1]=e[1]*b+e[3]*c;return a};f.transformMat2d=function(a,c,e){var b=c[0];c=c[1];a[0]=e[0]*b+e[2]*c+e[4];a[1]=e[1]*b+e[3]*c+e[5];return a};f.transformMat3=function(a,c,e){var b=c[0];c=c[1];a[0]=e[0]*b+e[3]*c+e[6];a[1]=e[1]*b+e[4]*c+e[7];return a};f.transformMat4=function(a,c,e){var b=c[0];c=
c[1];a[0]=e[0]*b+e[4]*c+e[12];a[1]=e[1]*b+e[5]*c+e[13];return a};f.str=function(a){return"vec2("+a[0]+", "+a[1]+")"};f.exactEquals=function(a,c){return a[0]===c[0]&&a[1]===c[1]};f.equals=function(a,c){var e=a[0];a=a[1];var b=c[0];c=c[1];return Math.abs(e-b)<=l.b*Math.max(1,Math.abs(e),Math.abs(b))&&Math.abs(a-c)<=l.b*Math.max(1,Math.abs(a),Math.abs(c))};var l=d(30);f.len=v;f.sub=p;f.mul=q;f.div=a;f.dist=c;f.sqrDist=n;f.sqrLen=t;m=function(){var a=u();return function(c,e,b,d,f,k){e||(e=2);b||(b=0);
for(d=d?Math.min(d*e+b,c.length):c.length;b<d;b+=e)a[0]=c[b],a[1]=c[b+1],f(a,a,k),c[b]=a[0],c[b+1]=a[1];return c}}();f.forEach=m},function(m,f,d){d.d(f,"a",function(){return q});var u=d(1),p=function(){function a(a,d){for(var c=0;c<d.length;c++){var f=d[c];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}return function(c,d,f){d&&a(c.prototype,d);f&&a(c,f);return c}}(),q=function(){function a(c,d){d=void 0===d?u.d:d;if(!(this instanceof
a))throw new TypeError("Cannot call a class as a function");this.size=u.s.clone(c);this.transform=u.k.clone(d);this.invTransform=u.k.invert(u.k.create(),d)}p(a,[{key:"toObject",value:function(a){a.size=this.size;a.transform=this.transform}},{key:"localSpatialToGlobal",value:function(a,d){return u.s.transformMat4(a,d,this.transform)}},{key:"globalToLocalSpatial",value:function(a,d){return u.s.transformMat4(a,d,this.invTransform)}},{key:"globalToLocalGrid",value:function(a,d){this.globalToLocalSpatial(a,
d);u.s.divide(a,a,this.size);return a}},{key:"localSpatialVectorToGlobal",value:function(a,d){return Object(u.p)(a,d,this.transform)}},{key:"globalToLocalSpatialVector",value:function(a,d){return Object(u.p)(a,d,this.invTransform)}},{key:"assignLocalSpatialToGlobalMat4",value:function(a){return u.k.copy(a,this.transform)}}],[{key:"get",value:function(c,d){d=void 0===d?u.d:d;var f=a.cache,n=JSON.stringify([Array.from(c),Array.from(d)]),l=f.get(n);void 0===l&&(l=new a(c,d),f.set(n,l));return l}},{key:"fromObject",
value:function(c){return a.get(c.size,c.transform)}}]);return a}();q.cache=new Map},function(m,f,d){f.a=function(d,f){return d===f?!0:1E-6>Math.abs(d-f)/Math.min(Math.abs(d),Math.abs(f))}},function(m,f,d){function u(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(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 q(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)}d.d(f,"a",function(){return g});var a=d(52),c=d(15),n=d(40),v=d(6);m=d(0);var t=d(1),l=function(){function a(a,c){for(var b=0;b<c.length;b++){var e=c[b];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);
Object.defineProperty(a,e.key,e)}}return function(b,c,e){c&&a(b.prototype,c);e&&a(b,e);return b}}(),k=function(a){function b(){u(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);return b}(v.f),g=function(e){function b(e){u(this,b);var d=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));d.transformCacheGeneration=-1;d.cachedObjectToGlobal=t.k.create();d.cachedGlobalToObject=t.k.create();var g=void 0===e.transform?new a.a:e.transform,h=e.source,f=
void 0===e.hoverState?new k(void 0):e.hoverState,l=void 0===e.role?c.g.ANNOTATION:e.role,q=e.color,m=e.fillOpacity,G=void 0===e.segmentationState?new v.f(null):e.segmentationState;e=void 0===e.filterBySegmentation?new n.b(!1):e.filterBySegmentation;d.transform=g;d.source=d.registerDisposer(h);d.hoverState=f;d.role=l;d.color=q;d.fillOpacity=m;d.segmentationState=G;d.filterBySegmentation=e;return d}q(b,e);l(b,[{key:"updateTransforms",value:function(){if(this.transform.changed.count!==this.transformCacheGeneration){var a=
this.cachedObjectToGlobal;t.k.multiply(a,this.transform.transform,this.source.objectToLocal);t.k.invert(this.cachedGlobalToObject,a)}}},{key:"objectToGlobal",get:function(){this.updateTransforms();return this.cachedObjectToGlobal}},{key:"globalToObject",get:function(){this.updateTransforms();return this.cachedGlobalToObject}}]);return b}(m.a)},function(m,f,d){var u=d(108);m.exports=function(){return u.Date.now()}},function(m,f,d){f=d(7);m.exports="object"==typeof f&&f&&f.Object===Object&&f},function(m,
f,d){var u=d(76),p=d(188),q=0/0,a=/^\s+|\s+$/g,c=/^[-+]0x[0-9a-f]+$/i,n=/^0b[01]+$/i,v=/^0o[0-7]+$/i,t=parseInt;m.exports=function(d){if("number"==typeof d)return d;if(p(d))return q;u(d)&&(d="function"==typeof d.valueOf?d.valueOf():d,d=u(d)?d+"":d);if("string"!=typeof d)return 0===d?d:+d;d=d.replace(a,"");var f=n.test(d);return f||v.test(d)?t(d.slice(2),f?2:8):c.test(d)?q:+d}},function(m,f,d){var u=d(189),p=d(192);m.exports=function(d){return"symbol"==typeof d||p(d)&&"[object Symbol]"==u(d)}},function(m,
f,d){f=d(109);var u=d(190),p=d(191),q=f?f.toStringTag:void 0;m.exports=function(a){return null==a?void 0===a?"[object Undefined]":"[object Null]":q&&q in Object(a)?u(a):p(a)}},function(m,f,d){f=d(109);d=Object.prototype;var u=d.hasOwnProperty,p=d.toString,q=f?f.toStringTag:void 0;m.exports=function(a){var c=u.call(a,q),d=a[q];try{a[q]=void 0;var f=!0}catch(l){}var t=p.call(a);f&&(c?a[q]=d:delete a[q]);return t}},function(m,f){var d=Object.prototype.toString;m.exports=function(f){return d.call(f)}},
function(m,f){m.exports=function(d){return null!=d&&"object"==typeof d}},function(m,f,d){f.b=function(d,f){d.remove(f)};f.a=function(d,f){d.add(f)}},function(m,f){},function(m,f,d){d.d(f,"b",function(){return u});var u;(function(d){d[d.LITTLE=0]="LITTLE";d[d.BIG=1]="BIG"})(u||(u={}));m=function(){var d=Uint16Array.of(4386);return 17===(new Uint8Array(d.buffer))[0]?u.BIG:u.LITTLE}();f.a=m},function(m,f){},function(m,f,d){function u(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
}function p(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 q(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){if(null==
a)return function(){return!1};var b=a.visibleSegments,c=a.segmentEquivalences;return function(a){a=a.segments;if(void 0===a)return!1;a=$jscomp.makeIterator(a);for(var e=a.next();!e.done;e=a.next())if(b.has(c.get(e.value)))return!0;return!1}}function c(a,b){for(var c=[],e=$jscomp.makeIterator(v.e),d=e.next();!d.done;d=e.next())c[d.value]=[];e=$jscomp.makeIterator(a);for(d=e.next();!d.done;d=e.next())d=d.value,(void 0===b||b(d))&&c[d.type].push(d.id);var g=0;b=0;e=[];var h=$jscomp.makeIterator(v.e);
for(d=h.next();!d.done;d=h.next()){var f=d.value;e[f]=g;d=c[f].length;f=Object(k.b)(f);g+=d*f.bytes;b+=f.pickIdsPerInstance*d}g=new ArrayBuffer(g);h={};f=$jscomp.makeIterator(v.e);for(d=f.next();!d.done;h={serializer:h.serializer},d=f.next()){d=d.value;var l=c[d],r=Object(k.b)(d);h.serializer=r.serializer(g,e[d],l.length);l.forEach(function(b){return function(c,e){return b.serializer(a.get(c),e)}}(h))}return{typeToIds:c,typeToOffset:e,data:g,numPickIds:b}}function n(a,c){return function(a){function e(a){for(var b=
[],d=0;d<arguments.length;++d)b[d-0]=arguments[d];u(this,e);var g,h=p(this,(g=e.__proto__||Object.getPrototypeOf(e)).call.apply(g,[].concat([this],$jscomp.arrayFromIterable(b))));h.renderHelpers=[];h.isAnnotation=!0;b=h.registerDisposer(h.base);d=b.visibility;void 0!==d&&h.registerDisposer(d.add(h.visibility));h.role=b.state.role;d=h.renderHelpers;g=h.gl;for(var f=$jscomp.makeIterator(v.e),l=f.next();!l.done;l=f.next()){var r=l.value;l=Object(k.b)(r);r=d[r]=h.registerDisposer(new l[c](g));r.pickIdsPerInstance=
l.pickIdsPerInstance;r.targetIsSliceView="sliceViewRenderHelper"===c}h.registerDisposer(b.redrawNeeded.add(function(){h.redrawNeeded.dispatch()}));h.setReady(!0);return h}q(e,a);J(e,[{key:"drawGeometryChunkData",value:function(a,b){if(!a.bufferValid){var c=a.buffer;void 0===c&&(c=a.buffer=new x.a(this.gl));c.setData(a.data);a.bufferValid=!0}this.drawGeometry(a,b)}},{key:"drawGeometry",value:function(a,b){var c=this.base,e=a.typeToIds,d=a.typeToOffset,g=0;b.emitPickID&&(g=b.pickIDs.register(this,a.numPickIds,
0,0,a));for(var h=c.hoverState.value,f=y.k.multiply(C,b.dataToDevice,c.state.objectToGlobal),l=$jscomp.makeIterator(v.e),n=l.next();!n.done;n=l.next()){n=n.value;var t=e[n];if(0<t.length){var p=t.length,q=Object(k.b)(n),m=4294967295;void 0!==h&&(t=Object(r.a)(t,h.id,function(a,b){return a<b?-1:a===b?0:1}),0<=t&&(m=t*q.pickIdsPerInstance));this.renderHelpers[n].draw({annotationLayer:c,renderContext:b,selectedIndex:m,basePickId:g,buffer:a.buffer,bufferOffset:d[n],count:p,projectionMatrix:f});g+=p*q.pickIdsPerInstance}}}},
{key:"draw",value:function(a){var c=this,e=this.base.source;if(e instanceof v.b)e=this.base,e.updateBuffer(),this.drawGeometry(e,a);else if(this.drawGeometryChunkData(e.temporary.data,a),this.base.state.filterBySegmentation.value){var d=this.base.state.segmentationState.value;if(null!=d){var h=e.segmentFilteredSource.chunks;Object(b.a)(d,function(e){e=Object(b.b)(e);e=h.get(e);void 0!==e&&c.drawGeometryChunkData(e.data,a)})}}else for(e=$jscomp.makeIterator(e.sources),d=e.next();!d.done;d=e.next()){d=
$jscomp.makeIterator(d.value);for(var f=d.next();!f.done;f=d.next()){f=$jscomp.makeIterator(f.value.chunks.values());for(var k=f.next();!k.done;k=f.next())k=k.value,k.state===g.d.GPU_MEMORY&&this.drawGeometryChunkData(k.data,a)}}}},{key:"updateMouseState",value:function(a,b,c,e){var d=e.typeToIds;b=e.typeToOffset;for(var g=$jscomp.makeIterator(v.e),h=g.next();!h.done;h=g.next()){h=h.value;var f=d[h],l=Object(k.b)(h),r=l.pickIdsPerInstance;if(c<f.length*r){d=Math.floor(c/r);c%=r;a.pickedAnnotationId=
f[d];a.pickedAnnotationLayer=this.base.state;a.pickedOffset=c;l.snapPosition(a.position,this.base.state.objectToGlobal,e.data.buffer,e.data.byteOffset+b[h]+d*l.bytes,c);break}c-=f.length*r}}},{key:"transformPickedValue",value:function(a,b){}},{key:"isReady",value:function(){var a=this.base,c=a.source;if(!(c instanceof l.b&&a.state.filterBySegmentation.value))return!0;a=this.base.state.segmentationState.value;if(void 0===a)return!1;if(null===a)return!0;var e=c.segmentFilteredSource.chunks,d=!1;Object(b.a)(a,
function(a){a=Object(b.b)(a);e.has(a)||(d=!0)});return!d}},{key:"gl",get:function(){return this.base.chunkManager.gl}}]);return e}(a)}d.d(f,"a",function(){return F});d.d(f,"b",function(){return P});d(198);d(199);d(200);d(201);var v=d(23),t=d(75),l=d(77),k=d(45),g=d(36),e=d(54),b=d(67),h=d(63);m=d(81);var r=d(39),A=d(0),y=d(1),z=d(3),E=d(24),x=d(16),D=d(12),G=function N(a,b,c){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,b);if(void 0===e){if(a=Object.getPrototypeOf(a),null!==
a)return N(a,b,c)}else{if("value"in e)return e.value;b=e.get;return void 0===b?void 0:b.call(c)}},J=function(){function a(a,b){for(var c=0;c<b.length;c++){var e=b[c];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(b,c,e){c&&a(b.prototype,c);e&&a(b,e);return b}}();d=this&&this.__decorate||function(a,b,c,e){var d=arguments.length,g=3>d?b:null===e?e=Object.getOwnPropertyDescriptor(b,c):e,h;if("object"===typeof Reflect&&"function"===
typeof Reflect.decorate)g=Reflect.decorate(a,b,c,e);else for(var f=a.length-1;0<=f;f--)if(h=a[f])g=(3>d?h(g):3<d?h(b,c,g):h(b,c))||g;return 3<d&&g&&Object.defineProperty(b,c,g),g};var C=y.k.create(),B=function(a){function b(a,c,e,d){u(this,b);var g=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));g.chunkManager=a;g.source=c;g.state=e;g.filterBySegmentation=d;g.initializeCounterpart(g.chunkManager.rpc,{chunkManager:g.chunkManager.rpcId,source:c.rpcId,segmentationState:g.serializeDisplayState()});
a=function(){var a={id:g.rpcId,segmentationState:g.serializeDisplayState()};g.rpc.invoke(t.i,a)};g.registerDisposer(e.changed.add(a));g.registerDisposer(d.changed.add(a));return g}q(b,a);J(b,[{key:"serializeDisplayState",value:function(){var a=this.state.value;return null==a?a:this.filterBySegmentation.value?{segmentEquivalences:a.segmentEquivalences.rpcId,visibleSegments:a.visibleSegments.rpcId}:null}}]);return b}(Object(E.c)(D.b));B=d([Object(D.g)(t.h)],B);var F=function(b){function e(a,b){u(this,
e);var c=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));c.chunkManager=a;c.state=b;c.generation=-1;c.redrawNeeded=new z.a;c.handleChangeAffectingBuffer=function(){c.generation=-1;c.redrawNeeded.dispatch()};c.handleSegmentationChanged=function(){c.state.filterBySegmentation.value&&c.handleChangeAffectingBuffer()};c.registerDisposer(b);c.buffer=c.registerDisposer(new x.a(a.gl));c.registerDisposer(c.source.changed.add(c.handleChangeAffectingBuffer));c.registerDisposer(b.filterBySegmentation.changed.add(c.handleChangeAffectingBuffer));
c.registerDisposer(function(){return c.unregisterSegmentationState()});c.registerDisposer(b.segmentationState.changed.add(function(){var a=b.segmentationState.value;a!==c.segmentationState&&(c.unregisterSegmentationState(),null!=a&&(a.visibleSegments.changed.add(c.handleSegmentationChanged),a.segmentEquivalences.changed.add(c.handleSegmentationChanged)),c.segmentationState=a,c.handleSegmentationChanged())}));c.source instanceof v.b||(c.sharedObject=c.registerDisposer(new B(a,c.source,b.segmentationState,
b.filterBySegmentation)));c.registerDisposer(c.state.color.changed.add(c.redrawNeeded.dispatch));c.registerDisposer(c.state.fillOpacity.changed.add(c.redrawNeeded.dispatch));c.registerDisposer(c.hoverState.changed.add(c.redrawNeeded.dispatch));c.registerDisposer(c.transform.changed.add(c.redrawNeeded.dispatch));return c}q(e,b);J(e,[{key:"unregisterSegmentationState",value:function(){var a=this.segmentationState;null!=a&&(a.visibleSegments.changed.remove(this.handleSegmentationChanged),a.segmentEquivalences.changed.remove(this.handleSegmentationChanged),
this.segmentationState=void 0)}},{key:"updateBuffer",value:function(){var b=this.source;if(b instanceof v.b){var e=b.changed.count;if(this.generation!==e){this.generation=e;b=c(b,this.state.filterBySegmentation.value?a(this.segmentationState):void 0);e=b.typeToIds;var d=b.typeToOffset,g=b.numPickIds;this.data=new Uint8Array(b.data);this.buffer.setData(this.data);this.typeToIds=e;this.typeToOffset=d;this.numPickIds=g}}}},{key:"source",get:function(){return this.state.source}},{key:"transform",get:function(){return this.state.transform}},
{key:"hoverState",get:function(){return this.state.hoverState}},{key:"visibility",get:function(){var a=this.sharedObject;if(void 0!==a)return a.visibility}},{key:"gl",get:function(){return this.chunkManager.gl}}]);return e}(A.a);d=function(a){function b(a){u(this,b);var c=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.base=a;return c}q(b,a);return b}(e.a);m=function(a){function b(a){u(this,b);var c=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.base=a;return c}q(b,a);return b}(m.b);
var P=function(a){function b(){u(this,b);var a=p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));var c=a.base.source;if(c instanceof l.b){var e=a.registerDisposer(new D.b),d=c.chunkManager.rpc;e.RPC_TYPE_ID=t.e;e.initializeCounterpart(d,{source:c.rpcId,filterBySegmentation:a.registerDisposer(h.a.makeFromExisting(d,a.base.state.filterBySegmentation)).rpcId});c=e}else c=void 0;a.backend=c;return a}q(b,a);J(b,[{key:"isReady",value:function(){if(!G(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),
"isReady",this).call(this))return!1;var a=this.base,c=a.source;return c instanceof l.b&&!a.state.filterBySegmentation.value&&(a=c.sources[0][0].chunks.get("0,0,0"),void 0===a||a.state!==g.d.GPU_MEMORY)?!1:!0}}]);return b}(n(d,"perspectiveViewRenderHelper"));m=n(m,"sliceViewRenderHelper");f.c=m},function(m,f,d){function u(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(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 q(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(){return new Float32Array([0,1,2,3,4,5])}function c(){return Object(v.d)(a(),1,1,e.b)}m=d(23);f=d(45);var n=d(114),v=
d(39),t=d(1),l=d(16),k=d(79),g=d(11),e=d(115),b=d(27),h=function(){function a(a,b){for(var c=0;c<b.length;c++){var e=b[c];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(b,c,e){c&&a(b.prototype,c);e&&a(b,e);return b}}(),r=function x(a,b,c){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,b);if(void 0===e){if(a=Object.getPrototypeOf(a),null!==a)return x(a,b,c)}else{if("value"in e)return e.value;b=
e.get;return void 0===b?void 0:b.call(c)}};d=27;var A=Float32Array.from([0,0,0,0,0,1,9,1,0,0,1,0,1,10,0,1,0,0,1,1,11,1,1,0,1,1,1,12,0,0,0,0,1,0,13,0,0,1,0,1,1,14,1,0,0,1,1,0,15,1,0,1,1,1,1,16,0,0,0,1,0,0,17,0,0,1,1,0,1,18,0,1,0,1,1,0,19,0,1,1,1,1,1,20]),y=function(a){function b(){u(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);h(b,[{key:"defineShader",value:function(a){r(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"defineShader",this).call(this,
a);a.addAttribute("highp vec3","aLower");a.addAttribute("highp vec3","aUpper")}},{key:"enable",value:function(a,c,e){r(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"enable",this).call(this,a,c,function(){var b=a.gl,d=a.attribute("aLower"),h=a.attribute("aUpper");c.buffer.bindToVertexAttrib(d,3,g.g,!1,24,c.bufferOffset);c.buffer.bindToVertexAttrib(h,3,g.g,!1,24,c.bufferOffset+12);b.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(d,1);b.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(h,
1);e();b.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(d,0);b.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(h,0);b.disableVertexAttribArray(d);b.disableVertexAttribArray(h)})}}]);return b}(f.a),z=function(a){function c(){u(this,c);var a=p(this,(c.__proto__||Object.getPrototypeOf(c)).apply(this,arguments));a.lineShader=a.registerDisposer(new e.a(a.gl,12));a.edgeBoxCornerOffsetsBuffer=a.registerDisposer(l.a.fromData(a.gl,Object(v.d)(A,7,1,e.b)));a.edgeShaderGetter=Object(b.b)(a,a.gl,function(b){a.defineShader(b);
a.lineShader.defineShader(b);b.addAttribute("highp vec3","aBoxCornerOffset1");b.addAttribute("highp vec4","aBoxCornerOffset2");b.setVertexMain("\nvec3 vertexPosition1 = mix(aLower, aUpper, aBoxCornerOffset1);\nvec3 vertexPosition2 = mix(aLower, aUpper, aBoxCornerOffset2.xyz);\nemitLine(uProjection, vertexPosition1, vertexPosition2);\n"+a.setPartIndex(b,"aBoxCornerOffset2.w")+";\n");b.setFragmentMain("\nemitAnnotation(vec4(vColor.rgb, getLineAlpha()));\n")});a.circleShader=a.registerDisposer(new k.a(a.gl,
8));a.boxCornerOffsetsBuffer=a.registerDisposer(l.a.fromData(a.gl,Object(v.d)(n.b,3,1,k.b)));a.cornerShaderGetter=Object(b.b)(a,a.gl,function(b){a.defineShader(b);a.circleShader.defineShader(b,a.targetIsSliceView);b.addAttribute("highp vec3","aBoxCornerOffset");b.setVertexMain("\nvec3 vertexPosition = mix(aLower, aUpper, aBoxCornerOffset);\nemitCircle(uProjection * vec4(vertexPosition, 1.0));\nfloat cornerIndex = aBoxCornerOffset.x + aBoxCornerOffset.y * 2.0 + aBoxCornerOffset.z * 4.0;\nfloat cornerPickOffset = "+
(1).toFixed(1)+" + cornerIndex;\n"+a.setPartIndex(b,"cornerPickOffset")+";\n");b.setFragmentMain("\nvec4 borderColor = vec4(0.0, 0.0, 0.0, 1.0);\nemitAnnotation(getCircleColor(vColor, borderColor));\n")});return a}q(c,a);h(c,[{key:"drawEdges",value:function(a){var b=this,c=this.edgeShaderGetter(a.renderContext.emitter),e=this.gl;this.enable(c,a,function(){var d=c.attribute("aBoxCornerOffset1"),h=c.attribute("aBoxCornerOffset2");b.edgeBoxCornerOffsetsBuffer.bindToVertexAttrib(d,3,g.g,!1,28,0);b.edgeBoxCornerOffsetsBuffer.bindToVertexAttrib(h,
4,g.g,!1,28,12);b.lineShader.draw(c,a.renderContext,a.renderContext.emitColor?1:5,1,a.count);e.disableVertexAttribArray(d);e.disableVertexAttribArray(h)})}},{key:"drawCorners",value:function(a){var b=this,c=this.cornerShaderGetter(a.renderContext.emitter),e=this.gl;this.enable(c,a,function(){var d=c.attribute("aBoxCornerOffset");b.boxCornerOffsetsBuffer.bindToVertexAttrib(d,3,g.g,!1);b.circleShader.draw(c,a.renderContext,{interiorRadiusInPixels:1,borderWidthInPixels:0,featherWidthInPixels:1},a.count);
e.disableVertexAttribArray(d)})}},{key:"draw",value:function(a){this.drawEdges(a);this.drawCorners(a)}}]);return c}(y);y=function(d){function f(d){u(this,f);var h=p(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,d));h.gl=d;h.lineShader=new e.a(h.gl,6);h.intersectionVertexIndexBuffer=Object(l.b)(h.gl,g.a,c).value;h.filledIntersectionVertexIndexBuffer=Object(l.b)(h.gl,g.a,a).value;h.boundingBoxCrossSectionHelper=h.registerDisposer(new n.a(h.gl));h.faceShaderGetter=Object(b.b)(h,h.gl,function(a){r(f.prototype.__proto__||
Object.getPrototypeOf(f.prototype),"defineShader",h).call(h,a);h.boundingBoxCrossSectionHelper.defineShader(a);h.lineShader.defineShader(a);a.addAttribute("highp float","aVertexIndexFloat");a.setVertexMain("\nint vertexIndex1 = int(aVertexIndexFloat);\nint vertexIndex2 = vertexIndex1 == 5 ? 0 : vertexIndex1 + 1;\nvec3 vertexPosition1 = getBoundingBoxPlaneIntersectionVertexPosition(aUpper - aLower, aLower, aLower, aUpper, vertexIndex1);\nvec3 vertexPosition2 = getBoundingBoxPlaneIntersectionVertexPosition(aUpper - aLower, aLower, aLower, aUpper, vertexIndex2);\nemitLine(uProjection, vertexPosition1, vertexPosition2);\n"+
h.setPartIndex(a)+";\n");a.setFragmentMain("\nemitAnnotation(vec4(vColor.rgb, vColor.a * getLineAlpha()));\n")});h.fillShaderGetter=Object(b.b)(h,h.gl,function(a){r(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"defineShader",h).call(h,a);h.boundingBoxCrossSectionHelper.defineShader(a);a.addAttribute("highp float","aVertexIndexFloat");a.addUniform("highp float","uFillOpacity");a.setVertexMain("\nint vertexIndex = int(aVertexIndexFloat);\nvec3 vertexPosition = getBoundingBoxPlaneIntersectionVertexPosition(aUpper - aLower, aLower, aLower, aUpper, vertexIndex);\ngl_Position = uProjection * vec4(vertexPosition, 1);\n"+
h.setPartIndex(a)+";\n");a.setFragmentMain("\nemitAnnotation(vec4(vColor.rgb, uFillOpacity));\n")});return h}q(f,d);h(f,[{key:"draw",value:function(a){var b=this,c=a.annotationLayer.state.fillOpacity.value,e=(c?this.fillShaderGetter:this.faceShaderGetter)(a.renderContext.emitter),d=this.gl;this.enable(e,a,function(){b.boundingBoxCrossSectionHelper.setViewportPlane(e,a.renderContext.sliceView.viewportAxes[2],a.renderContext.sliceView.centerDataPosition,a.annotationLayer.state.globalToObject);var h=
e.attribute("aVertexIndexFloat");(c?b.filledIntersectionVertexIndexBuffer:b.intersectionVertexIndexBuffer).bindToVertexAttrib(h,1,g.g,!1);c?(d.uniform1f(e.uniform("uFillOpacity"),c),d.ANGLE_instanced_arrays.drawArraysInstancedANGLE(g.D,0,6,a.count)):b.lineShader.draw(e,a.renderContext,a.renderContext.emitColor?1:5,1,a.count);d.disableVertexAttribArray(h)})}}]);return f}(y);Object(f.c)(m.c.AXIS_ALIGNED_BOUNDING_BOX,{bytes:24,serializer:function(a,b,c){var e=new Float32Array(a,b,6*c);return function(a,
b){var c=a.pointA;a=a.pointB;b*=6;e[b]=Math.min(c[0],a[0]);e[b+1]=Math.min(c[1],a[1]);e[b+2]=Math.min(c[2],a[2]);e[b+3]=Math.max(c[0],a[0]);e[b+4]=Math.max(c[1],a[1]);e[b+5]=Math.max(c[2],a[2])}},sliceViewRenderHelper:y,perspectiveViewRenderHelper:z,pickIdsPerInstance:d,snapPosition:function(a,b,c,e,d){c=new Float32Array(c,e,6);if(1<=d&&9>d){d=3*(d-1);for(e=0;3>e;++e){var g=n.b[d+e];a[e]=(1-g)*Math.min(c[e],c[e+3])+g*Math.max(c[e],c[e+3])}t.s.transformMat4(a,a,b)}else if(9<=d&&21>d){d=7*(d-9);e=t.s.create();
g=t.s.create();for(var h=0;3>h;++h){var f=A[d+h],k=A[d+h+3],l=Math.min(c[h],c[h+3]),r=Math.max(c[h],c[h+3]);e[h]=(1-f)*l+f*r;g[h]=(1-k)*l+k*r}t.s.transformMat4(e,e,b);t.s.transformMat4(g,g,b);Object(t.m)(a,e,g,a)}}})},function(m,f,d){function u(a,c){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!c||"object"!==typeof c&&"function"!==typeof c?a:c}function p(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+
typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}function q(){return Object(a.d)(new Float32Array([0,1]),1,1,v.b)}m=d(23);f=d(45);var a=d(39),c=d(1),n=d(16),v=d(79),t=d(11),l=d(115),k=d(27),g=function(){function a(a,b){for(var c=0;c<b.length;c++){var e=b[c];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,
e)}}return function(b,c,e){c&&a(b.prototype,c);e&&a(b,e);return b}}(),e=function h(a,c,e){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,c);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return h(a,c,e)}else{if("value"in d)return d.value;c=d.get;return void 0===c?void 0:c.call(e)}};d=function(a){function c(){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");var a=u(this,(c.__proto__||Object.getPrototypeOf(c)).apply(this,arguments));a.lineShader=
a.registerDisposer(new l.a(a.gl,1));a.circleShader=a.registerDisposer(new v.a(a.gl,2));a.edgeShaderGetter=Object(k.b)(a,a.gl,function(c){a.defineShader(c);a.lineShader.defineShader(c);c.setVertexMain("\nemitLine(uProjection, aEndpointA, aEndpointB);\n"+a.setPartIndex(c)+";\n");c.setFragmentMain("\nemitAnnotation(vec4(vColor.rgb, vColor.a * getLineAlpha() * "+a.getCrossSectionFadeFactor()+"));\n")});a.endpointIndexBuffer=a.registerDisposer(Object(n.b)(a.gl,t.a,q)).value;a.endpointShaderGetter=Object(k.b)(a,
a.gl,function(c){a.defineShader(c);a.circleShader.defineShader(c,a.targetIsSliceView);c.addAttribute("highp float","aEndpointIndex");c.setVertexMain("\nvec3 vertexPosition = mix(aEndpointA, aEndpointB, aEndpointIndex);\nemitCircle(uProjection * vec4(vertexPosition, 1.0));\n"+a.setPartIndex(c,"aEndpointIndex + 1.0")+";\n");c.setFragmentMain("\nvec4 borderColor = vec4(0.0, 0.0, 0.0, 1.0);\nemitAnnotation(getCircleColor(vColor, borderColor));\n")});return a}p(c,a);g(c,[{key:"defineShader",value:function(a){e(c.prototype.__proto__||
Object.getPrototypeOf(c.prototype),"defineShader",this).call(this,a);a.addAttribute("highp vec3","aEndpointA");a.addAttribute("highp vec3","aEndpointB")}},{key:"enable",value:function(a,d,g){e(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"enable",this).call(this,a,d,function(){var c=a.gl,e=a.attribute("aEndpointA"),h=a.attribute("aEndpointB");d.buffer.bindToVertexAttrib(e,3,t.g,!1,24,d.bufferOffset);d.buffer.bindToVertexAttrib(h,3,t.g,!1,24,d.bufferOffset+12);c.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(e,
1);c.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(h,1);g();c.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(e,0);c.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(h,0);c.disableVertexAttribArray(e);c.disableVertexAttribArray(h)})}},{key:"drawEdges",value:function(a){var c=this,e=this.edgeShaderGetter(a.renderContext.emitter);this.enable(e,a,function(){c.lineShader.draw(e,a.renderContext,a.renderContext.emitColor?1:5,1,a.count)})}},{key:"drawEndpoints",value:function(a){var c=this,e=this.endpointShaderGetter(a.renderContext.emitter);
this.enable(e,a,function(){var d=e.attribute("aEndpointIndex");c.endpointIndexBuffer.bindToVertexAttrib(d,1,t.g,!1);c.circleShader.draw(e,a.renderContext,{interiorRadiusInPixels:6,borderWidthInPixels:2,featherWidthInPixels:1},a.count);e.gl.disableVertexAttribArray(d)})}},{key:"draw",value:function(a){this.drawEdges(a);this.drawEndpoints(a)}}]);return c}(f.a);Object(f.c)(m.c.LINE,{bytes:24,serializer:function(a,c,e){var d=new Float32Array(a,c,6*e);return function(a,c){var e=a.pointA;a=a.pointB;c*=
6;d[c]=e[0];d[c+1]=e[1];d[c+2]=e[2];d[c+3]=a[0];d[c+4]=a[1];d[c+5]=a[2]}},sliceViewRenderHelper:d,perspectiveViewRenderHelper:d,pickIdsPerInstance:3,snapPosition:function(a,e,d,g,f){d=new Float32Array(d,g,6);0===f?(f=c.s.transformMat4(c.s.create(),d.subarray(0,3),e),e=c.s.transformMat4(c.s.create(),d.subarray(3,6),e),Object(c.m)(a,f,e,a)):(f=3*(f-1),f=d.subarray(f,f+3),c.s.transformMat4(a,f,e))}})},function(m,f,d){function u(a,c){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!c||"object"!==typeof c&&"function"!==typeof c?a:c}function p(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}m=d(23);f=d(45);var q=d(1),a=d(79),c=d(11),n=d(27),v=function(){function a(a,c){for(var e=0;e<c.length;e++){var b=c[e];b.enumerable=
b.enumerable||!1;b.configurable=!0;"value"in b&&(b.writable=!0);Object.defineProperty(a,b.key,b)}}return function(c,d,e){d&&a(c.prototype,d);e&&a(c,e);return c}}(),t=function k(a,c,b){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,c);if(void 0===e){if(a=Object.getPrototypeOf(a),null!==a)return k(a,c,b)}else{if("value"in e)return e.value;c=e.get;return void 0===c?void 0:c.call(b)}};d=function(d){function g(){if(!(this instanceof g))throw new TypeError("Cannot call a class as a function");
var c=u(this,(g.__proto__||Object.getPrototypeOf(g)).apply(this,arguments));c.circleShader=c.registerDisposer(new a.a(c.gl));c.shaderGetter=Object(n.b)(c,c.gl,function(a){return c.defineShader(a)});return c}p(g,d);v(g,[{key:"defineShader",value:function(a){t(g.prototype.__proto__||Object.getPrototypeOf(g.prototype),"defineShader",this).call(this,a);this.circleShader.defineShader(a,this.targetIsSliceView);a.addAttribute("highp vec3","aVertexPosition");a.setVertexMain("\nemitCircle(uProjection * vec4(aVertexPosition, 1.0));\n"+
this.setPartIndex(a)+";\n");a.setFragmentMain("\nvec4 borderColor = vec4(0.0, 0.0, 0.0, 1.0);\nemitAnnotation(getCircleColor(vColor, borderColor));\n")}},{key:"draw",value:function(a){var b=this,e=this.shaderGetter(a.renderContext.emitter);this.enable(e,a,function(){var d=b.gl,g=e.attribute("aVertexPosition");a.buffer.bindToVertexAttrib(g,3,c.g,!1,0,a.bufferOffset);d.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(g,1);b.circleShader.draw(e,a.renderContext,{interiorRadiusInPixels:6,borderWidthInPixels:2,
featherWidthInPixels:1},a.count);d.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(g,0);d.disableVertexAttribArray(g)})}}]);return g}(f.a);Object(f.c)(m.c.POINT,{bytes:12,serializer:function(a,c,e){var b=new Float32Array(a,c,3*e);return function(a,c){a=a.point;c*=3;b[c]=a[0];b[c+1]=a[1];b[c+2]=a[2]}},sliceViewRenderHelper:d,perspectiveViewRenderHelper:d,pickIdsPerInstance:1,snapPosition:function(a,c,e,b){q.s.transformMat4(a,new Float32Array(e,b,3),c)}})},function(m,f,d){function u(a,b){if(!(a instanceof
b))throw new TypeError("Cannot call a class as a function");}function p(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 q(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)}m=d(23);f=d(45);var a=d(1),c=d(11),n=d(202),v=d(80),t=d(27),l=d(203),k=d(53),g=d(204),e=function(){function a(a,b){for(var c=0;c<b.length;c++){var e=b[c];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(b,c,e){c&&a(b.prototype,c);e&&a(b,e);return b}}(),b=function y(a,b,c){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,b);if(void 0===e){if(a=Object.getPrototypeOf(a),null!==a)return y(a,
b,c)}else{if("value"in e)return e.value;b=e.get;return void 0===b?void 0:b.call(c)}},h=a.k.create(),r=function(a){function d(){u(this,d);return p(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments))}q(d,a);e(d,[{key:"defineShader",value:function(a){b(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"defineShader",this).call(this,a);a.addAttribute("highp vec3","aCenter");a.addAttribute("highp vec3","aRadii")}},{key:"enable",value:function(a,e,g){b(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),
"enable",this).call(this,a,e,function(){var b=a.attribute("aCenter"),d=a.attribute("aRadii"),h=a.gl;e.buffer.bindToVertexAttrib(b,3,c.g,!1,24,e.bufferOffset);e.buffer.bindToVertexAttrib(d,3,c.g,!1,24,e.bufferOffset+12);h.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(b,1);h.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(d,1);g();h.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(b,0);h.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(d,0);h.disableVertexAttribArray(b);h.disableVertexAttribArray(d)})}}]);
return d}(f.a);d=function(b){function c(){u(this,c);var a=p(this,(c.__proto__||Object.getPrototypeOf(c)).apply(this,arguments));a.sphereRenderHelper=a.registerDisposer(new l.a(a.gl,10,10));a.shaderGetter=Object(t.b)(a,a.gl,function(b){a.defineShader(b);a.sphereRenderHelper.defineShader(b);b.addUniform("highp vec4","uLightDirection");b.addUniform("highp mat4","uNormalTransform");b.setVertexMain("\nemitSphere(uProjection, uNormalTransform, aCenter, aRadii, uLightDirection);\n"+a.setPartIndex(b)+";\n");
b.setFragmentMain("\nemitAnnotation(vec4(vColor.rgb * vLightingFactor, vColor.a));\n")});a.tempLightVec=new Float32Array(4);return a}q(c,b);e(c,[{key:"draw",value:function(b){var c=this,e=this.shaderGetter(b.renderContext.emitter);this.enable(e,b,function(){var d=e.gl,g=c.tempLightVec,h=b.renderContext,f=h.ambientLighting;a.s.scale(g,h.lightDirection,h.directionalLighting);g[3]=f;d.uniform4fv(e.uniform("uLightDirection"),g);d.uniformMatrix4fv(e.uniform("uNormalTransform"),!1,a.k.transpose(a.k.create(),
b.annotationLayer.state.globalToObject));c.sphereRenderHelper.draw(e,b.count)})}}]);return c}(r);r=function(b){function c(){u(this,c);var a=p(this,(c.__proto__||Object.getPrototypeOf(c)).apply(this,arguments));a.quadRenderHelper=a.registerDisposer(new v.a(a.gl,1));a.squareCornersBuffer=Object(k.a)(a.gl,-1,-1,1,1,1,1);a.shaderGetter=Object(t.b)(a,a.gl,function(b){a.defineShader(b);b.addUniform("highp mat4","uViewportToObject");b.addUniform("highp mat4","uObjectToViewport");b.addUniform("highp mat4",
"uViewportToDevice");b.addAttribute("highp vec2","aCornerOffset");b.addVarying("highp vec2","vCircleCoord");b.addVertexCode(g.a);b.addVertexCode(n.d);b.addVertexCode(n.c);b.setVertexMain("\nmat3 Aobject = mat3(0.0);\nfor (int i = 0; i < 3; ++i) {\n  Aobject[i][i] = 1.0 / (aRadii[i] * aRadii[i]);\n}\nmat3 RviewportToObject = mat3(uViewportToObject);\nmat3 Aviewport = transpose(RviewportToObject) * Aobject * RviewportToObject;\nvec3 cViewport = (uObjectToViewport * vec4(aCenter, 1.0)).xyz;\nEllipseQuadraticForm quadraticForm = computeCrossSectionEllipse(Aviewport, cViewport);\nvec2 u1, u2;\nfloat a, b;\nCenterOrientEllipse centerOrient = computeCenterOrientEllipse(quadraticForm);\nvec2 viewportCorner = centerOrient.k +\n  centerOrient.u1 * aCornerOffset.x * centerOrient.a +\n  centerOrient.u2 * aCornerOffset.y * centerOrient.b;\ngl_Position = uViewportToDevice * vec4(viewportCorner, 0.0, 1.0);\nvCircleCoord = aCornerOffset;\n"+
a.setPartIndex(b)+";\n");b.setFragmentMain("\nif (dot(vCircleCoord, vCircleCoord) > 1.0) {\n  discard;\n}\nemitAnnotation(vec4(vColor.rgb, 0.5));\n")});return a}q(c,b);e(c,[{key:"draw",value:function(b){var c=this,e=this.shaderGetter(b.renderContext.emitter);this.enable(e,b,function(){var d=e.gl,g=e.attribute("aCornerOffset");c.squareCornersBuffer.bindToVertexAttrib(g,2);var f=a.k.multiply(h,b.annotationLayer.state.globalToObject,b.renderContext.sliceView.viewportToData);d.uniformMatrix4fv(e.uniform("uViewportToObject"),
!1,f);d.uniformMatrix4fv(e.uniform("uViewportToDevice"),!1,b.renderContext.sliceView.viewportToDevice);a.k.invert(h,f);d.uniformMatrix4fv(e.uniform("uObjectToViewport"),!1,h);c.quadRenderHelper.draw(d,b.count);e.gl.disableVertexAttribArray(g)})}}]);return c}(r);Object(f.c)(m.c.ELLIPSOID,{bytes:24,serializer:function(a,b,c){var e=new Float32Array(a,b,6*c);return function(a,b){var c=a.radii;b*=6;e.set(a.center,b);e.set(c,b+3)}},sliceViewRenderHelper:r,perspectiveViewRenderHelper:d,pickIdsPerInstance:1,
snapPosition:function(){}})},function(m,f,d){f.b=function(d,f){d=[[d[0],d[1],d[2]],[d[3],d[4],d[5]],[d[6],d[7],d[8]]];return{A:d[0][0],B:d[0][1]+d[1][0],C:d[1][1],D:-2*f[0]*d[0][0]-f[1]*(d[0][1]+d[1][0])+f[2]*(d[0][2]+d[2][0]),E:-f[0]*(d[0][1]+d[1][0])-2*f[1]*d[1][1]+f[2]*(d[1][2]+d[2][1]),F:f[0]*f[0]*d[0][0]+f[0]*f[1]*(d[0][1]+d[1][0])-f[0]*f[2]*(d[0][2]+d[2][0])+f[1]*f[1]*d[1][1]-f[1]*f[2]*(d[1][2]+d[2][1])+f[2]*f[2]*d[2][2]-1}};f.a=function(d){var f=d.A,a=d.B/2,c=d.C,n=d.D,p=d.E,t=2*(a*a-f*c),
l=(c*n-a*p)/t;n=(f*p-a*n)/t;d=1/(f*l*l+2*a*l*n+c*n*n-d.F);f*=d;a*=d;c*=d;p=f+c;t=Math.sqrt((f-c)*(f-c)+4*a*a);d=(p+t)/2;p=(p-t)/2;t=1/Math.sqrt(d);var k=1/Math.sqrt(p);var g=1E-10>Math.abs(a)?u.r.fromValues(1,0):f>=c?u.r.fromValues(d-c,a):u.r.fromValues(a,d-f);u.r.normalize(g,g);var e=u.r.fromValues(-g[1],g[0]);return{k:u.r.fromValues(l,n),u1:g,u2:e,a:t,b:k,lambda1:d,lambda2:p,m11:f,m12:a,m22:c}};var u=d(1);f.d=["\nstruct EllipseQuadraticForm {\n  highp float A;  // x*x coefficient\n  highp float B;  // x*y coefficient\n  highp float C;  // y*y coefficient\n  highp float D;  // x coefficient\n  highp float E;  // y coefficient\n  highp float F;  // 1 coefficient\n};\n",
"\nEllipseQuadraticForm computeCrossSectionEllipse(mat3 A, vec3 c) {\n  EllipseQuadraticForm p;\n  p.A = A[0][0];\n  p.B = A[0][1] + A[1][0];\n  p.C = A[1][1];\n  p.D = -2.0 * c[0] * A[0][0] - c[1] * (A[0][1] + A[1][0]) +\n        c[2] * (A[0][2] + A[2][0]);\n  p.E = -c[0] * (A[0][1] + A[1][0]) - 2.0 * c[1] * A[1][1] +\n        c[2] * (A[1][2] + A[2][1]);\n  p.F = c[0] * c[0] * A[0][0] + c[0] * c[1] * (A[0][1] + A[1][0]) -\n        c[0] * c[2] * (A[0][2] + A[2][0]) + c[1] * c[1] * A[1][1] -\n        c[1] * c[2] * (A[1][2] + A[2][1]) + c[2] * c[2] * A[2][2] - 1.0;\n  return p;\n}\n"];
f.c=["\nstruct EllipseQuadraticForm {\n  highp float A;  // x*x coefficient\n  highp float B;  // x*y coefficient\n  highp float C;  // y*y coefficient\n  highp float D;  // x coefficient\n  highp float E;  // y coefficient\n  highp float F;  // 1 coefficient\n};\n","\nstruct CenterOrientEllipse {\n  vec2 k;   // center\n  vec2 u1;  // minor axis direction\n  vec2 u2;  // major axis direction\n  float a;  // semimajor axis\n  float b;  // semiminor axis\n};\n","\nCenterOrientEllipse computeCenterOrientEllipse(EllipseQuadraticForm p) {\n  CenterOrientEllipse r;\n  float a11 = p.A;\n  float a12 = p.B / 2.0;\n  float a22 = p.C;\n  float b1 = p.D;\n  float b2 = p.E;\n  float c = p.F;\n  float kdenom = 2.0 * (a12 * a12 - a11 * a22);\n  float k1 = r.k.x = (a22 * b1 - a12 * b2) / kdenom;\n  float k2 = r.k.y = (a11 * b2 - a12 * b1) / kdenom;\n  float mu = 1.0 / (a11 * k1 * k1 + 2.0 * a12 * k1 * k2 + a22 * k2 * k2 - c);\n  float m11 = mu * a11;\n  float m12 = mu * a12;\n  float m22 = mu * a22;\n  float lambdaTerm1 = m11 + m22;\n  float lambdaTerm2 = sqrt((m11 - m22) * (m11 - m22) + 4.0 * m12 * m12);\n  float lambda1 = ((lambdaTerm1 + lambdaTerm2) / 2.0);\n  float lambda2 = ((lambdaTerm1 - lambdaTerm2) / 2.0);\n  r.a = 1.0 / sqrt(lambda1);\n  r.b = 1.0 / sqrt(lambda2);\n  if (abs(m12) < 1e-10) {\n    r.u1 = vec2(1.0, 0.0);\n  } else if (m11 >= m22) {\n    r.u1 = normalize(vec2(lambda1 - m22, m12));\n  } else {\n    r.u1 = normalize(vec2(m12, lambda1 - m11));\n  }\n  r.u2 = vec2(-r.u1.y, r.u1.x);\n  return r;\n}\n"]},
function(m,f,d){function u(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}function p(a,c){for(var d=new Float32Array((a+1)*(c+1)*3),g=0,e=0;e<=a;++e){var b=e*Math.PI/a,h=Math.sin(b);b=Math.cos(b);for(var f=0;f<=c;++f){var l=2*f*Math.PI/c,n=Math.sin(l);
l=Math.cos(l);d[g++]=l*h;d[g++]=b;d[g++]=n*h}}return d}function q(a,c){for(var d=new Uint16Array(a*c*6),g=0,e=0;e<a;e++)for(var b=0;b<c;b++){var h=e*(c+1)+b,f=h+c+1;d[g++]=h;d[g++]=f;d[g++]=h+1;d[g++]=f;d[g++]=f+1;d[g++]=h+1}return d}d.d(f,"a",function(){return v});m=d(0);var a=d(16),c=d(11),n=function(){function a(a,c){for(var d=0;d<c.length;d++){var e=c[d];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(c,d,g){d&&a(c.prototype,
d);g&&a(c,g);return c}}(),v=function(d){function f(d,g,e){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var 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.vertexBuffer=b.registerDisposer(Object(a.b)(d,c.a,p,g,e)).value;b.indexBuffer=b.registerDisposer(Object(a.b)(d,c.f,q,g,e)).value;b.numIndices=g*e*6;return b}
u(f,d);n(f,[{key:"defineShader",value:function(a){a.addAttribute("highp vec3","aSphereVertex");a.addVarying("highp float","vLightingFactor");a.addVertexCode("\nvoid emitSphere(mat4 projectionMatrix, mat4 normalTransformMatrix, vec3 centerPosition, vec3 radii, vec4 lightDirection) {\n  vec3 vertexPosition = aSphereVertex * radii + centerPosition;\n  gl_Position = projectionMatrix * vec4(vertexPosition, 1.0);\n  vec3 normal = normalize((normalTransformMatrix * vec4(aSphereVertex / radii, 0.0)).xyz);\n  vLightingFactor = abs(dot(normal, uLightDirection.xyz)) + uLightDirection.w;\n}\n")}},
{key:"draw",value:function(a,d){var e=a.attribute("aSphereVertex");this.vertexBuffer.bindToVertexAttrib(e,3,c.g,!1);this.indexBuffer.bind();a.gl.ANGLE_instanced_arrays.drawElementsInstancedANGLE(c.C,this.numIndices,c.H,0,d);a.gl.disableVertexAttribArray(e)}}]);return f}(m.a)},function(m,f,d){f.a="\nmat3 transpose(mat3 m) {\n  mat3 result;\n  for (int i = 0; i < 3; ++i) {\n    for (int j = 0; j < 3; ++j) {\n      result[i][j] = m[j][i];\n    }\n  }\n  return result;\n}\n"},function(m,f,d){f.a=function(d){var f=
{antialias:!1,stencil:!0};d=d.getContext("webgl",f)||d.getContext("experimental-webgl",f);if(null==d)throw Error("WebGL not supported.");d.memoize=new u.a;d.maxTextureSize=d.getParameter(d.MAX_TEXTURE_SIZE);d.maxTextureImageUnits=d.getParameter(d.MAX_TEXTURE_IMAGE_UNITS);d.tempTextureUnit=d.maxTextureImageUnits-1;d.WEBGL_draw_buffers=d.getExtension("WEBGL_draw_buffers");if(!d.WEBGL_draw_buffers)throw Error("WEBGL_draw_buffers extension not available");d.ANGLE_instanced_arrays=d.getExtension("ANGLE_instanced_arrays");
if(!d.ANGLE_instanced_arrays)throw Error("ANGLE_instanced_ararys extension not available");f=$jscomp.makeIterator(["OES_texture_float","OES_element_index_uint"]);for(var a=f.next();!a.done;a=f.next())if(a=a.value,!d.getExtension(a))throw Error(a+" extension not available");return d};var u=d(64)},function(m,f,d){var u=function(){function d(d,a){for(var c=0;c<a.length;c++){var f=a[c];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(d,f.key,f)}}return function(f,
a,c){a&&d(f.prototype,a);c&&d(f,c);return f}}();m=function(){function d(){if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");}u(d,null,[{key:"insertAfter",value:function(d,a){var c=d.next0;a.next0=c;a.prev0=d;d.next0=a;c.prev0=a}},{key:"insertBefore",value:function(d,a){var c=d.prev0;a.prev0=c;a.next0=d;d.prev0=a;c.next0=a}},{key:"front",value:function(d){var a=d.next0;return a===d?null:a}},{key:"back",value:function(d){var a=d.prev0;return a===d?null:a}},{key:"pop",
value:function(d){var a=d.next0,c=d.prev0;a.prev0=c;c.next0=a;d.next0=null;d.prev0=null;return d}},{key:"iterator",value:function(d){function a(a,l){for(;;)switch(c){case 0:f=d.next0;case 1:if(f===d){c=3;break}c=4;return{value:f,done:!1};case 4:if(void 0===l){c=5;break}c=-1;throw l;case 5:case 2:f=f.next0;c=1;break;case 3:c=-1;default:return{value:void 0,done:!0}}}var c=0,f,p={next:function(c){return a(c,void 0)},throw:function(c){return a(void 0,c)},return:function(a){throw Error("Not yet implemented");
}};$jscomp.initSymbolIterator();p[Symbol.iterator]=function(){return this};return p}},{key:"reverseIterator",value:function(d){function a(a,l){for(;;)switch(c){case 0:f=d.prev0;case 1:if(f===d){c=3;break}c=4;return{value:f,done:!1};case 4:if(void 0===l){c=5;break}c=-1;throw l;case 5:case 2:f=f.prev0;c=1;break;case 3:c=-1;default:return{value:void 0,done:!0}}}var c=0,f,p={next:function(c){return a(c,void 0)},throw:function(c){return a(void 0,c)},return:function(a){throw Error("Not yet implemented");
}};$jscomp.initSymbolIterator();p[Symbol.iterator]=function(){return this};return p}},{key:"initializeHead",value:function(d){d.next0=d.prev0=d}}]);return d}();f.a=m},function(m,f,d){d.d(f,"a",function(){return p});var u=function(){function d(a,c){for(var d=0;d<c.length;d++){var f=c[d];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}return function(a,c,f){c&&d(a.prototype,c);f&&d(a,f);return a}}(),p=function(){function d(a){if(!(this instanceof
d))throw new TypeError("Cannot call a class as a function");this.parents=[];this.parentPriorities=[];this.bindings=new Map;if(void 0!==a){this.parents.push.apply(this.parents,[].concat($jscomp.arrayFromIterable(a.parents)));this.parentPriorities.push.apply(this.parentPriorities,[].concat($jscomp.arrayFromIterable(a.parentPriorities)));a=$jscomp.makeIterator(a.bindings);for(var c=a.next();!c.done;c=a.next()){var f=$jscomp.makeIterator(c.value);c=f.next().value;f=f.next().value;this.bindings.set(c,
f)}}}u(d,[{key:"addParent",value:function(a,c){for(var d=this,f=this.parents,t=this.parentPriorities,l=0,k=f.length;l<k&&c<t[l];)++l;f.splice(l,0,a);t.splice(l,0,c);return function(){d.removeParent(a)}}},{key:"removeParent",value:function(a){a=this.parents.indexOf(a);if(-1===a)throw Error("Attempt to remove non-existent parent map.");this.parents.splice(a,1);this.parentPriorities.splice(a,1)}},{key:"set",value:function(a,c){this.bindings.set(a,c)}},{key:"delete",value:function(a){this.bindings.delete(a)}},
{key:"clear",value:function(){this.bindings.clear();this.parents.length=0;this.parentPriorities.length=0}},{key:"get",value:function(a){for(var c=this.parents,d=this.parentPriorities,f=d.length,t=0,l;t<f&&0<d[t];++t)if(l=c[t].get(a),void 0!==l)return l;l=this.bindings.get(a);if(void 0!==l)return l;for(;t<f;++t)if(l=c[t].get(a),void 0!==l)return l}},{key:"getAll",value:function(a){function c(c,h){for(;;)switch(d){case 0:e=b,g=e.parents,k=e.parentPriorities,l=k.length,t=0;case 1:if(!(t<l&&0<k[t])){d=
2;break}f=g[t].get(a);if(void 0===f){d=3;break}d=4;return{value:f,done:!1};case 4:if(void 0===h){d=5;break}d=-1;throw h;case 5:case 3:d=1;break;case 2:f=b.bindings.get(a);if(void 0===f){d=6;break}d=7;return{value:f,done:!1};case 7:if(void 0===h){d=8;break}d=-1;throw h;case 8:case 6:case 9:if(!(t<l)){d=10;break}f=g[t].get(a);if(void 0===f){d=11;break}d=12;return{value:f,done:!1};case 12:if(void 0===h){d=13;break}d=-1;throw h;case 13:case 11:d=9;break;case 10:d=-1;default:return{value:void 0,done:!0}}}
var d=0,f,t,l,k,g,e,b=this,h={next:function(a){return c(a,void 0)},throw:function(a){return c(void 0,a)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();h[Symbol.iterator]=function(){return this};return h}}]);return d}()},function(m,f,d){f.a=function(d){var f=0;switch(d.deltaMode){case 0:f=.005;break;case 1:f=.1;break;case 2:f=2}return Math.exp(d.deltaY*f)}},function(m,f){},function(m,f,d){function u(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+
typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}function p(c,d){var f=c.memoize.get({type:"getSharedCredentialsProvider",credentialsProvider:Object(a.a)(d)},function(){return new q.a(d.addRef(),c.rpc)}),k=f.addCounterpartRef();f.dispose();return k}f.a=function(){return function(d){return function(d){function f(a){for(var c=[],e=0;e<arguments.length;++e)c[e-0]=arguments[e];
if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var b;e=(b=f.__proto__||Object.getPrototypeOf(f)).call.apply(b,[].concat([this],$jscomp.arrayFromIterable(c)));if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");b=!e||"object"!==typeof e&&"function"!==typeof e?this:e;b.credentialsProvider=c[1].credentialsProvider.addRef();return b}u(f,d);c(f,[{key:"initializeCounterpart",value:function(a,c){c.credentialsProvider=p(this.chunkManager,
this.credentialsProvider);n(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"initializeCounterpart",this).call(this,a,c)}}],[{key:"encodeOptions",value:function(c){var d=n(f.__proto__||Object.getPrototypeOf(f),"encodeOptions",this).call(this,c);d.credentialsProvider=Object(a.a)(c.credentialsProvider);return d}}]);return f}(d)}};var q=d(211),a=d(25),c=function(){function a(a,c){for(var d=0;d<c.length;d++){var g=c[d];g.enumerable=g.enumerable||!1;g.configurable=!0;"value"in g&&(g.writable=
!0);Object.defineProperty(a,g.key,g)}}return function(c,d,f){d&&a(c.prototype,d);f&&a(c,f);return c}}(),n=function t(a,c,d){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,c);if(void 0===e){if(a=Object.getPrototypeOf(a),null!==a)return t(a,c,d)}else{if("value"in e)return e.value;c=e.get;return void 0===c?void 0:c.call(d)}}},function(m,f,d){function u(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);
a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}d.d(f,"a",function(){return q});m=d(212);d=d(12);var p=function(){function a(a,d){for(var c=0;c<d.length;c++){var f=d[c];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}return function(c,d,f){d&&a(c.prototype,d);f&&a(c,f);return c}}();f=this&&this.__decorate||function(a,
c,d,f){var n=arguments.length,l=3>n?c:null===f?f=Object.getOwnPropertyDescriptor(c,d):f,k;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)l=Reflect.decorate(a,c,d,f);else for(var g=a.length-1;0<=g;g--)if(k=a[g])l=(3>n?k(l):3<n?k(c,d,l):k(c,d))||l;return 3<n&&l&&Object.defineProperty(c,d,l),l};var q=function(a){function c(a,d){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");var f=(c.__proto__||Object.getPrototypeOf(c)).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
f=!f||"object"!==typeof f&&"function"!==typeof f?this:f;f.provider=a;f.registerDisposer(a);f.initializeCounterpart(d);return f}u(c,a);p(c,[{key:"get",value:function(a,c){return this.provider.get(a,c)}}]);return c}(d.b);q=f([Object(d.g)(m.b)],q);Object(d.d)(m.a,function(a,c){return this.get(a.providerId).get(a.invalidCredentials,c).then(function(a){return{value:a}})})},function(m,f,d){f.b="CredentialsProvider";f.a="CredentialsProvider.get"},function(m,f,d){f.a=function(d){for(var f=0,m=d.length,a=
0;a<m;++a)f=31*f+d.charCodeAt(a)|0;return f}},function(m,f,d){function u(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}function p(a,c){if(!(a instanceof c))throw new TypeError("Cannot call a class as a function");}d.d(f,"d",function(){return q});
d.d(f,"e",function(){return a});d.d(f,"b",function(){return c});d.d(f,"c",function(){return n});d.d(f,"a",function(){return v});var q;(function(a){a[a.RAW=0]="RAW";a[a.JPEG=1]="JPEG";a[a.COMPRESSED_SEGMENTATION=2]="COMPRESSED_SEGMENTATION"})(q||(q={}));var a=function l(){p(this,l)};a.RPC_ID="brainmaps/VolumeChunkSource";var c=function k(){p(this,k)};c.RPC_ID="brainmaps/MeshSource";var n=function(a){function c(){p(this,c);var a=(c.__proto__||Object.getPrototypeOf(c)).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}u(c,a);return c}(c);n.RPC_ID="brainmaps/SkeletonSource";var v=function g(){p(this,g)};v.RPC_ID="brainmaps/Annotation"},function(m,f,d){f.b="mesh/MeshLayer";f.a="mesh/FragmentSource"},function(m,f,d){f.a="skeleton/SkeletonLayer"},function(m,f,d){Object.defineProperty(f,"__esModule",{value:!0});var u=d(102),p=d(122);m=d(32);Object(m.b)("brainmaps",function(d){return new u.BrainmapsDataSource(u.productionInstance,d.credentialsManager.getCredentialsProvider(p.a))})},
function(m,f,d){Object.defineProperty(f,"__esModule",{value:!0});var u=d(85);m=d(32);Object(m.b)("ndstore",function(){return new u.NDStoreDataSource})},function(m,f,d){function u(a,c){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!c||"object"!==typeof c&&"function"!==typeof c?a:c}function p(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&
c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}function q(a,c){if(!(a instanceof c))throw new TypeError("Cannot call a class as a function");}d.d(f,"c",function(){return a});d.d(f,"d",function(){return c});d.d(f,"b",function(){return n});d.d(f,"a",function(){return v});var a;(function(a){a[a.JPEG=0]="JPEG";a[a.COMPRESSED_SEGMENTATION=1]="COMPRESSED_SEGMENTATION"})(a||(a={}));m=function l(){q(this,l)};
var c=function(a){function c(){q(this,c);return u(this,(c.__proto__||Object.getPrototypeOf(c)).apply(this,arguments))}p(c,a);return c}(m);c.RPC_ID="dvid/VolumeChunkSource";var n;(function(a){a[a.JPEG=0]="JPEG"})(n||(n={}));var v=function(a){function c(){q(this,c);return u(this,(c.__proto__||Object.getPrototypeOf(c)).apply(this,arguments))}p(c,a);return c}(m);v.RPC_ID="dvid/TileChunkSource"},function(m,f,d){Object.defineProperty(f,"__esModule",{value:!0});var u=d(125);m=d(32);Object(m.b)("dvid",function(){return new u.DVIDDataSource})},
function(m,f,d){function u(a,c){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!c||"object"!==typeof c&&"function"!==typeof c?a:c}function p(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}function q(a,
c){if(!(a instanceof c))throw new TypeError("Cannot call a class as a function");}d.d(f,"b",function(){return a});d.d(f,"a",function(){return c});m=function(a){function c(){q(this,c);return u(this,(c.__proto__||Object.getPrototypeOf(c)).apply(this,arguments))}p(c,a);return c}(function v(){q(this,v)});var a=function(a){function c(){q(this,c);return u(this,(c.__proto__||Object.getPrototypeOf(c)).apply(this,arguments))}p(c,a);return c}(m);a.RPC_ID="render/TileChunkSource";var c=function(a){function c(){q(this,
c);return u(this,(c.__proto__||Object.getPrototypeOf(c)).apply(this,arguments))}p(c,a);return c}(m);c.RPC_ID="render/PointMatchSource"},function(m,f,d){Object.defineProperty(f,"__esModule",{value:!0});m=d(32);var u=d(126);Object(m.b)("render",function(){return new u.RenderDataSource})},function(m,f,d){Object.defineProperty(f,"__esModule",{value:!0});var u=d(129);m=d(32);Object(m.b)("openconnectome",function(){return new u.OpenConnectomeDataSource})},function(m,f,d){function u(a,d){if(!(a instanceof
d))throw new TypeError("Cannot call a class as a function");}d.d(f,"b",function(){return p});d.d(f,"c",function(){return q});d.d(f,"a",function(){return a});var p;(function(a){a[a.RAW=0]="RAW";a[a.JPEG=1]="JPEG";a[a.COMPRESSED_SEGMENTATION=2]="COMPRESSED_SEGMENTATION"})(p||(p={}));var q=function n(){u(this,n)};q.RPC_ID="precomputed/VolumeChunkSource";var a=function v(){u(this,v)};a.RPC_ID="precomputed/MeshSource"},function(m,f,d){Object.defineProperty(f,"__esModule",{value:!0});var u=d(130);m=d(32);
Object(m.b)("precomputed",function(){return new u.PrecomputedDataSource})},function(m,f,d){d.d(f,"b",function(){return p});f.a="nifti/getNiftiVolumeInfo";var u;(function(d){d[d.NONE=0]="NONE";d[d.BINARY=1]="BINARY";d[d.UINT8=2]="UINT8";d[d.INT16=4]="INT16";d[d.INT32=8]="INT32";d[d.FLOAT32=16]="FLOAT32";d[d.COMPLEX64=32]="COMPLEX64";d[d.FLOAT64=64]="FLOAT64";d[d.RGB24=128]="RGB24";d[d.INT8=256]="INT8";d[d.UINT16=512]="UINT16";d[d.UINT32=768]="UINT32";d[d.INT64=1024]="INT64";d[d.UINT64=1280]="UINT64";
d[d.FLOAT128=1536]="FLOAT128";d[d.COMPLEX128=1792]="COMPLEX128";d[d.COMPLEX256=2048]="COMPLEX256"})(u||(u={}));var p=function a(){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");};p.RPC_ID="nifti/VolumeChunkSource"},function(m,f,d){Object.defineProperty(f,"__esModule",{value:!0});var u=d(131);m=d(32);Object(m.b)("nifti",function(){return new u.NiftiDataSource})},function(m,f){},function(m,f){},function(m,f,d){function u(a,c){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!c||"object"!==typeof c&&"function"!==typeof c?a:c}function p(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}function q(a,c){if(!(a instanceof c))throw new TypeError("Cannot call a class as a function");}d.d(f,"c",function(){return a});d.d(f,
"d",function(){return c});d.d(f,"a",function(){return n});d.d(f,"b",function(){return v});var a;(function(a){a[a.JPEG=0]="JPEG";a[a.NPZ=1]="NPZ";a[a.RAW=2]="RAW"})(a||(a={}));m=function l(){q(this,l)};var c=function(a){function c(){q(this,c);return u(this,(c.__proto__||Object.getPrototypeOf(c)).apply(this,arguments))}p(c,a);return c}(m);c.RPC_ID="python/VolumeChunkSource";var n=function(a){function c(){q(this,c);return u(this,(c.__proto__||Object.getPrototypeOf(c)).apply(this,arguments))}p(c,a);return c}(m);
n.RPC_ID="python/MeshSource";var v=function(a){function c(){q(this,c);return u(this,(c.__proto__||Object.getPrototypeOf(c)).apply(this,arguments))}p(c,a);return c}(m);v.RPC_ID="python/SkeletonSource"},function(m,f,d){function u(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(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 q(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){return new b.a({shaderError:a.shaderError,fragmentMain:a.fragmentMain,fragmentMainStartLine:v.a})}Object.defineProperty(f,"__esModule",{value:!0});d.d(f,"ImageUserLayer",function(){return y});m=d(15);f=d(21);
var c=d(42),n=d(19),v=d(233),t=d(49),l=d(134),k=d(135),g=d(48),e=d(71),b=d(90),h=d(35),r=function(){function a(a,b){for(var c=0;c<b.length;c++){var e=b[c];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(b,c,e){c&&a(b.prototype,c);e&&a(b,e);return b}}(),A=function D(a,b,c){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,b);if(void 0===e){if(a=Object.getPrototypeOf(a),null!==a)return D(a,b,c)}else{if("value"in
e)return e.value;b=e.get;return void 0===b?void 0:b.call(c)}};d(143);d(144);var y=function(a){function b(a,c){u(this,b);var e=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,c));e.opacity=Object(t.a)(.5);e.blendMode=Object(l.c)();e.fragmentMain=Object(v.c)();e.shaderError=Object(g.c)();e.registerDisposer(e.fragmentMain.changed.add(e.specificationChanged.dispatch));e.tabs.add("rendering",{label:"Rendering",order:-100,getter:function(){return new z(e)}});e.tabs.default="rendering";return e}
q(b,a);r(b,[{key:"restoreState",value:function(a){var c=this;A(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"restoreState",this).call(this,a);this.opacity.restoreState(a.opacity);this.blendMode.restoreState(a.blend);this.fragmentMain.restoreState(a.shader);a=this.multiscaleSource;if(void 0===a)throw Error("source property must be specified");a.then(function(a){c.wasDisposed||(a=c.renderLayer=new v.b(a,{opacity:c.opacity,blendMode:c.blendMode,fragmentMain:c.fragmentMain,shaderError:c.shaderError,
transform:c.transform}),c.addRenderLayer(a),c.shaderError.changed.dispatch(),c.isReady=!0)})}},{key:"toJSON",value:function(){var a=A(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"toJSON",this).call(this);a.type="image";a.opacity=this.opacity.toJSON();a.blend=this.blendMode.toJSON();a.shader=this.fragmentMain.toJSON();return a}}]);return b}(Object(k.a)(m.i)),z=function(b){function c(b){u(this,c);var d=p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));d.layer=b;d.opacityWidget=
d.registerDisposer(new e.a(d.layer.opacity));d.codeWidget=d.registerDisposer(a(d.layer));b=d.element;b.classList.add("image-dropdown");var g=d.opacityWidget,h=document.createElement("div");h.className="image-dropdown-top-row";g.promptElement.textContent="Opacity";g=document.createElement("div");g.style.flex="1";var f=document.createElement("a"),k=document.createElement("button");k.type="button";k.textContent="?";k.className="help-link";f.appendChild(k);f.title="Documentation on image layer rendering";
f.target="_blank";f.href="https://github.com/google/neuroglancer/blob/master/src/neuroglancer/sliceview/image_layer_rendering.md";k=document.createElement("button");k.innerHTML="&square;";k.className="maximize-button";k.title="Show larger editor view";d.registerEventListener(k,"click",function(){new E(d.layer)});h.appendChild(d.opacityWidget.element);h.appendChild(g);h.appendChild(k);h.appendChild(f);b.appendChild(h);b.appendChild(d.codeWidget.element);d.codeWidget.textEditor.refresh();d.visibility.changed.add(function(){d.visible&&
d.codeWidget.textEditor.refresh()});return d}q(c,b);return c}(h.b),E=function(b){function c(b){u(this,c);var e=p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));e.layer=b;e.codeWidget=e.registerDisposer(a(e.layer));e.content.classList.add("image-layer-shader-overlay");e.content.appendChild(e.codeWidget.element);e.codeWidget.textEditor.refresh();return e}q(c,b);return c}(c.a);Object(f.e)("image",y);Object(f.f)(n.c.IMAGE,y)},function(m,f){},function(m,f,d){function u(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 p(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 q(a){return Object(v.b)(void 0===a?"void main() {\n  emitGrayscale(toNormalized(getDataValue()));\n}\n":a)}f.c=q;d.d(f,
"b",function(){return g});m=d(133);var a=d(49),c=d(134),n=d(2),v=d(48),t=function(){function a(a,c){for(var b=0;b<c.length;b++){var e=c[b];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(b,c,e){c&&a(b.prototype,c);e&&a(b,e);return b}}(),l=function b(a,c,d){null===a&&(a=Function.prototype);var g=Object.getOwnPropertyDescriptor(a,c);if(void 0===g){if(a=Object.getPrototypeOf(a),null!==a)return b(a,c,d)}else{if("value"in g)return g.value;
c=g.get;return void 0===c?void 0:c.call(d)}};f.a="//NEUROGLANCER_IMAGE_RENDERLAYER_FRAGMENT_MAIN_START";var k=d(84),g=function(b){function d(b,g){g=void 0===g?{}:g;if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");var h=u(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,g)),f=g;b=void 0===f.opacity?Object(a.a)(.5):f.opacity;g=void 0===f.blendMode?Object(c.c)():f.blendMode;f=void 0===f.fragmentMain?q():f.fragmentMain;h.fragmentMain=f;h.opacity=b;h.blendMode=g;
h.registerDisposer(b.changed.add(function(){h.redrawNeeded.dispatch()}));h.registerDisposer(f.changed.add(function(){h.shaderGetter.invalidateShader();h.redrawNeeded.dispatch()}));return h}p(d,b);t(d,[{key:"getShaderKey",value:function(){return"volume.ImageRenderLayer:"+JSON.stringify(this.fragmentMain.value)}},{key:"defineShader",value:function(a){l(d.prototype.__proto__||Object.getPrototypeOf(d.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(k);a.setFragmentMainFunction("//NEUROGLANCER_IMAGE_RENDERLAYER_FRAGMENT_MAIN_START\n"+this.fragmentMain.value)}},{key:"beginSlice",value:function(a){a=l(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"beginSlice",this).call(this,a);if(void 0!==a)return this.gl.uniform1f(a.uniform("uOpacity"),this.opacity.value),a}},{key:"setGLBlendMode",value:function(a,b){var d=Object(n.m)(this.blendMode.value,c.b);if(d===c.b.ADDITIVE||0<b)a.enable(a.BLEND),c.a.get(d)(a)}}]);return d}(m.a)},
function(m,f){},function(m,f){},function(m,f,d){function u(a,c){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!c||"object"!==typeof c&&"function"!==typeof c?a:c}function p(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,
c):a.__proto__=c)}d.d(f,"a",function(){return n});m=d(0);var q=d(10),a=function(){function a(a,c){for(var d=0;d<c.length;d++){var g=c[d];g.enumerable=g.enumerable||!1;g.configurable=!0;"value"in g&&(g.writable=!0);Object.defineProperty(a,g.key,g)}}return function(c,d,f){d&&a(c.prototype,d);f&&a(c,f);return c}}(),c=function t(a,c,d){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,c);if(void 0===e){if(a=Object.getPrototypeOf(a),null!==a)return t(a,c,d)}else{if("value"in e)return e.value;
c=e.get;return void 0===c?void 0:c.call(d)}},n=function(d){function f(a){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var c=u(this,(f.__proto__||Object.getPrototypeOf(f)).call(this));c.model=a;c.element=document.createElement("input");var e=c.element;e.classList.add("neuroglancer-color-widget");e.type="color";e.addEventListener("change",function(){return c.updateModel()});c.registerDisposer(a.changed.add(function(){return c.updateView()}));c.updateView();return c}
p(f,d);a(f,[{key:"updateView",value:function(){this.element.value=this.model.toString()}},{key:"updateModel",value:function(){this.model.restoreState(this.element.value)}},{key:"disposed",value:function(){Object(q.b)(this.element);c(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"disposed",this).call(this)}}]);return f}(m.a)},function(m,f){},function(m,f){},function(m,f,d){function u(a,c){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!c||
"object"!==typeof c&&"function"!==typeof c?a:c}function p(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}d.d(f,"a",function(){return c});m=d(240);d.n(m);m=d(35);var q=d(137),a=function(){function a(a,c){for(var d=0;d<c.length;d++){var f=c[d];f.enumerable=
f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}return function(c,d,f){d&&a(c.prototype,d);f&&a(c,f);return c}}(),c=function(c){function d(a){if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");var c=u(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));c.transform=a;c.textArea=document.createElement("textarea");c.modelGeneration=-1;var f=c.element;f.classList.add("neuroglancer-coordinate-transform-widget");var g=
c.textArea,e=document.createElement("label");e.className="neuroglancer-coordinate-transform-widget-homogeneous";e.textContent="3\u00d74 Homogeneous transformation matrix";e.appendChild(g);f.appendChild(e);c.registerDisposer(a.changed.add(function(){return c.updateView()}));c.registerDisposer(c.visibility.changed.add(function(){return c.updateView()}));g.addEventListener("change",function(){return c.updateModel()});g.addEventListener("blur",function(){return c.updateModel()});g.title="Homogeneous transformation matrix";
g.rows=3;a=document.createElement("button");a.textContent="Reset to identity";a.addEventListener("click",function(){return c.transform.reset()});f.appendChild(a);c.updateView();return c}p(d,c);a(d,[{key:"updateView",value:function(){if(this.visible){var a=this.transform.changed.count;if(this.modelGeneration!==a){for(var c="",d=this.transform.transform,g=0;3>g;++g){0!==g&&(c+="\n");for(var e=0;4>e;++e){var b=d[4*e+g];0!==e&&(c+=" ");c+=Object(q.a)(b)}}this.textArea.value=c;this.modelGeneration=a}}}},
{key:"updateModel",value:function(){var a=this.textArea.value.split(/[\s,\[\]\(\)\{\}]/).filter(function(a){return 0<a.length});if(12===a.length){for(var c=[],d=0;12>d;++d){var g=parseFloat(a[d]);if(Number.isNaN(g))return!1;c[d]=g}a=this.transform.transform;a[3]=a[7]=a[10]=0;a[15]=1;for(d=0;4>d;++d)for(g=0;3>g;++g)a[4*d+g]=c[d+4*g];this.transform.changed.dispatch();return!0}return!1}}]);return d}(m.b)},function(m,f){},function(m,f,d){(function(d){function f(a,c){function b(a){if(!e.parentNode)return d.off(document,
"mousemove",b);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(c.cloneNode(!0));document.body.appendChild(e);d.on(document,"mousemove",b);b(a);null!=e.style.opacity&&(e.style.opacity=1);return e}function m(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 a(a,c,e){function b(){d.off(e,"mouseout",b);g&&(m(g),g=null)}var g=f(a,c),h=setInterval(function(){if(g)for(var a=e;;a=a.parentNode){a&&11==a.nodeType&&(a=a.host);if(a==document.body)return;if(!a){b();break}}if(!g)return clearInterval(h)},400);d.on(e,"mouseout",b)}function c(b,c,e){this.marked=[];this.options=c;this.timeout=null;this.hasGutter=e;this.onMouseOver=function(c){var e=c.target||c.srcElement;if(/\bCodeMirror-lint-mark-/.test(e.className)){e=e.getBoundingClientRect();var d=b.findMarksAt(b.coordsChar({left:(e.left+
e.right)/2,top:(e.top+e.bottom)/2},"client"));e=[];for(var g=0;g<d.length;++g){var h=d[g].__annotation;h&&e.push(h)}if(e.length){d=c.target||c.srcElement;g=document.createDocumentFragment();for(h=0;h<e.length;h++)g.appendChild(t(e[h]));a(c,g,d)}}};this.waitingFor=0}function n(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 u(b,c,e,g){var h=document.createElement("div"),f=h;h.className="CodeMirror-lint-marker-"+
c;e&&(f=h.appendChild(document.createElement("div")),f.className="CodeMirror-lint-marker-multiple");if(0!=g)d.on(f,"mouseover",function(c){a(c,b,f)});return h}function t(a){var b=a.severity;b||(b="error");var c=document.createElement("div");c.className="CodeMirror-lint-message-"+b;"undefined"!=typeof a.messageHTML?c.innerHTML=a.messageHTML:c.appendChild(document.createTextNode(a.message));return c}function l(a,c,e){function b(){f=-1;a.off("change",b)}var h=a.state.lint,f=++h.waitingFor;a.on("change",
b);c(a.getValue(),function(c,e){a.off("change",b);h.waitingFor==f&&(e&&c instanceof d&&(c=e),g(a,c))},e,a)}function k(a){var b=a.state.lint.options,c=b.options||b,e=b.getAnnotations||a.getHelper(d.Pos(0,0),"lint");e&&(b.async||e.async?l(a,e,c):(b=e(a.getValue(),c,a))&&(b.then?b.then(function(b){g(a,b)}):g(a,b)))}function g(a,c){n(a);for(var b=a.state.lint,e=b.options,d=[],g=0;g<c.length;++g){var h=c[g],f=h.from.line;(d[f]||(d[f]=[])).push(h)}for(g=0;g<d.length;++g)if(h=d[g]){f=null;for(var k=b.hasGutter&&
document.createDocumentFragment(),l=0;l<h.length;++l){var p=h[l],m=p.severity;m||(m="error");"error"!=f&&(f=m);e.formatAnnotation&&(p=e.formatAnnotation(p));b.hasGutter&&k.appendChild(t(p));p.to&&b.marked.push(a.markText(p.from,p.to,{className:"CodeMirror-lint-mark-"+m,__annotation:p}))}b.hasGutter&&a.setGutterMarker(g,"CodeMirror-lint-markers",u(k,f,1<h.length,b.options.tooltips))}if(e.onUpdateLinting)e.onUpdateLinting(c,d,a)}function e(a){var b=a.state.lint;b&&(clearTimeout(b.timeout),b.timeout=
setTimeout(function(){k(a)},b.options.delay||500))}d.defineOption("lint",!1,function(a,g,f){f&&f!=d.Init&&(n(a),!1!==a.state.lint.options.lintOnChange&&a.off("change",e),d.off(a.getWrapperElement(),"mouseover",a.state.lint.onMouseOver),clearTimeout(a.state.lint.timeout),delete a.state.lint);if(g){var b=a.getOption("gutters");f=!1;for(var h=0;h<b.length;++h)"CodeMirror-lint-markers"==b[h]&&(f=!0);b=a.state;g instanceof Function?g={getAnnotations:g}:g&&!0!==g||(g={});f=b.lint=new c(a,g,f);if(!1!==f.options.lintOnChange)a.on("change",
e);if(0!=f.options.tooltips&&"gutter"!=f.options.tooltips)d.on(a.getWrapperElement(),"mouseover",f.onMouseOver);k(a)}});d.defineExtension("performLint",function(){this.state.lint&&k(this)})})(d(43))},function(m,f){},function(m,f){m.exports=function(d){function f(a){var c={};a=a.split(" ");for(var d=0;d<a.length;++d)c[a[d]]=!0;return c}d.defineMode("glsl",function(a,c){function d(a,c){var e=a.next();if(y[e]){var d=y[e](a,c);if(!1!==d)return d}if('"'==e||"'"==e)return c.tokenize=q(e),c.tokenize(a,c);
if(/[\[\]{}\(\),;\:\.]/.test(e))return x=e,"bracket";if(/\d/.test(e))return a.eatWhile(/[\w\.]/),"number";if("/"==e){if(a.eat("*"))return c.tokenize=t,t(a,c);if(a.eat("/"))return a.skipToEnd(),"comment"}if("#"==e)return a.eatWhile(/[\S]+/),a.eatWhile(/[\s]+/),a.eatWhile(/[\S]+/),a.eatWhile(/[\s]+/),"comment";if(E.test(e))return a.eatWhile(E),"operator";a.eatWhile(/[\w\$_]/);a=a.current();return b.propertyIsEnumerable(a)?(r.propertyIsEnumerable(a)&&(x="newstatement"),"keyword"):h.propertyIsEnumerable(a)?
"builtin":u.propertyIsEnumerable(a)?"atom":"word"}function q(a){return function(b,c){for(var e=!1,g,h=!1;null!=(g=b.next());){if(g==a&&!e){h=!0;break}e=!e&&"\\"==g}if(h||!e&&!z)c.tokenize=d;return"string"}}function t(a,b){for(var c=!1,e;e=a.next();){if("/"==e&&c){b.tokenize=d;break}c="*"==e}return"comment"}function l(a,b,c,e,d){this.indented=a;this.column=b;this.type=c;this.align=e;this.prev=d}function k(a,b,c){return a.context=new l(a.indented,b,c,null,a.context)}function g(a){var b=a.context.type;
if(")"==b||"]"==b||"}"==b)a.indented=a.context.indented;return a.context=a.context.prev}var e=a.indentUnit,b=c.keywords||f(p),h=c.builtins||f(m),r=c.blockKeywords||f("case do else for if switch while struct"),u=c.atoms||f("null"),y=c.hooks||{},z=c.multiLineStrings,E=/[+\-*&%=<>!?|\/]/,x;return{startState:function(a){return{tokenize:null,context:new l((a||0)-e,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;x=null;var e=(b.tokenize||d)(a,b);if("comment"==e||"meta"==e)return e;null==c.align&&(c.align=!0);if(";"!=x&&":"!=x||"statement"!=c.type)if("{"==x)k(b,a.column(),"}");else if("["==x)k(b,a.column(),"]");else if("("==x)k(b,a.column(),")");else if("}"==x){for(;"statement"==c.type;)c=g(b);for("}"==c.type&&(c=g(b));"statement"==c.type;)c=g(b)}else x==c.type?g(b):("}"==c.type||"top"==c.type||"statement"==c.type&&"newstatement"==x)&&k(b,a.column(),"statement");
else g(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:e):a.align?a.column+(c?0:1):a.indented+(c?0:e)},electricChars:"{}"}});var p="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",
m="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";d.defineMIME("text/x-glsl",{name:"glsl",keywords:f(p),builtins:f(m),blockKeywords:f("case do else for if switch while struct"),
atoms:f("null"),hooks:{"#":function(a,c){if(!c.startOfLine)return!1;a.skipToEnd();return"meta"}}})}},function(m,f,d){function u(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(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 q(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,c,e){e=void 0===e?{}:e;return v.a.forPromise(new Promise(function(d){d(a.getVectorGraphicsSource(b,c,e))}),{initialMessage:"Retrieving metadata for vector graphics source "+c+".",delay:!0,errorPrefix:"Error retrieving metadata for vector graphics source "+c+": "})}Object.defineProperty(f,"__esModule",
{value:!0});d.d(f,"VectorGraphicsUserLayer",function(){return z});m=d(15);f=d(21);var c=d(127),n=d(245),v=d(26),t=d(49),l=d(145),k=d(146),g=d(1),e=d(2),b=d(71),h=d(35),r=d(246),A=function(){function a(a,b){for(var c=0;c<b.length;c++){var e=b[c];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(b,c,e){c&&a(b.prototype,c);e&&a(b,e);return b}}(),y=function G(a,b,c){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,
b);if(void 0===e){if(a=Object.getPrototypeOf(a),null!==a)return G(a,b,c)}else{if("value"in e)return e.value;b=e.get;return void 0===b?void 0:b.call(c)}};d(143);d(144);var z=function(b){function d(b,h){u(this,d);var f=p(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,h));f.opacity=Object(t.a)(.5);f.lineWidth=Object(l.a)(10);f.color=Object(k.a)(g.s.fromValues(1,1,1));f.opacity.restoreState(h.opacity);f.lineWidth.restoreState(h.linewidth);f.color.restoreState(h.color);f.lineWidth.changed.add(function(){f.specificationChanged.dispatch()});
f.color.changed.add(function(){f.specificationChanged.dispatch()});f.vectorGraphicsLayerType=Object(e.m)(h.type,c.b);h=f.vectorGraphicsPath=Object(e.y)(h.source);var r=0;void 0!==h&&(++r,f.vectorGraphicsLayerType===c.b.LINE&&a(b.dataSourceProvider,b.chunkManager,h).then(function(a){f.wasDisposed||(a=f.renderLayer=new n.a(a,{opacity:f.opacity,lineWidth:f.lineWidth,color:f.color,sourceOptions:{}}),f.addRenderLayer(a),0===--r&&(f.isReady=!0))}));f.tabs.add("rendering",{label:"Rendering",order:-100,getter:function(){return new E(f)}});
f.tabs.default="rendering";return f}q(d,b);A(d,[{key:"toJSON",value:function(){var a=y(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"toJSON",this).call(this);a.type=this.getLayerType();a.source=this.vectorGraphicsPath;a.opacity=this.opacity.toJSON();a.linewidth=this.lineWidth.toJSON();a.color=this.color.toJSON();return a}},{key:"getLayerType",value:function(){return c.b[this.vectorGraphicsLayerType].toLowerCase()}}]);return d}(m.i),E=function(a){function c(a){u(this,c);var e=p(this,(c.__proto__||
Object.getPrototypeOf(c)).call(this));e.layer=a;e.opacityWidget=e.registerDisposer(new b.a(e.layer.opacity));e.lineWidthWidget=e.registerDisposer(new b.a(e.layer.lineWidth,{min:0,max:50,step:1}));e.colorWidget=e.registerDisposer(new x(e.layer.color));a=e.element;a.classList.add("image-dropdown");var d=e.opacityWidget,g=e.lineWidthWidget,h=e.colorWidget,f=document.createElement("div");f.className="image-dropdown-top-row";d.promptElement.textContent="Opacity";g.promptElement.textContent="Line Width";
h.promptElement.textContent="Color";d=document.createElement("div");d.style.flex="1";g=document.createElement("a");h=document.createElement("button");h.type="button";h.textContent="?";h.className="help-link";g.appendChild(h);g.title="Documentation on vector graphics layer rendering";g.target="_blank";g.href="https://github.com/google/neuroglancer/blob/master/src/neuroglancer/sliceview/vectorgraphics_layer_rendering.md";f.appendChild(d);f.appendChild(g);a.appendChild(f);a.appendChild(e.opacityWidget.element);
a.appendChild(e.lineWidthWidget.element);a.appendChild(e.colorWidget.element);return e}q(c,a);return c}(h.b),x=function(a){function b(a){u(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a))}q(b,a);A(b,[{key:"verifyValue",value:function(a){a=Object(e.n)(a);a/=255;return 0>a?0:1<a?1:a}},{key:"updateInput",value:function(){this.inputx.valueAsNumber=Math.round(255*this.model.value[0]);this.inputy.valueAsNumber=Math.round(255*this.model.value[1]);this.inputz.valueAsNumber=Math.round(255*
this.model.value[2])}}]);return b}(r.a);Object(f.e)("line",z)},function(m,f,d){function u(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 p(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)}d.d(f,"a",function(){return b});var q=d(36);m=d(128);var a=d(49),c=d(145),n=d(146),v=d(1),t=d(16),l=d(11),k=function(){function a(a,b){for(var c=0;c<b.length;c++){var e=b[c];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(b,c,e){c&&a(b.prototype,c);e&&a(b,e);return b}}(),g=function r(a,b,c){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,b);if(void 0===
e){if(a=Object.getPrototypeOf(a),null!==a)return r(a,b,c)}else{if("value"in e)return e.value;b=e.get;return void 0===b?void 0:b.call(c)}},e=v.k.create(),b=function(b){function d(b,e){var g=void 0===e?{}:e;e=void 0===g.opacity?Object(a.a)(.5):g.opacity;var f=void 0===g.lineWidth?Object(c.a)(10):g.lineWidth,k=void 0===g.color?Object(n.a)(v.s.fromValues(255,255,255)):g.color;g=void 0===g.sourceOptions?{}:g.sourceOptions;if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");
var l=u(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,{sourceOptions:g}));l.opacity=e;l.registerDisposer(e.changed.add(function(){l.redrawNeeded.dispatch()}));l.lineWidth=f;l.registerDisposer(f.changed.add(function(){l.redrawNeeded.dispatch()}));l.color=k;l.registerDisposer(k.changed.add(function(){l.redrawNeeded.dispatch()}));b=l.gl;e=new Float32Array([1,0,0,1,1,0,0,1]);l.vertexIndexBuffer=l.registerDisposer(t.a.fromData(b,e,b.ARRAY_BUFFER,b.STATIC_DRAW));e=new Float32Array([1,1,-1,-1]);
l.normalDirectionBuffer=l.registerDisposer(t.a.fromData(b,e,b.ARRAY_BUFFER,b.STATIC_DRAW));return l}p(d,b);k(d,[{key:"getShaderKey",value:function(){return"vectorgraphics.VectorGraphicsLineRenderLayer"}},{key:"defineShader",value:function(a){g(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"defineShader",this).call(this,a);a.addUniform("highp float","uOpacity");a.addUniform("highp float","ulineWidth");a.addUniform("highp vec3","uColor");a.addVarying("vec3","vNormal");a.addAttribute("highp float",
"aNormalDirection");a.addAttribute("highp vec2","aVertexIndex");a.addAttribute("highp vec3","aVertexFirst");a.addAttribute("highp vec3","aVertexSecond");a.addUniform("highp mat4","uProjection");a.setFragmentMain("\nfloat distance = length(vNormal);\n\nfloat antialiasing = 0.5;\n\nif (distance >= 1.0 - antialiasing) {\n  emitRGBA(vec4(uColor, (distance - 1.0) / -antialiasing ));\n}\nelse if (distance < 1.0 - antialiasing) {\n  emitRGB(uColor);\n}\n");a.setVertexMain("\nvec3 direction = vec3(0., 0., 0.);\ndirection.z = aNormalDirection;\n\nvec3 difference = aVertexSecond - aVertexFirst;\ndifference.z = 0.;\n\nvec3 normal = cross(difference, direction);\nnormal = normalize(normal);\nvNormal = normal;\n\nvec4 delta = vec4(normal * ulineWidth, 0.0);\nvec4 pos = vec4(aVertexFirst * aVertexIndex.x + aVertexSecond * aVertexIndex.y, 1.0);\n\ngl_Position = uProjection * (pos + delta);\n")}},
{key:"beginSlice",value:function(a){g(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"beginSlice",this).call(this,a);a=this.gl;var b=this.shader;a.uniform1f(b.uniform("uOpacity"),this.opacity.value);a.uniform1f(b.uniform("ulineWidth"),this.lineWidth.value);a.uniform3fv(b.uniform("uColor"),this.color.value);this.vertexIndexBuffer.bindToVertexAttrib(b.attribute("aVertexIndex"),2);this.normalDirectionBuffer.bindToVertexAttrib(b.attribute("aNormalDirection"),1);return b}},{key:"endSlice",value:function(a){var b=
this.gl;b.disableVertexAttribArray(a.attribute("aVertexIndex"));b.disableVertexAttribArray(a.attribute("aNormalDirection"));b.disableVertexAttribArray(a.attribute("aVertexFirst"));b.disableVertexAttribArray(a.attribute("aVertexSecond"))}},{key:"draw",value:function(a){var b=a.visibleLayers.get(this);if(0!==b.length){var c=this.gl,d=this.beginSlice(a);if(void 0===d)console.log("error: shader undefined");else{b=$jscomp.makeIterator(b);for(var g=b.next();!g.done;g=b.next()){g=g.value;var f=g.chunkLayout,
k=g.source,r=k.spec.voxelSize;g=k.chunks;var n=e;v.k.identity(n);k.vectorGraphicsCoordinatesInVoxels&&v.k.scale(n,n,r);v.k.multiply(n,f.transform,n);c.uniformMatrix4fv(d.uniform("uProjection"),!1,v.k.multiply(e,a.dataToDevice,n));if(f=a.visibleChunks.get(f))for(f=$jscomp.makeIterator(f),k=f.next();!k.done;k=f.next())if((k=g.get(k.value))&&k.state===q.d.GPU_MEMORY){r=k.numPoints/2;n=d.attribute("aVertexFirst");k.vertexBuffer.bindToVertexAttrib(n,3,l.g,!1,24,0);c.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(n,
1);var p=d.attribute("aVertexSecond");k.vertexBuffer.bindToVertexAttrib(p,3,l.g,!1,24,12);c.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(p,1);c.ANGLE_instanced_arrays.drawArraysInstancedANGLE(c.TRIANGLE_STRIP,0,4,r);c.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(n,0);c.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(p,0)}}this.endSlice(d)}}}}]);return d}(m.a)},function(m,f,d){function u(a,c){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!c||
"object"!==typeof c&&"function"!==typeof c?a:c}function p(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}d.d(f,"a",function(){return t});m=d(0);var q=d(1),a=d(2),c=d(3),n=function(){function a(a,c){for(var e=0;e<c.length;e++){var b=c[e];b.enumerable=
b.enumerable||!1;b.configurable=!0;"value"in b&&(b.writable=!0);Object.defineProperty(a,b.key,b)}}return function(c,d,e){d&&a(c.prototype,d);e&&a(c,e);return c}}(),v=function k(a,c,b){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,c);if(void 0===e){if(a=Object.getPrototypeOf(a),null!==a)return k(a,c,b)}else{if("value"in e)return e.value;c=e.get;return void 0===c?void 0:c.call(b)}};d(247);var t=function(d){function g(a){if(!(this instanceof g))throw new TypeError("Cannot call a class as a function");
var b=u(this,(g.__proto__||Object.getPrototypeOf(g)).call(this));b.model=a;b.promptElement=document.createElement("span");b.element=document.createElement("label");b.inputx=document.createElement("input");b.inputy=document.createElement("input");b.inputz=document.createElement("input");b.valueEntered=new c.b;a=b.inputx;var e=b.inputy,d=b.inputz,f=b.element,k=b.promptElement;f.className="vec3-input-row";k.className="vec3-input-label";f.appendChild(k);f.appendChild(a);f.appendChild(e);f.appendChild(d);
a.type=e.type=d.type="number";b.updateInput();f=function(){b.model.value=b.getVec3Values()};b.registerEventListener(a,"change",f);b.registerEventListener(e,"change",f);b.registerEventListener(d,"change",f);b.model.changed.add(function(){b.updateInput()});return b}p(g,d);n(g,[{key:"getVec3Values",value:function(){var a=q.s.create();a[0]=this.verifyValue(this.inputx.valueAsNumber);a[1]=this.verifyValue(this.inputy.valueAsNumber);a[2]=this.verifyValue(this.inputz.valueAsNumber);return a}},{key:"verifyValue",
value:function(c){return Object(a.n)(c)}},{key:"updateInput",value:function(){this.inputx.valueAsNumber=this.model.value[0];this.inputy.valueAsNumber=this.model.value[1];this.inputz.valueAsNumber=this.model.value[2]}},{key:"disposed",value:function(){var a=this.inputx,b=this.inputy,c=this.inputz,d=this.element;a.parentElement&&a.parentElement.removeChild(a);b.parentElement&&b.parentElement.removeChild(b);c.parentElement&&c.parentElement.removeChild(c);d.parentElement&&d.parentElement.removeChild(d);
v(g.prototype.__proto__||Object.getPrototypeOf(g.prototype),"disposed",this).call(this)}}]);return g}(m.a)},function(m,f){},function(m,f,d){function u(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}d.d(f,"a",function(){return t});var p=d(249),
q=d(2),a=d(3),c=d(14);m=d(12);var n=function(){function a(a,b){for(var c=0;c<b.length;c++){var e=b[c];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(c,b,d){b&&a(c.prototype,b);d&&a(c,d);return c}}(),v=function e(a,c,d){null===a&&(a=Function.prototype);var b=Object.getOwnPropertyDescriptor(a,c);if(void 0===b){if(a=Object.getPrototypeOf(a),null!==a)return e(a,c,d)}else{if("value"in b)return b.value;c=b.get;return void 0===
c?void 0:c.call(d)}};f=this&&this.__decorate||function(a,b,c,d){var e=arguments.length,h=3>e?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d,f;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)h=Reflect.decorate(a,b,c,d);else for(var k=a.length-1;0<=k;k--)if(f=a[k])h=(3>e?f(h):3<e?f(b,c,h):f(b,c))||h;return 3<e&&h&&Object.defineProperty(b,c,h),h};var t=function(e){function b(){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");var c=(b.__proto__||
Object.getPrototypeOf(b)).apply(this,arguments);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;c.disjointSets=new p.a;c.changed=new a.a;return c}u(b,e);n(b,[{key:"disposed",value:function(){this.changed=this.disjointSets=void 0;v(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}},{key:"link",value:function(a,b){if(this.disjointSets.link(a,b)){var c=this.rpc;
c&&c.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(a){var b=this;this.clear();if(void 0!==a){var e=[new c.a,new c.a];Object(q.a)(a,function(a){Object(q.a)(a,function(a,c){e[c%2].parseString(String(a),10);0!==c&&b.link(e[0],e[1])})})}}},{key:"size",get:function(){return this.disjointSets.size}}],[{key:"makeWithCounterpart",value:function(a){var b=new this;b.initializeCounterpart(a);return b}}]);return b}(m.c);t=f([Object(m.f)("DisjointUint64Sets")],t);var l=new c.a,k=new c.a;Object(m.e)("DisjointUint64Sets.add",function(a){var b=this.get(a.id);
l.low=a.al;l.high=a.ah;k.low=a.bl;k.high=a.bh;b.disjointSets.link(l,k)&&b.changed.dispatch()});Object(m.e)("DisjointUint64Sets.clear",function(a){a=this.get(a.id);a.disjointSets.clear()&&a.changed.dispatch()})},function(m,f,d){function u(a){for(var c=a,b=a[n];b!==a;)a=b,b=a[n];for(a=c[n];b!==a;)c[n]=b,c=a,a=c[n];return b}function p(a){function c(c,e){for(;;)switch(b){case 0:g=!0,d=a;case 1:if(!g&&d===a){b=3;break}b=4;return{value:d,done:!1};case 4:if(void 0===e){b=5;break}b=-1;throw e;case 5:d=d[v];
case 2:g=!1;b=1;break;case 3:b=-1;default:return{value:void 0,done:!0}}}var b=0,d,g,f={next:function(a){return c(a,void 0)},throw:function(a){return c(void 0,a)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();f[Symbol.iterator]=function(){return this};return f}d.d(f,"a",function(){return k});var q=d(14),a=function(){function a(a,b){for(var c=0;c<b.length;c++){var e=b[c];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,
e.key,e)}}return function(c,b,d){b&&a(c.prototype,b);d&&a(c,d);return c}}();$jscomp.initSymbol();var c=Symbol("disjoint_sets:rank");$jscomp.initSymbol();var n=Symbol("disjoint_sets:parent");$jscomp.initSymbol();var v=Symbol("disjoint_sets:next");$jscomp.initSymbol();var t=Symbol("disjoint_sets:prev");$jscomp.initSymbol();var l=Symbol("disjoint_sets:min"),k=function(){function d(){if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");this.map=new Map;this.generation=0}$jscomp.initSymbol();
$jscomp.initSymbolIterator();a(d,[{key:"get",value:function(a){var b=this.map.get(a.toString());return void 0===b?a:u(b)[l]}},{key:"isMinElement",value:function(a){var b=this.get(a);return b===a||q.a.equal(b,a)}},{key:"makeSet",value:function(a){var b=a.toString(),e=this.map,d=e.get(b);return void 0===d?(a=d=a.clone(),a[n]=a,a[c]=0,a[v]=a[t]=a,d[l]=d,e.set(b,d),d):u(d)}},{key:"link",value:function(a,b){a=this.makeSet(a);b=this.makeSet(b);if(a===b)return!1;this.generation++;var e=a;var d=b,g=e[c],
f=d[c];g>f?d[n]=e:(e[n]=d,g===f&&(d[c]=f+1),e=d);d=a;g=b;f=d[t];var k=g[t];g[t]=f;f[v]=g;d[t]=k;k[v]=d;a=a[l];b=b[l];e[l]=q.a.less(a,b)?a:b;return!0}},{key:"setElements",value:function(a){function b(b,h){for(;;)switch(c){case 0:f=a.toString();g=k.map.get(f);if(void 0!==g){c=1;break}c=3;return{value:a,done:!1};case 3:if(void 0===h){c=4;break}c=-1;throw h;case 4:c=2;break;case 1:d=$jscomp.makeIterator(p(g));case 5:if((e=d.next(b)).done){c=6;break}c=7;return{value:e.value,done:!1};case 7:if(void 0===
h){c=8;break}c=-1;throw h;case 8:c=5;break;case 6:case 2:c=-1;default:return{value:void 0,done:!0}}}var c=0,e,d,g,f,k=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,h){for(;;)switch(c){case 0:a=
void 0===a?Array(2):a,g=$jscomp.makeIterator(f.map.values()),d=g.next();case 1:if(d.done){c=3;break}e=d.value;a[0]=e;a[1]=u(e)[l];c=4;return{value:a,done:!1};case 4:if(void 0===h){c=5;break}c=-1;throw h;case 5:case 2:d=g.next();c=1;break;case 3:c=-1;default:return{value:void 0,done:!0}}}var c=0,e,d,g,f=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 a=[],b=$jscomp.makeIterator(this.map.values()),c=b.next();!c.done;c=b.next()){var d=c.value;if(d[n]===d){c=[];d=$jscomp.makeIterator(p(d));for(var g=d.next();!g.done;g=d.next())c.push(g.value);c.sort(q.a.compare);a.push(c)}}a.sort(function(a,b){return q.a.compare(a[0],b[0])});return a.map(function(a){return a.map(function(a){return a.toString()})})}},{key:"size",get:function(){return this.map.size}}]);
return d}()},function(m,f,d){function u(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 p(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 q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}d.d(f,"a",function(){return b});var a=d(92),c=d(149),n=d(148),v=d(70);m=d(133);var t=d(17),l=function r(a,b,c){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,b);if(void 0===e){if(a=Object.getPrototypeOf(a),null!==a)return r(a,b,c)}else{if("value"in e)return e.value;b=e.get;return void 0===b?void 0:b.call(c)}},k=function(){function a(a,b){for(var c=0;c<b.length;c++){var e=b[c];
e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(b,c,e){c&&a(b.prototype,c);e&&a(b,e);return b}}(),g=new Float32Array(8),e=function(){function b(c){q(this,b);this.disjointSets=c;this.generation=Number.NaN;this.hashMap=new a.a}k(b,[{key:"update",value:function(){var a=this.disjointSets,b=a.generation;if(this.generation!==b){this.generation=b;b=this.hashMap;b.clear();a=$jscomp.makeIterator(a.mappings());for(var c=a.next();!c.done;c=
a.next()){var e=$jscomp.makeIterator(c.value);c=e.next().value;e=e.next().value;b.set(c,e)}}}}]);return b}(),b=function(a){function b(a,d){q(this,b);var g=u(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,{sourceOptions:d.volumeSourceOptions,transform:d.objectToDataTransform}));g.displayState=d;g.segmentColorShaderManager=new n.b("segmentColorHash");g.hashTableManager=new c.c("visibleSegments");g.gpuHashTable=c.a.get(g.gl,g.displayState.visibleSegments.hashTable);g.hashTableManagerHighlighted=
new c.c("highlightedSegments");g.gpuHashTableHighlighted=c.a.get(g.gl,g.displayState.highlightedSegments.hashTable);g.equivalencesShaderManager=new c.b("equivalences");g.equivalencesHashMap=new e(g.displayState.segmentEquivalences.disjointSets);g.gpuEquivalencesHashTable=c.a.get(g.gl,g.equivalencesHashMap.hashMap);Object(v.g)(d,g);g.registerDisposer(d.selectedAlpha.changed.add(function(){g.redrawNeeded.dispatch()}));g.registerDisposer(d.hideSegmentZero.changed.add(function(){g.redrawNeeded.dispatch();
g.shaderGetter.invalidateShader()}));g.hasEquivalences=0!==g.displayState.segmentEquivalences.size;d.segmentEquivalences.changed.add(function(){var a=0!==g.displayState.segmentEquivalences.size;a!==g.hasEquivalences&&(g.hasEquivalences=a,g.shaderGetter.invalidateShader())});g.registerDisposer(d.notSelectedAlpha.changed.add(function(){g.redrawNeeded.dispatch()}));return g}p(b,a);k(b,[{key:"getShaderKey",value:function(){return"sliceview.SegmentationRenderLayer/"+this.hasEquivalences+"/"+this.displayState.hideSegmentZero.value}},
{key:"defineShader",value:function(a){l(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"defineShader",this).call(this,a);this.hashTableManager.defineShader(a);this.hashTableManagerHighlighted.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.addUniform("highp float","uSaturation");a.addFragmentCode(t.q);
var c="\n  uint64_t value = getMappedObjectId();\n\n  float alpha = uSelectedAlpha;\n  float saturation = uSaturation;\n";this.displayState.hideSegmentZero.value&&(c+="\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");c+="\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  ";
c+="\n  if("+this.hashTableManagerHighlighted.hasFunctionName+"(value)) {\n    rgb = vec3(0.2,0.2,2.0);\n    saturation = 1.0;\n  };\n";a.setFragmentMain(c+"\n  emit(vec4(mix(vec3(1.0,1.0,1.0), rgb, saturation), alpha));\n")}},{key:"beginSlice",value:function(a){a=l(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"beginSlice",this).call(this,a);if(void 0!==a){var c=this.gl,e=this.displayState,d=this.displayState,f=d.segmentSelectionState;d=d.visibleSegments;if(f.hasSelectedSegment){var k=
f.selectedSegment;f=k.low;k=k.high;for(var n=0;4>n;++n)g[n]=f>>8*n&255,g[4+n]=k>>8*n&255}else g.fill(0);c.uniform1f(a.uniform("uSelectedAlpha"),this.displayState.selectedAlpha.value);c.uniform1f(a.uniform("uSaturation"),this.displayState.saturation.value);c.uniform1f(a.uniform("uNotSelectedAlpha"),this.displayState.notSelectedAlpha.value);c.uniform4fv(a.uniform("uSelectedSegment"),g);c.uniform1f(a.uniform("uShowAllSegments"),d.hashTable.size?0:1);this.hashTableManager.enable(c,a,this.gpuHashTable);
this.hashTableManagerHighlighted.enable(c,a,this.gpuHashTableHighlighted);this.hasEquivalences&&(this.equivalencesHashMap.update(),this.equivalencesShaderManager.enable(c,a,this.gpuEquivalencesHashTable));this.segmentColorShaderManager.enable(c,a,e.segmentColorHash);return a}}},{key:"endSlice",value:function(a){var c=this.gl;this.hashTableManager.disable(c,a);this.hashTableManagerHighlighted.disable(c,a);l(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"endSlice",this).call(this,a)}}]);
return b}(m.a)},function(m,f,d){function u(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}d.d(f,"a",function(){return n});var p=d(92),q=d(3);m=d(12);var a=function(){function a(a,c){for(var d=0;d<c.length;d++){var e=c[d];e.enumerable=e.enumerable||
!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(c,d,g){d&&a(c.prototype,d);g&&a(c,g);return c}}(),c=function l(a,c,e){null===a&&(a=Function.prototype);var b=Object.getOwnPropertyDescriptor(a,c);if(void 0===b){if(a=Object.getPrototypeOf(a),null!==a)return l(a,c,e)}else{if("value"in b)return b.value;c=b.get;return void 0===c?void 0:c.call(e)}};f=this&&this.__decorate||function(a,c,d,e){var b=arguments.length,g=3>b?c:null===e?e=Object.getOwnPropertyDescriptor(c,
d):e,f;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)g=Reflect.decorate(a,c,d,e);else for(var k=a.length-1;0<=k;k--)if(f=a[k])g=(3>b?f(g):3<b?f(c,d,g):f(c,d))||g;return 3<b&&g&&Object.defineProperty(c,d,g),g};var n=v=function(d){function f(){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var a=(f.__proto__||Object.getPrototypeOf(f)).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.hashTable=new p.b;a.changed=new q.b;return a}u(f,d);$jscomp.initSymbol();$jscomp.initSymbolIterator();a(f,[{key:"disposed",value:function(){c(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 c=this.rpc;c&&c.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 c=this.rpc;c&&c.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=[],c=$jscomp.makeIterator(this),b=c.next();!b.done;b=c.next())a.push(b.value.toString());a.sort();return a}},{key:"size",get:function(){return this.hashTable.size}}],[{key:"makeWithCounterpart",value:function(a){var c=new v;c.initializeCounterpart(a);return c}}]);return f}(m.c);n=v=f([Object(m.f)("Uint64Set")],n);Object(m.e)("Uint64Set.add",function(a){var c=this.get(a.id);c.add_(a.value)&&c.changed.dispatch()});Object(m.e)("Uint64Set.delete",function(a){var c=
this.get(a.id);c.delete_(a.value)&&c.changed.dispatch()});Object(m.e)("Uint64Set.clear",function(a){a=this.get(a.id);a.hashTable.clear()&&a.changed.dispatch()});var v},function(m,f,d){function u(a,c){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!c||"object"!==typeof c&&"function"!==typeof c?a:c}function p(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=
Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}d.d(f,"a",function(){return n});m=d(0);f=d(14);var q=function(){function a(a,c){for(var d=0;d<c.length;d++){var g=c[d];g.enumerable=g.enumerable||!1;g.configurable=!0;"value"in g&&(g.writable=!0);Object.defineProperty(a,g.key,g)}}return function(c,d,f){d&&a(c.prototype,d);f&&a(c,f);return c}}(),a=function t(a,c,d){null===a&&(a=Function.prototype);
var e=Object.getOwnPropertyDescriptor(a,c);if(void 0===e){if(a=Object.getPrototypeOf(a),null!==a)return t(a,c,d)}else{if("value"in e)return e.value;c=e.get;return void 0===c?void 0:c.call(d)}};d(41);d(253);var c=new f.a,n=function(d){function f(a){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var c=u(this,(f.__proto__||Object.getPrototypeOf(f)).call(this));c.displayState=a;c.element=document.createElement("div");c.clearButton=document.createElement("button");c.itemContainer=
document.createElement("span");c.items=new Map;var d=c.element,b=c.clearButton,h=c.itemContainer;d.className="segment-set-widget neuroglancer-noselect";b.className="clear-button";b.title="Remove all segment IDs";c.registerEventListener(b,"click",function(){c.visibleSegments.clear()});h.className="item-container";d.appendChild(h);h.appendChild(b);c.registerDisposer(a.visibleSegments.changed.add(function(a,b){c.handleSetChanged(a,b)}));c.registerDisposer(a.segmentColorHash.changed.add(function(){c.handleColorChanged()}));
a=$jscomp.makeIterator(a.visibleSegments);for(d=a.next();!d.done;d=a.next())c.addElement(d.value.toString());c.updateClearButtonVisibility();return c}p(f,d);q(f,[{key:"updateClearButtonVisibility",value:function(){this.clearButton.style.display=0<this.displayState.visibleSegments.size?"":"none"}},{key:"handleSetChanged",value:function(a,c){this.updateClearButtonVisibility();var d=this.items;if(null===a){a=this.itemContainer;for(c=this.clearButton;;){var b=a.lastElementChild;if(b===c)break;a.removeChild(b)}d.clear()}else c?
this.addElement(a.toString()):(a=a.toString(),c=d.get(a),c.parentElement.removeChild(c),d.delete(a))}},{key:"addElement",value:function(a){var d=document.createElement("button");d.className="segment-button";d.textContent=a;d.title="Remove segment ID "+a;var e=this;d.addEventListener("click",function(){c.tryParseString(this.textContent);e.visibleSegments.delete(c)});d.addEventListener("mouseenter",function(){c.tryParseString(this.textContent);e.segmentSelectionState.set(c)});d.addEventListener("mouseleave",
function(){c.tryParseString(this.textContent);e.segmentSelectionState.set(null)});this.setItemColor(d);this.itemContainer.appendChild(d);this.items.set(a,d)}},{key:"setItemColor",value:function(a){c.tryParseString(a.textContent);a.style.backgroundColor=this.segmentColorHash.computeCssColor(c)}},{key:"handleColorChanged",value:function(){var a=this;this.items.forEach(function(c){a.setItemColor(c)})}},{key:"disposed",value:function(){var c=this.element,d=c.parentElement;d&&d.removeChild(c);a(f.prototype.__proto__||
Object.getPrototypeOf(f.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 f}(m.a)},function(m,f){},function(m,f){},function(m,f,d){function u(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(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 q(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){return a.split(/[^a-zA-Z0-9]+/).filter(function(a){return a}).join("_")}function c(b){var c=new Set,d=[];b=$jscomp.makeIterator(b);
for(var e=b.next();!e.done;e=b.next()){e=a(e.value);for(var g="",f=0;c.has(e+g);)g=""+ ++f;d.push(e+g)}return d}function n(a){return new r.a({fragmentMain:a.displayState.fragmentMain,shaderError:a.displayState.shaderError,fragmentMainStartLine:k.a})}function v(a){return new x(a.displayState.attributeNames,function(){return a.meshSource&&a.meshSource.info.vertexAttributes})}Object.defineProperty(f,"__esModule",{value:!0});d.d(f,"SingleMeshUserLayer",function(){return E});m=d(5);var t=d.n(m);m=d(15);
f=d(21);var l=d(42),k=d(256),g=d(89),e=d(0),b=d(10),h=d(2),r=d(90),A=d(35),y=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}}(),z=function C(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 C(a,b,c)}else{if("value"in
d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};d(258);var E=function(a){function b(a,d){u(this,b);var e=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,d));e.manager=a;e.displayState=new k.b;e.displayState.objectToDataTransform=e.transform;e.parameters={meshSourceUrl:Object(h.v)(d,"source",h.A),attributeSourceUrls:Object(h.v)(d,"vertexAttributeSources",function(a){return void 0!==a?Object(h.a)(a,h.A):[]})};e.displayState.fragmentMain.restoreState(d.shader);e.userSpecifiedAttributeNames=
Object(h.v)(d,"vertexAttributeNames",function(a){if(void 0!==a)return Object(h.a)(a,function(a){if(a=Object(h.y)(a))return a})});Object(k.e)(a.chunkManager,e.parameters).then(function(a){if(!e.wasDisposed){e.meshSource=a;var b=e.defaultAttributeNames=c(a.info.vertexAttributes.map(function(a){return a.name})),d=e.userSpecifiedAttributeNames;void 0!==d&&d.length===b.length?(b=d,e.userSpecifiedAttributeNames=void 0):b=Array.from(b);e.displayState.attributeNames.value=b;e.addRenderLayer(new k.c(a,e.displayState));
e.isReady=!0}});e.registerDisposer(e.displayState.fragmentMain.changed.add(function(){e.specificationChanged.dispatch()}));e.registerDisposer(e.displayState.attributeNames.changed.add(function(){e.specificationChanged.dispatch()}));e.tabs.add("rendering",{label:"Rendering",order:-100,getter:function(){return new D(e)}});e.tabs.default="rendering";return e}q(b,a);y(b,[{key:"toJSON",value:function(){var a=z(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"toJSON",this).call(this);a.type="mesh";
var c=this.parameters.attributeSourceUrls;a.source=this.parameters.meshSourceUrl;c&&(a.vertexAttributeSources=c);a.shader=this.displayState.fragmentMain.toJSON();if(void 0===this.meshSource)c=this.userSpecifiedAttributeNames;else{c=this.defaultAttributeNames;for(var d=this.displayState.attributeNames.value,e=!0,g=d.length,f=0;f<g;++f)if(d[f]!==c[f]){e=!1;break}c=e?void 0:Array.from(d)}a.vertexAttributeNames=c;return a}}]);return b}(Object(g.a)(m.i)),x=function(a){function c(a,b){u(this,c);var d=p(this,
(c.__proto__||Object.getPrototypeOf(c)).call(this));d.attributeNames=a;d.getAttributeInfo=b;d.element=document.createElement("div");d.debouncedValueUpdater=t()(function(){d.updateAttributeNames()},500);d.element.className="neuroglancer-single-mesh-attribute-widget";d.updateInputElements();d.registerDisposer(a.changed.add(function(){d.updateInputElements()}));return d}q(c,a);y(c,[{key:"updateInputElements",value:function(){var a=this.attributeNames,b=this.attributeNameElements;if(void 0===b){var c=
this.getAttributeInfo();if(void 0===c)return;b=this.attributeNameElements=[];for(var d=void 0,e=a.value.length,g=this.element,f=0;f<e;++f){var h=c[f],l=h.source;if(l!==d&&void 0!==l){d=l;var n=document.createElement("div");n.className="neuroglancer-single-mesh-source-header";n.textContent=l;g.appendChild(n)}l=document.createElement("div");l.className="neuroglancer-single-mesh-attribute";n=document.createElement("input");n.title=h.name;this.registerEventListener(n,"input",this.debouncedValueUpdater);
n.type="text";l.textContent=Object(k.d)(h);l.appendChild(n);if(void 0!==h.min&&void 0!==h.max){var r=document.createElement("span");r.className="neuroglancer-single-mesh-attribute-range";r.textContent="["+h.min.toPrecision(6)+", "+h.max.toPrecision(6)+"]";l.appendChild(r)}b[f]=n;g.appendChild(l)}}a.value.forEach(function(a,c){b[c].value=a||""})}},{key:"disposed",value:function(){Object(b.b)(this.element)}},{key:"updateAttributeNames",value:function(){var a=this.attributeNames.value,b=this.attributeNameElements,
c=!1;a.forEach(function(d,e){var g=b[e].value;g||(g=void 0);g!==d&&(c=!0,a[e]=g)});c&&this.attributeNames.changed.dispatch()}}]);return c}(e.a),D=function(a){function b(a){u(this,b);var c=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.layer=a;c.attributeWidget=c.registerDisposer(v(c.layer));c.codeWidget=c.registerDisposer(n(c.layer));a=c.element;a.classList.add("neuroglancer-single-mesh-dropdown");var d=document.createElement("div");d.className="neuroglancer-single-mesh-dropdown-top-row";
var e=document.createElement("div");e.style.flex="1";var g=document.createElement("a"),f=document.createElement("button");f.type="button";f.textContent="?";f.className="help-link";g.appendChild(f);g.title="Documentation on single mesh layer rendering";g.target="_blank";g.href="https://github.com/google/neuroglancer/blob/master/src/neuroglancer/sliceview/image_layer_rendering.md";f=document.createElement("button");f.innerHTML="&square;";f.className="maximize-button";f.title="Show larger editor view";
c.registerEventListener(f,"click",function(){new G(c.layer)});d.appendChild(e);d.appendChild(f);d.appendChild(g);a.appendChild(d);a.appendChild(c.attributeWidget.element);a.appendChild(c.codeWidget.element);c.codeWidget.textEditor.refresh();c.visibility.changed.add(function(){c.visible&&c.codeWidget.textEditor.refresh()});return c}q(b,a);return b}(A.b),G=function(a){function b(a){u(this,b);var c=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.layer=a;c.attributeWidget=c.registerDisposer(v(c.layer));
c.codeWidget=c.registerDisposer(n(c.layer));c.content.classList.add("neuroglancer-single-mesh-layer-shader-overlay");c.content.appendChild(c.attributeWidget.element);c.content.appendChild(c.codeWidget.element);c.codeWidget.textEditor.refresh();return c}q(b,a);return b}(l.a);Object(f.e)("mesh",E)},function(m,f,d){function u(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 p(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 q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function a(){return new e.c([],function(a){return Object(r.a)(a,r.y)})}function c(a){return Object(G.a)(a.dataType,a.numComponents)}
function n(a){return a.map(function(a){return Object(x.c)(new x.b,a.dataType,a.numComponents)})}function v(a,b){return a.memoize.getUncounted({type:"single_mesh:getMeshInfo",parameters:b},function(){return a.rpc.promiseInvoke(g.a,{chunkManager:a.addCounterpartRef(),parameters:b})})}d.d(f,"b",function(){return P});f.d=c;d.d(f,"c",function(){return aa});f.e=function(a,b){return v(a,b).then(function(c){return a.getChunkSource(U,{parameters:Object.assign({},b,{info:c})})})};var t=d(36);m=d(18);var l=
d(52),k=d(54),g=d(257),e=d(6),b=d(44),h=d(1),r=d(2),A=d(25),y=d(24),z=d(48),E=d(112),x=d(93),D=d(27),G=d(17),J=d(12),C=function T(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 T(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},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}}();f.a="//NEUROGLANCER_SINGLE_MESH_LAYER_FRAGMENT_MAIN_START";var F=d(84),P=function da(){q(this,da);this.shaderError=Object(z.c)();var b=void 0;this.fragmentMain=new e.c(void 0===b?"void main() {\n  emitGray();\n}\n":b,r.A);this.attributeNames=a();this.objectToDataTransform=new l.a};$jscomp.initSymbol();var H=Symbol("SingleMeshShaderManager.vertexAttributeTextureUnit"),N=Object(x.c)(new x.b,b.b.FLOAT32,
3),R=function(){function a(b,c,d){q(this,a);this.attributeNames=b;this.attributeInfo=c;this.fragmentMain=d;this.tempLightVec=new Float32Array(4);this.tempPickID=new Float32Array(4);this.textureAccessHelper=new x.a("vertexData");this.indexBufferHelper=new E.a("VertexIndex")}B(a,[{key:"defineAttributeAccess",value:function(a,d){var e=this.textureAccessHelper;e.defineShader(a);a.addVertexCode(e.getAccessor("readVertexPosition","uVertexAttributeSampler[0]",b.b.FLOAT32,3));a.addVertexCode(e.getAccessor("readVertexNormal",
"uVertexAttributeSampler[1]",b.b.FLOAT32,3));var g=2,f="\nvec3 vertexPosition = readVertexPosition("+d+");\nvec3 vertexNormal = readVertexNormal("+d+");\n",h=this.attributeNames;this.attributeInfo.forEach(function(b,k){if(void 0!==h[k]){var l=c(b);a.addVarying("highp "+l,"vCustom"+k);a.addFragmentCode("\n#define "+h[k]+" vCustom"+k+"\n");a.addVertexCode(e.getAccessor("readAttribute"+k,"uVertexAttributeSampler["+g+"]",b.dataType,b.numComponents));f+="vCustom"+k+" = readAttribute"+k+"("+d+");\n";g+=
1}});a.addTextureSampler2D("uVertexAttributeSampler",H,g);a.addVertexMain(f)}},{key:"defineShader",value:function(a){a.require(E.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(G.b);a.addVertexCode(G.c);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(F);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,g=c.ambientLighting;c=c.directionalLighting;a.uniformMatrix4fv(b.uniform("uProjection"),!1,d);d=this.tempLightVec;h.s.scale(d,e,c);d[3]=g;a.uniform4fv(b.uniform("uLightDirection"),d)}},{key:"setPickID",value:function(a,b,c){a.uniform4fv(b.uniform("uPickID"),Object(G.r)(this.tempPickID,c))}},{key:"beginObject",value:function(a,
b,c){a.uniformMatrix4fv(b.uniform("uModelMatrix"),!1,c)}},{key:"getShader",value:function(a,b){var c=this,d={attributeNames:this.attributeNames,attributeInfo:this.attributeInfo,fragmentMain:this.fragmentMain};return a.memoize.get("single_mesh/SingleMeshShaderManager:"+Object(A.a)(b)+":"+Object(r.g)(d),function(){var d=new D.a(a);d.require(b);c.defineShader(d);return d.build()})}},{key:"bindVertexData",value:function(a,b,c){this.textureAccessHelper.setupTextureLayout(a,b,c);var d=b.textureUnit(H)+
a.TEXTURE0,e=function(b){a.activeTexture(d++);a.bindTexture(a.TEXTURE_2D,b)};e(c.vertexTexture);e(c.normalTexture);var g=this.attributeNames;c.vertexAttributeTextures.forEach(function(a,b){void 0!==g[b]&&e(a)})}},{key:"disableVertexData",value:function(a,b){for(var c=2,d=this.attributeInfo.length,e=this.attributeNames,g=0;g<d;++g)void 0!==e[g]&&++c;b=b.textureUnit(H)+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){Object(E.c)(a,b);this.indexBufferHelper.disable(b);this.disableVertexData(a,b)}}]);return a}(),O=function(){function a(){q(this,a)}B(a,[{key:"copyToGPU",value:function(a,b){var c=this;Object(x.d)(this,a,1,this.vertexPositions.length/3);var d=function(b,d){var e=a.createTexture();a.bindTexture(a.TEXTURE_2D,e);Object(x.f)(a,c,d,b);return e};
this.vertexTexture=d(this.vertexPositions,N);this.normalTexture=d(this.vertexNormals,N);this.vertexAttributeTextures=this.vertexAttributes.map(function(a,c){return d(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 a}(),Q=function(a){function b(a,c){q(this,
b);a=u(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));var d=a.vertexData=new O;d.vertexPositions=c.vertexPositions;d.vertexNormals=c.vertexNormals;d.vertexAttributes=c.vertexAttributes;c=a.indices=c.indices;a.numIndices=c.length;return a}p(b,a);B(b,[{key:"copyToGPU",value:function(a){C(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"copyToGPU",this).call(this,a);this.vertexData.copyToGPU(a,this.source.attributeTextureFormats);this.indexBuffer=Object(E.e)(a,this.indices)}},{key:"freeGPUMemory",
value:function(a){C(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"freeGPUMemory",this).call(this,a);this.vertexData.freeGPUMemory(a);this.indexBuffer.dispose()}}]);return b}(m.b),U=function(a){function b(){q(this,b);var a=u(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));a.attributeTextureFormats=n(a.info.vertexAttributes);return a}p(b,a);B(b,[{key:"getChunk",value:function(a){return new Q(this,a)}},{key:"info",get:function(){return this.parameters.info}}]);return b}(Object(m.f)(m.e,
g.d)),W=function(a){function b(){q(this,b);return u(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}p(b,a);return b}(Object(y.c)(J.b)),aa=function(a){function b(a,c){q(this,b);var d=u(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));d.source=a;d.displayState=c;d.shaders=new Map;d.sharedObject=d.registerDisposer(new W);d.fallbackFragmentMain="void main() {\n  emitGray();\n}\n";d.countingBuffer=d.registerDisposer(Object(E.d)(d.gl));d.displayState.shaderError.value=void 0;
var e=function(){d.shaderManager=void 0;d.displayState.shaderError.value=void 0;d.disposeShaders();d.redrawNeeded.dispatch()};d.registerDisposer(c.fragmentMain.changed.add(e));d.registerDisposer(c.attributeNames.changed.add(e));d.registerDisposer(c.objectToDataTransform.changed.add(function(){d.redrawNeeded.dispatch()}));d.displayState.shaderError.value=void 0;c=d.sharedObject;c.visibility.add(d.visibility);c.RPC_TYPE_ID=g.c;c.initializeCounterpart(a.chunkManager.rpc,{chunkManager:a.chunkManager.rpcId,
source:a.addCounterpartRef()});d.setReady(!0);return d}p(b,a);B(b,[{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();C(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}},{key:"makeShaderManager",value:function(a){a=void 0===a?this.displayState.fragmentMain.value:a;return new R(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){c=null;var 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(na){if(this.displayState.shaderError.value=na,d=this.fallbackFragmentMain,d!==e){d=this.shaderManager=this.makeShaderManager(d);try{c=d.getShader(this.gl,
a)}catch(fb){}}}b.set(a,c)}return c}},{key:"draw",value:function(a){if(a.emitColor||!a.alreadyEmittedPickID){var b=this.source.chunks.get(g.b);if(void 0!==b&&b.state===t.d.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(g.b);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 b}(k.a)},function(m,f,d){function u(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}function p(a,c){if(!(a instanceof c))throw new TypeError("Cannot call a class as a function");}d.d(f,"d",
function(){return q});f.c="single_mesh/SingleMeshLayer";f.a="single_mesh/getSingleMeshInfo";f.b="";var q=function(a){function c(){p(this,c);var a=(c.__proto__||Object.getPrototypeOf(c)).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}u(c,a);return c}(function c(){p(this,c)});q.RPC_ID="single_mesh/SingleMeshSource"},function(m,f){},function(m,f,d){function u(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 p(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 q(a,b){void 0!==b&&Object(A.a)(b,function(b,d){a.add({type:c.c.POINT,id:""+d,point:Object(A.k)(b)})})}function a(a){a=a.layer;
return null===a||a instanceof k.SegmentationUserLayer?!0:!1}Object.defineProperty(f,"__esModule",{value:!0});d.d(f,"AnnotationUserLayer",function(){return x});var c=d(23),n=d(62),v=d(52),t=d(15);m=d(21);var l=d(58),k=d(147),g=d(26),e=d(40),b=d(6),h=d(86);f=d(89);var r=d(1),A=d(2),y=d(261),z=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=function G(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 G(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};d(262);var x=function(d){function f(b,d){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var h=u(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,b,d));h.localAnnotations=h.registerDisposer(new c.d);
h.voxelSize=new l.h;h.linkedSegmentationLayer=h.registerDisposer(new t.b(h.manager.rootLayers.addRef(),a));h.filterBySegmentation=new e.b(!1);var k=h.sourceUrl=d.source;h.linkedSegmentationLayer.restoreState(d.linkedSegmentationLayer);h.filterBySegmentation.restoreState(d.filterBySegmentation);if(void 0===k){h.isReady=!0;h.voxelSize.restoreState(d.voxelSize);h.localAnnotations.restoreState(d.annotations);q(h.localAnnotations,d.points);var p=!1;d=function(){!h.voxelSize.valid&&b.voxelSize.valid&&(r.s.copy(h.voxelSize.size,
b.voxelSize.size),h.voxelSize.setValid());if(h.voxelSize.valid&&!1===p){var a=new v.a;h.registerDisposer(Object(v.b)(a,h.transform,function(a,b){var c=r.k.fromScaling(r.k.create(),h.voxelSize.size);r.k.multiply(a,b,c)}));h.annotationLayerState.value=new n.b(Object.assign({transform:a,source:h.localAnnotations.addRef()},h.getAnnotationRenderOptions()));p=!0}};h.registerDisposer(h.localAnnotations.changed.add(h.specificationChanged.dispatch));h.registerDisposer(h.voxelSize.changed.add(h.specificationChanged.dispatch));
h.registerDisposer(h.filterBySegmentation.changed.add(h.specificationChanged.dispatch));h.registerDisposer(h.voxelSize.changed.add(d));h.registerDisposer(h.manager.voxelSize.changed.add(d));d()}else g.a.forPromise(h.manager.dataSourceProvider.getAnnotationSource(h.manager.chunkManager,k),{initialMessage:"Retrieving metadata for volume "+k+".",delay:!0,errorPrefix:"Error retrieving metadata for volume "+k+": "}).then(function(a){h.wasDisposed||(h.annotationLayerState.value=new n.b(Object.assign({transform:h.transform,
source:a},h.getAnnotationRenderOptions())),h.isReady=!0)});h.tabs.default="annotations";return h}p(f,d);z(f,[{key:"getAnnotationRenderOptions",value:function(){var a=this,c=new b.f(void 0),d=function(){var b=a.linkedSegmentationLayer;if(void 0===b.layerName)b=null;else a:{b=b.layer;if(void 0!==b&&(b=b.layer,null!==b&&b instanceof k.SegmentationUserLayer)){b=b.displayState;break a}b=void 0}c.value=b};this.registerDisposer(this.linkedSegmentationLayer.changed.add(d));d();return Object.assign({segmentationState:c,
filterBySegmentation:this.filterBySegmentation},Object(h.b)(this))}},{key:"initializeAnnotationLayerViewTab",value:function(a){var c=a.registerDisposer(new y.a(this.linkedSegmentationLayer));c.element.insertBefore(document.createTextNode("Linked segmentation: "),c.element.firstChild);a.element.appendChild(c.element);c=this.registerDisposer(new e.c(a.annotationLayer.filterBySegmentation));var d=document.createElement("label");d.textContent="Filter by segmentation: ";d.appendChild(c.element);a.element.appendChild(d);
a.registerDisposer(new e.a(this.registerDisposer(Object(b.g)(function(a){return void 0!==a},a.annotationLayer.segmentationState)),d))}},{key:"toJSON",value:function(){var a=E(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"toJSON",this).call(this);a.type="annotation";a.source=this.sourceUrl;void 0===this.sourceUrl&&(a.annotations=this.localAnnotations.toJSON(),a.voxelSize=this.voxelSize.toJSON());a.linkedSegmentationLayer=this.linkedSegmentationLayer.toJSON();a.filterBySegmentation=this.filterBySegmentation.toJSON();
return a}}]);return f}(Object(h.a)(Object(f.a)(t.i)));Object(m.e)("annotation",x);Object(m.e)("pointAnnotation",x)},function(m,f,d){d.d(f,"a",function(){return a});var u=d(2),p=d(3),q=function(){function a(a,c){for(var d=0;d<c.length;d++){var f=c[d];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}return function(c,d,f){d&&a(c.prototype,d);f&&a(c,f);return c}}(),a=function(){function a(c,d,f){f=void 0===f?d:f;if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");
this.enumType=c;this.value_=d;this.defaultValue=f;this.changed=new p.a}q(a,[{key:"reset",value:function(){this.value=this.defaultValue}},{key:"restoreState",value:function(a){this.value=Object(u.m)(a,this.enumType)}},{key:"toJSON",value:function(){return this.enumType[this.value_].toLowerCase()}},{key:"value",set:function(a){this.value_!==a&&(this.value_=a,this.changed.dispatch())},get:function(){return this.value_}}]);return a}()},function(m,f,d){function u(a,c){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!c||"object"!==typeof c&&"function"!==typeof c?a:c}function p(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}d.d(f,"a",function(){return n});m=d(5);var q=d.n(m);m=d(0);var a=d(10),c=function(){function a(a,c){for(var d=0;d<c.length;d++){var g=
c[d];g.enumerable=g.enumerable||!1;g.configurable=!0;"value"in g&&(g.writable=!0);Object.defineProperty(a,g.key,g)}}return function(c,d,f){d&&a(c.prototype,d);f&&a(c,f);return c}}(),n=function(d){function f(a){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var c=u(this,(f.__proto__||Object.getPrototypeOf(f)).call(this));c.ref=a;c.element=document.createElement("label");c.selectElement=document.createElement("select");c.registerDisposer(a);a=c.selectElement;c.element.appendChild(a);
c.updateView();c.registerEventListener(a,"change",function(){return c.updateModel()});c.registerDisposer(c.ref.changed.add(q()(function(){return c.updateView()},0)));return c}p(f,d);c(f,[{key:"updateModel",value:function(){this.ref.layerName=this.selectElement.value||void 0}},{key:"updateView",value:function(){var c=this.selectElement,d=this.ref,f=d.filter;Object(a.a)(c);var e=document.createElement("option");c.appendChild(e);e=$jscomp.makeIterator(this.ref.layerManager.managedLayers);for(var b=e.next();!b.done;b=
e.next()){var h=b.value;f(h)&&(b=document.createElement("option"),h=h.name,b.textContent=h,b.value=h,c.appendChild(b))}c.value=d.layerName||""}}]);return f}(m.a)},function(m,f){},function(m,f,d){function u(a){var b=new x.a,c=new t.a;b.add("viewer",c);a.global.addParent(c.eventActionMap,1E3);c=new t.a;b.add("sliceView",c);a.sliceView.addParent(c.eventActionMap,1E3);c=new t.a;b.add("perspectiveView",c);a.perspectiveView.addParent(c.eventActionMap,1E3);c=new t.a;b.add("dataView",c);a.perspectiveView.addParent(c.eventActionMap,
999);a.sliceView.addParent(c.eventActionMap,999);return b}function p(a){var b=new h.c({},function(a){for(var b=$jscomp.makeIterator(Object.keys(a)),c=b.next();!c.done;c=b.next()){c=c.value;var d=a[c];if("number"!==typeof d)throw Error("Expected key "+JSON.stringify(c)+" to have a numeric value, but received: "+JSON.stringify(d)+".");}return a});b.changed.add(q()(function(){for(var c=b.value,d=$jscomp.makeIterator(Object.keys(c)),e=d.next();!e.done;e=d.next())e=e.value,a.setSourceGeneration(e,c[e]);
d=$jscomp.makeIterator(a.sourceGenerations.keys());for(e=d.next();!e.done;e=d.next())e=e.value,c.hasOwnProperty(e)||a.deleteSourceGeneration(e)},0));return b}Object.defineProperty(f,"__esModule",{value:!0});m=d(5);var q=d.n(m),a=d(94),c=d(32),n=d(132),v=d(264),t=d(265),l=d(266),k=d(306),g=d(307),e=d(308),b=d(309),h=d(6),r=d(343),A=d(344),y=d(345),z=d(353),E=d(2),x=d(29);window.addEventListener("DOMContentLoaded",function(){var d=new x.a,f=new x.a,m=new v.a;d.add("credentials",m.inputState);f.add("credentials",
m.outputState);m=Object(c.a)({credentialsManager:new a.a(m)});var t=new n.PythonDataSource;m.register("python",t);d.add("sourceGenerations",p(t));var B=window.viewer=Object(y.a)({showLayerDialog:!1,resetStateWhenEmpty:!1,dataSourceProvider:m});Object(A.a)(B.inputEventBindings);d.add("inputEventBindings",u(B.inputEventBindings));t=new k.a(B);window.remoteActionHandler=t;d.add("actions",t.actionSet);d.add("statusMessages",new g.a);var F=new e.a(B);d.add("screenshot",F.requestState);var P=B.state;window.location.hash&&
(B.registerDisposer(new z.a(B.state)).updateFromUrlHash(),P=void 0);m=new l.a(B.display,m,B.dataContext.addRef(),B.uiConfiguration);d.add("prefetch",m);d.add("showUIControls",B.uiConfiguration.showUIControls);d.add("showLayerPanel",B.uiConfiguration.showLayerPanel);d.add("showHelpButton",B.uiConfiguration.showHelpButton);d.add("showLocation",B.uiConfiguration.showLocation);d.add("showPanelBorders",B.uiConfiguration.showPanelBorders);var H=new h.c(void 0,function(a){return null==a?void 0:Object(E.c)([0,
0],a,E.r)});d.add("viewerSize",H);var N=function(){var a=B.display.container,b=H.value;void 0===b?(a.style.position="relative",a.style.width=null,a.style.height=null,a.style.transform=null,a.style.transformOrigin=null):(a.style.position="absolute",a.style.width=b[0]+"px",a.style.height=b[1]+"px",a.style.transform="scale("+Math.min(document.documentElement.clientWidth/b[0],document.documentElement.clientHeight/b[1])+")",a.style.transformOrigin="top left");B.display.onResize()};N();window.addEventListener("resize",
N);H.changed.add(q()(function(){return N()},0));var R=new b.a(P,f,d);t.sendActionRequested.add(function(a,b){return R.sendActionNotification(a,b)});F.sendScreenshotRequested.add(function(a){return R.sendActionNotification("screenshot",a)});Object(r.a)(B);Object(r.b)(B)})},function(m,f,d){function u(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(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 q(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)}d.d(f,"a",function(){return g});var a=d(94),c=d(6),n=d(64),v=d(29),t=d(2),l=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,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),k=function(d){function b(){u(this,b);var d=p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));d.invalidCredentials=new c.c(void 0,function(a){return a});d.validCredentials=new c.c(void 0,function(a){return a});d.get=Object(a.d)(function(a){return new Promise(function(b){var c=d.validCredentials.value,e=void 0!==
a?a.generation:null;if(void 0!==c&&e!==c.generation)b(c);else{d.invalidCredentials.value=e;var f=d.validCredentials.changed.add(function(){var a=d.validCredentials.value;void 0!==a&&e!==a.generation&&(f(),b(a))})}})});return d}q(b,d);return b}(a.c),g=function(){function a(){u(this,a);this.inputState=new v.b;this.outputState=new v.b;this.memoize=new n.a}l(a,[{key:"getCredentialsProvider",value:function(a,c){var b=this;void 0===c&&(c=null);var d=Object(t.g)({key:a,parameters:c});return this.memoize.get(d,
function(){var a=new k;a.registerDisposer(b.inputState.add(d,a.validCredentials));a.registerDisposer(b.outputState.add(d,a.invalidCredentials));return a})}}]);return a}()},function(m,f,d){d.d(f,"a",function(){return c});var u=d(2),p=d(3),q=d(20),a=function(){function a(a,c){for(var d=0;d<c.length;d++){var f=c[d];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}return function(c,d,f){d&&a(c.prototype,d);f&&a(c,f);return c}}(),c=function(){function c(){if(!(this instanceof
c))throw new TypeError("Cannot call a class as a function");this.eventActionMap=new q.a;this.changed=new p.a}a(c,[{key:"reset",value:function(){this.eventActionMap.clear();this.changed.dispatch()}},{key:"restoreState",value:function(a){Object(u.t)(a);for(var c=this.eventActionMap,d=$jscomp.makeIterator(Object.keys(a)),f=d.next();!f.done;f=d.next()){f=f.value;var g=Object(u.A)(a[f]);c.set(f,g)}this.changed.dispatch()}},{key:"toJSON",value:function(){for(var a={},c=$jscomp.makeIterator(this.eventActionMap.bindings),
d=c.next();!d.done;d=c.next()){var f=$jscomp.makeIterator(d.value);d=f.next().value;f=f.next().value;a[d]=f.action}return a}}]);return c}()},function(m,f,d){function u(a,c){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!c||"object"!==typeof c&&"function"!==typeof c?a:c}function p(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,
{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}d.d(f,"a",function(){return l});m=d(5);var q=d.n(m);m=d(0);var a=d(2),c=d(3),n=d(150),v=d(24),t=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(c,d,b){d&&a(c.prototype,d);b&&a(c,b);return c}}(),l=function(d){function f(a,
b,d,g){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var e=u(this,(f.__proto__||Object.getPrototypeOf(f)).call(this));e.display=a;e.dataSourceProvider=b;e.dataContext=d;e.uiConfiguration=g;e.prefetchStates=new Map;e.changed=new c.a;e.specification=[];e.updatePrefetchStates=e.registerCancellable(q()(function(){var a=e.specification,b=e.prefetchStates,c=new Set;a=$jscomp.makeIterator(a);for(var d=a.next();!d.done;d=a.next()){var f=d.value;d=f.state;f=f.priority;var g=
JSON.stringify(d);c.add(g);var h=b.get(g);void 0===h?(h=e.makePrefetchState(d,f),b.set(g,h)):h.visibility.value=f}a=$jscomp.makeIterator(b);for(d=a.next();!d.done;d=a.next())f=$jscomp.makeIterator(d.value),d=f.next().value,f=f.next().value,c.has(d)||(b.delete(d),f.dispose())},0));e.registerDisposer(d);return e}p(f,d);t(f,[{key:"makePrefetchState",value:function(a,b){b=new n.a(this.display,{showLayerDialog:!1,resetStateWhenEmpty:!1,dataSourceProvider:this.dataSourceProvider,dataContext:this.dataContext.addRef(),
visibility:new v.b(b),uiConfiguration:this.uiConfiguration});try{b.state.restoreState(a)}catch(h){console.log("Error setting prefetch state: "+h.message)}return b}},{key:"reset",value:function(){this.specification=[];this.changed.dispatch();this.updatePrefetchStates()}},{key:"restoreState",value:function(c){this.specification=Object(a.a)(c,function(b){Object(a.t)(b);var c=Object(a.v)(b,"state",a.t);b=Object(a.v)(b,"priority",function(b){return void 0===b?0:Object(a.r)(b)});return{state:c,priority:b}});
this.changed.dispatch();this.updatePrefetchStates()}},{key:"toJSON",value:function(){return 0===this.specification.length?void 0:this.specification}}]);return f}(m.a)},function(m,f,d){m=new (d(94).b);f.a=m},function(m,f,d){f.b=function(d,f){return function(p){p.style.flex=d;f(p)}};f.a=function(d,f){return function(p){p.style.display="flex";p.style.flexDirection=d;for(var a=$jscomp.makeIterator(f),c=a.next();!c.done;c=a.next()){c=c.value;var n=p.ownerDocument.createElement("div");p.appendChild(n);
c(n)}}}},function(m,f,d){function u(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(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 q(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(F)}function c(a){a.addFragmentExtension("GL_EXT_draw_buffers");a.addFragmentCode(P)}function n(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")}d.d(f,"a",function(){return U});var v=d(116),
t=d(15),l=d(117),k=d(270),g=d(54);m=d(118);var e=d(46),b=d(40),h=d(20),r=d(1),A=d(121),y=d(152);f=d(24);var z=d(11),E=d(78),x=d(17),D=d(69),G=d(12),J=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=function aa(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 aa(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};d(41);d(271);var B;(function(a){a[a.COLOR=0]="COLOR";a[a.Z=1]="Z";a[a.PICK=2]="PICK";a[a.NUM_TEXTURES=3]="NUM_TEXTURES"})(B||(B={}));var F=[x.k,"\nvoid emit(vec4 color, vec4 pickId) {\n  gl_FragData["+B.COLOR+"] = color;\n  gl_FragData["+B.Z+"] = packFloat01ToFixedPoint(1.0 - gl_FragCoord.z);\n  gl_FragData["+B.PICK+"] = pickId;\n}\n"],P=["\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"],H=r.s.create(),N=r.s.create(),R=r.u.create(),O=r.k.create(),Q=function(a){function b(){u(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);return b}(Object(f.c)(G.b)),U=function(d){function f(c,d,m){u(this,f);var q=p(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,
c,d,m));q.sliceViews=function(){var a=new Map;return q.registerDisposer(new y.a(function(b,c){b=c.visibility.add(q.visibility);a.set(c,b);q.scheduleRedraw()},function(b,c){b=a.get(c);a.delete(c);b();c.dispose();q.scheduleRedraw()}))}();q.projectionMat=r.k.create();q.inverseProjectionMat=r.k.create();q.modelViewMat=r.k.create();q.width=0;q.height=0;q.pickIDs=new l.a;q.axesLineHelper=q.registerDisposer(v.a.get(q.gl));q.sliceViewRenderHelper=q.registerDisposer(e.d.get(q.gl,a));q.offscreenFramebuffer=
q.registerDisposer(new E.b(q.gl,{colorBuffers:Object(E.e)(q.gl,B.NUM_TEXTURES),depthBuffer:new E.a(q.gl)}));q.offscreenCopyHelper=q.registerDisposer(E.c.get(q.gl));q.transparencyCopyHelper=q.registerDisposer(E.c.get(q.gl,n,2));q.scaleBarCopyHelper=q.registerDisposer(E.c.get(q.gl));q.scaleBarTexture=q.registerDisposer(new D.a(q.gl));q.nanometersPerPixel=1;q.registerDisposer(q.navigationState.changed.add(function(){q.viewportChanged()}));c=q.sharedObject=q.registerDisposer(new Q);c.RPC_TYPE_ID=k.c;
c.initializeCounterpart(m.rpc,{});c.visibility.add(q.visibility);q.visibleLayerTracker=Object(t.l)(q.viewer.layerManager,g.a,q.viewer.visibleLayerRoles,q,function(a){var b=a.backend;if(b)return b.rpc.invoke(k.a,{layer:b.rpcId,view:q.sharedObject.rpcId}),function(){b.rpc.invoke(k.b,{layer:b.rpcId,view:q.sharedObject.rpcId})}});Object(h.c)(d,"translate-via-mouse-drag",function(a){Object(A.a)(a.detail,function(a,b,c){a=q.width;var d=q.height,e=q.viewer.navigationState.position,f=e.spatialCoordinates;
r.s.transformMat4(H,f,q.projectionMat);H[0]=2*b/a;H[1]=-2*c/d;r.s.transformMat4(f,H,q.inverseProjectionMat);e.changed.dispatch()})});Object(h.c)(d,"rotate-via-mouse-drag",function(a){Object(A.a)(a.detail,function(a,b,c){q.navigationState.pose.rotateRelative(r.e[1],-b/4*Math.PI/180);q.navigationState.pose.rotateRelative(r.e[0],c/4*Math.PI/180);q.viewer.navigationState.changed.dispatch()})});m.showSliceViewsCheckbox&&(d=q.registerDisposer(new b.c(m.showSliceViews)),d.element.className="perspective-panel-show-slice-views neuroglancer-noselect",
c=document.createElement("label"),c.className="perspective-panel-show-slice-views neuroglancer-noselect",c.appendChild(document.createTextNode("Slices")),c.appendChild(d.element),q.element.appendChild(c));q.registerDisposer(m.orthographicProjection.changed.add(function(){return q.scheduleRedraw()}));q.registerDisposer(m.showScaleBar.changed.add(function(){return q.scheduleRedraw()}));q.registerDisposer(m.showSliceViews.changed.add(function(){return q.scheduleRedraw()}));q.registerDisposer(m.showAxisLines.changed.add(function(){return q.scheduleRedraw()}));
q.registerDisposer(m.crossSectionBackgroundColor.changed.add(function(){return q.scheduleRedraw()}));return q}q(f,d);J(f,[{key:"isReady",value:function(){if(!this.visible)return!1;for(var a=$jscomp.makeIterator(this.sliceViews),b=a.next();!b.done;b=a.next()){b=$jscomp.makeIterator(b.value);var c=b.next().value;if((b.next().value||this.viewer.showSliceViews.value)&&!c.isReady())return!1}a=this.visibleLayerTracker.getVisibleLayers();a=$jscomp.makeIterator(a);for(b=a.next();!b.done;b=a.next())if(!b.value.isReady())return!1;
return!0}},{key:"updateProjectionMatrix",value:function(){var a=this.projectionMat,b=this.width/this.height,c=Math.PI/4;this.viewer.orthographicProjection.value?(c=100/(1/Math.tan(c/2)),r.k.ortho(a,-b*c,b*c,-c,c,10,5E3),this.nanometersPerPixel=1/(2*a[0])*this.navigationState.zoomFactor.value,this.nanometersPerPixel=2*b*c/this.width*this.navigationState.zoomFactor.value):r.k.perspective(a,c,b,10,5E3);b=this.modelViewMat;this.navigationState.toMat4(b);r.s.set(H,1,-1,-1);r.k.scale(b,b,H);c=r.s.set(H,
0,0,100);r.k.translate(b,b,c);r.k.invert(O,b);r.k.multiply(a,a,O);r.k.invert(this.inverseProjectionMat,a)}},{key:"viewportChanged",value:function(){this.context.scheduleRedraw()}},{key:"onResize",value:function(){var a=this.element,b=a.clientHeight;if(a.clientWidth!==this.width||b!==this.height)this.width=this.element.clientWidth,this.height=this.element.clientHeight,this.viewportChanged()}},{key:"disposed",value:function(){for(var a=$jscomp.makeIterator(this.sliceViews.keys()),b=a.next();!b.done;b=
a.next())b.value.dispose();this.sliceViews.clear();C(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"disposed",this).call(this)}},{key:"updateMouseState",value:function(a){a.pickedRenderLayer=null;if(!this.navigationState.valid)return!1;var b=a.position,c=this.offscreenFramebuffer,d=this.width,e=this.height;if(!c.hasSize(d,e))return!1;var f=this.mouseX,g=e-this.mouseY,h=c.readPixel(B.Z,f,g);h=1-Object(x.s)(h);if(1===h)return!1;b[0]=2*f/d-1;b[1]=2*g/e-1;b[2]=2*h-1;r.s.transformMat4(b,b,
this.inverseProjectionMat);this.pickIDs.setMouseState(a,c.readPixelAsUint32(B.PICK,f,g));return!0}},{key:"draw",value:function(){if(this.navigationState.valid){this.onResize();var b=this.width,d=this.height;if(0!==b&&0!==d){for(var e=this.viewer.showSliceViews.value,f=$jscomp.makeIterator(this.sliceViews),g=f.next();!g.done;g=f.next()){g=$jscomp.makeIterator(g.value);var h=g.next().value;(g.next().value||e)&&h.updateRendering()}e=this.gl;this.offscreenFramebuffer.bind(b,d);e.disable(e.SCISSOR_TEST);
this.gl.clearColor(0,0,0,0);e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);e.enable(e.DEPTH_TEST);f=this.projectionMat;this.updateProjectionMatrix();g=r.s.create();Object(r.p)(g,r.e[2],this.modelViewMat);r.s.normalize(g,g);h=this.pickIDs;h.clear();f={dataToDevice:f,lightDirection:g,ambientLighting:.2,directionalLighting:.8,pickIDs:h,emitter:a,emitColor:!0,emitPickID:!0,alreadyEmittedPickID:!1,viewportWidth:b,viewportHeight:d};g=this.visibleLayerTracker.getVisibleLayers();var k=!1,l=!1,n=$jscomp.makeIterator(g);
for(h=n.next();!h.done;h=n.next())h=h.value,h.isTransparent?k=!0:h.isAnnotation?l=!0:h.draw(f);this.drawSliceViews(f);if(l){e.enable(z.b);e.depthFunc(z.i);e.blendFunc(z.u,z.p);e.WEBGL_draw_buffers.drawBuffersWEBGL([e.WEBGL_draw_buffers.COLOR_ATTACHMENT0_WEBGL,e.NONE,e.NONE]);f.emitPickID=!1;l=$jscomp.makeIterator(g);for(h=l.next();!h.done;h=l.next())h=h.value,h.isAnnotation&&h.draw(f);e.depthFunc(z.j);e.disable(z.b);e.WEBGL_draw_buffers.drawBuffersWEBGL([e.WEBGL_draw_buffers.COLOR_ATTACHMENT0_WEBGL,
e.WEBGL_draw_buffers.COLOR_ATTACHMENT1_WEBGL,e.WEBGL_draw_buffers.COLOR_ATTACHMENT2_WEBGL]);f.emitPickID=!0}this.viewer.showAxisLines.value&&this.drawAxisLines();if(k){e.depthMask(!1);e.enable(z.b);k=this.transparentConfiguration;k.bind(b,d);this.gl.clearColor(0,0,0,1);e.clear(z.d);f.emitter=c;e.blendFuncSeparate(z.o,z.o,z.J,z.p);f.emitPickID=!1;l=$jscomp.makeIterator(g);for(h=l.next();!h.done;h=l.next())h=h.value,h.isTransparent&&h.draw(f);e.disable(z.e);this.offscreenFramebuffer.bindSingle(B.COLOR);
e.blendFunc(z.p,z.u);this.transparencyCopyHelper.draw(k.colorBuffers[0].texture,k.colorBuffers[1].texture);e.depthMask(!0);e.disable(z.b);e.enable(z.e);this.offscreenFramebuffer.bind(b,d)}e.WEBGL_draw_buffers.drawBuffersWEBGL([e.NONE,e.WEBGL_draw_buffers.COLOR_ATTACHMENT1_WEBGL,e.WEBGL_draw_buffers.COLOR_ATTACHMENT2_WEBGL]);f.emitter=a;f.emitPickID=!0;f.emitColor=!1;e.enable(z.q);e.polygonOffset(-1,-1);d=$jscomp.makeIterator(g);for(h=d.next();!h.done;h=d.next())g=h.value,f.alreadyEmittedPickID=!g.isTransparent&&
!g.isAnnotation,g.draw(f);e.disable(z.q);this.viewer.showScaleBar.value&&this.viewer.orthographicProjection.value&&(e.WEBGL_draw_buffers.drawBuffersWEBGL([e.WEBGL_draw_buffers.COLOR_ATTACHMENT0_WEBGL]),e.disable(z.e),e.enable(z.b),e.blendFunc(z.u,z.p),d=this.scaleBarTexture,f=d.dimensions,f.targetLengthInPixels=Math.min(b/4,100),f.nanometersPerPixel=this.nanometersPerPixel,d.update(),e.viewport(10,10,d.width,d.height),this.scaleBarCopyHelper.draw(d.texture),e.disable(z.b));this.offscreenFramebuffer.unbind();
this.setGLViewport();this.offscreenCopyHelper.draw(this.offscreenFramebuffer.colorBuffers[B.COLOR].texture)}}}},{key:"drawSliceViews",value:function(a){var b=this.sliceViewRenderHelper,c=a.lightDirection,d=a.ambientLighting,e=a.directionalLighting;a=a.dataToDevice;for(var f=this.viewer.showSliceViews.value,g=$jscomp.makeIterator(this.sliceViews),h=g.next();!h.done;h=g.next()){var k=$jscomp.makeIterator(h.value);h=k.next().value;if((k.next().value||f)&&0!==h.width&&0!==h.height&&h.hasValidViewport){k=
Math.abs(r.s.dot(c,h.viewportAxes[2]));k=d+k*e;var l=O;r.k.identity(l);l[0]=h.width/2;l[5]=-h.height/2;r.k.multiply(l,h.viewportToData,l);r.k.multiply(l,a,l);var n=R,p=this.viewer.crossSectionBackgroundColor.value;n[0]=p[0];n[1]=p[1];n[2]=p[2];n[3]=1;b.draw(h.offscreenFramebuffer.colorBuffers[0].texture,l,r.u.fromValues(k,k,k,1),R,0,0,1,1)}}}},{key:"drawAxisLines",value:function(){var a=this.viewer.navigationState.position.spatialCoordinates;r.s.transformMat4(H,a,this.projectionMat);H[0]=.5;r.s.transformMat4(N,
H,this.inverseProjectionMat);var b=r.s.distance(N,a);H[0]=0;H[1]=.5;r.s.transformMat4(N,H,this.inverseProjectionMat);var c=r.s.distance(N,a);a=this.gl;r.k.identity(O);b=Math.min(b,c);O[0]=b;O[5]=b;O[10]=b;b=this.navigationState.position.spatialCoordinates;O[12]=b[0];O[13]=b[1];O[14]=b[2];O[15]=1;r.k.multiply(O,this.projectionMat,O);a.WEBGL_draw_buffers.drawBuffersWEBGL([a.WEBGL_draw_buffers.COLOR_ATTACHMENT0_WEBGL]);this.axesLineHelper.draw(O,!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 E.b(this.gl,{colorBuffers:Object(E.e)(this.gl,2,this.gl.RGBA,this.gl.FLOAT),depthBuffer:this.offscreenFramebuffer.depthBuffer.addRef()})));return a}}]);return f}(m.a)},function(m,f,d){f.c="perspective_view/PerspectiveView";f.a="perspective_view/addLayer";f.b="perspective_view/removeLayer"},
function(m,f){},function(m,f,d){function u(a,d){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!d||"object"!==typeof d&&"function"!==typeof d?a:d}function p(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)}function q(a){return a.startsWith("key")?a.substring(3):a.startsWith("digit")||a.startsWith("arrow")?a.substring(5):a}d.d(f,"a",function(){return a});m=d(42);d(273);var a=function(a){function c(a){function d(a,b){for(var c=$jscomp.makeIterator(a.parents),e=c.next();!e.done;e=c.next())e=e.value,void 0!==e.label?f(e.label,e):d(e,b);a=$jscomp.makeIterator(a.bindings.entries());for(c=a.next();!c.done;c=a.next()){e=$jscomp.makeIterator(c.value);c=e.next().value;e=e.next().value;var g=c.indexOf(":");
c=c.substring(g+1);b.set(c,e.action)}}function f(a,c){b.has(c)||(a={label:a,entries:new Map},d(c,a.entries),b.set(c,a))}if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");var k=u(this,(c.__proto__||Object.getPrototypeOf(c)).call(this)),g=k.content;g.classList.add("describe-key-bindings");var e=document.createElement("div");e.classList.add("describe-key-bindings-container");var b=new Map;a=$jscomp.makeIterator(a);for(var h=a.next();!h.done;h=a.next()){var n=$jscomp.makeIterator(h.value);
h=n.next().value;n=n.next().value;f(h,n)}a=$jscomp.makeIterator(b.values());for(h=a.next();!h.done;h=a.next()){n=h.value;h=document.createElement("h2");h.textContent=n.label;e.appendChild(h);h=document.createElement("div");h.className="dl";n=$jscomp.makeIterator(n.entries);for(var p=n.next();!p.done;p=n.next()){var m=$jscomp.makeIterator(p.value);p=m.next().value;m=m.next().value;var v=document.createElement("div"),E=document.createElement("div");E.className="definition-outer-container";v.className=
"definition-container";var x=document.createElement("div");x.className="dt";x.textContent=p.split("+").map(q).join("+");p=document.createElement("div");p.className="dd";p.textContent=m;v.appendChild(x);v.appendChild(p);h.appendChild(E);E.appendChild(v)}e.appendChild(h)}g.appendChild(e);return k}p(c,a);return c}(m.a)},function(m,f){},function(m,f,d){function u(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 p(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 q(a){var b=document.createElement("div");b.textContent=a.value;return b}f.b=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};d.d(f,"a",function(){return y});m=d(5);var a=d.n(m),c=d(34);m=d(0);var n=d(10),v=d(275),t=d(55),l=d(276),k=d(277),g=d(3),e=d(154),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}}(),h=function E(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 E(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};d(278);$jscomp.initSymbol();var r=Symbol("autocompleteIndex"),A=t.a.fromObject({arrowdown:{action:"cycle-next-active-completion"},arrowup:{action:"cycle-prev-active-completion"},tab:{action:"choose-active-completion-or-prefix",
preventDefault:!1},enter:{action:"choose-active-completion",preventDefault:!1},escape:{action:"cancel",preventDefault:!1,stopPropagation:!1}}),y=function(d){function f(b){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var d=u(this,(f.__proto__||Object.getPrototypeOf(f)).call(this));d.inputChanged=new g.b;d.prevInputValue="";d.completionsVisible=!1;d.activeCompletionPromise=null;d.activeCompletionCancellationToken=void 0;d.hasFocus=!1;d.completionResult=null;d.dropdownContentsStale=
!0;d.updateHintScrollPositionTimer=null;d.completionElements=null;d.hasResultForDropdown=!1;d.commonPrefix="";d.activeIndex=-1;d.dropdownStyleStale=!0;d.completer=b.completer;b=void 0===b.delay?200:b.delay;var h=d.scheduleUpdateCompletions=a()(function(){var a=d.activeCompletionCancellationToken=new c.b,b=d.activeCompletionPromise=d.completer(d.value,a);null!==b&&b.then(function(a){d.activeCompletionPromise===b&&(d.setCompletions(a),d.activeCompletionPromise=null)})},b);d.registerDisposer(function(){h.cancel()});
b=d.element=document.createElement("div");b.className="autocomplete";var k=document.createElement("div");k.className="autocomplete-dropdown-wrapper";var l=d.dropdownElement=document.createElement("div");l.className="autocomplete-dropdown";var n=d.promptElement=document.createElement("label");n.className="autocomplete-prompt";var r=d.inputWrapperElement=document.createElement("div");r.className="autocomplete-input-wrapper";b.appendChild(n);var p=d.inputElement=document.createElement("input");p.type=
"text";p.autocomplete="off";p.spellcheck=!1;p.className="autocomplete-input";Object(e.a)(n,p);n=d.hintElement=document.createElement("input");n.type="text";n.spellcheck=!1;n.className="autocomplete-hint";n.disabled=!0;r.appendChild(n);r.appendChild(p);k.appendChild(r);k.appendChild(l);b.appendChild(k);d.registerInputHandler();d.handleInputChanged("");d.registerEventListener(d.inputElement,"focus",function(){d.hasFocus||(d.hasFocus=!0,d.dropdownStyleStale=!0,d.updateDropdown())});d.registerEventListener(d.inputElement,
"blur",function(){d.hasFocus&&(d.hasFocus=!1,d.updateDropdown())});d.registerEventListener(b.ownerDocument.defaultView,"resize",function(){d.dropdownStyleStale=!0});d.registerEventListener(b.ownerDocument.defaultView,"scroll",function(){d.dropdownStyleStale=!0});d.registerEventListener(d.dropdownElement,"mousedown",d.handleDropdownMousedown.bind(d));d.registerEventListener(d.inputElement,"keydown",function(){d.hintScrollPositionMayBeStale()});d.registerEventListener(d.inputElement,"mousemove",function(a){0!==
a.buttons&&d.hintScrollPositionMayBeStale()});d.registerDisposer(new t.b(p,A)).allShortcutsAreGlobal=!0;Object(t.c)(p,"cycle-next-active-completion",function(){d.cycleActiveCompletion(1)});Object(t.c)(p,"cycle-prev-active-completion",function(){d.cycleActiveCompletion(-1)});Object(t.c)(p,"choose-active-completion-or-prefix",function(a){d.selectActiveCompletion(!0)&&a.preventDefault()});Object(t.c)(p,"choose-active-completion",function(a){d.selectActiveCompletion(!1)&&a.preventDefault()});Object(t.c)(p,
"cancel",function(a){a.stopPropagation();d.cancel()&&(a.detail.preventDefault(),a.detail.stopPropagation())});return d}p(f,d);b(f,[{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[r];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:"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(){Object(v.a)(this.dropdownElement,this.inputElement,{horizontal:!1});this.dropdownStyleStale=!1}},{key:"updateDropdown",value:function(){if(this.shouldShowDropdown()){var a=this.dropdownElement,b=this.activeIndex;if(this.dropdownContentsStale){var c=this.completionResult,d=void 0===c.makeElement?q:c.makeElement;this.completionElements=c.completions.map(function(e,
f){e=d.call(c,e);e[r]=f;e.classList.add("autocomplete-completion");b===f&&e.classList.add("autocomplete-completion-active");a.appendChild(e);return e});this.dropdownContentsStale=!1}this.dropdownStyleStale&&this.updateDropdownStyle();this.completionsVisible||(a.style.display="block",this.completionsVisible=!0);-1!==b&&Object(k.a)(this.completionElements[b])}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=Object(l.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"),Object(k.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="",Object(n.a)(this.dropdownElement),this.updateDropdown())}},{key:"disposed",value:function(){Object(n.b)(this.element);this.cancelActiveCompletion();null!==this.updateHintScrollPositionTimer&&(clearTimeout(this.updateHintScrollPositionTimer),this.updateHintScrollPositionTimer=null);h(f.prototype.__proto__||Object.getPrototypeOf(f.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 f}(m.a)},function(m,f,d){f.a=function(d,f,m){var a=void 0===m?{}:m,c=void 0===a.horizontal?!1:a.horizontal,n=void 0===a.vertical?!0:a.vertical,p=void 0===a.topMargin?6:a.topMargin,q=void 0===a.bottomMargin?6:a.bottomMargin,l=void 0===a.leftMargin?6:a.leftMargin,k=void 0===
a.rightMargin?6:a.rightMargin;m=void 0===a.maxHeight?!0:a.maxHeight;a=void 0===a.maxWidth?!0:a.maxWidth;f=f.getBoundingClientRect();if(c){c=f.right;var g=d.ownerDocument.documentElement.clientHeight-f.left;c>g?(d.style.left="",d.style.right="0",a&&(d.style.maxWidth=c-l+"px")):(d.style.right="",d.style.left="0",a&&(d.style.maxWidth=g-k+"px"))}n&&(n=f.top-p,q=d.ownerDocument.documentElement.clientHeight-f.bottom-q,n>3*q?(d.style.top="",d.style.bottom="100%",m&&(d.style.maxHeight=n+"px")):(d.style.top=
"100%",d.style.bottom="",m&&(d.style.maxHeight=q+"px")))}},function(m,f,d){f.a=function(d){$jscomp.initSymbol();$jscomp.initSymbolIterator();d=d[Symbol.iterator]();var f=d.next(),m=f.value;if(f.done)return"";for(f=m.length;0<f;){var a=d.next(),c=a.value;if(a.done)break;for(a=0;a<f&&m.charCodeAt(a)===c.charCodeAt(a);++a);f=a}return m.substring(0,f)}},function(m,f,d){f.a=function(d){var f=d.parentElement,m=d.offsetLeft-f.clientLeft,a=d.offsetTop-f.clientTop,c=f.scrollLeft,n=f.scrollTop;a=Math.max(0,
a+d.offsetHeight-(n+f.clientHeight))||Math.min(0,a-n);f.scrollLeft+=Math.max(0,m+d.offsetWidth-(c+f.clientWidth))||Math.min(0,m-c);f.scrollTop+=a}},function(m,f){},function(m,f,d){f.a=function(){var d=document.createElement("button");d.type="submit";d.className="hidden-submit-button";d.style.margin="0";d.style.border="0";d.style.padding="0";d.style.width="0";d.style.height="0";d.style.overflow="hidden";d.tabIndex=-1;return d}},function(m,f){},function(m,f,d){function u(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
}function p(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 q(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){return{mouseState:a.mouseState,
showAxisLines:a.showAxisLines,showScaleBar:a.showScaleBar,showPerspectiveSliceViews:a.showPerspectiveSliceViews,inputEventBindings:a.inputEventBindings,visibility:a.visibility,selectedLayer:a.selectedLayer,visibleLayerRoles:a.visibleLayerRoles,navigationState:a.navigationState.addRef(),perspectiveNavigationState:a.perspectiveNavigationState.addRef(),crossSectionBackgroundColor:a.crossSectionBackgroundColor}}function c(a,c,d){var e=Object(g.c)(a,"dragenter",function(b){void 0!==Object(k.c)(b)&&a.classList.add("neuroglancer-drag-over")}),
f=Object(g.c)(a,"dragleave",function(){a.classList.remove("neuroglancer-drag-over")}),h=Object(g.c)(a,"dragover",function(a){Object(t.c)(a)?(Object(b.e)(a,Object(t.b)(a,c)),a.stopPropagation(),a.preventDefault()):void 0!==Object(k.c)(a)&&(Object(k.f)(a,c,!0),a.stopPropagation(),a.preventDefault())}),l=Object(g.c)(a,"drop",function(e){a.classList.remove("neuroglancer-drag-over");if(Object(t.c)(e)){e.stopPropagation();try{var f=JSON.parse(e.dataTransfer.getData(t.d))}catch(W){return}var g=Object(k.b)(e,
c,!1,!1,!0);if(void 0!==g&&g.finalize(e)){e.preventDefault();e.dataTransfer.dropEffect=Object(b.c)();Object(k.a)(e);var h=d();g=$jscomp.makeIterator(g.layers.keys());for(e=g.next();!e.done;e=g.next())h.layerSpecification.add(e.value);try{h.restoreState(f)}catch(W){}}}else if(h=Object(k.b)(e,c,"copy"===Object(b.c)(),!1,!0),void 0!==h&&h.finalize(e))for(e.preventDefault(),e.dataTransfer.dropEffect=Object(b.c)(),Object(k.a)(e),f=d(),h=$jscomp.makeIterator(h.layers.keys()),e=h.next();!e.done;e=h.next())f.layerSpecification.add(e.value)});
return function(){l();h();f();e()}}function n(b,c){var d=document.createElement("div");d.style.flex="1";d.style.width="0px";if("string"===typeof c){if(void 0!==b.parent)throw Error("Invalid layout component specification: "+JSON.stringify(c));return new x(d,c,b.viewer)}Object(h.t)(c);var e=Object(h.v)(c,"type",h.A);switch(e){case "row":case "column":return new D(d,e,Object(h.v)(c,"children",function(a){a=Object(h.a)(a,function(a){return a});if(void 0===b.parent&&0===a.length)throw Error("Stack layout requires at least one child.");
return a}),b);case "viewer":e=b.viewer;var f=new l.a(e.layerSpecification.addRef());d=new t.a(d,Object.assign({display:e.display,layerSpecification:f},a(e)),{showLayerPanel:e.uiControlVisibility.showLayerPanel,showViewerMenu:!0});try{d.restoreState(c)}catch(H){throw d.dispose(),H;}return d;default:return new x(d,c,b.viewer)}}d.d(f,"a",function(){return G});m=d(5);var v=d.n(m),t=d(282),l=d(21),k=d(95),g=d(0),e=d(10),b=d(96),h=d(2),r=d(3),A=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}}(),y=function C(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 C(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};d(289);$jscomp.initSymbol();var z=Symbol("layoutComponentContainer"),E=function(a){function b(a,
d,e){u(this,b);var f=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));f.viewer=a;f.parent=e;f.changed=new r.a;f.element=document.createElement("div");var g=f.element;g.style.display="flex";g.style.flex="1";g.style.position="relative";g.style.alignItems="stretch";g.foo="hello";g[z]=f;f.setSpecification(d);var h=[];a=function(a){var b=document.createElement("div");b.className="neuroglancer-layout-split-drop-zone";b.style[a]="0";switch(a){case "left":case "right":var d="row";b.style.width=
"10px";b.style.height="100%";break;case "top":case "bottom":d="column",b.style.height="10px",b.style.width="100%"}b.style.display="none";h.push({element:b,direction:d,orientation:a});g.appendChild(b);f.registerDisposer(c(b,f.viewer.layerSpecification,function(){return f.split(a).newContainer.component}))};a("left");a("right");a("top");a("bottom");var l=!1;f.registerEventListener(g,"dragenter",function(a){if(!l&&void 0!==Object(k.c)(a)){l=!0;a=$jscomp.makeIterator(h);for(var b=a.next();!b.done;b=a.next()){var c=
b.value;b=c.element;var d=c.direction;c=c.orientation;if(void 0===e||d!==e.direction||("left"!==c&&"top"!==c||e.get(0)===f)&&("bottom"!==c&&"right"!==c||e.get(e.length-1)===f))c=f.component,c instanceof D&&c.direction===d||(b.style.display="block")}}},!0);f.registerEventListener(g,"drop",function(a){if(l){l=!1;a=$jscomp.makeIterator(h);for(var b=a.next();!b.done;b=a.next())b.value.element.style.display="none"}});f.registerEventListener(g,"dragleave",function(a){a=a.relatedTarget;if(l&&!(a instanceof
HTMLElement&&f.element.contains(a))){l=!1;a=$jscomp.makeIterator(h);for(var b=a.next();!b.done;b=a.next())b.value.element.style.display="none"}},!0);return f}q(b,a);A(b,[{key:"unsetComponent",value:function(){var a=this.componentValue;void 0!==a&&(a.changed.remove(this.changed.dispatch),this.element.removeChild(a.element),a.dispose())}},{key:"setComponent",value:function(a){var b=this;this.unsetComponent();this.componentValue=a;a.changed.add(this.changed.dispatch);this.element.appendChild(a.element);
if(a instanceof t.a){var c=a.layerManager,d=a.registerCancellable(v()(function(){0===c.managedLayers.length&&b.dispose()},0));a.registerDisposer(c.layersChanged.add(function(){0===c.managedLayers.length&&d()}));d()}else if(a instanceof D){var e=a.registerCancellable(v()(function(){var c=a.length;if(0===c&&void 0!==b.parent)b.dispose();else if(1===c){c=a.get(0).component;if(void 0===b.parent&&c instanceof t.a){var d=c.layout.specification.toJSON();c.viewerNavigationState.copyToParent();var e=new Set(c.layerManager.managedLayers),
f=c.layerSpecification;f.rootLayers.filter(function(a){return e.has(a)});f.rootLayers.managedLayers=Array.from(c.layerManager.managedLayers);f.rootLayers.layersChanged.dispatch()}else d=c.toJSON();b.setSpecification(d)}},0));a.registerDisposer(a.changed.add(function(){2>a.length&&e()}));e()}}},{key:"toJSON",value:function(){return this.component.toJSON()}},{key:"setSpecification",value:function(a){this.setComponent(n(this,a))}},{key:"disposed",value:function(){this.unsetComponent();this.componentValue=
void 0;y(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}},{key:"split",value:function(a){var b={type:"viewer"},c=this.parent;if(void 0!==c){if("left"===a&&"row"===c.direction||"top"===a&&"column"===c.direction)return{newContainer:c.insertChild(b,this),existingContainer:this};if("right"===a&&"row"===c.direction||"bottom"===a&&"column"===c.direction)return{newContainer:c.insertChild(b),existingContainer:this}}c=this.component;c=c instanceof x?c.layerGroupViewer.toJSON():
c.toJSON();var d="left"===a||"right"===a?"row":"column";switch(a){case "left":case "top":var e={type:d,children:[b,c]};var f=0;break;case "right":case "bottom":e={type:d,children:[c,b]},f=1}this.setSpecification(e);a=this.component;return{newContainer:a.get(f),existingContainer:a.get(1-f)}}},{key:"component",get:function(){return this.componentValue}}],[{key:"getFromElement",value:function(a){return a[z]}}]);return b}(g.a),x=function(b){function c(b,d,e){u(this,c);var f=p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));
f.element=b;f.layerGroupViewer=f.registerDisposer(new t.a(b,Object.assign({display:e.display,layerSpecification:e.layerSpecification.addRef()},a(e)),{showLayerPanel:e.uiControlVisibility.showLayerPanel,showViewerMenu:!1}));f.layerGroupViewer.layout.restoreState(d);return f}q(c,b);A(c,[{key:"toJSON",value:function(){return this.layerGroupViewer.layout.specification.toJSON()}},{key:"changed",get:function(){return this.layerGroupViewer.layout.changed}}]);return c}(g.a),D=function(a){function b(a,c,d,
e){u(this,b);var f=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));f.element=a;f.direction=c;f.container=e;f.changed=new r.a;a.classList.add("neuroglancer-stack-layout");a.classList.add("neuroglancer-stack-layout-"+c);a.style.display="flex";a.style.flexDirection=c;a.appendChild(f.makeDropPlaceholder(f));a=$jscomp.makeIterator(d);for(c=a.next();!c.done;c=a.next())f.insertChild(c.value);return f}q(b,a);$jscomp.initSymbol();$jscomp.initSymbolIterator();A(b,[{key:"makeDropPlaceholder",value:function(a){var b=
this,d=document.createElement("div");d.className="neuroglancer-stack-layout-drop-placeholder";a.registerDisposer(c(d,this.viewer.layerSpecification,function(){var a=d.nextElementSibling,c;null!==a&&(c=E.getFromElement(a));return b.insertChild({type:"viewer",layers:[]},c).component}));a.registerDisposer(function(){Object(e.b)(d)});return d}},{key:"get",value:function(a){return E.getFromElement(this.element.children[2*a+1])}},{key:"insertChild",value:function(a,b){var c=this,d=new E(this.viewer,a,this);
a=this.makeDropPlaceholder(d);d.element.classList.add("neuroglancer-stack-layout-child");d.registerDisposer(d.changed.add(this.changed.dispatch));d.registerDisposer(function(){c.element.removeChild(d.element);c.changed.dispatch()});b=void 0!==b?b.element:null;this.element.insertBefore(d.element,b);this.element.insertBefore(a,b);this.changed.dispatch();return d}},{key:"disposed",value:function(){this.clear();y(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}},
{key:"clear",value:function(){for(;0!==this.length;)this.get(0).dispose()}},{key:Symbol.iterator,value:function(){function a(a,g){for(;;)switch(b){case 0:e=f,d=e.length,c=0;case 1:if(!(c<d)){b=3;break}b=4;return{value:f.get(c),done:!1};case 4:if(void 0===g){b=5;break}b=-1;throw g;case 5:case 2:++c;b=1;break;case 3:b=-1;default:return{value:void 0,done:!0}}}var b=0,c,d,e,f=this,g={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();g[Symbol.iterator]=function(){return this};return g}},{key:"toJSON",value:function(){return{type:this.direction,children:Array.from(this).map(function(a){return a.toJSON()})}}},{key:"length",get:function(){return(this.element.childElementCount-1)/2}},{key:"viewer",get:function(){return this.container.viewer}}]);return b}(g.a),G=function(a){function b(a,c){u(this,b);var d=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));d.viewer=a;d.defaultSpecification=c;
d.container=d.registerDisposer(new E(d.viewer,d.defaultSpecification,void 0));return d}q(b,a);A(b,[{key:"reset",value:function(){this.container.setSpecification(this.defaultSpecification)}},{key:"restoreState",value:function(a){this.container.setSpecification(a)}},{key:"disposed",value:function(){y(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}},{key:"toJSON",value:function(){var a=this.container.toJSON();if(a!==this.defaultSpecification)return a}},{key:"changed",
get:function(){return this.container.changed}},{key:"element",get:function(){return this.container.element}}]);return b}(g.a)},function(m,f,d){function u(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(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 q(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){a=new g.a(a);var c=a.element;c.classList.add("neuroglancer-layer-group-viewer-context-menu");var d=document.createElement("button");d.textContent="Remove layer group";c.appendChild(d);a.registerEventListener(d,"click",function(){b.layerSpecification.layerManager.clear()});d=b.viewerNavigationState;
d=$jscomp.makeIterator([["Position",d.position.link],["Cross-section orientation",d.crossSectionOrientation.link],["Cross-section zoom",d.crossSectionZoom.link],["Perspective orientation",d.perspectiveOrientation.link],["Perspective zoom",d.perspectiveZoom.link]]);for(var e=d.next();!e.done;e=d.next()){var f=$jscomp.makeIterator(e.value);e=f.next().value;f=f.next().value;f=a.registerDisposer(new z.a(f));var h=document.createElement("label");h.style.display="flex";h.style.flexDirection="row";h.style.whiteSpace=
"nowrap";h.textContent=e;h.appendChild(f.element);c.appendChild(h)}return a}f.c=function(a){return-1!==a.dataTransfer.types.indexOf("neuroglancer-layer-group-viewer")};f.b=function(a,b){if(a.shiftKey)return"copy";if(a.ctrlKey)return"move";a=D&&D.viewer.layerSpecification.rootLayers===b.rootLayers?D.viewer:void 0;return void 0!==a?"move":"copy"};d.d(f,"a",function(){return J});m=d(5);var c=d.n(m),n=d(151),v=d(283),t=d(21),l=d(58),k=d(40),g=d(157),e=d(95),b=d(158),h=d(68);m=d(0);var r=d(10),A=d(20),
y=d(29),z=d(287),E=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)}},x=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(288);f.d="neuroglancer-layer-group-viewer";var D,G=function(a){function b(a){u(this,b);var c=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.position=new l.b(a.navigationState.position.addRef());c.crossSectionOrientation=new l.a(a.navigationState.pose.orientation.addRef());c.crossSectionZoom=new l.c(a.navigationState.zoomFactor.addRef());c.navigationState=c.registerDisposer(new l.e(new l.g(c.position.value,c.crossSectionOrientation.value),c.crossSectionZoom.value));c.perspectiveOrientation=
new l.a(a.perspectiveNavigationState.pose.orientation.addRef());c.perspectiveZoom=new l.c(a.perspectiveNavigationState.zoomFactor.addRef());c.perspectiveNavigationState=c.registerDisposer(new l.e(new l.g(c.position.value.addRef(),c.perspectiveOrientation.value),c.perspectiveZoom.value));return c}q(b,a);x(b,[{key:"copyToParent",value:function(){for(var a=$jscomp.makeIterator([this.position,this.crossSectionOrientation,this.crossSectionZoom,this.perspectiveOrientation,this.perspectiveZoom]),b=a.next();!b.done;b=
a.next())b.value.copyToPeer()}},{key:"register",value:function(a){a.add("position",this.position);a.add("crossSectionOrientation",this.crossSectionOrientation);a.add("crossSectionZoom",this.crossSectionZoom);a.add("perspectiveOrientation",this.perspectiveOrientation);a.add("perspectiveZoom",this.perspectiveZoom)}}]);return b}(m.a),J=function(d){function f(a,d,e){e=void 0===e?{}:e;u(this,f);var g=p(this,(f.__proto__||Object.getPrototypeOf(f)).call(this));g.element=a;g.viewerState=d;g.state=new y.a;
g.options=Object.assign({showLayerPanel:new k.b(!0),showViewerMenu:!1},e);g.layerSpecification=g.registerDisposer(d.layerSpecification);g.viewerNavigationState=g.registerDisposer(new G(d));g.viewerNavigationState.register(g.state);g.layerSpecification instanceof t.a?g.state.add("layers",g.layerSpecification):g.state.add("layers",{changed:g.layerSpecification.changed,toJSON:function(){return g.layerSpecification.layerManager.managedLayers.map(function(a){return a.name})},reset:function(){throw Error("not implemented");
},restoreState:function(){throw Error("not implemented");}});a.classList.add("neuroglancer-layer-group-viewer");g.registerDisposer(new h.a(a));g.layout=g.registerDisposer(new n.a(g,"xy"));g.state.add("layout",g.layout);g.registerActionBindings();g.registerDisposer(g.layerManager.useDirectly());g.registerDisposer(Object(b.a)(a,g.navigationState.position));g.registerDisposer(g.options.showLayerPanel.changed.add(g.registerCancellable(c()(function(){return g.updateUI()},0))));g.makeUI();return g}q(f,
d);x(f,[{key:"bindAction",value:function(a,b){this.registerDisposer(Object(A.c)(this.element,a,b))}},{key:"registerActionBindings",value:function(){var a=this;this.bindAction("add-layer",function(){a.layerPanel&&a.layerPanel.addLayerMenu()})}},{key:"toJSON",value:function(){return Object.assign({type:"viewer"},this.state.toJSON())}},{key:"reset",value:function(){this.state.reset()}},{key:"restoreState",value:function(a){this.state.restoreState(a)}},{key:"makeUI",value:function(){this.element.style.flex=
"1";this.element.style.display="flex";this.element.style.flexDirection="column";this.element.appendChild(this.layout.element);this.updateUI()}},{key:"updateUI",value:function(){var b=this,c=this.options,d=c.showLayerPanel.value;void 0===this.layerPanel||d?d&&void 0===this.layerPanel&&(d=this.layerPanel=new v.a(this.display,this.layerSpecification,this.viewerNavigationState,this.viewerState.selectedLayer),c.showViewerMenu?(d.registerDisposer(a(d.element,this)),d.element.title="Right click for options, drag to move/copy layer group."):
d.element.title="Drag to move/copy layer group.",d.element.draggable=!0,this.registerEventListener(d.element,"dragstart",function(a){Object(e.e)(a,{manager:b.layerSpecification,layers:b.layerManager.managedLayers});var c=function(){D&&D.viewer===b&&(D=void 0);b.unregisterDisposer(c)};D={viewer:b,disposer:c};b.registerDisposer(c);var d=b.toJSON();delete d.layers;a.dataTransfer.setData("neuroglancer-layer-group-viewer",JSON.stringify(d))}),this.registerEventListener(d.element,"dragend",function(a){Object(e.a)(a);
void 0!==D&&D.viewer===b&&D.disposer()}),this.element.insertBefore(d.element,this.element.firstChild)):(this.layerPanel.dispose(),this.layerPanel=void 0)}},{key:"disposed",value:function(){Object(r.a)(this.element);var a=this.layerPanel;void 0!==a&&(a.dispose(),this.layerPanel=void 0);E(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"disposed",this).call(this)}},{key:"perspectiveNavigationState",get:function(){return this.viewerNavigationState.perspectiveNavigationState}},{key:"navigationState",
get:function(){return this.viewerNavigationState.navigationState}},{key:"display",get:function(){return this.viewerState.display}},{key:"selectedLayer",get:function(){return this.viewerState.selectedLayer}},{key:"layerManager",get:function(){return this.layerSpecification.layerManager}},{key:"chunkManager",get:function(){return this.layerSpecification.chunkManager}},{key:"mouseState",get:function(){return this.viewerState.mouseState}},{key:"showAxisLines",get:function(){return this.viewerState.showAxisLines}},
{key:"showScaleBar",get:function(){return this.viewerState.showScaleBar}},{key:"showPerspectiveSliceViews",get:function(){return this.viewerState.showPerspectiveSliceViews}},{key:"inputEventBindings",get:function(){return this.viewerState.inputEventBindings}},{key:"visibility",get:function(){return this.viewerState.visibility}},{key:"visibleLayerRoles",get:function(){return this.viewerState.visibleLayerRoles}},{key:"crossSectionBackgroundColor",get:function(){return this.viewerState.crossSectionBackgroundColor}},
{key:"changed",get:function(){return this.state.changed}}]);return f}(m.a)},function(m,f,d){function u(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(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 q(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("move"===a.method)return!1;a.manager.layerManager.filter(function(b){return!a.layers.has(b)});return void 0!==b&&a.layers.has(b)}function c(c,d,e){function f(d,f){var g=c.dropLayers,h=f?Object(l.d)(d,c.manager):Object(b.c)(),k=!0;if(void 0!==g&&(f&&Object(b.e)(d,h),!g.compatibleWithMethod(h)&&(c.dropLayers=void 0,a(g,
e))))return;if(void 0===g){g=c.dropLayers=Object(l.b)(d,c.manager,"copy"===h,!0,!1);if(void 0===g)return;k="move"===g.method}if(void 0!==e&&g.layers.has(e))return g;if(k){var n=c.manager.layerManager,r=new Set,p=Number.POSITIVE_INFINITY;d=n.managedLayers=n.managedLayers.filter(function(a,b){return g.layers.has(a)?(p===Number.POSITIVE_INFINITY&&(p=b),r.add(a),!1):!0});void 0!==e?(f=d.indexOf(e),p<=f&&++f):f=d.length;h=$jscomp.makeIterator(g.layers.keys());for(k=h.next();!k.done;k=h.next())k=k.value,
r.has(k)||g.layers.delete(k);d.splice.apply(d,[].concat([f,0],$jscomp.arrayFromIterable(g.layers.keys())));n.layersChanged.dispatch()}else for(void 0!==e&&(n=c.manager.layerManager.managedLayers.indexOf(e)),d=$jscomp.makeIterator(g.layers.keys()),f=d.next();!f.done;f=d.next())c.manager.add(f.value,n);return g}var h=Object(g.c)(d,"dragenter",function(a){void 0!==f(a,!0)&&a.preventDefault()}),k=Object(g.c)(d,"drop",function(d){d.preventDefault();var e=f(d,!1);void 0!==e&&(e.finalize(d)?(d.dataTransfer.dropEffect=
Object(b.c)(),Object(l.a)("move"===e.method?void 0:d)):a(e));c.dropLayers=void 0}),n=Object(g.c)(d,"dragover",function(a){void 0!==f(a,!0)&&(a.preventDefault(),a.stopPropagation())});return function(){n();k();h()}}d.d(f,"a",function(){return E});var n=d(153),v=d(21),t=d(58),l=d(95),k=d(155),g=d(0),e=d(10),b=d(96),h=d(87),r=d(97),A=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}}(),y=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)}};d(41);d(285);d(72);var z=function(a){function b(a,d){u(this,b);var e=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));e.layer=a;e.panel=d;var f=e.element=document.createElement("div");
f.title="Control+click for layer options, drag to move/copy.";f.className="neuroglancer-layer-item neuroglancer-noselect";var g=e.labelElement=document.createElement("span");g.className="neuroglancer-layer-item-label";var k=e.layerNumberElement=document.createElement("span");k.className="neuroglancer-layer-item-number";var r=e.valueElement=document.createElement("span");r.className="neuroglancer-layer-item-value";var m=Object(h.a)();m.title="Delete layer";e.registerEventListener(m,"click",function(a){e.panel.layerManager.removeManagedLayer(e.layer);
a.stopPropagation()});f.appendChild(k);f.appendChild(g);f.appendChild(r);f.appendChild(m);e.registerEventListener(f,"click",function(b){b.ctrlKey?(d.selectedLayer.layer=a,d.selectedLayer.visible=!0):a.setVisible(!a.visible)});e.registerEventListener(f,"contextmenu",function(b){d.selectedLayer.layer=a;d.selectedLayer.visible=!0;b.stopPropagation();b.preventDefault()});f.draggable=!0;e.registerEventListener(f,"dragstart",function(a){Object(l.e)(a,{manager:d.manager,layers:[e.layer]});a.stopPropagation()});
e.registerEventListener(f,"dragend",function(a){Object(l.a)(a)});e.registerDisposer(c(e.panel,f,e.layer));e.registerEventListener(f,"dblclick",function(b){a instanceof v.b&&new n.a(e.panel.manager,a)});return e}q(b,a);A(b,[{key:"update",value:function(){var a=this.layer;this.labelElement.textContent=a.name;this.element.setAttribute("layer-visible",a.visible.toString());this.element.setAttribute("layer-selected",(a===this.panel.selectedLayer.layer).toString())}},{key:"disposed",value:function(){this.element.parentElement.removeChild(this.element);
y(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}}]);return b}(g.a),E=function(d){function f(d,e,g,h){u(this,f);var l=p(this,(f.__proto__||Object.getPrototypeOf(f)).call(this));l.display=d;l.manager=e;l.viewerNavigationState=g;l.selectedLayer=h;l.layerWidgets=new Map;l.element=document.createElement("div");l.layerUpdateNeeded=!0;l.valueUpdateNeeded=!1;l.layerWidgetInsertionPoint=document.createElement("div");l.positionWidget=l.registerDisposer(new r.b(l.viewerNavigationState.position.value));
l.scheduleUpdate=l.registerCancellable(Object(k.a)(function(){return l.update()}));l.registerDisposer(h);var n=l.element;n.className="neuroglancer-layer-panel";l.registerDisposer(e.layerSelectedValues.changed.add(function(){l.handleLayerValuesChanged()}));l.registerDisposer(e.layerManager.layersChanged.add(function(){l.handleLayersChanged()}));l.registerDisposer(h.changed.add(function(){l.handleLayersChanged()}));l.layerWidgetInsertionPoint.style.display="none";l.element.appendChild(l.layerWidgetInsertionPoint);
e=l.addButton=document.createElement("div");e.className="neuroglancer-layer-add-button neuroglancer-button";e.title="Click to add layer, control+click to add local annotation layer.";e.textContent="+";g=l.dropZone=document.createElement("div");g.className="neuroglancer-layer-panel-drop-zone";l.registerEventListener(e,"click",function(a){a.ctrlKey?(a=new v.b("annotation",{},l.manager),l.manager.initializeLayerFromSpec(a,{type:"annotation"}),l.manager.add(a)):l.addLayerMenu()});n.appendChild(e);n.appendChild(g);
l.registerDisposer(Object(b.d)(e));n.appendChild(l.positionWidget.element);h=function(){l.positionWidget.element.style.display=l.viewerNavigationState.position.link.value===t.d.LINKED?"none":null};l.registerDisposer(l.viewerNavigationState.position.link.changed.add(h));h();l.update();l.registerEventListener(n,"dragleave",function(b){b.relatedTarget&&n.contains(b.relatedTarget)||(b=l.dropLayers,void 0!==b&&(a(b),l.dropLayers=void 0))});l.registerDisposer(c(l,e,void 0));l.registerDisposer(c(l,g,void 0));
l.registerDisposer(d.updateStarted.add(function(){return l.updateLayers()}));return l}q(f,d);A(f,[{key:"disposed",value:function(){this.layerWidgets.forEach(function(a){return a.dispose()});this.layerWidgets=void 0;Object(e.b)(this.element);y(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"disposed",this).call(this)}},{key:"handleLayersChanged",value:function(){this.layerUpdateNeeded=!0;this.handleLayerValuesChanged()}},{key:"handleLayerValuesChanged",value:function(){this.valueUpdateNeeded||
(this.valueUpdateNeeded=!0,this.scheduleUpdate())}},{key:"update",value:function(){this.valueUpdateNeeded=!1;this.updateLayers();for(var a=this.manager.layerSelectedValues,b=$jscomp.makeIterator(this.layerWidgets),c=b.next();!c.done;c=b.next()){c=$jscomp.makeIterator(c.value);var d=c.next().value;c=c.next().value;var e=d.layer;d="";null!==e&&(e=a.get(e),void 0!==e&&(d=""+e));c.valueElement.textContent=d}}},{key:"updateLayers",value:function(){var a=this;if(this.layerUpdateNeeded){this.layerUpdateNeeded=
!1;var b=this.element,c=new Set,d=this.layerWidgetInsertionPoint.nextElementSibling;this.manager.layerManager.managedLayers.forEach(function(e){c.add(e);var f=a.layerWidgets.get(e),g=a.manager.rootLayers.managedLayers.indexOf(e);void 0===f&&(f=new z(e,a),a.layerWidgets.set(e,f));f.layerNumberElement.textContent=""+(1+g);f.update();e=f.element;e!==d&&b.insertBefore(f.element,d);d=e.nextElementSibling});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;c.has(f)||(this.layerWidgets.delete(f),g.dispose())}}}},{key:"addLayerMenu",value:function(){new n.a(this.manager)}},{key:"layerManager",get:function(){return this.manager.layerManager}}]);return f}(g.a)},function(m,f){},function(m,f){},function(m,f){},function(m,f,d){function u(a,d){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!d||"object"!==typeof d&&"function"!==typeof d?a:d}function p(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)}d.d(f,"a",function(){return a});m=d(0);var q=function(){function a(a,c){for(var d=0;d<c.length;d++){var f=c[d];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}return function(c,
d,f){d&&a(c.prototype,d);f&&a(c,f);return c}}(),a=function(a){function c(a){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");var d=u(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));d.model=a;d.element=document.createElement("select");d.valueIndexMap=new Map;for(var f=d.element,k=d.valueIndexMap,g=0,e=$jscomp.makeIterator(Object.keys(a.enumType)),b=e.next();!b.done;b=e.next())if(b=b.value,isNaN(Number(b))){var h=document.createElement("option");h.textContent=
h.value=b.toLowerCase();f.appendChild(h);k.set(a.enumType[b],g);++g}d.registerDisposer(a.changed.add(function(){return d.updateView()}));d.registerEventListener(f,"change",function(){return d.updateModel()});d.updateView();return d}p(c,a);q(c,[{key:"updateView",value:function(){this.element.selectedIndex=this.valueIndexMap.get(this.model.value)}},{key:"updateModel",value:function(){this.model.restoreState(this.element.value)}}]);return c}(m.a)},function(m,f){},function(m,f){},function(m,f,d){function u(a,
b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(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 q(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)}d.d(f,"a",function(){return b});m=d(291);d.n(m);m=d(0);var a=d(10),c=d(24),n=d(87),v=d(35),t=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)}},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}}(),k=function(a){function b(a){u(this,b);var c=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.layer=a;c.tabView=new v.d(c.layer.tabs.addRef(),c.visibility);c.element.appendChild(c.tabView.element);c.element.classList.add("neuroglancer-layer-side-panel-info-panel");c.tabView.element.style.flex="1";return c}q(b,a);return b}(v.b),g=function(a){function b(){u(this,b);var a=
p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));a.element.classList.add("neuroglancer-layer-side-panel-info-panel-empty");a.element.textContent="Information about this layer will be available once it finishes loading.";return a}q(b,a);l(b,[{key:"layer",get:function(){return null}}]);return b}(v.b),e=function(a){function b(a,c,d){u(this,b);var e=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));e.layer=a;e.layerManager=c;e.collapse=d;e.element=document.createElement("div");e.title=
document.createElement("div");e.layerName=document.createElement("input");e.stack=e.registerDisposer(new v.a(function(a){return null===a?new g:new k(a)},e.visibility));var f=e.element;c=e.title;d=e.layerName;var l=e.stack;f.className="neuroglancer-managed-user-layer-info-panel";c.className="neuroglancer-layer-side-panel-title";l.element.classList.add("neuroglancer-layer-side-panel-content-container");f.appendChild(c);f.appendChild(l.element);f=Object(n.a)();f.title="Close side panel";f.addEventListener("click",
function(){e.collapse()});c.appendChild(d);d.spellcheck=!1;d.title="Rename layer";c.appendChild(f);d.addEventListener("change",function(){return e.handleLayerNameViewChanged()});d.addEventListener("blur",function(){return e.handleLayerNameViewChanged()});e.registerDisposer(a.layerChanged.add(function(){return e.handleLayerNameModelChanged()}));e.handleUserLayerChanged();e.handleLayerNameModelChanged();return e}q(b,a);l(b,[{key:"handleUserLayerChanged",value:function(){this.stack.selected!==this.layer.layer&&
(this.stack.invalidateAll(),this.stack.selected=this.layer.layer)}},{key:"handleLayerNameModelChanged",value:function(){this.layerName.value=this.layer.name}},{key:"handleLayerNameViewChanged",value:function(){var a=this.layer;if(void 0!==a){var b=this.layerName.value;b!==a.name&&(b=this.layerManager.getUniqueLayerName(b),this.layerName.value=b,a.name=b,a.layerChanged.dispatch())}}}]);return b}(v.b),b=function(b){function d(a){u(this,d);var b=p(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));
b.state=a;b.element=document.createElement("div");b.stack=b.registerDisposer(new v.a(function(a){return new e(a,b.state.layerManager,b.collapse.bind(b))}));var c=b.element,f=b.stack;c.className="neuroglancer-layer-side-panel";f.element.classList.add("neuroglancer-layer-info-panel-container");c.appendChild(f.element);b.registerDisposer(a.changed.add(function(){return b.handleStateChanged()}));b.registerDisposer(a.layerManager.layersChanged.add(function(){return b.handleLayersChanged()}));b.handleStateChanged();
return b}q(d,b);l(d,[{key:"handleLayersChanged",value:function(){for(var a=this.state.layerManager,b=this.stack,c=$jscomp.makeIterator(b.tabs.keys()),d=c.next();!d.done;d=c.next())d=d.value,a.has(d)||b.invalidate(d)}},{key:"collapse",value:function(){!0===this.state.visible&&(this.state.visible=!1,this.state.changed.dispatch())}},{key:"handleStateChanged",value:function(){var a=this.state,b=a.visible;this.element.style.display=b?null:"none";this.stack.visibility.value=b?c.b.VISIBLE:c.b.IGNORED;this.stack.selected=
a.layer}},{key:"disposed",value:function(){Object(a.b)(this.element);t(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"disposed",this).call(this)}}]);return d}(m.a)},function(m,f){},function(m,f,d){function u(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 p(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)}d.d(f,"a",function(){return b});m=d(293);d.n(m);m=d(5);var q=d.n(m),a=d(23),c=d(82),n=d(86);m=d(0);var v=d(10),t=d(139),l=d(294),k=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)}},e=new Map([[a.c.AXIS_ALIGNED_BOUNDING_BOX,function(a,b,c,d){d=document.createElement("div");d.className="neuroglancer-annotation-details-volume";d.textContent=Object(t.a)(a.pointA,a.pointB,c);b.appendChild(d)}]]),
b=function(b){function d(a,b,c){if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");var e=u(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));e.mouseState=a;e.layerManager=b;e.voxelSize=c;e.tooltip=void 0;e.debouncedShowTooltip=e.registerCancellable(q()(function(){return e.doCreateTooltip()},500));e.debouncedShowTooltip0=e.registerCancellable(q()(function(){return e.doCreateTooltip()},0));e.doCreateTooltip=function(){e.debouncedShowTooltip.cancel();e.debouncedShowTooltip0.cancel();
var a=e.mouseState;e.maybeCreateTooltip()?e.tooltip.updatePosition(a.pageX,a.pageY):(a=e.tooltip,void 0!==a&&(a.dispose(),e.tooltip=void 0),e.setReference(void 0))};e.registerDisposer(a.changed.add(function(){return e.mouseStateChanged()}));return e}p(d,b);k(d,[{key:"setReference",value:function(a){var b=this.reference;void 0!==b&&(b.changed.remove(this.debouncedShowTooltip0),b.dispose(),this.reference=void 0);this.reference=a;void 0!==a&&a.changed.add(this.debouncedShowTooltip0)}},{key:"maybeCreateTooltip",
value:function(){var b=Object(c.a)(this.mouseState,this.layerManager);if(void 0===b||!this.voxelSize.valid)return!1;var d=this.tooltip;void 0===d&&(d=this.tooltip=new l.a,d.element.classList.add("neuroglancer-mouse-selection-tooltip"));var f=b.annotationLayer.source.getReference(b.id);this.setReference(f);if(null===f.value)return!1;Object(v.a)(d.element);var g=document.createElement("div");g.className="neuroglancer-mouse-selection-tooltip-title";g.textContent=""+b.layer.name;var k=document.createElement("div");
k.className="neuroglancer-mouse-selection-tooltip-description";f=f.value;k.textContent=void 0===f?"Loading...":f.description||"";d.element.appendChild(g);d.element.appendChild(k);if(null!=f){g=f.segments;if(void 0!==g&&0<g.length){var p=document.createElement("div");p.className="neuroglancer-annotation-segment-list";var r=b.annotationLayer.segmentationState.value,m=r?r.segmentColorHash:void 0;g.forEach(function(a,b){0!==b&&p.appendChild(document.createTextNode(" "));b=document.createElement("span");
b.className="neuroglancer-annotation-segment-item";b.textContent=a.toString();void 0!==r&&(b.style.backgroundColor=m.computeCssColor(a));p.appendChild(b)});d.element.appendChild(p)}b=b.annotationLayer.objectToGlobal;g=Object(a.g)(f.type);k=document.createElement("div");k.appendChild(document.createTextNode(g.icon));Object(n.c)(k,f,b,this.voxelSize);k.className="neuroglancer-mouse-selection-tooltip-annotation-corners";d.element.appendChild(k);g=e.get(f.type);void 0!==g&&g(f,d.element,b,this.voxelSize)}return!0}},
{key:"mouseStateChanged",value:function(){var a=this.tooltip;void 0!==a&&(a.dispose(),this.tooltip=void 0);this.setReference(void 0);this.debouncedShowTooltip()}},{key:"disposed",value:function(){var a=this.tooltip;void 0!==a&&(a.dispose(),this.tooltip=void 0);this.setReference(void 0);g(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"disposed",this).call(this)}}]);return d}(m.a)},function(m,f){},function(m,f,d){function u(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+
typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}d.d(f,"a",function(){return c});m=d(295);d.n(m);m=d(0);var p=d(10),q=function(){function a(a,c){for(var d=0;d<c.length;d++){var f=c[d];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}return function(c,d,f){d&&a(c.prototype,d);f&&a(c,f);return c}}(),a=function v(a,
c,d){null===a&&(a=Function.prototype);var f=Object.getOwnPropertyDescriptor(a,c);if(void 0===f){if(a=Object.getPrototypeOf(a),null!==a)return v(a,c,d)}else{if("value"in f)return f.value;c=f.get;return void 0===c?void 0:c.call(d)}},c=function(c){function d(){if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");var a=(d.__proto__||Object.getPrototypeOf(d)).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.element=document.createElement("div");var c=a.element;c.className="neuroglancer-tooltip";c.style.visibility="hidden";document.body.appendChild(c);return a}u(d,c);q(d,[{key:"updatePosition",value:function(a,c){var d=this.element;d.style.left=a+"px";d.style.top=c+"px";d.style.visibility="inherit"}},{key:"disposed",value:function(){Object(p.b)(this.element);a(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"disposed",this).call(this)}}]);return d}(m.a)},
function(m,f){},function(m,f,d){function u(a,c){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!c||"object"!==typeof c&&"function"!==typeof c?a:c}function p(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=
c)}d.d(f,"a",function(){return v});m=d(141);d.n(m);m=d(297);d.n(m);m=d(159);d.n(m);m=d(298);d.n(m);m=d(299);d.n(m);m=d(300);d.n(m);m=d(142);d.n(m);m=d(301);d.n(m);m=d(43);var q=d.n(m);m=d(5);var a=d.n(m);m=d(42);var c=d(29),n=function(){function a(a,c){for(var d=0;d<c.length;d++){var e=c[d];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(c,d,f){d&&a(c.prototype,d);f&&a(c,f);return c}}(),v=function(d){function f(c){if(!(this instanceof
f))throw new TypeError("Cannot call a class as a function");var d=u(this,(f.__proto__||Object.getPrototypeOf(f)).call(this));d.viewer=c;d.parsedValue=null;d.debouncedValueUpdater=a()(function(){var a=d.textEditor.getValue();try{var b=JSON.parse(a);d.parsedValue=b;d.applyButton.disabled=!1;d.textEditor.setOption("lint",void 0)}catch(y){d.parsedValue=null;d.applyButton.disabled=!0;var c=0,f=0,g="Unknown parse error";y instanceof Error&&(b=y.message.match(/^((?:.|\n)*) in JSON at position ([0-9]+)$/),
null!==b?(g=b[1],b=parseInt(b[2],10),a=a.substring(0,b).split("\n"),c=a.length-1,f=a[a.length-1].length):g=y.message);d.textEditor.setOption("lint",{getAnnotations:function(){return[{message:g,severity:"error",from:q.a.Pos(c,f)}]}})}},100);d.content.classList.add("neuroglancer-state-editor");c=d.applyButton=document.createElement("button");c.textContent="Apply changes";d.content.appendChild(c);c.addEventListener("click",function(){return d.applyChanges()});c.disabled=!0;d.textEditor=q()(function(a){},
{value:"",mode:{name:"javascript",json:!0},foldGutter:!0,gutters:["CodeMirror-lint-markers","CodeMirror-foldgutter"]});d.updateView();d.textEditor.on("change",function(){d.debouncedValueUpdater()});d.content.appendChild(d.textEditor.getWrapperElement());d.textEditor.refresh();return d}p(f,d);n(f,[{key:"applyChanges",value:function(){null!==this.parsedValue&&(this.viewer.state.reset(),this.viewer.state.restoreState(this.parsedValue));this.applyButton.disabled=!0}},{key:"updateView",value:function(){this.textEditor.setValue(this.getJson());
this.textEditor.execCommand("foldAll");this.textEditor.execCommand("unfold")}},{key:"getJson",value:function(){return JSON.stringify(Object(c.c)(this.viewer.state).value,null,"  ")}}]);return f}(m.a)},function(m,f,d){(function(d){d.defineMode("javascript",function(f,m){function a(a,b,c){jb=a;Va=c;return b}function c(b,c){var d=b.next();if('"'==d||"'"==d)return c.tokenize=n(d),c.tokenize(b,c);if("."==d&&b.match(/^\d+(?:[eE][+\-]?\d+)?/))return a("number","number");if("."==d&&b.match(".."))return a("spread",
"meta");if(/[\[\]{}\(\),;\:\.]/.test(d))return a(d);if("="==d&&b.eat(">"))return a("=>","operator");if("0"==d&&b.eat(/x/i))return b.eatWhile(/[\da-f]/i),a("number","number");if("0"==d&&b.eat(/o/i))return b.eatWhile(/[0-7]/i),a("number","number");if("0"==d&&b.eat(/b/i))return b.eatWhile(/[01]/i),a("number","number");if(/\d/.test(d))return b.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),a("number","number");if("/"==d){if(b.eat("*"))return c.tokenize=p,p(b,c);if(b.eat("/"))return b.skipToEnd(),a("comment",
"comment");if(ac(b,c,1)){a:for(var e=c=!1;null!=(d=b.next());){if(!c){if("/"==d&&!e)break a;"["==d?e=!0:e&&"]"==d&&(e=!1)}c=!c&&"\\"==d}b.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/);return a("regexp","string-2")}b.eat("=");return a("operator","operator",b.current())}if("`"==d)return c.tokenize=q,q(b,c);if("#"==d)return b.skipToEnd(),a("error","error");if(bc.test(d))return">"==d&&c.lexical&&">"==c.lexical.type||(b.eat("=")?"!"!=d&&"="!=d||b.eat("="):/[<>*+\-]/.test(d)&&(b.eat(d),">"==d&&b.eat(d))),a("operator",
"operator",b.current());if(Pa.test(d)){b.eatWhile(Pa);d=b.current();if("."!=c.lastType){if(Jb.propertyIsEnumerable(d))return b=Jb[d],a(b.type,b.style,d);if("async"==d&&b.match(/^\s*[\(\w]/,!1))return a("async","keyword",d)}return a("variable","variable",d)}}function n(b){return function(d,e){var f=!1,g;if(bb&&"@"==d.peek()&&d.match(Sc))return e.tokenize=c,a("jsonld-keyword","meta");for(;null!=(g=d.next())&&(g!=b||f);)f=!f&&"\\"==g;f||(e.tokenize=c);return a("string","string")}}function p(b,d){for(var e=
!1,f;f=b.next();){if("/"==f&&e){d.tokenize=c;break}e="*"==f}return a("comment","comment")}function q(b,d){for(var e=!1,f;null!=(f=b.next());){if(!e&&("`"==f||"$"==f&&b.eat("{"))){d.tokenize=c;break}e=!e&&"\\"==f}return a("quasi","string-2",b.current())}function l(a,b){b.fatArrowAt&&(b.fatArrowAt=null);var c=a.string.indexOf("=>",a.start);if(!(0>c)){if(ua){var d=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(a.string.slice(a.start,c));d&&(c=d.index)}d=0;var e=!1;for(--c;0<=c;--c){var f=a.string.charAt(c),
g="([{}])".indexOf(f);if(0<=g&&3>g){if(!d){++c;break}if(0==--d){"("==f&&(e=!0);break}}else if(3<=g&&6>g)++d;else if(Pa.test(f))e=!0;else{if(/["'\/]/.test(f))return;if(e&&!d){++c;break}}}e&&!d&&(b.fatArrowAt=c)}}function k(a,b,c,d,e,f){this.indented=a;this.column=b;this.type=c;this.prev=e;this.info=f;null!=d&&(this.align=d)}function g(){for(var a=arguments.length-1;0<=a;a--)M.cc.push(arguments[a])}function e(){g.apply(null,arguments);return!0}function b(a){function b(b){for(;b;b=b.next)if(b.name==
a)return!0;return!1}var c=M.state;M.marked="def";c.context?b(c.localVars)||(c.localVars={name:a,next:c.localVars}):!b(c.globalVars)&&m.globalVars&&(c.globalVars={name:a,next:c.globalVars})}function h(){M.state.context={prev:M.state.context,vars:M.state.localVars};M.state.localVars=dc}function r(){M.state.localVars=M.state.context.vars;M.state.context=M.state.context.prev}function u(a,b){var c=function(){var c=M.state,d=c.indented;if("stat"==c.lexical.type)d=c.lexical.indented;else for(var e=c.lexical;e&&
")"==e.type&&e.align;e=e.prev)d=e.indented;c.lexical=new k(d,M.stream.column(),a,null,c.lexical,b)};c.lex=!0;return c}function y(){var a=M.state;a.lexical.prev&&(")"==a.lexical.type&&(a.indented=a.lexical.indented),a.lexical=a.lexical.prev)}function z(a){function b(c){return c==a?e():";"==a?g():e(b)}return b}function E(a,b){return"var"==a?e(u("vardef",b.length),Fb,z(";"),y):"keyword a"==a?e(u("form"),G,E,y):"keyword b"==a?e(u("form"),E,y):"keyword d"==a?M.stream.match(/^\s*$/,!1)?e():e(u("stat"),
C,z(";"),y):"debugger"==a?e(z(";")):"{"==a?e(u("}"),X,y):";"==a?e():"if"==a?("else"==M.state.lexical.info&&M.state.cc[M.state.cc.length-1]==y&&M.state.cc.pop()(),e(u("form"),G,E,y,Ha)):"function"==a?e(ya):"for"==a?e(u("form"),Xb,E,y):"variable"==a?ua&&"type"==b?(M.marked="keyword",e(Y,z("operator"),Y,z(";"))):ua&&"declare"==b?(M.marked="keyword",e(E)):e(u("stat"),W):"switch"==a?e(u("form"),G,z("{"),u("}","switch"),X,y,y):"case"==a?e(x,z(":")):"default"==a?e(z(":")):"catch"==a?e(u("form"),h,z("("),
ab,z(")"),E,y,r):"class"==a?e(u("form"),Ua,y):"export"==a?e(u("stat"),ka,y):"import"==a?e(u("stat"),Ea,y):"module"==a?e(u("form"),Ba,z("{"),u("}"),X,y,y):"async"==a?e(E):"@"==b?e(x,E):g(u("stat"),x,z(";"),y)}function x(a){return J(a,!1)}function D(a){return J(a,!0)}function G(a){return"("!=a?g():e(u(")"),x,z(")"),y)}function J(a,b){if(M.state.fatArrowAt==M.stream.start){var c=b?R:N;if("("==a)return e(h,u(")"),L(ab,")"),y,z("=>"),c,r);if("variable"==a)return g(h,Ba,z("=>"),c,r)}c=b?F:B;return cc.hasOwnProperty(a)?
e(c):"function"==a?e(ya,c):"class"==a?e(u("form"),Nc,y):"keyword c"==a||"async"==a?e(b?D:x):"("==a?e(u(")"),C,z(")"),y,c):"operator"==a||"spread"==a?e(b?D:x):"["==a?e(u("]"),qb,y,c):"{"==a?ia(I,"}",null,c):"quasi"==a?g(P,c):"new"==a?e(O(b)):e()}function C(a){return a.match(/[;\}\)\],]/)?g():g(x)}function B(a,b){return","==a?e(x):F(a,b,!1)}function F(a,b,c){var d=0==c?B:F,f=0==c?x:D;if("=>"==a)return e(h,c?R:N,r);if("operator"==a)return/\+\+|--/.test(b)||ua&&"!"==b?e(d):"?"==b?e(x,z(":"),f):e(f);if("quasi"==
a)return g(P,d);if(";"!=a){if("("==a)return ia(D,")","call",d);if("."==a)return e(aa,d);if("["==a)return e(u("]"),C,z("]"),y,d);if(ua&&"as"==b)return M.marked="keyword",e(Y,d);if("regexp"==a)return M.state.lastType=M.marked="operator",M.stream.backUp(M.stream.pos-M.stream.start-1),e(f)}}function P(a,b){return"quasi"!=a?g():"${"!=b.slice(b.length-2)?e(P):e(x,H)}function H(a){if("}"==a)return M.marked="string-2",M.state.tokenize=q,e(P)}function N(a){l(M.stream,M.state);return g("{"==a?E:x)}function R(a){l(M.stream,
M.state);return g("{"==a?E:D)}function O(a){return function(b){return"."==b?e(a?U:Q):"variable"==b&&ua?e(qd,a?F:B):g(a?D:x)}}function Q(a,b){if("target"==b)return M.marked="keyword",e(B)}function U(a,b){if("target"==b)return M.marked="keyword",e(F)}function W(a){return":"==a?e(y,E):g(B,z(";"),y)}function aa(a){if("variable"==a)return M.marked="property",e()}function I(a,b){if("async"==a)return M.marked="property",e(I);if("variable"==a||"keyword"==M.style){M.marked="property";if("get"==b||"set"==b)return e(T);
var c;ua&&M.state.fatArrowAt==M.stream.start&&(c=M.stream.match(/^\s*:\s*/,!1))&&(M.state.fatArrowAt=M.stream.pos+c[0].length);return e(da)}if("number"==a||"string"==a)return M.marked=bb?"property":M.style+" property",e(da);if("jsonld-keyword"==a)return e(da);if("modifier"==a)return e(I);if("["==a)return e(x,z("]"),da);if("spread"==a)return e(D,da);if("*"==b)return M.marked="keyword",e(I);if(":"==a)return g(da)}function T(a){if("variable"!=a)return g(da);M.marked="property";return e(ya)}function da(a){if(":"==
a)return e(D);if("("==a)return g(ya)}function L(a,b,c){function d(f,h){return(c?-1<c.indexOf(f):","==f)?(f=M.state.lexical,"call"==f.info&&(f.pos=(f.pos||0)+1),e(function(c,d){return c==b||d==b?g():g(a)},d)):f==b||h==b?e():e(z(b))}return function(c,f){return c==b||f==b?e():g(a,d)}}function ia(a,b,c){for(var d=3;d<arguments.length;d++)M.cc.push(arguments[d]);return e(u(b,c),L(a,b),y)}function X(a){return"}"==a?e():g(E,X)}function S(a,b){if(ua){if(":"==a)return e(Y);if("?"==b)return e(S)}}function Y(a,
b){if("variable"==a||"void"==b){if("keyof"==b)return M.marked="keyword",e(Y);M.marked="type";return e(La)}if("string"==a||"number"==a||"atom"==a)return e(La);if("["==a)return e(u("]"),L(Y,"]",","),y,La);if("{"==a)return e(u("}"),L(na,"}",",;"),y,La);if("("==a)return e(L(fb,")"),Ca)}function Ca(a){if("=>"==a)return e(Y)}function na(a,b){if("variable"==a||"keyword"==M.style)return M.marked="property",e(na);if("?"==b)return e(na);if(":"==a)return e(Y);if("["==a)return e(x,S,z("]"),na)}function fb(a){if("variable"==
a)return e(fb);if(":"==a)return e(Y)}function La(a,b){if("<"==b)return e(u(">"),L(Y,">"),y,La);if("|"==b||"."==a)return e(Y);if("["==a)return e(z("]"),La);if("extends"==b)return e(Y)}function qd(a,b){if("<"==b)return e(u(">"),L(Y,">"),y,La)}function Fb(){return g(Ba,S,xa,Gb)}function Ba(a,c){if("modifier"==a)return e(Ba);if("variable"==a)return b(c),e();if("spread"==a)return e(Ba);if("["==a)return ia(Ba,"]");if("{"==a)return ia(Za,"}")}function Za(a,c){if("variable"==a&&!M.stream.match(/^\s*:/,!1))return b(c),
e(xa);"variable"==a&&(M.marked="property");return"spread"==a?e(Ba):"}"==a?g():e(z(":"),Ba,xa)}function xa(a,b){if("="==b)return e(D)}function Gb(a){if(","==a)return e(Fb)}function Ha(a,b){if("keyword b"==a&&"else"==b)return e(u("form","else"),E,y)}function Xb(a){if("("==a)return e(u(")"),Mc,z(")"),y)}function Mc(a){return"var"==a?e(Fb,z(";"),eb):";"==a?e(eb):"variable"==a?e($a):g(x,z(";"),eb)}function $a(a,b){return"in"==b||"of"==b?(M.marked="keyword",e(x)):e(B,eb)}function eb(a,b){return";"==a?e(Ia):
"in"==b||"of"==b?(M.marked="keyword",e(x)):g(x,z(";"),Ia)}function Ia(a){")"!=a&&e(x)}function ya(a,c){if("*"==c)return M.marked="keyword",e(ya);if("variable"==a)return b(c),e(ya);if("("==a)return e(h,u(")"),L(ab,")"),y,S,E,r);if(ua&&"<"==c)return e(u(">"),L(Y,">"),y,ya)}function ab(a,b){"@"==b&&e(x,ab);return"spread"==a||"modifier"==a?e(ab):g(Ba,S,xa)}function Nc(a,b){return"variable"==a?Ua(a,b):Da(a,b)}function Ua(a,c){if("variable"==a)return b(c),e(Da)}function Da(a,b){if("<"==b)return e(u(">"),
L(Y,">"),y,Da);if("extends"==b||"implements"==b||ua&&","==a)return e(ua?Y:x,Da);if("{"==a)return e(u("}"),ja,y)}function ja(a,b){if("modifier"==a||"async"==a||"variable"==a&&("static"==b||"get"==b||"set"==b)&&M.stream.match(/^\s+[\w$\xa1-\uffff]/,!1))return M.marked="keyword",e(ja);if("variable"==a||"keyword"==M.style)return M.marked="property",e(ua?fa:ya,ja);if("["==a)return e(x,z("]"),ua?fa:ya,ja);if("*"==b)return M.marked="keyword",e(ja);if(";"==a)return e(ja);if("}"==a)return e();if("@"==b)return e(x,
ja)}function fa(a,b){return"?"==b?e(fa):":"==a?e(Y,xa):"="==b?e(D):g(ya)}function ka(a,b){return"*"==b?(M.marked="keyword",e(pb,z(";"))):"default"==b?(M.marked="keyword",e(x,z(";"))):"{"==a?e(L($b,"}"),pb,z(";")):g(E)}function $b(a,b){if("as"==b)return M.marked="keyword",e(z("variable"));if("variable"==a)return g(D,$b)}function Ea(a){return"string"==a?e():g(Ma,oa,pb)}function Ma(a,c){if("{"==a)return ia(Ma,"}");"variable"==a&&b(c);"*"==c&&(M.marked="keyword");return e(Qc)}function oa(a){if(","==a)return e(Ma,
oa)}function Qc(a,b){if("as"==b)return M.marked="keyword",e(Ma)}function pb(a,b){if("from"==b)return M.marked="keyword",e(x)}function qb(a){return"]"==a?e():g(L(D,"]"))}function ac(a,b,d){return b.tokenize==c&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(b.lastType)||"quasi"==b.lastType&&/\{\s*$/.test(a.string.slice(0,a.pos-(d||0)))}var ib=f.indentUnit,Rc=m.statementIndent,bb=m.jsonld,Oa=m.json||bb,ua=m.typescript,Pa=m.wordCharacters||/[\w$\xa1-\uffff]/,Jb=
function(){function a(a){return{type:a,style:"keyword"}}var b=a("keyword a"),c=a("keyword b"),d=a("keyword c"),e=a("keyword d"),f=a("operator"),g={type:"atom",style:"atom"};b={"if":a("if"),"while":b,"with":b,"else":c,"do":c,"try":c,"finally":c,"return":e,"break":e,"continue":e,"new":a("new"),"delete":d,"void":d,"throw":d,"debugger":a("debugger"),"var":a("var"),"const":a("var"),let:a("var"),"function":a("function"),"catch":a("catch"),"for":a("for"),"switch":a("switch"),"case":a("case"),"default":a("default"),
"in":f,"typeof":f,"instanceof":f,"true":g,"false":g,"null":g,undefined:g,NaN:g,Infinity:g,"this":a("this"),"class":a("class"),"super":a("atom"),yield:d,"export":a("export"),"import":a("import"),"extends":d,await:d};if(ua){c={type:"variable",style:"type"};d={"interface":a("class"),"implements":d,namespace:d,module:a("module"),"enum":a("module"),"public":a("modifier"),"private":a("modifier"),"protected":a("modifier"),"abstract":a("modifier"),readonly:a("modifier"),string:c,number:c,"boolean":c,any:c};
for(var h in d)b[h]=d[h]}return b}(),bc=/[+\-*&%=<>!?|~^@]/,Sc=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,jb,Va,cc={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0,"jsonld-keyword":!0},M={state:null,column:null,marked:null,cc:null},dc={name:"this",next:{name:"arguments"}};y.lex=!0;return{startState:function(a){a={tokenize:c,lastType:"sof",cc:[],lexical:new k((a||0)-ib,0,"block",!1),localVars:m.localVars,context:m.localVars&&{vars:m.localVars},
indented:a||0};m.globalVars&&"object"==typeof m.globalVars&&(a.globalVars=m.globalVars);return a},token:function(a,b){a.sol()&&(b.lexical.hasOwnProperty("align")||(b.lexical.align=!1),b.indented=a.indentation(),l(a,b));if(b.tokenize!=p&&a.eatSpace())return null;var c=b.tokenize(a,b);if("comment"==jb)return c;b.lastType="operator"!=jb||"++"!=Va&&"--"!=Va?jb:"incdec";a:{var d=jb,e=Va,f=b.cc;M.state=b;M.stream=a;M.marked=null;M.cc=f;M.style=c;b.lexical.hasOwnProperty("align")||(b.lexical.align=!0);for(;;)if((f.length?
f.pop():Oa?x:E)(d,e)){for(;f.length&&f[f.length-1].lex;)f.pop()();if(M.marked){c=M.marked;break a}if(a="variable"==d)b:{for(a=b.localVars;a;a=a.next)if(a.name==e){a=!0;break b}for(b=b.context;b;b=b.prev)for(a=b.vars;a;a=a.next)if(a.name==e){a=!0;break b}a=void 0}if(a){c="variable-2";break a}break a}}return c},indent:function(a,b){if(a.tokenize==p)return d.Pass;if(a.tokenize!=c)return 0;var e=b&&b.charAt(0),f=a.lexical,g;if(!/^\s*else\b/.test(b))for(var h=a.cc.length-1;0<=h;--h){var k=a.cc[h];if(k==
y)f=f.prev;else if(k!=Ha)break}for(;!("stat"!=f.type&&"form"!=f.type||"}"!=e&&(!(g=a.cc[a.cc.length-1])||g!=B&&g!=F||/^[,\.=+\-*:?[\(]/.test(b)));)f=f.prev;Rc&&")"==f.type&&"stat"==f.prev.type&&(f=f.prev);g=f.type;h=e==g;return"vardef"==g?f.indented+("operator"==a.lastType||","==a.lastType?f.info+1:0):"form"==g&&"{"==e?f.indented:"form"==g?f.indented+ib:"stat"==g?(e=f.indented,a="operator"==a.lastType||","==a.lastType||bc.test(b.charAt(0))||/[,.]/.test(b.charAt(0)),e+(a?Rc||ib:0)):"switch"!=f.info||
h||0==m.doubleIndentSwitch?f.align?f.column+(h?0:1):f.indented+(h?0:ib):f.indented+(/^(?:case|default)\b/.test(b)?ib:2*ib)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:Oa?null:"/*",blockCommentEnd:Oa?null:"*/",blockCommentContinue:Oa?null:" * ",lineComment:Oa?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:Oa?"json":"javascript",jsonldMode:bb,jsonMode:Oa,expressionAllowed:ac,skipExpression:function(a){var b=a.cc[a.cc.length-1];b!=x&&b!=D||a.cc.pop()}}});d.registerHelper("wordChars",
"javascript",/[\w$]/);d.defineMIME("text/javascript","javascript");d.defineMIME("text/ecmascript","javascript");d.defineMIME("application/javascript","javascript");d.defineMIME("application/x-javascript","javascript");d.defineMIME("application/ecmascript","javascript");d.defineMIME("application/json",{name:"javascript",json:!0});d.defineMIME("application/x-json",{name:"javascript",json:!0});d.defineMIME("application/ld+json",{name:"javascript",jsonld:!0});d.defineMIME("text/typescript",{name:"javascript",
typescript:!0});d.defineMIME("application/typescript",{name:"javascript",typescript:!0})})(d(43))},function(m,f,d){(function(d){function f(a){this.options=a;this.from=this.to=0}function m(a,b){a=a.findMarks(g(b,0),g(b+1,0));for(var c=0;c<a.length;++c)if(a[c].__isFold&&a[c].find().from.line==b)return a[c]}function a(a){if("string"==typeof a){var b=document.createElement("div");b.className=a+" CodeMirror-guttermarker-subtle";return b}return a.cloneNode(!0)}function c(c,b,d){var e=c.state.foldGutter.options,
f=b,h=c.foldOption(e,"minFoldSize"),k=c.foldOption(e,"rangeFinder");c.eachLine(b,d,function(b){var d=null;if(m(c,f))d=a(e.indicatorFolded);else{var l=g(f,0);(l=k&&k(c,l))&&l.to.line-l.from.line>=h&&(d=a(e.indicatorOpen))}c.setGutterMarker(b,e.gutter,d);++f})}function n(a){var b=a.getViewport(),d=a.state.foldGutter;d&&(a.operation(function(){c(a,b.from,b.to)}),d.from=b.from,d.to=b.to)}function u(a,b,c){var d=a.state.foldGutter;d&&(d=d.options,c==d.gutter&&((c=m(a,b))?c.clear():a.foldCode(g(b,0),d.rangeFinder)))}
function t(a){var b=a.state.foldGutter;if(b){var c=b.options;b.from=b.to=0;clearTimeout(b.changeUpdate);b.changeUpdate=setTimeout(function(){n(a)},c.foldOnChangeTimeSpan||600)}}function l(a){var b=a.state.foldGutter;if(b){var d=b.options;clearTimeout(b.changeUpdate);b.changeUpdate=setTimeout(function(){var d=a.getViewport();b.from==b.to||20<d.from-b.to||20<b.from-d.to?n(a):a.operation(function(){d.from<b.from&&(c(a,d.from,b.from),b.from=d.from);d.to>b.to&&(c(a,b.to,d.to),b.to=d.to)})},d.updateViewportTimeSpan||
400)}}function k(a,b){var d=a.state.foldGutter;d&&(b=b.line,b>=d.from&&b<d.to&&c(a,b,b+1))}d.defineOption("foldGutter",!1,function(a,b,c){c&&c!=d.Init&&(a.clearGutter(a.state.foldGutter.options.gutter),a.state.foldGutter=null,a.off("gutterClick",u),a.off("change",t),a.off("viewportChange",l),a.off("fold",k),a.off("unfold",k),a.off("swapDoc",t));b&&(c=a.state,!0===b&&(b={}),null==b.gutter&&(b.gutter="CodeMirror-foldgutter"),null==b.indicatorOpen&&(b.indicatorOpen="CodeMirror-foldgutter-open"),null==
b.indicatorFolded&&(b.indicatorFolded="CodeMirror-foldgutter-folded"),c.foldGutter=new f(b),n(a),a.on("gutterClick",u),a.on("change",t),a.on("viewportChange",l),a.on("fold",k),a.on("unfold",k),a.on("swapDoc",t))});var g=d.Pos})(d(43),d(159))},function(m,f,d){(function(d){d.registerHelper("fold","brace",function(f,m){function a(a){for(var b=m.ch,e=0;;)if(b=0>=b?-1:n.lastIndexOf(a,b-1),-1==b){if(1==e)break;e=1;b=n.length}else{if(1==e&&b<m.ch)break;p=f.getTokenTypeAt(d.Pos(c,b+1));if(!/^(comment|string)/.test(p))return b+
1;--b}}var c=m.line,n=f.getLine(c),p,q="{",l="}",k=a("{");null==k&&(q="[",l="]",k=a("["));if(null!=k){var g=1,e=f.lastLine(),b=c;a:for(;b<=e;++b)for(var h=f.getLine(b),r=b==c?k:0;;){var u=h.indexOf(q,r);r=h.indexOf(l,r);0>u&&(u=h.length);0>r&&(r=h.length);r=Math.min(u,r);if(r==h.length)break;if(f.getTokenTypeAt(d.Pos(b,r+1))==p)if(r==u)++g;else if(!--g){var y=b;var z=r;break a}++r}if(null!=y&&(c!=y||z!=k))return{from:d.Pos(c,k),to:d.Pos(y,z)}}});d.registerHelper("fold","import",function(f,m){function a(a){if(a<
f.firstLine()||a>f.lastLine())return null;var c=f.getTokenAt(d.Pos(a,1));/\S/.test(c.string)||(c=f.getTokenAt(d.Pos(a,c.end+1)));if("keyword"!=c.type||"import"!=c.string)return null;var k=a;for(a=Math.min(f.lastLine(),a+10);k<=a;++k){var g=f.getLine(k).indexOf(";");if(-1!=g)return{startCh:c.end,end:d.Pos(k,g)}}}m=m.line;var c=a(m),n;if(!c||a(m-1)||(n=a(m-2))&&n.end.line==m-1)return null;for(n=c.end;;){var p=a(n.line+1);if(null==p)break;n=p.end}return{from:f.clipPos(d.Pos(m,c.startCh+1)),to:n}});d.registerHelper("fold",
"include",function(f,m){function a(a){if(a<f.firstLine()||a>f.lastLine())return null;var c=f.getTokenAt(d.Pos(a,1));/\S/.test(c.string)||(c=f.getTokenAt(d.Pos(a,c.end+1)));if("meta"==c.type&&"#include"==c.string.slice(0,8))return c.start+8}m=m.line;var c=a(m);if(null==c||null!=a(m-1))return null;for(var n=m;null!=a(n+1);)++n;return{from:d.Pos(m,c+1),to:f.clipPos(d.Pos(n))}})})(d(43))},function(m,f){},function(m,f){},function(m,f,d){function u(a,d){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!d||"object"!==typeof d&&"function"!==typeof d?a:d}function p(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)}d.d(f,"a",function(){return a});m=d(303);d.n(m);d=d(0);var q=function(){function a(a,c){for(var d=0;d<c.length;d++){var f=c[d];f.enumerable=
f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}return function(c,d,f){d&&a(c.prototype,d);f&&a(c,f);return c}}(),a=function(a){function c(a){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");var d=u(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));d.selectedLayer=a;d.element=document.createElement("div");d.element.className="neuroglancer-annotation-tool-status-widget";d.registerDisposer(a.changed.add(function(){return d.selectedLayerChanged()}));
d.selectedLayerChanged();return d}p(c,a);q(c,[{key:"selectedLayerChanged",value:function(){var a=this,c=this.unbindPreviousLayer;void 0!==c&&c();c=this.selectedLayer.layer;void 0!==c&&(this.unbindPreviousLayer=c.specificationChanged.add(function(){a.updateView()}));this.updateView()}},{key:"disposed",value:function(){var a=this.unbindPreviousLayer;void 0!==a&&a();this.unbindPreviousLayer=void 0}},{key:"getDescriptionText",value:function(){var a=this.selectedLayer.layer;if(void 0!==a&&(a=a.layer,null!==
a&&(a=a.tool.value,void 0!==a)))return a.description}},{key:"updateView",value:function(){this.element.textContent=this.getDescriptionText()||""}}]);return c}(d.a)},function(m,f){},function(m,f,d){function u(a,c){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!c||"object"!==typeof c&&"function"!==typeof c?a:c}function p(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);
a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}d.d(f,"a",function(){return v});var q=d(6);m=d(0);var a=d(10),c=function(){function a(a,c){for(var d=0;d<c.length;d++){var e=c[d];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(c,d,f){d&&a(c.prototype,d);f&&a(c,f);return c}}(),n=function l(a,c,d){null===
a&&(a=Function.prototype);var b=Object.getOwnPropertyDescriptor(a,c);if(void 0===b){if(a=Object.getPrototypeOf(a),null!==a)return l(a,c,d)}else{if("value"in b)return b.value;c=b.get;return void 0===c?void 0:c.call(d)}},v=function(d){function f(a,c){c=void 0===c?{}:c;if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var b=u(this,(f.__proto__||Object.getPrototypeOf(f)).call(this));b.model=a;b.element=document.createElement("label");b.inputElement=document.createElement("input");
var d=c;c=d.validator;d=d.label;var e=b.element,g=b.inputElement;void 0===c&&(c=a instanceof q.c?a.validator:function(a){return a});b.validator=c;void 0!==d&&(e.textContent=d);e.appendChild(g);e.className="neuroglancer-number-input";g.type="input";b.registerDisposer(b.model.changed.add(function(){return b.updateView()}));b.registerEventListener(g,"change",function(){return b.updateModel()});b.updateView();return b}p(f,d);c(f,[{key:"updateView",value:function(){this.inputElement.value=""+this.model.value}},
{key:"updateModel",value:function(){var a=parseFloat(this.inputElement.value.trim());if(Number.isNaN(a))this.updateView();else try{a=this.validator(a),this.model.value=a}catch(e){this.updateView()}}},{key:"disposed",value:function(){Object(a.b)(this.element);n(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"disposed",this).call(this)}}]);return f}(m.a)},function(m,f){},function(m,f,d){function u(a,c){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!c||"object"!==typeof c&&"function"!==typeof c?a:c}function p(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}d.d(f,"a",function(){return e});m=d(5);var q=d.n(m),a=d(6);m=d(0);var c=d(20),n=d(1),v=d(2),t=d(3),l=d(29),k=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 h(a,c,d){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,c);if(void 0===e){if(a=Object.getPrototypeOf(a),null!==a)return h(a,c,d)}else{if("value"in e)return e.value;c=e.get;return void 0===c?void 0:c.call(d)}},e=function(d){function e(c){if(!(this instanceof
e))throw new TypeError("Cannot call a class as a function");var d=u(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));d.viewer=c;d.actionSet=new a.c(new Set,function(a){return new Set(Object(v.B)(a))});d.actionDisposers=[];d.sendActionRequested=new t.b;d.actionSet.changed.add(q()(function(){return d.updateActions()},0));return d}p(e,d);k(e,[{key:"clearListeners",value:function(){for(var a=$jscomp.makeIterator(this.actionDisposers),c=a.next();!c.done;c=a.next())c=c.value,c();this.actionDisposers.length=
0}},{key:"disposed",value:function(){this.clearListeners();g(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"disposed",this).call(this)}},{key:"updateActions",value:function(){var a=this;this.clearListeners();for(var d={},e=$jscomp.makeIterator(this.actionSet.value),f=e.next();!f.done;d={action:d.action},f=e.next())d.action=f.value,this.actionDisposers.push(Object(c.c)(this.viewer.element,d.action,function(c){return function(){return a.handleAction(c.action)}}(d)))}},{key:"handleAction",
value:function(a){var c=this.viewer,d=c.mouseState;c=c.layerSelectedValues;var e={};if(d.updateUnconditionally()){e.mouseSpatialCoordinates=Array.prototype.slice.call(d.position);var f=this.viewer.navigationState.voxelSize;f.valid&&(e.mouseVoxelCoordinates=Array.prototype.slice.call(n.s.divide(n.s.create(),d.position,f.size)))}e.selectedValues=c;e.viewerState=Object(l.c)(this.viewer.state).value;this.sendActionRequested.dispatch(a,JSON.parse(JSON.stringify(e)))}}]);return e}(m.a)},function(m,f,d){function u(a,
c){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!c||"object"!==typeof c&&"function"!==typeof c?a:c}function p(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}d.d(f,"a",function(){return t});m=
d(5);var q=d.n(m),a=d(26),c=d(3);m=d(0);var n=d(2),v=function(){function a(a,c){for(var d=0;d<c.length;d++){var b=c[d];b.enumerable=b.enumerable||!1;b.configurable=!0;"value"in b&&(b.writable=!0);Object.defineProperty(a,b.key,b)}}return function(c,d,e){d&&a(c.prototype,d);e&&a(c,e);return c}}(),t=function(d){function f(){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var a=u(this,(f.__proto__||Object.getPrototypeOf(f)).call(this));a.existingMessages=new Map;a.changed=
new c.a;a.messages=new Map;a.changed.add(a.registerCancellable(q()(function(){return a.updateMessages()},0)));return a}p(f,d);v(f,[{key:"reset",value:function(){this.messages.clear();this.changed.dispatch()}},{key:"restoreState",value:function(a){Object(n.t)(a);this.messages.clear();for(var c=$jscomp.makeIterator(Object.keys(a)),b=c.next();!b.done;b=c.next()){b=b.value;var d=Object(n.A)(a[b]);this.messages.set(b,d)}this.changed.dispatch()}},{key:"disposed",value:function(){for(var a=$jscomp.makeIterator(this.existingMessages.values()),
c=a.next();!c.done;c=a.next())c.value.dispose();this.existingMessages.clear()}},{key:"updateMessages",value:function(){for(var c=this.existingMessages,d=this.messages,b=$jscomp.makeIterator(c),f=b.next();!f.done;f=b.next()){var k=$jscomp.makeIterator(f.value);f=k.next().value;k=k.next().value;var l=d.get(f);void 0===l?(k.dispose(),c.delete(f)):k.setText(l)}d=$jscomp.makeIterator(d);for(b=d.next();!b.done;b=d.next())f=$jscomp.makeIterator(b.value),b=f.next().value,f=f.next().value,c.has(b)||(k=new a.a,
k.setText(f),c.set(b,k))}},{key:"toJSON",value:function(){for(var a={},c=$jscomp.makeIterator(this.messages),b=c.next();!b.done;b=c.next()){var d=$jscomp.makeIterator(b.value);b=d.next().value;d=d.next().value;a[b]=d}return a}}]);return f}(m.a)},function(m,f,d){function u(a,c){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!c||"object"!==typeof c&&"function"!==typeof c?a:c}function p(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+
typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}d.d(f,"a",function(){return l});m=d(5);var q=d.n(m),a=d(6);m=d(0);var c=d(2),n=d(3),v=d(29),t=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(c,d,b){d&&a(c.prototype,d);b&&
a(c,b);return c}}(),l=function(d){function f(d){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var b=u(this,(f.__proto__||Object.getPrototypeOf(f)).call(this));b.viewer=d;b.sendScreenshotRequested=new n.b;b.requestState=new a.c(void 0,c.y);b.previousRequest=void 0;var e=b.registerCancellable(q()(function(){return b.maybeSendScreenshot()},0));b.requestState.changed.add(e);b.registerDisposer(d.display.updateFinished.add(e));return b}p(f,d);t(f,[{key:"maybeSendScreenshot",
value:function(){var a=this.requestState.value,b=this.previousRequest,c=this.viewer.layerSelectedValues;if(void 0!==a&&a!==b&&(b=this.viewer,b.display.isReady())){for(var d=$jscomp.makeIterator(b.layerManager.managedLayers),f=d.next();!f.done;f=d.next())if(!f.value.isReady())return;this.previousRequest=a;b.display.draw();d=b.display.canvas.toDataURL();d.startsWith("data:image/png;base64,")?(b="image/png",d=d.substring(22)):d=b="";a={viewerState:JSON.parse(JSON.stringify(Object(v.c)(this.viewer.state).value)),
selectedValues:JSON.parse(JSON.stringify(c)),screenshot:{id:a,image:d,imageType:b}};this.sendScreenshotRequested.dispatch(a)}}}]);return f}(m.a)},function(m,f,d){function u(a,c){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!c||"object"!==typeof c&&"function"!==typeof c?a:c}function p(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,
{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}function q(){var a=window.location.pathname.match(/^\/v\/([^\/]+)/);if(null===a)throw Error("Failed to determine token from URL.");return window.location.origin+"/socket/"+a[1]}d.d(f,"a",function(){return t});var a=d(310);m=d(0);f=d(311);var c=d.n(f),n=d(26),v=function(){function a(a,c){for(var d=0;d<c.length;d++){var b=c[d];b.enumerable=b.enumerable||!1;b.configurable=
!0;"value"in b&&(b.writable=!0);Object.defineProperty(a,b.key,b)}}return function(c,d,e){d&&a(c.prototype,d);e&&a(c,e);return c}}(),t=function(d){function f(c,d,b,h){h=void 0===h?q():h;if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var e=u(this,(f.__proto__||Object.getPrototypeOf(f)).call(this));e.sharedState=c;e.privateState=d;e.configState=b;e.url=h;e.reconnectionDelay=1E3;e.waitingToReconnect=-1;e.isOpen=!1;e.updateClients=new Map;e.status=e.registerDisposer(new n.a(!0));
e.actionQueue=[];e.nextActionId=0;e.lastActionAcknowledged=-1;d=[{key:"p",state:d,receiveUpdates:!1,sendUpdates:0},{key:"c",state:b,receiveUpdates:!0,sendUpdates:null}];void 0!==c&&d.push({key:"s",state:c,receiveUpdates:!0,sendUpdates:100});c={};d=$jscomp.makeIterator(d);for(b=d.next();!b.done;c={key:c.key},b=d.next()){var g=b.value;c.key=g.key;b=g.receiveUpdates;h=g.sendUpdates;g=e.registerDisposer(new a.a(g.state,h,b));e.updateClients.set(c.key,g);null!==h&&g.sendUpdateRequested.add(function(a){return function(b,
c){return e.send("setState",{k:a.key,s:b,g:c})}}(c));b&&g.receiveUpdateRequested.add(function(a){return function(b){return e.send("getState",{g:b,k:a.key})}}(c))}e.connect();return e}p(f,d);v(f,[{key:"dispose",value:function(){void 0!==this.socket&&(this.socket.close(),this.socket=void 0);-1!==this.waitingToReconnect&&(clearInterval(this.waitingToReconnect),this.waitingToReconnect=-1)}},{key:"send",value:function(a,c){c.t=a;this.socket.send(JSON.stringify(c))}},{key:"connect",value:function(){var a=
this;this.status.setText("Connecting to Python server");this.status.setVisible(!0);var d=this.socket=new c.a(this.url,{transports:["websocket","xhr-streaming"]});d.onopen=function(){a.isOpen=!0;a.reconnectionDelay=1E3;a.status.setVisible(!1);for(var b=$jscomp.makeIterator(a.updateClients.values()),c=b.next();!c.done;c=b.next())c.value.connected=!0;a.flushActionQueue()};d.onclose=function(){a.isOpen=!1;for(var b=a.reconnectionDelay,c=$jscomp.makeIterator(a.updateClients.values()),d=c.next();!d.done;d=
c.next())d.value.connected=!1;var e=Date.now()+b;a.status.setVisible(!0);var f=function(b){a.status.setText("Disconnected from Python server.  "+("Retrying in "+Math.ceil(b/1E3)+" seconds."))};a.waitingToReconnect=setInterval(function(){var b=e-Date.now();0>b?(clearInterval(a.waitingToReconnect),a.waitingToReconnect=-1,a.connect()):f(b)},1E3);f(b);a.reconnectionDelay=Math.min(3E4,2*b)};d.onmessage=function(b){b=JSON.parse(b.data);if("object"!==typeof b||Array.isArray(b))throw Error("Invalid message received over server connection.");
switch(b.t){case "setState":var c=a.updateClients.get(b.k);if(void 0===c)throw Error("Invalid state key: "+JSON.stringify(b.k));c.setState(b.s,b.g);break;case "ackAction":b=parseInt(b.id,10);if(b<a.lastActionAcknowledged||b>=a.nextActionId)throw Error("Invalid action acknowledged message");a.actionQueue.splice(0,b-a.lastActionAcknowledged);a.lastActionAcknowledged=b}}}},{key:"flushActionQueue",value:function(){var a=this.actionQueue;0!==a.length&&this.send("action",{id:this.nextActionId-1,actions:a})}},
{key:"sendActionNotification",value:function(a,c){this.actionQueue.push({action:a,state:c});++this.nextActionId;this.isOpen&&this.flushActionQueue()}}]);return f}(m.a)},function(m,f,d){function u(a,c){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!c||"object"!==typeof c&&"function"!==typeof c?a:c}function p(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=
Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}d.d(f,"a",function(){return l});m=d(5);var q=d.n(m);m=d(110);var a=d.n(m);m=d(0);var c=d(107),n=d(3),v=d(29),t=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(c,d,b){d&&a(c.prototype,d);b&&a(c,
b);return c}}(),l=function(d){function f(c,b,d){b=void 0===b?100:b;d=void 0===d?!0:d;if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var e=u(this,(f.__proto__||Object.getPrototypeOf(f)).call(this));e.state=c;e.receiveUpdates=d;e.serverGeneration="";e.clientGeneration=-1;e.connected_=!1;e.receiveUpdateRequested=new n.b;e.sendUpdateRequested=new n.b;null!==b?(e.sendUpdates=!0,e.registerDisposer(c.changed.add(e.registerCancellable(a()(e.registerCancellable(q()(function(){return e.handleStateChanged()},
0)),b,{leading:!1}))))):e.sendUpdates=!1;return e}p(f,d);t(f,[{key:"setState",value:function(a,b){this.receiveUpdates&&b!==this.serverGeneration&&(this.lastServerState=JSON.stringify(a),this.state.reset(),this.state.restoreState(a),this.serverGeneration=b,this.clientGeneration=this.state.changed.count)}},{key:"handleStateChanged",value:function(){if(this.sendUpdates&&this.connected_&&(!this.receiveUpdates||""!==this.serverGeneration)&&this.clientGeneration!==this.state.changed.count){var a=Object(v.c)(this.state).value,
b=JSON.stringify(a);if(b===this.lastServerState)this.clientGeneration=this.state.changed.count;else{var d=Object(c.a)(160);this.serverGeneration=d;this.lastServerState=b;this.sendUpdateRequested.dispatch(a,d)}}}},{key:"connected",set:function(a){a!==this.connected_&&(this.connected_=a,!0===a&&(this.receiveUpdates&&this.receiveUpdateRequested.dispatch(this.serverGeneration),this.handleStateChanged()))},get:function(){return this.connected_}}]);return f}(m.a)},function(m,f,d){f=d(7);var u=d(312);m.exports=
d(331)(u);"_sockjs_onload"in f&&setTimeout(f._sockjs_onload,1)},function(m,f,d){m.exports=[d(313),d(320),d(164),d(165),d(99)(d(165)),d(169),d(99)(d(169)),d(170),d(327),d(99)(d(170)),d(328)]},function(m,f,d){(function(f){function p(c,d,f){if(!p.enabled())throw Error("Transport created when disabled");n.call(this);t("constructor",c);var e=this;c=a.addPath(c,"/websocket");this.url=c="https"===c.slice(0,5)?"wss"+c.slice(5):"ws"+c.slice(4);this.ws=new u(this.url,[],f);this.ws.onmessage=function(a){t("message event",
a.data);e.emit("message",a.data)};this.unloadRef=q.unloadAdd(function(){t("unload");e.ws.close()});this.ws.onclose=function(a){t("close event",a.code,a.reason);e.emit("close",a.code,a.reason);e._cleanup()};this.ws.onerror=function(a){t("error event",a);e.emit("close",1006,"WebSocket connection broken");e._cleanup()}}var q=d(38),a=d(22),c=d(4),n=d(13).EventEmitter,u=d(319),t=function(){};"production"!==f.env.NODE_ENV&&(t=d(9)("sockjs-client:websocket"));c(p,n);p.prototype.send=function(a){a="["+a+
"]";t("send",a);this.ws.send(a)};p.prototype.close=function(){t("close");var a=this.ws;this._cleanup();a&&a.close()};p.prototype._cleanup=function(){t("_cleanup");var a=this.ws;a&&(a.onmessage=a.onclose=a.onerror=null);q.unloadDel(this.unloadRef);this.unloadRef=this.ws=null;this.removeAllListeners()};p.enabled=function(){t("enabled");return!!u};p.transportName="websocket";p.roundTrips=2;m.exports=p}).call(f,d(8))},function(m,f,d){(function(d){m.exports.randomBytes=d.crypto&&d.crypto.getRandomValues?
function(f){f=new Uint8Array(f);d.crypto.getRandomValues(f);return f}:function(d){for(var f=Array(d),a=0;a<d;a++)f[a]=Math.floor(256*Math.random());return f}}).call(f,d(7))},function(m,f,d){m.exports=function(d,f){f=f.split(":")[0];d=+d;if(!d)return!1;switch(f){case "http":case "ws":return 80!==d;case "https":case "wss":return 443!==d;case "ftp":return 21!==d;case "gopher":return 70!==d;case "file":return!1}return 0!==d}},function(m,f,d){var u=Object.prototype.hasOwnProperty;f.stringify=function(d,
f){f=f||"";var a=[];"string"!==typeof f&&(f="?");for(var c in d)u.call(d,c)&&a.push(encodeURIComponent(c)+"="+encodeURIComponent(d[c]));return a.length?f+a.join("&"):""};f.parse=function(d){for(var f=/([^=?&]+)=?([^&]*)/g,a={},c;c=f.exec(d);a[decodeURIComponent(c[1].replace(/\+/g," "))]=decodeURIComponent(c[2].replace(/\+/g," ")));return a}},function(m,f,d){function u(a){var c=0,d;for(d in a)c=(c<<5)-c+a.charCodeAt(d),c|=0;return f.colors[Math.abs(c)%f.colors.length]}function p(a){function c(){if(c.enabled){var a=
+new Date;c.diff=a-(q||a);c.prev=q;q=c.curr=a;var d=Array(arguments.length);for(a=0;a<d.length;a++)d[a]=arguments[a];d[0]=f.coerce(d[0]);"string"!==typeof d[0]&&d.unshift("%O");var m=0;d[0]=d[0].replace(/%([a-zA-Z%])/g,function(a,k){if("%%"===a)return a;m++;k=f.formatters[k];"function"===typeof k&&(a=k.call(c,d[m]),d.splice(m,1),m--);return a});f.formatArgs.call(c,d);(c.log||f.log||console.log.bind(console)).apply(c,d)}}c.namespace=a;c.enabled=f.enabled(a);c.useColors=f.useColors();c.color=u(a);"function"===
typeof f.init&&f.init(c);return c}f=m.exports=p.debug=p["default"]=p;f.coerce=function(a){return a instanceof Error?a.stack||a.message:a};f.disable=function(){f.enable("")};f.enable=function(a){f.save(a);f.names=[];f.skips=[];for(var c=("string"===typeof a?a:"").split(/[\s,]+/),d=c.length,m=0;m<d;m++)c[m]&&(a=c[m].replace(/\*/g,".*?"),"-"===a[0]?f.skips.push(new RegExp("^"+a.substr(1)+"$")):f.names.push(new RegExp("^"+a+"$")))};f.enabled=function(a){var c;var d=0;for(c=f.skips.length;d<c;d++)if(f.skips[d].test(a))return!1;
d=0;for(c=f.names.length;d<c;d++)if(f.names[d].test(a))return!0;return!1};f.humanize=d(318);f.names=[];f.skips=[];f.formatters={};var q},function(m,f){function d(a){a=String(a);if(!(100<a.length)&&(a=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(a))){var c=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case "years":case "year":case "yrs":case "yr":case "y":return c*q;case "days":case "day":case "d":return c*p;case "hours":case "hour":case "hrs":case "hr":case "h":return 36E5*
c;case "minutes":case "minute":case "mins":case "min":case "m":return 6E4*c;case "seconds":case "second":case "secs":case "sec":case "s":return 1E3*c;case "milliseconds":case "millisecond":case "msecs":case "msec":case "ms":return c}}}function u(a,c,d){if(!(a<c))return a<1.5*c?Math.floor(a/c)+" "+d:Math.ceil(a/c)+" "+d+"s"}var p=864E5,q=365.25*p;m.exports=function(a,c){c=c||{};var f=typeof a;if("string"===f&&0<a.length)return d(a);if("number"===f&&!1===isNaN(a))return c.long?u(a,p,"day")||u(a,36E5,
"hour")||u(a,6E4,"minute")||u(a,1E3,"second")||a+" ms":a>=p?Math.round(a/p)+"d":36E5<=a?Math.round(a/36E5)+"h":6E4<=a?Math.round(a/6E4)+"m":1E3<=a?Math.round(a/1E3)+"s":a+"ms";throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a));}},function(m,f,d){(function(d){var f=d.WebSocket||d.MozWebSocket;m.exports=f?function(d){return new f(d)}:void 0}).call(f,d(7))},function(m,f,d){(function(f){function p(d){if(!u.enabled&&!n.enabled)throw Error("Transport created when disabled");
a.call(this,d,"/xhr_streaming",c,n)}var q=d(4),a=d(51),c=d(73),n=d(74),u=d(59),t=d(60);q(p,a);p.enabled=function(a){return a.nullOrigin||t.isOpera()?!1:n.enabled};p.transportName="xhr-streaming";p.roundTrips=2;p.needBody=!!f.document;m.exports=p}).call(f,d(7))},function(m,f,d){(function(f){function p(d,f){c(d);a.call(this);this.sendBuffer=[];this.sender=f;this.url=d}var q=d(4),a=d(13).EventEmitter,c=function(){};"production"!==f.env.NODE_ENV&&(c=d(9)("sockjs-client:buffered-sender"));q(p,a);p.prototype.send=
function(a){c("send",a);this.sendBuffer.push(a);this.sendStop||this.sendSchedule()};p.prototype.sendScheduleWait=function(){c("sendScheduleWait");var a=this;this.sendStop=function(){c("sendStop");a.sendStop=null;clearTimeout(d)};var d=setTimeout(function(){c("timeout");a.sendStop=null;a.sendSchedule()},25)};p.prototype.sendSchedule=function(){c("sendSchedule",this.sendBuffer.length);var a=this;if(0<this.sendBuffer.length){var d="["+this.sendBuffer.join(",")+"]";this.sendStop=this.sender(this.url,
d,function(d){a.sendStop=null;d?(c("error",d),a.emit("close",d.code||1006,"Sending error: "+d),a.close()):a.sendScheduleWait()});this.sendBuffer=[]}};p.prototype._cleanup=function(){c("_cleanup");this.removeAllListeners()};p.prototype.close=function(){c("close");this._cleanup();this.sendStop&&(this.sendStop(),this.sendStop=null)};m.exports=p}).call(f,d(8))},function(m,f,d){(function(f){function p(d,f,m){c(f);a.call(this);this.Receiver=d;this.receiveUrl=f;this.AjaxObject=m;this._scheduleReceiver()}
var q=d(4),a=d(13).EventEmitter,c=function(){};"production"!==f.env.NODE_ENV&&(c=d(9)("sockjs-client:polling"));q(p,a);p.prototype._scheduleReceiver=function(){c("_scheduleReceiver");var a=this,d=this.poll=new this.Receiver(this.receiveUrl,this.AjaxObject);d.on("message",function(d){c("message",d);a.emit("message",d)});d.once("close",function(f,l){c("close",f,l,a.pollIsClosing);a.poll=d=null;a.pollIsClosing||("network"===l?a._scheduleReceiver():(a.emit("close",f||1006,l),a.removeAllListeners()))})};
p.prototype.abort=function(){c("abort");this.removeAllListeners();this.pollIsClosing=!0;this.poll&&this.poll.abort()};m.exports=p}).call(f,d(8))},function(m,f,d){(function(f){function p(d){n(d);a.call(this);var f=this,l=this.es=new c(d);l.onmessage=function(a){n("message",a.data);f.emit("message",decodeURI(a.data))};l.onerror=function(a){n("error",l.readyState,a);a=2!==l.readyState?"network":"permanent";f._cleanup();f._close(a)}}var q=d(4),a=d(13).EventEmitter,c=d(166),n=function(){};"production"!==
f.env.NODE_ENV&&(n=d(9)("sockjs-client:receiver:eventsource"));q(p,a);p.prototype.abort=function(){n("abort");this._cleanup();this._close("user")};p.prototype._cleanup=function(){n("cleanup");var a=this.es;a&&(a.onmessage=a.onerror=null,a.close(),this.es=null)};p.prototype._close=function(a){n("close",a);var c=this;setTimeout(function(){c.emit("close",null,a);c.removeAllListeners()},200)};m.exports=p}).call(f,d(8))},function(m,f){m.exports=function(d){d.webpackPolyfill||(d.deprecate=function(){},
d.paths=[],d.children||(d.children=[]),Object.defineProperty(d,"loaded",{enumerable:!0,get:function(){return d.l}}),Object.defineProperty(d,"id",{enumerable:!0,get:function(){return d.i}}),d.webpackPolyfill=1);return d}},function(m,f){m.exports={}},function(m,f,d){(function(f,p){function q(a){l(a);u.call(this);var d=this;c.polluteGlobalNamespace();this.id="a"+t.string(6);a=n.addQuery(a,"c="+decodeURIComponent(c.WPrefix+"."+this.id));l("using htmlfile",q.htmlfileEnabled);var e=q.htmlfileEnabled?c.createHtmlfile:
c.createIframe;p[c.WPrefix][this.id]={start:function(){l("start");d.iframeObj.loaded()},message:function(a){l("message",a);d.emit("message",a)},stop:function(){l("stop");d._cleanup();d._close("network")}};this.iframeObj=e(a,function(){l("callback");d._cleanup();d._close("permanent")})}var a=d(4),c=d(61),n=d(22),u=d(13).EventEmitter,t=d(50),l=function(){};"production"!==f.env.NODE_ENV&&(l=d(9)("sockjs-client:receiver:htmlfile"));a(q,u);q.prototype.abort=function(){l("abort");this._cleanup();this._close("user")};
q.prototype._cleanup=function(){l("_cleanup");this.iframeObj&&(this.iframeObj.cleanup(),this.iframeObj=null);delete p[c.WPrefix][this.id]};q.prototype._close=function(a){l("_close",a);this.emit("close",null,a);this.removeAllListeners()};q.htmlfileEnabled=!1;f=["Active"].concat("Object").join("X");if(f in p)try{q.htmlfileEnabled=!!new p[f]("htmlfile")}catch(k){}q.enabled=q.htmlfileEnabled||c.iframeEnabled;m.exports=q}).call(f,d(8),d(7))},function(m,f,d){function u(d){if(!c.enabled)throw Error("Transport created when disabled");
p.call(this,d,"/xhr",a,c)}f=d(4);var p=d(51),q=d(164),a=d(73),c=d(98);f(u,p);u.enabled=q.enabled;u.transportName="xdr-polling";u.roundTrips=2;m.exports=u},function(m,f,d){(function(f){function p(d){if(!p.enabled())throw Error("Transport created when disabled");a.call(this,d,"/jsonp",n,c)}var q=d(4),a=d(162),c=d(329),n=d(330);q(p,a);p.enabled=function(){return!!f.document};p.transportName="jsonp-polling";p.roundTrips=1;p.needBody=!0;m.exports=p}).call(f,d(7))},function(m,f,d){(function(f,p){function q(d){k(d);
var e=this;l.call(this);a.polluteGlobalNamespace();this.id="a"+c.string(6);d=u.addQuery(d,"c="+encodeURIComponent(a.WPrefix+"."+this.id));p[a.WPrefix][this.id]=this._callback.bind(this);this._createScript(d);this.timeoutId=setTimeout(function(){k("timeout");e._abort(Error("JSONP script loaded abnormally (timeout)"))},q.timeout)}var a=d(61),c=d(50),n=d(60),u=d(22),t=d(4),l=d(13).EventEmitter,k=function(){};"production"!==f.env.NODE_ENV&&(k=d(9)("sockjs-client:receiver:jsonp"));t(q,l);q.prototype.abort=
function(){k("abort");if(p[a.WPrefix][this.id]){var c=Error("JSONP user aborted read");c.code=1E3;this._abort(c)}};q.timeout=35E3;q.scriptErrorTimeout=1E3;q.prototype._callback=function(a){k("_callback",a);this._cleanup();this.aborting||(a&&(k("message",a),this.emit("message",a)),this.emit("close",null,"network"),this.removeAllListeners())};q.prototype._abort=function(a){k("_abort",a);this._cleanup();this.aborting=!0;this.emit("close",a.code,a.message);this.removeAllListeners()};q.prototype._cleanup=
function(){k("_cleanup");clearTimeout(this.timeoutId);this.script2&&(this.script2.parentNode.removeChild(this.script2),this.script2=null);if(this.script){var c=this.script;c.parentNode.removeChild(c);this.script=c.onreadystatechange=c.onerror=c.onload=c.onclick=null}delete p[a.WPrefix][this.id]};q.prototype._scriptError=function(){k("_scriptError");var a=this;this.errorTimer||(this.errorTimer=setTimeout(function(){a.loadedOkay||a._abort(Error("JSONP script loaded abnormally (onerror)"))},q.scriptErrorTimeout))};
q.prototype._createScript=function(a){k("_createScript",a);var d=this,b=this.script=p.document.createElement("script");b.id="a"+c.string(8);b.src=a;b.type="text/javascript";b.charset="UTF-8";b.onerror=this._scriptError.bind(this);b.onload=function(){k("onload");d._abort(Error("JSONP script loaded abnormally (onload)"))};b.onreadystatechange=function(){k("onreadystatechange",b.readyState);if(/loaded|closed/.test(b.readyState)){if(b&&b.htmlFor&&b.onclick){d.loadedOkay=!0;try{b.onclick()}catch(r){}}b&&
d._abort(Error("JSONP script loaded abnormally (onreadystatechange)"))}};if("undefined"===typeof b.async&&p.document.attachEvent)if(n.isOpera()){var f=this.script2=p.document.createElement("script");f.text="try{var a = document.getElementById('"+b.id+"'); if(a)a.onerror();}catch(x){};";b.async=f.async=!1}else{try{b.htmlFor=b.id,b.event="onclick"}catch(r){}b.async=!0}"undefined"!==typeof b.async&&(b.async=!0);a=p.document.getElementsByTagName("head")[0];a.insertBefore(b,a.firstChild);f&&a.insertBefore(f,
a.firstChild)};m.exports=q}).call(f,d(8),d(7))},function(m,f,d){(function(f,p){function q(a){n("createIframe",a);try{return p.document.createElement('<iframe name="'+a+'">')}catch(g){var c=p.document.createElement("iframe");c.name=a;return c}}var a=d(50),c=d(22),n=function(){};"production"!==f.env.NODE_ENV&&(n=d(9)("sockjs-client:sender:jsonp"));var u,t;m.exports=function(d,f,g){n(d,f);u||(n("createForm"),u=p.document.createElement("form"),u.style.display="none",u.style.position="absolute",u.method=
"POST",u.enctype="application/x-www-form-urlencoded",u.acceptCharset="UTF-8",t=p.document.createElement("textarea"),t.name="d",u.appendChild(t),p.document.body.appendChild(u));var e="a"+a.string(8);u.target=e;u.action=c.addQuery(c.addPath(d,"/jsonp_send"),"i="+e);var b=q(e);b.id=e;b.style.display="none";u.appendChild(b);try{t.value=f}catch(r){}u.submit();var h=function(a){n("completed",e,a);b.onerror&&(b.onreadystatechange=b.onerror=b.onload=null,setTimeout(function(){n("cleaning up",e);b.parentNode.removeChild(b);
b=null},500),t.value="",g(a))};b.onerror=function(){n("onerror",e);h()};b.onload=function(){n("onload",e);h()};b.onreadystatechange=function(a){n("onreadystatechange",e,b.readyState,a);"complete"===b.readyState&&h()};return function(){n("aborted",e);h(Error("Aborted"))}}}).call(f,d(8),d(7))},function(m,f,d){(function(f,p){function q(c,d,e){if(!(this instanceof q))return new q(c,d,e);if(1>arguments.length)throw new TypeError("Failed to construct 'SockJS: 1 argument required, but only 0 present");A.call(this);
this.readyState=q.CONNECTING;this.protocol=this.extensions="";e=e||{};e.protocols_whitelist&&h.warn("'protocols_whitelist' is DEPRECATED. Use 'transports' instead.");this._transportsWhitelist=e.transports;this._transportOptions=e.transportOptions||{};var f=e.sessionId||8;if("function"===typeof f)this._generateSessionId=f;else if("number"===typeof f)this._generateSessionId=function(){return u.string(f)};else throw new TypeError("If sessionId is used in the options, it needs to be a number or a function.");
this._server=e.server||u.numberString(1E3);var g=new a(c);if(g.host&&g.protocol){if(g.hash)throw new SyntaxError("The URL must not contain a fragment");if("http:"!==g.protocol&&"https:"!==g.protocol)throw new SyntaxError("The URL's scheme must be either 'http:' or 'https:'. '"+g.protocol+"' is not allowed.");}else throw new SyntaxError("The URL '"+c+"' is invalid");var k="https:"===g.protocol;if("https"===y.protocol&&!k)throw Error("SecurityError: An insecure SockJS connection may not be initiated from a page loaded over HTTPS");
d?Array.isArray(d)||(d=[d]):d=[];var n=d.sort();n.forEach(function(a,b){if(!a)throw new SyntaxError("The protocols entry '"+a+"' is invalid.");if(b<n.length-1&&a===n[b+1])throw new SyntaxError("The protocols entry '"+a+"' is duplicated.");});this._origin=(k=l.getOrigin(y.href))?k.toLowerCase():null;g.set("pathname",g.pathname.replace(/\/+$/,""));this.url=g.href;D("using url",this.url);this._urlInfo={nullOrigin:!b.hasDomain(),sameOrigin:l.isOriginEqual(this.url,y.href),sameScheme:l.isSchemeEqual(this.url,
y.href)};this._ir=new x(this.url,this._urlInfo);this._ir.once("finish",this._receiveInfo.bind(this))}d(332);var a=d(160),c=d(4),n=d(33),u=d(50),t=d(333),l=d(22),k=d(38),g=d(334),e=d(100),b=d(60),h=d(335),r=d(101),A=d(161),y=d(171),z=d(336),E=d(337),x=d(338),D=function(){};"production"!==f.env.NODE_ENV&&(D=d(9)("sockjs-client:main"));var G;c(q,A);q.prototype.close=function(a,b){if(a&&!(1E3===a||3E3<=a&&4999>=a))throw Error("InvalidAccessError: Invalid code");if(b&&123<b.length)throw new SyntaxError("reason argument has an invalid length");
this.readyState!==q.CLOSING&&this.readyState!==q.CLOSED&&this._close(a||1E3,b||"Normal closure",!0)};q.prototype.send=function(a){"string"!==typeof a&&(a=""+a);if(this.readyState===q.CONNECTING)throw Error("InvalidStateError: The connection has not been established yet");this.readyState===q.OPEN&&this._transport.send(t.quote(a))};q.version=d(168);q.CONNECTING=0;q.OPEN=1;q.CLOSING=2;q.CLOSED=3;q.prototype._receiveInfo=function(a,b){D("_receiveInfo",b);this._ir=null;a?(this._rto=this.countRTO(b),this._transUrl=
a.base_url?a.base_url:this.url,a=e.extend(a,this._urlInfo),D("info",a),this._transports=G.filterToEnabled(this._transportsWhitelist,a).main,D(this._transports.length+" enabled transports"),this._connect()):this._close(1002,"Cannot connect to server")};q.prototype._connect=function(){for(var a=this._transports.shift();a;){D("attempt",a.transportName);if(a.needBody&&(!p.document.body||"undefined"!==typeof p.document.readyState&&"complete"!==p.document.readyState&&"interactive"!==p.document.readyState)){D("waiting for body");
this._transports.unshift(a);k.attachEvent("load",this._connect.bind(this));return}var b=this._rto*a.roundTrips||5E3;this._transportTimeoutId=setTimeout(this._transportTimeout.bind(this),b);D("using timeout",b);b=l.addPath(this._transUrl,"/"+this._server+"/"+this._generateSessionId());var c=this._transportOptions[a.transportName];D("transport url",b);b=new a(b,this._transUrl,c);b.on("message",this._transportMessage.bind(this));b.once("close",this._transportClose.bind(this));b.transportName=a.transportName;
this._transport=b;return}this._close(2E3,"All transports failed",!1)};q.prototype._transportTimeout=function(){D("_transportTimeout");this.readyState===q.CONNECTING&&this._transportClose(2007,"Transport timed out")};q.prototype._transportMessage=function(a){D("_transportMessage",a);var b=this,c=a.slice(0,1);a=a.slice(1);switch(c){case "o":this._open();return;case "h":this.dispatchEvent(new r("heartbeat"));D("heartbeat",this.transport);return}if(a)try{var d=n.parse(a)}catch(P){D("bad json",a)}if("undefined"===
typeof d)D("empty payload",a);else switch(c){case "a":Array.isArray(d)&&d.forEach(function(a){D("message",b.transport,a);b.dispatchEvent(new E(a))});break;case "m":D("message",this.transport,d);this.dispatchEvent(new E(d));break;case "c":Array.isArray(d)&&2===d.length&&this._close(d[0],d[1],!0)}};q.prototype._transportClose=function(a,b){D("_transportClose",this.transport,a,b);this._transport&&(this._transport.removeAllListeners(),this.transport=this._transport=null);1E3===a||3E3<=a&&4999>=a||2E3===
a||this.readyState!==q.CONNECTING?this._close(a,b):this._connect()};q.prototype._open=function(){D("_open",this._transport.transportName,this.readyState);this.readyState===q.CONNECTING?(this._transportTimeoutId&&(clearTimeout(this._transportTimeoutId),this._transportTimeoutId=null),this.readyState=q.OPEN,this.transport=this._transport.transportName,this.dispatchEvent(new r("open")),D("connected",this.transport)):this._close(1006,"Server lost session")};q.prototype._close=function(a,b,c){D("_close",
this.transport,a,b,c,this.readyState);var d=!1;this._ir&&(d=!0,this._ir.close(),this._ir=null);this._transport&&(this._transport.close(),this.transport=this._transport=null);if(this.readyState===q.CLOSED)throw Error("InvalidStateError: SockJS has already been closed");this.readyState=q.CLOSING;setTimeout(function(){this.readyState=q.CLOSED;d&&this.dispatchEvent(new r("error"));var e=new z("close");e.wasClean=c||!1;e.code=a||1E3;e.reason=b;this.dispatchEvent(e);this.onmessage=this.onclose=this.onerror=
null;D("disconnected")}.bind(this),0)};q.prototype.countRTO=function(a){return 100<a?4*a:300+a};m.exports=function(a){G=g(a);d(341)(q,a);return q}}).call(f,d(8),d(7))},function(m,f,d){function u(){}var p=Array.prototype,q=Object.prototype;f=Function.prototype;var a=String.prototype,c=p.slice,n=q.toString;if(m=Object.defineProperty)try{Object.defineProperty({},"x",{}),m=!0}catch(e){m=!1}var v=m?function(a,b,c,d){!d&&b in a||Object.defineProperty(a,b,{configurable:!0,enumerable:!1,writable:!0,value:c})}:
function(a,b,c,d){!d&&b in a||(a[b]=c)};m=function(a,b,c){for(var d in b)q.hasOwnProperty.call(b,d)&&v(a,d,b[d],c)};var t=function(a){if(null==a)throw new TypeError("can't convert "+a+" to object");return Object(a)};m(f,{bind:function(a){var b=this;if("[object Function]"!==q.toString.call(b))throw new TypeError("Function.prototype.bind called on incompatible "+b);for(var d=c.call(arguments,1),e=Math.max(0,b.length-d.length),f=[],g=0;g<e;g++)f.push("$"+g);var k=Function("binder","return function ("+
f.join(",")+"){ return binder.apply(this, arguments); }")(function(){if(this instanceof k){var e=b.apply(this,d.concat(c.call(arguments)));return Object(e)===e?e:this}return b.apply(a,d.concat(c.call(arguments)))});b.prototype&&(u.prototype=b.prototype,k.prototype=new u,u.prototype=null);return k}});m(Array,{isArray:function(a){return"[object Array]"===n.call(a)}});f=Object("a");var l="a"!==f[0]||!(0 in f);m(p,{forEach:function(a,b){var c=t(this),d=l&&"[object String]"===n.call(this)?this.split(""):
c,e=-1,f=d.length>>>0;if("[object Function]"!==q.toString.call(a))throw new TypeError;for(;++e<f;)e in d&&a.call(b,d[e],e,c)}},!function(a){var b=!0,c=!0;a&&(a.call("foo",function(a,c,d){"object"!==typeof d&&(b=!1)}),a.call([1],function(){c="string"===typeof this},"x"));return!!a&&b&&c}(p.forEach));f=Array.prototype.indexOf&&-1!==[0,1].indexOf(1,2);m(p,{indexOf:function(a){var b=l&&"[object String]"===n.call(this)?this.split(""):t(this),c=b.length>>>0;if(!c)return-1;var d=0;1<arguments.length&&(d=
+arguments[1],d!==d?d=0:0!==d&&d!==1/0&&d!==-(1/0)&&(d=(0<d||-1)*Math.floor(Math.abs(d))));for(d=0<=d?d:Math.max(0,c+d);d<c;d++)if(d in b&&b[d]===a)return d;return-1}},f);var k=a.split;2!=="ab".split(/(?:ab)*/).length||4!==".".split(/(.?)(.?)/).length||"t"==="tesst".split(/(s)*/)[1]||4!=="test".split(/(?:)/,-1).length||"".split(/.?/).length||1<".".split(/()()/).length?function(){var c=void 0===/()??/.exec("")[1];a.split=function(a,d){var b=this;if(void 0===a&&0===d)return[];if("[object RegExp]"!==
n.call(a))return k.call(this,a,d);var e=[],f=(a.ignoreCase?"i":"")+(a.multiline?"m":"")+(a.extended?"x":"")+(a.sticky?"y":""),g=0,h,l;a=new RegExp(a.source,f+"g");b+="";c||(h=new RegExp("^"+a.source+"$(?!\\s)",f));for(d=void 0===d?4294967295:d>>>0;l=a.exec(b);){f=l.index+l[0].length;if(f>g){e.push(b.slice(g,l.index));!c&&1<l.length&&l[0].replace(h,function(){for(var a=1;a<arguments.length-2;a++)void 0===arguments[a]&&(l[a]=void 0)});1<l.length&&l.index<b.length&&p.push.apply(e,l.slice(1));var m=l[0].length;
g=f;if(e.length>=d)break}a.lastIndex===l.index&&a.lastIndex++}g===b.length?!m&&a.test("")||e.push(""):e.push(b.slice(g));return e.length>d?e.slice(0,d):e}}():"0".split(void 0,0).length&&(a.split=function(a,b){return void 0===a&&0===b?[]:k.call(this,a,b)});var g=a.substr;f="".substr&&"b"!=="0b".substr(-1);m(a,{substr:function(a,b){return g.call(this,0>a?0>(a=this.length+a)?0:a:a,b)}},f)},function(m,f,d){var u=d(33),p=/[\x00-\x1f\ud800-\udfff\ufffe\uffff\u0300-\u0333\u033d-\u0346\u034a-\u034c\u0350-\u0352\u0357-\u0358\u035c-\u0362\u0374\u037e\u0387\u0591-\u05af\u05c4\u0610-\u0617\u0653-\u0654\u0657-\u065b\u065d-\u065e\u06df-\u06e2\u06eb-\u06ec\u0730\u0732-\u0733\u0735-\u0736\u073a\u073d\u073f-\u0741\u0743\u0745\u0747\u07eb-\u07f1\u0951\u0958-\u095f\u09dc-\u09dd\u09df\u0a33\u0a36\u0a59-\u0a5b\u0a5e\u0b5c-\u0b5d\u0e38-\u0e39\u0f43\u0f4d\u0f52\u0f57\u0f5c\u0f69\u0f72-\u0f76\u0f78\u0f80-\u0f83\u0f93\u0f9d\u0fa2\u0fa7\u0fac\u0fb9\u1939-\u193a\u1a17\u1b6b\u1cda-\u1cdb\u1dc0-\u1dcf\u1dfc\u1dfe\u1f71\u1f73\u1f75\u1f77\u1f79\u1f7b\u1f7d\u1fbb\u1fbe\u1fc9\u1fcb\u1fd3\u1fdb\u1fe3\u1feb\u1fee-\u1fef\u1ff9\u1ffb\u1ffd\u2000-\u2001\u20d0-\u20d1\u20d4-\u20d7\u20e7-\u20e9\u2126\u212a-\u212b\u2329-\u232a\u2adc\u302b-\u302c\uaab2-\uaab3\uf900-\ufa0d\ufa10\ufa12\ufa15-\ufa1e\ufa20\ufa22\ufa25-\ufa26\ufa2a-\ufa2d\ufa30-\ufa6d\ufa70-\ufad9\ufb1d\ufb1f\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufb4e\ufff0-\uffff]/g,
q,a=function(a){var c,d={},f=[];for(c=0;65536>c;c++)f.push(String.fromCharCode(c));a.lastIndex=0;f.join("").replace(a,function(a){d[a]="\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4);return""});a.lastIndex=0;return d};m.exports={quote:function(c){c=u.stringify(c);p.lastIndex=0;if(!p.test(c))return c;q||(q=a(p));return c.replace(p,function(a){return q[a]})}}},function(m,f,d){(function(f){var p=function(){};"production"!==f.env.NODE_ENV&&(p=d(9)("sockjs-client:utils:transport"));m.exports=function(d){return{filterToEnabled:function(a,
c){var f={main:[],facade:[]};a?"string"===typeof a&&(a=[a]):a=[];d.forEach(function(d){d&&("websocket"===d.transportName&&!1===c.websocket?p("disabled from server","websocket"):a.length&&-1===a.indexOf(d.transportName)?p("not in whitelist",d.transportName):d.enabled(c)?(p("enabled",d.transportName),f.main.push(d),d.facadeTransport&&f.facade.push(d.facadeTransport)):p("disabled",d.transportName))});return f}}}}).call(f,d(8))},function(m,f,d){(function(d){var f={};["log","debug","warn"].forEach(function(m){try{var a=
d.console&&d.console[m]&&d.console[m].apply}catch(c){}f[m]=a?function(){return d.console[m].apply(d.console,arguments)}:"log"===m?function(){}:f.log});m.exports=f}).call(f,d(7))},function(m,f,d){function u(){p.call(this);this.initEvent("close",!1,!1);this.wasClean=!1;this.code=0;this.reason=""}f=d(4);var p=d(101);f(u,p);m.exports=u},function(m,f,d){function u(d){p.call(this);this.initEvent("message",!1,!1);this.data=d}f=d(4);var p=d(101);f(u,p);m.exports=u},function(m,f,d){(function(f){function p(a,
c){e(a);var b=this;q.call(this);setTimeout(function(){b.doXhr(a,c)},0)}var q=d(13).EventEmitter,a=d(4),c=d(22),n=d(98),u=d(74),t=d(59),l=d(339),k=d(340),g=d(173),e=function(){};"production"!==f.env.NODE_ENV&&(e=d(9)("sockjs-client:info-receiver"));a(p,q);p._getReceiver=function(a,c,d){return d.sameOrigin?new g(c,t):u.enabled?new g(c,u):n.enabled&&d.sameScheme?new g(c,n):k.enabled()?new k(a,c):new g(c,l)};p.prototype.doXhr=function(a,d){var b=this,f=c.addPath(a,"/info");e("doXhr",f);this.xo=p._getReceiver(a,
f,d);this.timeoutRef=setTimeout(function(){e("timeout");b._cleanup(!1);b.emit("finish")},p.timeout);this.xo.once("finish",function(a,c){e("finish",a,c);b._cleanup(!0);b.emit("finish",a,c)})};p.prototype._cleanup=function(a){e("_cleanup");clearTimeout(this.timeoutRef);this.timeoutRef=null;!a&&this.xo&&this.xo.close();this.xo=null};p.prototype.close=function(){e("close");this.removeAllListeners();this._cleanup(!1)};p.timeout=8E3;m.exports=p}).call(f,d(8))},function(m,f,d){function u(){var d=this;p.call(this);
this.to=setTimeout(function(){d.emit("finish",200,"{}")},u.timeout)}var p=d(13).EventEmitter;d(4)(u,p);u.prototype.close=function(){clearTimeout(this.to)};u.timeout=2E3;m.exports=u},function(m,f,d){(function(f,p){function q(c,d){var b=this;a.call(this);var e=function(){var a=b.ifr=new t(l.transportName,d,c);a.once("message",function(a){if(a){try{var c=n.parse(a)}catch(z){k("bad json",a);b.emit("finish");b.close();return}b.emit("finish",c[0],c[1])}b.close()});a.once("close",function(){b.emit("finish");
b.close()})};p.document.body?e():u.attachEvent("load",e)}var a=d(13).EventEmitter,c=d(4),n=d(33),u=d(38),t=d(167),l=d(172),k=function(){};"production"!==f.env.NODE_ENV&&(k=d(9)("sockjs-client:info-iframe"));c(q,a);q.enabled=function(){return t.enabled()};q.prototype.close=function(){this.ifr&&this.ifr.close();this.removeAllListeners();this.ifr=null};m.exports=q}).call(f,d(8),d(7))},function(m,f,d){(function(f){var p=d(22),q=d(38),a=d(33),c=d(342),n=d(172),u=d(61),t=d(171),l=function(){};"production"!==
f.env.NODE_ENV&&(l=d(9)("sockjs-client:iframe-bootstrap"));m.exports=function(d,f){var e={};f.forEach(function(a){a.facadeTransport&&(e[a.facadeTransport.transportName]=a.facadeTransport)});e[n.transportName]=n;var b;d.bootstrap_iframe=function(){var f;u.currentWindowId=t.hash.slice(1);q.attachEvent("message",function(g){if(g.source===parent&&("undefined"===typeof b&&(b=g.origin),g.origin===b)){try{var h=a.parse(g.data)}catch(E){l("bad json",g.data);return}if(h.windowId===u.currentWindowId)switch(h.type){case "s":try{var k=
a.parse(h.data)}catch(E){l("bad json",h.data);break}g=k[0];h=k[1];var n=k[2];k=k[3];l(g,h,n,k);if(g!==d.version)throw Error('Incompatible SockJS! Main site uses: "'+g+'", the iframe: "'+d.version+'".');if(!p.isOriginEqual(n,t.href)||!p.isOriginEqual(k,t.href))throw Error("Can't connect to different domain from within an iframe. ("+t.href+", "+n+", "+k+")");f=new c(new e[h](n,k));break;case "m":f._send(h.data);break;case "c":f&&f._close(),f=null}}});u.postMessage("s")}}}).call(f,d(8))},function(m,
f,d){function u(a){this._transport=a;a.on("message",this._transportMessage.bind(this));a.on("close",this._transportClose.bind(this))}var p=d(33),q=d(61);u.prototype._transportClose=function(a,c){q.postMessage("c",p.stringify([a,c]))};u.prototype._transportMessage=function(a){q.postMessage("t",a)};u.prototype._send=function(a){this._transport.send(a)};u.prototype._close=function(){this._transport.close();this._transport.removeAllListeners()};m.exports=u},function(m,f,d){f.a=function(a){a.registerEventListener(document,
"copy",function(c){if(!Object(u.a)(c)){var d=Object(q.c)(a.state).value;c.clipboardData.setData("text/plain",JSON.stringify(d,void 0,"  "));c.preventDefault()}})};f.b=function(a){a.registerEventListener(document,"paste",function(c){if(!Object(u.a)(c)){var d=c.clipboardData.getData("text/plain").match(/^[\[\]{}()\s,]*(\d+(?:\.\d+)?)[,\s]+(\d+(?:\.\d+)?)[,\s]+(\d+(?:\.\d+)?)[\[\]{}()\s,]*$/);d=null!==d?p.s.fromValues(parseFloat(d[1]),parseFloat(d[2]),parseFloat(d[3])):void 0;void 0!==d&&a.navigationState.position.setVoxelCoordinates(d);
c.preventDefault()}})};var u=d(156),p=d(1),q=d(29)},function(m,f,d){function u(){if(void 0===n){var a=new c.a;a.set("keyl","recolor");a.set("keyx","clear-segments");a.set("keys","toggle-show-slices");a.set("keyb","toggle-scale-bar");a.set("shift+keyb","toggle-default-annotations");a.set("keya","toggle-axis-lines");a.set("keyo","toggle-orthographic-projection");for(var d=1;9>=d;++d)a.set("digit"+d,"toggle-layer-"+d),a.set("control+digit"+d,"select-layer-"+d);a.set("keyn","add-layer");a.set("keyh",
"help");a.set("space","toggle-layout");a.set("shift+space","toggle-layout-alternative");n=a}return n}function p(){void 0===v&&(v=c.a.fromObject({arrowleft:"x-",arrowright:"x+",arrowup:"y-",arrowdown:"y+",comma:"z-",period:"z+",keyz:"snap","control+equal":"zoom-in","control+shift+equal":"zoom-in","control+minus":"zoom-out",keyr:"rotate-relative-z-",keye:"rotate-relative-z+","shift+arrowdown":"rotate-relative-x-","shift+arrowup":"rotate-relative-x+","shift+arrowleft":"rotate-relative-y-","shift+arrowright":"rotate-relative-y+",
"at:control+wheel":{action:"zoom-via-wheel",preventDefault:!0},"at:wheel":{action:"z+1-via-wheel",preventDefault:!0},"at:shift+wheel":{action:"z+10-via-wheel",preventDefault:!0},"at:dblclick0":"select","at:control+mousedown0":"annotate","at:mousedown2":"move-to-mouse-position","at:control+mousedown2":"select-annotation"},{label:"All Data Panels"}));return v}function q(){void 0===t&&(t=c.a.fromObject({"at:mousedown0":{action:"rotate-via-mouse-drag",stopPropagation:!0},"at:shift+mousedown0":{action:"translate-via-mouse-drag",
stopPropagation:!0}},{parents:[[p(),Number.NEGATIVE_INFINITY]]}));return t}function a(){void 0===l&&(l=c.a.fromObject({"at:mousedown0":{action:"translate-via-mouse-drag",stopPropagation:!0},"at:shift+mousedown0":{action:"rotate-via-mouse-drag",stopPropagation:!0}},{parents:[[p(),Number.NEGATIVE_INFINITY]]}));return l}f.a=function(c){c.global.addParent(u(),Number.NEGATIVE_INFINITY);c.sliceView.addParent(a(),Number.NEGATIVE_INFINITY);c.perspectiveView.addParent(q(),Number.NEGATIVE_INFINITY)};var c=
d(20),n,v,t,l},function(m,f,d){f.a=function(c){Object(a.a)();Object(a.b)();try{var d=new p.a(document.getElementById("neuroglancer-container"));return new q.a(d,c)}catch(v){throw u.a.showMessage("Error: "+v.message),v;}};d(347);var u=d(26),p=d(119),q=d(150),a=d(352);d(346)},function(m,f){},function(m,f,d){d(348);d(349)},function(m,f,d){function u(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(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 q(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)}m=d(174);var a=d(19);f=d(28);var c=d(0),n=d(1),v=d(14),t=d(93),l=d(17),k=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)}},g=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=function(a){function b(a,c,d,e){u(this,b);var f=p(this,(b.__proto__||
Object.getPrototypeOf(b)).call(this));f.chunkDataSize=c;f.channelStride=c[0]*c[1]*c[2];Object(t.e)(f,a,d,c[0],c[1],c[2]*e);return f}q(b,a);g(b,null,[{key:"get",value:function(a,c,d,e){return a.memoize.get("sliceview.UncompressedTextureLayout:"+Object(n.t)(c)+","+(d+","+e),function(){return new b(a,c,d,e)})}}]);return b}(c.a),b=function(a){function b(a,c,d,e){u(this,b);a=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,e));a.dataType=c;a.numChannels=d;Object(t.c)(a,c);a.textureAccessHelper=
new t.a("chunkData");return a}q(b,a);g(b,[{key:"defineShader",value:function(a){k(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"defineShader",this).call(this,a);var c=this.textureAccessHelper;c.defineShader(a);a.addFragmentCode(c.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");c=Object(l.a)(this.dataType);a.addFragmentCode("\n"+c+" getDataValue (int channelIndex) {\n  return readVolumeData(getIndexIntoChunk(channelIndex));\n}\n")}},{key:"setupTextureLayout",value:function(a,b,c){1<this.numChannels&&
a.uniform1f(b.uniform("uChannelStride"),c.channelStride);this.textureAccessHelper.setupTextureLayout(a,b,c)}},{key:"getTextureLayout",value:function(a,b){return e.get(a,b,this.texelsPerElement,this.numChannels)}},{key:"setTextureData",value:function(a,b,c){Object(t.f)(a,b,this,c)}}],[{key:"get",value:function(a,c,d){var e="sliceview.UncompressedChunkFormat:"+c+":"+d;return a.memoize.get(e,function(){return new b(a,c,d,e)})}}]);return b}(m.a),h=function(b){function c(){u(this,c);return p(this,(c.__proto__||
Object.getPrototypeOf(c)).apply(this,arguments))}q(c,b);g(c,[{key:"setTextureData",value:function(a){var b=this.source,c=b.chunkFormatHandler,d=c.chunkFormat,e;this.textureLayout=this.chunkDataSize===b.spec.chunkDataSize?e=c.textureLayout.addRef():e=d.getTextureLayout(a,this.chunkDataSize);this.chunkFormat.setTextureData(a,e,this.data)}},{key:"getChannelValueAt",value:function(b,c){var d=this.chunkDataSize;c=b[0]+d[0]*(b[1]+d[1]*(b[2]+d[2]*c));d=this.chunkFormat.dataType;b=this.data;switch(d){case a.a.UINT8:case a.a.FLOAT32:case a.a.UINT16:case a.a.UINT32:return b[c];
case a.a.UINT64:return c*=2,new v.a(b[c],b[c+1])}throw Error("Invalid data type: "+d);}}]);return c}(m.b),r=function(a){function c(a,d){u(this,c);var e=p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));e.chunkFormat=e.registerDisposer(b.get(a,d.dataType,d.numChannels));e.textureLayout=e.registerDisposer(e.chunkFormat.getTextureLayout(a,d.chunkDataSize));return e}q(c,a);g(c,[{key:"getChunk",value:function(a,b){return new h(a,b)}}]);return c}(c.a);Object(f.c)(function(a,b){return null==b.compressedSegmentationBlockSize?
new r(a,b):null})},function(m,f,d){function u(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(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 q(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=d(350),c=d(351);m=d(174);var n=d(19);f=d(28);var v=d(0),t=d(1),l=d(14),k=d(93),g=d(17),e=function x(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 x(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},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}}(),h=function(a){function c(a,b,d,e){u(this,c);var f=p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));f.chunkDataSize=b;f.subchunkSize=d;Object(k.d)(f,a,1,e);a=f.subchunkGridSize=t.s.create();for(e=0;3>e;++e)a[e]=Math.ceil(b[e]/d[e]);return f}q(c,a);b(c,null,[{key:"get",value:function(a,b,d,e){return a.memoize.get("sliceview.CompressedSegmentationTextureLayout:"+
Object(t.t)(b)+","+(Object(t.t)(d)+","+e),function(){return new c(a,b,d,e)})}}]);return c}(v.a),r=Object(k.c)(new k.b,n.a.UINT32),A=function(a){function c(a,b,d,e){u(this,c);e=p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this,e));e.dataType=a;e.subchunkSize=b;e.numChannels=d;e.textureAccessHelper=new k.a("chunkData");return e}q(c,a);b(c,[{key:"defineShader",value:function(a){e(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"defineShader",this).call(this,a);var b=this.textureAccessHelper;
b.defineShader(a);var d=function(a){return"compressedSegmentationChunkFormat_"+a};a.addUniform("highp vec3","uSubchunkGridSize");a.addUniform("highp vec3","uSubchunkSize");a.addFragmentCode(g.g);var f=this.dataType,h=Object(g.a)(f);f===n.a.UINT64&&a.addFragmentCode(g.n);a.addFragmentCode(b.getAccessor(d("readTextureValue"),"uVolumeChunkSampler",n.a.UINT32));a.addFragmentCode(g.q);a.addFragmentCode(g.p);b="\nfloat "+d("getChannelOffset")+"(int channelIndex) {\n  if (channelIndex == 0) {\n    return "+
this.numChannels+".0;\n  }\n  vec4 v = "+d("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 = "+d("getChannelOffset")+"(channelIndex);\n\n  // TODO: Maybe just combine this offset into subchunkGridStrides.\n  float subchunkHeaderOffset = subchunkGridOffset * 2.0 + channelOffset;\n\n  vec4 subchunkHeader0 = "+
d("readTextureValue")+"(subchunkHeaderOffset).value;\n  vec4 subchunkHeader1 = "+d("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 = "+
d("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===n.a.UINT64?"2.0":"1.0")+";\n  }\n  "+h+" result;\n";b=f===n.a.UINT64?b+("\n  result.low = "+d("readTextureValue")+"(outputValueOffset).value;\n  result.high = "+d("readTextureValue")+"(outputValueOffset+1.0).value;\n"):b+("\n  result.value = "+d("readTextureValue")+"(outputValueOffset).value;\n");a.addFragmentCode(b+"\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,c){Object(k.f)(a,b,r,c)}},{key:"getTextureLayout",value:function(a,b,c){return h.get(a,b,this.subchunkSize,c)}},{key:"beginSource",value:function(a,b){e(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"beginSource",this).call(this,a,b);a.uniform3fv(b.uniform("uSubchunkSize"),this.subchunkSize)}}],[{key:"get",value:function(a,b,d,e){var f="sliceview.CompressedSegmentationChunkFormat:"+b+":"+e,g=f+":"+Object(t.t)(d);return a.memoize.get(g,function(){return new c(b,
d,e,f)})}}]);return c}(m.a),y=function(d){function e(){u(this,e);return p(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}q(e,d);b(e,[{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(b,d){var e=this.chunkDataSize,f=this.chunkFormat,g=this.data;d=g[d];if(f.dataType===n.a.UINT64){var h=new l.a;Object(c.a)(h,g,d,e,f.subchunkSize,
b);return h}return Object(a.a)(g,d,e,f.subchunkSize,b)}}]);return e}(m.b),z=function(a){function c(a,b){u(this,c);var d=p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this)),e=b.dataType;if(e!==n.a.UINT64&&e!==n.a.UINT32)throw Error("Unsupported compressed segmentation data type: "+n.a[e]);d.chunkFormat=d.registerDisposer(A.get(a,b.dataType,b.compressedSegmentationBlockSize,b.numChannels));return d}q(c,a);b(c,[{key:"getChunk",value:function(a,b){return new y(a,b)}}]);return c}(v.a);Object(f.c)(function(a,
b){return null!=b.compressedSegmentationBlockSize?new z(a,b):null})},function(m,f,d){f.a=function(d,f,a,c,m){f=Object(u.a)(d,f,a,c,m,1)+f;return d[f]};var u=d(175)},function(m,f,d){f.a=function(d,f,a,c,m,v){a=Object(u.a)(f,a,c,m,v,2)+a;d.low=f[a];d.high=f[a+1];return d};var u=d(175)},function(m,f,d){f.a=function(){return Object(u.c)(document,"contextmenu",function(d){d.preventDefault()})};f.b=function(){return Object(u.c)(document,"wheel",function(d){d.ctrlKey&&d.preventDefault()})};var u=d(0)},function(m,
f,d){function u(a,c){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!c||"object"!==typeof c&&"function"!==typeof c?a:c}function p(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}function q(a){return encodeURI(a).replace(/[!'()*;,]/g,
function(a){return"%"+a.charCodeAt(0).toString(16).toUpperCase()})}d.d(f,"a",function(){return l});m=d(5);var a=d.n(m),c=d(6);m=d(0);var n=d(2),v=d(29),t=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(c,d,b){d&&a(c.prototype,d);b&&a(c,b);return c}}(),l=function(d){function f(d,b){b=void 0===b?200:b;if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");
var e=u(this,(f.__proto__||Object.getPrototypeOf(f)).call(this));e.root=d;e.parseError=new c.f(void 0);e.registerEventListener(window,"hashchange",function(){return e.updateFromUrlHash()});var g=a()(function(){return e.setUrlHash()},b);e.registerDisposer(d.changed.add(g));e.registerDisposer(function(){return g.cancel()});return e}p(f,d);t(f,[{key:"setUrlHash",value:function(){var a=Object(v.c)(this.root);a.generation!==this.prevStateGeneration&&(this.prevStateGeneration=a.generation,a=q(JSON.stringify(a.value)),
a!==this.prevStateString&&(this.prevStateString=a,"{}"===decodeURIComponent(a)?history.replaceState(null,"","#"):history.replaceState(null,"","#!"+a)))}},{key:"updateFromUrlHash",value:function(){try{var a=location.href.replace(/^[^#]+/,"");if(""===a||"#"===a||"#!"===a)a="#!{}";if(a.startsWith("#!+")){a=a.slice(3);a=decodeURIComponent(a);var b=Object(n.h)(a);Object(n.t)(b);this.root.restoreState(b);this.prevStateString=void 0}else if(a.startsWith("#!")){a=a.slice(2);a=decodeURIComponent(a);if(a===
this.prevStateString)return;this.prevStateString=a;this.root.reset();var c=Object(n.h)(a);Object(n.t)(c);this.root.restoreState(c)}else throw Error('URL hash is expected to be of the form "#!{...}" or "#!+{...}".');this.parseError.value=void 0}catch(r){this.parseError.value=r}}}]);return f}(m.a)}]);
