/*

 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(n,e,c){n!=Array.prototype&&n!=Object.prototype&&(n[e]=c.value)};$jscomp.getGlobal=function(n){return"undefined"!=typeof window&&window===n?n:"undefined"!=typeof global&&null!=global?global:n};$jscomp.global=$jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX="jscomp_symbol_";
$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.symbolCounter_=0;$jscomp.Symbol=function(n){return $jscomp.SYMBOL_PREFIX+(n||"")+$jscomp.symbolCounter_++};
$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var n=$jscomp.global.Symbol.iterator;n||(n=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[n]&&$jscomp.defineProperty(Array.prototype,n,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}};$jscomp.arrayIterator=function(n){var e=0;return $jscomp.iteratorPrototype(function(){return e<n.length?{done:!1,value:n[e++]}:{done:!0}})};
$jscomp.iteratorPrototype=function(n){$jscomp.initSymbolIterator();n={next:n};n[$jscomp.global.Symbol.iterator]=function(){return this};return n};$jscomp.makeIterator=function(n){$jscomp.initSymbolIterator();$jscomp.initSymbol();$jscomp.initSymbolIterator();var e=n[Symbol.iterator];return e?e.call(n):$jscomp.arrayIterator(n)};$jscomp.arrayFromIterator=function(n){for(var e,c=[];!(e=n.next()).done;)c.push(e.value);return c};$jscomp.arrayFromIterable=function(n){return n instanceof Array?n:$jscomp.arrayFromIterator($jscomp.makeIterator(n))};
$jscomp.polyfill=function(n,e,c,p){if(e){c=$jscomp.global;n=n.split(".");for(p=0;p<n.length-1;p++){var h=n[p];h in c||(c[h]={});c=c[h]}n=n[n.length-1];p=c[n];e=e(p);e!=p&&null!=e&&$jscomp.defineProperty(c,n,{configurable:!0,writable:!0,value:e})}};$jscomp.polyfill("Number.isNaN",function(n){return n?n:function(e){return"number"===typeof e&&isNaN(e)}},"es6","es3");
$jscomp.polyfill("Number.isFinite",function(n){return n?n:function(e){return"number"!==typeof e?!1:!isNaN(e)&&Infinity!==e&&-Infinity!==e}},"es6","es3");$jscomp.iteratorFromArray=function(n,e){$jscomp.initSymbolIterator();n instanceof String&&(n+="");var c=0,p={next:function(){if(c<n.length){var h=c++;return{value:e(h,n[h]),done:!1}}p.next=function(){return{done:!0,value:void 0}};return p.next()}};p[Symbol.iterator]=function(){return p};return p};
$jscomp.polyfill("Array.prototype.keys",function(n){return n?n:function(){return $jscomp.iteratorFromArray(this,function(e){return e})}},"es6","es3");$jscomp.polyfill("Number.isInteger",function(n){return n?n:function(e){return Number.isFinite(e)?e===Math.floor(e):!1}},"es6","es3");
$jscomp.polyfill("Array.from",function(n){return n?n:function(e,c,p){$jscomp.initSymbolIterator();c=null!=c?c:function(a){return a};var h=[],r=e[Symbol.iterator];if("function"==typeof r)for(e=r.call(e);!(r=e.next()).done;)h.push(c.call(p,r.value));else{r=e.length;for(var a=0;a<r;a++)h.push(c.call(p,e[a]))}return h}},"es6","es3");$jscomp.owns=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)};
$jscomp.polyfill("WeakMap",function(n){function e(a){$jscomp.owns(a,p)||$jscomp.defineProperty(a,p,{value:{}})}function c(a){var b=Object[a];b&&(Object[a]=function(a){e(a);return b(a)})}if(function(){if(!n||!Object.seal)return!1;try{var a=Object.seal({}),b=Object.seal({}),c=new n([[a,2],[b,3]]);if(2!=c.get(a)||3!=c.get(b))return!1;c.delete(a);c.set(b,4);return!c.has(a)&&4==c.get(b)}catch(w){return!1}}())return n;var p="$jscomp_hidden_"+Math.random().toString().substring(2);c("freeze");c("preventExtensions");
c("seal");var h=0,r=function(a){this.id_=(h+=Math.random()+1).toString();if(a){$jscomp.initSymbol();$jscomp.initSymbolIterator();a=$jscomp.makeIterator(a);for(var b;!(b=a.next()).done;)b=b.value,this.set(b[0],b[1])}};r.prototype.set=function(a,b){e(a);if(!$jscomp.owns(a,p))throw Error("WeakMap key fail: "+a);a[p][this.id_]=b;return this};r.prototype.get=function(a){return $jscomp.owns(a,p)?a[p][this.id_]:void 0};r.prototype.has=function(a){return $jscomp.owns(a,p)&&$jscomp.owns(a[p],this.id_)};r.prototype.delete=
function(a){return $jscomp.owns(a,p)&&$jscomp.owns(a[p],this.id_)?delete a[p][this.id_]:!1};return r},"es6","es3");$jscomp.MapEntry=function(){};
$jscomp.polyfill("Map",function(n){if(!$jscomp.ASSUME_NO_NATIVE_MAP&&function(){if(!n||!n.prototype.entries||"function"!=typeof Object.seal)return!1;try{var a=Object.seal({x:4}),c=new n($jscomp.makeIterator([[a,"s"]]));if("s"!=c.get(a)||1!=c.size||c.get({x:4})||c.set({x:4},"t")!=c||2!=c.size)return!1;var e=c.entries(),v=e.next();if(v.done||v.value[0]!=a||"s"!=v.value[1])return!1;v=e.next();return v.done||4!=v.value[0].x||"t"!=v.value[1]||!e.next().done?!1:!0}catch(t){return!1}}())return n;$jscomp.initSymbol();
$jscomp.initSymbolIterator();var e=new WeakMap,c=function(a){this.data_={};this.head_=r();this.size=0;if(a){a=$jscomp.makeIterator(a);for(var b;!(b=a.next()).done;)b=b.value,this.set(b[0],b[1])}};c.prototype.set=function(a,c){var b=p(this,a);b.list||(b.list=this.data_[b.id]=[]);b.entry?b.entry.value=c:(b.entry={next:this.head_,previous:this.head_.previous,head:this.head_,key:a,value:c},b.list.push(b.entry),this.head_.previous.next=b.entry,this.head_.previous=b.entry,this.size++);return this};c.prototype.delete=
function(a){a=p(this,a);return a.entry&&a.list?(a.list.splice(a.index,1),a.list.length||delete this.data_[a.id],a.entry.previous.next=a.entry.next,a.entry.next.previous=a.entry.previous,a.entry.head=null,this.size--,!0):!1};c.prototype.clear=function(){this.data_={};this.head_=this.head_.previous=r();this.size=0};c.prototype.has=function(a){return!!p(this,a).entry};c.prototype.get=function(a){return(a=p(this,a).entry)&&a.value};c.prototype.entries=function(){return h(this,function(a){return[a.key,
a.value]})};c.prototype.keys=function(){return h(this,function(a){return a.key})};c.prototype.values=function(){return h(this,function(a){return a.value})};c.prototype.forEach=function(a,c){for(var b=this.entries(),l;!(l=b.next()).done;)l=l.value,a.call(c,l[1],l[0],this)};c.prototype[Symbol.iterator]=c.prototype.entries;var p=function(b,c){var l=c&&typeof c;"object"==l||"function"==l?e.has(c)?l=e.get(c):(l=""+ ++a,e.set(c,l)):l="p_"+c;var v=b.data_[l];if(v&&$jscomp.owns(b.data_,l))for(b=0;b<v.length;b++){var t=
v[b];if(c!==c&&t.key!==t.key||c===t.key)return{id:l,list:v,index:b,entry:t}}return{id:l,list:v,index:-1,entry:void 0}},h=function(a,c){var b=a.head_;return $jscomp.iteratorPrototype(function(){if(b){for(;b.head!=a.head_;)b=b.previous;for(;b.next!=b.head;)return b=b.next,{done:!1,value:c(b)};b=null}return{done:!0,value:void 0}})},r=function(){var a={};return a.previous=a.next=a.head=a},a=0;return c},"es6","es3");
$jscomp.checkStringArgs=function(n,e,c){if(null==n)throw new TypeError("The 'this' value for String.prototype."+c+" must not be null or undefined");if(e instanceof RegExp)throw new TypeError("First argument to String.prototype."+c+" must not be a regular expression");return n+""};
$jscomp.polyfill("String.prototype.startsWith",function(n){return n?n:function(e,c){var p=$jscomp.checkStringArgs(this,e,"startsWith");e+="";var h=p.length,r=e.length;c=Math.max(0,Math.min(c|0,p.length));for(var a=0;a<r&&c<h;)if(p[c++]!=e[a++])return!1;return a>=r}},"es6","es3");
$jscomp.polyfill("Set",function(n){if(!$jscomp.ASSUME_NO_NATIVE_SET&&function(){if(!n||!n.prototype.entries||"function"!=typeof Object.seal)return!1;try{var c=Object.seal({x:4}),e=new n($jscomp.makeIterator([c]));if(!e.has(c)||1!=e.size||e.add(c)!=e||1!=e.size||e.add({x:4})!=e||2!=e.size)return!1;var h=e.entries(),r=h.next();if(r.done||r.value[0]!=c||r.value[1]!=c)return!1;r=h.next();return r.done||r.value[0]==c||4!=r.value[0].x||r.value[1]!=r.value[0]?!1:h.next().done}catch(a){return!1}}())return n;
$jscomp.initSymbol();$jscomp.initSymbolIterator();var e=function(c){this.map_=new Map;if(c){c=$jscomp.makeIterator(c);for(var e;!(e=c.next()).done;)this.add(e.value)}this.size=this.map_.size};e.prototype.add=function(c){this.map_.set(c,c);this.size=this.map_.size;return this};e.prototype.delete=function(c){c=this.map_.delete(c);this.size=this.map_.size;return c};e.prototype.clear=function(){this.map_.clear();this.size=0};e.prototype.has=function(c){return this.map_.has(c)};e.prototype.entries=function(){return this.map_.entries()};
e.prototype.values=function(){return this.map_.values()};e.prototype.keys=e.prototype.values;e.prototype[Symbol.iterator]=e.prototype.values;e.prototype.forEach=function(c,e){var h=this;this.map_.forEach(function(r){return c.call(e,r,r,h)})};return e},"es6","es3");$jscomp.polyfill("Object.assign",function(n){return n?n:function(e,c){for(var p=1;p<arguments.length;p++){var h=arguments[p];if(h)for(var r in h)$jscomp.owns(h,r)&&(e[r]=h[r])}return e}},"es6","es3");$jscomp.FORCE_POLYFILL_PROMISE=!1;
$jscomp.polyfill("Promise",function(n){function e(){this.batch_=null}function c(a){return a instanceof h?a:new h(function(b,c){b(a)})}if(n&&!$jscomp.FORCE_POLYFILL_PROMISE)return n;e.prototype.asyncExecute=function(a){null==this.batch_&&(this.batch_=[],this.asyncExecuteBatch_());this.batch_.push(a);return this};e.prototype.asyncExecuteBatch_=function(){var a=this;this.asyncExecuteFunction(function(){a.executeBatch_()})};var p=$jscomp.global.setTimeout;e.prototype.asyncExecuteFunction=function(a){p(a,
0)};e.prototype.executeBatch_=function(){for(;this.batch_&&this.batch_.length;){var a=this.batch_;this.batch_=[];for(var b=0;b<a.length;++b){var c=a[b];delete a[b];try{c()}catch(w){this.asyncThrow_(w)}}}this.batch_=null};e.prototype.asyncThrow_=function(a){this.asyncExecuteFunction(function(){throw a;})};var h=function(a){this.state_=0;this.result_=void 0;this.onSettledCallbacks_=[];var b=this.createResolveAndReject_();try{a(b.resolve,b.reject)}catch(l){b.reject(l)}};h.prototype.createResolveAndReject_=
function(){function a(a){return function(l){c||(c=!0,a.call(b,l))}}var b=this,c=!1;return{resolve:a(this.resolveTo_),reject:a(this.reject_)}};h.prototype.resolveTo_=function(a){if(a===this)this.reject_(new TypeError("A Promise cannot resolve to itself"));else if(a instanceof h)this.settleSameAsPromise_(a);else{a:switch(typeof a){case "object":var b=null!=a;break a;case "function":b=!0;break a;default:b=!1}b?this.resolveToNonPromiseObj_(a):this.fulfill_(a)}};h.prototype.resolveToNonPromiseObj_=function(a){var b=
void 0;try{b=a.then}catch(l){this.reject_(l);return}"function"==typeof b?this.settleSameAsThenable_(b,a):this.fulfill_(a)};h.prototype.reject_=function(a){this.settle_(2,a)};h.prototype.fulfill_=function(a){this.settle_(1,a)};h.prototype.settle_=function(a,b){if(0!=this.state_)throw Error("Cannot settle("+a+", "+b|"): Promise already settled in state"+this.state_);this.state_=a;this.result_=b;this.executeOnSettledCallbacks_()};h.prototype.executeOnSettledCallbacks_=function(){if(null!=this.onSettledCallbacks_){for(var a=
this.onSettledCallbacks_,b=0;b<a.length;++b)a[b].call(),a[b]=null;this.onSettledCallbacks_=null}};var r=new e;h.prototype.settleSameAsPromise_=function(a){var b=this.createResolveAndReject_();a.callWhenSettled_(b.resolve,b.reject)};h.prototype.settleSameAsThenable_=function(a,b){var c=this.createResolveAndReject_();try{a.call(b,c.resolve,c.reject)}catch(w){c.reject(w)}};h.prototype.then=function(a,b){function c(a,b){return"function"==typeof a?function(b){try{e(a(b))}catch(d){v(d)}}:b}var e,v,t=new h(function(a,
b){e=a;v=b});this.callWhenSettled_(c(a,e),c(b,v));return t};h.prototype.catch=function(a){return this.then(void 0,a)};h.prototype.callWhenSettled_=function(a,b){function c(){switch(e.state_){case 1:a(e.result_);break;case 2:b(e.result_);break;default:throw Error("Unexpected state: "+e.state_);}}var e=this;null==this.onSettledCallbacks_?r.asyncExecute(c):this.onSettledCallbacks_.push(function(){r.asyncExecute(c)})};h.resolve=c;h.reject=function(a){return new h(function(b,c){c(a)})};h.race=function(a){return new h(function(b,
l){for(var e=$jscomp.makeIterator(a),v=e.next();!v.done;v=e.next())c(v.value).callWhenSettled_(b,l)})};h.all=function(a){var b=$jscomp.makeIterator(a),l=b.next();return l.done?c([]):new h(function(a,e){function t(b){return function(d){q[b]=d;m--;0==m&&a(q)}}var q=[],m=0;do q.push(void 0),m++,c(l.value).callWhenSettled_(t(q.length-1),e),l=b.next();while(!l.done)})};return h},"es6","es3");$jscomp.polyfill("Math.log2",function(n){return n?n:function(e){return Math.log(e)/Math.LN2}},"es6","es3");
$jscomp.polyfill("String.prototype.repeat",function(n){return n?n:function(e){var c=$jscomp.checkStringArgs(this,null,"repeat");if(0>e||1342177279<e)throw new RangeError("Invalid count value");e|=0;for(var p="";e;)if(e&1&&(p+=c),e>>>=1)c+=c;return p}},"es6","es3");
$jscomp.polyfill("WeakSet",function(n){if(function(){if(!n||!Object.seal)return!1;try{var c=Object.seal({}),e=Object.seal({}),h=new n([c]);if(!h.has(c)||h.has(e))return!1;h.delete(c);h.add(e);return!h.has(c)&&h.has(e)}catch(r){return!1}}())return n;var e=function(c){this.map_=new WeakMap;if(c){$jscomp.initSymbol();$jscomp.initSymbolIterator();c=$jscomp.makeIterator(c);for(var e;!(e=c.next()).done;)this.add(e.value)}};e.prototype.add=function(c){this.map_.set(c,!0);return this};e.prototype.has=function(c){return this.map_.has(c)};
e.prototype.delete=function(c){return this.map_.delete(c)};return e},"es6","es3");$jscomp.findInternal=function(n,e,c){n instanceof String&&(n=String(n));for(var p=n.length,h=0;h<p;h++){var r=n[h];if(e.call(c,r,h,n))return{i:h,v:r}}return{i:-1,v:void 0}};$jscomp.polyfill("Array.prototype.find",function(n){return n?n:function(e,c){return $jscomp.findInternal(this,e,c).v}},"es6","es3");
$jscomp.polyfill("Array.prototype.values",function(n){return n?n:function(){return $jscomp.iteratorFromArray(this,function(e,c){return c})}},"es6","es3");$jscomp.polyfill("Math.sign",function(n){return n?n:function(e){e=Number(e);return 0===e||isNaN(e)?e:0<e?1:-1}},"es6","es3");$jscomp.polyfill("Array.prototype.entries",function(n){return n?n:function(){return $jscomp.iteratorFromArray(this,function(e,c){return[e,c]})}},"es6","es3");
$jscomp.polyfill("Array.prototype.fill",function(n){return n?n:function(e,c,p){var h=this.length||0;0>c&&(c=Math.max(0,h+c));if(null==p||p>h)p=h;p=Number(p);0>p&&(p=Math.max(0,h+p));for(c=Number(c||0);c<p;c++)this[c]=e;return this}},"es6","es3");
$jscomp.polyfill("Array.prototype.copyWithin",function(n){return n?n:function(e,c,p){var h=this.length;e=Number(e);c=Number(c);p=Number(null!=p?p:h);if(e<c)for(p=Math.min(p,h);c<p;)c in this?this[e++]=this[c++]:(delete this[e++],c++);else for(p=Math.min(p,h+c-e),e+=p-c;p>c;)--p in this?this[--e]=this[p]:delete this[e];return this}},"es6","es3");
(function(n){function e(p){if(c[p])return c[p].exports;var h=c[p]={i:p,l:!1,exports:{}};n[p].call(h.exports,h,h.exports,e);h.l=!0;return h.exports}var c={};e.m=n;e.c=c;e.d=function(c,h,r){e.o(c,h)||Object.defineProperty(c,h,{configurable:!1,enumerable:!0,get:r})};e.n=function(c){var h=c&&c.__esModule?function(){return c["default"]}:function(){return c};e.d(h,"a",h);return h};e.o=function(c,e){return Object.prototype.hasOwnProperty.call(c,e)};e.p="";return e(e.s=147)})([function(n,e,c){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 h(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function r(a,b,c,q){a.addEventListener(b,c,q);return function(){return a.removeEventListener(b,c,q)}}c.d(e,
"c",function(){return r});c.d(e,"a",function(){return b});c.d(e,"b",function(){return l});var a=function(){function a(a,b){for(var c=0;c<b.length;c++){var m=b[c];m.enumerable=m.enumerable||!1;m.configurable=!0;"value"in m&&(m.writable=!0);Object.defineProperty(a,m.key,m)}}return function(b,c,q){c&&a(b.prototype,c);q&&a(b,q);return b}}(),b=function(){function b(){h(this,b);this.refCount=1}a(b,[{key:"addRef",value:function(){++this.refCount;return this}},{key:"dispose",value:function(){0===--this.refCount&&
this.refCountReachedZero()}},{key:"refCountReachedZero",value:function(){this.disposed();var a=this.disposers;if(null!=a){for(var b=a.length;0<b;--b){var c=a[b-1];"object"===typeof c?c.dispose():c.call(this)}this.disposers=void 0}this.wasDisposed=!0}},{key:"disposed",value:function(){}},{key:"registerDisposer",value:function(a){var b=this.disposers;null==b?this.disposers=[a]:b.push(a);return a}},{key:"unregisterDisposer",value:function(a){var b=this.disposers;if(null!=b){var c=b.indexOf(a);-1!==c&&
b.splice(c,1)}return a}},{key:"registerEventListener",value:function(a,b,c,m){this.registerDisposer(r(a,b,c,m))}},{key:"registerCancellable",value:function(a){this.registerDisposer(function(){a.cancel()});return a}}]);return b}(),l=function(a){function b(a){h(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.value=a;return c}p(b,a);
return b}(b)},function(n,e,c){function p(a,b){var c=Math.abs(a[b]),e=Math.abs(a[b+1]),v=Math.abs(a[b+2]),t=Math.max(c,e,v);1E-4>c/t&&(a[b]=0);1E-4>e/t&&(a[b+1]=0);1E-4>v/t&&(a[b+2]=0)}c.d(e,"b",function(){return r});e.k=function(a){return a[0]*a[1]*a[2]};e.q=function(a){return a[0]+","+a[1]+","+a[2]};e.m=function(a){p(a,0);p(a,4);p(a,8)};e.n=function(a,b,c){var l=b[0],e=b[1];b=b[2];a[0]=c[0]*l+c[4]*e+c[8]*b;a[1]=c[1]*l+c[5]*e+c[9]*b;a[2]=c[2]*l+c[6]*e+c[10]*b;return a};e.c=function(a,b){var c=b[0],
e=b[1],v=b[2],t=b[4],q=b[5],m=b[6],g=b[8],d=b[9];b=b[10];a[0]=Math.sqrt(c*c+e*e+v*v);a[1]=Math.sqrt(t*t+q*q+m*m);a[2]=Math.sqrt(g*g+d*d+b*b);return a};e.o=function(a,b,c,e,v){a[0]=e[0];a[1]=e[1];a[2]=e[2]*v;return h.b.fromRotationTranslationScale(a,c,b,a)};var h=c(87);n=c(19);c.d(e,"i",function(){return h.a});c.d(e,"j",function(){return h.b});c.d(e,"l",function(){return h.c});c.d(e,"p",function(){return h.d});c.d(e,"r",function(){return h.e});c=h.b.create();e.d=c;e.a=["x","y","z"];var r=function b(c,
e){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");this.lower=c;this.upper=e};c=[h.d.fromValues(1,0,0),h.d.fromValues(0,1,0),h.d.fromValues(0,0,1)];e.e=c;c=h.d.fromValues(0,0,0);e.h=c;c=h.d.fromValues(1,1,1);e.g=c;c=h.d.fromValues(Infinity,Infinity,Infinity);e.f=c;h.c.create();new n.a(1227133513,306783378);new n.a(3272356035,818089008);new n.a(251719695,4027515120);new n.a(4278190335,16711680);new n.a(65535,16711680);new n.a(2097151,0)},function(n,e,c){function p(d){var a=
typeof d;if("number"===a||"string"===a)if(a=parseFloat(""+d),!Number.isNaN(a))return a;throw Error("Expected floating-point number, but received: "+JSON.stringify(d)+".");}function h(d){d=p(d);if(Number.isFinite(d))return d;throw Error("Expected finite floating-point number, but received: "+d+".");}function r(d){d=h(d);if(0<d)return d;throw Error("Expected positive finite floating-point number, but received: "+d+".");}function a(d){if("object"===typeof d){if(null===d)return"null";if(Array.isArray(d)){var f=
"[",b=d.length,g=0;if(g<b)for(f+=a(d[g]);++g<b;)f+=",",f+=a(d[g]);return f+"]"}f="{";b=Object.keys(d).sort();g=0;var c=b.length;if(g<c){var k=b[g];f+=JSON.stringify(k);for(f=f+":"+a(d[k]);++g<c;)f+=",",k=b[g],f+=JSON.stringify(k),f+=":",f+=a(d[k])}return f+"}"}return JSON.stringify(d)}function b(d){return d.replace(/['"]/g,function(d){return'"'===d?"'":'"'})}function l(d){if("object"===typeof d){if(null===d)return"null";var a=d.toJSON;if("function"===typeof a)return l(a.call(d));if(Array.isArray(d)){a=
"[";var f=d.length,g=0;if(g<f)for(a+=l(d[g]);++g<f;)a+="_",a+=l(d[g]);return a+"]"}a="{";g=Object.keys(d);f=!0;g=$jscomp.makeIterator(g);for(var c=g.next();!c.done;c=g.next()){c=c.value;var k=d[c];void 0!==k&&(k=l(k))&&(f?f=!1:a+="_",a+=b(JSON.stringify(b(c))),a+=":",a+=k)}return a+"}"}return"string"===typeof d?b(JSON.stringify(b(d))):JSON.stringify(d)}function w(d,a,f){var b=/[&_,]/g;if('"'===f){var g="'";var c=B;var m=k}else g='"',c=E,m=x;for(var q="";0<d.length;){var l=d.match(m);if(null===l){var t=
d;l=d=""}else{t=d.substr(0,l.index);d=d.substr(l.index+l[0].length);var e=l[1];if(void 0!==e){var v=e,w=g;l=f;e=c;if(2<=v.length&&v.charAt(0)===w&&v.charAt(v.length-1)===w){v=v.substr(1,v.length-2);for(w=l;0<v.length;){var y=v.match(e);if(null===y){w+=v;break}w+=y[1];w+="\\";w+=l;v=v.substr(y.index+y[0].length)}l=w+l}else l=v}else l=l[2]}q+=t.replace(b,a);q+=l}return q}function v(d){return JSON.parse(w(d,",",'"'))}function t(d,a,f){var b=d.length;if(!Array.isArray(a)||a.length!==b)throw Error("Expected length "+
b+" array, but received: "+JSON.stringify(a)+".");for(var g=0;g<b;++g)d[g]=f(a[g],g);return d}function q(d){if("object"!==typeof d||null==d||Array.isArray(d))throw Error("Expected JSON object, but received: "+JSON.stringify(d)+".");return d}function m(d){var a=parseInt(d,10);if(!Number.isInteger(a))throw Error("Expected integer, but received: "+JSON.stringify(d)+".");return a}function g(d){d=m(d);if(0>=d)throw Error("Expected positive integer, but received: "+d+".");return d}function d(d){if("string"!==
typeof d)throw Error("Expected string, but received: "+JSON.stringify(d)+".");return d}e.q=p;e.o=h;e.p=r;e.f=function(d,a,f){f=void 0===f?p:f;q(a);var b=Object.keys(a);b.sort();if(3!==b.length||"x"!==b[0]||"y"!==b[1]||"z"!==b[2])throw Error("Expected object to have keys ['x', 'y', 'z'], but received: "+JSON.stringify(a)+".");d[0]=f(a.x);d[1]=f(a.y);d[2]=f(a.z);return d};e.b=function(d,a){var f=d.length;if(!Array.isArray(a)||a.length!==f)throw Error("Incompatible sizes");for(var b=0;b<f;++b)if(!Number.isFinite(parseFloat(a[b])))throw Error("Non-finite value.");
for(b=0;b<f;++b)d[b]=parseFloat(a[b]);return d};e.d=function(d,a){var f=d.length;if(!Array.isArray(a)||a.length!==f)throw Error("Incompatible sizes.");for(var b=0;b<f;++b){var g=parseInt(a[b],void 0);if(!Number.isInteger(g))throw Error("Non-integer value.");}for(b=0;b<f;++b)d[b]=parseInt(a[b],void 0);return d};e.g=a;e.i=l;e.h=v;e.a=function(d,a){if(!Array.isArray(d))throw Error("Expected array, but received: "+JSON.stringify(d)+".");return d.map(a)};e.c=t;e.u=q;e.s=m;e.A=g;e.t=function(d,a){var f=
a.get(d);if(void 0===f)throw Error("Expected one of "+JSON.stringify(Array.from(a.keys()))+", "+("but received: "+JSON.stringify(d)+"."));return f};e.B=d;e.z=function(a){if(void 0!==a)return d(a)};e.y=function(d){if(void 0!==d)return m(d)};e.x=function(d){if(void 0!==d){if("boolean"===typeof d)return d;if("true"===d)return!0;if("false"===d)return!1;throw Error("Expected string or boolean but received: "+JSON.stringify(d));}};e.w=function(d,a,f){d=d.hasOwnProperty(a)?d[a]:void 0;try{return f(d)}catch(A){throw Error("Error parsing "+
JSON.stringify(a)+" property: "+A.message);}};e.v=function(d,a){q(d);for(var f=new Map,b=$jscomp.makeIterator(Object.keys(d)),g=b.next();!g.done;g=b.next()){g=g.value;try{f.set(g,a(d[g]))}catch(D){throw Error("Error parsing value associated with key "+JSON.stringify(g)+": "+D.message);}}return f};e.r=function(d){if("number"!==typeof d||!Number.isFinite(d)||0>d||1<d)throw Error("Expected floating point number in [0,1], but received: "+JSON.stringify(d)+".");return d};e.e=function(d){if(""===d)return{};
if(d.startsWith("{"))return v(d);var a={};d=d.split(/[&;]/);d=$jscomp.makeIterator(d);for(var f=d.next();!f.done;f=d.next()){f=f.value;var b=f.match(/^([^=&;]+)=([^&;]*)$/);if(null===b)throw Error("Invalid query string part: "+JSON.stringify(f)+".");a[b[1]]=decodeURIComponent(b[2])}return a};e.n=function(d,a){if("string"===typeof d&&null!==d.match(/^[a-zA-Z]/)&&(d=d.toUpperCase(),a.hasOwnProperty(d)))return a[d];throw Error("Invalid enum value: "+JSON.stringify(d)+".");};e.l=function(d){return t(f.p.create(),
d,h)};e.k=function(d){return t(f.p.create(),d,r)};e.j=function(d){return t(f.p.create(),d,g)};e.C=function(d){if(!Array.isArray(d))throw Error("Expected array, received: "+JSON.stringify(d)+".");for(var a=$jscomp.makeIterator(d),f=a.next();!f.done;f=a.next())if(f=f.value,"string"!==typeof f)throw Error("Expected string, received: "+JSON.stringify(f)+".");return d};e.m=function(d){if("boolean"!==typeof d)throw Error("Expected boolean, received: "+JSON.stringify(d));return d};var f=c(1);n=/('(?:[^'\\]|(?:\\.))*')/;
e=/("(?:[^'\\]|(?:\\.))*")/;var k=new RegExp(n.source+"|"+e.source),x=new RegExp(e.source+"|"+n.source),B=/^((?:[^"'\\]|(?:\\.))*)"/,E=/^((?:[^"'\\]|(?:\\.))*)'/},function(n,e,c){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 h(a,
b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}c.d(e,"b",function(){return a});c.d(e,"a",function(){return b});var r=function(){function a(a,b){for(var c=0;c<b.length;c++){var q=b[c];q.enumerable=q.enumerable||!1;q.configurable=!0;"value"in q&&(q.writable=!0);Object.defineProperty(a,q.key,q)}}return function(b,c,l){c&&a(b.prototype,c);l&&a(b,l);return b}}(),a=function(){function a(){h(this,a);this.handlers=new Set;this.count=0;var b=this;this.dispatch=function(){var a=
this,c=arguments;++b.count;b.handlers.forEach(function(b){b.apply(a,c)})}}r(a,[{key:"add",value:function(a){var b=this;this.handlers.add(a);return function(){return b.remove(a)}}},{key:"remove",value:function(a){return this.handlers.delete(a)}},{key:"dispose",value:function(){this.handlers=void 0}}]);return a}(),b=function(a){function b(){h(this,b);var a=(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!a||"object"!==typeof a&&"function"!==typeof a?this:a}p(b,a);return b}(a)},function(n,e){n.exports="function"===typeof Object.create?function(c,e){c.super_=e;c.prototype=Object.create(e.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}})}:function(c,e){c.super_=e;var h=function(){};h.prototype=e.prototype;c.prototype=new h;c.prototype.constructor=c}},function(n,e){e=function(){return this}();try{e=e||Function("return this")()||(0,eval)("this")}catch(c){"object"===typeof window&&
(e=window)}n.exports=e},function(n,e){function c(){throw Error("setTimeout has not been defined");}function p(){throw Error("clearTimeout has not been defined");}function h(d){if(v===setTimeout)return setTimeout(d,0);if((v===c||!v)&&setTimeout)return v=setTimeout,setTimeout(d,0);try{return v(d,0)}catch(k){try{return v.call(null,d,0)}catch(x){return v.call(this,d,0)}}}function r(d){if(t===clearTimeout)return clearTimeout(d);if((t===p||!t)&&clearTimeout)return t=clearTimeout,clearTimeout(d);try{return t(d)}catch(k){try{return t.call(null,
d)}catch(x){return t.call(this,d)}}}function a(){m&&g&&(m=!1,g.length?q=g.concat(q):d=-1,q.length&&b())}function b(){if(!m){var f=h(a);m=!0;for(var b=q.length;b;){g=q;for(q=[];++d<b;)g&&g[d].run();d=-1;b=q.length}g=null;m=!1;r(f)}}function l(d,a){this.fun=d;this.array=a}function w(){}n=n.exports={};try{var v="function"===typeof setTimeout?setTimeout:c}catch(f){v=c}try{var t="function"===typeof clearTimeout?clearTimeout:p}catch(f){t=p}var q=[],m=!1,g,d=-1;n.nextTick=function(d){var a=Array(arguments.length-
1);if(1<arguments.length)for(var f=1;f<arguments.length;f++)a[f-1]=arguments[f];q.push(new l(d,a));1!==q.length||m||h(b)};l.prototype.run=function(){this.fun.apply(null,this.array)};n.title="browser";n.browser=!0;n.env={};n.argv=[];n.version="";n.versions={};n.on=w;n.addListener=w;n.once=w;n.off=w;n.removeListener=w;n.removeAllListeners=w;n.emit=w;n.prependListener=w;n.prependOnceListener=w;n.listeners=function(d){return[]};n.binding=function(d){throw Error("process.binding is not supported");};n.cwd=
function(){return"/"};n.chdir=function(d){throw Error("process.chdir is not supported");};n.umask=function(){return 0}},function(n,e,c){(function(p){function h(){try{var a=e.storage.debug}catch(l){}!a&&"undefined"!==typeof p&&"env"in p&&(a=p.env.DEBUG);return a}e=n.exports=c(243);e.log=function(){return"object"===typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)};e.formatArgs=function(a){var b=this.useColors;a[0]=(b?"%c":"")+this.namespace+(b?" %c":" ")+a[0]+
(b?"%c ":" ")+"+"+e.humanize(this.diff);if(b){b="color: "+this.color;a.splice(1,0,b,"color: inherit");var c=0,v=0;a[0].replace(/%[a-zA-Z%]/g,function(a){"%%"!==a&&(c++,"%c"===a&&(v=c))});a.splice(v,0,b)}};e.save=function(a){try{null==a?e.storage.removeItem("debug"):e.storage.debug=a}catch(l){}};e.load=h;e.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 r=e;if("undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage)var a=
chrome.storage.local;else a:{try{a=window.localStorage;break a}catch(b){}a=void 0}r.storage=a;e.colors="lightseagreen forestgreen goldenrod dodgerblue darkorchid crimson".split(" ");e.formatters.j=function(a){try{return JSON.stringify(a)}catch(l){return"[UnexpectedJSONParseError]: "+l.message}};e.enable(h())}).call(e,c(6))},function(n,e,c){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 h(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 r(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}c.d(e,"b",function(){return l});c.d(e,"a",function(){return w});e.c=function(a,b){for(var c=
[],g=1;g<arguments.length;++g)c[g-1]=arguments[g];return new v(a,c)};n=c(0);var a=c(3),b=function(){function a(a,b){for(var g=0;g<b.length;g++){var d=b[g];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,g){c&&a(b.prototype,c);g&&a(b,g);return b}}(),l=function(){function c(b){r(this,c);this.value_=b;this.changed=new a.a}b(c,[{key:"value",get:function(){return this.value_},set:function(a){a!==this.value_&&(this.value_=
a,this.changed.dispatch())}}]);return c}(),w=function(a){function c(a,b,d){d=void 0===d?a:d;r(this,c);a=p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this,a));a.validator=b;a.defaultValue=d;return a}h(c,a);b(c,[{key:"toJSON",value:function(){if(this.value_!==this.defaultValue)return this.value_}},{key:"reset",value:function(){this.value=this.defaultValue}},{key:"restoreState",value:function(a){if(void 0!==a){var b=this.validator;try{this.value=b(a);return}catch(d){}}this.value=this.defaultValue}}]);
return c}(l),v=function(c){function q(b,g){r(this,q);var d=p(this,(q.__proto__||Object.getPrototypeOf(q)).call(this));d.changed=new a.a;d.f=b;d.ws=g;b=$jscomp.makeIterator(g);for(g=b.next();!g.done;g=b.next())d.registerDisposer(g.value.changed.add(d.changed.dispatch));return d}h(q,c);b(q,[{key:"value",get:function(){return this.f.apply(this,[].concat($jscomp.arrayFromIterable(this.ws.map(function(a){return a.value}))))}}]);return q}(n.a)},function(n,e,c){var p=c(64),h=c(159),r=c(161),a=Math.max,b=
Math.min;n.exports=function(c,e,v){function l(d){var a=f,b=k;f=k=void 0;C=d;return x=c.apply(b,a)}function q(d){var a=d-w;d-=C;return void 0===w||a>=e||0>a||G&&d>=H}function m(){var d=h();if(q(d))return g(d);var a=setTimeout;var f=d-C;d=e-(d-w);f=G?b(d,H-f):d;B=a(m,f)}function g(d){B=void 0;if(A&&f)return l(d);f=k=void 0;return x}function d(){var d=h(),a=q(d);f=arguments;k=this;w=d;if(a){if(void 0===B)return C=d=w,B=setTimeout(m,e),y?l(d):x;if(G)return B=setTimeout(m,e),l(w)}void 0===B&&(B=setTimeout(m,
e));return x}var f,k,x,B,w,C=0,y=!1,G=!1,A=!0;if("function"!=typeof c)throw new TypeError("Expected a function");e=r(e)||0;if(p(v)){y=!!v.leading;var H=(G="maxWait"in v)?a(r(v.maxWait)||0,e):H;A="trailing"in v?!!v.trailing:A}d.cancel=function(){void 0!==B&&clearTimeout(B);C=0;f=w=k=B=void 0};d.flush=function(){return void 0===B?x:g(h())};return d}},function(n,e,c){function p(){h.call(this)}e=c(4);var h=c(125);e(p,h);p.prototype.removeAllListeners=function(c){c?delete this._listeners[c]:this._listeners=
{}};p.prototype.once=function(c,a){function b(){l.removeListener(c,b);e||(e=!0,a.apply(this,arguments))}var l=this,e=!1;this.on(c,b)};p.prototype.emit=function(){var c=this._listeners[arguments[0]];if(c){for(var a=arguments.length,b=Array(a-1),l=1;l<a;l++)b[l-1]=arguments[l];for(a=0;a<c.length;a++)c[a].apply(this,b)}};p.prototype.on=p.prototype.addListener=h.prototype.addEventListener;p.prototype.removeListener=h.prototype.removeEventListener;n.exports.EventEmitter=p},function(n,e,c){e.a=function(c){for(;;){var e=
c.firstElementChild;if(!e)break;c.removeChild(e)}};e.b=function(c){var e=c.parentElement;return e?(e.removeChild(c),!0):!1}},function(n,e,c){c.d(e,"i",function(){return r});e.q=function(a){return(a[3]+1/256*a[2]+1/65536*a[1]+1/16777216*a[0])/256};c.d(e,"g",function(){return a});c.d(e,"f",function(){return w});c.d(e,"h",function(){return v});c.d(e,"d",function(){return t});e.p=function(a,b){for(var g=0;4>g;++g)a[g]=(b>>8*g&255)/255;return a};e.a=function(a,b){b=void 0===b?1:b;switch(a){case p.b.FLOAT32:if(1===
b)return"float";if(1<b&&4>b)return"vec"+b;break;case p.b.UINT8:if(1===b)return"uint8_t";if(1<b&&4>b)return"uint8x"+b+"_t";break;case p.b.UINT16:if(1===b)return"uint16_t";if(2===b)return"uint16x2_t";break;case p.b.UINT32:if(1===b)return"uint32_t";break;case p.b.UINT64:if(1===b)return"uint64_t"}throw Error("No shader type for "+p.b[a]+"["+b+"].");};var p=c(38),h=c(168),r="\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";n=["float","vec2","vec3","vec4"].map(function(a){return"\n"+a+" unnormalizeUint8("+a+" value) {\n  return floor(value * 255.0 + 0.5);\n}\n"}).join("");e.o=n;var b=[n,"\nfloat uintleToFloat(float v) {\n  return unnormalizeUint8(v);\n}\nfloat uintleToFloat(vec2 v) {\n  v = unnormalizeUint8(v);\n  return v.x + v.y * 256.0;\n}\nfloat uintleToFloat(vec3 v) {\n  v = unnormalizeUint8(v);\n  return v.x + v.y * 256.0 + v.z * 256.0 * 256.0;\n}\n"];
e.n=b;var l=[n,"\nfloat uintbeToFloat(float v) {\n  return unnormalizeUint8(v);\n}\nfloat uintbeToFloat(vec2 v) {\n  v = unnormalizeUint8(v);\n  return v.y + v.x * 256.0;\n}\nfloat uintbeToFloat(vec3 v) {\n  v = unnormalizeUint8(v);\n  return v.z + v.y * 256.0 + v.x * 256.0 * 256.0;\n}\n"];(function(){var a=h.a===h.b.BIG?"be":"le";return[h.a===h.b.BIG?l:b,"\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"]})();e.l="\nstruct uint64_t {\n  vec4 low, high;\n};\nuint64_t toUint64(uint64_t x) { return x; }\n";e.m=[n,"\nstruct uint64_t {\n  vec4 low, high;\n};\nuint64_t toUint64(uint64_t x) { return x; }\n","\nstruct uint8_t {\n  float value;\n};\nstruct uint8x2_t {\n  vec2 value;\n};\nstruct uint8x3_t {\n  vec3 value;\n};\nstruct uint8x4_t {\n  vec4 value;\n};\nfloat toRaw(uint8_t x) { return unnormalizeUint8(x.value); }\nfloat toNormalized(uint8_t x) { return x.value; }\nvec2 toRaw(uint8x2_t x) { return unnormalizeUint8(x.value); }\nvec2 toNormalized(uint8x2_t x) { return x.value; }\nvec3 toRaw(uint8x3_t x) { return unnormalizeUint8(x.value); }\nvec3 toNormalized(uint8x3_t x) { return x.value; }\nvec4 toRaw(uint8x4_t x) { return unnormalizeUint8(x.value); }\nvec4 toNormalized(uint8x4_t x) { return x.value; }\nuint64_t toUint64(uint8_t x) {\n  uint64_t result;\n  result.low = vec4(x.value, 0.0, 0.0, 0.0);\n  result.high = vec4(0.0, 0.0, 0.0, 0.0);\n  return result;\n}\n"];
e.e="\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";e.j=["\nstruct uint64_t {\n  vec4 low, high;\n};\nuint64_t toUint64(uint64_t x) { return x; }\n",b,"\nstruct uint16_t {\n  vec2 value;\n};\nstruct uint16x2_t {\n  vec4 value;\n};\nfloat toRaw(uint16_t x) { return uintleToFloat(x.value); }\nfloat toNormalized(uint16_t x) { return toRaw(x) / 65535.0; }\nvec2 toRaw(uint16x2_t x) { return vec2(uintleToFloat(x.value.xy), uintleToFloat(x.value.zw)); }\nvec2 toNormalized(uint16x2_t x) { return toRaw(x) / 65535.0; }\nuint64_t toUint64(uint16_t x) {\n  uint64_t result;\n  result.low = vec4(x.value, 0.0, 0.0);\n  result.high = vec4(0.0, 0.0, 0.0, 0.0);\n  return result;\n}\n"];
n=["\nstruct uint64_t {\n  vec4 low, high;\n};\nuint64_t toUint64(uint64_t x) { return x; }\n","\nstruct uint32_t {\n  vec4 value;\n};\nuint64_t toUint64(uint32_t x) {\n  uint64_t result;\n  result.low = x.value;\n  result.high = vec4(0.0, 0.0, 0.0, 0.0);\n  return result;\n}\n"];e.k=n;var w=["\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"],v="\nfloat imod(float x, float y) {\n  return x - y * floor(x / y);\n}\n",t="\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";e.b=[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"];
e.c=[n,"\nfloat divmod(uint32_t dividend, float divisor, out uint32_t quotient) {\n\n  float partial = dividend.value.w * 255.0;\n  float remainder;\n\n  remainder = mod(partial, divisor);\n  quotient.value.w = (partial - remainder) / divisor / 255.0;\n  partial = remainder * 256.0 + dividend.value.z * 255.0;\n\n  remainder = mod(partial, divisor);\n  quotient.value.z = (partial - remainder) / divisor / 255.0;\n  partial = remainder * 256.0 + dividend.value.y * 255.0;\n\n  remainder = mod(partial, divisor);\n  quotient.value.y = (partial - remainder) / divisor / 255.0;\n  partial = remainder * 256.0 + dividend.value.x * 255.0;\n\n  remainder = mod(partial, divisor);\n  quotient.value.x = (partial - remainder) / divisor / 255.0;\n\n  return remainder;\n}\n"]},
function(n,e,c){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)}c.d(e,"c",function(){return l});c.d(e,"b",function(){return w});var h=c(32),r=c(38),a=c(1);c.d(e,"a",function(){return r.b});var b=function(){function a(a,b){for(var c=0;c<
b.length;c++){var g=b[c];g.enumerable=g.enumerable||!1;g.configurable=!0;"value"in g&&(g.writable=!0);Object.defineProperty(a,g.key,g)}}return function(b,c,m){c&&a(b.prototype,c);m&&a(b,m);return b}}(),l;(function(a){a[a.UNKNOWN=0]="UNKNOWN";a[a.IMAGE=1]="IMAGE";a[a.SEGMENTATION=2]="SEGMENTATION"})(l||(l={}));var w=function(c){function e(b){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var c=(e.__proto__||Object.getPrototypeOf(e)).call(this,b);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
c=!c||"object"!==typeof c&&"function"!==typeof c?this:c;var g=c.dataType=b.dataType,d=c.numChannels=b.numChannels;c.chunkBytes=Object(a.k)(b.chunkDataSize)*r.a[g]*d;c.compressedSegmentationBlockSize=b.compressedSegmentationBlockSize;return c}p(e,c);b(e,[{key:"toObject",value:function(){return{transform:this.chunkLayout.transform,numChannels:this.numChannels,chunkDataSize:this.chunkDataSize,voxelSize:this.voxelSize,dataType:this.dataType,lowerVoxelBound:this.lowerVoxelBound,upperVoxelBound:this.upperVoxelBound,
lowerClipBound:this.lowerClipBound,upperClipBound:this.upperClipBound,baseVoxelOffset:this.baseVoxelOffset,compressedSegmentationBlockSize:this.compressedSegmentationBlockSize}}}],[{key:"make",value:function(a){return new e(Object.assign({},a,{transform:Object(h.m)(a.transform,a.volumeSourceOptions)}))}},{key:"fromObject",value:function(a){return new e(a)}},{key:"withDefaultCompression",value:function(a){var b=a.compressedSegmentationBlockSize,g=a.dataType,d=a.voxelSize,f=a.transform,c=a.lowerVoxelBound,
q=a.upperVoxelBound;f=Object(h.m)(f,a.volumeSourceOptions);void 0!==b||a.volumeType!==l.SEGMENTATION||g!==r.b.UINT32&&g!==r.b.UINT64||(b=Object(h.n)({voxelSize:d,transform:f,lowerVoxelBound:c,upperVoxelBound:q,maxVoxelsPerChunkLog2:9}));return new e(Object.assign({},a,{compressedSegmentationBlockSize:b,transform:f}))}},{key:"getDefaults",value:function(a){var b=Object.assign({},a,{transform:Object(h.m)(a.transform,a.volumeSourceOptions)});return(void 0===a.chunkDataSizes?Object(h.l)(b):a.chunkDataSizes).map(function(b){return e.withDefaultCompression(Object.assign({},
a,{chunkDataSize:b}))})}}]);return e}(h.k)},function(n,e,c){function p(d,a){if(!(d instanceof a))throw new TypeError("Cannot call a class as a function");}function h(d,a){if(!d)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?d:a}function r(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)}function a(a,d,b,f){f=void 0===f?{}:f;return w.a.forPromise(new Promise(function(g){g(a.getVolume(d,b,f))}),{initialMessage:"Retrieving metadata for volume "+b+".",delay:!0,errorPrefix:"Error retrieving metadata for volume "+b+": "})}e.d=a;c.d(e,"b",function(){return m});c.d(e,"c",function(){return g});c.d(e,"a",function(){return d});e.e=function(a,d){f.set(a,d)};
e.f=function(a,d){k.set(a,d)};var b=c(20),l=c(13),w=c(33);n=c(0);var v=c(2),t=c(3),q=function(){function a(a,d){for(var b=0;b<d.length;b++){var f=d[b];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}return function(d,b,f){b&&a(d.prototype,b);f&&a(d,f);return d}}(),m=function(d){function a(d,b,f){p(this,a);d=h(this,(a.__proto__||Object.getPrototypeOf(a)).call(this,d));d.initialSpecification=b;d.manager=f;return d}r(a,d);q(a,[{key:"toJSON",
value:function(){var d=this.layer;if(!d)return this.initialSpecification;d=d.toJSON();this.visible||(d.visible=!1);return d}}]);return a}(b.c),g=function(d){function b(d,a,f,g,c){p(this,b);var k=h(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));k.dataSourceProvider=d;k.layerManager=a;k.chunkManager=f;k.layerSelectedValues=g;k.voxelSize=c;k.changed=new t.a;k.voxelCoordinatesSet=new t.b;k.registerDisposer(a.layersChanged.add(k.changed.dispatch));k.registerDisposer(a.specificationChanged.add(k.changed.dispatch));
return k}r(b,d);q(b,[{key:"reset",value:function(){this.layerManager.clear()}},{key:"restoreState",value:function(d){Object(v.u)(d);this.layerManager.clear();for(var a=$jscomp.makeIterator(Object.keys(d)),b=a.next();!b.done;b=a.next())b=b.value,this.layerManager.addManagedLayer(this.getLayer(b,d[b]))}},{key:"initializeLayerFromSpec",value:function(d,b){var g=this;d.initialSpecification=b;"string"===typeof b&&(b={source:b});Object(v.u)(b);var c=Object(v.w)(b,"type",v.z);d.visible=Object(v.w)(b,"visible",
function(d){if(void 0===d||!0===d)return!0;if(!1===d)return!1;throw Error("Expected boolean, but received: "+JSON.stringify(d)+".");});var m=d.sourceUrl=Object(v.w)(b,"source",v.z);if(void 0===c){if(void 0===m)throw Error("Either layer 'type' or 'source' URL must be specified.");a(this.dataSourceProvider,this.chunkManager,m).then(function(a){if(-1!==g.layerManager.managedLayers.indexOf(d)){var f=k.get(a.volumeType);if(void 0!==f)d.layer=new f(g,b);else throw Error("Unsupported volume type: "+l.c[a.volumeType]+
".");}})}else if(m=f.get(c),void 0!==m)d.layer=new m(this,b);else throw Error("Unsupported layer type: "+JSON.stringify(c)+".");}},{key:"getLayer",value:function(d,a){d=new m(d,a,this);this.initializeLayerFromSpec(d,a);return d}},{key:"add",value:function(d,a){this.layerManager.addManagedLayer(d,a)}},{key:"toJSON",value:function(){for(var d={},a=0,b=$jscomp.makeIterator(this.layerManager.managedLayers),f=b.next();!f.done;f=b.next()){f=f.value;var g=f.toJSON();null!=g&&(d[f.name]=g,++a)}if(0!==a)return d}},
{key:"setVoxelCoordinates",value:function(d){this.voxelCoordinatesSet.dispatch(d)}},{key:"worker",get:function(){return this.chunkManager.rpc}},{key:"rpc",get:function(){return this.chunkManager.rpc}},{key:"rootLayers",get:function(){return this.layerManager}}]);return b}(n.a),d=function(d){function a(d){p(this,a);var f=h(this,(a.__proto__||Object.getPrototypeOf(a)).call(this));f.master=d;f.changed=new t.a;f.layerManager=new b.a;f.registerDisposer(d);d=f.layerManager;f.registerDisposer(d.layersChanged.add(f.changed.dispatch));
f.registerDisposer(d.specificationChanged.add(f.changed.dispatch));return f}r(a,d);q(a,[{key:"reset",value:function(){this.layerManager.clear()}},{key:"restoreState",value:function(d){var a=this.master.layerManager,b=[];d=$jscomp.makeIterator(new Set(Object(v.a)(d,v.B)));for(var f=d.next();!f.done;f=d.next()){f=f.value;var g=a.getLayerByName(f);if(void 0===g)throw Error("Undefined layer referenced in subset specification: "+JSON.stringify(f));b.push(g)}this.layerManager.clear();a=$jscomp.makeIterator(b);
for(b=a.next();!b.done;b=a.next())this.layerManager.addManagedLayer(b.value.addRef())}},{key:"toJSON",value:function(){return this.layerManager.managedLayers.map(function(d){return d.name})}},{key:"initializeLayerFromSpec",value:function(d,a){this.master.initializeLayerFromSpec(d,a)}},{key:"getLayer",value:function(d,a){return this.master.getLayer(d,a)}},{key:"add",value:function(d,a){-1===this.master.layerManager.managedLayers.indexOf(d)&&(d.name=this.master.layerManager.getUniqueLayerName(d.name),
this.master.layerManager.addManagedLayer(d.addRef()));this.layerManager.addManagedLayer(d,a)}},{key:"setVoxelCoordinates",value:function(d){this.master.setVoxelCoordinates(d)}},{key:"voxelCoordinatesSet",get:function(){return this.master.voxelCoordinatesSet}},{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}(n.a),f=new Map,k=new Map},function(n,e,c){function p(d,a){if(!d)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?d:a}function h(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)}function r(d,a){if(!(d instanceof a))throw new TypeError("Cannot call a class as a function");}function a(d){if("number"!==typeof d||0>d)throw Error("Expected non-negative number as limit, but received: "+JSON.stringify(d));return d}c.d(e,"b",function(){return x});c.d(e,"a",function(){return B});c.d(e,"d",function(){return E});
c.d(e,"c",function(){return C});c.d(e,"e",function(){return y});e.f=function(a,b){a=function(a){function b(d){for(var a=[],f=0;f<arguments.length;++f)a[f-0]=arguments[f];r(this,b);var g;f=p(this,(g=b.__proto__||Object.getPrototypeOf(b)).call.apply(g,[].concat([this],$jscomp.arrayFromIterable(a))));f.parameters=a[1].parameters;return f}h(b,a);f(b,[{key:"initializeCounterpart",value:function(a,f){f.parameters=this.parameters;d(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"initializeCounterpart",
this).call(this,a,f)}}],[{key:"encodeOptions",value:function(a){var f=d(b.__proto__||Object.getPrototypeOf(b),"encodeOptions",this).call(this,a);f.parameters=a.parameters;return f}}]);return b}(a);return a=k([Object(g.g)(b.RPC_ID)],a)};var b=c(35),l=c(63),w=c(8),v=c(2),t=c(53),q=c(23),m=c(3),g=c(16),d=function A(d,a,b){null===d&&(d=Function.prototype);var f=Object.getOwnPropertyDescriptor(d,a);if(void 0===f){if(d=Object.getPrototypeOf(d),null!==d)return A(d,a,b)}else{if("value"in f)return f.value;
a=f.get;return void 0===a?void 0:a.call(b)}},f=function(){function d(d,a){for(var b=0;b<a.length;b++){var f=a[b];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(d,f.key,f)}}return function(a,b,f){b&&d(a.prototype,b);f&&d(a,f);return a}}(),k=this&&this.__decorate||function(d,a,b,f){var g=arguments.length,c=3>g?a:null===f?f=Object.getOwnPropertyDescriptor(a,b):f,k;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)c=Reflect.decorate(d,
a,b,f);else for(var m=d.length-1;0<=m;m--)if(k=d[m])c=(3>g?k(c):3<g?k(a,b,c):k(a,b))||c;return 3<g&&c&&Object.defineProperty(a,b,c),c},x=function(){function d(a){r(this,d);this.source=a;this.state=b.d.SYSTEM_MEMORY}f(d,[{key:"copyToGPU",value:function(d){this.state=b.d.GPU_MEMORY}},{key:"freeGPUMemory",value:function(d){this.state=b.d.SYSTEM_MEMORY}},{key:"gl",get:function(){return this.source.gl}}]);return d}(),B=function H(d){var b=void 0===d?{}:d;d=void 0===b.defaultItemLimit?Number.POSITIVE_INFINITY:
b.defaultItemLimit;b=void 0===b.defaultSizeLimit?Number.POSITIVE_INFINITY:b.defaultSizeLimit;r(this,H);this.sizeLimit=new w.a(b,a);this.itemLimit=new w.a(d,a)},E=function(d){function a(d,b,f){r(this,a);var g=p(this,(a.__proto__||Object.getPrototypeOf(a)).call(this));g.gl=b;g.capacities=f;g.visibleChunksChanged=new m.a;g.pendingChunkUpdates=null;g.pendingChunkUpdatesTail=null;g.chunkUpdateDeadline=null;g.chunkUpdateDelay=30;b=function(a){return{itemLimit:g.registerDisposer(l.a.makeFromExisting(d,a.itemLimit)).rpcId,
sizeLimit:g.registerDisposer(l.a.makeFromExisting(d,a.sizeLimit)).rpcId}};g.initializeCounterpart(d,{gpuMemoryCapacity:b(f.gpuMemory),systemMemoryCapacity:b(f.systemMemory),downloadCapacity:b(f.download)});return g}h(a,d);f(a,[{key:"scheduleChunkUpdate",value:function(){var d=this.chunkUpdateDeadline;d=null===d||Date.now()<d?0:this.chunkUpdateDelay;setTimeout(this.processPendingChunkUpdates.bind(this),d)}},{key:"processPendingChunkUpdates",value:function(){var d=this.chunkUpdateDeadline;null===d&&
(d=Date.now()+30);for(var a=!1;;){if(Date.now()>d){setTimeout(this.processPendingChunkUpdates.bind(this),this.chunkUpdateDelay);break}var f=this.pendingChunkUpdates,g=this.rpc.get(f.source);if(void 0===f.id){a=$jscomp.makeIterator(g.chunks.keys());for(var c=a.next();!c.done;c=a.next())g.deleteChunk(c.value);a=!0}else if(c=f.state,c===b.d.EXPIRED)g.deleteChunk(f.id);else{var k=f.id;if(f["new"]){var m=g.getChunk(f);g.addChunk(k,m)}else m=g.chunks.get(k);if(c!==m.state)switch(c){case b.d.GPU_MEMORY:m.copyToGPU(this.gl);
a=!0;break;case b.d.SYSTEM_MEMORY:m.freeGPUMemory(this.gl);break;default:throw Error("INTERNAL ERROR: Invalid chunk state: "+b.d[c]);}}f=this.pendingChunkUpdates=f.nextUpdate;--window.numPendingChunkUpdates;if(null==f){this.pendingChunkUpdatesTail=null;break}}a&&this.visibleChunksChanged.dispatch()}}]);return a}(g.b);E=k([Object(g.g)(b.b)],E);window.numPendingChunkUpdates=0;Object(g.e)("Chunk.update",function(d){var a=this.get(d.source).chunkManager.chunkQueueManager,b=a.pendingChunkUpdatesTail;++window.numPendingChunkUpdates;
null==b?(a.pendingChunkUpdates=d,a.pendingChunkUpdatesTail=d,a.scheduleChunkUpdate()):(b.nextUpdate=d,a.pendingChunkUpdatesTail=d)});var C=function(d){function a(d){r(this,a);var b=p(this,(a.__proto__||Object.getPrototypeOf(a)).call(this));b.chunkQueueManager=d;b.memoize=new t.b;b.registerDisposer(d.addRef());b.initializeCounterpart(d.rpc,{chunkQueueManager:d.rpcId});return b}h(a,d);f(a,[{key:"getChunkSource",value:function(d,a){var b=this,f=d.encodeOptions(a);f.constructorId=Object(q.a)(d);f=Object(v.g)(f);
return this.memoize.get(f,function(){var f=new d(b,a);f.initializeCounterpart(b.rpc,{});return f})}},{key:"gl",get:function(){return this.chunkQueueManager.gl}}]);return a}(g.b);C=k([Object(g.g)(b.a)],C);var y=function(a){function g(d,a){r(this,g);a=p(this,(g.__proto__||Object.getPrototypeOf(g)).call(this));a.chunkManager=d;a.chunks=new Map;return a}h(g,a);f(g,[{key:"initializeCounterpart",value:function(a,b){b.chunkManager=this.chunkManager.rpcId;d(g.prototype.__proto__||Object.getPrototypeOf(g.prototype),
"initializeCounterpart",this).call(this,a,b)}},{key:"deleteChunk",value:function(d){var a=this.chunks.get(d);a.state===b.d.GPU_MEMORY&&a.freeGPUMemory(this.gl);this.chunks.delete(d)}},{key:"addChunk",value:function(d,a){this.chunks.set(d,a)}},{key:"getChunk",value:function(d){throw Error("Not implemented.");}},{key:"invalidateCache",value:function(){this.rpc.invoke(b.c,{id:this.rpcId})}},{key:"gl",get:function(){return this.chunkManager.chunkQueueManager.gl}}],[{key:"encodeOptions",value:function(d){return{}}}]);
return g}(g.b)},function(n,e,c){function p(d,a){if(!(d instanceof a))throw new TypeError("Cannot call a class as a function");}function h(d,a){if(!d)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?d:a}function r(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)}function a(d,a){t.set(d,a)}e.e=a;e.d=function(d,f){a(d,function(d){var a=this,g=d.id,c=new b.b;d=f.call(this,d,c);this.set(g,{promise:d,cancellationToken:c});d.then(function(d){var b=d.value;d=d.transfers;a.delete(g);a.invoke("rpc.promise.response",{id:g,value:b},d)},function(d){a.delete(g);a.invoke("rpc.promise.response",{id:g,error:d.message,errorName:d.name})})})};c.d(e,"a",function(){return g});
c.d(e,"b",function(){return d});c.d(e,"c",function(){return f});e.g=function(d){return function(a){a.prototype.RPC_TYPE_ID=d}};e.f=function(d){return function(a){if(void 0!==d)a.prototype.RPC_TYPE_ID=d;else if(d=a.prototype.RPC_TYPE_ID,void 0===d)throw Error("RPC_TYPE_ID should have already been defined");k.set(d,a)}};var b=c(29);n=c(0);var l=function B(d,a,b){null===d&&(d=Function.prototype);var f=Object.getOwnPropertyDescriptor(d,a);if(void 0===f){if(d=Object.getPrototypeOf(d),null!==d)return B(d,
a,b)}else{if("value"in f)return f.value;a=f.get;return void 0===a?void 0:a.call(b)}},w=function(){function d(d,a){for(var b=0;b<a.length;b++){var f=a[b];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(d,f.key,f)}}return function(a,b,f){b&&d(a.prototype,b);f&&d(a,f);return a}}(),v=!("undefined"!==typeof Window&&self instanceof Window),t=new Map,q=function(d){function a(d,b){p(this,a);var f=h(this,(a.__proto__||Object.getPrototypeOf(a)).call(this,b));
f.name=d;f.message=b;return f}r(a,d);return a}(Error);a("rpc.promise.cancel",function(d){this.get(d.id).cancellationToken.cancel()});a("rpc.promise.response",function(d){var a=d.id,f=this.get(a),g=f.resolve;f=f.reject;this.delete(a);d.hasOwnProperty("value")?g(d.value):d.errorName===b.a.name?f(b.a):f(new q(d.errorName,d.error))});var m=v?-1:0,g=function(){function d(a){var b=this;p(this,d);this.target=a;this.objects=new Map;this.nextId=m;a.onmessage=function(d){d=d.data;t.get(d.functionName).call(b,
d)}}w(d,[{key:"set",value:function(d,a){this.objects.set(d,a)}},{key:"delete",value:function(d){this.objects.delete(d)}},{key:"get",value:function(d){return this.objects.get(d)}},{key:"getRef",value:function(d){var a=this.get(d.id);a.referencedGeneration=d.gen;a.addRef();return a}},{key:"invoke",value:function(d,a,b){a.functionName=d;this.target.postMessage(a,b)}},{key:"promiseInvoke",value:function(d,a,f,g){var c=this;f=void 0===f?b.e:f;return Object(b.d)(f,function(b,f,k){var m=a.id=c.newId();c.set(m,
{resolve:b,reject:f});c.invoke(d,a,g);k.add(function(){c.invoke("rpc.promise.cancel",{id:m})})})}},{key:"newId",value:function(){return v?this.nextId--:this.nextId++}},{key:"numObjects",get:function(){return this.objects.size}}]);return d}(),d=function(d){function a(){p(this,a);var d=h(this,(a.__proto__||Object.getPrototypeOf(a)).apply(this,arguments));d.rpc=null;d.rpcId=null;return d}r(a,d);w(a,[{key:"initializeSharedObject",value:function(d,a){a=void 0===a?d.newId():a;this.rpc=d;this.rpcId=a;this.isOwner=
!1;d.set(a,this)}},{key:"initializeCounterpart",value:function(d,a){a=void 0===a?{}:a;this.initializeSharedObject(d);this.referencedGeneration=this.unreferencedGeneration=0;this.isOwner=!0;a.id=this.rpcId;a.type=this.RPC_TYPE_ID;d.invoke("SharedObject.new",a)}},{key:"dispose",value:function(){l(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}):l(a.prototype.__proto__||Object.getPrototypeOf(a.prototype),"refCountReachedZero",this).call(this)}},{key:"ownerDispose",value:function(){var d=this.rpc,b=this.rpcId;l(a.prototype.__proto__||Object.getPrototypeOf(a.prototype),"refCountReachedZero",this).call(this);d.delete(b);
d.invoke("SharedObject.dispose",{id:b})}},{key:"counterpartRefCountReachedZero",value:function(d){this.unreferencedGeneration=d;0===this.refCount&&d===this.referencedGeneration&&this.ownerDispose()}}]);return a}(n.a),f=function(d){function a(d,b){b=void 0===b?{}:b;p(this,a);var f=h(this,(a.__proto__||Object.getPrototypeOf(a)).call(this));b=void 0===b?{}:b;null!=d&&f.initializeSharedObject(d,b.id);return f}r(a,d);return a}(d);a("SharedObject.dispose",function(d){d=this.get(d.id);if(0!==d.refCount)throw Error("Attempted to dispose object with non-zero reference count.");
d.disposed();this.delete(d.rpcId);d.rpcId=null;d.rpc=null});a("SharedObject.refCountReachedZero",function(d){this.get(d.id).counterpartRefCountReachedZero(d.gen)});var k=new Map;a("SharedObject.new",function(d){--(new (k.get(d.type))(this,d)).refCount})},function(n,e,c){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 h(a,b){var d="";b&1&&(d+="control+");b&2&&(d+="alt+");b&4&&(d+="meta+");b&8&&(d+="shift+");return d+a}function r(a){return"string"===typeof a?{action:a}:a}function a(a){function b(b,g){for(;;)switch(d){case 0:m=a.indexOf(":");a:{b=void 0;var k=a.substring(m+1).split("+"),q=0;k=$jscomp.makeIterator(k);for(var l=k.next();!l.done;l=k.next())switch(l=l.value,l){case "control":q|=1;break;case "alt":q|=2;break;case "meta":q|=4;
break;case "shift":q|=8;break;default:if(void 0===b)b=l;else{c=void 0;break a}}c=void 0===b?void 0:h(b,q)}if(void 0!==c){d=1;break}d=-1;throw Error("Invalid event identifier: "+JSON.stringify(a));case 1:if(-1===m){d=2;break}f=a.substring(0,m);if("at"===f||"bubble"===f){d=4;break}d=-1;throw Error("Invalid event phase: "+JSON.stringify(f));case 4:return d=5,{value:f+":"+c,done:!1};case 5:if(void 0===g){d=6;break}d=-1;throw g;case 6:d=3;break;case 2:return d=7,{value:"at:"+c,done:!1};case 7:if(void 0===
g){d=8;break}d=-1;throw g;case 8:return d=9,{value:"bubble:"+c,done:!1};case 9:if(void 0===g){d=10;break}d=-1;throw g;case 10:case 3:d=-1;default:return{value:void 0,done:!0}}}var d=0,f,c,m,q={next:function(d){return b(d,void 0)},throw:function(d){return b(void 0,d)},return:function(d){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();q[Symbol.iterator]=function(){return this};return q}c.d(e,"a",function(){return t});e.b=function(a,b,d){a=q[b.eventPhase]+":"+h(a,(b.ctrlKey?1:0)|(b.altKey?
2:0)|(b.metaKey?4:0)|(b.shiftKey?8:0));d=d.get(a);void 0!==d&&(!1!==d.stopPropagation&&b.stopPropagation(),a=new CustomEvent("action:"+d.action,{bubbles:!0,detail:b,cancelable:!0}),a=!b.target.dispatchEvent(a),(!1!==d.preventDefault||a)&&b.preventDefault())};e.c=function(a,g,d,f){return Object(b.c)(a,"action:"+g,d,f)};var b=c(0);n=c(172);var l=function(){function a(a,d){for(var b=0;b<d.length;b++){var g=d[b];g.enumerable=g.enumerable||!1;g.configurable=!0;"value"in g&&(g.writable=!0);Object.defineProperty(a,
g.key,g)}}return function(b,d,f){d&&a(b.prototype,d);f&&a(b,f);return b}}(),w=function g(d,a,b){null===d&&(d=Function.prototype);var f=Object.getOwnPropertyDescriptor(d,a);if(void 0===f){if(d=Object.getPrototypeOf(d),null!==d)return g(d,a,b)}else{if("value"in f)return f.value;a=f.get;return void 0===a?void 0:a.call(b)}},v;(function(a){a[a.CONTROL=1]="CONTROL";a[a.ALT=2]="ALT";a[a.META=4]="META";a[a.SHIFT=8]="SHIFT"})(v||(v={}));var t=function(b){function d(){if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");
var a=(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?this:a}p(d,b);l(d,[{key:"setFromObject",value:function(a){for(var d=$jscomp.makeIterator(Object.keys(a)),b=d.next();!b.done;b=d.next())b=b.value,this.set(b,r(a[b]))}},{key:"set",value:function(b,g){g=r(g);b=$jscomp.makeIterator(a(b));for(var f=b.next();!f.done;f=b.next())f=f.value,w(d.prototype.__proto__||
Object.getPrototypeOf(d.prototype),"set",this).call(this,f,g)}},{key:"delete",value:function(b){b=$jscomp.makeIterator(a(b));for(var f=b.next();!f.done;f=b.next())f=f.value,w(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"delete",this).call(this,f)}}],[{key:"fromObject",value:function(a,b){b=void 0===b?{}:b;var f=new d;f.label=b.label;if(void 0!==b.parents){b=$jscomp.makeIterator(b.parents);for(var g=b.next();!g.done;g=b.next()){var c=$jscomp.makeIterator(g.value);g=c.next().value;c=c.next().value;
f.addParent(g,c)}}b=$jscomp.makeIterator(Object.keys(a));for(g=b.next();!g.done;g=b.next())g=g.value,f.set(g,r(a[g]));return f}}]);return d}(n.a),q=[];q[Event.AT_TARGET]="at";q[Event.CAPTURING_PHASE]="capture";q[Event.BUBBLING_PHASE]="bubble"},function(n,e,c){(function(e){var h=c(124),r=function(){};"production"!==e.env.NODE_ENV&&(r=c(7)("sockjs-client:utils:url"));n.exports={getOrigin:function(a){if(!a)return null;a=new h(a);if("file:"===a.protocol)return null;var b=a.port;b||(b="https:"===a.protocol?
"443":"80");return a.protocol+"//"+a.hostname+":"+b},isOriginEqual:function(a,b){var c=this.getOrigin(a)===this.getOrigin(b);r("same",a,b,c);return c},isSchemeEqual:function(a,b){return a.split(":")[0]===b.split(":")[0]},addPath:function(a,b){a=a.split("?");return a[0]+b+(a[1]?"?"+a[1]:"")},addQuery:function(a,b){return a+(-1===a.indexOf("?")?"?"+b:"&"+b)}}}).call(e,c(6))},function(n,e,c){c.d(e,"a",function(){return w});var p=function(){function a(a,b){for(var c=0;c<b.length;c++){var g=b[c];g.enumerable=
g.enumerable||!1;g.configurable=!0;"value"in g&&(g.writable=!0);Object.defineProperty(a,g.key,g)}}return function(b,c,m){c&&a(b.prototype,c);m&&a(b,m);return b}}(),h=new Uint32Array(2),r=[];for(n=2;36>=n;++n){e=Math.floor(32/Math.log2(n));c=Math.pow(n,e);var a=Math.floor(e/2),b=Math.pow(n,a);a=Math.pow(n,e-a);var l="^[0-"+String.fromCharCode(48+Math.min(9,n-1));10<n&&(l+="a-"+String.fromCharCode(97+n-11),l+="A-"+String.fromCharCode(65+n-11));l+="]{1,"+Math.ceil(64/Math.log2(n))+"}$";r[n]={lowDigits:e,
lowBase:c,lowBase1:b,lowBase2:a,pattern:new RegExp(l)}}var w=function(){function a(b,c){b=void 0===b?0:b;c=void 0===c?0:c;if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");this.low=b;this.high=c}p(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 b=this.low,c=this.high;if(0===c)return b.toString(a);c*=4294967296;var g=r[a],d=g.lowBase;
g=g.lowDigits;var f=c%d;c=Math.floor(c/d);b+=f;c+=Math.floor(b/d);b=(b%d).toString(a);return c.toString(a)+"0".repeat(g-b.length)+b}},{key:"tryParseString",value:function(a,b){b=void 0===b?10:b;var c=r[b],g=c.lowDigits,d=c.lowBase,f=c.lowBase1,k=c.lowBase2;if(!c.pattern.test(a))return!1;if(a.length<=g)return this.low=parseInt(a,b),this.high=0,!0;g=a.length-g;c=parseInt(a.substr(g),b);a=parseInt(a.substr(0,g),b);d=Math.floor(a*d/4294967296);f=c+a%4294967296*f%4294967296*k%4294967296;4294967296<f&&
(++d,f-=4294967296);if(f>>>0!==f||d>>>0!==d)return!1;this.low=f;this.high=d;return!0}},{key:"parseString",value:function(a,b){if(!this.tryParseString(a,void 0===b?10:b))throw Error("Failed to parse string as uint64 value: "+JSON.stringify(a)+".");return this}},{key:"valid",value:function(){var a=this.low,b=this.high;return a>>>0===a&&b>>>0===b}},{key:"toJSON",value:function(){return this.toString()}},{key:"lshift",value:function(b){b&=63;if(0==b)return this.clone();var c=this.low,m=this.high;return 32>
b?new a(c<<b,m<<b|c>>>32-b):new a(0,c<<b-32)}},{key:"rshift",value:function(b){b&=63;if(0==b)return this.clone();var c=this.low,m=this.high;return 32>b?new a(c>>>b|m<<32-b,m>>b):new a(m>>b-32,0<=m?0:-1)}},{key:"or",value:function(b){return new a(this.low|b.low,this.high|b.high)}},{key:"xor",value:function(b){return new a(this.low^b.low,this.high^b.high)}},{key:"and",value:function(b){return new a(this.low&b.low,this.high&b.high)}}],[{key:"less",value:function(a,b){return a.high<b.high||a.high===b.high&&
a.low<b.low}},{key:"compare",value:function(a,b){return a.high-b.high||a.low-b.low}},{key:"equal",value:function(a,b){return a.low===b.low&&a.high===b.high}},{key:"min",value:function(b,c){return a.less(b,c)?b:c}},{key:"random",value:function(){crypto.getRandomValues(h);return new a(h[0],h[1])}},{key:"parseString",value:function(b,c){c=void 0===c?10:c;return(new a).parseString(b,c)}}]);return a}();w.ZERO=new w(0,0)},function(n,e,c){function p(a,d){if(!(a instanceof d))throw new TypeError("Cannot call a class as a function");
}function h(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 r(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)}c.d(e,"e",function(){return d});
c.d(e,"h",function(){return f});c.d(e,"g",function(){return k});c.d(e,"f",function(){return x});c.d(e,"c",function(){return B});c.d(e,"a",function(){return E});c.d(e,"d",function(){return C});c.d(e,"b",function(){return y});e.i=function(a,d,b){return b.registerDisposer(new G(a,d,function(a){var d=a.redrawNeeded.add(function(){return b.scheduleRedraw()});b.scheduleRedraw();return function(){d();b.scheduleRedraw()}},b.visibility))};n=c(9);var a=c.n(n);n=c(94);var b=c.n(n);n=c(0);var l=c(1),w=c(3),v=
c(167),t=c(19),q=c(44),m=function H(a,d,b){null===a&&(a=Function.prototype);var f=Object.getOwnPropertyDescriptor(a,d);if(void 0===f){if(a=Object.getPrototypeOf(a),null!==a)return H(a,d,b)}else{if("value"in f)return f.value;d=f.get;return void 0===d?void 0:d.call(b)}},g=function(){function a(a,d){for(var b=0;b<d.length;b++){var f=d[b];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}return function(d,b,f){b&&a(d.prototype,b);f&&a(d,f);
return d}}(),d=function(a){function d(){p(this,d);var a=h(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments));a.ready=!1;a.layerChanged=new w.a;a.redrawNeeded=new w.a;a.readyStateChanged=new w.a;a.voxelSize=null;a.boundingBox=null;return a}r(d,a);g(d,[{key:"setReady",value:function(a){this.ready=a;this.readyStateChanged.dispatch();this.layerChanged.dispatch()}},{key:"handleAction",value:function(a){}},{key:"getValueAt",value:function(a){}},{key:"transformPickedValue",value:function(a,
d){return a}},{key:"updateMouseState",value:function(a,d,b){}}]);return d}(n.a),f=function(a){function d(){p(this,d);var a=h(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments));a.visibility=new q.a;return a}r(d,a);return d}(d),k=function(a){function d(){p(this,d);return h(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments))}r(d,a);g(d,[{key:"onShow",value:function(){}},{key:"onHide",value:function(){}}]);return d}(n.a),x=function(a){function d(a){a=void 0===a?[]:a;p(this,
d);var b=h(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));b.layersChanged=new w.a;b.readyStateChanged=new w.a;b.specificationChanged=new w.a;b.renderLayers=[];b.isReady=!1;a.forEach(b.addRenderLayer.bind(b));return b}r(d,a);g(d,[{key:"addRenderLayer",value:function(a){this.renderLayers.push(a);var d=this.layersChanged,b=this.readyStateChanged;this.registerDisposer(a);this.registerDisposer(a.layerChanged.add(d.dispatch));this.registerDisposer(a.readyStateChanged.add(b.dispatch));b.dispatch();
d.dispatch()}},{key:"getValueAt",value:function(a,d){var b=this.renderLayers,f=d.pickedRenderLayer;if(null!==f&&-1!==b.indexOf(f)){var g=f.transformPickedValue(d.pickedValue,d.pickedOffset);return this.transformPickedValue(g)}d=$jscomp.makeIterator(b);for(b=d.next();!b.done&&(b=b.value,!b.ready||(g=b.getValueAt(a),void 0===g));b=d.next());return this.transformPickedValue(g)}},{key:"transformPickedValue",value:function(a){return a}},{key:"toJSON",value:function(){return null}},{key:"makeDropdown",
value:function(a){}},{key:"handleAction",value:function(a){}}]);return d}(n.a),B=function(a){function d(a,b,f){b=void 0===b?null:b;f=void 0===f?!0:f;p(this,d);var g=h(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));g.name=a;g.visible=f;g.readyStateChanged=new w.a;g.layerChanged=new w.a;g.specificationChanged=new w.a;g.wasDisposed=!1;g.layer_=null;g.layer=b;return g}r(d,a);g(d,[{key:"isReady",value:function(){var a=this.layer;return null!==a&&a.isReady}},{key:"handleLayerChanged",value:function(){this.visible&&
this.layerChanged.dispatch()}},{key:"setVisible",value:function(a){a!==this.visible&&(this.visible=a,this.layerChanged.dispatch())}},{key:"disposed",value:function(){this.wasDisposed=!0;this.layer=null;m(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"disposed",this).call(this)}},{key:"layer",get:function(){return this.layer_},set:function(a){var d=this,b=this.layer_;null!=b&&(this.unregisterUserLayer(),b.dispose());this.layer_=a;if(null!=a){var f=[a.layersChanged.add(function(){return d.handleLayerChanged()}),
a.readyStateChanged.add(this.readyStateChanged.dispatch),a.specificationChanged.add(this.specificationChanged.dispatch)];this.unregisterUserLayer=function(){f.forEach(function(a){return a()})};this.readyStateChanged.dispatch();this.handleLayerChanged()}}}]);return d}(n.a),E=function(d){function b(){p(this,b);var d=h(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));d.managedLayers=[];d.layersChanged=new w.a;d.readyStateChanged=new w.a;d.specificationChanged=new w.a;d.boundPositions=new WeakSet;
d.numDirectUsers=0;d.scheduleRemoveLayersWithSingleRef=d.registerCancellable(a()(function(){return d.removeLayersWithSingleRef()},0));d.layersChanged.add(d.scheduleRemoveLayersWithSingleRef);return d}r(b,d);g(b,[{key:"filter",value:function(a){var d=this,b=!1;this.managedLayers=this.managedLayers.filter(function(f){return a(f)?!0:(d.unbindManagedLayer(f),b=!0,!1)});b&&this.layersChanged.dispatch()}},{key:"removeLayersWithSingleRef",value:function(){0<this.numDirectUsers||this.filter(function(a){return 1!==
a.refCount})}},{key:"updateSignalBindings",value:function(a,d){d(a.layerChanged,this.layersChanged.dispatch);d(a.readyStateChanged,this.readyStateChanged.dispatch);d(a.specificationChanged,this.specificationChanged.dispatch)}},{key:"useDirectly",value:function(){var a=this;1===++this.numDirectUsers&&this.layersChanged.remove(this.scheduleRemoveLayersWithSingleRef);return function(){0===--a.numDirectUsers&&(a.layersChanged.add(a.scheduleRemoveLayersWithSingleRef),a.scheduleRemoveLayersWithSingleRef())}}},
{key:"addManagedLayer",value:function(a,d){this.updateSignalBindings(a,v.a);void 0===d&&(d=this.managedLayers.length);this.managedLayers.splice(d,0,a);this.layersChanged.dispatch();this.readyStateChanged.dispatch();return a}},{key:"addUserLayer",value:function(a,d,b){a=new B(a,d,b);return this.addManagedLayer(a)}},{key:"readyRenderLayers",value:function(){function a(a,l){for(;;)switch(d){case 0:m=$jscomp.makeIterator(q.managedLayers),k=m.next();case 1:if(k.done){d=3;break}c=k.value;if(c.visible&&
c.layer){d=4;break}d=2;break;case 4:g=$jscomp.makeIterator(c.layer.renderLayers),f=g.next();case 5:if(f.done){d=7;break}b=f.value;if(b.ready){d=8;break}d=6;break;case 8:return d=9,{value:b,done:!1};case 9:if(void 0===l){d=10;break}d=-1;throw l;case 10:case 6:f=g.next();d=5;break;case 7:case 2:k=m.next();d=1;break;case 3:d=-1;default:return{value:void 0,done:!0}}}var d=0,b,f,g,c,k,m,q=this,l={next:function(d){return a(d,void 0)},throw:function(d){return a(void 0,d)},return:function(a){throw Error("Not yet implemented");
}};$jscomp.initSymbolIterator();l[Symbol.iterator]=function(){return this};return l}},{key:"unbindManagedLayer",value:function(a){this.updateSignalBindings(a,v.b);a.dispose()}},{key:"clear",value:function(){for(var a=$jscomp.makeIterator(this.managedLayers),d=a.next();!d.done;d=a.next())this.unbindManagedLayer(d.value);this.managedLayers.length=0;this.layersChanged.dispatch()}},{key:"remove",value:function(a){this.unbindManagedLayer(this.managedLayers[a]);this.managedLayers.splice(a,1);this.layersChanged.dispatch()}},
{key:"removeManagedLayer",value:function(a){a=this.managedLayers.indexOf(a);if(-1===a)throw Error("Internal error: invalid managed layer.");this.remove(a)}},{key:"reorderManagedLayer",value:function(a,d){var b=this.managedLayers.length;a===d||0>a||a>=b||0>d||d>=b||(a=$jscomp.makeIterator(this.managedLayers.splice(a,1)).next().value,this.managedLayers.splice(d,0,a),this.layersChanged.dispatch())}},{key:"disposed",value:function(){this.clear();m(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),
"disposed",this).call(this)}},{key:"getLayerByName",value:function(a){return this.managedLayers.find(function(d){return d.name===a})}},{key:"getUniqueLayerName",value:function(a){for(var d=a,b=0;void 0!==this.getLayerByName(d);)d=a+ ++b;return d}},{key:"has",value:function(a){return-1!==this.managedLayers.indexOf(a)}},{key:"initializePosition",value:function(d){var b=this,f=this.boundPositions;f.has(d)||(f.add(d),f=a()(function(){b.updatePositionFromLayers(d)}),this.readyStateChanged.add(f),d.changed.add(f),
this.updatePositionFromLayers(d))}},{key:"updatePositionFromLayers",value:function(a){if(!a.valid)for(var d=$jscomp.makeIterator(this.managedLayers),b=d.next();!b.done;b=d.next())if(b=b.value.layer,null!=b){b=$jscomp.makeIterator(b.renderLayers);for(var f=b.next();!f.done;f=b.next())if(f=f.value,f.ready&&(a.voxelSize.valid||null==f.voxelSize||(l.p.copy(a.voxelSize.size,f.voxelSize),a.voxelSize.setValid()),!a.spatialCoordinatesValid&&!a.voxelCoordinatesValid&&null!=f.boundingBox)){f=f.boundingBox;
var g=a.spatialCoordinates;l.p.add(g,f.lower,f.upper);l.p.scale(g,g,.5);a.spatialCoordinatesValid=!0;a.changed.dispatch()}}}},{key:"invokeAction",value:function(a){for(var d=$jscomp.makeIterator(this.managedLayers),b=d.next();!b.done;b=d.next())if(b=b.value,null!==b.layer&&b.visible){b=b.layer;b.handleAction(a);b=$jscomp.makeIterator(b.renderLayers);for(var f=b.next();!f.done;f=b.next())f=f.value,f.ready&&f.handleAction(a)}}},{key:"renderLayers",get:function(){var a=this;$jscomp.initSymbol();$jscomp.initSymbolIterator();
var d={};return d[Symbol.iterator]=function(){function d(d,q){for(;;)switch(b){case 0:l=$jscomp.makeIterator(a.managedLayers),m=l.next();case 1:if(m.done){b=3;break}k=m.value;if(null!==k.layer){b=4;break}b=2;break;case 4:c=$jscomp.makeIterator(k.layer.renderLayers),g=c.next();case 5:if(g.done){b=7;break}f=g.value;b=8;return{value:f,done:!1};case 8:if(void 0===q){b=9;break}b=-1;throw q;case 9:case 6:g=c.next();b=5;break;case 7:case 2:m=l.next();b=1;break;case 3:b=-1;default:return{value:void 0,done:!0}}}
var b=0,f,g,c,k,m,l,q={next:function(a){return d(a,void 0)},throw:function(a){return d(void 0,a)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();q[Symbol.iterator]=function(){return this};return q},d}},{key:"visibleRenderLayers",get:function(){var a=this;$jscomp.initSymbol();$jscomp.initSymbolIterator();var d={};return d[Symbol.iterator]=function(){function d(d,q){for(;;)switch(b){case 0:l=$jscomp.makeIterator(a.managedLayers),m=l.next();case 1:if(m.done){b=
3;break}k=m.value;if(null!==k.layer&&k.visible){b=4;break}b=2;break;case 4:c=$jscomp.makeIterator(k.layer.renderLayers),g=c.next();case 5:if(g.done){b=7;break}f=g.value;b=8;return{value:f,done:!1};case 8:if(void 0===q){b=9;break}b=-1;throw q;case 9:case 6:g=c.next();b=5;break;case 7:case 2:m=l.next();b=1;break;case 3:b=-1;default:return{value:void 0,done:!0}}}var b=0,f,g,c,k,m,l,q={next:function(a){return d(a,void 0)},throw:function(a){return d(void 0,a)},return:function(a){throw Error("Not yet implemented");
}};$jscomp.initSymbolIterator();q[Symbol.iterator]=function(){return this};return q},d}}]);return b}(n.a),C=function(){function a(){var d=this;p(this,a);this.changed=new w.a;this.position=l.p.create();this.active=!1;this.pickedRenderLayer=null;this.pickedValue=new t.a(0,0);this.pickedOffset=0;this.updater=void 0;this.stale=!1;this.triggerUpdate=b()(function(){d.update()},50,{leading:!0,trailing:!0})}g(a,[{key:"updateUnconditionally",value:function(){this.triggerUpdate.cancel();this.update();return this.active}},
{key:"updateIfStale",value:function(){this.stale&&this.update()}},{key:"update",value:function(){var a=this.updater;this.stale=!1;a?this.setActive(a(this)):this.setActive(!1)}},{key:"setActive",value:function(a){this.stale=!1;if(this.active!==a||!0===a)this.active=a,this.changed.dispatch()}}]);return a}(),y=function(a){function d(a,b){p(this,d);var f=h(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));f.layerManager=a;f.mouseState=b;f.values=new Map;f.changed=new w.a;f.needsUpdate=!0;f.registerDisposer(b.changed.add(function(){f.handleChange()}));
f.registerDisposer(a.layersChanged.add(function(){f.handleLayerChange()}));return f}r(d,a);g(d,[{key:"handleLayerChange",value:function(){this.mouseState.active&&this.handleChange()}},{key:"handleChange",value:function(){this.needsUpdate=!0;this.changed.dispatch()}},{key:"update",value:function(){if(this.needsUpdate){this.needsUpdate=!1;var a=this.values,d=this.mouseState;a.clear();if(d.active)for(var b=d.position,f=$jscomp.makeIterator(this.layerManager.managedLayers),g=f.next();!g.done;g=f.next()){g=
g.value;var c=g.layer;g.visible&&c&&a.set(c,c.getValueAt(b,d))}}}},{key:"get",value:function(a){this.update();return this.values.get(a)}},{key:"toJSON",value:function(){this.update();for(var a={},d=this.values,b=$jscomp.makeIterator(this.layerManager.managedLayers),f=b.next();!f.done;f=b.next()){f=f.value;var g=f.layer;g&&(g=d.get(g),void 0!==g&&(g instanceof t.a&&(g={t:"u64",v:g}),a[f.name]=g))}return a}}]);return d}(n.a),G=function(a){function d(a,f,g,c){p(this,d);var k=h(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));
k.layerManager=a;k.renderLayerType=f;k.layerAdded=g;k.visibility=c;k.visibleLayers=new Map;k.newVisibleLayers=new Set;k.throttledUpdateVisibleLayers=b()(function(){k.updateVisibleLayers()},0);k.registerDisposer(a.layersChanged.add(function(){k.handleLayersChanged()}));k.updateVisibleLayers();return k}r(d,a);g(d,[{key:"handleLayersChanged",value:function(){this.throttledUpdateVisibleLayers()}},{key:"disposed",value:function(){this.throttledUpdateVisibleLayers.cancel();this.visibleLayers.forEach(function(a){return a()});
this.visibleLayers.clear();m(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"disposed",this).call(this)}},{key:"updateVisibleLayers",value:function(){for(var a=this.visibleLayers,d=this.newVisibleLayers,b=this.renderLayerType,f=this.layerAdded,g={},c=$jscomp.makeIterator(this.layerManager.readyRenderLayers()),k=c.next();!k.done;g={disposer:g.disposer,visibilityDisposer:g.visibilityDisposer,typedLayer:g.typedLayer},k=c.next())k=k.value,k instanceof b&&(g.typedLayer=k,d.add(g.typedLayer),
a.has(g.typedLayer)||(g.visibilityDisposer=g.typedLayer.visibility.add(this.visibility),g.disposer=f(g.typedLayer),a.set(g.typedLayer.addRef(),function(a){return function(){a.disposer();a.visibilityDisposer();a.typedLayer.dispose()}}(g))));b=$jscomp.makeIterator(a);for(f=b.next();!f.done;f=b.next())g=$jscomp.makeIterator(f.value),f=g.next().value,g=g.next().value,d.has(f)||(a.delete(f),g());d.clear()}},{key:"getVisibleLayers",value:function(){this.throttledUpdateVisibleLayers.flush();return[].concat($jscomp.arrayFromIterable(this.visibleLayers.keys()))}}]);
return d}(n.a)},function(n,e,c){function p(a,d){if(!(a instanceof d))throw new TypeError("Cannot call a class as a function");}function h(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 r(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 a(a,d){for(var b=$jscomp.makeIterator(t),g=b.next();!g.done;g=b.next())if(g=g.value,g=g(a,d),null!=g)return g;throw Error("No chunk format handler found.");}e.c=function(a){t.push(a)};c.d(e,"b",function(){return q});c.d(e,"a",function(){return m});n=c(46);var b=c(1),l=function(){function a(a,b){for(var d=0;d<b.length;d++){var f=b[d];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&
(f.writable=!0);Object.defineProperty(a,f.key,f)}}return function(d,b,g){b&&a(d.prototype,b);g&&a(d,g);return d}}(),w=b.p.create(),v=b.p.create(),t=[],q=function(g){function d(b,g){p(this,d);g=h(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,g));g.chunkFormatHandler=g.registerDisposer(a(b.chunkQueueManager.gl,g.spec));return g}r(d,g);l(d,[{key:"getValueAt",value:function(a,d){d=void 0===d?this.spec.chunkLayout:d;var f=this.spec,g=d.size;d.globalToLocalSpatial(v,a);for(a=0;3>a;++a)w[a]=Math.floor(v[a]/
g[a]);a=Object(b.q)(w);a=this.chunks.get(a);if(!a)return null;d=f.voxelSize;for(var c=0;3>c;++c)w[c]=Math.floor((v[c]-w[c]*g[c])/d[c]);g=a.chunkDataSize;for(d=0;3>d;++d)if(w[d]>=g[d])return;f=f.numChannels;if(1===f)return a.getChannelValueAt(w,0);g=Array(f);for(d=0;d<f;++d)g[d]=a.getChannelValueAt(w,d);return g}},{key:"getChunk",value:function(a){return this.chunkFormatHandler.getChunk(this,a)}},{key:"chunkFormat",get:function(){return this.chunkFormatHandler.chunkFormat}}]);return d}(n.c),m=function(a){function d(a,
b){p(this,d);return h(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,a,b))}r(d,a);l(d,[{key:"chunkFormat",get:function(){return this.source.chunkFormat}}]);return d}(n.b)},function(n,e,c){c.d(e,"a",function(){return p});e.b=1E-6;var p="undefined"!==typeof Float32Array?Float32Array:Array;e.c=Math.random},function(n,e,c){e.a=function(c){if(c instanceof Object){var a=c[p];void 0===a&&(a=c[p]=h++);return"o"+a}return""+JSON.stringify(c)};$jscomp.initSymbol();var p=Symbol("objectId"),h=0},function(n,
e,c){c.d(e,"a",function(){return r});var p=c(25),h=function(){function a(a,c){for(var b=0;b<c.length;b++){var l=c[b];l.enumerable=l.enumerable||!1;l.configurable=!0;"value"in l&&(l.writable=!0);Object.defineProperty(a,l.key,l)}}return function(b,c,e){c&&a(b.prototype,c);e&&a(b,e);return b}}(),r=function(){function a(b,c){c=void 0===c?p.a:c;if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");this.gl=b;this.bufferType=c;this.gl=b;this.buffer=b.createBuffer()}h(a,[{key:"bind",
value:function(){this.gl.bindBuffer(this.bufferType,this.buffer)}},{key:"bindToVertexAttrib",value:function(a,c,e,v,t,q){e=void 0===e?p.e:e;v=void 0===v?!1:v;t=void 0===t?0:t;q=void 0===q?0:q;this.bind();this.gl.enableVertexAttribArray(a);this.gl.vertexAttribPointer(a,c,e,v,t,q)}},{key:"setData",value:function(a,c){c=void 0===c?p.p:c;var b=this.gl;this.bind();b.bufferData(this.bufferType,a,c)}},{key:"dispose",value:function(){this.gl.deleteBuffer(this.buffer);this.gl=this.buffer=void 0}}],[{key:"fromData",
value:function(b,c,e,v){b=new a(b,e);b.setData(c,v);return b}}]);return a}()},function(n,e,c){e.d=16384;e.o=770;e.k=771;e.a=34962;e.p=35044;e.b=3042;e.n=3089;e.w=3317;e.y=5121;e.e=5126;e.l=6407;e.m=6408;e.h=6409;e.i=6410;e.f=35632;e.z=35633;e.j=9728;e.g=9729;e.s=10240;e.t=10241;e.u=10242;e.v=10243;e.r=3553;e.q=33984;e.c=33071;e.x=37440},function(n,e,c){e.b=function(c,a){h.set(c,a)};e.a=function(c){for(var a=new p.b,b=$jscomp.makeIterator(h),l=b.next();!l.done;l=b.next()){var e=$jscomp.makeIterator(l.value);
l=e.next().value;e=e.next().value;a.register(l,e(c))}return a};var p=c(30),h=new Map},function(n,e,c){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 h(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
}function r(a){var b=q.get(a),d=a.changed.count;if(void 0!==b&&b.generation===d)return b;if(a instanceof v){var f=a.baseJSON();for(var c=$jscomp.makeIterator(a.children),m=c.next();!m.done;m=c.next()){var l=$jscomp.makeIterator(m.value);m=l.next().value;l=l.next().value;f[m]=r(l).value}}else f=a.toJSON();void 0===b?(b={generation:d,value:f},q.set(a,b)):(b.generation=d,b.value=f);return b}c.d(e,"a",function(){return v});c.d(e,"b",function(){return t});e.c=r;var a=c(2),b=c(3),l=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)}},w=function(){function a(a,b){for(var d=0;d<b.length;d++){var f=b[d];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}return function(d,b,c){b&&a(d.prototype,b);c&&a(d,c);return d}}(),v=function(){function c(){h(this,c);this.children=
new Map;this.changed=new b.a}w(c,[{key:"add",value:function(a,b){var d=this;if(this.children.has(a))throw Error("Key "+JSON.stringify(a)+" already registered.");this.children.set(a,b);b.changed.add(this.changed.dispatch);this.changed.dispatch();return function(){d.remove(a)}}},{key:"remove",value:function(a){var d=this.children;if(d.has(a))throw Error("Key "+JSON.stringify(a)+" not registered.");d=d.get(a);this.children.delete(a);d.changed.remove(this.changed.dispatch);this.changed.dispatch()}},{key:"dispose",
value:function(){for(var a=this.changed,b=$jscomp.makeIterator(this.children.values()),c=b.next();!c.done;c=b.next())c.value.changed.remove(a.dispatch);this.children=void 0}},{key:"toJSON",value:function(){for(var a=this.baseJSON(),b=$jscomp.makeIterator(this.children),c=b.next();!c.done;c=b.next()){var g=$jscomp.makeIterator(c.value);c=g.next().value;g=g.next().value;a[c]=g.toJSON()}return a}},{key:"baseJSON",value:function(){return{}}},{key:"reset",value:function(){for(var a=$jscomp.makeIterator(this.children.values()),
b=a.next();!b.done;b=a.next())b.value.reset()}},{key:"restoreState",value:function(d){Object(a.u)(d);for(var b=$jscomp.makeIterator(this.children),c=b.next();!c.done;c=b.next()){var g=$jscomp.makeIterator(c.value);c=g.next().value;g=g.next().value;try{d.hasOwnProperty(c)&&g.restoreState(d[c])}catch(B){throw Error("Error restoring property "+JSON.stringify(c)+": "+B.message);}}}}]);return c}(),t=function(b){function d(){h(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.lastState={};return a}p(d,b);w(d,[{key:"restoreState",value:function(b){Object(a.u)(b);this.lastState=b;l(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"restoreState",this).call(this,b)}},{key:"reset",value:function(){this.lastState={};l(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"reset",this).call(this)}},{key:"baseJSON",
value:function(){for(var a=Object.assign(l(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"baseJSON",this).call(this),this.lastState),b=$jscomp.makeIterator(this.children.keys()),c=b.next();!c.done;c=b.next())delete a[c.value];return a}},{key:"toJSON",value:function(){var a=l(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"toJSON",this).call(this);return this.lastState=a}},{key:"add",value:function(a,b){var f=l(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"add",
this).call(this,a,b);a=this.lastState[a];void 0!==a&&(b.reset(),b.restoreState(a));return f}}]);return d}(v),q=new WeakMap},function(n,e,c){(function(p,h){var r;(function(){function a(d,b){function f(a){var d;if(f[a]!==h)return f[a];if("bug-string-char-index"==a)var k=!1;else if("json"==a)k=f("json-stringify")&&f("json-parse");else{var q;if("json-stringify"==a){k=b.stringify;var l="function"==typeof k&&r;if(l){(q=function(){return 1}).toJSON=q;try{l="0"===k(0)&&"0"===k(new c)&&'""'==k(new g)&&k(D)===
h&&k(h)===h&&k()===h&&"1"===k(q)&&"[1]"==k([q])&&"[null]"==k([h])&&"null"==k(null)&&"[null,null,null]"==k([h,D,null])&&'{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}'==k({a:[q,!0,!1,null,"\x00\b\n\f\r\t"]})&&"1"===k(null,q)&&"[\n 1,\n 2\n]"==k([1,2],null,1)&&'"-271821-04-20T00:00:00.000Z"'==k(new m(-864E13))&&'"+275760-09-13T00:00:00.000Z"'==k(new m(864E13))&&'"-000001-01-01T00:00:00.000Z"'==k(new m(-621987552E5))&&'"1969-12-31T23:59:59.999Z"'==k(new m(-1))}catch(ab){l=!1}}k=l}if("json-parse"==
a){k=b.parse;if("function"==typeof k)try{if(0===k("0")&&!k(!1)&&(q=k('{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}'),d=5==q.a.length&&1===q.a[0])){try{d=!k('"\t"')}catch(ab){}if(d)try{d=1!==k("01")}catch(ab){}if(d)try{d=1!==k("1.")}catch(ab){}}}catch(ab){d=!1}k=d}}return f[a]=!!k}d||(d=v.Object());b||(b=v.Object());var c=d.Number||v.Number,g=d.String||v.String,k=d.Object||v.Object,m=d.Date||v.Date,q=d.SyntaxError||v.SyntaxError,e=d.TypeError||v.TypeError,t=d.Math||v.Math;d=d.JSON||v.JSON;"object"==
typeof d&&d&&(b.stringify=d.stringify,b.parse=d.parse);k=k.prototype;var D=k.toString,w,h,r=new m(-0xc782b5b800cec);try{r=-109252==r.getUTCFullYear()&&0===r.getUTCMonth()&&1===r.getUTCDate()&&10==r.getUTCHours()&&37==r.getUTCMinutes()&&6==r.getUTCSeconds()&&708==r.getUTCMilliseconds()}catch(Ib){}if(!f("json")){var p=f("bug-string-char-index");if(!r){var n=t.floor;var V=[0,31,59,90,120,151,181,212,243,273,304,334];var S=function(a,d){return V[d]+365*(a-1970)+n((a-1969+(d=+(1<d)))/4)-n((a-1901+d)/100)+
n((a-1601+d)/400)}}(w=k.hasOwnProperty)||(w=function(a){var d={};if((d.__proto__=null,d.__proto__={toString:1},d).toString!=D)w=function(a){var d=this.__proto__;a=a in(this.__proto__=null,this);this.__proto__=d;return a};else{var b=d.constructor;w=function(a){var d=(this.constructor||b).prototype;return a in this&&!(a in d&&this[a]===d[a])}}d=null;return w.call(this,a)});var L=function(a,d){var b=0,f,c;(f=function(){this.valueOf=0}).prototype.valueOf=0;var g=new f;for(c in g)w.call(g,c)&&b++;f=g=
null;b?L=2==b?function(a,d){var b={},f="[object Function]"==D.call(a),c;for(c in a)f&&"prototype"==c||w.call(b,c)||!(b[c]=1)||!w.call(a,c)||d(c)}:function(a,d){var b="[object Function]"==D.call(a),f,c;for(f in a)b&&"prototype"==f||!w.call(a,f)||(c="constructor"===f)||d(f);(c||w.call(a,f="constructor"))&&d(f)}:(g="valueOf toString toLocaleString propertyIsEnumerable isPrototypeOf hasOwnProperty constructor".split(" "),L=function(a,d){var b="[object Function]"==D.call(a),f,c=!b&&"function"!=typeof a.constructor&&
l[typeof a.hasOwnProperty]&&a.hasOwnProperty||w;for(f in a)b&&"prototype"==f||!c.call(a,f)||d(f);for(b=g.length;f=g[--b];c.call(a,f)&&d(f));});return L(a,d)};if(!f("json-stringify")){var Q={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"},X=function(a,d){return("000000"+(d||0)).slice(-a)},da=function(a){for(var d='"',b=0,f=a.length,c=!p||10<f,g=c&&(p?a.split(""):a);b<f;b++){var k=a.charCodeAt(b);switch(k){case 8:case 9:case 10:case 12:case 13:case 34:case 92:d+=Q[k];break;default:d=
32>k?d+("\\u00"+X(2,k.toString(16))):d+(c?g[b]:a.charAt(b))}}return d+'"'},J=function(a,d,b,f,c,g,k){var m;try{var q=d[a]}catch(Zd){}if("object"==typeof q&&q){var l=D.call(q);if("[object Date]"!=l||w.call(q,"toJSON"))"function"==typeof q.toJSON&&("[object Number]"!=l&&"[object String]"!=l&&"[object Array]"!=l||w.call(q,"toJSON"))&&(q=q.toJSON(a));else if(q>-1/0&&q<1/0){if(S){var t=n(q/864E5);for(l=n(t/365.2425)+1970-1;S(l+1,0)<=t;l++);for(m=n((t-S(l,0))/30.42);S(l,m+1)<=t;m++);t=1+t-S(l,m);var x=
(q%864E5+864E5)%864E5;var v=n(x/36E5)%24;var A=n(x/6E4)%60;var H=n(x/1E3)%60;x%=1E3}else l=q.getUTCFullYear(),m=q.getUTCMonth(),t=q.getUTCDate(),v=q.getUTCHours(),A=q.getUTCMinutes(),H=q.getUTCSeconds(),x=q.getUTCMilliseconds();q=(0>=l||1E4<=l?(0>l?"-":"+")+X(6,0>l?-l:l):X(4,l))+"-"+X(2,m+1)+"-"+X(2,t)+"T"+X(2,v)+":"+X(2,A)+":"+X(2,H)+"."+X(3,x)+"Z"}else q=null}b&&(q=b.call(d,a,q));if(null===q)return"null";l=D.call(q);if("[object Boolean]"==l)return""+q;if("[object Number]"==l)return q>-1/0&&q<1/
0?""+q:"null";if("[object String]"==l)return da(""+q);if("object"==typeof q){for(a=k.length;a--;)if(k[a]===q)throw e();k.push(q);var B=[];d=g;g+=c;if("[object Array]"==l){m=0;for(a=q.length;m<a;m++)l=J(m,q,b,f,c,g,k),B.push(l===h?"null":l);a=B.length?c?"[\n"+g+B.join(",\n"+g)+"\n"+d+"]":"["+B.join(",")+"]":"[]"}else L(f||q,function(a){var d=J(a,q,b,f,c,g,k);d!==h&&B.push(da(a)+":"+(c?" ":"")+d)}),a=B.length?c?"{\n"+g+B.join(",\n"+g)+"\n"+d+"}":"{"+B.join(",")+"}":"{}";k.pop();return a}};b.stringify=
function(a,d,b){var f;if(l[typeof d]&&d)if("[object Function]"==(f=D.call(d)))var c=d;else if("[object Array]"==f){var g={};for(var k=0,m=d.length,q;k<m;q=d[k++],(f=D.call(q),"[object String]"==f||"[object Number]"==f)&&(g[q]=1));}if(b)if("[object Number]"==(f=D.call(b))){if(0<(b-=b%1)){var e="";for(10<b&&(b=10);e.length<b;e+=" ");}}else"[object String]"==f&&(e=10>=b.length?b:b.slice(0,10));return J("",(q={},q[""]=a,q),c,g,e,"",[])}}if(!f("json-parse")){var O=g.fromCharCode,Na={92:"\\",34:'"',47:"/",
98:"\b",116:"\t",110:"\n",102:"\f",114:"\r"},M,Oa,ea=function(){M=Oa=null;throw q();},N=function(){for(var a=Oa,d=a.length,b,f,c,g,k;M<d;)switch(k=a.charCodeAt(M),k){case 9:case 10:case 13:case 32:M++;break;case 123:case 125:case 91:case 93:case 58:case 44:return b=p?a.charAt(M):a[M],M++,b;case 34:b="@";for(M++;M<d;)if(k=a.charCodeAt(M),32>k)ea();else if(92==k)switch(k=a.charCodeAt(++M),k){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:b+=Na[k];M++;break;case 117:f=++M;for(c=
M+4;M<c;M++)k=a.charCodeAt(M),48<=k&&57>=k||97<=k&&102>=k||65<=k&&70>=k||ea();b+=O("0x"+a.slice(f,M));break;default:ea()}else{if(34==k)break;k=a.charCodeAt(M);for(f=M;32<=k&&92!=k&&34!=k;)k=a.charCodeAt(++M);b+=a.slice(f,M)}if(34==a.charCodeAt(M))return M++,b;ea();default:f=M;45==k&&(g=!0,k=a.charCodeAt(++M));if(48<=k&&57>=k){for(48==k&&(k=a.charCodeAt(M+1),48<=k&&57>=k)&&ea();M<d&&(k=a.charCodeAt(M),48<=k&&57>=k);M++);if(46==a.charCodeAt(M)){for(c=++M;c<d&&(k=a.charCodeAt(c),48<=k&&57>=k);c++);c==
M&&ea();M=c}k=a.charCodeAt(M);if(101==k||69==k){k=a.charCodeAt(++M);43!=k&&45!=k||M++;for(c=M;c<d&&(k=a.charCodeAt(c),48<=k&&57>=k);c++);c==M&&ea();M=c}return+a.slice(f,M)}g&&ea();if("true"==a.slice(M,M+4))return M+=4,!0;if("false"==a.slice(M,M+5))return M+=5,!1;if("null"==a.slice(M,M+4))return M+=4,null;ea()}return"$"},Sa=function(a){var d,b;"$"==a&&ea();if("string"==typeof a){if("@"==(p?a.charAt(0):a[0]))return a.slice(1);if("["==a){for(d=[];;b||(b=!0)){a=N();if("]"==a)break;b&&(","==a?(a=N(),"]"==
a&&ea()):ea());","==a&&ea();d.push(Sa(a))}return d}if("{"==a){for(d={};;b||(b=!0)){a=N();if("}"==a)break;b&&(","==a?(a=N(),"}"==a&&ea()):ea());","!=a&&"string"==typeof a&&"@"==(p?a.charAt(0):a[0])&&":"==N()||ea();d[a.slice(1)]=Sa(N())}return d}ea()}return a},Ta=function(a,d,b){b=Ba(a,d,b);b===h?delete a[d]:a[d]=b},Ba=function(a,d,b){var f=a[d],c;if("object"==typeof f&&f)if("[object Array]"==D.call(f))for(c=f.length;c--;)Ta(f,c,b);else L(f,function(a){Ta(f,a,b)});return b.call(a,d,f)};b.parse=function(a,
d){var b;M=0;Oa=""+a;a=Sa(N());"$"!=N()&&ea();M=Oa=null;return d&&"[object Function]"==D.call(d)?Ba((b={},b[""]=a,b),"",d):a}}}b.runInContext=a;return b}var b=c(251),l={"function":!0,object:!0},w=l[typeof e]&&e&&!e.nodeType&&e,v=l[typeof window]&&window||this,t=w&&l[typeof p]&&p&&!p.nodeType&&"object"==typeof h&&h;!t||t.global!==t&&t.window!==t&&t.self!==t||(v=t);if(w&&!b)a(v,w);else{var q=v.JSON,m=v.JSON3,g=!1;var d=a(v,v.JSON3={noConflict:function(){g||(g=!0,v.JSON=q,v.JSON3=m,q=m=null);return d}});
v.JSON={parse:d.parse,stringify:d.stringify}}b&&!(r=d,void 0!==r&&(p.exports=r))}).call(this)}).call(e,c(250)(n),c(5))},function(n,e,c){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 h(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
}c.d(e,"b",function(){return l});c.d(e,"c",function(){return w});e.d=function(a,c){return new Promise(function(q,m){if(a===b)c(q,m,b);else{var g=new l,d=a.add(function(){g.cancel()});c(function(a){d();q(a)},function(a){d();m(a)},g)}})};var r=function(){function a(a,b){for(var c=0;c<b.length;c++){var g=b[c];g.enumerable=g.enumerable||!1;g.configurable=!0;"value"in g&&(g.writable=!0);Object.defineProperty(a,g.key,g)}}return function(b,c,m){c&&a(b.prototype,c);m&&a(b,m);return b}}();n=new (function(){function a(){h(this,
a);this.name="CancellationError";this.message="CANCELED"}r(a,[{key:"toString",value:function(){return"CANCELED"}}]);return a}());e.a=n;var a=function(){},b={isCanceled:!1,add:function(){return a},remove:a};e.e=b;var l=function(){function b(){h(this,b)}r(b,[{key:"cancel",value:function(){var a=this.handlers;if(null!==a&&(this.handlers=null,void 0!==a)){a=$jscomp.makeIterator(a);for(var b=a.next();!b.done;b=a.next())b=b.value,b()}}},{key:"add",value:function(b){var c=this,m=this.handlers;if(null===
m)return b(),a;void 0===m&&(m=this.handlers=new Set);m.add(b);return function(){c.remove(b)}}},{key:"remove",value:function(a){var b=this.handlers;null!=b&&b.delete(a)}},{key:"isCanceled",get:function(){return null===this.handlers}}]);return b}(),w=function(a){function c(){h(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");a=!a||"object"!==typeof a&&"function"!==typeof a?this:
a;a.consumers=new Set;return a}p(c,a);r(c,[{key:"addConsumer",value:function(a){var c=this;a=void 0===a?b:a;var g=this.consumers;g.has(a)||a.isCanceled||(g.add(a),a.add(function(){g.delete(a);0===g.size&&c.cancel()}))}}]);return c}(l)},function(n,e,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function h(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 r(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){void 0===b&&(b=-1===a.indexOf("/")?":":"/");a=a.lastIndexOf(b);return-1===a?0:a+1}c.d(e,"a",function(){return v});c.d(e,"b",function(){return q});var b=c(29),l=c(42);
n=c(0);var w=function(){function a(a,d){for(var b=0;b<d.length;b++){var c=d[b];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,f){d&&a(b.prototype,d);f&&a(b,f);return b}}(),v=function(a){function b(){p(this,b);return h(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}r(b,a);return b}(n.a),t=/^(?:([a-zA-Z-+_]+):\/\/)?(.*)$/,q=function(c){function g(){p(this,g);var a=h(this,(g.__proto__||Object.getPrototypeOf(g)).apply(this,
arguments));a.dataSources=new Map;return a}r(g,c);w(g,[{key:"register",value:function(a,b){this.dataSources.set(a,this.registerDisposer(b))}},{key:"getDataSource",value:function(a){a=a.match(t);if(null===a||void 0===a[1])throw Error('Data source URL must have the form "<protocol>://<path>".');var d=a[1],b=this.dataSources.get(d);if(void 0===b)throw Error("Unsupported data source: "+JSON.stringify(d)+".");return[b,a[2],d]}},{key:"getVolume",value:function(a,f,c,g){c=void 0===c?{}:c;g=void 0===g?b.e:
g;f=$jscomp.makeIterator(this.getDataSource(f));var d=f.next().value,k=f.next().value;return new Promise(function(b){b(d.getVolume(a,k,c,g))})}},{key:"getVectorGraphicsSource",value:function(a,f,c,g){c=void 0===c?{}:c;g=void 0===g?b.e:g;f=$jscomp.makeIterator(this.getDataSource(f));var d=f.next().value,k=f.next().value;return new Promise(function(b){b(d.getVectorGraphicsSource(a,k,c,g))})}},{key:"getMeshSource",value:function(a,f,c){c=void 0===c?b.e:c;f=$jscomp.makeIterator(this.getDataSource(f));
var d=f.next().value,g=f.next().value;return new Promise(function(b){b(d.getMeshSource(a,g,c))})}},{key:"getSkeletonSource",value:function(a,f,c){c=void 0===c?b.e:c;f=$jscomp.makeIterator(this.getDataSource(f));var d=f.next().value,g=f.next().value;return new Promise(function(b){b(d.getSkeletonSource(a,g,c))})}},{key:"volumeCompleter",value:function(a,f,c){c=void 0===c?b.e:c;var d=a.match(t),g=d[1];if(void 0===g){f=[];c=$jscomp.makeIterator(this.dataSources);for(d=c.next();!d.done;d=c.next()){var k=
$jscomp.makeIterator(d.value);d=k.next().value;k=k.next().value;d+="://";d.startsWith(a)&&f.push({value:d,description:k.description})}return Promise.resolve({offset:0,completions:f})}a=this.dataSources.get(g);return void 0!==a&&void 0!==a.volumeCompleter?a.volumeCompleter(d[2],f,c).then(function(a){return Object(l.a)(g.length+3,a)}):Promise.reject(null)}},{key:"suggestLayerName",value:function(d){d=$jscomp.makeIterator(this.getDataSource(d));var b=d.next().value;d=d.next().value;b=b.suggestLayerName;
if(void 0!==b)return b(d);b=a(d,void 0);return d.substring(b)}},{key:"findSourceGroup",value:function(d){var b=$jscomp.makeIterator(this.getDataSource(d));d=b.next().value;var c=b.next().value;b=b.next().value;return(d.findSourceGroup||a)(c)+b.length+3}}]);return g}(n.a)},function(n,e){},function(n,e,c){function p(a,d){if(!(a instanceof d))throw new TypeError("Cannot call a class as a function");}function h(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 r(a,d,b){for(var f=0;3>f;++f)a[f]=Number.POSITIVE_INFINITY,d[f]=Number.NEGATIVE_INFINITY;b=$jscomp.makeIterator(b);for(f=b.next();!f.done;f=b.next()){var c=f.value.spec;f=c.lowerChunkBound;c=c.upperChunkBound;for(var g=0;3>g;++g)a[g]=Math.min(a[g],f[g]),d[g]=Math.max(d[g],c[g])}}function a(a,d,b,f){for(var c=
B.FULLY_INSIDE,g=0;3>g;++g){var k=a[g];var m=d[g],l=b[g],q=f[g];k=k>=q||m<=l?B.FULLY_OUTSIDE:k>=l&&m<=q?B.FULLY_INSIDE:B.PARTIALLY_INSIDE;switch(k){case B.FULLY_OUTSIDE:return k;case B.PARTIALLY_INSIDE:c=k}}return c}function b(a){var d=a.transform,b=a.transformedSources,c=d.changed.count;c!==a.transformedSourcesGeneration&&(a.transformedSourcesGeneration=c,b=f.j.equals(d.transform,f.d)?a.sources.map(function(a){return a.map(function(a){return{source:a,chunkLayout:a.spec.chunkLayout}})}):a.sources.map(function(a){return a.map(function(a){var b=
a.spec.chunkLayout;return{chunkLayout:q.a.get(b.size,t(b.transform,d)),source:a}})}),a.transformedSources=b);return b}function l(a,d){var b=d.length,f=0;if(1<b)for(var c=0,g=0;g<b;++g){var k=d[g].chunkLayout;var m=k.size;k=k.globalToLocalSpatialVector(x,a);for(var l=0,q=0,e=1,t=0;3>t;++t){var w=m[t];e*=w;w*=k[t];l=Math.min(l,w);q=Math.max(q,w)}m=e/(q-l);m>c&&(c=m,f=g)}return d[f]}function w(a){var d=a.voxelSize,b=void 0===a.lowerVoxelBound?f.h:a.lowerVoxelBound,c=a.upperVoxelBound,g=void 0===a.maxVoxelsPerChunkLog2?
18:a.maxVoxelsPerChunkLog2;a=void 0===a.transform?f.d:a.transform;a=Object(f.c)(f.p.create(),a);d=f.p.multiply(a,a,d);a=f.p.fromValues(1,1,1);if(void 0===c)var k=f.f;else{k=f.p.create();for(var m=0;3>m;++m)k[m]=Math.pow(2,Math.floor(Math.log2(c[m]-b[m])))}for(b=0;b<g;++b){c=Infinity;m=-1;for(var l=0;3>l;++l)if(!(a[l]>=k[l])){var q=a[l]*d[l];q<c&&(c=q,m=l)}c=m;if(-1===c)break;a[c]*=2}return a}function v(a){var d=a.flatDimension,b=a.voxelSize,c=a.maxVoxelsPerChunkLog2,g=a.transform;f.p.subtract(x,void 0===
a.upperVoxelBound?f.f:a.upperVoxelBound,void 0===a.lowerVoxelBound?f.h:a.lowerVoxelBound);x[d]=1;return w({voxelSize:b,upperVoxelBound:x,maxVoxelsPerChunkLog2:c,transform:g})}function t(a,d){d=d.transform;return void 0===d?void 0===a?f.d:a:void 0===a?d:f.j.multiply(f.j.create(),d,a)}e.o=b;c.d(e,"j",function(){return C});e.n=w;e.p=v;c.d(e,"a",function(){return y});e.m=t;e.l=function(a){if(void 0!==a.chunkDataSizes)return a.chunkDataSizes;var d=void 0===a.chunkLayoutPreference?y.ISOTROPIC:a.chunkLayoutPreference;
switch(d){case y.ISOTROPIC:return[w(a)];case y.FLAT:d=[];for(var b=0;3>b;++b)d[b]=v({flatDimension:b,voxelSize:a.voxelSize,lowerVoxelBound:a.lowerVoxelBound,upperVoxelBound:a.upperVoxelBound,maxVoxelsPerChunkLog2:a.maxVoxelsPerChunkLog2,transform:a.transform});d.push(w(a));return d}throw Error("Invalid chunk layout preference: "+d+".");};c.d(e,"k",function(){return G});var q=c(175),m=c(102),g=c(176),d=c(38),f=c(1);n=c(16);c.d(e,"c",function(){return d.b});var k=function(){function a(a,d){for(var b=
0;b<d.length;b++){var f=d[b];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}return function(d,b,f){b&&a(d.prototype,b);f&&a(d,f);return d}}(),x=f.p.create(),B;(function(a){a[a.FULLY_OUTSIDE=0]="FULLY_OUTSIDE";a[a.FULLY_INSIDE=1]="FULLY_INSIDE";a[a.PARTIALLY_INSIDE=2]="PARTIALLY_INSIDE"})(B||(B={}));var E=[f.p.create(),f.p.create(),f.p.create(),f.p.create()],C=function(d){function c(){p(this,c);var a=(c.__proto__||Object.getPrototypeOf(c)).call(this);
if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");a=!a||"object"!==typeof a&&"function"!==typeof a?this:a;a.width=-1;a.height=-1;a.hasViewportToData=!1;a.hasValidViewport=!1;a.viewportToData=f.j.create();a.viewportAxes=[f.p.create(),f.p.create(),f.p.create()];a.previousViewportAxes=[f.p.create(),f.p.create()];a.centerDataPosition=f.p.create();a.viewportPlaneDistanceToOrigin=0;a.visibleChunkLayouts=new Map;a.visibleLayers=new Map;a.visibleSourcesStale=!0;
a.pixelSize=0;f.j.identity(a.viewportToData);return a}h(c,d);k(c,[{key:"onViewportChanged",value:function(){}},{key:"maybeSetHasValidViewport",value:function(){!this.hasValidViewport&&-1!==this.width&&-1!==this.height&&this.hasViewportToData&&(this.hasValidViewport=!0,this.onHasValidViewport());if(this.hasValidViewport)this.onViewportChanged()}},{key:"onHasValidViewport",value:function(){}},{key:"setViewportSize",value:function(a,d){return a!==this.width||d!==this.height?(this.width=a,this.height=
d,this.maybeSetHasValidViewport(),!0):!1}},{key:"setViewportToDataMatrix",value:function(a){if(this.hasViewportToData&&f.j.equals(this.viewportToData,a))return!1;this.hasViewportToData=!0;var d=this.viewportToData;f.j.copy(d,a);Object(f.m)(d);f.p.transformMat4(this.centerDataPosition,f.h,a);a=0;for(var b=this.viewportAxes,c=this.previousViewportAxes,k=0;3>k;++k){var m=b[k];Object(f.n)(m,f.e[k],d);0===k&&(a=f.p.length(m));f.p.normalize(m,m)}this.viewportAxes=b;this.previousViewportAxes=c;if(!Object(g.a)(a,
this.pixelSize)||.95>f.p.dot(b[0],c[0])||.95>f.p.dot(b[1],c[1]))f.p.copy(c[0],b[0]),f.p.copy(c[1],b[1]),this.visibleSourcesStale=!0,this.pixelSize=a;this.viewportPlaneDistanceToOrigin=f.p.dot(this.centerDataPosition,this.viewportAxes[2]);this.onViewportToDataMatrixChanged();this.maybeSetHasValidViewport();return!0}},{key:"onViewportToDataMatrixChanged",value:function(){}},{key:"updateVisibleSources",value:function(){if(this.visibleSourcesStale){this.visibleSourcesStale=!1;var a=1.1*this.pixelSize,
d=this.visibleChunkLayouts,f=this.viewportAxes[2],c=this.visibleLayers;d.clear();var g={};c=$jscomp.makeIterator(c);for(var k=c.next();!k.done;g={smallestVoxelSize:g.smallestVoxelSize,visibleSources:g.visibleSources},k=c.next()){k=$jscomp.makeIterator(k.value);var m=k.next().value;g.visibleSources=k.next().value;g.visibleSources.length=0;k=b(m);var q=k.length;m=void 0;g.smallestVoxelSize=k[0][0].source.spec.voxelSize;var e=function(d){return function(b){for(var f=0;3>f;++f){var c=b[f];if(c>a&&c>d.smallestVoxelSize[f])return!0}return!1}}(g),
x=function(a){return function(b,f){var c=b.source,g=b.chunkLayout;a.visibleSources[a.visibleSources.length++]=b;b=d.get(g);void 0===b&&(b=new Map,d.set(g,b));b.set(c,f)}}(g);for(m=q-1;;){q=l(f,k[m]);x(q,m);if(0===m||!e(q.source.spec.voxelSize))break;--m}g.visibleSources.reverse()}}}},{key:"computeVisibleChunks",value:function(d,b){var c=this;this.updateVisibleSources();for(var g=this.width,k=this.height,l=this.viewportToData,q=0;3>q;++q)E[0][q]=-f.e[0][q]*g/2-f.e[1][q]*k/2,E[1][q]=-f.e[0][q]*g/2+
f.e[1][q]*k/2,E[2][q]=f.e[0][q]*g/2-f.e[1][q]*k/2,E[3][q]=f.e[0][q]*g/2+f.e[1][q]*k/2;for(g=0;4>g;++g)f.p.transformMat4(E[g],E[g],l);var e=f.p.create(),t=f.p.create(),w=f.p.create(),D=f.p.create(),v=f.p.create(),H=f.p.create(),A=[],h=[];this.visibleChunkLayouts.forEach(function(g,k){function q(){for(var a=0,d=0,b=0;3>b;++b){var f=H[b],c=e[b],g=t[b]-c,k=v[b]*g;a+=f*(c+k);d+=f*(c+g-k)}return a<G?!1:d<=G}function l(d){function f(){n=Object(m.b)(A,0,v,function(d){var b=d.spec;switch(a(e,t,b.lowerChunkBound,
b.upperChunkBound)){case B.PARTIALLY_INSIDE:return!0;case B.FULLY_INSIDE:h.push(d);default:return!1}})}if(0!==h.length||0!==n){for(var c=1,g=0;3>g;++g)c*=Math.max(0,t[g]-e[g]);if(0!==c&&q())if(1===c)b(k,y,e,h);else{for(var x;;)if(c=e[d],g=t[d],x=g-c,1===x)d=(d+1)%3;else break;x=c+Math.floor(.5*x);var w=(d+1)%3,D=h.length;t[d]=x;var v=n;f();l(w);h.length=D;n=v;t[d]=g;e[d]=x;f();l(w);e[d]=c;h.length=D;n=v}}}var y=d(k);r(w,D,g.keys());f.p.set(e,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY);
f.p.set(t,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);k.globalToLocalSpatialVector(H,c.viewportAxes[2]);for(var p=0;3>p;++p)v[p]=0<H[p]?1:0;var G=f.p.dot(k.globalToLocalGrid(x,c.centerDataPosition),H);for(p=0;4>p;++p)for(var F=k.globalToLocalGrid(x,E[p]),I=0;3>I;++I)e[I]=Math.min(e[I],Math.floor(F[I])),t[I]=Math.max(t[I],Math.floor(F[I])+1);f.p.max(e,e,w);f.p.min(t,t,D);h.length=0;A.length=0;g=$jscomp.makeIterator(g.keys());for(p=g.next();!p.done;p=g.next())switch(p=
p.value,F=p.spec,a(e,t,F.lowerChunkBound,F.upperChunkBound)){case B.FULLY_INSIDE:h.push(p);break;case B.PARTIALLY_INSIDE:A.push(p)}var n=A.length;l(0)})}}]);return c}(n.b);e.b=18;var y;(function(a){a[a.ISOTROPIC=0]="ISOTROPIC";a[a.FLAT=1]="FLAT"})(y||(y={}));var G=function H(a){p(this,H);var d=void 0===a.lowerVoxelBound?f.h:a.lowerVoxelBound,b=a.upperVoxelBound,c=a.chunkDataSize,g=a.voxelSize,k=a.transform,m=void 0===a.baseVoxelOffset?f.h:a.baseVoxelOffset,l=void 0===a.lowerClipBound?f.p.multiply(f.p.create(),
g,d):a.lowerClipBound,e=void 0===a.upperClipBound?f.p.multiply(f.p.create(),g,b):a.upperClipBound;this.voxelSize=g;this.chunkDataSize=c;this.chunkLayout=q.a.get(f.p.multiply(f.p.create(),a.chunkDataSize,g),k);this.lowerClipBound=l;this.upperClipBound=e;this.lowerVoxelBound=d;this.upperVoxelBound=b;this.baseVoxelOffset=m;a=this.lowerChunkBound=f.p.create();g=this.upperChunkBound=f.p.create();for(k=0;3>k;++k)a[k]=Math.floor(d[k]/c[k]),g[k]=Math.floor((b[k]-1)/c[k]+1)};e.h="SliceView";e.f="sliceview/RenderLayer";
e.d="SliceView.addVisibleLayer";e.e="SliceView.removeVisibleLayer";e.i="SliceView.updateView";e.g="SliceView.updateTransform"},function(n,e,c){c.d(e,"a",function(){return r});var p=function(){function a(a,c){for(var b=0;b<c.length;b++){var l=c[b];l.enumerable=l.enumerable||!1;l.configurable=!0;"value"in l&&(l.writable=!0);Object.defineProperty(a,l.key,l)}}return function(b,c,e){c&&a(b.prototype,c);e&&a(b,e);return b}}();c(177);var h=null,r=function(){function a(b){b=void 0===b?!1:b;if(!(this instanceof
a))throw new TypeError("Cannot call a class as a function");null===h&&(h=document.createElement("ul"),h.id="statusContainer",document.body.appendChild(h));var c=document.createElement("li");this.element=c;!0===b&&(b=200);!1!==b?(this.setVisible(!1),this.timer=setTimeout(this.setVisible.bind(this,!0),b)):this.timer=null;h.appendChild(c)}p(a,[{key:"dispose",value:function(){h.removeChild(this.element);this.element=void 0;null!==this.timer&&clearTimeout(this.timer)}},{key:"setText",value:function(a,
c){this.element.textContent=a;c&&this.setVisible(!0)}},{key:"setHTML",value:function(a,c){this.element.innerHTML=a;c&&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:"forPromise",value:function(b,c){var l=new a(c.delay);l.setText(c.initialMessage);var e=l.dispose.bind(l);b.then(e,function(a){l.element.textContent=(void 0===c.errorPrefix?"":c.errorPrefix)+(a instanceof Error?
a.message:""+a)+"  ";a=document.createElement("button");a.textContent="Dismiss";a.addEventListener("click",function(){l.dispose()});l.element.appendChild(a);l.setVisible(!0)});return b}},{key:"showMessage",value:function(b){var c=new a;c.element.textContent=b;c.setVisible(!0);return c}},{key:"showTemporaryMessage",value:function(a,c){c=void 0===c?2E3:c;var b=this.showMessage(a);setTimeout(function(){return b.dispose()},c);return b}}]);return a}()},function(n,e,c){(function(e){var h=c(40),r={},a=!1,
b=e.chrome&&e.chrome.app&&e.chrome.app.runtime;n.exports={attachEvent:function(a,b){"undefined"!==typeof e.addEventListener?e.addEventListener(a,b,!1):e.document&&e.attachEvent&&(e.document.attachEvent("on"+a,b),e.attachEvent("on"+a,b))},detachEvent:function(a,b){"undefined"!==typeof e.addEventListener?e.removeEventListener(a,b,!1):e.document&&e.detachEvent&&(e.document.detachEvent("on"+a,b),e.detachEvent("on"+a,b))},unloadAdd:function(c){if(b)return null;var l=h.string(8);r[l]=c;a&&setTimeout(this.triggerUnloadCallbacks,
0);return l},unloadDel:function(a){a in r&&delete r[a]},triggerUnloadCallbacks:function(){for(var a in r)r[a](),delete r[a]}};b||n.exports.attachEvent("unload",function(){a||(a=!0,n.exports.triggerUnloadCallbacks())})}).call(e,c(5))},function(n,e,c){c.d(e,"d",function(){return p});var p;(function(c){c[c.GPU_MEMORY=0]="GPU_MEMORY";c[c.SYSTEM_MEMORY=1]="SYSTEM_MEMORY";c[c.SYSTEM_MEMORY_WORKER=2]="SYSTEM_MEMORY_WORKER";c[c.DOWNLOADING=3]="DOWNLOADING";c[c.QUEUED=4]="QUEUED";c[c.NEW=5]="NEW";c[c.FAILED=
6]="FAILED";c[c.EXPIRED=7]="EXPIRED"})(p||(p={}));var h;(function(c){c[c.FIRST_TIER=0]="FIRST_TIER";c[c.FIRST_ORDERED_TIER=0]="FIRST_ORDERED_TIER";c[c.VISIBLE=0]="VISIBLE";c[c.PREFETCH=1]="PREFETCH";c[c.LAST_ORDERED_TIER=1]="LAST_ORDERED_TIER";c[c.RECENT=2]="RECENT";c[c.LAST_TIER=2]="LAST_TIER"})(h||(h={}));e.b="ChunkQueueManager";e.a="ChunkManager";e.c="ChunkSource.invalidate"},function(n,e,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function h(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 r(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){var d=a.createShader(c);
a.shaderSource(d,b);a.compileShader(d);if(!a.getShaderParameter(d,a.COMPILE_STATUS)){a=a.getShaderInfoLog(d)||"";var f=a.replace("\x00","");d=[];f=$jscomp.makeIterator(f.split("\n"));for(var g=f.next();!g.done;g=f.next()){g=g.value;var k=g.match(/^ERROR:\s*(\d+):(\d+)\s*(.+)$/);null!==k?d.push({message:k[3].trim(),file:parseInt(k[1],10),line:parseInt(k[2],10)}):(k=g.match(/^ERROR:\s*(.+)$/),null!==k?d.push({message:k[1]}):(g=g.trim())&&d.push({message:g}))}throw new v(c,b,a,d);}return d}c.d(e,"a",
function(){return g});n=c(0);var b=c(25),l=function(){function a(a,d){for(var b=0;b<d.length;b++){var f=d[b];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}return function(d,b,c){b&&a(d.prototype,b);c&&a(d,c);return d}}(),w;(function(a){a[a.VERTEX=b.z]="VERTEX";a[a.FRAGMENT=b.f]="FRAGMENT"})(w||(w={}));var v=function(a){function d(a,b,f,c){p(this,d);var g="Error compiling "+w[a].toLowerCase()+" shader: "+f,k=h(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,
g));k.name="ShaderCompilationError";k.log=f;k.message=g;k.shaderType=a;k.source=b;k.errorMessages=c;return k}r(d,a);return d}(Error),t=function(a){function d(a,b,f){p(this,d);var c="Error linking shader: "+f,g=h(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,c));g.name="ShaderLinkError";g.log=f;g.message=c;g.vertexSource=a;g.fragmentSource=b;return g}r(d,a);return d}(Error),q=function(d){function b(d,f,c,g,m){p(this,b);var k=h(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));k.gl=
d;k.vertexSource=f;k.fragmentSource=c;k.attributes=new Map;k.uniforms=new Map;var q=k.vertexShader=a(d,f,d.VERTEX_SHADER),l=k.fragmentShader=a(d,c,d.FRAGMENT_SHADER),e=d.createProgram();d.attachShader(e,q);d.attachShader(e,l);d.linkProgram(e);if(!d.getProgramParameter(e,d.LINK_STATUS))throw d=d.getProgramInfoLog(e)||"",new t(f,c,d);k.program=e;c=k.uniforms;f=k.attributes;if(g)for(g=$jscomp.makeIterator(g),q=g.next();!q.done;q=g.next())q=q.value,c.set(q,d.getUniformLocation(e,q));if(m)for(m=$jscomp.makeIterator(m),
q=m.next();!q.done;q=m.next())g=q.value,f.set(g,d.getAttribLocation(e,g));return k}r(b,d);l(b,[{key:"uniform",value:function(a){return this.uniforms.get(a)}},{key:"attribute",value:function(a){return this.attributes.get(a)}},{key:"textureUnit",value:function(a){return this.textureUnits.get(a)}},{key:"bind",value:function(){this.gl.useProgram(this.program)}},{key:"disposed",value:function(){var a=this.gl;a.deleteShader(this.vertexShader);this.vertexShader=void 0;a.deleteShader(this.fragmentShader);
this.fragmentShader=void 0;a.deleteProgram(this.program);this.uniforms=this.attributes=this.gl=this.program=void 0}}]);return b}(n.a),m=function(){function a(){p(this,a);this.code="";this.parts=new Set}l(a,[{key:"add",value:function(a){if(!this.parts.has(a))switch(this.parts.add(a),typeof a){case "string":this.code+=a;break;case "function":this.add(a());break;default:if(Array.isArray(a)){a=$jscomp.makeIterator(a);for(var d=a.next();!d.done;d=a.next())this.add(d.value)}else throw Error("Invalid code type");
}}},{key:"toString",value:function(){return this.code}}]);return a}(),g=function(){function a(d){p(this,a);this.gl=d;this.nextTextureUnit=this.nextSymbolID=0;this.varyingsCode=this.attributesCode=this.uniformsCode="";this.fragmentExtensionsSet=new Set;this.fragmentExtensions="";this.vertexCode=new m;this.vertexMain="";this.fragmentCode=new m;this.fragmentMain="";this.required=new Set;this.uniforms=[];this.attributes=[];this.initializers=[];this.textureUnits=new Map}l(a,[{key:"allocateTextureUnit",
value:function(a,d){d=void 0===d?1:d;if(this.textureUnits.has(a))throw Error("Duplicate texture unit symbol: "+a);var b=this.nextTextureUnit;this.nextTextureUnit+=d;this.textureUnits.set(a,b);return b}},{key:"addTextureSampler2D",value:function(a,d,b){var f=this.allocateTextureUnit(d,b);this.addUniform("highp sampler2D",a,b);this.addInitializer(function(d){if(b){for(var c=new Int32Array(b),g=0;g<b;++g)c[g]=g+f;d.gl.uniform1iv(d.uniform(a),c)}else d.gl.uniform1i(d.uniform(a),f)});return f}},{key:"symbol",
value:function(a){return a+this.nextSymbolID++}},{key:"addAttribute",value:function(a,d){this.attributes.push(d);this.attributesCode+="attribute "+a+" "+d+";\n";return d}},{key:"addVarying",value:function(a,d){this.varyingsCode+="varying "+a+" "+d+";\n"}},{key:"addUniform",value:function(a,d,b){this.uniforms.push(d);this.uniformsCode=null!=b?this.uniformsCode+("uniform "+a+" "+d+"["+b+"];\n"):this.uniformsCode+("uniform "+a+" "+d+";\n");return d}},{key:"addFragmentExtension",value:function(a){this.fragmentExtensionsSet.has(a)||
(this.fragmentExtensionsSet.add(a),this.fragmentExtensions+="#extension "+a+" : require\n")}},{key:"addVertexCode",value:function(a){this.vertexCode.add(a)}},{key:"addFragmentCode",value:function(a){this.fragmentCode.add(a)}},{key:"setVertexMain",value:function(a){this.vertexMain=a}},{key:"addVertexMain",value:function(a){this.vertexMain=(this.vertexMain||"")+a}},{key:"setFragmentMain",value:function(a){this.fragmentMain="void main() {\n"+a+"\n}\n"}},{key:"setFragmentMainFunction",value:function(a){this.fragmentMain=
a}},{key:"addInitializer",value:function(a){this.initializers.push(a)}},{key:"require",value:function(a){this.required.has(a)||(this.required.add(a),a(this))}},{key:"build",value:function(){var a=new q(this.gl,"\nprecision highp float;\n"+this.uniformsCode+"\n"+this.attributesCode+"\n"+this.varyingsCode+"\n"+this.vertexCode+"\nvoid main() {\n"+this.vertexMain+"\n}\n","\n"+this.fragmentExtensions+"\nprecision highp float;\n"+this.uniformsCode+"\n"+this.varyingsCode+"\n"+this.fragmentCode+"\n"+this.fragmentMain+
"\n",this.uniforms,this.attributes);a.textureUnits=this.textureUnits;var d=this.initializers;if(0<d.length){a.bind();d=$jscomp.makeIterator(d);for(var b=d.next();!b.done;b=d.next())b=b.value,b(a)}return a}}]);return a}()},function(n,e,c){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)}c.d(e,"a",function(){return w});e.b=function(a,c){c=void 0===c?"GET":c;var q=new XMLHttpRequest;q[l]=c;q[b]=a;q.open(c,a);return q};e.c=function(a,c,q){q=void 0===q?"GET":q;var m=new XMLHttpRequest;if(Array.isArray(a)){var g=a.length;g=1===g?0:Math.abs(Object(r.a)(c))%g;a=a[g]+c}else a+=c;m[l]=q;m[b]=a;m.open(q,a);return m};e.e=function(a,b,c){c=void 0===c?h.e:c;a.responseType=b;return new Promise(function(b,g){var d=function(){a.abort()};c.add(d);a.onloadend=
function(){var f=this.status;c.remove(d);200<=f&&300>f?b(this.response):g(w.fromXhr(a))};a.send()})};e.d=function(a){var b=a.match(/^([^:\/]+):\/\/([^\/]+)(\/.*)?$/);if(null===b)throw Error("Invalid URL: "+JSON.stringify(a));return"gs"===b[1]?[["https://storage.googleapis.com/"+b[2]],b[3]]:[[a],""]};var h=c(29),r=c(156),a=function(){function a(a,b){for(var c=0;c<b.length;c++){var g=b[c];g.enumerable=g.enumerable||!1;g.configurable=!0;"value"in g&&(g.writable=!0);Object.defineProperty(a,g.key,g)}}
return function(b,c,m){c&&a(b.prototype,c);m&&a(b,m);return b}}();$jscomp.initSymbol();var b=Symbol("url");$jscomp.initSymbol();var l=Symbol("method"),w=function(c){function e(a,b,c,d){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var f=a+" "+JSON.stringify(b)+" resulted in HTTP error "+c;d&&(f+=": "+d);f+=".";var g=(e.__proto__||Object.getPrototypeOf(e)).call(this,f);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
g=!g||"object"!==typeof g&&"function"!==typeof g?this:g;g.name="HttpError";g.message=f;g.method=a;g.url=b;g.code=c;g.statusMessage=d;return g}p(e,c);a(e,null,[{key:"fromXhr",value:function(a){return new e(a[l],a[b],a.status,a.statusText)}}]);return e}(Error)},function(n,e,c){c.d(e,"b",function(){return p});var p;(function(c){c[c.UINT8=0]="UINT8";c[c.UINT16=1]="UINT16";c[c.UINT32=2]="UINT32";c[c.UINT64=3]="UINT64";c[c.FLOAT32=4]="FLOAT32"})(p||(p={}));n=[];e.a=n;n[p.UINT8]=1;n[p.UINT16]=2;n[p.UINT32]=
4;n[p.UINT64]=8;n[p.FLOAT32]=4},function(n,e,c){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 h(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)}c.d(e,"b",function(){return w});c.d(e,"a",function(){return t});var r=c(56);n=c(0);var a=c(45),b=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),l=function m(a,d,b){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,d);if(void 0===c){if(a=Object.getPrototypeOf(a),null!==
a)return m(a,d,b)}else{if("value"in c)return c.value;d=c.get;return void 0===d?void 0:d.call(b)}};c(193);var w=0,v=a.a.fromObject({escape:{action:"close"}}),t=function(c){function g(){if(!(this instanceof g))throw new TypeError("Cannot call a class as a function");var d=p(this,(g.__proto__||Object.getPrototypeOf(g)).call(this));d.keyMap=new a.a;d.keyMap.addParent(v,Number.NEGATIVE_INFINITY);++w;var b=d.container=document.createElement("div");b.className="overlay";var c=d.content=document.createElement("div");
d.registerDisposer(new r.a(c));c.className="overlay-content";b.appendChild(c);document.body.appendChild(b);d.registerDisposer(new a.b(d.container,d.keyMap));d.registerEventListener(b,"action:close",function(){d.dispose()});c.focus();return d}h(g,c);b(g,[{key:"disposed",value:function(){--w;document.body.removeChild(this.container);l(g.prototype.__proto__||Object.getPrototypeOf(g.prototype),"disposed",this).call(this)}}]);return g}(n.a)},function(n,e,c){var p=c(240);n.exports={string:function(c){for(var e=
p.randomBytes(c),a=[],b=0;b<c;b++)a.push("abcdefghijklmnopqrstuvwxyz012345".substr(e[b]%32,1));return a.join("")},number:function(c){return Math.floor(Math.random()*c)},numberString:function(c){var e=(""+(c-1)).length;return(Array(e+1).join("0")+this.number(c)).slice(-e)}}},function(n,e,c){(function(e){function h(a){return function(c,e,m){w("create ajax sender",c,e);var g={};"string"===typeof e&&(g.headers={"Content-type":"text/plain"});c=b.addPath(c,"/xhr_send");var d=new a("POST",c,e,g);d.once("finish",
function(a){w("finish",a);d=null;if(200!==a&&204!==a)return m(Error("http status "+a));m()});return function(){w("abort");d.close();d=null;var a=Error("Aborted");a.code=1E3;m(a)}}}function r(a,b,c,m){l.call(this,a,b,h(m),c,m)}var a=c(4),b=c(18),l=c(126),w=function(){};"production"!==e.env.NODE_ENV&&(w=c(7)("sockjs-client:ajax-based"));a(r,l);n.exports=r}).call(e,c(6))},function(n,e,c){e.a=function(c,e){e.offset+=c;return e};e.b=function(c,e){var h=[];e=$jscomp.makeIterator(e);for(var a=e.next();!a.done;a=
e.next())a=a.value,a.startsWith(c)&&h.push({value:a});return h};e.c=function(c,e,r,a){var b=[];e=$jscomp.makeIterator(e);for(var l=e.next();!l.done;l=e.next()){l=l.value;var w=r(l);w.startsWith(c)&&b.push({value:w,description:a(l)})}return b}},function(n,e,c){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)}c.d(e,"a",function(){return r});n=c(20);var h=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}}(),r=function(a){function b(){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");var a=(b.__proto__||Object.getPrototypeOf(b)).apply(this,
arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?this:a}p(b,a);h(b,[{key:"draw",value:function(a){}},{key:"isReady",value:function(){return!0}},{key:"isTransparent",get:function(){return!1}}]);return b}(n.h)},function(n,e,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function h(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 r(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)}c.d(e,"b",function(){return w});c.d(e,"a",function(){return v});e.c=function(c){return function(c){function m(){p(this,m);var a=
h(this,(m.__proto__||Object.getPrototypeOf(m)).apply(this,arguments));a.visibility=new v;return a}r(m,c);l(m,[{key:"initializeCounterpart",value:function(c,d){d=void 0===d?{}:d;d.visibility=this.registerDisposer(a.a.makeFromExisting(c,this.visibility)).rpcId;b(m.prototype.__proto__||Object.getPrototypeOf(m.prototype),"initializeCounterpart",this).call(this,c,d)}}]);return m}(c)};var a=c(63);n=c(8);var b=function q(a,b,d){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,b);
if(void 0===c){if(a=Object.getPrototypeOf(a),null!==a)return q(a,b,d)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(d)}},l=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),w=function(a){function b(a){a=void 0===a?Number.NEGATIVE_INFINITY:a;p(this,b);return h(this,(b.__proto__||
Object.getPrototypeOf(b)).call(this,a))}r(b,a);l(b,[{key:"visible",get:function(){return this.value===Number.POSITIVE_INFINITY}},{key:"ignored",get:function(){return this.value===Number.NEGATIVE_INFINITY}}]);return b}(n.b);w.VISIBLE=Number.POSITIVE_INFINITY;w.IGNORED=Number.NEGATIVE_INFINITY;var v=function(a){function b(){p(this,b);var a=h(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));a.contributors=new Map;return a}r(b,a);l(b,[{key:"add",value:function(a){var d=this,b=this.contributors,
c=a.changed.add(function(){d.update()}),g=function(){b.delete(g);c();d.update()};b.set(g,a);this.update();return g}},{key:"update",value:function(){for(var a=Number.NEGATIVE_INFINITY,d=$jscomp.makeIterator(this.contributors.values()),b=d.next();!b.done;b=d.next())a=Math.max(a,b.value.value);this.value=a}}]);return b}(w)},function(n,e,c){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)}c.d(e,"b",function(){return l});n=c(0);var h=c(17);c.d(e,"a",function(){return h.a});c.d(e,"c",function(){return h.c});var r=function(){function a(a,b){for(var c=0;c<b.length;c++){var m=b[c];m.enumerable=m.enumerable||!1;m.configurable=!0;"value"in m&&(m.writable=!0);Object.defineProperty(a,m.key,m)}}return function(b,c,e){c&&a(b.prototype,c);e&&a(b,e);
return b}}(),a=new Set("f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 escape pause".split(" ")),b=new Set("color date datetime datetime-local email month number password search tel text time url week".split(" ")),l=function(c){function e(a,b){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var c=(e.__proto__||Object.getPrototypeOf(e)).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.target=a;c.eventMap=b;c.modifierShortcutsAreGlobal=!0;c.allShortcutsAreGlobal=!1;c.allowSpaceKeyOnButtons=!1;c.registerEventListener(a,"keydown",c.handleKeyDown.bind(c),!1);return c}p(e,c);r(e,[{key:"shouldIgnoreEvent",value:function(c,e){var m=e.target,g=m.tagName;if(m===this.target)return!1;var d="TEXTAREA"===g||"INPUT"===g||"BUTTON"===g||"SELECT"===g,f=!d&&(m.isContentEditable||m.ownerDocument&&"on"===m.ownerDocument.designMode);return!d&&!f||this.allShortcutsAreGlobal||a.has(c)?
!1:f||this.modifierShortcutsAreGlobal&&(e.altKey||e.ctrlKey||e.metaKey)?!0:"INPUT"===g&&b.has(m.type)?"enter"!==c:"INPUT"===g||"BUTTON"===g?this.allowSpaceKeyOnButtons?!1:"space"===c:!0}},{key:"handleKeyDown",value:function(a){var b=a.code.toLowerCase();this.shouldIgnoreEvent(b,a)||Object(h.b)(b,a,this.eventMap)}}]);return e}(n.a)},function(n,e,c){function p(a,d){if(!(a instanceof d))throw new TypeError("Cannot call a class as a function");}function h(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 r(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)}c.d(e,"a",function(){return C});c.d(e,"c",function(){return y});c.d(e,"b",function(){return G});c.d(e,"d",function(){return A});
n=c(9);var a=c.n(n),b=c(35);n=c(15);var l=c(32),w=c(67);e=c(0);var v=c(1),t=c(23),q=c(3),m=c(44),g=c(68),d=c(36),f=c(69);c=c(16);var k=function(){function a(a,d){for(var b=0;b<d.length;b++){var c=d[b];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(d,b,c){b&&a(d.prototype,b);c&&a(d,c);return d}}(),x=function D(a,d,b){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,d);if(void 0===c){if(a=Object.getPrototypeOf(a),
null!==a)return D(a,d,b)}else{if("value"in c)return c.value;d=c.get;return void 0===d?void 0:d.call(b)}},B=this&&this.__decorate||function(a,d,b,c){var f=arguments.length,g=3>f?d:null===c?c=Object.getOwnPropertyDescriptor(d,b):c,k;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)g=Reflect.decorate(a,d,b,c);else for(var m=a.length-1;0<=m;m--)if(k=a[m])g=(3>f?k(g):3<f?k(d,b,g):k(d,b))||g;return 3<f&&g&&Object.defineProperty(d,b,g),g},E=v.j.create(),C=function(d){function c(d,b,f){p(this,
c);var k=h(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));k.chunkManager=d;k.layerManager=b;k.navigationState=f;k.gl=k.chunkManager.gl;k.dataToViewport=v.j.create();k.viewportToDevice=v.j.create();k.dataToDevice=v.j.create();k.visibleChunks=new Map;k.viewChanged=new q.a;k.renderingStale=!0;k.visibleChunksStale=!0;k.visibleLayerList=[];k.newVisibleLayers=new Set;k.offscreenFramebuffer=k.registerDisposer(new g.b(k.gl,{colorBuffers:Object(g.e)(k.gl,1),depthBuffer:new g.d(k.gl)}));k.updateVisibleLayers=
k.registerCancellable(a()(function(){k.updateVisibleLayersNow()},0));k.invalidateVisibleSources=function(){k.visibleSourcesStale=!0;k.viewChanged.dispatch()};v.j.identity(k.dataToViewport);k.initializeCounterpart(k.chunkManager.rpc,{chunkManager:d.rpcId});k.registerDisposer(f.changed.add(function(){k.updateViewportFromNavigationState()}));k.updateViewportFromNavigationState();k.registerDisposer(b.layersChanged.add(function(){k.hasValidViewport&&k.updateVisibleLayers()}));k.viewChanged.add(function(){k.renderingStale=
!0});k.registerDisposer(d.chunkQueueManager.visibleChunksChanged.add(k.viewChanged.dispatch));k.updateViewportFromNavigationState();k.updateVisibleLayers();return k}r(c,d);k(c,[{key:"isReady",value:function(){if(!this.hasValidViewport)return!1;this.maybeUpdateVisibleChunks();for(var a=$jscomp.makeIterator(this.visibleLayers.values()),d=a.next();!d.done;d=a.next()){d=$jscomp.makeIterator(d.value);for(var c=d.next();!c.done;c=d.next()){var f=c.value;c=f.source;f=this.visibleChunks.get(f.chunkLayout);
if(!f)return!1;c=c.chunks;f=$jscomp.makeIterator(f);for(var g=f.next();!g.done;g=f.next())if(g=c.get(g.value),!g||g.state!==b.d.GPU_MEMORY)return!1}}return!0}},{key:"updateViewportFromNavigationState",value:function(){var a=this.navigationState;a.valid&&(a.toMat4(E),this.setViewportToDataMatrix(E))}},{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,d=this.rpc,b={id:this.rpcId},c=this.newVisibleLayers,f=!1,g=this.visibleLayerList;g.length=0;for(var k=$jscomp.makeIterator(this.layerManager.readyRenderLayers()),m=k.next();!m.done;m=k.next())m=m.value,m instanceof w.a&&(c.add(m),g.push(m),a.has(m)||(a.set(m.addRef(),[]),this.bindVisibleRenderLayer(m),b.layerId=m.rpcId,
d.invoke(l.d,b),f=!0));g=$jscomp.makeIterator(a.keys());for(m=g.next();!m.done;m=g.next())k=m.value,c.has(k)||(a.delete(k),this.unbindVisibleRenderLayer(k),b.layerId=k.rpcId,d.invoke(l.e,b),k.dispose(),f=!0);c.clear();f&&(this.visibleSourcesStale=!0);this.viewChanged.dispatch();return f}},{key:"onViewportChanged",value:function(){var a=this.width,d=this.height,b=this.viewportToDevice,c=this.dataToViewport,f=this.dataToDevice;v.j.ortho(b,-a/2,a/2,d/2,-d/2,-10,10);v.j.multiply(f,b,c);this.visibleChunksStale=
!0;this.viewChanged.dispatch()}},{key:"setViewportSize",value:function(a,d){return x(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"setViewportSize",this).call(this,a,d)?(this.rpc.invoke(l.i,{id:this.rpcId,width:a,height:d}),!0):!1}},{key:"onViewportToDataMatrixChanged",value:function(){var a=this.viewportToData,d=this.dataToViewport;v.j.invert(d,a);Object(v.m)(d);this.rpc.invoke(l.i,{id:this.rpcId,viewportToData:a})}},{key:"onHasValidViewport",value:function(){this.updateVisibleLayers()}},
{key:"updateRendering",value:function(){if(this.renderingStale&&this.hasValidViewport&&0!==this.width&&0!==this.height){this.renderingStale=!1;this.maybeUpdateVisibleChunks();var a=this.gl,d=this.offscreenFramebuffer;d.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 b=0,c=$jscomp.makeIterator(this.visibleLayerList),
f=c.next();!f.done;f=c.next())f=f.value,a.clear(a.STENCIL_BUFFER_BIT),a.stencilFuncSeparate(a.FRONT_AND_BACK,a.GREATER,1,1),f.setGLBlendMode(a,b),f.draw(this),++b;a.disable(a.BLEND);a.disable(a.STENCIL_TEST);d.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;
this.computeVisibleChunks(function(d){var b=a.get(d);void 0===b?(b=[],a.set(d,b)):b.length=0;return b},function(a,d,b){a=Object(v.q)(b);d[d.length]=a})}},{key:"disposed",value:function(){for(var a=$jscomp.makeIterator(this.visibleLayers.keys()),d=a.next();!d.done;d=a.next())d=d.value,this.unbindVisibleRenderLayer(d),d.dispose();this.visibleLayers.clear();this.visibleLayerList.length=0}}]);return c}(Object(m.c)(l.j));C=B([Object(c.g)(l.h)],C);var y=function(a){function d(a,b){p(this,d);a=h(this,(d.__proto__||
Object.getPrototypeOf(d)).call(this,a,b));a.spec=b.spec;return a}r(d,a);k(d,[{key:"initializeCounterpart",value:function(a,b){b.spec=this.spec.toObject();x(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"initializeCounterpart",this).call(this,a,b)}}],[{key:"encodeOptions",value:function(a){var b=x(d.__proto__||Object.getPrototypeOf(d),"encodeOptions",this).call(this,a);b.spec=a.spec.toObject();return b}}]);return d}(n.e),G=function(a){function d(a,c){p(this,d);var f=h(this,(d.__proto__||
Object.getPrototypeOf(d)).call(this,a));f.chunkGridPosition=c.chunkGridPosition;f.chunkDataSize=c.chunkDataSize||a.spec.chunkDataSize;f.state=b.d.SYSTEM_MEMORY;return f}r(d,a);return d}(n.b),A=function(a){function b(a,c){p(this,b);var g=h(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));g.gl=a;g.copyVertexPositionsBuffer=Object(f.a)(g.gl);g.textureCoordinateAdjustment=new Float32Array(4);var k=new d.a(a);k.addVarying("vec2","vTexCoord");k.addUniform("sampler2D","uSampler");k.addInitializer(function(d){a.uniform1i(d.uniform("uSampler"),
0)});k.addUniform("vec4","uColorFactor");k.addUniform("vec4","uBackgroundColor");k.addUniform("mat4","uProjectionMatrix");k.addUniform("vec4","uTextureCoordinateAdjustment");k.require(c);k.setFragmentMain("\nvec4 sampledColor = texture2D(uSampler, vTexCoord);\nif (sampledColor.a == 0.0) {\n  sampledColor = uBackgroundColor;\n}\nemit(sampledColor * uColorFactor, vec4(0,0,0,0));\n");k.addAttribute("vec4","aVertexPosition");k.setVertexMain("\nvTexCoord = uTextureCoordinateAdjustment.xy + 0.5 * (aVertexPosition.xy + 1.0) * uTextureCoordinateAdjustment.zw;\ngl_Position = uProjectionMatrix * aVertexPosition;\n");
g.shader=g.registerDisposer(k.build());return g}r(b,a);k(b,[{key:"draw",value:function(a,d,b,c,f,g,k,m){var e=this.gl,l=this.shader,q=this.textureCoordinateAdjustment;q[0]=f;q[1]=g;q[2]=k-f;q[3]=m-g;l.bind();e.activeTexture(e.TEXTURE0);e.bindTexture(e.TEXTURE_2D,a);e.uniformMatrix4fv(l.uniform("uProjectionMatrix"),!1,d);e.uniform4fv(l.uniform("uColorFactor"),b);e.uniform4fv(l.uniform("uBackgroundColor"),c);e.uniform4fv(l.uniform("uTextureCoordinateAdjustment"),q);a=l.attribute("aVertexPosition");
this.copyVertexPositionsBuffer.bindToVertexAttrib(a,2);e.drawArrays(e.TRIANGLE_FAN,0,4);e.disableVertexAttribArray(a);e.bindTexture(e.TEXTURE_2D,null)}}],[{key:"get",value:function(a,d){return a.memoize.get("sliceview/SliceViewRenderHelper:"+Object(t.a)(d),function(){return new b(a,d)})}}]);return b}(e.a)},function(n,e,c){e.b=function(){return new p.b(void 0)};e.a=function(c){return new p.a(c,h.B)};var p=c(8),h=c(2)},function(n,e,c){e.a=function(c){return new p.a(void 0===c?.5:c,h.r)};var p=c(8),
h=c(2)},function(n,e,c){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 h(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 r(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}c.d(e,"b",function(){return v});c.d(e,"c",function(){return t});c.d(e,"a",function(){return q});n=c(9);var a=c.n(n);n=c(0);var b=c(3),l=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)}},w=function(){function a(a,
b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(d,b,c){b&&a(d.prototype,b);c&&a(d,c);return d}}(),v=function(){function a(d,c){c=void 0===c?d:c;r(this,a);this.value_=d;this.defaultValue=c;this.changed=new b.a}w(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}(),t=function(a){function d(a){r(this,d);var b=p(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));b.model=a;b.element=document.createElement("input");var c=b.element;c.type="checkbox";b.registerDisposer(a.changed.add(function(){b.updateCheckbox()}));b.updateCheckbox();
b.registerEventListener(c,"change",function(d){a.value=this.checked});c.addEventListener("mousedown",function(a){a.preventDefault()});return b}h(d,a);w(d,[{key:"updateCheckbox",value:function(){this.element.checked=this.model.value}},{key:"disposed",value:function(){var a=this.element,b=a.parentElement;b&&b.removeChild(a);l(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"disposed",this).call(this)}}]);return d}(n.a),q=function(b){function d(b,c){r(this,d);var f=p(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));
f.model=b;f.element=c;f.initialDisplay=f.element.style.display;f.updateVisibility();f.registerDisposer(b.changed.add(f.registerCancellable(a()(function(){return f.updateVisibility()},0))));return f}h(d,b);w(d,[{key:"updateVisibility",value:function(){this.element.style.display=this.model.value?this.initialDisplay:"none"}}]);return d}(n.a)},function(n,e,c){function p(c,a,b){h.call(this,c,a,b,{noCredentials:!0})}e=c(4);var h=c(127);e(p,h);p.enabled=h.enabled;n.exports=p},function(n,e,c){(function(c){n.exports=
{isOpera:function(){return c.navigator&&/opera/i.test(c.navigator.userAgent)},isKonqueror:function(){return c.navigator&&/konqueror/i.test(c.navigator.userAgent)},hasDomain:function(){if(!c.document)return!0;try{return!!c.document.domain}catch(h){return!1}}}}).call(e,c(5))},function(n,e,c){(function(e,h){var r=c(34),a=c(28),b=c(51),l=function(){};"production"!==e.env.NODE_ENV&&(l=c(7)("sockjs-client:utils:iframe"));n.exports={WPrefix:"_jp",currentWindowId:null,polluteGlobalNamespace:function(){n.exports.WPrefix in
h||(h[n.exports.WPrefix]={})},postMessage:function(b,c){h.parent!==h?h.parent.postMessage(a.stringify({windowId:n.exports.currentWindowId,type:b,data:c||""}),"*"):l("Cannot postMessage, no parent window.",b,c)},createIframe:function(a,b){var c=h.document.createElement("iframe"),e=function(){l("unattach");clearTimeout(d);try{c.onload=null}catch(k){}c.onerror=null},m=function(){l("cleanup");c&&(e(),setTimeout(function(){c&&c.parentNode.removeChild(c);c=null},0),r.unloadDel(f))},g=function(a){l("onerror",
a);c&&(m(),b(a))};c.src=a;c.style.display="none";c.style.position="absolute";c.onerror=function(){g("onerror")};c.onload=function(){l("onload");clearTimeout(d);d=setTimeout(function(){g("onload timeout")},2E3)};h.document.body.appendChild(c);var d=setTimeout(function(){g("timeout")},15E3);var f=r.unloadAdd(m);return{post:function(a,d){l("post",a,d);try{setTimeout(function(){c&&c.contentWindow&&c.contentWindow.postMessage(a,d)},0)}catch(B){}},cleanup:m,loaded:e}},createHtmlfile:function(a,b){var c=
["Active"].concat("Object").join("X"),e=new h[c]("htmlfile"),m=function(){clearTimeout(k);f.onerror=null},g=function(){e&&(m(),r.unloadDel(x),f.parentNode.removeChild(f),f=e=null,CollectGarbage())},d=function(a){l("onerror",a);e&&(g(),b(a))};e.open();e.write('<html><script>document.domain="'+h.document.domain+'";\x3c/script></html>');e.close();e.parentWindow[n.exports.WPrefix]=h[n.exports.WPrefix];c=e.createElement("div");e.body.appendChild(c);var f=e.createElement("iframe");c.appendChild(f);f.src=
a;f.onerror=function(){d("onerror")};var k=setTimeout(function(){d("timeout")},15E3);var x=r.unloadAdd(g);return{post:function(a,d){try{setTimeout(function(){f&&f.contentWindow&&f.contentWindow.postMessage(a,d)},0)}catch(C){}},cleanup:g,loaded:m}}};n.exports.iframeEnabled=!1;h.document&&(n.exports.iframeEnabled=("function"===typeof h.postMessage||"object"===typeof h.postMessage)&&!b.isKonqueror())}).call(e,c(6),c(5))},function(n,e,c){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 h(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}c.d(e,"a",function(){return w});c.d(e,"b",function(){return v});var r=c(0),a=c(2),b=function q(a,b,d){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,b);if(void 0===c){if(a=Object.getPrototypeOf(a),
null!==a)return q(a,b,d)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(d)}},l=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),w=function(){function a(){h(this,a);this.map=new Map}l(a,[{key:"get",value:function(a,b){var d=this.map,c=d.get(a);void 0===c?(c=b(),c.registerDisposer(function(){d.delete(a)}),
d.set(a,c)):c.addRef();return c}}]);return a}(),v=function(c){function m(){h(this,m);var a=(m.__proto__||Object.getPrototypeOf(m)).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}p(m,c);l(m,[{key:"get",value:function(c,d){"string"!==typeof c&&(c=Object(a.g)(c));return b(m.prototype.__proto__||Object.getPrototypeOf(m.prototype),"get",this).call(this,c,d)}},{key:"getUncounted",
value:function(a,d){return this.get(a,function(){return new r.b(d())}).value}}]);return m}(w)},function(n,e,c){function p(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 h(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 r(a,d){if(!(a instanceof d))throw new TypeError("Cannot call a class as a function");}c.d(e,"a",function(){return B});c.d(e,"b",function(){return y});var a=c(35);n=c(15);var b=c(158);e=c(43);var l=c(95),w=c(55),v=c(1),t=c(23),q=c(24),m=c(36),g=c(12);c=c(16);var d=function H(a,d,b){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,d);if(void 0===c){if(a=Object.getPrototypeOf(a),null!==
a)return H(a,d,b)}else{if("value"in c)return c.value;d=c.get;return void 0===d?void 0:d.call(b)}},f=function(){function a(a,d){for(var b=0;b<d.length;b++){var c=d[b];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(d,b,c){b&&a(d.prototype,b);c&&a(d,c);return d}}(),k=this&&this.__decorate||function(a,d,b,c){var f=arguments.length,g=3>f?d:null===c?c=Object.getOwnPropertyDescriptor(d,b):c,k;if("object"===typeof Reflect&&"function"===
typeof Reflect.decorate)g=Reflect.decorate(a,d,b,c);else for(var m=a.length-1;0<=m;m--)if(k=a[m])g=(3>f?k(g):3<f?k(d,b,g):k(d,b))||g;return 3<f&&g&&Object.defineProperty(d,b,g),g},x=function(){function a(){r(this,a);this.tempLightVec=new Float32Array(4);this.tempPickID=new Float32Array(4)}f(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,d,b){var c=b.dataToDevice,f=b.lightDirection,g=b.ambientLighting;b=b.directionalLighting;a.uniformMatrix4fv(d.uniform("uProjection"),!1,c);c=this.tempLightVec;v.p.scale(c,f,b);c[3]=g;a.uniform4fv(d.uniform("uLightDirection"),c)}},{key:"setColor",value:function(a,d,b){a.uniform4fv(d.uniform("uColor"),b)}},{key:"setPickID",value:function(a,d,b){a.uniform4fv(d.uniform("uPickID"),Object(g.p)(this.tempPickID,b))}},{key:"beginObject",value:function(a,d,b){a.uniformMatrix4fv(d.uniform("uModelMatrix"),
!1,b)}},{key:"getShader",value:function(a,d){var b=this;return a.memoize.get("mesh/MeshShaderManager:"+Object(t.a)(d),function(){var c=new m.a(a);c.require(d);b.defineShader(c);return c.build()})}},{key:"drawFragment",value:function(a,d,b){b.vertexBuffer.bindToVertexAttrib(d.attribute("aVertexPosition"),3);b.normalBuffer.bindToVertexAttrib(d.attribute("aVertexNormal"),3);b.indexBuffer.bind();a.drawElements(a.TRIANGLES,b.numIndices,a.UNSIGNED_INT,0)}},{key:"endLayer",value:function(a,d){a.disableVertexAttribArray(d.attribute("aVertexPosition"));
a.disableVertexAttribArray(d.attribute("aVertexNormal"))}}]);return a}(),B=function(d){function c(a,d,f){r(this,c);var g=p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));g.chunkManager=a;g.source=d;g.displayState=f;g.meshShaderManager=new x;g.shaders=new Map;Object(w.f)(f,g);a=g.sharedObject=g.registerDisposer(new w.b(a,f));a.RPC_TYPE_ID=b.b;a.initializeCounterpartWithChunkManager({source:d.addCounterpartRef()});g.setReady(!0);a.visibility.add(g.visibility);return g}h(c,d);f(c,[{key:"getShader",
value:function(a){var d=this.shaders,b=d.get(a);void 0===b&&(b=this.registerDisposer(this.meshShaderManager.getShader(this.gl,a)),d.set(a,b));return b}},{key:"draw",value:function(d){var b=this;if(d.emitColor||!d.alreadyEmittedPickID){var c=this.gl,f=this.displayState,g=this.meshShaderManager,k=Math.min(1,f.objectAlpha.value);if(!(0>=k)){var m=this.getShader(d.emitter);m.bind();g.beginLayer(c,m,d);var e=d.pickIDs,l=this.displayState.objectToDataTransform.transform;Object(w.d)(f,this.source.fragmentSource.objectChunks,
function(q,x,t){d.emitColor&&g.setColor(c,m,Object(w.e)(f,q,k));d.emitPickID&&g.setPickID(c,m,e.registerUint64(b,x));g.beginObject(c,m,l);q=$jscomp.makeIterator(t);for(x=q.next();!x.done;x=q.next())x=x.value,x.state===a.d.GPU_MEMORY&&g.drawFragment(c,m,x)});g.endLayer(c,m)}}}},{key:"isReady",value:function(){var d=this.displayState,b=this.source,c=!0,f=b.fragmentSource.chunks;Object(l.a)(d,function(g){g=Object(l.b)(g,d.clipBounds.value);var k=b.chunks.get(g);if(void 0===k)c=!1;else{k=$jscomp.makeIterator(k.fragmentIds);
for(var m=k.next();!m.done;m=k.next())if(m=f.get(g+"/"+m.value),void 0===m||m.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 c}(e.a),E=function(a){function d(a,b){r(this,d);a=p(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,a));a.fragmentIds=b.fragmentIds;return a}h(d,a);return d}(n.b),C=function(a){function b(a,d){r(this,b);
a=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));a.objectKey=d.objectKey;a.vertexPositions=d.vertexPositions;var c=a.indices=d.indices;a.numIndices=c.length;a.vertexNormals=d.vertexNormals;return a}h(b,a);f(b,[{key:"copyToGPU",value:function(a){d(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"copyToGPU",this).call(this,a);this.vertexBuffer=q.a.fromData(a,this.vertexPositions,a.ARRAY_BUFFER,a.STATIC_DRAW);this.indexBuffer=q.a.fromData(a,this.indices,a.ELEMENT_ARRAY_BUFFER,
a.STATIC_DRAW);this.normalBuffer=q.a.fromData(a,this.vertexNormals,a.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();this.normalBuffer.dispose()}}]);return b}(n.b),y=function(a){function b(){r(this,b);var a=p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));a.fragmentSource=a.registerDisposer(new G(a.chunkManager,
a));return a}h(b,a);f(b,[{key:"initializeCounterpart",value:function(a,c){this.fragmentSource.initializeCounterpart(this.chunkManager.rpc,{});c.fragmentSource=this.fragmentSource.addCounterpartRef();d(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"initializeCounterpart",this).call(this,a,c)}},{key:"getChunk",value:function(a){return new E(this,a)}}]);return b}(n.e),G=function(a){function b(a,d){r(this,b);a=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));a.meshSource=d;a.objectChunks=
new Map;return a}h(b,a);f(b,[{key:"addChunk",value:function(a,c){d(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"addChunk",this).call(this,a,c);a=this.objectChunks;var f=c.objectKey,g=a.get(f);void 0===g&&(g=new Set,a.set(f,g));g.add(c)}},{key:"deleteChunk",value:function(a){var c=this.chunks.get(a);d(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"deleteChunk",this).call(this,a);a=this.objectChunks;var f=c.objectKey,g=a.get(f);g.delete(c);0===g.size&&a.delete(f)}},{key:"getChunk",
value:function(a){return new C(this,a)}}]);return b}(n.e);G=k([Object(c.g)(b.a)],G)},function(n,e,c){function p(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 h(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 r(a,d){if(!(a instanceof d))throw new TypeError("Cannot call a class as a function");}function a(a,d){var b=d.redrawNeeded.dispatch;d.registerDisposer(a.segmentColorHash.changed.add(b));d.registerDisposer(a.visibleSegments.changed.add(b));d.registerDisposer(a.segmentEquivalences.changed.add(b));d.registerDisposer(a.segmentSelectionState.changed.add(b))}c.d(e,"c",function(){return m});c.d(e,"a",function(){return g});e.g=a;
e.f=function(d,b){a(d,b);b.registerDisposer(d.objectAlpha.changed.add(b.redrawNeeded.dispatch));b.registerDisposer(d.objectToDataTransform.changed.add(b.redrawNeeded.dispatch))};e.e=function(a,b,c){c=void 0===c?1:c;var f=d;f[3]=c;a.segmentColorHash.compute(f,b);if(a.segmentSelectionState.isSelected(b))for(a=0;3>a;++a)f[a]=.5*f[a]+.5;f[0]*=c;f[1]*=c;f[2]*=c;return f};e.d=function(a,d,c){Object(b.a)(a,function(f,g){var k=Object(b.b)(f,a.clipBounds.value);k=d.get(k);void 0!==k&&c(g,f,k)})};c.d(e,"b",
function(){return f});var b=c(95);n=c(0);e=c(1);var l=c(3),w=c(19),v=c(44);c=c(16);var t=function x(a,d,b){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,d);if(void 0===c){if(a=Object.getPrototypeOf(a),null!==a)return x(a,d,b)}else{if("value"in c)return c.value;d=c.get;return void 0===d?void 0:d.call(b)}},q=function(){function a(a,d){for(var b=0;b<d.length;b++){var c=d[b];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,
c.key,c)}}return function(d,b,c){b&&a(d.prototype,b);c&&a(d,c);return d}}(),m=function(){function a(d,b){r(this,a);this.key=d;this.value=b}q(a,[{key:"toString",value:function(){return this.key+"\u2192"+this.value}}]);return a}(),g=function(a){function d(){r(this,d);var a=p(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments));a.selectedSegment=new w.a;a.hasSelectedSegment=!1;a.changed=new l.a;return a}h(d,a);q(d,[{key:"set",value:function(a){if(null==a)this.hasSelectedSegment&&(this.hasSelectedSegment=
!1,this.changed.dispatch());else{var d=this.selectedSegment;this.hasSelectedSegment&&a.low===d.low&&a.high===d.high||(d.low=a.low,d.high=a.high,this.hasSelectedSegment=!0,this.changed.dispatch())}}},{key:"isSelected",value:function(a){return this.hasSelectedSegment&&w.a.equal(a,this.selectedSegment)}},{key:"bindTo",value:function(a,d){var b=this,c=new w.a;this.registerDisposer(a.changed.add(function(){var f=a.get(d);"number"===typeof f?(c.low=f,c.high=0,f=c):f instanceof m&&(f=f.value);b.set(f)}))}}]);
return d}(n.a),d=e.r.create(),f=function(a){function d(a,b){r(this,d);var c=p(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));c.chunkManager=a;c.displayState=b;c.registerDisposer(b.clipBounds.changed.add(function(){return a.chunkQueueManager.scheduleChunkUpdate()}));return c}h(d,a);q(d,[{key:"initializeCounterpartWithChunkManager",value:function(a){var b=this.displayState;a.chunkManager=this.chunkManager.rpcId;a.visibleSegments=b.visibleSegments.rpcId;a.segmentEquivalences=b.segmentEquivalences.rpcId;
a.clipBounds=b.clipBounds.rpcId;t(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"initializeCounterpart",this).call(this,this.chunkManager.rpc,a)}}]);return d}(Object(v.c)(c.b))},function(n,e,c){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 h(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 r(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}c.d(e,"a",function(){return q});n=c(9);var a=c.n(n);n=c(0);var b=c(171),l=function(){function a(a,d){for(var b=0;b<d.length;b++){var c=d[b];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,
c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),w=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)}},v=new function d(){r(this,d);b.a.initializeHead(this)},t=a()(function(){var a=document.activeElement;if(null===a||a===document.body)a=b.a.front(v),null!==a&&a.element.focus()});window.addEventListener("focus",
function(){t()},!0);window.addEventListener("blur",function(){t()},!0);var q=function(d){function c(d){r(this,c);var f=p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));f.element=d;f.prev0=null;f.next0=null;f.lastFocusedElement=null;f.scheduleUpdateFocus=f.registerCancellable(a()(function(){var a=document.activeElement,d=f.element;d.contains(a)||((a===f.lastFocusedElement||a.contains(d))&&f.element.focus(),f.lastFocusedElement=null)},0));d.tabIndex=-1;f.registerEventListener(d,"mouseenter",
function(){f.lastFocusedElement=document.activeElement;f.scheduleUpdateFocus()});f.registerEventListener(d,"mouseleave",function(){f.scheduleUpdateFocus.cancel()});b.a.insertBefore(v,f);f.registerEventListener(d,"focus",function(){b.a.pop(f);b.a.insertAfter(v,f)});t();return f}h(c,d);l(c,[{key:"disposed",value:function(){b.a.pop(this);w(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"disposed",this).call(this)}}]);return c}(n.a)},function(n,e,c){c.d(e,"a",function(){return b});var p=c(1),
h=c(2),r=c(3),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}}(),b=function(){function b(a){a=void 0===a?p.j.create():a;if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");this.transform=a;this.changed=new r.a}a(b,[{key:"reset",value:function(){p.j.copy(this.transform,p.d);this.changed.dispatch()}},
{key:"toJSON",value:function(){if(!p.j.equals(p.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 b=0;4>b;++b)Object(h.b)(this.transform.subarray(4*b,4*(b+1)),a[b]);p.j.transpose(this.transform,this.transform)}catch(m){this.reset()}else if(16===a.length)try{Object(h.b)(this.transform,a),p.j.transpose(this.transform,
this.transform)}catch(m){this.reset()}else this.reset();else if("object"===typeof a){b=p.l.create();var c=p.p.create(),e=p.p.fromValues(1,1,1);try{Object(h.b)(b,a.rotation),p.l.normalize(b,b)}catch(m){p.l.identity(b)}try{Object(h.b)(c,a.translation)}catch(m){p.p.copy(c,p.h)}try{Object(h.b)(e,a.scale)}catch(m){p.p.copy(e,p.g)}p.j.fromRotationTranslationScale(this.transform,b,c,e);this.changed.dispatch()}else this.reset()}},{key:"clone",value:function(){return new b(p.j.clone(this.transform))}}]);return b}()},
function(n,e,c){function p(c){c.texParameteri(h.r,h.t,h.j);c.texParameteri(h.r,h.s,h.j);c.texParameteri(h.r,h.u,h.c);c.texParameteri(h.r,h.v,h.c)}e.b=p;e.a=function(c,a,b,e,w,v){w=void 0===w?h.m:w;v=void 0===v?h.y:v;c.activeTexture(h.q+c.tempTextureUnit);c.bindTexture(h.r,a);p(c);c.texImage2D(h.r,0,w,b,e,0,w,v,null);c.bindTexture(h.r,null)};e.c=function(c,a,b){c.activeTexture(h.q+c.tempTextureUnit);c.bindTexture(h.r,a);c.texParameteri(h.r,h.t,h.g);c.texParameteri(h.r,h.s,h.g);c.texParameteri(h.r,
h.u,h.c);c.texParameteri(h.r,h.v,h.c);c.pixelStorei(h.x,!0);c.pixelStorei(h.w,4);c.texImage2D(h.r,0,h.m,h.m,h.y,b);c.pixelStorei(h.x,!1);c.bindTexture(h.r,null)};var h=c(25)},function(n,e,c){(function(e){function h(c,e){b(c);a.call(this);var l=this;this.bufferPosition=0;this.xo=new e("POST",c,null);this.xo.on("chunk",this._chunkHandler.bind(this));this.xo.once("finish",function(a,c){b("finish",a,c);l._chunkHandler(a,c);l.xo=null;a=200===a?"network":"permanent";b("close",a);l.emit("close",null,a);
l._cleanup()})}var r=c(4),a=c(10).EventEmitter,b=function(){};"production"!==e.env.NODE_ENV&&(b=c(7)("sockjs-client:receiver:xhr"));r(h,a);h.prototype._chunkHandler=function(a,c){b("_chunkHandler",a);if(200===a&&c)for(;;this.bufferPosition+=a+1){var e=c.slice(this.bufferPosition);a=e.indexOf("\n");if(-1===a)break;if(e=e.slice(0,a))b("message",e),this.emit("message",e)}};h.prototype._cleanup=function(){b("_cleanup");this.removeAllListeners()};h.prototype.abort=function(){b("abort");this.xo&&(this.xo.close(),
b("close"),this.emit("close",null,"user"),this.xo=null);this._cleanup()};n.exports=h}).call(e,c(6))},function(n,e,c){function p(c,a,b,e){h.call(this,c,a,b,e)}e=c(4);var h=c(127);e(p,h);p.enabled=h.enabled&&h.supportsCORS;n.exports=p},function(n,e,c){function p(a,d){if(!(a instanceof d))throw new TypeError("Cannot call a class as a function");}function h(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 r(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 a(a,d,b,c){var f=!1,g;a.registerDisposer(d);var k=t.UNLINKED,e=function(){var f=b.value;if(f!==k)switch(f){case t.UNLINKED:g=void 0;break;case t.LINKED:g=void 0;c.assign(a,
d);break;case t.RELATIVE:g=c.difference(a,d)}k=f;a.changed.dispatch()};a.registerDisposer(a.changed.add(function(){if(!f)switch(b.value){case t.LINKED:c.assign(d,a);break;case t.RELATIVE:c.subtract(d,a,g)}}));a.registerDisposer(d.changed.add(function(){f=!0;switch(b.value){case t.UNLINKED:if(c.isValid(a))break;case t.LINKED:c.assign(a,d);break;case t.RELATIVE:c.add(a,d,g)}f=!1}));a.registerDisposer(b.changed.add(e));e();return a}c.d(e,"d",function(){return t});c.d(e,"b",function(){return k});c.d(e,
"f",function(){return x});c.d(e,"a",function(){return B});c.d(e,"g",function(){return E});c.d(e,"c",function(){return y});c.d(e,"e",function(){return G});n=c(0);var b=c(1),l=c(2),w=c(3);c=c(281);var v=function(){function a(a,d){for(var b=0;b<d.length;b++){var c=d[b];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(d,b,c){b&&a(d.prototype,b);c&&a(d,c);return d}}(),t;(function(a){a[a.LINKED=0]="LINKED";a[a.RELATIVE=1]="RELATIVE";
a[a.UNLINKED=2]="UNLINKED"})(t||(t={}));var q=function(a){function d(a){a=void 0===a?t.LINKED:a;p(this,d);return h(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,t,a))}r(d,a);return d}(c.a),m=function(a){function d(a){p(this,d);var c=h(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));c.changed=new w.a;var f=!0;null==a&&(a=b.p.create(),f=!1);c.size=a;c.valid=f;return c}r(d,a);v(d,[{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(l.b)(this.size,a),this.valid=!0,this.changed.dispatch()}catch(I){this.valid=!1,this.changed.dispatch()}}},{key:"toString",value:function(){return this.valid?this.size.toString():null}},{key:"voxelFromSpatial",value:function(a,d){return b.p.divide(a,d,this.size)}},{key:"spatialFromVoxel",value:function(a,d){return b.p.multiply(a,
d,this.size)}}]);return d}(n.a),g=b.p.create(),d=b.l.create(),f=function(a){function d(a,c){p(this,d);var f=h(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));f.voxelCoordinates=null;f.changed=new w.a;null==a&&(a=new m);f.voxelSize=a;var g=!0;null==c&&(c=b.p.create(),g=!1);f.spatialCoordinates=c;f.spatialCoordinatesValid=g;f.registerDisposer(a);f.registerDisposer(a.changed.add(function(){f.handleVoxelSizeChanged()}));return f}r(d,a);v(d,[{key:"reset",value:function(){this.spatialCoordinatesValid=
!1;this.voxelCoordinates=null;this.voxelSize.reset();this.changed.dispatch()}},{key:"getVoxelCoordinates",value:function(a){var d=this.voxelCoordinates;if(d)b.p.copy(a,d);else if(this.valid)this.voxelSize.voxelFromSpatial(a,this.spatialCoordinates);else return!1;return!0}},{key:"setVoxelCoordinates",value:function(a){var d=this.voxelSize;d.valid?(d.spatialFromVoxel(this.spatialCoordinates,a),this.markSpatialCoordinatesChanged()):(d=this.voxelCoordinates)?b.p.copy(d,a):this.voxelCoordinates=b.p.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,d=this.voxelSize.toJSON(),
b={};void 0!==d&&(a=!1,b.voxelSize=d);this.voxelCoordinatesValid?(this.getVoxelCoordinates(g),b.voxelCoordinates=Array.prototype.slice.call(g),a=!1):this.spatialCoordinatesValid&&(b.spatialCoordinates=Array.prototype.slice.call(this.spatialCoordinates),a=!1);if(!a)return b}},{key:"restoreState",value:function(a){var d=this;Object(l.u)(a);Object(l.w)(a,"voxelSize",function(a){void 0!==a&&d.voxelSize.restoreState(a)});this.spatialCoordinatesValid=!1;Object(l.w)(a,"voxelCoordinates",function(a){void 0!==
a&&d.setVoxelCoordinates(Object(l.b)(b.p.create(),a))});Object(l.w)(a,"spatialCoordinates",function(a){void 0!==a&&(Object(l.b)(d.spatialCoordinates,a),d.markSpatialCoordinatesChanged())})}},{key:"snapToVoxel",value:function(){if(this.valid){for(var a=this.spatialCoordinates,d=this.voxelSize.size,b=0;3>b;++b){var c=d[b];a[b]=Math.round(a[b]/c)*c}this.changed.dispatch()}else if(a=this.voxelCoordinates,null!=a){for(d=0;3>d;++d)a[d]=Math.round(a[d]);this.changed.dispatch()}}},{key:"assign",value:function(a){this.spatialCoordinatesValid=
a.spatialCoordinatesValid;b.p.copy(this.spatialCoordinates,a.spatialCoordinates);this.voxelCoordinates=(a=a.voxelCoordinates)&&b.p.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,d){if(a.spatialCoordinatesValid&&d.spatialCoordinatesValid)return{spatialOffset:b.p.subtract(b.p.create(),a.spatialCoordinates,
d.spatialCoordinates)};if(a.voxelCoordinates&&d.voxelCoordinates){if(a.voxelSize!==d.voxelSize)throw Error("Voxel offsets are only meaningful with identical voxelSize.");return{voxelOffset:b.p.subtract(b.p.create(),a.voxelCoordinates,d.voxelCoordinates)}}return{}}},{key:"addOffset",value:function(a,d,c,f){f=void 0===f?1:f;var k=c.spatialOffset;c=c.voxelOffset;void 0!==k&&d.spatialCoordinatesValid?(b.p.scaleAndAdd(a.spatialCoordinates,d.spatialCoordinates,k,f),a.markSpatialCoordinatesChanged()):void 0!==
c&&d.getVoxelCoordinates(g)&&a.setVoxelCoordinates(b.p.scaleAndAdd(g,g,c,f))}}]);return d}(n.a);c=function(){function a(d,b){b=void 0===b?new q:b;p(this,a);this.peer=d;this.link=b}v(a,[{key:"toJSON",value:function(){var a=this.link;if(a.value!==t.LINKED)return{link:a.toJSON(),value:this.getValueJson()}}},{key:"getValueJson",value:function(){return this.value.toJSON()}},{key:"reset",value:function(){this.link.value=t.LINKED}},{key:"restoreState",value:function(a){var d=this;void 0===a?this.link.value=
t.LINKED:(Object(l.u)(a),this.link.value=t.UNLINKED,Object(l.w)(a,"value",function(a){void 0!==a&&d.value.restoreState(a)}),Object(l.w)(a,"link",function(a){return d.link.restoreState(a)}))}},{key:"copyToPeer",value:function(){this.link.value!==t.LINKED&&(this.link.value=t.UNLINKED,this.peer.assign(this.value),this.link.value=t.LINKED)}},{key:"changed",get:function(){return this.value.changed}}]);return a}();var k=function(d){function b(){p(this,b);var d=h(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,
arguments));d.value=a(new f(d.peer.voxelSize.addRef()),d.peer,d.link,{assign:function(a,d){return a.assign(d)},isValid:function(a){return a.spatialCoordinatesValid||a.voxelCoordinatesValid},difference:f.getOffset,add:f.addOffset,subtract:function(a,d,b){f.addOffset(a,d,b,-1)}});return d}r(b,d);v(b,[{key:"getValueJson",value:function(){var a=this.value.toJSON()||{};delete a.voxelSize;return a}}]);return b}(c),x=function(a){function d(a){p(this,d);var c=h(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));
c.changed=new w.a;null==a&&(a=b.l.create());c.orientation=a;return c}r(d,a);v(d,[{key:"toJSON",value:function(){var a=this.orientation;b.l.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(l.b)(this.orientation,a),b.l.normalize(this.orientation,this.orientation)}catch(I){b.l.identity(this.orientation)}this.changed.dispatch()}},{key:"reset",value:function(){b.l.identity(this.orientation);
this.changed.dispatch()}},{key:"snap",value:function(){var a=b.i.create();b.i.fromQuat(a,this.orientation);for(var d=[!1,!1,!1],c=0;3>c;++c){for(var f=0,g=0,k=0;3>k;++k){var e=a[3*c+k];a[3*c+k]=0;!d[k]&&Math.abs(e)>Math.abs(f)&&(f=e,g=k)}a[3*c+g]=Math.sign(f);d[g]=!0}b.l.fromMat3(this.orientation,a);this.changed.dispatch()}},{key:"assign",value:function(a){b.l.copy(this.orientation,a.orientation);this.changed.dispatch()}}],[{key:"makeRelative",value:function(a,c){var f=new d(b.l.multiply(b.l.create(),
a.orientation,c)),g=!1;f.registerDisposer(a.changed.add(function(){g||(k=!0,b.l.multiply(f.orientation,a.orientation,c),f.changed.dispatch(),k=!1)}));var k=!1,e=b.l.invert(b.l.create(),c);f.registerDisposer(f.changed.add(function(){k||(g=!0,b.l.multiply(a.orientation,f.orientation,e),a.changed.dispatch(),g=!1)}));return f}}]);return d}(n.a),B=function(c){function f(){p(this,f);var c=h(this,(f.__proto__||Object.getPrototypeOf(f)).apply(this,arguments));c.value=a(new x,c.peer,c.link,{assign:function(a,
d){return a.assign(d)},isValid:function(){return!0},difference:function(a,d){var c=b.l.create();return b.l.multiply(c,b.l.invert(c,d.orientation),a.orientation)},add:function(a,d,c){b.l.multiply(a.orientation,d.orientation,c);a.changed.dispatch()},subtract:function(a,c,f){b.l.multiply(a.orientation,c.orientation,b.l.invert(d,f));a.changed.dispatch()}});return c}r(f,c);return f}(c),E=function(a){function c(a,d){p(this,c);var b=h(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));b.changed=new w.a;
null==a&&(a=new f);b.position=a;null==d&&(d=new x);b.orientation=d;b.registerDisposer(b.position);b.registerDisposer(b.orientation);b.registerDisposer(b.position.changed.add(b.changed.dispatch));b.registerDisposer(b.orientation.changed.add(b.changed.dispatch));return b}r(c,a);v(c,[{key:"reset",value:function(){this.position.reset();this.orientation.reset()}},{key:"toMat4",value:function(a){b.j.fromRotationTranslation(a,this.orientation.orientation,this.position.spatialCoordinates)}},{key:"toJSON",
value:function(){var a=this.position.toJSON(),d=this.orientation.toJSON();if(void 0!==a||void 0!==d)return{position:a,orientation:d}}},{key:"restoreState",value:function(a){var d=this;Object(l.u)(a);Object(l.w)(a,"position",function(a){void 0!==a&&d.position.restoreState(a)});Object(l.w)(a,"orientation",function(a){void 0!==a&&d.orientation.restoreState(a)})}},{key:"snap",value:function(){this.orientation.snap();this.position.snapToVoxel();this.changed.dispatch()}},{key:"translateAbsolute",value:function(a){b.p.add(this.position.spatialCoordinates,
this.position.spatialCoordinates,a);this.position.changed.dispatch()}},{key:"translateRelative",value:function(a){this.valid&&(b.p.transformQuat(g,a,this.orientation.orientation),b.p.add(this.position.spatialCoordinates,this.position.spatialCoordinates,g),this.position.changed.dispatch())}},{key:"translateVoxelsRelative",value:function(a){if(this.valid){var d=b.p.create();b.p.transformQuat(d,a,this.orientation.orientation);b.p.multiply(d,d,this.position.voxelSize.size);b.p.add(this.position.spatialCoordinates,
this.position.spatialCoordinates,d);this.position.changed.dispatch()}}},{key:"rotateRelative",value:function(a,d){var c=b.l.create();b.l.setAxisAngle(c,a,d);a=this.orientation.orientation;b.l.multiply(a,a,c);this.orientation.changed.dispatch()}},{key:"rotateAbsolute",value:function(a,c,f){var k=b.l.create();b.l.setAxisAngle(k,a,c);a=this.orientation.orientation;if(void 0!==f){c=this.position.spatialCoordinates;var e=b.p.subtract(g,f,c),m=b.l.invert(d,a);b.p.transformQuat(e,e,m);b.l.multiply(a,k,a);
b.p.transformQuat(c,e,a);b.p.subtract(c,f,c);this.position.changed.dispatch()}else b.l.multiply(a,k,a);this.orientation.changed.dispatch()}},{key:"valid",get:function(){return this.position.valid}}]);return c}(n.a),C=function(a){function d(a,b){a=void 0===a?Number.NaN:a;b=void 0===b?a:b;p(this,d);var c=h(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));c.value_=a;c.defaultValue=b;c.changed=new w.a;return c}r(d,a);v(d,[{key:"toJSON",value:function(){var a=this.value_,d=this.defaultValue;if(!(Number.isNaN(a)&&
Number.isNaN(d)||a===d))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 d=this.value_;Number.isNaN(d)||(this.value=d*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 d}(n.a),y=function(d){function b(){p(this,b);var d=h(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));d.value=function(){var b=new C;return a(b,d.peer,d.link,{assign:function(a,d){return a.assign(d)},isValid:function(a){return a.valid},difference:function(a,d){return a.value/d.value},add:function(a,d,b){a.value=d.value*b},subtract:function(a,d,b){a.value=d.value/b}})}();return d}r(b,d);return b}(c),G=function(a){function d(a,b){a=void 0===a?new E:a;b=void 0===b?Number.NaN:
b;p(this,d);var c=h(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));c.pose=a;c.changed=new w.a;c.zoomFactor="number"===typeof b?new C(b):b;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}r(d,a);v(d,[{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 d=this.zoomFactor.value;b.j.scale(a,a,b.p.fromValues(d,d,d))}},{key:"toJSON",value:function(){var a=this.pose.toJSON(),d=this.zoomFactor.toJSON();if(void 0!==a||void 0!==d)return{pose:a,
zoomFactor:d}}},{key:"restoreState",value:function(a){var d=this;try{Object(l.u)(a),Object(l.w)(a,"pose",function(a){void 0!==a&&d.pose.restoreState(a)}),Object(l.w)(a,"zoomFactor",function(a){void 0!==a&&d.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 d}(n.a)},function(n,e){},function(n,e,c){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)}c.d(e,"a",function(){return b});var h=c(8);n=c(16);var 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 v(a,b,c){null===a&&(a=Function.prototype);var g=Object.getOwnPropertyDescriptor(a,b);if(void 0===g){if(a=Object.getPrototypeOf(a),null!==a)return v(a,b,c)}else{if("value"in g)return g.value;b=g.get;return void 0===b?void 0:b.call(c)}};e=this&&this.__decorate||function(a,b,c,e){var g=
arguments.length,d=3>g?b:null===e?e=Object.getOwnPropertyDescriptor(b,c):e,f;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)d=Reflect.decorate(a,b,c,e);else for(var k=a.length-1;0<=k;k--)if(f=a[k])d=(3>g?f(d):3<g?f(b,c,d):f(b,c))||d;return 3<g&&d&&Object.defineProperty(b,c,d),d};var b=l=function(b){function c(a,b){b=void 0===b?{}:b;if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");var g=(c.__proto__||Object.getPrototypeOf(c)).call(this,a,b);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.updatingValue_=!1;void 0!==a&&(g.base=new h.b(b.value),g.setupChangedHandler());return g}p(c,b);r(c,[{key:"initializeCounterpart",value:function(b,e){e=void 0===e?{}:e;e.value=this.value;a(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"initializeCounterpart",this).call(this,b,e)}},{key:"setupChangedHandler",value:function(){var a=this;this.registerDisposer(this.base.changed.add(function(){if(a.updatingValue_)a.updatingValue_=!1;
else{var b=a.rpc;null!==b&&b.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,b){var c=new l;c.base=b;c.setupChangedHandler();c.initializeCounterpart(a);return c}},{key:"make",value:function(a,b){return l.makeFromExisting(a,new h.b(b))}}]);return c}(n.c);b=l=e([Object(n.f)("SharedWatchableValue")],
b);Object(n.e)("SharedWatchableValue.changed",function(a){var b=this.get(a.id);b.updatingValue_=!0;b.base.value=a.value;b.updatingValue_=!1});var l},function(n,e){n.exports=function(c){var e=typeof c;return null!=c&&("object"==e||"function"==e)}},function(n,e,c){function p(a,d){if(!(a instanceof d))throw new TypeError("Cannot call a class as a function");}function h(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 r(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 a(a){switch(a){case m.b.FLOAT32:return E.e;default:throw Error("Data type not supported by WebGL: ${DataType[dataType]}");}}e.f=function(a){return new q.a(void 0===
a?"void main() {\n  emitDefault();\n}\n":a,f.B)};c.d(e,"c",function(){return P});c.d(e,"b",function(){return K});c.d(e,"e",function(){return T});c.d(e,"d",function(){return Q});var b=c(35);n=c(15);var l=c(43),w=c(55),v=c(169),t=c(66),q=c(8),m=c(38),g=c(0),d=c(1),f=c(2),k=c(23),x=c(3),B=c(24),E=c(25),C=c(36),y=c(12),G=function da(a,d,b){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,d);if(void 0===c){if(a=Object.getPrototypeOf(a),null!==a)return da(a,d,b)}else{if("value"in
c)return c.value;d=c.get;return void 0===d?void 0:d.call(b)}},A=function(){function a(a,d){for(var b=0;b<d.length;b++){var c=d[b];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(d,b,c){b&&a(d.prototype,b);c&&a(d,c);return d}}(),H=c(70),D=d.j.create(),I=new Float32Array(4);e.a="//NEUROGLANCER_SKELETON_LAYER_FRAGMENT_MAIN_START";var F=function(a){function b(a){p(this,b);var d=h(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));
d.vertexAttributes=a;d.shaders=new Map;d.shaderGeneration=-1;d.vertexAttributesKey=Object(f.g)(d.vertexAttributes);return d}r(b,a);A(b,[{key:"defineShader",value:function(a,d){a.addUniform("highp vec4","uColor");a.addUniform("highp mat4","uProjection");a.addUniform("highp vec4","uPickID");var b="\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(H);this.vertexAttributes.forEach(function(d,c){a.addAttribute("highp "+d.glslDataType,"aVertex"+c);0!==c&&(a.addVarying("highp "+d.glslDataType,"vVertex"+c),b+="vVertex"+c+" = aVertex"+c+";\n",a.addFragmentCode("#define "+d.name+" vVertex"+c+"\n"))});a.setVertexMain(b);a.setFragmentMainFunction("//NEUROGLANCER_SKELETON_LAYER_FRAGMENT_MAIN_START\n"+d)}},{key:"beginLayer",value:function(a,b,c,f){c=d.j.multiply(D,c.dataToDevice,f);a.uniformMatrix4fv(b.uniform("uProjection"),!1,c)}},
{key:"getShader",value:function(a,d,b){var c=this;return this.registerDisposer(a.memoize.get("skeleton/SkeletonShaderManager:"+Object(k.a)(d)+":"+this.vertexAttributesKey+":"+b,function(){var f=new C.a(a);f.require(d);c.defineShader(f,b);return f.build()}))}},{key:"setColor",value:function(a,d,b){a.uniform4fv(d.uniform("uColor"),b)}},{key:"setPickID",value:function(a,d,b){a.uniform4fv(d.uniform("uPickID"),Object(y.p)(I,b))}},{key:"drawSkeleton",value:function(a,d,b){for(var c=this.vertexAttributes,
f=c.length,g=b.vertexAttributeOffsets,k=0;k<f;++k){var e=c[k];b.vertexBuffer.bindToVertexAttrib(d.attribute("aVertex"+k),e.numComponents,e.webglDataType,!1,0,g[k])}b.indexBuffer.bind();a.drawElements(a.LINES,b.numIndices,a.UNSIGNED_INT,0)}},{key:"endLayer",value:function(a,d){for(var b=this.vertexAttributes.length,c=0;c<b;++c)a.disableVertexAttribArray(d.attribute("aVertex"+c))}}]);return b}(g.a),P=function(c){function f(b,c,g,k){p(this,f);var e=h(this,(f.__proto__||Object.getPrototypeOf(f)).call(this));
e.chunkManager=b;e.source=c;e.voxelSizeObject=g;e.displayState=k;e.tempMat=d.j.create();e.redrawNeeded=new x.a;e.fallbackFragmentMain="void main() {\n  emitDefault();\n}\n";Object(w.f)(k,e);e.displayState.shaderError.value=void 0;e.registerDisposer(k.fragmentMain.changed.add(function(){e.displayState.shaderError.value=void 0;e.redrawNeeded.dispatch()}));b=e.sharedObject=e.registerDisposer(new w.b(b,k));b.RPC_TYPE_ID=v.a;b.initializeCounterpartWithChunkManager({source:c.addCounterpartRef()});b=e.vertexAttributes=
[V];c=$jscomp.makeIterator(c.vertexAttributes);for(g=c.next();!g.done;g=c.next())k=$jscomp.makeIterator(g.value),g=k.next().value,k=k.next().value,b.push({name:g,dataType:k.dataType,numComponents:k.numComponents,webglDataType:a(k.dataType),glslDataType:1<k.numComponents?"vec"+k.numComponents:"float"});return e}r(f,c);A(f,[{key:"getShader",value:function(a,d,b){var c=this.displayState.fragmentMain,f=c.changed.count,g=d.shaders;d.shaderGeneration!==f&&(g.clear(),d.shaderGeneration=f);f=g.get(b);if(void 0===
f){f=null;try{f=d.getShader(a,b,c.value),this.fallbackFragmentMain=c.value,this.displayState.shaderError.value=null}catch(Sa){this.displayState.shaderError.value=Sa;try{f=d.getShader(a,b,this.fallbackFragmentMain)}catch(Ta){}}g.set(b,f)}return f}},{key:"draw",value:function(a,c,f,g){void 0===g&&(g=a.emitColor?1:5);var k=this.gl,e=this.source,m=this.displayState,l=Math.min(1,m.objectAlpha.value);if(!(0>=l)){var q=this.getShader(k,f,a.emitter);if(null!==q){q.bind();var x=this.tempMat;d.j.identity(x);
e.skeletonVertexCoordinatesInVoxels&&d.j.scale(x,x,this.voxelSizeObject.size);d.j.multiply(x,this.displayState.objectToDataTransform.transform,x);f.beginLayer(k,q,a,x);e=e.chunks;var t=a.pickIDs;k.lineWidth(g);Object(w.d)(m,e,function(d,g,e){e.state===b.d.GPU_MEMORY&&(a.emitColor&&f.setColor(k,q,Object(w.e)(m,d,l)),a.emitPickID&&f.setPickID(k,q,t.registerUint64(c,g)),f.drawSkeleton(k,q,e))});f.endLayer(k,q)}}}},{key:"visibility",get:function(){return this.sharedObject.visibility}},{key:"gl",get:function(){return this.chunkManager.chunkQueueManager.gl}}]);
return f}(g.a),K=function(a){function d(a){p(this,d);var b=h(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));b.base=a;b.renderHelper=b.registerDisposer(new F(b.base.vertexAttributes));b.registerDisposer(a);b.registerDisposer(a.redrawNeeded.add(function(){b.redrawNeeded.dispatch()}));b.setReady(!0);b.registerDisposer(a.visibility.add(b.visibility));return b}r(d,a);A(d,[{key:"draw",value:function(a){this.base.draw(a,this,this.renderHelper)}},{key:"gl",get:function(){return this.base.gl}},{key:"isTransparent",
get:function(){return 1>this.base.displayState.objectAlpha.value}}]);return d}(l.a),T=function(a){function d(a){p(this,d);var b=h(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));b.base=a;b.renderHelper=b.registerDisposer(new F(b.base.vertexAttributes));b.registerDisposer(a);b.registerDisposer(a.redrawNeeded.add(function(){b.redrawNeeded.dispatch()}));b.setReady(!0);b.registerDisposer(a.visibility.add(b.visibility));return b}r(d,a);A(d,[{key:"draw",value:function(a){this.base.draw(a,this,
this.renderHelper,10)}},{key:"gl",get:function(){return this.base.gl}}]);return d}(t.b),V={dataType:m.b.FLOAT32,numComponents:3,name:"",webglDataType:E.e,glslDataType:"vec3"},S=function(a){function d(a,b){p(this,d);a=h(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,a));a.vertexAttributes=b.vertexAttributes;var c=a.indices=b.indices;a.vertexAttributeOffsets=b.vertexAttributeOffsets;a.numIndices=c.length;return a}r(d,a);A(d,[{key:"copyToGPU",value:function(a){G(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),
"copyToGPU",this).call(this,a);this.vertexBuffer=B.a.fromData(a,this.vertexAttributes,a.ARRAY_BUFFER,a.STATIC_DRAW);this.indexBuffer=B.a.fromData(a,this.indices,a.ELEMENT_ARRAY_BUFFER,a.STATIC_DRAW)}},{key:"freeGPUMemory",value:function(a){G(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"freeGPUMemory",this).call(this,a);this.vertexBuffer.dispose();this.indexBuffer.dispose()}}]);return d}(n.b),L=new Map,Q=function(a){function d(){p(this,d);return h(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,
arguments))}r(d,a);A(d,[{key:"getChunk",value:function(a){return new S(this,a)}},{key:"skeletonVertexCoordinatesInVoxels",get:function(){return!0}},{key:"vertexAttributes",get:function(){return L}}]);return d}(n.e)},function(n,e,c){function p(a,d){if(!(a instanceof d))throw new TypeError("Cannot call a class as a function");}function h(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 r(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 a(a){a.addFragmentCode("\nvoid emit(vec4 color, vec4 pickId) {\n  gl_FragColor = color;\n}\n")}function b(a){a.addFragmentCode("\nvoid emit(vec4 color, vec4 pickId) {\n  gl_FragColor = pickId;\n}\n")}
c.d(e,"b",function(){return E});c.d(e,"a",function(){return C});var l=c(96),w=c(20),v=c(98);n=c(99);var t=c(46),q=c(17),m=c(1),g=c(103),d=c(25),f=c(68),k=c(104),x=function(){function a(a,d){for(var b=0;b<d.length;b++){var c=d[b];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(d,b,c){b&&a(d.prototype,b);c&&a(d,c);return d}}(),B;(function(a){a[a.COLOR=0]="COLOR";a[a.PICK=1]="PICK";a[a.NUM_TEXTURES=2]="NUM_TEXTURES"})(B||
(B={}));var E=function(a){function d(){p(this,d);return h(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments))}r(d,a);x(d,[{key:"draw",value:function(a){}}]);return d}(w.h),C=function(c){function e(d,b,c,x){p(this,e);var A=h(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,d,b,x));A.sliceView=c;A.axesLineHelper=A.registerDisposer(l.a.get(A.gl));A.sliceViewRenderHelper=A.registerDisposer(t.d.get(A.gl,a));A.colorFactor=m.r.fromValues(1,1,1,1);A.backgroundColor=m.r.fromValues(.5,
.5,.5,1);A.pickIDs=new v.a;A.visibleLayerTracker=Object(w.i)(A.viewer.layerManager,E,A);A.offscreenFramebuffer=A.registerDisposer(new f.b(A.gl,{colorBuffers:Object(f.e)(A.gl,B.NUM_TEXTURES)}));A.offscreenCopyHelper=A.registerDisposer(f.c.get(A.gl));A.scaleBarCopyHelper=A.registerDisposer(f.c.get(A.gl));A.scaleBarTexture=A.registerDisposer(new k.a(A.gl));Object(q.c)(b,"translate-via-mouse-drag",function(a){A.viewer.mouseState.updateUnconditionally()&&Object(g.a)(a.detail,function(a,d,b){a=A.viewer.navigationState.position;
var c=a.spatialCoordinates;m.p.set(c,d,b,0);m.p.transformMat4(c,c,A.sliceView.viewportToData);a.changed.dispatch()})});Object(q.c)(b,"rotate-via-mouse-drag",function(a){var d=A.viewer.mouseState;if(d.updateUnconditionally()){var b=m.p.clone(d.position);Object(g.a)(a.detail,function(a,d,c){a=A.sliceView.viewportAxes;A.viewer.navigationState.pose.rotateAbsolute(a[1],d/4*Math.PI/180,b);A.viewer.navigationState.pose.rotateAbsolute(a[0],c/4*Math.PI/180,b)})}});A.registerDisposer(c);A.registerDisposer(c.visibility.add(A.visibility));
A.registerDisposer(c.viewChanged.add(function(){A.visible&&d.scheduleRedraw()}));A.registerDisposer(x.showAxisLines.changed.add(function(){A.visible&&A.scheduleRedraw()}));A.registerDisposer(x.showScaleBar.changed.add(function(){A.visible&&A.context.scheduleRedraw()}));return A}r(e,c);x(e,[{key:"isReady",value:function(){return this.sliceView.isReady()}},{key:"draw",value:function(){var c=this.sliceView;if(c.hasValidViewport){this.onResize();c.updateRendering();var f=this.gl,g=c.width,k=c.height,
e=c.dataToDevice;this.offscreenFramebuffer.bind(g,k);f.disable(d.n);this.gl.clearColor(0,0,0,0);f.clear(d.d);var l=m.j.create();this.sliceViewRenderHelper.draw(c.offscreenFramebuffer.colorBuffers[0].texture,m.d,this.colorFactor,this.backgroundColor,0,0,1,1);var q=this.visibleLayerTracker.getVisibleLayers(),x=this.pickIDs;x.clear();this.offscreenFramebuffer.bindSingle(B.COLOR);x={dataToDevice:c.dataToDevice,pickIDs:x,emitter:a,emitColor:!0,emitPickID:!1,viewportWidth:g,viewportHeight:k};f.enable(d.b);
f.blendFunc(d.o,d.k);for(var t=$jscomp.makeIterator(q),w=t.next();!w.done;w=t.next())w.value.draw(x);f.disable(d.b);this.offscreenFramebuffer.bindSingle(B.PICK);x.emitColor=!1;x.emitPickID=!0;x.emitter=b;q=$jscomp.makeIterator(q);for(w=q.next();!w.done;w=q.next())w.value.draw(x);if(this.viewer.showAxisLines.value||this.viewer.showScaleBar.value){if(this.viewer.showAxisLines.value){m.j.copy(l,e);for(e=0;3>e;++e)l[12+e]=0;for(e=0;4>e;++e)l[2+4*e]=0;k=Math.min(g,k)/4*1.5;e=c.pixelSize;for(q=0;12>q;++q)l[q]=
l[q]*k*e}this.offscreenFramebuffer.bindSingle(B.COLOR);this.viewer.showAxisLines.value&&this.axesLineHelper.draw(l);this.viewer.showScaleBar.value&&(f.enable(d.b),f.blendFunc(d.o,d.k),l=this.scaleBarTexture,k=l.dimensions,k.targetLengthInPixels=Math.min(g/4,100),k.nanometersPerPixel=c.pixelSize,l.update(),f.viewport(10,10,l.width,l.height),this.scaleBarCopyHelper.draw(l.texture),f.disable(d.b))}this.offscreenFramebuffer.unbind();this.setGLViewport();this.offscreenCopyHelper.draw(this.offscreenFramebuffer.colorBuffers[B.COLOR].texture)}}},
{key:"onResize",value:function(){this.sliceView.setViewportSize(this.element.clientWidth,this.element.clientHeight)}},{key:"updateMouseState",value:function(a){a.pickedRenderLayer=null;var d=this.sliceView;if(!d.hasValidViewport)return!1;var b=d.width,c=d.height,f=this.offscreenFramebuffer;if(!f.hasSize(b,c))return!1;var g=a.position,k=this.mouseX,e=this.mouseY;m.p.set(g,k-b/2,e-c/2,0);m.p.transformMat4(g,g,d.viewportToData);this.pickIDs.setMouseState(a,f.readPixelAsUint32(B.PICK,k,c-e));return!0}},
{key:"zoomByMouse",value:function(a){var d=this.navigationState;if(d.valid){var b=this.sliceView,c=b.height,f=this.mouseX,g=this.mouseY;f-=b.width/2;g-=c/2;c=this.navigationState.zoomFactor.value;d.zoomBy(a);a=d.zoomFactor.value;var k=d.position.spatialCoordinates;m.p.scaleAndAdd(k,k,b.viewportAxes[0],f*(c-a));m.p.scaleAndAdd(k,k,b.viewportAxes[1],g*(c-a));d.position.changed.dispatch()}}},{key:"navigationState",get:function(){return this.sliceView.navigationState}}]);return e}(n.a)},function(n,e,
c){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 h(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)}c.d(e,"a",function(){return g});
var r=c(57);n=c(20);var a=c(32),b=c(1),l=c(47),w=c(36),v=c(16),t=function(){function a(a,d){for(var b=0;b<d.length;b++){var c=d[b];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(d,b,c){b&&a(d.prototype,b);c&&a(d,c);return d}}(),q=function f(a,b,c){null===a&&(a=Function.prototype);var g=Object.getOwnPropertyDescriptor(a,b);if(void 0===g){if(a=Object.getPrototypeOf(a),null!==a)return f(a,b,c)}else{if("value"in g)return g.value;
b=g.get;return void 0===b?void 0:b.call(c)}},m=b.p.create(),g=function(c){function f(c,g,k){k=void 0===k?{}:k;if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var e=p(this,(f.__proto__||Object.getPrototypeOf(f)).call(this));e.chunkManager=c;e.sources=g;e.shader=void 0;e.shaderUpdated=!0;e.rpcId=null;e.transformedSourcesGeneration=-1;c=k;var q=void 0===c.transform?new r.a:c.transform;c=void 0===c.shaderError?Object(l.b)():c.shaderError;e.transform=q;e.shaderError=c;
c.value=void 0;k=Object(a.o)(e)[0][0];c=k.chunkLayout;k=k.source.spec;for(var x=e.voxelSize=c.localSpatialVectorToGlobal(b.p.create(),k.voxelSize),t=0;3>t;++t)x[t]=Math.abs(x[t]);x=e.boundingBox=new b.b(b.p.fromValues(Infinity,Infinity,Infinity),b.p.fromValues(-Infinity,-Infinity,-Infinity));t=b.p.create();for(var w=0;8>w;++w){for(var h=0;3>h;++h)m[h]=w&1<<h?k.upperClipBound[h]:k.lowerClipBound[h];c.localSpatialToGlobal(t,m);b.p.min(x.lower,x.lower,t);b.p.max(x.upper,x.upper,t)}c=e.registerDisposer(new v.b);
var B=e.chunkManager.rpc;c.RPC_TYPE_ID=a.f;g=g.map(function(a){return a.map(function(a){return a.rpcId})});c.initializeCounterpart(B,{sources:g,transform:q.transform});e.rpcId=c.rpcId;e.registerDisposer(q.changed.add(function(){B.invoke(a.g,{id:e.rpcId,value:q.transform})}));e.setReady(!0);return e}h(f,c);t(f,[{key:"initializeShader",value:function(){if(this.shaderUpdated){this.shaderUpdated=!1;try{var a=this.getShader();this.disposeShader();this.shader=a;this.shaderError.value=null}catch(B){this.shaderError.value=
B}}}},{key:"disposeShader",value:function(){this.shader&&(this.shader.dispose(),this.shader=void 0)}},{key:"disposed",value:function(){q(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"disposed",this).call(this);this.disposeShader()}},{key:"getShaderKey",value:function(){return""}},{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 w.a(this.gl);this.defineShader(a);
return a.build()}},{key:"setGLBlendMode",value:function(a,b){0<b&&(a.enable(a.BLEND),a.blendFunc(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA))}},{key:"gl",get:function(){return this.chunkManager.chunkQueueManager.gl}}]);return f}(n.e)},function(n,e,c){function p(a,d){if(!(a instanceof d))throw new TypeError("Cannot call a class as a function");}function h(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 r(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)}c.d(e,"a",function(){return m});e.e=function(a,d,b,c){b=void 0===b?a.RGBA:b;c=void 0===c?a.UNSIGNED_BYTE:c;for(var g=[],k=0;k<d;++k)g[k]=new f(a,b,c);return g};c.d(e,"b",function(){return x});
c.d(e,"c",function(){return B});n=c(0);var a=c(1),b=c(23),l=c(69),w=c(58),v=c(97),t=function C(a,d,b){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,d);if(void 0===c){if(a=Object.getPrototypeOf(a),null!==a)return C(a,d,b)}else{if("value"in c)return c.value;d=c.get;return void 0===d?void 0:d.call(b)}},q=function(){function a(a,d){for(var b=0;b<d.length;b++){var c=d[b];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,
c)}}return function(d,b,c){b&&a(d.prototype,b);c&&a(d,c);return d}}();c=function(a){function d(){p(this,d);var a=h(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments));a.width=Number.NaN;a.height=Number.NaN;return a}r(d,a);q(d,[{key:"hasSize",value:function(a,d){return this.width===a&&this.height===d}},{key:"resize",value:function(a,d){this.hasSize(a,d)||(this.width=a,this.height=d,this.performResize())}}]);return d}(n.a);var m=function(a){function d(a,b){b=void 0===b?!1:b;p(this,d);
var c=h(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,a,b?a.DEPTH_STENCIL:a.DEPTH_COMPONENT16));c.gl=a;c.includeStencilBuffer=b;return c}r(d,a);q(d,[{key:"attachToFramebuffer",value:function(){var a=this.gl;t(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"attachToFramebuffer",this).call(this,this.includeStencilBuffer?a.DEPTH_STENCIL_ATTACHMENT:a.DEPTH_ATTACHMENT)}}]);return d}(function(a){function d(a,b){p(this,d);var c=h(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));
c.gl=a;c.internalformat=b;c.renderbuffer=null;c.renderbuffer=a.createRenderbuffer();return c}r(d,a);q(d,[{key:"performResize",value:function(){var a=this.gl;a.bindRenderbuffer(a.RENDERBUFFER,this.renderbuffer);a.renderbufferStorage(a.RENDERBUFFER,this.internalformat,this.width,this.height);a.bindRenderbuffer(a.RENDERBUFFER,null)}},{key:"disposed",value:function(){this.gl.deleteRenderbuffer(this.renderbuffer)}},{key:"attachToFramebuffer",value:function(a){var d=this.gl;d.framebufferRenderbuffer(d.FRAMEBUFFER,
a,d.RENDERBUFFER,this.renderbuffer)}}]);return d}(c)),g=function(a){function d(a){p(this,d);return h(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,a,!0))}r(d,a);return d}(m);e.d=g;var d=function(a){function d(a){p(this,d);var b=h(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));b.gl=a;b.framebuffer=b.gl.createFramebuffer();return b}r(d,a);q(d,[{key:"disposed",value:function(){this.gl.deleteFramebuffer(this.framebuffer)}},{key:"bind",value:function(){var a=this.gl;a.bindFramebuffer(a.FRAMEBUFFER,
this.framebuffer)}},{key:"unbind",value:function(){var a=this.gl;a.bindFramebuffer(a.FRAMEBUFFER,null)}}]);return d}(n.a),f=function(a){function d(a,b,c){p(this,d);var f=h(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));f.gl=a;f.format=b;f.dataType=c;f.texture=a.createTexture();return f}r(d,a);q(d,[{key:"performResize",value:function(){Object(w.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 d=this.gl;d.framebufferTexture2D(d.FRAMEBUFFER,a,d.TEXTURE_2D,this.texture,0)}}]);return d}(c),k=new Uint8Array(4),x=function(a){function b(a,c){p(this,b);var f=h(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));f.gl=a;f.width=Number.NaN;f.height=Number.NaN;f.fullAttachmentList=[];f.attachmentVerified=!1;f.singleAttachmentList=[f.gl.COLOR_ATTACHMENT0];var g=void 0===c.framebuffer?new d(a):c.framebuffer,k=c.colorBuffers;c=c.depthBuffer;f.framebuffer=
f.registerDisposer(g);f.colorBuffers=k;f.depthBuffer=c;void 0!==c&&f.registerDisposer(c);var e=f.fullAttachmentList;k.forEach(function(d,b){f.registerDisposer(d);e[b]=a.COLOR_ATTACHMENT0+b});return f}r(b,a);q(b,[{key:"hasSize",value:function(a,d){return this.width===a&&this.height===d}},{key:"bind",value:function(a,d){this.width=a;this.height=d;this.framebuffer.bind();var b=this.gl,c=this.depthBuffer;void 0!==c&&(c.resize(a,d),c.attachToFramebuffer());this.colorBuffers.forEach(function(c,f){c.resize(a,
d);c.attachToFramebuffer(b.COLOR_ATTACHMENT0+f)});b.WEBGL_draw_buffers.drawBuffersWEBGL(this.fullAttachmentList);this.verifyAttachment();b.viewport(0,0,a,d)}},{key:"bindSingle",value:function(a){var d=this.gl;this.framebuffer.bind();0!==a&&d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0+a,d.TEXTURE_2D,null,0);d.bindTexture(d.TEXTURE_2D,null);this.colorBuffers[a].attachToFramebuffer(d.COLOR_ATTACHMENT0);d.WEBGL_draw_buffers.drawBuffersWEBGL(this.singleAttachmentList)}},{key:"unbind",value:function(){this.framebuffer.unbind()}},
{key:"readPixel",value:function(a,d,b){var c=this.gl;try{this.bindSingle(a),c.readPixels(d,b,1,1,c.RGBA,c.UNSIGNED_BYTE,k)}finally{this.framebuffer.unbind()}return k}},{key:"readPixelAsUint32",value:function(a,d,b){a=this.readPixel(a,d,b);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 b}(n.a),B=function(d){function c(a,d){p(this,c);var b=h(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));b.gl=a;b.shader=d;b.copyVertexPositionsBuffer=Object(l.a)(b.gl);b.copyTexCoordsBuffer=Object(l.a)(b.gl,0,0,1,1);b.registerDisposer(d);return b}r(c,d);q(c,[{key:"draw",value:function(d){for(var b=[],c=0;c<arguments.length;++c)b[c-0]=arguments[c];c=this.gl;var f=this.shader;f.bind();for(var g=b.length,k=0;k<g;++k)c.activeTexture(c.TEXTURE0+k),c.bindTexture(c.TEXTURE_2D,b[k]);
c.uniformMatrix4fv(f.uniform("uProjectionMatrix"),!1,a.d);b=f.attribute("aVertexPosition");this.copyVertexPositionsBuffer.bindToVertexAttrib(b,2);f=f.attribute("aTexCoord");this.copyTexCoordsBuffer.bindToVertexAttrib(f,2);c.drawArrays(c.TRIANGLE_FAN,0,4);c.disableVertexAttribArray(b);c.disableVertexAttribArray(f);for(b=0;b<g;++b)c.activeTexture(c.TEXTURE0+b),c.bindTexture(c.TEXTURE_2D,null)}}],[{key:"get",value:function(a,d,f){d=void 0===d?v.a:d;f=void 0===f?1:f;return a.memoize.get("OffscreenCopyHelper:"+
f+":"+Object(b.a)(d),function(){return new c(a,Object(v.b)(a,d,f))})}}]);return c}(n.a)},function(n,e,c){e.a=function(a,b,c,e,v){b=void 0===b?-1:b;c=void 0===c?-1:c;e=void 0===e?1:e;v=void 0===v?1:v;return a.memoize.get("SquareCornersBuffer:"+b+","+c+","+e+","+v,function(){return new p.b(h.a.fromData(a,new Float32Array([b,c,b,v,e,v,e,c]),r.a,r.p))}).value};var p=c(0),h=c(24),r=c(25)},function(n,e){n.exports="\n\nvec3 colormapJet(float x) {\n  vec3 result;\n  result.r = x < 0.89 ? ((x - 0.35) / 0.31) : (1.0 - (x - 0.89) / 0.11 * 0.5);\n  result.g = x < 0.64 ? ((x - 0.125) * 4.0) : (1.0 - (x - 0.64) / 0.27);\n  result.b = x < 0.34 ? (0.5 + x * 0.5 / 0.11) : (1.0 - (x - 0.34) / 0.31);\n  return clamp(result, 0.0, 1.0);\n}\n"},
function(n,e,c){function p(a,d){if(!(a instanceof d))throw new TypeError("Cannot call a class as a function");}function h(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 r(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 a(a){Object(y.u)(a);var d=Object(y.w)(a,"neariso_voxelres",function(a){return Object(y.v)(a,y.k)}),b=Object(y.w)(a,"neariso_imagesize",function(a){return Object(y.v)(a,y.j)}),c=Object(y.w)(a,"neariso_offset",function(a){return Object(y.v)(a,y.l)});return Object(y.w)(a,"resolutions",function(a){return Object(y.a)(a,y.s)}).map(function(a){var f=""+a,g=d.get(f),k=b.get(f),e=c.get(f);if(void 0===g||void 0===
k||void 0===e)throw Error("Missing neariso_voxelres/neariso_imagesize/neariso_offset for resolution "+(a+"."));return{key:f,voxelSize:g,imageSize:k,voxelOffset:e}})}function b(a){a=A.get(a);void 0===a&&(a=k.c.UNKNOWN);return a}function l(a){Object(y.u)(a);var d=Object(y.w)(a,"channel_type",y.B);return{channelType:d,description:Object(y.w)(a,"description",y.B),volumeType:b(d),dataType:Object(y.w)(a,"datatype",function(a){return Object(y.n)(a,k.a)})}}function w(d){Object(y.u)(d);return{channels:Object(y.w)(d,
"channels",function(a){return Object(y.v)(a,l)}),scales:Object(y.w)(d,"dataset",a)}}function v(a,d,b,c){return a.memoize.getUncounted({type:"ndstore:getTokenInfo",hostnames:d,token:b},function(){return Object(C.e)(Object(C.c)(d,c+"/"+b+"/info/"),"json").then(w)})}function t(a,d,b,c){var f=b.match(F);if(null===f)throw Error("Invalid volume path "+JSON.stringify(b));var g=f[1],k=f[2],e=Object(y.e)(f[3]||"");return a.memoize.getUncounted({type:"ndstore:MultiscaleVolumeChunkSource",hostnames:d,path:b},
function(){return v(a,d,g,c).then(function(b){return new I(a,d,g,b,k,c,e)})})}function q(a,d){var b=d.match(P);if(null===b)throw Error("Invalid ndstore volume path: "+JSON.stringify(d));return t(a,[b[1]],b[2],f.b)}function m(a,d,b){return a.memoize.getUncounted({type:"dvid:getPublicTokens",hostnames:d},function(){return Object(C.e)(Object(C.c)(d,b+"/public_tokens/"),"json").then(function(a){return Object(y.a)(a,y.B)})})}function g(a,d,b,c){var f=b.match(/^(?:([^\/]+)(?:\/([^\/]*))?)?$/);if(null===
f)return Promise.reject(null);if(void 0===f[2]){var g=f[1]||"";return m(a,d,c).then(function(a){return{offset:0,completions:Object(B.c)(g,a,function(a){return a+"/"},function(){})}})}return v(a,d,f[1],c).then(function(a){a=Object(B.c)(f[2],a.channels,function(a){return a[0]},function(a){return a[1].channelType+" ("+k.a[a[1].dataType]+")"});return{offset:f[1].length+1,completions:a}})}function d(a,d){var b=a.match(P);return null===b?Promise.reject(null):g(d,[b[1]],b[2],f.b).then(function(a){return Object(B.a)(b[1].length+
1,a)})}Object.defineProperty(e,"__esModule",{value:!0});c.d(e,"getVolume",function(){return q});c.d(e,"volumeCompleter",function(){return d});c.d(e,"MultiscaleVolumeChunkSource",function(){return I});e.getTokenInfo=v;e.getShardedVolume=t;e.getPublicTokens=m;e.tokenAndChannelCompleter=g;c.d(e,"NDStoreDataSource",function(){return K});c.d(e,"SingleServerDataSource",function(){return T});n=c(15);e=c(30);var f=c(105),k=c(13),x=c(21),B=c(42),E=c(1),C=c(37),y=c(2),G=function(){function a(a,d){for(var b=
0;b<d.length;b++){var c=d[b];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(d,b,c){b&&a(d.prototype,b);c&&a(d,c);return d}}(),A=new Map;A.set("image",k.c.IMAGE);A.set("annotation",k.c.SEGMENTATION);var H=new Set(["npz","raw","jpeg"]),D=function(a){function d(){p(this,d);return h(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments))}r(d,a);return d}(Object(n.f)(x.b,f.c)),I=function(){function a(d,b,c,g,e,
m,l){p(this,a);this.chunkManager=d;this.baseUrls=b;this.key=c;this.tokenInfo=g;this.parameters=l;this.urlPrefix=f.b;this.neariso=!0;if(void 0===e){e=Array.from(g.channels.keys());if(1!==e.length)throw Error("Dataset contains multiple channels: "+JSON.stringify(e));e=e[0]}d=g.channels.get(e);if(void 0===d)throw Error("Specified channel "+JSON.stringify(e)+" is not one of the supported "+("channels "+JSON.stringify(Array.from(g.channels.keys()))));this.channel=e;this.channelInfo=d;this.scales=g.scales;
void 0!==m&&(this.urlPrefix=m);"false"===Object(y.z)(l.neariso)&&(this.neariso=!1);g=Object(y.z)(l.encoding);if(void 0===g)g=this.volumeType===k.c.IMAGE?"jpeg":"npz";else if(!H.has(g))throw Error("Invalid encoding: "+JSON.stringify(g)+".");this.encoding=g}G(a,[{key:"getSources",value:function(a){var d=this;return this.scales.map(function(b){for(var c=b.voxelOffset,f=b.voxelSize,g=E.p.create(),e=0;3>e;++e)g[e]=Math.ceil(c[e]);return k.b.getDefaults({numChannels:d.numChannels,volumeType:d.volumeType,
dataType:d.dataType,voxelSize:f,transform:E.j.fromTranslation(E.j.create(),E.p.multiply(E.p.create(),c,f)),baseVoxelOffset:g,upperVoxelBound:b.imageSize,volumeSourceOptions:a}).map(function(a){return d.chunkManager.getChunkSource(D,{spec:a,parameters:{baseUrls:d.baseUrls,urlPrefix:d.urlPrefix,key:d.key,channel:d.channel,resolution:b.key,encoding:d.encoding,neariso:d.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):\/\/[^\/?]+)\/(.*)$/,K=function(a){function b(){p(this,b);return h(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}r(b,a);G(b,[{key:"volumeCompleter",value:function(a,b){return d(a,b)}},{key:"getVolume",value:function(a,d){return q(a,d)}},{key:"description",get:function(){return"NDstore"}}]);
return b}(e.a),T=function(a){function d(a,b,c){c=void 0===c?f.b:c;p(this,d);var g=h(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));g.description=a;g.hostnames=b;g.urlprefix=c;return g}r(d,a);G(d,[{key:"getVolume",value:function(a,d){return t(a,this.hostnames,d,this.urlprefix)}},{key:"volumeCompleter",value:function(a,d){return g(d,this.hostnames,a,this.urlprefix)}}]);return d}(e.a)},function(n,e,c){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 h(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)}c.d(e,"a",function(){return l});n=c(0);var r=c(11),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}}(),b=function v(a,b,c){null===a&&(a=Function.prototype);var g=Object.getOwnPropertyDescriptor(a,b);if(void 0===g){if(a=Object.getPrototypeOf(a),null!==a)return v(a,b,c)}else{if("value"in g)return g.value;b=g.get;return void 0===b?void 0:b.call(c)}};c(196);var l=function(c){function e(a,b){var c=void 0===b?{}:b;b=void 0===c.min?0:c.min;var d=
void 0===c.max?1:c.max;c=void 0===c.step?.01:c.step;if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var f=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));f.value=a;f.element=document.createElement("label");f.promptElement=document.createElement("span");f.inputElement=document.createElement("input");var k=f.element,m=f.promptElement,l=f.inputElement;k.className="range-slider";m.className="range-prompt";l.type="range";l.min=""+b;l.max=""+d;l.step=""+c;l.valueAsNumber=
f.value.value;k.appendChild(m);k.appendChild(l);var q=function(){f.value.value=f.inputElement.valueAsNumber};f.registerEventListener(l,"change",q);f.registerEventListener(l,"input",q);f.registerEventListener(l,"wheel",function(a){a=a.deltaY;0<a?(f.inputElement.stepUp(),q()):0>a&&(f.inputElement.stepDown(),q())});a.changed.add(function(){f.inputElement.valueAsNumber=f.value.value});return f}h(e,c);a(e,[{key:"disposed",value:function(){Object(r.b)(this.element);b(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),
"disposed",this).call(this)}}]);return e}(n.a)},function(n,e,c){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 h(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)}c.d(e,"a",function(){return v});n=c(197);c.n(n);n=c(116);var r=c.n(n);n=c(9);var a=c.n(n);n=c(0);var b=c(11),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,g){c&&a(b.prototype,c);g&&a(b,g);return b}}(),w=function q(a,b,d){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,b);if(void 0===
c){if(a=Object.getPrototypeOf(a),null!==a)return q(a,b,d)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(d)}};c(198);c(199);c(200);c(201)(r.a);var v=function(c){function e(b){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var d=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));d.state=b;d.changingValue=!1;d.debouncedValueUpdater=a()(function(){d.changingValue=!0;try{d.state.fragmentMain.value=d.textEditor.getValue()}finally{d.changingValue=
!1}},500);d.textEditor=r()(function(a){},{value:d.state.fragmentMain.value,mode:"glsl",gutters:["CodeMirror-lint-markers"]});d.textEditor.on("change",function(){d.setValidState(void 0);d.debouncedValueUpdater()});d.registerDisposer(d.state.fragmentMain.changed.add(function(){d.changingValue||d.textEditor.setValue(d.state.fragmentMain.value)}));d.element.classList.add("neuroglancer-shader-code-widget");d.registerDisposer(d.state.shaderError.changed.add(function(){d.updateErrorState()}));d.updateErrorState();
return d}h(e,c);l(e,[{key:"updateErrorState",value:function(){var a=this,d=this.state.shaderError.value;void 0===d?this.setValidState(void 0):null!==d?(this.textEditor.setOption("lint",{getAnnotations:function(){if("ShaderCompilationError"===d.name){var b=d.source.split("\n").indexOf(a.state.fragmentMainStartLine)+2;return d.errorMessages.map(function(a){return{message:a.message,severity:"error",from:r.a.Pos(void 0===a.line?0:a.line-b)}})}return"ShaderLinkError"===d.name?[{message:d.log,severity:"error",
from:r.a.Pos(0)}]:[{message:d.message,severity:"error",from:r.a.Pos(0)}]}}),this.setValidState(!1)):(this.textEditor.setOption("lint",void 0),this.setValidState(!0))}},{key:"setValidState",value:function(a){var d=this.element;d.classList.remove("invalid-input");d.classList.remove("valid-input");!0===a?d.classList.add("valid-input"):!1===a&&d.classList.add("invalid-input")}},{key:"disposed",value:function(){this.debouncedValueUpdater.flush();this.debouncedValueUpdater=void 0;Object(b.b)(this.element);
this.textEditor=void 0;w(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"disposed",this).call(this)}},{key:"element",get:function(){return this.textEditor.getWrapperElement()}}]);return e}(n.a)},function(n,e,c){c.d(e,"a",function(){return h});var p=function(){function c(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(a,b,e){b&&c(a.prototype,b);e&&c(a,e);return a}}();
e.b=4093;var h=function(){function c(a,b,e,w){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");this.a0=a;this.a1=b;this.b=e;this.c=w}p(c,[{key:"computeDotProduct",value:function(a,b){var c=this.a0,e=this.a1;return c[0]*(a&255)+c[1]*(a>>8&255)+c[2]*(a>>16&255)+c[3]*(a>>24&255)+(e[0]*(b&255)+e[1]*(b>>8&255)+e[2]*(b>>16&255)+e[3]*(b>>24&255))}},{key:"compute",value:function(a,b){var c=this.b,e=this.c;a=this.computeDotProduct(a,b);return(a+a*a%4093*e+c)%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 c(Float32Array.of(a(),a(),a(),a()),Float32Array.of(a(),a(),a(),a()),a(),a())}}]);return c}()},function(n,e,c){function p(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 h(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 r(a,d){if(!(a instanceof d))throw new TypeError("Cannot call a class as a function");}c.d(e,"b",function(){return g});c.d(e,"a",function(){return B});var a=c(74),b=c(19),l=
function C(a,d,b){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,d);if(void 0===c){if(a=Object.getPrototypeOf(a),null!==a)return C(a,d,b)}else{if("value"in c)return c.value;d=c.get;return void 0===d?void 0:d.call(b)}},w=function(){function a(a,d){for(var b=0;b<d.length;b++){var c=d[b];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(d,b,c){b&&a(d.prototype,b);c&&a(d,c);return d}}();e.c=3;var v=
0,t=0,q=0,m=0;n=function(){function d(a){a=void 0===a?d.generateHashFunctions(3):a;r(this,d);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)}w(d,[{key:"updateHashFunctions",value:function(a){this.hashFunctions=d.generateHashFunctions(a);this.mungedEmptyKey=-1}},{key:"tableWithMungedEmptyKey",
value:function(a){for(var d=this.hashFunctions.length,b=Array(d),c=0;c<d;++c)b[c]=this.getHash(c,this.emptyLow,this.emptyHigh);c=this.mungedEmptyKey;if(-1===c)a:for(;;){c=16777216*Math.random()>>>0;for(var f=0;f<d;++f)for(var g=this.getHash(f,c,c),k=0;k<d;++k)if(b[k]===g)continue a;this.mungedEmptyKey=c;break}f=this.table;g=this.emptyLow;k=this.emptyHigh;for(var e=0;e<d;++e){var m=b[e];f[m]===g&&f[m+1]===k&&(f[m]=c,f[m+1]=c)}try{a(f)}finally{for(a=0;a<d;++a)e=b[a],f[e]===c&&f[e+1]===c&&(f[e]=g,f[e+
1]=k)}}},{key:"getHash",value:function(a,d,b){a=this.hashFunctions[a];var c=this.width,f=this.height;c=a[0].compute(d,b)%c;d=a[1].compute(d,b)%f;return this.entryStride*(d*this.width+c)}},{key:"keys",value:function(a){function d(d,v){for(;;)switch(c){case 0:a=void 0===a?new b.a:a,w=h,t=w.emptyLow,x=w.emptyHigh,q=w.entryStride,l=h,m=l.table,e=0,k=m.length;case 1:if(!(e<k)){c=3;break}g=m[e];f=m[e+1];if(g===t&&f===x){c=4;break}a.low=g;a.high=f;c=5;return{value:a,done:!1};case 5:if(void 0===v){c=6;break}c=
-1;throw v;case 6:case 4:case 2:e+=q;c=1;break;case 3:c=-1;default:return{value:void 0,done:!0}}}var c=0,f,g,k,e,m,l,q,x,t,w,h=this,v={next:function(a){return d(a,void 0)},throw:function(a){return d(void 0,a)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();v[Symbol.iterator]=function(){return this};return v}},{key:"indexOfPair",value:function(a,d){var b=this.table,c=this.emptyHigh;if(a===this.emptyLow&&d===c)return-1;c=0;for(var f=this.hashFunctions.length;c<
f;++c){var g=this.getHash(c,a,d);if(b[g]===a&&b[g+1]===d)return g}return-1}},{key:"indexOf",value:function(a){return this.indexOfPair(a.low,a.high)}},{key:"chooseAnotherEmptyKey",value:function(){for(var a=this.emptyLow,d=this.emptyHigh,b=this.table,c=this.entryStride,f,g;f=4294967296*Math.random()>>>0,g=4294967296*Math.random()>>>0,f===a&&g===d||this.hasPair(f,g););this.emptyLow=f;this.emptyHigh=g;for(var k=0,e=b.length;k<e;k+=c)b[k]===a&&b[k+1]===d&&(b[k]=f,b[k+1]=g)}},{key:"has",value:function(a){return-1!==
this.indexOf(a)}},{key:"hasPair",value:function(a,d){return-1!==this.indexOfPair(a,d)}},{key:"delete",value:function(a){a=this.indexOf(a);if(-1!==a){var d=this.table;d[a]=this.emptyLow;d[a+1]=this.emptyHigh;++this.generation;this.size--;return!0}return!1}},{key:"clearTable",value:function(){for(var a=this.table,d=this.entryStride,b=this.emptyLow,c=this.emptyHigh,f=a.length,g=0;g<f;g+=d)a[g]=b,a[g+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,d){var b=v,c=t;this.storePending(a,d);a[d]=b;a[d+1]=c}},{key:"storePending",value:function(a,d){v=a[d];t=a[d+1]}},{key:"backupPending",value:function(){q=v;m=t}},{key:"restorePending",value:function(){v=q;t=m}},{key:"tryToInsert",value:function(){for(var a=0,d=this.emptyLow,b=this.emptyHigh,c=this.maxAttempts,f=this.table,g=this.hashFunctions.length,k=Math.floor(Math.random()*g);;){var e=this.getHash(k,v,t);this.swapPending(f,e);if(v===d&&t===b)return!0;
if(++a===c)break;k=(k+Math.floor(Math.random()*(g-1))+1)%g}return!1}},{key:"allocate",value:function(a,d){var b=a*d;this.width=a;this.height=d;this.table=new Uint32Array(b*this.entryStride);this.maxAttempts=b;this.clearTable();this.capacity=b*this.loadFactor;this.mungedEmptyKey=-1}},{key:"rehash",value:function(a,d,b){this.allocate(d,b);this.updateHashFunctions(this.hashFunctions.length);d=this.emptyLow;b=this.emptyHigh;for(var c=this.entryStride,f=0,g=a.length;f<g;f+=c){var k=a[f+1];if(a[f]!==d||
k!==b)if(this.storePending(a,f),!this.tryToInsert())return!1}return!0}},{key:"grow",value:function(a){for(var d=this.table,b=this.width,c=this.height,f=this.maxWidth,g=this.maxHeight;;){var k=b*c;b=Math.min(f,Math.ceil(a/this.height));b*c<a&&(c=Math.min(g,Math.ceil(a/b)));var e=b*c;if(e<a&&e===k)throw Error("Maximum table size exceeded");for(k=0;k<this.maxRehashAttempts;++k)if(this.rehash(d,b,c))return;a=Math.ceil(this.growFactor*a)}}},{key:"insertInternal",value:function(){++this.generation;v===
this.emptyLow&&t===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(d){d=void 0===d?3:d;for(var b=[],c=0;c<d;++c){var f=[a.a.generate(),a.a.generate()];b.push(f)}return b}}]);return d}();var g=function(a){function d(){r(this,
d);return p(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments))}h(d,a);$jscomp.initSymbol();$jscomp.initSymbolIterator();w(d,[{key:"add",value:function(a){var d=a.low;a=a.high;if(this.hasPair(d,a))return!1;v=d;t=a;this.insertInternal();return!0}},{key:Symbol.iterator,value:function(){return this.keys()}}]);return d}(n);g.prototype.entryStride=2;var d=0,f=0,k=0,x=0,B=function(a){function c(){r(this,c);return p(this,(c.__proto__||Object.getPrototypeOf(c)).apply(this,arguments))}h(c,
a);$jscomp.initSymbol();$jscomp.initSymbolIterator();w(c,[{key:"set",value:function(a,b){var c=a.low;a=a.high;if(this.hasPair(c,a))return!1;v=c;t=a;d=b.low;f=b.high;this.insertInternal();return!0}},{key:"get",value:function(a,d){a=this.indexOf(a);if(-1===a)return!1;var b=this.table;d.low=b[a+2];d.high=b[a+3];return!0}},{key:"swapPending",value:function(a,b){var g=d,k=f;l(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"swapPending",this).call(this,a,b);a[b+2]=g;a[b+3]=k}},{key:"storePending",
value:function(a,b){l(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"storePending",this).call(this,a,b);d=a[b+2];f=a[b+3]}},{key:"backupPending",value:function(){l(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"backupPending",this).call(this);k=d;x=f}},{key:"restorePending",value:function(){l(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"restorePending",this).call(this);d=k;f=x}},{key:Symbol.iterator,value:function(){return this.entries()}},{key:"entries",value:function(a){function d(d,
p){for(;;)switch(c){case 0:a=void 0===a?[new b.a,new b.a]:a,B=r,v=B.emptyLow,h=B.emptyHigh,w=B.entryStride,t=r,x=t.table,q=$jscomp.makeIterator(a),l=q.next().value,m=q.next().value,e=0,k=x.length;case 1:if(!(e<k)){c=3;break}g=x[e];f=x[e+1];if(g===v&&f===h){c=4;break}l.low=g;l.high=f;m.low=x[e+2];m.high=x[e+3];c=5;return{value:a,done:!1};case 5:if(void 0===p){c=6;break}c=-1;throw p;case 6:case 4:case 2:e+=w;c=1;break;case 3:c=-1;default:return{value:void 0,done:!0}}}var c=0,f,g,k,e,m,l,q,x,t,w,h,v,
B,r=this,p={next:function(a){return d(a,void 0)},throw:function(a){return d(void 0,a)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();p[Symbol.iterator]=function(){return this};return p}}]);return c}(n);B.prototype.entryStride=4},function(n,e,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function h(a,b,c){c=Math.ceil(c/b);a.dataWidth=b;a.textureHeight=c;a.textureAccessCoefficients=Float32Array.of(1/b,1/(b*c),
b)}c.d(e,"b",function(){return t});e.c=function(d,c,g){g=void 0===g?1:g;switch(c){case a.b.UINT8:if(1>g||4<g)break;d.texelsPerElement=1;d.textureFormat=q[g];d.texelType=b.y;d.arrayElementsPerTexel=g;d.arrayConstructor=Uint8Array;return d;case a.b.UINT16:if(1>g||2<g)break;d.texelsPerElement=1;d.textureFormat=q[2*g];d.texelType=b.y;d.arrayElementsPerTexel=2*g;d.arrayConstructor=Uint8Array;return d;case a.b.UINT64:if(1!==g)break;d.texelsPerElement=2;d.textureFormat=b.m;d.texelType=b.y;d.arrayElementsPerTexel=
4;d.arrayConstructor=Uint8Array;return d;case a.b.UINT32:if(1!==g)break;d.texelsPerElement=1;d.textureFormat=b.m;d.texelType=b.y;d.arrayElementsPerTexel=4;d.arrayConstructor=Uint8Array;return d;case a.b.FLOAT32:if(!(1>g||4<g))return d.texelsPerElement=1,d.textureFormat=q[g],d.texelType=b.e,d.arrayElementsPerTexel=g,d.arrayConstructor=Float32Array,d}throw Error("No supported texture format for "+a.b[c]+"["+g+"].");};e.e=function(a,b,c,g,e,m){b=b.maxTextureSize;var d=g*e*m;if(!(c*g<=b&&e*m<=b))if(c*
g*e<=b&&m<=b)g*=e;else if(g=Math.ceil(d/b),g*c>b)throw Error("Chunk data size exceeds maximum texture size: "+c+" * "+d);h(a,g,d)};e.d=function(a,b,c,g){b=b.maxTextureSize;var d=Math.ceil(g/b);if(d*c>b)throw Error("Number of elements exceeds maximum texture size: "+c+" * "+g);h(a,d,g)};e.f=function(a,c,g,e){var d=g.arrayConstructor,f=g.textureFormat,k=g.texelsPerElement,m=c.dataWidth;c=c.textureHeight;var l=m*c*g.arrayElementsPerTexel*k;e.constructor!==d&&(e=new d(e.buffer,e.byteOffset,e.byteLength/
d.BYTES_PER_ELEMENT));e=Object(r.a)(e,l);a.pixelStorei(b.w,1);Object(w.b)(a);a.texImage2D(a.TEXTURE_2D,0,f,m*k,c,0,f,g.texelType,e)};c.d(e,"a",function(){return g});var r=c(102),a=c(38),b=c(25),l=c(12),w=c(58),v=function(){function a(a,d){for(var b=0;b<d.length;b++){var c=d[b];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(d,b,c){b&&a(d.prototype,b);c&&a(d,c);return d}}(),t=function f(){p(this,f)},q=[-1,b.h,b.i,b.l,b.m],
m=["","r","ra","rgb","rgba"],g=function(){function b(a){p(this,b);this.key=a;this.uniformName="uTextureAccessCoefficients_"+this.key;this.readTextureValue="readTextureValue_"+this.key}v(b,[{key:"defineShader",value:function(a){a.addUniform("highp vec3",this.uniformName)}},{key:"getReadTextureValueCode",value:function(a){for(var b=this.uniformName,c="\nvoid "+this.readTextureValue+"(highp sampler2D sampler, float index",f=0;f<a;++f)c+=", out vec4 output"+f;c+=") {\n  float offset = "+.5/a+";\n  float xCoord = fract((index + offset) * "+
b+".x);\n  vec2 texCoords = vec2(xCoord,\n                        (index - (xCoord - 0.5 - offset * "+b+".x) * "+b+".z) *\n                        "+b+".y);\n";for(f=0;f<a;++f)c+="\n  output"+f+" = texture2D(sampler,\n                        vec2(texCoords.x +\n                             "+b+".x * "+(f/a).toFixed(8)+",\n                             texCoords.y));\n";return c+"\n}\n"}},{key:"getAccessor",value:function(b,c,f,g){g=void 0===g?1:g;var k=Object(l.a)(f,g),e=[];e.push(this.getReadTextureValueCode(f===
a.b.UINT64?2:1));b="\n"+k+" "+b+"(float index) {\n";switch(f){case a.b.UINT8:e.push(l.m);b+="\n  "+k+" result;\n  vec4 temp;\n  "+this.readTextureValue+"("+c+", index, temp);\n  result.value = temp."+m[g]+";\n  return result;\n";break;case a.b.UINT16:e.push(l.j);b+="\n  "+k+" result;\n  vec4 temp;\n  "+this.readTextureValue+"("+c+", index, temp);\n  result.value = temp."+m[2*g]+";\n  return result;\n";break;case a.b.UINT32:e.push(l.k);b+="\n  "+k+" result;\n  "+this.readTextureValue+"("+c+", index, result.value);\n  return result;\n";
break;case a.b.UINT64:e.push(l.l);b+="\n  "+k+" result;\n  "+this.readTextureValue+"("+c+", index, result.low, result.high);\n  return result;\n";break;case a.b.FLOAT32:e.push(l.e),b+="\n  vec4 temp;\n  "+this.readTextureValue+"("+c+", index, temp);\n  return temp."+m[g]+";\n"}e.push(b+"\n}\n");return e}},{key:"setupTextureLayout",value:function(a,b,c){a.uniform3fv(b.uniform(this.uniformName),c.textureAccessCoefficients)}}]);return b}()},function(n,e,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
}function h(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 r(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)}c.d(e,"c",function(){return w});
e.d=function(b){var c,d,f;return function(g,e){if(void 0!==d&&(void 0===c||void 0===g||c.generation!==g.generation))return void 0===c&&f.addConsumer(e),d;c=void 0;f=new a.c;return d=b(g,f).then(function(a){c=a;f=void 0;return a},function(a){f.isCanceled&&(d=f=void 0);throw a;})}};c.d(e,"a",function(){return t});c.d(e,"b",function(){return q});var a=c(29);n=c(0);var b=c(53),l=function(){function a(a,d){for(var b=0;b<d.length;b++){var c=d[b];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in
c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),w=function(a){function b(){p(this,b);return h(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}r(b,a);return b}(n.a),v=function(){function a(){p(this,a);this.providers=new Map}l(a,[{key:"register",value:function(a,d){this.providers.set(a,d)}},{key:"getCredentialsProvider",value:function(a,d){var b=this.providers.get(a);if(void 0===b)throw Error("No registered credentials provider: "+
JSON.stringify(a));return b(d)}}]);return a}(),t=function(a){function c(a){p(this,c);var d=h(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));d.base=a;d.memoize=new b.b;return d}r(c,a);l(c,[{key:"getCredentialsProvider",value:function(a,b){var d=this;return this.memoize.get({key:a,parameters:b},function(){return d.registerDisposer(d.base.getCredentialsProvider(a,b).addRef())})}}]);return c}(n.a),q=function(a){function b(){p(this,b);return h(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,
new v))}r(b,a);l(b,[{key:"register",value:function(a,b){this.base.register(a,b)}}]);return b}(t)},function(n,e,c){(function(e,h){function r(b,c,g){t(b,c);var d=this;a.call(this);setTimeout(function(){d._start(b,c,g)},0)}var a=c(10).EventEmitter,b=c(4),l=c(34),w=c(51),v=c(18),t=function(){};"production"!==e.env.NODE_ENV&&(t=c(7)("sockjs-client:sender:xdr"));b(r,a);r.prototype._start=function(a,b,c){t("_start");var d=this,f=new h.XDomainRequest;b=v.addQuery(b,"t="+ +new Date);f.onerror=function(){t("onerror");
d._error()};f.ontimeout=function(){t("ontimeout");d._error()};f.onprogress=function(){t("progress",f.responseText);d.emit("chunk",200,f.responseText)};f.onload=function(){t("load");d.emit("finish",200,f.responseText);d._cleanup(!1)};this.xdr=f;this.unloadRef=l.unloadAdd(function(){d._cleanup(!0)});try{this.xdr.open(a,b),this.timeout&&(this.xdr.timeout=this.timeout),this.xdr.send(c)}catch(k){this._error()}};r.prototype._error=function(){this.emit("finish",0,"");this._cleanup(!1)};r.prototype._cleanup=
function(a){t("cleanup",a);if(this.xdr){this.removeAllListeners();l.unloadDel(this.unloadRef);this.xdr.ontimeout=this.xdr.onerror=this.xdr.onprogress=this.xdr.onload=null;if(a)try{this.xdr.abort()}catch(m){}this.unloadRef=this.xdr=null}};r.prototype.close=function(){t("close");this._cleanup(!0)};r.enabled=!(!h.XDomainRequest||!w.hasDomain());n.exports=r}).call(e,c(6),c(5))},function(n,e,c){(function(e){var h=c(4),r=c(131),a=c(80);n.exports=function(b){function c(a,c){r.call(this,b.transportName,a,
c)}h(c,r);c.enabled=function(c,l){if(!e.document)return!1;c=a.extend({},l);c.sameOrigin=!0;return b.enabled(c)&&r.enabled()};c.transportName="iframe-"+b.transportName;c.needBody=!0;c.roundTrips=r.roundTrips+b.roundTrips-1;c.facadeTransport=b;return c}}).call(e,c(5))},function(n,e,c){n.exports={isObject:function(c){var e=typeof c;return"function"===e||"object"===e&&!!c},extend:function(c){if(!this.isObject(c))return c;for(var e,r,a=1,b=arguments.length;a<b;a++)for(r in e=arguments[a],e)Object.prototype.hasOwnProperty.call(e,
r)&&(c[r]=e[r]);return c}}},function(n,e,c){function p(c){this.type=c}p.prototype.initEvent=function(c,e,a){this.type=c;this.bubbles=e;this.cancelable=a;this.timeStamp=+new Date;return this};p.prototype.stopPropagation=function(){};p.prototype.preventDefault=function(){};p.CAPTURING_PHASE=1;p.AT_TARGET=2;p.BUBBLING_PHASE=3;n.exports=p},function(n,e,c){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 h(a,b){var c=document.documentElement.scrollTop+Math.min(document.documentElement.clientHeight-a.offsetHeight,b.clientY);a.style.left=document.documentElement.scrollLeft+Math.min(document.documentElement.clientWidth-a.offsetWidth,b.clientX)+"px";a.style.top=c+"px";a.style.visibility=null}c.d(e,"a",function(){return w});var r=c(0),
a=c(11),b=c(3),l=function(){function a(a,b){for(var c=0;c<b.length;c++){var g=b[c];g.enumerable=g.enumerable||!1;g.configurable=!0;"value"in g&&(g.writable=!0);Object.defineProperty(a,g.key,g)}}return function(b,c,e){c&&a(b.prototype,c);e&&a(b,e);return b}}();c(296);var w=function(c){function e(a){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var c=(e.__proto__||Object.getPrototypeOf(e)).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.element=document.createElement("div");c.parentDisposers=new Map;c.disabledValue=!1;c.opened=new b.a;c.closed=new b.a;var g=c.element;g.className="neuroglancer-context-menu";g.style.visibility="hidden";g.tabIndex=-1;document.body.appendChild(g);void 0!==a&&c.registerParent(a);return c}p(e,c);l(e,[{key:"registerParent",value:function(a){var b=this,c=this.parentDisposers;c.has(a)||c.set(a,Object(r.c)(a,"contextmenu",function(a){b.show(a);a.stopPropagation();
a.preventDefault()}))}},{key:"show",value:function(a){var b=this;if(!this.disabledValue){this.hide();var c=this.element,d=Object(r.c)(document,"mousedown",function(a){a.target instanceof Node&&!c.contains(a.target)&&b.hide()},!0),f=Object(r.c)(document,"keydown",function(a){"Escape"===a.code&&b.hide()},!0);c.style.display=null;c.style.visibility="hidden";this.opened.dispatch();h(c,a);this.menuDisposer=function(){f();d();c.style.display="none"}}}},{key:"unregisterParent",value:function(a){var b=this.parentDisposers,
c=b.get(a);void 0!==c&&(c(),b.delete(a))}},{key:"disposed",value:function(){for(var b=this.parentDisposers,c=$jscomp.makeIterator(b.values()),g=c.next();!g.done;g=c.next())g=g.value,g();b.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 e}(r.a)},function(n,e,c){function p(a){return Object(b.a)(a.dataTransfer.types,"neuroglancer-layer\x00")}function h(a){if(void 0!==v&&v.manager.rootLayers===a.rootLayers)return v}function r(a,b,c){if(a.shiftKey)return"copy";if(a.ctrlKey)return"move";a=void 0===c?!1:c;a=void 0===a?!1:a;c=h(b);b=void 0===c?"copy":a||c.manager!==b?"link":"move";return b}e.e=function(a,c){a.dataTransfer.setData(Object(b.b)("neuroglancer-layer\x00",c.layers.map(function(a){return{name:a.name,
visible:a.visible}})),JSON.stringify(c.layers.map(function(a){return a.toJSON()})));void 0!==v&&v.disposer();var g,d=function(){c.manager.unregisterDisposer(d);for(var a=$jscomp.makeIterator(c.layers),b=a.next();!b.done;b=a.next())b.value.dispose();c.manager.dispose();v===g&&(v=void 0)};v=g={manager:c.manager.addRef(),layers:c.layers.map(function(a){return a.addRef()}),disposer:d}};e.a=function(a){if(void 0!==v){if(a&&"move"===a.dataTransfer.dropEffect){var b=new Set(v.layers);v.manager.layerManager.filter(function(a){return!b.has(a)})}v.disposer()}};
e.c=p;e.d=r;e.f=function(a,c,g){return Object(b.e)(a,r(a,c,void 0===g?!1:g))};e.b=function(b,c,g,d,f){var e=h(c),m=!f&&void 0!==e&&e.manager===c;if(!g&&void 0!==e){var q=new t;q.manager=c;q.numSourceLayers=e.layers.length;q.sourceManager=e.manager;q.moveSupported=m;q.layers=new Map;if(!f&&e.manager===c)if(d)e.layers.forEach(function(a,d){q.layers.set(a,d)});else return;e.layers.forEach(function(a,d){!f&&c.layerManager.has(a)||q.layers.set(a.addRef(),d)});return q}b=p(b);if(void 0!==b)try{var w=Object(l.a)(b.parameters,
function(d,b){var f=Object(l.w)(d,"name",l.B);d=Object(l.w)(d,"visible",l.m);f=new a.b(f,null,c);f.visible=d;return[f,b]}),v=new t;v.numSourceLayers=w.length;v.moveSupported=m;v.manager=c;v.dragType=b.dragType;v.layers=new Map(w);return v}catch(y){}};var a=c(14),b=c(84),l=c(2),w=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,c,d){c&&a(b.prototype,c);d&&
a(b,d);return b}}(),v,t=function(){function a(){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");}w(a,[{key:"finalize",value:function(a){var b=this.dragType;if(void 0!==b)try{var d=JSON.parse(a.dataTransfer.getData(b));if(!Array.isArray(d)||this.numSourceLayers!==d.length)throw Error("Invalid layer drop data");for(var c=$jscomp.makeIterator(this.layers),e=c.next();!e.done;e=c.next()){var l=$jscomp.makeIterator(e.value),m=l.next().value,q=l.next().value;this.manager.initializeLayerFromSpec(m,
d[q])}}catch(C){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(n,e,c){e.b=function(a,b){b=JSON.stringify(b);b=Object(p.b)((new TextEncoder).encode(b));return a+b};e.a=function(a,b){a=$jscomp.makeIterator(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;a:{var e=b;if(c.startsWith(e))try{var h=
c.substring(e.length);var t=(new TextDecoder).decode(Object(p.a)(h));var q=JSON.parse(t);break a}catch(m){q=void 0;break a}q=void 0}e=q;if(void 0!==e)return{parameters:e,dragType:c}}};e.e=function(a,b){return r=a.dataTransfer.dropEffect=b};e.c=function(){return r};e.d=function(a){a.draggable=!0;return Object(h.c)(a,"dragstart",function(a){a.stopPropagation();a.preventDefault()})};var p=c(297),h=c(0),r},function(n,e,c){function p(a,d){if(!(a instanceof d))throw new TypeError("Cannot call a class as a function");
}function h(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 r(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)}c.d(e,"b",function(){return x});
c.d(e,"c",function(){return B});c.d(e,"a",function(){return E});var a=c(33),b=c(144),l=c(138);n=c(0);var w=c(11),v=c(17),t=c(1),q=c(45),m=c(101),g=c(104),d=function(){function a(a,d){for(var b=0;b<d.length;b++){var c=d[b];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(d,b,c){b&&a(d.prototype,b);c&&a(d,c);return d}}(),f=function y(a,d,b){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,d);if(void 0===
c){if(a=Object.getPrototypeOf(a),null!==a)return y(a,d,b)}else{if("value"in c)return c.value;d=c.get;return void 0===d?void 0:d.call(b)}};c(300);c(62);e.d="neuroglancer-position";var k=v.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}}),x=function(c){function g(d,c){c=void 0===c?6:c;p(this,g);var f=h(this,(g.__proto__||Object.getPrototypeOf(g)).call(this));f.position=d;f.maxNumberWidth=c;f.element=document.createElement("div");f.inputContainer=document.createElement("div");f.inputElement=document.createElement("input");f.hintElement=document.createElement("input");f.tempPosition=t.p.create();f.updateHintScrollPosition=f.registerCancellable(Object(b.a)(function(){f.hintElement.scrollLeft=f.inputElement.scrollLeft}));
var e=f.element,x=f.inputElement,w=f.hintElement,r=f.inputContainer;r.className="neuroglancer-position-widget-input-container";x.className="neuroglancer-position-widget-input";w.className="neuroglancer-position-widget-hint";f.inputFieldWidth=3*c+11;c=$jscomp.makeIterator([x,w]);for(var B=c.next();!B.done;B=c.next())B=B.value,B.spellcheck=!1,B.autocomplete="off",B.type="text",B.style.width=f.inputFieldWidth+"ch";w.disabled=!0;c=document.createElement("div");c.textContent="\u29c9";c.className="neuroglancer-copy-button neuroglancer-button";
c.title="Copy position to clipboard";c.addEventListener("click",function(){var d=Object(l.b)(f.getPositionText());a.a.showTemporaryMessage(d?"Position copied to clipboard":"Failed to copy position to clipboard")});c.addEventListener("dragstart",function(a){a.dataTransfer.setData("neuroglancer-position",JSON.stringify(d.toJSON()));a.dataTransfer.setData("text",f.getPositionText());a.stopPropagation()});c.draggable=!0;e.appendChild(c);e.appendChild(r);r.appendChild(x);r.appendChild(w);e.className="neuroglancer-position-widget";
f.registerDisposer(d.changed.add(f.registerCancellable(Object(b.a)(function(){return f.updateView()}))));f.registerDisposer(new q.b(x,k)).allShortcutsAreGlobal=!0;f.registerDisposer(new m.a(x,k));f.registerEventListener(x,"change",function(){return f.updatePosition()});f.registerEventListener(x,"blur",function(){return f.updatePosition()});f.registerEventListener(x,"input",function(){return f.cleanInput()});f.registerEventListener(x,"keydown",f.updateHintScrollPosition);f.registerEventListener(x,
"copy",function(a){var d=x.value.substring(x.selectionStart,x.selectionEnd);d=d.trim().replace(/\s+/g," ");a.clipboardData.setData("text/plain",d);a.stopPropagation();a.preventDefault()});var n=!1;f.registerEventListener(x,"mousedown",function(){n=document.activeElement===x});f.registerDisposer(Object(v.c)(x,"select-all-if-was-not-focused",function(a){n||(x.selectionStart=0,x.selectionEnd=x.value.length,x.selectionDirection="forward",a.preventDefault())}));f.registerDisposer(Object(v.c)(x,"tab-forward",
function(a){var d=Math.min(x.selectionStart,x.selectionEnd),b=x.value.substring(d).match(/^([^,\s]*)((?:\s+)|(?:\s*,\s*))?([^,\s]*)/);null!==b&&void 0!==b[2]&&(x.selectionStart=d+b[1].length+b[2].length,x.selectionEnd=x.selectionStart+b[3].length,x.selectionDirection="forward",a.preventDefault())}));f.registerDisposer(Object(v.c)(x,"tab-backward",function(a){var d=x.value.substring(0,Math.max(x.selectionStart,x.selectionEnd)).match(/([^,\s]*)((?:\s+)|(?:\s*,\s*))?([^,\s]*)$/);null!==d&&void 0!==d[2]&&
(x.selectionStart=d.index,x.selectionEnd=x.selectionStart+d[1].length,x.selectionDirection="forward",a.preventDefault())}));f.registerDisposer(Object(v.c)(x,"delete-backward",function(a){if(x.selectionStart===x.selectionEnd&&x.selectionStart===x.value.length){var d=x.value.match(/^(.*)(?![\s])(?:(?:\s+)|(?:\s*,\s*))$/);null!==d&&(x.value=d[1],f.cleanInput(),a.preventDefault())}}));f.registerDisposer(Object(v.c)(x,"cancel",function(){f.updateView();f.inputElement.blur()}));f.registerDisposer(Object(v.c)(x,
"adjust-via-wheel",function(a){a=a.detail;var d=a.deltaY;0!==d&&f.adjustFromCursor(Math.ceil((x.scrollLeft+a.offsetX-x.clientLeft)/(x.scrollWidth/f.inputFieldWidth)),-Math.sign(d))}));f.registerDisposer(Object(v.c)(x,"adjust-up",function(){f.adjustFromCursor(void 0,1)}));f.registerDisposer(Object(v.c)(x,"adjust-down",function(){f.adjustFromCursor(void 0,-1)}));f.updateView();return f}r(g,c);d(g,[{key:"adjustFromCursor",value:function(a,d){var b=this.inputElement;void 0===a&&(a="forward"===b.selectionDirection?
b.selectionEnd:b.selectionStart);void 0!==this.cleanInput()&&(a=b.value.substring(0,a).split(",").length-1,this.updatePosition(),b=this.tempPosition,this.position.getVoxelCoordinates(b)&&(b[a]+=d,this.position.setVoxelCoordinates(b),this.updateView()))}},{key:"cleanInput",value:function(){var a=this.inputElement.selectionStart,d=/(-?\d+(?:\.(?:\d+)?)?)/.source,b=/((?:\s+(?![\s,]))|(?:\s*,\s*))/.source,c=/([\[\]{}()\s]*)/.source;d=this.inputElement.value.match(new RegExp("^"+c+"(?![\\s])"+d+"?"+("(?:"+
b+d+"?(?:"+b+d+"?)?)?")+(c+"$")));if(null!==d){var f="  ",g="x ",e=2,k=d[1].length;b=function(d,b,c){if(void 0!==d){var m=k+d.length;void 0===b&&(b=d,c=" ".repeat(b.length));a>=k&&(e=a===m?f.length+b.length:f.length+Math.min(b.length,a-k));f+=b;g+=c;k=m}};b(d[2]);b(d[3],",   ","  y ");b(d[4]);b(d[5],",   ","  z ");b(d[6]);this.hintElement.value=g;this.inputElement.value!==f&&(this.inputElement.value=f,this.inputElement.selectionEnd=e,this.inputElement.selectionStart=e);this.updateHintScrollPosition();
return void 0!==d[2]&&void 0!==d[4]&&void 0!==d[6]?{position:t.p.set(this.tempPosition,parseFloat(d[2]),parseFloat(d[4]),parseFloat(d[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 d=this.inputElement;a="  "+Math.floor(a[0])+",   "+Math.floor(a[1])+",   "+Math.floor(a[2]);var b=a.indexOf(","),c=a.indexOf(",",b+1)-b-4;b="x "+" ".repeat(b-2)+"  y "+" ".repeat(c)+"  z";c=d.selectionStart;var f=d.selectionEnd,g=d.selectionDirection;d.value=a;d.setSelectionRange(c,f,g);this.hintElement.value=b+" ".repeat(a.length-b.length);this.updateHintScrollPosition()}else this.inputElement.value=
"",this.hintElement.value=""}},{key:"disposed",value:function(){Object(w.b)(this.element);f(g.prototype.__proto__||Object.getPrototypeOf(g.prototype),"disposed",this).call(this)}}]);return g}(n.a),B=function(a){function c(a,d){p(this,c);var f=h(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));f.element=a;f.voxelSize=d;f.dimensionsContainer=document.createElement("span");f.unitsElement=document.createElement("span");var g=f.dimensionsContainer,e=f.unitsElement;a.className="neuroglancer-voxel-size-widget";
a.title="Voxel size";g.className="neuroglancer-voxel-size-dimensions-container";a.appendChild(g);a.appendChild(e);e.className="neuroglancer-voxel-size-units";f.registerDisposer(d.changed.add(f.registerCancellable(Object(b.a)(function(){return f.updateView()}))));f.updateView();return f}r(c,a);d(c,[{key:"updateView",value:function(){var a=this.dimensionsContainer,d=this.unitsElement;Object(w.a)(a);this.element.style.display=this.voxelSize.valid?null:"none";var b=this.voxelSize.size,c=Object(g.b)(Math.min(b[0],
b[1],b[2]));d.textContent=c.unit;for(d=0;3>d;++d){for(var f=b[d]/c.lengthInNanometers,e="",k=0;2>=k&&(e=f.toFixed(k),parseFloat(e)!==f);++k);f=document.createElement("span");f.className="neuroglancer-voxel-size-dimension";f.textContent=e;a.appendChild(f)}}},{key:"disposed",value:function(){Object(w.b)(this.element);f(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"disposed",this).call(this)}}]);return c}(n.a),E=function(a){function c(a,d,f){p(this,c);var g=h(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));
g.element=a;g.mouseState=d;g.voxelSize=f;g.tempPosition=t.p.create();a.className="neuroglancer-mouse-position-widget";a=g.registerCancellable(Object(b.a)(function(){return g.updateView()}));g.registerDisposer(d.changed.add(a));g.registerDisposer(f.changed.add(a));return g}r(c,a);d(c,[{key:"updateView",value:function(){var a="",d=this.mouseState,b=this.voxelSize;d.active&&b.valid&&(a=this.tempPosition,b.voxelFromSpatial(a,d.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(w.b)(this.element);f(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"disposed",this).call(this)}}]);return c}(n.a)},function(n,e,c){function p(a,d){if(!(a instanceof d))throw new TypeError("Cannot call a class as a function");}function h(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 r(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 a(a){var d=a.match(/^([^:?]+:[^:?]+:[^:?]+)(?::([^:?]+))?(?:\?(.*))?$/);if(null===d)throw Error("Invalid Brain Maps volume key: "+JSON.stringify(a)+".");var b;void 0!==d[2]&&(b={changeStackId:d[2]});a=Object(y.e)(d[3]||
"");return{volumeId:d[1],changeSpec:b,parameters:a}}function b(a){try{return Object(y.u)(a),{id:Object(y.w)(a,"id",y.B),label:Object(y.w)(a,"label",y.B),description:Object(y.w)(a,"description",y.z)}}catch(Q){throw Error("Failed to parse project: "+Q.message);}}function l(a){try{return Object(y.u)(a),Object(y.w)(a,"project",function(a){return void 0===a?[]:Object(y.a)(a,b)})}catch(Q){throw Error("Error parsing project list: "+Q.message);}}function w(a){return Object(y.w)(a,"changeStackId",function(a){return void 0===
a?void 0:Object(y.a)(a,y.B)})}Object.defineProperty(e,"__esModule",{value:!0});c.d(e,"BrainmapsSkeletonSource",function(){return D});c.d(e,"VolumeInfo",function(){return F});c.d(e,"MeshInfo",function(){return P});c.d(e,"MultiscaleVolumeChunkSource",function(){return K});e.parseVolumeKey=a;c.d(e,"VolumeList",function(){return V});e.parseChangeStackList=w;c.d(e,"BrainmapsDataSource",function(){return S});n=c(15);var v=c(153),t=c(30),q=c(91),m=c(157),g=c(54),d=c(65),f=c(32),k=c(13),x=c(21),B=c(33),E=
c(42),C=c(1),y=c(2),G=function(){function a(a,d){for(var b=0;b<d.length;b++){var c=d[b];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(d,b,c){b&&a(d.prototype,b);c&&a(d,c);return d}}(),A=function(a){function d(){p(this,d);return h(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments))}r(d,a);return d}(Object(n.f)(Object(v.a)()(x.b),m.d)),H=function(a){function d(){p(this,d);return h(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,
arguments))}r(d,a);return d}(Object(n.f)(Object(v.a)()(g.b),m.a)),D=function(a){function d(){p(this,d);return h(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments))}r(d,a);G(d,[{key:"skeletonVertexCoordinatesInVoxels",get:function(){return!1}}]);return d}(Object(n.f)(Object(v.a)()(d.d),m.b)),I=new Map;I.set("UINT8",k.a.UINT8);I.set("FLOAT",k.a.FLOAT32);I.set("UINT64",k.a.UINT64);var F=function Q(a){p(this,Q);try{Object(y.u)(a),this.numChannels=Object(y.A)(a.channelCount),this.dataType=
Object(y.t)(a.channelType,I),this.voxelSize=Object(y.f)(C.p.create(),a.pixelSize,y.p),this.upperVoxelBound=Object(y.f)(C.p.create(),a.volumeSize,y.A)}catch(da){throw Error("Failed to parse BrainMaps volume geometry: "+da.message);}},P=function X(a){p(this,X);Object(y.u)(a);this.name=Object(y.w)(a,"name",y.B);this.type=Object(y.w)(a,"type",y.B)},K=function(){function a(d,b,c,f,g,e,m,l){p(this,a);this.chunkManager=d;this.instance=b;this.credentialsProvider=c;this.volumeId=f;this.changeSpec=g;this.encoding=
l.encoding;this.chunkLayoutPreference=l.chunkLayoutPreference;try{Object(y.u)(e);var q=this.scales=Object(y.w)(e,"geometry",function(a){return Object(y.a)(a,function(a){return new F(a)})});if(0===q.length)throw Error("Expected at least one scale.");var x=q[0],t=this.numChannels=x.numChannels,w=this.dataType=x.dataType;d=1;for(var h=q.length;d<h;++d){var v=q[d];if(v.dataType!==w)throw Error("Scale "+d+" has data type "+k.a[v.dataType]+" "+("but scale 0 has data type "+k.a[w]+"."));if(v.numChannels!==
t)throw Error("Scale "+d+" has "+v.numChannels+" channel(s) "+("but scale 0 has "+t+" channels."));}if(1===t)switch(w){case k.a.UINT64:var r=k.c.SEGMENTATION}void 0===r&&(r=void 0!==l.volumeType?l.volumeType:k.c.IMAGE);this.volumeType=r}catch(rb){throw Error("Failed to parse BrainMaps multiscale volume specification: "+rb.message);}try{Object(y.u)(m),this.meshes=Object(y.w)(m,"meshes",function(a){return void 0===a?[]:Object(y.a)(a,function(a){return new P(a)})})}catch(rb){throw Error("Failed to parse BrainMaps meshes specification: "+
rb.message);}}G(a,[{key:"getSources",value:function(a){var d=this,b=m.c.RAW;this.dataType===k.a.UINT64?b=m.c.COMPRESSED_SEGMENTATION:this.volumeType===k.c.IMAGE&&this.dataType===k.a.UINT8&&1===this.numChannels&&this.encoding!==m.c.RAW&&(b=m.c.JPEG);return this.scales.map(function(c,f){return k.b.getDefaults({voxelSize:c.voxelSize,dataType:c.dataType,numChannels:c.numChannels,upperVoxelBound:c.upperVoxelBound,volumeType:d.volumeType,volumeSourceOptions:a,chunkLayoutPreference:d.chunkLayoutPreference}).map(function(a){return d.chunkManager.getChunkSource(A,
{credentialsProvider:d.credentialsProvider,spec:a,parameters:{instance:d.instance,volumeId:d.volumeId,changeSpec:d.changeSpec,scaleIndex:f,encoding:b}})})})}},{key:"getMeshSource",value:function(){var a=this.meshes.find(function(a){return"TRIANGLES"===a.type});return void 0===a?null:this.chunkManager.getChunkSource(H,{credentialsProvider:this.credentialsProvider,parameters:{instance:this.instance,volumeId:this.volumeId,meshName:a.name,changeSpec:this.changeSpec}})}}]);return a}(),T=/^([^\/]+)\/(.*)$/,
V=function da(a,d){p(this,da);this.projects=new Map;this.hierarchicalVolumeIds=new Map;var b=this.projects;a=$jscomp.makeIterator(l(a));for(var c=a.next();!c.done;c=a.next())c=c.value,b.set(c.id,c);try{Object(y.u)(d);var f=this.volumeIds=Object(y.w)(d,"volumeId",function(a){return void 0===a?[]:Object(y.a)(a,y.B)});f.sort();for(var g=new Map,e=$jscomp.makeIterator(f),k=e.next();!k.done;k=e.next()){var m=k.value;for(d=0;;){var q=m.indexOf(":",d);-1===q?q=void 0:++q;var x=m.substring(0,d),t=g.get(x);
void 0===t&&(t=new Set,g.set(x,t));t.add(m.substring(d,q));if(void 0===q)break;d=q}}for(var w=this.hierarchicalVolumeIds,h=$jscomp.makeIterator(g),v=h.next();!v.done;v=h.next()){var r=$jscomp.makeIterator(v.value),B=r.next().value,n=r.next().value;w.set(B,Array.from(n))}}catch(Aa){throw Error("Failed to parse Brain Maps volume list reply: "+Aa.message);}},S=function(d){function b(a,d){p(this,b);var c=h(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.instance=a;c.credentialsProvider=d;return c}
r(b,d);G(b,[{key:"getMeshSource",value:function(a,d){return a.getChunkSource(H,{credentialsProvider:this.credentialsProvider,parameters:this.getMeshSourceParameters(d)})}},{key:"getMeshSourceParameters",value:function(d){var b=d.match(T);if(null===b)throw Error("Invalid Brainmaps mesh URL: "+d);d=a(b[1]);return{instance:this.instance,volumeId:d.volumeId,changeSpec:d.changeSpec,meshName:b[2]}}},{key:"getSkeletonSource",value:function(a,d){return a.getChunkSource(D,{credentialsProvider:this.credentialsProvider,
parameters:this.getMeshSourceParameters(d)})}},{key:"getVolume",value:function(d,b,c){var g=this;b=a(b);var e=b.volumeId,k=b.changeSpec,l=b.parameters;Object(y.u)(l);b=Object(y.w)(l,"encoding",function(a){return void 0===a?void 0:Object(y.n)(a,m.c)});l=Object(y.w)(l,"chunkLayout",function(a){return void 0===a?void 0:Object(y.n)(a,f.a)});var x=Object.assign({},c,{encoding:b,chunkLayoutPreference:l});return d.memoize.getUncounted({type:"brainmaps:getVolume",instance:this.instance,volumeId:e,changeSpec:k,
brainmapsOptions:x},function(){return Promise.all([Object(q.b)(g.instance,g.credentialsProvider,{method:"GET",path:"/v1beta2/volumes/"+e,responseType:"json"}),Object(q.b)(g.instance,g.credentialsProvider,{method:"GET",path:"/v1beta2/objects/"+e+"/meshes",responseType:"json"})]).then(function(a){var b=$jscomp.makeIterator(a);a=b.next().value;b=b.next().value;return new K(d,g.instance,g.credentialsProvider,e,k,a,b,x)})})}},{key:"getVolumeList",value:function(a){var d=this;return a.memoize.getUncounted({instance:this.instance,
type:"brainmaps:getVolumeList"},function(){var a=Promise.all([Object(q.b)(d.instance,d.credentialsProvider,{method:"GET",path:"/v1beta2/projects",responseType:"json"}),Object(q.b)(d.instance,d.credentialsProvider,{method:"GET",path:"/v1beta2/volumes",responseType:"json"})]).then(function(a){var d=$jscomp.makeIterator(a);a=d.next().value;d=d.next().value;return new V(a,d)}),b=d.instance.description+" volume list";B.a.forPromise(a,{delay:!0,initialMessage:"Retrieving "+b+".",errorPrefix:"Error retrieving "+
b+": "});return a})}},{key:"getChangeStackList",value:function(a,d){var b=this;return a.memoize.getUncounted({instance:this.instance,type:"brainmaps:getChangeStackList",volumeId:d},function(){var a=Object(q.b)(b.instance,b.credentialsProvider,{method:"GET",path:"/v1beta2/changes/"+d+"/change_stacks",responseType:"json"}).then(function(a){return w(a)}),c="change stacks for "+d;B.a.forPromise(a,{delay:!0,initialMessage:"Retrieving "+c+".",errorPrefix:"Error retrieving "+c+": "});return a})}},{key:"volumeCompleter",
value:function(a,d){var b=this;return this.getVolumeList(d).then(function(c){var f=a.match(/^([^:]+:[^:]+:[^:]+):(.*)$/);if(null!==f){var g=f[1],e=f[2];return b.getChangeStackList(d,g).then(function(a){if(void 0===a)throw null;return{offset:g.length+1,completions:Object(E.b)(e,a)}})}var k=a.lastIndexOf(":")+1;f=a.substring(0,k);k=a.substring(k);var m=c.hierarchicalVolumeIds.get(f);if(void 0===m)throw null;return f?{offset:f.length,completions:Object(E.b)(k,m)}:{offset:0,completions:Object(E.c)(k,
m,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}(t.a);e.productionInstance={description:"Google Brain Maps",serverUrls:["https://brainmaps.googleapis.com"]}},function(n,e,c){c(22);c(148);c(149);var p=c(88),h=c(150),r=c(151);c(152);var a=c(89),b=c(90);c.d(e,"a",function(){return p});c.d(e,"b",function(){return h});c.d(e,"c",function(){return r});c.d(e,"d",function(){return a});
c.d(e,"e",function(){return b})},function(n,e,c){function p(a,b,c){var e=b[0],l=b[1],t=b[2],q=b[3],m=b[4],g=b[5],d=b[6],f=b[7];b=b[8];var k=c[0],x=c[1],h=c[2],r=c[3],p=c[4],n=c[5],G=c[6],A=c[7];c=c[8];a[0]=k*e+x*q+h*d;a[1]=k*l+x*m+h*f;a[2]=k*t+x*g+h*b;a[3]=r*e+p*q+n*d;a[4]=r*l+p*m+n*f;a[5]=r*t+p*g+n*b;a[6]=G*e+A*q+c*d;a[7]=G*l+A*m+c*f;a[8]=G*t+A*g+c*b;return a}function h(a,b,c){a[0]=b[0]-c[0];a[1]=b[1]-c[1];a[2]=b[2]-c[2];a[3]=b[3]-c[3];a[4]=b[4]-c[4];a[5]=b[5]-c[5];a[6]=b[6]-c[6];a[7]=b[7]-c[7];
a[8]=b[8]-c[8];return a}Object.defineProperty(e,"__esModule",{value:!0});e.create=function(){var a=new r.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};e.fromMat4=function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[4];a[4]=b[5];a[5]=b[6];a[6]=b[8];a[7]=b[9];a[8]=b[10];return a};e.clone=function(a){var b=new r.a(9);b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];return b};e.copy=function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=
b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];return a};e.fromValues=function(a,b,c,e,h,t,q,m,g){var d=new r.a(9);d[0]=a;d[1]=b;d[2]=c;d[3]=e;d[4]=h;d[5]=t;d[6]=q;d[7]=m;d[8]=g;return d};e.set=function(a,b,c,e,h,t,q,m,g,d){a[0]=b;a[1]=c;a[2]=e;a[3]=h;a[4]=t;a[5]=q;a[6]=m;a[7]=g;a[8]=d;return a};e.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};e.transpose=function(a,b){if(a===b){var c=b[1],e=b[2],h=b[5];a[1]=b[3];a[2]=b[6];a[3]=c;a[5]=b[7];a[6]=
e;a[7]=h}else a[0]=b[0],a[1]=b[3],a[2]=b[6],a[3]=b[1],a[4]=b[4],a[5]=b[7],a[6]=b[2],a[7]=b[5],a[8]=b[8];return a};e.invert=function(a,b){var c=b[0],e=b[1],h=b[2],t=b[3],q=b[4],m=b[5],g=b[6],d=b[7];b=b[8];var f=b*q-m*d,k=-b*t+m*g,x=d*t-q*g,r=c*f+e*k+h*x;if(!r)return null;r=1/r;a[0]=f*r;a[1]=(-b*e+h*d)*r;a[2]=(m*e-h*q)*r;a[3]=k*r;a[4]=(b*c-h*g)*r;a[5]=(-m*c+h*t)*r;a[6]=x*r;a[7]=(-d*c+e*g)*r;a[8]=(q*c-e*t)*r;return a};e.adjoint=function(a,b){var c=b[0],e=b[1],h=b[2],t=b[3],q=b[4],m=b[5],g=b[6],d=b[7];
b=b[8];a[0]=q*b-m*d;a[1]=h*d-e*b;a[2]=e*m-h*q;a[3]=m*g-t*b;a[4]=c*b-h*g;a[5]=h*t-c*m;a[6]=t*d-q*g;a[7]=e*g-c*d;a[8]=c*q-e*t;return a};e.determinant=function(a){var b=a[3],c=a[4],e=a[5],h=a[6],t=a[7],q=a[8];return a[0]*(q*c-e*t)+a[1]*(-q*b+e*h)+a[2]*(t*b-c*h)};e.multiply=p;e.translate=function(a,b,c){var e=b[0],l=b[1],t=b[2],q=b[3],m=b[4],g=b[5],d=b[6],f=b[7];b=b[8];var k=c[0];c=c[1];a[0]=e;a[1]=l;a[2]=t;a[3]=q;a[4]=m;a[5]=g;a[6]=k*e+c*q+d;a[7]=k*l+c*m+f;a[8]=k*t+c*g+b;return a};e.rotate=function(a,
b,c){var e=b[0],l=b[1],t=b[2],q=b[3],m=b[4],g=b[5],d=b[6],f=b[7];b=b[8];var k=Math.sin(c);c=Math.cos(c);a[0]=c*e+k*q;a[1]=c*l+k*m;a[2]=c*t+k*g;a[3]=c*q-k*e;a[4]=c*m-k*l;a[5]=c*g-k*t;a[6]=d;a[7]=f;a[8]=b;return a};e.scale=function(a,b,c){var e=c[0];c=c[1];a[0]=e*b[0];a[1]=e*b[1];a[2]=e*b[2];a[3]=c*b[3];a[4]=c*b[4];a[5]=c*b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];return a};e.fromTranslation=function(a,b){a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=1;a[5]=0;a[6]=b[0];a[7]=b[1];a[8]=1;return a};e.fromRotation=function(a,
b){var c=Math.sin(b);b=Math.cos(b);a[0]=b;a[1]=c;a[2]=0;a[3]=-c;a[4]=b;a[5]=0;a[6]=0;a[7]=0;a[8]=1;return a};e.fromScaling=function(a,b){a[0]=b[0];a[1]=0;a[2]=0;a[3]=0;a[4]=b[1];a[5]=0;a[6]=0;a[7]=0;a[8]=1;return a};e.fromMat2d=function(a,b){a[0]=b[0];a[1]=b[1];a[2]=0;a[3]=b[2];a[4]=b[3];a[5]=0;a[6]=b[4];a[7]=b[5];a[8]=1;return a};e.fromQuat=function(a,b){var c=b[0],e=b[1],h=b[2];b=b[3];var t=c+c,q=e+e,m=h+h;c*=t;var g=e*t;e*=q;var d=h*t,f=h*q;h*=m;t*=b;q*=b;b*=m;a[0]=1-e-h;a[3]=g-b;a[6]=d+q;a[1]=
g+b;a[4]=1-c-h;a[7]=f-t;a[2]=d-q;a[5]=f+t;a[8]=1-c-e;return a};e.normalFromMat4=function(a,b){var c=b[0],e=b[1],h=b[2],t=b[3],q=b[4],m=b[5],g=b[6],d=b[7],f=b[8],k=b[9],x=b[10],r=b[11],p=b[12],n=b[13],y=b[14];b=b[15];var G=c*m-e*q,A=c*g-h*q,H=c*d-t*q,D=e*g-h*m,I=e*d-t*m,F=h*d-t*g,P=f*n-k*p,K=f*y-x*p;f=f*b-r*p;var T=k*y-x*n;k=k*b-r*n;x=x*b-r*y;r=G*x-A*k+H*T+D*f-I*K+F*P;if(!r)return null;r=1/r;a[0]=(m*x-g*k+d*T)*r;a[1]=(g*f-q*x-d*K)*r;a[2]=(q*k-m*f+d*P)*r;a[3]=(h*k-e*x-t*T)*r;a[4]=(c*x-h*f+t*K)*r;a[5]=
(e*f-c*k-t*P)*r;a[6]=(n*F-y*I+b*D)*r;a[7]=(y*H-p*F-b*A)*r;a[8]=(p*I-n*H+b*G)*r;return a};e.projection=function(a,b,c){a[0]=2/b;a[1]=0;a[2]=0;a[3]=0;a[4]=-2/c;a[5]=0;a[6]=-1;a[7]=1;a[8]=1;return a};e.str=function(a){return"mat3("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+", "+a[6]+", "+a[7]+", "+a[8]+")"};e.frob=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3],2)+Math.pow(a[4],2)+Math.pow(a[5],2)+Math.pow(a[6],2)+Math.pow(a[7],2)+Math.pow(a[8],
2))};e.add=function(a,b,c){a[0]=b[0]+c[0];a[1]=b[1]+c[1];a[2]=b[2]+c[2];a[3]=b[3]+c[3];a[4]=b[4]+c[4];a[5]=b[5]+c[5];a[6]=b[6]+c[6];a[7]=b[7]+c[7];a[8]=b[8]+c[8];return a};e.subtract=h;e.multiplyScalar=function(a,b,c){a[0]=b[0]*c;a[1]=b[1]*c;a[2]=b[2]*c;a[3]=b[3]*c;a[4]=b[4]*c;a[5]=b[5]*c;a[6]=b[6]*c;a[7]=b[7]*c;a[8]=b[8]*c;return a};e.multiplyScalarAndAdd=function(a,b,c,e){a[0]=b[0]+c[0]*e;a[1]=b[1]+c[1]*e;a[2]=b[2]+c[2]*e;a[3]=b[3]+c[3]*e;a[4]=b[4]+c[4]*e;a[5]=b[5]+c[5]*e;a[6]=b[6]+c[6]*e;a[7]=
b[7]+c[7]*e;a[8]=b[8]+c[8]*e;return a};e.exactEquals=function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]&&a[4]===b[4]&&a[5]===b[5]&&a[6]===b[6]&&a[7]===b[7]&&a[8]===b[8]};e.equals=function(a,b){var c=a[0],e=a[1],h=a[2],t=a[3],q=a[4],m=a[5],g=a[6],d=a[7];a=a[8];var f=b[0],k=b[1],x=b[2],p=b[3],n=b[4],C=b[5],y=b[6],G=b[7];b=b[8];return Math.abs(c-f)<=r.b*Math.max(1,Math.abs(c),Math.abs(f))&&Math.abs(e-k)<=r.b*Math.max(1,Math.abs(e),Math.abs(k))&&Math.abs(h-x)<=r.b*Math.max(1,Math.abs(h),
Math.abs(x))&&Math.abs(t-p)<=r.b*Math.max(1,Math.abs(t),Math.abs(p))&&Math.abs(q-n)<=r.b*Math.max(1,Math.abs(q),Math.abs(n))&&Math.abs(m-C)<=r.b*Math.max(1,Math.abs(m),Math.abs(C))&&Math.abs(g-y)<=r.b*Math.max(1,Math.abs(g),Math.abs(y))&&Math.abs(d-G)<=r.b*Math.max(1,Math.abs(d),Math.abs(G))&&Math.abs(a-b)<=r.b*Math.max(1,Math.abs(a),Math.abs(b))};var r=c(22);e.mul=p;e.sub=h},function(n,e,c){function p(){var a=new g.a(3);a[0]=0;a[1]=0;a[2]=0;return a}function h(a){var d=a[0],b=a[1];a=a[2];return Math.sqrt(d*
d+b*b+a*a)}function r(a,b,c){var d=new g.a(3);d[0]=a;d[1]=b;d[2]=c;return d}function a(a,b,c){a[0]=b[0]-c[0];a[1]=b[1]-c[1];a[2]=b[2]-c[2];return a}function b(a,b,c){a[0]=b[0]*c[0];a[1]=b[1]*c[1];a[2]=b[2]*c[2];return a}function l(a,b,c){a[0]=b[0]/c[0];a[1]=b[1]/c[1];a[2]=b[2]/c[2];return a}function w(a,b){var d=b[0]-a[0],c=b[1]-a[1];a=b[2]-a[2];return Math.sqrt(d*d+c*c+a*a)}function v(a,b){var d=b[0]-a[0],c=b[1]-a[1];a=b[2]-a[2];return d*d+c*c+a*a}function t(a){var d=a[0],b=a[1];a=a[2];return d*
d+b*b+a*a}function q(a,b){var d=b[0],c=b[1],f=b[2];d=d*d+c*c+f*f;0<d&&(d=1/Math.sqrt(d),a[0]=b[0]*d,a[1]=b[1]*d,a[2]=b[2]*d);return a}function m(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]}Object.defineProperty(e,"__esModule",{value:!0});e.create=p;e.clone=function(a){var d=new g.a(3);d[0]=a[0];d[1]=a[1];d[2]=a[2];return d};e.length=h;e.fromValues=r;e.copy=function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];return a};e.set=function(a,b,c,g){a[0]=b;a[1]=c;a[2]=g;return a};e.add=function(a,b,c){a[0]=b[0]+c[0];
a[1]=b[1]+c[1];a[2]=b[2]+c[2];return a};e.subtract=a;e.multiply=b;e.divide=l;e.ceil=function(a,b){a[0]=Math.ceil(b[0]);a[1]=Math.ceil(b[1]);a[2]=Math.ceil(b[2]);return a};e.floor=function(a,b){a[0]=Math.floor(b[0]);a[1]=Math.floor(b[1]);a[2]=Math.floor(b[2]);return a};e.min=function(a,b,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]);return a};e.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]);return a};e.round=function(a,
b){a[0]=Math.round(b[0]);a[1]=Math.round(b[1]);a[2]=Math.round(b[2]);return a};e.scale=function(a,b,c){a[0]=b[0]*c;a[1]=b[1]*c;a[2]=b[2]*c;return a};e.scaleAndAdd=function(a,b,c,g){a[0]=b[0]+c[0]*g;a[1]=b[1]+c[1]*g;a[2]=b[2]+c[2]*g;return a};e.distance=w;e.squaredDistance=v;e.squaredLength=t;e.negate=function(a,b){a[0]=-b[0];a[1]=-b[1];a[2]=-b[2];return a};e.inverse=function(a,b){a[0]=1/b[0];a[1]=1/b[1];a[2]=1/b[2];return a};e.normalize=q;e.dot=m;e.cross=function(a,b,c){var d=b[0],f=b[1];b=b[2];var g=
c[0],e=c[1];c=c[2];a[0]=f*c-b*e;a[1]=b*g-d*c;a[2]=d*e-f*g;return a};e.lerp=function(a,b,c,g){var d=b[0],f=b[1];b=b[2];a[0]=d+g*(c[0]-d);a[1]=f+g*(c[1]-f);a[2]=b+g*(c[2]-b);return a};e.hermite=function(a,b,c,g,e,m){var d=m*m,f=d*(2*m-3)+1,k=d*(m-2)+m,l=d*(m-1);m=d*(3-2*m);a[0]=b[0]*f+c[0]*k+g[0]*l+e[0]*m;a[1]=b[1]*f+c[1]*k+g[1]*l+e[1]*m;a[2]=b[2]*f+c[2]*k+g[2]*l+e[2]*m;return a};e.bezier=function(a,b,c,g,e,m){var d=1-m,f=d*d,k=m*m,l=f*d;f*=3*m;d*=3*k;m*=k;a[0]=b[0]*l+c[0]*f+g[0]*d+e[0]*m;a[1]=b[1]*
l+c[1]*f+g[1]*d+e[1]*m;a[2]=b[2]*l+c[2]*f+g[2]*d+e[2]*m;return a};e.random=function(a,b){b=b||1;var d=2*g.c()*Math.PI,c=2*g.c()-1,f=Math.sqrt(1-c*c)*b;a[0]=Math.cos(d)*f;a[1]=Math.sin(d)*f;a[2]=c*b;return a};e.transformMat4=function(a,b,c){var d=b[0],f=b[1];b=b[2];var g=c[3]*d+c[7]*f+c[11]*b+c[15];g=g||1;a[0]=(c[0]*d+c[4]*f+c[8]*b+c[12])/g;a[1]=(c[1]*d+c[5]*f+c[9]*b+c[13])/g;a[2]=(c[2]*d+c[6]*f+c[10]*b+c[14])/g;return a};e.transformMat3=function(a,b,c){var d=b[0],f=b[1];b=b[2];a[0]=d*c[0]+f*c[3]+
b*c[6];a[1]=d*c[1]+f*c[4]+b*c[7];a[2]=d*c[2]+f*c[5]+b*c[8];return a};e.transformQuat=function(a,b,c){var d=b[0],f=b[1],g=b[2];b=c[0];var e=c[1],k=c[2];c=c[3];var m=c*d+e*g-k*f,l=c*f+k*d-b*g,q=c*g+b*f-e*d;d=-b*d-e*f-k*g;a[0]=m*c+d*-b+l*-k-q*-e;a[1]=l*c+d*-e+q*-b-m*-k;a[2]=q*c+d*-k+m*-e-l*-b;return a};e.rotateX=function(a,b,c,g){var d=[],f=[];d[0]=b[0]-c[0];d[1]=b[1]-c[1];d[2]=b[2]-c[2];f[0]=d[0];f[1]=d[1]*Math.cos(g)-d[2]*Math.sin(g);f[2]=d[1]*Math.sin(g)+d[2]*Math.cos(g);a[0]=f[0]+c[0];a[1]=f[1]+
c[1];a[2]=f[2]+c[2];return a};e.rotateY=function(a,b,c,g){var d=[],f=[];d[0]=b[0]-c[0];d[1]=b[1]-c[1];d[2]=b[2]-c[2];f[0]=d[2]*Math.sin(g)+d[0]*Math.cos(g);f[1]=d[1];f[2]=d[2]*Math.cos(g)-d[0]*Math.sin(g);a[0]=f[0]+c[0];a[1]=f[1]+c[1];a[2]=f[2]+c[2];return a};e.rotateZ=function(a,b,c,g){var d=[],f=[];d[0]=b[0]-c[0];d[1]=b[1]-c[1];d[2]=b[2]-c[2];f[0]=d[0]*Math.cos(g)-d[1]*Math.sin(g);f[1]=d[0]*Math.sin(g)+d[1]*Math.cos(g);f[2]=d[2];a[0]=f[0]+c[0];a[1]=f[1]+c[1];a[2]=f[2]+c[2];return a};e.angle=function(a,
b){a=r(a[0],a[1],a[2]);b=r(b[0],b[1],b[2]);q(a,a);q(b,b);b=m(a,b);return 1<b?0:-1>b?Math.PI:Math.acos(b)};e.str=function(a){return"vec3("+a[0]+", "+a[1]+", "+a[2]+")"};e.exactEquals=function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]};e.equals=function(a,b){var d=a[0],c=a[1];a=a[2];var f=b[0],e=b[1];b=b[2];return Math.abs(d-f)<=g.b*Math.max(1,Math.abs(d),Math.abs(f))&&Math.abs(c-e)<=g.b*Math.max(1,Math.abs(c),Math.abs(e))&&Math.abs(a-b)<=g.b*Math.max(1,Math.abs(a),Math.abs(b))};var g=c(22);
e.sub=a;e.mul=b;e.div=l;e.dist=w;e.sqrDist=v;e.len=h;e.sqrLen=t;n=function(){var a=p();return function(b,d,c,g,e,m){d||(d=3);c||(c=0);for(g=g?Math.min(g*d+c,b.length):b.length;c<g;c+=d)a[0]=b[c],a[1]=b[c+1],a[2]=b[c+2],e(a,a,m),b[c]=a[0],b[c+1]=a[1],b[c+2]=a[2];return b}}();e.forEach=n},function(n,e,c){function p(){var a=new m.a(4);a[0]=0;a[1]=0;a[2]=0;a[3]=0;return a}function h(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 r(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 b(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 l(a,b){var d=b[0]-a[0],c=b[1]-a[1],g=b[2]-a[2];a=b[3]-a[3];return Math.sqrt(d*d+c*c+g*g+a*a)}function w(a,b){var d=b[0]-a[0],c=b[1]-a[1],g=b[2]-a[2];a=b[3]-a[3];return d*d+c*c+g*g+a*a}function v(a){var b=a[0],c=a[1],g=a[2];a=a[3];return Math.sqrt(b*b+c*c+g*g+a*a)}function t(a){var b=a[0],
c=a[1],g=a[2];a=a[3];return b*b+c*c+g*g+a*a}function q(a,b){var d=b[0],c=b[1],g=b[2];b=b[3];var e=d*d+c*c+g*g+b*b;0<e&&(e=1/Math.sqrt(e),a[0]=d*e,a[1]=c*e,a[2]=g*e,a[3]=b*e);return a}Object.defineProperty(e,"__esModule",{value:!0});e.create=p;e.clone=function(a){var b=new m.a(4);b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];return b};e.fromValues=function(a,b,c,e){var d=new m.a(4);d[0]=a;d[1]=b;d[2]=c;d[3]=e;return d};e.copy=function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];return a};e.set=function(a,
b,c,e,m){a[0]=b;a[1]=c;a[2]=e;a[3]=m;return a};e.add=function(a,b,c){a[0]=b[0]+c[0];a[1]=b[1]+c[1];a[2]=b[2]+c[2];a[3]=b[3]+c[3];return a};e.subtract=h;e.multiply=r;e.divide=a;e.ceil=function(a,b){a[0]=Math.ceil(b[0]);a[1]=Math.ceil(b[1]);a[2]=Math.ceil(b[2]);a[3]=Math.ceil(b[3]);return a};e.floor=function(a,b){a[0]=Math.floor(b[0]);a[1]=Math.floor(b[1]);a[2]=Math.floor(b[2]);a[3]=Math.floor(b[3]);return a};e.min=function(a,b,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};e.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};e.round=function(a,b){a[0]=Math.round(b[0]);a[1]=Math.round(b[1]);a[2]=Math.round(b[2]);a[3]=Math.round(b[3]);return a};e.scale=b;e.scaleAndAdd=function(a,b,c,e){a[0]=b[0]+c[0]*e;a[1]=b[1]+c[1]*e;a[2]=b[2]+c[2]*e;a[3]=b[3]+c[3]*e;return a};e.distance=l;e.squaredDistance=w;e.length=v;e.squaredLength=t;e.negate=function(a,b){a[0]=
-b[0];a[1]=-b[1];a[2]=-b[2];a[3]=-b[3];return a};e.inverse=function(a,b){a[0]=1/b[0];a[1]=1/b[1];a[2]=1/b[2];a[3]=1/b[3];return a};e.normalize=q;e.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]};e.lerp=function(a,b,c,e){var d=b[0],f=b[1],g=b[2];b=b[3];a[0]=d+e*(c[0]-d);a[1]=f+e*(c[1]-f);a[2]=g+e*(c[2]-g);a[3]=b+e*(c[3]-b);return a};e.random=function(a,d){d=d||1;a[0]=m.c();a[1]=m.c();a[2]=m.c();a[3]=m.c();q(a,a);b(a,a,d);return a};e.transformMat4=function(a,b,c){var d=b[0],f=b[1],
g=b[2];b=b[3];a[0]=c[0]*d+c[4]*f+c[8]*g+c[12]*b;a[1]=c[1]*d+c[5]*f+c[9]*g+c[13]*b;a[2]=c[2]*d+c[6]*f+c[10]*g+c[14]*b;a[3]=c[3]*d+c[7]*f+c[11]*g+c[15]*b;return a};e.transformQuat=function(a,b,c){var d=b[0],f=b[1],g=b[2],e=c[0],m=c[1],l=c[2];c=c[3];var q=c*d+m*g-l*f,t=c*f+l*d-e*g,h=c*g+e*f-m*d;d=-e*d-m*f-l*g;a[0]=q*c+d*-e+t*-l-h*-m;a[1]=t*c+d*-m+h*-e-q*-l;a[2]=h*c+d*-l+q*-m-t*-e;a[3]=b[3];return a};e.str=function(a){return"vec4("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"};e.exactEquals=function(a,b){return a[0]===
b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]};e.equals=function(a,b){var d=a[0],c=a[1],g=a[2];a=a[3];var e=b[0],l=b[1],q=b[2];b=b[3];return Math.abs(d-e)<=m.b*Math.max(1,Math.abs(d),Math.abs(e))&&Math.abs(c-l)<=m.b*Math.max(1,Math.abs(c),Math.abs(l))&&Math.abs(g-q)<=m.b*Math.max(1,Math.abs(g),Math.abs(q))&&Math.abs(a-b)<=m.b*Math.max(1,Math.abs(a),Math.abs(b))};var m=c(22);e.sub=h;e.mul=r;e.div=a;e.dist=l;e.sqrDist=w;e.len=v;e.sqrLen=t;n=function(){var a=p();return function(b,c,g,e,m,l){c||(c=4);g||
(g=0);for(e=e?Math.min(e*c+g,b.length):b.length;g<e;g+=c)a[0]=b[g],a[1]=b[g+1],a[2]=b[g+2],a[3]=b[g+3],m(a,a,l),b[g]=a[0],b[g+1]=a[1],b[g+2]=a[2],b[g+3]=a[3];return b}}();e.forEach=n},function(n,e,c){e.b=function(c,a,b,e){e=void 0===e?p.e:e;var l=void 0;return new Promise(function(w,t){function q(g){null!==l&&(l=Object(h.c)(c.serverUrls,b.path,b.method),l.responseType=b.responseType,l.setRequestHeader("Authorization",g.credentials.tokenType+" "+g.credentials.accessToken),l.onloadend=function(){if(null!==
l){var b=this.status;200<=b&&300>b?(e.remove(m),w(this.response)):401===b?a.get(g,e).then(q):504===b||503===b?a.get(void 0,e).then(q):(e.remove(m),t(h.a.fromXhr(this)))}},l.send(b.payload))}var m=function(){var a=l;l=null;null!=a&&a.abort();t(p.a)};e.add(m);a.get(void 0,e).then(q)})};var p=c(29),h=c(37);e.a="google-brainmaps"},function(n,e,c){e=c(160);c="object"==typeof self&&self&&self.Object===Object&&self;e=e||c||Function("return this")();n.exports=e},function(n,e,c){e=c(92).Symbol;n.exports=e},
function(n,e,c){var p=c(9),h=c(64);n.exports=function(c,a,b){var e=!0,w=!0;if("function"!=typeof c)throw new TypeError("Expected a function");h(b)&&(e="leading"in b?!!b.leading:e,w="trailing"in b?!!b.trailing:w);return p(c,a,{leading:e,maxWait:a,trailing:w})}},function(n,e,c){e.b=function(c,e){return c.low+","+c.high+(e?"_"+e.center.toString()+"_"+e.size.toString():"")};e.a=function(c,e){var h=c.segmentEquivalences;c=$jscomp.makeIterator(c.visibleSegments);for(var a=c.next();!a.done;a=c.next())if(a=
a.value,h.disjointSets.isMinElement(a))for(var b=$jscomp.makeIterator(h.setElements(a)),l=b.next();!l.done;l=b.next())e(l.value,a)}},function(n,e,c){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)}c.d(e,"a",function(){return b});n=c(0);
var h=c(24),r=c(97),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}}(),b=function(b){function c(a){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");var b=(c.__proto__||Object.getPrototypeOf(c)).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.gl=a;b.vertexBuffer=b.registerDisposer(h.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));b.colorBuffer=b.registerDisposer(h.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));b.trivialColorShader=b.registerDisposer(Object(r.c)(a));return b}p(c,b);a(c,[{key:"draw",value:function(a,b){b=void 0===b?!0:b;var c=this.trivialColorShader,
e=this.gl;c.bind();e.uniformMatrix4fv(c.uniform("uProjectionMatrix"),!1,a);a=c.attribute("aVertexPosition");this.vertexBuffer.bindToVertexAttrib(a,4);c=c.attribute("aColor");this.colorBuffer.bindToVertexAttrib(c,4);b&&(e.colorMask(!1,!1,!1,!0),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.colorMask(!0,!0,!0,!0),e.enable(e.BLEND),e.blendFunc(e.ONE_MINUS_DST_ALPHA,e.DST_ALPHA));e.lineWidth(1);e.drawArrays(e.LINES,0,6);b&&e.disable(e.BLEND);e.disableVertexAttribArray(a);e.disableVertexAttribArray(c)}}],
[{key:"get",value:function(a){return a.memoize.get("SliceViewPanel:AxesLineHelper",function(){return new c(a)})}}]);return c}(n.a)},function(n,e,c){function p(a){a.setFragmentMain("gl_FragColor = getValue0();")}e.a=p;e.b=function(a,b,c){b=void 0===b?p:b;c=void 0===c?1:c;return a.memoize.get("elementWiseTextureShader:"+c+":"+Object(h.a)(b),function(){var e=new r.a(a);e.addVarying("vec2","vTexCoord");e.addUniform("sampler2D","uSampler",c);e.addInitializer(function(b){for(var e=[],m=0;m<c;++m)e[m]=m;
a.uniform1iv(b.uniform("uSampler"),e)});for(var l=0;l<c;++l)e.addFragmentCode("\nvec4 getValue"+l+"() {\n  return texture2D(uSampler["+l+"], vTexCoord);\n}\n");e.addUniform("mat4","uProjectionMatrix");e.require(b);e.addAttribute("vec4","aVertexPosition");e.addAttribute("vec2","aTexCoord");e.setVertexMain("vTexCoord = aTexCoord; gl_Position = uProjectionMatrix * aVertexPosition;");return e.build()})};e.c=function(a){return a.memoize.get("trivialColorShader",function(){var b=new r.a(a);b.addVarying("vec4",
"vColor");b.setFragmentMain("gl_FragColor = vColor;");b.addAttribute("vec4","aVertexPosition");b.addAttribute("vec4","aColor");b.addUniform("mat4","uProjectionMatrix");b.setVertexMain("vColor = aColor; gl_Position = uProjectionMatrix * aVertexPosition;");return b.build()})};var h=c(23),r=c(36)},function(n,e,c){c.d(e,"a",function(){return h});var p=function(){function c(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(a,b,e){b&&c(a.prototype,b);e&&c(a,e);return a}}(),h=function(){function c(){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");this.renderLayers=[null];this.values=[0,0,0];this.nextPickID=1}p(c,[{key:"clear",value:function(){this.renderLayers.length=1;this.values.length=3;this.nextPickID=1}},{key:"registerUint64",value:function(a,b,c){return this.register(a,void 0===c?1:c,b.low,b.high)}},{key:"register",value:function(a,b,c,e){var l=this.renderLayers,
h=this.values,q=this.nextPickID;this.nextPickID+=void 0===b?1:b;b=l.length;l[b]=a;a=3*b;h[a]=q;h[a+1]=void 0===c?0:c;h[a+2]=void 0===e?0:e;return q}},{key:"setMouseState",value:function(a,b){for(var c=this.renderLayers,e=this.values,h=0,t=c.length-1;h<t;){var q=Math.ceil(h+(t-h)/2);e[3*q]>b?t=q-1:h=q}c=a.pickedRenderLayer=c[h];h*=3;b=a.pickedOffset=b-e[h];t=a.pickedValue;t.low=e[h+1];t.high=e[h+2];null!==c&&c.updateMouseState(a,t,b)}}]);return c}()},function(n,e,c){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 h(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)}c.d(e,"a",function(){return g});n=c(100);var r=c(56),a=c(17),b=c(1),l=c(45),w=c(101),v=c(173),t=function(){function a(a,b){for(var d=
0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),q=function f(a,b,c){null===a&&(a=Function.prototype);var g=Object.getOwnPropertyDescriptor(a,b);if(void 0===g){if(a=Object.getPrototypeOf(a),null!==a)return f(a,b,c)}else{if("value"in g)return g.value;b=g.get;return void 0===b?void 0:b.call(c)}};c(174);c(31);var m=b.p.create(),g=function(c){function f(c,
g,e){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var k=p(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,c,g,e.visibility));k.viewer=e;k.mouseX=0;k.mouseY=0;k.mouseStateUpdater=k.updateMouseState.bind(k);k.inputEventMap=e.inputEventMap;g.classList.add("neuroglancer-rendered-data-panel");g.classList.add("neuroglancer-panel");g.classList.add("neuroglancer-noselect");k.registerDisposer(new r.a(g));k.registerDisposer(new l.b(g,k.inputEventMap));k.registerDisposer(new w.a(g,
k.inputEventMap));k.registerEventListener(g,"mousemove",k.onMousemove.bind(k));k.registerEventListener(g,"mouseleave",k.onMouseout.bind(k));Object(a.c)(g,"snap",function(){k.navigationState.pose.snap()});Object(a.c)(g,"zoom-in",function(){k.navigationState.zoomBy(.5)});Object(a.c)(g,"zoom-out",function(){k.navigationState.zoomBy(2)});for(c={axis:0};3>c.axis;c={axis:c.axis},++c.axis){e=b.a[c.axis];for(var q={},h=$jscomp.makeIterator([-1,1]),t=h.next();!t.done;q={sign:q.sign,tempOffset:q.tempOffset},
t=h.next())q.sign=t.value,t=0>q.sign?"-":"+",Object(a.c)(g,"rotate-relative-"+e+t,function(a,c){return function(){k.navigationState.pose.rotateRelative(b.e[a.axis],.1*c.sign)}}(c,q)),q.tempOffset=b.p.create(),Object(a.c)(g,""+e+t,function(a,b){return function(){var c=k.navigationState,f=a.tempOffset;f[0]=0;f[1]=0;f[2]=0;f[b.axis]=a.sign;c.pose.translateVoxelsRelative(f)}}(q,c))}Object(a.c)(g,"zoom-via-wheel",function(a){a=a.detail;k.onMousemove(a);k.zoomByMouse(Object(v.a)(a))});c={};e=$jscomp.makeIterator([1,
10]);for(q=e.next();!q.done;c={amount:c.amount},q=e.next())c.amount=q.value,Object(a.c)(g,"z+"+c.amount+"-via-wheel",function(a){return function(b){var c=b.detail;b=k.navigationState;c=0!==c.deltaY?c.deltaY:c.deltaX;m[0]=0;m[1]=0;m[2]=(0<c?-1:1)*a.amount;b.pose.translateVoxelsRelative(m)}}(c));Object(a.c)(g,"move-to-mouse-position",function(){var a=k.viewer.mouseState;if(a.updateUnconditionally()){var c=k.navigationState.pose.position;b.p.copy(c.spatialCoordinates,a.position);c.changed.dispatch()}});
Object(a.c)(g,"snap",function(){return k.navigationState.pose.snap()});return k}h(f,c);t(f,[{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,a=this.viewer.mouseState,a.updater=this.mouseStateUpdater,a.triggerUpdate())}},{key:"disposed",value:function(){var a=this.viewer.mouseState;a.updater===this.mouseStateUpdater&&
(a.updater=void 0,a.setActive(!1));q(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"disposed",this).call(this)}}]);return f}(n.b)},function(n,e,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function h(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 r(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)}c.d(e,"b",function(){return t});c.d(e,"a",function(){return q});n=c(9);var a=c.n(n);n=c(0);var b=c(3),l=c(170),w=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&
a(b.prototype,d);c&&a(b,c);return b}}(),v=function 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)}},t=function(a){function b(a,d,c){p(this,b);var f=h(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));f.context=a;f.element=d;f.visibility=c;f.gl=a.gl;a.addPanel(f);return f}r(b,a);w(b,[{key:"scheduleRedraw",value:function(){this.context.scheduleRedraw()}},
{key:"setGLViewport",value:function(){var a=this.element,b=a.getBoundingClientRect(),d=this.context.canvasRect,c=a.clientLeft+b.left-d.left,g=a.clientWidth,e=a.clientHeight;b=b.top-d.top+a.clientTop+e;a=this.gl;a.enable(a.SCISSOR_TEST);b=this.context.canvas.height-b;a.viewport(c,b,g,e);a.scissor(c,b,g,e)}},{key:"disposed",value:function(){this.context.removePanel(this);v(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}},{key:"visible",get:function(){return this.visibility.visible}}]);
return b}(n.a),q=function(c){function d(c){p(this,d);var f=h(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));f.container=c;f.canvas=document.createElement("canvas");f.updateStarted=new b.a;f.updateFinished=new b.a;f.panels=new Set;f.updatePending=null;f.onResize=f.registerCancellable(a()(function(){f.scheduleRedraw();for(var a=$jscomp.makeIterator(f.panels),b=a.next();!b.done;b=a.next())b.value.onResize()},0));var g=f.canvas;c.style.position="relative";g.style.position="absolute";g.style.top=
"0px";g.style.left="0px";g.style.width="100%";g.style.height="100%";g.style.zIndex="0";c.appendChild(g);f.gl=Object(l.a)(g);f.registerEventListener(window,"resize",f.onResize.bind(f));return f}r(d,c);w(d,[{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 d=b.next();!d.done;d=b.next()){d=d.value;var c=d.element;d.visible&&0!==c.clientWidth&&0!==c.clientHeight&&0!==c.offsetWidth&&0!==c.offsetHeight&&(d.setGLViewport(),d.draw())}a.disable(a.SCISSOR_TEST);this.gl.clearColor(1,
1,1,1);this.gl.colorMask(!1,!1,!1,!0);a.clear(a.COLOR_BUFFER_BIT);this.gl.colorMask(!0,!0,!0,!0);this.updateFinished.dispatch()}},{key:"update",value:function(){this.updatePending=null;this.draw()}}]);return d}(n.a)},function(n,e,c){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 h(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)}c.d(e,"a",function(){return b});n=c(0);var r=c(17),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}}(),b=function(b){function c(a,
b){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");var e=p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));e.target=a;e.eventMap=b;e.registerEventListener(a,"wheel",function(a){e.dispatch("wheel",a)});e.registerEventListener(a,"click",function(a){e.dispatch("click"+a.button,a)});e.registerEventListener(a,"dblclick",function(a){e.dispatch("dblclick"+a.button,a)});e.registerEventListener(a,"mousedown",function(a){e.dispatch("mousedown"+a.button,a)});e.registerEventListener(a,
"mouseup",function(a){e.dispatch("mouseup"+a.button,a)});return e}h(c,b);a(c,[{key:"dispatch",value:function(a,b){Object(r.b)(a,b,this.eventMap)}}]);return c}(n.a)},function(n,e,c){e.b=function(c,e,r,a){for(;e<r;){var b=c[e];a(b)?++e:(--r,c[e]=c[r],c[r]=b)}return r};e.a=function(c,e){if(c.length===e)return c;e=new c.constructor(e);e.set(c);return e}},function(n,e,c){e.a=function(c,e){var h=c.view.document,a=c.screenX,b=c.screenY,l=function(c){var l=a-c.screenX,m=b-c.screenY;a=c.screenX;b=c.screenY;
e(c,l,m)},w=c.button,p=function(a){a.button===w&&(h.removeEventListener("mousemove",l,!0),h.removeEventListener("mouseup",p,!1))};h.addEventListener("mousemove",l,!0);h.addEventListener("mouseup",p,!1)}},function(n,e,c){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 h(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function r(a){for(var b=v.length,c=v[b-1],f=0;f<b;++f){var e=v[f];if(a>=e.lengthInNanometers){c=e;break}}return c}e.b=r;c.d(e,"a",function(){return q});n=c(0);var a=c(58),b=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)}},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,e){c&&a(b.prototype,c);e&&a(b,e);return b}}(),w=[1.5,2,3,5,7.5,10],v=[{unit:"km",lengthInNanometers:1E12},{unit:"m",lengthInNanometers:1E9},{unit:"mm",lengthInNanometers:1E6},{unit:"\u00b5m",lengthInNanometers:1E3},{unit:"nm",lengthInNanometers:1},{unit:"pm",lengthInNanometers:.001}],
t=function(){function a(){h(this,a);this.allowedSignificands=w;this.prevTargetLengthInPixels=this.prevNanometersPerPixel=this.nanometersPerPixel=this.targetLengthInPixels=0}l(a,[{key:"update",value:function(){var a=this.nanometersPerPixel,b=this.targetLengthInPixels;if(this.prevNanometersPerPixel===a&&this.prevTargetLengthInPixels===b)return!1;this.prevNanometersPerPixel=a;this.prevTargetLengthInPixels=b;var c=b*a;b=Math.pow(10,Math.floor(Math.log(c)/Math.LN10));c/=b;for(var e=1,g=$jscomp.makeIterator(this.allowedSignificands),
l=g.next();!l.done;l=g.next())if(l=l.value,Math.abs(l-c)<Math.abs(e-c))e=l;else break;b*=e;c=r(b);this.lengthInPixels=Math.round(b/a);this.physicalUnit=c.unit;this.physicalLength=b/c.lengthInNanometers;return!0}}]);return a}(),q=function(c){function d(a,b){b=void 0===b?new t:b;h(this,d);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.dimensions=b;c.texture=null;c.width=0;c.height=0;return c}p(d,c);l(d,[{key:"update",value:function(){var b=this.dimensions,c=this.texture;if(b.update()||null===c){null===c&&(c=this.texture=this.gl.createTexture());var d=this.gl,e=document.createElement("canvas"),g=e.getContext("2d");g.font="bold 15px sans-serif";g.fillStyle="white";var l=b.physicalLength+" "+b.physicalUnit,q=g.measureText(l);q=Math.max(b.lengthInPixels,q.width)+4;e.width=q;e.height=32;g.font="bold 15px sans-serif";g.textAlign=
"center";g.fillStyle="rgba(0, 0, 0, 0.3)";g.fillRect(0,0,q,32);g.fillStyle="white";g.fillText(l,q/2,17);g.fillRect(2,22,b.lengthInPixels,8);Object(a.c)(d,c,e);this.width=q;this.height=32}}},{key:"disposed",value:function(){this.gl.deleteTexture(this.texture);this.texture=null;b(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"disposed",this).call(this)}}]);return d}(n.a)},function(n,e,c){c.d(e,"c",function(){return p});e.a="/ocp/ca";e.b="/nd/sd";var p=function r(){if(!(this instanceof r))throw new TypeError("Cannot call a class as a function");
};p.RPC_ID="ndstore/VolumeChunkSource"},function(n,e,c){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 h(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 r(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function a(a,b,c){Object(y.u)(a);var f=Object(y.w)(a,"Base",function(a){return new H(a)});switch(f.typeName){case "uint8blk":case "grayscale8":return new F(a,b,f,d.c.JPEG,c);case "imagetile":return new V(a,b,f);case "labels64":case "labelblk":return new F(a,b,f,d.c.COMPRESSED_SEGMENTATION,c);default:throw Error("DVID data type "+JSON.stringify(f.typeName)+" is not supported.");}}function b(a){try{for(var b=
Object(y.v)(a,function(a){return new S(a)}),c=new Map,d=$jscomp.makeIterator(b),f=d.next();!f.done;f=d.next()){var e=$jscomp.makeIterator(f.value),g=e.next().value,k=e.next().value;c.set(g,k);for(var m=$jscomp.makeIterator(k.vnodes),l=m.next();!l.done;l=m.next()){var q=l.value;if(q!==g){var h=new S(k);c.set(q,h)}}}for(var t=$jscomp.makeIterator(c),r=t.next();!r.done;r=t.next()){var w=$jscomp.makeIterator(r.value),p=w.next().value;w.next().value.uuid=p}return c}catch(Ma){throw Error("Failed to parse DVID repositories info: "+
Ma.message);}}function l(a,b){return a.memoize.getUncounted({type:"dvid:getServerInfo",baseUrls:b},function(){var a=Object(C.e)(Object(C.c)(b,"/api/repos/info","GET"),"json").then(function(a){return new L(a)}),c="repository info for DVID server "+b[0];x.a.forPromise(a,{initialMessage:"Retrieving "+c+".",delay:!0,errorPrefix:"Error retrieving "+c+": "});return a})}function w(a,b,c,d){return a.memoize.getUncounted({type:"dvid:getInstanceDetails",baseUrls:b,nodeKey:c,name:d.name},function(){var a=Object(C.e)(Object(C.c)(b,
"/api/node/"+c+"/"+d.name+"/info","GET"),"json"),f="datainstance info for node "+c+" and instance "+d.name+" "+("on DVID server "+b[0]);x.a.forPromise(a,{initialMessage:"Retrieving "+f+".",delay:!0,errorPrefix:"Error retrieving "+f+": "});return a.then(function(a){a=Object(y.w)(a,"Extended",y.u);d.lowerVoxelBound=Object(y.w)(a,"MinPoint",function(a){return Object(y.d)(E.p.create(),a)});d.upperVoxelBound=Object(y.w)(a,"MaxPoint",function(a){return Object(y.d)(E.p.create(),a)});return d})})}function v(a,
b,c,d){return l(a,b).then(function(f){f=f.getNode(c);if(void 0===f)throw Error("Invalid node: "+JSON.stringify(c)+".");f=f.dataInstances.get(d);if(!(f instanceof F||f instanceof V))throw Error("Invalid data instance "+d+".");return w(a,b,c,f)}).then(function(f){return a.memoize.getUncounted({type:"dvid:MultiscaleVolumeChunkSource",baseUrls:b,nodeKey:c,dataInstanceKey:d},function(){return new Q(a,b,c,d,f)})})}function t(a,b){var c=b.match(X);if(null===c)throw Error("Invalid DVID URL: "+JSON.stringify(b)+
".");return v(a,[c[1]],c[2],c[3])}function q(a,b){return{offset:0,completions:Object(B.c)(b,a.dataInstances.values(),function(a){return a.name},function(a){return""+a.base.typeName})}}function m(a,b){var c=b.match(/^(?:([^\/]+)(?:\/([^\/]*))?)?$/);if(null===c)throw Error("Invalid DVID URL syntax.");if(void 0===c[2])return{offset:0,completions:Object(B.c)(b,a.repositories.values(),function(a){return a.uuid+"/"},function(a){return a.alias+": "+a.description})};b=c[1];a=a.getNode(b);return Object(B.a)(b.length+
1,q(a,c[2]))}function g(a,b){a=a.match(/^((?:http|https):\/\/[^\/]+)\/(.*)$/);if(null===a)return Promise.reject(null);var c=a[1],d=a[2];return l(b,[c]).then(function(a){return Object(B.a)(c.length+1,m(a,d))})}Object.defineProperty(e,"__esModule",{value:!0});c.d(e,"getVolume",function(){return t});c.d(e,"volumeCompleter",function(){return g});c.d(e,"DataInstanceBaseInfo",function(){return H});c.d(e,"DataInstanceInfo",function(){return D});c.d(e,"VolumeDataInstanceInfo",function(){return F});c.d(e,
"TileLevelInfo",function(){return P});c.d(e,"TileDataInstanceInfo",function(){return V});e.parseDataInstance=a;c.d(e,"RepositoryInfo",function(){return S});e.parseRepositoriesInfo=b;c.d(e,"ServerInfo",function(){return L});e.getServerInfo=l;e.getDataInstanceDetails=w;c.d(e,"MultiscaleVolumeChunkSource",function(){return Q});e.getShardedVolume=v;e.completeInstanceName=q;e.completeNodeAndInstance=m;c.d(e,"DVIDDataSource",function(){return da});n=c(15);e=c(30);var d=c(180),f=c(13),k=c(21),x=c(33),B=
c(42),E=c(1),C=c(37),y=c(2),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}}(),A=new Map;A.set("uint8",f.a.UINT8);A.set("uint32",f.a.UINT32);A.set("uint64",f.a.UINT64);var H=function(){function a(b){r(this,a);this.obj=b;Object(y.u)(b);Object(y.w)(b,"TypeName",y.B)}G(a,[{key:"typeName",get:function(){return this.obj.TypeName}}]);
return a}(),D=function O(a,b,c){r(this,O);this.obj=a;this.name=b;this.base=c},I=function(a){function b(){r(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}h(b,a);return b}(Object(n.f)(k.b,d.d)),F=function(a){function b(a,c,d,f,e){r(this,b);d=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,c,d));d.encoding=f;a=Object(y.w)(a,"Extended",y.u);f=Object(y.w)(a,"Values",function(a){return Object(y.a)(a,y.u)});if(1>f.length)throw Error("Expected Extended.Values property to have length >= 1, but received: ${JSON.stringify(extendedValues)}.");
d.numLevels=1;for(e=new Set(e);e.has(c+"_"+d.numLevels.toString());)d.numLevels+=1;d.dataType=Object(y.w)(f[0],"DataType",function(a){return Object(y.t)(a,A)});d.voxelSize=Object(y.w)(a,"VoxelSize",function(a){return Object(y.c)(E.p.create(),a,y.p)});d.numChannels=1;return d}h(b,a);G(b,[{key:"getSources",value:function(a,b,c){for(var e=this.encoding,g=[],k={},m=0;m<this.numLevels;k={volParameters:k.volParameters},++m){for(var l=E.p.scale(E.p.create(),this.voxelSize,Math.pow(2,m)),q=E.p.create(),h=
E.p.create(),t=0;3>t;++t)q[t]=Math.floor(this.voxelSize[t]/l[t]*this.lowerVoxelBound[t]),h[t]=Math.ceil(this.voxelSize[t]/l[t]*this.upperVoxelBound[t]);t=b.dataInstanceKey;0<m&&(t+="_"+m.toString());k.volParameters={baseUrls:b.baseUrls,nodeKey:b.nodeKey,dataInstanceKey:t,encoding:e};l=f.b.getDefaults({voxelSize:l,dataType:this.dataType,numChannels:this.numChannels,transform:E.j.fromTranslation(E.j.create(),E.p.multiply(E.p.create(),q,l)),baseVoxelOffset:q,upperVoxelBound:E.p.subtract(E.p.create(),
h,q),volumeType:this.volumeType,volumeSourceOptions:c,compressedSegmentationBlockSize:e===d.c.COMPRESSED_SEGMENTATION?E.p.fromValues(8,8,8):void 0}).map(function(b){return function(c){return a.getChunkSource(I,{spec:c,parameters:b.volParameters})}}(k));g.push(l)}return g}},{key:"volumeType",get:function(){return this.encoding===d.c.COMPRESSED_SEGMENTATION?f.c.SEGMENTATION:f.c.IMAGE}}]);return b}(D),P=function Na(a){r(this,Na);Object(y.u)(a);this.resolution=Object(y.w)(a,"Resolution",function(a){return Object(y.c)(E.p.create(),
a,y.p)});this.tileSize=Object(y.w)(a,"TileSize",function(a){return Object(y.c)(E.p.create(),a,y.A)})},K=[[0,1],[0,2],[1,2]],T=function(a){function b(){r(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}h(b,a);return b}(Object(n.f)(k.b,d.a)),V=function(a){function b(a,c,f){r(this,b);c=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,c,f));a=Object(y.w)(a,"Extended",y.u);c.levels=Object(y.w)(a,"Levels",function(a){return Object(y.v)(a,function(a){return new P(a)})});
f=c.levels.get("0");if(void 0===f)throw Error("Level 0 is not defined.");c.voxelSize=f.resolution;var e=Object(y.w)(a,"MinTileCoord",function(a){return Object(y.c)(E.p.create(),a,y.s)}),g=Object(y.w)(a,"MaxTileCoord",function(a){return Object(y.c)(E.p.create(),a,y.s)});c.lowerVoxelBound=E.p.multiply(E.p.create(),f.tileSize,e);c.upperVoxelBound=E.p.multiply(E.p.create(),f.tileSize,g);a=Object(y.w)(a,"Encoding",function(a){return a});switch(a){case 2:c.encoding=d.b.JPEG;break;default:throw Error("Unsupported tile encoding: "+
JSON.stringify(a)+".");}return c}h(b,a);G(b,[{key:"dataType",get:function(){return f.a.UINT8}},{key:"volumeType",get:function(){return f.c.IMAGE}},{key:"numChannels",get:function(){return 1}}]);G(b,[{key:"getSources",value:function(a,b,c){for(var d=this,e=[],g=this.numChannels,k=this.dataType,m=this.encoding,l={},q=$jscomp.makeIterator(this.levels),h=q.next();!h.done;l={levelInfo:l.levelInfo,level:l.level},h=q.next())h=$jscomp.makeIterator(h.value),l.level=h.next().value,l.levelInfo=h.next().value,
h=K.map(function(e){return function(l){for(var q=E.p.clone(d.voxelSize),h=E.p.fromValues(1,1,1),t=0;2>t;++t)q[l[t]]=e.levelInfo.resolution[l[t]],h[l[t]]=e.levelInfo.tileSize[l[t]];t=E.p.create();for(var r=E.p.create(),w=0;3>w;++w)t[w]=Math.floor(d.voxelSize[w]/q[w]*d.lowerVoxelBound[w]),r[w]=Math.ceil(d.voxelSize[w]/q[w]*d.upperVoxelBound[w]);q=f.b.make({voxelSize:q,chunkDataSize:h,numChannels:g,dataType:k,lowerVoxelBound:t,upperVoxelBound:r,volumeSourceOptions:c});return a.getChunkSource(T,{spec:q,
parameters:{baseUrls:b.baseUrls,nodeKey:b.nodeKey,dataInstanceKey:b.dataInstanceKey,encoding:m,level:e.level,dims:l[0]+"_"+l[1]}})}}(l)),e.push(h);return e}}]);return b}(D),S=function M(b){r(this,M);this.errors=[];this.dataInstances=new Map;this.vnodes=new Set;if(b instanceof M)this.alias=b.alias,this.description=b.description,this.errors=b.errors,this.dataInstances=b.dataInstances;else{Object(y.u)(b);this.alias=Object(y.w)(b,"Alias",y.B);this.description=Object(y.w)(b,"Description",y.B);for(var c=
Object(y.w)(b,"DataInstances",y.u),d=Object.keys(c),f=$jscomp.makeIterator(d),e=f.next();!e.done;e=f.next()){e=e.value;try{this.dataInstances.set(e,a(c[e],e,d))}catch(Ba){e="Failed to parse data instance "+JSON.stringify(e)+": "+Ba.message,console.log(e),this.errors.push(e)}}b=Object(y.w)(b,"DAG",y.u);b=Object(y.w)(b,"Nodes",y.u);b=$jscomp.makeIterator(Object.keys(b));for(e=b.next();!e.done;e=b.next())this.vnodes.add(e.value)}},L=function(){function a(c){r(this,a);this.repositories=b(c)}G(a,[{key:"getNode",
value:function(a){for(var b=[],c=$jscomp.makeIterator(this.repositories.keys()),d=c.next();!d.done;d=c.next())d=d.value,d.startsWith(a)&&b.push(d);if(1!==b.length)throw Error("Node key "+JSON.stringify(a)+" matches "+JSON.stringify(b)+" nodes.");return this.repositories.get(b[0])}}]);return a}(),Q=function(){function a(b,c,d,f,e){r(this,a);this.chunkManager=b;this.baseUrls=c;this.nodeKey=d;this.dataInstanceKey=f;this.info=e}G(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}(),X=/^((?:http|https):\/\/[^\/]+)\/([^\/]+)\/([^\/]+)$/,da=function(a){function b(){r(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}
h(b,a);G(b,[{key:"getVolume",value:function(a,b){return t(a,b)}},{key:"volumeCompleter",value:function(a,b){return g(a,b)}},{key:"description",get:function(){return"DVID"}}]);return b}(e.a)},function(n,e,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function h(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 r(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 c=Object(F.a)(a,F.u);if(1>c.length)throw Error("No stacks found for owner object.");a=new Map;var d=Object(F.w)(c[0],"stackId",l);c=$jscomp.makeIterator(c);for(var f=c.next();!f.done;f=c.next()){var e=f.value;
f=Object(F.w)(e,"stackId",b);Object(F.u)(e);var g=Object(F.w)(e,"state",F.B);if(S.has(g)){g=Object(F.w)(e,"stats",F.u);var k=g;Object(F.u)(k);k=Object(F.w)(k,"stackBounds",F.u);var m=D.p.create();m[0]=Object(F.w)(k,"minX",F.q);m[1]=Object(F.w)(k,"minY",F.q);m[2]=Object(F.w)(k,"minZ",F.q);k=m;m=g;Object(F.u)(m);m=Object(F.w)(m,"stackBounds",F.u);var q=D.p.create();q[0]=Object(F.w)(m,"maxX",F.q);q[1]=Object(F.w)(m,"maxY",F.q);q[2]=Object(F.w)(m,"maxZ",F.q);m=q;q=[];g.hasOwnProperty("channelNames")&&
(q=w(g));g=Object(F.w)(e,"currentVersion",v);e=Object(F.w)(e,"stackId",t);e={lowerVoxelBound:k,upperVoxelBound:m,voxelResolution:g,project:e,channels:q}}else e=void 0;void 0!==e&&(g=e.project,k=a.get(g),void 0===k&&(k=new Map,a.set(g,{stacks:k}),k=a.get(g)),k.stacks.set(f,e))}return{owner:d,projects:a}}function b(a){Object(F.u)(a);return Object(F.w)(a,"stack",F.B)}function l(a){Object(F.u)(a);return Object(F.w)(a,"owner",F.B)}function w(a){Object(F.u)(a);return Object(F.w)(a,"channelNames",function(a){return Object(F.a)(a,
F.B)})}function v(a){Object(F.u)(a);var b=D.p.create();try{b[0]=Object(F.w)(a,"stackResolutionX",F.q),b[1]=Object(F.w)(a,"stackResolutionY",F.q),b[2]=Object(F.w)(a,"stackResolutionZ",F.q)}catch(M){b[0]=1,b[1]=1,b[2]=1}return b}function t(a){Object(F.u)(a);return Object(F.w)(a,"project",F.B)}function q(a,b){for(var c=0,d=0;2>d;d++)c<a.upperVoxelBound[d]&&(c=a.upperVoxelBound[d]);if(b>=c)return 1;for(a=0;c>b;)c/=2,a++;return a}function m(b,c,d){return b.memoize.getUncounted({type:"render:getOwnerInfo",
hostnames:c,owner:d},function(){return Object(I.e)(Object(I.c)(c,"/render-ws/v1/owner/"+d+"/stacks"),"json").then(a)})}function g(a,b,c){var d=c.match(Q);if(null===d)throw Error("Invalid volume path "+JSON.stringify(c));var f=d[1],e=d[2],g=d[3],k=d[4],l=Object(F.e)(d[5]||"");return a.memoize.getUncounted({type:"render:MultiscaleVolumeChunkSource",hostnames:b,path:c},function(){return m(a,b,f).then(function(c){return new L(a,b,c,g,e,k,l)})})}function d(a,b){var c=b.match(X);if(null===c)throw Error("Invalid render volume path: "+
JSON.stringify(b));b=c[1].split(",");return g(a,b,c[2])}function f(a,b,c){var d=c.match(/^(?:([^\/]+)(?:\/([^\/]*))?(?:\/([^\/]*))?(\/.*?)?)?$/);if(null===d||void 0===d[2])return Promise.reject(null);if(void 0===d[3]){var f=d[2]||"";return m(a,b,d[1]).then(function(a){a=Object(H.c)(f,a.projects,function(a){return a[0]+"/"},function(){});return{offset:d[1].length+1,completions:a}})}if(void 0===d[4]){var e=d[3]||"";return m(a,b,d[1]).then(function(a){a=a.projects.get(d[2]);if(void 0===a)return Promise.reject(null);
a=Object(H.c)(e,a.stacks,function(a){return a[0]+"/"},function(a){return"("+a[1].project+")"});return{offset:d[1].length+d[2].length+2,completions:a}})}var g=d[4].substr(1)||"";return m(a,b,d[1]).then(function(a){a=a.projects.get(d[2]);if(void 0===a)return Promise.reject(null);a=a.stacks.get(d[3]);if(void 0===a)return Promise.reject(null);a=a.channels;if(0===a.length)return Promise.reject(null);a=Object(H.c)(g,a,function(a){return a},function(){});return{offset:d[1].length+d[2].length+d[3].length+
3,completions:a}})}function k(a,b){var c=a.match(X);if(null===c)return Promise.reject(null);a=c[1].split(",");return f(b,a,c[2]).then(function(a){return Object(H.a)(c[1].length+1,a)})}function x(a,b){var c=b.match(X);if(null===c)throw Error("Invalid render point path: "+JSON.stringify(b));return B(a,[c[1]],c[2])}function B(a,b,c){var d=c.match(Q);if(null===d)throw Error("Invalid point path "+JSON.stringify(c));var f=d[1],e=d[2],g=d[3],k=Object(F.e)(d[4]||"");return a.memoize.getUncounted({type:"render:MultiscaleVectorGraphicsChunkSource",
hostnames:b,path:c},function(){return m(a,b,f).then(function(c){return new da(a,b,c,g,e,k)})})}Object.defineProperty(e,"__esModule",{value:!0});c.d(e,"getVolume",function(){return d});c.d(e,"volumeCompleter",function(){return k});c.d(e,"MultiscaleVolumeChunkSource",function(){return L});e.computeStackHierarchy=q;e.getOwnerInfo=m;e.getShardedVolume=g;e.stackAndProjectCompleter=f;c.d(e,"MultiscaleVectorGraphicsChunkSource",function(){return da});e.getPointMatches=x;e.getShardedPointMatches=B;c.d(e,
"RenderDataSource",function(){return J});n=c(15);e=c(30);var E=c(182),C=c(108),y=c(109),G=c(13),A=c(21),H=c(42),D=c(1),I=c(37),F=c(2),P=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),K=new Set(["jpg"]),T=function(a){function b(){p(this,b);return h(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}
r(b,a);return b}(Object(n.f)(A.b,E.b)),V=function(a){function b(){p(this,b);return h(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}r(b,a);return b}(Object(n.f)(y.b,E.a)),S=new Set(["COMPLETE"]),L=function(){function a(b,c,d,f,e,g,k){p(this,a);this.chunkManager=b;this.baseUrls=c;this.ownerInfo=d;this.project=e;this.parameters=k;b=d.projects.get(e);if(void 0===b)throw Error("Specified project "+JSON.stringify(e)+" does not exist for "+("specified owner "+JSON.stringify(d.owner)));
if(void 0===f){f=Array.from(b.stacks.keys());if(1!==f.length)throw Error("Dataset contains multiple stacks: "+JSON.stringify(f));f=f[0]}d=b.stacks.get(f);if(void 0===d)throw Error("Specified stack "+JSON.stringify(f)+" is not one of the supported stacks: "+JSON.stringify(Array.from(b.stacks.keys())));this.stack=f;this.stackInfo=d;void 0!==g&&0<g.length&&(this.channel=g);this.minIntensity=Object(F.y)(k.minIntensity);this.maxIntensity=Object(F.y)(k.maxIntensity);this.maxTileSpecsToRender=Object(F.y)(k.maxTileSpecsToRender);
this.filter=Object(F.x)(k.filter);g=Object(F.z)(k.encoding);if(void 0===g)g="jpg";else if(!K.has(g))throw Error("Invalid encoding: "+JSON.stringify(g)+".");this.encoding=g;this.numLevels=Object(F.y)(k.numlevels);this.dims=D.p.create();k=Object(F.y)(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=[],c=this.numLevels;void 0===c&&(c=q(this.stackInfo,this.dims[0]));for(var d=D.p.create(),f=D.p.create(),e=0;3>e;e++)d[e]=this.stackInfo.lowerVoxelBound[e]*
this.stackInfo.voxelResolution[e],f[e]=this.stackInfo.upperVoxelBound[e]*this.stackInfo.voxelResolution[e];for(e=0;e<c;e++){for(var g=D.p.clone(this.stackInfo.voxelResolution),k=D.p.fromValues(1,1,1),m=0;2>m;++m)g[m]*=Math.pow(2,e),k[m]=this.dims[m];m=D.p.create();for(var l=D.p.create(),h=0;3>h;h++)m[h]=Math.floor(this.stackInfo.voxelResolution[h]/g[h]*this.stackInfo.lowerVoxelBound[h]),l[h]=Math.ceil(this.stackInfo.voxelResolution[h]/g[h]*this.stackInfo.upperVoxelBound[h]);g=G.b.make({voxelSize:g,
chunkDataSize:k,numChannels:this.numChannels,dataType:this.dataType,lowerClipBound:d,upperClipBound:f,lowerVoxelBound:m,upperVoxelBound:l,volumeSourceOptions:a});g=this.chunkManager.getChunkSource(T,{spec:g,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:e,encoding:this.encoding}});b.push([g])}return b}},{key:"getMeshSource",value:function(){return null}},{key:"dataType",get:function(){return G.a.UINT8}},{key:"numChannels",get:function(){return 3}},{key:"volumeType",get:function(){return G.c.IMAGE}}]);return a}(),Q=/^([^\/?]+)(?:\/([^\/?]+))?(?:\/([^\/?]+))(?:\/([^\/?]*))?(?:\?(.*))?$/,X=/^((?:(?:(?:http|https):\/\/[^,\/]+)[^\/?])+)\/(.*)$/,da=function(){function a(b,c,d,f,e,g){p(this,a);this.chunkManager=b;this.baseUrls=c;this.ownerInfo=d;
this.project=e;this.parameters=g;b=d.projects.get(e);if(void 0===b)throw Error("Specified project "+JSON.stringify(e)+" does not exist for "+("specified owner "+JSON.stringify(d.owner)));if(void 0===f){f=Array.from(b.stacks.keys());if(1!==f.length)throw Error("Dataset contains multiple stacks: "+JSON.stringify(f));f=f[0]}d=b.stacks.get(f);if(void 0===d)throw Error("Specified stack "+JSON.stringify(f)+" is not one of the supported stacks: "+JSON.stringify(Array.from(b.stacks.keys())));this.stack=f;
this.stackInfo=d;d=Object(F.z)(g.matchCollection);void 0===d&&(d=f);this.matchCollection=d;f=Object(F.y)(g.zoffset);void 0===f&&(f=1);this.zoffset=f;this.dims=D.p.create();g=Object(F.y)(g.tilesize);void 0===g&&(g=1024);this.dims[0]=g;this.dims[1]=g;this.dims[2]=1}P(a,[{key:"getSources",value:function(a){for(var b=D.p.clone(this.stackInfo.voxelResolution),c=D.p.create(),d=D.p.create(),f=0;3>f;f++)c[f]=Math.floor(this.stackInfo.voxelResolution[f]/b[f]*this.stackInfo.lowerVoxelBound[f]),d[f]=Math.ceil(this.stackInfo.voxelResolution[f]/
b[f]*this.stackInfo.upperVoxelBound[f]);f=D.p.clone(d);f[0]+=Math.abs(c[0]);f[1]+=Math.abs(c[1]);f[2]=1;a=C.a.make({voxelSize:b,lowerVoxelBound:c,upperVoxelBound:d,chunkDataSize:f,vectorGraphicsSourceOptions:a});return[[this.chunkManager.getChunkSource(V,{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}(),J=function(a){function b(){p(this,
b);return h(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}r(b,a);P(b,[{key:"getVolume",value:function(a,b){return d(a,b)}},{key:"volumeCompleter",value:function(a,b){return k(a,b)}},{key:"getVectorGraphicsSource",value:function(a,b){return x(a,b)}},{key:"description",get:function(){return"Render"}}]);return b}(e.a)},function(n,e,c){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)}c.d(e,"b",function(){return b});c.d(e,"a",function(){return l});var h=c(32),r=c(1),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}}(),b;(function(a){a[a.LINE=
0]="LINE";a[a.POINT=1]="POINT"})(b||(b={}));var l=function(b){function c(a){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");a=(c.__proto__||Object.getPrototypeOf(c)).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}p(c,b);a(c,[{key:"toObject",value:function(){return{transform:this.chunkLayout.transform,chunkDataSize:this.chunkDataSize,voxelSize:this.voxelSize,
lowerVoxelBound:this.lowerVoxelBound,upperVoxelBound:this.upperVoxelBound,lowerClipBound:this.lowerClipBound,upperClipBound:this.upperClipBound,baseVoxelOffset:this.baseVoxelOffset}}}],[{key:"make",value:function(a){return new c(Object.assign({},a,{transform:Object(h.m)(a.transform,a.vectorGraphicsSourceOptions)}))}},{key:"fromObject",value:function(a){return new c(a)}},{key:"withDefaults",value:function(a){var b=a.transform,e=a.lowerVoxelBound,g=a.upperVoxelBound,d=a.chunkDataSize;b=Object(h.m)(b,
a.vectorGraphicsSourceOptions);if(void 0===d&&(d=r.p.clone(g),void 0!==e))for(g=0;3>g;g++)d[g]+=Math.abs(e[g]);console.log(d);console.log(a);return new c(Object.assign({},a,{transform:b,chunkDataSize:d}))}}]);return c}(h.k)},function(n,e,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function h(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 r(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)}c.d(e,"a",function(){return w});c.d(e,"b",function(){return t});n=c(46);e=c(67);var a=c(24),b=function m(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 m(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,f){c&&a(b.prototype,c);f&&a(b,f);return b}}(),w=function(a){function b(a,c){c=void 0===c?{}:c;c=void 0===c.sourceOptions?{}:c.sourceOptions;p(this,b);
a=h(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a.chunkManager,a.getSources(c)));a.shader=void 0;a.shaderUpdated=!0;a.rpcId=null;return a}r(b,a);l(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.shader;a.bind();return a}}]);return b}(e.a),v=function(c){function e(a,b){p(this,e);a=h(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,a,b));a.vertexPositions=b.vertexPositions;a.numPoints=Math.floor(a.vertexPositions.length/3);return a}r(e,c);l(e,[{key:"copyToGPU",value:function(c){b(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"copyToGPU",this).call(this,c);this.vertexBuffer=a.a.fromData(c,this.vertexPositions,c.ARRAY_BUFFER,c.STATIC_DRAW)}},
{key:"freeGPUMemory",value:function(a){b(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"freeGPUMemory",this).call(this,a);this.vertexBuffer.dispose()}}]);return e}(n.b),t=function(a){function b(){p(this,b);return h(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}r(b,a);l(b,[{key:"getChunk",value:function(a){return new v(this,a)}},{key:"vectorGraphicsCoordinatesInVoxels",get:function(){return!0}}]);return b}(n.c)},function(n,e,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)}Object.defineProperty(e,"__esModule",{value:!0});c.d(e,"OpenConnectomeDataSource",function(){return a});var h=c(105),r=["http://openconnecto.me","http://www.openconnecto.me"],a=function(a){function b(){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");
var a=(b.__proto__||Object.getPrototypeOf(b)).call(this,"NDstore server hosted at openconnecto.me",r,h.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}p(b,a);return b}(c(71).SingleServerDataSource)},function(n,e,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function h(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 r(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(B,{parameters:b})}function b(a,b,c){return a.memoize.getUncounted({type:"precomputed:MultiscaleVolumeChunkSource",
baseUrls:b,path:c},function(){return Object(d.e)(Object(d.c)(b,c+"/info"),"json").then(function(d){return new C(a,b,c,d)})})}function l(b,c){var f=$jscomp.makeIterator(Object(d.d)(c));c=f.next().value;f=f.next().value;return a(b,{baseUrls:c,path:f,lod:0})}function w(a,c){var f=$jscomp.makeIterator(Object(d.d)(c));c=f.next().value;f=f.next().value;return b(a,c,f)}Object.defineProperty(e,"__esModule",{value:!0});c.d(e,"getMeshSource",function(){return l});c.d(e,"getVolume",function(){return w});c.d(e,
"MultiscaleVolumeChunkSource",function(){return C});e.getShardedMeshSource=a;e.getShardedVolume=b;c.d(e,"PrecomputedDataSource",function(){return y});n=c(15);e=c(30);var v=c(185),t=c(54),q=c(13),m=c(21),g=c(1),d=c(37),f=c(2),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}}(),x=function(a){function b(){p(this,
b);return h(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}r(b,a);return b}(Object(n.f)(m.b,v.c)),B=function(a){function b(){p(this,b);return h(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}r(b,a);return b}(Object(n.f)(t.b,v.a)),E=function A(a){p(this,A);Object(f.u)(a);this.resolution=Object(f.w)(a,"resolution",function(a){return Object(f.c)(g.p.create(),a,f.p)});this.voxelOffset=Object(f.w)(a,"voxel_offset",function(a){return Object(f.d)(g.p.create(),a)});
this.size=Object(f.w)(a,"size",function(a){return Object(f.c)(g.p.create(),a,f.A)});this.chunkSizes=Object(f.w)(a,"chunk_sizes",function(a){return Object(f.a)(a,function(a){return Object(f.c)(g.p.create(),a,f.A)})});if(0===this.chunkSizes.length)throw Error("No chunk sizes specified.");(this.encoding=Object(f.w)(a,"encoding",function(a){return Object(f.n)(a,v.b)}))===v.b.COMPRESSED_SEGMENTATION&&(this.compressedSegmentationBlockSize=Object(f.w)(a,"compressed_segmentation_block_size",function(a){return Object(f.c)(g.p.create(),
a,f.A)}));this.key=Object(f.w)(a,"key",f.B)},C=function(){function b(a,c,d,e){p(this,b);this.chunkManager=a;this.baseUrls=c;this.path=d;Object(f.u)(e);this.dataType=Object(f.w)(e,"data_type",function(a){return Object(f.n)(a,q.a)});this.numChannels=Object(f.w)(e,"num_channels",f.A);this.volumeType=Object(f.w)(e,"type",function(a){return Object(f.n)(a,q.c)});this.mesh=Object(f.w)(e,"mesh",f.z);this.scales=Object(f.w)(e,"scales",function(a){return Object(f.a)(a,function(a){return new E(a)})})}k(b,[{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 b=this;return this.scales.map(function(c){return q.b.getDefaults({voxelSize:c.resolution,dataType:b.dataType,numChannels:b.numChannels,transform:g.j.fromTranslation(g.j.create(),g.p.multiply(g.p.create(),c.resolution,c.voxelOffset)),upperVoxelBound:c.size,volumeType:b.volumeType,chunkDataSizes:c.chunkSizes,baseVoxelOffset:c.voxelOffset,
compressedSegmentationBlockSize:c.compressedSegmentationBlockSize,volumeSourceOptions:a}).map(function(a){return b.chunkManager.getChunkSource(x,{spec:a,parameters:{baseUrls:b.baseUrls,path:b.path+"/"+c.key,encoding:c.encoding}})})})}}]);return b}(),y=function(a){function b(){p(this,b);return h(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}r(b,a);k(b,[{key:"getVolume",value:function(a,b){return w(a,b)}},{key:"getMeshSource",value:function(a,b){return l(a,b)}},{key:"description",
get:function(){return"Precomputed file-backed data source"}}]);return b}(e.a)},function(n,e,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function h(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 r(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){return a.rpc.promiseInvoke(l.a,{chunkManager:a.addCounterpartRef(),url:b},c)}function b(b,c){return b.memoize.getUncounted({type:"nifti/getVolume",url:c},function(){return a(b,c,t.e).then(function(a){return new d(b,c,a)})})}Object.defineProperty(e,"__esModule",{value:!0});c.d(e,"getVolume",function(){return b});c.d(e,
"MultiscaleVolumeChunkSource",function(){return d});c.d(e,"NiftiDataSource",function(){return f});n=c(15);e=c(30);var l=c(187),w=c(13),v=c(21),t=c(29),q=c(1),m=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(a){function b(){p(this,b);return h(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,
arguments))}r(b,a);return b}(Object(n.f)(v.b,l.b)),d=function(){function a(b,c,d){p(this,a);this.chunkManager=b;this.url=c;this.info=d}m(a,[{key:"getSources",value:function(a){var b=this.info;a=w.b.withDefaultCompression({volumeType:b.volumeType,chunkDataSize:b.volumeSize,dataType:b.dataType,voxelSize:b.voxelSize,numChannels:b.numChannels,upperVoxelBound:b.volumeSize,transform:Object(q.o)(q.j.create(),b.qoffset,b.quatern,q.g,b.qfac),volumeSourceOptions:a});return[[this.chunkManager.getChunkSource(g,
{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}(),f=function(a){function c(){p(this,c);return h(this,(c.__proto__||Object.getPrototypeOf(c)).apply(this,arguments))}r(c,a);m(c,[{key:"getVolume",value:function(a,c){return b(a,c)}},{key:"description",get:function(){return"Single NIfTI file"}}]);
return c}(e.a)},function(n,e,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function h(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 r(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 c=[],d=0;d<arguments.length;++d)c[d-0]=arguments[d];p(this,b);var f;d=h(this,(f=b.__proto__||Object.getPrototypeOf(b)).call.apply(f,[].concat([this],$jscomp.arrayFromIterable(c))));c=c[1];f=d.dataSource=d.registerDisposer(c.dataSource.addRef());d.generation=c.generation;f.registerSource(c.parameters.key,d);return d}r(b,a);B(b,null,[{key:"encodeOptions",
value:function(a){var c=E(b.__proto__||Object.getPrototypeOf(b),"encodeOptions",this).call(this,a);c.dataSource=Object(x.a)(a.dataSource);return c}}]);return b}(a)}function b(a){Object(k.u)(a);return{key:Object(k.w)(a,"key",k.B),offset:Object(k.w)(a,"offset",k.l),sizeInVoxels:Object(k.w)(a,"sizeInVoxels",k.j),voxelSize:Object(k.w)(a,"voxelSize",k.k),chunkDataSize:Object(k.w)(a,"chunkDataSize",function(a){return void 0===a?void 0:Object(k.j)(a)})}}function l(a){Object(k.u)(a);return{dataType:Object(k.w)(a,
"dataType",function(a){return Object(k.n)(a,q.c)}),numComponents:Object(k.w)(a,"numComponents",k.A)}}Object.defineProperty(e,"__esModule",{value:!0});c.d(e,"MultiscaleVolumeChunkSource",function(){return G});c.d(e,"PythonSkeletonSource",function(){return A});c.d(e,"PythonDataSource",function(){return H});n=c(15);e=c(30);var w=c(191),v=c(54),t=c(65),q=c(32),m=c(13),g=c(21),d=c(1),f=c(37),k=c(2),x=c(23),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}}(),E=function I(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 I(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},C=function(a){function b(){p(this,b);return h(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}
r(b,a);return b}(a(Object(n.f)(g.b,w.d))),y=function(a){function b(){p(this,b);return h(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}r(b,a);return b}(a(Object(n.f)(v.b,w.a))),G=function(){function a(c,f,e,g){p(this,a);this.dataSource=c;this.chunkManager=f;this.key=e;this.response=g;Object(k.u)(g);this.dataType=Object(k.w)(g,"dataType",function(a){return Object(k.n)(a,q.c)});this.volumeType=Object(k.w)(g,"volumeType",function(a){return Object(k.n)(a,m.c)});this.numChannels=Object(k.w)(g,
"numChannels",k.A);this.encoding=Object(k.w)(g,"encoding",function(a){return Object(k.n)(a,w.c)});this.generation=Object(k.w)(g,"generation",function(a){return a});var l=Object(k.w)(g,"maxVoxelsPerChunkLog2",function(a){return void 0===a?q.b:Object(k.A)(a)});c=Object(k.w)(g,"threeDimensionalScales",function(a){return void 0===a?void 0:Object(k.a)(a,b)});g=Object(k.w)(g,"twoDimensionalScales",function(a){return void 0===a?void 0:Object(k.a)(a,function(a){return Object(k.c)(Array(3),a,b)})});if(void 0===
g===(void 0===c))throw Error('Exactly one of "threeDimensionalScales" and "twoDimensionalScales" must be specified.');if(void 0!==g){if(0===g.length)throw Error("At least one scale must be specified.");this.scales=g.map(function(a){return a.map(function(a,b){var c=a.voxelSize,d=a.sizeInVoxels;b=void 0===a.chunkDataSize?Object(q.p)({voxelSize:c,upperVoxelBound:d,flatDimension:2-b,maxVoxelsPerChunkLog2:l}):a.chunkDataSize;return{key:a.key,offset:a.offset,sizeInVoxels:d,voxelSize:c,chunkDataSize:b}})});
if(!d.p.equals(this.scales[0][0].voxelSize,this.scales[0][1].voxelSize)||!d.p.equals(this.scales[0][0].voxelSize,this.scales[0][2].voxelSize))throw Error("Lowest scale must have uniform voxel size.");}if(void 0!==c){if(0===c.length)throw Error("At least one scale must be specified.");this.scales=c.map(function(a){var b=a.voxelSize,c=a.sizeInVoxels,d=void 0===a.chunkDataSize?Object(q.n)({voxelSize:b,upperVoxelBound:c,maxVoxelsPerChunkLog2:l}):a.chunkDataSize;return[{key:a.key,offset:a.offset,sizeInVoxels:c,
voxelSize:b,chunkDataSize:d}]})}}B(a,[{key:"getSources",value:function(a){var b=this,c=this.numChannels,f=this.dataType,e=this.volumeType,g=this.encoding,k=this.scales[0][0],l=d.p.multiply(d.p.create(),k.voxelSize,k.sizeInVoxels);return this.scales.map(function(k){return k.map(function(k){var q=m.b.withDefaultCompression({voxelSize:k.voxelSize,dataType:f,volumeType:e,numChannels:c,transform:d.j.fromTranslation(d.j.create(),k.offset),upperVoxelBound:k.sizeInVoxels,upperClipBound:l,chunkDataSize:k.chunkDataSize,
volumeSourceOptions:a});return b.chunkManager.getChunkSource(C,{spec:q,dataSource:b.dataSource,generation:b.generation,parameters:{key:b.key,scaleKey:k.key,encoding:g}})})})}},{key:"getMeshSource",value:function(){return this.chunkManager.getChunkSource(y,{dataSource:this.dataSource,generation:this.generation,parameters:{key:this.key}})}}]);return a}(),A=function(a){function b(){p(this,b);return h(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}r(b,a);B(b,[{key:"skeletonVertexCoordinatesInVoxels",
get:function(){return!1}},{key:"vertexAttributes",get:function(){return this.parameters.vertexAttributes}}]);return b}(a(Object(n.f)(t.d,w.b))),H=function(a){function b(){p(this,b);var a=h(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));a.sources=new Map;a.sourceGenerations=new Map;return a}r(b,a);B(b,[{key:"registerSource",value:function(a,b){var c=this,d=this.sources.get(a);void 0===d&&(d=new Set,this.sources.set(a,d));var f=this.sourceGenerations.get(a);void 0!==f&&(b.generation=
f);d.add(b);b.registerDisposer(function(){d.delete(b);0===d.size&&c.sources.delete(a)})}},{key:"setSourceGeneration",value:function(a,b){var c=this.sourceGenerations;if(c.get(a)!==b&&(c.set(a,b),a=this.sources.get(a),void 0!==a))for(a=$jscomp.makeIterator(a),c=a.next();!c.done;c=a.next())c=c.value,c.generation!==b&&(c.generation=b,c.invalidateCache())}},{key:"deleteSourceGeneration",value:function(a){this.sourceGenerations.delete(a)}},{key:"getVolume",value:function(a,b){var c=this;return a.memoize.getUncounted({type:"python:MultiscaleVolumeChunkSource",
key:b},function(){return Object(f.e)(Object(f.b)("/neuroglancer/info/"+b),"json").then(function(d){return new G(c,a,b,d)})})}},{key:"getSkeletonSource",value:function(a,b){var c=b.match(/^([^\/?]+)\?(.*)$/);if(null===c)throw Error("Invalid python volume path: "+JSON.stringify(b));return a.getChunkSource(A,{dataSource:this,generation:-1,parameters:{key:c[1],vertexAttributes:Object(k.v)(JSON.parse(c[2]),l)}})}},{key:"description",get:function(){return"Python-served volume"}}]);return b}(e.a)},function(n,
e,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function h(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 r(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)}c.d(e,"a",function(){return g});var a=c(35),b=c(32);n=c(195);e=c(67);var l=c(1),w=c(12),v=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),t=function f(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 f(a,b,c)}else{if("value"in e)return e.value;b=e.get;return void 0===b?void 0:b.call(c)}},q=l.j.create(),m=function(a){function b(){p(this,b);return h(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}r(b,a);v(b,[{key:"defineShader",value:function(a){t(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 + 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,c,f,e,g,k,m){a=l.p.multiply(l.p.create(),a,b);for(var q=l.p.create(),h=l.p.create(),t=l.p.fromValues(Math.abs(g[0]),Math.abs(g[1]),Math.abs(g[2])),r=0;6>r;++r){var w=this.computeVertexPositionDebug(a,c,f,e,g,k,r);if(void 0===w){console.log("no intersection found");break}l.p.transformMat4(q,w,m);l.p.sub(h,w,k);l.p.divide(h,h,b);l.p.scaleAndAdd(h,
h,t,.001);console.log("vertex "+r+", at "+q+", vChunkPosition = "+h)}}},{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,c,f,e,g){this.setViewportPlane(b,c.viewportAxes[2],c.centerDataPosition,g.invTransform);a.uniformMatrix4fv(b.uniform("uProjectionMatrix"),!1,l.j.multiply(q,f,g.transform));
a.uniform3fv(b.uniform("uVoxelSize"),e.voxelSize);a.uniform3fv(b.uniform("uLowerClipBound"),e.lowerClipBound);a.uniform3fv(b.uniform("uUpperClipBound"),e.upperClipBound)}},{key:"setupChunkDataSize",value:function(a,b,c){a.uniform3fv(b.uniform("uChunkDataSize"),c)}},{key:"drawChunk",value:function(a,b,c){a.uniform3fv(b.uniform("uTranslation"),c);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}(n.a),g=function(c){function f(a,b){b=void 0===b?{}:b;p(this,f);var c=b;c=void 0===c.sourceOptions?{}:c.sourceOptions;a=h(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,a.chunkManager,a.getSources(c),b));a.vertexComputationManager=m.get(a.gl);return a}r(f,c);v(f,[{key:"getValueAt",value:function(a){for(var c=$jscomp.makeIterator(Object(b.o)(this)),f=c.next();!f.done;f=c.next()){f=$jscomp.makeIterator(f.value);for(var e=f.next();!e.done;e=f.next())if(e=e.value,e=e.source.getValueAt(a,
e.chunkLayout),null!=e)return e}return null}},{key:"getShader",value:function(){var a=this,b=this.getShaderKey()+"/"+this.chunkFormat.shaderKey;return this.gl.memoize.get(b,function(){return a.buildShader()})}},{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(w.a)(this.dataType)+" getDataValue() { return getDataValue(0); }\n")}},
{key:"beginSlice",value:function(a){a=this.gl;var b=this.shader;b.bind();this.vertexComputationManager.beginSlice(a,b);return b}},{key:"endSlice",value:function(a){this.vertexComputationManager.endSlice(this.gl,a)}},{key:"draw",value:function(b){var c=b.visibleLayers.get(this);if(0!==c.length&&(this.initializeShader(),void 0!==this.shader)){var f=this.gl,e=l.p.create(),g=this.beginSlice(b),k=this.vertexComputationManager,m=this.chunkFormat;m.beginDrawing(f,g);var q={};c=$jscomp.makeIterator(c);for(var h=
c.next();!h.done;q={chunkDataSize:q.chunkDataSize},h=c.next()){h=h.value;var t=h.chunkLayout,r=h.source;h=r.chunks;var w=t.size;q.chunkDataSize=void 0;var p=b.visibleChunks.get(t);if(p){k.beginSource(f,g,b,b.dataToDevice,r.spec,t);t=r.chunkFormat;t.beginSource(f,g);r=function(a){return function(b){a.chunkDataSize=b;k.setupChunkDataSize(f,g,a.chunkDataSize)}}(q);p=$jscomp.makeIterator(p);for(var v=p.next();!v.done;v=p.next())if((v=h.get(v.value))&&v.state===a.d.GPU_MEMORY){var n=v.chunkDataSize;n!==
q.chunkDataSize&&r(n);l.p.multiply(e,w,v.chunkGridPosition);t.bindChunk(f,g,v);k.drawChunk(f,g,e)}}}m.endDrawing(f,g);this.endSlice(g)}}},{key:"dataType",get:function(){return this.sources[0][0].spec.dataType}},{key:"chunkFormat",get:function(){return this.sources[0][0].chunkFormat}}]);return f}(e.a)},function(n,e,c){function p(b){if(Object(r.n)(b,a))return Object(r.B)(b);throw Error();}c.d(e,"b",function(){return a});e.c=function(a){return new h.a(void 0===a?"default":a,p)};var h=c(8),r=c(2),a;(function(a){a[a.DEFAULT=
0]="DEFAULT";a[a.ADDITIVE=1]="ADDITIVE"})(a||(a={}));n=new Map;e.a=n;n.set(a.DEFAULT,function(a){a.blendFunc(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA)});n.set(a.ADDITIVE,function(a){a.blendFunc(a.SRC_ALPHA,a.ONE)})},function(n,e,c){(function(c,e){n.exports=e()})(this,function(){function c(a){return new RegExp("(^|\\s)"+a+"(?:$|\\s)\\s*")}function e(a){for(var b=a.childNodes.length;0<b;--b)a.removeChild(a.firstChild);return a}function r(a,b){return e(a).appendChild(b)}function a(a,b,c,d){a=document.createElement(a);
c&&(a.className=c);d&&(a.style.cssText=d);if("string"==typeof b)a.appendChild(document.createTextNode(b));else if(b)for(c=0;c<b.length;++c)a.appendChild(b[c]);return a}function b(b,c,d,f){b=a(b,c,d,f);b.setAttribute("role","presentation");return b}function l(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 w(){try{var a=document.activeElement}catch(z){a=document.body||null}for(;a&&a.shadowRoot&&a.shadowRoot.activeElement;)a=
a.shadowRoot.activeElement;return a}function v(a,b){var d=a.className;c(b).test(d)||(a.className+=(d?" ":"")+b)}function t(a,b){a=a.split(" ");for(var d=0;d<a.length;d++)a[d]&&!c(a[d]).test(b)&&(b+=" "+a[d]);return b}function q(a){var b=Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b)}}function m(a,b,c){b||(b={});for(var d in a)!a.hasOwnProperty(d)||!1===c&&b.hasOwnProperty(d)||(b[d]=a[d]);return b}function g(a,b,c,d,f){null==b&&(b=a.search(/[^\s\u00a0]/),-1==b&&(b=
a.length));d=d||0;for(f=f||0;;){var u=a.indexOf("\t",d);if(0>u||u>=b)return f+(b-d);f+=u-d;f+=c-f%c;d=u+1}}function d(a,b){for(var c=0;c<a.length;++c)if(a[c]==b)return c;return-1}function f(a,b,c){for(var d=0,u=0;;){var f=a.indexOf("\t",d);-1==f&&(f=a.length);var e=f-d;if(f==a.length||u+e>=b)return d+Math.min(e,b-u);u+=f-d;u+=c-u%c;d=f+1;if(u>=b)return d}}function k(a){for(;wc.length<=a;)wc.push(n(wc)+" ");return wc[a]}function n(a){return a[a.length-1]}function B(a,b){for(var c=[],d=0;d<a.length;d++)c[d]=
b(a[d],d);return c}function E(a,b,c){for(var d=0,u=c(b);d<a.length&&c(a[d])<=u;)d++;a.splice(d,0,b)}function C(){}function y(a,b){Object.create?a=Object.create(a):(C.prototype=a,a=new C);b&&m(b,a);return a}function G(a){return/\w/.test(a)||"\u0080"<a&&(a.toUpperCase()!=a.toLowerCase()||bg.test(a))}function A(a,b){return b?-1<b.source.indexOf("\\w")&&G(a)?!0:b.test(a):G(a)}function H(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return!1;return!0}function D(a){return 768<=a.charCodeAt(0)&&cg.test(a)}
function I(a,b,c){for(;(0>c?0<b:b<a.length)&&D(a.charAt(b));)b+=c;return b}function F(a,b,c){for(var d=b>c?-1:1;;){if(b==c)return b;var u=(b+c)/2;u=0>d?Math.ceil(u):Math.floor(u);if(u==b)return a(u)?b:c;a(u)?c=u:b=u+d}}function P(c,d,f){this.input=f;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=
b("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=b("div",[this.measure,this.lineMeasure,this.selectionDiv,this.cursorDiv,this.lineDiv],null,"position: relative; outline: none");var u=b("div",[this.lineSpace],"CodeMirror-lines");this.mover=a("div",[u],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");W&&8>ba&&(this.gutters.style.zIndex=-1,this.scroller.style.paddingRight=
0);pa||Ua&&Kb||(this.scroller.draggable=!0);c&&(c.appendChild?c.appendChild(this.wrapper):c(this.wrapper));this.reportedViewFrom=this.reportedViewTo=this.viewFrom=this.viewTo=d.first;this.view=[];this.externalMeasured=this.renderedView=null;this.lastWrapHeight=this.lastWrapWidth=this.viewOffset=0;this.updateLineNumbers=null;this.nativeBarWidth=this.barHeight=this.barWidth=0;this.scrollbarsClipped=!1;this.lineNumWidth=this.lineNumInnerWidth=this.lineNumChars=null;this.alignWidgets=!1;this.maxLine=
this.cachedCharWidth=this.cachedTextHeight=this.cachedPaddingH=null;this.maxLineLength=0;this.maxLineChanged=!1;this.wheelDX=this.wheelDY=this.wheelStartX=this.wheelStartY=null;this.shift=!1;this.activeTouch=this.selForContextMenu=null;f.init(this)}function K(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 c=0;;++c){var d=a.children[c],u=d.chunkSize();if(b<u){a=d;break}b-=u}return a.lines[b]}function T(a,b,c){var d=[],u=b.line;
a.iter(b.line,c.line+1,function(a){a=a.text;u==c.line&&(a=a.slice(0,c.ch));u==b.line&&(a=a.slice(b.ch));d.push(a);++u});return d}function V(a,b,c){var d=[];a.iter(b,c,function(a){d.push(a.text)});return d}function S(a,b){if(b-=a.height)for(;a;a=a.parent)a.height+=b}function L(a){if(null==a.parent)return null;var b=a.parent;a=d(b.lines,a);for(var c=b.parent;c;b=c,c=c.parent)for(var u=0;c.children[u]!=b;++u)a+=c.children[u].chunkSize();return a+b.first}function Q(a,b){var c=a.first;a:do{for(var d=0;d<
a.children.length;++d){var u=a.children[d],f=u.height;if(b<f){a=u;continue a}b-=f;c+=u.chunkSize()}return c}while(!a.lines);for(d=0;d<a.lines.length;++d){u=a.lines[d].height;if(b<u)break;b-=u}return c+d}function X(a,b){return b>=a.first&&b<a.first+a.size}function da(a,b){return String(a.lineNumberFormatter(b+a.firstLineNumber))}function J(a,b,c){void 0===c&&(c=null);if(!(this instanceof J))return new J(a,b,c);this.line=a;this.ch=b;this.sticky=c}function O(a,b){return a.line-b.line||a.ch-b.ch}function Na(a,
b){return a.sticky==b.sticky&&0==O(a,b)}function M(a){return J(a.line,a.ch)}function Oa(a,b){return 0>O(a,b)?b:a}function ea(a,b){return 0>O(a,b)?a:b}function N(a,b){if(b.line<a.first)return J(a.first,0);var c=a.first+a.size-1;if(b.line>c)return J(c,K(a,c).text.length);a=K(a,b.line).text.length;c=b.ch;b=null==c||c>a?J(b.line,a):0>c?J(b.line,0):b;return b}function Sa(a,b){for(var c=[],d=0;d<b.length;d++)c[d]=N(a,b[d]);return c}function Ta(a,b,c){this.marker=a;this.from=b;this.to=c}function Ba(a,b){if(a)for(var c=
0;c<a.length;++c){var d=a[c];if(d.marker==b)return d}}function Ib(a,b){if(b.full)return null;var c=X(a,b.from.line)&&K(a,b.from.line).markedSpans,d=X(a,b.to.line)&&K(a,b.to.line).markedSpans;if(!c&&!d)return null;a=b.from.ch;var u=b.to.ch,f=0==O(b.from,b.to),e;if(c)for(var g=0;g<c.length;++g){var z=c[g],k=z.marker;if(null==z.from||(k.inclusiveLeft?z.from<=a:z.from<a)||!(z.from!=a||"bookmark"!=k.type||f&&z.marker.insertLeft)){var m=null==z.to||(k.inclusiveRight?z.to>=a:z.to>a);(e||(e=[])).push(new Ta(k,
z.from,m?null:z.to))}}c=e;var l;if(d)for(e=0;e<d.length;++e)if(g=d[e],z=g.marker,null==g.to||(z.inclusiveRight?g.to>=u:g.to>u)||g.from==u&&"bookmark"==z.type&&(!f||g.marker.insertLeft))k=null==g.from||(z.inclusiveLeft?g.from<=u:g.from<u),(l||(l=[])).push(new Ta(z,k?null:g.from-u,null==g.to?null:g.to-u));d=1==b.text.length;u=n(b.text).length+(d?a:0);if(c)for(f=0;f<c.length;++f)if(e=c[f],null==e.to)(g=Ba(l,e.marker),g)?d&&(e.to=null==g.to?null:g.to+u):e.to=a;if(l)for(a=0;a<l.length;++a)f=l[a],null!=
f.to&&(f.to+=u),null==f.from?Ba(c,f.marker)||(f.from=u,d&&(c||(c=[])).push(f)):(f.from+=u,d&&(c||(c=[])).push(f));c&&(c=Vd(c));l&&l!=c&&(l=Vd(l));a=[c];if(!d){b=b.text.length-2;var q;if(0<b&&c)for(d=0;d<c.length;++d)null==c[d].to&&(q||(q=[])).push(new Ta(c[d].marker,null,null));for(c=0;c<b;++c)a.push(q);a.push(l)}return a}function Vd(a){for(var b=0;b<a.length;++b){var c=a[b];null!=c.from&&c.from==c.to&&!1!==c.marker.clearWhenEmpty&&a.splice(b--,1)}return a.length?a:null}function ag(a,b,c){var u=null;
a.iter(b.line,c.line+1,function(a){if(a.markedSpans)for(var b=0;b<a.markedSpans.length;++b){var c=a.markedSpans[b].marker;!c.readOnly||u&&-1!=d(u,c)||(u||(u=[])).push(c)}});if(!u)return null;a=[{from:b,to:c}];for(b=0;b<u.length;++b){c=u[b];for(var f=c.find(0),e=0;e<a.length;++e){var g=a[e];if(!(0>O(g.to,f.from)||0<O(g.from,f.to))){var z=[e,1],k=O(g.from,f.from),m=O(g.to,f.to);(0>k||!c.inclusiveLeft&&!k)&&z.push({from:g.from,to:f.from});(0<m||!c.inclusiveRight&&!m)&&z.push({from:f.to,to:g.to});a.splice.apply(a,
z);e+=z.length-3}}}return a}function Wd(a){var b=a.markedSpans;if(b){for(var c=0;c<b.length;++c)b[c].marker.detachLine(a);a.markedSpans=null}}function rb(a,b){if(b){for(var c=0;c<b.length;++c)b[c].marker.attachLine(a);a.markedSpans=b}}function ab(a,b){var c=a.lines.length-b.lines.length;if(0!=c)return c;c=a.find();var d=b.find(),u=O(c.from,d.from)||(a.inclusiveLeft?-1:0)-(b.inclusiveLeft?-1:0);return u?-u:(c=O(c.to,d.to)||(a.inclusiveRight?1:0)-(b.inclusiveRight?1:0))?c:b.id-a.id}function Ma(a,b){a=
Va&&a.markedSpans;if(a)for(var c,d=0;d<a.length;++d)if(c=a[d],c.marker.collapsed&&null==(b?c.from:c.to)&&(!u||0>ab(u,c.marker)))var u=c.marker;return u}function Xd(a,b,c,d,f){a=K(a,b);if(a=Va&&a.markedSpans)for(b=0;b<a.length;++b){var u=a[b];if(u.marker.collapsed){var e=u.marker.find(0),g=O(e.from,c)||(u.marker.inclusiveLeft?-1:0)-(f.inclusiveLeft?-1:0),z=O(e.to,d)||(u.marker.inclusiveRight?1:0)-(f.inclusiveRight?1:0);if(!(0<=g&&0>=z||0>=g&&0<=z)&&(0>=g&&(u.marker.inclusiveRight&&f.inclusiveLeft?
0<=O(e.to,c):0<O(e.to,c))||0<=g&&(u.marker.inclusiveRight&&f.inclusiveLeft?0>=O(e.from,d):0>O(e.from,d))))return!0}}}function Aa(a){for(var b;b=Ma(a,!0);)a=b.find(-1,!0).line;return a}function Xc(a,b){a=K(a,b);var c=Aa(a);return a==c?b:L(c)}function Yd(a,b){if(b>a.lastLine())return b;var c=K(a,b);if(!bb(a,c))return b;for(;a=Ma(c,!1);)c=a.find(1,!0).line;return L(c)+1}function bb(a,b){var c=Va&&b.markedSpans;if(c)for(var d,u=0;u<c.length;++u)if(d=c[u],d.marker.collapsed&&(null==d.from||!d.marker.widgetNode&&
0==d.from&&d.marker.inclusiveLeft&&Yc(a,b,d)))return!0}function Yc(a,b,c){if(null==c.to)return b=c.marker.find(1,!0),Yc(a,b.line,Ba(b.line.markedSpans,c.marker));if(c.marker.inclusiveRight&&c.to==b.text.length)return!0;for(var d,u=0;u<b.markedSpans.length;++u)if(d=b.markedSpans[u],d.marker.collapsed&&!d.marker.widgetNode&&d.from==c.to&&(null==d.to||d.to!=c.from)&&(d.marker.inclusiveLeft||c.marker.inclusiveRight)&&Yc(a,b,d))return!0}function Ia(a){a=Aa(a);for(var b=0,c=a.parent,d=0;d<c.lines.length;++d){var u=
c.lines[d];if(u==a)break;else b+=u.height}for(a=c.parent;a;c=a,a=c.parent)for(d=0;d<a.children.length&&(u=a.children[d],u!=c);++d)b+=u.height;return b}function vc(a){if(0==a.height)return 0;for(var b=a.text.length,c,d=a;c=Ma(d,!0);)c=c.find(0,!0),d=c.from.line,b+=c.from.ch-c.to.ch;for(d=a;c=Ma(d,!1);)a=c.find(0,!0),b-=d.text.length-a.from.ch,d=a.to.line,b+=d.text.length-a.to.ch;return b}function Zc(a){var b=a.display;a=a.doc;b.maxLine=K(a,a.first);b.maxLineLength=vc(b.maxLine);b.maxLineChanged=!0;
a.iter(function(a){var c=vc(a);c>b.maxLineLength&&(b.maxLineLength=c,b.maxLine=a)})}function Zd(a,b,c,d){if(!a)return d(b,c,"ltr",0);for(var u=!1,f=0;f<a.length;++f){var e=a[f];if(e.from<c&&e.to>b||b==c&&e.to==b)d(Math.max(e.from,b),Math.min(e.to,c),1==e.level?"rtl":"ltr",f),u=!0}u||d(b,c,"ltr")}function Jb(a,b,c){var d;Lb=null;for(var u=0;u<a.length;++u){var f=a[u];if(f.from<b&&f.to>b)return u;f.to==b&&(f.from!=f.to&&"before"==c?d=u:Lb=u);f.from==b&&(f.from!=f.to&&"before"!=c?d=u:Lb=u)}return null!=
d?d:Lb}function Pa(a,b){var c=a.order;null==c&&(c=a.order=dg(a.text,b));return c}function xa(a,b,c){if(a.removeEventListener)a.removeEventListener(b,c,!1);else if(a.detachEvent)a.detachEvent("on"+b,c);else{var u=(a=a._handlers)&&a[b];u&&(c=d(u,c),-1<c&&(a[b]=u.slice(0,c).concat(u.slice(c+1))))}}function fa(a,b){var c=a._handlers&&a._handlers[b]||xc;if(c.length)for(var d=Array.prototype.slice.call(arguments,2),u=0;u<c.length;++u)c[u].apply(null,d)}function ja(a,b,c){"string"==typeof b&&(b={type:b,
preventDefault:function(){this.defaultPrevented=!0}});fa(a,c||b.type,a,b);return $c(b)||b.codemirrorIgnore}function ae(a){var b=a._handlers&&a._handlers.cursorActivity;if(b){a=a.curOp.cursorActivityHandlers||(a.curOp.cursorActivityHandlers=[]);for(var c=0;c<b.length;++c)-1==d(a,b[c])&&a.push(b[c])}}function Ca(a,b){return 0<(a._handlers&&a._handlers[b]||xc).length}function sb(a){a.prototype.on=function(a,b){R(this,a,b)};a.prototype.off=function(a,b){xa(this,a,b)}}function qa(a){a.preventDefault?a.preventDefault():
a.returnValue=!1}function be(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0}function $c(a){return null!=a.defaultPrevented?a.defaultPrevented:0==a.returnValue}function Mb(a){qa(a);be(a)}function ce(a){var b=a.which;null==b&&(a.button&1?b=1:a.button&2?b=3:a.button&4&&(b=2));Da&&a.ctrlKey&&1==b&&(b=3);return b}function eg(b){if(null==ad){var c=a("span","\u200b");r(b,a("span",[c,document.createTextNode("x")]));0!=b.firstChild.offsetHeight&&(ad=1>=c.offsetWidth&&2<c.offsetHeight&&!(W&&8>ba))}b=
ad?a("span","\u200b"):a("span","\u00a0",null,"display: inline-block; width: 1px; margin-right: -1px");b.setAttribute("cm-text","");return b}function fg(a,b){2<arguments.length&&(b.dependencies=Array.prototype.slice.call(arguments,2));bd[a]=b}function yc(a){if("string"==typeof a&&tb.hasOwnProperty(a))a=tb[a];else if(a&&"string"==typeof a.name&&tb.hasOwnProperty(a.name)){var b=tb[a.name];"string"==typeof b&&(b={name:b});a=y(b,a);a.name=b.name}else{if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+xml$/.test(a))return yc("application/xml");
if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+json$/.test(a))return yc("application/json")}return"string"==typeof a?{name:a}:a||{name:"null"}}function cd(a,b){b=yc(b);var c=bd[b.name];if(!c)return cd(a,"text/plain");a=c(a,b);if(ub.hasOwnProperty(b.name)){c=ub[b.name];for(var d in c)c.hasOwnProperty(d)&&(a.hasOwnProperty(d)&&(a["_"+d]=a[d]),a[d]=c[d])}a.name=b.name;b.helperType&&(a.helperType=b.helperType);if(b.modeProps)for(var u in b.modeProps)a[u]=b.modeProps[u];return a}function gg(a,b){a=ub.hasOwnProperty(a)?
ub[a]:ub[a]={};m(b,a)}function cb(a,b){if(!0===b)return b;if(a.copyState)return a.copyState(b);a={};for(var c in b){var d=b[c];d instanceof Array&&(d=d.concat([]));a[c]=d}return a}function dd(a,b){for(var c;a.innerMode;){c=a.innerMode(b);if(!c||c.mode==a)break;b=c.state;a=c.mode}return c||{mode:a,state:b}}function de(a,b,c){return a.startState?a.startState(b,c):!0}function ee(a,b,c,d){var u=[a.state.modeGen],f={};fe(a,b.text,a.doc.mode,c,function(a,b){return u.push(a,b)},f,d);var e=c.state;d=function(d){c.baseTokens=
u;var g=a.state.overlays[d],z=1,k=0;c.state=!0;fe(a,b.text,g.mode,c,function(a,b){for(var c=z;k<a;){var d=u[z];d>a&&u.splice(z,1,a,u[z+1],d);z+=2;k=Math.min(a,d)}if(b)if(g.opaque)u.splice(c,z-c,a,"overlay "+b),z=c+2;else for(;c<z;c+=2)a=u[c+1],u[c+1]=(a?a+" ":"")+"overlay "+b},f);c.state=e;c.baseTokens=null;c.baseTokenPos=1};for(var g=0;g<a.state.overlays.length;++g)d(g);return{styles:u,classes:f.bgClass||f.textClass?f:null}}function ge(a,b,c){if(!b.styles||b.styles[0]!=a.state.modeGen){var d=Nb(a,
L(b)),u=b.text.length>a.options.maxHighlightLength&&cb(a.doc.mode,d.state),f=ee(a,b,d);u&&(d.state=u);b.stateAfter=d.save(!u);b.styles=f.styles;f.classes?b.styleClasses=f.classes:b.styleClasses&&(b.styleClasses=null);c===a.doc.highlightFrontier&&(a.doc.modeFrontier=Math.max(a.doc.modeFrontier,++a.doc.highlightFrontier))}return b.styles}function Nb(a,b,c){var d=a.doc,u=a.display;if(!d.mode.startState)return new Ja(d,!0,b);var f=hg(a,b,c),e=f>d.first&&K(d,f-1).stateAfter,g=e?Ja.fromSaved(d,e,f):new Ja(d,
de(d.mode),f);d.iter(f,b,function(c){ed(a,c.text,g);var d=g.line;c.stateAfter=d==b-1||0==d%5||d>=u.viewFrom&&d<u.viewTo?g.save():null;g.nextLine()});c&&(d.modeFrontier=g.line);return g}function ed(a,b,c,d){var u=a.doc.mode;a=new ha(b,a.options.tabSize,c);a.start=a.pos=d||0;for(""==b&&he(u,c.state);!a.eol();)fd(u,a,c.state),a.start=a.pos}function he(a,b){if(a.blankLine)return a.blankLine(b);if(a.innerMode&&(a=dd(a,b),a.mode.blankLine))return a.mode.blankLine(a.state)}function fd(a,b,c,d){for(var u=
0;10>u;u++){d&&(d[0]=dd(a,c).mode);var f=a.token(b,c);if(b.pos>b.start)return f}throw Error("Mode "+a.name+" failed to advance stream.");}function ie(a,b,c,d){var u=a.doc,f=u.mode;b=N(u,b);var e=K(u,b.line);c=Nb(a,b.line,c);a=new ha(e.text,a.options.tabSize,c);var g;for(d&&(g=[]);(d||a.pos<b.ch)&&!a.eol();){a.start=a.pos;var z=fd(f,a,c.state);d&&g.push(new je(a,z,cb(u.mode,c.state)))}return d?g:new je(a,z,c.state)}function ke(a,b){if(a)for(;;){var c=a.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!c)break;
a=a.slice(0,c.index)+a.slice(c.index+c[0].length);var d=c[1]?"bgClass":"textClass";null==b[d]?b[d]=c[2]:(new RegExp("(?:^|s)"+c[2]+"(?:$|s)")).test(b[d])||(b[d]+=" "+c[2])}return a}function fe(a,b,c,d,f,e,g){var u=c.flattenSpans;null==u&&(u=a.options.flattenSpans);var z=0,k=null,m=new ha(b,a.options.tabSize,d),l=a.options.addModeClass&&[null];for(""==b&&ke(he(c,d.state),e);!m.eol();){if(m.pos>a.options.maxHighlightLength){u=!1;g&&ed(a,b,d,m.pos);m.pos=b.length;var q=null}else q=ke(fd(c,m,d.state,
l),e);if(l){var U=l[0].name;U&&(q="m-"+(q?U+" "+q:U))}if(!u||k!=q){for(;z<m.start;)z=Math.min(m.start,z+5E3),f(z,k);k=q}m.start=m.pos}for(;z<m.pos;)a=Math.min(m.pos,z+5E3),f(a,k),z=a}function hg(a,b,c){for(var d,u,f=a.doc,e=c?-1:b-(a.doc.mode.innerMode?1E3:100);b>e;--b){if(b<=f.first)return f.first;var z=K(f,b-1),k=z.stateAfter;if(k&&(!c||b+(k instanceof zc?k.lookAhead:0)<=f.modeFrontier))return b;z=g(z.text,null,a.options.tabSize);if(null==u||d>z)u=b-1,d=z}return u}function ig(a,b){a.modeFrontier=
Math.min(a.modeFrontier,b);if(!(a.highlightFrontier<b-10)){for(var c=a.first,d=b-1;d>c;d--){var u=K(a,d).stateAfter;if(u&&(!(u instanceof zc)||d+u.lookAhead<b)){c=d+1;break}}a.highlightFrontier=Math.min(a.highlightFrontier,c)}}function le(a,b){if(!a||/^\s*$/.test(a))return null;b=b.addModeClass?jg:kg;return b[a]||(b[a]=a.replace(/\S+/g,"cm-$&"))}function me(a,c){var d=b("span",null,null,pa?"padding-right: .1px":null);d={pre:b("pre",[d],"CodeMirror-line"),content:d,col:0,pos:0,cm:a,trailingSpace:!1,
splitSpaces:(W||pa)&&a.getOption("lineWrapping")};c.measure={};for(var u=0;u<=(c.rest?c.rest.length:0);u++){var f=u?c.rest[u-1]:c.line,g=void 0;d.pos=0;d.addToken=lg;var z=a.display.measure;if(null!=gd)z=gd;else{var k=r(z,document.createTextNode("A\u062eA")),m=Ob(k,0,1).getBoundingClientRect();k=Ob(k,1,2).getBoundingClientRect();e(z);z=m&&m.left!=m.right?gd=3>k.right-m.right:!1}z&&(g=Pa(f,a.doc.direction))&&(d.addToken=mg(d.addToken,g));d.map=[];var l=c!=a.display.externalMeasured&&L(f);a:{var q=
k=m=z=void 0,h=void 0,w=void 0,p=void 0;g=d;l=ge(a,f,l);var n=f.markedSpans,v=f.text,x=0;if(n)for(var B=v.length,A=0,y=1,G="",H=0;;){if(H==A){h=q=k=m=w="";z=null;H=Infinity;for(var D=[],E=void 0,C=0;C<n.length;++C){var I=n[C],F=I.marker;"bookmark"==F.type&&I.from==A&&F.widgetNode?D.push(F):I.from<=A&&(null==I.to||I.to>A||F.collapsed&&I.to==A&&I.from==A)?(null!=I.to&&I.to!=A&&H>I.to&&(H=I.to,q=""),F.className&&(h+=" "+F.className),F.css&&(w=(w?w+";":"")+F.css),F.startStyle&&I.from==A&&(k+=" "+F.startStyle),
F.endStyle&&I.to==H&&(E||(E=[])).push(F.endStyle,I.to),F.title&&!m&&(m=F.title),F.collapsed&&(!z||0>ab(z.marker,F))&&(z=I)):I.from>A&&H>I.from&&(H=I.from)}if(E)for(C=0;C<E.length;C+=2)E[C+1]==H&&(q+=" "+E[C]);if(!z||z.from==A)for(E=0;E<D.length;++E)ne(g,0,D[E]);if(z&&(z.from||0)==A){ne(g,(null==z.to?B+1:z.to)-A,z.marker,null==z.from);if(null==z.to)break a;z.to==A&&(z=!1)}}if(A>=B)break;for(D=Math.min(B,H);;){if(G){E=A+G.length;z||(C=E>D?G.slice(0,D-A):G,g.addToken(g,C,p?p+h:h,k,A+C.length==H?q:"",
m,w));if(E>=D){G=G.slice(D-A);A=D;break}A=E;k=""}G=v.slice(x,x=l[y++]);p=le(l[y++],g.cm.options)}}else for(z=1;z<l.length;z+=2)g.addToken(g,v.slice(x,x=l[z]),le(l[z+1],g.cm.options))}f.styleClasses&&(f.styleClasses.bgClass&&(d.bgClass=t(f.styleClasses.bgClass,d.bgClass||"")),f.styleClasses.textClass&&(d.textClass=t(f.styleClasses.textClass,d.textClass||"")));0==d.map.length&&d.map.push(0,0,d.content.appendChild(eg(a.display.measure)));0==u?(c.measure.map=d.map,c.measure.cache={}):((c.measure.maps||
(c.measure.maps=[])).push(d.map),(c.measure.caches||(c.measure.caches=[])).push({}))}pa&&(u=d.content.lastChild,/\bcm-tab\b/.test(u.className)||u.querySelector&&u.querySelector(".cm-tab"))&&(d.content.className="cm-tab-wrap-hack");fa(a,"renderLine",a,c.line,d.pre);d.pre.className&&(d.textClass=t(d.pre.className,d.textClass||""));return d}function ng(b){var c=a("span","\u2022","cm-invalidchar");c.title="\\u"+b.charCodeAt(0).toString(16);c.setAttribute("aria-label",c.title);return c}function lg(b,c,
d,f,e,g,m){if(c){if(b.splitSpaces){var u=b.trailingSpace;if(1<c.length&&!/  /.test(c))u=c;else{for(var z="",l=0;l<c.length;l++){var q=c.charAt(l);" "!=q||!u||l!=c.length-1&&32!=c.charCodeAt(l+1)||(q="\u00a0");z+=q;u=" "==q}u=z}}else u=c;z=u;l=b.cm.state.specialChars;q=!1;if(l.test(c)){u=document.createDocumentFragment();for(var U=0;;){l.lastIndex=U;var Y=l.exec(c),h=Y?Y.index-U:c.length-U;if(h){var ma=document.createTextNode(z.slice(U,U+h));W&&9>ba?u.appendChild(a("span",[ma])):u.appendChild(ma);
b.map.push(b.pos,b.pos+h,ma);b.col+=h;b.pos+=h}if(!Y)break;U+=h+1;"\t"==Y[0]?(Y=b.cm.options.tabSize,Y-=b.col%Y,h=u.appendChild(a("span",k(Y),"cm-tab")),h.setAttribute("role","presentation"),h.setAttribute("cm-text","\t"),b.col+=Y):("\r"==Y[0]||"\n"==Y[0]?(h=u.appendChild(a("span","\r"==Y[0]?"\u240d":"\u2424","cm-invalidchar")),h.setAttribute("cm-text",Y[0])):(h=b.cm.options.specialCharPlaceholder(Y[0]),h.setAttribute("cm-text",Y[0]),W&&9>ba?u.appendChild(a("span",[h])):u.appendChild(h)),b.col+=1);
b.map.push(b.pos,b.pos+1,h);b.pos++}}else b.col+=c.length,u=document.createTextNode(z),b.map.push(b.pos,b.pos+c.length,u),W&&9>ba&&(q=!0),b.pos+=c.length;b.trailingSpace=32==z.charCodeAt(c.length-1);if(d||f||e||q||m)return c=d||"",f&&(c+=f),e&&(c+=e),f=a("span",[u],c,m),g&&(f.title=g),b.content.appendChild(f);b.content.appendChild(u)}}function mg(a,b){return function(c,d,u,f,e,g,z){u=u?u+" cm-force-border":"cm-force-border";for(var k=c.pos,m=k+d.length;;){for(var l=void 0,q=0;q<b.length&&!(l=b[q],
l.to>k&&l.from<=k);q++);if(l.to>=m)return a(c,d,u,f,e,g,z);a(c,d.slice(0,l.to-k),u,f,null,g,z);f=null;d=d.slice(l.to-k);k=l.to}}}function ne(a,b,c,d){var u=!d&&c.widgetNode;u&&a.map.push(a.pos,a.pos+b,u);!d&&a.cm.display.input.needsContentAttribute&&(u||(u=a.content.appendChild(document.createElement("span"))),u.setAttribute("cm-marker",c.id));u&&(a.cm.display.input.setUneditable(u),a.content.appendChild(u));a.pos+=b;a.trailingSpace=!1}function oe(a,b,c){for(var d=this.line=b,u;d=Ma(d,!1);)d=d.find(1,
!0).line,(u||(u=[])).push(d);this.size=(this.rest=u)?L(n(this.rest))-c+1:1;this.node=this.text=null;this.hidden=bb(a,b)}function Ac(a,b,c){var d=[],u;for(u=b;u<c;)b=new oe(a.doc,K(a.doc,u),u),u+=b.size,d.push(b);return d}function og(a,b){if(a=a.ownsGroup)try{var c=a.delayedCallbacks,d=0;do{for(;d<c.length;d++)c[d].call(null);for(var u=0;u<a.ops.length;u++){var f=a.ops[u];if(f.cursorActivityHandlers)for(;f.cursorActivityCalled<f.cursorActivityHandlers.length;)f.cursorActivityHandlers[f.cursorActivityCalled++].call(null,
f.cm)}}while(d<c.length)}finally{vb=null,b(a)}}function na(a,b){var c=a._handlers&&a._handlers[b]||xc;if(c.length){var d=Array.prototype.slice.call(arguments,2);if(vb)var u=vb.delayedCallbacks;else Pb?u=Pb:(u=Pb=[],setTimeout(pg,0));for(var f=function(a){u.push(function(){return c[a].apply(null,d)})},e=0;e<c.length;++e)f(e)}}function pg(){var a=Pb;Pb=null;for(var b=0;b<a.length;++b)a[b]()}function pe(a,b,c,d){for(var u=0;u<b.changes.length;u++){var f=b.changes[u];if("text"==f){f=a;var e=b,g=e.text.className,
z=qe(f,e);e.text==e.node&&(e.node=z.pre);e.text.parentNode.replaceChild(z.pre,e.text);e.text=z.pre;z.bgClass!=e.bgClass||z.textClass!=e.textClass?(e.bgClass=z.bgClass,e.textClass=z.textClass,hd(f,e)):g&&(e.text.className=g)}else if("gutter"==f)re(a,b,c,d);else if("class"==f)hd(a,b);else if("widget"==f){f=a;e=b;g=d;e.alignable&&(e.alignable=null);z=e.node.firstChild;for(var k;z;z=k)k=z.nextSibling,"CodeMirror-linewidget"==z.className&&e.node.removeChild(z);se(f,e,g)}}b.changes=null}function Qb(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),W&&8>ba&&(b.node.style.zIndex=2));return b.node}function qe(a,b){var c=a.display.externalMeasured;return c&&c.line==b.line?(a.display.externalMeasured=null,b.measure=c.measure,c.built):me(a,b)}function hd(b,c){var d=c.bgClass?c.bgClass+" "+(c.line.bgClass||""):c.line.bgClass;d&&(d+=" CodeMirror-linebackground");if(c.background)d?c.background.className=
d:(c.background.parentNode.removeChild(c.background),c.background=null);else if(d){var u=Qb(c);c.background=u.insertBefore(a("div",null,d),u.firstChild);b.display.input.setUneditable(c.background)}c.line.wrapClass?Qb(c).className=c.line.wrapClass:c.node!=c.text&&(c.node.className="");c.text.className=(c.textClass?c.textClass+" "+(c.line.textClass||""):c.line.textClass)||""}function re(b,c,d,f){c.gutter&&(c.node.removeChild(c.gutter),c.gutter=null);c.gutterBackground&&(c.node.removeChild(c.gutterBackground),
c.gutterBackground=null);if(c.line.gutterClass){var u=Qb(c);c.gutterBackground=a("div",null,"CodeMirror-gutter-background "+c.line.gutterClass,"left: "+(b.options.fixedGutter?f.fixedPos:-f.gutterTotalWidth)+"px; width: "+f.gutterTotalWidth+"px");b.display.input.setUneditable(c.gutterBackground);u.insertBefore(c.gutterBackground,c.text)}u=c.line.gutterMarkers;if(b.options.lineNumbers||u){var e=Qb(c),g=c.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(b.options.fixedGutter?f.fixedPos:-f.gutterTotalWidth)+
"px");b.display.input.setUneditable(g);e.insertBefore(g,c.text);c.line.gutterClass&&(g.className+=" "+c.line.gutterClass);!b.options.lineNumbers||u&&u["CodeMirror-linenumbers"]||(c.lineNumber=g.appendChild(a("div",da(b.options,d),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+f.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+b.display.lineNumInnerWidth+"px")));if(u)for(c=0;c<b.options.gutters.length;++c)d=b.options.gutters[c],(e=u.hasOwnProperty(d)&&u[d])&&g.appendChild(a("div",[e],"CodeMirror-gutter-elt",
"left: "+f.gutterLeft[d]+"px; width: "+f.gutterWidth[d]+"px"))}}function qg(a,b,c,d){var u=qe(a,b);b.text=b.node=u.pre;u.bgClass&&(b.bgClass=u.bgClass);u.textClass&&(b.textClass=u.textClass);hd(a,b);re(a,b,c,d);se(a,b,d);return b.node}function se(a,b,c){te(a,b.line,b,c,!0);if(b.rest)for(var d=0;d<b.rest.length;d++)te(a,b.rest[d],b,c,!1)}function te(b,c,d,f,e){if(c.widgets){var u=Qb(d),g=0;for(c=c.widgets;g<c.length;++g){var z=c[g],k=a("div",[z.node],"CodeMirror-linewidget");z.handleMouseEvents||k.setAttribute("cm-ignore-events",
"true");var m=z,l=k,q=f;if(m.noHScroll){(d.alignable||(d.alignable=[])).push(l);var U=q.wrapperWidth;l.style.left=q.fixedPos+"px";m.coverGutter||(U-=q.gutterTotalWidth,l.style.paddingLeft=q.gutterTotalWidth+"px");l.style.width=U+"px"}m.coverGutter&&(l.style.zIndex=5,l.style.position="relative",m.noHScroll||(l.style.marginLeft=-q.gutterTotalWidth+"px"));b.display.input.setUneditable(k);e&&z.above?u.insertBefore(k,d.gutter||d.text):u.appendChild(k);na(z,"redraw")}}}function Rb(b){if(null!=b.height)return b.height;
var c=b.doc.cm;if(!c)return 0;if(!l(document.body,b.node)){var d="position: relative;";b.coverGutter&&(d+="margin-left: -"+c.display.gutters.offsetWidth+"px;");b.noHScroll&&(d+="width: "+c.display.wrapper.clientWidth+"px;");r(c.display.measure,a("div",[b.node],null,d))}return b.height=b.node.parentNode.offsetHeight}function Qa(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 id(a){return a.mover.offsetHeight-
a.lineSpace.offsetHeight}function ue(b){if(b.cachedPaddingH)return b.cachedPaddingH;var c=r(b.measure,a("pre","x"));c=window.getComputedStyle?window.getComputedStyle(c):c.currentStyle;c={left:parseInt(c.paddingLeft),right:parseInt(c.paddingRight)};isNaN(c.left)||isNaN(c.right)||(b.cachedPaddingH=c);return c}function Ka(a){return 30-a.display.nativeBarWidth}function db(a){return a.display.scroller.clientWidth-Ka(a)-a.display.barWidth}function jd(a){return a.display.scroller.clientHeight-Ka(a)-a.display.barHeight}
function ve(a,b,c){if(a.line==b)return{map:a.measure.map,cache:a.measure.cache};for(var d=0;d<a.rest.length;d++)if(a.rest[d]==b)return{map:a.measure.maps[d],cache:a.measure.caches[d]};for(b=0;b<a.rest.length;b++)if(L(a.rest[b])>c)return{map:a.measure.maps[b],cache:a.measure.caches[b],before:!0}}function kd(a,b){if(b>=a.display.viewFrom&&b<a.display.viewTo)return a.display.view[eb(a,b)];if((a=a.display.externalMeasured)&&b>=a.lineN&&b<a.lineN+a.size)return a}function fb(a,b){var c=L(b),d=kd(a,c);d&&
!d.text?d=null:d&&d.changes&&(pe(a,d,c,ld(a)),a.curOp.forceUpdate=!0);if(!d){var u=Aa(b);d=L(u);u=a.display.externalMeasured=new oe(a.doc,u,d);u.lineN=d;d=u.built=me(a,u);u.text=d.pre;r(a.display.lineMeasure,d.pre);d=u}a=ve(d,b,c);return{line:b,view:d,rect:null,map:a.map,cache:a.cache,before:a.before,hasHeights:!1}}function Ea(b,c,d,f,e){c.before&&(d=-1);var u=d+(f||"");if(c.cache.hasOwnProperty(u))b=c.cache[u];else{c.rect||(c.rect=c.view.text.getBoundingClientRect());if(!c.hasHeights){var g=c.view,
z=c.rect,k=b.options.lineWrapping,m=k&&db(b);if(!g.measure.heights||k&&g.measure.width!=m){var l=g.measure.heights=[];if(k)for(g.measure.width=m,g=g.text.firstChild.getClientRects(),k=0;k<g.length-1;k++){m=g[k];var q=g[k+1];2<Math.abs(m.bottom-q.bottom)&&l.push((m.bottom+q.top)/2-z.top)}l.push(z.bottom-z.top)}c.hasHeights=!0}l=f;g=we(c.map,d,l);f=g.node;z=g.start;k=g.end;d=g.collapse;if(3==f.nodeType){for(var U=0;4>U;U++){for(;z&&D(c.line.text.charAt(g.coverStart+z));)--z;for(;g.coverStart+k<g.coverEnd&&
D(c.line.text.charAt(g.coverStart+k));)++k;if(W&&9>ba&&0==z&&k==g.coverEnd-g.coverStart)var h=f.parentNode.getBoundingClientRect();else{h=Ob(f,z,k).getClientRects();k=xe;if("left"==l)for(m=0;m<h.length&&(k=h[m]).left==k.right;m++);else for(m=h.length-1;0<=m&&(k=h[m]).left==k.right;m--);h=k}if(h.left||h.right||0==z)break;k=z;--z;d="right"}W&&11>ba&&((U=!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI)||(null!=md?U=md:(l=r(b.display.measure,a("span","x")),U=l.getBoundingClientRect(),
l=Ob(l,0,1).getBoundingClientRect(),U=md=1<Math.abs(U.left-l.left)),U=!U),U||(U=screen.logicalXDPI/screen.deviceXDPI,l=screen.logicalYDPI/screen.deviceYDPI,h={left:h.left*U,right:h.right*U,top:h.top*l,bottom:h.bottom*l}))}else 0<z&&(d=l="right"),h=b.options.lineWrapping&&1<(U=f.getClientRects()).length?U["right"==l?U.length-1:0]:f.getBoundingClientRect();!(W&&9>ba)||z||h&&(h.left||h.right)||(h=(h=f.parentNode.getClientRects()[0])?{left:h.left,right:h.left+Sb(b.display),top:h.top,bottom:h.bottom}:
xe);f=h.top-c.rect.top;z=h.bottom-c.rect.top;U=(f+z)/2;l=c.view.measure.heights;for(g=0;g<l.length-1&&!(U<l[g]);g++);d={left:("right"==d?h.right:h.left)-c.rect.left,right:("left"==d?h.left:h.right)-c.rect.left,top:g?l[g-1]:0,bottom:l[g]};h.left||h.right||(d.bogus=!0);b.options.singleCursorHeightPerLine||(d.rtop=f,d.rbottom=z);b=d;b.bogus||(c.cache[u]=b)}return{left:b.left,right:b.right,top:e?b.rtop:b.top,bottom:e?b.rbottom:b.bottom}}function we(a,b,c){for(var d,f,u,e,g,z,k=0;k<a.length;k+=3){g=a[k];
z=a[k+1];if(b<g)f=0,u=1,e="left";else if(b<z)f=b-g,u=f+1;else if(k==a.length-3||b==z&&a[k+3]>b)u=z-g,f=u-1,b>=z&&(e="right");if(null!=f){d=a[k+2];g==z&&c==(d.insertLeft?"left":"right")&&(e=c);if("left"==c&&0==f)for(;k&&a[k-2]==a[k-3]&&a[k-1].insertLeft;)d=a[(k-=3)+2],e="left";if("right"==c&&f==z-g)for(;k<a.length-3&&a[k+3]==a[k+4]&&!a[k+5].insertLeft;)d=a[(k+=3)+2],e="right";break}}return{node:d,start:f,end:u,collapse:e,coverStart:g,coverEnd:z}}function ye(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 ze(a){a.display.externalMeasure=null;e(a.display.lineMeasure);for(var b=0;b<a.display.view.length;b++)ye(a.display.view[b])}function Tb(a){ze(a);a.display.cachedCharWidth=a.display.cachedTextHeight=a.display.cachedPaddingH=null;a.options.lineWrapping||(a.display.maxLineChanged=!0);a.display.lineNumChars=null}function Ae(){return Bc&&Cc?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):
window.pageXOffset||(document.documentElement||document.body).scrollLeft}function Be(){return Bc&&Cc?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function nd(a){var b=0;if(a.widgets)for(var c=0;c<a.widgets.length;++c)a.widgets[c].above&&(b+=Rb(a.widgets[c]));return b}function Dc(a,b,c,d,f){f||(f=nd(b),c.top+=f,c.bottom+=f);if("line"==d)return c;d||(d="local");b=Ia(b);b="local"==
d?b+a.display.lineSpace.offsetTop:b-a.display.viewOffset;if("page"==d||"window"==d)a=a.display.lineSpace.getBoundingClientRect(),b+=a.top+("window"==d?0:Be()),d=a.left+("window"==d?0:Ae()),c.left+=d,c.right+=d;c.top+=b;c.bottom+=b;return c}function Ce(a,b,c){if("div"==c)return b;var d=b.left;b=b.top;"page"==c?(d-=Ae(),b-=Be()):"local"!=c&&c||(c=a.display.sizer.getBoundingClientRect(),d+=c.left,b+=c.top);a=a.display.lineSpace.getBoundingClientRect();return{left:d-a.left,top:b-a.top}}function od(a,
b,c,d,f){d||(d=K(a.doc,b.line));var u=d;b=b.ch;d=Ea(a,fb(a,d),b,f);return Dc(a,u,d,c)}function Fa(a,b,c,d,f,e){function u(b,u){b=Ea(a,f,b,u?"right":"left",e);u?b.left=b.right:b.right=b.left;return Dc(a,d,b,c)}function g(a,b,c){return u(c?a-1:a,1==z[b].level!=c)}d=d||K(a.doc,b.line);f||(f=fb(a,d));var z=Pa(d,a.doc.direction),k=b.ch;b=b.sticky;k>=d.text.length?(k=d.text.length,b="before"):0>=k&&(k=0,b="after");if(!z)return u("before"==b?k-1:k,"before"==b);var m=Jb(z,k,b),l=Lb;m=g(k,m,"before"==b);null!=
l&&(m.other=g(k,l,"before"!=b));return m}function De(a,b){var c=0;b=N(a.doc,b);a.options.lineWrapping||(c=Sb(a.display)*b.ch);b=K(a.doc,b.line);a=Ia(b)+a.display.lineSpace.offsetTop;return{left:c,right:c,top:a,bottom:a+b.height}}function pd(a,b,c,d,f){a=J(a,b,c);a.xRel=f;d&&(a.outside=!0);return a}function qd(a,b,c){var d=a.doc;c+=a.display.viewOffset;if(0>c)return pd(d.first,0,null,!0,-1);var f=Q(d,c),u=d.first+d.size-1;if(f>u)return pd(d.first+d.size-1,K(d,u).text.length,null,!0,1);0>b&&(b=0);for(d=
K(d,f);;)if(f=rg(a,d,f,b,c),u=(d=Ma(d,!1))&&d.find(0,!0),d&&(f.ch>u.from.ch||f.ch==u.from.ch&&0<f.xRel))f=L(d=u.to.line);else return f}function Ee(a,b,c,d){d-=nd(b);b=b.text.length;var f=F(function(b){return Ea(a,c,b-1).bottom<=d},b,0);b=F(function(b){return Ea(a,c,b).top>d},f,b);return{begin:f,end:b}}function Fe(a,b,c,d){c||(c=fb(a,b));d=Dc(a,b,Ea(a,c,d),"line").top;return Ee(a,b,c,d)}function rd(a,b,c,d){return a.bottom<=c?!1:a.top>c?!0:(d?a.left:a.right)>b}function rg(a,b,c,d,f){f-=Ia(b);var u=
fb(a,b),e=nd(b),g=0,z=b.text.length,k=!0,m=Pa(b,a.doc.direction);m&&(m=(a.options.lineWrapping?sg:tg)(a,b,c,u,m,d,f),g=(k=1!=m.level)?m.from:m.to-1,z=k?m.to:m.from-1);var l=null,q=null;m=F(function(b){var c=Ea(a,u,b);c.top+=e;c.bottom+=e;if(!rd(c,d,f,!1))return!1;c.top<=f&&c.left<=d&&(l=b,q=c);return!0},g,z);var h=!1;q?(g=d-q.left<q.right-d,k=g==k,m=l+(k?0:1),k=k?"after":"before",g=g?q.left:q.right):(k||m!=z&&m!=g||m++,k=0==m?"after":m==b.text.length?"before":Ea(a,u,m-(k?1:0)).bottom+e<=f==k?"after":
"before",h=Fa(a,J(c,m,k),"line",b,u),g=h.left,h=f<h.top||f>=h.bottom);m=I(b.text,m,1);return pd(c,m,k,h,d-g)}function tg(a,b,c,d,f,e,g){var u=F(function(u){u=f[u];var k=1!=u.level;return rd(Fa(a,J(c,k?u.to:u.from,k?"before":"after"),"line",b,d),e,g,!0)},0,f.length-1),k=f[u];if(0<u){var z=1!=k.level;z=Fa(a,J(c,z?k.from:k.to,z?"after":"before"),"line",b,d);rd(z,e,g,!0)&&z.top>g&&(k=f[u-1])}return k}function sg(a,b,c,d,f,e,g){g=Ee(a,b,d,g);c=g.begin;g=g.end;/\s/.test(b.text.charAt(g-1))&&g--;for(var u=
b=null,k=0;k<f.length;k++){var z=f[k];if(!(z.from>=g||z.to<=c)){var m=Ea(a,d,1!=z.level?Math.min(g,z.to)-1:Math.max(c,z.from)).right;m=m<e?e-m+1E9:m-e;if(!b||u>m)b=z,u=m}}b||(b=f[f.length-1]);b.from<c&&(b={from:c,to:b.to,level:b.level});b.to>g&&(b={from:b.from,to:g,level:b.level});return b}function gb(b){if(null!=b.cachedTextHeight)return b.cachedTextHeight;if(null==hb){hb=a("pre");for(var c=0;49>c;++c)hb.appendChild(document.createTextNode("x")),hb.appendChild(a("br"));hb.appendChild(document.createTextNode("x"))}r(b.measure,
hb);c=hb.offsetHeight/50;3<c&&(b.cachedTextHeight=c);e(b.measure);return c||1}function Sb(b){if(null!=b.cachedCharWidth)return b.cachedCharWidth;var c=a("span","xxxxxxxxxx"),d=a("pre",[c]);r(b.measure,d);c=c.getBoundingClientRect();c=(c.right-c.left)/10;2<c&&(b.cachedCharWidth=c);return c||10}function ld(a){for(var b=a.display,c={},d={},f=b.gutters.clientLeft,u=b.gutters.firstChild,e=0;u;u=u.nextSibling,++e)c[a.options.gutters[e]]=u.offsetLeft+u.clientLeft+f,d[a.options.gutters[e]]=u.clientWidth;
return{fixedPos:sd(b),gutterTotalWidth:b.gutters.offsetWidth,gutterLeft:c,gutterWidth:d,wrapperWidth:b.wrapper.clientWidth}}function sd(a){return a.scroller.getBoundingClientRect().left-a.sizer.getBoundingClientRect().left}function Ge(a){var b=gb(a.display),c=a.options.lineWrapping,d=c&&Math.max(5,a.display.scroller.clientWidth/Sb(a.display)-3);return function(f){if(bb(a.doc,f))return 0;var e=0;if(f.widgets)for(var u=0;u<f.widgets.length;u++)f.widgets[u].height&&(e+=f.widgets[u].height);return c?
e+(Math.ceil(f.text.length/d)||1)*b:e+b}}function td(a){var b=a.doc,c=Ge(a);b.iter(function(a){var b=c(a);b!=a.height&&S(a,b)})}function ib(a,b,c,d){var f=a.display;if(!c&&"true"==(b.target||b.srcElement).getAttribute("cm-not-content"))return null;c=f.lineSpace.getBoundingClientRect();try{var e=b.clientX-c.left;var u=b.clientY-c.top}catch($d){return null}b=qd(a,e,u);var k;d&&1==b.xRel&&(k=K(a.doc,b.line).text).length==b.ch&&(d=g(k,k.length,a.options.tabSize)-k.length,b=J(b.line,Math.max(0,Math.round((e-
ue(a.display).left)/Sb(a.display))-d)));return b}function eb(a,b){if(b>=a.display.viewTo)return null;b-=a.display.viewFrom;if(0>b)return null;a=a.display.view;for(var c=0;c<a.length;c++)if(b-=a[c].size,0>b)return c}function Ub(a){a.display.input.showSelection(a.display.input.prepareSelection())}function He(a,b){void 0===b&&(b=!0);for(var c=a.doc,d={},f=d.cursors=document.createDocumentFragment(),e=d.selection=document.createDocumentFragment(),u=0;u<c.sel.ranges.length;u++)if(b||u!=c.sel.primIndex){var g=
c.sel.ranges[u];if(!(g.from().line>=a.display.viewTo||g.to().line<a.display.viewFrom)){var k=g.empty();(k||a.options.showCursorWhenSelecting)&&Ie(a,g.head,f);k||ug(a,g,e)}}return d}function Ie(b,c,d){c=Fa(b,c,"div",null,null,!b.options.singleCursorHeightPerLine);var f=d.appendChild(a("div","\u00a0","CodeMirror-cursor"));f.style.left=c.left+"px";f.style.top=c.top+"px";f.style.height=Math.max(0,c.bottom-c.top)*b.options.cursorHeight+"px";c.other&&(b=d.appendChild(a("div","\u00a0","CodeMirror-cursor CodeMirror-secondarycursor")),
b.style.display="",b.style.left=c.other.left+"px",b.style.top=c.other.top+"px",b.style.height=.85*(c.other.bottom-c.other.top)+"px")}function Ec(a,b){return a.top-b.top||a.left-b.left}function ug(b,c,d){function f(b,c,d,f){0>c&&(c=0);c=Math.round(c);f=Math.round(f);k.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+b+"px;\n                             top: "+c+"px; width: "+(null==d?l-b:d)+"px;\n                             height: "+(f-c)+"px"))}function e(a,c,d){function e(c,
d){return od(b,J(a,c),"div",k,d)}function u(a,c,d){a=Fe(b,k,null,a);c="ltr"==c==("after"==d)?"left":"right";d="after"==d?a.begin:a.end-(/\s/.test(k.text.charAt(a.end-1))?2:1);return e(d,c)[c]}var k=K(g,a),z=k.text.length,h,U,t=Pa(k,g.direction);Zd(t,c||0,null==d?z:d,function(a,b,g,k){var r="ltr"==g,Y=e(a,r?"left":"right"),ma=e(b-1,r?"right":"left"),w=null==c&&0==a,p=null==d&&b==z,n=0==k;k=!t||k==t.length-1;3>=ma.top-Y.top?(b=(q?w:p)&&n?m:(r?Y:ma).left,f(b,Y.top,((q?p:w)&&k?l:(r?ma:Y).right)-b,Y.bottom)):
(r?(r=q&&w&&n?m:Y.left,w=q?l:u(a,g,"before"),a=q?m:u(b,g,"after"),p=q&&p&&k?l:ma.right):(r=q?u(a,g,"before"):m,w=!q&&w&&n?l:Y.right,a=!q&&p&&k?m:ma.left,p=q?u(b,g,"after"):l),f(r,Y.top,w-r,Y.bottom),Y.bottom<ma.top&&f(m,Y.bottom,null,ma.top),f(a,ma.top,p-a,ma.bottom));if(!h||0>Ec(Y,h))h=Y;0>Ec(ma,h)&&(h=ma);if(!U||0>Ec(Y,U))U=Y;0>Ec(ma,U)&&(U=ma)});return{start:h,end:U}}var u=b.display,g=b.doc,k=document.createDocumentFragment(),z=ue(b.display),m=z.left,l=Math.max(u.sizerWidth,db(b)-u.sizer.offsetLeft)-
z.right,q="ltr"==g.direction;u=c.from();c=c.to();if(u.line==c.line)e(u.line,u.ch,c.ch);else{var h=K(g,u.line);z=K(g,c.line);z=Aa(h)==Aa(z);u=e(u.line,u.ch,z?h.text.length+1:null).end;c=e(c.line,z?0:null,c.ch).start;z&&(u.top<c.top-2?(f(u.right,u.top,null,u.bottom),f(m,c.top,c.left,c.bottom)):f(u.right,u.top,c.left-u.right,u.bottom));u.bottom<c.top&&f(m,u.bottom,null,c.top)}d.appendChild(k)}function ud(a){if(a.state.focused){var b=a.display;clearInterval(b.blinker);var c=!0;b.cursorDiv.style.visibility=
"";0<a.options.cursorBlinkRate?b.blinker=setInterval(function(){return b.cursorDiv.style.visibility=(c=!c)?"":"hidden"},a.options.cursorBlinkRate):0>a.options.cursorBlinkRate&&(b.cursorDiv.style.visibility="hidden")}}function Je(a){a.state.focused||(a.display.input.focus(),vd(a))}function Ke(a){a.state.delayingBlurEvent=!0;setTimeout(function(){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1,Vb(a))},100)}function vd(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,v(a.display.wrapper,"CodeMirror-focused"),a.curOp||a.display.selForContextMenu==a.doc.sel||(a.display.input.reset(),pa&&setTimeout(function(){return a.display.input.reset(!0)},20)),a.display.input.receivedFocus()),ud(a))}function Vb(a,b){a.state.delayingBlurEvent||(a.state.focused&&(fa(a,"blur",a,b),a.state.focused=!1,jb(a.display.wrapper,"CodeMirror-focused")),clearInterval(a.display.blinker),setTimeout(function(){a.state.focused||
(a.display.shift=!1)},150))}function Fc(a){a=a.display;for(var b=a.lineDiv.offsetTop,c=0;c<a.view.length;c++){var d=a.view[c];if(!d.hidden){if(W&&8>ba){var f=d.node.offsetTop+d.node.offsetHeight;var e=f-b;b=f}else e=d.node.getBoundingClientRect(),e=e.bottom-e.top;f=d.line.height-e;2>e&&(e=gb(a));if(.005<f||-.005>f)if(S(d.line,e),Le(d.line),d.rest)for(e=0;e<d.rest.length;e++)Le(d.rest[e])}}}function Le(a){if(a.widgets)for(var b=0;b<a.widgets.length;++b)a.widgets[b].height=a.widgets[b].node.parentNode.offsetHeight}
function wd(a,b,c){var d=c&&null!=c.top?Math.max(0,c.top):a.scroller.scrollTop;d=Math.floor(d-a.lineSpace.offsetTop);var f=c&&null!=c.bottom?c.bottom:d+a.wrapper.clientHeight;d=Q(b,d);f=Q(b,f);if(c&&c.ensure){var e=c.ensure.from.line;c=c.ensure.to.line;e<d?(d=e,f=Q(b,Ia(K(b,e))+a.wrapper.clientHeight)):Math.min(c,b.lastLine())>=f&&(d=Q(b,Ia(K(b,c))-a.wrapper.clientHeight),f=c)}return{from:d,to:Math.max(f,d+1)}}function Me(a){var b=a.display,c=b.view;if(b.alignWidgets||b.gutters.firstChild&&a.options.fixedGutter){for(var d=
sd(b)-b.scroller.scrollLeft+a.doc.scrollLeft,f=b.gutters.offsetWidth,e=d+"px",g=0;g<c.length;g++)if(!c[g].hidden){a.options.fixedGutter&&(c[g].gutter&&(c[g].gutter.style.left=e),c[g].gutterBackground&&(c[g].gutterBackground.style.left=e));var u=c[g].alignable;if(u)for(var k=0;k<u.length;k++)u[k].style.left=e}a.options.fixedGutter&&(b.gutters.style.left=d+f+"px")}}function Ne(b){if(!b.options.lineNumbers)return!1;var c=b.doc;c=da(b.options,c.first+c.size-1);var d=b.display;if(c.length!=d.lineNumChars){var f=
d.measure.appendChild(a("div",[a("div",c)],"CodeMirror-linenumber CodeMirror-gutter-elt")),e=f.firstChild.offsetWidth;f=f.offsetWidth-e;d.lineGutter.style.width="";d.lineNumInnerWidth=Math.max(e,d.lineGutter.offsetWidth-f)+1;d.lineNumWidth=d.lineNumInnerWidth+f;d.lineNumChars=d.lineNumInnerWidth?c.length:-1;d.lineGutter.style.width=d.lineNumWidth+"px";xd(b);return!0}return!1}function yd(a,b){var c=a.display,d=gb(a.display);0>b.top&&(b.top=0);var f=a.curOp&&null!=a.curOp.scrollTop?a.curOp.scrollTop:
c.scroller.scrollTop,e=jd(a),g={};b.bottom-b.top>e&&(b.bottom=b.top+e);var u=a.doc.height+id(c),k=b.top<d;d=b.bottom>u-d;b.top<f?g.scrollTop=k?0:b.top:b.bottom>f+e&&(e=Math.min(b.top,(d?u:b.bottom)-e),e!=f&&(g.scrollTop=e));f=a.curOp&&null!=a.curOp.scrollLeft?a.curOp.scrollLeft:c.scroller.scrollLeft;a=db(a)-(a.options.fixedGutter?c.gutters.offsetWidth:0);if(c=b.right-b.left>a)b.right=b.left+a;10>b.left?g.scrollLeft=0:b.left<f?g.scrollLeft=Math.max(0,b.left-(c?0:10)):b.right>a+f-3&&(g.scrollLeft=b.right+
(c?0:10)-a);return g}function Gc(a,b){null!=b&&(Hc(a),a.curOp.scrollTop=(null==a.curOp.scrollTop?a.doc.scrollTop:a.curOp.scrollTop)+b)}function wb(a){Hc(a);var b=a.getCursor();a.curOp.scrollToPos={from:b,to:b,margin:a.options.cursorScrollMargin}}function Wb(a,b,c){null==b&&null==c||Hc(a);null!=b&&(a.curOp.scrollLeft=b);null!=c&&(a.curOp.scrollTop=c)}function Hc(a){var b=a.curOp.scrollToPos;if(b){a.curOp.scrollToPos=null;var c=De(a,b.from),d=De(a,b.to);Oe(a,c,d,b.margin)}}function Oe(a,b,c,d){b=yd(a,
{left:Math.min(b.left,c.left),top:Math.min(b.top,c.top)-d,right:Math.max(b.right,c.right),bottom:Math.max(b.bottom,c.bottom)+d});Wb(a,b.scrollLeft,b.scrollTop)}function Xb(a,b){2>Math.abs(a.doc.scrollTop-b)||(Ua||zd(a,{top:b}),Pe(a,b,!0),Ua&&zd(a),Yb(a,100))}function Pe(a,b,c){b=Math.min(a.display.scroller.scrollHeight-a.display.scroller.clientHeight,b);if(a.display.scroller.scrollTop!=b||c)a.doc.scrollTop=b,a.display.scrollbars.setScrollTop(b),a.display.scroller.scrollTop!=b&&(a.display.scroller.scrollTop=
b)}function kb(a,b,c,d){b=Math.min(b,a.display.scroller.scrollWidth-a.display.scroller.clientWidth);(c?b==a.doc.scrollLeft:2>Math.abs(a.doc.scrollLeft-b))&&!d||(a.doc.scrollLeft=b,Me(a),a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft=b),a.display.scrollbars.setScrollLeft(b))}function Zb(a){var b=a.display,c=b.gutters.offsetWidth,d=Math.round(a.doc.height+id(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?c:0,docHeight:d,scrollHeight:d+Ka(a)+b.barHeight,nativeBarWidth:b.nativeBarWidth,gutterWidth:c}}function xb(a,b){b||(b=Zb(a));var c=a.display.barWidth,d=a.display.barHeight;Qe(a,b);for(b=0;4>b&&c!=a.display.barWidth||d!=a.display.barHeight;b++)c!=a.display.barWidth&&a.options.lineWrapping&&Fc(a),Qe(a,Zb(a)),c=a.display.barWidth,d=a.display.barHeight}function Qe(a,b){var c=a.display,d=c.scrollbars.update(b);
c.sizer.style.paddingRight=(c.barWidth=d.right)+"px";c.sizer.style.paddingBottom=(c.barHeight=d.bottom)+"px";c.heightForcer.style.borderBottom=d.bottom+"px solid transparent";d.right&&d.bottom?(c.scrollbarFiller.style.display="block",c.scrollbarFiller.style.height=d.bottom+"px",c.scrollbarFiller.style.width=d.right+"px"):c.scrollbarFiller.style.display="";d.bottom&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(c.gutterFiller.style.display="block",c.gutterFiller.style.height=d.bottom+
"px",c.gutterFiller.style.width=b.gutterWidth+"px"):c.gutterFiller.style.display=""}function Re(a){a.display.scrollbars&&(a.display.scrollbars.clear(),a.display.scrollbars.addClass&&jb(a.display.wrapper,a.display.scrollbars.addClass));a.display.scrollbars=new Se[a.options.scrollbarStyle](function(b){a.display.wrapper.insertBefore(b,a.display.scrollbarFiller);R(b,"mousedown",function(){a.state.focused&&setTimeout(function(){return a.display.input.focus()},0)});b.setAttribute("cm-not-content","true")},
function(b,c){"horizontal"==c?kb(a,b):Xb(a,b)},a);a.display.scrollbars.addClass&&v(a.display.wrapper,a.display.scrollbars.addClass)}function lb(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:++vg};a=a.curOp;vb?vb.ops.push(a):a.ownsGroup=vb={ops:[a],delayedCallbacks:[]}}function mb(b){og(b.curOp,
function(b){for(var c=0;c<b.ops.length;c++)b.ops[c].cm.curOp=null;b=b.ops;for(c=0;c<b.length;c++){var d=b[c],f=d.cm,e=f.display,g=f.display;!g.scrollbarsClipped&&g.scroller.offsetWidth&&(g.nativeBarWidth=g.scroller.offsetWidth-g.scroller.clientWidth,g.heightForcer.style.height=Ka(f)+"px",g.sizer.style.marginBottom=-g.nativeBarWidth+"px",g.sizer.style.borderRightWidth=Ka(f)+"px",g.scrollbarsClipped=!0);d.updateMaxLine&&Zc(f);d.mustUpdate=d.viewChanged||d.forceUpdate||null!=d.scrollTop||d.scrollToPos&&
(d.scrollToPos.from.line<e.viewFrom||d.scrollToPos.to.line>=e.viewTo)||e.maxLineChanged&&f.options.lineWrapping;d.update=d.mustUpdate&&new Ic(f,d.mustUpdate&&{top:d.scrollTop,ensure:d.scrollToPos},d.forceUpdate)}for(c=0;c<b.length;c++)d=b[c],d.updatedDisplay=d.mustUpdate&&Ad(d.cm,d.update);for(c=0;c<b.length;c++)if(d=b[c],f=d.cm,e=f.display,d.updatedDisplay&&Fc(f),d.barMeasure=Zb(f),e.maxLineChanged&&!f.options.lineWrapping&&(g=e.maxLine.text.length,g=Ea(f,fb(f,e.maxLine),g,void 0),d.adjustWidthTo=
g.left+3,f.display.sizerWidth=d.adjustWidthTo,d.barMeasure.scrollWidth=Math.max(e.scroller.clientWidth,e.sizer.offsetLeft+d.adjustWidthTo+Ka(f)+f.display.barWidth),d.maxScrollLeft=Math.max(0,e.sizer.offsetLeft+d.adjustWidthTo-db(f))),d.updatedDisplay||d.selectionChanged)d.preparedSelection=e.input.prepareSelection();for(c=0;c<b.length;c++)d=b[c],f=d.cm,null!=d.adjustWidthTo&&(f.display.sizer.style.minWidth=d.adjustWidthTo+"px",d.maxScrollLeft<f.doc.scrollLeft&&kb(f,Math.min(f.display.scroller.scrollLeft,
d.maxScrollLeft),!0),f.display.maxLineChanged=!1),e=d.focus&&d.focus==w(),d.preparedSelection&&f.display.input.showSelection(d.preparedSelection,e),(d.updatedDisplay||d.startHeight!=f.doc.height)&&xb(f,d.barMeasure),d.updatedDisplay&&Bd(f,d.barMeasure),d.selectionChanged&&ud(f),f.state.focused&&d.updateInput&&f.display.input.reset(d.typing),e&&Je(d.cm);for(c=0;c<b.length;c++){var u=void 0;d=b[c];f=d.cm;e=f.display;g=f.doc;d.updatedDisplay&&Te(f,d.update);null==e.wheelStartX||null==d.scrollTop&&null==
d.scrollLeft&&!d.scrollToPos||(e.wheelStartX=e.wheelStartY=null);null!=d.scrollTop&&Pe(f,d.scrollTop,d.forceScroll);null!=d.scrollLeft&&kb(f,d.scrollLeft,!0,!0);if(d.scrollToPos){var k=N(g,d.scrollToPos.from),m=N(g,d.scrollToPos.to),l=d.scrollToPos.margin;null==l&&(l=0);f.options.lineWrapping||k!=m||(k=k.ch?J(k.line,"before"==k.sticky?k.ch-1:k.ch,"after"):k,m="before"==k.sticky?J(k.line,k.ch+1,"before"):k);for(var z=0;5>z;z++){var q=!1;u=Fa(f,k);var h=m&&m!=k?Fa(f,m):u;u={left:Math.min(u.left,h.left),
top:Math.min(u.top,h.top)-l,right:Math.max(u.left,h.left),bottom:Math.max(u.bottom,h.bottom)+l};h=yd(f,u);var t=f.doc.scrollTop,r=f.doc.scrollLeft;null!=h.scrollTop&&(Xb(f,h.scrollTop),1<Math.abs(f.doc.scrollTop-t)&&(q=!0));null!=h.scrollLeft&&(kb(f,h.scrollLeft),1<Math.abs(f.doc.scrollLeft-r)&&(q=!0));if(!q)break}m=u;ja(f,"scrollCursorIntoView")||(l=f.display,z=l.sizer.getBoundingClientRect(),k=null,0>m.top+z.top?k=!0:m.bottom+z.top>(window.innerHeight||document.documentElement.clientHeight)&&(k=
!1),null==k||wg||(m=a("div","\u200b",null,"position: absolute;\n                         top: "+(m.top-l.viewOffset-f.display.lineSpace.offsetTop)+"px;\n                         height: "+(m.bottom-m.top+Ka(f)+l.barHeight)+"px;\n                         left: "+m.left+"px; width: "+Math.max(2,m.right-m.left)+"px;"),f.display.lineSpace.appendChild(m),m.scrollIntoView(k),f.display.lineSpace.removeChild(m)))}m=d.maybeHiddenMarkers;k=d.maybeUnhiddenMarkers;if(m)for(l=0;l<m.length;++l)m[l].lines.length||
fa(m[l],"hide");if(k)for(m=0;m<k.length;++m)k[m].lines.length&&fa(k[m],"unhide");e.wrapper.offsetHeight&&(g.scrollTop=f.display.scroller.scrollTop);d.changeObjs&&fa(f,"changes",f,d.changeObjs);d.update&&d.update.finish()}})}function va(a,b){if(a.curOp)return b();lb(a);try{return b()}finally{mb(a)}}function ka(a,b){return function(){if(a.curOp)return b.apply(a,arguments);lb(a);try{return b.apply(a,arguments)}finally{mb(a)}}}function ra(a){return function(){if(this.curOp)return a.apply(this,arguments);
lb(this);try{return a.apply(this,arguments)}finally{mb(this)}}}function la(a){return function(){var b=this.cm;if(!b||b.curOp)return a.apply(this,arguments);lb(b);try{return a.apply(this,arguments)}finally{mb(b)}}}function ta(a,b,c,d){null==b&&(b=a.doc.first);null==c&&(c=a.doc.first+a.doc.size);d||(d=0);var f=a.display;d&&c<f.viewTo&&(null==f.updateLineNumbers||f.updateLineNumbers>b)&&(f.updateLineNumbers=b);a.curOp.viewChanged=!0;if(b>=f.viewTo)Va&&Xc(a.doc,b)<f.viewTo&&Wa(a);else if(c<=f.viewFrom)Va&&
Yd(a.doc,c+d)>f.viewFrom?Wa(a):(f.viewFrom+=d,f.viewTo+=d);else if(b<=f.viewFrom&&c>=f.viewTo)Wa(a);else if(b<=f.viewFrom){var e=Jc(a,c,c+d,1);e?(f.view=f.view.slice(e.index),f.viewFrom=e.lineN,f.viewTo+=d):Wa(a)}else if(c>=f.viewTo)(e=Jc(a,b,b,-1))?(f.view=f.view.slice(0,e.index),f.viewTo=e.lineN):Wa(a);else{e=Jc(a,b,b,-1);var g=Jc(a,c,c+d,1);e&&g?(f.view=f.view.slice(0,e.index).concat(Ac(a,e.lineN,g.lineN)).concat(f.view.slice(g.index)),f.viewTo+=d):Wa(a)}if(a=f.externalMeasured)c<a.lineN?a.lineN+=
d:b<a.lineN+a.size&&(f.externalMeasured=null)}function Xa(a,b,c){a.curOp.viewChanged=!0;var f=a.display,e=a.display.externalMeasured;e&&b>=e.lineN&&b<e.lineN+e.size&&(f.externalMeasured=null);b<f.viewFrom||b>=f.viewTo||(a=f.view[eb(a,b)],null!=a.node&&(a=a.changes||(a.changes=[]),-1==d(a,c)&&a.push(c)))}function Wa(a){a.display.viewFrom=a.display.viewTo=a.doc.first;a.display.view=[];a.display.viewOffset=0}function Jc(a,b,c,d){var f=eb(a,b),e=a.display.view;if(!Va||c==a.doc.first+a.doc.size)return{index:f,
lineN:c};for(var g=a.display.viewFrom,u=0;u<f;u++)g+=e[u].size;if(g!=b){if(0<d){if(f==e.length-1)return null;b=g+e[f].size-b;f++}else b=g-b;c+=b}for(;Xc(a.doc,c)!=c;){if(f==(0>d?0:e.length-1))return null;c+=d*e[f-(0>d?1:0)].size;f+=d}return{index:f,lineN:c}}function Ue(a){a=a.display.view;for(var b=0,c=0;c<a.length;c++){var d=a[c];d.hidden||d.node&&!d.changes||++b}return b}function Yb(a,b){a.doc.highlightFrontier<a.display.viewTo&&a.state.highlight.set(b,q(xg,a))}function xg(a){var b=a.doc;if(!(b.highlightFrontier>=
a.display.viewTo)){var c=+new Date+a.options.workTime,d=Nb(a,b.highlightFrontier),f=[];b.iter(d.line,Math.min(b.first+b.size,a.display.viewTo+500),function(e){if(d.line>=a.display.viewFrom){var g=e.styles,u=e.text.length>a.options.maxHighlightLength?cb(b.mode,d.state):null,k=ee(a,e,d,!0);u&&(d.state=u);e.styles=k.styles;u=e.styleClasses;(k=k.classes)?e.styleClasses=k:u&&(e.styleClasses=null);k=!g||g.length!=e.styles.length||u!=k&&(!u||!k||u.bgClass!=k.bgClass||u.textClass!=k.textClass);for(u=0;!k&&
u<g.length;++u)k=g[u]!=e.styles[u];k&&f.push(d.line);e.stateAfter=d.save()}else e.text.length<=a.options.maxHighlightLength&&ed(a,e.text,d),e.stateAfter=0==d.line%5?d.save():null;d.nextLine();if(+new Date>c)return Yb(a,a.options.workDelay),!0});b.highlightFrontier=d.line;b.modeFrontier=Math.max(b.modeFrontier,d.line);f.length&&va(a,function(){for(var b=0;b<f.length;b++)Xa(a,f[b],"text")})}}function Ad(a,b){var c=a.display,d=a.doc;if(b.editorIsHidden)return Wa(a),!1;if(!b.force&&b.visible.from>=c.viewFrom&&
b.visible.to<=c.viewTo&&(null==c.updateLineNumbers||c.updateLineNumbers>=c.viewTo)&&c.renderedView==c.view&&0==Ue(a))return!1;Ne(a)&&(Wa(a),b.dims=ld(a));var f=d.first+d.size,g=Math.max(b.visible.from-a.options.viewportMargin,d.first),u=Math.min(f,b.visible.to+a.options.viewportMargin);c.viewFrom<g&&20>g-c.viewFrom&&(g=Math.max(d.first,c.viewFrom));c.viewTo>u&&20>c.viewTo-u&&(u=Math.min(f,c.viewTo));Va&&(g=Xc(a.doc,g),u=Yd(a.doc,u));d=g!=c.viewFrom||u!=c.viewTo||c.lastWrapHeight!=b.wrapperHeight||
c.lastWrapWidth!=b.wrapperWidth;f=a.display;0==f.view.length||g>=f.viewTo||u<=f.viewFrom?(f.view=Ac(a,g,u),f.viewFrom=g):(f.viewFrom>g?f.view=Ac(a,g,f.viewFrom).concat(f.view):f.viewFrom<g&&(f.view=f.view.slice(eb(a,g))),f.viewFrom=g,f.viewTo<u?f.view=f.view.concat(Ac(a,f.viewTo,u)):f.viewTo>u&&(f.view=f.view.slice(0,eb(a,u))));f.viewTo=u;c.viewOffset=Ia(K(a.doc,c.viewFrom));a.display.mover.style.top=c.viewOffset+"px";u=Ue(a);if(!d&&0==u&&!b.force&&c.renderedView==c.view&&(null==c.updateLineNumbers||
c.updateLineNumbers>=c.viewTo))return!1;a.hasFocus()?g=null:(g=w())&&l(a.display.lineDiv,g)?(g={activeElt:g},window.getSelection&&(f=window.getSelection(),f.anchorNode&&f.extend&&l(a.display.lineDiv,f.anchorNode)&&(g.anchorNode=f.anchorNode,g.anchorOffset=f.anchorOffset,g.focusNode=f.focusNode,g.focusOffset=f.focusOffset))):g=null;4<u&&(c.lineDiv.style.display="none");yg(a,c.updateLineNumbers,b.dims);4<u&&(c.lineDiv.style.display="");c.renderedView=c.view;(u=g)&&u.activeElt&&u.activeElt!=w()&&(u.activeElt.focus(),
u.anchorNode&&l(document.body,u.anchorNode)&&l(document.body,u.focusNode)&&(g=window.getSelection(),f=document.createRange(),f.setEnd(u.anchorNode,u.anchorOffset),f.collapse(!1),g.removeAllRanges(),g.addRange(f),g.extend(u.focusNode,u.focusOffset)));e(c.cursorDiv);e(c.selectionDiv);c.gutters.style.height=c.sizer.style.minHeight=0;d&&(c.lastWrapHeight=b.wrapperHeight,c.lastWrapWidth=b.wrapperWidth,Yb(a,400));c.updateLineNumbers=null;return!0}function Te(a,b){for(var c=b.viewport,d=!0;;d=!1){if(!d||
!a.options.lineWrapping||b.oldDisplayWidth==db(a))if(c&&null!=c.top&&(c={top:Math.min(a.doc.height+id(a.display)-jd(a),c.top)}),b.visible=wd(a.display,a.doc,c),b.visible.from>=a.display.viewFrom&&b.visible.to<=a.display.viewTo)break;if(!Ad(a,b))break;Fc(a);d=Zb(a);Ub(a);xb(a,d);Bd(a,d);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 zd(a,b){b=new Ic(a,b);if(Ad(a,b)){Fc(a);Te(a,b);var c=Zb(a);Ub(a);xb(a,c);Bd(a,c);b.finish()}}function yg(a,b,c){function f(b){var c=b.nextSibling;pa&&Da&&a.display.currentWheelTarget==b?b.style.display="none":b.parentNode.removeChild(b);return c}var g=a.display,u=a.options.lineNumbers,k=g.lineDiv,m=k.firstChild,l=g.view;g=g.viewFrom;for(var q=0;q<l.length;q++){var z=l[q];if(!z.hidden)if(z.node&&z.node.parentNode==k){for(;m!=z.node;)m=
f(m);m=u&&null!=b&&b<=g&&z.lineNumber;z.changes&&(-1<d(z.changes,"gutter")&&(m=!1),pe(a,z,g,c));m&&(e(z.lineNumber),z.lineNumber.appendChild(document.createTextNode(da(a.options,g))));m=z.node.nextSibling}else{var h=qg(a,z,g,c);k.insertBefore(h,m)}g+=z.size}for(;m;)m=f(m)}function xd(a){a.display.sizer.style.marginLeft=a.display.gutters.offsetWidth+"px"}function Bd(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+Ka(a)+"px"}function Ve(b){var c=b.display.gutters,d=b.options.gutters;e(c);for(var f=0;f<d.length;++f){var g=d[f],u=c.appendChild(a("div",null,"CodeMirror-gutter "+g));"CodeMirror-linenumbers"==g&&(b.display.lineGutter=u,u.style.width=(b.display.lineNumWidth||1)+"px")}c.style.display=f?"":"none";xd(b)}function Cd(a){var b=d(a.gutters,"CodeMirror-linenumbers");-1==b&&a.lineNumbers?a.gutters=a.gutters.concat(["CodeMirror-linenumbers"]):-1<b&&!a.lineNumbers&&(a.gutters=
a.gutters.slice(0),a.gutters.splice(b,1))}function We(a){var b=a.wheelDeltaX,c=a.wheelDeltaY;null==b&&a.detail&&a.axis==a.HORIZONTAL_AXIS&&(b=a.detail);null==c&&a.detail&&a.axis==a.VERTICAL_AXIS?c=a.detail:null==c&&(c=a.wheelDelta);return{x:b,y:c}}function zg(a){a=We(a);a.x*=ya;a.y*=ya;return a}function Xe(a,b){var c=We(b),d=c.x;c=c.y;var f=a.display,e=f.scroller,g=e.scrollWidth>e.clientWidth,u=e.scrollHeight>e.clientHeight;if(d&&g||c&&u){if(c&&Da&&pa){g=b.target;var k=f.view;a:for(;g!=e;g=g.parentNode)for(var m=
0;m<k.length;m++)if(k[m].node==g){a.display.currentWheelTarget=g;break a}}!d||Ua||Ga||null==ya?(c&&null!=ya&&(b=c*ya,u=a.doc.scrollTop,g=u+f.wrapper.clientHeight,0>b?u=Math.max(0,u+b-50):g=Math.min(a.doc.height,g+b+50),zd(a,{top:u,bottom:g})),20>Kc&&(null==f.wheelStartX?(f.wheelStartX=e.scrollLeft,f.wheelStartY=e.scrollTop,f.wheelDX=d,f.wheelDY=c,setTimeout(function(){if(null!=f.wheelStartX){var a=e.scrollLeft-f.wheelStartX,b=e.scrollTop-f.wheelStartY;a=b&&f.wheelDY&&b/f.wheelDY||a&&f.wheelDX&&a/
f.wheelDX;f.wheelStartX=f.wheelStartY=null;a&&(ya=(ya*Kc+a)/(Kc+1),++Kc)}},200)):(f.wheelDX+=d,f.wheelDY+=c))):(c&&u&&Xb(a,Math.max(0,e.scrollTop+c*ya)),kb(a,Math.max(0,e.scrollLeft+d*ya)),(!c||c&&u)&&qa(b),f.wheelStartX=null)}}function Ha(a,b){b=a[b];a.sort(function(a,b){return O(a.from(),b.from())});b=d(a,b);for(var c=1;c<a.length;c++){var f=a[c],e=a[c-1];if(0<=O(e.to(),f.from())){var g=ea(e.from(),f.from()),u=Oa(e.to(),f.to());f=e.empty()?f.from()==f.head:e.from()==e.head;c<=b&&--b;a.splice(--c,
2,new Z(f?u:g,f?g:u))}}return new za(a,b)}function Ra(a,b){return new za([new Z(a,b||a)],0)}function Ya(a){return a.text?J(a.from.line+a.text.length-1,n(a.text).length+(1==a.text.length?a.from.ch:0)):a.to}function Ye(a,b){if(0>O(a,b.from))return a;if(0>=O(a,b.to))return Ya(b);var c=a.line+b.text.length-(b.to.line-b.from.line)-1,d=a.ch;a.line==b.to.line&&(d+=Ya(b).ch-b.to.ch);return J(c,d)}function Dd(a,b){for(var c=[],d=0;d<a.sel.ranges.length;d++){var f=a.sel.ranges[d];c.push(new Z(Ye(f.anchor,b),
Ye(f.head,b)))}return Ha(c,a.sel.primIndex)}function Ze(a,b,c){return a.line==b.line?J(c.line,a.ch-b.ch+c.ch):J(c.line+(a.line-b.line),a.ch)}function Ed(a){a.doc.mode=cd(a.options,a.doc.modeOption);$b(a)}function $b(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;Yb(a,100);a.state.modeGen++;a.curOp&&ta(a)}function $e(a,b){return 0==b.from.ch&&0==b.to.ch&&""==n(b.text)&&(!a.cm||a.cm.options.wholeLineUpdateBefore)}
function Fd(a,b,c,d){function f(a,c,f){a.text=c;a.stateAfter&&(a.stateAfter=null);a.styles&&(a.styles=null);null!=a.order&&(a.order=null);Wd(a);rb(a,f);c=d?d(a):1;c!=a.height&&S(a,c);na(a,"change",a,b)}function e(a,b){for(var f=[];a<b;++a)f.push(new yb(k[a],c?c[a]:null,d));return f}var g=b.from,u=b.to,k=b.text,m=K(a,g.line),l=K(a,u.line),q=n(k),z=c?c[k.length-1]:null,h=u.line-g.line;b.full?(a.insert(0,e(0,k.length)),a.remove(k.length,a.size-k.length)):$e(a,b)?(u=e(0,k.length-1),f(l,l.text,z),h&&a.remove(g.line,
h),u.length&&a.insert(g.line,u)):m==l?1==k.length?f(m,m.text.slice(0,g.ch)+q+m.text.slice(u.ch),z):(h=e(1,k.length-1),h.push(new yb(q+m.text.slice(u.ch),z,d)),f(m,m.text.slice(0,g.ch)+k[0],c?c[0]:null),a.insert(g.line+1,h)):1==k.length?(f(m,m.text.slice(0,g.ch)+k[0]+l.text.slice(u.ch),c?c[0]:null),a.remove(g.line+1,h)):(f(m,m.text.slice(0,g.ch)+k[0],c?c[0]:null),f(l,q+l.text.slice(u.ch),z),z=e(1,k.length-1),1<h&&a.remove(g.line+1,h-1),a.insert(g.line+1,z));na(a,"change",a,b)}function nb(a,b,c){function d(a,
f,e){if(a.linked)for(var g=0;g<a.linked.length;++g){var u=a.linked[g];if(u.doc!=f){var k=e&&u.sharedHist;if(!c||k)b(u.doc,k),d(u.doc,a,k)}}}d(a,null,!0)}function af(a,b){if(b.cm)throw Error("This document is already in use.");a.doc=b;b.cm=a;td(a);Ed(a);bf(a);a.options.lineWrapping||Zc(a);a.options.mode=b.modeOption;ta(a)}function bf(a){("rtl"==a.doc.direction?v:jb)(a.display.lineDiv,"CodeMirror-rtl")}function Ag(a){va(a,function(){bf(a);ta(a)})}function Lc(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 Gd(a,b){var c={from:M(b.from),to:Ya(b),text:T(a,b.from,b.to)};cf(a,c,b.from.line,b.to.line+1);nb(a,function(a){return cf(a,c,b.from.line,b.to.line+1)},!0);return c}function df(a){for(;a.length;)if(n(a).ranges)a.pop();else break}function ef(a,b,c,d){var f=a.history;f.undone.length=0;var e=+new Date,g;if(g=f.lastOp==d||f.lastOrigin==b.origin&&
b.origin&&("+"==b.origin.charAt(0)&&a.cm&&f.lastModTime>e-a.cm.options.historyEventDelay||"*"==b.origin.charAt(0))){if(f.lastOp==d){df(f.done);var u=n(f.done)}else f.done.length&&!n(f.done).ranges?u=n(f.done):1<f.done.length&&!f.done[f.done.length-2].ranges?(f.done.pop(),u=n(f.done)):u=void 0;g=u}if(g){var k=n(u.changes);0==O(b.from,b.to)&&0==O(b.from,k.to)?k.to=Ya(b):u.changes.push(Gd(a,b))}else for((u=n(f.done))&&u.ranges||Mc(a.sel,f.done),u={changes:[Gd(a,b)],generation:f.generation},f.done.push(u);f.done.length>
f.undoDepth;)f.done.shift(),f.done[0].ranges||f.done.shift();f.done.push(c);f.generation=++f.maxGeneration;f.lastModTime=f.lastSelTime=e;f.lastOp=f.lastSelOp=d;f.lastOrigin=f.lastSelOrigin=b.origin;k||fa(a,"historyAdded")}function Mc(a,b){var c=n(b);c&&c.ranges&&c.equals(a)||b.push(a)}function cf(a,b,c,d){var f=b["spans_"+a.id],e=0;a.iter(Math.max(a.first,c),Math.min(a.first+a.size,d),function(c){c.markedSpans&&((f||(f=b["spans_"+a.id]={}))[e]=c.markedSpans);++e})}function Bg(a){if(!a)return null;
for(var b,c=0;c<a.length;++c)a[c].marker.explicitlyCleared?b||(b=a.slice(0,c)):b&&b.push(a[c]);return b?b.length?b:null:a}function ff(a,b){var c;if(c=b["spans_"+a.id]){for(var d=[],f=0;f<b.text.length;++f)d.push(Bg(c[f]));c=d}else c=null;a=Ib(a,b);if(!c)return a;if(!a)return c;for(b=0;b<c.length;++b)if(d=c[b],f=a[b],d&&f){var e=0;a:for(;e<f.length;++e){for(var g=f[e],u=0;u<d.length;++u)if(d[u].marker==g.marker)continue a;d.push(g)}}else f&&(c[b]=f);return c}function zb(a,b,c){for(var f=[],e=0;e<a.length;++e){var g=
a[e];if(g.ranges)f.push(c?za.prototype.deepCopy.call(g):g);else{g=g.changes;var u=[];f.push({changes:u});for(var k=0;k<g.length;++k){var m=g[k],l;u.push({from:m.from,to:m.to,text:m.text});if(b)for(var q in m)(l=q.match(/^spans_(\d+)$/))&&-1<d(b,Number(l[1]))&&(n(u)[q]=m[q],delete m[q])}}}return f}function Hd(a,b,c,d){return d?(a=a.anchor,c&&(d=0>O(b,a),d!=0>O(c,a)?(a=b,b=c):d!=0>O(b,c)&&(b=c)),new Z(a,b)):new Z(c||b,b)}function Nc(a,b,c,d,f){null==f&&(f=a.cm&&(a.cm.display.shift||a.extend));oa(a,
new za([Hd(a.sel.primary(),b,c,f)],0),d)}function gf(a,b,c){for(var d=[],f=a.cm&&(a.cm.display.shift||a.extend),e=0;e<a.sel.ranges.length;e++)d[e]=Hd(a.sel.ranges[e],b[e],null,f);b=Ha(d,a.sel.primIndex);oa(a,b,c)}function Id(a,b,c,d){var f=a.sel.ranges.slice(0);f[b]=c;oa(a,Ha(f,a.sel.primIndex),d)}function Cg(a,b,c){c={ranges:b.ranges,update:function(b){this.ranges=[];for(var c=0;c<b.length;c++)this.ranges[c]=new Z(N(a,b[c].anchor),N(a,b[c].head))},origin:c&&c.origin};fa(a,"beforeSelectionChange",
a,c);a.cm&&fa(a.cm,"beforeSelectionChange",a.cm,c);return c.ranges!=b.ranges?Ha(c.ranges,c.ranges.length-1):b}function hf(a,b,c){var d=a.history.done,f=n(d);f&&f.ranges?(d[d.length-1]=b,Oc(a,b,c)):oa(a,b,c)}function oa(a,b,c){Oc(a,b,c);b=a.sel;var d=a.cm?a.cm.curOp.id:NaN,f=a.history,e=c&&c.origin,g;if(!(g=d==f.lastSelOp)&&(g=e&&f.lastSelOrigin==e)&&!(g=f.lastModTime==f.lastSelTime&&f.lastOrigin==e)){g=n(f.done);var u=e.charAt(0);g="*"==u||"+"==u&&g.ranges.length==b.ranges.length&&g.somethingSelected()==
b.somethingSelected()&&new Date-a.history.lastSelTime<=(a.cm?a.cm.options.historyEventDelay:500)}g?f.done[f.done.length-1]=b:Mc(b,f.done);f.lastSelTime=+new Date;f.lastSelOrigin=e;f.lastSelOp=d;c&&!1!==c.clearRedo&&df(f.undone)}function Oc(a,b,c){if(Ca(a,"beforeSelectionChange")||a.cm&&Ca(a.cm,"beforeSelectionChange"))b=Cg(a,b,c);var d=c&&c.bias||(0>O(b.primary().head,a.sel.primary().head)?-1:1);jf(a,kf(a,b,d,!0));c&&!1===c.scroll||!a.cm||wb(a.cm)}function jf(a,b){b.equals(a.sel)||(a.sel=b,a.cm&&
(a.cm.curOp.updateInput=a.cm.curOp.selectionChanged=!0,ae(a.cm)),na(a,"cursorActivity",a))}function lf(a){jf(a,kf(a,a.sel,null,!1))}function kf(a,b,c,d){for(var f,e=0;e<b.ranges.length;e++){var g=b.ranges[e],u=b.ranges.length==a.sel.ranges.length&&a.sel.ranges[e],k=Jd(a,g.anchor,u&&u.anchor,c,d);u=Jd(a,g.head,u&&u.head,c,d);if(f||k!=g.anchor||u!=g.head)f||(f=b.ranges.slice(0,e)),f[e]=new Z(k,u)}return f?Ha(f,b.primIndex):b}function Ab(a,b,c,d,f){var e=K(a,b.line);if(e.markedSpans)for(var g=0;g<e.markedSpans.length;++g){var u=
e.markedSpans[g],k=u.marker;if((null==u.from||(k.inclusiveLeft?u.from<=b.ch:u.from<b.ch))&&(null==u.to||(k.inclusiveRight?u.to>=b.ch:u.to>b.ch))){if(f&&(fa(k,"beforeCursorEnter"),k.explicitlyCleared))if(e.markedSpans){--g;continue}else break;if(k.atomic){if(c){g=k.find(0>d?1:-1);u=void 0;if(0>d?k.inclusiveRight:k.inclusiveLeft)g=mf(a,g,-d,g&&g.line==b.line?e:null);if(g&&g.line==b.line&&(u=O(g,c))&&(0>d?0>u:0<u))return Ab(a,g,b,d,f)}c=k.find(0>d?-1:1);if(0>d?k.inclusiveLeft:k.inclusiveRight)c=mf(a,
c,d,c.line==b.line?e:null);return c?Ab(a,c,b,d,f):null}}}return b}function Jd(a,b,c,d,f){d=d||1;b=Ab(a,b,c,d,f)||!f&&Ab(a,b,c,d,!0)||Ab(a,b,c,-d,f)||!f&&Ab(a,b,c,-d,!0);return b?b:(a.cantEdit=!0,J(a.first,0))}function mf(a,b,c,d){return 0>c&&0==b.ch?b.line>a.first?N(a,J(b.line-1)):null:0<c&&b.ch==(d||K(a,b.line)).text.length?b.line<a.first+a.size-1?J(b.line+1,0):null:new J(b.line,b.ch+c)}function nf(a){a.setSelection(J(a.firstLine(),0),J(a.lastLine()),La)}function of(a,b,c){var d={canceled:!1,from:b.from,
to:b.to,text:b.text,origin:b.origin,cancel:function(){return d.canceled=!0}};c&&(d.update=function(b,c,f,e){b&&(d.from=N(a,b));c&&(d.to=N(a,c));f&&(d.text=f);void 0!==e&&(d.origin=e)});fa(a,"beforeChange",a,d);a.cm&&fa(a.cm,"beforeChange",a.cm,d);return d.canceled?null:{from:d.from,to:d.to,text:d.text,origin:d.origin}}function Bb(a,b,c){if(a.cm){if(!a.cm.curOp)return ka(a.cm,Bb)(a,b,c);if(a.cm.state.suppressEdits)return}if(Ca(a,"beforeChange")||a.cm&&Ca(a.cm,"beforeChange"))if(b=of(a,b,!0),!b)return;
if(c=pf&&!c&&ag(a,b.from,b.to))for(var d=c.length-1;0<=d;--d)qf(a,{from:c[d].from,to:c[d].to,text:d?[""]:b.text,origin:b.origin});else qf(a,b)}function qf(a,b){if(1!=b.text.length||""!=b.text[0]||0!=O(b.from,b.to)){var c=Dd(a,b);ef(a,b,c,a.cm?a.cm.curOp.id:NaN);ac(a,b,c,Ib(a,b));var f=[];nb(a,function(a,c){c||-1!=d(f,a.history)||(rf(a.history,b),f.push(a.history));ac(a,b,null,Ib(a,b))})}}function Pc(a,b,c){if(!a.cm||!a.cm.state.suppressEdits||c){for(var f=a.history,e,g=a.sel,u="undo"==b?f.done:f.undone,
k="undo"==b?f.undone:f.done,m=0;m<u.length&&(e=u[m],c?!e.ranges||e.equals(a.sel):e.ranges);m++);if(m!=u.length){for(f.lastOrigin=f.lastSelOrigin=null;;)if(e=u.pop(),e.ranges){Mc(e,k);if(c&&!e.equals(a.sel)){oa(a,e,{clearRedo:!1});return}g=e}else break;var l=[];Mc(g,k);k.push({changes:l,generation:f.generation});f.generation=e.generation||++f.maxGeneration;var q=Ca(a,"beforeChange")||a.cm&&Ca(a.cm,"beforeChange");c=function(c){var f=e.changes[c];f.origin=b;if(q&&!of(a,f,!1))return u.length=0,{};l.push(Gd(a,
f));var g=c?Dd(a,f):n(u);ac(a,f,g,ff(a,f));!c&&a.cm&&a.cm.scrollIntoView({from:f.from,to:Ya(f)});var k=[];nb(a,function(a,b){b||-1!=d(k,a.history)||(rf(a.history,f),k.push(a.history));ac(a,f,null,ff(a,f))})};for(f=e.changes.length-1;0<=f;--f)if(g=c(f))return g.v}}}function sf(a,b){if(0!=b&&(a.first+=b,a.sel=new za(B(a.sel.ranges,function(a){return new Z(J(a.anchor.line+b,a.anchor.ch),J(a.head.line+b,a.head.ch))}),a.sel.primIndex),a.cm)){ta(a.cm,a.first,a.first-b,b);for(var c=a.cm.display,d=c.viewFrom;d<
c.viewTo;d++)Xa(a.cm,d,"gutter")}}function ac(a,b,c,d){if(a.cm&&!a.cm.curOp)return ka(a.cm,ac)(a,b,c,d);if(b.to.line<a.first)sf(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 f=b.text.length-1-(a.first-b.from.line);sf(a,f);b={from:J(a.first,0),to:J(b.to.line+f,b.to.ch),text:[n(b.text)],origin:b.origin}}f=a.lastLine();b.to.line>f&&(b={from:b.from,to:J(f,K(a,f).text.length),text:[b.text[0]],origin:b.origin});b.removed=T(a,b.from,b.to);c||
(c=Dd(a,b));a.cm?Dg(a.cm,b,d):Fd(a,b,d);Oc(a,c,La)}}function Dg(a,b,c){var d=a.doc,f=a.display,e=b.from,g=b.to,u=!1,k=e.line;a.options.lineWrapping||(k=L(Aa(K(d,e.line))),d.iter(k,g.line+1,function(a){if(a==f.maxLine)return u=!0}));-1<d.sel.contains(b.from,b.to)&&ae(a);Fd(d,b,c,Ge(a));a.options.lineWrapping||(d.iter(k,e.line+b.text.length,function(a){var b=vc(a);b>f.maxLineLength&&(f.maxLine=a,f.maxLineLength=b,f.maxLineChanged=!0,u=!1)}),u&&(a.curOp.updateMaxLine=!0));ig(d,e.line);Yb(a,400);c=b.text.length-
(g.line-e.line)-1;b.full?ta(a):e.line!=g.line||1!=b.text.length||$e(a.doc,b)?ta(a,e.line,g.line+1,c):Xa(a,e.line,"text");c=Ca(a,"changes");if((d=Ca(a,"change"))||c)b={from:e,to:g,text:b.text,removed:b.removed,origin:b.origin},d&&na(a,"change",a,b),c&&(a.curOp.changeObjs||(a.curOp.changeObjs=[])).push(b);a.display.selForContextMenu=null}function Cb(a,b,c,d,f){d||(d=c);if(0>O(d,c)){var e=[d,c];c=e[0];d=e[1];e}"string"==typeof b&&(b=a.splitLines(b));Bb(a,{from:c,to:d,text:b,origin:f})}function tf(a,
b,c,d){c<a.line?a.line+=d:b<a.line&&(a.line=b,a.ch=0)}function uf(a,b,c,d){for(var f=0;f<a.length;++f){var e=a[f],g=!0;if(e.ranges)for(e.copied||(e=a[f]=e.deepCopy(),e.copied=!0),g=0;g<e.ranges.length;g++)tf(e.ranges[g].anchor,b,c,d),tf(e.ranges[g].head,b,c,d);else{for(var u=0;u<e.changes.length;++u){var k=e.changes[u];if(c<k.from.line)k.from=J(k.from.line+d,k.from.ch),k.to=J(k.to.line+d,k.to.ch);else if(b<=k.to.line){g=!1;break}}g||(a.splice(0,f+1),f=0)}}}function rf(a,b){var c=b.from.line,d=b.to.line;
b=b.text.length-(d-c)-1;uf(a.done,c,d,b);uf(a.undone,c,d,b)}function bc(a,b,c,d){var f=b,e=b;"number"==typeof b?e=K(a,Math.max(a.first,Math.min(b,a.first+a.size-1))):f=L(b);if(null==f)return null;d(e,f)&&a.cm&&Xa(a.cm,f,c);return e}function cc(a){this.lines=a;this.parent=null;for(var b=0,c=0;c<a.length;++c)a[c].parent=this,b+=a[c].height;this.height=b}function dc(a){this.children=a;for(var b=0,c=0,d=0;d<a.length;++d){var f=a[d];b+=f.chunkSize();c+=f.height;f.parent=this}this.size=b;this.height=c;
this.parent=null}function Eg(a,b,c,d){var f=new ec(a,c,d),e=a.cm;e&&f.noHScroll&&(e.display.alignWidgets=!0);bc(a,b,"widget",function(b){var c=b.widgets||(b.widgets=[]);null==f.insertAt?c.push(f):c.splice(Math.min(c.length-1,Math.max(0,f.insertAt)),0,f);f.line=b;e&&!bb(a,b)&&(c=Ia(b)<a.scrollTop,S(b,b.height+Rb(f)),c&&Gc(e,f.height),e.curOp.forceUpdate=!0);return!0});na(e,"lineWidgetAdded",e,f,"number"==typeof b?b:L(b));return f}function Db(a,c,d,f,e){if(f&&f.shared)return Fg(a,c,d,f,e);if(a.cm&&
!a.cm.curOp)return ka(a.cm,Db)(a,c,d,f,e);var g=new Za(a,e);e=O(c,d);f&&m(f,g,!1);if(0<e||0==e&&!1!==g.clearWhenEmpty)return g;g.replacedWith&&(g.collapsed=!0,g.widgetNode=b("span",[g.replacedWith],"CodeMirror-widget"),f.handleMouseEvents||g.widgetNode.setAttribute("cm-ignore-events","true"),f.insertLeft&&(g.widgetNode.insertLeft=!0));if(g.collapsed){if(Xd(a,c.line,c,d,g)||c.line!=d.line&&Xd(a,d.line,c,d,g))throw Error("Inserting collapsed marker partially overlapping an existing one");Va=!0}g.addToHistory&&
ef(a,{from:c,to:d,origin:"markText"},a.sel,NaN);var k=c.line,u=a.cm,l;a.iter(k,d.line+1,function(a){u&&g.collapsed&&!u.options.lineWrapping&&Aa(a)==u.display.maxLine&&(l=!0);g.collapsed&&k!=c.line&&S(a,0);var b=new Ta(g,k==c.line?c.ch:null,k==d.line?d.ch:null);a.markedSpans=a.markedSpans?a.markedSpans.concat([b]):[b];b.marker.attachLine(a);++k});g.collapsed&&a.iter(c.line,d.line+1,function(b){bb(a,b)&&S(b,0)});g.clearOnEnter&&R(g,"beforeCursorEnter",function(){return g.clear()});g.readOnly&&(pf=!0,
(a.history.done.length||a.history.undone.length)&&a.clearHistory());g.collapsed&&(g.id=++vf,g.atomic=!0);if(u){l&&(u.curOp.updateMaxLine=!0);if(g.collapsed)ta(u,c.line,d.line+1);else if(g.className||g.title||g.startStyle||g.endStyle||g.css)for(f=c.line;f<=d.line;f++)Xa(u,f,"text");g.atomic&&lf(u.doc);na(u,"markerAdded",u,g)}return g}function Fg(a,b,c,d,f){d=m(d);d.shared=!1;var e=[Db(a,b,c,d,f)],g=e[0],k=d.widgetNode;nb(a,function(a){k&&(d.widgetNode=k.cloneNode(!0));e.push(Db(a,N(a,b),N(a,c),d,f));
for(var u=0;u<a.linked.length;++u)if(a.linked[u].isParent)return;g=n(e)});return new fc(e,g)}function wf(a){return a.findMarks(J(a.first,0),a.clipPos(J(a.lastLine())),function(a){return a.parent})}function Gg(a){for(var b=function(b){b=a[b];var c=[b.primary.doc];nb(b.primary.doc,function(a){return c.push(a)});for(var f=0;f<b.markers.length;f++){var e=b.markers[f];-1==d(c,e.doc)&&(e.parent=null,b.markers.splice(f--,1))}},c=0;c<a.length;c++)b(c)}function Hg(a){var b=this;xf(b);if(!ja(b,a)&&!Qa(b.display,
a)){qa(a);W&&(yf=+new Date);var c=ib(b,a,!0),f=a.dataTransfer.files;if(c&&!b.isReadOnly())if(f&&f.length&&window.FileReader&&window.File)for(var e=f.length,g=Array(e),k=0,u=function(a,f){if(!b.options.allowDropFileTypes||-1!=d(b.options.allowDropFileTypes,a.type)){var u=new FileReader;u.onload=ka(b,function(){var a=u.result;/[\x00-\x08\x0e-\x1f]{2}/.test(a)&&(a="");g[f]=a;++k==e&&(c=N(b.doc,c),a={from:c,to:c,text:b.doc.splitLines(g.join(b.doc.lineSeparator())),origin:"paste"},Bb(b.doc,a),hf(b.doc,
Ra(c,Ya(a))))});u.readAsText(a)}},m=0;m<e;++m)u(f[m],m);else if(b.state.draggingText&&-1<b.doc.sel.contains(c))b.state.draggingText(a),setTimeout(function(){return b.display.input.focus()},20);else try{if(u=a.dataTransfer.getData("Text")){b.state.draggingText&&!b.state.draggingText.copy&&(m=b.listSelections());Oc(b.doc,Ra(c,c));if(m)for(f=0;f<m.length;++f)Cb(b.doc,"",m[f].anchor,m[f].head,"drag");b.replaceSelection(u,"around","paste");b.display.input.focus()}}catch(mh){}}}function xf(a){a.display.dragCursor&&
(a.display.lineSpace.removeChild(a.display.dragCursor),a.display.dragCursor=null)}function zf(a){if(document.getElementsByClassName)for(var b=document.getElementsByClassName("CodeMirror"),c=0;c<b.length;c++){var d=b[c].CodeMirror;d&&a(d)}}function Ig(){var a;R(window,"resize",function(){null==a&&(a=setTimeout(function(){a=null;zf(Jg)},100))});R(window,"blur",function(){return zf(Vb)})}function Jg(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 Kg(a){var b=a.split(/-(?!$)/);a=b[b.length-1];for(var c,d,f,e,g=0;g<b.length-1;g++){var k=b[g];if(/^(cmd|meta|m)$/i.test(k))e=!0;else if(/^a(lt)?$/i.test(k))c=!0;else if(/^(c|ctrl|control)$/i.test(k))d=!0;else if(/^s(hift)?$/i.test(k))f=!0;else throw Error("Unrecognized modifier name: "+k);}c&&(a="Alt-"+a);d&&(a="Ctrl-"+a);e&&(a="Cmd-"+a);f&&(a="Shift-"+a);return a}function Lg(a){var b={},c;for(c in a)if(a.hasOwnProperty(c)){var d=
a[c];if(!/^(name|fallthrough|(de|at)tach)$/.test(c)){if("..."!=d)for(var f=B(c.split(" "),Kg),e=0;e<f.length;e++){if(e==f.length-1){var g=f.join(" ");var k=d}else g=f.slice(0,e+1).join(" "),k="...";var u=b[g];if(!u)b[g]=k;else if(u!=k)throw Error("Inconsistent bindings for "+g);}delete a[c]}}for(var m in b)a[m]=b[m];return a}function Eb(a,b,c,d){b=Qc(b);var f=b.call?b.call(a,d):b[a];if(!1===f)return"nothing";if("..."===f)return"multi";if(null!=f&&c(f))return"handled";if(b.fallthrough){if("[object Array]"!=
Object.prototype.toString.call(b.fallthrough))return Eb(a,b.fallthrough,c,d);for(f=0;f<b.fallthrough.length;f++){var e=Eb(a,b.fallthrough[f],c,d);if(e)return e}}}function Af(a){a="string"==typeof a?a:$a[a.keyCode];return"Ctrl"==a||"Alt"==a||"Shift"==a||"Mod"==a}function Bf(a,b,c){var d=a;b.altKey&&"Alt"!=d&&(a="Alt-"+a);(Cf?b.metaKey:b.ctrlKey)&&"Ctrl"!=d&&(a="Ctrl-"+a);(Cf?b.ctrlKey:b.metaKey)&&"Cmd"!=d&&(a="Cmd-"+a);!c&&b.shiftKey&&"Shift"!=d&&(a="Shift-"+a);return a}function Df(a,b){if(Ga&&34==
a.keyCode&&a["char"])return!1;var c=$a[a.keyCode];return null==c||a.altGraphKey?!1:Bf(c,a,b)}function Qc(a){return"string"==typeof a?gc[a]:a}function Fb(a,b){for(var c=a.doc.sel.ranges,d=[],f=0;f<c.length;f++){for(var e=b(c[f]);d.length&&0>=O(e.from,n(d).to);){var g=d.pop();if(0>O(g.from,e.from)){e.from=g.from;break}}d.push(e)}va(a,function(){for(var b=d.length-1;0<=b;b--)Cb(a.doc,"",d[b].from,d[b].to,"+delete");wb(a)})}function Kd(a,b,c){b=I(a.text,b+c,c);return 0>b||b>a.text.length?null:b}function Ld(a,
b,c){a=Kd(a,b.ch,c);return null==a?null:new J(b.line,a,0>c?"after":"before")}function Md(a,b,c,d,f){if(a&&(a=Pa(c,b.doc.direction))){a=0>f?n(a):a[0];var e=0>f==(1==a.level)?"after":"before";if(0<a.level||"rtl"==b.doc.direction){var g=fb(b,c);var k=0>f?c.text.length-1:0;var u=Ea(b,g,k).top;k=F(function(a){return Ea(b,g,a).top==u},0>f==(1==a.level)?a.from:a.to-1,k);"before"==e&&(k=Kd(c,k,1))}else k=0>f?a.to:a.from;return new J(d,k,e)}return new J(d,0>f?c.text.length:0,0>f?"before":"after")}function Mg(a,
b,c,d){var f=Pa(b,a.doc.direction);if(!f)return Ld(b,c,d);c.ch>=b.text.length?(c.ch=b.text.length,c.sticky="before"):0>=c.ch&&(c.ch=0,c.sticky="after");var e=Jb(f,c.ch,c.sticky),g=f[e];if("ltr"==a.doc.direction&&0==g.level%2&&(0<d?g.to>c.ch:g.from<c.ch))return Ld(b,c,d);var k=function(a,c){return Kd(b,a instanceof J?a.ch:a,c)},u,m=function(c){if(!a.options.lineWrapping)return{begin:0,end:b.text.length};u=u||fb(a,b);return Fe(a,b,u,c)},l=m("before"==c.sticky?k(c,-1):c.ch);if("rtl"==a.doc.direction||
1==g.level){var q=1==g.level==0>d,h=k(c,q?1:-1);if(null!=h&&(q?h<=g.to&&h<=l.end:h>=g.from&&h>=l.begin))return new J(c.line,h,q?"before":"after")}g=function(a,b,d){for(var e=function(a,b){return b?new J(c.line,k(a,1),"before"):new J(c.line,a,"after")};0<=a&&a<f.length;a+=b){var g=f[a],u=0<b==(1!=g.level),m=u?d.begin:k(d.end,-1);if(g.from<=m&&m<g.to)return e(m,u);m=u?g.from:k(g.to,-1);if(d.begin<=m&&m<d.end)return e(m,u)}};if(e=g(e+d,d,l))return e;l=0<d?l.end:k(l.begin,-1);return null==l||0<d&&l==
b.text.length||!(e=g(0<d?0:f.length-1,d,m(l)))?null:e}function Ef(a,b){var c=K(a.doc,b),d=Aa(c);d!=c&&(b=L(d));return Md(!0,a,d,b,1)}function Ff(a,b){var c=Ef(a,b.line),d=K(a.doc,c.line);a=Pa(d,a.doc.direction);return a&&0!=a[0].level?c:(d=Math.max(0,d.text.search(/\S/)),J(c.line,b.line==c.line&&b.ch<=d&&b.ch?0:d,c.sticky))}function Rc(a,b,c){if("string"==typeof b&&(b=hc[b],!b))return!1;a.display.input.ensurePolled();var d=a.display.shift,f=!1;try{a.isReadOnly()&&(a.state.suppressEdits=!0),c&&(a.display.shift=
!1),f=b(a)!=Sc}finally{a.display.shift=d,a.state.suppressEdits=!1}return f}function Ng(a,b,c){for(var d=0;d<a.state.keyMaps.length;d++){var f=Eb(b,a.state.keyMaps[d],c,a);if(f)return f}return a.options.extraKeys&&Eb(b,a.options.extraKeys,c,a)||Eb(b,a.options.keyMap,c,a)}function ic(a,b,c,d){var f=a.state.keySeq;if(f){if(Af(b))return"handled";Og.set(50,function(){a.state.keySeq==f&&(a.state.keySeq=null,a.display.input.reset())});b=f+" "+b}d=Ng(a,b,d);"multi"==d&&(a.state.keySeq=b);"handled"==d&&na(a,
"keyHandled",a,b,c);if("handled"==d||"multi"==d)qa(c),ud(a);return f&&!d&&/\'$/.test(b)?(qa(c),!0):!!d}function Gf(a,b){var c=Df(b,!0);return c?b.shiftKey&&!a.state.keySeq?ic(a,"Shift-"+c,b,function(b){return Rc(a,b,!0)})||ic(a,c,b,function(b){if("string"==typeof b?/^go[A-Z]/.test(b):b.motion)return Rc(a,b)}):ic(a,c,b,function(b){return Rc(a,b)}):!1}function Pg(a,b,c){return ic(a,"'"+c+"'",b,function(b){return Rc(a,b,!0)})}function Hf(a){this.curOp.focus=w();if(!ja(this,a)){W&&11>ba&&27==a.keyCode&&
(a.returnValue=!1);var b=a.keyCode;this.display.shift=16==b||a.shiftKey;var c=Gf(this,a);Ga&&(Nd=c?b:null,!c&&88==b&&!Qg&&(Da?a.metaKey:a.ctrlKey)&&this.replaceSelection("",null,"cut"));18!=b||/\bCodeMirror-crosshair\b/.test(this.display.lineDiv.className)||Rg(this)}}function Rg(a){function b(a){18!=a.keyCode&&a.altKey||(jb(c,"CodeMirror-crosshair"),xa(document,"keyup",b),xa(document,"mouseover",b))}var c=a.display.lineDiv;v(c,"CodeMirror-crosshair");R(document,"keyup",b);R(document,"mouseover",b)}
function If(a){16==a.keyCode&&(this.doc.sel.shift=!1);ja(this,a)}function Jf(a){if(!(Qa(this.display,a)||ja(this,a)||a.ctrlKey&&!a.altKey||Da&&a.metaKey)){var b=a.keyCode,c=a.charCode;if(Ga&&b==Nd)Nd=null,qa(a);else if(!Ga||a.which&&!(10>a.which)||!Gf(this,a))if(b=String.fromCharCode(null==c?b:c),"\b"!=b&&!Pg(this,a,b))this.display.input.onKeyPress(a)}}function Sg(a,b){var c=+new Date;if(jc&&jc.compare(c,a,b))return kc=jc=null,"triple";if(kc&&kc.compare(c,a,b))return jc=new Od(c,a,b),kc=null,"double";
kc=new Od(c,a,b);jc=null;return"single"}function Kf(a){var b=this.display;if(!(ja(this,a)||b.activeTouch&&b.input.supportsTouch()))if(b.input.ensurePolled(),b.shift=a.shiftKey,Qa(b,a))pa||(b.scroller.draggable=!1,setTimeout(function(){return b.scroller.draggable=!0},100));else if(!Tc(this,a,"gutterClick",!0)){var c=ib(this,a),d=ce(a),f=c?Sg(c,d):"single";window.focus();1==d&&this.state.selectingText&&this.state.selectingText(a);c&&Tg(this,d,c,f,a)||(1==d?c?Ug(this,c,f,a):(a.target||a.srcElement)==
b.scroller&&qa(a):2==d?(c&&Nc(this.doc,c),setTimeout(function(){return b.input.focus()},20)):3==d&&(Pd?Lf(this,a):Ke(this)))}}function Tg(a,b,c,d,f){var e="Click";"double"==d?e="Double"+e:"triple"==d&&(e="Triple"+e);return ic(a,Bf((1==b?"Left":2==b?"Middle":"Right")+e,f),f,function(b){"string"==typeof b&&(b=hc[b]);if(!b)return!1;var d=!1;try{a.isReadOnly()&&(a.state.suppressEdits=!0),d=b(a,c)!=Sc}finally{a.state.suppressEdits=!1}return d})}function Ug(a,b,c,d){W?setTimeout(q(Je,a),0):a.curOp.focus=
w();var f=a.getOption("configureMouse");f=f?f(a,c,d):{};null==f.unit&&(f.unit=(Vg?d.shiftKey&&d.metaKey:d.altKey)?"rectangle":"single"==c?"char":"double"==c?"word":"line");if(null==f.extend||a.doc.extend)f.extend=a.doc.extend||d.shiftKey;null==f.addNew&&(f.addNew=Da?d.metaKey:d.ctrlKey);null==f.moveOnDrag&&(f.moveOnDrag=!(Da?d.altKey:d.ctrlKey));var e=a.doc.sel,g;a.options.dragDrop&&Wg&&!a.isReadOnly()&&"single"==c&&-1<(g=e.contains(b))&&(0>O((g=e.ranges[g]).from(),b)||0<b.xRel)&&(0<O(g.to(),b)||
0>b.xRel)?Xg(a,d,b,f):Yg(a,d,b,f)}function Xg(a,b,c,d){var f=a.display,e=!1,g=ka(a,function(b){pa&&(f.scroller.draggable=!1);a.state.draggingText=!1;xa(document,"mouseup",g);xa(document,"mousemove",k);xa(f.scroller,"dragstart",m);xa(f.scroller,"drop",g);e||(qa(b),d.addNew||Nc(a.doc,c,null,null,d.extend),pa||W&&9==ba?setTimeout(function(){document.body.focus();f.input.focus()},20):f.input.focus())}),k=function(a){e=e||10<=Math.abs(b.clientX-a.clientX)+Math.abs(b.clientY-a.clientY)},m=function(){return e=
!0};pa&&(f.scroller.draggable=!0);a.state.draggingText=g;g.copy=!d.moveOnDrag;f.scroller.dragDrop&&f.scroller.dragDrop();R(document,"mouseup",g);R(document,"mousemove",k);R(f.scroller,"dragstart",m);R(f.scroller,"drop",g);Ke(a);setTimeout(function(){return f.input.focus()},20)}function Mf(a,b,c){if("char"==c)return new Z(b,b);if("word"==c)return a.findWordAt(b);if("line"==c)return new Z(J(b.line,0),N(a.doc,J(b.line+1,0)));a=c(a,b);return new Z(a.from,a.to)}function Yg(a,b,c,d){function e(b){if(0!=
O(p,b))if(p=b,"rectangle"==d.unit){var e=[],k=a.options.tabSize,m=g(K(l,c.line).text,c.ch,k),u=g(K(l,b.line).text,b.ch,k),h=Math.min(m,u);m=Math.max(m,u);u=Math.min(c.line,b.line);for(var w=Math.min(a.lastLine(),Math.max(c.line,b.line));u<=w;u++){var n=K(l,u).text,v=f(n,h,k);h==m?e.push(new Z(J(u,v),J(u,v))):n.length>v&&e.push(new Z(J(u,v),J(u,f(n,m,k))))}e.length||e.push(new Z(c,c));oa(l,Ha(q.ranges.slice(0,t).concat(e),t),{origin:"*mouse",scroll:!1});a.scrollIntoView(b)}else e=r,h=Mf(a,b,d.unit),
b=e.anchor,0<O(h.anchor,b)?(k=h.head,b=ea(e.from(),h.anchor)):(k=h.anchor,b=Oa(e.to(),h.head)),e=q.ranges.slice(0),e[t]=Zg(a,new Z(N(l,b),k)),oa(l,Ha(e,t),Qd)}function k(b){var c=++v,f=ib(a,b,!0,"rectangle"==d.unit);if(f)if(0!=O(f,p)){a.curOp.focus=w();e(f);var g=wd(u,l);(f.line>=g.to||f.line<g.from)&&setTimeout(ka(a,function(){v==c&&k(b)}),150)}else{var m=b.clientY<n.top?-20:b.clientY>n.bottom?20:0;m&&setTimeout(ka(a,function(){v==c&&(u.scroller.scrollTop+=m,k(b))}),50)}}function m(b){a.state.selectingText=
!1;v=Infinity;qa(b);u.input.focus();xa(document,"mousemove",z);xa(document,"mouseup",x);l.history.lastSelOrigin=null}var u=a.display,l=a.doc;qa(b);var q=l.sel,h=q.ranges;if(d.addNew&&!d.extend){var t=l.sel.contains(c);var r=-1<t?h[t]:new Z(c,c)}else r=l.sel.primary(),t=l.sel.primIndex;"rectangle"==d.unit?(d.addNew||(r=new Z(c,c)),c=ib(a,b,!0,!0),t=-1):(b=Mf(a,c,d.unit),r=d.extend?Hd(r,b.anchor,b.head,d.extend):b);d.addNew?-1==t?(t=h.length,oa(l,Ha(h.concat([r]),t),{scroll:!1,origin:"*mouse"})):1<
h.length&&h[t].empty()&&"char"==d.unit&&!d.extend?(oa(l,Ha(h.slice(0,t).concat(h.slice(t+1)),0),{scroll:!1,origin:"*mouse"}),q=l.sel):Id(l,t,r,Qd):(t=0,oa(l,new za([r],0),Qd),q=l.sel);var p=c,n=u.wrapper.getBoundingClientRect(),v=0,z=ka(a,function(a){ce(a)?k(a):m(a)}),x=ka(a,m);a.state.selectingText=x;R(document,"mousemove",z);R(document,"mouseup",x)}function Zg(a,b){var c=b.anchor,d=b.head,f=K(a.doc,c.line);if(0==O(c,d)&&c.sticky==d.sticky)return b;f=Pa(f);if(!f)return b;var e=Jb(f,c.ch,c.sticky),
g=f[e];if(g.from!=c.ch&&g.to!=c.ch)return b;var k=e+(g.from==c.ch==(1!=g.level)?0:1);if(0==k||k==f.length)return b;d.line!=c.line?a=0<(d.line-c.line)*("ltr"==a.doc.direction?1:-1):(a=Jb(f,d.ch,d.sticky),e=a-e||(d.ch-c.ch)*(1==g.level?-1:1),a=a==k-1||a==k?0>e:0<e);f=f[k+(a?-1:0)];f=(k=a==(1==f.level))?f.from:f.to;k=k?"after":"before";return c.ch==f&&c.sticky==k?b:new Z(new J(c.line,f,k),d)}function Tc(a,b,c,d){if(b.touches){var f=b.touches[0].clientX;var e=b.touches[0].clientY}else try{f=b.clientX,
e=b.clientY}catch($d){return!1}if(f>=Math.floor(a.display.gutters.getBoundingClientRect().right))return!1;d&&qa(b);d=a.display;var g=d.lineDiv.getBoundingClientRect();if(e>g.bottom||!Ca(a,c))return $c(b);e-=g.top-d.viewOffset;for(g=0;g<a.options.gutters.length;++g){var k=d.gutters.childNodes[g];if(k&&k.getBoundingClientRect().right>=f)return f=Q(a.doc,e),fa(a,c,a,f,a.options.gutters[g],b),$c(b)}}function Lf(a,b){var c;(c=Qa(a.display,b))||(c=Ca(a,"gutterContextMenu")?Tc(a,b,"gutterContextMenu",!1):
!1);if(!c&&!ja(a,b,"contextmenu"))a.display.input.onContextMenu(b)}function Nf(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g," cm-s-");Tb(a)}function lc(a){Ve(a);ta(a);Me(a)}function $g(a,b,c){!b!=!(c&&c!=Gb)&&(c=a.display.dragFunctions,b=b?R:xa,b(a.display.scroller,"dragstart",c.start),b(a.display.scroller,"dragenter",c.enter),b(a.display.scroller,"dragover",c.over),b(a.display.scroller,"dragleave",c.leave),b(a.display.scroller,
"drop",c.drop))}function ah(a){a.options.lineWrapping?(v(a.display.wrapper,"CodeMirror-wrap"),a.display.sizer.style.minWidth="",a.display.sizerWidth=null):(jb(a.display.wrapper,"CodeMirror-wrap"),Zc(a));td(a);ta(a);Tb(a);setTimeout(function(){return xb(a)},100)}function ca(a,b){var c=this;if(!(this instanceof ca))return new ca(a,b);this.options=b=b?m(b):{};m(Of,b,!1);Cd(b);var d=b.value;"string"==typeof d&&(d=new ua(d,b.mode,null,b.lineSeparator,b.direction));this.doc=d;var f=new ca.inputStyles[b.inputStyle](this);
a=this.display=new P(a,d,f);a.wrapper.CodeMirror=this;Ve(this);Nf(this);b.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");Re(this);this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new ob,keySeq:null,specialChars:null};b.autofocus&&!Kb&&a.input.focus();W&&11>ba&&setTimeout(function(){return c.display.input.reset(!0)},20);bh(this);Pf||(Ig(),Pf=!0);lb(this);
this.curOp.forceUpdate=!0;af(this,d);b.autofocus&&!Kb||this.hasFocus()?setTimeout(q(vd,this),20):Vb(this);for(var e in Uc)if(Uc.hasOwnProperty(e))Uc[e](c,b[e],Gb);Ne(this);b.finishInit&&b.finishInit(this);for(d=0;d<Rd.length;++d)Rd[d](c);mb(this);pa&&b.lineWrapping&&"optimizelegibility"==getComputedStyle(a.lineDiv).textRendering&&(a.lineDiv.style.textRendering="auto")}function bh(b){function c(){f.activeTouch&&(e=setTimeout(function(){return f.activeTouch=null},1E3),g=f.activeTouch,g.end=+new Date)}
function d(a,b){if(null==b.left)return!0;var c=b.left-a.left;a=b.top-a.top;return 400<c*c+a*a}var f=b.display;R(f.scroller,"mousedown",ka(b,Kf));W&&11>ba?R(f.scroller,"dblclick",ka(b,function(a){if(!ja(b,a)){var c=ib(b,a);!c||Tc(b,a,"gutterClick",!0)||Qa(b.display,a)||(qa(a),a=b.findWordAt(c),Nc(b.doc,a.anchor,a.head))}})):R(f.scroller,"dblclick",function(a){return ja(b,a)||qa(a)});Pd||R(f.scroller,"contextmenu",function(a){return Lf(b,a)});var e,g={end:0};R(f.scroller,"touchstart",function(a){var c;
if(c=!ja(b,a))1!=a.touches.length?c=!1:(c=a.touches[0],c=1>=c.radiusX&&1>=c.radiusY),c=!c;c&&!Tc(b,a,"gutterClick",!0)&&(f.input.ensurePolled(),clearTimeout(e),c=+new Date,f.activeTouch={start:c,moved:!1,prev:300>=c-g.end?g:null},1==a.touches.length&&(f.activeTouch.left=a.touches[0].pageX,f.activeTouch.top=a.touches[0].pageY))});R(f.scroller,"touchmove",function(){f.activeTouch&&(f.activeTouch.moved=!0)});R(f.scroller,"touchend",function(a){var e=f.activeTouch;if(e&&!Qa(f,a)&&null!=e.left&&!e.moved&&
300>new Date-e.start){var g=b.coordsChar(f.activeTouch,"page");e=!e.prev||d(e,e.prev)?new Z(g,g):!e.prev.prev||d(e,e.prev.prev)?b.findWordAt(g):new Z(J(g.line,0),N(b.doc,J(g.line+1,0)));b.setSelection(e.anchor,e.head);b.focus();qa(a)}c()});R(f.scroller,"touchcancel",c);R(f.scroller,"scroll",function(){f.scroller.clientHeight&&(Xb(b,f.scroller.scrollTop),kb(b,f.scroller.scrollLeft,!0),fa(b,"scroll",b))});R(f.scroller,"mousewheel",function(a){return Xe(b,a)});R(f.scroller,"DOMMouseScroll",function(a){return Xe(b,
a)});R(f.wrapper,"scroll",function(){return f.wrapper.scrollTop=f.wrapper.scrollLeft=0});f.dragFunctions={enter:function(a){ja(b,a)||Mb(a)},over:function(c){if(!ja(b,c)){var d=ib(b,c);if(d){var f=document.createDocumentFragment();Ie(b,d,f);b.display.dragCursor||(b.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),b.display.lineSpace.insertBefore(b.display.dragCursor,b.display.cursorDiv));r(b.display.dragCursor,f)}Mb(c)}},start:function(c){if(W&&(!b.state.draggingText||100>
+new Date-yf))Mb(c);else if(!ja(b,c)&&!Qa(b.display,c)&&(c.dataTransfer.setData("Text",b.getSelection()),c.dataTransfer.effectAllowed="copyMove",c.dataTransfer.setDragImage&&!Qf)){var d=a("img",null,null,"position: fixed; left: 0; top: 0;");d.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";Ga&&(d.width=d.height=1,b.display.wrapper.appendChild(d),d._top=d.offsetTop);c.dataTransfer.setDragImage(d,0,0);Ga&&d.parentNode.removeChild(d)}},drop:ka(b,Hg),leave:function(a){ja(b,
a)||xf(b)}};var k=f.input.getField();R(k,"keyup",function(a){return If.call(b,a)});R(k,"keydown",ka(b,Hf));R(k,"keypress",ka(b,Jf));R(k,"focus",function(a){return vd(b,a)});R(k,"blur",function(a){return Vb(b,a)})}function mc(a,b,c,d){var f=a.doc,e;null==c&&(c="add");"smart"==c&&(f.mode.indent?e=Nb(a,b).state:c="prev");var m=a.options.tabSize,l=K(f,b),u=g(l.text,null,m);l.stateAfter&&(l.stateAfter=null);var q=l.text.match(/^\s*/)[0];if(!d&&!/\S/.test(l.text)){var h=0;c="not"}else if("smart"==c&&(h=
f.mode.indent(e,l.text.slice(q.length),l.text),h==Sc||150<h)){if(!d)return;c="prev"}"prev"==c?h=b>f.first?g(K(f,b-1).text,null,m):0:"add"==c?h=u+a.options.indentUnit:"subtract"==c?h=u-a.options.indentUnit:"number"==typeof c&&(h=u+c);h=Math.max(0,h);c="";d=0;if(a.options.indentWithTabs)for(a=Math.floor(h/m);a;--a)d+=m,c+="\t";d<h&&(c+=k(h-d));if(c!=q)return Cb(f,c,J(b,0),J(b,q.length),"+input"),l.stateAfter=null,!0;for(m=0;m<f.sel.ranges.length;m++)if(l=f.sel.ranges[m],l.head.line==b&&l.head.ch<q.length){b=
J(b,q.length);Id(f,m,new Z(b,b));break}}function Sd(a,b,c,d,f){var e=a.doc;a.display.shift=!1;d||(d=e.sel);var g=a.state.pasteIncoming||"paste"==f,k=Td(b),m=null;if(g&&1<d.ranges.length)if(wa&&wa.text.join("\n")==b){if(0==d.ranges.length%wa.text.length){m=[];for(var l=0;l<wa.text.length;l++)m.push(e.splitLines(wa.text[l]))}}else k.length==d.ranges.length&&a.options.pasteLinesPerSelection&&(m=B(k,function(a){return[a]}));for(l=d.ranges.length-1;0<=l;l--){var u=d.ranges[l];var q=u.from(),h=u.to();u.empty()&&
(c&&0<c?q=J(q.line,q.ch-c):a.state.overwrite&&!g?h=J(h.line,Math.min(K(e,h.line).text.length,h.ch+n(k).length)):wa&&wa.lineWise&&wa.text.join("\n")==b&&(q=h=J(q.line,0)));u=a.curOp.updateInput;q={from:q,to:h,text:m?m[l%m.length]:k,origin:f||(g?"paste":a.state.cutIncoming?"cut":"+input")};Bb(a.doc,q);na(a,"inputRead",a,q)}b&&!g&&Rf(a,b);wb(a);a.curOp.updateInput=u;a.curOp.typing=!0;a.state.pasteIncoming=a.state.cutIncoming=!1}function Sf(a,b){var c=a.clipboardData&&a.clipboardData.getData("Text");
if(c)return a.preventDefault(),b.isReadOnly()||b.options.disableInput||va(b,function(){return Sd(b,c,0,null,"paste")}),!0}function Rf(a,b){if(a.options.electricChars&&a.options.smartIndent)for(var c=a.doc.sel,d=c.ranges.length-1;0<=d;d--){var f=c.ranges[d];if(!(100<f.head.ch||d&&c.ranges[d-1].head.line==f.head.line)){var e=a.getModeAt(f.head),g=!1;if(e.electricChars)for(var k=0;k<e.electricChars.length;k++){if(-1<b.indexOf(e.electricChars.charAt(k))){g=mc(a,f.head.line,"smart");break}}else e.electricInput&&
e.electricInput.test(K(a.doc,f.head.line).text.slice(0,f.head.ch))&&(g=mc(a,f.head.line,"smart"));g&&na(a,"electricInput",a,f.head.line)}}}function Tf(a){for(var b=[],c=[],d=0;d<a.doc.sel.ranges.length;d++){var f=a.doc.sel.ranges[d].head.line;f={anchor:J(f,0),head:J(f+1,0)};c.push(f);b.push(a.getRange(f.anchor,f.head))}return{text:b,ranges:c}}function Uf(a,b){a.setAttribute("autocorrect","off");a.setAttribute("autocapitalize","off");a.setAttribute("spellcheck",!!b)}function Vf(){var b=a("textarea",
null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),c=a("div",[b],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");pa?b.style.width="1000px":b.setAttribute("wrap","off");nc&&(b.style.border="1px solid black");Uf(b);return c}function Ud(a,b,c,d,f){function e(d){var e=f?Mg(a.cm,m,b,c):Ld(m,b,c);if(null==e){if(d=!d)d=b.line+c,d<a.first||d>=a.first+a.size?d=!1:(b=new J(d,b.ch,b.sticky),d=m=K(a,d));if(d)b=Md(f,a.cm,m,b.line,c);else return!1}else b=
e;return!0}var g=b,k=c,m=K(a,b.line);if("char"==d)e();else if("column"==d)e(!0);else if("word"==d||"group"==d){var l=null;d="group"==d;for(var q=a.cm&&a.cm.getHelper(b,"wordChars"),u=!0;!(0>c)||e(!u);u=!1){var h=m.text.charAt(b.ch)||"\n";h=A(h,q)?"w":d&&"\n"==h?"n":!d||/\s/.test(h)?null:"p";!d||u||h||(h="s");if(l&&l!=h){0>c&&(c=1,e(),b.sticky="after");break}h&&(l=h);if(0<c&&!e(!u))break}}k=Jd(a,b,g,k,!0);Na(g,k)&&(k.hitSide=!0);return k}function Wf(a,b,c,d){var f=a.doc,e=b.left;if("page"==d){var g=
Math.max(Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight)-.5*gb(a.display),3);g=(0<c?b.bottom:b.top)+c*g}else"line"==d&&(g=0<c?b.bottom+3:b.top-3);for(;;){b=qd(a,e,g);if(!b.outside)break;if(0>c?0>=g:g>=f.height){b.hitSide=!0;break}g+=5*c}return b}function Xf(a,b){var c=kd(a,b.line);if(!c||c.hidden)return null;var d=K(a.doc,b.line);c=ve(c,d,b.line);a=Pa(d,a.doc.direction);d="left";a&&(d=Jb(a,b.ch)%2?"right":"left");b=we(c.map,b.ch,d);b.offset="right"==
b.collapse?b.end:b.start;return b}function ch(a){for(;a;a=a.parentNode)if(/CodeMirror-gutter-wrapper/.test(a.className))return!0;return!1}function Hb(a,b){b&&(a.bad=!0);return a}function dh(a,b,c,d,f){function e(a){return function(b){return b.id==a}}function g(a){a&&(l&&(m+=q,l=!1),m+=a)}function k(b){if(1==b.nodeType){var c=b.getAttribute("cm-text");if(null!=c)g(c||b.textContent.replace(/\u200b/g,""));else{c=b.getAttribute("cm-marker");var u;if(c)b=a.findMarks(J(d,0),J(f+1,0),e(+c)),b.length&&(u=
b[0].find(0))&&g(T(a.doc,u.from,u.to).join(q));else if("false"!=b.getAttribute("contenteditable")){(u=/^(pre|div|p)$/i.test(b.nodeName))&&l&&(m+=q,l=!1);for(c=0;c<b.childNodes.length;c++)k(b.childNodes[c]);u&&(l=!0)}}}else 3==b.nodeType&&g(b.nodeValue)}for(var m="",l=!1,q=a.doc.lineSeparator();;){k(b);if(b==c)break;b=b.nextSibling}return m}function Vc(a,b,c){if(b==a.display.lineDiv){var d=a.display.lineDiv.childNodes[c];if(!d)return Hb(a.clipPos(J(a.display.viewTo-1)),!0);b=null;c=0}else for(d=b;;d=
d.parentNode){if(!d||d==a.display.lineDiv)return null;if(d.parentNode&&d.parentNode==a.display.lineDiv)break}for(var f=0;f<a.display.view.length;f++){var e=a.display.view[f];if(e.node==d)return eh(e,b,c)}}function eh(a,b,c){function d(b,c,d){for(var f=-1;f<(q?q.length:0);f++)for(var e=0>f?m.map:q[f],g=0;g<e.length;g+=3){var k=e[g+2];if(k==b||k==c){c=L(0>f?a.line:a.rest[f]);f=e[g]+d;if(0>d||k!=b)f=e[g+(d?1:0)];return J(c,f)}}}var f=a.text.firstChild,e=!1;if(!b||!l(f,b))return Hb(J(L(a.line),0),!0);
if(b==f&&(e=!0,b=f.childNodes[c],c=0,!b))return c=a.rest?n(a.rest):a.line,Hb(J(L(c),c.text.length),e);var g=3==b.nodeType?b:null,k=b;g||1!=b.childNodes.length||3!=b.firstChild.nodeType||(g=b.firstChild,c&&(c=g.nodeValue.length));for(;k.parentNode!=f;)k=k.parentNode;var m=a.measure,q=m.maps;if(b=d(g,k,c))return Hb(b,e);f=k.nextSibling;for(g=g?g.nodeValue.length-c:0;f;f=f.nextSibling){if(b=d(f,f.firstChild,0))return Hb(J(b.line,b.ch-g),e);g+=f.textContent.length}for(k=k.previousSibling;k;k=k.previousSibling){if(b=
d(k,k.firstChild,-1))return Hb(J(b.line,b.ch+c),e);c+=k.textContent.length}}var sa=navigator.userAgent,Yf=navigator.platform,Ua=/gecko\/\d/i.test(sa),Zf=/MSIE \d/.test(sa),$f=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(sa),oc=/Edge\/(\d+)/.exec(sa),W=Zf||$f||oc,ba=W&&(Zf?document.documentMode||6:+(oc||$f)[1]),pa=!oc&&/WebKit\//.test(sa),fh=pa&&/Qt\/\d+\.\d+/.test(sa),Bc=!oc&&/Chrome\//.test(sa),Ga=/Opera\//.test(sa),Qf=/Apple Computer/.test(navigator.vendor),gh=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(sa),
wg=/PhantomJS/.test(sa),nc=!oc&&/AppleWebKit/.test(sa)&&/Mobile\/\w+/.test(sa),Cc=/Android/.test(sa),Kb=nc||Cc||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(sa),Da=nc||/Mac/.test(Yf),Vg=/\bCrOS\b/.test(sa),hh=/win/i.test(Yf),pb=Ga&&sa.match(/Version\/(\d*\.\d*)/);pb&&(pb=Number(pb[1]));pb&&15<=pb&&(Ga=!1,pa=!0);var Cf=Da&&(fh||Ga&&(null==pb||12.11>pb)),Pd=Ua||W&&9<=ba,jb=function(a,b){var d=a.className;if(b=c(b).exec(d)){var f=d.slice(b.index+b[0].length);a.className=d.slice(0,b.index)+
(f?b[1]+f:"")}};var Ob=document.createRange?function(a,b,c,d){var f=document.createRange();f.setEnd(d||a,c);f.setStart(a,b);return f}:function(a,b,c){var d=document.body.createTextRange();try{d.moveToElementText(a.parentNode)}catch(ma){return d}d.collapse(!0);d.moveEnd("character",c);d.moveStart("character",b);return d};var pc=function(a){a.select()};nc?pc=function(a){a.selectionStart=0;a.selectionEnd=a.value.length}:W&&(pc=function(a){try{a.select()}catch(z){}});var ob=function(){this.id=null};ob.prototype.set=
function(a,b){clearTimeout(this.id);this.id=setTimeout(b,a)};var Sc={toString:function(){return"CodeMirror.Pass"}},La={scroll:!1},Qd={origin:"*mouse"},qc={origin:"+move"},wc=[""],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]/,
pf=!1,Va=!1,Lb=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,c){this.level=a;this.from=b;this.to=c}var c=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,d=/[stwN]/,f=/[LRr]/,e=/[Lb1n]/,g=/[1n]/;return function(k,m){var l="ltr"==m?"L":"R";if(0==k.length||"ltr"==m&&!c.test(k))return!1;for(var q=k.length,u=[],h=0;h<q;++h)u.push(a(k.charCodeAt(h)));h=0;for(var t=l;h<q;++h){var r=u[h];"m"==r?u[h]=t:t=r}h=0;for(t=l;h<q;++h)r=u[h],"1"==r&&"r"==t?u[h]="n":f.test(r)&&(t=r,"r"==r&&(u[h]="R"));
h=1;for(t=u[0];h<q-1;++h)r=u[h],"+"==r&&"1"==t&&"1"==u[h+1]?u[h]="1":","!=r||t!=u[h+1]||"1"!=t&&"n"!=t||(u[h]=t),t=r;for(h=0;h<q;++h)if(t=u[h],","==t)u[h]="N";else if("%"==t){for(t=h+1;t<q&&"%"==u[t];++t);for(r=h&&"!"==u[h-1]||t<q&&"1"==u[t]?"1":"N";h<t;++h)u[h]=r;h=t-1}h=0;for(t=l;h<q;++h)r=u[h],"L"==t&&"1"==r?u[h]="L":f.test(r)&&(t=r);for(t=0;t<q;++t)if(d.test(u[t])){for(h=t+1;h<q&&d.test(u[h]);++h);r="L"==(t?u[t-1]:l);for(r=r==("L"==(h<q?u[h]:l))?r?"L":"R":l;t<h;++t)u[t]=r;t=h-1}l=[];var w;for(h=
0;h<q;)if(e.test(u[h])){t=h;for(++h;h<q&&e.test(u[h]);++h);l.push(new b(0,t,h))}else{var p=h;t=l.length;for(++h;h<q&&"L"!=u[h];++h);for(r=p;r<h;)if(g.test(u[r])){p<r&&l.splice(t,0,new b(1,p,r));p=r;for(++r;r<h&&g.test(u[r]);++r);l.splice(t,0,new b(2,p,r));p=r}else++r;p<h&&l.splice(t,0,new b(1,p,h))}"ltr"==m&&(1==l[0].level&&(w=k.match(/^\s+/))&&(l[0].from=w[0].length,l.unshift(new b(0,0,w[0].length))),1==n(l).level&&(w=k.match(/\s+$/))&&(n(l).to-=w[0].length,l.push(new b(0,q-w[0].length,q))));return"rtl"==
m?l.reverse():l}}(),xc=[],R=function(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent?a.attachEvent("on"+b,c):(a=a._handlers||(a._handlers={}),a[b]=(a[b]||xc).concat(c))},Wg=function(){if(W&&9>ba)return!1;var b=a("div");return"draggable"in b||"dragDrop"in b}(),ad,gd,Td=3!="\n\nb".split(/\n/).length?function(a){for(var b=0,c=[],d=a.length;b<=d;){var f=a.indexOf("\n",b);-1==f&&(f=a.length);var e=a.slice(b,"\r"==a.charAt(f-1)?f-1:f),g=e.indexOf("\r");-1!=g?(c.push(e.slice(0,g)),b+=
g+1):(c.push(e),b=f+1)}return c}:function(a){return a.split(/\r\n?|\n/)},ih=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(z){return!1}}:function(a){try{var b=a.ownerDocument.selection.createRange()}catch(Y){}return b&&b.parentElement()==a?0!=b.compareEndPoints("StartToEnd",b):!1},Qg=function(){var b=a("div");if("oncopy"in b)return!0;b.setAttribute("oncopy","return;");return"function"==typeof b.oncopy}(),md=null,bd={},tb={},ub={},ha=function(a,b,c){this.pos=this.start=
0;this.string=a;this.tabSize=b||8;this.lineStart=this.lastColumnPos=this.lastColumnValue=0;this.lineOracle=c};ha.prototype.eol=function(){return this.pos>=this.string.length};ha.prototype.sol=function(){return this.pos==this.lineStart};ha.prototype.peek=function(){return this.string.charAt(this.pos)||void 0};ha.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)};ha.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};ha.prototype.eatWhile=function(a){for(var b=this.pos;this.eat(a););return this.pos>b};ha.prototype.eatSpace=function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a};ha.prototype.skipToEnd=function(){this.pos=this.string.length};ha.prototype.skipTo=function(a){a=this.string.indexOf(a,this.pos);if(-1<a)return this.pos=a,!0};ha.prototype.backUp=function(a){this.pos-=a};ha.prototype.column=function(){this.lastColumnPos<
this.start&&(this.lastColumnValue=g(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start);return this.lastColumnValue-(this.lineStart?g(this.string,this.lineStart,this.tabSize):0)};ha.prototype.indentation=function(){return g(this.string,null,this.tabSize)-(this.lineStart?g(this.string,this.lineStart,this.tabSize):0)};ha.prototype.match=function(a,b,c){if("string"==typeof a){var d=function(a){return c?a.toLowerCase():a},f=this.string.substr(this.pos,
a.length);if(d(f)==d(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}};ha.prototype.current=function(){return this.string.slice(this.start,this.pos)};ha.prototype.hideFirstChars=function(a,b){this.lineStart+=a;try{return b()}finally{this.lineStart-=a}};ha.prototype.lookAhead=function(a){var b=this.lineOracle;return b&&b.lookAhead(a)};ha.prototype.baseToken=function(){var a=this.lineOracle;
return a&&a.baseToken(this.pos)};var zc=function(a,b){this.state=a;this.lookAhead=b},Ja=function(a,b,c,d){this.state=b;this.doc=a;this.line=c;this.maxLookAhead=d||0;this.baseTokens=null;this.baseTokenPos=1};Ja.prototype.lookAhead=function(a){var b=this.doc.getLine(this.line+a);null!=b&&a>this.maxLookAhead&&(this.maxLookAhead=a);return b};Ja.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}};Ja.prototype.nextLine=function(){this.line++;0<this.maxLookAhead&&this.maxLookAhead--};Ja.fromSaved=function(a,b,c){return b instanceof zc?new Ja(a,cb(a.mode,b.state),c,b.lookAhead):new Ja(a,cb(a.mode,b),c)};Ja.prototype.save=function(a){a=!1!==a?cb(this.doc.mode,this.state):this.state;return 0<this.maxLookAhead?new zc(a,this.maxLookAhead):a};var je=function(a,b,c){this.start=a.start;this.end=a.pos;this.string=
a.current();this.type=b||null;this.state=c},yb=function(a,b,c){this.text=a;rb(this,b);this.height=c?c(this):1};yb.prototype.lineNo=function(){return L(this)};sb(yb);var kg={},jg={},vb=null,Pb=null,xe={left:0,right:0,top:0,bottom:0},hb,qb=function(b,c,d){this.cm=d;var f=this.vert=a("div",[a("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),e=this.horiz=a("div",[a("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");b(f);b(e);R(f,"scroll",function(){f.clientHeight&&c(f.scrollTop,
"vertical")});R(e,"scroll",function(){e.clientWidth&&c(e.scrollLeft,"horizontal")});this.checkedZeroWidth=!1;W&&8>ba&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};qb.prototype.update=function(a){var b=a.scrollWidth>a.clientWidth+1,c=a.scrollHeight>a.clientHeight+1,d=a.nativeBarWidth;c?(this.vert.style.display="block",this.vert.style.bottom=b?d+"px":"0",this.vert.firstChild.style.height=Math.max(0,a.scrollHeight-a.clientHeight+(a.viewHeight-(b?d:0)))+"px"):(this.vert.style.display=
"",this.vert.firstChild.style.height="0");b?(this.horiz.style.display="block",this.horiz.style.right=c?d+"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-(c?d:0)))+"px"):(this.horiz.style.display="",this.horiz.firstChild.style.width="0");!this.checkedZeroWidth&&0<a.clientHeight&&(0==d&&this.zeroWidthHack(),this.checkedZeroWidth=!0);return{right:c?d:0,bottom:b?d:0}};qb.prototype.setScrollLeft=function(a){this.horiz.scrollLeft!=
a&&(this.horiz.scrollLeft=a);this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")};qb.prototype.setScrollTop=function(a){this.vert.scrollTop!=a&&(this.vert.scrollTop=a);this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")};qb.prototype.zeroWidthHack=function(){this.horiz.style.height=this.vert.style.width=Da&&!gh?"12px":"18px";this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none";this.disableHoriz=new ob;this.disableVert=new ob};qb.prototype.enableZeroWidthBar=
function(a,b,c){function d(){var f=a.getBoundingClientRect();("vert"==c?document.elementFromPoint(f.right-1,(f.top+f.bottom)/2):document.elementFromPoint((f.right+f.left)/2,f.bottom-1))!=a?a.style.pointerEvents="none":b.set(1E3,d)}a.style.pointerEvents="auto";b.set(1E3,d)};qb.prototype.clear=function(){var a=this.horiz.parentNode;a.removeChild(this.horiz);a.removeChild(this.vert)};var rc=function(){};rc.prototype.update=function(){return{bottom:0,right:0}};rc.prototype.setScrollLeft=function(){};
rc.prototype.setScrollTop=function(){};rc.prototype.clear=function(){};var Se={"native":qb,"null":rc},vg=0,Ic=function(a,b,c){var d=a.display;this.viewport=b;this.visible=wd(d,a.doc,b);this.editorIsHidden=!d.wrapper.offsetWidth;this.wrapperHeight=d.wrapper.clientHeight;this.wrapperWidth=d.wrapper.clientWidth;this.oldDisplayWidth=db(a);this.force=c;this.dims=ld(a);this.events=[]};Ic.prototype.signal=function(a,b){Ca(a,b)&&this.events.push(arguments)};Ic.prototype.finish=function(){for(var a=0;a<this.events.length;a++)fa.apply(null,
this.events[a])};var Kc=0,ya=null;W?ya=-.53:Ua?ya=15:Bc?ya=-.7:Qf&&(ya=-1/3);var za=function(a,b){this.ranges=a;this.primIndex=b};za.prototype.primary=function(){return this.ranges[this.primIndex]};za.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 c=this.ranges[b],d=a.ranges[b];if(!Na(c.anchor,d.anchor)||!Na(c.head,d.head))return!1}return!0};za.prototype.deepCopy=function(){for(var a=
[],b=0;b<this.ranges.length;b++)a[b]=new Z(M(this.ranges[b].anchor),M(this.ranges[b].head));return new za(a,this.primIndex)};za.prototype.somethingSelected=function(){for(var a=0;a<this.ranges.length;a++)if(!this.ranges[a].empty())return!0;return!1};za.prototype.contains=function(a,b){b||(b=a);for(var c=0;c<this.ranges.length;c++){var d=this.ranges[c];if(0<=O(b,d.from())&&0>=O(a,d.to()))return c}return-1};var Z=function(a,b){this.anchor=a;this.head=b};Z.prototype.from=function(){return ea(this.anchor,
this.head)};Z.prototype.to=function(){return Oa(this.anchor,this.head)};Z.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};cc.prototype={chunkSize:function(){return this.lines.length},removeInner:function(a,b){for(var c=a,d=a+b;c<d;++c){var f=this.lines[c];this.height-=f.height;var e=f;e.parent=null;Wd(e);na(f,"delete")}this.lines.splice(a,b)},collapse:function(a){a.push.apply(a,this.lines)},insertInner:function(a,b,c){this.height+=c;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,c){for(b=a+b;a<b;++a)if(c(this.lines[a]))return!0}};dc.prototype={chunkSize:function(){return this.size},removeInner:function(a,b){this.size-=b;for(var c=0;c<this.children.length;++c){var d=this.children[c],f=d.chunkSize();if(a<f){var e=Math.min(b,f-a),g=d.height;d.removeInner(a,e);this.height-=g-d.height;f==e&&(this.children.splice(c--,1),d.parent=null);if(0==(b-=e))break;a=0}else a-=f}25>this.size-
b&&(1<this.children.length||!(this.children[0]instanceof cc))&&(a=[],this.collapse(a),this.children=[new cc(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,c){this.size+=b.length;this.height+=c;for(var d=0;d<this.children.length;++d){var f=this.children[d],e=f.chunkSize();if(a<=e){f.insertInner(a,b,c);if(f.lines&&50<f.lines.length){for(b=a=f.lines.length%25+25;b<f.lines.length;)c=new cc(f.lines.slice(b,
b+=25)),f.height-=c.height,this.children.splice(++d,0,c),c.parent=this;f.lines=f.lines.slice(0,a);this.maybeSpill()}break}a-=e}},maybeSpill:function(){if(!(10>=this.children.length)){var a=this;do{var b=a.children.splice(a.children.length-5,5);b=new dc(b);if(a.parent){a.size-=b.size;a.height-=b.height;var c=d(a.parent.children,a);a.parent.children.splice(c+1,0,b)}else c=new dc(a.children),c.parent=a,a.children=[c,b],a=c;b.parent=a.parent}while(10<a.children.length);a.parent.maybeSpill()}},iterN:function(a,
b,c){for(var d=0;d<this.children.length;++d){var f=this.children[d],e=f.chunkSize();if(a<e){e=Math.min(b,e-a);if(f.iterN(a,e,c))return!0;if(0==(b-=e))break;a=0}else a-=e}}};var ec=function(a,b,c){if(c)for(var d in c)c.hasOwnProperty(d)&&(this[d]=c[d]);this.doc=a;this.node=b};ec.prototype.clear=function(){var a=this.doc.cm,b=this.line.widgets,c=this.line,d=L(c);if(null!=d&&b){for(var f=0;f<b.length;++f)b[f]==this&&b.splice(f--,1);b.length||(c.widgets=null);var e=Rb(this);S(c,Math.max(0,c.height-e));
a&&(va(a,function(){var b=-e;Ia(c)<(a.curOp&&a.curOp.scrollTop||a.doc.scrollTop)&&Gc(a,b);Xa(a,d,"widget")}),na(a,"lineWidgetCleared",a,this,d))}};ec.prototype.changed=function(){var a=this,b=this.height,c=this.doc.cm,d=this.line;this.height=null;var f=Rb(this)-b;f&&(S(d,d.height+f),c&&va(c,function(){c.curOp.forceUpdate=!0;Ia(d)<(c.curOp&&c.curOp.scrollTop||c.doc.scrollTop)&&Gc(c,f);na(c,"lineWidgetChanged",c,a,L(d))}))};sb(ec);var vf=0,Za=function(a,b){this.lines=[];this.type=b;this.doc=a;this.id=
++vf};Za.prototype.clear=function(){if(!this.explicitlyCleared){var a=this.doc.cm,b=a&&!a.curOp;b&&lb(a);if(Ca(this,"clear")){var c=this.find();c&&na(this,"clear",c.from,c.to)}for(var d=c=null,f=0;f<this.lines.length;++f){var e=this.lines[f],g=Ba(e.markedSpans,this);a&&!this.collapsed?Xa(a,L(e),"text"):a&&(null!=g.to&&(d=L(e)),null!=g.from&&(c=L(e)));for(var k=e,m=void 0,l=e.markedSpans,q=g,h=0;h<l.length;++h)l[h]!=q&&(m||(m=[])).push(l[h]);k.markedSpans=m;null==g.from&&this.collapsed&&!bb(this.doc,
e)&&a&&S(e,gb(a.display))}if(a&&this.collapsed&&!a.options.lineWrapping)for(f=0;f<this.lines.length;++f)e=Aa(this.lines[f]),g=vc(e),g>a.display.maxLineLength&&(a.display.maxLine=e,a.display.maxLineLength=g,a.display.maxLineChanged=!0);null!=c&&a&&this.collapsed&&ta(a,c,d+1);this.lines.length=0;this.explicitlyCleared=!0;this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,a&&lf(a.doc));a&&na(a,"markerCleared",a,this,c,d);b&&mb(a);this.parent&&this.parent.clear()}};Za.prototype.find=function(a,b){null==
a&&"bookmark"==this.type&&(a=1);for(var c,d,f=0;f<this.lines.length;++f){var e=this.lines[f],g=Ba(e.markedSpans,this);if(null!=g.from&&(c=J(b?e:L(e),g.from),-1==a))return c;if(null!=g.to&&(d=J(b?e:L(e),g.to),1==a))return d}return c&&{from:c,to:d}};Za.prototype.changed=function(){var a=this,b=this.find(-1,!0),c=this,d=this.doc.cm;b&&d&&va(d,function(){var f=b.line,e=L(b.line);if(e=kd(d,e))ye(e),d.curOp.selectionChanged=d.curOp.forceUpdate=!0;d.curOp.updateMaxLine=!0;bb(c.doc,f)||null==c.height||(e=
c.height,c.height=null,(e=Rb(c)-e)&&S(f,f.height+e));na(d,"markerChanged",d,a)})};Za.prototype.attachLine=function(a){if(!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;b.maybeHiddenMarkers&&-1!=d(b.maybeHiddenMarkers,this)||(b.maybeUnhiddenMarkers||(b.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(a)};Za.prototype.detachLine=function(a){this.lines.splice(d(this.lines,a),1);!this.lines.length&&this.doc.cm&&(a=this.doc.cm.curOp,(a.maybeHiddenMarkers||(a.maybeHiddenMarkers=[])).push(this))};
sb(Za);var fc=function(a,b){this.markers=a;this.primary=b;for(b=0;b<a.length;++b)a[b].parent=this};fc.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var a=0;a<this.markers.length;++a)this.markers[a].clear();na(this,"clear")}};fc.prototype.find=function(a,b){return this.primary.find(a,b)};sb(fc);var jh=0,ua=function(a,b,c,d,f){if(!(this instanceof ua))return new ua(a,b,c,d,f);null==c&&(c=0);dc.call(this,[new cc([new yb("",null)])]);this.first=c;this.scrollTop=
this.scrollLeft=0;this.cantEdit=!1;this.cleanGeneration=1;this.modeFrontier=this.highlightFrontier=c;c=J(c,0);this.sel=Ra(c);this.history=new Lc(null);this.id=++jh;this.modeOption=b;this.lineSep=d;this.direction="rtl"==f?"rtl":"ltr";this.extend=!1;"string"==typeof a&&(a=this.splitLines(a));Fd(this,{from:c,to:c,text:a});oa(this,Ra(c),La)};ua.prototype=y(dc.prototype,{constructor:ua,iter:function(a,b,c){c?this.iterN(a-this.first,b-a,c):this.iterN(this.first,this.first+this.size,a)},insert:function(a,
b){for(var c=0,d=0;d<b.length;++d)c+=b[d].height;this.insertInner(a-this.first,b,c)},remove:function(a,b){this.removeInner(a-this.first,b)},getValue:function(a){var b=V(this,this.first,this.first+this.size);return!1===a?b:b.join(a||this.lineSeparator())},setValue:la(function(a){var b=J(this.first,0),c=this.first+this.size-1;Bb(this,{from:b,to:J(c,K(this,c).text.length),text:this.splitLines(a),origin:"setValue",full:!0},!0);this.cm&&Wb(this.cm,0,0);oa(this,Ra(b),La)}),replaceRange:function(a,b,c,d){b=
N(this,b);c=c?N(this,c):b;Cb(this,a,b,c,d)},getRange:function(a,b,c){a=T(this,N(this,a),N(this,b));return!1===c?a:a.join(c||this.lineSeparator())},getLine:function(a){return(a=this.getLineHandle(a))&&a.text},getLineHandle:function(a){if(X(this,a))return K(this,a)},getLineNumber:function(a){return L(a)},getLineHandleVisualStart:function(a){"number"==typeof a&&(a=K(this,a));return Aa(a)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+
this.size-1},clipPos:function(a){return N(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:la(function(a,b,c){a=N(this,"number"==typeof a?J(a,b||0):a);oa(this,Ra(a,null),c)}),setSelection:la(function(a,b,c){var d=N(this,a);a=N(this,b||a);oa(this,Ra(d,a),c)}),extendSelection:la(function(a,
b,c){Nc(this,N(this,a),b&&N(this,b),c)}),extendSelections:la(function(a,b){gf(this,Sa(this,a),b)}),extendSelectionsBy:la(function(a,b){a=B(this.sel.ranges,a);gf(this,Sa(this,a),b)}),setSelections:la(function(a,b,c){if(a.length){for(var d=[],f=0;f<a.length;f++)d[f]=new Z(N(this,a[f].anchor),N(this,a[f].head));null==b&&(b=Math.min(a.length-1,this.sel.primIndex));oa(this,Ha(d,b),c)}}),addSelection:la(function(a,b,c){var d=this.sel.ranges.slice(0);d.push(new Z(N(this,a),N(this,b||a)));oa(this,Ha(d,d.length-
1),c)}),getSelection:function(a){for(var b=this.sel.ranges,c,d=0;d<b.length;d++){var f=T(this,b[d].from(),b[d].to());c=c?c.concat(f):f}return!1===a?c:c.join(a||this.lineSeparator())},getSelections:function(a){for(var b=[],c=this.sel.ranges,d=0;d<c.length;d++){var f=T(this,c[d].from(),c[d].to());!1!==a&&(f=f.join(a||this.lineSeparator()));b[d]=f}return b},replaceSelection:function(a,b,c){for(var d=[],f=0;f<this.sel.ranges.length;f++)d[f]=a;this.replaceSelections(d,b,c||"+input")},replaceSelections:la(function(a,
b,c){for(var d=[],f=this.sel,e=0;e<f.ranges.length;e++){var g=f.ranges[e];d[e]={from:g.from(),to:g.to(),text:this.splitLines(a[e]),origin:c}}if(a=b&&"end"!=b){a=[];f=c=J(this.first,0);for(e=0;e<d.length;e++){var k=d[e];g=Ze(k.from,c,f);var m=Ze(Ya(k),c,f);c=k.to;f=m;"around"==b?(k=this.sel.ranges[e],k=0>O(k.head,k.anchor),a[e]=new Z(k?m:g,k?g:m)):a[e]=new Z(g,g)}a=new za(a,this.sel.primIndex)}b=a;for(a=d.length-1;0<=a;a--)Bb(this,d[a]);b?hf(this,b):this.cm&&wb(this.cm)}),undo:la(function(){Pc(this,
"undo")}),redo:la(function(){Pc(this,"redo")}),undoSelection:la(function(){Pc(this,"undo",!0)}),redoSelection:la(function(){Pc(this,"redo",!0)}),setExtending:function(a){this.extend=a},getExtending:function(){return this.extend},historySize:function(){for(var a=this.history,b=0,c=0,d=0;d<a.done.length;d++)a.done[d].ranges||++b;for(d=0;d<a.undone.length;d++)a.undone[d].ranges||++c;return{undo:b,redo:c}},clearHistory:function(){this.history=new Lc(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:zb(this.history.done),undone:zb(this.history.undone)}},setHistory:function(a){var b=this.history=new Lc(this.history.maxGeneration);b.done=zb(a.done.slice(0),null,!0);b.undone=zb(a.undone.slice(0),null,!0)},setGutterMarker:la(function(a,
b,c){return bc(this,a,"gutter",function(a){var d=a.gutterMarkers||(a.gutterMarkers={});d[b]=c;!c&&H(d)&&(a.gutterMarkers=null);return!0})}),clearGutter:la(function(a){var b=this;this.iter(function(c){c.gutterMarkers&&c.gutterMarkers[a]&&bc(b,c,"gutter",function(){c.gutterMarkers[a]=null;H(c.gutterMarkers)&&(c.gutterMarkers=null);return!0})})}),lineInfo:function(a){if("number"==typeof a){if(!X(this,a))return null;var b=a;a=K(this,a);if(!a)return null}else if(b=L(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:la(function(a,b,d){return bc(this,a,"gutter"==b?"gutter":"class",function(a){var f="text"==b?"textClass":"background"==b?"bgClass":"gutter"==b?"gutterClass":"wrapClass";if(a[f]){if(c(d).test(a[f]))return!1;a[f]+=" "+d}else a[f]=d;return!0})}),removeLineClass:la(function(a,b,d){return bc(this,a,"gutter"==b?"gutter":"class",function(a){var f="text"==b?"textClass":
"background"==b?"bgClass":"gutter"==b?"gutterClass":"wrapClass",e=a[f];if(e)if(null==d)a[f]=null;else{var g=e.match(c(d));if(!g)return!1;var k=g.index+g[0].length;a[f]=e.slice(0,g.index)+(g.index&&k!=e.length?" ":"")+e.slice(k)||null}else return!1;return!0})}),addLineWidget:la(function(a,b,c){return Eg(this,a,b,c)}),removeLineWidget:function(a){a.clear()},markText:function(a,b,c){return Db(this,N(this,a),N(this,b),c,c&&c.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=N(this,a);return Db(this,a,a,b,"bookmark")},findMarksAt:function(a){a=N(this,a);var b=[],c=K(this,a.line).markedSpans;if(c)for(var d=0;d<c.length;++d){var f=c[d];(null==f.from||f.from<=a.ch)&&(null==f.to||f.to>=a.ch)&&b.push(f.marker.parent||f.marker)}return b},findMarks:function(a,b,c){a=N(this,a);b=N(this,b);var d=[],f=a.line;this.iter(a.line,b.line+1,function(e){if(e=e.markedSpans)for(var g=
0;g<e.length;g++){var k=e[g];null!=k.to&&f==a.line&&a.ch>=k.to||null==k.from&&f!=a.line||null!=k.from&&f==b.line&&k.from>=b.ch||c&&!c(k.marker)||d.push(k.marker.parent||k.marker)}++f});return d},getAllMarks:function(){var a=[];this.iter(function(b){if(b=b.markedSpans)for(var c=0;c<b.length;++c)null!=b[c].from&&a.push(b[c].marker)});return a},posFromIndex:function(a){var b,c=this.first,d=this.lineSeparator().length;this.iter(function(f){f=f.text.length+d;if(f>a)return b=a,!0;a-=f;++c});return N(this,
J(c,b))},indexFromPos:function(a){a=N(this,a);var b=a.ch;if(a.line<this.first||0>a.ch)return 0;var c=this.lineSeparator().length;this.iter(this.first,a.line,function(a){b+=a.text.length+c});return b},copy:function(a){var b=new ua(V(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,c=this.first+this.size;null!=a.from&&a.from>b&&(b=a.from);null!=a.to&&a.to<c&&(c=a.to);b=new ua(V(this,b,c),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=wf(this);for(c=0;c<a.length;c++){var d=a[c],f=d.find(),e=b.clipPos(f.from);f=b.clipPos(f.to);O(e,f)&&(e=Db(b,e,f,d.primary,d.primary.type),d.markers.push(e),
e.parent=d)}return b},unlinkDoc:function(a){a instanceof ca&&(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);Gg(wf(this));break}if(a.history==this.history){var c=[a.id];nb(a,function(a){return c.push(a.id)},!0);a.history=new Lc(null);a.history.done=zb(this.history.done,c);a.history.undone=zb(this.history.undone,c)}},iterLinkedDocs:function(a){nb(this,a)},getMode:function(){return this.mode},getEditor:function(){return this.cm},
splitLines:function(a){return this.lineSep?a.split(this.lineSep):Td(a)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:la(function(a){"rtl"!=a&&(a="ltr");a!=this.direction&&(this.direction=a,this.iter(function(a){return a.order=null}),this.cm&&Ag(this.cm))})});ua.prototype.eachLine=ua.prototype.iter;for(var yf=0,Pf=!1,$a={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"},sc=0;10>sc;sc++)$a[sc+48]=$a[sc+96]=String(sc);for(var Wc=65;90>=Wc;Wc++)$a[Wc]=String.fromCharCode(Wc);
for(var tc=1;12>=tc;tc++)$a[tc+111]=$a[tc+63235]="F"+tc;var gc={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"]}};gc["default"]=Da?gc.macDefault:gc.pcDefault;var hc={selectAll:nf,singleSelection:function(a){return a.setSelection(a.getCursor("anchor"),a.getCursor("head"),La)},killLine:function(a){return Fb(a,function(b){if(b.empty()){var c=K(a.doc,b.head.line).text.length;return b.head.ch==c&&b.head.line<a.lastLine()?{from:b.head,to:J(b.head.line+
1,0)}:{from:b.head,to:J(b.head.line,c)}}return{from:b.from(),to:b.to()}})},deleteLine:function(a){return Fb(a,function(b){return{from:J(b.from().line,0),to:N(a.doc,J(b.to().line+1,0))}})},delLineLeft:function(a){return Fb(a,function(a){return{from:J(a.from().line,0),to:a.from()}})},delWrappedLineLeft:function(a){return Fb(a,function(b){var c=a.charCoords(b.head,"div").top+5;return{from:a.coordsChar({left:0,top:c},"div"),to:b.from()}})},delWrappedLineRight:function(a){return Fb(a,function(b){var c=
a.charCoords(b.head,"div").top+5;c=a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:c},"div");return{from:b.from(),to:c}})},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(J(a.firstLine(),0))},goDocEnd:function(a){return a.extendSelection(J(a.lastLine()))},goLineStart:function(a){return a.extendSelectionsBy(function(b){return Ef(a,
b.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(a){return a.extendSelectionsBy(function(b){return Ff(a,b.head)},{origin:"+move",bias:1})},goLineEnd:function(a){return a.extendSelectionsBy(function(b){b=b.head.line;var c=K(a.doc,b);var d=c;for(var f;f=Ma(d,!1);)d=f.find(1,!0).line;d!=c&&(b=L(d));return Md(!0,a,c,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")},qc)},goLineLeft:function(a){return a.extendSelectionsBy(function(b){b=a.cursorCoords(b.head,"div").top+5;return a.coordsChar({left:0,top:b},"div")},qc)},goLineLeftSmart:function(a){return a.extendSelectionsBy(function(b){var c=a.cursorCoords(b.head,"div").top+5;c=a.coordsChar({left:0,top:c},"div");return c.ch<a.getLine(c.line).search(/\S/)?Ff(a,b.head):c},qc)},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,f=0;f<c.length;f++){var e=c[f].from();e=g(a.getLine(e.line),e.ch,d);b.push(k(d-e%d))}a.replaceSelections(b)},defaultTab:function(a){a.somethingSelected()?a.indentSelection("add"):a.execCommand("insertTab")},transposeChars:function(a){return va(a,function(){for(var b=a.listSelections(),c=[],d=0;d<b.length;d++)if(b[d].empty()){var f=b[d].head,e=K(a.doc,f.line).text;if(e)if(f.ch==e.length&&(f=new J(f.line,f.ch-1)),0<f.ch)f=
new J(f.line,f.ch+1),a.replaceRange(e.charAt(f.ch-1)+e.charAt(f.ch-2),J(f.line,f.ch-2),f,"+transpose");else if(f.line>a.doc.first){var g=K(a.doc,f.line-1).text;g&&(f=new J(f.line,1),a.replaceRange(e.charAt(0)+a.doc.lineSeparator()+g.charAt(g.length-1),J(f.line-1,g.length-1),f,"+transpose"))}c.push(new Z(f,f))}a.setSelections(c)})},newlineAndIndent:function(a){return va(a,function(){for(var b=a.listSelections(),c=b.length-1;0<=c;c--)a.replaceRange(a.doc.lineSeparator(),b[c].anchor,b[c].head,"+input");
b=a.listSelections();for(c=0;c<b.length;c++)a.indentLine(b[c].from().line,null,!0);wb(a)})},openLine:function(a){return a.replaceSelection("\n","start")},toggleOverwrite:function(a){return a.toggleOverwrite()}},Og=new ob,Nd=null,Od=function(a,b,c){this.time=a;this.pos=b;this.button=c};Od.prototype.compare=function(a,b,c){return this.time+400>a&&0==O(b,this.pos)&&c==this.button};var kc,jc,Gb={toString:function(){return"CodeMirror.Init"}},Of={},Uc={};ca.defaults=Of;ca.optionHandlers=Uc;var Rd=[];ca.defineInitHook=
function(a){return Rd.push(a)};var wa=null,aa=function(a){this.cm=a;this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null;this.polling=new ob;this.composing=null;this.gracePeriod=!1;this.readDOMTimeout=null};aa.prototype.init=function(a){function b(a){if(!ja(f,a)){if(f.somethingSelected())wa={lineWise:!1,text:f.getSelections()},"cut"==a.type&&f.replaceSelection("",null,"cut");else if(f.options.lineWiseCopyCut){var b=Tf(f);wa={lineWise:!0,text:b.text};"cut"==a.type&&
f.operation(function(){f.setSelections(b.ranges,0,La);f.replaceSelection("",null,"cut")})}else return;if(a.clipboardData){a.clipboardData.clearData();var c=wa.text.join("\n");a.clipboardData.setData("Text",c);if(a.clipboardData.getData("Text")==c){a.preventDefault();return}}var g=Vf();a=g.firstChild;f.display.lineSpace.insertBefore(g,f.display.lineSpace.firstChild);a.value=wa.text.join("\n");var k=document.activeElement;pc(a);setTimeout(function(){f.display.lineSpace.removeChild(g);k.focus();k==e&&
d.showPrimarySelection()},50)}}var c=this,d=this,f=d.cm,e=d.div=a.lineDiv;Uf(e,f.options.spellcheck);R(e,"paste",function(a){ja(f,a)||Sf(a,f)||11>=ba&&setTimeout(ka(f,function(){return c.updateFromDOM()}),20)});R(e,"compositionstart",function(a){c.composing={data:a.data,done:!1}});R(e,"compositionupdate",function(a){c.composing||(c.composing={data:a.data,done:!1})});R(e,"compositionend",function(a){c.composing&&(a.data!=c.composing.data&&c.readFromDOMSoon(),c.composing.done=!0)});R(e,"touchstart",
function(){return d.forceCompositionEnd()});R(e,"input",function(){c.composing||c.readFromDOMSoon()});R(e,"copy",b);R(e,"cut",b)};aa.prototype.prepareSelection=function(){var a=He(this.cm,!1);a.focus=this.cm.state.focused;return a};aa.prototype.showSelection=function(a,b){a&&this.cm.display.view.length&&((a.focus||b)&&this.showPrimarySelection(),this.showMultipleSelections(a))};aa.prototype.showPrimarySelection=function(){var a=window.getSelection(),b=this.cm,c=b.doc.sel.primary(),d=c.from();c=c.to();
if(b.display.viewTo==b.display.viewFrom||d.line>=b.display.viewTo||c.line<b.display.viewFrom)a.removeAllRanges();else{var f=Vc(b,a.anchorNode,a.anchorOffset),e=Vc(b,a.focusNode,a.focusOffset);if(!f||f.bad||!e||e.bad||0!=O(ea(f,e),d)||0!=O(Oa(f,e),c))if(f=b.display.view,d=d.line>=b.display.viewFrom&&Xf(b,d)||{node:f[0].measure.map[2],offset:0},c=c.line<b.display.viewTo&&Xf(b,c),c||(c=f[f.length-1].measure,c=c.maps?c.maps[c.maps.length-1]:c.map,c={node:c[c.length-1],offset:c[c.length-2]-c[c.length-
3]}),d&&c){f=a.rangeCount&&a.getRangeAt(0);try{var g=Ob(d.node,d.offset,c.offset,c.node)}catch(lh){}g&&(!Ua&&b.state.focused?(a.collapse(d.node,d.offset),g.collapsed||(a.removeAllRanges(),a.addRange(g))):(a.removeAllRanges(),a.addRange(g)),f&&null==a.anchorNode?a.addRange(f):Ua&&this.startGracePeriod());this.rememberSelection()}else a.removeAllRanges()}};aa.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)};aa.prototype.showMultipleSelections=function(a){r(this.cm.display.cursorDiv,a.cursors);r(this.cm.display.selectionDiv,a.selection)};aa.prototype.rememberSelection=function(){var a=window.getSelection();this.lastAnchorNode=a.anchorNode;this.lastAnchorOffset=a.anchorOffset;this.lastFocusNode=a.focusNode;this.lastFocusOffset=a.focusOffset};aa.prototype.selectionInEditor=function(){var a=window.getSelection();if(!a.rangeCount)return!1;
a=a.getRangeAt(0).commonAncestorContainer;return l(this.div,a)};aa.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()||this.showSelection(this.prepareSelection(),!0),this.div.focus())};aa.prototype.blur=function(){this.div.blur()};aa.prototype.getField=function(){return this.div};aa.prototype.supportsTouch=function(){return!0};aa.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():va(this.cm,function(){return b.cm.curOp.selectionChanged=!0});this.polling.set(this.cm.options.pollInterval,a)};aa.prototype.selectionChanged=function(){var a=window.getSelection();return a.anchorNode!=this.lastAnchorNode||a.anchorOffset!=this.lastAnchorOffset||a.focusNode!=this.lastFocusNode||a.focusOffset!=this.lastFocusOffset};aa.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var a=
window.getSelection(),b=this.cm;if(Cc&&Bc&&this.cm.options.gutters.length&&ch(a.anchorNode))this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();else if(!this.composing){this.rememberSelection();var c=Vc(b,a.anchorNode,a.anchorOffset),d=Vc(b,a.focusNode,a.focusOffset);c&&d&&va(b,function(){oa(b.doc,Ra(c,d),La);if(c.bad||d.bad)b.curOp.selectionChanged=!0})}}};aa.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),
this.readDOMTimeout=null);var a=this.cm,b=a.display,c=a.doc.sel.primary(),d=c.from(),f=c.to();0==d.ch&&d.line>a.firstLine()&&(d=J(d.line-1,K(a.doc,d.line-1).length));f.ch==K(a.doc,f.line).text.length&&f.line<a.lastLine()&&(f=J(f.line+1,0));if(d.line<b.viewFrom||f.line>b.viewTo-1)return!1;var e;d.line==b.viewFrom||0==(e=eb(a,d.line))?(c=L(b.view[0].line),e=b.view[0].node):(c=L(b.view[e].line),e=b.view[e-1].node.nextSibling);var g=eb(a,f.line);g==b.view.length-1?(f=b.viewTo-1,b=b.lineDiv.lastChild):
(f=L(b.view[g+1].line)-1,b=b.view[g+1].node.previousSibling);if(!e)return!1;b=a.doc.splitLines(dh(a,e,b,c,f));for(e=T(a.doc,J(c,0),J(f,K(a.doc,f).text.length));1<b.length&&1<e.length;)if(n(b)==n(e))b.pop(),e.pop(),f--;else if(b[0]==e[0])b.shift(),e.shift(),c++;else break;var k=0;g=0;for(var m=b[0],l=e[0],q=Math.min(m.length,l.length);k<q&&m.charCodeAt(k)==l.charCodeAt(k);)++k;m=n(b);l=n(e);for(q=Math.min(m.length-(1==b.length?k:0),l.length-(1==e.length?k:0));g<q&&m.charCodeAt(m.length-g-1)==l.charCodeAt(l.length-
g-1);)++g;if(1==b.length&&1==e.length&&c==d.line)for(;k&&k>d.ch&&m.charCodeAt(m.length-g-1)==l.charCodeAt(l.length-g-1);)k--,g++;b[b.length-1]=m.slice(0,m.length-g).replace(/^\u200b+/,"");b[0]=b[0].slice(k).replace(/\u200b+$/,"");d=J(c,k);c=J(f,e.length?n(e).length-g:0);if(1<b.length||b[0]||O(d,c))return Cb(a.doc,b,d,c,"+input"),!0};aa.prototype.ensurePolled=function(){this.forceCompositionEnd()};aa.prototype.reset=function(){this.forceCompositionEnd()};aa.prototype.forceCompositionEnd=function(){this.composing&&
(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())};aa.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))};aa.prototype.updateFromDOM=function(){var a=this;!this.cm.isReadOnly()&&this.pollContent()||va(this.cm,function(){return ta(a.cm)})};aa.prototype.setUneditable=
function(a){a.contentEditable="false"};aa.prototype.onKeyPress=function(a){0!=a.charCode&&(a.preventDefault(),this.cm.isReadOnly()||ka(this.cm,Sd)(this.cm,String.fromCharCode(null==a.charCode?a.keyCode:a.charCode),0))};aa.prototype.readOnlyChanged=function(a){this.div.contentEditable=String("nocursor"!=a)};aa.prototype.onContextMenu=function(){};aa.prototype.resetPosition=function(){};aa.prototype.needsContentAttribute=!0;var ia=function(a){this.cm=a;this.prevInput="";this.pollingFast=!1;this.polling=
new ob;this.hasSelection=!1;this.composing=null};ia.prototype.init=function(a){function b(a){if(!ja(f,a)){if(f.somethingSelected())wa={lineWise:!1,text:f.getSelections()};else if(f.options.lineWiseCopyCut){var b=Tf(f);wa={lineWise:!0,text:b.text};"cut"==a.type?f.setSelections(b.ranges,null,La):(d.prevInput="",g.value=b.text.join("\n"),pc(g))}else return;"cut"==a.type&&(f.state.cutIncoming=!0)}}var c=this,d=this,f=this.cm,e=this.wrapper=Vf(),g=this.textarea=e.firstChild;a.wrapper.insertBefore(e,a.wrapper.firstChild);
nc&&(g.style.width="0px");R(g,"input",function(){W&&9<=ba&&c.hasSelection&&(c.hasSelection=null);d.poll()});R(g,"paste",function(a){ja(f,a)||Sf(a,f)||(f.state.pasteIncoming=!0,d.fastPoll())});R(g,"cut",b);R(g,"copy",b);R(a.scroller,"paste",function(b){Qa(a,b)||ja(f,b)||(f.state.pasteIncoming=!0,d.focus())});R(a.lineSpace,"selectstart",function(b){Qa(a,b)||qa(b)});R(g,"compositionstart",function(){var a=f.getCursor("from");d.composing&&d.composing.range.clear();d.composing={start:a,range:f.markText(a,
f.getCursor("to"),{className:"CodeMirror-composing"})}});R(g,"compositionend",function(){d.composing&&(d.poll(),d.composing.range.clear(),d.composing=null)})};ia.prototype.prepareSelection=function(){var a=this.cm,b=a.display,c=a.doc,d=He(a);if(a.options.moveInputWithCursor){a=Fa(a,c.sel.primary().head,"div");c=b.wrapper.getBoundingClientRect();var f=b.lineDiv.getBoundingClientRect();d.teTop=Math.max(0,Math.min(b.wrapper.clientHeight-10,a.top+f.top-c.top));d.teLeft=Math.max(0,Math.min(b.wrapper.clientWidth-
10,a.left+f.left-c.left))}return d};ia.prototype.showSelection=function(a){var b=this.cm.display;r(b.cursorDiv,a.cursors);r(b.selectionDiv,a.selection);null!=a.teTop&&(this.wrapper.style.top=a.teTop+"px",this.wrapper.style.left=a.teLeft+"px")};ia.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&&pc(this.textarea),W&&9<=ba&&(this.hasSelection=a)):a||(this.prevInput=
this.textarea.value="",W&&9<=ba&&(this.hasSelection=null))}};ia.prototype.getField=function(){return this.textarea};ia.prototype.supportsTouch=function(){return!1};ia.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!Kb||w()!=this.textarea))try{this.textarea.focus()}catch(u){}};ia.prototype.blur=function(){this.textarea.blur()};ia.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0};ia.prototype.receivedFocus=function(){this.slowPoll()};ia.prototype.slowPoll=
function(){var a=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){a.poll();a.cm.state.focused&&a.slowPoll()})};ia.prototype.fastPoll=function(){function a(){c.poll()||b?(c.pollingFast=!1,c.slowPoll()):(b=!0,c.polling.set(60,a))}var b=!1,c=this;c.pollingFast=!0;c.polling.set(20,a)};ia.prototype.poll=function(){var a=this,b=this.cm,c=this.textarea,d=this.prevInput;if(this.contextMenuPending||!b.state.focused||ih(c)&&!d&&!this.composing||b.isReadOnly()||b.options.disableInput||
b.state.keySeq)return!1;var f=c.value;if(f==d&&!b.somethingSelected())return!1;if(W&&9<=ba&&this.hasSelection===f||Da&&/[\uf700-\uf7ff]/.test(f))return b.display.input.reset(),!1;if(b.doc.sel==b.display.selForContextMenu){var e=f.charCodeAt(0);8203!=e||d||(d="\u200b");if(8666==e)return this.reset(),this.cm.execCommand("undo")}var g=0;for(e=Math.min(d.length,f.length);g<e&&d.charCodeAt(g)==f.charCodeAt(g);)++g;va(b,function(){Sd(b,f.slice(g),d.length-g,null,a.composing?"*compose":null);1E3<f.length||
-1<f.indexOf("\n")?c.value=a.prevInput="":a.prevInput=f;a.composing&&(a.composing.range.clear(),a.composing.range=b.markText(a.composing.start,b.getCursor("to"),{className:"CodeMirror-composing"}))});return!0};ia.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)};ia.prototype.onKeyPress=function(){W&&9<=ba&&(this.hasSelection=null);this.fastPoll()};ia.prototype.onContextMenu=function(a){function b(){if(null!=g.selectionStart){var a=f.somethingSelected(),b="\u200b"+
(a?g.value:"");g.value="\u21da";g.value=b;d.prevInput=a?"":"\u200b";g.selectionStart=1;g.selectionEnd=b.length;e.selForContextMenu=f.doc.sel}}function c(){d.contextMenuPending=!1;d.wrapper.style.cssText=q;g.style.cssText=l;W&&9>ba&&e.scrollbars.setScrollTop(e.scroller.scrollTop=m);if(null!=g.selectionStart){(!W||W&&9>ba)&&b();var a=0,c=function(){e.selForContextMenu==f.doc.sel&&0==g.selectionStart&&0<g.selectionEnd&&"\u200b"==d.prevInput?ka(f,nf)(f):10>a++?e.detectingSelectAll=setTimeout(c,500):(e.selForContextMenu=
null,e.input.reset())};e.detectingSelectAll=setTimeout(c,200)}}var d=this,f=d.cm,e=f.display,g=d.textarea,k=ib(f,a),m=e.scroller.scrollTop;if(k&&!Ga){f.options.resetSelectionOnContextMenu&&-1==f.doc.sel.contains(k)&&ka(f,oa)(f.doc,Ra(k),La);var l=g.style.cssText,q=d.wrapper.style.cssText;d.wrapper.style.cssText="position: absolute";k=d.wrapper.getBoundingClientRect();g.style.cssText="position: absolute; width: 30px; height: 30px;\n      top: "+(a.clientY-k.top-5)+"px; left: "+(a.clientX-k.left-5)+
"px;\n      z-index: 1000; background: "+(W?"rgba(255, 255, 255, .05)":"transparent")+";\n      outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";if(pa)var h=window.scrollY;e.input.focus();pa&&window.scrollTo(null,h);e.input.reset();f.somethingSelected()||(g.value=d.prevInput=" ");d.contextMenuPending=!0;e.selForContextMenu=f.doc.sel;clearTimeout(e.detectingSelectAll);W&&9<=ba&&b();if(Pd){Mb(a);var t=function(){xa(window,"mouseup",t);setTimeout(c,
20)};R(window,"mouseup",t)}else setTimeout(c,50)}};ia.prototype.readOnlyChanged=function(a){a||this.reset();this.textarea.disabled="nocursor"==a};ia.prototype.setUneditable=function(){};ia.prototype.needsContentAttribute=!1;(function(a){function b(b,d,f,e){a.defaults[b]=d;f&&(c[b]=e?function(a,b,c){c!=Gb&&f(a,b,c)}:f)}var c=a.optionHandlers;a.defineOption=b;a.Init=Gb;b("value","",function(a,b){return a.setValue(b)},!0);b("mode",null,function(a,b){a.doc.modeOption=b;Ed(a)},!0);b("indentUnit",2,Ed,
!0);b("indentWithTabs",!1);b("smartIndent",!0);b("tabSize",4,function(a){$b(a);Tb(a);ta(a)},!0);b("lineSeparator",null,function(a,b){if(a.doc.lineSep=b){var c=[],d=a.doc.first;a.doc.iter(function(a){for(var f=0;;){var e=a.text.indexOf(b,f);if(-1==e)break;f=e+b.length;c.push(J(d,e))}d++});for(var f=c.length-1;0<=f;f--)Cb(a.doc,b,c[f],J(c[f].line,c[f].ch+b.length))}});b("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(a,b,c){a.state.specialChars=new RegExp(b.source+
(b.test("\t")?"":"|\t"),"g");c!=Gb&&a.refresh()});b("specialCharPlaceholder",ng,function(a){return a.refresh()},!0);b("electricChars",!0);b("inputStyle",Kb?"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",!hh);b("wholeLineUpdateBefore",!0);b("theme","default",function(a){Nf(a);lc(a)},!0);b("keyMap","default",function(a,b,c){b=Qc(b);(c=c!=
Gb&&Qc(c))&&c.detach&&c.detach(a,b);b.attach&&b.attach(a,c||null)});b("extraKeys",null);b("configureMouse",null);b("lineWrapping",!1,ah,!0);b("gutters",[],function(a){Cd(a.options);lc(a)},!0);b("fixedGutter",!0,function(a,b){a.display.gutters.style.left=b?sd(a.display)+"px":"0";a.refresh()},!0);b("coverGutterNextToScrollbar",!1,function(a){return xb(a)},!0);b("scrollbarStyle","native",function(a){Re(a);xb(a);a.display.scrollbars.setScrollTop(a.doc.scrollTop);a.display.scrollbars.setScrollLeft(a.doc.scrollLeft)},
!0);b("lineNumbers",!1,function(a){Cd(a.options);lc(a)},!0);b("firstLineNumber",1,lc,!0);b("lineNumberFormatter",function(a){return a},lc,!0);b("showCursorWhenSelecting",!1,Ub,!0);b("resetSelectionOnContextMenu",!0);b("lineWiseCopyCut",!0);b("pasteLinesPerSelection",!0);b("readOnly",!1,function(a,b){"nocursor"==b&&(Vb(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,$g);b("allowDropFileTypes",null);b("cursorBlinkRate",
530);b("cursorScrollMargin",0);b("cursorHeight",1,Ub,!0);b("singleCursorHeightPerLine",!0,Ub,!0);b("workTime",100);b("workDelay",100);b("flattenSpans",!0,$b,!0);b("addModeClass",!1,$b,!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,$b,!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)})(ca);(function(a){var b=a.optionHandlers,c=a.helpers={};a.prototype={constructor:a,focus:function(){window.focus();this.display.input.focus()},setOption:function(a,c){var d=this.options,f=d[a];if(d[a]!=c||"mode"==a)d[a]=c,b.hasOwnProperty(a)&&ka(this,b[a])(this,c,f),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"](Qc(a))},removeKeyMap:function(a){for(var b=this.state.keyMaps,c=0;c<b.length;++c)if(b[c]==a||b[c].name==a)return b.splice(c,1),!0},addOverlay:ra(function(b,c){var d=b.token?b:a.getMode(this.options,b);if(d.startState)throw Error("Overlays may not be stateful.");E(this.state.overlays,{mode:d,modeSpec:b,opaque:c&&c.opaque,priority:c&&c.priority||0},function(a){return a.priority});this.state.modeGen++;ta(this)}),removeOverlay:ra(function(a){for(var b=
this.state.overlays,c=0;c<b.length;++c){var d=b[c].modeSpec;if(d==a||"string"==typeof a&&d.name==a){b.splice(c,1);this.state.modeGen++;ta(this);break}}}),indentLine:ra(function(a,b,c){"string"!=typeof b&&"number"!=typeof b&&(b=null==b?this.options.smartIndent?"smart":"prev":b?"add":"subtract");X(this.doc,a)&&mc(this,a,b,c)}),indentSelection:ra(function(a){for(var b=this.doc.sel.ranges,c=-1,d=0;d<b.length;d++){var f=b[d];if(f.empty())f.head.line>c&&(mc(this,f.head.line,a,!0),c=f.head.line,d==this.doc.sel.primIndex&&
wb(this));else{var e=f.from();f=f.to();var g=Math.max(c,e.line);c=Math.min(this.lastLine(),f.line-(f.ch?0:1))+1;for(f=g;f<c;++f)mc(this,f,a);f=this.doc.sel.ranges;0==e.ch&&b.length==f.length&&0<f[d].from().ch&&Id(this.doc,d,new Z(e,f[d].to()),La)}}}),getTokenAt:function(a,b){return ie(this,a,b)},getLineTokens:function(a,b){return ie(this,J(a),b,!0)},getTokenTypeAt:function(a){a=N(this.doc,a);var b=ge(this,K(this.doc,a.line)),c=0,d=(b.length-1)/2;a=a.ch;if(0==a)b=b[2];else for(;;){var f=c+d>>1;if((f?
b[2*f-1]:0)>=a)d=f;else if(b[2*f+1]<a)c=f+1;else{b=b[2*f+2];break}}c=b?b.indexOf("overlay "):-1;return 0>c?b:0==c?null:b.slice(0,c-1)},getModeAt:function(b){var c=this.doc.mode;return c.innerMode?a.innerMode(c,this.getTokenAt(b).state).mode:c},getHelper:function(a,b){return this.getHelpers(a,b)[0]},getHelpers:function(a,b){var f=[];if(!c.hasOwnProperty(b))return f;var e=c[b];a=this.getModeAt(a);if("string"==typeof a[b])e[a[b]]&&f.push(e[a[b]]);else if(a[b])for(var g=0;g<a[b].length;g++){var k=e[a[b][g]];
k&&f.push(k)}else a.helperType&&e[a.helperType]?f.push(e[a.helperType]):e[a.name]&&f.push(e[a.name]);for(b=0;b<e._global.length;b++)g=e._global[b],g.pred(a,this)&&-1==d(f,g.val)&&f.push(g.val);return f},getStateAfter:function(a,b){var c=this.doc;a=Math.max(c.first,Math.min(null==a?c.first+c.size-1:a,c.first+c.size-1));return Nb(this,a+1,b).state},cursorCoords:function(a,b){var c=this.doc.sel.primary();a=null==a?c.head:"object"==typeof a?N(this.doc,a):a?c.from():c.to();return Fa(this,a,b||"page")},
charCoords:function(a,b){return od(this,N(this.doc,a),b||"page")},coordsChar:function(a,b){a=Ce(this,a,b||"page");return qd(this,a.left,a.top)},lineAtHeight:function(a,b){a=Ce(this,{top:a,left:0},b||"page").top;return Q(this.doc,a+this.display.viewOffset)},heightAtLine:function(a,b,c){var d=!1;if("number"==typeof a){var f=this.doc.first+this.doc.size-1;a<this.doc.first?a=this.doc.first:a>f&&(a=f,d=!0);a=K(this.doc,a)}return Dc(this,a,{top:0,left:0},b||"page",c||d).top+(d?this.doc.height-Ia(a):0)},
defaultTextHeight:function(){return gb(this.display)},defaultCharWidth:function(){return Sb(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(a,b,c,d,f){var e=this.display;a=Fa(this,N(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);e.sizer.appendChild(b);if("over"==d)g=a.top;else if("above"==d||"near"==d){var m=Math.max(e.wrapper.clientHeight,
this.doc.height),l=Math.max(e.sizer.clientWidth,e.lineSpace.clientWidth);("above"==d||a.bottom+b.offsetHeight>m)&&a.top>b.offsetHeight?g=a.top-b.offsetHeight:a.bottom+b.offsetHeight<=m&&(g=a.bottom);k+b.offsetWidth>l&&(k=l-b.offsetWidth)}b.style.top=g+"px";b.style.left=b.style.right="";"right"==f?(k=e.sizer.clientWidth-b.offsetWidth,b.style.right="0px"):("left"==f?k=0:"middle"==f&&(k=(e.sizer.clientWidth-b.offsetWidth)/2),b.style.left=k+"px");c&&(a=yd(this,{left:k,top:g,right:k+b.offsetWidth,bottom:g+
b.offsetHeight}),null!=a.scrollTop&&Xb(this,a.scrollTop),null!=a.scrollLeft&&kb(this,a.scrollLeft))},triggerOnKeyDown:ra(Hf),triggerOnKeyPress:ra(Jf),triggerOnKeyUp:If,triggerOnMouseDown:ra(Kf),execCommand:function(a){if(hc.hasOwnProperty(a))return hc[a].call(null,this)},triggerElectric:ra(function(a){Rf(this,a)}),findPosH:function(a,b,c,d){var f=1;0>b&&(f=-1,b=-b);a=N(this.doc,a);for(var e=0;e<b&&(a=Ud(this.doc,a,f,c,d),!a.hitSide);++e);return a},moveH:ra(function(a,b){var c=this;this.extendSelectionsBy(function(d){return c.display.shift||
c.doc.extend||d.empty()?Ud(c.doc,d.head,a,b,c.options.rtlMoveVisually):0>a?d.from():d.to()},qc)}),deleteH:ra(function(a,b){var c=this.doc;this.doc.sel.somethingSelected()?c.replaceSelection("",null,"+delete"):Fb(this,function(d){var f=Ud(c,d.head,a,b,!1);return 0>a?{from:f,to:d.head}:{from:d.head,to:f}})}),findPosV:function(a,b,c,d){var f=1;0>b&&(f=-1,b=-b);var e=N(this.doc,a);for(a=0;a<b&&(e=Fa(this,e,"div"),null==d?d=e.left:e.left=d,e=Wf(this,e,f,c),!e.hitSide);++a);return e},moveV:ra(function(a,
b){var c=this,d=this.doc,f=[],e=!this.display.shift&&!d.extend&&d.sel.somethingSelected();d.extendSelectionsBy(function(g){if(e)return 0>a?g.from():g.to();var k=Fa(c,g.head,"div");null!=g.goalColumn&&(k.left=g.goalColumn);f.push(k.left);var m=Wf(c,k,a,b);"page"==b&&g==d.sel.primary()&&Gc(c,od(c,m,"div").top-k.top);return m},qc);if(f.length)for(var g=0;g<d.sel.ranges.length;g++)d.sel.ranges[g].goalColumn=f[g]}),findWordAt:function(a){var b=K(this.doc,a.line).text,c=a.ch,d=a.ch;if(b){var f=this.getHelper(a,
"wordChars");"before"!=a.sticky&&d!=b.length||!c?++d:--c;var e=b.charAt(c);for(e=A(e,f)?function(a){return A(a,f)}:/\s/.test(e)?function(a){return/\s/.test(a)}:function(a){return!/\s/.test(a)&&!A(a)};0<c&&e(b.charAt(c-1));)--c;for(;d<b.length&&e(b.charAt(d));)++d}return new Z(J(a.line,c),J(a.line,d))},toggleOverwrite:function(a){if(null==a||a!=this.state.overwrite)(this.state.overwrite=!this.state.overwrite)?v(this.display.cursorDiv,"CodeMirror-overwrite"):jb(this.display.cursorDiv,"CodeMirror-overwrite"),
fa(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==w()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:ra(function(a,b){Wb(this,a,b)}),getScrollInfo:function(){var a=this.display.scroller;return{left:a.scrollLeft,top:a.scrollTop,height:a.scrollHeight-Ka(this)-this.display.barHeight,width:a.scrollWidth-Ka(this)-this.display.barWidth,clientHeight:jd(this),clientWidth:db(this)}},scrollIntoView:ra(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:J(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?(Hc(this),this.curOp.scrollToPos=a):Oe(this,a.from,a.to,a.margin)}),setSize:ra(function(a,b){var c=this,d=function(a){return"number"==typeof a||/^\d+$/.test(String(a))?a+"px":a};null!=a&&(this.display.wrapper.style.width=d(a));null!=b&&(this.display.wrapper.style.height=
d(b));this.options.lineWrapping&&ze(this);var f=this.display.viewFrom;this.doc.iter(f,this.display.viewTo,function(a){if(a.widgets)for(var b=0;b<a.widgets.length;b++)if(a.widgets[b].noHScroll){Xa(c,f,"widget");break}++f});this.curOp.forceUpdate=!0;fa(this,"refresh",this)}),operation:function(a){return va(this,a)},startOperation:function(){return lb(this)},endOperation:function(){return mb(this)},refresh:ra(function(){var a=this.display.cachedTextHeight;ta(this);this.curOp.forceUpdate=!0;Tb(this);
Wb(this,this.doc.scrollLeft,this.doc.scrollTop);xd(this);(null==a||.5<Math.abs(a-gb(this.display)))&&td(this);fa(this,"refresh",this)}),swapDoc:ra(function(a){var b=this.doc;b.cm=null;af(this,a);Tb(this);this.display.input.reset();Wb(this,a.scrollLeft,a.scrollTop);this.curOp.forceScroll=!0;na(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}};sb(a);a.registerHelper=function(b,d,f){c.hasOwnProperty(b)||(c[b]=a[b]={_global:[]});c[b][d]=f};a.registerGlobalHelper=function(b,d,f,e){a.registerHelper(b,d,e);c[b]._global.push({pred:f,val:e})}})(ca);var kh="iter insert remove copy getEditor constructor".split(" "),uc;for(uc in ua.prototype)ua.prototype.hasOwnProperty(uc)&&0>d(kh,uc)&&(ca.prototype[uc]=function(a){return function(){return a.apply(this.doc,arguments)}}(ua.prototype[uc]));
sb(ua);ca.inputStyles={textarea:ia,contenteditable:aa};ca.defineMode=function(a){ca.defaults.mode||"null"==a||(ca.defaults.mode=a);fg.apply(this,arguments)};ca.defineMIME=function(a,b){tb[a]=b};ca.defineMode("null",function(){return{token:function(a){return a.skipToEnd()}}});ca.defineMIME("text/plain","null");ca.defineExtension=function(a,b){ca.prototype[a]=b};ca.defineDocExtension=function(a,b){ua.prototype[a]=b};ca.fromTextArea=function(a,b){function c(){a.value=k.getValue()}b=b?m(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 d=w();b.autofocus=d==a||null!=a.getAttribute("autofocus")&&d==document.body}if(a.form&&(R(a.form,"submit",c),!b.leaveSubmitMethodAlone)){var f=a.form;var e=f.submit;try{var g=f.submit=function(){c();f.submit=e;f.submit();f.submit=g}}catch($d){}}b.finishInit=function(b){b.save=c;b.getTextArea=function(){return a};b.toTextArea=function(){b.toTextArea=isNaN;
c();a.parentNode.removeChild(b.getWrapperElement());a.style.display="";a.form&&(xa(a.form,"submit",c),"function"==typeof a.form.submit&&(a.form.submit=e))}};a.style.display="none";var k=ca(function(b){return a.parentNode.insertBefore(b,a.nextSibling)},b);return k};(function(a){a.off=xa;a.on=R;a.wheelEventPixels=zg;a.Doc=ua;a.splitLines=Td;a.countColumn=g;a.findColumn=f;a.isWordChar=G;a.Pass=Sc;a.signal=fa;a.Line=yb;a.changeEnd=Ya;a.scrollbarModel=Se;a.Pos=J;a.cmpPos=O;a.modes=bd;a.mimeModes=tb;a.resolveMode=
yc;a.getMode=cd;a.modeExtensions=ub;a.extendMode=gg;a.copyState=cb;a.startState=de;a.innerMode=dd;a.commands=hc;a.keyMap=gc;a.keyName=Df;a.isModifierKey=Af;a.lookupKey=Eb;a.normalizeKeyMap=Lg;a.StringStream=ha;a.SharedTextMarker=fc;a.TextMarker=Za;a.LineWidget=ec;a.e_preventDefault=qa;a.e_stopPropagation=be;a.e_stop=Mb;a.addClass=v;a.contains=l;a.rmClass=jb;a.keyNames=$a})(ca);ca.version="5.31.0";return ca})},function(n,e){},function(n,e){},function(n,e,c){e.a=function(c){return new p.a(void 0===
c?1:c,h.o)};var p=c(8),h=c(2)},function(n,e,c){e.a=function(a){a=void 0===a?p.p.create():a;return new b(a,a)};var p=c(1),h=c(2),r=c(3),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}}(),b=function(){function b(a,c){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");this.value_=
a;this.defaultValue=c;this.changed=new r.a}a(b,[{key:"toJSON",value:function(){if(this.value_!==this.defaultValue)return this.value_.toString()}},{key:"restoreState",value:function(a){try{this.value=Object(h.l)(a.split(","))}catch(v){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 b}()},function(n,e,c){function p(a,b){if(!(a instanceof
b))throw new TypeError("Cannot call a class as a function");}function h(a){return a-Math.floor(a)}c.d(e,"b",function(){return t});c.d(e,"a",function(){return g});var r=c(74),a=c(122),b=c(207),l=c(3),w=c(12),v=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),t=function(){function b(a){p(this,b);this.prefix=
a;this.aName=this.prefix+"_a";this.bName=this.prefix+"_b"}v(b,[{key:"defineShader",value:function(b){var c=this.aName,d=this.bName;b.addUniform("highp vec4",c,4);b.addUniform("highp float",d,4);b.addFragmentCode(w.l);b.addFragmentCode(a.d);b.addFragmentCode(w.g);for(var f="\nvec3 "+this.prefix+"(uint64_t x) {\n  vec2 v;\n  float primeModulus = float("+r.b+");\n",e=0;2>e;++e){var g=2*e,m=2*e;f+="\n  v["+e+"] = computeHash(x,\n                        "+c+"["+m+"], "+c+"["+(m+1)+"],\n                        "+
d+"["+g+"], "+d+"["+(g+1)+"],\n                        primeModulus, 1.0 / 256.0);\n"}b.addFragmentCode(f+"\n  vec3 hsv = vec3(v.x, 0.5 + v.y * 0.5, 1.0);\n  return hsvToRgb(hsv);\n}\n")}},{key:"enable",value:function(a,b,c){a.uniform4fv(b.uniform(this.aName),c.a_);a.uniform1fv(b.uniform(this.bName),c.b_)}}]);return b}(),q=new Float32Array(2),m=new Float32Array(3),g=function(){function a(b){p(this,a);this.a_=new Float32Array(16);this.b_=new Float32Array(4);this.changed=new l.a;null==b?(this.hashFunctions=
Array(2),this.randomize_()):this.hashFunctions=b;this.computeGPUCoefficients_()}v(a,[{key:"compute",value:function(a,c){var d=c.low;c=c.high;for(var f=this.hashFunctions,e=0;2>e;++e)q[e]=h(f[e].compute(d,c)/256);Object(b.a)(a,q[0],.5+.5*q[1],1);return a}},{key:"computeCssColor",value:function(a){this.compute(m,a);return"rgb("+100*m[0]+"%,"+100*m[1]+"%,"+100*m[2]+"%)"}},{key:"debugCompute",value:function(a,b){var c=b.low;b=b.high;for(var d=this.b_,f=r.b,e=0;2>e;++e){for(var g=2*e,k=2*e,m=new Float32Array(2),
l=0;4>l;++l)m[0]+=this.a_[4*k+l]*(c>>8*l&255),m[1]+=this.a_[4*(k+1)+l]*(b>>8*l&255);k=(m[0]+m[1])%f;l=k*k%f;var q=l*d[g+1]%f,t=(d[g]+k+q)%f;console.log("b = "+d[g]+", sums="+m[0]+" "+m[1]+", dotResult="+k+", "+("prod = "+k*k+" dotResult2="+l+", y="+q+", ")+("modResult="+t));a[e]=h(1/256*t)}return a}},{key:"randomize_",value:function(){for(var a=0;2>a;++a)this.hashFunctions[a]=r.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_,c=this.b_,d=0;2>d;++d){var e=a[d],g=2*d,m=8*d;c[g]=1*e.b;c[g+1]=1*e.c;for(g=0;4>g;++g)b[m+g]=1*e.a0[g],b[m+4+g]=1*e.a1[g]}}}],[{key:"getDefault",value:function(){return new a([new r.a(Float32Array.of(609,2364,3749,2289),Float32Array.of(2840,1186,3660,1833),1718,1109),new r.a(Float32Array.of(3466,3835,3345,2040),Float32Array.of(3382,
901,18,3444),1534,1432)])}}]);return a}()},function(n,e,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function h(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 r(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)}c.d(e,"a",function(){return m});c.d(e,"c",function(){return g});c.d(e,"b",function(){return d});var a=c(74),b=c(75);n=c(0);var l=c(12),w=c(58),v=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),
t=function k(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 k(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},q=[l.o,l.l,l.d,l.h,"\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"];
e.d=q;var m=function(b){function c(a,b){p(this,c);var d=h(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));d.gl=a;d.hashTable=b;d.hashFunctions=null;d.generation=-1;d.texture=null;b=b.hashFunctions.length;d.a=new Float32Array(16*b);d.b=new Float32Array(4*b+5);d.texture=a.createTexture();return d}r(c,b);v(c,[{key:"computeCoefficients",value:function(){var b=this.hashTable,c=b.hashFunctions;if(this.hashFunctions!==c){this.hashFunctions=c;for(var d=this.a,e=this.b,g=c.length,k=b.width,m=[1/k,
1/b.height],l=0;2>l;++l)e[4*g+l]=a.b,e[4*g+3+l]=m[l];e[4*g+2]=1/(b.entryStride*k);for(k=0;k<g;++k)for(m=c[k],l=0;2>l;++l){var q=m[l],h=4*k+2*l,t=4*(4*k+2*l);e[h]=q.b+(0===l?.5/b.entryStride:.5);e[h+1]=q.c;for(h=0;4>h;++h)d[t+h]=q.a0[h],d[t+4+h]=q.a1[h]}}}},{key:"copyToGPU",value:function(){this.computeCoefficients();var a=this.hashTable,b=a.generation;if(this.generation!==b){this.generation=b;var c=a.width,d=a.height,e=this.gl;b=this.texture;e.activeTexture(e.TEXTURE0+e.tempTextureUnit);e.bindTexture(e.TEXTURE_2D,
b);e.pixelStorei(e.UNPACK_ALIGNMENT,1);Object(w.b)(e);var g=e.RGBA;a.tableWithMungedEmptyKey(function(b){e.texImage2D(e.TEXTURE_2D,0,g,c*a.entryStride,d,0,g,e.UNSIGNED_BYTE,new Uint8Array(b.buffer))});e.bindTexture(e.TEXTURE_2D,null)}}},{key:"disposed",value:function(){this.gl.deleteTexture(this.texture);this.texture=null;this.hashTable=this.gl=void 0;this.hashFunctions=null;t(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"disposed",this).call(this)}}],[{key:"get",value:function(a,b){var c=
this;return a.memoize.get(b,function(){return new c(a,b)})}}]);return c}(n.a),g=function(){function a(c,d){d=void 0===d?b.c:d;p(this,a);this.prefix=c;this.numAlternatives=d;$jscomp.initSymbol();this.textureUnitSymbol=Symbol.for("gpuhashtable:"+this.prefix);this.aName=this.prefix+"_a";this.bName=this.prefix+"_b";this.samplerName=this.prefix+"_sampler"}v(a,[{key:"defineShader",value:function(a){var b=this.aName,c=this.bName,d=this.samplerName,e=this.numAlternatives;a.addUniform("highp vec4",b,4*e);
a.addUniform("highp float",c,4*e+5);a.addTextureSampler2D(d,this.textureUnitSymbol);a.addFragmentCode(q);for(var g="",k=0;k<e;++k){for(var m=0;2>m;++m){var l=4*k+2*m,h=4*k+2*m;g+="\nfloat "+this.prefix+"_computeHash_"+k+"_"+m+"(uint64_t x) {\n  float primeModulus = "+c+"["+(4*e+m)+"];\n  float scalar = "+c+"["+(4*e+3+m)+"];\n  return computeHash(x,\n                     "+b+"["+h+"], "+b+"["+(h+1)+"],\n                     "+c+"["+l+"], "+c+"["+(l+1)+"],\n                     primeModulus, scalar);\n}\n"}g+=
"\nvec2 "+this.prefix+"_computeHash_"+k+"(uint64_t x) {\n  vec2 v;\n  v[0] = "+this.prefix+"_computeHash_"+k+"_0(x);\n  v[1] = "+this.prefix+"_computeHash_"+k+"_1(x);\n  return v;\n}\n"}g+="\nbool "+this.hasFunctionName+"(uint64_t x) {\n  float highOffset = "+c+"["+(4*e+2)+"];\n";for(b=0;b<e;++b)g+="\n  {\n    vec2 v = "+this.prefix+"_computeHash_"+b+"(x);\n    vec4 lowResult = texture2D("+d+", v);\n    vec4 highResult = texture2D("+d+", 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,c){c.copyToGPU();var d=b.textureUnit(this.textureUnitSymbol);a.activeTexture(a.TEXTURE0+d);a.bindTexture(a.TEXTURE_2D,c.texture);a.uniform4fv(b.uniform(this.aName),c.a);a.uniform1fv(b.uniform(this.bName),c.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}(),
d=function(a){function b(){p(this,b);return h(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}r(b,a);v(b,[{key:"defineShader",value:function(a){t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"defineShader",this).call(this,a);for(var c=this.samplerName,d=this.numAlternatives,e="\nbool "+this.getFunctionName+"(uint64_t x, out uint64_t value) {\n  float highOffset = "+this.bName+"["+(4*d+2)+"];\n",g=0;g<d;++g)e+="\n  {\n    vec2 v = "+this.prefix+"_computeHash_"+g+"(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      value.low = texture2D("+c+", vec2(v.x + 2.0 * highOffset, v.y));\n      value.high = texture2D("+c+", vec2(v.x + 3.0 * highOffset, v.y));\n      return true;\n    }\n  }\n";a.addFragmentCode(e+"\n  return false;\n}\n")}},{key:"getFunctionName",get:function(){return this.prefix+"_get"}}]);return b}(g)},function(n,e,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
}function h(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)}e.c=function(a,b,c){c=void 0===c?!1:c;b=b.attribute("aIndexRaw");0<=b&&(c&&a.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(b,0),a.disableVertexAttribArray(b))};e.d=function(a){return a.memoize.get("IndexBuffer",
function(){return new w(a)})};e.b=function(a){a.addAttribute("highp vec3","aIndexRaw");a.addVertexCode(b.k);a.addVertexCode("\nuint32_t getPrimitiveIndex() {\n  uint32_t result;\n  result.value = vec4(aIndexRaw, 0.0);\n  return result;\n}\n")};c.d(e,"a",function(){return v});e.e=function(b,c){return r.a.fromData(b,new Uint8Array(c.buffer,c.byteOffset,c.byteLength),a.a,a.p)};n=c(0);var r=c(24),a=c(25),b=c(12),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,e){c&&a(b.prototype,c);e&&a(b,e);return b}}(),w=function(b){function c(a){p(this,c);var b=(c.__proto__||Object.getPrototypeOf(c)).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.gl=a;b.buffer=b.registerDisposer(new r.a(a));return b}h(c,b);l(c,[{key:"resize",value:function(a){var b;
if(256>a){var c=b=new Uint8Array(a);for(var f=0;f<a;++f)c[f]=f;c=1}else if(65536>a){c=b=new Uint8Array(2*a);f=0;for(var e=2*a,m=0;m<e;m+=2)c[m]=f,c[m+1]=f>>8,++f;c=2}else if(16777216>a){c=b=new Uint8Array(3*a);f=3*a;for(m=e=0;m<f;m+=3)c[m]=e,c[m+1]=e>>8,c[m+2]=e>>16,++e;c=3}else throw Error("Length of index buffer must not exceed 2^24.");this.buffer.setData(b);this.numComponents=c;this.length=a}},{key:"ensure",value:function(a){(void 0===this.length||this.length<a)&&this.resize(a);return this}},{key:"bindToVertexAttrib",
value:function(b){this.buffer.bindToVertexAttrib(b,this.numComponents,a.y,!0)}},{key:"bind",value:function(a,b){b=void 0===b?0:b;a=a.attribute("aIndexRaw");0<=a&&(this.bindToVertexAttrib(a),0!==b&&this.gl.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(a,b))}}]);return c}(n.a),v=function(){function b(a){p(this,b);this.name=a;this.attributeName="a"+this.name;this.getterName="get"+this.name}l(b,[{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(b,c){b.bindToVertexAttrib(c.attribute(this.attributeName),4,a.y,!1)}},{key:"disable",value:function(a){a.gl.disableVertexAttribArray(a.attribute(this.attributeName))}}]);return b}()},function(n,e,c){(function(e){function h(b){b=b||e.location||{};var c={},d=typeof b,f;if("blob:"===b.protocol)c=new a(unescape(b.pathname),{});else if("string"===d)for(f in c=
new a(b,{}),q)delete c[f];else if("object"===d){for(f in b)f in q||(c[f]=b[f]);void 0===c.slashes&&(c.slashes=v.test(b.href))}return c}function r(a){a=p.exec(a);return{protocol:a[1]?a[1].toLowerCase():"",slashes:!!a[2],rest:a[3]}}function a(c,e,d){if(!(this instanceof a))return new a(c,e,d);var f=t.slice();var g=typeof e;var m=0;"object"!==g&&"string"!==g&&(d=e,e=null);d&&"function"!==typeof d&&(d=l.parse);e=h(e);var q=r(c||"");g=!q.protocol&&!q.slashes;this.slashes=q.slashes||g&&e.slashes;this.protocol=
q.protocol||e.protocol||"";c=q.rest;for(q.slashes||(f[2]=[/(.*)/,"pathname"]);m<f.length;m++){q=f[m];var p=q[0];var w=q[1];if(p!==p)this[w]=c;else if("string"===typeof p)~(p=c.indexOf(p))&&("number"===typeof q[2]?(this[w]=c.slice(0,p),c=c.slice(p+q[2])):(this[w]=c.slice(p),c=c.slice(0,p)));else if(p=p.exec(c))this[w]=p[1],c=c.slice(0,p.index);this[w]=this[w]||(g&&q[3]?e[w]||"":"");q[4]&&(this[w]=this[w].toLowerCase())}d&&(this.query=d(this.query));if(g&&e.slashes&&"/"!==this.pathname.charAt(0)&&(""!==
this.pathname||""!==e.pathname)){c=this.pathname;e=(e.pathname||"/").split("/").slice(0,-1).concat(c.split("/"));c=e.length;d=e[c-1];f=!1;for(m=0;c--;)"."===e[c]?e.splice(c,1):".."===e[c]?(e.splice(c,1),m++):m&&(0===c&&(f=!0),e.splice(c,1),m--);f&&e.unshift("");"."!==d&&".."!==d||e.push("");this.pathname=e.join("/")}b(this.port,this.protocol)||(this.host=this.hostname,this.port="");this.username=this.password="";this.auth&&(q=this.auth.split(":"),this.username=q[0]||"",this.password=q[1]||"");this.origin=
this.protocol&&this.host&&"file:"!==this.protocol?this.protocol+"//"+this.host:"null";this.href=this.toString()}var b=c(241),l=c(242),p=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,v=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,t=[["#","hash"],["?","query"],["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],q={hash:1,query:1};a.prototype={set:function(a,c,d){switch(a){case "query":"string"===typeof c&&c.length&&(c=(d||l.parse)(c));this[a]=c;break;case "port":this[a]=
c;b(c,this.protocol)?c&&(this.host=this.hostname+":"+c):(this.host=this.hostname,this[a]="");break;case "hostname":this[a]=c;this.port&&(c+=":"+this.port);this.host=c;break;case "host":this[a]=c;/:\d+$/.test(c)?(c=c.split(":"),this.port=c.pop(),this.hostname=c.join(":")):(this.hostname=c,this.port="");break;case "protocol":this.protocol=c.toLowerCase();this.slashes=!d;break;case "pathname":this.pathname=c.length&&"/"!==c.charAt(0)?"/"+c:c;break;default:this[a]=c}for(a=0;a<t.length;a++)c=t[a],c[4]&&
(this[c[1]]=this[c[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=l.stringify);var b=this.protocol;b&&":"!==b.charAt(b.length-1)&&(b+=":");b+=this.slashes?"//":"";this.username&&(b+=this.username,this.password&&(b+=":"+this.password),b+="@");b+=this.host+this.pathname;(a="object"===typeof this.query?a(this.query):this.query)&&(b+="?"!==a.charAt(0)?
"?"+a:a);this.hash&&(b+=this.hash);return b}};a.extractProtocol=r;a.location=h;a.qs=l;n.exports=a}).call(e,c(5))},function(n,e,c){function p(){this._listeners={}}p.prototype.addEventListener=function(c,e){c in this._listeners||(this._listeners[c]=[]);var a=this._listeners[c];-1===a.indexOf(e)&&(a=a.concat([e]));this._listeners[c]=a};p.prototype.removeEventListener=function(c,e){var a=this._listeners[c];a&&(e=a.indexOf(e),-1!==e&&(1<a.length?this._listeners[c]=a.slice(0,e).concat(a.slice(e+1)):delete this._listeners[c]))};
p.prototype.dispatchEvent=function(){var c=arguments[0],e=c.type;c=1===arguments.length?[c]:Array.apply(null,arguments);this["on"+e]&&this["on"+e].apply(this,c);if(e in this._listeners){e=this._listeners[e];for(var a=0;a<e.length;a++)e[a].apply(this,c)}};n.exports=p},function(n,e,c){(function(e){function h(c,e,q,m,g){e=a.addPath(c,e);p(e);var d=this;b.call(this,c,q);this.poll=new l(m,e,g);this.poll.on("message",function(a){p("poll message",a);d.emit("message",a)});this.poll.once("close",function(a,
b){p("poll close",a,b);d.poll=null;d.emit("close",a,b);d.close()})}var r=c(4),a=c(18),b=c(247),l=c(248),p=function(){};"production"!==e.env.NODE_ENV&&(p=c(7)("sockjs-client:sender-receiver"));r(h,b);h.prototype.close=function(){b.prototype.close.call(this);p("close");this.removeAllListeners();this.poll&&(this.poll.abort(),this.poll=null)};n.exports=h}).call(e,c(6))},function(n,e,c){(function(e,h){function r(b,c,d,f){t(b,c);var e=this;a.call(this);setTimeout(function(){e._start(b,c,d,f)},0)}var a=
c(10).EventEmitter,b=c(4),l=c(34),p=c(18),v=e.XMLHttpRequest,t=function(){};"production"!==h.env.NODE_ENV&&(t=c(7)("sockjs-client:browser:xhr"));b(r,a);r.prototype._start=function(a,b,c,f){var d=this;try{this.xhr=new v}catch(B){}if(this.xhr){b=p.addQuery(b,"t="+ +new Date);this.unloadRef=l.unloadAdd(function(){t("unload cleanup");d._cleanup(!0)});try{this.xhr.open(a,b,!0),this.timeout&&"timeout"in this.xhr&&(this.xhr.timeout=this.timeout,this.xhr.ontimeout=function(){t("xhr timeout");d.emit("finish",
0,"");d._cleanup(!1)})}catch(B){t("exception",B);this.emit("finish",0,"");this._cleanup(!1);return}f&&f.noCredentials||!r.supportsCORS||(t("withCredentials"),this.xhr.withCredentials="true");if(f&&f.headers)for(var e in f.headers)this.xhr.setRequestHeader(e,f.headers[e]);this.xhr.onreadystatechange=function(){if(d.xhr){var a=d.xhr;t("readyState",a.readyState);switch(a.readyState){case 3:try{var b=a.status;var c=a.responseText}catch(y){}t("status",b);1223===b&&(b=204);200===b&&c&&0<c.length&&(t("chunk"),
d.emit("chunk",b,c));break;case 4:b=a.status;t("status",b);1223===b&&(b=204);if(12005===b||12029===b)b=0;t("finish",b,a.responseText);d.emit("finish",b,a.responseText);d._cleanup(!1)}}};try{d.xhr.send(c)}catch(B){d.emit("finish",0,""),d._cleanup(!1)}}else t("no xhr"),this.emit("finish",0,"no xhr support"),this._cleanup()};r.prototype._cleanup=function(a){t("cleanup");if(this.xhr){this.removeAllListeners();l.unloadDel(this.unloadRef);this.xhr.onreadystatechange=function(){};this.xhr.ontimeout&&(this.xhr.ontimeout=
null);if(a)try{this.xhr.abort()}catch(g){}this.unloadRef=this.xhr=null}};r.prototype.close=function(){t("close");this._cleanup(!0)};r.enabled=!!v;var q=["Active"].concat("Object").join("X");!r.enabled&&q in e&&(t("overriding xmlhttprequest"),v=function(){try{return new e[q]("Microsoft.XMLHTTP")}catch(m){return null}},r.enabled=!!new v);h=!1;try{h="withCredentials"in new v}catch(m){}r.supportsCORS=h;n.exports=r}).call(e,c(5),c(6))},function(n,e,c){function p(b){if(!a.enabled)throw Error("Transport created when disabled");
h.call(this,b,"/xhr_streaming",r,a)}e=c(4);var h=c(41),r=c(59),a=c(78);e(p,h);p.enabled=function(b){return b.cookie_needed||b.nullOrigin?!1:a.enabled&&b.sameScheme};p.transportName="xdr-streaming";p.roundTrips=2;n.exports=p},function(n,e,c){function p(b){if(!p.enabled())throw Error("Transport created when disabled");h.call(this,b,"/eventsource",r,a)}e=c(4);var h=c(41),r=c(249),a=c(60),b=c(130);e(p,h);p.enabled=function(){return!!b};p.transportName="eventsource";p.roundTrips=2;n.exports=p},function(n,
e,c){e=c(5);n.exports=e.EventSource},function(n,e,c){(function(e){function h(a,c,f){if(!h.enabled())throw Error("Transport created when disabled");b.call(this);var d=this;this.origin=p.getOrigin(f);this.baseUrl=f;this.transUrl=c;this.transport=a;this.windowId=q.string(8);f=p.addPath(f,"/iframe.html")+"#"+this.windowId;m(a,c,f);this.iframeObj=v.createIframe(f,function(a){m("err callback");d.emit("close",1006,"Unable to load an iframe ("+a+")");d.close()});this.onmessageCallback=this._message.bind(this);
t.attachEvent("message",this.onmessageCallback)}var r=c(4),a=c(28),b=c(10).EventEmitter,l=c(132),p=c(18),v=c(52),t=c(34),q=c(40),m=function(){};"production"!==e.env.NODE_ENV&&(m=c(7)("sockjs-client:transport:iframe"));r(h,b);h.prototype.close=function(){m("close");this.removeAllListeners();if(this.iframeObj){t.detachEvent("message",this.onmessageCallback);try{this.postMessage("c")}catch(g){}this.iframeObj.cleanup();this.onmessageCallback=this.iframeObj=this.iframeObj=null}};h.prototype._message=function(b){m("message",
b.data);if(p.isOriginEqual(b.origin,this.origin)){try{var c=a.parse(b.data)}catch(k){m("bad json",b.data);return}if(c.windowId!==this.windowId)m("mismatched window id",c.windowId,this.windowId);else switch(c.type){case "s":this.iframeObj.loaded();this.postMessage("s",a.stringify([l,this.transport,this.transUrl,this.baseUrl]));break;case "t":this.emit("message",c.data);break;case "c":try{var f=a.parse(c.data)}catch(k){m("bad json",c.data);break}this.emit("close",f[0],f[1]);this.close()}}else m("not same origin",
b.origin,this.origin)};h.prototype.postMessage=function(b,c){m("postMessage",b,c);this.iframeObj.post(a.stringify({windowId:this.windowId,type:b,data:c||""}),this.origin)};h.prototype.send=function(a){m("send",a);this.postMessage("m",a)};h.enabled=function(){return v.iframeEnabled};h.transportName="iframe";h.roundTrips=2;n.exports=h}).call(e,c(6))},function(n,e){n.exports="1.1.4"},function(n,e,c){function p(b){if(!h.enabled)throw Error("Transport created when disabled");a.call(this,b,"/htmlfile",
h,r)}e=c(4);var h=c(252),r=c(50),a=c(41);e(p,a);p.enabled=function(a){return h.enabled&&a.sameOrigin};p.transportName="htmlfile";p.roundTrips=2;n.exports=p},function(n,e,c){function p(c){if(!b.enabled&&!a.enabled)throw Error("Transport created when disabled");h.call(this,c,"/xhr",r,a)}e=c(4);var h=c(41),r=c(59),a=c(60),b=c(50);e(p,h);p.enabled=function(c){return c.nullOrigin?!1:b.enabled&&c.sameOrigin?!0:a.enabled};p.transportName="xhr-polling";p.roundTrips=2;n.exports=p},function(n,e,c){e=c(5);n.exports=
e.location||{origin:"http://localhost:80",protocol:"http",host:"localhost",port:80,href:"http://localhost/",hash:""}},function(n,e,c){function p(c){var e=this;h.call(this);this.ir=new b(c,a);this.ir.once("finish",function(a,b){e.ir=null;e.emit("message",r.stringify([a,b]))})}e=c(4);var h=c(10).EventEmitter,r=c(28),a=c(50),b=c(137);e(p,h);p.transportName="iframe-info-receiver";p.prototype.close=function(){this.ir&&(this.ir.close(),this.ir=null);this.removeAllListeners()};n.exports=p},function(n,e,
c){(function(e){function h(a,c){r.call(this);var e=this,m=+new Date;this.xo=new c("GET",a);this.xo.once("finish",function(a,c){if(200===a){var d=+new Date-m;if(c)try{var g=b.parse(c)}catch(x){p("bad json",c)}l.isObject(g)||(g={})}e.emit("finish",g,d);e.removeAllListeners()})}var r=c(10).EventEmitter,a=c(4),b=c(28),l=c(80),p=function(){};"production"!==e.env.NODE_ENV&&(p=c(7)("sockjs-client:info-ajax"));a(h,r);h.prototype.close=function(){this.removeAllListeners();this.xo.close()};n.exports=h}).call(e,
c(6))},function(n,e,c){e.a=function(c){if(!window.getSelection().isCollapsed)return!0;c=c.target.tagName;return"TEXTAREA"===c||"INPUT"===c?!0:!1};e.b=function(c,e){e=void 0===e?"text/plain":e;var a=!1,b=Object(p.c)(document,"copy",function(b){b.clipboardData.setData(e,c);a=!0;b.stopPropagation();b.preventDefault()},!0);try{document.execCommand("copy")}finally{b()}return a};var p=c(0)},function(n,e,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function h(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 r(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)}c.d(e,"a",function(){return v});c.d(e,
"b",function(){return t});n=c(21);c=c(0);var a=function m(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 m(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,f){c&&a(b.prototype,
c);f&&a(b,f);return b}}();$jscomp.initSymbol();var l=Symbol("SingleTextureVolumeChunk.textureUnit");$jscomp.initSymbol();var w=Symbol("SingleTextureVolumeChunk.textureLayout"),v=function(a){function c(a){p(this,c);var b=h(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));b.shaderKey=a;return b}r(c,a);b(c,[{key:"defineShader",value:function(a){a.addTextureSampler2D("uVolumeChunkSampler",l)}},{key:"beginDrawing",value:function(a,b){var c=b.textureUnit(l);a.activeTexture(a.TEXTURE0+c);b[w]=null}},
{key:"endDrawing",value:function(a,b){a.bindTexture(a.TEXTURE_2D,null);b[w]=null}},{key:"bindChunk",value:function(a,b,c){var d=c.textureLayout;b[w]!==d&&(b[w]=d,this.setupTextureLayout(a,b,d));a.bindTexture(a.TEXTURE_2D,c.texture)}},{key:"beginSource",value:function(a,b){}}]);return c}(c.a),t=function(c){function e(a,b){p(this,e);a=h(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,a,b));a.texture=null;a.data=b.data;return a}r(e,c);b(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}(n.a)},function(n,e,c){e.a=function(c,e,r,a,b,l){for(var h=0,p=
0,t=1,q=1,m=0;3>m;++m){var g=b[m],d=a[m],f=g%d;h+=Math.floor(g/d)*t;t*=Math.ceil(r[m]/d);p+=f*q;q*=d}a=e+2*h;r=c[a];a=c[a+1];b=r&16777215;r=r>>24&255;0<r&&(b+=l*(c[(e+a&16777215)+Math.floor(p*r/32)]>>p*r%32&(1<<r)-1));return b}},function(n,e,c){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 h(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 r(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 f.e(new f.g(a.navigationState.pose.position,f.f.makeRelative(a.navigationState.pose.orientation,b)),a.navigationState.zoomFactor);return new x.a(a.chunkManager,a.layerManager,
b)}function b(b){return new Map([["xy",a(b,I.get("xy"))],["xz",a(b,I.get("xz"))],["yz",a(b,I.get("yz"))]])}function l(a){return{mouseState:a.mouseState,layerManager:a.layerManager,showAxisLines:a.showAxisLines,visibility:a.visibility}}function w(a){return Object.assign({},l(a),{navigationState:a.perspectiveNavigationState,inputEventMap:a.inputEventBindings.perspectiveView})}function v(a){return Object.assign({},l(a),{navigationState:a.navigationState,inputEventMap:a.inputEventBindings.sliceView})}
function t(a,b,c){for(var d={},f=0;2>f;d={relatedLayout:d.relatedLayout},++f)d.relatedLayout=c[Math.min(c.length-1,f)],a.registerDisposer(Object(G.c)(b.element,0===f?"toggle-layout":"toggle-layout-alternative",function(b){return function(c){a.container.name=b.relatedLayout;c.stopPropagation()}}(d)))}function q(a){var b=V.get(a);if(void 0===b)throw Error("Invalid layout name: "+JSON.stringify(a)+".");return b}function m(a){q(a);return a}c.d(e,"b",function(){return D});c.d(e,"a",function(){return L});
n=c(9);var g=c.n(n),d=c(280),f=c(61),k=c(282),x=c(46),B=c(66),E=c(49),C=c(8);n=c(0);var y=c(11),G=c(17);e=c(1);var 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}}(),H=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)}};c(62);var D=function da(){r(this,da);this.perspectiveView=new G.a;this.sliceView=new G.a},I=new Map([["xy",void 0],["xz",e.l.rotateX(e.l.create(),e.l.create(),Math.PI/2)],["yz",e.l.rotateY(e.l.create(),e.l.create(),Math.PI/2)]]),F=function(a){function c(a,f,e){r(this,c);var g=p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));g.container=a;g.rootElement=f;g.viewer=e;var m=b(e),l=e.display,
q=Object.assign({},w(e),{showSliceViews:e.showPerspectiveSliceViews,showSliceViewsCheckbox:!0}),h=Object.assign({},v(e),{showScaleBar:e.showScaleBar}),n=Object.assign({},v(e),{showScaleBar:new E.b(!1,!1)}),x=function(a,b,c){b=g.registerDisposer(new B.a(l,b,m.get(a),c));t(g,b,[a,a+"-3d"]);return b};a=[d.b(1,d.a("column",[d.b(1,d.a("row",[d.b(1,function(a){x("xy",a,h)}),d.b(1,function(a){x("xz",a,n)})])),d.b(1,d.a("row",[d.b(1,function(a){a=g.registerDisposer(new k.a(l,a,q));for(var b=$jscomp.makeIterator(m.values()),
c=b.next();!c.done;c=b.next())a.sliceViews.add(c.value.addRef());t(g,a,["3d"])}),d.b(1,function(a){x("yz",a,n)})]))]))];d.a("row",a)(f);l.onResize();return g}h(c,a);A(c,[{key:"disposed",value:function(){Object(y.a)(this.rootElement);H(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"disposed",this).call(this)}}]);return c}(n.a),P=function(b){function c(b,f,e,g,m){r(this,c);var l=p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));l.container=b;l.rootElement=f;l.viewer=e;l.direction=
g;var q=a(e,I.get(m)),h=e.display,n=Object.assign({},w(e),{showSliceViews:e.showPerspectiveSliceViews,showSliceViewsCheckbox:!0}),x=Object.assign({},v(e),{showScaleBar:e.showScaleBar});d.b(1,d.a(g,[d.b(1,function(a){a=l.registerDisposer(new B.a(h,a,q,x));t(l,a,[m,"4panel"])}),d.b(1,function(a){a=l.registerDisposer(new k.a(h,a,n));a.sliceViews.add(q.addRef());t(l,a,["3d","4panel"])})]))(f);h.onResize();return l}h(c,b);A(c,[{key:"disposed",value:function(){Object(y.a)(this.rootElement);H(c.prototype.__proto__||
Object.getPrototypeOf(c.prototype),"disposed",this).call(this)}}]);return c}(n.a),K=function(b){function c(b,f,e,g){r(this,c);var k=p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));k.container=b;k.rootElement=f;k.viewer=e;var m=a(e,I.get(g)),l=Object.assign({},v(e),{showScaleBar:e.showScaleBar});d.a("row",[d.b(1,function(a){a=k.registerDisposer(new B.a(e.display,a,m,l));t(k,a,["4panel",g+"-3d"])})])(f);e.display.onResize();return k}h(c,b);A(c,[{key:"disposed",value:function(){Object(y.a)(this.rootElement);
H(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"disposed",this).call(this)}}]);return c}(n.a),T=function(a){function b(a,c,f){r(this,b);var e=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));e.container=a;e.rootElement=c;e.viewer=f;var g=Object.assign({},w(f),{showSliceViews:new E.b(!1,!1)});d.a("row",[d.b(1,function(a){a=e.registerDisposer(new k.a(f.display,a,g));t(e,a,["4panel"])})])(c);f.display.onResize();return e}h(b,a);A(b,[{key:"disposed",value:function(){Object(y.a)(this.rootElement);
H(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}}]);return b}(n.a),V=new Map([["4panel",{factory:function(a,b,c){return new F(a,b,c)}}],["3d",{factory:function(a,b,c){return new T(a,b,c)}}]]);c={};e=$jscomp.makeIterator(I.keys());for(var S=e.next();!S.done;c={axes:c.axes},S=e.next())c.axes=S.value,V.set(c.axes,{factory:function(a){return function(b,c,d){return new K(b,c,d,a.axes)}}(c)}),V.set(c.axes+"-3d",{factory:function(a){return function(b,c,d){return new P(b,
c,d,"row",a.axes)}}(c)});var L=function(a){function b(a,c){c=void 0===c?"xy":c;r(this,b);var d=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));d.viewer=a;d.element=document.createElement("div");d.element.style.flex="1";d.layoutName=new C.a(c,m);var f=d.registerCancellable(g()(function(){return d.updateLayout()},0));d.layoutName.changed.add(f);d.registerDisposer(d.viewer.display.updateStarted.add(function(){return f.flush()}));f();return d}h(b,a);A(b,[{key:"toJSON",value:function(){return this.layoutName.toJSON()}},
{key:"restoreState",value:function(a){this.layoutName.restoreState(a)}},{key:"reset",value:function(){this.layoutName.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=q(this.layoutName.value).factory(this,this.element,this.viewer)}},{key:"disposed",value:function(){this.disposeLayout();H(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}},
{key:"name",get:function(){return this.layoutName.value},set:function(a){this.layoutName.value=a}},{key:"changed",get:function(){return this.layoutName.changed}}]);return b}(n.a)},function(n,e,c){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 h(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)}c.d(e,"a",function(){return q});var r=c(14);n=c(39);var a=c(13),b=c(29),l=c(143),w=c(286),v=c(291),t=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,f){c&&a(b.prototype,c);f&&a(b,
f);return b}}();c(292);var q=function(c){function e(a,b){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var c=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));c.manager=a;c.existingLayer=b;c.statusElement=document.createElement("div");c.submitElement=document.createElement("button");c.namePromptElement=document.createElement("label");c.nameInputElement=document.createElement("input");c.volumeCancellationSource=void 0;c.sourceValid=!1;c.nameValid=!0;var d=
c.content;d.classList.add("add-layer-overlay");var f=document.createElement("form");f.className="source-form";c.registerEventListener(f,"submit",function(a){a.preventDefault();c.validateSource(!0)});var g=document.createElement("label");g.textContent="Source:";a=c.sourceInput=c.registerDisposer(new w.a({completer:function(a,b){return c.manager.dataSourceProvider.volumeCompleter(a,c.manager.chunkManager,b).then(function(a){return{completions:a.completions,makeElement:w.b,offset:a.offset,showSingleResult:!0}})},
delay:0}));a.element.classList.add("add-layer-source");a.inputElement.addEventListener("blur",function(){c.validateSource(!1)});c.submitElement.disabled=!0;a.inputChanged.add(function(){var a=c.volumeCancellationSource;void 0!==a&&(a.cancel(),c.volumeCancellationSource=void 0);c.sourceValid=!1;c.submitElement.disabled=!0;c.statusElement.textContent=""});f.appendChild(g);f.appendChild(a.element);Object(l.a)(g,a.inputElement);g=Object(v.a)();f.appendChild(g);d.appendChild(f);var m=c.statusElement,q=
c.namePromptElement,h=c.nameInputElement;f=c.submitElement;m.className="dialog-status";g=document.createElement("form");g.className="name-form";q.textContent="Name:";h.className="add-layer-name";h.autocomplete="off";h.spellcheck=!1;h.type="text";c.registerEventListener(h,"input",function(){c.validateName()});f.type="submit";Object(l.a)(q,h);g.appendChild(q);g.appendChild(h);g.appendChild(f);d.appendChild(g);d.appendChild(m);void 0!==b?(void 0!==b.sourceUrl?(a.value=b.sourceUrl,c.validateSource()):
c.sourceValid=!0,a.disabled=!0,h.value=b.name,c.validateName(),f.textContent="Save",h.focus()):(b=c.manager.layerManager.managedLayers,0<b.length&&(b=b[b.length-1],b instanceof r.b&&(b=b.sourceUrl,void 0!==b&&(d=c.manager.dataSourceProvider.findSourceGroup(b),a.value=b.substring(0,d),a.inputElement.setSelectionRange(0,d)))),a.inputElement.focus(),f.textContent="Add Layer");c.registerEventListener(g,"submit",function(a){a.preventDefault();c.submit()});return c}h(e,c);t(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(c){var d=this;c=void 0===c?!1:c;var e=this.sourceInput.value;if(""!==e){try{var g=this.manager.dataSourceProvider.suggestLayerName(e),m=this.nameInputElement;if(""===
this.nameInputElement.value){var l=this.manager.layerManager.getUniqueLayerName(g);m.value=l;m.setSelectionRange(0,l.length);this.validateName()}c&&m.focus()}catch(y){this.setError(y.message);return}this.setInfo("Validating volume source...");var q=this.volumeCancellationSource=new b.b;this.manager.dataSourceProvider.getVolume(this.manager.chunkManager,e,void 0,q).then(function(b){q.isCanceled||(d.volumeCancellationSource=void 0,d.sourceValid=!0,d.setInfo(a.c[b.volumeType].toLowerCase()+": "+(b.numChannels+
"-channel "+a.a[b.dataType].toLowerCase())),d.validityChanged())}).catch(function(a){q.isCanceled||(d.volumeCancellationSource=void 0,d.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}(n.a)},function(n,e,c){e.a=function(c,e){""===e.id&&(e.id="unique-id-for-association-"+
p++);c.setAttribute("for",e.id)};var p=0},function(n,e,c){e.a=function(c){var e=-1;return Object.assign(function(){-1===e&&(e=requestAnimationFrame(function(){e=-1;c()}))},{flush:function(){-1!==e&&(e=-1,c())},cancel:function(){-1!==e&&(cancelAnimationFrame(e),e=-1)}})}},function(n,e,c){e.a=function(c,e){var h=document.createElement("div"),a=document.createElement("div");a.textContent=c;h.className="neuroglancer-icon-button";h.appendChild(a);void 0!==e&&(h.title=e);return h};n=c(299);c.n(n)},function(n,
e,c){e.a=function(c,a){var b=Object(p.c)(c,"drop",function(b){b.preventDefault();if(-1!==b.dataTransfer.types.indexOf(h.d)){var c=JSON.parse(b.dataTransfer.getData(h.d));a.restoreState(c);b.stopPropagation()}}),e=Object(p.c)(c,"dragover",function(a){-1!==a.dataTransfer.types.indexOf(h.d)&&(a.dataTransfer.dropEffect="link",a.preventDefault(),a.stopPropagation())});return function(){e();b()}};var p=c(0),h=c(85)},function(n,e,c){c(86);c(178);c(71);c(179);c(106);c(181);c(107);c(183);c(110);c(184);c(111);
c(186);c(112);c(188);c(189);c(190);c(113);c(192);c(202);c(206);c(217);c(221);n.exports=c(228)},function(n,e,c){c(22)},function(n,e,c){c(22)},function(n,e,c){function p(a,b,c){var e=b[0],l=b[1],h=b[2],q=b[3],m=b[4],g=b[5],d=b[6],f=b[7],k=b[8],r=b[9],p=b[10],n=b[11],C=b[12],y=b[13],G=b[14];b=b[15];var A=c[0],H=c[1],D=c[2],I=c[3];a[0]=A*e+H*m+D*k+I*C;a[1]=A*l+H*g+D*r+I*y;a[2]=A*h+H*d+D*p+I*G;a[3]=A*q+H*f+D*n+I*b;A=c[4];H=c[5];D=c[6];I=c[7];a[4]=A*e+H*m+D*k+I*C;a[5]=A*l+H*g+D*r+I*y;a[6]=A*h+H*d+D*p+I*
G;a[7]=A*q+H*f+D*n+I*b;A=c[8];H=c[9];D=c[10];I=c[11];a[8]=A*e+H*m+D*k+I*C;a[9]=A*l+H*g+D*r+I*y;a[10]=A*h+H*d+D*p+I*G;a[11]=A*q+H*f+D*n+I*b;A=c[12];H=c[13];D=c[14];I=c[15];a[12]=A*e+H*m+D*k+I*C;a[13]=A*l+H*g+D*r+I*y;a[14]=A*h+H*d+D*p+I*G;a[15]=A*q+H*f+D*n+I*b;return a}function h(a,b,c){a[0]=b[0]-c[0];a[1]=b[1]-c[1];a[2]=b[2]-c[2];a[3]=b[3]-c[3];a[4]=b[4]-c[4];a[5]=b[5]-c[5];a[6]=b[6]-c[6];a[7]=b[7]-c[7];a[8]=b[8]-c[8];a[9]=b[9]-c[9];a[10]=b[10]-c[10];a[11]=b[11]-c[11];a[12]=b[12]-c[12];a[13]=b[13]-
c[13];a[14]=b[14]-c[14];a[15]=b[15]-c[15];return a}Object.defineProperty(e,"__esModule",{value:!0});e.create=function(){var a=new r.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};e.clone=function(a){var b=new r.a(16);b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];b[9]=a[9];b[10]=a[10];b[11]=a[11];b[12]=a[12];b[13]=a[13];b[14]=a[14];b[15]=a[15];return b};e.copy=function(a,
b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a};e.fromValues=function(a,b,c,e,h,t,q,m,g,d,f,k,p,n,E,C){var l=new r.a(16);l[0]=a;l[1]=b;l[2]=c;l[3]=e;l[4]=h;l[5]=t;l[6]=q;l[7]=m;l[8]=g;l[9]=d;l[10]=f;l[11]=k;l[12]=p;l[13]=n;l[14]=E;l[15]=C;return l};e.set=function(a,b,c,e,h,t,q,m,g,d,f,k,r,p,n,C,y){a[0]=b;a[1]=c;a[2]=e;a[3]=h;a[4]=t;a[5]=q;a[6]=m;a[7]=g;a[8]=d;a[9]=
f;a[10]=k;a[11]=r;a[12]=p;a[13]=n;a[14]=C;a[15]=y;return a};e.identity=function(a){a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=1;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=1;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};e.transpose=function(a,b){if(a===b){var c=b[1],e=b[2],h=b[3],t=b[6],q=b[7],m=b[11];a[1]=b[4];a[2]=b[8];a[3]=b[12];a[4]=c;a[6]=b[9];a[7]=b[13];a[8]=e;a[9]=t;a[11]=b[14];a[12]=h;a[13]=q;a[14]=m}else a[0]=b[0],a[1]=b[4],a[2]=b[8],a[3]=b[12],a[4]=b[1],a[5]=b[5],a[6]=b[9],a[7]=b[13],a[8]=b[2],a[9]=
b[6],a[10]=b[10],a[11]=b[14],a[12]=b[3],a[13]=b[7],a[14]=b[11],a[15]=b[15];return a};e.invert=function(a,b){var c=b[0],e=b[1],h=b[2],t=b[3],q=b[4],m=b[5],g=b[6],d=b[7],f=b[8],k=b[9],r=b[10],p=b[11],n=b[12],C=b[13],y=b[14];b=b[15];var G=c*m-e*q,A=c*g-h*q,H=c*d-t*q,D=e*g-h*m,I=e*d-t*m,F=h*d-t*g,P=f*C-k*n,K=f*y-r*n,T=f*b-p*n,V=k*y-r*C,S=k*b-p*C,L=r*b-p*y,Q=G*L-A*S+H*V+D*T-I*K+F*P;if(!Q)return null;Q=1/Q;a[0]=(m*L-g*S+d*V)*Q;a[1]=(h*S-e*L-t*V)*Q;a[2]=(C*F-y*I+b*D)*Q;a[3]=(r*I-k*F-p*D)*Q;a[4]=(g*T-q*L-
d*K)*Q;a[5]=(c*L-h*T+t*K)*Q;a[6]=(y*H-n*F-b*A)*Q;a[7]=(f*F-r*H+p*A)*Q;a[8]=(q*S-m*T+d*P)*Q;a[9]=(e*T-c*S-t*P)*Q;a[10]=(n*I-C*H+b*G)*Q;a[11]=(k*H-f*I-p*G)*Q;a[12]=(m*K-q*V-g*P)*Q;a[13]=(c*V-e*K+h*P)*Q;a[14]=(C*A-n*D-y*G)*Q;a[15]=(f*D-k*A+r*G)*Q;return a};e.adjoint=function(a,b){var c=b[0],e=b[1],h=b[2],t=b[3],q=b[4],m=b[5],g=b[6],d=b[7],f=b[8],k=b[9],r=b[10],p=b[11],n=b[12],C=b[13],y=b[14];b=b[15];a[0]=m*(r*b-p*y)-k*(g*b-d*y)+C*(g*p-d*r);a[1]=-(e*(r*b-p*y)-k*(h*b-t*y)+C*(h*p-t*r));a[2]=e*(g*b-d*y)-
m*(h*b-t*y)+C*(h*d-t*g);a[3]=-(e*(g*p-d*r)-m*(h*p-t*r)+k*(h*d-t*g));a[4]=-(q*(r*b-p*y)-f*(g*b-d*y)+n*(g*p-d*r));a[5]=c*(r*b-p*y)-f*(h*b-t*y)+n*(h*p-t*r);a[6]=-(c*(g*b-d*y)-q*(h*b-t*y)+n*(h*d-t*g));a[7]=c*(g*p-d*r)-q*(h*p-t*r)+f*(h*d-t*g);a[8]=q*(k*b-p*C)-f*(m*b-d*C)+n*(m*p-d*k);a[9]=-(c*(k*b-p*C)-f*(e*b-t*C)+n*(e*p-t*k));a[10]=c*(m*b-d*C)-q*(e*b-t*C)+n*(e*d-t*m);a[11]=-(c*(m*p-d*k)-q*(e*p-t*k)+f*(e*d-t*m));a[12]=-(q*(k*y-r*C)-f*(m*y-g*C)+n*(m*r-g*k));a[13]=c*(k*y-r*C)-f*(e*y-h*C)+n*(e*r-h*k);a[14]=
-(c*(m*y-g*C)-q*(e*y-h*C)+n*(e*g-h*m));a[15]=c*(m*r-g*k)-q*(e*r-h*k)+f*(e*g-h*m);return a};e.determinant=function(a){var b=a[0],c=a[1],e=a[2],h=a[3],t=a[4],q=a[5],m=a[6],g=a[7],d=a[8],f=a[9],k=a[10],r=a[11],p=a[12],n=a[13],C=a[14];a=a[15];return(b*q-c*t)*(k*a-r*C)-(b*m-e*t)*(f*a-r*n)+(b*g-h*t)*(f*C-k*n)+(c*m-e*q)*(d*a-r*p)-(c*g-h*q)*(d*C-k*p)+(e*g-h*m)*(d*n-f*p)};e.multiply=p;e.translate=function(a,b,c){var e=c[0],l=c[1];c=c[2];if(b===a)a[12]=b[0]*e+b[4]*l+b[8]*c+b[12],a[13]=b[1]*e+b[5]*l+b[9]*c+
b[13],a[14]=b[2]*e+b[6]*l+b[10]*c+b[14],a[15]=b[3]*e+b[7]*l+b[11]*c+b[15];else{var h=b[0];var q=b[1];var m=b[2];var g=b[3];var d=b[4];var f=b[5];var k=b[6];var r=b[7];var p=b[8];var n=b[9];var C=b[10];var y=b[11];a[0]=h;a[1]=q;a[2]=m;a[3]=g;a[4]=d;a[5]=f;a[6]=k;a[7]=r;a[8]=p;a[9]=n;a[10]=C;a[11]=y;a[12]=h*e+d*l+p*c+b[12];a[13]=q*e+f*l+n*c+b[13];a[14]=m*e+k*l+C*c+b[14];a[15]=g*e+r*l+y*c+b[15]}return a};e.scale=function(a,b,c){var e=c[0],l=c[1];c=c[2];a[0]=b[0]*e;a[1]=b[1]*e;a[2]=b[2]*e;a[3]=b[3]*e;
a[4]=b[4]*l;a[5]=b[5]*l;a[6]=b[6]*l;a[7]=b[7]*l;a[8]=b[8]*c;a[9]=b[9]*c;a[10]=b[10]*c;a[11]=b[11]*c;a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a};e.rotate=function(a,b,c,e){var l=e[0],h=e[1];e=e[2];var q=Math.sqrt(l*l+h*h+e*e);if(Math.abs(q)<r.b)return null;q=1/q;l*=q;h*=q;e*=q;var m=Math.sin(c);var g=Math.cos(c);var d=1-g;c=b[0];q=b[1];var f=b[2];var k=b[3];var p=b[4];var n=b[5];var w=b[6];var C=b[7];var y=b[8];var G=b[9];var A=b[10];var H=b[11];var D=l*l*d+g;var I=h*l*d+e*m;var F=e*
l*d-h*m;var P=l*h*d-e*m;var K=h*h*d+g;var T=e*h*d+l*m;var V=l*e*d+h*m;l=h*e*d-l*m;h=e*e*d+g;a[0]=c*D+p*I+y*F;a[1]=q*D+n*I+G*F;a[2]=f*D+w*I+A*F;a[3]=k*D+C*I+H*F;a[4]=c*P+p*K+y*T;a[5]=q*P+n*K+G*T;a[6]=f*P+w*K+A*T;a[7]=k*P+C*K+H*T;a[8]=c*V+p*l+y*h;a[9]=q*V+n*l+G*h;a[10]=f*V+w*l+A*h;a[11]=k*V+C*l+H*h;b!==a&&(a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]);return a};e.rotateX=function(a,b,c){var e=Math.sin(c);c=Math.cos(c);var l=b[4],h=b[5],q=b[6],m=b[7],g=b[8],d=b[9],f=b[10],k=b[11];b!==a&&(a[0]=b[0],
a[1]=b[1],a[2]=b[2],a[3]=b[3],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]);a[4]=l*c+g*e;a[5]=h*c+d*e;a[6]=q*c+f*e;a[7]=m*c+k*e;a[8]=g*c-l*e;a[9]=d*c-h*e;a[10]=f*c-q*e;a[11]=k*c-m*e;return a};e.rotateY=function(a,b,c){var e=Math.sin(c);c=Math.cos(c);var l=b[0],h=b[1],q=b[2],m=b[3],g=b[8],d=b[9],f=b[10],k=b[11];b!==a&&(a[4]=b[4],a[5]=b[5],a[6]=b[6],a[7]=b[7],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]);a[0]=l*c-g*e;a[1]=h*c-d*e;a[2]=q*c-f*e;a[3]=m*c-k*e;a[8]=l*e+g*c;a[9]=h*e+d*c;a[10]=q*e+f*
c;a[11]=m*e+k*c;return a};e.rotateZ=function(a,b,c){var e=Math.sin(c);c=Math.cos(c);var l=b[0],h=b[1],q=b[2],m=b[3],g=b[4],d=b[5],f=b[6],k=b[7];b!==a&&(a[8]=b[8],a[9]=b[9],a[10]=b[10],a[11]=b[11],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]);a[0]=l*c+g*e;a[1]=h*c+d*e;a[2]=q*c+f*e;a[3]=m*c+k*e;a[4]=g*c-l*e;a[5]=d*c-h*e;a[6]=f*c-q*e;a[7]=k*c-m*e;return a};e.fromTranslation=function(a,b){a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=1;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=1;a[11]=0;a[12]=b[0];a[13]=b[1];a[14]=
b[2];a[15]=1;return a};e.fromScaling=function(a,b){a[0]=b[0];a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=b[1];a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=b[2];a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};e.fromRotation=function(a,b,c){var e=c[0],l=c[1];c=c[2];var h=Math.sqrt(e*e+l*l+c*c);if(Math.abs(h)<r.b)return null;h=1/h;e*=h;l*=h;c*=h;h=Math.sin(b);b=Math.cos(b);var q=1-b;a[0]=e*e*q+b;a[1]=l*e*q+c*h;a[2]=c*e*q-l*h;a[3]=0;a[4]=e*l*q-c*h;a[5]=l*l*q+b;a[6]=c*l*q+e*h;a[7]=0;a[8]=e*c*q+l*h;a[9]=l*c*q-e*h;a[10]=c*
c*q+b;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};e.fromXRotation=function(a,b){var c=Math.sin(b);b=Math.cos(b);a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=b;a[6]=c;a[7]=0;a[8]=0;a[9]=-c;a[10]=b;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};e.fromYRotation=function(a,b){var c=Math.sin(b);b=Math.cos(b);a[0]=b;a[1]=0;a[2]=-c;a[3]=0;a[4]=0;a[5]=1;a[6]=0;a[7]=0;a[8]=c;a[9]=0;a[10]=b;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};e.fromZRotation=function(a,b){var c=Math.sin(b);b=Math.cos(b);a[0]=
b;a[1]=c;a[2]=0;a[3]=0;a[4]=-c;a[5]=b;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=1;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};e.fromRotationTranslation=function(a,b,c){var e=b[0],l=b[1],h=b[2],q=b[3],m=e+e,g=l+l,d=h+h;b=e*m;var f=e*g;e*=d;var k=l*g;l*=d;h*=d;m*=q;g*=q;q*=d;a[0]=1-(k+h);a[1]=f+q;a[2]=e-g;a[3]=0;a[4]=f-q;a[5]=1-(b+h);a[6]=l+m;a[7]=0;a[8]=e+g;a[9]=l-m;a[10]=1-(b+k);a[11]=0;a[12]=c[0];a[13]=c[1];a[14]=c[2];a[15]=1;return a};e.getTranslation=function(a,b){a[0]=b[12];a[1]=b[13];a[2]=b[14];
return a};e.getScaling=function(a,b){var c=b[0],e=b[1],h=b[2],r=b[4],q=b[5],m=b[6],g=b[8],d=b[9];b=b[10];a[0]=Math.sqrt(c*c+e*e+h*h);a[1]=Math.sqrt(r*r+q*q+m*m);a[2]=Math.sqrt(g*g+d*d+b*b);return a};e.getRotation=function(a,b){var c=b[0]+b[5]+b[10];0<c?(c=2*Math.sqrt(c+1),a[3]=.25*c,a[0]=(b[6]-b[9])/c,a[1]=(b[8]-b[2])/c,a[2]=(b[1]-b[4])/c):b[0]>b[5]&b[0]>b[10]?(c=2*Math.sqrt(1+b[0]-b[5]-b[10]),a[3]=(b[6]-b[9])/c,a[0]=.25*c,a[1]=(b[1]+b[4])/c,a[2]=(b[8]+b[2])/c):b[5]>b[10]?(c=2*Math.sqrt(1+b[5]-b[0]-
b[10]),a[3]=(b[8]-b[2])/c,a[0]=(b[1]+b[4])/c,a[1]=.25*c,a[2]=(b[6]+b[9])/c):(c=2*Math.sqrt(1+b[10]-b[0]-b[5]),a[3]=(b[1]-b[4])/c,a[0]=(b[8]+b[2])/c,a[1]=(b[6]+b[9])/c,a[2]=.25*c);return a};e.fromRotationTranslationScale=function(a,b,c,e){var l=b[0],h=b[1],q=b[2],m=b[3],g=l+l,d=h+h,f=q+q;b=l*g;var k=l*d;l*=f;var r=h*d;h*=f;q*=f;g*=m;d*=m;m*=f;f=e[0];var p=e[1];e=e[2];a[0]=(1-(r+q))*f;a[1]=(k+m)*f;a[2]=(l-d)*f;a[3]=0;a[4]=(k-m)*p;a[5]=(1-(b+q))*p;a[6]=(h+g)*p;a[7]=0;a[8]=(l+d)*e;a[9]=(h-g)*e;a[10]=
(1-(b+r))*e;a[11]=0;a[12]=c[0];a[13]=c[1];a[14]=c[2];a[15]=1;return a};e.fromRotationTranslationScaleOrigin=function(a,b,c,e,h){var l=b[0],q=b[1],m=b[2],g=b[3],d=l+l,f=q+q,k=m+m;b=l*d;var r=l*f;l*=k;var p=q*f;q*=k;m*=k;d*=g;f*=g;g*=k;k=e[0];var n=e[1];e=e[2];var w=h[0],v=h[1];h=h[2];a[0]=(1-(p+m))*k;a[1]=(r+g)*k;a[2]=(l-f)*k;a[3]=0;a[4]=(r-g)*n;a[5]=(1-(b+m))*n;a[6]=(q+d)*n;a[7]=0;a[8]=(l+f)*e;a[9]=(q-d)*e;a[10]=(1-(b+p))*e;a[11]=0;a[12]=c[0]+w-(a[0]*w+a[4]*v+a[8]*h);a[13]=c[1]+v-(a[1]*w+a[5]*v+a[9]*
h);a[14]=c[2]+h-(a[2]*w+a[6]*v+a[10]*h);a[15]=1;return a};e.fromQuat=function(a,b){var c=b[0],e=b[1],h=b[2];b=b[3];var r=c+c,q=e+e,m=h+h;c*=r;var g=e*r;e*=q;var d=h*r,f=h*q;h*=m;r*=b;q*=b;b*=m;a[0]=1-e-h;a[1]=g+b;a[2]=d-q;a[3]=0;a[4]=g-b;a[5]=1-c-h;a[6]=f+r;a[7]=0;a[8]=d+q;a[9]=f-r;a[10]=1-c-e;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};e.frustum=function(a,b,c,e,h,r,q){var m=1/(c-b),g=1/(h-e),d=1/(r-q);a[0]=2*r*m;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=2*r*g;a[6]=0;a[7]=0;a[8]=(c+b)*m;a[9]=(h+e)*
g;a[10]=(q+r)*d;a[11]=-1;a[12]=0;a[13]=0;a[14]=q*r*2*d;a[15]=0;return a};e.perspective=function(a,b,c,e,h){b=1/Math.tan(b/2);var l=1/(e-h);a[0]=b/c;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=b;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=(h+e)*l;a[11]=-1;a[12]=0;a[13]=0;a[14]=2*h*e*l;a[15]=0;return a};e.perspectiveFromFieldOfView=function(a,b,c,e){var l=Math.tan(b.upDegrees*Math.PI/180),h=Math.tan(b.downDegrees*Math.PI/180),q=Math.tan(b.leftDegrees*Math.PI/180);b=Math.tan(b.rightDegrees*Math.PI/180);var m=2/(q+b),g=2/
(l+h);a[0]=m;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=g;a[6]=0;a[7]=0;a[8]=-((q-b)*m*.5);a[9]=(l-h)*g*.5;a[10]=e/(c-e);a[11]=-1;a[12]=0;a[13]=0;a[14]=e*c/(c-e);a[15]=0;return a};e.ortho=function(a,b,c,e,h,r,q){var m=1/(b-c),g=1/(e-h),d=1/(r-q);a[0]=-2*m;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=-2*g;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=2*d;a[11]=0;a[12]=(b+c)*m;a[13]=(h+e)*g;a[14]=(q+r)*d;a[15]=1;return a};e.lookAt=function(a,b,c,e){var l=b[0],h=b[1];b=b[2];var q=e[0];var m=e[1];var g=e[2];var d=c[0];e=c[1];var f=c[2];
if(Math.abs(l-d)<r.b&&Math.abs(h-e)<r.b&&Math.abs(b-f)<r.b)return mat4.identity(a);c=l-d;e=h-e;d=b-f;var k=1/Math.sqrt(c*c+e*e+d*d);c*=k;e*=k;d*=k;f=m*d-g*e;g=g*c-q*d;q=q*e-m*c;(k=Math.sqrt(f*f+g*g+q*q))?(k=1/k,f*=k,g*=k,q*=k):q=g=f=0;m=e*q-d*g;var p=d*f-c*q;var n=c*g-e*f;(k=Math.sqrt(m*m+p*p+n*n))?(k=1/k,m*=k,p*=k,n*=k):n=p=m=0;a[0]=f;a[1]=m;a[2]=c;a[3]=0;a[4]=g;a[5]=p;a[6]=e;a[7]=0;a[8]=q;a[9]=n;a[10]=d;a[11]=0;a[12]=-(f*l+g*h+q*b);a[13]=-(m*l+p*h+n*b);a[14]=-(c*l+e*h+d*b);a[15]=1;return a};e.targetTo=
function(a,b,c,e){var l=b[0],h=b[1];b=b[2];var q=e[0],m=e[1],g=e[2];e=l-c[0];var d=h-c[1];c=b-c[2];var f=e*e+d*d+c*c;0<f&&(f=1/Math.sqrt(f),e*=f,d*=f,c*=f);f=m*c-g*d;g=g*e-q*c;q=q*d-m*e;a[0]=f;a[1]=g;a[2]=q;a[3]=0;a[4]=d*q-c*g;a[5]=c*f-e*q;a[6]=e*g-d*f;a[7]=0;a[8]=e;a[9]=d;a[10]=c;a[11]=0;a[12]=l;a[13]=h;a[14]=b;a[15]=1;return a};e.str=function(a){return"mat4("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+", "+a[6]+", "+a[7]+", "+a[8]+", "+a[9]+", "+a[10]+", "+a[11]+", "+a[12]+", "+a[13]+
", "+a[14]+", "+a[15]+")"};e.frob=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3],2)+Math.pow(a[4],2)+Math.pow(a[5],2)+Math.pow(a[6],2)+Math.pow(a[7],2)+Math.pow(a[8],2)+Math.pow(a[9],2)+Math.pow(a[10],2)+Math.pow(a[11],2)+Math.pow(a[12],2)+Math.pow(a[13],2)+Math.pow(a[14],2)+Math.pow(a[15],2))};e.add=function(a,b,c){a[0]=b[0]+c[0];a[1]=b[1]+c[1];a[2]=b[2]+c[2];a[3]=b[3]+c[3];a[4]=b[4]+c[4];a[5]=b[5]+c[5];a[6]=b[6]+c[6];a[7]=b[7]+c[7];a[8]=b[8]+c[8];a[9]=
b[9]+c[9];a[10]=b[10]+c[10];a[11]=b[11]+c[11];a[12]=b[12]+c[12];a[13]=b[13]+c[13];a[14]=b[14]+c[14];a[15]=b[15]+c[15];return a};e.subtract=h;e.multiplyScalar=function(a,b,c){a[0]=b[0]*c;a[1]=b[1]*c;a[2]=b[2]*c;a[3]=b[3]*c;a[4]=b[4]*c;a[5]=b[5]*c;a[6]=b[6]*c;a[7]=b[7]*c;a[8]=b[8]*c;a[9]=b[9]*c;a[10]=b[10]*c;a[11]=b[11]*c;a[12]=b[12]*c;a[13]=b[13]*c;a[14]=b[14]*c;a[15]=b[15]*c;return a};e.multiplyScalarAndAdd=function(a,b,c,e){a[0]=b[0]+c[0]*e;a[1]=b[1]+c[1]*e;a[2]=b[2]+c[2]*e;a[3]=b[3]+c[3]*e;a[4]=
b[4]+c[4]*e;a[5]=b[5]+c[5]*e;a[6]=b[6]+c[6]*e;a[7]=b[7]+c[7]*e;a[8]=b[8]+c[8]*e;a[9]=b[9]+c[9]*e;a[10]=b[10]+c[10]*e;a[11]=b[11]+c[11]*e;a[12]=b[12]+c[12]*e;a[13]=b[13]+c[13]*e;a[14]=b[14]+c[14]*e;a[15]=b[15]+c[15]*e;return a};e.exactEquals=function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]&&a[4]===b[4]&&a[5]===b[5]&&a[6]===b[6]&&a[7]===b[7]&&a[8]===b[8]&&a[9]===b[9]&&a[10]===b[10]&&a[11]===b[11]&&a[12]===b[12]&&a[13]===b[13]&&a[14]===b[14]&&a[15]===b[15]};e.equals=function(a,
b){var c=a[0],e=a[1],h=a[2],p=a[3],q=a[4],m=a[5],g=a[6],d=a[7],f=a[8],k=a[9],n=a[10],B=a[11],E=a[12],C=a[13],y=a[14];a=a[15];var G=b[0],A=b[1],H=b[2],D=b[3],I=b[4],F=b[5],P=b[6],K=b[7],T=b[8],V=b[9],S=b[10],L=b[11],Q=b[12],X=b[13],da=b[14];b=b[15];return Math.abs(c-G)<=r.b*Math.max(1,Math.abs(c),Math.abs(G))&&Math.abs(e-A)<=r.b*Math.max(1,Math.abs(e),Math.abs(A))&&Math.abs(h-H)<=r.b*Math.max(1,Math.abs(h),Math.abs(H))&&Math.abs(p-D)<=r.b*Math.max(1,Math.abs(p),Math.abs(D))&&Math.abs(q-I)<=r.b*Math.max(1,
Math.abs(q),Math.abs(I))&&Math.abs(m-F)<=r.b*Math.max(1,Math.abs(m),Math.abs(F))&&Math.abs(g-P)<=r.b*Math.max(1,Math.abs(g),Math.abs(P))&&Math.abs(d-K)<=r.b*Math.max(1,Math.abs(d),Math.abs(K))&&Math.abs(f-T)<=r.b*Math.max(1,Math.abs(f),Math.abs(T))&&Math.abs(k-V)<=r.b*Math.max(1,Math.abs(k),Math.abs(V))&&Math.abs(n-S)<=r.b*Math.max(1,Math.abs(n),Math.abs(S))&&Math.abs(B-L)<=r.b*Math.max(1,Math.abs(B),Math.abs(L))&&Math.abs(E-Q)<=r.b*Math.max(1,Math.abs(E),Math.abs(Q))&&Math.abs(C-X)<=r.b*Math.max(1,
Math.abs(C),Math.abs(X))&&Math.abs(y-da)<=r.b*Math.max(1,Math.abs(y),Math.abs(da))&&Math.abs(a-b)<=r.b*Math.max(1,Math.abs(a),Math.abs(b))};var r=c(22);e.mul=p;e.sub=h},function(n,e,c){function p(){var a=new l.a(4);a[0]=0;a[1]=0;a[2]=0;a[3]=1;return a}function h(a,b,c){c*=.5;var d=Math.sin(c);a[0]=d*b[0];a[1]=d*b[1];a[2]=d*b[2];a[3]=Math.cos(c);return a}function r(a,b,c){var d=b[0],f=b[1],e=b[2];b=b[3];var g=c[0],m=c[1],h=c[2];c=c[3];a[0]=d*c+b*g+f*h-e*m;a[1]=f*c+b*m+e*g-d*h;a[2]=e*c+b*h+d*m-f*g;
a[3]=b*c-d*g-f*m-e*h;return a}function a(a,b,c,d){var f=b[0],e=b[1],g=b[2];b=b[3];var m=c[0],h=c[1],l=c[2];c=c[3];var q=f*m+e*h+g*l+b*c;0>q&&(q=-q,m=-m,h=-h,l=-l,c=-c);if(1E-6<1-q){var r=Math.acos(q);var p=Math.sin(r);q=Math.sin((1-d)*r)/p;d=Math.sin(d*r)/p}else q=1-d;a[0]=q*f+d*m;a[1]=q*e+d*h;a[2]=q*g+d*l;a[3]=q*b+d*c;return a}function b(a,b){var c=b[0]+b[4]+b[8];if(0<c)c=Math.sqrt(c+1),a[3]=.5*c,c=.5/c,a[0]=(b[5]-b[7])*c,a[1]=(b[6]-b[2])*c,a[2]=(b[1]-b[3])*c;else{var d=0;b[4]>b[0]&&(d=1);b[8]>b[3*
d+d]&&(d=2);var f=(d+1)%3,e=(d+2)%3;c=Math.sqrt(b[3*d+d]-b[3*f+f]-b[3*e+e]+1);a[d]=.5*c;c=.5/c;a[3]=(b[3*f+e]-b[3*e+f])*c;a[f]=(b[3*f+d]+b[3*d+f])*c;a[e]=(b[3*e+d]+b[3*d+e])*c}return a}Object.defineProperty(e,"__esModule",{value:!0});e.create=p;e.identity=function(a){a[0]=0;a[1]=0;a[2]=0;a[3]=1;return a};e.setAxisAngle=h;e.getAxisAngle=function(a,b){var c=2*Math.acos(b[3]),d=Math.sin(c/2);0!=d?(a[0]=b[0]/d,a[1]=b[1]/d,a[2]=b[2]/d):(a[0]=1,a[1]=0,a[2]=0);return c};e.multiply=r;e.rotateX=function(a,
b,c){c*=.5;var d=b[0],f=b[1],e=b[2];b=b[3];var g=Math.sin(c);c=Math.cos(c);a[0]=d*c+b*g;a[1]=f*c+e*g;a[2]=e*c-f*g;a[3]=b*c-d*g;return a};e.rotateY=function(a,b,c){c*=.5;var d=b[0],f=b[1],e=b[2];b=b[3];var g=Math.sin(c);c=Math.cos(c);a[0]=d*c-e*g;a[1]=f*c+b*g;a[2]=e*c+d*g;a[3]=b*c-f*g;return a};e.rotateZ=function(a,b,c){c*=.5;var d=b[0],f=b[1],e=b[2];b=b[3];var g=Math.sin(c);c=Math.cos(c);a[0]=d*c+f*g;a[1]=f*c-d*g;a[2]=e*c+b*g;a[3]=b*c-e*g;return a};e.calculateW=function(a,b){var c=b[0],d=b[1];b=b[2];
a[0]=c;a[1]=d;a[2]=b;a[3]=Math.sqrt(Math.abs(1-c*c-d*d-b*b));return a};e.slerp=a;e.invert=function(a,b){var c=b[0],d=b[1],f=b[2];b=b[3];var e=c*c+d*d+f*f+b*b;e=e?1/e:0;a[0]=-c*e;a[1]=-d*e;a[2]=-f*e;a[3]=b*e;return a};e.conjugate=function(a,b){a[0]=-b[0];a[1]=-b[1];a[2]=-b[2];a[3]=b[3];return a};e.fromMat3=b;e.fromEuler=function(a,b,c,d){var f=.5*Math.PI/180;b*=f;c*=f;d*=f;f=Math.sin(b);b=Math.cos(b);var e=Math.sin(c);c=Math.cos(c);var g=Math.sin(d);d=Math.cos(d);a[0]=f*c*d-b*e*g;a[1]=b*e*d+f*c*g;
a[2]=b*c*g-f*e*d;a[3]=b*c*d+f*e*g;return a};e.str=function(a){return"quat("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"};var l=c(22),w=c(88),v=c(89);n=c(90);e.clone=n.clone;e.fromValues=n.fromValues;e.copy=n.copy;e.set=n.set;e.add=n.add;e.mul=r;e.scale=n.scale;e.dot=n.dot;e.lerp=n.lerp;c=n.length;e.length=c;e.len=c;c=n.squaredLength;e.squaredLength=c;e.sqrLen=c;var t=n.normalize;e.normalize=t;e.exactEquals=n.exactEquals;e.equals=n.equals;n=function(){var a=v.create(),b=v.fromValues(1,0,0),c=v.fromValues(0,
1,0);return function(d,f,e){var g=v.dot(f,e);if(-.999999>g)return v.cross(a,b,f),1E-6>v.len(a)&&v.cross(a,c,f),v.normalize(a,a),h(d,a,Math.PI),d;if(.999999<g)return d[0]=0,d[1]=0,d[2]=0,d[3]=1,d;v.cross(a,f,e);d[0]=a[0];d[1]=a[1];d[2]=a[2];d[3]=1+g;return t(d,d)}}();e.rotationTo=n;n=function(){var b=p(),c=p();return function(e,d,f,k,m,h){a(b,d,m,h);a(c,f,k,h);a(e,b,c,2*h*(1-h));return e}}();e.sqlerp=n;n=function(){var a=w.create();return function(c,e,d,f){a[0]=d[0];a[3]=d[1];a[6]=d[2];a[1]=f[0];a[4]=
f[1];a[7]=f[2];a[2]=-e[0];a[5]=-e[1];a[8]=-e[2];return t(c,b(c,a))}}();e.setAxes=n},function(n,e,c){function p(){var c=new h.a(2);c[0]=0;c[1]=0;return c}var h=c(22);(function(){var c=p();return function(a,b,e,h,r,p){b||(b=2);e||(e=0);for(h=h?Math.min(h*b+e,a.length):a.length;e<h;e+=b)c[0]=a[e],c[1]=a[e+1],r(c,c,p),a[e]=c[0],a[e+1]=c[1];return a}})()},function(n,e,c){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 h(b,c){var e=b.memoize.get({type:"getSharedCredentialsProvider",credentialsProvider:Object(a.a)(c)},function(){return new r.a(c.addRef(),b.rpc)}),h=e.addCounterpartRef();e.dispose();return h}e.a=function(){return function(c){return function(c){function e(a){for(var b=[],c=0;c<arguments.length;++c)b[c-0]=arguments[c];
if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var d;c=(d=e.__proto__||Object.getPrototypeOf(e)).call.apply(d,[].concat([this],$jscomp.arrayFromIterable(b)));if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");d=!c||"object"!==typeof c&&"function"!==typeof c?this:c;d.credentialsProvider=b[1].credentialsProvider.addRef();return d}p(e,c);b(e,[{key:"initializeCounterpart",value:function(a,b){b.credentialsProvider=h(this.chunkManager,
this.credentialsProvider);l(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"initializeCounterpart",this).call(this,a,b)}}],[{key:"encodeOptions",value:function(b){var c=l(e.__proto__||Object.getPrototypeOf(e),"encodeOptions",this).call(this,b);c.credentialsProvider=Object(a.a)(b.credentialsProvider);return c}}]);return e}(c)}};var r=c(154),a=c(23),b=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}}(),l=function v(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 v(a,b,c)}else{if("value"in e)return e.value;b=e.get;return void 0===b?void 0:b.call(c)}}},function(n,e,c){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)}c.d(e,"a",function(){return r});n=c(155);c=c(16);var h=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}}();e=this&&this.__decorate||function(a,
b,c,e){var h=arguments.length,l=3>h?b:null===e?e=Object.getOwnPropertyDescriptor(b,c):e,q;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)l=Reflect.decorate(a,b,c,e);else for(var m=a.length-1;0<=m;m--)if(q=a[m])l=(3>h?q(l):3<h?q(b,c,l):q(b,c))||l;return 3<h&&l&&Object.defineProperty(b,c,l),l};var r=function(a){function b(a,c){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");var e=(b.__proto__||Object.getPrototypeOf(b)).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.provider=a;e.registerDisposer(a);e.initializeCounterpart(c);return e}p(b,a);h(b,[{key:"get",value:function(a,b){return this.provider.get(a,b)}}]);return b}(c.b);r=e([Object(c.g)(n.b)],r);Object(c.d)(n.a,function(a,b){return this.get(a.providerId).get(a.invalidCredentials,b).then(function(a){return{value:a}})})},function(n,e,c){e.b="CredentialsProvider";e.a="CredentialsProvider.get"},function(n,e,c){e.a=function(c){for(var e=0,r=c.length,a=
0;a<r;++a)e=31*e+c.charCodeAt(a)|0;return e}},function(n,e,c){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 h(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}c.d(e,"c",function(){return r});
c.d(e,"d",function(){return a});c.d(e,"a",function(){return b});c.d(e,"b",function(){return l});var r;(function(a){a[a.RAW=0]="RAW";a[a.JPEG=1]="JPEG";a[a.COMPRESSED_SEGMENTATION=2]="COMPRESSED_SEGMENTATION"})(r||(r={}));var a=function v(){h(this,v)};a.RPC_ID="brainmaps/VolumeChunkSource";var b=function t(){h(this,t)};b.RPC_ID="brainmaps/MeshSource";var l=function(a){function b(){h(this,b);var a=(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!a||"object"!==typeof a&&"function"!==typeof a?this:a}p(b,a);return b}(b);l.RPC_ID="brainmaps/SkeletonSource"},function(n,e,c){e.b="mesh/MeshLayer";e.a="mesh/FragmentSource"},function(n,e,c){var p=c(92);n.exports=function(){return p.Date.now()}},function(n,e,c){e=c(5);n.exports="object"==typeof e&&e&&e.Object===Object&&e},function(n,e,c){var p=c(64),h=c(162),r=0/0,a=/^\s+|\s+$/g,b=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,w=/^0o[0-7]+$/i,v=parseInt;n.exports=function(c){if("number"==typeof c)return c;
if(h(c))return r;p(c)&&(c="function"==typeof c.valueOf?c.valueOf():c,c=p(c)?c+"":c);if("string"!=typeof c)return 0===c?c:+c;c=c.replace(a,"");var e=l.test(c);return e||w.test(c)?v(c.slice(2),e?2:8):b.test(c)?r:+c}},function(n,e,c){var p=c(163),h=c(166);n.exports=function(c){return"symbol"==typeof c||h(c)&&"[object Symbol]"==p(c)}},function(n,e,c){e=c(93);var p=c(164),h=c(165),r=e?e.toStringTag:void 0;n.exports=function(a){return null==a?void 0===a?"[object Undefined]":"[object Null]":r&&r in Object(a)?
p(a):h(a)}},function(n,e,c){e=c(93);c=Object.prototype;var p=c.hasOwnProperty,h=c.toString,r=e?e.toStringTag:void 0;n.exports=function(a){var b=p.call(a,r),c=a[r];try{a[r]=void 0;var e=!0}catch(t){}var n=h.call(a);e&&(b?a[r]=c:delete a[r]);return n}},function(n,e){var c=Object.prototype.toString;n.exports=function(e){return c.call(e)}},function(n,e){n.exports=function(c){return null!=c&&"object"==typeof c}},function(n,e,c){e.b=function(c,e){c.remove(e)};e.a=function(c,e){c.add(e)}},function(n,e,c){c.d(e,
"b",function(){return p});var p;(function(c){c[c.LITTLE=0]="LITTLE";c[c.BIG=1]="BIG"})(p||(p={}));n=function(){var c=Uint16Array.of(4386);return 17===(new Uint8Array(c.buffer))[0]?p.BIG:p.LITTLE}();e.a=n},function(n,e,c){e.a="skeleton/SkeletonLayer"},function(n,e,c){e.a=function(c){var e={antialias:!1,stencil:!0};c=c.getContext("webgl",e)||c.getContext("experimental-webgl",e);if(null==c)throw Error("WebGL not supported.");c.memoize=new p.a;c.maxTextureSize=c.getParameter(c.MAX_TEXTURE_SIZE);c.maxTextureImageUnits=
c.getParameter(c.MAX_TEXTURE_IMAGE_UNITS);c.tempTextureUnit=c.maxTextureImageUnits-1;c.WEBGL_draw_buffers=c.getExtension("WEBGL_draw_buffers");if(!c.WEBGL_draw_buffers)throw Error("WEBGL_draw_buffers extension not available");c.ANGLE_instanced_arrays=c.getExtension("ANGLE_instanced_arrays");if(!c.ANGLE_instanced_arrays)throw Error("ANGLE_instanced_ararys extension not available");e=$jscomp.makeIterator(["OES_texture_float","OES_element_index_uint"]);for(var a=e.next();!a.done;a=e.next())if(a=a.value,
!c.getExtension(a))throw Error(a+" extension not available");return c};var p=c(53)},function(n,e,c){var p=function(){function c(c,a){for(var b=0;b<a.length;b++){var e=a[b];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(c,e.key,e)}}return function(e,a,b){a&&c(e.prototype,a);b&&c(e,b);return e}}();n=function(){function c(){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");}p(c,null,[{key:"insertAfter",value:function(c,
a){var b=c.next0;a.next0=b;a.prev0=c;c.next0=a;b.prev0=a}},{key:"insertBefore",value:function(c,a){var b=c.prev0;a.prev0=b;a.next0=c;c.prev0=a;b.next0=a}},{key:"front",value:function(c){var a=c.next0;return a===c?null:a}},{key:"back",value:function(c){var a=c.prev0;return a===c?null:a}},{key:"pop",value:function(c){var a=c.next0,b=c.prev0;a.prev0=b;b.next0=a;c.next0=null;c.prev0=null;return c}},{key:"iterator",value:function(c){function a(a,h){for(;;)switch(b){case 0:e=c.next0;case 1:if(e===c){b=
3;break}b=4;return{value:e,done:!1};case 4:if(void 0===h){b=5;break}b=-1;throw h;case 5:case 2:e=e.next0;b=1;break;case 3:b=-1;default:return{value:void 0,done:!0}}}var b=0,e,h={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();h[Symbol.iterator]=function(){return this};return h}},{key:"reverseIterator",value:function(c){function a(a,h){for(;;)switch(b){case 0:e=c.prev0;case 1:if(e===c){b=
3;break}b=4;return{value:e,done:!1};case 4:if(void 0===h){b=5;break}b=-1;throw h;case 5:case 2:e=e.prev0;b=1;break;case 3:b=-1;default:return{value:void 0,done:!0}}}var b=0,e,h={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();h[Symbol.iterator]=function(){return this};return h}},{key:"initializeHead",value:function(c){c.next0=c.prev0=c}}]);return c}();e.a=n},function(n,e,c){c.d(e,"a",function(){return h});
var p=function(){function c(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(a,b,e){b&&c(a.prototype,b);e&&c(a,e);return a}}(),h=function(){function c(a){if(!(this instanceof c))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 b=a.next();!b.done;b=a.next()){var e=$jscomp.makeIterator(b.value);b=e.next().value;e=e.next().value;this.bindings.set(b,e)}}}p(c,[{key:"addParent",value:function(a,b){for(var c=this,e=this.parents,h=this.parentPriorities,p=0,q=e.length;p<q&&b<h[p];)++p;e.splice(p,0,a);h.splice(p,0,b);return function(){c.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,b){this.bindings.set(a,b)}},{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 b=this.parents,c=this.parentPriorities,e=c.length,h=0,p;h<e&&0<c[h];++h)if(p=
b[h].get(a),void 0!==p)return p;p=this.bindings.get(a);if(void 0!==p)return p;for(;h<e;++h)if(p=b[h].get(a),void 0!==p)return p}},{key:"getAll",value:function(a){function b(b,f){for(;;)switch(c){case 0:g=d,m=g.parents,q=g.parentPriorities,p=q.length,h=0;case 1:if(!(h<p&&0<q[h])){c=2;break}e=m[h].get(a);if(void 0===e){c=3;break}c=4;return{value:e,done:!1};case 4:if(void 0===f){c=5;break}c=-1;throw f;case 5:case 3:c=1;break;case 2:e=d.bindings.get(a);if(void 0===e){c=6;break}c=7;return{value:e,done:!1};
case 7:if(void 0===f){c=8;break}c=-1;throw f;case 8:case 6:case 9:if(!(h<p)){c=10;break}e=m[h].get(a);if(void 0===e){c=11;break}c=12;return{value:e,done:!1};case 12:if(void 0===f){c=13;break}c=-1;throw f;case 13:case 11:c=9;break;case 10:c=-1;default:return{value:void 0,done:!0}}}var c=0,e,h,p,q,m,g,d=this,f={next:function(a){return b(a,void 0)},throw:function(a){return b(void 0,a)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();f[Symbol.iterator]=function(){return this};
return f}}]);return c}()},function(n,e,c){e.a=function(c){var e=0;switch(c.deltaMode){case 0:e=.005;break;case 1:e=.1;break;case 2:e=2}return Math.exp(c.deltaY*e)}},function(n,e){},function(n,e,c){c.d(e,"a",function(){return r});var p=c(1),h=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}}(),r=function(){function a(b,
c){c=void 0===c?p.d:c;if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");this.size=p.p.clone(b);this.transform=p.j.clone(c);this.invTransform=p.j.invert(p.j.create(),c)}h(a,[{key:"toObject",value:function(a){a.size=this.size;a.transform=this.transform}},{key:"localSpatialToGlobal",value:function(a,c){return p.p.transformMat4(a,c,this.transform)}},{key:"globalToLocalSpatial",value:function(a,c){return p.p.transformMat4(a,c,this.invTransform)}},{key:"globalToLocalGrid",
value:function(a,c){this.globalToLocalSpatial(a,c);p.p.divide(a,a,this.size);return a}},{key:"localSpatialVectorToGlobal",value:function(a,c){return Object(p.n)(a,c,this.transform)}},{key:"globalToLocalSpatialVector",value:function(a,c){return Object(p.n)(a,c,this.invTransform)}},{key:"assignLocalSpatialToGlobalMat4",value:function(a){return p.j.copy(a,this.transform)}}],[{key:"get",value:function(b,c){c=void 0===c?p.d:c;var e=a.cache,h=JSON.stringify([Array.from(b),Array.from(c)]),l=e.get(h);void 0===
l&&(l=new a(b,c),e.set(h,l));return l}},{key:"fromObject",value:function(b){return a.get(b.size,b.transform)}}]);return a}();r.cache=new Map},function(n,e,c){e.a=function(c,e){return c===e?!0:1E-6>Math.abs(c-e)/Math.min(Math.abs(c),Math.abs(e))}},function(n,e){},function(n,e,c){Object.defineProperty(e,"__esModule",{value:!0});var p=c(86),h=c(91);n=c(26);Object(n.b)("brainmaps",function(c){return new p.BrainmapsDataSource(p.productionInstance,c.credentialsManager.getCredentialsProvider(h.a))})},function(n,
e,c){Object.defineProperty(e,"__esModule",{value:!0});var p=c(71);n=c(26);Object(n.b)("ndstore",function(){return new p.NDStoreDataSource})},function(n,e,c){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 h(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 r(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}c.d(e,"c",function(){return a});c.d(e,"d",function(){return b});c.d(e,"b",function(){return l});c.d(e,"a",function(){return w});var a;(function(a){a[a.JPEG=0]="JPEG";a[a.COMPRESSED_SEGMENTATION=1]="COMPRESSED_SEGMENTATION"})(a||(a={}));n=function t(){r(this,t)};var b=function(a){function b(){r(this,
b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}h(b,a);return b}(n);b.RPC_ID="dvid/VolumeChunkSource";var l;(function(a){a[a.JPEG=0]="JPEG"})(l||(l={}));var w=function(a){function b(){r(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}h(b,a);return b}(n);w.RPC_ID="dvid/TileChunkSource"},function(n,e,c){Object.defineProperty(e,"__esModule",{value:!0});var p=c(106);n=c(26);Object(n.b)("dvid",function(){return new p.DVIDDataSource})},
function(n,e,c){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 h(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 r(a,
b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}c.d(e,"b",function(){return a});c.d(e,"a",function(){return b});n=function(a){function b(){r(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}h(b,a);return b}(function w(){r(this,w)});var a=function(a){function b(){r(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}h(b,a);return b}(n);a.RPC_ID="render/TileChunkSource";var b=function(a){function b(){r(this,
b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}h(b,a);return b}(n);b.RPC_ID="render/PointMatchSource"},function(n,e,c){Object.defineProperty(e,"__esModule",{value:!0});n=c(26);var p=c(107);Object(n.b)("render",function(){return new p.RenderDataSource})},function(n,e,c){Object.defineProperty(e,"__esModule",{value:!0});var p=c(110);n=c(26);Object(n.b)("openconnectome",function(){return new p.OpenConnectomeDataSource})},function(n,e,c){function p(a,c){if(!(a instanceof
c))throw new TypeError("Cannot call a class as a function");}c.d(e,"b",function(){return h});c.d(e,"c",function(){return r});c.d(e,"a",function(){return a});var h;(function(a){a[a.RAW=0]="RAW";a[a.JPEG=1]="JPEG";a[a.COMPRESSED_SEGMENTATION=2]="COMPRESSED_SEGMENTATION"})(h||(h={}));var r=function l(){p(this,l)};r.RPC_ID="precomputed/VolumeChunkSource";var a=function w(){p(this,w)};a.RPC_ID="precomputed/MeshSource"},function(n,e,c){Object.defineProperty(e,"__esModule",{value:!0});var p=c(111);n=c(26);
Object(n.b)("precomputed",function(){return new p.PrecomputedDataSource})},function(n,e,c){c.d(e,"b",function(){return h});e.a="nifti/getNiftiVolumeInfo";var p;(function(c){c[c.NONE=0]="NONE";c[c.BINARY=1]="BINARY";c[c.UINT8=2]="UINT8";c[c.INT16=4]="INT16";c[c.INT32=8]="INT32";c[c.FLOAT32=16]="FLOAT32";c[c.COMPLEX64=32]="COMPLEX64";c[c.FLOAT64=64]="FLOAT64";c[c.RGB24=128]="RGB24";c[c.INT8=256]="INT8";c[c.UINT16=512]="UINT16";c[c.UINT32=768]="UINT32";c[c.INT64=1024]="INT64";c[c.UINT64=1280]="UINT64";
c[c.FLOAT128=1536]="FLOAT128";c[c.COMPLEX128=1792]="COMPLEX128";c[c.COMPLEX256=2048]="COMPLEX256"})(p||(p={}));var h=function a(){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");};h.RPC_ID="nifti/VolumeChunkSource"},function(n,e,c){Object.defineProperty(e,"__esModule",{value:!0});var p=c(112);n=c(26);Object(n.b)("nifti",function(){return new p.NiftiDataSource})},function(n,e){},function(n,e){},function(n,e,c){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 h(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 r(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}c.d(e,"c",function(){return a});c.d(e,
"d",function(){return b});c.d(e,"a",function(){return l});c.d(e,"b",function(){return w});var a;(function(a){a[a.JPEG=0]="JPEG";a[a.NPZ=1]="NPZ";a[a.RAW=2]="RAW"})(a||(a={}));n=function t(){r(this,t)};var b=function(a){function b(){r(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}h(b,a);return b}(n);b.RPC_ID="python/VolumeChunkSource";var l=function(a){function b(){r(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}h(b,a);return b}(n);
l.RPC_ID="python/MeshSource";var w=function(a){function b(){r(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}h(b,a);return b}(n);w.RPC_ID="python/SkeletonSource"},function(n,e,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function h(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 r(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 d.a({shaderError:a.shaderError,fragmentMain:a.fragmentMain,fragmentMainStartLine:v.a})}Object.defineProperty(e,"__esModule",{value:!0});c.d(e,"ImageUserLayer",function(){return k});var b=c(57);
n=c(20);var l=c(14);e=c(39);var w=c(13),v=c(194),t=c(48),q=c(115),m=c(47),g=c(72),d=c(73),f=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}();c(117);c(118);var k=function(a){function c(a,d){p(this,c);var e=h(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));e.opacity=Object(t.a)(.5);e.blendMode=Object(q.c)();
e.fragmentMain=Object(v.c)();e.shaderError=Object(m.b)();e.transform=new b.a;var f=d.source;if("string"!==typeof f)throw Error("Invalid image layer specification");e.opacity.restoreState(d.opacity);e.blendMode.restoreState(d.blend);e.fragmentMain.restoreState(d.shader);e.transform.restoreState(d.transform);e.registerDisposer(e.fragmentMain.changed.add(function(){e.specificationChanged.dispatch()}));e.volumePath=f;Object(l.d)(a.dataSourceProvider,a.chunkManager,f).then(function(a){e.wasDisposed||(a=
e.renderLayer=new v.b(a,{opacity:e.opacity,blendMode:e.blendMode,fragmentMain:e.fragmentMain,shaderError:e.shaderError,transform:e.transform}),e.addRenderLayer(a),e.shaderError.changed.dispatch(),e.isReady=!0)});return e}r(c,a);f(c,[{key:"toJSON",value:function(){var a={type:"image"};a.source=this.volumePath;a.opacity=this.opacity.toJSON();a.blend=this.blendMode.toJSON();a.shader=this.fragmentMain.toJSON();a.transform=this.transform.toJSON();return a}},{key:"makeDropdown",value:function(a){return new x(a,
this)}}]);return c}(n.f),x=function(b){function c(b,d){p(this,c);var e=h(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));e.element=b;e.layer=d;e.opacityWidget=e.registerDisposer(new g.a(e.layer.opacity));e.codeWidget=e.registerDisposer(a(e.layer));b.classList.add("image-dropdown");var f=e.opacityWidget;d=document.createElement("div");d.className="image-dropdown-top-row";f.promptElement.textContent="Opacity";f=document.createElement("div");f.style.flex="1";var k=document.createElement("a"),
m=document.createElement("button");m.type="button";m.textContent="?";m.className="help-link";k.appendChild(m);k.title="Documentation on image layer rendering";k.target="_blank";k.href="https://github.com/google/neuroglancer/blob/master/src/neuroglancer/sliceview/image_layer_rendering.md";m=document.createElement("button");m.innerHTML="&square;";m.className="maximize-button";m.title="Show larger editor view";e.registerEventListener(m,"click",function(){new B(e.layer)});d.appendChild(e.opacityWidget.element);
d.appendChild(f);d.appendChild(m);d.appendChild(k);b.appendChild(d);b.appendChild(e.codeWidget.element);e.codeWidget.textEditor.refresh();return e}r(c,b);f(c,[{key:"onShow",value:function(){this.codeWidget.textEditor.refresh()}}]);return c}(n.g),B=function(b){function c(b){p(this,c);var d=h(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));d.layer=b;d.codeWidget=d.registerDisposer(a(d.layer));d.content.classList.add("image-layer-shader-overlay");d.content.appendChild(d.codeWidget.element);
d.codeWidget.textEditor.refresh();return d}r(c,b);return c}(e.a);Object(l.e)("image",k);Object(l.f)(w.c.IMAGE,k)},function(n,e){},function(n,e,c){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 h(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 r(a){return Object(w.a)(void 0===a?"void main() {\n  emitGrayscale(toNormalized(getDataValue()));\n}\n":a)}e.c=r;c.d(e,"b",function(){return m});n=c(114);var a=c(48),b=c(115),l=c(2),w=c(47),v=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,
c,e){c&&a(b.prototype,c);e&&a(b,e);return b}}(),t=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)}};e.a="//NEUROGLANCER_IMAGE_RENDERLAYER_FRAGMENT_MAIN_START";var q=c(70),m=function(c){function d(c,e){e=void 0===e?{}:e;if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");var f=p(this,
(d.__proto__||Object.getPrototypeOf(d)).call(this,c,e)),k=e;c=void 0===k.opacity?Object(a.a)(.5):k.opacity;e=void 0===k.blendMode?Object(b.c)():k.blendMode;k=void 0===k.fragmentMain?r():k.fragmentMain;f.fragmentMain=k;f.opacity=c;f.blendMode=e;f.registerDisposer(c.changed.add(function(){f.redrawNeeded.dispatch()}));f.registerDisposer(k.changed.add(function(){f.shaderUpdated=!0;f.redrawNeeded.dispatch()}));return f}h(d,c);v(d,[{key:"getShaderKey",value:function(){return"volume.ImageRenderLayer:"+JSON.stringify(this.fragmentMain.value)}},
{key:"defineShader",value:function(a){t(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(q);a.setFragmentMainFunction("//NEUROGLANCER_IMAGE_RENDERLAYER_FRAGMENT_MAIN_START\n"+
this.fragmentMain.value)}},{key:"beginSlice",value:function(a){a=t(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"beginSlice",this).call(this,a);this.gl.uniform1f(a.uniform("uOpacity"),this.opacity.value);return a}},{key:"setGLBlendMode",value:function(a,c){var d=Object(l.n)(this.blendMode.value,b.b);if(d===b.b.ADDITIVE||0<c)a.enable(a.BLEND),b.a.get(d)(a)}}]);return d}(n.a)},function(n,e,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
}function h(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 r(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){for(var b=
0,c=0;3>c;++c)0>a[c]&&(b+=1<<c);return b}c.d(e,"a",function(){return g});n=c(0);var b=c(1),l=c(24),w=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}}(),v=b.p.create(),t=b.p.create(),q=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]),m=function(a){function b(a){p(this,b);var c=h(this,(b.__proto__||
Object.getPrototypeOf(b)).call(this));c.outputVertexIndices=c.registerDisposer(l.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 d=[0,1,2,5,3,4,6,7],e=[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],f=[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],g=[],k=0;8>k;++k)for(var m=0;m<e.length;++m)g.push(a[f[8*d[k]+e[m]]]);
c.vertexIndices=new Int32Array(g);return c}r(b,a);w(b,null,[{key:"get",value:function(a){return a.memoize.get("SliceViewShaderBuffers",function(){return new b(a)})}}]);return b}(n.a),g=function(c){function d(a){p(this,d);var b=h(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));b.data=b.registerDisposer(m.get(a));return b}r(d,c);w(d,null,[{key:"get",value:function(a){return a.memoize.get("BoundingBoxCrossSectionRenderHelper",function(){return new d(a)})}}]);w(d,[{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"),q)});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(c,d,e,f,g,m,h){var k=a(g);k=this.data.vertexIndices.subarray(48*k,48*(k+1));for(var l=[0,0],p=[b.p.create(),b.p.create()],n=b.p.create(),r=b.p.create(),t=function(a){return q.subarray(3*a,3*a+3)},w=0;4>w;++w){for(var v=0;2>v;++v)l[v]=k[2*(4*h+w)+v],b.p.multiply(p[v],c,t(l[v])),b.p.add(p[v],p[v],m),b.p.min(p[v],p[v],e),b.p.max(p[v],p[v],d);b.p.subtract(n,p[1],p[0]);v=b.p.dot(n,g);if(.001<Math.abs(v)){var x=(f-b.p.dot(p[0],g))/v;if(-.001<=x&&1.001>=x)return x=
Math.max(0,Math.min(1,x)),b.p.scaleAndAdd(r,p[0],n,x),r;console.log("vertex "+h+", e = "+w+", skipped, deom = "+v+", "+("vDir = "+Object(b.q)(n)+", ")+("uPlaneNormal = "+Object(b.q)(g)+", ")+("lambda="+x))}else console.log("vertex "+h+", e = "+w+", skipped, deom = "+v+", "+("vDir = "+Object(b.q)(n)+", uPlaneNormal = "+Object(b.q)(g)))}}},{key:"setPlane",value:function(b,c,d){var e=b.gl;e.uniform3fv(b.uniform("uPlaneNormal"),c);e.uniform1f(b.uniform("uPlaneDistance"),d);c=a(c);e.uniform2iv(b.uniform("uVertexIndex"),
this.data.vertexIndices.subarray(48*c,48*(c+1)))}},{key:"setViewportPlane",value:function(a,c,d,e){c=Object(b.n)(v,c,e);d=b.p.dot(b.p.transformMat4(t,d,e),c);this.setPlane(a,c,d)}}]);return d}(n.a)},function(n,e){},function(n,e,c){(function(c){function e(a,b){function d(a){if(!e.parentNode)return c.off(document,"mousemove",d);e.style.top=Math.max(0,a.clientY-e.offsetHeight-5)+"px";e.style.left=a.clientX+5+"px"}var e=document.createElement("div");e.className="CodeMirror-lint-tooltip";e.appendChild(b.cloneNode(!0));
document.body.appendChild(e);c.on(document,"mousemove",d);d(a);null!=e.style.opacity&&(e.style.opacity=1);return e}function p(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,b,g){function d(){c.off(g,"mouseout",d);f&&(p(f),f=null)}var f=e(a,b),k=setInterval(function(){if(f)for(var a=g;;a=a.parentNode){a&&11==a.nodeType&&(a=a.host);if(a==document.body)return;if(!a){d();
break}}if(!f)return clearInterval(k)},400);c.on(g,"mouseout",d)}function b(b,c,e){this.marked=[];this.options=c;this.timeout=null;this.hasGutter=e;this.onMouseOver=function(c){var d=c.target||c.srcElement;if(/\bCodeMirror-lint-mark-/.test(d.className)){d=d.getBoundingClientRect();var e=b.findMarksAt(b.coordsChar({left:(d.left+d.right)/2,top:(d.top+d.bottom)/2},"client"));d=[];for(var f=0;f<e.length;++f){var g=e[f].__annotation;g&&d.push(g)}if(d.length){e=c.target||c.srcElement;f=document.createDocumentFragment();
for(g=0;g<d.length;g++)f.appendChild(v(d[g]));a(c,f,e)}}};this.waitingFor=0}function l(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 n(b,e,g,m){var d=document.createElement("div"),f=d;d.className="CodeMirror-lint-marker-"+e;g&&(f=d.appendChild(document.createElement("div")),f.className="CodeMirror-lint-marker-multiple");if(0!=m)c.on(f,"mouseover",function(c){a(c,b,f)});return d}function v(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 t(a,b,e){function d(){g=-1;a.off("change",d)}var f=a.state.lint,g=++f.waitingFor;a.on("change",d);b(a.getValue(),function(b,e){a.off("change",d);f.waitingFor==g&&(e&&b instanceof c&&(b=e),m(a,b))},e,a)}function q(a){var b=a.state.lint.options,d=b.options||b,e=b.getAnnotations||
a.getHelper(c.Pos(0,0),"lint");e&&(b.async||e.async?t(a,e,d):(b=e(a.getValue(),d,a))&&(b.then?b.then(function(b){m(a,b)}):m(a,b)))}function m(a,b){l(a);for(var c=a.state.lint,d=c.options,e=[],f=0;f<b.length;++f){var g=b[f],m=g.from.line;(e[m]||(e[m]=[])).push(g)}for(f=0;f<e.length;++f)if(g=e[f]){m=null;for(var h=c.hasGutter&&document.createDocumentFragment(),q=0;q<g.length;++q){var p=g[q],r=p.severity;r||(r="error");"error"!=m&&(m=r);d.formatAnnotation&&(p=d.formatAnnotation(p));c.hasGutter&&h.appendChild(v(p));
p.to&&c.marked.push(a.markText(p.from,p.to,{className:"CodeMirror-lint-mark-"+r,__annotation:p}))}c.hasGutter&&a.setGutterMarker(f,"CodeMirror-lint-markers",n(h,m,1<g.length,c.options.tooltips))}if(d.onUpdateLinting)d.onUpdateLinting(b,e,a)}function g(a){var b=a.state.lint;b&&(clearTimeout(b.timeout),b.timeout=setTimeout(function(){q(a)},b.options.delay||500))}c.defineOption("lint",!1,function(a,e,k){k&&k!=c.Init&&(l(a),!1!==a.state.lint.options.lintOnChange&&a.off("change",g),c.off(a.getWrapperElement(),
"mouseover",a.state.lint.onMouseOver),clearTimeout(a.state.lint.timeout),delete a.state.lint);if(e){var d=a.getOption("gutters");k=!1;for(var f=0;f<d.length;++f)"CodeMirror-lint-markers"==d[f]&&(k=!0);d=a.state;e instanceof Function?e={getAnnotations:e}:e&&!0!==e||(e={});k=d.lint=new b(a,e,k);if(!1!==k.options.lintOnChange)a.on("change",g);if(0!=k.options.tooltips&&"gutter"!=k.options.tooltips)c.on(a.getWrapperElement(),"mouseover",k.onMouseOver);q(a)}});c.defineExtension("performLint",function(){this.state.lint&&
q(this)})})(c(116))},function(n,e){},function(n,e){},function(n,e){},function(n,e){n.exports=function(c){function e(a){var b={};a=a.split(" ");for(var c=0;c<a.length;++c)b[a[c]]=!0;return b}c.defineMode("glsl",function(a,b){function c(a,b){var c=a.next();if(B[c]){var e=B[c](a,b);if(!1!==e)return e}if('"'==c||"'"==c)return b.tokenize=p(c),b.tokenize(a,b);if(/[\[\]{}\(\),;\:\.]/.test(c))return y=c,"bracket";if(/\d/.test(c))return a.eatWhile(/[\w\.]/),"number";if("/"==c){if(a.eat("*"))return b.tokenize=
r,r(a,b);if(a.eat("/"))return a.skipToEnd(),"comment"}if("#"==c)return a.eatWhile(/[\S]+/),a.eatWhile(/[\s]+/),a.eatWhile(/[\S]+/),a.eatWhile(/[\s]+/),"comment";if(C.test(c))return a.eatWhile(C),"operator";a.eatWhile(/[\w\$_]/);a=a.current();return d.propertyIsEnumerable(a)?(k.propertyIsEnumerable(a)&&(y="newstatement"),"keyword"):f.propertyIsEnumerable(a)?"builtin":x.propertyIsEnumerable(a)?"atom":"word"}function p(a){return function(b,d){for(var e=!1,f,g=!1;null!=(f=b.next());){if(f==a&&!e){g=!0;
break}e=!e&&"\\"==f}if(g||!e&&!E)d.tokenize=c;return"string"}}function r(a,b){for(var d=!1,e;e=a.next();){if("/"==e&&d){b.tokenize=c;break}d="*"==e}return"comment"}function t(a,b,c,d,e){this.indented=a;this.column=b;this.type=c;this.align=d;this.prev=e}function q(a,b,c){return a.context=new t(a.indented,b,c,null,a.context)}function m(a){var b=a.context.type;if(")"==b||"]"==b||"}"==b)a.indented=a.context.indented;return a.context=a.context.prev}var g=a.indentUnit,d=b.keywords||e(h),f=b.builtins||e(n),
k=b.blockKeywords||e("case do else for if switch while struct"),x=b.atoms||e("null"),B=b.hooks||{},E=b.multiLineStrings,C=/[+\-*&%=<>!?|\/]/,y;return{startState:function(a){return{tokenize:null,context:new t((a||0)-g,0,"top",!1),indented:0,startOfLine:!0}},token:function(a,b){var d=b.context;a.sol()&&(null==d.align&&(d.align=!1),b.indented=a.indentation(),b.startOfLine=!0);if(a.eatSpace())return null;y=null;var e=(b.tokenize||c)(a,b);if("comment"==e||"meta"==e)return e;null==d.align&&(d.align=!0);
if(";"!=y&&":"!=y||"statement"!=d.type)if("{"==y)q(b,a.column(),"}");else if("["==y)q(b,a.column(),"]");else if("("==y)q(b,a.column(),")");else if("}"==y){for(;"statement"==d.type;)d=m(b);for("}"==d.type&&(d=m(b));"statement"==d.type;)d=m(b)}else y==d.type?m(b):("}"==d.type||"top"==d.type||"statement"==d.type&&"newstatement"==y)&&q(b,a.column(),"statement");else m(b);b.startOfLine=!1;return e},indent:function(a,b){if(a.tokenize!=c&&null!=a.tokenize)return 0;b=b&&b.charAt(0);a=a.context;var d=b==a.type;
return"statement"==a.type?a.indented+("{"==b?0:g):a.align?a.column+(d?0:1):a.indented+(d?0:g)},electricChars:"{}"}});var h="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",n="radians degrees sin cos tan asin acos atan pow exp log exp2 log2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not dFdx dFdy fwidth texture2D texture2DProj texture2DLod texture2DProjLod textureCube textureCubeLod require export";
c.defineMIME("text/x-glsl",{name:"glsl",keywords:e(h),builtins:e(n),blockKeywords:e("case do else for if switch while struct"),atoms:e("null"),hooks:{"#":function(a,b){if(!b.startOfLine)return!1;a.skipToEnd();return"meta"}}})}},function(n,e,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function h(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 r(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,d){d=void 0===d?{}:d;return w.a.forPromise(new Promise(function(e){e(a.getVectorGraphicsSource(b,c,d))}),{initialMessage:"Retrieving metadata for vector graphics source "+
c+".",delay:!0,errorPrefix:"Error retrieving metadata for vector graphics source "+c+": "})}Object.defineProperty(e,"__esModule",{value:!0});c.d(e,"VectorGraphicsUserLayer",function(){return x});n=c(20);e=c(14);var b=c(108),l=c(203),w=c(33),v=c(48),t=c(119),q=c(120),m=c(1),g=c(2),d=c(72),f=c(204),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}}();c(117);c(118);var x=function(c){function d(c,e){p(this,d);var f=h(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));f.opacity=Object(v.a)(.5);f.lineWidth=Object(t.a)(10);f.color=Object(q.a)(m.p.fromValues(1,1,1));f.opacity.restoreState(e.opacity);f.lineWidth.restoreState(e.linewidth);f.color.restoreState(e.color);f.lineWidth.changed.add(function(){f.specificationChanged.dispatch()});f.color.changed.add(function(){f.specificationChanged.dispatch()});f.vectorGraphicsLayerType=
Object(g.n)(e.type,b.b);e=f.vectorGraphicsPath=Object(g.z)(e.source);var k=0;void 0!==e&&(++k,f.vectorGraphicsLayerType===b.b.LINE&&a(c.dataSourceProvider,c.chunkManager,e).then(function(a){f.wasDisposed||(a=f.renderLayer=new l.a(a,{opacity:f.opacity,lineWidth:f.lineWidth,color:f.color,sourceOptions:{}}),f.addRenderLayer(a),0===--k&&(f.isReady=!0))}));return f}r(d,c);k(d,[{key:"toJSON",value:function(){var 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 b.b[this.vectorGraphicsLayerType].toLowerCase()}},{key:"makeDropdown",value:function(a){return new B(a,this)}}]);return d}(n.f),B=function(a){function b(a,c){p(this,b);var e=h(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));e.element=a;e.layer=c;e.opacityWidget=e.registerDisposer(new d.a(e.layer.opacity));e.lineWidthWidget=e.registerDisposer(new d.a(e.layer.lineWidth,{min:0,
max:50,step:1}));e.colorWidget=e.registerDisposer(new E(e.layer.color));a.classList.add("image-dropdown");var f=e.opacityWidget,g=e.lineWidthWidget,k=e.colorWidget;c=document.createElement("div");c.className="image-dropdown-top-row";f.promptElement.textContent="Opacity";g.promptElement.textContent="Line Width";k.promptElement.textContent="Color";f=document.createElement("div");f.style.flex="1";g=document.createElement("a");k=document.createElement("button");k.type="button";k.textContent="?";k.className=
"help-link";g.appendChild(k);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";c.appendChild(f);c.appendChild(g);a.appendChild(c);a.appendChild(e.opacityWidget.element);a.appendChild(e.lineWidthWidget.element);a.appendChild(e.colorWidget.element);return e}r(b,a);return b}(n.g),E=function(a){function b(a){p(this,b);return h(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,
a))}r(b,a);k(b,[{key:"verifyValue",value:function(a){a=Object(g.o)(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}(f.a);Object(e.e)("line",x)},function(n,e,c){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 h(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)}c.d(e,"a",function(){return d});var r=c(35);n=c(109);var a=c(48),b=c(119),l=c(120),w=c(1),v=c(24),t=c(25),q=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}}(),m=function k(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 k(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},g=w.j.create(),d=function(c){function d(c,e){var g=void 0===
e?{}:e;e=void 0===g.opacity?Object(a.a)(.5):g.opacity;var k=void 0===g.lineWidth?Object(b.a)(10):g.lineWidth,m=void 0===g.color?Object(l.a)(w.p.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 h=p(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,c,{sourceOptions:g}));h.opacity=e;h.registerDisposer(e.changed.add(function(){h.redrawNeeded.dispatch()}));h.lineWidth=k;h.registerDisposer(k.changed.add(function(){h.redrawNeeded.dispatch()}));
h.color=m;h.registerDisposer(m.changed.add(function(){h.redrawNeeded.dispatch()}));c=h.gl;e=new Float32Array([1,0,0,1,1,0,0,1]);h.vertexIndexBuffer=v.a.fromData(c,e,c.ARRAY_BUFFER,c.STATIC_DRAW);e=new Float32Array([1,1,-1,-1]);h.normalDirectionBuffer=v.a.fromData(c,e,c.ARRAY_BUFFER,c.STATIC_DRAW);return h}h(d,c);q(d,[{key:"getShaderKey",value:function(){return"vectorgraphics.VectorGraphicsLineRenderLayer"}},{key:"defineShader",value:function(a){m(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){m(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)if(this.initializeShader(),void 0===this.shader)console.log("error: shader undefined");else{var c=this.gl,d=this.beginSlice(a);b=$jscomp.makeIterator(b);for(var e=b.next();!e.done;e=b.next()){e=e.value;var k=e.chunkLayout,m=e.source,h=m.spec.voxelSize;
e=m.chunks;var l=g;w.j.identity(l);m.vectorGraphicsCoordinatesInVoxels&&w.j.scale(l,l,h);w.j.multiply(l,k.transform,l);c.uniformMatrix4fv(d.uniform("uProjection"),!1,w.j.multiply(g,a.dataToDevice,l));if(k=a.visibleChunks.get(k))for(k=$jscomp.makeIterator(k),m=k.next();!m.done;m=k.next())if((m=e.get(m.value))&&m.state===r.d.GPU_MEMORY){h=m.numPoints/2;l=d.attribute("aVertexFirst");m.vertexBuffer.bindToVertexAttrib(l,3,t.e,!1,24,0);c.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(l,1);var q=d.attribute("aVertexSecond");
m.vertexBuffer.bindToVertexAttrib(q,3,t.e,!1,24,12);c.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(q,1);c.ANGLE_instanced_arrays.drawArraysInstancedANGLE(c.TRIANGLE_STRIP,0,4,h);c.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(l,0);c.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(q,0)}}this.endSlice(d)}}}]);return d}(n.a)},function(n,e,c){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 h(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)}c.d(e,"a",function(){return v});n=c(0);var r=c(1),a=c(2),b=c(3),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,e){c&&a(b.prototype,c);e&&a(b,e);return b}}(),w=function q(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 q(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};c(205);var v=function(c){function e(a){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var c=p(this,(e.__proto__||
Object.getPrototypeOf(e)).call(this));c.model=a;c.promptElement=document.createElement("span");c.element=document.createElement("label");c.inputx=document.createElement("input");c.inputy=document.createElement("input");c.inputz=document.createElement("input");c.valueEntered=new b.b;a=c.inputx;var f=c.inputy,g=c.inputz,m=c.element,h=c.promptElement;m.className="vec3-input-row";h.className="vec3-input-label";m.appendChild(h);m.appendChild(a);m.appendChild(f);m.appendChild(g);a.type=f.type=g.type="number";
c.updateInput();m=function(){c.model.value=c.getVec3Values()};c.registerEventListener(a,"change",m);c.registerEventListener(f,"change",m);c.registerEventListener(g,"change",m);c.model.changed.add(function(){c.updateInput()});return c}h(e,c);l(e,[{key:"getVec3Values",value:function(){var a=r.p.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(b){return Object(a.o)(b)}},
{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,k=this.element;a.parentElement&&a.parentElement.removeChild(a);b.parentElement&&b.parentElement.removeChild(b);c.parentElement&&c.parentElement.removeChild(c);k.parentElement&&k.parentElement.removeChild(k);w(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),
"disposed",this).call(this)}}]);return e}(n.a)},function(n,e){},function(n,e,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function h(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 r(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 A.a({fragmentMain:a.displayState.fragmentMain,shaderError:a.displayState.shaderError,fragmentMainStartLine:m.a})}Object.defineProperty(e,"__esModule",{value:!0});c.d(e,"SegmentationUserLayer",function(){return F});var b=c(57);n=c(20);var l=c(14),w=c(54);e=c(39);var v=c(121),t=c(55),q=c(208),m=c(65),g=c(13),d=c(210),f=c(48),k=c(49),
x=c(211),B=c(2),E=c(19),C=c(47),y=c(72),G=c(212),A=c(73),H=c(214),D=c(63),I=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}();c(31);c(216);var F=function(a){function c(a,e){p(this,c);var n=h(this,(c.__proto__||Object.getPrototypeOf(c)).call(this,[]));n.manager=a;n.displayState={segmentColorHash:v.a.getDefault(),
segmentSelectionState:new t.a,selectedAlpha:Object(f.a)(.5),notSelectedAlpha:Object(f.a)(0),objectAlpha:Object(f.a)(1),clipBounds:D.a.make(n.manager.worker,void 0),hideSegmentZero:new k.b(!0,!0),visibleSegments:x.a.makeWithCounterpart(n.manager.worker),segmentEquivalences:q.a.makeWithCounterpart(n.manager.worker),objectToDataTransform:new b.a,fragmentMain:Object(m.f)(),shaderError:Object(C.b)()};n.displayState.visibleSegments.changed.add(function(){n.specificationChanged.dispatch()});n.displayState.segmentEquivalences.changed.add(function(){n.specificationChanged.dispatch()});
n.displayState.segmentSelectionState.bindTo(a.layerSelectedValues,n);n.displayState.selectedAlpha.changed.add(function(){n.specificationChanged.dispatch()});n.displayState.notSelectedAlpha.changed.add(function(){n.specificationChanged.dispatch()});n.displayState.objectAlpha.changed.add(function(){n.specificationChanged.dispatch()});n.displayState.hideSegmentZero.changed.add(function(){n.specificationChanged.dispatch()});n.displayState.fragmentMain.changed.add(function(){n.specificationChanged.dispatch()});
n.displayState.selectedAlpha.restoreState(e.selectedAlpha);n.displayState.notSelectedAlpha.restoreState(e.notSelectedAlpha);n.displayState.objectAlpha.restoreState(e.objectAlpha);n.displayState.hideSegmentZero.restoreState(e.hideSegmentZero);n.displayState.objectToDataTransform.restoreState(e.transform);n.displayState.fragmentMain.restoreState(e.skeletonShader);var r=n.volumePath=Object(B.z)(e.source),w=n.meshPath=null===e.mesh?null:Object(B.z)(e.mesh),A=n.skeletonsPath=Object(B.z)(e.skeletons),H=
0;void 0!==r&&(++H,Object(l.d)(a.dataSourceProvider,a.chunkManager,r,{volumeType:g.c.SEGMENTATION}).then(function(a){n.wasDisposed||(n.addRenderLayer(new d.a(a,n.displayState)),void 0===w&&(a=a.getMeshSource(),null!=a&&n.addMesh(a)),0===--H&&(n.isReady=!0))}));null!=w&&(++H,n.manager.dataSourceProvider.getMeshSource(a.chunkManager,w).then(function(a){n.wasDisposed||(n.addMesh(a),0===--H&&(n.isReady=!0))}));void 0!==A&&(++H,n.manager.dataSourceProvider.getSkeletonSource(a.chunkManager,A).then(function(b){n.wasDisposed||
(b=new m.c(a.chunkManager,b,a.voxelSize,n.displayState),n.addRenderLayer(new m.b(b.addRef())),n.addRenderLayer(new m.e(b)),0===--H&&(n.isReady=!0))}));Object(B.w)(e,"equivalences",function(a){n.displayState.segmentEquivalences.restoreState(a)});Object(B.w)(e,"segments",function(a){if(void 0!==a){var b=n.displayState,c=b.visibleSegments,d=b.segmentEquivalences;Object(B.a)(a,function(a){a=E.a.parseString(String(a),10);c.add(d.get(a))})}});Object(B.w)(e,"clipBounds",function(a){if(void 0!==a){var b,
c;Object(B.w)(a,"center",function(a){return b=Object(B.l)(a)});Object(B.w)(a,"size",function(a){return c=Object(B.l)(a)});b&&c&&(n.displayState.clipBounds.value={center:b,size:c})}});return n}r(c,a);I(c,[{key:"addMesh",value:function(a){this.meshLayer=new w.a(this.manager.chunkManager,a,this.displayState);this.addRenderLayer(this.meshLayer)}},{key:"toJSON",value:function(){var a={type:"segmentation"};a.source=this.volumePath;a.mesh=this.meshPath;a.skeletons=this.skeletonsPath;a.selectedAlpha=this.displayState.selectedAlpha.toJSON();
a.notSelectedAlpha=this.displayState.notSelectedAlpha.toJSON();a.objectAlpha=this.displayState.objectAlpha.toJSON();a.hideSegmentZero=this.displayState.hideSegmentZero.toJSON();var b=this.displayState.visibleSegments;0<b.size&&(a.segments=b.toJSON());b=this.displayState.segmentEquivalences;0<b.size&&(a.equivalences=b.toJSON());b=this.displayState.clipBounds;b.value&&(a.clipBounds={center:b.value.center,size:b.value.size});a.transform=this.displayState.objectToDataTransform.toJSON();a.skeletonShader=
this.displayState.fragmentMain.toJSON();return a}},{key:"transformPickedValue",value:function(a){if(null==a)return a;var b=this.displayState.segmentEquivalences;if(0===b.size)return a;"number"===typeof a&&(a=new E.a(a,0));b=b.get(a);return E.a.equal(b,a)?a:new t.c(a,b)}},{key:"makeDropdown",value:function(a){return new P(a,this)}},{key:"handleAction",value:function(a){switch(a){case "recolor":this.displayState.segmentColorHash.randomize();break;case "clear-segments":this.displayState.visibleSegments.clear();
break;case "select":if(a=this.displayState.segmentSelectionState,a.hasSelectedSegment){a=a.selectedSegment;var b=this.displayState.visibleSegments;b.has(a)?b.delete(a):b.add(a)}}}}]);return c}(n.f),P=function(b){function c(b,d){p(this,c);var e=h(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));e.element=b;e.layer=d;e.visibleSegmentWidget=e.registerDisposer(new G.a(e.layer.displayState));e.addSegmentWidget=e.registerDisposer(new H.a);e.selectedAlphaWidget=e.registerDisposer(new y.a(e.layer.displayState.selectedAlpha));
e.notSelectedAlphaWidget=e.registerDisposer(new y.a(e.layer.displayState.notSelectedAlpha));e.objectAlphaWidget=e.registerDisposer(new y.a(e.layer.displayState.objectAlpha));b.classList.add("segmentation-dropdown");var f=e.notSelectedAlphaWidget,g=e.objectAlphaWidget;e.selectedAlphaWidget.promptElement.textContent="Opacity (on)";f.promptElement.textContent="Opacity (off)";g.promptElement.textContent="Opacity (3d)";b.appendChild(e.selectedAlphaWidget.element);b.appendChild(e.notSelectedAlphaWidget.element);
b.appendChild(e.objectAlphaWidget.element);d=e.registerDisposer(new k.c(d.displayState.hideSegmentZero));d.element.className="neuroglancer-segmentation-dropdown-hide-segment-zero neuroglancer-noselect";f=document.createElement("label");f.className="neuroglancer-segmentation-dropdown-hide-segment-zero neuroglancer-noselect";f.appendChild(document.createTextNode("Hide segment ID 0"));f.appendChild(d.element);b.appendChild(f);e.addSegmentWidget.element.classList.add("add-segment");e.addSegmentWidget.element.title=
"Add one or more segment IDs";b.appendChild(e.registerDisposer(e.addSegmentWidget).element);e.registerDisposer(e.addSegmentWidget.valuesEntered.add(function(a){a=$jscomp.makeIterator(a);for(var b=a.next();!b.done;b=a.next())e.layer.displayState.visibleSegments.add(b.value)}));b.appendChild(e.registerDisposer(e.visibleSegmentWidget).element);if(void 0!==e.layer.skeletonsPath){d=document.createElement("div");d.className="neuroglancer-segmentation-dropdown-skeleton-shader-header";f=document.createElement("div");
f.style.flex="1";f.textContent="Skeleton shader:";g=document.createElement("a");var m=document.createElement("button");m.type="button";m.textContent="?";m.className="help-link";g.appendChild(m);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";m=document.createElement("button");m.innerHTML="&square;";m.className="maximize-button";m.title="Show larger editor view";e.registerEventListener(m,
"click",function(){new K(e.layer)});d.appendChild(f);d.appendChild(m);d.appendChild(g);b.appendChild(d);d=e.codeWidget=e.registerDisposer(a(e.layer));b.appendChild(d.element);d.textEditor.refresh()}return e}r(c,b);I(c,[{key:"onShow",value:function(){void 0!==this.codeWidget&&this.codeWidget.textEditor.refresh()}}]);return c}(n.g),K=function(b){function c(b){p(this,c);var d=h(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));d.layer=b;d.codeWidget=d.registerDisposer(a(d.layer));d.content.classList.add("neuroglancer-segmentation-layer-skeleton-shader-overlay");
d.content.appendChild(d.codeWidget.element);d.codeWidget.textEditor.refresh();return d}r(c,b);return c}(e.a);Object(l.e)("segmentation",F);Object(l.f)(g.c.SEGMENTATION,F)},function(n,e,c){e.a=function(c,e,n,a){e*=6;var b=Math.floor(e),h=e-b;e=a*(1-n);var p=a*(1-n*h);n=a*(1-n*(1-h));switch(b%6){case 0:c[0]=a;c[1]=n;c[2]=e;break;case 1:c[0]=p;c[1]=a;c[2]=e;break;case 2:c[0]=e;c[1]=a;c[2]=n;break;case 3:c[0]=e;c[1]=p;c[2]=a;break;case 4:c[0]=n;c[1]=e;c[2]=a;break;case 5:c[0]=a,c[1]=e,c[2]=p}return c}},
function(n,e,c){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)}c.d(e,"a",function(){return v});var h=c(209),r=c(2),a=c(3),b=c(19);n=c(16);var l=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||
!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,e){c&&a(b.prototype,c);e&&a(b,e);return b}}(),w=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)}};e=this&&this.__decorate||function(a,b,c,e){var d=arguments.length,f=3>d?b:null===e?e=Object.getOwnPropertyDescriptor(b,
c):e,g;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)f=Reflect.decorate(a,b,c,e);else for(var k=a.length-1;0<=k;k--)if(g=a[k])f=(3>d?g(f):3<d?g(b,c,f):g(b,c))||f;return 3<d&&f&&Object.defineProperty(b,c,f),f};var v=function(c){function d(){if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");var b=(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
b=!b||"object"!==typeof b&&"function"!==typeof b?this:b;b.disjointSets=new h.a;b.changed=new a.a;return b}p(d,c);l(d,[{key:"disposed",value:function(){this.changed=this.disjointSets=void 0;w(d.prototype.__proto__||Object.getPrototypeOf(d.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 c=this;this.clear();if(void 0!==a){var d=[new b.a,new b.a];Object(r.a)(a,function(a){Object(r.a)(a,function(a,b){d[b%2].parseString(String(a),10);0!==b&&c.link(d[0],
d[1])})})}}},{key:"size",get:function(){return this.disjointSets.size}}],[{key:"makeWithCounterpart",value:function(a){var b=new this;b.initializeCounterpart(a);return b}}]);return d}(n.c);v=e([Object(n.f)("DisjointUint64Sets")],v);var t=new b.a,q=new b.a;Object(n.e)("DisjointUint64Sets.add",function(a){var b=this.get(a.id);t.low=a.al;t.high=a.ah;q.low=a.bl;q.high=a.bh;b.disjointSets.link(t,q)&&b.changed.dispatch()});Object(n.e)("DisjointUint64Sets.clear",function(a){a=this.get(a.id);a.disjointSets.clear()&&
a.changed.dispatch()})},function(n,e,c){function p(a){for(var b=a,c=a[l];c!==a;)a=c,c=a[l];for(a=b[l];c!==a;)b[l]=c,b=a,a=b[l];return c}function h(a){function b(b,d){for(;;)switch(c){case 0:k=!0,e=a;case 1:if(!k&&e===a){c=3;break}c=4;return{value:e,done:!1};case 4:if(void 0===d){c=5;break}c=-1;throw d;case 5:e=e[w];case 2:k=!1;c=1;break;case 3:c=-1;default:return{value:void 0,done:!0}}}var c=0,e,k,m={next:function(a){return b(a,void 0)},throw:function(a){return b(void 0,a)},return:function(a){throw Error("Not yet implemented");
}};$jscomp.initSymbolIterator();m[Symbol.iterator]=function(){return this};return m}c.d(e,"a",function(){return q});var r=c(19),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,e){c&&a(b.prototype,c);e&&a(b,e);return b}}();$jscomp.initSymbol();var b=Symbol("disjoint_sets:rank");$jscomp.initSymbol();var l=Symbol("disjoint_sets:parent");$jscomp.initSymbol();
var w=Symbol("disjoint_sets:next");$jscomp.initSymbol();var v=Symbol("disjoint_sets:prev");$jscomp.initSymbol();var t=Symbol("disjoint_sets:min"),q=function(){function c(){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");this.map=new Map;this.generation=0}$jscomp.initSymbol();$jscomp.initSymbolIterator();a(c,[{key:"get",value:function(a){var b=this.map.get(a.toString());return void 0===b?a:p(b)[t]}},{key:"isMinElement",value:function(a){var b=this.get(a);return b===
a||r.a.equal(b,a)}},{key:"makeSet",value:function(a){var c=a.toString(),e=this.map,g=e.get(c);return void 0===g?(a=g=a.clone(),a[l]=a,a[b]=0,a[w]=a[v]=a,g[t]=g,e.set(c,g),g):p(g)}},{key:"link",value:function(a,c){a=this.makeSet(a);c=this.makeSet(c);if(a===c)return!1;this.generation++;var d=a;var e=c,g=d[b],m=e[b];g>m?e[l]=d:(d[l]=e,g===m&&(e[b]=m+1),d=e);e=a;g=c;m=e[v];var h=g[v];g[v]=m;m[w]=g;e[v]=h;h[w]=e;a=a[t];c=c[t];d[t]=r.a.less(a,c)?a:c;return!0}},{key:"setElements",value:function(a){function b(b,
d){for(;;)switch(c){case 0:l=a.toString();m=q.map.get(l);if(void 0!==m){c=1;break}c=3;return{value:a,done:!1};case 3:if(void 0===d){c=4;break}c=-1;throw d;case 4:c=2;break;case 1:g=$jscomp.makeIterator(h(m));case 5:if((e=g.next(b)).done){c=6;break}c=7;return{value:e.value,done:!1};case 7:if(void 0===d){c=8;break}c=-1;throw d;case 8:c=5;break;case 6:case 2:c=-1;default:return{value:void 0,done:!0}}}var c=0,e,g,m,l,q=this,n={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();n[Symbol.iterator]=function(){return this};return n}},{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,d){for(;;)switch(c){case 0:a=void 0===a?Array(2):a,m=$jscomp.makeIterator(h.map.values()),g=m.next();case 1:if(g.done){c=3;break}e=g.value;a[0]=e;a[1]=p(e)[t];c=4;return{value:a,done:!1};case 4:if(void 0===d){c=
5;break}c=-1;throw d;case 5:case 2:g=m.next();c=1;break;case 3:c=-1;default:return{value:void 0,done:!0}}}var c=0,e,g,m,h=this,l={next:function(a){return b(a,void 0)},throw:function(a){return b(void 0,a)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();l[Symbol.iterator]=function(){return this};return l}},{key: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 e=c.value;if(e[l]===e){c=[];e=$jscomp.makeIterator(h(e));for(var m=e.next();!m.done;m=e.next())c.push(m.value);c.sort(r.a.compare);a.push(c)}}a.sort(function(a,b){return r.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 c}()},function(n,e,c){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 h(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 r(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}c.d(e,"a",function(){return d});var a=c(75),b=c(122),l=c(121),w=
c(55);n=c(114);var v=c(12),t=function k(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 k(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},q=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}}(),m=new Float32Array(8),g=function(){function b(c){r(this,b);this.disjointSets=c;this.generation=Number.NaN;this.hashMap=new a.a}q(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 d=$jscomp.makeIterator(c.value);c=d.next().value;d=d.next().value;b.set(c,d)}}}}]);return b}(),d=function(a){function c(a,d){r(this,c);var e=
p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this,a,{sourceOptions:d.volumeSourceOptions,transform:d.objectToDataTransform}));e.displayState=d;e.segmentColorShaderManager=new l.b("segmentColorHash");e.hashTableManager=new b.c("visibleSegments");e.gpuHashTable=b.a.get(e.gl,e.displayState.visibleSegments.hashTable);e.equivalencesShaderManager=new b.b("equivalences");e.equivalencesHashMap=new g(e.displayState.segmentEquivalences.disjointSets);e.gpuEquivalencesHashTable=b.a.get(e.gl,e.equivalencesHashMap.hashMap);
Object(w.g)(d,e);e.registerDisposer(d.selectedAlpha.changed.add(function(){e.redrawNeeded.dispatch()}));e.registerDisposer(d.hideSegmentZero.changed.add(function(){e.redrawNeeded.dispatch();e.shaderUpdated=!0}));e.hasEquivalences=0!==e.displayState.segmentEquivalences.size;d.segmentEquivalences.changed.add(function(){var a=0!==e.displayState.segmentEquivalences.size;a!==e.hasEquivalences&&(e.hasEquivalences=a,e.shaderUpdated=!0)});e.registerDisposer(d.notSelectedAlpha.changed.add(function(){e.redrawNeeded.dispatch()}));
return e}h(c,a);q(c,[{key:"getShaderKey",value:function(){return"sliceview.SegmentationRenderLayer/"+this.hasEquivalences+"/"+this.displayState.hideSegmentZero.value}},{key:"defineShader",value:function(a){t(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"defineShader",this).call(this,a);this.hashTableManager.defineShader(a);a.addFragmentCode("\nuint64_t getUint64DataValue() {\n  return toUint64(getDataValue());\n}\n");this.hasEquivalences?(this.equivalencesShaderManager.defineShader(a),
a.addFragmentCode("\nuint64_t getMappedObjectId() {\n  uint64_t value = getUint64DataValue();\n  uint64_t mappedValue;\n  if ("+this.equivalencesShaderManager.getFunctionName+"(value, mappedValue)) {\n    return mappedValue;\n  }\n  return value;\n}\n")):a.addFragmentCode("\nuint64_t getMappedObjectId() {\n  return getUint64DataValue();\n}\n");this.segmentColorShaderManager.defineShader(a);a.addUniform("highp vec4","uSelectedSegment",2);a.addUniform("highp float","uShowAllSegments");a.addUniform("highp float",
"uSelectedAlpha");a.addUniform("highp float","uNotSelectedAlpha");a.addFragmentCode(v.o);var b="\n  uint64_t value = getMappedObjectId();\n  \n  float alpha = uSelectedAlpha;\n  float saturation = 1.0;\n";this.displayState.hideSegmentZero.value&&(b+="\n  if (value.low == vec4(0,0,0,0) && value.high == vec4(0,0,0,0)) {\n    emit(vec4(vec4(0, 0, 0, 0)));\n    return;\n  }\n");b+="\n  bool has = uShowAllSegments > 0.0 ? true : "+this.hashTableManager.hasFunctionName+"(value);\n  if (uSelectedSegment[0] == unnormalizeUint8(value.low) &&\n      uSelectedSegment[1] == unnormalizeUint8(value.high)) {\n    saturation = has ? 0.5 : 0.75;\n  } else if (!has) {\n    alpha = uNotSelectedAlpha;\n  }\n  vec3 rgb = segmentColorHash(value);\n  emit(vec4(mix(vec3(1.0,1.0,1.0), rgb, saturation), alpha));\n";
a.setFragmentMain(b)}},{key:"beginSlice",value:function(a){a=t(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"beginSlice",this).call(this,a);var b=this.gl,d=this.displayState,e=this.displayState,g=e.segmentSelectionState;e=e.visibleSegments;if(g.hasSelectedSegment){var k=g.selectedSegment;g=k.low;k=k.high;for(var h=0;4>h;++h)m[h]=g>>8*h&255,m[4+h]=k>>8*h&255}else m.fill(0);b.uniform1f(a.uniform("uSelectedAlpha"),this.displayState.selectedAlpha.value);b.uniform1f(a.uniform("uNotSelectedAlpha"),
this.displayState.notSelectedAlpha.value);b.uniform4fv(a.uniform("uSelectedSegment"),m);b.uniform1f(a.uniform("uShowAllSegments"),e.hashTable.size?0:1);this.hashTableManager.enable(b,a,this.gpuHashTable);this.hasEquivalences&&(this.equivalencesHashMap.update(),this.equivalencesShaderManager.enable(b,a,this.gpuEquivalencesHashTable));this.segmentColorShaderManager.enable(b,a,d.segmentColorHash);return a}},{key:"endSlice",value:function(a){this.hashTableManager.disable(this.gl,a);t(c.prototype.__proto__||
Object.getPrototypeOf(c.prototype),"endSlice",this).call(this,a)}}]);return c}(n.a)},function(n,e,c){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)}c.d(e,"a",function(){return l});var h=c(75),r=c(3);n=c(16);var 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}}(),b=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)}};e=this&&this.__decorate||function(a,
b,c,e){var d=arguments.length,f=3>d?b:null===e?e=Object.getOwnPropertyDescriptor(b,c):e,g;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)f=Reflect.decorate(a,b,c,e);else for(var m=a.length-1;0<=m;m--)if(g=a[m])f=(3>d?g(f):3<d?g(b,c,f):g(b,c))||f;return 3<d&&f&&Object.defineProperty(b,c,f),f};var l=w=function(c){function e(){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var a=(e.__proto__||Object.getPrototypeOf(e)).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 h.b;a.changed=new r.b;return a}p(e,c);$jscomp.initSymbol();$jscomp.initSymbolIterator();a(e,[{key:"disposed",value:function(){b(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"disposed",this).call(this);this.changed=this.hashTable=void 0}},{key:"add_",value:function(a){return this.hashTable.add(a)}},{key:"add",value:function(a){if(this.add_(a)){var b=this.rpc;b&&b.invoke("Uint64Set.add",{id:this.rpcId,value:a});this.changed.dispatch(a,
!0)}}},{key:"has",value:function(a){return this.hashTable.has(a)}},{key:Symbol.iterator,value:function(){return this.hashTable.keys()}},{key:"delete_",value:function(a){return this.hashTable.delete(a)}},{key:"delete",value:function(a){if(this.delete_(a)){var b=this.rpc;b&&b.invoke("Uint64Set.delete",{id:this.rpcId,value:a});this.changed.dispatch(a,!1)}}},{key:"clear",value:function(){if(this.hashTable.clear()){var a=this.rpc;a&&a.invoke("Uint64Set.clear",{id:this.rpcId});this.changed.dispatch(null,
!1)}}},{key:"toJSON",value:function(){for(var a=[],b=$jscomp.makeIterator(this),c=b.next();!c.done;c=b.next())a.push(c.value.toString());a.sort();return a}},{key:"size",get:function(){return this.hashTable.size}}],[{key:"makeWithCounterpart",value:function(a){var b=new w;b.initializeCounterpart(a);return b}}]);return e}(n.c);l=w=e([Object(n.f)("Uint64Set")],l);Object(n.e)("Uint64Set.add",function(a){var b=this.get(a.id);b.add_(a.value)&&b.changed.dispatch()});Object(n.e)("Uint64Set.delete",function(a){var b=
this.get(a.id);b.delete_(a.value)&&b.changed.dispatch()});Object(n.e)("Uint64Set.clear",function(a){a=this.get(a.id);a.hashTable.clear()&&a.changed.dispatch()});var w},function(n,e,c){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 h(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)}c.d(e,"a",function(){return l});n=c(0);e=c(19);var 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 v(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 v(a,b,c)}else{if("value"in e)return e.value;b=e.get;return void 0===b?void 0:b.call(c)}};c(31);c(213);var b=new e.a,l=function(c){function e(a){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var b=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));b.displayState=a;b.element=document.createElement("div");b.clearButton=document.createElement("button");b.itemContainer=
document.createElement("span");b.items=new Map;var c=b.element,d=b.clearButton,f=b.itemContainer;c.className="segment-set-widget neuroglancer-noselect";d.className="clear-button";d.title="Remove all segment IDs";b.registerEventListener(d,"click",function(){b.visibleSegments.clear()});f.className="item-container";c.appendChild(f);f.appendChild(d);b.registerDisposer(a.visibleSegments.changed.add(function(a,c){b.handleSetChanged(a,c)}));b.registerDisposer(a.segmentColorHash.changed.add(function(){b.handleColorChanged()}));
a=$jscomp.makeIterator(a.visibleSegments);for(c=a.next();!c.done;c=a.next())b.addElement(c.value.toString());b.updateClearButtonVisibility();return b}h(e,c);r(e,[{key:"updateClearButtonVisibility",value:function(){this.clearButton.style.display=0<this.displayState.visibleSegments.size?"":"none"}},{key:"handleSetChanged",value:function(a,b){this.updateClearButtonVisibility();var c=this.items;if(null===a){a=this.itemContainer;for(b=this.clearButton;;){var d=a.lastElementChild;if(d===b)break;a.removeChild(d)}c.clear()}else b?
this.addElement(a.toString()):(a=a.toString(),b=c.get(a),b.parentElement.removeChild(b),c.delete(a))}},{key:"addElement",value:function(a){var c=document.createElement("button");c.className="segment-button";c.textContent=a;c.title="Remove segment ID "+a;var e=this;c.addEventListener("click",function(){b.tryParseString(this.textContent);e.visibleSegments.delete(b)});c.addEventListener("mouseenter",function(){b.tryParseString(this.textContent);e.segmentSelectionState.set(b)});c.addEventListener("mouseleave",
function(){b.tryParseString(this.textContent);e.segmentSelectionState.set(null)});this.setItemColor(c);this.itemContainer.appendChild(c);this.items.set(a,c)}},{key:"setItemColor",value:function(a){b.tryParseString(a.textContent);a.style.backgroundColor=this.segmentColorHash.computeCssColor(b)}},{key:"handleColorChanged",value:function(){var a=this;this.items.forEach(function(b){a.setItemColor(b)})}},{key:"disposed",value:function(){var b=this.element,c=b.parentElement;c&&c.removeChild(b);a(e.prototype.__proto__||
Object.getPrototypeOf(e.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 e}(n.a)},function(n,e){},function(n,e,c){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 h(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)}c.d(e,"a",function(){return v});n=c(0);var r=c(11),a=c(3),b=c(19),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,e){c&&a(b.prototype,c);e&&a(b,e);return b}}(),w=function q(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 q(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};c(31);c(215);var v=function(c){function e(){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");
var b=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));b.element=document.createElement("form");b.label=document.createElement("label");b.input=document.createElement("input");b.valuesEntered=new a.b;var c=b.element,f=b.label,k=b.input;c.className="uint64-entry neuroglancer-noselect";c.appendChild(f);f.appendChild(k);b.registerEventListener(c,"submit",function(a){a.preventDefault();a=b.validateInput();void 0!==a&&(b.input.value="",b.input.classList.remove("valid-input","invalid-input"),
b.valuesEntered.dispatch(a))});b.registerEventListener(c,"input",function(){""===b.input.value?b.input.classList.remove("valid-input","invalid-input"):b.validateInput()?b.input.classList.remove("invalid-input"):b.input.classList.add("invalid-input")});return b}h(e,c);l(e,[{key:"validateInput",value:function(){var a=this.input.value;a=a.replace(/[\s,\(\)\[\]\{\};]+/g," ");a=a.trim();var c=a.split(" ");if(0!==c.length){a=[];c=$jscomp.makeIterator(c);for(var e=c.next();!e.done;e=c.next()){e=e.value;
var k=new b.a;if(!k.tryParseString(e))return;a.push(k)}return a}}},{key:"disposed",value:function(){Object(r.b)(this.element);w(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"disposed",this).call(this)}}]);return e}(n.a)},function(n,e){},function(n,e){},function(n,e,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function h(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 r(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 b(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 f="",g=0;c.has(e+f);)f=""+ ++g;d.push(e+f)}return d}function l(a){return new f.a({fragmentMain:a.displayState.fragmentMain,shaderError:a.displayState.shaderError,fragmentMainStartLine:q.a})}function w(a){return new B(a.displayState.attributeNames,function(){return a.meshSource&&a.meshSource.info.vertexAttributes})}Object.defineProperty(e,"__esModule",{value:!0});c.d(e,"SingleMeshUserLayer",function(){return x});n=c(9);var v=c.n(n);n=c(20);e=c(14);
var t=c(39),q=c(218),m=c(0),g=c(11),d=c(2),f=c(73),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}}();c(220);var x=function(a){function c(a,e){p(this,c);var f=h(this,(c.__proto__||Object.getPrototypeOf(c)).call(this,[]));f.manager=a;f.displayState=new q.b;f.parameters={meshSourceUrl:Object(d.w)(e,"source",
d.B),attributeSourceUrls:Object(d.w)(e,"vertexAttributeSources",function(a){return void 0!==a?Object(d.a)(a,d.B):[]})};f.displayState.objectToDataTransform.restoreState(e.transform);f.displayState.fragmentMain.restoreState(e.shader);f.userSpecifiedAttributeNames=Object(d.w)(e,"vertexAttributeNames",function(a){if(void 0!==a)return Object(d.a)(a,function(a){if(a=Object(d.z)(a))return a})});Object(q.e)(a.chunkManager,f.parameters).then(function(a){if(!f.wasDisposed){f.meshSource=a;var c=f.defaultAttributeNames=
b(a.info.vertexAttributes.map(function(a){return a.name})),d=f.userSpecifiedAttributeNames;void 0!==d&&d.length===c.length?(c=d,f.userSpecifiedAttributeNames=void 0):c=Array.from(c);f.displayState.attributeNames.value=c;f.addRenderLayer(new q.c(a,f.displayState));f.isReady=!0}});f.registerDisposer(f.displayState.fragmentMain.changed.add(function(){f.specificationChanged.dispatch()}));f.registerDisposer(f.displayState.attributeNames.changed.add(function(){f.specificationChanged.dispatch()}));return f}
r(c,a);k(c,[{key:"toJSON",value:function(){var a={type:"mesh"},b=this.parameters.attributeSourceUrls;a.source=this.parameters.meshSourceUrl;b&&(a.vertexAttributeSources=b);a.shader=this.displayState.fragmentMain.toJSON();a.transform=this.displayState.objectToDataTransform.toJSON();if(void 0===this.meshSource)b=this.userSpecifiedAttributeNames;else{b=this.defaultAttributeNames;for(var c=this.displayState.attributeNames.value,d=!0,e=c.length,f=0;f<e;++f)if(c[f]!==b[f]){d=!1;break}b=d?void 0:Array.from(c)}a.vertexAttributeNames=
b;return a}},{key:"makeDropdown",value:function(a){return new E(a,this)}}]);return c}(n.f),B=function(a){function b(a,c){p(this,b);var d=h(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));d.attributeNames=a;d.getAttributeInfo=c;d.element=document.createElement("div");d.debouncedValueUpdater=v()(function(){d.updateAttributeNames()},500);d.element.className="neuroglancer-single-mesh-attribute-widget";d.updateInputElements();d.registerDisposer(a.changed.add(function(){d.updateInputElements()}));
return d}r(b,a);k(b,[{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,f=this.element,g=0;g<e;++g){var k=c[g],h=k.source;if(h!==d&&void 0!==h){d=h;var m=document.createElement("div");m.className="neuroglancer-single-mesh-source-header";m.textContent=h;f.appendChild(m)}h=document.createElement("div");h.className="neuroglancer-single-mesh-attribute";
m=document.createElement("input");m.title=k.name;this.registerEventListener(m,"input",this.debouncedValueUpdater);m.type="text";h.textContent=Object(q.d)(k);h.appendChild(m);if(void 0!==k.min&&void 0!==k.max){var l=document.createElement("span");l.className="neuroglancer-single-mesh-attribute-range";l.textContent="["+k.min.toPrecision(6)+", "+k.max.toPrecision(6)+"]";h.appendChild(l)}b[g]=m;f.appendChild(h)}}a.value.forEach(function(a,c){b[c].value=a||""})}},{key:"disposed",value:function(){Object(g.b)(this.element)}},
{key:"updateAttributeNames",value:function(){var a=this.attributeNames.value,b=this.attributeNameElements,c=!1;a.forEach(function(d,e){var f=b[e].value;f||(f=void 0);f!==d&&(c=!0,a[e]=f)});c&&this.attributeNames.changed.dispatch()}}]);return b}(m.a),E=function(a){function b(a,c){p(this,b);var d=h(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));d.element=a;d.layer=c;d.attributeWidget=d.registerDisposer(w(d.layer));d.codeWidget=d.registerDisposer(l(d.layer));a.classList.add("neuroglancer-single-mesh-dropdown");
c=document.createElement("div");c.className="neuroglancer-single-mesh-dropdown-top-row";var e=document.createElement("div");e.style.flex="1";var f=document.createElement("a"),g=document.createElement("button");g.type="button";g.textContent="?";g.className="help-link";f.appendChild(g);f.title="Documentation on single mesh layer rendering";f.target="_blank";f.href="https://github.com/google/neuroglancer/blob/master/src/neuroglancer/sliceview/image_layer_rendering.md";g=document.createElement("button");
g.innerHTML="&square;";g.className="maximize-button";g.title="Show larger editor view";d.registerEventListener(g,"click",function(){new C(d.layer)});c.appendChild(e);c.appendChild(g);c.appendChild(f);a.appendChild(c);a.appendChild(d.attributeWidget.element);a.appendChild(d.codeWidget.element);d.codeWidget.textEditor.refresh();return d}r(b,a);k(b,[{key:"onShow",value:function(){this.codeWidget.textEditor.refresh()}}]);return b}(n.g),C=function(a){function b(a){p(this,b);var c=h(this,(b.__proto__||
Object.getPrototypeOf(b)).call(this));c.layer=a;c.attributeWidget=c.registerDisposer(w(c.layer));c.codeWidget=c.registerDisposer(l(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}r(b,a);return b}(t.a);Object(e.e)("mesh",x)},function(n,e,c){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 h(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 r(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function a(){return new g.a([],function(a){return Object(k.a)(a,
k.z)})}function b(a){return Object(A.a)(a.dataType,a.numComponents)}function l(a){return a.map(function(a){return Object(y.c)(new y.b,a.dataType,a.numComponents)})}function w(a,b){return a.memoize.getUncounted({type:"single_mesh:getMeshInfo",parameters:b},function(){return a.rpc.promiseInvoke(m.a,{chunkManager:a.addCounterpartRef(),parameters:b})})}c.d(e,"b",function(){return P});e.d=b;c.d(e,"c",function(){return da});e.e=function(a,b){return w(a,b).then(function(c){return a.getChunkSource(Q,{parameters:Object.assign({},
b,{info:c})})})};var v=c(35);n=c(15);var t=c(57),q=c(43),m=c(219),g=c(8),d=c(38),f=c(1),k=c(2),x=c(23),B=c(44),E=c(47),C=c(123),y=c(76),G=c(36),A=c(12),H=c(16),D=function O(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 O(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},I=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||
!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}();e.a="//NEUROGLANCER_SINGLE_MESH_LAYER_FRAGMENT_MAIN_START";var F=c(70),P=function Na(){r(this,Na);this.shaderError=Object(E.b)();var b=void 0;this.fragmentMain=new g.a(void 0===b?"void main() {\n  emitGray();\n}\n":b,k.B);this.attributeNames=a();this.objectToDataTransform=new t.a};$jscomp.initSymbol();var K=Symbol("SingleMeshShaderManager.vertexAttributeTextureUnit"),
T=Object(y.c)(new y.b,d.b.FLOAT32,3),V=function(){function a(b,c,d){r(this,a);this.attributeNames=b;this.attributeInfo=c;this.fragmentMain=d;this.tempLightVec=new Float32Array(4);this.tempPickID=new Float32Array(4);this.textureAccessHelper=new y.a("vertexData");this.indexBufferHelper=new C.a("VertexIndex")}I(a,[{key:"defineAttributeAccess",value:function(a,c){var e=this.textureAccessHelper;e.defineShader(a);a.addVertexCode(e.getAccessor("readVertexPosition","uVertexAttributeSampler[0]",d.b.FLOAT32,
3));a.addVertexCode(e.getAccessor("readVertexNormal","uVertexAttributeSampler[1]",d.b.FLOAT32,3));var f=2,g="\nvec3 vertexPosition = readVertexPosition("+c+");\nvec3 vertexNormal = readVertexNormal("+c+");\n",k=this.attributeNames;this.attributeInfo.forEach(function(d,h){if(void 0!==k[h]){var m=b(d);a.addVarying("highp "+m,"vCustom"+h);a.addFragmentCode("\n#define "+k[h]+" vCustom"+h+"\n");a.addVertexCode(e.getAccessor("readAttribute"+h,"uVertexAttributeSampler["+f+"]",d.dataType,d.numComponents));
g+="vCustom"+h+" = readAttribute"+h+"("+c+");\n";f+=1}});a.addTextureSampler2D("uVertexAttributeSampler",K,f);a.addVertexMain(g)}},{key:"defineShader",value:function(a){a.require(C.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(A.b);a.addVertexCode(A.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;f.p.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(A.p)(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(x.a)(b)+":"+Object(k.g)(d),function(){var d=new G.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(K)+a.TEXTURE0,e=function(b){a.activeTexture(d++);a.bindTexture(a.TEXTURE_2D,b)};e(c.vertexTexture);e(c.normalTexture);var f=this.attributeNames;c.vertexAttributeTextures.forEach(function(a,b){void 0!==f[b]&&e(a)})}},
{key:"disableVertexData",value:function(a,b){for(var c=2,d=this.attributeInfo.length,e=this.attributeNames,f=0;f<d;++f)void 0!==e[f]&&++c;b=b.textureUnit(K)+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(C.c)(a,b);this.indexBufferHelper.disable(b);
this.disableVertexData(a,b)}}]);return a}(),S=function(){function a(){r(this,a)}I(a,[{key:"copyToGPU",value:function(a,b){var c=this;Object(y.d)(this,a,1,this.vertexPositions.length/3);var d=function(b,d){var e=a.createTexture();a.bindTexture(a.TEXTURE_2D,e);Object(y.f)(a,c,d,b);return e};this.vertexTexture=d(this.vertexPositions,T);this.normalTexture=d(this.vertexNormals,T);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}(),L=function(a){function b(a,c){r(this,b);a=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));var d=a.vertexData=new S;d.vertexPositions=c.vertexPositions;d.vertexNormals=c.vertexNormals;d.vertexAttributes=c.vertexAttributes;c=a.indices=
c.indices;a.numIndices=c.length;return a}h(b,a);I(b,[{key:"copyToGPU",value:function(a){D(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"copyToGPU",this).call(this,a);this.vertexData.copyToGPU(a,this.source.attributeTextureFormats);this.indexBuffer=Object(C.e)(a,this.indices)}},{key:"freeGPUMemory",value:function(a){D(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"freeGPUMemory",this).call(this,a);this.vertexData.freeGPUMemory(a);this.indexBuffer.dispose()}}]);return b}(n.b),
Q=function(a){function b(){r(this,b);var a=p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));a.attributeTextureFormats=l(a.info.vertexAttributes);return a}h(b,a);I(b,[{key:"getChunk",value:function(a){return new L(this,a)}},{key:"info",get:function(){return this.parameters.info}}]);return b}(Object(n.f)(n.e,m.d)),X=function(a){function b(){r(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}h(b,a);return b}(Object(B.c)(H.b)),da=function(a){function b(a,
c){r(this,b);var d=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));d.source=a;d.displayState=c;d.shaders=new Map;d.sharedObject=d.registerDisposer(new X);d.fallbackFragmentMain="void main() {\n  emitGray();\n}\n";d.countingBuffer=d.registerDisposer(Object(C.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=m.c;c.initializeCounterpart(a.chunkManager.rpc,{chunkManager:a.chunkManager.rpcId,source:a.addCounterpartRef()});d.setReady(!0);return d}h(b,a);I(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();D(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 V(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(Ba){if(this.displayState.shaderError.value=Ba,d=this.fallbackFragmentMain,d!==e){d=this.shaderManager=this.makeShaderManager(d);try{c=d.getShader(this.gl,a)}catch(Ib){}}}b.set(a,c)}return c}},{key:"draw",value:function(a){if(a.emitColor||!a.alreadyEmittedPickID){var b=this.source.chunks.get(m.b);if(void 0!==b&&b.state===v.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(m.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}(q.a)},function(n,e,c){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 h(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}c.d(e,"d",function(){return r});e.c="single_mesh/SingleMeshLayer";e.a="single_mesh/getSingleMeshInfo";e.b="";var r=function(a){function b(){h(this,b);var a=(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!a||"object"!==typeof a&&"function"!==typeof a?this:a}p(b,a);return b}(function b(){h(this,b)});r.RPC_ID="single_mesh/SingleMeshSource"},function(n,e){},function(n,e,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function h(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 r(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(e,"__esModule",{value:!0});c.d(e,"AnnotationPointListUserLayer",function(){return m});var a=c(222),b=c(223);n=c(20);e=c(14);var l=c(8),w=c(1),v=c(225),t=function f(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 f(a,b,c)}else{if("value"in e)return e.value;b=e.get;return void 0===b?void 0:b.call(c)}},q=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}}();c(227);var m=function(c){function e(c,f){p(this,e);var g=h(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,[]));g.manager=c;g.selectedIndex=new l.b(null);
g.layer=new a.a(g.manager.chunkManager,new b.a,g.manager.voxelSize,g.selectedIndex);g.layer.pointList.restoreState(f.points);g.registerDisposer(g.layer.pointList.changed.add(function(){g.specificationChanged.dispatch()}));g.addRenderLayer(new a.b(g.layer));g.addRenderLayer(new a.c(g.layer));var k=c.layerSelectedValues;g.registerDisposer(k.changed.add(function(){var a=k.get(g);g.selectedIndex.value="number"===typeof a?a:null}));g.isReady=!0;return g}r(e,c);q(e,[{key:"toJSON",value:function(){var a=
{type:"pointAnnotation"};a.points=this.layer.pointList.toJSON();return a}},{key:"handleAction",value:function(a){switch(a){case "annotate":a=this.manager.layerSelectedValues.get(this),void 0!==a?this.layer.pointList.delete(a):this.manager.layerSelectedValues.mouseState.active&&this.layer.pointList.append(this.manager.voxelSize.voxelFromSpatial(w.p.create(),this.manager.layerSelectedValues.mouseState.position))}}},{key:"makeDropdown",value:function(a){return new g(a,this)}}]);return e}(n.f),g=function(a){function b(a,
c){p(this,b);var e=h(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));e.element=a;e.layer=c;e.pointListWidget=e.registerDisposer(new v.a(e.layer.layer.pointList,e.layer.selectedIndex));a.classList.add("neuroglancer-annotation-point-list-dropdown");a.appendChild(e.pointListWidget.element);e.registerDisposer(e.pointListWidget.pointSelected.add(function(a){e.layer.manager.setVoxelCoordinates(e.layer.layer.pointList.get(a))}));return e}r(b,a);q(b,[{key:"onShow",value:function(){t(b.prototype.__proto__||
Object.getPrototypeOf(b.prototype),"onShow",this).call(this);this.pointListWidget.visible=!0}},{key:"onHide",value:function(){t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"onHide",this).call(this);this.pointListWidget.visible=!1}}]);return b}(n.g);Object(e.e)("pointAnnotation",m)},function(n,e,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function h(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 r(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)}c.d(e,"a",function(){return x});c.d(e,"b",function(){return E});c.d(e,"c",function(){return y});n=c(43);e=c(66);var a=c(0),b=c(1),
l=c(3),w=c(24),v=c(123),t=c(36),q=c(12),m=c(69),g=function A(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 A(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},d=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,
c);d&&a(b,d);return b}}(),f=b.j.create(),k=new Float32Array(4),x=function(a){function c(a,b,d,e){p(this,c);var f=h(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));f.chunkManager=a;f.pointList=b;f.voxelSizeObject=d;f.selectedIndex=e;f.generation=-1;f.redrawNeeded=new l.a;f.color=Float32Array.of(1,1,0,1);f.selectedColor=Float32Array.of(0,1,0,1);f.buffer=new w.a(a.gl);f.registerDisposer(b.changed.add(function(){f.selectedIndex.value=null;f.redrawNeeded.dispatch()}));f.registerDisposer(e.changed.add(function(){f.redrawNeeded.dispatch()}));
return f}r(c,a);d(c,[{key:"updateBuffer",value:function(){var a=this.pointList,b=a.generation;this.generation!==b&&(this.generation=b,this.buffer.setData(a.points.view))}},{key:"updateMouseState",value:function(a,c){b.p.multiply(a.position,this.pointList.get(c),this.voxelSizeObject.size)}},{key:"gl",get:function(){return this.chunkManager.gl}}]);return c}(a.a);c=function(a){function c(a){p(this,c);var b=h(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));b.gl=a;b.shaders=new Map;b.squareCornersBuffer=
Object(m.a)(b.gl);b.countingBuffer=b.registerDisposer(Object(v.d)(b.gl));return b}r(c,a);d(c,[{key:"defineShader",value:function(a){a.addAttribute("highp vec3","aVertexPosition");a.addAttribute("highp vec2","aCornerOffset");a.addUniform("highp vec2","uPointRadii");a.addUniform("highp vec4","uColor");a.addUniform("highp vec4","uColorSelected");a.addUniform("highp vec4","uSelectedIndex");a.addVarying("highp vec4","vColor");a.addUniform("highp mat4","uProjection");a.addUniform("highp vec4","uPickID");
a.addVarying("highp vec4","vPickID");a.addVarying("highp vec2","vPointCoord");a.require(v.b);a.addVertexCode(q.b);a.setVertexMain("\ngl_Position = uProjection * vec4(aVertexPosition, 1.0);\ngl_Position.xy += aCornerOffset * uPointRadii * gl_Position.w;\nvPointCoord = aCornerOffset;\n\nuint32_t primitiveIndex = getPrimitiveIndex();\n\nuint32_t pickID; pickID.value = uPickID;\nvPickID = add(pickID, primitiveIndex).value;\n\nif (uSelectedIndex == primitiveIndex.value) {\n  vColor = uColorSelected;\n} else {\n  vColor = uColor;\n}\n");
a.setFragmentMain("\nif (dot(vPointCoord, vPointCoord) > 1.0) {\n  discard;\n}\nemit(getColor(), vPickID);\n")}},{key:"getShader",value:function(a){var b=this.shaders,c=b.get(a);void 0===c&&(c=new t.a(this.gl),c.require(a),this.defineShader(c),c=this.registerDisposer(c.build()),b.set(a,c));return c}},{key:"draw",value:function(a,c,d){var e=this.getShader(d.emitter),g=this.gl;e.bind();c.updateBuffer();var h=c.pointList.length,m=e.attribute("aVertexPosition"),l=e.attribute("aCornerOffset");c.buffer.bindToVertexAttrib(m,
3);g.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(m,1);this.squareCornersBuffer.bindToVertexAttrib(l,2);this.countingBuffer.ensure(h).bind(e,1);b.j.identity(f);b.j.scale(f,f,c.voxelSizeObject.size);b.j.multiply(f,d.dataToDevice,f);g.uniformMatrix4fv(e.uniform("uProjection"),!1,f);g.uniform2f(e.uniform("uPointRadii"),8/d.viewportWidth,8/d.viewportHeight);d.emitPickID&&(a=d.pickIDs.register(a,h),g.uniform4fv(e.uniform("uPickID"),Object(q.p)(k,a)));d.emitColor&&(g.uniform4fv(e.uniform("uColor"),c.color),
g.uniform4fv(e.uniform("uColorSelected"),c.selectedColor),c=c.selectedIndex.value,null===c&&(c=4294967295),g.uniform4fv(e.uniform("uSelectedIndex"),Object(q.p)(k,c)));g.ANGLE_instanced_arrays.drawArraysInstancedANGLE(g.TRIANGLE_FAN,0,4,h);g.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(m,0);Object(v.c)(g,e,!0);g.disableVertexAttribArray(m)}}]);return c}(a.a);var B=function(a){function b(){p(this,b);return h(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}r(b,a);d(b,[{key:"defineShader",
value:function(a){g(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"defineShader",this).call(this,a);a.addFragmentCode("\nvec4 getColor () { return vColor; }\n")}}]);return b}(c),E=function(a){function b(a){p(this,b);var c=h(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.base=a;c.renderHelper=c.registerDisposer(new B(c.gl));c.registerDisposer(a);c.registerDisposer(a.redrawNeeded.add(function(){c.redrawNeeded.dispatch()}));c.setReady(!0);return c}r(b,a);d(b,[{key:"draw",value:function(a){this.renderHelper.draw(this,
this.base,a)}},{key:"updateMouseState",value:function(a,b,c){this.base.updateMouseState(a,c)}},{key:"transformPickedValue",value:function(a,b){return b}},{key:"gl",get:function(){return this.base.chunkManager.gl}}]);return b}(n.a),C=function(a){function b(){p(this,b);return h(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}r(b,a);d(b,[{key:"defineShader",value:function(a){g(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"defineShader",this).call(this,a);a.addFragmentCode("\nvec4 getColor() {\n  float scalar = 1.0 - 2.0 * abs(0.5 - gl_FragCoord.z);\n  return vec4(vColor.xyz, scalar * vColor.a);\n}\n")}}]);
return b}(c),y=function(a){function b(a){p(this,b);var c=h(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.base=a;c.renderHelper=c.registerDisposer(new C(c.gl));c.registerDisposer(a);c.registerDisposer(a.redrawNeeded.add(function(){c.redrawNeeded.dispatch()}));c.setReady(!0);return c}r(b,a);d(b,[{key:"draw",value:function(a){this.renderHelper.draw(this,this.base,a)}},{key:"updateMouseState",value:function(a,b,c){this.base.updateMouseState(a,c)}},{key:"transformPickedValue",value:function(a,
b){return b}},{key:"gl",get:function(){return this.base.chunkManager.gl}}]);return b}(e.b)},function(n,e,c){c.d(e,"a",function(){return b});var p=c(224),h=c(2),r=c(3),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}}(),b=function(){function b(){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");
this.points=new p.a;this.changed=new r.a;this.generation=0}a(b,[{key:"delete",value:function(a){this.points.eraseRange(3*a,3*a+3);++this.generation;this.changed.dispatch()}},{key:"get",value:function(a){return this.points.data.subarray(3*a,3*a+3)}},{key:"append",value:function(a){this.points.appendArray(a.subarray(0,3));++this.generation;this.changed.dispatch()}},{key:"reset",value:function(){this.points.clear();++this.generation;this.changed.dispatch()}},{key:"restoreState",value:function(a){try{if(Array.isArray(a)){var b=
a.length,c=this.points;c.resize(3*b);var e=c.data;for(c=0;c<b;++c){var m=3*c;Object(h.c)(e.subarray(m,m+3),a[c],h.o)}++this.generation;this.changed.dispatch()}}catch(g){this.reset()}}},{key:"toJSON",value:function(){for(var a=this.length,b=this.points.data,c=Array(a),e=0;e<a;++e){var h=3*e;c[e]=[b[h],b[h+1],b[h+2]]}return c}},{key:"length",get:function(){return this.points.length/3}}]);return b}()},function(n,e,c){c.d(e,"a",function(){return h});var p=function(){function c(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(a,b,e){b&&c(a.prototype,b);e&&c(a,e);return a}}(),h=function(){function c(a){a=void 0===a?16:a;if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");this.length=0;this.data=new Float32Array(a)}p(c,[{key:"resize",value:function(a){var b=this.data;if(a>b.length){var c=new Float32Array(Math.max(a,2*b.length));c.set(b.subarray(0,this.length));this.data=
c}this.length=a}},{key:"shrinkToFit",value:function(){this.data=new Float32Array(this.view)}},{key:"clear",value:function(){this.length=0}},{key:"appendArray",value:function(a){var b=this.length;this.resize(b+a.length);this.data.set(a,b)}},{key:"eraseRange",value:function(a,b){this.data.copyWithin(a,b,this.length);this.length-=b-a}},{key:"view",get:function(){var a=this.data;return new Float32Array(a.buffer,a.byteOffset,this.length)}}]);return c}()},function(n,e,c){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 h(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)}c.d(e,"a",function(){return w});n=c(0);var r=c(11),a=c(3),b=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}}(),l=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)}};c(31);c(226);var w=function(c){function e(b,c){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");
var d=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));d.pointList=b;d.selectionIndex=c;d.element=document.createElement("div");d.clearButton=document.createElement("button");d.itemContainer=document.createElement("div");d.generation=-1;d.pointSelected=new a.b;d.visible_=!1;c=d.element;var f=d.clearButton,g=d.itemContainer;c.className="neuroglancer-point-list-widget";f.className="neuroglancer-clear-button";f.textContent="Delete all points";d.registerEventListener(f,"click",function(){d.pointList.reset()});
g.className="neuroglancer-item-container neuroglancer-select-text";c.appendChild(f);c.appendChild(g);d.registerDisposer(b.changed.add(function(){d.maybeUpdate()}));return d}h(e,c);b(e,[{key:"maybeUpdate",value:function(){var a=this;if(this.visible_){var b=this.pointList;if(this.generation!==b.generation){this.generation=b.generation;var c=this.itemContainer;Object(r.a)(c);var e=b.length;b=b.points.data;for(var k={i:0};k.i<e;k={i:k.i},++k.i){var h=document.createElement("div");h.className="neuroglancer-point-list-item";
var l=3*k.i;h.textContent=Math.round(b[l])+" "+Math.round(b[l+1])+" "+Math.round(b[l+2]);h.addEventListener("click",function(b){return function(){a.pointSelected.dispatch(b.i)}}(k));h.addEventListener("mouseenter",function(b){return function(){a.selectionIndex.value=b.i}}(k));h.addEventListener("mouseleave",function(){a.selectionIndex.value=null});c.appendChild(h)}}}}},{key:"disposed",value:function(){Object(r.b)(this.element);this.clearButton=this.itemContainer=this.element=void 0;l(e.prototype.__proto__||
Object.getPrototypeOf(e.prototype),"disposed",this).call(this)}},{key:"visible",get:function(){return this.visible_},set:function(a){this.visible_!==a&&(this.visible_=a,!0===a&&this.maybeUpdate())}}]);return e}(n.a)},function(n,e){},function(n,e){},function(n,e,c){function p(a){var b=new C.a,c=new v.a;b.add("viewer",c);a.global.addParent(c.eventActionMap,1E3);c=new v.a;b.add("sliceView",c);a.sliceView.addParent(c.eventActionMap,1E3);c=new v.a;b.add("perspectiveView",c);a.perspectiveView.addParent(c.eventActionMap,
1E3);c=new v.a;b.add("dataView",c);a.perspectiveView.addParent(c.eventActionMap,999);a.sliceView.addParent(c.eventActionMap,999);return b}function h(a){var b=new d.a({},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(r()(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(e,"__esModule",{value:!0});n=c(9);var r=c.n(n),a=c(77),b=c(26),l=c(113),w=c(229),v=c(230),t=c(231),q=c(232),m=c(233),g=c(234),d=c(8),f=c(269),k=c(270),x=c(271),B=c(308),E=c(2),C=c(27);window.addEventListener("DOMContentLoaded",function(){var c=new C.a,
e=new C.a,n=new w.a;c.add("credentials",n.inputState);e.add("credentials",n.outputState);n=Object(b.a)({credentialsManager:new a.a(n)});var v=new l.PythonDataSource;n.register("python",v);c.add("sourceGenerations",h(v));var D=window.viewer=Object(x.a)({showLayerDialog:!1,resetStateWhenEmpty:!1,dataSourceProvider:n});Object(k.a)(D.inputEventBindings);c.add("inputEventBindings",p(D.inputEventBindings));n=new t.a(D);window.remoteActionHandler=n;c.add("actions",n.actionSet);c.add("statusMessages",new q.a);
v=new m.a(D);c.add("screenshot",v.requestState);var I=D.state;window.location.hash&&(D.registerDisposer(new B.a(D.state)).updateFromUrlHash(),I=void 0);c.add("showUIControls",D.showUIControls);c.add("showLayerPanel",D.showLayerPanel);c.add("showHelpButton",D.showHelpButton);c.add("showLocation",D.showLocation);c.add("showPanelBorders",D.showPanelBorders);var F=new d.a(void 0,function(a){return Object(E.c)([0,0],a,E.s)});c.add("viewerSize",F);var P=function(){var a=D.display.container,b=F.value;void 0===
b?(a.style.position="relative",a.style.width=null,a.style.height=null):(a.style.position="absolute",a.style.width=b[0]+"px",a.style.height=b[1]+"px");D.display.onResize()};P();F.changed.add(r()(function(){return P()},0));var K=new g.a(I,e,c);n.sendActionRequested.add(function(a,b){return K.sendActionNotification(a,b)});v.sendScreenshotRequested.add(function(a){return K.sendActionNotification("screenshot",a)});Object(f.a)(D);Object(f.b)(D)})},function(n,e,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
}function h(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 r(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)}c.d(e,"a",function(){return m});
var a=c(77),b=c(8),l=c(53),w=c(27),v=c(2),t=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,e){c&&a(b.prototype,c);e&&a(b,e);return b}}(),q=function(c){function d(){p(this,d);var c=h(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments));c.invalidCredentials=new b.a(void 0,function(a){return a});c.validCredentials=new b.a(void 0,function(a){return a});
c.get=Object(a.d)(function(a){return new Promise(function(b){var d=c.validCredentials.value,e=void 0!==a?a.generation:null;if(void 0!==d&&e!==d.generation)b(d);else{c.invalidCredentials.value=e;var f=c.validCredentials.changed.add(function(){var a=c.validCredentials.value;void 0!==a&&e!==a.generation&&(f(),b(a))})}})});return c}r(d,c);return d}(a.c),m=function(){function a(){p(this,a);this.inputState=new w.b;this.outputState=new w.b;this.memoize=new l.a}t(a,[{key:"getCredentialsProvider",value:function(a,
b){var c=this;void 0===b&&(b=null);var d=Object(v.g)({key:a,parameters:b});return this.memoize.get(d,function(){var a=new q;a.registerDisposer(c.inputState.add(d,a.validCredentials));a.registerDisposer(c.outputState.add(d,a.invalidCredentials));return a})}}]);return a}()},function(n,e,c){c.d(e,"a",function(){return b});var p=c(2),h=c(3),r=c(17),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}}(),b=function(){function b(){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");this.eventActionMap=new r.a;this.changed=new h.a}a(b,[{key:"reset",value:function(){this.eventActionMap.clear();this.changed.dispatch()}},{key:"restoreState",value:function(a){Object(p.u)(a);for(var b=this.eventActionMap,c=$jscomp.makeIterator(Object.keys(a)),e=c.next();!e.done;e=c.next()){e=e.value;var h=Object(p.B)(a[e]);
b.set(e,h)}this.changed.dispatch()}},{key:"toJSON",value:function(){for(var a={},b=$jscomp.makeIterator(this.eventActionMap.bindings),c=b.next();!c.done;c=b.next()){var e=$jscomp.makeIterator(c.value);c=e.next().value;e=e.next().value;a[c]=e.action}return a}}]);return b}()},function(n,e,c){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 h(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)}c.d(e,"a",function(){return g});n=c(9);var r=c.n(n),a=c(8);n=c(0);var b=c(17),l=c(1),w=c(2),v=c(3),t=c(27),q=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}}(),m=function f(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 f(a,b,c)}else{if("value"in e)return e.value;b=e.get;return void 0===b?void 0:b.call(c)}},g=function(c){function e(b){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var c=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));
c.viewer=b;c.actionSet=new a.a(new Set,function(a){return new Set(Object(w.C)(a))});c.actionDisposers=[];c.sendActionRequested=new v.b;c.actionSet.changed.add(r()(function(){return c.updateActions()},0));return c}h(e,c);q(e,[{key:"clearListeners",value:function(){for(var a=$jscomp.makeIterator(this.actionDisposers),b=a.next();!b.done;b=a.next())b=b.value,b();this.actionDisposers.length=0}},{key:"disposed",value:function(){this.clearListeners();m(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),
"disposed",this).call(this)}},{key:"updateActions",value:function(){var a=this;this.clearListeners();for(var c={},e=$jscomp.makeIterator(this.actionSet.value),f=e.next();!f.done;c={action:c.action},f=e.next())c.action=f.value,this.actionDisposers.push(Object(b.c)(this.viewer.element,c.action,function(b){return function(){return a.handleAction(b.action)}}(c)))}},{key:"handleAction",value:function(a){var b=this.viewer,c=b.mouseState;b=b.layerSelectedValues;var e={};if(c.updateUnconditionally()){e.mouseSpatialCoordinates=
Array.prototype.slice.call(c.position);var f=this.viewer.navigationState.voxelSize;f.valid&&(e.mouseVoxelCoordinates=Array.prototype.slice.call(l.p.divide(l.p.create(),c.position,f.size)))}e.selectedValues=b;e.viewerState=Object(t.c)(this.viewer.state).value;this.sendActionRequested.dispatch(a,JSON.parse(JSON.stringify(e)))}}]);return e}(n.a)},function(n,e,c){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 h(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)}c.d(e,"a",function(){return v});n=c(9);var r=c.n(n),a=c(33),b=c(3);n=c(0);var l=c(2),w=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=
d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,e){c&&a(b.prototype,c);e&&a(b,e);return b}}(),v=function(c){function e(){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var a=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));a.existingMessages=new Map;a.changed=new b.a;a.messages=new Map;a.changed.add(a.registerCancellable(r()(function(){return a.updateMessages()},0)));return a}h(e,c);w(e,
[{key:"reset",value:function(){this.messages.clear();this.changed.dispatch()}},{key:"restoreState",value:function(a){Object(l.u)(a);this.messages.clear();for(var b=$jscomp.makeIterator(Object.keys(a)),c=b.next();!c.done;c=b.next()){c=c.value;var e=Object(l.B)(a[c]);this.messages.set(c,e)}this.changed.dispatch()}},{key:"disposed",value:function(){for(var a=$jscomp.makeIterator(this.existingMessages.values()),b=a.next();!b.done;b=a.next())b.value.dispose();this.existingMessages.clear()}},{key:"updateMessages",
value:function(){for(var b=this.existingMessages,c=this.messages,d=$jscomp.makeIterator(b),e=d.next();!e.done;e=d.next()){var k=$jscomp.makeIterator(e.value);e=k.next().value;k=k.next().value;var h=c.get(e);void 0===h?(k.dispose(),b.delete(e)):k.setText(h)}c=$jscomp.makeIterator(c);for(d=c.next();!d.done;d=c.next())e=$jscomp.makeIterator(d.value),d=e.next().value,e=e.next().value,b.has(d)||(k=new a.a,k.setText(e),b.set(d,k))}},{key:"toJSON",value:function(){for(var a={},b=$jscomp.makeIterator(this.messages),
c=b.next();!c.done;c=b.next()){var e=$jscomp.makeIterator(c.value);c=e.next().value;e=e.next().value;a[c]=e}return a}}]);return e}(n.a)},function(n,e,c){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 h(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)}c.d(e,"a",function(){return t});n=c(9);var r=c.n(n),a=c(8);n=c(0);var b=c(2),l=c(3),w=c(27),v=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,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),t=function(c){function e(c){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");
var d=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));d.viewer=c;d.sendScreenshotRequested=new l.b;d.requestState=new a.a(void 0,b.z);d.previousRequest=void 0;var f=d.registerCancellable(r()(function(){return d.maybeSendScreenshot()},0));d.requestState.changed.add(f);d.registerDisposer(c.display.updateFinished.add(f));return d}h(e,c);v(e,[{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 e=$jscomp.makeIterator(b.layerManager.managedLayers),h=e.next();!h.done;h=e.next())if(!h.value.isReady())return;this.previousRequest=a;b.display.draw();e=b.display.canvas.toDataURL();e.startsWith("data:image/png;base64,")?(b="image/png",e=e.substring(22)):e=b="";a={viewerState:JSON.parse(JSON.stringify(Object(w.c)(this.viewer.state).value)),selectedValues:JSON.parse(JSON.stringify(c)),screenshot:{id:a,image:e,imageType:b}};this.sendScreenshotRequested.dispatch(a)}}}]);
return e}(n.a)},function(n,e,c){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 h(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 r(){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]}c.d(e,"a",function(){return v});var a=c(235);n=c(0);e=c(237);var b=c.n(e),l=c(33),w=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,e){c&&a(b.prototype,c);e&&a(b,e);return b}}(),
v=function(c){function e(b,c,d,f){f=void 0===f?r():f;if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var g=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));g.sharedState=b;g.privateState=c;g.configState=d;g.url=f;g.reconnectionDelay=1E3;g.waitingToReconnect=-1;g.isOpen=!1;g.updateClients=new Map;g.status=g.registerDisposer(new l.a(!0));g.actionQueue=[];g.nextActionId=0;g.lastActionAcknowledged=-1;c=[{key:"p",state:c,receiveUpdates:!1,sendUpdates:0},{key:"c",
state:d,receiveUpdates:!0,sendUpdates:null}];void 0!==b&&c.push({key:"s",state:b,receiveUpdates:!0,sendUpdates:100});b={};c=$jscomp.makeIterator(c);for(d=c.next();!d.done;b={key:b.key},d=c.next()){var h=d.value;b.key=h.key;d=h.receiveUpdates;f=h.sendUpdates;h=g.registerDisposer(new a.a(h.state,f,d));g.updateClients.set(b.key,h);null!==f&&h.sendUpdateRequested.add(function(a){return function(b,c){return g.send("setState",{k:a.key,s:b,g:c})}}(b));d&&h.receiveUpdateRequested.add(function(a){return function(b){return g.send("getState",
{g:b,k:a.key})}}(b))}g.connect();return g}h(e,c);w(e,[{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,b){b.t=a;this.socket.send(JSON.stringify(b))}},{key:"connect",value:function(){var a=this;this.status.setText("Connecting to Python server");this.status.setVisible(!0);var c=this.socket=new b.a(this.url,{transports:["websocket",
"xhr-streaming"]});c.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()};c.onclose=function(){a.isOpen=!1;for(var b=a.reconnectionDelay,c=$jscomp.makeIterator(a.updateClients.values()),e=c.next();!e.done;e=c.next())e.value.connected=!1;var g=Date.now()+b;a.status.setVisible(!0);var h=function(b){a.status.setText("Disconnected from Python server.  "+
("Retrying in "+Math.ceil(b/1E3)+" seconds."))};a.waitingToReconnect=setInterval(function(){var b=g-Date.now();0>b?(clearInterval(a.waitingToReconnect),a.waitingToReconnect=-1,a.connect()):h(b)},1E3);h(b);a.reconnectionDelay=Math.min(3E4,2*b)};c.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,b){this.actionQueue.push({action:a,state:b});++this.nextActionId;
this.isOpen&&this.flushActionQueue()}}]);return e}(n.a)},function(n,e,c){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 h(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)}c.d(e,"a",function(){return t});n=c(9);var r=c.n(n);n=c(94);var a=c.n(n);n=c(0);var b=c(236),l=c(3),w=c(27),v=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,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),t=function(c){function e(b,c,f){c=void 0===c?100:c;f=void 0===f?!0:f;if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");
var d=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));d.state=b;d.receiveUpdates=f;d.serverGeneration="";d.clientGeneration=-1;d.connected_=!1;d.receiveUpdateRequested=new l.b;d.sendUpdateRequested=new l.b;null!==c?(d.sendUpdates=!0,d.registerDisposer(b.changed.add(d.registerCancellable(a()(d.registerCancellable(r()(function(){return d.handleStateChanged()},0)),c,{leading:!1}))))):d.sendUpdates=!1;return d}h(e,c);v(e,[{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(w.c)(this.state).value,c=JSON.stringify(a);if(c===this.lastServerState)this.clientGeneration=this.state.changed.count;else{var e=Object(b.a)(160);
this.serverGeneration=e;this.lastServerState=c;this.sendUpdateRequested.dispatch(a,e)}}}},{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 e}(n.a)},function(n,e,c){e.a=function(c){c=Math.ceil((void 0===c?128:c)/32);var e=new Uint32Array(c);crypto.getRandomValues(e);for(var n="",a=0;a<c;++a)n+=("00000000"+e[a].toString(16)).slice(-8);
return n}},function(n,e,c){e=c(5);var p=c(238);n.exports=c(257)(p);"_sockjs_onload"in e&&setTimeout(e._sockjs_onload,1)},function(n,e,c){n.exports=[c(239),c(246),c(128),c(129),c(79)(c(129)),c(133),c(79)(c(133)),c(134),c(253),c(79)(c(134)),c(254)]},function(n,e,c){(function(e){function h(b,c,e){if(!h.enabled())throw Error("Transport created when disabled");l.call(this);v("constructor",b);var g=this;b=a.addPath(b,"/websocket");this.url=b="https"===b.slice(0,5)?"wss"+b.slice(5):"ws"+b.slice(4);this.ws=
new w(this.url,[],e);this.ws.onmessage=function(a){v("message event",a.data);g.emit("message",a.data)};this.unloadRef=p.unloadAdd(function(){v("unload");g.ws.close()});this.ws.onclose=function(a){v("close event",a.code,a.reason);g.emit("close",a.code,a.reason);g._cleanup()};this.ws.onerror=function(a){v("error event",a);g.emit("close",1006,"WebSocket connection broken");g._cleanup()}}var p=c(34),a=c(18),b=c(4),l=c(10).EventEmitter,w=c(245),v=function(){};"production"!==e.env.NODE_ENV&&(v=c(7)("sockjs-client:websocket"));
b(h,l);h.prototype.send=function(a){a="["+a+"]";v("send",a);this.ws.send(a)};h.prototype.close=function(){v("close");var a=this.ws;this._cleanup();a&&a.close()};h.prototype._cleanup=function(){v("_cleanup");var a=this.ws;a&&(a.onmessage=a.onclose=a.onerror=null);p.unloadDel(this.unloadRef);this.unloadRef=this.ws=null;this.removeAllListeners()};h.enabled=function(){v("enabled");return!!w};h.transportName="websocket";h.roundTrips=2;n.exports=h}).call(e,c(6))},function(n,e,c){(function(c){n.exports.randomBytes=
c.crypto&&c.crypto.getRandomValues?function(e){e=new Uint8Array(e);c.crypto.getRandomValues(e);return e}:function(c){for(var e=Array(c),a=0;a<c;a++)e[a]=Math.floor(256*Math.random());return e}}).call(e,c(5))},function(n,e,c){n.exports=function(c,e){e=e.split(":")[0];c=+c;if(!c)return!1;switch(e){case "http":case "ws":return 80!==c;case "https":case "wss":return 443!==c;case "ftp":return 21!==c;case "gopher":return 70!==c;case "file":return!1}return 0!==c}},function(n,e,c){var p=Object.prototype.hasOwnProperty;
e.stringify=function(c,e){e=e||"";var a=[];"string"!==typeof e&&(e="?");for(var b in c)p.call(c,b)&&a.push(encodeURIComponent(b)+"="+encodeURIComponent(c[b]));return a.length?e+a.join("&"):""};e.parse=function(c){for(var e=/([^=?&]+)=?([^&]*)/g,a={},b;b=e.exec(c);a[decodeURIComponent(b[1].replace(/\+/g," "))]=decodeURIComponent(b[2].replace(/\+/g," ")));return a}},function(n,e,c){function p(a){var b=0,c;for(c in a)b=(b<<5)-b+a.charCodeAt(c),b|=0;return e.colors[Math.abs(b)%e.colors.length]}function h(a){function b(){if(b.enabled){var a=
+new Date;b.diff=a-(r||a);b.prev=r;r=b.curr=a;var c=Array(arguments.length);for(a=0;a<c.length;a++)c[a]=arguments[a];c[0]=e.coerce(c[0]);"string"!==typeof c[0]&&c.unshift("%O");var h=0;c[0]=c[0].replace(/%([a-zA-Z%])/g,function(a,l){if("%%"===a)return a;h++;l=e.formatters[l];"function"===typeof l&&(a=l.call(b,c[h]),c.splice(h,1),h--);return a});e.formatArgs.call(b,c);(b.log||e.log||console.log.bind(console)).apply(b,c)}}b.namespace=a;b.enabled=e.enabled(a);b.useColors=e.useColors();b.color=p(a);"function"===
typeof e.init&&e.init(b);return b}e=n.exports=h.debug=h["default"]=h;e.coerce=function(a){return a instanceof Error?a.stack||a.message:a};e.disable=function(){e.enable("")};e.enable=function(a){e.save(a);e.names=[];e.skips=[];for(var b=("string"===typeof a?a:"").split(/[\s,]+/),c=b.length,h=0;h<c;h++)b[h]&&(a=b[h].replace(/\*/g,".*?"),"-"===a[0]?e.skips.push(new RegExp("^"+a.substr(1)+"$")):e.names.push(new RegExp("^"+a+"$")))};e.enabled=function(a){var b;var c=0;for(b=e.skips.length;c<b;c++)if(e.skips[c].test(a))return!1;
c=0;for(b=e.names.length;c<b;c++)if(e.names[c].test(a))return!0;return!1};e.humanize=c(244);e.names=[];e.skips=[];e.formatters={};var r},function(n,e){function c(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 b=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case "years":case "year":case "yrs":case "yr":case "y":return b*r;case "days":case "day":case "d":return b*h;case "hours":case "hour":case "hrs":case "hr":case "h":return 36E5*
b;case "minutes":case "minute":case "mins":case "min":case "m":return 6E4*b;case "seconds":case "second":case "secs":case "sec":case "s":return 1E3*b;case "milliseconds":case "millisecond":case "msecs":case "msec":case "ms":return b}}}function p(a,b,c){if(!(a<b))return a<1.5*b?Math.floor(a/b)+" "+c:Math.ceil(a/b)+" "+c+"s"}var h=864E5,r=365.25*h;n.exports=function(a,b){b=b||{};var e=typeof a;if("string"===e&&0<a.length)return c(a);if("number"===e&&!1===isNaN(a))return b.long?p(a,h,"day")||p(a,36E5,
"hour")||p(a,6E4,"minute")||p(a,1E3,"second")||a+" ms":a>=h?Math.round(a/h)+"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(n,e,c){(function(c){var e=c.WebSocket||c.MozWebSocket;n.exports=e?function(c){return new e(c)}:void 0}).call(e,c(5))},function(n,e,c){(function(e){function h(c){if(!w.enabled&&!l.enabled)throw Error("Transport created when disabled");
a.call(this,c,"/xhr_streaming",b,l)}var p=c(4),a=c(41),b=c(59),l=c(60),w=c(50),v=c(51);p(h,a);h.enabled=function(a){return a.nullOrigin||v.isOpera()?!1:l.enabled};h.transportName="xhr-streaming";h.roundTrips=2;h.needBody=!!e.document;n.exports=h}).call(e,c(5))},function(n,e,c){(function(e){function h(c,e){b(c);a.call(this);this.sendBuffer=[];this.sender=e;this.url=c}var p=c(4),a=c(10).EventEmitter,b=function(){};"production"!==e.env.NODE_ENV&&(b=c(7)("sockjs-client:buffered-sender"));p(h,a);h.prototype.send=
function(a){b("send",a);this.sendBuffer.push(a);this.sendStop||this.sendSchedule()};h.prototype.sendScheduleWait=function(){b("sendScheduleWait");var a=this;this.sendStop=function(){b("sendStop");a.sendStop=null;clearTimeout(c)};var c=setTimeout(function(){b("timeout");a.sendStop=null;a.sendSchedule()},25)};h.prototype.sendSchedule=function(){b("sendSchedule",this.sendBuffer.length);var a=this;if(0<this.sendBuffer.length){var c="["+this.sendBuffer.join(",")+"]";this.sendStop=this.sender(this.url,
c,function(c){a.sendStop=null;c?(b("error",c),a.emit("close",c.code||1006,"Sending error: "+c),a.close()):a.sendScheduleWait()});this.sendBuffer=[]}};h.prototype._cleanup=function(){b("_cleanup");this.removeAllListeners()};h.prototype.close=function(){b("close");this._cleanup();this.sendStop&&(this.sendStop(),this.sendStop=null)};n.exports=h}).call(e,c(6))},function(n,e,c){(function(e){function h(c,e,h){b(e);a.call(this);this.Receiver=c;this.receiveUrl=e;this.AjaxObject=h;this._scheduleReceiver()}
var p=c(4),a=c(10).EventEmitter,b=function(){};"production"!==e.env.NODE_ENV&&(b=c(7)("sockjs-client:polling"));p(h,a);h.prototype._scheduleReceiver=function(){b("_scheduleReceiver");var a=this,c=this.poll=new this.Receiver(this.receiveUrl,this.AjaxObject);c.on("message",function(c){b("message",c);a.emit("message",c)});c.once("close",function(e,h){b("close",e,h,a.pollIsClosing);a.poll=c=null;a.pollIsClosing||("network"===h?a._scheduleReceiver():(a.emit("close",e||1006,h),a.removeAllListeners()))})};
h.prototype.abort=function(){b("abort");this.removeAllListeners();this.pollIsClosing=!0;this.poll&&this.poll.abort()};n.exports=h}).call(e,c(6))},function(n,e,c){(function(e){function h(c){l(c);a.call(this);var e=this,h=this.es=new b(c);h.onmessage=function(a){l("message",a.data);e.emit("message",decodeURI(a.data))};h.onerror=function(a){l("error",h.readyState,a);a=2!==h.readyState?"network":"permanent";e._cleanup();e._close(a)}}var p=c(4),a=c(10).EventEmitter,b=c(130),l=function(){};"production"!==
e.env.NODE_ENV&&(l=c(7)("sockjs-client:receiver:eventsource"));p(h,a);h.prototype.abort=function(){l("abort");this._cleanup();this._close("user")};h.prototype._cleanup=function(){l("cleanup");var a=this.es;a&&(a.onmessage=a.onerror=null,a.close(),this.es=null)};h.prototype._close=function(a){l("close",a);var b=this;setTimeout(function(){b.emit("close",null,a);b.removeAllListeners()},200)};n.exports=h}).call(e,c(6))},function(n,e){n.exports=function(c){c.webpackPolyfill||(c.deprecate=function(){},
c.paths=[],c.children||(c.children=[]),Object.defineProperty(c,"loaded",{enumerable:!0,get:function(){return c.l}}),Object.defineProperty(c,"id",{enumerable:!0,get:function(){return c.i}}),c.webpackPolyfill=1);return c}},function(n,e){n.exports={}},function(n,e,c){(function(e,h){function p(a){t(a);w.call(this);var c=this;b.polluteGlobalNamespace();this.id="a"+v.string(6);a=l.addQuery(a,"c="+decodeURIComponent(b.WPrefix+"."+this.id));t("using htmlfile",p.htmlfileEnabled);var e=p.htmlfileEnabled?b.createHtmlfile:
b.createIframe;h[b.WPrefix][this.id]={start:function(){t("start");c.iframeObj.loaded()},message:function(a){t("message",a);c.emit("message",a)},stop:function(){t("stop");c._cleanup();c._close("network")}};this.iframeObj=e(a,function(){t("callback");c._cleanup();c._close("permanent")})}var a=c(4),b=c(52),l=c(18),w=c(10).EventEmitter,v=c(40),t=function(){};"production"!==e.env.NODE_ENV&&(t=c(7)("sockjs-client:receiver:htmlfile"));a(p,w);p.prototype.abort=function(){t("abort");this._cleanup();this._close("user")};
p.prototype._cleanup=function(){t("_cleanup");this.iframeObj&&(this.iframeObj.cleanup(),this.iframeObj=null);delete h[b.WPrefix][this.id]};p.prototype._close=function(a){t("_close",a);this.emit("close",null,a);this.removeAllListeners()};p.htmlfileEnabled=!1;e=["Active"].concat("Object").join("X");if(e in h)try{p.htmlfileEnabled=!!new h[e]("htmlfile")}catch(q){}p.enabled=p.htmlfileEnabled||b.iframeEnabled;n.exports=p}).call(e,c(6),c(5))},function(n,e,c){function p(c){if(!b.enabled)throw Error("Transport created when disabled");
h.call(this,c,"/xhr",a,b)}e=c(4);var h=c(41),r=c(128),a=c(59),b=c(78);e(p,h);p.enabled=r.enabled;p.transportName="xdr-polling";p.roundTrips=2;n.exports=p},function(n,e,c){(function(e){function h(c){if(!h.enabled())throw Error("Transport created when disabled");a.call(this,c,"/jsonp",l,b)}var p=c(4),a=c(126),b=c(255),l=c(256);p(h,a);h.enabled=function(){return!!e.document};h.transportName="jsonp-polling";h.roundTrips=1;h.needBody=!0;n.exports=h}).call(e,c(5))},function(n,e,c){(function(e,h){function p(c){q(c);
var e=this;t.call(this);a.polluteGlobalNamespace();this.id="a"+b.string(6);c=w.addQuery(c,"c="+encodeURIComponent(a.WPrefix+"."+this.id));h[a.WPrefix][this.id]=this._callback.bind(this);this._createScript(c);this.timeoutId=setTimeout(function(){q("timeout");e._abort(Error("JSONP script loaded abnormally (timeout)"))},p.timeout)}var a=c(52),b=c(40),l=c(51),w=c(18),v=c(4),t=c(10).EventEmitter,q=function(){};"production"!==e.env.NODE_ENV&&(q=c(7)("sockjs-client:receiver:jsonp"));v(p,t);p.prototype.abort=
function(){q("abort");if(h[a.WPrefix][this.id]){var b=Error("JSONP user aborted read");b.code=1E3;this._abort(b)}};p.timeout=35E3;p.scriptErrorTimeout=1E3;p.prototype._callback=function(a){q("_callback",a);this._cleanup();this.aborting||(a&&(q("message",a),this.emit("message",a)),this.emit("close",null,"network"),this.removeAllListeners())};p.prototype._abort=function(a){q("_abort",a);this._cleanup();this.aborting=!0;this.emit("close",a.code,a.message);this.removeAllListeners()};p.prototype._cleanup=
function(){q("_cleanup");clearTimeout(this.timeoutId);this.script2&&(this.script2.parentNode.removeChild(this.script2),this.script2=null);if(this.script){var b=this.script;b.parentNode.removeChild(b);this.script=b.onreadystatechange=b.onerror=b.onload=b.onclick=null}delete h[a.WPrefix][this.id]};p.prototype._scriptError=function(){q("_scriptError");var a=this;this.errorTimer||(this.errorTimer=setTimeout(function(){a.loadedOkay||a._abort(Error("JSONP script loaded abnormally (onerror)"))},p.scriptErrorTimeout))};
p.prototype._createScript=function(a){q("_createScript",a);var c=this,d=this.script=h.document.createElement("script");d.id="a"+b.string(8);d.src=a;d.type="text/javascript";d.charset="UTF-8";d.onerror=this._scriptError.bind(this);d.onload=function(){q("onload");c._abort(Error("JSONP script loaded abnormally (onload)"))};d.onreadystatechange=function(){q("onreadystatechange",d.readyState);if(/loaded|closed/.test(d.readyState)){if(d&&d.htmlFor&&d.onclick){c.loadedOkay=!0;try{d.onclick()}catch(k){}}d&&
c._abort(Error("JSONP script loaded abnormally (onreadystatechange)"))}};if("undefined"===typeof d.async&&h.document.attachEvent)if(l.isOpera()){var e=this.script2=h.document.createElement("script");e.text="try{var a = document.getElementById('"+d.id+"'); if(a)a.onerror();}catch(x){};";d.async=e.async=!1}else{try{d.htmlFor=d.id,d.event="onclick"}catch(k){}d.async=!0}"undefined"!==typeof d.async&&(d.async=!0);a=h.document.getElementsByTagName("head")[0];a.insertBefore(d,a.firstChild);e&&a.insertBefore(e,
a.firstChild)};n.exports=p}).call(e,c(6),c(5))},function(n,e,c){(function(e,h){function p(a){l("createIframe",a);try{return h.document.createElement('<iframe name="'+a+'">')}catch(m){var b=h.document.createElement("iframe");b.name=a;return b}}var a=c(40),b=c(18),l=function(){};"production"!==e.env.NODE_ENV&&(l=c(7)("sockjs-client:sender:jsonp"));var w,v;n.exports=function(c,e,m){l(c,e);w||(l("createForm"),w=h.document.createElement("form"),w.style.display="none",w.style.position="absolute",w.method=
"POST",w.enctype="application/x-www-form-urlencoded",w.acceptCharset="UTF-8",v=h.document.createElement("textarea"),v.name="d",w.appendChild(v),h.document.body.appendChild(w));var g="a"+a.string(8);w.target=g;w.action=b.addQuery(b.addPath(c,"/jsonp_send"),"i="+g);var d=p(g);d.id=g;d.style.display="none";w.appendChild(d);try{v.value=e}catch(k){}w.submit();var f=function(a){l("completed",g,a);d.onerror&&(d.onreadystatechange=d.onerror=d.onload=null,setTimeout(function(){l("cleaning up",g);d.parentNode.removeChild(d);
d=null},500),v.value="",m(a))};d.onerror=function(){l("onerror",g);f()};d.onload=function(){l("onload",g);f()};d.onreadystatechange=function(a){l("onreadystatechange",g,d.readyState,a);"complete"===d.readyState&&f()};return function(){l("aborted",g);f(Error("Aborted"))}}}).call(e,c(6),c(5))},function(n,e,c){(function(e,h){function p(b,c,e){if(!(this instanceof p))return new p(b,c,e);if(1>arguments.length)throw new TypeError("Failed to construct 'SockJS: 1 argument required, but only 0 present");x.call(this);
this.readyState=p.CONNECTING;this.protocol=this.extensions="";e=e||{};e.protocols_whitelist&&f.warn("'protocols_whitelist' is DEPRECATED. Use 'transports' instead.");this._transportsWhitelist=e.transports;this._transportOptions=e.transportOptions||{};var g=e.sessionId||8;if("function"===typeof g)this._generateSessionId=g;else if("number"===typeof g)this._generateSessionId=function(){return w.string(g)};else throw new TypeError("If sessionId is used in the options, it needs to be a number or a function.");
this._server=e.server||w.numberString(1E3);var h=new a(b);if(h.host&&h.protocol){if(h.hash)throw new SyntaxError("The URL must not contain a fragment");if("http:"!==h.protocol&&"https:"!==h.protocol)throw new SyntaxError("The URL's scheme must be either 'http:' or 'https:'. '"+h.protocol+"' is not allowed.");}else throw new SyntaxError("The URL '"+b+"' is invalid");var k="https:"===h.protocol;if("https"===B.protocol&&!k)throw Error("SecurityError: An insecure SockJS connection may not be initiated from a page loaded over HTTPS");
c?Array.isArray(c)||(c=[c]):c=[];var l=c.sort();l.forEach(function(a,b){if(!a)throw new SyntaxError("The protocols entry '"+a+"' is invalid.");if(b<l.length-1&&a===l[b+1])throw new SyntaxError("The protocols entry '"+a+"' is duplicated.");});this._origin=(k=t.getOrigin(B.href))?k.toLowerCase():null;h.set("pathname",h.pathname.replace(/\/+$/,""));this.url=h.href;G("using url",this.url);this._urlInfo={nullOrigin:!d.hasDomain(),sameOrigin:t.isOriginEqual(this.url,B.href),sameScheme:t.isSchemeEqual(this.url,
B.href)};this._ir=new y(this.url,this._urlInfo);this._ir.once("finish",this._receiveInfo.bind(this))}c(258);var a=c(124),b=c(4),l=c(28),w=c(40),v=c(259),t=c(18),q=c(34),m=c(260),g=c(80),d=c(51),f=c(261),k=c(81),x=c(125),B=c(135),E=c(262),C=c(263),y=c(264),G=function(){};"production"!==e.env.NODE_ENV&&(G=c(7)("sockjs-client:main"));var A;b(p,x);p.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!==p.CLOSING&&this.readyState!==p.CLOSED&&this._close(a||1E3,b||"Normal closure",!0)};p.prototype.send=function(a){"string"!==typeof a&&(a=""+a);if(this.readyState===p.CONNECTING)throw Error("InvalidStateError: The connection has not been established yet");this.readyState===p.OPEN&&this._transport.send(v.quote(a))};p.version=c(132);p.CONNECTING=0;p.OPEN=1;p.CLOSING=2;p.CLOSED=3;p.prototype._receiveInfo=function(a,b){G("_receiveInfo",b);this._ir=null;a?(this._rto=this.countRTO(b),this._transUrl=
a.base_url?a.base_url:this.url,a=g.extend(a,this._urlInfo),G("info",a),this._transports=A.filterToEnabled(this._transportsWhitelist,a).main,G(this._transports.length+" enabled transports"),this._connect()):this._close(1002,"Cannot connect to server")};p.prototype._connect=function(){for(var a=this._transports.shift();a;){G("attempt",a.transportName);if(a.needBody&&(!h.document.body||"undefined"!==typeof h.document.readyState&&"complete"!==h.document.readyState&&"interactive"!==h.document.readyState)){G("waiting for body");
this._transports.unshift(a);q.attachEvent("load",this._connect.bind(this));return}var b=this._rto*a.roundTrips||5E3;this._transportTimeoutId=setTimeout(this._transportTimeout.bind(this),b);G("using timeout",b);b=t.addPath(this._transUrl,"/"+this._server+"/"+this._generateSessionId());var c=this._transportOptions[a.transportName];G("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)};p.prototype._transportTimeout=function(){G("_transportTimeout");this.readyState===p.CONNECTING&&this._transportClose(2007,"Transport timed out")};p.prototype._transportMessage=function(a){G("_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 k("heartbeat"));G("heartbeat",this.transport);return}if(a)try{var d=l.parse(a)}catch(P){G("bad json",a)}if("undefined"===
typeof d)G("empty payload",a);else switch(c){case "a":Array.isArray(d)&&d.forEach(function(a){G("message",b.transport,a);b.dispatchEvent(new C(a))});break;case "m":G("message",this.transport,d);this.dispatchEvent(new C(d));break;case "c":Array.isArray(d)&&2===d.length&&this._close(d[0],d[1],!0)}};p.prototype._transportClose=function(a,b){G("_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!==p.CONNECTING?this._close(a,b):this._connect()};p.prototype._open=function(){G("_open",this._transport.transportName,this.readyState);this.readyState===p.CONNECTING?(this._transportTimeoutId&&(clearTimeout(this._transportTimeoutId),this._transportTimeoutId=null),this.readyState=p.OPEN,this.transport=this._transport.transportName,this.dispatchEvent(new k("open")),G("connected",this.transport)):this._close(1006,"Server lost session")};p.prototype._close=function(a,b,c){G("_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===p.CLOSED)throw Error("InvalidStateError: SockJS has already been closed");this.readyState=p.CLOSING;setTimeout(function(){this.readyState=p.CLOSED;d&&this.dispatchEvent(new k("error"));var e=new E("close");e.wasClean=c||!1;e.code=a||1E3;e.reason=b;this.dispatchEvent(e);this.onmessage=this.onclose=this.onerror=
null;G("disconnected")}.bind(this),0)};p.prototype.countRTO=function(a){return 100<a?4*a:300+a};n.exports=function(a){A=m(a);c(267)(p,a);return p}}).call(e,c(6),c(5))},function(n,e,c){function p(){}var h=Array.prototype,r=Object.prototype;e=Function.prototype;var a=String.prototype,b=h.slice,l=r.toString;if(n=Object.defineProperty)try{Object.defineProperty({},"x",{}),n=!0}catch(g){n=!1}var w=n?function(a,b,c,e){!e&&b in a||Object.defineProperty(a,b,{configurable:!0,enumerable:!1,writable:!0,value:c})}:
function(a,b,c,e){!e&&b in a||(a[b]=c)};n=function(a,b,c){for(var d in b)r.hasOwnProperty.call(b,d)&&w(a,d,b[d],c)};var v=function(a){if(null==a)throw new TypeError("can't convert "+a+" to object");return Object(a)};n(e,{bind:function(a){var c=this;if("[object Function]"!==r.toString.call(c))throw new TypeError("Function.prototype.bind called on incompatible "+c);for(var e=b.call(arguments,1),g=Math.max(0,c.length-e.length),h=[],l=0;l<g;l++)h.push("$"+l);var m=Function("binder","return function ("+
h.join(",")+"){ return binder.apply(this, arguments); }")(function(){if(this instanceof m){var d=c.apply(this,e.concat(b.call(arguments)));return Object(d)===d?d:this}return c.apply(a,e.concat(b.call(arguments)))});c.prototype&&(p.prototype=c.prototype,m.prototype=new p,p.prototype=null);return m}});n(Array,{isArray:function(a){return"[object Array]"===l.call(a)}});e=Object("a");var t="a"!==e[0]||!(0 in e);n(h,{forEach:function(a,b){var c=v(this),d=t&&"[object String]"===l.call(this)?this.split(""):
c,e=-1,g=d.length>>>0;if("[object Function]"!==r.toString.call(a))throw new TypeError;for(;++e<g;)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}(h.forEach));e=Array.prototype.indexOf&&-1!==[0,1].indexOf(1,2);n(h,{indexOf:function(a){var b=t&&"[object String]"===l.call(this)?this.split(""):v(this),c=b.length>>>0;if(!c)return-1;var e=0;1<arguments.length&&(e=
+arguments[1],e!==e?e=0:0!==e&&e!==1/0&&e!==-(1/0)&&(e=(0<e||-1)*Math.floor(Math.abs(e))));for(e=0<=e?e:Math.max(0,c+e);e<c;e++)if(e in b&&b[e]===a)return e;return-1}},e);var q=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 b=void 0===/()??/.exec("")[1];a.split=function(a,c){var d=this;if(void 0===a&&0===c)return[];if("[object RegExp]"!==
l.call(a))return q.call(this,a,c);var e=[],f=(a.ignoreCase?"i":"")+(a.multiline?"m":"")+(a.extended?"x":"")+(a.sticky?"y":""),g=0,m,n;a=new RegExp(a.source,f+"g");d+="";b||(m=new RegExp("^"+a.source+"$(?!\\s)",f));for(c=void 0===c?4294967295:c>>>0;n=a.exec(d);){f=n.index+n[0].length;if(f>g){e.push(d.slice(g,n.index));!b&&1<n.length&&n[0].replace(m,function(){for(var a=1;a<arguments.length-2;a++)void 0===arguments[a]&&(n[a]=void 0)});1<n.length&&n.index<d.length&&h.push.apply(e,n.slice(1));var p=n[0].length;
g=f;if(e.length>=c)break}a.lastIndex===n.index&&a.lastIndex++}g===d.length?!p&&a.test("")||e.push(""):e.push(d.slice(g));return e.length>c?e.slice(0,c):e}}():"0".split(void 0,0).length&&(a.split=function(a,b){return void 0===a&&0===b?[]:q.call(this,a,b)});var m=a.substr;e="".substr&&"b"!=="0b".substr(-1);n(a,{substr:function(a,b){return m.call(this,0>a?0>(a=this.length+a)?0:a:a,b)}},e)},function(n,e,c){var p=c(28),h=/[\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,
r,a=function(a){var b,c={},e=[];for(b=0;65536>b;b++)e.push(String.fromCharCode(b));a.lastIndex=0;e.join("").replace(a,function(a){c[a]="\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4);return""});a.lastIndex=0;return c};n.exports={quote:function(b){b=p.stringify(b);h.lastIndex=0;if(!h.test(b))return b;r||(r=a(h));return b.replace(h,function(a){return r[a]})}}},function(n,e,c){(function(e){var h=function(){};"production"!==e.env.NODE_ENV&&(h=c(7)("sockjs-client:utils:transport"));n.exports=function(c){return{filterToEnabled:function(a,
b){var e={main:[],facade:[]};a?"string"===typeof a&&(a=[a]):a=[];c.forEach(function(c){c&&("websocket"===c.transportName&&!1===b.websocket?h("disabled from server","websocket"):a.length&&-1===a.indexOf(c.transportName)?h("not in whitelist",c.transportName):c.enabled(b)?(h("enabled",c.transportName),e.main.push(c),c.facadeTransport&&e.facade.push(c.facadeTransport)):h("disabled",c.transportName))});return e}}}}).call(e,c(6))},function(n,e,c){(function(c){var e={};["log","debug","warn"].forEach(function(h){try{var a=
c.console&&c.console[h]&&c.console[h].apply}catch(b){}e[h]=a?function(){return c.console[h].apply(c.console,arguments)}:"log"===h?function(){}:e.log});n.exports=e}).call(e,c(5))},function(n,e,c){function p(){h.call(this);this.initEvent("close",!1,!1);this.wasClean=!1;this.code=0;this.reason=""}e=c(4);var h=c(81);e(p,h);n.exports=p},function(n,e,c){function p(c){h.call(this);this.initEvent("message",!1,!1);this.data=c}e=c(4);var h=c(81);e(p,h);n.exports=p},function(n,e,c){(function(e){function h(a,
b){g(a);var c=this;p.call(this);setTimeout(function(){c.doXhr(a,b)},0)}var p=c(10).EventEmitter,a=c(4),b=c(18),l=c(78),w=c(60),v=c(50),t=c(265),q=c(266),m=c(137),g=function(){};"production"!==e.env.NODE_ENV&&(g=c(7)("sockjs-client:info-receiver"));a(h,p);h._getReceiver=function(a,b,c){return c.sameOrigin?new m(b,v):w.enabled?new m(b,w):l.enabled&&c.sameScheme?new m(b,l):q.enabled()?new q(a,b):new m(b,t)};h.prototype.doXhr=function(a,c){var d=this,e=b.addPath(a,"/info");g("doXhr",e);this.xo=h._getReceiver(a,
e,c);this.timeoutRef=setTimeout(function(){g("timeout");d._cleanup(!1);d.emit("finish")},h.timeout);this.xo.once("finish",function(a,b){g("finish",a,b);d._cleanup(!0);d.emit("finish",a,b)})};h.prototype._cleanup=function(a){g("_cleanup");clearTimeout(this.timeoutRef);this.timeoutRef=null;!a&&this.xo&&this.xo.close();this.xo=null};h.prototype.close=function(){g("close");this.removeAllListeners();this._cleanup(!1)};h.timeout=8E3;n.exports=h}).call(e,c(6))},function(n,e,c){function p(){var c=this;h.call(this);
this.to=setTimeout(function(){c.emit("finish",200,"{}")},p.timeout)}var h=c(10).EventEmitter;c(4)(p,h);p.prototype.close=function(){clearTimeout(this.to)};p.timeout=2E3;n.exports=p},function(n,e,c){(function(e,h){function p(b,c){var d=this;a.call(this);var e=function(){var a=d.ifr=new v(t.transportName,c,b);a.once("message",function(a){if(a){try{var b=l.parse(a)}catch(E){q("bad json",a);d.emit("finish");d.close();return}d.emit("finish",b[0],b[1])}d.close()});a.once("close",function(){d.emit("finish");
d.close()})};h.document.body?e():w.attachEvent("load",e)}var a=c(10).EventEmitter,b=c(4),l=c(28),w=c(34),v=c(131),t=c(136),q=function(){};"production"!==e.env.NODE_ENV&&(q=c(7)("sockjs-client:info-iframe"));b(p,a);p.enabled=function(){return v.enabled()};p.prototype.close=function(){this.ifr&&this.ifr.close();this.removeAllListeners();this.ifr=null};n.exports=p}).call(e,c(6),c(5))},function(n,e,c){(function(e){var h=c(18),p=c(34),a=c(28),b=c(268),l=c(136),w=c(52),v=c(135),t=function(){};"production"!==
e.env.NODE_ENV&&(t=c(7)("sockjs-client:iframe-bootstrap"));n.exports=function(c,e){var g={};e.forEach(function(a){a.facadeTransport&&(g[a.facadeTransport.transportName]=a.facadeTransport)});g[l.transportName]=l;var d;c.bootstrap_iframe=function(){var e;w.currentWindowId=v.hash.slice(1);p.attachEvent("message",function(f){if(f.source===parent&&("undefined"===typeof d&&(d=f.origin),f.origin===d)){try{var k=a.parse(f.data)}catch(C){t("bad json",f.data);return}if(k.windowId===w.currentWindowId)switch(k.type){case "s":try{var l=
a.parse(k.data)}catch(C){t("bad json",k.data);break}f=l[0];k=l[1];var m=l[2];l=l[3];t(f,k,m,l);if(f!==c.version)throw Error('Incompatible SockJS! Main site uses: "'+f+'", the iframe: "'+c.version+'".');if(!h.isOriginEqual(m,v.href)||!h.isOriginEqual(l,v.href))throw Error("Can't connect to different domain from within an iframe. ("+v.href+", "+m+", "+l+")");e=new b(new g[k](m,l));break;case "m":e._send(k.data);break;case "c":e&&e._close(),e=null}}});w.postMessage("s")}}}).call(e,c(6))},function(n,
e,c){function p(a){this._transport=a;a.on("message",this._transportMessage.bind(this));a.on("close",this._transportClose.bind(this))}var h=c(28),r=c(52);p.prototype._transportClose=function(a,b){r.postMessage("c",h.stringify([a,b]))};p.prototype._transportMessage=function(a){r.postMessage("t",a)};p.prototype._send=function(a){this._transport.send(a)};p.prototype._close=function(){this._transport.close();this._transport.removeAllListeners()};n.exports=p},function(n,e,c){e.a=function(a){a.registerEventListener(document,
"copy",function(b){if(!Object(p.a)(b)){var c=Object(r.c)(a.state).value;b.clipboardData.setData("text/plain",JSON.stringify(c,void 0,"  "));b.preventDefault()}})};e.b=function(a){a.registerEventListener(document,"paste",function(b){if(!Object(p.a)(b)){var c=b.clipboardData.getData("text/plain").match(/^[\[\]{}()\s,]*(\d+(?:\.\d+)?)[,\s]+(\d+(?:\.\d+)?)[,\s]+(\d+(?:\.\d+)?)[\[\]{}()\s,]*$/);c=null!==c?h.p.fromValues(parseFloat(c[1]),parseFloat(c[2]),parseFloat(c[3])):void 0;void 0!==c&&a.navigationState.position.setVoxelCoordinates(c);
b.preventDefault()}})};var p=c(138),h=c(1),r=c(27)},function(n,e,c){function p(){if(void 0===l){var a=new b.a;a.set("keyl","recolor");a.set("keyx","clear-segments");a.set("keys","toggle-show-slices");a.set("keyb","toggle-scale-bar");a.set("keya","toggle-axis-lines");for(var c=1;9>=c;++c)a.set("digit"+c,"toggle-layer-"+c);a.set("keyn","add-layer");a.set("keyh","help");a.set("space","toggle-layout");a.set("shift+space","toggle-layout-alternative");l=a}return l}function h(){void 0===w&&(w=b.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"},{label:"All Data Panels"}));return w}function r(){void 0===v&&(v=b.a.fromObject({"at:mousedown0":{action:"rotate-via-mouse-drag",stopPropagation:!0},"at:shift+mousedown0":{action:"translate-via-mouse-drag",stopPropagation:!0}},{parents:[[h(),Number.NEGATIVE_INFINITY]]}));return v}function a(){void 0===t&&(t=b.a.fromObject({"at:mousedown0":{action:"translate-via-mouse-drag",stopPropagation:!0},
"at:shift+mousedown0":{action:"rotate-via-mouse-drag",stopPropagation:!0}},{parents:[[h(),Number.NEGATIVE_INFINITY]]}));return t}e.a=function(b){b.global.addParent(p(),Number.NEGATIVE_INFINITY);b.sliceView.addParent(a(),Number.NEGATIVE_INFINITY);b.perspectiveView.addParent(r(),Number.NEGATIVE_INFINITY)};var b=c(17),l,w,v,t},function(n,e,c){e.a=function(b){Object(a.a)();Object(a.b)();try{var c=new h.a(document.getElementById("neuroglancer-container"));return new r.a(c,b)}catch(w){throw p.a.showMessage("Error: "+
w.message),w;}};c(273);var p=c(33),h=c(100),r=c(278),a=c(307);c(272)},function(n,e){},function(n,e,c){c(274);c(275)},function(n,e,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function h(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 r(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}n=c(139);var a=c(13);e=c(21);var b=c(0),l=c(1),w=c(19),v=c(76),t=c(12),q=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)}},
m=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(a){function b(a,c,d,e){p(this,b);var f=h(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));f.chunkDataSize=c;f.channelStride=c[0]*c[1]*c[2];Object(v.e)(f,a,d,c[0],c[1],c[2]*e);return f}r(b,a);m(b,null,[{key:"get",value:function(a,c,d,e){return a.memoize.get("sliceview.UncompressedTextureLayout:"+
Object(l.q)(c)+","+(d+","+e),function(){return new b(a,c,d,e)})}}]);return b}(b.a),d=function(a){function b(a,c,d,e){p(this,b);a=h(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,e));a.dataType=c;a.numChannels=d;Object(v.c)(a,c);a.textureAccessHelper=new v.a("chunkData");return a}r(b,a);m(b,[{key:"defineShader",value:function(a){q(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(t.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 g.get(a,b,this.texelsPerElement,this.numChannels)}},{key:"setTextureData",value:function(a,b,c){Object(v.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}(n.a),f=function(b){function c(){p(this,c);return h(this,(c.__proto__||Object.getPrototypeOf(c)).apply(this,arguments))}r(c,b);m(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 w.a(b[c],b[c+1])}throw Error("Invalid data type: "+d);}}]);return c}(n.b),k=function(a){function b(a,c){p(this,b);var e=h(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));
e.chunkFormat=e.registerDisposer(d.get(a,c.dataType,c.numChannels));e.textureLayout=e.registerDisposer(e.chunkFormat.getTextureLayout(a,c.chunkDataSize));return e}r(b,a);m(b,[{key:"getChunk",value:function(a,b){return new f(a,b)}}]);return b}(b.a);Object(e.c)(function(a,b){return null==b.compressedSegmentationBlockSize?new k(a,b):null})},function(n,e,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function h(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 r(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var a=c(276),b=c(277);n=c(139);var l=c(13);e=c(21);var w=c(0),v=c(1),t=c(19),q=c(76),m=c(12),g=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)}},d=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),f=function(a){function b(a,c,d,e){p(this,b);var f=h(this,(b.__proto__||
Object.getPrototypeOf(b)).call(this));f.chunkDataSize=c;f.subchunkSize=d;Object(q.d)(f,a,1,e);a=f.subchunkGridSize=v.p.create();for(e=0;3>e;++e)a[e]=Math.ceil(c[e]/d[e]);return f}r(b,a);d(b,null,[{key:"get",value:function(a,c,d,e){return a.memoize.get("sliceview.CompressedSegmentationTextureLayout:"+Object(v.q)(c)+","+(Object(v.q)(d)+","+e),function(){return new b(a,c,d,e)})}}]);return b}(w.a),k=Object(q.c)(new q.b,l.a.UINT32),x=function(a){function b(a,c,d,e){p(this,b);e=h(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,
e));e.dataType=a;e.subchunkSize=c;e.numChannels=d;e.textureAccessHelper=new q.a("chunkData");return e}r(b,a);d(b,[{key:"defineShader",value:function(a){g(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"defineShader",this).call(this,a);var c=this.textureAccessHelper;c.defineShader(a);var d=function(a){return"compressedSegmentationChunkFormat_"+a};a.addUniform("highp vec3","uSubchunkGridSize");a.addUniform("highp vec3","uSubchunkSize");a.addFragmentCode(m.f);var e=this.dataType,f=Object(m.a)(e);
e===l.a.UINT64&&a.addFragmentCode(m.l);a.addFragmentCode(c.getAccessor(d("readTextureValue"),"uVolumeChunkSampler",l.a.UINT32));a.addFragmentCode(m.o);a.addFragmentCode(m.n);c="\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"+f+" 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===l.a.UINT64?"2.0":"1.0")+";\n  }\n  "+f+" result;\n";c=e===l.a.UINT64?c+("\n  result.low = "+d("readTextureValue")+"(outputValueOffset).value;\n  result.high = "+d("readTextureValue")+"(outputValueOffset+1.0).value;\n"):c+("\n  result.value = "+d("readTextureValue")+"(outputValueOffset).value;\n");a.addFragmentCode(c+"\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(q.f)(a,b,k,c)}},{key:"getTextureLayout",value:function(a,b,c){return f.get(a,b,this.subchunkSize,c)}},{key:"beginSource",value:function(a,c){g(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"beginSource",this).call(this,a,c);a.uniform3fv(c.uniform("uSubchunkSize"),this.subchunkSize)}}],[{key:"get",value:function(a,c,d,e){var f="sliceview.CompressedSegmentationChunkFormat:"+c+":"+e,g=f+":"+Object(v.q)(d);return a.memoize.get(g,function(){return new b(c,
d,e,f)})}}]);return b}(n.a),B=function(c){function e(){p(this,e);return h(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}r(e,c);d(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(c,d){var e=this.chunkDataSize,f=this.chunkFormat,g=this.data;d=g[d];if(f.dataType===l.a.UINT64){var h=new t.a;Object(b.a)(h,g,d,e,f.subchunkSize,
c);return h}return Object(a.a)(g,d,e,f.subchunkSize,c)}}]);return e}(n.b),E=function(a){function b(a,c){p(this,b);var d=h(this,(b.__proto__||Object.getPrototypeOf(b)).call(this)),e=c.dataType;if(e!==l.a.UINT64&&e!==l.a.UINT32)throw Error("Unsupported compressed segmentation data type: "+l.a[e]);d.chunkFormat=d.registerDisposer(x.get(a,c.dataType,c.compressedSegmentationBlockSize,c.numChannels));return d}r(b,a);d(b,[{key:"getChunk",value:function(a,b){return new B(a,b)}}]);return b}(w.a);Object(e.c)(function(a,
b){return null!=b.compressedSegmentationBlockSize?new E(a,b):null})},function(n,e,c){e.a=function(c,e,a,b,l){e=Object(p.a)(c,e,a,b,l,1)+e;return c[e]};var p=c(140)},function(n,e,c){e.a=function(c,e,a,b,l,n){a=Object(p.a)(e,a,b,l,n,2)+a;c.low=e[a];c.high=e[a+1];return c};var p=c(140)},function(n,e,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function h(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 r(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=new E.a,c=b.element;c.classList.add("neuroglancer-viewer-context-menu");var d=function(a,d){a=b.registerDisposer(new P.a(d,
{label:a}));a.element.classList.add("neuroglancer-viewer-context-menu-limit-widget");c.appendChild(a.element)};d("GPU memory limit",a.chunkQueueManager.capacities.gpuMemory.sizeLimit);d("System memory limit",a.chunkQueueManager.capacities.systemMemory.sizeLimit);d("Concurrent chunk requests",a.chunkQueueManager.capacities.download.itemLimit);d=function(a,d){var e=document.createElement("label");e.textContent=a;a=b.registerDisposer(new x.c(d));e.appendChild(a.element);c.appendChild(e)};d("Show axis lines",
a.showAxisLines);d("Show scale bar",a.showScaleBar);d("Show cross sections in 3-d",a.showPerspectiveSliceViews);return b}c.d(e,"a",function(){return X});n=c(9);var b=c.n(n),l=c(15),w=c(279);n=c(141);var v=c(26),t=c(284),q=c(20),m=c(142),g=c(293),d=c(14),f=c(61),k=c(39),x=c(49),B=c(8),E=c(82),C=c(146),y=c(56);e=c(0);var G=c(11),A=c(17),H=c(45),D=c(3),I=c(27),F=c(44),P=c(305),K=c(85),T=c(145),V=c(16),S=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(306);c(31);c(62);var L=function(a){function b(a){p(this,b);var c=h(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.gl=a;c.worker=new Worker("chunk_worker.bundle.js");c.chunkQueueManager=c.registerDisposer(new l.d(new V.a(c.worker),c.gl,{gpuMemory:new l.a({defaultItemLimit:1E6,defaultSizeLimit:1E9}),systemMemory:new l.a({defaultItemLimit:1E7,defaultSizeLimit:2E9}),
download:new l.a({defaultItemLimit:32,defaultSizeLimit:Number.POSITIVE_INFINITY})}));c.chunkManager=c.registerDisposer(new l.c(c.chunkQueueManager));c.chunkQueueManager.registerDisposer(function(){return c.worker.terminate()});return c}r(b,a);S(b,[{key:"rpc",get:function(){return this.chunkQueueManager.rpc}}]);return b}(e.a);(function(a){function b(){p(this,b);var a=h(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));a.global=new H.a;return a}r(b,a);return b})(n.b);var Q={showUIControls:!0,
showHelpButton:!0,showLayerDialog:!0,showLayerPanel:!0,showLocation:!0,showPanelBorders:!0,resetStateWhenEmpty:!0},X=function(c){function e(a,c){c=void 0===c?{}:c;p(this,e);var g=h(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));g.display=a;g.navigationState=g.registerDisposer(new f.e);g.perspectiveNavigationState=new f.e(new f.g(g.navigationState.position),1);g.mouseState=new q.d;g.layerManager=g.registerDisposer(new q.a);g.showAxisLines=new x.b(!0,!0);g.showScaleBar=new x.b(!0,!0);g.showPerspectiveSliceViews=
new x.b(!0,!0);g.layerSelectedValues=g.registerDisposer(new q.b(g.layerManager,g.mouseState));g.resetInitiated=new D.a;g.state=new I.a;g.visible=!0;var l=c,n=void 0===l.dataContext?new L(a.gl):l.dataContext,r=void 0===l.visibility?new F.b(F.b.VISIBLE):l.visibility,t=void 0===l.inputEventBindings?{global:new H.a,sliceView:new H.a,perspectiveView:new H.a}:l.inputEventBindings,A=void 0===l.element?a.makeCanvasOverlayElement():l.element;l=void 0===l.dataSourceProvider?Object(v.a)({credentialsManager:w.a}):
l.dataSourceProvider;g.visibility=r;g.inputEventBindings=t;g.element=A;g.dataSourceProvider=l;g.registerDisposer(function(){return Object(G.b)(g.element)});g.dataContext=g.registerDisposer(n);c=Object.assign({},Q,c);n=c.showHelpButton;r=c.showLayerPanel;t=c.showLocation;l=c.showPanelBorders;var y=c.resetStateWhenEmpty,P=c.showLayerDialog;g.showUIControls=new x.b(c.showUIControls);g.showHelpButton=new x.b(n);g.showLayerPanel=new x.b(r);g.showLocation=new x.b(t);g.showPanelBorders=new x.b(l);g.showHelpButtonEffective=
Object(B.c)(function(a,b){return a&&b},g.showUIControls,g.showHelpButton);g.showLayerPanelEffective=Object(B.c)(function(a,b){return a&&b},g.showUIControls,g.showLayerPanel);g.showLocationEffective=Object(B.c)(function(a,b){return a&&b},g.showUIControls,g.showLocation);g.showHelpButtonEffective.changed.add(function(){return g.display.onResize()});g.showLocationEffective.changed.add(function(){return g.display.onResize()});g.showLayerPanelEffective.changed.add(function(){return g.display.onResize()});
g.showPanelBorders.changed.add(function(){return g.updateShowBorders()});g.showPanelBorders.changed.add(function(){return g.display.onResize()});g.showLayerDialog=P;g.resetStateWhenEmpty=y;g.layerSpecification=new d.c(g.dataSourceProvider,g.layerManager,g.chunkManager,g.layerSelectedValues,g.navigationState.voxelSize);g.registerDisposer(a.updateStarted.add(function(){g.onUpdateDisplay()}));g.registerDisposer(a.updateFinished.add(function(){g.onUpdateDisplayFinished()}));c=g.state;c.add("layers",g.layerSpecification);
c.add("navigation",g.navigationState);c.add("showAxisLines",g.showAxisLines);c.add("showScaleBar",g.showScaleBar);c.add("perspectiveOrientation",g.perspectiveNavigationState.pose.orientation);c.add("perspectiveZoom",g.perspectiveNavigationState.zoomFactor);c.add("showSlices",g.showPerspectiveSliceViews);c.add("gpuMemoryLimit",g.dataContext.chunkQueueManager.capacities.gpuMemory.sizeLimit);c.add("systemMemoryLimit",g.dataContext.chunkQueueManager.capacities.systemMemory.sizeLimit);c.add("concurrentDownloads",
g.dataContext.chunkQueueManager.capacities.download.itemLimit);g.registerDisposer(g.navigationState.changed.add(function(){g.handleNavigationStateChanged()}));g.layerManager.initializePosition(g.navigationState.position);g.registerDisposer(g.layerSpecification.voxelCoordinatesSet.add(function(a){g.navigationState.position.setVoxelCoordinates(a)}));n=g.registerCancellable(b()(function(){!g.wasDisposed&&0===g.layerManager.managedLayers.length&&g.resetStateWhenEmpty&&(g.navigationState.reset(),g.perspectiveNavigationState.pose.orientation.reset(),
g.perspectiveNavigationState.zoomFactor.reset(),g.resetInitiated.dispatch(),!k.b&&g.showLayerDialog&&g.visibility.visible&&new m.a(g.layerSpecification))}));g.layerManager.layersChanged.add(n);n();g.registerDisposer(g.dataContext.chunkQueueManager.visibleChunksChanged.add(function(){g.layerSelectedValues.handleLayerChange()}));g.registerDisposer(g.dataContext.chunkQueueManager.visibleChunksChanged.add(function(){g.visible&&a.scheduleRedraw()}));g.makeUI();g.updateShowBorders();c.add("layout",g.layout);
g.registerActionListeners();g.registerEventActionBindings();g.registerDisposer(Object(C.a)(A,g.navigationState.position));return g}r(e,c);S(e,[{key:"updateShowBorders",value:function(){var a=this.element;this.showPanelBorders.value?a.classList.add("neuroglancer-show-panel-borders"):a.classList.remove("neuroglancer-show-panel-borders")}},{key:"makeUI",value:function(){var b=this,c=this.element;c.classList.add("neuroglancer-viewer");c.classList.add("neuroglancer-noselect");c.style.display="flex";c.style.flexDirection=
"column";var d=document.createElement("div");d.title="Right click for settings";(this.contextMenu=this.registerDisposer(a(this))).registerParent(d);d.style.display="flex";d.style.flexDirection="row";d.style.alignItems="stretch";var e=this.registerDisposer(new K.c(document.createElement("div"),this.navigationState.voxelSize));this.registerDisposer(new x.a(this.showLocationEffective,e.element));d.appendChild(e.element);e=this.registerDisposer(new K.b(this.navigationState.position));this.registerDisposer(new x.a(this.showLocationEffective,
e.element));d.appendChild(e.element);e=this.registerDisposer(new K.a(document.createElement("div"),this.mouseState,this.navigationState.voxelSize));e.element.style.flex="1";e.element.style.alignSelf="center";this.registerDisposer(new x.a(this.showLocationEffective,e.element));d.appendChild(e.element);e=Object(T.a)("?","Help");this.registerEventListener(e,"click",function(){b.showHelpDialog()});this.registerDisposer(new x.a(this.showHelpButtonEffective,e));this.registerDisposer(new x.a(Object(B.c)(function(a,
b){return a&&b},this.showHelpButtonEffective,this.showLocationEffective),d));d.appendChild(e);c.appendChild(d);this.layout=this.registerDisposer(new g.a(this,"4panel"));c.appendChild(this.layout.element);this.display.onResize();d=function(){var a=b.visibility.visible;a!==b.visible&&(c.style.visibility=a?"inherit":"hidden",b.visible=a)};d();this.registerDisposer(this.visibility.changed.add(d))}},{key:"registerEventActionBindings",value:function(){var a=this.element;this.registerDisposer(new H.b(a,
this.inputEventMap));this.registerDisposer(new y.a(a))}},{key:"bindAction",value:function(a,b){this.registerDisposer(Object(A.c)(this.element,a,b))}},{key:"registerActionListeners",value:function(){for(var a=this,b={},c=$jscomp.makeIterator(["recolor","clear-segments"]),d=c.next();!d.done;b={action:b.action},d=c.next())b.action=d.value,this.bindAction(b.action,function(b){return function(){a.layerManager.invokeAction(b.action)}}(b));b={};c=$jscomp.makeIterator(["select","annotate"]);for(d=c.next();!d.done;b=
{action$251:b.action$251},d=c.next())b.action$251=d.value,this.bindAction(b.action$251,function(b){return function(){a.mouseState.updateUnconditionally();a.layerManager.invokeAction(b.action$251)}}(b));this.bindAction("help",function(){return a.showHelpDialog()});for(d={i:1};9>=d.i;d={i:d.i},++d.i)this.bindAction("toggle-layer-"+d.i,function(b){return function(){var c=b.i-1,d=a.layerManager.managedLayers;c<d.length&&(c=d[c],c.setVisible(!c.visible))}}(d));this.bindAction("toggle-axis-lines",function(){return a.showAxisLines.toggle()});
this.bindAction("toggle-scale-bar",function(){return a.showScaleBar.toggle()});this.bindAction("toggle-show-slices",function(){return a.showPerspectiveSliceViews.toggle()})}},{key:"showHelpDialog",value:function(){var a=this.inputEventBindings;new t.a([["Global",a.global],["Slice View",a.sliceView],["Perspective View",a.perspectiveView]])}},{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 e}(e.a)},function(n,e,c){n=new (c(77).b);e.a=n},function(n,e,c){e.b=function(c,e){return function(h){h.style.flex=c;e(h)}};e.a=function(c,e){return function(h){h.style.display="flex";h.style.flexDirection=c;for(var a=$jscomp.makeIterator(e),b=a.next();!b.done;b=a.next()){b=b.value;var l=h.ownerDocument.createElement("div");h.appendChild(l);b(l)}}}},function(n,e,c){c.d(e,"a",function(){return a});var p=c(2),h=c(3),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(){function a(b,c,e){e=void 0===e?c:e;if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");this.enumType=b;this.value_=c;this.defaultValue=e;this.changed=new h.a}r(a,[{key:"reset",value:function(){this.value=this.defaultValue}},{key:"restoreState",value:function(a){this.value=Object(p.n)(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(n,e,c){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 h(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 r(a){a.addFragmentExtension("GL_EXT_draw_buffers");a.addFragmentCode(y)}function a(a){a.addFragmentExtension("GL_EXT_draw_buffers");a.addFragmentCode(G)}function b(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")}
c.d(e,"a",function(){return I});var l=c(96),w=c(20),v=c(98),t=c(43);n=c(99);var q=c(46),m=c(49),g=c(17),d=c(1),f=c(103),k=c(68),x=c(12),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}}(),E=function P(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),
null!==a)return P(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};c(31);c(283);var C;(function(a){a[a.COLOR=0]="COLOR";a[a.Z=1]="Z";a[a.PICK=2]="PICK";a[a.NUM_TEXTURES=3]="NUM_TEXTURES"})(C||(C={}));var y=[x.i,"\nvoid emit(vec4 color, vec4 pickId) {\n  gl_FragData["+C.COLOR+"] = color;\n  gl_FragData["+C.Z+"] = packFloat01ToFixedPoint(1.0 - gl_FragCoord.z);\n  gl_FragData["+C.PICK+"] = pickId;\n}\n"],G=["\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"],A=d.p.create(),H=d.p.create(),D=d.j.create(),I=function(c){function e(a,c,h){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var n=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,a,c,h));n.visibleLayerTracker=Object(w.i)(n.viewer.layerManager,
t.a,n);n.sliceViews=new Set;n.projectionMat=d.j.create();n.inverseProjectionMat=d.j.create();n.modelViewMat=d.j.create();n.width=0;n.height=0;n.pickIDs=new v.a;n.axesLineHelper=n.registerDisposer(l.a.get(n.gl));n.sliceViewRenderHelper=n.registerDisposer(q.d.get(n.gl,r));n.offscreenFramebuffer=n.registerDisposer(new k.b(n.gl,{colorBuffers:Object(k.e)(n.gl,C.NUM_TEXTURES),depthBuffer:new k.a(n.gl)}));n.offscreenCopyHelper=n.registerDisposer(k.c.get(n.gl));n.transparencyCopyHelper=n.registerDisposer(k.c.get(n.gl,
b,2));n.registerDisposer(n.navigationState.changed.add(function(){n.viewportChanged()}));Object(g.c)(c,"translate-via-mouse-drag",function(a){Object(f.a)(a.detail,function(a,b,c){a=n.width;var e=n.height,f=n.viewer.navigationState.position,g=f.spatialCoordinates;d.p.transformMat4(A,g,n.projectionMat);A[0]=2*b/a;A[1]=-2*c/e;d.p.transformMat4(g,A,n.inverseProjectionMat);f.changed.dispatch()})});Object(g.c)(c,"rotate-via-mouse-drag",function(a){Object(f.a)(a.detail,function(a,b,c){n.navigationState.pose.rotateRelative(d.e[1],
-b/4*Math.PI/180);n.navigationState.pose.rotateRelative(d.e[0],c/4*Math.PI/180);n.viewer.navigationState.changed.dispatch()})});h.showSliceViewsCheckbox&&(a=n.registerDisposer(new m.c(h.showSliceViews)),a.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(a.element),n.element.appendChild(c));n.registerDisposer(h.showSliceViews.changed.add(function(){n.scheduleRedraw()}));
n.registerDisposer(h.showAxisLines.changed.add(function(){n.scheduleRedraw()}));return n}h(e,c);B(e,[{key:"isReady",value:function(){if(!this.visible)return!1;if(this.viewer.showSliceViews.value)for(var a=$jscomp.makeIterator(this.sliceViews),b=a.next();!b.done;b=a.next())if(!b.value.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;d.j.perspective(a,Math.PI/4,this.width/this.height,10,5E3);var b=this.modelViewMat;this.navigationState.toMat4(b);d.p.set(A,1,-1,-1);d.j.scale(b,b,A);var c=d.p.set(A,0,0,100);d.j.translate(b,b,c);d.j.invert(D,b);d.j.multiply(a,a,D);d.j.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),b=a.next();!b.done;b=a.next())b.value.dispose();this.sliceViews.clear();E(e.prototype.__proto__||Object.getPrototypeOf(e.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,e=this.width,f=this.height;if(!c.hasSize(e,
f))return!1;var g=this.mouseX,h=f-this.mouseY,k=c.readPixel(C.Z,g,h);k=1-Object(x.q)(k);if(1===k)return!1;b[0]=2*g/e-1;b[1]=2*h/f-1;b[2]=2*k-1;d.p.transformMat4(b,b,this.inverseProjectionMat);this.pickIDs.setMouseState(a,c.readPixelAsUint32(C.PICK,g,h));return!0}},{key:"draw",value:function(){if(this.navigationState.valid){this.onResize();var b=this.width,c=this.height;if(0!==b&&0!==c){if(this.viewer.showSliceViews.value)for(var e=$jscomp.makeIterator(this.sliceViews),f=e.next();!f.done;f=e.next())f.value.updateRendering();
e=this.gl;this.offscreenFramebuffer.bind(b,c);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();var g=d.p.create();Object(d.n)(g,d.e[2],this.modelViewMat);d.p.normalize(g,g);var h=this.pickIDs;h.clear();f={dataToDevice:f,lightDirection:g,ambientLighting:.2,directionalLighting:.8,pickIDs:h,emitter:r,emitColor:!0,emitPickID:!0,alreadyEmittedPickID:!1,viewportWidth:b,viewportHeight:c};
g=this.visibleLayerTracker.getVisibleLayers();var k=!1,l=$jscomp.makeIterator(g);for(h=l.next();!h.done;h=l.next())h=h.value,h.isTransparent?k=!0:h.draw(f);this.viewer.showSliceViews.value&&this.drawSliceViews(f);this.viewer.showAxisLines.value&&this.drawAxisLines();if(k){e.depthMask(!1);e.enable(e.BLEND);k=this.transparentConfiguration;k.bind(b,c);this.gl.clearColor(0,0,0,1);e.clear(e.COLOR_BUFFER_BIT);f.emitter=a;e.blendFuncSeparate(e.ONE,e.ONE,e.ZERO,e.ONE_MINUS_SRC_ALPHA);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(e.DEPTH_TEST);this.offscreenFramebuffer.bindSingle(C.COLOR);e.blendFunc(e.ONE_MINUS_SRC_ALPHA,e.SRC_ALPHA);this.transparencyCopyHelper.draw(k.colorBuffers[0].texture,k.colorBuffers[1].texture);e.depthMask(!0);e.disable(e.BLEND);e.enable(e.DEPTH_TEST);this.offscreenFramebuffer.bind(b,c)}e.WEBGL_draw_buffers.drawBuffersWEBGL([e.NONE,e.WEBGL_draw_buffers.COLOR_ATTACHMENT1_WEBGL,e.WEBGL_draw_buffers.COLOR_ATTACHMENT2_WEBGL]);
f.emitter=r;f.emitPickID=!0;f.emitColor=!1;b=$jscomp.makeIterator(g);for(h=b.next();!h.done;h=b.next())c=h.value,f.alreadyEmittedPickID=!c.isTransparent,c.draw(f);e.disable(e.DEPTH_TEST);this.offscreenFramebuffer.unbind();this.setGLViewport();this.offscreenCopyHelper.draw(this.offscreenFramebuffer.colorBuffers[C.COLOR].texture)}}}},{key:"drawSliceViews",value:function(a){var b=this.sliceViewRenderHelper,c=a.lightDirection,e=a.ambientLighting,f=a.directionalLighting;a=a.dataToDevice;for(var g=$jscomp.makeIterator(this.sliceViews),
h=g.next();!h.done;h=g.next())if(h=h.value,0!==h.width&&0!==h.height){var k=Math.abs(d.p.dot(c,h.viewportAxes[2]));k=e+k*f;var l=D;d.j.identity(l);l[0]=h.width/2;l[5]=-h.height/2;d.j.multiply(l,h.viewportToData,l);d.j.multiply(l,a,l);b.draw(h.offscreenFramebuffer.colorBuffers[0].texture,l,d.r.fromValues(k,k,k,1),d.r.fromValues(.5,.5,.5,1),0,0,1,1)}}},{key:"drawAxisLines",value:function(){var a=this.viewer.navigationState.position.spatialCoordinates;d.p.transformMat4(A,a,this.projectionMat);A[0]=.5;
d.p.transformMat4(H,A,this.inverseProjectionMat);var b=d.p.distance(H,a);A[0]=0;A[1]=.5;d.p.transformMat4(H,A,this.inverseProjectionMat);var c=d.p.distance(H,a);a=this.gl;d.j.identity(D);b=Math.min(b,c);D[0]=b;D[5]=b;D[10]=b;b=this.navigationState.position.spatialCoordinates;D[12]=b[0];D[13]=b[1];D[14]=b[2];D[15]=1;d.j.multiply(D,this.projectionMat,D);a.WEBGL_draw_buffers.drawBuffersWEBGL([a.WEBGL_draw_buffers.COLOR_ATTACHMENT0_WEBGL]);this.axesLineHelper.draw(D,!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 k.b(this.gl,{colorBuffers:Object(k.e)(this.gl,2,this.gl.RGBA,this.gl.FLOAT)})));return a}}]);return e}(n.a)},function(n,e){},function(n,e,c){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 h(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 r(a){return a.startsWith("key")?a.substring(3):a.startsWith("digit")||a.startsWith("arrow")?a.substring(5):a}c.d(e,"a",function(){return a});
n=c(39);c(285);var a=function(a){function b(a){function c(a,b){for(var d=$jscomp.makeIterator(a.parents),f=d.next();!f.done;f=d.next())f=f.value,void 0!==f.label?e(f.label,f):c(f,b);a=$jscomp.makeIterator(a.bindings.entries());for(d=a.next();!d.done;d=a.next()){f=$jscomp.makeIterator(d.value);d=f.next().value;f=f.next().value;var g=d.indexOf(":");d=d.substring(g+1);b.set(d,f.action)}}function e(a,b){d.has(b)||(a={label:a,entries:new Map},c(b,a.entries),d.set(b,a))}if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");
var h=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this)),l=h.content;l.classList.add("describe-key-bindings");var g=document.createElement("div");g.classList.add("describe-key-bindings-container");var d=new Map;a=$jscomp.makeIterator(a);for(var f=a.next();!f.done;f=a.next()){var k=$jscomp.makeIterator(f.value);f=k.next().value;k=k.next().value;e(f,k)}a=$jscomp.makeIterator(d.values());for(f=a.next();!f.done;f=a.next()){k=f.value;f=document.createElement("h2");f.textContent=k.label;g.appendChild(f);
f=document.createElement("div");f.className="dl";k=$jscomp.makeIterator(k.entries);for(var n=k.next();!n.done;n=k.next()){var w=$jscomp.makeIterator(n.value);n=w.next().value;w=w.next().value;var E=document.createElement("div"),C=document.createElement("div");C.className="definition-outer-container";E.className="definition-container";var y=document.createElement("div");y.className="dt";y.textContent=n.split("+").map(r).join("+");n=document.createElement("div");n.className="dd";n.textContent=w;E.appendChild(y);
E.appendChild(n);f.appendChild(C);C.appendChild(E)}g.appendChild(f)}l.appendChild(g);return h}h(b,a);return b}(n.a)},function(n,e){},function(n,e,c){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 h(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 r(a){var b=document.createElement("div");b.textContent=a.value;return b}e.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};c.d(e,"a",function(){return B});n=
c(9);var a=c.n(n),b=c(29);n=c(0);var l=c(11),w=c(287),v=c(45),t=c(288),q=c(289),m=c(3),g=c(143),d=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),f=function 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)}};c(290);$jscomp.initSymbol();var k=Symbol("autocompleteIndex"),x=v.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}}),B=function(c){function e(c){if(!(this instanceof
e))throw new TypeError("Cannot call a class as a function");var d=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));d.inputChanged=new m.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=c.completer;
c=void 0===c.delay?200:c.delay;var f=d.scheduleUpdateCompletions=a()(function(){var a=d.activeCompletionCancellationToken=new b.b,c=d.activeCompletionPromise=d.completer(d.value,a);null!==c&&c.then(function(a){d.activeCompletionPromise===c&&(d.setCompletions(a),d.activeCompletionPromise=null)})},c);d.registerDisposer(function(){f.cancel()});c=d.element=document.createElement("div");c.className="autocomplete";var h=document.createElement("div");h.className="autocomplete-dropdown-wrapper";var k=d.dropdownElement=
document.createElement("div");k.className="autocomplete-dropdown";var l=d.promptElement=document.createElement("label");l.className="autocomplete-prompt";var n=d.inputWrapperElement=document.createElement("div");n.className="autocomplete-input-wrapper";c.appendChild(l);var q=d.inputElement=document.createElement("input");q.type="text";q.autocomplete="off";q.spellcheck=!1;q.className="autocomplete-input";Object(g.a)(l,q);l=d.hintElement=document.createElement("input");l.type="text";l.spellcheck=!1;
l.className="autocomplete-hint";l.disabled=!0;n.appendChild(l);n.appendChild(q);h.appendChild(n);h.appendChild(k);c.appendChild(h);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(c.ownerDocument.defaultView,"resize",function(){d.dropdownStyleStale=
!0});d.registerEventListener(c.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 v.b(q,x)).allShortcutsAreGlobal=!0;Object(v.c)(q,"cycle-next-active-completion",
function(){d.cycleActiveCompletion(1)});Object(v.c)(q,"cycle-prev-active-completion",function(){d.cycleActiveCompletion(-1)});Object(v.c)(q,"choose-active-completion-or-prefix",function(a){d.selectActiveCompletion(!0)&&a.preventDefault()});Object(v.c)(q,"choose-active-completion",function(a){d.selectActiveCompletion(!1)&&a.preventDefault()});Object(v.c)(q,"cancel",function(a){a.stopPropagation();d.cancel()&&(a.detail.preventDefault(),a.detail.stopPropagation())});return d}h(e,c);d(e,[{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[k];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(w.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?r:c.makeElement;this.completionElements=c.completions.map(function(e,f){e=d.call(c,e);e[k]=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(q.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(t.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(q.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(l.a)(this.dropdownElement),this.updateDropdown())}},{key:"disposed",value:function(){Object(l.b)(this.element);this.cancelActiveCompletion();null!==this.updateHintScrollPositionTimer&&(clearTimeout(this.updateHintScrollPositionTimer),this.updateHintScrollPositionTimer=null);f(e.prototype.__proto__||Object.getPrototypeOf(e.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 e}(n.a)},function(n,e,c){e.a=function(c,e,n){var a=void 0===n?{}:n,b=void 0===a.horizontal?!1:a.horizontal,h=void 0===a.vertical?!0:a.vertical,p=void 0===a.topMargin?6:a.topMargin,r=void 0===a.bottomMargin?6:a.bottomMargin,t=void 0===a.leftMargin?6:a.leftMargin,q=void 0===a.rightMargin?6:a.rightMargin;n=void 0===a.maxHeight?!0:a.maxHeight;
a=void 0===a.maxWidth?!0:a.maxWidth;e=e.getBoundingClientRect();if(b){b=e.right;var m=c.ownerDocument.documentElement.clientHeight-e.left;b>m?(c.style.left="",c.style.right="0",a&&(c.style.maxWidth=b-t+"px")):(c.style.right="",c.style.left="0",a&&(c.style.maxWidth=m-q+"px"))}h&&(h=e.top-p,r=c.ownerDocument.documentElement.clientHeight-e.bottom-r,h>3*r?(c.style.top="",c.style.bottom="100%",n&&(c.style.maxHeight=h+"px")):(c.style.top="100%",c.style.bottom="",n&&(c.style.maxHeight=r+"px")))}},function(n,
e,c){e.a=function(c){$jscomp.initSymbol();$jscomp.initSymbolIterator();c=c[Symbol.iterator]();var e=c.next(),n=e.value;if(e.done)return"";for(e=n.length;0<e;){var a=c.next(),b=a.value;if(a.done)break;for(a=0;a<e&&n.charCodeAt(a)===b.charCodeAt(a);++a);e=a}return n.substring(0,e)}},function(n,e,c){e.a=function(c){var e=c.parentElement,n=c.offsetLeft-e.clientLeft,a=c.offsetTop-e.clientTop,b=e.scrollLeft,l=e.scrollTop;a=Math.max(0,a+c.offsetHeight-(l+e.clientHeight))||Math.min(0,a-l);e.scrollLeft+=Math.max(0,
n+c.offsetWidth-(b+e.clientWidth))||Math.min(0,n-b);e.scrollTop+=a}},function(n,e){},function(n,e,c){e.a=function(){var c=document.createElement("button");c.type="submit";c.className="hidden-submit-button";c.style.margin="0";c.style.border="0";c.style.padding="0";c.style.width="0";c.style.height="0";c.style.overflow="hidden";c.tabIndex=-1;return c}},function(n,e){},function(n,e,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function h(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 r(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){var d=Object(q.c)(a,"dragenter",function(b){void 0!==Object(t.c)(b)&&a.classList.add("neuroglancer-drag-over")}),
e=Object(q.c)(a,"dragleave",function(){a.classList.remove("neuroglancer-drag-over")}),f=Object(q.c)(a,"dragover",function(a){Object(w.c)(a)?(Object(g.e)(a,Object(w.b)(a,b)),a.stopPropagation(),a.preventDefault()):void 0!==Object(t.c)(a)&&(Object(t.f)(a,b,!0),a.stopPropagation(),a.preventDefault())}),h=Object(q.c)(a,"drop",function(d){a.classList.remove("neuroglancer-drag-over");if(Object(w.c)(d)){d.stopPropagation();try{var e=JSON.parse(d.dataTransfer.getData(w.d))}catch(Q){return}var f=Object(t.b)(d,
b,!1,!1,!0);if(void 0!==f&&f.finalize(d)){d.preventDefault();d.dataTransfer.dropEffect=Object(g.c)();Object(t.a)(d);var h=c();f=$jscomp.makeIterator(f.layers.keys());for(d=f.next();!d.done;d=f.next())h.layerSpecification.add(d.value);try{h.restoreState(e)}catch(Q){}}}else if(h=Object(t.b)(d,b,"copy"===Object(g.c)(),!1,!0),void 0!==h&&h.finalize(d))for(d.preventDefault(),d.dataTransfer.dropEffect=Object(g.c)(),Object(t.a)(d),e=c(),h=$jscomp.makeIterator(h.layers.keys()),d=h.next();!d.done;d=h.next())e.layerSpecification.add(d.value)});
return function(){h();f();e();d()}}function b(a,b){var c=document.createElement("div");c.style.flex="1";c.style.width="0px";if("string"===typeof b){if(void 0!==a.parent)throw Error("Invalid layout component specification: "+JSON.stringify(b));return new C(c,b,a.viewer)}Object(d.u)(b);var e=Object(d.w)(b,"type",d.B);switch(e){case "row":case "column":return new y(c,e,Object(d.w)(b,"children",function(b){b=Object(d.a)(b,function(a){return a});if(void 0===a.parent&&0===b.length)throw Error("Stack layout requires at least one child.");
return b}),a);case "viewer":e=a.viewer;var f=new v.a(e.layerSpecification.addRef());c=new w.a(c,{display:e.display,navigationState:e.navigationState.addRef(),perspectiveNavigationState:e.perspectiveNavigationState.addRef(),mouseState:e.mouseState,showAxisLines:e.showAxisLines,showScaleBar:e.showScaleBar,showPerspectiveSliceViews:e.showPerspectiveSliceViews,layerSpecification:f,inputEventBindings:e.inputEventBindings,visibility:e.visibility},{showLayerPanel:e.showLayerPanelEffective,showViewerMenu:!0});
try{c.restoreState(b)}catch(P){throw c.dispose(),P;}return c}throw Error("Invalid layout component specification: "+JSON.stringify(b));}c.d(e,"a",function(){return G});n=c(9);var l=c.n(n),w=c(294),v=c(14),t=c(83),q=c(0),m=c(11),g=c(84),d=c(2),f=c(3),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}}(),x=function H(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 H(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};c(304);$jscomp.initSymbol();var B=Symbol("layoutComponentContainer"),E=function(c){function d(b,c,e){p(this,d);var g=h(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));g.viewer=b;g.parent=e;g.changed=new f.a;g.element=document.createElement("div");var k=g.element;
k.style.display="flex";k.style.flex="1";k.style.position="relative";k.style.alignItems="stretch";k.foo="hello";k[B]=g;g.setSpecification(c);var l=[];b=function(b){var c=document.createElement("div");c.className="neuroglancer-layout-split-drop-zone";c.style[b]="0";switch(b){case "left":case "right":var d="row";c.style.width="10px";c.style.height="100%";break;case "top":case "bottom":d="column",c.style.height="10px",c.style.width="100%"}c.style.display="none";l.push({element:c,direction:d,orientation:b});
k.appendChild(c);g.registerDisposer(a(c,g.viewer.layerSpecification,function(){return g.split(b).newContainer.component}))};b("left");b("right");b("top");b("bottom");var m=!1;g.registerEventListener(k,"dragenter",function(a){if(!m&&void 0!==Object(t.c)(a)){m=!0;a=$jscomp.makeIterator(l);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)===g)&&("bottom"!==c&&"right"!==c||e.get(e.length-
1)===g))c=g.component,c instanceof y&&c.direction===d||(b.style.display="block")}}},!0);g.registerEventListener(k,"drop",function(a){if(m){m=!1;a=$jscomp.makeIterator(l);for(var b=a.next();!b.done;b=a.next())b.value.element.style.display="none"}});g.registerEventListener(k,"dragleave",function(a){a=a.relatedTarget;if(m&&!(a instanceof HTMLElement&&g.element.contains(a))){m=!1;a=$jscomp.makeIterator(l);for(var b=a.next();!b.done;b=a.next())b.value.element.style.display="none"}},!0);return g}r(d,c);
k(d,[{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 w.a){var c=a.layerManager,d=a.registerCancellable(l()(function(){0===c.managedLayers.length&&b.dispose()},0));a.registerDisposer(c.layersChanged.add(function(){0===
c.managedLayers.length&&d()}));d()}else if(a instanceof y){var e=a.registerCancellable(l()(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 w.a){var d=c.layout.name;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(b(this,a))}},{key:"disposed",value:function(){this.unsetComponent();this.componentValue=void 0;x(d.prototype.__proto__||Object.getPrototypeOf(d.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 C?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[B]}}]);return d}(q.a),C=function(a){function b(a,c,d){p(this,b);var e=h(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));e.element=a;e.layerGroupViewer=e.registerDisposer(new w.a(a,{display:d.display,navigationState:d.navigationState.addRef(),perspectiveNavigationState:d.perspectiveNavigationState.addRef(),
mouseState:d.mouseState,showAxisLines:d.showAxisLines,showScaleBar:d.showScaleBar,showPerspectiveSliceViews:d.showPerspectiveSliceViews,layerSpecification:d.layerSpecification.addRef(),inputEventBindings:d.inputEventBindings,visibility:d.visibility},{showLayerPanel:d.showLayerPanelEffective,showViewerMenu:!1}));e.layerGroupViewer.layout.name=c;return e}r(b,a);k(b,[{key:"toJSON",value:function(){return this.layerGroupViewer.layout.name}},{key:"changed",get:function(){return this.layerGroupViewer.layout.changed}}]);
return b}(q.a),y=function(b){function c(a,b,d,e){p(this,c);var g=h(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));g.element=a;g.direction=b;g.container=e;g.changed=new f.a;a.classList.add("neuroglancer-stack-layout");a.classList.add("neuroglancer-stack-layout-"+b);a.style.display="flex";a.style.flexDirection=b;a.appendChild(g.makeDropPlaceholder(g));a=$jscomp.makeIterator(d);for(b=a.next();!b.done;b=a.next())g.insertChild(b.value);return g}r(c,b);$jscomp.initSymbol();$jscomp.initSymbolIterator();
k(c,[{key:"makeDropPlaceholder",value:function(b){var c=this,d=document.createElement("div");d.className="neuroglancer-stack-layout-drop-placeholder";b.registerDisposer(a(d,this.viewer.layerSpecification,function(){var a=d.nextElementSibling,b;null!==a&&(b=E.getFromElement(a));return c.insertChild({type:"viewer",layers:[]},b).component}));b.registerDisposer(function(){Object(m.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();x(c.prototype.__proto__||Object.getPrototypeOf(c.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 c}(q.a),G=function(a){function b(a,c){p(this,b);var d=h(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}r(b,a);k(b,[{key:"reset",value:function(){this.container.setSpecification(this.defaultSpecification)}},{key:"restoreState",value:function(a){this.container.setSpecification(a)}},{key:"disposed",value:function(){x(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}(q.a)},function(n,e,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function h(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 r(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 m.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 E.a(f));var g=document.createElement("label");g.style.display="flex";g.style.flexDirection="row";g.style.whiteSpace=
"nowrap";g.textContent=e;g.appendChild(f.element);c.appendChild(g)}return a}e.c=function(a){return-1!==a.dataTransfer.types.indexOf("neuroglancer-layer-group-viewer")};e.b=function(a,b){if(a.shiftKey)return"copy";if(a.ctrlKey)return"move";a=G&&G.viewer.layerSpecification.rootLayers===b.rootLayers?G.viewer:void 0;return void 0!==a?"move":"copy"};c.d(e,"a",function(){return H});n=c(9);var b=c.n(n),l=c(141),w=c(295),v=c(14),t=c(61),q=c(49),m=c(82),g=c(83),d=c(146),f=c(56);n=c(0);var k=c(11),x=c(17),
B=c(27),E=c(302),C=function I(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 I(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},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}}();
c(303);e.d="neuroglancer-layer-group-viewer";var G,A=function(a){function b(a){p(this,b);var c=h(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.position=new t.b(a.navigationState.position.addRef());c.crossSectionOrientation=new t.a(a.navigationState.pose.orientation.addRef());c.crossSectionZoom=new t.c(a.navigationState.zoomFactor.addRef());c.navigationState=c.registerDisposer(new t.e(new t.g(c.position.value,c.crossSectionOrientation.value),c.crossSectionZoom.value));c.perspectiveOrientation=
new t.a(a.perspectiveNavigationState.pose.orientation.addRef());c.perspectiveZoom=new t.c(a.perspectiveNavigationState.zoomFactor.addRef());c.perspectiveNavigationState=c.registerDisposer(new t.e(new t.g(c.position.value.addRef(),c.perspectiveOrientation.value),c.perspectiveZoom.value));return c}r(b,a);y(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}(n.a),H=function(c){function e(a,c,g){g=void 0===g?{}:g;p(this,e);var k=h(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));k.element=a;k.viewerState=c;k.state=new B.a;
k.options=Object.assign({showLayerPanel:new q.b(!0),showViewerMenu:!1},g);k.layerSpecification=k.registerDisposer(c.layerSpecification);k.viewerNavigationState=k.registerDisposer(new A(c));k.viewerNavigationState.register(k.state);k.layerSpecification instanceof v.a?k.state.add("layers",k.layerSpecification):k.state.add("layers",{changed:k.layerSpecification.changed,toJSON:function(){return k.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");k.registerDisposer(new f.a(a));k.layout=k.registerDisposer(new l.a(k,"xy"));k.state.add("layout",k.layout);k.registerActionBindings();k.registerDisposer(k.layerManager.useDirectly());k.registerDisposer(Object(d.a)(a,k.navigationState.position));k.registerDisposer(k.options.showLayerPanel.changed.add(k.registerCancellable(b()(function(){return k.updateUI()},0))));k.makeUI();return k}r(e,
c);y(e,[{key:"bindAction",value:function(a,b){this.registerDisposer(Object(x.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?(this.layerPanel.dispose(),this.layerPanel=void 0):d&&void 0===this.layerPanel&&(d=this.layerPanel=new w.a(this.display,this.layerSpecification,this.viewerNavigationState),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(g.e)(a,{manager:b.layerSpecification,layers:b.layerManager.managedLayers});var c=function(){G&&G.viewer===b&&(G=void 0);b.unregisterDisposer(c)};G={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(g.a)(a);
void 0!==G&&G.viewer===b&&G.disposer()}),this.element.insertBefore(d.element,this.element.firstChild))}},{key:"disposed",value:function(){Object(k.a)(this.element);var a=this.layerPanel;void 0!==a&&(a.dispose(),this.layerPanel=void 0);C(e.prototype.__proto__||Object.getPrototypeOf(e.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:"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:"changed",get:function(){return this.state.changed}}]);return e}(n.a)},function(n,e,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function h(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 r(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 b(b,c,d){function e(c,e){var g=
b.dropLayers,h=e?Object(q.d)(c,b.manager):Object(f.c)(),k=!0;if(void 0!==g&&(e&&Object(f.e)(c,h),!g.compatibleWithMethod(h)&&(b.dropLayers=void 0,a(g,d))))return;if(void 0===g){g=b.dropLayers=Object(q.b)(c,b.manager,"copy"===h,!0,!1);if(void 0===g)return;k="move"===g.method}if(void 0!==d&&g.layers.has(d))return g;if(k){var l=b.manager.layerManager,m=new Set,n=Number.POSITIVE_INFINITY;c=l.managedLayers=l.managedLayers.filter(function(a,b){return g.layers.has(a)?(n===Number.POSITIVE_INFINITY&&(n=b),
m.add(a),!1):!0});void 0!==d?(e=c.indexOf(d),n<=e&&++e):e=c.length;h=$jscomp.makeIterator(g.layers.keys());for(k=h.next();!k.done;k=h.next())k=k.value,m.has(k)||g.layers.delete(k);c.splice.apply(c,[].concat([e,0],$jscomp.arrayFromIterable(g.layers.keys())));l.layersChanged.dispatch()}else for(void 0!==d&&(l=b.manager.layerManager.managedLayers.indexOf(d)),c=$jscomp.makeIterator(g.layers.keys()),e=c.next();!e.done;e=c.next())b.manager.add(e.value,l);return g}var h=Object(g.c)(c,"dragenter",function(a){void 0!==
e(a,!0)&&a.preventDefault()}),k=Object(g.c)(c,"drop",function(c){c.preventDefault();var d=e(c,!1);void 0!==d&&(d.finalize(c)?(c.dataTransfer.dropEffect=Object(f.c)(),Object(q.a)("move"===d.method?void 0:c)):a(d));b.dropLayers=void 0}),l=Object(g.c)(c,"dragover",function(a){void 0!==e(a,!0)&&(a.preventDefault(),a.stopPropagation())});return function(){l();k();h()}}c.d(e,"a",function(){return y});var l=c(142),w=c(14),v=c(61),t=c(82),q=c(83),m=c(144),g=c(0),d=c(11),f=c(84),k=c(298),x=c(85),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}}(),E=function A(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 A(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};c(31);c(301);c(62);var C=function(a){function c(a,
d){p(this,c);var e=h(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));e.layer=a;e.panel=d;var f=e.element=document.createElement("div");f.title="Right 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 m=e.layerNumberElement=document.createElement("span");m.className="neuroglancer-layer-item-number";var n=e.valueElement=document.createElement("span");
n.className="neuroglancer-layer-item-value";var r=Object(k.a)();r.title="Delete layer";e.registerEventListener(r,"click",function(a){e.panel.layerManager.removeManagedLayer(e.layer);a.stopPropagation()});f.appendChild(m);f.appendChild(g);f.appendChild(n);f.appendChild(r);e.registerEventListener(f,"click",function(b){a.setVisible(!a.visible)});g=e.contextMenu=e.registerDisposer(new t.a(f));g.element.classList.add("neuroglancer-layer-dropdown");g.opened.add(function(){if(void 0!==e.dropdown)e.dropdown.onShow()});
g.closed.add(function(){if(void 0!==e.dropdown)e.dropdown.onHide()});f.draggable=!0;e.registerEventListener(f,"dragstart",function(a){Object(q.e)(a,{manager:d.manager,layers:[e.layer]});a.stopPropagation()});e.registerEventListener(f,"dragend",function(a){Object(q.a)(a)});e.registerDisposer(b(e.panel,f,e.layer));e.registerEventListener(f,"dblclick",function(b){a instanceof w.b&&new l.a(e.panel.manager,a)});e.handleLayerChanged();e.registerDisposer(a.layerChanged.add(function(){e.handleLayerChanged()}));
return e}r(c,a);B(c,[{key:"update",value:function(){var a=this.layer;this.labelElement.textContent=a.name;this.element.setAttribute("layer-visible",a.visible.toString())}},{key:"handleLayerChanged",value:function(){var a=this.layer.layer;if(a!==this.userLayer)if(this.dropdown&&(this.dropdown.dispose(),Object(d.a)(this.contextMenu.element)),this.userLayer=a){var b=document.createElement("div");this.contextMenu.element.appendChild(b);this.dropdown=a.makeDropdown(b)}else this.dropdown=void 0;this.contextMenu.disabled=
void 0===this.dropdown}},{key:"disposed",value:function(){this.dropdown&&this.dropdown.dispose();this.element.parentElement.removeChild(this.element);E(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"disposed",this).call(this)}}]);return c}(g.a),y=function(c){function e(c,d,g){p(this,e);var k=h(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));k.display=c;k.manager=d;k.viewerNavigationState=g;k.layerWidgets=new Map;k.element=document.createElement("div");k.layerUpdateNeeded=!0;k.valueUpdateNeeded=
!1;k.layerWidgetInsertionPoint=document.createElement("div");k.positionWidget=k.registerDisposer(new x.b(k.viewerNavigationState.position.value));k.scheduleUpdate=k.registerCancellable(Object(m.a)(function(){return k.update()}));var l=k.element;l.className="neuroglancer-layer-panel";k.registerDisposer(d.layerSelectedValues.changed.add(function(){k.handleLayerValuesChanged()}));k.registerDisposer(d.layerManager.layersChanged.add(function(){k.handleLayersChanged()}));k.layerWidgetInsertionPoint.style.display=
"none";k.element.appendChild(k.layerWidgetInsertionPoint);d=k.addButton=document.createElement("div");d.className="neuroglancer-layer-add-button neuroglancer-button";d.title="Add layer";d.textContent="+";g=k.dropZone=document.createElement("div");g.className="neuroglancer-layer-panel-drop-zone";k.registerEventListener(d,"click",function(){k.addLayerMenu()});l.appendChild(d);l.appendChild(g);k.registerDisposer(Object(f.d)(d));l.appendChild(k.positionWidget.element);var n=function(){k.positionWidget.element.style.display=
k.viewerNavigationState.position.link.value===v.d.LINKED?"none":null};k.registerDisposer(k.viewerNavigationState.position.link.changed.add(n));n();k.update();k.registerEventListener(l,"dragleave",function(b){b.relatedTarget&&l.contains(b.relatedTarget)||(b=k.dropLayers,void 0!==b&&(a(b),k.dropLayers=void 0))});k.registerDisposer(b(k,d,void 0));k.registerDisposer(b(k,g,void 0));k.registerDisposer(c.updateStarted.add(function(){return k.updateLayers()}));return k}r(e,c);B(e,[{key:"disposed",value:function(){this.layerWidgets.forEach(function(a){return a.dispose()});
this.layerWidgets=void 0;Object(d.b)(this.element);E(e.prototype.__proto__||Object.getPrototypeOf(e.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 C(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 l.a(this.manager)}},{key:"layerManager",get:function(){return this.manager.layerManager}}]);
return e}(g.a)},function(n,e){},function(n,e,c){e.b=function(c){return Array.prototype.map.call(c,function(c){return("0"+c.toString(16)).slice(-2)}).join("")};e.a=function(c){if(!/^(?:[0-9a-fA-F]{2})*$/.test(c))throw Error("Invalid hex-encoded string");for(var e=c.length/2,n=new Uint8Array(e),a=0;a<e;++a)n[a]=parseInt(c.substr(2*a,2),16);return n}},function(n,e,c){e.a=function(){return Object(p.a)("\u274c")};var p=c(145)},function(n,e){},function(n,e){},function(n,e){},function(n,e,c){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 h(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)}c.d(e,"a",function(){return a});n=
c(0);var 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(a){function b(a){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");var c=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.model=a;c.element=document.createElement("select");c.valueIndexMap=new Map;
for(var e=c.element,h=c.valueIndexMap,m=0,g=$jscomp.makeIterator(Object.keys(a.enumType)),d=g.next();!d.done;d=g.next())if(d=d.value,isNaN(Number(d))){var f=document.createElement("option");f.textContent=f.value=d.toLowerCase();e.appendChild(f);h.set(a.enumType[d],m);++m}c.registerDisposer(a.changed.add(function(){return c.updateView()}));c.registerEventListener(e,"change",function(){return c.updateModel()});c.updateView();return c}h(b,a);r(b,[{key:"updateView",value:function(){this.element.selectedIndex=
this.valueIndexMap.get(this.model.value)}},{key:"updateModel",value:function(){this.model.restoreState(this.element.value)}}]);return b}(n.a)},function(n,e){},function(n,e){},function(n,e,c){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 h(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)}c.d(e,"a",function(){return w});var r=c(8);n=c(0);var a=c(11),b=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}}(),l=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)}},w=function(c){function e(a,b){b=void 0===b?{}:b;if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var c=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));c.model=a;c.element=document.createElement("label");c.inputElement=document.createElement("input");
var f=b;b=f.validator;f=f.label;var g=c.element,h=c.inputElement;void 0===b&&(b=a instanceof r.a?a.validator:function(a){return a});c.validator=b;void 0!==f&&(g.textContent=f);g.appendChild(h);g.className="neuroglancer-number-input";h.type="input";c.registerDisposer(c.model.changed.add(function(){return c.updateView()}));c.registerEventListener(h,"change",function(){return c.updateModel()});c.updateView();return c}h(e,c);b(e,[{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(g){this.updateView()}}},{key:"disposed",value:function(){Object(a.b)(this.element);l(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"disposed",this).call(this)}}]);return e}(n.a)},function(n,e){},function(n,e,c){e.a=function(){return Object(p.c)(document,"contextmenu",function(c){c.preventDefault()})};e.b=function(){return Object(p.c)(document,
"wheel",function(c){c.ctrlKey&&c.preventDefault()})};var p=c(0)},function(n,e,c){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 h(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)}c.d(e,"a",function(){return v});n=c(9);var r=c.n(n),a=c(8);n=c(0);var b=c(2),l=c(27),w=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,e){c&&a(b.prototype,c);e&&a(b,e);return b}}(),v=function(c){function e(b,c){c=void 0===c?200:c;if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");
var d=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));d.root=b;d.parseError=new a.b(void 0);d.registerEventListener(window,"hashchange",function(){return d.updateFromUrlHash()});var f=r()(function(){return d.setUrlHash()},c);d.registerDisposer(b.changed.add(f));d.registerDisposer(function(){return f.cancel()});return d}h(e,c);w(e,[{key:"setUrlHash",value:function(){var a=Object(l.c)(this.root);a.generation!==this.prevStateGeneration&&(this.prevStateGeneration=a.generation,a=Object(b.i)(a.value),
a!==this.prevStateString&&(this.prevStateString=a,"{}"===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=decodeURI(a);var c=Object(b.h)(a);Object(b.u)(c);this.root.restoreState(c);this.prevStateString=void 0}else if(a.startsWith("#!")){a=a.slice(2);a=decodeURI(a);if(a===this.prevStateString)return;this.prevStateString=
a;this.root.reset();var d=Object(b.h)(a);Object(b.u)(d);this.root.restoreState(d)}else throw Error('URL hash is expected to be of the form "#!{...}" or "#!+{...}".');this.parseError.value=void 0}catch(f){this.parseError.value=f}}}]);return e}(n.a)}]);
