/*

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

 JS Signals <http://millermedeiros.github.com/js-signals/>
 Released under the MIT license
 Author: Miller Medeiros
 Version: 1.0.0 - Build: 268 (2012/11/29 05:48 PM)

 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 2015 Mozilla Foundation

 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 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 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 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 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 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 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 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 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 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 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 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.
*/
var $jscomp={scope:{},getGlobal:function(f){return"undefined"!=typeof window&&window===f?f:"undefined"!=typeof global?global:f}};$jscomp.global=$jscomp.getGlobal(this);$jscomp.initSymbol=function(){$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol);$jscomp.initSymbol=function(){}};$jscomp.symbolCounter_=0;$jscomp.Symbol=function(f){return"jscomp_symbol_"+f+$jscomp.symbolCounter_++};
$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();$jscomp.global.Symbol.iterator||($jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));$jscomp.initSymbolIterator=function(){}};
$jscomp.makeIterator=function(f){$jscomp.initSymbolIterator();if(f[$jscomp.global.Symbol.iterator])return f[$jscomp.global.Symbol.iterator]();if(!(f instanceof Array||"string"==typeof f||f instanceof String))throw new TypeError(f+" is not iterable");var d=0;return{next:function(){return d==f.length?{done:!0}:{done:!1,value:f[d++]}}}};$jscomp.arrayFromIterator=function(f){for(var d,h=[];!(d=f.next()).done;)h.push(d.value);return h};
$jscomp.arrayFromIterable=function(f){return f instanceof Array?f:$jscomp.arrayFromIterator($jscomp.makeIterator(f))};$jscomp.arrayFromArguments=function(f){for(var d=[],h=0;h<f.length;h++)d.push(f[h]);return d};$jscomp.inherits=function(f,d){function h(){}h.prototype=d.prototype;f.prototype=new h;f.prototype.constructor=f;for(var l in d)if($jscomp.global.Object.defineProperties){var b=$jscomp.global.Object.getOwnPropertyDescriptor(d,l);$jscomp.global.Object.defineProperty(f,l,b)}else f[l]=d[l]};
$jscomp.array=$jscomp.array||{};$jscomp.array.done_=function(){return{done:!0,value:void 0}};$jscomp.array.arrayIterator_=function(f,d){f instanceof String&&(f=String(f));var h=0;$jscomp.initSymbol();$jscomp.initSymbolIterator();var l={},b=(l.next=function(){if(h<f.length){var a=h++;return{value:d(a,f[a]),done:!1}}b.next=$jscomp.array.done_;return $jscomp.array.done_()},l[Symbol.iterator]=function(){return b},l);return b};
$jscomp.array.findInternal_=function(f,d,h){f instanceof String&&(f=String(f));for(var l=f.length,b=0;b<l;b++){var a=f[b];if(d.call(h,a,b,f))return{i:b,v:a}}return{i:-1,v:void 0}};
$jscomp.array.from=function(f,d,h){d=void 0===d?function(a){return a}:d;var l=[];$jscomp.initSymbol();$jscomp.initSymbolIterator();if(f[Symbol.iterator]){$jscomp.initSymbol();$jscomp.initSymbolIterator();f=f[Symbol.iterator]();for(var b;!(b=f.next()).done;)l.push(d.call(h,b.value))}else{b=f.length;for(var a=0;a<b;a++)l.push(d.call(h,f[a]))}return l};$jscomp.array.of=function(f){for(var d=[],h=0;h<arguments.length;++h)d[h-0]=arguments[h];return $jscomp.array.from(d)};
$jscomp.array.entries=function(){return $jscomp.array.arrayIterator_(this,function(f,d){return[f,d]})};$jscomp.array.entries$install=function(){Array.prototype.entries||(Array.prototype.entries=$jscomp.array.entries)};$jscomp.array.keys=function(){return $jscomp.array.arrayIterator_(this,function(f){return f})};$jscomp.array.keys$install=function(){Array.prototype.keys||(Array.prototype.keys=$jscomp.array.keys)};$jscomp.array.values=function(){return $jscomp.array.arrayIterator_(this,function(f,d){return d})};
$jscomp.array.values$install=function(){Array.prototype.values||(Array.prototype.values=$jscomp.array.values)};$jscomp.array.copyWithin=function(f,d,h){var l=this.length;f=Number(f);d=Number(d);h=Number(null!=h?h:l);if(f<d)for(h=Math.min(h,l);d<h;)d in this?this[f++]=this[d++]:(delete this[f++],d++);else for(h=Math.min(h,l+d-f),f+=h-d;h>d;)--h in this?this[--f]=this[h]:delete this[f];return this};$jscomp.array.copyWithin$install=function(){Array.prototype.copyWithin||(Array.prototype.copyWithin=$jscomp.array.copyWithin)};
$jscomp.array.fill=function(f,d,h){null!=h&&f.length||(h=this.length||0);h=Number(h);for(d=Number((void 0===d?0:d)||0);d<h;d++)this[d]=f;return this};$jscomp.array.fill$install=function(){Array.prototype.fill||(Array.prototype.fill=$jscomp.array.fill)};$jscomp.array.find=function(f,d){return $jscomp.array.findInternal_(this,f,d).v};$jscomp.array.find$install=function(){Array.prototype.find||(Array.prototype.find=$jscomp.array.find)};
$jscomp.array.findIndex=function(f,d){return $jscomp.array.findInternal_(this,f,d).i};$jscomp.array.findIndex$install=function(){Array.prototype.findIndex||(Array.prototype.findIndex=$jscomp.array.findIndex)};$jscomp.Map=function(f){f=void 0===f?[]:f;this.data_={};this.head_=$jscomp.Map.createHead_();this.size=0;if(f){f=$jscomp.makeIterator(f);for(var d=f.next();!d.done;d=f.next())d=d.value,this.set(d[0],d[1])}};
$jscomp.Map.checkBrowserConformance_=function(){var f=$jscomp.global.Map;if(!f||!f.prototype.entries||!Object.seal)return!1;try{var d=Object.seal({x:4}),h=new f($jscomp.makeIterator([[d,"s"]]));if("s"!=h.get(d)||1!=h.size||h.get({x:4})||h.set({x:4},"t")!=h||2!=h.size)return!1;var l=h.entries(),b=l.next();if(b.done||b.value[0]!=d||"s"!=b.value[1])return!1;b=l.next();return b.done||4!=b.value[0].x||"t"!=b.value[1]||!l.next().done?!1:!0}catch(a){return!1}};
$jscomp.Map.createHead_=function(){var f={};return f.previous=f.next=f.head=f};$jscomp.Map.getId_=function(f){if(!(f instanceof Object))return String(f);$jscomp.Map.key_ in f||f instanceof Object&&Object.isExtensible&&Object.isExtensible(f)&&$jscomp.Map.defineProperty_(f,$jscomp.Map.key_,++$jscomp.Map.index_);return $jscomp.Map.key_ in f?f[$jscomp.Map.key_]:" "+f};
$jscomp.Map.prototype.set=function(f,d){var h=this.maybeGetEntry_(f),l=h.id,b=h.list,h=h.entry;b||(b=this.data_[l]=[]);h?h.value=d:(h={next:this.head_,previous:this.head_.previous,head:this.head_,key:f,value:d},b.push(h),this.head_.previous.next=h,this.head_.previous=h,this.size++);return this};
$jscomp.Map.prototype["delete"]=function(f){var d=this.maybeGetEntry_(f);f=d.id;var h=d.list,l=d.index;return(d=d.entry)&&h?(h.splice(l,1),h.length||delete this.data_[f],d.previous.next=d.next,d.next.previous=d.previous,d.head=null,this.size--,!0):!1};$jscomp.Map.prototype.clear=function(){this.data_={};this.head_=this.head_.previous=$jscomp.Map.createHead_();this.size=0};$jscomp.Map.prototype.has=function(f){return!!this.maybeGetEntry_(f).entry};
$jscomp.Map.prototype.get=function(f){return(f=this.maybeGetEntry_(f).entry)&&f.value};$jscomp.Map.prototype.maybeGetEntry_=function(f){var d=$jscomp.Map.getId_(f),h=this.data_[d];if(h)for(var l=0;l<h.length;l++){var b=h[l];if(f!==f&&b.key!==b.key||f===b.key)return{id:d,list:h,index:l,entry:b}}return{id:d,list:h,index:-1,entry:void 0}};$jscomp.Map.prototype.entries=function(){return this.iter_(function(f){return[f.key,f.value]})};$jscomp.Map.prototype.keys=function(){return this.iter_(function(f){return f.key})};
$jscomp.Map.prototype.values=function(){return this.iter_(function(f){return f.value})};$jscomp.Map.prototype.forEach=function(f,d){for(var h=$jscomp.makeIterator(this.entries()),l=h.next();!l.done;l=h.next())l=l.value,f.call(d,l[1],l[0],this)};
$jscomp.Map.prototype.iter_=function(f){var d=this,h=this.head_;$jscomp.initSymbol();$jscomp.initSymbolIterator();var l={};return l.next=function(){if(h){for(;h.head!=d.head_;)h=h.previous;for(;h.next!=h.head;)return h=h.next,{done:!1,value:f(h)};h=null}return{done:!0,value:void 0}},l[Symbol.iterator]=function(){return this},l};$jscomp.Map.index_=0;$jscomp.Map.defineProperty_=Object.defineProperty?function(f,d,h){Object.defineProperty(f,d,{value:String(h)})}:function(f,d,h){f[d]=String(h)};
$jscomp.Map.Entry_=function(){};$jscomp.Map.ASSUME_NO_NATIVE=!1;$jscomp.Map$install=function(){$jscomp.initSymbol();$jscomp.initSymbolIterator();!$jscomp.Map.ASSUME_NO_NATIVE&&$jscomp.Map.checkBrowserConformance_()?$jscomp.Map=$jscomp.global.Map:($jscomp.initSymbol(),$jscomp.initSymbolIterator(),$jscomp.Map.prototype[Symbol.iterator]=$jscomp.Map.prototype.entries,$jscomp.initSymbol(),$jscomp.Map.key_=Symbol("map-id-key"));$jscomp.Map$install=function(){}};$jscomp.math=$jscomp.math||{};
$jscomp.math.clz32=function(f){f=Number(f)>>>0;if(0===f)return 32;var d=0;0===(f&4294901760)&&(f<<=16,d+=16);0===(f&4278190080)&&(f<<=8,d+=8);0===(f&4026531840)&&(f<<=4,d+=4);0===(f&3221225472)&&(f<<=2,d+=2);0===(f&2147483648)&&d++;return d};$jscomp.math.imul=function(f,d){f=Number(f);d=Number(d);var h=f&65535,l=d&65535;return h*l+((f>>>16&65535)*l+h*(d>>>16&65535)<<16>>>0)|0};$jscomp.math.sign=function(f){f=Number(f);return 0===f||isNaN(f)?f:0<f?1:-1};
$jscomp.math.log10=function(f){return Math.log(f)/Math.LN10};$jscomp.math.log2=function(f){return Math.log(f)/Math.LN2};$jscomp.math.log1p=function(f){f=Number(f);if(.25>f&&-.25<f){for(var d=f,h=1,l=f,b=0,a=1;b!=l;)d*=f,a*=-1,l=(b=l)+a*d/++h;return l}return Math.log(1+f)};$jscomp.math.expm1=function(f){f=Number(f);if(.25>f&&-.25<f){for(var d=f,h=1,l=f,b=0;b!=l;)d*=f/++h,l=(b=l)+d;return l}return Math.exp(f)-1};$jscomp.math.cosh=function(f){f=Number(f);return(Math.exp(f)+Math.exp(-f))/2};
$jscomp.math.sinh=function(f){f=Number(f);return 0===f?f:(Math.exp(f)-Math.exp(-f))/2};$jscomp.math.tanh=function(f){f=Number(f);if(0===f)return f;var d=Math.exp(2*-Math.abs(f)),d=(1-d)/(1+d);return 0>f?-d:d};$jscomp.math.acosh=function(f){f=Number(f);return Math.log(f+Math.sqrt(f*f-1))};$jscomp.math.asinh=function(f){f=Number(f);if(0===f)return f;var d=Math.log(Math.abs(f)+Math.sqrt(f*f+1));return 0>f?-d:d};
$jscomp.math.atanh=function(f){f=Number(f);return($jscomp.math.log1p(f)-$jscomp.math.log1p(-f))/2};
$jscomp.math.hypot=function(f,d,h){for(var l=[],b=2;b<arguments.length;++b)l[b-2]=arguments[b];f=Number(f);d=Number(d);for(var a=Math.max(Math.abs(f),Math.abs(d)),c=$jscomp.makeIterator(l),b=c.next();!b.done;b=c.next())a=Math.max(a,Math.abs(b.value));if(1E100<a||1E-100>a){f/=a;d/=a;c=f*f+d*d;l=$jscomp.makeIterator(l);for(b=l.next();!b.done;b=l.next())b=b.value,b=Number(b)/a,c+=b*b;return Math.sqrt(c)*a}a=f*f+d*d;l=$jscomp.makeIterator(l);for(b=l.next();!b.done;b=l.next())b=b.value,a+=b*b;return Math.sqrt(a)};
$jscomp.math.trunc=function(f){f=Number(f);if(isNaN(f)||Infinity===f||-Infinity===f||0===f)return f;var d=Math.floor(Math.abs(f));return 0>f?-d:d};$jscomp.math.cbrt=function(f){if(0===f)return f;f=Number(f);var d=Math.pow(Math.abs(f),1/3);return 0>f?-d:d};$jscomp.number=$jscomp.number||{};$jscomp.number.isFinite=function(f){return"number"!==typeof f?!1:!isNaN(f)&&Infinity!==f&&-Infinity!==f};$jscomp.number.isInteger=function(f){return $jscomp.number.isFinite(f)?f===Math.floor(f):!1};
$jscomp.number.isNaN=function(f){return"number"===typeof f&&isNaN(f)};$jscomp.number.isSafeInteger=function(f){return $jscomp.number.isInteger(f)&&Math.abs(f)<=$jscomp.number.MAX_SAFE_INTEGER};$jscomp.number.EPSILON=Math.pow(2,-52);$jscomp.number.MAX_SAFE_INTEGER=9007199254740991;$jscomp.number.MIN_SAFE_INTEGER=-9007199254740991;$jscomp.object=$jscomp.object||{};
$jscomp.object.assign=function(f,d){for(var h=[],l=1;l<arguments.length;++l)h[l-1]=arguments[l];h=$jscomp.makeIterator(h);for(l=h.next();!l.done;l=h.next()){var l=l.value,b;for(b in l)Object.prototype.hasOwnProperty.call(l,b)&&(f[b]=l[b])}return f};$jscomp.object.is=function(f,d){return f===d?0!==f||1/f===1/d:f!==f&&d!==d};$jscomp.Set=function(f){f=void 0===f?[]:f;this.map_=new $jscomp.Map;if(f){f=$jscomp.makeIterator(f);for(var d=f.next();!d.done;d=f.next())this.add(d.value)}this.size=this.map_.size};
$jscomp.Set.checkBrowserConformance_=function(){var f=$jscomp.global.Set;if(!f||!f.prototype.entries||!Object.seal)return!1;var d=Object.seal({x:4}),f=new f($jscomp.makeIterator([d]));if(f.has(d)||1!=f.size||f.add(d)!=f||1!=f.size||f.add({x:4})!=f||2!=f.size)return!1;var f=f.entries(),h=f.next();if(h.done||h.value[0]!=d||h.value[1]!=d)return!1;h=f.next();return h.done||h.value[0]==d||4!=h.value[0].x||h.value[1]!=h.value[0]?!1:f.next().done};
$jscomp.Set.prototype.add=function(f){this.map_.set(f,f);this.size=this.map_.size;return this};$jscomp.Set.prototype["delete"]=function(f){f=this.map_["delete"](f);this.size=this.map_.size;return f};$jscomp.Set.prototype.clear=function(){this.map_.clear();this.size=0};$jscomp.Set.prototype.has=function(f){return this.map_.has(f)};$jscomp.Set.prototype.entries=function(){return this.map_.entries()};$jscomp.Set.prototype.values=function(){return this.map_.values()};
$jscomp.Set.prototype.forEach=function(f,d){var h=this;this.map_.forEach(function(l){return f.call(d,l,l,h)})};$jscomp.Set.ASSUME_NO_NATIVE=!1;$jscomp.Set$install=function(){!$jscomp.Set.ASSUME_NO_NATIVE&&$jscomp.Set.checkBrowserConformance_()?$jscomp.Set=$jscomp.global.Set:($jscomp.Map$install(),$jscomp.initSymbol(),$jscomp.initSymbolIterator(),$jscomp.Set.prototype[Symbol.iterator]=$jscomp.Set.prototype.values);$jscomp.Set$install=function(){}};$jscomp.string=$jscomp.string||{};
$jscomp.string.noRegExp_=function(f,d){if(f instanceof RegExp)throw new TypeError("First argument to String.prototype."+d+" must not be a regular expression");};
$jscomp.string.fromCodePoint=function(f){for(var d=[],h=0;h<arguments.length;++h)d[h-0]=arguments[h];for(var h="",d=$jscomp.makeIterator(d),l=d.next();!l.done;l=d.next()){l=l.value;l=+l;if(0>l||1114111<l||l!==Math.floor(l))throw new RangeError("invalid_code_point "+l);65535>=l?h+=String.fromCharCode(l):(l-=65536,h+=String.fromCharCode(l>>>10&1023|55296),h+=String.fromCharCode(l&1023|56320))}return h};
$jscomp.string.repeat=function(f){var d=this.toString();if(0>f||1342177279<f)throw new RangeError("Invalid count value");f|=0;for(var h="";f;)if(f&1&&(h+=d),f>>>=1)d+=d;return h};$jscomp.string.repeat$install=function(){String.prototype.repeat||(String.prototype.repeat=$jscomp.string.repeat)};
$jscomp.string.codePointAt=function(f){var d=this.toString(),h=d.length;f=Number(f)||0;if(0<=f&&f<h){f|=0;var l=d.charCodeAt(f);if(55296>l||56319<l||f+1===h)return l;f=d.charCodeAt(f+1);return 56320>f||57343<f?l:1024*(l-55296)+f+9216}};$jscomp.string.codePointAt$install=function(){String.prototype.codePointAt||(String.prototype.codePointAt=$jscomp.string.codePointAt)};
$jscomp.string.includes=function(f,d){d=void 0===d?0:d;$jscomp.string.noRegExp_(f,"includes");return-1!==this.toString().indexOf(f,d)};$jscomp.string.includes$install=function(){String.prototype.includes||(String.prototype.includes=$jscomp.string.includes)};
$jscomp.string.startsWith=function(f,d){d=void 0===d?0:d;$jscomp.string.noRegExp_(f,"startsWith");var h=this.toString();f+="";for(var l=h.length,b=f.length,a=Math.max(0,Math.min(d|0,h.length)),c=0;c<b&&a<l;)if(h[a++]!=f[c++])return!1;return c>=b};$jscomp.string.startsWith$install=function(){String.prototype.startsWith||(String.prototype.startsWith=$jscomp.string.startsWith)};
$jscomp.string.endsWith=function(f,d){$jscomp.string.noRegExp_(f,"endsWith");var h=this.toString();f+="";void 0===d&&(d=h.length);for(var l=Math.max(0,Math.min(d|0,h.length)),b=f.length;0<b&&0<l;)if(h[--l]!=f[--b])return!1;return 0>=b};$jscomp.string.endsWith$install=function(){String.prototype.endsWith||(String.prototype.endsWith=$jscomp.string.endsWith)};
(function(f){function d(l){if(h[l])return h[l].exports;var b=h[l]={exports:{},id:l,loaded:!1};f[l].call(b.exports,b,b.exports,d);b.loaded=!0;return b.exports}var h={};d.m=f;d.c=h;d.p="";return d(0)})([function(f,d,h){h(1);h(4);h(12);h(29);h(69);h(72);h(74);h(75);f.exports=h(77)},function(f,d,h){f=h(2);d.rpc=new f.RPC(self)},function(f,d,h){function l(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 b(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 a(a,c){if(!(a instanceof c))throw new TypeError("Cannot call a class as a function");}function c(a,c){g.set(a,c)}var e=function p(a,c,e){null===a&&(a=Function.prototype);var b=
Object.getOwnPropertyDescriptor(a,c);if(void 0===b)return a=Object.getPrototypeOf(a),null===a?void 0:p(a,c,e);if("value"in b)return b.value;c=b.get;return void 0===c?void 0:c.call(e)},n=function(){function a(c,e){for(var b=0;b<e.length;b++){var n=e[b];n.enumerable=n.enumerable||!1;n.configurable=!0;"value"in n&&(n.writable=!0);Object.defineProperty(c,n.key,n)}}return function(c,e,b){e&&a(c.prototype,e);b&&a(c,b);return c}}();f=h(3);var g=new Map;d.registerRPC=c;h=function(){function c(e){var b=this;
a(this,c);this.target=e;this.objects=new Map;this.nextId=-1;e.onmessage=function(a){a=a.data;g.get(a.functionName).call(b,a)}}n(c,[{key:"set",value:function(a,c){this.objects.set(a,c)}},{key:"delete",value:function(a){this.objects.delete(a)}},{key:"get",value:function(a){return this.objects.get(a)}},{key:"getRef",value:function(a){var c=this.get(a.id);c.referencedGeneration=a.gen;c.addRef();return c}},{key:"invoke",value:function(a,c,e){c.functionName=a;this.target.postMessage(c,e)}},{key:"newId",
value:function(){return this.nextId--}},{key:"numObjects",get:function(){return this.objects.size}}]);return c}();d.RPC=h;f=function(c){function g(){a(this,g);for(var c=arguments.length,e=Array(c),b=0;b<c;b++)e[b]=arguments[b];var n,c=l(this,(n=Object.getPrototypeOf(g)).call.apply(n,[].concat([this],$jscomp.arrayFromIterable(e))));c.rpc=null;c.rpcId=null;return c}b(g,c);n(g,[{key:"initializeSharedObject",value:function(a){var c=1>=arguments.length||void 0===arguments[1]?a.newId():arguments[1];this.rpc=
a;this.rpcId=c;this.isOwner=!1;a.set(c,this)}},{key:"initializeCounterpart",value:function(a){var c=1>=arguments.length||void 0===arguments[1]?{}:arguments[1];this.initializeSharedObject(a);this.referencedGeneration=this.unreferencedGeneration=0;this.isOwner=!0;c.id=this.rpcId;a.invoke("SharedObject.new",c)}},{key:"dispose",value:function(){e(Object.getPrototypeOf(g.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}):e(Object.getPrototypeOf(g.prototype),"refCountReachedZero",this).call(this)}},{key:"ownerDispose",value:function(){var a=this.rpc,c=this.rpcId;e(Object.getPrototypeOf(g.prototype),"refCountReachedZero",this).call(this);a.delete(c);a.invoke("SharedObject.dispose",
{id:c})}},{key:"counterpartRefCountReachedZero",value:function(a){this.unreferencedGeneration=a;0===this.refCount&&a===this.referencedGeneration&&this.ownerDispose()}}]);return g}(f.RefCounted);d.SharedObject=f;f=function(c){function e(c){var b=1>=arguments.length||void 0===arguments[1]?{}:arguments[1];a(this,e);var n=l(this,Object.getPrototypeOf(e).call(this));null!=c&&n.initializeSharedObject(c,b.id);return n}b(e,c);return e}(f);d.SharedObjectCounterpart=f;c("SharedObject.dispose",function(a){a=
this.get(a.id);if(0!==a.refCount)throw Error("Attempted to dispose object with non-zero reference count.");a.disposed();this.delete(a.rpcId);a.rpcId=null;a.rpc=null});c("SharedObject.refCountReachedZero",function(a){this.get(a.id).counterpartRefCountReachedZero(a.gen)});var m=new Map;d.registerSharedObject=function(a,c){m.set(a,c)};c("SharedObject.new",function(a){--(new (m.get(a.type))(this,a)).refCount})},function(f,d){var h=function(){function b(a,c){for(var e=0;e<c.length;e++){var b=c[e];b.enumerable=
b.enumerable||!1;b.configurable=!0;"value"in b&&(b.writable=!0);Object.defineProperty(a,b.key,b)}}return function(a,c,e){c&&b(a.prototype,c);e&&b(a,e);return a}}(),l=function(){function b(){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");this.refCount=1}h(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 c=a.length;0<c;--c){var e=a[c-1];"object"===typeof e?e.dispose():e.call(this)}this.disposers=void 0}}},{key:"disposed",value:function(){}},{key:"registerDisposer",value:function(a){var c=this.disposers;null==c?this.disposers=[a]:c.push(a);return a}},{key:"unregisterDisposer",value:function(a){var c=this.disposers;if(null!=c){var e=c.indexOf(a);-1!==e&&c.splice(e,1)}return a}},{key:"registerSignalBinding",value:function(a){this.registerDisposer(function(){return a.detach()})}},
{key:"registerEventListener",value:function(a,c,e,b){a.addEventListener(c,e,b);this.registerDisposer(function(){return a.removeEventListener(c,e,b)})}}]);return b}();d.RefCounted=l},function(f,d,h){function l(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 b(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 a(a,c){if(!(a instanceof c))throw new TypeError("Cannot call a class as a function");}function c(a){return new C(new p.default(a),z.default)}function e(a,c,e,b,n,g){for(;1>c.availableItems||c.availableSize<a;){var m=n.next().value;if(void 0===m)return!1;var k=m.priorityTier;if(k<e||k===e&&m.priority>=b)return!1;g(m)}return!0}
var n=function(){function a(c,e){for(var b=0;b<e.length;b++){var n=e[b];n.enumerable=n.enumerable||!1;n.configurable=!0;"value"in n&&(n.writable=!0);Object.defineProperty(c,n.key,n)}}return function(c,e,b){e&&a(c.prototype,e);b&&a(c,b);return c}}(),g=h(5);f=h(2);var m=h(6),k=h(7),p=h(8),r=h(9),z=h(10),D=h(1),w=h(11),q=function(){function c(){a(this,c);this.key=this.source=this.prev1=this.next1=this.child1=this.prev0=this.next0=this.child0=null;this.state=g.ChunkState.NEW;this.newPriority=this.priority=
0;this.newPriorityTier=this.priorityTier=g.ChunkPriorityTier.RECENT;this.backendOnly=!1;this.cancelDownload=null}n(c,[{key:"initialize",value:function(a){this.key=a;this.state=g.ChunkState.NEW;this.priority=Number.NEGATIVE_INFINITY;this.priorityTier=g.ChunkPriorityTier.RECENT;this.newPriority=Number.NEGATIVE_INFINITY;this.newPriorityTier=g.ChunkPriorityTier.RECENT}},{key:"updatePriorityProperties",value:function(){this.priorityTier=this.newPriorityTier;this.priority=this.newPriority;this.newPriorityTier=
g.ChunkPriorityTier.RECENT;this.newPriority=Number.NEGATIVE_INFINITY}},{key:"dispose",value:function(){this.source=null}},{key:"downloadFailed",value:function(){this.queueManager.updateChunkState(this,g.ChunkState.FAILED)}},{key:"downloadSucceeded",value:function(){this.queueManager.updateChunkState(this,g.ChunkState.SYSTEM_MEMORY_WORKER)}},{key:"freeSystemMemory",value:function(){}},{key:"serialize",value:function(a,c){a.id=this.key;a.source=this.source.rpcId;a["new"]=!0}},{key:"toString",value:function(){return this.key}},
{key:"chunkManager",get:function(){return this.source.chunkManager}},{key:"queueManager",get:function(){return this.source.chunkManager.queueManager}}],[{key:"priorityLess",value:function(a,c){return a.priority<c.priority}},{key:"priorityGreater",value:function(a,c){return a.priority>c.priority}}]);return c}();d.Chunk=q;h=function(c){function e(c,b){a(this,e);var n=l(this,Object.getPrototypeOf(e).call(this,c,b));n.chunks=new Map;n.freeChunks=[];n.chunkManager=c.get(b.chunkManager);return n}b(e,c);
n(e,[{key:"getNewChunk_",value:function(a){var c=this.freeChunks,e=c.length;if(0<e)return a=c[e-1],c.length=e-1,a.source=this,a;c=new a;c.source=this;return c}},{key:"download",value:function(a){}},{key:"addChunk",value:function(a){var c=this.chunks;0===c.size&&this.addRef();c.set(a.key,a)}},{key:"removeChunk",value:function(a){var c=this.chunks,e=this.freeChunks;c.delete(a.key);a.dispose();e[e.length]=a;0===c.size&&this.dispose()}}]);return e}(f.SharedObjectCounterpart);d.ChunkSource=h;d.handleChunkDownloadPromise=
function(a,c,e){a.cancelDownload=function(){a.cancelDownload=null;w.cancelPromise(c)};c.then(function(c){if(null!==a.cancelDownload){a.cancelDownload=null;try{e.call(void 0,a,c),a.downloadSucceeded()}catch(b){console.log("Failed to decode chunk "+a+": "+b),a.downloadFailed()}}},function(c){null!==a.cancelDownload&&(a.cancelDownload=null,a.downloadFailed(),console.log("Download failed for chunk "+a))})};var u;(function(a){a[a.MIN=0]="MIN";a[a.MAX=1]="MAX"})(u||(u={}));var C=function(){function c(e,
b){a(this,c);this.heapOperations=e;this.linkedListOperations=b;this.heapRoots=[null,null];this.recentHead=new q;b.initializeHead(this.recentHead)}n(c,[{key:"add",value:function(a){var c=a.priorityTier;if(c===g.ChunkPriorityTier.RECENT)this.linkedListOperations.insertAfter(this.recentHead,a);else{var e=this.heapRoots;e[c]=this.heapOperations.meld(e[c],a)}}},{key:"candidates",value:function(){function a(L,C){for(;;)switch(c){case 0:if(h.heapOperations.compare!==q.priorityLess){c=1;break}f=h.linkedListOperations;
z=h.recentHead;case 3:u=f.back(z);if(null!=u){c=5;break}c=4;break;case 5:return c=7,{value:u,done:!1};case 7:if(void 0===C){c=8;break}c=-1;throw C;case 8:case 6:c=3;break;case 4:d=h.heapRoots,r=g.ChunkPriorityTier.LAST_ORDERED_TIER;case 9:if(!(r>=g.ChunkPriorityTier.FIRST_ORDERED_TIER)){c=11;break}case 12:p=d[r];if(null!=p){c=14;break}c=13;break;case 14:return c=16,{value:p,done:!1};case 16:if(void 0===C){c=17;break}c=-1;throw C;case 17:case 15:c=12;break;case 13:case 10:--r;c=9;break;case 11:c=2;
break;case 1:y=h.heapRoots,k=g.ChunkPriorityTier.FIRST_ORDERED_TIER;case 18:if(!(k<=g.ChunkPriorityTier.LAST_ORDERED_TIER)){c=20;break}case 21:m=y[k];if(null!=m){c=23;break}c=22;break;case 23:return c=25,{value:m,done:!1};case 25:if(void 0===C){c=26;break}c=-1;throw C;case 26:case 24:c=21;break;case 22:case 19:++k;c=18;break;case 20:n=h.linkedListOperations,b=h.recentHead;case 27:e=n.front(b);if(null!=e){c=29;break}c=28;break;case 29:return c=31,{value:e,done:!1};case 31:if(void 0===C){c=32;break}c=
-1;throw C;case 32:case 30:c=27;break;case 28:case 2:c=-1;default:return{value:void 0,done:!0}}}var c=0,e,b,n,m,k,y,p,r,d,u,z,f,h=this,L={next:function(c){return a(c,void 0)},throw:function(c){return a(void 0,c)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();L[Symbol.iterator]=function(){return this};return L}},{key:"delete",value:function(a){var c=a.priorityTier;if(c===g.ChunkPriorityTier.RECENT)this.linkedListOperations.pop(a);else{var e=this.heapRoots;e[c]=
this.heapOperations.remove(e[c],a)}}}]);return c}();u=function(m){function p(e,b){a(this,p);var n=l(this,Object.getPrototypeOf(p).call(this,e,b));n.queuedPromotionQueue=c(q.priorityGreater);n.downloadEvictionQueue=c(q.priorityLess);n.systemMemoryEvictionQueue=new C(new k.default(q.priorityLess),r.default);n.gpuMemoryPromotionQueue=c(q.priorityGreater);n.gpuMemoryEvictionQueue=c(q.priorityLess);n.updatePending=null;n.numQueued=0;n.numFailed=0;n.gpuMemoryCapacity=g.AvailableCapacity.fromObject(b.gpuMemoryCapacity);
n.systemMemoryCapacity=g.AvailableCapacity.fromObject(b.systemMemoryCapacity);n.downloadCapacity=g.AvailableCapacity.fromObject(b.downloadCapacity);return n}b(p,m);n(p,[{key:"scheduleUpdate",value:function(){null===this.updatePending&&(this.updatePending=setTimeout(this.process.bind(this),0))}},{key:"chunkQueuesForChunk",value:function(a){function c(k,y){for(;;)switch(e){case 0:n=!1;b=a.state;if(!n&&b!==g.ChunkState.QUEUED){e=2;break}n=!0;e=3;return{value:m.queuedPromotionQueue,done:!1};case 3:if(void 0===
y){e=4;break}e=-1;throw y;case 4:e=1;break;case 2:if(!n&&b!==g.ChunkState.DOWNLOADING){e=5;break}n=!0;e=6;return{value:m.downloadEvictionQueue,done:!1};case 6:if(void 0===y){e=7;break}e=-1;throw y;case 7:return e=8,{value:m.systemMemoryEvictionQueue,done:!1};case 8:if(void 0===y){e=9;break}e=-1;throw y;case 9:e=1;break;case 5:if(n||b===g.ChunkState.SYSTEM_MEMORY_WORKER)n=!0;if(!n&&b!==g.ChunkState.SYSTEM_MEMORY){e=10;break}n=!0;e=11;return{value:m.systemMemoryEvictionQueue,done:!1};case 11:if(void 0===
y){e=12;break}e=-1;throw y;case 12:if(a.priorityTier===g.ChunkPriorityTier.RECENT||a.backendOnly){e=13;break}e=14;return{value:m.gpuMemoryPromotionQueue,done:!1};case 14:if(void 0===y){e=15;break}e=-1;throw y;case 15:case 13:e=1;break;case 10:if(!n&&b!==g.ChunkState.GPU_MEMORY){e=16;break}n=!0;e=17;return{value:m.systemMemoryEvictionQueue,done:!1};case 17:if(void 0===y){e=18;break}e=-1;throw y;case 18:return e=19,{value:m.gpuMemoryEvictionQueue,done:!1};case 19:if(void 0===y){e=20;break}e=-1;throw y;
case 20:e=1;break;case 16:case 1:e=-1;default:return{value:void 0,done:!0}}}var e=0,b,n,m=this,k={next:function(a){return c(a,void 0)},throw:function(a){return c(void 0,a)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();k[Symbol.iterator]=function(){return this};return k}},{key:"adjustCapacitiesForChunk",value:function(a,c){var e=c?-1:1;switch(a.state){case g.ChunkState.FAILED:this.numFailed-=e;break;case g.ChunkState.QUEUED:this.numQueued-=e;break;case g.ChunkState.DOWNLOADING:this.downloadCapacity.adjust(e,
0);this.systemMemoryCapacity.adjust(e,0);break;case g.ChunkState.SYSTEM_MEMORY:case g.ChunkState.SYSTEM_MEMORY_WORKER:this.systemMemoryCapacity.adjust(e,e*a.systemMemoryBytes);break;case g.ChunkState.GPU_MEMORY:this.systemMemoryCapacity.adjust(e,e*a.systemMemoryBytes),this.gpuMemoryCapacity.adjust(e,e*a.gpuMemoryBytes)}}},{key:"removeChunkFromQueues_",value:function(a){for(var c=$jscomp.makeIterator(this.chunkQueuesForChunk(a)),e=c.next();!e.done;e=c.next())e.value.delete(a)}},{key:"addChunkToQueues_",
value:function(a){if(a.state===g.ChunkState.QUEUED&&a.priorityTier===g.ChunkPriorityTier.RECENT)return a.source.removeChunk(a),this.adjustCapacitiesForChunk(a,!1),!1;for(var c=$jscomp.makeIterator(this.chunkQueuesForChunk(a)),e=c.next();!e.done;e=c.next())e.value.add(a);return!0}},{key:"performChunkPriorityUpdate",value:function(a){a.priorityTier===a.newPriorityTier&&a.priority===a.newPriority?(a.newPriorityTier=g.ChunkPriorityTier.RECENT,a.newPriority=Number.NEGATIVE_INFINITY):(this.removeChunkFromQueues_(a),
a.updatePriorityProperties(),a.state===g.ChunkState.NEW&&(a.state=g.ChunkState.QUEUED,this.adjustCapacitiesForChunk(a,!0)),this.addChunkToQueues_(a))}},{key:"updateChunkState",value:function(a,c){c!==a.state&&(this.adjustCapacitiesForChunk(a,!1),this.removeChunkFromQueues_(a),a.state=c,this.adjustCapacitiesForChunk(a,!0),this.addChunkToQueues_(a),this.scheduleUpdate())}},{key:"processGPUPromotions_",value:function(){function a(e){c.freeChunkGPUMemory(e);e.source.chunkManager.queueManager.updateChunkState(e,
g.ChunkState.SYSTEM_MEMORY)}for(var c=this,b=this.gpuMemoryPromotionQueue.candidates(),n=this.gpuMemoryEvictionQueue.candidates(),m=this.gpuMemoryCapacity;;){var k=b.next().value;if(void 0===k)break;else{if(!e(k.gpuMemoryBytes,m,k.priorityTier,k.priority,n,a))break;this.copyChunkToGPU(k);this.updateChunkState(k,g.ChunkState.GPU_MEMORY)}}}},{key:"freeChunkGPUMemory",value:function(a){D.rpc.invoke("Chunk.update",{id:a.key,state:g.ChunkState.SYSTEM_MEMORY,source:a.source.rpcId})}},{key:"freeChunkSystemMemory",
value:function(a){a.state===g.ChunkState.SYSTEM_MEMORY_WORKER?D.rpc.invoke("Chunk.update",{id:a.key,state:g.ChunkState.EXPIRED,source:a.source.rpcId}):a.freeSystemMemory()}},{key:"copyChunkToGPU",value:function(a){if(a.state===g.ChunkState.SYSTEM_MEMORY)D.rpc.invoke("Chunk.update",{id:a.key,source:a.source.rpcId,state:g.ChunkState.GPU_MEMORY});else{var c={},e=[];a.serialize(c,e);c.state=g.ChunkState.GPU_MEMORY;D.rpc.invoke("Chunk.update",c,e)}}},{key:"processQueuePromotions_",value:function(){function a(e){switch(e.state){case g.ChunkState.DOWNLOADING:e.cancelDownload();
break;case g.ChunkState.GPU_MEMORY:c.freeChunkGPUMemory(e);case g.ChunkState.SYSTEM_MEMORY_WORKER:case g.ChunkState.SYSTEM_MEMORY:c.freeChunkSystemMemory(e)}e.source.chunkManager.queueManager.updateChunkState(e,g.ChunkState.QUEUED)}for(var c=this,b=this.queuedPromotionQueue.candidates(),n=this.downloadEvictionQueue.candidates(),m=this.systemMemoryEvictionQueue.candidates(),k=this.downloadCapacity,y=this.systemMemoryCapacity;;){var p=b.next();if(p.done)break;var p=p.value,r=p.priorityTier,d=p.priority;
if(!e(0,k,r,d,n,a))break;if(!e(0,y,r,d,m,a))break;this.updateChunkState(p,g.ChunkState.DOWNLOADING);p.source.download(p)}}},{key:"process",value:function(){this.updatePending&&(this.updatePending=null,this.processGPUPromotions_(),this.processQueuePromotions_(),this.logStatistics())}},{key:"logStatistics",value:function(){}}]);return p}(f.SharedObjectCounterpart);d.ChunkQueueManager=u;f.registerSharedObject("ChunkQueueManager",u);u=function(c){function e(c,b){a(this,e);var n=l(this,Object.getPrototypeOf(e).call(this,
c,b));n.existingTierChunks=[];n.newTierChunks=[];n.updatePending=null;n.recomputeChunkPriorities=new m.Signal;n.queueManager=c.get(b.chunkQueueManager).addRef();for(var k=g.ChunkPriorityTier.FIRST_TIER;k<=g.ChunkPriorityTier.LAST_TIER;++k)k!==g.ChunkPriorityTier.RECENT&&(n.existingTierChunks[k]=[]);return n}b(e,c);n(e,[{key:"scheduleUpdateChunkPriorities",value:function(){null===this.updatePending&&(this.updatePending=setTimeout(this.recomputeChunkPriorities_.bind(this),0))}},{key:"recomputeChunkPriorities_",
value:function(){this.updatePending=null;this.recomputeChunkPriorities.dispatch();this.updateQueueState([g.ChunkPriorityTier.VISIBLE])}},{key:"requestChunk",value:function(a,c,e){a.newPriorityTier===g.ChunkPriorityTier.RECENT&&this.newTierChunks.push(a);a.newPriorityTier=c;a.newPriority=e}},{key:"updateQueueState",value:function(a){var c=this.existingTierChunks,e=this.queueManager;a=$jscomp.makeIterator(a);for(var b=a.next();!b.done;b=a.next()){for(var b=c[b.value],n=$jscomp.makeIterator(b),m=n.next();!m.done;m=
n.next())m=m.value,m.newPriorityTier===g.ChunkPriorityTier.RECENT&&e.performChunkPriorityUpdate(m);b.length=0}a=this.newTierChunks;b=$jscomp.makeIterator(a);for(n=b.next();!n.done;n=b.next())n=n.value,e.performChunkPriorityUpdate(n),c[n.priorityTier].push(n);a.length=0;this.queueManager.scheduleUpdate()}}]);return e}(f.SharedObjectCounterpart);d.ChunkManager=u;f.registerSharedObject("ChunkManager",u)},function(f,d){var h=function(){function b(a,c){for(var e=0;e<c.length;e++){var b=c[e];b.enumerable=
b.enumerable||!1;b.configurable=!0;"value"in b&&(b.writable=!0);Object.defineProperty(a,b.key,b)}}return function(a,c,e){c&&b(a.prototype,c);e&&b(a,e);return a}}();(function(b){b[b.GPU_MEMORY=0]="GPU_MEMORY";b[b.SYSTEM_MEMORY=1]="SYSTEM_MEMORY";b[b.SYSTEM_MEMORY_WORKER=2]="SYSTEM_MEMORY_WORKER";b[b.DOWNLOADING=3]="DOWNLOADING";b[b.QUEUED=4]="QUEUED";b[b.NEW=5]="NEW";b[b.FAILED=6]="FAILED";b[b.EXPIRED=7]="EXPIRED"})(d.ChunkState||(d.ChunkState={}));(function(b){b[b.FIRST_TIER=0]="FIRST_TIER";b[b.FIRST_ORDERED_TIER=
0]="FIRST_ORDERED_TIER";b[b.VISIBLE=0]="VISIBLE";b[b.PREFETCH=1]="PREFETCH";b[b.LAST_ORDERED_TIER=1]="LAST_ORDERED_TIER";b[b.RECENT=2]="RECENT";b[b.LAST_TIER=2]="LAST_TIER"})(d.ChunkPriorityTier||(d.ChunkPriorityTier={}));var l=function(){function b(a,c){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");this.itemCapacity=this.availableItems=a;this.sizeCapacity=this.availableSize=c}h(b,[{key:"adjust",value:function(a,c){this.availableItems+=a;this.availableSize+=c}},
{key:"toString",value:function(){return this.availableItems+"/"+this.itemCapacity+" items, "+this.availableSize+"/"+this.sizeCapacity+" size"}},{key:"toObject",value:function(){return{itemCapacity:this.itemCapacity,sizeCapacity:this.sizeCapacity}}}],[{key:"fromObject",value:function(a){return new b(a.itemCapacity,a.sizeCapacity)}}]);return b}();l.INFINITE=new l(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY);d.AvailableCapacity=l},function(f,d,h){var l;(function(b){function a(a,c,e,b,p){this._listener=
c;this._isOnce=e;this.context=b;this._signal=a;this._priority=p||0}function c(a,c){if("function"!==typeof a)throw Error("listener is a required param of {fn}() and should be a Function.".replace("{fn}",c));}function e(){this._bindings=[];this._prevParams=null;var a=this;this.dispatch=function(){e.prototype.dispatch.apply(a,arguments)}}a.prototype={active:!0,params:null,execute:function(a){var c;this.active&&this._listener&&(a=this.params?this.params.concat(a):a,c=this._listener.apply(this.context,
a),this._isOnce&&this.detach());return c},detach:function(){return this.isBound()?this._signal.remove(this._listener,this.context):null},isBound:function(){return!!this._signal&&!!this._listener},isOnce:function(){return this._isOnce},getListener:function(){return this._listener},getSignal:function(){return this._signal},_destroy:function(){delete this._signal;delete this._listener;delete this.context},toString:function(){return"[SignalBinding isOnce:"+this._isOnce+", isBound:"+this.isBound()+", active:"+
this.active+"]"}};e.prototype={VERSION:"1.0.0",memorize:!1,_shouldPropagate:!0,active:!0,_registerListener:function(c,e,b,k){var p=this._indexOfListener(c,b);if(-1!==p){if(c=this._bindings[p],c.isOnce()!==e)throw Error("You cannot add"+(e?"":"Once")+"() then add"+(e?"Once":"")+"() the same listener without removing the relationship first.");}else c=new a(this,c,e,b,k),this._addBinding(c);this.memorize&&this._prevParams&&c.execute(this._prevParams);return c},_addBinding:function(a){var c=this._bindings.length;
do--c;while(this._bindings[c]&&a._priority<=this._bindings[c]._priority);this._bindings.splice(c+1,0,a)},_indexOfListener:function(a,c){for(var e=this._bindings.length,b;e--;)if(b=this._bindings[e],b._listener===a&&b.context===c)return e;return-1},has:function(a,c){return-1!==this._indexOfListener(a,c)},add:function(a,e,b){c(a,"add");return this._registerListener(a,!1,e,b)},addOnce:function(a,e,b){c(a,"addOnce");return this._registerListener(a,!0,e,b)},remove:function(a,e){c(a,"remove");var b=this._indexOfListener(a,
e);-1!==b&&(this._bindings[b]._destroy(),this._bindings.splice(b,1));return a},removeAll:function(){for(var a=this._bindings.length;a--;)this._bindings[a]._destroy();this._bindings.length=0},getNumListeners:function(){return this._bindings.length},halt:function(){this._shouldPropagate=!1},dispatch:function(a){if(this.active){var c=Array.prototype.slice.call(arguments),e=this._bindings.length,b;this.memorize&&(this._prevParams=c);if(e){b=this._bindings.slice();this._shouldPropagate=!0;do e--;while(b[e]&&
this._shouldPropagate&&!1!==b[e].execute(c))}}},forget:function(){this._prevParams=null},dispose:function(){this.removeAll();delete this._bindings;delete this._prevParams},toString:function(){return"[Signal active:"+this.active+" numListeners:"+this.getNumListeners()+"]"}};e.Signal=e;!(l=function(){return e}.call(d,h,d,f),void 0!==l&&(f.exports=l))})(this)},function(f,d){var h=function(){function b(a,c){for(var e=0;e<c.length;e++){var b=c[e];b.enumerable=b.enumerable||!1;b.configurable=!0;"value"in
b&&(b.writable=!0);Object.defineProperty(a,b.key,b)}}return function(a,c,e){c&&b(a.prototype,c);e&&b(a,e);return a}}(),l=function(){function b(a){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");this.compare=a}h(b,[{key:"meld",value:function(a,c){if(null===c)return a;if(null===a)return c;var e=this.compare;e(c,a)&&(e=a,a=c,c=e);e=a.child0;c.next0=e;c.prev0=a;null!==e&&(e.prev0=c);a.child0=c;return a}},{key:"combineChildren",value:function(a){var c=a.child0;if(null===
c)return null;for(a=null;;){var e=c.next0,b=void 0,g=void 0;null===e?(b=null,g=c):(b=e.next0,g=this.meld(c,e));g.next0=a;a=g;if(null===b)break;c=b}c=a;for(a=a.next0;null!==a;)e=a.next0,c=this.meld(c,a),a=e;c.prev0=null;c.next0=null;return c}},{key:"removeMin",value:function(a){var c=this.combineChildren(a);a.next0=null;a.prev0=null;a.child0=null;return c}},{key:"remove",value:function(a,c){if(a===c)return this.removeMin(a);var e=c.prev0,b=c.next0;e.child0===c?e.child0=b:e.next0=b;null!==b&&(b.prev0=
e);e=this.meld(a,this.combineChildren(c));c.next0=null;c.prev0=null;c.child0=null;return e}},{key:"entries",value:function(a){function c(c,r){for(;;)switch(e){case 0:if(null===a){e=1;break}k=a.child0;e=2;return{value:a,done:!1};case 2:if(void 0===r){e=3;break}e=-1;throw r;case 3:case 4:if(null===k){e=5;break}m=k.next0;g=$jscomp.makeIterator(p.entries(k));case 6:if((b=g.next(c)).done){e=7;break}e=8;return{value:b.value,done:!1};case 8:if(void 0===r){e=9;break}e=-1;throw r;case 9:e=6;break;case 7:k=
m;e=4;break;case 5:case 1:e=-1;default:return{value:void 0,done:!0}}}var e=0,b,g,m,k,p=this,r={next:function(a){return c(a,void 0)},throw:function(a){return c(void 0,a)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();r[Symbol.iterator]=function(){return this};return r}},{key:"removedEntries",value:function(a){function c(c,r){for(;;)switch(e){case 0:if(null===a){e=1;break}k=a.child0;a.child0=null;a.next0=null;a.prev0=null;e=2;return{value:a,done:!1};case 2:if(void 0===
r){e=3;break}e=-1;throw r;case 3:case 4:if(null===k){e=5;break}m=k.next0;k.child0=null;k.next0=null;k.prev0=null;g=$jscomp.makeIterator(p.entries(k));case 6:if((b=g.next(c)).done){e=7;break}e=8;return{value:b.value,done:!1};case 8:if(void 0===r){e=9;break}e=-1;throw r;case 9:e=6;break;case 7:k=m;e=4;break;case 5:case 1:e=-1;default:return{value:void 0,done:!0}}}var e=0,b,g,m,k,p=this,r={next:function(a){return c(a,void 0)},throw:function(a){return c(void 0,a)},return:function(a){throw Error("Not yet implemented");
}};$jscomp.initSymbolIterator();r[Symbol.iterator]=function(){return this};return r}}]);return b}();Object.defineProperty(d,"__esModule",{value:!0});d.default=l},function(f,d){var h=function(){function b(a,c){for(var e=0;e<c.length;e++){var b=c[e];b.enumerable=b.enumerable||!1;b.configurable=!0;"value"in b&&(b.writable=!0);Object.defineProperty(a,b.key,b)}}return function(a,c,e){c&&b(a.prototype,c);e&&b(a,e);return a}}(),l=function(){function b(a){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");
this.compare=a}h(b,[{key:"meld",value:function(a,c){if(null===c)return a;if(null===a)return c;var e=this.compare;e(c,a)&&(e=a,a=c,c=e);e=a.child1;c.next1=e;c.prev1=a;null!==e&&(e.prev1=c);a.child1=c;return a}},{key:"combineChildren",value:function(a){var c=a.child1;if(null===c)return null;for(a=null;;){var e=c.next1,b=void 0,g=void 0;null===e?(b=null,g=c):(b=e.next1,g=this.meld(c,e));g.next1=a;a=g;if(null===b)break;c=b}c=a;for(a=a.next1;null!==a;)e=a.next1,c=this.meld(c,a),a=e;c.prev1=null;c.next1=
null;return c}},{key:"removeMin",value:function(a){var c=this.combineChildren(a);a.next1=null;a.prev1=null;a.child1=null;return c}},{key:"remove",value:function(a,c){if(a===c)return this.removeMin(a);var e=c.prev1,b=c.next1;e.child1===c?e.child1=b:e.next1=b;null!==b&&(b.prev1=e);e=this.meld(a,this.combineChildren(c));c.next1=null;c.prev1=null;c.child1=null;return e}},{key:"entries",value:function(a){function c(c,r){for(;;)switch(e){case 0:if(null===a){e=1;break}k=a.child1;e=2;return{value:a,done:!1};
case 2:if(void 0===r){e=3;break}e=-1;throw r;case 3:case 4:if(null===k){e=5;break}m=k.next1;g=$jscomp.makeIterator(p.entries(k));case 6:if((b=g.next(c)).done){e=7;break}e=8;return{value:b.value,done:!1};case 8:if(void 0===r){e=9;break}e=-1;throw r;case 9:e=6;break;case 7:k=m;e=4;break;case 5:case 1:e=-1;default:return{value:void 0,done:!0}}}var e=0,b,g,m,k,p=this,r={next:function(a){return c(a,void 0)},throw:function(a){return c(void 0,a)},return:function(a){throw Error("Not yet implemented");}};
$jscomp.initSymbolIterator();r[Symbol.iterator]=function(){return this};return r}},{key:"removedEntries",value:function(a){function c(c,r){for(;;)switch(e){case 0:if(null===a){e=1;break}k=a.child1;a.child1=null;a.next1=null;a.prev1=null;e=2;return{value:a,done:!1};case 2:if(void 0===r){e=3;break}e=-1;throw r;case 3:case 4:if(null===k){e=5;break}m=k.next1;k.child1=null;k.next1=null;k.prev1=null;g=$jscomp.makeIterator(p.entries(k));case 6:if((b=g.next(c)).done){e=7;break}e=8;return{value:b.value,done:!1};
case 8:if(void 0===r){e=9;break}e=-1;throw r;case 9:e=6;break;case 7:k=m;e=4;break;case 5:case 1:e=-1;default:return{value:void 0,done:!0}}}var e=0,b,g,m,k,p=this,r={next:function(a){return c(a,void 0)},throw:function(a){return c(void 0,a)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();r[Symbol.iterator]=function(){return this};return r}}]);return b}();Object.defineProperty(d,"__esModule",{value:!0});d.default=l},function(f,d){var h=function(){function b(a,
c){for(var e=0;e<c.length;e++){var b=c[e];b.enumerable=b.enumerable||!1;b.configurable=!0;"value"in b&&(b.writable=!0);Object.defineProperty(a,b.key,b)}}return function(a,c,e){c&&b(a.prototype,c);e&&b(a,e);return a}}(),l=function(){function b(){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");}h(b,null,[{key:"insertAfter",value:function(a,c){var e=a.next0;c.next0=e;c.prev0=a;a.next0=c;e.prev0=c}},{key:"insertBefore",value:function(a,c){var e=a.prev0;c.prev0=e;c.next0=
a;a.prev0=c;e.next0=c}},{key:"front",value:function(a){var c=a.next0;return c===a?null:c}},{key:"back",value:function(a){var c=a.prev0;return c===a?null:c}},{key:"pop",value:function(a){var c=a.next0,e=a.prev0;c.prev0=e;e.next0=c;a.next0=null;a.prev0=null;return a}},{key:"iterator",value:function(a){function c(c,g){for(;;)switch(e){case 0:b=a.next0;case 1:if(b===a){e=3;break}e=4;return{value:b,done:!1};case 4:if(void 0===g){e=5;break}e=-1;throw g;case 5:case 2:b=b.next0;e=1;break;case 3:e=-1;default:return{value:void 0,
done:!0}}}var e=0,b,g={next:function(a){return c(a,void 0)},throw:function(a){return c(void 0,a)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();g[Symbol.iterator]=function(){return this};return g}},{key:"reverseIterator",value:function(a){function c(c,g){for(;;)switch(e){case 0:b=a.prev0;case 1:if(b===a){e=3;break}e=4;return{value:b,done:!1};case 4:if(void 0===g){e=5;break}e=-1;throw g;case 5:case 2:b=b.prev0;e=1;break;case 3:e=-1;default:return{value:void 0,
done:!0}}}var e=0,b,g={next:function(a){return c(a,void 0)},throw:function(a){return c(void 0,a)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();g[Symbol.iterator]=function(){return this};return g}},{key:"initializeHead",value:function(a){a.next0=a.prev0=a}}]);return b}();Object.defineProperty(d,"__esModule",{value:!0});d.default=l},function(f,d){var h=function(){function b(a,c){for(var e=0;e<c.length;e++){var b=c[e];b.enumerable=b.enumerable||!1;b.configurable=
!0;"value"in b&&(b.writable=!0);Object.defineProperty(a,b.key,b)}}return function(a,c,e){c&&b(a.prototype,c);e&&b(a,e);return a}}(),l=function(){function b(){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");}h(b,null,[{key:"insertAfter",value:function(a,c){var e=a.next1;c.next1=e;c.prev1=a;a.next1=c;e.prev1=c}},{key:"insertBefore",value:function(a,c){var e=a.prev1;c.prev1=e;c.next1=a;a.prev1=c;e.next1=c}},{key:"front",value:function(a){var c=a.next1;return c===a?null:
c}},{key:"back",value:function(a){var c=a.prev1;return c===a?null:c}},{key:"pop",value:function(a){var c=a.next1,e=a.prev1;c.prev1=e;e.next1=c;a.next1=null;a.prev1=null;return a}},{key:"iterator",value:function(a){function c(c,g){for(;;)switch(e){case 0:b=a.next1;case 1:if(b===a){e=3;break}e=4;return{value:b,done:!1};case 4:if(void 0===g){e=5;break}e=-1;throw g;case 5:case 2:b=b.next1;e=1;break;case 3:e=-1;default:return{value:void 0,done:!0}}}var e=0,b,g={next:function(a){return c(a,void 0)},throw:function(a){return c(void 0,
a)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();g[Symbol.iterator]=function(){return this};return g}},{key:"reverseIterator",value:function(a){function c(c,g){for(;;)switch(e){case 0:b=a.prev1;case 1:if(b===a){e=3;break}e=4;return{value:b,done:!1};case 4:if(void 0===g){e=5;break}e=-1;throw g;case 5:case 2:b=b.prev1;e=1;break;case 3:e=-1;default:return{value:void 0,done:!0}}}var e=0,b,g={next:function(a){return c(a,void 0)},throw:function(a){return c(void 0,
a)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();g[Symbol.iterator]=function(){return this};return g}},{key:"initializeHead",value:function(a){a.next1=a.prev1=a}}]);return b}();Object.defineProperty(d,"__esModule",{value:!0});d.default=l},function(f,d){function h(a){var e=!1,b=void 0,g=void 0,m=new Promise(function(k,m){function r(a){e||(e=!0,k(a))}function h(a){e||(e=!0,m(a))}function f(a){if(e)try{a()}catch(c){}}try{a(r,h,f)}catch(l){h(l)}g=function(){if(!e){e=
!0;if(void 0!==b){try{b()}catch(a){}b=void 0}m(d.CANCELLED)}}});m.cancel=g;return m}function l(a){if(null!=a){var e=a.cancel;void 0!==e&&e.call(a)}}var b=function(){function a(c,b){for(var g=0;g<b.length;g++){var m=b[g];m.enumerable=m.enumerable||!1;m.configurable=!0;"value"in m&&(m.writable=!0);Object.defineProperty(c,m.key,m)}}return function(e,b,g){b&&a(e.prototype,b);g&&a(e,g);return e}}(),a=function(){function a(){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");
}b(a,[{key:"toString",value:function(){return"CancellationError"}}]);return a}();d.CancellationError=a;d.CANCELLED=new a;d.makeCancellablePromise=h;d.cancelPromise=l;d.callFinally=function(a,e){return h(function(b,g,m){m(function(){l(a)});a.then(function(a){m(void 0);Promise.resolve(e(m)).then(function(){b(a)})},function(a){m(void 0);try{Promise.resolve(e(m)).then(function(){g(a)},g)}catch(c){g(c)}})})};d.cancellableThen=function(a,e){return h(function(b,g,m){var k=!1;m(function(){k=!0;l(a)});a.then(function(a){k?
g(d.CANCELLED):(m(void 0),b(e(a,m)))})})}},function(f,d,h){function l(a,c){if(!(a instanceof c))throw new TypeError("Cannot call a class as a function");}function b(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 a(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)}var c=function q(a,c,e){null===a&&(a=Function.prototype);var b=Object.getOwnPropertyDescriptor(a,c);if(void 0===b)return a=Object.getPrototypeOf(a),null===a?void 0:q(a,c,e);if("value"in b)return b.value;c=b.get;return void 0===c?void 0:c.call(e)},e=function(){function a(c,e){for(var b=0;b<e.length;b++){var n=e[b];n.enumerable=n.enumerable||!1;n.configurable=!0;"value"in n&&(n.writable=
!0);Object.defineProperty(c,n.key,n)}}return function(c,e,b){e&&a(c.prototype,e);b&&a(c,b);return c}}(),n=h(4),g=h(5),m=h(13),k=h(15);f=h(2);var p=h(6),r=k.vec3.create(),z=k.vec3.create();h=function(c){function n(a,c){l(this,n);var e=b(this,Object.getPrototypeOf(n).call(this));e.initializeSharedObject(a,c.id);e.chunkManager=e.registerDisposer(a.get(c.chunkManager).addRef());e.registerSignalBinding(e.chunkManager.recomputeChunkPriorities.add(e.updateVisibleChunks,e));return e}a(n,c);e(n,[{key:"onViewportChanged",
value:function(){this.chunkManager.scheduleUpdateChunkPriorities()}},{key:"handleLayerChanged",value:function(){this.hasValidViewport&&this.chunkManager.scheduleUpdateChunkPriorities()}},{key:"updateVisibleChunks",value:function(){var a=this,c=this.centerDataPosition,e=this.chunkManager;this.computeVisibleChunks(function(c){return a.visibleChunkLayouts.get(c)},function(a,b,n,m){k.vec3.multiply(r,n,a.size);k.vec3.add(r,r,a.offset);a=-k.vec3.distance(c,r);m=$jscomp.makeIterator(m);for(var v=m.next();!v.done;v=
m.next()){var p=v.value,v=b.get(p),p=p.getChunk(n);e.requestChunk(p,g.ChunkPriorityTier.VISIBLE,a-1E5*v)}})}},{key:"removeVisibleLayer",value:function(a){this.visibleLayers.delete(a);a.layerChanged.remove(this.handleLayerChanged,this);this.visibleSourcesStale=!0;this.hasValidViewport&&this.chunkManager.scheduleUpdateChunkPriorities()}},{key:"disposed",value:function(){for(var a=$jscomp.makeIterator(this.visibleLayers.keys()),c=a.next();!c.done;c=a.next())this.removeVisibleLayer(c.value)}}]);return n}(m.SliceViewBase);
d.SliceView=h;f.registerSharedObject("SliceView",h);f.registerRPC("SliceView.updateView",function(a){var c=this.get(a.id);a.width&&c.setViewportSize(a.width,a.height);a.viewportToData&&c.setViewportToDataMatrix(a.viewportToData)});f.registerRPC("SliceView.addVisibleLayer",function(a){var c=this.get(a.id);a=this.get(a.layerId);c.visibleLayers.set(a,[]);a.layerChanged.add(c.handleLayerChanged,c);c.visibleSourcesStale=!0;c.hasValidViewport&&c.chunkManager.scheduleUpdateChunkPriorities()});f.registerRPC("SliceView.removeVisibleLayer",
function(a){var c=this.get(a.id);a=this.get(a.layerId);c.removeVisibleLayer(a)});var D=function(n){function g(){l(this,g);var a=b(this,Object.getPrototypeOf(g).call(this));a.source=null;a.chunkGridPosition=k.vec3.create();return a}a(g,n);e(g,[{key:"initializeVolumeChunk",value:function(a,e){c(Object.getPrototypeOf(g.prototype),"initialize",this).call(this,a);var b=this.source;k.vec3.copy(this.chunkGridPosition,e);this.gpuMemoryBytes=this.systemMemoryBytes=b.spec.chunkBytes;this.data=this.chunkDataSize=
null}},{key:"serialize",value:function(a,e){c(Object.getPrototypeOf(g.prototype),"serialize",this).call(this,a,e);var b=a.data=this.data,n=this.chunkDataSize;n!==this.source.spec.chunkDataSize&&(a.chunkDataSize=n);a.chunkGridPosition=this.chunkGridPosition;e.push(b.buffer);this.data=null}},{key:"downloadSucceeded",value:function(){this.systemMemoryBytes=this.gpuMemoryBytes=this.data.byteLength;c(Object.getPrototypeOf(g.prototype),"downloadSucceeded",this).call(this)}},{key:"freeSystemMemory",value:function(){this.data=
null}},{key:"toString",value:function(){return this.source.toString()+":"+k.vec3Key(this.chunkGridPosition)}}]);return g}(n.Chunk);d.VolumeChunk=D;h=function(c){function n(a,c){l(this,n);var e=b(this,Object.getPrototypeOf(n).call(this,a,c));e.baseVoxelOffset=k.vec3.create();for(var g=e.spec=m.VolumeChunkSpecification.fromObject(c.spec),p=e.baseVoxelOffset,r=g.chunkLayout.offset,g=g.voxelSize,d=0;3>d;++d)p[d]=Math.round(r[d]/g[d]);return e}a(n,c);e(n,[{key:"getChunk",value:function(a){var c=k.vec3Key(a),
e=this.chunks.get(c);void 0===e&&(e=this.getNewChunk_(D),e.initializeVolumeChunk(c,a),this.addChunk(e));return e}},{key:"computeChunkBounds",value:function(a){var c=this.spec,e=c.upperVoxelBound,c=c.chunkDataSize,b=k.vec3.multiply(r,a.chunkGridPosition,c);k.vec3.add(b,b,this.baseVoxelOffset);for(var n=!1,g=0;3>g;++g)(z[g]=Math.min(e[g],b[g]+c[g])-b[g])!==c[g]&&(n=!0);a.chunkDataSize=n?k.vec3.clone(z):c;return b}}]);return n}(n.ChunkSource);d.VolumeChunkSource=h;h=function(c){function e(a,c){l(this,
e);var n=b(this,Object.getPrototypeOf(e).call(this,a,c));n.layerChanged=new p.Signal;n.equivalences=c.equivalences;for(var g=n.sources=[],m=$jscomp.makeIterator(c.sources),k=m.next();!k.done;k=m.next()){var r=k.value,k=[];g.push(k);for(var r=$jscomp.makeIterator(r),v=r.next();!v.done;v=r.next())v=a.get(v.value),n.registerDisposer(v.addRef()),k.push(v)}return n}a(e,c);return e}(f.SharedObjectCounterpart);d.RenderLayer=h;f.registerSharedObject("sliceview/RenderLayer",h);f.registerRPC("sliceview/RenderLayer:updateEquivalences",
function(a){var c=this.get(a.id);a.equivalences!==c.equivalences&&(c.equivalences=a.equivalences,c.layerChanged.dispatch())})},function(f,d,h){function l(a,c){if(!(a instanceof c))throw new TypeError("Cannot call a class as a function");}function b(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 a(a,c,e){for(var b=0;3>b;++b)a[b]=Number.POSITIVE_INFINITY,c[b]=Number.NEGATIVE_INFINITY;e=$jscomp.makeIterator(e);for(b=e.next();!b.done;b=e.next())for(var n=b.value.spec,b=n.lowerChunkBound,n=n.upperChunkBound,g=0;3>g;++g)a[g]=Math.min(a[g],b[g]),c[g]=Math.max(c[g],n[g])}function c(a,c,e,b){for(var n=w.FULLY_INSIDE,g=0;3>g;++g){var m;m=a[g];var k=c[g],v=e[g],p=b[g];m=m>=p||k<=v?w.FULLY_OUTSIDE:m>=v&&k<=p?w.FULLY_INSIDE:w.PARTIALLY_INSIDE;switch(m){case w.FULLY_OUTSIDE:return m;
case w.PARTIALLY_INSIDE:n=m}}return n}function e(a,c,e){var b=e.length,n=0;if(1<b)for(var g=0,m=0;m<b;++m){for(var k=e[m],v=0,p=v,r=0;3>r;++r)var d=k.spec.chunkLayout.size[r],v=Math.max(v,d*Math.abs(a[r])),p=Math.max(p,d*Math.abs(c[r]));k=v*p;k>g&&(g=k,n=m)}return e[n]}var n=function(){return function(a,c){if(Array.isArray(a))return a;$jscomp.initSymbol();$jscomp.initSymbolIterator();if(Symbol.iterator in Object(a)){var e=[],b=!0,n=!1,g=void 0;try{$jscomp.initSymbol();$jscomp.initSymbolIterator();
for(var m=a[Symbol.iterator](),k;!(b=(k=m.next()).done)&&(e.push(k.value),!c||e.length!==c);b=!0);}catch(v){n=!0,g=v}finally{try{if(!b&&m["return"])m["return"]()}finally{if(n)throw g;}}return e}throw new TypeError("Invalid attempt to destructure non-iterable instance");}}(),g=function(){function a(c,e){for(var b=0;b<e.length;b++){var n=e[b];n.enumerable=n.enumerable||!1;n.configurable=!0;"value"in n&&(n.writable=!0);Object.defineProperty(c,n.key,n)}}return function(c,e,b){e&&a(c.prototype,e);b&&a(c,
b);return c}}(),m=h(14),k=h(26),p=h(27),r=h(28);d.DATA_TYPE_BYTES=r.DATA_TYPE_BYTES;d.DataType=r.DataType;var z=h(15),D=h(15);f=h(2);var w;(function(a){a[a.FULLY_OUTSIDE=0]="FULLY_OUTSIDE";a[a.FULLY_INSIDE=1]="FULLY_INSIDE";a[a.PARTIALLY_INSIDE=2]="PARTIALLY_INSIDE"})(w||(w={}));f=function(m){function r(){l(this,r);var a;a=Object.getPrototypeOf(r).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=z.mat4.create();a.viewportAxes=[z.vec4.create(),z.vec4.create(),z.vec4.create()];a.previousViewportAxes=[z.vec3.create(),z.vec3.create()];a.centerDataPosition=z.vec3.create();a.viewportPlaneDistanceToOrigin=0;a.visibleChunkLayouts=new Map;a.visibleLayers=new Map;a.visibleSourcesStale=!0;a.pixelSize=0;z.mat4.identity(a.viewportToData);return a}b(r,m);g(r,[{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,c){return a!==this.width||c!==this.height?(this.width=a,this.height=c,this.maybeSetHasValidViewport(),!0):!1}},{key:"setViewportToDataMatrix",value:function(a){if(this.hasViewportToData&&z.mat4.equals(this.viewportToData,
a))return!1;this.hasViewportToData=!0;var c=this.viewportToData;z.mat4.copy(c,a);z.rectifyTransformMatrixIfAxisAligned(c);z.vec3.transformMat4(this.centerDataPosition,D.kZeroVec,a);a=0;for(var e=this.viewportAxes,b=this.previousViewportAxes,n=0;3>n;++n){var g=e[n];z.vec4.transformMat4(g,D.kAxes[n],c);0===n&&(a=z.vec3.length(g));z.vec4.normalize(g,g)}this.viewportAxes=e;this.previousViewportAxes=b;if(!p.approxEqual(a,this.pixelSize)||.95>z.vec3.dot(e[0],b[0])||.95>z.vec3.dot(e[1],b[1]))z.vec3.copy(b[0],
e[0]),z.vec3.copy(b[1],e[1]),this.visibleSourcesStale=!0,this.pixelSize=a;this.viewportPlaneDistanceToOrigin=z.vec3.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,c=this.visibleChunkLayouts,b=n(this.viewportAxes,2),g=b[0],m=b[1],k=this.visibleLayers;
c.clear();for(var b=function(b){p=n(b,2);b=p[0];var k=p[1];k.length=0;b=b.sources;for(var v=b.length,r=void 0,d=b[0][0].spec.voxelSize,h=function(c){for(var e=0;3>e;++e){var b=c[e];if(b>a&&b>d[e])return!0}return!1},f=function(a,e){k[k.length++]=a;var b=a.spec.chunkLayout,n=c.get(b);void 0===n&&(n=new Map,c.set(b,n));n.set(a,v-e-1)},r=v-1;;){var z=e(g,m,b[r]);f(z,r);if(0===r||!h(z.spec.voxelSize))break;--r}k.reverse()},k=$jscomp.makeIterator(k),v=k.next();!v.done;v=k.next()){var p;b(v.value)}}}},{key:"computeVisibleChunks",
value:function(e,b){var n=this;this.updateVisibleSources();for(var g=this.centerDataPosition,m=z.vec3.clone(g),p=z.vec3.clone(g),g=z.vec3.create(),v=$jscomp.makeIterator([-this.width/2,this.width/2]),r=v.next();!r.done;r=v.next())for(var r=r.value,d=$jscomp.makeIterator([-this.height/2,this.height/2]),h=d.next();!h.done;h=d.next())h=h.value,z.vec3.scale(g,D.kAxes[0],r),z.vec3.scaleAndAdd(g,g,D.kAxes[1],h),z.vec3.transformMat4(g,g,this.viewportToData),z.vec3.min(m,m,g),z.vec3.max(p,p,g);for(var f=
z.vec3.create(),u=z.vec3.create(),l=z.vec3.create(),C=this.viewportAxes[2],g=0;3>g;++g)0<C[g]&&(l[g]=1);var q=[],M=[];this.visibleChunkLayouts.forEach(function(g,v){function r(){for(var a=0,c=0,e=0;3>e;++e)var b=t[e],n=C[e],g=f[e],m=u[e]-g,k=l[e]*m,a=a+n*b*(g+k),c=c+n*b*(g+m-k);return a<D?!1:c<=D}function d(a){function e(){fa=k.partitionArray(q,0,L,function(a){var e=a.spec;switch(c(f,u,e.lowerChunkBound,e.upperChunkBound)){case w.PARTIALLY_INSIDE:return!0;case w.FULLY_INSIDE:M.push(a);default:return!1}})}
if(0!==M.length||0!==fa){for(var n=1,g=0;3>g;++g)n*=Math.max(0,u[g]-f[g]);if(0!==n&&r())if(1===n)b(v,h,f,M);else{for(var m;;)if(n=f[a],g=u[a],m=g-n,1===m)a=(a+1)%3;else break;m=n+Math.floor(.5*m);var p=(a+1)%3,y=M.length;u[a]=m;var L=fa;e();d(p);M.length=y;fa=L;u[a]=g;f[a]=m;e();d(p);f[a]=n;M.length=y;fa=L}}}var h=e(v),t=v.size,H=v.offset,D=n.viewportPlaneDistanceToOrigin-z.vec3.dot(H,n.viewportAxes[2]);a(f,u,g.keys());for(var A=0;3>A;++A)f[A]=Math.max(f[A],Math.floor((m[A]-H[A])/t[A])),u[A]=Math.min(u[A],
Math.floor((p[A]-H[A])/t[A]+1));M.length=0;q.length=0;H=$jscomp.makeIterator(g.keys());for(A=H.next();!A.done;A=H.next()){var A=A.value,x=A.spec;switch(c(f,u,x.lowerChunkBound,x.upperChunkBound)){case w.FULLY_INSIDE:M.push(A);break;case w.PARTIALLY_INSIDE:q.push(A)}}var fa=q.length;d(0)})}}]);return r}(f.SharedObject);d.SliceViewBase=f;(function(a){a[a.UNKNOWN=0]="UNKNOWN";a[a.IMAGE=1]="IMAGE";a[a.SEGMENTATION=2]="SEGMENTATION"})(d.VolumeType||(d.VolumeType={}));var q=d.VolumeType;d.DEFAULT_CHUNK_DATA_SIZES=
[z.vec3.fromValues(64,64,64)];f=function(){function a(c,e,b,n,g,m,k){l(this,a);this.chunkLayout=c;this.chunkDataSize=e;this.numChannels=b;this.dataType=n;this.lowerVoxelBound=g;this.upperVoxelBound=m;this.compressedSegmentationBlockSize=k;this.chunkBytes=z.prod3(e)*r.DATA_TYPE_BYTES[n]*b;e=this.voxelSize=z.vec3.divide(z.vec3.create(),this.chunkLayout.size,this.chunkDataSize);b=this.lowerChunkBound=z.vec3.create();n=this.upperChunkBound=z.vec3.create();var v=c.size;c=c.offset;for(var p=0;3>p;++p)b[p]=
Math.floor((g[p]*e[p]-c[p])/v[p]),n[p]=Math.floor(((m[p]-1)*e[p]-c[p])/v[p]+1);this.compressedSegmentationBlockSize=k}g(a,[{key:"toObject",value:function(a){this.chunkLayout.toObject(a.chunkLayout={});a.chunkDataSize=this.chunkDataSize;a.numChannels=this.numChannels;a.dataType=this.dataType;a.lowerVoxelBound=this.lowerVoxelBound;a.upperVoxelBound=this.upperVoxelBound;a.compressedSegmentationBlockSize=this.compressedSegmentationBlockSize}}],[{key:"fromObject",value:function(c){return new a(m.ChunkLayout.fromObject(c.chunkLayout),
c.chunkDataSize,c.numChannels,c.dataType,c.lowerVoxelBound,c.upperVoxelBound,c.compressedSegmentationBlockSize)}},{key:"getDefaults",value:function(c){var e=c.voxelSize,b=c.dataType,n=c.lowerVoxelBound,g=c.chunkDataSizes,g=void 0===g?d.DEFAULT_CHUNK_DATA_SIZES:g,k=c.numChannels,p=void 0===k?1:k,v=c.compressedSegmentationBlockSize,f=z.vec3.multiply(z.vec3.create(),n,e);void 0!==v||c.volumeType!==q.SEGMENTATION||b!==r.DataType.UINT32&&b!==r.DataType.UINT64||(v=z.vec3.fromValues(8,8,8));return g.map(function(g){var k=
z.vec3.create();z.vec3.multiply(k,e,g);k=m.ChunkLayout.get(k,f);return new a(k,g,p,b,n,c.upperVoxelBound,v)})}}]);return a}();d.VolumeChunkSpecification=f},function(f,d,h){var l=function(){function a(a,e){for(var b=0;b<e.length;b++){var g=e[b];g.enumerable=g.enumerable||!1;g.configurable=!0;"value"in g&&(g.writable=!0);Object.defineProperty(a,g.key,g)}}return function(c,e,b){e&&a(c.prototype,e);b&&a(c,b);return c}}(),b=h(15);f=function(){function a(c,e){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");
this.size=b.vec3.clone(c);this.offset=void 0===e?b.vec3.create():b.vec3.clone(e)}l(a,[{key:"toObject",value:function(a){a.size=this.size;a.offset=this.offset}}],[{key:"get",value:function(c){var e=1>=arguments.length||void 0===arguments[1]?b.kZeroVec:arguments[1],n=a.cache,g=b.vec3Key(c)+"+"+b.vec3Key(e),m=n.get(g);void 0===m&&(m=new a(c,e),n.set(g,m));return m}},{key:"fromObject",value:function(c){return a.get(c.size,c.offset)}}]);return a}();f.cache=new Map;d.ChunkLayout=f},function(f,d,h){function l(b,
a){var c=Math.abs(b[a]),e=Math.abs(b[a+1]),n=Math.abs(b[a+2]),g=Math.max(c,e,n);1E-4>c/g&&(b[a]=0);1E-4>e/g&&(b[a+1]=0);1E-4>n/g&&(b[a+2]=0)}f=h(16);h=h(16);d.mat2=h.mat2;d.mat3=h.mat3;d.mat4=h.mat4;d.quat=h.quat;d.vec2=h.vec2;d.vec3=h.vec3;d.vec4=h.vec4;d.identityMat4=f.mat4.create();d.AXES_NAMES=["x","y","z"];d.BoundingBox=function a(c,e){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");this.lower=c;this.upper=e};d.kAxes=[f.vec4.fromValues(1,0,0,0),f.vec4.fromValues(0,
1,0,0),f.vec4.fromValues(0,0,1,0)];d.kZeroVec=f.vec3.fromValues(0,0,0);d.prod3=function(a){return a[0]*a[1]*a[2]};d.prod4=function(a){return a[0]*a[1]*a[2]*a[3]};d.vec3Key=function(a){return a[0]+","+a[1]+","+a[2]};d.rectifyVec3IfAxisAligned=l;d.rectifyTransformMatrixIfAxisAligned=function(a){l(a,0);l(a,4);l(a,8)}},function(f,d,h){d.glMatrix=h(17);d.mat2=h(18);d.mat2d=h(19);d.mat3=h(20);d.mat4=h(21);d.quat=h(22);d.vec2=h(25);d.vec3=h(23);d.vec4=h(24)},function(f,d){var h={EPSILON:1E-6};h.ARRAY_TYPE=
"undefined"!==typeof Float32Array?Float32Array:Array;h.RANDOM=Math.random;h.ENABLE_SIMD=!1;h.SIMD_AVAILABLE=h.ARRAY_TYPE===Float32Array&&"SIMD"in this;h.USE_SIMD=h.ENABLE_SIMD&&h.SIMD_AVAILABLE;h.setMatrixArrayType=function(b){h.ARRAY_TYPE=b};var l=Math.PI/180;h.toRadian=function(b){return b*l};h.equals=function(b,a){return Math.abs(b-a)<=h.EPSILON*Math.max(1,Math.abs(b),Math.abs(a))};f.exports=h},function(f,d,h){var l=h(17);d={create:function(){var b=new l.ARRAY_TYPE(4);b[0]=1;b[1]=0;b[2]=0;b[3]=
1;return b},clone:function(b){var a=new l.ARRAY_TYPE(4);a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];return a},copy:function(b,a){b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];return b},identity:function(b){b[0]=1;b[1]=0;b[2]=0;b[3]=1;return b},fromValues:function(b,a,c,e){var n=new l.ARRAY_TYPE(4);n[0]=b;n[1]=a;n[2]=c;n[3]=e;return n},set:function(b,a,c,e,n){b[0]=a;b[1]=c;b[2]=e;b[3]=n;return b},transpose:function(b,a){if(b===a){var c=a[1];b[1]=a[2];b[2]=c}else b[0]=a[0],b[1]=a[2],b[2]=a[1],b[3]=a[3];return b},
invert:function(b,a){var c=a[0],e=a[1],n=a[2],g=a[3],m=c*g-n*e;if(!m)return null;m=1/m;b[0]=g*m;b[1]=-e*m;b[2]=-n*m;b[3]=c*m;return b},adjoint:function(b,a){var c=a[0];b[0]=a[3];b[1]=-a[1];b[2]=-a[2];b[3]=c;return b},determinant:function(b){return b[0]*b[3]-b[2]*b[1]},multiply:function(b,a,c){var e=a[0],n=a[1],g=a[2];a=a[3];var m=c[0],k=c[1],p=c[2];c=c[3];b[0]=e*m+g*k;b[1]=n*m+a*k;b[2]=e*p+g*c;b[3]=n*p+a*c;return b}};d.mul=d.multiply;d.rotate=function(b,a,c){var e=a[0],n=a[1],g=a[2];a=a[3];var m=
Math.sin(c);c=Math.cos(c);b[0]=e*c+g*m;b[1]=n*c+a*m;b[2]=e*-m+g*c;b[3]=n*-m+a*c;return b};d.scale=function(b,a,c){var e=a[1],n=a[2],g=a[3],m=c[0];c=c[1];b[0]=a[0]*m;b[1]=e*m;b[2]=n*c;b[3]=g*c;return b};d.fromRotation=function(b,a){var c=Math.sin(a),e=Math.cos(a);b[0]=e;b[1]=c;b[2]=-c;b[3]=e;return b};d.fromScaling=function(b,a){b[0]=a[0];b[1]=0;b[2]=0;b[3]=a[1];return b};d.str=function(b){return"mat2("+b[0]+", "+b[1]+", "+b[2]+", "+b[3]+")"};d.frob=function(b){return Math.sqrt(Math.pow(b[0],2)+Math.pow(b[1],
2)+Math.pow(b[2],2)+Math.pow(b[3],2))};d.LDU=function(b,a,c,e){b[2]=e[2]/e[0];c[0]=e[0];c[1]=e[1];c[3]=e[3]-b[2]*c[1];return[b,a,c]};d.add=function(b,a,c){b[0]=a[0]+c[0];b[1]=a[1]+c[1];b[2]=a[2]+c[2];b[3]=a[3]+c[3];return b};d.subtract=function(b,a,c){b[0]=a[0]-c[0];b[1]=a[1]-c[1];b[2]=a[2]-c[2];b[3]=a[3]-c[3];return b};d.sub=d.subtract;d.exactEquals=function(b,a){return b[0]===a[0]&&b[1]===a[1]&&b[2]===a[2]&&b[3]===a[3]};d.equals=function(b,a){var c=b[0],e=b[1],n=b[2],g=b[3],m=a[0],k=a[1],p=a[2],
r=a[3];return Math.abs(c-m)<=l.EPSILON*Math.max(1,Math.abs(c),Math.abs(m))&&Math.abs(e-k)<=l.EPSILON*Math.max(1,Math.abs(e),Math.abs(k))&&Math.abs(n-p)<=l.EPSILON*Math.max(1,Math.abs(n),Math.abs(p))&&Math.abs(g-r)<=l.EPSILON*Math.max(1,Math.abs(g),Math.abs(r))};d.multiplyScalar=function(b,a,c){b[0]=a[0]*c;b[1]=a[1]*c;b[2]=a[2]*c;b[3]=a[3]*c;return b};d.multiplyScalarAndAdd=function(b,a,c,e){b[0]=a[0]+c[0]*e;b[1]=a[1]+c[1]*e;b[2]=a[2]+c[2]*e;b[3]=a[3]+c[3]*e;return b};f.exports=d},function(f,d,h){var l=
h(17);d={create:function(){var b=new l.ARRAY_TYPE(6);b[0]=1;b[1]=0;b[2]=0;b[3]=1;b[4]=0;b[5]=0;return b},clone:function(b){var a=new l.ARRAY_TYPE(6);a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];return a},copy:function(b,a){b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];return b},identity:function(b){b[0]=1;b[1]=0;b[2]=0;b[3]=1;b[4]=0;b[5]=0;return b},fromValues:function(b,a,c,e,n,g){var m=new l.ARRAY_TYPE(6);m[0]=b;m[1]=a;m[2]=c;m[3]=e;m[4]=n;m[5]=g;return m},set:function(b,
a,c,e,n,g,m){b[0]=a;b[1]=c;b[2]=e;b[3]=n;b[4]=g;b[5]=m;return b},invert:function(b,a){var c=a[0],e=a[1],n=a[2],g=a[3],m=a[4],k=a[5],p=c*g-e*n;if(!p)return null;p=1/p;b[0]=g*p;b[1]=-e*p;b[2]=-n*p;b[3]=c*p;b[4]=(n*k-g*m)*p;b[5]=(e*m-c*k)*p;return b},determinant:function(b){return b[0]*b[3]-b[1]*b[2]},multiply:function(b,a,c){var e=a[0],n=a[1],g=a[2],m=a[3],k=a[4];a=a[5];var p=c[0],r=c[1],d=c[2],f=c[3],h=c[4];c=c[5];b[0]=e*p+g*r;b[1]=n*p+m*r;b[2]=e*d+g*f;b[3]=n*d+m*f;b[4]=e*h+g*c+k;b[5]=n*h+m*c+a;return b}};
d.mul=d.multiply;d.rotate=function(b,a,c){var e=a[0],n=a[1],g=a[2],m=a[3],k=a[4];a=a[5];var p=Math.sin(c);c=Math.cos(c);b[0]=e*c+g*p;b[1]=n*c+m*p;b[2]=e*-p+g*c;b[3]=n*-p+m*c;b[4]=k;b[5]=a;return b};d.scale=function(b,a,c){var e=a[1],n=a[2],g=a[3],m=a[4],k=a[5],p=c[0];c=c[1];b[0]=a[0]*p;b[1]=e*p;b[2]=n*c;b[3]=g*c;b[4]=m;b[5]=k;return b};d.translate=function(b,a,c){var e=a[0],n=a[1],g=a[2],m=a[3],k=a[4];a=a[5];var p=c[0];c=c[1];b[0]=e;b[1]=n;b[2]=g;b[3]=m;b[4]=e*p+g*c+k;b[5]=n*p+m*c+a;return b};d.fromRotation=
function(b,a){var c=Math.sin(a),e=Math.cos(a);b[0]=e;b[1]=c;b[2]=-c;b[3]=e;b[4]=0;b[5]=0;return b};d.fromScaling=function(b,a){b[0]=a[0];b[1]=0;b[2]=0;b[3]=a[1];b[4]=0;b[5]=0;return b};d.fromTranslation=function(b,a){b[0]=1;b[1]=0;b[2]=0;b[3]=1;b[4]=a[0];b[5]=a[1];return b};d.str=function(b){return"mat2d("+b[0]+", "+b[1]+", "+b[2]+", "+b[3]+", "+b[4]+", "+b[5]+")"};d.frob=function(b){return Math.sqrt(Math.pow(b[0],2)+Math.pow(b[1],2)+Math.pow(b[2],2)+Math.pow(b[3],2)+Math.pow(b[4],2)+Math.pow(b[5],
2)+1)};d.add=function(b,a,c){b[0]=a[0]+c[0];b[1]=a[1]+c[1];b[2]=a[2]+c[2];b[3]=a[3]+c[3];b[4]=a[4]+c[4];b[5]=a[5]+c[5];return b};d.subtract=function(b,a,c){b[0]=a[0]-c[0];b[1]=a[1]-c[1];b[2]=a[2]-c[2];b[3]=a[3]-c[3];b[4]=a[4]-c[4];b[5]=a[5]-c[5];return b};d.sub=d.subtract;d.multiplyScalar=function(b,a,c){b[0]=a[0]*c;b[1]=a[1]*c;b[2]=a[2]*c;b[3]=a[3]*c;b[4]=a[4]*c;b[5]=a[5]*c;return b};d.multiplyScalarAndAdd=function(b,a,c,e){b[0]=a[0]+c[0]*e;b[1]=a[1]+c[1]*e;b[2]=a[2]+c[2]*e;b[3]=a[3]+c[3]*e;b[4]=
a[4]+c[4]*e;b[5]=a[5]+c[5]*e;return b};d.exactEquals=function(b,a){return b[0]===a[0]&&b[1]===a[1]&&b[2]===a[2]&&b[3]===a[3]&&b[4]===a[4]&&b[5]===a[5]};d.equals=function(b,a){var c=b[0],e=b[1],n=b[2],g=b[3],m=b[4],k=b[5],p=a[0],r=a[1],d=a[2],f=a[3],h=a[4],q=a[5];return Math.abs(c-p)<=l.EPSILON*Math.max(1,Math.abs(c),Math.abs(p))&&Math.abs(e-r)<=l.EPSILON*Math.max(1,Math.abs(e),Math.abs(r))&&Math.abs(n-d)<=l.EPSILON*Math.max(1,Math.abs(n),Math.abs(d))&&Math.abs(g-f)<=l.EPSILON*Math.max(1,Math.abs(g),
Math.abs(f))&&Math.abs(m-h)<=l.EPSILON*Math.max(1,Math.abs(m),Math.abs(h))&&Math.abs(k-q)<=l.EPSILON*Math.max(1,Math.abs(k),Math.abs(q))};f.exports=d},function(f,d,h){var l=h(17);d={create:function(){var b=new l.ARRAY_TYPE(9);b[0]=1;b[1]=0;b[2]=0;b[3]=0;b[4]=1;b[5]=0;b[6]=0;b[7]=0;b[8]=1;return b},fromMat4:function(b,a){b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[4];b[4]=a[5];b[5]=a[6];b[6]=a[8];b[7]=a[9];b[8]=a[10];return b},clone:function(b){var a=new l.ARRAY_TYPE(9);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},copy:function(b,a){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},fromValues:function(b,a,c,e,n,g,m,k,p){var r=new l.ARRAY_TYPE(9);r[0]=b;r[1]=a;r[2]=c;r[3]=e;r[4]=n;r[5]=g;r[6]=m;r[7]=k;r[8]=p;return r},set:function(b,a,c,e,n,g,m,k,p,r){b[0]=a;b[1]=c;b[2]=e;b[3]=n;b[4]=g;b[5]=m;b[6]=k;b[7]=p;b[8]=r;return b},identity:function(b){b[0]=1;b[1]=0;b[2]=0;b[3]=0;b[4]=1;b[5]=0;b[6]=0;b[7]=
0;b[8]=1;return b},transpose:function(b,a){if(b===a){var c=a[1],e=a[2],n=a[5];b[1]=a[3];b[2]=a[6];b[3]=c;b[5]=a[7];b[6]=e;b[7]=n}else b[0]=a[0],b[1]=a[3],b[2]=a[6],b[3]=a[1],b[4]=a[4],b[5]=a[7],b[6]=a[2],b[7]=a[5],b[8]=a[8];return b},invert:function(b,a){var c=a[0],e=a[1],n=a[2],g=a[3],m=a[4],k=a[5],p=a[6],r=a[7],d=a[8],f=d*m-k*r,h=-d*g+k*p,l=r*g-m*p,u=c*f+e*h+n*l;if(!u)return null;u=1/u;b[0]=f*u;b[1]=(-d*e+n*r)*u;b[2]=(k*e-n*m)*u;b[3]=h*u;b[4]=(d*c-n*p)*u;b[5]=(-k*c+n*g)*u;b[6]=l*u;b[7]=(-r*c+e*
p)*u;b[8]=(m*c-e*g)*u;return b},adjoint:function(b,a){var c=a[0],e=a[1],n=a[2],g=a[3],m=a[4],k=a[5],p=a[6],r=a[7],d=a[8];b[0]=m*d-k*r;b[1]=n*r-e*d;b[2]=e*k-n*m;b[3]=k*p-g*d;b[4]=c*d-n*p;b[5]=n*g-c*k;b[6]=g*r-m*p;b[7]=e*p-c*r;b[8]=c*m-e*g;return b},determinant:function(b){var a=b[3],c=b[4],e=b[5],n=b[6],g=b[7],m=b[8];return b[0]*(m*c-e*g)+b[1]*(-m*a+e*n)+b[2]*(g*a-c*n)},multiply:function(b,a,c){var e=a[0],n=a[1],g=a[2],m=a[3],k=a[4],p=a[5],r=a[6],d=a[7];a=a[8];var f=c[0],h=c[1],l=c[2],u=c[3],C=c[4],
y=c[5],B=c[6],F=c[7];c=c[8];b[0]=f*e+h*m+l*r;b[1]=f*n+h*k+l*d;b[2]=f*g+h*p+l*a;b[3]=u*e+C*m+y*r;b[4]=u*n+C*k+y*d;b[5]=u*g+C*p+y*a;b[6]=B*e+F*m+c*r;b[7]=B*n+F*k+c*d;b[8]=B*g+F*p+c*a;return b}};d.mul=d.multiply;d.translate=function(b,a,c){var e=a[0],n=a[1],g=a[2],m=a[3],k=a[4],p=a[5],r=a[6],d=a[7];a=a[8];var f=c[0];c=c[1];b[0]=e;b[1]=n;b[2]=g;b[3]=m;b[4]=k;b[5]=p;b[6]=f*e+c*m+r;b[7]=f*n+c*k+d;b[8]=f*g+c*p+a;return b};d.rotate=function(b,a,c){var e=a[0],n=a[1],g=a[2],m=a[3],k=a[4],p=a[5],r=a[6],d=a[7];
a=a[8];var f=Math.sin(c);c=Math.cos(c);b[0]=c*e+f*m;b[1]=c*n+f*k;b[2]=c*g+f*p;b[3]=c*m-f*e;b[4]=c*k-f*n;b[5]=c*p-f*g;b[6]=r;b[7]=d;b[8]=a;return b};d.scale=function(b,a,c){var e=c[0];c=c[1];b[0]=e*a[0];b[1]=e*a[1];b[2]=e*a[2];b[3]=c*a[3];b[4]=c*a[4];b[5]=c*a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];return b};d.fromTranslation=function(b,a){b[0]=1;b[1]=0;b[2]=0;b[3]=0;b[4]=1;b[5]=0;b[6]=a[0];b[7]=a[1];b[8]=1;return b};d.fromRotation=function(b,a){var c=Math.sin(a),e=Math.cos(a);b[0]=e;b[1]=c;b[2]=0;b[3]=-c;
b[4]=e;b[5]=0;b[6]=0;b[7]=0;b[8]=1;return b};d.fromScaling=function(b,a){b[0]=a[0];b[1]=0;b[2]=0;b[3]=0;b[4]=a[1];b[5]=0;b[6]=0;b[7]=0;b[8]=1;return b};d.fromMat2d=function(b,a){b[0]=a[0];b[1]=a[1];b[2]=0;b[3]=a[2];b[4]=a[3];b[5]=0;b[6]=a[4];b[7]=a[5];b[8]=1;return b};d.fromQuat=function(b,a){var c=a[0],e=a[1],n=a[2],g=a[3],m=c+c,k=e+e,p=n+n,c=c*m,r=e*m,e=e*k,d=n*m,f=n*k,n=n*p,m=g*m,k=g*k,g=g*p;b[0]=1-e-n;b[3]=r-g;b[6]=d+k;b[1]=r+g;b[4]=1-c-n;b[7]=f-m;b[2]=d-k;b[5]=f+m;b[8]=1-c-e;return b};d.normalFromMat4=
function(b,a){var c=a[0],e=a[1],n=a[2],g=a[3],m=a[4],k=a[5],p=a[6],r=a[7],d=a[8],f=a[9],h=a[10],l=a[11],u=a[12],C=a[13],y=a[14],B=a[15],F=c*k-e*m,H=c*p-n*m,I=c*r-g*m,J=e*p-n*k,v=e*r-g*k,t=n*r-g*p,x=d*C-f*u,A=d*y-h*u,d=d*B-l*u,K=f*y-h*C,f=f*B-l*C,h=h*B-l*y,l=F*h-H*f+I*K+J*d-v*A+t*x;if(!l)return null;l=1/l;b[0]=(k*h-p*f+r*K)*l;b[1]=(p*d-m*h-r*A)*l;b[2]=(m*f-k*d+r*x)*l;b[3]=(n*f-e*h-g*K)*l;b[4]=(c*h-n*d+g*A)*l;b[5]=(e*d-c*f-g*x)*l;b[6]=(C*t-y*v+B*J)*l;b[7]=(y*I-u*t-B*H)*l;b[8]=(u*v-C*I+B*F)*l;return b};
d.str=function(b){return"mat3("+b[0]+", "+b[1]+", "+b[2]+", "+b[3]+", "+b[4]+", "+b[5]+", "+b[6]+", "+b[7]+", "+b[8]+")"};d.frob=function(b){return Math.sqrt(Math.pow(b[0],2)+Math.pow(b[1],2)+Math.pow(b[2],2)+Math.pow(b[3],2)+Math.pow(b[4],2)+Math.pow(b[5],2)+Math.pow(b[6],2)+Math.pow(b[7],2)+Math.pow(b[8],2))};d.add=function(b,a,c){b[0]=a[0]+c[0];b[1]=a[1]+c[1];b[2]=a[2]+c[2];b[3]=a[3]+c[3];b[4]=a[4]+c[4];b[5]=a[5]+c[5];b[6]=a[6]+c[6];b[7]=a[7]+c[7];b[8]=a[8]+c[8];return b};d.subtract=function(b,
a,c){b[0]=a[0]-c[0];b[1]=a[1]-c[1];b[2]=a[2]-c[2];b[3]=a[3]-c[3];b[4]=a[4]-c[4];b[5]=a[5]-c[5];b[6]=a[6]-c[6];b[7]=a[7]-c[7];b[8]=a[8]-c[8];return b};d.sub=d.subtract;d.multiplyScalar=function(b,a,c){b[0]=a[0]*c;b[1]=a[1]*c;b[2]=a[2]*c;b[3]=a[3]*c;b[4]=a[4]*c;b[5]=a[5]*c;b[6]=a[6]*c;b[7]=a[7]*c;b[8]=a[8]*c;return b};d.multiplyScalarAndAdd=function(b,a,c,e){b[0]=a[0]+c[0]*e;b[1]=a[1]+c[1]*e;b[2]=a[2]+c[2]*e;b[3]=a[3]+c[3]*e;b[4]=a[4]+c[4]*e;b[5]=a[5]+c[5]*e;b[6]=a[6]+c[6]*e;b[7]=a[7]+c[7]*e;b[8]=a[8]+
c[8]*e;return b};d.exactEquals=function(b,a){return 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]};d.equals=function(b,a){var c=b[0],e=b[1],n=b[2],g=b[3],m=b[4],k=b[5],p=b[6],r=b[7],d=b[8],f=a[0],h=a[1],q=a[2],u=a[3],C=a[4],y=a[5],B=b[6],F=a[7],H=a[8];return Math.abs(c-f)<=l.EPSILON*Math.max(1,Math.abs(c),Math.abs(f))&&Math.abs(e-h)<=l.EPSILON*Math.max(1,Math.abs(e),Math.abs(h))&&Math.abs(n-q)<=l.EPSILON*Math.max(1,Math.abs(n),
Math.abs(q))&&Math.abs(g-u)<=l.EPSILON*Math.max(1,Math.abs(g),Math.abs(u))&&Math.abs(m-C)<=l.EPSILON*Math.max(1,Math.abs(m),Math.abs(C))&&Math.abs(k-y)<=l.EPSILON*Math.max(1,Math.abs(k),Math.abs(y))&&Math.abs(p-B)<=l.EPSILON*Math.max(1,Math.abs(p),Math.abs(B))&&Math.abs(r-F)<=l.EPSILON*Math.max(1,Math.abs(r),Math.abs(F))&&Math.abs(d-H)<=l.EPSILON*Math.max(1,Math.abs(d),Math.abs(H))};f.exports=d},function(f,d,h){var l=h(17),b={scalar:{},SIMD:{},create:function(){var a=new l.ARRAY_TYPE(16);a[0]=1;a[1]=
0;a[2]=0;a[3]=0;a[4]=0;a[5]=1;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=1;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a},clone:function(a){var c=new l.ARRAY_TYPE(16);c[0]=a[0];c[1]=a[1];c[2]=a[2];c[3]=a[3];c[4]=a[4];c[5]=a[5];c[6]=a[6];c[7]=a[7];c[8]=a[8];c[9]=a[9];c[10]=a[10];c[11]=a[11];c[12]=a[12];c[13]=a[13];c[14]=a[14];c[15]=a[15];return c},copy:function(a,c){a[0]=c[0];a[1]=c[1];a[2]=c[2];a[3]=c[3];a[4]=c[4];a[5]=c[5];a[6]=c[6];a[7]=c[7];a[8]=c[8];a[9]=c[9];a[10]=c[10];a[11]=c[11];a[12]=c[12];a[13]=
c[13];a[14]=c[14];a[15]=c[15];return a},fromValues:function(a,c,e,b,g,m,k,p,r,d,f,h,q,u,C,y){var B=new l.ARRAY_TYPE(16);B[0]=a;B[1]=c;B[2]=e;B[3]=b;B[4]=g;B[5]=m;B[6]=k;B[7]=p;B[8]=r;B[9]=d;B[10]=f;B[11]=h;B[12]=q;B[13]=u;B[14]=C;B[15]=y;return B},set:function(a,c,e,b,g,m,k,p,r,d,f,h,l,u,C,y,B){a[0]=c;a[1]=e;a[2]=b;a[3]=g;a[4]=m;a[5]=k;a[6]=p;a[7]=r;a[8]=d;a[9]=f;a[10]=h;a[11]=l;a[12]=u;a[13]=C;a[14]=y;a[15]=B;return a},identity:function(a){a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=1;a[6]=0;a[7]=0;
a[8]=0;a[9]=0;a[10]=1;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a}};b.scalar.transpose=function(a,c){if(a===c){var e=c[1],b=c[2],g=c[3],m=c[6],k=c[7],p=c[11];a[1]=c[4];a[2]=c[8];a[3]=c[12];a[4]=e;a[6]=c[9];a[7]=c[13];a[8]=b;a[9]=m;a[11]=c[14];a[12]=g;a[13]=k;a[14]=p}else a[0]=c[0],a[1]=c[4],a[2]=c[8],a[3]=c[12],a[4]=c[1],a[5]=c[5],a[6]=c[9],a[7]=c[13],a[8]=c[2],a[9]=c[6],a[10]=c[10],a[11]=c[14],a[12]=c[3],a[13]=c[7],a[14]=c[11],a[15]=c[15];return a};b.SIMD.transpose=function(a,c){var e,b,g,m,
k,p,r;e=SIMD.Float32x4.load(c,0);b=SIMD.Float32x4.load(c,4);g=SIMD.Float32x4.load(c,8);m=SIMD.Float32x4.load(c,12);k=SIMD.Float32x4.shuffle(e,b,0,1,4,5);p=SIMD.Float32x4.shuffle(g,m,0,1,4,5);r=SIMD.Float32x4.shuffle(k,p,0,2,4,6);k=SIMD.Float32x4.shuffle(k,p,1,3,5,7);SIMD.Float32x4.store(a,0,r);SIMD.Float32x4.store(a,4,k);k=SIMD.Float32x4.shuffle(e,b,2,3,6,7);p=SIMD.Float32x4.shuffle(g,m,2,3,6,7);e=SIMD.Float32x4.shuffle(k,p,0,2,4,6);b=SIMD.Float32x4.shuffle(k,p,1,3,5,7);SIMD.Float32x4.store(a,8,e);
SIMD.Float32x4.store(a,12,b);return a};b.transpose=l.USE_SIMD?b.SIMD.transpose:b.scalar.transpose;b.scalar.invert=function(a,c){var e=c[0],b=c[1],g=c[2],m=c[3],k=c[4],p=c[5],r=c[6],d=c[7],f=c[8],h=c[9],l=c[10],u=c[11],C=c[12],y=c[13],B=c[14],F=c[15],H=e*p-b*k,I=e*r-g*k,J=e*d-m*k,v=b*r-g*p,t=b*d-m*p,x=g*d-m*r,A=f*y-h*C,K=f*B-l*C,E=f*F-u*C,G=h*B-l*y,O=h*F-u*y,Q=l*F-u*B,M=H*Q-I*O+J*G+v*E-t*K+x*A;if(!M)return null;M=1/M;a[0]=(p*Q-r*O+d*G)*M;a[1]=(g*O-b*Q-m*G)*M;a[2]=(y*x-B*t+F*v)*M;a[3]=(l*t-h*x-u*v)*
M;a[4]=(r*E-k*Q-d*K)*M;a[5]=(e*Q-g*E+m*K)*M;a[6]=(B*J-C*x-F*I)*M;a[7]=(f*x-l*J+u*I)*M;a[8]=(k*O-p*E+d*A)*M;a[9]=(b*E-e*O-m*A)*M;a[10]=(C*t-y*J+F*H)*M;a[11]=(h*J-f*t-u*H)*M;a[12]=(p*K-k*G-r*A)*M;a[13]=(e*G-b*K+g*A)*M;a[14]=(y*I-C*v-B*H)*M;a[15]=(f*v-h*I+l*H)*M;return a};b.SIMD.invert=function(a,c){var e,b,g,m,k,p,r,d,f;p=SIMD.Float32x4.load(c,0);r=SIMD.Float32x4.load(c,4);d=SIMD.Float32x4.load(c,8);f=SIMD.Float32x4.load(c,12);k=SIMD.Float32x4.shuffle(p,r,0,1,4,5);b=SIMD.Float32x4.shuffle(d,f,0,1,4,
5);e=SIMD.Float32x4.shuffle(k,b,0,2,4,6);b=SIMD.Float32x4.shuffle(b,k,1,3,5,7);k=SIMD.Float32x4.shuffle(p,r,2,3,6,7);m=SIMD.Float32x4.shuffle(d,f,2,3,6,7);g=SIMD.Float32x4.shuffle(k,m,0,2,4,6);m=SIMD.Float32x4.shuffle(m,k,1,3,5,7);k=SIMD.Float32x4.mul(g,m);k=SIMD.Float32x4.swizzle(k,1,0,3,2);p=SIMD.Float32x4.mul(b,k);r=SIMD.Float32x4.mul(e,k);k=SIMD.Float32x4.swizzle(k,2,3,0,1);p=SIMD.Float32x4.sub(SIMD.Float32x4.mul(b,k),p);r=SIMD.Float32x4.sub(SIMD.Float32x4.mul(e,k),r);r=SIMD.Float32x4.swizzle(r,
2,3,0,1);k=SIMD.Float32x4.mul(b,g);k=SIMD.Float32x4.swizzle(k,1,0,3,2);p=SIMD.Float32x4.add(SIMD.Float32x4.mul(m,k),p);f=SIMD.Float32x4.mul(e,k);k=SIMD.Float32x4.swizzle(k,2,3,0,1);p=SIMD.Float32x4.sub(p,SIMD.Float32x4.mul(m,k));f=SIMD.Float32x4.sub(SIMD.Float32x4.mul(e,k),f);f=SIMD.Float32x4.swizzle(f,2,3,0,1);k=SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(b,2,3,0,1),m);k=SIMD.Float32x4.swizzle(k,1,0,3,2);g=SIMD.Float32x4.swizzle(g,2,3,0,1);p=SIMD.Float32x4.add(SIMD.Float32x4.mul(g,k),p);d=SIMD.Float32x4.mul(e,
k);k=SIMD.Float32x4.swizzle(k,2,3,0,1);p=SIMD.Float32x4.sub(p,SIMD.Float32x4.mul(g,k));d=SIMD.Float32x4.sub(SIMD.Float32x4.mul(e,k),d);d=SIMD.Float32x4.swizzle(d,2,3,0,1);k=SIMD.Float32x4.mul(e,b);k=SIMD.Float32x4.swizzle(k,1,0,3,2);d=SIMD.Float32x4.add(SIMD.Float32x4.mul(m,k),d);f=SIMD.Float32x4.sub(SIMD.Float32x4.mul(g,k),f);k=SIMD.Float32x4.swizzle(k,2,3,0,1);d=SIMD.Float32x4.sub(SIMD.Float32x4.mul(m,k),d);f=SIMD.Float32x4.sub(f,SIMD.Float32x4.mul(g,k));k=SIMD.Float32x4.mul(e,m);k=SIMD.Float32x4.swizzle(k,
1,0,3,2);r=SIMD.Float32x4.sub(r,SIMD.Float32x4.mul(g,k));d=SIMD.Float32x4.add(SIMD.Float32x4.mul(b,k),d);k=SIMD.Float32x4.swizzle(k,2,3,0,1);r=SIMD.Float32x4.add(SIMD.Float32x4.mul(g,k),r);d=SIMD.Float32x4.sub(d,SIMD.Float32x4.mul(b,k));k=SIMD.Float32x4.mul(e,g);k=SIMD.Float32x4.swizzle(k,1,0,3,2);r=SIMD.Float32x4.add(SIMD.Float32x4.mul(m,k),r);f=SIMD.Float32x4.sub(f,SIMD.Float32x4.mul(b,k));k=SIMD.Float32x4.swizzle(k,2,3,0,1);r=SIMD.Float32x4.sub(r,SIMD.Float32x4.mul(m,k));f=SIMD.Float32x4.add(SIMD.Float32x4.mul(b,
k),f);e=SIMD.Float32x4.mul(e,p);e=SIMD.Float32x4.add(SIMD.Float32x4.swizzle(e,2,3,0,1),e);e=SIMD.Float32x4.add(SIMD.Float32x4.swizzle(e,1,0,3,2),e);k=SIMD.Float32x4.reciprocalApproximation(e);e=SIMD.Float32x4.sub(SIMD.Float32x4.add(k,k),SIMD.Float32x4.mul(e,SIMD.Float32x4.mul(k,k)));e=SIMD.Float32x4.swizzle(e,0,0,0,0);if(!e)return null;SIMD.Float32x4.store(a,0,SIMD.Float32x4.mul(e,p));SIMD.Float32x4.store(a,4,SIMD.Float32x4.mul(e,r));SIMD.Float32x4.store(a,8,SIMD.Float32x4.mul(e,d));SIMD.Float32x4.store(a,
12,SIMD.Float32x4.mul(e,f));return a};b.invert=l.USE_SIMD?b.SIMD.invert:b.scalar.invert;b.scalar.adjoint=function(a,c){var e=c[0],b=c[1],g=c[2],m=c[3],k=c[4],p=c[5],d=c[6],f=c[7],h=c[8],l=c[9],q=c[10],u=c[11],C=c[12],y=c[13],B=c[14],F=c[15];a[0]=p*(q*F-u*B)-l*(d*F-f*B)+y*(d*u-f*q);a[1]=-(b*(q*F-u*B)-l*(g*F-m*B)+y*(g*u-m*q));a[2]=b*(d*F-f*B)-p*(g*F-m*B)+y*(g*f-m*d);a[3]=-(b*(d*u-f*q)-p*(g*u-m*q)+l*(g*f-m*d));a[4]=-(k*(q*F-u*B)-h*(d*F-f*B)+C*(d*u-f*q));a[5]=e*(q*F-u*B)-h*(g*F-m*B)+C*(g*u-m*q);a[6]=
-(e*(d*F-f*B)-k*(g*F-m*B)+C*(g*f-m*d));a[7]=e*(d*u-f*q)-k*(g*u-m*q)+h*(g*f-m*d);a[8]=k*(l*F-u*y)-h*(p*F-f*y)+C*(p*u-f*l);a[9]=-(e*(l*F-u*y)-h*(b*F-m*y)+C*(b*u-m*l));a[10]=e*(p*F-f*y)-k*(b*F-m*y)+C*(b*f-m*p);a[11]=-(e*(p*u-f*l)-k*(b*u-m*l)+h*(b*f-m*p));a[12]=-(k*(l*B-q*y)-h*(p*B-d*y)+C*(p*q-d*l));a[13]=e*(l*B-q*y)-h*(b*B-g*y)+C*(b*q-g*l);a[14]=-(e*(p*B-d*y)-k*(b*B-g*y)+C*(b*d-g*p));a[15]=e*(p*q-d*l)-k*(b*q-g*l)+h*(b*d-g*p);return a};b.SIMD.adjoint=function(a,c){var e,b,g,m,k,p,d,f,h;e=SIMD.Float32x4.load(c,
0);b=SIMD.Float32x4.load(c,4);g=SIMD.Float32x4.load(c,8);m=SIMD.Float32x4.load(c,12);d=SIMD.Float32x4.shuffle(e,b,0,1,4,5);p=SIMD.Float32x4.shuffle(g,m,0,1,4,5);k=SIMD.Float32x4.shuffle(d,p,0,2,4,6);p=SIMD.Float32x4.shuffle(p,d,1,3,5,7);d=SIMD.Float32x4.shuffle(e,b,2,3,6,7);b=SIMD.Float32x4.shuffle(g,m,2,3,6,7);e=SIMD.Float32x4.shuffle(d,b,0,2,4,6);b=SIMD.Float32x4.shuffle(b,d,1,3,5,7);d=SIMD.Float32x4.mul(e,b);d=SIMD.Float32x4.swizzle(d,1,0,3,2);g=SIMD.Float32x4.mul(p,d);m=SIMD.Float32x4.mul(k,d);
d=SIMD.Float32x4.swizzle(d,2,3,0,1);g=SIMD.Float32x4.sub(SIMD.Float32x4.mul(p,d),g);m=SIMD.Float32x4.sub(SIMD.Float32x4.mul(k,d),m);m=SIMD.Float32x4.swizzle(m,2,3,0,1);d=SIMD.Float32x4.mul(p,e);d=SIMD.Float32x4.swizzle(d,1,0,3,2);g=SIMD.Float32x4.add(SIMD.Float32x4.mul(b,d),g);h=SIMD.Float32x4.mul(k,d);d=SIMD.Float32x4.swizzle(d,2,3,0,1);g=SIMD.Float32x4.sub(g,SIMD.Float32x4.mul(b,d));h=SIMD.Float32x4.sub(SIMD.Float32x4.mul(k,d),h);h=SIMD.Float32x4.swizzle(h,2,3,0,1);d=SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(p,
2,3,0,1),b);d=SIMD.Float32x4.swizzle(d,1,0,3,2);e=SIMD.Float32x4.swizzle(e,2,3,0,1);g=SIMD.Float32x4.add(SIMD.Float32x4.mul(e,d),g);f=SIMD.Float32x4.mul(k,d);d=SIMD.Float32x4.swizzle(d,2,3,0,1);g=SIMD.Float32x4.sub(g,SIMD.Float32x4.mul(e,d));f=SIMD.Float32x4.sub(SIMD.Float32x4.mul(k,d),f);f=SIMD.Float32x4.swizzle(f,2,3,0,1);d=SIMD.Float32x4.mul(k,p);d=SIMD.Float32x4.swizzle(d,1,0,3,2);f=SIMD.Float32x4.add(SIMD.Float32x4.mul(b,d),f);h=SIMD.Float32x4.sub(SIMD.Float32x4.mul(e,d),h);d=SIMD.Float32x4.swizzle(d,
2,3,0,1);f=SIMD.Float32x4.sub(SIMD.Float32x4.mul(b,d),f);h=SIMD.Float32x4.sub(h,SIMD.Float32x4.mul(e,d));d=SIMD.Float32x4.mul(k,b);d=SIMD.Float32x4.swizzle(d,1,0,3,2);m=SIMD.Float32x4.sub(m,SIMD.Float32x4.mul(e,d));f=SIMD.Float32x4.add(SIMD.Float32x4.mul(p,d),f);d=SIMD.Float32x4.swizzle(d,2,3,0,1);m=SIMD.Float32x4.add(SIMD.Float32x4.mul(e,d),m);f=SIMD.Float32x4.sub(f,SIMD.Float32x4.mul(p,d));d=SIMD.Float32x4.mul(k,e);d=SIMD.Float32x4.swizzle(d,1,0,3,2);m=SIMD.Float32x4.add(SIMD.Float32x4.mul(b,d),
m);h=SIMD.Float32x4.sub(h,SIMD.Float32x4.mul(p,d));d=SIMD.Float32x4.swizzle(d,2,3,0,1);m=SIMD.Float32x4.sub(m,SIMD.Float32x4.mul(b,d));h=SIMD.Float32x4.add(SIMD.Float32x4.mul(p,d),h);SIMD.Float32x4.store(a,0,g);SIMD.Float32x4.store(a,4,m);SIMD.Float32x4.store(a,8,f);SIMD.Float32x4.store(a,12,h);return a};b.adjoint=l.USE_SIMD?b.SIMD.adjoint:b.scalar.adjoint;b.determinant=function(a){var c=a[0],e=a[1],b=a[2],g=a[3],m=a[4],k=a[5],d=a[6],f=a[7],h=a[8],l=a[9],w=a[10],q=a[11],u=a[12],C=a[13],y=a[14];a=
a[15];return(c*k-e*m)*(w*a-q*y)-(c*d-b*m)*(l*a-q*C)+(c*f-g*m)*(l*y-w*C)+(e*d-b*k)*(h*a-q*u)-(e*f-g*k)*(h*y-w*u)+(b*f-g*d)*(h*C-l*u)};b.SIMD.multiply=function(a,c,e){var b=SIMD.Float32x4.load(c,0),g=SIMD.Float32x4.load(c,4),m=SIMD.Float32x4.load(c,8);c=SIMD.Float32x4.load(c,12);var k=SIMD.Float32x4.load(e,0),k=SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(k,0,0,0,0),b),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(k,1,1,1,1),g),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(k,
2,2,2,2),m),SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(k,3,3,3,3),c))));SIMD.Float32x4.store(a,0,k);k=SIMD.Float32x4.load(e,4);k=SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(k,0,0,0,0),b),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(k,1,1,1,1),g),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(k,2,2,2,2),m),SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(k,3,3,3,3),c))));SIMD.Float32x4.store(a,4,k);k=SIMD.Float32x4.load(e,8);k=SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(k,
0,0,0,0),b),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(k,1,1,1,1),g),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(k,2,2,2,2),m),SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(k,3,3,3,3),c))));SIMD.Float32x4.store(a,8,k);e=SIMD.Float32x4.load(e,12);b=SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(e,0,0,0,0),b),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(e,1,1,1,1),g),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(e,2,2,2,2),
m),SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(e,3,3,3,3),c))));SIMD.Float32x4.store(a,12,b);return a};b.scalar.multiply=function(a,c,e){var b=c[0],g=c[1],m=c[2],k=c[3],d=c[4],f=c[5],h=c[6],l=c[7],w=c[8],q=c[9],u=c[10],C=c[11],y=c[12],B=c[13],F=c[14];c=c[15];var H=e[0],I=e[1],J=e[2],v=e[3];a[0]=H*b+I*d+J*w+v*y;a[1]=H*g+I*f+J*q+v*B;a[2]=H*m+I*h+J*u+v*F;a[3]=H*k+I*l+J*C+v*c;H=e[4];I=e[5];J=e[6];v=e[7];a[4]=H*b+I*d+J*w+v*y;a[5]=H*g+I*f+J*q+v*B;a[6]=H*m+I*h+J*u+v*F;a[7]=H*k+I*l+J*C+v*c;H=e[8];I=e[9];J=
e[10];v=e[11];a[8]=H*b+I*d+J*w+v*y;a[9]=H*g+I*f+J*q+v*B;a[10]=H*m+I*h+J*u+v*F;a[11]=H*k+I*l+J*C+v*c;H=e[12];I=e[13];J=e[14];v=e[15];a[12]=H*b+I*d+J*w+v*y;a[13]=H*g+I*f+J*q+v*B;a[14]=H*m+I*h+J*u+v*F;a[15]=H*k+I*l+J*C+v*c;return a};b.multiply=l.USE_SIMD?b.SIMD.multiply:b.scalar.multiply;b.mul=b.multiply;b.scalar.translate=function(a,c,e){var b=e[0],g=e[1];e=e[2];var m,k,d,f,h,l,w,q,u,C,y,B;c===a?(a[12]=c[0]*b+c[4]*g+c[8]*e+c[12],a[13]=c[1]*b+c[5]*g+c[9]*e+c[13],a[14]=c[2]*b+c[6]*g+c[10]*e+c[14],a[15]=
c[3]*b+c[7]*g+c[11]*e+c[15]):(m=c[0],k=c[1],d=c[2],f=c[3],h=c[4],l=c[5],w=c[6],q=c[7],u=c[8],C=c[9],y=c[10],B=c[11],a[0]=m,a[1]=k,a[2]=d,a[3]=f,a[4]=h,a[5]=l,a[6]=w,a[7]=q,a[8]=u,a[9]=C,a[10]=y,a[11]=B,a[12]=m*b+h*g+u*e+c[12],a[13]=k*b+l*g+C*e+c[13],a[14]=d*b+w*g+y*e+c[14],a[15]=f*b+q*g+B*e+c[15]);return a};b.SIMD.translate=function(a,c,e){var b=SIMD.Float32x4.load(c,0),g=SIMD.Float32x4.load(c,4),m=SIMD.Float32x4.load(c,8),k=SIMD.Float32x4.load(c,12);e=SIMD.Float32x4(e[0],e[1],e[2],0);c!==a&&(a[0]=
c[0],a[1]=c[1],a[2]=c[2],a[3]=c[3],a[4]=c[4],a[5]=c[5],a[6]=c[6],a[7]=c[7],a[8]=c[8],a[9]=c[9],a[10]=c[10],a[11]=c[11]);b=SIMD.Float32x4.mul(b,SIMD.Float32x4.swizzle(e,0,0,0,0));g=SIMD.Float32x4.mul(g,SIMD.Float32x4.swizzle(e,1,1,1,1));m=SIMD.Float32x4.mul(m,SIMD.Float32x4.swizzle(e,2,2,2,2));c=SIMD.Float32x4.add(b,SIMD.Float32x4.add(g,SIMD.Float32x4.add(m,k)));SIMD.Float32x4.store(a,12,c);return a};b.translate=l.USE_SIMD?b.SIMD.translate:b.scalar.translate;b.scalar.scale=function(a,c,e){var b=e[0],
g=e[1];e=e[2];a[0]=c[0]*b;a[1]=c[1]*b;a[2]=c[2]*b;a[3]=c[3]*b;a[4]=c[4]*g;a[5]=c[5]*g;a[6]=c[6]*g;a[7]=c[7]*g;a[8]=c[8]*e;a[9]=c[9]*e;a[10]=c[10]*e;a[11]=c[11]*e;a[12]=c[12];a[13]=c[13];a[14]=c[14];a[15]=c[15];return a};b.SIMD.scale=function(a,c,e){var b;e=SIMD.Float32x4(e[0],e[1],e[2],0);b=SIMD.Float32x4.load(c,0);SIMD.Float32x4.store(a,0,SIMD.Float32x4.mul(b,SIMD.Float32x4.swizzle(e,0,0,0,0)));b=SIMD.Float32x4.load(c,4);SIMD.Float32x4.store(a,4,SIMD.Float32x4.mul(b,SIMD.Float32x4.swizzle(e,1,1,
1,1)));b=SIMD.Float32x4.load(c,8);SIMD.Float32x4.store(a,8,SIMD.Float32x4.mul(b,SIMD.Float32x4.swizzle(e,2,2,2,2)));a[12]=c[12];a[13]=c[13];a[14]=c[14];a[15]=c[15];return a};b.scale=l.USE_SIMD?b.SIMD.scale:b.scalar.scale;b.rotate=function(a,c,e,b){var g=b[0],m=b[1];b=b[2];var k=Math.sqrt(g*g+m*m+b*b),d,f,h,D,w,q,u,C,y,B,F,H,I,J,v,t,x,A,K,E;if(Math.abs(k)<l.EPSILON)return null;k=1/k;g*=k;m*=k;b*=k;d=Math.sin(e);f=Math.cos(e);h=1-f;e=c[0];k=c[1];D=c[2];w=c[3];q=c[4];u=c[5];C=c[6];y=c[7];B=c[8];F=c[9];
H=c[10];I=c[11];J=g*g*h+f;v=m*g*h+b*d;t=b*g*h-m*d;x=g*m*h-b*d;A=m*m*h+f;K=b*m*h+g*d;E=g*b*h+m*d;g=m*b*h-g*d;m=b*b*h+f;a[0]=e*J+q*v+B*t;a[1]=k*J+u*v+F*t;a[2]=D*J+C*v+H*t;a[3]=w*J+y*v+I*t;a[4]=e*x+q*A+B*K;a[5]=k*x+u*A+F*K;a[6]=D*x+C*A+H*K;a[7]=w*x+y*A+I*K;a[8]=e*E+q*g+B*m;a[9]=k*E+u*g+F*m;a[10]=D*E+C*g+H*m;a[11]=w*E+y*g+I*m;c!==a&&(a[12]=c[12],a[13]=c[13],a[14]=c[14],a[15]=c[15]);return a};b.scalar.rotateX=function(a,c,e){var b=Math.sin(e);e=Math.cos(e);var g=c[4],m=c[5],k=c[6],d=c[7],f=c[8],h=c[9],
l=c[10],w=c[11];c!==a&&(a[0]=c[0],a[1]=c[1],a[2]=c[2],a[3]=c[3],a[12]=c[12],a[13]=c[13],a[14]=c[14],a[15]=c[15]);a[4]=g*e+f*b;a[5]=m*e+h*b;a[6]=k*e+l*b;a[7]=d*e+w*b;a[8]=f*e-g*b;a[9]=h*e-m*b;a[10]=l*e-k*b;a[11]=w*e-d*b;return a};b.SIMD.rotateX=function(a,c,e){var b=SIMD.Float32x4.splat(Math.sin(e));e=SIMD.Float32x4.splat(Math.cos(e));c!==a&&(a[0]=c[0],a[1]=c[1],a[2]=c[2],a[3]=c[3],a[12]=c[12],a[13]=c[13],a[14]=c[14],a[15]=c[15]);var g=SIMD.Float32x4.load(c,4);c=SIMD.Float32x4.load(c,8);SIMD.Float32x4.store(a,
4,SIMD.Float32x4.add(SIMD.Float32x4.mul(g,e),SIMD.Float32x4.mul(c,b)));SIMD.Float32x4.store(a,8,SIMD.Float32x4.sub(SIMD.Float32x4.mul(c,e),SIMD.Float32x4.mul(g,b)));return a};b.rotateX=l.USE_SIMD?b.SIMD.rotateX:b.scalar.rotateX;b.scalar.rotateY=function(a,c,e){var b=Math.sin(e);e=Math.cos(e);var g=c[0],m=c[1],k=c[2],d=c[3],f=c[8],h=c[9],l=c[10],w=c[11];c!==a&&(a[4]=c[4],a[5]=c[5],a[6]=c[6],a[7]=c[7],a[12]=c[12],a[13]=c[13],a[14]=c[14],a[15]=c[15]);a[0]=g*e-f*b;a[1]=m*e-h*b;a[2]=k*e-l*b;a[3]=d*e-w*
b;a[8]=g*b+f*e;a[9]=m*b+h*e;a[10]=k*b+l*e;a[11]=d*b+w*e;return a};b.SIMD.rotateY=function(a,c,e){var b=SIMD.Float32x4.splat(Math.sin(e));e=SIMD.Float32x4.splat(Math.cos(e));c!==a&&(a[4]=c[4],a[5]=c[5],a[6]=c[6],a[7]=c[7],a[12]=c[12],a[13]=c[13],a[14]=c[14],a[15]=c[15]);var g=SIMD.Float32x4.load(c,0);c=SIMD.Float32x4.load(c,8);SIMD.Float32x4.store(a,0,SIMD.Float32x4.sub(SIMD.Float32x4.mul(g,e),SIMD.Float32x4.mul(c,b)));SIMD.Float32x4.store(a,8,SIMD.Float32x4.add(SIMD.Float32x4.mul(g,b),SIMD.Float32x4.mul(c,
e)));return a};b.rotateY=l.USE_SIMD?b.SIMD.rotateY:b.scalar.rotateY;b.scalar.rotateZ=function(a,c,e){var b=Math.sin(e);e=Math.cos(e);var g=c[0],m=c[1],k=c[2],d=c[3],f=c[4],h=c[5],l=c[6],w=c[7];c!==a&&(a[8]=c[8],a[9]=c[9],a[10]=c[10],a[11]=c[11],a[12]=c[12],a[13]=c[13],a[14]=c[14],a[15]=c[15]);a[0]=g*e+f*b;a[1]=m*e+h*b;a[2]=k*e+l*b;a[3]=d*e+w*b;a[4]=f*e-g*b;a[5]=h*e-m*b;a[6]=l*e-k*b;a[7]=w*e-d*b;return a};b.SIMD.rotateZ=function(a,c,e){var b=SIMD.Float32x4.splat(Math.sin(e));e=SIMD.Float32x4.splat(Math.cos(e));
c!==a&&(a[8]=c[8],a[9]=c[9],a[10]=c[10],a[11]=c[11],a[12]=c[12],a[13]=c[13],a[14]=c[14],a[15]=c[15]);var g=SIMD.Float32x4.load(c,0);c=SIMD.Float32x4.load(c,4);SIMD.Float32x4.store(a,0,SIMD.Float32x4.add(SIMD.Float32x4.mul(g,e),SIMD.Float32x4.mul(c,b)));SIMD.Float32x4.store(a,4,SIMD.Float32x4.sub(SIMD.Float32x4.mul(c,e),SIMD.Float32x4.mul(g,b)));return a};b.rotateZ=l.USE_SIMD?b.SIMD.rotateZ:b.scalar.rotateZ;b.fromTranslation=function(a,c){a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=1;a[6]=0;a[7]=0;a[8]=
0;a[9]=0;a[10]=1;a[11]=0;a[12]=c[0];a[13]=c[1];a[14]=c[2];a[15]=1;return a};b.fromScaling=function(a,c){a[0]=c[0];a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=c[1];a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=c[2];a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};b.fromRotation=function(a,c,e){var b=e[0],g=e[1];e=e[2];var m=Math.sqrt(b*b+g*g+e*e),k;if(Math.abs(m)<l.EPSILON)return null;m=1/m;b*=m;g*=m;e*=m;m=Math.sin(c);c=Math.cos(c);k=1-c;a[0]=b*b*k+c;a[1]=g*b*k+e*m;a[2]=e*b*k-g*m;a[3]=0;a[4]=b*g*k-e*m;a[5]=g*g*k+c;a[6]=
e*g*k+b*m;a[7]=0;a[8]=b*e*k+g*m;a[9]=g*e*k-b*m;a[10]=e*e*k+c;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};b.fromXRotation=function(a,c){var e=Math.sin(c),b=Math.cos(c);a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=b;a[6]=e;a[7]=0;a[8]=0;a[9]=-e;a[10]=b;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};b.fromYRotation=function(a,c){var e=Math.sin(c),b=Math.cos(c);a[0]=b;a[1]=0;a[2]=-e;a[3]=0;a[4]=0;a[5]=1;a[6]=0;a[7]=0;a[8]=e;a[9]=0;a[10]=b;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};b.fromZRotation=
function(a,c){var e=Math.sin(c),b=Math.cos(c);a[0]=b;a[1]=e;a[2]=0;a[3]=0;a[4]=-e;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};b.fromRotationTranslation=function(a,c,e){var b=c[0],g=c[1],m=c[2],k=c[3],d=b+b,f=g+g,h=m+m;c=b*d;var l=b*f,b=b*h,w=g*f,g=g*h,m=m*h,d=k*d,f=k*f,k=k*h;a[0]=1-(w+m);a[1]=l+k;a[2]=b-f;a[3]=0;a[4]=l-k;a[5]=1-(c+m);a[6]=g+d;a[7]=0;a[8]=b+f;a[9]=g-d;a[10]=1-(c+w);a[11]=0;a[12]=e[0];a[13]=e[1];a[14]=e[2];a[15]=1;return a};b.getTranslation=
function(a,c){a[0]=c[12];a[1]=c[13];a[2]=c[14];return a};b.getRotation=function(a,c){var e=c[0]+c[5]+c[10],b=0;0<e?(b=2*Math.sqrt(e+1),a[3]=.25*b,a[0]=(c[6]-c[9])/b,a[1]=(c[8]-c[2])/b,a[2]=(c[1]-c[4])/b):c[0]>c[5]&c[0]>c[10]?(b=2*Math.sqrt(1+c[0]-c[5]-c[10]),a[3]=(c[6]-c[9])/b,a[0]=.25*b,a[1]=(c[1]+c[4])/b,a[2]=(c[8]+c[2])/b):c[5]>c[10]?(b=2*Math.sqrt(1+c[5]-c[0]-c[10]),a[3]=(c[8]-c[2])/b,a[0]=(c[1]+c[4])/b,a[1]=.25*b,a[2]=(c[6]+c[9])/b):(b=2*Math.sqrt(1+c[10]-c[0]-c[5]),a[3]=(c[1]-c[4])/b,a[0]=(c[8]+
c[2])/b,a[1]=(c[6]+c[9])/b,a[2]=.25*b);return a};b.fromRotationTranslationScale=function(a,c,e,b){var g=c[0],m=c[1],k=c[2],d=c[3],f=g+g,h=m+m,l=k+k;c=g*f;var w=g*h,g=g*l,q=m*h,m=m*l,k=k*l,f=d*f,h=d*h,d=d*l,l=b[0],u=b[1];b=b[2];a[0]=(1-(q+k))*l;a[1]=(w+d)*l;a[2]=(g-h)*l;a[3]=0;a[4]=(w-d)*u;a[5]=(1-(c+k))*u;a[6]=(m+f)*u;a[7]=0;a[8]=(g+h)*b;a[9]=(m-f)*b;a[10]=(1-(c+q))*b;a[11]=0;a[12]=e[0];a[13]=e[1];a[14]=e[2];a[15]=1;return a};b.fromRotationTranslationScaleOrigin=function(a,c,e,b,g){var m=c[0],k=c[1],
d=c[2],f=c[3],h=m+m,l=k+k,w=d+d;c=m*h;var q=m*l,m=m*w,u=k*l,k=k*w,d=d*w,h=f*h,l=f*l,f=f*w,w=b[0],C=b[1];b=b[2];var y=g[0],B=g[1];g=g[2];a[0]=(1-(u+d))*w;a[1]=(q+f)*w;a[2]=(m-l)*w;a[3]=0;a[4]=(q-f)*C;a[5]=(1-(c+d))*C;a[6]=(k+h)*C;a[7]=0;a[8]=(m+l)*b;a[9]=(k-h)*b;a[10]=(1-(c+u))*b;a[11]=0;a[12]=e[0]+y-(a[0]*y+a[4]*B+a[8]*g);a[13]=e[1]+B-(a[1]*y+a[5]*B+a[9]*g);a[14]=e[2]+g-(a[2]*y+a[6]*B+a[10]*g);a[15]=1;return a};b.fromQuat=function(a,c){var e=c[0],b=c[1],g=c[2],m=c[3],k=e+e,d=b+b,f=g+g,e=e*k,h=b*k,
b=b*d,l=g*k,w=g*d,g=g*f,k=m*k,d=m*d,m=m*f;a[0]=1-b-g;a[1]=h+m;a[2]=l-d;a[3]=0;a[4]=h-m;a[5]=1-e-g;a[6]=w+k;a[7]=0;a[8]=l+d;a[9]=w-k;a[10]=1-e-b;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};b.frustum=function(a,c,e,b,g,m,k){var d=1/(e-c),f=1/(g-b),h=1/(m-k);a[0]=2*m*d;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=2*m*f;a[6]=0;a[7]=0;a[8]=(e+c)*d;a[9]=(g+b)*f;a[10]=(k+m)*h;a[11]=-1;a[12]=0;a[13]=0;a[14]=k*m*2*h;a[15]=0;return a};b.perspective=function(a,c,e,b,g){c=1/Math.tan(c/2);var m=1/(b-g);a[0]=c/e;a[1]=
0;a[2]=0;a[3]=0;a[4]=0;a[5]=c;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=(g+b)*m;a[11]=-1;a[12]=0;a[13]=0;a[14]=2*g*b*m;a[15]=0;return a};b.perspectiveFromFieldOfView=function(a,c,e,b){var g=Math.tan(c.upDegrees*Math.PI/180),m=Math.tan(c.downDegrees*Math.PI/180),k=Math.tan(c.leftDegrees*Math.PI/180);c=Math.tan(c.rightDegrees*Math.PI/180);var d=2/(k+c),f=2/(g+m);a[0]=d;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=f;a[6]=0;a[7]=0;a[8]=-((k-c)*d*.5);a[9]=(g-m)*f*.5;a[10]=b/(e-b);a[11]=-1;a[12]=0;a[13]=0;a[14]=b*e/(e-b);
a[15]=0;return a};b.ortho=function(a,c,e,b,g,m,k){var d=1/(c-e),f=1/(b-g),h=1/(m-k);a[0]=-2*d;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=-2*f;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=2*h;a[11]=0;a[12]=(c+e)*d;a[13]=(g+b)*f;a[14]=(k+m)*h;a[15]=1;return a};b.lookAt=function(a,c,e,n){var g,m,k,d,f,h,D,w,q=c[0],u=c[1];c=c[2];k=n[0];d=n[1];m=n[2];D=e[0];n=e[1];g=e[2];if(Math.abs(q-D)<l.EPSILON&&Math.abs(u-n)<l.EPSILON&&Math.abs(c-g)<l.EPSILON)return b.identity(a);e=q-D;n=u-n;D=c-g;w=1/Math.sqrt(e*e+n*n+D*D);e*=w;n*=w;
D*=w;g=d*D-m*n;m=m*e-k*D;k=k*n-d*e;(w=Math.sqrt(g*g+m*m+k*k))?(w=1/w,g*=w,m*=w,k*=w):k=m=g=0;d=n*k-D*m;f=D*g-e*k;h=e*m-n*g;(w=Math.sqrt(d*d+f*f+h*h))?(w=1/w,d*=w,f*=w,h*=w):h=f=d=0;a[0]=g;a[1]=d;a[2]=e;a[3]=0;a[4]=m;a[5]=f;a[6]=n;a[7]=0;a[8]=k;a[9]=h;a[10]=D;a[11]=0;a[12]=-(g*q+m*u+k*c);a[13]=-(d*q+f*u+h*c);a[14]=-(e*q+n*u+D*c);a[15]=1;return a};b.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]+")"};b.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))};b.add=function(a,c,e){a[0]=c[0]+e[0];a[1]=c[1]+e[1];a[2]=c[2]+e[2];a[3]=c[3]+e[3];a[4]=c[4]+e[4];a[5]=c[5]+e[5];a[6]=c[6]+e[6];a[7]=c[7]+e[7];
a[8]=c[8]+e[8];a[9]=c[9]+e[9];a[10]=c[10]+e[10];a[11]=c[11]+e[11];a[12]=c[12]+e[12];a[13]=c[13]+e[13];a[14]=c[14]+e[14];a[15]=c[15]+e[15];return a};b.subtract=function(a,c,e){a[0]=c[0]-e[0];a[1]=c[1]-e[1];a[2]=c[2]-e[2];a[3]=c[3]-e[3];a[4]=c[4]-e[4];a[5]=c[5]-e[5];a[6]=c[6]-e[6];a[7]=c[7]-e[7];a[8]=c[8]-e[8];a[9]=c[9]-e[9];a[10]=c[10]-e[10];a[11]=c[11]-e[11];a[12]=c[12]-e[12];a[13]=c[13]-e[13];a[14]=c[14]-e[14];a[15]=c[15]-e[15];return a};b.sub=b.subtract;b.multiplyScalar=function(a,c,e){a[0]=c[0]*
e;a[1]=c[1]*e;a[2]=c[2]*e;a[3]=c[3]*e;a[4]=c[4]*e;a[5]=c[5]*e;a[6]=c[6]*e;a[7]=c[7]*e;a[8]=c[8]*e;a[9]=c[9]*e;a[10]=c[10]*e;a[11]=c[11]*e;a[12]=c[12]*e;a[13]=c[13]*e;a[14]=c[14]*e;a[15]=c[15]*e;return a};b.multiplyScalarAndAdd=function(a,c,e,b){a[0]=c[0]+e[0]*b;a[1]=c[1]+e[1]*b;a[2]=c[2]+e[2]*b;a[3]=c[3]+e[3]*b;a[4]=c[4]+e[4]*b;a[5]=c[5]+e[5]*b;a[6]=c[6]+e[6]*b;a[7]=c[7]+e[7]*b;a[8]=c[8]+e[8]*b;a[9]=c[9]+e[9]*b;a[10]=c[10]+e[10]*b;a[11]=c[11]+e[11]*b;a[12]=c[12]+e[12]*b;a[13]=c[13]+e[13]*b;a[14]=
c[14]+e[14]*b;a[15]=c[15]+e[15]*b;return a};b.exactEquals=function(a,c){return a[0]===c[0]&&a[1]===c[1]&&a[2]===c[2]&&a[3]===c[3]&&a[4]===c[4]&&a[5]===c[5]&&a[6]===c[6]&&a[7]===c[7]&&a[8]===c[8]&&a[9]===c[9]&&a[10]===c[10]&&a[11]===c[11]&&a[12]===c[12]&&a[13]===c[13]&&a[14]===c[14]&&a[15]===c[15]};b.equals=function(a,c){var e=a[0],b=a[1],g=a[2],m=a[3],d=a[4],f=a[5],h=a[6],z=a[7],D=a[8],w=a[9],q=a[10],u=a[11],C=a[12],y=a[13],B=a[14],F=a[15],H=c[0],I=c[1],J=c[2],v=c[3],t=c[4],x=c[5],A=c[6],K=c[7],E=
c[8],G=c[9],O=c[10],Q=c[11],M=c[12],L=c[13],S=c[14],T=c[15];return Math.abs(e-H)<=l.EPSILON*Math.max(1,Math.abs(e),Math.abs(H))&&Math.abs(b-I)<=l.EPSILON*Math.max(1,Math.abs(b),Math.abs(I))&&Math.abs(g-J)<=l.EPSILON*Math.max(1,Math.abs(g),Math.abs(J))&&Math.abs(m-v)<=l.EPSILON*Math.max(1,Math.abs(m),Math.abs(v))&&Math.abs(d-t)<=l.EPSILON*Math.max(1,Math.abs(d),Math.abs(t))&&Math.abs(f-x)<=l.EPSILON*Math.max(1,Math.abs(f),Math.abs(x))&&Math.abs(h-A)<=l.EPSILON*Math.max(1,Math.abs(h),Math.abs(A))&&
Math.abs(z-K)<=l.EPSILON*Math.max(1,Math.abs(z),Math.abs(K))&&Math.abs(D-E)<=l.EPSILON*Math.max(1,Math.abs(D),Math.abs(E))&&Math.abs(w-G)<=l.EPSILON*Math.max(1,Math.abs(w),Math.abs(G))&&Math.abs(q-O)<=l.EPSILON*Math.max(1,Math.abs(q),Math.abs(O))&&Math.abs(u-Q)<=l.EPSILON*Math.max(1,Math.abs(u),Math.abs(Q))&&Math.abs(C-M)<=l.EPSILON*Math.max(1,Math.abs(C),Math.abs(M))&&Math.abs(y-L)<=l.EPSILON*Math.max(1,Math.abs(y),Math.abs(L))&&Math.abs(B-S)<=l.EPSILON*Math.max(1,Math.abs(B),Math.abs(S))&&Math.abs(F-
T)<=l.EPSILON*Math.max(1,Math.abs(F),Math.abs(T))};f.exports=b},function(f,d,h){var l=h(17),b=h(20),a=h(23);d=h(24);var c={create:function(){var a=new l.ARRAY_TYPE(4);a[0]=0;a[1]=0;a[2]=0;a[3]=1;return a}};c.rotationTo=function(){var e=a.create(),b=a.fromValues(1,0,0),g=a.fromValues(0,1,0);return function(m,d,f){var h=a.dot(d,f);if(-.999999>h)return a.cross(e,b,d),1E-6>a.length(e)&&a.cross(e,g,d),a.normalize(e,e),c.setAxisAngle(m,e,Math.PI),m;if(.999999<h)return m[0]=0,m[1]=0,m[2]=0,m[3]=1,m;a.cross(e,
d,f);m[0]=e[0];m[1]=e[1];m[2]=e[2];m[3]=1+h;return c.normalize(m,m)}}();c.setAxes=function(){var a=b.create();return function(b,g,d,k){a[0]=d[0];a[3]=d[1];a[6]=d[2];a[1]=k[0];a[4]=k[1];a[7]=k[2];a[2]=-g[0];a[5]=-g[1];a[8]=-g[2];return c.normalize(b,c.fromMat3(b,a))}}();c.clone=d.clone;c.fromValues=d.fromValues;c.copy=d.copy;c.set=d.set;c.identity=function(a){a[0]=0;a[1]=0;a[2]=0;a[3]=1;return a};c.setAxisAngle=function(a,c,b){b*=.5;var d=Math.sin(b);a[0]=d*c[0];a[1]=d*c[1];a[2]=d*c[2];a[3]=Math.cos(b);
return a};c.getAxisAngle=function(a,c){var b=2*Math.acos(c[3]),d=Math.sin(b/2);0!=d?(a[0]=c[0]/d,a[1]=c[1]/d,a[2]=c[2]/d):(a[0]=1,a[1]=0,a[2]=0);return b};c.add=d.add;c.multiply=function(a,c,b){var d=c[0],k=c[1],f=c[2];c=c[3];var h=b[0],l=b[1],D=b[2];b=b[3];a[0]=d*b+c*h+k*D-f*l;a[1]=k*b+c*l+f*h-d*D;a[2]=f*b+c*D+d*l-k*h;a[3]=c*b-d*h-k*l-f*D;return a};c.mul=c.multiply;c.scale=d.scale;c.rotateX=function(a,c,b){b*=.5;var d=c[0],k=c[1],f=c[2];c=c[3];var h=Math.sin(b);b=Math.cos(b);a[0]=d*b+c*h;a[1]=k*
b+f*h;a[2]=f*b-k*h;a[3]=c*b-d*h;return a};c.rotateY=function(a,c,b){b*=.5;var d=c[0],k=c[1],f=c[2];c=c[3];var h=Math.sin(b);b=Math.cos(b);a[0]=d*b-f*h;a[1]=k*b+c*h;a[2]=f*b+d*h;a[3]=c*b-k*h;return a};c.rotateZ=function(a,c,b){b*=.5;var d=c[0],k=c[1],f=c[2];c=c[3];var h=Math.sin(b);b=Math.cos(b);a[0]=d*b+k*h;a[1]=k*b-d*h;a[2]=f*b+c*h;a[3]=c*b-f*h;return a};c.calculateW=function(a,c){var b=c[0],d=c[1],k=c[2];a[0]=b;a[1]=d;a[2]=k;a[3]=Math.sqrt(Math.abs(1-b*b-d*d-k*k));return a};c.dot=d.dot;c.lerp=d.lerp;
c.slerp=function(a,c,b,d){var k=c[0],f=c[1],h=c[2];c=c[3];var l=b[0],D=b[1],w=b[2];b=b[3];var q,u,C;u=k*l+f*D+h*w+c*b;0>u&&(u=-u,l=-l,D=-D,w=-w,b=-b);1E-6<1-u?(q=Math.acos(u),C=Math.sin(q),u=Math.sin((1-d)*q)/C,d=Math.sin(d*q)/C):u=1-d;a[0]=u*k+d*l;a[1]=u*f+d*D;a[2]=u*h+d*w;a[3]=u*c+d*b;return a};c.sqlerp=function(){var a=c.create(),b=c.create();return function(d,m,k,f,h,l){c.slerp(a,m,h,l);c.slerp(b,k,f,l);c.slerp(d,a,b,2*l*(1-l));return d}}();c.invert=function(a,c){var b=c[0],d=c[1],k=c[2],f=c[3],
h=b*b+d*d+k*k+f*f,h=h?1/h:0;a[0]=-b*h;a[1]=-d*h;a[2]=-k*h;a[3]=f*h;return a};c.conjugate=function(a,c){a[0]=-c[0];a[1]=-c[1];a[2]=-c[2];a[3]=c[3];return a};c.length=d.length;c.len=c.length;c.squaredLength=d.squaredLength;c.sqrLen=c.squaredLength;c.normalize=d.normalize;c.fromMat3=function(a,c){var b=c[0]+c[4]+c[8];if(0<b)b=Math.sqrt(b+1),a[3]=.5*b,b=.5/b,a[0]=(c[5]-c[7])*b,a[1]=(c[6]-c[2])*b,a[2]=(c[1]-c[3])*b;else{var d=0;c[4]>c[0]&&(d=1);c[8]>c[3*d+d]&&(d=2);var k=(d+1)%3,f=(d+2)%3,b=Math.sqrt(c[3*
d+d]-c[3*k+k]-c[3*f+f]+1);a[d]=.5*b;b=.5/b;a[3]=(c[3*k+f]-c[3*f+k])*b;a[k]=(c[3*k+d]+c[3*d+k])*b;a[f]=(c[3*f+d]+c[3*d+f])*b}return a};c.str=function(a){return"quat("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"};c.exactEquals=d.exactEquals;c.equals=d.equals;f.exports=c},function(f,d,h){var l=h(17),b={create:function(){var a=new l.ARRAY_TYPE(3);a[0]=0;a[1]=0;a[2]=0;return a},clone:function(a){var c=new l.ARRAY_TYPE(3);c[0]=a[0];c[1]=a[1];c[2]=a[2];return c},fromValues:function(a,c,b){var d=new l.ARRAY_TYPE(3);
d[0]=a;d[1]=c;d[2]=b;return d},copy:function(a,c){a[0]=c[0];a[1]=c[1];a[2]=c[2];return a},set:function(a,c,b,d){a[0]=c;a[1]=b;a[2]=d;return a},add:function(a,c,b){a[0]=c[0]+b[0];a[1]=c[1]+b[1];a[2]=c[2]+b[2];return a},subtract:function(a,c,b){a[0]=c[0]-b[0];a[1]=c[1]-b[1];a[2]=c[2]-b[2];return a}};b.sub=b.subtract;b.multiply=function(a,c,b){a[0]=c[0]*b[0];a[1]=c[1]*b[1];a[2]=c[2]*b[2];return a};b.mul=b.multiply;b.divide=function(a,c,b){a[0]=c[0]/b[0];a[1]=c[1]/b[1];a[2]=c[2]/b[2];return a};b.div=
b.divide;b.ceil=function(a,c){a[0]=Math.ceil(c[0]);a[1]=Math.ceil(c[1]);a[2]=Math.ceil(c[2]);return a};b.floor=function(a,c){a[0]=Math.floor(c[0]);a[1]=Math.floor(c[1]);a[2]=Math.floor(c[2]);return a};b.min=function(a,c,b){a[0]=Math.min(c[0],b[0]);a[1]=Math.min(c[1],b[1]);a[2]=Math.min(c[2],b[2]);return a};b.max=function(a,c,b){a[0]=Math.max(c[0],b[0]);a[1]=Math.max(c[1],b[1]);a[2]=Math.max(c[2],b[2]);return a};b.round=function(a,c){a[0]=Math.round(c[0]);a[1]=Math.round(c[1]);a[2]=Math.round(c[2]);
return a};b.scale=function(a,c,b){a[0]=c[0]*b;a[1]=c[1]*b;a[2]=c[2]*b;return a};b.scaleAndAdd=function(a,c,b,d){a[0]=c[0]+b[0]*d;a[1]=c[1]+b[1]*d;a[2]=c[2]+b[2]*d;return a};b.distance=function(a,c){var b=c[0]-a[0],d=c[1]-a[1],g=c[2]-a[2];return Math.sqrt(b*b+d*d+g*g)};b.dist=b.distance;b.squaredDistance=function(a,c){var b=c[0]-a[0],d=c[1]-a[1],g=c[2]-a[2];return b*b+d*d+g*g};b.sqrDist=b.squaredDistance;b.length=function(a){var c=a[0],b=a[1];a=a[2];return Math.sqrt(c*c+b*b+a*a)};b.len=b.length;b.squaredLength=
function(a){var c=a[0],b=a[1];a=a[2];return c*c+b*b+a*a};b.sqrLen=b.squaredLength;b.negate=function(a,c){a[0]=-c[0];a[1]=-c[1];a[2]=-c[2];return a};b.inverse=function(a,c){a[0]=1/c[0];a[1]=1/c[1];a[2]=1/c[2];return a};b.normalize=function(a,c){var b=c[0],d=c[1],g=c[2],b=b*b+d*d+g*g;0<b&&(b=1/Math.sqrt(b),a[0]=c[0]*b,a[1]=c[1]*b,a[2]=c[2]*b);return a};b.dot=function(a,c){return a[0]*c[0]+a[1]*c[1]+a[2]*c[2]};b.cross=function(a,c,b){var d=c[0],g=c[1];c=c[2];var m=b[0],k=b[1];b=b[2];a[0]=g*b-c*k;a[1]=
c*m-d*b;a[2]=d*k-g*m;return a};b.lerp=function(a,c,b,d){var g=c[0],m=c[1];c=c[2];a[0]=g+d*(b[0]-g);a[1]=m+d*(b[1]-m);a[2]=c+d*(b[2]-c);return a};b.hermite=function(a,c,b,d,g,m){var k=m*m,f=k*(2*m-3)+1,h=k*(m-2)+m,l=k*(m-1);m=k*(3-2*m);a[0]=c[0]*f+b[0]*h+d[0]*l+g[0]*m;a[1]=c[1]*f+b[1]*h+d[1]*l+g[1]*m;a[2]=c[2]*f+b[2]*h+d[2]*l+g[2]*m;return a};b.bezier=function(a,c,b,d,g,m){var k=1-m,f=k*k,h=m*m,l=f*k,f=3*m*f,k=3*h*k;m*=h;a[0]=c[0]*l+b[0]*f+d[0]*k+g[0]*m;a[1]=c[1]*l+b[1]*f+d[1]*k+g[1]*m;a[2]=c[2]*l+
b[2]*f+d[2]*k+g[2]*m;return a};b.random=function(a,c){c=c||1;var b=2*l.RANDOM()*Math.PI,d=2*l.RANDOM()-1,g=Math.sqrt(1-d*d)*c;a[0]=Math.cos(b)*g;a[1]=Math.sin(b)*g;a[2]=d*c;return a};b.transformMat4=function(a,c,b){var d=c[0],g=c[1];c=c[2];var m=b[3]*d+b[7]*g+b[11]*c+b[15],m=m||1;a[0]=(b[0]*d+b[4]*g+b[8]*c+b[12])/m;a[1]=(b[1]*d+b[5]*g+b[9]*c+b[13])/m;a[2]=(b[2]*d+b[6]*g+b[10]*c+b[14])/m;return a};b.transformMat3=function(a,c,b){var d=c[0],g=c[1];c=c[2];a[0]=d*b[0]+g*b[3]+c*b[6];a[1]=d*b[1]+g*b[4]+
c*b[7];a[2]=d*b[2]+g*b[5]+c*b[8];return a};b.transformQuat=function(a,c,b){var d=c[0],g=c[1],m=c[2];c=b[0];var k=b[1],f=b[2];b=b[3];var h=b*d+k*m-f*g,l=b*g+f*d-c*m,D=b*m+c*g-k*d,d=-c*d-k*g-f*m;a[0]=h*b+d*-c+l*-f-D*-k;a[1]=l*b+d*-k+D*-c-h*-f;a[2]=D*b+d*-f+h*-k-l*-c;return a};b.rotateX=function(a,c,b,d){var g=[],m=[];g[0]=c[0]-b[0];g[1]=c[1]-b[1];g[2]=c[2]-b[2];m[0]=g[0];m[1]=g[1]*Math.cos(d)-g[2]*Math.sin(d);m[2]=g[1]*Math.sin(d)+g[2]*Math.cos(d);a[0]=m[0]+b[0];a[1]=m[1]+b[1];a[2]=m[2]+b[2];return a};
b.rotateY=function(a,c,b,d){var g=[],m=[];g[0]=c[0]-b[0];g[1]=c[1]-b[1];g[2]=c[2]-b[2];m[0]=g[2]*Math.sin(d)+g[0]*Math.cos(d);m[1]=g[1];m[2]=g[2]*Math.cos(d)-g[0]*Math.sin(d);a[0]=m[0]+b[0];a[1]=m[1]+b[1];a[2]=m[2]+b[2];return a};b.rotateZ=function(a,c,b,d){var g=[],m=[];g[0]=c[0]-b[0];g[1]=c[1]-b[1];g[2]=c[2]-b[2];m[0]=g[0]*Math.cos(d)-g[1]*Math.sin(d);m[1]=g[0]*Math.sin(d)+g[1]*Math.cos(d);m[2]=g[2];a[0]=m[0]+b[0];a[1]=m[1]+b[1];a[2]=m[2]+b[2];return a};b.forEach=function(){var a=b.create();return function(c,
b,d,g,m,k){b||(b=3);d||(d=0);for(g=g?Math.min(g*b+d,c.length):c.length;d<g;d+=b)a[0]=c[d],a[1]=c[d+1],a[2]=c[d+2],m(a,a,k),c[d]=a[0],c[d+1]=a[1],c[d+2]=a[2];return c}}();b.angle=function(a,c){var e=b.fromValues(a[0],a[1],a[2]),d=b.fromValues(c[0],c[1],c[2]);b.normalize(e,e);b.normalize(d,d);e=b.dot(e,d);return 1<e?0:Math.acos(e)};b.str=function(a){return"vec3("+a[0]+", "+a[1]+", "+a[2]+")"};b.exactEquals=function(a,c){return a[0]===c[0]&&a[1]===c[1]&&a[2]===c[2]};b.equals=function(a,c){var b=a[0],
d=a[1],g=a[2],m=c[0],k=c[1],f=c[2];return Math.abs(b-m)<=l.EPSILON*Math.max(1,Math.abs(b),Math.abs(m))&&Math.abs(d-k)<=l.EPSILON*Math.max(1,Math.abs(d),Math.abs(k))&&Math.abs(g-f)<=l.EPSILON*Math.max(1,Math.abs(g),Math.abs(f))};f.exports=b},function(f,d,h){var l=h(17),b={create:function(){var a=new l.ARRAY_TYPE(4);a[0]=0;a[1]=0;a[2]=0;a[3]=0;return a},clone:function(a){var c=new l.ARRAY_TYPE(4);c[0]=a[0];c[1]=a[1];c[2]=a[2];c[3]=a[3];return c},fromValues:function(a,c,b,d){var g=new l.ARRAY_TYPE(4);
g[0]=a;g[1]=c;g[2]=b;g[3]=d;return g},copy:function(a,c){a[0]=c[0];a[1]=c[1];a[2]=c[2];a[3]=c[3];return a},set:function(a,c,b,d,g){a[0]=c;a[1]=b;a[2]=d;a[3]=g;return a},add:function(a,c,b){a[0]=c[0]+b[0];a[1]=c[1]+b[1];a[2]=c[2]+b[2];a[3]=c[3]+b[3];return a},subtract:function(a,c,b){a[0]=c[0]-b[0];a[1]=c[1]-b[1];a[2]=c[2]-b[2];a[3]=c[3]-b[3];return a}};b.sub=b.subtract;b.multiply=function(a,c,b){a[0]=c[0]*b[0];a[1]=c[1]*b[1];a[2]=c[2]*b[2];a[3]=c[3]*b[3];return a};b.mul=b.multiply;b.divide=function(a,
c,b){a[0]=c[0]/b[0];a[1]=c[1]/b[1];a[2]=c[2]/b[2];a[3]=c[3]/b[3];return a};b.div=b.divide;b.ceil=function(a,c){a[0]=Math.ceil(c[0]);a[1]=Math.ceil(c[1]);a[2]=Math.ceil(c[2]);a[3]=Math.ceil(c[3]);return a};b.floor=function(a,c){a[0]=Math.floor(c[0]);a[1]=Math.floor(c[1]);a[2]=Math.floor(c[2]);a[3]=Math.floor(c[3]);return a};b.min=function(a,c,b){a[0]=Math.min(c[0],b[0]);a[1]=Math.min(c[1],b[1]);a[2]=Math.min(c[2],b[2]);a[3]=Math.min(c[3],b[3]);return a};b.max=function(a,c,b){a[0]=Math.max(c[0],b[0]);
a[1]=Math.max(c[1],b[1]);a[2]=Math.max(c[2],b[2]);a[3]=Math.max(c[3],b[3]);return a};b.round=function(a,c){a[0]=Math.round(c[0]);a[1]=Math.round(c[1]);a[2]=Math.round(c[2]);a[3]=Math.round(c[3]);return a};b.scale=function(a,c,b){a[0]=c[0]*b;a[1]=c[1]*b;a[2]=c[2]*b;a[3]=c[3]*b;return a};b.scaleAndAdd=function(a,c,b,d){a[0]=c[0]+b[0]*d;a[1]=c[1]+b[1]*d;a[2]=c[2]+b[2]*d;a[3]=c[3]+b[3]*d;return a};b.distance=function(a,c){var b=c[0]-a[0],d=c[1]-a[1],g=c[2]-a[2],m=c[3]-a[3];return Math.sqrt(b*b+d*d+g*
g+m*m)};b.dist=b.distance;b.squaredDistance=function(a,c){var b=c[0]-a[0],d=c[1]-a[1],g=c[2]-a[2],m=c[3]-a[3];return b*b+d*d+g*g+m*m};b.sqrDist=b.squaredDistance;b.length=function(a){var c=a[0],b=a[1],d=a[2];a=a[3];return Math.sqrt(c*c+b*b+d*d+a*a)};b.len=b.length;b.squaredLength=function(a){var c=a[0],b=a[1],d=a[2];a=a[3];return c*c+b*b+d*d+a*a};b.sqrLen=b.squaredLength;b.negate=function(a,c){a[0]=-c[0];a[1]=-c[1];a[2]=-c[2];a[3]=-c[3];return a};b.inverse=function(a,c){a[0]=1/c[0];a[1]=1/c[1];a[2]=
1/c[2];a[3]=1/c[3];return a};b.normalize=function(a,c){var b=c[0],d=c[1],g=c[2],m=c[3],k=b*b+d*d+g*g+m*m;0<k&&(k=1/Math.sqrt(k),a[0]=b*k,a[1]=d*k,a[2]=g*k,a[3]=m*k);return a};b.dot=function(a,c){return a[0]*c[0]+a[1]*c[1]+a[2]*c[2]+a[3]*c[3]};b.lerp=function(a,c,b,d){var g=c[0],m=c[1],k=c[2];c=c[3];a[0]=g+d*(b[0]-g);a[1]=m+d*(b[1]-m);a[2]=k+d*(b[2]-k);a[3]=c+d*(b[3]-c);return a};b.random=function(a,c){c=c||1;a[0]=l.RANDOM();a[1]=l.RANDOM();a[2]=l.RANDOM();a[3]=l.RANDOM();b.normalize(a,a);b.scale(a,
a,c);return a};b.transformMat4=function(a,c,b){var d=c[0],g=c[1],m=c[2];c=c[3];a[0]=b[0]*d+b[4]*g+b[8]*m+b[12]*c;a[1]=b[1]*d+b[5]*g+b[9]*m+b[13]*c;a[2]=b[2]*d+b[6]*g+b[10]*m+b[14]*c;a[3]=b[3]*d+b[7]*g+b[11]*m+b[15]*c;return a};b.transformQuat=function(a,c,b){var d=c[0],g=c[1],m=c[2],k=b[0],f=b[1],h=b[2];b=b[3];var l=b*d+f*m-h*g,D=b*g+h*d-k*m,w=b*m+k*g-f*d,d=-k*d-f*g-h*m;a[0]=l*b+d*-k+D*-h-w*-f;a[1]=D*b+d*-f+w*-k-l*-h;a[2]=w*b+d*-h+l*-f-D*-k;a[3]=c[3];return a};b.forEach=function(){var a=b.create();
return function(c,b,d,g,m,k){b||(b=4);d||(d=0);for(g=g?Math.min(g*b+d,c.length):c.length;d<g;d+=b)a[0]=c[d],a[1]=c[d+1],a[2]=c[d+2],a[3]=c[d+3],m(a,a,k),c[d]=a[0],c[d+1]=a[1],c[d+2]=a[2],c[d+3]=a[3];return c}}();b.str=function(a){return"vec4("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"};b.exactEquals=function(a,c){return a[0]===c[0]&&a[1]===c[1]&&a[2]===c[2]&&a[3]===c[3]};b.equals=function(a,c){var b=a[0],d=a[1],g=a[2],m=a[3],k=c[0],f=c[1],h=c[2],z=c[3];return Math.abs(b-k)<=l.EPSILON*Math.max(1,Math.abs(b),
Math.abs(k))&&Math.abs(d-f)<=l.EPSILON*Math.max(1,Math.abs(d),Math.abs(f))&&Math.abs(g-h)<=l.EPSILON*Math.max(1,Math.abs(g),Math.abs(h))&&Math.abs(m-z)<=l.EPSILON*Math.max(1,Math.abs(m),Math.abs(z))};f.exports=b},function(f,d,h){var l=h(17),b={create:function(){var a=new l.ARRAY_TYPE(2);a[0]=0;a[1]=0;return a},clone:function(a){var c=new l.ARRAY_TYPE(2);c[0]=a[0];c[1]=a[1];return c},fromValues:function(a,c){var b=new l.ARRAY_TYPE(2);b[0]=a;b[1]=c;return b},copy:function(a,c){a[0]=c[0];a[1]=c[1];return a},
set:function(a,c,b){a[0]=c;a[1]=b;return a},add:function(a,c,b){a[0]=c[0]+b[0];a[1]=c[1]+b[1];return a},subtract:function(a,c,b){a[0]=c[0]-b[0];a[1]=c[1]-b[1];return a}};b.sub=b.subtract;b.multiply=function(a,c,b){a[0]=c[0]*b[0];a[1]=c[1]*b[1];return a};b.mul=b.multiply;b.divide=function(a,c,b){a[0]=c[0]/b[0];a[1]=c[1]/b[1];return a};b.div=b.divide;b.ceil=function(a,c){a[0]=Math.ceil(c[0]);a[1]=Math.ceil(c[1]);return a};b.floor=function(a,c){a[0]=Math.floor(c[0]);a[1]=Math.floor(c[1]);return a};b.min=
function(a,c,b){a[0]=Math.min(c[0],b[0]);a[1]=Math.min(c[1],b[1]);return a};b.max=function(a,c,b){a[0]=Math.max(c[0],b[0]);a[1]=Math.max(c[1],b[1]);return a};b.round=function(a,c){a[0]=Math.round(c[0]);a[1]=Math.round(c[1]);return a};b.scale=function(a,c,b){a[0]=c[0]*b;a[1]=c[1]*b;return a};b.scaleAndAdd=function(a,c,b,d){a[0]=c[0]+b[0]*d;a[1]=c[1]+b[1]*d;return a};b.distance=function(a,c){var b=c[0]-a[0],d=c[1]-a[1];return Math.sqrt(b*b+d*d)};b.dist=b.distance;b.squaredDistance=function(a,c){var b=
c[0]-a[0],d=c[1]-a[1];return b*b+d*d};b.sqrDist=b.squaredDistance;b.length=function(a){var c=a[0];a=a[1];return Math.sqrt(c*c+a*a)};b.len=b.length;b.squaredLength=function(a){var c=a[0];a=a[1];return c*c+a*a};b.sqrLen=b.squaredLength;b.negate=function(a,c){a[0]=-c[0];a[1]=-c[1];return a};b.inverse=function(a,c){a[0]=1/c[0];a[1]=1/c[1];return a};b.normalize=function(a,c){var b=c[0],d=c[1],b=b*b+d*d;0<b&&(b=1/Math.sqrt(b),a[0]=c[0]*b,a[1]=c[1]*b);return a};b.dot=function(a,c){return a[0]*c[0]+a[1]*
c[1]};b.cross=function(a,c,b){c=c[0]*b[1]-c[1]*b[0];a[0]=a[1]=0;a[2]=c;return a};b.lerp=function(a,c,b,d){var g=c[0];c=c[1];a[0]=g+d*(b[0]-g);a[1]=c+d*(b[1]-c);return a};b.random=function(a,c){c=c||1;var b=2*l.RANDOM()*Math.PI;a[0]=Math.cos(b)*c;a[1]=Math.sin(b)*c;return a};b.transformMat2=function(a,c,b){var d=c[0];c=c[1];a[0]=b[0]*d+b[2]*c;a[1]=b[1]*d+b[3]*c;return a};b.transformMat2d=function(a,c,b){var d=c[0];c=c[1];a[0]=b[0]*d+b[2]*c+b[4];a[1]=b[1]*d+b[3]*c+b[5];return a};b.transformMat3=function(a,
c,b){var d=c[0];c=c[1];a[0]=b[0]*d+b[3]*c+b[6];a[1]=b[1]*d+b[4]*c+b[7];return a};b.transformMat4=function(a,c,b){var d=c[0];c=c[1];a[0]=b[0]*d+b[4]*c+b[12];a[1]=b[1]*d+b[5]*c+b[13];return a};b.forEach=function(){var a=b.create();return function(c,b,d,g,m,k){b||(b=2);d||(d=0);for(g=g?Math.min(g*b+d,c.length):c.length;d<g;d+=b)a[0]=c[d],a[1]=c[d+1],m(a,a,k),c[d]=a[0],c[d+1]=a[1];return c}}();b.str=function(a){return"vec2("+a[0]+", "+a[1]+")"};b.exactEquals=function(a,c){return a[0]===c[0]&&a[1]===c[1]};
b.equals=function(a,c){var b=a[0],d=a[1],g=c[0],m=c[1];return Math.abs(b-g)<=l.EPSILON*Math.max(1,Math.abs(b),Math.abs(g))&&Math.abs(d-m)<=l.EPSILON*Math.max(1,Math.abs(d),Math.abs(m))};f.exports=b},function(f,d){d.partitionArray=function(d,f,b,a){for(;f<b;){var c=d[f];a(c)?++f:(--b,d[f]=d[b],d[b]=c)}return b};d.maybePadArray=function(d,f){if(d.length===f)return d;var b=new d.constructor(f);b.set(d);return b};d.getFortranOrderStrides=function(d){for(var f=d.length,b=Array(f),a=b[0]=1>=arguments.length||
void 0===arguments[1]?1:arguments[1],c=1;c<f;++c)a*=d[c-1],b[c]=a;return b}},function(f,d){d.approxEqual=function(d,f){return d===f?!0:1E-6>Math.abs(d-f)/Math.min(Math.abs(d),Math.abs(f))}},function(f,d){var h=d.DataType||(d.DataType={});h[h.UINT8=0]="UINT8";h[h.UINT16=1]="UINT16";h[h.UINT32=2]="UINT32";h[h.UINT64=3]="UINT64";h[h.FLOAT32=4]="FLOAT32";h=d.DataType;d.DATA_TYPE_BYTES=[];d.DATA_TYPE_BYTES[h.UINT8]=1;d.DATA_TYPE_BYTES[h.UINT16]=2;d.DATA_TYPE_BYTES[h.UINT32]=4;d.DATA_TYPE_BYTES[h.UINT64]=
8;d.DATA_TYPE_BYTES[h.FLOAT32]=4},function(f,d,h){function l(a,c){if(!(a instanceof c))throw new TypeError("Cannot call a class as a function");}function b(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 a(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 c(a,c){return p.decodeJsonManifestChunk(a,c,"fragmentKey")}function e(a,c){var b=new DataView(c),e=b.getUint32(0,!0);if(0!==b.getUint32(4,!0))throw Error("The number of vertices should not exceed 2^32-1.");p.decodeVertexPositionsAndIndices(a,c,w.Endianness.LITTLE,8,e)}var n=function(){function a(c,b){for(var e=0;e<b.length;e++){var d=b[e];d.enumerable=d.enumerable||!1;d.configurable=
!0;"value"in d&&(d.writable=!0);Object.defineProperty(c,d.key,d)}}return function(c,b,e){b&&a(c.prototype,b);e&&a(c,e);return c}}();h(30);var g=h(4),m=h(32),k=h(35),p=h(36);d=h(12);var r=h(43),z=h(44),D=h(52),w=h(41),q=h(15);f=h(2);var u=h(53);h=function(c){function e(a,c){l(this,e);var d=b(this,Object.getPrototypeOf(e).call(this,a,c));switch((d.parameters=c.parameters).encoding){case k.VolumeChunkEncoding.RAW:d.chunkDecoder=function(a,c){D.decodeRawChunk(a,u.inflate(new Uint8Array(c)).buffer)};d.encodingParams=
"/subvolume_format=RAW/image_format_options.gzip_compression_level=6";break;case k.VolumeChunkEncoding.JPEG:d.chunkDecoder=z.decodeJpegChunk;d.encodingParams="/subvolume_format=SINGLE_IMAGE/image_format_options.image_format=JPEG";break;case k.VolumeChunkEncoding.COMPRESSED_SEGMENTATION:d.chunkDecoder=function(a,c){r.decodeCompressedSegmentationChunk(a,u.inflate(new Uint8Array(c)).buffer)},d.encodingParams="/subvolume_format=RAW/image_format_options.compressed_segmentation_block_size="+q.vec3Key(d.spec.compressedSegmentationBlockSize)+
"/image_format_options.gzip_compression_level=6"}return d}a(e,c);n(e,[{key:"download",value:function(a){var c=this.parameters,b=void 0,b=this.computeChunkBounds(a),e=a.chunkDataSize,b="/v1beta2/binary/volumes/binary/volumes/subvolume/header.volume_id="+c.volume_id+"/geometry.corner="+q.vec3Key(b)+"/geometry.size="+q.vec3Key(e)+"/geometry.scale="+c.scaleIndex+this.encodingParams+"?alt=media";g.handleChunkDownloadPromise(a,m.makeRequest(c.instance,"GET",b,"arraybuffer"),this.chunkDecoder)}},{key:"toString",
value:function(){return k.volumeSourceToString(this.parameters)}}]);return e}(d.VolumeChunkSource);f.registerSharedObject("brainmaps/VolumeChunkSource",h);h=function(d){function f(a,c){l(this,f);var e=b(this,Object.getPrototypeOf(f).call(this,a,c));e.parameters=c.parameters;return e}a(f,d);n(f,[{key:"download",value:function(a){var b=this.parameters;g.handleChunkDownloadPromise(a,m.makeRequest(b.instance,"GET","/v1beta2/objects/"+b.volume_id+"/meshes/"+b.mesh_name+":listfragments?object_id="+a.objectId,
"json"),c)}},{key:"downloadFragment",value:function(a){var c=this.parameters;g.handleChunkDownloadPromise(a,m.makeRequest(c.instance,"GET","/v1beta2/binary/objects/binary/objects/fragment/header.volume_id="+c.volume_id+"/mesh_name="+c.mesh_name+"/fragment_key="+a.fragmentId+"/object_id="+a.manifestChunk.objectId+"?alt=media","arraybuffer"),e)}},{key:"toString",value:function(){return k.meshSourceToString(this.parameters)}}]);return f}(p.MeshSource);f.registerSharedObject("brainmaps/MeshSource",h)},
function(f,d,h){f=h(31);d=h(2);var l=h(1),b=null;f.implementation.getNewTokenPromise=function(a){var c={};null!=a&&(c.invalidToken=a);a=new Promise(function(a,c){b=a});l.rpc.invoke("brainmaps.requestToken",c);return a};d.registerRPC("brainmaps.receiveToken",function(a){b(a.authResult)})},function(f,d){var h=function c(){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");};d.Implementation=h;d.implementation=new h;var l=null,b=null;d.getToken=function(c){if(null!==l&&
(null===b||null==c||c.generationId!==b.generationId))return l;b=null;l=d.implementation.getNewTokenPromise(c);l.then(function(c){b=c});return l}},function(f,d,h){function l(a,c,b,m){d.INSTANCE_IDENTIFIERS[a]=b;d.INSTANCE_NAMES[a]=m;b=["https://"+c];for(m=0;9>=m;++m)b.push("https://s"+m+"-"+c);d.INSTANCE_BASE_URLS[a]=b}var b=h(31),a=h(33),c=h(11);d.numPendingRequests=0;d.PRODUCTION_INSTANCE=0;d.INSTANCE_NAMES=[];d.INSTANCE_BASE_URLS=[];d.INSTANCE_IDENTIFIERS=[];d.brainmapsInstanceKey=function(a){return d.INSTANCE_IDENTIFIERS[a]};
d.setupBrainmapsInstance=l;l(d.PRODUCTION_INSTANCE,"brainmaps.googleapis.com","prod","Brain Maps");d.makeRequest=function(e,f,g,m){var k=void 0;return c.makeCancellablePromise(function(c,h,l){function D(l){null===k?--d.numPendingRequests:(k=a.openShardedHttpRequest(d.INSTANCE_BASE_URLS[e],g,f),k.responseType=m,k.setRequestHeader("Authorization",l.tokenType+" "+l.accessToken),k.onloadend=function(){if(null===k)--d.numPendingRequests;else{var e=this.status;200<=e&&300>e?(--d.numPendingRequests,c(this.response)):
403===e||401===e?b.getToken(l).then(D):(--d.numPendingRequests,h(a.HttpError.fromXhr(this)))}},k.send())}l(function(){var a=k;k=null;null!=a&&a.abort()});b.getToken().then(D)})}},function(f,d,h){function l(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 b(a,b){if(Array.isArray(a)){var e=a.length,e=1===e?0:Math.abs(c.simpleStringHash(b))%e;return a[e]+b}return a+b}var a=function(){function a(c,b){for(var e=0;e<b.length;e++){var d=b[e];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(c,d.key,d)}}return function(c,b,e){b&&a(c.prototype,b);e&&a(c,e);return c}}(),c=h(34),e=h(11);$jscomp.initSymbol();d.URL_SYMBOL=Symbol("url");$jscomp.initSymbol();d.METHOD_SYMBOL=Symbol("method");var n=function(c){function b(a,
c,e,d){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");var g=a+" "+JSON.stringify(c)+" resulted in HTTP error "+e;d&&(g+=": "+d);var g=g+".",f;f=Object.getPrototypeOf(b).call(this,g);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");f=!f||"object"!==typeof f&&"function"!==typeof f?this:f;f.name="HttpError";f.message=g;f.method=a;f.url=c;f.code=e;f.statusMessage=d;return f}l(b,c);a(b,null,[{key:"fromXhr",value:function(a){return new b(a[d.METHOD_SYMBOL],
a[d.URL_SYMBOL],a.status,a.statusText)}}]);return b}(Error);d.HttpError=n;d.openHttpRequest=function(a){var c=1>=arguments.length||void 0===arguments[1]?"GET":arguments[1],b=new XMLHttpRequest;b[d.METHOD_SYMBOL]=c;b[d.URL_SYMBOL]=a;b.open(c,a);return b};d.pickShard=b;d.openShardedHttpRequest=function(a,c){var e=2>=arguments.length||void 0===arguments[2]?"GET":arguments[2],f=new XMLHttpRequest,h=b(a,c);f[d.METHOD_SYMBOL]=e;f[d.URL_SYMBOL]=h;f.open(e,h);return f};d.sendHttpRequest=function(a,c){a.responseType=
c;return e.makeCancellablePromise(function(c,b,e){a.onloadend=function(){var e=this.status;200<=e&&300>e?c(this.response):b(n.fromXhr(a))};e(function(){a.abort()});a.send()})};d.parseSpecialUrl=function(a){var c=a.match(/^([^:\/]+):\/\/([^\/]+)(\/.*)?$/);if(null===c)throw Error("Invalid URL: "+JSON.stringify(a));return"gs"===c[1]?(a=c[2],[["https://"+a+".storage.googleapis.com","https://storage.googleapis.com/"+a],c[3]]):[[a],""]}},function(f,d){d.simpleStringHash=function(d){for(var f=0,b=d.length,
a=0;a<b;++a)f=31*f+d.charCodeAt(a)|0;return f}},function(f,d,h){var l=h(32);(function(a){a[a.RAW=0]="RAW";a[a.JPEG=1]="JPEG";a[a.COMPRESSED_SEGMENTATION=2]="COMPRESSED_SEGMENTATION"})(d.VolumeChunkEncoding||(d.VolumeChunkEncoding={}));var b=d.VolumeChunkEncoding;d.volumeSourceToString=function(a){return"brainmaps-"+l.brainmapsInstanceKey(a.instance)+":volume/"+a.volume_id+"/"+a.scaleIndex+"/"+b[a.encoding]};d.meshSourceToString=function(a){return"brainmaps:"+l.brainmapsInstanceKey(a.instance)+":mesh/"+
a.volume_id+"/"+a.mesh_name}},function(f,d,h){function l(a,c){if(!(a instanceof c))throw new TypeError("Cannot call a class as a function");}function b(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 a(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 c(a,c){for(var b=k.vec3.create(),e=k.vec3.create(),d=k.vec3.create(),g=new Float32Array(a.length),f=new Float32Array(a.length/3),m=c.length,h=0;h<m;h+=3)for(var v=0;3>v;++v)f[c[h+v]]+=1;for(h=0;h<m;h+=3){for(var v=3*c[h],n=3*c[h+1],p=3*c[h+2],l=0;3>l;++l)e[l]=a[n+l]-a[v+l],d[l]=a[p+l]-a[n+l];k.vec3.cross(b,e,d);k.vec3.normalize(b,b);for(v=0;3>v;++v)for(p=c[h+v],n=1/f[p],p*=3,l=
0;3>l;++l)g[p+l]+=n*b[l]}b=g.length;for(e=0;e<b;e+=3)d=g.subarray(e,3),k.vec3.normalize(d,d);return g}var e=function(){function a(c,b){for(var e=0;e<b.length;e++){var d=b[e];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(c,d.key,d)}}return function(c,b,e){b&&a(c.prototype,b);e&&a(c,e);return c}}(),n=function u(a,c,b){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,c);if(void 0===e)return a=Object.getPrototypeOf(a),null===
a?void 0:u(a,c,b);if("value"in e)return e.value;c=e.get;return void 0===c?void 0:c.call(b)};h(37);f=h(4);var g=h(5),m=h(41),k=h(15),p=h(42),r=h(40);h=h(2);var z=function(c){function d(){l(this,d);var a=b(this,Object.getPrototypeOf(d).call(this));a.backendOnly=!0;a.objectId=new r.Uint64;return a}a(d,c);e(d,[{key:"initializeManifestChunk",value:function(a,c){n(Object.getPrototypeOf(d.prototype),"initialize",this).call(this,a);this.objectId.assign(c)}},{key:"freeSystemMemory",value:function(){this.fragmentIds=
null}},{key:"downloadSucceeded",value:function(){this.systemMemoryBytes=100;n(Object.getPrototypeOf(d.prototype),"downloadSucceeded",this).call(this);this.priorityTier===g.ChunkPriorityTier.VISIBLE&&this.source.chunkManager.scheduleUpdateChunkPriorities()}},{key:"toString",value:function(){return this.objectId.toString()}}]);return d}(f.Chunk);d.ManifestChunk=z;var D=function(c){function d(){l(this,d);var a=b(this,Object.getPrototypeOf(d).call(this));a.manifestChunk=null;a.fragmentId=null;a.vertexPositions=
null;a.indices=null;a.vertexNormals=null;return a}a(d,c);e(d,[{key:"initializeFragmentChunk",value:function(a,c,b){n(Object.getPrototypeOf(d.prototype),"initialize",this).call(this,a);this.manifestChunk=c;this.fragmentId=b}},{key:"freeSystemMemory",value:function(){this.fragmentId=this.vertexPositions=this.indices=this.vertexNormals=this.manifestChunk=null}},{key:"serialize",value:function(a,c){n(Object.getPrototypeOf(d.prototype),"serialize",this).call(this,a,c);a.objectKey=this.manifestChunk.key;
var b=this.vertexPositions,e=this.indices,g=this.vertexNormals;a.vertexPositions=b;a.indices=e;a.vertexNormals=g;b=b.buffer;c.push(b);e=e.buffer;e!==b&&c.push(e);g=g.buffer;g!==b&&g!==e&&c.push(g);this.vertexPositions=this.indices=this.vertexNormals=null}},{key:"downloadSucceeded",value:function(){this.systemMemoryBytes=this.gpuMemoryBytes=this.vertexPositions.byteLength+this.indices.byteLength+this.vertexNormals.byteLength;n(Object.getPrototypeOf(d.prototype),"downloadSucceeded",this).call(this)}}]);
return d}(f.Chunk);d.FragmentChunk=D;d.decodeJsonManifestChunk=function(a,c,b){p.verifyObject(c);a.fragmentIds=p.verifyObjectProperty(c,b,function(a){if(!Array.isArray(a))throw Error("Expected array, received: "+JSON.stringify(a)+".");for(var c=$jscomp.makeIterator(a),b=c.next();!b.done;b=c.next())if(b=b.value,"string"!==typeof b)throw Error("Expected string fragment key, received: "+JSON.stringify(b)+".");return a})};d.computeVertexNormals=c;d.decodeVertexPositionsAndIndices=function(a,b,e,d,g,f,
k){var h=new Float32Array(b,d,3*g);m.convertEndian32(h,e);void 0===f&&(f=d+12*g);d=void 0;void 0!==k&&(d=3*k);b=new Uint32Array(b,f,d);if(0!==b.length%3)throw Error("Number of indices is not a multiple of 3: "+b.length+".");m.convertEndian32(b,e);a.vertexPositions=h;a.indices=b;a.vertexNormals=c(h,b)};var w=function(c){function d(a,c){l(this,d);var e=b(this,Object.getPrototypeOf(d).call(this,a,c));return(e.fragmentSource=e.registerDisposer(a.getRef(c.fragmentSource))).meshSource=e}a(d,c);e(d,[{key:"getChunk",
value:function(a){var c=a.low+":"+a.high,b=this.chunks.get(c);void 0===b&&(b=this.getNewChunk_(z),b.initializeManifestChunk(c,a),this.addChunk(b));return b}},{key:"getFragmentChunk",value:function(a,c){var b=a.key+"/"+c,e=this.fragmentSource,d=e.chunks.get(b);void 0===d&&(d=e.getNewChunk_(D),d.initializeFragmentChunk(b,a,c),e.addChunk(d));return d}}]);return d}(f.ChunkSource);d.MeshSource=w;f=function(c){function d(){l(this,d);for(var a=arguments.length,c=Array(a),e=0;e<a;e++)c[e]=arguments[e];var g,
a=b(this,(g=Object.getPrototypeOf(d)).call.apply(g,[].concat([this],$jscomp.arrayFromIterable(c))));a.meshSource=null;return a}a(d,c);e(d,[{key:"download",value:function(a){this.meshSource.downloadFragment(a)}}]);return d}(f.ChunkSource);d.FragmentSource=f;h.registerSharedObject("mesh/FragmentSource",f);d=function(c){function d(a,c){l(this,d);var e=b(this,Object.getPrototypeOf(d).call(this,a,c));e.chunkManager=a.get(c.chunkManager);e.visibleSegmentSet=a.get(c.visibleSegmentSet);e.source=e.registerDisposer(a.getRef(c.source));
e.registerSignalBinding(e.chunkManager.recomputeChunkPriorities.add(e.updateChunkPriorities,e));e.registerSignalBinding(e.visibleSegmentSet.changed.add(e.handleVisibleSegmentSetChanged,e));return e}a(d,c);e(d,[{key:"handleVisibleSegmentSetChanged",value:function(){this.chunkManager.scheduleUpdateChunkPriorities()}},{key:"updateChunkPriorities",value:function(){for(var a=this.source,c=this.chunkManager,b=$jscomp.makeIterator(this.visibleSegmentSet),e=b.next();!e.done;e=b.next())if(e=a.getChunk(e.value),
c.requestChunk(e,g.ChunkPriorityTier.VISIBLE,100),e.state===g.ChunkState.SYSTEM_MEMORY_WORKER)for(var d=$jscomp.makeIterator(e.fragmentIds),f=d.next();!f.done;f=d.next())f=a.getFragmentChunk(e,f.value),c.requestChunk(f,g.ChunkPriorityTier.VISIBLE,50)}}]);return d}(h.SharedObjectCounterpart);h.registerSharedObject("mesh/MeshLayer",d)},function(f,d,h){function l(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)}var b=function(){function a(c,b){for(var e=0;e<b.length;e++){var d=b[e];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(c,d.key,d)}}return function(c,b,e){b&&a(c.prototype,b);e&&a(c,e);return c}}(),a=function m(a,c,b){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,
c);if(void 0===e)return a=Object.getPrototypeOf(a),null===a?void 0:m(a,c,b);if("value"in e)return e.value;c=e.get;return void 0===c?void 0:c.call(b)},c=h(38),e=h(40);f=h(2);var n=h(6);h=function(d){function f(){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");for(var a=arguments.length,b=Array(a),e=0;e<a;e++)b[e]=arguments[e];var d,a=(d=Object.getPrototypeOf(f)).call.apply(d,[].concat([this],$jscomp.arrayFromIterable(b)));if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
d=!a||"object"!==typeof a&&"function"!==typeof a?this:a;d.hashTable=new c.HashTable;d.changed=new n.Signal;return d}l(f,d);$jscomp.initSymbol();$jscomp.initSymbolIterator();b(f,[{key:"initializeCounterpart",value:function(c){var b=1>=arguments.length||void 0===arguments[1]?{}:arguments[1];b.type="Uint64Set";a(Object.getPrototypeOf(f.prototype),"initializeCounterpart",this).call(this,c,b)}},{key:"disposed",value:function(){a(Object.getPrototypeOf(f.prototype),"disposed",this).call(this);this.changed=
this.hashTable=void 0}},{key:"add_",value:function(a){return this.hashTable.add(a.low,a.high)}},{key:"add",value:function(a){if(this.add_(a)){var c=this.rpc;c&&c.invoke("Uint64Set.add",{id:this.rpcId,value:a});this.changed.dispatch(a,!0)}}},{key:"has",value:function(a){return this.hashTable.has(a.low,a.high)}},{key:Symbol.iterator,value:function(){function a(h,n){for(;;)switch(c){case 0:k=new e.Uint64,$jscomp.initSymbol(),$jscomp.initSymbolIterator(),f=$jscomp.makeIterator(m.hashTable[Symbol.iterator]()),
d=f.next();case 1:if(d.done){c=3;break}b=d.value;k.low=b[0];k.high=b[1];c=4;return{value:k,done:!1};case 4:if(void 0===n){c=5;break}c=-1;throw n;case 5:case 2:d=f.next();c=1;break;case 3:c=-1;default:return{value:void 0,done:!0}}}var c=0,b,d,f,k,m=this,h={next:function(c){return a(c,void 0)},throw:function(c){return a(void 0,c)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();h[Symbol.iterator]=function(){return this};return h}},{key:"delete_",value:function(a){return this.hashTable.delete(a.low,
a.high)}},{key:"delete",value:function(a){if(this.delete_(a)){var c=this.rpc;c&&c.invoke("Uint64Set.delete",{id:this.rpcId,value:a});this.changed.dispatch(a,!1)}}},{key:"clear",value:function(){if(this.hashTable.clear()){var a=this.rpc;a&&a.invoke("Uint64Set.clear",{id:this.rpcId});this.changed.dispatch(null,!1)}}},{key:"size",get:function(){return this.hashTable.size}}],[{key:"makeWithCounterpart",value:function(a){var c=new f;c.initializeCounterpart(a);return c}}]);return f}(f.SharedObjectCounterpart);
d.Uint64Set=h;f.registerRPC("Uint64Set.add",function(a){var c=this.get(a.id);c.add_(a.value)&&c.changed.dispatch()});f.registerRPC("Uint64Set.delete",function(a){var c=this.get(a.id);c.delete_(a.value)&&c.changed.dispatch()});f.registerRPC("Uint64Set.clear",function(a){a=this.get(a.id);a.hashTable.clear()&&a.changed.dispatch()});f.registerSharedObject("Uint64Set",h)},function(f,d,h){var l=function(){function a(a,b){for(var d=0;d<b.length;d++){var g=b[d];g.enumerable=g.enumerable||!1;g.configurable=
!0;"value"in g&&(g.writable=!0);Object.defineProperty(a,g.key,g)}}return function(c,b,d){b&&a(c.prototype,b);d&&a(c,d);return c}}(),b=h(39);d.NUM_ALTERNATIVES=3;f=function(){function a(){var c=0>=arguments.length||void 0===arguments[0]?a.generateHashFunctions(d.NUM_ALTERNATIVES):arguments[0];if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");this.loadFactor=.9;this.size=0;this.growFactor=1.2;this.maxWidth=4096;this.maxHeight=8192;this.emptyHigh=this.emptyLow=4294967295;
this.maxAttempts=this.maxRehashAttempts=5;this.generation=0;this.hashFunctions=c;this.allocate(4,1)}$jscomp.initSymbol();$jscomp.initSymbolIterator();l(a,[{key:"updateHashFunctions",value:function(c){this.hashFunctions=a.generateHashFunctions(c)}},{key:"getHash",value:function(a,b,d){a=this.hashFunctions[a];var g=this.width,f=this.height,g=a[0].compute(b,d)%g;return 2*(a[1].compute(b,d)%f*this.width+g)}},{key:Symbol.iterator,value:function(){function a(c,C){for(;;)switch(b){case 0:q=u.width*u.height,
w=u.emptyLow,D=u.emptyHigh,z=[0,0],l=$jscomp.makeIterator(u.tables),h=l.next();case 1:if(h.done){b=3;break}k=h.value;f=0;case 4:if(!(f<q)){b=6;break}g=k[2*f];d=k[2*f+1];if(g===w&&d===D){b=7;break}z[0]=g;z[1]=d;b=8;return{value:z,done:!1};case 8:if(void 0===C){b=9;break}b=-1;throw C;case 9:case 7:case 5:++f;b=4;break;case 6:case 2:h=l.next();b=1;break;case 3:b=-1;default:return{value:void 0,done:!0}}}var b=0,d,g,f,k,h,l,z,D,w,q,u=this,C={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();C[Symbol.iterator]=function(){return this};return C}},{key:"hasWithTableIndex",value:function(a,b){for(var d=this.tables.length,f=0;f<d;++f){var h=this.getHash(f,a,b),k=this.tables[f];if(k[h]===a&&k[h+1]===b)return f}return null}},{key:"has",value:function(a,b){for(var d=this.tables.length,f=0;f<d;++f){var h=this.getHash(f,a,b),k=this.tables[f];if(k[h]===a&&k[h+1]===b)return!0}return!1}},{key:"delete",value:function(a,
b){for(var d=this.tables.length,f=0;f<d;++f){var h=this.getHash(f,a,b),k=this.tables[f];if(k[h]===a&&k[h+1]===b)return k[h]=this.emptyLow,k[h+1]=this.emptyHigh,++this.generation,this.size--,!0}return!1}},{key:"clear",value:function(){if(0===this.size)return!1;this.size=0;++this.generation;for(var a=this.tables,b=this.emptyLow,d=this.emptyHigh,f=a.length,h=0;h<f;++h)for(var k=a[h],l=k.length,r=0;r<l;r+=2)k[r]=b,k[r+1]=d;return!0}},{key:"tryToInsert",value:function(a,b){for(var d=0,f=this.emptyLow,
h=this.emptyHigh,k=this.maxAttempts,l=this.tables,r=l.length,z=Math.floor(Math.random()*r);;){var D=this.getHash(z,a,b),w=l[z],q=w[D],u=w[D+1];w[D]=a;w[D+1]=b;if(q===f&&u===h)return null;a=q;b=u;if(++d===k)break;z=(z+Math.floor(Math.random()*(r-1)))%r}return[a,b]}},{key:"allocate",value:function(a,b){var d=a*b;this.width=a;this.height=b;for(var f=this.hashFunctions.length,h=this.tables=Array(f),k=0;k<f;++k)h[k]=new Uint32Array(2*d);this.maxAttempts=d;for(var f=this.emptyLow,k=this.emptyHigh,h=$jscomp.makeIterator(h),
l=h.next();!l.done;l=h.next())for(var l=l.value,r=0;r<d;++r)l[2*r]=f,l[2*r+1]=k;this.capacity=d*this.tables.length*this.loadFactor}},{key:"rehash",value:function(a,b,d){this.allocate(b,d);this.updateHashFunctions(a.length);a=$jscomp.makeIterator(a);for(b=a.next();!b.done;b=a.next()){b=b.value;d=b.length/2;for(var f=0;f<d;++f){var h=2*f,k=b[h],h=b[h+1];if((0!==k||0!==h)&&null!==this.tryToInsert(k,h))return!1}}return!0}},{key:"grow",value:function(a){for(var b=this.tables,d=this.width,f=this.height,
h=this.maxWidth,k=this.maxHeight;;){var l=d*f,d=Math.min(h,Math.ceil(a/this.height));d*f<a&&(f=Math.min(k,Math.ceil(a/this.width)));var r=d*f;if(r<a&&r===l)throw Error("Maximum table size exceeded");for(l=0;l<this.maxRehashAttempts;++l)if(this.rehash(b,d,f))return;a=Math.ceil(this.growFactor*a)}}},{key:"add",value:function(a,b){if(this.has(a,b))return!1;++this.generation;for(++this.size>this.capacity&&this.grow(Math.ceil(this.growFactor*this.width*this.height));;){var d=this.tryToInsert(a,b);if(null==
d)return!0;a=d[0];b=d[1];this.grow(this.width*this.height)}}}],[{key:"generateHashFunctions",value:function(){for(var a=0>=arguments.length||void 0===arguments[0]?d.NUM_ALTERNATIVES:arguments[0],e=[],f=0;f<a;++f){var g=[b.HashFunction.generate(),b.HashFunction.generate()];e.push(g)}return e}}]);return a}();d.HashTable=f},function(f,d){var h=function(){function b(a,c){for(var b=0;b<c.length;b++){var d=c[b];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,
d.key,d)}}return function(a,c,e){c&&b(a.prototype,c);e&&b(a,e);return a}}();d.PRIME_MODULUS=4093;var l=function(){function b(a,c,e,d){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");this.a0=a;this.a1=c;this.b=e;this.c=d}h(b,[{key:"computeDotProduct",value:function(a,c){var b=this.a0,d=this.a1;return b[0]*(a&255)+b[1]*(a>>8&255)+b[2]*(a>>16&255)+b[3]*(a>>24&255)+(d[0]*(c&255)+d[1]*(c>>8&255)+d[2]*(c>>16&255)+d[3]*(c>>24&255))}},{key:"compute",value:function(a,c){var b=
this.b,f=this.c,g=this.computeDotProduct(a,c);return(g+g*g%d.PRIME_MODULUS*f+b)%d.PRIME_MODULUS}},{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(Math.random()*d.PRIME_MODULUS)}return new b(Float32Array.of(a(),a(),a(),a()),Float32Array.of(a(),a(),a(),a()),a(),a())}}]);return b}();d.HashFunction=l},function(f,d){var h=function(){function a(c,
b){for(var e=0;e<b.length;e++){var d=b[e];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(c,d.key,d)}}return function(c,b,e){b&&a(c.prototype,b);e&&a(c,e);return c}}(),l=new Uint32Array(2),b=[],a=2;for(;36>=a;++a){var c=Math.floor(32/Math.log2(a)),e=Math.pow(a,c),n=Math.floor(c/2),g=Math.pow(a,n),n=Math.pow(a,c-n),m="^[0-"+String.fromCharCode(48+Math.min(9,a-1));10<a&&(m+="a-"+String.fromCharCode(97+a-11),m+="A-"+String.fromCharCode(65+a-11));m+=
"]{1,"+Math.ceil(64/Math.log2(a))+"}$";b[a]={lowDigits:c,lowBase:e,lowBase1:g,lowBase2:n,pattern:new RegExp(m)}}a=function(){function a(){var c=0>=arguments.length||void 0===arguments[0]?0:arguments[0],b=1>=arguments.length||void 0===arguments[1]?0:arguments[1];if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");this.low=c;this.high=b}h(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(){var a=0>=arguments.length||void 0===arguments[0]?10:arguments[0],c=this.low,e=this.high;if(0===e)return c.toString(a);var e=4294967296*e,d=b[a],f=d.lowBase,d=d.lowDigits,g=e%f,e=Math.floor(e/f),c=c+g,e=e+Math.floor(c/f),c=(c%f).toString(a);return e.toString(a)+"0".repeat(d-c.length)+c}},{key:"parseString",value:function(a){var c=1>=arguments.length||void 0===arguments[1]?10:arguments[1],e=b[c],d=e.lowDigits,f=e.lowBase,g=e.lowBase1,k=e.lowBase2;if(!e.pattern.test(a))return!1;
if(a.length<=d)return this.low=parseInt(a,c),this.high=0,!0;d=a.length-d;e=parseInt(a.substr(d),c);c=parseInt(a.substr(0,d),c);f=Math.floor(c*f/4294967296);g=e+c%4294967296*g%4294967296*k%4294967296;4294967296<g&&(++f,g-=4294967296);if(g>>>0!==g||f>>>0!==f)return!1;this.low=g;this.high=f;return!0}},{key:"valid",value:function(){var a=this.low,c=this.high;return a>>>0===a&&c>>>0===c}}],[{key:"less",value:function(a,c){return a.high<c.high||a.high===c.high&&a.low<c.low}},{key:"equal",value:function(a,
c){return a.low===c.low&&a.high===c.high}},{key:"min",value:function(c,b){return a.less(c,b)?c:b}},{key:"random",value:function(){crypto.getRandomValues(l);return new a(l[0],l[1])}},{key:"parseString",value:function(c){var b=1>=arguments.length||void 0===arguments[1]?10:arguments[1],e=new a;if(!e.parseString(c,b))throw Error("Failed to parse string as uint64 value: "+JSON.stringify(c)+".");return e}}]);return a}();a.ZERO=new a(0,0);d.Uint64=a},function(f,d){function h(){var c=Uint16Array.of(4386);
return 17===(new Uint8Array(c.buffer))[0]?a.BIG:a.LITTLE}function l(a){a=new Uint8Array(a.buffer,a.byteOffset,a.byteLength);for(var b=0,d=a.length;b<d;b+=2){var f=a[b];a[b]=a[b+1];a[b+1]=f}}function b(a){a=new Uint8Array(a.buffer,a.byteOffset,a.byteLength);for(var b=0,d=a.length;b<d;b+=4){var f=a[b];a[b]=a[b+3];a[b+3]=f;f=a[b+1];a[b+1]=a[b+2];a[b+2]=f}}(function(a){a[a.LITTLE=0]="LITTLE";a[a.BIG=1]="BIG"})(d.Endianness||(d.Endianness={}));var a=d.Endianness;d.determineEndianness=h;d.ENDIANNESS=h();
d.swapEndian16=l;d.swapEndian32=b;d.convertEndian16=function(a,b){b!==(2>=arguments.length||void 0===arguments[2]?d.ENDIANNESS:arguments[2])&&l(a)};d.nativeToLittle16=function(c){d.ENDIANNESS!==a.LITTLE&&l(c)};d.convertEndian32=function(a,e){e!==(2>=arguments.length||void 0===arguments[2]?d.ENDIANNESS:arguments[2])&&b(a)};d.nativeToLittle32=function(c){d.ENDIANNESS!==a.LITTLE&&b(c)}},function(f,d){function h(a){var c=typeof a;if("number"===c||"string"===c)if(c=parseFloat(""+a),!Number.isNaN(c))return c;
throw Error("Expected floating-point number, but received: "+JSON.stringify(a)+".");}function l(a){if("object"===typeof a){if(null===a)return"null";if(Array.isArray(a)){var c="[",b=a.length,e=0;if(e<b)for(c+=l(a[e]);++e<b;)c+=",",c+=l(a[e]);return c+"]"}var c="{",b=Object.keys(a).sort(),e=0,d=b.length;if(e<d)for(var f=b[e],c=c+JSON.stringify(f),c=c+":"+l(a[f]);++e<d;)c+=",",f=b[e],c+=JSON.stringify(f),c+=":",c+=l(a[f]);return c+="}"}return JSON.stringify(a)}function b(a){return a.replace(/['"]/g,
function(a){return'"'===a?"'":'"'})}function a(a){return b(JSON.stringify(b(a)))}function c(b){if("object"===typeof b){if(null===b)return"null";var e=b.toJSON;if("function"===typeof e)return c(e.call(b));if(Array.isArray(b)){var e="[",d=b.length,f=0;if(f<d)for(e+=c(b[f]);++f<d;)e+="_",e+=c(b[f]);return e+"]"}for(var e="{",f=Object.keys(b),d=!0,f=$jscomp.makeIterator(f),g=f.next();!g.done;g=f.next()){var g=g.value,k=b[g];void 0!==k&&(k=c(k))&&(d?d=!1:e+="_",e+=a(g),e+=":",e+=k)}return e+"}"}return"string"===
typeof b?a(b):JSON.stringify(b)}function e(a,c,b,e){if(2<=a.length&&a.charAt(0)===c&&a.charAt(a.length-1)===c){a=a.substr(1,a.length-2);for(c=b;0<a.length;){var d=a.match(e);if(null===d){c+=a;break}c+=d[1];c+="\\";c+=b;a=a.substr(d.index+d[0].length)}return c+b}return a}function n(a){return e(a,"'",'"',y)}function g(a,c,b){var d=/[&_,]/g,f=void 0,g=void 0,k=void 0;'"'===b?(f="'",g=y,k=u):(f='"',g=B,k=C);for(var h="";0<a.length;){var m=a.match(k),l=void 0,n=void 0;null===m?(l=a,n=a=""):(l=a.substr(0,
m.index),a=a.substr(m.index+m[0].length),n=m[1],n=void 0!==n?e(n,f,b,g):m[2]);h+=l.replace(d,c);h+=n}return h}function m(a){return g(a,",",'"')}function k(a){return JSON.parse(m(a))}function p(a){for(var c="";0<a.length;){var b=a.match(u),e=void 0,d=void 0;null===b?(e=a,d=a=""):(e=a.substr(0,b.index),a=a.substr(b.index+b[0].length),d=b[1],d=void 0!==d?n(d):b[2]);c+=e.replace(/\(/g,"[").replace(/\)/g,"]").replace("True","true").replace("False","false").replace(/,\s*([\}\]])/g,"$1");c+=d}return c}function r(a){if("object"!==
typeof a||null==a||Array.isArray(a))throw Error("Expected JSON object, but received: "+JSON.stringify(a)+".");return a}function z(a){var c=parseInt(a,10);if(!Number.isInteger(c))throw Error("Expected integer, but received: "+JSON.stringify(a)+".");return c}function D(a){if("string"!==typeof a)throw Error("Expected string, but received: "+JSON.stringify(a)+".");return a}d.verifyFloat=h;d.verifyFinitePositiveFloat=function(a){a=h(a);if(Number.isFinite(a)&&0<a)return a;throw Error("Expected positive finite floating-point number, but received: "+
a+".");};d.parseXYZ=function(a,c){var b=2>=arguments.length||void 0===arguments[2]?h:arguments[2];r(c);var e=Object.keys(c);e.sort();if(3!==e.length||"x"!==e[0]||"y"!==e[1]||"z"!==e[2])throw Error("Expected object to have keys ['x', 'y', 'z'], but received: "+JSON.stringify(c)+".");a[0]=b(c.x);a[1]=b(c.y);a[2]=b(c.z);return a};d.parseFiniteVec=function(a,c){var b=a.length;if(!Array.isArray(c)||c.length!==b)throw Error("Incompatible sizes");for(var e=0;e<b;++e)if(!Number.isFinite(parseFloat(c[e])))throw Error("Non-finite value.");
for(e=0;e<b;++e)a[e]=parseFloat(c[e]);return a};d.parseIntVec=function(a,c){var b=a.length;if(!Array.isArray(c)||c.length!==b)throw Error("Incompatible sizes.");for(var e=0;e<b;++e){var d=parseInt(c[e],void 0);if(!Number.isInteger(d))throw Error("Non-integer value.");}for(e=0;e<b;++e)a[e]=parseInt(c[e],void 0);return a};d.stableStringify=l;d.urlSafeStringifyString=a;d.urlSafeStringify=c;var w=/('(?:[^'\\]|(?:\\.))*')/,q=/("(?:[^'\\]|(?:\\.))*")/,u=new RegExp(w.source+"|"+q.source),C=new RegExp(q.source+
"|"+w.source),y=/^((?:[^"'\\]|(?:\\.))*)"/,B=/^((?:[^"'\\]|(?:\\.))*)'/;d.normalizeStringLiteral=n;d.urlSafeToJSON=m;d.jsonToUrlSafe=function(a){return g(a,"_","'")};d.urlSafeParse=k;d.pythonLiteralToJSON=p;d.pythonLiteralParse=function(a){return JSON.parse(p(a))};d.parseArray=function(a,c){if(!Array.isArray(a))throw Error("Expected array, but received: "+JSON.stringify(a)+".");return a.map(c)};d.parseFixedLengthArray=function(a,c,b){var e=a.length;if(!Array.isArray(c)||c.length!==e)throw Error("Expected length "+
e+" array, but received: "+JSON.stringify(c)+".");for(var d=0;d<e;++d)a[d]=b(c[d],d);return a};d.verifyObject=r;d.verifyInt=z;d.verifyPositiveInt=function(a){a=z(a);if(0>=a)throw Error("Expected positive integer, but received: "+a+".");return a};d.verifyMapKey=function(a,c){var b=c.get(a);if(void 0===b)throw Error("Expected one of "+JSON.stringify(Array.from(c.keys()))+", but received: "+JSON.stringify(a)+".");return b};d.verifyString=D;d.verifyOptionalString=function(a){return void 0===a?void 0:
D(a)};d.verifyObjectProperty=function(a,c,b){a=a.hasOwnProperty(c)?a[c]:void 0;try{return b(a)}catch(e){throw Error("Error parsing "+JSON.stringify(c)+" property: "+e.message);}};d.verifyObjectAsMap=function(a,c){r(a);for(var b=new Map,e=$jscomp.makeIterator(Object.keys(a)),d=e.next();!d.done;d=e.next()){d=d.value;try{b.set(d,c(a[d]))}catch(f){throw Error("Error parsing value associated with key "+JSON.stringify(d)+": "+f.message);}}return b};d.verifyFloat01=function(a){if("number"!==typeof a||!Number.isFinite(a)||
0>a||1<a)throw Error("Expected floating point number in [0,1], but received: "+JSON.stringify(a)+".");return a};d.parseQueryStringParameters=function(a){if(""===a)return{};if(a.startsWith("{"))return k(a);var c={};a=a.split(/[&;]/);a=$jscomp.makeIterator(a);for(var b=a.next();!b.done;b=a.next()){var b=b.value,e=b.match(/^([^=&;]+)=([^&;]*)$/);if(null===e)throw Error("Invalid query string part: "+JSON.stringify(b)+".");c[e[1]]=e[2]}return c};d.verifyEnumString=function(a,c){if("string"===typeof a&&
null!==a.match(/^[a-zA-Z]/)&&(a=a.toUpperCase(),c.hasOwnProperty(a)))return c[a];throw Error("Invalid enum value: "+JSON.stringify(a)+".");}},function(f,d){d.decodeCompressedSegmentationChunk=function(d,f){d.data=new Uint32Array(f)}},function(f,d,h){var l=h(45),b=h(50);d.decodeJpegChunk=function(a,c){l.postProcessRawData(a,b.decodeJpegStack(new Uint8Array(c),a.chunkDataSize))}},function(f,d,h){var l=h(13),b=h(46),a=h(48),c=new (h(49).Uint32ArrayBuilder)(2E4),e=Array(4);d.postProcessRawData=function(d,
f){var h=d.source.spec;if(h.compressedSegmentationBlockSize){var k=h.dataType;c.clear();var p=d.chunkDataSize;e[0]=p[0];e[1]=p[1];e[2]=p[2];e[3]=h.numChannels;switch(k){case l.DataType.UINT32:b.encodeChannels(c,h.compressedSegmentationBlockSize,f,e);break;case l.DataType.UINT64:a.encodeChannels(c,h.compressedSegmentationBlockSize,f,e);break;default:throw Error("Unsupported data type for compressed segmentation: "+l.DataType[k]);}d.data=new Uint32Array(c.view)}else d.data=f}},function(f,d,h){function l(a,
d,f,h,l,w,q,u){var C=l[0],y=l[1],B=l[2];l=h[0];var F=h[1];h=h[2];var H=f[0],I=f[1],J=f[2],J=J-I*y,I=I-H*C;if(0===C*y*B)return[0,0];f=l*F*h+31;if(void 0===c||c.length<f)c=new Uint32Array(f),e=new Uint32Array(1*f),n=new Uint32Array(1*f),g=new Uint32Array(f),m=new Uint32Array(f);f=c.subarray(0,f);f.fill(0);for(var v=e,t=n,x=g,A=m,K=0,E=a[d]+1>>>0,G=0,O=l-C,Q=l*F-l*y,M=0;M<B;++M,d+=J,G+=Q)for(var L=0;L<y;++L,d+=I,G+=O)for(var S=0;S<C;++S,d+=H){var T=a[d];T!==E&&(E=v[1*K]=T,x[K]=K++);f[G++]=K}x.subarray(0,
K).sort(function(a,c){return v[a]-v[c]});a=-1;C=v[1*x[0]]+1>>>0;for(y=0;y<K;++y)B=x[y],H=v[1*B],H!==C&&(++a,C=t[1*a]=H),A[B+1]=a;++a;return b.writeBlock(u,w,q,l*F*h,a,t,f,A,1)}var b=h(47),a=h(26);f=h(47);d.newCache=f.newCache;var c=void 0,e=void 0,n=void 0,g=void 0,m=void 0;d.encodeBlock=l;d.encodeChannel=function(c,e,d,f){var g=4>=arguments.length||void 0===arguments[4]?0:arguments[4],h=5>=arguments.length||void 0===arguments[5]?a.getFortranOrderStrides(f,1):arguments[5];return b.encodeChannel(c,
e,d,f,g,h,l)};d.encodeChannels=function(c,e,d,f){var g=4>=arguments.length||void 0===arguments[4]?0:arguments[4],h=5>=arguments.length||void 0===arguments[5]?a.getFortranOrderStrides(f,1):arguments[5];return b.encodeChannels(c,e,d,f,g,h,l)}},function(f,d){function h(){return new Map}function l(a,c,e,f,g,m,k){for(var l=h(),r=Array(3),z=d.BLOCK_HEADER_SIZE,D=0;3>D;++D)var w=r[D]=Math.ceil(f[D]/c[D]),z=z*w;var D=r[0],w=r[1],r=r[2],q=f[0],u=f[1];f=f[2];var C=c[0],y=c[1],B=c[2],F=a.length,H=F,I=[0,0,0];
a.resize(F+z);for(var z=m[0],J=m[1],v=m[2],t=0;t<r;++t){I[2]=Math.min(B,f-t*B);for(var x=0;x<w;++x){I[1]=Math.min(y,u-x*y);for(var A=0;A<D;++A){I[0]=Math.min(C,q-A*C);var K=a.length-F,E=k(e,g+(t*B*v+x*y*J+A*C*z),m,c,I,F,l,a),G=b(E,2),E=G[0],G=G[1],O=a.data;O[H++]=G|E<<24;O[H++]=K}}}}var b=function(){return function(a,c){if(Array.isArray(a))return a;$jscomp.initSymbol();$jscomp.initSymbolIterator();if(Symbol.iterator in Object(a)){var b=[],d=!0,f=!1,h=void 0;try{$jscomp.initSymbol();$jscomp.initSymbolIterator();
for(var k=a[Symbol.iterator](),l;!(d=(l=k.next()).done)&&(b.push(l.value),!c||b.length!==c);d=!0);}catch(r){f=!0,h=r}finally{try{if(!d&&k["return"])k["return"]()}finally{if(f)throw h;}}return b}throw new TypeError("Invalid attempt to destructure non-iterable instance");}}();d.BLOCK_HEADER_SIZE=2;d.newCache=h;d.writeBlock=function(a,c,b,d,f,h,k,l,r){var z=void 0;if(1===f)z=0;else for(z=1;1<<z<f;)z*=2;var D=Math.ceil(z*d/32),w=a.length,q=D,u=!1,C=Array.prototype.join.call(h.subarray(0,f*r),",");d=b.get(C);
void 0===d&&(u=!0,q+=f*r,d=w+D-c,b.set(C,d));a.resize(w+q);a=a.data;if(0<z)switch(z){case 1:for(b=c=0;c<D;++c)q=0,q|=l[k[b+0]]<<0,q|=l[k[b+1]]<<1,q|=l[k[b+2]]<<2,q|=l[k[b+3]]<<3,q|=l[k[b+4]]<<4,q|=l[k[b+5]]<<5,q|=l[k[b+6]]<<6,q|=l[k[b+7]]<<7,q|=l[k[b+8]]<<8,q|=l[k[b+9]]<<9,q|=l[k[b+10]]<<10,q|=l[k[b+11]]<<11,q|=l[k[b+12]]<<12,q|=l[k[b+13]]<<13,q|=l[k[b+14]]<<14,q|=l[k[b+15]]<<15,q|=l[k[b+16]]<<16,q|=l[k[b+17]]<<17,q|=l[k[b+18]]<<18,q|=l[k[b+19]]<<19,q|=l[k[b+20]]<<20,q|=l[k[b+21]]<<21,q|=l[k[b+22]]<<
22,q|=l[k[b+23]]<<23,q|=l[k[b+24]]<<24,q|=l[k[b+25]]<<25,q|=l[k[b+26]]<<26,q|=l[k[b+27]]<<27,q|=l[k[b+28]]<<28,q|=l[k[b+29]]<<29,q|=l[k[b+30]]<<30,q|=l[k[b+31]]<<31,a[w+c]=q,b+=32;break;case 2:for(b=c=0;c<D;++c)q=0,q|=l[k[b+0]]<<0,q|=l[k[b+1]]<<2,q|=l[k[b+2]]<<4,q|=l[k[b+3]]<<6,q|=l[k[b+4]]<<8,q|=l[k[b+5]]<<10,q|=l[k[b+6]]<<12,q|=l[k[b+7]]<<14,q|=l[k[b+8]]<<16,q|=l[k[b+9]]<<18,q|=l[k[b+10]]<<20,q|=l[k[b+11]]<<22,q|=l[k[b+12]]<<24,q|=l[k[b+13]]<<26,q|=l[k[b+14]]<<28,q|=l[k[b+15]]<<30,a[w+c]=q,b+=16;
break;case 4:for(b=c=0;c<D;++c)q=0,q|=l[k[b+0]]<<0,q|=l[k[b+1]]<<4,q|=l[k[b+2]]<<8,q|=l[k[b+3]]<<12,q|=l[k[b+4]]<<16,q|=l[k[b+5]]<<20,q|=l[k[b+6]]<<24,q|=l[k[b+7]]<<28,a[w+c]=q,b+=8;break;case 8:for(b=c=0;c<D;++c)q=0,q|=l[k[b+0]]<<0,q|=l[k[b+1]]<<8,q|=l[k[b+2]]<<16,q|=l[k[b+3]]<<24,a[w+c]=q,b+=4;break;case 16:for(b=c=0;c<D;++c)q=0,q|=l[k[b+0]]<<0,q|=l[k[b+1]]<<16,a[w+c]=q,b+=2;break;case 32:for(b=c=0;c<D;++c)q=0,q|=l[k[b+0]]<<0,a[w+c]=q,b+=1}if(u)for(k=w+D,l=0,f*=r;l<f;++l)a[k++]=h[l];return[z,d]};
d.encodeChannel=l;d.encodeChannels=function(a,c,b,d,f,h,k){var p=a.length,r=d[3];a.resize(p+r);for(var z=0;z<r;++z)a.data[p+z]=a.length,l(a,c,b,d,f+h[3]*z,h,k)}},function(f,d,h){function l(a,d,f,h,l,w,q,u){var C=l[0],y=l[1],B=l[2];l=h[0];var F=h[1];h=h[2];var H=f[0],I=f[1],J=f[2],J=J-I*y,I=I-H*C;if(0===C*y*B)return[0,0];f=l*F*h+31;if(void 0===c||c.length<f)c=new Uint32Array(f),e=new Uint32Array(2*f),n=new Uint32Array(2*f),g=new Uint32Array(f),m=new Uint32Array(f);f=c.subarray(0,f);f.fill(0);for(var v=
e,t=n,x=g,A=m,K=0,E=a[d]+1>>>0,G=0,O=0,Q=l-C,M=l*F-l*y,L=0;L<B;++L,d+=J,O+=M)for(var S=0;S<y;++S,d+=I,O+=Q)for(var T=0;T<C;++T,d+=H){var P=a[d],R=a[d+1];if(P!==E||R!==G)E=v[2*K]=P,G=v[2*K+1]=R,x[K]=K++;f[O++]=K}x.subarray(0,K).sort(function(a,c){var b=v[2*a],e=v[2*c];return v[2*a+1]-v[2*c+1]||b-e});a=-1;C=v[2*x[0]]+1>>>0;for(y=I=0;y<K;++y){B=x[y];J=2*B;H=v[J];J=v[J+1];if(H!==C||J!==I)++a,I=2*a,C=t[I]=H,I=t[I+1]=J;A[B+1]=a}++a;return b.writeBlock(u,w,q,l*F*h,a,t,f,A,2)}var b=h(47),a=h(26);f=h(47);
d.newCache=f.newCache;var c=void 0,e=void 0,n=void 0,g=void 0,m=void 0;d.encodeBlock=l;d.encodeChannel=function(c,e,d,f){var g=4>=arguments.length||void 0===arguments[4]?0:arguments[4],h=5>=arguments.length||void 0===arguments[5]?a.getFortranOrderStrides(f,2):arguments[5];return b.encodeChannel(c,e,d,f,g,h,l)};d.encodeChannels=function(c,e,d,f){var g=4>=arguments.length||void 0===arguments[4]?0:arguments[4],h=5>=arguments.length||void 0===arguments[5]?a.getFortranOrderStrides(f,2):arguments[5];return b.encodeChannels(c,
e,d,f,g,h,l)}},function(f,d){var h=function(){function b(a,c){for(var b=0;b<c.length;b++){var d=c[b];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(a,c,e){c&&b(a.prototype,c);e&&b(a,e);return a}}(),l=function(){function b(){var a=0>=arguments.length||void 0===arguments[0]?16:arguments[0];if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");this.length=0;this.data=new Uint32Array(a)}h(b,[{key:"resize",
value:function(a){var c=this.data;if(a>c.length){var b=new Uint32Array(Math.max(a,2*c.length));b.set(c.subarray(0,this.length));this.data=b}this.length=a}},{key:"shrinkToFit",value:function(){this.data=new Uint32Array(this.view)}},{key:"clear",value:function(){this.length=0}},{key:"appendArray",value:function(a){var c=this.length;this.resize(c+a.length);this.data.set(a,c)}},{key:"view",get:function(){var a=this.data;return new Uint32Array(a.buffer,a.byteOffset,this.length)}}]);return b}();d.Uint32ArrayBuilder=
l},function(f,d,h){var l=h(51),b=h(15);d.decodeJpegStack=function(a,c){var e=new l.JpegDecoder;e.parse(a);if(1!==e.numComponents)throw Error("JPEG data does not have the expected number of components");if(e.width*e.height!==c[0]*c[1]*c[2])throw Error("JPEG data does not have the expected dimensions: width="+e.width+", height="+e.height+", chunkDataSize="+b.vec3.str(c));return e.getData(e.width,e.height,!1)}},function(f,d,h){function l(a,c){if(0===a.indexOf("data:")){for(var b=a.indexOf("base64,")+
7,b=atob(a.substring(b)),d=new Uint8Array(b.length),f=b.length-1;0<=f;f--)d[f]=b.charCodeAt(f);c(d.buffer)}else{var h=new XMLHttpRequest;h.open("GET",a,!0);h.responseType="arraybuffer";h.onload=function(){c(h.response)};h.send(null)}}d=function(){function a(){this._src=null;this._parser=new b.JpegImage;this.onload=null}a.prototype={get src(){return this._src},set src(a){this.load(a)},get width(){return this._parser.width},get height(){return this._parser.height},load:function(a){this._src=a;l(a,function(a){this.parse(new Uint8Array(a));
if(this.onload)this.onload()}.bind(this))},parse:function(a){this._parser.parse(a)},getData:function(a,b){return this._parser.getData(a,b,!1)},copyToImageData:function(a){if(2===this._parser.numComponents||4<this._parser.numComponents)throw Error("Unsupported amount of components");var b=a.width,d=a.height,f=b*d*4;a=a.data;if(1===this._parser.numComponents)for(var h=this._parser.getData(b,d,!1),d=b=0;b<f;){var k=h[d++];a[b++]=k;a[b++]=k;a[b++]=k;a[b++]=255}else for(h=this._parser.getData(b,d,!0),
d=b=0;b<f;)a[b++]=h[d++],a[b++]=h[d++],a[b++]=h[d++],a[b++]=255}};return a}();var b;(function(a){function c(a){for(var c=1,b=0;a>c;)c<<=1,b++;return b}function b(a,c){return a[c]<<8|a[c+1]}function d(a,c){return(a[c]<<24|a[c+1]<<16|a[c+2]<<8|a[c+3])>>>0}function f(a,c,b){Object.defineProperty(a,c,{value:b,enumerable:!0,configurable:!0,writable:!1});return b}var h=function(){function a(){}function c(a,b){for(var d=0,e=[],f,h,g=16;0<g&&!a[g-1];)g--;e.push({children:[],index:0});var k=e[0],m;for(f=0;f<
g;f++){for(h=0;h<a[f];h++){k=e.pop();for(k.children[k.index]=b[d];0<k.index;)k=e.pop();k.index++;for(e.push(k);e.length<=f;)e.push(m={children:[],index:0}),k.children[k.index]=m.children,k=m;d++}f+1<g&&(e.push(m={children:[],index:0}),k.children[k.index]=m.children,k=m)}return e[0].children}function b(a,c,d,e,h,g,k,m,l){function y(){if(0<B)return B--,C>>B&1;C=a[c++];if(255===C){var b=a[c++];if(b)throw"unexpected marker: "+(C<<8|b).toString(16);}B=7;return C>>>7}function n(a){for(;;){a=a[y()];if("number"===
typeof a)return a;if("object"!==typeof a)throw"invalid huffman sequence";}}function u(a){for(var c=0;0<a;)c=c<<1|y(),a--;return c}function p(a){if(1===a)return 1===y()?1:-1;var c=u(a);return c>=1<<a-1?c:c+(-1<<a)+1}function L(a,c){var b=n(a.huffmanTableDC),b=0===b?0:p(b);a.blockData[c]=a.pred+=b;for(b=1;64>b;){var d=n(a.huffmanTableAC),e=d&15,d=d>>4;if(0===e){if(15>d)break;b+=16}else b+=d,a.blockData[c+f[b]]=p(e),b++}}function S(a,c){var b=n(a.huffmanTableDC),b=0===b?0:p(b)<<l;a.blockData[c]=a.pred+=
b}function r(a,c){a.blockData[c]|=y()<<l}function P(a,c){if(0<z)z--;else for(var b=g;b<=k;){var d=n(a.huffmanTableAC),e=d&15,d=d>>4;if(0===e){if(15>d){z=u(d)+(1<<d)-1;break}b+=16}else b+=d,a.blockData[c+f[b]]=p(e)*(1<<l),b++}}function R(a,c){for(var b=g,d=0,e;b<=k;){e=f[b];switch(w){case 0:d=n(a.huffmanTableAC);e=d&15;d>>=4;if(0===e)15>d?(z=u(d)+(1<<d),w=4):(d=16,w=1);else{if(1!==e)throw"invalid ACn encoding";D=p(e);w=d?2:3}continue;case 1:case 2:a.blockData[c+e]?a.blockData[c+e]+=y()<<l:(d--,0===
d&&(w=2===w?3:0));break;case 3:a.blockData[c+e]?a.blockData[c+e]+=y()<<l:(a.blockData[c+e]=D<<l,w=0);break;case 4:a.blockData[c+e]&&(a.blockData[c+e]+=y()<<l)}b++}4===w&&(z--,0===z&&(w=0))}var q=d.mcusPerLine,N=c,C=0,B=0,z=0,w=0,D,eb=e.length,W,ma,Aa,ta,ua;m=d.progressive?0===g?0===m?S:r:0===m?P:R:L;var ba=0;d=1===eb?e[0].blocksPerLine*e[0].blocksPerColumn:q*d.mcusPerColumn;h||(h=d);for(var Ia,ab;ba<d;){for(ma=0;ma<eb;ma++)e[ma].pred=0;z=0;if(1===eb)for(W=e[0],ua=0;ua<h;ua++)m(W,64*((W.blocksPerLine+
1)*(ba/W.blocksPerLine|0)+ba%W.blocksPerLine)),ba++;else for(ua=0;ua<h;ua++){for(ma=0;ma<eb;ma++)for(W=e[ma],Ia=W.h,ab=W.v,Aa=0;Aa<ab;Aa++)for(ta=0;ta<Ia;ta++)m(W,64*((W.blocksPerLine+1)*((ba/q|0)*W.v+Aa)+(ba%q*W.h+ta)));ba++}B=0;W=a[c]<<8|a[c+1];if(65280>=W)throw"marker was not found";if(65488<=W&&65495>=W)c+=2;else break}return c-N}function d(a,c){for(var b=c.blocksPerLine,e=c.blocksPerColumn,f=new Int16Array(64),h=0;h<e;h++)for(var g=0;g<b;g++){for(var k=64*((c.blocksPerLine+1)*h+g),m=f,l=c.quantizationTable,
y=c.blockData,n=void 0,u=void 0,L=void 0,p=void 0,r=void 0,P=void 0,R=void 0,q=void 0,N=void 0,C=q=void 0,B=R=u=P=void 0,z=void 0,N=void 0,w=0;64>w;w+=8)N=y[k+w],q=y[k+w+1],C=y[k+w+2],P=y[k+w+3],u=y[k+w+4],R=y[k+w+5],B=y[k+w+6],z=y[k+w+7],N*=l[w],0===(q|C|P|u|R|B|z)?(N=5793*N+512>>10,m[w]=N,m[w+1]=N,m[w+2]=N,m[w+3]=N,m[w+4]=N,m[w+5]=N,m[w+6]=N,m[w+7]=N):(q*=l[w+1],C*=l[w+2],P*=l[w+3],u*=l[w+4],R*=l[w+5],B*=l[w+6],z*=l[w+7],n=5793*N+128>>8,u=5793*u+128>>8,L=C,p=B,r=2896*(q-z)+128>>8,q=2896*(q+z)+128>>
8,P<<=4,R<<=4,n=n+u+1>>1,u=n-u,N=3784*L+1567*p+128>>8,L=1567*L-3784*p+128>>8,p=N,r=r+R+1>>1,R=r-R,q=q+P+1>>1,P=q-P,n=n+p+1>>1,p=n-p,u=u+L+1>>1,L=u-L,N=2276*r+3406*q+2048>>12,r=3406*r-2276*q+2048>>12,q=N,N=799*P+4017*R+2048>>12,P=4017*P-799*R+2048>>12,R=N,m[w]=n+q,m[w+7]=n-q,m[w+1]=u+R,m[w+6]=u-R,m[w+2]=L+P,m[w+5]=L-P,m[w+3]=p+r,m[w+4]=p-r);for(l=0;8>l;++l)N=m[l],q=m[l+8],C=m[l+16],P=m[l+24],u=m[l+32],R=m[l+40],B=m[l+48],z=m[l+56],0===(q|C|P|u|R|B|z)?(N=5793*N+8192>>14,N=-2040>N?0:2024<=N?255:N+2056>>
4,y[k+l]=N,y[k+l+8]=N,y[k+l+16]=N,y[k+l+24]=N,y[k+l+32]=N,y[k+l+40]=N,y[k+l+48]=N,y[k+l+56]=N):(n=5793*N+2048>>12,u=5793*u+2048>>12,L=C,p=B,r=2896*(q-z)+2048>>12,q=2896*(q+z)+2048>>12,n=(n+u+1>>1)+4112,u=n-u,N=3784*L+1567*p+2048>>12,L=1567*L-3784*p+2048>>12,p=N,r=r+R+1>>1,R=r-R,q=q+P+1>>1,P=q-P,n=n+p+1>>1,p=n-p,u=u+L+1>>1,L=u-L,N=2276*r+3406*q+2048>>12,r=3406*r-2276*q+2048>>12,q=N,N=799*P+4017*R+2048>>12,P=4017*P-799*R+2048>>12,R=N,N=n+q,z=n-q,q=u+R,B=u-R,C=L+P,R=L-P,P=p+r,u=p-r,N=16>N?0:4080<=N?
255:N>>4,q=16>q?0:4080<=q?255:q>>4,C=16>C?0:4080<=C?255:C>>4,P=16>P?0:4080<=P?255:P>>4,u=16>u?0:4080<=u?255:u>>4,R=16>R?0:4080<=R?255:R>>4,B=16>B?0:4080<=B?255:B>>4,z=16>z?0:4080<=z?255:z>>4,y[k+l]=N,y[k+l+8]=q,y[k+l+16]=C,y[k+l+24]=P,y[k+l+32]=u,y[k+l+40]=R,y[k+l+48]=B,y[k+l+56]=z)}return c.blockData}function e(a){return 0>=a?0:255<=a?255:a}var f=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,
59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]);a.prototype={parse:function(a){function e(){var c=a[k]<<8|a[k+1];k+=2;return c}function h(){var c=e(),c=a.subarray(k,k+c-2);k+=c.length;return c}function g(a){for(var c=Math.ceil(a.samplesPerLine/8/a.maxH),b=Math.ceil(a.scanLines/8/a.maxV),d=0;d<a.components.length;d++){N=a.components[d];var e=Math.ceil(Math.ceil(a.samplesPerLine/8)*N.h/a.maxH),f=Math.ceil(Math.ceil(a.scanLines/8)*N.v/a.maxV);N.blockData=new Int16Array(64*b*N.v*(c*N.h+1));N.blocksPerLine=
e;N.blocksPerColumn=f}a.mcusPerLine=c;a.mcusPerColumn=b}var k=0,m=null,l=null,n,p,r=[],q=[],B=[],M=e();if(65496!==M)throw"SOI not found";for(M=e();65497!==M;){var L,S;switch(M){case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:L=h();65504===M&&74===L[0]&&70===L[1]&&73===L[2]&&70===L[3]&&0===L[4]&&(m={version:{major:L[5],minor:L[6]},densityUnits:L[7],xDensity:L[8]<<
8|L[9],yDensity:L[10]<<8|L[11],thumbWidth:L[12],thumbHeight:L[13],thumbData:L.subarray(14,14+3*L[12]*L[13])});65518===M&&65===L[0]&&100===L[1]&&111===L[2]&&98===L[3]&&101===L[4]&&0===L[5]&&(l={version:L[6],flags0:L[7]<<8|L[8],flags1:L[9]<<8|L[10],transformCode:L[11]});break;case 65499:for(var M=e()+k-2,T;k<M;){var P=a[k++],R=new Uint16Array(64);if(0===P>>4)for(L=0;64>L;L++)T=f[L],R[T]=a[k++];else if(1===P>>4)for(L=0;64>L;L++)T=f[L],R[T]=e();else throw"DQT: invalid table spec";r[P&15]=R}break;case 65472:case 65473:case 65474:if(n)throw"Only single frame JPEGs supported";
e();n={};n.extended=65473===M;n.progressive=65474===M;n.precision=a[k++];n.scanLines=e();n.samplesPerLine=e();n.components=[];n.componentIds={};L=a[k++];for(M=R=P=0;M<L;M++){T=a[k];S=a[k+1]>>4;var w=a[k+1]&15;P<S&&(P=S);R<w&&(R=w);S=n.components.push({h:S,v:w,quantizationTable:r[a[k+2]]});n.componentIds[T]=S-1;k+=3}n.maxH=P;n.maxV=R;g(n);break;case 65476:T=e();for(M=2;M<T;){P=a[k++];R=new Uint8Array(16);for(L=S=0;16>L;L++,k++)S+=R[L]=a[k];w=new Uint8Array(S);for(L=0;L<S;L++,k++)w[L]=a[k];M+=17+S;
(0===P>>4?B:q)[P&15]=c(R,w)}break;case 65501:e();p=e();break;case 65498:e();T=a[k++];L=[];for(var N,M=0;M<T;M++)P=n.componentIds[a[k++]],N=n.components[P],P=a[k++],N.huffmanTableDC=B[P>>4],N.huffmanTableAC=q[P&15],L.push(N);M=a[k++];T=a[k++];P=a[k++];M=b(a,k,n,L,p,M,T,P>>4,P&15);k+=M;break;case 65535:255!==a[k]&&k--;break;default:if(255===a[k-3]&&192<=a[k-2]&&254>=a[k-2])k-=3;else throw"unknown JPEG marker "+M.toString(16);}M=e()}this.width=n.samplesPerLine;this.height=n.scanLines;this.jfif=m;this.adobe=
l;this.components=[];for(M=0;M<n.components.length;M++)N=n.components[M],this.components.push({output:d(n,N),scaleX:N.h/n.maxH,scaleY:N.v/n.maxV,blocksPerLine:N.blocksPerLine,blocksPerColumn:N.blocksPerColumn});this.numComponents=this.components.length},_getLinearizedBlockData:function(a,c){var b=this.width/a,d=this.height/c,e,f,k,h,g,m,l=0,y,n=this.components.length,L=a*c*n,u=new Uint8Array(L),p=new Uint32Array(a);for(m=0;m<n;m++){e=this.components[m];f=e.scaleX*b;k=e.scaleY*d;l=m;y=e.output;h=e.blocksPerLine+
1<<3;for(g=0;g<a;g++)e=0|g*f,p[g]=(e&4294967288)<<3|e&7;for(f=0;f<c;f++)for(e=0|f*k,e=h*(e&4294967288)|(e&7)<<3,g=0;g<a;g++)u[l]=y[e+p[g]],l+=n}if(d=this.decodeTransform)for(m=0;m<L;)for(b=e=0;e<n;e++,m++,b+=2)u[m]=(u[m]*d[b]>>8)+d[b+1];return u},_isColorConversionNeeded:function(){return this.adobe&&this.adobe.transformCode?!0:3===this.numComponents?!0:!1},_convertYccToRgb:function(a){for(var c,b,d,f=0,k=a.length;f<k;f+=3)c=a[f],b=a[f+1],d=a[f+2],a[f]=e(c-179.456+1.402*d),a[f+1]=e(c+135.459-.344*
b-.714*d),a[f+2]=e(c-226.816+1.772*b);return a},_convertYcckToRgb:function(a){for(var c,b,d,f,k=0,g=0,h=a.length;g<h;g+=4){c=a[g];b=a[g+1];d=a[g+2];f=a[g+3];var m=-122.67195406894+b*(-6.60635669420364E-5*b+4.37130475926232E-4*d-5.4080610064599E-5*c+4.8449797120281E-4*f-.154362151871126)+d*(-9.57964378445773E-4*d+8.17076911346625E-4*c-.00477271405408747*f+1.53380253221734)+c*(9.61250184130688E-4*c-.00266257332283933*f+.48357088451265)+f*(-3.36197177618394E-4*f+.484791561490776),l=107.268039397724+
b*(2.19927104525741E-5*b-6.40992018297945E-4*d+6.59397001245577E-4*c+4.26105652938837E-4*f-.176491792462875)+d*(-7.78269941513683E-4*d+.00130872261408275*c+7.70482631801132E-4*f-.151051492775562)+c*(.00126935368114843*c-.00265090189010898*f+.25802910206845)+f*(-3.18913117588328E-4*f-.213742400323665);c=-20.810012546947+b*(-5.70115196973677E-4*b-2.63409051004589E-5*d+.0020741088115012*c-.00288260236853442*f+.814272968359295)+d*(-1.53496057440975E-5*d-1.32689043961446E-4*c+5.60833691242812E-4*f-.195152027534049)+
c*(.00174418132927582*c-.00255243321439347*f+.116935020465145)+f*(-3.43531996510555E-4*f+.24165260232407);a[k++]=e(m);a[k++]=e(l);a[k++]=e(c)}return a},_convertYcckToCmyk:function(a){for(var c,b,d,f=0,k=a.length;f<k;f+=4)c=a[f],b=a[f+1],d=a[f+2],a[f]=e(434.456-c-1.402*d),a[f+1]=e(119.541-c+.344*b+.714*d),a[f+2]=e(481.816-c-1.772*b);return a},_convertCmykToRgb:function(a){for(var c,b,d,e,f=0,k=1/255/255,g=0,h=a.length;g<h;g+=4){c=a[g];b=a[g+1];d=a[g+2];e=a[g+3];var m=c*(-4.387332384609988*c+54.48615194189176*
b+18.82290502165302*d+212.25662451639585*e-72734.4411664936)+b*(1.7149763477362134*b-5.6096736904047315*d-17.873870861415444*e-1401.7366389350734)+d*(-2.5217340131683033*d-21.248923337353073*e+4465.541406466231)-e*(21.86122147463605*e+48317.86113160301),l=c*(8.841041422036149*c+60.118027045597366*b+6.871425592049007*d+31.159100130055922*e-20220.756542821975)+b*(-15.310361306967817*b+17.575251261109482*d+131.35250912493976*e-48691.05921601825)+d*(4.444339102852739*d+9.8632861493405*e-6341.191035517494)-
e*(20.737325471181034*e+47890.15695978492);c=c*(.8842522430003296*c+8.078677503112928*b+30.89978309703729*d-.23883238689178934*e-3616.812083916688)+b*(10.49593273432072*b+63.02378494754052*d+50.606957656360734*e-28620.90484698408)+d*(.03296041114873217*d+115.60384449646641*e-49363.43385999684)-e*(22.33816807309886*e+45932.16563550634);a[f++]=0<=m?255:-16581375>=m?0:255+m*k|0;a[f++]=0<=l?255:-16581375>=l?0:255+l*k|0;a[f++]=0<=c?255:-16581375>=c?0:255+c*k|0}return a},getData:function(a,c,b){if(4<this.numComponents)throw"Unsupported color mode";
a=this._getLinearizedBlockData(a,c);if(3===this.numComponents)return this._convertYccToRgb(a);if(4===this.numComponents){if(this._isColorConversionNeeded())return b?this._convertYcckToRgb(a):this._convertYcckToCmyk(a);if(b)return this._convertCmykToRgb(a)}return a}};return a}();"use strict";var k=function(){function a(c,b,d){this.data=c;this.bp=b;this.dataEnd=d;this.chigh=c[b];this.clow=0;this.byteIn();this.chigh=this.chigh<<7&65535|this.clow>>9&127;this.clow=this.clow<<7&65535;this.ct-=7;this.a=
32768}var c=[{qe:22017,nmps:1,nlps:1,switchFlag:1},{qe:13313,nmps:2,nlps:6,switchFlag:0},{qe:6145,nmps:3,nlps:9,switchFlag:0},{qe:2753,nmps:4,nlps:12,switchFlag:0},{qe:1313,nmps:5,nlps:29,switchFlag:0},{qe:545,nmps:38,nlps:33,switchFlag:0},{qe:22017,nmps:7,nlps:6,switchFlag:1},{qe:21505,nmps:8,nlps:14,switchFlag:0},{qe:18433,nmps:9,nlps:14,switchFlag:0},{qe:14337,nmps:10,nlps:14,switchFlag:0},{qe:12289,nmps:11,nlps:17,switchFlag:0},{qe:9217,nmps:12,nlps:18,switchFlag:0},{qe:7169,nmps:13,nlps:20,switchFlag:0},
{qe:5633,nmps:29,nlps:21,switchFlag:0},{qe:22017,nmps:15,nlps:14,switchFlag:1},{qe:21505,nmps:16,nlps:14,switchFlag:0},{qe:20737,nmps:17,nlps:15,switchFlag:0},{qe:18433,nmps:18,nlps:16,switchFlag:0},{qe:14337,nmps:19,nlps:17,switchFlag:0},{qe:13313,nmps:20,nlps:18,switchFlag:0},{qe:12289,nmps:21,nlps:19,switchFlag:0},{qe:10241,nmps:22,nlps:19,switchFlag:0},{qe:9217,nmps:23,nlps:20,switchFlag:0},{qe:8705,nmps:24,nlps:21,switchFlag:0},{qe:7169,nmps:25,nlps:22,switchFlag:0},{qe:6145,nmps:26,nlps:23,
switchFlag:0},{qe:5633,nmps:27,nlps:24,switchFlag:0},{qe:5121,nmps:28,nlps:25,switchFlag:0},{qe:4609,nmps:29,nlps:26,switchFlag:0},{qe:4353,nmps:30,nlps:27,switchFlag:0},{qe:2753,nmps:31,nlps:28,switchFlag:0},{qe:2497,nmps:32,nlps:29,switchFlag:0},{qe:2209,nmps:33,nlps:30,switchFlag:0},{qe:1313,nmps:34,nlps:31,switchFlag:0},{qe:1089,nmps:35,nlps:32,switchFlag:0},{qe:673,nmps:36,nlps:33,switchFlag:0},{qe:545,nmps:37,nlps:34,switchFlag:0},{qe:321,nmps:38,nlps:35,switchFlag:0},{qe:273,nmps:39,nlps:36,
switchFlag:0},{qe:133,nmps:40,nlps:37,switchFlag:0},{qe:73,nmps:41,nlps:38,switchFlag:0},{qe:37,nmps:42,nlps:39,switchFlag:0},{qe:21,nmps:43,nlps:40,switchFlag:0},{qe:9,nmps:44,nlps:41,switchFlag:0},{qe:5,nmps:45,nlps:42,switchFlag:0},{qe:1,nmps:45,nlps:43,switchFlag:0},{qe:22017,nmps:46,nlps:46,switchFlag:0}];a.prototype={byteIn:function(){var a=this.data,c=this.bp;255===a[c]?143<a[c+1]?(this.clow+=65280,this.ct=8):(c++,this.clow+=a[c]<<9,this.ct=7,this.bp=c):(c++,this.clow+=c<this.dataEnd?a[c]<<
8:65280,this.ct=8,this.bp=c);65535<this.clow&&(this.chigh+=this.clow>>16,this.clow&=65535)},readBit:function(a,b){var d=a[b]>>1,e=a[b]&1,d=c[d],f=d.qe,k=this.a-f;if(this.chigh<f)k<f?(k=f,f=e,d=d.nmps):(k=f,f=1^e,1===d.switchFlag&&(e=f),d=d.nlps);else{this.chigh-=f;if(0!==(k&32768))return this.a=k,e;k<f?(f=1^e,1===d.switchFlag&&(e=f),d=d.nlps):(f=e,d=d.nmps)}do 0===this.ct&&this.byteIn(),k<<=1,this.chigh=this.chigh<<1&65535|this.clow>>15&1,this.clow=this.clow<<1&65535,this.ct--;while(0===(k&32768));
this.a=k;a[b]=d<<1|e;return f}};return a}();"use strict";var l=function(){function a(){this.failOnCorruptedImage=!1}function f(a,c,b){a=b.xcb_;b=b.ycb_;var d=1<<a,e=1<<b,k=c.tbx0>>a,g=c.tby0>>b,h=c.tbx1+d-1>>a,m=c.tby1+e-1>>b,l=c.resolution.precinctParameters,v=[],y=[],n,u,p,r;for(u=g;u<m;u++)for(n=k;n<h;n++)if(p={cbx:n,cby:u,tbx0:d*n,tby0:e*u,tbx1:d*(n+1),tby1:e*(u+1)},p.tbx0_=Math.max(c.tbx0,p.tbx0),p.tby0_=Math.max(c.tby0,p.tby0),p.tbx1_=Math.min(c.tbx1,p.tbx1),p.tby1_=Math.min(c.tby1,p.tby1),
r=Math.floor((p.tbx0_-c.tbx0)/l.precinctWidthInSubband)+Math.floor((p.tby0_-c.tby0)/l.precinctHeightInSubband)*l.numprecinctswide,p.precinctNumber=r,p.subbandType=c.type,p.Lblock=3,!(p.tbx1_<=p.tbx0_||p.tby1_<=p.tby0_)){v.push(p);var q=y[r];void 0!==q?(n<q.cbxMin?q.cbxMin=n:n>q.cbxMax&&(q.cbxMax=n),u<q.cbyMin?q.cbxMin=u:u>q.cbyMax&&(q.cbyMax=u)):y[r]=q={cbxMin:n,cbyMin:u,cbxMax:n,cbyMax:u};p.precinct=q}c.codeblockParameters={codeblockWidth:a,codeblockHeight:b,numcodeblockwide:h-k+1,numcodeblockhigh:m-
g+1};c.codeblocks=v;c.precincts=y}function g(a,c,b){var d=[];a=a.subbands;for(var e=0,f=a.length;e<f;e++)for(var k=a[e].codeblocks,h=0,m=k.length;h<m;h++){var l=k[h];l.precinctNumber===c&&d.push(l)}return{layerNumber:b,codeblocks:d}}function h(a){var c=a.tiles[a.currentTile.index],b=c.codingStyleDefaultParameters.layersCount,d=a.SIZ.Csiz,e=0;for(a=0;a<d;a++)e=Math.max(e,c.components[a].codingStyleParameters.decompositionLevelsCount);var f=0,k=0,m=0,l=0;this.nextPacket=function(){for(;f<b;f++){for(;k<=
e;k++){for(;m<d;m++){var a=c.components[m];if(!(k>a.codingStyleParameters.decompositionLevelsCount)){for(var a=a.resolutions[k],h=a.precinctParameters.numprecincts;l<h;)return a=g(a,l,f),l++,a;l=0}}m=0}k=0}throw Error("JPX Error: Out of packets");}}function m(a){var c=a.tiles[a.currentTile.index],b=c.codingStyleDefaultParameters.layersCount,d=a.SIZ.Csiz,e=0;for(a=0;a<d;a++)e=Math.max(e,c.components[a].codingStyleParameters.decompositionLevelsCount);var f=0,k=0,h=0,l=0;this.nextPacket=function(){for(;f<=
e;f++){for(;k<b;k++){for(;h<d;h++){var a=c.components[h];if(!(f>a.codingStyleParameters.decompositionLevelsCount)){for(var a=a.resolutions[f],m=a.precinctParameters.numprecincts;l<m;)return a=g(a,l,k),l++,a;l=0}}h=0}k=0}throw Error("JPX Error: Out of packets");}}function l(a){var c=a.tiles[a.currentTile.index],b=c.codingStyleDefaultParameters.layersCount,d=a.SIZ.Csiz,e,f,k,h,m=0;for(k=0;k<d;k++)m=Math.max(m,c.components[k].codingStyleParameters.decompositionLevelsCount);var v=new Int32Array(m+1);
for(f=0;f<=m;++f){for(k=a=0;k<d;++k){var y=c.components[k].resolutions;f<y.length&&(a=Math.max(a,y[f].precinctParameters.numprecincts))}v[f]=a}h=k=f=e=0;this.nextPacket=function(){for(;f<=m;f++){for(;h<v[f];h++){for(;k<d;k++){var a=c.components[k];if(!(f>a.codingStyleParameters.decompositionLevelsCount||(a=a.resolutions[f],h>=a.precinctParameters.numprecincts))){for(;e<b;)return a=g(a,h,e),e++,a;e=0}}k=0}h=0}throw Error("JPX Error: Out of packets");}}function p(a){var c=a.tiles[a.currentTile.index],
b=c.codingStyleDefaultParameters.layersCount,d=a.SIZ.Csiz,e=v(c),f=0,k=0,h=0,m=0,l=0;this.nextPacket=function(){for(;l<e.maxNumHigh;l++){for(;m<e.maxNumWide;m++){for(;h<d;h++){for(var a=c.components[h],v=a.codingStyleParameters.decompositionLevelsCount;k<=v;k++){var y=a.resolutions[k],n=z(m,l,e.components[h].resolutions[k],e,y);if(null!==n){for(;f<b;)return a=g(y,n,f),f++,a;f=0}}k=0}h=0}m=0}throw Error("JPX Error: Out of packets");}}function r(a){var c=a.tiles[a.currentTile.index],b=c.codingStyleDefaultParameters.layersCount,
d=a.SIZ.Csiz,e=v(c),f=0,k=0,h=0,m=0,l=0;this.nextPacket=function(){for(;h<d;++h){for(var a=c.components[h],v=e.components[h],y=a.codingStyleParameters.decompositionLevelsCount;l<v.maxNumHigh;l++){for(;m<v.maxNumWide;m++){for(;k<=y;k++){var n=a.resolutions[k],u=z(m,l,v.resolutions[k],v,n);if(null!==u){for(;f<b;)return a=g(n,u,f),f++,a;f=0}}k=0}m=0}l=0}throw Error("JPX Error: Out of packets");}}function z(a,c,b,d,e){a*=d.minWidth;c*=d.minHeight;return 0!==a%b.width||0!==c%b.height?null:a/b.height+c/
b.width*e.precinctParameters.numprecinctswide}function v(a){for(var c=a.components.length,b=Number.MAX_VALUE,d=Number.MAX_VALUE,e=0,f=0,k=Array(c),h=0;h<c;h++){for(var g=a.components[h],m=g.codingStyleParameters.decompositionLevelsCount,l=Array(m+1),v=Number.MAX_VALUE,y=Number.MAX_VALUE,n=0,u=0,p=1;0<=m;--m){var r=g.resolutions[m],q=p*r.precinctParameters.precinctWidth,A=p*r.precinctParameters.precinctHeight,v=Math.min(v,q),y=Math.min(y,A),n=Math.max(n,r.precinctParameters.numprecinctswide),u=Math.max(u,
r.precinctParameters.numprecinctshigh);l[m]={width:q,height:A};p<<=1}b=Math.min(b,v);d=Math.min(d,y);e=Math.max(e,n);f=Math.max(f,u);k[h]={resolutions:l,minWidth:v,minHeight:y,maxNumWide:n,maxNumHigh:u}}return{components:k,minWidth:b,minHeight:d,maxNumWide:e,maxNumHigh:f}}function t(a,b,d,e){function f(a){for(;l<a;){var c=b[d+g];g++;v?(m=m<<7|c,l+=7,v=!1):(m=m<<8|c,l+=8);255===c&&(v=!0)}l-=a;return m>>>l&(1<<a)-1}function k(a){return 255===b[d+g-1]&&b[d+g]===a?(g+=1,!0):255===b[d+g]&&b[d+g+1]===a?
(g+=2,!0):!1}function h(){if(0===f(1))return 1;if(0===f(1))return 2;var a=f(2);if(3>a)return a+3;a=f(5);if(31>a)return a+6;a=f(7);return a+37}var g=0,m,l=0,v=!1,y=a.COD.sopMarkerUsed,n=a.COD.ephMarkerUsed;for(a=a.tiles[a.currentTile.index].packetsIterator;g<e;){l=0;v&&(g++,v=!1);y&&k(145)&&(g+=4);var u=a.nextPacket();if(f(1)){for(var p=u.layerNumber,r=[],q,t=0,C=u.codeblocks.length;t<C;t++){q=u.codeblocks[t];var x=q.precinct,w=q.cbx-x.cbxMin,B=q.cby-x.cbyMin,z=!1,D=!1,F;if(void 0!==q.included)z=!!f(1);
else{var x=q.precinct,E,O;void 0!==x.inclusionTree?E=x.inclusionTree:(F=x.cbxMax-x.cbxMin+1,O=x.cbyMax-x.cbyMin+1,E=new K(F,O,p),O=new A(F,O),x.inclusionTree=E,x.zeroBitPlanesTree=O);if(E.reset(w,B,p))for(;;)if(f(1)){if(F=!E.nextLevel()){z=D=q.included=!0;break}}else{E.incrementValue(p);break}}if(z){if(D){O=x.zeroBitPlanesTree;for(O.reset(w,B);;)if(f(1)){if(F=!O.nextLevel())break}else O.incrementValue();q.zeroBitPlanes=O.value}for(x=h();f(1);)q.Lblock++;w=c(x);w=f((x<1<<w?w-1:w)+q.Lblock);r.push({codeblock:q,
codingpasses:x,dataLength:w})}}l=0;v&&(g++,v=!1);for(n&&k(146);0<r.length;)u=r.shift(),q=u.codeblock,void 0===q.data&&(q.data=[]),q.data.push({data:b,start:d+g,end:d+g+u.dataLength,codingpasses:u.codingpasses}),g+=u.dataLength}}return g}var x={LL:0,LH:1,HL:1,HH:2};a.prototype={parse:function(a){if(65359===b(a,0))this.parseCodestream(a,0,a.length);else for(var c=0,f=a.length;c<f;){var k=8,g=d(a,c),h=d(a,c+4),c=c+k;1===g&&(g=4294967296*d(a,c)+d(a,c+4),c+=8,k+=8);0===g&&(g=f-c+k);if(g<k)throw Error("JPX Error: Invalid box field size");
k=g-k;g=!0;switch(h){case 1785737832:g=!1;break;case 1668246642:h=a[c];if(1===h)switch(h=d(a,c+3),h){case 16:case 17:case 18:break;default:D("Unknown colorspace "+h)}else 2===h&&w("ICC profile not supported");break;case 1785737827:this.parseCodestream(a,c,c+k);break;case 1783636E3:218793738!==d(a,c)&&D("Invalid JP2 signature");break;case 1783634458:case 1718909296:case 1920099697:case 1919251232:case 1768449138:break;default:var m=String.fromCharCode(h>>24&255,h>>16&255,h>>8&255,h&255);D("Unsupported header type "+
h+" ("+m+")")}g&&(c+=k)}},parseImageProperties:function(a){for(var c=a.getByte();0<=c;){var b=c,c=a.getByte();if(65361===(b<<8|c)){a.skip(4);var c=a.getInt32()>>>0,b=a.getInt32()>>>0,d=a.getInt32()>>>0,e=a.getInt32()>>>0;a.skip(16);a=a.getUint16();this.width=c-d;this.height=b-e;this.componentsCount=a;this.bitsPerComponent=8;return}}throw Error("JPX Error: No size marker found in JPX stream");},parseCodestream:function(a,c,g){var v={};try{for(var q=!1,A=c;A+1<g;){var C=b(a,A),A=A+2,w=0,z,J,K,fa,za,
G;switch(C){case 65359:v.mainHeader=!0;break;case 65497:break;case 65361:var w=b(a,A),W={};W.Xsiz=d(a,A+4);W.Ysiz=d(a,A+8);W.XOsiz=d(a,A+12);W.YOsiz=d(a,A+16);W.XTsiz=d(a,A+20);W.YTsiz=d(a,A+24);W.XTOsiz=d(a,A+28);W.YTOsiz=d(a,A+32);var ma=b(a,A+36);W.Csiz=ma;var Aa=[];z=A+38;for(var ta=0;ta<ma;ta++){var ua={precision:(a[z]&127)+1,isSigned:!!(a[z]&128),XRsiz:a[z+1],YRsiz:a[z+1]},ba=ua,Ia=W;ba.x0=Math.ceil(Ia.XOsiz/ba.XRsiz);ba.x1=Math.ceil(Ia.Xsiz/ba.XRsiz);ba.y0=Math.ceil(Ia.YOsiz/ba.YRsiz);ba.y1=
Math.ceil(Ia.Ysiz/ba.YRsiz);ba.width=ba.x1-ba.x0;ba.height=ba.y1-ba.y0;Aa.push(ua)}v.SIZ=W;v.components=Aa;for(var ab=v,vc=Aa,X=ab.SIZ,U=void 0,Y=[],ga=Math.ceil((X.Xsiz-X.XTOsiz)/X.XTsiz),fb=Math.ceil((X.Ysiz-X.YTOsiz)/X.YTsiz),gb=0;gb<fb;gb++)for(var hb=0;hb<ga;hb++)U={},U.tx0=Math.max(X.XTOsiz+hb*X.XTsiz,X.XOsiz),U.ty0=Math.max(X.YTOsiz+gb*X.YTsiz,X.YOsiz),U.tx1=Math.min(X.XTOsiz+(hb+1)*X.XTsiz,X.Xsiz),U.ty1=Math.min(X.YTOsiz+(gb+1)*X.YTsiz,X.Ysiz),U.width=U.tx1-U.tx0,U.height=U.ty1-U.ty0,U.components=
[],Y.push(U);ab.tiles=Y;for(var ib=0,wc=X.Csiz;ib<wc;ib++)for(var jb=vc[ib],yb=0,xc=Y.length;yb<xc;yb++){var na={},U=Y[yb];na.tcx0=Math.ceil(U.tx0/jb.XRsiz);na.tcy0=Math.ceil(U.ty0/jb.YRsiz);na.tcx1=Math.ceil(U.tx1/jb.XRsiz);na.tcy1=Math.ceil(U.ty1/jb.YRsiz);na.width=na.tcx1-na.tcx0;na.height=na.tcy1-na.tcy0;U.components[ib]=na}v.QCC=[];v.COC=[];break;case 65372:var w=b(a,A),Qa={};z=A+2;J=a[z++];switch(J&31){case 0:fa=8;za=!0;break;case 1:fa=16;za=!1;break;case 2:fa=16;za=!0;break;default:throw Error("JPX Error: Invalid SQcd value "+
J);}Qa.noQuantization=8===fa;Qa.scalarExpounded=za;Qa.guardBits=J>>5;for(K=[];z<w+A;){var oa={};8===fa?(oa.epsilon=a[z++]>>3,oa.mu=0):(oa.epsilon=a[z]>>3,oa.mu=(a[z]&7)<<8|a[z+1],z+=2);K.push(oa)}Qa.SPqcds=K;v.mainHeader?v.QCD=Qa:(v.currentTile.QCD=Qa,v.currentTile.QCC=[]);break;case 65373:var w=b(a,A),Ra={};z=A+2;var kb;257>v.SIZ.Csiz?kb=a[z++]:(kb=b(a,z),z+=2);J=a[z++];switch(J&31){case 0:fa=8;za=!0;break;case 1:fa=16;za=!1;break;case 2:fa=16;za=!0;break;default:throw Error("JPX Error: Invalid SQcd value "+
J);}Ra.noQuantization=8===fa;Ra.scalarExpounded=za;Ra.guardBits=J>>5;for(K=[];z<w+A;)oa={},8===fa?(oa.epsilon=a[z++]>>3,oa.mu=0):(oa.epsilon=a[z]>>3,oa.mu=(a[z]&7)<<8|a[z+1],z+=2),K.push(oa);Ra.SPqcds=K;v.mainHeader?v.QCC[kb]=Ra:v.currentTile.QCC[kb]=Ra;break;case 65362:var w=b(a,A),Z={};z=A+2;var zb=a[z++];Z.entropyCoderWithCustomPrecincts=!!(zb&1);Z.sopMarkerUsed=!!(zb&2);Z.ephMarkerUsed=!!(zb&4);Z.progressionOrder=a[z++];Z.layersCount=b(a,z);z+=2;Z.multipleComponentTransform=a[z++];Z.decompositionLevelsCount=
a[z++];Z.xcb=(a[z++]&15)+2;Z.ycb=(a[z++]&15)+2;var Sa=a[z++];Z.selectiveArithmeticCodingBypass=!!(Sa&1);Z.resetContextProbabilities=!!(Sa&2);Z.terminationOnEachCodingPass=!!(Sa&4);Z.verticalyStripe=!!(Sa&8);Z.predictableTermination=!!(Sa&16);Z.segmentationSymbolUsed=!!(Sa&32);Z.reversibleTransformation=a[z++];if(Z.entropyCoderWithCustomPrecincts){for(var Wb=[];z<w+A;){var Xb=a[z++];Wb.push({PPx:Xb&15,PPy:Xb>>4})}Z.precinctsSizes=Wb}var Ja=[];Z.selectiveArithmeticCodingBypass&&Ja.push("selectiveArithmeticCodingBypass");
Z.resetContextProbabilities&&Ja.push("resetContextProbabilities");Z.terminationOnEachCodingPass&&Ja.push("terminationOnEachCodingPass");Z.verticalyStripe&&Ja.push("verticalyStripe");Z.predictableTermination&&Ja.push("predictableTermination");if(0<Ja.length)throw q=!0,Error("JPX Error: Unsupported COD options ("+Ja.join(", ")+")");v.mainHeader?v.COD=Z:(v.currentTile.COD=Z,v.currentTile.COC=[]);break;case 65424:w=b(a,A);G={};G.index=b(a,A+2);G.length=d(a,A+4);G.dataEnd=G.length+A-2;G.partIndex=a[A+
8];G.partsCount=a[A+9];v.mainHeader=!1;0===G.partIndex&&(G.COD=v.COD,G.COC=v.COC.slice(0),G.QCD=v.QCD,G.QCC=v.QCC.slice(0));v.currentTile=G;break;case 65427:G=v.currentTile;if(0===G.partIndex){for(var va=v,yc=va.SIZ.Csiz,Yb=va.tiles[G.index],Ka=0;Ka<yc;Ka++){var Zb=Yb.components[Ka];Zb.quantizationParameters=void 0!==va.currentTile.QCC[Ka]?va.currentTile.QCC[Ka]:va.currentTile.QCD;Zb.codingStyleParameters=void 0!==va.currentTile.COC[Ka]?va.currentTile.COC[Ka]:va.currentTile.COD}Yb.codingStyleDefaultParameters=
va.currentTile.COD;for(var ja=v,La=ja.tiles[ja.currentTile.index],zc=ja.SIZ.Csiz,Ab=0;Ab<zc;Ab++){for(var aa=La.components[Ab],Bb=aa.codingStyleParameters.decompositionLevelsCount,$b=[],bb=[],Ma=0;Ma<=Bb;Ma++){var wa,lb=Ma,Na=aa.codingStyleParameters,pa={};Na.entropyCoderWithCustomPrecincts?(pa.PPx=Na.precinctsSizes[lb].PPx,pa.PPy=Na.precinctsSizes[lb].PPy):(pa.PPx=15,pa.PPy=15);pa.xcb_=0<lb?Math.min(Na.xcb,pa.PPx-1):Math.min(Na.xcb,pa.PPx);pa.ycb_=0<lb?Math.min(Na.ycb,pa.PPy-1):Math.min(Na.ycb,pa.PPy);
wa=pa;var ca={},Ba=1<<Bb-Ma;ca.trx0=Math.ceil(aa.tcx0/Ba);ca.try0=Math.ceil(aa.tcy0/Ba);ca.trx1=Math.ceil(aa.tcx1/Ba);ca.try1=Math.ceil(aa.tcy1/Ba);ca.resLevel=Ma;var Cb=1<<wa.PPx,Db=1<<wa.PPy,ac=0===ca.resLevel,bc=ca.trx1>ca.trx0?Math.ceil(ca.trx1/Cb)-Math.floor(ca.trx0/Cb):0,cc=ca.try1>ca.try0?Math.ceil(ca.try1/Db)-Math.floor(ca.try0/Db):0;ca.precinctParameters={precinctWidth:Cb,precinctHeight:Db,numprecinctswide:bc,numprecinctshigh:cc,numprecincts:bc*cc,precinctWidthInSubband:1<<wa.PPx+(ac?0:-1),
precinctHeightInSubband:1<<wa.PPy+(ac?0:-1)};$b.push(ca);var V;if(0===Ma)V={type:"LL"},V.tbx0=Math.ceil(aa.tcx0/Ba),V.tby0=Math.ceil(aa.tcy0/Ba),V.tbx1=Math.ceil(aa.tcx1/Ba),V.tby1=Math.ceil(aa.tcy1/Ba),V.resolution=ca,f(ja,V,wa),bb.push(V),ca.subbands=[V];else{var ka=1<<Bb-Ma+1,mb=[];V={type:"HL"};V.tbx0=Math.ceil(aa.tcx0/ka-.5);V.tby0=Math.ceil(aa.tcy0/ka);V.tbx1=Math.ceil(aa.tcx1/ka-.5);V.tby1=Math.ceil(aa.tcy1/ka);V.resolution=ca;f(ja,V,wa);bb.push(V);mb.push(V);V={type:"LH"};V.tbx0=Math.ceil(aa.tcx0/
ka);V.tby0=Math.ceil(aa.tcy0/ka-.5);V.tbx1=Math.ceil(aa.tcx1/ka);V.tby1=Math.ceil(aa.tcy1/ka-.5);V.resolution=ca;f(ja,V,wa);bb.push(V);mb.push(V);V={type:"HH"};V.tbx0=Math.ceil(aa.tcx0/ka-.5);V.tby0=Math.ceil(aa.tcy0/ka-.5);V.tbx1=Math.ceil(aa.tcx1/ka-.5);V.tby1=Math.ceil(aa.tcy1/ka-.5);V.resolution=ca;f(ja,V,wa);bb.push(V);mb.push(V);ca.subbands=mb}}aa.resolutions=$b;aa.subbands=bb}var dc=La.codingStyleDefaultParameters.progressionOrder;switch(dc){case 0:La.packetsIterator=new h(ja);break;case 1:La.packetsIterator=
new m(ja);break;case 2:La.packetsIterator=new l(ja);break;case 3:La.packetsIterator=new p(ja);break;case 4:La.packetsIterator=new r(ja);break;default:throw Error("JPX Error: Unsupported progression order "+dc);}}w=G.dataEnd-A;t(v,a,A,w);break;case 65365:case 65367:case 65368:case 65380:w=b(a,A);break;case 65363:throw Error("JPX Error: Codestream code 0xFF53 (COC) is not implemented");default:throw Error("JPX Error: Unknown codestream code: "+C.toString(16));}A+=w}}catch(ec){if(q||this.failOnCorruptedImage)throw ec;
D("Trying to recover from "+ec.message)}for(var fc=v.components,Ta=v.SIZ.Csiz,gc=[],Eb=0,Ac=v.tiles.length;Eb<Ac;Eb++){var Fb=v.tiles[Eb],Oa=[],la;for(la=0;la<Ta;la++){for(var Bc=Oa,Cc=la,Pa=Fb.components[la],Gb=Pa.codingStyleParameters,Hb=Pa.quantizationParameters,Dc=Gb.decompositionLevelsCount,nb=Hb.SPqcds,Ec=Hb.scalarExpounded,Fc=Hb.guardBits,Gc=Gb.segmentationSymbolUsed,Hc=v.components[la].precision,Ib=Gb.reversibleTransformation,Ic=Ib?new Q:new O,hc=[],Jb=0,cb=0;cb<=Dc;cb++){for(var Ua=Pa.resolutions[cb],
Kb=Ua.trx1-Ua.trx0,ic=Ua.try1-Ua.try0,jc=new Float32Array(Kb*ic),Lb=0,Jc=Ua.subbands.length;Lb<Jc;Lb++){var Mb,ob;Ec?(Mb=nb[Jb].mu,ob=nb[Jb].epsilon,Jb++):(Mb=nb[0].mu,ob=nb[0].epsilon+(0<cb?1-cb:0));for(var kc=Ua.subbands[Lb],Kc=x[kc.type],Lc=jc,lc=Kb,Ca=kc,Mc=Ib?1:Math.pow(2,Hc+Kc-ob)*(1+Mb/2048),Nb=Fc+ob-1,mc=Ib,Nc=Gc,Oc=Ca.tbx0,Pc=Ca.tby0,pb=Ca.tbx1-Ca.tbx0,nc=Ca.codeblocks,Qc="H"===Ca.type.charAt(0)?1:0,Rc="H"===Ca.type.charAt(1)?lc:0,Ob=0,Sc=nc.length;Ob<Sc;++Ob){var ra=nc[Ob],qb=ra.tbx1_-ra.tbx0_,
Pb=ra.tby1_-ra.tby0_;if(0!==qb&&0!==Pb&&void 0!==ra.data){var xa,rb;xa=new E(qb,Pb,ra.subbandType,ra.zeroBitPlanes,Nb);rb=2;var sb=ra.data,tb=0,Qb=0,ha,ub,Da;ha=0;for(ub=sb.length;ha<ub;ha++)Da=sb[ha],tb+=Da.end-Da.start,Qb+=Da.codingpasses;var oc=new Uint8Array(tb),Ea=0;ha=0;for(ub=sb.length;ha<ub;ha++){Da=sb[ha];var pc=Da.data.subarray(Da.start,Da.end);oc.set(pc,Ea);Ea+=pc.length}var Tc=new k(oc,0,tb);xa.setDecoder(Tc);for(ha=0;ha<Qb;ha++){switch(rb){case 0:xa.runSignificancePropogationPass();break;
case 1:xa.runMagnitudeRefinementPass();break;case 2:xa.runCleanupPass(),Nc&&xa.checkSegmentationSymbol()}rb=(rb+1)%3}var Va=ra.tbx0_-Oc+(ra.tby0_-Pc)*pb,Uc=xa.coefficentsSign,Vc=xa.coefficentsMagnitude,Wc=xa.bitsDecoded,Xc=mc?0:.5,Rb,Fa,Sb,Ea=0,Yc="LL"!==Ca.type;for(ha=0;ha<Pb;ha++){var Zc=2*(Va/pb|0)*(lc-pb)+Qc+Rc;for(Rb=0;Rb<qb;Rb++)Fa=Vc[Ea],0!==Fa&&(Fa=(Fa+Xc)*Mc,0!==Uc[Ea]&&(Fa=-Fa),Sb=Wc[Ea],Lc[Yc?Zc+(Va<<1):Va]=mc&&Sb>=Nb?Fa:Fa*(1<<Nb-Sb)),Va++,Ea++;Va+=pb-qb}}}}hc.push({width:Kb,height:ic,
items:jc})}var Tb=Ic.calculate(hc,Pa.tcx0,Pa.tcy0);Bc[Cc]={left:Pa.tcx0,top:Pa.tcy0,width:Tb.width,height:Tb.height,items:Tb.items}}var db=Oa[0],ya=new Uint8Array(db.items.length*Ta),$c={left:db.left,top:db.top,width:db.width,height:db.height,items:ya},ia,Wa,qa,vb,Ub,ea=0,da,Xa,Ya,Za,$a,Ga,sa,Ha,wb,xb;if(Fb.codingStyleDefaultParameters.multipleComponentTransform){var qc=4===Ta,Vb=Oa[0].items,rc=Oa[1].items,sc=Oa[2].items,ad=qc?Oa[3].items:null;ia=fc[0].precision-8;Wa=(128<<ia)+.5;qa=255*(1<<ia);Ub=
.5*qa;vb=-Ub;var bd=Fb.components[0],tc=Ta-3;Xa=Vb.length;if(bd.codingStyleParameters.reversibleTransformation)for(da=0;da<Xa;da++,ea+=tc)Ya=Vb[da]+Wa,Za=rc[da],$a=sc[da],sa=Ya-($a+Za>>2),Ga=sa+$a,Ha=sa+Za,ya[ea++]=0>=Ga?0:Ga>=qa?255:Ga>>ia,ya[ea++]=0>=sa?0:sa>=qa?255:sa>>ia,ya[ea++]=0>=Ha?0:Ha>=qa?255:Ha>>ia;else for(da=0;da<Xa;da++,ea+=tc)Ya=Vb[da]+Wa,Za=rc[da],$a=sc[da],Ga=Ya+1.402*$a,sa=Ya-.34413*Za-.71414*$a,Ha=Ya+1.772*Za,ya[ea++]=0>=Ga?0:Ga>=qa?255:Ga>>ia,ya[ea++]=0>=sa?0:sa>=qa?255:sa>>ia,
ya[ea++]=0>=Ha?0:Ha>=qa?255:Ha>>ia;if(qc)for(da=0,ea=3;da<Xa;da++,ea+=4)wb=ad[da],ya[ea]=wb<=vb?0:wb>=Ub?255:wb+Wa>>ia}else for(la=0;la<Ta;la++){var uc=Oa[la].items;ia=fc[la].precision-8;Wa=(128<<ia)+.5;qa=127.5*(1<<ia);vb=-qa;ea=la;da=0;for(Xa=uc.length;da<Xa;da++)xb=uc[da],ya[ea]=xb<=vb?0:xb>=qa?255:xb+Wa>>ia,ea+=Ta}gc.push($c)}this.tiles=gc;this.width=v.SIZ.Xsiz-v.SIZ.XOsiz;this.height=v.SIZ.Ysiz-v.SIZ.YOsiz;this.componentsCount=v.SIZ.Csiz}};var A=function(){function a(b,d){var e=c(Math.max(b,
d))+1;this.levels=[];for(var f=0;f<e;f++)this.levels.push({width:b,height:d,items:[]}),b=Math.ceil(b/2),d=Math.ceil(d/2)}a.prototype={reset:function(a,c){for(var b=0,d=0,e;b<this.levels.length;){e=this.levels[b];var f=a+c*e.width;if(void 0!==e.items[f]){d=e.items[f];break}e.index=f;a>>=1;c>>=1;b++}b--;e=this.levels[b];e.items[e.index]=d;this.currentLevel=b;delete this.value},incrementValue:function(){var a=this.levels[this.currentLevel];a.items[a.index]++},nextLevel:function(){var a=this.currentLevel,
c=this.levels[a],b=c.items[c.index];a--;if(0>a)return this.value=b,!1;this.currentLevel=a;c=this.levels[a];c.items[c.index]=b;return!0}};return a}(),K=function(){function a(b,d,e){var f=c(Math.max(b,d))+1;this.levels=[];for(var k=0;k<f;k++){for(var g=new Uint8Array(b*d),h=0,m=g.length;h<m;h++)g[h]=e;this.levels.push({width:b,height:d,items:g});b=Math.ceil(b/2);d=Math.ceil(d/2)}}a.prototype={reset:function(a,c,b){for(var d=0;d<this.levels.length;){var e=this.levels[d],f=a+c*e.width;e.index=f;e=e.items[f];
if(255===e)break;if(e>b)return this.currentLevel=d,this.propagateValues(),!1;a>>=1;c>>=1;d++}this.currentLevel=d-1;return!0},incrementValue:function(a){var c=this.levels[this.currentLevel];c.items[c.index]=a+1;this.propagateValues()},propagateValues:function(){for(var a=this.currentLevel,c=this.levels[a],b=c.items[c.index];0<=--a;)c=this.levels[a],c.items[c.index]=b},nextLevel:function(){var a=this.currentLevel,c=this.levels[a],b=c.items[c.index];c.items[c.index]=255;a--;if(0>a)return!1;this.currentLevel=
a;c=this.levels[a];c.items[c.index]=b;return!0}};return a}(),E=function(){function a(e,f,k,g,h){this.width=e;this.height=f;this.contextLabelTable="HH"===k?d:"HL"===k?b:c;e*=f;this.neighborsSignificance=new Uint8Array(e);this.coefficentsSign=new Uint8Array(e);this.coefficentsMagnitude=14<h?new Uint32Array(e):6<h?new Uint16Array(e):new Uint8Array(e);this.processingFlags=new Uint8Array(e);h=new Uint8Array(e);if(0!==g)for(f=0;f<e;f++)h[f]=g;this.bitsDecoded=h;this.reset()}var c=new Uint8Array([0,5,8,
0,3,7,8,0,4,7,8,0,0,0,0,0,1,6,8,0,3,7,8,0,4,7,8,0,0,0,0,0,2,6,8,0,3,7,8,0,4,7,8,0,0,0,0,0,2,6,8,0,3,7,8,0,4,7,8,0,0,0,0,0,2,6,8,0,3,7,8,0,4,7,8]),b=new Uint8Array([0,3,4,0,5,7,7,0,8,8,8,0,0,0,0,0,1,3,4,0,6,7,7,0,8,8,8,0,0,0,0,0,2,3,4,0,6,7,7,0,8,8,8,0,0,0,0,0,2,3,4,0,6,7,7,0,8,8,8,0,0,0,0,0,2,3,4,0,6,7,7,0,8,8,8]),d=new Uint8Array([0,1,2,0,1,2,2,0,2,2,2,0,0,0,0,0,3,4,5,0,4,5,5,0,5,5,5,0,0,0,0,0,6,7,7,0,7,7,7,0,7,7,7,0,0,0,0,0,8,8,8,0,8,8,8,0,8,8,8,0,0,0,0,0,8,8,8,0,8,8,8,0,8,8,8]);a.prototype={setDecoder:function(a){this.decoder=
a},reset:function(){this.contexts=new Int8Array(19);this.contexts[0]=8;this.contexts[17]=92;this.contexts[18]=6},setNeighborsSignificance:function(a,c,b){var d=this.neighborsSignificance,e=this.width,f=this.height,k=0<c;c=c+1<e;var g;0<a&&(g=b-e,k&&(d[g-1]+=16),c&&(d[g+1]+=16),d[g]+=4);a+1<f&&(g=b+e,k&&(d[g-1]+=16),c&&(d[g+1]+=16),d[g]+=4);k&&(d[b-1]+=1);c&&(d[b+1]+=1);d[b]|=128},runSignificancePropogationPass:function(){for(var a=this.decoder,c=this.width,b=this.height,d=this.coefficentsMagnitude,
e=this.coefficentsSign,f=this.neighborsSignificance,k=this.processingFlags,g=this.contexts,h=this.contextLabelTable,m=this.bitsDecoded,l=0;l<b;l+=4)for(var v=0;v<c;v++)for(var y=l*c+v,n=0;4>n;n++,y+=c){var L=l+n;if(L>=b)break;k[y]&=-2;if(!d[y]&&f[y]){if(a.readBit(g,h[f[y]])){var u=this.decodeSignBit(L,v,y);e[y]=u;d[y]=1;this.setNeighborsSignificance(L,v,y);k[y]|=2}m[y]++;k[y]|=1}}},decodeSignBit:function(a,c,b){var d=this.width,e=this.height,f=this.coefficentsMagnitude,k=this.coefficentsSign,g;g=
0<c&&0!==f[b-1];c+1<d&&0!==f[b+1]?(c=k[b+1],g?(g=k[b-1],c=1-c-g):c=1-c-c):g?(g=k[b-1],c=1-g-g):c=0;var h=3*c;g=0<a&&0!==f[b-d];a+1<e&&0!==f[b+d]?(c=k[b+d],g?(g=k[b-d],c=1-c-g+h):c=1-c-c+h):g?(g=k[b-d],c=1-g-g+h):c=h;return a=0<=c?this.decoder.readBit(this.contexts,9+c):this.decoder.readBit(this.contexts,9-c)^1},runMagnitudeRefinementPass:function(){for(var a=this.decoder,c=this.width,b=this.coefficentsMagnitude,d=this.neighborsSignificance,e=this.contexts,f=this.bitsDecoded,k=this.processingFlags,
g=c*this.height,h=4*c,m=0,l;m<g;m=l){l=Math.min(g,m+h);for(var v=0;v<c;v++)for(var y=m+v;y<l;y+=c)if(b[y]&&0===(k[y]&1)){var n=16;0!==(k[y]&2)&&(k[y]^=2,n=0===(d[y]&127)?15:14);n=a.readBit(e,n);b[y]=b[y]<<1|n;f[y]++;k[y]|=1}}},runCleanupPass:function(){for(var a=this.decoder,c=this.width,b=this.height,d=this.neighborsSignificance,e=this.coefficentsMagnitude,f=this.coefficentsSign,k=this.contexts,g=this.contextLabelTable,h=this.bitsDecoded,m=this.processingFlags,l=2*c,v=3*c,y,n=0;n<b;n=y){y=Math.min(n+
4,b);for(var L=n*c,u=n+3<b,p=0;p<c;p++){var r=L+p,q=0,A=r,t=n,x;if(u&&0===m[r]&&0===m[r+c]&&0===m[r+l]&&0===m[r+v]&&0===d[r]&&0===d[r+c]&&0===d[r+l]&&0===d[r+v]){if(!a.readBit(k,18)){h[r]++;h[r+c]++;h[r+l]++;h[r+v]++;continue}q=a.readBit(k,17)<<1|a.readBit(k,17);0!==q&&(t=n+q,A+=q*c);x=this.decodeSignBit(t,p,A);f[A]=x;e[A]=1;this.setNeighborsSignificance(t,p,A);m[A]|=2;A=r;for(r=n;r<=t;r++,A+=c)h[A]++;q++}for(t=n+q;t<y;t++,A+=c)e[A]||0!==(m[A]&1)||(1===a.readBit(k,g[d[A]])&&(x=this.decodeSignBit(t,
p,A),f[A]=x,e[A]=1,this.setNeighborsSignificance(t,p,A),m[A]|=2),h[A]++)}}},checkSegmentationSymbol:function(){var a=this.decoder,c=this.contexts;if(10!==(a.readBit(c,17)<<3|a.readBit(c,17)<<2|a.readBit(c,17)<<1|a.readBit(c,17)))throw Error("JPX Error: Invalid segmentation symbol");}};return a}(),G=function(){function a(){}a.prototype.calculate=function(a,c,b){for(var d=a[0],e=1,f=a.length;e<f;e++)d=this.iterate(d,a[e],c,b);return d};a.prototype.extend=function(a,c,b){var d=c-1,e=c+1,f=c+b-2;c+=b;
a[d--]=a[e++];a[c++]=a[f--];a[d--]=a[e++];a[c++]=a[f--];a[d--]=a[e++];a[c++]=a[f--];a[d]=a[e];a[c]=a[f]};a.prototype.iterate=function(a,c,b,d){var e=a.width,f=a.height,k=a.items,g=c.width,h=c.height;c=c.items;var m,l,v,y;for(m=v=0;m<f;m++)for(y=2*m*g,l=0;l<e;l++,v++,y+=2)c[y]=k[v];a.items=null;a=new Float32Array(g+8);if(1===g){if(0!==(b&1))for(v=y=0;y<h;y++,v+=g)c[v]*=.5}else for(v=y=0;y<h;y++,v+=g)a.set(c.subarray(v,v+g),4),this.extend(a,4,g),this.filter(a,4,g),c.set(a.subarray(4,4+g),v);b=16;e=
[];for(m=0;m<b;m++)e.push(new Float32Array(h+8));m=0;a=4+h;if(1===h){if(0!==(d&1))for(d=0;d<g;d++)c[d]*=.5}else for(d=0;d<g;d++){if(0===m){b=Math.min(g-d,b);v=d;for(y=4;y<a;v+=g,y++)for(f=0;f<b;f++)e[f][y]=c[v+f];m=b}m--;v=e[m];this.extend(v,4,h);this.filter(v,4,h);if(0===m)for(v=d-b+1,y=4;y<a;v+=g,y++)for(f=0;f<b;f++)c[v+f]=e[f][y]}return{width:g,height:h,items:c}};return a}(),O=function(){function a(){G.call(this)}a.prototype=Object.create(G.prototype);a.prototype.filter=function(a,c,b){b>>=1;c|=
0;var d,e,f,k;d=c-3;for(e=b+4;e--;d+=2)a[d]*=.8128930661159609;d=c-2;f=.443506852043971*a[d-1];for(e=b+3;e--;d+=2)if(k=.443506852043971*a[d+1],a[d]=1.230174104914001*a[d]-f-k,e--)d+=2,f=.443506852043971*a[d+1],a[d]=1.230174104914001*a[d]-f-k;else break;d=c-1;f=.882911075530934*a[d-1];for(e=b+2;e--;d+=2)if(k=.882911075530934*a[d+1],a[d]-=f+k,e--)d+=2,f=.882911075530934*a[d+1],a[d]-=f+k;else break;d=c;f=-.052980118572961*a[d-1];for(e=b+1;e--;d+=2)if(k=-.052980118572961*a[d+1],a[d]-=f+k,e--)d+=2,f=-.052980118572961*
a[d+1],a[d]-=f+k;else break;if(0!==b)for(d=c+1,f=-1.586134342059924*a[d-1],e=b;e--;d+=2)if(k=-1.586134342059924*a[d+1],a[d]-=f+k,e--)d+=2,f=-1.586134342059924*a[d+1],a[d]-=f+k;else break};return a}(),Q=function(){function a(){G.call(this)}a.prototype=Object.create(G.prototype);a.prototype.filter=function(a,c,b){b>>=1;c|=0;var d,e;d=c;for(e=b+1;e--;d+=2)a[d]-=a[d-1]+a[d+1]+2>>2;d=c+1;for(e=b;e--;d+=2)a[d]+=a[d-1]+a[d+1]>>1};return a}();return a}();"use strict";var r=function(){function a(){}function h(a,
c,b){this.data=a;this.start=c;this.end=b}function m(a,c,b){function d(a){for(var c=0,k=0;k<a;k++){var g=b.readBit(e,f);f=256>f?f<<1|g:(f<<1|g)&511|256;c=c<<1|g}return c>>>0}var e=a.getContexts(c),f=1;a=d(1);c=d(1)?d(1)?d(1)?d(1)?d(1)?d(32)+4436:d(12)+340:d(8)+84:d(6)+20:d(4)+4:d(2);return 0===a?c:0<c?-c:null}function l(a,c,b){a=a.getContexts("IAID");for(var d=1,e=0;e<b;e++)var f=c.readBit(a,d),d=d<<1|f;return 31>b?d&(1<<b)-1:d&2147483647}function p(a,c,b){var d=b.decoder;b=b.contextCache.getContexts("GB");
var e,f,k,g,h,m,l,v=[];for(f=0;f<c;f++)for(h=v[f]=new Uint8Array(a),m=1>f?h:v[f-1],l=2>f?h:v[f-2],e=l[0]<<13|l[1]<<12|l[2]<<11|m[0]<<7|m[1]<<6|m[2]<<5|m[3]<<4,k=0;k<a;k++)h[k]=g=d.readBit(b,e),e=(e&31735)<<1|(k+3<a?l[k+3]<<11:0)|(k+4<a?m[k+4]<<4:0)|g;return v}function r(a,c,b,d,e,f,k,g){a&&z("JBIG2 error: MMR encoding is not supported");if(0===d&&!f&&!e&&4===k.length&&3===k[0].x&&-1===k[0].y&&-3===k[1].x&&-1===k[1].y&&2===k[2].x&&-2===k[2].y&&-2===k[3].x&&-2===k[3].y)return p(c,b,g);a=!!f;var h=A[d].concat(k);
h.sort(function(a,c){return a.y-c.y||a.x-c.x});k=h.length;var m=new Int8Array(k),l=new Int8Array(k),v=[],y=0,n=0,u=0,q=0,t,x;for(x=0;x<k;x++)m[x]=h[x].x,l[x]=h[x].y,n=Math.min(n,h[x].x),u=Math.max(u,h[x].x),q=Math.min(q,h[x].y),x<k-1&&h[x].y===h[x+1].y&&h[x].x===h[x+1].x-1?y|=1<<k-1-x:v.push(x);var w=v.length,C=new Int8Array(w),D=new Int8Array(w),F=new Uint16Array(w);for(t=0;t<w;t++)x=v[t],C[t]=h[x].x,D[t]=h[x].y,F[t]=1<<k-1-x;h=-n;q=-q;u=c-u;d=E[d];v=new Uint8Array(c);n=[];t=g.decoder;g=g.contextCache.getContexts("GB");
for(var J=0,H,K,G,I=0,Y,ga=0;ga<b;ga++){if(e&&(x=t.readBit(g,d),J^=x)){n.push(v);continue}v=new Uint8Array(v);n.push(v);for(H=0;H<c;H++)if(a&&f[ga][H])v[H]=0;else{if(H>=h&&H<u&&ga>=q)for(I=I<<1&y,x=0;x<w;x++){if(K=ga+D[x],G=H+C[x],K=n[K][G])K=F[x],I|=K}else for(I=0,Y=k-1,x=0;x<k;x++,Y--)G=H+m[x],0<=G&&G<c&&(K=ga+l[x],0<=K&&(K=n[K][G])&&(I|=K<<Y));x=t.readBit(g,I);v[H]=x}}return n}function w(a,c,b,d,e,f,k,g,h){var m=K[b].coding;0===b&&(m=m.concat([g[0]]));var l=m.length,v=new Int32Array(l),y=new Int32Array(l),
n;for(n=0;n<l;n++)v[n]=m[n].x,y[n]=m[n].y;var u=K[b].reference;0===b&&(u=u.concat([g[1]]));g=u.length;var m=new Int32Array(g),p=new Int32Array(g);for(n=0;n<g;n++)m[n]=u[n].x,p[n]=u[n].y;var u=d[0].length,r=d.length;b=G[b];var A=[],q=h.decoder;h=h.contextCache.getContexts("GR");for(var x=0,t=0;t<c;t++){k&&(n=q.readBit(h,b),(x^=n)&&z("JBIG2 error: prediction is not supported"));var C=new Uint8Array(a);A.push(C);for(var B=0;B<a;B++){var D,F,E=0;for(n=0;n<l;n++)D=t+y[n],F=B+v[n],E=0>D||0>F||F>=a?E<<1:
E<<1|A[D][F];for(n=0;n<g;n++)D=t+p[n]+f,F=B+m[n]+e,E=0>D||D>=r||0>F||F>=u?E<<1:E<<1|d[D][F];n=q.readBit(h,E);C[B]=n}}return A}function D(a,c,b,d,e,f,k,g,h,v,n,u,p,r,A,q,t){a&&z("JBIG2 error: huffman is not supported");a=[];var x;for(r=0;r<d;r++){x=new Uint8Array(b);if(e)for(var B=0;B<b;B++)x[B]=e;a.push(x)}d=t.decoder;e=t.contextCache;var B=-m(e,"IADT",d),F=0;for(r=0;r<f;){var E=m(e,"IADT",d),B=B+E,E=m(e,"IAFS",d),E=F+=E;do{var J=1===k?0:m(e,"IAIT",d);x=k*B+J;var J=l(e,d,h),K=c&&m(e,"IARI",d),J=g[J],
G=J[0].length,I=J.length;if(K)var K=m(e,"IARDW",d),X=m(e,"IARDH",d),U=m(e,"IARDX",d),Y=m(e,"IARDY",d),G=G+K,I=I+X,J=w(G,I,A,J,(K>>1)+U,(X>>1)+Y,!1,q,t);var K=x-(u&1?0:I),X=E-(u&2?G:0),ga;if(v){for(U=0;U<I;U++)if(x=a[X+U]){ga=J[U];var fb=Math.min(b-K,G);switch(p){case 0:for(Y=0;Y<fb;Y++)x[K+Y]|=ga[Y];break;case 2:for(Y=0;Y<fb;Y++)x[K+Y]^=ga[Y];break;default:z("JBIG2 error: operator "+p+" is not supported")}}E+=I-1}else{for(Y=0;Y<I;Y++)if(x=a[K+Y])switch(ga=J[Y],p){case 0:for(U=0;U<G;U++)x[X+U]|=ga[U];
break;case 2:for(U=0;U<G;U++)x[X+U]^=ga[U];break;default:z("JBIG2 error: operator "+p+" is not supported")}E+=G-1}r++;J=m(e,"IADS",d);if(null===J)break;E+=J+n}while(1)}return a}function J(a,c){return{width:d(a,c),height:d(a,c+4),x:d(a,c+8),y:d(a,c+12),combinationOperator:a[c+16]&7}}function v(){}function t(){}a.prototype={getContexts:function(a){return a in this?this[a]:this[a]=new Int8Array(65536)}};h.prototype={get decoder(){var a=new k(this.data,this.start,this.end);return f(this,"decoder",a)},
get contextCache(){var c=new a;return f(this,"contextCache",c)}};var x=["SymbolDictionary",null,null,null,"IntermediateTextRegion",null,"ImmediateTextRegion","ImmediateLosslessTextRegion",null,null,null,null,null,null,null,null,"patternDictionary",null,null,null,"IntermediateHalftoneRegion",null,"ImmediateHalftoneRegion","ImmediateLosslessHalftoneRegion",null,null,null,null,null,null,null,null,null,null,null,null,"IntermediateGenericRegion",null,"ImmediateGenericRegion","ImmediateLosslessGenericRegion",
"IntermediateGenericRefinementRegion",null,"ImmediateGenericRefinementRegion","ImmediateLosslessGenericRefinementRegion",null,null,null,null,"PageInformation","EndOfPage","EndOfStripe","EndOfFile","Profiles","Tables",null,null,null,null,null,null,null,null,"Extension"],A=[[{x:-1,y:-2},{x:0,y:-2},{x:1,y:-2},{x:-2,y:-1},{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:2,y:-1},{x:-4,y:0},{x:-3,y:0},{x:-2,y:0},{x:-1,y:0}],[{x:-1,y:-2},{x:0,y:-2},{x:1,y:-2},{x:2,y:-2},{x:-2,y:-1},{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},
{x:2,y:-1},{x:-3,y:0},{x:-2,y:0},{x:-1,y:0}],[{x:-1,y:-2},{x:0,y:-2},{x:1,y:-2},{x:-2,y:-1},{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:-2,y:0},{x:-1,y:0}],[{x:-3,y:-1},{x:-2,y:-1},{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:-4,y:0},{x:-3,y:0},{x:-2,y:0},{x:-1,y:0}]],K=[{coding:[{x:0,y:-1},{x:1,y:-1},{x:-1,y:0}],reference:[{x:0,y:-1},{x:1,y:-1},{x:-1,y:0},{x:0,y:0},{x:1,y:0},{x:-1,y:1},{x:0,y:1},{x:1,y:1}]},{coding:[{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:-1,y:0}],reference:[{x:0,y:-1},{x:-1,y:0},{x:0,y:0},{x:1,y:0},
{x:0,y:1},{x:1,y:1}]}],E=[39717,1941,229,405],G=[32,8];v.prototype={onPageInformation:function(a){this.currentPageInfo=a;var c=new Uint8Array((a.width+7>>3)*a.height);if(a.defaultPixelValue){a=0;for(var b=c.length;a<b;a++)c[a]=255}this.buffer=c},drawBitmap:function(a,c){var b=this.currentPageInfo,d=a.width,e=a.height,f=b.width+7>>3,k=b.combinationOperatorOverride?a.combinationOperator:b.combinationOperator,b=this.buffer,g=128>>(a.x&7),h=a.y*f+(a.x>>3),m,l,v;switch(k){case 0:for(k=0;k<e;k++){l=g;v=
h;for(m=0;m<d;m++)c[k][m]&&(b[v]|=l),l>>=1,l||(l=128,v++);h+=f}break;case 2:for(k=0;k<e;k++){l=g;v=h;for(m=0;m<d;m++)c[k][m]&&(b[v]^=l),l>>=1,l||(l=128,v++);h+=f}break;default:z("JBIG2 error: operator "+k+" is not supported")}},onImmediateGenericRegion:function(a,c,b,d){var e=a.info;c=new h(c,b,d);a=r(a.mmr,e.width,e.height,a.template,a.prediction,null,a.at,c);this.drawBitmap(e,a)},onImmediateLosslessGenericRegion:function(){this.onImmediateGenericRegion.apply(this,arguments)},onSymbolDictionary:function(a,
b,d,e,f,k){a.huffman&&z("JBIG2 error: huffman is not supported");var g=this.symbols;g||(this.symbols=g={});for(var v=[],n=0,p=d.length;n<p;n++)v=v.concat(g[d[n]]);k=new h(e,f,k);n=a.huffman;p=a.refinement;d=v;var v=a.numberOfNewSymbols,A=a.template,q=a.at,x=a.refinementTemplate,t=a.refinementAt;n&&z("JBIG2 error: huffman is not supported");a=[];var B=0,E=c(d.length+v);e=k.decoder;for(f=k.contextCache;a.length<v;)for(var J=m(f,"IADH",e),B=B+J,J=0;;){var K=m(f,"IADW",e);if(null===K)break;J+=K;if(p)if(K=
m(f,"IAAI",e),1<K)K=D(n,p,J,B,0,K,1,d.concat(a),E,0,0,1,0,void 0,x,t,k);else var K=l(f,e,E),G=m(f,"IARDX",e),ta=m(f,"IARDY",e),K=w(J,B,x,K<d.length?d[K]:a[K-d.length],G,ta,!1,t,k);else K=r(!1,J,B,A,!1,null,q,k);a.push(K)}k=[];n=[];p=!1;for(A=d.length+v;n.length<A;){for(q=m(f,"IAEX",e);q--;)n.push(p);p=!p}e=0;for(f=d.length;e<f;e++)n[e]&&k.push(d[e]);for(d=0;d<v;e++,d++)n[e]&&k.push(a[d]);g[b]=k},onImmediateTextRegion:function(a,b,d,e,f){for(var k=a.info,g=this.symbols,m=[],l=0,v=b.length;l<v;l++)m=
m.concat(g[b[l]]);b=c(m.length);d=new h(d,e,f);a=D(a.huffman,a.refinement,k.width,k.height,a.defaultPixelValue,a.numberOfSymbolInstances,a.stripSize,m,b,a.transposed,a.dsOffset,a.referenceCorner,a.combinationOperator,void 0,a.refinementTemplate,a.refinementAt,d);this.drawBitmap(k,a)},onImmediateLosslessTextRegion:function(){this.onImmediateTextRegion.apply(this,arguments)}};t.prototype={parseChunks:function(a){for(var c=new v,f=0,k=a.length;f<k;f++){for(var g=a[f],h={},m=g.data,l=g.end,y=[],u=g.start;u<
l;){var g=m,p=u,u={};u.number=d(g,p);var r=g[p+4],A=r&63;x[A]||z("JBIG2 error: invalid segment type: "+A);u.type=A;u.typeName=x[A];u.deferredNonRetain=!!(r&128);var r=!!(r&64),q=g[p+5],t=q>>5&7,w=[q&31],p=p+6;if(7===q)for(t=d(g,p-1)&536870911,p+=3,q=t+7>>3,w[0]=g[p++];0<--q;)w.push(g[p++]);else 5!==q&&6!==q||z("JBIG2 error: invalid referred-to flags");u.retainBits=w;for(var C=256>=u.number?1:65536>=u.number?2:4,B=[],q=w=void 0,w=0;w<t;w++)q=1===C?g[p]:2===C?b(g,p):d(g,p),B.push(q),p+=C;u.referredTo=
B;r?(u.pageAssociation=d(g,p),p+=4):u.pageAssociation=g[p++];u.length=d(g,p);p+=4;if(4294967295===u.length)if(38===A){r=J(g,p);t=!!(g[p+17]&1);A=new Uint8Array(6);t||(A[0]=255,A[1]=172);A[2]=r.height>>>24&255;A[3]=r.height>>16&255;A[4]=r.height>>8&255;A[5]=r.height&255;w=p;for(q=g.length;w<q;w++){for(r=0;6>r&&A[r]===g[w+r];)r++;if(6===r){u.length=w+6;break}}4294967295===u.length&&z("JBIG2 error: segment end was not found")}else z("JBIG2 error: invalid unknown segment length");u.headerEnd=p;g=u;u=
g.headerEnd;p={header:g,data:m};h.randomAccess||(p.start=u,u+=g.length,p.end=u);y.push(p);if(51===g.type)break}if(h.randomAccess)for(h=0,m=y.length;h<m;h++)y[h].start=u,u+=y[h].header.length,y[h].end=u;h=c;m=0;for(l=y.length;m<l;m++){r=y[m];g=h;u=r.header;p=r.data;A=r.start;r=r.end;q=w=t=C=void 0;switch(u.type){case 0:C={};t=b(p,A);C.huffman=!!(t&1);C.refinement=!!(t&2);C.huffmanDHSelector=t>>2&3;C.huffmanDWSelector=t>>4&3;C.bitmapSizeSelector=t>>6&1;C.aggregationInstancesSelector=t>>7&1;C.bitmapCodingContextUsed=
!!(t&256);C.bitmapCodingContextRetained=!!(t&512);C.template=t>>10&3;C.refinementTemplate=t>>12&1;A+=2;if(!C.huffman){q=0===C.template?4:1;t=[];for(w=0;w<q;w++)t.push({x:p[A]<<24>>24,y:p[A+1]<<24>>24}),A+=2;C.at=t}if(C.refinement&&!C.refinementTemplate){t=[];for(w=0;2>w;w++)t.push({x:p[A]<<24>>24,y:p[A+1]<<24>>24}),A+=2;C.refinementAt=t}C.numberOfExportedSymbols=d(p,A);A+=4;C.numberOfNewSymbols=d(p,A);A+=4;C=[C,u.number,u.referredTo,p,A,r];break;case 6:case 7:q={};q.info=J(p,A);A+=17;t=b(p,A);A+=
2;q.huffman=!!(t&1);q.refinement=!!(t&2);q.stripSize=1<<(t>>2&3);q.referenceCorner=t>>4&3;q.transposed=!!(t&64);q.combinationOperator=t>>7&3;q.defaultPixelValue=t>>9&1;q.dsOffset=t<<17>>27;q.refinementTemplate=t>>15&1;q.huffman&&(t=b(p,A),A+=2,q.huffmanFS=t&3,q.huffmanDS=t>>2&3,q.huffmanDT=t>>4&3,q.huffmanRefinementDW=t>>6&3,q.huffmanRefinementDH=t>>8&3,q.huffmanRefinementDX=t>>10&3,q.huffmanRefinementDY=t>>12&3,q.huffmanRefinementSizeSelector=!!(t&14));if(q.refinement&&!q.refinementTemplate){t=[];
for(w=0;2>w;w++)t.push({x:p[A]<<24>>24,y:p[A+1]<<24>>24}),A+=2;q.refinementAt=t}q.numberOfSymbolInstances=d(p,A);A+=4;q.huffman&&z("JBIG2 error: huffman is not supported");C=[q,u.referredTo,p,A,r];break;case 38:case 39:C={};C.info=J(p,A);A+=17;t=p[A++];C.mmr=!!(t&1);C.template=t>>1&3;C.prediction=!!(t&8);if(!C.mmr){q=0===C.template?4:1;t=[];for(w=0;w<q;w++)t.push({x:p[A]<<24>>24,y:p[A+1]<<24>>24}),A+=2;C.at=t}C=[C,p,A,r];break;case 48:r={width:d(p,A),height:d(p,A+4),resolutionX:d(p,A+8),resolutionY:d(p,
A+12)};4294967295===r.height&&delete r.height;t=p[A+16];b(p,A+17);r.lossless=!!(t&1);r.refinement=!!(t&2);r.defaultPixelValue=t>>2&1;r.combinationOperator=t>>3&3;r.requiresBuffer=!!(t&32);r.combinationOperatorOverride=!!(t&64);C=[r];break;case 49:break;case 50:break;case 51:break;case 62:break;default:z("JBIG2 error: segment type "+u.typeName+"("+u.type+") is not implemented")}u="on"+u.typeName;u in g&&g[u].apply(g,C)}}return c}};return t}(),z=function(){console.error.apply(console,arguments);throw Error("PDFJS error: "+
arguments[0]);},D=function(){console.warn.apply(console,arguments)},w=function(){console.info.apply(console,arguments)};r.prototype.parse=function(a){var c=0,b=a.length;151===a[c]&&74===a[c+1]&&66===a[c+2]&&50===a[c+3]&&13===a[c+4]&&10===a[c+5]&&26===a[c+6]&&10===a[c+7]||z("JBIG2 error: invalid header");c+=8;a[c++]&2||(d(a,c),c+=4);a=this.parseChunks([{data:a,start:c,end:b}]);var c=a.currentPageInfo.width,b=a.currentPageInfo.height,e=a.buffer;a=new Uint8Array(c*b);for(var f=0,k=0,g=0;g<b;g++)for(var h=
0,m,l=0;l<c;l++)h||(h=128,m=e[k++]),a[f++]=m&h?0:255,h>>=1;this.width=c;this.height=b;this.data=a};a.JpegImage=h;a.JpxImage=l;a.Jbig2Image=r})(b||(b={}));f.exports={JpegImage:d,JpegDecoder:b.JpegImage,JpxDecoder:b.JpxImage,Jbig2Decoder:b.Jbig2Image}},function(f,d,h){var l=h(45),b=h(28),a=h(15);d.decodeRawChunk=function(c,d){var f=c.source.spec,g=f.dataType,h=a.prod3(c.chunkDataSize),k=b.DATA_TYPE_BYTES[g],f=h*k*f.numChannels;if(f!==d.byteLength)throw Error("Raw-format chunk is "+d.byteLength+" bytes, but "+
h+" * "+k+" = "+f+" bytes are expected.");h=void 0;switch(g){case b.DataType.UINT8:h=new Uint8Array(d);break;case b.DataType.UINT16:h=new Uint16Array(d);break;case b.DataType.UINT32:case b.DataType.UINT64:h=new Uint32Array(d);break;case b.DataType.FLOAT32:h=new Float32Array(d);break;default:throw Error("Unexpected data type: "+g+".");}l.postProcessRawData(c,h)}},function(f,d,h){d=h(54).assign;var l=h(55),b=h(63);h=h(67);var a={};d(a,l,b,h);f.exports=a},function(f,d){var h="undefined"!==typeof Uint8Array&&
"undefined"!==typeof Uint16Array&&"undefined"!==typeof Int32Array;d.assign=function(a){for(var c=Array.prototype.slice.call(arguments,1);c.length;){var b=c.shift();if(b){if("object"!==typeof b)throw new TypeError(b+"must be non-object");for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d])}}return a};d.shrinkBuf=function(a,c){if(a.length===c)return a;if(a.subarray)return a.subarray(0,c);a.length=c;return a};var l={arraySet:function(a,c,b,d,f){if(c.subarray&&a.subarray)a.set(c.subarray(b,b+d),f);else for(var h=
0;h<d;h++)a[f+h]=c[b+h]},flattenChunks:function(a){var c,b,d,f,h;c=d=0;for(b=a.length;c<b;c++)d+=a[c].length;h=new Uint8Array(d);c=d=0;for(b=a.length;c<b;c++)f=a[c],h.set(f,d),d+=f.length;return h}},b={arraySet:function(a,c,b,d,f){for(var h=0;h<d;h++)a[f+h]=c[b+h]},flattenChunks:function(a){return[].concat.apply([],a)}};d.setTyped=function(a){a?(d.Buf8=Uint8Array,d.Buf16=Uint16Array,d.Buf32=Int32Array,d.assign(d,l)):(d.Buf8=Array,d.Buf16=Array,d.Buf32=Array,d.assign(d,b))};d.setTyped(h)},function(f,
d,h){function l(b){if(!(this instanceof l))return new l(b);b=this.options=c.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},b||{});b.raw&&0<b.windowBits?b.windowBits=-b.windowBits:b.gzip&&0<b.windowBits&&16>b.windowBits&&(b.windowBits+=16);this.err=0;this.msg="";this.ended=!1;this.chunks=[];this.strm=new g;this.strm.avail_out=0;var d=a.deflateInit2(this.strm,b.level,b.method,b.windowBits,b.memLevel,b.strategy);if(0!==d)throw Error(n[d]);b.header&&a.deflateSetHeader(this.strm,
b.header);if(b.dictionary){b="string"===typeof b.dictionary?e.string2buf(b.dictionary):"[object ArrayBuffer]"===m.call(b.dictionary)?new Uint8Array(b.dictionary):b.dictionary;d=a.deflateSetDictionary(this.strm,b);if(0!==d)throw Error(n[d]);this._dict_set=!0}}function b(a,c){var b=new l(c);b.push(a,!0);if(b.err)throw b.msg;return b.result}var a=h(56),c=h(54),e=h(61),n=h(60),g=h(62),m=Object.prototype.toString;l.prototype.push=function(b,d){var f=this.strm,g=this.options.chunkSize,h,l;if(this.ended)return!1;
l=d===~~d?d:!0===d?4:0;"string"===typeof b?f.input=e.string2buf(b):"[object ArrayBuffer]"===m.call(b)?f.input=new Uint8Array(b):f.input=b;f.next_in=0;f.avail_in=f.input.length;do{0===f.avail_out&&(f.output=new c.Buf8(g),f.next_out=0,f.avail_out=g);h=a.deflate(f,l);if(1!==h&&0!==h)return this.onEnd(h),this.ended=!0,!1;if(0===f.avail_out||0===f.avail_in&&(4===l||2===l))if("string"===this.options.to)this.onData(e.buf2binstring(c.shrinkBuf(f.output,f.next_out)));else this.onData(c.shrinkBuf(f.output,
f.next_out))}while((0<f.avail_in||0===f.avail_out)&&1!==h);if(4===l)return h=a.deflateEnd(this.strm),this.onEnd(h),this.ended=!0,0===h;2===l&&(this.onEnd(0),f.avail_out=0);return!0};l.prototype.onData=function(a){this.chunks.push(a)};l.prototype.onEnd=function(a){0===a&&(this.result="string"===this.options.to?this.chunks.join(""):c.flattenChunks(this.chunks));this.chunks=[];this.err=a;this.msg=this.strm.msg};d.Deflate=l;d.deflate=b;d.deflateRaw=function(a,c){c=c||{};c.raw=!0;return b(a,c)};d.gzip=
function(a,c){c=c||{};c.gzip=!0;return b(a,c)}},function(f,d,h){function l(a,c){a.msg=I[c];return c}function b(a){for(var c=a.length;0<=--c;)a[c]=0}function a(a){var c=a.state,b=c.pending;b>a.avail_out&&(b=a.avail_out);0!==b&&(y.arraySet(a.output,c.pending_buf,c.pending_out,b,a.next_out),a.next_out+=b,c.pending_out+=b,a.total_out+=b,a.avail_out-=b,c.pending-=b,0===c.pending&&(c.pending_out=0))}function c(c,b){B._tr_flush_block(c,0<=c.block_start?c.block_start:-1,c.strstart-c.block_start,b);c.block_start=
c.strstart;a(c.strm)}function e(a,c){a.pending_buf[a.pending++]=c}function n(a,c){a.pending_buf[a.pending++]=c>>>8&255;a.pending_buf[a.pending++]=c&255}function g(a,c){var b=a.max_chain_length,d=a.strstart,e,f=a.prev_length,g=a.nice_match,h=a.strstart>a.w_size-262?a.strstart-(a.w_size-262):0,k=a.window,m=a.w_mask,l=a.prev,y=a.strstart+258,n=k[d+f-1],p=k[d+f];a.prev_length>=a.good_match&&(b>>=2);g>a.lookahead&&(g=a.lookahead);do if(e=c,k[e+f]===p&&k[e+f-1]===n&&k[e]===k[d]&&k[++e]===k[d+1]){d+=2;for(e++;k[++d]===
k[++e]&&k[++d]===k[++e]&&k[++d]===k[++e]&&k[++d]===k[++e]&&k[++d]===k[++e]&&k[++d]===k[++e]&&k[++d]===k[++e]&&k[++d]===k[++e]&&d<y;);e=258-(y-d);d=y-258;if(e>f){a.match_start=c;f=e;if(e>=g)break;n=k[d+f-1];p=k[d+f]}}while((c=l[c&m])>h&&0!==--b);return f<=a.lookahead?f:a.lookahead}function m(a){var c=a.w_size,b,d,e,f;do{f=a.window_size-a.lookahead-a.strstart;if(a.strstart>=c+(c-262)){y.arraySet(a.window,a.window,c,c,0);a.match_start-=c;a.strstart-=c;a.block_start-=c;b=d=a.hash_size;do e=a.head[--b],
a.head[b]=e>=c?e-c:0;while(--d);b=d=c;do e=a.prev[--b],a.prev[b]=e>=c?e-c:0;while(--d);f+=c}if(0===a.strm.avail_in)break;b=a.strm;d=a.window;e=a.strstart+a.lookahead;var k=b.avail_in;k>f&&(k=f);0===k?d=0:(b.avail_in-=k,y.arraySet(d,b.input,b.next_in,k,e),1===b.state.wrap?b.adler=F(b.adler,d,k,e):2===b.state.wrap&&(b.adler=H(b.adler,d,k,e)),b.next_in+=k,b.total_in+=k,d=k);a.lookahead+=d;if(3<=a.lookahead+a.insert)for(f=a.strstart-a.insert,a.ins_h=a.window[f],a.ins_h=(a.ins_h<<a.hash_shift^a.window[f+
1])&a.hash_mask;a.insert&&!(a.ins_h=(a.ins_h<<a.hash_shift^a.window[f+3-1])&a.hash_mask,a.prev[f&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=f,f++,a.insert--,3>a.lookahead+a.insert););}while(262>a.lookahead&&0!==a.strm.avail_in)}function k(a,b){for(var d;;){if(262>a.lookahead){m(a);if(262>a.lookahead&&0===b)return 1;if(0===a.lookahead)break}d=0;3<=a.lookahead&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+3-1])&a.hash_mask,d=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart);
0!==d&&a.strstart-d<=a.w_size-262&&(a.match_length=g(a,d));if(3<=a.match_length)if(d=B._tr_tally(a,a.strstart-a.match_start,a.match_length-3),a.lookahead-=a.match_length,a.match_length<=a.max_lazy_match&&3<=a.lookahead){a.match_length--;do a.strstart++,a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+3-1])&a.hash_mask,a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart;while(0!==--a.match_length);a.strstart++}else a.strstart+=a.match_length,a.match_length=0,a.ins_h=a.window[a.strstart],
a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+1])&a.hash_mask;else d=B._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++;if(d&&(c(a,!1),0===a.strm.avail_out))return 1}a.insert=2>a.strstart?a.strstart:2;return 4===b?(c(a,!0),0===a.strm.avail_out?3:4):a.last_lit&&(c(a,!1),0===a.strm.avail_out)?1:2}function p(a,b){for(var d,e;;){if(262>a.lookahead){m(a);if(262>a.lookahead&&0===b)return 1;if(0===a.lookahead)break}d=0;3<=a.lookahead&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+
3-1])&a.hash_mask,d=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart);a.prev_length=a.match_length;a.prev_match=a.match_start;a.match_length=2;0!==d&&a.prev_length<a.max_lazy_match&&a.strstart-d<=a.w_size-262&&(a.match_length=g(a,d),5>=a.match_length&&(1===a.strategy||3===a.match_length&&4096<a.strstart-a.match_start)&&(a.match_length=2));if(3<=a.prev_length&&a.match_length<=a.prev_length){e=a.strstart+a.lookahead-3;d=B._tr_tally(a,a.strstart-1-a.prev_match,a.prev_length-3);
a.lookahead-=a.prev_length-1;a.prev_length-=2;do++a.strstart<=e&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+3-1])&a.hash_mask,a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart);while(0!==--a.prev_length);a.match_available=0;a.match_length=2;a.strstart++;if(d&&(c(a,!1),0===a.strm.avail_out))return 1}else if(a.match_available){if((d=B._tr_tally(a,0,a.window[a.strstart-1]))&&c(a,!1),a.strstart++,a.lookahead--,0===a.strm.avail_out)return 1}else a.match_available=1,a.strstart++,
a.lookahead--}a.match_available&&(B._tr_tally(a,0,a.window[a.strstart-1]),a.match_available=0);a.insert=2>a.strstart?a.strstart:2;return 4===b?(c(a,!0),0===a.strm.avail_out?3:4):a.last_lit&&(c(a,!1),0===a.strm.avail_out)?1:2}function r(a,b){for(var d,e,f,k=a.window;;){if(258>=a.lookahead){m(a);if(258>=a.lookahead&&0===b)return 1;if(0===a.lookahead)break}a.match_length=0;if(3<=a.lookahead&&0<a.strstart&&(e=a.strstart-1,d=k[e],d===k[++e]&&d===k[++e]&&d===k[++e])){for(f=a.strstart+258;d===k[++e]&&d===
k[++e]&&d===k[++e]&&d===k[++e]&&d===k[++e]&&d===k[++e]&&d===k[++e]&&d===k[++e]&&e<f;);a.match_length=258-(f-e);a.match_length>a.lookahead&&(a.match_length=a.lookahead)}3<=a.match_length?(d=B._tr_tally(a,1,a.match_length-3),a.lookahead-=a.match_length,a.strstart+=a.match_length,a.match_length=0):(d=B._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++);if(d&&(c(a,!1),0===a.strm.avail_out))return 1}a.insert=0;return 4===b?(c(a,!0),0===a.strm.avail_out?3:4):a.last_lit&&(c(a,!1),0===a.strm.avail_out)?
1:2}function z(a,b){for(var d;;){if(0===a.lookahead&&(m(a),0===a.lookahead)){if(0===b)return 1;break}a.match_length=0;d=B._tr_tally(a,0,a.window[a.strstart]);a.lookahead--;a.strstart++;if(d&&(c(a,!1),0===a.strm.avail_out))return 1}a.insert=0;return 4===b?(c(a,!0),0===a.strm.avail_out?3:4):a.last_lit&&(c(a,!1),0===a.strm.avail_out)?1:2}function D(a,c,b,d,e){this.good_length=a;this.max_lazy=c;this.nice_length=b;this.max_chain=d;this.func=e}function w(){this.strm=null;this.status=0;this.pending_buf=
null;this.wrap=this.pending=this.pending_out=this.pending_buf_size=0;this.gzhead=null;this.gzindex=0;this.method=8;this.last_flush=-1;this.w_mask=this.w_bits=this.w_size=0;this.window=null;this.window_size=0;this.head=this.prev=null;this.nice_match=this.good_match=this.strategy=this.level=this.max_lazy_match=this.max_chain_length=this.prev_length=this.lookahead=this.match_start=this.strstart=this.match_available=this.prev_match=this.match_length=this.block_start=this.hash_shift=this.hash_mask=this.hash_bits=
this.hash_size=this.ins_h=0;this.dyn_ltree=new y.Buf16(1146);this.dyn_dtree=new y.Buf16(122);this.bl_tree=new y.Buf16(78);b(this.dyn_ltree);b(this.dyn_dtree);b(this.bl_tree);this.bl_desc=this.d_desc=this.l_desc=null;this.bl_count=new y.Buf16(16);this.heap=new y.Buf16(573);b(this.heap);this.heap_max=this.heap_len=0;this.depth=new y.Buf16(573);b(this.depth);this.bi_valid=this.bi_buf=this.insert=this.matches=this.static_len=this.opt_len=this.d_buf=this.last_lit=this.lit_bufsize=this.l_buf=0}function q(a){var c;
if(!a||!a.state)return l(a,-2);a.total_in=a.total_out=0;a.data_type=2;c=a.state;c.pending=0;c.pending_out=0;0>c.wrap&&(c.wrap=-c.wrap);c.status=c.wrap?42:113;a.adler=2===c.wrap?0:1;c.last_flush=0;B._tr_init(c);return 0}function u(a){var c=q(a);0===c&&(a=a.state,a.window_size=2*a.w_size,b(a.head),a.max_lazy_match=J[a.level].max_lazy,a.good_match=J[a.level].good_length,a.nice_match=J[a.level].nice_length,a.max_chain_length=J[a.level].max_chain,a.strstart=0,a.block_start=0,a.lookahead=0,a.insert=0,a.match_length=
a.prev_length=2,a.match_available=0,a.ins_h=0);return c}function C(a,c,b,d,e,f){if(!a)return-2;var k=1;-1===c&&(c=6);0>d?(k=0,d=-d):15<d&&(k=2,d-=16);if(1>e||9<e||8!==b||8>d||15<d||0>c||9<c||0>f||4<f)return l(a,-2);8===d&&(d=9);var g=new w;a.state=g;g.strm=a;g.wrap=k;g.gzhead=null;g.w_bits=d;g.w_size=1<<g.w_bits;g.w_mask=g.w_size-1;g.hash_bits=e+7;g.hash_size=1<<g.hash_bits;g.hash_mask=g.hash_size-1;g.hash_shift=~~((g.hash_bits+3-1)/3);g.window=new y.Buf8(2*g.w_size);g.head=new y.Buf16(g.hash_size);
g.prev=new y.Buf16(g.w_size);g.lit_bufsize=1<<e+6;g.pending_buf_size=4*g.lit_bufsize;g.pending_buf=new y.Buf8(g.pending_buf_size);g.d_buf=g.lit_bufsize>>1;g.l_buf=3*g.lit_bufsize;g.level=c;g.strategy=f;g.method=b;return u(a)}var y=h(54),B=h(57),F=h(58),H=h(59),I=h(60),J;J=[new D(0,0,0,0,function(a,b){var d=65535;for(d>a.pending_buf_size-5&&(d=a.pending_buf_size-5);;){if(1>=a.lookahead){m(a);if(0===a.lookahead&&0===b)return 1;if(0===a.lookahead)break}a.strstart+=a.lookahead;a.lookahead=0;var e=a.block_start+
d;if(0===a.strstart||a.strstart>=e)if(a.lookahead=a.strstart-e,a.strstart=e,c(a,!1),0===a.strm.avail_out)return 1;if(a.strstart-a.block_start>=a.w_size-262&&(c(a,!1),0===a.strm.avail_out))return 1}a.insert=0;if(4===b)return c(a,!0),0===a.strm.avail_out?3:4;a.strstart>a.block_start&&c(a,!1);return 1}),new D(4,4,8,4,k),new D(4,5,16,8,k),new D(4,6,32,32,k),new D(4,4,16,16,p),new D(8,16,32,32,p),new D(8,16,128,128,p),new D(8,32,128,256,p),new D(32,128,258,1024,p),new D(32,258,258,4096,p)];d.deflateInit=
function(a,c){return C(a,c,8,15,8,0)};d.deflateInit2=C;d.deflateReset=u;d.deflateResetKeep=q;d.deflateSetHeader=function(a,c){if(!a||!a.state||2!==a.state.wrap)return-2;a.state.gzhead=c;return 0};d.deflate=function(c,d){var f,g,k,h;if(!c||!c.state||5<d||0>d)return c?l(c,-2):-2;g=c.state;if(!c.output||!c.input&&0!==c.avail_in||666===g.status&&4!==d)return l(c,0===c.avail_out?-5:-2);g.strm=c;f=g.last_flush;g.last_flush=d;42===g.status&&(2===g.wrap?(c.adler=0,e(g,31),e(g,139),e(g,8),g.gzhead?(e(g,(g.gzhead.text?
1:0)+(g.gzhead.hcrc?2:0)+(g.gzhead.extra?4:0)+(g.gzhead.name?8:0)+(g.gzhead.comment?16:0)),e(g,g.gzhead.time&255),e(g,g.gzhead.time>>8&255),e(g,g.gzhead.time>>16&255),e(g,g.gzhead.time>>24&255),e(g,9===g.level?2:2<=g.strategy||2>g.level?4:0),e(g,g.gzhead.os&255),g.gzhead.extra&&g.gzhead.extra.length&&(e(g,g.gzhead.extra.length&255),e(g,g.gzhead.extra.length>>8&255)),g.gzhead.hcrc&&(c.adler=H(c.adler,g.pending_buf,g.pending,0)),g.gzindex=0,g.status=69):(e(g,0),e(g,0),e(g,0),e(g,0),e(g,0),e(g,9===g.level?
2:2<=g.strategy||2>g.level?4:0),e(g,3),g.status=113)):(k=8+(g.w_bits-8<<4)<<8,h=-1,h=2<=g.strategy||2>g.level?0:6>g.level?1:6===g.level?2:3,k|=h<<6,0!==g.strstart&&(k|=32),g.status=113,n(g,k+(31-k%31)),0!==g.strstart&&(n(g,c.adler>>>16),n(g,c.adler&65535)),c.adler=1));if(69===g.status)if(g.gzhead.extra){for(k=g.pending;g.gzindex<(g.gzhead.extra.length&65535)&&(g.pending!==g.pending_buf_size||(g.gzhead.hcrc&&g.pending>k&&(c.adler=H(c.adler,g.pending_buf,g.pending-k,k)),a(c),k=g.pending,g.pending!==
g.pending_buf_size));)e(g,g.gzhead.extra[g.gzindex]&255),g.gzindex++;g.gzhead.hcrc&&g.pending>k&&(c.adler=H(c.adler,g.pending_buf,g.pending-k,k));g.gzindex===g.gzhead.extra.length&&(g.gzindex=0,g.status=73)}else g.status=73;if(73===g.status)if(g.gzhead.name){k=g.pending;do{if(g.pending===g.pending_buf_size&&(g.gzhead.hcrc&&g.pending>k&&(c.adler=H(c.adler,g.pending_buf,g.pending-k,k)),a(c),k=g.pending,g.pending===g.pending_buf_size)){h=1;break}h=g.gzindex<g.gzhead.name.length?g.gzhead.name.charCodeAt(g.gzindex++)&
255:0;e(g,h)}while(0!==h);g.gzhead.hcrc&&g.pending>k&&(c.adler=H(c.adler,g.pending_buf,g.pending-k,k));0===h&&(g.gzindex=0,g.status=91)}else g.status=91;if(91===g.status)if(g.gzhead.comment){k=g.pending;do{if(g.pending===g.pending_buf_size&&(g.gzhead.hcrc&&g.pending>k&&(c.adler=H(c.adler,g.pending_buf,g.pending-k,k)),a(c),k=g.pending,g.pending===g.pending_buf_size)){h=1;break}h=g.gzindex<g.gzhead.comment.length?g.gzhead.comment.charCodeAt(g.gzindex++)&255:0;e(g,h)}while(0!==h);g.gzhead.hcrc&&g.pending>
k&&(c.adler=H(c.adler,g.pending_buf,g.pending-k,k));0===h&&(g.status=103)}else g.status=103;103===g.status&&(g.gzhead.hcrc?(g.pending+2>g.pending_buf_size&&a(c),g.pending+2<=g.pending_buf_size&&(e(g,c.adler&255),e(g,c.adler>>8&255),c.adler=0,g.status=113)):g.status=113);if(0!==g.pending){if(a(c),0===c.avail_out)return g.last_flush=-1,0}else if(0===c.avail_in&&(d<<1)-(4<d?9:0)<=(f<<1)-(4<f?9:0)&&4!==d)return l(c,-5);if(666===g.status&&0!==c.avail_in)return l(c,-5);if(0!==c.avail_in||0!==g.lookahead||
0!==d&&666!==g.status){f=2===g.strategy?z(g,d):3===g.strategy?r(g,d):J[g.level].func(g,d);if(3===f||4===f)g.status=666;if(1===f||3===f)return 0===c.avail_out&&(g.last_flush=-1),0;if(2===f&&(1===d?B._tr_align(g):5!==d&&(B._tr_stored_block(g,0,0,!1),3===d&&(b(g.head),0===g.lookahead&&(g.strstart=0,g.block_start=0,g.insert=0))),a(c),0===c.avail_out))return g.last_flush=-1,0}if(4!==d)return 0;if(0>=g.wrap)return 1;2===g.wrap?(e(g,c.adler&255),e(g,c.adler>>8&255),e(g,c.adler>>16&255),e(g,c.adler>>24&255),
e(g,c.total_in&255),e(g,c.total_in>>8&255),e(g,c.total_in>>16&255),e(g,c.total_in>>24&255)):(n(g,c.adler>>>16),n(g,c.adler&65535));a(c);0<g.wrap&&(g.wrap=-g.wrap);return 0!==g.pending?0:1};d.deflateEnd=function(a){var c;if(!a||!a.state)return-2;c=a.state.status;if(42!==c&&69!==c&&73!==c&&91!==c&&103!==c&&113!==c&&666!==c)return l(a,-2);a.state=null;return 113===c?l(a,-3):0};d.deflateSetDictionary=function(a,c){var d=c.length,e,f,g,k,h,l;if(!a||!a.state)return-2;e=a.state;g=e.wrap;if(2===g||1===g&&
42!==e.status||e.lookahead)return-2;1===g&&(a.adler=F(a.adler,c,d,0));e.wrap=0;d>=e.w_size&&(0===g&&(b(e.head),e.strstart=0,e.block_start=0,e.insert=0),k=new y.Buf8(e.w_size),y.arraySet(k,c,d-e.w_size,e.w_size,0),c=k,d=e.w_size);k=a.avail_in;h=a.next_in;l=a.input;a.avail_in=d;a.next_in=0;a.input=c;for(m(e);3<=e.lookahead;){d=e.strstart;f=e.lookahead-2;do e.ins_h=(e.ins_h<<e.hash_shift^e.window[d+3-1])&e.hash_mask,e.prev[d&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=d,d++;while(--f);e.strstart=d;e.lookahead=
2;m(e)}e.strstart+=e.lookahead;e.block_start=e.strstart;e.insert=e.lookahead;e.lookahead=0;e.match_length=e.prev_length=2;e.match_available=0;a.next_in=h;a.input=l;a.avail_in=k;e.wrap=g;return 0};d.deflateInfo="pako deflate (from Nodeca project)"},function(f,d,h){function l(a){for(var c=a.length;0<=--c;)a[c]=0}function b(a,c,b,d,e){this.static_tree=a;this.extra_bits=c;this.extra_base=b;this.elems=d;this.max_length=e;this.has_stree=a&&a.length}function a(a,c){this.dyn_tree=a;this.max_code=0;this.stat_desc=
c}function c(a,c){a.pending_buf[a.pending++]=c&255;a.pending_buf[a.pending++]=c>>>8&255}function e(a,b,d){a.bi_valid>16-d?(a.bi_buf|=b<<a.bi_valid&65535,c(a,a.bi_buf),a.bi_buf=b>>16-a.bi_valid,a.bi_valid+=d-16):(a.bi_buf|=b<<a.bi_valid&65535,a.bi_valid+=d)}function n(a,c,b){e(a,b[2*c],b[2*c+1])}function g(a,c){var b=0;do b|=a&1,a>>>=1,b<<=1;while(0<--c);return b>>>1}function m(a,c,b){var d=Array(16),e=0,f;for(f=1;15>=f;f++)d[f]=e=e+b[f-1]<<1;for(b=0;b<=c;b++)e=a[2*b+1],0!==e&&(a[2*b]=g(d[e]++,e))}
function k(a){var c;for(c=0;286>c;c++)a.dyn_ltree[2*c]=0;for(c=0;30>c;c++)a.dyn_dtree[2*c]=0;for(c=0;19>c;c++)a.bl_tree[2*c]=0;a.dyn_ltree[512]=1;a.opt_len=a.static_len=0;a.last_lit=a.matches=0}function p(a){8<a.bi_valid?c(a,a.bi_buf):0<a.bi_valid&&(a.pending_buf[a.pending++]=a.bi_buf);a.bi_buf=0;a.bi_valid=0}function r(a,c,b,d){var e=2*c,f=2*b;return a[e]<a[f]||a[e]===a[f]&&d[c]<=d[b]}function z(a,c,b){for(var d=a.heap[b],e=b<<1;e<=a.heap_len;){e<a.heap_len&&r(c,a.heap[e+1],a.heap[e],a.depth)&&e++;
if(r(c,d,a.heap[e],a.depth))break;a.heap[b]=a.heap[e];b=e;e<<=1}a.heap[b]=d}function D(a,c,b){var d,f,g=0,k,h;if(0!==a.last_lit){do d=a.pending_buf[a.d_buf+2*g]<<8|a.pending_buf[a.d_buf+2*g+1],f=a.pending_buf[a.l_buf+g],g++,0===d?n(a,f,c):(k=A[f],n(a,k+256+1,c),h=F[k],0!==h&&(f-=K[k],e(a,f,h)),d--,k=256>d?x[d]:x[256+(d>>>7)],n(a,k,b),h=H[k],0!==h&&(d-=E[k],e(a,d,h)));while(g<a.last_lit)}n(a,256,c)}function w(a,c){var b=c.dyn_tree,d=c.stat_desc.static_tree,e=c.stat_desc.has_stree,f=c.stat_desc.elems,
g,k=-1,h;a.heap_len=0;a.heap_max=573;for(g=0;g<f;g++)0!==b[2*g]?(a.heap[++a.heap_len]=k=g,a.depth[g]=0):b[2*g+1]=0;for(;2>a.heap_len;)h=a.heap[++a.heap_len]=2>k?++k:0,b[2*h]=1,a.depth[h]=0,a.opt_len--,e&&(a.static_len-=d[2*h+1]);c.max_code=k;for(g=a.heap_len>>1;1<=g;g--)z(a,b,g);h=f;do g=a.heap[1],a.heap[1]=a.heap[a.heap_len--],z(a,b,1),d=a.heap[1],a.heap[--a.heap_max]=g,a.heap[--a.heap_max]=d,b[2*h]=b[2*g]+b[2*d],a.depth[h]=(a.depth[g]>=a.depth[d]?a.depth[g]:a.depth[d])+1,b[2*g+1]=b[2*d+1]=h,a.heap[1]=
h++,z(a,b,1);while(2<=a.heap_len);a.heap[--a.heap_max]=a.heap[1];g=c.dyn_tree;h=c.max_code;for(var l=c.stat_desc.static_tree,y=c.stat_desc.has_stree,n=c.stat_desc.extra_bits,p=c.stat_desc.extra_base,u=c.stat_desc.max_length,r,q,w=0,f=0;15>=f;f++)a.bl_count[f]=0;g[2*a.heap[a.heap_max]+1]=0;for(d=a.heap_max+1;573>d;d++)e=a.heap[d],f=g[2*g[2*e+1]+1]+1,f>u&&(f=u,w++),g[2*e+1]=f,e>h||(a.bl_count[f]++,r=0,e>=p&&(r=n[e-p]),q=g[2*e],a.opt_len+=q*(f+r),y&&(a.static_len+=q*(l[2*e+1]+r)));if(0!==w){do{for(f=
u-1;0===a.bl_count[f];)f--;a.bl_count[f]--;a.bl_count[f+1]+=2;a.bl_count[u]--;w-=2}while(0<w);for(f=u;0!==f;f--)for(e=a.bl_count[f];0!==e;)l=a.heap[--d],l>h||(g[2*l+1]!==f&&(a.opt_len+=(f-g[2*l+1])*g[2*l],g[2*l+1]=f),e--)}m(b,k,a.bl_count)}function q(a,c,b){var d,e=-1,f,g=c[1],k=0,h=7,m=4;0===g&&(h=138,m=3);c[2*(b+1)+1]=65535;for(d=0;d<=b;d++)f=g,g=c[2*(d+1)+1],++k<h&&f===g||(k<m?a.bl_tree[2*f]+=k:0!==f?(f!==e&&a.bl_tree[2*f]++,a.bl_tree[32]++):10>=k?a.bl_tree[34]++:a.bl_tree[36]++,k=0,e=f,0===g?
(h=138,m=3):f===g?(h=6,m=3):(h=7,m=4))}function u(a,c,b){var d,f=-1,g,k=c[1],h=0,m=7,l=4;0===k&&(m=138,l=3);for(d=0;d<=b;d++)if(g=k,k=c[2*(d+1)+1],!(++h<m&&g===k)){if(h<l){do n(a,g,a.bl_tree);while(0!==--h)}else 0!==g?(g!==f&&(n(a,g,a.bl_tree),h--),n(a,16,a.bl_tree),e(a,h-3,2)):10>=h?(n(a,17,a.bl_tree),e(a,h-3,3)):(n(a,18,a.bl_tree),e(a,h-11,7));h=0;f=g;0===k?(m=138,l=3):g===k?(m=6,l=3):(m=7,l=4)}}function C(a){var c=4093624447,b;for(b=0;31>=b;b++,c>>>=1)if(c&1&&0!==a.dyn_ltree[2*b])return 0;if(0!==
a.dyn_ltree[18]||0!==a.dyn_ltree[20]||0!==a.dyn_ltree[26])return 1;for(b=32;256>b;b++)if(0!==a.dyn_ltree[2*b])return 1;return 0}function y(a,b,d,f){e(a,0+(f?1:0),3);p(a);c(a,d);c(a,~d);B.arraySet(a.pending_buf,a.window,b,d,a.pending);a.pending+=d}var B=h(54),F=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],H=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],I=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],J=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],v=Array(576);l(v);
var t=Array(60);l(t);var x=Array(512);l(x);var A=Array(256);l(A);var K=Array(29);l(K);var E=Array(30);l(E);var G,O,Q,M=!1;d._tr_init=function(c){if(!M){var d,e,f,h=Array(16);for(f=e=0;28>f;f++)for(K[f]=e,d=0;d<1<<F[f];d++)A[e++]=f;A[e-1]=f;for(f=e=0;16>f;f++)for(E[f]=e,d=0;d<1<<H[f];d++)x[e++]=f;for(e>>=7;30>f;f++)for(E[f]=e<<7,d=0;d<1<<H[f]-7;d++)x[256+e++]=f;for(d=0;15>=d;d++)h[d]=0;for(d=0;143>=d;)v[2*d+1]=8,d++,h[8]++;for(;255>=d;)v[2*d+1]=9,d++,h[9]++;for(;279>=d;)v[2*d+1]=7,d++,h[7]++;for(;287>=
d;)v[2*d+1]=8,d++,h[8]++;m(v,287,h);for(d=0;30>d;d++)t[2*d+1]=5,t[2*d]=g(d,5);G=new b(v,F,257,286,15);O=new b(t,H,0,30,15);Q=new b([],I,0,19,7);M=!0}c.l_desc=new a(c.dyn_ltree,G);c.d_desc=new a(c.dyn_dtree,O);c.bl_desc=new a(c.bl_tree,Q);c.bi_buf=0;c.bi_valid=0;k(c)};d._tr_stored_block=y;d._tr_flush_block=function(a,c,b,d){var f,g,h=0;if(0<a.level){2===a.strm.data_type&&(a.strm.data_type=C(a));w(a,a.l_desc);w(a,a.d_desc);q(a,a.dyn_ltree,a.l_desc.max_code);q(a,a.dyn_dtree,a.d_desc.max_code);w(a,a.bl_desc);
for(h=18;3<=h&&0===a.bl_tree[2*J[h]+1];h--);a.opt_len+=3*(h+1)+14;f=a.opt_len+3+7>>>3;g=a.static_len+3+7>>>3;g<=f&&(f=g)}else f=g=b+5;if(b+4<=f&&-1!==c)y(a,c,b,d);else if(4===a.strategy||g===f)e(a,2+(d?1:0),3),D(a,v,t);else{e(a,4+(d?1:0),3);c=a.l_desc.max_code+1;b=a.d_desc.max_code+1;h+=1;e(a,c-257,5);e(a,b-1,5);e(a,h-4,4);for(f=0;f<h;f++)e(a,a.bl_tree[2*J[f]+1],3);u(a,a.dyn_ltree,c-1);u(a,a.dyn_dtree,b-1);D(a,a.dyn_ltree,a.dyn_dtree)}k(a);d&&p(a)};d._tr_tally=function(a,c,b){a.pending_buf[a.d_buf+
2*a.last_lit]=c>>>8&255;a.pending_buf[a.d_buf+2*a.last_lit+1]=c&255;a.pending_buf[a.l_buf+a.last_lit]=b&255;a.last_lit++;0===c?a.dyn_ltree[2*b]++:(a.matches++,c--,a.dyn_ltree[2*(A[b]+256+1)]++,a.dyn_dtree[2*(256>c?x[c]:x[256+(c>>>7)])]++);return a.last_lit===a.lit_bufsize-1};d._tr_align=function(a){e(a,2,3);n(a,256,v);16===a.bi_valid?(c(a,a.bi_buf),a.bi_buf=0,a.bi_valid=0):8<=a.bi_valid&&(a.pending_buf[a.pending++]=a.bi_buf&255,a.bi_buf>>=8,a.bi_valid-=8)}},function(f,d){f.exports=function(d,f,b,
a){var c=d&65535|0;d=d>>>16&65535|0;for(var e=0;0!==b;){e=2E3<b?2E3:b;b-=e;do c=c+f[a++]|0,d=d+c|0;while(--e);c%=65521;d%=65521}return c|d<<16|0}},function(f,d){var h=function(){for(var d,b=[],a=0;256>a;a++){d=a;for(var c=0;8>c;c++)d=d&1?3988292384^d>>>1:d>>>1;b[a]=d}return b}();f.exports=function(d,b,a,c){a=c+a;for(d^=-1;c<a;c++)d=d>>>8^h[(d^b[c])&255];return d^-1}},function(f,d){f.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory",
"-5":"buffer error","-6":"incompatible version"}},function(f,d,h){function l(d,e){if(65537>e&&(d.subarray&&c||!d.subarray&&a))return String.fromCharCode.apply(null,b.shrinkBuf(d,e));for(var f="",k=0;k<e;k++)f+=String.fromCharCode(d[k]);return f}var b=h(54),a=!0,c=!0;try{String.fromCharCode.apply(null,[0])}catch(n){a=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(n){c=!1}var e=new b.Buf8(256);for(f=0;256>f;f++)e[f]=252<=f?6:248<=f?5:240<=f?4:224<=f?3:192<=f?2:1;e[254]=e[254]=1;d.string2buf=
function(a){var c,d,e,f,h,l=a.length,D=0;for(f=0;f<l;f++)d=a.charCodeAt(f),55296===(d&64512)&&f+1<l&&(e=a.charCodeAt(f+1),56320===(e&64512)&&(d=65536+(d-55296<<10)+(e-56320),f++)),D+=128>d?1:2048>d?2:65536>d?3:4;c=new b.Buf8(D);for(f=h=0;h<D;f++)d=a.charCodeAt(f),55296===(d&64512)&&f+1<l&&(e=a.charCodeAt(f+1),56320===(e&64512)&&(d=65536+(d-55296<<10)+(e-56320),f++)),128>d?c[h++]=d:(2048>d?c[h++]=192|d>>>6:(65536>d?c[h++]=224|d>>>12:(c[h++]=240|d>>>18,c[h++]=128|d>>>12&63),c[h++]=128|d>>>6&63),c[h++]=
128|d&63);return c};d.buf2binstring=function(a){return l(a,a.length)};d.binstring2buf=function(a){for(var c=new b.Buf8(a.length),d=0,e=c.length;d<e;d++)c[d]=a.charCodeAt(d);return c};d.buf2string=function(a,c){var b,d,f,h,z=c||a.length,D=Array(2*z);for(b=d=0;b<z;)if(f=a[b++],128>f)D[d++]=f;else if(h=e[f],4<h)D[d++]=65533,b+=h-1;else{for(f&=2===h?31:3===h?15:7;1<h&&b<z;)f=f<<6|a[b++]&63,h--;1<h?D[d++]=65533:65536>f?D[d++]=f:(f-=65536,D[d++]=55296|f>>10&1023,D[d++]=56320|f&1023)}return l(D,d)};d.utf8border=
function(a,c){var b;c=c||a.length;c>a.length&&(c=a.length);for(b=c-1;0<=b&&128===(a[b]&192);)b--;return 0>b||0===b?c:b+e[a[b]]>c?b:c}},function(f,d){f.exports=function(){this.input=null;this.total_in=this.avail_in=this.next_in=0;this.output=null;this.total_out=this.avail_out=this.next_out=0;this.msg="";this.state=null;this.data_type=2;this.adler=0}},function(f,d,h){function l(b){if(!(this instanceof l))return new l(b);var d=this.options=c.assign({chunkSize:16384,windowBits:0,to:""},b||{});d.raw&&
0<=d.windowBits&&16>d.windowBits&&(d.windowBits=-d.windowBits,0===d.windowBits&&(d.windowBits=-15));!(0<=d.windowBits&&16>d.windowBits)||b&&b.windowBits||(d.windowBits+=32);15<d.windowBits&&48>d.windowBits&&0===(d.windowBits&15)&&(d.windowBits|=15);this.err=0;this.msg="";this.ended=!1;this.chunks=[];this.strm=new m;this.strm.avail_out=0;b=a.inflateInit2(this.strm,d.windowBits);if(b!==n.Z_OK)throw Error(g[b]);this.header=new k;a.inflateGetHeader(this.strm,this.header)}function b(a,c){var b=new l(c);
b.push(a,!0);if(b.err)throw b.msg;return b.result}var a=h(64),c=h(54),e=h(61),n=h(67),g=h(60),m=h(62),k=h(68),p=Object.prototype.toString;l.prototype.push=function(b,d){var f=this.strm,g=this.options.chunkSize,k=this.options.dictionary,h,l,m,B,F,H=!1;if(this.ended)return!1;l=d===~~d?d:!0===d?n.Z_FINISH:n.Z_NO_FLUSH;"string"===typeof b?f.input=e.binstring2buf(b):"[object ArrayBuffer]"===p.call(b)?f.input=new Uint8Array(b):f.input=b;f.next_in=0;f.avail_in=f.input.length;do{0===f.avail_out&&(f.output=
new c.Buf8(g),f.next_out=0,f.avail_out=g);h=a.inflate(f,n.Z_NO_FLUSH);h===n.Z_NEED_DICT&&k&&(h="string"===typeof k?e.string2buf(k):"[object ArrayBuffer]"===p.call(k)?new Uint8Array(k):k,h=a.inflateSetDictionary(this.strm,h));h===n.Z_BUF_ERROR&&!0===H&&(h=n.Z_OK,H=!1);if(h!==n.Z_STREAM_END&&h!==n.Z_OK)return this.onEnd(h),this.ended=!0,!1;if(f.next_out&&(0===f.avail_out||h===n.Z_STREAM_END||0===f.avail_in&&(l===n.Z_FINISH||l===n.Z_SYNC_FLUSH)))if("string"===this.options.to)m=e.utf8border(f.output,
f.next_out),B=f.next_out-m,F=e.buf2string(f.output,m),f.next_out=B,f.avail_out=g-B,B&&c.arraySet(f.output,f.output,m,B,0),this.onData(F);else this.onData(c.shrinkBuf(f.output,f.next_out));0===f.avail_in&&0===f.avail_out&&(H=!0)}while((0<f.avail_in||0===f.avail_out)&&h!==n.Z_STREAM_END);h===n.Z_STREAM_END&&(l=n.Z_FINISH);if(l===n.Z_FINISH)return h=a.inflateEnd(this.strm),this.onEnd(h),this.ended=!0,h===n.Z_OK;l===n.Z_SYNC_FLUSH&&(this.onEnd(n.Z_OK),f.avail_out=0);return!0};l.prototype.onData=function(a){this.chunks.push(a)};
l.prototype.onEnd=function(a){a===n.Z_OK&&(this.result="string"===this.options.to?this.chunks.join(""):c.flattenChunks(this.chunks));this.chunks=[];this.err=a;this.msg=this.strm.msg};d.Inflate=l;d.inflate=b;d.inflateRaw=function(a,c){c=c||{};c.raw=!0;return b(a,c)};d.ungzip=b},function(f,d,h){function l(a){return(a>>>24&255)+(a>>>8&65280)+((a&65280)<<8)+((a&255)<<24)}function b(){this.mode=0;this.last=!1;this.wrap=0;this.havedict=!1;this.total=this.check=this.dmax=this.flags=0;this.head=null;this.wnext=
this.whave=this.wsize=this.wbits=0;this.window=null;this.extra=this.offset=this.length=this.bits=this.hold=0;this.distcode=this.lencode=null;this.have=this.ndist=this.nlen=this.ncode=this.distbits=this.lenbits=0;this.next=null;this.lens=new m.Buf16(320);this.work=new m.Buf16(288);this.distdyn=this.lendyn=null;this.was=this.back=this.sane=0}function a(a){var c;if(!a||!a.state)return-2;c=a.state;a.total_in=a.total_out=c.total=0;a.msg="";c.wrap&&(a.adler=c.wrap&1);c.mode=1;c.last=0;c.havedict=0;c.dmax=
32768;c.head=null;c.hold=0;c.bits=0;c.lencode=c.lendyn=new m.Buf32(852);c.distcode=c.distdyn=new m.Buf32(592);c.sane=1;c.back=-1;return 0}function c(c){var b;if(!c||!c.state)return-2;b=c.state;b.wsize=0;b.whave=0;b.wnext=0;return a(c)}function e(a,b){var d,e;if(!a||!a.state)return-2;e=a.state;0>b?(d=0,b=-b):(d=(b>>4)+1,48>b&&(b&=15));if(b&&(8>b||15<b))return-2;null!==e.window&&e.wbits!==b&&(e.window=null);e.wrap=d;e.wbits=b;return c(a)}function n(a,c){var d;if(!a)return-2;d=new b;a.state=d;d.window=
null;d=e(a,c);0!==d&&(a.state=null);return d}function g(a,c,b,d){var e=a.state;null===e.window&&(e.wsize=1<<e.wbits,e.wnext=0,e.whave=0,e.window=new m.Buf8(e.wsize));d>=e.wsize?(m.arraySet(e.window,c,b-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):(a=e.wsize-e.wnext,a>d&&(a=d),m.arraySet(e.window,c,b-d,a,e.wnext),(d-=a)?(m.arraySet(e.window,c,b-d,d,0),e.wnext=d,e.whave=e.wsize):(e.wnext+=a,e.wnext===e.wsize&&(e.wnext=0),e.whave<e.wsize&&(e.whave+=a)));return 0}var m=h(54),k=h(58),p=h(59),r=h(65),
z=h(66),D=!0,w,q;d.inflateReset=c;d.inflateReset2=e;d.inflateResetKeep=a;d.inflateInit=function(a){return n(a,15)};d.inflateInit2=n;d.inflate=function(a,c){var b,d,e,f,h,n,v,t,x,A,K,E,G,O,Q=0,M,L,S,T=new m.Buf8(4),P=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!a||!a.state||!a.output||!a.input&&0!==a.avail_in)return-2;b=a.state;12===b.mode&&(b.mode=13);h=a.next_out;e=a.output;v=a.avail_out;f=a.next_in;d=a.input;n=a.avail_in;t=b.hold;x=b.bits;A=n;K=v;S=0;a:for(;;)switch(b.mode){case 1:if(0===
b.wrap){b.mode=13;break}for(;16>x;){if(0===n)break a;n--;t+=d[f++]<<x;x+=8}if(b.wrap&2&&35615===t){b.check=0;T[0]=t&255;T[1]=t>>>8&255;b.check=p(b.check,T,2,0);x=t=0;b.mode=2;break}b.flags=0;b.head&&(b.head.done=!1);if(!(b.wrap&1)||(((t&255)<<8)+(t>>8))%31){a.msg="incorrect header check";b.mode=30;break}if(8!==(t&15)){a.msg="unknown compression method";b.mode=30;break}t>>>=4;x-=4;G=(t&15)+8;if(0===b.wbits)b.wbits=G;else if(G>b.wbits){a.msg="invalid window size";b.mode=30;break}b.dmax=1<<G;a.adler=
b.check=1;b.mode=t&512?10:12;x=t=0;break;case 2:for(;16>x;){if(0===n)break a;n--;t+=d[f++]<<x;x+=8}b.flags=t;if(8!==(b.flags&255)){a.msg="unknown compression method";b.mode=30;break}if(b.flags&57344){a.msg="unknown header flags set";b.mode=30;break}b.head&&(b.head.text=t>>8&1);b.flags&512&&(T[0]=t&255,T[1]=t>>>8&255,b.check=p(b.check,T,2,0));x=t=0;b.mode=3;case 3:for(;32>x;){if(0===n)break a;n--;t+=d[f++]<<x;x+=8}b.head&&(b.head.time=t);b.flags&512&&(T[0]=t&255,T[1]=t>>>8&255,T[2]=t>>>16&255,T[3]=
t>>>24&255,b.check=p(b.check,T,4,0));x=t=0;b.mode=4;case 4:for(;16>x;){if(0===n)break a;n--;t+=d[f++]<<x;x+=8}b.head&&(b.head.xflags=t&255,b.head.os=t>>8);b.flags&512&&(T[0]=t&255,T[1]=t>>>8&255,b.check=p(b.check,T,2,0));x=t=0;b.mode=5;case 5:if(b.flags&1024){for(;16>x;){if(0===n)break a;n--;t+=d[f++]<<x;x+=8}b.length=t;b.head&&(b.head.extra_len=t);b.flags&512&&(T[0]=t&255,T[1]=t>>>8&255,b.check=p(b.check,T,2,0));x=t=0}else b.head&&(b.head.extra=null);b.mode=6;case 6:if(b.flags&1024&&(E=b.length,
E>n&&(E=n),E&&(b.head&&(G=b.head.extra_len-b.length,b.head.extra||(b.head.extra=Array(b.head.extra_len)),m.arraySet(b.head.extra,d,f,E,G)),b.flags&512&&(b.check=p(b.check,d,E,f)),n-=E,f+=E,b.length-=E),b.length))break a;b.length=0;b.mode=7;case 7:if(b.flags&2048){if(0===n)break a;E=0;do G=d[f+E++],b.head&&G&&65536>b.length&&(b.head.name+=String.fromCharCode(G));while(G&&E<n);b.flags&512&&(b.check=p(b.check,d,E,f));n-=E;f+=E;if(G)break a}else b.head&&(b.head.name=null);b.length=0;b.mode=8;case 8:if(b.flags&
4096){if(0===n)break a;E=0;do G=d[f+E++],b.head&&G&&65536>b.length&&(b.head.comment+=String.fromCharCode(G));while(G&&E<n);b.flags&512&&(b.check=p(b.check,d,E,f));n-=E;f+=E;if(G)break a}else b.head&&(b.head.comment=null);b.mode=9;case 9:if(b.flags&512){for(;16>x;){if(0===n)break a;n--;t+=d[f++]<<x;x+=8}if(t!==(b.check&65535)){a.msg="header crc mismatch";b.mode=30;break}x=t=0}b.head&&(b.head.hcrc=b.flags>>9&1,b.head.done=!0);a.adler=b.check=0;b.mode=12;break;case 10:for(;32>x;){if(0===n)break a;n--;
t+=d[f++]<<x;x+=8}a.adler=b.check=l(t);x=t=0;b.mode=11;case 11:if(0===b.havedict)return a.next_out=h,a.avail_out=v,a.next_in=f,a.avail_in=n,b.hold=t,b.bits=x,2;a.adler=b.check=1;b.mode=12;case 12:if(5===c||6===c)break a;case 13:if(b.last){t>>>=x&7;x-=x&7;b.mode=27;break}for(;3>x;){if(0===n)break a;n--;t+=d[f++]<<x;x+=8}b.last=t&1;t>>>=1;--x;switch(t&3){case 0:b.mode=14;break;case 1:E=b;if(D){G=void 0;w=new m.Buf32(512);q=new m.Buf32(32);for(G=0;144>G;)E.lens[G++]=8;for(;256>G;)E.lens[G++]=9;for(;280>
G;)E.lens[G++]=7;for(;288>G;)E.lens[G++]=8;z(1,E.lens,0,288,w,0,E.work,{bits:9});for(G=0;32>G;)E.lens[G++]=5;z(2,E.lens,0,32,q,0,E.work,{bits:5});D=!1}E.lencode=w;E.lenbits=9;E.distcode=q;E.distbits=5;b.mode=20;if(6===c){t>>>=2;x-=2;break a}break;case 2:b.mode=17;break;case 3:a.msg="invalid block type",b.mode=30}t>>>=2;x-=2;break;case 14:t>>>=x&7;for(x-=x&7;32>x;){if(0===n)break a;n--;t+=d[f++]<<x;x+=8}if((t&65535)!==(t>>>16^65535)){a.msg="invalid stored block lengths";b.mode=30;break}b.length=t&
65535;x=t=0;b.mode=15;if(6===c)break a;case 15:b.mode=16;case 16:if(E=b.length){E>n&&(E=n);E>v&&(E=v);if(0===E)break a;m.arraySet(e,d,f,E,h);n-=E;f+=E;v-=E;h+=E;b.length-=E;break}b.mode=12;break;case 17:for(;14>x;){if(0===n)break a;n--;t+=d[f++]<<x;x+=8}b.nlen=(t&31)+257;t>>>=5;x-=5;b.ndist=(t&31)+1;t>>>=5;x-=5;b.ncode=(t&15)+4;t>>>=4;x-=4;if(286<b.nlen||30<b.ndist){a.msg="too many length or distance symbols";b.mode=30;break}b.have=0;b.mode=18;case 18:for(;b.have<b.ncode;){for(;3>x;){if(0===n)break a;
n--;t+=d[f++]<<x;x+=8}b.lens[P[b.have++]]=t&7;t>>>=3;x-=3}for(;19>b.have;)b.lens[P[b.have++]]=0;b.lencode=b.lendyn;b.lenbits=7;E={bits:b.lenbits};S=z(0,b.lens,0,19,b.lencode,0,b.work,E);b.lenbits=E.bits;if(S){a.msg="invalid code lengths set";b.mode=30;break}b.have=0;b.mode=19;case 19:for(;b.have<b.nlen+b.ndist;){for(;;){Q=b.lencode[t&(1<<b.lenbits)-1];E=Q>>>24;Q&=65535;if(E<=x)break;if(0===n)break a;n--;t+=d[f++]<<x;x+=8}if(16>Q)t>>>=E,x-=E,b.lens[b.have++]=Q;else{if(16===Q){for(G=E+2;x<G;){if(0===
n)break a;n--;t+=d[f++]<<x;x+=8}t>>>=E;x-=E;if(0===b.have){a.msg="invalid bit length repeat";b.mode=30;break}G=b.lens[b.have-1];E=3+(t&3);t>>>=2;x-=2}else if(17===Q){for(G=E+3;x<G;){if(0===n)break a;n--;t+=d[f++]<<x;x+=8}t>>>=E;x-=E;G=0;E=3+(t&7);t>>>=3;x-=3}else{for(G=E+7;x<G;){if(0===n)break a;n--;t+=d[f++]<<x;x+=8}t>>>=E;x-=E;G=0;E=11+(t&127);t>>>=7;x-=7}if(b.have+E>b.nlen+b.ndist){a.msg="invalid bit length repeat";b.mode=30;break}for(;E--;)b.lens[b.have++]=G}}if(30===b.mode)break;if(0===b.lens[256]){a.msg=
"invalid code -- missing end-of-block";b.mode=30;break}b.lenbits=9;E={bits:b.lenbits};S=z(1,b.lens,0,b.nlen,b.lencode,0,b.work,E);b.lenbits=E.bits;if(S){a.msg="invalid literal/lengths set";b.mode=30;break}b.distbits=6;b.distcode=b.distdyn;E={bits:b.distbits};S=z(2,b.lens,b.nlen,b.ndist,b.distcode,0,b.work,E);b.distbits=E.bits;if(S){a.msg="invalid distances set";b.mode=30;break}b.mode=20;if(6===c)break a;case 20:b.mode=21;case 21:if(6<=n&&258<=v){a.next_out=h;a.avail_out=v;a.next_in=f;a.avail_in=n;
b.hold=t;b.bits=x;r(a,K);h=a.next_out;e=a.output;v=a.avail_out;f=a.next_in;d=a.input;n=a.avail_in;t=b.hold;x=b.bits;12===b.mode&&(b.back=-1);break}for(b.back=0;;){Q=b.lencode[t&(1<<b.lenbits)-1];E=Q>>>24;G=Q>>>16&255;Q&=65535;if(E<=x)break;if(0===n)break a;n--;t+=d[f++]<<x;x+=8}if(G&&0===(G&240)){O=E;M=G;for(L=Q;;){Q=b.lencode[L+((t&(1<<O+M)-1)>>O)];E=Q>>>24;G=Q>>>16&255;Q&=65535;if(O+E<=x)break;if(0===n)break a;n--;t+=d[f++]<<x;x+=8}t>>>=O;x-=O;b.back+=O}t>>>=E;x-=E;b.back+=E;b.length=Q;if(0===G){b.mode=
26;break}if(G&32){b.back=-1;b.mode=12;break}if(G&64){a.msg="invalid literal/length code";b.mode=30;break}b.extra=G&15;b.mode=22;case 22:if(b.extra){for(G=b.extra;x<G;){if(0===n)break a;n--;t+=d[f++]<<x;x+=8}b.length+=t&(1<<b.extra)-1;t>>>=b.extra;x-=b.extra;b.back+=b.extra}b.was=b.length;b.mode=23;case 23:for(;;){Q=b.distcode[t&(1<<b.distbits)-1];E=Q>>>24;G=Q>>>16&255;Q&=65535;if(E<=x)break;if(0===n)break a;n--;t+=d[f++]<<x;x+=8}if(0===(G&240)){O=E;M=G;for(L=Q;;){Q=b.distcode[L+((t&(1<<O+M)-1)>>O)];
E=Q>>>24;G=Q>>>16&255;Q&=65535;if(O+E<=x)break;if(0===n)break a;n--;t+=d[f++]<<x;x+=8}t>>>=O;x-=O;b.back+=O}t>>>=E;x-=E;b.back+=E;if(G&64){a.msg="invalid distance code";b.mode=30;break}b.offset=Q;b.extra=G&15;b.mode=24;case 24:if(b.extra){for(G=b.extra;x<G;){if(0===n)break a;n--;t+=d[f++]<<x;x+=8}b.offset+=t&(1<<b.extra)-1;t>>>=b.extra;x-=b.extra;b.back+=b.extra}if(b.offset>b.dmax){a.msg="invalid distance too far back";b.mode=30;break}b.mode=25;case 25:if(0===v)break a;E=K-v;if(b.offset>E){E=b.offset-
E;if(E>b.whave&&b.sane){a.msg="invalid distance too far back";b.mode=30;break}E>b.wnext?(E-=b.wnext,G=b.wsize-E):G=b.wnext-E;E>b.length&&(E=b.length);O=b.window}else O=e,G=h-b.offset,E=b.length;E>v&&(E=v);v-=E;b.length-=E;do e[h++]=O[G++];while(--E);0===b.length&&(b.mode=21);break;case 26:if(0===v)break a;e[h++]=b.length;v--;b.mode=21;break;case 27:if(b.wrap){for(;32>x;){if(0===n)break a;n--;t|=d[f++]<<x;x+=8}K-=v;a.total_out+=K;b.total+=K;K&&(a.adler=b.check=b.flags?p(b.check,e,K,h-K):k(b.check,
e,K,h-K));K=v;if((b.flags?t:l(t))!==b.check){a.msg="incorrect data check";b.mode=30;break}x=t=0}b.mode=28;case 28:if(b.wrap&&b.flags){for(;32>x;){if(0===n)break a;n--;t+=d[f++]<<x;x+=8}if(t!==(b.total&4294967295)){a.msg="incorrect length check";b.mode=30;break}x=t=0}b.mode=29;case 29:S=1;break a;case 30:S=-3;break a;case 31:return-4;default:return-2}a.next_out=h;a.avail_out=v;a.next_in=f;a.avail_in=n;b.hold=t;b.bits=x;if((b.wsize||K!==a.avail_out&&30>b.mode&&(27>b.mode||4!==c))&&g(a,a.output,a.next_out,
K-a.avail_out))return b.mode=31,-4;A-=a.avail_in;K-=a.avail_out;a.total_in+=A;a.total_out+=K;b.total+=K;b.wrap&&K&&(a.adler=b.check=b.flags?p(b.check,e,K,a.next_out-K):k(b.check,e,K,a.next_out-K));a.data_type=b.bits+(b.last?64:0)+(12===b.mode?128:0)+(20===b.mode||15===b.mode?256:0);(0===A&&0===K||4===c)&&0===S&&(S=-5);return S};d.inflateEnd=function(a){if(!a||!a.state)return-2;var b=a.state;b.window&&(b.window=null);a.state=null;return 0};d.inflateGetHeader=function(a,b){var c;if(!a||!a.state)return-2;
c=a.state;if(0===(c.wrap&2))return-2;c.head=b;b.done=!1;return 0};d.inflateSetDictionary=function(a,b){var c=b.length,d,e;if(!a||!a.state)return-2;d=a.state;if(0!==d.wrap&&11!==d.mode)return-2;if(11===d.mode&&(e=k(1,b,c,0),e!==d.check))return-3;if(g(a,b,c,c))return d.mode=31,-4;d.havedict=1;return 0};d.inflateInfo="pako inflate (from Nodeca project)"},function(f,d){f.exports=function(d,f){var b,a,c,e,n,g,m,k,p,r,z,D,w,q,u,C,y,B,F,H,I,J,v,t;b=d.state;a=d.next_in;v=d.input;c=a+(d.avail_in-5);e=d.next_out;
t=d.output;n=e-(f-d.avail_out);g=e+(d.avail_out-257);m=b.dmax;k=b.wsize;p=b.whave;r=b.wnext;z=b.window;D=b.hold;w=b.bits;q=b.lencode;u=b.distcode;C=(1<<b.lenbits)-1;y=(1<<b.distbits)-1;a:do b:for(15>w&&(D+=v[a++]<<w,w+=8,D+=v[a++]<<w,w+=8),B=q[D&C];;){F=B>>>24;D>>>=F;w-=F;F=B>>>16&255;if(0===F)t[e++]=B&65535;else if(F&16){H=B&65535;if(F&=15)w<F&&(D+=v[a++]<<w,w+=8),H+=D&(1<<F)-1,D>>>=F,w-=F;15>w&&(D+=v[a++]<<w,w+=8,D+=v[a++]<<w,w+=8);B=u[D&y];c:for(;;){F=B>>>24;D>>>=F;w-=F;F=B>>>16&255;if(F&16){B&=
65535;F&=15;w<F&&(D+=v[a++]<<w,w+=8,w<F&&(D+=v[a++]<<w,w+=8));B+=D&(1<<F)-1;if(B>m){d.msg="invalid distance too far back";b.mode=30;break a}D>>>=F;w-=F;F=e-n;if(B>F){F=B-F;if(F>p&&b.sane){d.msg="invalid distance too far back";b.mode=30;break a}I=0;J=z;if(0===r){if(I+=k-F,F<H){H-=F;do t[e++]=z[I++];while(--F);I=e-B;J=t}}else if(r<F){if(I+=k+r-F,F-=r,F<H){H-=F;do t[e++]=z[I++];while(--F);I=0;if(r<H){F=r;H-=F;do t[e++]=z[I++];while(--F);I=e-B;J=t}}}else if(I+=r-F,F<H){H-=F;do t[e++]=z[I++];while(--F);
I=e-B;J=t}for(;2<H;)t[e++]=J[I++],t[e++]=J[I++],t[e++]=J[I++],H-=3;H&&(t[e++]=J[I++],1<H&&(t[e++]=J[I++]))}else{I=e-B;do t[e++]=t[I++],t[e++]=t[I++],t[e++]=t[I++],H-=3;while(2<H);H&&(t[e++]=t[I++],1<H&&(t[e++]=t[I++]))}}else if(0===(F&64)){B=u[(B&65535)+(D&(1<<F)-1)];continue c}else{d.msg="invalid distance code";b.mode=30;break a}break}}else if(0===(F&64)){B=q[(B&65535)+(D&(1<<F)-1)];continue b}else{F&32?b.mode=12:(d.msg="invalid literal/length code",b.mode=30);break a}break}while(a<c&&e<g);H=w>>
3;a-=H;w-=H<<3;d.next_in=a;d.next_out=e;d.avail_in=a<c?5+(c-a):5-(a-c);d.avail_out=e<g?257+(g-e):257-(e-g);b.hold=D&(1<<w)-1;b.bits=w}},function(f,d,h){var l=h(54),b=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],a=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],c=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],e=[16,16,16,16,17,17,18,18,
19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];f.exports=function(d,f,h,k,p,r,z,D){for(var w=D.bits,q=0,u=0,C=0,y=0,B=0,F=0,H=0,I=0,J=0,v=0,t,x,A=null,K=0,E,G=new l.Buf16(16),F=new l.Buf16(16),O=null,Q=0,M,L,S,q=0;15>=q;q++)G[q]=0;for(u=0;u<k;u++)G[f[h+u]]++;B=w;for(y=15;1<=y&&0===G[y];y--);B>y&&(B=y);if(0===y)return p[r++]=20971520,p[r++]=20971520,D.bits=1,0;for(C=1;C<y&&0===G[C];C++);B<C&&(B=C);for(q=I=1;15>=q;q++)if(I<<=1,I-=G[q],0>I)return-1;if(0<I&&(0===d||1!==y))return-1;
F[1]=0;for(q=1;15>q;q++)F[q+1]=F[q]+G[q];for(u=0;u<k;u++)0!==f[h+u]&&(z[F[f[h+u]]++]=u);0===d?(A=O=z,E=19):1===d?(A=b,K-=257,O=a,Q-=257,E=256):(A=c,O=e,E=-1);u=v=0;q=C;w=r;F=B;H=0;x=-1;J=1<<B;k=J-1;if(1===d&&852<J||2===d&&592<J)return 1;for(var T=0;;){T++;M=q-H;z[u]<E?(L=0,S=z[u]):z[u]>E?(L=O[Q+z[u]],S=A[K+z[u]]):(L=96,S=0);I=1<<q-H;C=t=1<<F;do t-=I,p[w+(v>>H)+t]=M<<24|L<<16|S|0;while(0!==t);for(I=1<<q-1;v&I;)I>>=1;0!==I?(v&=I-1,v+=I):v=0;u++;if(0===--G[q]){if(q===y)break;q=f[h+z[u]]}if(q>B&&(v&k)!==
x){0===H&&(H=B);w+=C;F=q-H;for(I=1<<F;F+H<y;){I-=G[F+H];if(0>=I)break;F++;I<<=1}J+=1<<F;if(1===d&&852<J||2===d&&592<J)return 1;x=v&k;p[x]=B<<24|F<<16|w-r|0}}0!==v&&(p[w+v]=q-H<<24|4194304);D.bits=B;return 0}},function(f,d){f.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,
Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},function(f,d){f.exports=function(){this.os=this.xflags=this.time=this.text=0;this.extra=null;this.extra_len=0;this.comment=this.name="";this.hcrc=0;this.done=!1}},function(f,d,h){function l(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,
writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var b=function(){function a(b,c){for(var d=0;d<c.length;d++){var e=c[d];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(b,e.key,e)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),a=h(4);f=h(12);d=h(44);var c=h(70),e=h(52),n=h(33);h=h(2);var g=new Map;g.set("npz",c.decodeNdstoreNpzChunk);g.set("jpeg",d.decodeJpegChunk);g.set("raw",
e.decodeRawChunk);f=function(c){function d(a,b){if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");var c;c=Object.getPrototypeOf(d).call(this,a,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;c.hostnames=b.hostnames;c.key=b.key;c.channel=b.channel;c.resolution=b.resolution;c.encoding=b.encoding;c.chunkDecoder=g.get(c.encoding);return c}l(d,c);b(d,[{key:"download",
value:function(b){for(var c="/ocp/ca/"+this.key+"/"+this.channel+"/"+this.encoding+"/"+this.resolution,d=this.computeChunkBounds(b),e=b.chunkDataSize,f=0;3>f;++f)c+="/"+d[f]+","+(d[f]+e[f]);a.handleChunkDownloadPromise(b,n.sendHttpRequest(n.openShardedHttpRequest(this.hostnames,c+"/neariso/"),"arraybuffer"),this.chunkDecoder)}},{key:"toString",value:function(){return"ndstore:volume:"+this.hostnames[0]+"/"+this.key+"/"+this.channel+"/"+this.resolution+"/"+this.encoding}}]);return d}(f.VolumeChunkSource);
h.registerSharedObject("ndstore/VolumeChunkSource",f)},function(f,d,h){var l=h(45),b=h(13),a=h(15),c=h(71),e=h(53);d.decodeNdstoreNpzChunk=function(d,f){var h=c.parseNpy(e.inflate(new Uint8Array(f))),k=d.chunkDataSize,p=d.source,r=p.spec.numChannels,z=h.shape;if(4!==z.length||z[0]!==r||z[1]!==k[2]||z[2]!==k[1]||z[3]!==k[0])throw Error("Shape "+JSON.stringify(z)+" does not match chunkDataSize "+a.vec3Key(k));k=h.dataType.dataType;p=p.spec;if(k!==p.dataType)throw Error("Data type "+b.DataType[k]+" does not match expected data type "+
b.DataType[p.dataType]);l.postProcessRawData(d,h.data)}},function(f,d,h){var l=function(){return function(a,b){if(Array.isArray(a))return a;$jscomp.initSymbol();$jscomp.initSymbolIterator();if(Symbol.iterator in Object(a)){var c=[],d=!0,e=!1,f=void 0;try{$jscomp.initSymbol();$jscomp.initSymbolIterator();for(var g=a[Symbol.iterator](),h;!(d=(h=g.next()).done)&&(c.push(h.value),!b||c.length!==b);d=!0);}catch(l){e=!0,f=l}finally{try{if(!d&&g["return"])g["return"]()}finally{if(e)throw f;}}return c}throw new TypeError("Invalid attempt to destructure non-iterable instance");
}}(),b=h(28),a=h(41),c=h(42),e=new Map;e.set("|u1",{arrayConstructor:Uint8Array,fixEndianness:function(a){},javascriptElementsPerArrayElement:1,elementBytes:1,dataType:b.DataType.UINT8});f=function(c){g=l(c,2);c=g[0];var d=g[1];e.set(c+"u2",{arrayConstructor:Uint16Array,elementBytes:2,fixEndianness:function(b){a.convertEndian16(b,d)},javascriptElementsPerArrayElement:1,dataType:b.DataType.UINT16});e.set(c+"u4",{arrayConstructor:Uint32Array,elementBytes:4,fixEndianness:function(b){a.convertEndian32(b,
d)},javascriptElementsPerArrayElement:1,dataType:b.DataType.UINT32});e.set(c+"u8",{arrayConstructor:Uint32Array,elementBytes:8,fixEndianness:function(b){a.convertEndian32(b,d)},javascriptElementsPerArrayElement:2,dataType:b.DataType.UINT64});e.set(c+"f4",{arrayConstructor:Float32Array,elementBytes:4,fixEndianness:function(b){a.convertEndian32(b,d)},javascriptElementsPerArrayElement:1,dataType:b.DataType.FLOAT32})};h=$jscomp.makeIterator([["<",a.Endianness.LITTLE],[">",a.Endianness.BIG]]);for(var n=
h.next();!n.done;n=h.next()){var g;f(n.value)}var m=function p(a,b,c,d){if(!(this instanceof p))throw new TypeError("Cannot call a class as a function");this.data=a;this.shape=b;this.dataType=c;this.fortranOrder=d};d.NumpyArray=m;d.parseNpy=function(a){if(147!==a[0]||78!==a[1]||85!==a[2]||77!==a[3]||80!==a[4]||89!==a[5])throw Error("Data does not match npy format.");var b=a[6],d=a[7];if(1!==b||0!==d)throw Error("Unsupported npy version "+b+"."+d);var d=(new DataView(a.buffer,a.byteOffset,a.byteLength)).getUint16(8,
!0),f=(new TextDecoder("utf-8")).decode(a.subarray(10,d+10)),b=void 0,d=d+10;try{b=c.pythonLiteralParse(f)}catch(g){throw Error("Failed to parse npy header: "+g);}var h=b.descr,f=b.shape,l=1;if(!Array.isArray(f))throw Error("Invalid shape ${JSON.stringify(shape)}");for(var n=$jscomp.makeIterator(f),C=n.next();!C.done;C=n.next()){C=C.value;if("number"!==typeof C)throw Error("Invalid shape ${JSON.stringify(shape)}");l*=C}n=e.get(h);if(void 0===n)throw Error("Unsupported numpy data type "+JSON.stringify(h));
h=n.arrayConstructor;l*=n.javascriptElementsPerArrayElement;if(h.BYTES_PER_ELEMENT*l+d!==a.byteLength)throw Error("Expected length does not match length of data");a=new h(a.buffer,a.byteOffset+d,l);n.fixEndianness(a);return new m(a,f,n,!0===b.fortran_order)}},function(f,d,h){function l(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function b(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&
"function"!==typeof b?a:b}function a(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var c=function(){function a(b,c){for(var d=0;d<c.length;d++){var e=c[d];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(b,
e.key,e)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),e=h(4),n=h(73);f=h(12);d=h(44);var g=h(52),m=h(33);h=h(2);var k=new Map([[n.TileEncoding.JPEG,d.decodeJpegChunk]]);d=function(d){function f(a,c){l(this,f);var d=b(this,Object.getPrototypeOf(f).call(this,a,c));d.parameters=c.parameters;return d}a(f,d);c(f,[{key:"download",value:function(a){var b=this.parameters,c=void 0,c=this.computeChunkBounds(a),d=a.chunkDataSize,c="/api/node/"+b.nodeKey+"/"+b.dataInstanceKey+"/raw/0_1_2/"+
d[0]+"_"+d[1]+"_"+d[2]+"/"+c[0]+"_"+c[1]+"_"+c[2]+"/nd";e.handleChunkDownloadPromise(a,m.sendHttpRequest(m.openShardedHttpRequest(b.baseUrls,c),"arraybuffer"),g.decodeRawChunk)}},{key:"toString",value:function(){return n.volumeSourceToString(this.parameters)}}]);return f}(f.VolumeChunkSource);h.registerSharedObject("dvid/VolumeChunkSource",d);f=function(d){function f(a,c){l(this,f);var d=b(this,Object.getPrototypeOf(f).call(this,a,c));d.parameters=c.parameters;d.chunkDecoder=k.get(d.parameters.encoding);
return d}a(f,d);c(f,[{key:"download",value:function(a){var b=this.parameters,c=a.chunkGridPosition;a.chunkDataSize=this.spec.chunkDataSize;e.handleChunkDownloadPromise(a,m.sendHttpRequest(m.openShardedHttpRequest(b.baseUrls,"/api/node/"+b.nodeKey+"/"+b.dataInstanceKey+"/tile/"+b.dims+"/"+b.level+"/"+c[0]+"_"+c[1]+"_"+c[2]),"arraybuffer"),this.chunkDecoder)}},{key:"toString",value:function(){return n.tileSourceToString(this.parameters)}}]);return f}(f.VolumeChunkSource);h.registerSharedObject("dvid/TileChunkSource",
f)},function(f,d){(function(d){d[d.JPEG=0]="JPEG"})(d.TileEncoding||(d.TileEncoding={}));var h=d.TileEncoding;d.volumeSourceToString=function(d){return"dvid:volume:"+d.baseUrls[0]+"/"+d.nodeKey+"/"+d.dataInstanceKey+"/"+d.level};d.tileSourceToString=function(d){return"dvid:volume:"+d.baseUrls[0]+"/"+d.nodeKey+"/"+d.dataInstanceKey+"/"+d.dims+"/"+d.level+"/"+h[d.encoding]}},function(f,d,h){h(69)},function(f,d,h){function l(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
}function b(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function a(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function c(a,b){return m.decodeJsonManifestChunk(a,
b,"fragments")}function e(a,b){var c=(new DataView(b)).getUint32(0,!0);m.decodeVertexPositionsAndIndices(a,b,D.Endianness.LITTLE,4,c)}var n=function(){function a(b,c){for(var d=0;d<c.length;d++){var e=c[d];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(b,e.key,e)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),g=h(4);f=h(76);var m=h(36),k=h(12),p=h(43),r=h(44),z=h(52),D=h(41),w=h(33);h=h(2);var q=new Map;q.set(f.VolumeChunkEncoding.RAW,
z.decodeRawChunk);q.set(f.VolumeChunkEncoding.JPEG,r.decodeJpegChunk);q.set(f.VolumeChunkEncoding.COMPRESSED_SEGMENTATION,p.decodeCompressedSegmentationChunk);f=function(c){function d(a,c){l(this,d);var e=b(this,Object.getPrototypeOf(d).call(this,a,c));e.baseUrls=c.baseUrls;e.path=c.path;e.encoding=c.encoding;e.chunkDecoder=q.get(e.encoding);return e}a(d,c);n(d,[{key:"download",value:function(a){var b=void 0,b=this.computeChunkBounds(a),c=a.chunkDataSize,b=this.path+"/"+b[0]+"-"+(b[0]+c[0])+"_"+b[1]+
"-"+(b[1]+c[1])+"_"+b[2]+"-"+(b[2]+c[2]);g.handleChunkDownloadPromise(a,w.sendHttpRequest(w.openShardedHttpRequest(this.baseUrls,b),"arraybuffer"),this.chunkDecoder)}},{key:"toString",value:function(){return"precomputed:volume:"+this.baseUrls[0]+"/"+this.path}}]);return d}(k.VolumeChunkSource);h.registerSharedObject("precomputed/VolumeChunkSource",f);d.decodeManifestChunk=c;d.decodeFragmentChunk=e;f=function(d){function f(a,c){l(this,f);var d=b(this,Object.getPrototypeOf(f).call(this,a,c));d.baseUrls=
c.baseUrls;d.path=c.path;d.lod=c.lod;return d}a(f,d);n(f,[{key:"download",value:function(a){g.handleChunkDownloadPromise(a,w.sendHttpRequest(w.openShardedHttpRequest(this.baseUrls,this.path+"/"+a.objectId+":"+this.lod),"json"),c)}},{key:"downloadFragment",value:function(a){g.handleChunkDownloadPromise(a,w.sendHttpRequest(w.openShardedHttpRequest(this.baseUrls,this.path+"/"+a.fragmentId),"arraybuffer"),e)}},{key:"toString",value:function(){return"precomputed:mesh:"+this.baseUrls[0]+"/"+this.path}}]);
return f}(m.MeshSource);d.MeshSource=f;h.registerSharedObject("precomputed/MeshSource",f)},function(f,d){var h=d.VolumeChunkEncoding||(d.VolumeChunkEncoding={});h[h.RAW=0]="RAW";h[h.JPEG=1]="JPEG";h[h.COMPRESSED_SEGMENTATION=2]="COMPRESSED_SEGMENTATION"},function(f,d,h){function l(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function b(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&
"function"!==typeof b?a:b}function a(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function c(a,b){var c=(new DataView(b)).getUint32(0,!0);k.decodeVertexPositionsAndIndices(a,b,D.Endianness.LITTLE,4,c)}function e(a,b){a.fragmentIds=[""]}var n=
function(){function a(b,c){for(var d=0;d<c.length;d++){var e=c[d];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(b,e.key,e)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),g=h(4),m=h(78),k=h(36);f=h(12);var p=h(44),r=h(70),z=h(52),D=h(41),w=h(33);h=h(2);var q=new Map;q.set(m.VolumeChunkEncoding.NPZ,r.decodeNdstoreNpzChunk);q.set(m.VolumeChunkEncoding.JPEG,p.decodeJpegChunk);q.set(m.VolumeChunkEncoding.RAW,z.decodeRawChunk);f=function(c){function d(a,
c){l(this,d);var e=b(this,Object.getPrototypeOf(d).call(this,a,c));e.parameters=c.parameters;e.chunkDecoder=q.get(e.parameters.encoding);e.encoding=m.VolumeChunkEncoding[e.parameters.encoding].toLowerCase();return e}a(d,c);n(d,[{key:"download",value:function(a){for(var b=this.parameters,c="/neuroglancer/"+this.encoding+"/"+b.key,d=this.computeChunkBounds(a),e=a.chunkDataSize,f=0;3>f;++f)c+="/"+d[f]+","+(d[f]+e[f]);g.handleChunkDownloadPromise(a,w.sendHttpRequest(w.openShardedHttpRequest(b.baseUrls,
c),"arraybuffer"),this.chunkDecoder)}},{key:"toString",value:function(){return m.volumeSourceToString(this.parameters)}}]);return d}(f.VolumeChunkSource);h.registerSharedObject("python/VolumeChunkSource",f);d.decodeFragmentChunk=c;f=function(d){function f(a,c){l(this,f);var d=b(this,Object.getPrototypeOf(f).call(this,a,c));d.parameters=c.parameters;return d}a(f,d);n(f,[{key:"download",value:function(a){g.handleChunkDownloadPromise(a,Promise.resolve(void 0),e)}},{key:"downloadFragment",value:function(a){var b=
this.parameters;g.handleChunkDownloadPromise(a,w.sendHttpRequest(w.openShardedHttpRequest(b.baseUrls,"/neuroglancer/mesh/"+b.key+"/"+a.manifestChunk.objectId),"arraybuffer"),c)}},{key:"toString",value:function(){return m.meshSourceToString(this.parameters)}}]);return f}(k.MeshSource);d.MeshSource=f;h.registerSharedObject("python/MeshSource",f)},function(f,d){(function(d){d[d.JPEG=0]="JPEG";d[d.NPZ=1]="NPZ";d[d.RAW=2]="RAW"})(d.VolumeChunkEncoding||(d.VolumeChunkEncoding={}));var h=d.VolumeChunkEncoding;
d.volumeSourceToString=function(d){return"python:volume:"+d.baseUrls[0]+"/"+d.key+"/"+h[d.encoding]};d.meshSourceToString=function(d){return"python:mesh:"+d.baseUrls[0]+"/"+d.key}}]);
